@lightharu/krouter 1.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/LICENSE +679 -0
- package/README.md +238 -0
- package/dist-web/assets/index-CM4-0adf.css +1 -0
- package/dist-web/assets/index-DCslvfUR.js +139 -0
- package/dist-web/favicon.svg +9 -0
- package/dist-web/icon.svg +9 -0
- package/dist-web/index.html +19 -0
- package/out-server/main/kiroAuthSync.js +249 -0
- package/out-server/main/kproxy/certManager.js +262 -0
- package/out-server/main/kproxy/index.js +254 -0
- package/out-server/main/kproxy/mitmProxy.js +475 -0
- package/out-server/main/kproxy/types.js +23 -0
- package/out-server/main/proxy/accountPool.js +543 -0
- package/out-server/main/proxy/clientConfig.js +596 -0
- package/out-server/main/proxy/index.js +25 -0
- package/out-server/main/proxy/kiroApi.js +1996 -0
- package/out-server/main/proxy/logger.js +407 -0
- package/out-server/main/proxy/modelCatalog.js +75 -0
- package/out-server/main/proxy/promptCacheTracker.js +301 -0
- package/out-server/main/proxy/proxyServer.js +3543 -0
- package/out-server/main/proxy/selfSignedCert.js +179 -0
- package/out-server/main/proxy/systemProxy.js +250 -0
- package/out-server/main/proxy/tokenCounter.js +164 -0
- package/out-server/main/proxy/toolNameRegistry.js +57 -0
- package/out-server/main/proxy/translator.js +1084 -0
- package/out-server/main/proxy/types.js +3 -0
- package/out-server/main/registration/browser-identity.js +184 -0
- package/out-server/main/registration/chainProxy.js +349 -0
- package/out-server/main/registration/config.js +58 -0
- package/out-server/main/registration/email-service.js +801 -0
- package/out-server/main/registration/fingerprint.js +352 -0
- package/out-server/main/registration/http-utils.js +148 -0
- package/out-server/main/registration/jwe.js +74 -0
- package/out-server/main/registration/names.js +142 -0
- package/out-server/main/registration/proton-mail-window.js +339 -0
- package/out-server/main/registration/registrar.js +1715 -0
- package/out-server/main/registration/tlsClientPool.js +70 -0
- package/out-server/main/registration/xxtea.js +161 -0
- package/out-server/main/runtimePaths.js +19 -0
- package/out-server/main/utils/redact.js +95 -0
- package/out-server/server/index.js +1272 -0
- package/out-server/server/services/accountExtras.js +105 -0
- package/out-server/server/services/accountProfileHydration.js +95 -0
- package/out-server/server/services/authFlows.js +509 -0
- package/out-server/server/services/dashboardTunnel.js +315 -0
- package/out-server/server/services/diagnostics.js +326 -0
- package/out-server/server/services/kiroAccounts.js +431 -0
- package/out-server/server/services/kiroSettings.js +260 -0
- package/out-server/server/services/kproxyRuntime.js +264 -0
- package/out-server/server/services/localKiroCredentials.js +320 -0
- package/out-server/server/services/machineIdRuntime.js +327 -0
- package/out-server/server/services/protonBrowserRuntime.js +724 -0
- package/out-server/server/services/proxyRuntime.js +523 -0
- package/out-server/server/services/registrationRuntime.js +106 -0
- package/out-server/server/store.js +266 -0
- package/package.json +113 -0
- package/resources/tls-client-xgo-1.14.0-windows-amd64.dll +0 -0
- package/scripts/kiro-manager-cli.cjs +3 -0
- package/scripts/krouter-cli.cjs +509 -0
- package/src/renderer/src/assets/krouter-logo.svg +11 -0
- package/src/renderer/src/assets/krouter-mark.svg +9 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const d of o)if(d.type==="childList")for(const u of d.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).observe(document,{childList:!0,subtree:!0});function r(o){const d={};return o.integrity&&(d.integrity=o.integrity),o.referrerPolicy&&(d.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?d.credentials="include":o.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function i(o){if(o.ep)return;o.ep=!0;const d=r(o);fetch(o.href,d)}})();function qk(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Ym={exports:{}},Qo={};var Yy;function Xk(){if(Yy)return Qo;Yy=1;var n=Symbol.for("react.transitional.element"),s=Symbol.for("react.fragment");function r(i,o,d){var u=null;if(d!==void 0&&(u=""+d),o.key!==void 0&&(u=""+o.key),"key"in o){d={};for(var h in o)h!=="key"&&(d[h]=o[h])}else d=o;return o=d.ref,{$$typeof:n,type:i,key:u,ref:o!==void 0?o:null,props:d}}return Qo.Fragment=s,Qo.jsx=r,Qo.jsxs=r,Qo}var Wy;function Yk(){return Wy||(Wy=1,Ym.exports=Xk()),Ym.exports}var e=Yk(),Wm={exports:{}},At={};var Qy;function Wk(){if(Qy)return At;Qy=1;var n=Symbol.for("react.transitional.element"),s=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),u=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),v=Symbol.iterator;function N(C){return C===null||typeof C!="object"?null:(C=v&&C[v]||C["@@iterator"],typeof C=="function"?C:null)}var j={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},T=Object.assign,S={};function k(C,z,X){this.props=C,this.context=z,this.refs=S,this.updater=X||j}k.prototype.isReactComponent={},k.prototype.setState=function(C,z){if(typeof C!="object"&&typeof C!="function"&&C!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,C,z,"setState")},k.prototype.forceUpdate=function(C){this.updater.enqueueForceUpdate(this,C,"forceUpdate")};function R(){}R.prototype=k.prototype;function I(C,z,X){this.props=C,this.context=z,this.refs=S,this.updater=X||j}var M=I.prototype=new R;M.constructor=I,T(M,k.prototype),M.isPureReactComponent=!0;var G=Array.isArray;function W(){}var U={H:null,A:null,T:null,S:null},q=Object.prototype.hasOwnProperty;function V(C,z,X){var re=X.ref;return{$$typeof:n,type:C,key:z,ref:re!==void 0?re:null,props:X}}function le(C,z){return V(C.type,z,C.props)}function B(C){return typeof C=="object"&&C!==null&&C.$$typeof===n}function be(C){var z={"=":"=0",":":"=2"};return"$"+C.replace(/[=:]/g,function(X){return z[X]})}var K=/\/+/g;function se(C,z){return typeof C=="object"&&C!==null&&C.key!=null?be(""+C.key):z.toString(36)}function te(C){switch(C.status){case"fulfilled":return C.value;case"rejected":throw C.reason;default:switch(typeof C.status=="string"?C.then(W,W):(C.status="pending",C.then(function(z){C.status==="pending"&&(C.status="fulfilled",C.value=z)},function(z){C.status==="pending"&&(C.status="rejected",C.reason=z)})),C.status){case"fulfilled":return C.value;case"rejected":throw C.reason}}throw C}function Y(C,z,X,re,xe){var Oe=typeof C;(Oe==="undefined"||Oe==="boolean")&&(C=null);var Ee=!1;if(C===null)Ee=!0;else switch(Oe){case"bigint":case"string":case"number":Ee=!0;break;case"object":switch(C.$$typeof){case n:case s:Ee=!0;break;case y:return Ee=C._init,Y(Ee(C._payload),z,X,re,xe)}}if(Ee)return xe=xe(C),Ee=re===""?"."+se(C,0):re,G(xe)?(X="",Ee!=null&&(X=Ee.replace(K,"$&/")+"/"),Y(xe,z,X,"",function(st){return st})):xe!=null&&(B(xe)&&(xe=le(xe,X+(xe.key==null||C&&C.key===xe.key?"":(""+xe.key).replace(K,"$&/")+"/")+Ee)),z.push(xe)),1;Ee=0;var Qe=re===""?".":re+":";if(G(C))for(var _e=0;_e<C.length;_e++)re=C[_e],Oe=Qe+se(re,_e),Ee+=Y(re,z,X,Oe,xe);else if(_e=N(C),typeof _e=="function")for(C=_e.call(C),_e=0;!(re=C.next()).done;)re=re.value,Oe=Qe+se(re,_e++),Ee+=Y(re,z,X,Oe,xe);else if(Oe==="object"){if(typeof C.then=="function")return Y(te(C),z,X,re,xe);throw z=String(C),Error("Objects are not valid as a React child (found: "+(z==="[object Object]"?"object with keys {"+Object.keys(C).join(", ")+"}":z)+"). If you meant to render a collection of children, use an array instead.")}return Ee}function P(C,z,X){if(C==null)return C;var re=[],xe=0;return Y(C,re,"","",function(Oe){return z.call(X,Oe,xe++)}),re}function F(C){if(C._status===-1){var z=C._result;z=z(),z.then(function(X){(C._status===0||C._status===-1)&&(C._status=1,C._result=X)},function(X){(C._status===0||C._status===-1)&&(C._status=2,C._result=X)}),C._status===-1&&(C._status=0,C._result=z)}if(C._status===1)return C._result.default;throw C._result}var fe=typeof reportError=="function"?reportError:function(C){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var z=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof C=="object"&&C!==null&&typeof C.message=="string"?String(C.message):String(C),error:C});if(!window.dispatchEvent(z))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",C);return}console.error(C)},pe={map:P,forEach:function(C,z,X){P(C,function(){z.apply(this,arguments)},X)},count:function(C){var z=0;return P(C,function(){z++}),z},toArray:function(C){return P(C,function(z){return z})||[]},only:function(C){if(!B(C))throw Error("React.Children.only expected to receive a single React element child.");return C}};return At.Activity=b,At.Children=pe,At.Component=k,At.Fragment=r,At.Profiler=o,At.PureComponent=I,At.StrictMode=i,At.Suspense=f,At.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=U,At.__COMPILER_RUNTIME={__proto__:null,c:function(C){return U.H.useMemoCache(C)}},At.cache=function(C){return function(){return C.apply(null,arguments)}},At.cacheSignal=function(){return null},At.cloneElement=function(C,z,X){if(C==null)throw Error("The argument must be a React element, but you passed "+C+".");var re=T({},C.props),xe=C.key;if(z!=null)for(Oe in z.key!==void 0&&(xe=""+z.key),z)!q.call(z,Oe)||Oe==="key"||Oe==="__self"||Oe==="__source"||Oe==="ref"&&z.ref===void 0||(re[Oe]=z[Oe]);var Oe=arguments.length-2;if(Oe===1)re.children=X;else if(1<Oe){for(var Ee=Array(Oe),Qe=0;Qe<Oe;Qe++)Ee[Qe]=arguments[Qe+2];re.children=Ee}return V(C.type,xe,re)},At.createContext=function(C){return C={$$typeof:u,_currentValue:C,_currentValue2:C,_threadCount:0,Provider:null,Consumer:null},C.Provider=C,C.Consumer={$$typeof:d,_context:C},C},At.createElement=function(C,z,X){var re,xe={},Oe=null;if(z!=null)for(re in z.key!==void 0&&(Oe=""+z.key),z)q.call(z,re)&&re!=="key"&&re!=="__self"&&re!=="__source"&&(xe[re]=z[re]);var Ee=arguments.length-2;if(Ee===1)xe.children=X;else if(1<Ee){for(var Qe=Array(Ee),_e=0;_e<Ee;_e++)Qe[_e]=arguments[_e+2];xe.children=Qe}if(C&&C.defaultProps)for(re in Ee=C.defaultProps,Ee)xe[re]===void 0&&(xe[re]=Ee[re]);return V(C,Oe,xe)},At.createRef=function(){return{current:null}},At.forwardRef=function(C){return{$$typeof:h,render:C}},At.isValidElement=B,At.lazy=function(C){return{$$typeof:y,_payload:{_status:-1,_result:C},_init:F}},At.memo=function(C,z){return{$$typeof:p,type:C,compare:z===void 0?null:z}},At.startTransition=function(C){var z=U.T,X={};U.T=X;try{var re=C(),xe=U.S;xe!==null&&xe(X,re),typeof re=="object"&&re!==null&&typeof re.then=="function"&&re.then(W,fe)}catch(Oe){fe(Oe)}finally{z!==null&&X.types!==null&&(z.types=X.types),U.T=z}},At.unstable_useCacheRefresh=function(){return U.H.useCacheRefresh()},At.use=function(C){return U.H.use(C)},At.useActionState=function(C,z,X){return U.H.useActionState(C,z,X)},At.useCallback=function(C,z){return U.H.useCallback(C,z)},At.useContext=function(C){return U.H.useContext(C)},At.useDebugValue=function(){},At.useDeferredValue=function(C,z){return U.H.useDeferredValue(C,z)},At.useEffect=function(C,z){return U.H.useEffect(C,z)},At.useEffectEvent=function(C){return U.H.useEffectEvent(C)},At.useId=function(){return U.H.useId()},At.useImperativeHandle=function(C,z,X){return U.H.useImperativeHandle(C,z,X)},At.useInsertionEffect=function(C,z){return U.H.useInsertionEffect(C,z)},At.useLayoutEffect=function(C,z){return U.H.useLayoutEffect(C,z)},At.useMemo=function(C,z){return U.H.useMemo(C,z)},At.useOptimistic=function(C,z){return U.H.useOptimistic(C,z)},At.useReducer=function(C,z,X){return U.H.useReducer(C,z,X)},At.useRef=function(C){return U.H.useRef(C)},At.useState=function(C){return U.H.useState(C)},At.useSyncExternalStore=function(C,z,X){return U.H.useSyncExternalStore(C,z,X)},At.useTransition=function(){return U.H.useTransition()},At.version="19.2.1",At}var Zy;function zp(){return Zy||(Zy=1,Wm.exports=Wk()),Wm.exports}var g=zp();const Yd=qk(g);var Qm={exports:{}},Zo={},Zm={exports:{}},Jm={};var Jy;function Qk(){return Jy||(Jy=1,(function(n){function s(Y,P){var F=Y.length;Y.push(P);e:for(;0<F;){var fe=F-1>>>1,pe=Y[fe];if(0<o(pe,P))Y[fe]=P,Y[F]=pe,F=fe;else break e}}function r(Y){return Y.length===0?null:Y[0]}function i(Y){if(Y.length===0)return null;var P=Y[0],F=Y.pop();if(F!==P){Y[0]=F;e:for(var fe=0,pe=Y.length,C=pe>>>1;fe<C;){var z=2*(fe+1)-1,X=Y[z],re=z+1,xe=Y[re];if(0>o(X,F))re<pe&&0>o(xe,X)?(Y[fe]=xe,Y[re]=F,fe=re):(Y[fe]=X,Y[z]=F,fe=z);else if(re<pe&&0>o(xe,F))Y[fe]=xe,Y[re]=F,fe=re;else break e}}return P}function o(Y,P){var F=Y.sortIndex-P.sortIndex;return F!==0?F:Y.id-P.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;n.unstable_now=function(){return d.now()}}else{var u=Date,h=u.now();n.unstable_now=function(){return u.now()-h}}var f=[],p=[],y=1,b=null,v=3,N=!1,j=!1,T=!1,S=!1,k=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,I=typeof setImmediate<"u"?setImmediate:null;function M(Y){for(var P=r(p);P!==null;){if(P.callback===null)i(p);else if(P.startTime<=Y)i(p),P.sortIndex=P.expirationTime,s(f,P);else break;P=r(p)}}function G(Y){if(T=!1,M(Y),!j)if(r(f)!==null)j=!0,W||(W=!0,be());else{var P=r(p);P!==null&&te(G,P.startTime-Y)}}var W=!1,U=-1,q=5,V=-1;function le(){return S?!0:!(n.unstable_now()-V<q)}function B(){if(S=!1,W){var Y=n.unstable_now();V=Y;var P=!0;try{e:{j=!1,T&&(T=!1,R(U),U=-1),N=!0;var F=v;try{t:{for(M(Y),b=r(f);b!==null&&!(b.expirationTime>Y&&le());){var fe=b.callback;if(typeof fe=="function"){b.callback=null,v=b.priorityLevel;var pe=fe(b.expirationTime<=Y);if(Y=n.unstable_now(),typeof pe=="function"){b.callback=pe,M(Y),P=!0;break t}b===r(f)&&i(f),M(Y)}else i(f);b=r(f)}if(b!==null)P=!0;else{var C=r(p);C!==null&&te(G,C.startTime-Y),P=!1}}break e}finally{b=null,v=F,N=!1}P=void 0}}finally{P?be():W=!1}}}var be;if(typeof I=="function")be=function(){I(B)};else if(typeof MessageChannel<"u"){var K=new MessageChannel,se=K.port2;K.port1.onmessage=B,be=function(){se.postMessage(null)}}else be=function(){k(B,0)};function te(Y,P){U=k(function(){Y(n.unstable_now())},P)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(Y){Y.callback=null},n.unstable_forceFrameRate=function(Y){0>Y||125<Y?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):q=0<Y?Math.floor(1e3/Y):5},n.unstable_getCurrentPriorityLevel=function(){return v},n.unstable_next=function(Y){switch(v){case 1:case 2:case 3:var P=3;break;default:P=v}var F=v;v=P;try{return Y()}finally{v=F}},n.unstable_requestPaint=function(){S=!0},n.unstable_runWithPriority=function(Y,P){switch(Y){case 1:case 2:case 3:case 4:case 5:break;default:Y=3}var F=v;v=Y;try{return P()}finally{v=F}},n.unstable_scheduleCallback=function(Y,P,F){var fe=n.unstable_now();switch(typeof F=="object"&&F!==null?(F=F.delay,F=typeof F=="number"&&0<F?fe+F:fe):F=fe,Y){case 1:var pe=-1;break;case 2:pe=250;break;case 5:pe=1073741823;break;case 4:pe=1e4;break;default:pe=5e3}return pe=F+pe,Y={id:y++,callback:P,priorityLevel:Y,startTime:F,expirationTime:pe,sortIndex:-1},F>fe?(Y.sortIndex=F,s(p,Y),r(f)===null&&Y===r(p)&&(T?(R(U),U=-1):T=!0,te(G,F-fe))):(Y.sortIndex=pe,s(f,Y),j||N||(j=!0,W||(W=!0,be()))),Y},n.unstable_shouldYield=le,n.unstable_wrapCallback=function(Y){var P=v;return function(){var F=v;v=P;try{return Y.apply(this,arguments)}finally{v=F}}}})(Jm)),Jm}var eb;function Zk(){return eb||(eb=1,Zm.exports=Qk()),Zm.exports}var ef={exports:{}},fn={};var tb;function Jk(){if(tb)return fn;tb=1;var n=zp();function s(f){var p="https://react.dev/errors/"+f;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)p+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+f+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var i={d:{f:r,r:function(){throw Error(s(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},o=Symbol.for("react.portal");function d(f,p,y){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:b==null?null:""+b,children:f,containerInfo:p,implementation:y}}var u=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(f,p){if(f==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return fn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,fn.createPortal=function(f,p){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(s(299));return d(f,p,null,y)},fn.flushSync=function(f){var p=u.T,y=i.p;try{if(u.T=null,i.p=2,f)return f()}finally{u.T=p,i.p=y,i.d.f()}},fn.preconnect=function(f,p){typeof f=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,i.d.C(f,p))},fn.prefetchDNS=function(f){typeof f=="string"&&i.d.D(f)},fn.preinit=function(f,p){if(typeof f=="string"&&p&&typeof p.as=="string"){var y=p.as,b=h(y,p.crossOrigin),v=typeof p.integrity=="string"?p.integrity:void 0,N=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;y==="style"?i.d.S(f,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:b,integrity:v,fetchPriority:N}):y==="script"&&i.d.X(f,{crossOrigin:b,integrity:v,fetchPriority:N,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},fn.preinitModule=function(f,p){if(typeof f=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var y=h(p.as,p.crossOrigin);i.d.M(f,{crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&i.d.M(f)},fn.preload=function(f,p){if(typeof f=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var y=p.as,b=h(y,p.crossOrigin);i.d.L(f,y,{crossOrigin:b,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},fn.preloadModule=function(f,p){if(typeof f=="string")if(p){var y=h(p.as,p.crossOrigin);i.d.m(f,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else i.d.m(f)},fn.requestFormReset=function(f){i.d.r(f)},fn.unstable_batchedUpdates=function(f,p){return f(p)},fn.useFormState=function(f,p,y){return u.H.useFormState(f,p,y)},fn.useFormStatus=function(){return u.H.useHostTransitionStatus()},fn.version="19.2.1",fn}var sb;function Pj(){if(sb)return ef.exports;sb=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(s){console.error(s)}}return n(),ef.exports=Jk(),ef.exports}var nb;function e2(){if(nb)return Zo;nb=1;var n=Zk(),s=zp(),r=Pj();function i(t){var a="https://react.dev/errors/"+t;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)a+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+t+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function d(t){var a=t,l=t;if(t.alternate)for(;a.return;)a=a.return;else{t=a;do a=t,(a.flags&4098)!==0&&(l=a.return),t=a.return;while(t)}return a.tag===3?l:null}function u(t){if(t.tag===13){var a=t.memoizedState;if(a===null&&(t=t.alternate,t!==null&&(a=t.memoizedState)),a!==null)return a.dehydrated}return null}function h(t){if(t.tag===31){var a=t.memoizedState;if(a===null&&(t=t.alternate,t!==null&&(a=t.memoizedState)),a!==null)return a.dehydrated}return null}function f(t){if(d(t)!==t)throw Error(i(188))}function p(t){var a=t.alternate;if(!a){if(a=d(t),a===null)throw Error(i(188));return a!==t?null:t}for(var l=t,c=a;;){var m=l.return;if(m===null)break;var x=m.alternate;if(x===null){if(c=m.return,c!==null){l=c;continue}break}if(m.child===x.child){for(x=m.child;x;){if(x===l)return f(m),t;if(x===c)return f(m),a;x=x.sibling}throw Error(i(188))}if(l.return!==c.return)l=m,c=x;else{for(var w=!1,E=m.child;E;){if(E===l){w=!0,l=m,c=x;break}if(E===c){w=!0,c=m,l=x;break}E=E.sibling}if(!w){for(E=x.child;E;){if(E===l){w=!0,l=x,c=m;break}if(E===c){w=!0,c=x,l=m;break}E=E.sibling}if(!w)throw Error(i(189))}}if(l.alternate!==c)throw Error(i(190))}if(l.tag!==3)throw Error(i(188));return l.stateNode.current===l?t:a}function y(t){var a=t.tag;if(a===5||a===26||a===27||a===6)return t;for(t=t.child;t!==null;){if(a=y(t),a!==null)return a;t=t.sibling}return null}var b=Object.assign,v=Symbol.for("react.element"),N=Symbol.for("react.transitional.element"),j=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),I=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),G=Symbol.for("react.suspense"),W=Symbol.for("react.suspense_list"),U=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),V=Symbol.for("react.activity"),le=Symbol.for("react.memo_cache_sentinel"),B=Symbol.iterator;function be(t){return t===null||typeof t!="object"?null:(t=B&&t[B]||t["@@iterator"],typeof t=="function"?t:null)}var K=Symbol.for("react.client.reference");function se(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===K?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case T:return"Fragment";case k:return"Profiler";case S:return"StrictMode";case G:return"Suspense";case W:return"SuspenseList";case V:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case j:return"Portal";case I:return t.displayName||"Context";case R:return(t._context.displayName||"Context")+".Consumer";case M:var a=t.render;return t=t.displayName,t||(t=a.displayName||a.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case U:return a=t.displayName||null,a!==null?a:se(t.type)||"Memo";case q:a=t._payload,t=t._init;try{return se(t(a))}catch{}}return null}var te=Array.isArray,Y=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F={pending:!1,data:null,method:null,action:null},fe=[],pe=-1;function C(t){return{current:t}}function z(t){0>pe||(t.current=fe[pe],fe[pe]=null,pe--)}function X(t,a){pe++,fe[pe]=t.current,t.current=a}var re=C(null),xe=C(null),Oe=C(null),Ee=C(null);function Qe(t,a){switch(X(Oe,a),X(xe,t),X(re,null),a.nodeType){case 9:case 11:t=(t=a.documentElement)&&(t=t.namespaceURI)?yy(t):0;break;default:if(t=a.tagName,a=a.namespaceURI)a=yy(a),t=by(a,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}z(re),X(re,t)}function _e(){z(re),z(xe),z(Oe)}function st(t){t.memoizedState!==null&&X(Ee,t);var a=re.current,l=by(a,t.type);a!==l&&(X(xe,t),X(re,l))}function oe(t){xe.current===t&&(z(re),z(xe)),Ee.current===t&&(z(Ee),qo._currentValue=F)}var ue,ae;function L(t){if(ue===void 0)try{throw Error()}catch(l){var a=l.stack.trim().match(/\n( *(at )?)/);ue=a&&a[1]||"",ae=-1<l.stack.indexOf(`
|
|
2
|
+
at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
+
`+ue+t+ae}var we=!1;function Ue(t,a){if(!t||we)return"";we=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var c={DetermineComponentFrameRoot:function(){try{if(a){var Re=function(){throw Error()};if(Object.defineProperty(Re.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Re,[])}catch(ke){var ve=ke}Reflect.construct(t,[],Re)}else{try{Re.call()}catch(ke){ve=ke}t.call(Re.prototype)}}else{try{throw Error()}catch(ke){ve=ke}(Re=t())&&typeof Re.catch=="function"&&Re.catch(function(){})}}catch(ke){if(ke&&ve&&typeof ke.stack=="string")return[ke.stack,ve.stack]}return[null,null]}};c.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var m=Object.getOwnPropertyDescriptor(c.DetermineComponentFrameRoot,"name");m&&m.configurable&&Object.defineProperty(c.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=c.DetermineComponentFrameRoot(),w=x[0],E=x[1];if(w&&E){var Q=w.split(`
|
|
4
|
+
`),ye=E.split(`
|
|
5
|
+
`);for(m=c=0;c<Q.length&&!Q[c].includes("DetermineComponentFrameRoot");)c++;for(;m<ye.length&&!ye[m].includes("DetermineComponentFrameRoot");)m++;if(c===Q.length||m===ye.length)for(c=Q.length-1,m=ye.length-1;1<=c&&0<=m&&Q[c]!==ye[m];)m--;for(;1<=c&&0<=m;c--,m--)if(Q[c]!==ye[m]){if(c!==1||m!==1)do if(c--,m--,0>m||Q[c]!==ye[m]){var Te=`
|
|
6
|
+
`+Q[c].replace(" at new "," at ");return t.displayName&&Te.includes("<anonymous>")&&(Te=Te.replace("<anonymous>",t.displayName)),Te}while(1<=c&&0<=m);break}}}finally{we=!1,Error.prepareStackTrace=l}return(l=t?t.displayName||t.name:"")?L(l):""}function Lt(t,a){switch(t.tag){case 26:case 27:case 5:return L(t.type);case 16:return L("Lazy");case 13:return t.child!==a&&a!==null?L("Suspense Fallback"):L("Suspense");case 19:return L("SuspenseList");case 0:case 15:return Ue(t.type,!1);case 11:return Ue(t.type.render,!1);case 1:return Ue(t.type,!0);case 31:return L("Activity");default:return""}}function xt(t){try{var a="",l=null;do a+=Lt(t,l),l=t,t=t.return;while(t);return a}catch(c){return`
|
|
7
|
+
Error generating stack: `+c.message+`
|
|
8
|
+
`+c.stack}}var Qt=Object.prototype.hasOwnProperty,ft=n.unstable_scheduleCallback,Et=n.unstable_cancelCallback,Ge=n.unstable_shouldYield,gt=n.unstable_requestPaint,Ze=n.unstable_now,J=n.unstable_getCurrentPriorityLevel,Ne=n.unstable_ImmediatePriority,et=n.unstable_UserBlockingPriority,qe=n.unstable_NormalPriority,Je=n.unstable_LowPriority,Kt=n.unstable_IdlePriority,Ye=n.log,qt=n.unstable_setDisableYieldValue,Jt=null,Ct=null;function O(t){if(typeof Ye=="function"&&qt(t),Ct&&typeof Ct.setStrictMode=="function")try{Ct.setStrictMode(Jt,t)}catch{}}var ne=Math.clz32?Math.clz32:ce,ze=Math.log,_=Math.LN2;function ce(t){return t>>>=0,t===0?32:31-(ze(t)/_|0)|0}var Ce=256,Ve=262144,je=4194304;function He(t){var a=t&42;if(a!==0)return a;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Tt(t,a,l){var c=t.pendingLanes;if(c===0)return 0;var m=0,x=t.suspendedLanes,w=t.pingedLanes;t=t.warmLanes;var E=c&134217727;return E!==0?(c=E&~x,c!==0?m=He(c):(w&=E,w!==0?m=He(w):l||(l=E&~t,l!==0&&(m=He(l))))):(E=c&~x,E!==0?m=He(E):w!==0?m=He(w):l||(l=c&~t,l!==0&&(m=He(l)))),m===0?0:a!==0&&a!==m&&(a&x)===0&&(x=m&-m,l=a&-a,x>=l||x===32&&(l&4194048)!==0)?a:m}function H(t,a){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&a)===0}function Se(t,a){switch(t){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Xe(){var t=je;return je<<=1,(je&62914560)===0&&(je=4194304),t}function Nt(t){for(var a=[],l=0;31>l;l++)a.push(t);return a}function nt(t,a){t.pendingLanes|=a,a!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function $t(t,a,l,c,m,x){var w=t.pendingLanes;t.pendingLanes=l,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=l,t.entangledLanes&=l,t.errorRecoveryDisabledLanes&=l,t.shellSuspendCounter=0;var E=t.entanglements,Q=t.expirationTimes,ye=t.hiddenUpdates;for(l=w&~l;0<l;){var Te=31-ne(l),Re=1<<Te;E[Te]=0,Q[Te]=-1;var ve=ye[Te];if(ve!==null)for(ye[Te]=null,Te=0;Te<ve.length;Te++){var ke=ve[Te];ke!==null&&(ke.lane&=-536870913)}l&=~Re}c!==0&&Bt(t,c,0),x!==0&&m===0&&t.tag!==0&&(t.suspendedLanes|=x&~(w&~a))}function Bt(t,a,l){t.pendingLanes|=a,t.suspendedLanes&=~a;var c=31-ne(a);t.entangledLanes|=a,t.entanglements[c]=t.entanglements[c]|1073741824|l&261930}function qn(t,a){var l=t.entangledLanes|=a;for(t=t.entanglements;l;){var c=31-ne(l),m=1<<c;m&a|t[c]&a&&(t[c]|=a),l&=~m}}function Ot(t,a){var l=a&-a;return l=(l&42)!==0?1:ws(l),(l&(t.suspendedLanes|a))!==0?0:l}function ws(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function Hs(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function Z(){var t=P.p;return t!==0?t:(t=window.event,t===void 0?32:Vy(t.type))}function he(t,a){var l=P.p;try{return P.p=t,a()}finally{P.p=l}}var tt=Math.random().toString(36).slice(2),We="__reactFiber$"+tt,jt="__reactProps$"+tt,Be="__reactContainer$"+tt,ht="__reactEvents$"+tt,It="__reactListeners$"+tt,gs="__reactHandles$"+tt,wt="__reactResources$"+tt,Xt="__reactMarker$"+tt;function Ys(t){delete t[We],delete t[jt],delete t[ht],delete t[It],delete t[gs]}function Fs(t){var a=t[We];if(a)return a;for(var l=t.parentNode;l;){if(a=l[Be]||l[We]){if(l=a.alternate,a.child!==null||l!==null&&l.child!==null)for(t=Cy(t);t!==null;){if(l=t[We])return l;t=Cy(t)}return a}t=l,l=t.parentNode}return null}function pn(t){if(t=t[We]||t[Be]){var a=t.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return t}return null}function Na(t){var a=t.tag;if(a===5||a===26||a===27||a===6)return t.stateNode;throw Error(i(33))}function An(t){var a=t[wt];return a||(a=t[wt]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function as(t){t[Xt]=!0}var Xn=new Set,Fi={};function wa(t,a){Ga(t,a),Ga(t+"Capture",a)}function Ga(t,a){for(Fi[t]=a,t=0;t<a.length;t++)Xn.add(a[t])}var Pc=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Lc={},Oc={};function Xu(t){return Qt.call(Oc,t)?!0:Qt.call(Lc,t)?!1:Pc.test(t)?Oc[t]=!0:(Lc[t]=!0,!1)}function qa(t,a,l){if(Xu(a))if(l===null)t.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":t.removeAttribute(a);return;case"boolean":var c=a.toLowerCase().slice(0,5);if(c!=="data-"&&c!=="aria-"){t.removeAttribute(a);return}}t.setAttribute(a,""+l)}}function Mn(t,a,l){if(l===null)t.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(a);return}t.setAttribute(a,""+l)}}function Yn(t,a,l,c){if(c===null)t.removeAttribute(l);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(l);return}t.setAttributeNS(a,l,""+c)}}function vn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function on(t){var a=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function Yu(t,a,l){var c=Object.getOwnPropertyDescriptor(t.constructor.prototype,a);if(!t.hasOwnProperty(a)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var m=c.get,x=c.set;return Object.defineProperty(t,a,{configurable:!0,get:function(){return m.call(this)},set:function(w){l=""+w,x.call(this,w)}}),Object.defineProperty(t,a,{enumerable:c.enumerable}),{getValue:function(){return l},setValue:function(w){l=""+w},stopTracking:function(){t._valueTracker=null,delete t[a]}}}}function ka(t){if(!t._valueTracker){var a=on(t)?"checked":"value";t._valueTracker=Yu(t,a,""+t[a])}}function zc(t){if(!t)return!1;var a=t._valueTracker;if(!a)return!0;var l=a.getValue(),c="";return t&&(c=on(t)?t.checked?"true":"false":t.value),t=c,t!==l?(a.setValue(t),!0):!1}function da(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var Wu=/[\n"\\]/g;function Ms(t){return t.replace(Wu,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function Gi(t,a,l,c,m,x,w,E){t.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?t.type=w:t.removeAttribute("type"),a!=null?w==="number"?(a===0&&t.value===""||t.value!=a)&&(t.value=""+vn(a)):t.value!==""+vn(a)&&(t.value=""+vn(a)):w!=="submit"&&w!=="reset"||t.removeAttribute("value"),a!=null?ua(t,w,vn(a)):l!=null?ua(t,w,vn(l)):c!=null&&t.removeAttribute("value"),m==null&&x!=null&&(t.defaultChecked=!!x),m!=null&&(t.checked=m&&typeof m!="function"&&typeof m!="symbol"),E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?t.name=""+vn(E):t.removeAttribute("name")}function oo(t,a,l,c,m,x,w,E){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(t.type=x),a!=null||l!=null){if(!(x!=="submit"&&x!=="reset"||a!=null)){ka(t);return}l=l!=null?""+vn(l):"",a=a!=null?""+vn(a):l,E||a===t.value||(t.value=a),t.defaultValue=a}c=c??m,c=typeof c!="function"&&typeof c!="symbol"&&!!c,t.checked=E?t.checked:!!c,t.defaultChecked=!!c,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(t.name=w),ka(t)}function ua(t,a,l){a==="number"&&da(t.ownerDocument)===t||t.defaultValue===""+l||(t.defaultValue=""+l)}function yr(t,a,l,c){if(t=t.options,a){a={};for(var m=0;m<l.length;m++)a["$"+l[m]]=!0;for(l=0;l<t.length;l++)m=a.hasOwnProperty("$"+t[l].value),t[l].selected!==m&&(t[l].selected=m),m&&c&&(t[l].defaultSelected=!0)}else{for(l=""+vn(l),a=null,m=0;m<t.length;m++){if(t[m].value===l){t[m].selected=!0,c&&(t[m].defaultSelected=!0);return}a!==null||t[m].disabled||(a=t[m])}a!==null&&(a.selected=!0)}}function Xa(t,a,l){if(a!=null&&(a=""+vn(a),a!==t.value&&(t.value=a),l==null)){t.defaultValue!==a&&(t.defaultValue=a);return}t.defaultValue=l!=null?""+vn(l):""}function Uc(t,a,l,c){if(a==null){if(c!=null){if(l!=null)throw Error(i(92));if(te(c)){if(1<c.length)throw Error(i(93));c=c[0]}l=c}l==null&&(l=""),a=l}l=vn(a),t.defaultValue=l,c=t.textContent,c===l&&c!==""&&c!==null&&(t.value=c),ka(t)}function Wn(t,a){if(a){var l=t.firstChild;if(l&&l===t.lastChild&&l.nodeType===3){l.nodeValue=a;return}}t.textContent=a}var Qu=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function br(t,a,l){var c=a.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?c?t.setProperty(a,""):a==="float"?t.cssFloat="":t[a]="":c?t.setProperty(a,l):typeof l!="number"||l===0||Qu.has(a)?a==="float"?t.cssFloat=l:t[a]=(""+l).trim():t[a]=l+"px"}function $c(t,a,l){if(a!=null&&typeof a!="object")throw Error(i(62));if(t=t.style,l!=null){for(var c in l)!l.hasOwnProperty(c)||a!=null&&a.hasOwnProperty(c)||(c.indexOf("--")===0?t.setProperty(c,""):c==="float"?t.cssFloat="":t[c]="");for(var m in a)c=a[m],a.hasOwnProperty(m)&&l[m]!==c&&br(t,m,c)}else for(var x in a)a.hasOwnProperty(x)&&br(t,x,a[x])}function Ya(t){if(t.indexOf("-")===-1)return!1;switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Zu=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),oi=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function qi(t){return oi.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function Ws(){}var co=null;function xn(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var js=null,Wa=null;function vr(t){var a=pn(t);if(a&&(t=a.stateNode)){var l=t[jt]||null;e:switch(t=a.stateNode,a.type){case"input":if(Gi(t,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),a=l.name,l.type==="radio"&&a!=null){for(l=t;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+Ms(""+a)+'"][type="radio"]'),a=0;a<l.length;a++){var c=l[a];if(c!==t&&c.form===t.form){var m=c[jt]||null;if(!m)throw Error(i(90));Gi(c,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name)}}for(a=0;a<l.length;a++)c=l[a],c.form===t.form&&zc(c)}break e;case"textarea":Xa(t,l.value,l.defaultValue);break e;case"select":a=l.value,a!=null&&yr(t,!!l.multiple,a,!1)}}}var cn=!1;function jr(t,a,l){if(cn)return t(a,l);cn=!0;try{var c=t(a);return c}finally{if(cn=!1,(js!==null||Wa!==null)&&(Td(),js&&(a=js,t=Wa,Wa=js=null,vr(a),t)))for(a=0;a<t.length;a++)vr(t[a])}}function ci(t,a){var l=t.stateNode;if(l===null)return null;var c=l[jt]||null;if(c===null)return null;l=c[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(c=!c.disabled)||(t=t.type,c=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!c;break e;default:t=!1}if(t)return null;if(l&&typeof l!="function")throw Error(i(231,a,typeof l));return l}var Qs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Sa=!1;if(Qs)try{var Ca={};Object.defineProperty(Ca,"passive",{get:function(){Sa=!0}}),window.addEventListener("test",Ca,Ca),window.removeEventListener("test",Ca,Ca)}catch{Sa=!1}var En=null,di=null,dn=null;function uo(){if(dn)return dn;var t,a=di,l=a.length,c,m="value"in En?En.value:En.textContent,x=m.length;for(t=0;t<l&&a[t]===m[t];t++);var w=l-t;for(c=1;c<=w&&a[l-c]===m[x-c];c++);return dn=m.slice(t,1<c?1-c:void 0)}function ha(t){var a=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&a===13&&(t=13)):t=a,t===10&&(t=13),32<=t||t===13?t:0}function Xi(){return!0}function Nr(){return!1}function Gs(t){function a(l,c,m,x,w){this._reactName=l,this._targetInst=m,this.type=c,this.nativeEvent=x,this.target=w,this.currentTarget=null;for(var E in t)t.hasOwnProperty(E)&&(l=t[E],this[E]=l?l(x):x[E]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Xi:Nr,this.isPropagationStopped=Nr,this}return b(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=Xi)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Xi)},persist:function(){},isPersistent:Xi}),a}var Ta={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Yi=Gs(Ta),wr=b({},Ta,{view:0,detail:0}),Ju=Gs(wr),ho,kr,ui,Wi=b({},wr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Le,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==ui&&(ui&&t.type==="mousemove"?(ho=t.screenX-ui.screenX,kr=t.screenY-ui.screenY):kr=ho=0,ui=t),ho)},movementY:function(t){return"movementY"in t?t.movementY:kr}}),Qi=Gs(Wi),eh=b({},Wi,{dataTransfer:0}),Bc=Gs(eh),_c=b({},wr,{relatedTarget:0}),mo=Gs(_c),Zi=b({},Ta,{animationName:0,elapsedTime:0,pseudoElement:0}),Vc=Gs(Zi),Kc=b({},Ta,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Ji=Gs(Kc),el=b({},Ta,{data:0}),A=Gs(el),$={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},de={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"},Me={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ke(t){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(t):(t=Me[t])?!!a[t]:!1}function Le(){return Ke}var pt=b({},wr,{key:function(t){if(t.key){var a=$[t.key]||t.key;if(a!=="Unidentified")return a}return t.type==="keypress"?(t=ha(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?de[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Le,charCode:function(t){return t.type==="keypress"?ha(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?ha(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),ut=Gs(pt),un=b({},Wi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),hn=Gs(un),hs=b({},wr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Le}),Ht=Gs(hs),mn=b({},Ta,{propertyName:0,elapsedTime:0,pseudoElement:0}),Aa=Gs(mn),Hc=b({},Wi,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),th=Gs(Hc),kt=b({},Ta,{newState:0,oldState:0}),Rt=Gs(kt),In=[9,13,27,32],Ma=Qs&&"CompositionEvent"in window,tl=null;Qs&&"documentMode"in document&&(tl=document.documentMode);var Fc=Qs&&"TextEvent"in window&&!tl,Rn=Qs&&(!Ma||tl&&8<tl&&11>=tl),fo=" ",Cx=!1;function Tx(t,a){switch(t){case"keyup":return In.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ax(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var sl=!1;function gw(t,a){switch(t){case"compositionend":return Ax(a);case"keypress":return a.which!==32?null:(Cx=!0,fo);case"textInput":return t=a.data,t===fo&&Cx?null:t;default:return null}}function yw(t,a){if(sl)return t==="compositionend"||!Ma&&Tx(t,a)?(t=uo(),dn=di=En=null,sl=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return Rn&&a.locale!=="ko"?null:a.data;default:return null}}var bw={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 Mx(t){var a=t&&t.nodeName&&t.nodeName.toLowerCase();return a==="input"?!!bw[t.type]:a==="textarea"}function Ex(t,a,l,c){js?Wa?Wa.push(c):Wa=[c]:js=c,a=Pd(a,"onChange"),0<a.length&&(l=new Yi("onChange","change",null,l,c),t.push({event:l,listeners:a}))}var po=null,xo=null;function vw(t){hy(t,0)}function Gc(t){var a=Na(t);if(zc(a))return t}function Ix(t,a){if(t==="change")return a}var Rx=!1;if(Qs){var sh;if(Qs){var nh="oninput"in document;if(!nh){var Dx=document.createElement("div");Dx.setAttribute("oninput","return;"),nh=typeof Dx.oninput=="function"}sh=nh}else sh=!1;Rx=sh&&(!document.documentMode||9<document.documentMode)}function Px(){po&&(po.detachEvent("onpropertychange",Lx),xo=po=null)}function Lx(t){if(t.propertyName==="value"&&Gc(xo)){var a=[];Ex(a,xo,t,xn(t)),jr(vw,a)}}function jw(t,a,l){t==="focusin"?(Px(),po=a,xo=l,po.attachEvent("onpropertychange",Lx)):t==="focusout"&&Px()}function Nw(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Gc(xo)}function ww(t,a){if(t==="click")return Gc(a)}function kw(t,a){if(t==="input"||t==="change")return Gc(a)}function Sw(t,a){return t===a&&(t!==0||1/t===1/a)||t!==t&&a!==a}var Dn=typeof Object.is=="function"?Object.is:Sw;function go(t,a){if(Dn(t,a))return!0;if(typeof t!="object"||t===null||typeof a!="object"||a===null)return!1;var l=Object.keys(t),c=Object.keys(a);if(l.length!==c.length)return!1;for(c=0;c<l.length;c++){var m=l[c];if(!Qt.call(a,m)||!Dn(t[m],a[m]))return!1}return!0}function Ox(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function zx(t,a){var l=Ox(t);t=0;for(var c;l;){if(l.nodeType===3){if(c=t+l.textContent.length,t<=a&&c>=a)return{node:l,offset:a-t};t=c}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=Ox(l)}}function Ux(t,a){return t&&a?t===a?!0:t&&t.nodeType===3?!1:a&&a.nodeType===3?Ux(t,a.parentNode):"contains"in t?t.contains(a):t.compareDocumentPosition?!!(t.compareDocumentPosition(a)&16):!1:!1}function $x(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var a=da(t.document);a instanceof t.HTMLIFrameElement;){try{var l=typeof a.contentWindow.location.href=="string"}catch{l=!1}if(l)t=a.contentWindow;else break;a=da(t.document)}return a}function ah(t){var a=t&&t.nodeName&&t.nodeName.toLowerCase();return a&&(a==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||a==="textarea"||t.contentEditable==="true")}var Cw=Qs&&"documentMode"in document&&11>=document.documentMode,nl=null,rh=null,yo=null,ih=!1;function Bx(t,a,l){var c=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;ih||nl==null||nl!==da(c)||(c=nl,"selectionStart"in c&&ah(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),yo&&go(yo,c)||(yo=c,c=Pd(rh,"onSelect"),0<c.length&&(a=new Yi("onSelect","select",null,a,l),t.push({event:a,listeners:c}),a.target=nl)))}function hi(t,a){var l={};return l[t.toLowerCase()]=a.toLowerCase(),l["Webkit"+t]="webkit"+a,l["Moz"+t]="moz"+a,l}var al={animationend:hi("Animation","AnimationEnd"),animationiteration:hi("Animation","AnimationIteration"),animationstart:hi("Animation","AnimationStart"),transitionrun:hi("Transition","TransitionRun"),transitionstart:hi("Transition","TransitionStart"),transitioncancel:hi("Transition","TransitionCancel"),transitionend:hi("Transition","TransitionEnd")},lh={},_x={};Qs&&(_x=document.createElement("div").style,"AnimationEvent"in window||(delete al.animationend.animation,delete al.animationiteration.animation,delete al.animationstart.animation),"TransitionEvent"in window||delete al.transitionend.transition);function mi(t){if(lh[t])return lh[t];if(!al[t])return t;var a=al[t],l;for(l in a)if(a.hasOwnProperty(l)&&l in _x)return lh[t]=a[l];return t}var Vx=mi("animationend"),Kx=mi("animationiteration"),Hx=mi("animationstart"),Tw=mi("transitionrun"),Aw=mi("transitionstart"),Mw=mi("transitioncancel"),Fx=mi("transitionend"),Gx=new Map,oh="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");oh.push("scrollEnd");function ma(t,a){Gx.set(t,a),wa(a,[t])}var qc=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},Qn=[],rl=0,ch=0;function Xc(){for(var t=rl,a=ch=rl=0;a<t;){var l=Qn[a];Qn[a++]=null;var c=Qn[a];Qn[a++]=null;var m=Qn[a];Qn[a++]=null;var x=Qn[a];if(Qn[a++]=null,c!==null&&m!==null){var w=c.pending;w===null?m.next=m:(m.next=w.next,w.next=m),c.pending=m}x!==0&&qx(l,m,x)}}function Yc(t,a,l,c){Qn[rl++]=t,Qn[rl++]=a,Qn[rl++]=l,Qn[rl++]=c,ch|=c,t.lanes|=c,t=t.alternate,t!==null&&(t.lanes|=c)}function dh(t,a,l,c){return Yc(t,a,l,c),Wc(t)}function fi(t,a){return Yc(t,null,null,a),Wc(t)}function qx(t,a,l){t.lanes|=l;var c=t.alternate;c!==null&&(c.lanes|=l);for(var m=!1,x=t.return;x!==null;)x.childLanes|=l,c=x.alternate,c!==null&&(c.childLanes|=l),x.tag===22&&(t=x.stateNode,t===null||t._visibility&1||(m=!0)),t=x,x=x.return;return t.tag===3?(x=t.stateNode,m&&a!==null&&(m=31-ne(l),t=x.hiddenUpdates,c=t[m],c===null?t[m]=[a]:c.push(a),a.lane=l|536870912),x):null}function Wc(t){if(50<Bo)throw Bo=0,bm=null,Error(i(185));for(var a=t.return;a!==null;)t=a,a=t.return;return t.tag===3?t.stateNode:null}var il={};function Ew(t,a,l,c){this.tag=t,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Pn(t,a,l,c){return new Ew(t,a,l,c)}function uh(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Qa(t,a){var l=t.alternate;return l===null?(l=Pn(t.tag,a,t.key,t.mode),l.elementType=t.elementType,l.type=t.type,l.stateNode=t.stateNode,l.alternate=t,t.alternate=l):(l.pendingProps=a,l.type=t.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=t.flags&65011712,l.childLanes=t.childLanes,l.lanes=t.lanes,l.child=t.child,l.memoizedProps=t.memoizedProps,l.memoizedState=t.memoizedState,l.updateQueue=t.updateQueue,a=t.dependencies,l.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},l.sibling=t.sibling,l.index=t.index,l.ref=t.ref,l.refCleanup=t.refCleanup,l}function Xx(t,a){t.flags&=65011714;var l=t.alternate;return l===null?(t.childLanes=0,t.lanes=a,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=l.childLanes,t.lanes=l.lanes,t.child=l.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=l.memoizedProps,t.memoizedState=l.memoizedState,t.updateQueue=l.updateQueue,t.type=l.type,a=l.dependencies,t.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),t}function Qc(t,a,l,c,m,x){var w=0;if(c=t,typeof t=="function")uh(t)&&(w=1);else if(typeof t=="string")w=Lk(t,l,re.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case V:return t=Pn(31,l,a,m),t.elementType=V,t.lanes=x,t;case T:return pi(l.children,m,x,a);case S:w=8,m|=24;break;case k:return t=Pn(12,l,a,m|2),t.elementType=k,t.lanes=x,t;case G:return t=Pn(13,l,a,m),t.elementType=G,t.lanes=x,t;case W:return t=Pn(19,l,a,m),t.elementType=W,t.lanes=x,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case I:w=10;break e;case R:w=9;break e;case M:w=11;break e;case U:w=14;break e;case q:w=16,c=null;break e}w=29,l=Error(i(130,t===null?"null":typeof t,"")),c=null}return a=Pn(w,l,a,m),a.elementType=t,a.type=c,a.lanes=x,a}function pi(t,a,l,c){return t=Pn(7,t,c,a),t.lanes=l,t}function hh(t,a,l){return t=Pn(6,t,null,a),t.lanes=l,t}function Yx(t){var a=Pn(18,null,null,0);return a.stateNode=t,a}function mh(t,a,l){return a=Pn(4,t.children!==null?t.children:[],t.key,a),a.lanes=l,a.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},a}var Wx=new WeakMap;function Zn(t,a){if(typeof t=="object"&&t!==null){var l=Wx.get(t);return l!==void 0?l:(a={value:t,source:a,stack:xt(a)},Wx.set(t,a),a)}return{value:t,source:a,stack:xt(a)}}var ll=[],ol=0,Zc=null,bo=0,Jn=[],ea=0,Sr=null,Ea=1,Ia="";function Za(t,a){ll[ol++]=bo,ll[ol++]=Zc,Zc=t,bo=a}function Qx(t,a,l){Jn[ea++]=Ea,Jn[ea++]=Ia,Jn[ea++]=Sr,Sr=t;var c=Ea;t=Ia;var m=32-ne(c)-1;c&=~(1<<m),l+=1;var x=32-ne(a)+m;if(30<x){var w=m-m%5;x=(c&(1<<w)-1).toString(32),c>>=w,m-=w,Ea=1<<32-ne(a)+m|l<<m|c,Ia=x+t}else Ea=1<<x|l<<m|c,Ia=t}function fh(t){t.return!==null&&(Za(t,1),Qx(t,1,0))}function ph(t){for(;t===Zc;)Zc=ll[--ol],ll[ol]=null,bo=ll[--ol],ll[ol]=null;for(;t===Sr;)Sr=Jn[--ea],Jn[ea]=null,Ia=Jn[--ea],Jn[ea]=null,Ea=Jn[--ea],Jn[ea]=null}function Zx(t,a){Jn[ea++]=Ea,Jn[ea++]=Ia,Jn[ea++]=Sr,Ea=a.id,Ia=a.overflow,Sr=t}var Zs=null,ys=null,Zt=!1,Cr=null,ta=!1,xh=Error(i(519));function Tr(t){var a=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw vo(Zn(a,t)),xh}function Jx(t){var a=t.stateNode,l=t.type,c=t.memoizedProps;switch(a[We]=t,a[jt]=c,l){case"dialog":Gt("cancel",a),Gt("close",a);break;case"iframe":case"object":case"embed":Gt("load",a);break;case"video":case"audio":for(l=0;l<Vo.length;l++)Gt(Vo[l],a);break;case"source":Gt("error",a);break;case"img":case"image":case"link":Gt("error",a),Gt("load",a);break;case"details":Gt("toggle",a);break;case"input":Gt("invalid",a),oo(a,c.value,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name,!0);break;case"select":Gt("invalid",a);break;case"textarea":Gt("invalid",a),Uc(a,c.value,c.defaultValue,c.children)}l=c.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||a.textContent===""+l||c.suppressHydrationWarning===!0||xy(a.textContent,l)?(c.popover!=null&&(Gt("beforetoggle",a),Gt("toggle",a)),c.onScroll!=null&&Gt("scroll",a),c.onScrollEnd!=null&&Gt("scrollend",a),c.onClick!=null&&(a.onclick=Ws),a=!0):a=!1,a||Tr(t,!0)}function eg(t){for(Zs=t.return;Zs;)switch(Zs.tag){case 5:case 31:case 13:ta=!1;return;case 27:case 3:ta=!0;return;default:Zs=Zs.return}}function cl(t){if(t!==Zs)return!1;if(!Zt)return eg(t),Zt=!0,!1;var a=t.tag,l;if((l=a!==3&&a!==27)&&((l=a===5)&&(l=t.type,l=!(l!=="form"&&l!=="button")||Pm(t.type,t.memoizedProps)),l=!l),l&&ys&&Tr(t),eg(t),a===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(317));ys=Sy(t)}else if(a===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(317));ys=Sy(t)}else a===27?(a=ys,_r(t.type)?(t=$m,$m=null,ys=t):ys=a):ys=Zs?na(t.stateNode.nextSibling):null;return!0}function xi(){ys=Zs=null,Zt=!1}function gh(){var t=Cr;return t!==null&&(kn===null?kn=t:kn.push.apply(kn,t),Cr=null),t}function vo(t){Cr===null?Cr=[t]:Cr.push(t)}var yh=C(null),gi=null,Ja=null;function Ar(t,a,l){X(yh,a._currentValue),a._currentValue=l}function er(t){t._currentValue=yh.current,z(yh)}function bh(t,a,l){for(;t!==null;){var c=t.alternate;if((t.childLanes&a)!==a?(t.childLanes|=a,c!==null&&(c.childLanes|=a)):c!==null&&(c.childLanes&a)!==a&&(c.childLanes|=a),t===l)break;t=t.return}}function vh(t,a,l,c){var m=t.child;for(m!==null&&(m.return=t);m!==null;){var x=m.dependencies;if(x!==null){var w=m.child;x=x.firstContext;e:for(;x!==null;){var E=x;x=m;for(var Q=0;Q<a.length;Q++)if(E.context===a[Q]){x.lanes|=l,E=x.alternate,E!==null&&(E.lanes|=l),bh(x.return,l,t),c||(w=null);break e}x=E.next}}else if(m.tag===18){if(w=m.return,w===null)throw Error(i(341));w.lanes|=l,x=w.alternate,x!==null&&(x.lanes|=l),bh(w,l,t),w=null}else w=m.child;if(w!==null)w.return=m;else for(w=m;w!==null;){if(w===t){w=null;break}if(m=w.sibling,m!==null){m.return=w.return,w=m;break}w=w.return}m=w}}function dl(t,a,l,c){t=null;for(var m=a,x=!1;m!==null;){if(!x){if((m.flags&524288)!==0)x=!0;else if((m.flags&262144)!==0)break}if(m.tag===10){var w=m.alternate;if(w===null)throw Error(i(387));if(w=w.memoizedProps,w!==null){var E=m.type;Dn(m.pendingProps.value,w.value)||(t!==null?t.push(E):t=[E])}}else if(m===Ee.current){if(w=m.alternate,w===null)throw Error(i(387));w.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(t!==null?t.push(qo):t=[qo])}m=m.return}t!==null&&vh(a,t,l,c),a.flags|=262144}function Jc(t){for(t=t.firstContext;t!==null;){if(!Dn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function yi(t){gi=t,Ja=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function Js(t){return tg(gi,t)}function ed(t,a){return gi===null&&yi(t),tg(t,a)}function tg(t,a){var l=a._currentValue;if(a={context:a,memoizedValue:l,next:null},Ja===null){if(t===null)throw Error(i(308));Ja=a,t.dependencies={lanes:0,firstContext:a},t.flags|=524288}else Ja=Ja.next=a;return l}var Iw=typeof AbortController<"u"?AbortController:function(){var t=[],a=this.signal={aborted:!1,addEventListener:function(l,c){t.push(c)}};this.abort=function(){a.aborted=!0,t.forEach(function(l){return l()})}},Rw=n.unstable_scheduleCallback,Dw=n.unstable_NormalPriority,Ps={$$typeof:I,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function jh(){return{controller:new Iw,data:new Map,refCount:0}}function jo(t){t.refCount--,t.refCount===0&&Rw(Dw,function(){t.controller.abort()})}var No=null,Nh=0,ul=0,hl=null;function Pw(t,a){if(No===null){var l=No=[];Nh=0,ul=Sm(),hl={status:"pending",value:void 0,then:function(c){l.push(c)}}}return Nh++,a.then(sg,sg),a}function sg(){if(--Nh===0&&No!==null){hl!==null&&(hl.status="fulfilled");var t=No;No=null,ul=0,hl=null;for(var a=0;a<t.length;a++)(0,t[a])()}}function Lw(t,a){var l=[],c={status:"pending",value:null,reason:null,then:function(m){l.push(m)}};return t.then(function(){c.status="fulfilled",c.value=a;for(var m=0;m<l.length;m++)(0,l[m])(a)},function(m){for(c.status="rejected",c.reason=m,m=0;m<l.length;m++)(0,l[m])(void 0)}),c}var ng=Y.S;Y.S=function(t,a){B0=Ze(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&Pw(t,a),ng!==null&&ng(t,a)};var bi=C(null);function wh(){var t=bi.current;return t!==null?t:ms.pooledCache}function td(t,a){a===null?X(bi,bi.current):X(bi,a.pool)}function ag(){var t=wh();return t===null?null:{parent:Ps._currentValue,pool:t}}var ml=Error(i(460)),kh=Error(i(474)),sd=Error(i(542)),nd={then:function(){}};function rg(t){return t=t.status,t==="fulfilled"||t==="rejected"}function ig(t,a,l){switch(l=t[l],l===void 0?t.push(a):l!==a&&(a.then(Ws,Ws),a=l),a.status){case"fulfilled":return a.value;case"rejected":throw t=a.reason,og(t),t;default:if(typeof a.status=="string")a.then(Ws,Ws);else{if(t=ms,t!==null&&100<t.shellSuspendCounter)throw Error(i(482));t=a,t.status="pending",t.then(function(c){if(a.status==="pending"){var m=a;m.status="fulfilled",m.value=c}},function(c){if(a.status==="pending"){var m=a;m.status="rejected",m.reason=c}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw t=a.reason,og(t),t}throw ji=a,ml}}function vi(t){try{var a=t._init;return a(t._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(ji=l,ml):l}}var ji=null;function lg(){if(ji===null)throw Error(i(459));var t=ji;return ji=null,t}function og(t){if(t===ml||t===sd)throw Error(i(483))}var fl=null,wo=0;function ad(t){var a=wo;return wo+=1,fl===null&&(fl=[]),ig(fl,t,a)}function ko(t,a){a=a.props.ref,t.ref=a!==void 0?a:null}function rd(t,a){throw a.$$typeof===v?Error(i(525)):(t=Object.prototype.toString.call(a),Error(i(31,t==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":t)))}function cg(t){function a(ie,ee){if(t){var ge=ie.deletions;ge===null?(ie.deletions=[ee],ie.flags|=16):ge.push(ee)}}function l(ie,ee){if(!t)return null;for(;ee!==null;)a(ie,ee),ee=ee.sibling;return null}function c(ie){for(var ee=new Map;ie!==null;)ie.key!==null?ee.set(ie.key,ie):ee.set(ie.index,ie),ie=ie.sibling;return ee}function m(ie,ee){return ie=Qa(ie,ee),ie.index=0,ie.sibling=null,ie}function x(ie,ee,ge){return ie.index=ge,t?(ge=ie.alternate,ge!==null?(ge=ge.index,ge<ee?(ie.flags|=67108866,ee):ge):(ie.flags|=67108866,ee)):(ie.flags|=1048576,ee)}function w(ie){return t&&ie.alternate===null&&(ie.flags|=67108866),ie}function E(ie,ee,ge,Ie){return ee===null||ee.tag!==6?(ee=hh(ge,ie.mode,Ie),ee.return=ie,ee):(ee=m(ee,ge),ee.return=ie,ee)}function Q(ie,ee,ge,Ie){var yt=ge.type;return yt===T?Te(ie,ee,ge.props.children,Ie,ge.key):ee!==null&&(ee.elementType===yt||typeof yt=="object"&&yt!==null&&yt.$$typeof===q&&vi(yt)===ee.type)?(ee=m(ee,ge.props),ko(ee,ge),ee.return=ie,ee):(ee=Qc(ge.type,ge.key,ge.props,null,ie.mode,Ie),ko(ee,ge),ee.return=ie,ee)}function ye(ie,ee,ge,Ie){return ee===null||ee.tag!==4||ee.stateNode.containerInfo!==ge.containerInfo||ee.stateNode.implementation!==ge.implementation?(ee=mh(ge,ie.mode,Ie),ee.return=ie,ee):(ee=m(ee,ge.children||[]),ee.return=ie,ee)}function Te(ie,ee,ge,Ie,yt){return ee===null||ee.tag!==7?(ee=pi(ge,ie.mode,Ie,yt),ee.return=ie,ee):(ee=m(ee,ge),ee.return=ie,ee)}function Re(ie,ee,ge){if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return ee=hh(""+ee,ie.mode,ge),ee.return=ie,ee;if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case N:return ge=Qc(ee.type,ee.key,ee.props,null,ie.mode,ge),ko(ge,ee),ge.return=ie,ge;case j:return ee=mh(ee,ie.mode,ge),ee.return=ie,ee;case q:return ee=vi(ee),Re(ie,ee,ge)}if(te(ee)||be(ee))return ee=pi(ee,ie.mode,ge,null),ee.return=ie,ee;if(typeof ee.then=="function")return Re(ie,ad(ee),ge);if(ee.$$typeof===I)return Re(ie,ed(ie,ee),ge);rd(ie,ee)}return null}function ve(ie,ee,ge,Ie){var yt=ee!==null?ee.key:null;if(typeof ge=="string"&&ge!==""||typeof ge=="number"||typeof ge=="bigint")return yt!==null?null:E(ie,ee,""+ge,Ie);if(typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case N:return ge.key===yt?Q(ie,ee,ge,Ie):null;case j:return ge.key===yt?ye(ie,ee,ge,Ie):null;case q:return ge=vi(ge),ve(ie,ee,ge,Ie)}if(te(ge)||be(ge))return yt!==null?null:Te(ie,ee,ge,Ie,null);if(typeof ge.then=="function")return ve(ie,ee,ad(ge),Ie);if(ge.$$typeof===I)return ve(ie,ee,ed(ie,ge),Ie);rd(ie,ge)}return null}function ke(ie,ee,ge,Ie,yt){if(typeof Ie=="string"&&Ie!==""||typeof Ie=="number"||typeof Ie=="bigint")return ie=ie.get(ge)||null,E(ee,ie,""+Ie,yt);if(typeof Ie=="object"&&Ie!==null){switch(Ie.$$typeof){case N:return ie=ie.get(Ie.key===null?ge:Ie.key)||null,Q(ee,ie,Ie,yt);case j:return ie=ie.get(Ie.key===null?ge:Ie.key)||null,ye(ee,ie,Ie,yt);case q:return Ie=vi(Ie),ke(ie,ee,ge,Ie,yt)}if(te(Ie)||be(Ie))return ie=ie.get(ge)||null,Te(ee,ie,Ie,yt,null);if(typeof Ie.then=="function")return ke(ie,ee,ge,ad(Ie),yt);if(Ie.$$typeof===I)return ke(ie,ee,ge,ed(ee,Ie),yt);rd(ee,Ie)}return null}function lt(ie,ee,ge,Ie){for(var yt=null,es=null,mt=ee,zt=ee=0,Wt=null;mt!==null&&zt<ge.length;zt++){mt.index>zt?(Wt=mt,mt=null):Wt=mt.sibling;var ts=ve(ie,mt,ge[zt],Ie);if(ts===null){mt===null&&(mt=Wt);break}t&&mt&&ts.alternate===null&&a(ie,mt),ee=x(ts,ee,zt),es===null?yt=ts:es.sibling=ts,es=ts,mt=Wt}if(zt===ge.length)return l(ie,mt),Zt&&Za(ie,zt),yt;if(mt===null){for(;zt<ge.length;zt++)mt=Re(ie,ge[zt],Ie),mt!==null&&(ee=x(mt,ee,zt),es===null?yt=mt:es.sibling=mt,es=mt);return Zt&&Za(ie,zt),yt}for(mt=c(mt);zt<ge.length;zt++)Wt=ke(mt,ie,zt,ge[zt],Ie),Wt!==null&&(t&&Wt.alternate!==null&&mt.delete(Wt.key===null?zt:Wt.key),ee=x(Wt,ee,zt),es===null?yt=Wt:es.sibling=Wt,es=Wt);return t&&mt.forEach(function(Gr){return a(ie,Gr)}),Zt&&Za(ie,zt),yt}function St(ie,ee,ge,Ie){if(ge==null)throw Error(i(151));for(var yt=null,es=null,mt=ee,zt=ee=0,Wt=null,ts=ge.next();mt!==null&&!ts.done;zt++,ts=ge.next()){mt.index>zt?(Wt=mt,mt=null):Wt=mt.sibling;var Gr=ve(ie,mt,ts.value,Ie);if(Gr===null){mt===null&&(mt=Wt);break}t&&mt&&Gr.alternate===null&&a(ie,mt),ee=x(Gr,ee,zt),es===null?yt=Gr:es.sibling=Gr,es=Gr,mt=Wt}if(ts.done)return l(ie,mt),Zt&&Za(ie,zt),yt;if(mt===null){for(;!ts.done;zt++,ts=ge.next())ts=Re(ie,ts.value,Ie),ts!==null&&(ee=x(ts,ee,zt),es===null?yt=ts:es.sibling=ts,es=ts);return Zt&&Za(ie,zt),yt}for(mt=c(mt);!ts.done;zt++,ts=ge.next())ts=ke(mt,ie,zt,ts.value,Ie),ts!==null&&(t&&ts.alternate!==null&&mt.delete(ts.key===null?zt:ts.key),ee=x(ts,ee,zt),es===null?yt=ts:es.sibling=ts,es=ts);return t&&mt.forEach(function(Gk){return a(ie,Gk)}),Zt&&Za(ie,zt),yt}function us(ie,ee,ge,Ie){if(typeof ge=="object"&&ge!==null&&ge.type===T&&ge.key===null&&(ge=ge.props.children),typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case N:e:{for(var yt=ge.key;ee!==null;){if(ee.key===yt){if(yt=ge.type,yt===T){if(ee.tag===7){l(ie,ee.sibling),Ie=m(ee,ge.props.children),Ie.return=ie,ie=Ie;break e}}else if(ee.elementType===yt||typeof yt=="object"&&yt!==null&&yt.$$typeof===q&&vi(yt)===ee.type){l(ie,ee.sibling),Ie=m(ee,ge.props),ko(Ie,ge),Ie.return=ie,ie=Ie;break e}l(ie,ee);break}else a(ie,ee);ee=ee.sibling}ge.type===T?(Ie=pi(ge.props.children,ie.mode,Ie,ge.key),Ie.return=ie,ie=Ie):(Ie=Qc(ge.type,ge.key,ge.props,null,ie.mode,Ie),ko(Ie,ge),Ie.return=ie,ie=Ie)}return w(ie);case j:e:{for(yt=ge.key;ee!==null;){if(ee.key===yt)if(ee.tag===4&&ee.stateNode.containerInfo===ge.containerInfo&&ee.stateNode.implementation===ge.implementation){l(ie,ee.sibling),Ie=m(ee,ge.children||[]),Ie.return=ie,ie=Ie;break e}else{l(ie,ee);break}else a(ie,ee);ee=ee.sibling}Ie=mh(ge,ie.mode,Ie),Ie.return=ie,ie=Ie}return w(ie);case q:return ge=vi(ge),us(ie,ee,ge,Ie)}if(te(ge))return lt(ie,ee,ge,Ie);if(be(ge)){if(yt=be(ge),typeof yt!="function")throw Error(i(150));return ge=yt.call(ge),St(ie,ee,ge,Ie)}if(typeof ge.then=="function")return us(ie,ee,ad(ge),Ie);if(ge.$$typeof===I)return us(ie,ee,ed(ie,ge),Ie);rd(ie,ge)}return typeof ge=="string"&&ge!==""||typeof ge=="number"||typeof ge=="bigint"?(ge=""+ge,ee!==null&&ee.tag===6?(l(ie,ee.sibling),Ie=m(ee,ge),Ie.return=ie,ie=Ie):(l(ie,ee),Ie=hh(ge,ie.mode,Ie),Ie.return=ie,ie=Ie),w(ie)):l(ie,ee)}return function(ie,ee,ge,Ie){try{wo=0;var yt=us(ie,ee,ge,Ie);return fl=null,yt}catch(mt){if(mt===ml||mt===sd)throw mt;var es=Pn(29,mt,null,ie.mode);return es.lanes=Ie,es.return=ie,es}finally{}}}var Ni=cg(!0),dg=cg(!1),Mr=!1;function Sh(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ch(t,a){t=t.updateQueue,a.updateQueue===t&&(a.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Er(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Ir(t,a,l){var c=t.updateQueue;if(c===null)return null;if(c=c.shared,(rs&2)!==0){var m=c.pending;return m===null?a.next=a:(a.next=m.next,m.next=a),c.pending=a,a=Wc(t),qx(t,null,l),a}return Yc(t,c,a,l),Wc(t)}function So(t,a,l){if(a=a.updateQueue,a!==null&&(a=a.shared,(l&4194048)!==0)){var c=a.lanes;c&=t.pendingLanes,l|=c,a.lanes=l,qn(t,l)}}function Th(t,a){var l=t.updateQueue,c=t.alternate;if(c!==null&&(c=c.updateQueue,l===c)){var m=null,x=null;if(l=l.firstBaseUpdate,l!==null){do{var w={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};x===null?m=x=w:x=x.next=w,l=l.next}while(l!==null);x===null?m=x=a:x=x.next=a}else m=x=a;l={baseState:c.baseState,firstBaseUpdate:m,lastBaseUpdate:x,shared:c.shared,callbacks:c.callbacks},t.updateQueue=l;return}t=l.lastBaseUpdate,t===null?l.firstBaseUpdate=a:t.next=a,l.lastBaseUpdate=a}var Ah=!1;function Co(){if(Ah){var t=hl;if(t!==null)throw t}}function To(t,a,l,c){Ah=!1;var m=t.updateQueue;Mr=!1;var x=m.firstBaseUpdate,w=m.lastBaseUpdate,E=m.shared.pending;if(E!==null){m.shared.pending=null;var Q=E,ye=Q.next;Q.next=null,w===null?x=ye:w.next=ye,w=Q;var Te=t.alternate;Te!==null&&(Te=Te.updateQueue,E=Te.lastBaseUpdate,E!==w&&(E===null?Te.firstBaseUpdate=ye:E.next=ye,Te.lastBaseUpdate=Q))}if(x!==null){var Re=m.baseState;w=0,Te=ye=Q=null,E=x;do{var ve=E.lane&-536870913,ke=ve!==E.lane;if(ke?(Yt&ve)===ve:(c&ve)===ve){ve!==0&&ve===ul&&(Ah=!0),Te!==null&&(Te=Te.next={lane:0,tag:E.tag,payload:E.payload,callback:null,next:null});e:{var lt=t,St=E;ve=a;var us=l;switch(St.tag){case 1:if(lt=St.payload,typeof lt=="function"){Re=lt.call(us,Re,ve);break e}Re=lt;break e;case 3:lt.flags=lt.flags&-65537|128;case 0:if(lt=St.payload,ve=typeof lt=="function"?lt.call(us,Re,ve):lt,ve==null)break e;Re=b({},Re,ve);break e;case 2:Mr=!0}}ve=E.callback,ve!==null&&(t.flags|=64,ke&&(t.flags|=8192),ke=m.callbacks,ke===null?m.callbacks=[ve]:ke.push(ve))}else ke={lane:ve,tag:E.tag,payload:E.payload,callback:E.callback,next:null},Te===null?(ye=Te=ke,Q=Re):Te=Te.next=ke,w|=ve;if(E=E.next,E===null){if(E=m.shared.pending,E===null)break;ke=E,E=ke.next,ke.next=null,m.lastBaseUpdate=ke,m.shared.pending=null}}while(!0);Te===null&&(Q=Re),m.baseState=Q,m.firstBaseUpdate=ye,m.lastBaseUpdate=Te,x===null&&(m.shared.lanes=0),Or|=w,t.lanes=w,t.memoizedState=Re}}function ug(t,a){if(typeof t!="function")throw Error(i(191,t));t.call(a)}function hg(t,a){var l=t.callbacks;if(l!==null)for(t.callbacks=null,t=0;t<l.length;t++)ug(l[t],a)}var pl=C(null),id=C(0);function mg(t,a){t=cr,X(id,t),X(pl,a),cr=t|a.baseLanes}function Mh(){X(id,cr),X(pl,pl.current)}function Eh(){cr=id.current,z(pl),z(id)}var Ln=C(null),sa=null;function Rr(t){var a=t.alternate;X(Es,Es.current&1),X(Ln,t),sa===null&&(a===null||pl.current!==null||a.memoizedState!==null)&&(sa=t)}function Ih(t){X(Es,Es.current),X(Ln,t),sa===null&&(sa=t)}function fg(t){t.tag===22?(X(Es,Es.current),X(Ln,t),sa===null&&(sa=t)):Dr()}function Dr(){X(Es,Es.current),X(Ln,Ln.current)}function On(t){z(Ln),sa===t&&(sa=null),z(Es)}var Es=C(0);function ld(t){for(var a=t;a!==null;){if(a.tag===13){var l=a.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||zm(l)||Um(l)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===t)break;for(;a.sibling===null;){if(a.return===null||a.return===t)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var tr=0,Dt=null,cs=null,Ls=null,od=!1,xl=!1,wi=!1,cd=0,Ao=0,gl=null,Ow=0;function ks(){throw Error(i(321))}function Rh(t,a){if(a===null)return!1;for(var l=0;l<a.length&&l<t.length;l++)if(!Dn(t[l],a[l]))return!1;return!0}function Dh(t,a,l,c,m,x){return tr=x,Dt=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,Y.H=t===null||t.memoizedState===null?Qg:Xh,wi=!1,x=l(c,m),wi=!1,xl&&(x=xg(a,l,c,m)),pg(t),x}function pg(t){Y.H=Io;var a=cs!==null&&cs.next!==null;if(tr=0,Ls=cs=Dt=null,od=!1,Ao=0,gl=null,a)throw Error(i(300));t===null||Os||(t=t.dependencies,t!==null&&Jc(t)&&(Os=!0))}function xg(t,a,l,c){Dt=t;var m=0;do{if(xl&&(gl=null),Ao=0,xl=!1,25<=m)throw Error(i(301));if(m+=1,Ls=cs=null,t.updateQueue!=null){var x=t.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}Y.H=Zg,x=a(l,c)}while(xl);return x}function zw(){var t=Y.H,a=t.useState()[0];return a=typeof a.then=="function"?Mo(a):a,t=t.useState()[0],(cs!==null?cs.memoizedState:null)!==t&&(Dt.flags|=1024),a}function Ph(){var t=cd!==0;return cd=0,t}function Lh(t,a,l){a.updateQueue=t.updateQueue,a.flags&=-2053,t.lanes&=~l}function Oh(t){if(od){for(t=t.memoizedState;t!==null;){var a=t.queue;a!==null&&(a.pending=null),t=t.next}od=!1}tr=0,Ls=cs=Dt=null,xl=!1,Ao=cd=0,gl=null}function gn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ls===null?Dt.memoizedState=Ls=t:Ls=Ls.next=t,Ls}function Is(){if(cs===null){var t=Dt.alternate;t=t!==null?t.memoizedState:null}else t=cs.next;var a=Ls===null?Dt.memoizedState:Ls.next;if(a!==null)Ls=a,cs=t;else{if(t===null)throw Dt.alternate===null?Error(i(467)):Error(i(310));cs=t,t={memoizedState:cs.memoizedState,baseState:cs.baseState,baseQueue:cs.baseQueue,queue:cs.queue,next:null},Ls===null?Dt.memoizedState=Ls=t:Ls=Ls.next=t}return Ls}function dd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Mo(t){var a=Ao;return Ao+=1,gl===null&&(gl=[]),t=ig(gl,t,a),a=Dt,(Ls===null?a.memoizedState:Ls.next)===null&&(a=a.alternate,Y.H=a===null||a.memoizedState===null?Qg:Xh),t}function ud(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Mo(t);if(t.$$typeof===I)return Js(t)}throw Error(i(438,String(t)))}function zh(t){var a=null,l=Dt.updateQueue;if(l!==null&&(a=l.memoCache),a==null){var c=Dt.alternate;c!==null&&(c=c.updateQueue,c!==null&&(c=c.memoCache,c!=null&&(a={data:c.data.map(function(m){return m.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),l===null&&(l=dd(),Dt.updateQueue=l),l.memoCache=a,l=a.data[a.index],l===void 0)for(l=a.data[a.index]=Array(t),c=0;c<t;c++)l[c]=le;return a.index++,l}function sr(t,a){return typeof a=="function"?a(t):a}function hd(t){var a=Is();return Uh(a,cs,t)}function Uh(t,a,l){var c=t.queue;if(c===null)throw Error(i(311));c.lastRenderedReducer=l;var m=t.baseQueue,x=c.pending;if(x!==null){if(m!==null){var w=m.next;m.next=x.next,x.next=w}a.baseQueue=m=x,c.pending=null}if(x=t.baseState,m===null)t.memoizedState=x;else{a=m.next;var E=w=null,Q=null,ye=a,Te=!1;do{var Re=ye.lane&-536870913;if(Re!==ye.lane?(Yt&Re)===Re:(tr&Re)===Re){var ve=ye.revertLane;if(ve===0)Q!==null&&(Q=Q.next={lane:0,revertLane:0,gesture:null,action:ye.action,hasEagerState:ye.hasEagerState,eagerState:ye.eagerState,next:null}),Re===ul&&(Te=!0);else if((tr&ve)===ve){ye=ye.next,ve===ul&&(Te=!0);continue}else Re={lane:0,revertLane:ye.revertLane,gesture:null,action:ye.action,hasEagerState:ye.hasEagerState,eagerState:ye.eagerState,next:null},Q===null?(E=Q=Re,w=x):Q=Q.next=Re,Dt.lanes|=ve,Or|=ve;Re=ye.action,wi&&l(x,Re),x=ye.hasEagerState?ye.eagerState:l(x,Re)}else ve={lane:Re,revertLane:ye.revertLane,gesture:ye.gesture,action:ye.action,hasEagerState:ye.hasEagerState,eagerState:ye.eagerState,next:null},Q===null?(E=Q=ve,w=x):Q=Q.next=ve,Dt.lanes|=Re,Or|=Re;ye=ye.next}while(ye!==null&&ye!==a);if(Q===null?w=x:Q.next=E,!Dn(x,t.memoizedState)&&(Os=!0,Te&&(l=hl,l!==null)))throw l;t.memoizedState=x,t.baseState=w,t.baseQueue=Q,c.lastRenderedState=x}return m===null&&(c.lanes=0),[t.memoizedState,c.dispatch]}function $h(t){var a=Is(),l=a.queue;if(l===null)throw Error(i(311));l.lastRenderedReducer=t;var c=l.dispatch,m=l.pending,x=a.memoizedState;if(m!==null){l.pending=null;var w=m=m.next;do x=t(x,w.action),w=w.next;while(w!==m);Dn(x,a.memoizedState)||(Os=!0),a.memoizedState=x,a.baseQueue===null&&(a.baseState=x),l.lastRenderedState=x}return[x,c]}function gg(t,a,l){var c=Dt,m=Is(),x=Zt;if(x){if(l===void 0)throw Error(i(407));l=l()}else l=a();var w=!Dn((cs||m).memoizedState,l);if(w&&(m.memoizedState=l,Os=!0),m=m.queue,Vh(vg.bind(null,c,m,t),[t]),m.getSnapshot!==a||w||Ls!==null&&Ls.memoizedState.tag&1){if(c.flags|=2048,yl(9,{destroy:void 0},bg.bind(null,c,m,l,a),null),ms===null)throw Error(i(349));x||(tr&127)!==0||yg(c,a,l)}return l}function yg(t,a,l){t.flags|=16384,t={getSnapshot:a,value:l},a=Dt.updateQueue,a===null?(a=dd(),Dt.updateQueue=a,a.stores=[t]):(l=a.stores,l===null?a.stores=[t]:l.push(t))}function bg(t,a,l,c){a.value=l,a.getSnapshot=c,jg(a)&&Ng(t)}function vg(t,a,l){return l(function(){jg(a)&&Ng(t)})}function jg(t){var a=t.getSnapshot;t=t.value;try{var l=a();return!Dn(t,l)}catch{return!0}}function Ng(t){var a=fi(t,2);a!==null&&Sn(a,t,2)}function Bh(t){var a=gn();if(typeof t=="function"){var l=t;if(t=l(),wi){O(!0);try{l()}finally{O(!1)}}}return a.memoizedState=a.baseState=t,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:sr,lastRenderedState:t},a}function wg(t,a,l,c){return t.baseState=l,Uh(t,cs,typeof c=="function"?c:sr)}function Uw(t,a,l,c,m){if(pd(t))throw Error(i(485));if(t=a.action,t!==null){var x={payload:m,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){x.listeners.push(w)}};Y.T!==null?l(!0):x.isTransition=!1,c(x),l=a.pending,l===null?(x.next=a.pending=x,kg(a,x)):(x.next=l.next,a.pending=l.next=x)}}function kg(t,a){var l=a.action,c=a.payload,m=t.state;if(a.isTransition){var x=Y.T,w={};Y.T=w;try{var E=l(m,c),Q=Y.S;Q!==null&&Q(w,E),Sg(t,a,E)}catch(ye){_h(t,a,ye)}finally{x!==null&&w.types!==null&&(x.types=w.types),Y.T=x}}else try{x=l(m,c),Sg(t,a,x)}catch(ye){_h(t,a,ye)}}function Sg(t,a,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(c){Cg(t,a,c)},function(c){return _h(t,a,c)}):Cg(t,a,l)}function Cg(t,a,l){a.status="fulfilled",a.value=l,Tg(a),t.state=l,a=t.pending,a!==null&&(l=a.next,l===a?t.pending=null:(l=l.next,a.next=l,kg(t,l)))}function _h(t,a,l){var c=t.pending;if(t.pending=null,c!==null){c=c.next;do a.status="rejected",a.reason=l,Tg(a),a=a.next;while(a!==c)}t.action=null}function Tg(t){t=t.listeners;for(var a=0;a<t.length;a++)(0,t[a])()}function Ag(t,a){return a}function Mg(t,a){if(Zt){var l=ms.formState;if(l!==null){e:{var c=Dt;if(Zt){if(ys){t:{for(var m=ys,x=ta;m.nodeType!==8;){if(!x){m=null;break t}if(m=na(m.nextSibling),m===null){m=null;break t}}x=m.data,m=x==="F!"||x==="F"?m:null}if(m){ys=na(m.nextSibling),c=m.data==="F!";break e}}Tr(c)}c=!1}c&&(a=l[0])}}return l=gn(),l.memoizedState=l.baseState=a,c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ag,lastRenderedState:a},l.queue=c,l=Xg.bind(null,Dt,c),c.dispatch=l,c=Bh(!1),x=qh.bind(null,Dt,!1,c.queue),c=gn(),m={state:a,dispatch:null,action:t,pending:null},c.queue=m,l=Uw.bind(null,Dt,m,x,l),m.dispatch=l,c.memoizedState=t,[a,l,!1]}function Eg(t){var a=Is();return Ig(a,cs,t)}function Ig(t,a,l){if(a=Uh(t,a,Ag)[0],t=hd(sr)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var c=Mo(a)}catch(w){throw w===ml?sd:w}else c=a;a=Is();var m=a.queue,x=m.dispatch;return l!==a.memoizedState&&(Dt.flags|=2048,yl(9,{destroy:void 0},$w.bind(null,m,l),null)),[c,x,t]}function $w(t,a){t.action=a}function Rg(t){var a=Is(),l=cs;if(l!==null)return Ig(a,l,t);Is(),a=a.memoizedState,l=Is();var c=l.queue.dispatch;return l.memoizedState=t,[a,c,!1]}function yl(t,a,l,c){return t={tag:t,create:l,deps:c,inst:a,next:null},a=Dt.updateQueue,a===null&&(a=dd(),Dt.updateQueue=a),l=a.lastEffect,l===null?a.lastEffect=t.next=t:(c=l.next,l.next=t,t.next=c,a.lastEffect=t),t}function Dg(){return Is().memoizedState}function md(t,a,l,c){var m=gn();Dt.flags|=t,m.memoizedState=yl(1|a,{destroy:void 0},l,c===void 0?null:c)}function fd(t,a,l,c){var m=Is();c=c===void 0?null:c;var x=m.memoizedState.inst;cs!==null&&c!==null&&Rh(c,cs.memoizedState.deps)?m.memoizedState=yl(a,x,l,c):(Dt.flags|=t,m.memoizedState=yl(1|a,x,l,c))}function Pg(t,a){md(8390656,8,t,a)}function Vh(t,a){fd(2048,8,t,a)}function Bw(t){Dt.flags|=4;var a=Dt.updateQueue;if(a===null)a=dd(),Dt.updateQueue=a,a.events=[t];else{var l=a.events;l===null?a.events=[t]:l.push(t)}}function Lg(t){var a=Is().memoizedState;return Bw({ref:a,nextImpl:t}),function(){if((rs&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}function Og(t,a){return fd(4,2,t,a)}function zg(t,a){return fd(4,4,t,a)}function Ug(t,a){if(typeof a=="function"){t=t();var l=a(t);return function(){typeof l=="function"?l():a(null)}}if(a!=null)return t=t(),a.current=t,function(){a.current=null}}function $g(t,a,l){l=l!=null?l.concat([t]):null,fd(4,4,Ug.bind(null,a,t),l)}function Kh(){}function Bg(t,a){var l=Is();a=a===void 0?null:a;var c=l.memoizedState;return a!==null&&Rh(a,c[1])?c[0]:(l.memoizedState=[t,a],t)}function _g(t,a){var l=Is();a=a===void 0?null:a;var c=l.memoizedState;if(a!==null&&Rh(a,c[1]))return c[0];if(c=t(),wi){O(!0);try{t()}finally{O(!1)}}return l.memoizedState=[c,a],c}function Hh(t,a,l){return l===void 0||(tr&1073741824)!==0&&(Yt&261930)===0?t.memoizedState=a:(t.memoizedState=l,t=V0(),Dt.lanes|=t,Or|=t,l)}function Vg(t,a,l,c){return Dn(l,a)?l:pl.current!==null?(t=Hh(t,l,c),Dn(t,a)||(Os=!0),t):(tr&42)===0||(tr&1073741824)!==0&&(Yt&261930)===0?(Os=!0,t.memoizedState=l):(t=V0(),Dt.lanes|=t,Or|=t,a)}function Kg(t,a,l,c,m){var x=P.p;P.p=x!==0&&8>x?x:8;var w=Y.T,E={};Y.T=E,qh(t,!1,a,l);try{var Q=m(),ye=Y.S;if(ye!==null&&ye(E,Q),Q!==null&&typeof Q=="object"&&typeof Q.then=="function"){var Te=Lw(Q,c);Eo(t,a,Te,$n(t))}else Eo(t,a,c,$n(t))}catch(Re){Eo(t,a,{then:function(){},status:"rejected",reason:Re},$n())}finally{P.p=x,w!==null&&E.types!==null&&(w.types=E.types),Y.T=w}}function _w(){}function Fh(t,a,l,c){if(t.tag!==5)throw Error(i(476));var m=Hg(t).queue;Kg(t,m,a,F,l===null?_w:function(){return Fg(t),l(c)})}function Hg(t){var a=t.memoizedState;if(a!==null)return a;a={memoizedState:F,baseState:F,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:sr,lastRenderedState:F},next:null};var l={};return a.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:sr,lastRenderedState:l},next:null},t.memoizedState=a,t=t.alternate,t!==null&&(t.memoizedState=a),a}function Fg(t){var a=Hg(t);a.next===null&&(a=t.alternate.memoizedState),Eo(t,a.next.queue,{},$n())}function Gh(){return Js(qo)}function Gg(){return Is().memoizedState}function qg(){return Is().memoizedState}function Vw(t){for(var a=t.return;a!==null;){switch(a.tag){case 24:case 3:var l=$n();t=Er(l);var c=Ir(a,t,l);c!==null&&(Sn(c,a,l),So(c,a,l)),a={cache:jh()},t.payload=a;return}a=a.return}}function Kw(t,a,l){var c=$n();l={lane:c,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},pd(t)?Yg(a,l):(l=dh(t,a,l,c),l!==null&&(Sn(l,t,c),Wg(l,a,c)))}function Xg(t,a,l){var c=$n();Eo(t,a,l,c)}function Eo(t,a,l,c){var m={lane:c,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(pd(t))Yg(a,m);else{var x=t.alternate;if(t.lanes===0&&(x===null||x.lanes===0)&&(x=a.lastRenderedReducer,x!==null))try{var w=a.lastRenderedState,E=x(w,l);if(m.hasEagerState=!0,m.eagerState=E,Dn(E,w))return Yc(t,a,m,0),ms===null&&Xc(),!1}catch{}finally{}if(l=dh(t,a,m,c),l!==null)return Sn(l,t,c),Wg(l,a,c),!0}return!1}function qh(t,a,l,c){if(c={lane:2,revertLane:Sm(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},pd(t)){if(a)throw Error(i(479))}else a=dh(t,l,c,2),a!==null&&Sn(a,t,2)}function pd(t){var a=t.alternate;return t===Dt||a!==null&&a===Dt}function Yg(t,a){xl=od=!0;var l=t.pending;l===null?a.next=a:(a.next=l.next,l.next=a),t.pending=a}function Wg(t,a,l){if((l&4194048)!==0){var c=a.lanes;c&=t.pendingLanes,l|=c,a.lanes=l,qn(t,l)}}var Io={readContext:Js,use:ud,useCallback:ks,useContext:ks,useEffect:ks,useImperativeHandle:ks,useLayoutEffect:ks,useInsertionEffect:ks,useMemo:ks,useReducer:ks,useRef:ks,useState:ks,useDebugValue:ks,useDeferredValue:ks,useTransition:ks,useSyncExternalStore:ks,useId:ks,useHostTransitionStatus:ks,useFormState:ks,useActionState:ks,useOptimistic:ks,useMemoCache:ks,useCacheRefresh:ks};Io.useEffectEvent=ks;var Qg={readContext:Js,use:ud,useCallback:function(t,a){return gn().memoizedState=[t,a===void 0?null:a],t},useContext:Js,useEffect:Pg,useImperativeHandle:function(t,a,l){l=l!=null?l.concat([t]):null,md(4194308,4,Ug.bind(null,a,t),l)},useLayoutEffect:function(t,a){return md(4194308,4,t,a)},useInsertionEffect:function(t,a){md(4,2,t,a)},useMemo:function(t,a){var l=gn();a=a===void 0?null:a;var c=t();if(wi){O(!0);try{t()}finally{O(!1)}}return l.memoizedState=[c,a],c},useReducer:function(t,a,l){var c=gn();if(l!==void 0){var m=l(a);if(wi){O(!0);try{l(a)}finally{O(!1)}}}else m=a;return c.memoizedState=c.baseState=m,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:m},c.queue=t,t=t.dispatch=Kw.bind(null,Dt,t),[c.memoizedState,t]},useRef:function(t){var a=gn();return t={current:t},a.memoizedState=t},useState:function(t){t=Bh(t);var a=t.queue,l=Xg.bind(null,Dt,a);return a.dispatch=l,[t.memoizedState,l]},useDebugValue:Kh,useDeferredValue:function(t,a){var l=gn();return Hh(l,t,a)},useTransition:function(){var t=Bh(!1);return t=Kg.bind(null,Dt,t.queue,!0,!1),gn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,a,l){var c=Dt,m=gn();if(Zt){if(l===void 0)throw Error(i(407));l=l()}else{if(l=a(),ms===null)throw Error(i(349));(Yt&127)!==0||yg(c,a,l)}m.memoizedState=l;var x={value:l,getSnapshot:a};return m.queue=x,Pg(vg.bind(null,c,x,t),[t]),c.flags|=2048,yl(9,{destroy:void 0},bg.bind(null,c,x,l,a),null),l},useId:function(){var t=gn(),a=ms.identifierPrefix;if(Zt){var l=Ia,c=Ea;l=(c&~(1<<32-ne(c)-1)).toString(32)+l,a="_"+a+"R_"+l,l=cd++,0<l&&(a+="H"+l.toString(32)),a+="_"}else l=Ow++,a="_"+a+"r_"+l.toString(32)+"_";return t.memoizedState=a},useHostTransitionStatus:Gh,useFormState:Mg,useActionState:Mg,useOptimistic:function(t){var a=gn();a.memoizedState=a.baseState=t;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=l,a=qh.bind(null,Dt,!0,l),l.dispatch=a,[t,a]},useMemoCache:zh,useCacheRefresh:function(){return gn().memoizedState=Vw.bind(null,Dt)},useEffectEvent:function(t){var a=gn(),l={impl:t};return a.memoizedState=l,function(){if((rs&2)!==0)throw Error(i(440));return l.impl.apply(void 0,arguments)}}},Xh={readContext:Js,use:ud,useCallback:Bg,useContext:Js,useEffect:Vh,useImperativeHandle:$g,useInsertionEffect:Og,useLayoutEffect:zg,useMemo:_g,useReducer:hd,useRef:Dg,useState:function(){return hd(sr)},useDebugValue:Kh,useDeferredValue:function(t,a){var l=Is();return Vg(l,cs.memoizedState,t,a)},useTransition:function(){var t=hd(sr)[0],a=Is().memoizedState;return[typeof t=="boolean"?t:Mo(t),a]},useSyncExternalStore:gg,useId:Gg,useHostTransitionStatus:Gh,useFormState:Eg,useActionState:Eg,useOptimistic:function(t,a){var l=Is();return wg(l,cs,t,a)},useMemoCache:zh,useCacheRefresh:qg};Xh.useEffectEvent=Lg;var Zg={readContext:Js,use:ud,useCallback:Bg,useContext:Js,useEffect:Vh,useImperativeHandle:$g,useInsertionEffect:Og,useLayoutEffect:zg,useMemo:_g,useReducer:$h,useRef:Dg,useState:function(){return $h(sr)},useDebugValue:Kh,useDeferredValue:function(t,a){var l=Is();return cs===null?Hh(l,t,a):Vg(l,cs.memoizedState,t,a)},useTransition:function(){var t=$h(sr)[0],a=Is().memoizedState;return[typeof t=="boolean"?t:Mo(t),a]},useSyncExternalStore:gg,useId:Gg,useHostTransitionStatus:Gh,useFormState:Rg,useActionState:Rg,useOptimistic:function(t,a){var l=Is();return cs!==null?wg(l,cs,t,a):(l.baseState=t,[t,l.queue.dispatch])},useMemoCache:zh,useCacheRefresh:qg};Zg.useEffectEvent=Lg;function Yh(t,a,l,c){a=t.memoizedState,l=l(c,a),l=l==null?a:b({},a,l),t.memoizedState=l,t.lanes===0&&(t.updateQueue.baseState=l)}var Wh={enqueueSetState:function(t,a,l){t=t._reactInternals;var c=$n(),m=Er(c);m.payload=a,l!=null&&(m.callback=l),a=Ir(t,m,c),a!==null&&(Sn(a,t,c),So(a,t,c))},enqueueReplaceState:function(t,a,l){t=t._reactInternals;var c=$n(),m=Er(c);m.tag=1,m.payload=a,l!=null&&(m.callback=l),a=Ir(t,m,c),a!==null&&(Sn(a,t,c),So(a,t,c))},enqueueForceUpdate:function(t,a){t=t._reactInternals;var l=$n(),c=Er(l);c.tag=2,a!=null&&(c.callback=a),a=Ir(t,c,l),a!==null&&(Sn(a,t,l),So(a,t,l))}};function Jg(t,a,l,c,m,x,w){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(c,x,w):a.prototype&&a.prototype.isPureReactComponent?!go(l,c)||!go(m,x):!0}function e0(t,a,l,c){t=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(l,c),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(l,c),a.state!==t&&Wh.enqueueReplaceState(a,a.state,null)}function ki(t,a){var l=a;if("ref"in a){l={};for(var c in a)c!=="ref"&&(l[c]=a[c])}if(t=t.defaultProps){l===a&&(l=b({},l));for(var m in t)l[m]===void 0&&(l[m]=t[m])}return l}function t0(t){qc(t)}function s0(t){console.error(t)}function n0(t){qc(t)}function xd(t,a){try{var l=t.onUncaughtError;l(a.value,{componentStack:a.stack})}catch(c){setTimeout(function(){throw c})}}function a0(t,a,l){try{var c=t.onCaughtError;c(l.value,{componentStack:l.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(m){setTimeout(function(){throw m})}}function Qh(t,a,l){return l=Er(l),l.tag=3,l.payload={element:null},l.callback=function(){xd(t,a)},l}function r0(t){return t=Er(t),t.tag=3,t}function i0(t,a,l,c){var m=l.type.getDerivedStateFromError;if(typeof m=="function"){var x=c.value;t.payload=function(){return m(x)},t.callback=function(){a0(a,l,c)}}var w=l.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(t.callback=function(){a0(a,l,c),typeof m!="function"&&(zr===null?zr=new Set([this]):zr.add(this));var E=c.stack;this.componentDidCatch(c.value,{componentStack:E!==null?E:""})})}function Hw(t,a,l,c,m){if(l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){if(a=l.alternate,a!==null&&dl(a,l,m,!0),l=Ln.current,l!==null){switch(l.tag){case 31:case 13:return sa===null?Ad():l.alternate===null&&Ss===0&&(Ss=3),l.flags&=-257,l.flags|=65536,l.lanes=m,c===nd?l.flags|=16384:(a=l.updateQueue,a===null?l.updateQueue=new Set([c]):a.add(c),Nm(t,c,m)),!1;case 22:return l.flags|=65536,c===nd?l.flags|=16384:(a=l.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([c])},l.updateQueue=a):(l=a.retryQueue,l===null?a.retryQueue=new Set([c]):l.add(c)),Nm(t,c,m)),!1}throw Error(i(435,l.tag))}return Nm(t,c,m),Ad(),!1}if(Zt)return a=Ln.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=m,c!==xh&&(t=Error(i(422),{cause:c}),vo(Zn(t,l)))):(c!==xh&&(a=Error(i(423),{cause:c}),vo(Zn(a,l))),t=t.current.alternate,t.flags|=65536,m&=-m,t.lanes|=m,c=Zn(c,l),m=Qh(t.stateNode,c,m),Th(t,m),Ss!==4&&(Ss=2)),!1;var x=Error(i(520),{cause:c});if(x=Zn(x,l),$o===null?$o=[x]:$o.push(x),Ss!==4&&(Ss=2),a===null)return!0;c=Zn(c,l),l=a;do{switch(l.tag){case 3:return l.flags|=65536,t=m&-m,l.lanes|=t,t=Qh(l.stateNode,c,t),Th(l,t),!1;case 1:if(a=l.type,x=l.stateNode,(l.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(zr===null||!zr.has(x))))return l.flags|=65536,m&=-m,l.lanes|=m,m=r0(m),i0(m,t,l,c),Th(l,m),!1}l=l.return}while(l!==null);return!1}var Zh=Error(i(461)),Os=!1;function en(t,a,l,c){a.child=t===null?dg(a,null,l,c):Ni(a,t.child,l,c)}function l0(t,a,l,c,m){l=l.render;var x=a.ref;if("ref"in c){var w={};for(var E in c)E!=="ref"&&(w[E]=c[E])}else w=c;return yi(a),c=Dh(t,a,l,w,x,m),E=Ph(),t!==null&&!Os?(Lh(t,a,m),nr(t,a,m)):(Zt&&E&&fh(a),a.flags|=1,en(t,a,c,m),a.child)}function o0(t,a,l,c,m){if(t===null){var x=l.type;return typeof x=="function"&&!uh(x)&&x.defaultProps===void 0&&l.compare===null?(a.tag=15,a.type=x,c0(t,a,x,c,m)):(t=Qc(l.type,null,c,a,a.mode,m),t.ref=a.ref,t.return=a,a.child=t)}if(x=t.child,!im(t,m)){var w=x.memoizedProps;if(l=l.compare,l=l!==null?l:go,l(w,c)&&t.ref===a.ref)return nr(t,a,m)}return a.flags|=1,t=Qa(x,c),t.ref=a.ref,t.return=a,a.child=t}function c0(t,a,l,c,m){if(t!==null){var x=t.memoizedProps;if(go(x,c)&&t.ref===a.ref)if(Os=!1,a.pendingProps=c=x,im(t,m))(t.flags&131072)!==0&&(Os=!0);else return a.lanes=t.lanes,nr(t,a,m)}return Jh(t,a,l,c,m)}function d0(t,a,l,c){var m=c.children,x=t!==null?t.memoizedState:null;if(t===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),c.mode==="hidden"){if((a.flags&128)!==0){if(x=x!==null?x.baseLanes|l:l,t!==null){for(c=a.child=t.child,m=0;c!==null;)m=m|c.lanes|c.childLanes,c=c.sibling;c=m&~x}else c=0,a.child=null;return u0(t,a,x,l,c)}if((l&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},t!==null&&td(a,x!==null?x.cachePool:null),x!==null?mg(a,x):Mh(),fg(a);else return c=a.lanes=536870912,u0(t,a,x!==null?x.baseLanes|l:l,l,c)}else x!==null?(td(a,x.cachePool),mg(a,x),Dr(),a.memoizedState=null):(t!==null&&td(a,null),Mh(),Dr());return en(t,a,m,l),a.child}function Ro(t,a){return t!==null&&t.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function u0(t,a,l,c,m){var x=wh();return x=x===null?null:{parent:Ps._currentValue,pool:x},a.memoizedState={baseLanes:l,cachePool:x},t!==null&&td(a,null),Mh(),fg(a),t!==null&&dl(t,a,c,!0),a.childLanes=m,null}function gd(t,a){return a=bd({mode:a.mode,children:a.children},t.mode),a.ref=t.ref,t.child=a,a.return=t,a}function h0(t,a,l){return Ni(a,t.child,null,l),t=gd(a,a.pendingProps),t.flags|=2,On(a),a.memoizedState=null,t}function Fw(t,a,l){var c=a.pendingProps,m=(a.flags&128)!==0;if(a.flags&=-129,t===null){if(Zt){if(c.mode==="hidden")return t=gd(a,c),a.lanes=536870912,Ro(null,t);if(Ih(a),(t=ys)?(t=ky(t,ta),t=t!==null&&t.data==="&"?t:null,t!==null&&(a.memoizedState={dehydrated:t,treeContext:Sr!==null?{id:Ea,overflow:Ia}:null,retryLane:536870912,hydrationErrors:null},l=Yx(t),l.return=a,a.child=l,Zs=a,ys=null)):t=null,t===null)throw Tr(a);return a.lanes=536870912,null}return gd(a,c)}var x=t.memoizedState;if(x!==null){var w=x.dehydrated;if(Ih(a),m)if(a.flags&256)a.flags&=-257,a=h0(t,a,l);else if(a.memoizedState!==null)a.child=t.child,a.flags|=128,a=null;else throw Error(i(558));else if(Os||dl(t,a,l,!1),m=(l&t.childLanes)!==0,Os||m){if(c=ms,c!==null&&(w=Ot(c,l),w!==0&&w!==x.retryLane))throw x.retryLane=w,fi(t,w),Sn(c,t,w),Zh;Ad(),a=h0(t,a,l)}else t=x.treeContext,ys=na(w.nextSibling),Zs=a,Zt=!0,Cr=null,ta=!1,t!==null&&Zx(a,t),a=gd(a,c),a.flags|=4096;return a}return t=Qa(t.child,{mode:c.mode,children:c.children}),t.ref=a.ref,a.child=t,t.return=a,t}function yd(t,a){var l=a.ref;if(l===null)t!==null&&t.ref!==null&&(a.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(i(284));(t===null||t.ref!==l)&&(a.flags|=4194816)}}function Jh(t,a,l,c,m){return yi(a),l=Dh(t,a,l,c,void 0,m),c=Ph(),t!==null&&!Os?(Lh(t,a,m),nr(t,a,m)):(Zt&&c&&fh(a),a.flags|=1,en(t,a,l,m),a.child)}function m0(t,a,l,c,m,x){return yi(a),a.updateQueue=null,l=xg(a,c,l,m),pg(t),c=Ph(),t!==null&&!Os?(Lh(t,a,x),nr(t,a,x)):(Zt&&c&&fh(a),a.flags|=1,en(t,a,l,x),a.child)}function f0(t,a,l,c,m){if(yi(a),a.stateNode===null){var x=il,w=l.contextType;typeof w=="object"&&w!==null&&(x=Js(w)),x=new l(c,x),a.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=Wh,a.stateNode=x,x._reactInternals=a,x=a.stateNode,x.props=c,x.state=a.memoizedState,x.refs={},Sh(a),w=l.contextType,x.context=typeof w=="object"&&w!==null?Js(w):il,x.state=a.memoizedState,w=l.getDerivedStateFromProps,typeof w=="function"&&(Yh(a,l,w,c),x.state=a.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(w=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),w!==x.state&&Wh.enqueueReplaceState(x,x.state,null),To(a,c,x,m),Co(),x.state=a.memoizedState),typeof x.componentDidMount=="function"&&(a.flags|=4194308),c=!0}else if(t===null){x=a.stateNode;var E=a.memoizedProps,Q=ki(l,E);x.props=Q;var ye=x.context,Te=l.contextType;w=il,typeof Te=="object"&&Te!==null&&(w=Js(Te));var Re=l.getDerivedStateFromProps;Te=typeof Re=="function"||typeof x.getSnapshotBeforeUpdate=="function",E=a.pendingProps!==E,Te||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(E||ye!==w)&&e0(a,x,c,w),Mr=!1;var ve=a.memoizedState;x.state=ve,To(a,c,x,m),Co(),ye=a.memoizedState,E||ve!==ye||Mr?(typeof Re=="function"&&(Yh(a,l,Re,c),ye=a.memoizedState),(Q=Mr||Jg(a,l,Q,c,ve,ye,w))?(Te||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(a.flags|=4194308)):(typeof x.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=c,a.memoizedState=ye),x.props=c,x.state=ye,x.context=w,c=Q):(typeof x.componentDidMount=="function"&&(a.flags|=4194308),c=!1)}else{x=a.stateNode,Ch(t,a),w=a.memoizedProps,Te=ki(l,w),x.props=Te,Re=a.pendingProps,ve=x.context,ye=l.contextType,Q=il,typeof ye=="object"&&ye!==null&&(Q=Js(ye)),E=l.getDerivedStateFromProps,(ye=typeof E=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(w!==Re||ve!==Q)&&e0(a,x,c,Q),Mr=!1,ve=a.memoizedState,x.state=ve,To(a,c,x,m),Co();var ke=a.memoizedState;w!==Re||ve!==ke||Mr||t!==null&&t.dependencies!==null&&Jc(t.dependencies)?(typeof E=="function"&&(Yh(a,l,E,c),ke=a.memoizedState),(Te=Mr||Jg(a,l,Te,c,ve,ke,Q)||t!==null&&t.dependencies!==null&&Jc(t.dependencies))?(ye||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(c,ke,Q),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(c,ke,Q)),typeof x.componentDidUpdate=="function"&&(a.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof x.componentDidUpdate!="function"||w===t.memoizedProps&&ve===t.memoizedState||(a.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===t.memoizedProps&&ve===t.memoizedState||(a.flags|=1024),a.memoizedProps=c,a.memoizedState=ke),x.props=c,x.state=ke,x.context=Q,c=Te):(typeof x.componentDidUpdate!="function"||w===t.memoizedProps&&ve===t.memoizedState||(a.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===t.memoizedProps&&ve===t.memoizedState||(a.flags|=1024),c=!1)}return x=c,yd(t,a),c=(a.flags&128)!==0,x||c?(x=a.stateNode,l=c&&typeof l.getDerivedStateFromError!="function"?null:x.render(),a.flags|=1,t!==null&&c?(a.child=Ni(a,t.child,null,m),a.child=Ni(a,null,l,m)):en(t,a,l,m),a.memoizedState=x.state,t=a.child):t=nr(t,a,m),t}function p0(t,a,l,c){return xi(),a.flags|=256,en(t,a,l,c),a.child}var em={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function tm(t){return{baseLanes:t,cachePool:ag()}}function sm(t,a,l){return t=t!==null?t.childLanes&~l:0,a&&(t|=Un),t}function x0(t,a,l){var c=a.pendingProps,m=!1,x=(a.flags&128)!==0,w;if((w=x)||(w=t!==null&&t.memoizedState===null?!1:(Es.current&2)!==0),w&&(m=!0,a.flags&=-129),w=(a.flags&32)!==0,a.flags&=-33,t===null){if(Zt){if(m?Rr(a):Dr(),(t=ys)?(t=ky(t,ta),t=t!==null&&t.data!=="&"?t:null,t!==null&&(a.memoizedState={dehydrated:t,treeContext:Sr!==null?{id:Ea,overflow:Ia}:null,retryLane:536870912,hydrationErrors:null},l=Yx(t),l.return=a,a.child=l,Zs=a,ys=null)):t=null,t===null)throw Tr(a);return Um(t)?a.lanes=32:a.lanes=536870912,null}var E=c.children;return c=c.fallback,m?(Dr(),m=a.mode,E=bd({mode:"hidden",children:E},m),c=pi(c,m,l,null),E.return=a,c.return=a,E.sibling=c,a.child=E,c=a.child,c.memoizedState=tm(l),c.childLanes=sm(t,w,l),a.memoizedState=em,Ro(null,c)):(Rr(a),nm(a,E))}var Q=t.memoizedState;if(Q!==null&&(E=Q.dehydrated,E!==null)){if(x)a.flags&256?(Rr(a),a.flags&=-257,a=am(t,a,l)):a.memoizedState!==null?(Dr(),a.child=t.child,a.flags|=128,a=null):(Dr(),E=c.fallback,m=a.mode,c=bd({mode:"visible",children:c.children},m),E=pi(E,m,l,null),E.flags|=2,c.return=a,E.return=a,c.sibling=E,a.child=c,Ni(a,t.child,null,l),c=a.child,c.memoizedState=tm(l),c.childLanes=sm(t,w,l),a.memoizedState=em,a=Ro(null,c));else if(Rr(a),Um(E)){if(w=E.nextSibling&&E.nextSibling.dataset,w)var ye=w.dgst;w=ye,c=Error(i(419)),c.stack="",c.digest=w,vo({value:c,source:null,stack:null}),a=am(t,a,l)}else if(Os||dl(t,a,l,!1),w=(l&t.childLanes)!==0,Os||w){if(w=ms,w!==null&&(c=Ot(w,l),c!==0&&c!==Q.retryLane))throw Q.retryLane=c,fi(t,c),Sn(w,t,c),Zh;zm(E)||Ad(),a=am(t,a,l)}else zm(E)?(a.flags|=192,a.child=t.child,a=null):(t=Q.treeContext,ys=na(E.nextSibling),Zs=a,Zt=!0,Cr=null,ta=!1,t!==null&&Zx(a,t),a=nm(a,c.children),a.flags|=4096);return a}return m?(Dr(),E=c.fallback,m=a.mode,Q=t.child,ye=Q.sibling,c=Qa(Q,{mode:"hidden",children:c.children}),c.subtreeFlags=Q.subtreeFlags&65011712,ye!==null?E=Qa(ye,E):(E=pi(E,m,l,null),E.flags|=2),E.return=a,c.return=a,c.sibling=E,a.child=c,Ro(null,c),c=a.child,E=t.child.memoizedState,E===null?E=tm(l):(m=E.cachePool,m!==null?(Q=Ps._currentValue,m=m.parent!==Q?{parent:Q,pool:Q}:m):m=ag(),E={baseLanes:E.baseLanes|l,cachePool:m}),c.memoizedState=E,c.childLanes=sm(t,w,l),a.memoizedState=em,Ro(t.child,c)):(Rr(a),l=t.child,t=l.sibling,l=Qa(l,{mode:"visible",children:c.children}),l.return=a,l.sibling=null,t!==null&&(w=a.deletions,w===null?(a.deletions=[t],a.flags|=16):w.push(t)),a.child=l,a.memoizedState=null,l)}function nm(t,a){return a=bd({mode:"visible",children:a},t.mode),a.return=t,t.child=a}function bd(t,a){return t=Pn(22,t,null,a),t.lanes=0,t}function am(t,a,l){return Ni(a,t.child,null,l),t=nm(a,a.pendingProps.children),t.flags|=2,a.memoizedState=null,t}function g0(t,a,l){t.lanes|=a;var c=t.alternate;c!==null&&(c.lanes|=a),bh(t.return,a,l)}function rm(t,a,l,c,m,x){var w=t.memoizedState;w===null?t.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:c,tail:l,tailMode:m,treeForkCount:x}:(w.isBackwards=a,w.rendering=null,w.renderingStartTime=0,w.last=c,w.tail=l,w.tailMode=m,w.treeForkCount=x)}function y0(t,a,l){var c=a.pendingProps,m=c.revealOrder,x=c.tail;c=c.children;var w=Es.current,E=(w&2)!==0;if(E?(w=w&1|2,a.flags|=128):w&=1,X(Es,w),en(t,a,c,l),c=Zt?bo:0,!E&&t!==null&&(t.flags&128)!==0)e:for(t=a.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&g0(t,l,a);else if(t.tag===19)g0(t,l,a);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===a)break e;for(;t.sibling===null;){if(t.return===null||t.return===a)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(m){case"forwards":for(l=a.child,m=null;l!==null;)t=l.alternate,t!==null&&ld(t)===null&&(m=l),l=l.sibling;l=m,l===null?(m=a.child,a.child=null):(m=l.sibling,l.sibling=null),rm(a,!1,m,l,x,c);break;case"backwards":case"unstable_legacy-backwards":for(l=null,m=a.child,a.child=null;m!==null;){if(t=m.alternate,t!==null&&ld(t)===null){a.child=m;break}t=m.sibling,m.sibling=l,l=m,m=t}rm(a,!0,l,null,x,c);break;case"together":rm(a,!1,null,null,void 0,c);break;default:a.memoizedState=null}return a.child}function nr(t,a,l){if(t!==null&&(a.dependencies=t.dependencies),Or|=a.lanes,(l&a.childLanes)===0)if(t!==null){if(dl(t,a,l,!1),(l&a.childLanes)===0)return null}else return null;if(t!==null&&a.child!==t.child)throw Error(i(153));if(a.child!==null){for(t=a.child,l=Qa(t,t.pendingProps),a.child=l,l.return=a;t.sibling!==null;)t=t.sibling,l=l.sibling=Qa(t,t.pendingProps),l.return=a;l.sibling=null}return a.child}function im(t,a){return(t.lanes&a)!==0?!0:(t=t.dependencies,!!(t!==null&&Jc(t)))}function Gw(t,a,l){switch(a.tag){case 3:Qe(a,a.stateNode.containerInfo),Ar(a,Ps,t.memoizedState.cache),xi();break;case 27:case 5:st(a);break;case 4:Qe(a,a.stateNode.containerInfo);break;case 10:Ar(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Ih(a),null;break;case 13:var c=a.memoizedState;if(c!==null)return c.dehydrated!==null?(Rr(a),a.flags|=128,null):(l&a.child.childLanes)!==0?x0(t,a,l):(Rr(a),t=nr(t,a,l),t!==null?t.sibling:null);Rr(a);break;case 19:var m=(t.flags&128)!==0;if(c=(l&a.childLanes)!==0,c||(dl(t,a,l,!1),c=(l&a.childLanes)!==0),m){if(c)return y0(t,a,l);a.flags|=128}if(m=a.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),X(Es,Es.current),c)break;return null;case 22:return a.lanes=0,d0(t,a,l,a.pendingProps);case 24:Ar(a,Ps,t.memoizedState.cache)}return nr(t,a,l)}function b0(t,a,l){if(t!==null)if(t.memoizedProps!==a.pendingProps)Os=!0;else{if(!im(t,l)&&(a.flags&128)===0)return Os=!1,Gw(t,a,l);Os=(t.flags&131072)!==0}else Os=!1,Zt&&(a.flags&1048576)!==0&&Qx(a,bo,a.index);switch(a.lanes=0,a.tag){case 16:e:{var c=a.pendingProps;if(t=vi(a.elementType),a.type=t,typeof t=="function")uh(t)?(c=ki(t,c),a.tag=1,a=f0(null,a,t,c,l)):(a.tag=0,a=Jh(null,a,t,c,l));else{if(t!=null){var m=t.$$typeof;if(m===M){a.tag=11,a=l0(null,a,t,c,l);break e}else if(m===U){a.tag=14,a=o0(null,a,t,c,l);break e}}throw a=se(t)||t,Error(i(306,a,""))}}return a;case 0:return Jh(t,a,a.type,a.pendingProps,l);case 1:return c=a.type,m=ki(c,a.pendingProps),f0(t,a,c,m,l);case 3:e:{if(Qe(a,a.stateNode.containerInfo),t===null)throw Error(i(387));c=a.pendingProps;var x=a.memoizedState;m=x.element,Ch(t,a),To(a,c,null,l);var w=a.memoizedState;if(c=w.cache,Ar(a,Ps,c),c!==x.cache&&vh(a,[Ps],l,!0),Co(),c=w.element,x.isDehydrated)if(x={element:c,isDehydrated:!1,cache:w.cache},a.updateQueue.baseState=x,a.memoizedState=x,a.flags&256){a=p0(t,a,c,l);break e}else if(c!==m){m=Zn(Error(i(424)),a),vo(m),a=p0(t,a,c,l);break e}else{switch(t=a.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(ys=na(t.firstChild),Zs=a,Zt=!0,Cr=null,ta=!0,l=dg(a,null,c,l),a.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(xi(),c===m){a=nr(t,a,l);break e}en(t,a,c,l)}a=a.child}return a;case 26:return yd(t,a),t===null?(l=Ey(a.type,null,a.pendingProps,null))?a.memoizedState=l:Zt||(l=a.type,t=a.pendingProps,c=Ld(Oe.current).createElement(l),c[We]=a,c[jt]=t,tn(c,l,t),as(c),a.stateNode=c):a.memoizedState=Ey(a.type,t.memoizedProps,a.pendingProps,t.memoizedState),null;case 27:return st(a),t===null&&Zt&&(c=a.stateNode=Ty(a.type,a.pendingProps,Oe.current),Zs=a,ta=!0,m=ys,_r(a.type)?($m=m,ys=na(c.firstChild)):ys=m),en(t,a,a.pendingProps.children,l),yd(t,a),t===null&&(a.flags|=4194304),a.child;case 5:return t===null&&Zt&&((m=c=ys)&&(c=Nk(c,a.type,a.pendingProps,ta),c!==null?(a.stateNode=c,Zs=a,ys=na(c.firstChild),ta=!1,m=!0):m=!1),m||Tr(a)),st(a),m=a.type,x=a.pendingProps,w=t!==null?t.memoizedProps:null,c=x.children,Pm(m,x)?c=null:w!==null&&Pm(m,w)&&(a.flags|=32),a.memoizedState!==null&&(m=Dh(t,a,zw,null,null,l),qo._currentValue=m),yd(t,a),en(t,a,c,l),a.child;case 6:return t===null&&Zt&&((t=l=ys)&&(l=wk(l,a.pendingProps,ta),l!==null?(a.stateNode=l,Zs=a,ys=null,t=!0):t=!1),t||Tr(a)),null;case 13:return x0(t,a,l);case 4:return Qe(a,a.stateNode.containerInfo),c=a.pendingProps,t===null?a.child=Ni(a,null,c,l):en(t,a,c,l),a.child;case 11:return l0(t,a,a.type,a.pendingProps,l);case 7:return en(t,a,a.pendingProps,l),a.child;case 8:return en(t,a,a.pendingProps.children,l),a.child;case 12:return en(t,a,a.pendingProps.children,l),a.child;case 10:return c=a.pendingProps,Ar(a,a.type,c.value),en(t,a,c.children,l),a.child;case 9:return m=a.type._context,c=a.pendingProps.children,yi(a),m=Js(m),c=c(m),a.flags|=1,en(t,a,c,l),a.child;case 14:return o0(t,a,a.type,a.pendingProps,l);case 15:return c0(t,a,a.type,a.pendingProps,l);case 19:return y0(t,a,l);case 31:return Fw(t,a,l);case 22:return d0(t,a,l,a.pendingProps);case 24:return yi(a),c=Js(Ps),t===null?(m=wh(),m===null&&(m=ms,x=jh(),m.pooledCache=x,x.refCount++,x!==null&&(m.pooledCacheLanes|=l),m=x),a.memoizedState={parent:c,cache:m},Sh(a),Ar(a,Ps,m)):((t.lanes&l)!==0&&(Ch(t,a),To(a,null,null,l),Co()),m=t.memoizedState,x=a.memoizedState,m.parent!==c?(m={parent:c,cache:c},a.memoizedState=m,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=m),Ar(a,Ps,c)):(c=x.cache,Ar(a,Ps,c),c!==m.cache&&vh(a,[Ps],l,!0))),en(t,a,a.pendingProps.children,l),a.child;case 29:throw a.pendingProps}throw Error(i(156,a.tag))}function ar(t){t.flags|=4}function lm(t,a,l,c,m){if((a=(t.mode&32)!==0)&&(a=!1),a){if(t.flags|=16777216,(m&335544128)===m)if(t.stateNode.complete)t.flags|=8192;else if(G0())t.flags|=8192;else throw ji=nd,kh}else t.flags&=-16777217}function v0(t,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!Ly(a))if(G0())t.flags|=8192;else throw ji=nd,kh}function vd(t,a){a!==null&&(t.flags|=4),t.flags&16384&&(a=t.tag!==22?Xe():536870912,t.lanes|=a,Nl|=a)}function Do(t,a){if(!Zt)switch(t.tailMode){case"hidden":a=t.tail;for(var l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?t.tail=null:l.sibling=null;break;case"collapsed":l=t.tail;for(var c=null;l!==null;)l.alternate!==null&&(c=l),l=l.sibling;c===null?a||t.tail===null?t.tail=null:t.tail.sibling=null:c.sibling=null}}function bs(t){var a=t.alternate!==null&&t.alternate.child===t.child,l=0,c=0;if(a)for(var m=t.child;m!==null;)l|=m.lanes|m.childLanes,c|=m.subtreeFlags&65011712,c|=m.flags&65011712,m.return=t,m=m.sibling;else for(m=t.child;m!==null;)l|=m.lanes|m.childLanes,c|=m.subtreeFlags,c|=m.flags,m.return=t,m=m.sibling;return t.subtreeFlags|=c,t.childLanes=l,a}function qw(t,a,l){var c=a.pendingProps;switch(ph(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return bs(a),null;case 1:return bs(a),null;case 3:return l=a.stateNode,c=null,t!==null&&(c=t.memoizedState.cache),a.memoizedState.cache!==c&&(a.flags|=2048),er(Ps),_e(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(t===null||t.child===null)&&(cl(a)?ar(a):t===null||t.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,gh())),bs(a),null;case 26:var m=a.type,x=a.memoizedState;return t===null?(ar(a),x!==null?(bs(a),v0(a,x)):(bs(a),lm(a,m,null,c,l))):x?x!==t.memoizedState?(ar(a),bs(a),v0(a,x)):(bs(a),a.flags&=-16777217):(t=t.memoizedProps,t!==c&&ar(a),bs(a),lm(a,m,t,c,l)),null;case 27:if(oe(a),l=Oe.current,m=a.type,t!==null&&a.stateNode!=null)t.memoizedProps!==c&&ar(a);else{if(!c){if(a.stateNode===null)throw Error(i(166));return bs(a),null}t=re.current,cl(a)?Jx(a):(t=Ty(m,c,l),a.stateNode=t,ar(a))}return bs(a),null;case 5:if(oe(a),m=a.type,t!==null&&a.stateNode!=null)t.memoizedProps!==c&&ar(a);else{if(!c){if(a.stateNode===null)throw Error(i(166));return bs(a),null}if(x=re.current,cl(a))Jx(a);else{var w=Ld(Oe.current);switch(x){case 1:x=w.createElementNS("http://www.w3.org/2000/svg",m);break;case 2:x=w.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;default:switch(m){case"svg":x=w.createElementNS("http://www.w3.org/2000/svg",m);break;case"math":x=w.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;case"script":x=w.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof c.is=="string"?w.createElement("select",{is:c.is}):w.createElement("select"),c.multiple?x.multiple=!0:c.size&&(x.size=c.size);break;default:x=typeof c.is=="string"?w.createElement(m,{is:c.is}):w.createElement(m)}}x[We]=a,x[jt]=c;e:for(w=a.child;w!==null;){if(w.tag===5||w.tag===6)x.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===a)break e;for(;w.sibling===null;){if(w.return===null||w.return===a)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}a.stateNode=x;e:switch(tn(x,m,c),m){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}c&&ar(a)}}return bs(a),lm(a,a.type,t===null?null:t.memoizedProps,a.pendingProps,l),null;case 6:if(t&&a.stateNode!=null)t.memoizedProps!==c&&ar(a);else{if(typeof c!="string"&&a.stateNode===null)throw Error(i(166));if(t=Oe.current,cl(a)){if(t=a.stateNode,l=a.memoizedProps,c=null,m=Zs,m!==null)switch(m.tag){case 27:case 5:c=m.memoizedProps}t[We]=a,t=!!(t.nodeValue===l||c!==null&&c.suppressHydrationWarning===!0||xy(t.nodeValue,l)),t||Tr(a,!0)}else t=Ld(t).createTextNode(c),t[We]=a,a.stateNode=t}return bs(a),null;case 31:if(l=a.memoizedState,t===null||t.memoizedState!==null){if(c=cl(a),l!==null){if(t===null){if(!c)throw Error(i(318));if(t=a.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(557));t[We]=a}else xi(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;bs(a),t=!1}else l=gh(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=l),t=!0;if(!t)return a.flags&256?(On(a),a):(On(a),null);if((a.flags&128)!==0)throw Error(i(558))}return bs(a),null;case 13:if(c=a.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(m=cl(a),c!==null&&c.dehydrated!==null){if(t===null){if(!m)throw Error(i(318));if(m=a.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(i(317));m[We]=a}else xi(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;bs(a),m=!1}else m=gh(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=m),m=!0;if(!m)return a.flags&256?(On(a),a):(On(a),null)}return On(a),(a.flags&128)!==0?(a.lanes=l,a):(l=c!==null,t=t!==null&&t.memoizedState!==null,l&&(c=a.child,m=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(m=c.alternate.memoizedState.cachePool.pool),x=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(x=c.memoizedState.cachePool.pool),x!==m&&(c.flags|=2048)),l!==t&&l&&(a.child.flags|=8192),vd(a,a.updateQueue),bs(a),null);case 4:return _e(),t===null&&Mm(a.stateNode.containerInfo),bs(a),null;case 10:return er(a.type),bs(a),null;case 19:if(z(Es),c=a.memoizedState,c===null)return bs(a),null;if(m=(a.flags&128)!==0,x=c.rendering,x===null)if(m)Do(c,!1);else{if(Ss!==0||t!==null&&(t.flags&128)!==0)for(t=a.child;t!==null;){if(x=ld(t),x!==null){for(a.flags|=128,Do(c,!1),t=x.updateQueue,a.updateQueue=t,vd(a,t),a.subtreeFlags=0,t=l,l=a.child;l!==null;)Xx(l,t),l=l.sibling;return X(Es,Es.current&1|2),Zt&&Za(a,c.treeForkCount),a.child}t=t.sibling}c.tail!==null&&Ze()>Sd&&(a.flags|=128,m=!0,Do(c,!1),a.lanes=4194304)}else{if(!m)if(t=ld(x),t!==null){if(a.flags|=128,m=!0,t=t.updateQueue,a.updateQueue=t,vd(a,t),Do(c,!0),c.tail===null&&c.tailMode==="hidden"&&!x.alternate&&!Zt)return bs(a),null}else 2*Ze()-c.renderingStartTime>Sd&&l!==536870912&&(a.flags|=128,m=!0,Do(c,!1),a.lanes=4194304);c.isBackwards?(x.sibling=a.child,a.child=x):(t=c.last,t!==null?t.sibling=x:a.child=x,c.last=x)}return c.tail!==null?(t=c.tail,c.rendering=t,c.tail=t.sibling,c.renderingStartTime=Ze(),t.sibling=null,l=Es.current,X(Es,m?l&1|2:l&1),Zt&&Za(a,c.treeForkCount),t):(bs(a),null);case 22:case 23:return On(a),Eh(),c=a.memoizedState!==null,t!==null?t.memoizedState!==null!==c&&(a.flags|=8192):c&&(a.flags|=8192),c?(l&536870912)!==0&&(a.flags&128)===0&&(bs(a),a.subtreeFlags&6&&(a.flags|=8192)):bs(a),l=a.updateQueue,l!==null&&vd(a,l.retryQueue),l=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),c=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(c=a.memoizedState.cachePool.pool),c!==l&&(a.flags|=2048),t!==null&&z(bi),null;case 24:return l=null,t!==null&&(l=t.memoizedState.cache),a.memoizedState.cache!==l&&(a.flags|=2048),er(Ps),bs(a),null;case 25:return null;case 30:return null}throw Error(i(156,a.tag))}function Xw(t,a){switch(ph(a),a.tag){case 1:return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 3:return er(Ps),_e(),t=a.flags,(t&65536)!==0&&(t&128)===0?(a.flags=t&-65537|128,a):null;case 26:case 27:case 5:return oe(a),null;case 31:if(a.memoizedState!==null){if(On(a),a.alternate===null)throw Error(i(340));xi()}return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 13:if(On(a),t=a.memoizedState,t!==null&&t.dehydrated!==null){if(a.alternate===null)throw Error(i(340));xi()}return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 19:return z(Es),null;case 4:return _e(),null;case 10:return er(a.type),null;case 22:case 23:return On(a),Eh(),t!==null&&z(bi),t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 24:return er(Ps),null;case 25:return null;default:return null}}function j0(t,a){switch(ph(a),a.tag){case 3:er(Ps),_e();break;case 26:case 27:case 5:oe(a);break;case 4:_e();break;case 31:a.memoizedState!==null&&On(a);break;case 13:On(a);break;case 19:z(Es);break;case 10:er(a.type);break;case 22:case 23:On(a),Eh(),t!==null&&z(bi);break;case 24:er(Ps)}}function Po(t,a){try{var l=a.updateQueue,c=l!==null?l.lastEffect:null;if(c!==null){var m=c.next;l=m;do{if((l.tag&t)===t){c=void 0;var x=l.create,w=l.inst;c=x(),w.destroy=c}l=l.next}while(l!==m)}}catch(E){os(a,a.return,E)}}function Pr(t,a,l){try{var c=a.updateQueue,m=c!==null?c.lastEffect:null;if(m!==null){var x=m.next;c=x;do{if((c.tag&t)===t){var w=c.inst,E=w.destroy;if(E!==void 0){w.destroy=void 0,m=a;var Q=l,ye=E;try{ye()}catch(Te){os(m,Q,Te)}}}c=c.next}while(c!==x)}}catch(Te){os(a,a.return,Te)}}function N0(t){var a=t.updateQueue;if(a!==null){var l=t.stateNode;try{hg(a,l)}catch(c){os(t,t.return,c)}}}function w0(t,a,l){l.props=ki(t.type,t.memoizedProps),l.state=t.memoizedState;try{l.componentWillUnmount()}catch(c){os(t,a,c)}}function Lo(t,a){try{var l=t.ref;if(l!==null){switch(t.tag){case 26:case 27:case 5:var c=t.stateNode;break;case 30:c=t.stateNode;break;default:c=t.stateNode}typeof l=="function"?t.refCleanup=l(c):l.current=c}}catch(m){os(t,a,m)}}function Ra(t,a){var l=t.ref,c=t.refCleanup;if(l!==null)if(typeof c=="function")try{c()}catch(m){os(t,a,m)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(m){os(t,a,m)}else l.current=null}function k0(t){var a=t.type,l=t.memoizedProps,c=t.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":l.autoFocus&&c.focus();break e;case"img":l.src?c.src=l.src:l.srcSet&&(c.srcset=l.srcSet)}}catch(m){os(t,t.return,m)}}function om(t,a,l){try{var c=t.stateNode;xk(c,t.type,l,a),c[jt]=a}catch(m){os(t,t.return,m)}}function S0(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&_r(t.type)||t.tag===4}function cm(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||S0(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&_r(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function dm(t,a,l){var c=t.tag;if(c===5||c===6)t=t.stateNode,a?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(t,a):(a=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,a.appendChild(t),l=l._reactRootContainer,l!=null||a.onclick!==null||(a.onclick=Ws));else if(c!==4&&(c===27&&_r(t.type)&&(l=t.stateNode,a=null),t=t.child,t!==null))for(dm(t,a,l),t=t.sibling;t!==null;)dm(t,a,l),t=t.sibling}function jd(t,a,l){var c=t.tag;if(c===5||c===6)t=t.stateNode,a?l.insertBefore(t,a):l.appendChild(t);else if(c!==4&&(c===27&&_r(t.type)&&(l=t.stateNode),t=t.child,t!==null))for(jd(t,a,l),t=t.sibling;t!==null;)jd(t,a,l),t=t.sibling}function C0(t){var a=t.stateNode,l=t.memoizedProps;try{for(var c=t.type,m=a.attributes;m.length;)a.removeAttributeNode(m[0]);tn(a,c,l),a[We]=t,a[jt]=l}catch(x){os(t,t.return,x)}}var rr=!1,zs=!1,um=!1,T0=typeof WeakSet=="function"?WeakSet:Set,qs=null;function Yw(t,a){if(t=t.containerInfo,Rm=Vd,t=$x(t),ah(t)){if("selectionStart"in t)var l={start:t.selectionStart,end:t.selectionEnd};else e:{l=(l=t.ownerDocument)&&l.defaultView||window;var c=l.getSelection&&l.getSelection();if(c&&c.rangeCount!==0){l=c.anchorNode;var m=c.anchorOffset,x=c.focusNode;c=c.focusOffset;try{l.nodeType,x.nodeType}catch{l=null;break e}var w=0,E=-1,Q=-1,ye=0,Te=0,Re=t,ve=null;t:for(;;){for(var ke;Re!==l||m!==0&&Re.nodeType!==3||(E=w+m),Re!==x||c!==0&&Re.nodeType!==3||(Q=w+c),Re.nodeType===3&&(w+=Re.nodeValue.length),(ke=Re.firstChild)!==null;)ve=Re,Re=ke;for(;;){if(Re===t)break t;if(ve===l&&++ye===m&&(E=w),ve===x&&++Te===c&&(Q=w),(ke=Re.nextSibling)!==null)break;Re=ve,ve=Re.parentNode}Re=ke}l=E===-1||Q===-1?null:{start:E,end:Q}}else l=null}l=l||{start:0,end:0}}else l=null;for(Dm={focusedElem:t,selectionRange:l},Vd=!1,qs=a;qs!==null;)if(a=qs,t=a.child,(a.subtreeFlags&1028)!==0&&t!==null)t.return=a,qs=t;else for(;qs!==null;){switch(a=qs,x=a.alternate,t=a.flags,a.tag){case 0:if((t&4)!==0&&(t=a.updateQueue,t=t!==null?t.events:null,t!==null))for(l=0;l<t.length;l++)m=t[l],m.ref.impl=m.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&x!==null){t=void 0,l=a,m=x.memoizedProps,x=x.memoizedState,c=l.stateNode;try{var lt=ki(l.type,m);t=c.getSnapshotBeforeUpdate(lt,x),c.__reactInternalSnapshotBeforeUpdate=t}catch(St){os(l,l.return,St)}}break;case 3:if((t&1024)!==0){if(t=a.stateNode.containerInfo,l=t.nodeType,l===9)Om(t);else if(l===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":Om(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(i(163))}if(t=a.sibling,t!==null){t.return=a.return,qs=t;break}qs=a.return}}function A0(t,a,l){var c=l.flags;switch(l.tag){case 0:case 11:case 15:lr(t,l),c&4&&Po(5,l);break;case 1:if(lr(t,l),c&4)if(t=l.stateNode,a===null)try{t.componentDidMount()}catch(w){os(l,l.return,w)}else{var m=ki(l.type,a.memoizedProps);a=a.memoizedState;try{t.componentDidUpdate(m,a,t.__reactInternalSnapshotBeforeUpdate)}catch(w){os(l,l.return,w)}}c&64&&N0(l),c&512&&Lo(l,l.return);break;case 3:if(lr(t,l),c&64&&(t=l.updateQueue,t!==null)){if(a=null,l.child!==null)switch(l.child.tag){case 27:case 5:a=l.child.stateNode;break;case 1:a=l.child.stateNode}try{hg(t,a)}catch(w){os(l,l.return,w)}}break;case 27:a===null&&c&4&&C0(l);case 26:case 5:lr(t,l),a===null&&c&4&&k0(l),c&512&&Lo(l,l.return);break;case 12:lr(t,l);break;case 31:lr(t,l),c&4&&I0(t,l);break;case 13:lr(t,l),c&4&&R0(t,l),c&64&&(t=l.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(l=ak.bind(null,l),kk(t,l))));break;case 22:if(c=l.memoizedState!==null||rr,!c){a=a!==null&&a.memoizedState!==null||zs,m=rr;var x=zs;rr=c,(zs=a)&&!x?or(t,l,(l.subtreeFlags&8772)!==0):lr(t,l),rr=m,zs=x}break;case 30:break;default:lr(t,l)}}function M0(t){var a=t.alternate;a!==null&&(t.alternate=null,M0(a)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(a=t.stateNode,a!==null&&Ys(a)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var vs=null,jn=!1;function ir(t,a,l){for(l=l.child;l!==null;)E0(t,a,l),l=l.sibling}function E0(t,a,l){if(Ct&&typeof Ct.onCommitFiberUnmount=="function")try{Ct.onCommitFiberUnmount(Jt,l)}catch{}switch(l.tag){case 26:zs||Ra(l,a),ir(t,a,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:zs||Ra(l,a);var c=vs,m=jn;_r(l.type)&&(vs=l.stateNode,jn=!1),ir(t,a,l),Ho(l.stateNode),vs=c,jn=m;break;case 5:zs||Ra(l,a);case 6:if(c=vs,m=jn,vs=null,ir(t,a,l),vs=c,jn=m,vs!==null)if(jn)try{(vs.nodeType===9?vs.body:vs.nodeName==="HTML"?vs.ownerDocument.body:vs).removeChild(l.stateNode)}catch(x){os(l,a,x)}else try{vs.removeChild(l.stateNode)}catch(x){os(l,a,x)}break;case 18:vs!==null&&(jn?(t=vs,Ny(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,l.stateNode),El(t)):Ny(vs,l.stateNode));break;case 4:c=vs,m=jn,vs=l.stateNode.containerInfo,jn=!0,ir(t,a,l),vs=c,jn=m;break;case 0:case 11:case 14:case 15:Pr(2,l,a),zs||Pr(4,l,a),ir(t,a,l);break;case 1:zs||(Ra(l,a),c=l.stateNode,typeof c.componentWillUnmount=="function"&&w0(l,a,c)),ir(t,a,l);break;case 21:ir(t,a,l);break;case 22:zs=(c=zs)||l.memoizedState!==null,ir(t,a,l),zs=c;break;default:ir(t,a,l)}}function I0(t,a){if(a.memoizedState===null&&(t=a.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{El(t)}catch(l){os(a,a.return,l)}}}function R0(t,a){if(a.memoizedState===null&&(t=a.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{El(t)}catch(l){os(a,a.return,l)}}function Ww(t){switch(t.tag){case 31:case 13:case 19:var a=t.stateNode;return a===null&&(a=t.stateNode=new T0),a;case 22:return t=t.stateNode,a=t._retryCache,a===null&&(a=t._retryCache=new T0),a;default:throw Error(i(435,t.tag))}}function Nd(t,a){var l=Ww(t);a.forEach(function(c){if(!l.has(c)){l.add(c);var m=rk.bind(null,t,c);c.then(m,m)}})}function Nn(t,a){var l=a.deletions;if(l!==null)for(var c=0;c<l.length;c++){var m=l[c],x=t,w=a,E=w;e:for(;E!==null;){switch(E.tag){case 27:if(_r(E.type)){vs=E.stateNode,jn=!1;break e}break;case 5:vs=E.stateNode,jn=!1;break e;case 3:case 4:vs=E.stateNode.containerInfo,jn=!0;break e}E=E.return}if(vs===null)throw Error(i(160));E0(x,w,m),vs=null,jn=!1,x=m.alternate,x!==null&&(x.return=null),m.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)D0(a,t),a=a.sibling}var fa=null;function D0(t,a){var l=t.alternate,c=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:Nn(a,t),wn(t),c&4&&(Pr(3,t,t.return),Po(3,t),Pr(5,t,t.return));break;case 1:Nn(a,t),wn(t),c&512&&(zs||l===null||Ra(l,l.return)),c&64&&rr&&(t=t.updateQueue,t!==null&&(c=t.callbacks,c!==null&&(l=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=l===null?c:l.concat(c))));break;case 26:var m=fa;if(Nn(a,t),wn(t),c&512&&(zs||l===null||Ra(l,l.return)),c&4){var x=l!==null?l.memoizedState:null;if(c=t.memoizedState,l===null)if(c===null)if(t.stateNode===null){e:{c=t.type,l=t.memoizedProps,m=m.ownerDocument||m;t:switch(c){case"title":x=m.getElementsByTagName("title")[0],(!x||x[Xt]||x[We]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=m.createElement(c),m.head.insertBefore(x,m.querySelector("head > title"))),tn(x,c,l),x[We]=t,as(x),c=x;break e;case"link":var w=Dy("link","href",m).get(c+(l.href||""));if(w){for(var E=0;E<w.length;E++)if(x=w[E],x.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&x.getAttribute("rel")===(l.rel==null?null:l.rel)&&x.getAttribute("title")===(l.title==null?null:l.title)&&x.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){w.splice(E,1);break t}}x=m.createElement(c),tn(x,c,l),m.head.appendChild(x);break;case"meta":if(w=Dy("meta","content",m).get(c+(l.content||""))){for(E=0;E<w.length;E++)if(x=w[E],x.getAttribute("content")===(l.content==null?null:""+l.content)&&x.getAttribute("name")===(l.name==null?null:l.name)&&x.getAttribute("property")===(l.property==null?null:l.property)&&x.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&x.getAttribute("charset")===(l.charSet==null?null:l.charSet)){w.splice(E,1);break t}}x=m.createElement(c),tn(x,c,l),m.head.appendChild(x);break;default:throw Error(i(468,c))}x[We]=t,as(x),c=x}t.stateNode=c}else Py(m,t.type,t.stateNode);else t.stateNode=Ry(m,c,t.memoizedProps);else x!==c?(x===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):x.count--,c===null?Py(m,t.type,t.stateNode):Ry(m,c,t.memoizedProps)):c===null&&t.stateNode!==null&&om(t,t.memoizedProps,l.memoizedProps)}break;case 27:Nn(a,t),wn(t),c&512&&(zs||l===null||Ra(l,l.return)),l!==null&&c&4&&om(t,t.memoizedProps,l.memoizedProps);break;case 5:if(Nn(a,t),wn(t),c&512&&(zs||l===null||Ra(l,l.return)),t.flags&32){m=t.stateNode;try{Wn(m,"")}catch(lt){os(t,t.return,lt)}}c&4&&t.stateNode!=null&&(m=t.memoizedProps,om(t,m,l!==null?l.memoizedProps:m)),c&1024&&(um=!0);break;case 6:if(Nn(a,t),wn(t),c&4){if(t.stateNode===null)throw Error(i(162));c=t.memoizedProps,l=t.stateNode;try{l.nodeValue=c}catch(lt){os(t,t.return,lt)}}break;case 3:if(Ud=null,m=fa,fa=Od(a.containerInfo),Nn(a,t),fa=m,wn(t),c&4&&l!==null&&l.memoizedState.isDehydrated)try{El(a.containerInfo)}catch(lt){os(t,t.return,lt)}um&&(um=!1,P0(t));break;case 4:c=fa,fa=Od(t.stateNode.containerInfo),Nn(a,t),wn(t),fa=c;break;case 12:Nn(a,t),wn(t);break;case 31:Nn(a,t),wn(t),c&4&&(c=t.updateQueue,c!==null&&(t.updateQueue=null,Nd(t,c)));break;case 13:Nn(a,t),wn(t),t.child.flags&8192&&t.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(kd=Ze()),c&4&&(c=t.updateQueue,c!==null&&(t.updateQueue=null,Nd(t,c)));break;case 22:m=t.memoizedState!==null;var Q=l!==null&&l.memoizedState!==null,ye=rr,Te=zs;if(rr=ye||m,zs=Te||Q,Nn(a,t),zs=Te,rr=ye,wn(t),c&8192)e:for(a=t.stateNode,a._visibility=m?a._visibility&-2:a._visibility|1,m&&(l===null||Q||rr||zs||Si(t)),l=null,a=t;;){if(a.tag===5||a.tag===26){if(l===null){Q=l=a;try{if(x=Q.stateNode,m)w=x.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{E=Q.stateNode;var Re=Q.memoizedProps.style,ve=Re!=null&&Re.hasOwnProperty("display")?Re.display:null;E.style.display=ve==null||typeof ve=="boolean"?"":(""+ve).trim()}}catch(lt){os(Q,Q.return,lt)}}}else if(a.tag===6){if(l===null){Q=a;try{Q.stateNode.nodeValue=m?"":Q.memoizedProps}catch(lt){os(Q,Q.return,lt)}}}else if(a.tag===18){if(l===null){Q=a;try{var ke=Q.stateNode;m?wy(ke,!0):wy(Q.stateNode,!1)}catch(lt){os(Q,Q.return,lt)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===t)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===t)break e;for(;a.sibling===null;){if(a.return===null||a.return===t)break e;l===a&&(l=null),a=a.return}l===a&&(l=null),a.sibling.return=a.return,a=a.sibling}c&4&&(c=t.updateQueue,c!==null&&(l=c.retryQueue,l!==null&&(c.retryQueue=null,Nd(t,l))));break;case 19:Nn(a,t),wn(t),c&4&&(c=t.updateQueue,c!==null&&(t.updateQueue=null,Nd(t,c)));break;case 30:break;case 21:break;default:Nn(a,t),wn(t)}}function wn(t){var a=t.flags;if(a&2){try{for(var l,c=t.return;c!==null;){if(S0(c)){l=c;break}c=c.return}if(l==null)throw Error(i(160));switch(l.tag){case 27:var m=l.stateNode,x=cm(t);jd(t,x,m);break;case 5:var w=l.stateNode;l.flags&32&&(Wn(w,""),l.flags&=-33);var E=cm(t);jd(t,E,w);break;case 3:case 4:var Q=l.stateNode.containerInfo,ye=cm(t);dm(t,ye,Q);break;default:throw Error(i(161))}}catch(Te){os(t,t.return,Te)}t.flags&=-3}a&4096&&(t.flags&=-4097)}function P0(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var a=t;P0(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),t=t.sibling}}function lr(t,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)A0(t,a.alternate,a),a=a.sibling}function Si(t){for(t=t.child;t!==null;){var a=t;switch(a.tag){case 0:case 11:case 14:case 15:Pr(4,a,a.return),Si(a);break;case 1:Ra(a,a.return);var l=a.stateNode;typeof l.componentWillUnmount=="function"&&w0(a,a.return,l),Si(a);break;case 27:Ho(a.stateNode);case 26:case 5:Ra(a,a.return),Si(a);break;case 22:a.memoizedState===null&&Si(a);break;case 30:Si(a);break;default:Si(a)}t=t.sibling}}function or(t,a,l){for(l=l&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var c=a.alternate,m=t,x=a,w=x.flags;switch(x.tag){case 0:case 11:case 15:or(m,x,l),Po(4,x);break;case 1:if(or(m,x,l),c=x,m=c.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(ye){os(c,c.return,ye)}if(c=x,m=c.updateQueue,m!==null){var E=c.stateNode;try{var Q=m.shared.hiddenCallbacks;if(Q!==null)for(m.shared.hiddenCallbacks=null,m=0;m<Q.length;m++)ug(Q[m],E)}catch(ye){os(c,c.return,ye)}}l&&w&64&&N0(x),Lo(x,x.return);break;case 27:C0(x);case 26:case 5:or(m,x,l),l&&c===null&&w&4&&k0(x),Lo(x,x.return);break;case 12:or(m,x,l);break;case 31:or(m,x,l),l&&w&4&&I0(m,x);break;case 13:or(m,x,l),l&&w&4&&R0(m,x);break;case 22:x.memoizedState===null&&or(m,x,l),Lo(x,x.return);break;case 30:break;default:or(m,x,l)}a=a.sibling}}function hm(t,a){var l=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),t=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(t=a.memoizedState.cachePool.pool),t!==l&&(t!=null&&t.refCount++,l!=null&&jo(l))}function mm(t,a){t=null,a.alternate!==null&&(t=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==t&&(a.refCount++,t!=null&&jo(t))}function pa(t,a,l,c){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)L0(t,a,l,c),a=a.sibling}function L0(t,a,l,c){var m=a.flags;switch(a.tag){case 0:case 11:case 15:pa(t,a,l,c),m&2048&&Po(9,a);break;case 1:pa(t,a,l,c);break;case 3:pa(t,a,l,c),m&2048&&(t=null,a.alternate!==null&&(t=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==t&&(a.refCount++,t!=null&&jo(t)));break;case 12:if(m&2048){pa(t,a,l,c),t=a.stateNode;try{var x=a.memoizedProps,w=x.id,E=x.onPostCommit;typeof E=="function"&&E(w,a.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(Q){os(a,a.return,Q)}}else pa(t,a,l,c);break;case 31:pa(t,a,l,c);break;case 13:pa(t,a,l,c);break;case 23:break;case 22:x=a.stateNode,w=a.alternate,a.memoizedState!==null?x._visibility&2?pa(t,a,l,c):Oo(t,a):x._visibility&2?pa(t,a,l,c):(x._visibility|=2,bl(t,a,l,c,(a.subtreeFlags&10256)!==0||!1)),m&2048&&hm(w,a);break;case 24:pa(t,a,l,c),m&2048&&mm(a.alternate,a);break;default:pa(t,a,l,c)}}function bl(t,a,l,c,m){for(m=m&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var x=t,w=a,E=l,Q=c,ye=w.flags;switch(w.tag){case 0:case 11:case 15:bl(x,w,E,Q,m),Po(8,w);break;case 23:break;case 22:var Te=w.stateNode;w.memoizedState!==null?Te._visibility&2?bl(x,w,E,Q,m):Oo(x,w):(Te._visibility|=2,bl(x,w,E,Q,m)),m&&ye&2048&&hm(w.alternate,w);break;case 24:bl(x,w,E,Q,m),m&&ye&2048&&mm(w.alternate,w);break;default:bl(x,w,E,Q,m)}a=a.sibling}}function Oo(t,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var l=t,c=a,m=c.flags;switch(c.tag){case 22:Oo(l,c),m&2048&&hm(c.alternate,c);break;case 24:Oo(l,c),m&2048&&mm(c.alternate,c);break;default:Oo(l,c)}a=a.sibling}}var zo=8192;function vl(t,a,l){if(t.subtreeFlags&zo)for(t=t.child;t!==null;)O0(t,a,l),t=t.sibling}function O0(t,a,l){switch(t.tag){case 26:vl(t,a,l),t.flags&zo&&t.memoizedState!==null&&Ok(l,fa,t.memoizedState,t.memoizedProps);break;case 5:vl(t,a,l);break;case 3:case 4:var c=fa;fa=Od(t.stateNode.containerInfo),vl(t,a,l),fa=c;break;case 22:t.memoizedState===null&&(c=t.alternate,c!==null&&c.memoizedState!==null?(c=zo,zo=16777216,vl(t,a,l),zo=c):vl(t,a,l));break;default:vl(t,a,l)}}function z0(t){var a=t.alternate;if(a!==null&&(t=a.child,t!==null)){a.child=null;do a=t.sibling,t.sibling=null,t=a;while(t!==null)}}function Uo(t){var a=t.deletions;if((t.flags&16)!==0){if(a!==null)for(var l=0;l<a.length;l++){var c=a[l];qs=c,$0(c,t)}z0(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)U0(t),t=t.sibling}function U0(t){switch(t.tag){case 0:case 11:case 15:Uo(t),t.flags&2048&&Pr(9,t,t.return);break;case 3:Uo(t);break;case 12:Uo(t);break;case 22:var a=t.stateNode;t.memoizedState!==null&&a._visibility&2&&(t.return===null||t.return.tag!==13)?(a._visibility&=-3,wd(t)):Uo(t);break;default:Uo(t)}}function wd(t){var a=t.deletions;if((t.flags&16)!==0){if(a!==null)for(var l=0;l<a.length;l++){var c=a[l];qs=c,$0(c,t)}z0(t)}for(t=t.child;t!==null;){switch(a=t,a.tag){case 0:case 11:case 15:Pr(8,a,a.return),wd(a);break;case 22:l=a.stateNode,l._visibility&2&&(l._visibility&=-3,wd(a));break;default:wd(a)}t=t.sibling}}function $0(t,a){for(;qs!==null;){var l=qs;switch(l.tag){case 0:case 11:case 15:Pr(8,l,a);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var c=l.memoizedState.cachePool.pool;c!=null&&c.refCount++}break;case 24:jo(l.memoizedState.cache)}if(c=l.child,c!==null)c.return=l,qs=c;else e:for(l=t;qs!==null;){c=qs;var m=c.sibling,x=c.return;if(M0(c),c===l){qs=null;break e}if(m!==null){m.return=x,qs=m;break e}qs=x}}}var Qw={getCacheForType:function(t){var a=Js(Ps),l=a.data.get(t);return l===void 0&&(l=t(),a.data.set(t,l)),l},cacheSignal:function(){return Js(Ps).controller.signal}},Zw=typeof WeakMap=="function"?WeakMap:Map,rs=0,ms=null,Ft=null,Yt=0,ls=0,zn=null,Lr=!1,jl=!1,fm=!1,cr=0,Ss=0,Or=0,Ci=0,pm=0,Un=0,Nl=0,$o=null,kn=null,xm=!1,kd=0,B0=0,Sd=1/0,Cd=null,zr=null,$s=0,Ur=null,wl=null,dr=0,gm=0,ym=null,_0=null,Bo=0,bm=null;function $n(){return(rs&2)!==0&&Yt!==0?Yt&-Yt:Y.T!==null?Sm():Z()}function V0(){if(Un===0)if((Yt&536870912)===0||Zt){var t=Ve;Ve<<=1,(Ve&3932160)===0&&(Ve=262144),Un=t}else Un=536870912;return t=Ln.current,t!==null&&(t.flags|=32),Un}function Sn(t,a,l){(t===ms&&(ls===2||ls===9)||t.cancelPendingCommit!==null)&&(kl(t,0),$r(t,Yt,Un,!1)),nt(t,l),((rs&2)===0||t!==ms)&&(t===ms&&((rs&2)===0&&(Ci|=l),Ss===4&&$r(t,Yt,Un,!1)),Da(t))}function K0(t,a,l){if((rs&6)!==0)throw Error(i(327));var c=!l&&(a&127)===0&&(a&t.expiredLanes)===0||H(t,a),m=c?tk(t,a):jm(t,a,!0),x=c;do{if(m===0){jl&&!c&&$r(t,a,0,!1);break}else{if(l=t.current.alternate,x&&!Jw(l)){m=jm(t,a,!1),x=!1;continue}if(m===2){if(x=a,t.errorRecoveryDisabledLanes&x)var w=0;else w=t.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){a=w;e:{var E=t;m=$o;var Q=E.current.memoizedState.isDehydrated;if(Q&&(kl(E,w).flags|=256),w=jm(E,w,!1),w!==2){if(fm&&!Q){E.errorRecoveryDisabledLanes|=x,Ci|=x,m=4;break e}x=kn,kn=m,x!==null&&(kn===null?kn=x:kn.push.apply(kn,x))}m=w}if(x=!1,m!==2)continue}}if(m===1){kl(t,0),$r(t,a,0,!0);break}e:{switch(c=t,x=m,x){case 0:case 1:throw Error(i(345));case 4:if((a&4194048)!==a)break;case 6:$r(c,a,Un,!Lr);break e;case 2:kn=null;break;case 3:case 5:break;default:throw Error(i(329))}if((a&62914560)===a&&(m=kd+300-Ze(),10<m)){if($r(c,a,Un,!Lr),Tt(c,0,!0)!==0)break e;dr=a,c.timeoutHandle=vy(H0.bind(null,c,l,kn,Cd,xm,a,Un,Ci,Nl,Lr,x,"Throttled",-0,0),m);break e}H0(c,l,kn,Cd,xm,a,Un,Ci,Nl,Lr,x,null,-0,0)}}break}while(!0);Da(t)}function H0(t,a,l,c,m,x,w,E,Q,ye,Te,Re,ve,ke){if(t.timeoutHandle=-1,Re=a.subtreeFlags,Re&8192||(Re&16785408)===16785408){Re={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ws},O0(a,x,Re);var lt=(x&62914560)===x?kd-Ze():(x&4194048)===x?B0-Ze():0;if(lt=zk(Re,lt),lt!==null){dr=x,t.cancelPendingCommit=lt(Z0.bind(null,t,a,x,l,c,m,w,E,Q,Te,Re,null,ve,ke)),$r(t,x,w,!ye);return}}Z0(t,a,x,l,c,m,w,E,Q)}function Jw(t){for(var a=t;;){var l=a.tag;if((l===0||l===11||l===15)&&a.flags&16384&&(l=a.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var c=0;c<l.length;c++){var m=l[c],x=m.getSnapshot;m=m.value;try{if(!Dn(x(),m))return!1}catch{return!1}}if(l=a.child,a.subtreeFlags&16384&&l!==null)l.return=a,a=l;else{if(a===t)break;for(;a.sibling===null;){if(a.return===null||a.return===t)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function $r(t,a,l,c){a&=~pm,a&=~Ci,t.suspendedLanes|=a,t.pingedLanes&=~a,c&&(t.warmLanes|=a),c=t.expirationTimes;for(var m=a;0<m;){var x=31-ne(m),w=1<<x;c[x]=-1,m&=~w}l!==0&&Bt(t,l,a)}function Td(){return(rs&6)===0?(_o(0),!1):!0}function vm(){if(Ft!==null){if(ls===0)var t=Ft.return;else t=Ft,Ja=gi=null,Oh(t),fl=null,wo=0,t=Ft;for(;t!==null;)j0(t.alternate,t),t=t.return;Ft=null}}function kl(t,a){var l=t.timeoutHandle;l!==-1&&(t.timeoutHandle=-1,bk(l)),l=t.cancelPendingCommit,l!==null&&(t.cancelPendingCommit=null,l()),dr=0,vm(),ms=t,Ft=l=Qa(t.current,null),Yt=a,ls=0,zn=null,Lr=!1,jl=H(t,a),fm=!1,Nl=Un=pm=Ci=Or=Ss=0,kn=$o=null,xm=!1,(a&8)!==0&&(a|=a&32);var c=t.entangledLanes;if(c!==0)for(t=t.entanglements,c&=a;0<c;){var m=31-ne(c),x=1<<m;a|=t[m],c&=~x}return cr=a,Xc(),l}function F0(t,a){Dt=null,Y.H=Io,a===ml||a===sd?(a=lg(),ls=3):a===kh?(a=lg(),ls=4):ls=a===Zh?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,zn=a,Ft===null&&(Ss=1,xd(t,Zn(a,t.current)))}function G0(){var t=Ln.current;return t===null?!0:(Yt&4194048)===Yt?sa===null:(Yt&62914560)===Yt||(Yt&536870912)!==0?t===sa:!1}function q0(){var t=Y.H;return Y.H=Io,t===null?Io:t}function X0(){var t=Y.A;return Y.A=Qw,t}function Ad(){Ss=4,Lr||(Yt&4194048)!==Yt&&Ln.current!==null||(jl=!0),(Or&134217727)===0&&(Ci&134217727)===0||ms===null||$r(ms,Yt,Un,!1)}function jm(t,a,l){var c=rs;rs|=2;var m=q0(),x=X0();(ms!==t||Yt!==a)&&(Cd=null,kl(t,a)),a=!1;var w=Ss;e:do try{if(ls!==0&&Ft!==null){var E=Ft,Q=zn;switch(ls){case 8:vm(),w=6;break e;case 3:case 2:case 9:case 6:Ln.current===null&&(a=!0);var ye=ls;if(ls=0,zn=null,Sl(t,E,Q,ye),l&&jl){w=0;break e}break;default:ye=ls,ls=0,zn=null,Sl(t,E,Q,ye)}}ek(),w=Ss;break}catch(Te){F0(t,Te)}while(!0);return a&&t.shellSuspendCounter++,Ja=gi=null,rs=c,Y.H=m,Y.A=x,Ft===null&&(ms=null,Yt=0,Xc()),w}function ek(){for(;Ft!==null;)Y0(Ft)}function tk(t,a){var l=rs;rs|=2;var c=q0(),m=X0();ms!==t||Yt!==a?(Cd=null,Sd=Ze()+500,kl(t,a)):jl=H(t,a);e:do try{if(ls!==0&&Ft!==null){a=Ft;var x=zn;t:switch(ls){case 1:ls=0,zn=null,Sl(t,a,x,1);break;case 2:case 9:if(rg(x)){ls=0,zn=null,W0(a);break}a=function(){ls!==2&&ls!==9||ms!==t||(ls=7),Da(t)},x.then(a,a);break e;case 3:ls=7;break e;case 4:ls=5;break e;case 7:rg(x)?(ls=0,zn=null,W0(a)):(ls=0,zn=null,Sl(t,a,x,7));break;case 5:var w=null;switch(Ft.tag){case 26:w=Ft.memoizedState;case 5:case 27:var E=Ft;if(w?Ly(w):E.stateNode.complete){ls=0,zn=null;var Q=E.sibling;if(Q!==null)Ft=Q;else{var ye=E.return;ye!==null?(Ft=ye,Md(ye)):Ft=null}break t}}ls=0,zn=null,Sl(t,a,x,5);break;case 6:ls=0,zn=null,Sl(t,a,x,6);break;case 8:vm(),Ss=6;break e;default:throw Error(i(462))}}sk();break}catch(Te){F0(t,Te)}while(!0);return Ja=gi=null,Y.H=c,Y.A=m,rs=l,Ft!==null?0:(ms=null,Yt=0,Xc(),Ss)}function sk(){for(;Ft!==null&&!Ge();)Y0(Ft)}function Y0(t){var a=b0(t.alternate,t,cr);t.memoizedProps=t.pendingProps,a===null?Md(t):Ft=a}function W0(t){var a=t,l=a.alternate;switch(a.tag){case 15:case 0:a=m0(l,a,a.pendingProps,a.type,void 0,Yt);break;case 11:a=m0(l,a,a.pendingProps,a.type.render,a.ref,Yt);break;case 5:Oh(a);default:j0(l,a),a=Ft=Xx(a,cr),a=b0(l,a,cr)}t.memoizedProps=t.pendingProps,a===null?Md(t):Ft=a}function Sl(t,a,l,c){Ja=gi=null,Oh(a),fl=null,wo=0;var m=a.return;try{if(Hw(t,m,a,l,Yt)){Ss=1,xd(t,Zn(l,t.current)),Ft=null;return}}catch(x){if(m!==null)throw Ft=m,x;Ss=1,xd(t,Zn(l,t.current)),Ft=null;return}a.flags&32768?(Zt||c===1?t=!0:jl||(Yt&536870912)!==0?t=!1:(Lr=t=!0,(c===2||c===9||c===3||c===6)&&(c=Ln.current,c!==null&&c.tag===13&&(c.flags|=16384))),Q0(a,t)):Md(a)}function Md(t){var a=t;do{if((a.flags&32768)!==0){Q0(a,Lr);return}t=a.return;var l=qw(a.alternate,a,cr);if(l!==null){Ft=l;return}if(a=a.sibling,a!==null){Ft=a;return}Ft=a=t}while(a!==null);Ss===0&&(Ss=5)}function Q0(t,a){do{var l=Xw(t.alternate,t);if(l!==null){l.flags&=32767,Ft=l;return}if(l=t.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!a&&(t=t.sibling,t!==null)){Ft=t;return}Ft=t=l}while(t!==null);Ss=6,Ft=null}function Z0(t,a,l,c,m,x,w,E,Q){t.cancelPendingCommit=null;do Ed();while($s!==0);if((rs&6)!==0)throw Error(i(327));if(a!==null){if(a===t.current)throw Error(i(177));if(x=a.lanes|a.childLanes,x|=ch,$t(t,l,x,w,E,Q),t===ms&&(Ft=ms=null,Yt=0),wl=a,Ur=t,dr=l,gm=x,ym=m,_0=c,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,ik(qe,function(){return ny(),null})):(t.callbackNode=null,t.callbackPriority=0),c=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||c){c=Y.T,Y.T=null,m=P.p,P.p=2,w=rs,rs|=4;try{Yw(t,a,l)}finally{rs=w,P.p=m,Y.T=c}}$s=1,J0(),ey(),ty()}}function J0(){if($s===1){$s=0;var t=Ur,a=wl,l=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||l){l=Y.T,Y.T=null;var c=P.p;P.p=2;var m=rs;rs|=4;try{D0(a,t);var x=Dm,w=$x(t.containerInfo),E=x.focusedElem,Q=x.selectionRange;if(w!==E&&E&&E.ownerDocument&&Ux(E.ownerDocument.documentElement,E)){if(Q!==null&&ah(E)){var ye=Q.start,Te=Q.end;if(Te===void 0&&(Te=ye),"selectionStart"in E)E.selectionStart=ye,E.selectionEnd=Math.min(Te,E.value.length);else{var Re=E.ownerDocument||document,ve=Re&&Re.defaultView||window;if(ve.getSelection){var ke=ve.getSelection(),lt=E.textContent.length,St=Math.min(Q.start,lt),us=Q.end===void 0?St:Math.min(Q.end,lt);!ke.extend&&St>us&&(w=us,us=St,St=w);var ie=zx(E,St),ee=zx(E,us);if(ie&&ee&&(ke.rangeCount!==1||ke.anchorNode!==ie.node||ke.anchorOffset!==ie.offset||ke.focusNode!==ee.node||ke.focusOffset!==ee.offset)){var ge=Re.createRange();ge.setStart(ie.node,ie.offset),ke.removeAllRanges(),St>us?(ke.addRange(ge),ke.extend(ee.node,ee.offset)):(ge.setEnd(ee.node,ee.offset),ke.addRange(ge))}}}}for(Re=[],ke=E;ke=ke.parentNode;)ke.nodeType===1&&Re.push({element:ke,left:ke.scrollLeft,top:ke.scrollTop});for(typeof E.focus=="function"&&E.focus(),E=0;E<Re.length;E++){var Ie=Re[E];Ie.element.scrollLeft=Ie.left,Ie.element.scrollTop=Ie.top}}Vd=!!Rm,Dm=Rm=null}finally{rs=m,P.p=c,Y.T=l}}t.current=a,$s=2}}function ey(){if($s===2){$s=0;var t=Ur,a=wl,l=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||l){l=Y.T,Y.T=null;var c=P.p;P.p=2;var m=rs;rs|=4;try{A0(t,a.alternate,a)}finally{rs=m,P.p=c,Y.T=l}}$s=3}}function ty(){if($s===4||$s===3){$s=0,gt();var t=Ur,a=wl,l=dr,c=_0;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?$s=5:($s=0,wl=Ur=null,sy(t,t.pendingLanes));var m=t.pendingLanes;if(m===0&&(zr=null),Hs(l),a=a.stateNode,Ct&&typeof Ct.onCommitFiberRoot=="function")try{Ct.onCommitFiberRoot(Jt,a,void 0,(a.current.flags&128)===128)}catch{}if(c!==null){a=Y.T,m=P.p,P.p=2,Y.T=null;try{for(var x=t.onRecoverableError,w=0;w<c.length;w++){var E=c[w];x(E.value,{componentStack:E.stack})}}finally{Y.T=a,P.p=m}}(dr&3)!==0&&Ed(),Da(t),m=t.pendingLanes,(l&261930)!==0&&(m&42)!==0?t===bm?Bo++:(Bo=0,bm=t):Bo=0,_o(0)}}function sy(t,a){(t.pooledCacheLanes&=a)===0&&(a=t.pooledCache,a!=null&&(t.pooledCache=null,jo(a)))}function Ed(){return J0(),ey(),ty(),ny()}function ny(){if($s!==5)return!1;var t=Ur,a=gm;gm=0;var l=Hs(dr),c=Y.T,m=P.p;try{P.p=32>l?32:l,Y.T=null,l=ym,ym=null;var x=Ur,w=dr;if($s=0,wl=Ur=null,dr=0,(rs&6)!==0)throw Error(i(331));var E=rs;if(rs|=4,U0(x.current),L0(x,x.current,w,l),rs=E,_o(0,!1),Ct&&typeof Ct.onPostCommitFiberRoot=="function")try{Ct.onPostCommitFiberRoot(Jt,x)}catch{}return!0}finally{P.p=m,Y.T=c,sy(t,a)}}function ay(t,a,l){a=Zn(l,a),a=Qh(t.stateNode,a,2),t=Ir(t,a,2),t!==null&&(nt(t,2),Da(t))}function os(t,a,l){if(t.tag===3)ay(t,t,l);else for(;a!==null;){if(a.tag===3){ay(a,t,l);break}else if(a.tag===1){var c=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(zr===null||!zr.has(c))){t=Zn(l,t),l=r0(2),c=Ir(a,l,2),c!==null&&(i0(l,c,a,t),nt(c,2),Da(c));break}}a=a.return}}function Nm(t,a,l){var c=t.pingCache;if(c===null){c=t.pingCache=new Zw;var m=new Set;c.set(a,m)}else m=c.get(a),m===void 0&&(m=new Set,c.set(a,m));m.has(l)||(fm=!0,m.add(l),t=nk.bind(null,t,a,l),a.then(t,t))}function nk(t,a,l){var c=t.pingCache;c!==null&&c.delete(a),t.pingedLanes|=t.suspendedLanes&l,t.warmLanes&=~l,ms===t&&(Yt&l)===l&&(Ss===4||Ss===3&&(Yt&62914560)===Yt&&300>Ze()-kd?(rs&2)===0&&kl(t,0):pm|=l,Nl===Yt&&(Nl=0)),Da(t)}function ry(t,a){a===0&&(a=Xe()),t=fi(t,a),t!==null&&(nt(t,a),Da(t))}function ak(t){var a=t.memoizedState,l=0;a!==null&&(l=a.retryLane),ry(t,l)}function rk(t,a){var l=0;switch(t.tag){case 31:case 13:var c=t.stateNode,m=t.memoizedState;m!==null&&(l=m.retryLane);break;case 19:c=t.stateNode;break;case 22:c=t.stateNode._retryCache;break;default:throw Error(i(314))}c!==null&&c.delete(a),ry(t,l)}function ik(t,a){return ft(t,a)}var Id=null,Cl=null,wm=!1,Rd=!1,km=!1,Br=0;function Da(t){t!==Cl&&t.next===null&&(Cl===null?Id=Cl=t:Cl=Cl.next=t),Rd=!0,wm||(wm=!0,ok())}function _o(t,a){if(!km&&Rd){km=!0;do for(var l=!1,c=Id;c!==null;){if(t!==0){var m=c.pendingLanes;if(m===0)var x=0;else{var w=c.suspendedLanes,E=c.pingedLanes;x=(1<<31-ne(42|t)+1)-1,x&=m&~(w&~E),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(l=!0,cy(c,x))}else x=Yt,x=Tt(c,c===ms?x:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(x&3)===0||H(c,x)||(l=!0,cy(c,x));c=c.next}while(l);km=!1}}function lk(){iy()}function iy(){Rd=wm=!1;var t=0;Br!==0&&yk()&&(t=Br);for(var a=Ze(),l=null,c=Id;c!==null;){var m=c.next,x=ly(c,a);x===0?(c.next=null,l===null?Id=m:l.next=m,m===null&&(Cl=l)):(l=c,(t!==0||(x&3)!==0)&&(Rd=!0)),c=m}$s!==0&&$s!==5||_o(t),Br!==0&&(Br=0)}function ly(t,a){for(var l=t.suspendedLanes,c=t.pingedLanes,m=t.expirationTimes,x=t.pendingLanes&-62914561;0<x;){var w=31-ne(x),E=1<<w,Q=m[w];Q===-1?((E&l)===0||(E&c)!==0)&&(m[w]=Se(E,a)):Q<=a&&(t.expiredLanes|=E),x&=~E}if(a=ms,l=Yt,l=Tt(t,t===a?l:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),c=t.callbackNode,l===0||t===a&&(ls===2||ls===9)||t.cancelPendingCommit!==null)return c!==null&&c!==null&&Et(c),t.callbackNode=null,t.callbackPriority=0;if((l&3)===0||H(t,l)){if(a=l&-l,a===t.callbackPriority)return a;switch(c!==null&&Et(c),Hs(l)){case 2:case 8:l=et;break;case 32:l=qe;break;case 268435456:l=Kt;break;default:l=qe}return c=oy.bind(null,t),l=ft(l,c),t.callbackPriority=a,t.callbackNode=l,a}return c!==null&&c!==null&&Et(c),t.callbackPriority=2,t.callbackNode=null,2}function oy(t,a){if($s!==0&&$s!==5)return t.callbackNode=null,t.callbackPriority=0,null;var l=t.callbackNode;if(Ed()&&t.callbackNode!==l)return null;var c=Yt;return c=Tt(t,t===ms?c:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),c===0?null:(K0(t,c,a),ly(t,Ze()),t.callbackNode!=null&&t.callbackNode===l?oy.bind(null,t):null)}function cy(t,a){if(Ed())return null;K0(t,a,!0)}function ok(){vk(function(){(rs&6)!==0?ft(Ne,lk):iy()})}function Sm(){if(Br===0){var t=ul;t===0&&(t=Ce,Ce<<=1,(Ce&261888)===0&&(Ce=256)),Br=t}return Br}function dy(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:qi(""+t)}function uy(t,a){var l=a.ownerDocument.createElement("input");return l.name=a.name,l.value=a.value,t.id&&l.setAttribute("form",t.id),a.parentNode.insertBefore(l,a),t=new FormData(t),l.parentNode.removeChild(l),t}function ck(t,a,l,c,m){if(a==="submit"&&l&&l.stateNode===m){var x=dy((m[jt]||null).action),w=c.submitter;w&&(a=(a=w[jt]||null)?dy(a.formAction):w.getAttribute("formAction"),a!==null&&(x=a,w=null));var E=new Yi("action","action",null,c,m);t.push({event:E,listeners:[{instance:null,listener:function(){if(c.defaultPrevented){if(Br!==0){var Q=w?uy(m,w):new FormData(m);Fh(l,{pending:!0,data:Q,method:m.method,action:x},null,Q)}}else typeof x=="function"&&(E.preventDefault(),Q=w?uy(m,w):new FormData(m),Fh(l,{pending:!0,data:Q,method:m.method,action:x},x,Q))},currentTarget:m}]})}}for(var Cm=0;Cm<oh.length;Cm++){var Tm=oh[Cm],dk=Tm.toLowerCase(),uk=Tm[0].toUpperCase()+Tm.slice(1);ma(dk,"on"+uk)}ma(Vx,"onAnimationEnd"),ma(Kx,"onAnimationIteration"),ma(Hx,"onAnimationStart"),ma("dblclick","onDoubleClick"),ma("focusin","onFocus"),ma("focusout","onBlur"),ma(Tw,"onTransitionRun"),ma(Aw,"onTransitionStart"),ma(Mw,"onTransitionCancel"),ma(Fx,"onTransitionEnd"),Ga("onMouseEnter",["mouseout","mouseover"]),Ga("onMouseLeave",["mouseout","mouseover"]),Ga("onPointerEnter",["pointerout","pointerover"]),Ga("onPointerLeave",["pointerout","pointerover"]),wa("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),wa("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),wa("onBeforeInput",["compositionend","keypress","textInput","paste"]),wa("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),wa("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),wa("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Vo="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(" "),hk=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Vo));function hy(t,a){a=(a&4)!==0;for(var l=0;l<t.length;l++){var c=t[l],m=c.event;c=c.listeners;e:{var x=void 0;if(a)for(var w=c.length-1;0<=w;w--){var E=c[w],Q=E.instance,ye=E.currentTarget;if(E=E.listener,Q!==x&&m.isPropagationStopped())break e;x=E,m.currentTarget=ye;try{x(m)}catch(Te){qc(Te)}m.currentTarget=null,x=Q}else for(w=0;w<c.length;w++){if(E=c[w],Q=E.instance,ye=E.currentTarget,E=E.listener,Q!==x&&m.isPropagationStopped())break e;x=E,m.currentTarget=ye;try{x(m)}catch(Te){qc(Te)}m.currentTarget=null,x=Q}}}}function Gt(t,a){var l=a[ht];l===void 0&&(l=a[ht]=new Set);var c=t+"__bubble";l.has(c)||(my(a,t,2,!1),l.add(c))}function Am(t,a,l){var c=0;a&&(c|=4),my(l,t,c,a)}var Dd="_reactListening"+Math.random().toString(36).slice(2);function Mm(t){if(!t[Dd]){t[Dd]=!0,Xn.forEach(function(l){l!=="selectionchange"&&(hk.has(l)||Am(l,!1,t),Am(l,!0,t))});var a=t.nodeType===9?t:t.ownerDocument;a===null||a[Dd]||(a[Dd]=!0,Am("selectionchange",!1,a))}}function my(t,a,l,c){switch(Vy(a)){case 2:var m=Bk;break;case 8:m=_k;break;default:m=Hm}l=m.bind(null,a,l,t),m=void 0,!Sa||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(m=!0),c?m!==void 0?t.addEventListener(a,l,{capture:!0,passive:m}):t.addEventListener(a,l,!0):m!==void 0?t.addEventListener(a,l,{passive:m}):t.addEventListener(a,l,!1)}function Em(t,a,l,c,m){var x=c;if((a&1)===0&&(a&2)===0&&c!==null)e:for(;;){if(c===null)return;var w=c.tag;if(w===3||w===4){var E=c.stateNode.containerInfo;if(E===m)break;if(w===4)for(w=c.return;w!==null;){var Q=w.tag;if((Q===3||Q===4)&&w.stateNode.containerInfo===m)return;w=w.return}for(;E!==null;){if(w=Fs(E),w===null)return;if(Q=w.tag,Q===5||Q===6||Q===26||Q===27){c=x=w;continue e}E=E.parentNode}}c=c.return}jr(function(){var ye=x,Te=xn(l),Re=[];e:{var ve=Gx.get(t);if(ve!==void 0){var ke=Yi,lt=t;switch(t){case"keypress":if(ha(l)===0)break e;case"keydown":case"keyup":ke=ut;break;case"focusin":lt="focus",ke=mo;break;case"focusout":lt="blur",ke=mo;break;case"beforeblur":case"afterblur":ke=mo;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ke=Qi;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ke=Bc;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ke=Ht;break;case Vx:case Kx:case Hx:ke=Vc;break;case Fx:ke=Aa;break;case"scroll":case"scrollend":ke=Ju;break;case"wheel":ke=th;break;case"copy":case"cut":case"paste":ke=Ji;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ke=hn;break;case"toggle":case"beforetoggle":ke=Rt}var St=(a&4)!==0,us=!St&&(t==="scroll"||t==="scrollend"),ie=St?ve!==null?ve+"Capture":null:ve;St=[];for(var ee=ye,ge;ee!==null;){var Ie=ee;if(ge=Ie.stateNode,Ie=Ie.tag,Ie!==5&&Ie!==26&&Ie!==27||ge===null||ie===null||(Ie=ci(ee,ie),Ie!=null&&St.push(Ko(ee,Ie,ge))),us)break;ee=ee.return}0<St.length&&(ve=new ke(ve,lt,null,l,Te),Re.push({event:ve,listeners:St}))}}if((a&7)===0){e:{if(ve=t==="mouseover"||t==="pointerover",ke=t==="mouseout"||t==="pointerout",ve&&l!==co&&(lt=l.relatedTarget||l.fromElement)&&(Fs(lt)||lt[Be]))break e;if((ke||ve)&&(ve=Te.window===Te?Te:(ve=Te.ownerDocument)?ve.defaultView||ve.parentWindow:window,ke?(lt=l.relatedTarget||l.toElement,ke=ye,lt=lt?Fs(lt):null,lt!==null&&(us=d(lt),St=lt.tag,lt!==us||St!==5&&St!==27&&St!==6)&&(lt=null)):(ke=null,lt=ye),ke!==lt)){if(St=Qi,Ie="onMouseLeave",ie="onMouseEnter",ee="mouse",(t==="pointerout"||t==="pointerover")&&(St=hn,Ie="onPointerLeave",ie="onPointerEnter",ee="pointer"),us=ke==null?ve:Na(ke),ge=lt==null?ve:Na(lt),ve=new St(Ie,ee+"leave",ke,l,Te),ve.target=us,ve.relatedTarget=ge,Ie=null,Fs(Te)===ye&&(St=new St(ie,ee+"enter",lt,l,Te),St.target=ge,St.relatedTarget=us,Ie=St),us=Ie,ke&<)t:{for(St=mk,ie=ke,ee=lt,ge=0,Ie=ie;Ie;Ie=St(Ie))ge++;Ie=0;for(var yt=ee;yt;yt=St(yt))Ie++;for(;0<ge-Ie;)ie=St(ie),ge--;for(;0<Ie-ge;)ee=St(ee),Ie--;for(;ge--;){if(ie===ee||ee!==null&&ie===ee.alternate){St=ie;break t}ie=St(ie),ee=St(ee)}St=null}else St=null;ke!==null&&fy(Re,ve,ke,St,!1),lt!==null&&us!==null&&fy(Re,us,lt,St,!0)}}e:{if(ve=ye?Na(ye):window,ke=ve.nodeName&&ve.nodeName.toLowerCase(),ke==="select"||ke==="input"&&ve.type==="file")var es=Ix;else if(Mx(ve))if(Rx)es=kw;else{es=Nw;var mt=jw}else ke=ve.nodeName,!ke||ke.toLowerCase()!=="input"||ve.type!=="checkbox"&&ve.type!=="radio"?ye&&Ya(ye.elementType)&&(es=Ix):es=ww;if(es&&(es=es(t,ye))){Ex(Re,es,l,Te);break e}mt&&mt(t,ve,ye),t==="focusout"&&ye&&ve.type==="number"&&ye.memoizedProps.value!=null&&ua(ve,"number",ve.value)}switch(mt=ye?Na(ye):window,t){case"focusin":(Mx(mt)||mt.contentEditable==="true")&&(nl=mt,rh=ye,yo=null);break;case"focusout":yo=rh=nl=null;break;case"mousedown":ih=!0;break;case"contextmenu":case"mouseup":case"dragend":ih=!1,Bx(Re,l,Te);break;case"selectionchange":if(Cw)break;case"keydown":case"keyup":Bx(Re,l,Te)}var zt;if(Ma)e:{switch(t){case"compositionstart":var Wt="onCompositionStart";break e;case"compositionend":Wt="onCompositionEnd";break e;case"compositionupdate":Wt="onCompositionUpdate";break e}Wt=void 0}else sl?Tx(t,l)&&(Wt="onCompositionEnd"):t==="keydown"&&l.keyCode===229&&(Wt="onCompositionStart");Wt&&(Rn&&l.locale!=="ko"&&(sl||Wt!=="onCompositionStart"?Wt==="onCompositionEnd"&&sl&&(zt=uo()):(En=Te,di="value"in En?En.value:En.textContent,sl=!0)),mt=Pd(ye,Wt),0<mt.length&&(Wt=new A(Wt,t,null,l,Te),Re.push({event:Wt,listeners:mt}),zt?Wt.data=zt:(zt=Ax(l),zt!==null&&(Wt.data=zt)))),(zt=Fc?gw(t,l):yw(t,l))&&(Wt=Pd(ye,"onBeforeInput"),0<Wt.length&&(mt=new A("onBeforeInput","beforeinput",null,l,Te),Re.push({event:mt,listeners:Wt}),mt.data=zt)),ck(Re,t,ye,l,Te)}hy(Re,a)})}function Ko(t,a,l){return{instance:t,listener:a,currentTarget:l}}function Pd(t,a){for(var l=a+"Capture",c=[];t!==null;){var m=t,x=m.stateNode;if(m=m.tag,m!==5&&m!==26&&m!==27||x===null||(m=ci(t,l),m!=null&&c.unshift(Ko(t,m,x)),m=ci(t,a),m!=null&&c.push(Ko(t,m,x))),t.tag===3)return c;t=t.return}return[]}function mk(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function fy(t,a,l,c,m){for(var x=a._reactName,w=[];l!==null&&l!==c;){var E=l,Q=E.alternate,ye=E.stateNode;if(E=E.tag,Q!==null&&Q===c)break;E!==5&&E!==26&&E!==27||ye===null||(Q=ye,m?(ye=ci(l,x),ye!=null&&w.unshift(Ko(l,ye,Q))):m||(ye=ci(l,x),ye!=null&&w.push(Ko(l,ye,Q)))),l=l.return}w.length!==0&&t.push({event:a,listeners:w})}var fk=/\r\n?/g,pk=/\u0000|\uFFFD/g;function py(t){return(typeof t=="string"?t:""+t).replace(fk,`
|
|
9
|
+
`).replace(pk,"")}function xy(t,a){return a=py(a),py(t)===a}function ds(t,a,l,c,m,x){switch(l){case"children":typeof c=="string"?a==="body"||a==="textarea"&&c===""||Wn(t,c):(typeof c=="number"||typeof c=="bigint")&&a!=="body"&&Wn(t,""+c);break;case"className":Mn(t,"class",c);break;case"tabIndex":Mn(t,"tabindex",c);break;case"dir":case"role":case"viewBox":case"width":case"height":Mn(t,l,c);break;case"style":$c(t,c,x);break;case"data":if(a!=="object"){Mn(t,"data",c);break}case"src":case"href":if(c===""&&(a!=="a"||l!=="href")){t.removeAttribute(l);break}if(c==null||typeof c=="function"||typeof c=="symbol"||typeof c=="boolean"){t.removeAttribute(l);break}c=qi(""+c),t.setAttribute(l,c);break;case"action":case"formAction":if(typeof c=="function"){t.setAttribute(l,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof x=="function"&&(l==="formAction"?(a!=="input"&&ds(t,a,"name",m.name,m,null),ds(t,a,"formEncType",m.formEncType,m,null),ds(t,a,"formMethod",m.formMethod,m,null),ds(t,a,"formTarget",m.formTarget,m,null)):(ds(t,a,"encType",m.encType,m,null),ds(t,a,"method",m.method,m,null),ds(t,a,"target",m.target,m,null)));if(c==null||typeof c=="symbol"||typeof c=="boolean"){t.removeAttribute(l);break}c=qi(""+c),t.setAttribute(l,c);break;case"onClick":c!=null&&(t.onclick=Ws);break;case"onScroll":c!=null&&Gt("scroll",t);break;case"onScrollEnd":c!=null&&Gt("scrollend",t);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(i(61));if(l=c.__html,l!=null){if(m.children!=null)throw Error(i(60));t.innerHTML=l}}break;case"multiple":t.multiple=c&&typeof c!="function"&&typeof c!="symbol";break;case"muted":t.muted=c&&typeof c!="function"&&typeof c!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(c==null||typeof c=="function"||typeof c=="boolean"||typeof c=="symbol"){t.removeAttribute("xlink:href");break}l=qi(""+c),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":c!=null&&typeof c!="function"&&typeof c!="symbol"?t.setAttribute(l,""+c):t.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":c&&typeof c!="function"&&typeof c!="symbol"?t.setAttribute(l,""):t.removeAttribute(l);break;case"capture":case"download":c===!0?t.setAttribute(l,""):c!==!1&&c!=null&&typeof c!="function"&&typeof c!="symbol"?t.setAttribute(l,c):t.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":c!=null&&typeof c!="function"&&typeof c!="symbol"&&!isNaN(c)&&1<=c?t.setAttribute(l,c):t.removeAttribute(l);break;case"rowSpan":case"start":c==null||typeof c=="function"||typeof c=="symbol"||isNaN(c)?t.removeAttribute(l):t.setAttribute(l,c);break;case"popover":Gt("beforetoggle",t),Gt("toggle",t),qa(t,"popover",c);break;case"xlinkActuate":Yn(t,"http://www.w3.org/1999/xlink","xlink:actuate",c);break;case"xlinkArcrole":Yn(t,"http://www.w3.org/1999/xlink","xlink:arcrole",c);break;case"xlinkRole":Yn(t,"http://www.w3.org/1999/xlink","xlink:role",c);break;case"xlinkShow":Yn(t,"http://www.w3.org/1999/xlink","xlink:show",c);break;case"xlinkTitle":Yn(t,"http://www.w3.org/1999/xlink","xlink:title",c);break;case"xlinkType":Yn(t,"http://www.w3.org/1999/xlink","xlink:type",c);break;case"xmlBase":Yn(t,"http://www.w3.org/XML/1998/namespace","xml:base",c);break;case"xmlLang":Yn(t,"http://www.w3.org/XML/1998/namespace","xml:lang",c);break;case"xmlSpace":Yn(t,"http://www.w3.org/XML/1998/namespace","xml:space",c);break;case"is":qa(t,"is",c);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=Zu.get(l)||l,qa(t,l,c))}}function Im(t,a,l,c,m,x){switch(l){case"style":$c(t,c,x);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(i(61));if(l=c.__html,l!=null){if(m.children!=null)throw Error(i(60));t.innerHTML=l}}break;case"children":typeof c=="string"?Wn(t,c):(typeof c=="number"||typeof c=="bigint")&&Wn(t,""+c);break;case"onScroll":c!=null&&Gt("scroll",t);break;case"onScrollEnd":c!=null&&Gt("scrollend",t);break;case"onClick":c!=null&&(t.onclick=Ws);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Fi.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(m=l.endsWith("Capture"),a=l.slice(2,m?l.length-7:void 0),x=t[jt]||null,x=x!=null?x[l]:null,typeof x=="function"&&t.removeEventListener(a,x,m),typeof c=="function")){typeof x!="function"&&x!==null&&(l in t?t[l]=null:t.hasAttribute(l)&&t.removeAttribute(l)),t.addEventListener(a,c,m);break e}l in t?t[l]=c:c===!0?t.setAttribute(l,""):qa(t,l,c)}}}function tn(t,a,l){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Gt("error",t),Gt("load",t);var c=!1,m=!1,x;for(x in l)if(l.hasOwnProperty(x)){var w=l[x];if(w!=null)switch(x){case"src":c=!0;break;case"srcSet":m=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,a));default:ds(t,a,x,w,l,null)}}m&&ds(t,a,"srcSet",l.srcSet,l,null),c&&ds(t,a,"src",l.src,l,null);return;case"input":Gt("invalid",t);var E=x=w=m=null,Q=null,ye=null;for(c in l)if(l.hasOwnProperty(c)){var Te=l[c];if(Te!=null)switch(c){case"name":m=Te;break;case"type":w=Te;break;case"checked":Q=Te;break;case"defaultChecked":ye=Te;break;case"value":x=Te;break;case"defaultValue":E=Te;break;case"children":case"dangerouslySetInnerHTML":if(Te!=null)throw Error(i(137,a));break;default:ds(t,a,c,Te,l,null)}}oo(t,x,E,Q,ye,w,m,!1);return;case"select":Gt("invalid",t),c=w=x=null;for(m in l)if(l.hasOwnProperty(m)&&(E=l[m],E!=null))switch(m){case"value":x=E;break;case"defaultValue":w=E;break;case"multiple":c=E;default:ds(t,a,m,E,l,null)}a=x,l=w,t.multiple=!!c,a!=null?yr(t,!!c,a,!1):l!=null&&yr(t,!!c,l,!0);return;case"textarea":Gt("invalid",t),x=m=c=null;for(w in l)if(l.hasOwnProperty(w)&&(E=l[w],E!=null))switch(w){case"value":c=E;break;case"defaultValue":m=E;break;case"children":x=E;break;case"dangerouslySetInnerHTML":if(E!=null)throw Error(i(91));break;default:ds(t,a,w,E,l,null)}Uc(t,c,m,x);return;case"option":for(Q in l)if(l.hasOwnProperty(Q)&&(c=l[Q],c!=null))switch(Q){case"selected":t.selected=c&&typeof c!="function"&&typeof c!="symbol";break;default:ds(t,a,Q,c,l,null)}return;case"dialog":Gt("beforetoggle",t),Gt("toggle",t),Gt("cancel",t),Gt("close",t);break;case"iframe":case"object":Gt("load",t);break;case"video":case"audio":for(c=0;c<Vo.length;c++)Gt(Vo[c],t);break;case"image":Gt("error",t),Gt("load",t);break;case"details":Gt("toggle",t);break;case"embed":case"source":case"link":Gt("error",t),Gt("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ye in l)if(l.hasOwnProperty(ye)&&(c=l[ye],c!=null))switch(ye){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,a));default:ds(t,a,ye,c,l,null)}return;default:if(Ya(a)){for(Te in l)l.hasOwnProperty(Te)&&(c=l[Te],c!==void 0&&Im(t,a,Te,c,l,void 0));return}}for(E in l)l.hasOwnProperty(E)&&(c=l[E],c!=null&&ds(t,a,E,c,l,null))}function xk(t,a,l,c){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var m=null,x=null,w=null,E=null,Q=null,ye=null,Te=null;for(ke in l){var Re=l[ke];if(l.hasOwnProperty(ke)&&Re!=null)switch(ke){case"checked":break;case"value":break;case"defaultValue":Q=Re;default:c.hasOwnProperty(ke)||ds(t,a,ke,null,c,Re)}}for(var ve in c){var ke=c[ve];if(Re=l[ve],c.hasOwnProperty(ve)&&(ke!=null||Re!=null))switch(ve){case"type":x=ke;break;case"name":m=ke;break;case"checked":ye=ke;break;case"defaultChecked":Te=ke;break;case"value":w=ke;break;case"defaultValue":E=ke;break;case"children":case"dangerouslySetInnerHTML":if(ke!=null)throw Error(i(137,a));break;default:ke!==Re&&ds(t,a,ve,ke,c,Re)}}Gi(t,w,E,Q,ye,Te,x,m);return;case"select":ke=w=E=ve=null;for(x in l)if(Q=l[x],l.hasOwnProperty(x)&&Q!=null)switch(x){case"value":break;case"multiple":ke=Q;default:c.hasOwnProperty(x)||ds(t,a,x,null,c,Q)}for(m in c)if(x=c[m],Q=l[m],c.hasOwnProperty(m)&&(x!=null||Q!=null))switch(m){case"value":ve=x;break;case"defaultValue":E=x;break;case"multiple":w=x;default:x!==Q&&ds(t,a,m,x,c,Q)}a=E,l=w,c=ke,ve!=null?yr(t,!!l,ve,!1):!!c!=!!l&&(a!=null?yr(t,!!l,a,!0):yr(t,!!l,l?[]:"",!1));return;case"textarea":ke=ve=null;for(E in l)if(m=l[E],l.hasOwnProperty(E)&&m!=null&&!c.hasOwnProperty(E))switch(E){case"value":break;case"children":break;default:ds(t,a,E,null,c,m)}for(w in c)if(m=c[w],x=l[w],c.hasOwnProperty(w)&&(m!=null||x!=null))switch(w){case"value":ve=m;break;case"defaultValue":ke=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(i(91));break;default:m!==x&&ds(t,a,w,m,c,x)}Xa(t,ve,ke);return;case"option":for(var lt in l)if(ve=l[lt],l.hasOwnProperty(lt)&&ve!=null&&!c.hasOwnProperty(lt))switch(lt){case"selected":t.selected=!1;break;default:ds(t,a,lt,null,c,ve)}for(Q in c)if(ve=c[Q],ke=l[Q],c.hasOwnProperty(Q)&&ve!==ke&&(ve!=null||ke!=null))switch(Q){case"selected":t.selected=ve&&typeof ve!="function"&&typeof ve!="symbol";break;default:ds(t,a,Q,ve,c,ke)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var St in l)ve=l[St],l.hasOwnProperty(St)&&ve!=null&&!c.hasOwnProperty(St)&&ds(t,a,St,null,c,ve);for(ye in c)if(ve=c[ye],ke=l[ye],c.hasOwnProperty(ye)&&ve!==ke&&(ve!=null||ke!=null))switch(ye){case"children":case"dangerouslySetInnerHTML":if(ve!=null)throw Error(i(137,a));break;default:ds(t,a,ye,ve,c,ke)}return;default:if(Ya(a)){for(var us in l)ve=l[us],l.hasOwnProperty(us)&&ve!==void 0&&!c.hasOwnProperty(us)&&Im(t,a,us,void 0,c,ve);for(Te in c)ve=c[Te],ke=l[Te],!c.hasOwnProperty(Te)||ve===ke||ve===void 0&&ke===void 0||Im(t,a,Te,ve,c,ke);return}}for(var ie in l)ve=l[ie],l.hasOwnProperty(ie)&&ve!=null&&!c.hasOwnProperty(ie)&&ds(t,a,ie,null,c,ve);for(Re in c)ve=c[Re],ke=l[Re],!c.hasOwnProperty(Re)||ve===ke||ve==null&&ke==null||ds(t,a,Re,ve,c,ke)}function gy(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function gk(){if(typeof performance.getEntriesByType=="function"){for(var t=0,a=0,l=performance.getEntriesByType("resource"),c=0;c<l.length;c++){var m=l[c],x=m.transferSize,w=m.initiatorType,E=m.duration;if(x&&E&&gy(w)){for(w=0,E=m.responseEnd,c+=1;c<l.length;c++){var Q=l[c],ye=Q.startTime;if(ye>E)break;var Te=Q.transferSize,Re=Q.initiatorType;Te&&gy(Re)&&(Q=Q.responseEnd,w+=Te*(Q<E?1:(E-ye)/(Q-ye)))}if(--c,a+=8*(x+w)/(m.duration/1e3),t++,10<t)break}}if(0<t)return a/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var Rm=null,Dm=null;function Ld(t){return t.nodeType===9?t:t.ownerDocument}function yy(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function by(t,a){if(t===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&a==="foreignObject"?0:t}function Pm(t,a){return t==="textarea"||t==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var Lm=null;function yk(){var t=window.event;return t&&t.type==="popstate"?t===Lm?!1:(Lm=t,!0):(Lm=null,!1)}var vy=typeof setTimeout=="function"?setTimeout:void 0,bk=typeof clearTimeout=="function"?clearTimeout:void 0,jy=typeof Promise=="function"?Promise:void 0,vk=typeof queueMicrotask=="function"?queueMicrotask:typeof jy<"u"?function(t){return jy.resolve(null).then(t).catch(jk)}:vy;function jk(t){setTimeout(function(){throw t})}function _r(t){return t==="head"}function Ny(t,a){var l=a,c=0;do{var m=l.nextSibling;if(t.removeChild(l),m&&m.nodeType===8)if(l=m.data,l==="/$"||l==="/&"){if(c===0){t.removeChild(m),El(a);return}c--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")c++;else if(l==="html")Ho(t.ownerDocument.documentElement);else if(l==="head"){l=t.ownerDocument.head,Ho(l);for(var x=l.firstChild;x;){var w=x.nextSibling,E=x.nodeName;x[Xt]||E==="SCRIPT"||E==="STYLE"||E==="LINK"&&x.rel.toLowerCase()==="stylesheet"||l.removeChild(x),x=w}}else l==="body"&&Ho(t.ownerDocument.body);l=m}while(l);El(a)}function wy(t,a){var l=t;t=0;do{var c=l.nextSibling;if(l.nodeType===1?a?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(a?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),c&&c.nodeType===8)if(l=c.data,l==="/$"){if(t===0)break;t--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||t++;l=c}while(l)}function Om(t){var a=t.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var l=a;switch(a=a.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":Om(l),Ys(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}t.removeChild(l)}}function Nk(t,a,l,c){for(;t.nodeType===1;){var m=l;if(t.nodeName.toLowerCase()!==a.toLowerCase()){if(!c&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(c){if(!t[Xt])switch(a){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(x=t.getAttribute("rel"),x==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(x!==m.rel||t.getAttribute("href")!==(m.href==null||m.href===""?null:m.href)||t.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin)||t.getAttribute("title")!==(m.title==null?null:m.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(x=t.getAttribute("src"),(x!==(m.src==null?null:m.src)||t.getAttribute("type")!==(m.type==null?null:m.type)||t.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin))&&x&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(a==="input"&&t.type==="hidden"){var x=m.name==null?null:""+m.name;if(m.type==="hidden"&&t.getAttribute("name")===x)return t}else return t;if(t=na(t.nextSibling),t===null)break}return null}function wk(t,a,l){if(a==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!l||(t=na(t.nextSibling),t===null))return null;return t}function ky(t,a){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=na(t.nextSibling),t===null))return null;return t}function zm(t){return t.data==="$?"||t.data==="$~"}function Um(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function kk(t,a){var l=t.ownerDocument;if(t.data==="$~")t._reactRetry=a;else if(t.data!=="$?"||l.readyState!=="loading")a();else{var c=function(){a(),l.removeEventListener("DOMContentLoaded",c)};l.addEventListener("DOMContentLoaded",c),t._reactRetry=c}}function na(t){for(;t!=null;t=t.nextSibling){var a=t.nodeType;if(a===1||a===3)break;if(a===8){if(a=t.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return t}var $m=null;function Sy(t){t=t.nextSibling;for(var a=0;t;){if(t.nodeType===8){var l=t.data;if(l==="/$"||l==="/&"){if(a===0)return na(t.nextSibling);a--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||a++}t=t.nextSibling}return null}function Cy(t){t=t.previousSibling;for(var a=0;t;){if(t.nodeType===8){var l=t.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(a===0)return t;a--}else l!=="/$"&&l!=="/&"||a++}t=t.previousSibling}return null}function Ty(t,a,l){switch(a=Ld(l),t){case"html":if(t=a.documentElement,!t)throw Error(i(452));return t;case"head":if(t=a.head,!t)throw Error(i(453));return t;case"body":if(t=a.body,!t)throw Error(i(454));return t;default:throw Error(i(451))}}function Ho(t){for(var a=t.attributes;a.length;)t.removeAttributeNode(a[0]);Ys(t)}var aa=new Map,Ay=new Set;function Od(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var ur=P.d;P.d={f:Sk,r:Ck,D:Tk,C:Ak,L:Mk,m:Ek,X:Rk,S:Ik,M:Dk};function Sk(){var t=ur.f(),a=Td();return t||a}function Ck(t){var a=pn(t);a!==null&&a.tag===5&&a.type==="form"?Fg(a):ur.r(t)}var Tl=typeof document>"u"?null:document;function My(t,a,l){var c=Tl;if(c&&typeof a=="string"&&a){var m=Ms(a);m='link[rel="'+t+'"][href="'+m+'"]',typeof l=="string"&&(m+='[crossorigin="'+l+'"]'),Ay.has(m)||(Ay.add(m),t={rel:t,crossOrigin:l,href:a},c.querySelector(m)===null&&(a=c.createElement("link"),tn(a,"link",t),as(a),c.head.appendChild(a)))}}function Tk(t){ur.D(t),My("dns-prefetch",t,null)}function Ak(t,a){ur.C(t,a),My("preconnect",t,a)}function Mk(t,a,l){ur.L(t,a,l);var c=Tl;if(c&&t&&a){var m='link[rel="preload"][as="'+Ms(a)+'"]';a==="image"&&l&&l.imageSrcSet?(m+='[imagesrcset="'+Ms(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(m+='[imagesizes="'+Ms(l.imageSizes)+'"]')):m+='[href="'+Ms(t)+'"]';var x=m;switch(a){case"style":x=Al(t);break;case"script":x=Ml(t)}aa.has(x)||(t=b({rel:"preload",href:a==="image"&&l&&l.imageSrcSet?void 0:t,as:a},l),aa.set(x,t),c.querySelector(m)!==null||a==="style"&&c.querySelector(Fo(x))||a==="script"&&c.querySelector(Go(x))||(a=c.createElement("link"),tn(a,"link",t),as(a),c.head.appendChild(a)))}}function Ek(t,a){ur.m(t,a);var l=Tl;if(l&&t){var c=a&&typeof a.as=="string"?a.as:"script",m='link[rel="modulepreload"][as="'+Ms(c)+'"][href="'+Ms(t)+'"]',x=m;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=Ml(t)}if(!aa.has(x)&&(t=b({rel:"modulepreload",href:t},a),aa.set(x,t),l.querySelector(m)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Go(x)))return}c=l.createElement("link"),tn(c,"link",t),as(c),l.head.appendChild(c)}}}function Ik(t,a,l){ur.S(t,a,l);var c=Tl;if(c&&t){var m=An(c).hoistableStyles,x=Al(t);a=a||"default";var w=m.get(x);if(!w){var E={loading:0,preload:null};if(w=c.querySelector(Fo(x)))E.loading=5;else{t=b({rel:"stylesheet",href:t,"data-precedence":a},l),(l=aa.get(x))&&Bm(t,l);var Q=w=c.createElement("link");as(Q),tn(Q,"link",t),Q._p=new Promise(function(ye,Te){Q.onload=ye,Q.onerror=Te}),Q.addEventListener("load",function(){E.loading|=1}),Q.addEventListener("error",function(){E.loading|=2}),E.loading|=4,zd(w,a,c)}w={type:"stylesheet",instance:w,count:1,state:E},m.set(x,w)}}}function Rk(t,a){ur.X(t,a);var l=Tl;if(l&&t){var c=An(l).hoistableScripts,m=Ml(t),x=c.get(m);x||(x=l.querySelector(Go(m)),x||(t=b({src:t,async:!0},a),(a=aa.get(m))&&_m(t,a),x=l.createElement("script"),as(x),tn(x,"link",t),l.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},c.set(m,x))}}function Dk(t,a){ur.M(t,a);var l=Tl;if(l&&t){var c=An(l).hoistableScripts,m=Ml(t),x=c.get(m);x||(x=l.querySelector(Go(m)),x||(t=b({src:t,async:!0,type:"module"},a),(a=aa.get(m))&&_m(t,a),x=l.createElement("script"),as(x),tn(x,"link",t),l.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},c.set(m,x))}}function Ey(t,a,l,c){var m=(m=Oe.current)?Od(m):null;if(!m)throw Error(i(446));switch(t){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(a=Al(l.href),l=An(m).hoistableStyles,c=l.get(a),c||(c={type:"style",instance:null,count:0,state:null},l.set(a,c)),c):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){t=Al(l.href);var x=An(m).hoistableStyles,w=x.get(t);if(w||(m=m.ownerDocument||m,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(t,w),(x=m.querySelector(Fo(t)))&&!x._p&&(w.instance=x,w.state.loading=5),aa.has(t)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},aa.set(t,l),x||Pk(m,t,l,w.state))),a&&c===null)throw Error(i(528,""));return w}if(a&&c!==null)throw Error(i(529,""));return null;case"script":return a=l.async,l=l.src,typeof l=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=Ml(l),l=An(m).hoistableScripts,c=l.get(a),c||(c={type:"script",instance:null,count:0,state:null},l.set(a,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,t))}}function Al(t){return'href="'+Ms(t)+'"'}function Fo(t){return'link[rel="stylesheet"]['+t+"]"}function Iy(t){return b({},t,{"data-precedence":t.precedence,precedence:null})}function Pk(t,a,l,c){t.querySelector('link[rel="preload"][as="style"]['+a+"]")?c.loading=1:(a=t.createElement("link"),c.preload=a,a.addEventListener("load",function(){return c.loading|=1}),a.addEventListener("error",function(){return c.loading|=2}),tn(a,"link",l),as(a),t.head.appendChild(a))}function Ml(t){return'[src="'+Ms(t)+'"]'}function Go(t){return"script[async]"+t}function Ry(t,a,l){if(a.count++,a.instance===null)switch(a.type){case"style":var c=t.querySelector('style[data-href~="'+Ms(l.href)+'"]');if(c)return a.instance=c,as(c),c;var m=b({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return c=(t.ownerDocument||t).createElement("style"),as(c),tn(c,"style",m),zd(c,l.precedence,t),a.instance=c;case"stylesheet":m=Al(l.href);var x=t.querySelector(Fo(m));if(x)return a.state.loading|=4,a.instance=x,as(x),x;c=Iy(l),(m=aa.get(m))&&Bm(c,m),x=(t.ownerDocument||t).createElement("link"),as(x);var w=x;return w._p=new Promise(function(E,Q){w.onload=E,w.onerror=Q}),tn(x,"link",c),a.state.loading|=4,zd(x,l.precedence,t),a.instance=x;case"script":return x=Ml(l.src),(m=t.querySelector(Go(x)))?(a.instance=m,as(m),m):(c=l,(m=aa.get(x))&&(c=b({},l),_m(c,m)),t=t.ownerDocument||t,m=t.createElement("script"),as(m),tn(m,"link",c),t.head.appendChild(m),a.instance=m);case"void":return null;default:throw Error(i(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(c=a.instance,a.state.loading|=4,zd(c,l.precedence,t));return a.instance}function zd(t,a,l){for(var c=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=c.length?c[c.length-1]:null,x=m,w=0;w<c.length;w++){var E=c[w];if(E.dataset.precedence===a)x=E;else if(x!==m)break}x?x.parentNode.insertBefore(t,x.nextSibling):(a=l.nodeType===9?l.head:l,a.insertBefore(t,a.firstChild))}function Bm(t,a){t.crossOrigin==null&&(t.crossOrigin=a.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=a.referrerPolicy),t.title==null&&(t.title=a.title)}function _m(t,a){t.crossOrigin==null&&(t.crossOrigin=a.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=a.referrerPolicy),t.integrity==null&&(t.integrity=a.integrity)}var Ud=null;function Dy(t,a,l){if(Ud===null){var c=new Map,m=Ud=new Map;m.set(l,c)}else m=Ud,c=m.get(l),c||(c=new Map,m.set(l,c));if(c.has(t))return c;for(c.set(t,null),l=l.getElementsByTagName(t),m=0;m<l.length;m++){var x=l[m];if(!(x[Xt]||x[We]||t==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var w=x.getAttribute(a)||"";w=t+w;var E=c.get(w);E?E.push(x):c.set(w,[x])}}return c}function Py(t,a,l){t=t.ownerDocument||t,t.head.insertBefore(l,a==="title"?t.querySelector("head > title"):null)}function Lk(t,a,l){if(l===1||a.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;switch(a.rel){case"stylesheet":return t=a.disabled,typeof a.precedence=="string"&&t==null;default:return!0}case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function Ly(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function Ok(t,a,l,c){if(l.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var m=Al(c.href),x=a.querySelector(Fo(m));if(x){a=x._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(t.count++,t=$d.bind(t),a.then(t,t)),l.state.loading|=4,l.instance=x,as(x);return}x=a.ownerDocument||a,c=Iy(c),(m=aa.get(m))&&Bm(c,m),x=x.createElement("link"),as(x);var w=x;w._p=new Promise(function(E,Q){w.onload=E,w.onerror=Q}),tn(x,"link",c),l.instance=x}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(l,a),(a=l.state.preload)&&(l.state.loading&3)===0&&(t.count++,l=$d.bind(t),a.addEventListener("load",l),a.addEventListener("error",l))}}var Vm=0;function zk(t,a){return t.stylesheets&&t.count===0&&_d(t,t.stylesheets),0<t.count||0<t.imgCount?function(l){var c=setTimeout(function(){if(t.stylesheets&&_d(t,t.stylesheets),t.unsuspend){var x=t.unsuspend;t.unsuspend=null,x()}},6e4+a);0<t.imgBytes&&Vm===0&&(Vm=62500*gk());var m=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&_d(t,t.stylesheets),t.unsuspend)){var x=t.unsuspend;t.unsuspend=null,x()}},(t.imgBytes>Vm?50:800)+a);return t.unsuspend=l,function(){t.unsuspend=null,clearTimeout(c),clearTimeout(m)}}:null}function $d(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)_d(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Bd=null;function _d(t,a){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Bd=new Map,a.forEach(Uk,t),Bd=null,$d.call(t))}function Uk(t,a){if(!(a.state.loading&4)){var l=Bd.get(t);if(l)var c=l.get(null);else{l=new Map,Bd.set(t,l);for(var m=t.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<m.length;x++){var w=m[x];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(l.set(w.dataset.precedence,w),c=w)}c&&l.set(null,c)}m=a.instance,w=m.getAttribute("data-precedence"),x=l.get(w)||c,x===c&&l.set(null,m),l.set(w,m),this.count++,c=$d.bind(this),m.addEventListener("load",c),m.addEventListener("error",c),x?x.parentNode.insertBefore(m,x.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(m,t.firstChild)),a.state.loading|=4}}var qo={$$typeof:I,Provider:null,Consumer:null,_currentValue:F,_currentValue2:F,_threadCount:0};function $k(t,a,l,c,m,x,w,E,Q){this.tag=1,this.containerInfo=t,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Nt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Nt(0),this.hiddenUpdates=Nt(null),this.identifierPrefix=c,this.onUncaughtError=m,this.onCaughtError=x,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Q,this.incompleteTransitions=new Map}function Oy(t,a,l,c,m,x,w,E,Q,ye,Te,Re){return t=new $k(t,a,l,w,Q,ye,Te,Re,E),a=1,x===!0&&(a|=24),x=Pn(3,null,null,a),t.current=x,x.stateNode=t,a=jh(),a.refCount++,t.pooledCache=a,a.refCount++,x.memoizedState={element:c,isDehydrated:l,cache:a},Sh(x),t}function zy(t){return t?(t=il,t):il}function Uy(t,a,l,c,m,x){m=zy(m),c.context===null?c.context=m:c.pendingContext=m,c=Er(a),c.payload={element:l},x=x===void 0?null:x,x!==null&&(c.callback=x),l=Ir(t,c,a),l!==null&&(Sn(l,t,a),So(l,t,a))}function $y(t,a){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var l=t.retryLane;t.retryLane=l!==0&&l<a?l:a}}function Km(t,a){$y(t,a),(t=t.alternate)&&$y(t,a)}function By(t){if(t.tag===13||t.tag===31){var a=fi(t,67108864);a!==null&&Sn(a,t,67108864),Km(t,67108864)}}function _y(t){if(t.tag===13||t.tag===31){var a=$n();a=ws(a);var l=fi(t,a);l!==null&&Sn(l,t,a),Km(t,a)}}var Vd=!0;function Bk(t,a,l,c){var m=Y.T;Y.T=null;var x=P.p;try{P.p=2,Hm(t,a,l,c)}finally{P.p=x,Y.T=m}}function _k(t,a,l,c){var m=Y.T;Y.T=null;var x=P.p;try{P.p=8,Hm(t,a,l,c)}finally{P.p=x,Y.T=m}}function Hm(t,a,l,c){if(Vd){var m=Fm(c);if(m===null)Em(t,a,c,Kd,l),Ky(t,c);else if(Kk(m,t,a,l,c))c.stopPropagation();else if(Ky(t,c),a&4&&-1<Vk.indexOf(t)){for(;m!==null;){var x=pn(m);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var w=He(x.pendingLanes);if(w!==0){var E=x;for(E.pendingLanes|=2,E.entangledLanes|=2;w;){var Q=1<<31-ne(w);E.entanglements[1]|=Q,w&=~Q}Da(x),(rs&6)===0&&(Sd=Ze()+500,_o(0))}}break;case 31:case 13:E=fi(x,2),E!==null&&Sn(E,x,2),Td(),Km(x,2)}if(x=Fm(c),x===null&&Em(t,a,c,Kd,l),x===m)break;m=x}m!==null&&c.stopPropagation()}else Em(t,a,c,null,l)}}function Fm(t){return t=xn(t),Gm(t)}var Kd=null;function Gm(t){if(Kd=null,t=Fs(t),t!==null){var a=d(t);if(a===null)t=null;else{var l=a.tag;if(l===13){if(t=u(a),t!==null)return t;t=null}else if(l===31){if(t=h(a),t!==null)return t;t=null}else if(l===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;t=null}else a!==t&&(t=null)}}return Kd=t,null}function Vy(t){switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(J()){case Ne:return 2;case et:return 8;case qe:case Je:return 32;case Kt:return 268435456;default:return 32}default:return 32}}var qm=!1,Vr=null,Kr=null,Hr=null,Xo=new Map,Yo=new Map,Fr=[],Vk="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Ky(t,a){switch(t){case"focusin":case"focusout":Vr=null;break;case"dragenter":case"dragleave":Kr=null;break;case"mouseover":case"mouseout":Hr=null;break;case"pointerover":case"pointerout":Xo.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Yo.delete(a.pointerId)}}function Wo(t,a,l,c,m,x){return t===null||t.nativeEvent!==x?(t={blockedOn:a,domEventName:l,eventSystemFlags:c,nativeEvent:x,targetContainers:[m]},a!==null&&(a=pn(a),a!==null&&By(a)),t):(t.eventSystemFlags|=c,a=t.targetContainers,m!==null&&a.indexOf(m)===-1&&a.push(m),t)}function Kk(t,a,l,c,m){switch(a){case"focusin":return Vr=Wo(Vr,t,a,l,c,m),!0;case"dragenter":return Kr=Wo(Kr,t,a,l,c,m),!0;case"mouseover":return Hr=Wo(Hr,t,a,l,c,m),!0;case"pointerover":var x=m.pointerId;return Xo.set(x,Wo(Xo.get(x)||null,t,a,l,c,m)),!0;case"gotpointercapture":return x=m.pointerId,Yo.set(x,Wo(Yo.get(x)||null,t,a,l,c,m)),!0}return!1}function Hy(t){var a=Fs(t.target);if(a!==null){var l=d(a);if(l!==null){if(a=l.tag,a===13){if(a=u(l),a!==null){t.blockedOn=a,he(t.priority,function(){_y(l)});return}}else if(a===31){if(a=h(l),a!==null){t.blockedOn=a,he(t.priority,function(){_y(l)});return}}else if(a===3&&l.stateNode.current.memoizedState.isDehydrated){t.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Hd(t){if(t.blockedOn!==null)return!1;for(var a=t.targetContainers;0<a.length;){var l=Fm(t.nativeEvent);if(l===null){l=t.nativeEvent;var c=new l.constructor(l.type,l);co=c,l.target.dispatchEvent(c),co=null}else return a=pn(l),a!==null&&By(a),t.blockedOn=l,!1;a.shift()}return!0}function Fy(t,a,l){Hd(t)&&l.delete(a)}function Hk(){qm=!1,Vr!==null&&Hd(Vr)&&(Vr=null),Kr!==null&&Hd(Kr)&&(Kr=null),Hr!==null&&Hd(Hr)&&(Hr=null),Xo.forEach(Fy),Yo.forEach(Fy)}function Fd(t,a){t.blockedOn===a&&(t.blockedOn=null,qm||(qm=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,Hk)))}var Gd=null;function Gy(t){Gd!==t&&(Gd=t,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){Gd===t&&(Gd=null);for(var a=0;a<t.length;a+=3){var l=t[a],c=t[a+1],m=t[a+2];if(typeof c!="function"){if(Gm(c||l)===null)continue;break}var x=pn(l);x!==null&&(t.splice(a,3),a-=3,Fh(x,{pending:!0,data:m,method:l.method,action:c},c,m))}}))}function El(t){function a(Q){return Fd(Q,t)}Vr!==null&&Fd(Vr,t),Kr!==null&&Fd(Kr,t),Hr!==null&&Fd(Hr,t),Xo.forEach(a),Yo.forEach(a);for(var l=0;l<Fr.length;l++){var c=Fr[l];c.blockedOn===t&&(c.blockedOn=null)}for(;0<Fr.length&&(l=Fr[0],l.blockedOn===null);)Hy(l),l.blockedOn===null&&Fr.shift();if(l=(t.ownerDocument||t).$$reactFormReplay,l!=null)for(c=0;c<l.length;c+=3){var m=l[c],x=l[c+1],w=m[jt]||null;if(typeof x=="function")w||Gy(l);else if(w){var E=null;if(x&&x.hasAttribute("formAction")){if(m=x,w=x[jt]||null)E=w.formAction;else if(Gm(m)!==null)continue}else E=w.action;typeof E=="function"?l[c+1]=E:(l.splice(c,3),c-=3),Gy(l)}}}function qy(){function t(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(w){return m=w})},focusReset:"manual",scroll:"manual"})}function a(){m!==null&&(m(),m=null),c||setTimeout(l,20)}function l(){if(!c&&!navigation.transition){var x=navigation.currentEntry;x&&x.url!=null&&navigation.navigate(x.url,{state:x.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var c=!1,m=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(l,100),function(){c=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),m!==null&&(m(),m=null)}}}function Xm(t){this._internalRoot=t}qd.prototype.render=Xm.prototype.render=function(t){var a=this._internalRoot;if(a===null)throw Error(i(409));var l=a.current,c=$n();Uy(l,c,t,a,null,null)},qd.prototype.unmount=Xm.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var a=t.containerInfo;Uy(t.current,2,null,t,null,null),Td(),a[Be]=null}};function qd(t){this._internalRoot=t}qd.prototype.unstable_scheduleHydration=function(t){if(t){var a=Z();t={blockedOn:null,target:t,priority:a};for(var l=0;l<Fr.length&&a!==0&&a<Fr[l].priority;l++);Fr.splice(l,0,t),l===0&&Hy(t)}};var Xy=s.version;if(Xy!=="19.2.1")throw Error(i(527,Xy,"19.2.1"));P.findDOMNode=function(t){var a=t._reactInternals;if(a===void 0)throw typeof t.render=="function"?Error(i(188)):(t=Object.keys(t).join(","),Error(i(268,t)));return t=p(a),t=t!==null?y(t):null,t=t===null?null:t.stateNode,t};var Fk={bundleType:0,version:"19.2.1",rendererPackageName:"react-dom",currentDispatcherRef:Y,reconcilerVersion:"19.2.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Xd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Xd.isDisabled&&Xd.supportsFiber)try{Jt=Xd.inject(Fk),Ct=Xd}catch{}}return Zo.createRoot=function(t,a){if(!o(t))throw Error(i(299));var l=!1,c="",m=t0,x=s0,w=n0;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(c=a.identifierPrefix),a.onUncaughtError!==void 0&&(m=a.onUncaughtError),a.onCaughtError!==void 0&&(x=a.onCaughtError),a.onRecoverableError!==void 0&&(w=a.onRecoverableError)),a=Oy(t,1,!1,null,null,l,c,null,m,x,w,qy),t[Be]=a.current,Mm(t),new Xm(a)},Zo.hydrateRoot=function(t,a,l){if(!o(t))throw Error(i(299));var c=!1,m="",x=t0,w=s0,E=n0,Q=null;return l!=null&&(l.unstable_strictMode===!0&&(c=!0),l.identifierPrefix!==void 0&&(m=l.identifierPrefix),l.onUncaughtError!==void 0&&(x=l.onUncaughtError),l.onCaughtError!==void 0&&(w=l.onCaughtError),l.onRecoverableError!==void 0&&(E=l.onRecoverableError),l.formState!==void 0&&(Q=l.formState)),a=Oy(t,1,!0,a,l??null,c,m,Q,x,w,E,qy),a.context=zy(null),l=a.current,c=$n(),c=ws(c),m=Er(c),m.callback=null,Ir(l,m,c),l=c,a.current.lanes=l,nt(a,l),Da(a),t[Be]=a.current,Mm(t),new qd(a)},Zo.version="19.2.1",Zo}var ab;function t2(){if(ab)return Qm.exports;ab=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(s){console.error(s)}}return n(),Qm.exports=e2(),Qm.exports}var s2=t2();const Up=g.createContext({});function $p(n){const s=g.useRef(null);return s.current===null&&(s.current=n()),s.current}const n2=typeof window<"u",Lj=n2?g.useLayoutEffect:g.useEffect,_u=g.createContext(null);function Bp(n,s){n.indexOf(s)===-1&&n.push(s)}function ku(n,s){const r=n.indexOf(s);r>-1&&n.splice(r,1)}const Ha=(n,s,r)=>r>s?s:r<n?n:r;let _p=()=>{};const si={},Oj=n=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(n),zj=n=>typeof n=="object"&&n!==null,Uj=n=>/^0[^.\s]+$/u.test(n);function $j(n){let s;return()=>(s===void 0&&(s=n()),s)}const ca=n=>n,Mc=(...n)=>n.reduce((s,r)=>i=>r(s(i))),gc=(n,s,r)=>{const i=s-n;return i?(r-n)/i:1};class Vp{constructor(){this.subscriptions=[]}add(s){return Bp(this.subscriptions,s),()=>ku(this.subscriptions,s)}notify(s,r,i){const o=this.subscriptions.length;if(o)if(o===1)this.subscriptions[0](s,r,i);else for(let d=0;d<o;d++){const u=this.subscriptions[d];u&&u(s,r,i)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Hn=n=>n*1e3,la=n=>n/1e3,Bj=(n,s)=>s?n*(1e3/s):0,_j=(n,s,r)=>(((1-3*r+3*s)*n+(3*r-6*s))*n+3*s)*n,a2=1e-7,r2=12;function i2(n,s,r,i,o){let d,u,h=0;do u=s+(r-s)/2,d=_j(u,i,o)-n,d>0?r=u:s=u;while(Math.abs(d)>a2&&++h<r2);return u}function Ec(n,s,r,i){if(n===s&&r===i)return ca;const o=d=>i2(d,0,1,n,r);return d=>d===0||d===1?d:_j(o(d),s,i)}const Vj=n=>s=>s<=.5?n(2*s)/2:(2-n(2*(1-s)))/2,Kj=n=>s=>1-n(1-s),Hj=Ec(.33,1.53,.69,.99),Kp=Kj(Hj),Fj=Vj(Kp),Gj=n=>n>=1?1:(n*=2)<1?.5*Kp(n):.5*(2-Math.pow(2,-10*(n-1))),Hp=n=>1-Math.sin(Math.acos(n)),qj=Kj(Hp),Xj=Vj(Hp),l2=Ec(.42,0,1,1),o2=Ec(0,0,.58,1),Yj=Ec(.42,0,.58,1),c2=n=>Array.isArray(n)&&typeof n[0]!="number",Wj=n=>Array.isArray(n)&&typeof n[0]=="number",d2={linear:ca,easeIn:l2,easeInOut:Yj,easeOut:o2,circIn:Hp,circInOut:Xj,circOut:qj,backIn:Kp,backInOut:Fj,backOut:Hj,anticipate:Gj},u2=n=>typeof n=="string",rb=n=>{if(Wj(n)){_p(n.length===4);const[s,r,i,o]=n;return Ec(s,r,i,o)}else if(u2(n))return d2[n];return n},Wd=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function h2(n,s){let r=new Set,i=new Set,o=!1,d=!1;const u=new WeakSet;let h={delta:0,timestamp:0,isProcessing:!1};function f(y){u.has(y)&&(p.schedule(y),n()),y(h)}const p={schedule:(y,b=!1,v=!1)=>{const j=v&&o?r:i;return b&&u.add(y),j.add(y),y},cancel:y=>{i.delete(y),u.delete(y)},process:y=>{if(h=y,o){d=!0;return}o=!0;const b=r;r=i,i=b,r.forEach(f),r.clear(),o=!1,d&&(d=!1,p.process(y))}};return p}const m2=40;function Qj(n,s){let r=!1,i=!0;const o={delta:0,timestamp:0,isProcessing:!1},d=()=>r=!0,u=Wd.reduce((I,M)=>(I[M]=h2(d),I),{}),{setup:h,read:f,resolveKeyframes:p,preUpdate:y,update:b,preRender:v,render:N,postRender:j}=u,T=()=>{const I=si.useManualTiming,M=I?o.timestamp:performance.now();r=!1,I||(o.delta=i?1e3/60:Math.max(Math.min(M-o.timestamp,m2),1)),o.timestamp=M,o.isProcessing=!0,h.process(o),f.process(o),p.process(o),y.process(o),b.process(o),v.process(o),N.process(o),j.process(o),o.isProcessing=!1,r&&s&&(i=!1,n(T))},S=()=>{r=!0,i=!0,o.isProcessing||n(T)};return{schedule:Wd.reduce((I,M)=>{const G=u[M];return I[M]=(W,U=!1,q=!1)=>(r||S(),G.schedule(W,U,q)),I},{}),cancel:I=>{for(let M=0;M<Wd.length;M++)u[Wd[M]].cancel(I)},state:o,steps:u}}const{schedule:xs,cancel:ni,state:nn,steps:tf}=Qj(typeof requestAnimationFrame<"u"?requestAnimationFrame:ca,!0);let uu;function f2(){uu=void 0}const yn={now:()=>(uu===void 0&&yn.set(nn.isProcessing||si.useManualTiming?nn.timestamp:performance.now()),uu),set:n=>{uu=n,queueMicrotask(f2)}},Zj=n=>s=>typeof s=="string"&&s.startsWith(n),Jj=Zj("--"),p2=Zj("var(--"),Fp=n=>p2(n)?x2.test(n.split("/*")[0].trim()):!1,x2=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function ib(n){return typeof n!="string"?!1:n.split("/*")[0].includes("var(--")}const so={test:n=>typeof n=="number",parse:parseFloat,transform:n=>n},yc={...so,transform:n=>Ha(0,1,n)},Qd={...so,default:1},uc=n=>Math.round(n*1e5)/1e5,Gp=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function g2(n){return n==null}const y2=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,qp=(n,s)=>r=>!!(typeof r=="string"&&y2.test(r)&&r.startsWith(n)||s&&!g2(r)&&Object.prototype.hasOwnProperty.call(r,s)),e1=(n,s,r)=>i=>{if(typeof i!="string")return i;const[o,d,u,h]=i.match(Gp);return{[n]:parseFloat(o),[s]:parseFloat(d),[r]:parseFloat(u),alpha:h!==void 0?parseFloat(h):1}},b2=n=>Ha(0,255,n),sf={...so,transform:n=>Math.round(b2(n))},Pi={test:qp("rgb","red"),parse:e1("red","green","blue"),transform:({red:n,green:s,blue:r,alpha:i=1})=>"rgba("+sf.transform(n)+", "+sf.transform(s)+", "+sf.transform(r)+", "+uc(yc.transform(i))+")"};function v2(n){let s="",r="",i="",o="";return n.length>5?(s=n.substring(1,3),r=n.substring(3,5),i=n.substring(5,7),o=n.substring(7,9)):(s=n.substring(1,2),r=n.substring(2,3),i=n.substring(3,4),o=n.substring(4,5),s+=s,r+=r,i+=i,o+=o),{red:parseInt(s,16),green:parseInt(r,16),blue:parseInt(i,16),alpha:o?parseInt(o,16)/255:1}}const Wf={test:qp("#"),parse:v2,transform:Pi.transform},Ic=n=>({test:s=>typeof s=="string"&&s.endsWith(n)&&s.split(" ").length===1,parse:parseFloat,transform:s=>`${s}${n}`}),fr=Ic("deg"),_a=Ic("%"),dt=Ic("px"),j2=Ic("vh"),N2=Ic("vw"),lb={..._a,parse:n=>_a.parse(n)/100,transform:n=>_a.transform(n*100)},Kl={test:qp("hsl","hue"),parse:e1("hue","saturation","lightness"),transform:({hue:n,saturation:s,lightness:r,alpha:i=1})=>"hsla("+Math.round(n)+", "+_a.transform(uc(s))+", "+_a.transform(uc(r))+", "+uc(yc.transform(i))+")"},Us={test:n=>Pi.test(n)||Wf.test(n)||Kl.test(n),parse:n=>Pi.test(n)?Pi.parse(n):Kl.test(n)?Kl.parse(n):Wf.parse(n),transform:n=>typeof n=="string"?n:n.hasOwnProperty("red")?Pi.transform(n):Kl.transform(n),getAnimatableNone:n=>{const s=Us.parse(n);return s.alpha=0,Us.transform(s)}},w2=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function k2(n){return isNaN(n)&&typeof n=="string"&&(n.match(Gp)?.length||0)+(n.match(w2)?.length||0)>0}const t1="number",s1="color",S2="var",C2="var(",ob="${}",T2=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Ql(n){const s=n.toString(),r=[],i={color:[],number:[],var:[]},o=[];let d=0;const h=s.replace(T2,f=>(Us.test(f)?(i.color.push(d),o.push(s1),r.push(Us.parse(f))):f.startsWith(C2)?(i.var.push(d),o.push(S2),r.push(f)):(i.number.push(d),o.push(t1),r.push(parseFloat(f))),++d,ob)).split(ob);return{values:r,split:h,indexes:i,types:o}}function A2(n){return Ql(n).values}function n1({split:n,types:s}){const r=n.length;return i=>{let o="";for(let d=0;d<r;d++)if(o+=n[d],i[d]!==void 0){const u=s[d];u===t1?o+=uc(i[d]):u===s1?o+=Us.transform(i[d]):o+=i[d]}return o}}function M2(n){return n1(Ql(n))}const E2=n=>typeof n=="number"?0:Us.test(n)?Us.getAnimatableNone(n):n,I2=(n,s)=>typeof n=="number"?s?.trim().endsWith("/")?n:0:E2(n);function R2(n){const s=Ql(n);return n1(s)(s.values.map((i,o)=>I2(i,s.split[o])))}const ja={test:k2,parse:A2,createTransformer:M2,getAnimatableNone:R2};function nf(n,s,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?n+(s-n)*6*r:r<1/2?s:r<2/3?n+(s-n)*(2/3-r)*6:n}function D2({hue:n,saturation:s,lightness:r,alpha:i}){n/=360,s/=100,r/=100;let o=0,d=0,u=0;if(!s)o=d=u=r;else{const h=r<.5?r*(1+s):r+s-r*s,f=2*r-h;o=nf(f,h,n+1/3),d=nf(f,h,n),u=nf(f,h,n-1/3)}return{red:Math.round(o*255),green:Math.round(d*255),blue:Math.round(u*255),alpha:i}}function Su(n,s){return r=>r>0?s:n}const ps=(n,s,r)=>n+(s-n)*r,af=(n,s,r)=>{const i=n*n,o=r*(s*s-i)+i;return o<0?0:Math.sqrt(o)},P2=[Wf,Pi,Kl],L2=n=>P2.find(s=>s.test(n));function cb(n){const s=L2(n);if(!s)return!1;let r=s.parse(n);return s===Kl&&(r=D2(r)),r}const db=(n,s)=>{const r=cb(n),i=cb(s);if(!r||!i)return Su(n,s);const o={...r};return d=>(o.red=af(r.red,i.red,d),o.green=af(r.green,i.green,d),o.blue=af(r.blue,i.blue,d),o.alpha=ps(r.alpha,i.alpha,d),Pi.transform(o))},Qf=new Set(["none","hidden"]);function O2(n,s){return Qf.has(n)?r=>r<=0?n:s:r=>r>=1?s:n}function z2(n,s){return r=>ps(n,s,r)}function Xp(n){return typeof n=="number"?z2:typeof n=="string"?Fp(n)?Su:Us.test(n)?db:B2:Array.isArray(n)?a1:typeof n=="object"?Us.test(n)?db:U2:Su}function a1(n,s){const r=[...n],i=r.length,o=n.map((d,u)=>Xp(d)(d,s[u]));return d=>{for(let u=0;u<i;u++)r[u]=o[u](d);return r}}function U2(n,s){const r={...n,...s},i={};for(const o in r)n[o]!==void 0&&s[o]!==void 0&&(i[o]=Xp(n[o])(n[o],s[o]));return o=>{for(const d in i)r[d]=i[d](o);return r}}function $2(n,s){const r=[],i={color:0,var:0,number:0};for(let o=0;o<s.values.length;o++){const d=s.types[o],u=n.indexes[d][i[d]],h=n.values[u]??0;r[o]=h,i[d]++}return r}const B2=(n,s)=>{const r=ja.createTransformer(s),i=Ql(n),o=Ql(s);return i.indexes.var.length===o.indexes.var.length&&i.indexes.color.length===o.indexes.color.length&&i.indexes.number.length>=o.indexes.number.length?Qf.has(n)&&!o.values.length||Qf.has(s)&&!i.values.length?O2(n,s):Mc(a1($2(i,o),o.values),r):Su(n,s)};function r1(n,s,r){return typeof n=="number"&&typeof s=="number"&&typeof r=="number"?ps(n,s,r):Xp(n)(n,s)}const _2=n=>{const s=({timestamp:r})=>n(r);return{start:(r=!0)=>xs.update(s,r),stop:()=>ni(s),now:()=>nn.isProcessing?nn.timestamp:yn.now()}},i1=(n,s,r=10)=>{let i="";const o=Math.max(Math.round(s/r),2);for(let d=0;d<o;d++)i+=Math.round(n(d/(o-1))*1e4)/1e4+", ";return`linear(${i.substring(0,i.length-2)})`},Cu=2e4;function Yp(n){let s=0;const r=50;let i=n.next(s);for(;!i.done&&s<Cu;)s+=r,i=n.next(s);return s>=Cu?1/0:s}function V2(n,s=100,r){const i=r({...n,keyframes:[0,s]}),o=Math.min(Yp(i),Cu);return{type:"keyframes",ease:d=>i.next(o*d).value/s,duration:la(o)}}const Cs={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function Zf(n,s){return n*Math.sqrt(1-s*s)}const K2=12;function H2(n,s,r){let i=r;for(let o=1;o<K2;o++)i=i-n(i)/s(i);return i}const rf=.001;function F2({duration:n=Cs.duration,bounce:s=Cs.bounce,velocity:r=Cs.velocity,mass:i=Cs.mass}){let o,d,u=1-s;u=Ha(Cs.minDamping,Cs.maxDamping,u),n=Ha(Cs.minDuration,Cs.maxDuration,la(n)),u<1?(o=p=>{const y=p*u,b=y*n,v=y-r,N=Zf(p,u),j=Math.exp(-b);return rf-v/N*j},d=p=>{const b=p*u*n,v=b*r+r,N=Math.pow(u,2)*Math.pow(p,2)*n,j=Math.exp(-b),T=Zf(Math.pow(p,2),u);return(-o(p)+rf>0?-1:1)*((v-N)*j)/T}):(o=p=>{const y=Math.exp(-p*n),b=(p-r)*n+1;return-rf+y*b},d=p=>{const y=Math.exp(-p*n),b=(r-p)*(n*n);return y*b});const h=5/n,f=H2(o,d,h);if(n=Hn(n),isNaN(f))return{stiffness:Cs.stiffness,damping:Cs.damping,duration:n};{const p=Math.pow(f,2)*i;return{stiffness:p,damping:u*2*Math.sqrt(i*p),duration:n}}}const G2=["duration","bounce"],q2=["stiffness","damping","mass"];function ub(n,s){return s.some(r=>n[r]!==void 0)}function X2(n){let s={velocity:Cs.velocity,stiffness:Cs.stiffness,damping:Cs.damping,mass:Cs.mass,isResolvedFromDuration:!1,...n};if(!ub(n,q2)&&ub(n,G2))if(s.velocity=0,n.visualDuration){const r=n.visualDuration,i=2*Math.PI/(r*1.2),o=i*i,d=2*Ha(.05,1,1-(n.bounce||0))*Math.sqrt(o);s={...s,mass:Cs.mass,stiffness:o,damping:d}}else{const r=F2({...n,velocity:0});s={...s,...r,mass:Cs.mass},s.isResolvedFromDuration=!0}return s}function Tu(n=Cs.visualDuration,s=Cs.bounce){const r=typeof n!="object"?{visualDuration:n,keyframes:[0,1],bounce:s}:n;let{restSpeed:i,restDelta:o}=r;const d=r.keyframes[0],u=r.keyframes[r.keyframes.length-1],h={done:!1,value:d},{stiffness:f,damping:p,mass:y,duration:b,velocity:v,isResolvedFromDuration:N}=X2({...r,velocity:-la(r.velocity||0)}),j=v||0,T=p/(2*Math.sqrt(f*y)),S=u-d,k=la(Math.sqrt(f/y)),R=Math.abs(S)<5;i||(i=R?Cs.restSpeed.granular:Cs.restSpeed.default),o||(o=R?Cs.restDelta.granular:Cs.restDelta.default);let I,M,G,W,U,q;if(T<1)G=Zf(k,T),W=(j+T*k*S)/G,I=le=>{const B=Math.exp(-T*k*le);return u-B*(W*Math.sin(G*le)+S*Math.cos(G*le))},U=T*k*W+S*G,q=T*k*S-W*G,M=le=>Math.exp(-T*k*le)*(U*Math.sin(G*le)+q*Math.cos(G*le));else if(T===1){I=B=>u-Math.exp(-k*B)*(S+(j+k*S)*B);const le=j+k*S;M=B=>Math.exp(-k*B)*(k*le*B-j)}else{const le=k*Math.sqrt(T*T-1);I=se=>{const te=Math.exp(-T*k*se),Y=Math.min(le*se,300);return u-te*((j+T*k*S)*Math.sinh(Y)+le*S*Math.cosh(Y))/le};const B=(j+T*k*S)/le,be=T*k*B-S*le,K=T*k*S-B*le;M=se=>{const te=Math.exp(-T*k*se),Y=Math.min(le*se,300);return te*(be*Math.sinh(Y)+K*Math.cosh(Y))}}const V={calculatedDuration:N&&b||null,velocity:le=>Hn(M(le)),next:le=>{if(!N&&T<1){const be=Math.exp(-T*k*le),K=Math.sin(G*le),se=Math.cos(G*le),te=u-be*(W*K+S*se),Y=Hn(be*(U*K+q*se));return h.done=Math.abs(Y)<=i&&Math.abs(u-te)<=o,h.value=h.done?u:te,h}const B=I(le);if(N)h.done=le>=b;else{const be=Hn(M(le));h.done=Math.abs(be)<=i&&Math.abs(u-B)<=o}return h.value=h.done?u:B,h},toString:()=>{const le=Math.min(Yp(V),Cu),B=i1(be=>V.next(le*be).value,le,30);return le+"ms "+B},toTransition:()=>{}};return V}Tu.applyToOptions=n=>{const s=V2(n,100,Tu);return n.ease=s.ease,n.duration=Hn(s.duration),n.type="keyframes",n};const Y2=5;function l1(n,s,r){const i=Math.max(s-Y2,0);return Bj(r-n(i),s-i)}function Jf({keyframes:n,velocity:s=0,power:r=.8,timeConstant:i=325,bounceDamping:o=10,bounceStiffness:d=500,modifyTarget:u,min:h,max:f,restDelta:p=.5,restSpeed:y}){const b=n[0],v={done:!1,value:b},N=q=>h!==void 0&&q<h||f!==void 0&&q>f,j=q=>h===void 0?f:f===void 0||Math.abs(h-q)<Math.abs(f-q)?h:f;let T=r*s;const S=b+T,k=u===void 0?S:u(S);k!==S&&(T=k-b);const R=q=>-T*Math.exp(-q/i),I=q=>k+R(q),M=q=>{const V=R(q),le=I(q);v.done=Math.abs(V)<=p,v.value=v.done?k:le};let G,W;const U=q=>{N(v.value)&&(G=q,W=Tu({keyframes:[v.value,j(v.value)],velocity:l1(I,q,v.value),damping:o,stiffness:d,restDelta:p,restSpeed:y}))};return U(0),{calculatedDuration:null,next:q=>{let V=!1;return!W&&G===void 0&&(V=!0,M(q),U(q)),G!==void 0&&q>=G?W.next(q-G):(!V&&M(q),v)}}}function W2(n,s,r){const i=[],o=r||si.mix||r1,d=n.length-1;for(let u=0;u<d;u++){let h=o(n[u],n[u+1]);if(s){const f=Array.isArray(s)?s[u]||ca:s;h=Mc(f,h)}i.push(h)}return i}function Q2(n,s,{clamp:r=!0,ease:i,mixer:o}={}){const d=n.length;if(_p(d===s.length),d===1)return()=>s[0];if(d===2&&s[0]===s[1])return()=>s[1];const u=n[0]===n[1];n[0]>n[d-1]&&(n=[...n].reverse(),s=[...s].reverse());const h=W2(s,i,o),f=h.length,p=y=>{if(u&&y<n[0])return s[0];let b=0;if(f>1)for(;b<n.length-2&&!(y<n[b+1]);b++);const v=gc(n[b],n[b+1],y);return h[b](v)};return r?y=>p(Ha(n[0],n[d-1],y)):p}function Z2(n,s){const r=n[n.length-1];for(let i=1;i<=s;i++){const o=gc(0,s,i);n.push(ps(r,1,o))}}function J2(n){const s=[0];return Z2(s,n.length-1),s}function eS(n,s){return n.map(r=>r*s)}function tS(n,s){return n.map(()=>s||Yj).splice(0,n.length-1)}function hc({duration:n=300,keyframes:s,times:r,ease:i="easeInOut"}){const o=c2(i)?i.map(rb):rb(i),d={done:!1,value:s[0]},u=eS(r&&r.length===s.length?r:J2(s),n),h=Q2(u,s,{ease:Array.isArray(o)?o:tS(s,o)});return{calculatedDuration:n,next:f=>(d.value=h(f),d.done=f>=n,d)}}const sS=n=>n!==null;function Vu(n,{repeat:s,repeatType:r="loop"},i,o=1){const d=n.filter(sS),h=o<0||s&&r!=="loop"&&s%2===1?0:d.length-1;return!h||i===void 0?d[h]:i}const nS={decay:Jf,inertia:Jf,tween:hc,keyframes:hc,spring:Tu};function o1(n){typeof n.type=="string"&&(n.type=nS[n.type])}class Wp{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(s=>{this.resolve=s})}notifyFinished(){this.resolve()}then(s,r){return this.finished.then(s,r)}}const aS=n=>n/100;class Au extends Wp{constructor(s){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{const{motionValue:r}=this.options;r&&r.updatedAt!==yn.now()&&this.tick(yn.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=s,this.initAnimation(),this.play(),s.autoplay===!1&&this.pause()}initAnimation(){const{options:s}=this;o1(s);const{type:r=hc,repeat:i=0,repeatDelay:o=0,repeatType:d,velocity:u=0}=s;let{keyframes:h}=s;const f=r||hc;f!==hc&&typeof h[0]!="number"&&(this.mixKeyframes=Mc(aS,r1(h[0],h[1])),h=[0,100]);const p=f({...s,keyframes:h});d==="mirror"&&(this.mirroredGenerator=f({...s,keyframes:[...h].reverse(),velocity:-u})),p.calculatedDuration===null&&(p.calculatedDuration=Yp(p));const{calculatedDuration:y}=p;this.calculatedDuration=y,this.resolvedDuration=y+o,this.totalDuration=this.resolvedDuration*(i+1)-o,this.generator=p}updateTime(s){const r=Math.round(s-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=r}tick(s,r=!1){const{generator:i,totalDuration:o,mixKeyframes:d,mirroredGenerator:u,resolvedDuration:h,calculatedDuration:f}=this;if(this.startTime===null)return i.next(0);const{delay:p=0,keyframes:y,repeat:b,repeatType:v,repeatDelay:N,type:j,onUpdate:T,finalKeyframe:S}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,s):this.speed<0&&(this.startTime=Math.min(s-o/this.speed,this.startTime)),r?this.currentTime=s:this.updateTime(s);const k=this.currentTime-p*(this.playbackSpeed>=0?1:-1),R=this.playbackSpeed>=0?k<0:k>o;this.currentTime=Math.max(k,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=o);let I=this.currentTime,M=i;if(b){const q=Math.min(this.currentTime,o)/h;let V=Math.floor(q),le=q%1;!le&&q>=1&&(le=1),le===1&&V--,V=Math.min(V,b+1),!!(V%2)&&(v==="reverse"?(le=1-le,N&&(le-=N/h)):v==="mirror"&&(M=u)),I=Ha(0,1,le)*h}let G;R?(this.delayState.value=y[0],G=this.delayState):G=M.next(I),d&&!R&&(G.value=d(G.value));let{done:W}=G;!R&&f!==null&&(W=this.playbackSpeed>=0?this.currentTime>=o:this.currentTime<=0);const U=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&W);return U&&j!==Jf&&(G.value=Vu(y,this.options,S,this.speed)),T&&T(G.value),U&&this.finish(),G}then(s,r){return this.finished.then(s,r)}get duration(){return la(this.calculatedDuration)}get iterationDuration(){const{delay:s=0}=this.options||{};return this.duration+la(s)}get time(){return la(this.currentTime)}set time(s){s=Hn(s),this.currentTime=s,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=s:this.driver&&(this.startTime=this.driver.now()-s/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=s,this.tick(s))}getGeneratorVelocity(){const s=this.currentTime;if(s<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(s);const r=this.generator.next(s).value;return l1(i=>this.generator.next(i).value,s,r)}get speed(){return this.playbackSpeed}set speed(s){const r=this.playbackSpeed!==s;r&&this.driver&&this.updateTime(yn.now()),this.playbackSpeed=s,r&&this.driver&&(this.time=la(this.currentTime))}play(){if(this.isStopped)return;const{driver:s=_2,startTime:r}=this.options;this.driver||(this.driver=s(o=>this.tick(o))),this.options.onPlay?.();const i=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=i):this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime||(this.startTime=r??i),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(yn.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(s){return this.startTime=0,this.tick(s,!0)}attachTimeline(s){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),s.observe(this)}}function rS(n){for(let s=1;s<n.length;s++)n[s]??(n[s]=n[s-1])}const Li=n=>n*180/Math.PI,ep=n=>{const s=Li(Math.atan2(n[1],n[0]));return tp(s)},iS={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:n=>(Math.abs(n[0])+Math.abs(n[3]))/2,rotate:ep,rotateZ:ep,skewX:n=>Li(Math.atan(n[1])),skewY:n=>Li(Math.atan(n[2])),skew:n=>(Math.abs(n[1])+Math.abs(n[2]))/2},tp=n=>(n=n%360,n<0&&(n+=360),n),hb=ep,mb=n=>Math.sqrt(n[0]*n[0]+n[1]*n[1]),fb=n=>Math.sqrt(n[4]*n[4]+n[5]*n[5]),lS={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:mb,scaleY:fb,scale:n=>(mb(n)+fb(n))/2,rotateX:n=>tp(Li(Math.atan2(n[6],n[5]))),rotateY:n=>tp(Li(Math.atan2(-n[2],n[0]))),rotateZ:hb,rotate:hb,skewX:n=>Li(Math.atan(n[4])),skewY:n=>Li(Math.atan(n[1])),skew:n=>(Math.abs(n[1])+Math.abs(n[4]))/2};function sp(n){return n.includes("scale")?1:0}function np(n,s){if(!n||n==="none")return sp(s);const r=n.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let i,o;if(r)i=lS,o=r;else{const h=n.match(/^matrix\(([-\d.e\s,]+)\)$/u);i=iS,o=h}if(!o)return sp(s);const d=i[s],u=o[1].split(",").map(cS);return typeof d=="function"?d(u):u[d]}const oS=(n,s)=>{const{transform:r="none"}=getComputedStyle(n);return np(r,s)};function cS(n){return parseFloat(n.trim())}const no=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],ao=new Set([...no,"pathRotation"]),pb=n=>n===so||n===dt,dS=new Set(["x","y","z"]),uS=no.filter(n=>!dS.has(n));function hS(n){const s=[];return uS.forEach(r=>{const i=n.getValue(r);i!==void 0&&(s.push([r,i.get()]),i.set(r.startsWith("scale")?1:0))}),s}const Jr={width:({x:n},{paddingLeft:s="0",paddingRight:r="0",boxSizing:i})=>{const o=n.max-n.min;return i==="border-box"?o:o-parseFloat(s)-parseFloat(r)},height:({y:n},{paddingTop:s="0",paddingBottom:r="0",boxSizing:i})=>{const o=n.max-n.min;return i==="border-box"?o:o-parseFloat(s)-parseFloat(r)},top:(n,{top:s})=>parseFloat(s),left:(n,{left:s})=>parseFloat(s),bottom:({y:n},{top:s})=>parseFloat(s)+(n.max-n.min),right:({x:n},{left:s})=>parseFloat(s)+(n.max-n.min),x:(n,{transform:s})=>np(s,"x"),y:(n,{transform:s})=>np(s,"y")};Jr.translateX=Jr.x;Jr.translateY=Jr.y;const Bi=new Set;let ap=!1,rp=!1,ip=!1;function c1(){if(rp){const n=Array.from(Bi).filter(i=>i.needsMeasurement),s=new Set(n.map(i=>i.element)),r=new Map;s.forEach(i=>{const o=hS(i);o.length&&(r.set(i,o),i.render())}),n.forEach(i=>i.measureInitialState()),s.forEach(i=>{i.render();const o=r.get(i);o&&o.forEach(([d,u])=>{i.getValue(d)?.set(u)})}),n.forEach(i=>i.measureEndState()),n.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}rp=!1,ap=!1,Bi.forEach(n=>n.complete(ip)),Bi.clear()}function d1(){Bi.forEach(n=>{n.readKeyframes(),n.needsMeasurement&&(rp=!0)})}function mS(){ip=!0,d1(),c1(),ip=!1}class Qp{constructor(s,r,i,o,d,u=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...s],this.onComplete=r,this.name=i,this.motionValue=o,this.element=d,this.isAsync=u}scheduleResolve(){this.state="scheduled",this.isAsync?(Bi.add(this),ap||(ap=!0,xs.read(d1),xs.resolveKeyframes(c1))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:s,name:r,element:i,motionValue:o}=this;if(s[0]===null){const d=o?.get(),u=s[s.length-1];if(d!==void 0)s[0]=d;else if(i&&r){const h=i.readValue(r,u);h!=null&&(s[0]=h)}s[0]===void 0&&(s[0]=u),o&&d===void 0&&o.set(s[0])}rS(s)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(s=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,s),Bi.delete(this)}cancel(){this.state==="scheduled"&&(Bi.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const fS=n=>n.startsWith("--");function u1(n,s,r){fS(s)?n.style.setProperty(s,r):n.style[s]=r}const pS={};function h1(n,s){const r=$j(n);return()=>pS[s]??r()}const xS=h1(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),m1=h1(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),oc=([n,s,r,i])=>`cubic-bezier(${n}, ${s}, ${r}, ${i})`,xb={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:oc([0,.65,.55,1]),circOut:oc([.55,0,1,.45]),backIn:oc([.31,.01,.66,-.59]),backOut:oc([.33,1.53,.69,.99])};function f1(n,s){if(n)return typeof n=="function"?m1()?i1(n,s):"ease-out":Wj(n)?oc(n):Array.isArray(n)?n.map(r=>f1(r,s)||xb.easeOut):xb[n]}function gS(n,s,r,{delay:i=0,duration:o=300,repeat:d=0,repeatType:u="loop",ease:h="easeOut",times:f}={},p=void 0){const y={[s]:r};f&&(y.offset=f);const b=f1(h,o);Array.isArray(b)&&(y.easing=b);const v={delay:i,duration:o,easing:Array.isArray(b)?"linear":b,fill:"both",iterations:d+1,direction:u==="reverse"?"alternate":"normal"};return p&&(v.pseudoElement=p),n.animate(y,v)}function p1(n){return typeof n=="function"&&"applyToOptions"in n}function yS({type:n,...s}){return p1(n)&&m1()?n.applyToOptions(s):(s.duration??(s.duration=300),s.ease??(s.ease="easeOut"),s)}class x1 extends Wp{constructor(s){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!s)return;const{element:r,name:i,keyframes:o,pseudoElement:d,allowFlatten:u=!1,finalKeyframe:h,onComplete:f}=s;this.isPseudoElement=!!d,this.allowFlatten=u,this.options=s,_p(typeof s.type!="string");const p=yS(s);this.animation=gS(r,i,o,p,d),p.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!d){const y=Vu(o,this.options,h,this.speed);this.updateMotionValue&&this.updateMotionValue(y),u1(r,i,y),this.animation.cancel()}f?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:s}=this;s==="idle"||s==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const s=this.options?.element;!this.isPseudoElement&&s?.isConnected&&this.animation.commitStyles?.()}get duration(){const s=this.animation.effect?.getComputedTiming?.().duration||0;return la(Number(s))}get iterationDuration(){const{delay:s=0}=this.options||{};return this.duration+la(s)}get time(){return la(Number(this.animation.currentTime)||0)}set time(s){const r=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Hn(s),r&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(s){s<0&&(this.finishedTime=null),this.animation.playbackRate=s}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(s){this.manualStartTime=this.animation.startTime=s}attachTimeline({timeline:s,rangeStart:r,rangeEnd:i,observe:o}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,s&&xS()?(this.animation.timeline=s,r&&(this.animation.rangeStart=r),i&&(this.animation.rangeEnd=i),ca):o(this)}}const g1={anticipate:Gj,backInOut:Fj,circInOut:Xj};function bS(n){return n in g1}function vS(n){typeof n.ease=="string"&&bS(n.ease)&&(n.ease=g1[n.ease])}const lf=10;class jS extends x1{constructor(s){vS(s),o1(s),super(s),s.startTime!==void 0&&s.autoplay!==!1&&(this.startTime=s.startTime),this.options=s}updateMotionValue(s){const{motionValue:r,onUpdate:i,onComplete:o,element:d,...u}=this.options;if(!r)return;if(s!==void 0){r.set(s);return}const h=new Au({...u,autoplay:!1}),f=Math.max(lf,yn.now()-this.startTime),p=Ha(0,lf,f-lf),y=h.sample(f).value,{name:b}=this.options;d&&b&&u1(d,b,y),r.setWithVelocity(h.sample(Math.max(0,f-p)).value,y,p),h.stop()}}const gb=(n,s)=>s==="zIndex"?!1:!!(typeof n=="number"||Array.isArray(n)||typeof n=="string"&&(ja.test(n)||n==="0")&&!n.startsWith("url("));function NS(n){const s=n[0];if(n.length===1)return!0;for(let r=0;r<n.length;r++)if(n[r]!==s)return!0}function wS(n,s,r,i){const o=n[0];if(o===null)return!1;if(s==="display"||s==="visibility")return!0;const d=n[n.length-1],u=gb(o,s),h=gb(d,s);return!u||!h?!1:NS(n)||(r==="spring"||p1(r))&&i}function lp(n){n.duration=0,n.type="keyframes"}const y1=new Set(["opacity","clipPath","filter","transform"]),kS=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function SS(n){for(let s=0;s<n.length;s++)if(typeof n[s]=="string"&&kS.test(n[s]))return!0;return!1}const CS=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),TS=$j(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function AS(n){const{motionValue:s,name:r,repeatDelay:i,repeatType:o,damping:d,type:u,keyframes:h}=n;if(!(s?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:p,transformTemplate:y}=s.owner.getProps();return TS()&&r&&(y1.has(r)||CS.has(r)&&SS(h))&&(r!=="transform"||!y)&&!p&&!i&&o!=="mirror"&&d!==0&&u!=="inertia"}const MS=40;class ES extends Wp{constructor({autoplay:s=!0,delay:r=0,type:i="keyframes",repeat:o=0,repeatDelay:d=0,repeatType:u="loop",keyframes:h,name:f,motionValue:p,element:y,...b}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=yn.now();const v={autoplay:s,delay:r,type:i,repeat:o,repeatDelay:d,repeatType:u,name:f,motionValue:p,element:y,...b},N=y?.KeyframeResolver||Qp;this.keyframeResolver=new N(h,(j,T,S)=>this.onKeyframesResolved(j,T,v,!S),f,p,y),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(s,r,i,o){this.keyframeResolver=void 0;const{name:d,type:u,velocity:h,delay:f,isHandoff:p,onUpdate:y}=i;this.resolvedAt=yn.now();let b=!0;wS(s,d,u,h)||(b=!1,(si.instantAnimations||!f)&&y?.(Vu(s,i,r)),s[0]=s[s.length-1],lp(i),i.repeat=0);const N={startTime:o?this.resolvedAt?this.resolvedAt-this.createdAt>MS?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:r,...i,keyframes:s},j=b&&!p&&AS(N),T=N.motionValue?.owner?.current;let S;if(j)try{S=new jS({...N,element:T})}catch{S=new Au(N)}else S=new Au(N);S.finished.then(()=>{this.notifyFinished()}).catch(ca),this.pendingTimeline&&(this.stopTimeline=S.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=S}get finished(){return this._animation?this.animation.finished:this._finished}then(s,r){return this.finished.finally(s).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),mS()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(s){this.animation.time=s}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(s){this.animation.speed=s}get startTime(){return this.animation.startTime}attachTimeline(s){return this._animation?this.stopTimeline=this.animation.attachTimeline(s):this.pendingTimeline=s,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}function b1(n,s,r,i=0,o=1){const d=Array.from(n).sort((p,y)=>p.sortNodePosition(y)).indexOf(s),u=n.size,h=(u-1)*i;return typeof r=="function"?r(d,u):o===1?d*i:h-d*i}const yb=30,IS=n=>!isNaN(parseFloat(n));class RS{constructor(s,r={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=i=>{const o=yn.now();if(this.updatedAt!==o&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(i),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const d of this.dependents)d.dirty()},this.hasAnimated=!1,this.setCurrent(s),this.owner=r.owner}setCurrent(s){this.current=s,this.updatedAt=yn.now(),this.canTrackVelocity===null&&s!==void 0&&(this.canTrackVelocity=IS(this.current))}setPrevFrameValue(s=this.current){this.prevFrameValue=s,this.prevUpdatedAt=this.updatedAt}onChange(s){return this.on("change",s)}on(s,r){this.events[s]||(this.events[s]=new Vp);const i=this.events[s].add(r);return s==="change"?()=>{i(),xs.read(()=>{this.events.change.getSize()||this.stop()})}:i}clearListeners(){for(const s in this.events)this.events[s].clear()}attach(s,r){this.passiveEffect=s,this.stopPassiveEffect=r}set(s){this.passiveEffect?this.passiveEffect(s,this.updateAndNotify):this.updateAndNotify(s)}setWithVelocity(s,r,i){this.set(r),this.prev=void 0,this.prevFrameValue=s,this.prevUpdatedAt=this.updatedAt-i}jump(s,r=!0){this.updateAndNotify(s),this.prev=s,this.prevUpdatedAt=this.prevFrameValue=void 0,r&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(s){this.dependents||(this.dependents=new Set),this.dependents.add(s)}removeDependent(s){this.dependents&&this.dependents.delete(s)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const s=yn.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||s-this.updatedAt>yb)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,yb);return Bj(parseFloat(this.current)-parseFloat(this.prevFrameValue),r)}start(s){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=s(r),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Zl(n,s){return new RS(n,s)}function v1(n,s){if(n?.inherit&&s){const{inherit:r,...i}=n;return{...s,...i}}return n}function Zp(n,s){const r=n?.[s]??n?.default??n;return r!==n?v1(r,n):r}const DS={type:"spring",stiffness:500,damping:25,restSpeed:10},PS=n=>({type:"spring",stiffness:550,damping:n===0?2*Math.sqrt(550):30,restSpeed:10}),LS={type:"keyframes",duration:.8},OS={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},zS=(n,{keyframes:s})=>s.length>2?LS:ao.has(n)?n.startsWith("scale")?PS(s[1]):DS:OS,US=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function $S(n){for(const s in n)if(!US.has(s))return!0;return!1}const Jp=(n,s,r,i={},o,d)=>u=>{const h=Zp(i,n)||{},f=h.delay||i.delay||0;let{elapsed:p=0}=i;p=p-Hn(f);const y={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:s.getVelocity(),...h,delay:-p,onUpdate:v=>{s.set(v),h.onUpdate&&h.onUpdate(v)},onComplete:()=>{u(),h.onComplete&&h.onComplete()},name:n,motionValue:s,element:d?void 0:o};$S(h)||Object.assign(y,zS(n,y)),y.duration&&(y.duration=Hn(y.duration)),y.repeatDelay&&(y.repeatDelay=Hn(y.repeatDelay)),y.from!==void 0&&(y.keyframes[0]=y.from);let b=!1;if((y.type===!1||y.duration===0&&!y.repeatDelay)&&(lp(y),y.delay===0&&(b=!0)),(si.instantAnimations||si.skipAnimations||o?.shouldSkipAnimations||h.skipAnimations)&&(b=!0,lp(y),y.delay=0),y.allowFlatten=!h.type&&!h.ease,b&&!d&&s.get()!==void 0){const v=Vu(y.keyframes,h);if(v!==void 0){xs.update(()=>{y.onUpdate(v),y.onComplete()});return}}return h.isSync?new Au(y):new ES(y)},BS=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function _S(n){const s=BS.exec(n);if(!s)return[,];const[,r,i,o]=s;return[`--${r??i}`,o]}function j1(n,s,r=1){const[i,o]=_S(n);if(!i)return;const d=window.getComputedStyle(s).getPropertyValue(i);if(d){const u=d.trim();return Oj(u)?parseFloat(u):u}return Fp(o)?j1(o,s,r+1):o}function bb(n){const s=[{},{}];return n?.values.forEach((r,i)=>{s[0][i]=r.get(),s[1][i]=r.getVelocity()}),s}function ex(n,s,r,i){if(typeof s=="function"){const[o,d]=bb(i);s=s(r!==void 0?r:n.custom,o,d)}if(typeof s=="string"&&(s=n.variants&&n.variants[s]),typeof s=="function"){const[o,d]=bb(i);s=s(r!==void 0?r:n.custom,o,d)}return s}function _i(n,s,r){const i=n.getProps();return ex(i,s,r!==void 0?r:i.custom,n)}const N1=new Set(["width","height","top","left","right","bottom",...no]),op=n=>Array.isArray(n);function VS(n,s,r){n.hasValue(s)?n.getValue(s).set(r):n.addValue(s,Zl(r))}function KS(n){return op(n)?n[n.length-1]||0:n}function HS(n,s){const r=_i(n,s);let{transitionEnd:i={},transition:o={},...d}=r||{};d={...d,...i};for(const u in d){const h=KS(d[u]);VS(n,u,h)}}const rn=n=>!!(n&&n.getVelocity);function FS(n){return!!(rn(n)&&n.add)}function cp(n,s){const r=n.getValue("willChange");if(FS(r))return r.add(s);if(!r&&si.WillChange){const i=new si.WillChange("auto");n.addValue("willChange",i),i.add(s)}}function tx(n){return n.replace(/([A-Z])/g,s=>`-${s.toLowerCase()}`)}const GS="framerAppearId",w1="data-"+tx(GS);function k1(n){return n.props[w1]}function qS({protectedKeys:n,needsAnimating:s},r){const i=n.hasOwnProperty(r)&&s[r]!==!0;return s[r]=!1,i}function S1(n,s,{delay:r=0,transitionOverride:i,type:o}={}){let{transition:d,transitionEnd:u,...h}=s;const f=n.getDefaultTransition();d=d?v1(d,f):f;const p=d?.reduceMotion,y=d?.skipAnimations;i&&(d=i);const b=[],v=o&&n.animationState&&n.animationState.getState()[o],N=d?.path;N&&N.animateVisualElement(n,h,d,r,b);for(const j in h){const T=n.getValue(j,n.latestValues[j]??null),S=h[j];if(S===void 0||v&&qS(v,j))continue;const k={delay:r,...Zp(d||{},j)};y&&(k.skipAnimations=!0);const R=T.get();if(R!==void 0&&!T.isAnimating()&&!Array.isArray(S)&&S===R&&!k.velocity){xs.update(()=>T.set(S));continue}let I=!1;if(window.MotionHandoffAnimation){const W=k1(n);if(W){const U=window.MotionHandoffAnimation(W,j,xs);U!==null&&(k.startTime=U,I=!0)}}cp(n,j);const M=p??n.shouldReduceMotion;T.start(Jp(j,T,S,M&&N1.has(j)?{type:!1}:k,n,I));const G=T.animation;G&&b.push(G)}if(u){const j=()=>xs.update(()=>{u&&HS(n,u)});b.length?Promise.all(b).then(j):j()}return b}function dp(n,s,r={}){const i=_i(n,s,r.type==="exit"?n.presenceContext?.custom:void 0);let{transition:o=n.getDefaultTransition()||{}}=i||{};r.transitionOverride&&(o=r.transitionOverride);const d=i?()=>Promise.all(S1(n,i,r)):()=>Promise.resolve(),u=n.variantChildren&&n.variantChildren.size?(f=0)=>{const{delayChildren:p=0,staggerChildren:y,staggerDirection:b}=o;return XS(n,s,f,p,y,b,r)}:()=>Promise.resolve(),{when:h}=o;if(h){const[f,p]=h==="beforeChildren"?[d,u]:[u,d];return f().then(()=>p())}else return Promise.all([d(),u(r.delay)])}function XS(n,s,r=0,i=0,o=0,d=1,u){const h=[];for(const f of n.variantChildren)f.notify("AnimationStart",s),h.push(dp(f,s,{...u,delay:r+(typeof i=="function"?0:i)+b1(n.variantChildren,f,i,o,d)}).then(()=>f.notify("AnimationComplete",s)));return Promise.all(h)}function YS(n,s,r={}){n.notify("AnimationStart",s);let i;if(Array.isArray(s)){const o=s.map(d=>dp(n,d,r));i=Promise.all(o)}else if(typeof s=="string")i=dp(n,s,r);else{const o=typeof s=="function"?_i(n,s,r.custom):s;i=Promise.all(S1(n,o,r))}return i.then(()=>{n.notify("AnimationComplete",s)})}const WS={test:n=>n==="auto",parse:n=>n},C1=n=>s=>s.test(n),T1=[so,dt,_a,fr,N2,j2,WS],vb=n=>T1.find(C1(n));function QS(n){return typeof n=="number"?n===0:n!==null?n==="none"||n==="0"||Uj(n):!0}const ZS=new Set(["brightness","contrast","saturate","opacity"]);function JS(n){const[s,r]=n.slice(0,-1).split("(");if(s==="drop-shadow")return n;const[i]=r.match(Gp)||[];if(!i)return n;const o=r.replace(i,"");let d=ZS.has(s)?1:0;return i!==r&&(d*=100),s+"("+d+o+")"}const eC=/\b([a-z-]*)\(.*?\)/gu,up={...ja,getAnimatableNone:n=>{const s=n.match(eC);return s?s.map(JS).join(" "):n}},hp={...ja,getAnimatableNone:n=>{const s=ja.parse(n);return ja.createTransformer(n)(s.map(i=>typeof i=="number"?0:typeof i=="object"?{...i,alpha:1}:i))}},jb={...so,transform:Math.round},tC={rotate:fr,pathRotation:fr,rotateX:fr,rotateY:fr,rotateZ:fr,scale:Qd,scaleX:Qd,scaleY:Qd,scaleZ:Qd,skew:fr,skewX:fr,skewY:fr,distance:dt,translateX:dt,translateY:dt,translateZ:dt,x:dt,y:dt,z:dt,perspective:dt,transformPerspective:dt,opacity:yc,originX:lb,originY:lb,originZ:dt},Mu={borderWidth:dt,borderTopWidth:dt,borderRightWidth:dt,borderBottomWidth:dt,borderLeftWidth:dt,borderRadius:dt,borderTopLeftRadius:dt,borderTopRightRadius:dt,borderBottomRightRadius:dt,borderBottomLeftRadius:dt,width:dt,maxWidth:dt,height:dt,maxHeight:dt,top:dt,right:dt,bottom:dt,left:dt,inset:dt,insetBlock:dt,insetBlockStart:dt,insetBlockEnd:dt,insetInline:dt,insetInlineStart:dt,insetInlineEnd:dt,padding:dt,paddingTop:dt,paddingRight:dt,paddingBottom:dt,paddingLeft:dt,paddingBlock:dt,paddingBlockStart:dt,paddingBlockEnd:dt,paddingInline:dt,paddingInlineStart:dt,paddingInlineEnd:dt,margin:dt,marginTop:dt,marginRight:dt,marginBottom:dt,marginLeft:dt,marginBlock:dt,marginBlockStart:dt,marginBlockEnd:dt,marginInline:dt,marginInlineStart:dt,marginInlineEnd:dt,fontSize:dt,backgroundPositionX:dt,backgroundPositionY:dt,...tC,zIndex:jb,fillOpacity:yc,strokeOpacity:yc,numOctaves:jb},sC={...Mu,color:Us,backgroundColor:Us,outlineColor:Us,fill:Us,stroke:Us,borderColor:Us,borderTopColor:Us,borderRightColor:Us,borderBottomColor:Us,borderLeftColor:Us,filter:up,WebkitFilter:up,mask:hp,WebkitMask:hp},A1=n=>sC[n],nC=new Set([up,hp]);function M1(n,s){let r=A1(n);return nC.has(r)||(r=ja),r.getAnimatableNone?r.getAnimatableNone(s):void 0}const aC=new Set(["auto","none","0"]);function rC(n,s,r){let i=0,o;for(;i<n.length&&!o;){const d=n[i];typeof d=="string"&&!aC.has(d)&&Ql(d).values.length&&(o=n[i]),i++}if(o&&r)for(const d of s)n[d]=M1(r,o)}class iC extends Qp{constructor(s,r,i,o,d){super(s,r,i,o,d,!0)}readKeyframes(){const{unresolvedKeyframes:s,element:r,name:i}=this;if(!r||!r.current)return;super.readKeyframes();for(let y=0;y<s.length;y++){let b=s[y];if(typeof b=="string"&&(b=b.trim(),Fp(b))){const v=j1(b,r.current);v!==void 0&&(s[y]=v),y===s.length-1&&(this.finalKeyframe=b)}}if(this.resolveNoneKeyframes(),!N1.has(i)||s.length!==2)return;const[o,d]=s,u=vb(o),h=vb(d),f=ib(o),p=ib(d);if(f!==p&&Jr[i]){this.needsMeasurement=!0;return}if(u!==h)if(pb(u)&&pb(h))for(let y=0;y<s.length;y++){const b=s[y];typeof b=="string"&&(s[y]=parseFloat(b))}else Jr[i]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:s,name:r}=this,i=[];for(let o=0;o<s.length;o++)(s[o]===null||QS(s[o]))&&i.push(o);i.length&&rC(s,i,r)}measureInitialState(){const{element:s,unresolvedKeyframes:r,name:i}=this;if(!s||!s.current)return;i==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Jr[i](s.measureViewportBox(),window.getComputedStyle(s.current)),r[0]=this.measuredOrigin;const o=r[r.length-1];o!==void 0&&s.getValue(i,o).jump(o,!1)}measureEndState(){const{element:s,name:r,unresolvedKeyframes:i}=this;if(!s||!s.current)return;const o=s.getValue(r);o&&o.jump(this.measuredOrigin,!1);const d=i.length-1,u=i[d];i[d]=Jr[r](s.measureViewportBox(),window.getComputedStyle(s.current)),u!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=u),this.removedTransforms?.length&&this.removedTransforms.forEach(([h,f])=>{s.getValue(h).set(f)}),this.resolveNoneKeyframes()}}function E1(n,s,r){if(n==null)return[];if(n instanceof EventTarget)return[n];if(typeof n=="string"){let i=document;const o=r?.[n]??i.querySelectorAll(n);return o?Array.from(o):[]}return Array.from(n).filter(i=>i!=null)}const mp=(n,s)=>s&&typeof n=="number"?s.transform(n):n;function hu(n){return zj(n)&&"offsetHeight"in n&&!("ownerSVGElement"in n)}const{schedule:sx}=Qj(queueMicrotask,!1),ba={x:!1,y:!1};function I1(){return ba.x||ba.y}function lC(n){return n==="x"||n==="y"?ba[n]?null:(ba[n]=!0,()=>{ba[n]=!1}):ba.x||ba.y?null:(ba.x=ba.y=!0,()=>{ba.x=ba.y=!1})}function R1(n,s){const r=E1(n),i=new AbortController,o={passive:!0,...s,signal:i.signal};return[r,o,()=>i.abort()]}function oC(n){return!(n.pointerType==="touch"||I1())}function cC(n,s,r={}){const[i,o,d]=R1(n,r);return i.forEach(u=>{let h=!1,f=!1,p;const y=()=>{u.removeEventListener("pointerleave",j)},b=S=>{p&&(p(S),p=void 0),y()},v=S=>{h=!1,window.removeEventListener("pointerup",v),window.removeEventListener("pointercancel",v),f&&(f=!1,b(S))},N=()=>{h=!0,window.addEventListener("pointerup",v,o),window.addEventListener("pointercancel",v,o)},j=S=>{if(S.pointerType!=="touch"){if(h){f=!0;return}b(S)}},T=S=>{if(!oC(S))return;f=!1;const k=s(u,S);typeof k=="function"&&(p=k,u.addEventListener("pointerleave",j,o))};u.addEventListener("pointerenter",T,o),u.addEventListener("pointerdown",N,o)}),d}const D1=(n,s)=>s?n===s?!0:D1(n,s.parentElement):!1,nx=n=>n.pointerType==="mouse"?typeof n.button!="number"||n.button<=0:n.isPrimary!==!1,dC=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function uC(n){return dC.has(n.tagName)||n.isContentEditable===!0}const hC=new Set(["INPUT","SELECT","TEXTAREA"]);function mC(n){return hC.has(n.tagName)||n.isContentEditable===!0}const mu=new WeakSet;function Nb(n){return s=>{s.key==="Enter"&&n(s)}}function of(n,s){n.dispatchEvent(new PointerEvent("pointer"+s,{isPrimary:!0,bubbles:!0}))}const fC=(n,s)=>{const r=n.currentTarget;if(!r)return;const i=Nb(()=>{if(mu.has(r))return;of(r,"down");const o=Nb(()=>{of(r,"up")}),d=()=>of(r,"cancel");r.addEventListener("keyup",o,s),r.addEventListener("blur",d,s)});r.addEventListener("keydown",i,s),r.addEventListener("blur",()=>r.removeEventListener("keydown",i),s)};function wb(n){return nx(n)&&!I1()}const kb=new WeakSet;function pC(n,s,r={}){const[i,o,d]=R1(n,r),u=h=>{const f=h.currentTarget;if(!wb(h)||kb.has(h))return;mu.add(f),r.stopPropagation&&kb.add(h);const p=s(f,h),y=(N,j)=>{window.removeEventListener("pointerup",b),window.removeEventListener("pointercancel",v),mu.has(f)&&mu.delete(f),wb(N)&&typeof p=="function"&&p(N,{success:j})},b=N=>{y(N,f===window||f===document||r.useGlobalTarget||D1(f,N.target))},v=N=>{y(N,!1)};window.addEventListener("pointerup",b,o),window.addEventListener("pointercancel",v,o)};return i.forEach(h=>{(r.useGlobalTarget?window:h).addEventListener("pointerdown",u,o),hu(h)&&(h.addEventListener("focus",p=>fC(p,o)),!uC(h)&&!h.hasAttribute("tabindex")&&(h.tabIndex=0))}),d}function ax(n){return zj(n)&&"ownerSVGElement"in n}const fu=new WeakMap;let pu;const P1=(n,s,r)=>(i,o)=>o&&o[0]?o[0][n+"Size"]:ax(i)&&"getBBox"in i?i.getBBox()[s]:i[r],xC=P1("inline","width","offsetWidth"),gC=P1("block","height","offsetHeight");function yC({target:n,borderBoxSize:s}){fu.get(n)?.forEach(r=>{r(n,{get width(){return xC(n,s)},get height(){return gC(n,s)}})})}function bC(n){n.forEach(yC)}function vC(){typeof ResizeObserver>"u"||(pu=new ResizeObserver(bC))}function jC(n,s){pu||vC();const r=E1(n);return r.forEach(i=>{let o=fu.get(i);o||(o=new Set,fu.set(i,o)),o.add(s),pu?.observe(i)}),()=>{r.forEach(i=>{const o=fu.get(i);o?.delete(s),o?.size||pu?.unobserve(i)})}}const xu=new Set;let Hl;function NC(){Hl=()=>{const n={get width(){return window.innerWidth},get height(){return window.innerHeight}};xu.forEach(s=>s(n))},window.addEventListener("resize",Hl)}function wC(n){return xu.add(n),Hl||NC(),()=>{xu.delete(n),!xu.size&&typeof Hl=="function"&&(window.removeEventListener("resize",Hl),Hl=void 0)}}function Sb(n,s){return typeof n=="function"?wC(n):jC(n,s)}function kC(n){return ax(n)&&n.tagName==="svg"}const SC=[...T1,Us,ja],CC=n=>SC.find(C1(n)),Cb=()=>({translate:0,scale:1,origin:0,originPoint:0}),Fl=()=>({x:Cb(),y:Cb()}),Tb=()=>({min:0,max:0}),_s=()=>({x:Tb(),y:Tb()}),TC=new WeakMap;function Ku(n){return n!==null&&typeof n=="object"&&typeof n.start=="function"}function bc(n){return typeof n=="string"||Array.isArray(n)}const rx=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],ix=["initial",...rx];function Hu(n){return Ku(n.animate)||ix.some(s=>bc(n[s]))}function L1(n){return!!(Hu(n)||n.variants)}function AC(n,s,r){for(const i in s){const o=s[i],d=r[i];if(rn(o))n.addValue(i,o);else if(rn(d))n.addValue(i,Zl(o,{owner:n}));else if(d!==o)if(n.hasValue(i)){const u=n.getValue(i);u.liveStyle===!0?u.jump(o):u.hasAnimated||u.set(o)}else{const u=n.getStaticValue(i);n.addValue(i,Zl(u!==void 0?u:o,{owner:n}))}}for(const i in r)s[i]===void 0&&n.removeValue(i);return s}const fp={current:null},O1={current:!1},MC=typeof window<"u";function EC(){if(O1.current=!0,!!MC)if(window.matchMedia){const n=window.matchMedia("(prefers-reduced-motion)"),s=()=>fp.current=n.matches;n.addEventListener("change",s),s()}else fp.current=!1}const Ab=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Eu={};function z1(n){Eu=n}function IC(){return Eu}class RC{scrapeMotionValuesFromProps(s,r,i){return{}}constructor({parent:s,props:r,presenceContext:i,reducedMotionConfig:o,skipAnimations:d,blockInitialAnimation:u,visualState:h},f={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Qp,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const N=yn.now();this.renderScheduledAt<N&&(this.renderScheduledAt=N,xs.render(this.render,!1,!0))};const{latestValues:p,renderState:y}=h;this.latestValues=p,this.baseTarget={...p},this.initialValues=r.initial?{...p}:{},this.renderState=y,this.parent=s,this.props=r,this.presenceContext=i,this.depth=s?s.depth+1:0,this.reducedMotionConfig=o,this.skipAnimationsConfig=d,this.options=f,this.blockInitialAnimation=!!u,this.isControllingVariants=Hu(r),this.isVariantNode=L1(r),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(s&&s.current);const{willChange:b,...v}=this.scrapeMotionValuesFromProps(r,{},this);for(const N in v){const j=v[N];p[N]!==void 0&&rn(j)&&j.set(p[N])}}mount(s){if(this.hasBeenMounted)for(const r in this.initialValues)this.values.get(r)?.jump(this.initialValues[r]),this.latestValues[r]=this.initialValues[r];this.current=s,TC.set(s,this),this.projection&&!this.projection.instance&&this.projection.mount(s),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((r,i)=>this.bindToMotionValue(i,r)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(O1.current||EC(),this.shouldReduceMotion=fp.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),ni(this.notifyUpdate),ni(this.render),this.valueSubscriptions.forEach(s=>s()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const s in this.events)this.events[s].clear();for(const s in this.features){const r=this.features[s];r&&(r.unmount(),r.isMounted=!1)}this.current=null}addChild(s){this.children.add(s),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(s)}removeChild(s){this.children.delete(s),this.enteringChildren&&this.enteringChildren.delete(s)}bindToMotionValue(s,r){if(this.valueSubscriptions.has(s)&&this.valueSubscriptions.get(s)(),r.accelerate&&y1.has(s)&&this.current instanceof HTMLElement){const{factory:u,keyframes:h,times:f,ease:p,duration:y}=r.accelerate,b=new x1({element:this.current,name:s,keyframes:h,times:f,ease:p,duration:Hn(y)}),v=u(b);this.valueSubscriptions.set(s,()=>{v(),b.cancel()});return}const i=ao.has(s);i&&this.onBindTransform&&this.onBindTransform();const o=r.on("change",u=>{this.latestValues[s]=u,this.props.onUpdate&&xs.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let d;typeof window<"u"&&window.MotionCheckAppearSync&&(d=window.MotionCheckAppearSync(this,s,r)),this.valueSubscriptions.set(s,()=>{o(),d&&d()})}sortNodePosition(s){return!this.current||!this.sortInstanceNodePosition||this.type!==s.type?0:this.sortInstanceNodePosition(this.current,s.current)}updateFeatures(){let s="animation";for(s in Eu){const r=Eu[s];if(!r)continue;const{isEnabled:i,Feature:o}=r;if(!this.features[s]&&o&&i(this.props)&&(this.features[s]=new o(this)),this.features[s]){const d=this.features[s];d.isMounted?d.update():(d.mount(),d.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):_s()}getStaticValue(s){return this.latestValues[s]}setStaticValue(s,r){this.latestValues[s]=r}update(s,r){(s.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=s,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let i=0;i<Ab.length;i++){const o=Ab[i];this.propEventSubscriptions[o]&&(this.propEventSubscriptions[o](),delete this.propEventSubscriptions[o]);const d="on"+o,u=s[d];u&&(this.propEventSubscriptions[o]=this.on(o,u))}this.prevMotionValues=AC(this,this.scrapeMotionValuesFromProps(s,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(s){return this.props.variants?this.props.variants[s]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(s){const r=this.getClosestVariantNode();if(r)return r.variantChildren&&r.variantChildren.add(s),()=>r.variantChildren.delete(s)}addValue(s,r){const i=this.values.get(s);r!==i&&(i&&this.removeValue(s),this.bindToMotionValue(s,r),this.values.set(s,r),this.latestValues[s]=r.get())}removeValue(s){this.values.delete(s);const r=this.valueSubscriptions.get(s);r&&(r(),this.valueSubscriptions.delete(s)),delete this.latestValues[s],this.removeValueFromRenderState(s,this.renderState)}hasValue(s){return this.values.has(s)}getValue(s,r){if(this.props.values&&this.props.values[s])return this.props.values[s];let i=this.values.get(s);return i===void 0&&r!==void 0&&(i=Zl(r===null?void 0:r,{owner:this}),this.addValue(s,i)),i}readValue(s,r){let i=this.latestValues[s]!==void 0||!this.current?this.latestValues[s]:this.getBaseTargetFromProps(this.props,s)??this.readValueFromInstance(this.current,s,this.options);return i!=null&&(typeof i=="string"&&(Oj(i)||Uj(i))?i=parseFloat(i):!CC(i)&&ja.test(r)&&(i=M1(s,r)),this.setBaseTarget(s,rn(i)?i.get():i)),rn(i)?i.get():i}setBaseTarget(s,r){this.baseTarget[s]=r}getBaseTarget(s){const{initial:r}=this.props;let i;if(typeof r=="string"||typeof r=="object"){const d=ex(this.props,r,this.presenceContext?.custom);d&&(i=d[s])}if(r&&i!==void 0)return i;const o=this.getBaseTargetFromProps(this.props,s);return o!==void 0&&!rn(o)?o:this.initialValues[s]!==void 0&&i===void 0?void 0:this.baseTarget[s]}on(s,r){return this.events[s]||(this.events[s]=new Vp),this.events[s].add(r)}notify(s,...r){this.events[s]&&this.events[s].notify(...r)}scheduleRenderMicrotask(){sx.render(this.render)}}class U1 extends RC{constructor(){super(...arguments),this.KeyframeResolver=iC}sortInstanceNodePosition(s,r){return s.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(s,r){const i=s.style;return i?i[r]:void 0}removeValueFromRenderState(s,{vars:r,style:i}){delete r[s],delete i[s]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:s}=this.props;rn(s)&&(this.childSubscription=s.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}class li{constructor(s){this.isMounted=!1,this.node=s}update(){}}function $1({top:n,left:s,right:r,bottom:i}){return{x:{min:s,max:r},y:{min:n,max:i}}}function DC({x:n,y:s}){return{top:s.min,right:n.max,bottom:s.max,left:n.min}}function PC(n,s){if(!s)return n;const r=s({x:n.left,y:n.top}),i=s({x:n.right,y:n.bottom});return{top:r.y,left:r.x,bottom:i.y,right:i.x}}function cf(n){return n===void 0||n===1}function pp({scale:n,scaleX:s,scaleY:r}){return!cf(n)||!cf(s)||!cf(r)}function Di(n){return pp(n)||B1(n)||n.z||n.rotate||n.rotateX||n.rotateY||n.skewX||n.skewY}function B1(n){return Mb(n.x)||Mb(n.y)}function Mb(n){return n&&n!=="0%"}function Iu(n,s,r){const i=n-r,o=s*i;return r+o}function Eb(n,s,r,i,o){return o!==void 0&&(n=Iu(n,o,i)),Iu(n,r,i)+s}function xp(n,s=0,r=1,i,o){n.min=Eb(n.min,s,r,i,o),n.max=Eb(n.max,s,r,i,o)}function _1(n,{x:s,y:r}){xp(n.x,s.translate,s.scale,s.originPoint),xp(n.y,r.translate,r.scale,r.originPoint)}const Ib=.999999999999,Rb=1.0000000000001;function LC(n,s,r,i=!1){const o=r.length;if(!o)return;s.x=s.y=1;let d,u;for(let h=0;h<o;h++){d=r[h],u=d.projectionDelta;const{visualElement:f}=d.options;f&&f.props.style&&f.props.style.display==="contents"||(i&&d.options.layoutScroll&&d.scroll&&d!==d.root&&(Ua(n.x,-d.scroll.offset.x),Ua(n.y,-d.scroll.offset.y)),u&&(s.x*=u.x.scale,s.y*=u.y.scale,_1(n,u)),i&&Di(d.latestValues)&&gu(n,d.latestValues,d.layout?.layoutBox))}s.x<Rb&&s.x>Ib&&(s.x=1),s.y<Rb&&s.y>Ib&&(s.y=1)}function Ua(n,s){n.min+=s,n.max+=s}function Db(n,s,r,i,o=.5){const d=ps(n.min,n.max,o);xp(n,s,r,d,i)}function Pb(n,s){return typeof n=="string"?parseFloat(n)/100*(s.max-s.min):n}function gu(n,s,r){const i=r??n;Db(n.x,Pb(s.x,i.x),s.scaleX,s.scale,s.originX),Db(n.y,Pb(s.y,i.y),s.scaleY,s.scale,s.originY)}function V1(n,s){return $1(PC(n.getBoundingClientRect(),s))}function OC(n,s,r){const i=V1(n,r),{scroll:o}=s;return o&&(Ua(i.x,o.offset.x),Ua(i.y,o.offset.y)),i}const zC={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},UC=no.length;function $C(n,s,r){let i="",o=!0;for(let u=0;u<UC;u++){const h=no[u],f=n[h];if(f===void 0)continue;let p=!0;if(typeof f=="number")p=f===(h.startsWith("scale")?1:0);else{const y=parseFloat(f);p=h.startsWith("scale")?y===1:y===0}if(!p||r){const y=mp(f,Mu[h]);if(!p){o=!1;const b=zC[h]||h;i+=`${b}(${y}) `}r&&(s[h]=y)}}const d=n.pathRotation;return d&&(o=!1,i+=`rotate(${mp(d,Mu.pathRotation)}) `),i=i.trim(),r?i=r(s,o?"":i):o&&(i="none"),i}function lx(n,s,r){const{style:i,vars:o,transformOrigin:d}=n;let u=!1,h=!1;for(const f in s){const p=s[f];if(ao.has(f)){u=!0;continue}else if(Jj(f)){o[f]=p;continue}else{const y=mp(p,Mu[f]);f.startsWith("origin")?(h=!0,d[f]=y):i[f]=y}}if(s.transform||(u||r?i.transform=$C(s,n.transform,r):i.transform&&(i.transform="none")),h){const{originX:f="50%",originY:p="50%",originZ:y=0}=d;i.transformOrigin=`${f} ${p} ${y}`}}function K1(n,{style:s,vars:r},i,o){const d=n.style;let u;for(u in s)d[u]=s[u];o?.applyProjectionStyles(d,i);for(u in r)d.setProperty(u,r[u])}function Lb(n,s){return s.max===s.min?0:n/(s.max-s.min)*100}const Jo={correct:(n,s)=>{if(!s.target)return n;if(typeof n=="string")if(dt.test(n))n=parseFloat(n);else return n;const r=Lb(n,s.target.x),i=Lb(n,s.target.y);return`${r}% ${i}%`}},BC={correct:(n,{treeScale:s,projectionDelta:r})=>{const i=n,o=ja.parse(n);if(o.length>5)return i;const d=ja.createTransformer(n),u=typeof o[0]!="number"?1:0,h=r.x.scale*s.x,f=r.y.scale*s.y;o[0+u]/=h,o[1+u]/=f;const p=ps(h,f,.5);return typeof o[2+u]=="number"&&(o[2+u]/=p),typeof o[3+u]=="number"&&(o[3+u]/=p),d(o)}},gp={borderRadius:{...Jo,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Jo,borderTopRightRadius:Jo,borderBottomLeftRadius:Jo,borderBottomRightRadius:Jo,boxShadow:BC};function H1(n,{layout:s,layoutId:r}){return ao.has(n)||n.startsWith("origin")||(s||r!==void 0)&&(!!gp[n]||n==="opacity")}function ox(n,s,r){const i=n.style,o=s?.style,d={};if(!i)return d;for(const u in i)(rn(i[u])||o&&rn(o[u])||H1(u,n)||r?.getValue(u)?.liveStyle!==void 0)&&(d[u]=i[u]);return d}function _C(n){return window.getComputedStyle(n)}class VC extends U1{constructor(){super(...arguments),this.type="html",this.renderInstance=K1}readValueFromInstance(s,r){if(ao.has(r))return this.projection?.isProjecting?sp(r):oS(s,r);{const i=_C(s),o=(Jj(r)?i.getPropertyValue(r):i[r])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(s,{transformPagePoint:r}){return V1(s,r)}build(s,r,i){lx(s,r,i.transformTemplate)}scrapeMotionValuesFromProps(s,r,i){return ox(s,r,i)}}const KC={offset:"stroke-dashoffset",array:"stroke-dasharray"},HC={offset:"strokeDashoffset",array:"strokeDasharray"};function FC(n,s,r=1,i=0,o=!0){n.pathLength=1;const d=o?KC:HC;n[d.offset]=`${-i}`,n[d.array]=`${s} ${r}`}const GC=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function F1(n,{attrX:s,attrY:r,attrScale:i,pathLength:o,pathSpacing:d=1,pathOffset:u=0,...h},f,p,y){if(lx(n,h,p),f){n.style.viewBox&&(n.attrs.viewBox=n.style.viewBox);return}n.attrs=n.style,n.style={};const{attrs:b,style:v}=n;b.transform&&(v.transform=b.transform,delete b.transform),(v.transform||b.transformOrigin)&&(v.transformOrigin=b.transformOrigin??"50% 50%",delete b.transformOrigin),v.transform&&(v.transformBox=y?.transformBox??"fill-box",delete b.transformBox);for(const N of GC)b[N]!==void 0&&(v[N]=b[N],delete b[N]);s!==void 0&&(b.x=s),r!==void 0&&(b.y=r),i!==void 0&&(b.scale=i),o!==void 0&&FC(b,o,d,u,!1)}const G1=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),q1=n=>typeof n=="string"&&n.toLowerCase()==="svg";function qC(n,s,r,i){K1(n,s,void 0,i);for(const o in s.attrs)n.setAttribute(G1.has(o)?o:tx(o),s.attrs[o])}function X1(n,s,r){const i=ox(n,s,r);for(const o in n)if(rn(n[o])||rn(s[o])){const d=no.indexOf(o)!==-1?"attr"+o.charAt(0).toUpperCase()+o.substring(1):o;i[d]=n[o]}return i}class XC extends U1{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=_s}getBaseTargetFromProps(s,r){return s[r]}readValueFromInstance(s,r){if(ao.has(r)){const i=A1(r);return i&&i.default||0}return r=G1.has(r)?r:tx(r),s.getAttribute(r)}scrapeMotionValuesFromProps(s,r,i){return X1(s,r,i)}build(s,r,i){F1(s,r,this.isSVGTag,i.transformTemplate,i.style)}renderInstance(s,r,i,o){qC(s,r,i,o)}mount(s){this.isSVGTag=q1(s.tagName),super.mount(s)}}const YC=ix.length;function Y1(n){if(!n)return;if(!n.isControllingVariants){const r=n.parent?Y1(n.parent)||{}:{};return n.props.initial!==void 0&&(r.initial=n.props.initial),r}const s={};for(let r=0;r<YC;r++){const i=ix[r],o=n.props[i];(bc(o)||o===!1)&&(s[i]=o)}return s}function W1(n,s){if(!Array.isArray(s))return!1;const r=s.length;if(r!==n.length)return!1;for(let i=0;i<r;i++)if(s[i]!==n[i])return!1;return!0}const WC=[...rx].reverse(),QC=rx.length;function ZC(n){return s=>Promise.all(s.map(({animation:r,options:i})=>YS(n,r,i)))}function JC(n){let s=ZC(n),r=Ob(),i=!0,o=!1;const d=p=>(y,b)=>{const v=_i(n,b,p==="exit"?n.presenceContext?.custom:void 0);if(v){const{transition:N,transitionEnd:j,...T}=v;y={...y,...T,...j}}return y};function u(p){s=p(n)}function h(p){const{props:y}=n,b=Y1(n.parent)||{},v=[],N=new Set;let j={},T=1/0;for(let k=0;k<QC;k++){const R=WC[k],I=r[R],M=y[R]!==void 0?y[R]:b[R],G=bc(M),W=R===p?I.isActive:null;W===!1&&(T=k);let U=M===b[R]&&M!==y[R]&&G;if(U&&(i||o)&&n.manuallyAnimateOnMount&&(U=!1),I.protectedKeys={...j},!I.isActive&&W===null||!M&&!I.prevProp||Ku(M)||typeof M=="boolean")continue;if(R==="exit"&&I.isActive&&W!==!0){I.prevResolvedValues&&(j={...j,...I.prevResolvedValues});continue}const q=eT(I.prevProp,M);let V=q||R===p&&I.isActive&&!U&&G||k>T&&G,le=!1;const B=Array.isArray(M)?M:[M];let be=B.reduce(d(R),{});W===!1&&(be={});const{prevResolvedValues:K={}}=I,se={...K,...be},te=F=>{V=!0,N.has(F)&&(le=!0,N.delete(F)),I.needsAnimating[F]=!0;const fe=n.getValue(F);fe&&(fe.liveStyle=!1)};for(const F in se){const fe=be[F],pe=K[F];if(j.hasOwnProperty(F))continue;let C=!1;op(fe)&&op(pe)?C=!W1(fe,pe)||q:C=fe!==pe,C?fe!=null?te(F):N.add(F):fe!==void 0&&N.has(F)?te(F):I.protectedKeys[F]=!0}I.prevProp=M,I.prevResolvedValues=be,I.isActive&&(j={...j,...be}),(i||o)&&n.blockInitialAnimation&&(V=!1);const Y=U&&q;V&&(!Y||le)&&v.push(...B.map(F=>{const fe={type:R};if(typeof F=="string"&&(i||o)&&!Y&&n.manuallyAnimateOnMount&&n.parent){const{parent:pe}=n,C=_i(pe,F);if(pe.enteringChildren&&C){const{delayChildren:z}=C.transition||{};fe.delay=b1(pe.enteringChildren,n,z)}}return{animation:F,options:fe}}))}if(N.size){const k={};if(typeof y.initial!="boolean"){const R=_i(n,Array.isArray(y.initial)?y.initial[0]:y.initial);R&&R.transition&&(k.transition=R.transition)}N.forEach(R=>{const I=n.getBaseTarget(R),M=n.getValue(R);M&&(M.liveStyle=!0),k[R]=I??null}),v.push({animation:k})}let S=!!v.length;return i&&(y.initial===!1||y.initial===y.animate)&&!n.manuallyAnimateOnMount&&(S=!1),i=!1,o=!1,S?s(v):Promise.resolve()}function f(p,y){if(r[p].isActive===y)return Promise.resolve();n.variantChildren?.forEach(v=>v.animationState?.setActive(p,y)),r[p].isActive=y;const b=h(p);for(const v in r)r[v].protectedKeys={};return b}return{animateChanges:h,setActive:f,setAnimateFunction:u,getState:()=>r,reset:()=>{r=Ob(),o=!0}}}function eT(n,s){return typeof s=="string"?s!==n:Array.isArray(s)?!W1(s,n):!1}function Ti(n=!1){return{isActive:n,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Ob(){return{animate:Ti(!0),whileInView:Ti(),whileHover:Ti(),whileTap:Ti(),whileDrag:Ti(),whileFocus:Ti(),exit:Ti()}}function yp(n,s){n.min=s.min,n.max=s.max}function xa(n,s){yp(n.x,s.x),yp(n.y,s.y)}function zb(n,s){n.translate=s.translate,n.scale=s.scale,n.originPoint=s.originPoint,n.origin=s.origin}const Q1=1e-4,tT=1-Q1,sT=1+Q1,Z1=.01,nT=0-Z1,aT=0+Z1;function bn(n){return n.max-n.min}function rT(n,s,r){return Math.abs(n-s)<=r}function Ub(n,s,r,i=.5){n.origin=i,n.originPoint=ps(s.min,s.max,n.origin),n.scale=bn(r)/bn(s),n.translate=ps(r.min,r.max,n.origin)-n.originPoint,(n.scale>=tT&&n.scale<=sT||isNaN(n.scale))&&(n.scale=1),(n.translate>=nT&&n.translate<=aT||isNaN(n.translate))&&(n.translate=0)}function mc(n,s,r,i){Ub(n.x,s.x,r.x,i?i.originX:void 0),Ub(n.y,s.y,r.y,i?i.originY:void 0)}function $b(n,s,r,i=0){const o=i?ps(r.min,r.max,i):r.min;n.min=o+s.min,n.max=n.min+bn(s)}function iT(n,s,r,i){$b(n.x,s.x,r.x,i?.x),$b(n.y,s.y,r.y,i?.y)}function Bb(n,s,r,i=0){const o=i?ps(r.min,r.max,i):r.min;n.min=s.min-o,n.max=n.min+bn(s)}function Ru(n,s,r,i){Bb(n.x,s.x,r.x,i?.x),Bb(n.y,s.y,r.y,i?.y)}function _b(n,s,r,i,o){return n-=s,n=Iu(n,1/r,i),o!==void 0&&(n=Iu(n,1/o,i)),n}function lT(n,s=0,r=1,i=.5,o,d=n,u=n){if(_a.test(s)&&(s=parseFloat(s),s=ps(u.min,u.max,s/100)-u.min),typeof s!="number")return;let h=ps(d.min,d.max,i);n===d&&(h-=s),n.min=_b(n.min,s,r,h,o),n.max=_b(n.max,s,r,h,o)}function Vb(n,s,[r,i,o],d,u){lT(n,s[r],s[i],s[o],s.scale,d,u)}const oT=["x","scaleX","originX"],cT=["y","scaleY","originY"];function Kb(n,s,r,i){Vb(n.x,s,oT,r?r.x:void 0,i?i.x:void 0),Vb(n.y,s,cT,r?r.y:void 0,i?i.y:void 0)}function Hb(n){return n.translate===0&&n.scale===1}function J1(n){return Hb(n.x)&&Hb(n.y)}function Fb(n,s){return n.min===s.min&&n.max===s.max}function dT(n,s){return Fb(n.x,s.x)&&Fb(n.y,s.y)}function Gb(n,s){return Math.round(n.min)===Math.round(s.min)&&Math.round(n.max)===Math.round(s.max)}function eN(n,s){return Gb(n.x,s.x)&&Gb(n.y,s.y)}function qb(n){return bn(n.x)/bn(n.y)}function Xb(n,s){return n.translate===s.translate&&n.scale===s.scale&&n.originPoint===s.originPoint}function La(n){return[n("x"),n("y")]}function uT(n,s,r){let i="";const o=n.x.translate/s.x,d=n.y.translate/s.y,u=r?.z||0;if((o||d||u)&&(i=`translate3d(${o}px, ${d}px, ${u}px) `),(s.x!==1||s.y!==1)&&(i+=`scale(${1/s.x}, ${1/s.y}) `),r){const{transformPerspective:p,rotate:y,pathRotation:b,rotateX:v,rotateY:N,skewX:j,skewY:T}=r;p&&(i=`perspective(${p}px) ${i}`),y&&(i+=`rotate(${y}deg) `),b&&(i+=`rotate(${b}deg) `),v&&(i+=`rotateX(${v}deg) `),N&&(i+=`rotateY(${N}deg) `),j&&(i+=`skewX(${j}deg) `),T&&(i+=`skewY(${T}deg) `)}const h=n.x.scale*s.x,f=n.y.scale*s.y;return(h!==1||f!==1)&&(i+=`scale(${h}, ${f})`),i||"none"}const tN=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],hT=tN.length,Yb=n=>typeof n=="string"?parseFloat(n):n,Wb=n=>typeof n=="number"||dt.test(n);function mT(n,s,r,i,o,d){o?(n.opacity=ps(0,r.opacity??1,fT(i)),n.opacityExit=ps(s.opacity??1,0,pT(i))):d&&(n.opacity=ps(s.opacity??1,r.opacity??1,i));for(let u=0;u<hT;u++){const h=tN[u];let f=Qb(s,h),p=Qb(r,h);if(f===void 0&&p===void 0)continue;f||(f=0),p||(p=0),f===0||p===0||Wb(f)===Wb(p)?(n[h]=Math.max(ps(Yb(f),Yb(p),i),0),(_a.test(p)||_a.test(f))&&(n[h]+="%")):n[h]=p}(s.rotate||r.rotate)&&(n.rotate=ps(s.rotate||0,r.rotate||0,i))}function Qb(n,s){return n[s]!==void 0?n[s]:n.borderRadius}const fT=sN(0,.5,qj),pT=sN(.5,.95,ca);function sN(n,s,r){return i=>i<n?0:i>s?1:r(gc(n,s,i))}function xT(n,s,r){const i=rn(n)?n:Zl(n);return i.start(Jp("",i,s,r)),i.animation}function vc(n,s,r,i={passive:!0}){return n.addEventListener(s,r,i),()=>n.removeEventListener(s,r)}const gT=(n,s)=>n.depth-s.depth;class yT{constructor(){this.children=[],this.isDirty=!1}add(s){Bp(this.children,s),this.isDirty=!0}remove(s){ku(this.children,s),this.isDirty=!0}forEach(s){this.isDirty&&this.children.sort(gT),this.isDirty=!1,this.children.forEach(s)}}function bT(n,s){const r=yn.now(),i=({timestamp:o})=>{const d=o-r;d>=s&&(ni(i),n(d-s))};return xs.setup(i,!0),()=>ni(i)}function yu(n){return rn(n)?n.get():n}class vT{constructor(){this.members=[]}add(s){Bp(this.members,s);for(let r=this.members.length-1;r>=0;r--){const i=this.members[r];if(i===s||i===this.lead||i===this.prevLead)continue;const o=i.instance;(!o||o.isConnected===!1)&&!i.snapshot&&(ku(this.members,i),i.unmount())}s.scheduleRender()}remove(s){if(ku(this.members,s),s===this.prevLead&&(this.prevLead=void 0),s===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(s){for(let r=this.members.indexOf(s)-1;r>=0;r--){const i=this.members[r];if(i.isPresent!==!1&&i.instance?.isConnected!==!1)return this.promote(i),!0}return!1}promote(s,r){const i=this.lead;if(s!==i&&(this.prevLead=i,this.lead=s,s.show(),i)){i.updateSnapshot(),s.scheduleRender();const{layoutDependency:o}=i.options,{layoutDependency:d}=s.options;(o===void 0||o!==d)&&(s.resumeFrom=i,r&&(i.preserveOpacity=!0),i.snapshot&&(s.snapshot=i.snapshot,s.snapshot.latestValues=i.animationValues||i.latestValues),s.root?.isUpdating&&(s.isLayoutDirty=!0)),s.options.crossfade===!1&&i.hide()}}exitAnimationComplete(){this.members.forEach(s=>{s.options.onExitComplete?.(),s.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(s=>s.instance&&s.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}}const bu={hasAnimatedSinceResize:!0,hasEverUpdated:!1},df=["","X","Y","Z"],jT=1e3;let NT=0;function uf(n,s,r,i){const{latestValues:o}=s;o[n]&&(r[n]=o[n],s.setStaticValue(n,0),i&&(i[n]=0))}function nN(n){if(n.hasCheckedOptimisedAppear=!0,n.root===n)return;const{visualElement:s}=n.options;if(!s)return;const r=k1(s);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:o,layoutId:d}=n.options;window.MotionCancelOptimisedAnimation(r,"transform",xs,!(o||d))}const{parent:i}=n;i&&!i.hasCheckedOptimisedAppear&&nN(i)}function aN({attachResizeListener:n,defaultParent:s,measureScroll:r,checkIsScrollRoot:i,resetTransform:o}){return class{constructor(u={},h=s?.()){this.id=NT++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(ST),this.nodes.forEach(IT),this.nodes.forEach(RT),this.nodes.forEach(CT)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=u,this.root=h?h.root||h:this,this.path=h?[...h.path,h]:[],this.parent=h,this.depth=h?h.depth+1:0;for(let f=0;f<this.path.length;f++)this.path[f].shouldResetTransform=!0;this.root===this&&(this.nodes=new yT)}addEventListener(u,h){return this.eventHandlers.has(u)||this.eventHandlers.set(u,new Vp),this.eventHandlers.get(u).add(h)}notifyListeners(u,...h){const f=this.eventHandlers.get(u);f&&f.notify(...h)}hasListeners(u){return this.eventHandlers.has(u)}mount(u){if(this.instance)return;this.isSVG=ax(u)&&!kC(u),this.instance=u;const{layoutId:h,layout:f,visualElement:p}=this.options;if(p&&!p.current&&p.mount(u),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(f||h)&&(this.isLayoutDirty=!0),n){let y,b=0;const v=()=>this.root.updateBlockedByResize=!1;xs.read(()=>{b=window.innerWidth}),n(u,()=>{const N=window.innerWidth;N!==b&&(b=N,this.root.updateBlockedByResize=!0,y&&y(),y=bT(v,250),bu.hasAnimatedSinceResize&&(bu.hasAnimatedSinceResize=!1,this.nodes.forEach(ev)))})}h&&this.root.registerSharedNode(h,this),this.options.animate!==!1&&p&&(h||f)&&this.addEventListener("didUpdate",({delta:y,hasLayoutChanged:b,hasRelativeLayoutChanged:v,layout:N})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const j=this.options.transition||p.getDefaultTransition()||zT,{onLayoutAnimationStart:T,onLayoutAnimationComplete:S}=p.getProps(),k=!this.targetLayout||!eN(this.targetLayout,N),R=!b&&v;if(this.options.layoutRoot||this.resumeFrom||R||b&&(k||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const I={...Zp(j,"layout"),onPlay:T,onComplete:S};(p.shouldReduceMotion||this.options.layoutRoot)&&(I.delay=0,I.type=!1),this.startAnimation(I),this.setAnimationOrigin(y,R,I.path)}else b||ev(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=N})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const u=this.getStack();u&&u.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),ni(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(DT),this.animationId++)}getTransformTemplate(){const{visualElement:u}=this.options;return u&&u.getProps().transformTemplate}willUpdate(u=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&nN(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let y=0;y<this.path.length;y++){const b=this.path[y];b.shouldResetTransform=!0,(typeof b.latestValues.x=="string"||typeof b.latestValues.y=="string")&&(b.isLayoutDirty=!0),b.updateScroll("snapshot"),b.options.layoutRoot&&b.willUpdate(!1)}const{layoutId:h,layout:f}=this.options;if(h===void 0&&!f)return;const p=this.getTransformTemplate();this.prevTransformTemplateValue=p?p(this.latestValues,""):void 0,this.updateSnapshot(),u&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const f=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),f&&this.nodes.forEach(AT),this.nodes.forEach(Zb);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Jb);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(MT),this.nodes.forEach(ET),this.nodes.forEach(wT),this.nodes.forEach(kT)):this.nodes.forEach(Jb),this.clearAllSnapshots();const h=yn.now();nn.delta=Ha(0,1e3/60,h-nn.timestamp),nn.timestamp=h,nn.isProcessing=!0,tf.update.process(nn),tf.preRender.process(nn),tf.render.process(nn),nn.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,sx.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(TT),this.sharedNodes.forEach(PT)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,xs.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){xs.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!bn(this.snapshot.measuredBox.x)&&!bn(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let f=0;f<this.path.length;f++)this.path[f].updateScroll();const u=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=_s()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:h}=this.options;h&&h.notify("LayoutMeasure",this.layout.layoutBox,u?u.layoutBox:void 0)}updateScroll(u="measure"){let h=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===u&&(h=!1),h&&this.instance){const f=i(this.instance);this.scroll={animationId:this.root.animationId,phase:u,isRoot:f,offset:r(this.instance),wasRoot:this.scroll?this.scroll.isRoot:f}}}resetTransform(){if(!o)return;const u=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,h=this.projectionDelta&&!J1(this.projectionDelta),f=this.getTransformTemplate(),p=f?f(this.latestValues,""):void 0,y=p!==this.prevTransformTemplateValue;u&&this.instance&&(h||Di(this.latestValues)||y)&&(o(this.instance,p),this.shouldResetTransform=!1,this.scheduleRender())}measure(u=!0){const h=this.measurePageBox();let f=this.removeElementScroll(h);return u&&(f=this.removeTransform(f)),UT(f),{animationId:this.root.animationId,measuredBox:h,layoutBox:f,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:u}=this.options;if(!u)return _s();const h=u.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some($T))){const{scroll:p}=this.root;p&&(Ua(h.x,p.offset.x),Ua(h.y,p.offset.y))}return h}removeElementScroll(u){const h=_s();if(xa(h,u),this.scroll?.wasRoot)return h;for(let f=0;f<this.path.length;f++){const p=this.path[f],{scroll:y,options:b}=p;p!==this.root&&y&&b.layoutScroll&&(y.wasRoot&&xa(h,u),Ua(h.x,y.offset.x),Ua(h.y,y.offset.y))}return h}applyTransform(u,h=!1,f){const p=f||_s();xa(p,u);for(let y=0;y<this.path.length;y++){const b=this.path[y];!h&&b.options.layoutScroll&&b.scroll&&b!==b.root&&(Ua(p.x,-b.scroll.offset.x),Ua(p.y,-b.scroll.offset.y)),Di(b.latestValues)&&gu(p,b.latestValues,b.layout?.layoutBox)}return Di(this.latestValues)&&gu(p,this.latestValues,this.layout?.layoutBox),p}removeTransform(u){const h=_s();xa(h,u);for(let f=0;f<this.path.length;f++){const p=this.path[f];if(!Di(p.latestValues))continue;let y;p.instance&&(pp(p.latestValues)&&p.updateSnapshot(),y=_s(),xa(y,p.measurePageBox())),Kb(h,p.latestValues,p.snapshot?.layoutBox,y)}return Di(this.latestValues)&&Kb(h,this.latestValues),h}setTargetDelta(u){this.targetDelta=u,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(u){this.options={...this.options,...u,crossfade:u.crossfade!==void 0?u.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==nn.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(u=!1){const h=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=h.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=h.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=h.isSharedProjectionDirty);const f=!!this.resumingFrom||this!==h;if(!(u||f&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:y,layoutId:b}=this.options;if(!this.layout||!(y||b))return;this.resolvedRelativeTargetAt=nn.timestamp;const v=this.getClosestProjectingParent();v&&this.linkedParentVersion!==v.layoutVersion&&!v.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&v&&v.layout?this.createRelativeTarget(v,this.layout.layoutBox,v.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=_s(),this.targetWithTransforms=_s()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),iT(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):xa(this.target,this.layout.layoutBox),_1(this.target,this.targetDelta)):xa(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&v&&!!v.resumingFrom==!!this.resumingFrom&&!v.options.layoutScroll&&v.target&&this.animationProgress!==1?this.createRelativeTarget(v,this.target,v.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||pp(this.parent.latestValues)||B1(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(u,h,f){this.relativeParent=u,this.linkedParentVersion=u.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=_s(),this.relativeTargetOrigin=_s(),Ru(this.relativeTargetOrigin,h,f,this.options.layoutAnchor||void 0),xa(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const u=this.getLead(),h=!!this.resumingFrom||this!==u;let f=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(f=!1),h&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(f=!1),this.resolvedRelativeTargetAt===nn.timestamp&&(f=!1),f)return;const{layout:p,layoutId:y}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(p||y))return;xa(this.layoutCorrected,this.layout.layoutBox);const b=this.treeScale.x,v=this.treeScale.y;LC(this.layoutCorrected,this.treeScale,this.path,h),u.layout&&!u.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(u.target=u.layout.layoutBox,u.targetWithTransforms=_s());const{target:N}=u;if(!N){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(zb(this.prevProjectionDelta.x,this.projectionDelta.x),zb(this.prevProjectionDelta.y,this.projectionDelta.y)),mc(this.projectionDelta,this.layoutCorrected,N,this.latestValues),(this.treeScale.x!==b||this.treeScale.y!==v||!Xb(this.projectionDelta.x,this.prevProjectionDelta.x)||!Xb(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",N))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(u=!0){if(this.options.visualElement?.scheduleRender(),u){const h=this.getStack();h&&h.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Fl(),this.projectionDelta=Fl(),this.projectionDeltaWithTransform=Fl()}setAnimationOrigin(u,h=!1,f){const p=this.snapshot,y=p?p.latestValues:{},b={...this.latestValues},v=Fl();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!h;const N=_s(),j=p?p.source:void 0,T=this.layout?this.layout.source:void 0,S=j!==T,k=this.getStack(),R=!k||k.members.length<=1,I=!!(S&&!R&&this.options.crossfade===!0&&!this.path.some(OT));this.animationProgress=0;let M;const G=f?.interpolateProjection(u);this.mixTargetDelta=W=>{const U=W/1e3,q=G?.(U);q?(v.x.translate=q.x,v.x.scale=ps(u.x.scale,1,U),v.x.origin=u.x.origin,v.x.originPoint=u.x.originPoint,v.y.translate=q.y,v.y.scale=ps(u.y.scale,1,U),v.y.origin=u.y.origin,v.y.originPoint=u.y.originPoint):(tv(v.x,u.x,U),tv(v.y,u.y,U)),this.setTargetDelta(v),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Ru(N,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),LT(this.relativeTarget,this.relativeTargetOrigin,N,U),M&&dT(this.relativeTarget,M)&&(this.isProjectionDirty=!1),M||(M=_s()),xa(M,this.relativeTarget)),S&&(this.animationValues=b,mT(b,y,this.latestValues,U,I,R)),q&&q.rotate!==void 0&&(this.animationValues||(this.animationValues=b),this.animationValues.pathRotation=q.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=U},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(u){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(ni(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=xs.update(()=>{bu.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Zl(0)),this.motionValue.jump(0,!1),this.currentAnimation=xT(this.motionValue,[0,1e3],{...u,velocity:0,isSync:!0,onUpdate:h=>{this.mixTargetDelta(h),u.onUpdate&&u.onUpdate(h)},onStop:()=>{},onComplete:()=>{u.onComplete&&u.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const u=this.getStack();u&&u.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(jT),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const u=this.getLead();let{targetWithTransforms:h,target:f,layout:p,latestValues:y}=u;if(!(!h||!f||!p)){if(this!==u&&this.layout&&p&&rN(this.options.animationType,this.layout.layoutBox,p.layoutBox)){f=this.target||_s();const b=bn(this.layout.layoutBox.x);f.x.min=u.target.x.min,f.x.max=f.x.min+b;const v=bn(this.layout.layoutBox.y);f.y.min=u.target.y.min,f.y.max=f.y.min+v}xa(h,f),gu(h,y),mc(this.projectionDeltaWithTransform,this.layoutCorrected,h,y)}}registerSharedNode(u,h){this.sharedNodes.has(u)||this.sharedNodes.set(u,new vT),this.sharedNodes.get(u).add(h);const p=h.options.initialPromotionConfig;h.promote({transition:p?p.transition:void 0,preserveFollowOpacity:p&&p.shouldPreserveFollowOpacity?p.shouldPreserveFollowOpacity(h):void 0})}isLead(){const u=this.getStack();return u?u.lead===this:!0}getLead(){const{layoutId:u}=this.options;return u?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:u}=this.options;return u?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:u}=this.options;if(u)return this.root.sharedNodes.get(u)}promote({needsReset:u,transition:h,preserveFollowOpacity:f}={}){const p=this.getStack();p&&p.promote(this,f),u&&(this.projectionDelta=void 0,this.needsReset=!0),h&&this.setOptions({transition:h})}relegate(){const u=this.getStack();return u?u.relegate(this):!1}resetSkewAndRotation(){const{visualElement:u}=this.options;if(!u)return;let h=!1;const{latestValues:f}=u;if((f.z||f.rotate||f.rotateX||f.rotateY||f.rotateZ||f.skewX||f.skewY)&&(h=!0),!h)return;const p={};f.z&&uf("z",u,p,this.animationValues);for(let y=0;y<df.length;y++)uf(`rotate${df[y]}`,u,p,this.animationValues),uf(`skew${df[y]}`,u,p,this.animationValues);u.render();for(const y in p)u.setStaticValue(y,p[y]),this.animationValues&&(this.animationValues[y]=p[y]);u.scheduleRender()}applyProjectionStyles(u,h){if(!this.instance||this.isSVG)return;if(!this.isVisible){u.visibility="hidden";return}const f=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,u.visibility="",u.opacity="",u.pointerEvents=yu(h?.pointerEvents)||"",u.transform=f?f(this.latestValues,""):"none";return}const p=this.getLead();if(!this.projectionDelta||!this.layout||!p.target){this.options.layoutId&&(u.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,u.pointerEvents=yu(h?.pointerEvents)||""),this.hasProjected&&!Di(this.latestValues)&&(u.transform=f?f({},""):"none",this.hasProjected=!1);return}u.visibility="";const y=p.animationValues||p.latestValues;this.applyTransformsToTarget();let b=uT(this.projectionDeltaWithTransform,this.treeScale,y);f&&(b=f(y,b)),u.transform=b;const{x:v,y:N}=this.projectionDelta;u.transformOrigin=`${v.origin*100}% ${N.origin*100}% 0`,p.animationValues?u.opacity=p===this?y.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:y.opacityExit:u.opacity=p===this?y.opacity!==void 0?y.opacity:"":y.opacityExit!==void 0?y.opacityExit:0;for(const j in gp){if(y[j]===void 0)continue;const{correct:T,applyTo:S,isCSSVariable:k}=gp[j],R=b==="none"?y[j]:T(y[j],p);if(S){const I=S.length;for(let M=0;M<I;M++)u[S[M]]=R}else k?this.options.visualElement.renderState.vars[j]=R:u[j]=R}this.options.layoutId&&(u.pointerEvents=p===this?yu(h?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(u=>u.currentAnimation?.stop()),this.root.nodes.forEach(Zb),this.root.sharedNodes.clear()}}}function wT(n){n.updateLayout()}function kT(n){const s=n.resumeFrom?.snapshot||n.snapshot;if(n.isLead()&&n.layout&&s&&n.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:i}=n.layout,{animationType:o}=n.options,d=s.source!==n.layout.source;if(o==="size")La(y=>{const b=d?s.measuredBox[y]:s.layoutBox[y],v=bn(b);b.min=r[y].min,b.max=b.min+v});else if(o==="x"||o==="y"){const y=o==="x"?"y":"x";yp(d?s.measuredBox[y]:s.layoutBox[y],r[y])}else rN(o,s.layoutBox,r)&&La(y=>{const b=d?s.measuredBox[y]:s.layoutBox[y],v=bn(r[y]);b.max=b.min+v,n.relativeTarget&&!n.currentAnimation&&(n.isProjectionDirty=!0,n.relativeTarget[y].max=n.relativeTarget[y].min+v)});const u=Fl();mc(u,r,s.layoutBox);const h=Fl();d?mc(h,n.applyTransform(i,!0),s.measuredBox):mc(h,r,s.layoutBox);const f=!J1(u);let p=!1;if(!n.resumeFrom){const y=n.getClosestProjectingParent();if(y&&!y.resumeFrom){const{snapshot:b,layout:v}=y;if(b&&v){const N=n.options.layoutAnchor||void 0,j=_s();Ru(j,s.layoutBox,b.layoutBox,N);const T=_s();Ru(T,r,v.layoutBox,N),eN(j,T)||(p=!0),y.options.layoutRoot&&(n.relativeTarget=T,n.relativeTargetOrigin=j,n.relativeParent=y)}}}n.notifyListeners("didUpdate",{layout:r,snapshot:s,delta:h,layoutDelta:u,hasLayoutChanged:f,hasRelativeLayoutChanged:p})}else if(n.isLead()){const{onExitComplete:r}=n.options;r&&r()}n.options.transition=void 0}function ST(n){n.parent&&(n.isProjecting()||(n.isProjectionDirty=n.parent.isProjectionDirty),n.isSharedProjectionDirty||(n.isSharedProjectionDirty=!!(n.isProjectionDirty||n.parent.isProjectionDirty||n.parent.isSharedProjectionDirty)),n.isTransformDirty||(n.isTransformDirty=n.parent.isTransformDirty))}function CT(n){n.isProjectionDirty=n.isSharedProjectionDirty=n.isTransformDirty=!1}function TT(n){n.clearSnapshot()}function Zb(n){n.clearMeasurements()}function AT(n){n.isLayoutDirty=!0,n.updateLayout()}function Jb(n){n.isLayoutDirty=!1}function MT(n){n.isAnimationBlocked&&n.layout&&!n.isLayoutDirty&&(n.snapshot=n.layout,n.isLayoutDirty=!0)}function ET(n){const{visualElement:s}=n.options;s&&s.getProps().onBeforeLayoutMeasure&&s.notify("BeforeLayoutMeasure"),n.resetTransform()}function ev(n){n.finishAnimation(),n.targetDelta=n.relativeTarget=n.target=void 0,n.isProjectionDirty=!0}function IT(n){n.resolveTargetDelta()}function RT(n){n.calcProjection()}function DT(n){n.resetSkewAndRotation()}function PT(n){n.removeLeadSnapshot()}function tv(n,s,r){n.translate=ps(s.translate,0,r),n.scale=ps(s.scale,1,r),n.origin=s.origin,n.originPoint=s.originPoint}function sv(n,s,r,i){n.min=ps(s.min,r.min,i),n.max=ps(s.max,r.max,i)}function LT(n,s,r,i){sv(n.x,s.x,r.x,i),sv(n.y,s.y,r.y,i)}function OT(n){return n.animationValues&&n.animationValues.opacityExit!==void 0}const zT={duration:.45,ease:[.4,0,.1,1]},nv=n=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(n),av=nv("applewebkit/")&&!nv("chrome/")?Math.round:ca;function rv(n){n.min=av(n.min),n.max=av(n.max)}function UT(n){rv(n.x),rv(n.y)}function rN(n,s,r){return n==="position"||n==="preserve-aspect"&&!rT(qb(s),qb(r),.2)}function $T(n){return n!==n.root&&n.scroll?.wasRoot}const BT=aN({attachResizeListener:(n,s)=>vc(n,"resize",s),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),hf={current:void 0},iN=aN({measureScroll:n=>({x:n.scrollLeft,y:n.scrollTop}),defaultParent:()=>{if(!hf.current){const n=new BT({});n.mount(window),n.setOptions({layoutScroll:!0}),hf.current=n}return hf.current},resetTransform:(n,s)=>{n.style.transform=s!==void 0?s:"none"},checkIsScrollRoot:n=>window.getComputedStyle(n).position==="fixed"}),cx=g.createContext({transformPagePoint:n=>n,isStatic:!1,reducedMotion:"never"});function iv(n,s){if(typeof n=="function")return n(s);n!=null&&(n.current=s)}function _T(...n){return s=>{let r=!1;const i=n.map(o=>{const d=iv(o,s);return!r&&typeof d=="function"&&(r=!0),d});if(r)return()=>{for(let o=0;o<i.length;o++){const d=i[o];typeof d=="function"?d():iv(n[o],null)}}}}function VT(...n){return g.useCallback(_T(...n),n)}class KT extends g.Component{getSnapshotBeforeUpdate(s){const r=this.props.childRef.current;if(hu(r)&&s.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const i=r.offsetParent,o=hu(i)&&i.offsetWidth||0,d=hu(i)&&i.offsetHeight||0,u=getComputedStyle(r),h=this.props.sizeRef.current;h.height=parseFloat(u.height),h.width=parseFloat(u.width),h.top=r.offsetTop,h.left=r.offsetLeft,h.right=o-h.width-h.left,h.bottom=d-h.height-h.top,h.direction=u.direction}return null}componentDidUpdate(){}render(){return this.props.children}}function HT({children:n,isPresent:s,anchorX:r,anchorY:i,root:o,pop:d}){const u=g.useId(),h=g.useRef(null),f=g.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:p}=g.useContext(cx),y=n.props?.ref??n?.ref,b=VT(h,y);return g.useInsertionEffect(()=>{const{width:v,height:N,top:j,left:T,right:S,bottom:k,direction:R}=f.current;if(s||d===!1||!h.current||!v||!N)return;const I=R==="rtl",M=r==="left"?I?`right: ${S}`:`left: ${T}`:I?`left: ${T}`:`right: ${S}`,G=i==="bottom"?`bottom: ${k}`:`top: ${j}`;h.current.dataset.motionPopId=u;const W=document.createElement("style");p&&(W.nonce=p);const U=o??document.head;return U.appendChild(W),W.sheet&&W.sheet.insertRule(`
|
|
10
|
+
[data-motion-pop-id="${u}"] {
|
|
11
|
+
position: absolute !important;
|
|
12
|
+
width: ${v}px !important;
|
|
13
|
+
height: ${N}px !important;
|
|
14
|
+
${M}px !important;
|
|
15
|
+
${G}px !important;
|
|
16
|
+
}
|
|
17
|
+
`),()=>{h.current?.removeAttribute("data-motion-pop-id"),U.contains(W)&&U.removeChild(W)}},[s]),e.jsx(KT,{isPresent:s,childRef:h,sizeRef:f,pop:d,children:d===!1?n:g.cloneElement(n,{ref:b})})}const FT=({children:n,initial:s,isPresent:r,onExitComplete:i,custom:o,presenceAffectsLayout:d,mode:u,anchorX:h,anchorY:f,root:p})=>{const y=$p(GT),b=g.useId();let v=!0,N=g.useMemo(()=>(v=!1,{id:b,initial:s,isPresent:r,custom:o,onExitComplete:j=>{y.set(j,!0);for(const T of y.values())if(!T)return;i&&i()},register:j=>(y.set(j,!1),()=>y.delete(j))}),[r,y,i]);return d&&v&&(N={...N}),g.useMemo(()=>{y.forEach((j,T)=>y.set(T,!1))},[r]),g.useEffect(()=>{!r&&!y.size&&i&&i()},[r]),n=e.jsx(HT,{pop:u==="popLayout",isPresent:r,anchorX:h,anchorY:f,root:p,children:n}),e.jsx(_u.Provider,{value:N,children:n})};function GT(){return new Map}function lN(n=!0){const s=g.useContext(_u);if(s===null)return[!0,null];const{isPresent:r,onExitComplete:i,register:o}=s,d=g.useId();g.useEffect(()=>{if(n)return o(d)},[n]);const u=g.useCallback(()=>n&&i&&i(d),[d,i,n]);return!r&&i?[!1,u]:[!0]}const Zd=n=>n.key||"";function lv(n){const s=[];return g.Children.forEach(n,r=>{g.isValidElement(r)&&s.push(r)}),s}const fc=({children:n,custom:s,initial:r=!0,onExitComplete:i,presenceAffectsLayout:o=!0,mode:d="sync",propagate:u=!1,anchorX:h="left",anchorY:f="top",root:p})=>{const[y,b]=lN(u),v=g.useMemo(()=>lv(n),[n]),N=u&&!y?[]:v.map(Zd),j=g.useRef(!0),T=g.useRef(v),S=$p(()=>new Map),k=g.useRef(new Set),[R,I]=g.useState(v),[M,G]=g.useState(v);Lj(()=>{j.current=!1,T.current=v;for(let q=0;q<M.length;q++){const V=Zd(M[q]);N.includes(V)?(S.delete(V),k.current.delete(V)):S.get(V)!==!0&&S.set(V,!1)}},[M,N.length,N.join("-")]);const W=[];if(v!==R){let q=[...v];for(let V=0;V<M.length;V++){const le=M[V],B=Zd(le);N.includes(B)||(q.splice(V,0,le),W.push(le))}return d==="wait"&&W.length&&(q=W),G(lv(q)),I(v),null}const{forceRender:U}=g.useContext(Up);return e.jsx(e.Fragment,{children:M.map(q=>{const V=Zd(q),le=u&&!y?!1:v===M||N.includes(V),B=()=>{if(k.current.has(V))return;if(S.has(V))k.current.add(V),S.set(V,!0);else return;let be=!0;S.forEach(K=>{K||(be=!1)}),be&&(U?.(),G(T.current),u&&b?.(),i&&i())};return e.jsx(FT,{isPresent:le,initial:!j.current||r?void 0:!1,custom:s,presenceAffectsLayout:o,mode:d,root:p,onExitComplete:le?void 0:B,anchorX:h,anchorY:f,children:q},V)})})},oN=g.createContext({strict:!1}),ov={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let cv=!1;function qT(){if(cv)return;const n={};for(const s in ov)n[s]={isEnabled:r=>ov[s].some(i=>!!r[i])};z1(n),cv=!0}function cN(){return qT(),IC()}function XT(n){const s=cN();for(const r in n)s[r]={...s[r],...n[r]};z1(s)}const YT=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function Du(n){return n.startsWith("while")||n.startsWith("drag")&&n!=="draggable"||n.startsWith("layout")||n.startsWith("onTap")||n.startsWith("onPan")||n.startsWith("onLayout")||YT.has(n)}let dN=n=>!Du(n);function WT(n){typeof n=="function"&&(dN=s=>s.startsWith("on")?!Du(s):n(s))}try{WT(require("@emotion/is-prop-valid").default)}catch{}function QT(n,s,r){const i={};for(const o in n)o==="values"&&typeof n.values=="object"||rn(n[o])||(dN(o)||r===!0&&Du(o)||!s&&!Du(o)||n.draggable&&o.startsWith("onDrag"))&&(i[o]=n[o]);return i}const Fu=g.createContext({});function ZT(n,s){if(Hu(n)){const{initial:r,animate:i}=n;return{initial:r===!1||bc(r)?r:void 0,animate:bc(i)?i:void 0}}return n.inherit!==!1?s:{}}function JT(n){const{initial:s,animate:r}=ZT(n,g.useContext(Fu));return g.useMemo(()=>({initial:s,animate:r}),[dv(s),dv(r)])}function dv(n){return Array.isArray(n)?n.join(" "):n}const dx=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function uN(n,s,r){for(const i in s)!rn(s[i])&&!H1(i,r)&&(n[i]=s[i])}function e5({transformTemplate:n},s){return g.useMemo(()=>{const r=dx();return lx(r,s,n),Object.assign({},r.vars,r.style)},[s])}function t5(n,s){const r=n.style||{},i={};return uN(i,r,n),Object.assign(i,e5(n,s)),i}function s5(n,s){const r={},i=t5(n,s);return n.drag&&n.dragListener!==!1&&(r.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=n.drag===!0?"none":`pan-${n.drag==="x"?"y":"x"}`),n.tabIndex===void 0&&(n.onTap||n.onTapStart||n.whileTap)&&(r.tabIndex=0),r.style=i,r}const hN=()=>({...dx(),attrs:{}});function n5(n,s,r,i){const o=g.useMemo(()=>{const d=hN();return F1(d,s,q1(i),n.transformTemplate,n.style),{...d.attrs,style:{...d.style}}},[s]);if(n.style){const d={};uN(d,n.style,n),o.style={...d,...o.style}}return o}const a5=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function ux(n){return typeof n!="string"||n.includes("-")?!1:!!(a5.indexOf(n)>-1||/[A-Z]/u.test(n))}function r5(n,s,r,{latestValues:i},o,d=!1,u){const f=(u??ux(n)?n5:s5)(s,i,o,n),p=QT(s,typeof n=="string",d),y=n!==g.Fragment?{...p,...f,ref:r}:{},{children:b}=s,v=g.useMemo(()=>rn(b)?b.get():b,[b]);return g.createElement(n,{...y,children:v})}function i5({scrapeMotionValuesFromProps:n,createRenderState:s},r,i,o){return{latestValues:l5(r,i,o,n),renderState:s()}}function l5(n,s,r,i){const o={},d=i(n,{});for(const v in d)o[v]=yu(d[v]);let{initial:u,animate:h}=n;const f=Hu(n),p=L1(n);s&&p&&!f&&n.inherit!==!1&&(u===void 0&&(u=s.initial),h===void 0&&(h=s.animate));let y=r?r.initial===!1:!1;y=y||u===!1;const b=y?h:u;if(b&&typeof b!="boolean"&&!Ku(b)){const v=Array.isArray(b)?b:[b];for(let N=0;N<v.length;N++){const j=ex(n,v[N]);if(j){const{transitionEnd:T,transition:S,...k}=j;for(const R in k){let I=k[R];if(Array.isArray(I)){const M=y?I.length-1:0;I=I[M]}I!==null&&(o[R]=I)}for(const R in T)o[R]=T[R]}}}return o}const mN=n=>(s,r)=>{const i=g.useContext(Fu),o=g.useContext(_u),d=()=>i5(n,s,i,o);return r?d():$p(d)},o5=mN({scrapeMotionValuesFromProps:ox,createRenderState:dx}),c5=mN({scrapeMotionValuesFromProps:X1,createRenderState:hN}),d5=Symbol.for("motionComponentSymbol");function u5(n,s,r){const i=g.useRef(r);g.useInsertionEffect(()=>{i.current=r});const o=g.useRef(null);return g.useCallback(d=>{d&&n.onMount?.(d),s&&(d?s.mount(d):s.unmount());const u=i.current;if(typeof u=="function")if(d){const h=u(d);typeof h=="function"&&(o.current=h)}else o.current?(o.current(),o.current=null):u(d);else u&&(u.current=d)},[s])}const fN=g.createContext({});function _l(n){return n&&typeof n=="object"&&Object.prototype.hasOwnProperty.call(n,"current")}function h5(n,s,r,i,o,d){const{visualElement:u}=g.useContext(Fu),h=g.useContext(oN),f=g.useContext(_u),p=g.useContext(cx),y=p.reducedMotion,b=p.skipAnimations,v=g.useRef(null),N=g.useRef(!1);i=i||h.renderer,!v.current&&i&&(v.current=i(n,{visualState:s,parent:u,props:r,presenceContext:f,blockInitialAnimation:f?f.initial===!1:!1,reducedMotionConfig:y,skipAnimations:b,isSVG:d}),N.current&&v.current&&(v.current.manuallyAnimateOnMount=!0));const j=v.current,T=g.useContext(fN);j&&!j.projection&&o&&(j.type==="html"||j.type==="svg")&&m5(v.current,r,o,T);const S=g.useRef(!1);g.useInsertionEffect(()=>{j&&S.current&&j.update(r,f)});const k=r[w1],R=g.useRef(!!k&&typeof window<"u"&&!window.MotionHandoffIsComplete?.(k)&&window.MotionHasOptimisedAnimation?.(k));return Lj(()=>{N.current=!0,j&&(S.current=!0,window.MotionIsMounted=!0,j.updateFeatures(),j.scheduleRenderMicrotask(),R.current&&j.animationState&&j.animationState.animateChanges())}),g.useEffect(()=>{j&&(!R.current&&j.animationState&&j.animationState.animateChanges(),R.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(k)}),R.current=!1),j.enteringChildren=void 0)}),j}function m5(n,s,r,i){const{layoutId:o,layout:d,drag:u,dragConstraints:h,layoutScroll:f,layoutRoot:p,layoutAnchor:y,layoutCrossfade:b}=s;n.projection=new r(n.latestValues,s["data-framer-portal-id"]?void 0:pN(n.parent)),n.projection.setOptions({layoutId:o,layout:d,alwaysMeasureLayout:!!u||h&&_l(h),visualElement:n,animationType:typeof d=="string"?d:"both",initialPromotionConfig:i,crossfade:b,layoutScroll:f,layoutRoot:p,layoutAnchor:y})}function pN(n){if(n)return n.options.allowProjection!==!1?n.projection:pN(n.parent)}function mf(n,{forwardMotionProps:s=!1,type:r}={},i,o){i&&XT(i);const d=r?r==="svg":ux(n),u=d?c5:o5;function h(p,y){let b;const v={...g.useContext(cx),...p,layoutId:f5(p)},{isStatic:N}=v,j=JT(p),T=u(p,N);if(!N&&typeof window<"u"){p5();const S=x5(v);b=S.MeasureLayout,j.visualElement=h5(n,T,v,o,S.ProjectionNode,d)}return e.jsxs(Fu.Provider,{value:j,children:[b&&j.visualElement?e.jsx(b,{visualElement:j.visualElement,...v}):null,r5(n,p,u5(T,j.visualElement,y),T,N,s,d)]})}h.displayName=`motion.${typeof n=="string"?n:`create(${n.displayName??n.name??""})`}`;const f=g.forwardRef(h);return f[d5]=n,f}function f5({layoutId:n}){const s=g.useContext(Up).id;return s&&n!==void 0?s+"-"+n:n}function p5(n,s){g.useContext(oN).strict}function x5(n){const s=cN(),{drag:r,layout:i}=s;if(!r&&!i)return{};const o={...r,...i};return{MeasureLayout:r?.isEnabled(n)||i?.isEnabled(n)?o.MeasureLayout:void 0,ProjectionNode:o.ProjectionNode}}function g5(n,s){if(typeof Proxy>"u")return mf;const r=new Map,i=(d,u)=>mf(d,u,n,s),o=(d,u)=>i(d,u);return new Proxy(o,{get:(d,u)=>u==="create"?i:(r.has(u)||r.set(u,mf(u,void 0,n,s)),r.get(u))})}const y5=(n,s)=>s.isSVG??ux(n)?new XC(s):new VC(s,{allowProjection:n!==g.Fragment});class b5 extends li{constructor(s){super(s),s.animationState||(s.animationState=JC(s))}updateAnimationControlsSubscription(){const{animate:s}=this.node.getProps();Ku(s)&&(this.unmountControls=s.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:s}=this.node.getProps(),{animate:r}=this.node.prevProps||{};s!==r&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let v5=0;class j5 extends li{constructor(){super(...arguments),this.id=v5++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;const{isPresent:s,onExitComplete:r}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||s===i)return;if(s&&i===!1){if(this.isExitComplete){const{initial:d,custom:u}=this.node.getProps();if(typeof d=="string"||typeof d=="object"&&d!==null&&!Array.isArray(d)){const h=_i(this.node,d,u);if(h){const{transition:f,transitionEnd:p,...y}=h;for(const b in y)this.node.getValue(b)?.jump(y[b])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const o=this.node.animationState.setActive("exit",!s);r&&!s&&o.then(()=>{this.isExitComplete=!0,r(this.id)})}mount(){const{register:s,onExitComplete:r}=this.node.presenceContext||{};r&&r(this.id),s&&(this.unmount=s(this.id))}unmount(){}}const N5={animation:{Feature:b5},exit:{Feature:j5}};function Rc(n){return{point:{x:n.pageX,y:n.pageY}}}const w5=n=>s=>nx(s)&&n(s,Rc(s));function pc(n,s,r,i){return vc(n,s,w5(r),i)}const xN=({current:n})=>n?n.ownerDocument.defaultView:null,uv=(n,s)=>Math.abs(n-s);function k5(n,s){const r=uv(n.x,s.x),i=uv(n.y,s.y);return Math.sqrt(r**2+i**2)}const hv=new Set(["auto","scroll"]);class gN{constructor(s,r,{transformPagePoint:i,contextWindow:o=window,dragSnapToOrigin:d=!1,distanceThreshold:u=3,element:h}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=N=>{this.handleScroll(N.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Jd(this.lastRawMoveEventInfo,this.transformPagePoint));const N=ff(this.lastMoveEventInfo,this.history),j=this.startEvent!==null,T=k5(N.offset,{x:0,y:0})>=this.distanceThreshold;if(!j&&!T)return;const{point:S}=N,{timestamp:k}=nn;this.history.push({...S,timestamp:k});const{onStart:R,onMove:I}=this.handlers;j||(R&&R(this.lastMoveEvent,N),this.startEvent=this.lastMoveEvent),I&&I(this.lastMoveEvent,N)},this.handlePointerMove=(N,j)=>{this.lastMoveEvent=N,this.lastRawMoveEventInfo=j,this.lastMoveEventInfo=Jd(j,this.transformPagePoint),xs.update(this.updatePoint,!0)},this.handlePointerUp=(N,j)=>{this.end();const{onEnd:T,onSessionEnd:S,resumeAnimation:k}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&k&&k(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const R=ff(N.type==="pointercancel"?this.lastMoveEventInfo:Jd(j,this.transformPagePoint),this.history);this.startEvent&&T&&T(N,R),S&&S(N,R)},!nx(s))return;this.dragSnapToOrigin=d,this.handlers=r,this.transformPagePoint=i,this.distanceThreshold=u,this.contextWindow=o||window;const f=Rc(s),p=Jd(f,this.transformPagePoint),{point:y}=p,{timestamp:b}=nn;this.history=[{...y,timestamp:b}];const{onSessionStart:v}=r;v&&v(s,ff(p,this.history)),this.removeListeners=Mc(pc(this.contextWindow,"pointermove",this.handlePointerMove),pc(this.contextWindow,"pointerup",this.handlePointerUp),pc(this.contextWindow,"pointercancel",this.handlePointerUp)),h&&this.startScrollTracking(h)}startScrollTracking(s){let r=s.parentElement;for(;r;){const i=getComputedStyle(r);(hv.has(i.overflowX)||hv.has(i.overflowY))&&this.scrollPositions.set(r,{x:r.scrollLeft,y:r.scrollTop}),r=r.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(s){const r=this.scrollPositions.get(s);if(!r)return;const i=s===window,o=i?{x:window.scrollX,y:window.scrollY}:{x:s.scrollLeft,y:s.scrollTop},d={x:o.x-r.x,y:o.y-r.y};d.x===0&&d.y===0||(i?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=d.x,this.lastMoveEventInfo.point.y+=d.y):this.history.length>0&&(this.history[0].x-=d.x,this.history[0].y-=d.y),this.scrollPositions.set(s,o),xs.update(this.updatePoint,!0))}updateHandlers(s){this.handlers=s}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),ni(this.updatePoint)}}function Jd(n,s){return s?{point:s(n.point)}:n}function mv(n,s){return{x:n.x-s.x,y:n.y-s.y}}function ff({point:n},s){return{point:n,delta:mv(n,yN(s)),offset:mv(n,S5(s)),velocity:C5(s,.1)}}function S5(n){return n[0]}function yN(n){return n[n.length-1]}function C5(n,s){if(n.length<2)return{x:0,y:0};let r=n.length-1,i=null;const o=yN(n);for(;r>=0&&(i=n[r],!(o.timestamp-i.timestamp>Hn(s)));)r--;if(!i)return{x:0,y:0};i===n[0]&&n.length>2&&o.timestamp-i.timestamp>Hn(s)*2&&(i=n[1]);const d=la(o.timestamp-i.timestamp);if(d===0)return{x:0,y:0};const u={x:(o.x-i.x)/d,y:(o.y-i.y)/d};return u.x===1/0&&(u.x=0),u.y===1/0&&(u.y=0),u}function T5(n,{min:s,max:r},i){return s!==void 0&&n<s?n=i?ps(s,n,i.min):Math.max(n,s):r!==void 0&&n>r&&(n=i?ps(r,n,i.max):Math.min(n,r)),n}function fv(n,s,r){return{min:s!==void 0?n.min+s:void 0,max:r!==void 0?n.max+r-(n.max-n.min):void 0}}function A5(n,{top:s,left:r,bottom:i,right:o}){return{x:fv(n.x,r,o),y:fv(n.y,s,i)}}function pv(n,s){let r=s.min-n.min,i=s.max-n.max;return s.max-s.min<n.max-n.min&&([r,i]=[i,r]),{min:r,max:i}}function M5(n,s){return{x:pv(n.x,s.x),y:pv(n.y,s.y)}}function E5(n,s){let r=.5;const i=bn(n),o=bn(s);return o>i?r=gc(s.min,s.max-i,n.min):i>o&&(r=gc(n.min,n.max-o,s.min)),Ha(0,1,r)}function I5(n,s){const r={};return s.min!==void 0&&(r.min=s.min-n.min),s.max!==void 0&&(r.max=s.max-n.min),r}const bp=.35;function R5(n=bp){return n===!1?n=0:n===!0&&(n=bp),{x:xv(n,"left","right"),y:xv(n,"top","bottom")}}function xv(n,s,r){return{min:gv(n,s),max:gv(n,r)}}function gv(n,s){return typeof n=="number"?n:n[s]||0}const D5=new WeakMap;class P5{constructor(s){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=_s(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=s}start(s,{snapToCursor:r=!1,distanceThreshold:i}={}){const{presenceContext:o}=this.visualElement;if(o&&o.isPresent===!1)return;const d=b=>{r&&this.snapToCursor(Rc(b).point),this.stopAnimation()},u=(b,v)=>{const{drag:N,dragPropagation:j,onDragStart:T}=this.getProps();if(N&&!j&&(this.openDragLock&&this.openDragLock(),this.openDragLock=lC(N),!this.openDragLock))return;this.latestPointerEvent=b,this.latestPanInfo=v,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),La(k=>{let R=this.getAxisMotionValue(k).get()||0;if(_a.test(R)){const{projection:I}=this.visualElement;if(I&&I.layout){const M=I.layout.layoutBox[k];M&&(R=bn(M)*(parseFloat(R)/100))}}this.originPoint[k]=R}),T&&xs.update(()=>T(b,v),!1,!0),cp(this.visualElement,"transform");const{animationState:S}=this.visualElement;S&&S.setActive("whileDrag",!0)},h=(b,v)=>{this.latestPointerEvent=b,this.latestPanInfo=v;const{dragPropagation:N,dragDirectionLock:j,onDirectionLock:T,onDrag:S}=this.getProps();if(!N&&!this.openDragLock)return;const{offset:k}=v;if(j&&this.currentDirection===null){this.currentDirection=O5(k),this.currentDirection!==null&&T&&T(this.currentDirection);return}this.updateAxis("x",v.point,k),this.updateAxis("y",v.point,k),this.visualElement.render(),S&&xs.update(()=>S(b,v),!1,!0)},f=(b,v)=>{this.latestPointerEvent=b,this.latestPanInfo=v,this.stop(b,v),this.latestPointerEvent=null,this.latestPanInfo=null},p=()=>{const{dragSnapToOrigin:b}=this.getProps();(b||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:y}=this.getProps();this.panSession=new gN(s,{onSessionStart:d,onStart:u,onMove:h,onSessionEnd:f,resumeAnimation:p},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:y,distanceThreshold:i,contextWindow:xN(this.visualElement),element:this.visualElement.current})}stop(s,r){const i=s||this.latestPointerEvent,o=r||this.latestPanInfo,d=this.isDragging;if(this.cancel(),!d||!o||!i)return;const{velocity:u}=o;this.startAnimation(u);const{onDragEnd:h}=this.getProps();h&&xs.postRender(()=>h(i,o))}cancel(){this.isDragging=!1;const{projection:s,animationState:r}=this.visualElement;s&&(s.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:i}=this.getProps();!i&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),r&&r.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(s,r,i){const{drag:o}=this.getProps();if(!i||!eu(s,o,this.currentDirection))return;const d=this.getAxisMotionValue(s);let u=this.originPoint[s]+i[s];this.constraints&&this.constraints[s]&&(u=T5(u,this.constraints[s],this.elastic[s])),d.set(u)}resolveConstraints(){const{dragConstraints:s,dragElastic:r}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,o=this.constraints;s&&_l(s)?this.constraints||(this.constraints=this.resolveRefConstraints()):s&&i?this.constraints=A5(i.layoutBox,s):this.constraints=!1,this.elastic=R5(r),o!==this.constraints&&!_l(s)&&i&&this.constraints&&!this.hasMutatedConstraints&&La(d=>{this.constraints!==!1&&this.getAxisMotionValue(d)&&(this.constraints[d]=I5(i.layoutBox[d],this.constraints[d]))})}resolveRefConstraints(){const{dragConstraints:s,onMeasureDragConstraints:r}=this.getProps();if(!s||!_l(s))return!1;const i=s.current,{projection:o}=this.visualElement;if(!o||!o.layout)return!1;o.root&&(o.root.scroll=void 0,o.root.updateScroll());const d=OC(i,o.root,this.visualElement.getTransformPagePoint());let u=M5(o.layout.layoutBox,d);if(r){const h=r(DC(u));this.hasMutatedConstraints=!!h,h&&(u=$1(h))}return u}startAnimation(s){const{drag:r,dragMomentum:i,dragElastic:o,dragTransition:d,dragSnapToOrigin:u,onDragTransitionEnd:h}=this.getProps(),f=this.constraints||{},p=La(y=>{if(!eu(y,r,this.currentDirection))return;let b=f&&f[y]||{};(u===!0||u===y)&&(b={min:0,max:0});const v=o?200:1e6,N=o?40:1e7,j={type:"inertia",velocity:i?s[y]:0,bounceStiffness:v,bounceDamping:N,timeConstant:750,restDelta:1,restSpeed:10,...d,...b};return this.startAxisValueAnimation(y,j)});return Promise.all(p).then(h)}startAxisValueAnimation(s,r){const i=this.getAxisMotionValue(s);return cp(this.visualElement,s),i.start(Jp(s,i,0,r,this.visualElement,!1))}stopAnimation(){La(s=>this.getAxisMotionValue(s).stop())}getAxisMotionValue(s){const r=`_drag${s.toUpperCase()}`,o=this.visualElement.getProps()[r];return o||this.visualElement.getValue(s,this.visualElement.latestValues[s]??0)}snapToCursor(s){La(r=>{const{drag:i}=this.getProps();if(!eu(r,i,this.currentDirection))return;const{projection:o}=this.visualElement,d=this.getAxisMotionValue(r);if(o&&o.layout){const{min:u,max:h}=o.layout.layoutBox[r],f=d.get()||0;d.set(s[r]-ps(u,h,.5)+f)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:s,dragConstraints:r}=this.getProps(),{projection:i}=this.visualElement;if(!_l(r)||!i||!this.constraints)return;this.stopAnimation();const o={x:0,y:0};La(u=>{const h=this.getAxisMotionValue(u);if(h&&this.constraints!==!1){const f=h.get();o[u]=E5({min:f,max:f},this.constraints[u])}});const{transformTemplate:d}=this.visualElement.getProps();this.visualElement.current.style.transform=d?d({},""):"none",i.root&&i.root.updateScroll(),i.updateLayout(),this.constraints=!1,this.resolveConstraints(),La(u=>{if(!eu(u,s,null))return;const h=this.getAxisMotionValue(u),{min:f,max:p}=this.constraints[u];h.set(ps(f,p,o[u]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;D5.set(this.visualElement,this);const s=this.visualElement.current,r=pc(s,"pointerdown",p=>{const{drag:y,dragListener:b=!0}=this.getProps(),v=p.target,N=v!==s&&mC(v);y&&b&&!N&&this.start(p)});let i;const o=()=>{const{dragConstraints:p}=this.getProps();_l(p)&&p.current&&(this.constraints=this.resolveRefConstraints(),i||(i=L5(s,p.current,()=>this.scalePositionWithinConstraints())))},{projection:d}=this.visualElement,u=d.addEventListener("measure",o);d&&!d.layout&&(d.root&&d.root.updateScroll(),d.updateLayout()),xs.read(o);const h=vc(window,"resize",()=>this.scalePositionWithinConstraints()),f=d.addEventListener("didUpdate",(({delta:p,hasLayoutChanged:y})=>{this.isDragging&&y&&(La(b=>{const v=this.getAxisMotionValue(b);v&&(this.originPoint[b]+=p[b].translate,v.set(v.get()+p[b].translate))}),this.visualElement.render())}));return()=>{h(),r(),u(),f&&f(),i&&i()}}getProps(){const s=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:i=!1,dragPropagation:o=!1,dragConstraints:d=!1,dragElastic:u=bp,dragMomentum:h=!0}=s;return{...s,drag:r,dragDirectionLock:i,dragPropagation:o,dragConstraints:d,dragElastic:u,dragMomentum:h}}}function yv(n){let s=!0;return()=>{if(s){s=!1;return}n()}}function L5(n,s,r){const i=Sb(n,yv(r)),o=Sb(s,yv(r));return()=>{i(),o()}}function eu(n,s,r){return(s===!0||s===n)&&(r===null||r===n)}function O5(n,s=10){let r=null;return Math.abs(n.y)>s?r="y":Math.abs(n.x)>s&&(r="x"),r}class z5 extends li{constructor(s){super(s),this.removeGroupControls=ca,this.removeListeners=ca,this.controls=new P5(s)}mount(){const{dragControls:s}=this.node.getProps();s&&(this.removeGroupControls=s.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||ca}update(){const{dragControls:s}=this.node.getProps(),{dragControls:r}=this.node.prevProps||{};s!==r&&(this.removeGroupControls(),s&&(this.removeGroupControls=s.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const pf=n=>(s,r)=>{n&&xs.update(()=>n(s,r),!1,!0)};class U5 extends li{constructor(){super(...arguments),this.removePointerDownListener=ca}onPointerDown(s){this.session=new gN(s,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:xN(this.node)})}createPanHandlers(){const{onPanSessionStart:s,onPanStart:r,onPan:i,onPanEnd:o}=this.node.getProps();return{onSessionStart:pf(s),onStart:pf(r),onMove:pf(i),onEnd:(d,u)=>{delete this.session,o&&xs.postRender(()=>o(d,u))}}}mount(){this.removePointerDownListener=pc(this.node.current,"pointerdown",s=>this.onPointerDown(s))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let xf=!1;class $5 extends g.Component{componentDidMount(){const{visualElement:s,layoutGroup:r,switchLayoutGroup:i,layoutId:o}=this.props,{projection:d}=s;d&&(r.group&&r.group.add(d),i&&i.register&&o&&i.register(d),xf&&d.root.didUpdate(),d.addEventListener("animationComplete",()=>{this.safeToRemove()}),d.setOptions({...d.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),bu.hasEverUpdated=!0}getSnapshotBeforeUpdate(s){const{layoutDependency:r,visualElement:i,drag:o,isPresent:d}=this.props,{projection:u}=i;return u&&(u.isPresent=d,s.layoutDependency!==r&&u.setOptions({...u.options,layoutDependency:r}),xf=!0,o||s.layoutDependency!==r||r===void 0||s.isPresent!==d?u.willUpdate():this.safeToRemove(),s.isPresent!==d&&(d?u.promote():u.relegate()||xs.postRender(()=>{const h=u.getStack();(!h||!h.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:s,layoutAnchor:r}=this.props,{projection:i}=s;i&&(i.options.layoutAnchor=r,i.root.didUpdate(),sx.postRender(()=>{!i.currentAnimation&&i.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:s,layoutGroup:r,switchLayoutGroup:i}=this.props,{projection:o}=s;xf=!0,o&&(o.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(o),i&&i.deregister&&i.deregister(o))}safeToRemove(){const{safeToRemove:s}=this.props;s&&s()}render(){return null}}function bN(n){const[s,r]=lN(),i=g.useContext(Up);return e.jsx($5,{...n,layoutGroup:i,switchLayoutGroup:g.useContext(fN),isPresent:s,safeToRemove:r})}const B5={pan:{Feature:U5},drag:{Feature:z5,ProjectionNode:iN,MeasureLayout:bN}};function bv(n,s,r){const{props:i}=n;n.animationState&&i.whileHover&&n.animationState.setActive("whileHover",r==="Start");const o="onHover"+r,d=i[o];d&&xs.postRender(()=>d(s,Rc(s)))}class _5 extends li{mount(){const{current:s}=this.node;s&&(this.unmount=cC(s,(r,i)=>(bv(this.node,i,"Start"),o=>bv(this.node,o,"End"))))}unmount(){}}class V5 extends li{constructor(){super(...arguments),this.isActive=!1}onFocus(){let s=!1;try{s=this.node.current.matches(":focus-visible")}catch{s=!0}!s||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Mc(vc(this.node.current,"focus",()=>this.onFocus()),vc(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function vv(n,s,r){const{props:i}=n;if(n.current instanceof HTMLButtonElement&&n.current.disabled)return;n.animationState&&i.whileTap&&n.animationState.setActive("whileTap",r==="Start");const o="onTap"+(r==="End"?"":r),d=i[o];d&&xs.postRender(()=>d(s,Rc(s)))}class K5 extends li{mount(){const{current:s}=this.node;if(!s)return;const{globalTapTarget:r,propagate:i}=this.node.props;this.unmount=pC(s,(o,d)=>(vv(this.node,d,"Start"),(u,{success:h})=>vv(this.node,u,h?"End":"Cancel")),{useGlobalTarget:r,stopPropagation:i?.tap===!1})}unmount(){}}const vp=new WeakMap,gf=new WeakMap,H5=n=>{const s=vp.get(n.target);s&&s(n)},F5=n=>{n.forEach(H5)};function G5({root:n,...s}){const r=n||document;gf.has(r)||gf.set(r,{});const i=gf.get(r),o=JSON.stringify(s);return i[o]||(i[o]=new IntersectionObserver(F5,{root:n,...s})),i[o]}function q5(n,s,r){const i=G5(s);return vp.set(n,r),i.observe(n),()=>{vp.delete(n),i.unobserve(n)}}const X5={some:0,all:1};class Y5 extends li{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();const{viewport:s={}}=this.node.getProps(),{root:r,margin:i,amount:o="some",once:d}=s,u={root:r?r.current:void 0,rootMargin:i,threshold:typeof o=="number"?o:X5[o]},h=f=>{const{isIntersecting:p}=f;if(this.isInView===p||(this.isInView=p,d&&!p&&this.hasEnteredView))return;p&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",p);const{onViewportEnter:y,onViewportLeave:b}=this.node.getProps(),v=p?y:b;v&&v(f)};this.stopObserver=q5(this.node.current,u,h)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:s,prevProps:r}=this.node;["amount","margin","root"].some(W5(s,r))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}}function W5({viewport:n={}},{viewport:s={}}={}){return r=>n[r]!==s[r]}const Q5={inView:{Feature:Y5},tap:{Feature:K5},focus:{Feature:V5},hover:{Feature:_5}},Z5={layout:{ProjectionNode:iN,MeasureLayout:bN}},J5={...N5,...Q5,...B5,...Z5},za=g5(J5,y5);var Tn=Pj();function vN(n){var s,r,i="";if(typeof n=="string"||typeof n=="number")i+=n;else if(typeof n=="object")if(Array.isArray(n)){var o=n.length;for(s=0;s<o;s++)n[s]&&(r=vN(n[s]))&&(i&&(i+=" "),i+=r)}else for(r in n)n[r]&&(i&&(i+=" "),i+=r);return i}function jN(){for(var n,s,r=0,i="",o=arguments.length;r<o;r++)(n=arguments[r])&&(s=vN(n))&&(i&&(i+=" "),i+=s);return i}const jv=n=>typeof n=="boolean"?`${n}`:n===0?"0":n,Nv=jN,hx=(n,s)=>r=>{var i;if(s?.variants==null)return Nv(n,r?.class,r?.className);const{variants:o,defaultVariants:d}=s,u=Object.keys(o).map(p=>{const y=r?.[p],b=d?.[p];if(y===null)return null;const v=jv(y)||jv(b);return o[p][v]}),h=r&&Object.entries(r).reduce((p,y)=>{let[b,v]=y;return v===void 0||(p[b]=v),p},{}),f=s==null||(i=s.compoundVariants)===null||i===void 0?void 0:i.reduce((p,y)=>{let{class:b,className:v,...N}=y;return Object.entries(N).every(j=>{let[T,S]=j;return Array.isArray(S)?S.includes({...d,...h}[T]):{...d,...h}[T]===S})?[...p,b,v]:p},[]);return Nv(n,u,f,r?.class,r?.className)},e4=(n,s)=>{const r=new Array(n.length+s.length);for(let i=0;i<n.length;i++)r[i]=n[i];for(let i=0;i<s.length;i++)r[n.length+i]=s[i];return r},t4=(n,s)=>({classGroupId:n,validator:s}),NN=(n=new Map,s=null,r)=>({nextPart:n,validators:s,classGroupId:r}),Pu="-",wv=[],s4="arbitrary..",n4=n=>{const s=r4(n),{conflictingClassGroups:r,conflictingClassGroupModifiers:i}=n;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return a4(u);const h=u.split(Pu),f=h[0]===""&&h.length>1?1:0;return wN(h,f,s)},getConflictingClassGroupIds:(u,h)=>{if(h){const f=i[u],p=r[u];return f?p?e4(p,f):f:p||wv}return r[u]||wv}}},wN=(n,s,r)=>{if(n.length-s===0)return r.classGroupId;const o=n[s],d=r.nextPart.get(o);if(d){const p=wN(n,s+1,d);if(p)return p}const u=r.validators;if(u===null)return;const h=s===0?n.join(Pu):n.slice(s).join(Pu),f=u.length;for(let p=0;p<f;p++){const y=u[p];if(y.validator(h))return y.classGroupId}},a4=n=>n.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const s=n.slice(1,-1),r=s.indexOf(":"),i=s.slice(0,r);return i?s4+i:void 0})(),r4=n=>{const{theme:s,classGroups:r}=n;return i4(r,s)},i4=(n,s)=>{const r=NN();for(const i in n){const o=n[i];mx(o,r,i,s)}return r},mx=(n,s,r,i)=>{const o=n.length;for(let d=0;d<o;d++){const u=n[d];l4(u,s,r,i)}},l4=(n,s,r,i)=>{if(typeof n=="string"){o4(n,s,r);return}if(typeof n=="function"){c4(n,s,r,i);return}d4(n,s,r,i)},o4=(n,s,r)=>{const i=n===""?s:kN(s,n);i.classGroupId=r},c4=(n,s,r,i)=>{if(u4(n)){mx(n(i),s,r,i);return}s.validators===null&&(s.validators=[]),s.validators.push(t4(r,n))},d4=(n,s,r,i)=>{const o=Object.entries(n),d=o.length;for(let u=0;u<d;u++){const[h,f]=o[u];mx(f,kN(s,h),r,i)}},kN=(n,s)=>{let r=n;const i=s.split(Pu),o=i.length;for(let d=0;d<o;d++){const u=i[d];let h=r.nextPart.get(u);h||(h=NN(),r.nextPart.set(u,h)),r=h}return r},u4=n=>"isThemeGetter"in n&&n.isThemeGetter===!0,h4=n=>{if(n<1)return{get:()=>{},set:()=>{}};let s=0,r=Object.create(null),i=Object.create(null);const o=(d,u)=>{r[d]=u,s++,s>n&&(s=0,i=r,r=Object.create(null))};return{get(d){let u=r[d];if(u!==void 0)return u;if((u=i[d])!==void 0)return o(d,u),u},set(d,u){d in r?r[d]=u:o(d,u)}}},jp="!",kv=":",m4=[],Sv=(n,s,r,i,o)=>({modifiers:n,hasImportantModifier:s,baseClassName:r,maybePostfixModifierPosition:i,isExternal:o}),f4=n=>{const{prefix:s,experimentalParseClassName:r}=n;let i=o=>{const d=[];let u=0,h=0,f=0,p;const y=o.length;for(let T=0;T<y;T++){const S=o[T];if(u===0&&h===0){if(S===kv){d.push(o.slice(f,T)),f=T+1;continue}if(S==="/"){p=T;continue}}S==="["?u++:S==="]"?u--:S==="("?h++:S===")"&&h--}const b=d.length===0?o:o.slice(f);let v=b,N=!1;b.endsWith(jp)?(v=b.slice(0,-1),N=!0):b.startsWith(jp)&&(v=b.slice(1),N=!0);const j=p&&p>f?p-f:void 0;return Sv(d,N,v,j)};if(s){const o=s+kv,d=i;i=u=>u.startsWith(o)?d(u.slice(o.length)):Sv(m4,!1,u,void 0,!0)}if(r){const o=i;i=d=>r({className:d,parseClassName:o})}return i},p4=n=>{const s=new Map;return n.orderSensitiveModifiers.forEach((r,i)=>{s.set(r,1e6+i)}),r=>{const i=[];let o=[];for(let d=0;d<r.length;d++){const u=r[d],h=u[0]==="[",f=s.has(u);h||f?(o.length>0&&(o.sort(),i.push(...o),o=[]),i.push(u)):o.push(u)}return o.length>0&&(o.sort(),i.push(...o)),i}},x4=n=>({cache:h4(n.cacheSize),parseClassName:f4(n),sortModifiers:p4(n),...n4(n)}),g4=/\s+/,y4=(n,s)=>{const{parseClassName:r,getClassGroupId:i,getConflictingClassGroupIds:o,sortModifiers:d}=s,u=[],h=n.trim().split(g4);let f="";for(let p=h.length-1;p>=0;p-=1){const y=h[p],{isExternal:b,modifiers:v,hasImportantModifier:N,baseClassName:j,maybePostfixModifierPosition:T}=r(y);if(b){f=y+(f.length>0?" "+f:f);continue}let S=!!T,k=i(S?j.substring(0,T):j);if(!k){if(!S){f=y+(f.length>0?" "+f:f);continue}if(k=i(j),!k){f=y+(f.length>0?" "+f:f);continue}S=!1}const R=v.length===0?"":v.length===1?v[0]:d(v).join(":"),I=N?R+jp:R,M=I+k;if(u.indexOf(M)>-1)continue;u.push(M);const G=o(k,S);for(let W=0;W<G.length;++W){const U=G[W];u.push(I+U)}f=y+(f.length>0?" "+f:f)}return f},b4=(...n)=>{let s=0,r,i,o="";for(;s<n.length;)(r=n[s++])&&(i=SN(r))&&(o&&(o+=" "),o+=i);return o},SN=n=>{if(typeof n=="string")return n;let s,r="";for(let i=0;i<n.length;i++)n[i]&&(s=SN(n[i]))&&(r&&(r+=" "),r+=s);return r},v4=(n,...s)=>{let r,i,o,d;const u=f=>{const p=s.reduce((y,b)=>b(y),n());return r=x4(p),i=r.cache.get,o=r.cache.set,d=h,h(f)},h=f=>{const p=i(f);if(p)return p;const y=y4(f,r);return o(f,y),y};return d=u,(...f)=>d(b4(...f))},j4=[],Bs=n=>{const s=r=>r[n]||j4;return s.isThemeGetter=!0,s},CN=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,TN=/^\((?:(\w[\w-]*):)?(.+)\)$/i,N4=/^\d+\/\d+$/,w4=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,k4=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,S4=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,C4=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,T4=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Il=n=>N4.test(n),_t=n=>!!n&&!Number.isNaN(Number(n)),qr=n=>!!n&&Number.isInteger(Number(n)),yf=n=>n.endsWith("%")&&_t(n.slice(0,-1)),hr=n=>w4.test(n),A4=()=>!0,M4=n=>k4.test(n)&&!S4.test(n),AN=()=>!1,E4=n=>C4.test(n),I4=n=>T4.test(n),R4=n=>!ot(n)&&!ct(n),D4=n=>ro(n,IN,AN),ot=n=>CN.test(n),Ai=n=>ro(n,RN,M4),bf=n=>ro(n,U4,_t),Cv=n=>ro(n,MN,AN),P4=n=>ro(n,EN,I4),tu=n=>ro(n,DN,E4),ct=n=>TN.test(n),ec=n=>io(n,RN),L4=n=>io(n,$4),Tv=n=>io(n,MN),O4=n=>io(n,IN),z4=n=>io(n,EN),su=n=>io(n,DN,!0),ro=(n,s,r)=>{const i=CN.exec(n);return i?i[1]?s(i[1]):r(i[2]):!1},io=(n,s,r=!1)=>{const i=TN.exec(n);return i?i[1]?s(i[1]):r:!1},MN=n=>n==="position"||n==="percentage",EN=n=>n==="image"||n==="url",IN=n=>n==="length"||n==="size"||n==="bg-size",RN=n=>n==="length",U4=n=>n==="number",$4=n=>n==="family-name",DN=n=>n==="shadow",B4=()=>{const n=Bs("color"),s=Bs("font"),r=Bs("text"),i=Bs("font-weight"),o=Bs("tracking"),d=Bs("leading"),u=Bs("breakpoint"),h=Bs("container"),f=Bs("spacing"),p=Bs("radius"),y=Bs("shadow"),b=Bs("inset-shadow"),v=Bs("text-shadow"),N=Bs("drop-shadow"),j=Bs("blur"),T=Bs("perspective"),S=Bs("aspect"),k=Bs("ease"),R=Bs("animate"),I=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],G=()=>[...M(),ct,ot],W=()=>["auto","hidden","clip","visible","scroll"],U=()=>["auto","contain","none"],q=()=>[ct,ot,f],V=()=>[Il,"full","auto",...q()],le=()=>[qr,"none","subgrid",ct,ot],B=()=>["auto",{span:["full",qr,ct,ot]},qr,ct,ot],be=()=>[qr,"auto",ct,ot],K=()=>["auto","min","max","fr",ct,ot],se=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],te=()=>["start","end","center","stretch","center-safe","end-safe"],Y=()=>["auto",...q()],P=()=>[Il,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...q()],F=()=>[n,ct,ot],fe=()=>[...M(),Tv,Cv,{position:[ct,ot]}],pe=()=>["no-repeat",{repeat:["","x","y","space","round"]}],C=()=>["auto","cover","contain",O4,D4,{size:[ct,ot]}],z=()=>[yf,ec,Ai],X=()=>["","none","full",p,ct,ot],re=()=>["",_t,ec,Ai],xe=()=>["solid","dashed","dotted","double"],Oe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ee=()=>[_t,yf,Tv,Cv],Qe=()=>["","none",j,ct,ot],_e=()=>["none",_t,ct,ot],st=()=>["none",_t,ct,ot],oe=()=>[_t,ct,ot],ue=()=>[Il,"full",...q()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[hr],breakpoint:[hr],color:[A4],container:[hr],"drop-shadow":[hr],ease:["in","out","in-out"],font:[R4],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[hr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[hr],shadow:[hr],spacing:["px",_t],text:[hr],"text-shadow":[hr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Il,ot,ct,S]}],container:["container"],columns:[{columns:[_t,ot,ct,h]}],"break-after":[{"break-after":I()}],"break-before":[{"break-before":I()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:G()}],overflow:[{overflow:W()}],"overflow-x":[{"overflow-x":W()}],"overflow-y":[{"overflow-y":W()}],overscroll:[{overscroll:U()}],"overscroll-x":[{"overscroll-x":U()}],"overscroll-y":[{"overscroll-y":U()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:V()}],"inset-x":[{"inset-x":V()}],"inset-y":[{"inset-y":V()}],start:[{start:V()}],end:[{end:V()}],top:[{top:V()}],right:[{right:V()}],bottom:[{bottom:V()}],left:[{left:V()}],visibility:["visible","invisible","collapse"],z:[{z:[qr,"auto",ct,ot]}],basis:[{basis:[Il,"full","auto",h,...q()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[_t,Il,"auto","initial","none",ot]}],grow:[{grow:["",_t,ct,ot]}],shrink:[{shrink:["",_t,ct,ot]}],order:[{order:[qr,"first","last","none",ct,ot]}],"grid-cols":[{"grid-cols":le()}],"col-start-end":[{col:B()}],"col-start":[{"col-start":be()}],"col-end":[{"col-end":be()}],"grid-rows":[{"grid-rows":le()}],"row-start-end":[{row:B()}],"row-start":[{"row-start":be()}],"row-end":[{"row-end":be()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":K()}],"auto-rows":[{"auto-rows":K()}],gap:[{gap:q()}],"gap-x":[{"gap-x":q()}],"gap-y":[{"gap-y":q()}],"justify-content":[{justify:[...se(),"normal"]}],"justify-items":[{"justify-items":[...te(),"normal"]}],"justify-self":[{"justify-self":["auto",...te()]}],"align-content":[{content:["normal",...se()]}],"align-items":[{items:[...te(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...te(),{baseline:["","last"]}]}],"place-content":[{"place-content":se()}],"place-items":[{"place-items":[...te(),"baseline"]}],"place-self":[{"place-self":["auto",...te()]}],p:[{p:q()}],px:[{px:q()}],py:[{py:q()}],ps:[{ps:q()}],pe:[{pe:q()}],pt:[{pt:q()}],pr:[{pr:q()}],pb:[{pb:q()}],pl:[{pl:q()}],m:[{m:Y()}],mx:[{mx:Y()}],my:[{my:Y()}],ms:[{ms:Y()}],me:[{me:Y()}],mt:[{mt:Y()}],mr:[{mr:Y()}],mb:[{mb:Y()}],ml:[{ml:Y()}],"space-x":[{"space-x":q()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":q()}],"space-y-reverse":["space-y-reverse"],size:[{size:P()}],w:[{w:[h,"screen",...P()]}],"min-w":[{"min-w":[h,"screen","none",...P()]}],"max-w":[{"max-w":[h,"screen","none","prose",{screen:[u]},...P()]}],h:[{h:["screen","lh",...P()]}],"min-h":[{"min-h":["screen","lh","none",...P()]}],"max-h":[{"max-h":["screen","lh",...P()]}],"font-size":[{text:["base",r,ec,Ai]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,ct,bf]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",yf,ot]}],"font-family":[{font:[L4,ot,s]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,ct,ot]}],"line-clamp":[{"line-clamp":[_t,"none",ct,bf]}],leading:[{leading:[d,...q()]}],"list-image":[{"list-image":["none",ct,ot]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ct,ot]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:F()}],"text-color":[{text:F()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...xe(),"wavy"]}],"text-decoration-thickness":[{decoration:[_t,"from-font","auto",ct,Ai]}],"text-decoration-color":[{decoration:F()}],"underline-offset":[{"underline-offset":[_t,"auto",ct,ot]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:q()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ct,ot]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ct,ot]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:fe()}],"bg-repeat":[{bg:pe()}],"bg-size":[{bg:C()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},qr,ct,ot],radial:["",ct,ot],conic:[qr,ct,ot]},z4,P4]}],"bg-color":[{bg:F()}],"gradient-from-pos":[{from:z()}],"gradient-via-pos":[{via:z()}],"gradient-to-pos":[{to:z()}],"gradient-from":[{from:F()}],"gradient-via":[{via:F()}],"gradient-to":[{to:F()}],rounded:[{rounded:X()}],"rounded-s":[{"rounded-s":X()}],"rounded-e":[{"rounded-e":X()}],"rounded-t":[{"rounded-t":X()}],"rounded-r":[{"rounded-r":X()}],"rounded-b":[{"rounded-b":X()}],"rounded-l":[{"rounded-l":X()}],"rounded-ss":[{"rounded-ss":X()}],"rounded-se":[{"rounded-se":X()}],"rounded-ee":[{"rounded-ee":X()}],"rounded-es":[{"rounded-es":X()}],"rounded-tl":[{"rounded-tl":X()}],"rounded-tr":[{"rounded-tr":X()}],"rounded-br":[{"rounded-br":X()}],"rounded-bl":[{"rounded-bl":X()}],"border-w":[{border:re()}],"border-w-x":[{"border-x":re()}],"border-w-y":[{"border-y":re()}],"border-w-s":[{"border-s":re()}],"border-w-e":[{"border-e":re()}],"border-w-t":[{"border-t":re()}],"border-w-r":[{"border-r":re()}],"border-w-b":[{"border-b":re()}],"border-w-l":[{"border-l":re()}],"divide-x":[{"divide-x":re()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":re()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...xe(),"hidden","none"]}],"divide-style":[{divide:[...xe(),"hidden","none"]}],"border-color":[{border:F()}],"border-color-x":[{"border-x":F()}],"border-color-y":[{"border-y":F()}],"border-color-s":[{"border-s":F()}],"border-color-e":[{"border-e":F()}],"border-color-t":[{"border-t":F()}],"border-color-r":[{"border-r":F()}],"border-color-b":[{"border-b":F()}],"border-color-l":[{"border-l":F()}],"divide-color":[{divide:F()}],"outline-style":[{outline:[...xe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[_t,ct,ot]}],"outline-w":[{outline:["",_t,ec,Ai]}],"outline-color":[{outline:F()}],shadow:[{shadow:["","none",y,su,tu]}],"shadow-color":[{shadow:F()}],"inset-shadow":[{"inset-shadow":["none",b,su,tu]}],"inset-shadow-color":[{"inset-shadow":F()}],"ring-w":[{ring:re()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:F()}],"ring-offset-w":[{"ring-offset":[_t,Ai]}],"ring-offset-color":[{"ring-offset":F()}],"inset-ring-w":[{"inset-ring":re()}],"inset-ring-color":[{"inset-ring":F()}],"text-shadow":[{"text-shadow":["none",v,su,tu]}],"text-shadow-color":[{"text-shadow":F()}],opacity:[{opacity:[_t,ct,ot]}],"mix-blend":[{"mix-blend":[...Oe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Oe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[_t]}],"mask-image-linear-from-pos":[{"mask-linear-from":Ee()}],"mask-image-linear-to-pos":[{"mask-linear-to":Ee()}],"mask-image-linear-from-color":[{"mask-linear-from":F()}],"mask-image-linear-to-color":[{"mask-linear-to":F()}],"mask-image-t-from-pos":[{"mask-t-from":Ee()}],"mask-image-t-to-pos":[{"mask-t-to":Ee()}],"mask-image-t-from-color":[{"mask-t-from":F()}],"mask-image-t-to-color":[{"mask-t-to":F()}],"mask-image-r-from-pos":[{"mask-r-from":Ee()}],"mask-image-r-to-pos":[{"mask-r-to":Ee()}],"mask-image-r-from-color":[{"mask-r-from":F()}],"mask-image-r-to-color":[{"mask-r-to":F()}],"mask-image-b-from-pos":[{"mask-b-from":Ee()}],"mask-image-b-to-pos":[{"mask-b-to":Ee()}],"mask-image-b-from-color":[{"mask-b-from":F()}],"mask-image-b-to-color":[{"mask-b-to":F()}],"mask-image-l-from-pos":[{"mask-l-from":Ee()}],"mask-image-l-to-pos":[{"mask-l-to":Ee()}],"mask-image-l-from-color":[{"mask-l-from":F()}],"mask-image-l-to-color":[{"mask-l-to":F()}],"mask-image-x-from-pos":[{"mask-x-from":Ee()}],"mask-image-x-to-pos":[{"mask-x-to":Ee()}],"mask-image-x-from-color":[{"mask-x-from":F()}],"mask-image-x-to-color":[{"mask-x-to":F()}],"mask-image-y-from-pos":[{"mask-y-from":Ee()}],"mask-image-y-to-pos":[{"mask-y-to":Ee()}],"mask-image-y-from-color":[{"mask-y-from":F()}],"mask-image-y-to-color":[{"mask-y-to":F()}],"mask-image-radial":[{"mask-radial":[ct,ot]}],"mask-image-radial-from-pos":[{"mask-radial-from":Ee()}],"mask-image-radial-to-pos":[{"mask-radial-to":Ee()}],"mask-image-radial-from-color":[{"mask-radial-from":F()}],"mask-image-radial-to-color":[{"mask-radial-to":F()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":M()}],"mask-image-conic-pos":[{"mask-conic":[_t]}],"mask-image-conic-from-pos":[{"mask-conic-from":Ee()}],"mask-image-conic-to-pos":[{"mask-conic-to":Ee()}],"mask-image-conic-from-color":[{"mask-conic-from":F()}],"mask-image-conic-to-color":[{"mask-conic-to":F()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:fe()}],"mask-repeat":[{mask:pe()}],"mask-size":[{mask:C()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ct,ot]}],filter:[{filter:["","none",ct,ot]}],blur:[{blur:Qe()}],brightness:[{brightness:[_t,ct,ot]}],contrast:[{contrast:[_t,ct,ot]}],"drop-shadow":[{"drop-shadow":["","none",N,su,tu]}],"drop-shadow-color":[{"drop-shadow":F()}],grayscale:[{grayscale:["",_t,ct,ot]}],"hue-rotate":[{"hue-rotate":[_t,ct,ot]}],invert:[{invert:["",_t,ct,ot]}],saturate:[{saturate:[_t,ct,ot]}],sepia:[{sepia:["",_t,ct,ot]}],"backdrop-filter":[{"backdrop-filter":["","none",ct,ot]}],"backdrop-blur":[{"backdrop-blur":Qe()}],"backdrop-brightness":[{"backdrop-brightness":[_t,ct,ot]}],"backdrop-contrast":[{"backdrop-contrast":[_t,ct,ot]}],"backdrop-grayscale":[{"backdrop-grayscale":["",_t,ct,ot]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[_t,ct,ot]}],"backdrop-invert":[{"backdrop-invert":["",_t,ct,ot]}],"backdrop-opacity":[{"backdrop-opacity":[_t,ct,ot]}],"backdrop-saturate":[{"backdrop-saturate":[_t,ct,ot]}],"backdrop-sepia":[{"backdrop-sepia":["",_t,ct,ot]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":q()}],"border-spacing-x":[{"border-spacing-x":q()}],"border-spacing-y":[{"border-spacing-y":q()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ct,ot]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[_t,"initial",ct,ot]}],ease:[{ease:["linear","initial",k,ct,ot]}],delay:[{delay:[_t,ct,ot]}],animate:[{animate:["none",R,ct,ot]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[T,ct,ot]}],"perspective-origin":[{"perspective-origin":G()}],rotate:[{rotate:_e()}],"rotate-x":[{"rotate-x":_e()}],"rotate-y":[{"rotate-y":_e()}],"rotate-z":[{"rotate-z":_e()}],scale:[{scale:st()}],"scale-x":[{"scale-x":st()}],"scale-y":[{"scale-y":st()}],"scale-z":[{"scale-z":st()}],"scale-3d":["scale-3d"],skew:[{skew:oe()}],"skew-x":[{"skew-x":oe()}],"skew-y":[{"skew-y":oe()}],transform:[{transform:[ct,ot,"","none","gpu","cpu"]}],"transform-origin":[{origin:G()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ue()}],"translate-x":[{"translate-x":ue()}],"translate-y":[{"translate-y":ue()}],"translate-z":[{"translate-z":ue()}],"translate-none":["translate-none"],accent:[{accent:F()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:F()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ct,ot]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":q()}],"scroll-mx":[{"scroll-mx":q()}],"scroll-my":[{"scroll-my":q()}],"scroll-ms":[{"scroll-ms":q()}],"scroll-me":[{"scroll-me":q()}],"scroll-mt":[{"scroll-mt":q()}],"scroll-mr":[{"scroll-mr":q()}],"scroll-mb":[{"scroll-mb":q()}],"scroll-ml":[{"scroll-ml":q()}],"scroll-p":[{"scroll-p":q()}],"scroll-px":[{"scroll-px":q()}],"scroll-py":[{"scroll-py":q()}],"scroll-ps":[{"scroll-ps":q()}],"scroll-pe":[{"scroll-pe":q()}],"scroll-pt":[{"scroll-pt":q()}],"scroll-pr":[{"scroll-pr":q()}],"scroll-pb":[{"scroll-pb":q()}],"scroll-pl":[{"scroll-pl":q()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ct,ot]}],fill:[{fill:["none",...F()]}],"stroke-w":[{stroke:[_t,ec,Ai,bf]}],stroke:[{stroke:["none",...F()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},_4=v4(B4);function me(...n){return _4(jN(n))}function Oi(){const n=globalThis.crypto;if(typeof n?.randomUUID=="function")return n.randomUUID();const s=V4(16);s[6]=s[6]&15|64,s[8]=s[8]&63|128;const r=Array.from(s,i=>i.toString(16).padStart(2,"0"));return`${r.slice(0,4).join("")}-${r.slice(4,6).join("")}-${r.slice(6,8).join("")}-${r.slice(8,10).join("")}-${r.slice(10,16).join("")}`}function V4(n){const s=new Uint8Array(n),r=globalThis.crypto;if(typeof r?.getRandomValues=="function")return r.getRandomValues(s),s;for(let i=0;i<s.length;i++)s[i]=Math.floor(Math.random()*256);return s}function PN(n){if(n.includes("----")){const s=[],r=/-{4,}/g;let i=0,o;for(;(o=r.exec(n))!==null;)s.push(n.slice(i,o.index)+"-".repeat(o[0].length-4)),i=o.index+o[0].length;return s.push(n.slice(i)),s}return n.includes(" ")?n.split(" "):n.split(/\s{2,}/)}const K4=hx("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-xl text-sm font-medium transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90 hover:-translate-y-px hover:shadow-[var(--glass-shadow-glow)]",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90 hover:-translate-y-px hover:shadow-[0_0_0_1px_rgba(239,68,68,0.25),0_8px_24px_rgba(239,68,68,0.25)]",outline:"border border-[var(--glass-border-strong)] bg-[var(--glass-bg-subtle)] backdrop-blur-md shadow-sm hover:bg-[var(--glass-bg)] hover:text-foreground hover:-translate-y-px",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80 hover:-translate-y-px",ghost:"hover:bg-white/40 dark:hover:bg-white/5 hover:text-foreground",link:"text-primary underline-offset-4 hover:underline",gradient:"gradient-bg-primary shadow-md hover:-translate-y-px breathe-glow text-white border-0"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-lg px-3 text-xs",lg:"h-11 rounded-xl px-6 text-base",cta:"h-12 rounded-2xl px-8 text-base font-semibold",icon:"h-9 w-9 rounded-lg"}},defaultVariants:{variant:"default",size:"default"}}),D=g.forwardRef(({className:n,variant:s,size:r,...i},o)=>e.jsx("button",{className:me(K4({variant:s,size:r,className:n})),ref:o,...i}));D.displayName="Button";const De=g.forwardRef(({className:n,variant:s="glass",interactive:r=!1,...i},o)=>{const d={glass:"glass-card text-card-foreground","glass-strong":"glass-card-strong text-card-foreground","glass-subtle":"glass-card-subtle text-card-foreground",solid:"bg-card text-card-foreground border shadow",elevated:"bg-card text-card-foreground border shadow-lg"};return e.jsx("div",{ref:o,className:me("rounded-2xl",d[s],r&&"hover-lift cursor-pointer",n),...i})});De.displayName="Card";const at=g.forwardRef(({className:n,...s},r)=>e.jsx("div",{ref:r,className:me("flex flex-col space-y-1.5 p-6",n),...s}));at.displayName="CardHeader";const rt=g.forwardRef(({className:n,...s},r)=>e.jsx("div",{ref:r,className:me("font-semibold leading-none tracking-tight",n),...s}));rt.displayName="CardTitle";const Gl=g.forwardRef(({className:n,...s},r)=>e.jsx("div",{ref:r,className:me("text-sm text-muted-foreground",n),...s}));Gl.displayName="CardDescription";const Pe=g.forwardRef(({className:n,...s},r)=>e.jsx("div",{ref:r,className:me("p-6 pt-0",n),...s}));Pe.displayName="CardContent";const H4=g.forwardRef(({className:n,...s},r)=>e.jsx("div",{ref:r,className:me("flex items-center p-6 pt-0",n),...s}));H4.displayName="CardFooter";const Gu=g.forwardRef(({className:n,value:s=0,max:r=100,indicatorClassName:i,...o},d)=>{const u=Math.min(100,Math.max(0,s/r*100));return e.jsx("div",{ref:d,className:me("relative h-2 w-full overflow-hidden rounded-full bg-secondary",n),...o,children:e.jsx("div",{className:me("h-full w-full flex-1 bg-primary transition-all",u>80&&"bg-warning",u>95&&"bg-destructive",i),style:{transform:`translateX(-${100-u}%)`}})})});Gu.displayName="Progress";const F4=hx("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-transparent bg-destructive text-destructive-foreground shadow",outline:"text-foreground",success:"border-transparent bg-success text-white shadow"}},defaultVariants:{variant:"default"}});function $e({className:n,variant:s,...r}){return e.jsx("div",{className:me(F4({variant:s}),n),...r})}const G4=hx("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),q4=g.forwardRef(({className:n,variant:s,...r},i)=>e.jsx("div",{ref:i,role:"alert",className:me(G4({variant:s}),n),...r}));q4.displayName="Alert";const X4=g.forwardRef(({className:n,...s},r)=>e.jsx("h5",{ref:r,className:me("mb-1 font-medium leading-none tracking-tight",n),...s}));X4.displayName="AlertTitle";const Y4=g.forwardRef(({className:n,...s},r)=>e.jsx("div",{ref:r,className:me("text-sm [&_p]:leading-relaxed",n),...s}));Y4.displayName="AlertDescription";function Pa({checked:n,onChange:s,disabled:r=!1,size:i="md"}){const d={sm:{track:"w-8 h-4",thumb:"w-3 h-3",translate:"translate-x-4"},md:{track:"w-11 h-6",thumb:"w-5 h-5",translate:"translate-x-5"}}[i];return e.jsx("button",{type:"button",role:"switch","aria-checked":n,disabled:r,onClick:()=>!r&&s(!n),className:me("relative inline-flex shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-all duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 focus-visible:ring-offset-2",d.track,n?"bg-[linear-gradient(135deg,var(--gradient-from),var(--gradient-to))] shadow-[0_2px_8px_rgba(91,140,255,0.35)]":"bg-foreground/20 dark:bg-foreground/15 shadow-inner",r&&"opacity-50 cursor-not-allowed"),children:e.jsx("span",{className:me("pointer-events-none inline-block rounded-full bg-white shadow-md ring-1 ring-black/5 transition-transform duration-200 ease-in-out",d.thumb,n?d.translate:"translate-x-0")})})}const W4=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Q4=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(s,r,i)=>i?i.toUpperCase():r.toLowerCase()),Av=n=>{const s=Q4(n);return s.charAt(0).toUpperCase()+s.slice(1)},LN=(...n)=>n.filter((s,r,i)=>!!s&&s.trim()!==""&&i.indexOf(s)===r).join(" ").trim(),Z4=n=>{for(const s in n)if(s.startsWith("aria-")||s==="role"||s==="title")return!0};var J4={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const e3=g.forwardRef(({color:n="currentColor",size:s=24,strokeWidth:r=2,absoluteStrokeWidth:i,className:o="",children:d,iconNode:u,...h},f)=>g.createElement("svg",{ref:f,...J4,width:s,height:s,stroke:n,strokeWidth:i?Number(r)*24/Number(s):r,className:LN("lucide",o),...!d&&!Z4(h)&&{"aria-hidden":"true"},...h},[...u.map(([p,y])=>g.createElement(p,y)),...Array.isArray(d)?d:[d]]));const Ae=(n,s)=>{const r=g.forwardRef(({className:i,...o},d)=>g.createElement(e3,{ref:d,iconNode:s,className:LN(`lucide-${W4(Av(n))}`,`lucide-${n}`,i),...o}));return r.displayName=Av(n),r};const t3=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Ks=Ae("activity",t3);const s3=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],ON=Ae("archive",s3);const n3=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],zN=Ae("arrow-down",n3);const a3=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],r3=Ae("arrow-left",a3);const i3=[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]],Mv=Ae("arrow-right-left",i3);const l3=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Np=Ae("arrow-right",l3);const o3=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]],c3=Ae("at-sign",o3);const d3=[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],jc=Ae("ban",d3);const u3=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],wp=Ae("bell",u3);const h3=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],UN=Ae("bot",h3);const m3=[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]],f3=Ae("braces",m3);const p3=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],x3=Ae("brain",p3);const g3=[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]],$N=Ae("bug",g3);const y3=[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],b3=Ae("calendar-clock",y3);const v3=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],j3=Ae("calendar",v3);const N3=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],Lu=Ae("chart-column",N3);const w3=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Pt=Ae("check",w3);const k3=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],va=Ae("chevron-down",k3);const S3=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],BN=Ae("chevron-right",S3);const C3=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],zi=Ae("chevron-up",C3);const T3=[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]],_N=Ae("chevrons-down",T3);const A3=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],ln=Ae("circle-alert",A3);const M3=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Bn=Ae("circle-check-big",M3);const E3=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],an=Ae("circle-check",E3);const I3=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],fs=Ae("circle-x",I3);const R3=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]],vf=Ae("clipboard",R3);const D3=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Gn=Ae("clock",D3);const P3=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],L3=Ae("code-xml",P3);const O3=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],z3=Ae("code",O3);const U3=[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]],$3=Ae("coins",U3);const B3=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],As=Ae("copy",B3);const _3=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],ai=Ae("cpu",_3);const V3=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],$a=Ae("credit-card",V3);const K3=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],kp=Ae("database",K3);const H3=[["rect",{width:"12",height:"12",x:"2",y:"10",rx:"2",ry:"2",key:"6agr2n"}],["path",{d:"m17.92 14 3.5-3.5a2.24 2.24 0 0 0 0-3l-5-4.92a2.24 2.24 0 0 0-3 0L10 6",key:"1o487t"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 14h.01",key:"ssrbsk"}],["path",{d:"M15 6h.01",key:"cblpky"}],["path",{d:"M18 9h.01",key:"2061c0"}]],F3=Ae("dices",H3);const G3=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Ns=Ae("download",G3);const q3=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Xs=Ae("external-link",q3);const X3=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Jl=Ae("eye-off",X3);const Y3=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Nc=Ae("eye",Y3);const W3=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]],VN=Ae("file-braces",W3);const Q3=[["path",{d:"M13.85 22H18a2 2 0 0 0 2-2V8a2 2 0 0 0-.586-1.414l-4-4A2 2 0 0 0 14 2H6a2 2 0 0 0-2 2v6.6",key:"1l4p50"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m3.305 19.53.923-.382",key:"ao1pio"}],["path",{d:"m4.228 16.852-.924-.383",key:"1fv9zy"}],["path",{d:"m5.852 15.228-.383-.923",key:"1a9hc2"}],["path",{d:"m5.852 20.772-.383.924",key:"1sh9ke"}],["path",{d:"m8.148 15.228.383-.923",key:"4yu6lf"}],["path",{d:"m8.53 21.696-.382-.924",key:"18b0s9"}],["path",{d:"m9.773 16.852.922-.383",key:"ti6xop"}],["path",{d:"m9.773 19.148.922.383",key:"rws47d"}],["circle",{cx:"7",cy:"18",r:"3",key:"lvkj7j"}]],Z3=Ae("file-cog",Q3);const J3=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],xr=Ae("file-text",J3);const eA=[["path",{d:"M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4",key:"1nerag"}],["path",{d:"M14 13.12c0 2.38 0 6.38-1 8.88",key:"o46ks0"}],["path",{d:"M17.29 21.02c.12-.6.43-2.3.5-3.02",key:"ptglia"}],["path",{d:"M2 12a10 10 0 0 1 18-6",key:"ydlgp0"}],["path",{d:"M2 16h.01",key:"1gqxmh"}],["path",{d:"M21.8 16c.2-2 .131-5.354 0-6",key:"drycrb"}],["path",{d:"M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2",key:"1tidbn"}],["path",{d:"M8.65 22c.21-.66.45-1.32.57-2",key:"13wd9y"}],["path",{d:"M9 6.8a6 6 0 0 1 9 5.2v2",key:"1fr1j5"}]],eo=Ae("fingerprint-pattern",eA);const tA=[["path",{d:"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528",key:"1jaruq"}]],sA=Ae("flag",tA);const nA=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Vi=Ae("folder-open",nA);const aA=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Sp=Ae("folder-plus",aA);const rA=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],fx=Ae("funnel",rA);const iA=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],lA=Ae("gauge",iA);const oA=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],jf=Ae("github",oA);const cA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],ri=Ae("globe",cA);const dA=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],uA=Ae("grip-vertical",dA);const hA=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],KN=Ae("hash",hA);const mA=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],tc=Ae("history",mA);const fA=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],pA=Ae("house",fA);const xA=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],HN=Ae("image",xA);const gA=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]],Ev=Ae("inbox",gA);const yA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Va=Ae("info",yA);const bA=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],ii=Ae("key-round",bA);const vA=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],Dc=Ae("key",vA);const jA=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],NA=Ae("layers",jA);const wA=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],kA=Ae("layout-grid",wA);const SA=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],ql=Ae("link-2",SA);const CA=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],qu=Ae("list-checks",CA);const TA=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],AA=Ae("list",TA);const MA=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],bt=Ae("loader-circle",MA);const EA=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],FN=Ae("lock",EA);const IA=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],px=Ae("log-out",IA);const RA=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],xx=Ae("mail",RA);const DA=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],gx=Ae("message-square",DA);const PA=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],LA=Ae("minimize-2",PA);const OA=[["path",{d:"M5 12h14",key:"1ays0h"}]],wc=Ae("minus",OA);const zA=[["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}],["path",{d:"M12 13V7",key:"h0r20n"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]],UA=Ae("monitor-up",zA);const $A=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],Vl=Ae("monitor",$A);const BA=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],_A=Ae("moon",BA);const VA=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],Ki=Ae("network",VA);const KA=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],GN=Ae("palette",KA);const HA=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],Cp=Ae("pause",HA);const FA=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],Nf=Ae("pen-line",FA);const GA=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],yx=Ae("pen",GA);const qA=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],XA=Ae("pencil",qA);const YA=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],Ba=Ae("play",YA);const WA=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Ts=Ae("plus",WA);const QA=[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],qN=Ae("power-off",QA);const ZA=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],kc=Ae("power",ZA);const JA=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Mt=Ae("refresh-cw",JA);const eM=[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]],XN=Ae("repeat",eM);const tM=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],gr=Ae("rotate-ccw",tM);const sM=[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]],nM=Ae("route",sM);const aM=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],bx=Ae("save",aM);const rM=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],iM=Ae("scroll-text",rM);const lM=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],to=Ae("search",lM);const oM=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],cM=Ae("send",oM);const dM=[["path",{d:"m10.852 14.772-.383.923",key:"11vil6"}],["path",{d:"M13.148 14.772a3 3 0 1 0-2.296-5.544l-.383-.923",key:"1v3clb"}],["path",{d:"m13.148 9.228.383-.923",key:"t2zzyc"}],["path",{d:"m13.53 15.696-.382-.924a3 3 0 1 1-2.296-5.544",key:"1bxfiv"}],["path",{d:"m14.772 10.852.923-.383",key:"k9m8cz"}],["path",{d:"m14.772 13.148.923.383",key:"1xvhww"}],["path",{d:"M4.5 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-.5",key:"tn8das"}],["path",{d:"M4.5 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-.5",key:"1g2pve"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M6 6h.01",key:"1utrut"}],["path",{d:"m9.228 10.852-.923-.383",key:"1wtb30"}],["path",{d:"m9.228 13.148-.923.383",key:"1a830x"}]],uM=Ae("server-cog",dM);const hM=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],Sc=Ae("server",hM);const mM=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],Ka=Ae("settings-2",mM);const fM=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Tp=Ae("settings",fM);const pM=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],xc=Ae("shield-alert",pM);const xM=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Ap=Ae("shield-check",xM);const gM=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],Vn=Ae("shield",gM);const yM=[["path",{d:"m18 14 4 4-4 4",key:"10pe0f"}],["path",{d:"m18 2 4 4-4 4",key:"pucp1d"}],["path",{d:"M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22",key:"1ailkh"}],["path",{d:"M2 6h1.972a4 4 0 0 1 3.6 2.2",key:"km57vx"}],["path",{d:"M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45",key:"os18l9"}]],Kn=Ae("shuffle",yM);const bM=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],Hi=Ae("sparkles",bM);const vM=[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Cc=Ae("square-check-big",vM);const jM=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],Ou=Ae("square-pen",jM);const NM=[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],wM=Ae("square-terminal",NM);const kM=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Cn=Ae("square",kM);const SM=[["path",{d:"M11 2v2",key:"1539x4"}],["path",{d:"M5 2v2",key:"1yf1q8"}],["path",{d:"M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1",key:"rb5t3r"}],["path",{d:"M8 15a6 6 0 0 0 12 0v-3",key:"x18d4x"}],["circle",{cx:"20",cy:"10",r:"2",key:"ts1r5v"}]],vx=Ae("stethoscope",SM);const CM=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],TM=Ae("sun",CM);const AM=[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]],MM=Ae("table",AM);const EM=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],Xl=Ae("tag",EM);const IM=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],YN=Ae("terminal",IM);const RM=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],DM=Ae("timer",RM);const PM=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Vt=Ae("trash-2",PM);const LM=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],WN=Ae("trending-up",LM);const OM=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Rs=Ae("triangle-alert",OM);const zM=[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]],QN=Ae("unlink",zM);const UM=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Fa=Ae("upload",UM);const $M=[["path",{d:"m16 11 2 2 4-4",key:"9rsbq5"}],["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Iv=Ae("user-check",$M);const BM=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],zu=Ae("user-plus",BM);const _M=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]],VM=Ae("user-x",_M);const KM=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Mp=Ae("user",KM);const HM=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Fn=Ae("users",HM);const FM=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],GM=Ae("workflow",FM);const qM=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ns=Ae("x",qM);const XM=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Ds=Ae("zap",XM);function ei({value:n,options:s,onChange:r,placeholder:i="请选择",className:o}){const[d,u]=g.useState(!1),h=g.useRef(null),f=s.find(p=>p.value===n);return g.useEffect(()=>{const p=y=>{h.current&&!h.current.contains(y.target)&&u(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[]),e.jsxs("div",{ref:h,className:me("relative",o),children:[e.jsxs("button",{type:"button",onClick:()=>u(!d),className:me("flex items-center justify-between gap-2 px-3 py-2 w-full rounded-lg border bg-[var(--glass-bg)] backdrop-blur-md text-sm transition-all duration-200 shadow-sm","hover:border-primary/50 hover:bg-[var(--glass-bg-strong)]",d&&"border-primary/50 ring-2 ring-primary/30",!d&&"border-foreground/15"),children:[e.jsx("span",{className:me(!f&&"text-muted-foreground"),children:f?.label||i}),e.jsx(va,{className:me("h-4 w-4 text-muted-foreground transition-transform duration-200",d&&"rotate-180")})]}),d&&e.jsx("div",{className:"absolute top-full left-0 right-0 mt-1 py-1 rounded-xl glass-card-strong z-50 animate-in fade-in-0 zoom-in-95 duration-100",children:s.map(p=>e.jsxs("button",{type:"button",onClick:()=>{r(p.value),u(!1)},className:me("flex items-center justify-between w-full px-3 py-2 text-sm text-left transition-colors","hover:bg-primary/10",p.value===n&&"bg-primary/5"),children:[e.jsxs("div",{children:[e.jsx("p",{className:me("font-medium",p.value===n&&"text-primary"),children:p.label}),p.description&&e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:p.description})]}),p.value===n&&e.jsx(Pt,{className:"h-4 w-4 text-primary shrink-0"})]},p.value))})]})}const it=g.forwardRef(({className:n,type:s,...r},i)=>e.jsx("input",{type:s,className:me("flex h-9 w-full rounded-lg border border-foreground/15 bg-[var(--glass-bg)] backdrop-blur-md px-3 py-1 text-sm shadow-sm transition-all file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground hover:border-foreground/25 focus-visible:outline-none focus-visible:border-primary/50 focus-visible:ring-2 focus-visible:ring-primary/30 disabled:cursor-not-allowed disabled:opacity-50",n),ref:i,...r}));it.displayName="Input";const Fe=g.forwardRef(({className:n,...s},r)=>e.jsx("label",{ref:r,className:me("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",n),...s}));Fe.displayName="Label";const is=g.forwardRef(({id:n,checked:s=!1,onCheckedChange:r,disabled:i,className:o},d)=>e.jsx("button",{ref:d,id:n,role:"switch","aria-checked":s,disabled:i,onClick:()=>r?.(!s),className:me("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",s?"bg-[linear-gradient(135deg,var(--gradient-from),var(--gradient-to))] shadow-[0_2px_8px_rgba(91,140,255,0.35)]":"bg-foreground/20 dark:bg-foreground/15 shadow-inner",o),children:e.jsx("span",{className:me("pointer-events-none block h-4 w-4 rounded-full bg-white shadow-md ring-1 ring-black/5 transition-transform duration-200",s?"translate-x-4":"translate-x-0")})}));is.displayName="Switch";const Rv=n=>{let s;const r=new Set,i=(p,y)=>{const b=typeof p=="function"?p(s):p;if(!Object.is(b,s)){const v=s;s=y??(typeof b!="object"||b===null)?b:Object.assign({},s,b),r.forEach(N=>N(s,v))}},o=()=>s,h={setState:i,getState:o,getInitialState:()=>f,subscribe:p=>(r.add(p),()=>r.delete(p))},f=s=n(i,o,h);return h},YM=(n=>n?Rv(n):Rv),WM=n=>n;function QM(n,s=WM){const r=Yd.useSyncExternalStore(n.subscribe,Yd.useCallback(()=>s(n.getState()),[n,s]),Yd.useCallback(()=>s(n.getInitialState()),[n,s]));return Yd.useDebugValue(r),r}const ZM=n=>{const s=YM(n),r=i=>QM(s,i);return Object.assign(r,s),r},jx=(n=>ZM),sn=[];for(let n=0;n<256;++n)sn.push((n+256).toString(16).slice(1));function JM(n,s=0){return(sn[n[s+0]]+sn[n[s+1]]+sn[n[s+2]]+sn[n[s+3]]+"-"+sn[n[s+4]]+sn[n[s+5]]+"-"+sn[n[s+6]]+sn[n[s+7]]+"-"+sn[n[s+8]]+sn[n[s+9]]+"-"+sn[n[s+10]]+sn[n[s+11]]+sn[n[s+12]]+sn[n[s+13]]+sn[n[s+14]]+sn[n[s+15]]).toLowerCase()}let wf;const eE=new Uint8Array(16);function tE(){if(!wf){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");wf=crypto.getRandomValues.bind(crypto)}return wf(eE)}const sE=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Dv={randomUUID:sE};function nE(n,s,r){n=n||{};const i=n.random??n.rng?.()??tE();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=i[6]&15|64,i[8]=i[8]&63|128,JM(i)}function ra(n,s,r){return Dv.randomUUID&&!n?Dv.randomUUID():nE(n)}const kf=[{id:"ipify",label:"ipify",url:"https://api.ipify.org?format=json",format:"json",ipField:"ip"},{id:"ip-api",label:"IP-API",url:"http://ip-api.com/json",format:"json",ipField:"query"},{id:"ipinfo",label:"IPinfo",url:"https://ipinfo.io/json",format:"json",ipField:"ip"},{id:"ip2location",label:"IP2Location",url:"https://api.ip2location.io",format:"json",ipField:"ip"},{id:"httpbin",label:"httpbin",url:"https://httpbin.org/ip",format:"json",ipField:"origin"},{id:"ifconfig",label:"ifconfig.me",url:"https://ifconfig.me/ip",format:"text"},{id:"icanhazip",label:"icanhazip",url:"https://icanhazip.com",format:"text"},{id:"ipapi-co",label:"ipapi.co",url:"https://ipapi.co/json",format:"json",ipField:"ip"}],Pv={enabled:!1,strategy:"round_robin",validateOnStartup:!1,autoDisableDead:!0,failureThreshold:3,testUrl:"https://api.ipify.org?format=json",testTimeoutMs:8e3,autoValidateIntervalMin:0,autoValidateConcurrency:5,upstreamProxy:""},Lv=[{value:"batch-completed",label:"批量任务完成",labelEn:"Batch completed"},{value:"batch-error",label:"批量任务严重错误",labelEn:"Batch error"},{value:"risk-warning",label:"风控警告触发",labelEn:"Risk warning"},{value:"account-banned",label:"账号被封禁",labelEn:"Account banned"},{value:"register-success",label:"注册成功(单账号)",labelEn:"Register success"},{value:"register-failed",label:"注册失败(单账号)",labelEn:"Register failed"},{value:"token-expired",label:"Token 过期/刷新失败",labelEn:"Token expired"}],Ov="kiro-webhooks",_n=jx()((n,s)=>({webhooks:new Map,addWebhook:r=>{const i=Oi(),o={...r,id:i,createdAt:Date.now()};return n(d=>{const u=new Map(d.webhooks);return u.set(i,o),{webhooks:u}}),s().saveToStorage(),i},updateWebhook:(r,i)=>{n(o=>{const d=new Map(o.webhooks),u=d.get(r);return u&&d.set(r,{...u,...i}),{webhooks:d}}),s().saveToStorage()},removeWebhook:r=>{n(i=>{const o=new Map(i.webhooks);return o.delete(r),{webhooks:o}}),s().saveToStorage()},toggleWebhook:r=>{n(i=>{const o=new Map(i.webhooks),d=o.get(r);return d&&o.set(r,{...d,enabled:!d.enabled}),{webhooks:o}}),s().saveToStorage()},triggerEvent:async(r,i)=>{const o=Array.from(s().webhooks.values()).filter(d=>d.enabled&&d.events.includes(r));o.length!==0&&await Promise.allSettled(o.map(d=>zv(d,i)))},testWebhook:async r=>{const i=s().webhooks.get(r);if(!i)return{success:!1,error:"Webhook 不存在"};try{return await zv(i,{title:"🧪 测试通知",message:"Đây là tin nhắn kiểm tra từ Krouter. Nếu anh thấy tin này, cấu hình Webhook đã đúng.",level:"info",fields:{时间:new Date().toLocaleString("zh-CN")}}),{success:!0}}catch(o){return{success:!1,error:o instanceof Error?o.message:String(o)}}},loadFromStorage:()=>{try{const r=localStorage.getItem(Ov);if(!r)return;const i=JSON.parse(r);if(!Array.isArray(i))return;const o=new Map;for(const d of i)o.set(d.id,d);n({webhooks:o})}catch(r){console.warn("[Webhook] Load failed:",r)}},saveToStorage:()=>{try{const r=Array.from(s().webhooks.values());localStorage.setItem(Ov,JSON.stringify(r))}catch(r){console.warn("[Webhook] Save failed:",r)}}})),Sf=new Map,ZN=20,Cf=3,aE=1500;function rE(n){const s=Date.now(),i=(Sf.get(n)||[]).filter(o=>s-o<6e4);return i.length>=ZN?(Sf.set(n,i),!1):(i.push(s),Sf.set(n,i),!0)}async function zv(n,s){if(!rE(n.id)){console.warn(`[Webhook] ${n.kind} ${n.label||n.id} rate limit exceeded (>${ZN}/min), drop`);return}const r=lE(n,s),i=n.kind==="telegram"?iE(n):n.url;let o;for(let d=0;d<=Cf;d++){if(d>0){const u=aE*Math.pow(2,d-1);await new Promise(h=>setTimeout(h,u)),console.log(`[Webhook] Retry ${d}/${Cf} for ${n.kind} ${n.label||n.id}`)}try{const u=new AbortController,h=setTimeout(()=>u.abort(),8e3),f=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r),signal:u.signal});if(clearTimeout(h),f.ok){d>0&&console.log(`[Webhook] ${n.kind} ${n.label||n.id} succeeded on retry ${d}`);return}if(f.status>=400&&f.status<500&&f.status!==408&&f.status!==429){console.warn(`[Webhook] ${n.kind} ${n.label||n.id} HTTP ${f.status} (no retry)`);return}o=new Error(`HTTP ${f.status}`)}catch(u){o=u}}console.warn(`[Webhook] ${n.kind} ${n.label||n.id} failed after ${Cf} retries:`,o)}function iE(n){return n.url.endsWith("/sendMessage")?n.url:`${n.url.replace(/\/$/,"")}/sendMessage`}function lE(n,s){const r={info:"ℹ️",warn:"⚠️",error:"❌",success:"✅"}[s.level],i=s.fields?`
|
|
18
|
+
`+Object.entries(s.fields).map(([u,h])=>`**${u}**: ${h}`).join(`
|
|
19
|
+
`):"",o=s.fields?`
|
|
20
|
+
`+Object.entries(s.fields).map(([u,h])=>`${u}: ${h}`).join(`
|
|
21
|
+
`):"",d=`${r} ${s.title}
|
|
22
|
+
|
|
23
|
+
${s.message}${o}`;switch(n.kind){case"dingtalk":return{msgtype:"markdown",markdown:{title:s.title,text:`### ${r} ${s.title}
|
|
24
|
+
|
|
25
|
+
${s.message}${i}`}};case"wechat-work":return{msgtype:"markdown",markdown:{content:`## ${r} ${s.title}
|
|
26
|
+
|
|
27
|
+
${s.message}${i}`}};case"feishu":return{msg_type:"text",content:{text:d}};case"telegram":return{chat_id:n.telegramChatId,text:d,parse_mode:"Markdown"};case"discord":return{username:"Krouter",embeds:[{title:`${r} ${s.title}`,description:s.message,color:s.level==="error"?16711680:s.level==="warn"?16755200:s.level==="success"?65280:4890367,fields:s.fields?Object.entries(s.fields).map(([u,h])=>({name:u,value:String(h),inline:!0})):void 0,timestamp:new Date().toISOString()}]};case"custom":default:{if(n.customTemplate)try{const u=n.customTemplate.replace(/\{\{title\}\}/g,Uv(s.title)).replace(/\{\{message\}\}/g,Uv(s.message)).replace(/\{\{level\}\}/g,s.level).replace(/\{\{icon\}\}/g,r);return JSON.parse(u)}catch{}return{title:s.title,message:s.message,level:s.level,fields:s.fields,timestamp:new Date().toISOString()}}}}function Uv(n){return n.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}function Tf(){const n=new Uint8Array(32);return crypto.getRandomValues(n),Array.from(n).map(s=>s.toString(16).padStart(2,"0")).join("")}let Mi=null;const Af=300*1e3,oE=500,cE=5e3;let mr=null,Xr=null,sc=null,nc=[];const ac=new Set;let Ei=null,nu=null;async function dE(n,s){try{const r=await window.api.getLocalActiveAccount();if(!r.success||!r.data?.refreshToken)return;const i=r.data.refreshToken,o=n().accounts;let d=null;for(const[b,v]of o)if(v.credentials.refreshToken===i){d=b;break}if(d){s({activeAccountId:d}),s(b=>{const v=new Map(b.accounts);for(const[N,j]of v){const T=N===d;j.isActive!==T&&v.set(N,{...j,isActive:T})}return{accounts:v}}),console.log("[Store] Synced active account from local SSO cache:",d),n().saveToStorage();return}console.log("[Store] Local account not found in app, importing...");const u=await window.api.loadKiroCredentials();if(!u.success||!u.data)return;const h=await window.api.verifyAccountCredentials({refreshToken:u.data.refreshToken,clientId:u.data.clientId||"",clientSecret:u.data.clientSecret||"",region:u.data.region,authMethod:u.data.authMethod,provider:u.data.provider,profileArn:u.data.profileArn,machineId:u.data.machineId,startUrl:u.data.startUrl});if(!h.success||!h.data)return;const f=Date.now(),p=`${h.data.email}-${f}`,y={id:p,email:h.data.email,userId:h.data.userId,nickname:h.data.email?h.data.email.split("@")[0]:void 0,idp:u.data.provider||"BuilderId",profileArn:h.data.profileArn||u.data.profileArn,machineId:u.data.machineId,credentials:{accessToken:h.data.accessToken,csrfToken:"",refreshToken:h.data.refreshToken,clientId:u.data.clientId||"",clientSecret:u.data.clientSecret||"",region:u.data.region||"us-east-1",startUrl:u.data.startUrl,expiresAt:h.data.expiresIn?f+h.data.expiresIn*1e3:f+3600*1e3,authMethod:u.data.authMethod,provider:u.data.provider||"BuilderId"},subscription:{type:h.data.subscriptionType,title:h.data.subscriptionTitle,rawType:h.data.subscription?.rawType,daysRemaining:h.data.daysRemaining,expiresAt:h.data.expiresAt,managementTarget:h.data.subscription?.managementTarget,upgradeCapability:h.data.subscription?.upgradeCapability,overageCapability:h.data.subscription?.overageCapability},usage:{current:h.data.usage.current,limit:h.data.usage.limit,percentUsed:h.data.usage.limit>0?h.data.usage.current/h.data.usage.limit:0,lastUpdated:f,baseLimit:h.data.usage.baseLimit,baseCurrent:h.data.usage.baseCurrent,freeTrialLimit:h.data.usage.freeTrialLimit,freeTrialCurrent:h.data.usage.freeTrialCurrent,freeTrialExpiry:h.data.usage.freeTrialExpiry,bonuses:h.data.usage.bonuses,nextResetDate:h.data.usage.nextResetDate,resourceDetail:h.data.usage.resourceDetail},status:"active",createdAt:f,lastUsedAt:f,tags:[],isActive:!0};s(b=>{const v=new Map(b.accounts);for(const[N,j]of v)j.isActive&&v.set(N,{...j,isActive:!1});return v.set(p,y),{accounts:v,activeAccountId:p}}),console.log("[Store] Auto-imported account from local SSO cache:",h.data.email),n().saveToStorage()}catch(r){console.warn("[Store] Failed to sync local active account:",r)}}function Yr(n){if(!n)return!1;const s=n.toLowerCase();return s.includes("accountsuspendedexception")||s.includes("account suspended")||s.includes("temporarily_suspended")||s.includes("temporarily suspended")||s.includes("user id is")&&s.includes("suspended")||s.includes("账户已封禁")||s.includes("已封禁")||/\b423\b/.test(s)?!0:(s.includes("fetch failed")||s.includes("network")||s.includes("token expired")||s.includes("token 过期")||s.includes("刷新失败")||s.includes("unauthorizedexception"),!1)}let Rl=null,Dl=null;const $v=30*1e3;let Mf="";const uE={field:"lastUsedAt",order:"desc"},Bv={},hE=()=>{try{return localStorage.getItem("accounts_activeGroupTab")||"all"}catch{return"all"}},vt=jx()((n,s)=>({appVersion:"1.0.0",accounts:new Map,groups:new Map,tags:new Map,activeAccountId:null,filter:Bv,activeGroupTab:hE(),sort:uE,selectedIds:new Set,isLoading:!1,hasLoadedStorage:!1,isSyncing:!1,autoRefreshEnabled:!0,autoRefreshInterval:5,autoRefreshConcurrency:100,autoRefreshSyncInfo:!0,statusCheckInterval:60,proactiveRenewalEnabled:!1,proactiveRenewalLeadMinutes:15,privacyMode:!1,usagePrecision:!1,proxyEnabled:!1,proxyUrl:"",autoSwitchEnabled:!1,autoSwitchThreshold:0,autoSwitchInterval:5,batchImportConcurrency:100,loginPrivateMode:!1,switchTarget:"ide",theme:"default",darkMode:!1,language:"auto",machineIdConfig:{autoSwitchOnAccountChange:!1,bindMachineIdToAccount:!1,useBindedMachineId:!0},currentMachineId:"",originalMachineId:null,originalBackupTime:null,accountMachineIds:{},machineIdHistory:[],proxyPool:new Map,proxyPoolConfig:{...Pv},proxyPoolCursor:0,accountProxyBindings:{},addAccount:r=>{const i=ra(),o=Date.now();ac.delete(i);const d=r.machineId||Tf(),u={...r,id:i,machineId:d,createdAt:o,lastUsedAt:o,isActive:!1,tags:r.tags||[]};return n(h=>{const f=new Map(h.accounts);return f.set(i,u),{accounts:f}}),s().saveToStorage(),i},updateAccount:(r,i)=>{n(o=>{const d=new Map(o.accounts),u=d.get(r);return u&&d.set(r,{...u,...i}),{accounts:d}}),s().saveToStorage()},removeAccount:r=>{ac.add(r),n(i=>{const o=new Map(i.accounts);o.delete(r);const d=new Set(i.selectedIds);d.delete(r);const u=i.activeAccountId===r?null:i.activeAccountId,h={...i.accountProxyBindings};return delete h[r],{accounts:o,selectedIds:d,activeAccountId:u,accountProxyBindings:h}}),s().saveToStorage()},removeAccounts:r=>{const i={success:0,failed:0,errors:[]};for(const o of r)ac.add(o);return n(o=>{const d=new Map(o.accounts),u=new Set(o.selectedIds);let h=o.activeAccountId;const f={...o.accountProxyBindings};for(const p of r)d.has(p)?(d.delete(p),u.delete(p),delete f[p],h===p&&(h=null),i.success++):(i.failed++,i.errors.push({id:p,error:"Account not found"}));return{accounts:d,selectedIds:u,activeAccountId:h,accountProxyBindings:f}}),s().saveToStorage(),i},setActiveAccount:async r=>{const i=s();if(n(o=>{const d=new Map(o.accounts);if(o.activeAccountId){const u=d.get(o.activeAccountId);u&&d.set(o.activeAccountId,{...u,isActive:!1})}if(r){const u=d.get(r);u&&d.set(r,{...u,isActive:!0,lastUsedAt:Date.now()})}return{accounts:d,activeAccountId:r}}),r&&i.machineIdConfig.autoSwitchOnAccountChange)try{const o=i.accounts.get(r);if(i.machineIdConfig.bindMachineIdToAccount){let u=i.accountMachineIds[r];u||(u=await window.api.machineIdGenerateRandom(),s().bindMachineIdToAccount(r,u)),i.machineIdConfig.useBindedMachineId?await s().changeMachineId(u):await s().changeMachineId()}else await s().changeMachineId();const d=s().currentMachineId;n(u=>({machineIdHistory:[...u.machineIdHistory,{id:ra(),machineId:d,timestamp:Date.now(),action:"auto_switch",accountId:r,accountEmail:o?.email}]})),console.log(`[MachineId] Auto-switched machine ID for account: ${o?.email}`)}catch(o){console.error("[MachineId] Failed to auto-switch machine ID:",o)}s().saveToStorage()},getActiveAccount:()=>{const{accounts:r,activeAccountId:i}=s();return i?r.get(i)??null:null},addGroup:r=>{const i=ra(),{groups:o}=s(),d={...r,id:i,order:o.size,createdAt:Date.now()};return n(u=>{const h=new Map(u.groups);return h.set(i,d),{groups:h}}),s().saveToStorage(),i},updateGroup:(r,i)=>{n(o=>{const d=new Map(o.groups),u=d.get(r);return u&&d.set(r,{...u,...i}),{groups:d}}),s().saveToStorage()},removeGroup:r=>{n(i=>{const o=new Map(i.groups);o.delete(r);const d=new Map(i.accounts);for(const[u,h]of d)h.groupId===r&&d.set(u,{...h,groupId:void 0});return{groups:o,accounts:d}}),s().saveToStorage()},moveAccountsToGroup:(r,i)=>{n(o=>{const d=new Map(o.accounts);for(const u of r){const h=d.get(u);h&&d.set(u,{...h,groupId:i})}return{accounts:d}}),s().saveToStorage()},addTag:r=>{const i=ra(),o={...r,id:i};return n(d=>{const u=new Map(d.tags);return u.set(i,o),{tags:u}}),s().saveToStorage(),i},updateTag:(r,i)=>{n(o=>{const d=new Map(o.tags),u=d.get(r);return u&&d.set(r,{...u,...i}),{tags:d}}),s().saveToStorage()},removeTag:r=>{n(i=>{const o=new Map(i.tags);o.delete(r);const d=new Map(i.accounts);for(const[u,h]of d)h.tags.includes(r)&&d.set(u,{...h,tags:h.tags.filter(f=>f!==r)});return{tags:o,accounts:d}}),s().saveToStorage()},addTagToAccounts:(r,i)=>{n(o=>{const d=new Map(o.accounts);for(const u of r){const h=d.get(u);h&&!h.tags.includes(i)&&d.set(u,{...h,tags:[...h.tags,i]})}return{accounts:d}}),s().saveToStorage()},removeTagFromAccounts:(r,i)=>{n(o=>{const d=new Map(o.accounts);for(const u of r){const h=d.get(u);h&&d.set(u,{...h,tags:h.tags.filter(f=>f!==i)})}return{accounts:d}}),s().saveToStorage()},setFilter:r=>{n({filter:r})},clearFilter:()=>{n({filter:Bv})},setActiveGroupTab:r=>{try{localStorage.setItem("accounts_activeGroupTab",r)}catch{}n({activeGroupTab:r})},setSort:r=>{n({sort:r})},getFilteredAccounts:()=>{const{accounts:r,filter:i,sort:o,activeGroupTab:d}=s();if(Ei&&Ei.accounts===r&&Ei.filter===i&&Ei.sort===o&&Ei.activeGroupTab===d)return Ei.output;let u=Array.from(r.values());if(d==="ungrouped"?u=u.filter(h=>!h.groupId):d!=="all"&&(u=u.filter(h=>h.groupId===d)),i.search){const h=i.search.toLowerCase();u=u.filter(f=>f.email.toLowerCase().includes(h)||f.nickname?.toLowerCase().includes(h))}return i.subscriptionTypes?.length&&(u=u.filter(h=>i.subscriptionTypes.includes(h.subscription.type))),i.statuses?.length&&(u=u.filter(h=>i.statuses.includes(h.status))),i.idps?.length&&(u=u.filter(h=>i.idps.includes(h.idp))),i.groupIds?.length&&(u=u.filter(h=>h.groupId&&i.groupIds.includes(h.groupId))),i.tagIds?.length&&(u=u.filter(h=>i.tagIds.some(f=>h.tags.includes(f)))),i.usageMin!==void 0&&(u=u.filter(h=>h.usage.percentUsed>=i.usageMin)),i.usageMax!==void 0&&(u=u.filter(h=>h.usage.percentUsed<=i.usageMax)),i.daysRemainingMin!==void 0&&(u=u.filter(h=>h.subscription.daysRemaining!==void 0&&h.subscription.daysRemaining>=i.daysRemainingMin)),i.daysRemainingMax!==void 0&&(u=u.filter(h=>h.subscription.daysRemaining!==void 0&&h.subscription.daysRemaining<=i.daysRemainingMax)),i.bannedOnly&&(u=u.filter(h=>Yr(h.lastError))),u.sort((h,f)=>{let p=0;switch(o.field){case"email":p=h.email.localeCompare(f.email);break;case"nickname":p=(h.nickname??"").localeCompare(f.nickname??"");break;case"subscription":p=h.subscription.type.localeCompare(f.subscription.type);break;case"usage":p=h.usage.percentUsed-f.usage.percentUsed;break;case"daysRemaining":p=(h.subscription.daysRemaining??999)-(f.subscription.daysRemaining??999);break;case"lastUsedAt":p=h.lastUsedAt-f.lastUsedAt;break;case"createdAt":p=h.createdAt-f.createdAt;break;case"status":p=h.status.localeCompare(f.status);break}return o.order==="desc"?-p:p}),Ei={accounts:r,filter:i,sort:o,activeGroupTab:d,output:u},u},selectAccount:r=>{n(i=>{const o=new Set(i.selectedIds);return o.add(r),{selectedIds:o}})},deselectAccount:r=>{n(i=>{const o=new Set(i.selectedIds);return o.delete(r),{selectedIds:o}})},selectAll:()=>{const r=s().getFilteredAccounts();n({selectedIds:new Set(r.map(i=>i.id))})},deselectAll:()=>{n({selectedIds:new Set})},toggleSelection:r=>{n(i=>{const o=new Set(i.selectedIds);return o.has(r)?o.delete(r):o.add(r),{selectedIds:o}})},getSelectedAccounts:()=>{const{accounts:r,selectedIds:i}=s();return Array.from(i).map(o=>r.get(o)).filter(o=>o!==void 0)},exportAccounts:r=>{const{accounts:i,groups:o,tags:d}=s();let u;return r?.length?u=r.map(f=>i.get(f)).filter(f=>f!==void 0):u=Array.from(i.values()),{version:s().appVersion,exportedAt:Date.now(),accounts:u.map(({isActive:f,...p})=>p),groups:Array.from(o.values()),tags:Array.from(d.values())}},importAccounts:r=>{const i={success:0,failed:0,errors:[]},o=["Google","Github","BuilderId"],d=h=>h&&o.find(p=>p.toLowerCase()===h.toLowerCase())||"Google",u=[];for(const h of r)try{const f=Date.now(),p=ra(),y=Tf(),b={id:p,createdAt:f,isActive:!1,machineId:y,email:h.email,password:h.password,nickname:h.nickname,idp:d(h.idp),credentials:{accessToken:h.accessToken||"",csrfToken:h.csrfToken||"",refreshToken:h.refreshToken,clientId:h.clientId,clientSecret:h.clientSecret,region:h.region||"us-east-1",expiresAt:f+3600*1e3},subscription:{type:"Free"},usage:{current:0,limit:25,percentUsed:0,lastUpdated:f},groupId:h.groupId,tags:h.tags??[],status:"unknown",lastUsedAt:f};u.push(b),i.success++}catch(f){i.failed++,i.errors.push({id:h.email,error:f instanceof Error?f.message:"Unknown error"})}return u.length>0&&(n(h=>{const f=new Map(h.accounts);for(const p of u)f.set(p.id,p);return{accounts:f}}),s().saveToStorage()),i},importFromExportData:r=>{const i={success:0,failed:0,errors:[]},{accounts:o}=s(),d=(b,v,N)=>Array.from(o.values()).some(j=>!!(v&&j.userId===v||j.email===b&&j.credentials.provider===N)),u=new Set,h=new Set,f=r.accounts.filter(b=>u.has(b.email)||b.userId&&h.has(b.userId)?!1:(u.add(b.email),b.userId&&h.add(b.userId),!0));let p=0;const y=[];for(const b of f){if(d(b.email,b.userId,b.credentials?.provider)){p++;continue}try{y.push({...b,isActive:!1}),i.success++}catch(v){i.failed++,i.errors.push({id:b.id,error:v instanceof Error?v.message:"Unknown error"})}}return(r.groups.length>0||r.tags.length>0||y.length>0)&&n(b=>{const v=r.groups.length>0?new Map(b.groups):b.groups;if(r.groups.length>0)for(const T of r.groups)v.set(T.id,T);const N=r.tags.length>0?new Map(b.tags):b.tags;if(r.tags.length>0)for(const T of r.tags)N.set(T.id,T);const j=y.length>0?new Map(b.accounts):b.accounts;if(y.length>0)for(const T of y)j.set(T.id,T);return{groups:v,tags:N,accounts:j}}),p>0&&i.errors.push({id:"skipped",error:`跳过 ${p} 个已存在的账号`}),s().saveToStorage(),i},updateAccountStatus:(r,i,o)=>{const d=Yr(s().accounts.get(r)?.lastError),u=Yr(o);if(n(h=>{const f=new Map(h.accounts),p=f.get(r);return p&&f.set(r,{...p,status:i,lastError:o,lastCheckedAt:Date.now()}),{accounts:f}}),s().saveToStorage(),u&&!d){const h=s().accounts.get(r);_v("account-banned",{title:"账号被封禁",message:`账号 ${h?.email||r} 状态变为封禁`,level:"error",fields:{邮箱:h?.email||"-",错误:o||"-"}})}},refreshAccountToken:async r=>{const{accounts:i,updateAccountStatus:o}=s(),d=i.get(r);if(!d)return!1;o(r,"refreshing");try{const u=await window.api.refreshAccountToken(d);return u.success&&u.data?(u.data.syncedToIde?console.log(`[refreshAccountToken] Token refreshed AND synced to Kiro IDE (account=${d.email})`):console.warn(`[refreshAccountToken] Token refreshed but NOT synced to Kiro IDE (account=${d.email}). Reason: ${u.data.syncSkipReason||"unknown"}. Kiro IDE will still use its previously cached token until its own refresh loop kicks in.`),n(h=>{const f=new Map(h.accounts),p=f.get(r);return p&&f.set(r,{...p,credentials:{...p.credentials,accessToken:u.data.accessToken,refreshToken:u.data.refreshToken||p.credentials.refreshToken,expiresAt:Date.now()+u.data.expiresIn*1e3},status:"active",lastError:void 0,lastCheckedAt:Date.now()}),{accounts:f}}),s().saveToStorage(),!0):(o(r,"error",u.error?.message),_v("token-expired",{title:"Token 刷新失败",message:`账号 ${d.email} Token 刷新失败`,level:"warn",fields:{邮箱:d.email,错误:u.error?.message||"-"}}),!1)}catch(u){return o(r,"error",u instanceof Error?u.message:"Unknown error"),!1}},batchRefreshTokens:async r=>{const{accounts:i,autoRefreshConcurrency:o}=s(),d=[];for(const h of r){const f=i.get(h);f?.credentials.refreshToken&&d.push({id:h,email:f.email,credentials:{refreshToken:f.credentials.refreshToken,clientId:f.credentials.clientId,clientSecret:f.credentials.clientSecret,region:f.credentials.region,authMethod:f.credentials.authMethod,accessToken:f.credentials.accessToken}})}if(d.length===0)return{success:0,failed:0,errors:[]};console.log(`[BatchRefresh] Triggering background refresh for ${d.length} accounts...`);const u=await window.api.backgroundBatchRefresh(d,o);return{success:u.successCount,failed:u.failedCount,errors:[]}},checkAccountStatus:async r=>{const{accounts:i,updateAccountStatus:o}=s(),d=i.get(r);if(d){o(r,"refreshing");try{const u=await window.api.checkAccountStatus(d);u.success&&u.data?(n(h=>{const f=new Map(h.accounts),p=f.get(r);if(p){const y=u.data.newCredentials?{...p.credentials,accessToken:u.data.newCredentials.accessToken,refreshToken:u.data.newCredentials.refreshToken??p.credentials.refreshToken,expiresAt:u.data.newCredentials.expiresAt??p.credentials.expiresAt}:p.credentials,b=u.data.usage,v=b?{current:b.current??p.usage.current,limit:b.limit??p.usage.limit,percentUsed:b.limit>0?b.current/b.limit:0,lastUpdated:b.lastUpdated??Date.now(),baseLimit:b.baseLimit,baseCurrent:b.baseCurrent,freeTrialLimit:b.freeTrialLimit,freeTrialCurrent:b.freeTrialCurrent,freeTrialExpiry:b.freeTrialExpiry,bonuses:b.bonuses,nextResetDate:b.nextResetDate,resourceDetail:b.resourceDetail}:p.usage,N=u.data.subscription,j=N?{...p.subscription,...N}:p.subscription,T=u.data.idp;let S=p.idp;T&&(T==="BuilderId"?S="BuilderId":T==="Google"?S="Google":T==="Github"?S="Github":T==="AWSIdC"?S="AWSIdC":(T==="Enterprise"||T==="Internal")&&(S="Enterprise")),f.set(r,{...p,email:u.data.email??p.email,userId:u.data.userId??p.userId,idp:S,profileArn:u.data.profileArn??p.profileArn,status:u.data.status,usage:v,subscription:j,credentials:y,lastCheckedAt:Date.now(),lastError:void 0})}return{accounts:f}}),s().saveToStorage(),u.data.newCredentials&&console.log(`[Account] Token refreshed for ${d?.email}`)):u.error?.isBanned?o(r,"error",`账户已封禁: ${u.error?.message}`):o(r,"error",u.error?.message)}catch(u){o(r,"error",u instanceof Error?u.message:"Unknown error")}}},batchCheckStatus:async r=>{const{accounts:i,autoRefreshConcurrency:o}=s(),d=[];for(const h of r){const f=i.get(h);f?.credentials.accessToken&&d.push({id:h,email:f.email,credentials:{accessToken:f.credentials.accessToken,refreshToken:f.credentials.refreshToken,clientId:f.credentials.clientId,clientSecret:f.credentials.clientSecret,region:f.credentials.region,authMethod:f.credentials.authMethod,provider:f.credentials.provider},idp:f.idp})}if(d.length===0)return{success:0,failed:0,errors:[]};console.log(`[BatchCheck] Triggering background check for ${d.length} accounts...`);const u=await window.api.backgroundBatchCheck(d,o);return{success:u.successCount,failed:u.failedCount,errors:[]}},getStats:()=>{const{accounts:r}=s();if(nu&&nu.accounts===r)return nu.output;const i=Array.from(r.values()),o={total:i.length,byStatus:{active:0,expired:0,error:0,refreshing:0,unknown:0},bySubscription:{Free:0,Pro:0,Pro_Plus:0,Enterprise:0,Teams:0},byIdp:{Google:0,Github:0,BuilderId:0,Enterprise:0,AWSIdC:0,Internal:0,IAM_SSO:0},activeCount:0,expiringSoonCount:0,bannedCount:0};for(const d of i)o.byStatus[d.status]++,o.bySubscription[d.subscription.type]++,o.byIdp[d.idp]++,d.isActive&&o.activeCount++,d.subscription.daysRemaining!==void 0&&d.subscription.daysRemaining<=7&&o.expiringSoonCount++,Yr(d.lastError)&&o.bannedCount++;return nu={accounts:r,output:o},o},loadFromStorage:async()=>{n({isLoading:!0});try{const r=await window.api.getAppVersion();n({appVersion:r});const i=await window.api.loadAccounts();if(i){ac.clear();const o=new Map(Object.entries(i.accounts??{})),d=i.activeAccountId??null;let u=!1;for(const[h,f]of o)f.machineId||(f.machineId=Tf(),o.set(h,f),u=!0,console.log(`[Store] Generated machineId for account ${f.email}: ${f.machineId.substring(0,16)}...`));for(const[h,f]of o){const p=h===d;f.isActive!==p&&o.set(h,{...f,isActive:p})}n({accounts:o,groups:new Map(Object.entries(i.groups??{})),tags:new Map(Object.entries(i.tags??{})),activeAccountId:d,autoRefreshEnabled:i.autoRefreshEnabled??!0,autoRefreshInterval:i.autoRefreshInterval??5,autoRefreshConcurrency:i.autoRefreshConcurrency??100,autoRefreshSyncInfo:i.autoRefreshSyncInfo??!0,statusCheckInterval:i.statusCheckInterval??60,privacyMode:i.privacyMode??!1,usagePrecision:i.usagePrecision??!1,proxyEnabled:i.proxyEnabled??!1,proxyUrl:i.proxyUrl??"",autoSwitchEnabled:i.autoSwitchEnabled??!1,autoSwitchThreshold:i.autoSwitchThreshold??0,autoSwitchInterval:i.autoSwitchInterval??5,switchTarget:i.switchTarget??"ide",theme:i.theme??"default",darkMode:i.darkMode??!1,language:i.language??"auto",machineIdConfig:i.machineIdConfig??{autoSwitchOnAccountChange:!1,bindMachineIdToAccount:!1,useBindedMachineId:!0},accountMachineIds:i.accountMachineIds??{},machineIdHistory:i.machineIdHistory??[],proxyPool:i.proxyPool?new Map(Object.entries(i.proxyPool)):new Map,proxyPoolConfig:{...Pv,...i.proxyPoolConfig},proxyPoolCursor:typeof i.proxyPoolCursor=="number"?i.proxyPoolCursor:0,accountProxyBindings:i.accountProxyBindings||{}}),s().applyTheme(),i.proxyEnabled&&i.proxyUrl&&s().setProxy(!0,i.proxyUrl),i.autoSwitchEnabled&&s().startAutoSwitch(),s().startAutoSave(),u&&(console.log("[Store] Saving accounts with newly generated machineIds"),s().saveToStorage()),queueMicrotask(()=>{dE(s,n)})}}catch(r){console.error("Failed to load accounts:",r)}finally{n({isLoading:!1,hasLoadedStorage:!0})}},saveToStorage:async()=>new Promise(r=>{nc.push(r);const i=async()=>{mr&&(clearTimeout(mr),mr=null),Xr&&(clearTimeout(Xr),Xr=null);const o=nc;nc=[],await s().flushSaveImmediately();for(const d of o)d()};mr&&clearTimeout(mr),mr=setTimeout(i,oE),Xr||(Xr=setTimeout(i,cE))}),flushSaveImmediately:async()=>{if(mr&&(clearTimeout(mr),mr=null),Xr&&(clearTimeout(Xr),Xr=null),sc)return await sc,s().flushSaveImmediately();const r=nc;nc=[];const{accounts:i,groups:o,tags:d,activeAccountId:u,autoRefreshEnabled:h,autoRefreshInterval:f,autoRefreshConcurrency:p,statusCheckInterval:y,privacyMode:b,usagePrecision:v,proxyEnabled:N,proxyUrl:j,autoSwitchEnabled:T,autoSwitchThreshold:S,autoSwitchInterval:k,switchTarget:R,theme:I,darkMode:M,language:G,machineIdConfig:W,accountMachineIds:U,machineIdHistory:q,proxyPool:V,proxyPoolConfig:le,proxyPoolCursor:B,accountProxyBindings:be}=s();return n({isSyncing:!0}),sc=(async()=>{try{await window.api.saveAccounts({accounts:Object.fromEntries(i),groups:Object.fromEntries(o),tags:Object.fromEntries(d),activeAccountId:u,autoRefreshEnabled:h,autoRefreshInterval:f,autoRefreshConcurrency:p,statusCheckInterval:y,privacyMode:b,usagePrecision:v,proxyEnabled:N,proxyUrl:j,autoSwitchEnabled:T,autoSwitchThreshold:S,autoSwitchInterval:k,switchTarget:R,theme:I,darkMode:M,language:G,machineIdConfig:W,accountMachineIds:U,machineIdHistory:q,proxyPool:Object.fromEntries(V),proxyPoolConfig:le,proxyPoolCursor:B,accountProxyBindings:be,_deletedAccountIds:Array.from(ac)})}catch(K){console.error("Failed to save accounts:",K)}finally{n({isSyncing:!1}),sc=null;for(const K of r)K()}})(),sc},setAutoRefresh:(r,i)=>{n({autoRefreshEnabled:r,autoRefreshInterval:i??s().autoRefreshInterval}),s().saveToStorage(),r?s().startAutoTokenRefresh():s().stopAutoTokenRefresh()},setAutoRefreshConcurrency:r=>{n({autoRefreshConcurrency:Math.max(1,Math.min(500,r))}),s().saveToStorage()},setAutoRefreshSyncInfo:r=>{n({autoRefreshSyncInfo:r}),s().saveToStorage()},setProactiveRenewalEnabled:async r=>{if(typeof window.api?.setProactiveRenewalEnabled!="function")return{success:!1,error:"API not available"};const i=await window.api.setProactiveRenewalEnabled(r);return i.success&&n({proactiveRenewalEnabled:!!i.enabled}),{success:i.success,error:i.error}},loadProactiveRenewalEnabled:async()=>{if(typeof window.api?.getProactiveRenewalEnabled=="function")try{const r=await window.api.getProactiveRenewalEnabled();r.success&&n({proactiveRenewalEnabled:!!r.enabled,proactiveRenewalLeadMinutes:r.leadTimeMinutes??15})}catch(r){console.warn("[Store] loadProactiveRenewalEnabled failed:",r)}},setStatusCheckInterval:r=>{n({statusCheckInterval:r}),s().saveToStorage()},setPrivacyMode:r=>{n({privacyMode:r}),s().saveToStorage()},maskEmail:r=>!s().privacyMode||!r?r:`${`user${(r.split("").reduce((d,u)=>d+u.charCodeAt(0),0)%1e5).toString().padStart(5,"0")}`}@***.com`,maskNickname:r=>!s().privacyMode||!r?r||"":`用户${(r.split("").reduce((o,d)=>o+d.charCodeAt(0),0)%1e5).toString().padStart(5,"0")}`,setUsagePrecision:r=>{n({usagePrecision:r}),s().saveToStorage()},setProxy:async(r,i)=>{const o=i??s().proxyUrl;n({proxyEnabled:r,proxyUrl:o}),s().saveToStorage();try{const d=await window.api.setProxy?.(r,o);d?.normalizedUrl&&d.normalizedUrl!==o&&(n({proxyUrl:d.normalizedUrl}),s().saveToStorage())}catch(d){console.error("[Store] setProxy IPC failed:",d)}},setTheme:r=>{n({theme:r}),s().saveToStorage(),s().applyTheme()},setDarkMode:r=>{n({darkMode:r}),s().saveToStorage(),s().applyTheme()},setLanguage:r=>{n({language:r}),s().saveToStorage();const i=r==="auto"?navigator.language.startsWith("zh")?"zh":"en":r;window.api.updateTrayLanguage(i)},applyTheme:()=>{const{theme:r,darkMode:i}=s(),o=document.documentElement;o.classList.remove("dark","theme-indigo","theme-cyan","theme-sky","theme-teal","theme-purple","theme-violet","theme-fuchsia","theme-pink","theme-rose","theme-red","theme-orange","theme-amber","theme-yellow","theme-emerald","theme-green","theme-lime","theme-slate","theme-zinc","theme-stone","theme-neutral","theme-gold","theme-navy","theme-wine","theme-champagne","theme-dustyblue","theme-terracotta","theme-sage","theme-mauve","theme-coral","theme-forest","theme-ocean"),i&&o.classList.add("dark"),r!=="default"&&o.classList.add(`theme-${r}`)},setAutoSwitch:(r,i,o)=>{n({autoSwitchEnabled:r,autoSwitchThreshold:i??s().autoSwitchThreshold,autoSwitchInterval:o??s().autoSwitchInterval}),s().saveToStorage(),r?s().startAutoSwitch():s().stopAutoSwitch()},setBatchImportConcurrency:r=>{n({batchImportConcurrency:Math.max(1,Math.min(500,r))}),s().saveToStorage()},setLoginPrivateMode:r=>{n({loginPrivateMode:r}),s().saveToStorage()},setSwitchTarget:r=>{n({switchTarget:r}),s().saveToStorage()},startAutoSwitch:()=>{const{autoSwitchEnabled:r,autoSwitchInterval:i,checkAndAutoSwitch:o}=s();r&&(Rl&&clearInterval(Rl),o(),Rl=setInterval(()=>{o()},i*60*1e3),console.log(`[AutoSwitch] Started with interval: ${i} minutes`))},stopAutoSwitch:()=>{Rl&&(clearInterval(Rl),Rl=null,console.log("[AutoSwitch] Stopped"))},checkAndAutoSwitch:async()=>{const{accounts:r,autoSwitchThreshold:i,checkAccountStatus:o,setActiveAccount:d}=s(),u=s().getActiveAccount();if(!u){console.log("[AutoSwitch] No active account");return}console.log(`[AutoSwitch] Checking active account: ${u.email}`),await o(u.id);const h=s().accounts.get(u.id);if(!h)return;const f=h.usage.limit-h.usage.current;if(console.log(`[AutoSwitch] Remaining: ${f}, Threshold: ${i}`),f<=i){console.log(`[AutoSwitch] Account ${h.email} reached threshold, switching...`);const p=Array.from(r.values()).find(y=>!(y.id===u.id||Yr(y.lastError)||y.usage.limit-y.usage.current<=i));if(p){console.log(`[AutoSwitch] Switching to: ${p.email}`),d(p.id);const{switchTarget:y}=s(),b=p.credentials;if(y==="ide"||y==="both"){const v=await window.api.switchAccount({accessToken:b.accessToken||"",refreshToken:b.refreshToken||"",clientId:b.clientId||"",clientSecret:b.clientSecret||"",region:b.region||"us-east-1",startUrl:b.startUrl,authMethod:b.authMethod,provider:b.provider,profileArn:p.profileArn,accountId:p.id});if(v?.success&&v.refreshedCredentials){const N=v.refreshedCredentials;n(j=>{const T=new Map(j.accounts),S=T.get(p.id);return S&&T.set(p.id,{...S,credentials:{...S.credentials,accessToken:N.accessToken,refreshToken:N.refreshToken,expiresAt:Date.now()+N.expiresIn*1e3}}),{accounts:T}}),s().saveToStorage()}}(y==="cli"||y==="both")&&window.api.switchAccountCli?.({accessToken:b.accessToken||"",refreshToken:b.refreshToken||"",clientId:b.clientId,clientSecret:b.clientSecret,region:b.region||"us-east-1",profileArn:p.profileArn,provider:b.provider}).catch(v=>console.warn("[AutoSwitch CLI] Failed:",v))}else console.log("[AutoSwitch] No available account to switch to")}},checkAndRefreshExpiringTokens:async()=>{const{accounts:r,refreshAccountToken:i,checkAccountStatus:o,autoSwitchEnabled:d,autoRefreshConcurrency:u,autoRefreshSyncInfo:h}=s(),f=Date.now();console.log(`[AutoRefresh] Checking ${r.size} accounts... (syncInfo: ${h}, autoSwitch: ${d})`);const p=[];for(const[N,j]of r){if(Yr(j.lastError)){console.log(`[AutoRefresh] Skipping ${j.email} (banned/error)`);continue}const T=j.credentials.expiresAt,S=T?T-f:1/0,k=T&&S<=Af;p.push({id:N,email:j.email,needsTokenRefresh:!!k})}console.log(`[AutoRefresh] Processing ${p.length} accounts...`);const y=u;let b=0,v=0;for(let N=0;N<p.length;N+=y){const j=p.slice(N,N+y),T=await Promise.allSettled(j.map(async({id:S,email:k,needsTokenRefresh:R})=>{try{return R?(console.log(`[AutoRefresh] Refreshing token for ${k}...`),await i(S),console.log(`[AutoRefresh] Token for ${k} refreshed`),await o(S),console.log(`[AutoRefresh] Account info for ${k} updated`)):(h||d)&&(await o(S),console.log(`[AutoRefresh] Account info for ${k} updated`)),{email:k,success:!0}}catch(I){return console.error(`[AutoRefresh] Failed for ${k}:`,I),{email:k,success:!1,error:I}}}));b+=T.filter(S=>S.status==="fulfilled"&&S.value.success).length,v+=T.length-T.filter(S=>S.status==="fulfilled"&&S.value.success).length,N+y<p.length&&await new Promise(S=>setTimeout(S,200))}console.log(`[AutoRefresh] Completed: ${b} success, ${v} failed`)},refreshExpiredTokensOnly:async()=>{const{accounts:r,refreshAccountToken:i,autoRefreshConcurrency:o}=s(),d=Date.now(),u=[];for(const[f,p]of r){if(Yr(p.lastError))continue;const y=p.credentials.expiresAt,b=y?y-d:1/0;y&&b<=Af&&u.push({id:f,email:p.email})}if(u.length===0){console.log("[AutoRefresh] No expired tokens found");return}console.log(`[AutoRefresh] Refreshing ${u.length} expired tokens...`);const h=o;for(let f=0;f<u.length;f+=h){const p=u.slice(f,f+h);await Promise.allSettled(p.map(async({id:y,email:b})=>{try{await i(y),console.log(`[AutoRefresh] Token for ${b} refreshed`)}catch(v){console.error(`[AutoRefresh] Failed to refresh token for ${b}:`,v)}})),f+h<u.length&&await new Promise(y=>setTimeout(y,200))}},startAutoTokenRefresh:()=>{const{autoRefreshEnabled:r,autoRefreshInterval:i}=s();if(Mi&&(clearInterval(Mi),Mi=null),!r){console.log("[AutoRefresh] Auto-refresh is disabled");return}s().triggerBackgroundRefresh();const o=i*60*1e3;Mi=setInterval(()=>{s().triggerBackgroundRefresh()},o),console.log(`[AutoRefresh] Token auto-refresh started with interval: ${i} minutes`)},stopAutoTokenRefresh:()=>{Mi&&(clearInterval(Mi),Mi=null,console.log("[AutoRefresh] Token auto-refresh stopped"))},triggerBackgroundRefresh:async()=>{const{accounts:r,autoRefreshConcurrency:i,autoRefreshSyncInfo:o,autoSwitchEnabled:d}=s(),u=Date.now(),h=[];for(const[f,p]of r){if(Yr(p.lastError))continue;const y=p.credentials.expiresAt,b=y?y-u:1/0,v=y&&b<=Af;(v||o||d)&&h.push({id:f,email:p.email,idp:p.idp,needsTokenRefresh:!!v,machineId:p.machineId,credentials:{refreshToken:p.credentials.refreshToken||"",clientId:p.credentials.clientId,clientSecret:p.credentials.clientSecret,region:p.credentials.region,authMethod:p.credentials.authMethod,accessToken:p.credentials.accessToken,provider:p.credentials.provider}})}if(h.length===0){console.log("[BackgroundRefresh] No accounts need processing");return}console.log(`[BackgroundRefresh] Triggering refresh for ${h.length} accounts (syncInfo: ${o})...`),window.api.backgroundBatchRefresh(h,i,o)},handleBackgroundRefreshResult:r=>{s().applyBackgroundRefreshResults([r])},applyBackgroundRefreshResults:r=>{!r||r.length===0||n(i=>{const o=new Map(i.accounts),d=Date.now();for(const u of r){const{id:h,success:f,data:p,error:y}=u,b=o.get(h);if(!b)continue;if(!f){o.set(h,{...b,status:"error",lastError:y,lastCheckedAt:d});continue}const v=p,N=v?.status==="error"?"error":"active",j=v?.errorMessage;o.set(h,{...b,credentials:{...b.credentials,accessToken:v?.accessToken||b.credentials.accessToken,refreshToken:v?.refreshToken||b.credentials.refreshToken,expiresAt:v?.expiresIn?d+v.expiresIn*1e3:b.credentials.expiresAt},usage:v?.usage?(()=>{const T=v.usage.current??b.usage.current,S=v.usage.limit??b.usage.limit;return{...b.usage,current:T,limit:S,percentUsed:S>0?T/S:0,baseCurrent:v.usage.baseCurrent??b.usage.baseCurrent,baseLimit:v.usage.baseLimit??b.usage.baseLimit,freeTrialCurrent:v.usage.freeTrialCurrent??b.usage.freeTrialCurrent,freeTrialLimit:v.usage.freeTrialLimit??b.usage.freeTrialLimit,freeTrialExpiry:v.usage.freeTrialExpiry??b.usage.freeTrialExpiry,bonuses:v.usage.bonuses??b.usage.bonuses,nextResetDate:v.usage.nextResetDate??b.usage.nextResetDate,resourceDetail:v.usage.resourceDetail??b.usage.resourceDetail,lastUpdated:d}})():b.usage,subscription:v?.subscription?{...b.subscription,type:v.subscription.type||b.subscription.type,title:v.subscription.title||b.subscription.title,daysRemaining:v.subscription.daysRemaining??b.subscription.daysRemaining,expiresAt:v.subscription.expiresAt??b.subscription.expiresAt,overageCapability:v.subscription.overageCapability??b.subscription.overageCapability,upgradeCapability:v.subscription.upgradeCapability??b.subscription.upgradeCapability,managementTarget:v.subscription.subscriptionManagementTarget??b.subscription.managementTarget}:b.subscription,email:v?.userInfo?.email||b.email,userId:v?.userInfo?.userId||b.userId,status:N,lastError:j,lastCheckedAt:d})}return{accounts:o}})},handleBackgroundCheckResult:r=>{s().applyBackgroundCheckResults([r])},applyBackgroundCheckResults:r=>{!r||r.length===0||n(i=>{const o=new Map(i.accounts),d=Date.now();for(const u of r){const{id:h,success:f,data:p,error:y}=u,b=o.get(h);if(!b)continue;if(!f){o.set(h,{...b,status:"error",lastError:y,lastCheckedAt:d});continue}const v=p;let N="active";v?.status==="error"?N="error":(v?.status==="expired"||v?.needsRefresh)&&(N="expired");const j=v?.errorMessage;o.set(h,{...b,usage:v?.usage?(()=>{const T=v.usage.current??b.usage.current,S=v.usage.limit??b.usage.limit;return{...b.usage,current:T,limit:S,percentUsed:S>0?T/S:0,baseCurrent:v.usage.baseCurrent??b.usage.baseCurrent,baseLimit:v.usage.baseLimit??b.usage.baseLimit,freeTrialCurrent:v.usage.freeTrialCurrent??b.usage.freeTrialCurrent,freeTrialLimit:v.usage.freeTrialLimit??b.usage.freeTrialLimit,freeTrialExpiry:v.usage.freeTrialExpiry??b.usage.freeTrialExpiry,bonuses:v.usage.bonuses??b.usage.bonuses,nextResetDate:v.usage.nextResetDate??b.usage.nextResetDate,resourceDetail:v.usage.resourceDetail??b.usage.resourceDetail,lastUpdated:d}})():b.usage,subscription:v?.subscription?{...b.subscription,type:v.subscription.type??b.subscription.type,title:v.subscription.title??b.subscription.title,daysRemaining:v.subscription.daysRemaining??b.subscription.daysRemaining,expiresAt:v.subscription.expiresAt??b.subscription.expiresAt,overageCapability:v.subscription.overageCapability??b.subscription.overageCapability,upgradeCapability:v.subscription.upgradeCapability??b.subscription.upgradeCapability,managementTarget:v.subscription.subscriptionManagementTarget??b.subscription.managementTarget}:b.subscription,email:v?.userInfo?.email||b.email,userId:v?.userInfo?.userId||b.userId,status:N,lastError:j,lastCheckedAt:d})}return{accounts:o}})},startAutoSave:()=>{Dl&&clearInterval(Dl);const r=()=>{const{accounts:i,groups:o,tags:d,activeAccountId:u}=s();return JSON.stringify({accounts:Object.fromEntries(i),groups:Object.fromEntries(o),tags:Object.fromEntries(d),activeAccountId:u})};Mf=r(),Dl=setInterval(async()=>{const i=r();i!==Mf&&(console.log("[AutoSave] Data changed, saving..."),await s().saveToStorage(),Mf=i,console.log("[AutoSave] Data saved successfully"))},$v),console.log(`[AutoSave] Auto-save started with interval: ${$v/1e3}s`)},stopAutoSave:()=>{Dl&&(clearInterval(Dl),Dl=null,console.log("[AutoSave] Auto-save stopped"))},setMachineIdConfig:r=>{n(i=>({machineIdConfig:{...i.machineIdConfig,...r}})),s().saveToStorage()},refreshCurrentMachineId:async()=>{try{const r=await window.api.machineIdGetCurrent();if(r.success&&r.machineId){n({currentMachineId:r.machineId});const{originalMachineId:i}=s();i||s().backupOriginalMachineId()}}catch(r){console.error("[MachineId] Failed to refresh current machine ID:",r)}},changeMachineId:async r=>{const i=s();i.originalMachineId||i.backupOriginalMachineId();const o=r||await window.api.machineIdGenerateRandom();try{const d=await window.api.machineIdSet(o);return d.success?(n(u=>({currentMachineId:o,machineIdHistory:[...u.machineIdHistory,{id:ra(),machineId:o,timestamp:Date.now(),action:"manual"}]})),s().saveToStorage(),!0):(d.requiresAdmin||console.error("[MachineId] Failed to change:",d.error),!1)}catch(d){return console.error("[MachineId] Error changing machine ID:",d),!1}},restoreOriginalMachineId:async()=>{const{originalMachineId:r}=s();if(!r)return console.warn("[MachineId] No original machine ID to restore"),!1;try{return(await window.api.machineIdSet(r)).success?(n(o=>({currentMachineId:r,machineIdHistory:[...o.machineIdHistory,{id:ra(),machineId:r,timestamp:Date.now(),action:"restore"}]})),s().saveToStorage(),!0):!1}catch(i){return console.error("[MachineId] Error restoring original machine ID:",i),!1}},bindMachineIdToAccount:(r,i)=>{const o=s().accounts.get(r);if(!o)return;const d=i||ra();n(u=>({accountMachineIds:{...u.accountMachineIds,[r]:d},machineIdHistory:[...u.machineIdHistory,{id:ra(),machineId:d,timestamp:Date.now(),action:"bind",accountId:r,accountEmail:o.email}]})),s().saveToStorage()},getMachineIdForAccount:r=>s().accountMachineIds[r]||null,backupOriginalMachineId:()=>{const{currentMachineId:r,originalMachineId:i}=s();!i&&r&&(n({originalMachineId:r,originalBackupTime:Date.now()}),n(o=>({machineIdHistory:[...o.machineIdHistory,{id:ra(),machineId:r,timestamp:Date.now(),action:"initial"}]})),s().saveToStorage(),console.log("[MachineId] Original machine ID backed up:",r))},clearMachineIdHistory:()=>{n({machineIdHistory:[]}),s().saveToStorage()},addProxy:(r,i)=>{const o=Vv(r);if(!o)return null;const d=s().proxyPool;for(const f of d.values())if(f.host===o.host&&f.port===o.port&&f.protocol===o.protocol&&(f.username||"")===(o.username||""))return null;const u=ra(),h={id:u,url:o.normalized,protocol:o.protocol,host:o.host,port:o.port,username:o.username,password:o.password,label:i?.label,source:i?.source??"manual",tags:i?.tags,status:"untested",usedCount:0,failCount:0,enabled:!0,createdAt:Date.now()};return n(f=>{const p=new Map(f.proxyPool);return p.set(u,h),{proxyPool:p}}),s().saveToStorage(),u},importProxies:r=>{const i={added:0,skipped:0,failed:0},o=r.split(/\r?\n/).map(f=>f.trim()).filter(f=>f&&!f.startsWith("#"));if(o.length===0)return i;const d=s().proxyPool,u=new Set;for(const f of d.values())u.add(`${f.protocol}://${f.username||""}@${f.host}:${f.port}`);const h=[];for(const f of o){const p=Vv(f);if(!p){i.failed++;continue}const y=`${p.protocol}://${p.username||""}@${p.host}:${p.port}`;if(u.has(y)){i.skipped++;continue}u.add(y),h.push({id:ra(),url:p.normalized,protocol:p.protocol,host:p.host,port:p.port,username:p.username,password:p.password,source:"import",status:"untested",usedCount:0,failCount:0,enabled:!0,createdAt:Date.now()}),i.added++}return h.length>0&&(n(f=>{const p=new Map(f.proxyPool);for(const y of h)p.set(y.id,y);return{proxyPool:p}}),s().saveToStorage()),i},removeProxy:r=>{const i=Object.entries(s().accountProxyBindings).filter(([,o])=>o===r).map(([o])=>o);n(o=>{const d=new Map(o.proxyPool);d.delete(r);const u={...o.accountProxyBindings};for(const h of i)delete u[h];return{proxyPool:d,accountProxyBindings:u}}),s().saveToStorage();for(const o of i)pr(o)},removeProxies:r=>{if(r.length===0)return;const i=new Set(r),o=Object.entries(s().accountProxyBindings).filter(([,d])=>i.has(d)).map(([d])=>d);n(d=>{const u=new Map(d.proxyPool);for(const f of r)u.delete(f);const h={...d.accountProxyBindings};for(const f of o)delete h[f];return{proxyPool:u,accountProxyBindings:h}}),s().saveToStorage();for(const d of o)pr(d)},toggleProxyEnabled:(r,i)=>{n(o=>{const d=new Map(o.proxyPool),u=d.get(r);return u&&d.set(r,{...u,enabled:i??!u.enabled}),{proxyPool:d}}),s().saveToStorage(),au(r)},updateProxy:(r,i)=>{n(o=>{const d=new Map(o.proxyPool),u=d.get(r);return u&&d.set(r,{...u,...i}),{proxyPool:d}}),s().saveToStorage(),("url"in i||"enabled"in i||"status"in i)&&au(r)},validateProxy:async r=>{const i=s().proxyPool.get(r);if(!i)return{success:!1,error:"Proxy not found"};const{proxyPoolConfig:o}=s();n(u=>{const h=new Map(u.proxyPool),f=h.get(r);return f&&h.set(r,{...f,status:"testing"}),{proxyPool:h}});let d;try{d=await window.api.proxyPoolValidate({url:i.url,testUrl:o.testUrl,timeoutMs:o.testTimeoutMs,upstreamProxy:o.upstreamProxy})}catch(u){d={success:!1,error:u instanceof Error?u.message:String(u)}}return n(u=>{const h=new Map(u.proxyPool),f=h.get(r);if(f){const p=d.latencyMs,y=d.success?p!==void 0&&p>3e3?"slow":"alive":"dead";h.set(r,{...f,status:y,latencyMs:d.latencyMs,lastTestedAt:Date.now(),lastError:d.success?void 0:d.error,failCount:d.success?f.failCount:f.failCount+1,enabled:d.success?f.enabled:u.proxyPoolConfig.autoDisableDead&&f.failCount+1>=u.proxyPoolConfig.failureThreshold&&Array.from(u.proxyPool.values()).filter(b=>b.enabled&&b.status!=="dead").length>1?!1:f.enabled})}return{proxyPool:h}}),s().saveToStorage(),au(r),d},validateProxiesBatch:async(r,i=5)=>{if(r.length===0)return;const o=s().validateProxy;let d=0;const u=async()=>{for(;d<r.length;){const f=d++;try{await o(r[f])}catch{}}},h=Array.from({length:Math.max(1,Math.min(i,r.length))},()=>u());await Promise.all(h)},clearProxyPool:()=>{const r=Object.keys(s().accountProxyBindings);n({proxyPool:new Map,proxyPoolCursor:0,accountProxyBindings:{}}),s().saveToStorage();for(const i of r)pr(i)},setProxyPoolConfig:r=>{n(i=>({proxyPoolConfig:{...i.proxyPoolConfig,...r}})),s().saveToStorage()},pickNextProxy:()=>{const{proxyPool:r,proxyPoolConfig:i,proxyPoolCursor:o}=s();if(!i.enabled)return null;const d=Array.from(r.values()).filter(h=>h.enabled&&h.status!=="dead");if(d.length===0)return null;let u;switch(i.strategy){case"random":u=d[Math.floor(Math.random()*d.length)];break;case"least_used":u=d.reduce((h,f)=>f.usedCount<h.usedCount?f:h);break;case"fastest":u=d.slice().sort((h,f)=>{const p=h.latencyMs??Number.POSITIVE_INFINITY,y=f.latencyMs??Number.POSITIVE_INFINITY;return p-y})[0];break;case"round_robin":default:{const h=o%d.length;u=d[h],n({proxyPoolCursor:o+1});break}}return n(h=>{const f=new Map(h.proxyPool),p=f.get(u.id);return p&&f.set(u.id,{...p,usedCount:p.usedCount+1,lastUsedAt:Date.now()}),{proxyPool:f}}),s().saveToStorage(),u},reportProxyResult:(r,i,o,d)=>{let u=!1;n(h=>{const f=new Map(h.proxyPool),p=f.get(r);if(!p)return h;const y=!i&&mE(d),b=y?p.failCount+1:p.failCount,v=Array.from(h.proxyPool.values()).filter(j=>j.enabled&&j.status!=="dead").length,N=y&&h.proxyPoolConfig.autoDisableDead&&b>=h.proxyPoolConfig.failureThreshold&&v>1;return u=N,f.set(r,{...p,failCount:b,lastBoundEmail:o||p.lastBoundEmail,lastError:i?p.lastError:d||p.lastError,enabled:N?!1:p.enabled,status:N?"dead":p.status}),{proxyPool:f}}),s().saveToStorage(),u&&au(r)},bindAccountToProxy:(r,i)=>{n(o=>({accountProxyBindings:{...o.accountProxyBindings,[r]:i}})),s().saveToStorage(),pr(r)},bindAccountsToProxy:(r,i)=>{if(r.length!==0){n(o=>{const d={...o.accountProxyBindings};for(const u of r)d[u]=i;return{accountProxyBindings:d}}),s().saveToStorage();for(const o of r)pr(o)}},unbindAccountFromProxy:r=>{n(i=>{const o={...i.accountProxyBindings};return delete o[r],{accountProxyBindings:o}}),s().saveToStorage(),pr(r)},clearAccountProxyBindings:()=>{const r=Object.keys(s().accountProxyBindings);n({accountProxyBindings:{}}),s().saveToStorage();for(const i of r)pr(i)},autoDistributeAccountsToProxies:({accountsPerProxy:r=0,onlyUnbound:i=!1,accountIds:o})=>{const d=s(),u=Array.from(d.proxyPool.values()).filter(N=>N.enabled&&N.status!=="dead");if(u.length===0)return{distributed:0,perProxy:{},skipped:0};const h=o?o.map(N=>d.accounts.get(N)).filter(N=>!!N):Array.from(d.accounts.values()),f=i?h.filter(N=>!d.accountProxyBindings[N.id]):h;if(f.length===0)return{distributed:0,perProxy:{},skipped:h.length};const p={};u.forEach(N=>{p[N.id]=0});const y={...d.accountProxyBindings};if(!i)for(const N of Object.keys(y))u.some(T=>T.id===y[N])||delete y[N];let b=0,v=0;for(const N of f){let j;if(r>0){let T;for(let S=0;S<u.length;S++){const k=u[S].id;if(p[k]<r){T=k;break}}if(!T)break;j=T}else j=u[v%u.length].id,v++;y[N.id]=j,p[j]++,b++}n({accountProxyBindings:y}),s().saveToStorage();for(const N of f.slice(0,b))pr(N.id);return{distributed:b,perProxy:p,skipped:f.length-b}},getAccountProxyUrl:r=>{const i=s(),o=i.accountProxyBindings[r];if(!o)return;const d=i.proxyPool.get(o);if(!(!d||!d.enabled||d.status==="dead"))return d.url}}));function pr(n){try{const s=vt.getState().getAccountProxyUrl(n);window.api.accountSetProxyBinding?.(n,s)}catch(s){console.warn("[Store] Failed to sync account proxy binding to main:",s)}}function au(n){try{const s=vt.getState(),r=Object.entries(s.accountProxyBindings).filter(([,i])=>i===n).map(([i])=>i);for(const i of r)pr(i)}catch(s){console.warn("[Store] Failed to sync accounts bound to proxy:",s)}}function _v(n,s){try{_n.getState().triggerEvent(n,s)}catch(r){console.warn(`[Webhook] trigger ${n} failed:`,r)}}function mE(n){const s=(n||"").toLowerCase();return s?s.includes("proxy")||s.includes("econnrefused")||s.includes("econnreset")||s.includes("etimedout")||s.includes("ehostunreach")||s.includes("enetunreach")||s.includes("tunnel")||s.includes("dial tcp")||s.includes("connection refused")||s.includes("connection reset")||s.includes("407")||s.includes("socks"):!1}function Vv(n){const s=(n||"").trim();if(!s)return null;if(/^[a-z][a-z0-9+.-]*:\/\//i.test(s))try{const i=new URL(s),o=fE(i.protocol.replace(":",""));if(!o)return null;const d=Number(i.port)||pE(o);return!i.hostname||!Number.isFinite(d)?null:{protocol:o,host:i.hostname,port:d,username:i.username?decodeURIComponent(i.username):void 0,password:i.password?decodeURIComponent(i.password):void 0,normalized:ru(o,i.hostname,d,i.username,i.password)}}catch{return null}const r=s.split(":");if(r.length===4&&/^\d+$/.test(r[1])){const[i,o,d,u]=r,h=Number(o);return!i||!Number.isFinite(h)?null:{protocol:"http",host:i,port:h,username:d||void 0,password:u||void 0,normalized:ru("http",i,h,d,u)}}if(s.includes("@")){const[i,o]=s.split("@"),[d,u]=i.split(":"),[h,f]=(o||"").split(":"),p=Number(f);return!h||!Number.isFinite(p)?null:{protocol:"http",host:h,port:p,username:d||void 0,password:u||void 0,normalized:ru("http",h,p,d,u)}}if(r.length===2&&/^\d+$/.test(r[1])){const i=Number(r[1]);return!r[0]||!Number.isFinite(i)?null:{protocol:"http",host:r[0],port:i,normalized:ru("http",r[0],i)}}return null}function fE(n){const s=n.toLowerCase();return s==="http"||s==="https"||s==="socks5"||s==="socks4"?s:s==="socks"?"socks5":null}function pE(n){switch(n){case"http":return 8080;case"https":return 443;case"socks5":case"socks4":return 1080}}function ru(n,s,r,i,o){const d=i?`${encodeURIComponent(i)}${o?`:${encodeURIComponent(o)}`:""}@`:"";return`${n}://${d}${s}:${r}`}const Kv={common:{confirm:"Xác nhận",cancel:"Hủy",save:"Lưu",delete:"Xóa",edit:"Sửa",add:"Thêm",close:"Đóng",loading:"Đang tải...",success:"Thành công",error:"Lỗi",warning:"Cảnh báo",info:"Thông tin",yes:"Có",no:"Không",enabled:"Đã bật",disabled:"Đã tắt",all:"Tất cả",none:"Không có",search:"Tìm kiếm",filter:"Lọc",sort:"Sắp xếp",refresh:"Làm mới",copy:"Sao chép",copied:"Đã sao chép",import:"Nhập",export:"Xuất",backup:"Sao lưu",restore:"Khôi phục",reset:"Đặt lại",apply:"Áp dụng",selected:"Đã chọn",total:"Tổng",unknown:"Unknown"},nav:{home:"Trang chính",accounts:"Tài khoản",machineId:"Mã máy",kiroSettings:"Cài đặt Kiro",proxy:"Proxy API",kproxy:"K-Proxy",proxyPool:"Kho proxy",webhooks:"Webhook",diagnose:"Chẩn đoán",configSync:"Đồng bộ cấu hình",register:"Đăng ký",subscription:"Gói dịch vụ",logs:"Nhật ký",settings:"Cài đặt",about:"Giới thiệu"},home:{title:"Trang chính",totalAccounts:"Tổng tài khoản",activeAccounts:"Đang hoạt động",errorAccounts:"Có lỗi",totalQuota:"Tổng hạn mức",currentAccount:"Tài khoản hiện tại",noCurrentAccount:"Chưa chọn tài khoản",selectAccount:"Chọn một tài khoản để sử dụng",subscription:"Gói dịch vụ",usage:"Mức sử dụng",daysRemaining:"Còn {days} ngày",expiresOn:"Hết hạn vào {date}",quickActions:"Thao tác nhanh",switchAccount:"Đổi tài khoản",refreshToken:"Làm mới token",checkStatus:"Kiểm tra trạng thái",welcome:{title:"Chào mừng đến với Krouter",description:"Công cụ quản lý nhiều tài khoản cho Kiro IDE",features:{multiAccount:"Quản lý nhiều tài khoản Kiro",autoRefresh:"Tự động làm mới token trước khi hết hạn",machineId:"Quản lý mã máy để giảm lỗi liên kết tài khoản",themes:"Có 32 màu giao diện"}}},accounts:{title:"Quản lý tài khoản",addAccount:"Thêm tài khoản",batchAdd:"Thêm hàng loạt",searchPlaceholder:"Tìm tài khoản...",noAccounts:"Chưa có tài khoản",addFirstAccount:"Thêm tài khoản đầu tiên để bắt đầu",totalAccounts:"{count} tài khoản",selectedCount:"Đã chọn {count}",batchActions:"Thao tác hàng loạt",setGroup:"Gán nhóm",setTags:"Gán thẻ",batchRefresh:"Làm mới hàng loạt",batchCheck:"Kiểm tra hàng loạt",batchDelete:"Xóa hàng loạt",confirmDelete:"Anh chắc chắn muốn xóa tài khoản này?",confirmBatchDelete:"Anh chắc chắn muốn xóa {count} tài khoản?",filters:{all:"Tất cả",active:"Đang hoạt động",error:"Có lỗi",expiring:"Sắp hết hạn",noGroup:"Chưa có nhóm"},sort:{email:"Email",usage:"Mức dùng",addedAt:"Ngày thêm",lastChecked:"Lần kiểm tra cuối"},card:{usage:"Mức dùng",base:"Cơ bản",trial:"Dùng thử",tokenExpiry:"Token: {time}",tokenExpired:"Token: hết hạn",lastChecked:"Đã kiểm tra: {time}",neverChecked:"Chưa kiểm tra",switchTo:"Chuyển sang tài khoản này",current:"Hiện tại",banned:"Bị khóa",verified:"Đã xác minh"}},addAccount:{title:"Thêm tài khoản",description:"Thêm tài khoản Kiro mới",tabs:{ssoToken:"SSO Token",oidcCredentials:"Thông tin OIDC",socialLogin:"Đăng nhập mạng xã hội",batchImport:"Nhập hàng loạt"},ssoToken:{label:"SSO Token",placeholder:"Dán SSO Token vào đây...",hint:"Lấy từ công cụ nhà phát triển của trình duyệt sau khi đăng nhập Kiro"},oidc:{authMethod:"Phương thức xác thực",builderId:"Builder ID (IdC)",social:"GitHub / Google",refreshToken:"Refresh Token",refreshTokenPlaceholder:"Dán Refresh Token...",clientId:"Client ID",clientSecret:"Client Secret",region:"Vùng AWS",socialHint:"Đăng nhập mạng xã hội không cần Client ID và Client Secret",selectProvider:"Chọn nhà cung cấp"},social:{title:"Đăng nhập mạng xã hội",description:"Đăng nhập bằng Google hoặc GitHub",google:"Đăng nhập bằng Google",github:"Đăng nhập bằng GitHub",waiting:"Đang chờ cấp quyền...",success:"Cấp quyền thành công!",failed:"Cấp quyền thất bại"},batch:{title:"Nhập hàng loạt",description:"Nhập nhiều tài khoản cùng lúc",format:"Định dạng: mỗi dòng một tài khoản",placeholder:`refreshToken
|
|
28
|
+
HOẶC
|
|
29
|
+
refreshToken,clientId,clientSecret
|
|
30
|
+
HOẶC
|
|
31
|
+
định dạng JSON`,importing:"Đang nhập {current}/{total}...",result:"Nhập xong: {success} thành công, {failed} lỗi"},verifying:"Đang xác minh...",verifySuccess:"Xác minh thành công",verifyFailed:"Xác minh thất bại"},editAccount:{title:"Sửa tài khoản",description:"Chỉnh cài đặt tài khoản hoặc làm mới thông tin đăng nhập",nickname:"Tên gợi nhớ",nicknamePlaceholder:"Đặt tên dễ nhớ cho tài khoản này",credentials:"Thông tin đăng nhập",socialCredentials:"Thông tin đăng nhập mạng xã hội",oidcCredentials:"Thông tin OIDC",importFromLocal:"Nhập từ máy",verifyAndRefresh:"Xác minh và làm mới",saveChanges:"Lưu thay đổi",accountStatus:"Trạng thái tài khoản",verified:"Đã xác minh",error:"Lỗi"},machineId:{title:"Quản lý mã máy",description:"Quản lý định danh thiết bị cho tài khoản",current:"Mã máy hiện tại",original:"Bản sao lưu gốc",noBackup:"Chưa có sao lưu",backupTime:"Thời gian sao lưu: {time}",actions:{copy:"Sao chép",generate:"Tạo ngẫu nhiên",custom:"Tùy chỉnh",restore:"Khôi phục mã gốc",backupToFile:"Sao lưu ra file",restoreFromFile:"Khôi phục từ file"},automation:{title:"Cài đặt tự động",autoSwitch:"Tự đổi mã máy",autoSwitchDesc:"Tự đổi mã máy khi chuyển tài khoản",bindToAccount:"Gắn mã máy theo tài khoản",bindToAccountDesc:"Mỗi tài khoản dùng một mã máy riêng",useBinded:"Dùng mã đã gắn",useBindedDesc:"Dùng mã máy đã gắn khi chuyển tài khoản"},accountBindings:"Mã máy đã gắn với tài khoản",history:"Lịch sử thay đổi",requiresAdmin:"Cần quyền quản trị viên",restartAsAdmin:"Khởi động lại bằng quyền quản trị",platformInfo:{title:"Thông tin nền tảng",windows:"Windows: sửa MachineGuid trong registry",macos:"macOS: sửa IOPlatformUUID",linux:"Linux: sửa /etc/machine-id"}},settings:{title:"Cài đặt",language:{title:"Ngôn ngữ",description:"Chọn ngôn ngữ hiển thị",auto:"Tiếng Việt",en:"Tiếng Việt",zh:"Tiếng Việt",customFile:"File dịch tùy chỉnh",loadCustom:"Tải file",customHint:"Tải file JSON dịch tùy chỉnh từ máy"},theme:{title:"Giao diện",description:"Tùy chỉnh hiển thị",color:"Màu chủ đạo",darkMode:"Chế độ tối",lightMode:"Chế độ sáng"},privacy:{title:"Quyền riêng tư",description:"Cài đặt bảo vệ thông tin nhạy cảm",privacyMode:"Chế độ riêng tư",privacyModeDesc:"Ẩn email, token và các thông tin nhạy cảm"},autoRefresh:{title:"Tự làm mới",description:"Cài đặt tự làm mới token",enabled:"Tự làm mới",enabledDesc:"Tự làm mới token trước khi hết hạn và đồng bộ thông tin tài khoản",interval:"Chu kỳ kiểm tra",intervalDesc:"Tần suất kiểm tra trạng thái tài khoản",concurrency:"Số luồng làm mới",concurrencyDesc:"Số tài khoản được làm mới cùng lúc",syncInfo:"Đồng bộ thông tin tài khoản",syncInfoDesc:"Kiểm tra mức dùng, gói dịch vụ và trạng thái khóa khi làm mới token",minutes:"{n} phút"},autoSwitch:{title:"Tự đổi tài khoản",description:"Tự đổi tài khoản khi số dư thấp",enabled:"Tự đổi",enabledDesc:"Tự chuyển sang tài khoản khác khi tài khoản hiện tại còn ít hạn mức",threshold:"Ngưỡng số dư",thresholdDesc:"Chuyển khi số dư thấp hơn giá trị này",interval:"Chu kỳ kiểm tra",intervalDesc:"Tần suất kiểm tra số dư"},proxy:{title:"Proxy",description:"Cài đặt proxy mạng",enabled:"Bật proxy",url:"URL proxy",urlPlaceholder:"http://host:port hoặc socks5://host:port",urlHint:"Hỗ trợ HTTP, HTTPS, SOCKS5"},data:{title:"Quản lý dữ liệu",description:"Nhập/xuất dữ liệu tài khoản",export:"Xuất dữ liệu",import:"Nhập dữ liệu",exportHint:"Xuất tài khoản sang JSON, TXT, CSV hoặc clipboard",importHint:"Nhập tài khoản từ file JSON"},batchImport:{title:"Nhập hàng loạt",concurrency:"Số luồng nhập",concurrencyDesc:"Số tài khoản nhập cùng lúc"},dangerZone:{title:"Vùng nguy hiểm",clearData:"Xóa toàn bộ dữ liệu",clearDataDesc:"Xóa toàn bộ tài khoản và cài đặt",clearDataConfirm:"Anh chắc chắn chứ? Thao tác này không thể hoàn tác.",clearDataButton:"Xóa toàn bộ dữ liệu"}},about:{title:"Giới thiệu",version:"Phiên bản {version}",description:"Công cụ quản lý nhiều tài khoản cho Kiro IDE",features:"Tính năng",techStack:"Công nghệ",author:"Tác giả",github:"GitHub",checkUpdate:"Kiểm tra cập nhật",upToDate:"Anh đang dùng phiên bản mới nhất",newVersion:"Có phiên bản mới: {version}",download:"Tải xuống",releaseNotes:"Ghi chú phát hành"},status:{active:"Hoạt động",error:"Lỗi",banned:"Bị khóa",expired:"Hết hạn",unknown:"Không rõ"},subscription:{free:"Miễn phí",pro:"Pro",enterprise:"Enterprise",teams:"Teams",unknown:"Không rõ"},time:{justNow:"Vừa xong",minutesAgo:"{n} phút trước",hoursAgo:"{n} giờ trước",daysAgo:"{n} ngày trước",expired:"Đã hết hạn",remaining:"Còn {time}"},errors:{networkError:"Lỗi mạng, vui lòng kiểm tra kết nối",authError:"Xác thực thất bại",tokenExpired:"Token đã hết hạn, vui lòng làm mới",accountBanned:"Tài khoản đã bị khóa",invalidCredentials:"Thông tin đăng nhập không hợp lệ",importFailed:"Nhập thất bại",exportFailed:"Xuất thất bại",saveFailed:"Lưu thất bại",loadFailed:"Tải thất bại",unknownError:"Đã xảy ra lỗi không xác định"},messages:{accountAdded:"Đã thêm tài khoản",accountDeleted:"Đã xóa tài khoản",accountUpdated:"Đã cập nhật tài khoản",tokenRefreshed:"Đã làm mới token",settingsSaved:"Đã lưu cài đặt",dataCopied:"Đã sao chép dữ liệu",dataExported:"Đã xuất dữ liệu",dataImported:"Đã nhập dữ liệu",machineIdChanged:"Đã đổi mã máy",machineIdRestored:"Đã khôi phục mã máy"},register:{title:"Đăng ký tài khoản",mode:"Chế độ đăng ký",manual:"Thủ công",proxyLabel:"Proxy (không bắt buộc)",proxyPlaceholder:"socks5://127.0.0.1:1080",moApiUrl:"URL API MoEmail",moApiKey:"API Key",optional:"không bắt buộc",outlookAccounts:"Tài khoản Outlook",outlookFormat:"email----mật khẩu----clientId----token",outlookPlaceholder:"user@outlook.com----matkhau----clientId----refreshToken",tempmail:"Tên miền riêng",tempMailDomain:"Tên miền riêng",tempMailEmail:"Tên đăng nhập TempMail.Plus",tempMailEmailPlaceholder:"username (không gồm @mailto.plus)",tempMailEpin:"PIN truy cập TempMail.Plus",tempMailDesc:"Tên miền cần chuyển tiếp catch-all về hộp thư TempMail.Plus. Prefix email sẽ được tạo ngẫu nhiên.",emailLabel:"Email",emailPlaceholder:"ten@mien.com",fullNameLabel:"Họ tên (không bắt buộc)",fullNamePlaceholder:"Nguyễn Văn A",submitEmail:"Gửi email",otpLabel:"Mã xác minh",otpSentTo:"Mã đã gửi đến",submitOtp:"Gửi mã",startRegistration:"Bắt đầu đăng ký",cancel:"Hủy",newRegistration:"Đăng ký mới",processing:"Đang xử lý...",success:"Đăng ký thành công",failed:"Đăng ký thất bại",emailField:"Email:",passwordField:"Mật khẩu:",importToManager:"Nhập vào trình quản lý",imported:"Đã nhập",log:"Nhật ký",logManualInit:"Chế độ thủ công: đang khởi tạo OIDC + xác thực thiết bị...",logInitDone:"Khởi tạo xong, vui lòng nhập email",logInitFailed:"Khởi tạo thất bại:",logSubmitEmail:"Đang gửi email:",logOtpSent:"Đã gửi mã, vui lòng kiểm tra hộp thư",logFailed:"Thất bại:",logSubmitOtp:"Đang gửi mã:",logAutoStart:"Chế độ tự động ({mode}) đang bắt đầu đăng ký...",logStartFailed:"Khởi chạy thất bại:",logCancelled:"Đã hủy",logRegSuccess:"Đăng ký thành công! Email:",logRegFailed:"Đăng ký thất bại:",logImported:"Đã nhập tài khoản vào trình quản lý",logVerifyFailed:"Xác minh thất bại:",logDirectImport:"Đã nhập trực tiếp, cần làm mới thủ công",logImportFailed:"Nhập thất bại:",fullNameRandom:"Họ tên (bỏ trống sẽ tạo ngẫu nhiên)",parentEmailSection:"Email chính và biến thể ẩn danh",parentEmailLabel:"Email chính (nhận OTP)",parentEmailPlaceholder:"ten-cua-anh@gmail.com",parentEmailHint:"Không bắt buộc. Cần nhập khi bật ẩn danh; nếu không có thể nhập thủ công sau khi khởi tạo.",anonymousEmailLabel:"Email ẩn danh ngẫu nhiên (biến thể dấu chấm)",anonymousEmailHint:"Chèn dấu `.` vào phần tên email để tạo biến thể. Hệ thống kiểm tra danh sách tài khoản cục bộ để tránh trùng.",nextVariant:"Biến thể tiếp theo",dotCount:"Số dấu chấm",sameRoot:"Đã dùng cùng gốc",anonymousNoParent:"Vui lòng nhập email chính trước",anonymousInvalid:"Định dạng email chính không hợp lệ",anonymousExhausted:"Đã hết biến thể dấu chấm; hãy dùng email chính khác",logAnonymousNoParent:"[Ẩn danh] Email chính trống hoặc không hợp lệ, đã dừng",logAnonymousExhausted:"[Ẩn danh] Đã hết biến thể dấu chấm; hãy dùng email chính khác",logAnonymousGenerated:"[Ẩn danh] Đã tạo biến thể {email} ({dots} dấu chấm)",batchTitle:"Đăng ký hàng loạt",batchCount:"Số lượng",batchInterval:"Khoảng cách (giây)",batchStart:"Bắt đầu hàng loạt",batchStop:"Dừng hàng loạt",batchProgress:"Tiến độ",batchSuccess:"Thành công",batchFail:"Thất bại",historyTitle:"Lịch sử đăng ký",historyEmpty:"Chưa có bản ghi đăng ký",historyClear:"Xóa lịch sử",historyTime:"Thời gian",historyStatus:"Trạng thái",historyImport:"Nhập",batchAutoImport:"Tự nhập",batchAutoImportDesc:"Xác minh và nhập vào trình quản lý khi thành công",autoFetchProLink:"Lấy link Pro",autoFetchProLinkDesc:"Tự lấy link đăng ký Kiro Pro sau khi đăng ký",fetchingProLink:"Đang lấy link đăng ký Pro",linkCopied:"Đã sao chép link",batchRetries:"Số lần thử lại",batchConcurrency:"Số luồng",batchRetrying:"Đang thử lại ({current}/{max})...",batchItemSuccess:"Thành công",batchItemFailed:"Thất bại",batchItemRetrying:"Đang thử lại",batchItemImported:"Đã nhập",batchItemImportFailed:"Nhập thất bại",batchCompleted:"Đăng ký hàng loạt đã hoàn tất",batchStopped:"Đăng ký hàng loạt đã dừng tại {done}/{total}"}},Hv={en:Kv,zh:Kv};function xE(){return"en"}function gE(n){return xE()}function yE(n,s){const r=s.split(".");let i=n;for(const o of r){if(typeof i=="string"||i[o]===void 0)return s;i=i[o]}return typeof i=="string"?i:s}function bE(n,s,r){let i=yE(Hv[s]||Hv.en,n);return r&&i!==n&&Object.entries(r).forEach(([o,d])=>{i=i.replace(new RegExp(`\\{${o}\\}`,"g"),String(d))}),i}function Ut(){const n=vt(i=>i.language),s=g.useMemo(()=>gE(),[n]);return{t:g.useMemo(()=>(i,o)=>bE(i,s,o),[s]),language:n,actualLanguage:s}}function vu(n){let s=255,r=n;n.length===9&&n.startsWith("#")&&(s=parseInt(n.slice(1,3),16),r="#"+n.slice(3));const i=r.startsWith("#")?r.slice(1):r,o=parseInt(i.slice(0,2),16),d=parseInt(i.slice(2,4),16),u=parseInt(i.slice(4,6),16);return`rgba(${o}, ${d}, ${u}, ${s/255})`}function vE(n){if(n.length===0)return{};if(n.length===1){const r=vu(n[0]),i=r.replace("1)","0.15)");return{boxShadow:`0 0 0 1px ${r}, 0 4px 12px -2px ${i}`}}return{background:`linear-gradient(var(--card-solid), var(--card-solid)) padding-box, linear-gradient(135deg, ${n.map((r,i)=>{const o=i/n.length*100,d=(i+1)/n.length*100;return`${vu(r)} ${o}%, ${vu(r)} ${d}%`}).join(", ")}) border-box`,border:"1.5px solid transparent",boxShadow:"0 4px 12px -2px rgba(0, 0, 0, 0.05)"}}const jE=(n,s)=>{const r=(s||n).toUpperCase();return r.includes("PRO+")||r.includes("PRO_PLUS")||r.includes("PROPLUS")?"bg-purple-500":r.includes("POWER")?"bg-amber-500":r.includes("PRO")?"bg-blue-500":"bg-gray-500"},NE={active:"正常",expired:"已过期",error:"错误",refreshing:"刷新中",unknown:"未知"},wE={active:"Active",expired:"Expired",error:"Error",refreshing:"Refreshing",unknown:"Unknown"};function rc(n){return n.nickname?n.nickname:n.email?n.email:n.userId?n.userId:"Unknown"}function kE(n,s){const r=Date.now(),i=n-r;if(i<=0)return s?"Expired":"已过期";const o=Math.floor(i/(60*1e3)),d=Math.floor(i/(3600*1e3));if(o<60)return s?`${o}m`:`${o} 分钟`;if(d<24){const u=o%60;return s?u>0?`${d}h ${u}m`:`${d}h`:u>0?`${d} 小时 ${u} 分`:`${d} 小时`}else{const u=Math.floor(d/24),h=d%24;return s?h>0?`${u}d ${h}h`:`${u}d`:h>0?`${u} 天 ${h} 小时`:`${u} 天`}}const SE=g.memo(function({account:s,tags:r,groups:i,isSelected:o,onSelect:d,onEdit:u,onShowDetail:h}){const{setActiveAccount:f,removeAccount:p,checkAccountStatus:y,refreshAccountToken:b,toggleSelection:v,maskEmail:N,maskNickname:j,usagePrecision:T,updateAccountStatus:S,accountProxyBindings:k,proxyPool:R,unbindAccountFromProxy:I}=vt(),M=g.useMemo(()=>{const O=k[s.id];return O&&R.get(O)||null},[k,s.id,R]),[G,W]=g.useState(!1),U=async O=>{if(O.stopPropagation(),!G){W(!0);try{const ne=await window.api.proxyClearAccountSuspended(s.id);ne.success?(S(s.id,"active",void 0),ue(!1)):console.error("[AccountCard] Clear suspended failed:",ne.error)}catch(ne){console.error("[AccountCard] Clear suspended error:",ne)}finally{W(!1)}}},{t:q}=Ut(),V=q("common.unknown")==="Unknown",le=O=>T?O.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:2}):Math.floor(O).toLocaleString(),B=async()=>{const{credentials:O}=s,{switchTarget:ne}=vt.getState();if(!O.refreshToken){alert(V?"Incomplete credentials, cannot switch":"账号凭证不完整,无法切换");return}if(O.authMethod!=="social"&&(!O.clientId||!O.clientSecret)){alert(V?"Incomplete credentials, cannot switch":"账号凭证不完整,无法切换");return}const ze={accessToken:O.accessToken,refreshToken:O.refreshToken,clientId:O.clientId,clientSecret:O.clientSecret,region:O.region||"us-east-1",profileArn:s.profileArn,provider:O.provider},_={accessToken:O.accessToken,refreshToken:O.refreshToken,clientId:O.clientId||"",clientSecret:O.clientSecret||"",region:O.region||"us-east-1",startUrl:O.startUrl,authMethod:O.authMethod,provider:O.provider,profileArn:s.profileArn,accountId:s.id};let ce=!0,Ce="";if(ne==="ide"||ne==="both"){const Ve=await window.api.switchAccount(_);if(!Ve.success)ce=!1,Ce=Ve.error||"";else if(Ve.refreshedCredentials){const je=Ve.refreshedCredentials;vt.setState(He=>{const Tt=new Map(He.accounts),H=Tt.get(s.id);return H&&Tt.set(s.id,{...H,credentials:{...H.credentials,accessToken:je.accessToken,refreshToken:je.refreshToken,expiresAt:Date.now()+je.expiresIn*1e3}}),{accounts:Tt}}),vt.getState().saveToStorage()}}if(ne==="cli"||ne==="both"){const Ve=await window.api.switchAccountCli(ze);!Ve.success&&ne==="cli"&&(ce=!1,Ce=Ve.error||"")}ce?f(s.id):alert(V?`Switch failed: ${Ce}`:`切换失败: ${Ce}`)},be=async()=>{await y(s.id)},K=async()=>{if(!confirm(V?"This will clear local SSO cache and logout from Kiro. Continue?":"这将清除本地 SSO 缓存并退出 Kiro 登录,是否继续?"))return;const O=await window.api.logoutAccount();O.success?(f(null),alert(V?`Logged out successfully, cleared ${O.deletedCount} cache files`:`退出成功,已清除 ${O.deletedCount} 个缓存文件`)):alert(V?`Logout failed: ${O.error}`:`退出失败: ${O.error}`)},[se,te]=g.useState(!1),Y=async()=>{te(!0);try{await b(s.id)}finally{te(!1)}},P=()=>{confirm(V?`Delete account ${rc(s)}?`:`确定要删除账号 ${rc(s)} 吗?`)&&p(s.id)},[F,fe]=g.useState(!1),[pe,C]=g.useState(!1),z=()=>{const O={accessToken:s.credentials.accessToken,refreshToken:s.credentials.refreshToken,clientId:s.credentials.clientId,clientSecret:s.credentials.clientSecret};navigator.clipboard.writeText(JSON.stringify(O,null,2)),fe(!0),setTimeout(()=>fe(!1),2e3)},X=s.tags.map(O=>r.get(O)).filter(O=>O!==void 0),re=s.groupId?i.get(s.groupId):void 0,xe=g.useMemo(()=>{const O=X.map(ne=>ne.color);return vE(O)},[X]),Oe=s.subscription.daysRemaining!==void 0&&s.subscription.daysRemaining<=7,Ee=s.usage.percentUsed>.8,Qe=s.usage.percentUsed>1,_e=s.lastError?.toLowerCase(),st=!!_e&&(_e.includes("accountsuspendedexception")||_e.includes("account suspended")||_e.includes("temporarily_suspended")||_e.includes("temporarily suspended")||_e.includes("user id is")&&_e.includes("suspended")||_e.includes("账户已封禁")||_e.includes("已封禁")||/\b423\b/.test(_e)),[oe,ue]=g.useState(!1),[ae,L]=g.useState(!1),[we,Ue]=g.useState(!1),[Lt,xt]=g.useState([]),[Qt,ft]=g.useState(null),[Et,Ge]=g.useState(!1),[gt,Ze]=g.useState(!1),[J,Ne]=g.useState(null),[et,qe]=g.useState(null),Je=async O=>{if(O.stopPropagation(),!(we||!s.credentials?.accessToken)){Ue(!0);try{const ne=await window.api.accountGetSubscriptions(s.credentials.accessToken,s.credentials?.region,s.profileArn,s.machineId,s.credentials?.provider||s.idp,s.credentials?.authMethod,s.id);if(ne.success&&ne.plans.length>0){xt(ne.plans);const ze=s.subscription.type?.toUpperCase()||"",_=ze===""||ze.includes("FREE");Ze(_),L(!0)}else console.error("[AccountCard] Failed to get subscriptions:",ne.error)}catch(ne){console.error("[AccountCard] Subscription click error:",ne)}finally{Ue(!1)}}},Kt=async O=>{if(!(Et||!s.credentials?.accessToken)){ft(O),Ge(!0),Ne(null);try{const ne=await window.api.accountGetSubscriptionUrl(s.credentials.accessToken,O,s.credentials?.region,s.profileArn,s.machineId,s.credentials?.provider||s.idp,s.credentials?.authMethod,s.id);if(ne.success&&ne.url){await navigator.clipboard.writeText(ne.url),qe(V?"Link copied to clipboard!":"链接已复制到剪贴板!");const ze=ne.url;setTimeout(async()=>{L(!1),qe(null),await window.api.openSubscriptionWindow(ze)},800)}else{const ze=ne.error||(V?"Failed to get payment URL":"获取支付链接失败");Ne(ze),console.error("[AccountCard] Failed to get payment URL:",ne.error)}}catch(ne){const ze=ne instanceof Error?ne.message:V?"Unknown error":"未知错误";Ne(ze),console.error("[AccountCard] Payment URL error:",ne)}finally{Ge(!1),ft(null)}}},Ye=async()=>{if(!(Et||!s.credentials?.accessToken)){Ge(!0),Ne(null);try{const O=await window.api.accountGetSubscriptionUrl(s.credentials.accessToken,void 0,s.credentials?.region,s.profileArn,s.machineId,s.credentials?.provider||s.idp,s.credentials?.authMethod,s.id);if(O.success&&O.url)L(!1),await window.api.openSubscriptionWindow(O.url);else{const ne=O.error||(V?"Failed to get management URL":"获取管理链接失败");Ne(ne),console.error("[AccountCard] Failed to get management URL:",O.error)}}catch(O){const ne=O instanceof Error?O.message:V?"Unknown error":"未知错误";Ne(ne),console.error("[AccountCard] Management URL error:",O)}finally{Ge(!1)}}},qt=st?{backgroundColor:"var(--card-unauthorized-bg)",borderColor:"var(--card-unauthorized-border)",boxShadow:`
|
|
32
|
+
0 0 0 1px var(--card-unauthorized-ring),
|
|
33
|
+
0 4px 20px -2px var(--card-unauthorized-shadow),
|
|
34
|
+
inset 0 0 20px var(--card-unauthorized-glow)
|
|
35
|
+
`}:{},Jt=s.isActive?{boxShadow:"0 8px 24px -4px var(--card-active-shadow)"}:{};let Ct={};return s.isActive?Ct={...xe,...Jt}:st?Ct=qt:Ct=xe,e.jsxs(De,{className:me("relative cursor-pointer h-full flex flex-col overflow-hidden bg-solid-card",!s.isActive&&!st&&"hover-lift",s.isActive&&"border-transparent active-glow-border",st&&"border-destructive/50",X.length>0&&!s.isActive&&!st&&"border-transparent"),style:Ct,onClick:()=>v(s.id),children:[o&&!s.isActive&&!st&&e.jsx("div",{className:"absolute inset-0 pointer-events-none rounded-[inherit] ring-2 ring-inset ring-primary/60 bg-primary/[0.08] z-10"}),s.isActive&&st&&e.jsx("div",{className:"banned-badge",title:q("accounts.card.banned")}),e.jsxs(Pe,{className:"p-4 flex-1 flex flex-col gap-3 overflow-hidden",children:[e.jsxs("div",{className:"flex gap-3 items-start",children:[e.jsx("div",{className:me("w-5 h-5 rounded border-2 flex items-center justify-center transition-colors flex-shrink-0 mt-0.5 cursor-pointer",o?"bg-primary border-primary text-primary-foreground":"border-muted-foreground/30 hover:border-primary"),onClick:O=>{O.stopPropagation(),d()},children:o&&e.jsx(Pt,{className:"h-3.5 w-3.5"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("h3",{className:me("font-semibold text-sm truncate cursor-pointer transition-colors",pe?"text-success":"text-foreground/90 hover:text-primary"),title:`${rc(s)} (${V?"Click to copy":"点击复制"})`,onClick:O=>{O.stopPropagation();const ne=s.email||s.userId||"";ne&&(navigator.clipboard.writeText(ne),C(!0),setTimeout(()=>C(!1),1500))},children:pe?V?"Copied!":"已复制!":s.email?N(s.email):rc(s)}),e.jsxs("div",{className:me("text-[10px] font-medium px-2 py-0.5 rounded-full flex items-center gap-1 flex-shrink-0",st?"text-destructive bg-destructive/10":s.status==="active"?"text-success bg-success/10":s.status==="error"?"text-destructive bg-destructive/10":s.status==="expired"?"text-warning bg-warning/10":s.status==="refreshing"?"text-primary bg-primary/10":"text-muted-foreground bg-muted"),children:[s.status==="refreshing"&&e.jsx(bt,{className:"h-3 w-3 animate-spin"}),st&&e.jsx(ln,{className:"h-3 w-3"}),st?e.jsx("span",{className:"cursor-pointer hover:underline",onClick:O=>{O.stopPropagation(),ue(!0)},children:V?"Banned":"已封禁"}):(V?wE:NE)[s.status]]})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[s.nickname&&e.jsx("span",{className:"text-xs text-muted-foreground truncate",children:j(s.nickname)}),re&&e.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-muted text-muted-foreground flex items-center gap-1",style:{color:re.color,backgroundColor:re.color+"15"},children:[e.jsx(Vi,{className:"w-3 h-3"})," ",re.name]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx($e,{className:me("text-white text-[10px] h-5 px-2 border-0 cursor-pointer transition-all hover:opacity-80 hover:scale-105",jE(s.subscription.type,s.subscription.title),we&&"opacity-60 cursor-wait"),onClick:Je,title:V?"Click to manage subscription":"点击管理订阅",children:we?V?"Loading...":"加载中...":s.subscription.title||s.subscription.type}),e.jsx($e,{variant:"outline",className:"text-[10px] h-5 px-2 text-muted-foreground font-normal border-muted-foreground/30 bg-muted/30",children:s.idp}),M&&e.jsxs($e,{variant:"outline",className:me("text-[10px] h-5 px-1.5 font-normal cursor-pointer transition-colors group",M.enabled&&M.status!=="dead"?"border-cyan-500/40 text-cyan-700 dark:text-cyan-300 bg-cyan-500/10 hover:bg-cyan-500/20":"border-amber-500/40 text-amber-700 dark:text-amber-300 bg-amber-500/10"),title:`${V?"Bound proxy:":"绑定代理:"} ${M.host}:${M.port}${M.label?` (${M.label})`:""}
|
|
36
|
+
${V?"Click to unbind":"点击解绑"}`,onClick:O=>{O.stopPropagation(),confirm(V?`Unbind ${s.email} from ${M.host}:${M.port}?`:`解绑 ${s.email} 与 ${M.host}:${M.port}?`)&&I(s.id)},children:[e.jsx("span",{className:"opacity-70 group-hover:hidden",children:"⇄"}),e.jsx("span",{className:"hidden group-hover:inline",children:"✕"}),e.jsx("span",{className:"ml-0.5",children:M.host.length>15?M.host.slice(0,12)+"…":M.host})]}),s.isActive&&e.jsx($e,{variant:"default",className:"ml-auto h-5 bg-success text-white border-0 hover:bg-success/90",children:V?"Active":"当前使用"})]}),e.jsxs("div",{className:"bg-muted/30 p-3 rounded-lg space-y-2 border border-border/50",children:[e.jsxs("div",{className:"flex justify-between items-end text-xs",children:[e.jsx("span",{className:"text-muted-foreground font-medium",children:V?"Usage":"使用量"}),e.jsxs("span",{className:me("font-mono font-medium tabular-nums",Qe?"text-destructive":Ee?"text-warning":"text-foreground"),children:[(s.usage.percentUsed*100).toFixed(T?2:0),"%",Qe&&e.jsxs("span",{className:"ml-1.5 text-[10px] text-red-600 font-semibold",children:["(+",((s.usage.percentUsed-1)*100).toFixed(T?2:0),"% ",V?"over":"超",")"]})]})]}),(()=>{const O=s.usage.percentUsed;if(Qe){const ne=1/O*100;return e.jsxs("div",{className:"relative h-1.5 w-full overflow-hidden rounded-full bg-foreground/10",children:[e.jsx("div",{className:"absolute inset-y-0 left-0 bg-warning transition-all duration-300",style:{width:`${ne}%`}}),e.jsx("div",{className:"absolute inset-y-0 right-0 bg-red-500 transition-all duration-300",style:{left:`${ne}%`}})]})}return e.jsx("div",{className:"relative h-1.5 w-full overflow-hidden rounded-full bg-foreground/10",children:e.jsx("div",{className:me("absolute inset-y-0 left-0 transition-all duration-300",Ee?"bg-warning":"bg-primary"),style:{width:`${Math.min(O*100,100)}%`}})})})(),e.jsxs("div",{className:"flex justify-between text-[10px] text-muted-foreground pt-0.5",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsxs("span",{children:[le(s.usage.current)," / ",le(s.usage.limit)]}),Qe&&e.jsxs("span",{className:"text-red-600 font-semibold",children:["(+",le(s.usage.current-s.usage.limit),")"]})]}),s.usage.nextResetDate&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(j3,{className:"h-3 w-3"}),(()=>{const O=s.usage.nextResetDate;try{return(typeof O=="string"?O:new Date(O).toISOString()).split("T")[0]}catch{return"Unknown"}})()," ",V?"reset":"重置"]})]})]}),e.jsxs("div",{className:"space-y-1.5 min-h-0 overflow-y-auto pr-1 text-[10px] max-h-24",children:[s.usage.baseLimit!==void 0&&s.usage.baseLimit>0&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-primary flex-shrink-0"}),e.jsx("span",{className:"text-muted-foreground",children:V?"Base:":"基础:"}),e.jsxs("span",{className:"font-medium",children:[le(s.usage.baseCurrent??0),"/",le(s.usage.baseLimit)]}),s.usage.nextResetDate&&e.jsxs("span",{className:"text-muted-foreground/70 ml-auto",children:[V?"to":"至"," ",(()=>{const O=s.usage.nextResetDate;try{return(typeof O=="string"?O:new Date(O).toISOString()).split("T")[0]}catch{return""}})()]})]}),s.usage.freeTrialLimit!==void 0&&s.usage.freeTrialLimit>0&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-warning flex-shrink-0"}),e.jsx("span",{className:"text-muted-foreground",children:V?"Trial:":"试用:"}),e.jsxs("span",{className:"font-medium",children:[le(s.usage.freeTrialCurrent??0),"/",le(s.usage.freeTrialLimit)]}),s.usage.freeTrialExpiry&&e.jsxs("span",{className:"text-muted-foreground/70 ml-auto",children:[V?"to":"至"," ",(()=>{const O=s.usage.freeTrialExpiry;try{return(typeof O=="string"?O:new Date(O).toISOString()).split("T")[0]}catch{return""}})()]})]}),s.usage.bonuses?.map(O=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-success flex-shrink-0"}),e.jsxs("span",{className:"text-muted-foreground truncate max-w-[80px]",title:O.name,children:[O.name,":"]}),e.jsxs("span",{className:"font-medium",children:[le(O.current),"/",le(O.limit)]}),O.expiresAt&&e.jsxs("span",{className:"text-muted-foreground/70 ml-auto",children:[V?"to":"至"," ",(()=>{const ne=O.expiresAt;try{return(typeof ne=="string"?ne:new Date(ne).toISOString()).split("T")[0]}catch{return""}})()]})]},O.code))]}),X.length>0&&e.jsxs("div",{className:"flex flex-wrap gap-1 mt-auto pt-2",children:[X.slice(0,4).map(O=>e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] rounded-sm text-white font-medium shadow-sm",style:{backgroundColor:vu(O.color)},children:O.name},O.id)),X.length>4&&e.jsxs("span",{className:"px-1.5 py-0.5 text-[10px] text-muted-foreground bg-muted rounded-sm",children:["+",X.length-4]})]}),e.jsxs("div",{className:"pt-3 border-t flex items-center justify-between mt-auto gap-2 shrink-0",children:[e.jsxs("div",{className:"text-[10px] text-muted-foreground flex flex-col leading-tight gap-0.5",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Gn,{className:"h-3 w-3"}),e.jsx("span",{className:Oe?"text-warning font-medium":"",children:s.subscription.daysRemaining!==void 0?V?`${s.subscription.daysRemaining}d left`:`剩 ${s.subscription.daysRemaining} 天`:"-"})]}),e.jsxs("div",{className:"flex items-center gap-1",title:s.credentials.expiresAt?new Date(s.credentials.expiresAt).toLocaleString(V?"en-US":"zh-CN"):V?"Unknown":"未知",children:[e.jsx(ii,{className:"h-3 w-3"}),e.jsxs("span",{className:s.credentials.expiresAt&&s.credentials.expiresAt-Date.now()<300*1e3?"text-red-500 font-medium":"",children:["Token: ",s.credentials.expiresAt?kE(s.credentials.expiresAt,V):"-"]})]})]}),e.jsxs("div",{className:"flex items-center gap-0.5",children:[s.isActive?e.jsx(D,{size:"icon",variant:"ghost",className:"h-7 w-7 hover:bg-destructive/10 hover:text-destructive transition-colors",onClick:O=>{O.stopPropagation(),K()},title:V?"Logout (clear SSO cache)":"退出登录(清除 SSO 缓存)",children:e.jsx(px,{className:"h-3.5 w-3.5"})}):e.jsx(D,{size:"icon",variant:"ghost",className:"h-7 w-7 hover:bg-primary/10 hover:text-primary transition-colors",onClick:O=>{O.stopPropagation(),B()},title:V?"Switch to this account":"切换到此账号",children:e.jsx(kc,{className:"h-3.5 w-3.5"})}),e.jsx(D,{size:"icon",variant:"ghost",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:O=>{O.stopPropagation(),be()},disabled:s.status==="refreshing",title:V?"Check account info":"检查账户信息(用量、订阅、封禁状态)",children:e.jsx(Mt,{className:me("h-3.5 w-3.5",s.status==="refreshing"&&"animate-spin")})}),e.jsx(D,{size:"icon",variant:"ghost",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:O=>{O.stopPropagation(),Y()},disabled:se,title:V?"Refresh Token":"刷新 Token(仅刷新访问令牌)",children:e.jsx(ii,{className:me("h-3.5 w-3.5",se&&"animate-pulse")})}),e.jsx(D,{size:"icon",variant:"ghost",className:me("h-7 w-7 text-muted-foreground hover:text-foreground",F&&"text-success"),onClick:O=>{O.stopPropagation(),z()},title:V?"Copy credentials":"复制凭证",children:F?e.jsx(Pt,{className:"h-3.5 w-3.5"}):e.jsx(As,{className:"h-3.5 w-3.5"})}),e.jsx(D,{size:"icon",variant:"ghost",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:O=>{O.stopPropagation(),h()},title:V?"Details":"详情",children:e.jsx(Va,{className:"h-3.5 w-3.5"})}),e.jsx(D,{size:"icon",variant:"ghost",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:O=>{O.stopPropagation(),u()},title:V?"Edit":"编辑",children:e.jsx(Ou,{className:"h-3.5 w-3.5"})}),e.jsx(D,{size:"icon",variant:"ghost",className:"h-7 w-7 text-muted-foreground hover:text-destructive transition-colors",onClick:O=>{O.stopPropagation(),P()},title:V?"Delete":"删除",children:e.jsx(Vt,{className:"h-3.5 w-3.5"})})]})]}),s.lastError&&!st&&e.jsxs("div",{className:"bg-red-50 text-red-600 text-[10px] p-1.5 rounded flex items-center gap-1.5 truncate mt-1",title:s.lastError,children:[e.jsx(Rs,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{className:"truncate",children:s.lastError})]})]}),oe&&st&&Tn.createPortal(e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:()=>ue(!1)}),e.jsxs("div",{className:"relative bg-background rounded-xl shadow-2xl w-full max-w-lg m-4 animate-in fade-in zoom-in-95 duration-200 border overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b flex items-center justify-between bg-red-50 dark:bg-red-900/20",children:[e.jsxs("div",{className:"flex items-center gap-2 text-red-600 dark:text-red-400",children:[e.jsx(ln,{className:"h-5 w-5"}),e.jsx("span",{className:"font-bold",children:V?"Account Suspended":"账户已封禁"})]}),e.jsx(D,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-lg hover:bg-red-500 hover:text-white transition-colors",onClick:()=>ue(!1),children:e.jsx(ns,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:V?"Account":"账户"}),e.jsx("div",{className:"text-sm font-medium",children:rc(s)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:V?"Error Details":"错误详情"}),e.jsx("div",{className:"text-xs font-mono bg-muted/50 p-3 rounded-lg border break-all whitespace-pre-wrap max-h-[200px] overflow-y-auto",children:s.lastError})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2 gap-2 flex-wrap",children:[e.jsxs("a",{href:"https://support.aws.amazon.com/#/contacts/kiro",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline flex items-center gap-1",onClick:O=>O.stopPropagation(),children:[e.jsx(Xs,{className:"h-3 w-3"}),V?"Contact Support":"联系支持"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(D,{size:"sm",variant:"outline",onClick:U,disabled:G,title:V?"Mark as recovered — proxy pool will use this account again":"标记为已恢复 — 反代池会重新使用该账号",children:[G?e.jsx(Mt,{className:"h-3 w-3 mr-1 animate-spin"}):e.jsx(gr,{className:"h-3 w-3 mr-1"}),V?"Reset Suspended":"重置封禁状态"]}),e.jsx(D,{size:"sm",variant:"outline",onClick:()=>ue(!1),children:V?"Close":"关闭"})]})]})]})]})]}),document.body),ae&&Tn.createPortal(e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:()=>{L(!1),Ze(!1),Ne(null),qe(null)}}),e.jsxs("div",{className:"relative bg-background rounded-xl shadow-2xl w-full max-w-2xl m-4 animate-in fade-in zoom-in-95 duration-200 border overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b flex items-center justify-between bg-gradient-to-r from-primary/10 to-[var(--gradient-to)]/10",children:[e.jsxs("div",{className:"flex items-center gap-2 text-primary",children:[e.jsx($a,{className:"h-5 w-5"}),e.jsx("span",{className:"font-bold",children:V?gt?"Choose Your Plan":"Subscription Plans":gt?"选择订阅计划":"订阅计划"})]}),e.jsx(D,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-lg hover:bg-red-500 hover:text-white transition-colors",onClick:()=>{L(!1),Ze(!1),Ne(null),qe(null)},children:e.jsx(ns,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"p-4 space-y-4",children:[gt?e.jsx("div",{className:"text-xs text-muted-foreground mb-2 bg-warning/10 text-warning p-2 rounded-lg",children:V?"Please select a subscription plan to continue.":"请选择一个订阅计划以继续使用。"}):e.jsxs("div",{className:"text-xs text-muted-foreground mb-2",children:[V?"Current subscription: ":"当前订阅: ",e.jsx("span",{className:"font-medium text-foreground",children:s.subscription.title||s.subscription.type})]}),J&&e.jsxs("div",{className:"text-xs bg-red-500/10 text-red-600 dark:text-red-400 p-2 rounded-lg flex items-center gap-2",children:[e.jsx(ln,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{children:J})]}),et&&e.jsxs("div",{className:"text-xs bg-success/10 text-success p-2 rounded-lg flex items-center gap-2",children:[e.jsx(Pt,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{children:et})]}),e.jsx("div",{className:"grid grid-cols-2 gap-3",children:Lt.map(O=>{const ne=O.name===s.subscription.type||O.description.title===s.subscription.title,ze=Et&&Qt===O.qSubscriptionType;return e.jsxs("div",{className:me("relative p-4 rounded-lg border-2 transition-all cursor-pointer hover:shadow-md",ne?"border-primary bg-primary/5":"border-border hover:border-primary/50",ze&&"opacity-70 cursor-wait"),onClick:()=>!ne&&Kt(O.qSubscriptionType),children:[ne&&e.jsx("div",{className:"absolute -top-2 -right-2 bg-primary text-primary-foreground text-[10px] px-2 py-0.5 rounded-full font-medium",children:V?"Current":"当前"}),e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(Hi,{className:me("h-4 w-4",O.pricing.amount===0?"text-green-500":"text-amber-500")}),e.jsx("span",{className:"font-bold text-sm",children:O.description.title})]}),e.jsxs("div",{className:"text-2xl font-bold mb-2",children:[O.pricing.amount===0?V?"Free":"免费":`$${O.pricing.amount}`,O.pricing.amount>0&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground",children:["/",O.description.billingInterval]})]}),e.jsx("ul",{className:"space-y-1.5",children:O.description.features.slice(0,4).map((_,ce)=>e.jsxs("li",{className:"text-xs text-muted-foreground flex items-start gap-1.5",children:[e.jsx(Pt,{className:"h-3 w-3 text-green-500 mt-0.5 shrink-0"}),e.jsx("span",{children:_})]},ce))}),!ne&&e.jsx(D,{size:"sm",className:"w-full mt-3",variant:O.pricing.amount===0?"outline":"default",disabled:ze,children:ze?e.jsxs(e.Fragment,{children:[e.jsx(bt,{className:"h-3 w-3 mr-1 animate-spin"}),V?"Loading...":"加载中..."]}):V?"Select":"选择"})]},O.name)})}),e.jsxs("div",{className:"flex items-center justify-between pt-3 border-t",children:[e.jsx(D,{size:"sm",variant:"outline",onClick:Ye,disabled:Et,className:"text-xs",children:Et&&!Qt?e.jsxs(e.Fragment,{children:[e.jsx(bt,{className:"h-3 w-3 mr-1 animate-spin"}),V?"Loading...":"加载中..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Xs,{className:"h-3 w-3 mr-1"}),V?"Manage Billing":"管理账单"]})}),e.jsx(D,{size:"sm",variant:"ghost",onClick:()=>{L(!1),Ze(!1),Ne(null),qe(null)},children:V?"Close":"关闭"})]})]})]})]}),document.body)]})});function Pl(n,s,r){let i=r.initialDeps??[],o;function d(){var u,h,f,p;let y;r.key&&((u=r.debug)!=null&&u.call(r))&&(y=Date.now());const b=n();if(!(b.length!==i.length||b.some((j,T)=>i[T]!==j)))return o;i=b;let N;if(r.key&&((h=r.debug)!=null&&h.call(r))&&(N=Date.now()),o=s(...b),r.key&&((f=r.debug)!=null&&f.call(r))){const j=Math.round((Date.now()-y)*100)/100,T=Math.round((Date.now()-N)*100)/100,S=T/16,k=(R,I)=>{for(R=String(R);R.length<I;)R=" "+R;return R};console.info(`%c⏱ ${k(T,5)} /${k(j,5)} ms`,`
|
|
37
|
+
font-size: .6rem;
|
|
38
|
+
font-weight: bold;
|
|
39
|
+
color: hsl(${Math.max(0,Math.min(120-120*S,120))}deg 100% 31%);`,r?.key)}return(p=r?.onChange)==null||p.call(r,o),o}return d.updateDeps=u=>{i=u},d}function Fv(n,s){if(n===void 0)throw new Error("Unexpected undefined");return n}const CE=(n,s)=>Math.abs(n-s)<1.01,TE=(n,s,r)=>{let i;return function(...o){n.clearTimeout(i),i=n.setTimeout(()=>s.apply(this,o),r)}},Gv=n=>{const{offsetWidth:s,offsetHeight:r}=n;return{width:s,height:r}},AE=n=>n,ME=n=>{const s=Math.max(n.startIndex-n.overscan,0),r=Math.min(n.endIndex+n.overscan,n.count-1),i=[];for(let o=s;o<=r;o++)i.push(o);return i},EE=(n,s)=>{const r=n.scrollElement;if(!r)return;const i=n.targetWindow;if(!i)return;const o=u=>{const{width:h,height:f}=u;s({width:Math.round(h),height:Math.round(f)})};if(o(Gv(r)),!i.ResizeObserver)return()=>{};const d=new i.ResizeObserver(u=>{const h=()=>{const f=u[0];if(f?.borderBoxSize){const p=f.borderBoxSize[0];if(p){o({width:p.inlineSize,height:p.blockSize});return}}o(Gv(r))};n.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(h):h()});return d.observe(r,{box:"border-box"}),()=>{d.unobserve(r)}},qv={passive:!0},Xv=typeof window>"u"?!0:"onscrollend"in window,IE=(n,s)=>{const r=n.scrollElement;if(!r)return;const i=n.targetWindow;if(!i)return;let o=0;const d=n.options.useScrollendEvent&&Xv?()=>{}:TE(i,()=>{s(o,!1)},n.options.isScrollingResetDelay),u=y=>()=>{const{horizontal:b,isRtl:v}=n.options;o=b?r.scrollLeft*(v&&-1||1):r.scrollTop,d(),s(o,y)},h=u(!0),f=u(!1);f(),r.addEventListener("scroll",h,qv);const p=n.options.useScrollendEvent&&Xv;return p&&r.addEventListener("scrollend",f,qv),()=>{r.removeEventListener("scroll",h),p&&r.removeEventListener("scrollend",f)}},RE=(n,s,r)=>{if(s?.borderBoxSize){const i=s.borderBoxSize[0];if(i)return Math.round(i[r.options.horizontal?"inlineSize":"blockSize"])}return n[r.options.horizontal?"offsetWidth":"offsetHeight"]},DE=(n,{adjustments:s=0,behavior:r},i)=>{var o,d;const u=n+s;(d=(o=i.scrollElement)==null?void 0:o.scrollTo)==null||d.call(o,{[i.options.horizontal?"left":"top"]:u,behavior:r})};class PE{constructor(s){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let r=null;const i=()=>r||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:r=new this.targetWindow.ResizeObserver(o=>{o.forEach(d=>{const u=()=>{this._measureElement(d.target,d)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(u):u()})}));return{disconnect:()=>{var o;(o=i())==null||o.disconnect(),r=null},observe:o=>{var d;return(d=i())==null?void 0:d.observe(o,{box:"border-box"})},unobserve:o=>{var d;return(d=i())==null?void 0:d.unobserve(o)}}})(),this.range=null,this.setOptions=r=>{Object.entries(r).forEach(([i,o])=>{typeof o>"u"&&delete r[i]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:AE,rangeExtractor:ME,onChange:()=>{},measureElement:RE,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...r}},this.notify=r=>{var i,o;(o=(i=this.options).onChange)==null||o.call(i,this,r)},this.maybeNotify=Pl(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),r=>{this.notify(r)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(r=>r()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var r;const i=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==i){if(this.cleanup(),!i){this.maybeNotify();return}this.scrollElement=i,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((r=this.scrollElement)==null?void 0:r.window)??null,this.elementsCache.forEach(o=>{this.observer.observe(o)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,o=>{this.scrollRect=o,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(o,d)=>{this.scrollAdjustments=0,this.scrollDirection=d?this.getScrollOffset()<o?"forward":"backward":null,this.scrollOffset=o,this.isScrolling=d,this.maybeNotify()}))}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(r,i)=>{const o=new Map,d=new Map;for(let u=i-1;u>=0;u--){const h=r[u];if(o.has(h.lane))continue;const f=d.get(h.lane);if(f==null||h.end>f.end?d.set(h.lane,h):h.end<f.end&&o.set(h.lane,!0),o.size===this.options.lanes)break}return d.size===this.options.lanes?Array.from(d.values()).sort((u,h)=>u.end===h.end?u.index-h.index:u.end-h.end)[0]:void 0},this.getMeasurementOptions=Pl(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(r,i,o,d,u)=>(this.pendingMeasuredCacheIndexes=[],{count:r,paddingStart:i,scrollMargin:o,getItemKey:d,enabled:u}),{key:!1}),this.getMeasurements=Pl(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:r,paddingStart:i,scrollMargin:o,getItemKey:d,enabled:u},h)=>{if(!u)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(y=>{this.itemSizeCache.set(y.key,y.size)}));const f=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const p=this.measurementsCache.slice(0,f);for(let y=f;y<r;y++){const b=d(y),v=this.options.lanes===1?p[y-1]:this.getFurthestMeasurement(p,y),N=v?v.end+this.options.gap:i+o,j=h.get(b),T=typeof j=="number"?j:this.options.estimateSize(y),S=N+T,k=v?v.lane:y%this.options.lanes;p[y]={index:y,start:N,size:T,end:S,key:b,lane:k}}return this.measurementsCache=p,p},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Pl(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(r,i,o,d)=>this.range=r.length>0&&i>0?LE({measurements:r,outerSize:i,scrollOffset:o,lanes:d}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Pl(()=>{let r=null,i=null;const o=this.calculateRange();return o&&(r=o.startIndex,i=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,r,i]),[this.options.rangeExtractor,this.options.overscan,this.options.count,r,i]},(r,i,o,d,u)=>d===null||u===null?[]:r({startIndex:d,endIndex:u,overscan:i,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=r=>{const i=this.options.indexAttribute,o=r.getAttribute(i);return o?parseInt(o,10):(console.warn(`Missing attribute name '${i}={index}' on measured element.`),-1)},this._measureElement=(r,i)=>{const o=this.indexFromElement(r),d=this.measurementsCache[o];if(!d)return;const u=d.key,h=this.elementsCache.get(u);h!==r&&(h&&this.observer.unobserve(h),this.observer.observe(r),this.elementsCache.set(u,r)),r.isConnected&&this.resizeItem(o,this.options.measureElement(r,i,this))},this.resizeItem=(r,i)=>{const o=this.measurementsCache[r];if(!o)return;const d=this.itemSizeCache.get(o.key)??o.size,u=i-d;u!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(o,u,this):o.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=u,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(o.index),this.itemSizeCache=new Map(this.itemSizeCache.set(o.key,i)),this.notify(!1))},this.measureElement=r=>{if(!r){this.elementsCache.forEach((i,o)=>{i.isConnected||(this.observer.unobserve(i),this.elementsCache.delete(o))});return}this._measureElement(r,void 0)},this.getVirtualItems=Pl(()=>[this.getVirtualIndexes(),this.getMeasurements()],(r,i)=>{const o=[];for(let d=0,u=r.length;d<u;d++){const h=r[d],f=i[h];o.push(f)}return o},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=r=>{const i=this.getMeasurements();if(i.length!==0)return Fv(i[JN(0,i.length-1,o=>Fv(i[o]).start,r)])},this.getOffsetForAlignment=(r,i,o=0)=>{const d=this.getSize(),u=this.getScrollOffset();i==="auto"&&(i=r>=u+d?"end":"start"),i==="center"?r+=(o-d)/2:i==="end"&&(r-=d);const h=this.getTotalSize()+this.options.scrollMargin-d;return Math.max(Math.min(h,r),0)},this.getOffsetForIndex=(r,i="auto")=>{r=Math.max(0,Math.min(r,this.options.count-1));const o=this.measurementsCache[r];if(!o)return;const d=this.getSize(),u=this.getScrollOffset();if(i==="auto")if(o.end>=u+d-this.options.scrollPaddingEnd)i="end";else if(o.start<=u+this.options.scrollPaddingStart)i="start";else return[u,i];const h=i==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(h,i,o.size),i]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(r,{align:i="start",behavior:o}={})=>{o==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(r,i),{adjustments:void 0,behavior:o})},this.scrollToIndex=(r,{align:i="auto",behavior:o}={})=>{o==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),r=Math.max(0,Math.min(r,this.options.count-1));let d=0;const u=10,h=p=>{if(!this.targetWindow)return;const y=this.getOffsetForIndex(r,p);if(!y){console.warn("Failed to get offset for index:",r);return}const[b,v]=y;this._scrollToOffset(b,{adjustments:void 0,behavior:o}),this.targetWindow.requestAnimationFrame(()=>{const N=this.getScrollOffset(),j=this.getOffsetForIndex(r,v);if(!j){console.warn("Failed to get offset for index:",r);return}CE(j[0],N)||f(v)})},f=p=>{this.targetWindow&&(d++,d<u?this.targetWindow.requestAnimationFrame(()=>h(p)):console.warn(`Failed to scroll to index ${r} after ${u} attempts.`))};h(i)},this.scrollBy=(r,{behavior:i}={})=>{i==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+r,{adjustments:void 0,behavior:i})},this.getTotalSize=()=>{var r;const i=this.getMeasurements();let o;if(i.length===0)o=this.options.paddingStart;else if(this.options.lanes===1)o=((r=i[i.length-1])==null?void 0:r.end)??0;else{const d=Array(this.options.lanes).fill(null);let u=i.length-1;for(;u>=0&&d.some(h=>h===null);){const h=i[u];d[h.lane]===null&&(d[h.lane]=h.end),u--}o=Math.max(...d.filter(h=>h!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(r,{adjustments:i,behavior:o})=>{this.options.scrollToFn(r,{behavior:o,adjustments:i},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(s)}}const JN=(n,s,r,i)=>{for(;n<=s;){const o=(n+s)/2|0,d=r(o);if(d<i)n=o+1;else if(d>i)s=o-1;else return o}return n>0?n-1:0};function LE({measurements:n,outerSize:s,scrollOffset:r,lanes:i}){const o=n.length-1,d=f=>n[f].start;if(n.length<=i)return{startIndex:0,endIndex:o};let u=JN(0,o,d,r),h=u;if(i===1)for(;h<o&&n[h].end<r+s;)h++;else if(i>1){const f=Array(i).fill(0);for(;h<o&&f.some(y=>y<r+s);){const y=n[h];f[y.lane]=y.end,h++}const p=Array(i).fill(r+s);for(;u>=0&&p.some(y=>y>=r);){const y=n[u];p[y.lane]=y.start,u--}u=Math.max(0,u-u%i),h=Math.min(o,h+(i-1-h%i))}return{startIndex:u,endIndex:h}}const Yv=typeof document<"u"?g.useLayoutEffect:g.useEffect;function OE(n){const s=g.useReducer(()=>({}),{})[1],r={...n,onChange:(o,d)=>{var u;d?Tn.flushSync(s):s(),(u=n.onChange)==null||u.call(n,o,d)}},[i]=g.useState(()=>new PE(r));return i.setOptions(r),Yv(()=>i._didMount(),[]),Yv(()=>i._willUpdate()),i}function lo(n){return OE({observeElementRect:EE,observeElementOffset:IE,scrollToFn:DE,...n})}function Ef(n){return n.nickname?n.nickname:n.email?n.email:n.userId?n.userId:"Unknown"}const zE=(n,s)=>{const r=(s||n).toUpperCase();return r.includes("PRO+")||r.includes("PRO_PLUS")||r.includes("PROPLUS")?"bg-purple-500":r.includes("POWER")?"bg-amber-500":r.includes("PRO")?"bg-blue-500":"bg-gray-500"},If=n=>{if(!n)return"-";try{return typeof n=="string"?n.split("T")[0]:n instanceof Date?n.toISOString().split("T")[0]:new Date(n).toISOString().split("T")[0]}catch{return String(n).split("T")[0]}},Wv=n=>{if(!n)return"-";try{return(typeof n=="string"?new Date(n):n instanceof Date?n:new Date(n)).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}catch{return String(n)}};function ew({open:n,onOpenChange:s,account:r,onRefresh:i,isRefreshing:o}){const[d,u]=g.useState([]),[h,f]=g.useState(!1),[p,y]=g.useState(null),{maskEmail:b,maskNickname:v,privacyMode:N,usagePrecision:j}=vt(),{t:T}=Ut(),S=T("common.unknown")==="Unknown";if(g.useEffect(()=>{n&&r?.credentials?.accessToken?(f(!0),y(null),window.api.accountGetModels(r.credentials.accessToken,r.credentials?.region,r.profileArn,r.machineId,r.credentials.provider||r.idp,r.credentials.authMethod,r.id).then(U=>{U.success?u(U.models):y(U.error||"Failed to fetch models")}).catch(U=>y(U.message)).finally(()=>f(!1))):u([])},[n,r?.credentials?.accessToken,r?.credentials?.region,r?.profileArn,r?.machineId,r?.credentials?.provider,r?.idp,r?.credentials?.authMethod,r?.id]),!n||!r)return null;const k=r.usage,R=r.subscription,I=r.credentials,M=U=>j?U.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:2}):Math.floor(U).toLocaleString(),G=k.bonuses?.reduce((U,q)=>U+q.limit,0)??0,W=k.bonuses?.reduce((U,q)=>U+q.current,0)??0;return Tn.createPortal(e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:()=>s(!1)}),e.jsxs("div",{className:"relative glass-card-strong rounded-2xl shadow-2xl w-full max-w-2xl max-h-[90vh] overflow-y-auto m-4 animate-in zoom-in-95 duration-200",children:[e.jsxs("div",{className:"sticky top-0 z-20 px-6 py-5 border-b border-white/30 dark:border-white/10 bg-gradient-to-br from-primary/[0.08] via-primary/[0.04] to-transparent backdrop-blur-xl flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4 min-w-0 flex-1",children:[e.jsxs("div",{className:"relative w-14 h-14 rounded-2xl bg-gradient-to-br from-[var(--gradient-from)] to-[var(--gradient-to)] flex items-center justify-center shadow-lg shadow-primary/30 shrink-0",children:[e.jsx(Mp,{className:"h-7 w-7 text-white"}),e.jsx("div",{className:"absolute -bottom-1 -right-1 w-4 h-4 rounded-full bg-success border-2 border-background"})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[e.jsx("span",{className:"font-bold text-lg text-foreground truncate",title:r.email||Ef(r),children:r.email?b(r.email):Ef(r)}),e.jsx($e,{className:me(zE(R.type,R.title),"hover:opacity-90 text-white shadow-md flex-shrink-0 px-2.5"),children:R.title||R.type})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx("span",{className:"px-2 py-0.5 bg-background/70 backdrop-blur-sm rounded-md font-medium border border-border/50",children:r.idp}),e.jsx("span",{className:"opacity-50",children:"·"}),e.jsxs("span",{children:[S?"Added ":"添加于 ",If(r.createdAt)]})]})]})]}),e.jsx(D,{variant:"ghost",size:"icon",onClick:()=>s(!1),className:"rounded-full hover:bg-red-500 hover:text-white transition-colors shrink-0",children:e.jsx(ns,{className:"h-5 w-5"})})]}),e.jsxs("div",{className:"p-6 space-y-8",children:[e.jsxs("section",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("h3",{className:"flex items-center gap-2 font-bold text-base text-foreground",children:[e.jsx("div",{className:"p-1.5 rounded-lg bg-primary/10",children:e.jsx($a,{className:"h-4 w-4 text-primary"})}),S?"Quota Overview":"配额总览"]}),i&&e.jsxs(D,{variant:"outline",size:"sm",onClick:i,disabled:o,className:"h-8 rounded-lg",children:[e.jsx(Mt,{className:me("h-3.5 w-3.5 mr-1.5",o&&"animate-spin")}),S?"Refresh":"刷新数据"]})]}),e.jsxs("div",{className:"bg-gradient-to-br from-primary/[0.04] via-transparent to-primary/[0.04] border border-primary/15 rounded-2xl p-5 space-y-5 shadow-sm",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-end justify-between mb-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-xs text-muted-foreground font-semibold uppercase tracking-wider",children:S?"Total Usage":"总使用量"}),e.jsxs("div",{className:"flex items-baseline gap-1.5",children:[e.jsx("span",{className:"text-4xl font-bold tracking-tight bg-gradient-to-br from-[var(--gradient-from)] to-[var(--gradient-to)] bg-clip-text text-transparent",children:M(k.current)}),e.jsxs("span",{className:"text-lg text-muted-foreground font-medium",children:["/ ",M(k.limit)]})]})]}),e.jsxs("div",{className:me("text-sm font-bold px-3 py-1.5 rounded-full border shadow-sm",k.percentUsed>.9?"bg-destructive/10 text-destructive border-destructive/30":"bg-success/10 text-success border-success/30"),children:[(k.percentUsed*100).toFixed(j?2:1),"% ",S?"used":"已使用"]})]}),e.jsx(Gu,{value:k.percentUsed*100,className:"h-3 rounded-full",indicatorClassName:k.percentUsed>.9?"bg-red-500":"bg-primary"})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4 pt-2",children:[e.jsxs("div",{className:"p-4 bg-background/60 backdrop-blur-sm rounded-xl border border-primary/15 hover:border-primary/30 hover:bg-background/80 hover:shadow-md transition-all shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-primary mb-2",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-primary shadow-sm shadow-primary/50"}),S?"Base":"主配额"]}),e.jsxs("div",{className:"text-xl font-bold tracking-tight",children:[M(k.baseCurrent??0)," ",e.jsxs("span",{className:"text-sm text-muted-foreground font-normal",children:["/ ",M(k.baseLimit??0)]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1 font-medium",children:[If(k.nextResetDate)," ",S?"reset":"重置"]})]}),e.jsxs("div",{className:me("p-4 bg-background/60 backdrop-blur-sm rounded-xl border border-warning/15 hover:border-warning/30 hover:bg-background/80 hover:shadow-md transition-all shadow-sm",(k.freeTrialLimit??0)===0&&"opacity-60 grayscale"),children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-warning mb-2",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-warning shadow-sm shadow-warning/50"}),S?"Trial":"免费试用",(k.freeTrialLimit??0)>0&&e.jsx($e,{variant:"secondary",className:"text-[10px] px-1 h-4 ml-auto",children:"ACTIVE"})]}),e.jsxs("div",{className:"text-xl font-bold tracking-tight",children:[M(k.freeTrialCurrent??0)," ",e.jsxs("span",{className:"text-sm text-muted-foreground font-normal",children:["/ ",M(k.freeTrialLimit??0)]})]}),e.jsx("div",{className:"text-xs text-muted-foreground mt-1 font-medium",children:k.freeTrialExpiry?`${If(k.freeTrialExpiry)} ${S?"expires":"过期"}`:S?"No trial":"无试用额度"})]}),e.jsxs("div",{className:me("p-4 bg-background/60 backdrop-blur-sm rounded-xl border border-success/15 hover:border-success/30 hover:bg-background/80 hover:shadow-md transition-all shadow-sm",G===0&&"opacity-60 grayscale"),children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-success mb-2",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-success shadow-sm shadow-success/50"}),S?"Bonus":"奖励总计"]}),e.jsxs("div",{className:"text-xl font-bold tracking-tight",children:[M(W)," ",e.jsxs("span",{className:"text-sm text-muted-foreground font-normal",children:["/ ",M(G)]})]}),e.jsx("div",{className:"text-xs text-muted-foreground mt-1 font-medium",children:S?`${k.bonuses?.length??0} active`:`${k.bonuses?.length??0} 个生效奖励`})]})]})]})]}),k.bonuses&&k.bonuses.length>0&&e.jsxs("section",{className:"space-y-3",children:[e.jsx("h3",{className:"font-bold text-sm text-muted-foreground uppercase tracking-wider pl-1",children:S?"Active Bonuses":"生效奖励明细"}),e.jsx("div",{className:"grid grid-cols-1 gap-2",children:k.bonuses.map(U=>e.jsxs("div",{className:"flex items-center justify-between p-4 bg-background border rounded-xl shadow-sm hover:shadow-md transition-shadow",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-semibold text-sm",children:U.name}),e.jsx($e,{variant:"outline",className:"text-[10px] h-5 px-1.5 text-green-600 border-green-200 bg-green-50",children:"ACTIVE"})]}),e.jsxs("div",{className:"text-xs text-muted-foreground font-mono",children:["Code: ",U.code," · ",Wv(U.expiresAt)," 过期"]})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("div",{className:"text-sm font-bold",children:[M(U.current)," ",e.jsxs("span",{className:"text-muted-foreground font-normal",children:["/ ",M(U.limit)]})]}),e.jsxs("div",{className:"text-[10px] text-blue-600 font-medium",children:[S?"Used":"已用"," ",(U.current/U.limit*100).toFixed(j?2:0),"%"]})]})]},U.code))})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("section",{className:"space-y-3",children:[e.jsxs("h3",{className:"flex items-center gap-2 font-bold text-base text-foreground",children:[e.jsx("div",{className:"p-1.5 rounded-lg bg-primary/10",children:e.jsx(Mp,{className:"h-4 w-4 text-primary"})}),S?"Basic Info":"基本信息"]}),e.jsxs("div",{className:"bg-gradient-to-br from-primary/[0.04] to-transparent border border-primary/15 rounded-2xl p-5 space-y-4 shadow-sm",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:S?"Email/ID":"邮箱/ID"}),e.jsx("div",{className:"text-sm font-mono break-all select-all",children:r.email?b(r.email):Ef(r)})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-1 min-w-0",children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:S?"Nickname":"账号别名"}),e.jsx("div",{className:"text-sm font-medium truncate",title:r.nickname||"-",children:v(r.nickname)||"-"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:S?"Provider":"身份提供商"}),e.jsx("div",{className:"text-sm font-medium",children:r.idp})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:S?"User ID":"用户 ID"}),e.jsx("div",{className:"text-xs font-mono break-all bg-primary/[0.06] px-3 py-2 rounded-lg border border-primary/15 select-all text-foreground/80",children:N?"********":r.userId||"-"})]}),e.jsx(UE,{accountId:r.id,accountEmail:r.email||"",isEn:S})]})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsxs("h3",{className:"flex items-center gap-2 font-bold text-base text-foreground",children:[e.jsx("div",{className:"p-1.5 rounded-lg bg-primary/10",children:e.jsx(Dc,{className:"h-4 w-4 text-primary"})}),S?"Subscription":"订阅详情"]}),e.jsxs("div",{className:"bg-gradient-to-br from-primary/[0.04] to-transparent border border-primary/15 rounded-2xl p-5 text-sm space-y-3 shadow-sm",children:[e.jsxs("div",{className:"flex justify-between items-center py-1 border-b border-primary/10 last:border-0",children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"Region"}),e.jsx($e,{variant:"outline",className:"font-mono",children:I.region||"us-east-1"})]}),e.jsxs("div",{className:"flex justify-between items-center py-1 border-b border-primary/10 last:border-0",children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:S?"Token Expires":"Token 到期"}),e.jsx("span",{className:"font-medium text-xs",children:I.expiresAt?Wv(I.expiresAt):"-"})]}),e.jsxs("div",{className:"flex justify-between items-center py-1 border-b border-primary/10 last:border-0",children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:S?"Plan Type":"订阅类型"}),e.jsx("span",{className:"font-mono text-xs",title:R.rawType,children:R.rawType||"-"})]}),e.jsxs("div",{className:"flex justify-between items-center py-1 border-b border-primary/10 last:border-0",children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:S?"Overage Rate":"超额费率"}),e.jsx("span",{className:"font-mono text-xs",children:k.resourceDetail?.overageRate?`$${k.resourceDetail.overageRate}/${k.resourceDetail.unit||"INV"}`:"-"})]}),e.jsxs("div",{className:"flex justify-between items-center py-1 border-b border-primary/10 last:border-0",children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:S?"Resource Type":"资源类型"}),e.jsx("span",{className:"font-mono text-xs",children:k.resourceDetail?.resourceType||"-"})]}),e.jsxs("div",{className:"flex justify-between items-center py-1",children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:S?"Upgradable":"可升级"}),e.jsx($e,{variant:"outline",className:me("text-[10px] px-2 h-5 font-bold",R.upgradeCapability==="UPGRADE_CAPABLE"?"bg-success/10 text-success border-success/30":"bg-muted text-muted-foreground border-border"),children:R.upgradeCapability==="UPGRADE_CAPABLE"?"YES":"NO"})]})]})]})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsxs("h3",{className:"flex items-center gap-2 font-bold text-base text-foreground",children:[e.jsx("div",{className:"p-1.5 rounded-lg bg-primary/10",children:e.jsx(ai,{className:"h-4 w-4 text-primary"})}),S?"Available Models":"账户可用模型",e.jsx($e,{className:"ml-auto bg-primary/10 text-primary border-primary/20",children:d.length})]}),e.jsx("div",{className:"bg-gradient-to-br from-muted/20 to-muted/40 border rounded-xl p-4",children:h?e.jsxs("div",{className:"flex items-center justify-center py-8 text-muted-foreground",children:[e.jsx(bt,{className:"h-5 w-5 animate-spin mr-2"}),S?"Loading models...":"加载模型中..."]}):p?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:e.jsx("p",{className:"text-red-500 text-sm",children:p})}):d.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground text-sm",children:S?"No models available":"暂无可用模型"}):e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 max-h-[320px] overflow-y-auto pr-1",children:d.map((U,q)=>e.jsxs("div",{className:me("group p-3 bg-background rounded-xl border shadow-sm hover:shadow-md hover:border-primary/30 transition-all duration-200",q===0&&"ring-1 ring-primary/20"),children:[e.jsx("div",{className:"flex items-start justify-between gap-2",children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[e.jsx("div",{className:me("w-2 h-2 rounded-full shrink-0",q===0?"bg-primary animate-pulse":"bg-muted-foreground/40")}),e.jsx("code",{className:"text-xs font-bold text-foreground truncate",children:U.id})]}),U.name&&U.name!==U.id&&e.jsx("p",{className:"text-[11px] text-primary/80 font-medium mb-1 truncate",children:U.name}),e.jsx("p",{className:"text-[11px] text-muted-foreground line-clamp-2 leading-relaxed",children:U.description||(S?"No description":"无描述")})]})}),e.jsxs("div",{className:"flex items-center justify-between mt-2 pt-2 border-t border-border/50",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[U.inputTypes?.includes("TEXT")&&e.jsxs($e,{variant:"secondary",className:"text-[10px] px-1.5 h-5 bg-blue-500/10 text-blue-600 dark:text-blue-400 border-0",children:[e.jsx(xr,{className:"h-3 w-3 mr-0.5"}),"Text"]}),U.inputTypes?.includes("IMAGE")&&e.jsxs($e,{variant:"secondary",className:"text-[10px] px-1.5 h-5 bg-purple-500/10 text-purple-600 dark:text-purple-400 border-0",children:[e.jsx(HN,{className:"h-3 w-3 mr-0.5"}),"Image"]}),U.rateMultiplier!==void 0&&e.jsxs($e,{variant:"secondary",className:"text-[10px] px-1.5 h-5 bg-amber-500/10 text-amber-600 dark:text-amber-400 border-0",children:[e.jsx(Ds,{className:"h-3 w-3 mr-0.5"}),U.rateMultiplier,"x"]})]}),e.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-muted-foreground font-mono",children:[e.jsx(KN,{className:"h-3 w-3"}),e.jsx("span",{className:"text-green-600 dark:text-green-400",children:U.maxInputTokens?U.maxInputTokens>=1e6?`${(U.maxInputTokens/1e6).toFixed(0)}M`:`${(U.maxInputTokens/1e3).toFixed(0)}K`:"-"}),e.jsx("span",{children:"/"}),e.jsx("span",{className:"text-orange-600 dark:text-orange-400",children:U.maxOutputTokens?U.maxOutputTokens>=1e6?`${(U.maxOutputTokens/1e6).toFixed(0)}M`:`${(U.maxOutputTokens/1e3).toFixed(0)}K`:"-"})]})]})]},U.id))})})]})]})]})]}),document.body)}function UE({accountId:n,accountEmail:s,isEn:r}){const{proxyPool:i,accountProxyBindings:o,bindAccountsToProxy:d,unbindAccountFromProxy:u}=vt(),[h,f]=g.useState(!1),p=o[n],y=p?i.get(p):null,b=Array.from(i.values()).filter(v=>v.enabled&&v.status!=="dead");return e.jsxs("div",{className:"space-y-1 mt-3",children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:r?"Bound Proxy (Reverse Proxy)":"反代绑定代理"}),y?e.jsxs("div",{className:"flex items-center gap-2 bg-cyan-500/10 border border-cyan-500/30 px-3 py-2 rounded-lg",children:[e.jsxs("span",{className:"text-cyan-700 dark:text-cyan-300 text-xs font-mono flex-1 truncate",title:y.url,children:[y.protocol,"://",y.host,":",y.port,y.label&&e.jsxs("span",{className:"text-muted-foreground ml-1.5",children:["(",y.label,")"]})]}),e.jsx($e,{variant:"outline",className:"text-[10px]",children:y.status}),e.jsx(D,{size:"sm",variant:"ghost",onClick:()=>f(!h),className:"h-7 text-xs",children:r?"Change":"更换"}),e.jsx(D,{size:"sm",variant:"ghost",className:"h-7 text-xs text-destructive",onClick:()=>{confirm(r?`Unbind ${s}?`:`解绑 ${s}?`)&&u(n)},children:r?"Unbind":"解绑"})]}):e.jsx(D,{size:"sm",variant:"outline",onClick:()=>f(!h),className:"h-7 text-xs w-full",children:r?"+ Bind to Proxy":"+ 绑定代理"}),h&&e.jsx("div",{className:"border rounded-lg p-2 mt-2 space-y-1 max-h-48 overflow-y-auto",children:b.length===0?e.jsx("p",{className:"text-[11px] text-muted-foreground p-2",children:r?'No alive proxies. Add and validate in "Proxy Pool".':'无可用代理。请先在"代理池"添加并验活。'}):b.map(v=>e.jsxs("button",{onClick:()=>{d([n],v.id),f(!1)},className:me("w-full flex items-center gap-2 px-2 py-1.5 rounded text-xs text-left hover:bg-muted",v.id===p&&"bg-primary/10 text-primary"),children:[e.jsxs("span",{className:"font-mono flex-1 truncate",children:[v.host,":",v.port,v.label&&e.jsxs("span",{className:"text-muted-foreground ml-1.5",children:["(",v.label,")"]})]}),v.latencyMs!==void 0&&e.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[v.latencyMs,"ms"]}),v.id===p&&e.jsx("span",{className:"text-primary",children:"✓"})]},v.id))})]})}const Rf=340,Qv=300,ic=16,$E=8;function BE({onAddAccount:n,onEditAccount:s}){const r=g.useRef(null),[i,o]=g.useState(null),[d,u]=g.useState(!1),[h,f]=g.useState(3),[p,y]=g.useState(Qv);g.useEffect(()=>{const V=r.current;if(!V)return;const le=()=>{const be=V.clientWidth-$E,K=Math.max(1,Math.floor((be+ic)/(Qv+ic))),se=(be-(K-1)*ic)/K;f(K),y(se)};le();const B=new ResizeObserver(le);return B.observe(V),()=>B.disconnect()},[]);const{getFilteredAccounts:b,tags:v,groups:N,selectedIds:j,toggleSelection:T,checkAccountStatus:S}=vt(),{t:k}=Ut(),R=k("common.unknown")==="Unknown",I=V=>{o(V)},M=async()=>{if(i){u(!0);try{await S(i.id);const le=b().find(B=>B.id===i.id);le&&o(le)}finally{u(!1)}}},G=b(),W=g.useMemo(()=>{const V=[],le=[...G,"add"];for(let B=0;B<le.length;B+=h)V.push(le.slice(B,B+h));return V},[G,h]),U=lo({count:W.length,getScrollElement:()=>r.current,estimateSize:()=>Rf,overscan:2}),q=U.getVirtualItems();return e.jsxs("div",{ref:r,className:"h-full overflow-auto",style:{contain:"strict"},children:[e.jsx("div",{style:{height:`${U.getTotalSize()+8}px`,width:"100%",position:"relative"},children:q.map(V=>{const le=W[V.index];return e.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:`${V.size}px`,transform:`translateY(${V.start+8}px)`},children:e.jsx("div",{className:"flex gap-4 items-start px-1",children:le.map(B=>B==="add"?e.jsx("div",{className:"flex items-center justify-center border-2 border-dashed border-muted-foreground/20 rounded-xl cursor-pointer hover:border-primary/50 hover:bg-primary/5 transition-colors flex-shrink-0",style:{width:p,height:Rf-ic},onClick:n,children:e.jsxs("div",{className:"flex flex-col items-center gap-2 text-muted-foreground",children:[e.jsx(Ts,{className:"h-8 w-8"}),e.jsx("span",{className:"text-sm",children:R?"Add Account":"添加账号"})]})},"add-button"):e.jsx("div",{className:"flex-shrink-0",style:{width:p,height:Rf-ic},children:e.jsx(SE,{account:B,tags:v,groups:N,isSelected:j.has(B.id),onSelect:()=>T(B.id),onEdit:()=>s(B),onShowDetail:()=>I(B)})},B.id))})},V.key)})}),G.length===0&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-muted-foreground mb-4",children:R?"No accounts yet":"暂无账号"}),e.jsxs("button",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-lg bg-primary text-primary-foreground hover:bg-primary/90",onClick:n,children:[e.jsx(Ts,{className:"h-4 w-4"}),R?"Add First Account":"添加第一个账号"]})]})}),e.jsx(ew,{open:!!i,onOpenChange:V=>!V&&o(null),account:i,onRefresh:M,isRefreshing:d})]})}function Tc(n){let s=255,r=n;n.length===9&&n.startsWith("#")&&(s=parseInt(n.slice(1,3),16),r="#"+n.slice(3));const i=r.startsWith("#")?r.slice(1):r,o=parseInt(i.slice(0,2),16),d=parseInt(i.slice(2,4),16),u=parseInt(i.slice(4,6),16);return`rgba(${o}, ${d}, ${u}, ${s/255})`}function _E(n){return n.length===0?{}:n.length===1?{borderLeftColor:Tc(n[0]),borderLeftWidth:"3px"}:{borderLeftWidth:"3px",borderLeftColor:"transparent",backgroundImage:`linear-gradient(var(--card-solid), var(--card-solid)), linear-gradient(180deg, ${n.map((r,i)=>{const o=i/(n.length-1)*100;return`${Tc(r)} ${o}%`}).join(", ")})`,backgroundOrigin:"padding-box, border-box",backgroundClip:"padding-box, border-box",backgroundRepeat:"no-repeat"}}const VE={backgroundColor:"var(--card-unauthorized-bg)",borderColor:"var(--card-unauthorized-border)",boxShadow:"0 0 0 1px var(--card-unauthorized-ring)"};function KE(n,s){const r=(s||n).toUpperCase();return r.includes("PRO+")||r.includes("PRO_PLUS")||r.includes("PROPLUS")?"bg-purple-500":r.includes("POWER")?"bg-amber-500":r.includes("PRO")?"bg-blue-500":"bg-gray-500"}const HE={active:"正常",expired:"已过期",error:"错误",refreshing:"刷新中",unknown:"未知"},FE={active:"Active",expired:"Expired",error:"Error",refreshing:"Refreshing",unknown:"Unknown"};function GE(n,s){if(s)return"text-destructive bg-destructive/10";switch(n){case"active":return"text-success bg-success/10";case"error":return"text-destructive bg-destructive/10";case"expired":return"text-warning bg-warning/10";case"refreshing":return"text-primary bg-primary/10";default:return"text-muted-foreground bg-muted"}}function qE(n,s){const r=Date.now(),i=n-r;if(i<=0)return s?"Expired":"已过期";const o=Math.floor(i/(60*1e3)),d=Math.floor(i/(3600*1e3));if(o<60)return s?`${o}m`:`${o} 分钟`;if(d<24){const u=o%60;return s?u>0?`${d}h ${u}m`:`${d}h`:u>0?`${d} 小时 ${u} 分`:`${d} 小时`}else{const u=Math.floor(d/24),h=d%24;return s?h>0?`${u}d ${h}h`:`${u}d`:h>0?`${u} 天 ${h} 小时`:`${u} 天`}}function XE(n){if(!n)return!1;const s=n.toLowerCase();return s.includes("accountsuspendedexception")||s.includes("account suspended")||s.includes("temporarily_suspended")||s.includes("temporarily suspended")||s.includes("user id is")&&s.includes("suspended")||s.includes("账户已封禁")||s.includes("已封禁")||/\b423\b/.test(s)}function YE({account:n,tags:s,groups:r,isSelected:i,onEdit:o,onShowDetail:d}){const{setActiveAccount:u,removeAccount:h,checkAccountStatus:f,refreshAccountToken:p,toggleSelection:y,maskEmail:b,maskNickname:v,usagePrecision:N,updateAccountStatus:j,accountProxyBindings:T,proxyPool:S,unbindAccountFromProxy:k}=vt(),R=g.useMemo(()=>{const oe=T[n.id];return oe&&S.get(oe)||null},[T,n.id,S]),{t:I}=Ut(),M=I("common.unknown")==="Unknown",[G,W]=g.useState(!1),[U,q]=g.useState(!1),[V,le]=g.useState(!1),B=XE(n.lastError),be=g.useMemo(()=>(n.tags||[]).map(oe=>s.get(oe)).filter(oe=>!!oe),[n.tags,s]),K=g.useMemo(()=>be.map(oe=>oe.color),[be]),se=g.useMemo(()=>n.groupId&&r.get(n.groupId)||null,[n.groupId,r]),te=g.useMemo(()=>n.nickname?v(n.nickname):b(n.email),[n.nickname,n.email,b,v]),Y=g.useMemo(()=>b(n.email),[n.email,b]),P=oe=>N?oe.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:2}):Math.floor(oe).toLocaleString(),F=n.usage.percentUsed*100,fe=F>80,pe=F>100,C=n.subscription.daysRemaining,z=C!==void 0&&C<=7,X=n.credentials.expiresAt!==void 0&&n.credentials.expiresAt-Date.now()<300*1e3,re=g.useMemo(()=>n.isActive?{}:B?VE:K.length>0?_E(K):{},[n.isActive,B,K]),xe=g.useCallback(async oe=>{oe.stopPropagation();const{credentials:ue}=n,{switchTarget:ae}=vt.getState();if(!ue.refreshToken){alert(M?"Incomplete credentials, cannot switch":"账号凭证不完整,无法切换");return}if(ue.authMethod!=="social"&&(!ue.clientId||!ue.clientSecret)){alert(M?"Incomplete credentials, cannot switch":"账号凭证不完整,无法切换");return}const L={accessToken:ue.accessToken,refreshToken:ue.refreshToken,clientId:ue.clientId,clientSecret:ue.clientSecret,region:ue.region||"us-east-1",profileArn:n.profileArn,provider:ue.provider},we={accessToken:ue.accessToken,refreshToken:ue.refreshToken,clientId:ue.clientId||"",clientSecret:ue.clientSecret||"",region:ue.region||"us-east-1",startUrl:ue.startUrl,authMethod:ue.authMethod,provider:ue.provider,profileArn:n.profileArn,accountId:n.id};let Ue=!0,Lt="";const xt=ae||"ide";if(xt==="ide"||xt==="both"){const Qt=await window.api.switchAccount(we);if(!Qt.success)Ue=!1,Lt=Qt.error||"";else if(Qt.refreshedCredentials){const ft=Qt.refreshedCredentials;vt.setState(Et=>{const Ge=new Map(Et.accounts),gt=Ge.get(n.id);return gt&&Ge.set(n.id,{...gt,credentials:{...gt.credentials,accessToken:ft.accessToken,refreshToken:ft.refreshToken,expiresAt:Date.now()+ft.expiresIn*1e3}}),{accounts:Ge}}),vt.getState().saveToStorage()}}if(xt==="cli"||xt==="both"){const Qt=await window.api.switchAccountCli(L);!Qt.success&&xt==="cli"&&(Ue=!1,Lt=Qt.error||"")}Ue?u(n.id):alert(M?`Switch failed: ${Lt}`:`切换失败:${Lt}`)},[n,M,u]),Oe=g.useCallback(async oe=>{if(oe.stopPropagation(),!G){W(!0);try{await p(n.id),await f(n.id)}finally{W(!1)}}},[n.id,G,p,f]),Ee=g.useCallback(oe=>{oe.stopPropagation(),confirm(M?`Delete account "${n.email}"?`:`确定删除账号 "${n.email}"?`)&&h(n.id)},[n.id,n.email,M,h]),Qe=g.useCallback(async oe=>{if(oe.stopPropagation(),!confirm(M?"Clear local SSO cache and logout from Kiro?":"清除本地 SSO 缓存并退出 Kiro 登录?"))return;const ue=await window.api.logoutAccount();ue.success?u(null):alert(M?`Logout failed: ${ue.error}`:`退出失败:${ue.error}`)},[M,u]),_e=g.useCallback(async oe=>{if(oe.stopPropagation(),!U){q(!0);try{(await window.api.proxyClearAccountSuspended(n.id)).success&&j(n.id,"active",void 0)}finally{q(!1)}}},[n.id,U,j]),st=g.useCallback(oe=>{oe.stopPropagation();const ue=n.email||n.userId||"";ue&&(navigator.clipboard.writeText(ue),le(!0),setTimeout(()=>le(!1),1500))},[n.email,n.userId]);return e.jsxs("div",{className:me("group relative flex items-center gap-3 pl-3 pr-3 py-2.5 rounded-xl border bg-solid-card transition-all duration-300 cursor-pointer overflow-hidden","hover:shadow-md",n.isActive&&"active-glow-border border-transparent",!n.isActive&&!B&&K.length===0&&!i&&"border-border"),style:re,onClick:()=>y(n.id),children:[i&&!n.isActive&&!B&&e.jsx("div",{className:"absolute inset-0 pointer-events-none rounded-[inherit] ring-2 ring-inset ring-primary/60 bg-primary/[0.08] z-10"}),e.jsx("div",{className:me("flex-shrink-0 w-4 h-4 rounded border-2 flex items-center justify-center transition-colors cursor-pointer",i?"bg-primary border-primary text-primary-foreground":"border-muted-foreground/30 hover:border-primary"),onClick:oe=>{oe.stopPropagation(),y(n.id)},children:i&&e.jsx(Pt,{className:"h-3 w-3"})}),e.jsxs("div",{className:"w-[280px] flex-shrink-0 flex flex-col gap-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("h3",{className:me("font-semibold text-sm truncate cursor-pointer transition-colors min-w-0",V?"text-success":"text-foreground/90 hover:text-primary"),title:`${te} (${M?"Click to copy":"点击复制"})`,onClick:st,children:V?M?"Copied!":"已复制!":te}),n.nickname&&e.jsx("span",{className:"text-xs text-muted-foreground truncate min-w-0",title:n.email,children:Y})]}),e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 text-[10px] overflow-hidden",children:[se&&e.jsxs("span",{className:"px-1.5 py-0.5 rounded flex items-center gap-1 flex-shrink-0",style:{color:se.color,backgroundColor:se.color+"15"},children:[e.jsx(Vi,{className:"w-3 h-3"}),se.name]}),be.slice(0,4).map(oe=>{const ue=Tc(oe.color);return e.jsx("span",{className:"px-1.5 py-0.5 rounded-md font-medium flex-shrink-0 border",style:{backgroundColor:ue.replace(/[\d.]+\)$/,"0.12)"),color:ue,borderColor:ue.replace(/[\d.]+\)$/,"0.30)")},children:oe.name},oe.id)}),be.length>4&&e.jsxs("span",{className:"px-1.5 py-0.5 text-muted-foreground bg-muted rounded-sm flex-shrink-0",children:["+",be.length-4]}),n.lastError&&!B&&e.jsx("span",{className:"text-destructive truncate flex-1 min-w-0 italic",title:n.lastError,children:n.lastError}),!n.nickname&&e.jsx("button",{type:"button",onClick:st,className:"ml-auto text-muted-foreground/60 hover:text-primary transition-colors flex-shrink-0",title:M?"Copy email":"复制邮箱",children:e.jsx(As,{className:"h-3 w-3"})})]})]}),e.jsxs("div",{className:"flex-shrink-0 flex items-center gap-1.5",children:[e.jsxs("div",{className:me("text-[10px] font-medium h-5 px-2 rounded-full flex items-center justify-center gap-1 min-w-[52px]",GE(n.status,B)),children:[n.status==="refreshing"&&e.jsx(bt,{className:"h-3 w-3 animate-spin"}),B&&e.jsx(ln,{className:"h-3 w-3"}),B?e.jsx("span",{className:"cursor-pointer hover:underline",onClick:oe=>{oe.stopPropagation(),d()},children:M?"Banned":"已封禁"}):(M?FE:HE)[n.status]||n.status]}),e.jsx($e,{className:me("text-white text-[10px] h-5 px-2 border-0 min-w-[90px] flex items-center justify-center",KE(n.subscription.type,n.subscription.title)),children:n.subscription.title||n.subscription.type}),e.jsx($e,{variant:"outline",className:"text-[10px] h-5 px-1.5 text-muted-foreground font-normal border-muted-foreground/30 bg-muted/30 min-w-[72px] flex items-center justify-center",children:n.idp}),R&&e.jsxs($e,{variant:"outline",className:me("text-[10px] h-5 px-1.5 font-normal cursor-pointer group transition-colors",R.enabled&&R.status!=="dead"?"border-cyan-500/40 text-cyan-700 dark:text-cyan-300 bg-cyan-500/10 hover:bg-cyan-500/20":"border-amber-500/40 text-amber-700 dark:text-amber-300 bg-amber-500/10"),title:`${M?"Bound proxy:":"绑定代理:"} ${R.host}:${R.port}${R.label?` (${R.label})`:""}
|
|
40
|
+
${M?"Click to unbind":"点击解绑"}`,onClick:oe=>{oe.stopPropagation(),confirm(M?`Unbind ${n.email} from ${R.host}:${R.port}?`:`解绑 ${n.email} 与 ${R.host}:${R.port}?`)&&k(n.id)},children:[e.jsx("span",{className:"opacity-70 group-hover:hidden",children:"⇄"}),e.jsx("span",{className:"hidden group-hover:inline",children:"✕"}),e.jsx("span",{className:"ml-0.5 max-w-[80px] truncate inline-block align-middle",children:R.host})]}),e.jsx("div",{className:"w-[60px] flex items-center",children:n.isActive&&e.jsxs($e,{className:"h-5 px-2 bg-success text-white border-0 hover:bg-success/90 text-[10px] flex items-center justify-center w-full",children:[e.jsx(kc,{className:"h-2.5 w-2.5 mr-0.5"}),M?"Active":"当前"]})})]}),e.jsx("div",{className:"flex-1 min-w-0"}),e.jsxs("div",{className:"flex-shrink-0 w-40 flex flex-col gap-0.5 px-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[e.jsx("span",{className:"text-muted-foreground",children:M?"Usage":"使用量"}),e.jsxs("span",{className:me("font-mono font-medium tabular-nums",pe?"text-destructive":fe?"text-warning":"text-foreground"),children:[F.toFixed(N?2:0),"%",pe&&e.jsxs("span",{className:"ml-1 text-[9px] text-destructive font-semibold",children:["+",(F-100).toFixed(N?2:0),"%"]})]})]}),(()=>{if(pe){const oe=100/F*100;return e.jsxs("div",{className:"relative h-1.5 w-full overflow-hidden rounded-full bg-foreground/10",children:[e.jsx("div",{className:"absolute inset-y-0 left-0 bg-warning transition-all duration-300",style:{width:`${oe}%`}}),e.jsx("div",{className:"absolute inset-y-0 right-0 bg-destructive transition-all duration-300",style:{left:`${oe}%`}})]})}return e.jsx("div",{className:"relative h-1.5 w-full overflow-hidden rounded-full bg-foreground/10",children:e.jsx("div",{className:me("absolute inset-y-0 left-0 transition-all duration-300",fe?"bg-warning":"bg-primary"),style:{width:`${Math.min(F,100)}%`}})})})(),e.jsxs("div",{className:"flex justify-between text-[9px] text-muted-foreground pt-0.5",children:[e.jsxs("span",{className:me(pe&&"text-destructive font-semibold"),children:[P(n.usage.current),pe&&` (+${P(n.usage.current-n.usage.limit)})`]}),e.jsxs("span",{children:["/ ",P(n.usage.limit)]})]})]}),e.jsxs("div",{className:"flex-shrink-0 hidden lg:flex flex-col leading-tight gap-0.5 text-[10px] text-muted-foreground w-28",children:[e.jsxs("div",{className:"flex items-center gap-1",title:M?"Subscription days left":"订阅剩余天数",children:[e.jsx(Gn,{className:"h-3 w-3"}),e.jsx("span",{className:z?"text-warning font-medium":"",children:C!==void 0?M?`${C}d`:`${C}天`:"-"})]}),e.jsxs("div",{className:"flex items-center gap-1",title:n.credentials.expiresAt?new Date(n.credentials.expiresAt).toLocaleString(M?"en-US":"zh-CN"):M?"Unknown":"未知",children:[e.jsx(ii,{className:"h-3 w-3"}),e.jsx("span",{className:X?"text-destructive font-medium":"",children:n.credentials.expiresAt?qE(n.credentials.expiresAt,M):"-"})]})]}),e.jsxs("div",{className:"flex-shrink-0 flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity duration-200 border-l border-border/40 pl-2 ml-1",children:[B&&e.jsxs(e.Fragment,{children:[e.jsx(D,{size:"icon",variant:"ghost",className:"h-7 w-7 text-warning hover:bg-warning/10",onClick:_e,disabled:U,title:M?"Reset Suspended":"重置封禁状态",children:U?e.jsx(Mt,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(gr,{className:"h-3.5 w-3.5"})}),e.jsx("a",{href:"https://support.aws.amazon.com/#/contacts/kiro",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center h-7 w-7 rounded-md text-primary hover:bg-primary/10",onClick:oe=>oe.stopPropagation(),title:M?"Contact Support":"联系支持",children:e.jsx(Xs,{className:"h-3.5 w-3.5"})})]}),!n.isActive&&!B&&e.jsx(D,{size:"icon",variant:"ghost",className:"h-7 w-7 hover:bg-primary/10 hover:text-primary",onClick:xe,title:M?"Switch to this account":"切换到该账号",children:e.jsx(kc,{className:"h-3.5 w-3.5"})}),e.jsx(D,{size:"icon",variant:"ghost",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:Oe,disabled:G||n.status==="refreshing",title:M?"Check account info":"检查账户信息",children:e.jsx(Mt,{className:me("h-3.5 w-3.5",G&&"animate-spin")})}),e.jsx(D,{size:"icon",variant:"ghost",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:oe=>{oe.stopPropagation(),d()},title:M?"Details":"详情",children:e.jsx(Va,{className:"h-3.5 w-3.5"})}),e.jsx(D,{size:"icon",variant:"ghost",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:oe=>{oe.stopPropagation(),o()},title:M?"Edit":"编辑",children:e.jsx(Ou,{className:"h-3.5 w-3.5"})}),n.isActive?e.jsx(D,{size:"icon",variant:"ghost",className:"h-7 w-7 hover:bg-destructive/10 hover:text-destructive",onClick:Qe,title:M?"Logout (clear SSO cache)":"退出登录(清除 SSO 缓存)",children:e.jsx(px,{className:"h-3.5 w-3.5"})}):e.jsx(D,{size:"icon",variant:"ghost",className:"h-7 w-7 hover:bg-destructive/10 hover:text-destructive",onClick:Ee,title:M?"Delete":"删除",children:e.jsx(Vt,{className:"h-3.5 w-3.5"})})]}),n.isActive&&B&&e.jsx("div",{className:"banned-badge",title:M?"Banned":"已封禁"})]})}const WE=g.memo(YE),Zv=72,QE=10;function ZE({onAddAccount:n,onEditAccount:s}){const r=g.useRef(null),[i,o]=g.useState(null),[d,u]=g.useState(!1),{getFilteredAccounts:h,tags:f,groups:p,selectedIds:y,checkAccountStatus:b}=vt(),{t:v}=Ut(),N=v("common.unknown")==="Unknown",j=h(),T=I=>{o(I)},S=async()=>{if(i){u(!0);try{await b(i.id);const I=h().find(M=>M.id===i.id);I&&o(I)}finally{u(!1)}}},k=lo({count:j.length,getScrollElement:()=>r.current,estimateSize:()=>Zv+QE,overscan:8}),R=k.getVirtualItems();return e.jsxs("div",{ref:r,className:"h-full overflow-auto",style:{contain:"strict"},children:[e.jsxs("div",{style:{height:`${k.getTotalSize()+80}px`,width:"100%",position:"relative"},children:[R.map(I=>{const M=j[I.index];return M?e.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:`${Zv}px`,transform:`translateY(${I.start}px)`},children:e.jsx(WE,{account:M,tags:f,groups:p,isSelected:y.has(M.id),onEdit:()=>s(M),onShowDetail:()=>T(M)})},I.key):null}),j.length>0&&e.jsx("div",{style:{position:"absolute",top:`${k.getTotalSize()}px`,left:0,width:"100%"},children:e.jsxs("button",{type:"button",onClick:n,className:"w-full flex items-center justify-center gap-2 py-3 border-2 border-dashed border-muted-foreground/20 rounded-lg text-muted-foreground hover:border-primary/50 hover:bg-primary/5 hover:text-primary transition-colors",children:[e.jsx(Ts,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm",children:N?"Add Account":"添加账号"})]})})]}),j.length===0&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-muted-foreground mb-4",children:N?"No accounts yet":"暂无账号"}),e.jsxs("button",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-lg bg-primary text-primary-foreground hover:bg-primary/90",onClick:n,children:[e.jsx(Ts,{className:"h-4 w-4"}),N?"Add First Account":"添加第一个账号"]})]})}),e.jsx(ew,{open:!!i,onOpenChange:I=>!I&&o(null),account:i,onRefresh:S,isRefreshing:d})]})}const JE=[{value:"Free",label:"KIRO FREE",color:"text-gray-500 border-gray-300",activeColor:"bg-gray-500 text-white border-gray-500"},{value:"Pro",label:"KIRO PRO",color:"text-blue-500 border-blue-300",activeColor:"bg-blue-500 text-white border-blue-500"},{value:"Pro_Plus",label:"KIRO PRO+",color:"text-purple-500 border-purple-300",activeColor:"bg-purple-500 text-white border-purple-500"},{value:"Enterprise",label:"KIRO POWER",color:"text-amber-500 border-amber-300",activeColor:"bg-amber-500 text-white border-amber-500"}],eI=[{value:"active",label:"正常"},{value:"expired",label:"已过期"},{value:"error",label:"错误"},{value:"unknown",label:"未知"}],tI=[{value:"active",label:"Active"},{value:"expired",label:"Expired"},{value:"error",label:"Error"},{value:"unknown",label:"Unknown"}],sI=[{value:"Google",label:"Google"},{value:"Github",label:"GitHub"},{value:"BuilderId",label:"BuilderId"},{value:"Enterprise",label:"Enterprise"},{value:"AWSIdC",label:"AWSIdC"}];function nI(n){let s=255,r=n;n.length===9&&n.startsWith("#")&&(s=parseInt(n.slice(1,3),16),r="#"+n.slice(3));const i=r.startsWith("#")?r.slice(1):r,o=parseInt(i.slice(0,2),16),d=parseInt(i.slice(2,4),16),u=parseInt(i.slice(4,6),16);return`rgba(${o}, ${d}, ${u}, ${s/255})`}function aI(){const{filter:n,setFilter:s,clearFilter:r,tags:i,getStats:o}=vt(),{t:d}=Ut(),u=d("common.unknown")==="Unknown",h=u?tI:eI,f=o(),p=!!(n.subscriptionTypes?.length||n.statuses?.length||n.idps?.length||n.groupIds?.length||n.tagIds?.length||n.usageMin!==void 0||n.usageMax!==void 0||n.daysRemainingMin!==void 0||n.daysRemainingMax!==void 0||n.bannedOnly),y=(v,N)=>{const j=n[v]??[],T=j.includes(N)?j.filter(S=>S!==N):[...j,N];s({...n,[v]:T.length>0?T:void 0})},b=(v,N,j,T)=>{s({...n,[v]:j,[N]:T})};return e.jsxs("div",{className:"p-3 space-y-2",children:[p&&e.jsx("div",{className:"flex justify-end",children:e.jsx(D,{variant:"ghost",size:"sm",className:"h-6 text-xs px-2",onClick:()=>r(),children:u?"Clear":"清除筛选"})}),e.jsxs("div",{className:"flex flex-wrap items-start gap-x-6 gap-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:u?"Plan:":"订阅:"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:JE.map(v=>{const N=n.subscriptionTypes?.includes(v.value),j=f.bySubscription[v.value];return e.jsxs("button",{className:me("px-2 py-0.5 text-xs rounded border transition-colors",N?v.activeColor:`hover:bg-muted/50 ${v.color}`),onClick:()=>y("subscriptionTypes",v.value),children:[v.label,"(",j,")"]},v.value)})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:u?"Status:":"状态:"}),e.jsxs("div",{className:"flex flex-wrap gap-1",children:[h.map(v=>{const N=n.statuses?.includes(v.value),j=f.byStatus[v.value];return e.jsxs("button",{className:me("px-2 py-0.5 text-xs rounded border transition-colors",N?"bg-primary text-primary-foreground border-primary":"hover:bg-muted"),onClick:()=>y("statuses",v.value),children:[v.label,"(",j,")"]},v.value)}),e.jsxs("button",{className:me("px-2 py-0.5 text-xs rounded border transition-colors",n.bannedOnly?"bg-red-500 text-white border-red-500":"hover:bg-muted text-red-500 border-red-200"),onClick:()=>s({...n,bannedOnly:!n.bannedOnly}),children:[u?"Banned":"已封禁","(",f.bannedCount,")"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"IDP:"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:sI.map(v=>{const N=n.idps?.includes(v.value),j=f.byIdp[v.value];return e.jsxs("button",{className:me("px-2 py-0.5 text-xs rounded border transition-colors",N?"bg-primary text-primary-foreground border-primary":"hover:bg-muted"),onClick:()=>y("idps",v.value),children:[v.label,"(",j,")"]},v.value)})})]})]}),e.jsxs("div",{className:"flex flex-wrap items-start gap-x-6 gap-y-2 mt-2",children:[i.size>0&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:u?"Tags:":"标签:"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:Array.from(i.values()).map(v=>{const N=n.tagIds?.includes(v.id);return e.jsx("button",{className:me("px-2 py-0.5 text-xs rounded border transition-colors",N?"text-white border-transparent":"hover:bg-muted"),style:N?{backgroundColor:nI(v.color)}:void 0,onClick:()=>y("tagIds",v.id),children:v.name},v.id)})})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:u?"Usage:":"使用量:"}),e.jsx("input",{type:"number",min:"0",max:"100",placeholder:"min",className:"w-14 px-1.5 py-0.5 text-xs rounded-md border border-[var(--glass-border)] bg-[var(--glass-bg-subtle)] backdrop-blur-md focus:outline-none focus:ring-2 focus:ring-primary/40",value:n.usageMin??"",onChange:v=>b("usageMin","usageMax",v.target.value?Number(v.target.value)/100:void 0,n.usageMax)}),e.jsx("span",{className:"text-muted-foreground text-xs",children:"-"}),e.jsx("input",{type:"number",min:"0",max:"100",placeholder:"max",className:"w-14 px-1.5 py-0.5 text-xs rounded-md border border-[var(--glass-border)] bg-[var(--glass-bg-subtle)] backdrop-blur-md focus:outline-none focus:ring-2 focus:ring-primary/40",value:n.usageMax!==void 0?n.usageMax*100:"",onChange:v=>b("usageMin","usageMax",n.usageMin,v.target.value?Number(v.target.value)/100:void 0)}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"%"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:u?"Days:":"剩余:"}),e.jsx("input",{type:"number",min:"0",placeholder:"min",className:"w-14 px-1.5 py-0.5 text-xs rounded-md border border-[var(--glass-border)] bg-[var(--glass-bg-subtle)] backdrop-blur-md focus:outline-none focus:ring-2 focus:ring-primary/40",value:n.daysRemainingMin??"",onChange:v=>b("daysRemainingMin","daysRemainingMax",v.target.value?Number(v.target.value):void 0,n.daysRemainingMax)}),e.jsx("span",{className:"text-muted-foreground text-xs",children:"-"}),e.jsx("input",{type:"number",min:"0",placeholder:"max",className:"w-14 px-1.5 py-0.5 text-xs rounded-md border border-[var(--glass-border)] bg-[var(--glass-bg-subtle)] backdrop-blur-md focus:outline-none focus:ring-2 focus:ring-primary/40",value:n.daysRemainingMax??"",onChange:v=>b("daysRemainingMin","daysRemainingMax",n.daysRemainingMin,v.target.value?Number(v.target.value):void 0)}),e.jsx("span",{className:"text-xs text-muted-foreground",children:u?"d":"天"})]})]})]})}function rI({onAddAccount:n,onImport:s,onExport:r,viewMode:i,onViewModeChange:o,onManageGroups:d,onManageTags:u,isFilterExpanded:h,onToggleFilter:f}){const{filter:p,setFilter:y,selectedIds:b,selectAll:v,deselectAll:N,removeAccounts:j,batchRefreshTokens:T,batchCheckStatus:S,getFilteredAccounts:k,getStats:R,privacyMode:I,setPrivacyMode:M,groups:G,tags:W,accounts:U,moveAccountsToGroup:q,addTagToAccounts:V,removeTagFromAccounts:le,activeGroupTab:B,setActiveGroupTab:be,proxyPool:K,accountProxyBindings:se,bindAccountsToProxy:te,unbindAccountFromProxy:Y}=vt(),[P,F]=g.useState(!1),[fe,pe]=g.useState(!1),[C,z]=g.useState(!1),[X,re]=g.useState(!1),[xe,Oe]=g.useState(!1),Ee=g.useRef(null),Qe=g.useRef(null),_e=g.useRef(null);g.useEffect(()=>{const O=ne=>{Ee.current&&!Ee.current.contains(ne.target)&&z(!1),Qe.current&&!Qe.current.contains(ne.target)&&re(!1),_e.current&&!_e.current.contains(ne.target)&&Oe(!1)};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[]);const st=g.useCallback(()=>{const O=Array.from(b).map(ze=>U.get(ze)).filter(Boolean),ne=new Map;return O.forEach(ze=>{if(!ze)return;const ce=se[ze.id]||"none";ne.set(ce,(ne.get(ce)||0)+1)}),{selectedAccs:O,proxyCounts:ne,total:O.length}},[b,U,se]),oe=O=>{b.size!==0&&(te(Array.from(b),O),Oe(!1))},ue=()=>{if(b.size!==0){for(const O of b)Y(O);Oe(!1)}},ae=g.useMemo(()=>{const O=Array.from(b).map(ze=>U.get(ze)).filter(Boolean),ne=new Map;return O.forEach(ze=>{if(ze){const _=ze.groupId;ne.set(_,(ne.get(_)||0)+1)}}),{selectedAccounts:O,groupCounts:ne}},[b,U]),L=g.useMemo(()=>{const O=Array.from(b).map(ze=>U.get(ze)).filter(Boolean),ne=new Map;return O.forEach(ze=>{ze?.tags&&ze.tags.forEach(_=>{ne.set(_,(ne.get(_)||0)+1)})}),{selectedAccounts:O,tagCounts:ne,total:O.length}},[b,U]),we=g.useCallback(()=>ae,[ae]),Ue=g.useCallback(()=>L,[L]),Lt=O=>{b.size!==0&&(q(Array.from(b),O),z(!1))},xt=O=>{b.size!==0&&V(Array.from(b),O)},Qt=O=>{b.size!==0&&le(Array.from(b),O)},ft=O=>{const{tagCounts:ne,total:ze}=Ue();(ne.get(O)||0)===ze?Qt(O):xt(O)},{t:Et}=Ut(),Ge=Et("common.unknown")==="Unknown",gt=R(),Ze=k().length,J=b.size,Ne=g.useMemo(()=>{const O=U.size;let ne=0;const ze=new Map;for(const _ of U.values())_.groupId?ze.set(_.groupId,(ze.get(_.groupId)||0)+1):ne++;return{all:O,ungrouped:ne,byGroup:ze}},[U]),et=g.useMemo(()=>Array.from(G.values()).sort((O,ne)=>(O.order??0)-(ne.order??0)),[G]),qe=g.useMemo(()=>{if(B==="all")return{label:Ge?"All":"全部",color:void 0,icon:e.jsx(Fn,{className:"h-4 w-4 mr-1.5"}),count:Ne.all};if(B==="ungrouped")return{label:Ge?"Ungrouped":"未分组",color:void 0,icon:e.jsx(Ev,{className:"h-4 w-4 mr-1.5"}),count:Ne.ungrouped};const O=G.get(B);return O?{label:O.name,color:O.color?Tc(O.color):void 0,icon:e.jsx(Sp,{className:"h-4 w-4 mr-1.5"}),count:Ne.byGroup.get(O.id)||0}:{label:Ge?"All":"全部",color:void 0,icon:e.jsx(Fn,{className:"h-4 w-4 mr-1.5"}),count:Ne.all}},[B,G,Ne,Ge]),Je=O=>{y({...p,search:O||void 0})},Kt=async()=>{J!==0&&(F(!0),await T(Array.from(b)),F(!1))},Ye=async()=>{J!==0&&(pe(!0),await S(Array.from(b)),pe(!1))},qt=()=>{J!==0&&window.dispatchEvent(new CustomEvent("navigate-page",{detail:"diagnose"}))},Jt=()=>{J!==0&&confirm(Ge?`Delete ${J} selected accounts?`:`确定要删除选中的 ${J} 个账号吗?`)&&j(Array.from(b))},Ct=()=>{J===Ze&&Ze>0?N():v()};return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"relative flex-1 max-w-md",children:[e.jsx(to,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx("input",{type:"text",placeholder:Ge?"Search accounts...":"搜索账号...",className:"w-full pl-9 pr-4 py-2 text-sm rounded-xl bg-[var(--glass-bg-subtle)] backdrop-blur-md border border-[var(--glass-border)] focus:outline-none focus:ring-2 focus:ring-primary/40 focus:border-primary/30 transition-all",value:p.search??"",onChange:O=>Je(O.target.value)})]}),e.jsxs("div",{className:"flex items-center gap-2 ml-auto",children:[e.jsxs("div",{className:"flex items-center rounded-xl border border-[var(--glass-border)] bg-[var(--glass-bg-subtle)] backdrop-blur-md overflow-hidden",children:[e.jsx("button",{type:"button",onClick:()=>o("grid"),title:Ge?"Grid view":"卡片视图",className:`flex items-center justify-center h-8 w-8 transition-colors ${i==="grid"?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted"}`,children:e.jsx(kA,{className:"h-4 w-4"})}),e.jsx("button",{type:"button",onClick:()=>o("list"),title:Ge?"List view":"列表视图",className:`flex items-center justify-center h-8 w-8 transition-colors ${i==="list"?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted"}`,children:e.jsx(AA,{className:"h-4 w-4"})})]}),e.jsxs(D,{onClick:n,children:[e.jsx(Ts,{className:"h-4 w-4 mr-1"}),Ge?"Add":"添加账号"]}),e.jsxs(D,{variant:"outline",onClick:s,children:[e.jsx(Fa,{className:"h-4 w-4 mr-1"}),Ge?"Import":"导入"]}),e.jsxs(D,{variant:"outline",onClick:r,children:[e.jsx(Ns,{className:"h-4 w-4 mr-1"}),Ge?"Export":"导出"]})]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[e.jsxs("span",{className:"text-muted-foreground",children:[Ge?"":"共 ",e.jsx("span",{className:"font-medium text-foreground",children:gt.total})," ",Ge?"accounts":"个账号",Ze!==gt.total&&e.jsxs("span",{children:[Ge?", ":",已筛选 ",e.jsx("span",{className:"font-medium text-foreground",children:Ze})," ",Ge?"filtered":"个"]})]}),gt.expiringSoonCount>0&&e.jsxs($e,{variant:"destructive",className:"gap-1",children:[gt.expiringSoonCount," ",Ge?"expiring":"个即将到期"]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs("div",{className:"relative",ref:Ee,children:[e.jsxs(D,{variant:C?"default":"ghost",size:"sm",onClick:()=>{z(!C),re(!1)},title:Ge?"Switch group view / Manage":"切换分组视图 / 管理",children:[qe.color?e.jsx("span",{className:"w-2.5 h-2.5 rounded-full mr-1.5 flex-shrink-0",style:{backgroundColor:qe.color}}):qe.icon,e.jsx("span",{className:"truncate max-w-[100px]",children:qe.label}),e.jsx($e,{variant:"secondary",className:"ml-1.5 h-4 px-1 text-[10px] tabular-nums",children:qe.count}),e.jsx(va,{className:"h-3 w-3 ml-1"})]}),C&&(()=>{const{groupCounts:O,selectedAccounts:ne}=J>0?we():{groupCounts:new Map,selectedAccounts:[]},ze=(_,ce,Ce,Ve,je,He,Tt,H)=>e.jsxs("div",{className:me("group relative rounded-md transition-colors",ce?"":"hover:bg-muted"),style:ce&&Tt?{backgroundColor:Tt.replace(/[\d.]+\)$/,"0.12)")}:ce?{backgroundColor:"var(--color-primary)",opacity:.92}:void 0,children:[e.jsxs("button",{className:me("w-full flex items-center gap-1.5 px-2 py-1.5 text-sm rounded-md text-left",ce&&!Tt&&"text-primary-foreground"),style:ce&&Tt?{color:Tt}:void 0,onClick:Ce,children:[Ve,e.jsx("span",{className:"truncate flex-1 text-xs font-medium",children:je}),e.jsx("span",{className:me("text-[10px] tabular-nums",ce?Tt?"":"text-primary-foreground/80":"text-muted-foreground"),children:He}),ce&&e.jsx(Pt,{className:"h-3 w-3 ml-0.5"})]}),H&&e.jsx("button",{className:me("absolute right-1 top-1/2 -translate-y-1/2 h-5 w-5 rounded flex items-center justify-center transition-all","opacity-0 group-hover:opacity-100",H.isAllInGroup?"bg-success/15 text-success":"bg-background/80 text-muted-foreground hover:text-primary hover:bg-primary/10 shadow-sm"),onClick:Se=>{Se.stopPropagation(),H.onMove()},title:H.isAllInGroup?Ge?"All selected already in this group":"所有选中账户已在该组":Ge?`Move ${H.selCount} selected here`:`移动选中 ${H.selCount} 个账户到此`,children:H.isAllInGroup?e.jsx(Pt,{className:"h-3 w-3"}):e.jsx(Mv,{className:"h-3 w-3"})})]},_);return e.jsxs("div",{className:"absolute left-0 top-full mt-2 z-50 w-[320px] max-h-[80vh] overflow-y-auto bg-popover border rounded-lg shadow-lg p-2",children:[e.jsx("div",{className:"absolute -top-2 left-4 w-4 h-4 bg-popover border-l border-t rotate-45"}),e.jsxs("div",{className:"flex items-center justify-between px-2 py-1 mb-1",children:[e.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:Ge?"Groups":"分组"}),J>0&&e.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-primary",children:[e.jsx(Mv,{className:"h-3 w-3"}),Ge?`${J} selected`:`已选 ${J}`]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-1",children:[ze("all",B==="all",()=>{be("all"),z(!1)},e.jsx(Fn,{className:"h-3.5 w-3.5 flex-shrink-0"}),Ge?"All":"全部",Ne.all),ze("ungrouped",B==="ungrouped",()=>{be("ungrouped"),z(!1)},e.jsx(Ev,{className:"h-3.5 w-3.5 flex-shrink-0"}),Ge?"Ungrouped":"未分组",Ne.ungrouped,void 0,J>0?{selCount:J,isAllInGroup:(O.get(void 0)||0)===ne.length,onMove:()=>Lt(void 0)}:void 0),et.map(_=>{const ce=_.color?Tc(_.color):void 0,Ce=B===_.id,Ve=Ne.byGroup.get(_.id)||0,He=(O.get(_.id)||0)===ne.length&&ne.length>0;return ze(_.id,Ce,()=>{be(_.id),z(!1)},e.jsx("span",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{backgroundColor:ce||"var(--color-muted-foreground)"}}),_.name,Ve,ce,J>0?{selCount:J,isAllInGroup:He,onMove:()=>Lt(_.id)}:void 0)})]}),e.jsx("div",{className:"border-t my-2"}),e.jsxs("button",{className:"w-full flex items-center gap-2 px-2 py-1.5 text-sm rounded hover:bg-muted text-primary",onClick:()=>{z(!1),d()},children:[e.jsx(Sp,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:Ge?"Manage groups":"管理分组"})]}),J>0&&e.jsx("div",{className:"text-[10px] text-muted-foreground px-2 pt-1 pb-0.5 italic",children:Ge?"Tip: hover a tile and click ⇄ to move selected accounts here":"提示:将鼠标悬停到分组上,点击右侧 ⇄ 按钮即可批量移动选中账户"})]})})()]}),e.jsxs("div",{className:"relative",ref:Qe,children:[e.jsxs(D,{variant:X?"default":"ghost",size:"icon",className:"h-8 w-8 relative",onClick:()=>{J>0?(re(!X),z(!1)):u()},title:J>0?Ge?`Set tags for ${J} selected`:`批量设置 ${J} 个选中账号的标签`:Ge?"Manage tags":"管理标签",children:[e.jsx(Xl,{className:"h-4 w-4"}),J>0&&e.jsx("span",{className:"absolute top-1 right-1 w-1.5 h-1.5 rounded-full bg-primary"})]}),X&&J>0&&e.jsxs("div",{className:"absolute left-0 top-full mt-2 z-50 min-w-[220px] bg-popover border rounded-lg shadow-lg p-2",children:[e.jsx("div",{className:"absolute -top-2 left-4 w-4 h-4 bg-popover border-l border-t rotate-45"}),e.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1 mb-1",children:Ge?`${J} selected (multi)`:`已选 ${J} 个账户(可多选)`}),e.jsx("div",{className:"border-t my-1"}),e.jsx("div",{className:"max-h-[300px] overflow-y-auto",children:Array.from(W.values()).map(O=>{const{tagCounts:ne,total:ze}=Ue(),_=ne.get(O.id)||0,ce=_===ze,Ce=_>0&&_<ze;return e.jsxs("button",{className:"w-full flex items-center gap-2 px-2 py-1.5 text-sm rounded hover:bg-muted text-left",onClick:()=>ft(O.id),children:[e.jsxs("div",{className:"w-4 h-4 rounded border flex items-center justify-center shrink-0",style:{backgroundColor:ce?O.color||"#888":"transparent",borderColor:O.color||"#888"},children:[ce&&e.jsx(Pt,{className:"h-3 w-3 text-white"}),Ce&&e.jsx(wc,{className:"h-3 w-3",style:{color:O.color||"#888"}})]}),e.jsx("span",{className:"truncate flex-1",children:O.name}),Ce&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:[_,"/",ze]})]},O.id)})}),W.size===0&&e.jsx("div",{className:"text-sm text-muted-foreground px-2 py-2 text-center",children:Ge?"No tags":"暂无标签"}),e.jsx("div",{className:"border-t my-1"}),e.jsxs("button",{className:"w-full flex items-center gap-2 px-2 py-1.5 text-sm rounded hover:bg-muted text-primary",onClick:()=>{re(!1),u()},children:[e.jsx(Ts,{className:"h-4 w-4"}),e.jsx("span",{children:Ge?"Manage tags":"管理标签"})]})]})]}),e.jsxs("div",{className:"relative",ref:_e,children:[e.jsxs(D,{variant:xe?"default":"ghost",size:"icon",className:"h-8 w-8 relative",onClick:()=>{Oe(!xe),z(!1),re(!1)},title:J>0?Ge?`Bind ${J} selected accounts to a proxy`:`把选中 ${J} 个账号绑定到代理`:Ge?"View proxy bindings":"查看账号-代理绑定",children:[e.jsx(Ki,{className:"h-4 w-4"}),J>0&&e.jsx("span",{className:"absolute top-1 right-1 w-1.5 h-1.5 rounded-full bg-primary"})]}),xe&&(()=>{const O=Array.from(K.values()).filter(_=>_.enabled&&_.status!=="dead"),{proxyCounts:ne,total:ze}=st();return e.jsxs("div",{className:"absolute right-0 top-full mt-2 z-50 w-[320px] max-h-[80vh] overflow-y-auto bg-popover border rounded-lg shadow-lg p-2",children:[e.jsx("div",{className:"absolute -top-2 right-4 w-4 h-4 bg-popover border-l border-t rotate-45"}),e.jsxs("div",{className:"flex items-center justify-between px-2 py-1 mb-1",children:[e.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:Ge?"Proxy Bindings":"代理绑定"}),J>0&&e.jsx("span",{className:"text-[10px] text-primary",children:Ge?`${J} selected`:`已选 ${J}`})]}),J===0?e.jsx("div",{className:"px-2 py-3 text-[11px] text-muted-foreground",children:Ge?"Select accounts first, then choose a proxy to bind to.":"请先选择账号,再点击要绑定的代理"}):e.jsxs(e.Fragment,{children:[O.length===0?e.jsx("div",{className:"px-2 py-3 text-[11px] text-amber-600 dark:text-amber-400",children:Ge?'No alive proxies. Add and validate proxies in "Proxy Pool" first.':'没有可用代理。请先在"代理池"页面添加并验活代理'}):e.jsx("div",{className:"max-h-[280px] overflow-y-auto",children:O.map(_=>{const ce=ne.get(_.id)||0,Ce=ce===ze;return e.jsxs("button",{className:me("w-full flex items-center gap-2 px-2 py-1.5 text-sm rounded text-left hover:bg-muted transition-colors",Ce&&"bg-primary/10"),onClick:()=>oe(_.id),children:[e.jsx(ql,{className:"h-3.5 w-3.5 flex-shrink-0 text-primary"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"font-mono text-xs truncate",title:_.url,children:[_.host,":",_.port,_.label&&e.jsxs("span",{className:"text-muted-foreground ml-1.5",children:["(",_.label,")"]})]}),e.jsxs("div",{className:"text-[10px] text-muted-foreground flex items-center gap-1.5",children:[e.jsx("span",{children:_.protocol}),_.status==="alive"&&_.latencyMs!==void 0&&e.jsxs("span",{className:"text-green-600",children:[_.latencyMs,"ms"]})]})]}),ce>0&&e.jsxs($e,{variant:"outline",className:me("h-4 text-[9px]",Ce?"border-primary text-primary":""),children:[ce,"/",ze]}),Ce&&e.jsx(Pt,{className:"h-3 w-3 text-primary"})]},_.id)})}),e.jsx("div",{className:"border-t my-1"}),e.jsxs("button",{className:"w-full flex items-center gap-2 px-2 py-1.5 text-sm rounded hover:bg-destructive/10 text-destructive",onClick:ue,disabled:ne.get("none")===ze,children:[e.jsx(QN,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:Ge?`Unbind selected (${J})`:`解绑选中 (${J})`})]})]}),e.jsx("div",{className:"border-t my-1"}),e.jsx("div",{className:"text-[10px] text-muted-foreground px-2 py-1 italic",children:Ge?"Tip: bind N accounts to 1 proxy to reduce risk-control association.":"提示:把 N 个账号绑定到同一代理 IP,可降低风控关联风险"})]})})()]}),e.jsx(D,{variant:I?"default":"ghost",size:"icon",className:"h-8 w-8",onClick:()=>M(!I),title:I?Ge?"Disable privacy mode":"关闭隐私模式":Ge?"Enable privacy mode":"开启隐私模式",children:I?e.jsx(Jl,{className:"h-4 w-4"}):e.jsx(Nc,{className:"h-4 w-4"})}),e.jsxs("div",{className:"relative",children:[e.jsx(D,{variant:h?"default":"ghost",size:"icon",className:"h-8 w-8",onClick:f,title:Ge?"Toggle advanced filter":"展开/收起高级筛选",children:e.jsx(fx,{className:"h-4 w-4"})}),h&&e.jsxs("div",{className:"absolute right-0 top-full mt-2 z-50 min-w-[600px] bg-popover border rounded-lg shadow-lg",children:[e.jsx("div",{className:"absolute -top-2 right-4 w-4 h-4 bg-popover border-l border-t rotate-45"}),e.jsx(aI,{})]})]}),e.jsx("div",{className:"w-px h-6 bg-border mx-1"}),e.jsx(D,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:Ye,disabled:fe||J===0,title:J>0?Ge?`Check ${J} accounts info (usage / subscription / banned)`:`检查选中 ${J} 个账号信息:刷新用量、订阅详情、封禁状态`:Ge?"Check accounts info (select first)":"检查账户信息(请先选中账号)",children:fe?e.jsx(bt,{className:"h-4 w-4 animate-spin"}):e.jsx(Ks,{className:"h-4 w-4"})}),e.jsx(D,{variant:"ghost",size:"icon",className:"h-8 w-8 text-emerald-600 hover:text-emerald-600 hover:bg-emerald-500/10",onClick:qt,disabled:J===0,title:J>0?Ge?`Liveness test ${J} accounts via reverse-proxy`:`走反代对选中 ${J} 个账号批量测活`:Ge?"Liveness test (select first)":"账号测活(请先选中账号)",children:e.jsx(Ds,{className:"h-4 w-4"})}),e.jsx(D,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:Jt,disabled:J===0,title:J>0?Ge?`Delete ${J} selected accounts`:`删除选中的 ${J} 个账号`:Ge?"Delete (select first)":"删除选中账号(请先选中账号)",children:e.jsx(Vt,{className:"h-4 w-4"})}),e.jsx(D,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:Kt,disabled:P||J===0,title:J>0?Ge?`Refresh ${J} access tokens`:`刷新选中 ${J} 个账号的访问令牌`:Ge?"Refresh Token (select first)":"刷新 Token(请先选中账号)",children:P?e.jsx(bt,{className:"h-4 w-4 animate-spin"}):e.jsx(ii,{className:"h-4 w-4"})}),e.jsx("div",{className:"w-px h-6 bg-border mx-1"}),e.jsxs(D,{variant:"ghost",size:"sm",onClick:Ct,title:J===Ze&&Ze>0?Ge?"Deselect all":"取消全选":Ge?"Select all":"全选",children:[J===Ze&&Ze>0?e.jsx(Cc,{className:"h-4 w-4 mr-1"}):e.jsx(Cn,{className:"h-4 w-4 mr-1"}),J>0?Ge?`${J} sel`:`已选 ${J}`:Ge?"All":"全选"]}),J>0&&e.jsx(D,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive hover:bg-destructive/10",onClick:()=>N(),title:Ge?`Clear ${J} selected`:`清除 ${J} 个选中`,children:e.jsx(ns,{className:"h-4 w-4"})})]})]})]})}function iI({isOpen:n,onClose:s}){const{addAccount:r,accounts:i,batchImportConcurrency:o,loginPrivateMode:d,groups:u,activeGroupTab:h}=vt(),f=(Z,he,tt)=>Array.from(i.values()).some(We=>!!(he&&We.userId===he||Z&&We.email===Z&&We.credentials.provider===tt)),[p,y]=g.useState("login"),[b,v]=g.useState(void 0),[N,j]=g.useState(""),[T,S]=g.useState(""),[k,R]=g.useState(""),[I,M]=g.useState("us-east-1"),[G,W]=g.useState("IdC"),[U,q]=g.useState("BuilderId"),[V,le]=g.useState(""),[B,be]=g.useState(""),[K,se]=g.useState(""),[te,Y]=g.useState(""),[P,F]=g.useState(null),[fe,pe]=g.useState("single"),[C,z]=g.useState(""),[X,re]=g.useState(null),[xe,Oe]=g.useState(null),[Ee,Qe]=g.useState(!1),[_e,st]=g.useState(!1),[oe,ue]=g.useState(null),{t:ae}=Ut(),L=ae("common.unknown")==="Unknown",we=Z=>{const he=Z?.trim();if(he)return!he.startsWith("arn:")&&he.includes(":codewhisperer:")?`arn:${he}`:he},Ue=Z=>{const he=Z?.trim();if(!he)return"BuilderId";const tt=he.toLowerCase().replace(/[\s_-]/g,"");return tt==="github"?"Github":tt==="google"?"Google":tt==="enterprise"||tt==="iam"||tt==="iamsso"||tt==="awsidc"?"Enterprise":tt==="builderid"||tt==="kiro"?"BuilderId":he},Lt=(Z,he)=>{const tt=Z?.trim().toLowerCase(),We=he?.trim().toLowerCase();return tt==="social"||We==="github"||We==="google"?"social":"IdC"},xt=(Z,he)=>{for(const tt of he){const We=Z[tt];if(typeof We=="string"&&We.trim())return We.trim()}},Qt=Z=>{const he=Z&&typeof Z=="object"?Z:{},tt=Ue(xt(he,["provider","idp","type"])),We=Lt(xt(he,["authMethod","auth_method"]),tt);return{refreshToken:xt(he,["refreshToken","refresh_token"])||"",password:xt(he,["password","pwd"]),clientId:xt(he,["clientId","client_id"]),clientSecret:xt(he,["clientSecret","client_secret"]),region:xt(he,["region"])||"us-east-1",authMethod:We,provider:tt,profileArn:we(xt(he,["profileArn","profile_arn","arn"])),startUrl:xt(he,["startUrl","start_url"]),machineId:xt(he,["machineId","machine_id"])}},[ft,Et]=g.useState("builderid"),[Ge,gt]=g.useState(!1),[Ze,J]=g.useState(d),[Ne,et]=g.useState(""),[qe,Je]=g.useState(""),[Kt,Ye]=g.useState(!1),[qt,Jt]=g.useState(null),[Ct,O]=g.useState(!1),ne=g.useRef(null),[ze,_]=g.useState(""),[ce,Ce]=g.useState(null);g.useEffect(()=>()=>{ne.current&&clearInterval(ne.current)},[]),g.useEffect(()=>{if(!n)return;const Z=h!=="all"&&h!=="ungrouped"&&u.has(h);v(Z?h:void 0)},[n,h,u]),g.useEffect(()=>{if(!Ge||ft==="builderid")return;const Z=window.api.onSocialAuthCallback(async he=>{if(console.log("[AddAccountDialog] Social auth callback:",he),he.error){ue(`登录失败: ${he.error}`),gt(!1);return}if(he.code&&he.state)try{const tt=await window.api.exchangeSocialToken(he.code,he.state);tt.success?await Ve({accessToken:tt.accessToken,refreshToken:tt.refreshToken,authMethod:"social",provider:tt.provider}):ue(tt.error||"Token 交换失败")}catch(tt){ue(tt instanceof Error?tt.message:"登录失败")}finally{gt(!1)}});return()=>Z()},[Ge,ft]);const Ve=async Z=>{console.log("[AddAccountDialog] Login successful, verifying credentials...");try{const he=await window.api.verifyAccountCredentials({refreshToken:Z.refreshToken,clientId:Z.clientId||"",clientSecret:Z.clientSecret||"",region:Z.region||"us-east-1",authMethod:Z.authMethod,provider:Z.provider,profileArn:Z.profileArn,machineId:Z.machineId});if(he.success&&he.data){const{email:tt,userId:We}=he.data,jt=Z.provider||"BuilderId";if(f(tt,We,jt)){ue(L?"This account already exists":"该账号已存在,无需重复添加");return}const Be=Date.now();r({email:tt,userId:We,nickname:tt?tt.split("@")[0]:void 0,idp:jt,profileArn:he.data.profileArn||Z.profileArn,machineId:Z.machineId,groupId:b,credentials:{accessToken:he.data.accessToken,csrfToken:"",refreshToken:he.data.refreshToken,clientId:Z.clientId||"",clientSecret:Z.clientSecret||"",region:Z.region||"us-east-1",startUrl:Z.startUrl,expiresAt:he.data.expiresIn?Be+he.data.expiresIn*1e3:Be+3600*1e3,authMethod:Z.authMethod,provider:Z.provider||"BuilderId"},subscription:{type:he.data.subscriptionType,title:he.data.subscriptionTitle,rawType:he.data.subscription?.rawType,daysRemaining:he.data.daysRemaining,expiresAt:he.data.expiresAt,managementTarget:he.data.subscription?.managementTarget,upgradeCapability:he.data.subscription?.upgradeCapability,overageCapability:he.data.subscription?.overageCapability},usage:{current:he.data.usage.current,limit:he.data.usage.limit,percentUsed:he.data.usage.limit>0?he.data.usage.current/he.data.usage.limit:0,lastUpdated:Be,baseLimit:he.data.usage.baseLimit,baseCurrent:he.data.usage.baseCurrent,freeTrialLimit:he.data.usage.freeTrialLimit,freeTrialCurrent:he.data.usage.freeTrialCurrent,freeTrialExpiry:he.data.usage.freeTrialExpiry,bonuses:he.data.usage.bonuses,nextResetDate:he.data.usage.nextResetDate,resourceDetail:he.data.usage.resourceDetail},tags:[],status:"active",lastUsedAt:Be}),Hs(),s()}else ue(he.error||"验证失败")}catch(he){ue(he instanceof Error?he.message:"添加账号失败")}},je=async()=>{gt(!0),ue(null),Jt(null);try{const Z=await window.api.startBuilderIdLogin(I);Z.success&&Z.userCode&&Z.verificationUri?(Jt({userCode:Z.userCode,verificationUri:Z.verificationUri,expiresIn:Z.expiresIn||600,interval:Z.interval||5}),window.api.openExternal(Z.verificationUri,Ze),H(Z.interval||5)):(ue(Z.error||"启动登录失败"),gt(!1))}catch(Z){ue(Z instanceof Error?Z.message:"启动登录失败"),gt(!1)}},He=async()=>{if(!ze.trim()){ue(L?"Please enter SSO Start URL":"请输入 SSO Start URL");return}gt(!0),ue(null),Ce(null);try{const Z=await window.api.startIamSsoLogin(ze.trim(),I),he=Z.verificationUri||Z.authorizeUrl;Z.success&&he?(Ce({userCode:Z.userCode||"",verificationUri:he,expiresIn:Z.expiresIn||600,interval:Z.interval||3}),window.api.openExternal(he,Ze),Tt(Z.interval||3)):(ue(Z.error||(L?"Failed to start login":"启动登录失败")),gt(!1))}catch(Z){ue(Z instanceof Error?Z.message:L?"Failed to start login":"启动登录失败"),gt(!1)}},Tt=Z=>{ne.current&&clearInterval(ne.current),ne.current=setInterval(async()=>{try{const he=await window.api.pollIamSsoAuth(I);if(!he.success){ue(he.error||(L?"Authorization failed":"授权失败")),gt(!1),Ce(null),ne.current&&(clearInterval(ne.current),ne.current=null);return}he.completed&&(ne.current&&(clearInterval(ne.current),ne.current=null),await Ve({accessToken:he.accessToken,refreshToken:he.refreshToken,clientId:he.clientId,clientSecret:he.clientSecret,region:he.region,startUrl:ze.trim(),authMethod:"IdC",provider:"Enterprise"}),gt(!1),Ce(null))}catch(he){console.error("[AddAccountDialog] IAM SSO Poll error:",he)}},Z*1e3)},H=Z=>{ne.current&&clearInterval(ne.current),ne.current=setInterval(async()=>{try{const he=await window.api.pollBuilderIdAuth(I);if(!he.success){ue(he.error||"授权失败"),gt(!1),Jt(null),ne.current&&(clearInterval(ne.current),ne.current=null);return}he.completed&&(ne.current&&(clearInterval(ne.current),ne.current=null),await Ve({accessToken:he.accessToken,refreshToken:he.refreshToken,clientId:he.clientId,clientSecret:he.clientSecret,region:he.region,authMethod:"IdC",provider:"BuilderId"}),gt(!1),Jt(null))}catch(he){console.error("[AddAccountDialog] Poll error:",he)}},Z*1e3)},Se=async()=>{ne.current&&(clearInterval(ne.current),ne.current=null),ft==="builderid"?await window.api.cancelBuilderIdLogin():ft==="iamsso"?await window.api.cancelIamSsoLogin():await window.api.cancelSocialLogin(),gt(!1),Jt(null),Ce(null),et(""),Je(""),Ye(!1),ue(null)},Xe=Z=>{const he=Z.trim();if(!he)return null;try{const tt=new URL(he),We=tt.searchParams.get("code"),jt=tt.searchParams.get("state");return We&&jt?{code:We,state:jt}:null}catch{const tt=he.includes("?")?he.slice(he.indexOf("?")+1):he,We=new URLSearchParams(tt),jt=We.get("code"),Be=We.get("state");return jt&&Be?{code:jt,state:Be}:null}},Nt=async Z=>{gt(!0),ue(null),et(""),Je("");try{const he=await window.api.startSocialLogin(Z,Ze);he.success?et(he.loginUrl||""):(ue(he.error||"启动登录失败"),gt(!1))}catch(he){ue(he instanceof Error?he.message:"启动登录失败"),gt(!1)}},nt=async()=>{const Z=Xe(qe);if(!Z){ue(L?"Paste the full kiro:// callback URL or code=...&state=...":"请粘贴完整的 kiro:// 回调 URL,或 code=...&state=...");return}Ye(!0),ue(null);try{const he=await window.api.exchangeSocialToken(Z.code,Z.state);he.success?(await Ve({accessToken:he.accessToken,refreshToken:he.refreshToken,authMethod:"social",provider:he.provider}),et(""),Je("")):ue(he.error||(L?"Token exchange failed":"Token 交换失败"))}catch(he){ue(he instanceof Error?he.message:L?"Login failed":"登录失败")}finally{Ye(!1),gt(!1)}},$t=async()=>{qt?.userCode&&(await navigator.clipboard.writeText(qt.userCode),O(!0),setTimeout(()=>O(!1),2e3))},Bt=async()=>{try{const Z=await window.api.loadKiroCredentials();Z.success&&Z.data?(j(Z.data.refreshToken),S(Z.data.clientId),R(Z.data.clientSecret),M(Z.data.region),W(Z.data.authMethod||"IdC"),q(Z.data.provider||"BuilderId"),le(Z.data.profileArn||""),be(Z.data.machineId||""),se(Z.data.startUrl||""),ue(null)):ue(Z.error||"导入失败")}catch(Z){ue(Z instanceof Error?Z.message:"导入失败")}},qn=async()=>{if(!te.trim()){ue("请输入 x-amz-sso_authn 的值");return}const Z=te.split(`
|
|
41
|
+
`).map(We=>We.trim()).filter(We=>We.length>0);if(Z.length===0){ue("请输入至少一个 Token");return}Qe(!0),ue(null),F(null);const he={total:Z.length,success:0,failed:0,errors:[],failedIndices:[]},tt=async(We,jt)=>{try{const Be=await window.api.importFromSsoToken(We,I);if(Be.success&&Be.data){const{email:ht,userId:It}=Be.data;if(ht&&It&&f(ht,It,"BuilderId")){he.errors.push(`#${jt+1}: ${ht} ${L?"already exists":"已存在"}`);return}const gs=Date.now();r({email:ht||"",userId:It||"",nickname:ht?ht.split("@")[0]:void 0,idp:"BuilderId",groupId:b,credentials:{accessToken:Be.data.accessToken,csrfToken:"",refreshToken:Be.data.refreshToken,clientId:Be.data.clientId,clientSecret:Be.data.clientSecret,region:Be.data.region,expiresAt:Be.data.expiresIn?gs+Be.data.expiresIn*1e3:gs+3600*1e3},subscription:{type:Be.data.subscriptionType||"Free",title:Be.data.subscriptionTitle||"KIRO",daysRemaining:Be.data.daysRemaining,managementTarget:Be.data.subscription?.managementTarget,upgradeCapability:Be.data.subscription?.upgradeCapability,overageCapability:Be.data.subscription?.overageCapability},usage:{current:Be.data.usage?.current||0,limit:Be.data.usage?.limit||0,percentUsed:(Be.data.usage?.limit||0)>0?(Be.data.usage?.current||0)/(Be.data.usage?.limit||1):0,lastUpdated:gs,baseLimit:Be.data.usage?.baseLimit,baseCurrent:Be.data.usage?.baseCurrent,freeTrialLimit:Be.data.usage?.freeTrialLimit,freeTrialCurrent:Be.data.usage?.freeTrialCurrent,freeTrialExpiry:Be.data.usage?.freeTrialExpiry,bonuses:Be.data.usage?.bonuses,nextResetDate:Be.data.usage?.nextResetDate,resourceDetail:Be.data.usage?.resourceDetail},tags:[],status:"active",lastUsedAt:gs}),he.success++}else he.failed++,he.failedIndices.push(jt),he.errors.push(`#${jt+1}: ${Be.error?.message||"导入失败"}`)}catch(Be){he.failed++,he.failedIndices.push(jt),he.errors.push(`#${jt+1}: ${Be instanceof Error?Be.message:"导入失败"}`)}};try{const We=o;for(let jt=0;jt<Z.length;jt+=We){const Be=Z.slice(jt,jt+We);await Promise.allSettled(Be.map((ht,It)=>tt(ht,jt+It))),jt+We<Z.length&&await new Promise(ht=>setTimeout(ht,100))}if(F(he),he.failed===0)Hs(),s();else{const jt=he.failedIndices.map(Be=>Z[Be]);jt.length>0&&Y(jt.join(`
|
|
42
|
+
`)),he.success>0?ue(`成功导入 ${he.success} 个,失败 ${he.failed} 个`):ue(`全部导入失败 (${he.failed} 个)`)}}catch(We){ue(We instanceof Error?We.message:"SSO 导入失败")}finally{Qe(!1)}},Ot=async()=>{if(!C.trim()){ue("请输入凭证数据");return}let Z;const he=C.trim();let tt=!1;try{const Be=JSON.parse(he);Z=(Array.isArray(Be)?Be:[Be]).map(Qt).filter(ht=>ht.refreshToken)}catch{const Be=he.split(`
|
|
43
|
+
`).filter(ht=>ht.trim()&&!ht.startsWith("#"));if(Be.length===0){ue(L?"Invalid format":"格式错误,请输入 JSON 数组或卡密格式(邮箱----密码----Token----ID----Secret)");return}if(Z=Be.map(ht=>{const It=PN(ht),gs=It[1]?.trim(),wt=It[3]?.trim()||void 0,Xt=It[4]?.trim()||void 0,Fs=It[5]?.trim()||(!wt&&!Xt?"Google":"BuilderId");return{_email:It[0]?.trim()||"",password:gs&&gs!=="no_password"?gs:void 0,refreshToken:It[2]?.trim()||"",clientId:wt,clientSecret:Xt,provider:Fs}}).filter(ht=>ht.refreshToken),Z.length===0){ue(L?"Invalid format":"格式错误,请输入 JSON 数组或卡密格式(邮箱----密码----Token----ID----Secret)");return}tt=!0}if(Z.length===0){ue(L?"Enter at least one credential":"请输入至少一个凭证");return}st(!0),ue(null),re(null);const We={total:Z.length,success:0,failed:0,errors:[],failedIndices:[]},jt=async(Be,ht)=>{try{if(!Be.refreshToken){We.failed++,We.failedIndices.push(ht),We.errors.push(`#${ht+1}: 缺少 refreshToken`);return}const It=Be.provider||"BuilderId",gs=Be.authMethod||(It==="BuilderId"||It==="Enterprise"?"IdC":"social"),wt=await window.api.verifyAccountCredentials({refreshToken:Be.refreshToken,clientId:Be.clientId||"",clientSecret:Be.clientSecret||"",region:Be.region||"us-east-1",authMethod:gs,provider:It,profileArn:Be.profileArn,machineId:Be.machineId,startUrl:Be.startUrl});if(wt.success&&wt.data){const{email:Xt,userId:Ys}=wt.data,Fs=Be.provider||"BuilderId";if(f(Xt,Ys,Fs)){We.errors.push(`#${ht+1}: ${Xt} ${L?"already exists":"已存在"}`);return}const Na={BuilderId:"BuilderId",Enterprise:"Enterprise",Github:"Github",Google:"Google"}[Fs]||"BuilderId",An=Be.authMethod||(Fs==="BuilderId"||Fs==="Enterprise"?"IdC":"social"),as=Date.now();r({email:Xt,password:Be.password,userId:Ys,nickname:Xt?Xt.split("@")[0]:void 0,idp:Na,profileArn:wt.data.profileArn||Be.profileArn,machineId:Be.machineId,groupId:b,credentials:{accessToken:wt.data.accessToken,csrfToken:"",refreshToken:wt.data.refreshToken,clientId:Be.clientId||"",clientSecret:Be.clientSecret||"",region:Be.region||"us-east-1",startUrl:Be.startUrl,expiresAt:wt.data.expiresIn?as+wt.data.expiresIn*1e3:as+3600*1e3,authMethod:An,provider:Fs},subscription:{type:wt.data.subscriptionType,title:wt.data.subscriptionTitle,daysRemaining:wt.data.daysRemaining,expiresAt:wt.data.expiresAt,managementTarget:wt.data.subscription?.managementTarget,upgradeCapability:wt.data.subscription?.upgradeCapability,overageCapability:wt.data.subscription?.overageCapability},usage:{current:wt.data.usage.current,limit:wt.data.usage.limit,percentUsed:wt.data.usage.limit>0?wt.data.usage.current/wt.data.usage.limit:0,lastUpdated:as,baseLimit:wt.data.usage.baseLimit,baseCurrent:wt.data.usage.baseCurrent,freeTrialLimit:wt.data.usage.freeTrialLimit,freeTrialCurrent:wt.data.usage.freeTrialCurrent,freeTrialExpiry:wt.data.usage.freeTrialExpiry,bonuses:wt.data.usage.bonuses,nextResetDate:wt.data.usage.nextResetDate,resourceDetail:wt.data.usage.resourceDetail},tags:[],status:"active",lastUsedAt:as}),We.success++}else{We.failed++,We.failedIndices.push(ht);const Xt=wt.error,Ys=typeof Xt=="object"?Xt?.message||"验证失败":Xt||"验证失败";We.errors.push(`#${ht+1}: ${Ys}`)}}catch(It){We.failed++,We.failedIndices.push(ht),We.errors.push(`#${ht+1}: ${It instanceof Error?It.message:"导入失败"}`)}};try{const Be=o;for(let ht=0;ht<Z.length;ht+=Be){const It=Z.slice(ht,ht+Be);await Promise.allSettled(It.map((gs,wt)=>jt(gs,ht+wt))),ht+Be<Z.length&&await new Promise(gs=>setTimeout(gs,100))}if(re(We),We.failed===0)Hs(),s();else{const ht=We.failedIndices.map(It=>Z[It]);if(ht.length>0)if(tt){const It=ht.map(gs=>[gs._email||"",gs.password||"",gs.refreshToken,gs.clientId||"",gs.clientSecret||"",gs.provider||""].join("----"));z(It.join(`
|
|
44
|
+
`))}else z(JSON.stringify(ht,null,2));We.success>0?ue(`成功导入 ${We.success} 个,失败 ${We.failed} 个`):ue(`全部导入失败 (${We.failed} 个)`)}}catch(Be){ue(Be instanceof Error?Be.message:"OIDC 批量导入失败")}finally{st(!1)}},ws=async()=>{if(!N){ue("请填写 Refresh Token");return}if(G!=="social"&&(!T||!k)){ue("请填写 Client ID 和 Client Secret");return}st(!0),ue(null);try{const Z=await window.api.verifyAccountCredentials({refreshToken:N,clientId:T,clientSecret:k,region:I,authMethod:G,provider:U,profileArn:we(V),machineId:B.trim()||void 0,startUrl:K.trim()||void 0});if(Z.success&&Z.data){const{email:he,userId:tt}=Z.data,We=U||"BuilderId";if(f(he,tt,We)){ue(L?"This account already exists":"该账号已存在,无需重复添加");return}const jt=Date.now();r({email:he,userId:tt,nickname:he?he.split("@")[0]:void 0,idp:We,profileArn:Z.data.profileArn||we(V),machineId:B.trim()||void 0,groupId:b,credentials:{accessToken:Z.data.accessToken,csrfToken:"",refreshToken:Z.data.refreshToken,clientId:T,clientSecret:k,region:I,startUrl:K.trim()||void 0,expiresAt:Z.data.expiresIn?jt+Z.data.expiresIn*1e3:jt+3600*1e3,authMethod:G,provider:U||"BuilderId"},subscription:{type:Z.data.subscriptionType,title:Z.data.subscriptionTitle,daysRemaining:Z.data.daysRemaining,expiresAt:Z.data.expiresAt,managementTarget:Z.data.subscription?.managementTarget,upgradeCapability:Z.data.subscription?.upgradeCapability,overageCapability:Z.data.subscription?.overageCapability},usage:{current:Z.data.usage.current,limit:Z.data.usage.limit,percentUsed:Z.data.usage.limit>0?Z.data.usage.current/Z.data.usage.limit:0,lastUpdated:jt,baseLimit:Z.data.usage.baseLimit,baseCurrent:Z.data.usage.baseCurrent,freeTrialLimit:Z.data.usage.freeTrialLimit,freeTrialCurrent:Z.data.usage.freeTrialCurrent,freeTrialExpiry:Z.data.usage.freeTrialExpiry,bonuses:Z.data.usage.bonuses,nextResetDate:Z.data.usage.nextResetDate,resourceDetail:Z.data.usage.resourceDetail},tags:[],status:"active",lastUsedAt:jt}),Hs(),s()}else ue(Z.error||"验证失败")}catch(Z){ue(Z instanceof Error?Z.message:"添加失败")}finally{st(!1)}},Hs=()=>{y("login"),j(""),S(""),R(""),M("us-east-1"),W("IdC"),q("BuilderId"),le(""),be(""),se(""),Y(""),Oe(null),ue(null),Et("builderid"),gt(!1),Jt(null),O(!1),ne.current&&(clearInterval(ne.current),ne.current=null)};return n?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:s}),e.jsxs(De,{className:"relative w-full max-w-lg max-h-[90vh] overflow-auto z-10",children:[e.jsxs(at,{className:"pb-4 border-b",children:[e.jsxs("div",{className:"flex flex-row items-center justify-between",children:[e.jsx(rt,{className:"text-xl font-bold",children:L?"Add Account":"添加账号"}),e.jsx(D,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-full hover:bg-red-500 hover:text-white transition-colors",onClick:s,children:e.jsx(ns,{className:"h-4 w-4"})})]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:L?"Choose a method to add your Kiro account":"选择一种方式来添加您的 Kiro 账号"})]}),e.jsxs(Pe,{className:"space-y-6 pt-6",children:[u.size>0&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Fe,{className:"text-sm whitespace-nowrap",children:L?"Add to group":"添加到分组"}),e.jsx(ei,{className:"flex-1",value:b??"__default__",onChange:Z=>v(Z==="__default__"?void 0:Z),options:[{value:"__default__",label:L?"Default (Ungrouped)":"默认(未分组)"},...Array.from(u.values()).sort((Z,he)=>Z.order-he.order).map(Z=>({value:Z.id,label:Z.name}))]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-1 p-1 bg-muted/50 rounded-xl border",children:[e.jsx("button",{className:`py-2 px-3 text-sm rounded-lg transition-all duration-200 font-medium ${p==="login"?"bg-background text-foreground shadow-sm ring-1 ring-black/5":"text-muted-foreground hover:text-foreground hover:bg-background/50"}`,onClick:()=>{y("login"),ue(null)},disabled:!!xe||Ge,children:L?"Login":"在线登录"}),e.jsx("button",{className:`py-2 px-3 text-sm rounded-lg transition-all duration-200 font-medium ${p==="oidc"?"bg-background text-foreground shadow-sm ring-1 ring-black/5":"text-muted-foreground hover:text-foreground hover:bg-background/50"}`,onClick:()=>{y("oidc"),ue(null)},disabled:!!xe||Ge,children:L?"OIDC Token":"OIDC 凭证"}),e.jsx("button",{className:`py-2 px-3 text-sm rounded-lg transition-all duration-200 font-medium ${p==="sso"?"bg-background text-foreground shadow-sm ring-1 ring-black/5":"text-muted-foreground hover:text-foreground hover:bg-background/50"}`,onClick:()=>{y("sso"),ue(null)},disabled:!!xe||Ge,children:"SSO Token"})]}),p==="login"&&!xe&&e.jsxs("div",{className:"space-y-4",children:[Ge&&qt&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"p-4 bg-primary/[0.08] rounded-lg text-center border border-primary/15",children:[e.jsx("p",{className:"text-sm text-primary mb-2",children:L?"Complete login in browser and enter this code:":"请在浏览器中完成登录,并输入以下代码:"}),e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx("code",{className:"text-2xl font-bold tracking-widest bg-white dark:bg-gray-800 px-4 py-2 rounded border",children:qt.userCode}),e.jsx(D,{variant:"outline",size:"icon",onClick:$t,title:L?"Copy code":"复制代码",children:Ct?e.jsx(Pt,{className:"h-4 w-4 text-success"}):e.jsx(As,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"mt-3 flex items-center justify-center gap-2 text-xs text-muted-foreground",children:[e.jsx(bt,{className:"h-3 w-3 animate-spin"}),L?"Waiting for authorization...":"等待授权中..."]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(D,{variant:"outline",className:"flex-1",onClick:()=>window.api.openExternal(qt.verificationUri,Ze),children:[e.jsx(Xs,{className:"h-4 w-4 mr-2"}),L?"Open Browser":"重新打开浏览器"]}),e.jsx(D,{variant:"destructive",className:"flex-1",onClick:Se,children:L?"Cancel":"取消登录"})]})]}),Ge&&!qt&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"p-4 bg-primary/[0.08] rounded-lg text-center border border-primary/15",children:[e.jsx(bt,{className:"h-8 w-8 animate-spin mx-auto mb-2 text-primary"}),e.jsx("p",{className:"text-sm text-primary",children:L?"Complete login in browser...":"请在浏览器中完成登录..."}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:L?"Kiro social login uses the desktop callback. If the browser asks to open Kiro, allow it.":"Kiro 社交登录使用桌面端回调。如浏览器询问是否打开 Kiro,请允许。"})]}),e.jsxs("div",{className:"space-y-2",children:[Ne&&e.jsxs(D,{variant:"outline",className:"w-full",onClick:()=>window.api.openExternal(Ne,Ze),children:[e.jsx(Xs,{className:"h-4 w-4 mr-2"}),L?"Open Login Again":"重新打开登录"]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Fe,{className:"text-xs",children:L?"Callback URL":"回调 URL"}),e.jsx(it,{value:qe,onChange:Z=>Je(Z.target.value),placeholder:"kiro://kiro.kiroAgent/authenticate-success?code=...&state=...",className:"font-mono text-xs",autoComplete:"off",spellCheck:!1})]}),e.jsxs(D,{className:"w-full",disabled:Kt||!qe.trim(),onClick:nt,children:[Kt&&e.jsx(bt,{className:"h-4 w-4 mr-2 animate-spin"}),L?"Complete Login":"完成登录"]})]}),e.jsx(D,{variant:"destructive",className:"w-full",onClick:Se,children:L?"Cancel":"取消登录"})]}),!Ge&&e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:"text-center mb-6",children:[e.jsx("div",{className:"w-12 h-12 bg-primary/10 rounded-full flex items-center justify-center mx-auto mb-3",children:e.jsx(Pt,{className:"w-6 h-6 text-primary"})}),e.jsx("h3",{className:"text-lg font-semibold",children:L?"Choose Login Method":"选择登录方式"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:L?"Multiple quick login options":"支持多种方式快捷登录"})]}),e.jsx("div",{className:"px-2",children:e.jsxs("button",{type:"button",onClick:()=>J(!Ze),className:`w-full flex items-center justify-between px-4 py-3 rounded-xl border transition-all duration-200 ${Ze?"bg-primary/5 border-primary/30 hover:bg-primary/10":"bg-muted/30 border-transparent hover:bg-muted/50"}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center transition-colors ${Ze?"bg-primary/20":"bg-muted"}`,children:e.jsx(Jl,{className:`w-4 h-4 ${Ze?"text-primary":"text-muted-foreground"}`})}),e.jsx("span",{className:`text-sm font-medium ${Ze?"text-foreground":"text-muted-foreground"}`,children:L?"Private/Incognito Mode":"隐私/无痕模式"})]}),e.jsx("div",{className:`w-10 h-6 rounded-full p-1 transition-colors ${Ze?"bg-primary":"bg-muted-foreground/30"}`,children:e.jsx("div",{className:`w-4 h-4 rounded-full bg-white shadow-sm transition-transform ${Ze?"translate-x-4":"translate-x-0"}`})})]})}),e.jsxs("div",{className:"space-y-3 px-2",children:[e.jsxs("button",{className:"group w-full h-14 flex items-center px-4 gap-4 bg-background hover:bg-muted border border-border rounded-xl transition-all duration-200 hover:shadow-md hover:border-primary/30",onClick:()=>{Et("google"),Nt("Google")},children:[e.jsx("div",{className:"w-8 h-8 flex items-center justify-center bg-white dark:bg-slate-800 rounded-full shadow-sm border dark:border-slate-600 p-1.5 group-hover:scale-110 transition-transform",children:e.jsxs("svg",{viewBox:"0 0 24 24",className:"w-full h-full",children:[e.jsx("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),e.jsx("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),e.jsx("path",{fill:"#FBBC05",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),e.jsx("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})]})}),e.jsxs("div",{className:"flex flex-col items-start",children:[e.jsx("span",{className:"text-sm font-semibold text-foreground",children:L?"Google Account":"Google 账号"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:L?"Quick login with Google":"使用 Google 账号快捷登录"})]})]}),e.jsxs("button",{className:"group w-full h-14 flex items-center px-4 gap-4 bg-background hover:bg-muted border border-border rounded-xl transition-all duration-200 hover:shadow-md hover:border-primary/30",onClick:()=>{Et("github"),Nt("Github")},children:[e.jsx("div",{className:"w-8 h-8 flex items-center justify-center bg-white dark:bg-slate-800 rounded-full shadow-sm border dark:border-slate-600 p-1.5 group-hover:scale-110 transition-transform",children:e.jsx("svg",{viewBox:"0 0 24 24",fill:"#24292f",className:"w-full h-full dark:fill-white",children:e.jsx("path",{d:"M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"})})}),e.jsxs("div",{className:"flex flex-col items-start",children:[e.jsx("span",{className:"text-sm font-semibold text-foreground",children:L?"GitHub Account":"GitHub 账号"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:L?"Quick login with GitHub":"使用 GitHub 账号快捷登录"})]})]}),e.jsxs("button",{className:"group w-full h-14 flex items-center px-4 gap-4 bg-background hover:bg-muted border border-border rounded-xl transition-all duration-200 hover:shadow-md hover:border-primary/30",onClick:()=>{Et("builderid"),je()},children:[e.jsx("div",{className:"w-8 h-8 flex items-center justify-center bg-white dark:bg-slate-800 rounded-full shadow-sm border dark:border-slate-600 p-1.5 group-hover:scale-110 transition-transform",children:e.jsx("svg",{viewBox:"0 0 24 24",className:"w-full h-full",children:e.jsx("text",{x:"0",y:"17",fontSize:"12",fontWeight:"bold",fontFamily:"Arial",className:"fill-[#232f3e] dark:fill-white",children:"aws"})})}),e.jsxs("div",{className:"flex flex-col items-start",children:[e.jsx("span",{className:"text-sm font-semibold text-foreground",children:"AWS Builder ID"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:L?"Login with AWS Builder ID":"使用 AWS Builder ID 登录"})]})]}),e.jsxs("button",{className:"group w-full h-14 flex items-center px-4 gap-4 bg-background hover:bg-muted border border-border rounded-xl transition-all duration-200 hover:shadow-md hover:border-primary/30",onClick:()=>{Et("iamsso")},children:[e.jsx("div",{className:"w-8 h-8 flex items-center justify-center bg-white dark:bg-slate-800 rounded-full shadow-sm border dark:border-slate-600 p-1.5 group-hover:scale-110 transition-transform",children:e.jsx("svg",{viewBox:"0 0 24 24",className:"w-full h-full fill-[#232f3e] dark:fill-white",children:e.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-1-13h2v6h-2zm0 8h2v2h-2z"})})}),e.jsxs("div",{className:"flex flex-col items-start",children:[e.jsx("span",{className:"text-sm font-semibold text-foreground",children:"Enterprise"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"IAM Identity Center SSO"})]})]})]}),ft==="iamsso"&&!ce&&e.jsxs("div",{className:"space-y-4 p-4 bg-slate-50 dark:bg-slate-800/50 rounded-xl border border-slate-200 dark:border-slate-700",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Fe,{htmlFor:"ssoStartUrl",className:"text-sm font-medium",children:"SSO Start URL"}),e.jsx(it,{id:"ssoStartUrl",type:"url",placeholder:"https://your-org.awsapps.com/start",value:ze,onChange:Z=>_(Z.target.value),className:"font-mono text-sm"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:L?"Get this from your organization admin":"从您的组织管理员处获取"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Fe,{htmlFor:"ssoRegion",className:"text-sm font-medium",children:L?"SSO Region":"SSO 区域"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("select",{id:"ssoRegion",value:["us-east-1","us-east-2","us-west-1","us-west-2","eu-west-1","eu-west-2","eu-west-3","eu-central-1","eu-north-1","eu-south-1","ap-northeast-1","ap-northeast-2","ap-northeast-3","ap-southeast-1","ap-southeast-2","ap-south-1","ap-east-1","ca-central-1","sa-east-1","me-south-1","af-south-1"].includes(I)?I:"custom",onChange:Z=>{Z.target.value!=="custom"&&M(Z.target.value)},className:"flex-1 h-10 px-3 rounded-md border border-slate-200 dark:border-slate-700 bg-white dark:bg-slate-900 text-sm",children:[e.jsxs("optgroup",{label:"US",children:[e.jsx("option",{value:"us-east-1",children:"us-east-1 (N. Virginia)"}),e.jsx("option",{value:"us-east-2",children:"us-east-2 (Ohio)"}),e.jsx("option",{value:"us-west-1",children:"us-west-1 (N. California)"}),e.jsx("option",{value:"us-west-2",children:"us-west-2 (Oregon)"})]}),e.jsxs("optgroup",{label:"Europe",children:[e.jsx("option",{value:"eu-west-1",children:"eu-west-1 (Ireland)"}),e.jsx("option",{value:"eu-west-2",children:"eu-west-2 (London)"}),e.jsx("option",{value:"eu-west-3",children:"eu-west-3 (Paris)"}),e.jsx("option",{value:"eu-central-1",children:"eu-central-1 (Frankfurt)"}),e.jsx("option",{value:"eu-north-1",children:"eu-north-1 (Stockholm)"}),e.jsx("option",{value:"eu-south-1",children:"eu-south-1 (Milan)"})]}),e.jsxs("optgroup",{label:"Asia Pacific",children:[e.jsx("option",{value:"ap-northeast-1",children:"ap-northeast-1 (Tokyo)"}),e.jsx("option",{value:"ap-northeast-2",children:"ap-northeast-2 (Seoul)"}),e.jsx("option",{value:"ap-northeast-3",children:"ap-northeast-3 (Osaka)"}),e.jsx("option",{value:"ap-southeast-1",children:"ap-southeast-1 (Singapore)"}),e.jsx("option",{value:"ap-southeast-2",children:"ap-southeast-2 (Sydney)"}),e.jsx("option",{value:"ap-south-1",children:"ap-south-1 (Mumbai)"}),e.jsx("option",{value:"ap-east-1",children:"ap-east-1 (Hong Kong)"})]}),e.jsxs("optgroup",{label:"Other",children:[e.jsx("option",{value:"ca-central-1",children:"ca-central-1 (Canada)"}),e.jsx("option",{value:"sa-east-1",children:"sa-east-1 (São Paulo)"}),e.jsx("option",{value:"me-south-1",children:"me-south-1 (Bahrain)"}),e.jsx("option",{value:"af-south-1",children:"af-south-1 (Cape Town)"})]}),e.jsx("optgroup",{label:L?"Custom":"自定义",children:e.jsx("option",{value:"custom",children:L?"-- Custom Input --":"-- 自定义输入 --"})})]}),e.jsx("input",{type:"text",value:I,onChange:Z=>M(Z.target.value),placeholder:L?"e.g., cn-north-1":"例如: cn-north-1",className:"w-32 h-10 px-3 rounded-md border border-slate-200 dark:border-slate-700 bg-white dark:bg-slate-900 text-sm"})]})]}),e.jsx(D,{className:"w-full",onClick:He,disabled:!ze.trim()||Ge,children:Ge?L?"Starting...":"启动中...":L?"Start Login":"开始登录"})]}),ft==="iamsso"&&ce&&e.jsxs("div",{className:"space-y-4 p-4 bg-slate-50 dark:bg-slate-800/50 rounded-xl border border-slate-200 dark:border-slate-700",children:[e.jsx("div",{className:"text-center space-y-2",children:ce.userCode&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm font-medium",children:L?"Enter this code in browser:":"在浏览器中输入此代码:"}),e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx("code",{className:"px-4 py-2 bg-primary/10 text-primary font-mono text-2xl font-bold rounded-lg",children:ce.userCode}),e.jsx(D,{variant:"ghost",size:"sm",onClick:()=>{navigator.clipboard.writeText(ce.userCode),O(!0),setTimeout(()=>O(!1),2e3)},children:Ct?e.jsx(Pt,{className:"w-4 h-4 text-success"}):e.jsx(As,{className:"w-4 h-4"})})]})]})}),e.jsxs("div",{className:"flex items-center justify-center gap-2 text-sm text-muted-foreground",children:[e.jsx(bt,{className:"w-4 h-4 animate-spin"}),e.jsx("span",{children:L?"Waiting for authorization...":"等待授权中..."})]}),e.jsx(D,{variant:"destructive",className:"w-full",onClick:Se,children:L?"Cancel":"取消登录"})]})]})]}),p==="sso"&&!xe&&e.jsxs("div",{className:"space-y-5",children:[e.jsx("div",{className:"p-4 bg-primary/[0.04] rounded-xl border border-primary/15",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"p-2 bg-primary/10 rounded-lg text-primary",children:e.jsx(Va,{className:"w-4 h-4"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-semibold text-primary mb-1.5",children:L?"How to get Token?":"如何获取 Token?"}),e.jsxs("ol",{className:"text-xs text-primary/90 list-decimal list-inside space-y-1.5",children:[e.jsxs("li",{children:[L?"Visit and login:":"在浏览器中访问并登录:"," ",e.jsx("a",{href:"https://view.awsapps.com/start/#/device?user_code=PQCF-FCCN/start/#/device?user_code=PQCF-FCCN",target:"_blank",className:"underline hover:text-primary/80 font-medium",children:"view.awsapps.com/start/#/device?user_code=PQCF-FCCN"})]}),e.jsx("li",{children:L?"Press F12 → Application → Cookies":"按 F12 打开开发者工具 → Application → Cookies"}),e.jsxs("li",{children:[L?"Find and copy":"找到并复制"," ",e.jsx("code",{className:"px-1 py-0.5 bg-primary/15 rounded font-mono text-[10px]",children:"x-amz-sso_authn"})," ",L?"value":"的值"]})]})]})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:"text-sm font-medium flex items-center gap-1",children:["x-amz-sso_authn ",e.jsx("span",{className:"text-destructive",children:"*"}),e.jsx("span",{className:"text-xs text-muted-foreground font-normal ml-2",children:L?"Supports batch import, one per line":"支持批量导入,每行一个 Token"})]}),e.jsx("textarea",{className:"w-full min-h-[120px] px-3 py-2.5 text-sm rounded-xl border border-input bg-background/50 ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 resize-none font-mono",placeholder:L?"Paste Token content, one per line eyJlbmMiOiJBMjU2... eyJlbmMiOiJBMjU2...":"粘贴 Token 内容,每行一个 eyJlbmMiOiJBMjU2... eyJlbmMiOiJBMjU2...",value:te,onChange:Z=>{Y(Z.target.value),F(null)}}),te.trim()&&e.jsx("p",{className:"text-xs text-muted-foreground",children:L?`Entered ${te.split(`
|
|
45
|
+
`).filter(Z=>Z.trim()).length} tokens`:`已输入 ${te.split(`
|
|
46
|
+
`).filter(Z=>Z.trim()).length} 个 Token`})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"AWS Region"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("select",{className:"flex-1 h-10 px-3 py-2 text-sm rounded-xl border border-input bg-background/50 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",value:["us-east-1","us-east-2","us-west-1","us-west-2","eu-west-1","eu-west-2","eu-west-3","eu-central-1","eu-north-1","eu-south-1","ap-northeast-1","ap-northeast-2","ap-northeast-3","ap-southeast-1","ap-southeast-2","ap-south-1","ap-east-1","ca-central-1","sa-east-1","me-south-1","af-south-1"].includes(I)?I:"custom",onChange:Z=>{Z.target.value!=="custom"&&M(Z.target.value)},children:[e.jsxs("optgroup",{label:"US",children:[e.jsx("option",{value:"us-east-1",children:"us-east-1 (N. Virginia)"}),e.jsx("option",{value:"us-east-2",children:"us-east-2 (Ohio)"}),e.jsx("option",{value:"us-west-1",children:"us-west-1 (N. California)"}),e.jsx("option",{value:"us-west-2",children:"us-west-2 (Oregon)"})]}),e.jsxs("optgroup",{label:"Europe",children:[e.jsx("option",{value:"eu-west-1",children:"eu-west-1 (Ireland)"}),e.jsx("option",{value:"eu-west-2",children:"eu-west-2 (London)"}),e.jsx("option",{value:"eu-west-3",children:"eu-west-3 (Paris)"}),e.jsx("option",{value:"eu-central-1",children:"eu-central-1 (Frankfurt)"}),e.jsx("option",{value:"eu-north-1",children:"eu-north-1 (Stockholm)"}),e.jsx("option",{value:"eu-south-1",children:"eu-south-1 (Milan)"})]}),e.jsxs("optgroup",{label:"Asia Pacific",children:[e.jsx("option",{value:"ap-northeast-1",children:"ap-northeast-1 (Tokyo)"}),e.jsx("option",{value:"ap-northeast-2",children:"ap-northeast-2 (Seoul)"}),e.jsx("option",{value:"ap-northeast-3",children:"ap-northeast-3 (Osaka)"}),e.jsx("option",{value:"ap-southeast-1",children:"ap-southeast-1 (Singapore)"}),e.jsx("option",{value:"ap-southeast-2",children:"ap-southeast-2 (Sydney)"}),e.jsx("option",{value:"ap-south-1",children:"ap-south-1 (Mumbai)"}),e.jsx("option",{value:"ap-east-1",children:"ap-east-1 (Hong Kong)"})]}),e.jsxs("optgroup",{label:"Other",children:[e.jsx("option",{value:"ca-central-1",children:"ca-central-1 (Canada)"}),e.jsx("option",{value:"sa-east-1",children:"sa-east-1 (São Paulo)"}),e.jsx("option",{value:"me-south-1",children:"me-south-1 (Bahrain)"}),e.jsx("option",{value:"af-south-1",children:"af-south-1 (Cape Town)"})]}),e.jsx("optgroup",{label:L?"Custom":"自定义",children:e.jsx("option",{value:"custom",children:L?"-- Custom --":"-- 自定义 --"})})]}),e.jsx("input",{type:"text",value:I,onChange:Z=>M(Z.target.value),placeholder:L?"e.g., cn-north-1":"例如: cn-north-1",className:"w-28 h-10 px-2 text-sm rounded-xl border border-input bg-background/50"})]})]})]}),P&&e.jsxs("div",{className:`p-3 rounded-lg text-sm ${P.failed>0?"bg-warning/10 border border-warning/30":"bg-success/10 border border-success/30"}`,children:[e.jsx("p",{className:`font-medium ${P.failed>0?"text-warning":"text-success"}`,children:L?`Result: ${P.success}/${P.total} succeeded`:`导入结果: 成功 ${P.success}/${P.total}`}),P.errors.length>0&&e.jsx("ul",{className:"mt-2 text-xs text-warning/90 space-y-0.5 max-h-20 overflow-y-auto",children:P.errors.map((Z,he)=>e.jsx("li",{children:Z},he))})]}),e.jsx(D,{type:"button",className:"w-full h-11 text-sm font-medium rounded-xl shadow-sm",onClick:qn,disabled:Ee||!te.trim(),children:Ee?e.jsxs(e.Fragment,{children:[e.jsx(bt,{className:"h-4 w-4 mr-2 animate-spin"}),L?`Importing ${te.split(`
|
|
47
|
+
`).filter(Z=>Z.trim()).length} accounts...`:`正在并发导入 ${te.split(`
|
|
48
|
+
`).filter(Z=>Z.trim()).length} 个账号...`]}):te.split(`
|
|
49
|
+
`).filter(Z=>Z.trim()).length>1?L?`Batch import ${te.split(`
|
|
50
|
+
`).filter(Z=>Z.trim()).length} accounts`:`批量导入 ${te.split(`
|
|
51
|
+
`).filter(Z=>Z.trim()).length} 个账号`:L?"Import & Verify":"导入并验证"})]}),p==="oidc"&&!xe&&e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-sm font-semibold",children:L?"Enter OIDC Token":"输入 OIDC 凭证"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex bg-muted/50 rounded-lg p-0.5",children:[e.jsx("button",{className:`px-2.5 py-1 text-xs rounded-md transition-all ${fe==="single"?"bg-background shadow-sm font-medium":"text-muted-foreground hover:text-foreground"}`,onClick:()=>{pe("single"),re(null)},children:L?"Single":"单个"}),e.jsx("button",{className:`px-2.5 py-1 text-xs rounded-md transition-all ${fe==="batch"?"bg-background shadow-sm font-medium":"text-muted-foreground hover:text-foreground"}`,onClick:()=>{pe("batch"),re(null)},children:L?"Batch":"批量"})]}),fe==="single"&&e.jsxs(D,{type:"button",variant:"outline",size:"sm",className:"h-7 rounded-lg text-xs",onClick:Bt,children:[e.jsx(Ns,{className:"h-3 w-3 mr-1"}),L?"Import":"本地导入"]})]})]}),fe==="single"&&e.jsx(e.Fragment,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:L?"Login Type":"登录类型"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",className:`flex-1 h-9 px-3 text-sm rounded-lg border transition-all ${G==="IdC"&&U==="BuilderId"?"bg-primary text-primary-foreground border-primary":"bg-background border-input hover:bg-muted"}`,onClick:()=>{W("IdC"),q("BuilderId")},children:"Builder ID"}),e.jsx("button",{type:"button",className:`flex-1 h-9 px-3 text-sm rounded-lg border transition-all ${G==="IdC"&&U==="Enterprise"?"bg-primary text-primary-foreground border-primary":"bg-background border-input hover:bg-muted"}`,onClick:()=>{W("IdC"),q("Enterprise")},children:"Enterprise"}),e.jsx("button",{type:"button",className:`flex-1 h-9 px-3 text-sm rounded-lg border transition-all ${G==="social"?"bg-primary text-primary-foreground border-primary":"bg-background border-input hover:bg-muted"}`,onClick:()=>{W("social"),q("Google")},children:"Social"})]}),G==="social"&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",className:`flex-1 h-8 px-3 text-xs rounded-lg border transition-all ${U==="Google"?"bg-primary/20 text-primary border-primary/50":"bg-background border-input hover:bg-muted"}`,onClick:()=>q("Google"),children:"Google"}),e.jsx("button",{type:"button",className:`flex-1 h-8 px-3 text-xs rounded-lg border transition-all ${U==="Github"?"bg-primary/20 text-primary border-primary/50":"bg-background border-input hover:bg-muted"}`,onClick:()=>q("Github"),children:"GitHub"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:L?"Social login does not require Client ID and Secret":"社交登录不需要 Client ID 和 Client Secret"})]}),G==="IdC"&&U==="Enterprise"&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"Enterprise (IAM Identity Center SSO)"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:"text-sm font-medium",children:["Refresh Token ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx("textarea",{className:"w-full min-h-[80px] px-3 py-2.5 text-sm rounded-xl border border-input bg-background/50 ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 resize-none font-mono",placeholder:L?"Paste Refresh Token...":"粘贴 Refresh Token...",value:N,onChange:Z=>j(Z.target.value)})]}),G!=="social"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:"text-sm font-medium",children:["Client ID ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx("input",{type:"text",className:"w-full h-10 px-3 py-2 text-sm rounded-xl border border-input bg-background/50 ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 font-mono",placeholder:"Client ID",value:T,onChange:Z=>S(Z.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:"text-sm font-medium",children:["Client Secret ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx("input",{type:"password",className:"w-full h-10 px-3 py-2 text-sm rounded-xl border border-input bg-background/50 ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 font-mono",placeholder:"Client Secret",value:k,onChange:Z=>R(Z.target.value)})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"AWS Region"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("select",{className:"flex-1 h-10 px-3 py-2 text-sm rounded-xl border border-input bg-background/50 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",value:["us-east-1","us-east-2","us-west-1","us-west-2","eu-west-1","eu-west-2","eu-west-3","eu-central-1","eu-north-1","eu-south-1","ap-northeast-1","ap-northeast-2","ap-northeast-3","ap-southeast-1","ap-southeast-2","ap-south-1","ap-east-1","ca-central-1","sa-east-1","me-south-1","af-south-1"].includes(I)?I:"custom",onChange:Z=>{Z.target.value!=="custom"&&M(Z.target.value)},children:[e.jsxs("optgroup",{label:"US",children:[e.jsx("option",{value:"us-east-1",children:"us-east-1 (N. Virginia)"}),e.jsx("option",{value:"us-east-2",children:"us-east-2 (Ohio)"}),e.jsx("option",{value:"us-west-1",children:"us-west-1 (N. California)"}),e.jsx("option",{value:"us-west-2",children:"us-west-2 (Oregon)"})]}),e.jsxs("optgroup",{label:"Europe",children:[e.jsx("option",{value:"eu-west-1",children:"eu-west-1 (Ireland)"}),e.jsx("option",{value:"eu-west-2",children:"eu-west-2 (London)"}),e.jsx("option",{value:"eu-west-3",children:"eu-west-3 (Paris)"}),e.jsx("option",{value:"eu-central-1",children:"eu-central-1 (Frankfurt)"}),e.jsx("option",{value:"eu-north-1",children:"eu-north-1 (Stockholm)"}),e.jsx("option",{value:"eu-south-1",children:"eu-south-1 (Milan)"})]}),e.jsxs("optgroup",{label:"Asia Pacific",children:[e.jsx("option",{value:"ap-northeast-1",children:"ap-northeast-1 (Tokyo)"}),e.jsx("option",{value:"ap-northeast-2",children:"ap-northeast-2 (Seoul)"}),e.jsx("option",{value:"ap-northeast-3",children:"ap-northeast-3 (Osaka)"}),e.jsx("option",{value:"ap-southeast-1",children:"ap-southeast-1 (Singapore)"}),e.jsx("option",{value:"ap-southeast-2",children:"ap-southeast-2 (Sydney)"}),e.jsx("option",{value:"ap-south-1",children:"ap-south-1 (Mumbai)"}),e.jsx("option",{value:"ap-east-1",children:"ap-east-1 (Hong Kong)"})]}),e.jsxs("optgroup",{label:"Other",children:[e.jsx("option",{value:"ca-central-1",children:"ca-central-1 (Canada)"}),e.jsx("option",{value:"sa-east-1",children:"sa-east-1 (São Paulo)"}),e.jsx("option",{value:"me-south-1",children:"me-south-1 (Bahrain)"}),e.jsx("option",{value:"af-south-1",children:"af-south-1 (Cape Town)"})]}),e.jsx("optgroup",{label:L?"Custom":"自定义",children:e.jsx("option",{value:"custom",children:L?"-- Custom --":"-- 自定义 --"})})]}),e.jsx("input",{type:"text",value:I,onChange:Z=>M(Z.target.value),placeholder:L?"e.g., cn-north-1":"例如: cn-north-1",className:"w-28 h-10 px-2 text-sm rounded-xl border border-input bg-background/50"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Profile ARN"}),e.jsx("input",{type:"text",className:"w-full h-10 px-3 py-2 text-sm rounded-xl border border-input bg-background/50 ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 font-mono",placeholder:"arn:aws:codewhisperer:us-east-1:...",value:V,onChange:Z=>le(Z.target.value)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:L?"Required for Kiro Power/Enterprise model chat.":"Kiro Power/Enterprise cần ARN thật để chat model."})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Start URL"}),e.jsx("input",{type:"text",className:"w-full h-10 px-3 py-2 text-sm rounded-xl border border-input bg-background/50 ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 font-mono",placeholder:"https://view.awsapps.com/start",value:K,onChange:Z=>se(Z.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Machine ID"}),e.jsx("input",{type:"text",className:"w-full h-10 px-3 py-2 text-sm rounded-xl border border-input bg-background/50 ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 font-mono",placeholder:"optional",value:B,onChange:Z=>be(Z.target.value)})]})]})]})]})}),fe==="batch"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"p-3 bg-primary/[0.04] rounded-xl border border-primary/15",children:e.jsxs("p",{className:"text-xs text-primary",children:[L?"Supports JSON array or Card Key format. JSON required:":"支持 JSON 数组或卡密格式。JSON 必填:"," ",e.jsx("code",{className:"px-1 bg-primary/15 rounded",children:"refreshToken"}),".",L?"Card Key format:":"卡密格式:"," ",e.jsx("code",{className:"px-1 bg-primary/15 rounded",children:L?"email----pwd----token----id----secret":"邮箱----密码----Token----ID----Secret"})]})}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[L?"Credentials Data":"凭证数据"," ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx("textarea",{className:"w-full min-h-[180px] px-3 py-2.5 text-sm rounded-xl border border-input bg-background/50 ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 resize-none font-mono text-xs",placeholder:L?`JSON format:
|
|
52
|
+
[
|
|
53
|
+
{
|
|
54
|
+
"refreshToken": "xxx",
|
|
55
|
+
"clientId": "xxx",
|
|
56
|
+
"clientSecret": "xxx",
|
|
57
|
+
"provider": "BuilderId"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"refreshToken": "yyy",
|
|
61
|
+
"clientId": "yyy",
|
|
62
|
+
"clientSecret": "yyy",
|
|
63
|
+
"provider": "Enterprise"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"refreshToken": "zzz",
|
|
67
|
+
"provider": "Github"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"refreshToken": "aaa",
|
|
71
|
+
"provider": "Google"
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
|
|
75
|
+
Or Card Key format (one per line):
|
|
76
|
+
email----password----refreshToken----clientId----clientSecret`:`JSON 格式:
|
|
77
|
+
[
|
|
78
|
+
{
|
|
79
|
+
"refreshToken": "xxx",
|
|
80
|
+
"clientId": "xxx",
|
|
81
|
+
"clientSecret": "xxx",
|
|
82
|
+
"provider": "BuilderId"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"refreshToken": "yyy",
|
|
86
|
+
"clientId": "yyy",
|
|
87
|
+
"clientSecret": "yyy",
|
|
88
|
+
"provider": "Enterprise"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"refreshToken": "zzz",
|
|
92
|
+
"provider": "Github"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"refreshToken": "aaa",
|
|
96
|
+
"provider": "Google"
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
|
|
100
|
+
或卡密格式(每行一个):
|
|
101
|
+
邮箱----密码----RefreshToken----ClientId----ClientSecret`,value:C,onChange:Z=>{z(Z.target.value),re(null)}}),C.trim()&&(()=>{const Z=C.trim();try{const he=JSON.parse(Z),tt=Array.isArray(he)?he.length:1;return e.jsx("p",{className:"text-xs text-muted-foreground",children:L?`Entered ${tt} credentials (JSON)`:`已输入 ${tt} 个凭证 (JSON)`})}catch{const he=Z.split(`
|
|
102
|
+
`).filter(tt=>tt.trim()&&!tt.startsWith("#"));return he.length>0&&he.some(tt=>tt.includes("----")||tt.includes(" ")||/\s{2,}/.test(tt))?e.jsx("p",{className:"text-xs text-muted-foreground",children:L?`Entered ${he.length} credentials (Card Key)`:`已输入 ${he.length} 个凭证 (卡密格式)`}):e.jsx("p",{className:"text-xs text-destructive",children:L?"Invalid format (JSON or Card Key)":"格式错误(支持 JSON 或卡密格式)"})}})()]}),X&&e.jsxs("div",{className:`p-3 rounded-lg text-sm ${X.failed>0?"bg-warning/10 border border-warning/30":"bg-success/10 border border-success/30"}`,children:[e.jsx("p",{className:`font-medium ${X.failed>0?"text-warning":"text-success"}`,children:L?`Result: ${X.success}/${X.total} succeeded`:`导入结果: 成功 ${X.success}/${X.total}`}),X.errors.length>0&&e.jsx("ul",{className:"mt-2 text-xs text-warning/90 space-y-0.5 max-h-20 overflow-y-auto",children:X.errors.map((Z,he)=>e.jsx("li",{children:Z},he))})]})]})]}),oe&&e.jsxs("div",{className:"p-3 bg-destructive/10 text-destructive rounded-xl text-sm flex items-center gap-2 animate-in fade-in slide-in-from-top-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-destructive shrink-0"}),oe]}),p==="oidc"&&e.jsxs("div",{className:"flex justify-end gap-3 pt-4 border-t",children:[e.jsx(D,{type:"button",variant:"outline",onClick:s,className:"rounded-xl h-10 px-6",children:L?"Cancel":"取消"}),fe==="single"?e.jsxs(D,{onClick:ws,disabled:_e||!N||G!=="social"&&(!T||!k),className:"rounded-xl h-10 px-6",children:[_e&&e.jsx(bt,{className:"h-4 w-4 mr-2 animate-spin"}),L?"Add Account":"确认添加"]}):e.jsx(D,{onClick:Ot,disabled:_e||!C.trim(),className:"rounded-xl h-10 px-6",children:_e?e.jsxs(e.Fragment,{children:[e.jsx(bt,{className:"h-4 w-4 mr-2 animate-spin"}),L?"Importing...":"正在并发导入..."]}):(()=>{try{const Z=JSON.parse(C.trim()),he=Array.isArray(Z)?Z.length:1;return L?`Batch import ${he} accounts`:`批量导入 ${he} 个账号`}catch{return L?"Batch Import":"批量导入"}})()})]})]})]})]}):null}function lI({open:n,onOpenChange:s,account:r}){const{updateAccount:i}=vt(),{t:o}=Ut(),d=o("common.unknown")==="Unknown",[u,h]=g.useState(""),[f,p]=g.useState(""),[y,b]=g.useState(""),[v,N]=g.useState("us-east-1"),[j,T]=g.useState(""),[S,k]=g.useState(""),[R,I]=g.useState(""),[M,G]=g.useState(""),[W,U]=g.useState(null),[q,V]=g.useState(!1),[le,B]=g.useState(null),[be,K]=g.useState(!1),se=()=>{W?.accessToken&&(navigator.clipboard.writeText(W.accessToken),K(!0),setTimeout(()=>K(!1),2e3))};g.useEffect(()=>{r&&(h(r.credentials.refreshToken||""),p(r.credentials.clientId||""),b(r.credentials.clientSecret||""),N(r.credentials.region||"us-east-1"),T(r.profileArn||""),k(r.machineId||""),I(r.credentials.startUrl||""),G(r.nickname||""),U({email:r.email,userId:r.userId||"",accessToken:r.credentials.accessToken,profileArn:r.profileArn,subscriptionType:r.subscription.type,subscriptionTitle:r.subscription.title||r.subscription.type,usage:{current:r.usage?.current||0,limit:r.usage?.limit||0},daysRemaining:r.subscription.daysRemaining,expiresAt:r.subscription.expiresAt}),B(null))},[r]);const te=async()=>{try{const F=await window.api.loadKiroCredentials();F.success&&F.data?(h(F.data.refreshToken),p(F.data.clientId),b(F.data.clientSecret),N(F.data.region),T(F.data.profileArn||""),k(F.data.machineId||""),I(F.data.startUrl||""),B(null)):B(F.error||"导入失败")}catch(F){B(F instanceof Error?F.message:"导入失败")}},Y=async()=>{const F=r?.credentials.authMethod==="social";if(!u){B("请填写 Refresh Token");return}if(!F&&(!f||!y)){B("请填写 Client ID 和 Client Secret");return}V(!0),B(null);try{const fe=await window.api.verifyAccountCredentials({refreshToken:u,clientId:f,clientSecret:y,region:v,authMethod:r?.credentials.authMethod,provider:r?.credentials.provider||r?.idp,profileArn:j.trim()||void 0,machineId:S.trim()||void 0,startUrl:R.trim()||void 0});fe.success&&fe.data?(U({email:fe.data.email,userId:fe.data.userId,accessToken:fe.data.accessToken,profileArn:fe.data.profileArn||j.trim()||void 0,subscriptionType:fe.data.subscriptionType,subscriptionTitle:fe.data.subscriptionTitle,usage:fe.data.usage,daysRemaining:fe.data.daysRemaining,expiresAt:fe.data.expiresAt}),fe.data.refreshToken&&h(fe.data.refreshToken)):B(fe.error||"验证失败")}catch(fe){B(fe instanceof Error?fe.message:"验证失败")}finally{V(!1)}},P=()=>{if(!r||!W)return;const F=Date.now();i(r.id,{email:W.email,userId:W.userId,nickname:M||void 0,profileArn:W.profileArn||j.trim()||void 0,machineId:S.trim()||void 0,credentials:{...r.credentials,accessToken:W.accessToken,csrfToken:"",refreshToken:u,clientId:f,clientSecret:y,region:v,startUrl:R.trim()||void 0,expiresAt:F+3600*1e3},subscription:{type:W.subscriptionType,title:W.subscriptionTitle,daysRemaining:W.daysRemaining,expiresAt:W.expiresAt},usage:{current:W.usage.current,limit:W.usage.limit,percentUsed:W.usage.limit>0?W.usage.current/W.usage.limit:0,lastUpdated:F,baseLimit:W.usage.baseLimit,baseCurrent:W.usage.baseCurrent,freeTrialLimit:W.usage.freeTrialLimit,freeTrialCurrent:W.usage.freeTrialCurrent,freeTrialExpiry:W.usage.freeTrialExpiry,bonuses:W.usage.bonuses,nextResetDate:W.usage.nextResetDate},status:"active"}),s(!1)};return!n||!r?null:e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:()=>s(!1)}),e.jsxs(De,{className:"relative w-full max-w-lg max-h-[90vh] overflow-auto z-10 animate-in zoom-in-95 duration-200",children:[e.jsxs(at,{className:"pb-4 border-b sticky top-0 bg-background z-20",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(rt,{className:"text-xl font-bold",children:d?"Edit Account":"编辑账号"}),e.jsx(D,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-full hover:bg-red-500 hover:text-white transition-colors",onClick:()=>s(!1),children:e.jsx(ns,{className:"h-4 w-4"})})]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:d?"Modify account settings or update credentials":"修改账号配置或更新凭证"})]}),e.jsxs(Pe,{className:"p-6 space-y-6",children:[W&&e.jsxs("div",{className:"p-4 bg-primary/5 rounded-xl border border-primary/10 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-primary/10 pb-2",children:[e.jsx("span",{className:"text-sm font-semibold text-foreground/80",children:d?"Account Status":"当前账号状态"}),e.jsxs("div",{className:"px-2.5 py-0.5 rounded-full bg-success/10 text-success text-xs font-medium flex items-center gap-1.5",children:[e.jsx(Bn,{className:"h-3.5 w-3.5"}),d?"Verified":"已验证"]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs block mb-1",children:d?"Email":"邮箱"}),e.jsx("span",{className:"font-medium font-mono text-xs truncate block",title:W.email,children:W.email})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs block mb-1",children:d?"Plan":"订阅计划"}),e.jsx("span",{className:"font-medium",children:W.subscriptionTitle})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs block mb-1",children:d?"Usage":"使用额度"}),e.jsxs("span",{className:"font-medium",children:[W.usage.current.toLocaleString()," / ",W.usage.limit.toLocaleString()]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs block mb-1",children:d?"Days Left":"剩余天数"}),e.jsxs("span",{className:"font-medium",children:[W.daysRemaining??"-"," ",d?"d":"天"]})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:d?"Nickname":"账号别名"}),e.jsx("input",{type:"text",value:M,onChange:F=>G(F.target.value),placeholder:d?"Give this account a memorable name":"给这个账号起个好记的名字",className:"w-full h-10 px-3 py-2 text-sm rounded-xl border border-input bg-background/50 ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2"})]}),e.jsxs("div",{className:"space-y-5 pt-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"text-sm font-semibold",children:r?.credentials.authMethod==="social"?d?"Social Login":"社交登录凭证":d?"OIDC Credentials":"OIDC 凭证配置"}),r?.credentials.authMethod==="social"&&e.jsx("span",{className:"px-2 py-0.5 text-xs rounded-full bg-primary/10 text-primary",children:r?.credentials.provider||r?.idp})]}),r?.credentials.authMethod!=="social"&&e.jsxs(D,{type:"button",variant:"outline",size:"sm",className:"h-8 rounded-lg text-xs",onClick:te,children:[e.jsx(Ns,{className:"h-3 w-3 mr-1.5"}),d?"Import Local":"从本地导入"]})]}),r?.credentials.authMethod==="social"&&e.jsx("p",{className:"text-xs text-muted-foreground",children:d?"Social login only needs Refresh Token":"社交登录账号只需要 Refresh Token,不需要 Client ID 和 Client Secret"}),e.jsxs("div",{className:"space-y-4",children:[W?.accessToken&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("label",{className:"text-sm font-medium",children:"Access Token"}),e.jsxs(D,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:se,children:[be?e.jsx(Pt,{className:"h-3 w-3 mr-1 text-success"}):e.jsx(As,{className:"h-3 w-3 mr-1"}),be?d?"Copied":"已复制":d?"Copy":"复制"]})]}),e.jsxs("div",{className:"w-full px-3 py-2.5 text-sm rounded-xl border border-input bg-muted/50 font-mono text-muted-foreground truncate",children:[W.accessToken.slice(0,50),"..."]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:"text-sm font-medium",children:["Refresh Token ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx("textarea",{value:u,onChange:F=>h(F.target.value),placeholder:"aorAAAAA...",className:"w-full min-h-[80px] px-3 py-2.5 text-sm rounded-xl border border-input bg-background/50 ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 resize-none font-mono"})]}),r?.credentials.authMethod!=="social"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:"text-sm font-medium",children:["Client ID ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx("input",{type:"text",value:f,onChange:F=>p(F.target.value),placeholder:"Client ID",className:"w-full h-10 px-3 py-2 text-sm rounded-xl border border-input bg-background/50 ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 font-mono"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:"text-sm font-medium",children:["Client Secret ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx("input",{type:"text",value:y,onChange:F=>b(F.target.value),placeholder:"Client Secret",className:"w-full h-10 px-3 py-2 text-sm rounded-xl border border-input bg-background/50 ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 font-mono"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"AWS Region"}),e.jsxs("select",{value:v,onChange:F=>N(F.target.value),className:"w-full h-10 px-3 py-2 text-sm rounded-xl border border-input bg-background/50 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",children:[e.jsx("option",{value:"us-east-1",children:"us-east-1 (N. Virginia)"}),e.jsx("option",{value:"us-west-2",children:"us-west-2 (Oregon)"}),e.jsx("option",{value:"eu-west-1",children:"eu-west-1 (Ireland)"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Profile ARN"}),e.jsx("input",{type:"text",value:j,onChange:F=>T(F.target.value),placeholder:"arn:aws:codewhisperer:us-east-1:...",className:"w-full h-10 px-3 py-2 text-sm rounded-xl border border-input bg-background/50 ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 font-mono"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:d?"Required for Kiro Power/Enterprise model chat.":"Kiro Power/Enterprise cần ARN thật để chat model."})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Start URL"}),e.jsx("input",{type:"text",value:R,onChange:F=>I(F.target.value),placeholder:"https://view.awsapps.com/start",className:"w-full h-10 px-3 py-2 text-sm rounded-xl border border-input bg-background/50 ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 font-mono"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Machine ID"}),e.jsx("input",{type:"text",value:S,onChange:F=>k(F.target.value),placeholder:"optional",className:"w-full h-10 px-3 py-2 text-sm rounded-xl border border-input bg-background/50 ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 font-mono"})]})]})]}),e.jsxs(D,{type:"button",variant:"secondary",className:"w-full h-10 rounded-xl font-medium",onClick:Y,disabled:q||!u||r?.credentials.authMethod!=="social"&&(!f||!y),children:[q?e.jsx(bt,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(Mt,{className:"h-4 w-4 mr-2"}),d?"Verify & Refresh":"验证并刷新凭证信息"]})]})]}),le&&e.jsxs("div",{className:"p-3 bg-destructive/10 text-destructive rounded-xl text-sm flex items-center gap-2 animate-in fade-in slide-in-from-top-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-destructive shrink-0"}),le]})]}),e.jsxs("div",{className:"sticky bottom-0 bg-background/95 backdrop-blur p-4 border-t flex justify-end gap-3 z-20",children:[e.jsx(D,{variant:"outline",onClick:()=>s(!1),className:"rounded-xl h-10 px-6",children:d?"Cancel":"取消"}),e.jsx(D,{onClick:P,disabled:!W,className:"rounded-xl h-10 px-6",children:d?"Save Changes":"保存更改"})]})]})]})}function oI({isOpen:n,onClose:s}){const{groups:r,accounts:i,addGroup:o,updateGroup:d,removeGroup:u,moveAccountsToGroup:h}=vt(),{t:f}=Ut(),p=f("common.unknown")==="Unknown",[y,b]=g.useState(null),[v,N]=g.useState(""),[j,T]=g.useState(""),[S,k]=g.useState("#3b82f6"),[R,I]=g.useState(!1),[M,G]=g.useState(""),[W,U]=g.useState(""),[q,V]=g.useState("#3b82f6"),[le,B]=g.useState(null),be=z=>Array.from(i.values()).filter(X=>X.groupId===z).length,K=()=>Array.from(i.values()).filter(z=>!z.groupId).length,se=()=>{M.trim()&&(o({name:M.trim(),description:W.trim()||void 0,color:q}),G(""),U(""),V("#3b82f6"),I(!1))},te=z=>{b(z.id),N(z.name),T(z.description||""),k(z.color||"#3b82f6")},Y=()=>{!y||!v.trim()||(d(y,{name:v.trim(),description:j.trim()||void 0,color:S}),b(null))},P=(z,X)=>{const re=be(z),xe=re>0?`确定要删除分组「${X}」吗?
|
|
103
|
+
该分组包含 ${re} 个账号,删除后这些账号将变为未分组状态。`:`确定要删除分组「${X}」吗?`;confirm(xe)&&u(z)},F=(z,X)=>{h(X,z)},fe=z=>Array.from(i.values()).filter(X=>X.groupId!==z),pe=z=>Array.from(i.values()).filter(X=>X.groupId===z),C=Array.from(r.values()).sort((z,X)=>z.order-X.order);return n?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:s}),e.jsxs(De,{className:"relative w-full max-w-2xl max-h-[85vh] overflow-hidden z-10 flex flex-col",children:[e.jsxs(at,{className:"flex flex-row items-center justify-between pb-2 shrink-0",children:[e.jsxs(rt,{className:"flex items-center gap-2",children:[e.jsx(Vi,{className:"h-5 w-5"}),p?"Group Management":"分组管理"]}),e.jsx(D,{variant:"ghost",size:"icon",onClick:s,className:"rounded-lg hover:bg-red-500 hover:text-white transition-colors",children:e.jsx(ns,{className:"h-4 w-4"})})]}),e.jsxs(Pe,{className:"flex-1 overflow-auto space-y-4",children:[e.jsxs("div",{className:"flex gap-4 text-sm text-muted-foreground",children:[e.jsx("span",{children:p?`${C.length} groups`:`共 ${C.length} 个分组`}),e.jsx("span",{children:"•"}),e.jsx("span",{children:p?`${K()} ungrouped`:`${K()} 个未分组账号`})]}),R?e.jsxs("div",{className:"p-4 border rounded-lg space-y-3 bg-muted/30",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"color",value:q,onChange:z=>V(z.target.value),className:"w-8 h-8 rounded cursor-pointer"}),e.jsx("input",{type:"text",placeholder:p?"Group name":"分组名称",value:M,onChange:z=>G(z.target.value),className:"flex-1 px-3 py-2 border rounded-lg text-sm",autoFocus:!0})]}),e.jsx("input",{type:"text",placeholder:p?"Description (optional)":"分组描述(可选)",value:W,onChange:z=>U(z.target.value),className:"w-full px-3 py-2 border rounded-lg text-sm"}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(D,{variant:"outline",size:"sm",onClick:()=>I(!1),children:p?"Cancel":"取消"}),e.jsxs(D,{size:"sm",onClick:se,disabled:!M.trim(),children:[e.jsx(Pt,{className:"h-4 w-4 mr-1"}),p?"Create":"创建"]})]})]}):e.jsxs(D,{variant:"outline",className:"w-full",onClick:()=>I(!0),children:[e.jsx(Ts,{className:"h-4 w-4 mr-2"}),p?"New Group":"新建分组"]}),e.jsxs("div",{className:"space-y-2",children:[C.map(z=>e.jsx("div",{className:"p-3 border rounded-lg hover:bg-muted/30 transition-colors",children:y===z.id?e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"color",value:S,onChange:X=>k(X.target.value),className:"w-8 h-8 rounded cursor-pointer"}),e.jsx("input",{type:"text",value:v,onChange:X=>N(X.target.value),className:"flex-1 px-3 py-1.5 border rounded text-sm",autoFocus:!0})]}),e.jsx("input",{type:"text",placeholder:p?"Description":"分组描述",value:j,onChange:X=>T(X.target.value),className:"w-full px-3 py-1.5 border rounded text-sm"}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(D,{variant:"outline",size:"sm",onClick:()=>b(null),children:p?"Cancel":"取消"}),e.jsx(D,{size:"sm",onClick:Y,children:p?"Save":"保存"})]})]}):le===z.id?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded",style:{backgroundColor:z.color||"#3b82f6"}}),e.jsx("span",{className:"font-medium",children:z.name}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"- 选择要添加的账号"})]}),pe(z.id).length>0&&e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:p?"Accounts in this group:":"当前分组内的账号:"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:pe(z.id).map(X=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-primary/10 text-primary rounded text-xs",children:[X.email,e.jsx("button",{onClick:()=>F(void 0,[X.id]),className:"hover:text-destructive",title:p?"Remove from group":"移出分组",children:e.jsx(ns,{className:"h-3 w-3"})})]},X.id))})]}),fe(z.id).length>0&&e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:p?"Click to add to this group:":"点击添加到此分组:"}),e.jsx("div",{className:"flex flex-wrap gap-1 max-h-32 overflow-auto",children:fe(z.id).map(X=>e.jsx("button",{onClick:()=>F(z.id,[X.id]),className:"px-2 py-0.5 bg-muted hover:bg-primary/20 rounded text-xs transition-colors",children:X.email},X.id))})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(D,{variant:"outline",size:"sm",onClick:()=>B(null),children:"完成"})})]}):e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-4 h-4 rounded shrink-0",style:{backgroundColor:z.color||"#3b82f6"}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium truncate",children:z.name}),e.jsxs("span",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e.jsx(Fn,{className:"h-3 w-3"}),be(z.id)]})]}),z.description&&e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:z.description})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx(D,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>B(z.id),title:p?"Manage accounts":"管理账号",children:e.jsx(Fn,{className:"h-4 w-4"})}),e.jsx(D,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>te(z),title:p?"Edit":"编辑",children:e.jsx(yx,{className:"h-4 w-4"})}),e.jsx(D,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive",onClick:()=>P(z.id,z.name),title:p?"Delete":"删除",children:e.jsx(Vt,{className:"h-4 w-4"})})]})]})},z.id)),C.length===0&&!R&&e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(Vi,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:p?"No groups":"暂无分组"}),e.jsx("p",{className:"text-sm",children:p?"Click the button above to create your first group":"点击上方按钮创建第一个分组"})]})]})]})]})]}):null}const Jv=[{name:"红色",value:"#ffef4444"},{name:"橙色",value:"#fff97316"},{name:"黄色",value:"#ffeab308"},{name:"绿色",value:"#ff22c55e"},{name:"青色",value:"#ff06b6d4"},{name:"蓝色",value:"#ff3b82f6"},{name:"紫色",value:"#ff8b5cf6"},{name:"粉色",value:"#ffec4899"},{name:"灰色",value:"#ff6b7280"},{name:"浅红",value:"#80ef4444"},{name:"浅绿",value:"#8022c55e"},{name:"浅蓝",value:"#803b82f6"},{name:"浅紫",value:"#808b5cf6"}];function ju(n){if(n.length===9&&n.startsWith("#")){const s=parseInt(n.slice(1,3),16),r="#"+n.slice(3);return{alpha:s,rgb:r}}return{alpha:255,rgb:n}}function iu(n,s){const r=n.startsWith("#")?n.slice(1):n;return`#${Math.round(s).toString(16).padStart(2,"0")}${r}`}function Ii(n){const{alpha:s,rgb:r}=ju(n),i=r.startsWith("#")?r.slice(1):r,o=parseInt(i.slice(0,2),16),d=parseInt(i.slice(2,4),16),u=parseInt(i.slice(4,6),16);return`rgba(${o}, ${d}, ${u}, ${s/255})`}function cI({isOpen:n,onClose:s}){const{tags:r,accounts:i,addTag:o,updateTag:d,removeTag:u,addTagToAccounts:h,removeTagFromAccounts:f}=vt(),{t:p}=Ut(),y=p("common.unknown")==="Unknown",[b,v]=g.useState(null),[N,j]=g.useState(""),[T,S]=g.useState("#ff3b82f6"),[k,R]=g.useState(255),[I,M]=g.useState(!1),[G,W]=g.useState(""),[U,q]=g.useState("#3b82f6"),[V,le]=g.useState(255),[B,be]=g.useState(null),K=z=>Array.from(i.values()).filter(X=>X.tags.includes(z)).length,se=()=>Array.from(i.values()).filter(z=>z.tags.length===0).length,te=()=>{if(!G.trim())return;const z=iu(U,V);o({name:G.trim(),color:z}),W(""),q("#3b82f6"),le(255),M(!1)},Y=z=>{v(z.id),j(z.name);const{alpha:X,rgb:re}=ju(z.color);S(re),R(X)},P=()=>{if(!b||!N.trim())return;const z=iu(T,k);d(b,{name:N.trim(),color:z}),v(null)},F=(z,X)=>{const re=K(z),xe=re>0?`确定要删除标签「${X}」吗?
|
|
104
|
+
该标签已应用于 ${re} 个账号,删除后将从这些账号移除。`:`确定要删除标签「${X}」吗?`;confirm(xe)&&u(z)},fe=z=>Array.from(i.values()).filter(X=>X.tags.includes(z)),pe=z=>Array.from(i.values()).filter(X=>!X.tags.includes(z)),C=Array.from(r.values());return n?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:s}),e.jsxs(De,{className:"relative w-full max-w-2xl max-h-[85vh] overflow-hidden z-10 flex flex-col",children:[e.jsxs(at,{className:"flex flex-row items-center justify-between pb-2 shrink-0",children:[e.jsxs(rt,{className:"flex items-center gap-2",children:[e.jsx(Xl,{className:"h-5 w-5"}),y?"Tag Management":"标签管理"]}),e.jsx(D,{variant:"ghost",size:"icon",onClick:s,className:"rounded-lg hover:bg-red-500 hover:text-white transition-colors",children:e.jsx(ns,{className:"h-4 w-4"})})]}),e.jsxs(Pe,{className:"flex-1 overflow-auto space-y-4",children:[e.jsxs("div",{className:"flex gap-4 text-sm text-muted-foreground",children:[e.jsx("span",{children:y?`${C.length} tags`:`共 ${C.length} 个标签`}),e.jsx("span",{children:"•"}),e.jsx("span",{children:y?`${se()} untagged`:`${se()} 个未标记账号`})]}),I?e.jsxs("div",{className:"p-4 border rounded-lg space-y-3 bg-muted/30",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-8 h-8 rounded border cursor-pointer flex items-center justify-center",style:{backgroundColor:Ii(iu(U,V))},children:e.jsx("input",{type:"color",value:U,onChange:z=>q(z.target.value),className:"w-full h-full opacity-0 cursor-pointer"})}),e.jsx("input",{type:"text",placeholder:y?"Tag name":"标签名称",value:G,onChange:z=>W(z.target.value),className:"flex-1 px-3 py-2 border rounded-lg text-sm",autoFocus:!0})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(GN,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-muted-foreground w-16",children:y?"Opacity":"透明度"}),e.jsx("input",{type:"range",min:"0",max:"255",value:V,onChange:z=>le(parseInt(z.target.value)),className:"flex-1"}),e.jsxs("span",{className:"text-sm w-12 text-right",children:[Math.round(V/255*100),"%"]})]}),e.jsx("div",{className:"flex flex-wrap gap-1",children:Jv.map(z=>e.jsx("button",{className:"w-6 h-6 rounded border hover:scale-110 transition-transform",style:{backgroundColor:Ii(z.value)},onClick:()=>{const{alpha:X,rgb:re}=ju(z.value);q(re),le(X)},title:z.name},z.value))}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(D,{variant:"outline",size:"sm",onClick:()=>M(!1),children:y?"Cancel":"取消"}),e.jsxs(D,{size:"sm",onClick:te,disabled:!G.trim(),children:[e.jsx(Pt,{className:"h-4 w-4 mr-1"}),y?"Create":"创建"]})]})]}):e.jsxs(D,{variant:"outline",className:"w-full",onClick:()=>M(!0),children:[e.jsx(Ts,{className:"h-4 w-4 mr-2"}),y?"New Tag":"新建标签"]}),e.jsxs("div",{className:"space-y-2",children:[C.map(z=>e.jsx("div",{className:"p-3 border rounded-lg hover:bg-muted/30 transition-colors",children:b===z.id?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-8 h-8 rounded border cursor-pointer flex items-center justify-center",style:{backgroundColor:Ii(iu(T,k))},children:e.jsx("input",{type:"color",value:T,onChange:X=>S(X.target.value),className:"w-full h-full opacity-0 cursor-pointer"})}),e.jsx("input",{type:"text",value:N,onChange:X=>j(X.target.value),className:"flex-1 px-3 py-1.5 border rounded text-sm",autoFocus:!0})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm text-muted-foreground w-16",children:y?"Opacity":"透明度"}),e.jsx("input",{type:"range",min:"0",max:"255",value:k,onChange:X=>R(parseInt(X.target.value)),className:"flex-1"}),e.jsxs("span",{className:"text-sm w-12 text-right",children:[Math.round(k/255*100),"%"]})]}),e.jsx("div",{className:"flex flex-wrap gap-1",children:Jv.map(X=>e.jsx("button",{className:"w-6 h-6 rounded border hover:scale-110 transition-transform",style:{backgroundColor:Ii(X.value)},onClick:()=>{const{alpha:re,rgb:xe}=ju(X.value);S(xe),R(re)},title:X.name},X.value))}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(D,{variant:"outline",size:"sm",onClick:()=>v(null),children:"取消"}),e.jsx(D,{size:"sm",onClick:P,children:"保存"})]})]}):B===z.id?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium text-white",style:{backgroundColor:Ii(z.color)},children:z.name}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"- 选择要添加标签的账号"})]}),fe(z.id).length>0&&e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:y?"Tagged accounts:":"已标记的账号:"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:fe(z.id).map(X=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs",style:{backgroundColor:Ii(z.color),color:"white"},children:[X.email,e.jsx("button",{onClick:()=>f([X.id],z.id),className:"hover:opacity-70",title:y?"Remove tag":"移除标签",children:e.jsx(ns,{className:"h-3 w-3"})})]},X.id))})]}),pe(z.id).length>0&&e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:y?"Click to add tag:":"点击添加标签:"}),e.jsx("div",{className:"flex flex-wrap gap-1 max-h-32 overflow-auto",children:pe(z.id).map(X=>e.jsx("button",{onClick:()=>h([X.id],z.id),className:"px-2 py-0.5 bg-muted hover:bg-primary/20 rounded text-xs transition-colors",children:X.email},X.id))})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(D,{variant:"outline",size:"sm",onClick:()=>be(null),children:"完成"})})]}):e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium text-white shrink-0",style:{backgroundColor:Ii(z.color)},children:z.name}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[K(z.id)," 个账号"]}),e.jsx("div",{className:"flex-1"}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx(D,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>be(z.id),title:y?"Manage accounts":"管理账号",children:e.jsx(Xl,{className:"h-4 w-4"})}),e.jsx(D,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>Y(z),title:y?"Edit":"编辑",children:e.jsx(yx,{className:"h-4 w-4"})}),e.jsx(D,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive",onClick:()=>F(z.id,z.name),title:y?"Delete":"删除",children:e.jsx(Vt,{className:"h-4 w-4"})})]})]})},z.id)),C.length===0&&!I&&e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(Xl,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:y?"No tags":"暂无标签"}),e.jsx("p",{className:"text-sm",children:y?"Click the button above to create your first tag":"点击上方按钮创建第一个标签"})]})]})]})]})]}):null}function tw({open:n,onClose:s,accounts:r,selectedCount:i}){const[o,d]=g.useState("json"),[u,h]=g.useState(!0),[f,p]=g.useState(!1),{exportAccounts:y}=vt(),{t:b}=Ut(),v=b("common.unknown")==="Unknown";if(!n)return null;const N=[{id:"json",name:"JSON",icon:VN,desc:v?"Full data, can be imported":"完整数据,可用于导入"},{id:"oidc",name:"OIDC JSON",icon:f3,desc:v?"Minimal JSON, paste to OIDC batch import":"OIDC 精简 JSON,可粘贴到批量添加"},{id:"kami",name:v?"Card Key":"卡密",icon:Dc,desc:v?"email----password----token----id----secret":"卡密格式:邮箱----密码----Token----ID----Secret"},{id:"txt",name:"TXT",icon:xr,desc:v?"Text format":u?"可导入格式:邮箱,Token,昵称,登录方式":"纯文本格式,每行一个账号"},{id:"csv",name:"CSV",icon:MM,desc:v?"Excel compatible":u?"可导入格式,Excel 兼容":"Excel 兼容格式"},{id:"clipboard",name:v?"Clipboard":"剪贴板",icon:vf,desc:v?"Copy to clipboard":u?"可导入格式:邮箱,Token":"复制到剪贴板"}],j=S=>{switch(S){case"json":const k=y(r.map(M=>M.id));return u||(k.accounts=k.accounts.map(M=>({...M,credentials:{...M.credentials,accessToken:"",refreshToken:"",csrfToken:""}}))),JSON.stringify(k,null,2);case"oidc":{const M=r.map(G=>{const W={email:G.email,refreshToken:G.credentials?.refreshToken||"",provider:G.idp||"BuilderId"};return G.password&&(W.password=G.password),G.credentials?.clientId&&(W.clientId=G.credentials.clientId),G.credentials?.clientSecret&&(W.clientSecret=G.credentials.clientSecret),W});return JSON.stringify(M,null,2)}case"txt":return u?r.map(M=>[M.email,M.credentials?.refreshToken||"",M.nickname||"",M.idp||"Google"].join(",")).join(`
|
|
105
|
+
`):r.map(M=>[`邮箱: ${M.email}`,M.nickname?`昵称: ${M.nickname}`:null,M.idp?`登录方式: ${M.idp}`:null,M.subscription?.title?`订阅: ${M.subscription.title}`:null,M.usage?`用量: ${M.usage.current??0}/${M.usage.limit??0}`:null].filter(Boolean).join(`
|
|
106
|
+
`)).join(`
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
`);case"csv":const R=u?["邮箱","昵称","登录方式","RefreshToken","ClientId","ClientSecret","Region"]:["邮箱","昵称","登录方式","订阅类型","订阅标题","已用量","总额度"],I=r.map(M=>u?[M.email,M.nickname||"",M.idp||"",M.credentials?.refreshToken||"",M.credentials?.clientId||"",M.credentials?.clientSecret||"",M.credentials?.region||"us-east-1"]:[M.email,M.nickname||"",M.idp||"",M.subscription?.type||"",M.subscription?.title||"",String(M.usage?.current??""),String(M.usage?.limit??"")]);return"\uFEFF"+[R,...I].map(M=>M.map(G=>`"${String(G).replace(/"/g,'""')}"`).join(",")).join(`
|
|
111
|
+
`);case"kami":return r.map(M=>[M.email,M.password||"no_password",M.credentials?.refreshToken||"",M.credentials?.clientId||"",M.credentials?.clientSecret||"",M.idp||"BuilderId"].join("----")).join(`
|
|
112
|
+
`);case"clipboard":return u?r.map(M=>`${M.email},${M.credentials?.refreshToken||""}`).join(`
|
|
113
|
+
`):r.map(M=>`${M.email}${M.nickname?` (${M.nickname})`:""} - ${M.subscription?.title||"未知订阅"}`).join(`
|
|
114
|
+
`);default:return""}},T=async()=>{const S=j(o),k=r.length;if(o==="clipboard"){await navigator.clipboard.writeText(S),p(!0),setTimeout(()=>{p(!1),s()},1500);return}const R={json:"json",oidc:"json",txt:"txt",csv:"csv",kami:"txt"},I=`kiro-accounts-${new Date().toISOString().slice(0,10)}.${R[o]}`;await window.api.exportToFile(S,I)&&(alert(v?`Exported ${k} accounts`:`已导出 ${k} 个账号`),s())};return Tn.createPortal(e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:s}),e.jsxs("div",{className:"relative bg-background rounded-xl shadow-2xl w-[450px] animate-in fade-in zoom-in-95 duration-200",children:[e.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ns,{className:"h-5 w-5"}),e.jsx("h2",{className:"text-lg font-semibold",children:v?"Export Accounts":"导出账号"}),e.jsx($e,{variant:"secondary",children:i>0?v?`${i} selected`:`${i} 个选中`:v?`All ${r.length}`:`全部 ${r.length} 个`})]}),e.jsx(D,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 rounded-lg hover:bg-red-500 hover:text-white transition-colors",onClick:s,children:e.jsx(ns,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"p-6 space-y-4",children:[e.jsx("div",{className:"grid grid-cols-2 gap-3",children:N.map(S=>{const k=S.icon,R=o===S.id;return e.jsxs("button",{onClick:()=>d(S.id),className:me("p-4 rounded-lg border-2 text-left transition-all",R?"border-primary bg-primary/5":"border-muted hover:border-muted-foreground/30"),children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(k,{className:me("h-4 w-4",R&&"text-primary")}),e.jsx("span",{className:me("font-medium",R&&"text-primary"),children:S.name})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:S.desc})]},S.id)})}),o==="oidc"&&e.jsx("div",{className:"p-3 bg-muted rounded-lg",children:e.jsx("p",{className:"text-xs text-muted-foreground",children:v?"Minimal JSON array (email / password / refreshToken / clientId / clientSecret / provider). Paste directly into the OIDC batch import box.":"精简 JSON 数组,含 邮箱 / 密码 / RefreshToken / ClientId / ClientSecret / provider,可直接粘贴到「OIDC 批量添加」输入框。"})}),o==="kami"&&e.jsx("div",{className:"p-3 bg-muted rounded-lg",children:e.jsxs("p",{className:"text-xs text-muted-foreground",children:[v?"Format: email----password----refreshToken----clientId----clientSecret":"格式:邮箱----密码----RefreshToken----ClientId----ClientSecret",e.jsx("br",{}),v?"One account per line, empty lines are ignored. Supports auto-detection of separators (----, spaces, tabs)":"每行一个账号,空行无效。导入时支持自动识别分隔符(----、空格、Tab)"]})}),o==="json"&&e.jsxs("label",{className:"flex items-center gap-2 p-3 bg-muted rounded-lg cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:u,onChange:S=>h(S.target.checked),className:"w-4 h-4 rounded"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:v?"Include credentials":"包含凭证信息"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:v?"Include sensitive data for full import":"包含 Token 等敏感数据,可用于完整导入"})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-3 px-6 py-4 border-t bg-muted/30",children:[e.jsx(D,{variant:"outline",onClick:s,children:v?"Cancel":"取消"}),(o==="kami"||o==="oidc")&&e.jsx(D,{variant:"outline",disabled:f,onClick:async()=>{const S=j(o);await navigator.clipboard.writeText(S),p(!0),setTimeout(()=>{p(!1),s()},1500)},children:f?e.jsxs(e.Fragment,{children:[e.jsx(Pt,{className:"h-4 w-4 mr-2"}),v?"Copied":"已复制"]}):e.jsxs(e.Fragment,{children:[e.jsx(vf,{className:"h-4 w-4 mr-2"}),v?"Copy":"复制到剪贴板"]})}),e.jsx(D,{onClick:T,disabled:f,children:f?e.jsxs(e.Fragment,{children:[e.jsx(Pt,{className:"h-4 w-4 mr-2"}),v?"Copied":"已复制"]}):o==="clipboard"?e.jsxs(e.Fragment,{children:[e.jsx(vf,{className:"h-4 w-4 mr-2"}),v?"Copy":"复制到剪贴板"]}):e.jsxs(e.Fragment,{children:[e.jsx(Ns,{className:"h-4 w-4 mr-2"}),v?"Export":"导出"]})})]})]})]}),document.body)}function dI({onBack:n}){const{isLoading:s,accounts:r,importFromExportData:i,importAccounts:o,selectedIds:d,activeGroupTab:u,groups:h}=vt(),[f,p]=g.useState(!1),[y,b]=g.useState(null),[v,N]=g.useState(!1),[j,T]=g.useState(!1),[S,k]=g.useState(!1),[R,I]=g.useState(!1),[M,G]=g.useState(()=>localStorage.getItem("accounts_viewMode")==="list"?"list":"grid");g.useEffect(()=>{localStorage.setItem("accounts_viewMode",M)},[M]);const{t:W}=Ut(),U=W("common.unknown")==="Unknown",q=()=>{const te=Array.from(r.values());return d.size>0?te.filter(Y=>d.has(Y.id)):te},V=()=>{k(!0)},le=te=>{const Y=[];let P="",F=!1;for(let fe=0;fe<te.length;fe++){const pe=te[fe];pe==='"'?F&&te[fe+1]==='"'?(P+='"',fe++):F=!F:pe===","&&!F?(Y.push(P.trim()),P=""):P+=pe}return Y.push(P.trim()),Y},B=async()=>{const te=u!=="all"&&u!=="ungrouped"&&h.has(u)?u:void 0,Y=te?h.get(te)?.name??"未分组":"未分组",P=await window.api.importFromFile();if(!P)return;const{content:F,format:fe}=P;try{if(fe==="json"){const pe=JSON.parse(F);if(pe.version&&pe.accounts){const C=i(pe),z=C.errors.find(re=>re.id==="skipped"),X=z?`,${z.error}`:"";alert(`导入完成:成功 ${C.success} 个${X}`)}else alert("无效的 JSON 文件格式")}else if(fe==="csv"){const pe=F.split(`
|
|
115
|
+
`).filter(X=>X.trim());if(pe.length<2){alert("CSV 文件为空或只有标题行");return}const C=pe.slice(1).map(X=>{const re=le(X);return{email:re[0]||"",nickname:re[1]||void 0,idp:re[2]||"Google",refreshToken:re[3]||"",clientId:re[4]||"",clientSecret:re[5]||"",region:re[6]||"us-east-1",groupId:te}}).filter(X=>X.email&&X.refreshToken);if(C.length===0){alert("未找到有效的账号数据(需要邮箱和 RefreshToken)");return}const z=o(C);alert(`导入完成:成功 ${z.success} 个,失败 ${z.failed} 个(分组:${Y})`)}else if(fe==="txt"){const pe=F.split(`
|
|
116
|
+
`).filter(z=>z.trim()&&!z.startsWith("#"));if(pe.some(z=>z.includes("----"))){const z=pe.map(re=>{const xe=PN(re),Oe=xe[1]?.trim(),Ee=xe[3]?.trim()||void 0,Qe=xe[4]?.trim()||void 0,st=xe[5]?.trim()||(!Ee&&!Qe?"Google":"BuilderId");return{email:xe[0]?.trim()||"",password:Oe&&Oe!=="no_password"?Oe:void 0,refreshToken:xe[2]?.trim()||"",clientId:Ee,clientSecret:Qe,idp:st,groupId:te}}).filter(re=>re.email&&re.refreshToken);if(z.length===0){alert("未找到有效的卡密数据(格式:邮箱----密码----RefreshToken----ClientId----ClientSecret)");return}const X=o(z);alert(`卡密导入完成:成功 ${X.success} 个,失败 ${X.failed} 个(分组:${Y})`)}else{const z=pe.map(re=>{const xe=re.includes("|")?re.split("|"):re.split(",");return{email:xe[0]?.trim()||"",refreshToken:xe[1]?.trim()||"",nickname:xe[2]?.trim()||void 0,idp:xe[3]?.trim()||"Google",groupId:te}}).filter(re=>re.email&&re.refreshToken);if(z.length===0){alert("未找到有效的账号数据(格式:邮箱,RefreshToken 或 卡密格式:邮箱----密码----Token----ID----Secret)");return}const X=o(z);alert(`导入完成:成功 ${X.success} 个,失败 ${X.failed} 个(分组:${Y})`)}}else alert(`不支持的文件格式:${fe}`)}catch(pe){console.error("Import error:",pe),alert("解析导入文件失败")}},be=()=>{N(!0)},K=()=>{T(!0)},se=te=>{b(te)};return s?e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsxs("div",{className:"flex flex-col items-center gap-4",children:[e.jsx(bt,{className:"h-8 w-8 animate-spin text-primary"}),e.jsx("p",{className:"text-muted-foreground",children:"加载账号数据..."})]})}):e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("header",{className:"relative z-20 flex items-center justify-between gap-4 px-3 py-3 glass-toolbar",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[n&&e.jsx(D,{variant:"ghost",size:"icon",onClick:n,children:e.jsx(r3,{className:"h-5 w-5"})}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10",children:e.jsx(Fn,{className:"h-5 w-5 text-primary"})}),e.jsx("h1",{className:"text-lg font-semibold text-primary",children:U?"Accounts":"账户管理"})]})]}),e.jsx(rI,{onAddAccount:()=>p(!0),onImport:B,onExport:V,viewMode:M,onViewModeChange:G,onManageGroups:be,onManageTags:K,isFilterExpanded:R,onToggleFilter:()=>I(!R)})]}),e.jsx("div",{className:"flex-1 overflow-hidden flex flex-col px-3 py-3 gap-3",children:e.jsx("div",{className:"flex-1 overflow-hidden",children:M==="grid"?e.jsx(BE,{onAddAccount:()=>p(!0),onEditAccount:se}):e.jsx(ZE,{onAddAccount:()=>p(!0),onEditAccount:se})})}),e.jsx(iI,{isOpen:f,onClose:()=>p(!1)}),e.jsx(lI,{open:!!y,onOpenChange:te=>!te&&b(null),account:y}),e.jsx(oI,{isOpen:v,onClose:()=>N(!1)}),e.jsx(cI,{isOpen:j,onClose:()=>T(!1)}),e.jsx(tw,{open:S,onClose:()=>k(!1),accounts:q(),selectedCount:d.size})]})}const Ac="data:image/svg+xml,%3csvg%20width='96'%20height='96'%20viewBox='0%200%2096%2096'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%20role='img'%20aria-label='Krouter'%3e%3crect%20x='8'%20y='8'%20width='80'%20height='80'%20rx='22'%20fill='%230B1220'/%3e%3cpath%20d='M28%2068V28h10v16.8L54.2%2028H67L49.8%2045.5%2068.5%2068H55.4L42.9%2052.7%2038%2057.7V68H28Z'%20fill='%23FFFFFF'/%3e%3cpath%20d='M63%2028h5v5h-5v-5Z'%20fill='%2322C55E'/%3e%3cpath%20d='M69%2034h5v5h-5v-5Z'%20fill='%2338BDF8'/%3e%3cpath%20d='M63%2040h5v5h-5v-5Z'%20fill='%23F59E0B'/%3e%3cpath%20d='M62.5%2032.5%2049.5%2045.5M68.5%2036.5%2052%2052M62.5%2042.5%2055.5%2056'%20stroke='%2394A3B8'%20stroke-width='2'%20stroke-linecap='round'/%3e%3ccircle%20cx='48'%20cy='48'%20r='5'%20fill='%2338BDF8'/%3e%3c/svg%3e",oa="Krouter",ej="LightHaru",Df="https://github.com/LightHaru/Krouter",sw="Kiro account routing, quota balancing, and API proxy control from one web dashboard.",nw="Dashboard web cho tai khoan Kiro, can bang quota va Kiro API proxy.",uI=[{id:"home",labelKey:"nav.home",icon:pA},{id:"accounts",labelKey:"nav.accounts",icon:Fn},{id:"machineId",labelKey:"nav.machineId",icon:eo},{id:"kiroSettings",labelKey:"nav.kiroSettings",icon:Hi},{id:"proxy",labelKey:"nav.proxy",icon:Sc},{id:"kproxy",labelKey:"nav.kproxy",icon:Vn},{id:"proxyPool",labelKey:"nav.proxyPool",icon:Ki},{id:"register",labelKey:"nav.register",icon:zu},{id:"subscription",labelKey:"nav.subscription",icon:$a},{id:"webhooks",labelKey:"nav.webhooks",icon:wp},{id:"diagnose",labelKey:"nav.diagnose",icon:vx},{id:"configSync",labelKey:"nav.configSync",icon:ON},{id:"logs",labelKey:"nav.logs",icon:iM},{id:"settings",labelKey:"nav.settings",icon:Tp},{id:"about",labelKey:"nav.about",icon:Va}];function hI({currentPage:n,onPageChange:s,collapsed:r,onToggleCollapse:i}){const{t:o}=Ut(),[d,u]=g.useState(!1);g.useEffect(()=>{const f=window.matchMedia("(max-width: 767px)"),p=()=>u(f.matches);return p(),f.addEventListener("change",p),()=>f.removeEventListener("change",p)},[]);const h=r||d;return e.jsxs(za.aside,{initial:!1,animate:{width:d?"100%":r?64:224,height:d?64:"auto"},transition:{type:"spring",stiffness:320,damping:30},className:me("glass-sidebar flex overflow-hidden shrink-0",d?"rounded-2xl flex-row":"rounded-3xl flex-col"),children:[e.jsx("div",{className:me("flex items-center justify-center gap-2 overflow-hidden border-white/10 dark:border-white/5",d?"h-full w-14 px-2 border-r":"h-14 px-3 border-b"),children:e.jsx(fc,{mode:"wait",initial:!1,children:h?e.jsx(za.img,{src:Ac,alt:oa,initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{duration:.2},className:"h-10 w-10 object-contain"},"logo-small"):e.jsxs(za.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},exit:{opacity:0,x:-10},transition:{duration:.2},className:"flex items-center gap-2",children:[e.jsx("img",{src:Ac,alt:oa,className:"h-7 w-auto shrink-0"}),e.jsx("span",{className:"font-semibold text-foreground whitespace-nowrap text-sm",children:oa})]},"logo-full")})}),e.jsx("nav",{className:me("flex-1 overflow-auto",d?"h-full py-2 px-1 flex items-center gap-1 overflow-y-hidden":"py-3 px-2 space-y-1 overflow-y-auto"),children:uI.map(f=>{const p=f.icon,y=n===f.id,b=o(f.labelKey);return e.jsxs("button",{onClick:()=>s(f.id),className:me("group relative w-full flex items-center rounded-xl text-sm font-medium transition-all overflow-hidden focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/50",y?"text-primary-foreground shadow-[0_4px_16px_rgba(91,140,255,0.35)]":"text-muted-foreground hover:text-foreground hover:bg-white/40 dark:hover:bg-white/5",d?"w-10 h-10 justify-center p-2.5 shrink-0":h?"justify-center p-2.5":"gap-3 px-3 py-2.5"),title:h?b:void 0,children:[y&&e.jsx(za.span,{layoutId:"sidebar-active-pill",className:"absolute inset-0 rounded-xl",style:{background:"linear-gradient(135deg, var(--gradient-from), var(--gradient-to))"},transition:{type:"spring",stiffness:380,damping:32}}),e.jsx(p,{className:me("h-5 w-5 shrink-0 relative z-10",y?"text-white":"")}),e.jsx(fc,{initial:!1,children:!h&&e.jsx(za.span,{initial:{opacity:0,x:-8},animate:{opacity:1,x:0},exit:{opacity:0,x:-8},transition:{duration:.15},className:me("whitespace-nowrap relative z-10",y&&"text-white"),children:b},"label")})]},f.id)})}),!d&&e.jsx("div",{className:"p-2 border-t border-white/10 dark:border-white/5",children:e.jsxs("button",{onClick:i,className:"group w-full flex items-center justify-center gap-2 px-3 py-2 rounded-xl text-sm text-muted-foreground hover:text-primary hover:bg-white/40 dark:hover:bg-white/5 transition-all overflow-hidden focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/50",title:r?"Mo rong thanh ben":"Thu gon thanh ben",children:[e.jsx(za.div,{animate:{rotate:r?0:180},transition:{duration:.3,ease:[.4,0,.2,1]},className:"shrink-0",children:e.jsx(BN,{className:"h-4 w-4"})}),e.jsx(fc,{initial:!1,children:!r&&e.jsx(za.span,{initial:{opacity:0,width:0},animate:{opacity:1,width:"auto"},exit:{opacity:0,width:0},transition:{duration:.15},className:"whitespace-nowrap overflow-hidden",children:"Thu gon"},"collapse-label")})]})})]})}const aw="kiro-task-history",mI=200;function Ll(n){try{const s=Array.from(n.values()).filter(r=>r.status!=="running"&&r.status!=="paused").sort((r,i)=>i.updatedAt-r.updatedAt).slice(0,mI).map(({onCancel:r,onPause:i,onResume:o,...d})=>d);localStorage.setItem(aw,JSON.stringify(s))}catch{}}function fI(){try{const n=localStorage.getItem(aw);if(!n)return new Map;const s=JSON.parse(n),r=new Map;for(const i of s){const o=i.status==="running"||i.status==="paused"?"cancelled":i.status;r.set(i.id,{...i,status:o})}return r}catch{return new Map}}const Vs=jx()((n,s)=>({tasks:fI(),createTask:r=>{const i=r.fixedId||Oi(),o=Date.now(),d={id:i,kind:r.kind,title:r.title,subtitle:r.subtitle,status:r.status??"running",progress:r.progress??0,done:r.done??0,total:r.total,successCount:r.successCount??0,failedCount:r.failedCount??0,lastMessage:r.lastMessage,error:r.error,onCancel:r.onCancel,onPause:r.onPause,onResume:r.onResume,createdAt:o,updatedAt:o};return n(u=>{const h=new Map(u.tasks);return h.set(i,d),{tasks:h}}),i},updateTask:(r,i)=>{n(o=>{const d=new Map(o.tasks),u=d.get(r);return u?(d.set(r,{...u,...i,updatedAt:Date.now()}),{tasks:d}):o})},completeTask:(r,i)=>{n(o=>{const d=new Map(o.tasks),u=d.get(r);if(!u)return o;const h=i?.successCount??u.successCount,f=i?.failedCount??u.failedCount,p=i?.error||f>0&&h===0?"failed":"success";return d.set(r,{...u,status:p,progress:100,successCount:h,failedCount:f,error:i?.error,finishedAt:Date.now(),updatedAt:Date.now()}),{tasks:d}}),Ll(s().tasks)},failTask:(r,i)=>{n(o=>{const d=new Map(o.tasks),u=d.get(r);return u?(d.set(r,{...u,status:"failed",error:i,finishedAt:Date.now(),updatedAt:Date.now()}),{tasks:d}):o}),Ll(s().tasks)},cancelTask:r=>{const i=s().tasks.get(r);try{i?.onCancel?.()}catch{}n(o=>{const d=new Map(o.tasks),u=d.get(r);return u?(d.set(r,{...u,status:"cancelled",finishedAt:Date.now(),updatedAt:Date.now()}),{tasks:d}):o}),Ll(s().tasks)},removeTask:r=>{n(i=>{const o=new Map(i.tasks);return o.delete(r),{tasks:o}}),Ll(s().tasks)},clearFinished:()=>{n(r=>{const i=new Map;for(const[o,d]of r.tasks)(d.status==="running"||d.status==="paused")&&i.set(o,d);return{tasks:i}}),Ll(s().tasks)},clearAll:()=>{n({tasks:new Map}),Ll(s().tasks)},getActiveCount:()=>{let r=0;for(const i of s().tasks.values())(i.status==="running"||i.status==="paused")&&r++;return r}})),pI={"register-batch":zu,"subscription-batch":$a,"overage-batch":Ds,"proxy-validation":Ki,"token-refresh":Mt,"account-check":Mt,other:qu};function xI(){const{t:n}=Ut(),s=n("common.unknown")==="Unknown",[r,i]=g.useState(!1),o=Vs(p=>p.tasks),{activeCount:d,finishedCount:u,hasFailure:h,totalProgress:f}=g.useMemo(()=>{let p=0,y=0,b=!1,v=0,N=0;for(const j of o.values())j.status==="running"||j.status==="paused"?(p++,v+=j.done,N+=j.total):(y++,j.status==="failed"&&(b=!0));return{activeCount:p,finishedCount:y,hasFailure:b,totalProgress:N>0?Math.round(v/N*100):0}},[o]);return o.size===0?null:e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:()=>i(!0),title:s?"Task Center":"任务中心",className:me("flex items-center gap-1.5 px-2 h-6 rounded-md text-xs transition-colors","hover:bg-foreground/10",d>0?"text-primary":h?"text-red-500":"text-muted-foreground"),style:{WebkitAppRegion:"no-drag"},children:[d>0?e.jsx(bt,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(Ks,{className:"h-3.5 w-3.5"}),d>0&&e.jsx("span",{className:"tabular-nums font-medium",children:d}),d>0&&f>0&&e.jsxs("span",{className:"opacity-60 tabular-nums",children:[f,"%"]}),d===0&&u>0&&e.jsx("span",{className:"tabular-nums opacity-60",children:u})]}),e.jsx(gI,{open:r,onClose:()=>i(!1)})]})}function gI({open:n,onClose:s}){const{t:r}=Ut(),i=r("common.unknown")==="Unknown",o=Vs(b=>b.tasks),d=Vs(b=>b.cancelTask),u=Vs(b=>b.removeTask),h=Vs(b=>b.clearFinished),f=()=>{const b=Array.from(o.values()).filter(v=>v.status==="running"||v.status==="paused");if(b.length!==0&&confirm(i?`Cancel ${b.length} running task(s)?`:`取消正在进行的 ${b.length} 个任务?`))for(const v of b)d(v.id)},p=Array.from(o.values()).filter(b=>b.status==="running"||b.status==="paused").length,y=g.useMemo(()=>Array.from(o.values()).sort((b,v)=>{const N=b.status==="running"||b.status==="paused",j=v.status==="running"||v.status==="paused";return N!==j?N?-1:1:v.updatedAt-b.updatedAt}),[o]);return Tn.createPortal(e.jsx(fc,{children:n&&e.jsxs("div",{style:{WebkitAppRegion:"no-drag"},children:[e.jsx(za.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:"fixed inset-0 z-[9998] bg-black/30 backdrop-blur-sm",onClick:s}),e.jsxs(za.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",stiffness:300,damping:30},className:"fixed right-0 top-0 bottom-0 z-[9999] w-[420px] bg-background border-l shadow-2xl flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ks,{className:"h-4 w-4 text-primary"}),e.jsx("h2",{className:"text-sm font-semibold",children:i?"Task Center":"任务中心"}),e.jsx($e,{variant:"secondary",className:"h-5 text-[10px] tabular-nums",children:y.length})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[p>0&&e.jsxs(D,{variant:"ghost",size:"sm",onClick:f,className:"text-destructive hover:text-destructive",title:i?`Cancel all ${p} running tasks`:`取消所有 ${p} 个正在进行的任务`,children:[e.jsx(fs,{className:"h-3.5 w-3.5 mr-1"}),i?"Cancel all":"全部取消"]}),e.jsxs(D,{variant:"ghost",size:"sm",onClick:h,children:[e.jsx(Vt,{className:"h-3.5 w-3.5 mr-1"}),i?"Clear finished":"清理已完成"]}),e.jsx("button",{onClick:s,className:"p-1.5 rounded-md hover:bg-muted",children:e.jsx(ns,{className:"h-4 w-4"})})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:y.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-muted-foreground py-12",children:[e.jsx(qu,{className:"h-10 w-10 opacity-30 mb-3"}),e.jsx("p",{className:"text-sm",children:i?"No tasks":"暂无任务"})]}):e.jsx("div",{className:"divide-y",children:y.map(b=>e.jsx(yI,{task:b,onCancel:()=>d(b.id),onRemove:()=>u(b.id)},b.id))})})]})]})}),document.body)}function yI({task:n,onCancel:s,onRemove:r}){const{t:i}=Ut(),o=i("common.unknown")==="Unknown",d=pI[n.kind]||qu,u=n.status==="running"||n.status==="paused",h=(n.finishedAt||Date.now())-n.createdAt,f=(()=>{switch(n.status){case"running":return e.jsx($e,{className:"bg-primary text-primary-foreground",children:o?"Running":"运行中"});case"paused":return e.jsx($e,{variant:"outline",className:"text-amber-600 border-amber-200",children:o?"Paused":"已暂停"});case"success":return e.jsx($e,{variant:"outline",className:"text-green-600 border-green-200",children:o?"Done":"已完成"});case"failed":return e.jsx($e,{variant:"outline",className:"text-red-600 border-red-200",children:o?"Failed":"失败"});case"cancelled":return e.jsx($e,{variant:"outline",className:"text-muted-foreground",children:o?"Cancelled":"已取消"})}})();return e.jsx("div",{className:"p-3 hover:bg-muted/30 transition-colors",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:me("p-1.5 rounded-md flex-shrink-0",n.status==="success"&&"bg-green-500/15 text-green-600",n.status==="failed"&&"bg-red-500/15 text-red-600",n.status==="cancelled"&&"bg-muted text-muted-foreground",u&&"bg-primary/15 text-primary"),children:n.status==="running"?e.jsx(bt,{className:"h-3.5 w-3.5 animate-spin"}):n.status==="success"?e.jsx(an,{className:"h-3.5 w-3.5"}):n.status==="failed"?e.jsx(fs,{className:"h-3.5 w-3.5"}):n.status==="paused"?e.jsx(Cp,{className:"h-3.5 w-3.5"}):e.jsx(d,{className:"h-3.5 w-3.5"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("p",{className:"text-xs font-medium truncate",title:n.title,children:n.title}),f]}),n.subtitle&&e.jsx("p",{className:"text-[10px] text-muted-foreground truncate mt-0.5",title:n.subtitle,children:n.subtitle}),(n.total>0||u)&&e.jsxs("div",{className:"mt-2 space-y-1",children:[e.jsx("div",{className:"h-1.5 bg-muted rounded-full overflow-hidden",children:e.jsx("div",{className:me("h-full transition-all",n.status==="failed"&&"bg-red-500",n.status==="success"&&"bg-green-500",u&&"bg-primary",n.status==="cancelled"&&"bg-muted-foreground"),style:{width:`${n.progress}%`}})}),e.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground tabular-nums",children:[e.jsxs("span",{children:[n.done,"/",n.total,n.successCount>0&&e.jsxs("span",{className:"text-green-600 ml-1.5",children:["✓",n.successCount]}),n.failedCount>0&&e.jsxs("span",{className:"text-red-500 ml-1",children:["✗",n.failedCount]})]}),e.jsx("span",{children:bI(h)})]})]}),n.error&&e.jsxs("div",{className:"mt-2 flex items-start gap-1.5 text-[10px] text-red-500",children:[e.jsx(Rs,{className:"h-3 w-3 flex-shrink-0 mt-0.5"}),e.jsx("span",{className:"break-all",children:n.error})]}),n.lastMessage&&!n.error&&e.jsx("p",{className:"text-[10px] text-muted-foreground mt-1 truncate",title:n.lastMessage,children:n.lastMessage}),e.jsxs("div",{className:"mt-2 flex items-center gap-1",children:[n.status==="running"&&n.onPause&&e.jsxs(D,{size:"sm",variant:"ghost",className:"h-6 text-[10px]",onClick:n.onPause,children:[e.jsx(Cp,{className:"h-3 w-3 mr-1"})," ",o?"Pause":"暂停"]}),n.status==="paused"&&n.onResume&&e.jsxs(D,{size:"sm",variant:"ghost",className:"h-6 text-[10px]",onClick:n.onResume,children:[e.jsx(Ba,{className:"h-3 w-3 mr-1"})," ",o?"Resume":"恢复"]}),u&&e.jsxs(D,{size:"sm",variant:"ghost",className:"h-6 text-[10px] text-destructive hover:text-destructive",onClick:s,children:[e.jsx(fs,{className:"h-3 w-3 mr-1"})," ",o?"Cancel":"取消"]}),!u&&e.jsxs(D,{size:"sm",variant:"ghost",className:"h-6 text-[10px]",onClick:r,children:[e.jsx(Vt,{className:"h-3 w-3 mr-1"})," ",o?"Remove":"移除"]})]})]})]})})}function bI(n){if(n<1e3)return`${n}ms`;const s=Math.floor(n/1e3);if(s<60)return`${s}s`;const r=Math.floor(s/60);return r<60?`${r}m ${s%60}s`:`${Math.floor(r/60)}h ${r%60}m`}function vI(){Ut();const[n,s]=g.useState("win32"),[r,i]=g.useState(!1),[o,d]=g.useState("");g.useEffect(()=>{let h;return(async()=>{try{const p=await window.api.window.getPlatform();s(p);const y=await window.api.window.isMaximized();i(y)}catch(p){console.warn("[TitleBar] init failed",p)}h=window.api.window.onMaximizeChange(p=>i(p))})(),window.api.getAppVersion().then(d).catch(()=>{}),()=>h?.()},[]);const u=n==="darwin";return e.jsxs("div",{className:me("flex items-center h-8 w-full select-none flex-shrink-0","bg-[var(--titlebar-bg)] text-foreground/80","border-b border-foreground/5"),style:{WebkitAppRegion:"drag",paddingLeft:u?80:12,paddingRight:u?12:0},children:[e.jsxs("div",{className:me("flex items-center gap-2 text-xs",u?"flex-1 justify-center":"flex-1"),children:[!u&&e.jsx("img",{src:Ac,alt:"",className:"h-4 w-4 opacity-90",onError:h=>h.target.style.display="none"}),e.jsxs("span",{className:"font-medium tracking-wide text-foreground/70",children:[oa,o&&` v${o}`]})]}),e.jsx("div",{className:"flex items-center gap-1 px-2",style:{WebkitAppRegion:"no-drag"},children:e.jsx(xI,{})}),!u&&e.jsxs("div",{className:"flex items-stretch h-full",style:{WebkitAppRegion:"no-drag"},children:[e.jsx(Pf,{onClick:()=>window.api.window.minimize(),title:"Thu nhỏ",children:e.jsx(wc,{className:"h-3.5 w-3.5",strokeWidth:2})}),e.jsx(Pf,{onClick:()=>window.api.window.maximizeToggle(),title:r?"Khôi phục":"Phóng to",children:r?e.jsx(As,{className:"h-3 w-3",strokeWidth:2}):e.jsx(Cn,{className:"h-3 w-3",strokeWidth:2})}),e.jsx(Pf,{onClick:()=>window.api.window.close(),title:"Đóng",variant:"close",children:e.jsx(ns,{className:"h-3.5 w-3.5",strokeWidth:2})})]})]})}function Pf({onClick:n,title:s,variant:r="default",children:i}){return e.jsx("button",{type:"button",onClick:n,title:s,className:me("flex items-center justify-center w-12 h-full text-foreground/70 transition-colors","hover:text-foreground",r==="close"?"hover:bg-red-500 hover:text-white":"hover:bg-foreground/10"),children:i})}const rw="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzYwIiBoZWlnaHQ9Ijk2IiB2aWV3Qm94PSIwIDAgMzYwIDk2IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHJvbGU9ImltZyIgYXJpYS1sYWJlbD0iS3JvdXRlciI+CiAgPHJlY3QgeD0iOCIgeT0iOCIgd2lkdGg9IjgwIiBoZWlnaHQ9IjgwIiByeD0iMjIiIGZpbGw9IiMwQjEyMjAiLz4KICA8cGF0aCBkPSJNMjggNjhWMjhoMTB2MTYuOEw1NC4yIDI4SDY3TDQ5LjggNDUuNSA2OC41IDY4SDU1LjRMNDIuOSA1Mi43IDM4IDU3LjdWNjhIMjhaIiBmaWxsPSIjRkZGRkZGIi8+CiAgPHBhdGggZD0iTTYzIDI4aDV2NWgtNXYtNVoiIGZpbGw9IiMyMkM1NUUiLz4KICA8cGF0aCBkPSJNNjkgMzRoNXY1aC01di01WiIgZmlsbD0iIzM4QkRGOCIvPgogIDxwYXRoIGQ9Ik02MyA0MGg1djVoLTV2LTVaIiBmaWxsPSIjRjU5RTBCIi8+CiAgPHBhdGggZD0iTTYyLjUgMzIuNSA0OS41IDQ1LjVNNjguNSAzNi41IDUyIDUyTTYyLjUgNDIuNSA1NS41IDU2IiBzdHJva2U9IiM5NEEzQjgiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+CiAgPGNpcmNsZSBjeD0iNDgiIGN5PSI0OCIgcj0iNSIgZmlsbD0iIzM4QkRGOCIvPgogIDx0ZXh0IHg9IjEwOCIgeT0iNTciIGZpbGw9IiMxMTE4MjciIGZvbnQtZmFtaWx5PSJJbnRlciwgU2Vnb2UgVUksIEFyaWFsLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjM4IiBmb250LXdlaWdodD0iODAwIj5Lcm91dGVyPC90ZXh0PgogIDx0ZXh0IHg9IjExMCIgeT0iNzYiIGZpbGw9IiM2NDc0OEIiIGZvbnQtZmFtaWx5PSJJbnRlciwgU2Vnb2UgVUksIEFyaWFsLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE0IiBmb250LXdlaWdodD0iNjAwIj5LaXJvIHF1b3RhIHJvdXRlcjwvdGV4dD4KPC9zdmc+Cg==",jI=(n,s)=>{const r=(s||n).toUpperCase();return r.includes("PRO+")||r.includes("PRO_PLUS")||r.includes("PROPLUS")?"bg-purple-500":r.includes("POWER")?"bg-amber-500":r.includes("PRO")?"bg-blue-500":"bg-gray-500"};function tj(){const{accounts:n,activeAccountId:s,getStats:r,darkMode:i,usagePrecision:o}=vt(),{t:d}=Ut(),u=r(),h=g.useMemo(()=>{let b=0,v=0,N=0;Array.from(n.values()).forEach(S=>{if(S.status==="active"&&S.usage){const k=S.usage.limit??0,R=S.usage.current??0;k>0&&(b+=k,v+=R,N++)}});const j=b-v,T=b>0?v/b*100:0;return{totalLimit:b,totalUsed:v,remaining:j,percentUsed:T,validAccountCount:N}},[n]),f=d("common.unknown")==="Unknown",p=[{label:f?"Total Accounts":"总账号数",value:u.total,icon:Fn,color:"text-blue-500",bgColor:"bg-blue-500/10"},{label:f?"Active":"正常账号",value:u.byStatus?.active||0,icon:Bn,color:"text-green-500",bgColor:"bg-green-500/10"},{label:f?"Banned":"已封禁",value:u.byStatus?.error||0,icon:Rs,color:"text-red-500",bgColor:"bg-red-500/10"},{label:f?"Expiring Soon":"即将过期",value:u.expiringSoonCount,icon:Gn,color:"text-amber-500",bgColor:"bg-amber-500/10"}],y=g.useMemo(()=>s?n.get(s)??null:null,[n,s]);return e.jsxs("div",{className:"flex-1 p-4 md:p-6 space-y-5 md:space-y-6 overflow-auto",children:[e.jsxs("div",{className:"page-hero p-5 md:p-6",children:[e.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-primary/20 to-transparent rounded-full blur-2xl"}),e.jsx("div",{className:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-primary/20 to-transparent rounded-full blur-2xl"}),e.jsxs("div",{className:"relative flex flex-col sm:flex-row sm:items-center gap-4",children:[e.jsx("img",{src:rw,alt:oa,className:me("h-14 sm:h-16 w-auto max-w-full transition-all",i&&"brightness-110")}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold text-primary",children:oa}),e.jsx("p",{className:"text-sm sm:text-base text-muted-foreground max-w-2xl",children:f?sw:nw})]})]})]}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:p.map(b=>{const v=b.icon;return e.jsx(De,{className:"hover-lift",children:e.jsx(Pe,{className:"p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`p-2.5 rounded-xl ${b.bgColor}`,children:e.jsx(v,{className:`h-5 w-5 ${b.color}`})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:b.value}),e.jsx("p",{className:"text-xs text-muted-foreground",children:b.label})]})]})})},b.label)})}),h.validAccountCount>0&&e.jsxs(De,{className:"hover-lift",children:[e.jsx(at,{className:"pb-2",children:e.jsxs(rt,{className:"text-base flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10",children:e.jsx(Lu,{className:"h-4 w-4 text-primary"})}),f?"Usage Stats":"额度统计",e.jsxs("span",{className:"text-xs font-normal text-muted-foreground",children:["(",f?`Based on ${h.validAccountCount} valid accounts`:`基于 ${h.validAccountCount} 个有效账号`,")"]})]})}),e.jsxs(Pe,{children:[e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-4",children:[e.jsxs("div",{className:"p-3 bg-muted rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(WN,{className:"h-4 w-4 text-blue-500"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:f?"Total":"总额度"})]}),e.jsx("p",{className:"text-xl font-bold",children:h.totalLimit.toLocaleString()})]}),e.jsxs("div",{className:"p-3 bg-muted rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(Ks,{className:"h-4 w-4 text-orange-500"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:f?"Used":"已使用"})]}),e.jsx("p",{className:"text-xl font-bold",children:h.totalUsed.toLocaleString()})]}),e.jsxs("div",{className:"p-3 bg-muted rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(Ds,{className:"h-4 w-4 text-green-500"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:f?"Remaining":"剩余额度"})]}),e.jsx("p",{className:"text-xl font-bold text-green-600",children:h.remaining.toLocaleString()})]}),e.jsxs("div",{className:"p-3 bg-muted rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(Lu,{className:"h-4 w-4 text-purple-500"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:f?"Usage %":"使用率"})]}),e.jsxs("p",{className:"text-xl font-bold",children:[h.percentUsed.toFixed(o?2:1),"%"]})]})]}),(()=>{const b=h.percentUsed>100,v=b?h.percentUsed-100:0,N=b?Math.abs(h.remaining):0,j=b?Math.min(v/h.percentUsed*100,60):0,T=o?2:1;return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between items-center text-xs",children:[e.jsx("span",{className:"text-muted-foreground",children:f?"Overall Progress":"总体使用进度"}),e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-muted-foreground",children:[h.totalUsed.toLocaleString(void 0,{maximumFractionDigits:2})," / ",h.totalLimit.toLocaleString()]}),e.jsxs("span",{className:me("font-bold px-2 py-0.5 rounded-md",b&&"bg-red-500/15 text-red-600 dark:text-red-400",!b&&h.percentUsed>=80&&"bg-orange-500/15 text-orange-600 dark:text-orange-400",!b&&h.percentUsed>=50&&h.percentUsed<80&&"bg-yellow-500/15 text-yellow-600 dark:text-yellow-400",!b&&h.percentUsed<50&&"bg-green-500/15 text-green-600 dark:text-green-400"),children:[h.percentUsed.toFixed(T),"%"]})]})]}),e.jsxs("div",{className:"relative h-3 bg-muted rounded-full overflow-hidden",children:[e.jsx("div",{className:me("absolute inset-y-0 left-0 transition-all",b&&"bg-red-500",!b&&h.percentUsed>=80&&"bg-orange-500",!b&&h.percentUsed>=50&&h.percentUsed<80&&"bg-yellow-500",!b&&h.percentUsed<50&&"bg-green-500"),style:{width:`${Math.min(h.percentUsed,100)}%`}}),b&&e.jsx("div",{className:"absolute inset-y-0 right-0 bg-gradient-to-r from-red-600 via-red-700 to-red-800 animate-pulse",style:{width:`${j}%`,backgroundImage:"repeating-linear-gradient(45deg, rgba(255,255,255,0.15) 0, rgba(255,255,255,0.15) 8px, transparent 8px, transparent 16px)",backgroundSize:"22px 22px"}})]}),b&&e.jsxs("div",{className:"flex items-center justify-between gap-3 mt-2 px-3 py-2 rounded-lg bg-red-500/10 border border-red-500/30",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx(Rs,{className:"h-3.5 w-3.5 text-red-500 shrink-0"}),e.jsx("span",{className:"font-bold text-red-600 dark:text-red-400",children:f?"Over Quota":"已超额"}),e.jsxs("span",{className:"px-1.5 py-0.5 rounded bg-red-500/20 text-red-600 dark:text-red-400 font-bold",children:["+",v.toFixed(T),"%"]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[e.jsx("span",{className:"text-muted-foreground",children:f?"Excess: ":"超额积分:"}),e.jsx("span",{className:"font-bold text-red-600 dark:text-red-400",children:N.toLocaleString(void 0,{maximumFractionDigits:2})})]})]})]})})()]})]}),y&&e.jsxs(De,{className:"hover-lift bg-gradient-to-r from-primary/5 to-primary/10",children:[e.jsx(at,{className:"pb-2",children:e.jsxs(rt,{className:"text-base flex items-center gap-2",children:[e.jsx(Ds,{className:"h-4 w-4 text-primary"}),f?"Current Account":"当前使用账号"]})}),e.jsxs(Pe,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-primary/20 flex items-center justify-center text-primary font-bold",children:(y.nickname||y.email||"?")[0].toUpperCase()}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:y.nickname||y.email}),e.jsx("p",{className:"text-sm text-muted-foreground",children:y.email})]})]}),e.jsx("div",{className:"text-right",children:e.jsx("span",{className:me("inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium text-white",jI(y.subscription?.type||"Free",y.subscription?.title)),children:y.subscription?.title||y.subscription?.type||"Free"})})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 pt-2 border-t",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:f?"Monthly Usage":"本月用量"}),e.jsxs("p",{className:"text-sm font-medium",children:[y.usage?.current||0," / ",y.usage?.limit||0]}),e.jsx("div",{className:"h-1.5 bg-muted rounded-full overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full transition-all ${(y.usage?.percentUsed||0)>.8?"bg-red-500":(y.usage?.percentUsed||0)>.5?"bg-amber-500":"bg-green-500"}`,style:{width:`${Math.min((y.usage?.percentUsed||0)*100,100)}%`}})})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:f?"Subscription":"订阅剩余"}),e.jsx("p",{className:"text-sm font-medium",children:y.subscription?.daysRemaining!=null?f?`${y.subscription.daysRemaining} days`:`${y.subscription.daysRemaining} 天`:f?"Permanent":"永久"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:f?"Token Status":"Token 状态"}),(()=>{const b=y.credentials?.expiresAt;if(!b)return e.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:f?"Unknown":"未知"});const v=Date.now(),N=b-v;if(N<=0)return e.jsx("p",{className:"text-sm font-medium text-red-500",children:f?"Expired":"已过期"});const j=Math.floor(N/6e4);if(j<60)return e.jsx("p",{className:"text-sm font-medium text-amber-500",children:f?`${j} min`:`${j} 分钟`});const T=Math.floor(j/60);return e.jsx("p",{className:"text-sm font-medium text-green-500",children:f?`${T} hours`:`${T} 小时`})})()]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:f?"Auth Method":"登录方式"}),e.jsx("p",{className:"text-sm font-medium",children:y.credentials?.authMethod==="social"?y.credentials?.provider||"Social":"Builder ID"})]})]}),e.jsxs("div",{className:"pt-3 border-t space-y-2",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:f?"Subscription Details":"订阅详情"}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-muted-foreground",children:f?"Type:":"订阅类型:"}),e.jsx("span",{className:"font-medium",children:y.subscription?.title||y.subscription?.type||"Free"})]}),y.subscription?.rawType&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-muted-foreground",children:f?"Raw Type:":"原始类型:"}),e.jsx("span",{className:"font-mono text-[10px]",children:y.subscription.rawType})]}),y.subscription?.expiresAt&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-muted-foreground",children:f?"Expires:":"到期时间:"}),e.jsx("span",{className:"font-medium",children:new Date(y.subscription.expiresAt).toLocaleDateString("zh-CN")})]}),y.subscription?.upgradeCapability&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-muted-foreground",children:f?"Upgradeable:":"可升级:"}),e.jsx("span",{className:"font-medium",children:y.subscription.upgradeCapability})]}),y.subscription?.overageCapability&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-muted-foreground",children:f?"Overage:":"超额能力:"}),e.jsx("span",{className:"font-medium",children:y.subscription.overageCapability})]})]})]}),(y.usage?.baseLimit||y.usage?.freeTrialLimit||y.usage?.bonuses?.length)&&e.jsxs("div",{className:"pt-3 border-t space-y-2",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:f?"Quota Details":"额度明细"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:[y.usage?.baseLimit!==void 0&&y.usage.baseLimit>0&&e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-500"}),e.jsx("span",{className:"text-muted-foreground",children:f?"Base:":"基础额度:"}),e.jsxs("span",{className:"font-medium",children:[y.usage.baseCurrent??0," / ",y.usage.baseLimit]})]}),y.usage?.freeTrialLimit!==void 0&&y.usage.freeTrialLimit>0&&e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-purple-500"}),e.jsx("span",{className:"text-muted-foreground",children:f?"Trial:":"试用额度:"}),e.jsxs("span",{className:"font-medium",children:[y.usage.freeTrialCurrent??0," / ",y.usage.freeTrialLimit]}),y.usage.freeTrialExpiry&&e.jsxs("span",{className:"text-muted-foreground/70 text-[10px]",children:["(至 ",(()=>{const b=y.usage.freeTrialExpiry;try{return(typeof b=="string"?b:new Date(b).toISOString()).split("T")[0]}catch{return""}})(),")"]})]}),y.usage?.bonuses?.map(b=>e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-cyan-500"}),e.jsxs("span",{className:"text-muted-foreground truncate",children:[b.name,":"]}),e.jsxs("span",{className:"font-medium",children:[b.current," / ",b.limit]}),b.expiresAt&&e.jsxs("span",{className:"text-muted-foreground/70 text-[10px]",children:["(至 ",(()=>{const v=b.expiresAt;try{return(typeof v=="string"?v:new Date(v).toISOString()).split("T")[0]}catch{return""}})(),")"]})]},b.code))]})]}),e.jsxs("div",{className:"pt-3 border-t space-y-2",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:f?"Account Info":"账户信息"}),e.jsxs("div",{className:"space-y-1.5 text-xs",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-muted-foreground shrink-0",children:"User ID:"}),e.jsx("span",{className:"font-mono text-[10px] break-all select-all",children:y.userId})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-muted-foreground",children:"IDP:"}),e.jsx("span",{className:"font-medium",children:y.idp||"BuilderId"})]}),y.usage?.nextResetDate&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-muted-foreground",children:f?"Reset Date:":"重置日期:"}),e.jsx("span",{className:"font-medium",children:(()=>{const b=y.usage.nextResetDate;try{return(typeof b=="string"?b:new Date(b).toISOString()).split("T")[0]}catch{return f?"Unknown":"未知"}})()})]})]})]})]})]}),e.jsxs(De,{className:"hover-lift",children:[e.jsx(at,{className:"pb-2",children:e.jsxs(rt,{className:"text-base flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10",children:e.jsx(Vn,{className:"h-4 w-4 text-primary"})}),f?"Quick Tips":"快速提示"]})}),e.jsx(Pe,{children:e.jsxs("ul",{className:"space-y-2 text-sm text-muted-foreground",children:[e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-primary",children:"•"}),f?'Click "Accounts" to view and manage all accounts':"点击左侧「账户管理」可以查看和管理所有账号"]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-primary",children:"•"}),f?"Click power icon on account card to switch":"在账号卡片上点击电源图标可以快速切换账号"]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-primary",children:"•"}),f?"Tokens auto-refresh 5 minutes before expiry":"Token 会在过期前 5 分钟自动刷新,无需手动操作"]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-primary",children:"•"}),f?'Use "Privacy Mode" to hide sensitive info':"使用「隐私模式」可以隐藏邮箱和账号信息"]})]})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsx(De,{className:"hover-lift",children:e.jsx(Pe,{className:"p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10",children:e.jsx(eo,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:f?"Machine ID":"机器码管理"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:f?"Modify device ID, auto-switch, account binding":"修改设备标识符,切号时自动更换,支持账户绑定"})]})]})})}),e.jsx(De,{className:"hover-lift",children:e.jsx(Pe,{className:"p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10",children:e.jsx(Sp,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:f?"Groups":"分组管理"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:f?"Batch set groups for selected accounts":"多选账户后可批量设置分组,一键移动账号"})]})]})})}),e.jsx(De,{className:"hover-lift",children:e.jsx(Pe,{className:"p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10",children:e.jsx(Xl,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:f?"Tags":"标签管理"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:f?"Batch add/remove tags, multi-tag support":"多选账户后可批量添加/移除标签,支持多标签"})]})]})})})]})]})}function NI(){const[n,s]=g.useState("..."),[r,i]=g.useState(!1),[o,d]=g.useState(null),[u,h]=g.useState(!1),{t:f}=Ut(),p=f("common.unknown")==="Unknown";g.useEffect(()=>{window.api.getAppVersion().then(s).catch(()=>s("unknown"))},[]);const y=async()=>{i(!0);try{const T=await window.api.checkForUpdatesManual();d(T),h(!0)}catch(T){d({hasUpdate:!1,error:T instanceof Error?T.message:"Check update failed"}),h(!0)}finally{i(!1)}},b=T=>{T&&window.api.openExternal(T)},v=T=>T<1024?`${T} B`:T<1024*1024?`${(T/1024).toFixed(1)} KB`:`${(T/(1024*1024)).toFixed(1)} MB`,N=[{icon:nM,title:p?"Account router":"Router tai khoan",body:p?"Rotates requests across healthy Kiro accounts by model, quota, and runtime state.":"Xoay request qua cac tai khoan Kiro con khoe theo model, quota va trang thai runtime."},{icon:ii,title:p?"Client API keys":"Key cho client",body:p?"Creates OpenAI-compatible keys for OpenClaw, Aira, Codex, and other dev tools.":"Tao key tuong thich OpenAI cho OpenClaw, Aira, Codex va cac cong cu dev."},{icon:uM,title:"Backend runtime",body:p?"Keeps the proxy service alive from the backend/CLI instead of relying on a browser tab.":"Giu API proxy chay bang backend/CLI thay vi phu thuoc vao tab trinh duyet."},{icon:Ki,title:p?"Localhost or tunnel":"Localhost hoac tunnel",body:p?"Runs local-first and exposes the dashboard publicly only when a tunnel is enabled.":"Uu tien localhost va chi public dashboard khi bat tunnel."}],j=[{icon:UN,label:"OpenClaw / Aira",detail:p?"One client endpoint":"Mot endpoint client"},{icon:Ds,label:oa,detail:"Key, model, quota router"},{icon:Vn,label:p?"Kiro accounts":"Tai khoan Kiro",detail:"Health, quota, profile ARN"}];return e.jsxs("div",{className:"flex-1 overflow-auto p-4 space-y-4 md:p-6 md:space-y-6",children:[e.jsx("div",{className:"page-hero overflow-hidden p-5 md:p-8",children:e.jsxs("div",{className:"relative grid gap-6 lg:grid-cols-[minmax(0,1.15fr)_minmax(320px,0.85fr)] lg:items-center",children:[e.jsxs("div",{className:"min-w-0 space-y-5",children:[e.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center",children:[e.jsx("img",{src:rw,alt:oa,className:"h-16 w-auto max-w-full shrink-0 md:h-20"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-2xl font-bold text-primary md:text-3xl",children:oa}),e.jsx("p",{className:"mt-1 max-w-2xl text-sm text-muted-foreground md:text-base",children:p?sw:nw}),e.jsxs("p",{className:"mt-2 text-xs text-muted-foreground",children:[p?"Version":"Phien ban"," ",n," · ",ej]})]})]}),e.jsxs("div",{className:"grid gap-2 text-sm text-muted-foreground sm:grid-cols-3",children:[e.jsxs("div",{className:"rounded-xl border border-primary/10 bg-white/45 p-3 dark:bg-white/5",children:[e.jsx("p",{className:"font-semibold text-foreground",children:p?"Web dashboard":"Dashboard web"}),e.jsx("p",{className:"mt-1 text-xs",children:p?"Account control surface":"Noi quan ly tai khoan"})]}),e.jsxs("div",{className:"rounded-xl border border-primary/10 bg-white/45 p-3 dark:bg-white/5",children:[e.jsx("p",{className:"font-semibold text-foreground",children:"CLI runtime"}),e.jsx("p",{className:"mt-1 text-xs",children:p?"Setup and tunnel control":"Setup va tunnel"})]}),e.jsxs("div",{className:"rounded-xl border border-primary/10 bg-white/45 p-3 dark:bg-white/5",children:[e.jsx("p",{className:"font-semibold text-foreground",children:"OpenClaw"}),e.jsx("p",{className:"mt-1 text-xs",children:"provider: krouter"})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(D,{variant:"outline",size:"sm",className:"gap-2",onClick:y,disabled:r,children:[e.jsx(Mt,{className:me("h-4 w-4",r&&"animate-spin")}),r?p?"Checking...":"Dang kiem tra...":p?"Check updates":"Kiem tra cap nhat"]}),e.jsxs(D,{variant:"outline",size:"sm",className:"gap-2",onClick:()=>b(Df),children:[e.jsx(jf,{className:"h-4 w-4"}),"GitHub",e.jsx(Xs,{className:"h-3 w-3"})]})]})]}),e.jsxs("div",{className:"relative min-h-[260px] rounded-2xl border border-primary/10 bg-white/55 p-5 shadow-inner dark:bg-white/5",children:[e.jsx("div",{className:"absolute right-5 top-5 rounded-full bg-primary/10 p-3",children:e.jsx("img",{src:Ac,alt:oa,className:"h-12 w-12"})}),e.jsx("div",{className:"flex h-full flex-col justify-end gap-4 pt-20",children:j.map((T,S)=>{const k=T.icon;return e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-primary text-primary-foreground shadow-sm",children:e.jsx(k,{className:"h-5 w-5"})}),e.jsxs("div",{className:"min-w-0 flex-1 rounded-xl border border-primary/10 bg-background/70 px-3 py-2",children:[e.jsx("p",{className:"truncate text-sm font-semibold",children:T.label}),e.jsx("p",{className:"truncate text-xs text-muted-foreground",children:T.detail})]}),S<j.length-1&&e.jsx(Np,{className:"hidden h-4 w-4 text-primary md:block"})]},T.label)})})]})]})}),u&&o&&e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[e.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:()=>h(!1)}),e.jsx("div",{className:"relative z-10 max-h-[80vh] w-full max-w-md overflow-y-auto rounded-xl bg-card p-6 shadow-xl",children:o.hasUpdate?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"rounded-full bg-success/10 p-2",children:e.jsx(Ns,{className:"h-6 w-6 text-success"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:p?"New version available":"Co ban moi"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[o.currentVersion," -> ",o.latestVersion]})]})]}),o.releaseName&&e.jsxs("div",{className:"rounded-lg bg-muted/50 p-3",children:[e.jsx("p",{className:"text-sm font-medium",children:o.releaseName}),o.publishedAt&&e.jsx("p",{className:"text-xs text-muted-foreground",children:new Date(o.publishedAt).toLocaleDateString(p?"en-US":"vi-VN")})]}),o.releaseNotes&&e.jsx("div",{className:"max-h-32 overflow-y-auto whitespace-pre-wrap rounded-lg bg-muted/30 p-3 text-sm text-muted-foreground",children:o.releaseNotes}),o.assets&&o.assets.length>0&&e.jsx("div",{className:"space-y-1",children:o.assets.slice(0,6).map(T=>e.jsxs("div",{className:"flex items-center justify-between rounded bg-muted/30 px-2 py-1 text-xs",children:[e.jsx("span",{className:"truncate",children:T.name}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:v(T.size)})]},T.downloadUrl))}),e.jsxs(D,{className:"w-full gap-2",onClick:()=>b(o.releaseUrl),children:[e.jsx(Xs,{className:"h-4 w-4"}),p?"Open release page":"Mo trang phat hanh"]})]}):o.error?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"rounded-full bg-red-500/10 p-2",children:e.jsx(ln,{className:"h-6 w-6 text-red-500"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:p?"Check failed":"Kiem tra loi"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:o.error})]})]}),e.jsx(D,{variant:"outline",className:"w-full",onClick:y,children:p?"Retry":"Thu lai"})]}):e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"rounded-full bg-success/10 p-2",children:e.jsx(Bn,{className:"h-6 w-6 text-success"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:p?"Up to date":"Dang la ban moi nhat"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:p?`Version ${o.currentVersion}`:`Phien ban ${o.currentVersion}`})]})]})})})]}),e.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-4",children:N.map(T=>{const S=T.icon;return e.jsx(De,{className:"hover-lift",children:e.jsx(Pe,{className:"p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"rounded-lg bg-primary/10 p-2",children:e.jsx(S,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-semibold",children:T.title}),e.jsx("p",{className:"mt-1 text-xs leading-relaxed text-muted-foreground",children:T.body})]})]})})},T.title)})}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 xl:grid-cols-[1.05fr_0.95fr]",children:[e.jsxs(De,{className:"hover-lift",children:[e.jsx(at,{className:"pb-2",children:e.jsxs(rt,{className:"flex items-center gap-3 text-base",children:[e.jsx("div",{className:"rounded-lg bg-primary/10 p-2",children:e.jsx(Hi,{className:"h-4 w-4 text-primary"})}),p?"What Krouter is for":"Krouter dung de lam gi"]})}),e.jsxs(Pe,{className:"space-y-3 text-sm leading-relaxed text-muted-foreground",children:[e.jsx("p",{children:p?"Krouter is the control plane for a Kiro-based AI coding setup: it keeps account state visible, exposes one compatible API endpoint, and routes each request to a usable account.":"Krouter la control plane cho workflow AI coding dung Kiro: hien thi trang thai tai khoan, mo mot API endpoint tuong thich va dieu huong moi request den tai khoan dang dung duoc."}),e.jsx("p",{children:p?"The web dashboard handles operations. The backend service and CLI keep proxy, tunnel, API keys, and client imports running outside the browser.":"Dashboard web xu ly thao tac quan ly. Backend service va CLI giu API proxy, tunnel, API key va import client chay doc lap voi trinh duyet."})]})]}),e.jsxs(De,{className:"hover-lift",children:[e.jsx(at,{className:"pb-2",children:e.jsxs(rt,{className:"flex items-center gap-3 text-base",children:[e.jsx("div",{className:"rounded-lg bg-primary/10 p-2",children:e.jsx(wM,{className:"h-4 w-4 text-primary"})}),p?"Runtime commands":"Lenh runtime"]})}),e.jsx(Pe,{children:e.jsx("div",{className:"grid gap-2 text-xs",children:["krouter setup","krouter status","krouter tunnel start","krouter openclaw import"].map(T=>e.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-muted/40 px-3 py-2 font-mono",children:[e.jsx(z3,{className:"h-3.5 w-3.5 text-primary"}),e.jsx("span",{children:T})]},T))})})]})]}),e.jsxs(De,{className:"hover-lift",children:[e.jsx(at,{className:"pb-2",children:e.jsxs(rt,{className:"flex items-center gap-3 text-base",children:[e.jsx("div",{className:"rounded-lg bg-primary/10 p-2",children:e.jsx(UA,{className:"h-4 w-4 text-primary"})}),p?"Client integration":"Ket noi client"]})}),e.jsx(Pe,{children:e.jsxs("div",{className:"grid gap-3 text-sm md:grid-cols-3",children:[e.jsxs("div",{className:"rounded-xl bg-muted/30 p-3",children:[e.jsx("p",{className:"font-semibold",children:"Endpoint"}),e.jsx("p",{className:"mt-1 break-all font-mono text-xs text-muted-foreground",children:"http://localhost:5580/v1"})]}),e.jsxs("div",{className:"rounded-xl bg-muted/30 p-3",children:[e.jsx("p",{className:"font-semibold",children:"API key"}),e.jsx("p",{className:"mt-1 font-mono text-xs text-muted-foreground",children:"sk-..."})]}),e.jsxs("div",{className:"rounded-xl bg-muted/30 p-3",children:[e.jsx("p",{className:"font-semibold",children:"OpenClaw"}),e.jsx("p",{className:"mt-1 font-mono text-xs text-muted-foreground",children:"provider: krouter"})]})]})})]}),e.jsxs(De,{className:"hover-lift",children:[e.jsx(at,{className:"pb-2",children:e.jsxs(rt,{className:"flex items-center gap-3 text-base",children:[e.jsx("div",{className:"rounded-lg bg-primary/10 p-2",children:e.jsx(jf,{className:"h-4 w-4 text-primary"})}),p?"Project":"Du an"]})}),e.jsx(Pe,{children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"font-medium",children:ej}),e.jsx("p",{className:"break-all text-sm text-muted-foreground",children:Df})]}),e.jsxs(D,{variant:"outline",size:"sm",className:"gap-2",onClick:()=>b(Df),children:[e.jsx(jf,{className:"h-4 w-4"}),"GitHub",e.jsx(Xs,{className:"h-3 w-3"})]})]})})]})]})}const wI=[{name:"蓝色系",themes:[{id:"default",name:"天空蓝",color:"#3b82f6"},{id:"indigo",name:"靖蓝",color:"#6366f1"},{id:"cyan",name:"清新青",color:"#06b6d4"},{id:"sky",name:"晴空蓝",color:"#0ea5e9"},{id:"teal",name:"水鸭蓝",color:"#14b8a6"}]},{name:"紫红系",themes:[{id:"purple",name:"优雅紫",color:"#a855f7"},{id:"violet",name:"紫罗兰",color:"#8b5cf6"},{id:"fuchsia",name:"洋红",color:"#d946ef"},{id:"pink",name:"粉红",color:"#ec4899"},{id:"rose",name:"玑瑰红",color:"#f43f5e"}]},{name:"暖色系",themes:[{id:"red",name:"热情红",color:"#ef4444"},{id:"orange",name:"活力橙",color:"#f97316"},{id:"amber",name:"琥珀金",color:"#f59e0b"},{id:"yellow",name:"明黄",color:"#eab308"}]},{name:"绿色系",themes:[{id:"emerald",name:"翠绿",color:"#10b981"},{id:"green",name:"草绿",color:"#22c55e"},{id:"lime",name:"青柠",color:"#84cc16"}]},{name:"中性色",themes:[{id:"slate",name:"石板灰",color:"#64748b"},{id:"zinc",name:"锌灰",color:"#71717a"},{id:"stone",name:"暖灰",color:"#78716c"},{id:"neutral",name:"中性灰",color:"#737373"}]},{name:"奢华配色",themes:[{id:"gold",name:"奢华金",color:"#C9A227"},{id:"navy",name:"海军蓝",color:"#1E40AF"},{id:"wine",name:"酒红",color:"#9F1239"},{id:"champagne",name:"香槟",color:"#B89968"}]},{name:"莫兰迪",themes:[{id:"dustyblue",name:"烟雾蓝",color:"#64748B"},{id:"terracotta",name:"陶土橙",color:"#B45434"},{id:"sage",name:"鼠尾草",color:"#6B8E5A"},{id:"mauve",name:"烟紫",color:"#8E7CC3"}]},{name:"自然深色",themes:[{id:"coral",name:"珊瑚粉",color:"#F87171"},{id:"forest",name:"森林绿",color:"#166534"},{id:"ocean",name:"深海青",color:"#155E75"}]}],kI=[{name:"Blue",themes:[{id:"default",name:"Sky Blue",color:"#3b82f6"},{id:"indigo",name:"Indigo",color:"#6366f1"},{id:"cyan",name:"Cyan",color:"#06b6d4"},{id:"sky",name:"Sky",color:"#0ea5e9"},{id:"teal",name:"Teal",color:"#14b8a6"}]},{name:"Purple",themes:[{id:"purple",name:"Purple",color:"#a855f7"},{id:"violet",name:"Violet",color:"#8b5cf6"},{id:"fuchsia",name:"Fuchsia",color:"#d946ef"},{id:"pink",name:"Pink",color:"#ec4899"},{id:"rose",name:"Rose",color:"#f43f5e"}]},{name:"Warm",themes:[{id:"red",name:"Red",color:"#ef4444"},{id:"orange",name:"Orange",color:"#f97316"},{id:"amber",name:"Amber",color:"#f59e0b"},{id:"yellow",name:"Yellow",color:"#eab308"}]},{name:"Green",themes:[{id:"emerald",name:"Emerald",color:"#10b981"},{id:"green",name:"Green",color:"#22c55e"},{id:"lime",name:"Lime",color:"#84cc16"}]},{name:"Neutral",themes:[{id:"slate",name:"Slate",color:"#64748b"},{id:"zinc",name:"Zinc",color:"#71717a"},{id:"stone",name:"Stone",color:"#78716c"},{id:"neutral",name:"Neutral",color:"#737373"}]},{name:"Luxury",themes:[{id:"gold",name:"Gold",color:"#C9A227"},{id:"navy",name:"Navy",color:"#1E40AF"},{id:"wine",name:"Wine",color:"#9F1239"},{id:"champagne",name:"Champagne",color:"#B89968"}]},{name:"Morandi",themes:[{id:"dustyblue",name:"Dusty Blue",color:"#64748B"},{id:"terracotta",name:"Terracotta",color:"#B45434"},{id:"sage",name:"Sage",color:"#6B8E5A"},{id:"mauve",name:"Mauve",color:"#8E7CC3"}]},{name:"Natural",themes:[{id:"coral",name:"Coral",color:"#F87171"},{id:"forest",name:"Forest",color:"#166534"},{id:"ocean",name:"Ocean",color:"#155E75"}]}];function SI(){const{privacyMode:n,setPrivacyMode:s,usagePrecision:r,setUsagePrecision:i,autoRefreshEnabled:o,autoRefreshInterval:d,autoRefreshConcurrency:u,autoRefreshSyncInfo:h,proactiveRenewalEnabled:f,proactiveRenewalLeadMinutes:p,setProactiveRenewalEnabled:y,setAutoRefresh:b,setAutoRefreshConcurrency:v,setAutoRefreshSyncInfo:N,checkAndRefreshExpiringTokens:j,proxyEnabled:T,proxyUrl:S,setProxy:k,autoSwitchEnabled:R,autoSwitchThreshold:I,autoSwitchInterval:M,setAutoSwitch:G,batchImportConcurrency:W,setBatchImportConcurrency:U,loginPrivateMode:q,setLoginPrivateMode:V,switchTarget:le,setSwitchTarget:B,theme:be,darkMode:K,setTheme:se,setDarkMode:te,language:Y,setLanguage:P,accounts:F,importFromExportData:fe}=vt(),{t:pe}=Ut(),C=pe("common.unknown")==="Unknown",[z,X]=g.useState(!1),[re,xe]=g.useState(!1),[Oe,Ee]=g.useState(S),[Qe,_e]=g.useState(!1),[st,oe]=g.useState(!1),[ue,ae]=g.useState({enabled:!0,closeAction:"ask",showNotifications:!0,minimizeOnStart:!1}),[L,we]=g.useState(!0),[Ue,Lt]=g.useState(""),[xt,Qt]=g.useState(!0),[ft,Et]=g.useState(""),[Ge,gt]=g.useState(!1);g.useEffect(()=>{(async()=>{try{const He=await window.api.getShowWindowShortcut();Lt(He)}catch(He){console.error("Failed to load shortcut:",He)}finally{Qt(!1)}})()},[]);const Ze=async je=>{Lt(je),Et("");try{const He=await window.api.setShowWindowShortcut(je);He.success||Et(He.error||"Failed to set shortcut")}catch(He){Et(String(He))}},J=je=>{if(!Ge)return;je.preventDefault();const He=[];je.ctrlKey&&He.push("Ctrl"),je.metaKey&&He.push("Command"),je.altKey&&He.push("Alt"),je.shiftKey&&He.push("Shift");const Tt=je.key;if(!["Control","Meta","Alt","Shift"].includes(Tt)){const H=Tt.length===1?Tt.toUpperCase():Tt;He.push(H);const Se=He.join("+");Ze(Se),gt(!1)}},[Ne,et]=g.useState("rest"),[qe,Je]=g.useState(!0);g.useEffect(()=>{(async()=>{try{const He=await window.api.getUsageApiType();et(He)}catch(He){console.error("Failed to load usage API type:",He)}finally{Je(!1)}})()},[]);const Kt=async je=>{et(je);try{await window.api.setUsageApiType(je)}catch(He){console.error("Failed to save usage API type:",He)}},[Ye,qt]=g.useState(!1),[Jt,Ct]=g.useState(!0);g.useEffect(()=>{(async()=>{try{const He=await window.api.getUseKProxyForApi();qt(He)}catch(He){console.error("Failed to load K-Proxy settings:",He)}finally{Ct(!1)}})()},[]);const O=async je=>{qt(je);try{await window.api.setUseKProxyForApi(je)}catch(He){console.error("Failed to save K-Proxy settings:",He)}};g.useEffect(()=>{(async()=>{try{const He=await window.api.getTraySettings();ae(He)}catch(He){console.error("Failed to load tray settings:",He)}finally{we(!1)}})()},[]);const ne=async(je,He)=>{const Tt={...ue,[je]:He};ae(Tt);try{await window.api.saveTraySettings({[je]:He})}catch(H){console.error("Failed to save tray settings:",H)}},ze=async()=>{oe(!0);try{await j()}finally{oe(!1)}},_=C?kI:wI,ce=()=>{X(!0)},Ce=async()=>{xe(!0);try{const je=await window.api.importFromFile();if(je&&je.format==="json"){const He=JSON.parse(je.content),Tt=fe(He);alert(`导入完成:成功 ${Tt.success} 个,失败 ${Tt.failed} 个`)}else je&&alert("设置页面仅支持 JSON 格式导入,请使用账号管理页面导入 CSV/TXT")}catch(je){alert(`导入失败: ${je instanceof Error?je.message:"未知错误"}`)}finally{xe(!1)}},Ve=()=>{confirm("确定要清除所有账号数据吗?此操作不可恢复!")&&confirm("再次确认:这将删除所有账号、分组和标签数据!")&&(Array.from(F.keys()).forEach(je=>{vt.getState().removeAccount(je)}),alert("所有数据已清除"))};return e.jsxs("div",{className:"flex-1 p-6 space-y-6 overflow-auto",children:[e.jsxs("div",{className:"page-hero p-6",children:[e.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-primary/20 to-transparent rounded-full blur-2xl"}),e.jsx("div",{className:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-primary/20 to-transparent rounded-full blur-2xl"}),e.jsxs("div",{className:"relative flex items-center gap-4",children:[e.jsx("div",{className:"p-3 rounded-xl bg-primary shadow-lg shadow-primary/25",children:e.jsx(Tp,{className:"h-6 w-6 text-primary-foreground"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-primary",children:pe("settings.title")}),e.jsx("p",{className:"text-muted-foreground",children:pe("settings.title")==="Settings"?"Configure app features":"配置应用的各项功能"})]})]})]}),e.jsxs(De,{className:"hover-lift",children:[e.jsx(at,{className:"pb-2",children:e.jsxs(rt,{className:"text-base flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10",children:e.jsx(ri,{className:"h-4 w-4 text-primary"})}),"语言 / Language"]})}),e.jsxs(Pe,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"显示语言 / Display Language"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"选择界面显示语言 / Select interface language"})]}),e.jsxs("select",{className:"w-[160px] h-9 px-3 rounded-lg border bg-background text-sm focus:outline-none focus:ring-1 focus:ring-primary focus:border-primary",value:Y,onChange:je=>P(je.target.value),children:[e.jsx("option",{value:"auto",children:"🌐 自动 (Auto)"}),e.jsx("option",{value:"zh",children:"🇨🇳 简体中文"}),e.jsx("option",{value:"en",children:"🇺🇸 English"})]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground bg-muted/50 rounded-lg p-3 space-y-1",children:[e.jsx("p",{children:"• 自动模式会根据系统语言自动选择"}),e.jsx("p",{children:"• Auto mode will follow system language"}),e.jsx("p",{children:"• 支持自定义翻译文件扩展(开发中)"})]})]})]}),e.jsxs(De,{className:"hover-lift",children:[e.jsx(at,{className:"pb-2",children:e.jsxs(rt,{className:"text-base flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10",children:e.jsx(GN,{className:"h-4 w-4 text-primary"})}),C?"Theme":"主题设置"]})}),e.jsxs(Pe,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:C?"Dark Mode":"深色模式"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:C?"Toggle dark/light theme":"切换深色/浅色主题"})]}),e.jsxs(D,{variant:K?"default":"outline",size:"sm",onClick:()=>te(!K),children:[K?e.jsx(_A,{className:"h-4 w-4 mr-2"}):e.jsx(TM,{className:"h-4 w-4 mr-2"}),K?C?"Dark":"深色":C?"Light":"浅色"]})]}),e.jsxs("div",{className:"pt-2 border-t",children:[e.jsxs("button",{className:"flex items-center justify-between w-full text-left",onClick:()=>_e(!Qe),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"font-medium",children:C?"Theme Color":"主题颜色"}),!Qe&&e.jsx("div",{className:"w-5 h-5 rounded-full ring-2 ring-primary ring-offset-1",style:{backgroundColor:_.flatMap(je=>je.themes).find(je=>je.id===be)?.color||"#3b82f6"}})]}),Qe?e.jsx(zi,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(va,{className:"h-4 w-4 text-muted-foreground"})]}),Qe&&e.jsx("div",{className:"space-y-3 mt-3",children:_.map(je=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-muted-foreground w-14 shrink-0",children:je.name}),e.jsx("div",{className:"flex flex-wrap gap-2",children:je.themes.map(He=>e.jsx("button",{className:`group relative w-7 h-7 rounded-full transition-all ${be===He.id?"ring-2 ring-primary ring-offset-2 scale-110":"hover:scale-110 hover:shadow-md"}`,style:{backgroundColor:He.color},onClick:()=>se(He.id),title:He.name,children:e.jsx("span",{className:"absolute -bottom-6 left-1/2 -translate-x-1/2 text-[10px] text-muted-foreground whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity bg-popover px-1.5 py-0.5 rounded shadow-sm border pointer-events-none z-10",children:He.name})},He.id))})]},je.name))})]})]})]}),e.jsxs(De,{className:"hover-lift",children:[e.jsx(at,{className:"pb-2",children:e.jsxs(rt,{className:"text-base flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10",children:n?e.jsx(Jl,{className:"h-4 w-4 text-primary"}):e.jsx(Nc,{className:"h-4 w-4 text-primary"})}),C?"Privacy":"隐私设置"]})}),e.jsxs(Pe,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:C?"Privacy Mode":"隐私模式"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:C?"Hide emails and sensitive info":"隐藏邮箱和账号敏感信息"})]}),e.jsxs(D,{variant:n?"default":"outline",size:"sm",onClick:()=>s(!n),children:[n?e.jsx(Jl,{className:"h-4 w-4 mr-2"}):e.jsx(Nc,{className:"h-4 w-4 mr-2"}),n?C?"On":"已开启":C?"Off":"已关闭"]})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:C?"Usage Precision":"使用量精度"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:C?"Show decimal places for usage values":"显示使用量的小数精度(如 1.22 而非 1)"})]}),e.jsx(D,{variant:r?"default":"outline",size:"sm",onClick:()=>i(!r),children:r?C?"Decimal":"小数":C?"Integer":"整数"})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:C?"Switch Target":"切号目标"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:C?"Which client to switch account credentials to":"切换账号凭证写入的客户端"})]}),e.jsxs("select",{className:"h-9 px-3 rounded-lg border bg-background text-sm focus:outline-none focus:ring-1 focus:ring-primary focus:border-primary",value:le,onChange:je=>B(je.target.value),children:[e.jsx("option",{value:"ide",children:"Kiro IDE"}),e.jsx("option",{value:"cli",children:"Kiro CLI"}),e.jsx("option",{value:"both",children:C?"Both (IDE + CLI)":"两者 (IDE + CLI)"})]})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:C?"Login Private Mode":"登录隐私模式"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:C?"Open browser in incognito/private mode when logging in":"在线登录时使用浏览器无痕/隐私模式打开"})]}),e.jsxs(D,{variant:q?"default":"outline",size:"sm",onClick:()=>V(!q),children:[e.jsx(VM,{className:"h-4 w-4 mr-2"}),q?C?"On":"已开启":C?"Off":"已关闭"]})]})]})]}),e.jsxs(De,{className:"hover-lift",children:[e.jsx(at,{className:"pb-2",children:e.jsxs(rt,{className:"text-base flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10",children:e.jsx(Mt,{className:"h-4 w-4 text-primary"})}),C?"Auto Refresh":"自动刷新"]})}),e.jsxs(Pe,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:C?"Auto Refresh":"自动刷新"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:C?"Auto refresh tokens before expiration":"Token 过期前自动刷新,并同步更新账户信息"})]}),e.jsx(D,{variant:o?"default":"outline",size:"sm",onClick:()=>b(!o),children:o?C?"On":"已开启":C?"Off":"已关闭"})]}),e.jsxs("div",{className:"text-xs text-muted-foreground bg-amber-50 dark:bg-amber-950/30 border border-amber-200 dark:border-amber-900 rounded-lg p-3 space-y-1",children:[e.jsx("p",{className:"font-medium text-amber-700 dark:text-amber-300",children:C?"About Kiro IDE auto refresh":"关于 Kiro IDE 自动刷新"}),e.jsx("p",{children:C?"• Kiro IDE has its own internal refresh loop (independent of this app). Disabling Auto Refresh here only stops this app from refreshing — it does NOT stop Kiro IDE.":'• Kiro IDE 自带独立的刷新循环,关闭本工具的"自动刷新"不会停止 IDE 自己的刷新。'}),e.jsx("p",{children:C?"• When switching accounts or refreshing tokens here, the new token is synced to ~/.aws/sso/cache/kiro-auth-token.json only for the IDE current active account; other accounts only update the local store.":"• 切号 / 刷新 Token 时,仅当该账号是 Kiro IDE 当前激活账号才会同步到磁盘文件;非激活账号仅更新本工具内部 store。"}),e.jsx("p",{children:C?"• If IDE refreshes the token itself, this app detects the file change and syncs the new token back to its store (bidirectional sync).":"• 当 Kiro IDE 自己 refresh 后,本工具会监听磁盘文件变化并反向同步到 store(双向同步)。"})]}),e.jsxs("div",{className:"flex items-center justify-between pt-3 border-t",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"font-medium",children:[C?"Proactive Token Renewal for IDE":"IDE 主动续期",e.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(",C?"Advanced":"进阶",")"]})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:C?`Renew IDE's active token ~${p} min before expiry, so Kiro IDE never refreshes by itself (eliminates all race conditions).`:`在 IDE 激活账号的 token 剩 ~${p} 分钟时抢先 refresh,让 Kiro IDE 永远不自己 refresh(彻底消除竞争条件)。`})]}),e.jsx(D,{variant:f?"default":"outline",size:"sm",onClick:async()=>{const je=await y(!f);!je.success&&je.error&&alert((C?"Failed to toggle proactive renewal: ":"切换主动续期失败:")+je.error)},children:f?C?"On":"已开启":C?"Off":"已关闭"})]}),f&&e.jsxs("div",{className:"text-xs text-muted-foreground bg-emerald-50 dark:bg-emerald-950/30 border border-emerald-200 dark:border-emerald-900 rounded-lg p-3 space-y-1",children:[e.jsx("p",{children:C?`• On: a single in-process timer renews token ${p} min before expiry; Kiro IDE keeps seeing fresh tokens (≥${60-p} min remaining) and never invokes OIDC by itself.`:`• 启用后:账号管理器主进程会在 token 剩 ${p} 分钟时自动续期,Kiro IDE 始终看到剩余 ≥ ${60-p} 分钟的 token,永远不会自己调 OIDC。`}),e.jsx("p",{children:C?"• Only the IDE current active account is renewed. Switching accounts re-schedules the timer for the new active account.":"• 仅对 IDE 当前激活账号续期。切号时 timer 会自动重新调度到新账号。"}),e.jsx("p",{children:C?"• If a renewal fails (e.g. server outage), the timer stops; IDE's own refresh loop takes over as fallback.":"• 续期失败时 timer 停止,由 IDE 自己的 refresh loop 接管(双向同步仍生效)。"})]}),o&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"text-xs text-muted-foreground bg-muted/50 rounded-lg p-3 space-y-1",children:[e.jsxs("p",{children:["• ",C?"Auto refresh tokens to keep login":"Token 即将过期时自动刷新,保持登录状态"]}),e.jsxs("p",{children:["• ",C?"Update usage and subscription info after refresh":"Token 刷新后自动更新账户用量、订阅等信息"]}),e.jsxs("p",{children:["• ",C?"Check all balances when auto-switch is on":"开启自动换号时,会定期检查所有账户余额"]})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:C?"Check Interval":"检查间隔"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:C?"How often to check account status":"每隔多久检查一次账户状态"})]}),e.jsxs("select",{className:"w-[120px] h-9 px-3 rounded-lg border bg-background text-sm focus:outline-none focus:ring-1 focus:ring-primary focus:border-primary",value:d,onChange:je=>b(!0,parseInt(je.target.value)),children:[e.jsx("option",{value:"1",children:C?"1 min":"1 分钟"}),e.jsx("option",{value:"3",children:C?"3 min":"3 分钟"}),e.jsx("option",{value:"5",children:C?"5 min":"5 分钟"}),e.jsx("option",{value:"10",children:C?"10 min":"10 分钟"}),e.jsx("option",{value:"15",children:C?"15 min":"15 分钟"}),e.jsx("option",{value:"20",children:C?"20 min":"20 分钟"}),e.jsx("option",{value:"30",children:C?"30 min":"30 分钟"}),e.jsx("option",{value:"45",children:C?"45 min":"45 分钟"}),e.jsx("option",{value:"60",children:C?"60 min":"60 分钟"})]})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:C?"Concurrency":"刷新并发数"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:C?"Number of accounts to refresh simultaneously":"同时刷新的账号数量,过大可能卡顿"})]}),e.jsx("input",{type:"number",className:"w-24 h-9 px-3 rounded-lg border bg-background text-sm text-center focus:outline-none focus:ring-1 focus:ring-primary focus:border-primary",value:u,min:1,max:500,onChange:je=>v(parseInt(je.target.value)||50)})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:C?"Sync Account Info":"同步检测账户信息"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:C?"Detect usage, subscription, and ban status":"刷新 Token 时同步检测用量、订阅、封禁状态"})]}),e.jsx(D,{variant:h?"default":"outline",size:"sm",onClick:()=>N(!h),children:h?C?"On":"已开启":C?"Off":"已关闭"})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:C?"Manual Trigger":"手动触发"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:C?"Manually trigger auto-refresh for debugging":"手动触发一次自动刷新流程(用于调试)"})]}),e.jsx(D,{variant:"outline",size:"sm",onClick:ze,disabled:st,children:st?C?"Refreshing...":"刷新中...":C?"Trigger Now":"立即触发"})]})]})]})]}),e.jsxs(De,{className:"hover-lift",children:[e.jsx(at,{className:"pb-2",children:e.jsxs(rt,{className:"text-base flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10",children:e.jsx(kp,{className:"h-4 w-4 text-primary"})}),C?"API Settings":"API 设置"]})}),e.jsxs(Pe,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:C?"Usage API Type":"用量查询 API"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:C?"Select API type for querying usage limits":"选择查询账户用量的 API 类型"})]}),e.jsxs("select",{className:"w-[180px] h-9 px-3 rounded-lg border bg-background text-sm focus:outline-none focus:ring-1 focus:ring-primary focus:border-primary",value:Ne,onChange:je=>Kt(je.target.value),disabled:qe,children:[e.jsx("option",{value:"rest",children:"REST (GetUsageLimits)"}),e.jsx("option",{value:"cbor",children:"CBOR (GetUserUsageAndLimits)"})]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground bg-muted/50 rounded-lg p-3 space-y-1",children:[e.jsxs("p",{children:["• ",e.jsx("strong",{children:"REST"}),": ",C?"Official Kiro IDE format, recommended":"官方 Kiro IDE 使用的格式,推荐使用"]}),e.jsxs("p",{children:["• ",e.jsx("strong",{children:"CBOR"}),": ",C?"Web portal format, may have different fields":"网页端格式,字段可能有差异"]})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:C?"Use K-Proxy for API":"API 请求走 K-Proxy"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:C?"Route API requests through K-Proxy MITM proxy":"API 请求通过 K-Proxy MITM 代理发送"})]}),e.jsx(D,{variant:Ye?"default":"outline",size:"sm",onClick:()=>O(!Ye),disabled:Jt,children:Ye?C?"On":"已开启":C?"Off":"已关闭"})]}),Ye&&e.jsx("div",{className:"text-xs text-amber-500 bg-amber-500/10 rounded-lg p-3",children:C?"⚠️ K-Proxy must be running for this to work":"⚠️ 需要先启动 K-Proxy MITM 代理才能生效"})]})]}),e.jsxs(De,{className:"hover-lift",children:[e.jsx(at,{className:"pb-2",children:e.jsxs(rt,{className:"text-base flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10",children:e.jsx(ri,{className:"h-4 w-4 text-primary"})}),C?"Proxy":"代理设置"]})}),e.jsxs(Pe,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:C?"Enable Proxy":"启用代理"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:C?"All requests through proxy server":"所有网络请求将通过代理服务器"})]}),e.jsx(D,{variant:T?"default":"outline",size:"sm",onClick:()=>k(!T,Oe),children:T?C?"On":"已开启":C?"Off":"已关闭"})]}),e.jsxs("div",{className:"space-y-2 pt-2 border-t",children:[e.jsx("label",{className:"text-sm font-medium",children:C?"Proxy URL":"代理地址"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",className:"flex-1 h-9 px-3 rounded-lg border bg-background text-sm font-mono focus:outline-none focus:ring-1 focus:ring-primary focus:border-primary",placeholder:C?"http://127.0.0.1:7890 or socks5://127.0.0.1:1080":"http://127.0.0.1:7890 或 socks5://127.0.0.1:1080",value:Oe,onChange:je=>Ee(je.target.value)}),e.jsx(D,{variant:"outline",size:"sm",onClick:()=>k(T,Oe),disabled:Oe===S,children:C?"Save":"保存"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:C?"Supports HTTP/HTTPS/SOCKS5, format: protocol://host:port":"支持 HTTP/HTTPS/SOCKS5 代理,格式: protocol://host:port"})]})]})]}),e.jsxs(De,{className:"hover-lift",children:[e.jsx(at,{className:"pb-2",children:e.jsxs(rt,{className:"text-base flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10",children:e.jsx(XN,{className:"h-4 w-4 text-primary"})}),C?"Auto Switch":"自动换号"]})}),e.jsxs(Pe,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:C?"Enable Auto Switch":"启用自动换号"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:C?"Auto switch when balance is low":"余额不足时自动切换到其他可用账号"})]}),e.jsx(D,{variant:R?"default":"outline",size:"sm",onClick:()=>G(!R),children:R?C?"On":"已开启":C?"Off":"已关闭"})]}),R&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:C?"Balance Threshold":"余额阈值"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:C?"Switch when balance below this":"余额低于此值时自动切换"})]}),e.jsx("input",{type:"number",className:"w-20 h-9 px-3 rounded-lg border bg-background text-sm text-center focus:outline-none focus:ring-1 focus:ring-primary focus:border-primary",value:I,min:0,onChange:je=>G(!0,parseInt(je.target.value)||0)})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"font-medium flex items-center gap-2",children:[e.jsx(Gn,{className:"h-4 w-4"}),C?"Check Interval":"检查间隔"]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:C?"How often to check balance":"每隔多久检查一次余额"})]}),e.jsxs("select",{className:"h-9 px-3 rounded-lg border bg-background text-sm focus:outline-none focus:ring-1 focus:ring-primary focus:border-primary",value:M,onChange:je=>G(!0,void 0,parseInt(je.target.value)),children:[e.jsx("option",{value:"1",children:C?"1 min":"1 分钟"}),e.jsx("option",{value:"3",children:C?"3 min":"3 分钟"}),e.jsx("option",{value:"5",children:C?"5 min":"5 分钟"}),e.jsx("option",{value:"10",children:C?"10 min":"10 分钟"}),e.jsx("option",{value:"15",children:C?"15 min":"15 分钟"}),e.jsx("option",{value:"30",children:C?"30 min":"30 分钟"})]})]})]})]})]}),e.jsxs(De,{className:"hover-lift",children:[e.jsx(at,{className:"pb-2",children:e.jsxs(rt,{className:"text-base flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10",children:e.jsx(NA,{className:"h-4 w-4 text-primary"})}),C?"Batch Import":"批量导入"]})}),e.jsxs(Pe,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:C?"Concurrency":"并发数"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:C?"Too high may cause API rate limiting":"同时验证的账号数量,过大可能导致 API 限流"})]}),e.jsx("input",{type:"number",className:"w-24 h-9 px-3 rounded-lg border bg-background text-sm text-center focus:outline-none focus:ring-1 focus:ring-primary focus:border-primary",value:W,min:1,max:500,onChange:je=>U(parseInt(je.target.value)||100)})]}),e.jsx("p",{className:"text-xs text-muted-foreground bg-muted/50 rounded-lg p-2",children:C?"Recommended: 10-100. Too high may cause failures, too low is slow.":"建议范围: 10-100。设置过大可能导致大量「验证失败」,设置过小则导入速度较慢。"})]})]}),e.jsxs(De,{className:"hover-lift",children:[e.jsx(at,{className:"pb-2",children:e.jsxs(rt,{className:"text-base flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10",children:e.jsx(Vl,{className:"h-4 w-4 text-primary"})}),C?"System Tray":"系统托盘"]})}),e.jsx(Pe,{className:"space-y-4",children:L?e.jsx("div",{className:"text-sm text-muted-foreground",children:C?"Loading...":"加载中..."}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:C?"Enable System Tray":"启用系统托盘"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:C?"Show icon in system tray":"在系统托盘显示图标"})]}),e.jsx(D,{variant:ue.enabled?"default":"outline",size:"sm",onClick:()=>ne("enabled",!ue.enabled),children:ue.enabled?C?"On":"已开启":C?"Off":"已关闭"})]}),ue.enabled&&e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:C?"Close Button Action":"关闭按钮行为"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:C?"What happens when you click X":"点击关闭按钮时的行为"})]}),e.jsxs("select",{className:"w-[140px] h-9 px-3 rounded-lg border bg-background text-sm focus:outline-none focus:ring-1 focus:ring-primary focus:border-primary",value:ue.closeAction,onChange:je=>ne("closeAction",je.target.value),children:[e.jsx("option",{value:"ask",children:C?"Ask every time":"每次询问"}),e.jsx("option",{value:"minimize",children:C?"Minimize to tray":"最小化到托盘"}),e.jsx("option",{value:"quit",children:C?"Quit application":"退出程序"})]})]})}),e.jsxs("div",{className:"text-xs text-muted-foreground bg-muted/50 rounded-lg p-3 space-y-1",children:[e.jsxs("p",{children:["• ",C?"Double-click tray icon to show window":"双击托盘图标可以显示主窗口"]}),e.jsxs("p",{children:["• ",C?"Right-click tray icon to show menu":"右键托盘图标可以显示菜单"]}),e.jsxs("p",{children:["• ",C?"Tray menu shows current account info and usage":"托盘菜单可以查看当前账户信息和用量"]})]})]})})]}),e.jsxs(De,{className:"hover-lift",children:[e.jsx(at,{className:"pb-2",children:e.jsxs(rt,{className:"text-base flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10",children:e.jsx(Tp,{className:"h-4 w-4 text-primary"})}),C?"Keyboard Shortcuts":"快捷键"]})}),e.jsx(Pe,{className:"space-y-4",children:xt?e.jsx("div",{className:"text-sm text-muted-foreground",children:C?"Loading...":"加载中..."}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:C?"Show Window":"显示主窗口"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:C?"Global shortcut to show main window":"全局快捷键唤起主窗口"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",className:`w-[160px] h-9 px-3 rounded-lg border bg-background text-sm focus:outline-none focus:ring-1 focus:ring-primary focus:border-primary text-center ${Ge?"border-primary ring-1 ring-primary animate-pulse":""}`,value:Ge?C?"Press keys...":"请按键...":Ue,onKeyDown:J,onFocus:()=>gt(!0),onBlur:()=>gt(!1),readOnly:!0,placeholder:C?"Click to record":"点击录制"}),Ue&&e.jsx(D,{variant:"ghost",size:"sm",className:"h-9 px-2",onClick:()=>Ze(""),children:e.jsx(Vt,{className:"h-4 w-4"})})]})]}),ft&&e.jsx("p",{className:"text-sm text-destructive",children:ft}),e.jsxs("div",{className:"text-xs text-muted-foreground bg-muted/50 rounded-lg p-3 space-y-1",children:[e.jsxs("p",{children:["• ",C?"Click input and press key combination to record":"点击输入框后按下组合键自动录制"]}),e.jsxs("p",{children:["• ",C?"macOS use Command, Windows/Linux use Ctrl":"macOS 使用 Command,Windows/Linux 使用 Ctrl"]}),e.jsxs("p",{children:["• ",C?"Click trash icon to clear shortcut":"点击垃圾桶图标可清除快捷键"]})]})]})})]}),e.jsx(De,{className:"hover-lift bg-primary/5",children:e.jsx(Pe,{className:"py-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10",children:e.jsx(eo,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-medium text-sm",children:C?"Machine ID":"机器码管理"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:C?"Device identifier, auto-switch, account binding":"修改设备标识符、切号自动换码、账户机器码绑定等功能"})]}),e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(Va,{className:"h-3 w-3"}),e.jsx("span",{children:C?'Set in sidebar "Machine ID"':"请在侧边栏「机器码」中设置"})]})]})})}),e.jsxs(De,{className:"hover-lift",children:[e.jsx(at,{className:"pb-2",children:e.jsxs(rt,{className:"text-base flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10",children:e.jsx(kp,{className:"h-4 w-4 text-primary"})}),C?"Data Management":"数据管理"]})}),e.jsxs(Pe,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:C?"Export Data":"导出数据"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:C?"Supports JSON, TXT, CSV, Clipboard":"支持 JSON、TXT、CSV、剪贴板等多种格式"})]}),e.jsxs(D,{variant:"outline",size:"sm",onClick:ce,children:[e.jsx(Ns,{className:"h-4 w-4 mr-2"}),C?"Export":"导出"]})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:C?"Import Data":"导入数据"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:C?"Import accounts from JSON file":"从 JSON 文件导入账号数据"})]}),e.jsxs(D,{variant:"outline",size:"sm",onClick:Ce,disabled:re,children:[e.jsx(Fa,{className:"h-4 w-4 mr-2"}),re?C?"Importing...":"导入中...":C?"Import":"导入"]})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-destructive",children:C?"Clear All Data":"清除所有数据"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:C?"Delete all accounts, groups and tags":"删除所有账号、分组和标签"})]}),e.jsxs(D,{variant:"destructive",size:"sm",onClick:Ve,children:[e.jsx(Vt,{className:"h-4 w-4 mr-2"}),C?"Clear":"清除"]})]})]})]}),e.jsx(CI,{isEn:C}),e.jsx(tw,{open:z,onClose:()=>X(!1),accounts:Array.from(F.values()),selectedCount:0})]})}function CI({isEn:n}){const s=vt(u=>u.proxyPool),r=vt(u=>u.proxyPoolConfig),i=["kiro-register-config","kiro-register-history","kiro-register-templates","kiro-register-ratelimit-enabled","kiro-register-ratelimit-max","kiro-register-autobackoff","kiro-register-dailyquota-limit","kiro-register-schedule-enabled","kiro-register-schedule-time","kiro-register-mixed-sources","kiro-webhooks","accounts_viewMode","accounts_activeGroupTab","systemLogs_displayLimit","kiro-diagnose-moemail","proxyLogs_timeRange","proxyLogs_displayLimit"],o=()=>{const u={};for(const b of i){const v=localStorage.getItem(b);v!=null&&(u[b]=v)}const h={version:1,type:"krouter-config",exportedAt:Date.now(),proxyPool:Object.fromEntries(s),proxyPoolConfig:r,localStorage:u},f=new Blob([JSON.stringify(h,null,2)],{type:"application/json"}),p=URL.createObjectURL(f),y=document.createElement("a");y.href=p,y.download=`krouter-config-${new Date().toISOString().replace(/[:.]/g,"-")}.json`,y.click(),URL.revokeObjectURL(p)},d=async()=>{const u=await window.api.importFromFile();if(!u||u.format!=="json"){alert(n?"Please select a JSON file":"请选择 JSON 文件");return}try{const h=JSON.parse(u.content);if(h.type!=="krouter-config"&&h.type!=="kiro-account-manager-config"){alert(n?"Not a valid config file":"不是有效的配置文件");return}if(!confirm(n?"This will overwrite proxy pool / webhooks / templates. Continue?":"这将覆盖代理池 / Webhook / 模板等配置,确定继续?"))return;if(h.localStorage&&typeof h.localStorage=="object"){for(const[f,p]of Object.entries(h.localStorage))if(i.includes(f)&&typeof p=="string")try{localStorage.setItem(f,p)}catch{}}h.proxyPool&&typeof h.proxyPool=="object"&&(vt.getState().clearProxyPool(),vt.setState({proxyPool:new Map(Object.entries(h.proxyPool))})),h.proxyPoolConfig&&vt.getState().setProxyPoolConfig(h.proxyPoolConfig),alert(n?"Config imported. Please restart the app to fully apply.":"配置已导入。建议重启应用以完全生效。")}catch(h){alert((n?"Import failed: ":"导入失败: ")+(h instanceof Error?h.message:String(h)))}};return e.jsxs(De,{className:"hover-lift",children:[e.jsx(at,{className:"pb-2",children:e.jsxs(rt,{className:"text-base flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10",children:e.jsx(XN,{className:"h-4 w-4 text-primary"})}),n?"Configuration Sync":"配置同步"]})}),e.jsxs(Pe,{className:"space-y-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:n?"Export all non-sensitive settings (proxy pool, webhooks, templates, rate limits, UI preferences) to a file, for backup or multi-device sync. Does NOT include account tokens or credentials.":'导出所有"非敏感"配置(代理池、Webhook、注册模板、限速、UI 偏好等)到文件,便于备份或多设备同步。不含账号 Token 与凭据。'}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(D,{variant:"outline",size:"sm",onClick:o,children:[e.jsx(Ns,{className:"h-4 w-4 mr-2"}),n?"Export Config":"导出配置"]}),e.jsxs(D,{variant:"outline",size:"sm",onClick:d,children:[e.jsx(Fa,{className:"h-4 w-4 mr-2"}),n?"Import Config":"导入配置"]})]})]})]})}function TI(){const{machineIdConfig:n,currentMachineId:s,originalMachineId:r,originalBackupTime:i,accountMachineIds:o,machineIdHistory:d,accounts:u,setMachineIdConfig:h,refreshCurrentMachineId:f,changeMachineId:p,restoreOriginalMachineId:y,clearMachineIdHistory:b,bindMachineIdToAccount:v}=vt(),{t:N}=Ut(),j=N("common.unknown")==="Unknown",[T,S]=g.useState(!1),[k,R]=g.useState(null),[I,M]=g.useState("unknown"),[G,W]=g.useState(""),[U,q]=g.useState(!1),[V,le]=g.useState(!1),[B,be]=g.useState(null),[K,se]=g.useState(""),[te,Y]=g.useState(""),[P,F]=g.useState(null);g.useEffect(()=>{(async()=>{S(!0);try{const Ue=await window.api.machineIdGetOSType();M(Ue);const Lt=await window.api.machineIdCheckAdmin();R(Lt),await f()}catch(Ue){console.error("初始化失败:",Ue)}finally{S(!1)}})()},[f]);const fe=(we,Ue="default")=>{navigator.clipboard.writeText(we),F(Ue),setTimeout(()=>F(null),1500)},pe=async()=>{S(!0);try{await p(),await f()}finally{S(!1)}},C=async()=>{if(G.trim()){S(!0);try{await p(G.trim()),await f(),W("")}finally{S(!1)}}},z=async()=>{S(!0);try{await y(),await f()}finally{S(!1)}},X=async()=>{s&&await window.api.machineIdBackupToFile(s)},re=async()=>{S(!0);try{const we=await window.api.machineIdRestoreFromFile();we.success&&we.machineId&&(await p(we.machineId),await f())}finally{S(!1)}},xe=async()=>{await window.api.machineIdRequestAdminRestart()},Oe=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,we=>{const Ue=Math.random()*16|0;return(we==="x"?Ue:Ue&3|8).toString(16)}),Ee=we=>{be(we),se(o[we]||"")},Qe=we=>{K.trim()&&v(we,K.trim()),be(null),se("")},_e=()=>{be(null),se("")},st=we=>{const Ue=Oe();v(we,Ue),B===we&&se(Ue)},oe=we=>{const{accountMachineIds:Ue}=vt.getState(),Lt={...Ue};delete Lt[we],vt.setState({accountMachineIds:Lt}),vt.getState().saveToStorage()},ue=we=>new Date(we).toLocaleString("zh-CN"),ae=()=>{switch(I){case"windows":return"Windows";case"macos":return"macOS";case"linux":return"Linux";default:return j?"Unknown":"未知"}},L=Object.keys(o).length;return e.jsxs("div",{className:"flex-1 p-6 space-y-6 overflow-auto",children:[e.jsxs("div",{className:"page-hero",children:[e.jsx("div",{className:"absolute inset-0 bg-grid-white/5"}),e.jsx("div",{className:"absolute top-0 right-0 w-64 h-64 bg-gradient-to-br from-primary/20 to-transparent rounded-full blur-3xl -translate-y-1/2 translate-x-1/2"}),e.jsx("div",{className:"absolute bottom-0 left-0 w-48 h-48 bg-gradient-to-tr from-primary/20 to-transparent rounded-full blur-3xl translate-y-1/2 -translate-x-1/2"}),e.jsxs("div",{className:"relative p-6",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"p-4 rounded-2xl bg-gradient-to-br from-primary to-primary/80 shadow-lg shadow-primary/25",children:e.jsx(eo,{className:"h-8 w-8 text-white"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-primary",children:j?"Machine ID":"机器码管理"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:j?"Manage device identifier to prevent account bans":"管理设备标识符,防止账号关联和封禁"})]})]}),e.jsxs($e,{variant:"outline",className:"bg-background/80 backdrop-blur-sm",children:[e.jsx(Vl,{className:"h-3 w-3 mr-1"}),ae()]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4 mt-6",children:[e.jsx("div",{className:"p-4 rounded-xl bg-background/60 backdrop-blur-sm border border-white/10",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10",children:e.jsx(eo,{className:"h-4 w-4 text-primary"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:d.length}),e.jsx("p",{className:"text-xs text-muted-foreground",children:j?"History":"变更记录"})]})]})}),e.jsx("div",{className:"p-4 rounded-xl bg-background/60 backdrop-blur-sm border border-white/10",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10",children:e.jsx(ql,{className:"h-4 w-4 text-primary"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:L}),e.jsx("p",{className:"text-xs text-muted-foreground",children:j?"Bound Accounts":"已绑定账户"})]})]})}),e.jsx("div",{className:"p-4 rounded-xl bg-background/60 backdrop-blur-sm border border-white/10",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10",children:e.jsx(Vn,{className:"h-4 w-4 text-primary"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:r?j?"Backed":"已备份":j?"None":"未备份"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:j?"Original ID":"原始机器码"})]})]})})]})]})]}),k===!1&&e.jsx(De,{className:"border-warning/50 bg-gradient-to-r from-warning/10 to-warning/5 overflow-hidden",children:e.jsx(Pe,{className:"py-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-warning/20",children:e.jsx(Rs,{className:"h-5 w-5 text-warning"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-warning",children:j?"Admin Required":"需要管理员权限"}),e.jsx("p",{className:"text-sm text-warning/80",children:j?"Run as administrator to modify machine ID":"修改机器码需要以管理员身份运行应用"})]})]}),e.jsxs(D,{variant:"outline",size:"sm",onClick:xe,className:"border-warning/50 hover:bg-warning/10",children:[e.jsx(Vn,{className:"h-4 w-4 mr-1"}),j?"Restart as Admin":"以管理员重启"]})]})})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs(De,{className:"group relative overflow-hidden hover:shadow-lg transition-all duration-300",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-primary/5 to-primary/10 opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none"}),e.jsx(at,{className:"pb-3 relative z-10",children:e.jsxs(rt,{className:"text-base flex items-center gap-2",children:[e.jsx("div",{className:"p-1.5 rounded-lg bg-primary/10",children:e.jsx(Vl,{className:"h-4 w-4 text-primary"})}),j?"Current Machine ID":"当前机器码",s&&s!==r&&e.jsx($e,{className:"ml-auto bg-primary/10 text-primary border-primary/20",children:j?"Modified":"已修改"})]})}),e.jsxs(Pe,{className:"space-y-4 relative z-10",children:[e.jsx("div",{className:"relative group/code",children:e.jsx("div",{className:"p-4 bg-muted rounded-xl font-mono text-sm break-all border border-border text-foreground",children:T?e.jsxs("span",{className:"text-muted-foreground flex items-center gap-2",children:[e.jsx(Mt,{className:"h-4 w-4 animate-spin"}),j?"Loading...":"加载中..."]}):s||e.jsx("span",{className:"text-muted-foreground",children:j?"Unable to get":"无法获取"})})}),d.length>0&&e.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e.jsx(tc,{className:"h-3 w-3"}),j?"Last modified:":"最后修改:"," ",ue(d[d.length-1].timestamp)]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(D,{variant:"outline",size:"sm",onClick:()=>fe(s,"current"),disabled:!s,className:"flex-1",children:[P==="current"?e.jsx(Pt,{className:"h-4 w-4 mr-1 text-success"}):e.jsx(As,{className:"h-4 w-4 mr-1"}),P==="current"?j?"Copied!":"已复制":j?"Copy":"复制"]}),e.jsxs(D,{variant:"outline",size:"sm",onClick:async()=>{S(!0);try{await f()}finally{S(!1)}},disabled:T,className:"flex-1",children:[e.jsx(Mt,{className:me("h-4 w-4 mr-1",T&&"animate-spin")}),j?"Refresh":"刷新"]})]})]})]}),e.jsxs(De,{className:"group relative overflow-hidden hover:shadow-lg transition-all duration-300",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-primary/5 to-primary/10 opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none"}),e.jsx(at,{className:"pb-3 relative z-10",children:e.jsxs(rt,{className:"text-base flex items-center gap-2",children:[e.jsx("div",{className:"p-1.5 rounded-lg bg-primary/10",children:e.jsx(Vn,{className:"h-4 w-4 text-primary"})}),j?"Original Machine ID Backup":"原始机器码备份",r&&e.jsxs($e,{className:"ml-auto bg-primary/10 text-primary border-primary/20",children:[e.jsx(Bn,{className:"h-3 w-3 mr-1"}),j?"Backed Up":"已备份"]})]})}),e.jsx(Pe,{className:"space-y-4 relative z-10",children:r?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"p-4 bg-gradient-to-br from-primary/5 to-primary/10 rounded-xl font-mono text-sm break-all border border-primary/20",children:r}),e.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e.jsx(Bn,{className:"h-3 w-3 text-primary"}),j?"Backup time:":"备份时间:"," ",i?ue(i):j?"Unknown":"未知"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(D,{variant:"outline",size:"sm",onClick:()=>fe(r,"original"),className:"flex-1",children:[P==="original"?e.jsx(Pt,{className:"h-4 w-4 mr-1 text-success"}):e.jsx(As,{className:"h-4 w-4 mr-1"}),P==="original"?j?"Copied!":"已复制":j?"Copy":"复制"]}),e.jsxs(D,{variant:"outline",size:"sm",onClick:z,disabled:T||s===r,className:"flex-1 border-primary/50 hover:bg-primary/10 hover:text-primary",children:[e.jsx(gr,{className:"h-4 w-4 mr-1"}),j?"Restore":"恢复原始"]})]})]}):e.jsxs("div",{className:"p-6 text-center rounded-xl border-2 border-dashed border-muted",children:[e.jsx(Vn,{className:"h-8 w-8 mx-auto text-muted-foreground/50 mb-2"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:j?"Original ID will be backed up on first change":"首次修改机器码时将自动备份原始值"})]})})]})]}),e.jsxs(De,{className:"overflow-hidden",children:[e.jsx(at,{className:"bg-gradient-to-r from-primary/5 to-primary/10 border-b",children:e.jsxs(rt,{className:"text-base flex items-center gap-2",children:[e.jsx("div",{className:"p-1.5 rounded-lg bg-primary/10",children:e.jsx(Kn,{className:"h-4 w-4 text-primary"})}),j?"Operations":"机器码操作"]})}),e.jsxs(Pe,{className:"p-6 space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"group p-5 rounded-xl border-2 border-dashed hover:border-primary/50 hover:bg-primary/5 transition-all space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-gradient-to-br from-primary to-primary/80 text-white",children:e.jsx(Kn,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold",children:j?"Random Generate":"随机生成"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:j?"Generate UUID format machine ID":"一键生成 UUID 格式机器码"})]})]}),e.jsxs(D,{onClick:pe,disabled:T,className:"w-full bg-primary hover:bg-primary/90 text-primary-foreground shadow-lg shadow-primary/25",children:[e.jsx(Kn,{className:"h-4 w-4 mr-2"}),j?"Generate & Apply":"随机生成并应用"]})]}),e.jsxs("div",{className:"group p-5 rounded-xl border-2 border-dashed hover:border-primary/50 hover:bg-primary/5 transition-all space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-gradient-to-br from-primary/80 to-primary text-white",children:e.jsx(Nf,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold",children:j?"Custom Input":"自定义输入"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:j?"Enter a specific machine ID":"输入指定的机器码"})]})]}),e.jsx("input",{type:"text",placeholder:j?"Enter UUID format machine ID...":"输入 UUID 格式机器码...",value:G,onChange:we=>W(we.target.value),className:"w-full px-4 py-2.5 text-sm border-2 rounded-xl bg-background focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary transition-all"}),e.jsx(D,{onClick:C,disabled:T||!G.trim(),variant:"outline",className:"w-full border-2 hover:bg-primary/10 hover:border-primary/50",children:j?"Apply Custom ID":"应用自定义机器码"})]})]}),e.jsxs("div",{className:"flex gap-3 pt-4 border-t",children:[e.jsxs(D,{variant:"outline",size:"sm",onClick:X,disabled:!s,className:"flex-1 h-10",children:[e.jsx(Ns,{className:"h-4 w-4 mr-2"}),j?"Export to File":"导出到文件"]}),e.jsxs(D,{variant:"outline",size:"sm",onClick:re,disabled:T,className:"flex-1 h-10",children:[e.jsx(Fa,{className:"h-4 w-4 mr-2"}),j?"Import from File":"从文件导入"]})]})]})]}),e.jsxs(De,{className:"overflow-hidden",children:[e.jsx(at,{className:"bg-gradient-to-r from-primary/5 to-primary/10 border-b",children:e.jsxs(rt,{className:"text-base flex items-center gap-2",children:[e.jsx("div",{className:"p-1.5 rounded-lg bg-primary/10",children:e.jsx(ql,{className:"h-4 w-4 text-primary"})}),j?"Automation":"自动化设置"]})}),e.jsxs(Pe,{className:"p-0 divide-y",children:[e.jsxs("div",{className:"flex items-center justify-between p-5 hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:me("p-2.5 rounded-xl transition-colors",n.autoSwitchOnAccountChange?"bg-primary/10":"bg-muted"),children:e.jsx(Mt,{className:me("h-5 w-5 transition-colors",n.autoSwitchOnAccountChange?"text-primary":"text-muted-foreground")})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:j?"Auto Change on Switch":"切换账号时自动更换机器码"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:j?"Auto generate new ID when switching accounts":"每次切换账号时自动生成并应用新的机器码"})]})]}),e.jsx(D,{variant:n.autoSwitchOnAccountChange?"default":"outline",size:"sm",onClick:()=>h({autoSwitchOnAccountChange:!n.autoSwitchOnAccountChange}),className:me("min-w-[80px]",n.autoSwitchOnAccountChange&&"bg-primary hover:bg-primary/90"),children:n.autoSwitchOnAccountChange?j?"On":"已开启":j?"Off":"已关闭"})]}),e.jsxs("div",{className:"flex items-center justify-between p-5 hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:me("p-2.5 rounded-xl transition-colors",n.bindMachineIdToAccount?"bg-primary/10":"bg-muted"),children:e.jsx(ql,{className:me("h-5 w-5 transition-colors",n.bindMachineIdToAccount?"text-primary":"text-muted-foreground")})}),e.jsxs("div",{children:[e.jsxs("p",{className:"font-medium flex items-center gap-2",children:[j?"Account ID Binding":"账户机器码绑定",L>0&&e.jsx($e,{className:"bg-primary/10 text-primary border-primary/20",children:j?`${L} accounts`:`${L} 个账户`})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:j?"Assign unique ID per account, auto-apply on switch":"为每个账户分配唯一的机器码,切换时自动使用"})]})]}),e.jsx(D,{variant:n.bindMachineIdToAccount?"default":"outline",size:"sm",onClick:()=>h({bindMachineIdToAccount:!n.bindMachineIdToAccount}),className:me("min-w-[80px]",n.bindMachineIdToAccount&&"bg-primary hover:bg-primary/90"),children:n.bindMachineIdToAccount?j?"On":"已开启":j?"Off":"已关闭"})]}),n.bindMachineIdToAccount&&e.jsxs("div",{className:"flex items-center justify-between p-5 pl-16 bg-muted/30 hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:me("p-2 rounded-lg transition-colors",n.useBindedMachineId?"bg-primary/10":"bg-muted"),children:e.jsx(Bn,{className:me("h-4 w-4 transition-colors",n.useBindedMachineId?"text-primary":"text-muted-foreground")})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:j?"Use bound machine ID":"使用绑定的唯一机器码"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:j?"When off, generates new ID on each switch":"关闭时每次切换将随机生成新机器码"})]})]}),e.jsx(D,{variant:n.useBindedMachineId?"default":"outline",size:"sm",onClick:()=>h({useBindedMachineId:!n.useBindedMachineId}),className:me("min-w-[80px]",n.useBindedMachineId&&"bg-primary hover:bg-primary/90"),children:n.useBindedMachineId?j?"On":"已开启":j?"Off":"已关闭"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx(De,{className:"group cursor-pointer hover:shadow-lg transition-all duration-300 hover:border-primary/50",onClick:()=>le(!0),children:e.jsx(Pe,{className:"p-5",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"p-3 rounded-xl bg-gradient-to-br from-primary/10 to-primary/5 group-hover:from-primary/20 group-hover:to-primary/10 transition-colors",children:e.jsx(Fn,{className:"h-6 w-6 text-primary"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-semibold group-hover:text-primary transition-colors",children:j?"Account Machine ID":"账户机器码管理"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:j?"View and manage bound machine IDs":"查看和管理每个账户绑定的机器码"})]}),e.jsx("div",{className:"p-2 rounded-lg bg-muted group-hover:bg-primary/10 transition-colors",children:e.jsx(Nf,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors"})})]})})}),e.jsx(De,{className:"group cursor-pointer hover:shadow-lg transition-all duration-300 hover:border-primary/50",onClick:()=>q(!0),children:e.jsx(Pe,{className:"p-5",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"p-3 rounded-xl bg-gradient-to-br from-primary/10 to-primary/5 group-hover:from-primary/20 group-hover:to-primary/10 transition-colors",children:e.jsx(tc,{className:"h-6 w-6 text-primary"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-semibold group-hover:text-primary transition-colors",children:j?"Change History":"变更历史记录"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:j?`${d.length} records`:`共 ${d.length} 条历史记录`})]}),e.jsx("div",{className:"p-2 rounded-lg bg-muted group-hover:bg-primary/10 transition-colors",children:e.jsx(tc,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors"})})]})})})]}),V&&Tn.createPortal(e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:()=>le(!1)}),e.jsxs("div",{className:"relative bg-background rounded-xl shadow-2xl w-[600px] max-h-[80vh] flex flex-col animate-in fade-in zoom-in-95 duration-200",children:[e.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Fn,{className:"h-5 w-5"}),e.jsx("h2",{className:"text-lg font-semibold",children:j?"Account Machine ID":"账户机器码管理"}),e.jsxs($e,{variant:"secondary",children:[u.size," ",j?"accounts":"个账户"]})]}),e.jsx(D,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 rounded-lg hover:bg-red-500 hover:text-white transition-colors",onClick:()=>le(!1),children:e.jsx(ns,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"px-4 pt-4",children:e.jsxs("div",{className:"relative",children:[e.jsx(to,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx("input",{type:"text",value:te,onChange:we=>Y(we.target.value),placeholder:j?"Search accounts...":"搜索账户...",className:"w-full pl-9 pr-3 py-2 text-sm bg-muted border-0 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary"}),te&&e.jsx(D,{variant:"ghost",size:"sm",className:"absolute right-1 top-1/2 -translate-y-1/2 h-6 w-6 p-0",onClick:()=>Y(""),children:e.jsx(ns,{className:"h-3 w-3"})})]})}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-2",children:[Array.from(u.values()).filter(we=>{if(!te.trim())return!0;const Ue=te.toLowerCase();return we.email?.toLowerCase().includes(Ue)||we.nickname?.toLowerCase().includes(Ue)||o[we.id]?.toLowerCase().includes(Ue)}).map(we=>{const Ue=o[we.id],Lt=B===we.id;return e.jsxs("div",{className:"p-3 bg-muted rounded-lg",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-primary/10 flex items-center justify-center text-primary text-sm font-medium",children:(we.nickname||we.email||"?")[0].toUpperCase()}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-medium text-sm truncate max-w-[200px]",children:we.nickname||we.email}),we.nickname&&we.email&&e.jsx("span",{className:"text-xs text-muted-foreground truncate max-w-[200px]",children:we.email})]}),Ue&&e.jsx($e,{variant:"secondary",className:"text-xs bg-success/10 text-success",children:j?"Bound":"已绑定"})]}),e.jsx("div",{className:"flex items-center gap-1",children:Lt?e.jsxs(e.Fragment,{children:[e.jsxs(D,{variant:"default",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>Qe(we.id),children:[e.jsx(Pt,{className:"h-3.5 w-3.5 mr-1"}),j?"Save":"保存"]}),e.jsx(D,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:_e,children:j?"Cancel":"取消"}),e.jsx(D,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>st(we.id),title:j?"Random":"随机",children:e.jsx(Kn,{className:"h-3.5 w-3.5"})})]}):e.jsxs(e.Fragment,{children:[e.jsx(D,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>Ee(we.id),title:j?"Edit":"编辑",children:e.jsx(Nf,{className:"h-3.5 w-3.5"})}),e.jsx(D,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>st(we.id),title:j?"Random":"随机",children:e.jsx(Kn,{className:"h-3.5 w-3.5"})}),Ue&&e.jsxs(e.Fragment,{children:[e.jsx(D,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>fe(Ue),title:j?"Copy":"复制",children:e.jsx(As,{className:"h-3.5 w-3.5"})}),e.jsx(D,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-destructive hover:text-destructive",onClick:()=>oe(we.id),title:j?"Delete":"删除",children:e.jsx(Vt,{className:"h-3.5 w-3.5"})})]})]})})]}),Lt?e.jsx("input",{type:"text",value:K,onChange:xt=>se(xt.target.value),placeholder:j?"Enter UUID format machine ID":"输入 UUID 格式机器码",className:"w-full px-2 py-1.5 text-xs font-mono bg-background border rounded focus:outline-none focus:ring-2 focus:ring-primary",autoFocus:!0}):Ue?e.jsx("div",{className:"flex items-center gap-2 px-2 py-1.5 bg-background rounded border",children:e.jsx("code",{className:"text-xs font-mono flex-1",children:Ue})}):e.jsx("div",{className:"px-2 py-1.5 bg-background/50 rounded border border-dashed text-center",children:e.jsx("span",{className:"text-xs text-muted-foreground",children:j?"Not bound":"未绑定"})})]},we.id)}),u.size===0&&e.jsxs("div",{className:"text-center py-12",children:[e.jsx(Fn,{className:"h-12 w-12 mx-auto text-muted-foreground/50 mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:j?"No accounts":"暂无账户"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:j?"Please add accounts first":"请先添加账户"})]}),u.size>0&&te&&Array.from(u.values()).filter(we=>{const Ue=te.toLowerCase();return we.email?.toLowerCase().includes(Ue)||we.nickname?.toLowerCase().includes(Ue)||o[we.id]?.toLowerCase().includes(Ue)}).length===0&&e.jsxs("div",{className:"text-center py-8",children:[e.jsx(to,{className:"h-10 w-10 mx-auto text-muted-foreground/50 mb-3"}),e.jsx("p",{className:"text-muted-foreground",children:j?"No matches found":"未找到匹配的账户"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:j?"Try other keywords":"尝试其他关键词"})]})]}),e.jsx("div",{className:"px-6 py-3 border-t bg-muted/50 text-xs text-muted-foreground",children:j?"💡 Tip: After binding, switching to this account will auto-apply the bound machine ID":"💡 提示:绑定机器码后,切换到该账户时会自动应用对应的机器码"})]})]}),document.body),U&&Tn.createPortal(e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:()=>q(!1)}),e.jsxs("div",{className:"relative bg-background rounded-xl shadow-2xl w-[550px] max-h-[80vh] flex flex-col animate-in fade-in zoom-in-95 duration-200",children:[e.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(tc,{className:"h-5 w-5"}),e.jsx("h2",{className:"text-lg font-semibold",children:j?"Change History":"变更历史"}),e.jsxs($e,{variant:"secondary",children:[d.length," ",j?"records":"条"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[d.length>0&&e.jsxs(D,{variant:"ghost",size:"sm",onClick:b,className:"text-destructive hover:text-destructive",children:[e.jsx(Vt,{className:"h-4 w-4 mr-1"}),j?"Clear":"清空"]}),e.jsx(D,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 rounded-lg hover:bg-red-500 hover:text-white transition-colors",onClick:()=>q(!1),children:e.jsx(ns,{className:"h-4 w-4"})})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:d.length>0?e.jsx("div",{className:"space-y-2",children:[...d].reverse().map((we,Ue)=>e.jsxs("div",{className:"p-3 bg-muted rounded-lg",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:["#",d.length-Ue]}),e.jsxs($e,{variant:"secondary",className:me("text-xs whitespace-nowrap",we.action==="initial"&&"bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-300",we.action==="manual"&&"bg-purple-100 text-purple-700 dark:bg-purple-900 dark:text-purple-300",we.action==="auto_switch"&&"bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300",we.action==="restore"&&"bg-orange-100 text-orange-700 dark:bg-orange-900 dark:text-orange-300",we.action==="bind"&&"bg-cyan-100 text-cyan-700 dark:bg-cyan-900 dark:text-cyan-300"),children:[we.action==="initial"&&(j?"Init":"初始"),we.action==="manual"&&(j?"Manual":"手动"),we.action==="auto_switch"&&(j?"Auto":"自动"),we.action==="restore"&&(j?"Restore":"恢复"),we.action==="bind"&&(j?"Bind":"绑定")]})]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:ue(we.timestamp)})]}),e.jsxs("div",{className:"flex items-center gap-2 p-2 bg-background rounded border",children:[e.jsx("code",{className:"text-sm flex-1 font-mono",children:we.machineId}),e.jsx(D,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 shrink-0",onClick:()=>fe(we.machineId),title:j?"Copy":"复制",children:e.jsx(As,{className:"h-3 w-3"})})]}),we.accountId&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:[j?"Account: ":"关联账户: ",u.get(we.accountId)?.nickname||u.get(we.accountId)?.email||we.accountId]})]},we.id))}):e.jsxs("div",{className:"text-center py-12",children:[e.jsx(tc,{className:"h-12 w-12 mx-auto text-muted-foreground/50 mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:j?"No change records":"暂无变更记录"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:j?"Changes will be recorded automatically":"机器码变更后将自动记录"})]})})]})]}),document.body),e.jsx(De,{className:"overflow-hidden bg-gradient-to-br from-muted/50 to-muted/30",children:e.jsx(Pe,{className:"p-5",children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"p-2.5 rounded-xl bg-primary/10 shrink-0",children:e.jsx(Vn,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"font-semibold",children:j?"Platform Notes":"平台说明"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"p-3 rounded-lg bg-primary/5 border border-primary/10",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(Vl,{className:"h-4 w-4 text-primary"}),e.jsx("span",{className:"font-medium text-sm",children:"Windows"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:j?"Modifies registry MachineGuid, requires admin":"修改注册表 MachineGuid,需要管理员权限"})]}),e.jsxs("div",{className:"p-3 rounded-lg bg-primary/5 border border-primary/10",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(Vl,{className:"h-4 w-4 text-primary"}),e.jsx("span",{className:"font-medium text-sm",children:"macOS"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:j?"App-level override, hardware UUID unchanged":"应用层覆盖方式,原生硬件 UUID 无法修改"})]}),e.jsxs("div",{className:"p-3 rounded-lg bg-primary/5 border border-primary/10",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(Vl,{className:"h-4 w-4 text-primary"}),e.jsx("span",{className:"font-medium text-sm",children:"Linux"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:j?"Modifies /etc/machine-id, requires root":"修改 /etc/machine-id,需要 root 权限"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg bg-warning/10 border border-warning/20",children:[e.jsx(Rs,{className:"h-4 w-4 text-warning shrink-0"}),e.jsx("p",{className:"text-xs text-warning",children:j?"Changing machine ID may affect some software licenses, proceed with caution":"修改机器码可能影响部分软件的授权,请谨慎操作"})]})]})]})})})]})}function AI({filename:n,onClose:s,onSaved:r}){const[i,o]=g.useState(""),[d,u]=g.useState(!0),[h,f]=g.useState(!1),[p,y]=g.useState(null),[b,v]=g.useState(!1),{t:N}=Ut(),j=N("common.unknown")==="Unknown";g.useEffect(()=>{T()},[n]);const T=async()=>{u(!0),y(null);try{const I=await window.api.readKiroSteeringFile(n);I.success&&I.content!==void 0?(o(I.content),v(!1)):y(I.error||(j?"Failed to read file":"读取文件失败"))}catch(I){y(j?"Failed to read file":"读取文件失败"),console.error(I)}finally{u(!1)}},S=async()=>{f(!0),y(null);try{const I=await window.api.saveKiroSteeringFile(n,i);I.success?(v(!1),r?.()):y(I.error||(j?"Failed to save file":"保存文件失败"))}catch(I){y(j?"Failed to save file":"保存文件失败"),console.error(I)}finally{f(!1)}},k=()=>{b?confirm(j?"File modified. Close anyway? Unsaved changes will be lost.":"文件已修改,确定要关闭吗?未保存的更改将丢失。")&&s():s()},R=I=>{o(I),v(!0)};return Tn.createPortal(e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:k}),e.jsxs("div",{className:"relative bg-background rounded-lg shadow-xl w-[90vw] max-w-4xl h-[80vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"font-semibold",children:j?"Edit Steering File":"编辑 Steering 文件"}),e.jsx("span",{className:"text-sm text-muted-foreground font-mono",children:n}),b&&e.jsxs("span",{className:"text-xs text-warning",children:["● ",j?"Modified":"已修改"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(D,{variant:"ghost",size:"sm",onClick:T,disabled:d,children:e.jsx(Mt,{className:`h-4 w-4 ${d?"animate-spin":""}`})}),e.jsxs(D,{variant:"default",size:"sm",onClick:S,disabled:h||!b,children:[e.jsx(bx,{className:"h-4 w-4 mr-1"}),h?j?"Saving...":"保存中...":j?"Save":"保存"]}),e.jsx(D,{variant:"ghost",size:"sm",onClick:k,children:e.jsx(ns,{className:"h-4 w-4"})})]})]}),p&&e.jsx("div",{className:"px-4 py-2 bg-destructive/10 text-destructive text-sm",children:p}),e.jsx("div",{className:"flex-1 p-4 overflow-hidden",children:d?e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx(Mt,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):e.jsx("textarea",{value:i,onChange:I=>R(I.target.value),className:"w-full h-full p-4 font-mono text-sm bg-muted rounded-lg border-0 resize-none focus:outline-none focus:ring-2 focus:ring-primary",placeholder:j?"Edit steering rules here...":"在此编辑 Steering 规则...",spellCheck:!1})}),e.jsx("div",{className:"px-4 py-2 border-t text-xs text-muted-foreground",children:j?"Tip: Steering files use Markdown format to define AI assistant behavior rules":"提示:Steering 文件使用 Markdown 格式,用于定义 AI 助手的行为规则"})]})]}),document.body)}function MI({serverName:n,server:s,onClose:r,onSaved:i}){const[o,d]=g.useState(n||""),[u,h]=g.useState(s?.command||""),[f,p]=g.useState(s?.args||[]),[y,b]=g.useState(s?.env?Object.entries(s.env).map(([B,be])=>({key:B,value:be})):[]),[v,N]=g.useState(!1),[j,T]=g.useState(null),[S,k]=g.useState(""),R=!!n,{t:I}=Ut(),M=I("common.unknown")==="Unknown",G=async()=>{if(!o.trim()){T(M?"Please enter server name":"请输入服务器名称");return}if(!u.trim()){T(M?"Please enter command":"请输入命令");return}N(!0),T(null);try{const B={command:u.trim(),args:f.filter(K=>K.trim()),env:y.reduce((K,{key:se,value:te})=>(se.trim()&&(K[se.trim()]=te),K),{})};B.args?.length===0&&delete B.args,Object.keys(B.env||{}).length===0&&delete B.env;const be=await window.api.saveMcpServer(o.trim(),B,R?n:void 0);be.success?(i(),r()):T(be.error||(M?"Save failed":"保存失败"))}catch(B){T(M?"Save failed":"保存失败"),console.error(B)}finally{N(!1)}},W=()=>{S.trim()&&(p([...f,S.trim()]),k(""))},U=B=>{p(f.filter((be,K)=>K!==B))},q=()=>{b([...y,{key:"",value:""}])},V=(B,be,K)=>{const se=[...y];se[B][be]=K,b(se)},le=B=>{b(y.filter((be,K)=>K!==B))};return Tn.createPortal(e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:r}),e.jsxs("div",{className:"relative bg-background rounded-lg shadow-xl w-[90vw] max-w-lg max-h-[80vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b",children:[e.jsx("h2",{className:"font-semibold",children:R?M?"Edit MCP Server":"编辑 MCP 服务器":M?"Add MCP Server":"添加 MCP 服务器"}),e.jsx(D,{variant:"ghost",size:"sm",onClick:r,children:e.jsx(ns,{className:"h-4 w-4"})})]}),j&&e.jsx("div",{className:"px-4 py-2 bg-destructive/10 text-destructive text-sm",children:j}),e.jsxs("div",{className:"flex-1 p-4 space-y-4 overflow-auto",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1",children:M?"Server Name":"服务器名称"}),e.jsx("input",{type:"text",value:o,onChange:B=>d(B.target.value),placeholder:M?"e.g.: fetch, exa, context7":"例如: fetch, exa, context7",className:"w-full px-3 py-2 rounded-md border bg-background text-sm",disabled:R})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1",children:M?"Command":"命令"}),e.jsx("input",{type:"text",value:u,onChange:B=>h(B.target.value),placeholder:M?"e.g.: uvx, npx, node":"例如: uvx, npx, node",className:"w-full px-3 py-2 rounded-md border bg-background text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1",children:M?"Arguments":"参数"}),e.jsxs("div",{className:"space-y-2",children:[f.map((B,be)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx("code",{className:"flex-1 px-2 py-1 bg-muted rounded text-sm",children:B}),e.jsx(D,{variant:"ghost",size:"sm",onClick:()=>U(be),children:e.jsx(Vt,{className:"h-4 w-4 text-destructive"})})]},be)),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:S,onChange:B=>k(B.target.value),placeholder:M?"Add argument":"添加参数",className:"flex-1 px-3 py-1.5 rounded-md border bg-background text-sm",onKeyDown:B=>B.key==="Enter"&&W()}),e.jsx(D,{variant:"outline",size:"sm",onClick:W,children:e.jsx(Ts,{className:"h-4 w-4"})})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1",children:M?"Environment Variables":"环境变量"}),e.jsxs("div",{className:"space-y-2",children:[y.map((B,be)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:B.key,onChange:K=>V(be,"key",K.target.value),placeholder:M?"Key":"变量名",className:"w-1/3 px-2 py-1.5 rounded-md border bg-background text-sm"}),e.jsx("input",{type:"text",value:B.value,onChange:K=>V(be,"value",K.target.value),placeholder:M?"Value":"值",className:"flex-1 px-2 py-1.5 rounded-md border bg-background text-sm"}),e.jsx(D,{variant:"ghost",size:"sm",onClick:()=>le(be),children:e.jsx(Vt,{className:"h-4 w-4 text-destructive"})})]},be)),e.jsxs(D,{variant:"outline",size:"sm",onClick:q,children:[e.jsx(Ts,{className:"h-4 w-4 mr-1"}),M?"Add Env Var":"添加环境变量"]})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 px-4 py-3 border-t",children:[e.jsx(D,{variant:"outline",onClick:r,children:M?"Cancel":"取消"}),e.jsxs(D,{onClick:G,disabled:v,children:[e.jsx(bx,{className:"h-4 w-4 mr-1"}),v?M?"Saving...":"保存中...":M?"Save":"保存"]})]})]})]}),document.body)}const EI=["rm -rf *","rm -rf /","rm -rf ~","del /f /s /q *","format","mkfs","dd if=",":(){:|:&};:","chmod -R 777 /","chown -R","> /dev/sda","wget * | sh","curl * | sh","shutdown","reboot","init 0","init 6"],sj={agentAutonomy:"Autopilot",modelSelection:"auto",enableDebugLogs:!1,enableTabAutocomplete:!1,enableCodebaseIndexing:!1,usageSummary:!0,codeReferences:!1,configureMCP:"Enabled",trustedCommands:[],trustedTools:{},commandDenylist:[],ignoreFiles:[],mcpApprovedEnvVars:[],notificationsActionRequired:!0,notificationsFailure:!1,notificationsSuccess:!1,notificationsBilling:!0},II=[{value:"Autopilot",label:"Autopilot (自动执行)",description:"Agent 自动执行任务"},{value:"Supervised",label:"Supervised (需确认)",description:"每个步骤需要手动确认"}],RI=[{value:"Autopilot",label:"Autopilot (Auto)",description:"Agent executes tasks automatically"},{value:"Supervised",label:"Supervised (Confirm)",description:"Manual confirmation for each step"}],DI=[{value:"Enabled",label:"启用",description:"允许 MCP 服务器连接"},{value:"Disabled",label:"禁用",description:"禁用所有 MCP 功能"}],PI=[{value:"Enabled",label:"Enabled",description:"Allow MCP server connections"},{value:"Disabled",label:"Disabled",description:"Disable all MCP features"}];function LI(){const[n,s]=g.useState(sj),[r,i]=g.useState({mcpServers:{}}),[o,d]=g.useState([]),[u,h]=g.useState(!0),[f,p]=g.useState(!1),[y,b]=g.useState(null),[v,N]=g.useState([]),[j,T]=g.useState(!1),[S,k]=g.useState({agent:!0,mcp:!0,steering:!0,commands:!1}),[R,I]=g.useState(""),[M,G]=g.useState(""),[W,U]=g.useState(""),[q,V]=g.useState(null),[le,B]=g.useState(null),{t:be}=Ut(),K=be("common.unknown")==="Unknown",se=K?RI:II,te=K?PI:DI;g.useEffect(()=>{P(),Y()},[]);const Y=async()=>{T(!0);try{const ae=await window.api.getKiroAvailableModels();ae.models&&ae.models.length>0&&N(ae.models)}catch(ae){console.error("Failed to load models:",ae)}finally{T(!1)}},P=async()=>{h(!0),b(null);try{const ae=await window.api.getKiroSettings();if(ae.settings){const L=Object.fromEntries(Object.entries(ae.settings).filter(([,we])=>we!==void 0));s({...sj,...L})}ae.mcpConfig&&i(ae.mcpConfig),ae.steeringFiles&&d(ae.steeringFiles)}catch(ae){b(K?"Failed to load Kiro settings":"加载 Kiro 设置失败"),console.error(ae)}finally{h(!1)}},F=async()=>{p(!0),b(null);try{await window.api.saveKiroSettings(n)}catch(ae){b(K?"Failed to save settings":"保存设置失败"),console.error(ae)}finally{p(!1)}},fe=ae=>{k(L=>({...L,[ae]:!L[ae]}))},pe=async()=>{try{await window.api.openKiroSettingsFile()}catch(ae){console.error(ae)}},C=async ae=>{try{await window.api.openKiroMcpConfig(ae)}catch(L){console.error(L)}},z=async()=>{try{await window.api.openKiroSteeringFolder()}catch(ae){console.error(ae)}},X=ae=>{V(ae)},re=async ae=>{try{await window.api.openKiroSteeringFile(ae)}catch(L){console.error(L)}},xe=async()=>{try{(await window.api.createKiroDefaultRules()).success&&await P()}catch(ae){console.error(ae)}},Oe=async ae=>{if(confirm(K?`Delete "${ae}"? This cannot be undone.`:`确定要删除 "${ae}" 吗?此操作无法撤销。`))try{const L=await window.api.deleteKiroSteeringFile(ae);L.success?await P():b(L.error||(K?"Failed to delete file":"删除文件失败"))}catch(L){console.error(L),b(K?"Failed to delete file":"删除文件失败")}},Ee=async ae=>{if(confirm(K?`Delete MCP server "${ae}"?`:`确定要删除 MCP 服务器 "${ae}" 吗?`))try{const L=await window.api.deleteMcpServer(ae);L.success?await P():b(L.error||(K?"Failed to delete server":"删除服务器失败"))}catch(L){console.error(L),b(K?"Failed to delete server":"删除服务器失败")}},Qe=()=>{R.trim()&&(s(ae=>({...ae,trustedCommands:[...ae.trustedCommands,R.trim()]})),I(""))},_e=ae=>{s(L=>({...L,trustedCommands:L.trustedCommands.filter((we,Ue)=>Ue!==ae)}))},st=()=>{W.trim()&&(s(ae=>({...ae,commandDenylist:[...ae.commandDenylist,W.trim()]})),U(""))},oe=()=>{s(ae=>{const L=EI.filter(we=>!ae.commandDenylist.includes(we));return{...ae,commandDenylist:[...ae.commandDenylist,...L]}})},ue=ae=>{s(L=>({...L,commandDenylist:L.commandDenylist.filter((we,Ue)=>Ue!==ae)}))};return u?e.jsx("div",{className:"flex-1 p-6 flex items-center justify-center",children:e.jsx(Mt,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):e.jsxs("div",{className:"flex-1 p-6 space-y-6 overflow-auto",children:[e.jsxs("div",{className:"page-hero p-6",children:[e.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-primary/20 to-transparent rounded-full blur-2xl"}),e.jsx("div",{className:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-primary/20 to-transparent rounded-full blur-2xl"}),e.jsxs("div",{className:"relative flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"p-3 rounded-xl bg-primary shadow-lg shadow-primary/25",children:e.jsx(Hi,{className:"h-6 w-6 text-primary-foreground"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-primary",children:K?"Kiro Settings":"Kiro 设置"}),e.jsx("p",{className:"text-muted-foreground",children:K?"Manage Kiro IDE config, MCP servers and user rules":"管理 Kiro IDE 的配置、MCP 服务器和用户规则"})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(D,{variant:"outline",size:"sm",onClick:P,className:"bg-background/50 backdrop-blur-sm",children:[e.jsx(Mt,{className:"h-4 w-4 mr-2"}),K?"Refresh":"刷新"]}),e.jsxs(D,{variant:"outline",size:"sm",onClick:pe,className:"bg-background/50 backdrop-blur-sm",children:[e.jsx(Xs,{className:"h-4 w-4 mr-2"}),K?"Open File":"打开设置文件"]}),e.jsxs(D,{size:"sm",onClick:F,disabled:f,children:[e.jsx(bx,{className:"h-4 w-4 mr-2"}),f?K?"Saving...":"保存中...":K?"Save":"保存设置"]})]})]})]}),y&&e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-destructive/10 text-destructive rounded-lg",children:[e.jsx(ln,{className:"h-4 w-4"}),y]}),e.jsxs(De,{className:"hover-lift",children:[e.jsx(at,{className:"pb-2 cursor-pointer hover:bg-muted/30 transition-colors rounded-t-lg",onClick:()=>fe("agent"),children:e.jsxs(rt,{className:"text-base flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10",children:e.jsx(Ka,{className:"h-4 w-4 text-primary"})}),e.jsx("span",{children:K?"Agent Settings":"Agent 设置"})]}),S.agent?e.jsx(zi,{className:"h-4 w-4"}):e.jsx(va,{className:"h-4 w-4"})]})}),S.agent&&e.jsxs(Pe,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:K?"Agent Autonomy":"Agent 自主模式"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:K?"Determines whether the agent will ask for accept/reject at each checkpoint in the workflow.":"决定 Agent 在工作流的每个检查点是否要求接受/拒绝"})]}),e.jsx(ei,{value:n.agentAutonomy,options:se,onChange:ae=>s(L=>({...L,agentAutonomy:ae})),className:"w-[200px]"})]}),e.jsxs("div",{className:"flex items-center justify-between border-t pt-4",children:[e.jsxs("div",{className:"flex-1 mr-4",children:[e.jsx("p",{className:"font-medium",children:K?"Model Selection":"模型选择"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:K?"Select model to use for agent operations.":"选择 Agent 操作使用的模型"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[v.length>0?e.jsx(ei,{value:n.modelSelection,options:v.map(ae=>({value:ae.id,label:ae.name||ae.id,description:ae.description})),onChange:ae=>s(L=>({...L,modelSelection:ae})),className:"w-[240px]"}):e.jsx("input",{type:"text",value:n.modelSelection,onChange:ae=>s(L=>({...L,modelSelection:ae.target.value})),placeholder:"claude-haiku-4.5",className:"w-[240px] px-3 py-1.5 rounded-md border bg-background text-sm"}),e.jsx(D,{variant:"ghost",size:"sm",onClick:Y,disabled:j,title:K?"Refresh models":"刷新模型列表",children:e.jsx(Mt,{className:`h-4 w-4 ${j?"animate-spin":""}`})})]})]}),e.jsxs("div",{className:"border-t pt-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:K?"Enable Tab Autocomplete":"Tab 自动补全"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:K?"Tab Autocomplete allows Kiro Agent to provide code suggestions in the editor as you type.":"Tab 自动补全允许 Kiro Agent 在输入时提供代码建议"})]}),e.jsx(Pa,{checked:n.enableTabAutocomplete,onChange:ae=>s(L=>({...L,enableTabAutocomplete:ae}))})]}),e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:K?"Usage Summary":"使用统计"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:K?"Display usage summary and elapsed time for agent executions.":"显示 Agent 执行的用量摘要和耗时"})]}),e.jsx(Pa,{checked:n.usageSummary,onChange:ae=>s(L=>({...L,usageSummary:ae}))})]}),e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:K?"Code References: Reference Tracker":"代码引用追踪"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:K?"Allow Kiro to generate code with code references. Sometimes code generated by Kiro may be similar to publicly available code.":"允许 Kiro 生成带代码引用的代码。Kiro 生成的代码可能与公开可用代码相似。"})]}),e.jsx(Pa,{checked:n.codeReferences,onChange:ae=>s(L=>({...L,codeReferences:ae}))})]}),e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:K?"Enable Codebase Indexing":"代码库索引"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:K?"Enable Repo Indexing (Experimental). This is an experimental feature which does not work with multi-folder workspaces.":"启用仓库索引(实验性)。这是一个实验性功能,不支持多文件夹工作区。"})]}),e.jsx(Pa,{checked:n.enableCodebaseIndexing,onChange:ae=>s(L=>({...L,enableCodebaseIndexing:ae}))})]}),e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:K?"Enable Debug Logs":"调试日志"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:K?"Enable Kiro Debug Logs in the Output panel.":"在输出面板启用 Kiro 调试日志"})]}),e.jsx(Pa,{checked:n.enableDebugLogs,onChange:ae=>s(L=>({...L,enableDebugLogs:ae}))})]})]}),e.jsxs("div",{className:"border-t pt-4",children:[e.jsx("p",{className:"font-medium mb-3",children:K?"Notifications":"通知设置"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:K?"Agent: Action Required":"Agent: 需要操作"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:K?"Show desktop notification when the agent requires input, e.g. for a shell command.":"Agent 需要输入时显示桌面通知,如执行 Shell 命令时"})]}),e.jsx(Pa,{checked:n.notificationsActionRequired,onChange:ae=>s(L=>({...L,notificationsActionRequired:ae}))})]}),e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:K?"Agent: Failure":"Agent: 失败"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:K?"Show desktop notification when the agent encounters an unexpected failure.":"Agent 遇到意外失败时显示桌面通知"})]}),e.jsx(Pa,{checked:n.notificationsFailure,onChange:ae=>s(L=>({...L,notificationsFailure:ae}))})]}),e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:K?"Agent: Success":"Agent: 成功"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:K?"Show desktop notifications when the agent successfully completes a task.":"Agent 成功完成任务时显示桌面通知"})]}),e.jsx(Pa,{checked:n.notificationsSuccess,onChange:ae=>s(L=>({...L,notificationsSuccess:ae}))})]}),e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:K?"Billing":"账单"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:K?"Show in-app notifications for billing and usage events (usage resets, low resources, overages).":"显示账单和用量事件的应用内通知(用量重置、资源不足、超额)"})]}),e.jsx(Pa,{checked:n.notificationsBilling,onChange:ae=>s(L=>({...L,notificationsBilling:ae}))})]})]})]})]})]}),e.jsxs(De,{className:"hover-lift",children:[e.jsx(at,{className:"pb-2 cursor-pointer hover:bg-muted/30 transition-colors rounded-t-lg",onClick:()=>fe("mcp"),children:e.jsxs(rt,{className:"text-base flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10",children:e.jsx(Ds,{className:"h-4 w-4 text-primary"})}),e.jsx("span",{children:K?"MCP Servers":"MCP 服务器"}),e.jsx("span",{className:"px-2 py-0.5 text-xs rounded-full bg-primary/10 text-primary",children:Object.keys(r.mcpServers).length})]}),S.mcp?e.jsx(zi,{className:"h-4 w-4"}):e.jsx(va,{className:"h-4 w-4"})]})}),S.mcp&&e.jsxs(Pe,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:K?"Enable MCP":"启用 MCP"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:K?"Allow connections to external tools and data sources":"允许连接外部工具和数据源"})]}),e.jsx(ei,{value:n.configureMCP,options:te,onChange:ae=>s(L=>({...L,configureMCP:ae}))})]}),e.jsxs("div",{className:"border-t pt-4",children:[e.jsx("p",{className:"font-medium mb-2",children:K?"Configured MCP Servers":"已配置的 MCP 服务器"}),Object.keys(r.mcpServers).length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:K?"No MCP servers configured":"暂无配置的 MCP 服务器"}):e.jsx("div",{className:"space-y-2",children:Object.entries(r.mcpServers).map(([ae,L])=>e.jsxs("div",{className:"flex items-center justify-between p-2 bg-muted rounded-md",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-medium text-sm",children:ae}),e.jsx("p",{className:"text-xs text-muted-foreground font-mono",children:L.command})]}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx("button",{className:"p-1 hover:bg-background rounded transition-colors",onClick:()=>B({name:ae,server:L}),title:K?"Edit":"编辑",children:e.jsx(Ou,{className:"h-4 w-4 text-primary"})}),e.jsx("button",{className:"p-1 hover:bg-background rounded transition-colors",onClick:()=>Ee(ae),title:K?"Delete":"删除",children:e.jsx(Vt,{className:"h-4 w-4 text-destructive"})})]})]},ae))})]}),e.jsxs("div",{className:"flex gap-2 pt-2",children:[e.jsxs(D,{variant:"outline",size:"sm",onClick:()=>B({}),children:[e.jsx(Ts,{className:"h-4 w-4 mr-2"}),K?"Add MCP Server":"添加 MCP 服务器"]}),e.jsxs(D,{variant:"outline",size:"sm",onClick:()=>C("user"),children:[e.jsx(Vi,{className:"h-4 w-4 mr-2"}),K?"User MCP Config":"用户 MCP 配置"]}),e.jsxs(D,{variant:"outline",size:"sm",onClick:()=>C("workspace"),children:[e.jsx(Vi,{className:"h-4 w-4 mr-2"}),K?"Workspace MCP Config":"工作区 MCP 配置"]})]})]})]}),e.jsxs(De,{className:"hover-lift",children:[e.jsx(at,{className:"pb-2 cursor-pointer hover:bg-muted/30 transition-colors rounded-t-lg",onClick:()=>fe("steering"),children:e.jsxs(rt,{className:"text-base flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10",children:e.jsx(xr,{className:"h-4 w-4 text-primary"})}),e.jsx("span",{children:K?"User Rules (Steering)":"用户规则 (Steering)"}),e.jsxs("span",{className:"px-2 py-0.5 text-xs rounded-full bg-primary/10 text-primary",children:[o.length," ",K?"files":"个文件"]})]}),S.steering?e.jsx(zi,{className:"h-4 w-4"}):e.jsx(va,{className:"h-4 w-4"})]})}),S.steering&&e.jsxs(Pe,{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:K?"Steering files define AI assistant behavior rules and context":"Steering 文件用于定义 AI 助手的行为规则和上下文"}),o.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:K?"No steering files":"暂无 Steering 文件"}):e.jsx("div",{className:"space-y-2",children:o.map((ae,L)=>e.jsxs("div",{className:"flex items-center gap-2 p-2 bg-muted rounded-md",children:[e.jsx(xr,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-mono flex-1",children:ae}),e.jsx("button",{className:"p-1 hover:bg-background rounded transition-colors",onClick:()=>X(ae),title:K?"Edit internally":"内部编辑",children:e.jsx(Ou,{className:"h-4 w-4 text-primary"})}),e.jsx("button",{className:"p-1 hover:bg-background rounded transition-colors",onClick:()=>re(ae),title:K?"Open externally":"外部打开",children:e.jsx(Xs,{className:"h-4 w-4 text-muted-foreground"})}),e.jsx("button",{className:"p-1 hover:bg-background rounded transition-colors",onClick:()=>Oe(ae),title:K?"Delete":"删除",children:e.jsx(Vt,{className:"h-4 w-4 text-destructive"})})]},L))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(D,{variant:"outline",size:"sm",onClick:xe,children:[e.jsx(Ts,{className:"h-4 w-4 mr-2"}),K?"Create Rules":"创建规则文件"]}),e.jsxs(D,{variant:"outline",size:"sm",onClick:z,children:[e.jsx(Vi,{className:"h-4 w-4 mr-2"}),K?"Open Steering Folder":"打开 Steering 目录"]})]})]})]}),e.jsxs(De,{className:"hover-lift",children:[e.jsx(at,{className:"pb-2 cursor-pointer hover:bg-muted/30 transition-colors rounded-t-lg",onClick:()=>fe("commands"),children:e.jsxs(rt,{className:"text-base flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10",children:e.jsx(YN,{className:"h-4 w-4 text-primary"})}),e.jsx("span",{children:K?"Command Config":"命令配置"})]}),S.commands?e.jsx(zi,{className:"h-4 w-4"}):e.jsx(va,{className:"h-4 w-4"})]})}),S.commands&&e.jsxs(Pe,{className:"space-y-6",children:[e.jsxs("div",{className:"p-4 rounded-lg bg-muted/50 border border-border",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(Vn,{className:"h-4 w-4 text-primary"}),e.jsx("p",{className:"font-medium",children:K?"Trusted Commands":"信任的命令"})]}),e.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:K?"These commands will auto-execute without confirmation":"这些命令将自动执行,无需确认"}),e.jsxs("div",{className:"space-y-2",children:[n.trustedCommands.map((ae,L)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"flex-1 px-2 py-1 bg-muted rounded text-sm",children:ae}),e.jsx(D,{variant:"ghost",size:"sm",onClick:()=>_e(L),children:e.jsx(Vt,{className:"h-4 w-4 text-destructive"})})]},L)),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:R,onChange:ae=>I(ae.target.value),placeholder:K?"e.g.: npm *":"如: npm *",className:"flex-1 px-3 py-1.5 rounded-md border bg-background text-sm",onKeyDown:ae=>ae.key==="Enter"&&Qe()}),e.jsx(D,{variant:"outline",size:"sm",onClick:Qe,children:e.jsx(Ts,{className:"h-4 w-4"})})]})]})]}),e.jsxs("div",{className:"p-4 rounded-lg bg-muted/50 border border-border",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(Ds,{className:"h-4 w-4 text-primary"}),e.jsx("p",{className:"font-medium",children:K?"Trusted Tools":"信任的工具"})]}),e.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:K?"Tools to auto-accept if requested by the Agent. Each tool name maps to a boolean indicating whether it should be trusted.":"当 Agent 请求使用这些工具时自动批准。每个工具名称对应是否信任的布尔值。"}),e.jsxs("div",{className:"space-y-2",children:[Object.entries(n.trustedTools).map(([ae,L])=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"flex-1 px-2 py-1 bg-muted rounded text-sm",children:ae}),e.jsx(Pa,{checked:L,onChange:we=>s(Ue=>({...Ue,trustedTools:{...Ue.trustedTools,[ae]:we}}))}),e.jsx(D,{variant:"ghost",size:"sm",onClick:()=>{s(we=>{const Ue={...we.trustedTools};return delete Ue[ae],{...we,trustedTools:Ue}})},children:e.jsx(Vt,{className:"h-4 w-4 text-destructive"})})]},ae)),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:M,onChange:ae=>G(ae.target.value),placeholder:K?"Tool name":"工具名称",className:"flex-1 px-3 py-1.5 rounded-md border bg-background text-sm",onKeyDown:ae=>{ae.key==="Enter"&&M.trim()&&(s(L=>({...L,trustedTools:{...L.trustedTools,[M.trim()]:!0}})),G(""))}}),e.jsx(D,{variant:"outline",size:"sm",onClick:()=>{M.trim()&&(s(ae=>({...ae,trustedTools:{...ae.trustedTools,[M.trim()]:!0}})),G(""))},children:e.jsx(Ts,{className:"h-4 w-4"})})]})]})]}),e.jsxs("div",{className:"p-4 rounded-lg bg-destructive/5 border border-destructive/20",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(ln,{className:"h-4 w-4 text-destructive"}),e.jsx("p",{className:"font-medium text-destructive",children:K?"Blocked Commands":"禁止的命令"})]}),e.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:K?"These commands always require manual confirmation":"这些命令总是需要手动确认"}),e.jsxs("div",{className:"space-y-2",children:[n.commandDenylist.map((ae,L)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"flex-1 px-2 py-1 bg-muted rounded text-sm",children:ae}),e.jsx(D,{variant:"ghost",size:"sm",onClick:()=>ue(L),children:e.jsx(Vt,{className:"h-4 w-4 text-destructive"})})]},L)),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:W,onChange:ae=>U(ae.target.value),placeholder:K?"e.g.: rm -rf *":"如: rm -rf *",className:"flex-1 px-3 py-1.5 rounded-md border bg-background text-sm",onKeyDown:ae=>ae.key==="Enter"&&st()}),e.jsx(D,{variant:"outline",size:"sm",onClick:st,children:e.jsx(Ts,{className:"h-4 w-4"})})]}),e.jsxs(D,{variant:"outline",size:"sm",onClick:oe,className:"mt-2",children:[e.jsx(Ts,{className:"h-4 w-4 mr-2"}),K?"Add Default Blocked":"添加默认禁止命令"]})]})]})]})]}),q&&e.jsx(AI,{filename:q,onClose:()=>V(null),onSaved:P}),le&&e.jsx(MI,{serverName:le.name,server:le.server,onClose:()=>B(null),onSaved:P})]})}function OI({config:n,setConfig:s,isRunning:r,isEn:i}){const[o,d]=g.useState(!1),[u,h]=g.useState(!1),[f,p]=g.useState(!1),[y,b]=g.useState(null),[v,N]=g.useState([]),[j,T]=g.useState(!1),[S,k]=g.useState(!1),[R,I]=g.useState(!1),M=!!(n.enableMultiAccount&&(n.accountSelectionStrategy||"round-robin")!=="sticky"),[G,W]=g.useState((n.allowedIPs||[]).join(`
|
|
117
|
+
`)),[U,q]=g.useState((n.deniedIPs||[]).join(`
|
|
118
|
+
`));g.useEffect(()=>{W((n.allowedIPs||[]).join(`
|
|
119
|
+
`)),q((n.deniedIPs||[]).join(`
|
|
120
|
+
`))},[n.allowedIPs,n.deniedIPs]),g.useEffect(()=>{if(!r){T(!1);return}let P=!0;window.api.proxyNeedsRestart().then(fe=>{P&&T(fe.needsRestart)});const F=setInterval(()=>{window.api.proxyNeedsRestart().then(fe=>{P&&T(fe.needsRestart)})},5e3);return()=>{P=!1,clearInterval(F)}},[r]);const V=g.useCallback((P,F)=>{s(fe=>({...fe,[P]:F})),window.api.proxyUpdateConfig({[P]:F})},[s]),le=P=>P.split(`
|
|
121
|
+
`).map(F=>F.trim()).filter(Boolean),B=g.useCallback(async()=>{const P=await window.api.proxySelfSignedCertInfo();P.success&&b(P)},[]);g.useEffect(()=>{f&&!y&&B()},[f,y,B]);const be=g.useCallback(async()=>{if(confirm(i?"Regenerate self-signed certificate? You will need to re-install it on clients.":"Tạo lại chứng chỉ tự ký? Các client sẽ cần cài lại chứng chỉ.")){I(!0);try{const P=await window.api.proxySelfSignedCertRegenerate();P.success?(b(P),alert(i?"Regenerated. Restart proxy to apply.":"Đã tạo lại. Khởi động lại proxy để áp dụng.")):alert(i?`Failed: ${P.error}`:`Thất bại: ${P.error}`)}finally{I(!1)}}},[i]),K=g.useCallback(()=>{if(!y?.cert)return;const P=new Blob([y.cert],{type:"application/x-pem-file"}),F=URL.createObjectURL(P),fe=document.createElement("a");fe.href=F,fe.download="kiro-proxy-cert.crt",fe.click(),URL.revokeObjectURL(F)},[y]),se=g.useCallback(async()=>{y?.cert&&(await navigator.clipboard.writeText(y.cert),k(!0),setTimeout(()=>k(!1),2e3))},[y]),te=g.useCallback(async()=>{const P=await window.api.proxyAuditLog();N(P.entries)},[]);g.useEffect(()=>{u&&te()},[u,te]);const Y=g.useCallback(async()=>{if(!confirm(i?"Restart proxy server now? Active streams will be interrupted.":"Khởi động lại proxy ngay? Các stream đang chạy sẽ bị ngắt."))return;const P=await window.api.proxyRestart();P.success?T(!1):alert(i?`Restart failed: ${P.error}`:`Khởi động lại thất bại: ${P.error}`)},[i]);return e.jsxs(De,{className:"hover-lift",children:[e.jsx(at,{className:"pb-3 cursor-pointer",onClick:()=>d(!o),children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Vn,{className:"h-5 w-5 text-amber-500"}),e.jsx(rt,{className:"text-base",children:i?"Security & Observability (v1.8)":"Bảo mật & quan sát (v1.8)"}),j&&e.jsxs($e,{variant:"destructive",className:"ml-2",children:[e.jsx(Rs,{className:"h-3 w-3 mr-1"}),i?"Restart required":"Cần khởi động lại"]})]}),e.jsx(D,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:o?e.jsx(va,{className:"h-4 w-4"}):e.jsx(BN,{className:"h-4 w-4"})})]})}),o&&e.jsxs(Pe,{className:"space-y-4 text-sm",children:[j&&e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-md bg-amber-500/10 border border-amber-500/20",children:[e.jsxs("div",{className:"flex items-center gap-2 text-amber-600 dark:text-amber-400",children:[e.jsx(Rs,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs",children:i?"Configuration change requires a restart to take effect.":"Cấu hình đã đổi, cần khởi động lại để áp dụng."})]}),e.jsxs(D,{size:"sm",onClick:Y,children:[e.jsx(Mt,{className:"h-3 w-3 mr-1"}),i?"Restart Now":"Khởi động lại"]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(Fe,{className:"text-xs",children:i?"Max body size (MB)":"Giới hạn nội dung request (MB)"}),e.jsx(it,{type:"number",min:1,max:100,step:1,value:Math.round((n.maxRequestBodyBytes||10*1024*1024)/(1024*1024)),onChange:P=>{const F=parseInt(P.target.value)||10;V("maxRequestBodyBytes",F*1024*1024)},placeholder:"10",className:"h-9"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:i?"Reject larger requests with HTTP 413":"Request vượt giới hạn sẽ trả HTTP 413"})]}),e.jsxs("div",{children:[e.jsx(Fe,{className:"text-xs",children:i?"Rate limit (req/min per Key)":"Giới hạn tốc độ (request/phút mỗi Key)"}),e.jsx(it,{type:"number",min:0,max:1e4,step:10,value:n.rateLimitPerKeyPerMinute||0,onChange:P=>V("rateLimitPerKeyPerMinute",parseInt(P.target.value)||0),placeholder:i?"0 = unlimited":"0 = không giới hạn",className:"h-9"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:i?"Anonymous → by IP":"Không có key thì giới hạn theo IP"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(Fe,{className:"text-xs",children:i?"Allowed IPs (whitelist)":"IP được phép (whitelist)"}),e.jsx("textarea",{value:G,onChange:P=>W(P.target.value),onBlur:()=>V("allowedIPs",le(G)),placeholder:i?"One per line, supports CIDR (e.g. 10.0.0.0/8)":"Mỗi dòng một IP, hỗ trợ CIDR (vd 10.0.0.0/8)",className:"w-full h-20 px-3 py-2 text-xs rounded-md border border-input bg-background"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:i?"Empty = no restriction":"Để trống = không giới hạn"})]}),e.jsxs("div",{children:[e.jsx(Fe,{className:"text-xs",children:i?"Denied IPs (blacklist)":"IP bị chặn (blacklist)"}),e.jsx("textarea",{value:U,onChange:P=>q(P.target.value),onBlur:()=>V("deniedIPs",le(U)),placeholder:i?"Higher priority than allowed list":"Ưu tiên cao hơn whitelist",className:"w-full h-20 px-3 py-2 text-xs rounded-md border border-input bg-background"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:i?"IPv4 / IPv6 / CIDR":"Hỗ trợ IPv4 / IPv6 / CIDR"})]})]}),(n.host==="0.0.0.0"||n.host==="::")&&e.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-md bg-red-500/10 border border-red-500/20",children:[e.jsx(Rs,{className:"h-4 w-4 text-red-600 dark:text-red-400 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-xs font-medium text-red-600 dark:text-red-400",children:i?`Binding to ${n.host} exposes accounts to the network!`:`Đang bind vào ${n.host}, mạng LAN/public có thể truy cập`}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:i?"API Key is required to start the server.":"Cần thiết lập ít nhất một API Key để khởi động."}),e.jsxs("label",{className:"flex items-center gap-2 mt-2 cursor-pointer",children:[e.jsx(is,{checked:n.allowExternalWithoutApiKey||!1,onCheckedChange:P=>V("allowExternalWithoutApiKey",P),disabled:r}),e.jsx("span",{className:"text-xs text-red-600 dark:text-red-400",children:i?"I understand the risk, allow without API Key (DANGEROUS)":"Tôi hiểu rủi ro, cho phép chạy không cần API Key (nguy hiểm)"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-md border bg-background/50",children:[e.jsxs("div",{children:[e.jsx(Fe,{className:"text-sm",children:i?"Session affinity":"Gắn phiên"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:i?"Route same client to same account (prompt cache + anti-risk)":"Cùng một client sẽ dùng cùng một tài khoản để giữ cache và giảm rủi ro"})]}),e.jsx(is,{checked:M?!1:n.sessionAffinityEnabled||!1,onCheckedChange:P=>V("sessionAffinityEnabled",P),disabled:M})]}),e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-md border bg-background/50",children:[e.jsxs("div",{children:[e.jsx(Fe,{className:"text-sm",children:"Prometheus /metrics"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:i?"Expose monitoring metrics endpoint":"Mở endpoint chỉ số giám sát"})]}),e.jsx(is,{checked:n.enableMetrics||!1,onCheckedChange:P=>V("enableMetrics",P)})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-md border bg-background/50",children:[e.jsxs("div",{children:[e.jsx(Fe,{className:"text-sm",children:i?"Audit log":"Log kiểm toán"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:i?"Track config changes & critical events":"Ghi lại thay đổi cấu hình và sự kiện quan trọng"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(is,{checked:n.enableAuditLog||!1,onCheckedChange:P=>V("enableAuditLog",P)}),e.jsxs(D,{variant:"outline",size:"sm",onClick:()=>h(!u),children:[e.jsx(xr,{className:"h-3 w-3 mr-1"}),i?"View":"Xem"]})]})]}),e.jsxs("div",{children:[e.jsx(Fe,{className:"text-xs",children:i?"Recent requests limit":"Số log request gần đây"}),e.jsx(it,{type:"number",min:20,max:1e4,step:50,value:n.recentRequestsLimit||100,onChange:P=>V("recentRequestsLimit",parseInt(P.target.value)||100),className:"h-9"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:i?"Default 100, max 10000":"Mặc định 100, tối đa 10000"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(Fe,{className:"text-xs",children:i?"Keep-alive timeout (sec)":"Timeout keep-alive khi rảnh (giây)"}),e.jsx(it,{type:"number",min:5,max:600,step:5,value:Math.round((n.keepAliveTimeoutMs||65e3)/1e3),onChange:P=>V("keepAliveTimeoutMs",(parseInt(P.target.value)||65)*1e3),className:"h-9"})]}),e.jsxs("div",{children:[e.jsx(Fe,{className:"text-xs",children:i?"HTTP fallback port (when TLS enabled)":"Cổng HTTP dự phòng khi bật TLS"}),e.jsx(it,{type:"number",min:0,max:65535,step:1,value:n.fallbackPort||0,onChange:P=>V("fallbackPort",parseInt(P.target.value)||0),placeholder:i?"0 = disabled":"0 = tắt",className:"h-9",disabled:r})]})]}),e.jsxs("div",{className:"border-t pt-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx(Fe,{className:"text-sm font-medium",children:i?"Self-signed TLS Certificate":"Chứng chỉ TLS tự ký"}),e.jsx(D,{variant:"outline",size:"sm",onClick:()=>p(!f),children:f?i?"Hide":"Ẩn":i?"Show details":"Xem chi tiết"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:i?"When TLS is enabled but no cert/key configured, the proxy auto-generates a 2-year self-signed cert (in userData/proxy-tls/). Install on clients or set NODE_TLS_REJECT_UNAUTHORIZED=0.":"Khi bật TLS nhưng chưa cấu hình chứng chỉ, proxy sẽ tự tạo chứng chỉ tự ký có hiệu lực 2 năm trong userData/proxy-tls/. Client cần cài chứng chỉ này hoặc đặt NODE_TLS_REJECT_UNAUTHORIZED=0."}),f&&y&&e.jsxs("div",{className:"space-y-2 mt-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:i?"Subject:":"Chủ thể:"}),e.jsx("p",{className:"font-mono",children:y.subject||"-"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:i?"Expires:":"Hết hạn:"}),e.jsx("p",{className:"font-mono",children:y.notAfter?new Date(y.notAfter).toLocaleString():"-"})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx("span",{className:"text-muted-foreground",children:i?"SHA-256 Fingerprint:":"Vân tay SHA-256:"}),e.jsx("p",{className:"font-mono text-[10px] break-all",children:y.fingerprint||"-"})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx("span",{className:"text-muted-foreground",children:i?"Subject Alt Names:":"Tên thay thế (SAN):"}),e.jsx("p",{className:"font-mono text-[10px]",children:y.altNames?.join(", ")||"-"})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(D,{variant:"outline",size:"sm",onClick:K,children:[e.jsx(Ns,{className:"h-3 w-3 mr-1"}),i?"Download .crt":"Tải .crt"]}),e.jsxs(D,{variant:"outline",size:"sm",onClick:se,children:[S?e.jsx(an,{className:"h-3 w-3 mr-1 text-green-500"}):e.jsx(As,{className:"h-3 w-3 mr-1"}),S?i?"Copied":"Đã sao chép":i?"Copy PEM":"Sao chép PEM"]}),e.jsxs(D,{variant:"outline",size:"sm",onClick:be,disabled:R,children:[e.jsx(Mt,{className:`h-3 w-3 mr-1 ${R?"animate-spin":""}`}),i?"Regenerate":"Tạo lại"]})]})]})]}),u&&e.jsxs("div",{className:"border-t pt-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx(Fe,{className:"text-sm font-medium",children:i?"Audit Log (recent 200)":"Log kiểm toán (200 dòng gần đây)"}),e.jsxs(D,{variant:"outline",size:"sm",onClick:te,children:[e.jsx(Mt,{className:"h-3 w-3 mr-1"}),i?"Refresh":"Làm mới"]})]}),e.jsx("div",{className:"max-h-64 overflow-y-auto rounded-md border bg-muted/30 p-2 space-y-1",children:v.length===0?e.jsx("p",{className:"text-xs text-muted-foreground text-center py-4",children:i?"No entries":"Chưa có bản ghi"}):v.slice().reverse().map((P,F)=>e.jsxs("div",{className:"text-[10px] font-mono p-1.5 rounded bg-background/50 border",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx("span",{children:new Date(P.ts).toLocaleTimeString()}),e.jsx($e,{variant:"outline",className:"text-[9px] px-1 py-0",children:P.type})]}),e.jsx("pre",{className:"mt-1 break-all whitespace-pre-wrap",children:JSON.stringify(P.data,null,0)})]},F))})]}),n.enableMetrics&&r&&e.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-md bg-blue-500/10 border border-blue-500/20 text-xs",children:[e.jsx(Ks,{className:"h-3 w-3 text-blue-500"}),e.jsx("span",{className:"text-muted-foreground",children:i?"Metrics available at:":"Endpoint chỉ số:"}),e.jsx("code",{className:"font-mono",children:"/metrics"})]})]})]})}function zI({open:n,onOpenChange:s,logs:r,totalCredits:i,totalTokens:o,onClearLogs:d,onResetCredits:u,onResetTokens:h,isEn:f}){const[p,y]=g.useState(null);if(!n)return null;const b=()=>{const S=r.map(M=>`${M.time} ${M.path} ${M.status}${M.credits?` ${M.credits.toFixed(6)} credits`:""}`).join(`
|
|
122
|
+
`),k=new Blob([S],{type:"text/plain"}),R=URL.createObjectURL(k),I=document.createElement("a");I.href=R,I.download=`proxy-logs-${new Date().toISOString().slice(0,10)}.txt`,I.click(),URL.revokeObjectURL(R)},v=r.filter(S=>S.status<400).length,N=r.filter(S=>S.status>=400).length,j=r.reduce((S,k)=>S+(k.credits||0),0),T=r.reduce((S,k)=>S+(k.tokens||0),0);return e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:()=>s(!1)}),e.jsxs(De,{className:"relative w-[900px] max-h-[80vh] shadow-2xl border-0 overflow-hidden animate-in fade-in zoom-in-95 duration-200 glass-card-strong",children:[e.jsxs(at,{className:"pb-3 border-b sticky top-0 z-10",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(rt,{className:"text-lg",children:f?"Request Logs":"请求日志"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(D,{variant:"outline",size:"sm",onClick:b,disabled:r.length===0,children:[e.jsx(Ns,{className:"h-4 w-4 mr-1"}),f?"Export":"导出"]}),e.jsxs(D,{variant:"outline",size:"sm",onClick:d,disabled:r.length===0,children:[e.jsx(Vt,{className:"h-4 w-4 mr-1"}),f?"Clear":"清空"]}),e.jsx(D,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-lg hover:bg-red-500 hover:text-white transition-colors",onClick:()=>s(!1),children:e.jsx(ns,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1 mt-2 text-sm",children:[e.jsxs("span",{children:[f?"Total":"总计",": ",e.jsx($e,{variant:"secondary",children:r.length})]}),e.jsxs("span",{children:[f?"Success":"成功",": ",e.jsx($e,{className:"bg-success/20 text-success",children:v})]}),e.jsxs("span",{children:[f?"Error":"错误",": ",e.jsx($e,{className:"bg-destructive/20 text-destructive",children:N})]}),e.jsx("span",{className:"text-muted-foreground",children:"|"}),e.jsxs("span",{children:["Tokens ",f?"Recent":"最近",": ",e.jsx($e,{variant:"outline",children:T.toLocaleString()})]}),e.jsxs("span",{className:"flex items-center gap-1",children:["Tokens ",f?"Total":"总计",": ",e.jsx($e,{variant:"secondary",children:o.toLocaleString()}),h&&e.jsx(D,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:h,title:f?"Reset total":"重置总计",children:e.jsx(gr,{className:"h-3 w-3"})})]}),e.jsx("span",{className:"text-muted-foreground",children:"|"}),e.jsxs("span",{children:["Credits ",f?"Recent":"最近",": ",e.jsx($e,{variant:"outline",children:j.toFixed(4)})]}),e.jsxs("span",{className:"flex items-center gap-1",children:["Credits ",f?"Total":"总计",": ",e.jsx($e,{variant:"secondary",children:i.toFixed(4)}),u&&e.jsx(D,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:u,title:f?"Reset total":"重置总计",children:e.jsx(gr,{className:"h-3 w-3"})})]})]})]}),e.jsx(Pe,{className:"p-0",children:e.jsx("div",{className:"max-h-[calc(80vh-120px)] overflow-y-auto",children:r.length===0?e.jsx("div",{className:"flex items-center justify-center h-32 text-muted-foreground",children:f?"No logs yet":"暂无日志"}):e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-muted/50 sticky top-0",children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left p-2 font-medium",children:f?"Time":"时间"}),e.jsx("th",{className:"text-left p-2 font-medium",children:f?"Path":"路径"}),e.jsx("th",{className:"text-left p-2 font-medium",children:f?"Model":"模型"}),e.jsx("th",{className:"text-center p-2 font-medium",children:f?"Status":"状态"}),e.jsx("th",{className:"text-center p-2 font-medium",children:f?"In":"输入"}),e.jsx("th",{className:"text-center p-2 font-medium",children:f?"Out":"输出"}),e.jsx("th",{className:"text-center p-2 font-medium",children:"Cache"}),e.jsx("th",{className:"text-right p-2 font-medium",children:"Credits"}),e.jsx("th",{className:"text-right p-2 font-medium",children:f?"Time":"耗时"})]})}),e.jsx("tbody",{className:"font-mono",children:r.map((S,k)=>e.jsxs("tr",{className:"border-b border-muted/30 hover:bg-muted/30",children:[e.jsx("td",{className:"p-2 text-muted-foreground whitespace-nowrap",children:S.time}),e.jsx("td",{className:"p-2 truncate max-w-[200px]",title:S.path,children:S.path}),e.jsx("td",{className:"p-2 truncate max-w-[150px] text-muted-foreground",title:S.model,children:S.model?S.model.replace("anthropic.","").replace("-v1:0",""):"-"}),e.jsx("td",{className:"p-2 text-center relative",children:S.status>=400&&S.error?e.jsxs("div",{className:"relative inline-block",children:[e.jsxs($e,{className:"bg-destructive/20 text-destructive cursor-pointer hover:bg-destructive/30 transition-colors",onClick:()=>y(p===k?null:k),children:[e.jsx(ln,{className:"h-3 w-3 mr-1"}),S.status]}),p===k&&e.jsxs("div",{className:"absolute z-50 top-full left-1/2 -translate-x-1/2 mt-2 w-80 bg-background border border-destructive/30 rounded-lg shadow-xl p-3 text-left",children:[e.jsx("div",{className:"absolute -top-2 left-1/2 -translate-x-1/2 w-3 h-3 bg-background border-l border-t border-destructive/30 rotate-45"}),e.jsxs("div",{className:"text-xs font-sans",children:[e.jsxs("div",{className:"font-medium text-destructive mb-2 flex items-center gap-1",children:[e.jsx(ln,{className:"h-3 w-3"}),f?"Error Details":"错误详情"]}),e.jsx("pre",{className:"whitespace-pre-wrap break-all bg-destructive/10 p-2 rounded text-destructive text-xs max-h-40 overflow-y-auto",children:S.error})]})]})]}):e.jsx($e,{className:S.status>=400?"bg-destructive/20 text-destructive":"bg-success/20 text-success",children:S.status})}),e.jsx("td",{className:"p-2 text-center text-muted-foreground",children:S.inputTokens?S.inputTokens.toLocaleString():"-"}),e.jsx("td",{className:"p-2 text-center text-muted-foreground",children:S.outputTokens?S.outputTokens.toLocaleString():"-"}),e.jsx("td",{className:"p-2 text-center text-success",children:S.cacheReadTokens?S.cacheReadTokens.toLocaleString():"-"}),e.jsx("td",{className:"p-2 text-right text-muted-foreground",children:S.credits?S.credits.toFixed(6):"-"}),e.jsx("td",{className:"p-2 text-right text-muted-foreground",children:S.responseTime?`${(S.responseTime/1e3).toFixed(1)}s`:"-"})]},k))})]})})})]})]})}function Ol({value:n,options:s,onChange:r,placeholder:i,className:o}){const[d,u]=g.useState(!1),h=g.useRef(null),f=s.find(p=>p.value===n);return g.useEffect(()=>{const p=y=>{h.current&&!h.current.contains(y.target)&&u(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[]),e.jsxs("div",{ref:h,className:`relative ${o||""}`,children:[e.jsxs("button",{type:"button",onClick:()=>u(!d),className:"relative h-8 px-2 pr-7 rounded-lg border border-border bg-background/50 text-xs cursor-pointer hover:border-primary/50 focus:border-primary focus:outline-none transition-all flex items-center gap-1.5",children:[f?.icon,e.jsx("span",{className:"flex-1 text-left truncate",children:f?.label||i}),e.jsx(va,{className:`w-3.5 h-3.5 absolute right-1.5 top-1/2 -translate-y-1/2 text-muted-foreground transition-transform ${d?"rotate-180":""}`})]}),d&&e.jsx("div",{className:"absolute top-full left-0 mt-1 min-w-full py-1 rounded-lg border border-border bg-popover shadow-lg z-50 animate-in fade-in-0 zoom-in-95",children:s.map(p=>e.jsxs("button",{type:"button",onClick:()=>{r(p.value),u(!1)},className:`w-full px-2.5 py-1.5 text-xs text-left flex items-center gap-1.5 hover:bg-accent transition-colors ${p.value===n?"bg-accent text-accent-foreground":""}`,children:[p.icon,e.jsx("span",{children:p.label}),p.value===n&&e.jsx("svg",{className:"w-4 h-4 ml-auto text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]},p.value))})]})}function UI({open:n,onOpenChange:s}){const{t:r}=Ut(),i=r("common.unknown")==="Unknown",[o,d]=g.useState([]),[u,h]=g.useState(!1),[f,p]=g.useState(""),[y,b]=g.useState("all"),[v,N]=g.useState("all"),[j,T]=g.useState(!0),[S,k]=g.useState(0),[R,I]=g.useState(new Set),M=g.useRef(0),[G,W]=g.useState(()=>localStorage.getItem("proxyLogs_timeRange")||"all"),[U,q]=g.useState(()=>localStorage.getItem("proxyLogs_displayLimit")||"all"),V=g.useRef(null),le=g.useRef(null),B=g.useCallback(async()=>{try{const xe=await window.api.proxyGetLogs();d(xe)}catch(xe){console.error("Failed to load logs:",xe)}},[]);g.useEffect(()=>(n&&(h(!0),B().finally(()=>h(!1)),le.current=setInterval(()=>{B().then(()=>{!j&&o.length>M.current&&k(xe=>xe+(o.length-M.current)),M.current=o.length})},1500)),()=>{le.current&&(clearInterval(le.current),le.current=null)}),[n,B,j,o.length]);const be=g.useCallback(()=>{const xe=V.current;if(!xe)return;const Oe=xe.scrollHeight-xe.scrollTop-xe.clientHeight<40;T(Oe),Oe&&k(0)},[]),K=()=>{V.current&&(V.current.scrollTop=V.current.scrollHeight,T(!0),k(0))};g.useEffect(()=>{localStorage.setItem("proxyLogs_timeRange",G)},[G]),g.useEffect(()=>{localStorage.setItem("proxyLogs_displayLimit",U)},[U]);const se=async()=>{try{await window.api.proxyClearLogs(),d([])}catch(xe){console.error("Failed to clear logs:",xe)}},te=()=>{const xe=o.map(_e=>{const st=_e.data?` | ${JSON.stringify(_e.data)}`:"";return`[${_e.timestamp}] [${_e.level}] [${_e.category}] ${_e.message}${st}`}).join(`
|
|
123
|
+
`),Oe=new Blob([xe],{type:"text/plain"}),Ee=URL.createObjectURL(Oe),Qe=document.createElement("a");Qe.href=Ee,Qe.download=`proxy-logs-${new Date().toISOString().replace(/[:.]/g,"-")}.log`,Qe.click(),URL.revokeObjectURL(Ee)},Y=xe=>{const Oe=xe.data?`
|
|
124
|
+
Data: ${JSON.stringify(xe.data,null,2)}`:"",Ee=`[${xe.timestamp}] [${xe.level}] [${xe.category}]
|
|
125
|
+
${xe.message}${Oe}`;navigator.clipboard.writeText(Ee)},P=xe=>{const Oe=new Set(R);Oe.has(xe)?Oe.delete(xe):Oe.add(xe),I(Oe)},F=g.useMemo(()=>Array.from(new Set(o.map(xe=>xe.category))).sort(),[o]),fe=xe=>{switch(xe){case"1h":return 36e5;case"6h":return 6*36e5;case"12h":return 12*36e5;case"1d":return 864e5;case"3d":return 3*864e5;case"7d":return 7*864e5;case"30d":return 30*864e5;case"180d":return 180*864e5;case"1y":return 365*864e5;default:return 0}},pe=g.useMemo(()=>{const xe=Date.now(),Oe=fe(G),Ee=f.toLowerCase();let Qe=o.filter(_e=>{if(Oe>0){const st=new Date(_e.timestamp).getTime();if(xe-st>Oe)return!1}if(y!=="all"&&_e.level!==y||v!=="all"&&_e.category!==v)return!1;if(Ee){if(_e.message.toLowerCase().includes(Ee)||_e.category.toLowerCase().includes(Ee))return!0;if(_e.data)try{return JSON.stringify(_e.data).toLowerCase().includes(Ee)}catch{return!1}return!1}return!0});if(U!=="all"){const _e=parseInt(U);_e>0&&(Qe=Qe.slice(-_e))}return Qe},[o,G,y,v,f,U]),C=lo({count:pe.length,getScrollElement:()=>V.current,estimateSize:xe=>R.has(xe)?120:32,overscan:20});g.useEffect(()=>{j&&pe.length>0&&C.scrollToIndex(pe.length-1,{align:"end"})},[pe.length,j,C]);const z=xe=>{switch(xe){case"ERROR":return"bg-destructive/20 text-destructive border-destructive/30";case"WARN":return"bg-warning/20 text-warning border-warning/30";case"INFO":return"bg-primary/20 text-primary border-primary/30";case"DEBUG":return"bg-muted text-muted-foreground border-muted";default:return"bg-muted text-muted-foreground border-muted"}},X=xe=>{switch(xe){case"ERROR":return"bg-destructive/5 hover:bg-destructive/10";case"WARN":return"bg-warning/5 hover:bg-warning/10";case"INFO":return"hover:bg-primary/5";case"DEBUG":return"hover:bg-muted/50";default:return"hover:bg-muted/50"}},re=xe=>{try{if(!xe)return"-";const Oe=new Date(xe);if(isNaN(Oe.getTime()))return xe||"-";const Ee=Oe.getFullYear(),Qe=(Oe.getMonth()+1).toString().padStart(2,"0"),_e=Oe.getDate().toString().padStart(2,"0"),st=Oe.getHours().toString().padStart(2,"0"),oe=Oe.getMinutes().toString().padStart(2,"0"),ue=Oe.getSeconds().toString().padStart(2,"0"),ae=Oe.getMilliseconds().toString().padStart(3,"0");return`${Ee}-${Qe}-${_e} ${st}:${oe}:${ue}.${ae}`}catch{return xe||"-"}};return n?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:()=>s(!1),children:e.jsxs("div",{className:"glass-card-strong rounded-2xl shadow-2xl max-w-[90vw] w-[1200px] h-[80vh] flex flex-col overflow-hidden animate-in zoom-in-95 duration-200",onClick:xe=>xe.stopPropagation(),children:[e.jsxs("div",{className:"flex-shrink-0 flex items-center justify-between px-5 py-4 border-b border-border",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10",children:e.jsx("svg",{className:"w-5 h-5 text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})}),e.jsx("h2",{className:"text-lg font-semibold",children:i?"Proxy Detailed Logs":"反代详细日志"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ol,{value:G,onChange:W,className:"min-w-[70px]",options:[{value:"all",label:i?"All Time":"全部时间"},{value:"1h",label:i?"1 Hour":"1小时"},{value:"6h",label:i?"6 Hours":"6小时"},{value:"12h",label:i?"12 Hours":"12小时"},{value:"1d",label:i?"1 Day":"1天"},{value:"3d",label:i?"3 Days":"3天"},{value:"7d",label:i?"7 Days":"7天"},{value:"30d",label:i?"30 Days":"30天"},{value:"180d",label:i?"180 Days":"180天"},{value:"1y",label:i?"1 Year":"1年"}]}),e.jsx(Ol,{value:U,onChange:q,className:"min-w-[70px]",options:[{value:"all",label:i?"All":"全部"},{value:"5000",label:"5000"},{value:"10000",label:i?"10K":"1万"},{value:"50000",label:i?"50K":"5万"},{value:"100000",label:i?"100K":"10万"},{value:"200000",label:i?"200K":"20万"},{value:"500000",label:i?"500K":"50万"},{value:"1000000",label:i?"1M":"100万"}]}),e.jsxs($e,{variant:"secondary",className:"font-mono",children:[pe.length," / ",o.length," ",i?"entries":"条"]}),e.jsx(D,{variant:"ghost",size:"icon",className:"rounded-full hover:bg-red-500 hover:text-white transition-colors",onClick:()=>s(!1),children:e.jsx(ns,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"flex-shrink-0 flex items-center gap-2 px-4 py-2.5 border-b border-border",children:[e.jsxs("div",{className:"relative flex-1 min-w-[100px]",children:[e.jsx(to,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground"}),e.jsx(it,{placeholder:i?"Search logs...":"搜索日志内容...",value:f,onChange:xe=>p(xe.target.value),className:"pl-8 pr-8 h-8 text-xs bg-background/50 border-border focus:border-primary"}),f&&e.jsx(D,{variant:"ghost",size:"icon",className:"absolute right-1 top-1/2 -translate-y-1/2 w-7 h-7 rounded-full",onClick:()=>p(""),children:e.jsx(ns,{className:"w-3.5 h-3.5"})})]}),e.jsx(Ol,{value:y,onChange:b,options:[{value:"all",label:i?"All":"全部",icon:e.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-gradient-to-r from-destructive via-warning to-primary"})},{value:"ERROR",label:"ERR",icon:e.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-destructive"})},{value:"WARN",label:"WARN",icon:e.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-warning"})},{value:"INFO",label:"INFO",icon:e.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-primary"})},{value:"DEBUG",label:"DBG",icon:e.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-gray-400"})}]}),e.jsx(Ol,{value:v,onChange:N,className:"min-w-[100px]",options:[{value:"all",label:i?"All":"全部",icon:e.jsx("svg",{className:"w-3 h-3 text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})},...F.map(xe=>({value:xe,label:xe,icon:e.jsx("svg",{className:"w-3 h-3 text-muted-foreground",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A2 2 0 013 12V7a4 4 0 014-4z"})})}))]}),e.jsx("div",{className:"h-5 w-px bg-border flex-shrink-0"}),e.jsx(Ol,{value:U,onChange:q,className:"min-w-[60px]",options:[{value:"all",label:i?"All":"全部"},{value:"5000",label:"5K"},{value:"10000",label:"10K"},{value:"50000",label:"50K"},{value:"100000",label:"100K"}]}),e.jsx(Ol,{value:G,onChange:W,className:"min-w-[60px]",options:[{value:"all",label:i?"All":"全部"},{value:"1h",label:"1h"},{value:"6h",label:"6h"},{value:"1d",label:"1d"},{value:"7d",label:"7d"}]}),e.jsx("div",{className:"h-5 w-px bg-border flex-shrink-0"}),e.jsx(D,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:B,disabled:u,children:e.jsx(Mt,{className:`w-3.5 h-3.5 ${u?"animate-spin":""}`})}),e.jsx(D,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:te,disabled:o.length===0,children:e.jsx(Ns,{className:"w-3.5 h-3.5"})}),e.jsx(D,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-destructive",onClick:se,disabled:o.length===0,children:e.jsx(Vt,{className:"w-3.5 h-3.5"})})]}),e.jsxs("div",{className:"flex-1 overflow-hidden relative",children:[e.jsx("div",{ref:V,className:"h-full overflow-y-auto font-mono text-xs",onScroll:be,children:pe.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-muted-foreground gap-2",children:[e.jsx(fx,{className:"h-8 w-8 opacity-20"}),e.jsx("span",{className:"text-sm",children:o.length===0?i?"No logs yet":"暂无日志记录":i?"No matching logs":"没有匹配的日志"})]}):e.jsx("div",{style:{height:C.getTotalSize(),width:"100%",position:"relative"},children:C.getVirtualItems().map(xe=>{const Oe=xe.index,Ee=pe[Oe],Qe=R.has(Oe),_e=Ee.data!==void 0&&Ee.data!==null;return e.jsxs("div",{"data-index":Oe,ref:C.measureElement,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${xe.start}px)`},className:`group rounded-lg px-3 py-1.5 transition-colors ${X(Ee.level)}`,children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-muted-foreground whitespace-nowrap flex-shrink-0 tabular-nums text-[10px]",children:re(Ee.timestamp)}),e.jsx($e,{variant:"outline",className:`text-[9px] px-1 py-0 flex-shrink-0 font-semibold ${z(Ee.level)}`,children:Ee.level}),e.jsx("span",{className:"text-primary/80 flex-shrink-0 font-medium text-[10px]",children:Ee.category}),e.jsx("span",{className:"flex-1 break-all text-foreground/90 text-[11px]",children:Ee.message}),e.jsxs("div",{className:"flex-shrink-0 opacity-0 group-hover:opacity-100 flex items-center gap-0.5 transition-opacity",children:[_e&&e.jsx(D,{variant:"ghost",size:"icon",className:"w-5 h-5 rounded-full",onClick:()=>P(Oe),children:Qe?e.jsx(zi,{className:"w-3 h-3"}):e.jsx(va,{className:"w-3 h-3"})}),e.jsx(D,{variant:"ghost",size:"icon",className:"w-5 h-5 rounded-full",onClick:()=>Y(Ee),children:e.jsx(As,{className:"w-3 h-3"})})]})]}),Qe&&_e&&e.jsx("pre",{className:"mt-1.5 ml-20 p-2 rounded-md bg-muted/50 border border-border text-primary overflow-x-auto text-[10px] leading-4",children:JSON.stringify(Ee.data,null,2)})]},xe.key)})})}),!j&&e.jsxs("button",{className:"absolute bottom-3 right-3 flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-primary text-primary-foreground text-xs font-medium shadow-lg hover:bg-primary/90 transition-all",onClick:K,children:[e.jsx(_N,{className:"h-3.5 w-3.5"}),S>0?e.jsx(e.Fragment,{children:i?`${S} new`:`${S} 条新`}):e.jsx(e.Fragment,{children:i?"Bottom":"底部"})]})]}),e.jsxs("div",{className:"flex-shrink-0 flex items-center justify-between px-4 py-1.5 border-t border-border text-[10px] text-muted-foreground",children:[e.jsxs("span",{children:[i?"Showing":"显示"," ",pe.length.toLocaleString()," / ",o.length.toLocaleString()]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(zN,{className:`h-3 w-3 ${j?"text-success":"text-muted-foreground/40"}`}),e.jsx("span",{children:j?i?"Following":"跟随中":i?"Scrolled up":"已暂停跟随"})]})]})]})}):null}function $I({open:n,onOpenChange:s,isEn:r,onOpenModelMapping:i,mappingCount:o=0}){const[d,u]=g.useState([]),[h,f]=g.useState(!1),[p,y]=g.useState(!1),[b,v]=g.useState(null),[N,j]=g.useState(()=>localStorage.getItem("models_dialog_ip_tip_dismissed")!=="1"),T=()=>{localStorage.setItem("models_dialog_ip_tip_dismissed","1"),j(!1)},S=async()=>{f(!0),v(null);try{const R=await window.api.proxyGetModels();R.success?(u(R.models),y(R.fromCache||!1)):v(R.error||"Failed to fetch models")}catch(R){v(R instanceof Error?R.message:"Unknown error")}finally{f(!1)}};if(g.useEffect(()=>{n&&S()},[n]),!n)return null;const k=R=>R==null?"-":R>=1e6?`${(R/1e6).toFixed(1)}M`:R>=1e3?`${(R/1e3).toFixed(0)}K`:R.toString();return e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:()=>s(!1)}),e.jsxs(De,{className:"relative w-[850px] max-h-[85vh] shadow-2xl border-0 overflow-hidden animate-in fade-in zoom-in-95 duration-200 glass-card-strong",children:[e.jsx(at,{className:"pb-4 border-b sticky top-0 z-10",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(rt,{className:"text-xl flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-xl bg-primary/10",children:e.jsx(ai,{className:"h-6 w-6 text-primary"})}),e.jsxs("div",{children:[e.jsx("span",{className:"font-bold",children:r?"Available Models":"可用模型"}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsxs($e,{className:"bg-primary/10 text-primary border-primary/20 font-semibold",children:[d.length," ",r?"models":"个模型"]}),p&&e.jsxs($e,{variant:"secondary",className:"text-xs bg-warning/10 text-warning border-0",children:[e.jsx(Hi,{className:"h-3 w-3 mr-1"}),r?"Cached":"缓存"]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[i&&e.jsxs(D,{variant:"outline",size:"sm",onClick:i,className:"rounded-lg",children:[e.jsx(Kn,{className:"h-4 w-4"}),e.jsx("span",{className:"ml-1.5",children:r?"Mapping":"映射"}),o>0&&e.jsx($e,{className:"ml-1.5 h-5 px-1.5 bg-primary/20 text-primary text-xs",children:o})]}),e.jsxs(D,{variant:"outline",size:"sm",onClick:S,disabled:h,className:"rounded-lg",children:[h?e.jsx(bt,{className:"h-4 w-4 animate-spin"}):e.jsx(Mt,{className:"h-4 w-4"}),e.jsx("span",{className:"ml-1.5",children:r?"Refresh":"刷新"})]}),e.jsx(D,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-lg hover:bg-red-500 hover:text-white transition-colors",onClick:()=>s(!1),children:e.jsx(ns,{className:"h-5 w-5"})})]})]})}),e.jsxs(Pe,{className:"p-4",children:[N&&e.jsx("div",{className:"mb-3 rounded-xl border border-warning/30 bg-gradient-to-r from-warning/10 to-warning/5 p-3.5 relative",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"shrink-0 p-1.5 rounded-lg bg-warning/20",children:e.jsx(Rs,{className:"h-4 w-4 text-warning"})}),e.jsxs("div",{className:"flex-1 min-w-0 pr-6",children:[e.jsxs("p",{className:"text-sm font-semibold text-warning mb-1.5 flex items-center gap-1.5",children:[e.jsx(ri,{className:"h-3.5 w-3.5"}),r?"Pro/Pro Max subscription but missing advanced models?":"订阅 Pro/Pro Max 但看不到高级模型?"]}),e.jsx("p",{className:"text-xs text-warning/90 leading-relaxed mb-1",children:r?"This is likely caused by regional restrictions on China-mainland IPs. Try the following:":"这通常是国内 IP 被限制导致的。请尝试以下方案:"}),e.jsxs("ul",{className:"text-xs text-warning/90 space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:r?"Enable VPN/proxy (system-level or app-level)":"开启 VPN / 代理(系统级或应用级均可)"}),e.jsx("li",{children:r?"Switch to high-quality outbound IP (US/EU residential preferred)":"切换到优质外网 IP(推荐美国 / 欧洲住宅 IP)"}),e.jsx("li",{children:r?"Click Refresh after IP change to reload models":"IP 切换后点击右上角「刷新」重新加载模型"})]})]}),e.jsx(D,{variant:"ghost",size:"icon",className:"absolute top-2 right-2 h-7 w-7 hover:bg-warning/20 text-warning",onClick:T,title:r?"Don't show again":"不再显示",children:e.jsx(ns,{className:"h-4 w-4"})})]})}),e.jsx("div",{className:"max-h-[calc(85vh-140px)] overflow-y-auto pr-2",children:h&&d.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-muted-foreground",children:[e.jsx("div",{className:"p-4 rounded-full bg-primary/10 mb-4",children:e.jsx(bt,{className:"h-8 w-8 animate-spin text-primary"})}),e.jsx("p",{className:"font-medium",children:r?"Loading models...":"加载模型中..."})]}):b?e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-muted-foreground",children:[e.jsx("div",{className:"p-4 rounded-full bg-destructive/10 mb-4",children:e.jsx(ns,{className:"h-8 w-8 text-destructive"})}),e.jsx("p",{className:"text-destructive font-medium",children:b}),e.jsx("p",{className:"text-sm mt-2",children:r?"Make sure proxy is running and has synced accounts":"请确保代理服务已启动且已同步账号"})]}):d.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-muted-foreground",children:[e.jsx("div",{className:"p-4 rounded-full bg-muted mb-4",children:e.jsx(ai,{className:"h-8 w-8"})}),e.jsx("p",{className:"font-medium",children:r?"No models available":"暂无可用模型"})]}):e.jsx("div",{className:"grid grid-cols-2 gap-3",children:d.map((R,I)=>e.jsxs("div",{className:me("group p-3 rounded-xl border hover:shadow-md hover:border-primary/30 transition-all duration-200",I===0?"border-primary/40 bg-primary/10":"bg-background"),children:[e.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[e.jsx("div",{className:me("w-2 h-2 rounded-full mt-1.5 shrink-0",I===0?"bg-primary":"bg-muted-foreground/30")}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("code",{className:"text-sm font-bold text-foreground",children:R.id}),R.name&&R.name!==R.id&&e.jsx("p",{className:"text-[11px] text-primary/70 font-medium truncate",children:R.name})]})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground line-clamp-2 mb-2 pl-4",children:R.description||(r?"No description":"无描述")}),e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-border/50",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[R.inputTypes?.includes("TEXT")&&e.jsx($e,{variant:"secondary",className:"text-[10px] px-1.5 h-5 bg-blue-500/10 text-blue-600 dark:text-blue-400 border-0",children:e.jsx(xr,{className:"h-3 w-3"})}),R.inputTypes?.includes("IMAGE")&&e.jsx($e,{variant:"secondary",className:"text-[10px] px-1.5 h-5 bg-purple-500/10 text-purple-600 dark:text-purple-400 border-0",children:e.jsx(HN,{className:"h-3 w-3"})})]}),R.supportsThinking&&e.jsx($e,{variant:"secondary",className:"text-[10px] px-1.5 h-5 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-0",title:R.thinkingEfforts?.join(", "),children:e.jsx(x3,{className:"h-3 w-3"})}),R.supportsPromptCaching&&e.jsx($e,{variant:"secondary",className:"text-[10px] px-1.5 h-5 bg-cyan-500/10 text-cyan-600 dark:text-cyan-400 border-0",children:e.jsx(kp,{className:"h-3 w-3"})}),R.rateMultiplier!==void 0&&e.jsxs($e,{variant:"secondary",className:"text-[10px] px-1.5 h-5 bg-amber-500/10 text-amber-600 dark:text-amber-400 border-0",children:[e.jsx(Ds,{className:"h-3 w-3 mr-0.5"}),R.rateMultiplier,"x ",R.rateUnit||"credit"]})]}),e.jsxs("div",{className:"flex items-center gap-1 text-[11px] font-mono text-muted-foreground",children:[e.jsx(KN,{className:"h-3 w-3"}),e.jsx("span",{className:"text-green-600 dark:text-green-400",children:k(R.maxInputTokens)}),e.jsx("span",{children:"/"}),e.jsx("span",{className:"text-orange-600 dark:text-orange-400",children:k(R.maxOutputTokens)})]})]})]},R.id))})})]})]})]})}function BI({open:n,onOpenChange:s,isEn:r,mappings:i,onMappingsChange:o,apiKeys:d,availableModels:u}){const[h,f]=g.useState(i),[p,y]=g.useState(null),[b,v]=g.useState(!1);g.useEffect(()=>{n&&f(i)},[n]);const N=()=>`mapping_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,j=()=>{const B={id:N(),name:r?"New Rule":"新规则",enabled:!0,type:"replace",sourceModel:"",targetModels:[""],priority:h.length,apiKeyIds:[]};f([...h,B]),y(B.id)},T=(B,be)=>{f(h.map(K=>K.id===B?{...K,...be}:K))},S=B=>{f(h.filter(be=>be.id!==B)),p===B&&y(null)},k=(B,be)=>{const K=h.findIndex(Y=>Y.id===B);if(be==="up"&&K===0||be==="down"&&K===h.length-1)return;const se=[...h],te=be==="up"?K-1:K+1;[se[K],se[te]]=[se[te],se[K]],se.forEach((Y,P)=>Y.priority=P),f(se)},R=B=>{const be=h.find(K=>K.id===B);be&&T(B,{targetModels:[...be.targetModels,""],weights:be.weights?[...be.weights,1]:void 0})},I=(B,be,K)=>{const se=h.find(te=>te.id===B);if(se){const te=[...se.targetModels];te[be]=K,T(B,{targetModels:te})}},M=(B,be)=>{const K=h.find(se=>se.id===B);if(K&&K.targetModels.length>1){const se=K.targetModels.filter((Y,P)=>P!==be),te=K.weights?K.weights.filter((Y,P)=>P!==be):void 0;T(B,{targetModels:se,weights:te})}},G=(B,be,K)=>{const se=h.find(te=>te.id===B);if(se){const te=se.weights?[...se.weights]:se.targetModels.map(()=>1);te[be]=K,T(B,{weights:te})}},W=(B,be)=>{const K=h.find(se=>se.id===B);if(K){const se=K.apiKeyIds||[],te=se.includes(be)?se.filter(Y=>Y!==be):[...se,be];T(B,{apiKeyIds:te})}},U=async()=>{v(!0);try{o(h),s(!1)}finally{v(!1)}},q=B=>{switch(B){case"replace":return e.jsx(Np,{className:"h-4 w-4"});case"alias":return e.jsx(Xl,{className:"h-4 w-4"});case"loadbalance":return e.jsx(Kn,{className:"h-4 w-4"});default:return e.jsx(Ka,{className:"h-4 w-4"})}},V=B=>{switch(B){case"replace":return r?"Replace":"替换";case"alias":return r?"Alias":"别名";case"loadbalance":return r?"Load Balance":"负载均衡";default:return B}},le=B=>{switch(B){case"replace":return"bg-blue-500/10 text-blue-600 dark:text-blue-400";case"alias":return"bg-purple-500/10 text-purple-600 dark:text-purple-400";case"loadbalance":return"bg-green-500/10 text-green-600 dark:text-green-400";default:return"bg-muted"}};return n?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:()=>s(!1)}),e.jsxs(De,{className:"relative w-[900px] max-h-[85vh] shadow-2xl border-0 overflow-hidden animate-in fade-in zoom-in-95 duration-200 glass-card-strong",children:[e.jsx(at,{className:"pb-4 border-b sticky top-0 z-10",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(rt,{className:"text-xl flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-xl bg-primary/10",children:e.jsx(Kn,{className:"h-6 w-6 text-primary"})}),e.jsxs("div",{children:[e.jsx("span",{className:"font-bold",children:r?"Model Mapping":"模型映射"}),e.jsx("div",{className:"flex items-center gap-2 mt-1",children:e.jsxs($e,{className:"bg-primary/10 text-primary border-primary/20 font-semibold",children:[h.length," ",r?"rules":"条规则"]})})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(D,{variant:"outline",size:"sm",onClick:j,className:"rounded-lg",children:[e.jsx(Ts,{className:"h-4 w-4 mr-1"}),r?"Add Rule":"添加规则"]}),e.jsx(D,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-lg hover:bg-red-500 hover:text-white transition-colors",onClick:()=>s(!1),children:e.jsx(ns,{className:"h-5 w-5"})})]})]})}),e.jsxs(Pe,{className:"p-4",children:[e.jsx("div",{className:"max-h-[calc(85vh-180px)] overflow-y-auto pr-2 space-y-3",children:h.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-muted-foreground",children:[e.jsx("div",{className:"p-4 rounded-full bg-muted mb-4",children:e.jsx(Kn,{className:"h-8 w-8"})}),e.jsx("p",{className:"font-medium",children:r?"No mapping rules":"暂无映射规则"}),e.jsx("p",{className:"text-sm mt-1",children:r?'Click "Add Rule" to create one':'点击"添加规则"创建新规则'})]}):h.map((B,be)=>e.jsxs("div",{className:me("border rounded-xl overflow-hidden transition-all",B.enabled?"bg-background":"bg-muted/30 opacity-60",p===B.id?"ring-2 ring-primary/30":""),children:[e.jsxs("div",{className:"flex items-center gap-3 p-3 cursor-pointer hover:bg-muted/30",onClick:()=>y(p===B.id?null:B.id),children:[e.jsx(uA,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("div",{onClick:K=>K.stopPropagation(),children:e.jsx(is,{checked:B.enabled,onCheckedChange:K=>{T(B.id,{enabled:K})}})}),e.jsxs($e,{className:me("px-2 py-0.5",le(B.type)),children:[q(B.type),e.jsx("span",{className:"ml-1",children:V(B.type)})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"font-medium truncate",children:B.name}),e.jsx("span",{className:"text-muted-foreground mx-2",children:":"}),e.jsx("code",{className:"text-sm bg-muted px-1.5 py-0.5 rounded",children:B.sourceModel||"..."}),e.jsx(Np,{className:"inline h-4 w-4 mx-2 text-muted-foreground"}),e.jsx("code",{className:"text-sm bg-muted px-1.5 py-0.5 rounded",children:B.targetModels.filter(K=>K).join(", ")||"..."})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(D,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:K=>{K.stopPropagation(),k(B.id,"up")},disabled:be===0,children:e.jsx(zi,{className:"h-4 w-4"})}),e.jsx(D,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:K=>{K.stopPropagation(),k(B.id,"down")},disabled:be===h.length-1,children:e.jsx(va,{className:"h-4 w-4"})}),e.jsx(D,{variant:"ghost",size:"icon",className:"h-7 w-7 hover:bg-destructive/10 hover:text-destructive",onClick:K=>{K.stopPropagation(),S(B.id)},children:e.jsx(Vt,{className:"h-4 w-4"})})]})]}),p===B.id&&e.jsxs("div",{className:"border-t p-4 space-y-4 bg-muted/10",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Fe,{children:r?"Rule Name":"规则名称"}),e.jsx(it,{value:B.name,onChange:K=>T(B.id,{name:K.target.value}),placeholder:r?"Enter rule name":"输入规则名称"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Fe,{children:r?"Mapping Type":"映射类型"}),e.jsxs("select",{className:"w-full h-10 px-3 py-2 text-sm rounded-xl border border-input bg-background ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",value:B.type,onChange:K=>T(B.id,{type:K.target.value}),children:[e.jsx("option",{value:"replace",children:r?"Replace - Direct model replacement":"替换 - 直接替换模型"}),e.jsx("option",{value:"alias",children:r?"Alias - Create model alias":"别名 - 创建模型别名"}),e.jsx("option",{value:"loadbalance",children:r?"Load Balance - Random selection":"负载均衡 - 随机选择"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{children:[e.jsx(Fe,{children:r?"Source Model":"源模型"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:r?"The model name in user request (e.g., gpt-4, claude-*, my-alias). Supports * wildcard.":"用户请求时使用的模型名(如 gpt-4, claude-*, my-alias)。支持 * 通配符。"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(it,{value:B.sourceModel,onChange:K=>T(B.id,{sourceModel:K.target.value}),placeholder:r?"e.g., claude-*, gpt-4, my-alias":"例如: claude-*, gpt-4, my-alias",className:"flex-1"}),u.length>0&&e.jsxs("select",{className:"h-10 px-3 text-sm rounded-xl border border-input bg-background",value:"",onChange:K=>{K.target.value&&T(B.id,{sourceModel:K.target.value})},children:[e.jsx("option",{value:"",children:r?"Select model":"选择模型"}),u.map(K=>e.jsx("option",{value:K.id,children:K.id},K.id))]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Fe,{children:r?"Target Models":"目标模型"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:r?"The actual Kiro model to call. Select from the dropdown for official models.":"实际调用的 Kiro 模型。从下拉框选择官方模型。"})]}),e.jsxs(D,{variant:"outline",size:"sm",onClick:()=>R(B.id),className:"h-7 text-xs",children:[e.jsx(Ts,{className:"h-3 w-3 mr-1"}),r?"Add":"添加"]})]}),e.jsx("div",{className:"space-y-2",children:B.targetModels.map((K,se)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(it,{value:K,onChange:te=>I(B.id,se,te.target.value),placeholder:r?"Target model name":"目标模型名",className:"flex-1"}),u.length>0&&e.jsxs("select",{className:"h-10 px-3 text-sm rounded-xl border border-input bg-background",value:"",onChange:te=>{te.target.value&&I(B.id,se,te.target.value)},children:[e.jsx("option",{value:"",children:r?"Select":"选择"}),u.map(te=>e.jsx("option",{value:te.id,children:te.id},te.id))]}),B.type==="loadbalance"&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Fe,{className:"text-xs whitespace-nowrap",children:r?"Weight":"权重"}),e.jsx(it,{type:"number",min:1,value:B.weights?.[se]??1,onChange:te=>G(B.id,se,parseInt(te.target.value)||1),className:"w-16"})]}),B.targetModels.length>1&&e.jsx(D,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-destructive/10 hover:text-destructive",onClick:()=>M(B.id,se),children:e.jsx(Vt,{className:"h-4 w-4"})})]},se))})]}),d.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(Fe,{children:r?"Apply to API Keys (empty = all keys)":"适用 API Key(空 = 所有 Key)"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:d.map(K=>e.jsx($e,{variant:B.apiKeyIds?.includes(K.id)?"default":"outline",className:"cursor-pointer hover:bg-primary/20",onClick:()=>W(B.id,K.id),children:K.name},K.id))})]})]})]},B.id))}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t mt-4",children:[e.jsx(D,{variant:"outline",onClick:()=>s(!1),children:r?"Cancel":"取消"}),e.jsxs(D,{onClick:U,disabled:b,children:[b&&e.jsx(bt,{className:"h-4 w-4 mr-2 animate-spin"}),r?"Save":"保存"]})]})]})]})]}):null}function _I({open:n,onOpenChange:s,accounts:r,selectedAccountId:i,onSelect:o,isEn:d}){const[u,h]=g.useState(""),f=g.useMemo(()=>Array.from(r.values()),[r]),p=g.useMemo(()=>{if(!u.trim())return f;const S=u.toLowerCase();return f.filter(k=>k.email?.toLowerCase().includes(S)||k.id.toLowerCase().includes(S)||k.subscription?.title?.toLowerCase().includes(S))},[f,u]),y=S=>{o(S),s(!1)},b=S=>{const k=S.usage;return k?k.limit>0?Math.min(100,k.current/k.limit*100):k.percentUsed||0:0},v=S=>{const k=S.usage;return k?`${k.current.toFixed(1)} / ${k.limit}`:"-"},N=S=>{if(!S)return"bg-gray-500 text-white";const k=S.toUpperCase();return k.includes("PRO+")||k.includes("PRO_PLUS")||k.includes("PROPLUS")?"bg-purple-500 text-white":k.includes("POWER")?"bg-amber-500 text-white":k.includes("PRO")?"bg-blue-500 text-white":"bg-gray-500 text-white"},j=S=>{const k=S.lastError?.toLowerCase();return k?k.includes("accountsuspendedexception")||k.includes("account suspended")||k.includes("temporarily_suspended")||k.includes("temporarily suspended")||k.includes("user id is")&&k.includes("suspended")||k.includes("账户已封禁")||k.includes("已封禁")||/\b423\b/.test(k)?!0:(k.includes("fetch failed")||k.includes("network")||k.includes("token expired")||k.includes("token 过期")||k.includes("刷新失败")||k.includes("unauthorizedexception"),!1):!1},T=S=>{if(j(S))return{icon:e.jsx(jc,{className:"h-3.5 w-3.5"}),text:d?"Banned":"已封禁",color:"bg-destructive/10 text-destructive"};switch(S.status){case"error":return{icon:e.jsx(ln,{className:"h-3.5 w-3.5"}),text:d?"Error":"错误",color:"bg-destructive/10 text-destructive"};case"expired":return{icon:e.jsx(jc,{className:"h-3.5 w-3.5"}),text:d?"Expired":"已过期",color:"bg-warning/10 text-warning"};case"refreshing":return{icon:e.jsx(Ds,{className:"h-3.5 w-3.5"}),text:d?"Refreshing":"刷新中",color:"bg-warning/10 text-warning"};case"active":return null;default:return null}};return n?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:()=>s(!1)}),e.jsxs(De,{className:"relative w-[600px] max-h-[80vh] shadow-2xl border-0 overflow-hidden animate-in fade-in zoom-in-95 duration-200 glass-card-strong",children:[e.jsxs(at,{className:"pb-3 border-b sticky top-0 z-10",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(rt,{className:"text-lg",children:d?"Select Account":"选择账号"}),e.jsx(D,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-lg hover:bg-red-500 hover:text-white transition-colors",onClick:()=>s(!1),children:e.jsx(ns,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"relative mt-3",children:[e.jsx(to,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(it,{placeholder:d?"Search by email, ID or subscription...":"搜索邮箱、ID 或订阅类型...",value:u,onChange:S=>h(S.target.value),className:"pl-9"})]})]}),e.jsxs(Pe,{className:"p-0 overflow-y-auto max-h-[60vh]",children:[e.jsx("div",{className:`p-4 border-b cursor-pointer transition-colors hover:bg-accent/50 ${i?"":"bg-primary/5 border-l-2 border-l-primary"}`,onClick:()=>y(void 0),children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-muted flex items-center justify-center",children:e.jsx(Ds,{className:"h-5 w-5 text-muted-foreground"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:d?"First Available":"第一个可用账号"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:d?"Automatically use the first available account":"自动使用第一个可用的账号"})]})]}),!i&&e.jsx(Pt,{className:"h-5 w-5 text-primary"})]})}),p.length===0?e.jsx("div",{className:"p-8 text-center text-muted-foreground",children:u?d?"No accounts found":"未找到匹配的账号":d?"No accounts available":"暂无可用账号"}):p.map(S=>{const k=i===S.id,R=b(S),I=v(S),M=T(S),G=j(S),W=S.status==="error"||S.status==="expired"||G;return e.jsx("div",{className:`p-4 border-b cursor-pointer transition-colors hover:bg-accent/50 ${k?"bg-primary/5 border-l-2 border-l-primary":""} ${W?"opacity-60":""}`,onClick:()=>y(S.id),children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0",children:[e.jsx("div",{className:`w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0 ${W?"bg-destructive/10":"bg-primary/10"}`,children:W?e.jsx(ln,{className:"h-5 w-5 text-destructive"}):e.jsx(Mp,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xx,{className:"h-3.5 w-3.5 text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:"font-medium truncate",children:S.email||S.id.substring(0,12)+"..."}),M&&e.jsxs($e,{className:`text-xs ${M.color}`,children:[M.icon,e.jsx("span",{className:"ml-1",children:M.text})]})]}),S.lastError&&e.jsx("div",{className:"text-xs text-destructive mt-1 truncate",children:S.lastError}),e.jsxs("div",{className:"flex items-center gap-3 mt-2",children:[e.jsxs($e,{className:`text-xs ${N(S.subscription?.title)}`,children:[e.jsx($a,{className:"h-3 w-3 mr-1"}),S.subscription?.title||"Unknown"]}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[d?"Usage":"使用量",": ",I]})]}),e.jsx("div",{className:"mt-2 w-full bg-muted rounded-full h-1.5 overflow-hidden",children:e.jsx("div",{className:`h-full transition-all ${R>80?"bg-destructive":R>50?"bg-warning":"bg-success"}`,style:{width:`${R}%`}})}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1.5 font-mono",children:["ID: ",S.id.substring(0,20),"..."]})]})]}),k&&e.jsx(Pt,{className:"h-5 w-5 text-primary flex-shrink-0 mt-2"})]})},S.id)})]})]})]}):null}function VI({open:n,onOpenChange:s,apiKey:r}){const{t:i}=Ut(),o=i("common.unknown")==="Unknown",[d,u]=g.useState("history"),h=N=>new Date(N).toLocaleString(),f=N=>N.replace("anthropic.","").replace("-v1:0",""),p=g.useMemo(()=>r?.usage.daily?Object.entries(r.usage.daily).sort((j,T)=>T[0].localeCompare(j[0])).slice(0,7).reverse().map(([j,T])=>({date:j.slice(5),...T})):[],[r?.usage.daily]),y=g.useMemo(()=>r?.usage.byModel?Object.entries(r.usage.byModel).map(([N,j])=>({model:f(N),...j})).sort((N,j)=>j.requests-N.requests):[],[r?.usage.byModel]),b=g.useMemo(()=>Math.max(...p.map(N=>N.credits),.001),[p]),v=g.useMemo(()=>Math.max(...y.map(N=>N.requests),1),[y]);return!n||!r?null:e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:()=>s(!1)}),e.jsxs(De,{className:"relative w-[900px] max-h-[85vh] shadow-2xl border-0 overflow-hidden animate-in fade-in zoom-in-95 duration-200 glass-card-strong",children:[e.jsxs(at,{className:"pb-3 border-b sticky top-0 z-10",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(rt,{className:"text-lg flex items-center gap-2",children:[e.jsx(Lu,{className:"h-5 w-5 text-primary"}),o?"Usage Details":"用量详情"," - ",r.name]}),e.jsx(D,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-lg hover:bg-red-500 hover:text-white transition-colors",onClick:()=>s(!1),children:e.jsx(ns,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"grid grid-cols-4 gap-4 mt-4",children:[e.jsxs("div",{className:"bg-primary/10 rounded-lg p-3",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:o?"Total Requests":"总请求数"}),e.jsx("div",{className:"text-xl font-bold text-primary",children:r.usage.totalRequests.toLocaleString()})]}),e.jsxs("div",{className:"bg-success/10 rounded-lg p-3",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:o?"Total Credits":"总 Credits"}),e.jsx("div",{className:"text-xl font-bold text-success",children:r.usage.totalCredits.toFixed(4)})]}),e.jsxs("div",{className:"bg-primary/10 rounded-lg p-3",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:o?"Input Tokens":"输入 Tokens"}),e.jsx("div",{className:"text-xl font-bold text-primary",children:r.usage.totalInputTokens.toLocaleString()})]}),e.jsxs("div",{className:"bg-[var(--gradient-to)]/10 rounded-lg p-3",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:o?"Output Tokens":"输出 Tokens"}),e.jsx("div",{className:"text-xl font-bold text-[var(--gradient-to)]",children:r.usage.totalOutputTokens.toLocaleString()})]})]}),e.jsxs("div",{className:"flex gap-2 mt-4",children:[e.jsxs(D,{variant:d==="history"?"default":"outline",size:"sm",onClick:()=>u("history"),children:[e.jsx(Gn,{className:"h-4 w-4 mr-1"}),o?"History":"历史记录"]}),e.jsxs(D,{variant:d==="model"?"default":"outline",size:"sm",onClick:()=>u("model"),children:[e.jsx(ai,{className:"h-4 w-4 mr-1"}),o?"By Model":"按模型"]}),e.jsxs(D,{variant:d==="daily"?"default":"outline",size:"sm",onClick:()=>u("daily"),children:[e.jsx(WN,{className:"h-4 w-4 mr-1"}),o?"Daily Stats":"每日统计"]})]})]}),e.jsxs(Pe,{className:"p-4 max-h-[calc(85vh-280px)] overflow-y-auto",children:[d==="history"&&e.jsx("div",{children:r.usageHistory&&r.usageHistory.length>0?e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-muted/50 sticky top-0",children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left p-2 font-medium",children:o?"Time":"时间"}),e.jsx("th",{className:"text-left p-2 font-medium",children:o?"Model":"模型"}),e.jsx("th",{className:"text-left p-2 font-medium",children:o?"Path":"路径"}),e.jsx("th",{className:"text-right p-2 font-medium",children:o?"In":"输入"}),e.jsx("th",{className:"text-right p-2 font-medium",children:o?"Out":"输出"}),e.jsx("th",{className:"text-right p-2 font-medium",children:"Credits"})]})}),e.jsx("tbody",{className:"font-mono",children:r.usageHistory.map((N,j)=>e.jsxs("tr",{className:"border-b border-muted/30 hover:bg-muted/30",children:[e.jsx("td",{className:"p-2 text-muted-foreground whitespace-nowrap text-xs",children:h(N.timestamp)}),e.jsx("td",{className:"p-2 truncate max-w-[150px]",title:N.model,children:f(N.model)}),e.jsx("td",{className:"p-2 truncate max-w-[120px] text-muted-foreground",title:N.path,children:N.path}),e.jsx("td",{className:"p-2 text-right text-muted-foreground",children:N.inputTokens.toLocaleString()}),e.jsx("td",{className:"p-2 text-right text-muted-foreground",children:N.outputTokens.toLocaleString()}),e.jsx("td",{className:"p-2 text-right text-muted-foreground",children:N.credits.toFixed(6)})]},j))})]}):e.jsx("div",{className:"flex items-center justify-center h-32 text-muted-foreground",children:o?"No usage history yet":"暂无用量记录"})}),d==="model"&&e.jsx("div",{className:"space-y-4",children:y.length>0?y.map((N,j)=>e.jsxs("div",{className:"bg-muted/30 rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"font-medium flex items-center gap-2",children:[e.jsx(ai,{className:"h-4 w-4 text-primary"}),N.model]}),e.jsxs($e,{variant:"secondary",children:[N.requests," ",o?"requests":"次请求"]})]}),e.jsx("div",{className:"h-2 bg-muted rounded-full overflow-hidden mb-3",children:e.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${N.requests/v*100}%`}})}),e.jsxs("div",{className:"grid grid-cols-3 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"text-muted-foreground",children:["Credits",":"]}),e.jsx("span",{className:"ml-2 font-mono",children:N.credits.toFixed(4)})]}),e.jsxs("div",{children:[e.jsxs("span",{className:"text-muted-foreground",children:[o?"Input":"输入",":"]}),e.jsx("span",{className:"ml-2 font-mono",children:N.inputTokens.toLocaleString()})]}),e.jsxs("div",{children:[e.jsxs("span",{className:"text-muted-foreground",children:[o?"Output":"输出",":"]}),e.jsx("span",{className:"ml-2 font-mono",children:N.outputTokens.toLocaleString()})]})]})]},j)):e.jsx("div",{className:"flex items-center justify-center h-32 text-muted-foreground",children:o?"No model statistics yet":"暂无模型统计"})}),d==="daily"&&e.jsx("div",{className:"space-y-4",children:p.length>0?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"bg-muted/30 rounded-lg p-4",children:[e.jsxs("div",{className:"text-sm font-medium mb-4 flex items-center gap-2",children:[e.jsx($3,{className:"h-4 w-4 text-primary"}),o?"Daily Credits (Last 7 Days)":"每日 Credits(最近7天)"]}),e.jsx("div",{className:"flex items-end gap-2 h-32",children:p.map((N,j)=>e.jsxs("div",{className:"flex-1 flex flex-col items-center",children:[e.jsx("div",{className:"w-full bg-primary rounded-t transition-all hover:bg-primary/80",style:{height:`${N.credits/b*100}%`,minHeight:"4px"},title:`${N.credits.toFixed(4)} credits`}),e.jsx("div",{className:"text-xs text-muted-foreground mt-2",children:N.date})]},j))})]}),e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-muted/50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left p-2 font-medium",children:o?"Date":"日期"}),e.jsx("th",{className:"text-right p-2 font-medium",children:o?"Requests":"请求数"}),e.jsx("th",{className:"text-right p-2 font-medium",children:"Credits"}),e.jsx("th",{className:"text-right p-2 font-medium",children:o?"Input":"输入"}),e.jsx("th",{className:"text-right p-2 font-medium",children:o?"Output":"输出"})]})}),e.jsx("tbody",{className:"font-mono",children:Object.entries(r.usage.daily).sort((N,j)=>j[0].localeCompare(N[0])).slice(0,30).map(([N,j],T)=>e.jsxs("tr",{className:"border-b border-muted/30 hover:bg-muted/30",children:[e.jsx("td",{className:"p-2",children:N}),e.jsx("td",{className:"p-2 text-right",children:j.requests}),e.jsx("td",{className:"p-2 text-right",children:j.credits.toFixed(4)}),e.jsx("td",{className:"p-2 text-right text-muted-foreground",children:j.inputTokens.toLocaleString()}),e.jsx("td",{className:"p-2 text-right text-muted-foreground",children:j.outputTokens.toLocaleString()})]},T))})]})]}):e.jsx("div",{className:"flex items-center justify-center h-32 text-muted-foreground",children:o?"No daily statistics yet":"暂无每日统计"})})]})]})]})}function KI(){const{language:n}=vt(),s=n==="en",[r,i]=g.useState([]),[o,d]=g.useState(!0),[u,h]=g.useState(""),[f,p]=g.useState("sk"),[y,b]=g.useState(""),[v,N]=g.useState(null),[j,T]=g.useState(new Set),[S,k]=g.useState(null),[R,I]=g.useState(!1),M=g.useCallback(async()=>{try{const se=await window.api.proxyGetApiKeys();se.success&&i(se.apiKeys)}catch(se){console.error("Failed to load API keys:",se)}finally{d(!1)}},[]);g.useEffect(()=>{M()},[M]);const G=async()=>{if(u.trim())try{const se=y?parseFloat(y):void 0,te=await window.api.proxyAddApiKey({name:u.trim(),format:f,creditsLimit:se&&se>0?se:void 0});te.success&&te.apiKey&&(i(Y=>[...Y,te.apiKey]),h(""),b(""))}catch(se){console.error("Failed to add API key:",se)}},W=async se=>{if(confirm(s?"Delete this API key?":"确定删除此 API Key?"))try{(await window.api.proxyDeleteApiKey(se)).success&&(i(Y=>Y.filter(P=>P.id!==se)),S===se&&k(null))}catch(te){console.error("Failed to delete API key:",te)}},U=async(se,te)=>{try{(await window.api.proxyUpdateApiKey(se,{enabled:te})).success&&i(P=>P.map(F=>F.id===se?{...F,enabled:te}:F))}catch(Y){console.error("Failed to toggle API key:",Y)}},q=async se=>{if(confirm(s?"Reset usage statistics?":"确定重置用量统计?"))try{(await window.api.proxyResetApiKeyUsage(se)).success&&i(Y=>Y.map(P=>P.id===se?{...P,usage:{totalRequests:0,totalCredits:0,totalInputTokens:0,totalOutputTokens:0,daily:{}}}:P))}catch(te){console.error("Failed to reset usage:",te)}},V=(se,te)=>{navigator.clipboard.writeText(te),N(se),setTimeout(()=>N(null),2e3)},le=se=>{T(te=>{const Y=new Set(te);return Y.has(se)?Y.delete(se):Y.add(se),Y})},B=se=>{const te=new Date(se);return`${te.toLocaleDateString()} ${te.toLocaleTimeString()}`},be=se=>se.substring(0,8)+"..."+se.substring(se.length-4),K=r.find(se=>se.id===S);return o?e.jsx("div",{className:"flex items-center justify-center h-32",children:e.jsx(Mt,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs(De,{children:[e.jsxs(at,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Dc,{className:"h-5 w-5 text-primary"}),e.jsx(rt,{className:"text-lg",children:s?"API Keys":"API 密钥"})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[r.length," ",s?"keys":"个"]})]}),e.jsx(Gl,{children:s?"Manage API keys for authentication":"管理用于身份验证的 API 密钥"})]}),e.jsxs(Pe,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(it,{placeholder:s?"Key name...":"密钥名称...",value:u,onChange:se=>h(se.target.value),onKeyDown:se=>se.key==="Enter"&&G(),className:"flex-1"}),e.jsx(ei,{value:f,options:[{value:"sk",label:"sk-xxx"},{value:"simple",label:"PROXY_KEY"},{value:"token",label:"KEY:TOKEN"}],onChange:se=>p(se),className:"w-[120px]"}),e.jsxs(D,{onClick:G,disabled:!u.trim(),children:[e.jsx(Ts,{className:"h-4 w-4 mr-1"}),s?"Add":"添加"]})]}),e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsx(it,{type:"number",placeholder:s?"Credits limit (optional)":"Credits 额度限制(可选)",value:y,onChange:se=>b(se.target.value),className:"flex-1"}),e.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:s?"0 = unlimited":"0 = 无限制"})]})]}),r.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:s?"No API keys yet":"暂无 API 密钥"}):e.jsx("div",{className:"space-y-2",children:r.map(se=>e.jsxs("div",{className:me("flex items-center gap-3 p-3 rounded-lg border transition-colors cursor-pointer",S===se.id?"bg-primary/5 border-primary":"hover:bg-muted/50",!se.enabled&&"opacity-50"),onClick:()=>k(S===se.id?null:se.id),children:[e.jsx("div",{onClick:te=>te.stopPropagation(),children:e.jsx(is,{checked:se.enabled,onCheckedChange:te=>U(se.id,te)})}),e.jsxs("div",{className:"flex-1 min-w-0 overflow-hidden",children:[e.jsx("div",{className:"font-medium truncate",children:se.name}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx("code",{className:"bg-muted px-1 rounded",children:j.has(se.id)?se.key:be(se.key)}),e.jsx("button",{className:"hover:text-foreground",onClick:te=>{te.stopPropagation(),le(se.id)},children:j.has(se.id)?e.jsx(Jl,{className:"h-3 w-3"}):e.jsx(Nc,{className:"h-3 w-3"})}),e.jsx("button",{className:"hover:text-foreground",onClick:te=>{te.stopPropagation(),V(se.id,se.key)},children:v===se.id?e.jsx(Pt,{className:"h-3 w-3 text-success"}):e.jsx(As,{className:"h-3 w-3"})})]})]}),e.jsxs("div",{className:"text-right text-xs text-muted-foreground",children:[e.jsxs("div",{children:[se.usage.totalRequests," ",s?"requests":"请求"]}),e.jsxs("div",{className:me(se.creditsLimit&&se.usage.totalCredits>=se.creditsLimit&&"text-destructive font-medium"),children:[se.usage.totalCredits.toFixed(2),se.creditsLimit?`/${se.creditsLimit}`:""," credits"]})]}),e.jsx(D,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive",onClick:te=>{te.stopPropagation(),W(se.id)},children:e.jsx(Vt,{className:"h-4 w-4"})})]},se.id))})]})]}),K&&e.jsxs(De,{children:[e.jsx(at,{className:"pb-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Lu,{className:"h-5 w-5 text-primary"}),e.jsxs(rt,{className:"text-lg",children:[s?"Usage Details":"用量详情",": ",K.name]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(D,{variant:"outline",size:"sm",onClick:()=>I(!0),children:[e.jsx(Xs,{className:"h-3 w-3 mr-1"}),s?"View Details":"查看详情"]}),e.jsxs(D,{variant:"outline",size:"sm",onClick:()=>q(K.id),children:[e.jsx(Mt,{className:"h-3 w-3 mr-1"}),s?"Reset Usage":"重置用量"]})]})]})}),e.jsxs(Pe,{children:[e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"bg-muted/50 rounded-lg p-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[e.jsx(gx,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs",children:s?"Total Requests":"总请求数"})]}),e.jsx("div",{className:"text-2xl font-bold",children:K.usage.totalRequests})]}),e.jsxs("div",{className:"bg-muted/50 rounded-lg p-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[e.jsx(Ds,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs",children:s?"Total Credits":"总 Credits"})]}),e.jsx("div",{className:"text-2xl font-bold",children:K.usage.totalCredits.toFixed(2)})]}),e.jsxs("div",{className:"bg-muted/50 rounded-lg p-3",children:[e.jsx("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:e.jsx("span",{className:"text-xs",children:s?"Input Tokens":"输入 Tokens"})}),e.jsx("div",{className:"text-2xl font-bold",children:K.usage.totalInputTokens.toLocaleString()})]}),e.jsxs("div",{className:"bg-muted/50 rounded-lg p-3",children:[e.jsx("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:e.jsx("span",{className:"text-xs",children:s?"Output Tokens":"输出 Tokens"})}),e.jsx("div",{className:"text-2xl font-bold",children:K.usage.totalOutputTokens.toLocaleString()})]})]}),e.jsxs("div",{className:"mt-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:s?"Credits Limit:":"Credits 额度限制:"}),e.jsx(it,{type:"number",placeholder:s?"Unlimited":"无限制",value:K.creditsLimit||"",onChange:async se=>{const te=se.target.value?parseFloat(se.target.value):null;(await window.api.proxyUpdateApiKey(K.id,{creditsLimit:te&&te>0?te:null})).success&&i(P=>P.map(F=>F.id===K.id?{...F,creditsLimit:te&&te>0?te:void 0}:F))},className:"w-32 h-8"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:s?"(0 = unlimited)":"(0 = 无限制)"})]}),e.jsxs("div",{className:"text-xs text-muted-foreground space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Gn,{className:"h-3 w-3"}),e.jsxs("span",{children:[s?"Created:":"创建时间:"," ",B(K.createdAt)]})]}),K.lastUsedAt&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Gn,{className:"h-3 w-3"}),e.jsxs("span",{children:[s?"Last used:":"最后使用:"," ",B(K.lastUsedAt)]})]})]})]})]})]}),e.jsx(VI,{open:R,onOpenChange:I,apiKey:K||null})]})}const HI={claudeCode:"Claude Code",opencode:"OpenCode",codex:"Codex CLI",gemini:"Gemini CLI",hermes:"Hermes",openclaw:"OpenClaw"},Uu=["claude-sonnet-4.5","claude-sonnet-4","claude-opus-4.8","claude-opus-4.7","claude-opus-4.5","claude-haiku-4.5"],FI=[{id:"claude-sonnet-4.5",name:"Claude Sonnet 4.5",description:"Claude Sonnet 4.5",inputTypes:["TEXT","IMAGE"],maxInputTokens:2e5,maxOutputTokens:64e3},{id:"claude-sonnet-4",name:"Claude Sonnet 4",description:"Claude Sonnet 4",inputTypes:["TEXT","IMAGE"],maxInputTokens:2e5,maxOutputTokens:64e3},{id:"claude-opus-4.8",name:"Claude Opus 4.8",description:"Power account model",inputTypes:["TEXT","IMAGE"],maxInputTokens:2e5,maxOutputTokens:64e3},{id:"claude-opus-4.7",name:"Claude Opus 4.7",description:"Power account model",inputTypes:["TEXT","IMAGE"],maxInputTokens:2e5,maxOutputTokens:64e3},{id:"claude-opus-4.5",name:"Claude Opus 4.5",description:"Power account model",inputTypes:["TEXT","IMAGE"],maxInputTokens:2e5,maxOutputTokens:64e3},{id:"claude-haiku-4.5",name:"Claude Haiku 4.5",description:"Claude Haiku 4.5",inputTypes:["TEXT","IMAGE"],maxInputTokens:2e5,maxOutputTokens:64e3}];function ss(n){return n.trim().toLowerCase().replace(/^(claude-(?:sonnet|haiku|opus)-\d+)-(\d+)(.*)$/u,"$1.$2$3")}function nj(n){const s=new Map;for(const r of[...n,...FI]){if(!r.id?.trim())continue;const i=ss(r.id);s.has(i)||s.set(i,r)}return Array.from(s.values()).sort((r,i)=>{const o=Uu.findIndex(u=>ss(u)===ss(r.id)),d=Uu.findIndex(u=>ss(u)===ss(i.id));return o!==-1||d!==-1?(o===-1?99:o)-(d===-1?99:d):ss(r.id)==="auto"?1:ss(i.id)==="auto"?-1:r.id.localeCompare(i.id)})}function aj(n,s){const r=ss(s),i=n.find(o=>ss(o.id)===r);if(r&&r!=="auto"&&i)return i.id;for(const o of Uu){const d=n.find(u=>ss(u.id)===ss(o));if(d)return d.id}return n.find(o=>ss(o.id)!=="auto")?.id||n[0]?.id||""}function Lf(n,s){const r=new Map(n.map(u=>[ss(u.id),u.id])),i=s.map(u=>r.get(ss(u))).filter(u=>!!(u&&ss(u)!=="auto"));if(i.length>0)return Array.from(new Set(i));const o=Uu.map(u=>r.get(ss(u))).filter(u=>!!(u&&ss(u)!=="auto"));if(o.length>0)return Array.from(new Set(o));const d=n.find(u=>ss(u.id)!=="auto")?.id;return d?[d]:[]}function GI({open:n,onOpenChange:s,isEn:r}){const i=vt(oe=>oe.accounts),o=vt(oe=>oe.activeAccountId),[d,u]=g.useState([]),[h,f]=g.useState(""),[p,y]=g.useState([]),[b,v]=g.useState(["openclaw"]),[N,j]=g.useState(!1),[T,S]=g.useState(!1),[k,R]=g.useState(!1),[I,M]=g.useState(!1),[G,W]=g.useState(null),[U,q]=g.useState([]),[V,le]=g.useState(""),[,B]=g.useState([]),[be,K]=g.useState(null),[se,te]=g.useState(!1),Y=g.useMemo(()=>[{id:"claudeCode",name:"Claude Code",description:r?"Writes ANTHROPIC_BASE_URL, API key and default model":"Ghi ANTHROPIC_BASE_URL, API key và model mặc định",icon:UN},{id:"opencode",name:"OpenCode",description:r?"Adds Kiro provider and model metadata to opencode.json":"Thêm provider Kiro và metadata model vào opencode.json",icon:L3},{id:"codex",name:"Codex CLI",description:r?"Adds Kiro OpenAI Responses provider":"Thêm provider Kiro dùng OpenAI Responses",icon:YN},{id:"gemini",name:"Gemini CLI",description:r?"Writes .env and settings.json for Gemini v1beta":"Ghi .env và settings.json cho Gemini v1beta",icon:Hi},{id:"hermes",name:"Hermes",description:r?"Adds Kiro provider to config.yaml":"Thêm provider Kiro vào config.yaml",icon:GM},{id:"openclaw",name:"OpenClaw",description:r?"Adds Kiro provider to openclaw.json":"Thêm provider Kiro vào openclaw.json",icon:Ka}],[r]),P=d.find(oe=>oe.id===h),F=g.useMemo(()=>new Set(p.map(ss)),[p]),fe=b.length===1&&b[0]==="openclaw",pe=oe=>oe.length<=14?oe:`${oe.slice(0,8)}...${oe.slice(-4)}`,C=oe=>oe.find(ue=>ue.name==="OpenClaw - Kiro API Proxy")||oe.find(ue=>ue.enabled!==!1)||oe[0]||null,z=g.useCallback(async()=>{j(!0),W(null),q([]);try{const oe=await window.api.proxyGetModels();if(oe.success&&oe.models.length>0){const L=nj(oe.models);u(L),f(we=>aj(L,we)),y(we=>Lf(L,we));return}const ue=o?i.get(o):void 0,ae=ue?.status==="active"&&ue.credentials?.accessToken?ue:Array.from(i.values()).find(L=>L.status==="active"&&L.credentials?.accessToken);if(ae){const L=await window.api.accountGetModels(ae.credentials.accessToken,ae.credentials.region||"us-east-1",ae.profileArn,ae.machineId,ae.credentials.provider||ae.idp,ae.credentials.authMethod,ae.id);if(L.success&&L.models.length>0){const we=nj(L.models);u(we),f(Ue=>aj(we,Ue)),y(Ue=>Lf(we,Ue));return}}u([]),f(""),y([]),W(r?"No models were loaded. Please check whether the account is active and try reloading.":"Chưa tải được model. Hãy kiểm tra tài khoản đang active rồi tải lại.")}catch(oe){u([]),f(""),y([]),W(oe instanceof Error?oe.message:r?"Failed to load models":"Tải model thất bại")}finally{j(!1)}},[i,o,r]),X=g.useCallback(async()=>{S(!0);try{const oe=await window.api.proxyGetApiKeys();if(oe.success){const ue=oe.apiKeys||[];B(ue),K(C(ue))}}catch(oe){console.error("[ClientConfig] Failed to load API keys:",oe)}finally{S(!1)}},[]);if(g.useEffect(()=>{n&&(z(),X())},[n,z,X]),!n)return null;const re=oe=>{q([]),v(ue=>ue.includes(oe)?ue.filter(ae=>ae!==oe):[...ue,oe])},xe=oe=>{q([]),y(ue=>{const ae=ss(oe),L=ue.some(Ue=>ss(Ue)===ae),we=L?ue.filter(Ue=>ss(Ue)!==ae):[...ue,oe];return!L&&we.length===1&&f(oe),L&&ss(h)===ae&&f(we[0]||""),we})},Oe=()=>{q([]),y(Lf(d,[]))},Ee=()=>{q([]),y(h?[h]:[])},Qe=async()=>{be?.key&&(await navigator.clipboard.writeText(be.key),te(!0),setTimeout(()=>te(!1),1600))},_e=async()=>{R(!0),W(null);try{const oe=await window.api.proxyAddApiKey({name:"OpenClaw - Kiro API Proxy",format:"sk"});if(!oe.success||!oe.apiKey){W(oe.error||(r?"Failed to create API key":"Tạo API key thất bại"));return}B(ue=>[oe.apiKey,...ue]),K(oe.apiKey)}catch(oe){W(oe instanceof Error?oe.message:r?"Failed to create API key":"Tạo API key thất bại")}finally{R(!1)}},st=async()=>{if(!h){W(r?"Please select a model":"Hãy chọn model");return}if(b.length===0){W(r?"Please select at least one client":"Hãy chọn ít nhất một client");return}if(p.length===0){W(r?"Please select at least one model to add":"Hãy chọn ít nhất một model để thêm");return}M(!0),W(null),q([]);try{const oe=new Set(p.map(ss));oe.add(ss(h));const ue=d.filter(we=>oe.has(ss(we.id)));!ue.some(we=>ss(we.id)===ss(h))&&P&&ue.unshift(P);const ae=await window.api.proxyConfigureClients({clients:b,modelId:h,modelName:P?.name,models:ue.map(we=>({id:we.id,name:we.name,inputTypes:we.inputTypes,maxInputTokens:we.maxInputTokens,maxOutputTokens:we.maxOutputTokens}))});le(ae.openaiBaseUrl||ae.proxyOrigin);const L=ae.apiKey;L&&(K(L),B(we=>we.some(Ue=>Ue.id&&Ue.id===L.id)?we.map(Ue=>Ue.id===L.id?{...Ue,...L}:Ue):[L,...we])),q(ae.results),ae.success||W(ae.error||(r?"Some clients failed to configure":"Một số client cấu hình thất bại"))}catch(oe){W(oe instanceof Error?oe.message:r?"Failed to configure clients":"Cấu hình client thất bại")}finally{M(!1)}};return e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:()=>s(!1)}),e.jsxs(De,{className:"relative w-[780px] max-h-[85vh] shadow-2xl border-0 overflow-hidden animate-in fade-in zoom-in-95 duration-200 glass-card-strong",children:[e.jsx(at,{className:"pb-4 border-b sticky top-0 z-10",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(rt,{className:"text-xl flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-xl bg-primary/10",children:e.jsx(Ka,{className:"h-6 w-6 text-primary"})}),e.jsxs("div",{children:[e.jsx("span",{className:"font-bold",children:r?"One-Click Client Configuration":"Cấu hình client một chạm"}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsxs($e,{className:"bg-primary/10 text-primary border-primary/20 font-semibold",children:[b.length," ",r?"selected":"đã chọn"]}),V&&e.jsx($e,{variant:"secondary",className:"text-xs border-0",children:V})]})]})]}),e.jsx(D,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-lg hover:bg-red-500 hover:text-white transition-colors",onClick:()=>s(!1),children:e.jsx(ns,{className:"h-5 w-5"})})]})}),e.jsx(Pe,{className:"p-4",children:e.jsxs("div",{className:"max-h-[calc(85vh-140px)] overflow-y-auto pr-2 space-y-4",children:[e.jsxs("div",{className:"rounded-xl border bg-background p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ii,{className:"h-4 w-4 text-primary"}),e.jsx("span",{className:"font-medium",children:r?"Kiro API Proxy key":"Key Kiro API Proxy"})]}),e.jsxs(D,{variant:"outline",size:"sm",onClick:_e,disabled:k,children:[k?e.jsx(bt,{className:"h-4 w-4 animate-spin"}):e.jsx(ii,{className:"h-4 w-4"}),r?"Create key":"Tạo key"]})]}),e.jsxs("div",{className:"rounded-lg border bg-muted/40 px-3 py-2 flex items-center gap-2",children:[e.jsx("code",{className:"flex-1 text-xs break-all",children:T?r?"Loading key...":"Đang tải key...":be?.key?pe(be.key):r?"No key yet. Import will create one automatically.":"Chưa có key. Khi import hệ thống sẽ tự tạo."}),be?.key&&e.jsx(D,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:Qe,title:r?"Copy key":"Sao chép key",children:se?e.jsx(Pt,{className:"h-3.5 w-3.5 text-success"}):e.jsx(As,{className:"h-3.5 w-3.5"})})]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:r?"The server stores this key and OpenClaw uses it to call the Kiro API proxy quota pool.":"Server sẽ lưu key này để OpenClaw gọi qua Kiro API proxy và dùng quota xoay tài khoản."})]}),e.jsxs("div",{className:"rounded-xl border bg-background p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ai,{className:"h-4 w-4 text-primary"}),e.jsx("span",{className:"font-medium",children:"Model"})]}),e.jsxs(D,{variant:"outline",size:"sm",onClick:z,disabled:N,children:[N?e.jsx(bt,{className:"h-4 w-4 animate-spin"}):e.jsx(Z3,{className:"h-4 w-4"}),r?"Reload":"Tải lại"]})]}),N?e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground py-2",children:[e.jsx(bt,{className:"h-4 w-4 animate-spin"}),r?"Loading models...":"Đang tải model..."]}):d.length>0?e.jsxs("div",{className:"space-y-2",children:[e.jsx(ei,{value:h,options:d.map(oe=>({value:oe.id,label:oe.id,description:oe.name&&oe.name!==oe.id?oe.name:oe.description})),onChange:oe=>{f(oe),y(ue=>ue.some(ae=>ss(ae)===ss(oe))?ue:[...ue,oe]),q([])},placeholder:r?"Select model":"Chọn model"}),P&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[e.jsx($e,{variant:"secondary",className:"border-0",children:P.name||P.id}),P.inputTypes?.map(oe=>e.jsx($e,{variant:"secondary",className:"border-0",children:oe},oe))]}),e.jsxs("div",{className:"rounded-lg border bg-muted/20 p-3 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx($e,{className:"bg-primary/10 text-primary border-primary/20",children:p.length}),e.jsx("span",{className:"text-sm font-medium",children:r?"Models to add":"Model sẽ thêm"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(D,{type:"button",variant:"outline",size:"sm",onClick:Oe,children:[e.jsx(Pt,{className:"h-3.5 w-3.5"}),r?"Recommended":"Đề xuất"]}),e.jsx(D,{type:"button",variant:"ghost",size:"sm",onClick:Ee,children:r?"Only primary":"Chỉ primary"})]})]}),e.jsx("div",{className:"grid grid-cols-2 gap-2 max-h-56 overflow-y-auto pr-1",children:d.filter(oe=>ss(oe.id)!=="auto").map(oe=>{const ue=F.has(ss(oe.id));return e.jsxs("button",{type:"button",onClick:()=>xe(oe.id),className:me("flex items-start gap-2 rounded-lg border px-3 py-2 text-left text-xs transition-colors",ue?"border-primary/50 bg-primary/10":"border-border bg-background hover:border-primary/40"),children:[e.jsx("span",{className:me("mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded border",ue?"border-primary bg-primary text-primary-foreground":"border-muted-foreground/40"),children:ue&&e.jsx(Pt,{className:"h-3 w-3"})}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block truncate font-semibold",children:oe.id}),oe.name&&oe.name!==oe.id&&e.jsx("span",{className:"block truncate text-muted-foreground",children:oe.name})]})]},oe.id)})})]})]}):e.jsx("div",{className:"text-sm text-muted-foreground py-2",children:r?"No models loaded":"Chưa có model"})]}),e.jsx("div",{className:"grid grid-cols-3 gap-3",children:Y.map(oe=>{const ue=oe.icon,ae=b.includes(oe.id);return e.jsxs("button",{type:"button",onClick:()=>re(oe.id),className:me("text-left rounded-xl border p-4 transition-all hover:border-primary/50 hover:bg-primary/5",ae?"border-primary/50 bg-primary/10 shadow-sm":"bg-background"),children:[e.jsxs("div",{className:"flex items-start justify-between gap-2 mb-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10",children:e.jsx(ue,{className:"h-5 w-5 text-primary"})}),e.jsx("div",{className:me("h-5 w-5 rounded-full border flex items-center justify-center",ae?"bg-primary border-primary text-primary-foreground":"border-muted-foreground/40"),children:ae&&e.jsx(Pt,{className:"h-3.5 w-3.5"})})]}),e.jsx("div",{className:"font-semibold text-sm mb-1",children:oe.name}),e.jsx("div",{className:"text-xs text-muted-foreground leading-relaxed",children:oe.description})]},oe.id)})}),e.jsxs("div",{className:"rounded-xl border border-warning/30 bg-warning/10 p-3 flex items-start gap-2 text-sm text-warning",children:[e.jsx(ln,{className:"h-4 w-4 mt-0.5 shrink-0"}),e.jsx("div",{children:r?"Existing client files are merged and backed up before writing.":"File client hiện có sẽ được merge và tạo backup trước khi ghi."})]}),G&&e.jsxs("div",{className:"rounded-xl border border-destructive/30 bg-destructive/10 p-3 flex items-start gap-2 text-sm text-destructive",children:[e.jsx(ln,{className:"h-4 w-4 mt-0.5 shrink-0"}),e.jsx("div",{children:G})]}),U.length>0&&e.jsxs("div",{className:"space-y-2",children:[V&&e.jsxs("div",{className:"rounded-xl border border-primary/20 bg-primary/5 p-3 text-xs text-muted-foreground space-y-1",children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-semibold text-foreground",children:"Base URL:"})," ",e.jsx("code",{children:V})]}),e.jsx("div",{children:r?"In OpenClaw, use /models and choose the krouter provider.":"Trong OpenClaw, gõ /models rồi chọn provider krouter."})]}),U.map(oe=>e.jsxs("div",{className:me("rounded-xl border p-3 text-sm",oe.success?"border-success/30 bg-success/10":"border-destructive/30 bg-destructive/10"),children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 mb-2",children:[e.jsx("span",{className:"font-semibold",children:HI[oe.client]}),e.jsx($e,{className:oe.success?"bg-success/15 text-success border-success/20":"bg-destructive/15 text-destructive border-destructive/20",children:oe.success?r?"Configured":"Đã cấu hình":r?"Failed":"Thất bại"})]}),oe.error?e.jsx("div",{className:"text-xs text-destructive",children:oe.error}):e.jsxs("div",{className:"space-y-1 text-xs text-muted-foreground",children:[oe.paths.map(ue=>e.jsx("div",{className:"font-mono break-all",children:ue},ue)),oe.backupPaths.length>0&&e.jsxs("div",{children:[r?"Backups created":"Backup đã tạo",": ",oe.backupPaths.length]})]})]},oe.client))]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(D,{variant:"outline",onClick:()=>s(!1),disabled:I,children:r?"Close":"Đóng"}),e.jsxs(D,{onClick:st,disabled:N||I||!h||p.length===0||b.length===0,children:[I?e.jsx(bt,{className:"h-4 w-4 animate-spin"}):e.jsx(Pt,{className:"h-4 w-4"}),I?r?"Configuring...":"Đang cấu hình...":fe?r?"Import to OpenClaw":"Import vào OpenClaw":r?"Apply Configuration":"Áp dụng cấu hình"]})]})]})})]})]})}const qI=5e3;function zl(n){return n>=1e9?`${(n/1e9).toFixed(1)}B`:n>=1e6?`${(n/1e6).toFixed(1)}M`:n>=1e5?`${(n/1e3).toFixed(0)}K`:n.toLocaleString()}let Nu=[],Ep=null,rj=!1;function XI(){rj||(rj=!0,window.api.onProxyResponse(n=>{const s=new Date,r=s.getFullYear(),i=(s.getMonth()+1).toString().padStart(2,"0"),o=s.getDate().toString().padStart(2,"0"),d=s.getHours().toString().padStart(2,"0"),u=s.getMinutes().toString().padStart(2,"0"),h=s.getSeconds().toString().padStart(2,"0"),f=s.getMilliseconds().toString().padStart(3,"0");Nu=[{time:`${r}-${i}-${o} ${d}:${u}:${h}.${f}`,path:n.path,model:n.model,status:n.status,tokens:n.tokens,inputTokens:n.inputTokens,outputTokens:n.outputTokens,cacheReadTokens:n.cacheReadTokens,reasoningTokens:n.reasoningTokens,credits:n.credits,responseTime:n.responseTime,error:n.error},...Nu.slice(0,99)],Ep?.(Nu)}))}function YI(){const{t:n}=Ut(),s=n("common.unknown")==="Unknown",[r,i]=g.useState(!1),[o,d]=g.useState({enabled:!1,port:5580,host:"127.0.0.1",enableMultiAccount:!0,logRequests:!0,clientDrivenToolExecution:!0,accountSelectionStrategy:"round-robin",sessionAffinityEnabled:!1}),[u,h]=g.useState(null),[f,p]=g.useState(null),[y,b]=g.useState(0),[v,N]=g.useState(0),[j,T]=g.useState(!1),[S,k]=g.useState(null),[R,I]=g.useState(Nu),[M,G]=g.useState(!1),[W,U]=g.useState(!1),[q,V]=g.useState(!1),[le,B]=g.useState(!1),[be,K]=g.useState(!1),[se,te]=g.useState(!1),[Y,P]=g.useState(!1),[F,fe]=g.useState(!1),[pe,C]=g.useState(!1),[z,X]=g.useState([]),[re,xe]=g.useState(!1),[Oe,Ee]=g.useState(!1),[Qe,_e]=g.useState(!1),[st,oe]=g.useState("sk"),[ue,ae]=g.useState(!1),[L,we]=g.useState(!1),[Ue,Lt]=g.useState(null),[xt,Qt]=g.useState(""),[ft,Et]=g.useState(!1),[Ge,gt]=g.useState(!1),Ze=vt(H=>H.accounts),J=vt(H=>H.groups),Ne=g.useCallback(()=>{const H=Xe=>{const Nt="abcdefghijklmnopqrstuvwxyz0123456789";return Array.from({length:Xe},()=>Nt[Math.floor(Math.random()*Nt.length)]).join("")};let Se;switch(st){case"sk":Se=`sk-${H(48)}`;break;case"simple":Se=`PROXY_KEY_${H(32).toUpperCase()}`;break;case"token":Se=`PROXY_KEY:${H(32)}`;break;default:Se=`sk-${H(48)}`}d(Xe=>({...Xe,apiKey:Se})),window.api.proxyUpdateConfig({apiKey:Se}),_e(!0),we(!0),setTimeout(()=>we(!1),1500)},[st]),et=g.useCallback(()=>{o.apiKey&&(navigator.clipboard.writeText(o.apiKey),ae(!0),setTimeout(()=>ae(!1),1500))},[o.apiKey]),qe=g.useCallback(async()=>{try{const H=await window.api.proxyGetStatus();if(i(H.running),H.config){const Xe=H.config;Xe.selectedAccountIds&&Xe.selectedAccountIds.length>0&&(Xe.selectedAccountId=Xe.selectedAccountIds[0]);const Nt=Xe.clientDrivenToolExecution!==!1;d({...Xe,clientDrivenToolExecution:Nt})}H.stats&&h(H.stats),H.sessionStats&&p(H.sessionStats);const Se=await window.api.proxyGetAccounts();b(Se.accounts.length),N(Se.availableCount)}catch(H){console.error("Failed to fetch proxy status:",H)}},[]),Je=g.useCallback(async()=>{if(typeof window.api.dashboardTunnelGetStatus=="function")try{const H=await window.api.dashboardTunnelGetStatus();Lt(H),Qt(Se=>Se||H.localUrl||"")}catch(H){console.error("Failed to fetch dashboard tunnel status:",H)}},[]),Kt=async()=>{if(typeof window.api.dashboardTunnelStart=="function"){Et(!0),k(null);try{const H=await window.api.dashboardTunnelStart({localUrl:xt.trim()||void 0});Lt(H.status),Qt(H.status.localUrl),H.success||k(H.error||H.status.error||"Không bật được Dashboard Tunnel")}catch(H){k(H instanceof Error?H.message:String(H))}finally{Et(!1)}}},Ye=async()=>{if(typeof window.api.dashboardTunnelStop=="function"){Et(!0),k(null);try{const H=await window.api.dashboardTunnelStop();Lt(H.status),H.success||k(H.error||H.status.error||"Không tắt được Dashboard Tunnel")}catch(H){k(H instanceof Error?H.message:String(H))}finally{Et(!1)}}},qt=g.useCallback(()=>{Ue?.publicUrl&&(navigator.clipboard.writeText(Ue.publicUrl),gt(!0),setTimeout(()=>gt(!1),1500))},[Ue?.publicUrl]),Jt=g.useCallback(async()=>{try{const H=await window.api.proxyGetModels();H.success&&H.models&&X(H.models.map(Se=>({id:Se.id,name:Se.name||Se.id})))}catch{}},[]),Ct=g.useCallback(async H=>{G(!0),V(!1);try{const Se=H?.mode??o.multiAccountSelectionMode??"all",Xe=H?.groupIds??o.multiAccountGroupIds??[];let Nt=Array.from(Ze.values()).filter(Bt=>Bt.status==="active"&&Bt.credentials?.accessToken);if(o.enableMultiAccount&&Se==="groups"){const Bt=new Set(Xe);Nt=Nt.filter(qn=>qn.groupId?Bt.has(qn.groupId):Bt.has("__ungrouped__"))}const nt=Nt.map(Bt=>({id:Bt.id,email:Bt.email,accessToken:Bt.credentials.accessToken,refreshToken:Bt.credentials?.refreshToken,profileArn:Bt.profileArn,expiresAt:Bt.credentials?.expiresAt,machineId:Bt.machineId,clientId:Bt.credentials?.clientId,clientSecret:Bt.credentials?.clientSecret,region:Bt.credentials?.region||"us-east-1",authMethod:Bt.credentials?.authMethod,provider:Bt.credentials?.provider||Bt.idp,groupId:Bt.groupId})),$t=await window.api.proxySyncAccounts(nt);$t.success&&(b($t.accountCount||0),await qe(),V(!0),setTimeout(()=>V(!1),2e3))}catch(Se){console.error("Failed to sync accounts:",Se)}finally{G(!1)}},[Ze,qe,o.enableMultiAccount,o.multiAccountSelectionMode,o.multiAccountGroupIds]),O=async()=>{k(null);try{await Ct();const H=await window.api.proxyStart({port:o.port,host:o.host,apiKey:o.apiKey,enableMultiAccount:o.enableMultiAccount,enabled:!0,autoStart:o.autoStart,accountSelectionStrategy:o.enableMultiAccount?o.accountSelectionStrategy||"round-robin":o.accountSelectionStrategy,sessionAffinityEnabled:o.enableMultiAccount&&(o.accountSelectionStrategy||"round-robin")!=="sticky"?!1:o.sessionAffinityEnabled,logRequests:o.logRequests,clientDrivenToolExecution:o.clientDrivenToolExecution!==!1,disableTools:o.disableTools});H.success?(i(!0),d(Se=>({...Se,enabled:!0})),await qe()):k(H.error||(s?"Failed to start":"Khởi động thất bại"))}catch(H){k(H.message)}},ne=async()=>{k(null);try{const H=await window.api.proxyStop();H.success?(i(!1),d(Se=>({...Se,enabled:!1})),h(null)):k(H.error||(s?"Failed to stop":"Dừng thất bại"))}catch(H){k(H.message)}},ze=()=>{const Se=`http://${o.host==="0.0.0.0"?"localhost":o.host}:${o.port}`;navigator.clipboard.writeText(Se),T(!0),setTimeout(()=>T(!1),2e3)},_=async()=>{U(!0),B(!1);try{const H=await window.api.proxyRefreshModels();H.success?(await Jt(),B(!0),setTimeout(()=>B(!1),2e3)):k(H.error||(s?"Failed to refresh models":"Làm mới model thất bại"))}catch(H){k(H.message)}finally{U(!1)}};g.useEffect(()=>{window.api.proxyLoadLogs().then(H=>{H.success&&H.logs.length>0&&I(H.logs)})},[]),g.useEffect(()=>{Je();const H=setInterval(()=>void Je(),5e3);return()=>clearInterval(H)},[Je]),g.useEffect(()=>{if(R.length===0)return;const H=setTimeout(()=>{window.api.proxySaveLogs(R)},2e3);return()=>clearTimeout(H)},[R]),g.useEffect(()=>{qe(),Jt();const H=window.api.onProxyRequest(nt=>{console.log("[Proxy] Request:",nt)});XI(),Ep=I;const Se=window.api.onProxyResponse(()=>{qe()}),Xe=window.api.onProxyError(nt=>{console.error("[Proxy] Error:",nt),k(nt)}),Nt=window.api.onProxyStatusChange(nt=>{i(nt.running),nt.running&&d($t=>({...$t,port:nt.port}))});return()=>{H(),Se(),Xe(),Nt(),Ep=null}},[qe,Jt]),g.useEffect(()=>{const H=()=>{document.hidden||qe()};document.addEventListener("visibilitychange",H);const Se=setInterval(H,qI);return()=>{document.removeEventListener("visibilitychange",H),clearInterval(Se)}},[qe]);const ce=g.useRef(Ct);g.useEffect(()=>{ce.current=Ct},[Ct]);const Ce=g.useMemo(()=>Array.from(Ze.values()).filter(H=>H.status==="active"&&H.credentials?.accessToken).map(H=>`${H.id}:${H.groupId||""}`).sort().join("|"),[Ze]),Ve=g.useRef(!1);g.useEffect(()=>{if(!r)return;if(!Ve.current){Ve.current=!0;return}const H=setTimeout(()=>{ce.current()},600);return()=>clearTimeout(H)},[Ce,r]);const[je,He]=g.useState(0);g.useEffect(()=>{if(!r||!u){He(0);return}He(Math.floor((Date.now()-u.startTime)/1e3));const H=setInterval(()=>{He(Math.floor((Date.now()-u.startTime)/1e3))},1e3);return()=>clearInterval(H)},[r,u]);const Tt=H=>{const Se=Math.floor(H/3600),Xe=Math.floor(H%3600/60),Nt=H%60;return`${Se}h ${Xe}m ${Nt}s`};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs(De,{className:"hover-lift relative z-10",children:[e.jsx(at,{className:"pb-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10",children:e.jsx(Sc,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{children:[e.jsx(rt,{className:"text-lg text-primary",children:"Kiro API Proxy"}),e.jsx(Gl,{children:s?"Provides OpenAI and Claude compatible API endpoints":"Cung cấp endpoint tương thích OpenAI và Claude"})]})]}),e.jsxs($e,{variant:r?"default":"secondary",className:r?"bg-success text-white flex items-center gap-1.5 pr-2.5":"bg-muted text-muted-foreground flex items-center gap-1.5 pr-2.5",children:[e.jsxs("span",{className:"relative flex h-2 w-2",children:[r&&e.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-white opacity-75"}),e.jsx("span",{className:r?"relative inline-flex rounded-full h-2 w-2 bg-white":"relative inline-flex rounded-full h-2 w-2 bg-muted-foreground"})]}),r?s?"Running":"Đang chạy":s?"Stopped":"Đã dừng"]})]})}),e.jsxs(Pe,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[r?e.jsxs(D,{onClick:ne,variant:"destructive",className:"gap-2",children:[e.jsx(Cn,{className:"h-4 w-4"}),s?"Stop Service":"Tắt dịch vụ"]}):e.jsxs(D,{onClick:O,className:"gap-2",children:[e.jsx(Ba,{className:"h-4 w-4"}),s?"Start Service":"Bật dịch vụ"]}),e.jsxs(D,{onClick:()=>void Ct(),variant:"outline",className:"gap-2",disabled:!r||M,children:[M?e.jsx(bt,{className:"h-4 w-4 animate-spin"}):q?e.jsx(Pt,{className:"h-4 w-4 text-success"}):e.jsx(Mt,{className:"h-4 w-4"}),M?s?"Syncing...":"Đang đồng bộ...":q?s?"Synced!":"Đã đồng bộ":s?"Sync Accounts":"Đồng bộ tài khoản"]}),e.jsxs(D,{onClick:_,variant:"outline",className:"gap-2",disabled:!r||W,children:[W?e.jsx(bt,{className:"h-4 w-4 animate-spin"}):le?e.jsx(Pt,{className:"h-4 w-4 text-success"}):e.jsx(Mt,{className:"h-4 w-4"}),W?s?"Refreshing...":"Đang làm mới...":le?s?"Refreshed!":"Đã làm mới":s?"Refresh Models":"Làm mới model"]}),e.jsxs(D,{onClick:()=>P(!0),variant:"outline",className:"gap-2",disabled:!r,children:[e.jsx(ai,{className:"h-4 w-4"}),s?"View Models":"Xem model"]}),e.jsxs(D,{onClick:()=>fe(!0),variant:"outline",className:"gap-2",children:[e.jsx(Ka,{className:"h-4 w-4"}),s?"Configure Clients":"Cấu hình client"]})]}),S&&e.jsxs("div",{className:"flex items-center gap-2 text-destructive text-sm",children:[e.jsx(ln,{className:"h-4 w-4"}),S]}),r&&e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Fe,{className:"min-w-[80px]",children:s?"Address:":"Địa chỉ:"}),e.jsxs("code",{className:"flex-1 px-3 py-2 bg-muted rounded text-sm",children:["http://",o.host==="0.0.0.0"?"localhost":o.host,":",o.port]}),e.jsx(D,{variant:"outline",size:"icon",onClick:ze,children:j?e.jsx(Pt,{className:"h-4 w-4"}):e.jsx(As,{className:"h-4 w-4"})})]}),o.host==="0.0.0.0"&&e.jsx("p",{className:"text-xs text-muted-foreground pl-[88px]",children:s?`LAN devices use http://<this-machine-IP>:${o.port}`:`Thiết bị khác dùng http://<IP-máy-này>:${o.port}`})]}),e.jsxs("div",{className:"rounded-lg border bg-background/70 p-3 space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"p-1.5 rounded-md bg-primary/10",children:e.jsx(ri,{className:"h-4 w-4 text-primary"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-semibold",children:s?"Dashboard Tunnel":"Tunnel dashboard"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s?"Expose the dashboard with Cloudflare Quick Tunnel. Login is still required.":"Mở dashboard bằng Cloudflare Quick Tunnel. Người dùng vẫn phải đăng nhập."})]})]}),e.jsx($e,{variant:Ue?.running?"default":"secondary",className:Ue?.running?"bg-success text-white":"",children:Ue?.running?s?"Online":"Đang bật":s?"Off":"Đang tắt"})]}),e.jsxs("div",{className:"grid grid-cols-12 gap-2 items-end",children:[e.jsxs("div",{className:"col-span-8 space-y-1.5",children:[e.jsx(Fe,{htmlFor:"tunnelTarget",className:"text-xs",children:s?"Local dashboard target":"Đích dashboard nội bộ"}),e.jsx(it,{id:"tunnelTarget",value:xt,onChange:H=>Qt(H.target.value),placeholder:s?"Example: http://127.0.0.1 or http://127.0.0.1:4010":"Ví dụ: http://127.0.0.1 hoặc http://127.0.0.1:4010",disabled:Ue?.running||ft,className:"h-9"})]}),e.jsx("div",{className:"col-span-4 flex gap-2",children:Ue?.running?e.jsxs(D,{onClick:Ye,variant:"outline",className:"gap-2 flex-1",disabled:ft,children:[ft?e.jsx(bt,{className:"h-4 w-4 animate-spin"}):e.jsx(Cn,{className:"h-4 w-4"}),s?"Stop Tunnel":"Tắt tunnel"]}):e.jsxs(D,{onClick:Kt,variant:"outline",className:"gap-2 flex-1",disabled:ft,children:[ft?e.jsx(bt,{className:"h-4 w-4 animate-spin"}):e.jsx(Ba,{className:"h-4 w-4"}),s?"Start Tunnel":"Bật tunnel"]})})]}),Ue?.publicUrl&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"flex-1 px-3 py-2 bg-muted rounded text-sm truncate",children:Ue.publicUrl}),e.jsx(D,{variant:"outline",size:"icon",onClick:qt,title:s?"Copy tunnel URL":"Sao chép link tunnel",children:Ge?e.jsx(Pt,{className:"h-4 w-4"}):e.jsx(As,{className:"h-4 w-4"})}),e.jsx(D,{variant:"outline",size:"icon",onClick:()=>window.api.openExternal(Ue.publicUrl),title:s?"Open tunnel":"Mở tunnel",children:e.jsx(Xs,{className:"h-4 w-4"})})]}),Ue?.error&&e.jsx("div",{className:"text-xs text-destructive",children:Ue.error}),Ue&&!Ue.running&&!Ue.error&&e.jsx("div",{className:"text-xs text-muted-foreground",children:s?`Binary: ${Ue.binary}. Set CLOUDFLARED_BIN if cloudflared is not in PATH.`:`File chạy: ${Ue.binary}. Nếu cloudflared không có trong PATH, đặt CLOUDFLARED_BIN.`})]}),e.jsxs("div",{className:"grid grid-cols-12 gap-3",children:[e.jsxs("div",{className:"col-span-2 space-y-1.5",children:[e.jsx(Fe,{htmlFor:"port",className:"text-xs",children:s?"Port":"Cổng"}),e.jsx(it,{id:"port",type:"number",value:o.port,onChange:H=>{const Se=parseInt(H.target.value)||5580;d(Xe=>({...Xe,port:Se})),window.api.proxyUpdateConfig({port:Se})},disabled:r,className:"h-9"})]}),e.jsxs("div",{className:"col-span-3 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(Fe,{htmlFor:"host",className:"text-xs",title:o.host==="0.0.0.0"?s?"LAN access enabled. Set an API Key and allow port through firewall.":"Đang cho phép truy cập ngoài máy; nên đặt API Key và mở cổng firewall":s?"Loopback only. Toggle Public for LAN access.":"Chỉ chạy nội bộ; bật Public để thiết bị khác truy cập",children:s?"Host":"Địa chỉ nghe"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(is,{id:"publicAccess",checked:o.host==="0.0.0.0",onCheckedChange:async H=>{const Se=H?"0.0.0.0":"127.0.0.1";if(d(Xe=>({...Xe,host:Se})),await window.api.proxyUpdateConfig({host:Se}),r)try{await window.api.proxyStop(),await new Promise(Xe=>setTimeout(Xe,200)),await window.api.proxyStart()}catch(Xe){console.error("[Proxy] Failed to restart after host change:",Xe),k(Xe instanceof Error?Xe.message:String(Xe))}},className:"scale-75"}),e.jsx(Fe,{htmlFor:"publicAccess",className:"text-[10px] cursor-pointer",children:"Public"})]})]}),e.jsx(it,{id:"host",value:o.host,onChange:H=>{const Se=H.target.value;d(Xe=>({...Xe,host:Se})),window.api.proxyUpdateConfig({host:Se})},disabled:r,className:`h-9 ${o.host==="0.0.0.0"?"border-warning/50":""}`})]}),e.jsxs("div",{className:"col-span-7 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(Fe,{htmlFor:"apiKey",className:"text-xs",title:s?"When set, requests must provide this key in Authorization or X-Api-Key header":"Khi đặt key, request phải gửi qua header Authorization hoặc X-Api-Key",children:s?"API Key (Optional)":"API Key (tùy chọn)"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ei,{value:st,options:[{value:"sk",label:"sk-xxx"},{value:"simple",label:"PROXY_KEY"},{value:"token",label:"KEY:TOKEN"}],onChange:H=>oe(H),className:"w-[120px] h-7 text-xs [&>button]:h-7 [&>button]:py-0 [&>button]:px-2.5"}),e.jsx(D,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:Ne,disabled:r,title:s?"Generate":"Tạo ngẫu nhiên",children:L?e.jsx(Pt,{className:"h-3.5 w-3.5 text-success"}):e.jsx(F3,{className:"h-3.5 w-3.5"})}),o.apiKey&&e.jsx(D,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:et,title:s?"Copy":"Sao chép",children:ue?e.jsx(Pt,{className:"h-3.5 w-3.5 text-success"}):e.jsx(As,{className:"h-3.5 w-3.5"})}),e.jsx(D,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>Ee(!0),title:s?"Manage Multiple API Keys":"Quản lý nhiều API Key",children:e.jsx(Ka,{className:"h-3.5 w-3.5"})})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(it,{id:"apiKey",type:Qe?"text":"password",placeholder:s?"Leave empty to skip auth":"Để trống để bỏ xác thực",value:o.apiKey||"",onChange:H=>{const Se=H.target.value||void 0;d(Xe=>({...Xe,apiKey:Se})),window.api.proxyUpdateConfig({apiKey:Se})},disabled:r,className:"pr-9 h-9"}),e.jsx(D,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-2.5 hover:bg-transparent",onClick:()=>_e(!Qe),title:Qe?s?"Hide":"Ẩn":s?"Show":"Hiện",children:Qe?e.jsx(Jl,{className:"h-3.5 w-3.5"}):e.jsx(Nc,{className:"h-3.5 w-3.5"})})]})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-x-4 gap-y-3 items-center",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(is,{id:"autoStart",checked:o.autoStart||!1,onCheckedChange:async H=>{const Se=H?{autoStart:!0,enabled:!0}:{autoStart:!1,enabled:r};d(Nt=>({...Nt,...Se}));const Xe=await window.api.proxyUpdateConfig(Se);Xe.success||k(Xe.error||(s?"Failed to update auto start":"Không lưu được tự khởi động")),await qe()}}),e.jsx(Fe,{htmlFor:"autoStart",className:"text-sm cursor-pointer",children:s?"Auto Start":"Tự khởi động"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(is,{id:"multiAccount",checked:o.enableMultiAccount,onCheckedChange:H=>{const Se=H?{enableMultiAccount:!0,accountSelectionStrategy:"round-robin",sessionAffinityEnabled:!1}:{enableMultiAccount:!1};d(Xe=>({...Xe,...Se})),window.api.proxyUpdateConfig(Se)},disabled:r}),e.jsx(Fe,{htmlFor:"multiAccount",className:"text-sm cursor-pointer",children:s?"Multi-Account":"Nhiều tài khoản"})]}),o.enableMultiAccount&&e.jsxs("div",{className:"col-span-2 flex items-center gap-2",children:[e.jsxs(Fe,{className:"text-sm shrink-0",children:[s?"Strategy":"Chiến lược",":"]}),e.jsx("div",{className:"flex gap-1 bg-muted/30 rounded-lg p-0.5",children:["round-robin","least-used","sticky"].map(H=>{const Se=(o.accountSelectionStrategy||"round-robin")===H,Xe=H==="round-robin"?"Round-Robin":H==="least-used"?"Least-Used":"Sticky",Nt=H==="round-robin"?"Xoay vòng":H==="least-used"?"Ít dùng nhất":"Bám phiên";return e.jsx("button",{type:"button",disabled:r,className:`px-3 py-1 rounded-md text-xs font-medium transition-all ${Se?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground hover:bg-muted/50"} disabled:opacity-50 disabled:cursor-not-allowed`,onClick:()=>{const nt=H!=="sticky"?{accountSelectionStrategy:H,sessionAffinityEnabled:!1}:{accountSelectionStrategy:H};d($t=>({...$t,...nt})),window.api.proxyUpdateConfig(nt)},children:s?Xe:Nt},H)})}),e.jsx("span",{className:"text-xs text-muted-foreground",children:(()=>{const H=o.accountSelectionStrategy||"round-robin";return H==="least-used"?s?"Pick the account with the fewest successful requests":"Chọn tài khoản có số request thành công thấp nhất":H==="sticky"?s?"Stay on success account until failure (preserves prompt cache)":"Giữ tài khoản đang thành công cho tới khi lỗi":s?"Each request rotates to next account (load balanced)":"Mỗi request chuyển sang tài khoản kế tiếp để cân bằng tải"})()})]}),o.enableMultiAccount&&(()=>{const H=o.multiAccountSelectionMode||"all",Se=new Set(o.multiAccountGroupIds||[]),Xe=Array.from(J.values()).sort((Ot,ws)=>(Ot.order??0)-(ws.order??0)),Nt=Array.from(Ze.values()).filter(Ot=>Ot.status==="active"&&Ot.credentials?.accessToken),nt=Nt.filter(Ot=>!Ot.groupId).length,$t=new Map;for(const Ot of Nt)Ot.groupId&&$t.set(Ot.groupId,($t.get(Ot.groupId)||0)+1);const Bt=H==="all"?Nt.length:Nt.filter(Ot=>Ot.groupId?Se.has(Ot.groupId):Se.has("__ungrouped__")).length,qn=Ot=>{const ws=new Set(Se);ws.has(Ot)?ws.delete(Ot):ws.add(Ot);const Hs=Array.from(ws);d(Z=>({...Z,multiAccountGroupIds:Hs})),window.api.proxyUpdateConfig({multiAccountGroupIds:Hs}),Ct({mode:"groups",groupIds:Hs})};return e.jsxs("div",{className:"col-span-2 flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs(Fe,{className:"text-sm shrink-0",children:[s?"Scope":"Phạm vi",":"]}),e.jsx("div",{className:"flex gap-1 bg-muted/30 rounded-lg p-0.5",children:["all","groups"].map(Ot=>{const ws=H===Ot,Hs=Ot==="all"?s?"All Accounts":"Tất cả tài khoản":s?"Specific Groups":"Nhóm đã chọn";return e.jsx("button",{type:"button",disabled:r,className:`px-3 py-1 rounded-md text-xs font-medium transition-all ${ws?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground hover:bg-muted/50"} disabled:opacity-50 disabled:cursor-not-allowed`,onClick:()=>{d(Z=>({...Z,multiAccountSelectionMode:Ot})),window.api.proxyUpdateConfig({multiAccountSelectionMode:Ot}),Ct({mode:Ot,groupIds:Array.from(Se)})},children:Hs},Ot)})}),e.jsx("span",{className:"text-xs text-muted-foreground",children:H==="all"?s?`${Bt} active accounts`:`${Bt} tài khoản hoạt động`:s?`${Bt} accounts in selected groups`:`${Bt} tài khoản trong nhóm đã chọn`})]}),H==="groups"&&e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 pl-[60px]",children:[e.jsxs("button",{type:"button",disabled:r,onClick:()=>qn("__ungrouped__"),className:`flex items-center gap-1 px-2 h-7 rounded-md text-xs font-medium border transition-all ${Se.has("__ungrouped__")?"bg-muted text-foreground border-muted-foreground/30":"bg-background text-muted-foreground border-border hover:text-foreground hover:border-primary/40"} disabled:opacity-50 disabled:cursor-not-allowed`,children:[Se.has("__ungrouped__")&&e.jsx(Pt,{className:"h-3 w-3"}),e.jsx("span",{children:s?"Ungrouped":"Chưa nhóm"}),e.jsxs("span",{className:"text-[10px] opacity-70",children:["(",nt,")"]})]}),Xe.map(Ot=>{const ws=Se.has(Ot.id),Hs=$t.get(Ot.id)||0;return e.jsxs("button",{type:"button",disabled:r,onClick:()=>qn(Ot.id),className:`flex items-center gap-1 px-2 h-7 rounded-md text-xs font-medium border transition-all ${ws?"text-foreground":"bg-background text-muted-foreground border-border hover:text-foreground hover:border-primary/40"} disabled:opacity-50 disabled:cursor-not-allowed`,style:ws?{backgroundColor:(Ot.color||"#888")+"22",borderColor:(Ot.color||"#888")+"66"}:void 0,children:[ws&&e.jsx(Pt,{className:"h-3 w-3",style:{color:Ot.color||void 0}}),e.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:Ot.color||"#888"}}),e.jsx("span",{children:Ot.name}),e.jsxs("span",{className:"text-[10px] opacity-70",children:["(",Hs,")"]})]},Ot.id)}),Xe.length===0&&e.jsx("span",{className:"text-xs text-muted-foreground italic",children:s?"No groups defined yet. Create groups in Account Manager first.":"Chưa có nhóm nào. Hãy tạo nhóm trong trang Tài khoản trước."})]})]})})(),!o.enableMultiAccount&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"col-span-2",children:e.jsxs(D,{variant:"outline",className:"w-full justify-start",onClick:()=>xe(!0),disabled:r,children:[e.jsx(Iv,{className:"h-4 w-4 mr-2"}),o.selectedAccountId?(()=>{const H=Ze.get(o.selectedAccountId);return H?H.email||H.id.substring(0,12)+"...":s?"First Available":"Tài khoản khả dụng đầu tiên"})():s?"First Available":"Tài khoản khả dụng đầu tiên"]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(is,{id:"autoSwitchOnQuotaExhausted",checked:o.autoSwitchOnQuotaExhausted||!1,onCheckedChange:H=>{d(Se=>({...Se,autoSwitchOnQuotaExhausted:H})),window.api.proxyUpdateConfig({autoSwitchOnQuotaExhausted:H})},disabled:r}),e.jsx(Fe,{htmlFor:"autoSwitchOnQuotaExhausted",className:"text-sm cursor-pointer truncate",title:s?"Auto-switch on quota exhausted":"Tự chuyển khi tài khoản hết hạn mức",children:s?"Auto-switch":"Tự chuyển"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(is,{id:"logRequests",checked:o.logRequests,onCheckedChange:H=>{d(Se=>({...Se,logRequests:H})),window.api.proxyUpdateConfig({logRequests:H})}}),e.jsx(Fe,{htmlFor:"logRequests",className:"text-sm cursor-pointer",children:s?"Log Requests":"Ghi log request"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(is,{id:"logStreamEvents",checked:o.logStreamEvents||!1,onCheckedChange:H=>{d(Se=>({...Se,logStreamEvents:H})),window.api.proxyUpdateConfig({logStreamEvents:H})}}),e.jsx(Fe,{htmlFor:"logStreamEvents",className:"text-sm cursor-pointer",children:s?"Stream Events":"Sự kiện stream"})]})]}),e.jsxs("div",{className:"border-t border-border pt-3 overflow-visible",children:[e.jsxs("h4",{className:"text-xs font-medium mb-2 text-muted-foreground uppercase tracking-wider flex items-center gap-1.5",children:[e.jsx(Ka,{className:"h-3.5 w-3.5"}),s?"Advanced Settings":"Cài đặt nâng cao"]}),e.jsxs("div",{className:"grid grid-cols-3 gap-x-3 gap-y-3 items-start overflow-visible",children:[e.jsxs("div",{className:"space-y-1.5 relative z-20",children:[e.jsx(Fe,{htmlFor:"preferredEndpoint",className:"text-xs",children:s?"Preferred Endpoint":"Endpoint ưu tiên"}),e.jsx(ei,{value:o.preferredEndpoint||"",options:[{value:"",label:s?"Auto Select":"Tự chọn",description:s?"Auto select based on availability":"Tự chọn endpoint theo khả dụng"},{value:"codewhisperer",label:"CodeWhisperer",description:s?"IDE mode endpoint":"Endpoint chế độ IDE"},{value:"amazonq",label:"AmazonQ",description:s?"IDE mode (q.amazonaws.com)":"Chế độ IDE (q.amazonaws.com)"},{value:"amazonq-cli",label:"AmazonQ CLI",description:s?"CLI mode (SendMessageStreaming)":"Chế độ CLI (SendMessageStreaming)"}],onChange:H=>{const Se=H||void 0;d(Xe=>({...Xe,preferredEndpoint:Se})),window.api.proxyUpdateConfig({preferredEndpoint:Se})},placeholder:s?"Select endpoint":"Chọn endpoint"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Fe,{htmlFor:"maxRetries",className:"text-xs",children:s?"Max Retries":"Số lần thử lại tối đa"}),e.jsx(it,{id:"maxRetries",type:"number",min:0,max:10,value:o.maxRetries||3,onChange:H=>{const Se=parseInt(H.target.value)||3;d(Xe=>({...Xe,maxRetries:Se})),window.api.proxyUpdateConfig({maxRetries:Se})},disabled:r,className:"h-9"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Fe,{htmlFor:"payloadSizeLimit",className:"text-xs",title:s?"When payload exceeds this limit, oldest tool results will be truncated. Default 1536KB (1.5MB).":"Khi payload vượt giới hạn này, kết quả tool cũ nhất sẽ bị cắt. Mặc định 1536KB (1.5MB).",children:"Payload (KB)"}),e.jsx(it,{id:"payloadSizeLimit",type:"number",min:256,max:10240,step:128,value:o.payloadSizeLimitKB||1536,onChange:H=>{const Se=parseInt(H.target.value)||1536;d(Xe=>({...Xe,payloadSizeLimitKB:Se})),window.api.proxyUpdateConfig({payloadSizeLimitKB:Se})},disabled:r,className:"h-9"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Fe,{htmlFor:"clientDrivenToolExecution",className:"text-xs",title:s?"Recommended for OpenCode and Claude Code. Disable only when the proxy should fabricate tool results.":"Khuyến nghị cho OpenCode và Claude Code. Chỉ tắt khi muốn proxy tự tạo kết quả tool.",children:s?"Tool Execution":"Thực thi tool"}),e.jsxs("div",{className:"flex items-center justify-between h-9 px-3 rounded-md border border-input bg-transparent",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:s?"Client-driven":"Client xử lý"}),e.jsx(is,{id:"clientDrivenToolExecution",checked:o.clientDrivenToolExecution!==!1,onCheckedChange:H=>{d(Se=>({...Se,clientDrivenToolExecution:H})),window.api.proxyUpdateConfig({clientDrivenToolExecution:H})},disabled:r,className:"scale-90"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Fe,{htmlFor:"disableTools",className:"text-xs",title:s?"When enabled, the proxy strips all tool definitions from requests.":"Khi bật, proxy sẽ loại bỏ toàn bộ định nghĩa tool khỏi request, phù hợp chat thuần.",children:s?"Disable Tools":"Tắt gọi tool"}),e.jsxs("div",{className:"flex items-center justify-between h-9 px-3 rounded-md border border-input bg-transparent",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:s?"No tool calls":"Không gọi tool"}),e.jsx(is,{id:"disableTools",checked:o.disableTools||!1,onCheckedChange:H=>{d(Se=>({...Se,disableTools:H})),window.api.proxyUpdateConfig({disableTools:H})},disabled:r,className:"scale-90"})]})]}),e.jsxs("div",{className:"col-span-3 space-y-1.5",children:[e.jsx(Fe,{htmlFor:"tokenBufferReserve",className:"text-xs",title:s?"When enabled, reserves N tokens below context window for trim (e.g. 200K → trim at 180K). When disabled, never trims.":"Khi bật, chừa N token dưới context window để làm ngưỡng cắt (ví dụ 200K -> cắt ở 180K). Khi tắt sẽ không cắt lịch sử.",children:s?"Token Buffer Reserve (auto-trim history)":"Dự phòng token (tự cắt lịch sử)"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between h-9 px-3 rounded-md border border-input bg-transparent w-[160px] flex-shrink-0",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:s?"Auto-trim":"Bật tự cắt"}),e.jsx(is,{id:"enableTokenBufferReserve",checked:o.enableTokenBufferReserve||!1,onCheckedChange:H=>{d(Se=>({...Se,enableTokenBufferReserve:H})),window.api.proxyUpdateConfig({enableTokenBufferReserve:H})},disabled:r,className:"scale-90"})]}),e.jsx(it,{id:"tokenBufferReserve",type:"number",min:5e3,max:15e4,step:1e3,value:o.tokenBufferReserve||2e4,onChange:H=>{const Se=parseInt(H.target.value)||2e4;d(Xe=>({...Xe,tokenBufferReserve:Se})),window.api.proxyUpdateConfig({tokenBufferReserve:Se})},disabled:r||!o.enableTokenBufferReserve,placeholder:s?"Reserve tokens (default 20000)":"Số token dự phòng (mặc định 20000)",className:"h-9 flex-1"})]})]})]})]})]})]}),e.jsx(OI,{config:o,setConfig:d,isRunning:r,isEn:s}),r&&e.jsxs("div",{className:"grid grid-cols-6 gap-3",children:[e.jsx(De,{className:"hover-lift bg-gradient-to-br from-blue-500/5 to-transparent",children:e.jsxs(Pe,{className:"pt-3 pb-3",children:[e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground mb-1",children:[e.jsx(Fn,{className:"h-3 w-3"}),e.jsx("span",{children:s?"Pool":"Pool tài khoản"})]}),e.jsxs("div",{className:"text-xl font-bold text-foreground",children:[v,"/",y]})]})}),e.jsx(De,{className:"hover-lift bg-gradient-to-br from-purple-500/5 to-transparent",children:e.jsxs(Pe,{className:"pt-3 pb-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(Ks,{className:"h-3 w-3"}),e.jsx("span",{children:s?"Total":"Tổng request"})]}),e.jsx(D,{variant:"ghost",size:"icon",className:"h-4 w-4 text-muted-foreground hover:text-destructive",onClick:async()=>{await window.api.proxyResetRequestStats();const H=await window.api.proxyGetStatus();H.stats&&h(H.stats),H.sessionStats&&p(H.sessionStats)},title:s?"Reset Statistics":"Đặt lại thống kê",children:e.jsx(gr,{className:"h-3 w-3"})})]}),e.jsx("div",{className:"text-xl font-bold text-foreground",children:u?.totalRequests||0})]})}),e.jsx(De,{className:"hover-lift bg-gradient-to-br from-green-500/5 to-transparent",children:e.jsxs(Pe,{className:"pt-3 pb-3",children:[e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground mb-1",children:[e.jsx(Pt,{className:"h-3 w-3"}),e.jsx("span",{children:s?"Total S/F":"Tổng thành công/lỗi"})]}),e.jsxs("div",{className:"text-xl font-bold",children:[e.jsx("span",{className:"text-success",children:u?.successRequests||0}),e.jsx("span",{className:"text-muted-foreground mx-1",children:"/"}),e.jsx("span",{className:"text-destructive",children:u?.failedRequests||0})]})]})}),e.jsx(De,{className:"hover-lift bg-gradient-to-br from-cyan-500/5 to-transparent",children:e.jsxs(Pe,{className:"pt-3 pb-3",children:[e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground mb-1",children:[e.jsx(Ds,{className:"h-3 w-3"}),e.jsx("span",{children:s?"Session":"Phiên này"})]}),e.jsx("div",{className:"text-xl font-bold text-foreground",children:f?.totalRequests||0})]})}),e.jsx(De,{className:"hover-lift bg-gradient-to-br from-orange-500/5 to-transparent",children:e.jsxs(Pe,{className:"pt-3 pb-3",children:[e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground mb-1",children:[e.jsx(Ks,{className:"h-3 w-3"}),e.jsx("span",{children:s?"Session S/F":"Phiên thành công/lỗi"})]}),e.jsxs("div",{className:"text-xl font-bold",children:[e.jsx("span",{className:"text-success",children:f?.successRequests||0}),e.jsx("span",{className:"text-muted-foreground mx-1",children:"/"}),e.jsx("span",{className:"text-destructive",children:f?.failedRequests||0})]})]})}),e.jsx(De,{className:"hover-lift bg-gradient-to-br from-primary/5 to-transparent",children:e.jsxs(Pe,{className:"pt-3 pb-3",children:[e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground mb-1",children:[e.jsx(Gn,{className:"h-3 w-3"}),e.jsx("span",{children:s?"Uptime":"Thời gian chạy"})]}),e.jsx("div",{className:"text-xl font-bold text-primary whitespace-nowrap",children:Tt(je)})]})})]}),r&&u&&e.jsxs("div",{className:"grid grid-cols-6 gap-3",children:[e.jsx(De,{className:"hover-lift bg-gradient-to-br from-indigo-500/5 to-transparent",children:e.jsxs(Pe,{className:"pt-3 pb-3",children:[e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground mb-1",children:[e.jsx(Ks,{className:"h-3 w-3"}),e.jsx("span",{children:s?"Total Tokens":"Tổng token"})]}),e.jsx("div",{className:"text-xl font-bold text-indigo-500",title:((u.inputTokens||0)+(u.outputTokens||0)).toLocaleString(),children:zl((u.inputTokens||0)+(u.outputTokens||0))})]})}),e.jsx(De,{className:"hover-lift bg-gradient-to-br from-blue-500/5 to-transparent",children:e.jsxs(Pe,{className:"pt-3 pb-3",children:[e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground mb-1",children:[e.jsx(Ks,{className:"h-3 w-3"}),e.jsx("span",{children:s?"Input / Output":"Đầu vào / Đầu ra"})]}),e.jsxs("div",{className:"text-sm font-bold",children:[e.jsx("span",{className:"text-blue-500",title:(u.inputTokens||0).toLocaleString(),children:zl(u.inputTokens||0)}),e.jsx("span",{className:"text-muted-foreground mx-1",children:"/"}),e.jsx("span",{className:"text-purple-500",title:(u.outputTokens||0).toLocaleString(),children:zl(u.outputTokens||0)})]})]})}),e.jsx(De,{className:"hover-lift bg-gradient-to-br from-emerald-500/5 to-transparent",children:e.jsxs(Pe,{className:"pt-3 pb-3",children:[e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground mb-1",children:[e.jsx(ai,{className:"h-3 w-3"}),e.jsx("span",{children:s?"Cache Hit":"Cache hit"}),(()=>{const H=u.cacheReadTokens||0,Se=H+(u.cacheWriteTokens||0),Xe=Se>0?H/Se*100:0;return Xe>0?e.jsxs($e,{variant:"secondary",className:"ml-1 text-[10px] px-1 py-0",children:[Xe.toFixed(0),"%"]}):null})()]}),e.jsxs("div",{className:"text-sm font-bold",children:[e.jsx("span",{className:"text-emerald-500",title:`${s?"Cache Read":"Đọc cache"}: ${(u.cacheReadTokens||0).toLocaleString()}`,children:zl(u.cacheReadTokens||0)}),e.jsx("span",{className:"text-muted-foreground mx-1",children:"/"}),e.jsx("span",{className:"text-amber-500",title:`${s?"Cache Write":"Ghi cache"}: ${(u.cacheWriteTokens||0).toLocaleString()}`,children:zl(u.cacheWriteTokens||0)})]})]})}),e.jsx(De,{className:"hover-lift bg-gradient-to-br from-violet-500/5 to-transparent",children:e.jsxs(Pe,{className:"pt-3 pb-3",children:[e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground mb-1",children:[e.jsx(Ds,{className:"h-3 w-3"}),e.jsx("span",{children:s?"Reasoning":"Token suy luận"})]}),e.jsx("div",{className:"text-xl font-bold text-violet-500",title:(u.reasoningTokens||0).toLocaleString(),children:zl(u.reasoningTokens||0)})]})}),e.jsx(De,{className:"hover-lift bg-gradient-to-br from-green-500/5 to-transparent",children:e.jsxs(Pe,{className:"pt-3 pb-3",children:[e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground mb-1",children:[e.jsx(Iv,{className:"h-3 w-3"}),e.jsx("span",{children:s?"Success Rate":"Tỷ lệ thành công"})]}),e.jsx("div",{className:"text-xl font-bold text-success",children:u.totalRequests>0?`${(u.successRequests/u.totalRequests*100).toFixed(1)}%`:"-"})]})}),e.jsx(De,{className:"hover-lift bg-gradient-to-br from-amber-500/5 to-transparent",children:e.jsxs(Pe,{className:"pt-3 pb-3",children:[e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground mb-1",children:[e.jsx(Sc,{className:"h-3 w-3"}),e.jsx("span",{children:"Credits"})]}),e.jsx("div",{className:"text-xl font-bold text-amber-500",children:(u.totalCredits||0).toFixed(4)})]})})]}),e.jsxs(De,{className:"hover-lift",children:[e.jsx(at,{className:"pb-2",children:e.jsxs(rt,{className:"text-base flex items-center gap-2",children:[e.jsx("div",{className:"p-1.5 rounded-lg bg-primary/10",children:e.jsx(ri,{className:"h-4 w-4 text-primary"})}),s?"API Endpoints":"Endpoint API"]})}),e.jsxs(Pe,{className:"space-y-1.5 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-orange-500 w-11 flex-shrink-0 font-mono",children:"POST"}),e.jsx("code",{className:"text-muted-foreground flex-1 font-mono",children:"/v1/chat/completions"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:s?"OpenAI Compatible":"Tương thích OpenAI"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-orange-500 w-11 flex-shrink-0 font-mono",children:"POST"}),e.jsx("code",{className:"text-muted-foreground flex-1 font-mono",children:"/v1/responses"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"OpenAI Responses"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-orange-500 w-11 flex-shrink-0 font-mono",children:"POST"}),e.jsx("code",{className:"text-muted-foreground flex-1 font-mono",children:"/v1/messages"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:s?"Claude Compatible":"Tương thích Claude"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-orange-500 w-11 flex-shrink-0 font-mono",children:"POST"}),e.jsx("code",{className:"text-muted-foreground flex-1 font-mono",children:"/anthropic/v1/messages"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"Claude Code"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-orange-500 w-11 flex-shrink-0 font-mono",children:"POST"}),e.jsx("code",{className:"text-muted-foreground flex-1 font-mono",children:"/v1/messages/count_tokens"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:s?"Token Count":"Đếm token"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-green-500 w-11 flex-shrink-0 font-mono",children:"GET"}),e.jsx("code",{className:"text-muted-foreground flex-1 font-mono",children:"/v1/models"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:s?"Model List":"Danh sách model"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-orange-500 w-11 flex-shrink-0 font-mono",children:"POST"}),e.jsx("code",{className:"text-muted-foreground flex-1 font-mono",children:"/v1beta/models/*:generateContent"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:s?"Gemini Compatible":"Tương thích Gemini"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-green-500 w-11 flex-shrink-0 font-mono",children:"GET"}),e.jsx("code",{className:"text-muted-foreground flex-1 font-mono",children:"/v1beta/models"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:s?"Gemini Models":"Model Gemini"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-green-500 w-11 flex-shrink-0 font-mono",children:"GET"}),e.jsx("code",{className:"text-muted-foreground flex-1 font-mono",children:"/health"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:s?"Health Check":"Kiểm tra health"})]}),e.jsxs("div",{className:"border-t pt-2 mt-2 space-y-1.5",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:s?"Admin API (Requires API Key)":"Admin API (cần API Key)"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-green-500 w-11 flex-shrink-0 font-mono",children:"GET"}),e.jsx("code",{className:"text-muted-foreground flex-1 font-mono",children:"/admin/stats"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:s?"Detailed Stats":"Thống kê chi tiết"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-green-500 w-11 flex-shrink-0 font-mono",children:"GET"}),e.jsx("code",{className:"text-muted-foreground flex-1 font-mono",children:"/admin/accounts"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:s?"Account List":"Danh sách tài khoản"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-green-500 w-11 flex-shrink-0 font-mono",children:"GET"}),e.jsx("code",{className:"text-muted-foreground flex-1 font-mono",children:"/admin/logs"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:s?"Request Logs":"Log request"})]})]})]})]}),R.length>0&&e.jsxs(De,{className:"hover-lift",children:[e.jsx(at,{className:"pb-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(rt,{className:"text-base flex items-center gap-2",children:[e.jsx("div",{className:"p-1.5 rounded-lg bg-primary/10",children:e.jsx(Ks,{className:"h-4 w-4 text-primary"})}),s?"Recent Requests":"Request gần đây"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx($e,{variant:"secondary",className:"text-xs",children:R.length}),e.jsxs(D,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>K(!0),children:[e.jsx(xr,{className:"h-3 w-3 mr-1"}),s?"View All":"Xem tất cả"]}),e.jsxs(D,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>te(!0),children:[e.jsx(Ks,{className:"h-3 w-3 mr-1"}),s?"Detailed Logs":"Log chi tiết"]})]})]})}),e.jsx(Pe,{className:"pt-2",children:e.jsx("div",{className:"max-h-[150px] overflow-y-auto text-xs font-mono space-y-0.5",children:R.slice(0,5).map((H,Se)=>e.jsxs("div",{className:"grid gap-2 py-1 px-2 rounded hover:bg-muted/50 items-center",style:{gridTemplateColumns:"2fr 1fr 1.2fr 0.5fr 0.8fr 0.8fr 0.8fr 0.8fr 0.6fr"},children:[e.jsx("span",{className:"text-muted-foreground whitespace-nowrap text-left",children:H.time}),e.jsx("span",{className:"truncate text-left",title:H.path,children:H.path}),e.jsx("span",{className:"truncate text-left text-muted-foreground",title:H.model,children:H.model?H.model.replace("anthropic.","").replace("-v1:0",""):"-"}),e.jsx("span",{className:`text-center ${H.status>=400?"text-destructive":"text-success"}`,children:H.status}),e.jsx("span",{className:"text-muted-foreground text-right",children:H.inputTokens?H.inputTokens.toLocaleString():"-"}),e.jsx("span",{className:"text-muted-foreground text-right",children:H.outputTokens?H.outputTokens.toLocaleString():"-"}),e.jsx("span",{className:"text-success text-right",children:H.cacheReadTokens?H.cacheReadTokens.toLocaleString():"-"}),e.jsx("span",{className:"text-muted-foreground text-right",children:H.credits?H.credits.toFixed(4):"-"}),e.jsx("span",{className:"text-muted-foreground text-right",children:H.responseTime?`${(H.responseTime/1e3).toFixed(1)}s`:"-"})]},Se))})})]}),e.jsxs(De,{className:"hover-lift",children:[e.jsx(at,{className:"pb-2",children:e.jsxs(rt,{className:"text-base flex items-center gap-2",children:[e.jsx("div",{className:"p-1.5 rounded-lg bg-primary/10",children:e.jsx(Ds,{className:"h-4 w-4 text-primary"})}),s?"Supported Features":"Tính năng hỗ trợ"]})}),e.jsx(Pe,{children:e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-primary",children:"✓"}),e.jsx("span",{className:"text-foreground",children:s?"Auto Token Refresh":"Tự làm mới token"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-primary",children:"✓"}),e.jsx("span",{className:"text-foreground",children:s?"Request Retry":"Tự thử lại request"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-primary",children:"✓"}),e.jsx("span",{className:"text-foreground",children:s?"Multi-Account Rotation":"Xoay tua nhiều tài khoản"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-primary",children:"✓"}),e.jsx("span",{className:"text-foreground",children:s?"IDC/Social Auth":"Xác thực IDC/Social"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-primary",children:"✓"}),e.jsx("span",{className:"text-foreground",children:s?"Agentic Mode Detection":"Nhận diện chế độ agentic"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-primary",children:"✓"}),e.jsx("span",{className:"text-foreground",children:s?"Thinking Mode Support":"Hỗ trợ thinking mode"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-primary",children:"✓"}),e.jsx("span",{className:"text-foreground",children:s?"Image Processing":"Xử lý hình ảnh"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-primary",children:"✓"}),e.jsx("span",{className:"text-foreground",children:s?"Usage Statistics":"Thống kê sử dụng"})]})]})})]}),e.jsx(zI,{open:be,onOpenChange:K,logs:R,totalCredits:u?.totalCredits||0,totalTokens:(u?.inputTokens||0)+(u?.outputTokens||0),onClearLogs:()=>{I([]),window.api.proxySaveLogs([])},onResetCredits:async()=>{await window.api.proxyResetCredits(),qe()},onResetTokens:async()=>{await window.api.proxyResetTokens(),qe()},isEn:s}),e.jsx(UI,{open:se,onOpenChange:te}),e.jsx($I,{open:Y,onOpenChange:P,isEn:s,onOpenModelMapping:async()=>{try{const H=await window.api.proxyGetModels();H.success&&H.models&&X(H.models.map(Se=>({id:Se.id,name:Se.name||Se.id})))}catch{}P(!1),C(!0)},mappingCount:o.modelMappings?.length||0}),e.jsx(GI,{open:F,onOpenChange:fe,isEn:s}),e.jsx(BI,{open:pe,onOpenChange:C,isEn:s,mappings:o.modelMappings||[],onMappingsChange:H=>{d(Se=>({...Se,modelMappings:H})),window.api.proxyUpdateConfig({modelMappings:H})},apiKeys:(o.apiKeys||[]).map(H=>({id:H.id,name:H.name})),availableModels:z}),e.jsx(_I,{open:re,onOpenChange:xe,accounts:Ze,selectedAccountId:o.selectedAccountId,onSelect:H=>{d(Se=>({...Se,selectedAccountId:H})),window.api.proxyUpdateConfig({selectedAccountIds:H?[H]:[]})},isEn:s}),Oe&&Tn.createPortal(e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:()=>Ee(!1)}),e.jsxs("div",{className:"relative bg-background rounded-lg shadow-lg w-[800px] max-h-[80vh] overflow-y-auto p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h2",{className:"text-lg font-semibold",children:s?"API Key Management":"Quản lý API Key"}),e.jsx(D,{variant:"ghost",size:"icon",onClick:()=>Ee(!1),children:"✕"})]}),e.jsx(KI,{})]})]}),document.body)]})}function WI(){const{t:n}=Ut(),s=n("common.unknown")==="Unknown";return e.jsxs("div",{className:"flex-1 p-6 space-y-6 overflow-auto",children:[e.jsxs("div",{className:"page-hero p-6",children:[e.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-primary/20 to-transparent rounded-full blur-2xl"}),e.jsx("div",{className:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-primary/20 to-transparent rounded-full blur-2xl"}),e.jsxs("div",{className:"relative flex items-center gap-4",children:[e.jsx("div",{className:"p-3 rounded-xl bg-primary shadow-lg shadow-primary/25",children:e.jsx(Sc,{className:"h-6 w-6 text-primary-foreground"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-primary",children:s?"API Proxy Service":"API 反代服务"}),e.jsx("p",{className:"text-muted-foreground",children:s?"Provide OpenAI and Claude compatible API endpoints with multi-account rotation":"提供 OpenAI 和 Claude 兼容的 API 端点,支持多账号轮询"})]})]})]}),e.jsx(YI,{})]})}let wu=[],Ip=null,ij=!1;function QI(){ij||(ij=!0,window.api.onKproxyRequest(n=>{wu=[{timestamp:n.timestamp,host:n.host,method:n.method,path:n.path,isMitm:n.isMitm,deviceIdReplaced:n.deviceIdReplaced},...wu].slice(0,50),Ip?.(wu)}))}function ZI(){const{t:n}=Ut(),s=n("common.unknown")==="Unknown",[r,i]=g.useState(!1),[o,d]=g.useState(!1),[u,h]=g.useState(!1),[f,p]=g.useState({enabled:!1,port:8899,host:"127.0.0.1",mitmDomains:["amazonaws.com","amazon.com"],autoStart:!1,logRequests:!0}),[y,b]=g.useState(null),[v,N]=g.useState(null),[j,T]=g.useState(null),[S,k]=g.useState(!1),[R,I]=g.useState(!1),[M,G]=g.useState(wu),[W,U]=g.useState(null),q=g.useCallback(async()=>{try{const P=await window.api.kproxyCheckCaCertInstalled();U(P.installed)}catch{U(null)}},[]),V=g.useCallback(async()=>{if(!(o||u)){h(!0),T(null);try{const P=await window.api.kproxyInit();if(P.success){d(!0),P.caInfo&&N(P.caInfo);const F=await window.api.kproxyGetStatus();F.config&&p(F.config),F.stats&&b(F.stats),i(F.running)}else T(P.error||"Failed to initialize K-Proxy")}catch(P){T(P instanceof Error?P.message:"Init failed")}finally{h(!1)}}},[o,u]);g.useEffect(()=>{V(),q()},[V,q]),g.useEffect(()=>{QI(),Ip=G;const P=window.api.onKproxyStatusChange(fe=>{i(fe.running)}),F=window.api.onKproxyError(fe=>{T(fe)});return()=>{P(),F(),Ip=null}},[]);const le=async()=>{T(null);try{if(r){const F=await window.api.kproxyStop();F.success||T(F.error||"Failed to stop")}else{const F=await window.api.kproxyStart(f);F.success||T(F.error||"Failed to start")}const P=await window.api.kproxyGetStatus();i(P.running),P.stats&&b(P.stats)}catch(P){T(P instanceof Error?P.message:"Operation failed")}},B=async P=>{const F={...f,...P};p(F);try{await window.api.kproxyUpdateConfig(P)}catch(fe){console.error("Failed to update config:",fe)}},be=async()=>{try{const P=await window.api.kproxyGenerateDeviceId();P.success&&P.deviceId&&(await B({deviceId:P.deviceId}),await window.api.kproxySetDeviceId(P.deviceId))}catch(P){T(P instanceof Error?P.message:"Failed to generate device ID")}},K=()=>{const P=`${f.host}:${f.port}`;navigator.clipboard.writeText(P),k(!0),setTimeout(()=>k(!1),2e3)},se=()=>{f.deviceId&&(navigator.clipboard.writeText(f.deviceId),I(!0),setTimeout(()=>I(!1),2e3))},te=async()=>{try{const P=await window.api.kproxyExportCaCert();P.success||T(P.error||"Export failed")}catch(P){T(P instanceof Error?P.message:"Export failed")}},Y=P=>new Date(P).toLocaleTimeString();return o?e.jsxs("div",{className:"space-y-4",children:[j&&e.jsxs("div",{className:"bg-destructive/10 text-destructive px-4 py-2 rounded-md flex items-center gap-2",children:[e.jsx(ln,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm",children:j}),e.jsx(D,{variant:"ghost",size:"sm",className:"ml-auto h-6 px-2",onClick:()=>T(null),children:"✕"})]}),e.jsxs(De,{children:[e.jsxs(at,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Vn,{className:"h-5 w-5 text-primary"}),e.jsx(rt,{className:"text-lg",children:"K-Proxy MITM"}),e.jsx($e,{variant:r?"default":"secondary",className:me("ml-2",r&&"bg-green-500 hover:bg-green-600"),children:r?e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsxs("span",{className:"relative flex h-2 w-2",children:[e.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-white opacity-75"}),e.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-white"})]}),s?"Running":"运行中"]}):s?"Stopped":"已停止"})]}),e.jsx(D,{onClick:le,variant:r?"destructive":"default",size:"sm",children:r?e.jsxs(e.Fragment,{children:[e.jsx(Cn,{className:"h-4 w-4 mr-1"}),s?"Stop":"停止"]}):e.jsxs(e.Fragment,{children:[e.jsx(Ba,{className:"h-4 w-4 mr-1"}),s?"Start":"启动"]})})]}),e.jsx(Gl,{children:s?"MITM proxy for replacing Machine ID in Kiro requests":"MITM 代理,用于替换 Kiro 请求中的 Machine ID"})]}),e.jsxs(Pe,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Sc,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:s?"Proxy:":"代理地址:"}),e.jsxs("code",{className:"bg-muted px-2 py-1 rounded text-sm font-mono",children:[f.host,":",f.port]}),e.jsx(D,{variant:"ghost",size:"sm",className:"h-7 px-2",onClick:K,children:S?e.jsx(Pt,{className:"h-3 w-3 text-green-500"}):e.jsx(As,{className:"h-3 w-3"})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Fe,{children:s?"Port":"端口"}),e.jsx(it,{type:"number",value:f.port,onChange:P=>B({port:parseInt(P.target.value)||8899}),disabled:r,className:"h-8"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Fe,{children:s?"Host":"监听地址"}),e.jsx(it,{value:f.host,onChange:P=>B({host:P.target.value}),disabled:r,className:"h-8"})]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xr,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(Fe,{children:s?"Log Requests":"记录请求日志"})]}),e.jsx(is,{checked:f.logRequests,onCheckedChange:P=>B({logRequests:P})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ba,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(Fe,{children:s?"Auto Start":"自动启动"})]}),e.jsx(is,{checked:f.autoStart,onCheckedChange:P=>B({autoStart:P})})]})]})]}),e.jsxs(De,{children:[e.jsxs(at,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(eo,{className:"h-5 w-5 text-primary"}),e.jsx(rt,{className:"text-lg",children:s?"Device ID":"设备 ID"})]}),e.jsx(Gl,{children:s?"Machine ID to replace in requests (64 hex characters)":"替换请求中的 Machine ID(64位十六进制)"})]}),e.jsxs(Pe,{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(it,{value:f.deviceId||"",onChange:P=>{B({deviceId:P.target.value}),P.target.value.length===64&&window.api.kproxySetDeviceId(P.target.value)},placeholder:s?"Enter or generate device ID":"输入或生成设备 ID",className:"font-mono text-xs h-8"}),e.jsxs(D,{variant:"outline",size:"sm",className:"h-8",onClick:be,children:[e.jsx(Dc,{className:"h-3 w-3 mr-1"}),s?"Generate":"生成"]}),f.deviceId&&e.jsx(D,{variant:"ghost",size:"sm",className:"h-8 px-2",onClick:se,children:R?e.jsx(Pt,{className:"h-3 w-3 text-green-500"}):e.jsx(As,{className:"h-3 w-3"})})]}),f.deviceId&&e.jsx("p",{className:"text-xs text-muted-foreground",children:f.deviceId.length===64?s?"✓ Valid device ID format":"✓ 设备 ID 格式正确":s?`⚠ Invalid length: ${f.deviceId.length}/64`:`⚠ 长度不正确: ${f.deviceId.length}/64`})]})]}),e.jsxs(De,{children:[e.jsxs(at,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Vn,{className:"h-5 w-5 text-primary"}),e.jsx(rt,{className:"text-lg",children:s?"CA Certificate":"CA 证书"})]}),e.jsxs("div",{className:"flex gap-2",children:[W===!1?e.jsx(D,{variant:"default",size:"sm",onClick:async()=>{try{const P=await window.api.kproxyInstallCaCert();P.success?(U(!0),alert(P.message||(s?"Certificate installed":"证书已安装"))):alert(P.error||(s?"Failed to install":"安装失败"))}catch(P){alert(P instanceof Error?P.message:String(P))}},children:s?"Install":"安装"}):W===!0?e.jsx(D,{variant:"destructive",size:"sm",onClick:async()=>{try{const P=await window.api.kproxyUninstallCaCert();P.success?(U(!1),alert(P.message||(s?"Certificate uninstalled":"证书已卸载"))):alert(P.error||(s?"Failed to uninstall":"卸载失败"))}catch(P){alert(P instanceof Error?P.message:String(P))}},children:s?"Uninstall":"卸载"}):e.jsx(D,{variant:"outline",size:"sm",disabled:!0,children:s?"Checking...":"检测中..."}),e.jsxs(D,{variant:"outline",size:"sm",onClick:te,children:[e.jsx(Ns,{className:"h-3 w-3 mr-1"}),s?"Export":"导出"]})]})]}),e.jsx(Gl,{children:s?"Install this certificate to trust K-Proxy MITM":"安装此证书以信任 K-Proxy MITM 代理"})]}),v&&e.jsxs(Pe,{className:"space-y-2 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-muted-foreground",children:s?"Fingerprint:":"指纹:"}),e.jsx("code",{className:"bg-muted px-2 py-0.5 rounded text-xs font-mono truncate max-w-[300px]",children:v.fingerprint})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-muted-foreground",children:s?"Valid:":"有效期:"}),e.jsxs("span",{className:"text-xs",children:[new Date(v.validFrom).toLocaleDateString()," - ",new Date(v.validTo).toLocaleDateString()]})]})]})]}),y&&e.jsxs(De,{children:[e.jsx(at,{className:"pb-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ks,{className:"h-5 w-5 text-primary"}),e.jsx(rt,{className:"text-lg",children:s?"Statistics":"统计"})]})}),e.jsx(Pe,{children:e.jsxs("div",{className:"grid grid-cols-4 gap-4 text-center",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-bold",children:y.totalRequests}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s?"Total":"总请求"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-bold text-blue-500",children:y.mitmRequests}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"MITM"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-bold text-green-500",children:y.modifiedRequests}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s?"Modified":"已修改"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-bold text-gray-500",children:y.bypassRequests}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s?"Bypass":"透传"})]})]})})]}),M.length>0&&e.jsxs(De,{children:[e.jsx(at,{className:"pb-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ri,{className:"h-5 w-5 text-primary"}),e.jsx(rt,{className:"text-lg",children:s?"Recent Requests":"最近请求"})]})}),e.jsx(Pe,{children:e.jsx("div",{className:"space-y-1 max-h-48 overflow-y-auto",children:M.slice(0,10).map((P,F)=>e.jsxs("div",{className:"flex items-center gap-2 text-xs py-1 border-b last:border-0",children:[e.jsx("span",{className:"text-muted-foreground w-16",children:Y(P.timestamp)}),e.jsx($e,{variant:P.isMitm?"default":"secondary",className:"text-[10px] px-1 py-0",children:P.isMitm?"MITM":"PASS"}),P.deviceIdReplaced&&e.jsx($e,{variant:"outline",className:"text-[10px] px-1 py-0 text-green-600 border-green-600",children:"ID"}),e.jsx("span",{className:"font-mono truncate flex-1",children:P.host})]},F))})})]}),e.jsxs(De,{children:[e.jsx(at,{className:"pb-3",children:e.jsx(rt,{className:"text-lg",children:s?"Usage Guide":"使用说明"})}),e.jsxs(Pe,{className:"text-sm text-muted-foreground space-y-2",children:[e.jsxs("p",{children:["1. ",s?"Export and install the CA certificate to your system trust store":"导出并安装 CA 证书到系统信任存储"]}),e.jsxs("p",{children:["2. ",s?"Set your system/application proxy to":"设置系统/应用代理为"," ",e.jsxs("code",{className:"bg-muted px-1 rounded",children:[f.host,":",f.port]})]}),e.jsxs("p",{children:["3. ",s?"Generate or enter a device ID to use for requests":"生成或输入用于请求的设备 ID"]}),e.jsxs("p",{children:["4. ",s?"Start the proxy and use Kiro IDE normally":"启动代理后正常使用 Kiro IDE"]})]})]})]}):u||!j?e.jsxs("div",{className:"flex flex-col items-center justify-center h-64 gap-4",children:[e.jsx(bt,{className:"h-8 w-8 animate-spin text-primary"}),e.jsx("p",{className:"text-muted-foreground",children:s?"Initializing K-Proxy...":"正在初始化 K-Proxy..."})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center h-64 gap-4",children:[e.jsx(ln,{className:"h-8 w-8 text-destructive"}),e.jsx("p",{className:"text-destructive",children:j}),e.jsxs(D,{onClick:V,children:[e.jsx(Mt,{className:"h-4 w-4 mr-2"}),s?"Retry":"重试"]})]})}function JI(){const{t:n}=Ut(),s=n("common.unknown")==="Unknown";return e.jsxs("div",{className:"flex-1 p-6 space-y-6 overflow-auto",children:[e.jsxs("div",{className:"page-hero p-6",children:[e.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-purple-500/20 to-transparent rounded-full blur-2xl"}),e.jsx("div",{className:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-purple-500/20 to-transparent rounded-full blur-2xl"}),e.jsxs("div",{className:"relative flex items-center gap-4",children:[e.jsx("div",{className:"p-3 rounded-xl bg-purple-500 shadow-lg shadow-purple-500/25",children:e.jsx(Vn,{className:"h-6 w-6 text-white"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-purple-600 dark:text-purple-400",children:"K-Proxy MITM"}),e.jsx("p",{className:"text-muted-foreground",children:s?"MITM proxy for Machine ID replacement, reduces ban risk":"MITM 代理,替换 Machine ID,降低封禁风险"})]})]})]}),e.jsx(ZI,{})]})}const eR=[{value:"round_robin",label:"轮询",labelEn:"Round Robin",desc:"依次使用每个代理",descEn:"Use each proxy in sequence"},{value:"random",label:"随机",labelEn:"Random",desc:"随机挑选",descEn:"Pick randomly"},{value:"least_used",label:"最少使用",labelEn:"Least Used",desc:"使用次数少的优先",descEn:"Prefer proxies used less"},{value:"fastest",label:"最快优先",labelEn:"Fastest",desc:"按延迟升序",descEn:"Sort by latency asc"}];function tR({diag:n,isEn:s}){if(!n.success||!n.diagnose)return e.jsxs("div",{className:"mt-2 text-[11px] rounded-md bg-red-500/10 border border-red-500/30 text-red-700 dark:text-red-400 px-2 py-1.5",children:[s?"Diagnose failed: ":"诊断失败:",n.error||"unknown error"]});const r=n.diagnose,i=({ok:o,label:d,rt:u,err:h})=>e.jsxs("div",{className:"flex items-start gap-2 text-[11px]",children:[e.jsx("span",{className:me("mt-0.5 inline-flex items-center justify-center w-4 h-4 rounded-full text-[10px] font-bold",o?"bg-green-500/20 text-green-600 dark:text-green-400":"bg-red-500/20 text-red-600 dark:text-red-400"),children:o?"✓":"✗"}),e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"text-foreground",children:d}),u!==void 0&&e.jsxs("span",{className:"ml-1 text-muted-foreground font-mono",children:[u,"ms"]}),h&&e.jsx("div",{className:"mt-0.5 text-red-600 dark:text-red-400 break-all",children:h})]})]});return e.jsxs("div",{className:"mt-2 space-y-1.5 rounded-md border border-border bg-card/50 px-3 py-2",children:[e.jsxs("div",{className:"text-[10px] text-muted-foreground font-mono truncate",children:["target: ",n.targetUrl.replace(/:([^:@/]+)@/,":***@")]}),e.jsx(i,{ok:r.upstreamReachable,label:s?"A) Upstream TCP reachable":"A) 上游中转 TCP 可达",rt:r.upstreamRtMs,err:r.upstreamError}),e.jsx(i,{ok:r.targetReachable,label:s?"B) Via upstream → target proxy entry":"B) 经上游 → 目标代理入口",rt:r.targetRtMs,err:r.targetError}),e.jsx(i,{ok:r.endToEndOk===!0,label:s?`C) End-to-end CONNECT (status ${r.targetStatus??"?"} ${r.targetStatusText??""})`.trim():`C) 端到端 CONNECT(状态 ${r.targetStatus??"?"} ${r.targetStatusText??""})`.trim(),rt:r.endToEndRtMs,err:r.endToEndError}),r.targetBodySnippet&&e.jsxs("div",{className:"mt-1 text-[10px] text-muted-foreground font-mono break-all",children:["body: ",r.targetBodySnippet.slice(0,160)]})]})}function sR(n){const s={total:n.length,enabled:0,alive:0,slow:0,dead:0,untested:0,testing:0,totalUsed:0,totalFailed:0,totalSuccess:0,successRate:null,avgLatencyMs:null,topUsed:[]};let r=0,i=0;for(const o of n)o.enabled&&s.enabled++,o.status==="alive"?s.alive++:o.status==="slow"?s.slow++:o.status==="dead"?s.dead++:o.status==="untested"?s.untested++:o.status==="testing"&&s.testing++,s.totalUsed+=o.usedCount,s.totalFailed+=o.failCount,o.latencyMs&&(o.status==="alive"||o.status==="slow")&&(r+=o.latencyMs,i++);return s.totalSuccess=Math.max(0,s.totalUsed-s.totalFailed),s.successRate=s.totalUsed>0?s.totalSuccess/s.totalUsed:null,s.avgLatencyMs=i>0?Math.round(r/i):null,s.topUsed=n.slice().filter(o=>o.usedCount>0).sort((o,d)=>d.usedCount-o.usedCount).slice(0,5).map(o=>{const d=Math.max(0,o.usedCount-o.failCount);return{id:o.id,label:o.label||`${o.protocol}://${o.host}:${o.port}`,used:o.usedCount,failed:o.failCount,success:d,rate:o.usedCount>0?d/o.usedCount:null,status:o.status}}),s}function Ul({label:n,value:s,sub:r,tone:i}){const o=i==="green"?"text-green-600 dark:text-green-400":i==="amber"?"text-amber-600 dark:text-amber-400":i==="red"?"text-red-600 dark:text-red-400":i==="blue"?"text-blue-600 dark:text-blue-400":"text-foreground";return e.jsxs("div",{className:"rounded-lg border border-border bg-card/50 px-3 py-2",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:n}),e.jsx("div",{className:me("mt-0.5 text-lg font-semibold tabular-nums",o),children:s}),r!==void 0&&e.jsx("div",{className:"text-[11px] text-muted-foreground",children:r})]})}function nR({stats:n,isEn:s}){if(n.total===0)return null;const r=n.total>0?(n.alive+n.slow)/n.total:0,i=n.successRate!==null?Math.round(n.successRate*100):null,o=i===null?"default":i>=80?"green":i>=50?"amber":"red",d=n.total===0?"default":r>=.7?"green":r>=.3?"amber":"red";return e.jsxs(De,{className:"hover-lift",children:[e.jsx(at,{className:"pb-3",children:e.jsxs(rt,{className:"text-base flex items-center gap-2",children:[e.jsx(Ks,{className:"h-4 w-4 text-primary"}),s?"Pool Health Dashboard":"代理池健康看板"]})}),e.jsxs(Pe,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-2",children:[e.jsx(Ul,{label:s?"Total / Enabled":"总数 / 已启用",value:e.jsxs(e.Fragment,{children:[n.total,e.jsxs("span",{className:"text-muted-foreground text-base",children:[" / ",n.enabled]})]})}),e.jsx(Ul,{label:s?"Availability":"可用率",value:`${Math.round(r*100)}%`,sub:`${n.alive+n.slow} ${s?"alive":"可用"}`,tone:d}),e.jsx(Ul,{label:s?"Success Rate":"成功率",value:i!==null?`${i}%`:"—",sub:`${n.totalSuccess} / ${n.totalUsed}`,tone:o}),e.jsx(Ul,{label:s?"Avg Latency":"平均延迟",value:n.avgLatencyMs!==null?`${n.avgLatencyMs}ms`:"—",tone:"blue"}),e.jsx(Ul,{label:s?"Dead":"失效",value:n.dead,tone:n.dead>0?"red":"default"}),e.jsx(Ul,{label:s?"Untested":"未测试",value:n.untested+n.testing,tone:n.untested>0?"amber":"default"})]}),n.topUsed.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-xs text-muted-foreground",children:s?`Top ${n.topUsed.length} most used proxies`:`承担量 Top ${n.topUsed.length}`}),e.jsx("div",{className:"space-y-1.5",children:n.topUsed.map(u=>{const h=u.rate!==null?Math.round(u.rate*100):null,f=u.rate!==null?u.rate*100:0,p=h===null?"bg-muted-foreground/30":h>=80?"bg-green-500":h>=50?"bg-amber-500":"bg-red-500";return e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[e.jsx(iw,{status:u.status}),e.jsx("span",{className:"font-mono text-[11px] truncate",children:u.label})]}),e.jsxs("div",{className:"shrink-0 text-[11px] tabular-nums text-muted-foreground",children:[u.success,"/",u.used,h!==null&&e.jsxs("span",{className:"ml-1.5 font-medium text-foreground",children:[h,"%"]})]})]}),e.jsx("div",{className:"h-1.5 rounded-full bg-muted overflow-hidden",children:e.jsx("div",{className:me("h-full transition-all",p),style:{width:`${f}%`}})})]},u.id)})})]})]})]})}function iw({status:n,latency:s}){const r={untested:{color:"bg-muted text-muted-foreground",label:"未测试",labelEn:"Untested"},testing:{color:"bg-blue-500/15 text-blue-600 dark:text-blue-400",label:"测试中",labelEn:"Testing"},alive:{color:"bg-green-500/15 text-green-600 dark:text-green-400",label:"可用",labelEn:"Alive"},slow:{color:"bg-amber-500/15 text-amber-600 dark:text-amber-400",label:"较慢",labelEn:"Slow"},dead:{color:"bg-red-500/15 text-red-600 dark:text-red-400",label:"失效",labelEn:"Dead"}}[n];return e.jsxs("span",{className:me("inline-flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-medium",r.color),children:[n==="testing"&&e.jsx(bt,{className:"h-3 w-3 animate-spin"}),n==="alive"&&e.jsx(an,{className:"h-3 w-3"}),n==="slow"&&e.jsx(Ks,{className:"h-3 w-3"}),n==="dead"&&e.jsx(fs,{className:"h-3 w-3"}),e.jsx("span",{children:r.label}),s!==void 0&&(n==="alive"||n==="slow")&&e.jsxs("span",{className:"font-mono opacity-70",children:[s,"ms"]})]})}function aR(){const{t:n}=Ut(),s=n("common.unknown")==="Unknown",{proxyPool:r,proxyPoolConfig:i,addProxy:o,importProxies:d,removeProxy:u,removeProxies:h,toggleProxyEnabled:f,updateProxy:p,validateProxy:y,validateProxiesBatch:b,clearProxyPool:v,setProxyPoolConfig:N,accounts:j,accountProxyBindings:T,unbindAccountFromProxy:S,clearAccountProxyBindings:k,autoDistributeAccountsToProxies:R}=vt(),[I,M]=g.useState(""),[G,W]=g.useState(""),[U,q]=g.useState(!1),[V,le]=g.useState(new Set),[B,be]=g.useState(""),[K,se]=g.useState("all"),[te,Y]=g.useState("all"),[P,F]=g.useState("all"),[fe,pe]=g.useState("all"),[C,z]=g.useState("all"),[X,re]=g.useState(!1),[xe,Oe]=g.useState(!1),[Ee,Qe]=g.useState(10),[_e,st]=g.useState(5),[oe,ue]=g.useState(!1),[ae,L]=g.useState(!1),[we,Ue]=g.useState(null),Lt=g.useCallback(async()=>{const O=i.upstreamProxy?.trim();if(!O)return;const ne=Array.from(r.values()),ze=ne.find(_=>_.enabled)||ne[0];if(ze){L(!0),Ue(null);try{const _=await window.api.proxyPoolDiagnoseChain({targetUrl:ze.url,upstreamProxy:O});Ue({targetUrl:ze.url,..._})}catch(_){Ue({targetUrl:ze.url,success:!1,error:_ instanceof Error?_.message:String(_)})}finally{L(!1)}}},[r,i.upstreamProxy]),xt=g.useMemo(()=>Array.from(r.values()),[r]),Qt=g.useMemo(()=>sR(xt),[xt]),ft=g.useMemo(()=>{const ne=Array.from(j.values()).filter(Ve=>Ve.status==="active").length,ze=Object.keys(T).filter(Ve=>j.has(Ve)).length,_=xt.filter(Ve=>Ve.enabled&&Ve.status!=="dead"),ce={};for(const[Ve,je]of Object.entries(T))j.has(Ve)&&(ce[je]=(ce[je]||0)+1);const Ce=Object.entries(ce).filter(([,Ve])=>Ve>10).map(([Ve,je])=>({pid:Ve,count:je,proxy:r.get(Ve)}));return{totalActive:ne,boundCount:ze,unboundCount:ne-ze,aliveProxyCount:_.length,perProxy:ce,overloadedProxies:Ce}},[j,T,xt,r]),Et=g.useRef(0);g.useEffect(()=>{const O=i.autoValidateIntervalMin;if(!O||O<=0)return;const ze=setInterval(()=>{const _=Date.now();if(_-Et.current<O*6e4)return;const ce=Array.from(r.values()).filter(Ce=>Ce.enabled).map(Ce=>Ce.id);ce.length!==0&&(Et.current=_,console.log(`[ProxyPool] Auto-validate ${ce.length} proxies`),b(ce,i.autoValidateConcurrency||5))},6e4);return()=>clearInterval(ze)},[i.autoValidateIntervalMin,i.autoValidateConcurrency,r,b]);const Ge=g.useCallback(O=>{if(ft.aliveProxyCount===0){alert(s?"No alive proxies. Validate proxies first.":"没有可用代理,请先验活代理");return}const ne=Array.from(j.values()).filter(_=>_.status==="active").map(_=>_.id);if(ne.length===0){alert(s?"No active accounts.":"没有可用账号");return}const ze=R({accountsPerProxy:_e,onlyUnbound:O,accountIds:ne});alert(s?`Distributed ${ze.distributed} accounts, skipped ${ze.skipped}`:`已分配 ${ze.distributed} 个账号,跳过 ${ze.skipped}`)},[j,_e,R,ft.aliveProxyCount,s]),gt=g.useMemo(()=>{let O=0,ne=0,ze=0,_=0,ce=0;for(const Ce of xt)Ce.enabled&&ce++,Ce.status==="alive"?O++:Ce.status==="dead"?ne++:Ce.status==="slow"?ze++:Ce.status==="untested"&&_++;return{total:xt.length,alive:O,dead:ne,slow:ze,untested:_,enabled:ce}},[xt]),Ze=g.useMemo(()=>{const O=Date.now(),ne=3600*1e3,ze=24*ne;return xt.filter(_=>{if(K!=="all"&&_.status!==K||te!=="all"&&_.protocol!==te||P==="enabled"&&!_.enabled||P==="disabled"&&_.enabled)return!1;if(fe!=="all"){const ce=_.latencyMs;if(fe==="unknown"){if(typeof ce=="number")return!1}else{if(typeof ce!="number")return!1;if(fe==="fast"&&ce>=200||fe==="medium"&&(ce<200||ce>=1e3)||fe==="slow"&&ce<1e3)return!1}}if(C!=="all")if(C==="never"){if(_.lastTestedAt)return!1}else if(_.lastTestedAt){const ce=O-_.lastTestedAt;if(C==="1h"&&ce>ne||C==="1d"&&ce>ze||C==="7d"&&ce>7*ze)return!1}else return!1;if(B){const ce=B.toLowerCase().trim();if(![_.host,String(_.port),_.protocol,_.username||"",_.label||"",_.lastBoundEmail||"",_.url||"",(_.tags||[]).join(" "),_.source||""].join(" ").toLowerCase().includes(ce))return!1}return!0})},[xt,B,K,te,P,fe,C]),J=g.useMemo(()=>{let O=0;return te!=="all"&&O++,P!=="all"&&O++,fe!=="all"&&O++,C!=="all"&&O++,O},[te,P,fe,C]),Ne=g.useCallback(()=>{Y("all"),F("all"),pe("all"),z("all")},[]),et=g.useCallback(()=>{if(!I.trim())return;o(I.trim())?M(""):alert(s?"Invalid proxy URL or duplicate":"代理 URL 无效或重复")},[I,o,s]),qe=g.useCallback(()=>{if(!G.trim())return;const O=d(G);alert(s?`Imported: added ${O.added}, skipped ${O.skipped}, failed ${O.failed}`:`导入完成:新增 ${O.added},跳过 ${O.skipped},失败 ${O.failed}`),W(""),q(!1)},[G,d,s]),Je=g.useCallback(async()=>{const O=Ze.map(ne=>ne.id);if(O.length!==0){Oe(!0);try{await b(O,Ee)}finally{Oe(!1)}}},[Ze,b,Ee]),Kt=g.useCallback(async()=>{const O=Array.from(V);if(O.length!==0){Oe(!0);try{await b(O,Ee)}finally{Oe(!1)}}},[V,b,Ee]),Ye=g.useCallback(()=>{V.size!==0&&confirm(s?`Delete ${V.size} proxies?`:`确定删除 ${V.size} 个代理?`)&&(h(Array.from(V)),le(new Set))},[V,h,s]),qt=g.useCallback(()=>{const O=xt.filter(ne=>ne.status==="dead").map(ne=>ne.id);O.length!==0&&confirm(s?`Remove ${O.length} dead proxies?`:`确定移除 ${O.length} 个失效代理?`)&&h(O)},[xt,h,s]),Jt=O=>{le(ne=>{const ze=new Set(ne);return ze.has(O)?ze.delete(O):ze.add(O),ze})},Ct=()=>{V.size===Ze.length&&Ze.length>0?le(new Set):le(new Set(Ze.map(O=>O.id)))};return e.jsxs("div",{className:"flex-1 p-6 space-y-6 overflow-auto",children:[e.jsxs("div",{className:"page-hero p-6",children:[e.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-cyan-500/20 to-transparent rounded-full blur-2xl"}),e.jsx("div",{className:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-cyan-500/20 to-transparent rounded-full blur-2xl"}),e.jsxs("div",{className:"relative flex items-center gap-4",children:[e.jsx("div",{className:"p-3 rounded-xl bg-cyan-500 shadow-lg shadow-cyan-500/25",children:e.jsx(Ki,{className:"h-6 w-6 text-white"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-cyan-600 dark:text-cyan-400",children:s?"Proxy Pool":"代理池"}),e.jsx("p",{className:"text-muted-foreground",children:s?"Proxy routing for registration tasks. Use only for legitimate network configuration; it does not bypass provider risk controls.":"注册任务的代理路由配置。仅用于合规网络配置,不能绕过服务商风控。"})]})]})]}),e.jsx(nR,{stats:Qt,isEn:s}),e.jsxs(De,{className:"hover-lift",children:[e.jsx(at,{className:"pb-3",children:e.jsxs(rt,{className:"text-base flex items-center gap-2",children:[e.jsx(Ka,{className:"h-4 w-4 text-primary"}),s?"Pool Configuration":"池配置"]})}),e.jsxs(Pe,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(is,{checked:i.enabled,onCheckedChange:O=>N({enabled:O})}),e.jsxs("div",{children:[e.jsx(Fe,{className:"cursor-pointer text-sm",children:s?"Enable proxy pool for registration":"为注册流程启用代理池"}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:s?"When enabled, each registration task picks an available proxy by the strategy below.":"开启后,每个注册任务会按下方策略自动选取一个可用代理"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Fe,{className:"text-xs",children:s?"Selection Strategy":"调度策略"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:eR.map(O=>e.jsx("button",{type:"button",onClick:()=>N({strategy:O.value}),className:me("px-3 py-1.5 rounded-md border text-xs transition-colors",i.strategy===O.value?"border-primary bg-primary/10 text-primary font-medium":"border-border hover:border-primary/50"),title:s?O.descEn:O.desc,children:s?O.labelEn:O.label},O.value))})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3 pt-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(is,{checked:i.autoDisableDead,onCheckedChange:O=>N({autoDisableDead:O})}),e.jsx(Fe,{className:"text-xs cursor-pointer",children:s?"Auto-disable on failure":"失败自动停用"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(Fe,{className:"text-xs",children:s?"Failure threshold":"失败阈值"}),e.jsx(it,{type:"number",min:1,max:20,value:i.failureThreshold,onChange:O=>{const ne=parseInt(O.target.value,10);!isNaN(ne)&&ne>=1&&N({failureThreshold:ne})},className:"h-8 text-xs"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(Fe,{className:"text-xs",children:s?"IP Detection Endpoint":"IP 检测端点"}),e.jsxs("div",{className:"flex gap-1.5",children:[e.jsxs("select",{value:kf.find(O=>O.url===i.testUrl)?.id||"_custom",onChange:O=>{const ne=kf.find(ze=>ze.id===O.target.value);ne&&N({testUrl:ne.url})},className:"h-8 text-xs rounded-lg border border-foreground/15 bg-[var(--glass-bg)] backdrop-blur-md px-2 flex-shrink-0",children:[kf.map(O=>e.jsx("option",{value:O.id,children:O.label},O.id)),e.jsx("option",{value:"_custom",children:s?"Custom...":"自定义..."})]}),e.jsx(it,{value:i.testUrl,onChange:O=>N({testUrl:O.target.value}),placeholder:"https://api.ipify.org?format=json",className:"h-8 text-xs font-mono flex-1"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(Fe,{className:"text-xs flex items-center gap-1",children:[e.jsx(Gn,{className:"h-3 w-3"}),s?"Auto-validate interval (min, 0=off)":"定时自动验活(分钟,0=关闭)"]}),e.jsx(it,{type:"number",min:0,max:1440,value:i.autoValidateIntervalMin,onChange:O=>{const ne=parseInt(O.target.value,10);!isNaN(ne)&&ne>=0&&N({autoValidateIntervalMin:ne})},className:"h-8 text-xs"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(Fe,{className:"text-xs",children:s?"Auto-validate concurrency":"验活并发"}),e.jsx(it,{type:"number",min:1,max:50,value:i.autoValidateConcurrency,onChange:O=>{const ne=parseInt(O.target.value,10);!isNaN(ne)&&ne>=1&&N({autoValidateConcurrency:ne})},disabled:i.autoValidateIntervalMin===0,className:"h-8 text-xs"})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(Fe,{className:"text-xs",children:s?"Upstream relay proxy (proxy chaining)":"上游中转代理(代理链)"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(it,{value:i.upstreamProxy||"",onChange:O=>N({upstreamProxy:O.target.value}),placeholder:s?"e.g. socks5://127.0.0.1:7890 (empty = off)":"如 socks5://127.0.0.1:7890(留空=不启用)",className:"h-8 text-xs font-mono flex-1"}),e.jsxs(D,{size:"sm",variant:"outline",className:"h-8 px-3 text-xs whitespace-nowrap",disabled:!i.upstreamProxy?.trim()||r.size===0||ae,onClick:()=>void Lt(),title:s?"Diagnose proxy chain (locates failure layer)":"诊断代理链(定位失败在哪一层)",children:[ae?e.jsx(bt,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(vx,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"ml-1",children:s?"Diagnose":"诊断"})]})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground leading-relaxed",children:s?"When set, traffic chains: local → relay → target proxy → site. Use only to satisfy your proxy provider routing or allowlist requirements. Supports http/socks5.":"填写后链路为:本机 → 上游中转 → 目标代理 → 目标站点。仅用于满足代理服务商的路由或白名单要求。支持 http/socks5。"}),we&&e.jsx(tR,{diag:we,isEn:s})]})]})]}),e.jsxs(De,{className:"hover-lift",children:[e.jsx(at,{className:"pb-3",children:e.jsxs(rt,{className:"text-base flex items-center gap-2",children:[e.jsx(Ts,{className:"h-4 w-4 text-primary"}),s?"Add Proxies":"添加代理"]})}),e.jsxs(Pe,{className:"space-y-3",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(it,{value:I,onChange:O=>M(O.target.value),onKeyDown:O=>O.key==="Enter"&&et(),placeholder:s?"http://user:pass@host:port or host:port or socks5://...":"http://user:pass@host:port 或 host:port 或 socks5://...",className:"font-mono text-xs"}),e.jsxs(D,{onClick:et,disabled:!I.trim(),children:[e.jsx(Ts,{className:"h-4 w-4 mr-1"}),s?"Add":"添加"]}),e.jsxs(D,{variant:"outline",onClick:()=>q(!U),children:[e.jsx(Fa,{className:"h-4 w-4 mr-1"}),s?"Bulk":"批量"]})]}),U&&e.jsxs("div",{className:"space-y-2 p-3 bg-muted/30 rounded-lg border border-dashed",children:[e.jsx(Fe,{className:"text-xs",children:s?"One proxy per line. Supports: http(s)://host:port, user:pass@host:port, host:port:user:pass, socks5://...":"每行一个代理。支持格式: http(s)://host:port、user:pass@host:port、host:port:user:pass、socks5://..."}),e.jsx("textarea",{value:G,onChange:O=>W(O.target.value),rows:5,className:"w-full px-3 py-2 bg-background border rounded-lg text-xs font-mono resize-none",placeholder:`http://127.0.0.1:7890
|
|
126
|
+
user:pass@1.2.3.4:8080
|
|
127
|
+
socks5://example.com:1080`}),e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx(D,{variant:"ghost",size:"sm",onClick:()=>{W(""),q(!1)},children:s?"Cancel":"取消"}),e.jsxs(D,{size:"sm",onClick:qe,disabled:!G.trim(),children:[e.jsx(xr,{className:"h-4 w-4 mr-1"}),s?"Import":"导入"]})]})]})]})]}),e.jsx(De,{children:e.jsxs(Pe,{className:"py-3 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-4 text-sm flex-wrap",children:[e.jsxs("span",{className:"text-muted-foreground",children:[s?"Total:":"总计:"," ",e.jsx("strong",{className:"text-foreground",children:gt.total})]}),e.jsxs($e,{variant:"outline",className:"text-green-600 border-green-200 bg-green-50 dark:bg-green-950/30",children:[s?"Alive":"可用",": ",gt.alive]}),e.jsxs($e,{variant:"outline",className:"text-amber-600 border-amber-200 bg-amber-50 dark:bg-amber-950/30",children:[s?"Slow":"较慢",": ",gt.slow]}),e.jsxs($e,{variant:"outline",className:"text-red-600 border-red-200 bg-red-50 dark:bg-red-950/30",children:[s?"Dead":"失效",": ",gt.dead]}),e.jsxs($e,{variant:"outline",className:"text-muted-foreground",children:[s?"Untested":"未测试",": ",gt.untested]}),e.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:s?`${gt.enabled} enabled`:`${gt.enabled} 已启用`})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(it,{value:B,onChange:O=>be(O.target.value),placeholder:s?"Search any field (host/port/protocol/user/email/label/url)...":"搜索任意字段(host/端口/协议/user/邮箱/备注/URL)...",className:"h-8 max-w-md text-xs"}),e.jsxs("select",{value:K,onChange:O=>se(O.target.value),className:"h-8 px-2 rounded-md border bg-background text-xs",children:[e.jsx("option",{value:"all",children:s?"All Status":"全部状态"}),e.jsx("option",{value:"alive",children:s?"Alive":"可用"}),e.jsx("option",{value:"slow",children:s?"Slow":"较慢"}),e.jsx("option",{value:"dead",children:s?"Dead":"失效"}),e.jsx("option",{value:"untested",children:s?"Untested":"未测试"})]}),e.jsxs(D,{size:"sm",variant:X||J>0?"default":"outline",className:"h-8",onClick:()=>re(!X),children:[s?"Advanced":"高级",J>0&&e.jsx("span",{className:"ml-1.5 px-1.5 py-0.5 rounded-full bg-background/30 text-[10px]",children:J})]}),(B||K!=="all"||J>0)&&e.jsx(D,{size:"sm",variant:"ghost",className:"h-8 text-xs",onClick:()=>{be(""),se("all"),Ne()},children:s?"Clear":"清空"}),e.jsx("div",{className:"w-px h-6 bg-border"}),e.jsxs(D,{size:"sm",variant:"outline",onClick:Je,disabled:xe||Ze.length===0,children:[xe?e.jsx(bt,{className:"h-4 w-4 mr-1 animate-spin"}):e.jsx(Mt,{className:"h-4 w-4 mr-1"}),s?`Test All (${Ze.length})`:`全部测试 (${Ze.length})`]}),V.size>0&&e.jsxs(e.Fragment,{children:[e.jsxs(D,{size:"sm",variant:"outline",onClick:Kt,children:[e.jsx(Mt,{className:"h-4 w-4 mr-1"}),s?`Test Selected (${V.size})`:`测试选中 (${V.size})`]}),e.jsxs(D,{size:"sm",variant:"outline",className:"text-destructive",onClick:Ye,children:[e.jsx(Vt,{className:"h-4 w-4 mr-1"}),s?`Delete (${V.size})`:`删除 (${V.size})`]})]}),e.jsxs(D,{size:"sm",variant:"ghost",onClick:qt,disabled:gt.dead===0,children:[e.jsx(fs,{className:"h-4 w-4 mr-1"}),s?"Remove Dead":"移除失效"]}),e.jsxs(D,{size:"sm",variant:"ghost",className:"text-destructive ml-auto",onClick:()=>{xt.length!==0&&confirm(s?"Clear all proxies?":"确定清空所有代理?")&&v()},disabled:xt.length===0,children:[e.jsx(Vt,{className:"h-4 w-4 mr-1"}),s?"Clear All":"清空"]}),e.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[e.jsx("span",{className:"text-muted-foreground",children:s?"Concurrency:":"并发:"}),e.jsx(it,{type:"number",min:1,max:50,value:Ee,onChange:O=>{const ne=parseInt(O.target.value,10);!isNaN(ne)&&ne>=1&&Qe(ne)},className:"h-7 w-14 text-xs text-center"})]})]}),X&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2 p-3 rounded-md border bg-muted/30 mt-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:s?"Protocol:":"协议:"}),e.jsxs("select",{value:te,onChange:O=>Y(O.target.value),className:"h-7 px-2 rounded-md border bg-background text-xs",children:[e.jsx("option",{value:"all",children:s?"All":"全部"}),e.jsx("option",{value:"http",children:"HTTP"}),e.jsx("option",{value:"https",children:"HTTPS"}),e.jsx("option",{value:"socks5",children:"SOCKS5"}),e.jsx("option",{value:"socks4",children:"SOCKS4"})]})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:s?"Enabled:":"启用:"}),e.jsxs("select",{value:P,onChange:O=>F(O.target.value),className:"h-7 px-2 rounded-md border bg-background text-xs",children:[e.jsx("option",{value:"all",children:s?"All":"全部"}),e.jsx("option",{value:"enabled",children:s?"Enabled":"已启用"}),e.jsx("option",{value:"disabled",children:s?"Disabled":"已停用"})]})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:s?"Latency:":"延迟:"}),e.jsxs("select",{value:fe,onChange:O=>pe(O.target.value),className:"h-7 px-2 rounded-md border bg-background text-xs",children:[e.jsx("option",{value:"all",children:s?"All":"全部"}),e.jsx("option",{value:"fast",children:s?"< 200ms (Fast)":"< 200ms(快)"}),e.jsx("option",{value:"medium",children:"200-1000ms"}),e.jsx("option",{value:"slow",children:s?"> 1000ms (Slow)":"> 1000ms(慢)"}),e.jsx("option",{value:"unknown",children:s?"Unknown":"未知"})]})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:s?"Tested:":"验证于:"}),e.jsxs("select",{value:C,onChange:O=>z(O.target.value),className:"h-7 px-2 rounded-md border bg-background text-xs",children:[e.jsx("option",{value:"all",children:s?"Any time":"任意时间"}),e.jsx("option",{value:"1h",children:s?"Last 1h":"最近 1 小时"}),e.jsx("option",{value:"1d",children:s?"Last 1 day":"最近 1 天"}),e.jsx("option",{value:"7d",children:s?"Last 7 days":"最近 7 天"}),e.jsx("option",{value:"never",children:s?"Never tested":"从未测试"})]})]}),J>0&&e.jsx(D,{size:"sm",variant:"ghost",className:"h-7 ml-auto text-xs",onClick:Ne,children:s?"Reset":"重置"}),e.jsx("div",{className:"w-full text-[10px] text-muted-foreground mt-1",children:s?`Matched ${Ze.length} of ${xt.length}`:`匹配 ${Ze.length} / ${xt.length}`})]})]})}),e.jsxs(De,{className:"hover-lift",children:[e.jsx(at,{className:"pb-3",children:e.jsxs(rt,{className:"text-base flex items-center gap-2",children:[e.jsx(ql,{className:"h-4 w-4 text-primary"}),s?"Reverse Proxy: Account Routing":"反代路由(账号绑定代理)",e.jsx("span",{className:"text-[10px] font-normal text-muted-foreground",children:s?"— Keep routing explicit and auditable":"— 保持路由配置明确且可审计"})]})}),e.jsxs(Pe,{className:"space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2 text-xs",children:[e.jsxs("div",{className:"p-2 bg-muted/30 rounded",children:[e.jsx("div",{className:"text-[10px] text-muted-foreground",children:s?"Active Accounts":"可用账号"}),e.jsx("div",{className:"text-lg font-bold",children:ft.totalActive})]}),e.jsxs("div",{className:"p-2 bg-green-50 dark:bg-green-950/20 rounded",children:[e.jsx("div",{className:"text-[10px] text-muted-foreground",children:s?"Bound":"已绑定"}),e.jsx("div",{className:"text-lg font-bold text-green-600",children:ft.boundCount})]}),e.jsxs("div",{className:"p-2 bg-amber-50 dark:bg-amber-950/20 rounded",children:[e.jsx("div",{className:"text-[10px] text-muted-foreground",children:s?"Unbound":"未绑定"}),e.jsx("div",{className:"text-lg font-bold text-amber-600",children:ft.unboundCount})]}),e.jsxs("div",{className:"p-2 bg-cyan-50 dark:bg-cyan-950/20 rounded",children:[e.jsx("div",{className:"text-[10px] text-muted-foreground",children:s?"Alive Proxies":"可用代理"}),e.jsx("div",{className:"text-lg font-bold text-cyan-600",children:ft.aliveProxyCount})]})]}),ft.overloadedProxies.length>0&&e.jsxs("div",{className:"p-2 bg-red-50 dark:bg-red-950/20 border border-red-200 dark:border-red-800 rounded text-xs",children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-medium text-red-700 dark:text-red-300",children:[e.jsx(fs,{className:"h-3.5 w-3.5"}),s?"Risk: Overloaded proxies":"风险:超载代理"]}),e.jsx("p",{className:"text-muted-foreground mt-1",children:s?`${ft.overloadedProxies.length} proxy/proxies are carrying more than 10 accounts. Consider re-distributing.`:`${ft.overloadedProxies.length} 个代理承载了超过 10 个账号,建议重新分配。`})]}),e.jsxs("div",{className:"flex items-center gap-3 flex-wrap p-3 bg-muted/20 rounded-lg border border-dashed",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Kn,{className:"h-4 w-4 text-primary"}),e.jsxs(Fe,{className:"text-sm",children:[s?"Accounts per proxy":"每代理承载",":"]}),e.jsx(it,{type:"number",min:0,max:50,value:_e,onChange:O=>{const ne=parseInt(O.target.value,10);!isNaN(ne)&&ne>=0&&st(ne)},className:"h-8 w-20 text-xs text-center"}),e.jsx("span",{className:"text-[10px] text-muted-foreground italic",children:_e===0?s?"(0 = even split)":"(0 = 均分)":s?"accounts → 1 IP":"账号 / IP"})]}),e.jsxs(D,{size:"sm",onClick:()=>Ge(!0),disabled:ft.unboundCount===0,children:[e.jsx(Fn,{className:"h-4 w-4 mr-1"}),s?`Auto-Bind Unbound (${ft.unboundCount})`:`自动绑定未分配 (${ft.unboundCount})`]}),e.jsxs(D,{size:"sm",variant:"outline",onClick:()=>Ge(!1),children:[e.jsx(Mt,{className:"h-4 w-4 mr-1"}),s?"Re-Distribute All":"重新分配全部"]}),e.jsxs(D,{size:"sm",variant:"ghost",className:"text-destructive ml-auto",onClick:()=>{ft.boundCount!==0&&confirm(s?`Unbind all ${ft.boundCount} accounts?`:`解绑全部 ${ft.boundCount} 个账号?`)&&k()},disabled:ft.boundCount===0,children:[e.jsx(QN,{className:"h-4 w-4 mr-1"}),s?"Unbind All":"解绑全部"]})]}),e.jsx("button",{onClick:()=>ue(!oe),className:"text-xs text-primary hover:underline flex items-center gap-1",children:oe?s?"▼ Hide binding details":"▼ 隐藏绑定明细":s?"▶ Show binding details":"▶ 显示绑定明细"}),oe&&e.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto border rounded-lg",children:[xt.filter(O=>O.enabled&&O.status!=="dead").map(O=>{const ne=Object.entries(T).filter(([,ze])=>ze===O.id).map(([ze])=>ze);return ne.length===0?null:e.jsxs("div",{className:"p-2 border-b last:border-b-0",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 text-xs mb-1",children:[e.jsxs("span",{className:"font-mono truncate",title:O.url,children:[O.host,":",O.port,O.label&&e.jsx($e,{variant:"outline",className:"ml-1.5 h-4 text-[9px]",children:O.label})]}),e.jsxs($e,{variant:"outline",className:"text-[10px]",children:[ne.length," ",s?"accounts":"账号"]})]}),e.jsx("div",{className:"flex flex-wrap gap-1 pl-2",children:ne.map(ze=>{const _=j.get(ze);return e.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded bg-muted text-[10px] hover:bg-destructive/10 transition-colors group",children:[e.jsx("span",{title:_?.email,children:_?.email||ze.slice(0,8)}),e.jsx("button",{onClick:()=>S(ze),className:"opacity-30 group-hover:opacity-100 text-destructive",title:s?"Unbind":"解绑",children:e.jsx(fs,{className:"h-2.5 w-2.5"})})]},ze)})})]},O.id)}),ft.unboundCount>0&&e.jsx("div",{className:"p-2 bg-amber-50 dark:bg-amber-950/10 text-xs",children:e.jsx("span",{className:"text-amber-700 dark:text-amber-300",children:s?`${ft.unboundCount} accounts have no proxy binding (will use global proxy / direct).`:`${ft.unboundCount} 个账号未绑定代理(将走全局代理 / 直连)`})}),ft.boundCount===0&&e.jsx("div",{className:"p-4 text-center text-xs text-muted-foreground",children:s?'No bindings yet. Click "Auto-Bind" above to start.':'尚无绑定。点击上方"自动绑定"开始。'})]})]})]}),Ze.length>0?e.jsx(De,{children:e.jsxs(Pe,{className:"py-0 px-0",children:[e.jsxs("div",{className:"flex items-center gap-3 py-2 px-3 border-b text-xs font-medium text-muted-foreground bg-muted/30",children:[e.jsx("button",{onClick:Ct,className:"flex-shrink-0",children:e.jsx("input",{type:"checkbox",readOnly:!0,checked:V.size===Ze.length&&Ze.length>0,className:"cursor-pointer"})}),e.jsx("span",{className:"w-12 text-center",children:s?"On":"启用"}),e.jsx("span",{className:"flex-1",children:"URL"}),e.jsx("span",{className:"w-24 text-center",children:s?"Status":"状态"}),e.jsx("span",{className:"w-20 text-center",children:s?"Used":"使用"}),e.jsx("span",{className:"w-20 text-center",children:s?"Failed":"失败"}),e.jsx("span",{className:"w-32 text-center",children:s?"External IP / Email":"出口 IP / 邮箱"}),e.jsx("span",{className:"w-24 text-center",children:s?"Actions":"操作"})]}),e.jsx(rR,{filtered:Ze,selectedIds:V,onSelect:Jt,onToggle:f,onTest:y,onDelete:u,onSaveLabel:(O,ne)=>p(O,{label:ne}),isEn:s})]})}):e.jsx(De,{children:e.jsxs(Pe,{className:"py-12 text-center text-muted-foreground",children:[e.jsx(ri,{className:"h-12 w-12 mx-auto mb-3 opacity-30"}),e.jsx("p",{className:"text-sm",children:xt.length===0?s?"No proxies yet. Add some to begin.":"暂无代理。先添加一些代理。":s?"No proxies match the current filter.":"当前筛选无匹配代理。"})]})})]})}function lj({proxy:n,selected:s,onSelect:r,onToggle:i,onTest:o,onDelete:d,onSaveLabel:u,isEn:h}){const f=g.useMemo(()=>n.password?n.url.replace(/:([^:@\/]+)@/,":***@"):n.url,[n.url,n.password]),p=()=>{navigator.clipboard.writeText(n.url)},[y,b]=g.useState(!1),[v,N]=g.useState(n.label||""),j=()=>{N(n.label||""),b(!0)},T=()=>{const S=v.trim();S!==(n.label||"")&&u(S||void 0),b(!1)};return e.jsxs("div",{className:me("flex items-center gap-3 py-2 px-3 border-b last:border-b-0 hover:bg-muted/40 text-xs transition-colors",s&&"bg-primary/5",!n.enabled&&"opacity-60"),children:[e.jsx("input",{type:"checkbox",checked:s,onChange:r,className:"flex-shrink-0 cursor-pointer"}),e.jsx("button",{onClick:i,className:"w-12 flex justify-center text-muted-foreground hover:text-foreground",title:h?n.enabled?"Disable":"Enable":n.enabled?"停用":"启用",children:n.enabled?e.jsx(kc,{className:"h-4 w-4 text-green-500"}):e.jsx(qN,{className:"h-4 w-4"})}),e.jsxs("span",{className:"flex-1 font-mono truncate flex items-center min-w-0",title:f,children:[e.jsxs("span",{className:"opacity-50 mr-1 flex-shrink-0",children:[n.protocol,"://"]}),e.jsxs("span",{className:"truncate",children:[n.host,":",n.port,n.username&&e.jsxs("span",{className:"opacity-50 ml-1",children:["@",n.username]})]}),y?e.jsx("input",{autoFocus:!0,value:v,onChange:S=>N(S.target.value),onBlur:T,onClick:S=>S.stopPropagation(),onKeyDown:S=>{S.key==="Enter"?T():S.key==="Escape"&&(N(n.label||""),b(!1))},placeholder:h?"Note":"备注",className:"ml-2 px-1.5 h-5 text-[10px] rounded border border-primary bg-background font-sans w-28 flex-shrink-0 focus:outline-none focus:ring-1 focus:ring-primary"}):n.label?e.jsx($e,{variant:"outline",className:"ml-2 h-4 text-[9px] cursor-pointer hover:bg-muted flex-shrink-0",onClick:j,title:h?"Click to edit note":"点击编辑备注",children:n.label}):null]}),e.jsx("span",{className:"w-24 flex justify-center",children:e.jsx(iw,{status:n.status,latency:n.latencyMs})}),e.jsx("span",{className:"w-20 text-center font-mono tabular-nums",children:n.usedCount}),e.jsx("span",{className:me("w-20 text-center font-mono tabular-nums",n.failCount>0&&"text-amber-600"),children:n.failCount}),e.jsx("span",{className:"w-32 text-center text-[10px] truncate",title:n.lastBoundEmail,children:n.lastBoundEmail?e.jsx("span",{className:"text-muted-foreground",children:n.lastBoundEmail}):n.lastTestedAt?e.jsxs("span",{className:"text-muted-foreground inline-flex items-center gap-0.5",children:[e.jsx(Gn,{className:"h-2.5 w-2.5"}),Math.round((Date.now()-n.lastTestedAt)/6e4),"m"]}):e.jsx("span",{className:"opacity-40",children:"-"})}),e.jsxs("span",{className:"w-24 flex justify-center gap-1",children:[e.jsx("button",{onClick:()=>void o(),disabled:n.status==="testing",className:"p-1 rounded hover:bg-muted",title:h?"Test":"测试",children:n.status==="testing"?e.jsx(bt,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(Mt,{className:"h-3.5 w-3.5"})}),e.jsx("button",{onClick:j,className:"p-1 rounded hover:bg-muted",title:h?"Edit note":"编辑备注",children:e.jsx(XA,{className:"h-3.5 w-3.5"})}),e.jsx("button",{onClick:p,className:"p-1 rounded hover:bg-muted",title:h?"Copy URL":"复制 URL",children:e.jsx(As,{className:"h-3.5 w-3.5"})}),e.jsx("button",{onClick:d,className:"p-1 rounded hover:bg-destructive/10 text-destructive",title:h?"Delete":"删除",children:e.jsx(Vt,{className:"h-3.5 w-3.5"})})]})]})}function rR({filtered:n,selectedIds:s,onSelect:r,onToggle:i,onTest:o,onDelete:d,onSaveLabel:u,isEn:h}){const f=g.useRef(null),p=44,y=lo({count:n.length,getScrollElement:()=>f.current,estimateSize:()=>p,overscan:10});if(n.length<50)return e.jsx("div",{ref:f,className:"max-h-[60vh] overflow-y-auto",children:n.map(v=>e.jsx(lj,{proxy:v,selected:s.has(v.id),onSelect:()=>r(v.id),onToggle:()=>i(v.id),onTest:()=>o(v.id),onDelete:()=>d(v.id),onSaveLabel:N=>u(v.id,N),isEn:h},v.id))});const b=y.getVirtualItems();return e.jsx("div",{ref:f,className:"max-h-[60vh] overflow-y-auto",style:{contain:"strict"},children:e.jsx("div",{style:{height:y.getTotalSize(),position:"relative",width:"100%"},children:b.map(v=>{const N=n[v.index];return N?e.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${v.start}px)`},children:e.jsx(lj,{proxy:N,selected:s.has(N.id),onSelect:()=>r(N.id),onToggle:()=>i(N.id),onTest:()=>o(N.id),onDelete:()=>d(N.id),onSaveLabel:j=>u(N.id,j),isEn:h})},v.key):null})})})}const Of=[{value:"dingtalk",label:"钉钉",labelEn:"DingTalk",placeholder:"https://oapi.dingtalk.com/robot/send?access_token=xxx"},{value:"wechat-work",label:"企业微信",labelEn:"WeCom",placeholder:"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=xxx"},{value:"feishu",label:"飞书",labelEn:"Feishu",placeholder:"https://open.feishu.cn/open-apis/bot/v2/hook/xxx"},{value:"telegram",label:"Telegram",labelEn:"Telegram",placeholder:"https://api.telegram.org/bot<token>"},{value:"discord",label:"Discord",labelEn:"Discord",placeholder:"https://discord.com/api/webhooks/xxx"},{value:"custom",label:"自定义",labelEn:"Custom",placeholder:"https://your-server.com/webhook"}];function iR(){const{t:n}=Ut(),s=n("common.unknown")==="Unknown",{webhooks:r,addWebhook:i,updateWebhook:o,removeWebhook:d,toggleWebhook:u,testWebhook:h}=_n(),[f,p]=g.useState(null),[y,b]=g.useState(null),[v,N]=g.useState({}),j=g.useMemo(()=>Array.from(r.values()),[r]),T=()=>{if(!f||!f.kind||!f.url)return;const k={kind:f.kind,url:f.url,label:f.label,enabled:f.enabled??!0,telegramChatId:f.telegramChatId,customTemplate:f.customTemplate,events:f.events??["batch-completed","risk-warning","account-banned"]};f.id?o(f.id,k):i(k),p(null)},S=async k=>{b(k);const R=await h(k);N(I=>({...I,[k]:{...R,time:Date.now()}})),b(null)};return e.jsxs("div",{className:"flex-1 p-6 space-y-6 overflow-auto",children:[e.jsxs("div",{className:"page-hero p-6",children:[e.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-pink-500/20 to-transparent rounded-full blur-2xl"}),e.jsx("div",{className:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-pink-500/20 to-transparent rounded-full blur-2xl"}),e.jsxs("div",{className:"relative flex items-center gap-4",children:[e.jsx("div",{className:"p-3 rounded-xl bg-pink-500 shadow-lg shadow-pink-500/25",children:e.jsx(wp,{className:"h-6 w-6 text-white"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-pink-600 dark:text-pink-400",children:s?"Webhook Notifications":"Webhook 通知"}),e.jsx("p",{className:"text-muted-foreground",children:s?"Push critical events (batch completed, risk warning, account banned, etc.) to DingTalk / WeCom / Feishu / Telegram / Discord / custom endpoints.":"把关键事件(批量完成、风控警告、账号封禁等)推送到钉钉/企微/飞书/Telegram/Discord/自定义服务"})]})]})]}),e.jsxs(De,{children:[e.jsxs(at,{className:"pb-3 flex flex-row items-center justify-between",children:[e.jsxs(rt,{className:"text-base flex items-center gap-2",children:[e.jsx(gx,{className:"h-4 w-4 text-primary"}),s?`Webhooks (${j.length})`:`Webhook 列表 (${j.length})`]}),e.jsxs(D,{size:"sm",onClick:()=>p({kind:"dingtalk",enabled:!0,events:["batch-completed","risk-warning","account-banned"]}),children:[e.jsx(Ts,{className:"h-4 w-4 mr-1"}),s?"Add Webhook":"添加 Webhook"]})]}),e.jsx(Pe,{children:j.length===0?e.jsxs("div",{className:"py-12 text-center text-muted-foreground",children:[e.jsx(wp,{className:"h-12 w-12 mx-auto mb-3 opacity-30"}),e.jsx("p",{className:"text-sm",children:s?"No webhooks configured.":"尚未配置 Webhook"})]}):e.jsx("div",{className:"space-y-2",children:j.map(k=>{const R=v[k.id],I=Of.find(G=>G.value===k.kind),M=I?s?I.labelEn:I.label:k.kind;return e.jsxs("div",{className:me("flex items-start gap-3 p-3 rounded-lg border",k.enabled?"bg-card":"bg-muted/30 opacity-70"),children:[e.jsx("button",{onClick:()=>u(k.id),className:"mt-0.5",title:k.enabled?"点击停用":"点击启用",children:k.enabled?e.jsx(kc,{className:"h-4 w-4 text-green-500"}):e.jsx(qN,{className:"h-4 w-4 text-muted-foreground"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"font-medium text-sm",children:k.label||M}),e.jsx($e,{variant:"outline",className:"text-[10px]",children:M}),R&&Date.now()-R.time<6e4&&e.jsx($e,{variant:"outline",className:me("text-[10px]",R.success?"text-green-600 border-green-200":"text-red-600 border-red-200"),children:R.success?e.jsxs(e.Fragment,{children:[e.jsx(an,{className:"h-2.5 w-2.5 mr-0.5 inline"})," ",s?"Test OK":"测试成功"]}):e.jsxs(e.Fragment,{children:[e.jsx(fs,{className:"h-2.5 w-2.5 mr-0.5 inline"})," ",s?"Test failed":"测试失败"]})})]}),e.jsx("p",{className:"text-xs text-muted-foreground font-mono mt-0.5 truncate",title:k.url,children:k.url}),k.events.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mt-1.5",children:k.events.map(G=>{const W=Lv.find(q=>q.value===G),U=W?s?W.labelEn:W.label:G;return e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-primary/10 text-primary",children:U},G)})}),R&&!R.success&&R.error&&e.jsx("p",{className:"text-[10px] text-red-500 mt-1",children:R.error})]}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(D,{size:"sm",variant:"ghost",onClick:()=>S(k.id),disabled:y===k.id,children:y===k.id?e.jsx(bt,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(cM,{className:"h-3.5 w-3.5"})}),e.jsx(D,{size:"sm",variant:"ghost",onClick:()=>p({...k}),children:e.jsx(yx,{className:"h-3.5 w-3.5"})}),e.jsx(D,{size:"sm",variant:"ghost",className:"text-destructive",onClick:()=>{confirm(s?`Delete webhook "${k.label||M}"?`:`删除 Webhook "${k.label||M}"?`)&&d(k.id)},children:e.jsx(Vt,{className:"h-3.5 w-3.5"})})]})]},k.id)})})})]}),f&&e.jsxs(De,{className:"border-primary/40 shadow-lg",children:[e.jsx(at,{className:"pb-3",children:e.jsx(rt,{className:"text-base",children:f.id?s?"Edit Webhook":"编辑 Webhook":s?"New Webhook":"新建 Webhook"})}),e.jsxs(Pe,{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(Fe,{className:"text-xs",children:s?"Type":"类型"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:Of.map(k=>e.jsx("button",{onClick:()=>p({...f,kind:k.value}),className:me("px-3 py-1.5 rounded-md border text-xs transition-colors",f.kind===k.value?"border-primary bg-primary/10 text-primary font-medium":"border-border hover:border-primary/50"),children:s?k.labelEn:k.label},k.value))})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(Fe,{className:"text-xs",children:s?"Label (optional)":"备注名(可选)"}),e.jsx(it,{value:f.label||"",onChange:k=>p({...f,label:k.target.value}),placeholder:s?"e.g. Dev group":"例如:开发群",className:"h-8"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(Fe,{className:"text-xs",children:"Webhook URL"}),e.jsx(it,{value:f.url||"",onChange:k=>p({...f,url:k.target.value}),placeholder:Of.find(k=>k.value===f.kind)?.placeholder,className:"h-8 font-mono text-xs"})]}),f.kind==="telegram"&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(Fe,{className:"text-xs",children:"Chat ID"}),e.jsx(it,{value:f.telegramChatId||"",onChange:k=>p({...f,telegramChatId:k.target.value}),placeholder:s?"123456789 or @channel_name":"123456789 或 @channel_name",className:"h-8 font-mono text-xs"})]}),f.kind==="custom"&&e.jsxs("div",{className:"space-y-1",children:[e.jsxs(Fe,{className:"text-xs",children:[s?"Custom JSON template (placeholders: ":"自定义 JSON 模板(占位符:","{{title}} {{message}} {{level}} {{icon}}",s?")":")"]}),e.jsx("textarea",{value:f.customTemplate||"",onChange:k=>p({...f,customTemplate:k.target.value}),rows:4,className:"w-full px-3 py-2 rounded-md border bg-background text-xs font-mono",placeholder:'{"text": "{{title}}", "body": "{{message}}"}'})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(Fe,{className:"text-xs",children:s?"Subscribed events":"订阅事件"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:Lv.map(k=>{const R=f.events?.includes(k.value)??!1;return e.jsx("button",{onClick:()=>{const I=f.events??[],M=R?I.filter(G=>G!==k.value):[...I,k.value];p({...f,events:M})},className:me("px-2 py-1 rounded-md border text-[11px] transition-colors",R?"border-primary bg-primary/10 text-primary":"border-border hover:border-primary/50"),children:s?k.labelEn:k.label},k.value)})})]}),e.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[e.jsx(is,{checked:f.enabled??!0,onCheckedChange:k=>p({...f,enabled:k})}),e.jsx(Fe,{className:"text-sm cursor-pointer",children:s?"Enabled":"启用"})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(D,{variant:"ghost",size:"sm",onClick:()=>p(null),children:s?"Cancel":"取消"}),e.jsx(D,{size:"sm",onClick:T,disabled:!f.kind||!f.url,children:s?"Save":"保存"})]})]})]})]})}const zf=["claude-sonnet-4.5","claude-sonnet-4","claude-haiku-4.5","claude-opus-4.5","claude-3.7-sonnet","auto"];function lR(n){const s=`${n.error||""} ${n.content||""}`.trim(),r=s.toLowerCase();return r&&(r.includes("auth error 401")||r.includes("auth error 403")||r.includes("temporarily_suspended")||r.includes("permanently_suspended")||r.includes("accountsuspendedexception")||r.includes("temporarily suspended")||r.includes("account suspended")||r.includes("user id is temporarily suspended")||r.includes("unusual user activity")||r.includes("locked it as a security precaution")||r.includes("restricted your ability to use kiro"))?s:null}function oR(n){const s=lR(n);return s?{...n,success:!1,content:void 0,error:s}:n}function cR(n){return n.replace(/:([^:@/]+)@/,":***@")}const dR=[{id:"public-ip",label:{en:"Public connectivity",zh:"Kết nối internet"},url:"https://api.ipify.org?format=json",category:"network",description:{en:"Check basic internet access",zh:"Kiểm tra truy cập internet cơ bản"}},{id:"cloudflare",label:{en:"Cloudflare",zh:"Cloudflare"},url:"https://1.1.1.1",category:"network",description:{en:"Check international network reachability",zh:"Kiểm tra đường mạng quốc tế"}},{id:"kiro-auth",label:{en:"Kiro Auth Endpoint",zh:"Kiro Auth Endpoint"},url:"https://prod.us-east-1.auth.desktop.kiro.dev/.well-known/openid-configuration",category:"kiro",description:{en:"Social login token refresh endpoint",zh:"Endpoint làm mới token đăng nhập"},expectStatus:[200,401,403,404]},{id:"kiro-oidc",label:{en:"AWS OIDC",zh:"AWS OIDC"},url:"https://oidc.us-east-1.amazonaws.com/",category:"kiro",description:{en:"OIDC registration endpoint",zh:"Endpoint đăng ký OIDC"},expectStatus:[200,400,403,405]},{id:"kiro-codewhisperer",label:{en:"CodeWhisperer API",zh:"CodeWhisperer API"},url:"https://q.us-east-1.amazonaws.com/",category:"kiro",description:{en:"Kiro main API endpoint (q.amazonaws.com)",zh:"Endpoint API chính của Kiro (q.amazonaws.com)"},expectStatus:[200,400,403,405]},{id:"aws-signin",label:{en:"AWS SignIn",zh:"AWS SignIn"},url:"https://us-east-1.signin.aws/",category:"kiro",description:{en:"Required endpoint for the signup flow",zh:"Endpoint cần cho luồng đăng ký"},expectStatus:[200,400,403]},{id:"tempmail-plus",label:{en:"TempMail.Plus API",zh:"TempMail.Plus API"},url:"https://tempmail.plus/api/mails?email=test@mailto.plus",category:"email",description:{en:"TempMail.Plus mailbox service",zh:"Dịch vụ hộp thư TempMail.Plus"},expectStatus:[200,400,401,403]},{id:"outlook-login",label:{en:"Outlook Login",zh:"Outlook Login"},url:"https://login.microsoftonline.com/consumers/oauth2/v2.0/token",category:"email",description:{en:"Outlook token refresh endpoint",zh:"Endpoint làm mới token Outlook"},expectStatus:[200,400,405]}],uR=[{id:"network",label:{en:"Network",zh:"Mạng"},icon:ri,color:"text-blue-500"},{id:"kiro",label:{en:"Kiro / AWS",zh:"Kiro / AWS"},icon:Ks,color:"text-purple-500"},{id:"email",label:{en:"Email",zh:"Email"},icon:xx,color:"text-amber-500"},{id:"proxy",label:{en:"Proxy",zh:"Proxy"},icon:Ki,color:"text-cyan-500"},{id:"custom",label:{en:"Custom",zh:"Tùy chỉnh"},icon:Ks,color:"text-emerald-500"}];function hR(){const{t:n}=Ut(),s=n("common.unknown")==="Unknown",r=J=>s?J.en:J.zh,{proxyPool:i,proxyPoolConfig:o,accounts:d,selectedIds:u,getAccountProxyUrl:h,updateAccount:f,removeAccounts:p}=vt(),y=g.useMemo(()=>Array.from(d.values()),[d]),b=g.useMemo(()=>Array.from(u).map(J=>d.get(J)).filter(J=>!!J),[u,d]),[v,N]=g.useState(()=>vt.getState().selectedIds.size>0?"selected":"single"),[j,T]=g.useState(""),[S,k]=g.useState(()=>{try{return localStorage.getItem("kiro-liveness-model")||zf[0]}catch{return zf[0]}}),[R,I]=g.useState('Hi, reply with "pong" only.'),[M,G]=g.useState(!1),[W,U]=g.useState(null),[q,V]=g.useState(new Map),[le]=g.useState(3),B=g.useRef(!1),[be,K]=g.useState(()=>{try{const J=localStorage.getItem("kiro-liveness-models-cache");if(J){const Ne=JSON.parse(J);if(Array.isArray(Ne))return Ne.filter(et=>typeof et=="string")}}catch{}return[]}),[se,te]=g.useState(!1),Y=g.useMemo(()=>Array.from(new Set([...be,...zf])),[be]);g.useEffect(()=>{try{localStorage.setItem("kiro-liveness-model",S)}catch{}},[S]);const P=g.useCallback(async()=>{te(!0);try{let J=[];try{const Ne=await window.api.proxyGetModels();Ne.success&&Ne.models?.length&&(J=Ne.models.map(et=>et.id))}catch{}if(J.length===0)try{const Ne=await window.api.getKiroAvailableModels();Ne.models?.length&&(J=Ne.models.map(et=>et.id))}catch{}if(J.length>0){K(J);try{localStorage.setItem("kiro-liveness-models-cache",JSON.stringify(J))}catch{}}}finally{te(!1)}},[]);g.useEffect(()=>{P()},[P]),g.useEffect(()=>()=>{B.current=!0},[]);const F=g.useCallback(async J=>{const Ne=J.credentials;try{const et=await window.api.diagnoseAccountLiveness({account:{id:J.id,email:J.email,accessToken:Ne.accessToken,refreshToken:Ne.refreshToken,clientId:Ne.clientId,clientSecret:Ne.clientSecret,region:Ne.region,authMethod:Ne.authMethod,provider:Ne.provider||J.idp,profileArn:J.profileArn,machineId:J.machineId,expiresAt:Ne.expiresAt,proxyUrl:h(J.id)},model:S.trim(),message:R.trim()||void 0}),qe=oR(et);return qe.profileArn&&qe.profileArn!==J.profileArn&&f(J.id,{profileArn:qe.profileArn}),qe}catch(et){return{success:!1,latencyMs:0,error:et instanceof Error?et.message:String(et)}}},[S,R,h,f]),fe=g.useCallback(async()=>{const J=d.get(j);if(!J)return;B.current=!1,G(!0),U(null);const Ne=await F(J);B.current||(U(Ne),Ne.success?f(J.id,{status:"active",lastError:void 0}):f(J.id,{status:"error",lastError:Ne.error||(s?"Liveness test failed":"Kiểm tra liveness thất bại")}),G(!1))},[d,j,F,f,s]),pe=g.useCallback(async()=>{if(b.length===0)return;B.current=!1,G(!0);const J=new Map;for(const Je of b)J.set(Je.id,null);V(new Map(J));const Ne=[...b],et=async()=>{for(;!B.current;){const Je=Ne.shift();if(!Je)break;const Kt=await F(Je);if(B.current)break;V(Ye=>{const qt=new Map(Ye);return qt.set(Je.id,Kt),qt}),Kt.success?f(Je.id,{status:"active",lastError:void 0}):f(Je.id,{status:"error",lastError:Kt.error||(s?"Liveness test failed":"Kiểm tra liveness thất bại")})}},qe=Array.from({length:Math.min(le,b.length)},()=>et());await Promise.all(qe),B.current||G(!1)},[b,F,le,f,s]),C=g.useCallback(()=>{B.current=!0,G(!1)},[]),z=g.useCallback(async J=>{const Ne=d.get(J);if(!Ne)return;B.current=!1,V(qe=>new Map(qe).set(J,null));const et=await F(Ne);B.current||(V(qe=>new Map(qe).set(J,et)),et.success?f(J,{status:"active",lastError:void 0}):f(J,{status:"error",lastError:et.error||(s?"Liveness test failed":"Kiểm tra liveness thất bại")}))},[d,F,f,s]),X=g.useMemo(()=>b.filter(J=>{const Ne=q.get(J.id);return Ne&&!Ne.success}).map(J=>J.id),[b,q]),re=g.useCallback(async()=>{const J=X;if(J.length===0)return;B.current=!1,G(!0),V(Je=>{const Kt=new Map(Je);for(const Ye of J)Kt.set(Ye,null);return Kt});const Ne=J.map(Je=>d.get(Je)).filter(Je=>!!Je),et=async()=>{for(;!B.current;){const Je=Ne.shift();if(!Je)break;const Kt=await F(Je);if(B.current)break;V(Ye=>new Map(Ye).set(Je.id,Kt)),Kt.success?f(Je.id,{status:"active",lastError:void 0}):f(Je.id,{status:"error",lastError:Kt.error||(s?"Liveness test failed":"Kiểm tra liveness thất bại")})}},qe=Array.from({length:Math.min(le,Ne.length)},()=>et());await Promise.all(qe),B.current||G(!1)},[X,d,F,le,f,s]),xe=g.useCallback(()=>{for(const J of X){const Ne=q.get(J);f(J,{status:"error",lastError:Ne?.error||(s?"Liveness test failed":"Kiểm tra liveness thất bại")})}},[X,q,f,s]),Oe=g.useCallback(()=>{const J=X;J.length===0||!window.confirm(s?`Delete ${J.length} accounts that failed the liveness test? This cannot be undone.`:`Xóa ${J.length} tài khoản kiểm tra liveness thất bại? Không thể hoàn tác.`)||(p(J),V(et=>{const qe=new Map(et);for(const Je of J)qe.delete(Je);return qe}))},[X,p,s]),Ee=g.useMemo(()=>{let J=0,Ne=0,et=0;for(const qe of q.values())qe!==null&&(J++,qe.success?Ne++:et++);return{done:J,ok:Ne,fail:et,total:q.size}},[q]),[Qe,_e]=g.useState(()=>{try{const J=localStorage.getItem("kiro-diagnose-probe-url");if(J!==null)return J;const Ne=localStorage.getItem("kiro-diagnose-moemail")||"";if(Ne)try{localStorage.setItem("kiro-diagnose-probe-url",Ne),localStorage.removeItem("kiro-diagnose-moemail")}catch{}return Ne}catch{return""}}),[st,oe]=g.useState(!1),[ue,ae]=g.useState(""),[L,we]=g.useState(!1),[Ue,Lt]=g.useState({}),[xt,Qt]=g.useState({done:0,total:0}),ft=Array.from(i.values()).filter(J=>J.enabled&&J.status!=="dead"),Et=g.useCallback(()=>{const J=[...dR],Ne=Qe.trim();if(Ne){const et=/^https?:\/\//i.test(Ne)?Ne:`https://${Ne}`;J.push({id:"custom-probe",label:{en:"Custom Probe URL",zh:"URL kiểm tra tùy chỉnh"},url:et,category:"custom",description:{en:"User-provided URL for connectivity test",zh:"URL người dùng nhập để kiểm tra kết nối"},expectStatus:[200,201,204,301,302,400,401,403,404,405]})}return J},[Qe,s]),Ge=g.useCallback(async()=>{const J=Et();we(!0),Lt({}),Qt({done:0,total:J.length});const Ne=st&&ue?i.get(ue)?.url:void 0;try{const qe={};for(let Je=0;Je<J.length;Je+=4){const Kt=J.slice(Je,Je+4),Ye=await window.api.diagnoseRun({proxyUrl:Ne,targets:Kt.map(qt=>({id:qt.id,label:r(qt.label),url:qt.url,expectStatus:qt.expectStatus}))});for(const qt of Ye.results)qe[qt.id]=qt;Lt({...qe}),Qt({done:Math.min(Je+4,J.length),total:J.length})}}finally{we(!1);try{localStorage.setItem("kiro-diagnose-probe-url",Qe)}catch{}}},[Et,st,ue,i,Qe]),gt=g.useCallback(()=>{const J=Et(),Ne=[s?"Krouter - Diagnostic Report":"Krouter - 诊断报告",`${s?"Generated":"生成时间"}: ${new Date().toLocaleString()}`,`Proxy: ${st&&ue?i.get(ue)?.url:s?"Direct":"Trực tiếp"}`,"------------------------------------"];for(const et of J){const qe=Ue[et.id];Ne.push(`[${r(et.label)}]`),Ne.push(` URL: ${et.url}`),qe?(Ne.push(` ${s?"Status":"Trạng thái"}: ${qe.success?s?"✓ Pass":"✓ Đạt":s?"✗ Fail":"✗ Lỗi"}`),qe.httpStatus&&Ne.push(` HTTP: ${qe.httpStatus}`),qe.latencyMs!=null&&Ne.push(` ${s?"Latency":"延迟"}: ${qe.latencyMs}ms`),qe.error&&Ne.push(` ${s?"Error":"错误"}: ${qe.error}`)):Ne.push(` ${s?"Status":"Trạng thái"}: ${s?"Not tested":"Chưa kiểm tra"}`),Ne.push("")}navigator.clipboard.writeText(Ne.join(`
|
|
128
|
+
`)),alert(s?"Report copied to clipboard":"诊断报告已复制到剪贴板")},[Et,Ue,st,ue,i,s]),Ze=(()=>{const J=Object.values(Ue);return{total:J.length,passed:J.filter(Ne=>Ne.success).length,failed:J.filter(Ne=>!Ne.success).length}})();return e.jsxs("div",{className:"flex-1 p-6 space-y-6 overflow-auto",children:[e.jsxs("div",{className:"page-hero p-6",children:[e.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-emerald-500/20 to-transparent rounded-full blur-2xl"}),e.jsx("div",{className:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-emerald-500/20 to-transparent rounded-full blur-2xl"}),e.jsxs("div",{className:"relative flex items-center gap-4",children:[e.jsx("div",{className:"p-3 rounded-xl bg-emerald-500 shadow-lg shadow-emerald-500/25",children:e.jsx(vx,{className:"h-6 w-6 text-white"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-emerald-600 dark:text-emerald-400",children:s?"Diagnostics":"一键诊断"}),e.jsx("p",{className:"text-muted-foreground",children:s?"Test network / Kiro API / email service / proxy connectivity in one click.":"Kiểm tra mạng, Kiro/AWS API, email service và proxy trong một lần."})]})]})]}),e.jsxs(De,{children:[e.jsx(at,{className:"pb-3",children:e.jsxs(rt,{className:"text-base flex items-center gap-2",children:[e.jsx(Ks,{className:"h-4 w-4 text-primary"}),s?"Diagnostic Config":"诊断配置"]})}),e.jsxs(Pe,{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(Fe,{className:"text-xs",children:s?"Custom probe URL (optional)":"URL kiểm tra tùy chỉnh (tùy chọn)"}),e.jsx(it,{value:Qe,onChange:J=>_e(J.target.value),placeholder:"https://example.com/health",disabled:L,className:"font-mono text-xs"}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:s?"Any HTTP/HTTPS endpoint will be added to the diagnostic list (HEAD request, expecting 2xx/3xx/4xx).":"Có thể nhập endpoint HTTP/HTTPS bất kỳ để kiểm tra kết nối (HEAD, 2xx/3xx/4xx đều tính là thông)."})]}),e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:st,onChange:J=>oe(J.target.checked),disabled:L}),e.jsx("span",{children:s?"Test through proxy":"Kiểm tra qua proxy"})]}),st&&(ft.length>0?e.jsxs("select",{value:ue,onChange:J=>ae(J.target.value),disabled:L,className:"h-8 px-2 rounded-md border bg-background text-xs flex-1 max-w-md",children:[e.jsxs("option",{value:"",children:["-- ",s?"Select a proxy":"Chọn proxy"," --"]}),ft.map(J=>e.jsxs("option",{value:J.id,children:[J.protocol,"://",J.host,":",J.port,J.label?` (${J.label})`:"",J.status==="alive"&&J.latencyMs?` - ${J.latencyMs}ms`:""]},J.id))]}):e.jsx("span",{className:"text-xs text-muted-foreground italic",children:o.enabled?s?"No available proxy in pool":"Không có proxy khả dụng trong kho":s?'Proxy pool disabled, configure it in "Proxy Pool" first':"Kho proxy chưa bật, hãy cấu hình trong trang Proxy Pool trước"}))]}),e.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[e.jsxs(D,{onClick:Ge,disabled:L,children:[L?e.jsx(bt,{className:"h-4 w-4 mr-1 animate-spin"}):e.jsx(Ba,{className:"h-4 w-4 mr-1"}),L?`运行中 ${xt.done}/${xt.total}`:s?"Run Diagnostics":"Chạy chẩn đoán"]}),Ze.total>0&&e.jsxs(D,{variant:"outline",size:"sm",onClick:gt,children:[e.jsx(Ns,{className:"h-4 w-4 mr-1"}),s?"Copy Report":"复制报告"]}),Ze.total>0&&e.jsxs("div",{className:"ml-auto flex items-center gap-2 text-xs",children:[e.jsxs($e,{variant:"outline",className:"text-green-600 border-green-200",children:[e.jsx(an,{className:"h-3 w-3 mr-1"})," ",Ze.passed]}),Ze.failed>0&&e.jsxs($e,{variant:"outline",className:"text-red-600 border-red-200",children:[e.jsx(fs,{className:"h-3 w-3 mr-1"})," ",Ze.failed]})]})]})]})]}),e.jsxs(De,{children:[e.jsx(at,{className:"pb-2",children:e.jsxs(rt,{className:"text-sm flex items-center gap-2",children:[e.jsx(gx,{className:"h-4 w-4 text-emerald-500"}),s?"Account Liveness Test":"Kiểm tra liveness tài khoản"]})}),e.jsxs(Pe,{className:"space-y-3",children:[e.jsx("p",{className:"text-[11px] text-muted-foreground",children:s?"Send a real chat message to the selected model via the reverse-proxy call path (account-bound proxy applies). Verifies the account can actually get a response.":"Gửi một tin nhắn thật tới model qua đường API proxy, tự dùng proxy đã gán cho tài khoản để xác nhận tài khoản còn trả lời được."}),e.jsxs("div",{className:"flex items-center gap-1 p-0.5 bg-muted rounded-md w-fit",children:[e.jsx("button",{type:"button",onClick:()=>N("single"),disabled:M,className:me("px-3 h-7 rounded text-xs font-medium transition-colors",v==="single"?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"),children:s?"Single":"Một tài khoản"}),e.jsxs("button",{type:"button",onClick:()=>N("selected"),disabled:M,className:me("px-3 h-7 rounded text-xs font-medium transition-colors flex items-center gap-1",v==="selected"?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"),children:[s?"Selected":"Đã chọn",e.jsx($e,{variant:"secondary",className:"h-4 px-1.5 text-[10px] tabular-nums",children:b.length})]})]}),v==="selected"&&b.length===0&&e.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] text-amber-600",children:[e.jsx(Rs,{className:"h-3.5 w-3.5"}),s?"No accounts selected. Go to the Accounts page and multi-select first.":"Chưa chọn tài khoản nào. Hãy sang trang Tài khoản và chọn nhiều tài khoản trước."]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[v==="single"&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(Fe,{className:"text-xs",children:s?"Account":"Tài khoản"}),e.jsxs("select",{value:j,onChange:J=>T(J.target.value),disabled:M,className:"h-9 w-full px-2 rounded-md border bg-background text-xs",children:[e.jsxs("option",{value:"",children:["-- ",s?"Select an account":"Chọn tài khoản"," --"]}),y.map(J=>{const Ne=h(J.id);return e.jsxs("option",{value:J.id,children:[J.email,J.subscription?.type?` [${J.subscription.type}]`:"",Ne?" 🔗":""]},J.id)})]}),j&&h(j)&&e.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[s?"Bound proxy: ":"Proxy đã gán: ",e.jsx("code",{className:"font-mono",children:cR(h(j))})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(Fe,{className:"text-xs",children:s?"Model":"模型"}),e.jsxs("button",{type:"button",onClick:()=>void P(),disabled:se,className:"flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50",title:s?"Refresh models from proxy cache / Kiro":"Làm mới model từ cache proxy / Kiro",children:[e.jsx(Mt,{className:me("h-3 w-3",se&&"animate-spin")}),be.length>0?s?`${be.length} cached`:`${be.length} 个缓存`:s?"Refresh":"刷新"]})]}),e.jsx("input",{list:"liveness-models",value:S,onChange:J=>k(J.target.value),disabled:M,placeholder:"claude-sonnet-4.5",className:"h-9 w-full px-2 rounded-md border bg-background text-xs font-mono"}),e.jsx("datalist",{id:"liveness-models",children:Y.map(J=>e.jsx("option",{value:J},J))})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(Fe,{className:"text-xs",children:s?"Test message":"Tin nhắn test"}),e.jsx(it,{value:R,onChange:J=>I(J.target.value),disabled:M,placeholder:'Hi, reply with "pong" only.',className:"text-xs"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[v==="single"?e.jsxs(D,{onClick:fe,disabled:M||!j||!S.trim(),children:[M?e.jsx(bt,{className:"h-4 w-4 mr-1 animate-spin"}):e.jsx(Ds,{className:"h-4 w-4 mr-1"}),M?s?"Testing...":"Đang test...":s?"Test Now":"Test ngay"]}):e.jsxs(e.Fragment,{children:[e.jsxs(D,{onClick:pe,disabled:M||b.length===0||!S.trim(),children:[M?e.jsx(bt,{className:"h-4 w-4 mr-1 animate-spin"}):e.jsx(Ds,{className:"h-4 w-4 mr-1"}),M?`${s?"Testing":"Đang test"} ${Ee.done}/${Ee.total}`:`${s?"Test Selected":"Test đã chọn"} (${b.length})`]}),M&&e.jsxs(D,{variant:"destructive",onClick:C,children:[e.jsx(Cn,{className:"h-4 w-4 mr-1"}),s?"Stop":"停止"]})]}),v==="selected"&&Ee.total>0&&e.jsxs("div",{className:"ml-auto flex items-center gap-2 text-xs",children:[e.jsxs($e,{variant:"outline",className:"text-green-600 border-green-200",children:[e.jsx(an,{className:"h-3 w-3 mr-1"})," ",Ee.ok]}),Ee.fail>0&&e.jsxs($e,{variant:"outline",className:"text-red-600 border-red-200",children:[e.jsx(fs,{className:"h-3 w-3 mr-1"})," ",Ee.fail]})]})]}),v==="single"&&W&&e.jsxs("div",{className:me("rounded-md p-3 text-xs space-y-2 border",W.success?"bg-green-50/50 dark:bg-green-950/10 border-green-200 dark:border-green-900":"bg-red-50/50 dark:bg-red-950/10 border-red-200 dark:border-red-900"),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[W.success?e.jsx(an,{className:"h-4 w-4 text-green-500"}):e.jsx(fs,{className:"h-4 w-4 text-red-500"}),e.jsx("span",{className:"font-medium",children:W.success?s?"Account is alive":"Tài khoản hoạt động":s?"Failed":"Thất bại"}),e.jsxs("span",{className:"ml-auto font-mono tabular-nums text-muted-foreground",children:[W.latencyMs,"ms"]})]}),W.success&&e.jsxs(e.Fragment,{children:[W.content&&e.jsx("div",{className:"bg-background/60 rounded p-2 font-mono text-[11px] break-all max-h-32 overflow-y-auto",children:W.content||e.jsx("span",{className:"text-muted-foreground italic",children:s?"(empty response)":"(phản hồi trống)"})}),W.usage&&e.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-muted-foreground tabular-nums",children:[e.jsxs("span",{children:[s?"Input":"Đầu vào",": ",W.usage.inputTokens]}),e.jsxs("span",{children:[s?"Output":"Đầu ra",": ",W.usage.outputTokens]}),e.jsxs("span",{children:["Credits: ",W.usage.credits]})]})]}),!W.success&&W.error&&e.jsxs("div",{className:"flex items-start gap-1.5 text-red-500",children:[e.jsx(Rs,{className:"h-3.5 w-3.5 flex-shrink-0 mt-0.5"}),e.jsx("span",{className:"break-all",children:W.error})]})]}),v==="selected"&&!M&&X.length>0&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2 p-2 rounded-md bg-red-50/50 dark:bg-red-950/10 border border-red-200 dark:border-red-900",children:[e.jsxs("span",{className:"text-xs text-red-600 dark:text-red-400 flex items-center gap-1",children:[e.jsx(Rs,{className:"h-3.5 w-3.5"}),s?`${X.length} failed`:`${X.length} lỗi`]}),e.jsxs("div",{className:"ml-auto flex items-center gap-1.5",children:[e.jsxs(D,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>void re(),children:[e.jsx(gr,{className:"h-3.5 w-3.5 mr-1"}),s?"Retest failed":"Test lại lỗi"]}),e.jsxs(D,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:xe,children:[e.jsx(sA,{className:"h-3.5 w-3.5 mr-1"}),s?"Mark as error":"Đánh dấu lỗi"]}),e.jsxs(D,{variant:"destructive",size:"sm",className:"h-7 text-xs",onClick:Oe,children:[e.jsx(Vt,{className:"h-3.5 w-3.5 mr-1"}),s?"Delete failed":"Xóa lỗi"]})]})]}),v==="selected"&&Ee.total>0&&e.jsx("div",{className:"space-y-1 max-h-80 overflow-y-auto",children:b.map(J=>{const Ne=q.get(J.id),et=Ne===null;return e.jsxs("div",{className:me("flex items-center gap-2 p-2 rounded-md text-xs",et&&"bg-muted/30",Ne&&Ne.success&&"bg-green-50/50 dark:bg-green-950/10",Ne&&!Ne.success&&"bg-red-50/50 dark:bg-red-950/10"),children:[e.jsxs("div",{className:"w-5 flex justify-center flex-shrink-0",children:[et&&e.jsx(bt,{className:"h-3.5 w-3.5 animate-spin text-muted-foreground"}),Ne&&Ne.success&&e.jsx(an,{className:"h-4 w-4 text-green-500"}),Ne&&!Ne.success&&e.jsx(fs,{className:"h-4 w-4 text-red-500"})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"font-medium truncate flex items-center gap-1",children:[J.email,h(J.id)&&e.jsx("span",{title:s?"bound proxy":"Đã gán proxy",children:"🔗"})]}),Ne&&Ne.success&&Ne.content&&e.jsxs("div",{className:"text-[10px] text-muted-foreground truncate font-mono",title:Ne.content,children:["→ ",Ne.content]}),Ne&&!Ne.success&&Ne.error&&e.jsx("div",{className:"text-[10px] text-red-500 truncate",title:Ne.error,children:Ne.error})]}),Ne&&e.jsxs("span",{className:"font-mono tabular-nums text-[10px] text-muted-foreground flex-shrink-0",children:[Ne.latencyMs,"ms"]}),!et&&e.jsx("button",{type:"button",onClick:()=>void z(J.id),disabled:M,title:s?"Retest this account":"Test lại tài khoản này",className:"flex-shrink-0 p-1 rounded hover:bg-background/80 text-muted-foreground hover:text-foreground transition-colors disabled:opacity-40",children:e.jsx(gr,{className:"h-3.5 w-3.5"})})]},J.id)})})]})]}),uR.map(J=>{const Ne=Et().filter(qe=>qe.category===J.id);if(Ne.length===0)return null;const et=J.icon;return e.jsxs(De,{children:[e.jsx(at,{className:"pb-2",children:e.jsxs(rt,{className:"text-sm flex items-center gap-2",children:[e.jsx(et,{className:me("h-4 w-4",J.color)}),r(J.label)]})}),e.jsx(Pe,{className:"space-y-1.5",children:Ne.map(qe=>{const Je=Ue[qe.id];return e.jsxs("div",{className:me("flex items-center gap-3 p-2 rounded-md text-xs",Je?.success&&"bg-green-50/50 dark:bg-green-950/10",Je&&!Je.success&&"bg-red-50/50 dark:bg-red-950/10",!Je&&"bg-muted/30"),children:[e.jsxs("div",{className:"w-5 flex justify-center",children:[!Je&&e.jsx("span",{className:"h-2 w-2 rounded-full bg-muted-foreground/30"}),Je?.success&&e.jsx(an,{className:"h-4 w-4 text-green-500"}),Je&&!Je.success&&e.jsx(fs,{className:"h-4 w-4 text-red-500"})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium",children:r(qe.label)}),e.jsx("div",{className:"text-[10px] text-muted-foreground truncate",title:qe.url,children:qe.url}),qe.description&&e.jsx("div",{className:"text-[10px] text-muted-foreground italic",children:r(qe.description)}),Je?.error&&e.jsxs("div",{className:"text-[10px] text-red-500 mt-0.5 flex items-start gap-1",children:[e.jsx(Rs,{className:"h-3 w-3 flex-shrink-0 mt-0.5"}),e.jsx("span",{className:"break-all",children:Je.error})]})]}),Je&&e.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground",children:[Je.httpStatus&&e.jsxs("span",{className:me("font-mono px-1.5 py-0.5 rounded",Je.httpStatus>=200&&Je.httpStatus<300&&"bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-300",Je.httpStatus>=400&&"bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-300"),children:["HTTP ",Je.httpStatus]}),Je.latencyMs!=null&&e.jsxs("span",{className:"font-mono tabular-nums",children:[Je.latencyMs,"ms"]})]})]},qe.id)})})]},J.id)})]})}const Uf=["kiro-register-ratelimit-enabled","kiro-register-ratelimit-max","kiro-register-autobackoff","kiro-register-dailyquota-limit","kiro-register-schedule-enabled","kiro-register-schedule-time","kiro-register-mixed-sources"];function mR(){const{t:n}=Ut(),s=n("common.unknown")==="Unknown",r=vt(),[i,o]=g.useState({proxyPool:!0,webhooks:!0,registerConfig:!0,registerTemplates:!0,registerSettings:!0,appSettings:!0,includeProxyCredentials:!1,encrypt:!1}),[d,u]=g.useState(""),[h,f]=g.useState(null),[p,y]=g.useState(null),b=g.useCallback(async()=>{const N={version:1,exportedAt:new Date().toISOString(),app:"krouter"};if(i.proxyPool&&r.proxyPool.size>0&&(N.proxyPool=Array.from(r.proxyPool.values()).map(I=>{const M={...I};return i.includeProxyCredentials||(delete M.password,M.url=I.url.replace(/:([^:@/]+)@/,":***@")),M}),N.proxyPoolConfig={...r.proxyPoolConfig}),i.webhooks){const I=Array.from(_n.getState().webhooks.values());N.webhooks=I.map(M=>({...M}))}if(i.registerConfig)try{const I=localStorage.getItem("kiro-register-config");I&&(N.registerConfig=JSON.parse(I))}catch{}if(i.registerTemplates)try{const I=localStorage.getItem("kiro-register-templates");I&&(N.registerTemplates=JSON.parse(I))}catch{}if(i.registerSettings){const I={};for(const M of Uf){const G=localStorage.getItem(M);G!=null&&(I[M]=G)}N.registerLocalStorage=I}i.appSettings&&(N.appSettings={theme:r.theme,darkMode:r.darkMode,language:r.language,autoRefreshEnabled:r.autoRefreshEnabled,autoRefreshInterval:r.autoRefreshInterval,autoRefreshConcurrency:r.autoRefreshConcurrency,statusCheckInterval:r.statusCheckInterval,privacyMode:r.privacyMode,usagePrecision:r.usagePrecision,autoSwitchEnabled:r.autoSwitchEnabled,autoSwitchThreshold:r.autoSwitchThreshold,autoSwitchInterval:r.autoSwitchInterval,switchTarget:r.switchTarget});let j=JSON.stringify(N,null,2),T="json";if(i.encrypt){if(!d.trim()){alert(s?"Please enter encryption password":"请输入加密密码");return}try{j=await pR(j,d),T="kcfg"}catch(I){alert(s?`Encryption failed: ${I}`:`加密失败: ${I}`);return}}f(j.length);const S=new Blob([j],{type:i.encrypt?"application/octet-stream":"application/json"}),k=URL.createObjectURL(S),R=document.createElement("a");R.href=k,R.download=`krouter-config-${new Date().toISOString().slice(0,19).replace(/[:.]/g,"-")}.${T}`,R.click(),setTimeout(()=>URL.revokeObjectURL(k),1e3)},[i,r,d,s]),v=g.useCallback(async N=>{try{let j=await N.text();if(N.name.endsWith(".kcfg")||j.startsWith("KCFG1:")){const k=prompt(s?"Enter decryption password:":"请输入解密密码:");if(!k)return;try{j=await xR(j,k)}catch(R){y({success:!1,error:`解密失败:${R instanceof Error?R.message:String(R)}`});return}}const T=JSON.parse(j);if(T.app!=="krouter"&&T.app!=="kiro-account-manager"){y({success:!1,error:"文件不是有效的 Krouter配置(app 标识不匹配)"});return}const S={};if(T.proxyPool&&T.proxyPool.length>0){let k=0;for(const R of T.proxyPool)if(typeof R.url=="string"&&!R.url.includes("***"))r.addProxy(R.url,{label:R.label,source:"import-config",tags:R.tags})&&k++;else if(R.host&&R.port){const M=`${R.protocol||"http"}://${R.host}:${R.port}`;r.addProxy(M,{label:R.label,source:"import-config-masked",tags:R.tags})&&k++}S.代理池=k}if(T.proxyPoolConfig&&r.setProxyPoolConfig(T.proxyPoolConfig),T.webhooks&&T.webhooks.length>0){const k=_n.getState();let R=0;for(const I of T.webhooks){const M=I;M.kind&&M.url&&(k.addWebhook(M),R++)}S.Webhook=R}if(T.registerConfig)try{localStorage.setItem("kiro-register-config",JSON.stringify(T.registerConfig)),S.注册配置=1}catch{}if(T.registerTemplates)try{localStorage.setItem("kiro-register-templates",JSON.stringify(T.registerTemplates)),S.注册模板=T.registerTemplates.length}catch{}if(T.registerLocalStorage){let k=0;for(const[R,I]of Object.entries(T.registerLocalStorage))if(Uf.includes(R))try{localStorage.setItem(R,I),k++}catch{}S.注册偏好=k}if(T.appSettings){const k=T.appSettings;k.theme!=null&&r.setTheme(k.theme),k.darkMode!=null&&r.setDarkMode(k.darkMode),k.language!=null&&r.setLanguage(k.language),k.autoRefreshEnabled!=null&&r.setAutoRefresh(k.autoRefreshEnabled,k.autoRefreshInterval),k.autoRefreshConcurrency!=null&&r.setAutoRefreshConcurrency(k.autoRefreshConcurrency),k.statusCheckInterval!=null&&r.setStatusCheckInterval(k.statusCheckInterval),k.privacyMode!=null&&r.setPrivacyMode(k.privacyMode),k.usagePrecision!=null&&r.setUsagePrecision(k.usagePrecision),k.autoSwitchEnabled!=null&&r.setAutoSwitch(k.autoSwitchEnabled,k.autoSwitchThreshold,k.autoSwitchInterval),k.switchTarget!=null&&(k.switchTarget==="ide"||k.switchTarget==="cli"||k.switchTarget==="both")&&r.setSwitchTarget(k.switchTarget),S["App 设置"]=1}y({success:!0,counts:S})}catch(j){y({success:!1,error:j instanceof Error?j.message:String(j)})}},[r]);return e.jsxs("div",{className:"flex-1 p-6 space-y-6 overflow-auto",children:[e.jsxs("div",{className:"page-hero p-6",children:[e.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-indigo-500/20 to-transparent rounded-full blur-2xl"}),e.jsx("div",{className:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-indigo-500/20 to-transparent rounded-full blur-2xl"}),e.jsxs("div",{className:"relative flex items-center gap-4",children:[e.jsx("div",{className:"p-3 rounded-xl bg-indigo-500 shadow-lg shadow-indigo-500/25",children:e.jsx(ON,{className:"h-6 w-6 text-white"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-indigo-600 dark:text-indigo-400",children:s?"Config Sync":"配置同步"}),e.jsx("p",{className:"text-muted-foreground",children:s?"Export & import non-sensitive app config (proxy pool, webhooks, register templates, app preferences) for multi-device sync.":"导出/导入非敏感配置(代理池、Webhook、注册模板、应用偏好),用于多设备同步"})]})]})]}),e.jsx(De,{className:"border-amber-200 dark:border-amber-800 bg-amber-50/30 dark:bg-amber-950/10",children:e.jsxs(Pe,{className:"py-3 flex items-start gap-2",children:[e.jsx(xc,{className:"h-4 w-4 text-amber-600 flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-xs space-y-1",children:[e.jsx("p",{className:"font-medium text-amber-700 dark:text-amber-300",children:s?"Security Notice":"安全提示"}),e.jsx("p",{className:"text-muted-foreground",children:s?'This export does NOT include account credentials, refresh tokens, or other sensitive secrets — use "Account Export" (under Accounts page) for those.':'本页导出"不包含"账号凭据、Refresh Token 等敏感数据。账号导出请走"账户管理 → 导出"专用通道。'}),e.jsx("p",{className:"text-muted-foreground",children:s?'Tip: keep "Include proxy credentials" OFF when sharing the file with others.':'提示:分享给他人时,建议关闭"包含代理密码"选项,密码会被打码。'})]})]})}),e.jsxs(De,{className:"hover-lift",children:[e.jsx(at,{className:"pb-3",children:e.jsxs(rt,{className:"text-base flex items-center gap-2",children:[e.jsx(Ns,{className:"h-4 w-4 text-primary"}),s?"Export":"导出"]})}),e.jsxs(Pe,{className:"space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[e.jsx($l,{label:`${s?"Proxy Pool":"代理池"} (${r.proxyPool.size})`,checked:i.proxyPool,onChange:N=>o(j=>({...j,proxyPool:N}))}),e.jsx($l,{label:`${s?"Webhooks":"Webhook"} (${_n.getState().webhooks.size})`,checked:i.webhooks,onChange:N=>o(j=>({...j,webhooks:N}))}),e.jsx($l,{label:s?"Register Config":"注册配置",checked:i.registerConfig,onChange:N=>o(j=>({...j,registerConfig:N}))}),e.jsx($l,{label:s?"Register Templates":"注册模板",checked:i.registerTemplates,onChange:N=>o(j=>({...j,registerTemplates:N}))}),e.jsx($l,{label:s?"Register Preferences":"注册偏好(限速/定时/配额等)",checked:i.registerSettings,onChange:N=>o(j=>({...j,registerSettings:N}))}),e.jsx($l,{label:s?"App Settings (theme/lang/auto-refresh)":"App 设置(主题/语言/自动刷新)",checked:i.appSettings,onChange:N=>o(j=>({...j,appSettings:N}))})]}),e.jsxs("div",{className:"border-t pt-3 flex items-center gap-3 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(is,{checked:i.includeProxyCredentials,onCheckedChange:N=>o(j=>({...j,includeProxyCredentials:N}))}),e.jsxs(Fe,{className:"text-xs cursor-pointer flex items-center gap-1.5",children:[i.includeProxyCredentials?e.jsx(Rs,{className:"h-3.5 w-3.5 text-amber-500"}):e.jsx(xc,{className:"h-3.5 w-3.5 text-muted-foreground"}),s?"Include proxy credentials (NOT recommended for sharing)":"包含代理密码(分享时不建议)"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(is,{checked:i.encrypt,onCheckedChange:N=>o(j=>({...j,encrypt:N}))}),e.jsxs(Fe,{className:"text-xs cursor-pointer flex items-center gap-1.5",children:[e.jsx(xc,{className:"h-3.5 w-3.5 text-green-500"}),s?"Encrypt (AES-GCM)":"加密导出 (AES-GCM)"]})]}),i.encrypt&&e.jsx("input",{type:"password",value:d,onChange:N=>u(N.target.value),placeholder:s?"Password...":"加密密码...",className:"h-8 px-2 rounded-md border bg-background text-xs flex-1 max-w-xs"}),e.jsxs(D,{className:"ml-auto",onClick:b,disabled:i.encrypt&&!d.trim(),children:[e.jsx(VN,{className:"h-4 w-4 mr-2"}),s?"Export":"导出"]})]}),h!==null&&e.jsx("p",{className:"text-[10px] text-muted-foreground",children:s?`Last export: ${(h/1024).toFixed(1)} KB`:`上次导出大小: ${(h/1024).toFixed(1)} KB`})]})]}),e.jsxs(De,{className:"hover-lift",children:[e.jsx(at,{className:"pb-3",children:e.jsxs(rt,{className:"text-base flex items-center gap-2",children:[e.jsx(Fa,{className:"h-4 w-4 text-primary"}),s?"Import":"导入"]})}),e.jsxs(Pe,{className:"space-y-3",children:[e.jsx(Fe,{className:"text-xs",children:s?"Choose a previously exported config JSON. Duplicates will be merged/skipped automatically.":"选择之前导出的配置 JSON 文件。重复项会自动合并/跳过。"}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("input",{type:"file",accept:"application/json,.json",className:"text-xs",onChange:N=>{const j=N.target.files?.[0];j&&v(j),N.currentTarget.value=""}})}),p&&e.jsx("div",{className:`p-3 rounded-lg border ${p.success?"border-green-200 dark:border-green-800 bg-green-50/50 dark:bg-green-950/10":"border-red-200 dark:border-red-800 bg-red-50/50 dark:bg-red-950/10"}`,children:p.success?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-green-700 dark:text-green-300",children:[e.jsx(an,{className:"h-4 w-4"}),s?"Import Successful":"导入成功"]}),p.counts&&e.jsx("div",{className:"mt-2 grid grid-cols-2 gap-1 text-xs",children:Object.entries(p.counts).map(([N,j])=>e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:N}),e.jsx("span",{className:"font-mono tabular-nums",children:j})]},N))})]}):e.jsxs("div",{className:"flex items-start gap-2 text-sm text-red-700 dark:text-red-300",children:[e.jsx(Rs,{className:"h-4 w-4 flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:s?"Import Failed":"导入失败"}),e.jsx("div",{className:"text-xs mt-0.5",children:p.error})]})]})})]})]}),e.jsxs(De,{className:"border-red-200 dark:border-red-800",children:[e.jsx(at,{className:"pb-3",children:e.jsxs(rt,{className:"text-sm flex items-center gap-2 text-red-600",children:[e.jsx(Vt,{className:"h-4 w-4"}),s?"Danger Zone":"危险操作"]})}),e.jsx(Pe,{className:"space-y-2",children:e.jsxs(D,{variant:"outline",size:"sm",className:"text-red-600 border-red-200 hover:bg-red-50 dark:hover:bg-red-950/20",onClick:()=>{if(confirm(s?"Reset register page preferences (rate limit / schedule / quota / mixed sources / blacklist / templates)? This does NOT affect accounts.":"重置注册页所有偏好(限速/定时/配额/混合源/黑名单/模板)?不影响账号数据。")){for(const N of Uf)localStorage.removeItem(N);localStorage.removeItem("kiro-register-templates"),localStorage.removeItem("kiro-register-email-blacklist"),alert(s?"Done. Please reload the page.":"已重置,请刷新页面")}},children:[e.jsx(Mt,{className:"h-3.5 w-3.5 mr-1.5"}),s?"Reset Register Preferences":"重置注册页偏好"]})})]})]})}function $l({label:n,checked:s,onChange:r}){return e.jsxs("label",{className:"flex items-center gap-2 p-2 rounded hover:bg-muted/40 cursor-pointer",children:[e.jsx(is,{checked:s,onCheckedChange:r}),e.jsx("span",{className:"text-sm",children:n})]})}const Rp="KCFG1:",fR=1e5;async function lw(n,s){const r=new TextEncoder,i=await crypto.subtle.importKey("raw",r.encode(n).slice().buffer,{name:"PBKDF2"},!1,["deriveKey"]);return crypto.subtle.deriveKey({name:"PBKDF2",salt:s.slice().buffer,iterations:fR,hash:"SHA-256"},i,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}function $f(n){const s=n instanceof Uint8Array?n:new Uint8Array(n);let r="";for(let i=0;i<s.length;i++)r+=String.fromCharCode(s[i]);return btoa(r)}function Bf(n){const s=atob(n),r=new Uint8Array(s.length);for(let i=0;i<s.length;i++)r[i]=s.charCodeAt(i);return r}async function pR(n,s){const r=crypto.getRandomValues(new Uint8Array(16)),i=crypto.getRandomValues(new Uint8Array(12)),o=await lw(s,r),d=new TextEncoder().encode(n),u=await crypto.subtle.encrypt({name:"AES-GCM",iv:i.slice().buffer},o,d.slice().buffer);return`${Rp}${$f(r)}.${$f(i)}.${$f(u)}`}async function xR(n,s){if(!n.startsWith(Rp))throw new Error("Not an encrypted KCFG payload");const r=n.slice(Rp.length).split(".");if(r.length!==3)throw new Error("Invalid encrypted payload format");const[i,o,d]=r,u=Bf(i),h=Bf(o),f=Bf(d),p=await lw(s,u),y=await crypto.subtle.decrypt({name:"AES-GCM",iv:h.slice().buffer},p,f.slice().buffer);return new TextDecoder().decode(y)}const oj={maxPerMinute:10,burst:3,windowSec:120,successRateThreshold:.5,minSamples:5,consecutiveFailureThreshold:3,backoffBaseMs:8e3,backoffMaxMs:12e4};function gR(n={}){const s={config:{...oj,...n},lastRefillTime:Date.now(),tokens:n.burst??oj.burst,events:[],consecutiveFailures:0,backoffEndAt:0};function r(){const o=Date.now(),d=o-s.lastRefillTime;if(d<=0)return;const u=s.config.maxPerMinute/6e4;s.tokens=Math.min(s.config.burst,s.tokens+d*u),s.lastRefillTime=o}function i(){const o=Date.now()-s.config.windowSec*1e3;for(;s.events.length>0&&s.events[0][0]<o;)s.events.shift()}return{waitForSlot:async o=>{for(;;){if(o?.aborted)return;const d=Date.now();if(s.backoffEndAt>d){const p=Math.min(s.backoffEndAt-d,1e3);await new Promise(y=>setTimeout(y,p));continue}if(r(),s.tokens>=1){s.tokens-=1;return}const u=s.config.maxPerMinute/6e4,h=1-s.tokens,f=Math.max(50,Math.min(2e3,h/u));await new Promise(p=>setTimeout(p,f))}},reportResult:o=>{const d=Date.now();if(s.events.push([d,o]),i(),o)s.consecutiveFailures=0;else if(s.consecutiveFailures+=1,s.consecutiveFailures>=s.config.consecutiveFailureThreshold){const u=s.consecutiveFailures-s.config.consecutiveFailureThreshold+1,h=Math.min(s.config.backoffBaseMs*Math.pow(2,u-1),s.config.backoffMaxMs);s.backoffEndAt=d+h}},snapshot:()=>{r(),i();const o=Date.now();let d=0,u=0;for(const[,v]of s.events)v?d++:u++;const h=d+u,f=h>0?d/h:1,y=h>=s.config.minSamples&&f<s.config.successRateThreshold,b=s.config.windowSec>0?d*60/s.config.windowSec:0;return{availableTokens:Math.floor(s.tokens),windowSuccess:d,windowFailed:u,successRate:f,consecutiveFailures:s.consecutiveFailures,backoffRemainingMs:Math.max(0,s.backoffEndAt-o),riskWarning:y,throughputPerMinute:Math.round(b*10)/10}},updateConfig:o=>{s.config={...s.config,...o}},reset:()=>{s.events=[],s.consecutiveFailures=0,s.backoffEndAt=0,s.tokens=s.config.burst,s.lastRefillTime=Date.now()}}}function yR(n){if(!n.credentials?.accessToken)return{eligible:!1,reason:"no-token"};const s=(n.subscription?.type||"").toUpperCase(),r=(n.subscription?.title||"").toUpperCase(),i=s.includes("FREE")||r.includes("FREE")||!s&&!r;if(s.includes("PRO")||s.includes("ENTERPRISE")||s.includes("TEAMS")||r.includes("PRO")||r.includes("ENTERPRISE")||r.includes("TEAMS"))return{eligible:!1,reason:"already-pro",detail:n.subscription?.title||n.subscription?.type};if(!i)return{eligible:!1,reason:"unknown-status",detail:n.subscription?.title||n.subscription?.type||"未检测"};const d=(n.lastError||"").toLowerCase();if(n.status==="error"&&(d.includes("suspended")||d.includes("封禁")||d.includes("temporarily")))return{eligible:!1,reason:"banned",detail:n.lastError};const h=n.subscription?.upgradeCapability;return h&&h.toUpperCase().includes("NOT")?{eligible:!1,reason:"cant-upgrade",detail:h}:{eligible:!0,reason:"ok"}}let ti=[],$u=null;function bR(n){ti=[...ti,n],$u?.(ti)}function _f(n,s){ti=ti.map(r=>r.accountId===n?{...r,...s}:r),$u?.(ti)}let cj=[],dj="",uj=new Set,hj="overage",mj=[],fj=10;function ow(n){const s=[];for(const r of n.split(/\r?\n/)){const i=r.trim();if(!i)continue;const o=i.match(/https?:\/\/[^\s,|]+/i);if(!o||o.index===void 0)continue;const d=o[0].replace(/[)\]}>.,;'"]+$/,""),h=i.slice(0,o.index).trim().match(/[^\s,|<>"']+@[^\s,|<>"']+\.[^\s,|<>"']+/);s.push({email:h?h[0]:"",url:d})}return s}function vR(){const{accounts:n,selectedIds:s,updateAccount:r}=vt(),{actualLanguage:i}=Ut(),o=i==="en",[d,u]=g.useState(hj),h=_=>{hj=_,u(_)},[f,p]=g.useState(ti),[y,b]=g.useState(!1),[v,N]=g.useState(uj),[j,T]=g.useState(!1),[S,k]=g.useState(fj),[R,I]=g.useState(0),M=_=>{fj=_,k(_)},[G,W]=g.useState(cj),[U,q]=g.useState(dj),[V,le]=g.useState(!1),[B,be]=g.useState(mj),[K,se]=g.useState(!1),te=g.useRef(null),Y=_=>{p(ce=>{const Ce=typeof _=="function"?_(ce):_;return ti=Ce,Ce})},P=_=>{N(ce=>{const Ce=typeof _=="function"?_(ce):_;return uj=Ce,Ce})},F=_=>{cj=_,W(_)},fe=_=>{dj=_,q(_)},pe=_=>{be(ce=>{const Ce=typeof _=="function"?_(ce):_;return mj=Ce,Ce})};g.useEffect(()=>($u=p,()=>{$u=null}),[]),g.useEffect(()=>{const _=te.current;_&&(_.scrollTop=_.scrollHeight)},[B]);const C=g.useCallback(()=>(s.size>0?Array.from(s).map(ce=>n.get(ce)).filter(Boolean):Array.from(n.values())).filter(ce=>{if(!ce)return!1;const Ce=(ce.subscription?.type||"").toUpperCase(),Ve=(ce.subscription?.title||"").toUpperCase(),je=Ce.includes("FREE")||Ve.includes("FREE")||!Ce&&!Ve,He=!!ce.credentials?.accessToken;return je&&He}),[n,s]),z=g.useMemo(()=>{const _=s.size>0?Array.from(s).map(je=>n.get(je)).filter(Boolean):Array.from(n.values()),ce=[],Ce=[];for(const je of _){if(!je)continue;const He=yR(je);He.eligible?ce.push(je):Ce.push({account:je,reason:He.reason,detail:He.detail})}const Ve={ok:ce.length,"no-token":0,"already-pro":0,banned:0,"cant-upgrade":0,"unknown-status":0};for(const je of Ce)Ve[je.reason]++;return{eligible:ce,blocked:Ce,reasonBuckets:Ve,totalScanned:_.length}},[n,s]),X=async()=>{const _=C();if(_.length===0)return;le(!0);const ce=_[0];try{const Ce=await window.api.accountGetSubscriptions(ce.credentials.accessToken,ce.credentials?.region,ce.profileArn,ce.machineId,ce.credentials?.provider||ce.idp,ce.credentials?.authMethod,ce.id);if(Ce.success&&Ce.plans&&Ce.plans.length>0){F(Ce.plans);const Ve=Ce.plans.find(je=>je.qSubscriptionType?.toUpperCase().includes("PRO")&&!je.qSubscriptionType?.toUpperCase().includes("PLUS"))||Ce.plans[0];fe(Ve.qSubscriptionType)}}catch(Ce){console.error("[SubscriptionPage] Failed to load plans:",Ce)}le(!1)},[re,xe]=g.useState(5),Oe=async()=>{const _=C();if(_.length===0||!U)return;b(!0);const ce=_.map(H=>({accountId:H.id,email:H.email||"Unknown",status:"pending"}));Y(ce),P(new Set);const Ce=async H=>{const Se=_[H];Y(Xe=>Xe.map((Nt,nt)=>nt===H?{...Nt,status:"loading"}:Nt));try{const Xe=await window.api.accountGetSubscriptionUrl(Se.credentials.accessToken,U,Se.credentials?.region,Se.profileArn,Se.machineId,Se.credentials?.provider||Se.idp,Se.credentials?.authMethod,Se.id);Xe.success&&Xe.url?Y(Nt=>Nt.map((nt,$t)=>$t===H?{...nt,status:"success",url:Xe.url,generatedAt:Date.now(),validated:!1}:nt)):Y(Nt=>Nt.map((nt,$t)=>$t===H?{...nt,status:"error",error:Xe.error||"Failed to get URL"}:nt))}catch(Xe){Y(Nt=>Nt.map((nt,$t)=>$t===H?{...nt,status:"error",error:Xe instanceof Error?Xe.message:"Unknown error"}:nt))}},Ve=Array.from({length:_.length},(H,Se)=>Se);let je=0;const He=async()=>{for(;je<Ve.length;){const H=je++;await Ce(H)}},Tt=Array.from({length:Math.min(re,Ve.length)},()=>He());await Promise.all(Tt),b(!1)},Ee=_=>{P(ce=>{const Ce=new Set(ce);return Ce.has(_)?Ce.delete(_):Ce.add(_),Ce})},Qe=()=>{v.size===f.length&&f.length>0?P(new Set):P(new Set(f.map(_=>_.accountId)))},_e=()=>{P(_=>{const ce=new Set;for(const Ce of f)_.has(Ce.accountId)||ce.add(Ce.accountId);return ce})},st=()=>{P(new Set)},oe=_=>{P(ce=>{const Ce=new Set(ce);for(const Ve of f)Ve.status===_&&Ce.add(Ve.accountId);return Ce})},ue=()=>{const _=f.filter(Ve=>Ve.status==="success"&&Ve.url),ce=Math.max(1,S),Ce=_.slice(0,ce);P(new Set(Ce.map(Ve=>Ve.accountId))),I(Ce.length)},ae=()=>{const _=f.filter(je=>je.status==="success"&&je.url);if(_.length===0)return;const ce=Math.max(1,S);let Ce=R;Ce>=_.length&&(Ce=0);const Ve=_.slice(Ce,Ce+ce);P(new Set(Ve.map(je=>je.accountId))),I(Ce+Ve.length)},L=_=>{const ce=ow(_);if(ce.length===0)return 0;const Ce=new Set(f.map(Tt=>Tt.url).filter(Boolean)),Ve=Date.now(),je=[];let He=f.length;for(const{email:Tt,url:H}of ce)Ce.has(H)||(Ce.add(H),He++,je.push({accountId:`import-${Oi()}`,email:Tt||(o?`(Imported #${He})`:`(导入 #${He})`),status:"success",url:H,generatedAt:Ve,validated:!1}));return je.length>0&&Y(Tt=>[...Tt,...je]),je.length},we=()=>{v.size!==0&&confirm(o?`Remove ${v.size} selected links from the list?`:`从列表移除选中的 ${v.size} 个链接?`)&&(Y(_=>_.filter(ce=>!v.has(ce.accountId))),P(new Set))},Ue=()=>{const _=f.filter(ce=>ce.status==="error"||ce.status==="expired").length;_!==0&&confirm(o?`Remove ${_} failed/expired links?`:`移除 ${_} 个失败/过期的链接?`)&&Y(ce=>{const Ce=ce.filter(je=>je.status!=="error"&&je.status!=="expired"),Ve=ce.filter(je=>je.status==="error"||je.status==="expired").map(je=>je.accountId);return Ve.length>0&&P(je=>{const He=new Set(je);for(const Tt of Ve)He.delete(Tt);return He}),Ce})},Lt=_=>{const ce=f.filter(Ce=>Ce.status==="success"&&Ce.url);return _==="selected"?ce.filter(Ce=>v.has(Ce.accountId)):ce},xt=async _=>{await window.api.openSubscriptionWindow(_)},Qt=async _=>{if(!U){alert(o?"Please select a plan first":"请先选择计划");return}const ce=n.get(_);if(!(!ce||!ce.credentials?.accessToken)){Y(Ce=>Ce.map(Ve=>Ve.accountId===_?{...Ve,status:"loading",error:void 0}:Ve));try{const Ce=await window.api.accountGetSubscriptionUrl(ce.credentials.accessToken,U,ce.credentials?.region,ce.profileArn,ce.machineId,ce.credentials?.provider||ce.idp,ce.credentials?.authMethod,ce.id);Y(Ve=>Ve.map(je=>je.accountId===_?Ce.success&&Ce.url?{...je,status:"success",url:Ce.url,error:void 0,generatedAt:Date.now(),validated:!1}:{...je,status:"error",error:Ce.error||"Failed"}:je))}catch(Ce){Y(Ve=>Ve.map(je=>je.accountId===_?{...je,status:"error",error:Ce instanceof Error?Ce.message:"Unknown error"}:je))}}},[ft,Et]=g.useState(!1),Ge=async()=>{Et(!0);try{const _=f.filter(nt=>nt.status==="success"&&nt.url),ce=900*1e3,Ce=Date.now(),Ve={},je=_.filter(nt=>(nt.generatedAt?Ce-nt.generatedAt:Number.POSITIVE_INFINITY)>ce?(Ve[nt.accountId]="expired",!1):!0);let He=0;const Tt=async()=>{for(;He<je.length;){const nt=He++,$t=je[nt];if($t.url)try{const Bt=await window.api.diagnoseHttpProbe({url:$t.url,method:"HEAD",timeoutMs:6e3});Ve[$t.accountId]=Bt.success||Bt.status!==void 0&&Bt.status<400?"success":"expired"}catch{Ve[$t.accountId]="expired"}}},H=Array.from({length:Math.min(re,je.length)},()=>Tt());await Promise.all(H);const Se=f.map(nt=>{const $t=Ve[nt.accountId];return $t?$t==="expired"?{...nt,status:"expired",error:"链接已失效(HTTP 探测失败或超过 15 分钟)"}:{...nt,validated:!0}:nt});Y(Se);const Xe=Se.filter(nt=>nt.status==="expired").length,Nt=Se.filter(nt=>nt.status==="success"&&nt.validated).length;gt(`[Validate] 检测完成:${Nt} 个有效,${Xe} 个失效`)}finally{Et(!1)}};function gt(_){console.log(`[SubscriptionPage] ${_}`)}const Ze=async _=>{const ce=Lt(_);await Promise.all(ce.filter(Ce=>Ce.url).map(Ce=>window.api.openSubscriptionWindow(Ce.url)))},J=async _=>{await navigator.clipboard.writeText(_)},Ne=async _=>{const Ce=Lt(_).map(Ve=>Ve.url).join(`
|
|
129
|
+
`);await navigator.clipboard.writeText(Ce)},et=g.useCallback(()=>qe().filter(_=>_&&_.subscription?.overageCapability==="OVERAGE_CAPABLE"&&_.usage?.resourceDetail?.overageEnabled!==!0),[n,s]),qe=g.useCallback(()=>(s.size>0?Array.from(s).map(ce=>n.get(ce)).filter(Boolean):Array.from(n.values())).filter(ce=>{if(!ce)return!1;const Ce=!!ce.credentials?.accessToken,Ve=(ce.subscription?.type||"").toUpperCase(),je=(ce.subscription?.title||"").toUpperCase(),He=Ve.includes("PRO")||Ve.includes("ENTERPRISE")||Ve.includes("TEAMS")||je.includes("PRO")||je.includes("ENTERPRISE")||je.includes("TEAMS");return Ce&&He}),[n,s]),Je=async _=>{const ce=_??et();if(ce.length===0)return;se(!0);const Ce=ce.map(H=>({accountId:H.id,email:H.email||"Unknown",status:"pending"}));pe(Ce);const Ve=async H=>{const Se=ce[H];pe(Xe=>Xe.map((Nt,nt)=>nt===H?{...Nt,status:"loading"}:Nt));try{const Xe=await window.api.accountSetOverage(Se.credentials.accessToken,"ENABLED",Se.credentials?.region,Se.profileArn,Se.machineId,Se.credentials?.provider||Se.idp,Se.credentials?.authMethod,Se.id);if(Xe.success){pe(nt=>nt.map(($t,Bt)=>Bt===H?{...$t,status:"success"}:$t));const Nt=n.get(Se.id);Nt&&r(Se.id,{usage:{...Nt.usage,resourceDetail:{...Nt.usage?.resourceDetail,overageEnabled:!0}}})}else pe(Nt=>Nt.map((nt,$t)=>$t===H?{...nt,status:"error",error:Xe.error||"Unknown error"}:nt))}catch(Xe){pe(Nt=>Nt.map((nt,$t)=>$t===H?{...nt,status:"error",error:Xe instanceof Error?Xe.message:"Unknown error"}:nt))}};let je=0;const He=async()=>{for(;je<ce.length;){const H=je++;await Ve(H)}},Tt=Array.from({length:Math.min(re,ce.length)},()=>He());await Promise.all(Tt),se(!1)},Kt=et().length,Ye=qe().length,qt=B.filter(_=>_.status==="success").length,Jt=B.filter(_=>_.status==="error").length,Ct=f.filter(_=>_.status==="success").length,O=f.filter(_=>_.status==="error").length,ne=v.size,ze=C().length;return e.jsxs("div",{className:"flex-1 p-6 space-y-6 overflow-auto",children:[e.jsxs("div",{className:"page-hero p-6",children:[e.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-primary/20 to-transparent rounded-full blur-2xl"}),e.jsx("div",{className:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-primary/20 to-transparent rounded-full blur-2xl"}),e.jsxs("div",{className:"relative flex items-center gap-4",children:[e.jsx("div",{className:"p-3 rounded-xl bg-primary/10",children:e.jsx($a,{className:"h-7 w-7 text-primary"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-primary",children:o?"Batch Subscription":"批量订阅"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.size>0?o?`Using ${s.size} selected accounts`:`使用已选中的 ${s.size} 个账户`:o?"Using all accounts":"使用全部账户"})]})]})]}),e.jsxs("div",{className:"flex gap-1 p-1 bg-muted rounded-lg w-fit",children:[e.jsxs("button",{onClick:()=>h("overage"),className:me("px-4 py-1.5 rounded-md text-sm font-medium transition-colors flex items-center gap-1.5",d==="overage"?"bg-background shadow text-foreground":"text-muted-foreground hover:text-foreground"),children:[e.jsx(Ds,{className:"h-4 w-4"}),o?"Overage Settings":"超额设置"]}),e.jsxs("button",{onClick:()=>h("links"),className:me("px-4 py-1.5 rounded-md text-sm font-medium transition-colors flex items-center gap-1.5",d==="links"?"bg-background shadow text-foreground":"text-muted-foreground hover:text-foreground"),children:[e.jsx($a,{className:"h-4 w-4"}),o?"Subscription Links":"获取链接"]}),e.jsxs("button",{onClick:()=>h("manage"),className:me("px-4 py-1.5 rounded-md text-sm font-medium transition-colors flex items-center gap-1.5",d==="manage"?"bg-background shadow text-foreground":"text-muted-foreground hover:text-foreground"),children:[e.jsx(Ap,{className:"h-4 w-4"}),o?"Manage Subscriptions":"订阅管理"]})]}),d==="overage"&&e.jsxs(e.Fragment,{children:[e.jsx(De,{children:e.jsxs(Pe,{className:"py-3 flex items-center gap-2 flex-wrap",children:[e.jsxs(D,{size:"sm",onClick:()=>Je(),disabled:K||Kt===0,children:[K?e.jsx(bt,{className:"h-4 w-4 mr-1 animate-spin"}):e.jsx(Ds,{className:"h-4 w-4 mr-1"}),o?`Enable Overage (${Kt})`:`一键超额 (${Kt})`]}),e.jsxs(D,{size:"sm",variant:"outline",onClick:()=>Je(qe()),disabled:K||Ye===0,children:[K?e.jsx(bt,{className:"h-4 w-4 mr-1 animate-spin"}):e.jsx(Ds,{className:"h-4 w-4 mr-1"}),o?`Set All (${Ye})`:`全部设置 (${Ye})`]}),e.jsxs(D,{variant:"ghost",size:"sm",onClick:()=>pe([]),disabled:K||B.length===0,children:[e.jsx(Vt,{className:"h-4 w-4 mr-1"}),o?"Clear":"清空"]}),e.jsxs(D,{variant:"ghost",size:"sm",onClick:()=>pe(_=>_.filter(ce=>ce.status!=="error")),disabled:K||Jt===0,title:o?"Remove failed items only":"仅移除失败项",children:[e.jsx(fs,{className:"h-4 w-4 mr-1"}),o?`Clear Failed (${Jt})`:`清失败 (${Jt})`]}),e.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[e.jsx("span",{className:"text-muted-foreground",children:o?"Concurrency:":"并发:"}),e.jsx("input",{type:"number",min:1,max:100,value:re,onChange:_=>{const ce=parseInt(_.target.value,10);ce>0&&xe(ce)},disabled:K,className:"h-7 w-14 px-1.5 rounded border border-border bg-background text-xs text-center"})]}),e.jsx("span",{className:"text-xs text-muted-foreground ml-2",children:Kt>0?o?`${Kt} subscribed accounts without overage enabled`:`${Kt} 个已订阅账号未开启超额`:o?"No accounts need overage enablement":"没有需要开启超额的账号"}),B.length>0&&e.jsxs("div",{className:"ml-auto flex items-center gap-3 text-xs text-muted-foreground",children:[qt>0&&e.jsxs("span",{className:"flex items-center gap-1 text-green-600",children:[e.jsx(Bn,{className:"h-3 w-3"})," ",qt]}),Jt>0&&e.jsxs("span",{className:"flex items-center gap-1 text-red-500",children:[e.jsx(fs,{className:"h-3 w-3"})," ",Jt]}),K&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(bt,{className:"h-3 w-3 animate-spin"}),B.filter(_=>_.status==="pending"||_.status==="loading").length]})]})]})}),B.length>0&&e.jsx(De,{children:e.jsxs(Pe,{className:"py-2",children:[e.jsxs("div",{className:"flex items-center gap-3 py-2 px-2 border-b text-xs font-medium text-muted-foreground",children:[e.jsx("span",{className:"w-8 text-center",children:"#"}),e.jsx("span",{className:"flex-1",children:o?"Email":"邮箱"}),e.jsx("span",{className:"w-20 text-center",children:o?"Status":"状态"}),e.jsx("span",{className:"flex-1 text-right",children:o?"Details":"详情"})]}),e.jsx("div",{ref:te,className:"max-h-[60vh] overflow-y-auto",children:B.map((_,ce)=>e.jsxs("div",{className:"flex items-center gap-3 py-2 px-2 border-b last:border-b-0 hover:bg-muted/50 transition-colors",children:[e.jsx("span",{className:"w-8 text-center text-xs text-muted-foreground",children:ce+1}),e.jsx("span",{className:"flex-1 text-sm truncate",title:_.email,children:_.email}),e.jsxs("span",{className:"w-20 flex justify-center",children:[_.status==="pending"&&e.jsx("span",{className:"text-xs text-muted-foreground",children:o?"Pending":"等待中"}),_.status==="loading"&&e.jsx(bt,{className:"h-4 w-4 animate-spin text-blue-500"}),_.status==="success"&&e.jsx(Bn,{className:"h-4 w-4 text-green-500"}),_.status==="error"&&e.jsx(fs,{className:"h-4 w-4 text-red-500"}),_.status==="skipped"&&e.jsx("span",{className:"text-xs text-muted-foreground",children:o?"Skipped":"跳过"})]}),e.jsxs("span",{className:"flex-1 text-right text-xs truncate",children:[_.status==="success"&&e.jsx("span",{className:"text-green-600",children:o?"Overage enabled":"超额已开启"}),_.status==="error"&&e.jsx("span",{className:"text-red-500",title:_.error,children:_.error})]})]},_.accountId))})]})}),B.length===0&&e.jsx(De,{children:e.jsxs(Pe,{className:"py-2",children:[e.jsxs("div",{className:"flex items-center gap-3 py-2 px-2 border-b text-xs font-medium text-muted-foreground",children:[e.jsx("span",{className:"w-8 text-center",children:"#"}),e.jsx("span",{className:"flex-1",children:o?"Email":"邮箱"}),e.jsx("span",{className:"w-24 text-center",children:o?"Subscription":"订阅类型"}),e.jsx("span",{className:"w-24 text-center",children:o?"Overage Capable":"超额能力"}),e.jsx("span",{className:"w-24 text-center",children:o?"Overage Status":"超额状态"})]}),Ye>0?e.jsx("div",{className:"max-h-[60vh] overflow-y-auto",children:qe().map((_,ce)=>{if(!_)return null;const Ce=_.subscription?.overageCapability==="OVERAGE_CAPABLE",Ve=_.usage?.resourceDetail?.overageEnabled===!0;return e.jsxs("div",{className:"flex items-center gap-3 py-2 px-2 border-b last:border-b-0 hover:bg-muted/50 transition-colors",children:[e.jsx("span",{className:"w-8 text-center text-xs text-muted-foreground",children:ce+1}),e.jsx("span",{className:"flex-1 text-sm truncate",title:_.email,children:_.email}),e.jsx("span",{className:"w-24 text-center text-xs",children:_.subscription?.title||_.subscription?.type||"-"}),e.jsx("span",{className:"w-24 flex justify-center",children:Ce?e.jsx(Bn,{className:"h-4 w-4 text-green-500"}):e.jsx(fs,{className:"h-4 w-4 text-muted-foreground/40"})}),e.jsx("span",{className:"w-24 flex justify-center",children:Ve?e.jsx("span",{className:"text-xs text-green-600 font-medium",children:o?"ENABLED":"已开启"}):Ce?e.jsx("span",{className:"text-xs text-amber-500 font-medium",children:o?"DISABLED":"未开启"}):e.jsx("span",{className:"text-xs text-muted-foreground",children:"-"})})]},_.id)})}):e.jsxs("div",{className:"py-12 text-center text-muted-foreground",children:[e.jsx(Ds,{className:"h-12 w-12 mx-auto mb-3 opacity-30"}),e.jsx("p",{className:"text-sm",children:o?"No subscribed accounts found. Ensure accounts are checked first.":"未找到已订阅账号。请先检测账号状态。"})]})]})})]}),d==="manage"&&e.jsx(NR,{getAllSubscribed:qe,updateAccount:r,concurrency:re,isEn:o}),!1,d==="links"&&e.jsxs(e.Fragment,{children:[z.totalScanned>0&&e.jsx(De,{className:me(z.eligible.length===0&&"border-amber-200 dark:border-amber-800 bg-amber-50/50 dark:bg-amber-950/10"),children:e.jsxs(Pe,{className:"py-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ap,{className:"h-4 w-4 text-primary"}),e.jsx("span",{className:"text-sm font-medium",children:o?"Pre-flight Check":"升级预检"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:o?`Scanned ${z.totalScanned} accounts: ${z.eligible.length} eligible, ${z.blocked.length} blocked`:`扫描 ${z.totalScanned} 个账号:${z.eligible.length} 可升级,${z.blocked.length} 不可升级`})]}),z.blocked.length>0&&e.jsxs("div",{className:"flex flex-wrap gap-1.5 text-[10px]",children:[z.reasonBuckets["already-pro"]>0&&e.jsxs("span",{className:"px-2 py-0.5 rounded bg-green-100 dark:bg-green-900/40 text-green-700 dark:text-green-300 inline-flex items-center gap-1",children:[e.jsx(Bn,{className:"h-2.5 w-2.5"}),o?`Already subscribed: ${z.reasonBuckets["already-pro"]}`:`已订阅 ${z.reasonBuckets["already-pro"]}`]}),z.reasonBuckets["no-token"]>0&&e.jsxs("span",{className:"px-2 py-0.5 rounded bg-muted text-muted-foreground inline-flex items-center gap-1",children:[e.jsx(fs,{className:"h-2.5 w-2.5"}),o?`No token: ${z.reasonBuckets["no-token"]}`:`无 Token ${z.reasonBuckets["no-token"]}`]}),z.reasonBuckets.banned>0&&e.jsxs("span",{className:"px-2 py-0.5 rounded bg-red-100 dark:bg-red-900/40 text-red-700 dark:text-red-300 inline-flex items-center gap-1",children:[e.jsx(jc,{className:"h-2.5 w-2.5"}),o?`Banned: ${z.reasonBuckets.banned}`:`已封禁 ${z.reasonBuckets.banned}`]}),z.reasonBuckets["cant-upgrade"]>0&&e.jsxs("span",{className:"px-2 py-0.5 rounded bg-amber-100 dark:bg-amber-900/40 text-amber-700 dark:text-amber-300 inline-flex items-center gap-1",children:[e.jsx(Rs,{className:"h-2.5 w-2.5"}),o?`Can't upgrade: ${z.reasonBuckets["cant-upgrade"]}`:`不可升级 ${z.reasonBuckets["cant-upgrade"]}`]}),z.reasonBuckets["unknown-status"]>0&&e.jsxs("span",{className:"px-2 py-0.5 rounded bg-blue-100 dark:bg-blue-900/40 text-blue-700 dark:text-blue-300 inline-flex items-center gap-1",children:[e.jsx(Rs,{className:"h-2.5 w-2.5"}),o?`Unknown status: ${z.reasonBuckets["unknown-status"]}`:`状态未知 ${z.reasonBuckets["unknown-status"]}`]})]}),z.eligible.length===0&&z.totalScanned>0&&e.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400",children:o?'No eligible accounts. Run "Check Accounts" on the accounts page first to get latest status.':'无可升级账号。建议先在账户管理页"批量检查"获取最新状态。'})]})}),e.jsx(De,{children:e.jsxs(Pe,{className:"py-3 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(D,{variant:"outline",size:"sm",onClick:X,disabled:V||ze===0,children:[V?e.jsx(bt,{className:"h-4 w-4 mr-1 animate-spin"}):e.jsx(Mt,{className:"h-4 w-4 mr-1"}),o?"Load Plans":"加载计划"]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:G.length>0?o?`${G.length} plans available`:`已加载 ${G.length} 个计划`:o?"Click to load available subscription plans":"点击加载可用订阅计划"})]}),G.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:G.map(_=>e.jsxs("button",{onClick:()=>fe(_.qSubscriptionType),className:me("px-3 py-1.5 rounded-md border text-xs font-medium transition-colors",U===_.qSubscriptionType?"border-primary bg-primary/10 text-primary":"border-border hover:border-primary/50"),children:[e.jsx("div",{children:_.description.title||_.name}),e.jsxs("div",{className:"text-[10px] opacity-70",children:["$",_.pricing.amount/100,"/",_.description.billingInterval]})]},_.qSubscriptionType))})]})}),e.jsx(De,{children:e.jsxs(Pe,{className:"py-3 flex items-center gap-2 flex-wrap",children:[e.jsxs(D,{size:"sm",onClick:Oe,disabled:y||ze===0||!U,children:[y?e.jsx(bt,{className:"h-4 w-4 mr-1 animate-spin"}):e.jsx($a,{className:"h-4 w-4 mr-1"}),o?`Fetch Links (${ze})`:`获取链接 (${ze})`]}),e.jsxs(D,{variant:"ghost",size:"sm",onClick:()=>{Y([]),P(new Set)},disabled:y||f.length===0,title:o?"Clear results":"清空结果",children:[e.jsx(Vt,{className:"h-4 w-4 mr-1"}),o?"Clear":"清空"]}),e.jsxs(D,{variant:"outline",size:"sm",onClick:()=>T(!0),disabled:y,title:o?"Import links from text (one per line)":"从文本批量导入链接(每行一个)",children:[e.jsx(Fa,{className:"h-4 w-4 mr-1"}),o?"Import":"导入链接"]}),e.jsxs(D,{variant:"outline",size:"sm",onClick:Ge,disabled:y||ft||f.filter(_=>_.status==="success").length===0,title:o?"Detect expired links (>15min old)":"检测过期链接(生成超过 15 分钟)",children:[ft?e.jsx(bt,{className:"h-4 w-4 mr-1 animate-spin"}):e.jsx(Mt,{className:"h-4 w-4 mr-1"}),o?"Validate":"检测有效性"]}),e.jsxs(D,{variant:"outline",size:"sm",onClick:Ue,disabled:y||f.filter(_=>_.status==="error"||_.status==="expired").length===0,title:o?"Remove failed and expired links":"移除失败和过期的链接",children:[e.jsx(Vt,{className:"h-4 w-4 mr-1"}),o?"Remove Failed":"清失败"," ","(",f.filter(_=>_.status==="error"||_.status==="expired").length,")"]}),f.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-6 bg-border"}),e.jsxs(D,{variant:"outline",size:"sm",onClick:_e,disabled:y,title:o?"Invert selection":"反选",children:[e.jsx(wc,{className:"h-4 w-4 mr-1"}),o?"Invert":"反选"]}),e.jsxs(D,{variant:"outline",size:"sm",onClick:st,disabled:y||v.size===0,title:o?"Clear selection":"取消多选",children:[e.jsx(Cn,{className:"h-4 w-4 mr-1"}),o?"Deselect":"取消多选"]}),e.jsxs("div",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded-md border border-dashed",children:[e.jsx(qu,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:o?"Quick pick":"快选"}),e.jsx("input",{type:"number",min:1,value:S,onChange:_=>{const ce=parseInt(_.target.value,10);ce>0&&M(ce)},disabled:y,className:"h-6 w-12 px-1 rounded border border-border bg-background text-[11px] text-center",title:o?"Number of links to pick":"快选数量"}),e.jsx("button",{onClick:ue,disabled:y||Ct===0,className:"text-[10px] px-1.5 py-0.5 rounded hover:bg-primary/15 text-primary disabled:opacity-40",title:o?`Select top ${S} available links`:`从顶部选中前 ${S} 个可用链接`,children:o?"Top":"前N个"}),e.jsx("button",{onClick:ae,disabled:y||Ct===0,className:"text-[10px] px-1.5 py-0.5 rounded hover:bg-primary/15 text-primary disabled:opacity-40",title:o?"Select next batch (continue from last pick)":"选中下一批(从上次位置继续)",children:o?"Next":"下一批"})]}),e.jsxs("div",{className:"relative inline-flex items-center gap-1 px-1.5 py-0.5 rounded-md border border-dashed",children:[e.jsx("span",{className:"text-[10px] text-muted-foreground",children:o?"Pick:":"选择:"}),e.jsxs("button",{className:"text-[10px] px-1.5 py-0.5 rounded hover:bg-green-500/15 text-green-700 dark:text-green-300",onClick:()=>oe("success"),disabled:y,title:o?'Add all "Success" to selection':'把"成功"项加入选择',children:["✓ ",o?"Success":"成功"," (",f.filter(_=>_.status==="success").length,")"]}),e.jsxs("button",{className:"text-[10px] px-1.5 py-0.5 rounded hover:bg-amber-500/15 text-amber-700 dark:text-amber-300",onClick:()=>oe("expired"),disabled:y,title:o?'Add all "Expired" to selection':'把"过期"项加入选择',children:["⚠ ",o?"Expired":"过期"," (",f.filter(_=>_.status==="expired").length,")"]}),e.jsxs("button",{className:"text-[10px] px-1.5 py-0.5 rounded hover:bg-red-500/15 text-red-700 dark:text-red-300",onClick:()=>oe("error"),disabled:y,title:o?'Add all "Error" to selection':'把"失败"项加入选择',children:["✗ ",o?"Error":"失败"," (",f.filter(_=>_.status==="error").length,")"]})]}),v.size>0&&e.jsxs(D,{variant:"outline",size:"sm",onClick:we,className:"text-destructive hover:text-destructive hover:bg-destructive/10",title:o?`Delete ${v.size} selected links`:`删除选中的 ${v.size} 个链接`,children:[e.jsx(Vt,{className:"h-4 w-4 mr-1"}),o?`Delete Selected (${v.size})`:`删除选中 (${v.size})`]})]}),e.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[e.jsx("span",{className:"text-muted-foreground",children:o?"Concurrency:":"并发:"}),e.jsx("input",{type:"number",min:1,max:100,value:re,onChange:_=>{const ce=parseInt(_.target.value,10);ce>0&&xe(ce)},disabled:y,className:"h-7 w-14 px-1.5 rounded border border-border bg-background text-xs text-center"})]}),e.jsx("div",{className:"w-px h-6 bg-border"}),Ct>0&&e.jsxs(e.Fragment,{children:[e.jsxs(D,{variant:"outline",size:"sm",onClick:()=>Ze("selected"),disabled:ne===0,title:o?"Open selected in incognito":"无痕打开选中链接",children:[e.jsx(Xs,{className:"h-4 w-4 mr-1"}),o?`Open Selected (${ne})`:`打开选中 (${ne})`]}),e.jsxs(D,{variant:"outline",size:"sm",onClick:()=>Ze("all"),title:o?"Open all in incognito":"无痕打开全部链接",children:[e.jsx(Xs,{className:"h-4 w-4 mr-1"}),o?`Open All (${Ct})`:`全部打开 (${Ct})`]}),e.jsx("div",{className:"w-px h-6 bg-border"}),e.jsxs(D,{variant:"outline",size:"sm",onClick:()=>Ne("selected"),disabled:ne===0,title:o?"Copy selected links":"复制选中链接",children:[e.jsx(As,{className:"h-4 w-4 mr-1"}),o?`Export Selected (${ne})`:`导出选中 (${ne})`]}),e.jsxs(D,{variant:"outline",size:"sm",onClick:()=>Ne("all"),title:o?"Copy all links":"复制全部链接",children:[e.jsx(Ns,{className:"h-4 w-4 mr-1"}),o?`Export All (${Ct})`:`全部导出 (${Ct})`]})]}),f.length>0&&e.jsxs("div",{className:"ml-auto flex items-center gap-3 text-xs text-muted-foreground",children:[Ct>0&&e.jsxs("span",{className:"flex items-center gap-1 text-green-600",children:[e.jsx(Bn,{className:"h-3 w-3"})," ",Ct]}),O>0&&e.jsxs("span",{className:"flex items-center gap-1 text-red-500",children:[e.jsx(fs,{className:"h-3 w-3"})," ",O]}),y&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(bt,{className:"h-3 w-3 animate-spin"}),f.filter(_=>_.status==="pending"||_.status==="loading").length]})]})]})}),f.length>0&&e.jsx(De,{children:e.jsxs(Pe,{className:"py-2",children:[e.jsxs("div",{className:"flex items-center gap-3 py-2 px-2 border-b text-xs font-medium text-muted-foreground",children:[e.jsx("button",{onClick:Qe,className:"flex-shrink-0",disabled:f.length===0,title:v.size===f.length&&f.length>0?o?"Deselect all":"取消全选":o?"Select all":"全选",children:v.size===f.length&&f.length>0?e.jsx(Cc,{className:"h-4 w-4 text-primary"}):v.size>0?e.jsx(wc,{className:"h-4 w-4 text-primary"}):e.jsx(Cn,{className:"h-4 w-4"})}),e.jsx("span",{className:"w-8 text-center",children:"#"}),e.jsx("span",{className:"flex-1",children:o?"Email":"邮箱"}),e.jsx("span",{className:"w-20 text-center",children:o?"Status":"状态"}),e.jsx("span",{className:"w-24 text-center",children:o?"Actions":"操作"})]}),e.jsx("div",{className:"max-h-[60vh] overflow-y-auto",children:f.map((_,ce)=>e.jsxs("div",{className:me("flex items-center gap-3 py-2 px-2 border-b last:border-b-0 hover:bg-muted/50 transition-colors",v.has(_.accountId)&&"bg-primary/5"),children:[e.jsx("button",{onClick:()=>Ee(_.accountId),className:"flex-shrink-0",children:v.has(_.accountId)?e.jsx(Cc,{className:"h-4 w-4 text-primary"}):e.jsx(Cn,{className:"h-4 w-4"})}),e.jsx("span",{className:"w-8 text-center text-xs text-muted-foreground",children:ce+1}),e.jsx("span",{className:"flex-1 text-sm truncate",title:_.email,children:_.email}),e.jsxs("span",{className:"w-20 flex justify-center",children:[_.status==="pending"&&e.jsx("span",{className:"text-xs text-muted-foreground",children:o?"Pending":"等待中"}),_.status==="loading"&&e.jsx(bt,{className:"h-4 w-4 animate-spin text-blue-500"}),_.status==="success"&&e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Bn,{className:"h-4 w-4 text-green-500"}),_.generatedAt&&e.jsxs("span",{className:"text-[9px] text-muted-foreground tabular-nums",title:o?"Minutes since generated":"生成至今分钟数",children:[Math.round((Date.now()-_.generatedAt)/6e4),"m"]})]}),_.status==="expired"&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-amber-600",title:o?"May have expired":"可能已过期",children:[e.jsx(Rs,{className:"h-4 w-4"}),e.jsx("span",{className:"text-[9px]",children:o?"Expired":"过期"})]}),_.status==="error"&&e.jsx("span",{className:"text-xs text-red-500 truncate",title:_.error,children:e.jsx(fs,{className:"h-4 w-4 inline"})})]}),e.jsxs("span",{className:"w-24 flex justify-center gap-1",children:[(_.status==="success"||_.status==="expired")&&_.url&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>xt(_.url),className:"p-1 rounded hover:bg-muted",title:o?"Open in incognito":"无痕打开",children:e.jsx(Xs,{className:"h-3.5 w-3.5"})}),e.jsx("button",{onClick:()=>J(_.url),className:"p-1 rounded hover:bg-muted",title:o?"Copy link":"复制链接",children:e.jsx(As,{className:"h-3.5 w-3.5"})})]}),(_.status==="expired"||_.status==="error")&&e.jsx("button",{onClick:()=>void Qt(_.accountId),className:"p-1 rounded hover:bg-primary/10 text-primary",title:o?"Regenerate":"重新生成",children:e.jsx(Mt,{className:"h-3.5 w-3.5"})}),_.status==="error"&&e.jsx("span",{className:"text-[10px] text-red-500 truncate max-w-[80px]",title:_.error,children:_.error})]})]},_.accountId))})]})}),f.length===0&&e.jsx(De,{children:e.jsxs(Pe,{className:"py-12 text-center text-muted-foreground",children:[e.jsx($a,{className:"h-12 w-12 mx-auto mb-3 opacity-30"}),e.jsx("p",{className:"text-sm",children:ze>0?o?`${ze} FREE accounts available for upgrade. Click "Fetch Links" to start.`:`有 ${ze} 个 FREE 账户可升级。点击"获取链接"开始。`:o?"No FREE tier accounts found. Select accounts in the Accounts page first.":"未找到 FREE 账户。请先在账户管理页面选择账户。"})]})}),e.jsx(jR,{open:j,onClose:()=>T(!1),onImport:L,isEn:o})]})]})}function jR({open:n,onClose:s,onImport:r,isEn:i}){const[o,d]=g.useState("");if(!n)return null;const u=ow(o).length,h=()=>{const f=r(o);d(""),s(),setTimeout(()=>alert(i?`Imported ${f} link(s)`:`成功导入 ${f} 个链接`),0)};return Tn.createPortal(e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[e.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:s}),e.jsxs("div",{className:"relative bg-background rounded-xl shadow-2xl w-full max-w-2xl max-h-[85vh] flex flex-col animate-in fade-in zoom-in-95 duration-200",children:[e.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Fa,{className:"h-5 w-5 text-primary"}),e.jsx("h2",{className:"text-lg font-semibold",children:i?"Import Links":"批量导入链接"})]}),e.jsx(D,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 rounded-lg hover:bg-red-500 hover:text-white transition-colors",onClick:s,children:e.jsx(ns,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"px-6 py-4 space-y-3 overflow-y-auto",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:i?'Paste links, one per line. Supports plain URLs or "email<sep>url" (sep = space / comma / tab / | / ----). URLs are auto-extracted; duplicates are skipped.':"每行一个链接。支持纯 URL,或「邮箱<分隔符>URL」(分隔符可为 空格 / 逗号 / Tab / | / ----)。自动识别 URL,重复链接会跳过。"}),e.jsx("textarea",{value:o,onChange:f=>d(f.target.value),rows:12,autoFocus:!0,spellCheck:!1,placeholder:`https://aws.amazon.com/...
|
|
130
|
+
user@mail.com https://aws.amazon.com/...`,className:"w-full rounded-lg border border-foreground/15 bg-[var(--glass-bg)] backdrop-blur-md px-3 py-2 text-sm font-mono resize-y focus-visible:outline-none focus-visible:border-primary/50 focus-visible:ring-2 focus-visible:ring-primary/30"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:i?`Detected ${u} valid link(s)`:`已识别 ${u} 个有效链接`})]}),e.jsxs("div",{className:"flex justify-end gap-3 px-6 py-4 border-t bg-muted/30",children:[e.jsx(D,{variant:"outline",onClick:s,children:i?"Cancel":"取消"}),e.jsxs(D,{disabled:u===0,onClick:h,children:[e.jsx(Fa,{className:"h-4 w-4 mr-2"}),i?`Import (${u})`:`导入 (${u})`]})]})]})]}),document.body)}function NR({getAllSubscribed:n,updateAccount:s,concurrency:r,isEn:i}){const o=n(),[d,u]=g.useState(new Set),[h,f]=g.useState(!1),[p,y]=g.useState(!1),b=k=>{u(R=>{const I=new Set(R);return I.has(k)?I.delete(k):I.add(k),I})},v=()=>{d.size===o.length?u(new Set):u(new Set(o.map(k=>k.id)))},N=async k=>{const R=k==="selected"?o.filter(I=>I&&d.has(I.id)):o;if(R.length!==0&&confirm(i?`Open ${R.length} subscription portal pages? (in browser incognito mode)`:`打开 ${R.length} 个订阅门户页面?(浏览器无痕模式)`)){f(!0);try{let I=0;const M=async()=>{for(;I<R.length;){const W=I++,U=R[W];if(U)try{const q=await window.api.accountGetSubscriptionUrl(U.credentials.accessToken,void 0,U.credentials?.region,U.profileArn,U.machineId,U.credentials?.provider||U.idp,U.credentials?.authMethod,U.id);q.success&&q.url&&(await window.api.openSubscriptionWindow(q.url),await new Promise(V=>setTimeout(V,500)))}catch(q){console.warn("Open portal failed for",U.email,q)}}},G=Array.from({length:Math.min(r,R.length)},()=>M());await Promise.all(G)}finally{f(!1)}}},j=async k=>{const R=(k==="selected"?o.filter(I=>I&&d.has(I.id)):o).filter(I=>I?.usage?.resourceDetail?.overageEnabled===!0);if(R.length===0){alert(i?"No accounts with overage enabled":"没有开启超额的账号");return}if(confirm(i?`Disable overage on ${R.length} accounts?`:`关闭 ${R.length} 个账号的超额?`)){y(!0);try{let I=0;const M=async()=>{for(;I<R.length;){const W=I++,U=R[W];if(U)try{(await window.api.accountSetOverage(U.credentials.accessToken,"DISABLED",U.credentials?.region,U.profileArn,U.machineId,U.credentials?.provider||U.idp,U.credentials?.authMethod,U.id)).success&&s(U.id,{usage:{...U.usage,resourceDetail:{...U.usage?.resourceDetail,overageEnabled:!1}}})}catch(q){console.warn("Disable overage failed for",U.email,q)}}},G=Array.from({length:Math.min(r,R.length)},()=>M());await Promise.all(G)}finally{y(!1)}}};if(o.length===0)return e.jsx(De,{children:e.jsxs(Pe,{className:"py-12 text-center text-muted-foreground",children:[e.jsx($a,{className:"h-12 w-12 mx-auto mb-3 opacity-30"}),e.jsx("p",{className:"text-sm",children:i?'No subscribed accounts found. Run "Check Accounts" first to refresh status.':'未发现已订阅账号。请先在账户页"批量检查"刷新状态。'})]})});const T=d.size,S=o.filter(k=>k?.usage?.resourceDetail?.overageEnabled===!0).length;return e.jsxs(e.Fragment,{children:[e.jsx(De,{className:"border-blue-200 dark:border-blue-800 bg-blue-50/50 dark:bg-blue-950/10",children:e.jsxs(Pe,{className:"py-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ap,{className:"h-4 w-4 text-blue-600"}),e.jsx("span",{className:"text-sm font-medium",children:i?"Subscription Lifecycle Management":"订阅生命周期管理"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:i?"Bulk open subscription portals in browser (cancel/manage there), or bulk disable overage.":"批量打开订阅门户(在浏览器内取消/管理),或批量关闭超额。"})]})}),e.jsx(De,{children:e.jsxs(Pe,{className:"py-3 flex items-center gap-2 flex-wrap",children:[e.jsxs(D,{size:"sm",onClick:()=>N("selected"),disabled:h||T===0,children:[h?e.jsx(bt,{className:"h-4 w-4 mr-1 animate-spin"}):e.jsx(Xs,{className:"h-4 w-4 mr-1"}),i?`Open Portal (Selected: ${T})`:`打开门户(已选 ${T})`]}),e.jsxs(D,{size:"sm",variant:"outline",onClick:()=>N("all"),disabled:h,children:[e.jsx(Xs,{className:"h-4 w-4 mr-1"}),i?`Open All (${o.length})`:`打开全部 (${o.length})`]}),e.jsx("div",{className:"w-px h-6 bg-border"}),e.jsxs(D,{size:"sm",variant:"outline",onClick:()=>j("selected"),disabled:p||T===0,children:[p?e.jsx(bt,{className:"h-4 w-4 mr-1 animate-spin"}):e.jsx(jc,{className:"h-4 w-4 mr-1"}),i?"Disable Overage (Selected)":"关超额(已选)"]}),e.jsxs(D,{size:"sm",variant:"outline",onClick:()=>j("all"),disabled:p||S===0,children:[e.jsx(jc,{className:"h-4 w-4 mr-1"}),i?`Disable All Overage (${S})`:`关全部超额 (${S})`]}),e.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:T>0?i?`${T} of ${o.length} selected`:`已选 ${T} / ${o.length}`:i?`${o.length} subscribed accounts`:`${o.length} 个已订阅账号`})]})}),e.jsx(De,{children:e.jsxs(Pe,{className:"py-0 px-0",children:[e.jsxs("div",{className:"flex items-center gap-3 py-2 px-3 border-b text-xs font-medium text-muted-foreground bg-muted/30",children:[e.jsx("button",{onClick:v,className:"flex-shrink-0",children:d.size===o.length&&o.length>0?e.jsx(Cc,{className:"h-3.5 w-3.5 text-primary"}):d.size>0?e.jsx(wc,{className:"h-3.5 w-3.5 text-primary"}):e.jsx(Cn,{className:"h-3.5 w-3.5"})}),e.jsx("span",{className:"w-8 text-center",children:"#"}),e.jsx("span",{className:"flex-1",children:i?"Email":"邮箱"}),e.jsx("span",{className:"w-28 text-center",children:i?"Plan":"订阅类型"}),e.jsx("span",{className:"w-20 text-center",children:i?"Days Left":"剩余天数"}),e.jsx("span",{className:"w-24 text-center",children:i?"Overage":"超额状态"}),e.jsx("span",{className:"w-32 text-center",children:i?"Actions":"操作"})]}),e.jsx(wR,{subscribed:o,selectedIds:d,toggleSelect:b,updateAccount:s,isEn:i}),!1]})})]})}function wR({subscribed:n,selectedIds:s,toggleSelect:r,updateAccount:i,isEn:o}){const d=g.useRef(null),u=44,h=g.useMemo(()=>n.filter(y=>!!y),[n]),f=lo({count:h.length,getScrollElement:()=>d.current,estimateSize:()=>u,overscan:10});if(h.length<50)return e.jsx("div",{ref:d,className:"max-h-[60vh] overflow-y-auto",children:h.map((y,b)=>e.jsx(pj,{acc:y,idx:b,selected:s.has(y.id),onToggleSelect:()=>r(y.id),isEn:o},y.id))});const p=f.getVirtualItems();return e.jsx("div",{ref:d,className:"max-h-[60vh] overflow-y-auto",style:{contain:"strict"},children:e.jsx("div",{style:{height:f.getTotalSize(),position:"relative",width:"100%"},children:p.map(y=>{const b=h[y.index];return b?e.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${y.start}px)`},children:e.jsx(pj,{acc:b,idx:y.index,selected:s.has(b.id),onToggleSelect:()=>r(b.id),isEn:o})},y.key):null})})})}function pj({acc:n,idx:s,selected:r,onToggleSelect:i,isEn:o}){const d=n.subscription?.title||n.subscription?.type||"-",u=n.subscription?.daysRemaining,h=n.usage?.resourceDetail?.overageEnabled===!0,f=n.subscription?.overageCapability==="OVERAGE_CAPABLE";return e.jsxs("div",{className:me("flex items-center gap-3 py-2 px-3 border-b last:border-b-0 hover:bg-muted/40 text-xs transition-colors",r&&"bg-primary/5"),children:[e.jsx("button",{onClick:i,className:"flex-shrink-0",children:r?e.jsx(Cc,{className:"h-3.5 w-3.5 text-primary"}):e.jsx(Cn,{className:"h-3.5 w-3.5"})}),e.jsx("span",{className:"w-8 text-center text-muted-foreground",children:s+1}),e.jsx("span",{className:"flex-1 truncate",title:n.email,children:n.email}),e.jsx("span",{className:"w-28 text-center",children:e.jsx("span",{className:me("inline-block px-2 py-0.5 rounded text-[10px] font-medium",d.toUpperCase().includes("PRO+")||d.toUpperCase().includes("PRO_PLUS")?"bg-purple-500/15 text-purple-700 dark:text-purple-300":d.toUpperCase().includes("POWER")?"bg-amber-500/15 text-amber-700 dark:text-amber-300":d.toUpperCase().includes("PRO")?"bg-blue-500/15 text-blue-700 dark:text-blue-300":"bg-muted text-muted-foreground"),children:d})}),e.jsx("span",{className:"w-20 text-center text-muted-foreground",children:u!=null?e.jsx("span",{className:me(u<=3?"text-red-500":u<=7?"text-amber-500":""),children:o?`${u}d`:`${u} 天`}):"-"}),e.jsx("span",{className:"w-24 text-center",children:h?e.jsx("span",{className:"text-green-600 text-[10px]",children:o?"ENABLED":"已开启"}):f?e.jsx("span",{className:"text-muted-foreground text-[10px]",children:o?"DISABLED":"未开启"}):e.jsx("span",{className:"text-muted-foreground text-[10px]",children:"-"})}),e.jsx("span",{className:"w-32 flex justify-center gap-1",children:e.jsxs("button",{onClick:async()=>{const p=await window.api.accountGetSubscriptionUrl(n.credentials.accessToken,void 0,n.credentials?.region,n.profileArn,n.machineId,n.credentials?.provider||n.idp,n.credentials?.authMethod,n.id);p.success&&p.url?await window.api.openSubscriptionWindow(p.url):alert(o?`Failed: ${p.error}`:`失败: ${p.error}`)},className:"px-2 py-1 rounded text-[10px] bg-primary/10 text-primary hover:bg-primary/20",title:o?"Open subscription portal":"打开订阅门户",children:[e.jsx(Xs,{className:"h-3 w-3 inline mr-1"}),o?"Manage":"管理"]})})]})}function*cw(n,s,r=0,i=[]){if(i.length===s){yield[...i];return}if(!(n-r<s-i.length))for(let o=r;o<n;o++)i.push(o),yield*cw(n,s,o+1,i),i.pop()}function kR(n,s){const r=new Set(s);let i="";for(let o=0;o<n.length;o++)i+=n[o],o<n.length-1&&r.has(o)&&(i+=".");return i}function Ui(n){const s=n.trim(),r=s.indexOf("@");if(r<=0||r===s.length-1)return null;const i=s.slice(0,r),o=s.slice(r+1);return!i||!o||o.indexOf(".")<0?null:[i,o]}function SR(n,s){if(s<0||s>n)return 0;if(s===0||s===n)return 1;s=Math.min(s,n-s);let r=1;for(let i=0;i<s;i++)r=r*(n-i)/(i+1);return Math.round(r)}function xj(n,s=Number.POSITIVE_INFINITY){const r=n-1;if(r<=0)return 0;let i=0;for(let o=1;o<=Math.min(r,s);o++)i+=SR(r,o);return i}function CR(n,s){const r=Ui(n);if(!r)return 0;const i=r[0].replace(/\./g,"").toLowerCase(),o=r[1].toLowerCase();let d=0;for(const u of s){const h=Ui(u);if(!h)continue;const[f,p]=h;p.toLowerCase()===o&&f.replace(/\./g,"").toLowerCase()===i&&d++}return d}function Vf(n,s){const r=Ui(n);if(!r)return{variant:null,dotCount:0,remainingInBucket:0,localLength:0};const i=r[0].replace(/\./g,""),o=r[1].toLowerCase(),d=i.length,u=d-1;if(u<=0)return{variant:null,dotCount:0,remainingInBucket:0,localLength:d};const h=new Set;for(const f of s){const p=f.trim().toLowerCase();p&&h.add(p)}h.add(n.trim().toLowerCase()),h.add(`${i.toLowerCase()}@${o}`);for(let f=1;f<=u;f++){const p=[];for(const y of cw(u,f)){const b=`${kR(i,y)}@${o}`;h.has(b.toLowerCase())||p.push(b)}if(p.length>0)return{variant:p[Math.floor(Math.random()*p.length)],dotCount:f,remainingInBucket:p.length-1,localLength:d}}return{variant:null,dotCount:0,remainingInBucket:0,localLength:d}}const Ri="arn:aws:codewhisperer:us-east-1:638616132270:profile/AAAACCCCXXXX";function Nx(n){const s=(n||"").toLowerCase();return s?s.includes("aws-risk-control")||s.includes("风控")||s.includes("请稍后再试")||s.includes("try again later")?{category:"risk_control",title:"AWS đã chặn yêu cầu",reasons:["Yêu cầu đăng ký bị chính sách bảo mật AWS chặn","Nguyên nhân thường gặp: đăng ký hàng loạt trong thời gian ngắn, nhịp thao tác lặp lại, tên miền email bị liên kết hoặc thông tin tài khoản cần xác minh"],suggestions:["Dừng tác vụ hàng loạt hiện tại và kiểm tra email hạn chế tài khoản","Giảm tốc độ xuống 10/phút hoặc thấp hơn và giữ tự động tạm dừng","Sử dụng nguồn email ổn định, hợp lệ và tránh đăng ký hàng loạt cùng một tên miền","Nếu tài khoản bị hạn chế, liên hệ Support theo hướng dẫn của AWS/Kiro"]}:s.includes("610")||s.includes("whitelist")||s.includes("connect")&&s.includes("http 4")?{category:"proxy_whitelist",title:"Xác thực proxy hoặc danh sách cho phép thất bại",reasons:["Proxy đích từ chối xác thực do sai thông tin đăng nhập hoặc IP nguồn chưa được cho phép","Mã 610 của bestproxy nghĩa là IP nguồn chưa được cấp quyền"],suggestions:["Thêm IP đầu ra hiện tại vào danh sách cho phép của nhà cung cấp proxy","Hoặc dùng chế độ kết nối trực tiếp bằng tài khoản và bảo đảm vùng nguồn được cho phép","Kiểm tra cấu hình proxy trung chuyển"]}:s.includes("proxychain")||s.includes("代理链")||s.includes("上游中转")?{category:"proxy_chain",title:"Không thiết lập được chuỗi proxy",reasons:["Bắt tay kết nối giữa proxy trung chuyển và proxy đích thất bại"],suggestions:["Dùng chức năng Chẩn đoán tại trang Kho proxy để xác định lớp gặp lỗi","Xác nhận cổng proxy trung chuyển đang chạy","Nếu proxy đích yêu cầu danh sách cho phép, thêm IP đầu ra của proxy trung chuyển"]}:s.includes("严格代理")||s.includes("strict")&&s.includes("proxy")?{category:"strict_proxy",title:"Chế độ proxy nghiêm ngặt đã chặn yêu cầu",reasons:["Kho proxy đang bật chế độ nghiêm ngặt nhưng không có proxy khả dụng"],suggestions:["Kiểm tra kho proxy và bảo đảm có ít nhất một proxy hoạt động","Kiểm tra proxy có bị tự động vô hiệu hóa hay không","Có thể tạm bật lại proxy hoặc tắt tự động vô hiệu hóa khi thất bại"]}:s.includes("eof")||s.includes("status=0")&&s.includes("failed to do request")||s.includes("connection reset")?{category:"eof",title:"Kết nối mạng tạm thời bị ngắt (EOF)",reasons:["Kết nối TLS bị phía bên kia đóng khi bắt tay hoặc truyền dữ liệu","Thường xảy ra khi proxy không ổn định, quá nhiều tác vụ đồng thời hoặc mạng trung gian chập chờn"],suggestions:["Giảm số tác vụ đồng thời","Đổi proxy hoặc kiểm tra proxy trung chuyển","Lỗi đơn lẻ có thể tự thử lại; nếu xảy ra liên tục hãy đổi kết nối đầu ra"]}:(s.includes("timeout")||s.includes("超时"))&&(s.includes("otp")||s.includes("验证码")||s.includes("code"))?{category:"otp_timeout",title:"Hết thời gian chờ mã xác minh",reasons:["Email tạm chưa nhận được thư xác minh AWS trong thời hạn","AWS có thể không gửi, thư có thể vào mục rác hoặc dịch vụ email tạm bị chậm"],suggestions:["Xác nhận dịch vụ email tạm đang hoạt động","Tạm dừng đăng ký hàng loạt và đổi sang nguồn email hợp lệ nếu tên miền bị AWS từ chối","Nếu lỗi lặp lại, hãy dừng hàng loạt và giảm tốc độ"]}:s.includes("timeout")||s.includes("超时")||s.includes("etimedout")||s.includes("fetch failed")||s.includes("econnreset")||s.includes("econnrefused")||s.includes("enotfound")||s.includes("network")?{category:"network",title:"Lỗi mạng",reasons:["Kết nối, DNS hoặc yêu cầu đã hết thời gian chờ"],suggestions:["Kiểm tra mạng cục bộ và khả năng kết nối proxy","Giảm số tác vụ đồng thời rồi thử lại"]}:s.includes("已注册")||s.includes("email")&&(s.includes("already")||s.includes("exists")||s.includes("used")||s.includes("已存在")||s.includes("已被"))?{category:"email_used",title:"Email đã được đăng ký",reasons:["Địa chỉ email này đã tồn tại trên AWS"],suggestions:["Tạo một địa chỉ email mới rồi thử lại","Sử dụng nhiều tên miền để giảm trùng lặp"]}:s.includes("rate")||s.includes("limit")||s.includes("too many")||s.includes("限流")||s.includes("429")?{category:"rate_limit",title:"Đã chạm giới hạn tốc độ",reasons:["Số yêu cầu trong thời gian ngắn vượt quá mức AWS chấp nhận"],suggestions:["Giảm maxPerMinute và số tác vụ đồng thời","Bật tự động tạm dừng khi có cảnh báo rủi ro"]}:s.includes("suspended")?{category:"suspended",title:"Tài khoản đã bị vô hiệu hóa",reasons:["Quy trình đăng ký hoàn tất nhưng AWS đánh dấu tài khoản là suspended ở bước cuối","Đây thường là kết quả đánh giá bảo mật tổng hợp"],suggestions:["Dừng đăng ký hàng loạt và kiểm tra email hạn chế tài khoản","Giảm tốc độ và không tiếp tục thử lại cùng loại lỗi","Liên hệ Support theo hướng dẫn của AWS/Kiro để xác minh tài khoản"]}:s.includes("unauthorized")||s.includes("401")||s.includes("403")?{category:"auth",title:"Xác thực thất bại",reasons:["API phía trên trả về 401/403"],suggestions:["Kiểm tra thông tin đăng nhập và nội dung phản hồi API"]}:{category:"unknown",title:"Lỗi khác",reasons:[n||""],suggestions:["Xem nhật ký đầy đủ để xác định nguyên nhân"]}:{category:"unknown",title:"Lỗi không xác định",reasons:["Không nhận được thông tin lỗi cụ thể"],suggestions:["Xem nhật ký đầy đủ"]}}function cc(n){const s=Nx(n).category;return s==="risk_control"||s==="suspended"?"risk_control":s==="otp_timeout"?"otp_timeout":s==="email_used"?"email_used":s==="rate_limit"?"rate_limit":s==="auth"?"auth":s==="eof"||s==="network"||s==="proxy_chain"||s==="proxy_whitelist"||s==="strict_proxy"?"network":"unknown"}function dc(n){const s=n||"",r=s.toLowerCase();if(!r)return null;const i=Nx(s);return i.category==="risk_control"?{category:"risk_control",label:"AWS risk control"}:i.category==="suspended"?{category:"suspended",label:"account suspended"}:r.includes("accountsuspendedexception")||r.includes("temporarily_suspended")||r.includes("temporarily suspended")||r.includes("account suspended")||r.includes("restricted your ability to use kiro")||r.includes("user id is")&&r.includes("suspended")||/\b423\b/.test(r)?{category:"suspended",label:"account suspended"}:i.category==="auth"||/\b(401|403)\b/.test(r)||r.includes("unauthorized")||r.includes("forbidden")||r.includes("access denied")||r.includes("redirect_mismatch")?{category:"auth_block",label:"401/403 auth block"}:null}function TR(n){const s=(n||"").toLowerCase();return!s||!s.includes("profilearn")||dc(n)?!1:s.includes("profilearn is required")||s.includes("no usable streaming profilearn")||s.includes("placeholder profilearn")||s.includes("fixed placeholder profilearn")}function AR(n=8){const s="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";let r="";for(let i=0;i<n;i++)r+=s[Math.floor(Math.random()*s.length)];return r}function Kf(n){if(!n)return n;const s=AR();if(n.includes("{session}"))return n.replace(/\{session\}/g,s);const r=n.match(/^(\w+:\/\/)([^@/]+)@(.+)$/);if(r){const[,i,o,d]=r,u=o.indexOf(":"),h=u>=0?o.slice(0,u):o,f=u>=0?o.slice(u+1):"";if(/_(area|life|city|state|session|region|country)-/i.test(h)&&!/_session-/i.test(h)){const y=`${h}_session-${s}`;return`${i}${y}${u>=0?":"+f:""}@${d}`}}return n}const MR={init:"Khởi tạo","proxy-chain-ready":"Chuỗi proxy sẵn sàng","tls-ready":"TLS sẵn sàng","exit-ip":"Kiểm tra IP đầu ra",oidc:"OIDC",device:"Cấp quyền thiết bị","email-created":"Đã tạo email",portal:"Portal","workflow-init":"Quy trình","submit-email":"Gửi email",signup:"Signup","send-otp":"Gửi mã xác minh","waiting-otp":"Chờ mã xác minh","otp-received":"Đã nhận mã","create-identity":"Tạo danh tính","set-password":"Đặt mật khẩu","sso-workflow":"Quy trình SSO","sso-token":"Lấy Token","verify-alive":"Kiểm tra",done:"Hoàn tất"};function ER(n){if(n<1e3)return`${n}ms`;if(n<6e4)return`${(n/1e3).toFixed(1)}s`;const s=Math.floor(n/6e4),r=Math.floor(n%6e4/1e3);return`${s}m${r.toString().padStart(2,"0")}s`}function IR({item:n,t:s,batchClock:r}){const i=n.status==="running"||n.status==="retrying",o=i?r:n.stepStartedAt||n.startedAt||0,d=n.startedAt?Math.max(0,o-n.startedAt):void 0,u=n.currentStep?MR[n.currentStep]:"",[h,f]=g.useState(!1),y=(n.status==="failed"||n.status==="import_failed")&&n.error?Nx(n.error):null;return e.jsxs("div",{className:"border-b last:border-b-0 text-xs hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[e.jsxs("span",{className:"text-muted-foreground w-6 text-right shrink-0",children:["#",n.index]}),n.status==="pending"&&e.jsx("span",{className:"text-muted-foreground shrink-0",children:"—"}),n.status==="running"&&e.jsx(bt,{className:"h-3 w-3 animate-spin text-primary shrink-0"}),n.status==="retrying"&&e.jsx(Mt,{className:"h-3 w-3 animate-spin text-yellow-500 shrink-0"}),n.status==="success"&&e.jsx(an,{className:"h-3 w-3 text-green-500 shrink-0"}),n.status==="imported"&&e.jsx(Ns,{className:"h-3 w-3 text-green-600 shrink-0"}),n.status==="failed"&&e.jsx(fs,{className:"h-3 w-3 text-red-500 shrink-0"}),n.status==="import_failed"&&e.jsx(fs,{className:"h-3 w-3 text-orange-500 shrink-0"}),e.jsx("span",{className:"font-mono truncate",children:n.email||e.jsx("span",{className:"text-muted-foreground italic",children:"待生成"})}),i&&u&&e.jsx($e,{variant:"outline",className:"h-4 px-1.5 text-[10px] font-normal shrink-0",children:u}),n.exitIp&&e.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono shrink-0 hidden sm:inline",children:["IP ",n.exitIp]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[d!==void 0&&e.jsx("span",{className:"text-[10px] text-muted-foreground font-mono tabular-nums",children:ER(d)}),e.jsx("span",{className:me("text-xs whitespace-nowrap",(n.status==="success"||n.status==="imported")&&"text-green-600",(n.status==="failed"||n.status==="import_failed")&&"text-red-500",n.status==="retrying"&&"text-yellow-600",(n.status==="pending"||n.status==="running")&&"text-muted-foreground"),children:n.status==="pending"||n.status==="running"?"":n.status==="retrying"?`${s("register.batchItemRetrying")} (${n.retryCount})`:n.status==="success"?s("register.batchItemSuccess"):n.status==="imported"?s("register.batchItemImported"):n.status==="import_failed"?s("register.batchItemImportFailed"):y?y.title:n.error||s("register.batchItemFailed")}),y&&e.jsx("button",{onClick:()=>f(b=>!b),className:"ml-1 text-[10px] px-1.5 py-0.5 rounded border border-border bg-background hover:bg-muted transition-colors text-muted-foreground hover:text-foreground",title:"Xem nguyên nhân và đề xuất",children:h?"Thu gọn":"Chẩn đoán"})]})]}),y&&h&&e.jsx("div",{className:"px-3 pb-2 pl-12 pr-3 space-y-1.5",children:e.jsxs("div",{className:"rounded-md border border-red-500/30 bg-red-500/5 px-3 py-2 space-y-1.5",children:[e.jsx("div",{className:"font-medium text-red-700 dark:text-red-400 text-[11px]",children:y.title}),y.reasons.length>0&&e.jsxs("div",{className:"text-[11px] text-foreground/80",children:[e.jsx("div",{className:"text-muted-foreground",children:"Nguyên nhân có thể:"}),e.jsx("ul",{className:"list-disc pl-4 space-y-0.5",children:y.reasons.map((b,v)=>e.jsx("li",{children:b},v))})]}),y.suggestions.length>0&&e.jsxs("div",{className:"text-[11px] text-foreground/80",children:[e.jsx("div",{className:"text-muted-foreground",children:"Đề xuất:"}),e.jsx("ul",{className:"list-disc pl-4 space-y-0.5",children:y.suggestions.map((b,v)=>e.jsx("li",{children:b},v))})]}),n.error&&e.jsxs("div",{className:"text-[10px] text-muted-foreground font-mono break-all pt-1 border-t border-red-500/20",children:["原始:",n.error]})]})})]})}const gj=["OIDC","Email","Verify","Password","Token","Done"];function RR(n,s){const r=[];return n&&r.push("Import"),s&&r.push("ProLink"),r.length===0?gj:[...gj.slice(0,-1),...r,"Done"]}function DR(n,s,r){const i=d=>r.indexOf(d),o=r.length-1;switch(n){case"idle":return-1;case"initializing":return i("OIDC");case"email":return i("Email");case"otp":return i("Verify");case"done":return i("Done");case"importing":{const d=i("Import");return d>=0?d:i("Done")}case"fetching-link":{const d=i("ProLink");return d>=0?d:i("Done")}case"finalized":return o;case"running":{if(!s)return Math.max(0,i("Email"));const d=s.toLowerCase();if(d.includes("正在获取 pro")||d.includes("pro link")||d.includes("fetching pro")){const u=i("ProLink");if(u>=0)return u}if(d.includes("正在导入")||d.includes("importing")||d.includes("已导入")){const u=i("Import");if(u>=0)return u}return d.includes("sso")||d.includes("token")||d.includes("验活")||d.includes("complete")||d.includes("end-of-workflow")?i("Token"):d.includes("密码")||d.includes("password")||d.includes("加密公钥")?i("Password"):d.includes("验证码")||d.includes("otp")||d.includes("verify")||d.includes("signup")||d.includes("profile")||d.includes("注册初始化")?i("Verify"):d.includes("提交邮箱")||d.includes("submit")||d.includes("邮箱")?i("Email"):Math.max(0,i("Email"))}}}const dw="kiro-register-config",uw="kiro-register-history",wx="kiro-register-email-blacklist",hw="kiro-register-templates";function PR(){try{const n=localStorage.getItem(hw);return n?JSON.parse(n):[]}catch{return[]}}function Hf(n){try{localStorage.setItem(hw,JSON.stringify(n))}catch{}}function Yl(){try{const n=localStorage.getItem(wx);if(!n)return new Set;const s=JSON.parse(n);return new Set(s.map(r=>r.toLowerCase()))}catch{return new Set}}function Dp(n){try{const s=Array.from(n).slice(-5e3);localStorage.setItem(wx,JSON.stringify(s))}catch{}}function LR(){try{localStorage.removeItem(wx)}catch{}}let Oa=[],lc="idle",lu=null,ou="",cu=!1,Bl=0,ga=0,ya=0,Qr=[];const Ff=(n,s)=>{const r=Math.max(0,s);return r===0?0:Math.min(Math.max(0,n),r)};let yj=!1;const mw=new Map;let fw=null,ia=null;function OR(n){return[n.status||"",n.email||"",n.refreshToken||"",n.error||""].join("|")}function kx(n){if(typeof n=="string")return n;if(n==null)return"";if(typeof n=="object"){const s=n.message;if(s!==void 0)return kx(s);try{return JSON.stringify(n)}catch{return String(n)}}return String(n)}let bj=!1;function zR(){bj||(bj=!0,window.api.onRegistrationStep(({taskId:n,event:s})=>{if(!n)return;const r=mw.get(n);if(!r)return;const i=s.ts||Date.now();Qr=Qr.map(o=>o.id!==r?o:{...o,currentStep:s.name,startedAt:o.startedAt??i,stepStartedAt:i,email:s.email||o.email,exitIp:s.exitIp||o.exitIp}),Lp?.([...Qr]),s.exitIp&&fw?.(s.exitIp,r)}))}let vj=!1;function UR(){vj||(vj=!0,window.api.onRegistrationLog(n=>{const s=kx(n),r=[...Oa,`[${new Date().toLocaleTimeString()}] ${s}`];r.length>500&&r.splice(0,r.length-500),Oa=r,Pp?.(r)}))}let jj=null,Nj=null,Pp=null,wj=null,kj=null,Sj=null,Cj=null,Lp=null,Tj=null;function Gf(){try{const n=localStorage.getItem(uw);return n?JSON.parse(n):[]}catch{return[]}}function $R(n){try{localStorage.setItem(uw,JSON.stringify(n.slice(0,100)))}catch{}}function BR(){try{const n=localStorage.getItem(dw);return n?JSON.parse(n):{}}catch{return{}}}function _R(n){try{localStorage.setItem(dw,JSON.stringify(n))}catch{}}function VR(){const{t:n}=Ut(),s=n("common.unknown")==="Unknown",r=g.useRef(BR()).current,[i,o]=g.useState(r.mode||"manual"),[d,u]=g.useState(lc),[h,f]=g.useState(Oa),[p,y]=g.useState(lu),[b,v]=g.useState(!1),N=g.useCallback(A=>{lc=A,jj?.(A)},[]),j=g.useCallback(A=>{lu=A,Nj?.(A)},[]),[T,S]=g.useState(""),[k,R]=g.useState(r.fullName||""),[I,M]=g.useState(""),[G,W]=g.useState(r.manualParentEmail||""),[U,q]=g.useState(r.manualAnonymousEmail??!1),[V,le]=g.useState(r.outlookData||""),[B,be]=g.useState(r.tempMailEmail||""),[K,se]=g.useState(r.tempMailEpin||""),[te,Y]=g.useState(r.tempMailDomain||""),[P,F]=g.useState(r.tingamefiMailApiUrl||"https://temp-email-worker.thienp1301.workers.dev"),[fe,pe]=g.useState(r.tingamefiMailAdminPassword||""),[C,z]=g.useState(r.tingamefiMailDomain||"mail.tingamefi.com"),[X,re]=g.useState(r.protonBaseEmail||""),[xe,Oe]=g.useState(yj),Ee=g.useCallback(A=>{yj=A,Oe(A)},[]),[Qe,_e]=g.useState(!1),st=g.useRef(null),{addAccount:oe,accounts:ue}=vt(),ae=g.useCallback(()=>{const{pickNextProxy:A,proxyPoolConfig:$}=vt.getState(),de=A();if(!de)return null;const Me=de.url.replace(/:([^:@/]+)@/,":***@");return{proxy:de.url,upstreamProxy:$.upstreamProxy||"",proxyId:de.id,label:Me}},[]),L=g.useCallback(A=>{const $=[...Oa,`[${new Date().toLocaleTimeString()}] ${kx(A)}`];$.length>500&&$.splice(0,$.length-500),Oa=$,Pp?.($)},[]),we=g.useCallback(async A=>{let $=A.lastError;if(A.credentials.accessToken){const Me=A.credentials.provider||A.idp,Ke=A.profileArn===Ri&&[Me,A.idp,A.credentials.authMethod].some(Le=>Le?.toLowerCase()==="builderid"||Le?.toLowerCase()==="idc");try{const Le=await window.api.diagnoseAccountLiveness({account:{id:A.email,email:A.email,accessToken:A.credentials.accessToken,refreshToken:A.credentials.refreshToken,clientId:A.credentials.clientId,clientSecret:A.credentials.clientSecret,region:A.credentials.region||"us-east-1",authMethod:A.credentials.authMethod,provider:Me,profileArn:A.profileArn,machineId:A.machineId,expiresAt:A.credentials.expiresAt},model:"claude-sonnet-4.5",message:"Reply with pong only.",timeoutMs:6e4}),pt=Le.error||Le.content||"",ut=dc(pt);Le.success&&ut?$=pt:Le.success?Le.model==="credential-check"?L(`[Nhập] ${A.email}: kiểm tra credential/quota OK (bỏ qua model chat vì không có profileArn thật)`):L(`[Nhập] ${A.email}: model liveness OK`):Ke&&TR(Le.error)?L(`[Nhập] ${A.email}: Kiro không nhận profileArn placeholder; credential/quota đã OK nên bỏ qua model chat`):$=Le.error||"Model liveness check failed"}catch(Le){$=Le instanceof Error?Le.message:String(Le)}}else $="Missing access token for model liveness check";if($){const Ke=dc($)?.label||"model liveness failed";return L(`[Nhập] ${A.email}: ${Ke}: ${$}`),{ok:!1,error:$}}return{ok:!0,accountId:oe({...A,status:"active",lastError:void 0,lastCheckedAt:Date.now()})}},[oe,L]);g.useEffect(()=>{const A=st.current;A&&(A.scrollTop=A.scrollHeight)},[h]),g.useEffect(()=>{UR(),zR()},[]),g.useEffect(()=>{window.api.registrationStatus().then(A=>{A.inProgress&&lc==="idle"&&window.api.registrationCancel()})},[]);const Ue=()=>{lc="idle",Oa=[],lu=null,ou="",N("idle"),f([]),j(null),v(!1),M("")},Lt=g.useCallback(()=>{const A=new Set;for(const $ of ue.values())$.email&&A.add($.email.toLowerCase());for(const $ of Gf())$.email&&A.add($.email.toLowerCase());for(const $ of Yl())A.add($);return A},[ue]),xt=g.useRef(new Set),Qt=g.useCallback(()=>{const A=X.trim();if(!A||!Ui(A))return null;const $=new Set(Lt());for(const Me of xt.current)$.add(Me.toLowerCase());const de=Vf(A,$);return de.variant&&xt.current.add(de.variant.toLowerCase()),de.variant},[X,Lt]),ft=async()=>{let A="";if(U){const Ke=G.trim();if(!Ke||!Ui(Ke)){L(n("register.logAnonymousNoParent"));return}const Le=Vf(Ke,Lt());if(!Le.variant){L(n("register.logAnonymousExhausted"));return}A=Le.variant,S(A),L(n("register.logAnonymousGenerated").replace("{email}",A).replace("{dots}",String(Le.dotCount)))}else G.trim()&&(A=G.trim(),S(A));N("initializing"),Oa=[],f([]),j(null),v(!1),L(n("register.logManualInit"));const $={};k.trim()&&($.fullName=k.trim());const de=ae();if(de){const Ke=Kf(de.proxy);$.proxy=Ke,$.upstreamProxy=de.upstreamProxy,L(`[Proxy] Sử dụng kho proxy: ${$.proxy.replace(/:([^:@/]+)@/,":***@")}`),Ke===de.proxy&&L("[Proxy] This proxy URL has no {session} placeholder or supported session username pattern; if the provider assigns a fixed endpoint, the exit IP can remain unchanged.")}else L("[Proxy] Proxy pool is disabled or has no usable proxy; registration will use direct/system network, so the exit IP can remain unchanged.");const Me=await window.api.registrationManualPhase1($);if(!Me.success){L(`${n("register.logInitFailed")} ${Me.error}`),N("idle");return}if(L(n("register.logInitDone")),N("email"),A){N("running"),L(`${n("register.logSubmitEmail")} ${A}`);const Ke=await window.api.registrationManualPhase2(A,k.trim()||void 0);Ke.success?(L(n("register.logOtpSent")),N("otp")):(L(`${n("register.logFailed")} ${Ke.error}`),N("idle"))}},Et=async()=>{if(!T.trim())return;N("running"),L(`${n("register.logSubmitEmail")} ${T}`);const A=await window.api.registrationManualPhase2(T.trim(),k.trim()||void 0);A.success?(L(n("register.logOtpSent")),N("otp")):(L(`${n("register.logFailed")} ${A.error}`),N("idle"))},Ge=async()=>{if(!I.trim())return;N("running"),L(`${n("register.logSubmitOtp")} ${I}`);const A=await window.api.registrationManualPhase3(I.trim());if(A.success){const $=A.result;j($),N("done"),Sa({email:$.email,status:$.status,password:$.password,result:$});const de=$.status==="success",Me=ce&&de,Ke=H&&de;Me&&(N("importing"),await Ca($)&&(v(!0),L(n("register.logImported")),Qs(pt=>{const ut=pt.findIndex(un=>un.email===$.email&&!un.imported);if(ut>=0){const un=[...pt];return un[ut]={...un[ut],imported:!0},un}return pt}))),Ke&&(N("fetching-link"),await En($,$.email)),(Me||Ke)&&N("finalized")}else L(`${n("register.logFailed")} ${A.error}`),N("idle")},gt=async()=>{N("running"),Oa=[],f([]),j(null),v(!1),ou="";const A=i==="tempmail"?"TempMail.Plus":i==="tingamefi"?"Tingamefi Mail":i==="proton"?"Proton":"Outlook";L(n("register.logAutoStart").replace("{mode}",A));const $={};if(i==="outlook")$.useOutlook=!0,$.outlookData=V;else if(i==="tempmail")$.useTempMailPlus=!0,$.tempMailPlusEmail=B,$.tempMailPlusEpin=K,$.tempMailPlusDomain=te;else if(i==="tingamefi")$.useTingamefiMail=!0,$.tingamefiMailApiUrl=P,$.tingamefiMailAdminPassword=fe,$.tingamefiMailDomain=C;else if(i==="proton"){const Me=Qt();if(!Me){L("[Proton] Chưa cấu hình email gốc hoặc đã dùng hết bí danh dấu chấm"),N("idle");return}$.useProton=!0,$.protonEmail=Me,L(`[Proton] Sử dụng bí danh dấu chấm: ${Me}`)}const de=ae();if(de){const Me=Kf(de.proxy);$.proxy=Me,$.upstreamProxy=de.upstreamProxy,L(`[Proxy] Sử dụng kho proxy: ${String($.proxy).replace(/:([^:@/]+)@/,":***@")}`),Me===de.proxy&&L("[Proxy] This proxy URL has no {session} placeholder or supported session username pattern; if the provider assigns a fixed endpoint, the exit IP can remain unchanged.")}else L("[Proxy] Proxy pool is disabled or has no usable proxy; registration will use direct/system network, so the exit IP can remain unchanged.");try{const Me=await window.api.registrationStartAuto($);Me.success&&Me.result?await di(Me.result):Me.success||(L(`${n("register.logStartFailed")} ${Me.error}`),N("idle"))}catch(Me){L(`${n("register.logStartFailed")} ${Me instanceof Error?Me.message:String(Me)}`),N("idle")}},Ze=async()=>{await window.api.registrationCancel(),L(n("register.logCancelled")),N("idle")},J=async()=>{if(!(!p||p.status!=="success"||!p.refreshToken))try{const A=await window.api.verifyAccountCredentials({refreshToken:p.refreshToken,clientId:p.clientId,clientSecret:p.clientSecret,region:p.region||"us-east-1",authMethod:"IdC",provider:"BuilderId"}),$=Date.now(),de={current:0,limit:0,percentUsed:0,lastUpdated:$};if(A.success&&A.data){const Me=A.data.expiresIn?$+A.data.expiresIn*1e3:$+36e5,Ke=A.data.email||p.email,Le=A.data.accessToken||p.accessToken||"",pt=A.data.usage?{...A.data.usage,percentUsed:A.data.usage.limit>0?Math.round(A.data.usage.current/A.data.usage.limit*100):0,lastUpdated:$}:de,ut=await we({email:Ke,password:p.password,idp:"BuilderId",profileArn:Ri,status:"active",credentials:{refreshToken:p.refreshToken,clientId:p.clientId,clientSecret:p.clientSecret,accessToken:Le,csrfToken:"",region:p.region||"us-east-1",authMethod:"IdC",provider:"BuilderId",expiresAt:Me},subscription:{type:A.data.subscriptionType||"Free",title:A.data.subscriptionTitle||"Free Tier"},usage:pt,tags:[],lastUsedAt:$});ut.ok?(v(!0),L(n("register.logImported"))):L(`${n("register.logImportFailed")} ${ut.error}`)}else L(`${n("register.logVerifyFailed")} ${A.error}`)}catch(A){L(`${n("register.logImportFailed")} ${A instanceof Error?A.message:String(A)}`)}},Ne=d==="initializing"||d==="running"||d==="importing"||d==="fetching-link",[et,qe]=g.useState(r.batchCount??1),[Je,Kt]=g.useState(r.batchInterval??5),[Ye,qt]=g.useState(cu),[Jt,Ct]=g.useState(Bl),[O,ne]=g.useState(ga),[ze,_]=g.useState(ya),[ce,Ce]=g.useState(r.batchAutoImport??!0),[Ve,je]=g.useState(r.batchRetries??1),[He,Tt]=g.useState(r.batchConcurrency??1),[H,Se]=g.useState(r.autoFetchProLink??!1),[Xe,Nt]=g.useState(r.proPlanType??"Q_DEVELOPER_STANDALONE_PRO"),[nt,$t]=g.useState(Qr),Bt=g.useRef(mw),[qn,Ot]=g.useState(Date.now());g.useEffect(()=>{if(!Ye)return;const A=setInterval(()=>Ot(Date.now()),1e3);return()=>clearInterval(A)},[Ye]);const ws=g.useMemo(()=>RR(ce,H),[ce,H]),Hs=h.length>0?h[h.length-1]:void 0,Z=DR(d,Hs,ws),he=A=>{cu=A,wj?.(A)},tt=A=>{const $=typeof A=="function"?A(Bl):A;Bl=$,kj?.($)},We=A=>{const $=typeof A=="function"?A(ga):A;ga=$,Sj?.($)},jt=A=>{const $=typeof A=="function"?A(ya):A;ya=$,Cj?.($)},Be=A=>{const $=typeof A=="function"?A(Qr):A;Qr=$,Lp?.($)},ht=g.useRef(!1),It=g.useRef(!1),[gs,wt]=g.useState(!1),Xt=g.useRef(null),Ys=g.useRef(""),Fs=g.useRef(!1),pn=g.useRef(null),Na=g.useCallback(async(A=8e3)=>{const $=pn.current,de=Math.max(5e3,A);return $?window.api.proxyPoolValidate({url:$.url,upstreamProxy:$.upstreamProxy||void 0,testUrl:"https://api.ipify.org?format=json",timeoutMs:de}):window.api.networkRouteValidate({testUrl:"https://api.ipify.org?format=json",timeoutMs:de})},[]),An=g.useCallback((A,$)=>{const de=dc(A);if(!de)return!1;if(!ht.current){const Me=A||"unknown error";ht.current=!0,It.current=!1,wt(!1),L(`[BatchGuard] Stopped batch after ${de.label} in ${$}: ${Me}`),Xt.current&&Vs.getState().updateTask(Xt.current,{status:"failed",error:`${de.label}: ${Me}`,lastMessage:`Stopped after ${de.label}`}),_n.getState().triggerEvent("risk-warning",{title:"Batch stopped after AWS/Kiro auth block",message:`${de.label}: ${Me}`,level:"error",fields:{Context:$,Category:de.category,Error:Me}}),window.api.registrationCancel()}return!0},[L]),as=g.useCallback(A=>{ht.current||(ht.current=!0,It.current=!1,wt(!1),L(`[Proxy] ${A}`),Xt.current&&Vs.getState().updateTask(Xt.current,{status:"failed",error:A,lastMessage:"Stopped by proxy preflight"}),window.api.registrationCancel())},[L]);g.useEffect(()=>{fw=(A,$)=>{if(!cu||ht.current)return;const de=A.trim();if(de){if(!ia){ia=de,L(`[NetworkGuard] Locked batch exit IP to ${de}`);return}ia!==de&&as(`Network route changed during batch (${ia} -> ${de}, item ${$}); batch stopped`)}}},[L,as]);const[Xn,Fi]=g.useState(PR),[wa,Ga]=g.useState(!1),Pc=g.useCallback(()=>{let A=["outlook","tempmail"];try{const $=localStorage.getItem("kiro-register-mixed-sources");$&&(A=JSON.parse($).filter(Me=>Me==="outlook"||Me==="tempmail"||Me==="tingamefi"||Me==="proton"),A.length===0&&(A=["outlook","tempmail"]))}catch{}return{mode:i,outlookData:V,fullName:k,batchCount:et,batchInterval:Je,batchAutoImport:ce,batchRetries:Ve,batchConcurrency:He,autoFetchProLink:H,proPlanType:Xe,tempMailEmail:B,tempMailEpin:K,tempMailDomain:te,tingamefiMailApiUrl:P,tingamefiMailAdminPassword:fe,tingamefiMailDomain:C,protonBaseEmail:X,manualParentEmail:G,manualAnonymousEmail:U,mixedEnabledSources:A}},[i,V,k,et,Je,ce,Ve,He,H,Xe,B,K,te,P,fe,C,X,G,U]),Lc=g.useCallback(A=>{const $=A.config;o($.mode==="moemail"?"outlook":$.mode),le($.outlookData||""),R($.fullName||""),qe($.batchCount??1),Kt($.batchInterval??5),Ce($.batchAutoImport??!0),je($.batchRetries??1),Tt($.batchConcurrency??1),Se($.autoFetchProLink??!1),Nt($.proPlanType??"Q_DEVELOPER_STANDALONE_PRO"),be($.tempMailEmail||""),se($.tempMailEpin||""),Y($.tempMailDomain||""),F($.tingamefiMailApiUrl||"https://temp-email-worker.thienp1301.workers.dev"),pe($.tingamefiMailAdminPassword||""),z($.tingamefiMailDomain||"mail.tingamefi.com"),re($.protonBaseEmail||""),W($.manualParentEmail||""),q($.manualAnonymousEmail??!1),$.mixedEnabledSources&&uo($.mixedEnabledSources),L(`[Mẫu] Đã áp dụng mẫu: ${A.name}`),Ga(!1)},[L]),Oc=g.useCallback(()=>{const A=prompt("Lưu cấu hình hiện tại thành mẫu, nhập tên mẫu:")?.trim();if(!A)return;const de=[{id:Oi(),name:A,config:Pc(),createdAt:Date.now()},...Xn];Fi(de),Hf(de),L(`[Mẫu] Đã lưu mẫu: ${A}`)},[Pc,Xn,L]),Xu=g.useCallback(A=>{if(!confirm("Xóa mẫu này?"))return;const $=Xn.filter(de=>de.id!==A);Fi($),Hf($)},[Xn]),qa=g.useMemo(()=>{const A=new Date;return`kiro-register-quota-${A.getFullYear()}-${A.getMonth()+1}-${A.getDate()}`},[]),[Mn,Yn]=g.useState(()=>{try{return parseInt(localStorage.getItem(qa)||"0",10)||0}catch{return 0}}),vn=g.useCallback(A=>{Yn($=>{const de=$+A;try{localStorage.setItem(qa,String(de))}catch{}return de})},[qa]),[on,Yu]=g.useState(()=>{try{return parseInt(localStorage.getItem("kiro-register-dailyquota-limit")||"0",10)||0}catch{return 0}}),[ka,zc]=g.useState(()=>{try{return localStorage.getItem("kiro-register-schedule-enabled")==="1"}catch{return!1}}),[da,Wu]=g.useState(()=>{try{return localStorage.getItem("kiro-register-schedule-time")||"03:00"}catch{return"03:00"}}),[Ms,Gi]=g.useState(()=>{try{return parseInt(localStorage.getItem("kiro-register-schedule-week-mask")||"127",10)}catch{return 127}});g.useEffect(()=>{try{localStorage.setItem("kiro-register-dailyquota-limit",String(on))}catch{}},[on]),g.useEffect(()=>{try{localStorage.setItem("kiro-register-schedule-enabled",ka?"1":"0")}catch{}},[ka]),g.useEffect(()=>{try{localStorage.setItem("kiro-register-schedule-time",da)}catch{}},[da]),g.useEffect(()=>{try{localStorage.setItem("kiro-register-schedule-week-mask",String(Ms))}catch{}},[Ms]);const oo=g.useRef("");g.useEffect(()=>{if(!ka)return;const A=()=>{if(Ye)return;const de=new Date,Me=`${de.getFullYear()}-${de.getMonth()+1}-${de.getDate()}`;if(oo.current===Me)return;const Ke=de.getDay();if(!(Ms&1<<Ke))return;const[Le,pt]=da.split(":").map(ut=>parseInt(ut,10));de.getHours()===Le&&de.getMinutes()===pt&&(oo.current=Me,L(`[Lịch] Đã đến giờ ${da}, tự động bắt đầu đăng ký hàng loạt`),Qi())},$=setInterval(A,6e4);return A(),()=>clearInterval($)},[ka,da,Ms,Ye]);const[ua,yr]=g.useState(()=>{try{const A=localStorage.getItem("kiro-register-ratelimit-enabled");return A===null?!0:A==="1"}catch{return!0}}),[Xa,Uc]=g.useState(()=>{try{return parseInt(localStorage.getItem("kiro-register-ratelimit-max")||"10",10)||10}catch{return 10}}),[Wn,Qu]=g.useState(()=>{try{return parseInt(localStorage.getItem("kiro-register-ratelimit-burst")||"3",10)||3}catch{return 3}}),[br,$c]=g.useState(()=>{try{return parseInt(localStorage.getItem("kiro-register-backoff-base-sec")||"8",10)||8}catch{return 8}}),[Ya,Zu]=g.useState(()=>{try{return parseInt(localStorage.getItem("kiro-register-backoff-max-sec")||"120",10)||120}catch{return 120}}),[oi,qi]=g.useState(()=>{try{return localStorage.getItem("kiro-register-autobackoff")!=="0"}catch{return!0}}),[Ws,co]=g.useState(()=>{try{const A=localStorage.getItem("kiro-register-autopause-risk");return A===null?!0:A==="1"}catch{return!0}});g.useEffect(()=>{try{localStorage.setItem("kiro-register-ratelimit-enabled",ua?"1":"0")}catch{}},[ua]),g.useEffect(()=>{try{localStorage.setItem("kiro-register-ratelimit-max",String(Xa))}catch{}},[Xa]),g.useEffect(()=>{try{localStorage.setItem("kiro-register-ratelimit-burst",String(Wn))}catch{}},[Wn]),g.useEffect(()=>{try{localStorage.setItem("kiro-register-backoff-base-sec",String(br))}catch{}},[br]),g.useEffect(()=>{try{localStorage.setItem("kiro-register-backoff-max-sec",String(Ya))}catch{}},[Ya]),g.useEffect(()=>{try{localStorage.setItem("kiro-register-autobackoff",oi?"1":"0")}catch{}},[oi]),g.useEffect(()=>{try{localStorage.setItem("kiro-register-autopause-risk",Ws?"1":"0")}catch{}},[Ws]);const xn=g.useRef(null),[js,Wa]=g.useState(null),vr=g.useRef(!1);g.useEffect(()=>{if(!Ye){Wa(null),vr.current=!1;return}const A=setInterval(()=>{if(xn.current){const $=xn.current.snapshot();Wa($),$.riskWarning&&!vr.current?(vr.current=!0,Ws&&!It.current&&(It.current=!0,wt(!0),Xt.current&&Vs.getState().updateTask(Xt.current,{status:"paused"}),L(`[Kiểm soát rủi ro] Đã tự động tạm dừng do tỷ lệ thành công ${Math.round($.successRate*100)}%`)),_n.getState().triggerEvent("risk-warning",{title:"Cảnh báo rủi ro",message:`Tỷ lệ đăng ký hàng loạt giảm còn ${Math.round($.successRate*100)}%${Ws?", đã tự động tạm dừng":", nên tạm dừng để kiểm tra"}`,level:"warn",fields:{成功率:`${Math.round($.successRate*100)}%`,连续失败:$.consecutiveFailures,吞吐:`${$.throughputPerMinute}/min`,动作:Ws?"已自动暂停":"请手动检查"}})):!$.riskWarning&&vr.current&&(vr.current=!1)}},1e3);return()=>clearInterval(A)},[Ye]),g.useEffect(()=>{_R({mode:i,outlookData:V,fullName:k,batchCount:et,batchInterval:Je,batchAutoImport:ce,batchRetries:Ve,batchConcurrency:He,autoFetchProLink:H,proPlanType:Xe,tempMailEmail:B,tempMailEpin:K,tempMailDomain:te,tingamefiMailApiUrl:P,tingamefiMailAdminPassword:fe,tingamefiMailDomain:C,protonBaseEmail:X,manualParentEmail:G,manualAnonymousEmail:U})},[i,V,k,et,Je,ce,Ve,He,H,Xe,B,K,te,P,fe,C,X,G,U]);const cn=g.useMemo(()=>{if(!U)return null;const A=G.trim();if(!A)return{error:"empty"};const $=Ui(A);if(!$)return{error:"invalid"};const de=new Set;for(const ut of ue.values())ut.email&&de.add(ut.email.toLowerCase());for(const ut of Gf())ut.email&&de.add(ut.email.toLowerCase());const Me=Vf(A,de),Ke=CR(A,de),Le=$[0].replace(/\./g,"").length,pt=xj(Le,5);return{...Me,sameRootCount:Ke,totalCapacity:pt,localLen:Le,error:null}},[U,G,ue]),[jr,ci]=g.useState(Gf),Qs=g.useCallback(A=>{Tj?.($=>{const de=typeof A=="function"?A($):A;return $R(de),de})},[]),Sa=g.useCallback(A=>{Qs($=>[{...A,id:Oi(),time:Date.now(),imported:!1},...$])},[Qs]);g.useEffect(()=>{jj=u,Nj=y,Pp=f,wj=qt,kj=Ct,Sj=ne,Cj=_,Lp=$t,Tj=ci,u(lc),y(lu),f([...Oa]),qt(cu),Ct(Bl),ne(ga),_(ya),$t([...Qr])},[]);const Ca=g.useCallback(async A=>{if(Ys.current="",!A.refreshToken||!A.clientId||!A.clientSecret)return Ys.current="Thiếu bộ token để tự động nhập tài khoản",!1;const $=Date.now(),de={current:0,limit:0,percentUsed:0,lastUpdated:$},Me=A.region||"us-east-1",Ke=A.verify;if(Ke&&Ke.alive&&A.accessToken){const Le=String(Ke.email||A.email),pt=$+36e5,ut=String(Ke.subscription||"KIRO FREE"),un=Number(Ke.credit_used)||0,hn=Number(Ke.credit_limit)||0,hs=ut.includes("PRO_PLUS")?"Pro_Plus":ut.includes("PRO")?"Pro":ut.includes("POWER")?"Pro_Plus":"Free",Ht=await we({email:Le,password:A.password,idp:"BuilderId",profileArn:Ri,status:"active",credentials:{refreshToken:A.refreshToken,clientId:A.clientId,clientSecret:A.clientSecret,accessToken:A.accessToken||"",csrfToken:"",region:Me,authMethod:"IdC",provider:"BuilderId",expiresAt:pt},subscription:{type:hs,title:ut},usage:hn>0?{current:un,limit:hn,percentUsed:Math.round(un/hn*100),lastUpdated:$}:de,tags:[],lastUsedAt:$});return Ht.ok?!0:(Ys.current=Ht.error||"Model liveness check failed",!1)}try{const Le=await window.api.verifyAccountCredentials({refreshToken:A.refreshToken,clientId:A.clientId,clientSecret:A.clientSecret,region:Me,authMethod:"IdC",provider:"BuilderId"});if(Le.success&&Le.data){const pt=Le.data.expiresIn?$+Le.data.expiresIn*1e3:$+36e5,ut=Le.data.accessToken||A.accessToken||"",un=Le.data.email||A.email,hn=Le.data.usage?{...Le.data.usage,percentUsed:Le.data.usage.limit>0?Math.round(Le.data.usage.current/Le.data.usage.limit*100):0,lastUpdated:$}:de,hs=await we({email:un,password:A.password,idp:"BuilderId",status:"active",profileArn:Ri,credentials:{refreshToken:A.refreshToken,clientId:A.clientId,clientSecret:A.clientSecret,accessToken:ut,csrfToken:"",region:Me,authMethod:"IdC",provider:"BuilderId",expiresAt:pt},subscription:{type:Le.data.subscriptionType||"Free",title:Le.data.subscriptionTitle||"Free Tier"},usage:hn,tags:[],lastUsedAt:$});if(!hs.ok)return Ys.current=hs.error||"Model liveness check failed",!1}else{const pt=Le.error||"Lỗi không xác định";return Ys.current=pt,L(`[Nhập] ${A.email}: kiểm tra thông tin đăng nhập thất bại: ${pt}`),!1}return!0}catch(Le){const pt=Le instanceof Error?Le.message:String(Le);return Ys.current=pt,L(`[Nhập] ${A.email}: kiểm tra thông tin đăng nhập thất bại: ${pt}`),!1}},[we,L]),En=g.useCallback(async(A,$)=>{const de=A.accessToken;if(!de)return;const Me=Oi();bR({accountId:Me,email:$,status:"loading"});try{L(`[Pro Link] ${$}: ${n("register.fetchingProLink")} (${Xe.replace("Q_DEVELOPER_STANDALONE_","")})...`);const Ke=await window.api.accountGetSubscriptionUrl(de,Xe,A.region||"us-east-1",Ri,void 0,"BuilderId","IdC",void 0);if(Ke.success&&Ke.url)return L(`[Pro Link] ${$}: ${Ke.url}`),_f(Me,{status:"success",url:Ke.url}),Ke.url;const Le=Ke.error||"Failed to get link";L(`[Pro Link] ${$}: ${Le}`),_f(Me,{status:"error",error:Le});return}catch(Ke){const Le=Ke instanceof Error?Ke.message:String(Ke);L(`[Pro Link] ${$}: ${Le}`),_f(Me,{status:"error",error:Le});return}},[L,n]),di=g.useCallback(async A=>{const $=OR(A);if(ou!==$)if(ou=$,j(A),N("done"),A.status==="success"){L(`${n("register.logRegSuccess")} ${A.email}`),Sa({email:A.email,status:"success",password:A.password,result:A}),_n.getState().triggerEvent("register-success",{title:"Đăng ký tài khoản thành công",message:`Đã đăng ký xong tài khoản mới ${A.email}`,level:"success",fields:{Email:A.email,"Chế độ":i}});const de=ce,Me=H;de&&(N("importing"),await Ca(A)&&(v(!0),L(n("register.logImported")),Qs(Le=>{const pt=Le.findIndex(ut=>ut.email===A.email&&!ut.imported);if(pt>=0){const ut=[...Le];return ut[pt]={...ut[pt],imported:!0},ut}return Le}))),Me&&(N("fetching-link"),await En(A,A.email)),(de||Me)&&N("finalized")}else{if(L(`${n("register.logRegFailed")} ${A.error}`),Sa({email:A.email,status:A.status,error:A.error,password:A.password,result:A}),A.email&&cc(A.error)==="email_used"){const de=Yl();de.add(A.email.toLowerCase()),Dp(de),L(`[Kiểm tra trước] Đã thêm email ${A.email} vào danh sách email đã sử dụng`)}_n.getState().triggerEvent("register-failed",{title:"Đăng ký tài khoản thất bại",message:`Đăng ký ${A.email||"(email không xác định)"} thất bại`,level:"error",fields:{Email:A.email||"-",Lỗi:A.error||"-","Chế độ":i}})}},[L,Sa,n,ce,Ca,H,En,i]);g.useEffect(()=>{const A=window.api.onRegistrationComplete(di);return()=>A()},[di]);const[dn,uo]=g.useState(()=>{try{const A=localStorage.getItem("kiro-register-mixed-sources");if(A){const de=JSON.parse(A).filter(Me=>Me==="outlook"||Me==="tempmail"||Me==="tingamefi"||Me==="proton");return de.length>0?de:["outlook","tempmail"]}}catch{}return["outlook","tempmail"]}),[ha,Xi]=g.useState(()=>{try{const A=localStorage.getItem("kiro-register-mixed-weights");if(A){const $=JSON.parse(A);return{outlook:$.outlook??1,tempmail:$.tempmail??1,tingamefi:$.tingamefi??1,proton:$.proton??1}}}catch{}return{outlook:1,tempmail:1,tingamefi:1,proton:1}});g.useEffect(()=>{try{localStorage.setItem("kiro-register-mixed-sources",JSON.stringify(dn))}catch{}},[dn]),g.useEffect(()=>{try{localStorage.setItem("kiro-register-mixed-weights",JSON.stringify(ha))}catch{}},[ha]);const Nr=g.useRef({outlook:0,tempmail:0,tingamefi:0,proton:0}),Gs=g.useCallback(()=>{const A=dn.filter(Ke=>Ke==="outlook"?!!V.trim():Ke==="tempmail"?!!(te.trim()&&B.trim()&&K.trim()):Ke==="tingamefi"?!!(P.trim()&&fe.trim()&&C.trim()):Ke==="proton"?!!X.trim():!1);if(A.length===0)return null;if(A.length===1)return A[0];let $=0;for(const Ke of A)$+=Math.max(0,ha[Ke]||0);$===0&&($=A.length);let de=null,Me=-1/0;for(const Ke of A){const Le=Math.max(0,ha[Ke]||0)||1;Nr.current[Ke]=(Nr.current[Ke]||0)+Le,Nr.current[Ke]>Me&&(de=Ke,Me=Nr.current[Ke])}return de&&(Nr.current[de]-=$),de},[dn,ha,V,te,B,K,P,fe,C,X]),Ta=g.useCallback(()=>{const A={},$=i==="mixed"?Gs():i==="manual"?null:i;if($==="tempmail")A.useTempMailPlus=!0,A.tempMailPlusEmail=B,A.tempMailPlusEpin=K,A.tempMailPlusDomain=te;else if($==="outlook")A.useOutlook=!0,A.outlookData=V;else if($==="tingamefi")A.useTingamefiMail=!0,A.tingamefiMailApiUrl=P,A.tingamefiMailAdminPassword=fe,A.tingamefiMailDomain=C;else if($==="proton"){A.useProton=!0;const de=Qt();de&&(A.protonEmail=de)}return A},[i,Gs,V,B,K,te,P,fe,C,Qt]),{proxyPool:Yi,proxyPoolConfig:wr,pickNextProxy:Ju,reportProxyResult:ho}=vt(),kr=g.useRef([]),ui=g.useCallback(async(A,$,de)=>{for(let Me=0;Me<=de;Me++){for(;It.current&&!ht.current;)await new Promise(Ht=>setTimeout(Ht,300));if(ht.current)return{success:!1};if(Me>0){Be(Ht=>Ht.map(mn=>mn.id===A?{...mn,status:"retrying",retryCount:Me}:mn)),L(n("register.batchRetrying").replace("{current}",String(Me)).replace("{max}",String(de)));for(let Ht=0;Ht<30&&!ht.current;Ht++)await new Promise(mn=>setTimeout(mn,100));if(ht.current)return{success:!1}}else Be(Ht=>Ht.map(mn=>mn.id===A?{...mn,status:"running"}:mn));const Ke=Ta(),Le={...Ke,taskId:$};if(Ke.useOutlook&&kr.current.length>0){const Ht=kr.current.shift();Ht&&(Le.outlookData=Ht,L(`[Outlook] Đã phân bổ email: ${Ht.split("----")[0]}`))}const pt=vt.getState(),ut=pt.proxyPoolConfig,un=pt.proxyPool;let hn=null;if(!ut.enabled)Fs.current||(Fs.current=!0,L("[Proxy] Proxy pool is disabled; registration will use direct/system network, so the exit IP can remain unchanged."));else{if(un.size===0)return as("代理池已启用但池中无任何代理,已中止批量注册(请先在「代理池」页面添加代理)"),{success:!1,result:{status:"failed",email:"",error:"代理池已启用但池为空"}};const Ht=pn.current;if(!Ht)return as("Proxy pool is enabled but no stable batch route was pinned"),{success:!1,result:{status:"failed",email:"",error:"No stable batch proxy route"}};hn=Ht.entry,Le.proxy=Ht.url,Le.strictProxy=!0,Ht.upstreamProxy&&(Le.upstreamProxy=Ht.upstreamProxy),L(`[NetworkGuard] Reusing pinned route ${hn.protocol}://${hn.host}:${hn.port}`)}const hs=await window.api.registrationStartAuto(Le);if(hn){const Ht=hs.success&&hs.result?.status==="success",mn=hs.result?.email,Aa=hs.error||hs.result?.error;pt.reportProxyResult(hn.id,Ht,mn,Aa)}if(hs.success&&hs.result){const Ht=hs.result;if(Ht.status==="success")return{success:!0,result:Ht};if(An(Ht.error||hs.error,`registration ${Ht.email||A}`))return{success:!1,result:Ht};if(Me===de)return{success:!1,result:Ht}}else if(!hs.success){if(An(hs.error,`registration ${A}`))return{success:!1,result:{status:"failed",email:"",error:hs.error||"terminal registration error"}};if(Me===de)return{success:!1}}}return{success:!1}},[L,n,Yi,wr.enabled,Ju,ho,Ta,An,as]),Wi=async(A,$)=>{if($.success&&$.result){if(We(de=>de+1),on>0&&vn(1),Be(de=>de.map(Me=>Me.id===A?{...Me,status:"success",email:$.result.email}:Me)),Sa({email:$.result.email,status:"success",password:$.result.password,result:$.result}),ce){const de=await Ca($.result),Me=Ys.current;Be(Ke=>Ke.map(Le=>Le.id===A?{...Le,status:de?"imported":"import_failed",error:de?void 0:Me||"auto import failed"}:Le)),de?(L(n("register.logImported")),Qs(Ke=>{const Le=Ke.findIndex(pt=>pt.email===$.result.email&&!pt.imported);if(Le>=0){const pt=[...Ke];return pt[Le]={...pt[Le],imported:!0},pt}return Ke})):An(Me,`auto import ${$.result.email}`)}H&&await En($.result,$.result.email)}else{jt(Le=>Le+1);const de=$.result?.email||"",Me=$.result?.error||"unknown";Be(Le=>Le.map(pt=>pt.id===A?{...pt,status:"failed",email:de,error:Me}:pt)),$.result&&Sa({email:de,status:"failed",error:Me});const Ke=cc(Me);if(de&&Ke==="email_used"){const Le=Yl();Le.add(de.toLowerCase()),Dp(Le),L(`[Kiểm tra trước] Đã thêm email ${de} vào danh sách email đã sử dụng`)}Ke==="risk_control"&&Ws&&!It.current&&(It.current=!0,wt(!0),Xt.current&&Vs.getState().updateTask(Xt.current,{status:"paused"}),L(`[Kiểm soát rủi ro] AWS đã hạn chế ${de||"tài khoản"}, tự động tạm dừng đăng ký hàng loạt`),_n.getState().triggerEvent("risk-warning",{title:"AWS đã chặn yêu cầu, tác vụ đã tự động tạm dừng",message:`Tài khoản ${de||"(đang tạo)"} đã chạm giới hạn bảo mật AWS. Hệ thống đã dừng đăng ký hàng loạt; hãy kiểm tra email hạn chế, giảm tốc độ và xác minh tài khoản theo hướng dẫn AWS/Kiro.`,level:"error",fields:{Email:de||"-",Lỗi:Me}}))}tt(de=>de+1)},Qi=async A=>{if(i==="manual")return;if(on>0){const kt=Math.max(0,on-Mn);if(kt===0){L(`[Hạn mức] Đã hết hạn mức hôm nay (${Mn}/${on}), không khởi chạy`),alert(`Đã dùng hết quota đăng ký hôm nay (${Mn}/${on})`);return}const Rt=A?A.length:et;Rt>kt&&(L(`[Hạn mức] Yêu cầu ${Rt} tài khoản nhưng hôm nay chỉ còn ${kt}, tự động giảm xuống ${kt}`),A||qe(kt))}const $=vt.getState();let de=$.proxyPoolConfig,Me=$.proxyPool;if(!de.enabled&&(!$.hasLoadedStorage||$.isLoading))try{const kt=await window.api.loadAccounts(),Rt=kt&&kt.proxyPoolConfig&&typeof kt.proxyPoolConfig=="object"?{...de,...kt.proxyPoolConfig}:null;kt&&Rt?.enabled&&(de=Rt,Me=kt.proxyPool&&typeof kt.proxyPool=="object"?new Map(Object.entries(kt.proxyPool)):new Map,vt.setState({proxyPool:Me,proxyPoolConfig:de,proxyPoolCursor:typeof kt.proxyPoolCursor=="number"?kt.proxyPoolCursor:$.proxyPoolCursor}))}catch(kt){L(`[Proxy] Failed to reload proxy pool config before batch: ${kt instanceof Error?kt.message:String(kt)}`)}if(pn.current=null,ia=null,ht.current=!1,It.current=!1,de.enabled){const kt=Array.from(Me.values()).filter(Ma=>Ma.enabled&&Ma.status!=="dead").length;if(Me.size===0){N("idle"),he(!1),wt(!1),tt(0),We(0),jt(0),Be([]),L("[Proxy] Kho proxy đã bật nhưng đang trống, chưa bắt đầu đăng ký hàng loạt");return}if(kt===0){N("idle"),he(!1),wt(!1),tt(0),We(0),jt(0),Be([]),L("[Proxy] Kho proxy đã bật nhưng không có proxy khả dụng, chưa bắt đầu đăng ký hàng loạt");return}const Rt=vt.getState().pickNextProxy();if(!Rt){N("idle"),he(!1),wt(!1),tt(0),We(0),jt(0),Be([]),L("[NetworkGuard] Could not pin a stable route for this batch");return}const In=Kf(Rt.url);pn.current={entry:Rt,url:In,upstreamProxy:de.upstreamProxy?.trim()||""},L(`[NetworkGuard] Pinned ${Rt.protocol}://${Rt.host}:${Rt.port} for the entire batch`)}else pn.current=null;L("[NetworkGuard] Checking the batch network route before launch...");let Ke;try{Ke=await Na(de.testTimeoutMs||8e3)}catch(kt){Ke={success:!1,error:kt instanceof Error?kt.message:String(kt)}}if(!Ke.success||!Ke.externalIp){N("idle"),he(!1),wt(!1),tt(0),We(0),jt(0),Be([]),pn.current=null,L(`[NetworkGuard] Batch not started because the exit IP could not be verified: ${Ke.error||"missing exit IP"}`);return}ia=Ke.externalIp,L(`[NetworkGuard] Preflight passed: exit IP ${Ke.externalIp}, ${Ke.latencyMs??0}ms${Ke.route?`, route ${Ke.route}`:""}`),he(!0),Fs.current=!1,wt(!1);let Le;if(A&&A.length>0){Le=A.map(Rt=>({...Rt,status:"pending",error:void 0,retryCount:0}));const kt=new Set(Le.map(Rt=>Rt.id));Be(Rt=>[...Rt.filter(In=>!kt.has(In.id)),...Le]),tt(0),We(0),jt(0)}else tt(0),We(0),jt(0),Le=Array.from({length:et},(kt,Rt)=>({id:Oi(),index:Rt+1,status:"pending",email:"",retryCount:0})),Be(Le);const pt=Math.max(1,He),ut=Le.length;if((i==="outlook"||i==="mixed"&&dn.includes("outlook"))&&V.trim()){const kt=V.split(`
|
|
131
|
+
`).map(Rt=>Rt.trim()).filter(Rt=>Rt.includes("----"));for(let Rt=kt.length-1;Rt>0;Rt--){const In=Math.floor(Math.random()*(Rt+1));[kt[Rt],kt[In]]=[kt[In],kt[Rt]]}kr.current=kt,kt.length<ut?L(`[Outlook] Cảnh báo: kho chỉ có ${kt.length} email cho ${ut} tác vụ, phần vượt quá sẽ dùng lại ngẫu nhiên`):L(`[Outlook] Kho email đã sẵn sàng (${kt.length} email, phân bổ sau khi xáo trộn)`)}else kr.current=[];if(N("running"),ua){const kt={maxPerMinute:Xa,burst:Wn,backoffBaseMs:br*1e3,backoffMaxMs:Ya*1e3,consecutiveFailureThreshold:oi?5:999999};xn.current?(xn.current.updateConfig(kt),xn.current.reset()):xn.current=gR(kt),L(`[Giới hạn tốc độ] Đã bật: ${Xa}/phút, burst=${Wn}, chờ ${br}~${Ya} giây, tự động chờ: ${oi?"bật":"tắt"}`)}else xn.current=null;const hs=Vs.getState().createTask({kind:"register-batch",title:A?`Thử lại ${ut} tác vụ thất bại`:`Đăng ký hàng loạt ${ut} tài khoản`,subtitle:`${i==="outlook"?"Outlook":i==="tempmail"?"TempMail.Plus":i==="tingamefi"?"Tingamefi":i==="mixed"?"Hỗn hợp":"Thủ công"}, đồng thời ${pt}${de.enabled?" + kho proxy":""}${ua?` + ${Xa}/phút`:""}`,total:ut,onPause:()=>{It.current=!0,wt(!0),Vs.getState().updateTask(hs,{status:"paused"})},onResume:()=>{It.current=!1,wt(!1),Vs.getState().updateTask(hs,{status:"running"})},onCancel:()=>{ht.current=!0,window.api.registrationCancel()}});Xt.current=hs;const Ht=new Set;let mn=0;for(let kt=0;kt<Le.length;kt++){if(ht.current){L(n("register.batchStopped").replace("{done}",String(mn)).replace("{total}",String(ut)));break}for(;It.current&&!ht.current;)await new Promise(Rn=>setTimeout(Rn,500));if(ht.current||xn.current&&(await xn.current.waitForSlot({get aborted(){return ht.current}}),ht.current))break;let Rt;try{Rt=await Na(de.testTimeoutMs||8e3)}catch(Rn){Rt={success:!1,error:Rn instanceof Error?Rn.message:String(Rn)}}if(!Rt.success||!Rt.externalIp){as(`Network route check failed before task ${kt+1}/${ut}: ${Rt.error||"missing exit IP"}`);break}if(ia&&Rt.externalIp!==ia){as(`Network route changed before task ${kt+1}/${ut} (${ia} -> ${Rt.externalIp}); batch stopped`);break}ia=Rt.externalIp,L(`[NetworkGuard] Task ${kt+1}/${ut} route verified: ${Rt.externalIp}, ${Rt.latencyMs??0}ms`);const In=Le[kt].id,Ma=`batch-${In.slice(0,8)}`;Bt.current.set(Ma,In),L(`--- Batch ${kt+1}/${ut} ---`),mn++;const Fc=(async()=>{const Rn=await ui(In,Ma,Ve);Bt.current.delete(Ma),await Wi(In,Rn),xn.current&&xn.current.reportResult(Rn.success);const fo=Ff(Bl,ut);Vs.getState().updateTask(hs,{done:fo,successCount:ga,failedCount:ya,progress:ut>0?Math.round(fo/ut*100):0})})().finally(()=>Ht.delete(Fc));Ht.add(Fc),Ht.size>=pt&&await Promise.race(Ht),kt<Le.length-1&&!ht.current&&Je>0&&await new Promise(Rn=>setTimeout(Rn,Je*1e3))}await Promise.all(Ht);const Aa=ht.current,Hc=Ff(Bl,ut);he(!1),wt(!1),N("idle"),L(Aa?n("register.batchStopped").replace("{done}",String(Hc)).replace("{total}",String(ut)):n("register.batchCompleted"));const th=Vs.getState().tasks.get(hs);Aa?th?.status!=="cancelled"&&Vs.getState().completeTask(hs,{successCount:ga,failedCount:ya,error:"Batch stopped before all tasks finished"}):Vs.getState().completeTask(hs,{successCount:ga,failedCount:ya}),Xt.current=null,_n.getState().triggerEvent(Aa?"batch-error":"batch-completed",{title:Aa?`Đăng ký hàng loạt${A?" thử lại":""} đã dừng`:`Đăng ký hàng loạt${A?" thử lại":""} đã hoàn tất`,message:Aa?`Tổng ${ut} tác vụ, đã hoàn thành ${Hc}, thành công ${ga}, thất bại ${ya}`:`Tổng ${ut} tác vụ, thành công ${ga}, thất bại ${ya}`,level:Aa?"error":ya===0?"success":ga===0?"error":"warn",fields:{"Chế độ":i==="outlook"?"Outlook":i==="tempmail"?"TempMail.Plus":i==="tingamefi"?"Tingamefi":i==="mixed"?"Hỗn hợp":"Thủ công","Đồng thời":pt,"Thành công":ga,"Thất bại":ya,Tổng:ut}}),pn.current=null,ia=null},eh=()=>{Ye&&(It.current?(It.current=!1,wt(!1),Xt.current&&Vs.getState().updateTask(Xt.current,{status:"running"})):(It.current=!0,wt(!0),Xt.current&&Vs.getState().updateTask(Xt.current,{status:"paused"})))},Bc=()=>{ht.current=!0,It.current=!1,wt(!1),L("[Hàng loạt] Đang dừng và hủy các yêu cầu đang chạy..."),window.api.registrationCancel(),Xt.current&&(Vs.getState().cancelTask(Xt.current),Xt.current=null)},_c=A=>{const $=Qr.filter(de=>de.status!=="failed"&&de.status!=="import_failed"||dc(de.error)?!1:!A||A==="all"?!0:cc(de.error)===A);if($.length===0){L("[Thử lại] Không có tác vụ thất bại phù hợp để thử lại");return}L(`[Thử lại] Thử lại ${$.length} tác vụ thất bại (bộ lọc: ${A||"tất cả"})`),Qi($)},mo=async A=>{if(!A.result||A.result.status!=="success"||!A.result.refreshToken)return;const $=A.result;try{const de=await window.api.verifyAccountCredentials({refreshToken:$.refreshToken,clientId:$.clientId,clientSecret:$.clientSecret,region:$.region||"us-east-1",authMethod:"IdC",provider:"BuilderId"}),Me=Date.now(),Ke={current:0,limit:0,percentUsed:0,lastUpdated:Me};let Le=null;if(de.success&&de.data){const pt=de.data.expiresIn?Me+de.data.expiresIn*1e3:Me+36e5,ut=de.data.usage?{...de.data.usage,percentUsed:de.data.usage.limit>0?Math.round(de.data.usage.current/de.data.usage.limit*100):0,lastUpdated:Me}:Ke;Le=await we({email:de.data.email||$.email,idp:"BuilderId",status:"active",profileArn:Ri,credentials:{refreshToken:$.refreshToken,clientId:$.clientId,clientSecret:$.clientSecret,accessToken:de.data.accessToken||$.accessToken||"",csrfToken:"",region:$.region||"us-east-1",authMethod:"IdC",provider:"BuilderId",expiresAt:pt},subscription:{type:de.data.subscriptionType||"Free",title:de.data.subscriptionTitle||"Free Tier"},usage:ut,tags:[],lastUsedAt:Me})}else Le=await we({email:$.email,idp:"BuilderId",status:"active",profileArn:Ri,credentials:{refreshToken:$.refreshToken,clientId:$.clientId,clientSecret:$.clientSecret,accessToken:$.accessToken||"",csrfToken:"",region:$.region||"us-east-1",authMethod:"IdC",provider:"BuilderId",expiresAt:Me+36e5},subscription:{type:"Free",title:"Free Tier"},usage:Ke,tags:[],lastUsedAt:Me});Le?.ok&&Qs(pt=>pt.map(ut=>ut.id===A.id?{...ut,imported:!0}:ut))}catch{}},Zi=Math.max(0,nt.length||et),Vc=Ff(Jt,Zi),Kc=Array.from(new Set(nt.map(A=>A.exitIp?.trim()).filter(A=>!!A))),Ji=ia||Kc[0],el=!!Ji&&Kc.some(A=>A!==Ji);return e.jsxs("div",{className:"flex-1 p-6 space-y-6 overflow-auto",children:[e.jsxs("div",{className:"page-hero p-6",children:[e.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-primary/20 to-transparent rounded-full blur-2xl"}),e.jsx("div",{className:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-primary/20 to-transparent rounded-full blur-2xl"}),e.jsxs("div",{className:"relative flex items-center gap-4",children:[e.jsx("div",{className:"p-3 rounded-xl bg-primary/10",children:e.jsx(zu,{className:"h-7 w-7 text-primary"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-primary",children:n("register.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s?"Register new Kiro accounts automatically or manually":"Đăng ký tài khoản Kiro tự động hoặc thủ công"})]})]})]}),e.jsxs(De,{className:"hover-lift",children:[e.jsx(at,{className:"pb-3",children:e.jsxs(rt,{className:"text-base flex items-center gap-2",children:[e.jsx(Ka,{className:"h-4 w-4 text-primary"}),n("register.mode")]})}),e.jsxs(Pe,{className:"space-y-4",children:[e.jsx("div",{className:"flex gap-1 p-1 bg-muted rounded-lg w-fit",children:[["manual",n("register.manual")],["outlook","Outlook"],["tempmail",n("register.tempmail")],["tingamefi","Tingamefi"],["proton","Proton"],["mixed",s?"Mixed":"Kết hợp"]].map(([A,$])=>e.jsx("button",{onClick:()=>o(A),disabled:Ne||Ye,className:me("px-4 py-1.5 rounded-md text-sm font-medium transition-colors disabled:opacity-50",i===A?"bg-background shadow text-foreground":"text-muted-foreground hover:text-foreground"),children:$},A))}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(is,{checked:ce,onCheckedChange:Ce,disabled:Ne||Ye}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ns,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm",children:n("register.batchAutoImport")}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["— ",n("register.batchAutoImportDesc")]})]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(is,{checked:H,onCheckedChange:Se,disabled:Ne||Ye}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ql,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm",children:n("register.autoFetchProLink")}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["— ",n("register.autoFetchProLinkDesc")]})]})]}),H&&e.jsxs("div",{className:"ml-11 flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:s?"Plan:":"Gói:"}),[{value:"Q_DEVELOPER_STANDALONE_PRO",label:"Pro",color:"bg-blue-500"},{value:"Q_DEVELOPER_STANDALONE_PRO_PLUS",label:"Pro+",color:"bg-purple-500"},{value:"Q_DEVELOPER_STANDALONE_POWER",label:"Power",color:"bg-amber-500"}].map(A=>e.jsxs("button",{type:"button",onClick:()=>Nt(A.value),disabled:Ne||Ye,className:`px-3 h-7 rounded-md text-xs font-medium transition-all flex items-center gap-1.5 border ${Xe===A.value?`${A.color} text-white border-transparent shadow-sm`:"bg-background border-border text-muted-foreground hover:text-foreground hover:border-primary/40"} disabled:opacity-50 disabled:cursor-not-allowed`,children:[Xe===A.value&&e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-white"}),A.label]},A.value)),e.jsx("span",{className:"text-[10px] text-muted-foreground ml-1 italic",children:s?"(Plan ID will be sent to Kiro API)":"(Plan ID sẽ được gửi như loại đăng ký)"})]})]}),(i==="outlook"||i==="mixed"&&dn.includes("outlook"))&&e.jsxs("div",{className:"p-4 bg-muted/30 rounded-lg border border-dashed space-y-1.5",children:[e.jsxs(Fe,{children:[n("register.outlookAccounts")," (",n("register.outlookFormat"),")"]}),e.jsx("textarea",{value:V,onChange:A=>le(A.target.value),placeholder:n("register.outlookPlaceholder"),rows:3,disabled:Ne||Ye,className:"w-full px-3 py-2 bg-background border rounded-lg text-sm font-mono disabled:opacity-50 resize-none"})]}),i==="mixed"&&e.jsxs("div",{className:"p-4 bg-muted/30 rounded-lg border border-dashed space-y-3",children:[e.jsx(Fe,{children:s?"Enabled email sources (Weighted Round-Robin)":"Nguồn email đang bật (xoay tua có trọng số)"}),e.jsx("div",{className:"space-y-2",children:["outlook","tempmail","tingamefi","proton"].map(A=>{const $=dn.includes(A),de=A==="outlook"?"Outlook":A==="tempmail"?"TempMail.Plus":A==="tingamefi"?"Tingamefi":"Proton",Me=A==="outlook"?!!V.trim():A==="proton"?!!X.trim():A==="tingamefi"?!!(P.trim()&&fe.trim()&&C.trim()):!!(te.trim()&&B.trim()&&K.trim());return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>{uo(Ke=>$?Ke.filter(Le=>Le!==A):[...Ke,A])},disabled:Ne||Ye,className:me("flex-1 px-3 py-2 rounded-md border text-sm transition-colors flex items-center gap-2",$?"border-primary bg-primary/10 text-primary font-medium":"border-border hover:border-primary/50",!Me&&"opacity-60"),title:Me?"":"Nguồn này chưa được cấu hình, sẽ bị bỏ qua",children:[$?e.jsx(an,{className:"h-4 w-4"}):e.jsx(Cn,{className:"h-4 w-4"}),de,!Me&&e.jsx("span",{className:"text-[10px] text-amber-500 ml-auto",children:s?"not configured":"Chưa cấu hình"})]}),$&&Me&&e.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[e.jsx("span",{className:"text-muted-foreground",children:s?"Weight:":"Trọng số:"}),e.jsx(it,{type:"number",min:0,max:100,value:ha[A]||0,onChange:Ke=>{const Le=parseInt(Ke.target.value,10);!isNaN(Le)&&Le>=0&&Xi(pt=>({...pt,[A]:Le}))},disabled:Ne||Ye,className:"h-8 w-16 text-xs text-center"})]})]},A)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s?"Smooth Weighted Round-Robin: e.g. moemail=4 + tempmail=1 means 80% / 20%. Set 0 to disable.":"Xoay tua có trọng số: ví dụ moemail=4 + tempmail=1 tương đương 80% / 20%. Trọng số 0 nghĩa là không tham gia."}),dn.length===0&&e.jsx("p",{className:"text-xs text-amber-500",children:s?"Please enable at least one source.":"Vui lòng bật ít nhất một nguồn."})]}),(i==="tempmail"||i==="mixed"&&dn.includes("tempmail"))&&e.jsxs("div",{className:"p-4 bg-muted/30 rounded-lg border border-dashed space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Fe,{children:n("register.tempMailDomain")}),e.jsx(it,{value:te,onChange:A=>Y(A.target.value),placeholder:"example.com domain2.com domain3.com",disabled:Ne||Ye,className:"font-mono text-xs"}),te.trim()&&(()=>{const A=te.split(/[\s,;]+/).filter(Boolean);return A.length>1?e.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["Pool domain có ",A.length," domain, hãy đảm bảo nguồn ổn định và hợp lệ"]}):e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Có thể nhập nhiều domain đã được ủy quyền, phân tách bằng khoảng trắng hoặc dấu phẩy"})})()]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Fe,{children:n("register.tempMailEmail")}),e.jsx(it,{value:B,onChange:A=>be(A.target.value),placeholder:n("register.tempMailEmailPlaceholder"),disabled:Ne||Ye})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Fe,{children:n("register.tempMailEpin")}),e.jsx(it,{type:"password",value:K,onChange:A=>se(A.target.value),disabled:Ne||Ye})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:n("register.tempMailDesc")})]}),(i==="tingamefi"||i==="mixed"&&dn.includes("tingamefi"))&&e.jsxs("div",{className:"p-4 bg-muted/30 rounded-lg border border-dashed space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"space-y-1.5 md:col-span-3",children:[e.jsx(Fe,{children:"Tingamefi Worker API"}),e.jsx(it,{value:P,onChange:A=>F(A.target.value),placeholder:"https://temp-email-worker.thienp1301.workers.dev",disabled:Ne||Ye,className:"font-mono text-xs"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Fe,{children:"Domain"}),e.jsx(it,{value:C,onChange:A=>z(A.target.value),placeholder:"mail.tingamefi.com",disabled:Ne||Ye,className:"font-mono text-xs"})]}),e.jsxs("div",{className:"space-y-1.5 md:col-span-2",children:[e.jsx(Fe,{children:"Admin password"}),e.jsx(it,{type:"password",value:fe,onChange:A=>pe(A.target.value),placeholder:"admin123456",disabled:Ne||Ye,autoComplete:"off"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s?"Creates a fresh address via /admin/new_address and reads AWS verification mail from /admin/mails.":"Tạo địa chỉ mới qua /admin/new_address và đọc mail xác thực AWS từ /admin/mails."})]}),(i==="proton"||i==="mixed"&&dn.includes("proton"))&&e.jsxs("div",{className:"p-4 bg-muted/30 rounded-lg border border-dashed space-y-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Fe,{children:s?"Proton base email (dot-alias parent)":"Email Proton gốc (tạo alias bằng dấu chấm)"}),e.jsx(it,{type:"email",value:X,onChange:A=>re(A.target.value),placeholder:"evanbartellchae@protonmail.com",disabled:Ne||Ye,autoComplete:"off",spellCheck:!1,className:"font-mono text-xs"}),X.trim()&&(()=>{const A=Ui(X.trim());if(!A)return e.jsx("p",{className:"text-[11px] text-destructive",children:s?"Invalid email":"Email không hợp lệ"});const $=A[0].replace(/\./g,"").length,de=xj($,5);return e.jsx("p",{className:"text-[11px] text-muted-foreground",children:s?`Auto-generates dot-variants of the local part, ~${de.toLocaleString()} available`:`Tự tạo biến thể dấu chấm cho tên email, còn khoảng ${de.toLocaleString()} địa chỉ khả dụng`})})()]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("button",{type:"button",disabled:Qe,onClick:async()=>{_e(!0);try{const A=await window.api.protonOpenLogin();Ee(A.loggedIn),L(A.loggedIn?s?"[Proton] Already logged in":"[Proton] Đã đăng nhập":s?"[Proton] Please complete login in the popup window":"[Proton] Vui lòng đăng nhập trong cửa sổ bật lên")}catch(A){L(`[Proton] ${A instanceof Error?A.message:String(A)}`)}finally{_e(!1)}},className:"px-3 py-1.5 rounded-md border border-primary bg-primary/10 text-primary text-sm font-medium transition-colors hover:bg-primary/20 disabled:opacity-50",children:Qe?s?"Opening...":"Đang mở...":s?"Login Proton":"Đăng nhập Proton"}),e.jsx("button",{type:"button",disabled:Qe,onClick:async()=>{_e(!0);try{const A=await window.api.protonLoginStatus();Ee(A.loggedIn),L(A.loggedIn?"[Proton] Đã đăng nhập":"[Proton] Chưa đăng nhập")}finally{_e(!1)}},className:"px-3 py-1.5 rounded-md border border-border text-sm transition-colors hover:border-primary/50 disabled:opacity-50",children:s?"Check status":"Kiểm tra trạng thái"}),e.jsx("span",{className:me("text-xs",xe?"text-green-500":"text-muted-foreground"),children:xe?s?"● Logged in":"● Đã đăng nhập":s?"○ Not logged in":"○ Chưa đăng nhập"})]}),e.jsx("p",{className:"text-xs text-muted-foreground leading-snug",children:s?"Reads codes via the official Proton web page (login once, session persists). Each account uses a dot-variant of the base email (e.g. evanbar.tellcha.e@), all landing in the same inbox. Recommended concurrency: 1.":"Dùng trang Proton chính thức để lấy mã xác minh (đăng nhập một lần, giữ phiên). Mỗi tài khoản dùng một biến thể dấu chấm của email gốc, tất cả thư vẫn về cùng một hộp thư. Nên đặt song song = 1."})]})]})]}),i==="manual"&&d==="idle"&&!Ye&&e.jsxs(De,{className:"hover-lift",children:[e.jsx(at,{className:"pb-3",children:e.jsxs(rt,{className:"text-base flex items-center gap-2",children:[e.jsx(c3,{className:"h-4 w-4 text-primary"}),n("register.parentEmailSection")]})}),e.jsxs(Pe,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Fe,{htmlFor:"parentEmail",className:"text-xs",children:n("register.parentEmailLabel")}),e.jsx(it,{id:"parentEmail",type:"email",value:G,onChange:A=>W(A.target.value),placeholder:n("register.parentEmailPlaceholder"),autoComplete:"off",spellCheck:!1}),e.jsx("p",{className:"text-[11px] text-muted-foreground leading-snug",children:n("register.parentEmailHint")})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Fe,{htmlFor:"fullNameIdle",className:"text-xs",children:n("register.fullNameRandom")}),e.jsx(it,{id:"fullNameIdle",value:k,onChange:A=>R(A.target.value),placeholder:n("register.fullNamePlaceholder")})]})]}),e.jsxs("div",{className:"flex items-start gap-3 pt-1",children:[e.jsx(is,{id:"anonymousEmail",checked:U,onCheckedChange:q}),e.jsxs("div",{className:"flex-1 space-y-0.5",children:[e.jsxs(Fe,{htmlFor:"anonymousEmail",className:"cursor-pointer text-sm flex items-center gap-1.5",children:[e.jsx(Kn,{className:"h-3.5 w-3.5 text-primary"}),n("register.anonymousEmailLabel")]}),e.jsx("p",{className:"text-[11px] text-muted-foreground leading-snug",children:n("register.anonymousEmailHint")})]})]}),U&&e.jsxs("div",{className:"text-xs",children:[cn?.error==="empty"&&e.jsxs("div",{className:"flex items-center gap-1.5 text-warning",children:[e.jsx(Va,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:n("register.anonymousNoParent")})]}),cn?.error==="invalid"&&e.jsxs("div",{className:"flex items-center gap-1.5 text-destructive",children:[e.jsx(Va,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:n("register.anonymousInvalid")})]}),cn&&!cn.error&&cn.variant&&e.jsxs("div",{className:"bg-primary/[0.06] border border-primary/20 rounded-md p-2.5 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[e.jsxs("span",{className:"text-muted-foreground flex items-center gap-1",children:[e.jsx(Kn,{className:"h-3 w-3"})," ",n("register.nextVariant"),":"]}),e.jsx("code",{className:"bg-background px-2 py-0.5 rounded font-mono text-foreground border",children:cn.variant})]}),e.jsxs("div",{className:"flex items-center justify-between text-[11px] text-muted-foreground gap-2",children:[e.jsxs("span",{children:[n("register.dotCount"),": ",e.jsx("strong",{className:"text-foreground",children:cn.dotCount})]}),e.jsxs("span",{children:[n("register.sameRoot"),": ",e.jsx("strong",{className:"text-foreground",children:cn.sameRootCount})," / ~",cn.totalCapacity]})]})]}),cn&&!cn.error&&!cn.variant&&e.jsxs("div",{className:"flex items-center gap-1.5 text-warning",children:[e.jsx(Va,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:n("register.anonymousExhausted")})]})]})]})]}),i==="manual"&&d!=="idle"&&e.jsx("div",{className:"bg-card border rounded-xl p-4",children:e.jsx("div",{className:"flex items-center justify-between",children:ws.map((A,$)=>{const de=$===ws.length-1,Me=$<Z,Ke=$===Z,Le=A==="Import"||A==="ProLink";return e.jsxs("div",{className:me("flex items-center",de?"":"flex-1 min-w-0"),children:[e.jsx("div",{className:me("flex items-center justify-center w-8 h-8 rounded-full text-xs font-bold transition-all flex-shrink-0",Me&&(Le?"bg-cyan-500 text-white shadow-sm shadow-cyan-500/30":"bg-green-500 text-white shadow-sm shadow-green-500/30"),Ke&&"bg-primary text-primary-foreground animate-pulse shadow-sm shadow-primary/30",!Me&&!Ke&&"bg-muted text-muted-foreground"),children:Me?e.jsx(an,{className:"h-4 w-4"}):$+1}),e.jsx("span",{className:me("ml-1.5 text-xs font-medium whitespace-nowrap",Me||Ke?"text-foreground":"text-muted-foreground"),children:A}),!de&&e.jsx("div",{className:me("flex-1 h-0.5 mx-2 transition-colors",Me?Le?"bg-cyan-500":"bg-green-500":"bg-muted")})]},A)})})}),e.jsx(De,{className:"hover-lift",children:e.jsxs(Pe,{className:"pt-5 space-y-4",children:[i==="manual"&&d==="email"&&e.jsxs("div",{className:"space-y-4 p-4 bg-muted/30 rounded-lg border border-dashed",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Fe,{children:n("register.emailLabel")}),e.jsx(it,{type:"email",value:T,onChange:A=>S(A.target.value),placeholder:n("register.emailPlaceholder"),onKeyDown:A=>A.key==="Enter"&&Et()})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Fe,{children:n("register.fullNameRandom")}),e.jsx(it,{value:k,onChange:A=>R(A.target.value),placeholder:n("register.fullNamePlaceholder")})]}),e.jsxs(D,{onClick:Et,size:"sm",children:[e.jsx(xx,{className:"h-4 w-4 mr-2"}),n("register.submitEmail")]})]}),i==="manual"&&d==="otp"&&e.jsxs("div",{className:"space-y-4 p-4 bg-muted/30 rounded-lg border border-dashed",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Fe,{children:n("register.otpLabel")}),e.jsx(it,{value:I,onChange:A=>M(A.target.value),placeholder:"123456",maxLength:6,className:"font-mono text-lg tracking-widest",onKeyDown:A=>A.key==="Enter"&&Ge()}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[n("register.otpSentTo")," ",T]})]}),e.jsxs(D,{onClick:Ge,size:"sm",children:[e.jsx(Dc,{className:"h-4 w-4 mr-2"}),n("register.submitOtp")]})]}),e.jsxs("div",{className:"flex gap-3",children:[d==="idle"&&!Ye&&e.jsxs(D,{onClick:i==="manual"?ft:gt,disabled:i==="outlook"&&!V.trim()||i==="tempmail"&&(!te.trim()||!B.trim()||!K.trim())||i==="tingamefi"&&(!P.trim()||!fe.trim()||!C.trim()),children:[e.jsx(Ba,{className:"h-4 w-4 mr-2"}),n("register.startRegistration")]}),(Ne||Ye||d==="email"||d==="otp")&&e.jsxs(D,{variant:"destructive",onClick:Ye?Bc:Ze,children:[e.jsx(Cn,{className:"h-4 w-4 mr-2"}),n("register.cancel")]}),(d==="done"||d==="finalized")&&!Ye&&e.jsxs(D,{variant:"outline",onClick:Ue,children:[e.jsx(gr,{className:"h-4 w-4 mr-2"}),n("register.newRegistration")]})]}),Ne&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(bt,{className:"h-4 w-4 animate-spin text-primary"}),n("register.processing")]})]})}),h.length>0&&e.jsxs(De,{className:"overflow-hidden",children:[e.jsx(at,{className:"py-3 border-b",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(rt,{className:"text-sm",children:n("register.log")}),e.jsx(D,{variant:"ghost",size:"sm",onClick:()=>{Oa=[],f([])},children:e.jsx(Vt,{className:"h-3.5 w-3.5"})})]})}),e.jsx(Pe,{className:"p-0",children:e.jsx("div",{ref:st,className:"h-48 overflow-y-auto p-3 font-mono text-xs space-y-0.5 bg-muted/20",children:h.map((A,$)=>e.jsx("div",{className:"text-muted-foreground leading-relaxed",children:A},$))})})]}),i!=="manual"&&e.jsxs(De,{className:"hover-lift",children:[e.jsxs(at,{className:"pb-3 flex flex-row items-center justify-between",children:[e.jsxs(rt,{className:"text-base flex items-center gap-2",children:[e.jsx(Ba,{className:"h-4 w-4 text-primary"}),n("register.batchTitle")]}),e.jsxs("div",{className:"relative",children:[e.jsxs(D,{variant:"outline",size:"sm",onClick:()=>Ga(!wa),disabled:Ye,children:[e.jsx(Ka,{className:"h-4 w-4 mr-1"}),s?"Templates":"Mẫu"," (",Xn.length,")"]}),wa&&e.jsxs("div",{className:"absolute right-0 top-full mt-2 z-50 min-w-[280px] max-h-[400px] overflow-y-auto bg-popover border rounded-lg shadow-lg p-2",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2 px-2",children:[e.jsx("span",{className:"text-xs font-medium uppercase text-muted-foreground",children:s?"Strategy Templates":"Mẫu chiến lược"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs(D,{size:"sm",variant:"ghost",onClick:Oc,className:"h-7 text-xs",children:[e.jsx(Ns,{className:"h-3 w-3 mr-1"}),s?"Save current":"Lưu hiện tại"]}),e.jsx("button",{type:"button",onClick:()=>{const A=new Blob([JSON.stringify(Xn,null,2)],{type:"application/json"}),$=URL.createObjectURL(A),de=document.createElement("a");de.href=$,de.download=`kiro-register-templates-${new Date().toISOString().slice(0,10)}.json`,de.click(),setTimeout(()=>URL.revokeObjectURL($),1e3)},title:s?"Export all templates":"Xuất tất cả mẫu",className:"p-1 rounded hover:bg-muted text-muted-foreground",children:e.jsx(Ns,{className:"h-3 w-3"})}),e.jsxs("label",{className:"p-1 rounded hover:bg-muted text-muted-foreground cursor-pointer",title:s?"Import templates":"Nhập mẫu",children:[e.jsx("input",{type:"file",accept:"application/json,.json",className:"hidden",onChange:async A=>{const $=A.target.files?.[0];if($){try{const de=await $.text(),Me=JSON.parse(de);if(!Array.isArray(Me))throw new Error("Định dạng tệp không hợp lệ");const Ke=[...Me,...Xn],Le=new Set,pt=[];for(const ut of Ke)Le.has(ut.id)||(Le.add(ut.id),pt.push(ut));Fi(pt),Hf(pt),L(`[Mẫu] Đã nhập ${Me.length} mẫu`)}catch(de){alert(`Nhập thất bại: ${de instanceof Error?de.message:String(de)}`)}A.currentTarget.value=""}}}),e.jsx(Fa,{className:"h-3 w-3"})]})]})]}),e.jsx("div",{className:"border-t mb-1"}),Xn.length===0?e.jsx("div",{className:"py-6 text-center text-xs text-muted-foreground",children:s?'No templates yet. Click "Save current" to save the current config as a template.':'Chưa có mẫu. Bấm "Lưu hiện tại" để lưu cấu hình đang dùng thành mẫu.'}):Xn.map(A=>e.jsxs("div",{className:"flex items-center justify-between gap-2 px-2 py-1.5 hover:bg-muted rounded transition-colors",children:[e.jsxs("button",{onClick:()=>Lc(A),className:"flex-1 text-left min-w-0",children:[e.jsx("div",{className:"text-sm truncate",children:A.name}),e.jsxs("div",{className:"text-[10px] text-muted-foreground",children:[A.config.mode," · ",s?"count":"Số lượng"," ",A.config.batchCount," · ",s?"conc.":"Song song"," ",A.config.batchConcurrency]})]}),e.jsx("button",{onClick:()=>Xu(A.id),className:"p-1 rounded hover:bg-destructive/10 text-destructive",title:s?"Delete":"Xóa",children:e.jsx(Vt,{className:"h-3 w-3"})})]},A.id))]})]})]}),e.jsxs(Pe,{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-end gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(Fe,{className:"text-xs",children:n("register.batchCount")}),e.jsx(it,{type:"number",min:1,max:100,value:et,onChange:A=>{const $=parseInt(A.target.value);!isNaN($)&&$>=1&&qe($)},onBlur:()=>{et<1&&qe(1)},disabled:Ye,className:"w-24"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(Fe,{className:"text-xs",children:n("register.batchInterval")}),e.jsx(it,{type:"number",min:0,max:300,value:Je,onChange:A=>{const $=parseInt(A.target.value);!isNaN($)&&$>=0&&Kt($)},disabled:Ye,className:"w-24"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(Fe,{className:"text-xs",children:n("register.batchRetries")}),e.jsx(it,{type:"number",min:0,max:10,value:Ve,onChange:A=>{const $=parseInt(A.target.value);!isNaN($)&&$>=0&&je($)},disabled:Ye,className:"w-24"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(Fe,{className:"text-xs",children:n("register.batchConcurrency")}),e.jsx(it,{type:"number",min:1,max:100,value:He,onChange:A=>{const $=parseInt(A.target.value);!isNaN($)&&$>=1&&Tt($)},onBlur:()=>{He<1&&Tt(1)},disabled:Ye,className:"w-24"})]}),e.jsx(D,{variant:Ye?"destructive":"default",onClick:Ye?Bc:()=>void Qi(),disabled:!Ye&&Ne||i==="outlook"&&!V.trim()||i==="tempmail"&&(!te.trim()||!B.trim()||!K.trim())||i==="tingamefi"&&(!P.trim()||!fe.trim()||!C.trim())||i==="mixed"&&Gs()==null,children:Ye?e.jsxs(e.Fragment,{children:[e.jsx(Cn,{className:"h-4 w-4 mr-2"}),n("register.batchStop")]}):e.jsxs(e.Fragment,{children:[e.jsx(Ba,{className:"h-4 w-4 mr-2"}),n("register.batchStart")]})}),Ye&&e.jsx(D,{variant:"outline",onClick:eh,title:gs?"Tiếp tục":"Tạm dừng",children:gs?e.jsxs(e.Fragment,{children:[e.jsx(Ba,{className:"h-4 w-4 mr-2"}),s?"Resume":"Tiếp tục"]}):e.jsxs(e.Fragment,{children:[e.jsx(Cp,{className:"h-4 w-4 mr-2"}),s?"Pause":"Tạm dừng"]})})]}),e.jsxs("div",{className:"flex items-center gap-4 flex-wrap p-3 rounded-lg bg-muted/30 border border-dashed",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(is,{checked:ka,onCheckedChange:zc,disabled:Ye}),e.jsxs(Fe,{className:"text-sm cursor-pointer flex items-center gap-1.5",children:[e.jsx(b3,{className:"h-4 w-4 text-primary"}),"Lên lịch chạy"]})]}),ka&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex items-center gap-1.5 text-xs",children:e.jsx(it,{type:"time",value:da,onChange:A=>Wu(A.target.value),disabled:Ye,className:"h-8 w-28 text-xs"})}),e.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[(s?["Su","Mo","Tu","We","Th","Fr","Sa"]:["CN","T2","T3","T4","T5","T6","T7"]).map((A,$)=>{const de=!!(Ms&1<<$);return e.jsx("button",{type:"button",onClick:()=>Gi(Ms^1<<$),disabled:Ye,className:me("w-7 h-7 rounded text-[10px] border transition-colors",de?"border-primary bg-primary/10 text-primary font-medium":"border-border text-muted-foreground hover:border-primary/50"),children:A},$)}),e.jsx("button",{type:"button",onClick:()=>Gi(Ms===127?62:127),disabled:Ye,className:"text-[10px] text-primary hover:underline ml-1",title:s?"Toggle: all / weekdays only":"Chuyển: tất cả / chỉ ngày làm việc",children:Ms===127?s?"Weekdays":"Ngày làm việc":s?"Daily":"Hàng ngày"})]})]}),e.jsx("div",{className:"w-px h-6 bg-border"}),e.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[e.jsx(DM,{className:"h-4 w-4 text-primary"}),e.jsx("span",{className:"text-muted-foreground",children:s?"Daily quota:":"Quota mỗi ngày:"}),e.jsx(it,{type:"number",min:0,max:9999,value:on,onChange:A=>{const $=parseInt(A.target.value,10);!isNaN($)&&$>=0&&Yu($)},disabled:Ye,className:"h-8 w-20 text-xs text-center"}),e.jsx("span",{className:"text-muted-foreground",children:s?"/day":"/ngày"}),on>0&&e.jsxs(e.Fragment,{children:[e.jsxs($e,{variant:"outline",className:me("text-[10px]",Mn>=on?"text-red-600 border-red-200":Mn>=on*.8?"text-amber-600 border-amber-200":"text-muted-foreground"),children:[s?"Today":"Hôm nay",": ",Mn," / ",on]}),e.jsx("button",{type:"button",onClick:()=>{if(confirm(s?`Reset today's used quota (currently ${Mn})?`:`Đặt lại quota đã dùng hôm nay (hiện tại ${Mn})?`)){Yn(0);try{localStorage.setItem(qa,"0")}catch{}L("[Hạn mức] Đã đặt lại bộ đếm hạn mức hôm nay")}},className:"text-[10px] text-muted-foreground hover:text-foreground underline",title:s?"Manually reset today's used quota":"Đặt lại thủ công quota đã dùng hôm nay",children:s?"Reset":"Đặt lại"})]}),on===0&&e.jsx("span",{className:"text-[10px] text-muted-foreground italic",children:s?"(0 = unlimited)":"(0 = không giới hạn)"})]})]}),e.jsxs("div",{className:"flex items-center gap-4 flex-wrap p-3 rounded-lg bg-muted/30 border border-dashed",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(is,{checked:ua,onCheckedChange:yr,disabled:Ye}),e.jsxs(Fe,{className:"text-sm cursor-pointer flex items-center gap-1.5",children:[e.jsx(lA,{className:"h-4 w-4 text-primary"}),s?"Rate limit":"Giới hạn tốc độ"]})]}),ua&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[e.jsx("span",{className:"text-muted-foreground",children:s?"Max launch rate:":"Tốc độ khởi chạy tối đa:"}),e.jsx(it,{type:"number",min:1,max:300,value:Xa,onChange:A=>{const $=parseInt(A.target.value,10);!isNaN($)&&$>=1&&Uc($)},disabled:Ye,className:"w-20 h-8 text-xs text-center"}),e.jsx("span",{className:"text-muted-foreground",children:s?"/ min":"/ phút"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(is,{checked:oi,onCheckedChange:qi,disabled:Ye}),e.jsx(Fe,{className:"text-xs cursor-pointer",children:s?"Auto backoff on consecutive failures (exponential)":"Tự giãn cách khi lỗi liên tiếp (lũy tiến)"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(is,{checked:Ws,onCheckedChange:co,disabled:Ye}),e.jsxs(Fe,{className:"text-xs cursor-pointer flex items-center gap-1",children:[e.jsx(xc,{className:"h-3 w-3 text-amber-500"}),s?"Auto pause on risk control":"Tự tạm dừng khi gặp kiểm soát rủi ro"]})]}),e.jsxs("div",{className:"w-full flex items-center gap-3 text-xs flex-wrap pt-2 border-t border-dashed",children:[e.jsx("span",{className:"text-muted-foreground",children:s?"Advanced:":"Nâng cao:"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-muted-foreground",children:s?"Burst cap":"Giới hạn burst"}),e.jsx(it,{type:"number",min:1,max:100,value:Wn,onChange:A=>{const $=parseInt(A.target.value,10);!isNaN($)&&$>=1&&Qu($)},disabled:Ye,className:"w-16 h-7 text-xs text-center"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-muted-foreground",children:s?"Backoff start":"Giãn cách ban đầu"}),e.jsx(it,{type:"number",min:1,max:300,value:br,onChange:A=>{const $=parseInt(A.target.value,10);!isNaN($)&&$>=1&&$c($)},disabled:Ye,className:"w-16 h-7 text-xs text-center"}),e.jsx("span",{className:"text-muted-foreground",children:s?"sec":"giây"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-muted-foreground",children:s?"Backoff cap":"Giới hạn giãn cách"}),e.jsx(it,{type:"number",min:1,max:3600,value:Ya,onChange:A=>{const $=parseInt(A.target.value,10);!isNaN($)&&$>=1&&Zu($)},disabled:Ye,className:"w-20 h-7 text-xs text-center"}),e.jsx("span",{className:"text-muted-foreground",children:s?"sec":"giây"})]})]})]}),!ua&&e.jsx("span",{className:"text-xs text-muted-foreground",children:s?"When enabled, a token bucket paces launches and auto-extends intervals on consecutive failures.":"Khi bật, hệ thống dùng token bucket để kiểm soát nhịp khởi chạy và tự kéo dài khoảng chờ khi lỗi liên tiếp"})]}),Ye&&js&&e.jsxs("div",{className:me("p-3 rounded-lg border space-y-2 transition-colors",js.riskWarning?"bg-red-50 dark:bg-red-950/20 border-red-300 dark:border-red-800":js.backoffRemainingMs>0?"bg-amber-50 dark:bg-amber-950/20 border-amber-300 dark:border-amber-800":"bg-blue-50 dark:bg-blue-950/20 border-blue-200 dark:border-blue-800"),children:[e.jsx("div",{className:"flex items-center gap-2",children:js.riskWarning?e.jsxs(e.Fragment,{children:[e.jsx(xc,{className:"h-4 w-4 text-red-500 animate-pulse"}),e.jsxs("span",{className:"text-sm font-medium text-red-600 dark:text-red-400",children:[s?"Risk warning: success rate too low":"Cảnh báo rủi ro: tỷ lệ thành công quá thấp"," (",Math.round(js.successRate*100),"%)"]})]}):js.backoffRemainingMs>0?e.jsxs(e.Fragment,{children:[e.jsx(Gn,{className:"h-4 w-4 text-amber-500"}),e.jsx("span",{className:"text-sm font-medium text-amber-600 dark:text-amber-400",children:s?`Backing off: resuming in ${Math.ceil(js.backoffRemainingMs/1e3)}s`:`Đang giãn cách: tiếp tục sau ${Math.ceil(js.backoffRemainingMs/1e3)} giây`})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ks,{className:"h-4 w-4 text-blue-500"}),e.jsx("span",{className:"text-sm font-medium text-blue-600 dark:text-blue-400",children:s?"Running":"Đang chạy"})]})}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-muted-foreground",children:s?"Throughput:":"Thông lượng:"}),e.jsxs("span",{className:"font-mono tabular-nums",children:[js.throughputPerMinute,"/min"]})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-muted-foreground",children:s?"Success rate:":"Tỷ lệ thành công:"}),e.jsxs("span",{className:me("font-mono tabular-nums font-medium",js.successRate>=.8?"text-green-600":js.successRate>=.5?"text-amber-600":"text-red-600"),children:[Math.round(js.successRate*100),"%"]})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-muted-foreground",children:s?"Window:":"Cửa sổ:"}),e.jsxs("span",{className:"font-mono tabular-nums",children:[e.jsxs("span",{className:"text-green-600",children:["✓",js.windowSuccess]}),e.jsx("span",{className:"text-muted-foreground mx-0.5",children:"/"}),e.jsxs("span",{className:"text-red-500",children:["✗",js.windowFailed]})]})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-muted-foreground",children:s?"Consec. fails:":"Lỗi liên tiếp:"}),e.jsx("span",{className:me("font-mono tabular-nums",js.consecutiveFailures>=3?"text-red-600 font-medium":""),children:js.consecutiveFailures})]})]})]}),!Ye&&ze>0&&nt.some(A=>A.status==="failed"||A.status==="import_failed")&&(()=>{const A={network:0,otp_timeout:0,email_used:0,rate_limit:0,risk_control:0,auth:0,unknown:0};for(const de of nt){if(de.status!=="failed"&&de.status!=="import_failed")continue;const Me=cc(de.error);A[Me]=(A[Me]||0)+1}const $=s?{network:"Network error",otp_timeout:"OTP timeout",email_used:"Email in use",rate_limit:"Rate limited",risk_control:"AWS risk control",auth:"Auth error",unknown:"Other/Unknown"}:{network:"Lỗi mạng",otp_timeout:"OTP quá hạn",email_used:"Email đã được dùng",rate_limit:"Bị giới hạn tốc độ",risk_control:"AWS kiểm soát rủi ro",auth:"Lỗi xác thực",unknown:"Khác/không rõ"};return e.jsxs("div",{className:"p-3 bg-amber-50 dark:bg-amber-950/20 border border-amber-200 dark:border-amber-800 rounded-lg space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Rs,{className:"h-4 w-4 text-amber-600"}),e.jsx("span",{className:"text-sm font-medium",children:s?`${ze} tasks failed`:`${ze} tác vụ thất bại`}),e.jsxs(D,{size:"sm",variant:"default",className:"ml-auto",onClick:()=>_c("all"),children:[e.jsx(Mt,{className:"h-3.5 w-3.5 mr-1"}),s?"Retry all":"Thử lại tất cả"]})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:Object.entries(A).filter(([,de])=>de>0).map(([de,Me])=>e.jsxs("button",{type:"button",onClick:()=>_c(de),className:"px-2 py-0.5 rounded text-[10px] bg-amber-100 dark:bg-amber-900/40 text-amber-900 dark:text-amber-100 hover:bg-amber-200 dark:hover:bg-amber-900/60 transition-colors",title:s?"Click to retry this category":"Bấm để thử lại nhóm lỗi này",children:[$[de]," (",Me,")"]},de))})]})})(),(Ye||Jt>0)&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:me("border rounded-md px-3 py-2.5 space-y-2",el?"border-red-300 bg-red-50 dark:border-red-800 dark:bg-red-950/20":"border-emerald-200 bg-emerald-50/70 dark:border-emerald-900 dark:bg-emerald-950/20"),children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(Ki,{className:me("h-4 w-4",el?"text-red-600":"text-emerald-600")}),e.jsx("span",{className:"text-sm font-medium",children:s?"Stable batch network route":"Kết nối mạng ổn định cho batch"}),e.jsxs($e,{variant:"outline",className:me("ml-auto",el?"border-red-300 text-red-700 dark:border-red-800 dark:text-red-300":"border-emerald-300 text-emerald-700 dark:border-emerald-800 dark:text-emerald-300"),children:[e.jsx(FN,{className:"h-3 w-3 mr-1"}),el?s?"Route changed - stopped":"IP đã đổi - batch đã dừng":Ji?s?"Exit IP locked":"Đã khóa IP đầu ra":s?"Checking exit IP":"Đang kiểm tra IP đầu ra"]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-x-4 gap-y-1 text-xs text-muted-foreground",children:[e.jsxs("span",{children:["Route",": ",wr.enabled?s?"One pinned proxy session for the entire batch":"Một proxy/session cố định cho toàn bộ batch":s?"Direct/system VPN connection":"Kết nối trực tiếp/VPN hệ thống"]}),e.jsxs("span",{className:"font-mono",children:[s?"Exit IP":"IP đầu ra",": ",Ji||(s?"waiting...":"đang chờ...")]})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:s?"The batch automatically stops if the observed exit IP changes.":"Batch sẽ tự động dừng nếu hệ thống phát hiện IP đầu ra thay đổi."})]}),e.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[e.jsxs("span",{className:"font-medium",children:[n("register.batchProgress"),": ",Vc,"/",Zi]}),e.jsxs($e,{variant:"outline",className:"text-green-600 border-green-200 bg-green-50 dark:bg-green-950/30",children:[n("register.batchSuccess"),": ",O]}),e.jsxs($e,{variant:"outline",className:"text-red-600 border-red-200 bg-red-50 dark:bg-red-950/30",children:[n("register.batchFail"),": ",ze]})]}),e.jsx(Gu,{value:Zi>0?Vc/Zi*100:0,className:"h-2"}),nt.length>0&&e.jsx("div",{className:"max-h-60 overflow-y-auto border rounded-lg bg-muted/20",children:nt.map(A=>e.jsx(IR,{item:A,t:n,batchClock:qn},A.id))})]})]})]}),p&&e.jsx(De,{className:me("border shadow-sm",p.status==="success"?"bg-green-50 dark:bg-green-950/20 border-green-200 dark:border-green-800":"bg-red-50 dark:bg-red-950/20 border-red-200 dark:border-red-800"),children:e.jsxs(Pe,{className:"pt-5 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[p.status==="success"?e.jsx("div",{className:"p-1.5 rounded-full bg-green-100 dark:bg-green-900/50",children:e.jsx(an,{className:"h-5 w-5 text-green-600"})}):e.jsx("div",{className:"p-1.5 rounded-full bg-red-100 dark:bg-red-900/50",children:e.jsx(fs,{className:"h-5 w-5 text-red-600"})}),e.jsx("h3",{className:"text-lg font-semibold",children:p.status==="success"?n("register.success"):n("register.failed")})]}),p.status==="success"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm p-3 bg-background/50 rounded-lg",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:n("register.emailField")})," ",e.jsx("span",{className:"font-mono font-medium",children:p.email})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:n("register.passwordField")})," ",e.jsx("span",{className:"font-mono font-medium",children:p.password})]})]}),e.jsx(D,{onClick:J,disabled:b,variant:b?"outline":"default",className:b?"text-green-600 border-green-300":"",size:"sm",children:b?e.jsxs(e.Fragment,{children:[e.jsx(an,{className:"h-4 w-4 mr-2"}),n("register.imported")]}):e.jsxs(e.Fragment,{children:[e.jsx(zu,{className:"h-4 w-4 mr-2"}),n("register.importToManager")]})})]}),p.status==="failed"&&e.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:p.error})]})}),jr.length>=5&&e.jsx(KR,{history:jr}),e.jsx(GR,{}),jr.length>0&&e.jsxs(De,{className:"overflow-hidden",children:[e.jsx(at,{className:"py-3 border-b",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(rt,{className:"text-sm flex items-center gap-2",children:[e.jsx(Gn,{className:"h-4 w-4 text-primary"}),n("register.historyTitle")," (",jr.length,")"]}),e.jsxs(D,{variant:"ghost",size:"sm",onClick:()=>Qs([]),children:[e.jsx(Vt,{className:"h-3.5 w-3.5 mr-1"}),n("register.historyClear")]})]})}),e.jsx(Pe,{className:"p-0",children:e.jsx("div",{className:"max-h-48 overflow-y-auto",children:jr.map(A=>{const $=A.result?.fingerprint;return e.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 border-b last:border-b-0 hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[A.status==="success"?e.jsx(an,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):e.jsx(fs,{className:"h-4 w-4 text-red-500 flex-shrink-0"}),e.jsx("span",{className:"font-mono text-xs truncate",children:A.email}),e.jsx("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:new Date(A.time).toLocaleTimeString()}),$&&e.jsxs("span",{className:"text-[9px] text-muted-foreground bg-muted px-1.5 py-0.5 rounded font-mono flex-shrink-0 cursor-help",title:`Chrome ${$.chromeVer}
|
|
132
|
+
UA: ${$.ua}
|
|
133
|
+
GPU: ${$.gpuVendor} ${$.gpuModel}
|
|
134
|
+
Canvas: ${$.canvasHash}
|
|
135
|
+
Screen: ${$.screen.width}x${$.screen.height}
|
|
136
|
+
Proxy: ${$.proxyUrl||"(direct)"}
|
|
137
|
+
Exit IP: ${$.exitIP||"N/A"}`,children:["🔒 ",$.chromeVer.split(".")[0],"・",$.screen.width,"×",$.screen.height,$.exitIP?`・${$.exitIP}`:""]})]}),A.status==="success"&&A.result?.refreshToken&&e.jsx($e,{variant:"outline",className:me("cursor-pointer text-xs",A.imported?"text-green-600 border-green-200":"text-primary border-primary/30 hover:bg-primary/10"),onClick:()=>!A.imported&&mo(A),children:A.imported?n("register.imported"):n("register.historyImport")})]},A.id)})})})]})]})}function KR({history:n}){const{t:s}=Ut(),r=s("common.unknown")==="Unknown",i=g.useMemo(()=>{const b=n.length;let v=0,N=0;const j={},T={},S={},k={},R=Date.now(),I=[];for(let U=6;U>=0;U--){const q=new Date(R-U*864e5),V=`${q.getMonth()+1}/${q.getDate()}`;I.push(V),S[V]={success:0,failed:0}}for(const U of n){U.status==="success"?v++:N++;const q=U.result?.provider||"BuilderId";j[q]||(j[q]={success:0,failed:0}),U.status==="success"?j[q].success++:j[q].failed++;const V=new Date(U.time),le=V.getHours();T[le]||(T[le]={success:0,failed:0}),U.status==="success"?T[le].success++:T[le].failed++;const B=`${V.getMonth()+1}/${V.getDate()}`;if(S[B]&&(U.status==="success"?S[B].success++:S[B].failed++),U.status==="failed"){const be=cc(U.error);k[be]=(k[be]||0)+1}}const M=b>0?v/b:0,G=Object.entries(T).filter(([,U])=>U.success+U.failed>=2).sort((U,q)=>{const V=U[1].success/(U[1].success+U[1].failed);return q[1].success/(q[1].success+q[1].failed)-V}).slice(0,3),W=Object.entries(k).sort((U,q)=>q[1]-U[1]);return{total:b,success:v,failed:N,successRate:M,byMode:j,byHour:T,byDay:S,sevenDays:I,peakHours:G,topErrors:W}},[n]),o=g.useCallback(()=>{const b=["time,email,status,error,password"];for(const T of n){const S=k=>{if(!k)return"";const R=k.replace(/"/g,'""');return/[,"\n]/.test(R)?`"${R}"`:R};b.push([new Date(T.time).toISOString(),S(T.email),T.status,S(T.error),S(T.password)].join(","))}const v=new Blob([b.join(`
|
|
138
|
+
`)],{type:"text/csv;charset=utf-8"}),N=URL.createObjectURL(v),j=document.createElement("a");j.href=N,j.download=`register-history-${new Date().toISOString().slice(0,10)}.csv`,j.click(),setTimeout(()=>URL.revokeObjectURL(N),1e3)},[n]),d={network:{label:r?"Network error":"Lỗi mạng",color:"bg-blue-500"},otp_timeout:{label:r?"OTP timeout":"OTP quá hạn",color:"bg-amber-500"},email_used:{label:r?"Email in use":"Email đã được dùng",color:"bg-slate-500"},rate_limit:{label:r?"Rate limited":"Bị giới hạn tốc độ",color:"bg-orange-500"},risk_control:{label:r?"AWS risk control":"AWS kiểm soát rủi ro",color:"bg-red-500"},auth:{label:r?"Auth error":"Lỗi xác thực",color:"bg-purple-500"},unknown:{label:r?"Other/Unknown":"Khác/không rõ",color:"bg-gray-500"}},u=i.successRate>=.85?"#22c55e":i.successRate>=.6?"#f59e0b":"#ef4444",h=36,f=8,p=2*Math.PI*h,y=p*(1-i.successRate);return e.jsxs(De,{className:"hover-lift overflow-hidden",children:[e.jsx(at,{className:"pb-2 bg-gradient-to-br from-primary/5 to-transparent",children:e.jsxs(rt,{className:"text-sm flex items-center gap-2",children:[e.jsx("div",{className:"p-1.5 rounded-lg bg-primary/10",children:e.jsx(Ks,{className:"h-4 w-4 text-primary"})}),e.jsx("span",{children:r?"Registration Analytics":"Phân tích kết quả đăng ký"}),e.jsxs($e,{variant:"outline",className:"text-[10px] ml-auto",children:[r?"Samples":"Mẫu"," ",i.total]}),e.jsxs(D,{size:"sm",variant:"ghost",className:"h-6 text-[10px] -mr-1",onClick:o,children:[e.jsx(Ns,{className:"h-3 w-3 mr-1"}),"CSV"]})]})}),e.jsxs(Pe,{className:"space-y-4 pt-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[140px_1fr] gap-4 items-center",children:[e.jsxs("div",{className:"relative flex items-center justify-center",children:[e.jsxs("svg",{width:"120",height:"120",viewBox:"0 0 100 100",children:[e.jsx("circle",{cx:"50",cy:"50",r:h,fill:"none",stroke:"currentColor",strokeWidth:f,opacity:"0.1"}),e.jsx("circle",{cx:"50",cy:"50",r:h,fill:"none",stroke:u,strokeWidth:f,strokeLinecap:"round",strokeDasharray:p,strokeDashoffset:y,transform:"rotate(-90 50 50)",className:"transition-all duration-700"})]}),e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[e.jsxs("div",{className:"text-2xl font-bold tabular-nums",style:{color:u},children:[Math.round(i.successRate*100),"%"]}),e.jsx("div",{className:"text-[10px] text-muted-foreground",children:r?"Success rate":"Tỷ lệ thành công"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"p-3 rounded-lg bg-green-500/5 border border-green-500/20",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-[10px] text-muted-foreground",children:r?"Success":"Thành công"}),e.jsx(an,{className:"h-3 w-3 text-green-500"})]}),e.jsx("div",{className:"text-xl font-bold tabular-nums text-green-600 mt-0.5",children:i.success})]}),e.jsxs("div",{className:"p-3 rounded-lg bg-red-500/5 border border-red-500/20",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-[10px] text-muted-foreground",children:r?"Failed":"Thất bại"}),e.jsx(fs,{className:"h-3 w-3 text-red-500"})]}),e.jsx("div",{className:"text-xl font-bold tabular-nums text-red-600 mt-0.5",children:i.failed})]}),e.jsxs("div",{className:"p-3 rounded-lg bg-blue-500/5 border border-blue-500/20 col-span-2",children:[e.jsx("div",{className:"flex items-center justify-between mb-1",children:e.jsxs("span",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[e.jsx(Gn,{className:"h-3 w-3"}),r?"Top 3 success hours":"Top 3 khung giờ thành công"]})}),i.peakHours.length===0?e.jsx("p",{className:"text-xs text-muted-foreground",children:r?"Not enough data":"Chưa đủ dữ liệu"}):e.jsx("div",{className:"flex gap-2",children:i.peakHours.map(([b,v])=>{const N=Math.round(v.success/(v.success+v.failed)*100);return e.jsxs("div",{className:"flex-1 text-center",children:[e.jsxs("div",{className:"text-sm font-bold font-mono",children:[b.padStart(2,"0"),":00"]}),e.jsxs("div",{className:"text-[10px] text-green-600 font-mono",children:[N,"%"]})]},b)})})]})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs font-medium",children:r?"24-hour distribution":"Phân bố 24 giờ"}),e.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-green-500"})," ",r?"Success":"Thành công"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-red-500"})," ",r?"Failed":"Thất bại"]})]})]}),e.jsx(HR,{byHour:i.byHour})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs font-medium",children:r?"7-day trend":"Xu hướng 7 ngày"}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:r?"Registrations":"Lượt đăng ký"})]}),e.jsx(FR,{sevenDays:i.sevenDays,byDay:i.byDay})]}),i.topErrors.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs font-medium",children:r?"Failure reasons":"Phân bố lý do thất bại"}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:r?`${i.failed} failures total`:`Tổng ${i.failed} lần thất bại`})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:i.topErrors.map(([b,v])=>{const N=d[b]||{label:b,color:"bg-gray-500"},j=Math.round(v/i.failed*100);return e.jsxs("div",{className:"p-2 rounded-lg border bg-card hover:bg-muted/30 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("div",{className:me("w-2 h-2 rounded-full",N.color)}),e.jsx("span",{className:"text-xs font-medium flex-1 truncate",children:N.label}),e.jsx("span",{className:"text-xs font-mono tabular-nums text-muted-foreground",children:v})]}),e.jsx("div",{className:"h-1.5 bg-muted rounded-full overflow-hidden",children:e.jsx("div",{className:me("h-full transition-all",N.color),style:{width:`${j}%`}})}),e.jsxs("div",{className:"text-right text-[10px] text-muted-foreground tabular-nums mt-0.5",children:[j,"%"]})]},b)})})]}),Object.keys(i.byMode).length>1&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium mb-2",children:r?"Mode comparison":"So sánh phương thức đăng ký"}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-2",children:Object.entries(i.byMode).map(([b,v])=>{const N=v.success+v.failed,j=N>0?Math.round(v.success/N*100):0,T=j>=80?"text-green-600":j>=50?"text-amber-600":"text-red-600",S=j>=80?"bg-green-500":j>=50?"bg-amber-500":"bg-red-500";return e.jsxs("div",{className:"p-3 rounded-lg border bg-card",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsx("span",{className:"text-xs font-medium",children:b}),e.jsxs("span",{className:me("text-xs font-mono tabular-nums font-bold",T),children:[j,"%"]})]}),e.jsx("div",{className:"h-1 bg-muted rounded-full overflow-hidden",children:e.jsx("div",{className:me("h-full",S),style:{width:`${j}%`}})}),e.jsxs("div",{className:"text-[10px] text-muted-foreground mt-1",children:["✓",v.success," / ✗",v.failed," (",r?"total":"Tổng"," ",N,")"]})]},b)})})]})]})]})}function HR({byHour:n}){const h=30.26086956521739;let f=0;for(let N=0;N<24;N++){const j=n[N]||{success:0,failed:0};f=Math.max(f,j.success+j.failed)}f===0&&(f=1);const p=(N,j)=>{const T=12+N*h,S=82-j/f*74;return[T,S]},y=N=>{const j=[];for(let k=0;k<24;k++){const R=n[k]||{success:0,failed:0};j.push(p(k,R[N]))}let T=`M${j[0][0]},${j[0][1]}`;for(let k=0;k<j.length-1;k++){const R=j[k===0?k:k-1],I=j[k],M=j[k+1],G=j[k+2<j.length?k+2:k+1],W=I[0]+(M[0]-R[0])/6,U=I[1]+(M[1]-R[1])/6,q=M[0]-(G[0]-I[0])/6,V=M[1]-(G[1]-I[1])/6;T+=` C${W},${U} ${q},${V} ${M[0]},${M[1]}`}const S=T+` L${12+23*h},82 L12,82 Z`;return{line:T,area:S}},b=y("success"),v=y("failed");return e.jsxs("svg",{width:"100%",viewBox:"0 0 720 100",className:"overflow-visible",preserveAspectRatio:"none",children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"succGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"rgb(34 197 94)",stopOpacity:"0.35"}),e.jsx("stop",{offset:"100%",stopColor:"rgb(34 197 94)",stopOpacity:"0"})]}),e.jsxs("linearGradient",{id:"failGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"rgb(239 68 68)",stopOpacity:"0.3"}),e.jsx("stop",{offset:"100%",stopColor:"rgb(239 68 68)",stopOpacity:"0"})]})]}),[.25,.5,.75].map(N=>e.jsx("line",{x1:12,x2:708,y1:8+74*N,y2:8+74*N,stroke:"currentColor",strokeOpacity:"0.06",strokeDasharray:"2,3"},N)),e.jsx("path",{d:v.area,fill:"url(#failGradient)"}),e.jsx("path",{d:v.line,fill:"none",stroke:"rgb(239 68 68)",strokeWidth:"1.5",opacity:"0.8"}),e.jsx("path",{d:b.area,fill:"url(#succGradient)"}),e.jsx("path",{d:b.line,fill:"none",stroke:"rgb(34 197 94)",strokeWidth:"2"}),Array.from({length:24}).map((N,j)=>{const T=n[j]||{success:0,failed:0};return T.success===0&&T.failed===0?null:e.jsxs("g",{children:[T.success>0&&(()=>{const[S,k]=p(j,T.success);return e.jsx("circle",{cx:S,cy:k,r:"2.5",fill:"rgb(34 197 94)"})})(),T.failed>0&&(()=>{const[S,k]=p(j,T.failed);return e.jsx("circle",{cx:S,cy:k,r:"2",fill:"rgb(239 68 68)"})})()]},j)}),[0,6,12,18,23].map(N=>{const j=12+N*h;return e.jsxs("g",{children:[e.jsx("line",{x1:j,x2:j,y1:82,y2:85,stroke:"currentColor",opacity:"0.3"}),e.jsxs("text",{x:j,y:96,fontSize:"9",fill:"currentColor",opacity:"0.5",textAnchor:"middle",children:[N.toString().padStart(2,"0"),":00"]})]},N)})]})}function FR({sevenDays:n,byDay:s}){const f=688/n.length*.6,p=688/n.length;let y=0;for(const b of n){const v=s[b]||{success:0,failed:0};y=Math.max(y,v.success+v.failed)}return y===0&&(y=1),e.jsxs("svg",{width:"100%",viewBox:"0 0 720 80",className:"overflow-visible",preserveAspectRatio:"none",children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"barSuccGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"rgb(34 197 94)",stopOpacity:"1"}),e.jsx("stop",{offset:"100%",stopColor:"rgb(34 197 94)",stopOpacity:"0.6"})]}),e.jsxs("linearGradient",{id:"barFailGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"rgb(239 68 68)",stopOpacity:"1"}),e.jsx("stop",{offset:"100%",stopColor:"rgb(239 68 68)",stopOpacity:"0.6"})]})]}),[.5].map(b=>e.jsx("line",{x1:16,x2:704,y1:8+54*b,y2:8+54*b,stroke:"currentColor",strokeOpacity:"0.06",strokeDasharray:"2,3"},b)),n.map((b,v)=>{const N=s[b]||{success:0,failed:0},j=N.success+N.failed,T=j/y*54,S=j>0?N.success/j*T:0,k=j>0?N.failed/j*T:0,R=16+v*p+(p-f)/2,I=62;return e.jsxs("g",{children:[N.failed>0&&e.jsx("rect",{x:R,y:I-T,width:f,height:k,fill:"url(#barFailGrad)",rx:"2"}),N.success>0&&e.jsx("rect",{x:R,y:I-S,width:f,height:S,fill:"url(#barSuccGrad)",rx:"2"}),j>0&&e.jsx("text",{x:R+f/2,y:I-T-3,fontSize:"9",fill:"currentColor",opacity:"0.6",textAnchor:"middle",children:j}),e.jsx("text",{x:R+f/2,y:76,fontSize:"10",fill:"currentColor",opacity:v===n.length-1?1:.5,fontWeight:v===n.length-1?"bold":"normal",textAnchor:"middle",children:b})]},b)})]})}function GR(){const{t:n}=Ut(),s=n("common.unknown")==="Unknown",[r,i]=g.useState(!1),[o,d]=g.useState(()=>Array.from(Yl())),[u,h]=g.useState(""),f=g.useCallback(()=>{d(Array.from(Yl()))},[]),p=g.useCallback(v=>{const N=Yl();N.delete(v.toLowerCase()),Dp(N),f()},[f]),y=g.useCallback(()=>{confirm(s?`Clear all ${o.length} emails from blacklist?`:`Xóa toàn bộ ${o.length} email khỏi danh sách đen?`)&&(LR(),f())},[o.length,f,s]),b=g.useMemo(()=>{if(!u.trim())return o;const v=u.toLowerCase();return o.filter(N=>N.includes(v))},[o,u]);return o.length===0&&!r?null:e.jsxs(De,{className:"hover-lift",children:[e.jsx(at,{className:"pb-2",children:e.jsxs("button",{type:"button",onClick:()=>{i(!r),r||f()},className:"w-full flex items-center justify-between",children:[e.jsxs(rt,{className:"text-sm flex items-center gap-2",children:[e.jsx(fs,{className:"h-4 w-4 text-amber-500"}),s?"Used-email blacklist":"Danh sách đen email đã dùng",e.jsx($e,{variant:"outline",className:"text-[10px]",children:o.length})]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:r?s?"▼ Collapse":"▼ Thu gọn":s?"▶ Expand":"▶ Mở rộng"})]})}),r&&e.jsxs(Pe,{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(it,{value:u,onChange:v=>h(v.target.value),placeholder:s?"Search email...":"Tìm email...",className:"h-8 text-xs max-w-xs"}),e.jsxs(D,{size:"sm",variant:"ghost",onClick:f,children:[e.jsx(Mt,{className:"h-3.5 w-3.5 mr-1"})," ",s?"Refresh":"Làm mới"]}),e.jsxs(D,{size:"sm",variant:"ghost",className:"text-destructive ml-auto",onClick:y,disabled:o.length===0,children:[e.jsx(Vt,{className:"h-3.5 w-3.5 mr-1"})," ",s?"Clear all":"Xóa tất cả"]})]}),o.length===0?e.jsx("div",{className:"py-6 text-center text-xs text-muted-foreground",children:s?"Blacklist is empty":"Danh sách đen đang trống"}):b.length===0?e.jsx("div",{className:"py-4 text-center text-xs text-muted-foreground",children:s?"No matches":"Không có kết quả"}):e.jsx("div",{className:"max-h-60 overflow-y-auto border rounded",children:b.map(v=>e.jsxs("div",{className:"flex items-center justify-between gap-2 px-2 py-1 border-b last:border-b-0 hover:bg-muted/40 text-xs",children:[e.jsx("span",{className:"font-mono truncate flex-1",title:v,children:v}),e.jsx("button",{onClick:()=>p(v),className:"p-1 rounded hover:bg-destructive/10 text-destructive",title:s?"Remove from blacklist":"Xóa khỏi danh sách đen",children:e.jsx(Vt,{className:"h-3 w-3"})})]},v))}),e.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:'Danh sách đen được tự động thêm khi đăng ký lỗi kiểu "email_used". Email trong danh sách này sẽ bị bỏ qua ở các lần đăng ký hàng loạt sau. Nếu Kiro đã giải phóng email cũ, anh có thể xóa thủ công tại đây để cho email đó tham gia đăng ký lại.'})]})]})}const Aj={DEBUG:"text-muted-foreground",INFO:"text-blue-500",WARN:"text-amber-500",ERROR:"text-red-500"},qR={DEBUG:"bg-gray-400",INFO:"bg-blue-400",WARN:"bg-amber-400",ERROR:"bg-red-400"},XR={DEBUG:$N,INFO:Va,WARN:Rs,ERROR:ln},YR={ALL:"bg-primary text-primary-foreground",DEBUG:"bg-gray-500 text-white",INFO:"bg-blue-500 text-white",WARN:"bg-amber-500 text-white",ERROR:"bg-red-500 text-white"};function WR(){const{t:n}=Ut(),s=n("common.unknown")==="Unknown",[r,i]=g.useState([]),[o,d]=g.useState(0),[u,h]=g.useState(""),[f,p]=g.useState("ALL"),[y,b]=g.useState("all"),[v,N]=g.useState("all"),[j,T]=g.useState(()=>localStorage.getItem("systemLogs_displayLimit")||"5000"),[S,k]=g.useState(!0),[R,I]=g.useState(!1),[M,G]=g.useState(null),[W,U]=g.useState(0),q=g.useRef(null),V=g.useRef(null),le=g.useRef(0),B=g.useCallback(async()=>{try{const pe=j==="all"?void 0:parseInt(j)||void 0,[C,z]=await Promise.all([window.api.proxyGetLogs(pe),window.api.proxyGetLogsCount()]),X=C;i(X),d(z),!S&&X.length>le.current&&U(re=>re+(X.length-le.current)),le.current=X.length}catch{}},[S,j]);g.useEffect(()=>(I(!0),B().finally(()=>I(!1)),V.current=setInterval(B,1500),()=>{V.current&&clearInterval(V.current)}),[B]),g.useEffect(()=>{localStorage.setItem("systemLogs_displayLimit",j)},[j]),g.useEffect(()=>{S&&q.current&&(q.current.scrollTop=q.current.scrollHeight)},[r,S]);const be=g.useCallback(()=>{const pe=q.current;if(!pe)return;const C=pe.scrollHeight-pe.scrollTop-pe.clientHeight<40;k(C),C&&U(0)},[]),K=()=>{q.current&&(q.current.scrollTop=q.current.scrollHeight,k(!0),U(0))},se=async()=>{await window.api.proxyClearLogs(),i([]),d(0),U(0)},te=()=>{const pe=P.map(re=>{const xe=re.data?` ${typeof re.data=="string"?re.data:JSON.stringify(re.data)}`:"";return`${re.timestamp} [${re.level}][${re.category}] ${re.message}${xe}`}).join(`
|
|
139
|
+
`),C=new Blob([pe],{type:"text/plain"}),z=URL.createObjectURL(C),X=document.createElement("a");X.href=z,X.download=`kiro-logs-${new Date().toISOString().slice(0,10)}.log`,X.click(),URL.revokeObjectURL(z)},Y=g.useMemo(()=>Array.from(new Set(r.map(pe=>pe.category))).sort(),[r]),P=g.useMemo(()=>{const pe=Date.now(),C=v==="1h"?36e5:v==="6h"?216e5:v==="1d"?864e5:v==="7d"?6048e5:0,z=u.toLowerCase();let X=r.filter(re=>C>0&&pe-new Date(re.timestamp).getTime()>C||f!=="ALL"&&re.level!==f||y!=="all"&&re.category!==y?!1:z?re.message.toLowerCase().includes(z)||re.category.toLowerCase().includes(z)||typeof re.data=="string"&&re.data.toLowerCase().includes(z):!0);if(j!=="all"){const re=parseInt(j);re>0&&(X=X.slice(-re))}return X},[r,f,y,v,j,u]),F={ALL:r.length,DEBUG:r.filter(pe=>pe.level==="DEBUG").length,INFO:r.filter(pe=>pe.level==="INFO").length,WARN:r.filter(pe=>pe.level==="WARN").length,ERROR:r.filter(pe=>pe.level==="ERROR").length},fe=pe=>{try{const C=new Date(pe);return`${C.getHours().toString().padStart(2,"0")}:${C.getMinutes().toString().padStart(2,"0")}:${C.getSeconds().toString().padStart(2,"0")}.${C.getMilliseconds().toString().padStart(3,"0")}`}catch{return pe}};return e.jsxs("div",{className:"h-full flex flex-col p-4 gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[e.jsx("div",{className:"p-1.5 rounded-lg bg-primary/10",children:e.jsx($N,{className:"h-4 w-4 text-primary"})}),e.jsx("span",{className:"font-semibold text-sm",children:s?"System Logs":"系统日志"}),e.jsx($e,{variant:"secondary",className:"text-[10px] font-mono",children:o.toLocaleString()}),R&&e.jsx(Mt,{className:"h-3 w-3 animate-spin text-muted-foreground"})]}),e.jsx(D,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:B,title:s?"Refresh":"刷新",children:e.jsx(Mt,{className:"h-3.5 w-3.5"})}),e.jsx(D,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:te,title:s?"Export":"导出",children:e.jsx(Ns,{className:"h-3.5 w-3.5"})}),e.jsx(D,{variant:"ghost",size:"sm",className:"h-7 text-xs text-red-500 hover:text-red-600",onClick:se,title:s?"Clear All":"清空",children:e.jsx(Vt,{className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsxs("div",{className:"relative flex-1 max-w-sm",children:[e.jsx(to,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),e.jsx(it,{className:"h-7 pl-8 pr-7 text-xs bg-muted/30 border-0 focus-visible:ring-1",placeholder:s?"Filter by message, category...":"按消息、分类搜索...",value:u,onChange:pe=>h(pe.target.value)}),u&&e.jsx("button",{className:"absolute right-2 top-1/2 -translate-y-1/2",onClick:()=>h(""),children:e.jsx(ns,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]}),e.jsxs("select",{className:"h-7 px-2 text-[10px] rounded-md border border-border bg-muted/30 text-foreground cursor-pointer focus:outline-none focus:ring-1 focus:ring-ring",value:v,onChange:pe=>N(pe.target.value),children:[e.jsx("option",{value:"all",children:s?"All Time":"全部时间"}),e.jsx("option",{value:"1h",children:"1h"}),e.jsx("option",{value:"6h",children:"6h"}),e.jsx("option",{value:"1d",children:"1d"}),e.jsx("option",{value:"7d",children:"7d"})]}),e.jsxs("select",{className:"h-7 px-2 text-[10px] rounded-md border border-border bg-muted/30 text-foreground cursor-pointer focus:outline-none focus:ring-1 focus:ring-ring max-w-[120px]",value:y,onChange:pe=>b(pe.target.value),children:[e.jsx("option",{value:"all",children:s?"All Categories":"全部分类"}),Y.map(pe=>e.jsx("option",{value:pe,children:pe},pe))]}),e.jsxs("select",{className:"h-7 px-2 text-[10px] rounded-md border border-border bg-muted/30 text-foreground cursor-pointer focus:outline-none focus:ring-1 focus:ring-ring",value:j,onChange:pe=>T(pe.target.value),children:[e.jsx("option",{value:"all",children:s?"All":"全部"}),e.jsx("option",{value:"5000",children:"5K"}),e.jsx("option",{value:"10000",children:"10K"}),e.jsx("option",{value:"50000",children:"50K"}),e.jsx("option",{value:"100000",children:"100K"})]}),e.jsx("div",{className:"flex items-center gap-0.5 bg-muted/30 rounded-lg p-0.5",children:["ALL","DEBUG","INFO","WARN","ERROR"].map(pe=>e.jsxs("button",{className:`px-2 py-1 rounded-md text-[10px] font-medium transition-all ${f===pe?YR[pe]:"text-muted-foreground hover:text-foreground hover:bg-muted/50"}`,onClick:()=>p(pe),children:[pe==="ALL"?s?"All":"全部":pe,e.jsx("span",{className:"ml-1 opacity-70",children:String(F[pe])})]},pe))})]}),e.jsxs("div",{className:"flex-1 min-h-0 relative rounded-lg border border-border/50 bg-card/50 overflow-hidden",children:[P.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-muted-foreground gap-2",children:[e.jsx(fx,{className:"h-8 w-8 opacity-20"}),e.jsx("span",{className:"text-sm",children:s?"No logs to display":"暂无日志"}),u&&e.jsx("span",{className:"text-xs",children:s?"Try adjusting your filter":"尝试调整搜索条件"})]}):e.jsx(QR,{logs:P,expandedIdx:M,onToggleExpand:pe=>G(M===pe?null:pe),containerRef:q,onScroll:be,isAtBottom:S,formatTime:fe}),!S&&e.jsxs("button",{className:"absolute bottom-3 right-3 flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-primary text-primary-foreground text-xs font-medium shadow-lg hover:bg-primary/90 transition-all animate-in slide-in-from-bottom-2",onClick:K,children:[e.jsx(_N,{className:"h-3.5 w-3.5"}),W>0?e.jsx(e.Fragment,{children:s?`${W} new`:`${W} 条新日志`}):e.jsx(e.Fragment,{children:s?"Bottom":"回到底部"})]})]}),e.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground flex-shrink-0 px-1",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{children:[s?"Showing":"显示"," ",e.jsx("span",{className:"font-mono",children:P.length.toLocaleString()})," / ",e.jsx("span",{className:"font-mono",children:r.length.toLocaleString()})]}),F.ERROR>0&&e.jsxs("span",{className:"text-red-500",children:["● ",F.ERROR," ",s?"errors":"错误"]}),F.WARN>0&&e.jsxs("span",{className:"text-amber-500",children:["● ",F.WARN," ",s?"warnings":"警告"]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(zN,{className:`h-3 w-3 ${S?"text-green-500":"text-muted-foreground/40"}`}),e.jsx("span",{children:S?s?"Following":"跟随中":s?"Scrolled up":"已暂停跟随"})]})]})]})}function QR({logs:n,expandedIdx:s,onToggleExpand:r,containerRef:i,onScroll:o,isAtBottom:d,formatTime:u}){const h=lo({count:n.length,getScrollElement:()=>i.current,estimateSize:f=>s===f?120:24,overscan:20});return g.useEffect(()=>{d&&n.length>0&&h.scrollToIndex(n.length-1,{align:"end"})},[n.length,d,h]),e.jsx("div",{ref:i,className:"h-full overflow-y-auto font-mono text-[11px] leading-5",onScroll:o,children:e.jsx("div",{style:{height:h.getTotalSize(),width:"100%",position:"relative"},children:h.getVirtualItems().map(f=>{const p=f.index,y=n[p],b=s===p,v=XR[y.level]||Va;return e.jsxs("div",{"data-index":p,ref:h.measureElement,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${f.start}px)`},className:`group cursor-pointer transition-colors ${y.level==="ERROR"?"bg-red-500/[0.04]":y.level==="WARN"?"bg-amber-500/[0.04]":p%2===0?"bg-transparent":"bg-muted/20"} hover:bg-muted/40`,onClick:()=>r(p),children:[e.jsxs("div",{className:"grid items-start px-3 py-[3px]",style:{gridTemplateColumns:"8px 82px 80px 1fr"},children:[e.jsx("div",{className:`w-1.5 h-1.5 rounded-full mt-[7px] ${qR[y.level]}`}),e.jsx("span",{className:"text-muted-foreground/60 tabular-nums select-all",children:u(y.timestamp)}),e.jsx("span",{className:`text-[9px] px-1.5 py-[1px] rounded font-medium text-center truncate ${y.category==="Kiro"?"bg-blue-500/10 text-blue-500":y.category==="ProxyServer"?"bg-violet-500/10 text-violet-500":y.category==="KiroAPI"?"bg-cyan-500/10 text-cyan-500":"bg-muted/60 text-muted-foreground"}`,children:y.category}),e.jsxs("div",{className:"min-w-0 pl-2",children:[e.jsx("span",{className:`${Aj[y.level]} break-all`,children:y.message}),y.data!==void 0&&y.data!==null&&e.jsx(v,{className:`inline-block ml-1 h-3 w-3 opacity-30 group-hover:opacity-60 ${Aj[y.level]}`})]})]}),b&&y.data!==void 0&&y.data!==null&&e.jsx("div",{className:"mx-3 mb-1 ml-[174px] p-2 rounded-md bg-muted/40 border border-border/30 text-[10px] overflow-x-auto",children:e.jsx("pre",{className:"whitespace-pre-wrap break-all text-muted-foreground leading-4",children:String(typeof y.data=="string"?y.data:JSON.stringify(y.data,null,2))})})]},f.key)})})})}function ZR(){const[n,s]=g.useState(!1),[r,i]=g.useState("idle"),[o,d]=g.useState(null),[u,h]=g.useState(null),[f,p]=g.useState(null);g.useEffect(()=>{const T=window.api.onUpdateChecking(()=>{i("checking")}),S=window.api.onUpdateAvailable(G=>{d(G),i("available"),s(!0)}),k=window.api.onUpdateNotAvailable(()=>{i("idle")}),R=window.api.onUpdateDownloadProgress(G=>{h(G),i("downloading")}),I=window.api.onUpdateDownloaded(G=>{d(G),i("downloaded")}),M=window.api.onUpdateError(G=>{p(G),i("error")});return()=>{T(),S(),k(),R(),I(),M()}},[]);const y=async()=>{i("downloading"),h(null),await window.api.downloadUpdate()},b=()=>{window.api.installUpdate()},v=()=>{r!=="downloading"&&s(!1)},N=T=>T<1024?`${T} B`:T<1024*1024?`${(T/1024).toFixed(1)} KB`:`${(T/1024/1024).toFixed(1)} MB`,j=T=>`${N(T)}/s`;return n?Tn.createPortal(e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:v}),e.jsxs("div",{className:"relative glass-card-strong rounded-2xl shadow-2xl w-full max-w-md m-4 animate-in zoom-in-95 duration-200 overflow-hidden",children:[e.jsx("div",{className:"bg-gradient-to-r from-primary/10 to-primary/5 p-6 border-b",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl bg-primary/20 flex items-center justify-center",children:e.jsx(Hi,{className:"h-6 w-6 text-primary"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-bold",children:"发现新版本"}),o&&e.jsxs("p",{className:"text-sm text-muted-foreground",children:["v",o.version]})]})]}),r!=="downloading"&&e.jsx("button",{onClick:v,className:"p-2 hover:bg-red-500 hover:text-white rounded-lg transition-colors",children:e.jsx(ns,{className:"h-5 w-5"})})]})}),e.jsxs("div",{className:"p-6 space-y-4",children:[r==="available"&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"新版本已发布,建议立即更新以获得最新功能和修复。"}),o?.releaseNotes&&e.jsx("div",{className:"bg-muted/50 rounded-lg p-3 max-h-32 overflow-y-auto text-xs text-muted-foreground prose prose-sm prose-neutral dark:prose-invert max-w-none [&_ul]:list-disc [&_ul]:pl-4 [&_li]:my-0.5 [&_h1]:text-sm [&_h2]:text-xs [&_h3]:text-xs [&_p]:my-1 [&_hr]:my-2",dangerouslySetInnerHTML:{__html:o.releaseNotes}}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(D,{variant:"outline",className:"flex-1",onClick:v,children:"稍后提醒"}),e.jsxs(D,{className:"flex-1",onClick:y,children:[e.jsx(Ns,{className:"h-4 w-4 mr-2"}),"立即下载"]})]})]}),r==="downloading"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"正在下载更新..."}),e.jsx("span",{className:"font-mono",children:u?`${u.percent.toFixed(1)}%`:"0%"})]}),e.jsx(Gu,{value:u?.percent??0,className:"h-2"}),u&&e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsxs("span",{children:[N(u.transferred)," / ",N(u.total)]}),e.jsx("span",{children:j(u.bytesPerSecond)})]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(Mt,{className:"h-4 w-4 animate-spin"}),e.jsx("span",{children:"请勿关闭应用..."})]})]}),r==="downloaded"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-3 text-success",children:[e.jsx(Bn,{className:"h-6 w-6"}),e.jsx("span",{className:"font-medium",children:"下载完成!"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"更新已下载完成,点击下方按钮重启应用以完成安装。"}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(D,{variant:"outline",className:"flex-1",onClick:v,children:"稍后安装"}),e.jsxs(D,{className:"flex-1",onClick:b,children:[e.jsx(Mt,{className:"h-4 w-4 mr-2"}),"立即重启"]})]})]}),r==="error"&&e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-sm text-destructive",children:["更新检查失败: ",f]}),e.jsx(D,{variant:"outline",className:"w-full",onClick:v,children:"关闭"})]})]})]})]}),document.body):null}function JR(){const{t:n}=Ut(),s=n("common.unknown")==="Unknown",[r,i]=g.useState(!1),[o,d]=g.useState(!1);g.useEffect(()=>{const h=window.api.onShowCloseConfirmDialog(()=>{i(!0),d(!1)});return()=>h()},[]);const u=h=>{window.api.sendCloseConfirmResponse(h,o),i(!1)};return r?Tn.createPortal(e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:()=>u("cancel")}),e.jsxs("div",{className:"relative glass-card-strong rounded-2xl shadow-2xl w-full max-w-md m-4 animate-in zoom-in-95 duration-200 overflow-hidden",children:[e.jsx("div",{className:"bg-gradient-to-r from-primary/10 to-[var(--gradient-to)]/10 p-6 border-b",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl bg-primary/20 flex items-center justify-center",children:e.jsx(fs,{className:"h-6 w-6 text-primary"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-bold",children:s?"Close Window":"Đóng cửa sổ"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s?"Choose an action":"Chọn thao tác"})]})]}),e.jsx("button",{onClick:()=>u("cancel"),className:"p-2 hover:bg-muted rounded-lg transition-colors",children:e.jsx(ns,{className:"h-5 w-5"})})]})}),e.jsxs("div",{className:"p-6 space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s?"Would you like to minimize to system tray or exit the application?":"Anh muốn thu nhỏ xuống khay hệ thống hay thoát hẳn ứng dụng?"}),e.jsx("p",{className:"text-xs text-muted-foreground bg-muted/50 rounded-lg p-3",children:s?"When minimized to tray, the app will continue running in the background and the proxy service will remain available. You can reopen the window by clicking the tray icon.":"Khi thu nhỏ xuống khay, ứng dụng vẫn chạy nền và dịch vụ proxy vẫn hoạt động. Có thể mở lại bằng cách bấm biểu tượng ở khay hệ thống."}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(D,{variant:"outline",className:"w-full justify-start gap-3 h-12",onClick:()=>u("minimize"),children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-blue-500/10 flex items-center justify-center",children:e.jsx(LA,{className:"h-4 w-4 text-blue-500"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("div",{className:"font-medium",children:s?"Minimize to Tray":"Thu nhỏ xuống khay"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s?"Continue running in background":"Tiếp tục chạy nền"})]})]}),e.jsxs(D,{variant:"outline",className:"w-full justify-start gap-3 h-12",onClick:()=>u("quit"),children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-red-500/10 flex items-center justify-center",children:e.jsx(px,{className:"h-4 w-4 text-red-500"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("div",{className:"font-medium",children:s?"Exit Application":"Thoát ứng dụng"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s?"Close the app completely":"Đóng hoàn toàn ứng dụng"})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[e.jsx("button",{type:"button",onClick:()=>d(!o),className:`w-4 h-4 rounded border flex items-center justify-center transition-colors ${o?"bg-primary border-primary":"border-muted-foreground/50 hover:border-primary"}`,children:o&&e.jsx(Pt,{className:"h-3 w-3 text-primary-foreground"})}),e.jsx("button",{type:"button",onClick:()=>d(!o),className:"text-sm text-muted-foreground cursor-pointer select-none",children:s?"Remember my choice":"Ghi nhớ lựa chọn"})]}),e.jsx(D,{variant:"ghost",className:"w-full",onClick:()=>u("cancel"),children:s?"Cancel":"Hủy"})]})]})]}),document.body):null}const eD=400,Mj=120;function tD(){const[n,s]=g.useState("home"),[r,i]=g.useState(!0),{loadFromStorage:o,startAutoTokenRefresh:d,stopAutoTokenRefresh:u,applyBackgroundRefreshResults:h,applyBackgroundCheckResults:f,flushSaveImmediately:p,accounts:y,activeAccountId:b,setActiveAccount:v,checkAndRefreshExpiringTokens:N,updateAccountStatus:j}=vt(),T=g.useCallback(()=>{const I=Array.from(y.values()).filter(W=>W.status==="active");if(I.length<=1)return;const G=(I.findIndex(W=>W.id===b)+1)%I.length;v(I[G].id)},[y,b,v]),S=g.useRef(null),k=g.useCallback(()=>{S.current&&clearTimeout(S.current),S.current=setTimeout(()=>{S.current=null;const I=vt.getState(),M=I.accounts,G=I.activeAccountId,W=Array.from(M.values()).map(U=>({id:U.id,email:U.email||"Unknown",idp:U.idp||"Unknown",status:U.status}));if(window.api.updateTrayAccountList(W),G){const U=M.get(G);U?window.api.updateTrayAccount({id:U.id,email:U.email||"Unknown",idp:U.idp||"Unknown",status:U.status,subscription:U.subscription?.title||void 0,usage:U.usage?{usedCredits:U.usage.current||0,totalCredits:U.usage.limit||0,totalRequests:0,successRequests:0,failedRequests:0}:void 0}):window.api.updateTrayAccount(null)}else window.api.updateTrayAccount(null)},eD)},[]);g.useEffect(()=>(o().then(()=>{d()}),vt.getState().loadProactiveRenewalEnabled(),_n.getState().loadFromStorage(),()=>{u()}),[o,d,u]),g.useEffect(()=>typeof window.api.onKiroIdeTokenChanged!="function"?void 0:window.api.onKiroIdeTokenChanged(M=>{console.log(`[App] Kiro IDE refreshed token for account ${M.accountId} (${M.reason}), reloading accounts...`),o().catch(G=>console.warn("[App] reload after IDE token change failed:",G))}),[o]),g.useEffect(()=>{const I=window.api.onProxyWebhookTrigger?.((M,G)=>{try{const W=_n.getState(),q={"proxy-account-suspended":"account-banned","proxy-all-exhausted":"risk-warning"}[M]||"risk-warning",V=G?.level,le=V==="error"?"error":V==="info"?"info":V==="success"?"success":"warn";W.triggerEvent(q,{title:String(G.title??"反代告警"),message:String(G.message??""),level:le,fields:G?.fields})}catch(W){console.error("[App] Proxy webhook trigger failed:",W)}});return()=>{I?.()}},[]),g.useEffect(()=>{const I=M=>{const G=M.detail;G&&s(G)};return window.addEventListener("navigate-page",I),()=>window.removeEventListener("navigate-page",I)},[]),g.useEffect(()=>{const I=()=>{p()};return window.addEventListener("beforeunload",I),()=>{window.removeEventListener("beforeunload",I),S.current&&clearTimeout(S.current)}},[p]),g.useEffect(()=>{k()},[y,b,k]),g.useEffect(()=>{const I=window.api.onTrayRefreshAccount(()=>{N(),k()});return()=>{I()}},[N,k]),g.useEffect(()=>{const I=window.api.onTraySwitchAccount(()=>{T()});return()=>{I()}},[T]),g.useEffect(()=>{const I=[];let M=null;const G=()=>{if(M=null,I.length===0)return;const U=I.splice(0);h(U)},W=window.api.onBackgroundRefreshResult(U=>{I.push(U),M||(M=setTimeout(G,Mj))});return()=>{W(),M&&(clearTimeout(M),G())}},[h]),g.useEffect(()=>{const I=[];let M=null;const G=()=>{if(M=null,I.length===0)return;const U=I.splice(0);f(U)},W=window.api.onBackgroundCheckResult(U=>{I.push(U),M||(M=setTimeout(G,Mj))});return()=>{W(),M&&(clearTimeout(M),G())}},[f]),g.useEffect(()=>{const I=window.api.onProxyAccountSuspended(M=>{console.warn(`[App] Account suspended via proxy: ${M.email||M.id} (${M.reason})`),j(M.id,"error",`[${M.reason}] ${M.message}`)});return()=>{I()}},[j]);const R=()=>{switch(n){case"home":return e.jsx(tj,{});case"accounts":return e.jsx(dI,{});case"machineId":return e.jsx(TI,{});case"kiroSettings":return e.jsx(LI,{});case"proxy":return e.jsx(WI,{});case"kproxy":return e.jsx(JI,{});case"proxyPool":return e.jsx(aR,{});case"register":return e.jsx(VR,{});case"subscription":return e.jsx(vR,{});case"webhooks":return e.jsx(iR,{});case"diagnose":return e.jsx(hR,{});case"configSync":return e.jsx(mR,{});case"logs":return e.jsx(WR,{});case"settings":return e.jsx(SI,{});case"about":return e.jsx(NI,{});default:return e.jsx(tj,{})}};return e.jsxs("div",{className:"h-screen ambient-bg overflow-hidden flex flex-col",children:[e.jsx(vI,{}),e.jsxs("div",{className:"flex-1 min-h-0 flex gap-2 p-2 max-md:flex-col",children:[e.jsx(hI,{currentPage:n,onPageChange:s,collapsed:r,onToggleCollapse:()=>i(!r)}),e.jsx("main",{className:"flex-1 min-w-0 overflow-hidden rounded-3xl page-surface max-md:rounded-2xl",children:e.jsx(fc,{mode:"wait",children:e.jsx(za.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.25,ease:[.4,0,.2,1]},className:"h-full flex flex-col",children:R()},n)})})]}),e.jsx(ZR,{}),e.jsx(JR,{})]})}const pw="".replace(/\/$/,""),sD=2e3,Zr=new Map;let Wr=null,Wl=null;function nD(n){return n.replace(/^on/,"").replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z])([A-Z][a-z])/g,"$1-$2").toLowerCase()}function xw(){Wr||Zr.size===0||(Wr=new EventSource(`${pw}/api/events`,{withCredentials:!0}),Wr.onmessage=n=>{try{const s=JSON.parse(n.data),r=Zr.get(s.channel);if(!r)return;const i=Array.isArray(s.args)?s.args:[s.payload];for(const o of r)o(...i)}catch(s){console.warn("[WebApi] Failed to parse event payload",s)}},Wr.onerror=()=>{Wr?.close(),Wr=null,Zr.size>0&&!Wl&&(Wl=setTimeout(()=>{Wl=null,xw()},sD))})}function aD(n,s){let r=Zr.get(n);return r||(r=new Set,Zr.set(n,r)),r.add(s),xw(),()=>{const i=Zr.get(n);i?.delete(s),i&&i.size===0&&Zr.delete(n),Zr.size===0&&(Wr?.close(),Wr=null,Wl&&(clearTimeout(Wl),Wl=null))}}async function Op(n,s){const r=await fetch(`${pw}/api/ipc`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({method:n,args:s})}),i=await r.text(),o=i?JSON.parse(i):null;if(!r.ok)throw new Error(o?.error||r.statusText);return o}function rD(n,s){const r=new Blob([n],{type:"text/plain;charset=utf-8"}),i=URL.createObjectURL(r),o=document.createElement("a");return o.href=i,o.download=s,document.body.appendChild(o),o.click(),o.remove(),URL.revokeObjectURL(i),!0}function iD(){return new Promise(n=>{const s=document.createElement("input");s.type="file",s.accept=".json,.txt,.csv,text/plain,application/json,text/csv",s.onchange=async()=>{const r=s.files?.[0];if(!r){n(null);return}const i=await r.text(),o=r.name.split(".").pop()?.toLowerCase()||"txt";n({content:i,format:o})},s.click()})}const lD={openExternal:n=>{window.open(n,"_blank","noopener,noreferrer")},openSubscriptionWindow:async n=>(window.open(n,"_blank","noopener,noreferrer"),{success:!0}),exportToFile:async(n,s)=>rD(n,s),importFromFile:iD,startSocialLogin:async(n,s)=>{const r=await Op("startSocialLogin",[n,s]);return r.success&&r.loginUrl&&window.open(r.loginUrl,"_blank","noopener,noreferrer"),r},protonOpenLogin:async()=>{const n=await Op("protonOpenLogin",[]);return n.loginUrl&&window.open(n.loginUrl,"_blank","noopener,noreferrer"),n},downloadUpdate:async()=>({success:!1,error:"Web deployments are updated on the server."}),installUpdate:()=>{},getProactiveRenewalEnabled:async()=>({success:!0,enabled:!1,leadTimeMinutes:15}),setProactiveRenewalEnabled:async()=>({success:!1,enabled:!1,error:"Kiro IDE proactive renewal is only available in the desktop application."}),updateTrayAccount:()=>{},updateTrayAccountList:()=>{},refreshTrayMenu:()=>{},updateTrayLanguage:()=>{},sendCloseConfirmResponse:()=>{},window:{minimize:()=>{},maximizeToggle:()=>{},close:()=>{},isMaximized:async()=>!1,getPlatform:async()=>"darwin",onMaximizeChange:()=>()=>{}}},oD=new Proxy(lD,{get(n,s){if(typeof s!="string")return;if(s in n)return n[s];if(s.startsWith("on")&&s.length>2){const i=o=>aD(nD(s),o);return n[s]=i,i}const r=(...i)=>Op(s,i);return n[s]=r,r}});function cD(){window.api||(window.api=oD),window.electron||(window.electron={})}const dD="".replace(/\/$/,"");async function Sx(n,s){const r=await fetch(`${dD}${n}`,{credentials:"include",headers:{"Content-Type":"application/json",...s?.headers||{}},...s}),i=await r.text(),o=i?JSON.parse(i):null;if(!r.ok)throw new Error(o?.error||r.statusText);return o}function uD(){return Sx("/api/auth/session")}function hD(n,s){return Sx("/api/auth/login",{method:"POST",body:JSON.stringify({email:s,password:n})})}function mD(n){return Sx("/api/auth/setup",{method:"POST",body:JSON.stringify(n)})}function fD({children:n}){const[s,r]=g.useState(!0),[i,o]=g.useState(!1),[d,u]=g.useState(null),[h,f]=g.useState(""),[p,y]=g.useState(""),[b,v]=g.useState(""),[N,j]=g.useState("random"),[T,S]=g.useState(""),[k,R]=g.useState(null),[I,M]=g.useState(""),[G,W]=g.useState(!1);g.useEffect(()=>{uD().then(V=>{o(!!V.setupRequired),u(V.user||null)}).catch(()=>u(null)).finally(()=>r(!1))},[]);const U=async V=>{V.preventDefault(),M(""),W(!0);try{const le=await hD(h);o(!!le.setupRequired),u(le.user||null)}catch(le){M(le instanceof Error?le.message:"Dang nhap that bai")}finally{W(!1)}},q=async V=>{if(V.preventDefault(),M(""),N==="custom"){if(p.length<8){M("Mat khau can it nhat 8 ky tu");return}if(p!==b){M("Hai mat khau khong khop");return}}W(!0);try{const le=await mD({mode:N,password:N==="custom"?p:void 0});o(!1),le.generatedPassword?(S(le.generatedPassword),R(le.user||null)):u(le.user||null)}catch(le){M(le instanceof Error?le.message:"Thiet lap Krouter that bai")}finally{W(!1)}};return s?e.jsx("div",{className:"h-screen ambient-bg flex items-center justify-center text-foreground",children:e.jsx(bt,{className:"h-5 w-5 animate-spin"})}):d?n:T&&k?e.jsxs(qf,{children:[e.jsxs("div",{className:"mb-5 flex items-center gap-3",children:[e.jsx(Xf,{}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-base font-semibold text-foreground",children:"Krouter da san sang"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Mat khau admin chi hien thi mot lan."})]})]}),e.jsxs("div",{className:"rounded-xl border border-primary/20 bg-primary/5 p-3",children:[e.jsx("div",{className:"mb-1 text-xs font-medium text-muted-foreground",children:"Mat khau admin"}),e.jsx("div",{className:"select-all break-all rounded-lg bg-background/80 px-3 py-2 font-mono text-sm text-foreground",children:T})]}),e.jsxs("button",{type:"button",onClick:()=>u(k),className:"mt-4 flex h-10 w-full items-center justify-center gap-2 rounded-lg bg-primary px-3 text-sm font-medium text-primary-foreground transition hover:bg-primary/90",children:[e.jsx(Pt,{className:"h-4 w-4"}),"Vao dashboard"]})]}):i?e.jsxs(qf,{onSubmit:q,children:[e.jsxs("div",{className:"mb-5 flex items-center gap-3",children:[e.jsx(Xf,{}),e.jsxs("div",{children:[e.jsxs("h1",{className:"text-base font-semibold text-foreground",children:["Thiet lap ",oa]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Tao mat khau admin cho lan cai dat dau tien."})]})]}),e.jsxs("div",{className:"mb-4 grid grid-cols-2 gap-2",children:[e.jsx(Ej,{active:N==="random",icon:e.jsx(Kn,{className:"h-4 w-4"}),title:"Krouter tao",description:"Random an toan",onClick:()=>j("random")}),e.jsx(Ej,{active:N==="custom",icon:e.jsx(ii,{className:"h-4 w-4"}),title:"Tu dat",description:"Nhap mat khau rieng",onClick:()=>j("custom")})]}),N==="custom"&&e.jsxs("div",{className:"space-y-3",children:[e.jsx(Yf,{id:"setup-password",label:"Mat khau moi",value:p,onChange:y,autoComplete:"new-password"}),e.jsx(Yf,{id:"setup-password-confirm",label:"Nhap lai mat khau",value:b,onChange:v,autoComplete:"new-password"})]}),N==="random"&&e.jsx("div",{className:"rounded-xl border border-border/80 bg-background/60 p-3 text-xs leading-relaxed text-muted-foreground",children:"Krouter se tao mat khau manh va hien thi mot lan de anh luu lai."}),e.jsx(Ij,{error:I}),e.jsxs("button",{type:"submit",disabled:G,className:"mt-4 flex h-10 w-full items-center justify-center gap-2 rounded-lg bg-primary px-3 text-sm font-medium text-primary-foreground transition hover:bg-primary/90 disabled:opacity-60",children:[G?e.jsx(bt,{className:"h-4 w-4 animate-spin"}):e.jsx(FN,{className:"h-4 w-4"}),N==="random"?"Tao mat khau random":"Luu mat khau"]})]}):e.jsxs(qf,{onSubmit:U,children:[e.jsxs("div",{className:"mb-5 flex items-center gap-3",children:[e.jsx(Xf,{}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-base font-semibold text-foreground",children:oa}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Dang nhap vao may chu quan tri."})]})]}),e.jsx(Yf,{id:"password",label:"Mat khau",value:h,onChange:f,autoComplete:"current-password"}),e.jsx(Ij,{error:I}),e.jsx("button",{type:"submit",disabled:G,className:"mt-4 flex h-10 w-full items-center justify-center rounded-lg bg-primary px-3 text-sm font-medium text-primary-foreground transition hover:bg-primary/90 disabled:opacity-60",children:G?e.jsx(bt,{className:"h-4 w-4 animate-spin"}):"Dang nhap"})]})}function qf({children:n,onSubmit:s}){const r=e.jsx("div",{className:"w-full max-w-sm glass-card-strong rounded-2xl border border-foreground/10 p-5 shadow-xl",children:n});return e.jsx("div",{className:"h-screen ambient-bg flex items-center justify-center p-4",children:s?e.jsx("form",{onSubmit:s,className:"w-full max-w-sm",children:r}):r})}function Xf(){return e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl bg-primary/10 text-primary",children:e.jsx("img",{src:Ac,alt:"",className:"h-8 w-8"})})}function Ej(n){return e.jsxs("button",{type:"button",onClick:n.onClick,className:me("rounded-xl border p-3 text-left transition",n.active?"border-primary/50 bg-primary/10":"border-border bg-background/60 hover:bg-muted/60"),children:[e.jsx("div",{className:"mb-2 text-primary",children:n.icon}),e.jsx("div",{className:"text-sm font-semibold text-foreground",children:n.title}),e.jsx("div",{className:"text-[11px] text-muted-foreground",children:n.description})]})}function Yf(n){return e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs font-medium text-muted-foreground",htmlFor:n.id,children:n.label}),e.jsx("input",{id:n.id,type:"password",value:n.value,onChange:s=>n.onChange(s.target.value),className:"h-10 w-full rounded-lg border border-border bg-background/70 px-3 text-sm outline-none focus:ring-2 focus:ring-primary/30",autoComplete:n.autoComplete,required:!0})]})}function Ij({error:n}){return n?e.jsx("div",{className:"mt-3 rounded-lg bg-destructive/10 px-3 py-2 text-xs text-destructive",children:n}):null}const $i="Krouter",pD={Krouter:$i,"Account Manager":$i,"Welcome to Krouter":`Chào mừng đến với ${$i}`,"Krouter - Diagnostic Report":`${$i} - Báo cáo chẩn đoán`,"Sign in":"Đăng nhập","Sign in to the VPS backend.":"Đăng nhập vào máy chủ quản trị.",Password:"Mật khẩu","Login failed":"Đăng nhập thất bại",Home:"Trang chính",Accounts:"Tài khoản","Machine ID":"Mã máy","Kiro Settings":"Cài đặt Kiro","API Proxy":"Proxy API","K-Proxy":"K-Proxy","Proxy Pool":"Kho proxy",Webhooks:"Webhook",Diagnostics:"Chẩn đoán","Config Sync":"Đồng bộ cấu hình",Register:"Đăng ký",Subscription:"Gói dịch vụ",Logs:"Nhật ký",Settings:"Cài đặt",About:"Giới thiệu",Confirm:"Xác nhận",Cancel:"Hủy",Save:"Lưu",Delete:"Xóa",Edit:"Sửa",Add:"Thêm",Close:"Đóng",Clear:"Xóa",Refresh:"Làm mới",Copy:"Sao chép",Copied:"Đã sao chép","Copied!":"Đã sao chép!",Import:"Nhập",Export:"Xuất",Backup:"Sao lưu",Reset:"Đặt lại",Apply:"Áp dụng",Search:"Tìm kiếm",Filter:"Lọc",Sort:"Sắp xếp",All:"Tất cả",None:"Không có",Unknown:"Không rõ","Other/Unknown":"Khác/không rõ",Enabled:"Đã bật",Disabled:"Đã tắt",Active:"Đang hoạt động",Error:"Lỗi",Banned:"Bị khóa",Expired:"Hết hạn",Success:"Thành công",Failed:"Thất bại",Pending:"Đang chờ",Skipped:"Đã bỏ qua",Status:"Trạng thái",Details:"Chi tiết",Actions:"Thao tác",Plan:"Gói",Usage:"Mức dùng",Base:"Cơ bản",Trial:"Dùng thử",Bonus:"Thưởng",Current:"Hiện tại","Current Account":"Tài khoản hiện tại","No Active Account":"Chưa có tài khoản hoạt động","No account selected":"Chưa chọn tài khoản",Select:"Chọn","Select all":"Chọn tất cả",Deselect:"Bỏ chọn","Deselect all":"Bỏ chọn tất cả",Invert:"Đảo chọn",Selected:"Đã chọn",Total:"Tổng",Email:"Email","Email/ID":"Email/ID",Nickname:"Tên gợi nhớ",Provider:"Nhà cung cấp","User ID":"User ID","Token Expires":"Token hết hạn","Plan Type":"Loại gói","Overage Rate":"Phí vượt hạn mức","Resource Type":"Loại tài nguyên",Upgradable:"Có thể nâng cấp","Available Models":"Model khả dụng","Loading models...":"Đang tải model...","No models available":"Chưa có model khả dụng","No description":"Không có mô tả","Add Account":"Thêm tài khoản","Batch Add":"Thêm hàng loạt","Choose a method to add your Kiro account":"Chọn cách thêm tài khoản Kiro","SSO Token":"SSO Token","OIDC Credentials":"Thông tin OIDC","Social Login":"Đăng nhập mạng xã hội","Batch Import":"Nhập hàng loạt","Auth Method":"Phương thức xác thực","Refresh Token":"Làm mới token","Client ID":"Client ID","Client Secret":"Client Secret","AWS Region":"Vùng AWS","Login with Google":"Đăng nhập bằng Google","Login with GitHub":"Đăng nhập bằng GitHub","Waiting for authorization...":"Đang chờ cấp quyền...","Authorization successful!":"Cấp quyền thành công!","Authorization failed":"Cấp quyền thất bại","Verifying...":"Đang xác minh...","Verification successful":"Xác minh thành công","Verification failed":"Xác minh thất bại","Account Registration":"Đăng ký tài khoản","Register new Kiro accounts automatically or manually":"Đăng ký tài khoản Kiro tự động hoặc thủ công","Registration Mode":"Chế độ đăng ký",Manual:"Thủ công",Outlook:"Outlook","Custom Domain":"Tên miền riêng",Tingamefi:"Tingamefi",Proton:"Proton",Mixed:"Kết hợp","Auto Import":"Tự nhập","Fetch Pro Link":"Lấy link Pro","Start Registration":"Bắt đầu đăng ký","Batch Registration":"Đăng ký hàng loạt",Templates:"Mẫu","Save current":"Lưu cấu hình hiện tại",Count:"Số lượng","Interval (s)":"Khoảng cách (giây)",Retries:"Thử lại",Concurrency:"Số luồng","Start Batch":"Bắt đầu hàng loạt","Stop Batch":"Dừng hàng loạt",Pause:"Tạm dừng",Resume:"Tiếp tục",Progress:"Tiến độ","Registration History":"Lịch sử đăng ký","Clear History":"Xóa lịch sử",Log:"Nhật ký","Registration Analytics":"Phân tích đăng ký",Registrations:"Lượt đăng ký","Risk Control":"Kiểm soát rủi ro",Network:"Mạng","Rate limited":"Bị giới hạn tốc độ","Import Failed":"Nhập thất bại",Imported:"Đã nhập",Retrying:"Đang thử lại","Retry all":"Thử lại tất cả","Batch Subscription":"Gói dịch vụ hàng loạt","Using all accounts":"Đang dùng tất cả tài khoản","Overage Settings":"Cài đặt vượt hạn mức","Subscription Links":"Link gói dịch vụ","Manage Subscriptions":"Quản lý gói dịch vụ","Subscription Lifecycle Management":"Quản lý vòng đời gói dịch vụ","Load Plans":"Tải danh sách gói","Pre-flight Check":"Kiểm tra trước khi chạy","Import Links":"Nhập link","Open All":"Mở tất cả","Open Selected":"Mở mục đã chọn","Export All":"Xuất tất cả","Export Selected":"Xuất mục đã chọn","Remove Failed":"Xóa mục lỗi",Validate:"Kiểm tra","Quick pick":"Chọn nhanh",Top:"Đầu danh sách",Next:"Tiếp theo","Pick:":"Chọn:","Days Left":"Ngày còn lại",Overage:"Vượt hạn mức",ENABLED:"ĐÃ BẬT",DISABLED:"ĐÃ TẮT",Manage:"Quản lý","No-Overage":"Tắt vượt hạn mức","Proxy Running":"Proxy đang chạy","Proxy Stopped":"Proxy đã dừng","Start Proxy":"Bật proxy","Stop Proxy":"Dừng proxy",Port:"Cổng","API Keys":"API key","Model Cache":"Bộ nhớ đệm model","Diagnostics Report":"Báo cáo chẩn đoán","Check Updates":"Kiểm tra cập nhật","Checking...":"Đang kiểm tra...","Join Group":"Tham gia nhóm",Version:"Phiên bản",Features:"Tính năng","Tech Stack":"Công nghệ",Author:"Tác giả","Release Notes":"Ghi chú phát hành","Close Window":"Đóng cửa sổ","Choose an action":"Chọn thao tác","Minimize to Tray":"Thu nhỏ xuống khay hệ thống","Continue running in background":"Tiếp tục chạy nền","Exit Application":"Thoát ứng dụng","Close the app completely":"Đóng hoàn toàn ứng dụng","Remember my choice":"Ghi nhớ lựa chọn",Minimize:"Thu nhỏ",Maximize:"Phóng to",Restore:"Khôi phục",Theme:"Giao diện",Language:"Ngôn ngữ",Privacy:"Quyền riêng tư","Auto Refresh":"Tự làm mới","Auto Switch":"Tự đổi tài khoản","Data Management":"Quản lý dữ liệu","Danger Zone":"Vùng nguy hiểm","Dark Mode":"Chế độ tối","Light Mode":"Chế độ sáng","Search accounts...":"Tìm tài khoản...","No accounts yet":"Chưa có tài khoản","No Group":"Chưa có nhóm","Tags:":"Thẻ:","Plan:":"Gói:","Status:":"Trạng thái:","Usage:":"Mức dùng:","Days:":"Ngày:","Bound Proxy (Reverse Proxy)":"Proxy đã gắn (reverse proxy)","+ Bind to Proxy":"+ Gắn proxy",Unbind:"Bỏ gắn",Change:"Đổi","Account Suspended":"Tài khoản bị hạn chế","Error Details":"Chi tiết lỗi","Contact Support":"Liên hệ hỗ trợ","Reset Suspended":"Đặt lại trạng thái hạn chế","Choose Your Plan":"Chọn gói dịch vụ","Subscription Plans":"Gói dịch vụ","Manage Billing":"Quản lý thanh toán",Free:"Miễn phí","Loading...":"Đang tải...","1. Export and install the CA certificate to your system trust store":"1. Xuất và cài chứng chỉ CA vào kho tin cậy của hệ thống","Export and install the CA certificate to your system trust store":"Xuất và cài chứng chỉ CA vào kho tin cậy của hệ thống","• Click input and press key combination to record":"• Bấm vào ô nhập rồi nhấn tổ hợp phím để ghi lại","Click input and press key combination to record":"Bấm vào ô nhập rồi nhấn tổ hợp phím để ghi lại","• Click trash icon to clear shortcut":"• Bấm biểu tượng thùng rác để xóa phím tắt","Click trash icon to clear shortcut":"Bấm biểu tượng thùng rác để xóa phím tắt",关闭窗口:"Đóng cửa sổ",请选择关闭行为:"Chọn thao tác","您想要最小化到系统托盘还是退出程序?":"Anh muốn thu nhỏ xuống khay hệ thống hay thoát hẳn ứng dụng?","最小化到托盘后,程序将在后台继续运行,代理服务保持可用。您可以通过点击托盘图标重新打开窗口。":"Khi thu nhỏ xuống khay, ứng dụng vẫn chạy nền và dịch vụ proxy vẫn hoạt động. Có thể mở lại bằng cách bấm biểu tượng ở khay hệ thống.",最小化到托盘:"Thu nhỏ xuống khay",在后台继续运行:"Tiếp tục chạy nền",退出程序:"Thoát ứng dụng",完全关闭应用:"Đóng hoàn toàn ứng dụng",记住我的选择:"Ghi nhớ lựa chọn",取消:"Hủy",关闭:"Đóng",保存:"Lưu",删除:"Xóa",编辑:"Sửa",复制:"Sao chép",已复制:"Đã sao chép","已复制!":"Đã sao chép!",刷新:"Làm mới",清空:"Xóa",清空结果:"Xóa kết quả",导出:"Xuất",导入:"Nhập",导入链接:"Nhập link","加载中...":"Đang tải...",未知:"Không rõ",未知错误:"Lỗi không rõ",已过期:"Đã hết hạn",过期:"Hết hạn",成功:"Thành công",失败:"Thất bại",错误:"Lỗi",等待中:"Đang chờ",跳过:"Đã bỏ qua",当前:"Hiện tại",当前使用:"Đang dùng",已封禁:"Bị khóa",账户已封禁:"Tài khoản bị khóa","账号凭证不完整,无法切换":"Thông tin tài khoản chưa đủ, không thể chuyển",使用量:"Mức dùng",总使用量:"Tổng mức dùng",配额总览:"Tổng quan hạn mức",刷新数据:"Làm mới dữ liệu","基础:":"Cơ bản:","试用:":"Dùng thử:",主配额:"Hạn mức chính",免费试用:"Dùng thử miễn phí",奖励总计:"Tổng thưởng",生效奖励明细:"Chi tiết thưởng đang hiệu lực",已用:"Đã dùng",基本信息:"Thông tin cơ bản",账户:"Tài khoản",账号:"Tài khoản","邮箱/ID":"Email/ID",账号别名:"Tên gợi nhớ",身份提供商:"Nhà cung cấp đăng nhập","用户 ID":"User ID",订阅详情:"Chi tiết gói",订阅类型:"Loại gói",超额费率:"Phí vượt hạn mức",资源类型:"Loại tài nguyên",可升级:"Có thể nâng cấp",账户可用模型:"Model khả dụng của tài khoản","加载模型中...":"Đang tải model...",暂无可用模型:"Chưa có model khả dụng",无描述:"Không có mô tả",反代绑定代理:"Proxy đã gắn cho reverse proxy",更换:"Đổi",解绑:"Bỏ gắn","+ 绑定代理":"+ Gắn proxy",'无可用代理。请先在"代理池"添加并验活。':'Chưa có proxy khả dụng. Hãy thêm và kiểm tra trong "Kho proxy" trước.',清除筛选:"Xóa bộ lọc","订阅:":"Gói:","状态:":"Trạng thái:","标签:":"Thẻ:","剩余:":"Còn lại:",添加账号:"Thêm tài khoản",添加第一个账号:"Thêm tài khoản đầu tiên",暂无账号:"Chưa có tài khoản",复制邮箱:"Sao chép email",订阅剩余天数:"Số ngày gói còn lại",切换到该账号:"Chuyển sang tài khoản này",切换到此账号:"Chuyển sang tài khoản này",检查账户信息:"Kiểm tra thông tin tài khoản","检查账户信息(用量、订阅、封禁状态)":"Kiểm tra thông tin tài khoản (mức dùng, gói, trạng thái khóa)","刷新 Token(仅刷新访问令牌)":"Làm mới token (chỉ access token)",复制凭证:"Sao chép thông tin đăng nhập",详情:"Chi tiết",联系支持:"Liên hệ hỗ trợ",重置封禁状态:"Đặt lại trạng thái bị khóa",错误详情:"Chi tiết lỗi",选择订阅计划:"Chọn gói dịch vụ",订阅计划:"Gói dịch vụ","请选择一个订阅计划以继续使用。":"Vui lòng chọn một gói để tiếp tục.","当前订阅:":"Gói hiện tại:",免费:"Miễn phí",选择:"Chọn",管理账单:"Quản lý thanh toán",管理:"Quản lý","绑定代理:":"Proxy đã gắn:",点击复制:"Bấm để sao chép",点击解绑:"Bấm để bỏ gắn",点击管理订阅:"Bấm để quản lý gói","标记为已恢复 — 反代池会重新使用该账号":"Đánh dấu đã khôi phục, pool proxy sẽ dùng lại tài khoản này","输入或生成设备 ID":"Nhập hoặc tạo mã thiết bị",证书已安装:"Đã cài chứng chỉ",证书已卸载:"Đã gỡ chứng chỉ",安装失败:"Cài thất bại",卸载失败:"Gỡ thất bại","文件已修改,确定要关闭吗?未保存的更改将丢失。":"File đã thay đổi, vẫn đóng? Các thay đổi chưa lưu sẽ bị mất.","在此编辑 Steering 规则...":"Sửa quy tắc Steering tại đây...","搜索邮箱、ID 或订阅类型...":"Tìm theo email, ID hoặc loại gói...","确定删除此 API Key?":"Xóa API Key này?","确定重置用量统计?":"Đặt lại thống kê sử dụng?","密钥名称...":"Tên key...","Credits 额度限制(可选)":"Giới hạn credit (tùy chọn)",无限制:"Không giới hạn",任务中心:"Trung tâm tác vụ",诊断报告已复制到剪贴板:"Đã sao chép báo cáo chẩn đoán vào clipboard","确定要删除 MCP 服务器":"Xóa MCP server",内部编辑:"Sửa trong app",外部打开:"Mở bên ngoài",工具名称:"Tên tool","按消息、分类搜索...":"Tìm theo nội dung, phân loại...","请输入解密密码:":"Nhập mật khẩu giải mã:","加密密码...":"Mật khẩu mã hóa...","已重置,请刷新页面":"Đã đặt lại, vui lòng tải lại trang","设置页面仅支持 JSON 格式导入,请使用账号管理页面导入 CSV/TXT":"Trang cài đặt chỉ hỗ trợ nhập JSON; hãy dùng trang tài khoản để nhập CSV/TXT.",所有数据已清除:"Đã xóa toàn bộ dữ liệu","请选择 JSON 文件":"Vui lòng chọn file JSON",不是有效的配置文件:"File cấu hình không hợp lệ",请输入加密密码:"Vui lòng nhập mật khẩu mã hóa",请先选择计划:"Vui lòng chọn gói trước",没有开启超额的账号:"Không có tài khoản nào bật vượt hạn mức",打开订阅门户:"Mở cổng quản lý gói","打开订阅门户取消/管理":"Mở cổng gói để hủy/quản lý",关闭超额:"Tắt vượt hạn mức",关超额:"Tắt vượt hạn mức",升级预检:"Kiểm tra trước khi nâng cấp",加载计划:"Tải danh sách gói",点击加载可用订阅计划:"Bấm để tải các gói khả dụng",快选:"Chọn nhanh",前N个:"Top N",下一批:"Lô tiếp theo",反选:"Đảo chọn",取消多选:"Bỏ chọn nhiều",无痕打开:"Mở ẩn danh",无痕打开选中链接:"Mở các link đã chọn ở chế độ ẩn danh",无痕打开全部链接:"Mở tất cả link ở chế độ ẩn danh",复制链接:"Sao chép link",复制选中链接:"Sao chép link đã chọn",复制全部链接:"Sao chép toàn bộ link",检测有效性:"Kiểm tra hiệu lực","检测过期链接(生成超过 15 分钟)":"Kiểm tra link hết hạn (tạo quá 15 phút)",移除失败和过期的链接:"Xóa link lỗi và hết hạn",仅移除失败项:"Chỉ xóa mục lỗi",取消全选:"Bỏ chọn tất cả",全选:"Chọn tất cả",可能已过期:"Có thể đã hết hạn",生成至今分钟数:"Số phút từ khi tạo",重新生成:"Tạo lại",批量导入链接:"Nhập link hàng loạt","没有可用代理,请先验活代理":"Chưa có proxy khả dụng, hãy kiểm tra proxy trước",没有可用账号:"Chưa có tài khoản khả dụng","代理 URL 无效或重复":"Proxy URL không hợp lệ hoặc bị trùng","如 socks5://127.0.0.1:7890(留空=不启用)":"VD socks5://127.0.0.1:7890 (để trống = tắt)","诊断代理链(定位失败在哪一层)":"Chẩn đoán chuỗi proxy để xác định tầng lỗi","搜索任意字段(host/端口/协议/user/邮箱/备注/URL)...":"Tìm mọi trường (host/cổng/giao thức/user/email/ghi chú/URL)...",停用:"Tắt",启用:"Bật",备注:"Ghi chú",点击编辑备注:"Bấm để sửa ghi chú",测试:"Kiểm tra",编辑备注:"Sửa ghi chú","复制 URL":"Sao chép URL",分组名称:"Tên nhóm",分组描述:"Mô tả nhóm","分组描述(可选)":"Mô tả nhóm (tùy chọn)",移出分组:"Xóa khỏi nhóm",管理账号:"Quản lý tài khoản",标签名称:"Tên thẻ",移除标签:"Xóa thẻ","Webhook 通知":"Thông báo webhook","添加 Webhook":"Thêm webhook","尚未配置 Webhook":"Chưa cấu hình webhook",测试成功:"Kiểm tra thành công",测试失败:"Kiểm tra thất bại","编辑 Webhook":"Sửa webhook","新建 Webhook":"Tạo webhook",类型:"Loại","备注名(可选)":"Tên ghi chú (tùy chọn)",订阅事件:"Sự kiện theo dõi",正常:"Bình thường",刷新中:"Đang làm mới",全部:"Tất cả",全部时间:"Toàn bộ thời gian","1小时":"1 giờ","6小时":"6 giờ","12小时":"12 giờ","1天":"1 ngày","3天":"3 ngày","7天":"7 ngày","30天":"30 ngày","1年":"1 năm","1万":"10K","5万":"50K","10万":"100K","20万":"200K","50万":"500K","100万":"1M",条:"dòng",条新:"dòng mới",底部:"Cuối trang",显示:"Hiển thị",跟随中:"Đang theo dõi",已暂停跟随:"Đã tạm dừng theo dõi",暂无日志记录:"Chưa có log",没有匹配的日志:"Không có log phù hợp",反代详细日志:"Log chi tiết reverse proxy",可用模型:"Model khả dụng",个模型:"model",缓存:"Cache",映射:"Ánh xạ","订阅 Pro/Pro Max 但看不到高级模型?":"Đã đăng ký Pro/Pro Max nhưng chưa thấy model nâng cao?","这通常是国内 IP 被限制导致的。请尝试以下方案:":"Thường do IP khu vực bị hạn chế. Hãy thử các cách sau:","开启 VPN / 代理(系统级或应用级均可)":"Bật VPN/proxy ở cấp hệ thống hoặc trong app","切换到优质外网 IP(推荐美国 / 欧洲住宅 IP)":"Đổi sang IP outbound chất lượng tốt, ưu tiên US/EU residential","IP 切换后点击右上角「刷新」重新加载模型":"Sau khi đổi IP, bấm Làm mới ở góc phải để tải lại model",不再显示:"Không hiện lại",请确保代理服务已启动且已同步账号:"Hãy đảm bảo proxy đã chạy và đã đồng bộ tài khoản",新规则:"Quy tắc mới",目标模型:"Model đích",目标模型名:"Tên model đích",源模型:"Model nguồn",规则名称:"Tên quy tắc",映射类型:"Loại ánh xạ","适用 API Key(空 = 所有 Key)":"Áp dụng cho API Key (trống = tất cả key)","实际调用的 Kiro 模型。从下拉框选择官方模型。":"Model Kiro thực tế sẽ gọi. Chọn model chính thức trong danh sách.","用户请求时使用的模型名(如 gpt-4, claude-*, my-alias)。支持 * 通配符。":"Tên model người dùng gọi (vd gpt-4, claude-*, my-alias). Hỗ trợ wildcard *.","替换 - 直接替换模型":"Thay thế - đổi trực tiếp model","别名 - 创建模型别名":"Alias - tạo tên gọi model","负载均衡 - 随机选择":"Cân bằng tải - chọn ngẫu nhiên",选择模型:"Chọn model","-- 自定义 --":"-- Tùy chỉnh --","-- 自定义输入 --":"-- Nhập tùy chỉnh --",自定义:"Tùy chỉnh",输入规则名称:"Nhập tên quy tắc","例如: claude-*, gpt-4, my-alias":"VD: claude-*, gpt-4, my-alias",权重:"Trọng số",随机:"Ngẫu nhiên",自动:"Tự động",绑定:"Gắn",已绑定:"Đã gắn",未绑定:"Chưa gắn",初始:"Khởi tạo",手动:"Thủ công",恢复:"Khôi phục",恢复原始:"Khôi phục gốc","输入 UUID 格式机器码":"Nhập mã máy định dạng UUID","输入 UUID 格式机器码...":"Nhập mã máy định dạng UUID...",'未发现已订阅账号。请先在账户页"批量检查"刷新状态。':'Chưa thấy tài khoản đã đăng ký gói. Hãy chạy "kiểm tra hàng loạt" ở trang tài khoản trước.',"未找到已订阅账号。请先检测账号状态。":"Chưa tìm thấy tài khoản đã đăng ký gói. Hãy kiểm tra trạng thái tài khoản trước.","未找到 FREE 账户。请先在账户管理页面选择账户。":"Chưa tìm thấy tài khoản FREE. Hãy chọn tài khoản ở trang quản lý tài khoản trước.",'无可升级账号。建议先在账户管理页"批量检查"获取最新状态。':'Không có tài khoản có thể nâng cấp. Nên chạy "kiểm tra hàng loạt" để lấy trạng thái mới nhất.',超额已开启:"Đã bật vượt hạn mức",已超额:"Đã vượt hạn mức",超:"vượt",至:"đến","添加于 ":"Thêm lúc ",已使用:"Đã dùng",无试用额度:"Không có hạn mức dùng thử","基础额度:":"Hạn mức cơ bản:","试用额度:":"Hạn mức dùng thử:","超额积分:":"Credit vượt hạn mức:",输入:"Đầu vào",输出:"Đầu ra",请求数:"Số request",请求:"request",次请求:"request",模型:"Model",路径:"Đường dẫn",时间:"Thời gian",日期:"Ngày","到期时间:":"Hết hạn:","超额能力:":"Khả năng vượt hạn mức:",总体使用进度:"Tiến độ sử dụng tổng thể","原始类型:":"Loại gốc:","重置日期:":"Ngày reset:","可升级:":"Có thể nâng cấp:",账单:"Thanh toán","Agent: 需要操作":"Agent: cần thao tác","Agent: 失败":"Agent: thất bại","Agent: 成功":"Agent: thành công","显示账单和用量事件的应用内通知(用量重置、资源不足、超额)":"Hiện thông báo trong app cho sự kiện thanh toán và mức dùng.","Agent 需要输入时显示桌面通知,如执行 Shell 命令时":"Hiện thông báo desktop khi Agent cần nhập liệu.","Agent 遇到意外失败时显示桌面通知":"Hiện thông báo desktop khi Agent gặp lỗi ngoài dự kiến.","Agent 成功完成任务时显示桌面通知":"Hiện thông báo desktop khi Agent hoàn thành tác vụ.",选择登录方式:"Chọn phương thức đăng nhập",登录类型:"Loại đăng nhập","使用 AWS Builder ID 登录":"Đăng nhập bằng AWS Builder ID","使用 GitHub 账号快捷登录":"Đăng nhập nhanh bằng GitHub","使用 Google 账号快捷登录":"Đăng nhập nhanh bằng Google",支持多种方式快捷登录:"Hỗ trợ nhiều cách đăng nhập nhanh","等待授权中...":"Đang chờ cấp quyền...",取消登录:"Hủy đăng nhập",重新打开登录:"Mở lại đăng nhập",开始登录:"Bắt đầu đăng nhập","启动中...":"Đang khởi động...",完成登录:"Hoàn tất đăng nhập","请在浏览器中完成登录,并输入以下代码:":"Hoàn tất đăng nhập trong trình duyệt rồi nhập mã sau:","请在浏览器中完成登录...":"Hoàn tất đăng nhập trong trình duyệt...","在浏览器中输入此代码:":"Nhập mã này trong trình duyệt:",重新打开浏览器:"Mở lại trình duyệt",打开浏览器:"Mở trình duyệt","在浏览器中访问并登录:":"Mở trong trình duyệt và đăng nhập:","按 F12 打开开发者工具 → Application → Cookies":"Nhấn F12 -> Application -> Cookies",找到并复制:"Tìm và sao chép",的值:"giá trị","如何获取 Token?":"Cách lấy Token?",凭证数据:"Dữ liệu đăng nhập","卡密格式:":"Định dạng key:","邮箱----密码----Token----ID----Secret":"email----mật khẩu----Token----ID----Secret","支持 JSON 数组或卡密格式。JSON 必填:":"Hỗ trợ mảng JSON hoặc định dạng key. JSON bắt buộc có:","粘贴 Refresh Token...":"Dán Refresh Token...",本地导入:"Nhập cục bộ",批量导入:"Nhập hàng loạt",导入并验证:"Nhập và xác minh",导入成功:"Nhập thành công",导入失败:"Nhập thất bại","正在并发导入...":"Đang nhập song song...","格式错误(支持 JSON 或卡密格式)":"Sai định dạng (hỗ trợ JSON hoặc định dạng key)",代理绑定:"Gắn proxy","当前分组内的账号:":"Tài khoản trong nhóm này:","已标记的账号:":"Tài khoản đã gắn thẻ:","点击添加到此分组:":"Bấm để thêm vào nhóm này:","点击添加标签:":"Bấm để thêm thẻ:",暂无标签:"Chưa có thẻ",管理分组:"Quản lý nhóm",分组:"Nhóm",单个:"Một tài khoản",批量:"Hàng loạt",暂无记录:"Chưa có bản ghi",检查更新失败:"Kiểm tra cập nhật thất bại",发现新版本:"Có phiên bản mới",已是最新版本:"Đã là bản mới nhất","下载文件:":"File tải xuống:","更新内容:":"Nội dung cập nhật:",前往下载页面:"Đi tới trang tải xuống","发布时间:":"Ngày phát hành:",关闭按钮行为:"Hành vi nút đóng",点击关闭按钮时的行为:"Điều xảy ra khi bấm nút X",每次询问:"Hỏi mỗi lần",透明度:"Độ mờ",完成:"Hoàn tất",停止:"Dừng",重试:"Thử lại",全部取消:"Hủy tất cả",检查间隔:"Khoảng kiểm tra",永久:"Vĩnh viễn"},xD={Model:"Model",Running:"Đang chạy",Stopped:"Đã dừng",Stop:"Dừng",Off:"Tắt",Modified:"Đã sửa","Saving...":"Đang lưu...","Unknown error":"Lỗi không rõ",Used:"Đã dùng","(0 = unlimited)":"(0 = không giới hạn)","0 = unlimited":"0 = không giới hạn","0 = disabled":"0 = tắt",Account:"Tài khoản","Add First Account":"Thêm tài khoản đầu tiên","Add MCP Server":"Thêm MCP Server",Advanced:"Nâng cao","All Time":"Toàn thời gian","Auto Start":"Tự khởi động","Base:":"Cơ bản:",Bottom:"Cuối danh sách",Bound:"Đã gắn","Bound proxy:":"Proxy đã gắn:","Check account info":"Kiểm tra thông tin tài khoản","Clear All":"Xóa tất cả","Click to copy":"Bấm để sao chép","Click to unbind":"Bấm để bỏ gắn","Concurrency:":"Số luồng:",Create:"Tạo","Expires:":"Hết hạn:","First Available":"Tài khoản khả dụng đầu tiên",Following:"Đang bám cuối",Generate:"Tạo ngẫu nhiên",Groups:"Nhóm",Hide:"Ẩn",History:"Lịch sử",Host:"Host","Importing...":"Đang nhập...","Incomplete credentials, cannot switch":"Thiếu thông tin đăng nhập, không thể chuyển",Input:"Đầu vào","Input Tokens":"Token đầu vào","Log Requests":"Ghi log request","Logout (clear SSO cache)":"Đăng xuất (xóa cache SSO)","Manage accounts":"Quản lý tài khoản","Multi-Account":"Nhiều tài khoản","No logs yet":"Chưa có log","No tags":"Chưa có thẻ",Output:"Đầu ra","Output Tokens":"Token đầu ra",Path:"Đường dẫn","Privacy Mode":"Chế độ riêng tư",PROXY_KEY:"PROXY_KEY","Recent Requests":"Request gần đây","Refreshing...":"Đang làm mới...",Regenerate:"Tạo lại","Request Logs":"Log request",Retry:"Thử lại","Scrolled up":"Đã cuộn lên","Select model":"Chọn model",Showing:"Đang hiển thị",Single:"Một tài khoản","Success Rate":"Tỷ lệ thành công","Switch to this account":"Chuyển sang tài khoản này",Time:"Thời gian","Total Credits":"Tổng credit","Total Requests":"Tổng request","Trial:":"Dùng thử:",Ungrouped:"Chưa có nhóm","Usage Details":"Chi tiết sử dụng","-- Custom --":"-- Tùy chỉnh --","-- Custom Input --":"-- Nhập tùy chỉnh --","(empty response)":"(phản hồi trống)","(0 = even split)":"(0 = chia đều)","(Plan ID will be sent to Kiro API)":"(Plan ID sẽ được gửi tới Kiro API)","Account Info":"Thông tin tài khoản","Account ID Binding":"Gắn mã tài khoản","Account List":"Danh sách tài khoản","Account Liveness Test":"Kiểm tra tài khoản còn dùng được","Account Machine ID":"Mã máy của tài khoản","Account Status":"Trạng thái tài khoản","Account is alive":"Tài khoản còn hoạt động","Accounts in this group:":"Tài khoản trong nhóm này:","Accounts per proxy":"Số tài khoản mỗi proxy","Active Accounts":"Tài khoản đang hoạt động","Active Bonuses":"Bonus đang hoạt động",'Add all "Error" to selection':"Thêm toàn bộ mục lỗi vào lựa chọn",'Add all "Expired" to selection':"Thêm toàn bộ mục hết hạn vào lựa chọn",'Add all "Success" to selection':"Thêm toàn bộ mục thành công vào lựa chọn","Add argument":"Thêm tham số","Add Default Blocked":"Thêm mặc định bị chặn","Add Env Var":"Thêm biến môi trường","Add Proxies":"Thêm proxy","Add Rule":"Thêm quy tắc","Add to group":"Thêm vào nhóm","Add Webhook":"Thêm webhook","Address:":"Địa chỉ:","Admin API (Requires API Key)":"Admin API (cần API Key)","Admin Required":"Cần quyền admin","Admin password":"Mật khẩu admin","Advanced Settings":"Cài đặt nâng cao","Advanced:":"Nâng cao:","Agent Autonomy":"Quyền tự chạy của Agent","Agent Settings":"Cài đặt Agent","Agentic Mode Detection":"Nhận diện chế độ agentic",Alias:"Bí danh","Alias - Create model alias":"Bí danh - tạo alias model",Alive:"Còn sống","Alive Proxies":"Proxy còn sống","All Accounts":"Tất cả tài khoản","All Categories":"Tất cả danh mục","All selected already in this group":"Tất cả tài khoản đã chọn đã nằm trong nhóm này","Allowed IPs (whitelist)":"IP được phép (whitelist)","Any time":"Bất kỳ lúc nào","API Endpoints":"Endpoint API","API Key (Optional)":"API Key (tùy chọn)","API Key Management":"Quản lý API Key","API Proxy Service":"Dịch vụ API Proxy","API Settings":"Cài đặt API","App Settings (theme/lang/auto-refresh)":"Cài đặt app (giao diện/ngôn ngữ/tự làm mới)","Apply Configuration":"Áp dụng cấu hình","Apply Custom ID":"Áp dụng ID tùy chỉnh","Apply to API Keys (empty = all keys)":"Áp dụng cho API Key (trống = tất cả key)",Arguments:"Tham số","Ask every time":"Hỏi mỗi lần","Audit log":"Log kiểm toán","Audit Log (recent 200)":"Log kiểm toán (200 dòng gần nhất)","Available Models":"Model khả dụng","Backups created":"Backup đã tạo",Batch:"Hàng loạt","Cache Hit":"Cache hit","Cache Read":"Đọc cache","Cache Write":"Ghi cache","Claude Compatible":"Tương thích Claude","Claude Code":"Claude Code",Close:"Đóng","Configure Clients":"Cấu hình client",Configured:"Đã cấu hình","Configuring...":"Đang cấu hình...","Copy Report":"Sao chép báo cáo","Custom probe URL (optional)":"URL kiểm tra tùy chỉnh (tùy chọn)","Denied IPs (blacklist)":"IP bị chặn (blacklist)","Detailed Logs":"Log chi tiết","Detailed Stats":"Thống kê chi tiết","Diagnostic Config":"Cấu hình chẩn đoán",Diagnostics:"Chẩn đoán","Endpoint:":"Endpoint:","Existing client files are merged and backed up before writing.":"File client hiện có sẽ được merge và backup trước khi ghi.","Failed to configure clients":"Cấu hình client thất bại","Failed to load models":"Tải model thất bại","Gemini Compatible":"Tương thích Gemini","Gemini Models":"Model Gemini","Health Check":"Kiểm tra health","Import to OpenClaw":"Nhập vào OpenClaw","Image Processing":"Xử lý hình ảnh","IDC/Social Auth":"Xác thực IDC/Social","Kiro / AWS":"Kiro / AWS","Loading models...":"Đang tải model...","Mark as error":"Đánh dấu lỗi","Max body size (MB)":"Giới hạn nội dung request (MB)","Model List":"Danh sách model","No accounts selected. Go to the Accounts page and multi-select first.":"Chưa chọn tài khoản nào. Hãy sang trang Tài khoản và chọn nhiều tài khoản trước.","No available proxy in pool":"Không có proxy khả dụng trong kho","No models loaded":"Chưa tải được model","One-Click Client Configuration":"Cấu hình client một chạm","OpenAI Compatible":"Tương thích OpenAI","OpenAI Responses":"OpenAI Responses","Please select a model":"Hãy chọn model","Please select at least one client":"Hãy chọn ít nhất một client",'Proxy pool disabled, configure it in "Proxy Pool" first':"Kho proxy chưa bật, hãy cấu hình trong trang Kho proxy trước","Rate limit (req/min per Key)":"Giới hạn tốc độ (request/phút mỗi key)",Reload:"Tải lại","Request Retry":"Tự thử lại request","Restart Now":"Khởi động lại ngay","Restart required":"Cần khởi động lại","Retest failed":"Test lại mục lỗi","Run Diagnostics":"Chạy chẩn đoán","Security & Observability (v1.8)":"Bảo mật & quan sát (v1.8)","Send a real chat message to the selected model via the reverse-proxy call path (account-bound proxy applies). Verifies the account can actually get a response.":"Gửi tin nhắn thật tới model qua đường API proxy, tự áp dụng proxy đã gắn cho tài khoản để xác nhận tài khoản còn trả lời được.",Selected:"Đã chọn","Select an account":"Chọn tài khoản","Select a proxy":"Chọn proxy",Session:"Phiên này","Session S/F":"Phiên thành công/lỗi","Start Service":"Bật dịch vụ","Stop Service":"Tắt dịch vụ","Stream Events":"Sự kiện stream","Supported Features":"Tính năng hỗ trợ","Test message":"Tin nhắn test","Test network / Kiro API / email service / proxy connectivity in one click.":"Kiểm tra mạng, Kiro API, dịch vụ email và proxy trong một lần bấm.","Test Now":"Test ngay","Test Selected":"Test đã chọn","Test through proxy":"Kiểm tra qua proxy","Testing...":"Đang test...","Thinking Mode Support":"Hỗ trợ thinking mode","Token Buffer Reserve (auto-trim history)":"Dự phòng token (tự cắt lịch sử)","Token Count":"Đếm token","Tool Execution":"Thực thi tool","Total S/F":"Tổng thành công/lỗi","Total Tokens":"Tổng token",Uptime:"Thời gian chạy","Usage Statistics":"Thống kê sử dụng","View All":"Xem tất cả"},gD=[[/Manage your Kiro IDE accounts, one-click switch/g,"Quản lý tài khoản Kiro IDE và chuyển đổi nhanh"],[/Token Status/g,"Trạng thái token"],[/Subscription Details/g,"Chi tiết gói dịch vụ"],[/Quota Details/g,"Chi tiết hạn mức"],[/Click "Accounts" to view and manage all accounts/g,'Bấm "Tài khoản" để xem và quản lý toàn bộ tài khoản'],[/Click power icon on account card to switch/g,"Bấm biểu tượng nguồn trên thẻ tài khoản để chuyển tài khoản"],[/Batch set groups for selected accounts/g,"Gán nhóm hàng loạt cho tài khoản đã chọn"],[/Batch add\/remove tags, multi-tag support/g,"Thêm/xóa thẻ hàng loạt, hỗ trợ nhiều thẻ"],[/Switch group view \/ Manage/g,"Đổi chế độ xem nhóm / Quản lý"],[/Manage tags/g,"Quản lý thẻ"],[/Delete \(select first\)/g,"Xóa (chọn trước)"],[/Refresh Token \(select first\)/g,"Làm mới token (chọn trước)"],[/Copy credentials/g,"Sao chép thông tin đăng nhập"],[/Manage device identifier to prevent account bans/g,"Quản lý định danh thiết bị cho tài khoản"],[/Current Machine ID/g,"Mã máy hiện tại"],[/Original Machine ID Backup/g,"Bản sao lưu mã máy gốc"],[/Export to File/g,"Xuất ra file"],[/Import from File/g,"Nhập từ file"],[/Account Machine ID/g,"Mã máy tài khoản"],[/Manage Kiro IDE config, MCP servers and user rules/g,"Quản lý cấu hình Kiro IDE, máy chủ MCP và quy tắc người dùng"],[/Open File/g,"Mở file"],[/Agent Settings/g,"Cài đặt tác nhân"],[/Agent: Success/g,"Tác nhân: Thành công"],[/Open Steering Folder/g,"Mở thư mục quy tắc"],[/Refresh models/g,"Làm mới model"],[/Refresh Models/g,"Làm mới model"],[/Edit internally/g,"Sửa trong app"],[/Open externally/g,"Mở bên ngoài"],[/Auto Token Refresh/g,"Tự làm mới token"],[/Manage Multiple API Keys/g,"Quản lý nhiều API key"],[/MITM proxy for Machine ID replacement, reduces ban risk/g,"MITM proxy để thay mã máy trong request Kiro"],[/MITM proxy for replacing Machine ID in Kiro requests/g,"MITM proxy dùng để thay mã máy trong request Kiro"],[/Machine ID to replace in requests \(64 hex characters\)/g,"Mã máy dùng để thay trong request (64 ký tự hex)"],[/1\. Export and install the CA certificate to your system trust store/g,"1. Xuất và cài chứng chỉ CA vào kho tin cậy của hệ thống"],[/All Status/g,"Tất cả trạng thái"],[/Clear All/g,"Xóa tất cả"],[/Clear Failed \((\d+)\)/g,"Xóa lỗi ($1)"],[/Overage Status/g,"Trạng thái vượt hạn mức"],[/Refresh models from proxy cache \/ Kiro/g,"Làm mới model từ bộ nhớ đệm proxy / Kiro"],[/Export & import non-sensitive app config \(proxy pool, webhooks, register templates, app preferences\) for multi-device sync\./g,"Xuất và nhập cấu hình không nhạy cảm của app (kho proxy, webhook, mẫu đăng ký, tùy chọn giao diện) để đồng bộ nhiều thiết bị."],[/This export does NOT include account credentials, refresh tokens, or other sensitive secrets — use "Account Export" \(under Accounts page\) for those\./g,'Bản xuất này không gồm thông tin đăng nhập, refresh token hoặc dữ liệu nhạy cảm khác. Muốn xuất tài khoản, dùng "Xuất tài khoản" trong trang Tài khoản.'],[/Proxy Pool \((\d+)\)/g,"Kho proxy ($1)"],[/App Settings \(theme\/lang\/auto-refresh\)/g,"Cài đặt app (giao diện/ngôn ngữ/tự làm mới)"],[/Choose a previously exported config JSON\. Duplicates will be merged\/skipped automatically\./g,"Chọn file JSON cấu hình đã xuất trước đó. Mục trùng sẽ tự được gộp hoặc bỏ qua."],[/配置应用的各项功能/g,"Cấu hình các chức năng của ứng dụng"],[/语言 \/ Language/g,"Ngôn ngữ"],[/显示语言 \/ Display Language/g,"Ngôn ngữ hiển thị"],[/选择界面显示语言 \/ Select interface language/g,"Chọn ngôn ngữ giao diện"],[/🌐 自动 \(Auto\)/g,"Tiếng Việt"],[/🇨🇳 简体中文/g,"Tiếng Việt"],[/• 自动模式会根据系统语言自动选择/g,"• Giao diện hiện được cố định tiếng Việt"],[/• 支持自定义翻译文件扩展(开发中)/g,"• Hỗ trợ file dịch tùy chỉnh đang được phát triển"],[/Open browser in incognito\/private mode when logging in/g,"Mở trình duyệt ở chế độ riêng tư khi đăng nhập"],[/API Settings/g,"Cài đặt API"],[/• Click input and press key combination to record/g,"• Bấm vào ô nhập rồi nhấn tổ hợp phím để ghi lại"],[/• Click trash icon to clear shortcut/g,"• Bấm biểu tượng thùng rác để xóa phím tắt"],[/Set in sidebar "Machine ID"/g,'Cài trong mục "Mã máy" ở thanh bên'],[/Export Data/g,"Xuất dữ liệu"],[/Import Data/g,"Nhập dữ liệu"],[/Import accounts from JSON file/g,"Nhập tài khoản từ file JSON"],[/Clear All Data/g,"Xóa toàn bộ dữ liệu"],[/Delete all accounts, groups and tags/g,"Xóa toàn bộ tài khoản, nhóm và thẻ"],[/Export all non-sensitive settings \(proxy pool, webhooks, templates, rate limits, UI preferences\) to a file, for backup or multi-device sync\. Does NOT include account tokens or credentials\./g,"Xuất toàn bộ cài đặt không nhạy cảm (kho proxy, webhook, mẫu, giới hạn tốc độ, tùy chọn giao diện) ra file để sao lưu hoặc đồng bộ nhiều thiết bị. Không gồm token hoặc thông tin đăng nhập tài khoản."],[/Export Config/g,"Xuất cấu hình"],[/Import Config/g,"Nhập cấu hình"],[/Click to record/g,"Bấm để ghi phím tắt"],[/One-Click Switch/g,"Chuyển đổi một chạm"],[/: Batch set groups\/tags/g,": gán nhóm/thẻ hàng loạt"],[/Krouter/g,$i],[/Account Manager/g,$i],[/Version\s+([0-9][\w.-]*)/g,"Phiên bản $1"],[/New version v([0-9][\w.-]*)/g,"Có phiên bản mới v$1"],[/Progress:\s*(\d+)\/(\d+)/g,"Tiến độ: $1/$2"],[/Success:\s*(\d+)/g,"Thành công: $1"],[/Failed:\s*(\d+)/g,"Thất bại: $1"],[/(\d+)\s+tasks failed/g,"$1 tác vụ thất bại"],[/(\d+)\s+accounts/g,"$1 tài khoản"],[/(\d+)\s+selected/g,"Đã chọn $1"],[/Using\s+(\d+)\s+selected accounts/g,"Đang dùng $1 tài khoản đã chọn"],[/(\d+)\s+plans available/g,"Có $1 gói khả dụng"],[/Detected\s+(\d+)\s+valid link\(s\)/g,"Đã nhận diện $1 link hợp lệ"],[/Imported\s+(\d+)\s+link\(s\)/g,"Đã nhập $1 link"],[/(\d+)d left/g,"Còn $1 ngày"],[/(\d+)d/g,"$1 ngày"],[/(\d+)m/g,"$1 phút"],[/Base:/g,"Cơ bản:"],[/Trial:/g,"Dùng thử:"],[/Checked:/g,"Đã kiểm tra:"],[/Token:/g,"Token:"],[/Bound proxy:/g,"Proxy đã gắn:"],[/Click to copy/g,"Bấm để sao chép"],[/Click to unbind/g,"Bấm để bỏ gắn"],[/Click to manage subscription/g,"Bấm để quản lý gói dịch vụ"],[/剩\s*(\d+)\s*天/g,"Còn $1 ngày"],[/(\d+)\s*分钟/g,"$1 phút"],[/(\d+)\s*天/g,"$1 ngày"],[/剩\s*(\d+)\s*ngày/g,"Còn $1 ngày"],[/切换失败[::]\s*(.*)/g,"Chuyển thất bại: $1"],[/退出成功,已清除\s*(\d+)\s*个缓存文件/g,"Đăng xuất thành công, đã xóa $1 file cache"],[/退出失败[::]\s*(.*)/g,"Đăng xuất thất bại: $1"],[/获取支付链接失败/g,"Lấy link thanh toán thất bại"],[/获取管理链接失败/g,"Lấy link quản lý thất bại"],[/确定要删除账号\s*"?([^"?]+)"?\s*吗?/g,"Xóa tài khoản $1?"],[/确定删除账号\s*"([^"]+)"?/g,'Xóa tài khoản "$1"?'],[/解绑\s*([^?]+)?/g,"Bỏ gắn $1?"],[/确定要清除所有账号数据吗?此操作不可恢复!/g,"Xóa toàn bộ dữ liệu tài khoản? Thao tác này không thể khôi phục!"],[/再次确认:这将删除所有账号、分组和标签数据!/g,"Xác nhận lần nữa: thao tác này sẽ xóa toàn bộ tài khoản, nhóm và thẻ!"],[/导入完成:成功\s*(\d+)\s*个,失败\s*(\d+)\s*个(分组:([^)]+))/g,"Nhập hoàn tất: thành công $1, thất bại $2 (nhóm: $3)"],[/导入完成:成功\s*(\d+)\s*个/g,"Nhập hoàn tất: thành công $1 tài khoản"],[/卡密导入完成:成功\s*(\d+)\s*个,失败\s*(\d+)\s*个(分组:([^)]+))/g,"Nhập key hoàn tất: thành công $1, thất bại $2 (nhóm: $3)"],[/未找到有效的账号数据(需要邮箱和 RefreshToken)/g,"Không tìm thấy dữ liệu tài khoản hợp lệ (cần email và RefreshToken)"],[/未找到有效的卡密数据(格式:邮箱----密码----RefreshToken----ClientId----ClientSecret)/g,"Không tìm thấy dữ liệu key hợp lệ (định dạng: email----mật khẩu----RefreshToken----ClientId----ClientSecret)"],[/未找到有效的账号数据(格式:邮箱,RefreshToken 或 卡密格式:邮箱----密码----Token----ID----Secret)/g,"Không tìm thấy dữ liệu tài khoản hợp lệ (email,RefreshToken hoặc email----mật khẩu----Token----ID----Secret)"],[/不支持的文件格式:(.+)/g,"Không hỗ trợ định dạng file: $1"],[/解析导入文件失败/g,"Đọc file nhập thất bại"],[/导入失败[::]\s*(.*)/g,"Nhập thất bại: $1"],[/加密失败[::]\s*(.*)/g,"Mã hóa thất bại: $1"],[/失败[::]\s*(.*)/g,"Thất bại: $1"],[/确定要删除 MCP 服务器\s*"([^"]+)"\s*吗?/g,'Xóa MCP server "$1"?'],[/确定要删除\s*"([^"]+)"\s*吗?此操作无法撤销。/g,'Xóa "$1"? Thao tác này không thể hoàn tác.'],[/取消正在进行的\s*(\d+)\s*个任务?/g,"Hủy $1 tác vụ đang chạy?"],[/取消所有\s*(\d+)\s*个正在进行的任务/g,"Hủy tất cả $1 tác vụ đang chạy"],[/确定删除\s*(\d+)\s*个代理?/g,"Xóa $1 proxy?"],[/确定移除\s*(\d+)\s*个失效代理?/g,"Xóa $1 proxy đã lỗi?"],[/确定清空所有代理?/g,"Xóa toàn bộ proxy?"],[/解绑全部\s*(\d+)\s*个账号?/g,"Bỏ gắn toàn bộ $1 tài khoản?"],[/已导出\s*(\d+)\s*个账号/g,"Đã xuất $1 tài khoản"],[/确定要删除选中的\s*(\d+)\s*个账号吗?/g,"Xóa $1 tài khoản đã chọn?"],[/清除\s*(\d+)\s*个选中/g,"Bỏ chọn $1 mục"],[/成功导入\s*(\d+)\s*个链接/g,"Đã nhập thành công $1 link"],[/已识别\s*(\d+)\s*个有效链接/g,"Đã nhận diện $1 link hợp lệ"],[/关闭\s*(\d+)\s*个账号的超额?/g,"Tắt vượt hạn mức cho $1 tài khoản?"],[/打开门户(已选\s*(\d+))/g,"Mở cổng quản lý ($1 đã chọn)"],[/打开全部\s*\((\d+)\)/g,"Mở tất cả ($1)"],[/关全部超额\s*\((\d+)\)/g,"Tắt toàn bộ vượt hạn mức ($1)"],[/已选\s*(\d+)\s*\/\s*(\d+)/g,"Đã chọn $1 / $2"],[/(\d+)\s*个已订阅账号/g,"$1 tài khoản đã đăng ký gói"],[/已开启/g,"Đã bật"],[/未开启/g,"Chưa bật"],[/已订阅\s*(\d+)/g,"Đã đăng ký gói $1"],[/无 Token\s*(\d+)/g,"Thiếu token $1"],[/已封禁\s*(\d+)/g,"Bị khóa $1"],[/不可升级\s*(\d+)/g,"Không thể nâng cấp $1"],[/状态未知\s*(\d+)/g,"Trạng thái không rõ $1"],[/删除选中的\s*(\d+)\s*个链接/g,"Xóa $1 link đã chọn"],[/删除选中\s*\((\d+)\)/g,"Xóa đã chọn ($1)"],[/打开选中\s*\((\d+)\)/g,"Mở đã chọn ($1)"],[/全部打开\s*\((\d+)\)/g,"Mở tất cả ($1)"],[/导出选中\s*\((\d+)\)/g,"Xuất đã chọn ($1)"],[/全部导出\s*\((\d+)\)/g,"Xuất tất cả ($1)"],[/从顶部选中前\s*(\d+)\s*个可用链接/g,"Chọn $1 link khả dụng đầu danh sách"],[/选中下一批(从上次位置继续)/g,"Chọn lô tiếp theo từ vị trí lần trước"],[/把"成功"项加入选择/g,"Thêm các mục thành công vào lựa chọn"],[/把"过期"项加入选择/g,"Thêm các mục hết hạn vào lựa chọn"],[/把"失败"项加入选择/g,"Thêm các mục thất bại vào lựa chọn"],[/Webhook 列表\s*\((\d+)\)/g,"Danh sách webhook ($1)"],[/删除 Webhook\s*"([^"]+)"?/g,'Xóa webhook "$1"?'],[/点击停用/g,"Bấm để tắt"],[/点击启用/g,"Bấm để bật"],[/例如:开发群/g,"VD: nhóm dev"],[/自定义 JSON 模板(占位符:/g,"Mẫu JSON tùy chỉnh (placeholder: "],[/(\d+)\s*小时/g,"$1 giờ"],[/(\d+)\s*分/g,"$1 phút"],[/(\d+)\s*个模型/g,"$1 model"],[/(\d+)\s*条规则/g,"$1 quy tắc"],[/(\d+)\s*条新/g,"$1 dòng mới"],[/(\d+)\s*条/g,"$1 dòng"],[/(\d+)\s*次请求/g,"$1 request"],[/(\d+)\s*请求/g,"$1 request"],[/(\d+)\s*个账户/g,"$1 tài khoản"],[/(\d+)\s*个账号/g,"$1 tài khoản"],[/(\d+)\s*个缓存/g,"$1 cache"],[/(\d+)\s*个文件/g,"$1 file"],[/还有\s*(\d+)\s*个文件\.\.\./g,"Còn $1 file..."],[/移动选中\s*(\d+)\s*个账户到此/g,"Chuyển $1 tài khoản đã chọn vào đây"],[/所有选中账户已在该组/g,"Tất cả tài khoản đã chọn đã nằm trong nhóm này"],[/已输入\s*(\d+)\s*个凭证\s*\(卡密格式\)/g,"Đã nhập $1 thông tin đăng nhập (định dạng key)"],[/已输入\s*(\d+)\s*个凭证\s*\(JSON\)/g,"Đã nhập $1 thông tin đăng nhập (JSON)"],[/已输入\s*(\d+)\s*个 Token/g,"Đã nhập $1 token"],[/批量导入\s*(\d+)\s*个账号/g,"Nhập hàng loạt $1 tài khoản"],[/正在并发导入\s*(\d+)\s*个账号\.\.\./g,"Đang nhập song song $1 tài khoản..."],[/导入结果:\s*成功\s*(\d+)\/(\d+)/g,"Kết quả nhập: thành công $1/$2"],[/扫描\s*(\d+)\s*个账号:\s*(\d+)\s*可升级,\s*(\d+)\s*不可升级/g,"Đã quét $1 tài khoản: $2 có thể nâng cấp, $3 không thể nâng cấp"],[/有\s*(\d+)\s*个 FREE 账户可升级。点击"获取链接"开始。/g,'Có $1 tài khoản FREE có thể nâng cấp. Bấm "Lấy link" để bắt đầu.'],[/解绑选中\s*\((\d+)\)/g,"Bỏ gắn đã chọn ($1)"],[/关闭\s*([^?]+)\s*的超额?/g,"Tắt vượt hạn mức của $1?"],[/解绑\s*([^与]+)\s*与\s*([^?]+)?/g,"Bỏ gắn $1 khỏi $2?"],[/关联账户:\s*/g,"Tài khoản liên quan: "],[/Code:\s*([^·]+)·\s*([^过]+)\s*过期/g,"Code: $1 - hết hạn $2"],[/发布时间:\s*/g,"Ngày phát hành: "],[/当前版本 v([0-9][\w.-]*) 已经是最新的了/g,"Phiên bản v$1 đã là mới nhất"],[/切换主动续期失败:/g,"Bật/tắt gia hạn chủ động thất bại: "],[/提示:将鼠标悬停到分组上,点击右侧 ⇄ 按钮即可批量移动选中账户/g,"Gợi ý: rê chuột lên nhóm rồi bấm nút ⇄ bên phải để chuyển hàng loạt tài khoản đã chọn"],[/提示:把 N 个账号绑定到同一代理 IP,可降低风控关联风险/g,"Gợi ý: gắn N tài khoản vào cùng proxy IP có thể giảm rủi ro liên kết"],[/请先选择账号,再点击要绑定的代理/g,"Hãy chọn tài khoản trước, rồi bấm proxy cần gắn"],[/没有可用代理。请先在"代理池"页面添加并验活代理/g,'Không có proxy khả dụng. Hãy thêm và kiểm tra proxy ở trang "Kho proxy" trước.']],yD=[[/Builder ID model liveness failed/g,"Kiểm tra model Builder ID thất bại"],[/Builder ID model liveness fallback/g,"Kiểm tra model Builder ID bằng fallback"],[/model liveness failed/g,"kiểm tra model thất bại"],[/model liveness OK/g,"kiểm tra model OK"],[/Model liveness check failed/g,"Kiểm tra model thất bại"],[/No usable streaming profileArn is available for this account, so model chat was skipped/g,"Tài khoản này chưa có profileArn streaming dùng được nên bỏ qua chat model"],[/No profileArn on this account, so model chat was skipped/g,"Tài khoản này chưa có profileArn nên bỏ qua chat model"],[/Kiro did not accept the fixed placeholder profileArn/g,"Kiro không chấp nhận profileArn placeholder"],[/Credential and quota check passed for\s+([^,]+),\s+usage\s+([^\.]+)/g,"Thông tin đăng nhập và hạn mức hợp lệ cho $1, đã dùng $2"],[/Credential and quota check passed/g,"Thông tin đăng nhập và hạn mức hợp lệ"],[/Your User ID is temporarily suspended/g,"User ID đang bị tạm khóa"],[/We detected unusual user activity and locked it as a security precaution/g,"Hệ thống phát hiện hoạt động bất thường và khóa tài khoản để bảo mật"],[/To restore access, please contact our support team to verify your identity/g,"Muốn mở lại quyền truy cập, cần liên hệ hỗ trợ để xác minh danh tính"],[/TEMPORARILY_SUSPENDED/g,"TẠM THỜI BỊ KHÓA"],[/Auth error 401/g,"Lỗi xác thực 401"],[/Auth error 403/g,"Lỗi xác thực 403"],[/API error 400/g,"Lỗi API 400"],[/profileArn is required for this request/g,"request này cần profileArn"],[/Missing access token for model liveness check/g,"Thiếu access token để kiểm tra model"],[/Stopped after\s+([^\.]+)/g,"Đã dừng sau $1"],[/Stopped by proxy preflight/g,"Đã dừng do kiểm tra proxy trước khi chạy"],[/No accounts selected/g,"Chưa chọn tài khoản"],[/Delete\s+(\d+)\s+accounts that failed the liveness test\? This cannot be undone\./g,"Xóa $1 tài khoản kiểm tra liveness thất bại? Thao tác này không thể hoàn tác."],[/(\d+)\s+failed/g,"$1 lỗi"],[/(\d+)\s+cached/g,"$1 cache"],[/Input \/ Output/g,"Đầu vào / Đầu ra"],[/Cache Hit/g,"Cache hit"],[/Cache Read/g,"Đọc cache"],[/Cache Write/g,"Ghi cache"],[/OpenAI Compatible/g,"Tương thích OpenAI"],[/Claude Compatible/g,"Tương thích Claude"],[/Gemini Compatible/g,"Tương thích Gemini"],[/Request larger than limit will return HTTP 413/g,"Request vượt giới hạn sẽ trả HTTP 413"],[/Reject larger requests with HTTP 413/g,"Request vượt giới hạn sẽ trả HTTP 413"],[/Anonymous → by IP/g,"Không có key thì giới hạn theo IP"],[/Empty = no restriction/g,"Để trống = không giới hạn"],[/Higher priority than allowed list/g,"Ưu tiên cao hơn whitelist"],[/IPv4 \/ IPv6 \/ CIDR/g,"IPv4 / IPv6 / CIDR"],[/API Key is required to start the server/g,"Cần API Key để khởi động server"],[/Binding to ([^ ]+) exposes accounts to the network!/g,"Bind vào $1 sẽ mở tài khoản ra mạng ngoài!"],[/Configuration change requires a restart to take effect/g,"Cấu hình đã đổi, cần khởi động lại để áp dụng"],[/Restart proxy server now\? Active streams will be interrupted\./g,"Khởi động lại proxy ngay? Các stream đang chạy sẽ bị ngắt."],[/Regenerate self-signed certificate\? You will need to re-install it on clients\./g,"Tạo lại chứng chỉ tự ký? Các client sẽ cần cài lại chứng chỉ."],[/Regenerated\. Restart proxy to apply\./g,"Đã tạo lại. Khởi động lại proxy để áp dụng."],[/Failed:\s*/g,"Thất bại: "],[/Restart failed:\s*/g,"Khởi động lại thất bại: "],[/Writes ANTHROPIC_BASE_URL, API key and default model/g,"Ghi ANTHROPIC_BASE_URL, API key và model mặc định"],[/Adds Kiro provider and model metadata to opencode\.json/g,"Thêm provider Kiro và metadata model vào opencode.json"],[/Adds Kiro OpenAI Responses provider/g,"Thêm provider Kiro dùng OpenAI Responses"],[/Writes \.env and settings\.json for Gemini v1beta/g,"Ghi .env và settings.json cho Gemini v1beta"],[/Adds Kiro provider to config\.yaml/g,"Thêm provider Kiro vào config.yaml"],[/Adds Kiro provider to openclaw\.json/g,"Thêm provider Kiro vào openclaw.json"]];function bD(n,s){const r=n.match(/^\s*/)?.[0]||"",i=n.match(/\s*$/)?.[0]||"";return`${r}${s}${i}`}function Bu(n){const s=n.trim();if(!s)return n;let r=xD[s]||pD[s]||s;for(const[i,o]of[...gD,...yD])r=r.replace(i,o);return r===s?n:bD(n,r)}function Rj(n){const s=Bu(n.nodeValue||"");s!==n.nodeValue&&(n.nodeValue=s)}function Dj(n){for(const s of["title","placeholder","aria-label","alt"]){const r=n.getAttribute(s);if(!r)continue;const i=Bu(r);i!==r&&n.setAttribute(s,i)}}function du(n){if(n.nodeType===Node.TEXT_NODE){Rj(n);return}if(n.nodeType!==Node.ELEMENT_NODE&&n.nodeType!==Node.DOCUMENT_NODE)return;const s=n;if(s.nodeType===Node.ELEMENT_NODE){const o=s.tagName;if(o==="SCRIPT"||o==="STYLE"||o==="TEXTAREA")return;Dj(s)}const r=document.createTreeWalker(n,NodeFilter.SHOW_TEXT|NodeFilter.SHOW_ELEMENT);let i=r.nextNode();for(;i;)i.nodeType===Node.TEXT_NODE?Rj(i):i.nodeType===Node.ELEMENT_NODE&&Dj(i),i=r.nextNode()}function vD(){document.documentElement.lang="vi",document.title=$i;const n=window.alert.bind(window);window.alert=o=>n(Bu(String(o??"")));const s=window.confirm.bind(window);window.confirm=o=>s(Bu(String(o??"")));const r=()=>du(document.body);document.readyState==="loading"?document.addEventListener("DOMContentLoaded",r,{once:!0}):r(),new MutationObserver(o=>{for(const d of o){for(const u of d.addedNodes)du(u);d.type==="characterData"&&du(d.target),d.type==="attributes"&&du(d.target)}}).observe(document.documentElement,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["title","placeholder","aria-label","alt"]})}cD();vD();s2.createRoot(document.getElementById("root")).render(e.jsx(g.StrictMode,{children:e.jsx(fD,{children:e.jsx(tD,{})})}));
|