@jamiexiongr/panda-hub 0.1.13 → 0.1.15

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.
@@ -0,0 +1,142 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diagnostics-page-DXTBGISk.js","assets/diagnostics-page-BmzeM8p1.css"])))=>i.map(i=>d[i]);
2
+ var dv=e=>{throw TypeError(e)};var q1=(e,t,a)=>t.has(e)||dv("Cannot "+a);var B=(e,t,a)=>(q1(e,t,"read from private field"),a?a.call(e):t.get(e)),gt=(e,t,a)=>t.has(e)?dv("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,a),Ye=(e,t,a,l)=>(q1(e,t,"write to private field"),l?l.call(e,a):t.set(e,a),a),$t=(e,t,a)=>(q1(e,t,"access private method"),a);var sm=(e,t,a,l)=>({set _(o){Ye(e,t,o,a)},get _(){return B(e,t,l)}});(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))l(o);new MutationObserver(o=>{for(const u of o)if(u.type==="childList")for(const f of u.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&l(f)}).observe(document,{childList:!0,subtree:!0});function a(o){const u={};return o.integrity&&(u.integrity=o.integrity),o.referrerPolicy&&(u.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?u.credentials="include":o.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function l(o){if(o.ep)return;o.ep=!0;const u=a(o);fetch(o.href,u)}})();const Hx="modulepreload",$x=function(e){return"/"+e},fv={},ao=function(t,a,l){let o=Promise.resolve();if(a&&a.length>0){let f=function(g){return Promise.all(g.map(S=>Promise.resolve(S).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const m=document.querySelector("meta[property=csp-nonce]"),y=(m==null?void 0:m.nonce)||(m==null?void 0:m.getAttribute("nonce"));o=f(a.map(g=>{if(g=$x(g),g in fv)return;fv[g]=!0;const S=g.endsWith(".css"),p=S?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${p}`))return;const v=document.createElement("link");if(v.rel=S?"stylesheet":Hx,S||(v.as="script"),v.crossOrigin="",v.href=g,y&&v.setAttribute("nonce",y),document.head.appendChild(v),S)return new Promise((w,N)=>{v.addEventListener("load",w),v.addEventListener("error",()=>N(new Error(`Unable to preload CSS for ${g}`)))})}))}function u(f){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=f,window.dispatchEvent(m),!m.defaultPrevented)throw f}return o.then(f=>{for(const m of f||[])m.status==="rejected"&&u(m.reason);return t().catch(u)})};function Fx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var W1={exports:{}},Wd={};/**
3
+ * @license React
4
+ * react-jsx-runtime.production.js
5
+ *
6
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ */var hv;function qx(){if(hv)return Wd;hv=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function a(l,o,u){var f=null;if(u!==void 0&&(f=""+u),o.key!==void 0&&(f=""+o.key),"key"in o){u={};for(var m in o)m!=="key"&&(u[m]=o[m])}else u=o;return o=u.ref,{$$typeof:e,type:l,key:f,ref:o!==void 0?o:null,props:u}}return Wd.Fragment=t,Wd.jsx=a,Wd.jsxs=a,Wd}var mv;function Wx(){return mv||(mv=1,W1.exports=qx()),W1.exports}var i=Wx(),K1={exports:{}},Lt={};/**
11
+ * @license React
12
+ * react.production.js
13
+ *
14
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
15
+ *
16
+ * This source code is licensed under the MIT license found in the
17
+ * LICENSE file in the root directory of this source tree.
18
+ */var pv;function Kx(){if(pv)return Lt;pv=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),f=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),v=Symbol.iterator;function w(k){return k===null||typeof k!="object"?null:(k=v&&k[v]||k["@@iterator"],typeof k=="function"?k:null)}var N={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,T={};function A(k,K,_e){this.props=k,this.context=K,this.refs=T,this.updater=_e||N}A.prototype.isReactComponent={},A.prototype.setState=function(k,K){if(typeof k!="object"&&typeof k!="function"&&k!=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,k,K,"setState")},A.prototype.forceUpdate=function(k){this.updater.enqueueForceUpdate(this,k,"forceUpdate")};function U(){}U.prototype=A.prototype;function I(k,K,_e){this.props=k,this.context=K,this.refs=T,this.updater=_e||N}var E=I.prototype=new U;E.constructor=I,j(E,A.prototype),E.isPureReactComponent=!0;var L=Array.isArray;function W(){}var ee={H:null,A:null,T:null,S:null},F=Object.prototype.hasOwnProperty;function G(k,K,_e){var fe=_e.ref;return{$$typeof:e,type:k,key:K,ref:fe!==void 0?fe:null,props:_e}}function Q(k,K){return G(k.type,K,k.props)}function Y(k){return typeof k=="object"&&k!==null&&k.$$typeof===e}function pe(k){var K={"=":"=0",":":"=2"};return"$"+k.replace(/[=:]/g,function(_e){return K[_e]})}var ne=/\/+/g;function V(k,K){return typeof k=="object"&&k!==null&&k.key!=null?pe(""+k.key):K.toString(36)}function ye(k){switch(k.status){case"fulfilled":return k.value;case"rejected":throw k.reason;default:switch(typeof k.status=="string"?k.then(W,W):(k.status="pending",k.then(function(K){k.status==="pending"&&(k.status="fulfilled",k.value=K)},function(K){k.status==="pending"&&(k.status="rejected",k.reason=K)})),k.status){case"fulfilled":return k.value;case"rejected":throw k.reason}}throw k}function R(k,K,_e,fe,Te){var re=typeof k;(re==="undefined"||re==="boolean")&&(k=null);var we=!1;if(k===null)we=!0;else switch(re){case"bigint":case"string":case"number":we=!0;break;case"object":switch(k.$$typeof){case e:case t:we=!0;break;case S:return we=k._init,R(we(k._payload),K,_e,fe,Te)}}if(we)return Te=Te(k),we=fe===""?"."+V(k,0):fe,L(Te)?(_e="",we!=null&&(_e=we.replace(ne,"$&/")+"/"),R(Te,K,_e,"",function(Be){return Be})):Te!=null&&(Y(Te)&&(Te=Q(Te,_e+(Te.key==null||k&&k.key===Te.key?"":(""+Te.key).replace(ne,"$&/")+"/")+we)),K.push(Te)),1;we=0;var ve=fe===""?".":fe+":";if(L(k))for(var ze=0;ze<k.length;ze++)fe=k[ze],re=ve+V(fe,ze),we+=R(fe,K,_e,re,Te);else if(ze=w(k),typeof ze=="function")for(k=ze.call(k),ze=0;!(fe=k.next()).done;)fe=fe.value,re=ve+V(fe,ze++),we+=R(fe,K,_e,re,Te);else if(re==="object"){if(typeof k.then=="function")return R(ye(k),K,_e,fe,Te);throw K=String(k),Error("Objects are not valid as a React child (found: "+(K==="[object Object]"?"object with keys {"+Object.keys(k).join(", ")+"}":K)+"). If you meant to render a collection of children, use an array instead.")}return we}function H(k,K,_e){if(k==null)return k;var fe=[],Te=0;return R(k,fe,"","",function(re){return K.call(_e,re,Te++)}),fe}function X(k){if(k._status===-1){var K=k._result;K=K(),K.then(function(_e){(k._status===0||k._status===-1)&&(k._status=1,k._result=_e)},function(_e){(k._status===0||k._status===-1)&&(k._status=2,k._result=_e)}),k._status===-1&&(k._status=0,k._result=K)}if(k._status===1)return k._result.default;throw k._result}var oe=typeof reportError=="function"?reportError:function(k){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var K=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof k=="object"&&k!==null&&typeof k.message=="string"?String(k.message):String(k),error:k});if(!window.dispatchEvent(K))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",k);return}console.error(k)},ie={map:H,forEach:function(k,K,_e){H(k,function(){K.apply(this,arguments)},_e)},count:function(k){var K=0;return H(k,function(){K++}),K},toArray:function(k){return H(k,function(K){return K})||[]},only:function(k){if(!Y(k))throw Error("React.Children.only expected to receive a single React element child.");return k}};return Lt.Activity=p,Lt.Children=ie,Lt.Component=A,Lt.Fragment=a,Lt.Profiler=o,Lt.PureComponent=I,Lt.StrictMode=l,Lt.Suspense=y,Lt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=ee,Lt.__COMPILER_RUNTIME={__proto__:null,c:function(k){return ee.H.useMemoCache(k)}},Lt.cache=function(k){return function(){return k.apply(null,arguments)}},Lt.cacheSignal=function(){return null},Lt.cloneElement=function(k,K,_e){if(k==null)throw Error("The argument must be a React element, but you passed "+k+".");var fe=j({},k.props),Te=k.key;if(K!=null)for(re in K.key!==void 0&&(Te=""+K.key),K)!F.call(K,re)||re==="key"||re==="__self"||re==="__source"||re==="ref"&&K.ref===void 0||(fe[re]=K[re]);var re=arguments.length-2;if(re===1)fe.children=_e;else if(1<re){for(var we=Array(re),ve=0;ve<re;ve++)we[ve]=arguments[ve+2];fe.children=we}return G(k.type,Te,fe)},Lt.createContext=function(k){return k={$$typeof:f,_currentValue:k,_currentValue2:k,_threadCount:0,Provider:null,Consumer:null},k.Provider=k,k.Consumer={$$typeof:u,_context:k},k},Lt.createElement=function(k,K,_e){var fe,Te={},re=null;if(K!=null)for(fe in K.key!==void 0&&(re=""+K.key),K)F.call(K,fe)&&fe!=="key"&&fe!=="__self"&&fe!=="__source"&&(Te[fe]=K[fe]);var we=arguments.length-2;if(we===1)Te.children=_e;else if(1<we){for(var ve=Array(we),ze=0;ze<we;ze++)ve[ze]=arguments[ze+2];Te.children=ve}if(k&&k.defaultProps)for(fe in we=k.defaultProps,we)Te[fe]===void 0&&(Te[fe]=we[fe]);return G(k,re,Te)},Lt.createRef=function(){return{current:null}},Lt.forwardRef=function(k){return{$$typeof:m,render:k}},Lt.isValidElement=Y,Lt.lazy=function(k){return{$$typeof:S,_payload:{_status:-1,_result:k},_init:X}},Lt.memo=function(k,K){return{$$typeof:g,type:k,compare:K===void 0?null:K}},Lt.startTransition=function(k){var K=ee.T,_e={};ee.T=_e;try{var fe=k(),Te=ee.S;Te!==null&&Te(_e,fe),typeof fe=="object"&&fe!==null&&typeof fe.then=="function"&&fe.then(W,oe)}catch(re){oe(re)}finally{K!==null&&_e.types!==null&&(K.types=_e.types),ee.T=K}},Lt.unstable_useCacheRefresh=function(){return ee.H.useCacheRefresh()},Lt.use=function(k){return ee.H.use(k)},Lt.useActionState=function(k,K,_e){return ee.H.useActionState(k,K,_e)},Lt.useCallback=function(k,K){return ee.H.useCallback(k,K)},Lt.useContext=function(k){return ee.H.useContext(k)},Lt.useDebugValue=function(){},Lt.useDeferredValue=function(k,K){return ee.H.useDeferredValue(k,K)},Lt.useEffect=function(k,K){return ee.H.useEffect(k,K)},Lt.useEffectEvent=function(k){return ee.H.useEffectEvent(k)},Lt.useId=function(){return ee.H.useId()},Lt.useImperativeHandle=function(k,K,_e){return ee.H.useImperativeHandle(k,K,_e)},Lt.useInsertionEffect=function(k,K){return ee.H.useInsertionEffect(k,K)},Lt.useLayoutEffect=function(k,K){return ee.H.useLayoutEffect(k,K)},Lt.useMemo=function(k,K){return ee.H.useMemo(k,K)},Lt.useOptimistic=function(k,K){return ee.H.useOptimistic(k,K)},Lt.useReducer=function(k,K,_e){return ee.H.useReducer(k,K,_e)},Lt.useRef=function(k){return ee.H.useRef(k)},Lt.useState=function(k){return ee.H.useState(k)},Lt.useSyncExternalStore=function(k,K,_e){return ee.H.useSyncExternalStore(k,K,_e)},Lt.useTransition=function(){return ee.H.useTransition()},Lt.version="19.2.4",Lt}var gv;function Uf(){return gv||(gv=1,K1.exports=Kx()),K1.exports}var _=Uf();const Fr=Fx(_);var Q1={exports:{}},Kd={},G1={exports:{}},Y1={};/**
19
+ * @license React
20
+ * scheduler.production.js
21
+ *
22
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
23
+ *
24
+ * This source code is licensed under the MIT license found in the
25
+ * LICENSE file in the root directory of this source tree.
26
+ */var _v;function Qx(){return _v||(_v=1,(function(e){function t(R,H){var X=R.length;R.push(H);e:for(;0<X;){var oe=X-1>>>1,ie=R[oe];if(0<o(ie,H))R[oe]=H,R[X]=ie,X=oe;else break e}}function a(R){return R.length===0?null:R[0]}function l(R){if(R.length===0)return null;var H=R[0],X=R.pop();if(X!==H){R[0]=X;e:for(var oe=0,ie=R.length,k=ie>>>1;oe<k;){var K=2*(oe+1)-1,_e=R[K],fe=K+1,Te=R[fe];if(0>o(_e,X))fe<ie&&0>o(Te,_e)?(R[oe]=Te,R[fe]=X,oe=fe):(R[oe]=_e,R[K]=X,oe=K);else if(fe<ie&&0>o(Te,X))R[oe]=Te,R[fe]=X,oe=fe;else break e}}return H}function o(R,H){var X=R.sortIndex-H.sortIndex;return X!==0?X:R.id-H.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var f=Date,m=f.now();e.unstable_now=function(){return f.now()-m}}var y=[],g=[],S=1,p=null,v=3,w=!1,N=!1,j=!1,T=!1,A=typeof setTimeout=="function"?setTimeout:null,U=typeof clearTimeout=="function"?clearTimeout:null,I=typeof setImmediate<"u"?setImmediate:null;function E(R){for(var H=a(g);H!==null;){if(H.callback===null)l(g);else if(H.startTime<=R)l(g),H.sortIndex=H.expirationTime,t(y,H);else break;H=a(g)}}function L(R){if(j=!1,E(R),!N)if(a(y)!==null)N=!0,W||(W=!0,pe());else{var H=a(g);H!==null&&ye(L,H.startTime-R)}}var W=!1,ee=-1,F=5,G=-1;function Q(){return T?!0:!(e.unstable_now()-G<F)}function Y(){if(T=!1,W){var R=e.unstable_now();G=R;var H=!0;try{e:{N=!1,j&&(j=!1,U(ee),ee=-1),w=!0;var X=v;try{t:{for(E(R),p=a(y);p!==null&&!(p.expirationTime>R&&Q());){var oe=p.callback;if(typeof oe=="function"){p.callback=null,v=p.priorityLevel;var ie=oe(p.expirationTime<=R);if(R=e.unstable_now(),typeof ie=="function"){p.callback=ie,E(R),H=!0;break t}p===a(y)&&l(y),E(R)}else l(y);p=a(y)}if(p!==null)H=!0;else{var k=a(g);k!==null&&ye(L,k.startTime-R),H=!1}}break e}finally{p=null,v=X,w=!1}H=void 0}}finally{H?pe():W=!1}}}var pe;if(typeof I=="function")pe=function(){I(Y)};else if(typeof MessageChannel<"u"){var ne=new MessageChannel,V=ne.port2;ne.port1.onmessage=Y,pe=function(){V.postMessage(null)}}else pe=function(){A(Y,0)};function ye(R,H){ee=A(function(){R(e.unstable_now())},H)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(R){R.callback=null},e.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):F=0<R?Math.floor(1e3/R):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_next=function(R){switch(v){case 1:case 2:case 3:var H=3;break;default:H=v}var X=v;v=H;try{return R()}finally{v=X}},e.unstable_requestPaint=function(){T=!0},e.unstable_runWithPriority=function(R,H){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var X=v;v=R;try{return H()}finally{v=X}},e.unstable_scheduleCallback=function(R,H,X){var oe=e.unstable_now();switch(typeof X=="object"&&X!==null?(X=X.delay,X=typeof X=="number"&&0<X?oe+X:oe):X=oe,R){case 1:var ie=-1;break;case 2:ie=250;break;case 5:ie=1073741823;break;case 4:ie=1e4;break;default:ie=5e3}return ie=X+ie,R={id:S++,callback:H,priorityLevel:R,startTime:X,expirationTime:ie,sortIndex:-1},X>oe?(R.sortIndex=X,t(g,R),a(y)===null&&R===a(g)&&(j?(U(ee),ee=-1):j=!0,ye(L,X-oe))):(R.sortIndex=ie,t(y,R),N||w||(N=!0,W||(W=!0,pe()))),R},e.unstable_shouldYield=Q,e.unstable_wrapCallback=function(R){var H=v;return function(){var X=v;v=H;try{return R.apply(this,arguments)}finally{v=X}}}})(Y1)),Y1}var yv;function Gx(){return yv||(yv=1,G1.exports=Qx()),G1.exports}var V1={exports:{}},Qs={};/**
27
+ * @license React
28
+ * react-dom.production.js
29
+ *
30
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
31
+ *
32
+ * This source code is licensed under the MIT license found in the
33
+ * LICENSE file in the root directory of this source tree.
34
+ */var vv;function Yx(){if(vv)return Qs;vv=1;var e=Uf();function t(y){var g="https://react.dev/errors/"+y;if(1<arguments.length){g+="?args[]="+encodeURIComponent(arguments[1]);for(var S=2;S<arguments.length;S++)g+="&args[]="+encodeURIComponent(arguments[S])}return"Minified React error #"+y+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(){}var l={d:{f:a,r:function(){throw Error(t(522))},D:a,C:a,L:a,m:a,X:a,S:a,M:a},p:0,findDOMNode:null},o=Symbol.for("react.portal");function u(y,g,S){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:p==null?null:""+p,children:y,containerInfo:g,implementation:S}}var f=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(y,g){if(y==="font")return"";if(typeof g=="string")return g==="use-credentials"?g:""}return Qs.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=l,Qs.createPortal=function(y,g){var S=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!g||g.nodeType!==1&&g.nodeType!==9&&g.nodeType!==11)throw Error(t(299));return u(y,g,null,S)},Qs.flushSync=function(y){var g=f.T,S=l.p;try{if(f.T=null,l.p=2,y)return y()}finally{f.T=g,l.p=S,l.d.f()}},Qs.preconnect=function(y,g){typeof y=="string"&&(g?(g=g.crossOrigin,g=typeof g=="string"?g==="use-credentials"?g:"":void 0):g=null,l.d.C(y,g))},Qs.prefetchDNS=function(y){typeof y=="string"&&l.d.D(y)},Qs.preinit=function(y,g){if(typeof y=="string"&&g&&typeof g.as=="string"){var S=g.as,p=m(S,g.crossOrigin),v=typeof g.integrity=="string"?g.integrity:void 0,w=typeof g.fetchPriority=="string"?g.fetchPriority:void 0;S==="style"?l.d.S(y,typeof g.precedence=="string"?g.precedence:void 0,{crossOrigin:p,integrity:v,fetchPriority:w}):S==="script"&&l.d.X(y,{crossOrigin:p,integrity:v,fetchPriority:w,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},Qs.preinitModule=function(y,g){if(typeof y=="string")if(typeof g=="object"&&g!==null){if(g.as==null||g.as==="script"){var S=m(g.as,g.crossOrigin);l.d.M(y,{crossOrigin:S,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0})}}else g==null&&l.d.M(y)},Qs.preload=function(y,g){if(typeof y=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var S=g.as,p=m(S,g.crossOrigin);l.d.L(y,S,{crossOrigin:p,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0,type:typeof g.type=="string"?g.type:void 0,fetchPriority:typeof g.fetchPriority=="string"?g.fetchPriority:void 0,referrerPolicy:typeof g.referrerPolicy=="string"?g.referrerPolicy:void 0,imageSrcSet:typeof g.imageSrcSet=="string"?g.imageSrcSet:void 0,imageSizes:typeof g.imageSizes=="string"?g.imageSizes:void 0,media:typeof g.media=="string"?g.media:void 0})}},Qs.preloadModule=function(y,g){if(typeof y=="string")if(g){var S=m(g.as,g.crossOrigin);l.d.m(y,{as:typeof g.as=="string"&&g.as!=="script"?g.as:void 0,crossOrigin:S,integrity:typeof g.integrity=="string"?g.integrity:void 0})}else l.d.m(y)},Qs.requestFormReset=function(y){l.d.r(y)},Qs.unstable_batchedUpdates=function(y,g){return y(g)},Qs.useFormState=function(y,g,S){return f.H.useFormState(y,g,S)},Qs.useFormStatus=function(){return f.H.useHostTransitionStatus()},Qs.version="19.2.4",Qs}var bv;function v2(){if(bv)return V1.exports;bv=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),V1.exports=Yx(),V1.exports}/**
35
+ * @license React
36
+ * react-dom-client.production.js
37
+ *
38
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
39
+ *
40
+ * This source code is licensed under the MIT license found in the
41
+ * LICENSE file in the root directory of this source tree.
42
+ */var xv;function Vx(){if(xv)return Kd;xv=1;var e=Gx(),t=Uf(),a=v2();function l(n){var s="https://react.dev/errors/"+n;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)s+="&args[]="+encodeURIComponent(arguments[r])}return"Minified React error #"+n+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function u(n){var s=n,r=n;if(n.alternate)for(;s.return;)s=s.return;else{n=s;do s=n,(s.flags&4098)!==0&&(r=s.return),n=s.return;while(n)}return s.tag===3?r:null}function f(n){if(n.tag===13){var s=n.memoizedState;if(s===null&&(n=n.alternate,n!==null&&(s=n.memoizedState)),s!==null)return s.dehydrated}return null}function m(n){if(n.tag===31){var s=n.memoizedState;if(s===null&&(n=n.alternate,n!==null&&(s=n.memoizedState)),s!==null)return s.dehydrated}return null}function y(n){if(u(n)!==n)throw Error(l(188))}function g(n){var s=n.alternate;if(!s){if(s=u(n),s===null)throw Error(l(188));return s!==n?null:n}for(var r=n,c=s;;){var d=r.return;if(d===null)break;var h=d.alternate;if(h===null){if(c=d.return,c!==null){r=c;continue}break}if(d.child===h.child){for(h=d.child;h;){if(h===r)return y(d),n;if(h===c)return y(d),s;h=h.sibling}throw Error(l(188))}if(r.return!==c.return)r=d,c=h;else{for(var x=!1,C=d.child;C;){if(C===r){x=!0,r=d,c=h;break}if(C===c){x=!0,c=d,r=h;break}C=C.sibling}if(!x){for(C=h.child;C;){if(C===r){x=!0,r=h,c=d;break}if(C===c){x=!0,c=h,r=d;break}C=C.sibling}if(!x)throw Error(l(189))}}if(r.alternate!==c)throw Error(l(190))}if(r.tag!==3)throw Error(l(188));return r.stateNode.current===r?n:s}function S(n){var s=n.tag;if(s===5||s===26||s===27||s===6)return n;for(n=n.child;n!==null;){if(s=S(n),s!==null)return s;n=n.sibling}return null}var p=Object.assign,v=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),U=Symbol.for("react.consumer"),I=Symbol.for("react.context"),E=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),W=Symbol.for("react.suspense_list"),ee=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),G=Symbol.for("react.activity"),Q=Symbol.for("react.memo_cache_sentinel"),Y=Symbol.iterator;function pe(n){return n===null||typeof n!="object"?null:(n=Y&&n[Y]||n["@@iterator"],typeof n=="function"?n:null)}var ne=Symbol.for("react.client.reference");function V(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===ne?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case j:return"Fragment";case A:return"Profiler";case T:return"StrictMode";case L:return"Suspense";case W:return"SuspenseList";case G:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case N:return"Portal";case I:return n.displayName||"Context";case U:return(n._context.displayName||"Context")+".Consumer";case E:var s=n.render;return n=n.displayName,n||(n=s.displayName||s.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case ee:return s=n.displayName||null,s!==null?s:V(n.type)||"Memo";case F:s=n._payload,n=n._init;try{return V(n(s))}catch{}}return null}var ye=Array.isArray,R=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,H=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X={pending:!1,data:null,method:null,action:null},oe=[],ie=-1;function k(n){return{current:n}}function K(n){0>ie||(n.current=oe[ie],oe[ie]=null,ie--)}function _e(n,s){ie++,oe[ie]=n.current,n.current=s}var fe=k(null),Te=k(null),re=k(null),we=k(null);function ve(n,s){switch(_e(re,s),_e(Te,n),_e(fe,null),s.nodeType){case 9:case 11:n=(n=s.documentElement)&&(n=n.namespaceURI)?Oy(n):0;break;default:if(n=s.tagName,s=s.namespaceURI)s=Oy(s),n=Iy(s,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}K(fe),_e(fe,n)}function ze(){K(fe),K(Te),K(re)}function Be(n){n.memoizedState!==null&&_e(we,n);var s=fe.current,r=Iy(s,n.type);s!==r&&(_e(Te,n),_e(fe,r))}function St(n){Te.current===n&&(K(fe),K(Te)),we.current===n&&(K(we),Hd._currentValue=X)}var Ke,tt;function nn(n){if(Ke===void 0)try{throw Error()}catch(r){var s=r.stack.trim().match(/\n( *(at )?)/);Ke=s&&s[1]||"",tt=-1<r.stack.indexOf(`
43
+ at`)?" (<anonymous>)":-1<r.stack.indexOf("@")?"@unknown:0:0":""}return`
44
+ `+Ke+n+tt}var Xt=!1;function jn(n,s){if(!n||Xt)return"";Xt=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var c={DetermineComponentFrameRoot:function(){try{if(s){var Ne=function(){throw Error()};if(Object.defineProperty(Ne.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ne,[])}catch(ge){var ue=ge}Reflect.construct(n,[],Ne)}else{try{Ne.call()}catch(ge){ue=ge}n.call(Ne.prototype)}}else{try{throw Error()}catch(ge){ue=ge}(Ne=n())&&typeof Ne.catch=="function"&&Ne.catch(function(){})}}catch(ge){if(ge&&ue&&typeof ge.stack=="string")return[ge.stack,ue.stack]}return[null,null]}};c.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var d=Object.getOwnPropertyDescriptor(c.DetermineComponentFrameRoot,"name");d&&d.configurable&&Object.defineProperty(c.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var h=c.DetermineComponentFrameRoot(),x=h[0],C=h[1];if(x&&C){var z=x.split(`
45
+ `),ae=C.split(`
46
+ `);for(d=c=0;c<z.length&&!z[c].includes("DetermineComponentFrameRoot");)c++;for(;d<ae.length&&!ae[d].includes("DetermineComponentFrameRoot");)d++;if(c===z.length||d===ae.length)for(c=z.length-1,d=ae.length-1;1<=c&&0<=d&&z[c]!==ae[d];)d--;for(;1<=c&&0<=d;c--,d--)if(z[c]!==ae[d]){if(c!==1||d!==1)do if(c--,d--,0>d||z[c]!==ae[d]){var xe=`
47
+ `+z[c].replace(" at new "," at ");return n.displayName&&xe.includes("<anonymous>")&&(xe=xe.replace("<anonymous>",n.displayName)),xe}while(1<=c&&0<=d);break}}}finally{Xt=!1,Error.prepareStackTrace=r}return(r=n?n.displayName||n.name:"")?nn(r):""}function zt(n,s){switch(n.tag){case 26:case 27:case 5:return nn(n.type);case 16:return nn("Lazy");case 13:return n.child!==s&&s!==null?nn("Suspense Fallback"):nn("Suspense");case 19:return nn("SuspenseList");case 0:case 15:return jn(n.type,!1);case 11:return jn(n.type.render,!1);case 1:return jn(n.type,!0);case 31:return nn("Activity");default:return""}}function Bt(n){try{var s="",r=null;do s+=zt(n,r),r=n,n=n.return;while(n);return s}catch(c){return`
48
+ Error generating stack: `+c.message+`
49
+ `+c.stack}}var _t=Object.prototype.hasOwnProperty,vt=e.unstable_scheduleCallback,dt=e.unstable_cancelCallback,cn=e.unstable_shouldYield,Pn=e.unstable_requestPaint,ke=e.unstable_now,Z=e.unstable_getCurrentPriorityLevel,me=e.unstable_ImmediatePriority,Ce=e.unstable_UserBlockingPriority,Oe=e.unstable_NormalPriority,le=e.unstable_LowPriority,Ae=e.unstable_IdlePriority,qe=e.log,bt=e.unstable_setDisableYieldValue,At=null,ce=null;function Me(n){if(typeof qe=="function"&&bt(n),ce&&typeof ce.setStrictMode=="function")try{ce.setStrictMode(At,n)}catch{}}var Re=Math.clz32?Math.clz32:Je,We=Math.log,Xe=Math.LN2;function Je(n){return n>>>=0,n===0?32:31-(We(n)/Xe|0)|0}var Tt=256,Wt=262144,ls=4194304;function Nt(n){var s=n&42;if(s!==0)return s;switch(n&-n){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 n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function Un(n,s,r){var c=n.pendingLanes;if(c===0)return 0;var d=0,h=n.suspendedLanes,x=n.pingedLanes;n=n.warmLanes;var C=c&134217727;return C!==0?(c=C&~h,c!==0?d=Nt(c):(x&=C,x!==0?d=Nt(x):r||(r=C&~n,r!==0&&(d=Nt(r))))):(C=c&~h,C!==0?d=Nt(C):x!==0?d=Nt(x):r||(r=c&~n,r!==0&&(d=Nt(r)))),d===0?0:s!==0&&s!==d&&(s&h)===0&&(h=d&-d,r=s&-s,h>=r||h===32&&(r&4194048)!==0)?s:d}function Cn(n,s){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&s)===0}function Dn(n,s){switch(n){case 1:case 2:case 4:case 8:case 64:return s+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 s+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 De(){var n=ls;return ls<<=1,(ls&62914560)===0&&(ls=4194304),n}function Qt(n){for(var s=[],r=0;31>r;r++)s.push(n);return s}function On(n,s){n.pendingLanes|=s,s!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function Ts(n,s,r,c,d,h){var x=n.pendingLanes;n.pendingLanes=r,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=r,n.entangledLanes&=r,n.errorRecoveryDisabledLanes&=r,n.shellSuspendCounter=0;var C=n.entanglements,z=n.expirationTimes,ae=n.hiddenUpdates;for(r=x&~r;0<r;){var xe=31-Re(r),Ne=1<<xe;C[xe]=0,z[xe]=-1;var ue=ae[xe];if(ue!==null)for(ae[xe]=null,xe=0;xe<ue.length;xe++){var ge=ue[xe];ge!==null&&(ge.lane&=-536870913)}r&=~Ne}c!==0&&Ua(n,c,0),h!==0&&d===0&&n.tag!==0&&(n.suspendedLanes|=h&~(x&~s))}function Ua(n,s,r){n.pendingLanes|=s,n.suspendedLanes&=~s;var c=31-Re(s);n.entangledLanes|=s,n.entanglements[c]=n.entanglements[c]|1073741824|r&261930}function Us(n,s){var r=n.entangledLanes|=s;for(n=n.entanglements;r;){var c=31-Re(r),d=1<<c;d&s|n[c]&s&&(n[c]|=s),r&=~d}}function Ci(n,s){var r=s&-s;return r=(r&42)!==0?1:Fn(r),(r&(n.suspendedLanes|s))!==0?0:r}function Fn(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=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:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function Ys(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function te(){var n=H.p;return n!==0?n:(n=window.event,n===void 0?32:av(n.type))}function Ie(n,s){var r=H.p;try{return H.p=n,s()}finally{H.p=r}}var $e=Math.random().toString(36).slice(2),at="__reactFiber$"+$e,Ut="__reactProps$"+$e,ft="__reactContainer$"+$e,Mt="__reactEvents$"+$e,qn="__reactListeners$"+$e,jt="__reactHandles$"+$e,zs="__reactResources$"+$e,Kt="__reactMarker$"+$e;function bs(n){delete n[at],delete n[Ut],delete n[Mt],delete n[qn],delete n[jt]}function Wn(n){var s=n[at];if(s)return s;for(var r=n.parentNode;r;){if(s=r[ft]||r[at]){if(r=s.alternate,s.child!==null||r!==null&&r.child!==null)for(n=$y(n);n!==null;){if(r=n[at])return r;n=$y(n)}return s}n=r,r=n.parentNode}return null}function P(n){if(n=n[at]||n[ft]){var s=n.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return n}return null}function be(n){var s=n.tag;if(s===5||s===26||s===27||s===6)return n.stateNode;throw Error(l(33))}function Le(n){var s=n[zs];return s||(s=n[zs]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function He(n){n[Kt]=!0}var Ge=new Set,ht={};function mt(n,s){ot(n,s),ot(n+"Capture",s)}function ot(n,s){for(ht[n]=s,n=0;n<s.length;n++)Ge.add(s[n])}var Xn=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]*$"),Jt={},Jn={};function as(n){return _t.call(Jn,n)?!0:_t.call(Jt,n)?!1:Xn.test(n)?Jn[n]=!0:(Jt[n]=!0,!1)}function In(n,s,r){if(as(s))if(r===null)n.removeAttribute(s);else{switch(typeof r){case"undefined":case"function":case"symbol":n.removeAttribute(s);return;case"boolean":var c=s.toLowerCase().slice(0,5);if(c!=="data-"&&c!=="aria-"){n.removeAttribute(s);return}}n.setAttribute(s,""+r)}}function pn(n,s,r){if(r===null)n.removeAttribute(s);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(s);return}n.setAttribute(s,""+r)}}function sn(n,s,r,c){if(c===null)n.removeAttribute(r);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(r);return}n.setAttributeNS(s,r,""+c)}}function wn(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function xs(n){var s=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function D(n,s,r){var c=Object.getOwnPropertyDescriptor(n.constructor.prototype,s);if(!n.hasOwnProperty(s)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var d=c.get,h=c.set;return Object.defineProperty(n,s,{configurable:!0,get:function(){return d.call(this)},set:function(x){r=""+x,h.call(this,x)}}),Object.defineProperty(n,s,{enumerable:c.enumerable}),{getValue:function(){return r},setValue:function(x){r=""+x},stopTracking:function(){n._valueTracker=null,delete n[s]}}}}function he(n){if(!n._valueTracker){var s=xs(n)?"checked":"value";n._valueTracker=D(n,s,""+n[s])}}function et(n){if(!n)return!1;var s=n._valueTracker;if(!s)return!0;var r=s.getValue(),c="";return n&&(c=xs(n)?n.checked?"true":"false":n.value),n=c,n!==r?(s.setValue(n),!0):!1}function It(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var pt=/[\n"\\]/g;function ct(n){return n.replace(pt,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function gn(n,s,r,c,d,h,x,C){n.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?n.type=x:n.removeAttribute("type"),s!=null?x==="number"?(s===0&&n.value===""||n.value!=s)&&(n.value=""+wn(s)):n.value!==""+wn(s)&&(n.value=""+wn(s)):x!=="submit"&&x!=="reset"||n.removeAttribute("value"),s!=null?za(n,x,wn(s)):r!=null?za(n,x,wn(r)):c!=null&&n.removeAttribute("value"),d==null&&h!=null&&(n.defaultChecked=!!h),d!=null&&(n.checked=d&&typeof d!="function"&&typeof d!="symbol"),C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?n.name=""+wn(C):n.removeAttribute("name")}function zn(n,s,r,c,d,h,x,C){if(h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(n.type=h),s!=null||r!=null){if(!(h!=="submit"&&h!=="reset"||s!=null)){he(n);return}r=r!=null?""+wn(r):"",s=s!=null?""+wn(s):r,C||s===n.value||(n.value=s),n.defaultValue=s}c=c??d,c=typeof c!="function"&&typeof c!="symbol"&&!!c,n.checked=C?n.checked:!!c,n.defaultChecked=!!c,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(n.name=x),he(n)}function za(n,s,r){s==="number"&&It(n.ownerDocument)===n||n.defaultValue===""+r||(n.defaultValue=""+r)}function Bs(n,s,r,c){if(n=n.options,s){s={};for(var d=0;d<r.length;d++)s["$"+r[d]]=!0;for(r=0;r<n.length;r++)d=s.hasOwnProperty("$"+n[r].value),n[r].selected!==d&&(n[r].selected=d),d&&c&&(n[r].defaultSelected=!0)}else{for(r=""+wn(r),s=null,d=0;d<n.length;d++){if(n[d].value===r){n[d].selected=!0,c&&(n[d].defaultSelected=!0);return}s!==null||n[d].disabled||(s=n[d])}s!==null&&(s.selected=!0)}}function Hs(n,s,r){if(s!=null&&(s=""+wn(s),s!==n.value&&(n.value=s),r==null)){n.defaultValue!==s&&(n.defaultValue=s);return}n.defaultValue=r!=null?""+wn(r):""}function Vs(n,s,r,c){if(s==null){if(c!=null){if(r!=null)throw Error(l(92));if(ye(c)){if(1<c.length)throw Error(l(93));c=c[0]}r=c}r==null&&(r=""),s=r}r=wn(s),n.defaultValue=r,c=n.textContent,c===r&&c!==""&&c!==null&&(n.value=c),he(n)}function $s(n,s){if(s){var r=n.firstChild;if(r&&r===n.lastChild&&r.nodeType===3){r.nodeValue=s;return}}n.textContent=s}var ri=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 Ti(n,s,r){var c=s.indexOf("--")===0;r==null||typeof r=="boolean"||r===""?c?n.setProperty(s,""):s==="float"?n.cssFloat="":n[s]="":c?n.setProperty(s,r):typeof r!="number"||r===0||ri.has(s)?s==="float"?n.cssFloat=r:n[s]=(""+r).trim():n[s]=r+"px"}function er(n,s,r){if(s!=null&&typeof s!="object")throw Error(l(62));if(n=n.style,r!=null){for(var c in r)!r.hasOwnProperty(c)||s!=null&&s.hasOwnProperty(c)||(c.indexOf("--")===0?n.setProperty(c,""):c==="float"?n.cssFloat="":n[c]="");for(var d in s)c=s[d],s.hasOwnProperty(d)&&r[d]!==c&&Ti(n,d,c)}else for(var h in s)s.hasOwnProperty(h)&&Ti(n,h,s[h])}function tr(n){if(n.indexOf("-")===-1)return!1;switch(n){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 nr=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"]]),sr=/^[\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 Ba(n){return sr.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function Ms(){}var Ha=null;function ar(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Zs=null,Ss=null;function ir(n){var s=P(n);if(s&&(n=s.stateNode)){var r=n[Ut]||null;e:switch(n=s.stateNode,s.type){case"input":if(gn(n,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name),s=r.name,r.type==="radio"&&s!=null){for(r=n;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll('input[name="'+ct(""+s)+'"][type="radio"]'),s=0;s<r.length;s++){var c=r[s];if(c!==n&&c.form===n.form){var d=c[Ut]||null;if(!d)throw Error(l(90));gn(c,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name)}}for(s=0;s<r.length;s++)c=r[s],c.form===n.form&&et(c)}break e;case"textarea":Hs(n,r.value,r.defaultValue);break e;case"select":s=r.value,s!=null&&Bs(n,!!r.multiple,s,!1)}}}var rr=!1;function li(n,s,r){if(rr)return n(s,r);rr=!0;try{var c=n(s);return c}finally{if(rr=!1,(Zs!==null||Ss!==null)&&(Ih(),Zs&&(s=Zs,n=Ss,Ss=Zs=null,ir(s),n)))for(s=0;s<n.length;s++)ir(n[s])}}function Mi(n,s){var r=n.stateNode;if(r===null)return null;var c=r[Ut]||null;if(c===null)return null;r=c[s];e:switch(s){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)||(n=n.type,c=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!c;break e;default:n=!1}if(n)return null;if(r&&typeof r!="function")throw Error(l(231,s,typeof r));return r}var Xs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Qu=!1;if(Xs)try{var oi={};Object.defineProperty(oi,"passive",{get:function(){Qu=!0}}),window.addEventListener("test",oi,oi),window.removeEventListener("test",oi,oi)}catch{Qu=!1}var ja=null,lo=null,Ri=null;function lr(){if(Ri)return Ri;var n,s=lo,r=s.length,c,d="value"in ja?ja.value:ja.textContent,h=d.length;for(n=0;n<r&&s[n]===d[n];n++);var x=r-n;for(c=1;c<=x&&s[r-c]===d[h-c];c++);return Ri=d.slice(n,1<c?1-c:void 0)}function Ai(n){var s=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&s===13&&(n=13)):n=s,n===10&&(n=13),32<=n||n===13?n:0}function Di(){return!0}function Gu(){return!1}function os(n){function s(r,c,d,h,x){this._reactName=r,this._targetInst=d,this.type=c,this.nativeEvent=h,this.target=x,this.currentTarget=null;for(var C in n)n.hasOwnProperty(C)&&(r=n[C],this[C]=r?r(h):h[C]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?Di:Gu,this.isPropagationStopped=Gu,this}return p(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=Di)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=Di)},persist:function(){},isPersistent:Di}),s}var es={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Vr=os(es),ci=p({},es,{view:0,detail:0}),oo=os(ci),$a,de,on,Rs=p({},ci,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Vu,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==on&&(on&&n.type==="mousemove"?($a=n.screenX-on.screenX,de=n.screenY-on.screenY):de=$a=0,on=n),$a)},movementY:function(n){return"movementY"in n?n.movementY:de}}),ui=os(Rs),wa=p({},Rs,{dataTransfer:0}),_n=os(wa),Zr=p({},ci,{relatedTarget:0}),Xr=os(Zr),Qf=p({},es,{animationName:0,elapsedTime:0,pseudoElement:0}),Gf=os(Qf),dc=p({},es,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),Yf=os(dc),Np=p({},es,{data:0}),fc=os(Np),ps={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Yu={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"},kp={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function or(n){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(n):(n=kp[n])?!!s[n]:!1}function Vu(){return or}var bn=p({},ci,{key:function(n){if(n.key){var s=ps[n.key]||n.key;if(s!=="Unidentified")return s}return n.type==="keypress"?(n=Ai(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?Yu[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Vu,charCode:function(n){return n.type==="keypress"?Ai(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?Ai(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),Jr=os(bn),Vf=p({},Rs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),co=os(Vf),Zu=p({},ci,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Vu}),Zf=os(Zu),hc=p({},es,{propertyName:0,elapsedTime:0,pseudoElement:0}),Xf=os(hc),ia=p({},Rs,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),uo=os(ia),Ep=p({},es,{newState:0,oldState:0}),Cp=os(Ep),mc=[9,13,27,32],di=Xs&&"CompositionEvent"in window,el=null;Xs&&"documentMode"in document&&(el=document.documentMode);var Xu=Xs&&"TextEvent"in window&&!el,Ju=Xs&&(!di||el&&8<el&&11>=el),Jf=" ",cr=!1;function Na(n,s){switch(n){case"keyup":return mc.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ur(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var ra=!1;function ed(n,s){switch(n){case"compositionend":return ur(s);case"keypress":return s.which!==32?null:(cr=!0,Jf);case"textInput":return n=s.data,n===Jf&&cr?null:n;default:return null}}function pc(n,s){if(ra)return n==="compositionend"||!di&&Na(n,s)?(n=lr(),Ri=lo=ja=null,ra=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return Ju&&s.locale!=="ko"?null:s.data;default:return null}}var eh={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 tl(n){var s=n&&n.nodeName&&n.nodeName.toLowerCase();return s==="input"?!!eh[n.type]:s==="textarea"}function nl(n,s,r,c){Zs?Ss?Ss.push(c):Ss=[c]:Zs=c,s=$h(s,"onChange"),0<s.length&&(r=new Vr("onChange","change",null,r,c),n.push({event:r,listeners:s}))}var sl=null,la=null;function gc(n){Cy(n,0)}function fi(n){var s=be(n);if(et(s))return n}function td(n,s){if(n==="change")return s}var Fa=!1;if(Xs){var Kn;if(Xs){var al="oninput"in document;if(!al){var Fs=document.createElement("div");Fs.setAttribute("oninput","return;"),al=typeof Fs.oninput=="function"}Kn=al}else Kn=!1;Fa=Kn&&(!document.documentMode||9<document.documentMode)}function qa(){sl&&(sl.detachEvent("onpropertychange",Wa),la=sl=null)}function Wa(n){if(n.propertyName==="value"&&fi(la)){var s=[];nl(s,la,n,ar(n)),li(gc,s)}}function _c(n,s,r){n==="focusin"?(qa(),sl=s,la=r,sl.attachEvent("onpropertychange",Wa)):n==="focusout"&&qa()}function yc(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return fi(la)}function cs(n,s){if(n==="click")return fi(s)}function vc(n,s){if(n==="input"||n==="change")return fi(s)}function th(n,s){return n===s&&(n!==0||1/n===1/s)||n!==n&&s!==s}var js=typeof Object.is=="function"?Object.is:th;function dr(n,s){if(js(n,s))return!0;if(typeof n!="object"||n===null||typeof s!="object"||s===null)return!1;var r=Object.keys(n),c=Object.keys(s);if(r.length!==c.length)return!1;for(c=0;c<r.length;c++){var d=r[c];if(!_t.call(s,d)||!js(n[d],s[d]))return!1}return!0}function nd(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function il(n,s){var r=nd(n);n=0;for(var c;r;){if(r.nodeType===3){if(c=n+r.textContent.length,n<=s&&c>=s)return{node:r,offset:s-n};n=c}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=nd(r)}}function fo(n,s){return n&&s?n===s?!0:n&&n.nodeType===3?!1:s&&s.nodeType===3?fo(n,s.parentNode):"contains"in n?n.contains(s):n.compareDocumentPosition?!!(n.compareDocumentPosition(s)&16):!1:!1}function nh(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var s=It(n.document);s instanceof n.HTMLIFrameElement;){try{var r=typeof s.contentWindow.location.href=="string"}catch{r=!1}if(r)n=s.contentWindow;else break;s=It(n.document)}return s}function bc(n){var s=n&&n.nodeName&&n.nodeName.toLowerCase();return s&&(s==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||s==="textarea"||n.contentEditable==="true")}var sh=Xs&&"documentMode"in document&&11>=document.documentMode,rl=null,ho=null,fr=null,ll=!1;function sd(n,s,r){var c=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;ll||rl==null||rl!==It(c)||(c=rl,"selectionStart"in c&&bc(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}),fr&&dr(fr,c)||(fr=c,c=$h(ho,"onSelect"),0<c.length&&(s=new Vr("onSelect","select",null,s,r),n.push({event:s,listeners:c}),s.target=rl)))}function Ka(n,s){var r={};return r[n.toLowerCase()]=s.toLowerCase(),r["Webkit"+n]="webkit"+s,r["Moz"+n]="moz"+s,r}var Oi={animationend:Ka("Animation","AnimationEnd"),animationiteration:Ka("Animation","AnimationIteration"),animationstart:Ka("Animation","AnimationStart"),transitionrun:Ka("Transition","TransitionRun"),transitionstart:Ka("Transition","TransitionStart"),transitioncancel:Ka("Transition","TransitionCancel"),transitionend:Ka("Transition","TransitionEnd")},xc={},ad={};Xs&&(ad=document.createElement("div").style,"AnimationEvent"in window||(delete Oi.animationend.animation,delete Oi.animationiteration.animation,delete Oi.animationstart.animation),"TransitionEvent"in window||delete Oi.transitionend.transition);function hr(n){if(xc[n])return xc[n];if(!Oi[n])return n;var s=Oi[n],r;for(r in s)if(s.hasOwnProperty(r)&&r in ad)return xc[n]=s[r];return n}var Ii=hr("animationend"),ah=hr("animationiteration"),ih=hr("animationstart"),Tp=hr("transitionrun"),rh=hr("transitionstart"),Mp=hr("transitioncancel"),lh=hr("transitionend"),oa=new Map,Sc="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(" ");Sc.push("scrollEnd");function ka(n,s){oa.set(n,s),mt(s,[n])}var jc=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},ca=[],ol=0,Js=0;function wc(){for(var n=ol,s=Js=ol=0;s<n;){var r=ca[s];ca[s++]=null;var c=ca[s];ca[s++]=null;var d=ca[s];ca[s++]=null;var h=ca[s];if(ca[s++]=null,c!==null&&d!==null){var x=c.pending;x===null?d.next=d:(d.next=x.next,x.next=d),c.pending=d}h!==0&&oh(r,d,h)}}function mo(n,s,r,c){ca[ol++]=n,ca[ol++]=s,ca[ol++]=r,ca[ol++]=c,Js|=c,n.lanes|=c,n=n.alternate,n!==null&&(n.lanes|=c)}function id(n,s,r,c){return mo(n,s,r,c),po(n)}function mr(n,s){return mo(n,null,null,s),po(n)}function oh(n,s,r){n.lanes|=r;var c=n.alternate;c!==null&&(c.lanes|=r);for(var d=!1,h=n.return;h!==null;)h.childLanes|=r,c=h.alternate,c!==null&&(c.childLanes|=r),h.tag===22&&(n=h.stateNode,n===null||n._visibility&1||(d=!0)),n=h,h=h.return;return n.tag===3?(h=n.stateNode,d&&s!==null&&(d=31-Re(r),n=h.hiddenUpdates,c=n[d],c===null?n[d]=[s]:c.push(s),s.lane=r|536870912),h):null}function po(n){if(50<Od)throw Od=0,m1=null,Error(l(185));for(var s=n.return;s!==null;)n=s,s=n.return;return n.tag===3?n.stateNode:null}var cl={};function As(n,s,r,c){this.tag=n,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,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 Ds(n,s,r,c){return new As(n,s,r,c)}function go(n){return n=n.prototype,!(!n||!n.isReactComponent)}function hi(n,s){var r=n.alternate;return r===null?(r=Ds(n.tag,s,n.key,n.mode),r.elementType=n.elementType,r.type=n.type,r.stateNode=n.stateNode,r.alternate=n,n.alternate=r):(r.pendingProps=s,r.type=n.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=n.flags&65011712,r.childLanes=n.childLanes,r.lanes=n.lanes,r.child=n.child,r.memoizedProps=n.memoizedProps,r.memoizedState=n.memoizedState,r.updateQueue=n.updateQueue,s=n.dependencies,r.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},r.sibling=n.sibling,r.index=n.index,r.ref=n.ref,r.refCleanup=n.refCleanup,r}function ch(n,s){n.flags&=65011714;var r=n.alternate;return r===null?(n.childLanes=0,n.lanes=s,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=r.childLanes,n.lanes=r.lanes,n.child=r.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=r.memoizedProps,n.memoizedState=r.memoizedState,n.updateQueue=r.updateQueue,n.type=r.type,s=r.dependencies,n.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),n}function Nc(n,s,r,c,d,h){var x=0;if(c=n,typeof n=="function")go(n)&&(x=1);else if(typeof n=="string")x=Tx(n,r,fe.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case G:return n=Ds(31,r,s,d),n.elementType=G,n.lanes=h,n;case j:return Qa(r.children,d,h,s);case T:x=8,d|=24;break;case A:return n=Ds(12,r,s,d|2),n.elementType=A,n.lanes=h,n;case L:return n=Ds(13,r,s,d),n.elementType=L,n.lanes=h,n;case W:return n=Ds(19,r,s,d),n.elementType=W,n.lanes=h,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case I:x=10;break e;case U:x=9;break e;case E:x=11;break e;case ee:x=14;break e;case F:x=16,c=null;break e}x=29,r=Error(l(130,n===null?"null":typeof n,"")),c=null}return s=Ds(x,r,s,d),s.elementType=n,s.type=c,s.lanes=h,s}function Qa(n,s,r,c){return n=Ds(7,n,c,s),n.lanes=r,n}function qs(n,s,r){return n=Ds(6,n,null,s),n.lanes=r,n}function Ea(n){var s=Ds(18,null,null,0);return s.stateNode=n,s}function mi(n,s,r){return s=Ds(4,n.children!==null?n.children:[],n.key,s),s.lanes=r,s.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},s}var rd=new WeakMap;function Ws(n,s){if(typeof n=="object"&&n!==null){var r=rd.get(n);return r!==void 0?r:(s={value:n,source:s,stack:Bt(s)},rd.set(n,s),s)}return{value:n,source:s,stack:Bt(s)}}var Li=[],pi=0,ul=null,Ca=0,ua=[],ws=0,Pi=null,Ta=1,Ga="";function Ya(n,s){Li[pi++]=Ca,Li[pi++]=ul,ul=n,Ca=s}function ld(n,s,r){ua[ws++]=Ta,ua[ws++]=Ga,ua[ws++]=Pi,Pi=n;var c=Ta;n=Ga;var d=32-Re(c)-1;c&=~(1<<d),r+=1;var h=32-Re(s)+d;if(30<h){var x=d-d%5;h=(c&(1<<x)-1).toString(32),c>>=x,d-=x,Ta=1<<32-Re(s)+d|r<<d|c,Ga=h+n}else Ta=1<<h|r<<d|c,Ga=n}function Va(n){n.return!==null&&(Ya(n,1),ld(n,1,0))}function kc(n){for(;n===ul;)ul=Li[--pi],Li[pi]=null,Ca=Li[--pi],Li[pi]=null;for(;n===Pi;)Pi=ua[--ws],ua[ws]=null,Ga=ua[--ws],ua[ws]=null,Ta=ua[--ws],ua[ws]=null}function od(n,s){ua[ws++]=Ta,ua[ws++]=Ga,ua[ws++]=Pi,Ta=s.id,Ga=s.overflow,Pi=n}var us=null,Tn=null,Gt=!1,Ui=null,da=!1,cd=Error(l(519));function gi(n){var s=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw _o(Ws(s,n)),cd}function uh(n){var s=n.stateNode,r=n.type,c=n.memoizedProps;switch(s[at]=n,s[Ut]=c,r){case"dialog":Zt("cancel",s),Zt("close",s);break;case"iframe":case"object":case"embed":Zt("load",s);break;case"video":case"audio":for(r=0;r<Ld.length;r++)Zt(Ld[r],s);break;case"source":Zt("error",s);break;case"img":case"image":case"link":Zt("error",s),Zt("load",s);break;case"details":Zt("toggle",s);break;case"input":Zt("invalid",s),zn(s,c.value,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name,!0);break;case"select":Zt("invalid",s);break;case"textarea":Zt("invalid",s),Vs(s,c.value,c.defaultValue,c.children)}r=c.children,typeof r!="string"&&typeof r!="number"&&typeof r!="bigint"||s.textContent===""+r||c.suppressHydrationWarning===!0||Ay(s.textContent,r)?(c.popover!=null&&(Zt("beforetoggle",s),Zt("toggle",s)),c.onScroll!=null&&Zt("scroll",s),c.onScrollEnd!=null&&Zt("scrollend",s),c.onClick!=null&&(s.onclick=Ms),s=!0):s=!1,s||gi(n,!0)}function dh(n){for(us=n.return;us;)switch(us.tag){case 5:case 31:case 13:da=!1;return;case 27:case 3:da=!0;return;default:us=us.return}}function dl(n){if(n!==us)return!1;if(!Gt)return dh(n),Gt=!0,!1;var s=n.tag,r;if((r=s!==3&&s!==27)&&((r=s===5)&&(r=n.type,r=!(r!=="form"&&r!=="button")||T1(n.type,n.memoizedProps)),r=!r),r&&Tn&&gi(n),dh(n),s===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(l(317));Tn=Hy(n)}else if(s===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(l(317));Tn=Hy(n)}else s===27?(s=Tn,El(n.type)?(n=O1,O1=null,Tn=n):Tn=s):Tn=us?Ja(n.stateNode.nextSibling):null;return!0}function pr(){Tn=us=null,Gt=!1}function ud(){var n=Ui;return n!==null&&(ga===null?ga=n:ga.push.apply(ga,n),Ui=null),n}function _o(n){Ui===null?Ui=[n]:Ui.push(n)}var dd=k(null),gr=null,_i=null;function ea(n,s,r){_e(dd,s._currentValue),s._currentValue=r}function yi(n){n._currentValue=dd.current,K(dd)}function fd(n,s,r){for(;n!==null;){var c=n.alternate;if((n.childLanes&s)!==s?(n.childLanes|=s,c!==null&&(c.childLanes|=s)):c!==null&&(c.childLanes&s)!==s&&(c.childLanes|=s),n===r)break;n=n.return}}function hd(n,s,r,c){var d=n.child;for(d!==null&&(d.return=n);d!==null;){var h=d.dependencies;if(h!==null){var x=d.child;h=h.firstContext;e:for(;h!==null;){var C=h;h=d;for(var z=0;z<s.length;z++)if(C.context===s[z]){h.lanes|=r,C=h.alternate,C!==null&&(C.lanes|=r),fd(h.return,r,n),c||(x=null);break e}h=C.next}}else if(d.tag===18){if(x=d.return,x===null)throw Error(l(341));x.lanes|=r,h=x.alternate,h!==null&&(h.lanes|=r),fd(x,r,n),x=null}else x=d.child;if(x!==null)x.return=d;else for(x=d;x!==null;){if(x===n){x=null;break}if(d=x.sibling,d!==null){d.return=x.return,x=d;break}x=x.return}d=x}}function fl(n,s,r,c){n=null;for(var d=s,h=!1;d!==null;){if(!h){if((d.flags&524288)!==0)h=!0;else if((d.flags&262144)!==0)break}if(d.tag===10){var x=d.alternate;if(x===null)throw Error(l(387));if(x=x.memoizedProps,x!==null){var C=d.type;js(d.pendingProps.value,x.value)||(n!==null?n.push(C):n=[C])}}else if(d===we.current){if(x=d.alternate,x===null)throw Error(l(387));x.memoizedState.memoizedState!==d.memoizedState.memoizedState&&(n!==null?n.push(Hd):n=[Hd])}d=d.return}n!==null&&hd(s,n,r,c),s.flags|=262144}function Ec(n){for(n=n.firstContext;n!==null;){if(!js(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function _r(n){gr=n,_i=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function gs(n){return fh(gr,n)}function Cc(n,s){return gr===null&&_r(n),fh(n,s)}function fh(n,s){var r=s._currentValue;if(s={context:s,memoizedValue:r,next:null},_i===null){if(n===null)throw Error(l(308));_i=s,n.dependencies={lanes:0,firstContext:s},n.flags|=524288}else _i=_i.next=s;return r}var Rp=typeof AbortController<"u"?AbortController:function(){var n=[],s=this.signal={aborted:!1,addEventListener:function(r,c){n.push(c)}};this.abort=function(){s.aborted=!0,n.forEach(function(r){return r()})}},hh=e.unstable_scheduleCallback,mh=e.unstable_NormalPriority,Vn={$$typeof:I,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function md(){return{controller:new Rp,data:new Map,refCount:0}}function hl(n){n.refCount--,n.refCount===0&&hh(mh,function(){n.controller.abort()})}var ml=null,Tc=0,yr=0,vr=null;function ph(n,s){if(ml===null){var r=ml=[];Tc=0,yr=b1(),vr={status:"pending",value:void 0,then:function(c){r.push(c)}}}return Tc++,s.then(pd,pd),s}function pd(){if(--Tc===0&&ml!==null){vr!==null&&(vr.status="fulfilled");var n=ml;ml=null,yr=0,vr=null;for(var s=0;s<n.length;s++)(0,n[s])()}}function Ap(n,s){var r=[],c={status:"pending",value:null,reason:null,then:function(d){r.push(d)}};return n.then(function(){c.status="fulfilled",c.value=s;for(var d=0;d<r.length;d++)(0,r[d])(s)},function(d){for(c.status="rejected",c.reason=d,d=0;d<r.length;d++)(0,r[d])(void 0)}),c}var gh=R.S;R.S=function(n,s){ny=ke(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&ph(n,s),gh!==null&&gh(n,s)};var br=k(null);function Mc(){var n=br.current;return n!==null?n:An.pooledCache}function yo(n,s){s===null?_e(br,br.current):_e(br,s.pool)}function _h(){var n=Mc();return n===null?null:{parent:Vn._currentValue,pool:n}}var pl=Error(l(460)),gd=Error(l(474)),vo=Error(l(542)),bo={then:function(){}};function _d(n){return n=n.status,n==="fulfilled"||n==="rejected"}function xo(n,s,r){switch(r=n[r],r===void 0?n.push(s):r!==s&&(s.then(Ms,Ms),s=r),s.status){case"fulfilled":return s.value;case"rejected":throw n=s.reason,vd(n),n;default:if(typeof s.status=="string")s.then(Ms,Ms);else{if(n=An,n!==null&&100<n.shellSuspendCounter)throw Error(l(482));n=s,n.status="pending",n.then(function(c){if(s.status==="pending"){var d=s;d.status="fulfilled",d.value=c}},function(c){if(s.status==="pending"){var d=s;d.status="rejected",d.reason=c}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw n=s.reason,vd(n),n}throw Bi=s,pl}}function zi(n){try{var s=n._init;return s(n._payload)}catch(r){throw r!==null&&typeof r=="object"&&typeof r.then=="function"?(Bi=r,pl):r}}var Bi=null;function yd(){if(Bi===null)throw Error(l(459));var n=Bi;return Bi=null,n}function vd(n){if(n===pl||n===vo)throw Error(l(483))}var xr=null,gl=0;function So(n){var s=gl;return gl+=1,xr===null&&(xr=[]),xo(xr,n,s)}function _l(n,s){s=s.props.ref,n.ref=s!==void 0?s:null}function jo(n,s){throw s.$$typeof===v?Error(l(525)):(n=Object.prototype.toString.call(s),Error(l(31,n==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":n)))}function bd(n){function s(J,q){if(n){var se=J.deletions;se===null?(J.deletions=[q],J.flags|=16):se.push(q)}}function r(J,q){if(!n)return null;for(;q!==null;)s(J,q),q=q.sibling;return null}function c(J){for(var q=new Map;J!==null;)J.key!==null?q.set(J.key,J):q.set(J.index,J),J=J.sibling;return q}function d(J,q){return J=hi(J,q),J.index=0,J.sibling=null,J}function h(J,q,se){return J.index=se,n?(se=J.alternate,se!==null?(se=se.index,se<q?(J.flags|=67108866,q):se):(J.flags|=67108866,q)):(J.flags|=1048576,q)}function x(J){return n&&J.alternate===null&&(J.flags|=67108866),J}function C(J,q,se,je){return q===null||q.tag!==6?(q=qs(se,J.mode,je),q.return=J,q):(q=d(q,se),q.return=J,q)}function z(J,q,se,je){var yt=se.type;return yt===j?xe(J,q,se.props.children,je,se.key):q!==null&&(q.elementType===yt||typeof yt=="object"&&yt!==null&&yt.$$typeof===F&&zi(yt)===q.type)?(q=d(q,se.props),_l(q,se),q.return=J,q):(q=Nc(se.type,se.key,se.props,null,J.mode,je),_l(q,se),q.return=J,q)}function ae(J,q,se,je){return q===null||q.tag!==4||q.stateNode.containerInfo!==se.containerInfo||q.stateNode.implementation!==se.implementation?(q=mi(se,J.mode,je),q.return=J,q):(q=d(q,se.children||[]),q.return=J,q)}function xe(J,q,se,je,yt){return q===null||q.tag!==7?(q=Qa(se,J.mode,je,yt),q.return=J,q):(q=d(q,se),q.return=J,q)}function Ne(J,q,se){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return q=qs(""+q,J.mode,se),q.return=J,q;if(typeof q=="object"&&q!==null){switch(q.$$typeof){case w:return se=Nc(q.type,q.key,q.props,null,J.mode,se),_l(se,q),se.return=J,se;case N:return q=mi(q,J.mode,se),q.return=J,q;case F:return q=zi(q),Ne(J,q,se)}if(ye(q)||pe(q))return q=Qa(q,J.mode,se,null),q.return=J,q;if(typeof q.then=="function")return Ne(J,So(q),se);if(q.$$typeof===I)return Ne(J,Cc(J,q),se);jo(J,q)}return null}function ue(J,q,se,je){var yt=q!==null?q.key:null;if(typeof se=="string"&&se!==""||typeof se=="number"||typeof se=="bigint")return yt!==null?null:C(J,q,""+se,je);if(typeof se=="object"&&se!==null){switch(se.$$typeof){case w:return se.key===yt?z(J,q,se,je):null;case N:return se.key===yt?ae(J,q,se,je):null;case F:return se=zi(se),ue(J,q,se,je)}if(ye(se)||pe(se))return yt!==null?null:xe(J,q,se,je,null);if(typeof se.then=="function")return ue(J,q,So(se),je);if(se.$$typeof===I)return ue(J,q,Cc(J,se),je);jo(J,se)}return null}function ge(J,q,se,je,yt){if(typeof je=="string"&&je!==""||typeof je=="number"||typeof je=="bigint")return J=J.get(se)||null,C(q,J,""+je,yt);if(typeof je=="object"&&je!==null){switch(je.$$typeof){case w:return J=J.get(je.key===null?se:je.key)||null,z(q,J,je,yt);case N:return J=J.get(je.key===null?se:je.key)||null,ae(q,J,je,yt);case F:return je=zi(je),ge(J,q,se,je,yt)}if(ye(je)||pe(je))return J=J.get(se)||null,xe(q,J,je,yt,null);if(typeof je.then=="function")return ge(J,q,se,So(je),yt);if(je.$$typeof===I)return ge(J,q,se,Cc(q,je),yt);jo(q,je)}return null}function nt(J,q,se,je){for(var yt=null,fn=null,lt=q,Ht=q=0,tn=null;lt!==null&&Ht<se.length;Ht++){lt.index>Ht?(tn=lt,lt=null):tn=lt.sibling;var hn=ue(J,lt,se[Ht],je);if(hn===null){lt===null&&(lt=tn);break}n&&lt&&hn.alternate===null&&s(J,lt),q=h(hn,q,Ht),fn===null?yt=hn:fn.sibling=hn,fn=hn,lt=tn}if(Ht===se.length)return r(J,lt),Gt&&Ya(J,Ht),yt;if(lt===null){for(;Ht<se.length;Ht++)lt=Ne(J,se[Ht],je),lt!==null&&(q=h(lt,q,Ht),fn===null?yt=lt:fn.sibling=lt,fn=lt);return Gt&&Ya(J,Ht),yt}for(lt=c(lt);Ht<se.length;Ht++)tn=ge(lt,J,Ht,se[Ht],je),tn!==null&&(n&&tn.alternate!==null&&lt.delete(tn.key===null?Ht:tn.key),q=h(tn,q,Ht),fn===null?yt=tn:fn.sibling=tn,fn=tn);return n&&lt.forEach(function(Al){return s(J,Al)}),Gt&&Ya(J,Ht),yt}function wt(J,q,se,je){if(se==null)throw Error(l(151));for(var yt=null,fn=null,lt=q,Ht=q=0,tn=null,hn=se.next();lt!==null&&!hn.done;Ht++,hn=se.next()){lt.index>Ht?(tn=lt,lt=null):tn=lt.sibling;var Al=ue(J,lt,hn.value,je);if(Al===null){lt===null&&(lt=tn);break}n&&lt&&Al.alternate===null&&s(J,lt),q=h(Al,q,Ht),fn===null?yt=Al:fn.sibling=Al,fn=Al,lt=tn}if(hn.done)return r(J,lt),Gt&&Ya(J,Ht),yt;if(lt===null){for(;!hn.done;Ht++,hn=se.next())hn=Ne(J,hn.value,je),hn!==null&&(q=h(hn,q,Ht),fn===null?yt=hn:fn.sibling=hn,fn=hn);return Gt&&Ya(J,Ht),yt}for(lt=c(lt);!hn.done;Ht++,hn=se.next())hn=ge(lt,J,Ht,hn.value,je),hn!==null&&(n&&hn.alternate!==null&&lt.delete(hn.key===null?Ht:hn.key),q=h(hn,q,Ht),fn===null?yt=hn:fn.sibling=hn,fn=hn);return n&&lt.forEach(function(Bx){return s(J,Bx)}),Gt&&Ya(J,Ht),yt}function Rn(J,q,se,je){if(typeof se=="object"&&se!==null&&se.type===j&&se.key===null&&(se=se.props.children),typeof se=="object"&&se!==null){switch(se.$$typeof){case w:e:{for(var yt=se.key;q!==null;){if(q.key===yt){if(yt=se.type,yt===j){if(q.tag===7){r(J,q.sibling),je=d(q,se.props.children),je.return=J,J=je;break e}}else if(q.elementType===yt||typeof yt=="object"&&yt!==null&&yt.$$typeof===F&&zi(yt)===q.type){r(J,q.sibling),je=d(q,se.props),_l(je,se),je.return=J,J=je;break e}r(J,q);break}else s(J,q);q=q.sibling}se.type===j?(je=Qa(se.props.children,J.mode,je,se.key),je.return=J,J=je):(je=Nc(se.type,se.key,se.props,null,J.mode,je),_l(je,se),je.return=J,J=je)}return x(J);case N:e:{for(yt=se.key;q!==null;){if(q.key===yt)if(q.tag===4&&q.stateNode.containerInfo===se.containerInfo&&q.stateNode.implementation===se.implementation){r(J,q.sibling),je=d(q,se.children||[]),je.return=J,J=je;break e}else{r(J,q);break}else s(J,q);q=q.sibling}je=mi(se,J.mode,je),je.return=J,J=je}return x(J);case F:return se=zi(se),Rn(J,q,se,je)}if(ye(se))return nt(J,q,se,je);if(pe(se)){if(yt=pe(se),typeof yt!="function")throw Error(l(150));return se=yt.call(se),wt(J,q,se,je)}if(typeof se.then=="function")return Rn(J,q,So(se),je);if(se.$$typeof===I)return Rn(J,q,Cc(J,se),je);jo(J,se)}return typeof se=="string"&&se!==""||typeof se=="number"||typeof se=="bigint"?(se=""+se,q!==null&&q.tag===6?(r(J,q.sibling),je=d(q,se),je.return=J,J=je):(r(J,q),je=qs(se,J.mode,je),je.return=J,J=je),x(J)):r(J,q)}return function(J,q,se,je){try{gl=0;var yt=Rn(J,q,se,je);return xr=null,yt}catch(lt){if(lt===pl||lt===vo)throw lt;var fn=Ds(29,lt,null,J.mode);return fn.lanes=je,fn.return=J,fn}finally{}}}var Hi=bd(!0),xd=bd(!1),vi=!1;function Rc(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ac(n,s){n=n.updateQueue,s.updateQueue===n&&(s.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function bi(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function xi(n,s,r){var c=n.updateQueue;if(c===null)return null;if(c=c.shared,(vn&2)!==0){var d=c.pending;return d===null?s.next=s:(s.next=d.next,d.next=s),c.pending=s,s=po(n),oh(n,null,r),s}return mo(n,c,s,r),po(n)}function yl(n,s,r){if(s=s.updateQueue,s!==null&&(s=s.shared,(r&4194048)!==0)){var c=s.lanes;c&=n.pendingLanes,r|=c,s.lanes=r,Us(n,r)}}function b(n,s){var r=n.updateQueue,c=n.alternate;if(c!==null&&(c=c.updateQueue,r===c)){var d=null,h=null;if(r=r.firstBaseUpdate,r!==null){do{var x={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};h===null?d=h=x:h=h.next=x,r=r.next}while(r!==null);h===null?d=h=s:h=h.next=s}else d=h=s;r={baseState:c.baseState,firstBaseUpdate:d,lastBaseUpdate:h,shared:c.shared,callbacks:c.callbacks},n.updateQueue=r;return}n=r.lastBaseUpdate,n===null?r.firstBaseUpdate=s:n.next=s,r.lastBaseUpdate=s}var O=!1;function $(){if(O){var n=vr;if(n!==null)throw n}}function Se(n,s,r,c){O=!1;var d=n.updateQueue;vi=!1;var h=d.firstBaseUpdate,x=d.lastBaseUpdate,C=d.shared.pending;if(C!==null){d.shared.pending=null;var z=C,ae=z.next;z.next=null,x===null?h=ae:x.next=ae,x=z;var xe=n.alternate;xe!==null&&(xe=xe.updateQueue,C=xe.lastBaseUpdate,C!==x&&(C===null?xe.firstBaseUpdate=ae:C.next=ae,xe.lastBaseUpdate=z))}if(h!==null){var Ne=d.baseState;x=0,xe=ae=z=null,C=h;do{var ue=C.lane&-536870913,ge=ue!==C.lane;if(ge?(en&ue)===ue:(c&ue)===ue){ue!==0&&ue===yr&&(O=!0),xe!==null&&(xe=xe.next={lane:0,tag:C.tag,payload:C.payload,callback:null,next:null});e:{var nt=n,wt=C;ue=s;var Rn=r;switch(wt.tag){case 1:if(nt=wt.payload,typeof nt=="function"){Ne=nt.call(Rn,Ne,ue);break e}Ne=nt;break e;case 3:nt.flags=nt.flags&-65537|128;case 0:if(nt=wt.payload,ue=typeof nt=="function"?nt.call(Rn,Ne,ue):nt,ue==null)break e;Ne=p({},Ne,ue);break e;case 2:vi=!0}}ue=C.callback,ue!==null&&(n.flags|=64,ge&&(n.flags|=8192),ge=d.callbacks,ge===null?d.callbacks=[ue]:ge.push(ue))}else ge={lane:ue,tag:C.tag,payload:C.payload,callback:C.callback,next:null},xe===null?(ae=xe=ge,z=Ne):xe=xe.next=ge,x|=ue;if(C=C.next,C===null){if(C=d.shared.pending,C===null)break;ge=C,C=ge.next,ge.next=null,d.lastBaseUpdate=ge,d.shared.pending=null}}while(!0);xe===null&&(z=Ne),d.baseState=z,d.firstBaseUpdate=ae,d.lastBaseUpdate=xe,h===null&&(d.shared.lanes=0),Sl|=x,n.lanes=x,n.memoizedState=Ne}}function Fe(n,s){if(typeof n!="function")throw Error(l(191,n));n.call(s)}function kt(n,s){var r=n.callbacks;if(r!==null)for(n.callbacks=null,n=0;n<r.length;n++)Fe(r[n],s)}var Ve=k(null),un=k(0);function Os(n,s){n=Mr,_e(un,n),_e(Ve,s),Mr=n|s.baseLanes}function dn(){_e(un,Mr),_e(Ve,Ve.current)}function ds(){Mr=un.current,K(Ve),K(un)}var Ln=k(null),Pe=null;function Bn(n){var s=n.alternate;_e(Qn,Qn.current&1),_e(Ln,n),Pe===null&&(s===null||Ve.current!==null||s.memoizedState!==null)&&(Pe=n)}function Ns(n){_e(Qn,Qn.current),_e(Ln,n),Pe===null&&(Pe=n)}function an(n){n.tag===22?(_e(Qn,Qn.current),_e(Ln,n),Pe===null&&(Pe=n)):Za()}function Za(){_e(Qn,Qn.current),_e(Ln,Ln.current)}function Ks(n){K(Ln),Pe===n&&(Pe=null),K(Qn)}var Qn=k(0);function wo(n){for(var s=n;s!==null;){if(s.tag===13){var r=s.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||A1(r)||D1(r)))return s}else if(s.tag===19&&(s.memoizedProps.revealOrder==="forwards"||s.memoizedProps.revealOrder==="backwards"||s.memoizedProps.revealOrder==="unstable_legacy-backwards"||s.memoizedProps.revealOrder==="together")){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===n)break;for(;s.sibling===null;){if(s.return===null||s.return===n)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var Xa=0,Dt=null,yn=null,Zn=null,No=!1,Sr=!1,$i=!1,ko=0,vl=0,jr=null,yh=0;function Hn(){throw Error(l(321))}function Dc(n,s){if(s===null)return!1;for(var r=0;r<s.length&&r<n.length;r++)if(!js(n[r],s[r]))return!1;return!0}function Oc(n,s,r,c,d,h){return Xa=h,Dt=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,R.H=n===null||n.memoizedState===null?h8:Fp,$i=!1,h=r(c,d),$i=!1,Sr&&(h=jd(s,r,c,d)),Sd(n),h}function Sd(n){R.H=Nd;var s=yn!==null&&yn.next!==null;if(Xa=0,Zn=yn=Dt=null,No=!1,vl=0,jr=null,s)throw Error(l(300));n===null||fs||(n=n.dependencies,n!==null&&Ec(n)&&(fs=!0))}function jd(n,s,r,c){Dt=n;var d=0;do{if(Sr&&(jr=null),vl=0,Sr=!1,25<=d)throw Error(l(301));if(d+=1,Zn=yn=null,n.updateQueue!=null){var h=n.updateQueue;h.lastEffect=null,h.events=null,h.stores=null,h.memoCache!=null&&(h.memoCache.index=0)}R.H=m8,h=s(r,c)}while(Sr);return h}function vh(){var n=R.H,s=n.useState()[0];return s=typeof s.then=="function"?Nn(s):s,n=n.useState()[0],(yn!==null?yn.memoizedState:null)!==n&&(Dt.flags|=1024),s}function Ic(){var n=ko!==0;return ko=0,n}function Lc(n,s,r){s.updateQueue=n.updateQueue,s.flags&=-2053,n.lanes&=~r}function it(n){if(No){for(n=n.memoizedState;n!==null;){var s=n.queue;s!==null&&(s.pending=null),n=n.next}No=!1}Xa=0,Zn=yn=Dt=null,Sr=!1,vl=ko=0,jr=null}function Et(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Zn===null?Dt.memoizedState=Zn=n:Zn=Zn.next=n,Zn}function Ct(){if(yn===null){var n=Dt.alternate;n=n!==null?n.memoizedState:null}else n=yn.next;var s=Zn===null?Dt.memoizedState:Zn.next;if(s!==null)Zn=s,yn=n;else{if(n===null)throw Dt.alternate===null?Error(l(467)):Error(l(310));yn=n,n={memoizedState:yn.memoizedState,baseState:yn.baseState,baseQueue:yn.baseQueue,queue:yn.queue,next:null},Zn===null?Dt.memoizedState=Zn=n:Zn=Zn.next=n}return Zn}function Yt(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Nn(n){var s=vl;return vl+=1,jr===null&&(jr=[]),n=xo(jr,n,s),s=Dt,(Zn===null?s.memoizedState:Zn.next)===null&&(s=s.alternate,R.H=s===null||s.memoizedState===null?h8:Fp),n}function fa(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return Nn(n);if(n.$$typeof===I)return gs(n)}throw Error(l(438,String(n)))}function Eo(n){var s=null,r=Dt.updateQueue;if(r!==null&&(s=r.memoCache),s==null){var c=Dt.alternate;c!==null&&(c=c.updateQueue,c!==null&&(c=c.memoCache,c!=null&&(s={data:c.data.map(function(d){return d.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),r===null&&(r=Yt(),Dt.updateQueue=r),r.memoCache=s,r=s.data[s.index],r===void 0)for(r=s.data[s.index]=Array(n),c=0;c<n;c++)r[c]=Q;return s.index++,r}function Ma(n,s){return typeof s=="function"?s(n):s}function bh(n){var s=Ct();return Dp(s,yn,n)}function Dp(n,s,r){var c=n.queue;if(c===null)throw Error(l(311));c.lastRenderedReducer=r;var d=n.baseQueue,h=c.pending;if(h!==null){if(d!==null){var x=d.next;d.next=h.next,h.next=x}s.baseQueue=d=h,c.pending=null}if(h=n.baseState,d===null)n.memoizedState=h;else{s=d.next;var C=x=null,z=null,ae=s,xe=!1;do{var Ne=ae.lane&-536870913;if(Ne!==ae.lane?(en&Ne)===Ne:(Xa&Ne)===Ne){var ue=ae.revertLane;if(ue===0)z!==null&&(z=z.next={lane:0,revertLane:0,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null}),Ne===yr&&(xe=!0);else if((Xa&ue)===ue){ae=ae.next,ue===yr&&(xe=!0);continue}else Ne={lane:0,revertLane:ae.revertLane,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},z===null?(C=z=Ne,x=h):z=z.next=Ne,Dt.lanes|=ue,Sl|=ue;Ne=ae.action,$i&&r(h,Ne),h=ae.hasEagerState?ae.eagerState:r(h,Ne)}else ue={lane:Ne,revertLane:ae.revertLane,gesture:ae.gesture,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},z===null?(C=z=ue,x=h):z=z.next=ue,Dt.lanes|=Ne,Sl|=Ne;ae=ae.next}while(ae!==null&&ae!==s);if(z===null?x=h:z.next=C,!js(h,n.memoizedState)&&(fs=!0,xe&&(r=vr,r!==null)))throw r;n.memoizedState=h,n.baseState=x,n.baseQueue=z,c.lastRenderedState=h}return d===null&&(c.lanes=0),[n.memoizedState,c.dispatch]}function Op(n){var s=Ct(),r=s.queue;if(r===null)throw Error(l(311));r.lastRenderedReducer=n;var c=r.dispatch,d=r.pending,h=s.memoizedState;if(d!==null){r.pending=null;var x=d=d.next;do h=n(h,x.action),x=x.next;while(x!==d);js(h,s.memoizedState)||(fs=!0),s.memoizedState=h,s.baseQueue===null&&(s.baseState=h),r.lastRenderedState=h}return[h,c]}function D_(n,s,r){var c=Dt,d=Ct(),h=Gt;if(h){if(r===void 0)throw Error(l(407));r=r()}else r=s();var x=!js((yn||d).memoizedState,r);if(x&&(d.memoizedState=r,fs=!0),d=d.queue,Pp(L_.bind(null,c,d,n),[n]),d.getSnapshot!==s||x||Zn!==null&&Zn.memoizedState.tag&1){if(c.flags|=2048,Pc(9,{destroy:void 0},I_.bind(null,c,d,r,s),null),An===null)throw Error(l(349));h||(Xa&127)!==0||O_(c,s,r)}return r}function O_(n,s,r){n.flags|=16384,n={getSnapshot:s,value:r},s=Dt.updateQueue,s===null?(s=Yt(),Dt.updateQueue=s,s.stores=[n]):(r=s.stores,r===null?s.stores=[n]:r.push(n))}function I_(n,s,r,c){s.value=r,s.getSnapshot=c,P_(s)&&U_(n)}function L_(n,s,r){return r(function(){P_(s)&&U_(n)})}function P_(n){var s=n.getSnapshot;n=n.value;try{var r=s();return!js(n,r)}catch{return!0}}function U_(n){var s=mr(n,2);s!==null&&_a(s,n,2)}function Ip(n){var s=Et();if(typeof n=="function"){var r=n;if(n=r(),$i){Me(!0);try{r()}finally{Me(!1)}}}return s.memoizedState=s.baseState=n,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ma,lastRenderedState:n},s}function z_(n,s,r,c){return n.baseState=r,Dp(n,yn,typeof c=="function"?c:Ma)}function A5(n,s,r,c,d){if(jh(n))throw Error(l(485));if(n=s.action,n!==null){var h={payload:d,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(x){h.listeners.push(x)}};R.T!==null?r(!0):h.isTransition=!1,c(h),r=s.pending,r===null?(h.next=s.pending=h,B_(s,h)):(h.next=r.next,s.pending=r.next=h)}}function B_(n,s){var r=s.action,c=s.payload,d=n.state;if(s.isTransition){var h=R.T,x={};R.T=x;try{var C=r(d,c),z=R.S;z!==null&&z(x,C),H_(n,s,C)}catch(ae){Lp(n,s,ae)}finally{h!==null&&x.types!==null&&(h.types=x.types),R.T=h}}else try{h=r(d,c),H_(n,s,h)}catch(ae){Lp(n,s,ae)}}function H_(n,s,r){r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(function(c){$_(n,s,c)},function(c){return Lp(n,s,c)}):$_(n,s,r)}function $_(n,s,r){s.status="fulfilled",s.value=r,F_(s),n.state=r,s=n.pending,s!==null&&(r=s.next,r===s?n.pending=null:(r=r.next,s.next=r,B_(n,r)))}function Lp(n,s,r){var c=n.pending;if(n.pending=null,c!==null){c=c.next;do s.status="rejected",s.reason=r,F_(s),s=s.next;while(s!==c)}n.action=null}function F_(n){n=n.listeners;for(var s=0;s<n.length;s++)(0,n[s])()}function q_(n,s){return s}function W_(n,s){if(Gt){var r=An.formState;if(r!==null){e:{var c=Dt;if(Gt){if(Tn){t:{for(var d=Tn,h=da;d.nodeType!==8;){if(!h){d=null;break t}if(d=Ja(d.nextSibling),d===null){d=null;break t}}h=d.data,d=h==="F!"||h==="F"?d:null}if(d){Tn=Ja(d.nextSibling),c=d.data==="F!";break e}}gi(c)}c=!1}c&&(s=r[0])}}return r=Et(),r.memoizedState=r.baseState=s,c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:q_,lastRenderedState:s},r.queue=c,r=u8.bind(null,Dt,c),c.dispatch=r,c=Ip(!1),h=$p.bind(null,Dt,!1,c.queue),c=Et(),d={state:s,dispatch:null,action:n,pending:null},c.queue=d,r=A5.bind(null,Dt,d,h,r),d.dispatch=r,c.memoizedState=n,[s,r,!1]}function K_(n){var s=Ct();return Q_(s,yn,n)}function Q_(n,s,r){if(s=Dp(n,s,q_)[0],n=bh(Ma)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var c=Nn(s)}catch(x){throw x===pl?vo:x}else c=s;s=Ct();var d=s.queue,h=d.dispatch;return r!==s.memoizedState&&(Dt.flags|=2048,Pc(9,{destroy:void 0},D5.bind(null,d,r),null)),[c,h,n]}function D5(n,s){n.action=s}function G_(n){var s=Ct(),r=yn;if(r!==null)return Q_(s,r,n);Ct(),s=s.memoizedState,r=Ct();var c=r.queue.dispatch;return r.memoizedState=n,[s,c,!1]}function Pc(n,s,r,c){return n={tag:n,create:r,deps:c,inst:s,next:null},s=Dt.updateQueue,s===null&&(s=Yt(),Dt.updateQueue=s),r=s.lastEffect,r===null?s.lastEffect=n.next=n:(c=r.next,r.next=n,n.next=c,s.lastEffect=n),n}function Y_(){return Ct().memoizedState}function xh(n,s,r,c){var d=Et();Dt.flags|=n,d.memoizedState=Pc(1|s,{destroy:void 0},r,c===void 0?null:c)}function Sh(n,s,r,c){var d=Ct();c=c===void 0?null:c;var h=d.memoizedState.inst;yn!==null&&c!==null&&Dc(c,yn.memoizedState.deps)?d.memoizedState=Pc(s,h,r,c):(Dt.flags|=n,d.memoizedState=Pc(1|s,h,r,c))}function V_(n,s){xh(8390656,8,n,s)}function Pp(n,s){Sh(2048,8,n,s)}function O5(n){Dt.flags|=4;var s=Dt.updateQueue;if(s===null)s=Yt(),Dt.updateQueue=s,s.events=[n];else{var r=s.events;r===null?s.events=[n]:r.push(n)}}function Z_(n){var s=Ct().memoizedState;return O5({ref:s,nextImpl:n}),function(){if((vn&2)!==0)throw Error(l(440));return s.impl.apply(void 0,arguments)}}function X_(n,s){return Sh(4,2,n,s)}function J_(n,s){return Sh(4,4,n,s)}function e8(n,s){if(typeof s=="function"){n=n();var r=s(n);return function(){typeof r=="function"?r():s(null)}}if(s!=null)return n=n(),s.current=n,function(){s.current=null}}function t8(n,s,r){r=r!=null?r.concat([n]):null,Sh(4,4,e8.bind(null,s,n),r)}function Up(){}function n8(n,s){var r=Ct();s=s===void 0?null:s;var c=r.memoizedState;return s!==null&&Dc(s,c[1])?c[0]:(r.memoizedState=[n,s],n)}function s8(n,s){var r=Ct();s=s===void 0?null:s;var c=r.memoizedState;if(s!==null&&Dc(s,c[1]))return c[0];if(c=n(),$i){Me(!0);try{n()}finally{Me(!1)}}return r.memoizedState=[c,s],c}function zp(n,s,r){return r===void 0||(Xa&1073741824)!==0&&(en&261930)===0?n.memoizedState=s:(n.memoizedState=r,n=ay(),Dt.lanes|=n,Sl|=n,r)}function a8(n,s,r,c){return js(r,s)?r:Ve.current!==null?(n=zp(n,r,c),js(n,s)||(fs=!0),n):(Xa&42)===0||(Xa&1073741824)!==0&&(en&261930)===0?(fs=!0,n.memoizedState=r):(n=ay(),Dt.lanes|=n,Sl|=n,s)}function i8(n,s,r,c,d){var h=H.p;H.p=h!==0&&8>h?h:8;var x=R.T,C={};R.T=C,$p(n,!1,s,r);try{var z=d(),ae=R.S;if(ae!==null&&ae(C,z),z!==null&&typeof z=="object"&&typeof z.then=="function"){var xe=Ap(z,c);wd(n,s,xe,Da(n))}else wd(n,s,c,Da(n))}catch(Ne){wd(n,s,{then:function(){},status:"rejected",reason:Ne},Da())}finally{H.p=h,x!==null&&C.types!==null&&(x.types=C.types),R.T=x}}function I5(){}function Bp(n,s,r,c){if(n.tag!==5)throw Error(l(476));var d=r8(n).queue;i8(n,d,s,X,r===null?I5:function(){return l8(n),r(c)})}function r8(n){var s=n.memoizedState;if(s!==null)return s;s={memoizedState:X,baseState:X,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ma,lastRenderedState:X},next:null};var r={};return s.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ma,lastRenderedState:r},next:null},n.memoizedState=s,n=n.alternate,n!==null&&(n.memoizedState=s),s}function l8(n){var s=r8(n);s.next===null&&(s=n.alternate.memoizedState),wd(n,s.next.queue,{},Da())}function Hp(){return gs(Hd)}function o8(){return Ct().memoizedState}function c8(){return Ct().memoizedState}function L5(n){for(var s=n.return;s!==null;){switch(s.tag){case 24:case 3:var r=Da();n=bi(r);var c=xi(s,n,r);c!==null&&(_a(c,s,r),yl(c,s,r)),s={cache:md()},n.payload=s;return}s=s.return}}function P5(n,s,r){var c=Da();r={lane:c,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},jh(n)?d8(s,r):(r=id(n,s,r,c),r!==null&&(_a(r,n,c),f8(r,s,c)))}function u8(n,s,r){var c=Da();wd(n,s,r,c)}function wd(n,s,r,c){var d={lane:c,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(jh(n))d8(s,d);else{var h=n.alternate;if(n.lanes===0&&(h===null||h.lanes===0)&&(h=s.lastRenderedReducer,h!==null))try{var x=s.lastRenderedState,C=h(x,r);if(d.hasEagerState=!0,d.eagerState=C,js(C,x))return mo(n,s,d,0),An===null&&wc(),!1}catch{}finally{}if(r=id(n,s,d,c),r!==null)return _a(r,n,c),f8(r,s,c),!0}return!1}function $p(n,s,r,c){if(c={lane:2,revertLane:b1(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},jh(n)){if(s)throw Error(l(479))}else s=id(n,r,c,2),s!==null&&_a(s,n,2)}function jh(n){var s=n.alternate;return n===Dt||s!==null&&s===Dt}function d8(n,s){Sr=No=!0;var r=n.pending;r===null?s.next=s:(s.next=r.next,r.next=s),n.pending=s}function f8(n,s,r){if((r&4194048)!==0){var c=s.lanes;c&=n.pendingLanes,r|=c,s.lanes=r,Us(n,r)}}var Nd={readContext:gs,use:fa,useCallback:Hn,useContext:Hn,useEffect:Hn,useImperativeHandle:Hn,useLayoutEffect:Hn,useInsertionEffect:Hn,useMemo:Hn,useReducer:Hn,useRef:Hn,useState:Hn,useDebugValue:Hn,useDeferredValue:Hn,useTransition:Hn,useSyncExternalStore:Hn,useId:Hn,useHostTransitionStatus:Hn,useFormState:Hn,useActionState:Hn,useOptimistic:Hn,useMemoCache:Hn,useCacheRefresh:Hn};Nd.useEffectEvent=Hn;var h8={readContext:gs,use:fa,useCallback:function(n,s){return Et().memoizedState=[n,s===void 0?null:s],n},useContext:gs,useEffect:V_,useImperativeHandle:function(n,s,r){r=r!=null?r.concat([n]):null,xh(4194308,4,e8.bind(null,s,n),r)},useLayoutEffect:function(n,s){return xh(4194308,4,n,s)},useInsertionEffect:function(n,s){xh(4,2,n,s)},useMemo:function(n,s){var r=Et();s=s===void 0?null:s;var c=n();if($i){Me(!0);try{n()}finally{Me(!1)}}return r.memoizedState=[c,s],c},useReducer:function(n,s,r){var c=Et();if(r!==void 0){var d=r(s);if($i){Me(!0);try{r(s)}finally{Me(!1)}}}else d=s;return c.memoizedState=c.baseState=d,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:d},c.queue=n,n=n.dispatch=P5.bind(null,Dt,n),[c.memoizedState,n]},useRef:function(n){var s=Et();return n={current:n},s.memoizedState=n},useState:function(n){n=Ip(n);var s=n.queue,r=u8.bind(null,Dt,s);return s.dispatch=r,[n.memoizedState,r]},useDebugValue:Up,useDeferredValue:function(n,s){var r=Et();return zp(r,n,s)},useTransition:function(){var n=Ip(!1);return n=i8.bind(null,Dt,n.queue,!0,!1),Et().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,s,r){var c=Dt,d=Et();if(Gt){if(r===void 0)throw Error(l(407));r=r()}else{if(r=s(),An===null)throw Error(l(349));(en&127)!==0||O_(c,s,r)}d.memoizedState=r;var h={value:r,getSnapshot:s};return d.queue=h,V_(L_.bind(null,c,h,n),[n]),c.flags|=2048,Pc(9,{destroy:void 0},I_.bind(null,c,h,r,s),null),r},useId:function(){var n=Et(),s=An.identifierPrefix;if(Gt){var r=Ga,c=Ta;r=(c&~(1<<32-Re(c)-1)).toString(32)+r,s="_"+s+"R_"+r,r=ko++,0<r&&(s+="H"+r.toString(32)),s+="_"}else r=yh++,s="_"+s+"r_"+r.toString(32)+"_";return n.memoizedState=s},useHostTransitionStatus:Hp,useFormState:W_,useActionState:W_,useOptimistic:function(n){var s=Et();s.memoizedState=s.baseState=n;var r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=r,s=$p.bind(null,Dt,!0,r),r.dispatch=s,[n,s]},useMemoCache:Eo,useCacheRefresh:function(){return Et().memoizedState=L5.bind(null,Dt)},useEffectEvent:function(n){var s=Et(),r={impl:n};return s.memoizedState=r,function(){if((vn&2)!==0)throw Error(l(440));return r.impl.apply(void 0,arguments)}}},Fp={readContext:gs,use:fa,useCallback:n8,useContext:gs,useEffect:Pp,useImperativeHandle:t8,useInsertionEffect:X_,useLayoutEffect:J_,useMemo:s8,useReducer:bh,useRef:Y_,useState:function(){return bh(Ma)},useDebugValue:Up,useDeferredValue:function(n,s){var r=Ct();return a8(r,yn.memoizedState,n,s)},useTransition:function(){var n=bh(Ma)[0],s=Ct().memoizedState;return[typeof n=="boolean"?n:Nn(n),s]},useSyncExternalStore:D_,useId:o8,useHostTransitionStatus:Hp,useFormState:K_,useActionState:K_,useOptimistic:function(n,s){var r=Ct();return z_(r,yn,n,s)},useMemoCache:Eo,useCacheRefresh:c8};Fp.useEffectEvent=Z_;var m8={readContext:gs,use:fa,useCallback:n8,useContext:gs,useEffect:Pp,useImperativeHandle:t8,useInsertionEffect:X_,useLayoutEffect:J_,useMemo:s8,useReducer:Op,useRef:Y_,useState:function(){return Op(Ma)},useDebugValue:Up,useDeferredValue:function(n,s){var r=Ct();return yn===null?zp(r,n,s):a8(r,yn.memoizedState,n,s)},useTransition:function(){var n=Op(Ma)[0],s=Ct().memoizedState;return[typeof n=="boolean"?n:Nn(n),s]},useSyncExternalStore:D_,useId:o8,useHostTransitionStatus:Hp,useFormState:G_,useActionState:G_,useOptimistic:function(n,s){var r=Ct();return yn!==null?z_(r,yn,n,s):(r.baseState=n,[n,r.queue.dispatch])},useMemoCache:Eo,useCacheRefresh:c8};m8.useEffectEvent=Z_;function qp(n,s,r,c){s=n.memoizedState,r=r(c,s),r=r==null?s:p({},s,r),n.memoizedState=r,n.lanes===0&&(n.updateQueue.baseState=r)}var Wp={enqueueSetState:function(n,s,r){n=n._reactInternals;var c=Da(),d=bi(c);d.payload=s,r!=null&&(d.callback=r),s=xi(n,d,c),s!==null&&(_a(s,n,c),yl(s,n,c))},enqueueReplaceState:function(n,s,r){n=n._reactInternals;var c=Da(),d=bi(c);d.tag=1,d.payload=s,r!=null&&(d.callback=r),s=xi(n,d,c),s!==null&&(_a(s,n,c),yl(s,n,c))},enqueueForceUpdate:function(n,s){n=n._reactInternals;var r=Da(),c=bi(r);c.tag=2,s!=null&&(c.callback=s),s=xi(n,c,r),s!==null&&(_a(s,n,r),yl(s,n,r))}};function p8(n,s,r,c,d,h,x){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(c,h,x):s.prototype&&s.prototype.isPureReactComponent?!dr(r,c)||!dr(d,h):!0}function g8(n,s,r,c){n=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(r,c),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(r,c),s.state!==n&&Wp.enqueueReplaceState(s,s.state,null)}function Co(n,s){var r=s;if("ref"in s){r={};for(var c in s)c!=="ref"&&(r[c]=s[c])}if(n=n.defaultProps){r===s&&(r=p({},r));for(var d in n)r[d]===void 0&&(r[d]=n[d])}return r}function _8(n){jc(n)}function y8(n){console.error(n)}function v8(n){jc(n)}function wh(n,s){try{var r=n.onUncaughtError;r(s.value,{componentStack:s.stack})}catch(c){setTimeout(function(){throw c})}}function b8(n,s,r){try{var c=n.onCaughtError;c(r.value,{componentStack:r.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(d){setTimeout(function(){throw d})}}function Kp(n,s,r){return r=bi(r),r.tag=3,r.payload={element:null},r.callback=function(){wh(n,s)},r}function x8(n){return n=bi(n),n.tag=3,n}function S8(n,s,r,c){var d=r.type.getDerivedStateFromError;if(typeof d=="function"){var h=c.value;n.payload=function(){return d(h)},n.callback=function(){b8(s,r,c)}}var x=r.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(n.callback=function(){b8(s,r,c),typeof d!="function"&&(jl===null?jl=new Set([this]):jl.add(this));var C=c.stack;this.componentDidCatch(c.value,{componentStack:C!==null?C:""})})}function U5(n,s,r,c,d){if(r.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){if(s=r.alternate,s!==null&&fl(s,r,d,!0),r=Ln.current,r!==null){switch(r.tag){case 31:case 13:return Pe===null?Lh():r.alternate===null&&ts===0&&(ts=3),r.flags&=-257,r.flags|=65536,r.lanes=d,c===bo?r.flags|=16384:(s=r.updateQueue,s===null?r.updateQueue=new Set([c]):s.add(c),_1(n,c,d)),!1;case 22:return r.flags|=65536,c===bo?r.flags|=16384:(s=r.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([c])},r.updateQueue=s):(r=s.retryQueue,r===null?s.retryQueue=new Set([c]):r.add(c)),_1(n,c,d)),!1}throw Error(l(435,r.tag))}return _1(n,c,d),Lh(),!1}if(Gt)return s=Ln.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=d,c!==cd&&(n=Error(l(422),{cause:c}),_o(Ws(n,r)))):(c!==cd&&(s=Error(l(423),{cause:c}),_o(Ws(s,r))),n=n.current.alternate,n.flags|=65536,d&=-d,n.lanes|=d,c=Ws(c,r),d=Kp(n.stateNode,c,d),b(n,d),ts!==4&&(ts=2)),!1;var h=Error(l(520),{cause:c});if(h=Ws(h,r),Dd===null?Dd=[h]:Dd.push(h),ts!==4&&(ts=2),s===null)return!0;c=Ws(c,r),r=s;do{switch(r.tag){case 3:return r.flags|=65536,n=d&-d,r.lanes|=n,n=Kp(r.stateNode,c,n),b(r,n),!1;case 1:if(s=r.type,h=r.stateNode,(r.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&(jl===null||!jl.has(h))))return r.flags|=65536,d&=-d,r.lanes|=d,d=x8(d),S8(d,n,r,c),b(r,d),!1}r=r.return}while(r!==null);return!1}var Qp=Error(l(461)),fs=!1;function Is(n,s,r,c){s.child=n===null?xd(s,null,r,c):Hi(s,n.child,r,c)}function j8(n,s,r,c,d){r=r.render;var h=s.ref;if("ref"in c){var x={};for(var C in c)C!=="ref"&&(x[C]=c[C])}else x=c;return _r(s),c=Oc(n,s,r,x,h,d),C=Ic(),n!==null&&!fs?(Lc(n,s,d),wr(n,s,d)):(Gt&&C&&Va(s),s.flags|=1,Is(n,s,c,d),s.child)}function w8(n,s,r,c,d){if(n===null){var h=r.type;return typeof h=="function"&&!go(h)&&h.defaultProps===void 0&&r.compare===null?(s.tag=15,s.type=h,N8(n,s,h,c,d)):(n=Nc(r.type,null,c,s,s.mode,d),n.ref=s.ref,n.return=s,s.child=n)}if(h=n.child,!t1(n,d)){var x=h.memoizedProps;if(r=r.compare,r=r!==null?r:dr,r(x,c)&&n.ref===s.ref)return wr(n,s,d)}return s.flags|=1,n=hi(h,c),n.ref=s.ref,n.return=s,s.child=n}function N8(n,s,r,c,d){if(n!==null){var h=n.memoizedProps;if(dr(h,c)&&n.ref===s.ref)if(fs=!1,s.pendingProps=c=h,t1(n,d))(n.flags&131072)!==0&&(fs=!0);else return s.lanes=n.lanes,wr(n,s,d)}return Gp(n,s,r,c,d)}function k8(n,s,r,c){var d=c.children,h=n!==null?n.memoizedState:null;if(n===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),c.mode==="hidden"){if((s.flags&128)!==0){if(h=h!==null?h.baseLanes|r:r,n!==null){for(c=s.child=n.child,d=0;c!==null;)d=d|c.lanes|c.childLanes,c=c.sibling;c=d&~h}else c=0,s.child=null;return E8(n,s,h,r,c)}if((r&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},n!==null&&yo(s,h!==null?h.cachePool:null),h!==null?Os(s,h):dn(),an(s);else return c=s.lanes=536870912,E8(n,s,h!==null?h.baseLanes|r:r,r,c)}else h!==null?(yo(s,h.cachePool),Os(s,h),Za(),s.memoizedState=null):(n!==null&&yo(s,null),dn(),Za());return Is(n,s,d,r),s.child}function kd(n,s){return n!==null&&n.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function E8(n,s,r,c,d){var h=Mc();return h=h===null?null:{parent:Vn._currentValue,pool:h},s.memoizedState={baseLanes:r,cachePool:h},n!==null&&yo(s,null),dn(),an(s),n!==null&&fl(n,s,c,!0),s.childLanes=d,null}function Nh(n,s){return s=Eh({mode:s.mode,children:s.children},n.mode),s.ref=n.ref,n.child=s,s.return=n,s}function C8(n,s,r){return Hi(s,n.child,null,r),n=Nh(s,s.pendingProps),n.flags|=2,Ks(s),s.memoizedState=null,n}function z5(n,s,r){var c=s.pendingProps,d=(s.flags&128)!==0;if(s.flags&=-129,n===null){if(Gt){if(c.mode==="hidden")return n=Nh(s,c),s.lanes=536870912,kd(null,n);if(Ns(s),(n=Tn)?(n=By(n,da),n=n!==null&&n.data==="&"?n:null,n!==null&&(s.memoizedState={dehydrated:n,treeContext:Pi!==null?{id:Ta,overflow:Ga}:null,retryLane:536870912,hydrationErrors:null},r=Ea(n),r.return=s,s.child=r,us=s,Tn=null)):n=null,n===null)throw gi(s);return s.lanes=536870912,null}return Nh(s,c)}var h=n.memoizedState;if(h!==null){var x=h.dehydrated;if(Ns(s),d)if(s.flags&256)s.flags&=-257,s=C8(n,s,r);else if(s.memoizedState!==null)s.child=n.child,s.flags|=128,s=null;else throw Error(l(558));else if(fs||fl(n,s,r,!1),d=(r&n.childLanes)!==0,fs||d){if(c=An,c!==null&&(x=Ci(c,r),x!==0&&x!==h.retryLane))throw h.retryLane=x,mr(n,x),_a(c,n,x),Qp;Lh(),s=C8(n,s,r)}else n=h.treeContext,Tn=Ja(x.nextSibling),us=s,Gt=!0,Ui=null,da=!1,n!==null&&od(s,n),s=Nh(s,c),s.flags|=4096;return s}return n=hi(n.child,{mode:c.mode,children:c.children}),n.ref=s.ref,s.child=n,n.return=s,n}function kh(n,s){var r=s.ref;if(r===null)n!==null&&n.ref!==null&&(s.flags|=4194816);else{if(typeof r!="function"&&typeof r!="object")throw Error(l(284));(n===null||n.ref!==r)&&(s.flags|=4194816)}}function Gp(n,s,r,c,d){return _r(s),r=Oc(n,s,r,c,void 0,d),c=Ic(),n!==null&&!fs?(Lc(n,s,d),wr(n,s,d)):(Gt&&c&&Va(s),s.flags|=1,Is(n,s,r,d),s.child)}function T8(n,s,r,c,d,h){return _r(s),s.updateQueue=null,r=jd(s,c,r,d),Sd(n),c=Ic(),n!==null&&!fs?(Lc(n,s,h),wr(n,s,h)):(Gt&&c&&Va(s),s.flags|=1,Is(n,s,r,h),s.child)}function M8(n,s,r,c,d){if(_r(s),s.stateNode===null){var h=cl,x=r.contextType;typeof x=="object"&&x!==null&&(h=gs(x)),h=new r(c,h),s.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=Wp,s.stateNode=h,h._reactInternals=s,h=s.stateNode,h.props=c,h.state=s.memoizedState,h.refs={},Rc(s),x=r.contextType,h.context=typeof x=="object"&&x!==null?gs(x):cl,h.state=s.memoizedState,x=r.getDerivedStateFromProps,typeof x=="function"&&(qp(s,r,x,c),h.state=s.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(x=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),x!==h.state&&Wp.enqueueReplaceState(h,h.state,null),Se(s,c,h,d),$(),h.state=s.memoizedState),typeof h.componentDidMount=="function"&&(s.flags|=4194308),c=!0}else if(n===null){h=s.stateNode;var C=s.memoizedProps,z=Co(r,C);h.props=z;var ae=h.context,xe=r.contextType;x=cl,typeof xe=="object"&&xe!==null&&(x=gs(xe));var Ne=r.getDerivedStateFromProps;xe=typeof Ne=="function"||typeof h.getSnapshotBeforeUpdate=="function",C=s.pendingProps!==C,xe||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(C||ae!==x)&&g8(s,h,c,x),vi=!1;var ue=s.memoizedState;h.state=ue,Se(s,c,h,d),$(),ae=s.memoizedState,C||ue!==ae||vi?(typeof Ne=="function"&&(qp(s,r,Ne,c),ae=s.memoizedState),(z=vi||p8(s,r,z,c,ue,ae,x))?(xe||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount()),typeof h.componentDidMount=="function"&&(s.flags|=4194308)):(typeof h.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=c,s.memoizedState=ae),h.props=c,h.state=ae,h.context=x,c=z):(typeof h.componentDidMount=="function"&&(s.flags|=4194308),c=!1)}else{h=s.stateNode,Ac(n,s),x=s.memoizedProps,xe=Co(r,x),h.props=xe,Ne=s.pendingProps,ue=h.context,ae=r.contextType,z=cl,typeof ae=="object"&&ae!==null&&(z=gs(ae)),C=r.getDerivedStateFromProps,(ae=typeof C=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(x!==Ne||ue!==z)&&g8(s,h,c,z),vi=!1,ue=s.memoizedState,h.state=ue,Se(s,c,h,d),$();var ge=s.memoizedState;x!==Ne||ue!==ge||vi||n!==null&&n.dependencies!==null&&Ec(n.dependencies)?(typeof C=="function"&&(qp(s,r,C,c),ge=s.memoizedState),(xe=vi||p8(s,r,xe,c,ue,ge,z)||n!==null&&n.dependencies!==null&&Ec(n.dependencies))?(ae||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(c,ge,z),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(c,ge,z)),typeof h.componentDidUpdate=="function"&&(s.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof h.componentDidUpdate!="function"||x===n.memoizedProps&&ue===n.memoizedState||(s.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||x===n.memoizedProps&&ue===n.memoizedState||(s.flags|=1024),s.memoizedProps=c,s.memoizedState=ge),h.props=c,h.state=ge,h.context=z,c=xe):(typeof h.componentDidUpdate!="function"||x===n.memoizedProps&&ue===n.memoizedState||(s.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||x===n.memoizedProps&&ue===n.memoizedState||(s.flags|=1024),c=!1)}return h=c,kh(n,s),c=(s.flags&128)!==0,h||c?(h=s.stateNode,r=c&&typeof r.getDerivedStateFromError!="function"?null:h.render(),s.flags|=1,n!==null&&c?(s.child=Hi(s,n.child,null,d),s.child=Hi(s,null,r,d)):Is(n,s,r,d),s.memoizedState=h.state,n=s.child):n=wr(n,s,d),n}function R8(n,s,r,c){return pr(),s.flags|=256,Is(n,s,r,c),s.child}var Yp={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Vp(n){return{baseLanes:n,cachePool:_h()}}function Zp(n,s,r){return n=n!==null?n.childLanes&~r:0,s&&(n|=Aa),n}function A8(n,s,r){var c=s.pendingProps,d=!1,h=(s.flags&128)!==0,x;if((x=h)||(x=n!==null&&n.memoizedState===null?!1:(Qn.current&2)!==0),x&&(d=!0,s.flags&=-129),x=(s.flags&32)!==0,s.flags&=-33,n===null){if(Gt){if(d?Bn(s):Za(),(n=Tn)?(n=By(n,da),n=n!==null&&n.data!=="&"?n:null,n!==null&&(s.memoizedState={dehydrated:n,treeContext:Pi!==null?{id:Ta,overflow:Ga}:null,retryLane:536870912,hydrationErrors:null},r=Ea(n),r.return=s,s.child=r,us=s,Tn=null)):n=null,n===null)throw gi(s);return D1(n)?s.lanes=32:s.lanes=536870912,null}var C=c.children;return c=c.fallback,d?(Za(),d=s.mode,C=Eh({mode:"hidden",children:C},d),c=Qa(c,d,r,null),C.return=s,c.return=s,C.sibling=c,s.child=C,c=s.child,c.memoizedState=Vp(r),c.childLanes=Zp(n,x,r),s.memoizedState=Yp,kd(null,c)):(Bn(s),Xp(s,C))}var z=n.memoizedState;if(z!==null&&(C=z.dehydrated,C!==null)){if(h)s.flags&256?(Bn(s),s.flags&=-257,s=Jp(n,s,r)):s.memoizedState!==null?(Za(),s.child=n.child,s.flags|=128,s=null):(Za(),C=c.fallback,d=s.mode,c=Eh({mode:"visible",children:c.children},d),C=Qa(C,d,r,null),C.flags|=2,c.return=s,C.return=s,c.sibling=C,s.child=c,Hi(s,n.child,null,r),c=s.child,c.memoizedState=Vp(r),c.childLanes=Zp(n,x,r),s.memoizedState=Yp,s=kd(null,c));else if(Bn(s),D1(C)){if(x=C.nextSibling&&C.nextSibling.dataset,x)var ae=x.dgst;x=ae,c=Error(l(419)),c.stack="",c.digest=x,_o({value:c,source:null,stack:null}),s=Jp(n,s,r)}else if(fs||fl(n,s,r,!1),x=(r&n.childLanes)!==0,fs||x){if(x=An,x!==null&&(c=Ci(x,r),c!==0&&c!==z.retryLane))throw z.retryLane=c,mr(n,c),_a(x,n,c),Qp;A1(C)||Lh(),s=Jp(n,s,r)}else A1(C)?(s.flags|=192,s.child=n.child,s=null):(n=z.treeContext,Tn=Ja(C.nextSibling),us=s,Gt=!0,Ui=null,da=!1,n!==null&&od(s,n),s=Xp(s,c.children),s.flags|=4096);return s}return d?(Za(),C=c.fallback,d=s.mode,z=n.child,ae=z.sibling,c=hi(z,{mode:"hidden",children:c.children}),c.subtreeFlags=z.subtreeFlags&65011712,ae!==null?C=hi(ae,C):(C=Qa(C,d,r,null),C.flags|=2),C.return=s,c.return=s,c.sibling=C,s.child=c,kd(null,c),c=s.child,C=n.child.memoizedState,C===null?C=Vp(r):(d=C.cachePool,d!==null?(z=Vn._currentValue,d=d.parent!==z?{parent:z,pool:z}:d):d=_h(),C={baseLanes:C.baseLanes|r,cachePool:d}),c.memoizedState=C,c.childLanes=Zp(n,x,r),s.memoizedState=Yp,kd(n.child,c)):(Bn(s),r=n.child,n=r.sibling,r=hi(r,{mode:"visible",children:c.children}),r.return=s,r.sibling=null,n!==null&&(x=s.deletions,x===null?(s.deletions=[n],s.flags|=16):x.push(n)),s.child=r,s.memoizedState=null,r)}function Xp(n,s){return s=Eh({mode:"visible",children:s},n.mode),s.return=n,n.child=s}function Eh(n,s){return n=Ds(22,n,null,s),n.lanes=0,n}function Jp(n,s,r){return Hi(s,n.child,null,r),n=Xp(s,s.pendingProps.children),n.flags|=2,s.memoizedState=null,n}function D8(n,s,r){n.lanes|=s;var c=n.alternate;c!==null&&(c.lanes|=s),fd(n.return,s,r)}function e1(n,s,r,c,d,h){var x=n.memoizedState;x===null?n.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:c,tail:r,tailMode:d,treeForkCount:h}:(x.isBackwards=s,x.rendering=null,x.renderingStartTime=0,x.last=c,x.tail=r,x.tailMode=d,x.treeForkCount=h)}function O8(n,s,r){var c=s.pendingProps,d=c.revealOrder,h=c.tail;c=c.children;var x=Qn.current,C=(x&2)!==0;if(C?(x=x&1|2,s.flags|=128):x&=1,_e(Qn,x),Is(n,s,c,r),c=Gt?Ca:0,!C&&n!==null&&(n.flags&128)!==0)e:for(n=s.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&D8(n,r,s);else if(n.tag===19)D8(n,r,s);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===s)break e;for(;n.sibling===null;){if(n.return===null||n.return===s)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(d){case"forwards":for(r=s.child,d=null;r!==null;)n=r.alternate,n!==null&&wo(n)===null&&(d=r),r=r.sibling;r=d,r===null?(d=s.child,s.child=null):(d=r.sibling,r.sibling=null),e1(s,!1,d,r,h,c);break;case"backwards":case"unstable_legacy-backwards":for(r=null,d=s.child,s.child=null;d!==null;){if(n=d.alternate,n!==null&&wo(n)===null){s.child=d;break}n=d.sibling,d.sibling=r,r=d,d=n}e1(s,!0,r,null,h,c);break;case"together":e1(s,!1,null,null,void 0,c);break;default:s.memoizedState=null}return s.child}function wr(n,s,r){if(n!==null&&(s.dependencies=n.dependencies),Sl|=s.lanes,(r&s.childLanes)===0)if(n!==null){if(fl(n,s,r,!1),(r&s.childLanes)===0)return null}else return null;if(n!==null&&s.child!==n.child)throw Error(l(153));if(s.child!==null){for(n=s.child,r=hi(n,n.pendingProps),s.child=r,r.return=s;n.sibling!==null;)n=n.sibling,r=r.sibling=hi(n,n.pendingProps),r.return=s;r.sibling=null}return s.child}function t1(n,s){return(n.lanes&s)!==0?!0:(n=n.dependencies,!!(n!==null&&Ec(n)))}function B5(n,s,r){switch(s.tag){case 3:ve(s,s.stateNode.containerInfo),ea(s,Vn,n.memoizedState.cache),pr();break;case 27:case 5:Be(s);break;case 4:ve(s,s.stateNode.containerInfo);break;case 10:ea(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,Ns(s),null;break;case 13:var c=s.memoizedState;if(c!==null)return c.dehydrated!==null?(Bn(s),s.flags|=128,null):(r&s.child.childLanes)!==0?A8(n,s,r):(Bn(s),n=wr(n,s,r),n!==null?n.sibling:null);Bn(s);break;case 19:var d=(n.flags&128)!==0;if(c=(r&s.childLanes)!==0,c||(fl(n,s,r,!1),c=(r&s.childLanes)!==0),d){if(c)return O8(n,s,r);s.flags|=128}if(d=s.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),_e(Qn,Qn.current),c)break;return null;case 22:return s.lanes=0,k8(n,s,r,s.pendingProps);case 24:ea(s,Vn,n.memoizedState.cache)}return wr(n,s,r)}function I8(n,s,r){if(n!==null)if(n.memoizedProps!==s.pendingProps)fs=!0;else{if(!t1(n,r)&&(s.flags&128)===0)return fs=!1,B5(n,s,r);fs=(n.flags&131072)!==0}else fs=!1,Gt&&(s.flags&1048576)!==0&&ld(s,Ca,s.index);switch(s.lanes=0,s.tag){case 16:e:{var c=s.pendingProps;if(n=zi(s.elementType),s.type=n,typeof n=="function")go(n)?(c=Co(n,c),s.tag=1,s=M8(null,s,n,c,r)):(s.tag=0,s=Gp(null,s,n,c,r));else{if(n!=null){var d=n.$$typeof;if(d===E){s.tag=11,s=j8(null,s,n,c,r);break e}else if(d===ee){s.tag=14,s=w8(null,s,n,c,r);break e}}throw s=V(n)||n,Error(l(306,s,""))}}return s;case 0:return Gp(n,s,s.type,s.pendingProps,r);case 1:return c=s.type,d=Co(c,s.pendingProps),M8(n,s,c,d,r);case 3:e:{if(ve(s,s.stateNode.containerInfo),n===null)throw Error(l(387));c=s.pendingProps;var h=s.memoizedState;d=h.element,Ac(n,s),Se(s,c,null,r);var x=s.memoizedState;if(c=x.cache,ea(s,Vn,c),c!==h.cache&&hd(s,[Vn],r,!0),$(),c=x.element,h.isDehydrated)if(h={element:c,isDehydrated:!1,cache:x.cache},s.updateQueue.baseState=h,s.memoizedState=h,s.flags&256){s=R8(n,s,c,r);break e}else if(c!==d){d=Ws(Error(l(424)),s),_o(d),s=R8(n,s,c,r);break e}else{switch(n=s.stateNode.containerInfo,n.nodeType){case 9:n=n.body;break;default:n=n.nodeName==="HTML"?n.ownerDocument.body:n}for(Tn=Ja(n.firstChild),us=s,Gt=!0,Ui=null,da=!0,r=xd(s,null,c,r),s.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling}else{if(pr(),c===d){s=wr(n,s,r);break e}Is(n,s,c,r)}s=s.child}return s;case 26:return kh(n,s),n===null?(r=Ky(s.type,null,s.pendingProps,null))?s.memoizedState=r:Gt||(r=s.type,n=s.pendingProps,c=Fh(re.current).createElement(r),c[at]=s,c[Ut]=n,Ls(c,r,n),He(c),s.stateNode=c):s.memoizedState=Ky(s.type,n.memoizedProps,s.pendingProps,n.memoizedState),null;case 27:return Be(s),n===null&&Gt&&(c=s.stateNode=Fy(s.type,s.pendingProps,re.current),us=s,da=!0,d=Tn,El(s.type)?(O1=d,Tn=Ja(c.firstChild)):Tn=d),Is(n,s,s.pendingProps.children,r),kh(n,s),n===null&&(s.flags|=4194304),s.child;case 5:return n===null&&Gt&&((d=c=Tn)&&(c=gx(c,s.type,s.pendingProps,da),c!==null?(s.stateNode=c,us=s,Tn=Ja(c.firstChild),da=!1,d=!0):d=!1),d||gi(s)),Be(s),d=s.type,h=s.pendingProps,x=n!==null?n.memoizedProps:null,c=h.children,T1(d,h)?c=null:x!==null&&T1(d,x)&&(s.flags|=32),s.memoizedState!==null&&(d=Oc(n,s,vh,null,null,r),Hd._currentValue=d),kh(n,s),Is(n,s,c,r),s.child;case 6:return n===null&&Gt&&((n=r=Tn)&&(r=_x(r,s.pendingProps,da),r!==null?(s.stateNode=r,us=s,Tn=null,n=!0):n=!1),n||gi(s)),null;case 13:return A8(n,s,r);case 4:return ve(s,s.stateNode.containerInfo),c=s.pendingProps,n===null?s.child=Hi(s,null,c,r):Is(n,s,c,r),s.child;case 11:return j8(n,s,s.type,s.pendingProps,r);case 7:return Is(n,s,s.pendingProps,r),s.child;case 8:return Is(n,s,s.pendingProps.children,r),s.child;case 12:return Is(n,s,s.pendingProps.children,r),s.child;case 10:return c=s.pendingProps,ea(s,s.type,c.value),Is(n,s,c.children,r),s.child;case 9:return d=s.type._context,c=s.pendingProps.children,_r(s),d=gs(d),c=c(d),s.flags|=1,Is(n,s,c,r),s.child;case 14:return w8(n,s,s.type,s.pendingProps,r);case 15:return N8(n,s,s.type,s.pendingProps,r);case 19:return O8(n,s,r);case 31:return z5(n,s,r);case 22:return k8(n,s,r,s.pendingProps);case 24:return _r(s),c=gs(Vn),n===null?(d=Mc(),d===null&&(d=An,h=md(),d.pooledCache=h,h.refCount++,h!==null&&(d.pooledCacheLanes|=r),d=h),s.memoizedState={parent:c,cache:d},Rc(s),ea(s,Vn,d)):((n.lanes&r)!==0&&(Ac(n,s),Se(s,null,null,r),$()),d=n.memoizedState,h=s.memoizedState,d.parent!==c?(d={parent:c,cache:c},s.memoizedState=d,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=d),ea(s,Vn,c)):(c=h.cache,ea(s,Vn,c),c!==d.cache&&hd(s,[Vn],r,!0))),Is(n,s,s.pendingProps.children,r),s.child;case 29:throw s.pendingProps}throw Error(l(156,s.tag))}function Nr(n){n.flags|=4}function n1(n,s,r,c,d){if((s=(n.mode&32)!==0)&&(s=!1),s){if(n.flags|=16777216,(d&335544128)===d)if(n.stateNode.complete)n.flags|=8192;else if(oy())n.flags|=8192;else throw Bi=bo,gd}else n.flags&=-16777217}function L8(n,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!Zy(s))if(oy())n.flags|=8192;else throw Bi=bo,gd}function Ch(n,s){s!==null&&(n.flags|=4),n.flags&16384&&(s=n.tag!==22?De():536870912,n.lanes|=s,Hc|=s)}function Ed(n,s){if(!Gt)switch(n.tailMode){case"hidden":s=n.tail;for(var r=null;s!==null;)s.alternate!==null&&(r=s),s=s.sibling;r===null?n.tail=null:r.sibling=null;break;case"collapsed":r=n.tail;for(var c=null;r!==null;)r.alternate!==null&&(c=r),r=r.sibling;c===null?s||n.tail===null?n.tail=null:n.tail.sibling=null:c.sibling=null}}function $n(n){var s=n.alternate!==null&&n.alternate.child===n.child,r=0,c=0;if(s)for(var d=n.child;d!==null;)r|=d.lanes|d.childLanes,c|=d.subtreeFlags&65011712,c|=d.flags&65011712,d.return=n,d=d.sibling;else for(d=n.child;d!==null;)r|=d.lanes|d.childLanes,c|=d.subtreeFlags,c|=d.flags,d.return=n,d=d.sibling;return n.subtreeFlags|=c,n.childLanes=r,s}function H5(n,s,r){var c=s.pendingProps;switch(kc(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return $n(s),null;case 1:return $n(s),null;case 3:return r=s.stateNode,c=null,n!==null&&(c=n.memoizedState.cache),s.memoizedState.cache!==c&&(s.flags|=2048),yi(Vn),ze(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(n===null||n.child===null)&&(dl(s)?Nr(s):n===null||n.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,ud())),$n(s),null;case 26:var d=s.type,h=s.memoizedState;return n===null?(Nr(s),h!==null?($n(s),L8(s,h)):($n(s),n1(s,d,null,c,r))):h?h!==n.memoizedState?(Nr(s),$n(s),L8(s,h)):($n(s),s.flags&=-16777217):(n=n.memoizedProps,n!==c&&Nr(s),$n(s),n1(s,d,n,c,r)),null;case 27:if(St(s),r=re.current,d=s.type,n!==null&&s.stateNode!=null)n.memoizedProps!==c&&Nr(s);else{if(!c){if(s.stateNode===null)throw Error(l(166));return $n(s),null}n=fe.current,dl(s)?uh(s):(n=Fy(d,c,r),s.stateNode=n,Nr(s))}return $n(s),null;case 5:if(St(s),d=s.type,n!==null&&s.stateNode!=null)n.memoizedProps!==c&&Nr(s);else{if(!c){if(s.stateNode===null)throw Error(l(166));return $n(s),null}if(h=fe.current,dl(s))uh(s);else{var x=Fh(re.current);switch(h){case 1:h=x.createElementNS("http://www.w3.org/2000/svg",d);break;case 2:h=x.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;default:switch(d){case"svg":h=x.createElementNS("http://www.w3.org/2000/svg",d);break;case"math":h=x.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;case"script":h=x.createElement("div"),h.innerHTML="<script><\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof c.is=="string"?x.createElement("select",{is:c.is}):x.createElement("select"),c.multiple?h.multiple=!0:c.size&&(h.size=c.size);break;default:h=typeof c.is=="string"?x.createElement(d,{is:c.is}):x.createElement(d)}}h[at]=s,h[Ut]=c;e:for(x=s.child;x!==null;){if(x.tag===5||x.tag===6)h.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===s)break e;for(;x.sibling===null;){if(x.return===null||x.return===s)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}s.stateNode=h;e:switch(Ls(h,d,c),d){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}c&&Nr(s)}}return $n(s),n1(s,s.type,n===null?null:n.memoizedProps,s.pendingProps,r),null;case 6:if(n&&s.stateNode!=null)n.memoizedProps!==c&&Nr(s);else{if(typeof c!="string"&&s.stateNode===null)throw Error(l(166));if(n=re.current,dl(s)){if(n=s.stateNode,r=s.memoizedProps,c=null,d=us,d!==null)switch(d.tag){case 27:case 5:c=d.memoizedProps}n[at]=s,n=!!(n.nodeValue===r||c!==null&&c.suppressHydrationWarning===!0||Ay(n.nodeValue,r)),n||gi(s,!0)}else n=Fh(n).createTextNode(c),n[at]=s,s.stateNode=n}return $n(s),null;case 31:if(r=s.memoizedState,n===null||n.memoizedState!==null){if(c=dl(s),r!==null){if(n===null){if(!c)throw Error(l(318));if(n=s.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(l(557));n[at]=s}else pr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;$n(s),n=!1}else r=ud(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=r),n=!0;if(!n)return s.flags&256?(Ks(s),s):(Ks(s),null);if((s.flags&128)!==0)throw Error(l(558))}return $n(s),null;case 13:if(c=s.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(d=dl(s),c!==null&&c.dehydrated!==null){if(n===null){if(!d)throw Error(l(318));if(d=s.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(l(317));d[at]=s}else pr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;$n(s),d=!1}else d=ud(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=d),d=!0;if(!d)return s.flags&256?(Ks(s),s):(Ks(s),null)}return Ks(s),(s.flags&128)!==0?(s.lanes=r,s):(r=c!==null,n=n!==null&&n.memoizedState!==null,r&&(c=s.child,d=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(d=c.alternate.memoizedState.cachePool.pool),h=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(h=c.memoizedState.cachePool.pool),h!==d&&(c.flags|=2048)),r!==n&&r&&(s.child.flags|=8192),Ch(s,s.updateQueue),$n(s),null);case 4:return ze(),n===null&&w1(s.stateNode.containerInfo),$n(s),null;case 10:return yi(s.type),$n(s),null;case 19:if(K(Qn),c=s.memoizedState,c===null)return $n(s),null;if(d=(s.flags&128)!==0,h=c.rendering,h===null)if(d)Ed(c,!1);else{if(ts!==0||n!==null&&(n.flags&128)!==0)for(n=s.child;n!==null;){if(h=wo(n),h!==null){for(s.flags|=128,Ed(c,!1),n=h.updateQueue,s.updateQueue=n,Ch(s,n),s.subtreeFlags=0,n=r,r=s.child;r!==null;)ch(r,n),r=r.sibling;return _e(Qn,Qn.current&1|2),Gt&&Ya(s,c.treeForkCount),s.child}n=n.sibling}c.tail!==null&&ke()>Dh&&(s.flags|=128,d=!0,Ed(c,!1),s.lanes=4194304)}else{if(!d)if(n=wo(h),n!==null){if(s.flags|=128,d=!0,n=n.updateQueue,s.updateQueue=n,Ch(s,n),Ed(c,!0),c.tail===null&&c.tailMode==="hidden"&&!h.alternate&&!Gt)return $n(s),null}else 2*ke()-c.renderingStartTime>Dh&&r!==536870912&&(s.flags|=128,d=!0,Ed(c,!1),s.lanes=4194304);c.isBackwards?(h.sibling=s.child,s.child=h):(n=c.last,n!==null?n.sibling=h:s.child=h,c.last=h)}return c.tail!==null?(n=c.tail,c.rendering=n,c.tail=n.sibling,c.renderingStartTime=ke(),n.sibling=null,r=Qn.current,_e(Qn,d?r&1|2:r&1),Gt&&Ya(s,c.treeForkCount),n):($n(s),null);case 22:case 23:return Ks(s),ds(),c=s.memoizedState!==null,n!==null?n.memoizedState!==null!==c&&(s.flags|=8192):c&&(s.flags|=8192),c?(r&536870912)!==0&&(s.flags&128)===0&&($n(s),s.subtreeFlags&6&&(s.flags|=8192)):$n(s),r=s.updateQueue,r!==null&&Ch(s,r.retryQueue),r=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(r=n.memoizedState.cachePool.pool),c=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),c!==r&&(s.flags|=2048),n!==null&&K(br),null;case 24:return r=null,n!==null&&(r=n.memoizedState.cache),s.memoizedState.cache!==r&&(s.flags|=2048),yi(Vn),$n(s),null;case 25:return null;case 30:return null}throw Error(l(156,s.tag))}function $5(n,s){switch(kc(s),s.tag){case 1:return n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 3:return yi(Vn),ze(),n=s.flags,(n&65536)!==0&&(n&128)===0?(s.flags=n&-65537|128,s):null;case 26:case 27:case 5:return St(s),null;case 31:if(s.memoizedState!==null){if(Ks(s),s.alternate===null)throw Error(l(340));pr()}return n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 13:if(Ks(s),n=s.memoizedState,n!==null&&n.dehydrated!==null){if(s.alternate===null)throw Error(l(340));pr()}return n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 19:return K(Qn),null;case 4:return ze(),null;case 10:return yi(s.type),null;case 22:case 23:return Ks(s),ds(),n!==null&&K(br),n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 24:return yi(Vn),null;case 25:return null;default:return null}}function P8(n,s){switch(kc(s),s.tag){case 3:yi(Vn),ze();break;case 26:case 27:case 5:St(s);break;case 4:ze();break;case 31:s.memoizedState!==null&&Ks(s);break;case 13:Ks(s);break;case 19:K(Qn);break;case 10:yi(s.type);break;case 22:case 23:Ks(s),ds(),n!==null&&K(br);break;case 24:yi(Vn)}}function Cd(n,s){try{var r=s.updateQueue,c=r!==null?r.lastEffect:null;if(c!==null){var d=c.next;r=d;do{if((r.tag&n)===n){c=void 0;var h=r.create,x=r.inst;c=h(),x.destroy=c}r=r.next}while(r!==d)}}catch(C){En(s,s.return,C)}}function bl(n,s,r){try{var c=s.updateQueue,d=c!==null?c.lastEffect:null;if(d!==null){var h=d.next;c=h;do{if((c.tag&n)===n){var x=c.inst,C=x.destroy;if(C!==void 0){x.destroy=void 0,d=s;var z=r,ae=C;try{ae()}catch(xe){En(d,z,xe)}}}c=c.next}while(c!==h)}}catch(xe){En(s,s.return,xe)}}function U8(n){var s=n.updateQueue;if(s!==null){var r=n.stateNode;try{kt(s,r)}catch(c){En(n,n.return,c)}}}function z8(n,s,r){r.props=Co(n.type,n.memoizedProps),r.state=n.memoizedState;try{r.componentWillUnmount()}catch(c){En(n,s,c)}}function Td(n,s){try{var r=n.ref;if(r!==null){switch(n.tag){case 26:case 27:case 5:var c=n.stateNode;break;case 30:c=n.stateNode;break;default:c=n.stateNode}typeof r=="function"?n.refCleanup=r(c):r.current=c}}catch(d){En(n,s,d)}}function Fi(n,s){var r=n.ref,c=n.refCleanup;if(r!==null)if(typeof c=="function")try{c()}catch(d){En(n,s,d)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(d){En(n,s,d)}else r.current=null}function B8(n){var s=n.type,r=n.memoizedProps,c=n.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":r.autoFocus&&c.focus();break e;case"img":r.src?c.src=r.src:r.srcSet&&(c.srcset=r.srcSet)}}catch(d){En(n,n.return,d)}}function s1(n,s,r){try{var c=n.stateNode;ux(c,n.type,r,s),c[Ut]=s}catch(d){En(n,n.return,d)}}function H8(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&El(n.type)||n.tag===4}function a1(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||H8(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&El(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function i1(n,s,r){var c=n.tag;if(c===5||c===6)n=n.stateNode,s?(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r).insertBefore(n,s):(s=r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,s.appendChild(n),r=r._reactRootContainer,r!=null||s.onclick!==null||(s.onclick=Ms));else if(c!==4&&(c===27&&El(n.type)&&(r=n.stateNode,s=null),n=n.child,n!==null))for(i1(n,s,r),n=n.sibling;n!==null;)i1(n,s,r),n=n.sibling}function Th(n,s,r){var c=n.tag;if(c===5||c===6)n=n.stateNode,s?r.insertBefore(n,s):r.appendChild(n);else if(c!==4&&(c===27&&El(n.type)&&(r=n.stateNode),n=n.child,n!==null))for(Th(n,s,r),n=n.sibling;n!==null;)Th(n,s,r),n=n.sibling}function $8(n){var s=n.stateNode,r=n.memoizedProps;try{for(var c=n.type,d=s.attributes;d.length;)s.removeAttributeNode(d[0]);Ls(s,c,r),s[at]=n,s[Ut]=r}catch(h){En(n,n.return,h)}}var kr=!1,hs=!1,r1=!1,F8=typeof WeakSet=="function"?WeakSet:Set,ks=null;function F5(n,s){if(n=n.containerInfo,E1=Vh,n=nh(n),bc(n)){if("selectionStart"in n)var r={start:n.selectionStart,end:n.selectionEnd};else e:{r=(r=n.ownerDocument)&&r.defaultView||window;var c=r.getSelection&&r.getSelection();if(c&&c.rangeCount!==0){r=c.anchorNode;var d=c.anchorOffset,h=c.focusNode;c=c.focusOffset;try{r.nodeType,h.nodeType}catch{r=null;break e}var x=0,C=-1,z=-1,ae=0,xe=0,Ne=n,ue=null;t:for(;;){for(var ge;Ne!==r||d!==0&&Ne.nodeType!==3||(C=x+d),Ne!==h||c!==0&&Ne.nodeType!==3||(z=x+c),Ne.nodeType===3&&(x+=Ne.nodeValue.length),(ge=Ne.firstChild)!==null;)ue=Ne,Ne=ge;for(;;){if(Ne===n)break t;if(ue===r&&++ae===d&&(C=x),ue===h&&++xe===c&&(z=x),(ge=Ne.nextSibling)!==null)break;Ne=ue,ue=Ne.parentNode}Ne=ge}r=C===-1||z===-1?null:{start:C,end:z}}else r=null}r=r||{start:0,end:0}}else r=null;for(C1={focusedElem:n,selectionRange:r},Vh=!1,ks=s;ks!==null;)if(s=ks,n=s.child,(s.subtreeFlags&1028)!==0&&n!==null)n.return=s,ks=n;else for(;ks!==null;){switch(s=ks,h=s.alternate,n=s.flags,s.tag){case 0:if((n&4)!==0&&(n=s.updateQueue,n=n!==null?n.events:null,n!==null))for(r=0;r<n.length;r++)d=n[r],d.ref.impl=d.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&h!==null){n=void 0,r=s,d=h.memoizedProps,h=h.memoizedState,c=r.stateNode;try{var nt=Co(r.type,d);n=c.getSnapshotBeforeUpdate(nt,h),c.__reactInternalSnapshotBeforeUpdate=n}catch(wt){En(r,r.return,wt)}}break;case 3:if((n&1024)!==0){if(n=s.stateNode.containerInfo,r=n.nodeType,r===9)R1(n);else if(r===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":R1(n);break;default:n.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((n&1024)!==0)throw Error(l(163))}if(n=s.sibling,n!==null){n.return=s.return,ks=n;break}ks=s.return}}function q8(n,s,r){var c=r.flags;switch(r.tag){case 0:case 11:case 15:Cr(n,r),c&4&&Cd(5,r);break;case 1:if(Cr(n,r),c&4)if(n=r.stateNode,s===null)try{n.componentDidMount()}catch(x){En(r,r.return,x)}else{var d=Co(r.type,s.memoizedProps);s=s.memoizedState;try{n.componentDidUpdate(d,s,n.__reactInternalSnapshotBeforeUpdate)}catch(x){En(r,r.return,x)}}c&64&&U8(r),c&512&&Td(r,r.return);break;case 3:if(Cr(n,r),c&64&&(n=r.updateQueue,n!==null)){if(s=null,r.child!==null)switch(r.child.tag){case 27:case 5:s=r.child.stateNode;break;case 1:s=r.child.stateNode}try{kt(n,s)}catch(x){En(r,r.return,x)}}break;case 27:s===null&&c&4&&$8(r);case 26:case 5:Cr(n,r),s===null&&c&4&&B8(r),c&512&&Td(r,r.return);break;case 12:Cr(n,r);break;case 31:Cr(n,r),c&4&&Q8(n,r);break;case 13:Cr(n,r),c&4&&G8(n,r),c&64&&(n=r.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(r=X5.bind(null,r),yx(n,r))));break;case 22:if(c=r.memoizedState!==null||kr,!c){s=s!==null&&s.memoizedState!==null||hs,d=kr;var h=hs;kr=c,(hs=s)&&!h?Tr(n,r,(r.subtreeFlags&8772)!==0):Cr(n,r),kr=d,hs=h}break;case 30:break;default:Cr(n,r)}}function W8(n){var s=n.alternate;s!==null&&(n.alternate=null,W8(s)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(s=n.stateNode,s!==null&&bs(s)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}var Gn=null,ha=!1;function Er(n,s,r){for(r=r.child;r!==null;)K8(n,s,r),r=r.sibling}function K8(n,s,r){if(ce&&typeof ce.onCommitFiberUnmount=="function")try{ce.onCommitFiberUnmount(At,r)}catch{}switch(r.tag){case 26:hs||Fi(r,s),Er(n,s,r),r.memoizedState?r.memoizedState.count--:r.stateNode&&(r=r.stateNode,r.parentNode.removeChild(r));break;case 27:hs||Fi(r,s);var c=Gn,d=ha;El(r.type)&&(Gn=r.stateNode,ha=!1),Er(n,s,r),Ud(r.stateNode),Gn=c,ha=d;break;case 5:hs||Fi(r,s);case 6:if(c=Gn,d=ha,Gn=null,Er(n,s,r),Gn=c,ha=d,Gn!==null)if(ha)try{(Gn.nodeType===9?Gn.body:Gn.nodeName==="HTML"?Gn.ownerDocument.body:Gn).removeChild(r.stateNode)}catch(h){En(r,s,h)}else try{Gn.removeChild(r.stateNode)}catch(h){En(r,s,h)}break;case 18:Gn!==null&&(ha?(n=Gn,Uy(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,r.stateNode),Yc(n)):Uy(Gn,r.stateNode));break;case 4:c=Gn,d=ha,Gn=r.stateNode.containerInfo,ha=!0,Er(n,s,r),Gn=c,ha=d;break;case 0:case 11:case 14:case 15:bl(2,r,s),hs||bl(4,r,s),Er(n,s,r);break;case 1:hs||(Fi(r,s),c=r.stateNode,typeof c.componentWillUnmount=="function"&&z8(r,s,c)),Er(n,s,r);break;case 21:Er(n,s,r);break;case 22:hs=(c=hs)||r.memoizedState!==null,Er(n,s,r),hs=c;break;default:Er(n,s,r)}}function Q8(n,s){if(s.memoizedState===null&&(n=s.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{Yc(n)}catch(r){En(s,s.return,r)}}}function G8(n,s){if(s.memoizedState===null&&(n=s.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{Yc(n)}catch(r){En(s,s.return,r)}}function q5(n){switch(n.tag){case 31:case 13:case 19:var s=n.stateNode;return s===null&&(s=n.stateNode=new F8),s;case 22:return n=n.stateNode,s=n._retryCache,s===null&&(s=n._retryCache=new F8),s;default:throw Error(l(435,n.tag))}}function Mh(n,s){var r=q5(n);s.forEach(function(c){if(!r.has(c)){r.add(c);var d=J5.bind(null,n,c);c.then(d,d)}})}function ma(n,s){var r=s.deletions;if(r!==null)for(var c=0;c<r.length;c++){var d=r[c],h=n,x=s,C=x;e:for(;C!==null;){switch(C.tag){case 27:if(El(C.type)){Gn=C.stateNode,ha=!1;break e}break;case 5:Gn=C.stateNode,ha=!1;break e;case 3:case 4:Gn=C.stateNode.containerInfo,ha=!0;break e}C=C.return}if(Gn===null)throw Error(l(160));K8(h,x,d),Gn=null,ha=!1,h=d.alternate,h!==null&&(h.return=null),d.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)Y8(s,n),s=s.sibling}var Si=null;function Y8(n,s){var r=n.alternate,c=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:ma(s,n),pa(n),c&4&&(bl(3,n,n.return),Cd(3,n),bl(5,n,n.return));break;case 1:ma(s,n),pa(n),c&512&&(hs||r===null||Fi(r,r.return)),c&64&&kr&&(n=n.updateQueue,n!==null&&(c=n.callbacks,c!==null&&(r=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=r===null?c:r.concat(c))));break;case 26:var d=Si;if(ma(s,n),pa(n),c&512&&(hs||r===null||Fi(r,r.return)),c&4){var h=r!==null?r.memoizedState:null;if(c=n.memoizedState,r===null)if(c===null)if(n.stateNode===null){e:{c=n.type,r=n.memoizedProps,d=d.ownerDocument||d;t:switch(c){case"title":h=d.getElementsByTagName("title")[0],(!h||h[Kt]||h[at]||h.namespaceURI==="http://www.w3.org/2000/svg"||h.hasAttribute("itemprop"))&&(h=d.createElement(c),d.head.insertBefore(h,d.querySelector("head > title"))),Ls(h,c,r),h[at]=n,He(h),c=h;break e;case"link":var x=Yy("link","href",d).get(c+(r.href||""));if(x){for(var C=0;C<x.length;C++)if(h=x[C],h.getAttribute("href")===(r.href==null||r.href===""?null:r.href)&&h.getAttribute("rel")===(r.rel==null?null:r.rel)&&h.getAttribute("title")===(r.title==null?null:r.title)&&h.getAttribute("crossorigin")===(r.crossOrigin==null?null:r.crossOrigin)){x.splice(C,1);break t}}h=d.createElement(c),Ls(h,c,r),d.head.appendChild(h);break;case"meta":if(x=Yy("meta","content",d).get(c+(r.content||""))){for(C=0;C<x.length;C++)if(h=x[C],h.getAttribute("content")===(r.content==null?null:""+r.content)&&h.getAttribute("name")===(r.name==null?null:r.name)&&h.getAttribute("property")===(r.property==null?null:r.property)&&h.getAttribute("http-equiv")===(r.httpEquiv==null?null:r.httpEquiv)&&h.getAttribute("charset")===(r.charSet==null?null:r.charSet)){x.splice(C,1);break t}}h=d.createElement(c),Ls(h,c,r),d.head.appendChild(h);break;default:throw Error(l(468,c))}h[at]=n,He(h),c=h}n.stateNode=c}else Vy(d,n.type,n.stateNode);else n.stateNode=Gy(d,c,n.memoizedProps);else h!==c?(h===null?r.stateNode!==null&&(r=r.stateNode,r.parentNode.removeChild(r)):h.count--,c===null?Vy(d,n.type,n.stateNode):Gy(d,c,n.memoizedProps)):c===null&&n.stateNode!==null&&s1(n,n.memoizedProps,r.memoizedProps)}break;case 27:ma(s,n),pa(n),c&512&&(hs||r===null||Fi(r,r.return)),r!==null&&c&4&&s1(n,n.memoizedProps,r.memoizedProps);break;case 5:if(ma(s,n),pa(n),c&512&&(hs||r===null||Fi(r,r.return)),n.flags&32){d=n.stateNode;try{$s(d,"")}catch(nt){En(n,n.return,nt)}}c&4&&n.stateNode!=null&&(d=n.memoizedProps,s1(n,d,r!==null?r.memoizedProps:d)),c&1024&&(r1=!0);break;case 6:if(ma(s,n),pa(n),c&4){if(n.stateNode===null)throw Error(l(162));c=n.memoizedProps,r=n.stateNode;try{r.nodeValue=c}catch(nt){En(n,n.return,nt)}}break;case 3:if(Kh=null,d=Si,Si=qh(s.containerInfo),ma(s,n),Si=d,pa(n),c&4&&r!==null&&r.memoizedState.isDehydrated)try{Yc(s.containerInfo)}catch(nt){En(n,n.return,nt)}r1&&(r1=!1,V8(n));break;case 4:c=Si,Si=qh(n.stateNode.containerInfo),ma(s,n),pa(n),Si=c;break;case 12:ma(s,n),pa(n);break;case 31:ma(s,n),pa(n),c&4&&(c=n.updateQueue,c!==null&&(n.updateQueue=null,Mh(n,c)));break;case 13:ma(s,n),pa(n),n.child.flags&8192&&n.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(Ah=ke()),c&4&&(c=n.updateQueue,c!==null&&(n.updateQueue=null,Mh(n,c)));break;case 22:d=n.memoizedState!==null;var z=r!==null&&r.memoizedState!==null,ae=kr,xe=hs;if(kr=ae||d,hs=xe||z,ma(s,n),hs=xe,kr=ae,pa(n),c&8192)e:for(s=n.stateNode,s._visibility=d?s._visibility&-2:s._visibility|1,d&&(r===null||z||kr||hs||To(n)),r=null,s=n;;){if(s.tag===5||s.tag===26){if(r===null){z=r=s;try{if(h=z.stateNode,d)x=h.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{C=z.stateNode;var Ne=z.memoizedProps.style,ue=Ne!=null&&Ne.hasOwnProperty("display")?Ne.display:null;C.style.display=ue==null||typeof ue=="boolean"?"":(""+ue).trim()}}catch(nt){En(z,z.return,nt)}}}else if(s.tag===6){if(r===null){z=s;try{z.stateNode.nodeValue=d?"":z.memoizedProps}catch(nt){En(z,z.return,nt)}}}else if(s.tag===18){if(r===null){z=s;try{var ge=z.stateNode;d?zy(ge,!0):zy(z.stateNode,!1)}catch(nt){En(z,z.return,nt)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===n)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===n)break e;for(;s.sibling===null;){if(s.return===null||s.return===n)break e;r===s&&(r=null),s=s.return}r===s&&(r=null),s.sibling.return=s.return,s=s.sibling}c&4&&(c=n.updateQueue,c!==null&&(r=c.retryQueue,r!==null&&(c.retryQueue=null,Mh(n,r))));break;case 19:ma(s,n),pa(n),c&4&&(c=n.updateQueue,c!==null&&(n.updateQueue=null,Mh(n,c)));break;case 30:break;case 21:break;default:ma(s,n),pa(n)}}function pa(n){var s=n.flags;if(s&2){try{for(var r,c=n.return;c!==null;){if(H8(c)){r=c;break}c=c.return}if(r==null)throw Error(l(160));switch(r.tag){case 27:var d=r.stateNode,h=a1(n);Th(n,h,d);break;case 5:var x=r.stateNode;r.flags&32&&($s(x,""),r.flags&=-33);var C=a1(n);Th(n,C,x);break;case 3:case 4:var z=r.stateNode.containerInfo,ae=a1(n);i1(n,ae,z);break;default:throw Error(l(161))}}catch(xe){En(n,n.return,xe)}n.flags&=-3}s&4096&&(n.flags&=-4097)}function V8(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var s=n;V8(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),n=n.sibling}}function Cr(n,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)q8(n,s.alternate,s),s=s.sibling}function To(n){for(n=n.child;n!==null;){var s=n;switch(s.tag){case 0:case 11:case 14:case 15:bl(4,s,s.return),To(s);break;case 1:Fi(s,s.return);var r=s.stateNode;typeof r.componentWillUnmount=="function"&&z8(s,s.return,r),To(s);break;case 27:Ud(s.stateNode);case 26:case 5:Fi(s,s.return),To(s);break;case 22:s.memoizedState===null&&To(s);break;case 30:To(s);break;default:To(s)}n=n.sibling}}function Tr(n,s,r){for(r=r&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var c=s.alternate,d=n,h=s,x=h.flags;switch(h.tag){case 0:case 11:case 15:Tr(d,h,r),Cd(4,h);break;case 1:if(Tr(d,h,r),c=h,d=c.stateNode,typeof d.componentDidMount=="function")try{d.componentDidMount()}catch(ae){En(c,c.return,ae)}if(c=h,d=c.updateQueue,d!==null){var C=c.stateNode;try{var z=d.shared.hiddenCallbacks;if(z!==null)for(d.shared.hiddenCallbacks=null,d=0;d<z.length;d++)Fe(z[d],C)}catch(ae){En(c,c.return,ae)}}r&&x&64&&U8(h),Td(h,h.return);break;case 27:$8(h);case 26:case 5:Tr(d,h,r),r&&c===null&&x&4&&B8(h),Td(h,h.return);break;case 12:Tr(d,h,r);break;case 31:Tr(d,h,r),r&&x&4&&Q8(d,h);break;case 13:Tr(d,h,r),r&&x&4&&G8(d,h);break;case 22:h.memoizedState===null&&Tr(d,h,r),Td(h,h.return);break;case 30:break;default:Tr(d,h,r)}s=s.sibling}}function l1(n,s){var r=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(r=n.memoizedState.cachePool.pool),n=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(n=s.memoizedState.cachePool.pool),n!==r&&(n!=null&&n.refCount++,r!=null&&hl(r))}function o1(n,s){n=null,s.alternate!==null&&(n=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==n&&(s.refCount++,n!=null&&hl(n))}function ji(n,s,r,c){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)Z8(n,s,r,c),s=s.sibling}function Z8(n,s,r,c){var d=s.flags;switch(s.tag){case 0:case 11:case 15:ji(n,s,r,c),d&2048&&Cd(9,s);break;case 1:ji(n,s,r,c);break;case 3:ji(n,s,r,c),d&2048&&(n=null,s.alternate!==null&&(n=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==n&&(s.refCount++,n!=null&&hl(n)));break;case 12:if(d&2048){ji(n,s,r,c),n=s.stateNode;try{var h=s.memoizedProps,x=h.id,C=h.onPostCommit;typeof C=="function"&&C(x,s.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(z){En(s,s.return,z)}}else ji(n,s,r,c);break;case 31:ji(n,s,r,c);break;case 13:ji(n,s,r,c);break;case 23:break;case 22:h=s.stateNode,x=s.alternate,s.memoizedState!==null?h._visibility&2?ji(n,s,r,c):Md(n,s):h._visibility&2?ji(n,s,r,c):(h._visibility|=2,Uc(n,s,r,c,(s.subtreeFlags&10256)!==0||!1)),d&2048&&l1(x,s);break;case 24:ji(n,s,r,c),d&2048&&o1(s.alternate,s);break;default:ji(n,s,r,c)}}function Uc(n,s,r,c,d){for(d=d&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var h=n,x=s,C=r,z=c,ae=x.flags;switch(x.tag){case 0:case 11:case 15:Uc(h,x,C,z,d),Cd(8,x);break;case 23:break;case 22:var xe=x.stateNode;x.memoizedState!==null?xe._visibility&2?Uc(h,x,C,z,d):Md(h,x):(xe._visibility|=2,Uc(h,x,C,z,d)),d&&ae&2048&&l1(x.alternate,x);break;case 24:Uc(h,x,C,z,d),d&&ae&2048&&o1(x.alternate,x);break;default:Uc(h,x,C,z,d)}s=s.sibling}}function Md(n,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var r=n,c=s,d=c.flags;switch(c.tag){case 22:Md(r,c),d&2048&&l1(c.alternate,c);break;case 24:Md(r,c),d&2048&&o1(c.alternate,c);break;default:Md(r,c)}s=s.sibling}}var Rd=8192;function zc(n,s,r){if(n.subtreeFlags&Rd)for(n=n.child;n!==null;)X8(n,s,r),n=n.sibling}function X8(n,s,r){switch(n.tag){case 26:zc(n,s,r),n.flags&Rd&&n.memoizedState!==null&&Mx(r,Si,n.memoizedState,n.memoizedProps);break;case 5:zc(n,s,r);break;case 3:case 4:var c=Si;Si=qh(n.stateNode.containerInfo),zc(n,s,r),Si=c;break;case 22:n.memoizedState===null&&(c=n.alternate,c!==null&&c.memoizedState!==null?(c=Rd,Rd=16777216,zc(n,s,r),Rd=c):zc(n,s,r));break;default:zc(n,s,r)}}function J8(n){var s=n.alternate;if(s!==null&&(n=s.child,n!==null)){s.child=null;do s=n.sibling,n.sibling=null,n=s;while(n!==null)}}function Ad(n){var s=n.deletions;if((n.flags&16)!==0){if(s!==null)for(var r=0;r<s.length;r++){var c=s[r];ks=c,ty(c,n)}J8(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)ey(n),n=n.sibling}function ey(n){switch(n.tag){case 0:case 11:case 15:Ad(n),n.flags&2048&&bl(9,n,n.return);break;case 3:Ad(n);break;case 12:Ad(n);break;case 22:var s=n.stateNode;n.memoizedState!==null&&s._visibility&2&&(n.return===null||n.return.tag!==13)?(s._visibility&=-3,Rh(n)):Ad(n);break;default:Ad(n)}}function Rh(n){var s=n.deletions;if((n.flags&16)!==0){if(s!==null)for(var r=0;r<s.length;r++){var c=s[r];ks=c,ty(c,n)}J8(n)}for(n=n.child;n!==null;){switch(s=n,s.tag){case 0:case 11:case 15:bl(8,s,s.return),Rh(s);break;case 22:r=s.stateNode,r._visibility&2&&(r._visibility&=-3,Rh(s));break;default:Rh(s)}n=n.sibling}}function ty(n,s){for(;ks!==null;){var r=ks;switch(r.tag){case 0:case 11:case 15:bl(8,r,s);break;case 23:case 22:if(r.memoizedState!==null&&r.memoizedState.cachePool!==null){var c=r.memoizedState.cachePool.pool;c!=null&&c.refCount++}break;case 24:hl(r.memoizedState.cache)}if(c=r.child,c!==null)c.return=r,ks=c;else e:for(r=n;ks!==null;){c=ks;var d=c.sibling,h=c.return;if(W8(c),c===r){ks=null;break e}if(d!==null){d.return=h,ks=d;break e}ks=h}}}var W5={getCacheForType:function(n){var s=gs(Vn),r=s.data.get(n);return r===void 0&&(r=n(),s.data.set(n,r)),r},cacheSignal:function(){return gs(Vn).controller.signal}},K5=typeof WeakMap=="function"?WeakMap:Map,vn=0,An=null,Vt=null,en=0,kn=0,Ra=null,xl=!1,Bc=!1,c1=!1,Mr=0,ts=0,Sl=0,Mo=0,u1=0,Aa=0,Hc=0,Dd=null,ga=null,d1=!1,Ah=0,ny=0,Dh=1/0,Oh=null,jl=null,_s=0,wl=null,$c=null,Rr=0,f1=0,h1=null,sy=null,Od=0,m1=null;function Da(){return(vn&2)!==0&&en!==0?en&-en:R.T!==null?b1():te()}function ay(){if(Aa===0)if((en&536870912)===0||Gt){var n=Wt;Wt<<=1,(Wt&3932160)===0&&(Wt=262144),Aa=n}else Aa=536870912;return n=Ln.current,n!==null&&(n.flags|=32),Aa}function _a(n,s,r){(n===An&&(kn===2||kn===9)||n.cancelPendingCommit!==null)&&(Fc(n,0),Nl(n,en,Aa,!1)),On(n,r),((vn&2)===0||n!==An)&&(n===An&&((vn&2)===0&&(Mo|=r),ts===4&&Nl(n,en,Aa,!1)),qi(n))}function iy(n,s,r){if((vn&6)!==0)throw Error(l(327));var c=!r&&(s&127)===0&&(s&n.expiredLanes)===0||Cn(n,s),d=c?Y5(n,s):g1(n,s,!0),h=c;do{if(d===0){Bc&&!c&&Nl(n,s,0,!1);break}else{if(r=n.current.alternate,h&&!Q5(r)){d=g1(n,s,!1),h=!1;continue}if(d===2){if(h=s,n.errorRecoveryDisabledLanes&h)var x=0;else x=n.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){s=x;e:{var C=n;d=Dd;var z=C.current.memoizedState.isDehydrated;if(z&&(Fc(C,x).flags|=256),x=g1(C,x,!1),x!==2){if(c1&&!z){C.errorRecoveryDisabledLanes|=h,Mo|=h,d=4;break e}h=ga,ga=d,h!==null&&(ga===null?ga=h:ga.push.apply(ga,h))}d=x}if(h=!1,d!==2)continue}}if(d===1){Fc(n,0),Nl(n,s,0,!0);break}e:{switch(c=n,h=d,h){case 0:case 1:throw Error(l(345));case 4:if((s&4194048)!==s)break;case 6:Nl(c,s,Aa,!xl);break e;case 2:ga=null;break;case 3:case 5:break;default:throw Error(l(329))}if((s&62914560)===s&&(d=Ah+300-ke(),10<d)){if(Nl(c,s,Aa,!xl),Un(c,0,!0)!==0)break e;Rr=s,c.timeoutHandle=Ly(ry.bind(null,c,r,ga,Oh,d1,s,Aa,Mo,Hc,xl,h,"Throttled",-0,0),d);break e}ry(c,r,ga,Oh,d1,s,Aa,Mo,Hc,xl,h,null,-0,0)}}break}while(!0);qi(n)}function ry(n,s,r,c,d,h,x,C,z,ae,xe,Ne,ue,ge){if(n.timeoutHandle=-1,Ne=s.subtreeFlags,Ne&8192||(Ne&16785408)===16785408){Ne={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ms},X8(s,h,Ne);var nt=(h&62914560)===h?Ah-ke():(h&4194048)===h?ny-ke():0;if(nt=Rx(Ne,nt),nt!==null){Rr=h,n.cancelPendingCommit=nt(my.bind(null,n,s,h,r,c,d,x,C,z,xe,Ne,null,ue,ge)),Nl(n,h,x,!ae);return}}my(n,s,h,r,c,d,x,C,z)}function Q5(n){for(var s=n;;){var r=s.tag;if((r===0||r===11||r===15)&&s.flags&16384&&(r=s.updateQueue,r!==null&&(r=r.stores,r!==null)))for(var c=0;c<r.length;c++){var d=r[c],h=d.getSnapshot;d=d.value;try{if(!js(h(),d))return!1}catch{return!1}}if(r=s.child,s.subtreeFlags&16384&&r!==null)r.return=s,s=r;else{if(s===n)break;for(;s.sibling===null;){if(s.return===null||s.return===n)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function Nl(n,s,r,c){s&=~u1,s&=~Mo,n.suspendedLanes|=s,n.pingedLanes&=~s,c&&(n.warmLanes|=s),c=n.expirationTimes;for(var d=s;0<d;){var h=31-Re(d),x=1<<h;c[h]=-1,d&=~x}r!==0&&Ua(n,r,s)}function Ih(){return(vn&6)===0?(Id(0),!1):!0}function p1(){if(Vt!==null){if(kn===0)var n=Vt.return;else n=Vt,_i=gr=null,it(n),xr=null,gl=0,n=Vt;for(;n!==null;)P8(n.alternate,n),n=n.return;Vt=null}}function Fc(n,s){var r=n.timeoutHandle;r!==-1&&(n.timeoutHandle=-1,hx(r)),r=n.cancelPendingCommit,r!==null&&(n.cancelPendingCommit=null,r()),Rr=0,p1(),An=n,Vt=r=hi(n.current,null),en=s,kn=0,Ra=null,xl=!1,Bc=Cn(n,s),c1=!1,Hc=Aa=u1=Mo=Sl=ts=0,ga=Dd=null,d1=!1,(s&8)!==0&&(s|=s&32);var c=n.entangledLanes;if(c!==0)for(n=n.entanglements,c&=s;0<c;){var d=31-Re(c),h=1<<d;s|=n[d],c&=~h}return Mr=s,wc(),r}function ly(n,s){Dt=null,R.H=Nd,s===pl||s===vo?(s=yd(),kn=3):s===gd?(s=yd(),kn=4):kn=s===Qp?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,Ra=s,Vt===null&&(ts=1,wh(n,Ws(s,n.current)))}function oy(){var n=Ln.current;return n===null?!0:(en&4194048)===en?Pe===null:(en&62914560)===en||(en&536870912)!==0?n===Pe:!1}function cy(){var n=R.H;return R.H=Nd,n===null?Nd:n}function uy(){var n=R.A;return R.A=W5,n}function Lh(){ts=4,xl||(en&4194048)!==en&&Ln.current!==null||(Bc=!0),(Sl&134217727)===0&&(Mo&134217727)===0||An===null||Nl(An,en,Aa,!1)}function g1(n,s,r){var c=vn;vn|=2;var d=cy(),h=uy();(An!==n||en!==s)&&(Oh=null,Fc(n,s)),s=!1;var x=ts;e:do try{if(kn!==0&&Vt!==null){var C=Vt,z=Ra;switch(kn){case 8:p1(),x=6;break e;case 3:case 2:case 9:case 6:Ln.current===null&&(s=!0);var ae=kn;if(kn=0,Ra=null,qc(n,C,z,ae),r&&Bc){x=0;break e}break;default:ae=kn,kn=0,Ra=null,qc(n,C,z,ae)}}G5(),x=ts;break}catch(xe){ly(n,xe)}while(!0);return s&&n.shellSuspendCounter++,_i=gr=null,vn=c,R.H=d,R.A=h,Vt===null&&(An=null,en=0,wc()),x}function G5(){for(;Vt!==null;)dy(Vt)}function Y5(n,s){var r=vn;vn|=2;var c=cy(),d=uy();An!==n||en!==s?(Oh=null,Dh=ke()+500,Fc(n,s)):Bc=Cn(n,s);e:do try{if(kn!==0&&Vt!==null){s=Vt;var h=Ra;t:switch(kn){case 1:kn=0,Ra=null,qc(n,s,h,1);break;case 2:case 9:if(_d(h)){kn=0,Ra=null,fy(s);break}s=function(){kn!==2&&kn!==9||An!==n||(kn=7),qi(n)},h.then(s,s);break e;case 3:kn=7;break e;case 4:kn=5;break e;case 7:_d(h)?(kn=0,Ra=null,fy(s)):(kn=0,Ra=null,qc(n,s,h,7));break;case 5:var x=null;switch(Vt.tag){case 26:x=Vt.memoizedState;case 5:case 27:var C=Vt;if(x?Zy(x):C.stateNode.complete){kn=0,Ra=null;var z=C.sibling;if(z!==null)Vt=z;else{var ae=C.return;ae!==null?(Vt=ae,Ph(ae)):Vt=null}break t}}kn=0,Ra=null,qc(n,s,h,5);break;case 6:kn=0,Ra=null,qc(n,s,h,6);break;case 8:p1(),ts=6;break e;default:throw Error(l(462))}}V5();break}catch(xe){ly(n,xe)}while(!0);return _i=gr=null,R.H=c,R.A=d,vn=r,Vt!==null?0:(An=null,en=0,wc(),ts)}function V5(){for(;Vt!==null&&!cn();)dy(Vt)}function dy(n){var s=I8(n.alternate,n,Mr);n.memoizedProps=n.pendingProps,s===null?Ph(n):Vt=s}function fy(n){var s=n,r=s.alternate;switch(s.tag){case 15:case 0:s=T8(r,s,s.pendingProps,s.type,void 0,en);break;case 11:s=T8(r,s,s.pendingProps,s.type.render,s.ref,en);break;case 5:it(s);default:P8(r,s),s=Vt=ch(s,Mr),s=I8(r,s,Mr)}n.memoizedProps=n.pendingProps,s===null?Ph(n):Vt=s}function qc(n,s,r,c){_i=gr=null,it(s),xr=null,gl=0;var d=s.return;try{if(U5(n,d,s,r,en)){ts=1,wh(n,Ws(r,n.current)),Vt=null;return}}catch(h){if(d!==null)throw Vt=d,h;ts=1,wh(n,Ws(r,n.current)),Vt=null;return}s.flags&32768?(Gt||c===1?n=!0:Bc||(en&536870912)!==0?n=!1:(xl=n=!0,(c===2||c===9||c===3||c===6)&&(c=Ln.current,c!==null&&c.tag===13&&(c.flags|=16384))),hy(s,n)):Ph(s)}function Ph(n){var s=n;do{if((s.flags&32768)!==0){hy(s,xl);return}n=s.return;var r=H5(s.alternate,s,Mr);if(r!==null){Vt=r;return}if(s=s.sibling,s!==null){Vt=s;return}Vt=s=n}while(s!==null);ts===0&&(ts=5)}function hy(n,s){do{var r=$5(n.alternate,n);if(r!==null){r.flags&=32767,Vt=r;return}if(r=n.return,r!==null&&(r.flags|=32768,r.subtreeFlags=0,r.deletions=null),!s&&(n=n.sibling,n!==null)){Vt=n;return}Vt=n=r}while(n!==null);ts=6,Vt=null}function my(n,s,r,c,d,h,x,C,z){n.cancelPendingCommit=null;do Uh();while(_s!==0);if((vn&6)!==0)throw Error(l(327));if(s!==null){if(s===n.current)throw Error(l(177));if(h=s.lanes|s.childLanes,h|=Js,Ts(n,r,h,x,C,z),n===An&&(Vt=An=null,en=0),$c=s,wl=n,Rr=r,f1=h,h1=d,sy=c,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,ex(Oe,function(){return vy(),null})):(n.callbackNode=null,n.callbackPriority=0),c=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||c){c=R.T,R.T=null,d=H.p,H.p=2,x=vn,vn|=4;try{F5(n,s,r)}finally{vn=x,H.p=d,R.T=c}}_s=1,py(),gy(),_y()}}function py(){if(_s===1){_s=0;var n=wl,s=$c,r=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||r){r=R.T,R.T=null;var c=H.p;H.p=2;var d=vn;vn|=4;try{Y8(s,n);var h=C1,x=nh(n.containerInfo),C=h.focusedElem,z=h.selectionRange;if(x!==C&&C&&C.ownerDocument&&fo(C.ownerDocument.documentElement,C)){if(z!==null&&bc(C)){var ae=z.start,xe=z.end;if(xe===void 0&&(xe=ae),"selectionStart"in C)C.selectionStart=ae,C.selectionEnd=Math.min(xe,C.value.length);else{var Ne=C.ownerDocument||document,ue=Ne&&Ne.defaultView||window;if(ue.getSelection){var ge=ue.getSelection(),nt=C.textContent.length,wt=Math.min(z.start,nt),Rn=z.end===void 0?wt:Math.min(z.end,nt);!ge.extend&&wt>Rn&&(x=Rn,Rn=wt,wt=x);var J=il(C,wt),q=il(C,Rn);if(J&&q&&(ge.rangeCount!==1||ge.anchorNode!==J.node||ge.anchorOffset!==J.offset||ge.focusNode!==q.node||ge.focusOffset!==q.offset)){var se=Ne.createRange();se.setStart(J.node,J.offset),ge.removeAllRanges(),wt>Rn?(ge.addRange(se),ge.extend(q.node,q.offset)):(se.setEnd(q.node,q.offset),ge.addRange(se))}}}}for(Ne=[],ge=C;ge=ge.parentNode;)ge.nodeType===1&&Ne.push({element:ge,left:ge.scrollLeft,top:ge.scrollTop});for(typeof C.focus=="function"&&C.focus(),C=0;C<Ne.length;C++){var je=Ne[C];je.element.scrollLeft=je.left,je.element.scrollTop=je.top}}Vh=!!E1,C1=E1=null}finally{vn=d,H.p=c,R.T=r}}n.current=s,_s=2}}function gy(){if(_s===2){_s=0;var n=wl,s=$c,r=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||r){r=R.T,R.T=null;var c=H.p;H.p=2;var d=vn;vn|=4;try{q8(n,s.alternate,s)}finally{vn=d,H.p=c,R.T=r}}_s=3}}function _y(){if(_s===4||_s===3){_s=0,Pn();var n=wl,s=$c,r=Rr,c=sy;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?_s=5:(_s=0,$c=wl=null,yy(n,n.pendingLanes));var d=n.pendingLanes;if(d===0&&(jl=null),Ys(r),s=s.stateNode,ce&&typeof ce.onCommitFiberRoot=="function")try{ce.onCommitFiberRoot(At,s,void 0,(s.current.flags&128)===128)}catch{}if(c!==null){s=R.T,d=H.p,H.p=2,R.T=null;try{for(var h=n.onRecoverableError,x=0;x<c.length;x++){var C=c[x];h(C.value,{componentStack:C.stack})}}finally{R.T=s,H.p=d}}(Rr&3)!==0&&Uh(),qi(n),d=n.pendingLanes,(r&261930)!==0&&(d&42)!==0?n===m1?Od++:(Od=0,m1=n):Od=0,Id(0)}}function yy(n,s){(n.pooledCacheLanes&=s)===0&&(s=n.pooledCache,s!=null&&(n.pooledCache=null,hl(s)))}function Uh(){return py(),gy(),_y(),vy()}function vy(){if(_s!==5)return!1;var n=wl,s=f1;f1=0;var r=Ys(Rr),c=R.T,d=H.p;try{H.p=32>r?32:r,R.T=null,r=h1,h1=null;var h=wl,x=Rr;if(_s=0,$c=wl=null,Rr=0,(vn&6)!==0)throw Error(l(331));var C=vn;if(vn|=4,ey(h.current),Z8(h,h.current,x,r),vn=C,Id(0,!1),ce&&typeof ce.onPostCommitFiberRoot=="function")try{ce.onPostCommitFiberRoot(At,h)}catch{}return!0}finally{H.p=d,R.T=c,yy(n,s)}}function by(n,s,r){s=Ws(r,s),s=Kp(n.stateNode,s,2),n=xi(n,s,2),n!==null&&(On(n,2),qi(n))}function En(n,s,r){if(n.tag===3)by(n,n,r);else for(;s!==null;){if(s.tag===3){by(s,n,r);break}else if(s.tag===1){var c=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(jl===null||!jl.has(c))){n=Ws(r,n),r=x8(2),c=xi(s,r,2),c!==null&&(S8(r,c,s,n),On(c,2),qi(c));break}}s=s.return}}function _1(n,s,r){var c=n.pingCache;if(c===null){c=n.pingCache=new K5;var d=new Set;c.set(s,d)}else d=c.get(s),d===void 0&&(d=new Set,c.set(s,d));d.has(r)||(c1=!0,d.add(r),n=Z5.bind(null,n,s,r),s.then(n,n))}function Z5(n,s,r){var c=n.pingCache;c!==null&&c.delete(s),n.pingedLanes|=n.suspendedLanes&r,n.warmLanes&=~r,An===n&&(en&r)===r&&(ts===4||ts===3&&(en&62914560)===en&&300>ke()-Ah?(vn&2)===0&&Fc(n,0):u1|=r,Hc===en&&(Hc=0)),qi(n)}function xy(n,s){s===0&&(s=De()),n=mr(n,s),n!==null&&(On(n,s),qi(n))}function X5(n){var s=n.memoizedState,r=0;s!==null&&(r=s.retryLane),xy(n,r)}function J5(n,s){var r=0;switch(n.tag){case 31:case 13:var c=n.stateNode,d=n.memoizedState;d!==null&&(r=d.retryLane);break;case 19:c=n.stateNode;break;case 22:c=n.stateNode._retryCache;break;default:throw Error(l(314))}c!==null&&c.delete(s),xy(n,r)}function ex(n,s){return vt(n,s)}var zh=null,Wc=null,y1=!1,Bh=!1,v1=!1,kl=0;function qi(n){n!==Wc&&n.next===null&&(Wc===null?zh=Wc=n:Wc=Wc.next=n),Bh=!0,y1||(y1=!0,nx())}function Id(n,s){if(!v1&&Bh){v1=!0;do for(var r=!1,c=zh;c!==null;){if(n!==0){var d=c.pendingLanes;if(d===0)var h=0;else{var x=c.suspendedLanes,C=c.pingedLanes;h=(1<<31-Re(42|n)+1)-1,h&=d&~(x&~C),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(r=!0,Ny(c,h))}else h=en,h=Un(c,c===An?h:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(h&3)===0||Cn(c,h)||(r=!0,Ny(c,h));c=c.next}while(r);v1=!1}}function tx(){Sy()}function Sy(){Bh=y1=!1;var n=0;kl!==0&&fx()&&(n=kl);for(var s=ke(),r=null,c=zh;c!==null;){var d=c.next,h=jy(c,s);h===0?(c.next=null,r===null?zh=d:r.next=d,d===null&&(Wc=r)):(r=c,(n!==0||(h&3)!==0)&&(Bh=!0)),c=d}_s!==0&&_s!==5||Id(n),kl!==0&&(kl=0)}function jy(n,s){for(var r=n.suspendedLanes,c=n.pingedLanes,d=n.expirationTimes,h=n.pendingLanes&-62914561;0<h;){var x=31-Re(h),C=1<<x,z=d[x];z===-1?((C&r)===0||(C&c)!==0)&&(d[x]=Dn(C,s)):z<=s&&(n.expiredLanes|=C),h&=~C}if(s=An,r=en,r=Un(n,n===s?r:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),c=n.callbackNode,r===0||n===s&&(kn===2||kn===9)||n.cancelPendingCommit!==null)return c!==null&&c!==null&&dt(c),n.callbackNode=null,n.callbackPriority=0;if((r&3)===0||Cn(n,r)){if(s=r&-r,s===n.callbackPriority)return s;switch(c!==null&&dt(c),Ys(r)){case 2:case 8:r=Ce;break;case 32:r=Oe;break;case 268435456:r=Ae;break;default:r=Oe}return c=wy.bind(null,n),r=vt(r,c),n.callbackPriority=s,n.callbackNode=r,s}return c!==null&&c!==null&&dt(c),n.callbackPriority=2,n.callbackNode=null,2}function wy(n,s){if(_s!==0&&_s!==5)return n.callbackNode=null,n.callbackPriority=0,null;var r=n.callbackNode;if(Uh()&&n.callbackNode!==r)return null;var c=en;return c=Un(n,n===An?c:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),c===0?null:(iy(n,c,s),jy(n,ke()),n.callbackNode!=null&&n.callbackNode===r?wy.bind(null,n):null)}function Ny(n,s){if(Uh())return null;iy(n,s,!0)}function nx(){mx(function(){(vn&6)!==0?vt(me,tx):Sy()})}function b1(){if(kl===0){var n=yr;n===0&&(n=Tt,Tt<<=1,(Tt&261888)===0&&(Tt=256)),kl=n}return kl}function ky(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:Ba(""+n)}function Ey(n,s){var r=s.ownerDocument.createElement("input");return r.name=s.name,r.value=s.value,n.id&&r.setAttribute("form",n.id),s.parentNode.insertBefore(r,s),n=new FormData(n),r.parentNode.removeChild(r),n}function sx(n,s,r,c,d){if(s==="submit"&&r&&r.stateNode===d){var h=ky((d[Ut]||null).action),x=c.submitter;x&&(s=(s=x[Ut]||null)?ky(s.formAction):x.getAttribute("formAction"),s!==null&&(h=s,x=null));var C=new Vr("action","action",null,c,d);n.push({event:C,listeners:[{instance:null,listener:function(){if(c.defaultPrevented){if(kl!==0){var z=x?Ey(d,x):new FormData(d);Bp(r,{pending:!0,data:z,method:d.method,action:h},null,z)}}else typeof h=="function"&&(C.preventDefault(),z=x?Ey(d,x):new FormData(d),Bp(r,{pending:!0,data:z,method:d.method,action:h},h,z))},currentTarget:d}]})}}for(var x1=0;x1<Sc.length;x1++){var S1=Sc[x1],ax=S1.toLowerCase(),ix=S1[0].toUpperCase()+S1.slice(1);ka(ax,"on"+ix)}ka(Ii,"onAnimationEnd"),ka(ah,"onAnimationIteration"),ka(ih,"onAnimationStart"),ka("dblclick","onDoubleClick"),ka("focusin","onFocus"),ka("focusout","onBlur"),ka(Tp,"onTransitionRun"),ka(rh,"onTransitionStart"),ka(Mp,"onTransitionCancel"),ka(lh,"onTransitionEnd"),ot("onMouseEnter",["mouseout","mouseover"]),ot("onMouseLeave",["mouseout","mouseover"]),ot("onPointerEnter",["pointerout","pointerover"]),ot("onPointerLeave",["pointerout","pointerover"]),mt("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),mt("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),mt("onBeforeInput",["compositionend","keypress","textInput","paste"]),mt("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),mt("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),mt("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ld="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(" "),rx=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ld));function Cy(n,s){s=(s&4)!==0;for(var r=0;r<n.length;r++){var c=n[r],d=c.event;c=c.listeners;e:{var h=void 0;if(s)for(var x=c.length-1;0<=x;x--){var C=c[x],z=C.instance,ae=C.currentTarget;if(C=C.listener,z!==h&&d.isPropagationStopped())break e;h=C,d.currentTarget=ae;try{h(d)}catch(xe){jc(xe)}d.currentTarget=null,h=z}else for(x=0;x<c.length;x++){if(C=c[x],z=C.instance,ae=C.currentTarget,C=C.listener,z!==h&&d.isPropagationStopped())break e;h=C,d.currentTarget=ae;try{h(d)}catch(xe){jc(xe)}d.currentTarget=null,h=z}}}}function Zt(n,s){var r=s[Mt];r===void 0&&(r=s[Mt]=new Set);var c=n+"__bubble";r.has(c)||(Ty(s,n,2,!1),r.add(c))}function j1(n,s,r){var c=0;s&&(c|=4),Ty(r,n,c,s)}var Hh="_reactListening"+Math.random().toString(36).slice(2);function w1(n){if(!n[Hh]){n[Hh]=!0,Ge.forEach(function(r){r!=="selectionchange"&&(rx.has(r)||j1(r,!1,n),j1(r,!0,n))});var s=n.nodeType===9?n:n.ownerDocument;s===null||s[Hh]||(s[Hh]=!0,j1("selectionchange",!1,s))}}function Ty(n,s,r,c){switch(av(s)){case 2:var d=Ox;break;case 8:d=Ix;break;default:d=z1}r=d.bind(null,s,r,n),d=void 0,!Qu||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(d=!0),c?d!==void 0?n.addEventListener(s,r,{capture:!0,passive:d}):n.addEventListener(s,r,!0):d!==void 0?n.addEventListener(s,r,{passive:d}):n.addEventListener(s,r,!1)}function N1(n,s,r,c,d){var h=c;if((s&1)===0&&(s&2)===0&&c!==null)e:for(;;){if(c===null)return;var x=c.tag;if(x===3||x===4){var C=c.stateNode.containerInfo;if(C===d)break;if(x===4)for(x=c.return;x!==null;){var z=x.tag;if((z===3||z===4)&&x.stateNode.containerInfo===d)return;x=x.return}for(;C!==null;){if(x=Wn(C),x===null)return;if(z=x.tag,z===5||z===6||z===26||z===27){c=h=x;continue e}C=C.parentNode}}c=c.return}li(function(){var ae=h,xe=ar(r),Ne=[];e:{var ue=oa.get(n);if(ue!==void 0){var ge=Vr,nt=n;switch(n){case"keypress":if(Ai(r)===0)break e;case"keydown":case"keyup":ge=Jr;break;case"focusin":nt="focus",ge=Xr;break;case"focusout":nt="blur",ge=Xr;break;case"beforeblur":case"afterblur":ge=Xr;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ge=ui;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ge=_n;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ge=Zf;break;case Ii:case ah:case ih:ge=Gf;break;case lh:ge=Xf;break;case"scroll":case"scrollend":ge=oo;break;case"wheel":ge=uo;break;case"copy":case"cut":case"paste":ge=Yf;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ge=co;break;case"toggle":case"beforetoggle":ge=Cp}var wt=(s&4)!==0,Rn=!wt&&(n==="scroll"||n==="scrollend"),J=wt?ue!==null?ue+"Capture":null:ue;wt=[];for(var q=ae,se;q!==null;){var je=q;if(se=je.stateNode,je=je.tag,je!==5&&je!==26&&je!==27||se===null||J===null||(je=Mi(q,J),je!=null&&wt.push(Pd(q,je,se))),Rn)break;q=q.return}0<wt.length&&(ue=new ge(ue,nt,null,r,xe),Ne.push({event:ue,listeners:wt}))}}if((s&7)===0){e:{if(ue=n==="mouseover"||n==="pointerover",ge=n==="mouseout"||n==="pointerout",ue&&r!==Ha&&(nt=r.relatedTarget||r.fromElement)&&(Wn(nt)||nt[ft]))break e;if((ge||ue)&&(ue=xe.window===xe?xe:(ue=xe.ownerDocument)?ue.defaultView||ue.parentWindow:window,ge?(nt=r.relatedTarget||r.toElement,ge=ae,nt=nt?Wn(nt):null,nt!==null&&(Rn=u(nt),wt=nt.tag,nt!==Rn||wt!==5&&wt!==27&&wt!==6)&&(nt=null)):(ge=null,nt=ae),ge!==nt)){if(wt=ui,je="onMouseLeave",J="onMouseEnter",q="mouse",(n==="pointerout"||n==="pointerover")&&(wt=co,je="onPointerLeave",J="onPointerEnter",q="pointer"),Rn=ge==null?ue:be(ge),se=nt==null?ue:be(nt),ue=new wt(je,q+"leave",ge,r,xe),ue.target=Rn,ue.relatedTarget=se,je=null,Wn(xe)===ae&&(wt=new wt(J,q+"enter",nt,r,xe),wt.target=se,wt.relatedTarget=Rn,je=wt),Rn=je,ge&&nt)t:{for(wt=lx,J=ge,q=nt,se=0,je=J;je;je=wt(je))se++;je=0;for(var yt=q;yt;yt=wt(yt))je++;for(;0<se-je;)J=wt(J),se--;for(;0<je-se;)q=wt(q),je--;for(;se--;){if(J===q||q!==null&&J===q.alternate){wt=J;break t}J=wt(J),q=wt(q)}wt=null}else wt=null;ge!==null&&My(Ne,ue,ge,wt,!1),nt!==null&&Rn!==null&&My(Ne,Rn,nt,wt,!0)}}e:{if(ue=ae?be(ae):window,ge=ue.nodeName&&ue.nodeName.toLowerCase(),ge==="select"||ge==="input"&&ue.type==="file")var fn=td;else if(tl(ue))if(Fa)fn=vc;else{fn=yc;var lt=_c}else ge=ue.nodeName,!ge||ge.toLowerCase()!=="input"||ue.type!=="checkbox"&&ue.type!=="radio"?ae&&tr(ae.elementType)&&(fn=td):fn=cs;if(fn&&(fn=fn(n,ae))){nl(Ne,fn,r,xe);break e}lt&&lt(n,ue,ae),n==="focusout"&&ae&&ue.type==="number"&&ae.memoizedProps.value!=null&&za(ue,"number",ue.value)}switch(lt=ae?be(ae):window,n){case"focusin":(tl(lt)||lt.contentEditable==="true")&&(rl=lt,ho=ae,fr=null);break;case"focusout":fr=ho=rl=null;break;case"mousedown":ll=!0;break;case"contextmenu":case"mouseup":case"dragend":ll=!1,sd(Ne,r,xe);break;case"selectionchange":if(sh)break;case"keydown":case"keyup":sd(Ne,r,xe)}var Ht;if(di)e:{switch(n){case"compositionstart":var tn="onCompositionStart";break e;case"compositionend":tn="onCompositionEnd";break e;case"compositionupdate":tn="onCompositionUpdate";break e}tn=void 0}else ra?Na(n,r)&&(tn="onCompositionEnd"):n==="keydown"&&r.keyCode===229&&(tn="onCompositionStart");tn&&(Ju&&r.locale!=="ko"&&(ra||tn!=="onCompositionStart"?tn==="onCompositionEnd"&&ra&&(Ht=lr()):(ja=xe,lo="value"in ja?ja.value:ja.textContent,ra=!0)),lt=$h(ae,tn),0<lt.length&&(tn=new fc(tn,n,null,r,xe),Ne.push({event:tn,listeners:lt}),Ht?tn.data=Ht:(Ht=ur(r),Ht!==null&&(tn.data=Ht)))),(Ht=Xu?ed(n,r):pc(n,r))&&(tn=$h(ae,"onBeforeInput"),0<tn.length&&(lt=new fc("onBeforeInput","beforeinput",null,r,xe),Ne.push({event:lt,listeners:tn}),lt.data=Ht)),sx(Ne,n,ae,r,xe)}Cy(Ne,s)})}function Pd(n,s,r){return{instance:n,listener:s,currentTarget:r}}function $h(n,s){for(var r=s+"Capture",c=[];n!==null;){var d=n,h=d.stateNode;if(d=d.tag,d!==5&&d!==26&&d!==27||h===null||(d=Mi(n,r),d!=null&&c.unshift(Pd(n,d,h)),d=Mi(n,s),d!=null&&c.push(Pd(n,d,h))),n.tag===3)return c;n=n.return}return[]}function lx(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function My(n,s,r,c,d){for(var h=s._reactName,x=[];r!==null&&r!==c;){var C=r,z=C.alternate,ae=C.stateNode;if(C=C.tag,z!==null&&z===c)break;C!==5&&C!==26&&C!==27||ae===null||(z=ae,d?(ae=Mi(r,h),ae!=null&&x.unshift(Pd(r,ae,z))):d||(ae=Mi(r,h),ae!=null&&x.push(Pd(r,ae,z)))),r=r.return}x.length!==0&&n.push({event:s,listeners:x})}var ox=/\r\n?/g,cx=/\u0000|\uFFFD/g;function Ry(n){return(typeof n=="string"?n:""+n).replace(ox,`
50
+ `).replace(cx,"")}function Ay(n,s){return s=Ry(s),Ry(n)===s}function Mn(n,s,r,c,d,h){switch(r){case"children":typeof c=="string"?s==="body"||s==="textarea"&&c===""||$s(n,c):(typeof c=="number"||typeof c=="bigint")&&s!=="body"&&$s(n,""+c);break;case"className":pn(n,"class",c);break;case"tabIndex":pn(n,"tabindex",c);break;case"dir":case"role":case"viewBox":case"width":case"height":pn(n,r,c);break;case"style":er(n,c,h);break;case"data":if(s!=="object"){pn(n,"data",c);break}case"src":case"href":if(c===""&&(s!=="a"||r!=="href")){n.removeAttribute(r);break}if(c==null||typeof c=="function"||typeof c=="symbol"||typeof c=="boolean"){n.removeAttribute(r);break}c=Ba(""+c),n.setAttribute(r,c);break;case"action":case"formAction":if(typeof c=="function"){n.setAttribute(r,"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 h=="function"&&(r==="formAction"?(s!=="input"&&Mn(n,s,"name",d.name,d,null),Mn(n,s,"formEncType",d.formEncType,d,null),Mn(n,s,"formMethod",d.formMethod,d,null),Mn(n,s,"formTarget",d.formTarget,d,null)):(Mn(n,s,"encType",d.encType,d,null),Mn(n,s,"method",d.method,d,null),Mn(n,s,"target",d.target,d,null)));if(c==null||typeof c=="symbol"||typeof c=="boolean"){n.removeAttribute(r);break}c=Ba(""+c),n.setAttribute(r,c);break;case"onClick":c!=null&&(n.onclick=Ms);break;case"onScroll":c!=null&&Zt("scroll",n);break;case"onScrollEnd":c!=null&&Zt("scrollend",n);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(l(61));if(r=c.__html,r!=null){if(d.children!=null)throw Error(l(60));n.innerHTML=r}}break;case"multiple":n.multiple=c&&typeof c!="function"&&typeof c!="symbol";break;case"muted":n.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"){n.removeAttribute("xlink:href");break}r=Ba(""+c),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r);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"?n.setAttribute(r,""+c):n.removeAttribute(r);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"?n.setAttribute(r,""):n.removeAttribute(r);break;case"capture":case"download":c===!0?n.setAttribute(r,""):c!==!1&&c!=null&&typeof c!="function"&&typeof c!="symbol"?n.setAttribute(r,c):n.removeAttribute(r);break;case"cols":case"rows":case"size":case"span":c!=null&&typeof c!="function"&&typeof c!="symbol"&&!isNaN(c)&&1<=c?n.setAttribute(r,c):n.removeAttribute(r);break;case"rowSpan":case"start":c==null||typeof c=="function"||typeof c=="symbol"||isNaN(c)?n.removeAttribute(r):n.setAttribute(r,c);break;case"popover":Zt("beforetoggle",n),Zt("toggle",n),In(n,"popover",c);break;case"xlinkActuate":sn(n,"http://www.w3.org/1999/xlink","xlink:actuate",c);break;case"xlinkArcrole":sn(n,"http://www.w3.org/1999/xlink","xlink:arcrole",c);break;case"xlinkRole":sn(n,"http://www.w3.org/1999/xlink","xlink:role",c);break;case"xlinkShow":sn(n,"http://www.w3.org/1999/xlink","xlink:show",c);break;case"xlinkTitle":sn(n,"http://www.w3.org/1999/xlink","xlink:title",c);break;case"xlinkType":sn(n,"http://www.w3.org/1999/xlink","xlink:type",c);break;case"xmlBase":sn(n,"http://www.w3.org/XML/1998/namespace","xml:base",c);break;case"xmlLang":sn(n,"http://www.w3.org/XML/1998/namespace","xml:lang",c);break;case"xmlSpace":sn(n,"http://www.w3.org/XML/1998/namespace","xml:space",c);break;case"is":In(n,"is",c);break;case"innerText":case"textContent":break;default:(!(2<r.length)||r[0]!=="o"&&r[0]!=="O"||r[1]!=="n"&&r[1]!=="N")&&(r=nr.get(r)||r,In(n,r,c))}}function k1(n,s,r,c,d,h){switch(r){case"style":er(n,c,h);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(l(61));if(r=c.__html,r!=null){if(d.children!=null)throw Error(l(60));n.innerHTML=r}}break;case"children":typeof c=="string"?$s(n,c):(typeof c=="number"||typeof c=="bigint")&&$s(n,""+c);break;case"onScroll":c!=null&&Zt("scroll",n);break;case"onScrollEnd":c!=null&&Zt("scrollend",n);break;case"onClick":c!=null&&(n.onclick=Ms);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ht.hasOwnProperty(r))e:{if(r[0]==="o"&&r[1]==="n"&&(d=r.endsWith("Capture"),s=r.slice(2,d?r.length-7:void 0),h=n[Ut]||null,h=h!=null?h[r]:null,typeof h=="function"&&n.removeEventListener(s,h,d),typeof c=="function")){typeof h!="function"&&h!==null&&(r in n?n[r]=null:n.hasAttribute(r)&&n.removeAttribute(r)),n.addEventListener(s,c,d);break e}r in n?n[r]=c:c===!0?n.setAttribute(r,""):In(n,r,c)}}}function Ls(n,s,r){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Zt("error",n),Zt("load",n);var c=!1,d=!1,h;for(h in r)if(r.hasOwnProperty(h)){var x=r[h];if(x!=null)switch(h){case"src":c=!0;break;case"srcSet":d=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(l(137,s));default:Mn(n,s,h,x,r,null)}}d&&Mn(n,s,"srcSet",r.srcSet,r,null),c&&Mn(n,s,"src",r.src,r,null);return;case"input":Zt("invalid",n);var C=h=x=d=null,z=null,ae=null;for(c in r)if(r.hasOwnProperty(c)){var xe=r[c];if(xe!=null)switch(c){case"name":d=xe;break;case"type":x=xe;break;case"checked":z=xe;break;case"defaultChecked":ae=xe;break;case"value":h=xe;break;case"defaultValue":C=xe;break;case"children":case"dangerouslySetInnerHTML":if(xe!=null)throw Error(l(137,s));break;default:Mn(n,s,c,xe,r,null)}}zn(n,h,C,z,ae,x,d,!1);return;case"select":Zt("invalid",n),c=x=h=null;for(d in r)if(r.hasOwnProperty(d)&&(C=r[d],C!=null))switch(d){case"value":h=C;break;case"defaultValue":x=C;break;case"multiple":c=C;default:Mn(n,s,d,C,r,null)}s=h,r=x,n.multiple=!!c,s!=null?Bs(n,!!c,s,!1):r!=null&&Bs(n,!!c,r,!0);return;case"textarea":Zt("invalid",n),h=d=c=null;for(x in r)if(r.hasOwnProperty(x)&&(C=r[x],C!=null))switch(x){case"value":c=C;break;case"defaultValue":d=C;break;case"children":h=C;break;case"dangerouslySetInnerHTML":if(C!=null)throw Error(l(91));break;default:Mn(n,s,x,C,r,null)}Vs(n,c,d,h);return;case"option":for(z in r)if(r.hasOwnProperty(z)&&(c=r[z],c!=null))switch(z){case"selected":n.selected=c&&typeof c!="function"&&typeof c!="symbol";break;default:Mn(n,s,z,c,r,null)}return;case"dialog":Zt("beforetoggle",n),Zt("toggle",n),Zt("cancel",n),Zt("close",n);break;case"iframe":case"object":Zt("load",n);break;case"video":case"audio":for(c=0;c<Ld.length;c++)Zt(Ld[c],n);break;case"image":Zt("error",n),Zt("load",n);break;case"details":Zt("toggle",n);break;case"embed":case"source":case"link":Zt("error",n),Zt("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ae in r)if(r.hasOwnProperty(ae)&&(c=r[ae],c!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":throw Error(l(137,s));default:Mn(n,s,ae,c,r,null)}return;default:if(tr(s)){for(xe in r)r.hasOwnProperty(xe)&&(c=r[xe],c!==void 0&&k1(n,s,xe,c,r,void 0));return}}for(C in r)r.hasOwnProperty(C)&&(c=r[C],c!=null&&Mn(n,s,C,c,r,null))}function ux(n,s,r,c){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var d=null,h=null,x=null,C=null,z=null,ae=null,xe=null;for(ge in r){var Ne=r[ge];if(r.hasOwnProperty(ge)&&Ne!=null)switch(ge){case"checked":break;case"value":break;case"defaultValue":z=Ne;default:c.hasOwnProperty(ge)||Mn(n,s,ge,null,c,Ne)}}for(var ue in c){var ge=c[ue];if(Ne=r[ue],c.hasOwnProperty(ue)&&(ge!=null||Ne!=null))switch(ue){case"type":h=ge;break;case"name":d=ge;break;case"checked":ae=ge;break;case"defaultChecked":xe=ge;break;case"value":x=ge;break;case"defaultValue":C=ge;break;case"children":case"dangerouslySetInnerHTML":if(ge!=null)throw Error(l(137,s));break;default:ge!==Ne&&Mn(n,s,ue,ge,c,Ne)}}gn(n,x,C,z,ae,xe,h,d);return;case"select":ge=x=C=ue=null;for(h in r)if(z=r[h],r.hasOwnProperty(h)&&z!=null)switch(h){case"value":break;case"multiple":ge=z;default:c.hasOwnProperty(h)||Mn(n,s,h,null,c,z)}for(d in c)if(h=c[d],z=r[d],c.hasOwnProperty(d)&&(h!=null||z!=null))switch(d){case"value":ue=h;break;case"defaultValue":C=h;break;case"multiple":x=h;default:h!==z&&Mn(n,s,d,h,c,z)}s=C,r=x,c=ge,ue!=null?Bs(n,!!r,ue,!1):!!c!=!!r&&(s!=null?Bs(n,!!r,s,!0):Bs(n,!!r,r?[]:"",!1));return;case"textarea":ge=ue=null;for(C in r)if(d=r[C],r.hasOwnProperty(C)&&d!=null&&!c.hasOwnProperty(C))switch(C){case"value":break;case"children":break;default:Mn(n,s,C,null,c,d)}for(x in c)if(d=c[x],h=r[x],c.hasOwnProperty(x)&&(d!=null||h!=null))switch(x){case"value":ue=d;break;case"defaultValue":ge=d;break;case"children":break;case"dangerouslySetInnerHTML":if(d!=null)throw Error(l(91));break;default:d!==h&&Mn(n,s,x,d,c,h)}Hs(n,ue,ge);return;case"option":for(var nt in r)if(ue=r[nt],r.hasOwnProperty(nt)&&ue!=null&&!c.hasOwnProperty(nt))switch(nt){case"selected":n.selected=!1;break;default:Mn(n,s,nt,null,c,ue)}for(z in c)if(ue=c[z],ge=r[z],c.hasOwnProperty(z)&&ue!==ge&&(ue!=null||ge!=null))switch(z){case"selected":n.selected=ue&&typeof ue!="function"&&typeof ue!="symbol";break;default:Mn(n,s,z,ue,c,ge)}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 wt in r)ue=r[wt],r.hasOwnProperty(wt)&&ue!=null&&!c.hasOwnProperty(wt)&&Mn(n,s,wt,null,c,ue);for(ae in c)if(ue=c[ae],ge=r[ae],c.hasOwnProperty(ae)&&ue!==ge&&(ue!=null||ge!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(l(137,s));break;default:Mn(n,s,ae,ue,c,ge)}return;default:if(tr(s)){for(var Rn in r)ue=r[Rn],r.hasOwnProperty(Rn)&&ue!==void 0&&!c.hasOwnProperty(Rn)&&k1(n,s,Rn,void 0,c,ue);for(xe in c)ue=c[xe],ge=r[xe],!c.hasOwnProperty(xe)||ue===ge||ue===void 0&&ge===void 0||k1(n,s,xe,ue,c,ge);return}}for(var J in r)ue=r[J],r.hasOwnProperty(J)&&ue!=null&&!c.hasOwnProperty(J)&&Mn(n,s,J,null,c,ue);for(Ne in c)ue=c[Ne],ge=r[Ne],!c.hasOwnProperty(Ne)||ue===ge||ue==null&&ge==null||Mn(n,s,Ne,ue,c,ge)}function Dy(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function dx(){if(typeof performance.getEntriesByType=="function"){for(var n=0,s=0,r=performance.getEntriesByType("resource"),c=0;c<r.length;c++){var d=r[c],h=d.transferSize,x=d.initiatorType,C=d.duration;if(h&&C&&Dy(x)){for(x=0,C=d.responseEnd,c+=1;c<r.length;c++){var z=r[c],ae=z.startTime;if(ae>C)break;var xe=z.transferSize,Ne=z.initiatorType;xe&&Dy(Ne)&&(z=z.responseEnd,x+=xe*(z<C?1:(C-ae)/(z-ae)))}if(--c,s+=8*(h+x)/(d.duration/1e3),n++,10<n)break}}if(0<n)return s/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var E1=null,C1=null;function Fh(n){return n.nodeType===9?n:n.ownerDocument}function Oy(n){switch(n){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Iy(n,s){if(n===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&s==="foreignObject"?0:n}function T1(n,s){return n==="textarea"||n==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var M1=null;function fx(){var n=window.event;return n&&n.type==="popstate"?n===M1?!1:(M1=n,!0):(M1=null,!1)}var Ly=typeof setTimeout=="function"?setTimeout:void 0,hx=typeof clearTimeout=="function"?clearTimeout:void 0,Py=typeof Promise=="function"?Promise:void 0,mx=typeof queueMicrotask=="function"?queueMicrotask:typeof Py<"u"?function(n){return Py.resolve(null).then(n).catch(px)}:Ly;function px(n){setTimeout(function(){throw n})}function El(n){return n==="head"}function Uy(n,s){var r=s,c=0;do{var d=r.nextSibling;if(n.removeChild(r),d&&d.nodeType===8)if(r=d.data,r==="/$"||r==="/&"){if(c===0){n.removeChild(d),Yc(s);return}c--}else if(r==="$"||r==="$?"||r==="$~"||r==="$!"||r==="&")c++;else if(r==="html")Ud(n.ownerDocument.documentElement);else if(r==="head"){r=n.ownerDocument.head,Ud(r);for(var h=r.firstChild;h;){var x=h.nextSibling,C=h.nodeName;h[Kt]||C==="SCRIPT"||C==="STYLE"||C==="LINK"&&h.rel.toLowerCase()==="stylesheet"||r.removeChild(h),h=x}}else r==="body"&&Ud(n.ownerDocument.body);r=d}while(r);Yc(s)}function zy(n,s){var r=n;n=0;do{var c=r.nextSibling;if(r.nodeType===1?s?(r._stashedDisplay=r.style.display,r.style.display="none"):(r.style.display=r._stashedDisplay||"",r.getAttribute("style")===""&&r.removeAttribute("style")):r.nodeType===3&&(s?(r._stashedText=r.nodeValue,r.nodeValue=""):r.nodeValue=r._stashedText||""),c&&c.nodeType===8)if(r=c.data,r==="/$"){if(n===0)break;n--}else r!=="$"&&r!=="$?"&&r!=="$~"&&r!=="$!"||n++;r=c}while(r)}function R1(n){var s=n.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var r=s;switch(s=s.nextSibling,r.nodeName){case"HTML":case"HEAD":case"BODY":R1(r),bs(r);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(r.rel.toLowerCase()==="stylesheet")continue}n.removeChild(r)}}function gx(n,s,r,c){for(;n.nodeType===1;){var d=r;if(n.nodeName.toLowerCase()!==s.toLowerCase()){if(!c&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(c){if(!n[Kt])switch(s){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(h=n.getAttribute("rel"),h==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(h!==d.rel||n.getAttribute("href")!==(d.href==null||d.href===""?null:d.href)||n.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin)||n.getAttribute("title")!==(d.title==null?null:d.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(h=n.getAttribute("src"),(h!==(d.src==null?null:d.src)||n.getAttribute("type")!==(d.type==null?null:d.type)||n.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin))&&h&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(s==="input"&&n.type==="hidden"){var h=d.name==null?null:""+d.name;if(d.type==="hidden"&&n.getAttribute("name")===h)return n}else return n;if(n=Ja(n.nextSibling),n===null)break}return null}function _x(n,s,r){if(s==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!r||(n=Ja(n.nextSibling),n===null))return null;return n}function By(n,s){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!s||(n=Ja(n.nextSibling),n===null))return null;return n}function A1(n){return n.data==="$?"||n.data==="$~"}function D1(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function yx(n,s){var r=n.ownerDocument;if(n.data==="$~")n._reactRetry=s;else if(n.data!=="$?"||r.readyState!=="loading")s();else{var c=function(){s(),r.removeEventListener("DOMContentLoaded",c)};r.addEventListener("DOMContentLoaded",c),n._reactRetry=c}}function Ja(n){for(;n!=null;n=n.nextSibling){var s=n.nodeType;if(s===1||s===3)break;if(s===8){if(s=n.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return n}var O1=null;function Hy(n){n=n.nextSibling;for(var s=0;n;){if(n.nodeType===8){var r=n.data;if(r==="/$"||r==="/&"){if(s===0)return Ja(n.nextSibling);s--}else r!=="$"&&r!=="$!"&&r!=="$?"&&r!=="$~"&&r!=="&"||s++}n=n.nextSibling}return null}function $y(n){n=n.previousSibling;for(var s=0;n;){if(n.nodeType===8){var r=n.data;if(r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"){if(s===0)return n;s--}else r!=="/$"&&r!=="/&"||s++}n=n.previousSibling}return null}function Fy(n,s,r){switch(s=Fh(r),n){case"html":if(n=s.documentElement,!n)throw Error(l(452));return n;case"head":if(n=s.head,!n)throw Error(l(453));return n;case"body":if(n=s.body,!n)throw Error(l(454));return n;default:throw Error(l(451))}}function Ud(n){for(var s=n.attributes;s.length;)n.removeAttributeNode(s[0]);bs(n)}var ei=new Map,qy=new Set;function qh(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var Ar=H.d;H.d={f:vx,r:bx,D:xx,C:Sx,L:jx,m:wx,X:kx,S:Nx,M:Ex};function vx(){var n=Ar.f(),s=Ih();return n||s}function bx(n){var s=P(n);s!==null&&s.tag===5&&s.type==="form"?l8(s):Ar.r(n)}var Kc=typeof document>"u"?null:document;function Wy(n,s,r){var c=Kc;if(c&&typeof s=="string"&&s){var d=ct(s);d='link[rel="'+n+'"][href="'+d+'"]',typeof r=="string"&&(d+='[crossorigin="'+r+'"]'),qy.has(d)||(qy.add(d),n={rel:n,crossOrigin:r,href:s},c.querySelector(d)===null&&(s=c.createElement("link"),Ls(s,"link",n),He(s),c.head.appendChild(s)))}}function xx(n){Ar.D(n),Wy("dns-prefetch",n,null)}function Sx(n,s){Ar.C(n,s),Wy("preconnect",n,s)}function jx(n,s,r){Ar.L(n,s,r);var c=Kc;if(c&&n&&s){var d='link[rel="preload"][as="'+ct(s)+'"]';s==="image"&&r&&r.imageSrcSet?(d+='[imagesrcset="'+ct(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(d+='[imagesizes="'+ct(r.imageSizes)+'"]')):d+='[href="'+ct(n)+'"]';var h=d;switch(s){case"style":h=Qc(n);break;case"script":h=Gc(n)}ei.has(h)||(n=p({rel:"preload",href:s==="image"&&r&&r.imageSrcSet?void 0:n,as:s},r),ei.set(h,n),c.querySelector(d)!==null||s==="style"&&c.querySelector(zd(h))||s==="script"&&c.querySelector(Bd(h))||(s=c.createElement("link"),Ls(s,"link",n),He(s),c.head.appendChild(s)))}}function wx(n,s){Ar.m(n,s);var r=Kc;if(r&&n){var c=s&&typeof s.as=="string"?s.as:"script",d='link[rel="modulepreload"][as="'+ct(c)+'"][href="'+ct(n)+'"]',h=d;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=Gc(n)}if(!ei.has(h)&&(n=p({rel:"modulepreload",href:n},s),ei.set(h,n),r.querySelector(d)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(Bd(h)))return}c=r.createElement("link"),Ls(c,"link",n),He(c),r.head.appendChild(c)}}}function Nx(n,s,r){Ar.S(n,s,r);var c=Kc;if(c&&n){var d=Le(c).hoistableStyles,h=Qc(n);s=s||"default";var x=d.get(h);if(!x){var C={loading:0,preload:null};if(x=c.querySelector(zd(h)))C.loading=5;else{n=p({rel:"stylesheet",href:n,"data-precedence":s},r),(r=ei.get(h))&&I1(n,r);var z=x=c.createElement("link");He(z),Ls(z,"link",n),z._p=new Promise(function(ae,xe){z.onload=ae,z.onerror=xe}),z.addEventListener("load",function(){C.loading|=1}),z.addEventListener("error",function(){C.loading|=2}),C.loading|=4,Wh(x,s,c)}x={type:"stylesheet",instance:x,count:1,state:C},d.set(h,x)}}}function kx(n,s){Ar.X(n,s);var r=Kc;if(r&&n){var c=Le(r).hoistableScripts,d=Gc(n),h=c.get(d);h||(h=r.querySelector(Bd(d)),h||(n=p({src:n,async:!0},s),(s=ei.get(d))&&L1(n,s),h=r.createElement("script"),He(h),Ls(h,"link",n),r.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},c.set(d,h))}}function Ex(n,s){Ar.M(n,s);var r=Kc;if(r&&n){var c=Le(r).hoistableScripts,d=Gc(n),h=c.get(d);h||(h=r.querySelector(Bd(d)),h||(n=p({src:n,async:!0,type:"module"},s),(s=ei.get(d))&&L1(n,s),h=r.createElement("script"),He(h),Ls(h,"link",n),r.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},c.set(d,h))}}function Ky(n,s,r,c){var d=(d=re.current)?qh(d):null;if(!d)throw Error(l(446));switch(n){case"meta":case"title":return null;case"style":return typeof r.precedence=="string"&&typeof r.href=="string"?(s=Qc(r.href),r=Le(d).hoistableStyles,c=r.get(s),c||(c={type:"style",instance:null,count:0,state:null},r.set(s,c)),c):{type:"void",instance:null,count:0,state:null};case"link":if(r.rel==="stylesheet"&&typeof r.href=="string"&&typeof r.precedence=="string"){n=Qc(r.href);var h=Le(d).hoistableStyles,x=h.get(n);if(x||(d=d.ownerDocument||d,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(n,x),(h=d.querySelector(zd(n)))&&!h._p&&(x.instance=h,x.state.loading=5),ei.has(n)||(r={rel:"preload",as:"style",href:r.href,crossOrigin:r.crossOrigin,integrity:r.integrity,media:r.media,hrefLang:r.hrefLang,referrerPolicy:r.referrerPolicy},ei.set(n,r),h||Cx(d,n,r,x.state))),s&&c===null)throw Error(l(528,""));return x}if(s&&c!==null)throw Error(l(529,""));return null;case"script":return s=r.async,r=r.src,typeof r=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=Gc(r),r=Le(d).hoistableScripts,c=r.get(s),c||(c={type:"script",instance:null,count:0,state:null},r.set(s,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,n))}}function Qc(n){return'href="'+ct(n)+'"'}function zd(n){return'link[rel="stylesheet"]['+n+"]"}function Qy(n){return p({},n,{"data-precedence":n.precedence,precedence:null})}function Cx(n,s,r,c){n.querySelector('link[rel="preload"][as="style"]['+s+"]")?c.loading=1:(s=n.createElement("link"),c.preload=s,s.addEventListener("load",function(){return c.loading|=1}),s.addEventListener("error",function(){return c.loading|=2}),Ls(s,"link",r),He(s),n.head.appendChild(s))}function Gc(n){return'[src="'+ct(n)+'"]'}function Bd(n){return"script[async]"+n}function Gy(n,s,r){if(s.count++,s.instance===null)switch(s.type){case"style":var c=n.querySelector('style[data-href~="'+ct(r.href)+'"]');if(c)return s.instance=c,He(c),c;var d=p({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return c=(n.ownerDocument||n).createElement("style"),He(c),Ls(c,"style",d),Wh(c,r.precedence,n),s.instance=c;case"stylesheet":d=Qc(r.href);var h=n.querySelector(zd(d));if(h)return s.state.loading|=4,s.instance=h,He(h),h;c=Qy(r),(d=ei.get(d))&&I1(c,d),h=(n.ownerDocument||n).createElement("link"),He(h);var x=h;return x._p=new Promise(function(C,z){x.onload=C,x.onerror=z}),Ls(h,"link",c),s.state.loading|=4,Wh(h,r.precedence,n),s.instance=h;case"script":return h=Gc(r.src),(d=n.querySelector(Bd(h)))?(s.instance=d,He(d),d):(c=r,(d=ei.get(h))&&(c=p({},r),L1(c,d)),n=n.ownerDocument||n,d=n.createElement("script"),He(d),Ls(d,"link",c),n.head.appendChild(d),s.instance=d);case"void":return null;default:throw Error(l(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(c=s.instance,s.state.loading|=4,Wh(c,r.precedence,n));return s.instance}function Wh(n,s,r){for(var c=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),d=c.length?c[c.length-1]:null,h=d,x=0;x<c.length;x++){var C=c[x];if(C.dataset.precedence===s)h=C;else if(h!==d)break}h?h.parentNode.insertBefore(n,h.nextSibling):(s=r.nodeType===9?r.head:r,s.insertBefore(n,s.firstChild))}function I1(n,s){n.crossOrigin==null&&(n.crossOrigin=s.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=s.referrerPolicy),n.title==null&&(n.title=s.title)}function L1(n,s){n.crossOrigin==null&&(n.crossOrigin=s.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=s.referrerPolicy),n.integrity==null&&(n.integrity=s.integrity)}var Kh=null;function Yy(n,s,r){if(Kh===null){var c=new Map,d=Kh=new Map;d.set(r,c)}else d=Kh,c=d.get(r),c||(c=new Map,d.set(r,c));if(c.has(n))return c;for(c.set(n,null),r=r.getElementsByTagName(n),d=0;d<r.length;d++){var h=r[d];if(!(h[Kt]||h[at]||n==="link"&&h.getAttribute("rel")==="stylesheet")&&h.namespaceURI!=="http://www.w3.org/2000/svg"){var x=h.getAttribute(s)||"";x=n+x;var C=c.get(x);C?C.push(h):c.set(x,[h])}}return c}function Vy(n,s,r){n=n.ownerDocument||n,n.head.insertBefore(r,s==="title"?n.querySelector("head > title"):null)}function Tx(n,s,r){if(r===1||s.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;switch(s.rel){case"stylesheet":return n=s.disabled,typeof s.precedence=="string"&&n==null;default:return!0}case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function Zy(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function Mx(n,s,r,c){if(r.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var d=Qc(c.href),h=s.querySelector(zd(d));if(h){s=h._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(n.count++,n=Qh.bind(n),s.then(n,n)),r.state.loading|=4,r.instance=h,He(h);return}h=s.ownerDocument||s,c=Qy(c),(d=ei.get(d))&&I1(c,d),h=h.createElement("link"),He(h);var x=h;x._p=new Promise(function(C,z){x.onload=C,x.onerror=z}),Ls(h,"link",c),r.instance=h}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(r,s),(s=r.state.preload)&&(r.state.loading&3)===0&&(n.count++,r=Qh.bind(n),s.addEventListener("load",r),s.addEventListener("error",r))}}var P1=0;function Rx(n,s){return n.stylesheets&&n.count===0&&Yh(n,n.stylesheets),0<n.count||0<n.imgCount?function(r){var c=setTimeout(function(){if(n.stylesheets&&Yh(n,n.stylesheets),n.unsuspend){var h=n.unsuspend;n.unsuspend=null,h()}},6e4+s);0<n.imgBytes&&P1===0&&(P1=62500*dx());var d=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&Yh(n,n.stylesheets),n.unsuspend)){var h=n.unsuspend;n.unsuspend=null,h()}},(n.imgBytes>P1?50:800)+s);return n.unsuspend=r,function(){n.unsuspend=null,clearTimeout(c),clearTimeout(d)}}:null}function Qh(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Yh(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var Gh=null;function Yh(n,s){n.stylesheets=null,n.unsuspend!==null&&(n.count++,Gh=new Map,s.forEach(Ax,n),Gh=null,Qh.call(n))}function Ax(n,s){if(!(s.state.loading&4)){var r=Gh.get(n);if(r)var c=r.get(null);else{r=new Map,Gh.set(n,r);for(var d=n.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h<d.length;h++){var x=d[h];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(r.set(x.dataset.precedence,x),c=x)}c&&r.set(null,c)}d=s.instance,x=d.getAttribute("data-precedence"),h=r.get(x)||c,h===c&&r.set(null,d),r.set(x,d),this.count++,c=Qh.bind(this),d.addEventListener("load",c),d.addEventListener("error",c),h?h.parentNode.insertBefore(d,h.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(d,n.firstChild)),s.state.loading|=4}}var Hd={$$typeof:I,Provider:null,Consumer:null,_currentValue:X,_currentValue2:X,_threadCount:0};function Dx(n,s,r,c,d,h,x,C,z){this.tag=1,this.containerInfo=n,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=Qt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Qt(0),this.hiddenUpdates=Qt(null),this.identifierPrefix=c,this.onUncaughtError=d,this.onCaughtError=h,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=z,this.incompleteTransitions=new Map}function Xy(n,s,r,c,d,h,x,C,z,ae,xe,Ne){return n=new Dx(n,s,r,x,z,ae,xe,Ne,C),s=1,h===!0&&(s|=24),h=Ds(3,null,null,s),n.current=h,h.stateNode=n,s=md(),s.refCount++,n.pooledCache=s,s.refCount++,h.memoizedState={element:c,isDehydrated:r,cache:s},Rc(h),n}function Jy(n){return n?(n=cl,n):cl}function ev(n,s,r,c,d,h){d=Jy(d),c.context===null?c.context=d:c.pendingContext=d,c=bi(s),c.payload={element:r},h=h===void 0?null:h,h!==null&&(c.callback=h),r=xi(n,c,s),r!==null&&(_a(r,n,s),yl(r,n,s))}function tv(n,s){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var r=n.retryLane;n.retryLane=r!==0&&r<s?r:s}}function U1(n,s){tv(n,s),(n=n.alternate)&&tv(n,s)}function nv(n){if(n.tag===13||n.tag===31){var s=mr(n,67108864);s!==null&&_a(s,n,67108864),U1(n,67108864)}}function sv(n){if(n.tag===13||n.tag===31){var s=Da();s=Fn(s);var r=mr(n,s);r!==null&&_a(r,n,s),U1(n,s)}}var Vh=!0;function Ox(n,s,r,c){var d=R.T;R.T=null;var h=H.p;try{H.p=2,z1(n,s,r,c)}finally{H.p=h,R.T=d}}function Ix(n,s,r,c){var d=R.T;R.T=null;var h=H.p;try{H.p=8,z1(n,s,r,c)}finally{H.p=h,R.T=d}}function z1(n,s,r,c){if(Vh){var d=B1(c);if(d===null)N1(n,s,c,Zh,r),iv(n,c);else if(Px(d,n,s,r,c))c.stopPropagation();else if(iv(n,c),s&4&&-1<Lx.indexOf(n)){for(;d!==null;){var h=P(d);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var x=Nt(h.pendingLanes);if(x!==0){var C=h;for(C.pendingLanes|=2,C.entangledLanes|=2;x;){var z=1<<31-Re(x);C.entanglements[1]|=z,x&=~z}qi(h),(vn&6)===0&&(Dh=ke()+500,Id(0))}}break;case 31:case 13:C=mr(h,2),C!==null&&_a(C,h,2),Ih(),U1(h,2)}if(h=B1(c),h===null&&N1(n,s,c,Zh,r),h===d)break;d=h}d!==null&&c.stopPropagation()}else N1(n,s,c,null,r)}}function B1(n){return n=ar(n),H1(n)}var Zh=null;function H1(n){if(Zh=null,n=Wn(n),n!==null){var s=u(n);if(s===null)n=null;else{var r=s.tag;if(r===13){if(n=f(s),n!==null)return n;n=null}else if(r===31){if(n=m(s),n!==null)return n;n=null}else if(r===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;n=null}else s!==n&&(n=null)}}return Zh=n,null}function av(n){switch(n){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(Z()){case me:return 2;case Ce:return 8;case Oe:case le:return 32;case Ae:return 268435456;default:return 32}default:return 32}}var $1=!1,Cl=null,Tl=null,Ml=null,$d=new Map,Fd=new Map,Rl=[],Lx="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 iv(n,s){switch(n){case"focusin":case"focusout":Cl=null;break;case"dragenter":case"dragleave":Tl=null;break;case"mouseover":case"mouseout":Ml=null;break;case"pointerover":case"pointerout":$d.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Fd.delete(s.pointerId)}}function qd(n,s,r,c,d,h){return n===null||n.nativeEvent!==h?(n={blockedOn:s,domEventName:r,eventSystemFlags:c,nativeEvent:h,targetContainers:[d]},s!==null&&(s=P(s),s!==null&&nv(s)),n):(n.eventSystemFlags|=c,s=n.targetContainers,d!==null&&s.indexOf(d)===-1&&s.push(d),n)}function Px(n,s,r,c,d){switch(s){case"focusin":return Cl=qd(Cl,n,s,r,c,d),!0;case"dragenter":return Tl=qd(Tl,n,s,r,c,d),!0;case"mouseover":return Ml=qd(Ml,n,s,r,c,d),!0;case"pointerover":var h=d.pointerId;return $d.set(h,qd($d.get(h)||null,n,s,r,c,d)),!0;case"gotpointercapture":return h=d.pointerId,Fd.set(h,qd(Fd.get(h)||null,n,s,r,c,d)),!0}return!1}function rv(n){var s=Wn(n.target);if(s!==null){var r=u(s);if(r!==null){if(s=r.tag,s===13){if(s=f(r),s!==null){n.blockedOn=s,Ie(n.priority,function(){sv(r)});return}}else if(s===31){if(s=m(r),s!==null){n.blockedOn=s,Ie(n.priority,function(){sv(r)});return}}else if(s===3&&r.stateNode.current.memoizedState.isDehydrated){n.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}n.blockedOn=null}function Xh(n){if(n.blockedOn!==null)return!1;for(var s=n.targetContainers;0<s.length;){var r=B1(n.nativeEvent);if(r===null){r=n.nativeEvent;var c=new r.constructor(r.type,r);Ha=c,r.target.dispatchEvent(c),Ha=null}else return s=P(r),s!==null&&nv(s),n.blockedOn=r,!1;s.shift()}return!0}function lv(n,s,r){Xh(n)&&r.delete(s)}function Ux(){$1=!1,Cl!==null&&Xh(Cl)&&(Cl=null),Tl!==null&&Xh(Tl)&&(Tl=null),Ml!==null&&Xh(Ml)&&(Ml=null),$d.forEach(lv),Fd.forEach(lv)}function Jh(n,s){n.blockedOn===s&&(n.blockedOn=null,$1||($1=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Ux)))}var em=null;function ov(n){em!==n&&(em=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){em===n&&(em=null);for(var s=0;s<n.length;s+=3){var r=n[s],c=n[s+1],d=n[s+2];if(typeof c!="function"){if(H1(c||r)===null)continue;break}var h=P(r);h!==null&&(n.splice(s,3),s-=3,Bp(h,{pending:!0,data:d,method:r.method,action:c},c,d))}}))}function Yc(n){function s(z){return Jh(z,n)}Cl!==null&&Jh(Cl,n),Tl!==null&&Jh(Tl,n),Ml!==null&&Jh(Ml,n),$d.forEach(s),Fd.forEach(s);for(var r=0;r<Rl.length;r++){var c=Rl[r];c.blockedOn===n&&(c.blockedOn=null)}for(;0<Rl.length&&(r=Rl[0],r.blockedOn===null);)rv(r),r.blockedOn===null&&Rl.shift();if(r=(n.ownerDocument||n).$$reactFormReplay,r!=null)for(c=0;c<r.length;c+=3){var d=r[c],h=r[c+1],x=d[Ut]||null;if(typeof h=="function")x||ov(r);else if(x){var C=null;if(h&&h.hasAttribute("formAction")){if(d=h,x=h[Ut]||null)C=x.formAction;else if(H1(d)!==null)continue}else C=x.action;typeof C=="function"?r[c+1]=C:(r.splice(c,3),c-=3),ov(r)}}}function cv(){function n(h){h.canIntercept&&h.info==="react-transition"&&h.intercept({handler:function(){return new Promise(function(x){return d=x})},focusReset:"manual",scroll:"manual"})}function s(){d!==null&&(d(),d=null),c||setTimeout(r,20)}function r(){if(!c&&!navigation.transition){var h=navigation.currentEntry;h&&h.url!=null&&navigation.navigate(h.url,{state:h.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var c=!1,d=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(r,100),function(){c=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),d!==null&&(d(),d=null)}}}function F1(n){this._internalRoot=n}tm.prototype.render=F1.prototype.render=function(n){var s=this._internalRoot;if(s===null)throw Error(l(409));var r=s.current,c=Da();ev(r,c,n,s,null,null)},tm.prototype.unmount=F1.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var s=n.containerInfo;ev(n.current,2,null,n,null,null),Ih(),s[ft]=null}};function tm(n){this._internalRoot=n}tm.prototype.unstable_scheduleHydration=function(n){if(n){var s=te();n={blockedOn:null,target:n,priority:s};for(var r=0;r<Rl.length&&s!==0&&s<Rl[r].priority;r++);Rl.splice(r,0,n),r===0&&rv(n)}};var uv=t.version;if(uv!=="19.2.4")throw Error(l(527,uv,"19.2.4"));H.findDOMNode=function(n){var s=n._reactInternals;if(s===void 0)throw typeof n.render=="function"?Error(l(188)):(n=Object.keys(n).join(","),Error(l(268,n)));return n=g(s),n=n!==null?S(n):null,n=n===null?null:n.stateNode,n};var zx={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:R,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var nm=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!nm.isDisabled&&nm.supportsFiber)try{At=nm.inject(zx),ce=nm}catch{}}return Kd.createRoot=function(n,s){if(!o(n))throw Error(l(299));var r=!1,c="",d=_8,h=y8,x=v8;return s!=null&&(s.unstable_strictMode===!0&&(r=!0),s.identifierPrefix!==void 0&&(c=s.identifierPrefix),s.onUncaughtError!==void 0&&(d=s.onUncaughtError),s.onCaughtError!==void 0&&(h=s.onCaughtError),s.onRecoverableError!==void 0&&(x=s.onRecoverableError)),s=Xy(n,1,!1,null,null,r,c,null,d,h,x,cv),n[ft]=s.current,w1(n),new F1(s)},Kd.hydrateRoot=function(n,s,r){if(!o(n))throw Error(l(299));var c=!1,d="",h=_8,x=y8,C=v8,z=null;return r!=null&&(r.unstable_strictMode===!0&&(c=!0),r.identifierPrefix!==void 0&&(d=r.identifierPrefix),r.onUncaughtError!==void 0&&(h=r.onUncaughtError),r.onCaughtError!==void 0&&(x=r.onCaughtError),r.onRecoverableError!==void 0&&(C=r.onRecoverableError),r.formState!==void 0&&(z=r.formState)),s=Xy(n,1,!0,s,r??null,c,d,z,h,x,C,cv),s.context=Jy(null),r=s.current,c=Da(),c=Fn(c),d=bi(c),d.callback=null,xi(r,d,c),r=c,s.current.lanes=r,On(s,r),qi(s),n[ft]=s.current,w1(n),new tm(s)},Kd.version="19.2.4",Kd}var Sv;function Zx(){if(Sv)return Q1.exports;Sv=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Q1.exports=Vx(),Q1.exports}var Xx=Zx(),Hu=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Jx={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Hl,O0,l2,e9=(l2=class{constructor(){gt(this,Hl,Jx);gt(this,O0,!1)}setTimeoutProvider(e){Ye(this,Hl,e)}setTimeout(e,t){return B(this,Hl).setTimeout(e,t)}clearTimeout(e){B(this,Hl).clearTimeout(e)}setInterval(e,t){return B(this,Hl).setInterval(e,t)}clearInterval(e){B(this,Hl).clearInterval(e)}},Hl=new WeakMap,O0=new WeakMap,l2),Po=new e9;function t9(e){setTimeout(e,0)}var tc=typeof window>"u"||"Deno"in globalThis;function ys(){}function n9(e,t){return typeof e=="function"?e(t):e}function Dg(e){return typeof e=="number"&&e>=0&&e!==1/0}function b2(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Xl(e,t){return typeof e=="function"?e(t):e}function ni(e,t){return typeof e=="function"?e(t):e}function jv(e,t){const{type:a="all",exact:l,fetchStatus:o,predicate:u,queryKey:f,stale:m}=e;if(f){if(l){if(t.queryHash!==I0(f,t.options))return!1}else if(!yf(t.queryKey,f))return!1}if(a!=="all"){const y=t.isActive();if(a==="active"&&!y||a==="inactive"&&y)return!1}return!(typeof m=="boolean"&&t.isStale()!==m||o&&o!==t.state.fetchStatus||u&&!u(t))}function wv(e,t){const{exact:a,status:l,predicate:o,mutationKey:u}=e;if(u){if(!t.options.mutationKey)return!1;if(a){if(nc(t.options.mutationKey)!==nc(u))return!1}else if(!yf(t.options.mutationKey,u))return!1}return!(l&&t.state.status!==l||o&&!o(t))}function I0(e,t){return((t==null?void 0:t.queryKeyHashFn)||nc)(e)}function nc(e){return JSON.stringify(e,(t,a)=>Og(a)?Object.keys(a).sort().reduce((l,o)=>(l[o]=a[o],l),{}):a)}function yf(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(a=>yf(e[a],t[a])):!1}var s9=Object.prototype.hasOwnProperty;function x2(e,t,a=0){if(e===t)return e;if(a>500)return t;const l=Nv(e)&&Nv(t);if(!l&&!(Og(e)&&Og(t)))return t;const u=(l?e:Object.keys(e)).length,f=l?t:Object.keys(t),m=f.length,y=l?new Array(m):{};let g=0;for(let S=0;S<m;S++){const p=l?S:f[S],v=e[p],w=t[p];if(v===w){y[p]=v,(l?S<u:s9.call(e,p))&&g++;continue}if(v===null||w===null||typeof v!="object"||typeof w!="object"){y[p]=w;continue}const N=x2(v,w,a+1);y[p]=N,N===v&&g++}return u===m&&g===u?e:y}function Om(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const a in e)if(e[a]!==t[a])return!1;return!0}function Nv(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Og(e){if(!kv(e))return!1;const t=e.constructor;if(t===void 0)return!0;const a=t.prototype;return!(!kv(a)||!a.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function kv(e){return Object.prototype.toString.call(e)==="[object Object]"}function a9(e){return new Promise(t=>{Po.setTimeout(t,e)})}function Ig(e,t,a){return typeof a.structuralSharing=="function"?a.structuralSharing(e,t):a.structuralSharing!==!1?x2(e,t):t}function i9(e){return e}function r9(e,t,a=0){const l=[...e,t];return a&&l.length>a?l.slice(1):l}function l9(e,t,a=0){const l=[t,...e];return a&&l.length>a?l.slice(0,-1):l}var L0=Symbol();function S2(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===L0?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function P0(e,t){return typeof e=="function"?e(...t):!!e}function o9(e,t,a){let l=!1,o;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(o??(o=t()),l||(l=!0,o.aborted?a():o.addEventListener("abort",a,{once:!0})),o)}),e}var Ho,$l,mu,o2,c9=(o2=class extends Hu{constructor(){super();gt(this,Ho);gt(this,$l);gt(this,mu);Ye(this,mu,t=>{if(!tc&&window.addEventListener){const a=()=>t();return window.addEventListener("visibilitychange",a,!1),()=>{window.removeEventListener("visibilitychange",a)}}})}onSubscribe(){B(this,$l)||this.setEventListener(B(this,mu))}onUnsubscribe(){var t;this.hasListeners()||((t=B(this,$l))==null||t.call(this),Ye(this,$l,void 0))}setEventListener(t){var a;Ye(this,mu,t),(a=B(this,$l))==null||a.call(this),Ye(this,$l,t(l=>{typeof l=="boolean"?this.setFocused(l):this.onFocus()}))}setFocused(t){B(this,Ho)!==t&&(Ye(this,Ho,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(a=>{a(t)})}isFocused(){var t;return typeof B(this,Ho)=="boolean"?B(this,Ho):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Ho=new WeakMap,$l=new WeakMap,mu=new WeakMap,o2),U0=new c9;function Lg(){let e,t;const a=new Promise((o,u)=>{e=o,t=u});a.status="pending",a.catch(()=>{});function l(o){Object.assign(a,o),delete a.resolve,delete a.reject}return a.resolve=o=>{l({status:"fulfilled",value:o}),e(o)},a.reject=o=>{l({status:"rejected",reason:o}),t(o)},a}function u9(e){var a;let t;if((a=e.then(l=>(t=l,l),ys))==null||a.catch(ys),t!==void 0)return{data:t}}function j2(e){return e}function d9(e){return{mutationKey:e.options.mutationKey,state:e.state,...e.options.scope&&{scope:e.options.scope},...e.meta&&{meta:e.meta}}}function f9(e,t,a){const l=()=>{var u;const o=(u=e.promise)==null?void 0:u.then(t).catch(f=>a(f)?Promise.reject(new Error("redacted")):Promise.reject(f));return o==null||o.catch(ys),o};return{dehydratedAt:Date.now(),state:{...e.state,...e.state.data!==void 0&&{data:t(e.state.data)}},queryKey:e.queryKey,queryHash:e.queryHash,...e.state.status==="pending"&&{promise:l()},...e.meta&&{meta:e.meta}}}function h9(e){return e.state.isPaused}function m9(e){return e.state.status==="success"}function p9(e){return!0}function g9(e,t={}){var y,g,S,p;const a=t.shouldDehydrateMutation??((y=e.getDefaultOptions().dehydrate)==null?void 0:y.shouldDehydrateMutation)??h9,l=e.getMutationCache().getAll().flatMap(v=>a(v)?[d9(v)]:[]),o=t.shouldDehydrateQuery??((g=e.getDefaultOptions().dehydrate)==null?void 0:g.shouldDehydrateQuery)??m9,u=t.shouldRedactErrors??((S=e.getDefaultOptions().dehydrate)==null?void 0:S.shouldRedactErrors)??p9,f=t.serializeData??((p=e.getDefaultOptions().dehydrate)==null?void 0:p.serializeData)??j2,m=e.getQueryCache().getAll().flatMap(v=>o(v)?[f9(v,f,u)]:[]);return{mutations:l,queries:m}}function _9(e,t,a){var y;if(typeof t!="object"||t===null)return;const l=e.getMutationCache(),o=e.getQueryCache(),u=((y=e.getDefaultOptions().hydrate)==null?void 0:y.deserializeData)??j2,f=t.mutations||[],m=t.queries||[];f.forEach(({state:g,...S})=>{var p,v;l.build(e,{...(p=e.getDefaultOptions().hydrate)==null?void 0:p.mutations,...(v=a==null?void 0:a.defaultOptions)==null?void 0:v.mutations,...S},g)}),m.forEach(({queryKey:g,state:S,queryHash:p,meta:v,promise:w,dehydratedAt:N})=>{var L,W;const j=w?u9(w):void 0,T=S.data===void 0?j==null?void 0:j.data:S.data,A=T===void 0?T:u(T);let U=o.get(p);const I=(U==null?void 0:U.state.status)==="pending",E=(U==null?void 0:U.state.fetchStatus)==="fetching";if(U){const ee=j&&N!==void 0&&N>U.state.dataUpdatedAt;if(S.dataUpdatedAt>U.state.dataUpdatedAt||ee){const{fetchStatus:F,...G}=S;U.setState({...G,data:A})}}else U=o.build(e,{...(L=e.getDefaultOptions().hydrate)==null?void 0:L.queries,...(W=a==null?void 0:a.defaultOptions)==null?void 0:W.queries,queryKey:g,queryHash:p,meta:v},{...S,data:A,fetchStatus:"idle",status:A!==void 0?"success":S.status});w&&!I&&!E&&(N===void 0||N>U.state.dataUpdatedAt)&&U.fetch(void 0,{initialPromise:Promise.resolve(w).then(u)}).catch(ys)})}var y9=t9;function v9(){let e=[],t=0,a=m=>{m()},l=m=>{m()},o=y9;const u=m=>{t?e.push(m):o(()=>{a(m)})},f=()=>{const m=e;e=[],m.length&&o(()=>{l(()=>{m.forEach(y=>{a(y)})})})};return{batch:m=>{let y;t++;try{y=m()}finally{t--,t||f()}return y},batchCalls:m=>(...y)=>{u(()=>{m(...y)})},schedule:u,setNotifyFunction:m=>{a=m},setBatchNotifyFunction:m=>{l=m},setScheduler:m=>{o=m}}}var vs=v9(),pu,Fl,gu,c2,b9=(c2=class extends Hu{constructor(){super();gt(this,pu,!0);gt(this,Fl);gt(this,gu);Ye(this,gu,t=>{if(!tc&&window.addEventListener){const a=()=>t(!0),l=()=>t(!1);return window.addEventListener("online",a,!1),window.addEventListener("offline",l,!1),()=>{window.removeEventListener("online",a),window.removeEventListener("offline",l)}}})}onSubscribe(){B(this,Fl)||this.setEventListener(B(this,gu))}onUnsubscribe(){var t;this.hasListeners()||((t=B(this,Fl))==null||t.call(this),Ye(this,Fl,void 0))}setEventListener(t){var a;Ye(this,gu,t),(a=B(this,Fl))==null||a.call(this),Ye(this,Fl,t(this.setOnline.bind(this)))}setOnline(t){B(this,pu)!==t&&(Ye(this,pu,t),this.listeners.forEach(l=>{l(t)}))}isOnline(){return B(this,pu)}},pu=new WeakMap,Fl=new WeakMap,gu=new WeakMap,c2),Im=new b9;function x9(e){return Math.min(1e3*2**e,3e4)}function w2(e){return(e??"online")==="online"?Im.isOnline():!0}var Pg=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function N2(e){let t=!1,a=0,l;const o=Lg(),u=()=>o.status!=="pending",f=j=>{var T;if(!u()){const A=new Pg(j);v(A),(T=e.onCancel)==null||T.call(e,A)}},m=()=>{t=!0},y=()=>{t=!1},g=()=>U0.isFocused()&&(e.networkMode==="always"||Im.isOnline())&&e.canRun(),S=()=>w2(e.networkMode)&&e.canRun(),p=j=>{u()||(l==null||l(),o.resolve(j))},v=j=>{u()||(l==null||l(),o.reject(j))},w=()=>new Promise(j=>{var T;l=A=>{(u()||g())&&j(A)},(T=e.onPause)==null||T.call(e)}).then(()=>{var j;l=void 0,u()||(j=e.onContinue)==null||j.call(e)}),N=()=>{if(u())return;let j;const T=a===0?e.initialPromise:void 0;try{j=T??e.fn()}catch(A){j=Promise.reject(A)}Promise.resolve(j).then(p).catch(A=>{var W;if(u())return;const U=e.retry??(tc?0:3),I=e.retryDelay??x9,E=typeof I=="function"?I(a,A):I,L=U===!0||typeof U=="number"&&a<U||typeof U=="function"&&U(a,A);if(t||!L){v(A);return}a++,(W=e.onFail)==null||W.call(e,a,A),a9(E).then(()=>g()?void 0:w()).then(()=>{t?v(A):N()})})};return{promise:o,status:()=>o.status,cancel:f,continue:()=>(l==null||l(),o),cancelRetry:m,continueRetry:y,canStart:S,start:()=>(S()?N():w().then(N),o)}}var $o,u2,k2=(u2=class{constructor(){gt(this,$o)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Dg(this.gcTime)&&Ye(this,$o,Po.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(tc?1/0:300*1e3))}clearGcTimeout(){B(this,$o)&&(Po.clearTimeout(B(this,$o)),Ye(this,$o,void 0))}},$o=new WeakMap,u2),Fo,_u,ti,qo,Cs,Df,Wo,wi,Or,d2,S9=(d2=class extends k2{constructor(t){super();gt(this,wi);gt(this,Fo);gt(this,_u);gt(this,ti);gt(this,qo);gt(this,Cs);gt(this,Df);gt(this,Wo);Ye(this,Wo,!1),Ye(this,Df,t.defaultOptions),this.setOptions(t.options),this.observers=[],Ye(this,qo,t.client),Ye(this,ti,B(this,qo).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Ye(this,Fo,Cv(this.options)),this.state=t.state??B(this,Fo),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=B(this,Cs))==null?void 0:t.promise}setOptions(t){if(this.options={...B(this,Df),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const a=Cv(this.options);a.data!==void 0&&(this.setState(Ev(a.data,a.dataUpdatedAt)),Ye(this,Fo,a))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&B(this,ti).remove(this)}setData(t,a){const l=Ig(this.state.data,t,this.options);return $t(this,wi,Or).call(this,{data:l,type:"success",dataUpdatedAt:a==null?void 0:a.updatedAt,manual:a==null?void 0:a.manual}),l}setState(t,a){$t(this,wi,Or).call(this,{type:"setState",state:t,setStateOptions:a})}cancel(t){var l,o;const a=(l=B(this,Cs))==null?void 0:l.promise;return(o=B(this,Cs))==null||o.cancel(t),a?a.then(ys).catch(ys):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(B(this,Fo))}isActive(){return this.observers.some(t=>ni(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===L0||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Xl(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!b2(this.state.dataUpdatedAt,t)}onFocus(){var a;const t=this.observers.find(l=>l.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(a=B(this,Cs))==null||a.continue()}onOnline(){var a;const t=this.observers.find(l=>l.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(a=B(this,Cs))==null||a.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),B(this,ti).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(a=>a!==t),this.observers.length||(B(this,Cs)&&(B(this,Wo)?B(this,Cs).cancel({revert:!0}):B(this,Cs).cancelRetry()),this.scheduleGc()),B(this,ti).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||$t(this,wi,Or).call(this,{type:"invalidate"})}async fetch(t,a){var y,g,S,p,v,w,N,j,T,A,U,I;if(this.state.fetchStatus!=="idle"&&((y=B(this,Cs))==null?void 0:y.status())!=="rejected"){if(this.state.data!==void 0&&(a!=null&&a.cancelRefetch))this.cancel({silent:!0});else if(B(this,Cs))return B(this,Cs).continueRetry(),B(this,Cs).promise}if(t&&this.setOptions(t),!this.options.queryFn){const E=this.observers.find(L=>L.options.queryFn);E&&this.setOptions(E.options)}const l=new AbortController,o=E=>{Object.defineProperty(E,"signal",{enumerable:!0,get:()=>(Ye(this,Wo,!0),l.signal)})},u=()=>{const E=S2(this.options,a),W=(()=>{const ee={client:B(this,qo),queryKey:this.queryKey,meta:this.meta};return o(ee),ee})();return Ye(this,Wo,!1),this.options.persister?this.options.persister(E,W,this):E(W)},m=(()=>{const E={fetchOptions:a,options:this.options,queryKey:this.queryKey,client:B(this,qo),state:this.state,fetchFn:u};return o(E),E})();(g=this.options.behavior)==null||g.onFetch(m,this),Ye(this,_u,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((S=m.fetchOptions)==null?void 0:S.meta))&&$t(this,wi,Or).call(this,{type:"fetch",meta:(p=m.fetchOptions)==null?void 0:p.meta}),Ye(this,Cs,N2({initialPromise:a==null?void 0:a.initialPromise,fn:m.fetchFn,onCancel:E=>{E instanceof Pg&&E.revert&&this.setState({...B(this,_u),fetchStatus:"idle"}),l.abort()},onFail:(E,L)=>{$t(this,wi,Or).call(this,{type:"failed",failureCount:E,error:L})},onPause:()=>{$t(this,wi,Or).call(this,{type:"pause"})},onContinue:()=>{$t(this,wi,Or).call(this,{type:"continue"})},retry:m.options.retry,retryDelay:m.options.retryDelay,networkMode:m.options.networkMode,canRun:()=>!0}));try{const E=await B(this,Cs).start();if(E===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(E),(w=(v=B(this,ti).config).onSuccess)==null||w.call(v,E,this),(j=(N=B(this,ti).config).onSettled)==null||j.call(N,E,this.state.error,this),E}catch(E){if(E instanceof Pg){if(E.silent)return B(this,Cs).promise;if(E.revert){if(this.state.data===void 0)throw E;return this.state.data}}throw $t(this,wi,Or).call(this,{type:"error",error:E}),(A=(T=B(this,ti).config).onError)==null||A.call(T,E,this),(I=(U=B(this,ti).config).onSettled)==null||I.call(U,this.state.data,E,this),E}finally{this.scheduleGc()}}},Fo=new WeakMap,_u=new WeakMap,ti=new WeakMap,qo=new WeakMap,Cs=new WeakMap,Df=new WeakMap,Wo=new WeakMap,wi=new WeakSet,Or=function(t){const a=l=>{switch(t.type){case"failed":return{...l,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...l,fetchStatus:"paused"};case"continue":return{...l,fetchStatus:"fetching"};case"fetch":return{...l,...E2(l.data,this.options),fetchMeta:t.meta??null};case"success":const o={...l,...Ev(t.data,t.dataUpdatedAt),dataUpdateCount:l.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Ye(this,_u,t.manual?o:void 0),o;case"error":const u=t.error;return{...l,error:u,errorUpdateCount:l.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:l.fetchFailureCount+1,fetchFailureReason:u,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...l,isInvalidated:!0};case"setState":return{...l,...t.state}}};this.state=a(this.state),vs.batch(()=>{this.observers.forEach(l=>{l.onQueryUpdate()}),B(this,ti).notify({query:this,type:"updated",action:t})})},d2);function E2(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:w2(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Ev(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Cv(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,a=t!==void 0,l=a?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:a?l??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:a?"success":"pending",fetchStatus:"idle"}}var va,rn,Of,ta,Ko,yu,Pr,ql,If,vu,bu,Qo,Go,Wl,xu,Sn,nf,Ug,zg,Bg,Hg,$g,Fg,qg,C2,f2,j9=(f2=class extends Hu{constructor(t,a){super();gt(this,Sn);gt(this,va);gt(this,rn);gt(this,Of);gt(this,ta);gt(this,Ko);gt(this,yu);gt(this,Pr);gt(this,ql);gt(this,If);gt(this,vu);gt(this,bu);gt(this,Qo);gt(this,Go);gt(this,Wl);gt(this,xu,new Set);this.options=a,Ye(this,va,t),Ye(this,ql,null),Ye(this,Pr,Lg()),this.bindMethods(),this.setOptions(a)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(B(this,rn).addObserver(this),Tv(B(this,rn),this.options)?$t(this,Sn,nf).call(this):this.updateResult(),$t(this,Sn,Hg).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Wg(B(this,rn),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Wg(B(this,rn),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,$t(this,Sn,$g).call(this),$t(this,Sn,Fg).call(this),B(this,rn).removeObserver(this)}setOptions(t){const a=this.options,l=B(this,rn);if(this.options=B(this,va).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ni(this.options.enabled,B(this,rn))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");$t(this,Sn,qg).call(this),B(this,rn).setOptions(this.options),a._defaulted&&!Om(this.options,a)&&B(this,va).getQueryCache().notify({type:"observerOptionsUpdated",query:B(this,rn),observer:this});const o=this.hasListeners();o&&Mv(B(this,rn),l,this.options,a)&&$t(this,Sn,nf).call(this),this.updateResult(),o&&(B(this,rn)!==l||ni(this.options.enabled,B(this,rn))!==ni(a.enabled,B(this,rn))||Xl(this.options.staleTime,B(this,rn))!==Xl(a.staleTime,B(this,rn)))&&$t(this,Sn,Ug).call(this);const u=$t(this,Sn,zg).call(this);o&&(B(this,rn)!==l||ni(this.options.enabled,B(this,rn))!==ni(a.enabled,B(this,rn))||u!==B(this,Wl))&&$t(this,Sn,Bg).call(this,u)}getOptimisticResult(t){const a=B(this,va).getQueryCache().build(B(this,va),t),l=this.createResult(a,t);return N9(this,l)&&(Ye(this,ta,l),Ye(this,yu,this.options),Ye(this,Ko,B(this,rn).state)),l}getCurrentResult(){return B(this,ta)}trackResult(t,a){return new Proxy(t,{get:(l,o)=>(this.trackProp(o),a==null||a(o),o==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&B(this,Pr).status==="pending"&&B(this,Pr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(l,o))})}trackProp(t){B(this,xu).add(t)}getCurrentQuery(){return B(this,rn)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const a=B(this,va).defaultQueryOptions(t),l=B(this,va).getQueryCache().build(B(this,va),a);return l.fetch().then(()=>this.createResult(l,a))}fetch(t){return $t(this,Sn,nf).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),B(this,ta)))}createResult(t,a){var G;const l=B(this,rn),o=this.options,u=B(this,ta),f=B(this,Ko),m=B(this,yu),g=t!==l?t.state:B(this,Of),{state:S}=t;let p={...S},v=!1,w;if(a._optimisticResults){const Q=this.hasListeners(),Y=!Q&&Tv(t,a),pe=Q&&Mv(t,l,a,o);(Y||pe)&&(p={...p,...E2(S.data,t.options)}),a._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:N,errorUpdatedAt:j,status:T}=p;w=p.data;let A=!1;if(a.placeholderData!==void 0&&w===void 0&&T==="pending"){let Q;u!=null&&u.isPlaceholderData&&a.placeholderData===(m==null?void 0:m.placeholderData)?(Q=u.data,A=!0):Q=typeof a.placeholderData=="function"?a.placeholderData((G=B(this,bu))==null?void 0:G.state.data,B(this,bu)):a.placeholderData,Q!==void 0&&(T="success",w=Ig(u==null?void 0:u.data,Q,a),v=!0)}if(a.select&&w!==void 0&&!A)if(u&&w===(f==null?void 0:f.data)&&a.select===B(this,If))w=B(this,vu);else try{Ye(this,If,a.select),w=a.select(w),w=Ig(u==null?void 0:u.data,w,a),Ye(this,vu,w),Ye(this,ql,null)}catch(Q){Ye(this,ql,Q)}B(this,ql)&&(N=B(this,ql),w=B(this,vu),j=Date.now(),T="error");const U=p.fetchStatus==="fetching",I=T==="pending",E=T==="error",L=I&&U,W=w!==void 0,F={status:T,fetchStatus:p.fetchStatus,isPending:I,isSuccess:T==="success",isError:E,isInitialLoading:L,isLoading:L,data:w,dataUpdatedAt:p.dataUpdatedAt,error:N,errorUpdatedAt:j,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:p.dataUpdateCount>0||p.errorUpdateCount>0,isFetchedAfterMount:p.dataUpdateCount>g.dataUpdateCount||p.errorUpdateCount>g.errorUpdateCount,isFetching:U,isRefetching:U&&!I,isLoadingError:E&&!W,isPaused:p.fetchStatus==="paused",isPlaceholderData:v,isRefetchError:E&&W,isStale:z0(t,a),refetch:this.refetch,promise:B(this,Pr),isEnabled:ni(a.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const Q=F.data!==void 0,Y=F.status==="error"&&!Q,pe=ye=>{Y?ye.reject(F.error):Q&&ye.resolve(F.data)},ne=()=>{const ye=Ye(this,Pr,F.promise=Lg());pe(ye)},V=B(this,Pr);switch(V.status){case"pending":t.queryHash===l.queryHash&&pe(V);break;case"fulfilled":(Y||F.data!==V.value)&&ne();break;case"rejected":(!Y||F.error!==V.reason)&&ne();break}}return F}updateResult(){const t=B(this,ta),a=this.createResult(B(this,rn),this.options);if(Ye(this,Ko,B(this,rn).state),Ye(this,yu,this.options),B(this,Ko).data!==void 0&&Ye(this,bu,B(this,rn)),Om(a,t))return;Ye(this,ta,a);const l=()=>{if(!t)return!0;const{notifyOnChangeProps:o}=this.options,u=typeof o=="function"?o():o;if(u==="all"||!u&&!B(this,xu).size)return!0;const f=new Set(u??B(this,xu));return this.options.throwOnError&&f.add("error"),Object.keys(B(this,ta)).some(m=>{const y=m;return B(this,ta)[y]!==t[y]&&f.has(y)})};$t(this,Sn,C2).call(this,{listeners:l()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&$t(this,Sn,Hg).call(this)}},va=new WeakMap,rn=new WeakMap,Of=new WeakMap,ta=new WeakMap,Ko=new WeakMap,yu=new WeakMap,Pr=new WeakMap,ql=new WeakMap,If=new WeakMap,vu=new WeakMap,bu=new WeakMap,Qo=new WeakMap,Go=new WeakMap,Wl=new WeakMap,xu=new WeakMap,Sn=new WeakSet,nf=function(t){$t(this,Sn,qg).call(this);let a=B(this,rn).fetch(this.options,t);return t!=null&&t.throwOnError||(a=a.catch(ys)),a},Ug=function(){$t(this,Sn,$g).call(this);const t=Xl(this.options.staleTime,B(this,rn));if(tc||B(this,ta).isStale||!Dg(t))return;const l=b2(B(this,ta).dataUpdatedAt,t)+1;Ye(this,Qo,Po.setTimeout(()=>{B(this,ta).isStale||this.updateResult()},l))},zg=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(B(this,rn)):this.options.refetchInterval)??!1},Bg=function(t){$t(this,Sn,Fg).call(this),Ye(this,Wl,t),!(tc||ni(this.options.enabled,B(this,rn))===!1||!Dg(B(this,Wl))||B(this,Wl)===0)&&Ye(this,Go,Po.setInterval(()=>{(this.options.refetchIntervalInBackground||U0.isFocused())&&$t(this,Sn,nf).call(this)},B(this,Wl)))},Hg=function(){$t(this,Sn,Ug).call(this),$t(this,Sn,Bg).call(this,$t(this,Sn,zg).call(this))},$g=function(){B(this,Qo)&&(Po.clearTimeout(B(this,Qo)),Ye(this,Qo,void 0))},Fg=function(){B(this,Go)&&(Po.clearInterval(B(this,Go)),Ye(this,Go,void 0))},qg=function(){const t=B(this,va).getQueryCache().build(B(this,va),this.options);if(t===B(this,rn))return;const a=B(this,rn);Ye(this,rn,t),Ye(this,Of,t.state),this.hasListeners()&&(a==null||a.removeObserver(this),t.addObserver(this))},C2=function(t){vs.batch(()=>{t.listeners&&this.listeners.forEach(a=>{a(B(this,ta))}),B(this,va).getQueryCache().notify({query:B(this,rn),type:"observerResultsUpdated"})})},f2);function w9(e,t){return ni(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Tv(e,t){return w9(e,t)||e.state.data!==void 0&&Wg(e,t,t.refetchOnMount)}function Wg(e,t,a){if(ni(t.enabled,e)!==!1&&Xl(t.staleTime,e)!=="static"){const l=typeof a=="function"?a(e):a;return l==="always"||l!==!1&&z0(e,t)}return!1}function Mv(e,t,a,l){return(e!==t||ni(l.enabled,e)===!1)&&(!a.suspense||e.state.status!=="error")&&z0(e,a)}function z0(e,t){return ni(t.enabled,e)!==!1&&e.isStaleByTime(Xl(t.staleTime,e))}function N9(e,t){return!Om(e.getCurrentResult(),t)}function Rv(e){return{onFetch:(t,a)=>{var S,p,v,w,N;const l=t.options,o=(v=(p=(S=t.fetchOptions)==null?void 0:S.meta)==null?void 0:p.fetchMore)==null?void 0:v.direction,u=((w=t.state.data)==null?void 0:w.pages)||[],f=((N=t.state.data)==null?void 0:N.pageParams)||[];let m={pages:[],pageParams:[]},y=0;const g=async()=>{let j=!1;const T=I=>{o9(I,()=>t.signal,()=>j=!0)},A=S2(t.options,t.fetchOptions),U=async(I,E,L)=>{if(j)return Promise.reject();if(E==null&&I.pages.length)return Promise.resolve(I);const ee=(()=>{const Y={client:t.client,queryKey:t.queryKey,pageParam:E,direction:L?"backward":"forward",meta:t.options.meta};return T(Y),Y})(),F=await A(ee),{maxPages:G}=t.options,Q=L?l9:r9;return{pages:Q(I.pages,F,G),pageParams:Q(I.pageParams,E,G)}};if(o&&u.length){const I=o==="backward",E=I?k9:Av,L={pages:u,pageParams:f},W=E(l,L);m=await U(L,W,I)}else{const I=e??u.length;do{const E=y===0?f[0]??l.initialPageParam:Av(l,m);if(y>0&&E==null)break;m=await U(m,E),y++}while(y<I)}return m};t.options.persister?t.fetchFn=()=>{var j,T;return(T=(j=t.options).persister)==null?void 0:T.call(j,g,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},a)}:t.fetchFn=g}}}function Av(e,{pages:t,pageParams:a}){const l=t.length-1;return t.length>0?e.getNextPageParam(t[l],t,a[l],a):void 0}function k9(e,{pages:t,pageParams:a}){var l;return t.length>0?(l=e.getPreviousPageParam)==null?void 0:l.call(e,t[0],t,a[0],a):void 0}var Lf,Qi,Gs,Yo,Gi,Pl,h2,E9=(h2=class extends k2{constructor(t){super();gt(this,Gi);gt(this,Lf);gt(this,Qi);gt(this,Gs);gt(this,Yo);Ye(this,Lf,t.client),this.mutationId=t.mutationId,Ye(this,Gs,t.mutationCache),Ye(this,Qi,[]),this.state=t.state||T2(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){B(this,Qi).includes(t)||(B(this,Qi).push(t),this.clearGcTimeout(),B(this,Gs).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Ye(this,Qi,B(this,Qi).filter(a=>a!==t)),this.scheduleGc(),B(this,Gs).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){B(this,Qi).length||(this.state.status==="pending"?this.scheduleGc():B(this,Gs).remove(this))}continue(){var t;return((t=B(this,Yo))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var f,m,y,g,S,p,v,w,N,j,T,A,U,I,E,L,W,ee;const a=()=>{$t(this,Gi,Pl).call(this,{type:"continue"})},l={client:B(this,Lf),meta:this.options.meta,mutationKey:this.options.mutationKey};Ye(this,Yo,N2({fn:()=>this.options.mutationFn?this.options.mutationFn(t,l):Promise.reject(new Error("No mutationFn found")),onFail:(F,G)=>{$t(this,Gi,Pl).call(this,{type:"failed",failureCount:F,error:G})},onPause:()=>{$t(this,Gi,Pl).call(this,{type:"pause"})},onContinue:a,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>B(this,Gs).canRun(this)}));const o=this.state.status==="pending",u=!B(this,Yo).canStart();try{if(o)a();else{$t(this,Gi,Pl).call(this,{type:"pending",variables:t,isPaused:u}),B(this,Gs).config.onMutate&&await B(this,Gs).config.onMutate(t,this,l);const G=await((m=(f=this.options).onMutate)==null?void 0:m.call(f,t,l));G!==this.state.context&&$t(this,Gi,Pl).call(this,{type:"pending",context:G,variables:t,isPaused:u})}const F=await B(this,Yo).start();return await((g=(y=B(this,Gs).config).onSuccess)==null?void 0:g.call(y,F,t,this.state.context,this,l)),await((p=(S=this.options).onSuccess)==null?void 0:p.call(S,F,t,this.state.context,l)),await((w=(v=B(this,Gs).config).onSettled)==null?void 0:w.call(v,F,null,this.state.variables,this.state.context,this,l)),await((j=(N=this.options).onSettled)==null?void 0:j.call(N,F,null,t,this.state.context,l)),$t(this,Gi,Pl).call(this,{type:"success",data:F}),F}catch(F){try{await((A=(T=B(this,Gs).config).onError)==null?void 0:A.call(T,F,t,this.state.context,this,l))}catch(G){Promise.reject(G)}try{await((I=(U=this.options).onError)==null?void 0:I.call(U,F,t,this.state.context,l))}catch(G){Promise.reject(G)}try{await((L=(E=B(this,Gs).config).onSettled)==null?void 0:L.call(E,void 0,F,this.state.variables,this.state.context,this,l))}catch(G){Promise.reject(G)}try{await((ee=(W=this.options).onSettled)==null?void 0:ee.call(W,void 0,F,t,this.state.context,l))}catch(G){Promise.reject(G)}throw $t(this,Gi,Pl).call(this,{type:"error",error:F}),F}finally{B(this,Gs).runNext(this)}}},Lf=new WeakMap,Qi=new WeakMap,Gs=new WeakMap,Yo=new WeakMap,Gi=new WeakSet,Pl=function(t){const a=l=>{switch(t.type){case"failed":return{...l,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...l,isPaused:!0};case"continue":return{...l,isPaused:!1};case"pending":return{...l,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...l,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...l,data:void 0,error:t.error,failureCount:l.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=a(this.state),vs.batch(()=>{B(this,Qi).forEach(l=>{l.onMutationUpdate(t)}),B(this,Gs).notify({mutation:this,type:"updated",action:t})})},h2);function T2(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ur,Ni,Pf,m2,C9=(m2=class extends Hu{constructor(t={}){super();gt(this,Ur);gt(this,Ni);gt(this,Pf);this.config=t,Ye(this,Ur,new Set),Ye(this,Ni,new Map),Ye(this,Pf,0)}build(t,a,l){const o=new E9({client:t,mutationCache:this,mutationId:++sm(this,Pf)._,options:t.defaultMutationOptions(a),state:l});return this.add(o),o}add(t){B(this,Ur).add(t);const a=am(t);if(typeof a=="string"){const l=B(this,Ni).get(a);l?l.push(t):B(this,Ni).set(a,[t])}this.notify({type:"added",mutation:t})}remove(t){if(B(this,Ur).delete(t)){const a=am(t);if(typeof a=="string"){const l=B(this,Ni).get(a);if(l)if(l.length>1){const o=l.indexOf(t);o!==-1&&l.splice(o,1)}else l[0]===t&&B(this,Ni).delete(a)}}this.notify({type:"removed",mutation:t})}canRun(t){const a=am(t);if(typeof a=="string"){const l=B(this,Ni).get(a),o=l==null?void 0:l.find(u=>u.state.status==="pending");return!o||o===t}else return!0}runNext(t){var l;const a=am(t);if(typeof a=="string"){const o=(l=B(this,Ni).get(a))==null?void 0:l.find(u=>u!==t&&u.state.isPaused);return(o==null?void 0:o.continue())??Promise.resolve()}else return Promise.resolve()}clear(){vs.batch(()=>{B(this,Ur).forEach(t=>{this.notify({type:"removed",mutation:t})}),B(this,Ur).clear(),B(this,Ni).clear()})}getAll(){return Array.from(B(this,Ur))}find(t){const a={exact:!0,...t};return this.getAll().find(l=>wv(a,l))}findAll(t={}){return this.getAll().filter(a=>wv(t,a))}notify(t){vs.batch(()=>{this.listeners.forEach(a=>{a(t)})})}resumePausedMutations(){const t=this.getAll().filter(a=>a.state.isPaused);return vs.batch(()=>Promise.all(t.map(a=>a.continue().catch(ys))))}},Ur=new WeakMap,Ni=new WeakMap,Pf=new WeakMap,m2);function am(e){var t;return(t=e.options.scope)==null?void 0:t.id}var zr,Kl,ba,Br,Gr,xm,Kg,p2,T9=(p2=class extends Hu{constructor(a,l){super();gt(this,Gr);gt(this,zr);gt(this,Kl);gt(this,ba);gt(this,Br);Ye(this,zr,a),this.setOptions(l),this.bindMethods(),$t(this,Gr,xm).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(a){var o;const l=this.options;this.options=B(this,zr).defaultMutationOptions(a),Om(this.options,l)||B(this,zr).getMutationCache().notify({type:"observerOptionsUpdated",mutation:B(this,ba),observer:this}),l!=null&&l.mutationKey&&this.options.mutationKey&&nc(l.mutationKey)!==nc(this.options.mutationKey)?this.reset():((o=B(this,ba))==null?void 0:o.state.status)==="pending"&&B(this,ba).setOptions(this.options)}onUnsubscribe(){var a;this.hasListeners()||(a=B(this,ba))==null||a.removeObserver(this)}onMutationUpdate(a){$t(this,Gr,xm).call(this),$t(this,Gr,Kg).call(this,a)}getCurrentResult(){return B(this,Kl)}reset(){var a;(a=B(this,ba))==null||a.removeObserver(this),Ye(this,ba,void 0),$t(this,Gr,xm).call(this),$t(this,Gr,Kg).call(this)}mutate(a,l){var o;return Ye(this,Br,l),(o=B(this,ba))==null||o.removeObserver(this),Ye(this,ba,B(this,zr).getMutationCache().build(B(this,zr),this.options)),B(this,ba).addObserver(this),B(this,ba).execute(a)}},zr=new WeakMap,Kl=new WeakMap,ba=new WeakMap,Br=new WeakMap,Gr=new WeakSet,xm=function(){var l;const a=((l=B(this,ba))==null?void 0:l.state)??T2();Ye(this,Kl,{...a,isPending:a.status==="pending",isSuccess:a.status==="success",isError:a.status==="error",isIdle:a.status==="idle",mutate:this.mutate,reset:this.reset})},Kg=function(a){vs.batch(()=>{var l,o,u,f,m,y,g,S;if(B(this,Br)&&this.hasListeners()){const p=B(this,Kl).variables,v=B(this,Kl).context,w={client:B(this,zr),meta:this.options.meta,mutationKey:this.options.mutationKey};if((a==null?void 0:a.type)==="success"){try{(o=(l=B(this,Br)).onSuccess)==null||o.call(l,a.data,p,v,w)}catch(N){Promise.reject(N)}try{(f=(u=B(this,Br)).onSettled)==null||f.call(u,a.data,null,p,v,w)}catch(N){Promise.reject(N)}}else if((a==null?void 0:a.type)==="error"){try{(y=(m=B(this,Br)).onError)==null||y.call(m,a.error,p,v,w)}catch(N){Promise.reject(N)}try{(S=(g=B(this,Br)).onSettled)==null||S.call(g,void 0,a.error,p,v,w)}catch(N){Promise.reject(N)}}}this.listeners.forEach(p=>{p(B(this,Kl))})})},p2),Yi,g2,M9=(g2=class extends Hu{constructor(t={}){super();gt(this,Yi);this.config=t,Ye(this,Yi,new Map)}build(t,a,l){const o=a.queryKey,u=a.queryHash??I0(o,a);let f=this.get(u);return f||(f=new S9({client:t,queryKey:o,queryHash:u,options:t.defaultQueryOptions(a),state:l,defaultOptions:t.getQueryDefaults(o)}),this.add(f)),f}add(t){B(this,Yi).has(t.queryHash)||(B(this,Yi).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const a=B(this,Yi).get(t.queryHash);a&&(t.destroy(),a===t&&B(this,Yi).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){vs.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return B(this,Yi).get(t)}getAll(){return[...B(this,Yi).values()]}find(t){const a={exact:!0,...t};return this.getAll().find(l=>jv(a,l))}findAll(t={}){const a=this.getAll();return Object.keys(t).length>0?a.filter(l=>jv(t,l)):a}notify(t){vs.batch(()=>{this.listeners.forEach(a=>{a(t)})})}onFocus(){vs.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){vs.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Yi=new WeakMap,g2),ns,Ql,Gl,Su,ju,Yl,wu,Nu,_2,R9=(_2=class{constructor(e={}){gt(this,ns);gt(this,Ql);gt(this,Gl);gt(this,Su);gt(this,ju);gt(this,Yl);gt(this,wu);gt(this,Nu);Ye(this,ns,e.queryCache||new M9),Ye(this,Ql,e.mutationCache||new C9),Ye(this,Gl,e.defaultOptions||{}),Ye(this,Su,new Map),Ye(this,ju,new Map),Ye(this,Yl,0)}mount(){sm(this,Yl)._++,B(this,Yl)===1&&(Ye(this,wu,U0.subscribe(async e=>{e&&(await this.resumePausedMutations(),B(this,ns).onFocus())})),Ye(this,Nu,Im.subscribe(async e=>{e&&(await this.resumePausedMutations(),B(this,ns).onOnline())})))}unmount(){var e,t;sm(this,Yl)._--,B(this,Yl)===0&&((e=B(this,wu))==null||e.call(this),Ye(this,wu,void 0),(t=B(this,Nu))==null||t.call(this),Ye(this,Nu,void 0))}isFetching(e){return B(this,ns).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return B(this,Ql).findAll({...e,status:"pending"}).length}getQueryData(e){var a;const t=this.defaultQueryOptions({queryKey:e});return(a=B(this,ns).get(t.queryHash))==null?void 0:a.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),a=B(this,ns).build(this,t),l=a.state.data;return l===void 0?this.fetchQuery(e):(e.revalidateIfStale&&a.isStaleByTime(Xl(t.staleTime,a))&&this.prefetchQuery(t),Promise.resolve(l))}getQueriesData(e){return B(this,ns).findAll(e).map(({queryKey:t,state:a})=>{const l=a.data;return[t,l]})}setQueryData(e,t,a){const l=this.defaultQueryOptions({queryKey:e}),o=B(this,ns).get(l.queryHash),u=o==null?void 0:o.state.data,f=n9(t,u);if(f!==void 0)return B(this,ns).build(this,l).setData(f,{...a,manual:!0})}setQueriesData(e,t,a){return vs.batch(()=>B(this,ns).findAll(e).map(({queryKey:l})=>[l,this.setQueryData(l,t,a)]))}getQueryState(e){var a;const t=this.defaultQueryOptions({queryKey:e});return(a=B(this,ns).get(t.queryHash))==null?void 0:a.state}removeQueries(e){const t=B(this,ns);vs.batch(()=>{t.findAll(e).forEach(a=>{t.remove(a)})})}resetQueries(e,t){const a=B(this,ns);return vs.batch(()=>(a.findAll(e).forEach(l=>{l.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const a={revert:!0,...t},l=vs.batch(()=>B(this,ns).findAll(e).map(o=>o.cancel(a)));return Promise.all(l).then(ys).catch(ys)}invalidateQueries(e,t={}){return vs.batch(()=>(B(this,ns).findAll(e).forEach(a=>{a.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const a={...t,cancelRefetch:t.cancelRefetch??!0},l=vs.batch(()=>B(this,ns).findAll(e).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let u=o.fetch(void 0,a);return a.throwOnError||(u=u.catch(ys)),o.state.fetchStatus==="paused"?Promise.resolve():u}));return Promise.all(l).then(ys)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const a=B(this,ns).build(this,t);return a.isStaleByTime(Xl(t.staleTime,a))?a.fetch(t):Promise.resolve(a.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ys).catch(ys)}fetchInfiniteQuery(e){return e.behavior=Rv(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ys).catch(ys)}ensureInfiniteQueryData(e){return e.behavior=Rv(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Im.isOnline()?B(this,Ql).resumePausedMutations():Promise.resolve()}getQueryCache(){return B(this,ns)}getMutationCache(){return B(this,Ql)}getDefaultOptions(){return B(this,Gl)}setDefaultOptions(e){Ye(this,Gl,e)}setQueryDefaults(e,t){B(this,Su).set(nc(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...B(this,Su).values()],a={};return t.forEach(l=>{yf(e,l.queryKey)&&Object.assign(a,l.defaultOptions)}),a}setMutationDefaults(e,t){B(this,ju).set(nc(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...B(this,ju).values()],a={};return t.forEach(l=>{yf(e,l.mutationKey)&&Object.assign(a,l.defaultOptions)}),a}defaultQueryOptions(e){if(e._defaulted)return e;const t={...B(this,Gl).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=I0(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===L0&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...B(this,Gl).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){B(this,ns).clear(),B(this,Ql).clear()}},ns=new WeakMap,Ql=new WeakMap,Gl=new WeakMap,Su=new WeakMap,ju=new WeakMap,Yl=new WeakMap,wu=new WeakMap,Nu=new WeakMap,_2),M2=_.createContext(void 0),La=e=>{const t=_.useContext(M2);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},A9=({client:e,children:t})=>(_.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),i.jsx(M2.Provider,{value:e,children:t})),R2=_.createContext(!1),D9=()=>_.useContext(R2);R2.Provider;function O9(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var I9=_.createContext(O9()),L9=()=>_.useContext(I9),P9=(e,t,a)=>{const l=a!=null&&a.state.error&&typeof e.throwOnError=="function"?P0(e.throwOnError,[a.state.error,a]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||l)&&(t.isReset()||(e.retryOnMount=!1))},U9=e=>{_.useEffect(()=>{e.clearReset()},[e])},z9=({result:e,errorResetBoundary:t,throwOnError:a,query:l,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&l&&(o&&e.data===void 0||P0(a,[e.error,l])),B9=e=>{if(e.suspense){const a=o=>o==="static"?o:Math.max(o??1e3,1e3),l=e.staleTime;e.staleTime=typeof l=="function"?(...o)=>a(l(...o)):a(l),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},H9=(e,t)=>e.isLoading&&e.isFetching&&!t,$9=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Dv=(e,t,a)=>t.fetchOptimistic(e).catch(()=>{a.clearReset()});function F9(e,t,a){var v,w,N,j;const l=D9(),o=L9(),u=La(),f=u.defaultQueryOptions(e);(w=(v=u.getDefaultOptions().queries)==null?void 0:v._experimental_beforeQuery)==null||w.call(v,f);const m=u.getQueryCache().get(f.queryHash);f._optimisticResults=l?"isRestoring":"optimistic",B9(f),P9(f,o,m),U9(o);const y=!u.getQueryCache().get(f.queryHash),[g]=_.useState(()=>new t(u,f)),S=g.getOptimisticResult(f),p=!l&&e.subscribed!==!1;if(_.useSyncExternalStore(_.useCallback(T=>{const A=p?g.subscribe(vs.batchCalls(T)):ys;return g.updateResult(),A},[g,p]),()=>g.getCurrentResult(),()=>g.getCurrentResult()),_.useEffect(()=>{g.setOptions(f)},[f,g]),$9(f,S))throw Dv(f,g,o);if(z9({result:S,errorResetBoundary:o,throwOnError:f.throwOnError,query:m,suspense:f.suspense}))throw S.error;if((j=(N=u.getDefaultOptions().queries)==null?void 0:N._experimental_afterQuery)==null||j.call(N,f,S),f.experimental_prefetchInRender&&!tc&&H9(S,l)){const T=y?Dv(f,g,o):m==null?void 0:m.promise;T==null||T.catch(ys).finally(()=>{g.updateResult()})}return f.notifyOnChangeProps?S:g.trackResult(S)}function is(e,t){return F9(e,j9)}function ss(e,t){const a=La(),[l]=_.useState(()=>new T9(a,e));_.useEffect(()=>{l.setOptions(e)},[l,e]);const o=_.useSyncExternalStore(_.useCallback(f=>l.subscribe(vs.batchCalls(f)),[l]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),u=_.useCallback((f,m)=>{l.mutate(f,m).catch(ys)},[l]);if(o.error&&P0(l.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:u,mutateAsync:o.mutate}}var im=typeof window<"u"?_.useLayoutEffect:_.useEffect;function Z1(e){const t=_.useRef({value:e,prev:null}),a=t.current.value;return e!==a&&(t.current={value:e,prev:a}),t.current.prev}function q9(e,t,a={},l={}){_.useEffect(()=>{if(!e.current||l.disabled||typeof IntersectionObserver!="function")return;const o=new IntersectionObserver(([u])=>{t(u)},a);return o.observe(e.current),()=>{o.disconnect()}},[t,a,l.disabled,e])}function W9(e){const t=_.useRef(null);return _.useImperativeHandle(e,()=>t.current,[]),t}var K9=!1;function vf(e){return e[e.length-1]}function Q9(e){return typeof e=="function"}function Vl(e,t){return Q9(e)?e(t):e}var G9=Object.prototype.hasOwnProperty,Ov=Object.prototype.propertyIsEnumerable,Y9=()=>Object.create(null),Ro=(e,t)=>Uo(e,t,Y9);function Uo(e,t,a=()=>({}),l=0){if(e===t)return e;if(l>500)return t;const o=t,u=Pv(e)&&Pv(o);if(!u&&!(Lm(e)&&Lm(o)))return o;const f=u?e:Iv(e);if(!f)return o;const m=u?o:Iv(o);if(!m)return o;const y=f.length,g=m.length,S=u?new Array(g):a();let p=0;for(let v=0;v<g;v++){const w=u?v:m[v],N=e[w],j=o[w];if(N===j){S[w]=N,(u?v<y:G9.call(e,w))&&p++;continue}if(N===null||j===null||typeof N!="object"||typeof j!="object"){S[w]=j;continue}const T=Uo(N,j,a,l+1);S[w]=T,T===N&&p++}return y===g&&p===y?e:S}function Iv(e){const t=Object.getOwnPropertyNames(e);for(const o of t)if(!Ov.call(e,o))return!1;const a=Object.getOwnPropertySymbols(e);if(a.length===0)return t;const l=t;for(const o of a){if(!Ov.call(e,o))return!1;l.push(o)}return l}function Lm(e){if(!Lv(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const a=t.prototype;return!(!Lv(a)||!a.hasOwnProperty("isPrototypeOf"))}function Lv(e){return Object.prototype.toString.call(e)==="[object Object]"}function Pv(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Vo(e,t,a){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let l=0,o=e.length;l<o;l++)if(!Vo(e[l],t[l],a))return!1;return!0}if(Lm(e)&&Lm(t)){const l=(a==null?void 0:a.ignoreUndefined)??!0;if(a!=null&&a.partial){for(const f in t)if((!l||t[f]!==void 0)&&!Vo(e[f],t[f],a))return!1;return!0}let o=0;if(!l)o=Object.keys(e).length;else for(const f in e)e[f]!==void 0&&o++;let u=0;for(const f in t)if((!l||t[f]!==void 0)&&(u++,u>o||!Vo(e[f],t[f],a)))return!1;return o===u}return!1}function ku(e){let t,a;const l=new Promise((o,u)=>{t=o,a=u});return l.status="pending",l.resolve=o=>{l.status="resolved",l.value=o,t(o),e==null||e(o)},l.reject=o=>{l.status="rejected",a(o)},l}function bf(e){return!!(e&&typeof e=="object"&&typeof e.then=="function")}function V9(e){return e.replace(/[\x00-\x1f\x7f]/g,"")}function Uv(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,a=>{try{return decodeURI(a)}catch{return a}})}return V9(t)}var Z9=["http:","https:","mailto:","tel:"];function Pm(e,t){if(!e)return!1;try{const a=new URL(e);return!t.has(a.protocol)}catch{return!1}}function Qd(e){if(!e)return{path:e,handledProtocolRelativeURL:!1};if(!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith("//"))return{path:e,handledProtocolRelativeURL:!1};const t=/%25|%5C/gi;let a=0,l="",o;for(;(o=t.exec(e))!==null;)l+=Uv(e.slice(a,o.index))+o[0],a=t.lastIndex;l=l+Uv(a?e.slice(a):e);let u=!1;return l.startsWith("//")&&(u=!0,l="/"+l.replace(/^\/+/,"")),{path:l,handledProtocolRelativeURL:u}}function X9(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Um(e){const t=new Map;let a,l;const o=u=>{u.next&&(u.prev?(u.prev.next=u.next,u.next.prev=u.prev,u.next=void 0,l&&(l.next=u,u.prev=l)):(u.next.prev=void 0,a=u.next,u.next=void 0,l&&(u.prev=l,l.next=u)),l=u)};return{get(u){const f=t.get(u);if(f)return o(f),f.value},set(u,f){if(t.size>=e&&a){const y=a;t.delete(y.key),y.next&&(a=y.next,y.next.prev=void 0),y===l&&(l=void 0)}const m=t.get(u);if(m)m.value=f,o(m);else{const y={key:u,value:f,prev:l};l&&(l.next=y),l=y,a||(a=y),t.set(u,y)}},clear(){t.clear(),a=void 0,l=void 0}}}var J9="Invariant failed";function no(e,t){if(!e)throw new Error(J9)}var zo=4,A2=5;function eS(e){const t=e.indexOf("{");if(t===-1)return null;const a=e.indexOf("}",t);return a===-1||t+1>=e.length?null:[t,a]}function B0(e,t,a=new Uint16Array(6)){const l=e.indexOf("/",t),o=l===-1?e.length:l,u=e.substring(t,o);if(!u||!u.includes("$"))return a[0]=0,a[1]=t,a[2]=t,a[3]=o,a[4]=o,a[5]=o,a;if(u==="$"){const m=e.length;return a[0]=2,a[1]=t,a[2]=t,a[3]=m,a[4]=m,a[5]=m,a}if(u.charCodeAt(0)===36)return a[0]=1,a[1]=t,a[2]=t+1,a[3]=o,a[4]=o,a[5]=o,a;const f=eS(u);if(f){const[m,y]=f,g=u.charCodeAt(m+1);if(g===45){if(m+2<u.length&&u.charCodeAt(m+2)===36){const S=m+3,p=y;if(S<p)return a[0]=3,a[1]=t+m,a[2]=t+S,a[3]=t+p,a[4]=t+y+1,a[5]=o,a}}else if(g===36){const S=m+1,p=m+2;return p===y?(a[0]=2,a[1]=t+m,a[2]=t+S,a[3]=t+p,a[4]=t+y+1,a[5]=e.length,a):(a[0]=1,a[1]=t+m,a[2]=t+p,a[3]=t+y,a[4]=t+y+1,a[5]=o,a)}}return a[0]=0,a[1]=t,a[2]=t,a[3]=o,a[4]=o,a[5]=o,a}function fp(e,t,a,l,o,u,f){var y,g,S,p,v,w,N,j,T,A,U,I,E;f==null||f(a);let m=l;{const L=a.fullPath??a.from,W=L.length,ee=((y=a.options)==null?void 0:y.caseSensitive)??e,F=!!((S=(g=a.options)==null?void 0:g.params)!=null&&S.parse&&((v=(p=a.options)==null?void 0:p.skipRouteOnParseError)!=null&&v.params));for(;m<W;){const Q=B0(L,m,t);let Y;const pe=m,ne=Q[5];switch(m=ne+1,u++,Q[0]){case 0:{const V=L.substring(Q[2],Q[3]);if(ee){const ye=(w=o.static)==null?void 0:w.get(V);if(ye)Y=ye;else{o.static??(o.static=new Map);const R=Bo(a.fullPath??a.from);R.parent=o,R.depth=u,Y=R,o.static.set(V,R)}}else{const ye=V.toLowerCase(),R=(N=o.staticInsensitive)==null?void 0:N.get(ye);if(R)Y=R;else{o.staticInsensitive??(o.staticInsensitive=new Map);const H=Bo(a.fullPath??a.from);H.parent=o,H.depth=u,Y=H,o.staticInsensitive.set(ye,H)}}break}case 1:{const V=L.substring(pe,Q[1]),ye=L.substring(Q[4],ne),R=ee&&!!(V||ye),H=V?R?V:V.toLowerCase():void 0,X=ye?R?ye:ye.toLowerCase():void 0,oe=!F&&((j=o.dynamic)==null?void 0:j.find(ie=>!ie.skipOnParamError&&ie.caseSensitive===R&&ie.prefix===H&&ie.suffix===X));if(oe)Y=oe;else{const ie=J1(1,a.fullPath??a.from,R,H,X);Y=ie,ie.depth=u,ie.parent=o,o.dynamic??(o.dynamic=[]),o.dynamic.push(ie)}break}case 3:{const V=L.substring(pe,Q[1]),ye=L.substring(Q[4],ne),R=ee&&!!(V||ye),H=V?R?V:V.toLowerCase():void 0,X=ye?R?ye:ye.toLowerCase():void 0,oe=!F&&((T=o.optional)==null?void 0:T.find(ie=>!ie.skipOnParamError&&ie.caseSensitive===R&&ie.prefix===H&&ie.suffix===X));if(oe)Y=oe;else{const ie=J1(3,a.fullPath??a.from,R,H,X);Y=ie,ie.parent=o,ie.depth=u,o.optional??(o.optional=[]),o.optional.push(ie)}break}case 2:{const V=L.substring(pe,Q[1]),ye=L.substring(Q[4],ne),R=ee&&!!(V||ye),H=V?R?V:V.toLowerCase():void 0,X=ye?R?ye:ye.toLowerCase():void 0,oe=J1(2,a.fullPath??a.from,R,H,X);Y=oe,oe.parent=o,oe.depth=u,o.wildcard??(o.wildcard=[]),o.wildcard.push(oe)}}o=Y}if(F&&a.children&&!a.isRoot&&a.id&&a.id.charCodeAt(a.id.lastIndexOf("/")+1)===95){const Q=Bo(a.fullPath??a.from);Q.kind=A2,Q.parent=o,u++,Q.depth=u,o.pathless??(o.pathless=[]),o.pathless.push(Q),o=Q}const G=(a.path||!a.children)&&!a.isRoot;if(G&&L.endsWith("/")){const Q=Bo(a.fullPath??a.from);Q.kind=zo,Q.parent=o,u++,Q.depth=u,o.index=Q,o=Q}o.parse=((U=(A=a.options)==null?void 0:A.params)==null?void 0:U.parse)??null,o.skipOnParamError=F,o.parsingPriority=((E=(I=a.options)==null?void 0:I.skipRouteOnParseError)==null?void 0:E.priority)??0,G&&!o.route&&(o.route=a,o.fullPath=a.fullPath??a.from)}if(a.children)for(const L of a.children)fp(e,t,L,m,o,u,f)}function X1(e,t){if(e.skipOnParamError&&!t.skipOnParamError)return-1;if(!e.skipOnParamError&&t.skipOnParamError)return 1;if(e.skipOnParamError&&t.skipOnParamError&&(e.parsingPriority||t.parsingPriority))return t.parsingPriority-e.parsingPriority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function Ul(e){var t,a,l;if(e.pathless)for(const o of e.pathless)Ul(o);if(e.static)for(const o of e.static.values())Ul(o);if(e.staticInsensitive)for(const o of e.staticInsensitive.values())Ul(o);if((t=e.dynamic)!=null&&t.length){e.dynamic.sort(X1);for(const o of e.dynamic)Ul(o)}if((a=e.optional)!=null&&a.length){e.optional.sort(X1);for(const o of e.optional)Ul(o)}if((l=e.wildcard)!=null&&l.length){e.wildcard.sort(X1);for(const o of e.wildcard)Ul(o)}}function Bo(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0}}function J1(e,t,a,l,o){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0,caseSensitive:a,prefix:l,suffix:o}}function tS(e,t){const a=Bo("/"),l=new Uint16Array(6);for(const o of e)fp(!1,l,o,1,a,0);Ul(a),t.masksTree=a,t.flatCache=Um(1e3)}function nS(e,t){e||(e="/");const a=t.flatCache.get(e);if(a)return a;const l=H0(e,t.masksTree);return t.flatCache.set(e,l),l}function sS(e,t,a,l,o){e||(e="/"),l||(l="/");const u=t?`case\0${e}`:e;let f=o.singleCache.get(u);return f||(f=Bo("/"),fp(t,new Uint16Array(6),{from:e},1,f,0),o.singleCache.set(u,f)),H0(l,f,a)}function aS(e,t,a=!1){const l=a?e:`nofuzz\0${e}`,o=t.matchCache.get(l);if(o!==void 0)return o;e||(e="/");let u;try{u=H0(e,t.segmentTree,a)}catch(f){if(f instanceof URIError)u=null;else throw f}return u&&(u.branch=lS(u.route)),t.matchCache.set(l,u),u}function iS(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function rS(e,t=!1,a){const l=Bo(e.fullPath),o=new Uint16Array(6),u={},f={};let m=0;return fp(t,o,e,1,l,0,y=>{if(a==null||a(y,m),no(!(y.id in u),`Duplicate routes found with id: ${String(y.id)}`),u[y.id]=y,m!==0&&y.path){const g=iS(y.fullPath);(!f[g]||y.fullPath.endsWith("/"))&&(f[g]=y)}m++}),Ul(l),{processedTree:{segmentTree:l,singleCache:Um(1e3),matchCache:Um(1e3),flatCache:null,masksTree:null},routesById:u,routesByPath:f}}function H0(e,t,a=!1){const l=e.split("/"),o=cS(e,l,t,a);if(!o)return null;const[u]=D2(e,l,o);return{route:o.node.route,rawParams:u,parsedParams:o.parsedParams}}function D2(e,t,a){var S,p,v,w,N,j,T,A,U,I;const l=oS(a.node);let o=null;const u=Object.create(null);let f=((S=a.extract)==null?void 0:S.part)??0,m=((p=a.extract)==null?void 0:p.node)??0,y=((v=a.extract)==null?void 0:v.path)??0,g=((w=a.extract)==null?void 0:w.segment)??0;for(;m<l.length;f++,m++,y++,g++){const E=l[m];if(E.kind===zo)break;if(E.kind===A2){g--,f--,y--;continue}const L=t[f],W=y;if(L&&(y+=L.length),E.kind===1){o??(o=a.node.fullPath.split("/"));const ee=o[g],F=((N=E.prefix)==null?void 0:N.length)??0;if(ee.charCodeAt(F)===123){const G=((j=E.suffix)==null?void 0:j.length)??0,Q=ee.substring(F+2,ee.length-G-1),Y=L.substring(F,L.length-G);u[Q]=decodeURIComponent(Y)}else{const G=ee.substring(1);u[G]=decodeURIComponent(L)}}else if(E.kind===3){if(a.skipped&1<<m){f--,y=W-1;continue}o??(o=a.node.fullPath.split("/"));const ee=o[g],F=((T=E.prefix)==null?void 0:T.length)??0,G=((A=E.suffix)==null?void 0:A.length)??0,Q=ee.substring(F+3,ee.length-G-1),Y=E.suffix||E.prefix?L.substring(F,L.length-G):L;Y&&(u[Q]=decodeURIComponent(Y))}else if(E.kind===2){const ee=E,F=e.substring(W+(((U=ee.prefix)==null?void 0:U.length)??0),e.length-(((I=ee.suffix)==null?void 0:I.length)??0)),G=decodeURIComponent(F);u["*"]=G,u._splat=G;break}}return a.rawParams&&Object.assign(u,a.rawParams),[u,{part:f,node:m,path:y,segment:g}]}function lS(e){const t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function oS(e){const t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function cS(e,t,a,l){if(e==="/"&&a.index)return{node:a.index,skipped:0};const o=!vf(t),u=o&&e!=="/",f=t.length-(o?1:0),m=[{node:a,index:1,skipped:0,depth:1,statics:1,dynamics:0,optionals:0}];let y=null,g=null,S=null;for(;m.length;){const p=m.pop(),{node:v,index:w,skipped:N,depth:j,statics:T,dynamics:A,optionals:U}=p;let{extract:I,rawParams:E,parsedParams:L}=p;if(v.skipOnParamError){if(!eg(e,t,p))continue;E=p.rawParams,I=p.extract,L=p.parsedParams}l&&v.route&&v.kind!==zo&&Gd(g,p)&&(g=p);const W=w===f;if(W&&(v.route&&!u&&Gd(S,p)&&(S=p),!v.optional&&!v.wildcard&&!v.index&&!v.pathless))continue;const ee=W?void 0:t[w];let F;if(W&&v.index){const G={node:v.index,index:w,skipped:N,depth:j+1,statics:T,dynamics:A,optionals:U,extract:I,rawParams:E,parsedParams:L};let Q=!0;if(v.index.skipOnParamError&&(eg(e,t,G)||(Q=!1)),Q){if(T===f&&!A&&!U&&!N)return G;Gd(S,G)&&(S=G)}}if(v.wildcard&&Gd(y,p))for(const G of v.wildcard){const{prefix:Q,suffix:Y}=G;if(Q&&(W||!(G.caseSensitive?ee:F??(F=ee.toLowerCase())).startsWith(Q)))continue;if(Y){if(W)continue;const ne=t.slice(w).join("/").slice(-Y.length);if((G.caseSensitive?ne:ne.toLowerCase())!==Y)continue}const pe={node:G,index:f,skipped:N,depth:j,statics:T,dynamics:A,optionals:U,extract:I,rawParams:E,parsedParams:L};if(!(G.skipOnParamError&&!eg(e,t,pe))){y=pe;break}}if(v.optional){const G=N|1<<j,Q=j+1;for(let Y=v.optional.length-1;Y>=0;Y--){const pe=v.optional[Y];m.push({node:pe,index:w,skipped:G,depth:Q,statics:T,dynamics:A,optionals:U,extract:I,rawParams:E,parsedParams:L})}if(!W)for(let Y=v.optional.length-1;Y>=0;Y--){const pe=v.optional[Y],{prefix:ne,suffix:V}=pe;if(ne||V){const ye=pe.caseSensitive?ee:F??(F=ee.toLowerCase());if(ne&&!ye.startsWith(ne)||V&&!ye.endsWith(V))continue}m.push({node:pe,index:w+1,skipped:N,depth:Q,statics:T,dynamics:A,optionals:U+1,extract:I,rawParams:E,parsedParams:L})}}if(!W&&v.dynamic&&ee)for(let G=v.dynamic.length-1;G>=0;G--){const Q=v.dynamic[G],{prefix:Y,suffix:pe}=Q;if(Y||pe){const ne=Q.caseSensitive?ee:F??(F=ee.toLowerCase());if(Y&&!ne.startsWith(Y)||pe&&!ne.endsWith(pe))continue}m.push({node:Q,index:w+1,skipped:N,depth:j+1,statics:T,dynamics:A+1,optionals:U,extract:I,rawParams:E,parsedParams:L})}if(!W&&v.staticInsensitive){const G=v.staticInsensitive.get(F??(F=ee.toLowerCase()));G&&m.push({node:G,index:w+1,skipped:N,depth:j+1,statics:T+1,dynamics:A,optionals:U,extract:I,rawParams:E,parsedParams:L})}if(!W&&v.static){const G=v.static.get(ee);G&&m.push({node:G,index:w+1,skipped:N,depth:j+1,statics:T+1,dynamics:A,optionals:U,extract:I,rawParams:E,parsedParams:L})}if(v.pathless){const G=j+1;for(let Q=v.pathless.length-1;Q>=0;Q--){const Y=v.pathless[Q];m.push({node:Y,index:w,skipped:N,depth:G,statics:T,dynamics:A,optionals:U,extract:I,rawParams:E,parsedParams:L})}}}if(S&&y)return Gd(y,S)?S:y;if(S)return S;if(y)return y;if(l&&g){let p=g.index;for(let w=0;w<g.index;w++)p+=t[w].length;const v=p===e.length?"/":e.slice(p);return g.rawParams??(g.rawParams=Object.create(null)),g.rawParams["**"]=decodeURIComponent(v),g}return null}function eg(e,t,a){try{const[l,o]=D2(e,t,a);a.rawParams=l,a.extract=o;const u=a.node.parse(l);return a.parsedParams=Object.assign(Object.create(null),a.parsedParams,u),!0}catch{return null}}function Gd(e,t){return e?t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===zo)>(e.node.kind===zo)||t.node.kind===zo==(e.node.kind===zo)&&t.depth>e.depth))):!0}function Sm(e){return $0(e.filter(t=>t!==void 0).join("/"))}function $0(e){return e.replace(/\/{2,}/g,"/")}function O2(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function Jl(e){const t=e.length;return t>1&&e[t-1]==="/"?e.replace(/\/{1,}$/,""):e}function I2(e){return Jl(O2(e))}function zm(e,t){return e!=null&&e.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function uS(e,t,a){return zm(e,a)===zm(t,a)}function dS({base:e,to:t,trailingSlash:a="never",cache:l}){const o=t.startsWith("/"),u=!o&&t===".";let f;if(l){f=o?t:u?e:e+"\0"+t;const p=l.get(f);if(p)return p}let m;if(u)m=e.split("/");else if(o)m=t.split("/");else{for(m=e.split("/");m.length>1&&vf(m)==="";)m.pop();const p=t.split("/");for(let v=0,w=p.length;v<w;v++){const N=p[v];N===""?v?v===w-1&&m.push(N):m=[N]:N===".."?m.pop():N==="."||m.push(N)}}m.length>1&&(vf(m)===""?a==="never"&&m.pop():a==="always"&&m.push(""));let y,g="";for(let p=0;p<m.length;p++){p>0&&(g+="/");const v=m[p];if(!v)continue;y=B0(v,0,y);const w=y[0];if(w===0){g+=v;continue}const N=y[5],j=v.substring(0,y[1]),T=v.substring(y[4],N),A=v.substring(y[2],y[3]);w===1?g+=j||T?`${j}{$${A}}${T}`:`$${A}`:w===2?g+=j||T?`${j}{$}${T}`:"$":g+=`${j}{-$${A}}${T}`}g=$0(g);const S=g||"/";return f&&l&&l.set(f,S),S}function fS(e){const t=new Map(e.map(o=>[encodeURIComponent(o),o])),a=Array.from(t.keys()).map(o=>o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),l=new RegExp(a,"g");return o=>o.replace(l,u=>t.get(u)??u)}function tg(e,t,a){const l=t[e];return typeof l!="string"?l:e==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(l)?l:l.split("/").map(o=>Bv(o,a)).join("/"):Bv(l,a)}function zv({path:e,params:t,decoder:a,...l}){let o=!1;const u=Object.create(null);if(!e||e==="/")return{interpolatedPath:"/",usedParams:u,isMissingParams:o};if(!e.includes("$"))return{interpolatedPath:e,usedParams:u,isMissingParams:o};const f=e.length;let m=0,y,g="";for(;m<f;){const S=m;y=B0(e,S,y);const p=y[5];if(m=p+1,S===p)continue;const v=y[0];if(v===0){g+="/"+e.substring(S,p);continue}if(v===2){const w=t._splat;u._splat=w,u["*"]=w;const N=e.substring(S,y[1]),j=e.substring(y[4],p);if(!w){o=!0,(N||j)&&(g+="/"+N+j);continue}const T=tg("_splat",t,a);g+="/"+N+T+j;continue}if(v===1){const w=e.substring(y[2],y[3]);!o&&!(w in t)&&(o=!0),u[w]=t[w];const N=e.substring(S,y[1]),j=e.substring(y[4],p),T=tg(w,t,a)??"undefined";g+="/"+N+T+j;continue}if(v===3){const w=e.substring(y[2],y[3]),N=t[w];if(N==null)continue;u[w]=N;const j=e.substring(S,y[1]),T=e.substring(y[4],p),A=tg(w,t,a)??"";g+="/"+j+A+T;continue}}return e.endsWith("/")&&(g+="/"),{usedParams:u,interpolatedPath:g||"/",isMissingParams:o}}function Bv(e,t){const a=encodeURIComponent(e);return(t==null?void 0:t(a))??a}function sa(e){return!!(e!=null&&e.isNotFound)}function hS(){try{if(typeof window<"u"&&typeof window.sessionStorage=="object")return window.sessionStorage}catch{}}var Qg="tsr-scroll-restoration-v1_3",mS=(e,t)=>{let a;return(...l)=>{a||(a=setTimeout(()=>{e(...l),a=null},t))}};function pS(){const e=hS();if(!e)return null;const t=e.getItem(Qg);let a=t?JSON.parse(t):{};return{state:a,set:l=>{a=Vl(l,a)||a;try{e.setItem(Qg,JSON.stringify(a))}catch{console.warn("[ts-router] Could not persist scroll restoration state to sessionStorage.")}}}}var rm=pS(),gS=e=>e.state.__TSR_key||e.href;function _S(e){const t=[];let a;for(;a=e.parentNode;)t.push(`${e.tagName}:nth-child(${Array.prototype.indexOf.call(a.children,e)+1})`),e=a;return`${t.reverse().join(" > ")}`.toLowerCase()}var Bm=!1;function yS({storageKey:e,key:t,behavior:a,shouldScrollRestoration:l,scrollToTopSelectors:o,location:u}){var g,S;let f;try{f=JSON.parse(sessionStorage.getItem(e)||"{}")}catch(p){console.error(p);return}const m=t||((g=window.history.state)==null?void 0:g.__TSR_key),y=f[m];Bm=!0;e:{if(l&&y&&Object.keys(y).length>0){for(const w in y){const N=y[w];if(w==="window")window.scrollTo({top:N.scrollY,left:N.scrollX,behavior:a});else if(w){const j=document.querySelector(w);j&&(j.scrollLeft=N.scrollX,j.scrollTop=N.scrollY)}}break e}const p=(u??window.location).hash.split("#",2)[1];if(p){const w=((S=window.history.state)==null?void 0:S.__hashScrollIntoViewOptions)??!0;if(w){const N=document.getElementById(p);N&&N.scrollIntoView(w)}break e}const v={top:0,left:0,behavior:a};if(window.scrollTo(v),o)for(const w of o){if(w==="window")continue;const N=typeof w=="function"?w():document.querySelector(w);N&&N.scrollTo(v)}}Bm=!1}function vS(e,t){if(!rm||((e.options.scrollRestoration??!1)&&(e.isScrollRestoring=!0),e.isScrollRestorationSetup||!rm))return;e.isScrollRestorationSetup=!0,Bm=!1;const a=e.options.getScrollRestorationKey||gS;window.history.scrollRestoration="manual";const l=o=>{if(Bm||!e.isScrollRestoring)return;let u="";if(o.target===document||o.target===window)u="window";else{const m=o.target.getAttribute("data-scroll-restoration-id");m?u=`[data-scroll-restoration-id="${m}"]`:u=_S(o.target)}const f=a(e.state.location);rm.set(m=>{const y=m[f]||(m[f]={}),g=y[u]||(y[u]={});if(u==="window")g.scrollX=window.scrollX||0,g.scrollY=window.scrollY||0;else if(u){const S=document.querySelector(u);S&&(g.scrollX=S.scrollLeft||0,g.scrollY=S.scrollTop||0)}return m})};typeof document<"u"&&document.addEventListener("scroll",mS(l,100),!0),e.subscribe("onRendered",o=>{const u=a(o.toLocation);if(!e.resetNextScroll){e.resetNextScroll=!0;return}typeof e.options.scrollRestoration=="function"&&!e.options.scrollRestoration({location:e.latestLocation})||(yS({storageKey:Qg,key:u,behavior:e.options.scrollRestorationBehavior,shouldScrollRestoration:e.isScrollRestoring,scrollToTopSelectors:e.options.scrollToTopSelectors,location:e.history.location}),e.isScrollRestoring&&rm.set(f=>(f[u]||(f[u]={}),f)))})}function bS(e){if(typeof document<"u"&&document.querySelector){const t=e.state.location.state.__hashScrollIntoViewOptions??!0;if(t&&e.state.location.hash!==""){const a=document.getElementById(e.state.location.hash);a&&a.scrollIntoView(t)}}}function xS(e,t=String){const a=new URLSearchParams;for(const l in e){const o=e[l];o!==void 0&&a.set(l,t(o))}return a.toString()}function ng(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function SS(e){const t=new URLSearchParams(e),a=Object.create(null);for(const[l,o]of t.entries()){const u=a[l];u==null?a[l]=ng(o):Array.isArray(u)?u.push(ng(o)):a[l]=[u,ng(o)]}return a}var jS=NS(JSON.parse),wS=kS(JSON.stringify,JSON.parse);function NS(e){return t=>{t[0]==="?"&&(t=t.substring(1));const a=SS(t);for(const l in a){const o=a[l];if(typeof o=="string")try{a[l]=e(o)}catch{}}return a}}function kS(e,t){const a=typeof t=="function";function l(o){if(typeof o=="object"&&o!==null)try{return e(o)}catch{}else if(a&&typeof o=="string")try{return t(o),e(o)}catch{}return o}return o=>{const u=xS(o,l);return u?`?${u}`:""}}var Zo="__root__";function ES(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href=="string")try{new URL(e.href),e.reloadDocument=!0}catch{}const t=new Headers(e.headers);e.href&&t.get("Location")===null&&t.set("Location",e.href);const a=new Response(null,{status:e.statusCode,headers:t});if(a.options=e,e.throw)throw a;return a}function Sa(e){return e instanceof Response&&!!e.options}function CS(e){return{input:({url:t})=>{for(const a of e)t=Gg(a,t);return t},output:({url:t})=>{for(let a=e.length-1;a>=0;a--)t=L2(e[a],t);return t}}}function TS(e){const t=I2(e.basepath),a=`/${t}`,l=`${a}/`,o=e.caseSensitive?a:a.toLowerCase(),u=e.caseSensitive?l:l.toLowerCase();return{input:({url:f})=>{const m=e.caseSensitive?f.pathname:f.pathname.toLowerCase();return m===o?f.pathname="/":m.startsWith(u)&&(f.pathname=f.pathname.slice(a.length)),f},output:({url:f})=>(f.pathname=Sm(["/",t,f.pathname]),f)}}function Gg(e,t){var l;const a=(l=e==null?void 0:e.input)==null?void 0:l.call(e,{url:t});if(a){if(typeof a=="string")return new URL(a);if(a instanceof URL)return a}return t}function L2(e,t){var l;const a=(l=e==null?void 0:e.output)==null?void 0:l.call(e,{url:t});if(a){if(typeof a=="string")return new URL(a);if(a instanceof URL)return a}return t}var Yn=(e=>(e[e.None=0]="None",e[e.Mutable=1]="Mutable",e[e.Watching=2]="Watching",e[e.RecursedCheck=4]="RecursedCheck",e[e.Recursed=8]="Recursed",e[e.Dirty=16]="Dirty",e[e.Pending=32]="Pending",e))(Yn||{});function P2({update:e,notify:t,unwatched:a}){return{link:l,unlink:o,propagate:u,checkDirty:f,shallowPropagate:m};function l(g,S,p){const v=S.depsTail;if(v!==void 0&&v.dep===g)return;const w=v!==void 0?v.nextDep:S.deps;if(w!==void 0&&w.dep===g){w.version=p,S.depsTail=w;return}const N=g.subsTail;if(N!==void 0&&N.version===p&&N.sub===S)return;const j=S.depsTail=g.subsTail={version:p,dep:g,sub:S,prevDep:v,nextDep:w,prevSub:N,nextSub:void 0};w!==void 0&&(w.prevDep=j),v!==void 0?v.nextDep=j:S.deps=j,N!==void 0?N.nextSub=j:g.subs=j}function o(g,S=g.sub){const p=g.dep,v=g.prevDep,w=g.nextDep,N=g.nextSub,j=g.prevSub;return w!==void 0?w.prevDep=v:S.depsTail=v,v!==void 0?v.nextDep=w:S.deps=w,N!==void 0?N.prevSub=j:p.subsTail=j,j!==void 0?j.nextSub=N:(p.subs=N)===void 0&&a(p),w}function u(g){let S=g.nextSub,p;e:do{const v=g.sub;let w=v.flags;if(w&60?w&12?w&4?!(w&48)&&y(g,v)?(v.flags=w|40,w&=1):w=0:v.flags=w&-9|32:w=0:v.flags=w|32,w&2&&t(v),w&1){const N=v.subs;if(N!==void 0){const j=(g=N).nextSub;j!==void 0&&(p={value:S,prev:p},S=j);continue}}if((g=S)!==void 0){S=g.nextSub;continue}for(;p!==void 0;)if(g=p.value,p=p.prev,g!==void 0){S=g.nextSub;continue e}break}while(!0)}function f(g,S){let p,v=0,w=!1;e:do{const N=g.dep,j=N.flags;if(S.flags&16)w=!0;else if((j&17)===17){if(e(N)){const T=N.subs;T.nextSub!==void 0&&m(T),w=!0}}else if((j&33)===33){(g.nextSub!==void 0||g.prevSub!==void 0)&&(p={value:g,prev:p}),g=N.deps,S=N,++v;continue}if(!w){const T=g.nextDep;if(T!==void 0){g=T;continue}}for(;v--;){const T=S.subs,A=T.nextSub!==void 0;if(A?(g=p.value,p=p.prev):g=T,w){if(e(S)){A&&m(T),S=g.sub;continue}w=!1}else S.flags&=-33;S=g.sub;const U=g.nextDep;if(U!==void 0){g=U;continue e}}return w}while(!0)}function m(g){do{const S=g.sub,p=S.flags;(p&48)===32&&(S.flags=p|16,(p&6)===2&&t(S))}while((g=g.nextSub)!==void 0)}function y(g,S){let p=S.depsTail;for(;p!==void 0;){if(p===g)return!0;p=p.prevDep}return!1}}let F0=0,Ao=0,hf=0;const Hr=[],{link:tD,unlink:U2,propagate:nD,checkDirty:MS,shallowPropagate:sD}=P2({update(e){return e.depsTail!==void 0?OS(e):IS(e)},notify(e){var l;let t=hf,a=t;do if(Hr[t++]=e,e.flags&=-3,e=(l=e.subs)==null?void 0:l.sub,e===void 0||!(e.flags&2))break;while(!0);for(hf=t;a<--t;){const o=Hr[a];Hr[a++]=Hr[t],Hr[t]=o}},unwatched(e){e.flags&1?e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,hp(e)):US.call(e)}});function RS(){return F0}function AS(){++F0}function DS(){--F0||PS()}function OS(e){e.depsTail=void 0,e.flags=5;try{const t=e.value;return t!==(e.value=e.getter(t))}finally{e.flags&=-5,hp(e)}}function IS(e){return e.flags=1,e.currentValue!==(e.currentValue=e.pendingValue)}function LS(e){const t=e.flags;if(t&16||t&32&&MS(e.deps,e)){e.depsTail=void 0,e.flags=6;try{e.fn()}finally{e.flags&=-5,hp(e)}}else e.flags=2}function PS(){try{for(;Ao<hf;){const e=Hr[Ao];Hr[Ao++]=void 0,LS(e)}}finally{for(;Ao<hf;){const e=Hr[Ao];Hr[Ao++]=void 0,e.flags|=10}Ao=0,hf=0}}function US(){this.depsTail=void 0,this.flags=0,hp(this);const e=this.subs;e!==void 0&&U2(e)}function hp(e){const t=e.depsTail;let a=t!==void 0?t.nextDep:e.deps;for(;a!==void 0;)a=U2(a,e)}function q0(e,t,a){var u,f,m;const l=typeof e=="object",o=l?e:void 0;return{next:(u=l?e.next:e)==null?void 0:u.bind(o),error:(f=l?e.error:t)==null?void 0:f.bind(o),complete:(m=l?e.complete:a)==null?void 0:m.bind(o)}}const Yg=[];let jm=0;const{link:Hv,unlink:zS,propagate:BS,checkDirty:z2,shallowPropagate:$v}=P2({update(e){return e._update()},notify(e){Yg[Vg++]=e,e.flags&=~Yn.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=Yn.Mutable|Yn.Dirty,Hm(e))}});let lm=0,Vg=0,Wi;function Hm(e){const t=e.depsTail;let a=t!==void 0?t.nextDep:e.deps;for(;a!==void 0;)a=zS(a,e)}function B2(){if(!(RS()>0)){for(;lm<Vg;){const e=Yg[lm];Yg[lm++]=void 0,e.notify()}lm=0,Vg=0}}function H2(e,t){const a=typeof e=="function",l=e,o={_snapshot:a?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:a?Yn.None:Yn.Mutable,get(){return Wi!==void 0&&Hv(o,Wi,jm),o._snapshot},subscribe(u){const f=q0(u),m={current:!1},y=HS(()=>{var g;o.get(),m.current?(g=f.next)==null||g.call(f,o._snapshot):m.current=!0});return{unsubscribe:()=>{y.stop()}}},_update(u){const f=Wi,m=Object.is;if(a)Wi=o,++jm,o.depsTail=void 0;else if(u===void 0)return!1;a&&(o.flags=Yn.Mutable|Yn.RecursedCheck);try{const y=o._snapshot,g=typeof u=="function"?u(y):u===void 0&&a?l(y):u;return y===void 0||!m(y,g)?(o._snapshot=g,!0):!1}finally{Wi=f,a&&(o.flags&=~Yn.RecursedCheck),Hm(o)}}};return a?(o.flags=Yn.Mutable|Yn.Dirty,o.get=function(){const u=o.flags;if(u&Yn.Dirty||u&Yn.Pending&&z2(o.deps,o)){if(o._update()){const f=o.subs;f!==void 0&&$v(f)}}else u&Yn.Pending&&(o.flags=u&~Yn.Pending);return Wi!==void 0&&Hv(o,Wi,jm),o._snapshot}):o.set=function(u){if(o._update(u)){const f=o.subs;f!==void 0&&(BS(f),$v(f),B2())}},o}function HS(e){const t=()=>{const l=Wi;Wi=a,++jm,a.depsTail=void 0,a.flags=Yn.Watching|Yn.RecursedCheck;try{return e()}finally{Wi=l,a.flags&=~Yn.RecursedCheck,Hm(a)}},a={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:Yn.Watching|Yn.RecursedCheck,notify(){const l=this.flags;l&Yn.Dirty||l&Yn.Pending&&z2(this.deps,this)?t():this.flags=Yn.Watching},stop(){this.flags=Yn.None,this.depsTail=void 0,Hm(this)}};return t(),a}class $S{constructor(t){this.atom=H2(t)}setState(t){this.atom.set(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(q0(t))}}class FS{constructor(t){this.atom=H2(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(q0(t))}}function qS(e){return typeof e=="function"?new FS(e):new $S(e)}function WS(e){try{AS(),e()}finally{DS(),B2()}}function mf(e){let t;return WS(()=>{t=e()}),t}var Zg=e=>{var t;if(!e.rendered)return e.rendered=!0,(t=e.onReady)==null?void 0:t.call(e)},mp=(e,t)=>!!(e.preload&&!e.router.state.matches.some(a=>a.id===t)),Xo=(e,t,a=!0)=>{const l={...e.router.options.context??{}},o=a?t:t-1;for(let u=0;u<=o;u++){const f=e.matches[u];if(!f)continue;const m=e.router.getMatch(f.id);m&&Object.assign(l,m.__routeContext,m.__beforeLoadContext)}return l},Fv=(e,t)=>{if(!e.matches.length)return;const a=t.routeId,l=e.matches.findIndex(f=>f.routeId===e.router.routeTree.id),o=l>=0?l:0;let u=a?e.matches.findIndex(f=>f.routeId===a):e.firstBadMatchIndex??e.matches.length-1;u<0&&(u=o);for(let f=u;f>=0;f--){const m=e.matches[f];if(e.router.looseRoutesById[m.routeId].options.notFoundComponent)return f}return a?u:o},Zl=(e,t,a)=>{var l,o,u;if(!(!Sa(a)&&!sa(a)))throw Sa(a)&&a.redirectHandled&&!a.options.reloadDocument||(t&&((l=t._nonReactive.beforeLoadPromise)==null||l.resolve(),(o=t._nonReactive.loaderPromise)==null||o.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=a,e.updateMatch(t.id,f=>({...f,status:Sa(a)?"redirected":f.status==="pending"?"success":f.status,context:Xo(e,t.index),isFetching:!1,error:a})),sa(a)&&!a.routeId&&(a.routeId=t.routeId),(u=t._nonReactive.loadPromise)==null||u.resolve()),Sa(a)&&(e.rendered=!0,a.options._fromLocation=e.location,a.redirectHandled=!0,a=e.router.resolveRedirect(a))),a},$2=(e,t)=>{const a=e.router.getMatch(t);return!!(!a||a._nonReactive.dehydrated)},qv=(e,t,a)=>{const l=Xo(e,a);e.updateMatch(t,o=>({...o,context:l}))},Yd=(e,t,a,l)=>{var m,y;const{id:o,routeId:u}=e.matches[t],f=e.router.looseRoutesById[u];if(a instanceof Promise)throw a;a.routerCode=l,e.firstBadMatchIndex??(e.firstBadMatchIndex=t),Zl(e,e.router.getMatch(o),a);try{(y=(m=f.options).onError)==null||y.call(m,a)}catch(g){a=g,Zl(e,e.router.getMatch(o),a)}e.updateMatch(o,g=>{var S,p;return(S=g._nonReactive.beforeLoadPromise)==null||S.resolve(),g._nonReactive.beforeLoadPromise=void 0,(p=g._nonReactive.loadPromise)==null||p.resolve(),{...g,error:a,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController}}),!e.preload&&!Sa(a)&&!sa(a)&&(e.serialError??(e.serialError=a))},F2=(e,t,a,l)=>{var u;if(l._nonReactive.pendingTimeout!==void 0)return;const o=a.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!mp(e,t)&&(a.options.loader||a.options.beforeLoad||W2(a))&&typeof o=="number"&&o!==1/0&&(a.options.pendingComponent??((u=e.router.options)==null?void 0:u.defaultPendingComponent))){const f=setTimeout(()=>{Zg(e)},o);l._nonReactive.pendingTimeout=f}},KS=(e,t,a)=>{const l=e.router.getMatch(t);if(!l._nonReactive.beforeLoadPromise&&!l._nonReactive.loaderPromise)return;F2(e,t,a,l);const o=()=>{const u=e.router.getMatch(t);u.preload&&(u.status==="redirected"||u.status==="notFound")&&Zl(e,u,u.error)};return l._nonReactive.beforeLoadPromise?l._nonReactive.beforeLoadPromise.then(o):o()},QS=(e,t,a,l)=>{const o=e.router.getMatch(t);let u=o._nonReactive.loadPromise;o._nonReactive.loadPromise=ku(()=>{u==null||u.resolve(),u=void 0});const{paramsError:f,searchError:m}=o;f&&Yd(e,a,f,"PARSE_PARAMS"),m&&Yd(e,a,m,"VALIDATE_SEARCH"),F2(e,t,l,o);const y=new AbortController;let g=!1;const S=()=>{g||(g=!0,e.updateMatch(t,E=>({...E,isFetching:"beforeLoad",fetchCount:E.fetchCount+1,abortController:y})))},p=()=>{var E;(E=o._nonReactive.beforeLoadPromise)==null||E.resolve(),o._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,L=>({...L,isFetching:!1}))};if(!l.options.beforeLoad){mf(()=>{S(),p()});return}o._nonReactive.beforeLoadPromise=ku();const v={...Xo(e,a,!1),...o.__routeContext},{search:w,params:N,cause:j}=o,T=mp(e,t),A={search:w,abortController:y,params:N,preload:T,context:v,location:e.location,navigate:E=>e.router.navigate({...E,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:T?"preload":j,matches:e.matches,routeId:l.id,...e.router.options.additionalContext},U=E=>{if(E===void 0){mf(()=>{S(),p()});return}(Sa(E)||sa(E))&&(S(),Yd(e,a,E,"BEFORE_LOAD")),mf(()=>{S(),e.updateMatch(t,L=>({...L,__beforeLoadContext:E})),p()})};let I;try{if(I=l.options.beforeLoad(A),bf(I))return S(),I.catch(E=>{Yd(e,a,E,"BEFORE_LOAD")}).then(U)}catch(E){S(),Yd(e,a,E,"BEFORE_LOAD")}U(I)},GS=(e,t)=>{const{id:a,routeId:l}=e.matches[t],o=e.router.looseRoutesById[l],u=()=>m(),f=()=>QS(e,a,t,o),m=()=>{if($2(e,a))return;const y=KS(e,a,o);return bf(y)?y.then(f):f()};return u()},YS=(e,t,a)=>{var u,f,m,y,g,S;const l=e.router.getMatch(t);if(!l||!a.options.head&&!a.options.scripts&&!a.options.headers)return;const o={ssr:e.router.options.ssr,matches:e.matches,match:l,params:l.params,loaderData:l.loaderData};return Promise.all([(f=(u=a.options).head)==null?void 0:f.call(u,o),(y=(m=a.options).scripts)==null?void 0:y.call(m,o),(S=(g=a.options).headers)==null?void 0:S.call(g,o)]).then(([p,v,w])=>({meta:p==null?void 0:p.meta,links:p==null?void 0:p.links,headScripts:p==null?void 0:p.scripts,headers:w,scripts:v,styles:p==null?void 0:p.styles}))},q2=(e,t,a,l,o)=>{const u=t[l-1],{params:f,loaderDeps:m,abortController:y,cause:g}=e.router.getMatch(a),S=Xo(e,l),p=mp(e,a);return{params:f,deps:m,preload:!!p,parentMatchPromise:u,abortController:y,context:S,location:e.location,navigate:v=>e.router.navigate({...v,_fromLocation:e.location}),cause:p?"preload":g,route:o,...e.router.options.additionalContext}},Wv=async(e,t,a,l,o)=>{var u,f,m,y,g;try{const S=e.router.getMatch(a);try{(!(K9??e.router.isServer)||S.ssr===!0)&&xf(o);const p=o.options.loader,v=typeof p=="function"?p:p==null?void 0:p.handler,w=v==null?void 0:v(q2(e,t,a,l,o)),N=!!v&&bf(w);if((N||o._lazyPromise||o._componentsPromise||o.options.head||o.options.scripts||o.options.headers||S._nonReactive.minPendingPromise)&&e.updateMatch(a,T=>({...T,isFetching:"loader"})),v){const T=N?await w:w;Zl(e,e.router.getMatch(a),T),T!==void 0&&e.updateMatch(a,A=>({...A,loaderData:T}))}o._lazyPromise&&await o._lazyPromise;const j=S._nonReactive.minPendingPromise;j&&await j,o._componentsPromise&&await o._componentsPromise,e.updateMatch(a,T=>({...T,error:void 0,context:Xo(e,l),status:"success",isFetching:!1,updatedAt:Date.now()}))}catch(p){let v=p;if((v==null?void 0:v.name)==="AbortError"){if(S.abortController.signal.aborted){(u=S._nonReactive.loaderPromise)==null||u.resolve(),S._nonReactive.loaderPromise=void 0;return}e.updateMatch(a,N=>({...N,status:N.status==="pending"?"success":N.status,isFetching:!1,context:Xo(e,l)}));return}const w=S._nonReactive.minPendingPromise;w&&await w,sa(p)&&await((m=(f=o.options.notFoundComponent)==null?void 0:f.preload)==null?void 0:m.call(f)),Zl(e,e.router.getMatch(a),p);try{(g=(y=o.options).onError)==null||g.call(y,p)}catch(N){v=N,Zl(e,e.router.getMatch(a),N)}!Sa(v)&&!sa(v)&&await xf(o,["errorComponent"]),e.updateMatch(a,N=>({...N,error:v,context:Xo(e,l),status:"error",isFetching:!1}))}}catch(S){const p=e.router.getMatch(a);p&&(p._nonReactive.loaderPromise=void 0),Zl(e,p,S)}},VS=async(e,t,a)=>{var w,N,j,T;async function l(A,U,I,E,L){const W=Date.now()-U.updatedAt,ee=A?L.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:L.options.staleTime??e.router.options.defaultStaleTime??0,F=L.options.shouldReload,G=typeof F=="function"?F(q2(e,t,o,a,L)):F,{status:Q,invalid:Y}=E,pe=W>ee&&(!!e.forceStaleReload||E.cause==="enter"||I!==void 0&&I!==E.id);f=Q==="success"&&(Y||(G??pe)),A&&L.options.preload===!1||(f&&!e.sync&&S?(m=!0,(async()=>{var ne,V;try{await Wv(e,t,o,a,L);const ye=e.router.getMatch(o);(ne=ye._nonReactive.loaderPromise)==null||ne.resolve(),(V=ye._nonReactive.loadPromise)==null||V.resolve(),ye._nonReactive.loaderPromise=void 0,ye._nonReactive.loadPromise=void 0}catch(ye){Sa(ye)&&await e.router.navigate(ye.options)}})()):Q!=="success"||f?await Wv(e,t,o,a,L):qv(e,o,a))}const{id:o,routeId:u}=e.matches[a];let f=!1,m=!1;const y=e.router.looseRoutesById[u],g=y.options.loader,S=((typeof g=="function"||g==null?void 0:g.staleReloadMode)??e.router.options.defaultStaleReloadMode)!=="blocking";if($2(e,o)){if(!e.router.getMatch(o))return e.matches[a];qv(e,o,a)}else{const A=e.router.getMatch(o),U=((w=e.router.state.matches[a])==null?void 0:w.routeId)===u?e.router.state.matches[a].id:(N=e.router.state.matches.find(E=>E.routeId===u))==null?void 0:N.id,I=mp(e,o);if(A._nonReactive.loaderPromise){if(A.status==="success"&&!e.sync&&!A.preload&&S)return A;await A._nonReactive.loaderPromise;const E=e.router.getMatch(o),L=E._nonReactive.error||E.error;L&&Zl(e,E,L),E.status==="pending"&&await l(I,A,U,E,y)}else{const E=I&&!e.router.state.matches.some(W=>W.id===o),L=e.router.getMatch(o);L._nonReactive.loaderPromise=ku(),E!==L.preload&&e.updateMatch(o,W=>({...W,preload:E})),await l(I,A,U,L,y)}}const p=e.router.getMatch(o);m||((j=p._nonReactive.loaderPromise)==null||j.resolve(),(T=p._nonReactive.loadPromise)==null||T.resolve(),p._nonReactive.loadPromise=void 0),clearTimeout(p._nonReactive.pendingTimeout),p._nonReactive.pendingTimeout=void 0,m||(p._nonReactive.loaderPromise=void 0),p._nonReactive.dehydrated=void 0;const v=m?p.isFetching:!1;return v!==p.isFetching||p.invalid!==!1?(e.updateMatch(o,A=>({...A,isFetching:v,invalid:!1})),e.router.getMatch(o)):p};async function Kv(e){var v,w;const t=e,a=[];t.router.state.matches.some(N=>N._forcePending)&&Zg(t);let l;for(let N=0;N<t.matches.length;N++){try{const j=GS(t,N);bf(j)&&await j}catch(j){if(Sa(j))throw j;if(sa(j))l=j;else if(!t.preload)throw j;break}if(t.serialError)break}const o=t.firstBadMatchIndex??t.matches.length,u=l&&!t.preload?Fv(t,l):void 0,f=l&&t.preload?0:u!==void 0?Math.min(u+1,o):o;let m,y;for(let N=0;N<f;N++)a.push(VS(t,a,N));try{await Promise.all(a)}catch{const N=await Promise.allSettled(a);for(const j of N){if(j.status!=="rejected")continue;const T=j.reason;if(Sa(T))throw T;sa(T)?m??(m=T):y??(y=T)}if(y!==void 0)throw y}const g=m??(l&&!t.preload?l:void 0);let S=t.serialError?t.firstBadMatchIndex??0:t.matches.length-1;if(!g&&l&&t.preload)return t.matches;if(g){const N=Fv(t,g);no(N!==void 0);const j=t.matches[N],T=t.router.looseRoutesById[j.routeId],A=(v=t.router.options)==null?void 0:v.defaultNotFoundComponent;!T.options.notFoundComponent&&A&&(T.options.notFoundComponent=A),g.routeId=j.routeId;const U=j.routeId===t.router.routeTree.id;t.updateMatch(j.id,I=>({...I,...U?{status:"success",globalNotFound:!0,error:void 0}:{status:"notFound",error:g},isFetching:!1})),S=N,await xf(T,["notFoundComponent"])}else if(!t.preload){const N=t.matches[0];N.globalNotFound||(w=t.router.getMatch(N.id))!=null&&w.globalNotFound&&t.updateMatch(N.id,j=>({...j,globalNotFound:!1,error:void 0}))}if(t.serialError&&t.firstBadMatchIndex!==void 0){const N=t.router.looseRoutesById[t.matches[t.firstBadMatchIndex].routeId];await xf(N,["errorComponent"])}for(let N=0;N<=S;N++){const{id:j,routeId:T}=t.matches[N],A=t.router.looseRoutesById[T];try{const U=YS(t,j,A);if(U){const I=await U;t.updateMatch(j,E=>({...E,...I}))}}catch(U){console.error(`Error executing head for route ${T}:`,U)}}const p=Zg(t);if(bf(p)&&await p,g)throw g;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function Qv(e,t){const a=t.map(l=>{var o,u;return(u=(o=e.options[l])==null?void 0:o.preload)==null?void 0:u.call(o)}).filter(Boolean);if(a.length!==0)return Promise.all(a)}function xf(e,t=wm){!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(l=>{const{id:o,...u}=l.options;Object.assign(e.options,u),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0);const a=()=>e._componentsLoaded?void 0:t===wm?(()=>{if(e._componentsPromise===void 0){const l=Qv(e,wm);l?e._componentsPromise=l.then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0}):e._componentsLoaded=!0}return e._componentsPromise})():Qv(e,t);return e._lazyPromise?e._lazyPromise.then(a):a()}function W2(e){var t;for(const a of wm)if((t=e.options[a])!=null&&t.preload)return!0;return!1}var wm=["component","errorComponent","pendingComponent","notFoundComponent"],eo="__TSR_index",Gv="popstate",Yv="beforeunload";function ZS(e){let t=e.getLocation();const a=new Set,l=f=>{t=e.getLocation(),a.forEach(m=>m({location:t,action:f}))},o=f=>{e.notifyOnIndexChange??!0?l(f):t=e.getLocation()},u=async({task:f,navigateOpts:m,...y})=>{var p,v;if((m==null?void 0:m.ignoreBlocker)??!1){f();return}const g=((p=e.getBlockers)==null?void 0:p.call(e))??[],S=y.type==="PUSH"||y.type==="REPLACE";if(typeof document<"u"&&g.length&&S)for(const w of g){const N=$m(y.path,y.state);if(await w.blockerFn({currentLocation:t,nextLocation:N,action:y.type})){(v=e.onBlocked)==null||v.call(e);return}}f()};return{get location(){return t},get length(){return e.getLength()},subscribers:a,subscribe:f=>(a.add(f),()=>{a.delete(f)}),push:(f,m,y)=>{const g=t.state[eo];m=Vv(g+1,m),u({task:()=>{e.pushState(f,m),l({type:"PUSH"})},navigateOpts:y,type:"PUSH",path:f,state:m})},replace:(f,m,y)=>{const g=t.state[eo];m=Vv(g,m),u({task:()=>{e.replaceState(f,m),l({type:"REPLACE"})},navigateOpts:y,type:"REPLACE",path:f,state:m})},go:(f,m)=>{u({task:()=>{e.go(f),o({type:"GO",index:f})},navigateOpts:m,type:"GO"})},back:f=>{u({task:()=>{e.back((f==null?void 0:f.ignoreBlocker)??!1),o({type:"BACK"})},navigateOpts:f,type:"BACK"})},forward:f=>{u({task:()=>{e.forward((f==null?void 0:f.ignoreBlocker)??!1),o({type:"FORWARD"})},navigateOpts:f,type:"FORWARD"})},canGoBack:()=>t.state[eo]!==0,createHref:f=>e.createHref(f),block:f=>{var y;if(!e.setBlockers)return()=>{};const m=((y=e.getBlockers)==null?void 0:y.call(e))??[];return e.setBlockers([...m,f]),()=>{var S,p;const g=((S=e.getBlockers)==null?void 0:S.call(e))??[];(p=e.setBlockers)==null||p.call(e,g.filter(v=>v!==f))}},flush:()=>{var f;return(f=e.flush)==null?void 0:f.call(e)},destroy:()=>{var f;return(f=e.destroy)==null?void 0:f.call(e)},notify:l}}function Vv(e,t){t||(t={});const a=W0();return{...t,key:a,__TSR_key:a,[eo]:e}}function XS(e){var F,G;const t=typeof document<"u"?window:void 0,a=t.history.pushState,l=t.history.replaceState;let o=[];const u=()=>o,f=Q=>o=Q,m=(Q=>Q),y=(()=>$m(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!((F=t.history.state)!=null&&F.__TSR_key)&&!((G=t.history.state)!=null&&G.key)){const Q=W0();t.history.replaceState({[eo]:0,key:Q,__TSR_key:Q},"")}let g=y(),S,p=!1,v=!1,w=!1,N=!1;const j=()=>g;let T,A;const U=()=>{T&&(ee._ignoreSubscribers=!0,(T.isPush?t.history.pushState:t.history.replaceState)(T.state,"",T.href),ee._ignoreSubscribers=!1,T=void 0,A=void 0,S=void 0)},I=(Q,Y,pe)=>{const ne=m(Y);A||(S=g),g=$m(Y,pe),T={href:ne,state:pe,isPush:(T==null?void 0:T.isPush)||Q==="push"},A||(A=Promise.resolve().then(()=>U()))},E=Q=>{g=y(),ee.notify({type:Q})},L=async()=>{if(v){v=!1;return}const Q=y(),Y=Q.state[eo]-g.state[eo],pe=Y===1,ne=Y===-1,V=!pe&&!ne||p;p=!1;const ye=V?"GO":ne?"BACK":"FORWARD",R=V?{type:"GO",index:Y}:{type:ne?"BACK":"FORWARD"};if(w)w=!1;else{const H=u();if(typeof document<"u"&&H.length){for(const X of H)if(await X.blockerFn({currentLocation:g,nextLocation:Q,action:ye})){v=!0,t.history.go(1),ee.notify(R);return}}}g=y(),ee.notify(R)},W=Q=>{if(N){N=!1;return}let Y=!1;const pe=u();if(typeof document<"u"&&pe.length)for(const ne of pe){const V=ne.enableBeforeUnload??!0;if(V===!0){Y=!0;break}if(typeof V=="function"&&V()===!0){Y=!0;break}}if(Y)return Q.preventDefault(),Q.returnValue=""},ee=ZS({getLocation:j,getLength:()=>t.history.length,pushState:(Q,Y)=>I("push",Q,Y),replaceState:(Q,Y)=>I("replace",Q,Y),back:Q=>(Q&&(w=!0),N=!0,t.history.back()),forward:Q=>{Q&&(w=!0),N=!0,t.history.forward()},go:Q=>{p=!0,t.history.go(Q)},createHref:Q=>m(Q),flush:U,destroy:()=>{t.history.pushState=a,t.history.replaceState=l,t.removeEventListener(Yv,W,{capture:!0}),t.removeEventListener(Gv,L)},onBlocked:()=>{S&&g!==S&&(g=S)},getBlockers:u,setBlockers:f,notifyOnIndexChange:!1});return t.addEventListener(Yv,W,{capture:!0}),t.addEventListener(Gv,L),t.history.pushState=function(...Q){const Y=a.apply(t.history,Q);return ee._ignoreSubscribers||E("PUSH"),Y},t.history.replaceState=function(...Q){const Y=l.apply(t.history,Q);return ee._ignoreSubscribers||E("REPLACE"),Y},ee}function JS(e){let t=e.replace(/[\x00-\x1f\x7f]/g,"");return t.startsWith("//")&&(t="/"+t.replace(/^\/+/,"")),t}function $m(e,t){const a=JS(e),l=a.indexOf("#"),o=a.indexOf("?"),u=W0();return{href:a,pathname:a.substring(0,l>0?o>0?Math.min(l,o):l:o>0?o:a.length),hash:l>-1?a.substring(l):"",search:o>-1?a.slice(o,l===-1?void 0:l):"",state:t||{[eo]:0,key:u,__TSR_key:u}}}function W0(){return(Math.random()+1).toString(36).substring(7)}function Jo(e){const t=e.resolvedLocation,a=e.location;return{fromLocation:t,toLocation:a,pathChanged:(t==null?void 0:t.pathname)!==a.pathname,hrefChanged:(t==null?void 0:t.href)!==a.href,hashChanged:(t==null?void 0:t.hash)!==a.hash}}function e7(e){const t=e.filter(a=>a.status!=="redirected");return t.length===e.length?e:t}var t7=class{constructor(e){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.startTransition=t=>t(),this.update=t=>{var g;const a=this.options,l=this.basepath??(a==null?void 0:a.basepath)??"/",o=this.basepath===void 0,u=a==null?void 0:a.rewrite;if(this.options={...a,...t},this.isServer=this.options.isServer??typeof document>"u",this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=fS(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=XS()),this.origin=this.options.origin,this.origin||(window!=null&&window.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let S;this.resolvePathCache=Um(1e3),S=this.buildRouteTree(),this.setRoutes(S)}!this.__store&&this.latestLocation&&(this.__store=qS(s7(this.latestLocation)),vS(this));let f=!1;const m=this.options.basepath??"/",y=this.options.rewrite;if(o||l!==m||u!==y){this.basepath=m;const S=[],p=I2(m);p&&p!=="/"&&S.push(TS({basepath:m})),y&&S.push(y),this.rewrite=S.length===0?void 0:S.length===1?S[0]:CS(S),this.history&&this.updateLatestLocation(),f=!0}f&&this.__store&&this.__store.setState(S=>({...S,location:this.latestLocation})),typeof window<"u"&&"CSS"in window&&typeof((g=window.CSS)==null?void 0:g.supports)=="function"&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a)"))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const t=rS(this.routeTree,this.options.caseSensitive,(a,l)=>{a.init({originalIndex:l})});return this.options.routeMasks&&tS(this.options.routeMasks,t.processedTree),t},this.subscribe=(t,a)=>{const l={eventType:t,fn:a};return this.subscribers.add(l),()=>{this.subscribers.delete(l)}},this.emit=t=>{this.subscribers.forEach(a=>{a.eventType===t.type&&a.fn(t)})},this.parseLocation=(t,a)=>{const l=({pathname:m,search:y,hash:g,href:S,state:p})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(m)){const T=this.options.parseSearch(y),A=this.options.stringifySearch(T);return{href:m+A+g,publicHref:S,pathname:Qd(m).path,external:!1,searchStr:A,search:Ro(a==null?void 0:a.search,T),hash:Qd(g.slice(1)).path,state:Uo(a==null?void 0:a.state,p)}}const v=new URL(S,this.origin),w=Gg(this.rewrite,v),N=this.options.parseSearch(w.search),j=this.options.stringifySearch(N);return w.search=j,{href:w.href.replace(w.origin,""),publicHref:S,pathname:Qd(w.pathname).path,external:!!this.rewrite&&w.origin!==this.origin,searchStr:j,search:Ro(a==null?void 0:a.search,N),hash:Qd(w.hash.slice(1)).path,state:Uo(a==null?void 0:a.state,p)}},o=l(t),{__tempLocation:u,__tempKey:f}=o.state;if(u&&(!f||f===this.tempLocationKey)){const m=l(u);return m.state.key=o.state.key,m.state.__TSR_key=o.state.__TSR_key,delete m.state.__tempLocation,{...m,maskedLocation:o}}return o},this.resolvePathWithBase=(t,a)=>dS({base:t,to:$0(a),trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(t,a,l)=>typeof t=="string"?this.matchRoutesInternal({pathname:t,search:a},l):this.matchRoutesInternal(t,a),this.getMatchedRoutes=t=>a7({pathname:t,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=t=>{const a=this.getMatch(t);a&&(a.abortController.abort(),clearTimeout(a._nonReactive.pendingTimeout),a._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{const t=this.state.matches.filter(l=>l.status==="pending"),a=this.state.matches.filter(l=>l.isFetching==="loader");new Set([...this.state.pendingMatches??[],...t,...a]).forEach(l=>{this.cancelMatch(l.id)})},this.buildLocation=t=>{const a=(o={})=>{var G,Q;const u=o._fromLocation||this.pendingBuiltLocation||this.latestLocation,f=this.matchRoutesLightweight(u);o.from;const m=o.unsafeRelative==="path"?u.pathname:o.from??f.fullPath,y=this.resolvePathWithBase(m,"."),g=f.search,S=Object.assign(Object.create(null),f.params),p=o.to?this.resolvePathWithBase(y,`${o.to}`):this.resolvePathWithBase(y,"."),v=o.params===!1||o.params===null?Object.create(null):(o.params??!0)===!0?S:Object.assign(S,Vl(o.params,S)),w=this.getMatchedRoutes(p);let N=w.matchedRoutes;if((!w.foundRoute||w.foundRoute.path!=="/"&&w.routeParams["**"])&&this.options.notFoundRoute&&(N=[...N,this.options.notFoundRoute]),Object.keys(v).length>0)for(const Y of N){const pe=((G=Y.options.params)==null?void 0:G.stringify)??Y.options.stringifyParams;if(pe)try{Object.assign(v,pe(v))}catch{}}const j=t.leaveParams?p:Qd(zv({path:p,params:v,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path;let T=g;if(t._includeValidateSearch&&((Q=this.options.search)!=null&&Q.strict)){const Y={};N.forEach(pe=>{if(pe.options.validateSearch)try{Object.assign(Y,Nm(pe.options.validateSearch,{...Y,...T}))}catch{}}),T=Y}T=i7({search:T,dest:o,destRoutes:N,_includeValidateSearch:t._includeValidateSearch}),T=Ro(g,T);const A=this.options.stringifySearch(T),U=o.hash===!0?u.hash:o.hash?Vl(o.hash,u.hash):void 0,I=U?`#${U}`:"";let E=o.state===!0?u.state:o.state?Vl(o.state,u.state):{};E=Uo(u.state,E);const L=`${j}${A}${I}`;let W,ee,F=!1;if(this.rewrite){const Y=new URL(L,this.origin),pe=L2(this.rewrite,Y);W=Y.href.replace(Y.origin,""),pe.origin!==this.origin?(ee=pe.href,F=!0):ee=pe.pathname+pe.search+pe.hash}else W=X9(L),ee=W;return{publicHref:ee,href:W,pathname:j,search:T,searchStr:A,state:E,hash:U??"",external:F,unmaskOnReload:o.unmaskOnReload}},l=(o={},u)=>{const f=a(o);let m=u?a(u):void 0;if(!m){const y=Object.create(null);if(this.options.routeMasks){const g=nS(f.pathname,this.processedTree);if(g){Object.assign(y,g.rawParams);const{from:S,params:p,...v}=g.route,w=p===!1||p===null?Object.create(null):(p??!0)===!0?y:Object.assign(y,Vl(p,y));u={from:t.from,...v,params:w},m=a(u)}}}return m&&(f.maskedLocation=m),f};return t.mask?l(t,{from:t.from,...t.mask}):l(t)},this.commitLocation=async({viewTransition:t,ignoreBlocker:a,...l})=>{const o=()=>{const m=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];m.forEach(g=>{l.state[g]=this.latestLocation.state[g]});const y=Vo(l.state,this.latestLocation.state);return m.forEach(g=>{delete l.state[g]}),y},u=Jl(this.latestLocation.href)===Jl(l.href);let f=this.commitLocationPromise;if(this.commitLocationPromise=ku(()=>{f==null||f.resolve(),f=void 0}),u&&o())this.load();else{let{maskedLocation:m,hashScrollIntoView:y,...g}=l;m&&(g={...m,state:{...m.state,__tempKey:void 0,__tempLocation:{...g,search:g.searchStr,state:{...g.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(g.unmaskOnReload??this.options.unmaskOnReload??!1)&&(g.state.__tempKey=this.tempLocationKey)),g.state.__hashScrollIntoViewOptions=y??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=t,this.history[l.replace?"replace":"push"](g.publicHref,g.state,{ignoreBlocker:a})}return this.resetNextScroll=l.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:t,resetScroll:a,hashScrollIntoView:l,viewTransition:o,ignoreBlocker:u,href:f,...m}={})=>{if(f){const S=this.history.location.state.__TSR_index,p=$m(f,{__TSR_index:t?S:S+1}),v=new URL(p.pathname,this.origin);m.to=Gg(this.rewrite,v).pathname,m.search=this.options.parseSearch(p.search),m.hash=p.hash.slice(1)}const y=this.buildLocation({...m,_includeValidateSearch:!0});this.pendingBuiltLocation=y;const g=this.commitLocation({...y,viewTransition:o,replace:t,resetScroll:a,hashScrollIntoView:l,ignoreBlocker:u});return Promise.resolve().then(()=>{this.pendingBuiltLocation===y&&(this.pendingBuiltLocation=void 0)}),g},this.navigate=async({to:t,reloadDocument:a,href:l,publicHref:o,...u})=>{var m,y;let f=!1;if(l)try{new URL(`${l}`),f=!0}catch{}if(f&&!a&&(a=!0),a){if(t!==void 0||!l){const S=this.buildLocation({to:t,...u});l=l??S.publicHref,o=o??S.publicHref}const g=!f&&o?o:l;if(Pm(g,this.protocolAllowlist))return Promise.resolve();if(!u.ignoreBlocker){const S=((y=(m=this.history).getBlockers)==null?void 0:y.call(m))??[];for(const p of S)if(p!=null&&p.blockerFn&&await p.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return Promise.resolve()}return u.replace?window.location.replace(g):window.location.href=g,Promise.resolve()}return this.buildAndCommitLocation({...u,href:l,to:t,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();const t=this.matchRoutes(this.latestLocation);this.__store.setState(a=>({...a,status:"pending",statusCode:200,isLoading:!0,location:this.latestLocation,pendingMatches:t,cachedMatches:a.cachedMatches.filter(l=>!t.some(o=>o.id===l.id))}))},this.load=async t=>{let a,l,o;const u=this.state.resolvedLocation??this.state.location;for(o=new Promise(m=>{this.startTransition(async()=>{var y;try{this.beforeLoad();const g=this.latestLocation,S=this.state.resolvedLocation;this.state.redirect||this.emit({type:"onBeforeNavigate",...Jo({resolvedLocation:S,location:g})}),this.emit({type:"onBeforeLoad",...Jo({resolvedLocation:S,location:g})}),await Kv({router:this,sync:t==null?void 0:t.sync,forceStaleReload:u.href===g.href,matches:this.state.pendingMatches,location:g,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let p=[],v=[],w=[],N=[];mf(()=>{this.__store.setState(j=>{const T=j.matches,A=j.pendingMatches||j.matches;return p=T.filter(U=>!A.some(I=>I.id===U.id)),v=T.filter(U=>!A.some(I=>I.routeId===U.routeId)),w=A.filter(U=>!T.some(I=>I.routeId===U.routeId)),N=A.filter(U=>T.some(I=>I.routeId===U.routeId)),{...j,isLoading:!1,loadedAt:Date.now(),matches:A,pendingMatches:void 0,cachedMatches:[...j.cachedMatches,...p.filter(U=>U.status!=="error"&&U.status!=="notFound"&&U.status!=="redirected")]}}),this.clearExpiredCache()}),[[v,"onLeave"],[w,"onEnter"],[N,"onStay"]].forEach(([j,T])=>{j.forEach(A=>{var U,I;(I=(U=this.looseRoutesById[A.routeId].options)[T])==null||I.call(U,A)})})})})}})}catch(g){Sa(g)?(a=g,this.navigate({...a.options,replace:!0,ignoreBlocker:!0})):sa(g)&&(l=g),this.__store.setState(S=>({...S,statusCode:a?a.status:l?404:S.matches.some(p=>p.status==="error")?500:200,redirect:a}))}this.latestLoadPromise===o&&((y=this.commitLocationPromise)==null||y.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),m()})}),this.latestLoadPromise=o,await o;this.latestLoadPromise&&o!==this.latestLoadPromise;)await this.latestLoadPromise;let f;this.hasNotFoundMatch()?f=404:this.__store.state.matches.some(m=>m.status==="error")&&(f=500),f!==void 0&&this.__store.setState(m=>({...m,statusCode:f}))},this.startViewTransition=t=>{const a=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,a&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let l;if(typeof a=="object"&&this.isViewTransitionTypesSupported){const o=this.latestLocation,u=this.state.resolvedLocation,f=typeof a.types=="function"?a.types(Jo({resolvedLocation:u,location:o})):a.types;if(f===!1){t();return}l={update:t,types:f}}else l=t;document.startViewTransition(l)}else t()},this.updateMatch=(t,a)=>{this.startTransition(()=>{var o;const l=(o=this.state.pendingMatches)!=null&&o.some(u=>u.id===t)?"pendingMatches":this.state.matches.some(u=>u.id===t)?"matches":this.state.cachedMatches.some(u=>u.id===t)?"cachedMatches":"";l&&(l==="cachedMatches"?this.__store.setState(u=>({...u,cachedMatches:e7(u.cachedMatches.map(f=>f.id===t?a(f):f))})):this.__store.setState(u=>{var f;return{...u,[l]:(f=u[l])==null?void 0:f.map(m=>m.id===t?a(m):m)}}))})},this.getMatch=t=>{var l;const a=o=>o.id===t;return this.state.cachedMatches.find(a)??((l=this.state.pendingMatches)==null?void 0:l.find(a))??this.state.matches.find(a)},this.invalidate=t=>{const a=l=>{var o;return((o=t==null?void 0:t.filter)==null?void 0:o.call(t,l))??!0?{...l,invalid:!0,...t!=null&&t.forcePending||l.status==="error"||l.status==="notFound"?{status:"pending",error:void 0}:void 0}:l};return this.__store.setState(l=>{var o;return{...l,matches:l.matches.map(a),cachedMatches:l.cachedMatches.map(a),pendingMatches:(o=l.pendingMatches)==null?void 0:o.map(a)}}),this.shouldViewTransition=!1,this.load({sync:t==null?void 0:t.sync})},this.getParsedLocationHref=t=>t.publicHref||"/",this.resolveRedirect=t=>{const a=t.headers.get("Location");if(!t.options.href||t.options._builtLocation){const l=t.options._builtLocation??this.buildLocation(t.options),o=this.getParsedLocationHref(l);t.options.href=o,t.headers.set("Location",o)}else if(a)try{const l=new URL(a);if(this.origin&&l.origin===this.origin){const o=l.pathname+l.search+l.hash;t.options.href=o,t.headers.set("Location",o)}}catch{}if(t.options.href&&!t.options._builtLocation&&Pm(t.options.href,this.protocolAllowlist))throw new Error("Redirect blocked: unsafe protocol");return t.headers.get("Location")||t.headers.set("Location",t.options.href),t},this.clearCache=t=>{const a=t==null?void 0:t.filter;a!==void 0?this.__store.setState(l=>({...l,cachedMatches:l.cachedMatches.filter(o=>!a(o))})):this.__store.setState(l=>({...l,cachedMatches:[]}))},this.clearExpiredCache=()=>{const t=a=>{const l=this.looseRoutesById[a.routeId];if(!l.options.loader)return!0;const o=(a.preload?l.options.preloadGcTime??this.options.defaultPreloadGcTime:l.options.gcTime??this.options.defaultGcTime)??300*1e3;return a.status==="error"?!0:Date.now()-a.updatedAt>=o};this.clearCache({filter:t})},this.loadRouteChunk=xf,this.preloadRoute=async t=>{const a=t._builtLocation??this.buildLocation(t);let l=this.matchRoutes(a,{throwOnError:!0,preload:!0,dest:t});const o=new Set([...this.state.matches,...this.state.pendingMatches??[]].map(f=>f.id)),u=new Set([...o,...this.state.cachedMatches.map(f=>f.id)]);mf(()=>{l.forEach(f=>{u.has(f.id)||this.__store.setState(m=>({...m,cachedMatches:[...m.cachedMatches,f]}))})});try{return l=await Kv({router:this,matches:l,location:a,preload:!0,updateMatch:(f,m)=>{o.has(f)?l=l.map(y=>y.id===f?m(y):y):this.updateMatch(f,m)}}),l}catch(f){if(Sa(f))return f.options.reloadDocument?void 0:await this.preloadRoute({...f.options,_fromLocation:a});sa(f)||console.error(f);return}},this.matchRoute=(t,a)=>{const l={...t,to:t.to?this.resolvePathWithBase(t.from||"",t.to):void 0,params:t.params||{},leaveParams:!0},o=this.buildLocation(l);if(a!=null&&a.pending&&this.state.status!=="pending")return!1;const u=((a==null?void 0:a.pending)===void 0?!this.state.isLoading:a.pending)?this.latestLocation:this.state.resolvedLocation||this.state.location,f=sS(o.pathname,(a==null?void 0:a.caseSensitive)??!1,(a==null?void 0:a.fuzzy)??!1,u.pathname,this.processedTree);return!f||t.params&&!Vo(f.rawParams,t.params,{partial:!0})?!1:(a==null?void 0:a.includeSearch)??!0?Vo(u.search,o.search,{partial:!0})?f.rawParams:!1:f.rawParams},this.hasNotFoundMatch=()=>this.__store.state.matches.some(t=>t.status==="notFound"||t.globalNotFound),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??"fuzzy",stringifySearch:e.stringifySearch??wS,parseSearch:e.parseSearch??jS,protocolAllowlist:e.protocolAllowlist??Z9}),typeof document<"u"&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.__store.state}setRoutes({routesById:e,routesByPath:t,processedTree:a}){this.routesById=e,this.routesByPath=t,this.processedTree=a;const l=this.options.notFoundRoute;l&&(l.init({originalIndex:99999999999}),this.routesById[l.id]=l)}get looseRoutesById(){return this.routesById}getParentContext(e){return e!=null&&e.id?e.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(e,t){var p,v;const a=this.getMatchedRoutes(e.pathname),{foundRoute:l,routeParams:o,parsedParams:u}=a;let{matchedRoutes:f}=a,m=!1;(l?l.path!=="/"&&o["**"]:Jl(e.pathname))&&(this.options.notFoundRoute?f=[...f,this.options.notFoundRoute]:m=!0);const y=m?l7(this.options.notFoundMode,f):void 0,g=new Array(f.length),S=new Map(this.state.matches.map(w=>[w.routeId,w]));for(let w=0;w<f.length;w++){const N=f[w],j=g[w-1];let T,A,U;{const ye=(j==null?void 0:j.search)??e.search,R=(j==null?void 0:j._strictSearch)??void 0;try{const H=Nm(N.options.validateSearch,{...ye})??void 0;T={...ye,...H},A={...R,...H},U=void 0}catch(H){let X=H;if(H instanceof Fm||(X=new Fm(H.message,{cause:H})),t!=null&&t.throwOnError)throw X;T=ye,A={},U=X}}const I=((v=(p=N.options).loaderDeps)==null?void 0:v.call(p,{search:T}))??"",E=I?JSON.stringify(I):"",{interpolatedPath:L,usedParams:W}=zv({path:N.fullPath,params:o,decoder:this.pathParamsDecoder,server:this.isServer}),ee=N.id+L+E,F=this.getMatch(ee),G=S.get(N.id),Q=(F==null?void 0:F._strictParams)??W;let Y;if(!F)try{Zv(N,W,u,Q)}catch(ye){if(sa(ye)||Sa(ye)?Y=ye:Y=new n7(ye.message,{cause:ye}),t!=null&&t.throwOnError)throw Y}Object.assign(o,Q);const pe=G?"stay":"enter";let ne;if(F)ne={...F,cause:pe,params:(G==null?void 0:G.params)??o,_strictParams:Q,search:Ro(G?G.search:F.search,T),_strictSearch:A};else{const ye=N.options.loader||N.options.beforeLoad||N.lazyFn||W2(N)?"pending":"success";ne={id:ee,ssr:N.options.ssr,index:w,routeId:N.id,params:(G==null?void 0:G.params)??o,_strictParams:Q,pathname:L,updatedAt:Date.now(),search:G?Ro(G.search,T):T,_strictSearch:A,searchError:void 0,status:ye,isFetching:!1,error:void 0,paramsError:Y,__routeContext:void 0,_nonReactive:{loadPromise:ku()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:pe,loaderDeps:G?Uo(G.loaderDeps,I):I,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:N.options.staticData||{},fullPath:N.fullPath}}t!=null&&t.preload||(ne.globalNotFound=y===N.id),ne.searchError=U;const V=this.getParentContext(j);ne.context={...V,...ne.__routeContext,...ne.__beforeLoadContext},g[w]=ne}for(let w=0;w<g.length;w++){const N=g[w],j=this.looseRoutesById[N.routeId],T=this.getMatch(N.id),A=S.get(N.routeId);if(N.params=A?Ro(A.params,o):o,!T){const U=g[w-1],I=this.getParentContext(U);if(j.options.context){const E={deps:N.loaderDeps,params:N.params,context:I??{},location:e,navigate:L=>this.navigate({...L,_fromLocation:e}),buildLocation:this.buildLocation,cause:N.cause,abortController:N.abortController,preload:!!N.preload,matches:g,routeId:j.id};N.__routeContext=j.options.context(E)??void 0}N.context={...I,...N.__routeContext,...N.__beforeLoadContext}}}return g}matchRoutesLightweight(e){const{matchedRoutes:t,routeParams:a,parsedParams:l}=this.getMatchedRoutes(e.pathname),o=vf(t),u={...e.search};for(const g of t)try{Object.assign(u,Nm(g.options.validateSearch,u))}catch{}const f=vf(this.state.matches),m=f&&f.routeId===o.id&&e.pathname===this.state.location.pathname;let y;if(m)y=f.params;else{const g=Object.assign(Object.create(null),a);for(const S of t)try{Zv(S,a,l??{},g)}catch{}y=g}return{matchedRoutes:t,fullPath:o.fullPath,search:u,params:y}}},Fm=class extends Error{},n7=class extends Error{};function s7(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:e,matches:[],pendingMatches:[],cachedMatches:[],statusCode:200}}function Nm(e,t){if(e==null)return{};if("~standard"in e){const a=e["~standard"].validate(t);if(a instanceof Promise)throw new Fm("Async validation not supported");if(a.issues)throw new Fm(JSON.stringify(a.issues,void 0,2),{cause:a});return a.value}return"parse"in e?e.parse(t):typeof e=="function"?e(t):{}}function a7({pathname:e,routesById:t,processedTree:a}){const l=Object.create(null),o=Jl(e);let u,f;const m=aS(o,a,!0);return m&&(u=m.route,Object.assign(l,m.rawParams),f=Object.assign(Object.create(null),m.parsedParams)),{matchedRoutes:(m==null?void 0:m.branch)||[t.__root__],routeParams:l,foundRoute:u,parsedParams:f}}function i7({search:e,dest:t,destRoutes:a,_includeValidateSearch:l}){return r7(a)(e,t,l??!1)}function r7(e){var o;const t={dest:null,_includeValidateSearch:!1,middlewares:[]};for(const u of e){if("search"in u.options)(o=u.options.search)!=null&&o.middlewares&&t.middlewares.push(...u.options.search.middlewares);else if(u.options.preSearchFilters||u.options.postSearchFilters){const f=({search:m,next:y})=>{let g=m;"preSearchFilters"in u.options&&u.options.preSearchFilters&&(g=u.options.preSearchFilters.reduce((p,v)=>v(p),m));const S=y(g);return"postSearchFilters"in u.options&&u.options.postSearchFilters?u.options.postSearchFilters.reduce((p,v)=>v(p),S):S};t.middlewares.push(f)}if(u.options.validateSearch){const f=({search:m,next:y})=>{const g=y(m);if(!t._includeValidateSearch)return g;try{return{...g,...Nm(u.options.validateSearch,g)??void 0}}catch{return g}};t.middlewares.push(f)}}const a=({search:u})=>{const f=t.dest;return f.search?f.search===!0?u:Vl(f.search,u):{}};t.middlewares.push(a);const l=(u,f,m)=>{if(u>=m.length)return f;const y=m[u];return y({search:f,next:S=>l(u+1,S,m)})};return function(f,m,y){return t.dest=m,t._includeValidateSearch=y,l(0,f,t.middlewares)}}function l7(e,t){if(e!=="root")for(let a=t.length-1;a>=0;a--){const l=t[a];if(l.children)return l.id}return Zo}function Zv(e,t,a,l){var u;const o=((u=e.options.params)==null?void 0:u.parse)??e.options.parseParams;if(o)if(e.options.skipRouteOnParseError)for(const f in t)f in a&&(l[f]=a[f]);else{const f=o(l);Object.assign(l,f)}}var o7="Error preloading route! ☝️",K2=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=t=>{var y,g;this.originalIndex=t.originalIndex;const a=this.options,l=!(a!=null&&a.path)&&!(a!=null&&a.id);this.parentRoute=(g=(y=this.options).getParentRoute)==null?void 0:g.call(y),l?this._path=Zo:this.parentRoute||no(!1);let o=l?Zo:a==null?void 0:a.path;o&&o!=="/"&&(o=O2(o));const u=(a==null?void 0:a.id)||o;let f=l?Zo:Sm([this.parentRoute.id==="__root__"?"":this.parentRoute.id,u]);o==="__root__"&&(o="/"),f!=="__root__"&&(f=Sm(["/",f]));const m=f==="__root__"?"/":Sm([this.parentRoute.fullPath,o]);this._path=o,this._id=f,this._fullPath=m,this._to=Jl(m)},this.addChildren=t=>this._addFileChildren(t),this._addFileChildren=t=>(Array.isArray(t)&&(this.children=t),typeof t=="object"&&t!==null&&(this.children=Object.values(t)),this),this._addFileTypes=()=>this,this.updateLoader=t=>(Object.assign(this.options,t),this),this.update=t=>(Object.assign(this.options,t),this),this.lazy=t=>(this.lazyFn=t,this),this.redirect=t=>ES({from:this.fullPath,...t}),this.options=e||{},this.isRoot=!(e!=null&&e.getParentRoute),e!=null&&e.id&&(e!=null&&e.path))throw new Error("Route cannot have both an 'id' and a 'path' option.")}},c7=class extends K2{constructor(e){super(e)}};function K0(e){const t=e.errorComponent??Q0;return i.jsx(u7,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:a,reset:l})=>a?_.createElement(t,{error:a,reset:l}):e.children})}var u7=class extends _.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e){return{resetKey:e.getResetKey()}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidUpdate(e,t){t.error&&t.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.resetKey!==this.props.getResetKey()?null:this.state.error,reset:()=>{this.reset()}})}};function Q0({error:e}){const[t,a]=_.useState(!1);return i.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[i.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),i.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>a(l=>!l),children:t?"Hide Error":"Show Error"})]}),i.jsx("div",{style:{height:".25rem"}}),t?i.jsx("div",{children:i.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?i.jsx("code",{children:e.message}):null})}):null]})}function d7({children:e,fallback:t=null}){return Q2()?i.jsx(Fr.Fragment,{children:e}):i.jsx(Fr.Fragment,{children:t})}function Q2(){return Fr.useSyncExternalStore(f7,()=>!0,()=>!1)}function f7(){return()=>{}}var G2=_.createContext(null);function ai(e){const t=_.useContext(G2);return e==null||e.warn,t}var sg={exports:{}},ag={},ig={exports:{}},rg={};/**
51
+ * @license React
52
+ * use-sync-external-store-shim.production.js
53
+ *
54
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
55
+ *
56
+ * This source code is licensed under the MIT license found in the
57
+ * LICENSE file in the root directory of this source tree.
58
+ */var Xv;function h7(){if(Xv)return rg;Xv=1;var e=Uf();function t(p,v){return p===v&&(p!==0||1/p===1/v)||p!==p&&v!==v}var a=typeof Object.is=="function"?Object.is:t,l=e.useState,o=e.useEffect,u=e.useLayoutEffect,f=e.useDebugValue;function m(p,v){var w=v(),N=l({inst:{value:w,getSnapshot:v}}),j=N[0].inst,T=N[1];return u(function(){j.value=w,j.getSnapshot=v,y(j)&&T({inst:j})},[p,w,v]),o(function(){return y(j)&&T({inst:j}),p(function(){y(j)&&T({inst:j})})},[p]),f(w),w}function y(p){var v=p.getSnapshot;p=p.value;try{var w=v();return!a(p,w)}catch{return!0}}function g(p,v){return v()}var S=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?g:m;return rg.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:S,rg}var Jv;function m7(){return Jv||(Jv=1,ig.exports=h7()),ig.exports}/**
59
+ * @license React
60
+ * use-sync-external-store-shim/with-selector.production.js
61
+ *
62
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
63
+ *
64
+ * This source code is licensed under the MIT license found in the
65
+ * LICENSE file in the root directory of this source tree.
66
+ */var e4;function p7(){if(e4)return ag;e4=1;var e=Uf(),t=m7();function a(g,S){return g===S&&(g!==0||1/g===1/S)||g!==g&&S!==S}var l=typeof Object.is=="function"?Object.is:a,o=t.useSyncExternalStore,u=e.useRef,f=e.useEffect,m=e.useMemo,y=e.useDebugValue;return ag.useSyncExternalStoreWithSelector=function(g,S,p,v,w){var N=u(null);if(N.current===null){var j={hasValue:!1,value:null};N.current=j}else j=N.current;N=m(function(){function A(W){if(!U){if(U=!0,I=W,W=v(W),w!==void 0&&j.hasValue){var ee=j.value;if(w(ee,W))return E=ee}return E=W}if(ee=E,l(I,W))return ee;var F=v(W);return w!==void 0&&w(ee,F)?(I=W,ee):(I=W,E=F)}var U=!1,I,E,L=p===void 0?null:p;return[function(){return A(S())},L===null?void 0:function(){return A(L())}]},[S,p,v,w]);var T=o(g,N[0],N[1]);return f(function(){j.hasValue=!0,j.value=T},[T]),y(T),T},ag}var t4;function g7(){return t4||(t4=1,sg.exports=p7()),sg.exports}var _7=g7();function y7(e,t){return e===t}function v7(e,t,a=y7){const l=_.useCallback(f=>{if(!e)return()=>{};const{unsubscribe:m}=e.subscribe(f);return m},[e]),o=_.useCallback(()=>e==null?void 0:e.get(),[e]);return _7.useSyncExternalStoreWithSelector(l,o,o,t,a)}function Ia(e){const t=ai({warn:(e==null?void 0:e.router)===void 0}),a=(e==null?void 0:e.router)||t,l=_.useRef(void 0);return v7(a.__store,o=>{if(e!=null&&e.select){if(e.structuralSharing??a.options.defaultStructuralSharing){const u=Uo(l.current,e.select(o));return l.current=u,u}return e.select(o)}return o})}var pp=_.createContext(void 0),b7=_.createContext(void 0);function io(e){const t=_.useContext(e.from?b7:pp);return Ia({select:a=>{const l=a.matches.find(o=>e.from?e.from===o.routeId:o.id===t);if(no(!((e.shouldThrow??!0)&&!l),`Could not find ${e.from?`an active match from "${e.from}"`:"a nearest match!"}`),l!==void 0)return e.select?e.select(l):l},structuralSharing:e.structuralSharing})}function G0(e){return io({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Y0(e){const{select:t,...a}=e;return io({...a,select:l=>t?t(l.loaderDeps):l.loaderDeps})}function $u(e){return io({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const a=e.strict===!1?t.params:t._strictParams;return e.select?e.select(a):a}})}function V0(e){return io({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Ei(e){const t=ai();return _.useCallback(a=>t.navigate({...a,from:a.from??(e==null?void 0:e.from)}),[e==null?void 0:e.from,t])}function Z0(e){return io({...e,select:t=>e.select?e.select(t.context):t.context})}var ki=v2();function x7(e,t){const a=ai(),l=W9(t),{activeProps:o,inactiveProps:u,activeOptions:f,to:m,preload:y,preloadDelay:g,hashScrollIntoView:S,replace:p,startTransition:v,resetScroll:w,viewTransition:N,children:j,target:T,disabled:A,style:U,className:I,onClick:E,onBlur:L,onFocus:W,onMouseEnter:ee,onMouseLeave:F,onTouchStart:G,ignoreBlocker:Q,params:Y,search:pe,hash:ne,state:V,mask:ye,reloadDocument:R,unsafeRelative:H,from:X,_fromLocation:oe,...ie}=e,k=Q2(),K=Ia({select:Z=>{const me=Z.matches[Z.matches.length-1];return{search:me==null?void 0:me.search,hash:Z.location.hash,path:me==null?void 0:me.pathname}},structuralSharing:!0}),_e=e.from,fe=_.useMemo(()=>({...e,from:_e}),[a,K,_e,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),Te=_.useMemo(()=>a.buildLocation({...fe}),[a,fe]),re=Te.maskedLocation?Te.maskedLocation.publicHref:Te.publicHref,we=Te.maskedLocation?Te.maskedLocation.external:Te.external,ve=_.useMemo(()=>E7(re,we,a.history,A),[A,we,re,a.history]),ze=_.useMemo(()=>{if(ve!=null&&ve.external)return Pm(ve.href,a.protocolAllowlist)?void 0:ve.href;if(!C7(m)&&!(typeof m!="string"||m.indexOf(":")===-1))try{return new URL(m),Pm(m,a.protocolAllowlist)?void 0:m}catch{}},[m,ve,a.protocolAllowlist]),Be=Ia({select:Z=>{if(ze)return!1;if(f!=null&&f.exact){if(!uS(Z.location.pathname,Te.pathname,a.basepath))return!1}else{const me=zm(Z.location.pathname,a.basepath),Ce=zm(Te.pathname,a.basepath);if(!(me.startsWith(Ce)&&(me.length===Ce.length||me[Ce.length]==="/")))return!1}return((f==null?void 0:f.includeSearch)??!0)&&!Vo(Z.location.search,Te.search,{partial:!(f!=null&&f.exact),ignoreUndefined:!(f!=null&&f.explicitUndefined)})?!1:f!=null&&f.includeHash?k&&Z.location.hash===Te.hash:!0}}),St=Be?Vl(o,{})??S7:lg,Ke=Be?lg:Vl(u,{})??lg,tt=[I,St.className,Ke.className].filter(Boolean).join(" "),nn=(U||St.style||Ke.style)&&{...U,...St.style,...Ke.style},[Xt,jn]=_.useState(!1),zt=_.useRef(!1),Bt=e.reloadDocument||ze?!1:y??a.options.defaultPreload,_t=g??a.options.defaultPreloadDelay??0,vt=_.useCallback(()=>{a.preloadRoute({...fe,_builtLocation:Te}).catch(Z=>{console.warn(Z),console.warn(o7)})},[a,fe,Te]);q9(l,_.useCallback(Z=>{Z!=null&&Z.isIntersecting&&vt()},[vt]),k7,{disabled:!!A||Bt!=="viewport"}),_.useEffect(()=>{zt.current||!A&&Bt==="render"&&(vt(),zt.current=!0)},[A,vt,Bt]);const dt=Z=>{const me=Z.currentTarget.getAttribute("target"),Ce=T!==void 0?T:me;if(!A&&!T7(Z)&&!Z.defaultPrevented&&(!Ce||Ce==="_self")&&Z.button===0){Z.preventDefault(),ki.flushSync(()=>{jn(!0)});const Oe=a.subscribe("onResolved",()=>{Oe(),jn(!1)});a.navigate({...fe,replace:p,resetScroll:w,hashScrollIntoView:S,startTransition:v,viewTransition:N,ignoreBlocker:Q})}};if(ze)return{...ie,ref:l,href:ze,...j&&{children:j},...T&&{target:T},...A&&{disabled:A},...U&&{style:U},...I&&{className:I},...E&&{onClick:E},...L&&{onBlur:L},...W&&{onFocus:W},...ee&&{onMouseEnter:ee},...F&&{onMouseLeave:F},...G&&{onTouchStart:G}};const cn=Z=>{if(A||Bt!=="intent")return;if(!_t){vt();return}const me=Z.currentTarget;if(Vd.has(me))return;const Ce=setTimeout(()=>{Vd.delete(me),vt()},_t);Vd.set(me,Ce)},Pn=Z=>{A||Bt!=="intent"||vt()},ke=Z=>{if(A||!Bt||!_t)return;const me=Z.currentTarget,Ce=Vd.get(me);Ce&&(clearTimeout(Ce),Vd.delete(me))};return{...ie,...St,...Ke,href:ve==null?void 0:ve.href,ref:l,onClick:Vc([E,dt]),onBlur:Vc([L,ke]),onFocus:Vc([W,cn]),onMouseEnter:Vc([ee,cn]),onMouseLeave:Vc([F,ke]),onTouchStart:Vc([G,Pn]),disabled:!!A,target:T,...nn&&{style:nn},...tt&&{className:tt},...A&&j7,...Be&&w7,...k&&Xt&&N7}}var lg={},S7={className:"active"},j7={role:"link","aria-disabled":!0},w7={"data-status":"active","aria-current":"page"},N7={"data-transitioning":"transitioning"},Vd=new WeakMap,k7={rootMargin:"100px"},Vc=e=>t=>{for(const a of e)if(a){if(t.defaultPrevented)return;a(t)}};function E7(e,t,a,l){if(!l)return t?{href:e,external:!0}:{href:a.createHref(e)||"/",external:!1}}function C7(e){if(typeof e!="string")return!1;const t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var qm=_.forwardRef((e,t)=>{const{_asChild:a,...l}=e,{type:o,...u}=x7(l,t),f=typeof l.children=="function"?l.children({isActive:u["data-status"]==="active"}):l.children;if(!a){const{disabled:m,...y}=u;return _.createElement("a",y,f)}return _.createElement(a,u,f)});function T7(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var M7=class extends K2{constructor(e){super(e),this.useMatch=t=>io({select:t==null?void 0:t.select,from:this.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>Z0({...t,from:this.id}),this.useSearch=t=>V0({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useParams=t=>$u({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useLoaderDeps=t=>Y0({...t,from:this.id}),this.useLoaderData=t=>G0({...t,from:this.id}),this.useNavigate=()=>Ei({from:this.fullPath}),this.Link=Fr.forwardRef((t,a)=>i.jsx(qm,{ref:a,from:this.fullPath,...t})),this.$$typeof=Symbol.for("react.memo")}};function rc(e){return new M7(e)}var R7=class extends c7{constructor(e){super(e),this.useMatch=t=>io({select:t==null?void 0:t.select,from:this.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>Z0({...t,from:this.id}),this.useSearch=t=>V0({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useParams=t=>$u({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useLoaderDeps=t=>Y0({...t,from:this.id}),this.useLoaderData=t=>G0({...t,from:this.id}),this.useNavigate=()=>Ei({from:this.fullPath}),this.Link=Fr.forwardRef((t,a)=>i.jsx(qm,{ref:a,from:this.fullPath,...t})),this.$$typeof=Symbol.for("react.memo")}};function A7(e){return new R7(e)}function n4(e){return typeof e=="object"?new s4(e,{silent:!0}).createRoute(e):new s4(e,{silent:!0}).createRoute}var s4=class{constructor(e,t){this.path=e,this.createRoute=a=>{const l=rc(a);return l.isRoot=!1,l},this.silent=t==null?void 0:t.silent}},a4=class{constructor(e){this.useMatch=t=>io({select:t==null?void 0:t.select,from:this.options.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>Z0({...t,from:this.options.id}),this.useSearch=t=>V0({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.options.id}),this.useParams=t=>$u({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.options.id}),this.useLoaderDeps=t=>Y0({...t,from:this.options.id}),this.useLoaderData=t=>G0({...t,from:this.options.id}),this.useNavigate=()=>Ei({from:ai().routesById[this.options.id].fullPath}),this.options=e,this.$$typeof=Symbol.for("react.memo")}};function i4(e){return typeof e=="object"?new a4(e):t=>new a4({id:e,...t})}function D7(e){const t=Ia({select:a=>`not-found-${a.location.pathname}-${a.status}`});return i.jsx(K0,{getResetKey:()=>t,onCatch:(a,l)=>{var o;if(sa(a))(o=e.onCatch)==null||o.call(e,a,l);else throw a},errorComponent:({error:a})=>{var l;if(sa(a))return(l=e.fallback)==null?void 0:l.call(e,a);throw a},children:e.children})}function O7(){return i.jsx("p",{children:"Not Found"})}function su(e){return i.jsx(i.Fragment,{children:e.children})}function Y2(e,t,a){return t.options.notFoundComponent?i.jsx(t.options.notFoundComponent,{...a}):e.options.defaultNotFoundComponent?i.jsx(e.options.defaultNotFoundComponent,{...a}):i.jsx(O7,{})}function I7(){return ai().isScrollRestoring,null}var V2=_.memo(function({matchId:t}){var N,j;const a=ai(),l=Ia({select:T=>{var I;const A=T.matches.findIndex(E=>E.id===t),U=T.matches[A];return no(U),{routeId:U.routeId,ssr:U.ssr,_displayPending:U._displayPending,resetKey:T.loadedAt,parentRouteId:(I=T.matches[A-1])==null?void 0:I.routeId}},structuralSharing:!0}),o=a.routesById[l.routeId],u=o.options.pendingComponent??a.options.defaultPendingComponent,f=u?i.jsx(u,{}):null,m=o.options.errorComponent??a.options.defaultErrorComponent,y=o.options.onCatch??a.options.defaultOnCatch,g=o.isRoot?o.options.notFoundComponent??((N=a.options.notFoundRoute)==null?void 0:N.options.component):o.options.notFoundComponent,S=l.ssr===!1||l.ssr==="data-only",p=(!o.isRoot||o.options.wrapInSuspense||S)&&(o.options.wrapInSuspense??u??(((j=o.options.errorComponent)==null?void 0:j.preload)||S))?_.Suspense:su,v=m?K0:su,w=g?D7:su;return i.jsxs(o.isRoot?o.options.shellComponent??su:su,{children:[i.jsx(pp.Provider,{value:t,children:i.jsx(p,{fallback:f,children:i.jsx(v,{getResetKey:()=>l.resetKey,errorComponent:m||Q0,onCatch:(T,A)=>{if(sa(T))throw T;y==null||y(T,A)},children:i.jsx(w,{fallback:T=>{if(!g||T.routeId&&T.routeId!==l.routeId||!T.routeId&&!o.isRoot)throw T;return _.createElement(g,T)},children:S||l._displayPending?i.jsx(d7,{fallback:f,children:i.jsx(r4,{matchId:t})}):i.jsx(r4,{matchId:t})})})})}),l.parentRouteId===Zo&&a.options.scrollRestoration?i.jsxs(i.Fragment,{children:[i.jsx(L7,{}),i.jsx(I7,{})]}):null]})});function L7(){const e=ai(),t=_.useRef(void 0);return i.jsx("script",{suppressHydrationWarning:!0,ref:a=>{a&&(t.current===void 0||t.current.href!==e.latestLocation.href)&&(e.emit({type:"onRendered",...Jo(e.state)}),t.current=e.latestLocation)}},e.latestLocation.state.__TSR_key)}var r4=_.memo(function({matchId:t}){var y,g,S,p;const a=ai(),{match:l,key:o,routeId:u}=Ia({select:v=>{var T;const w=v.matches.find(A=>A.id===t),N=w.routeId,j=(T=a.routesById[N].options.remountDeps??a.options.defaultRemountDeps)==null?void 0:T({routeId:N,loaderDeps:w.loaderDeps,params:w._strictParams,search:w._strictSearch});return{key:j?JSON.stringify(j):void 0,routeId:N,match:{id:w.id,status:w.status,error:w.error,_forcePending:w._forcePending,_displayPending:w._displayPending}}},structuralSharing:!0}),f=a.routesById[u],m=_.useMemo(()=>{const v=f.options.component??a.options.defaultComponent;return v?i.jsx(v,{},o):i.jsx(Z2,{})},[o,f.options.component,a.options.defaultComponent]);if(l._displayPending)throw(y=a.getMatch(l.id))==null?void 0:y._nonReactive.displayPendingPromise;if(l._forcePending)throw(g=a.getMatch(l.id))==null?void 0:g._nonReactive.minPendingPromise;if(l.status==="pending"){const v=f.options.pendingMinMs??a.options.defaultPendingMinMs;if(v){const w=a.getMatch(l.id);if(w&&!w._nonReactive.minPendingPromise){const N=ku();w._nonReactive.minPendingPromise=N,setTimeout(()=>{N.resolve(),w._nonReactive.minPendingPromise=void 0},v)}}throw(S=a.getMatch(l.id))==null?void 0:S._nonReactive.loadPromise}if(l.status==="notFound")return no(sa(l.error)),Y2(a,f,l.error);if(l.status==="redirected")throw no(Sa(l.error)),(p=a.getMatch(l.id))==null?void 0:p._nonReactive.loadPromise;if(l.status==="error")throw l.error;return m}),Z2=_.memo(function(){const t=ai(),a=_.useContext(pp),l=Ia({select:g=>{var S;return(S=g.matches.find(p=>p.id===a))==null?void 0:S.routeId}}),o=t.routesById[l],u=Ia({select:g=>{const S=g.matches.find(p=>p.id===a);return no(S),S.globalNotFound}}),f=Ia({select:g=>{var p;const S=g.matches;return(p=S[S.findIndex(v=>v.id===a)+1])==null?void 0:p.id}}),m=t.options.defaultPendingComponent?i.jsx(t.options.defaultPendingComponent,{}):null;if(u)return Y2(t,o,void 0);if(!f)return null;const y=i.jsx(V2,{matchId:f});return l===Zo?i.jsx(_.Suspense,{fallback:m,children:y}):y});function P7(){const e=ai(),t=_.useRef({router:e,mounted:!1}),[a,l]=_.useState(!1),{hasPendingMatches:o,isLoading:u}=Ia({select:p=>({isLoading:p.isLoading,hasPendingMatches:p.matches.some(v=>v.status==="pending")}),structuralSharing:!0}),f=Z1(u),m=u||a||o,y=Z1(m),g=u||o,S=Z1(g);return e.startTransition=p=>{l(!0),_.startTransition(()=>{p(),l(!1)})},_.useEffect(()=>{const p=e.history.subscribe(e.load),v=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return Jl(e.latestLocation.publicHref)!==Jl(v.publicHref)&&e.commitLocation({...v,replace:!0}),()=>{p()}},[e,e.history]),im(()=>{if(typeof window<"u"&&e.ssr||t.current.router===e&&t.current.mounted)return;t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(v){console.error(v)}})()},[e]),im(()=>{f&&!u&&e.emit({type:"onLoad",...Jo(e.state)})},[f,e,u]),im(()=>{S&&!g&&e.emit({type:"onBeforeRouteMount",...Jo(e.state)})},[g,S,e]),im(()=>{if(y&&!m){const p=Jo(e.state);e.emit({type:"onResolved",...p}),e.__store.setState(v=>({...v,status:"idle",resolvedLocation:v.location})),p.hrefChanged&&bS(e)}},[m,y,e]),null}function U7(){const e=ai(),t=e.routesById[Zo].options.pendingComponent??e.options.defaultPendingComponent,a=t?i.jsx(t,{}):null,l=i.jsxs(typeof document<"u"&&e.ssr?su:_.Suspense,{fallback:a,children:[i.jsx(P7,{}),i.jsx(z7,{})]});return e.options.InnerWrap?i.jsx(e.options.InnerWrap,{children:l}):l}function z7(){const e=ai(),t=Ia({select:o=>{var u;return(u=o.matches[0])==null?void 0:u.id}}),a=Ia({select:o=>o.loadedAt}),l=t?i.jsx(V2,{matchId:t}):null;return i.jsx(pp.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?l:i.jsx(K0,{getResetKey:()=>a,errorComponent:Q0,onCatch:void 0,children:l})})}var B7=e=>new H7(e),H7=class extends t7{constructor(e){super(e)}};typeof globalThis<"u"?(globalThis.createFileRoute=n4,globalThis.createLazyFileRoute=i4):typeof window<"u"&&(window.createFileRoute=n4,window.createLazyFileRoute=i4);function $7({router:e,children:t,...a}){Object.keys(a).length>0&&e.update({...e.options,...a,context:{...e.options.context,...a.context}});const l=i.jsx(G2.Provider,{value:e,children:t});return e.options.Wrap?i.jsx(e.options.Wrap,{children:l}):l}function F7({router:e,...t}){return i.jsx($7,{router:e,...t,children:i.jsx(U7,{})})}/*! Capacitor: https://capacitorjs.com/ - MIT License */var Eu;(function(e){e.Unimplemented="UNIMPLEMENTED",e.Unavailable="UNAVAILABLE"})(Eu||(Eu={}));class og extends Error{constructor(t,a,l){super(t),this.message=t,this.code=a,this.data=l}}const q7=e=>{var t,a;return e!=null&&e.androidBridge?"android":!((a=(t=e==null?void 0:e.webkit)===null||t===void 0?void 0:t.messageHandlers)===null||a===void 0)&&a.bridge?"ios":"web"},W7=e=>{const t=e.CapacitorCustomPlatform||null,a=e.Capacitor||{},l=a.Plugins=a.Plugins||{},o=()=>t!==null?t.name:q7(e),u=()=>o()!=="web",f=p=>{const v=g.get(p);return!!(v!=null&&v.platforms.has(o())||m(p))},m=p=>{var v;return(v=a.PluginHeaders)===null||v===void 0?void 0:v.find(w=>w.name===p)},y=p=>e.console.error(p),g=new Map,S=(p,v={})=>{const w=g.get(p);if(w)return console.warn(`Capacitor plugin "${p}" already registered. Cannot register plugins twice.`),w.proxy;const N=o(),j=m(p);let T;const A=async()=>(!T&&N in v?T=typeof v[N]=="function"?T=await v[N]():T=v[N]:t!==null&&!T&&"web"in v&&(T=typeof v.web=="function"?T=await v.web():T=v.web),T),U=(F,G)=>{var Q,Y;if(j){const pe=j==null?void 0:j.methods.find(ne=>G===ne.name);if(pe)return pe.rtype==="promise"?ne=>a.nativePromise(p,G.toString(),ne):(ne,V)=>a.nativeCallback(p,G.toString(),ne,V);if(F)return(Q=F[G])===null||Q===void 0?void 0:Q.bind(F)}else{if(F)return(Y=F[G])===null||Y===void 0?void 0:Y.bind(F);throw new og(`"${p}" plugin is not implemented on ${N}`,Eu.Unimplemented)}},I=F=>{let G;const Q=(...Y)=>{const pe=A().then(ne=>{const V=U(ne,F);if(V){const ye=V(...Y);return G=ye==null?void 0:ye.remove,ye}else throw new og(`"${p}.${F}()" is not implemented on ${N}`,Eu.Unimplemented)});return F==="addListener"&&(pe.remove=async()=>G()),pe};return Q.toString=()=>`${F.toString()}() { [capacitor code] }`,Object.defineProperty(Q,"name",{value:F,writable:!1,configurable:!1}),Q},E=I("addListener"),L=I("removeListener"),W=(F,G)=>{const Q=E({eventName:F},G),Y=async()=>{const ne=await Q;L({eventName:F,callbackId:ne},G)},pe=new Promise(ne=>Q.then(()=>ne({remove:Y})));return pe.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await Y()},pe},ee=new Proxy({},{get(F,G){switch(G){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return j?W:E;case"removeListener":return L;default:return I(G)}}});return l[p]=ee,g.set(p,{name:p,proxy:ee,platforms:new Set([...Object.keys(v),...j?[N]:[]])}),ee};return a.convertFileSrc||(a.convertFileSrc=p=>p),a.getPlatform=o,a.handleError=y,a.isNativePlatform=u,a.isPluginAvailable=f,a.registerPlugin=S,a.Exception=og,a.DEBUG=!!a.DEBUG,a.isLoggingEnabled=!!a.isLoggingEnabled,a},K7=e=>e.Capacitor=W7(e),Kr=K7(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),lc=Kr.registerPlugin;class X2{constructor(){this.listeners={},this.retainedEventArguments={},this.windowListeners={}}addListener(t,a){let l=!1;this.listeners[t]||(this.listeners[t]=[],l=!0),this.listeners[t].push(a);const u=this.windowListeners[t];u&&!u.registered&&this.addWindowListener(u),l&&this.sendRetainedArgumentsForEvent(t);const f=async()=>this.removeListener(t,a);return Promise.resolve({remove:f})}async removeAllListeners(){this.listeners={};for(const t in this.windowListeners)this.removeWindowListener(this.windowListeners[t]);this.windowListeners={}}notifyListeners(t,a,l){const o=this.listeners[t];if(!o){if(l){let u=this.retainedEventArguments[t];u||(u=[]),u.push(a),this.retainedEventArguments[t]=u}return}o.forEach(u=>u(a))}hasListeners(t){var a;return!!(!((a=this.listeners[t])===null||a===void 0)&&a.length)}registerWindowListener(t,a){this.windowListeners[a]={registered:!1,windowEventName:t,pluginEventName:a,handler:l=>{this.notifyListeners(a,l)}}}unimplemented(t="not implemented"){return new Kr.Exception(t,Eu.Unimplemented)}unavailable(t="not available"){return new Kr.Exception(t,Eu.Unavailable)}async removeListener(t,a){const l=this.listeners[t];if(!l)return;const o=l.indexOf(a);this.listeners[t].splice(o,1),this.listeners[t].length||this.removeWindowListener(this.windowListeners[t])}addWindowListener(t){window.addEventListener(t.windowEventName,t.handler),t.registered=!0}removeWindowListener(t){t&&(window.removeEventListener(t.windowEventName,t.handler),t.registered=!1)}sendRetainedArgumentsForEvent(t){const a=this.retainedEventArguments[t];a&&(delete this.retainedEventArguments[t],a.forEach(l=>{this.notifyListeners(t,l)}))}}const l4=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),o4=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class Q7 extends X2{async getCookies(){const t=document.cookie,a={};return t.split(";").forEach(l=>{if(l.length<=0)return;let[o,u]=l.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");o=o4(o).trim(),u=o4(u).trim(),a[o]=u}),a}async setCookie(t){try{const a=l4(t.key),l=l4(t.value),o=t.expires?`; expires=${t.expires.replace("expires=","")}`:"",u=(t.path||"/").replace("path=",""),f=t.url!=null&&t.url.length>0?`domain=${t.url}`:"";document.cookie=`${a}=${l||""}${o}; path=${u}; ${f};`}catch(a){return Promise.reject(a)}}async deleteCookie(t){try{document.cookie=`${t.key}=; Max-Age=0`}catch(a){return Promise.reject(a)}}async clearCookies(){try{const t=document.cookie.split(";")||[];for(const a of t)document.cookie=a.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(t){return Promise.reject(t)}}async clearAllCookies(){try{await this.clearCookies()}catch(t){return Promise.reject(t)}}}lc("CapacitorCookies",{web:()=>new Q7});const G7=async e=>new Promise((t,a)=>{const l=new FileReader;l.onload=()=>{const o=l.result;t(o.indexOf(",")>=0?o.split(",")[1]:o)},l.onerror=o=>a(o),l.readAsDataURL(e)}),Y7=(e={})=>{const t=Object.keys(e);return Object.keys(e).map(o=>o.toLocaleLowerCase()).reduce((o,u,f)=>(o[u]=e[t[f]],o),{})},V7=(e,t=!0)=>e?Object.entries(e).reduce((l,o)=>{const[u,f]=o;let m,y;return Array.isArray(f)?(y="",f.forEach(g=>{m=t?encodeURIComponent(g):g,y+=`${u}=${m}&`}),y.slice(0,-1)):(m=t?encodeURIComponent(f):f,y=`${u}=${m}`),`${l}&${y}`},"").substr(1):null,Z7=(e,t={})=>{const a=Object.assign({method:e.method||"GET",headers:e.headers},t),o=Y7(e.headers)["content-type"]||"";if(typeof e.data=="string")a.body=e.data;else if(o.includes("application/x-www-form-urlencoded")){const u=new URLSearchParams;for(const[f,m]of Object.entries(e.data||{}))u.set(f,m);a.body=u.toString()}else if(o.includes("multipart/form-data")||e.data instanceof FormData){const u=new FormData;if(e.data instanceof FormData)e.data.forEach((m,y)=>{u.append(y,m)});else for(const m of Object.keys(e.data))u.append(m,e.data[m]);a.body=u;const f=new Headers(a.headers);f.delete("content-type"),a.headers=f}else(o.includes("application/json")||typeof e.data=="object")&&(a.body=JSON.stringify(e.data));return a};class X7 extends X2{async request(t){const a=Z7(t,t.webFetchExtra),l=V7(t.params,t.shouldEncodeUrlParams),o=l?`${t.url}?${l}`:t.url,u=await fetch(o,a),f=u.headers.get("content-type")||"";let{responseType:m="text"}=u.ok?t:{};f.includes("application/json")&&(m="json");let y,g;switch(m){case"arraybuffer":case"blob":g=await u.blob(),y=await G7(g);break;case"json":y=await u.json();break;case"document":case"text":default:y=await u.text()}const S={};return u.headers.forEach((p,v)=>{S[v]=p}),{data:y,headers:S,status:u.status,url:u.url}}async get(t){return this.request(Object.assign(Object.assign({},t),{method:"GET"}))}async post(t){return this.request(Object.assign(Object.assign({},t),{method:"POST"}))}async put(t){return this.request(Object.assign(Object.assign({},t),{method:"PUT"}))}async patch(t){return this.request(Object.assign(Object.assign({},t),{method:"PATCH"}))}async delete(t){return this.request(Object.assign(Object.assign({},t),{method:"DELETE"}))}}lc("CapacitorHttp",{web:()=>new X7});var Xg;(function(e){e.Aztec="AZTEC",e.Codabar="CODABAR",e.Code39="CODE_39",e.Code93="CODE_93",e.Code128="CODE_128",e.DataMatrix="DATA_MATRIX",e.Ean8="EAN_8",e.Ean13="EAN_13",e.Itf="ITF",e.Pdf417="PDF_417",e.QrCode="QR_CODE",e.UpcA="UPC_A",e.UpcE="UPC_E"})(Xg||(Xg={}));var c4;(function(e){e.CalendarEvent="CALENDAR_EVENT",e.ContactInfo="CONTACT_INFO",e.DriversLicense="DRIVERS_LICENSE",e.Email="EMAIL",e.Geo="GEO",e.Isbn="ISBN",e.Phone="PHONE",e.Product="PRODUCT",e.Sms="SMS",e.Text="TEXT",e.Url="URL",e.Wifi="WIFI",e.Unknown="UNKNOWN"})(c4||(c4={}));var Jg;(function(e){e[e["640x480"]=0]="640x480",e[e["1280x720"]=1]="1280x720",e[e["1920x1080"]=2]="1920x1080",e[e["3840x2160"]=3]="3840x2160"})(Jg||(Jg={}));var e0;(function(e){e.Front="FRONT",e.Back="BACK"})(e0||(e0={}));var u4;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.PENDING=1]="PENDING",e[e.DOWNLOADING=2]="DOWNLOADING",e[e.CANCELED=3]="CANCELED",e[e.COMPLETED=4]="COMPLETED",e[e.FAILED=5]="FAILED",e[e.INSTALLING=6]="INSTALLING",e[e.DOWNLOAD_PAUSED=7]="DOWNLOAD_PAUSED"})(u4||(u4={}));var d4;(function(e){e[e.HOME=0]="HOME",e[e.UNKNOWN=1]="UNKNOWN",e[e.WORK=2]="WORK"})(d4||(d4={}));var f4;(function(e){e[e.HOME=0]="HOME",e[e.UNKNOWN=1]="UNKNOWN",e[e.WORK=2]="WORK"})(f4||(f4={}));var h4;(function(e){e[e.FAX=0]="FAX",e[e.HOME=1]="HOME",e[e.MOBILE=2]="MOBILE",e[e.UNKNOWN=3]="UNKNOWN",e[e.WORK=4]="WORK"})(h4||(h4={}));var m4;(function(e){e[e.OPEN=1]="OPEN",e[e.WEP=2]="WEP",e[e.WPA=3]="WPA"})(m4||(m4={}));const Do=lc("BarcodeScanner",{web:()=>ao(()=>import("./web-DWBa_1oz.js"),[]).then(e=>new e.BarcodeScannerWeb)}),J7=8e3,Wm=e=>{const t=(e==null?void 0:e.trim())??"";if(!t)return"";const a=t.replace(/\/+$/,"");try{const l=new URL(a);return l.pathname==="/health"&&(l.pathname="",l.search="",l.hash=""),l.toString().replace(/\/+$/,"")}catch{return a.replace(/\/health$/i,"")}},J2=e=>new Error(`连接探测超时(${e} ms),请确认手机能直接访问该 Hub 地址。`),ej=(e,t)=>{if(!(e instanceof Error))return"连接失败";const a=e.message.trim();return e.name==="AbortError"||e.name==="TimeoutError"||/aborted/i.test(a)?J2(t).message:a||"连接失败"},t0=async(e,t)=>{const a=Wm(e),l=new Date().toISOString();if(!a)return{url:"",healthOk:!1,latencyMs:null,checkedAt:l,error:"地址为空"};const o=J7,u=`${a}/health`,f=typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now(),m=new AbortController,y=window.setTimeout(()=>m.abort(J2(o)),o);try{const g=await fetch(u,{cache:"no-store",signal:m.signal}),S=typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now();return{url:a,healthOk:g.ok,latencyMs:S-f,checkedAt:l,error:g.ok?null:`HTTP ${g.status}`}}catch(g){return{url:a,healthOk:!1,latencyMs:null,checkedAt:l,error:ej(g,o)}}finally{clearTimeout(y)}},tj=()=>{var e;try{const t=(e=Kr.getPlatform)==null?void 0:e.call(Kr);if(t==="android"||t==="ios")return t}catch{}return"web"},Cu=()=>tj(),e6=()=>{var e;try{return((e=Kr.isNativePlatform)==null?void 0:e.call(Kr))===!0}catch{return!1}},gp=()=>Cu()==="android"&&e6(),nj=()=>Cu()==="ios"&&e6(),Pa=()=>gp()||nj(),p4=e=>typeof e!="number"||!Number.isFinite(e)?"未测得":`${Math.max(0,Math.round(e))} ms`,sj=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString("zh-CN",{hour12:!1})},cg=e=>{var l;const t=e.trim();if(!t)return"";try{const o=new URL(t);if(o.protocol==="http:"||o.protocol==="https:")return Wm(o.toString())}catch{}const a=(l=t.match(/https?:\/\/[^\s]+/i))==null?void 0:l[0];return a?Wm(a):""},aj=e=>{var a;const t=[e.rawValue,e.displayValue,(a=e.urlBookmark)==null?void 0:a.url];for(const l of t){const o=(l==null?void 0:l.trim())??"";if(o)try{const u=new URL(o);return u.protocol==="panda:"&&u.searchParams.get("url")?cg(u.searchParams.get("url")??""):cg(u.toString())}catch{return cg(o)}}return""},ij=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M7 4.75H5.9A1.9 1.9 0 0 0 4 6.65v1.1M17 4.75h1.1A1.9 1.9 0 0 1 20 6.65v1.1M20 16.25v1.1a1.9 1.9 0 0 1-1.9 1.9H17M7 19.25H5.9A1.9 1.9 0 0 1 4 17.35v-1.1"}),i.jsx("path",{d:"M8 9.25h8M8 12h8M8 14.75h5"})]}),rj=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"M6 6 18 18M18 6 6 18"})}),t6=({title:e,description:t,currentHubUrl:a,initialHubUrl:l,hint:o,saveLabel:u,savingLabel:f,saveDescription:m,saveSuccessMessage:y,onSaveSuccess:g})=>{const[S,p]=_.useState(l),[v,w]=_.useState({loading:!1,result:null}),[N,j]=_.useState({saving:!1}),[T,A]=_.useState(null),[U,I]=_.useState({active:!1,starting:!1}),E=_.useRef([]),L=Wm(S),W=Pa();_.useEffect(()=>{p(l)},[l]),_.useEffect(()=>{if(!(typeof document>"u"))return document.documentElement.classList.toggle("hub-scanner-active",U.active),document.body.classList.toggle("hub-scanner-active",U.active),()=>{document.documentElement.classList.remove("hub-scanner-active"),document.body.classList.remove("hub-scanner-active")}},[U.active]),_.useEffect(()=>()=>{(async()=>(await Promise.all(E.current.map(ne=>ne.remove().catch(()=>{}))),E.current=[],await Do.stopScan().catch(()=>{})))()},[]);const ee=async()=>{const ne=[...E.current];E.current=[],await Promise.all(ne.map(V=>V.remove().catch(()=>{})))},F=async()=>{I(ne=>({...ne,active:!1})),await ee(),await Do.stopScan().catch(()=>{})},G=async()=>{if(!L){A({tone:"danger",text:"请先输入可访问的 Hub 地址。"});return}A(null),w({loading:!0,result:null});const ne=await t0(L);w({loading:!1,result:ne}),A({tone:ne.healthOk?"success":"danger",text:ne.healthOk?`连接成功,延迟 ${p4(ne.latencyMs)}。`:ne.error??"连接测试失败。"})},Q=async()=>{var ne;if(!L){A({tone:"danger",text:"请先输入可访问的 Hub 地址。"});return}A(null),j({saving:!0});try{const V=((ne=v.result)==null?void 0:ne.url)===L?v.result:await t0(L);if(w({loading:!1,result:V}),!V.healthOk){A({tone:"danger",text:V.error??"请先确认 Hub 地址可访问,再继续保存。"});return}await g(V),A({tone:"success",text:y})}catch(V){A({tone:"danger",text:V instanceof Error?V.message:"保存 Hub 地址失败。"})}finally{j({saving:!1})}},Y=async()=>{if(W){A(null),I({active:!1,starting:!0});try{if(!(await Do.isSupported()).supported){A({tone:"danger",text:"当前设备不支持扫码填入,请手动输入地址。"});return}const V=await Do.requestPermissions();if(V.camera!=="granted"&&V.camera!=="limited"){A({tone:"danger",text:"需要相机权限才能扫码,请在系统设置中允许 Panda 使用相机。"});return}const ye=await Promise.all([Do.addListener("barcodesScanned",R=>{const H=R.barcodes.map(aj).find(Boolean);if(!H){A({tone:"danger",text:"二维码已识别,但没有拿到可用的 Hub 地址。"}),F();return}p(H),w({loading:!1,result:null}),A({tone:"success",text:"已通过扫码填入地址,可以直接测试或保存。"}),F()}),Do.addListener("scanError",R=>{A({tone:"danger",text:R.message||"扫码失败,请稍后重试。"}),F()})]);E.current=ye,I({active:!0,starting:!1}),await Do.startScan({formats:[Xg.QrCode],lensFacing:e0.Back,resolution:Jg["1280x720"]})}catch(ne){await F(),A({tone:"danger",text:ne instanceof Error?ne.message:"无法启动扫码,请稍后重试。"})}finally{I(ne=>({...ne,starting:!1}))}}},pe=U.active&&typeof document<"u"?ki.createPortal(i.jsx("div",{className:"hub-scanner-sheet",role:"dialog","aria-modal":"true","aria-label":"扫描 Hub 地址二维码",children:i.jsxs("div",{className:"hub-scanner-sheet__content",children:[i.jsxs("div",{className:"hub-scanner-sheet__topbar",children:[i.jsx("span",{className:"hub-scanner-sheet__badge",children:"扫码填入"}),i.jsx("button",{type:"button",className:"hub-scanner-sheet__close",onClick:()=>{F()},"aria-label":"关闭扫码",children:i.jsx(rj,{})})]}),i.jsxs("div",{className:"hub-scanner-sheet__frame","aria-hidden":"true",children:[i.jsx("span",{className:"hub-scanner-sheet__corner hub-scanner-sheet__corner--tl"}),i.jsx("span",{className:"hub-scanner-sheet__corner hub-scanner-sheet__corner--tr"}),i.jsx("span",{className:"hub-scanner-sheet__corner hub-scanner-sheet__corner--bl"}),i.jsx("span",{className:"hub-scanner-sheet__corner hub-scanner-sheet__corner--br"})]}),i.jsxs("div",{className:"hub-scanner-sheet__footer",children:[i.jsx("p",{children:"把电脑端显示的 Hub 二维码放进取景框,识别后会自动填入地址。"}),i.jsx("button",{type:"button",className:"settings-ghost-button hub-scanner-sheet__cancel",onClick:()=>{F()},children:"取消扫码"})]})]})}),document.body):null;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"hub-connection-form",children:[i.jsxs("div",{className:"hub-connection-form__header",children:[i.jsxs("div",{className:"hub-connection-form__copy",children:[i.jsx("h3",{className:"hub-connection-form__title",children:e}),i.jsx("p",{className:"hub-connection-form__description",children:t})]}),a?i.jsxs("div",{className:"hub-connection-form__current",children:[i.jsx("span",{children:"当前"}),i.jsx("strong",{children:a})]}):null]}),i.jsxs("label",{className:"hub-connection-form__field",children:[i.jsx("span",{className:"hub-connection-form__label",children:"Hub 地址"}),i.jsxs("span",{className:"hub-connection-form__input-shell",children:[i.jsx("input",{className:"hub-connection-form__input",type:"url",inputMode:"url",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,placeholder:"例如 http://192.168.31.20:4343",value:S,onChange:ne=>{p(ne.target.value),w({loading:!1,result:null}),A(null)}}),W?i.jsxs("button",{type:"button",className:"hub-connection-form__scan",onClick:()=>{Y()},disabled:U.starting||N.saving||v.loading,"aria-label":"扫码填入 Hub 地址",children:[i.jsx(ij,{}),i.jsx("span",{children:U.starting?"启动中":"扫码"})]}):null]})]}),i.jsx("p",{className:"hub-connection-form__hint",children:o}),i.jsxs("div",{className:"hub-connection-form__actions",children:[i.jsxs("button",{type:"button",className:"settings-action hub-connection-form__save",onClick:()=>{Q()},disabled:!L||N.saving||U.starting,children:[i.jsxs("div",{className:"settings-action__copy",children:[i.jsx("strong",{children:N.saving?f:u}),i.jsx("span",{children:m})]}),i.jsx("span",{className:"settings-action__state",children:N.saving?"处理中…":"→"})]}),i.jsx("button",{type:"button",className:"settings-ghost-button hub-connection-form__test",onClick:()=>{G()},disabled:!L||v.loading||N.saving||U.starting,children:v.loading?"测试中…":"测试连接"})]}),v.result?i.jsxs("div",{className:"hub-connection-form__probe",children:[i.jsxs("div",{className:"hub-connection-form__probe-item",children:[i.jsx("span",{children:"探测地址"}),i.jsx("strong",{children:v.result.url})]}),i.jsxs("div",{className:"hub-connection-form__probe-item",children:[i.jsx("span",{children:"连通结果"}),i.jsx("strong",{className:v.result.healthOk?"is-ok":"is-danger",children:v.result.healthOk?"Hub 在线":v.result.error??"无法连接"})]}),i.jsxs("div",{className:"hub-connection-form__probe-item",children:[i.jsx("span",{children:"延迟"}),i.jsx("strong",{children:p4(v.result.latencyMs)})]}),i.jsxs("div",{className:"hub-connection-form__probe-item",children:[i.jsx("span",{children:"最近探测"}),i.jsx("strong",{children:sj(v.result.checkedAt)})]})]}):null,T?i.jsx("p",{className:`hub-connection-form__notice is-${T.tone}`,children:T.text}):null]}),pe]})};var mn;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function a(o){throw new Error}e.assertNever=a,e.arrayToEnum=o=>{const u={};for(const f of o)u[f]=f;return u},e.getValidEnumValues=o=>{const u=e.objectKeys(o).filter(m=>typeof o[o[m]]!="number"),f={};for(const m of u)f[m]=o[m];return e.objectValues(f)},e.objectValues=o=>e.objectKeys(o).map(function(u){return o[u]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const u=[];for(const f in o)Object.prototype.hasOwnProperty.call(o,f)&&u.push(f);return u},e.find=(o,u)=>{for(const f of o)if(u(f))return f},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function l(o,u=" | "){return o.map(f=>typeof f=="string"?`'${f}'`:f).join(u)}e.joinValues=l,e.jsonStringifyReplacer=(o,u)=>typeof u=="bigint"?u.toString():u})(mn||(mn={}));var g4;(function(e){e.mergeShapes=(t,a)=>({...t,...a})})(g4||(g4={}));const st=mn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),zl=e=>{switch(typeof e){case"undefined":return st.undefined;case"string":return st.string;case"number":return Number.isNaN(e)?st.nan:st.number;case"boolean":return st.boolean;case"function":return st.function;case"bigint":return st.bigint;case"symbol":return st.symbol;case"object":return Array.isArray(e)?st.array:e===null?st.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?st.promise:typeof Map<"u"&&e instanceof Map?st.map:typeof Set<"u"&&e instanceof Set?st.set:typeof Date<"u"&&e instanceof Date?st.date:st.object;default:return st.unknown}},Ue=mn.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Yr extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=l=>{this.issues=[...this.issues,l]},this.addIssues=(l=[])=>{this.issues=[...this.issues,...l]};const a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=t}format(t){const a=t||function(u){return u.message},l={_errors:[]},o=u=>{for(const f of u.issues)if(f.code==="invalid_union")f.unionErrors.map(o);else if(f.code==="invalid_return_type")o(f.returnTypeError);else if(f.code==="invalid_arguments")o(f.argumentsError);else if(f.path.length===0)l._errors.push(a(f));else{let m=l,y=0;for(;y<f.path.length;){const g=f.path[y];y===f.path.length-1?(m[g]=m[g]||{_errors:[]},m[g]._errors.push(a(f))):m[g]=m[g]||{_errors:[]},m=m[g],y++}}};return o(this),l}static assert(t){if(!(t instanceof Yr))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,mn.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=a=>a.message){const a={},l=[];for(const o of this.issues)if(o.path.length>0){const u=o.path[0];a[u]=a[u]||[],a[u].push(t(o))}else l.push(t(o));return{formErrors:l,fieldErrors:a}}get formErrors(){return this.flatten()}}Yr.create=e=>new Yr(e);const n0=(e,t)=>{let a;switch(e.code){case Ue.invalid_type:e.received===st.undefined?a="Required":a=`Expected ${e.expected}, received ${e.received}`;break;case Ue.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(e.expected,mn.jsonStringifyReplacer)}`;break;case Ue.unrecognized_keys:a=`Unrecognized key(s) in object: ${mn.joinValues(e.keys,", ")}`;break;case Ue.invalid_union:a="Invalid input";break;case Ue.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${mn.joinValues(e.options)}`;break;case Ue.invalid_enum_value:a=`Invalid enum value. Expected ${mn.joinValues(e.options)}, received '${e.received}'`;break;case Ue.invalid_arguments:a="Invalid function arguments";break;case Ue.invalid_return_type:a="Invalid function return type";break;case Ue.invalid_date:a="Invalid date";break;case Ue.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(a=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(a=`${a} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?a=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?a=`Invalid input: must end with "${e.validation.endsWith}"`:mn.assertNever(e.validation):e.validation!=="regex"?a=`Invalid ${e.validation}`:a="Invalid";break;case Ue.too_small:e.type==="array"?a=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?a=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?a=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?a=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?a=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:a="Invalid input";break;case Ue.too_big:e.type==="array"?a=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?a=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?a=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?a=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?a=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:a="Invalid input";break;case Ue.custom:a="Invalid input";break;case Ue.invalid_intersection_types:a="Intersection results could not be merged";break;case Ue.not_multiple_of:a=`Number must be a multiple of ${e.multipleOf}`;break;case Ue.not_finite:a="Number must be finite";break;default:a=t.defaultError,mn.assertNever(e)}return{message:a}};let lj=n0;function oj(){return lj}const cj=e=>{const{data:t,path:a,errorMaps:l,issueData:o}=e,u=[...a,...o.path||[]],f={...o,path:u};if(o.message!==void 0)return{...o,path:u,message:o.message};let m="";const y=l.filter(g=>!!g).slice().reverse();for(const g of y)m=g(f,{data:t,defaultError:m}).message;return{...o,path:u,message:m}};function Ze(e,t){const a=oj(),l=cj({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,a,a===n0?void 0:n0].filter(o=>!!o)});e.common.issues.push(l)}class aa{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,a){const l=[];for(const o of a){if(o.status==="aborted")return Ot;o.status==="dirty"&&t.dirty(),l.push(o.value)}return{status:t.value,value:l}}static async mergeObjectAsync(t,a){const l=[];for(const o of a){const u=await o.key,f=await o.value;l.push({key:u,value:f})}return aa.mergeObjectSync(t,l)}static mergeObjectSync(t,a){const l={};for(const o of a){const{key:u,value:f}=o;if(u.status==="aborted"||f.status==="aborted")return Ot;u.status==="dirty"&&t.dirty(),f.status==="dirty"&&t.dirty(),u.value!=="__proto__"&&(typeof f.value<"u"||o.alwaysSet)&&(l[u.value]=f.value)}return{status:t.value,value:l}}}const Ot=Object.freeze({status:"aborted"}),sf=e=>({status:"dirty",value:e}),ii=e=>({status:"valid",value:e}),_4=e=>e.status==="aborted",y4=e=>e.status==="dirty",Tu=e=>e.status==="valid",Km=e=>typeof Promise<"u"&&e instanceof Promise;var ut;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(ut||(ut={}));class Ji{constructor(t,a,l,o){this._cachedPath=[],this.parent=t,this.data=a,this._path=l,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const v4=(e,t)=>{if(Tu(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const a=new Yr(e.common.issues);return this._error=a,this._error}}};function qt(e){if(!e)return{};const{errorMap:t,invalid_type_error:a,required_error:l,description:o}=e;if(t&&(a||l))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(f,m)=>{const{message:y}=e;return f.code==="invalid_enum_value"?{message:y??m.defaultError}:typeof m.data>"u"?{message:y??l??m.defaultError}:f.code!=="invalid_type"?{message:m.defaultError}:{message:y??a??m.defaultError}},description:o}}class ln{get description(){return this._def.description}_getType(t){return zl(t.data)}_getOrReturnCtx(t,a){return a||{common:t.parent.common,data:t.data,parsedType:zl(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new aa,ctx:{common:t.parent.common,data:t.data,parsedType:zl(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const a=this._parse(t);if(Km(a))throw new Error("Synchronous parse encountered promise.");return a}_parseAsync(t){const a=this._parse(t);return Promise.resolve(a)}parse(t,a){const l=this.safeParse(t,a);if(l.success)return l.data;throw l.error}safeParse(t,a){const l={common:{issues:[],async:(a==null?void 0:a.async)??!1,contextualErrorMap:a==null?void 0:a.errorMap},path:(a==null?void 0:a.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:zl(t)},o=this._parseSync({data:t,path:l.path,parent:l});return v4(l,o)}"~validate"(t){var l,o;const a={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:zl(t)};if(!this["~standard"].async)try{const u=this._parseSync({data:t,path:[],parent:a});return Tu(u)?{value:u.value}:{issues:a.common.issues}}catch(u){(o=(l=u==null?void 0:u.message)==null?void 0:l.toLowerCase())!=null&&o.includes("encountered")&&(this["~standard"].async=!0),a.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:a}).then(u=>Tu(u)?{value:u.value}:{issues:a.common.issues})}async parseAsync(t,a){const l=await this.safeParseAsync(t,a);if(l.success)return l.data;throw l.error}async safeParseAsync(t,a){const l={common:{issues:[],contextualErrorMap:a==null?void 0:a.errorMap,async:!0},path:(a==null?void 0:a.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:zl(t)},o=this._parse({data:t,path:l.path,parent:l}),u=await(Km(o)?o:Promise.resolve(o));return v4(l,u)}refine(t,a){const l=o=>typeof a=="string"||typeof a>"u"?{message:a}:typeof a=="function"?a(o):a;return this._refinement((o,u)=>{const f=t(o),m=()=>u.addIssue({code:Ue.custom,...l(o)});return typeof Promise<"u"&&f instanceof Promise?f.then(y=>y?!0:(m(),!1)):f?!0:(m(),!1)})}refinement(t,a){return this._refinement((l,o)=>t(l)?!0:(o.addIssue(typeof a=="function"?a(l,o):a),!1))}_refinement(t){return new Au({schema:this,typeName:Rt.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:a=>this["~validate"](a)}}optional(){return to.create(this,this._def)}nullable(){return Du.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Xi.create(this)}promise(){return Zm.create(this,this._def)}or(t){return Gm.create([this,t],this._def)}and(t){return Ym.create(this,t,this._def)}transform(t){return new Au({...qt(this._def),schema:this,typeName:Rt.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const a=typeof t=="function"?t:()=>t;return new l0({...qt(this._def),innerType:this,defaultValue:a,typeName:Rt.ZodDefault})}brand(){return new Aj({typeName:Rt.ZodBranded,type:this,...qt(this._def)})}catch(t){const a=typeof t=="function"?t:()=>t;return new o0({...qt(this._def),innerType:this,catchValue:a,typeName:Rt.ZodCatch})}describe(t){const a=this.constructor;return new a({...this._def,description:t})}pipe(t){return X0.create(this,t)}readonly(){return c0.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const uj=/^c[^\s-]{8,}$/i,dj=/^[0-9a-z]+$/,fj=/^[0-9A-HJKMNP-TV-Z]{26}$/i,hj=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,mj=/^[a-z0-9_-]{21}$/i,pj=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,gj=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,_j=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,yj="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ug;const vj=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,bj=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,xj=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Sj=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,jj=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,wj=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,n6="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Nj=new RegExp(`^${n6}$`);function s6(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const a=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${a}`}function kj(e){return new RegExp(`^${s6(e)}$`)}function Ej(e){let t=`${n6}T${s6(e)}`;const a=[];return a.push(e.local?"Z?":"Z"),e.offset&&a.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${a.join("|")})`,new RegExp(`^${t}$`)}function Cj(e,t){return!!((t==="v4"||!t)&&vj.test(e)||(t==="v6"||!t)&&xj.test(e))}function Tj(e,t){if(!pj.test(e))return!1;try{const[a]=e.split(".");if(!a)return!1;const l=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),o=JSON.parse(atob(l));return!(typeof o!="object"||o===null||"typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function Mj(e,t){return!!((t==="v4"||!t)&&bj.test(e)||(t==="v6"||!t)&&Sj.test(e))}class qr extends ln{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==st.string){const u=this._getOrReturnCtx(t);return Ze(u,{code:Ue.invalid_type,expected:st.string,received:u.parsedType}),Ot}const l=new aa;let o;for(const u of this._def.checks)if(u.kind==="min")t.data.length<u.value&&(o=this._getOrReturnCtx(t,o),Ze(o,{code:Ue.too_small,minimum:u.value,type:"string",inclusive:!0,exact:!1,message:u.message}),l.dirty());else if(u.kind==="max")t.data.length>u.value&&(o=this._getOrReturnCtx(t,o),Ze(o,{code:Ue.too_big,maximum:u.value,type:"string",inclusive:!0,exact:!1,message:u.message}),l.dirty());else if(u.kind==="length"){const f=t.data.length>u.value,m=t.data.length<u.value;(f||m)&&(o=this._getOrReturnCtx(t,o),f?Ze(o,{code:Ue.too_big,maximum:u.value,type:"string",inclusive:!0,exact:!0,message:u.message}):m&&Ze(o,{code:Ue.too_small,minimum:u.value,type:"string",inclusive:!0,exact:!0,message:u.message}),l.dirty())}else if(u.kind==="email")_j.test(t.data)||(o=this._getOrReturnCtx(t,o),Ze(o,{validation:"email",code:Ue.invalid_string,message:u.message}),l.dirty());else if(u.kind==="emoji")ug||(ug=new RegExp(yj,"u")),ug.test(t.data)||(o=this._getOrReturnCtx(t,o),Ze(o,{validation:"emoji",code:Ue.invalid_string,message:u.message}),l.dirty());else if(u.kind==="uuid")hj.test(t.data)||(o=this._getOrReturnCtx(t,o),Ze(o,{validation:"uuid",code:Ue.invalid_string,message:u.message}),l.dirty());else if(u.kind==="nanoid")mj.test(t.data)||(o=this._getOrReturnCtx(t,o),Ze(o,{validation:"nanoid",code:Ue.invalid_string,message:u.message}),l.dirty());else if(u.kind==="cuid")uj.test(t.data)||(o=this._getOrReturnCtx(t,o),Ze(o,{validation:"cuid",code:Ue.invalid_string,message:u.message}),l.dirty());else if(u.kind==="cuid2")dj.test(t.data)||(o=this._getOrReturnCtx(t,o),Ze(o,{validation:"cuid2",code:Ue.invalid_string,message:u.message}),l.dirty());else if(u.kind==="ulid")fj.test(t.data)||(o=this._getOrReturnCtx(t,o),Ze(o,{validation:"ulid",code:Ue.invalid_string,message:u.message}),l.dirty());else if(u.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),Ze(o,{validation:"url",code:Ue.invalid_string,message:u.message}),l.dirty()}else u.kind==="regex"?(u.regex.lastIndex=0,u.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),Ze(o,{validation:"regex",code:Ue.invalid_string,message:u.message}),l.dirty())):u.kind==="trim"?t.data=t.data.trim():u.kind==="includes"?t.data.includes(u.value,u.position)||(o=this._getOrReturnCtx(t,o),Ze(o,{code:Ue.invalid_string,validation:{includes:u.value,position:u.position},message:u.message}),l.dirty()):u.kind==="toLowerCase"?t.data=t.data.toLowerCase():u.kind==="toUpperCase"?t.data=t.data.toUpperCase():u.kind==="startsWith"?t.data.startsWith(u.value)||(o=this._getOrReturnCtx(t,o),Ze(o,{code:Ue.invalid_string,validation:{startsWith:u.value},message:u.message}),l.dirty()):u.kind==="endsWith"?t.data.endsWith(u.value)||(o=this._getOrReturnCtx(t,o),Ze(o,{code:Ue.invalid_string,validation:{endsWith:u.value},message:u.message}),l.dirty()):u.kind==="datetime"?Ej(u).test(t.data)||(o=this._getOrReturnCtx(t,o),Ze(o,{code:Ue.invalid_string,validation:"datetime",message:u.message}),l.dirty()):u.kind==="date"?Nj.test(t.data)||(o=this._getOrReturnCtx(t,o),Ze(o,{code:Ue.invalid_string,validation:"date",message:u.message}),l.dirty()):u.kind==="time"?kj(u).test(t.data)||(o=this._getOrReturnCtx(t,o),Ze(o,{code:Ue.invalid_string,validation:"time",message:u.message}),l.dirty()):u.kind==="duration"?gj.test(t.data)||(o=this._getOrReturnCtx(t,o),Ze(o,{validation:"duration",code:Ue.invalid_string,message:u.message}),l.dirty()):u.kind==="ip"?Cj(t.data,u.version)||(o=this._getOrReturnCtx(t,o),Ze(o,{validation:"ip",code:Ue.invalid_string,message:u.message}),l.dirty()):u.kind==="jwt"?Tj(t.data,u.alg)||(o=this._getOrReturnCtx(t,o),Ze(o,{validation:"jwt",code:Ue.invalid_string,message:u.message}),l.dirty()):u.kind==="cidr"?Mj(t.data,u.version)||(o=this._getOrReturnCtx(t,o),Ze(o,{validation:"cidr",code:Ue.invalid_string,message:u.message}),l.dirty()):u.kind==="base64"?jj.test(t.data)||(o=this._getOrReturnCtx(t,o),Ze(o,{validation:"base64",code:Ue.invalid_string,message:u.message}),l.dirty()):u.kind==="base64url"?wj.test(t.data)||(o=this._getOrReturnCtx(t,o),Ze(o,{validation:"base64url",code:Ue.invalid_string,message:u.message}),l.dirty()):mn.assertNever(u);return{status:l.value,value:t.data}}_regex(t,a,l){return this.refinement(o=>t.test(o),{validation:a,code:Ue.invalid_string,...ut.errToObj(l)})}_addCheck(t){return new qr({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ut.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ut.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ut.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ut.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ut.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ut.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ut.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ut.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ut.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...ut.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...ut.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ut.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...ut.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...ut.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...ut.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...ut.errToObj(t)})}regex(t,a){return this._addCheck({kind:"regex",regex:t,...ut.errToObj(a)})}includes(t,a){return this._addCheck({kind:"includes",value:t,position:a==null?void 0:a.position,...ut.errToObj(a==null?void 0:a.message)})}startsWith(t,a){return this._addCheck({kind:"startsWith",value:t,...ut.errToObj(a)})}endsWith(t,a){return this._addCheck({kind:"endsWith",value:t,...ut.errToObj(a)})}min(t,a){return this._addCheck({kind:"min",value:t,...ut.errToObj(a)})}max(t,a){return this._addCheck({kind:"max",value:t,...ut.errToObj(a)})}length(t,a){return this._addCheck({kind:"length",value:t,...ut.errToObj(a)})}nonempty(t){return this.min(1,ut.errToObj(t))}trim(){return new qr({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new qr({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new qr({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const a of this._def.checks)a.kind==="min"&&(t===null||a.value>t)&&(t=a.value);return t}get maxLength(){let t=null;for(const a of this._def.checks)a.kind==="max"&&(t===null||a.value<t)&&(t=a.value);return t}}qr.create=e=>new qr({checks:[],typeName:Rt.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...qt(e)});function Rj(e,t){const a=(e.toString().split(".")[1]||"").length,l=(t.toString().split(".")[1]||"").length,o=a>l?a:l,u=Number.parseInt(e.toFixed(o).replace(".","")),f=Number.parseInt(t.toFixed(o).replace(".",""));return u%f/10**o}class Mu extends ln{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==st.number){const u=this._getOrReturnCtx(t);return Ze(u,{code:Ue.invalid_type,expected:st.number,received:u.parsedType}),Ot}let l;const o=new aa;for(const u of this._def.checks)u.kind==="int"?mn.isInteger(t.data)||(l=this._getOrReturnCtx(t,l),Ze(l,{code:Ue.invalid_type,expected:"integer",received:"float",message:u.message}),o.dirty()):u.kind==="min"?(u.inclusive?t.data<u.value:t.data<=u.value)&&(l=this._getOrReturnCtx(t,l),Ze(l,{code:Ue.too_small,minimum:u.value,type:"number",inclusive:u.inclusive,exact:!1,message:u.message}),o.dirty()):u.kind==="max"?(u.inclusive?t.data>u.value:t.data>=u.value)&&(l=this._getOrReturnCtx(t,l),Ze(l,{code:Ue.too_big,maximum:u.value,type:"number",inclusive:u.inclusive,exact:!1,message:u.message}),o.dirty()):u.kind==="multipleOf"?Rj(t.data,u.value)!==0&&(l=this._getOrReturnCtx(t,l),Ze(l,{code:Ue.not_multiple_of,multipleOf:u.value,message:u.message}),o.dirty()):u.kind==="finite"?Number.isFinite(t.data)||(l=this._getOrReturnCtx(t,l),Ze(l,{code:Ue.not_finite,message:u.message}),o.dirty()):mn.assertNever(u);return{status:o.value,value:t.data}}gte(t,a){return this.setLimit("min",t,!0,ut.toString(a))}gt(t,a){return this.setLimit("min",t,!1,ut.toString(a))}lte(t,a){return this.setLimit("max",t,!0,ut.toString(a))}lt(t,a){return this.setLimit("max",t,!1,ut.toString(a))}setLimit(t,a,l,o){return new Mu({...this._def,checks:[...this._def.checks,{kind:t,value:a,inclusive:l,message:ut.toString(o)}]})}_addCheck(t){return new Mu({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ut.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ut.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ut.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ut.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ut.toString(t)})}multipleOf(t,a){return this._addCheck({kind:"multipleOf",value:t,message:ut.toString(a)})}finite(t){return this._addCheck({kind:"finite",message:ut.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ut.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ut.toString(t)})}get minValue(){let t=null;for(const a of this._def.checks)a.kind==="min"&&(t===null||a.value>t)&&(t=a.value);return t}get maxValue(){let t=null;for(const a of this._def.checks)a.kind==="max"&&(t===null||a.value<t)&&(t=a.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&mn.isInteger(t.value))}get isFinite(){let t=null,a=null;for(const l of this._def.checks){if(l.kind==="finite"||l.kind==="int"||l.kind==="multipleOf")return!0;l.kind==="min"?(a===null||l.value>a)&&(a=l.value):l.kind==="max"&&(t===null||l.value<t)&&(t=l.value)}return Number.isFinite(a)&&Number.isFinite(t)}}Mu.create=e=>new Mu({checks:[],typeName:Rt.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...qt(e)});class Sf extends ln{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==st.bigint)return this._getInvalidInput(t);let l;const o=new aa;for(const u of this._def.checks)u.kind==="min"?(u.inclusive?t.data<u.value:t.data<=u.value)&&(l=this._getOrReturnCtx(t,l),Ze(l,{code:Ue.too_small,type:"bigint",minimum:u.value,inclusive:u.inclusive,message:u.message}),o.dirty()):u.kind==="max"?(u.inclusive?t.data>u.value:t.data>=u.value)&&(l=this._getOrReturnCtx(t,l),Ze(l,{code:Ue.too_big,type:"bigint",maximum:u.value,inclusive:u.inclusive,message:u.message}),o.dirty()):u.kind==="multipleOf"?t.data%u.value!==BigInt(0)&&(l=this._getOrReturnCtx(t,l),Ze(l,{code:Ue.not_multiple_of,multipleOf:u.value,message:u.message}),o.dirty()):mn.assertNever(u);return{status:o.value,value:t.data}}_getInvalidInput(t){const a=this._getOrReturnCtx(t);return Ze(a,{code:Ue.invalid_type,expected:st.bigint,received:a.parsedType}),Ot}gte(t,a){return this.setLimit("min",t,!0,ut.toString(a))}gt(t,a){return this.setLimit("min",t,!1,ut.toString(a))}lte(t,a){return this.setLimit("max",t,!0,ut.toString(a))}lt(t,a){return this.setLimit("max",t,!1,ut.toString(a))}setLimit(t,a,l,o){return new Sf({...this._def,checks:[...this._def.checks,{kind:t,value:a,inclusive:l,message:ut.toString(o)}]})}_addCheck(t){return new Sf({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ut.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ut.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ut.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ut.toString(t)})}multipleOf(t,a){return this._addCheck({kind:"multipleOf",value:t,message:ut.toString(a)})}get minValue(){let t=null;for(const a of this._def.checks)a.kind==="min"&&(t===null||a.value>t)&&(t=a.value);return t}get maxValue(){let t=null;for(const a of this._def.checks)a.kind==="max"&&(t===null||a.value<t)&&(t=a.value);return t}}Sf.create=e=>new Sf({checks:[],typeName:Rt.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...qt(e)});class s0 extends ln{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==st.boolean){const l=this._getOrReturnCtx(t);return Ze(l,{code:Ue.invalid_type,expected:st.boolean,received:l.parsedType}),Ot}return ii(t.data)}}s0.create=e=>new s0({typeName:Rt.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...qt(e)});class Qm extends ln{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==st.date){const u=this._getOrReturnCtx(t);return Ze(u,{code:Ue.invalid_type,expected:st.date,received:u.parsedType}),Ot}if(Number.isNaN(t.data.getTime())){const u=this._getOrReturnCtx(t);return Ze(u,{code:Ue.invalid_date}),Ot}const l=new aa;let o;for(const u of this._def.checks)u.kind==="min"?t.data.getTime()<u.value&&(o=this._getOrReturnCtx(t,o),Ze(o,{code:Ue.too_small,message:u.message,inclusive:!0,exact:!1,minimum:u.value,type:"date"}),l.dirty()):u.kind==="max"?t.data.getTime()>u.value&&(o=this._getOrReturnCtx(t,o),Ze(o,{code:Ue.too_big,message:u.message,inclusive:!0,exact:!1,maximum:u.value,type:"date"}),l.dirty()):mn.assertNever(u);return{status:l.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Qm({...this._def,checks:[...this._def.checks,t]})}min(t,a){return this._addCheck({kind:"min",value:t.getTime(),message:ut.toString(a)})}max(t,a){return this._addCheck({kind:"max",value:t.getTime(),message:ut.toString(a)})}get minDate(){let t=null;for(const a of this._def.checks)a.kind==="min"&&(t===null||a.value>t)&&(t=a.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const a of this._def.checks)a.kind==="max"&&(t===null||a.value<t)&&(t=a.value);return t!=null?new Date(t):null}}Qm.create=e=>new Qm({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Rt.ZodDate,...qt(e)});class b4 extends ln{_parse(t){if(this._getType(t)!==st.symbol){const l=this._getOrReturnCtx(t);return Ze(l,{code:Ue.invalid_type,expected:st.symbol,received:l.parsedType}),Ot}return ii(t.data)}}b4.create=e=>new b4({typeName:Rt.ZodSymbol,...qt(e)});class x4 extends ln{_parse(t){if(this._getType(t)!==st.undefined){const l=this._getOrReturnCtx(t);return Ze(l,{code:Ue.invalid_type,expected:st.undefined,received:l.parsedType}),Ot}return ii(t.data)}}x4.create=e=>new x4({typeName:Rt.ZodUndefined,...qt(e)});class S4 extends ln{_parse(t){if(this._getType(t)!==st.null){const l=this._getOrReturnCtx(t);return Ze(l,{code:Ue.invalid_type,expected:st.null,received:l.parsedType}),Ot}return ii(t.data)}}S4.create=e=>new S4({typeName:Rt.ZodNull,...qt(e)});class a0 extends ln{constructor(){super(...arguments),this._any=!0}_parse(t){return ii(t.data)}}a0.create=e=>new a0({typeName:Rt.ZodAny,...qt(e)});class j4 extends ln{constructor(){super(...arguments),this._unknown=!0}_parse(t){return ii(t.data)}}j4.create=e=>new j4({typeName:Rt.ZodUnknown,...qt(e)});class so extends ln{_parse(t){const a=this._getOrReturnCtx(t);return Ze(a,{code:Ue.invalid_type,expected:st.never,received:a.parsedType}),Ot}}so.create=e=>new so({typeName:Rt.ZodNever,...qt(e)});class w4 extends ln{_parse(t){if(this._getType(t)!==st.undefined){const l=this._getOrReturnCtx(t);return Ze(l,{code:Ue.invalid_type,expected:st.void,received:l.parsedType}),Ot}return ii(t.data)}}w4.create=e=>new w4({typeName:Rt.ZodVoid,...qt(e)});class Xi extends ln{_parse(t){const{ctx:a,status:l}=this._processInputParams(t),o=this._def;if(a.parsedType!==st.array)return Ze(a,{code:Ue.invalid_type,expected:st.array,received:a.parsedType}),Ot;if(o.exactLength!==null){const f=a.data.length>o.exactLength.value,m=a.data.length<o.exactLength.value;(f||m)&&(Ze(a,{code:f?Ue.too_big:Ue.too_small,minimum:m?o.exactLength.value:void 0,maximum:f?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),l.dirty())}if(o.minLength!==null&&a.data.length<o.minLength.value&&(Ze(a,{code:Ue.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),l.dirty()),o.maxLength!==null&&a.data.length>o.maxLength.value&&(Ze(a,{code:Ue.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),l.dirty()),a.common.async)return Promise.all([...a.data].map((f,m)=>o.type._parseAsync(new Ji(a,f,a.path,m)))).then(f=>aa.mergeArray(l,f));const u=[...a.data].map((f,m)=>o.type._parseSync(new Ji(a,f,a.path,m)));return aa.mergeArray(l,u)}get element(){return this._def.type}min(t,a){return new Xi({...this._def,minLength:{value:t,message:ut.toString(a)}})}max(t,a){return new Xi({...this._def,maxLength:{value:t,message:ut.toString(a)}})}length(t,a){return new Xi({...this._def,exactLength:{value:t,message:ut.toString(a)}})}nonempty(t){return this.min(1,t)}}Xi.create=(e,t)=>new Xi({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Rt.ZodArray,...qt(t)});function au(e){if(e instanceof ms){const t={};for(const a in e.shape){const l=e.shape[a];t[a]=to.create(au(l))}return new ms({...e._def,shape:()=>t})}else return e instanceof Xi?new Xi({...e._def,type:au(e.element)}):e instanceof to?to.create(au(e.unwrap())):e instanceof Du?Du.create(au(e.unwrap())):e instanceof sc?sc.create(e.items.map(t=>au(t))):e}class ms extends ln{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),a=mn.objectKeys(t);return this._cached={shape:t,keys:a},this._cached}_parse(t){if(this._getType(t)!==st.object){const g=this._getOrReturnCtx(t);return Ze(g,{code:Ue.invalid_type,expected:st.object,received:g.parsedType}),Ot}const{status:l,ctx:o}=this._processInputParams(t),{shape:u,keys:f}=this._getCached(),m=[];if(!(this._def.catchall instanceof so&&this._def.unknownKeys==="strip"))for(const g in o.data)f.includes(g)||m.push(g);const y=[];for(const g of f){const S=u[g],p=o.data[g];y.push({key:{status:"valid",value:g},value:S._parse(new Ji(o,p,o.path,g)),alwaysSet:g in o.data})}if(this._def.catchall instanceof so){const g=this._def.unknownKeys;if(g==="passthrough")for(const S of m)y.push({key:{status:"valid",value:S},value:{status:"valid",value:o.data[S]}});else if(g==="strict")m.length>0&&(Ze(o,{code:Ue.unrecognized_keys,keys:m}),l.dirty());else if(g!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const g=this._def.catchall;for(const S of m){const p=o.data[S];y.push({key:{status:"valid",value:S},value:g._parse(new Ji(o,p,o.path,S)),alwaysSet:S in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const g=[];for(const S of y){const p=await S.key,v=await S.value;g.push({key:p,value:v,alwaysSet:S.alwaysSet})}return g}).then(g=>aa.mergeObjectSync(l,g)):aa.mergeObjectSync(l,y)}get shape(){return this._def.shape()}strict(t){return ut.errToObj,new ms({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(a,l)=>{var u,f;const o=((f=(u=this._def).errorMap)==null?void 0:f.call(u,a,l).message)??l.defaultError;return a.code==="unrecognized_keys"?{message:ut.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new ms({...this._def,unknownKeys:"strip"})}passthrough(){return new ms({...this._def,unknownKeys:"passthrough"})}extend(t){return new ms({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new ms({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Rt.ZodObject})}setKey(t,a){return this.augment({[t]:a})}catchall(t){return new ms({...this._def,catchall:t})}pick(t){const a={};for(const l of mn.objectKeys(t))t[l]&&this.shape[l]&&(a[l]=this.shape[l]);return new ms({...this._def,shape:()=>a})}omit(t){const a={};for(const l of mn.objectKeys(this.shape))t[l]||(a[l]=this.shape[l]);return new ms({...this._def,shape:()=>a})}deepPartial(){return au(this)}partial(t){const a={};for(const l of mn.objectKeys(this.shape)){const o=this.shape[l];t&&!t[l]?a[l]=o:a[l]=o.optional()}return new ms({...this._def,shape:()=>a})}required(t){const a={};for(const l of mn.objectKeys(this.shape))if(t&&!t[l])a[l]=this.shape[l];else{let u=this.shape[l];for(;u instanceof to;)u=u._def.innerType;a[l]=u}return new ms({...this._def,shape:()=>a})}keyof(){return a6(mn.objectKeys(this.shape))}}ms.create=(e,t)=>new ms({shape:()=>e,unknownKeys:"strip",catchall:so.create(),typeName:Rt.ZodObject,...qt(t)});ms.strictCreate=(e,t)=>new ms({shape:()=>e,unknownKeys:"strict",catchall:so.create(),typeName:Rt.ZodObject,...qt(t)});ms.lazycreate=(e,t)=>new ms({shape:e,unknownKeys:"strip",catchall:so.create(),typeName:Rt.ZodObject,...qt(t)});class Gm extends ln{_parse(t){const{ctx:a}=this._processInputParams(t),l=this._def.options;function o(u){for(const m of u)if(m.result.status==="valid")return m.result;for(const m of u)if(m.result.status==="dirty")return a.common.issues.push(...m.ctx.common.issues),m.result;const f=u.map(m=>new Yr(m.ctx.common.issues));return Ze(a,{code:Ue.invalid_union,unionErrors:f}),Ot}if(a.common.async)return Promise.all(l.map(async u=>{const f={...a,common:{...a.common,issues:[]},parent:null};return{result:await u._parseAsync({data:a.data,path:a.path,parent:f}),ctx:f}})).then(o);{let u;const f=[];for(const y of l){const g={...a,common:{...a.common,issues:[]},parent:null},S=y._parseSync({data:a.data,path:a.path,parent:g});if(S.status==="valid")return S;S.status==="dirty"&&!u&&(u={result:S,ctx:g}),g.common.issues.length&&f.push(g.common.issues)}if(u)return a.common.issues.push(...u.ctx.common.issues),u.result;const m=f.map(y=>new Yr(y));return Ze(a,{code:Ue.invalid_union,unionErrors:m}),Ot}}get options(){return this._def.options}}Gm.create=(e,t)=>new Gm({options:e,typeName:Rt.ZodUnion,...qt(t)});function i0(e,t){const a=zl(e),l=zl(t);if(e===t)return{valid:!0,data:e};if(a===st.object&&l===st.object){const o=mn.objectKeys(t),u=mn.objectKeys(e).filter(m=>o.indexOf(m)!==-1),f={...e,...t};for(const m of u){const y=i0(e[m],t[m]);if(!y.valid)return{valid:!1};f[m]=y.data}return{valid:!0,data:f}}else if(a===st.array&&l===st.array){if(e.length!==t.length)return{valid:!1};const o=[];for(let u=0;u<e.length;u++){const f=e[u],m=t[u],y=i0(f,m);if(!y.valid)return{valid:!1};o.push(y.data)}return{valid:!0,data:o}}else return a===st.date&&l===st.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Ym extends ln{_parse(t){const{status:a,ctx:l}=this._processInputParams(t),o=(u,f)=>{if(_4(u)||_4(f))return Ot;const m=i0(u.value,f.value);return m.valid?((y4(u)||y4(f))&&a.dirty(),{status:a.value,value:m.data}):(Ze(l,{code:Ue.invalid_intersection_types}),Ot)};return l.common.async?Promise.all([this._def.left._parseAsync({data:l.data,path:l.path,parent:l}),this._def.right._parseAsync({data:l.data,path:l.path,parent:l})]).then(([u,f])=>o(u,f)):o(this._def.left._parseSync({data:l.data,path:l.path,parent:l}),this._def.right._parseSync({data:l.data,path:l.path,parent:l}))}}Ym.create=(e,t,a)=>new Ym({left:e,right:t,typeName:Rt.ZodIntersection,...qt(a)});class sc extends ln{_parse(t){const{status:a,ctx:l}=this._processInputParams(t);if(l.parsedType!==st.array)return Ze(l,{code:Ue.invalid_type,expected:st.array,received:l.parsedType}),Ot;if(l.data.length<this._def.items.length)return Ze(l,{code:Ue.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ot;!this._def.rest&&l.data.length>this._def.items.length&&(Ze(l,{code:Ue.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),a.dirty());const u=[...l.data].map((f,m)=>{const y=this._def.items[m]||this._def.rest;return y?y._parse(new Ji(l,f,l.path,m)):null}).filter(f=>!!f);return l.common.async?Promise.all(u).then(f=>aa.mergeArray(a,f)):aa.mergeArray(a,u)}get items(){return this._def.items}rest(t){return new sc({...this._def,rest:t})}}sc.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new sc({items:e,typeName:Rt.ZodTuple,rest:null,...qt(t)})};class Vm extends ln{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:a,ctx:l}=this._processInputParams(t);if(l.parsedType!==st.object)return Ze(l,{code:Ue.invalid_type,expected:st.object,received:l.parsedType}),Ot;const o=[],u=this._def.keyType,f=this._def.valueType;for(const m in l.data)o.push({key:u._parse(new Ji(l,m,l.path,m)),value:f._parse(new Ji(l,l.data[m],l.path,m)),alwaysSet:m in l.data});return l.common.async?aa.mergeObjectAsync(a,o):aa.mergeObjectSync(a,o)}get element(){return this._def.valueType}static create(t,a,l){return a instanceof ln?new Vm({keyType:t,valueType:a,typeName:Rt.ZodRecord,...qt(l)}):new Vm({keyType:qr.create(),valueType:t,typeName:Rt.ZodRecord,...qt(a)})}}class N4 extends ln{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:a,ctx:l}=this._processInputParams(t);if(l.parsedType!==st.map)return Ze(l,{code:Ue.invalid_type,expected:st.map,received:l.parsedType}),Ot;const o=this._def.keyType,u=this._def.valueType,f=[...l.data.entries()].map(([m,y],g)=>({key:o._parse(new Ji(l,m,l.path,[g,"key"])),value:u._parse(new Ji(l,y,l.path,[g,"value"]))}));if(l.common.async){const m=new Map;return Promise.resolve().then(async()=>{for(const y of f){const g=await y.key,S=await y.value;if(g.status==="aborted"||S.status==="aborted")return Ot;(g.status==="dirty"||S.status==="dirty")&&a.dirty(),m.set(g.value,S.value)}return{status:a.value,value:m}})}else{const m=new Map;for(const y of f){const g=y.key,S=y.value;if(g.status==="aborted"||S.status==="aborted")return Ot;(g.status==="dirty"||S.status==="dirty")&&a.dirty(),m.set(g.value,S.value)}return{status:a.value,value:m}}}}N4.create=(e,t,a)=>new N4({valueType:t,keyType:e,typeName:Rt.ZodMap,...qt(a)});class jf extends ln{_parse(t){const{status:a,ctx:l}=this._processInputParams(t);if(l.parsedType!==st.set)return Ze(l,{code:Ue.invalid_type,expected:st.set,received:l.parsedType}),Ot;const o=this._def;o.minSize!==null&&l.data.size<o.minSize.value&&(Ze(l,{code:Ue.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),a.dirty()),o.maxSize!==null&&l.data.size>o.maxSize.value&&(Ze(l,{code:Ue.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),a.dirty());const u=this._def.valueType;function f(y){const g=new Set;for(const S of y){if(S.status==="aborted")return Ot;S.status==="dirty"&&a.dirty(),g.add(S.value)}return{status:a.value,value:g}}const m=[...l.data.values()].map((y,g)=>u._parse(new Ji(l,y,l.path,g)));return l.common.async?Promise.all(m).then(y=>f(y)):f(m)}min(t,a){return new jf({...this._def,minSize:{value:t,message:ut.toString(a)}})}max(t,a){return new jf({...this._def,maxSize:{value:t,message:ut.toString(a)}})}size(t,a){return this.min(t,a).max(t,a)}nonempty(t){return this.min(1,t)}}jf.create=(e,t)=>new jf({valueType:e,minSize:null,maxSize:null,typeName:Rt.ZodSet,...qt(t)});class k4 extends ln{get schema(){return this._def.getter()}_parse(t){const{ctx:a}=this._processInputParams(t);return this._def.getter()._parse({data:a.data,path:a.path,parent:a})}}k4.create=(e,t)=>new k4({getter:e,typeName:Rt.ZodLazy,...qt(t)});class r0 extends ln{_parse(t){if(t.data!==this._def.value){const a=this._getOrReturnCtx(t);return Ze(a,{received:a.data,code:Ue.invalid_literal,expected:this._def.value}),Ot}return{status:"valid",value:t.data}}get value(){return this._def.value}}r0.create=(e,t)=>new r0({value:e,typeName:Rt.ZodLiteral,...qt(t)});function a6(e,t){return new Ru({values:e,typeName:Rt.ZodEnum,...qt(t)})}class Ru extends ln{_parse(t){if(typeof t.data!="string"){const a=this._getOrReturnCtx(t),l=this._def.values;return Ze(a,{expected:mn.joinValues(l),received:a.parsedType,code:Ue.invalid_type}),Ot}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const a=this._getOrReturnCtx(t),l=this._def.values;return Ze(a,{received:a.data,code:Ue.invalid_enum_value,options:l}),Ot}return ii(t.data)}get options(){return this._def.values}get enum(){const t={};for(const a of this._def.values)t[a]=a;return t}get Values(){const t={};for(const a of this._def.values)t[a]=a;return t}get Enum(){const t={};for(const a of this._def.values)t[a]=a;return t}extract(t,a=this._def){return Ru.create(t,{...this._def,...a})}exclude(t,a=this._def){return Ru.create(this.options.filter(l=>!t.includes(l)),{...this._def,...a})}}Ru.create=a6;class E4 extends ln{_parse(t){const a=mn.getValidEnumValues(this._def.values),l=this._getOrReturnCtx(t);if(l.parsedType!==st.string&&l.parsedType!==st.number){const o=mn.objectValues(a);return Ze(l,{expected:mn.joinValues(o),received:l.parsedType,code:Ue.invalid_type}),Ot}if(this._cache||(this._cache=new Set(mn.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const o=mn.objectValues(a);return Ze(l,{received:l.data,code:Ue.invalid_enum_value,options:o}),Ot}return ii(t.data)}get enum(){return this._def.values}}E4.create=(e,t)=>new E4({values:e,typeName:Rt.ZodNativeEnum,...qt(t)});class Zm extends ln{unwrap(){return this._def.type}_parse(t){const{ctx:a}=this._processInputParams(t);if(a.parsedType!==st.promise&&a.common.async===!1)return Ze(a,{code:Ue.invalid_type,expected:st.promise,received:a.parsedType}),Ot;const l=a.parsedType===st.promise?a.data:Promise.resolve(a.data);return ii(l.then(o=>this._def.type.parseAsync(o,{path:a.path,errorMap:a.common.contextualErrorMap})))}}Zm.create=(e,t)=>new Zm({type:e,typeName:Rt.ZodPromise,...qt(t)});class Au extends ln{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Rt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:a,ctx:l}=this._processInputParams(t),o=this._def.effect||null,u={addIssue:f=>{Ze(l,f),f.fatal?a.abort():a.dirty()},get path(){return l.path}};if(u.addIssue=u.addIssue.bind(u),o.type==="preprocess"){const f=o.transform(l.data,u);if(l.common.async)return Promise.resolve(f).then(async m=>{if(a.value==="aborted")return Ot;const y=await this._def.schema._parseAsync({data:m,path:l.path,parent:l});return y.status==="aborted"?Ot:y.status==="dirty"||a.value==="dirty"?sf(y.value):y});{if(a.value==="aborted")return Ot;const m=this._def.schema._parseSync({data:f,path:l.path,parent:l});return m.status==="aborted"?Ot:m.status==="dirty"||a.value==="dirty"?sf(m.value):m}}if(o.type==="refinement"){const f=m=>{const y=o.refinement(m,u);if(l.common.async)return Promise.resolve(y);if(y instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return m};if(l.common.async===!1){const m=this._def.schema._parseSync({data:l.data,path:l.path,parent:l});return m.status==="aborted"?Ot:(m.status==="dirty"&&a.dirty(),f(m.value),{status:a.value,value:m.value})}else return this._def.schema._parseAsync({data:l.data,path:l.path,parent:l}).then(m=>m.status==="aborted"?Ot:(m.status==="dirty"&&a.dirty(),f(m.value).then(()=>({status:a.value,value:m.value}))))}if(o.type==="transform")if(l.common.async===!1){const f=this._def.schema._parseSync({data:l.data,path:l.path,parent:l});if(!Tu(f))return Ot;const m=o.transform(f.value,u);if(m instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:a.value,value:m}}else return this._def.schema._parseAsync({data:l.data,path:l.path,parent:l}).then(f=>Tu(f)?Promise.resolve(o.transform(f.value,u)).then(m=>({status:a.value,value:m})):Ot);mn.assertNever(o)}}Au.create=(e,t,a)=>new Au({schema:e,typeName:Rt.ZodEffects,effect:t,...qt(a)});Au.createWithPreprocess=(e,t,a)=>new Au({schema:t,effect:{type:"preprocess",transform:e},typeName:Rt.ZodEffects,...qt(a)});class to extends ln{_parse(t){return this._getType(t)===st.undefined?ii(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}to.create=(e,t)=>new to({innerType:e,typeName:Rt.ZodOptional,...qt(t)});class Du extends ln{_parse(t){return this._getType(t)===st.null?ii(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Du.create=(e,t)=>new Du({innerType:e,typeName:Rt.ZodNullable,...qt(t)});class l0 extends ln{_parse(t){const{ctx:a}=this._processInputParams(t);let l=a.data;return a.parsedType===st.undefined&&(l=this._def.defaultValue()),this._def.innerType._parse({data:l,path:a.path,parent:a})}removeDefault(){return this._def.innerType}}l0.create=(e,t)=>new l0({innerType:e,typeName:Rt.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...qt(t)});class o0 extends ln{_parse(t){const{ctx:a}=this._processInputParams(t),l={...a,common:{...a.common,issues:[]}},o=this._def.innerType._parse({data:l.data,path:l.path,parent:{...l}});return Km(o)?o.then(u=>({status:"valid",value:u.status==="valid"?u.value:this._def.catchValue({get error(){return new Yr(l.common.issues)},input:l.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Yr(l.common.issues)},input:l.data})}}removeCatch(){return this._def.innerType}}o0.create=(e,t)=>new o0({innerType:e,typeName:Rt.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...qt(t)});class C4 extends ln{_parse(t){if(this._getType(t)!==st.nan){const l=this._getOrReturnCtx(t);return Ze(l,{code:Ue.invalid_type,expected:st.nan,received:l.parsedType}),Ot}return{status:"valid",value:t.data}}}C4.create=e=>new C4({typeName:Rt.ZodNaN,...qt(e)});class Aj extends ln{_parse(t){const{ctx:a}=this._processInputParams(t),l=a.data;return this._def.type._parse({data:l,path:a.path,parent:a})}unwrap(){return this._def.type}}class X0 extends ln{_parse(t){const{status:a,ctx:l}=this._processInputParams(t);if(l.common.async)return(async()=>{const u=await this._def.in._parseAsync({data:l.data,path:l.path,parent:l});return u.status==="aborted"?Ot:u.status==="dirty"?(a.dirty(),sf(u.value)):this._def.out._parseAsync({data:u.value,path:l.path,parent:l})})();{const o=this._def.in._parseSync({data:l.data,path:l.path,parent:l});return o.status==="aborted"?Ot:o.status==="dirty"?(a.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:l.path,parent:l})}}static create(t,a){return new X0({in:t,out:a,typeName:Rt.ZodPipeline})}}class c0 extends ln{_parse(t){const a=this._def.innerType._parse(t),l=o=>(Tu(o)&&(o.value=Object.freeze(o.value)),o);return Km(a)?a.then(o=>l(o)):l(a)}unwrap(){return this._def.innerType}}c0.create=(e,t)=>new c0({innerType:e,typeName:Rt.ZodReadonly,...qt(t)});var Rt;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Rt||(Rt={}));const M=qr.create,Qe=Mu.create,Ft=s0.create,Dj=a0.create;so.create;const rt=Xi.create,Ee=ms.create;Gm.create;Ym.create;sc.create;const Xm=Vm.create,oc=r0.create,Pt=Ru.create;Zm.create;to.create;Du.create;const i6=Pt(["codex","claude"]),Oj=Pt(["managed","attached-live","history-only"]),Ij=Pt(["active","idle","attention","offline"]),r6=Pt(["idle","running","completed"]),l6=Pt(["image","file"]),Lj=Pt(["user","repo","system","admin"]),Pj=Ee({can_stream_live:Ft(),can_send_input:Ft(),can_interrupt:Ft(),can_approve:Ft(),can_reject:Ft(),can_show_git:Ft(),can_show_terminal:Ft()}),o6=Ee({used_tokens:Qe(),total_tokens:Qe(),remaining_tokens:Qe(),percent_used:Qe(),cached_input_tokens:Qe(),output_tokens:Qe(),reasoning_output_tokens:Qe(),updated_at:M()}),Uj=Pt(["pending","in_progress","completed"]),zj=Ee({id:M(),step:M(),status:Uj}),J0=Ee({session_id:M(),turn_id:M().nullable(),source:Pt(["rollout","app-server"]),updated_at:M(),explanation:M().nullable().default(null),steps:rt(zj),completed_count:Qe().int().nonnegative(),total_count:Qe().int().nonnegative(),is_active:Ft()}),Bj=Ee({parent_session_id:M(),root_session_id:M().nullable().default(null),nickname:M().nullable().default(null),role:M().nullable().default(null),depth:Qe().int().nonnegative()}),Hj=Pt(["user_input","command_execution_approval","file_change_approval","permissions_approval","mcp_elicitation"]),$j=Pt(["pending","submitting","resolved"]),c6=Ee({id:M(),label:M(),description:M().nullable().default(null),emphasis:Pt(["default","primary","danger"]).default("default")}),Fj=Ee({id:M(),header:M().nullable().default(null),question:M(),options:rt(c6).default([]),allow_other:Ft().default(!1),is_secret:Ft().default(!1)}),e_=Ee({id:M(),session_id:M(),turn_id:M().nullable().default(null),item_id:M().nullable().default(null),kind:Hj,status:$j,title:M(),description:M().nullable().default(null),created_at:M(),updated_at:M(),options:rt(c6).default([]),questions:rt(Fj).default([]),allow_freeform:Ft().default(!1),freeform_placeholder:M().nullable().default(null),submit_label:M().nullable().default(null)}),qj=Ee({id:M(),kind:l6,name:M().nullable().default(null),mime_type:M().nullable().default(null),size_bytes:Qe().int().nonnegative().nullable().default(null),content_url:M().nullable().default(null)}),T4=Ee({id:M(),kind:l6,name:M(),mime_type:M().nullable().default(null),size_bytes:Qe().int().nonnegative().nullable().default(null),data_url:M()}),Wj=Ee({name:M(),description:M(),path:M(),scope:Lj,enabled:Ft()}),Kj=Pt(["supported","unsupported"]),Qj=Ee({name:M(),description:M(),availability:Kj.default("supported")}),M4=Ee({cli_version:M().nullable().default(null),loaded_at:M(),cache_ttl_ms:Qe().int().nonnegative(),commands:rt(Qj)});Ee({id:M(),label:M(),description:M(),isDefault:Ft(),defaultReasoningEffort:M().nullable().default(null),supportedReasoningEfforts:rt(M()).default([])});const Gj=Pt(["running","awaiting_input","completed","failed"]),Yj=Pt(["none","choice","text"]),Vj=Ee({id:M(),label:M(),description:M().nullable().default(null)}),Zj=Ee({type:oc("set_session_model"),model:M(),reasoning_effort:M().nullable().default(null)}).nullable().default(null),Xj=Ee({panel_id:M(),session_id:M(),command_name:M(),command_text:M(),title:M(),description:M().nullable().default(null),status:Gj,body:M(),submitted_at:M(),updated_at:M(),input_type:Yj,options:rt(Vj).default([]),input_placeholder:M().nullable().default(null),submit_label:M().nullable().default(null),effect:Zj}),R4=Ee({panel:Xj}),Jj=Pt(["online","offline"]),_p=Ee({id:M(),name:M(),display_name:M().nullable().default(null),host:M(),tailscale_ip:M().nullable().default(null),tailscale_dns_name:M().nullable().default(null),direct_base_url:M(),ws_base_url:M(),status:Jj,provider_availability:rt(i6),project_count:Qe(),session_count:Qe(),transport:Pt(["direct-agent","hub-routed"]),version:M().nullable().default(null),registered_at:M().nullable().default(null),last_seen_at:M().nullable().default(null)}),t_=Ee({id:M(),agent_id:M(),name:M(),display_name:M().nullable(),pinned:Ft(),path:M(),branch:M(),worktree:M(),runtime_profiles:rt(M()),preview_url:M().nullable()}),zf=Ee({id:M(),agent_id:M(),project_id:M(),provider:i6,archived:Ft(),title:M(),mode:Oj,health:Ij,branch:M(),worktree:M(),summary:M(),latest_assistant_message:M().nullable().default(null),last_event_at:M(),pinned:Ft(),run_state:r6,run_state_changed_at:M().nullable(),context_usage:o6.nullable().default(null),subagent:Bj.nullable().default(null),capability:Pj}),ew=Ee({path:M(),additions:Qe(),deletions:Qe()}),tw=Ee({files:rt(ew),additions:Qe(),deletions:Qe()}),wf=Ee({id:M(),kind:Pt(["user","assistant","thinking","tool","system"]),title:M(),body:M(),body_truncated:Ft().default(!1),detail_available:Ft().default(!1),patch_summary:tw.nullable().default(null),session_ids:rt(M()).default([]),timestamp:M(),accent:Pt(["primary","secondary","muted"]),attachments:rt(qj).default([])}),nw=Pt(["tail","full_compact"]),u6=Ee({session_id:M(),generated_at:M(),view:nw,anchor_entry_id:M().nullable().default(null),has_earlier_entries:Ft().default(!1),entries:rt(wf)}),sw=Pt(["app-server","rollout-fallback"]),aw=Pt(["running","completed"]),iw=Pt(["add","delete","update"]),n_=Ee({path:M(),kind:iw,move_path:M().nullable(),additions:Qe(),deletions:Qe(),diff:M(),item_id:M().nullable()}),rw=n_.omit({diff:!0}).extend({diff_available:Ft().default(!1)}),d6=Ee({id:M(),session_id:M(),turn_id:M(),source:sw,status:aw,started_at:M(),completed_at:M().nullable(),updated_at:M(),aggregated_diff:M(),files:rt(n_)}),f6=d6.omit({aggregated_diff:!0,files:!0}).extend({aggregated_diff_available:Ft().default(!1),files:rt(rw)}),lw=Ee({session_id:M(),change_set_id:M(),file:n_,empty_message:M().default("此变更没有可展示的补丁内容")}),ow=Ee({path:M(),status:Pt(["modified","added","deleted","renamed"]),additions:Qe(),deletions:Qe()}),h6=Pt(["modified","added","deleted","renamed","untracked"]),cw=Ee({path:M(),previous_path:M().nullable().default(null),status:h6,additions:Qe().int().nonnegative(),deletions:Qe().int().nonnegative()}),uw=Ee({session_id:M(),project_id:M(),path:M(),previous_path:M().nullable().default(null),additions:Qe().int().nonnegative(),deletions:Qe().int().nonnegative(),diff:M()}),m6=Ee({session_id:M(),project_id:M(),branch:M(),branches:rt(M()),upstream_branch:M().nullable().default(null),ahead_count:Qe().int().nonnegative(),behind_count:Qe().int().nonnegative(),files:rt(cw),updated_at:M()}),dw=Ee({path:M(),previous_path:M().nullable().default(null),status:h6}),fw=Ee({oid:M(),short_oid:M(),subject:M(),author_name:M(),authored_at:M(),committed_at:M(),parent_oids:rt(M()).default([]),refs:rt(M()).default([]),files:rt(dw)}),hw=Ee({session_id:M(),project_id:M(),commit_oid:M(),path:M(),previous_path:M().nullable().default(null),additions:Qe().int().nonnegative(),deletions:Qe().int().nonnegative(),diff:M()}),mw=Ee({session_id:M(),project_id:M(),branch:M(),upstream_branch:M().nullable().default(null),head_oid:M().nullable().default(null),upstream_head_oid:M().nullable().default(null),commits:rt(fw),updated_at:M()});Pt(["discard-file","discard-all","commit-all","switch-branch","push"]);const pw=Ee({ok:oc(!0),workspace:m6}),p6=Pt(["auto","powershell","cmd","bash"]),gw=Pt(["user","codex"]),_w=Ee({id:M(),name:M(),description:M().nullable().default(null),command:M(),kill_command:M().nullable().default(null),cwd:M().nullable().default(null),shell:p6.default("auto"),node_version:M().nullable().default(null),port:Qe().int().positive().nullable().default(null),source:gw.default("user"),created_at:M(),updated_at:M()}),yw=Ee({name:M(),description:M().nullable().default(null),command:M(),kill_command:M().nullable().default(null),cwd:M().nullable().default(null),shell:p6.default("auto"),node_version:M().nullable().default(null),port:Qe().int().positive().nullable().default(null)}),s_=Ee({session_id:M(),project_id:M(),config_path:M(),commands:rt(_w),updated_at:M()}),vw=Pt(["user","codex"]),bw=Ee({id:M(),name:M(),description:M().nullable().default(null),url:M(),source:vw.default("user"),created_at:M(),updated_at:M()}),xw=Ee({name:M(),description:M().nullable().default(null),url:M()}),a_=Ee({session_id:M(),project_id:M(),config_path:M(),websites:rt(bw),updated_at:M()}),Sw=Pt(["queued","running","completed","failed","stopped"]),jw=Pt(["stdout","stderr","system"]),ww=Ee({cursor:Qe().int().nonnegative(),stream:jw,text:M(),timestamp:M()}),i_=Ee({id:M(),session_id:M(),project_id:M(),command_id:M().nullable().default(null),title:M(),command:M(),cwd:M(),status:Sw,exit_code:Qe().int().nullable().default(null),created_at:M(),started_at:M().nullable().default(null),completed_at:M().nullable().default(null),updated_at:M(),last_output_at:M().nullable().default(null),output_cursor:Qe().int().nonnegative(),preview:M().nullable().default(null)}),r_=Ee({session_id:M(),project_id:M(),active_terminal_id:M().nullable().default(null),terminals:rt(i_),updated_at:M()}),Nw=Ee({session_id:M(),project_id:M(),terminal:i_,chunks:rt(ww),next_cursor:Qe().int().nonnegative(),truncated:Ft().default(!1)}),g6=Ee({run_state:r6.optional(),run_state_changed_at:M().nullable().optional(),summary:M().optional(),latest_assistant_message:M().nullable().optional(),last_event_at:M().optional(),context_usage:o6.nullable().optional()}),kw=Ee({session_id:M(),recovered_at:M(),session_patch:g6,timeline:rt(wf),interactions:rt(e_),plan_snapshot:J0.nullable().default(null),change_sets:rt(d6),terminal_snapshot:r_.nullable().default(null)}),_6=Ee({manager:Pt(["none","nvm-windows"]).default("none"),versions:rt(M()).default([]),error:M().nullable().default(null)}),y6=Ee({command_catalog:s_,website_catalog:a_,node_runtime:_6,terminal_snapshot:r_}),Ew=Ee({session_id:M(),generated_at:M(),session_patch:g6,timeline:u6,interactions:rt(e_),plan_snapshot:J0.nullable().default(null),run_workbench:y6.nullable().default(null),change_sets:rt(f6).default([])}),Cw=Ee({catalog:s_}),Tw=Ee({catalog:a_}),Mw=Ee({commands:rt(yw),reason:M().nullable().default(null)}),Rw=Ee({generation:Mw,catalog:s_}),Aw=Ee({websites:rt(xw),reason:M().nullable().default(null)}),Dw=Ee({generation:Aw,catalog:a_}),Ow=Ee({snapshot:r_,terminal:i_.nullable().default(null)}),Iw=Pt(["dev-hub","dev-agent","dev-web","release-hub","release-agent"]),Lw=Pt(["unknown","running","stopped","degraded"]),Pw=Pt(["dev-start","dev-restart","dev-stop","dev-probe","npm-publish","release-install-run","apk-build"]),Uw=Pt(["running","succeeded","failed"]),zw=Pt(["info","success","warn","error"]),v6=Ee({repo_path:M().nullable().default(null),nvm_version:M().nullable().default(null),dev_hub_port:Qe().int().positive().nullable().default(null),dev_hub_args:M().default(""),dev_agent_port:Qe().int().positive().nullable().default(null),dev_agent_hub_url:M().default(""),dev_agent_direct_base_url:M().default(""),dev_agent_ws_base_url:M().default(""),dev_agent_name:M().default(""),dev_agent_args:M().default(""),dev_web_port:Qe().int().positive().nullable().default(null),dev_web_hub_url:M().default(""),dev_web_args:M().default(""),release_hub_port:Qe().int().positive().nullable().default(null),release_hub_args:M().default(""),release_agent_port:Qe().int().positive().nullable().default(null),release_agent_hub_url:M().default(""),release_agent_direct_base_url:M().default(""),release_agent_ws_base_url:M().default(""),release_agent_name:M().default(""),release_agent_args:M().default(""),updated_at:M().nullable().default(null)}),Bw=v6.extend({npm_token:M().nullable().default(null),clear_npm_token:Ft().default(!1)}),Hw=Ee({has_npm_token:Ft(),npm_token_hint:M().nullable().default(null)}),$w=Ee({checked_at:M(),url:M().nullable().default(null),ok:Ft(),status_code:Qe().int().nullable().default(null),duration_ms:Qe().int().nonnegative().nullable().default(null),message:M().nullable().default(null)}),Fw=Ee({key:Iw,label:M(),status:Lw,configured_port:Qe().int().positive().nullable().default(null),detected_pids:rt(Qe().int().positive()).default([]),probe:$w.nullable().default(null)}),qw=Ee({id:M(),timestamp:M(),level:zw,message:M()}),b6=Ee({id:M(),kind:Pw,title:M(),status:Uw,created_at:M(),started_at:M().nullable().default(null),finished_at:M().nullable().default(null),summary:M().nullable().default(null),error:M().nullable().default(null),disconnect_expected:Ft().default(!1),logs:rt(qw).default([])}),Ww=Ee({artifact_id:M(),file_name:M(),size_bytes:Qe().int().nonnegative(),built_at:M(),published_at:M().nullable().default(null),version_name:M().nullable().default(null),version_code:Qe().int().nullable().default(null),download_path:M()}),u0=Ee({generated_at:M(),config:v6,credentials:Hw,node_runtime:_6,services:rt(Fw),current_version:M().nullable().default(null),apk_artifact:Ww.nullable().default(null),jobs:rt(b6).default([])});Ee({action:Pt(["start-development","restart-development","stop-development","probe-development","publish-npm","install-latest-release","build-apk"])});const Kw=Ee({ok:oc(!0),snapshot:u0,job:b6.nullable().default(null)}),Qw=Ee({id:M(),name:M(),command:M(),port:Qe().nullable(),status:Pt(["running","stopped","degraded"]),log_excerpt:M()}),Gw=Ee({id:M(),label:M(),url:M(),status:Pt(["ready","starting","stopped"])}),x6=Ee({path:M(),name:M(),has_children:Ft()}),Yw=Ee({directory:x6}),Vw=Ee({id:M(),title:M(),description:M(),status:Pt(["pending","approved","rejected"])}),Zw=Ee({project_id:M(),visible_session_count:Qe().int().nonnegative(),archived_session_count:Qe().int().nonnegative(),hidden_history_count:Qe().int().nonnegative()}),Xw=t_.pick({id:!0,agent_id:!0,name:!0,display_name:!0,pinned:!0,path:!0}),Jw=_p.pick({id:!0,name:!0,display_name:!0,status:!0}),S6=zf.pick({id:!0,agent_id:!0,project_id:!0,archived:!0,title:!0,last_event_at:!0,pinned:!0,run_state:!0,run_state_changed_at:!0,subagent:!0}),eN=zf.pick({id:!0,agent_id:!0,project_id:!0,archived:!0,title:!0,provider:!0,mode:!0,health:!0,branch:!0,worktree:!0,summary:!0,latest_assistant_message:!0,last_event_at:!0,pinned:!0,run_state:!0,run_state_changed_at:!0,context_usage:!0,subagent:!0,capability:!0}),tN=Ee({generated_at:M(),session:eN}),nN=Ee({generated_at:M(),agents:rt(_p)}),sN=zf.pick({id:!0,title:!0,run_state:!0,run_state_changed_at:!0,latest_assistant_message:!0}),aN=Ee({generated_at:M(),recent_sessions:rt(sN)}),iN=Ee({session_id:M(),agent_id:M(),project_id:M(),direct_base_url:M(),ws_base_url:M()}),rN=Ee({generated_at:M(),agent:Jw.nullable().default(null),projects:rt(Xw),project_stats:rt(Zw).default([]),sessions:rt(S6),active_session_id:M()}),j6=Pt(["archived","history"]),lN=Ee({bucket:j6,project_id:M().nullable().default(null),sessions:rt(S6),next_cursor:M().nullable().default(null),total_count:Qe().int().nonnegative()}),oN=Ee({session_id:M(),entry_id:M(),command_entry:wf,output_entries:rt(wf).default([])}),cN=Ee({generated_at:M(),agents:rt(_p),projects:rt(t_),sessions:rt(zf),active_session_id:M(),timeline:rt(wf),changed_files:rt(ow),runtime_processes:rt(Qw),previews:rt(Gw),approvals:rt(Vw)});Ee({agent:_p,projects:rt(t_),sessions:rt(zf),active_session_id:M().default(""),generated_at:M()});const A4=Ee({ok:oc(!0),agent_id:M(),heartbeat_interval_ms:Qe().int().positive(),heartbeat_timeout_ms:Qe().int().positive(),registered_at:M(),received_at:M()}),uN=Pt(["rename","delete"]);Ee({action:uN,display_name:M().nullable().default(null)});const dN=Ee({ok:oc(!0)}),l_=Ee({completion_notifications_enabled:Ft().default(!1)}),fN=Ee({p256dh:M(),auth:M()}),hN=Ee({endpoint:M().url(),expirationTime:Qe().nullable().default(null),keys:fN}),mN=Ee({label:M().nullable().default(null),user_agent:M().nullable().default(null)});Ee({subscription:hN,settings:l_.default({}),device:mN.default({})});const pN=Ee({endpoint:M().url()}),gN=Ee({endpoint:M().url()}),_N=Ee({supported:Ft(),vapid_public_key:M().nullable().default(null),subject:M().nullable().default(null),reason:M().nullable().default(null)}),yN=Ee({ok:oc(!0),subscription_id:M(),endpoint:M().url(),settings:l_,created_at:M(),updated_at:M()}),vN=Ee({ok:oc(!0),endpoint:M().url(),delivered_at:M()}),bN=Ee({type:Pt(["agent.online","agent.offline","snapshot.changed","session.updated","thread.updated","timeline.delta","timeline.reset","interaction.delta","interaction.reset","plan.delta","plan.reset","changeset.delta","changeset.reset","terminal.snapshot","terminal.delta","turn.delta","turn.completed","approval.requested"]),timestamp:M(),payload:Xm(Dj())}),xN=Ee({width:Qe().nonnegative(),height:Qe().nonnegative(),device_pixel_ratio:Qe().nonnegative(),visual_width:Qe().nonnegative().nullable().default(null),visual_height:Qe().nonnegative().nullable().default(null),screen_width:Qe().nonnegative().nullable().default(null),screen_height:Qe().nonnegative().nullable().default(null)}),SN=Ee({user_agent:M(),language:M().nullable().default(null),languages:rt(M()).default([]),platform:M().nullable().default(null),vendor:M().nullable().default(null),online:Ft().nullable().default(null),cookie_enabled:Ft().nullable().default(null),secure_context:Ft(),standalone_display_mode:Ft(),hardware_concurrency:Qe().int().nonnegative().nullable().default(null),device_memory_gb:Qe().nonnegative().nullable().default(null),max_touch_points:Qe().int().nonnegative().nullable().default(null)}),jN=Ee({href:M(),pathname:M(),referrer:M().nullable().default(null),visibility_state:M().nullable().default(null)}),wN=Ee({scope:M(),active_script_url:M().nullable().default(null),waiting_script_url:M().nullable().default(null),installing_script_url:M().nullable().default(null)}),NN=Ee({supported:Ft(),controller:Ft(),registrations:rt(wN).default([])}),kN=Ee({supported:Ft(),keys:rt(M()).default([])}),EN=Ee({href:M().nullable().default(null),rel:M().nullable().default(null)}),CN=Ee({href:M().nullable().default(null),owner_node:M().nullable().default(null),media:M().nullable().default(null),disabled:Ft(),css_rule_count:Qe().int().nonnegative().nullable().default(null)}),TN=Ee({url:M(),kind:Pt(["stylesheet","script","manifest","icon","other"]),ok:Ft(),status:Qe().int().nonnegative().nullable().default(null),content_type:M().nullable().default(null),cache_control:M().nullable().default(null),error:M().nullable().default(null)}),MN=Ee({name:M(),initiator_type:M().nullable().default(null),duration_ms:Qe().nonnegative().nullable().default(null),transfer_size:Qe().nonnegative().nullable().default(null),decoded_body_size:Qe().nonnegative().nullable().default(null)}),RN=Ee({x:Qe(),y:Qe(),width:Qe().nonnegative(),height:Qe().nonnegative()}),AN=Ee({selector:M(),found:Ft(),text_preview:M().nullable().default(null),rect:RN.nullable().default(null),computed:Xm(M()).default({})});Ee({captured_at:M(),page:jN,environment:SN,viewport:xN,feature_support:Xm(Ft()).default({}),service_worker:NN,cache:kN,manifest:EN,stylesheets:rt(CN).default([]),resource_probes:rt(TN).default([]),performance_entries:rt(MN).default([]),theme_variables:Xm(M()).default({}),element_snapshots:rt(AN).default([]),notes:rt(M()).default([])});const DN=/^(?:image|img|photo|picture|screenshot|图片|照片|截图)(?:[-_ ]?\d+)?\.(?:avif|bmp|gif|heic|heif|jpe?g|png|svg|webp)$/i,Ps=e=>(e==null?void 0:e.trim())??"",D4="\0",O4=e=>{const t=Ps(e);return t?DN.test(t)?1:2+Math.min(t.length,64)/100:0},ON=(e,t)=>{const a=O4(e),l=O4(t);if(l>a)return Ps(t)||null;if(a>l)return Ps(e)||null;const o=Ps(e),u=Ps(t);return u.length>o.length?u||null:o||null},IN=e=>{const t=Ps(e.content_url);return t?[e.kind,"content",t].join(D4):[e.kind,"meta",Ps(e.mime_type).toLowerCase(),typeof e.size_bytes=="number"&&Number.isFinite(e.size_bytes)?String(Math.max(0,Math.round(e.size_bytes))):"",Ps(e.name).toLowerCase()].join(D4)},LN=(e,t)=>{const a=Ps(e.name),l=Ps(t.name),o=Ps(e.mime_type),u=Ps(t.mime_type);return{id:e.id||t.id,kind:e.kind==="image"||t.kind==="image"?"image":e.kind,name:ON(a,l),mime_type:o||u||null,size_bytes:e.size_bytes??t.size_bytes??null,content_url:Ps(e.content_url)||Ps(t.content_url)||null}},w6=e=>{if(!e||e.length===0)return[];const t=[],a=new Map;for(const l of e){const o=IN(l),u=a.get(o);if(u===void 0){a.set(o,t.length),t.push({...l,name:Ps(l.name)||null,mime_type:Ps(l.mime_type)||null,size_bytes:typeof l.size_bytes=="number"&&Number.isFinite(l.size_bytes)?Math.max(0,Math.round(l.size_bytes)):null,content_url:Ps(l.content_url)||null});continue}t[u]=LN(t[u],l)}return t},N6=(e,t)=>w6([...e??[],...t??[]]),ya=e=>new Date(e).toISOString(),PN=()=>({generated_at:new Date().toISOString(),active_session_id:"session-managed-1",agents:[{id:"agent-shanghai-main",name:"studio-main",display_name:null,host:"100.88.10.14",tailscale_ip:"100.88.10.14",tailscale_dns_name:"studio-main.tail-scale.ts.net",direct_base_url:"http://100.88.10.14:4242",ws_base_url:"ws://100.88.10.14:4242/ws",status:"online",provider_availability:["codex"],project_count:2,session_count:2,transport:"direct-agent",version:"0.1.0",registered_at:ya("2026-03-18T10:30:00+08:00"),last_seen_at:ya("2026-03-18T10:58:00+08:00")},{id:"agent-macbook",name:"macbook-air",display_name:null,host:"100.89.20.77",tailscale_ip:"100.89.20.77",tailscale_dns_name:"macbook-air.tail-scale.ts.net",direct_base_url:"http://100.89.20.77:4242",ws_base_url:"ws://100.89.20.77:4242/ws",status:"online",provider_availability:["codex"],project_count:1,session_count:1,transport:"hub-routed",version:"0.1.0",registered_at:ya("2026-03-18T10:20:00+08:00"),last_seen_at:ya("2026-03-18T10:55:00+08:00")}],projects:[{id:"project-panda",agent_id:"agent-shanghai-main",name:"panda",display_name:null,pinned:!1,path:"D:/ai/panda",branch:"main",worktree:"default",runtime_profiles:["dev","storybook","test"],preview_url:"https://panda.tailnet.ts.net"},{id:"project-remodex-lab",agent_id:"agent-shanghai-main",name:"remodex",display_name:null,pinned:!1,path:"D:/ai/remodex",branch:"phase1-ui",worktree:"mobile-lab",runtime_profiles:["dev"],preview_url:null},{id:"project-notes",agent_id:"agent-macbook",name:"notes",display_name:null,pinned:!1,path:"D:/Users/dev/notes",branch:"research",worktree:"default",runtime_profiles:["dev"],preview_url:null}],sessions:[{id:"session-managed-1",agent_id:"agent-shanghai-main",project_id:"project-panda",provider:"codex",archived:!1,title:"Stage 1 buildout",mode:"managed",health:"active",branch:"main",worktree:"default",summary:"Monorepo scaffold, PWA shell, agent bootstrap API",latest_assistant_message:"Wiring the shell.",last_event_at:ya("2026-03-18T10:58:00+08:00"),pinned:!1,run_state:"running",run_state_changed_at:ya("2026-03-18T10:57:20+08:00"),context_usage:null,subagent:null,capability:{can_stream_live:!0,can_send_input:!0,can_interrupt:!0,can_approve:!0,can_reject:!0,can_show_git:!0,can_show_terminal:!0}},{id:"session-live-2",agent_id:"agent-shanghai-main",project_id:"project-remodex-lab",provider:"codex",archived:!1,title:"Remote attach",mode:"attached-live",health:"idle",branch:"phase1-ui",worktree:"mobile-lab",summary:"",latest_assistant_message:null,last_event_at:ya("2026-03-18T10:48:00+08:00"),pinned:!1,run_state:"completed",run_state_changed_at:ya("2026-03-18T10:48:00+08:00"),context_usage:null,subagent:null,capability:{can_stream_live:!0,can_send_input:!1,can_interrupt:!1,can_approve:!1,can_reject:!1,can_show_git:!0,can_show_terminal:!0}},{id:"session-history-3",agent_id:"agent-macbook",project_id:"project-notes",provider:"codex",archived:!1,title:"Research notes",mode:"history-only",health:"offline",branch:"research",worktree:"default",summary:"",latest_assistant_message:null,last_event_at:ya("2026-03-17T19:12:00+08:00"),pinned:!1,run_state:"idle",run_state_changed_at:null,context_usage:null,subagent:null,capability:{can_stream_live:!1,can_send_input:!1,can_interrupt:!1,can_approve:!1,can_reject:!1,can_show_git:!0,can_show_terminal:!1}}],timeline:[{id:"entry-1",kind:"system",title:"Session ready",body:"Managed session attached.",body_truncated:!1,detail_available:!1,patch_summary:null,session_ids:[],timestamp:ya("2026-03-18T10:40:00+08:00"),accent:"muted",attachments:[]},{id:"entry-2",kind:"user",title:"Prompt",body:"Start stage one.",body_truncated:!1,detail_available:!1,patch_summary:null,session_ids:[],timestamp:ya("2026-03-18T10:44:00+08:00"),accent:"primary",attachments:[]},{id:"entry-3",kind:"thinking",title:"Plan",body:"Aligning routes and session state.",body_truncated:!1,detail_available:!1,patch_summary:null,session_ids:[],timestamp:ya("2026-03-18T10:45:30+08:00"),accent:"secondary",attachments:[]},{id:"entry-4",kind:"tool",title:"Tool activity",body:"Scanned docs/, checked runtime versions, and created the initial workspace directories.",body_truncated:!1,detail_available:!1,patch_summary:null,session_ids:[],timestamp:ya("2026-03-18T10:48:00+08:00"),accent:"secondary",attachments:[]},{id:"entry-5",kind:"assistant",title:"Focus",body:"Wiring the shell.",body_truncated:!1,detail_available:!1,patch_summary:null,session_ids:[],timestamp:ya("2026-03-18T10:58:00+08:00"),accent:"primary",attachments:[]}],changed_files:[{path:"apps/web/src/components/dashboard.tsx",status:"added",additions:248,deletions:0},{path:"packages/protocol/src/index.ts",status:"modified",additions:94,deletions:12},{path:"apps/agent/src/index.ts",status:"modified",additions:77,deletions:3}],runtime_processes:[{id:"runtime-dev",name:"dev",command:"pnpm --filter @panda/web dev --host 0.0.0.0 --port 4173",port:4173,status:"running",log_excerpt:"Vite server ready on 0.0.0.0:4173 and previewed over the tailnet."},{id:"runtime-agent",name:"agent",command:"pnpm --filter @panda/agent dev",port:4242,status:"running",log_excerpt:"Fastify listening on http://0.0.0.0:4242 with WebSocket events enabled."}],previews:[{id:"preview-main",label:"PWA preview",url:"https://panda.tailnet.ts.net",status:"ready"},{id:"preview-storybook",label:"Design lab",url:"https://storybook.tailnet.ts.net",status:"starting"}],approvals:[{id:"approval-1",title:"Write workspace files",description:"Create monorepo config, React app shell, and Fastify agent entrypoints.",status:"approved"},{id:"approval-2",title:"Attach external Codex session",description:"External session controls remain experimental until app-server transport is available.",status:"pending"}]}),UN=()=>PN(),zN=()=>UN(),k6=e=>{const t=new URL(e);return t.protocol=t.protocol==="https:"?"wss:":"ws:",t.pathname="/ws",t.toString()};class BN{constructor(t,a=k6(t)){this.baseUrl=t,this.wsBaseUrl=a}getConnectionKey(){return`${this.baseUrl}::${this.wsBaseUrl}`}async readJson(t,a){const l=await fetch(t);if(!l.ok)throw new Error(`Request failed with ${l.status}`);return a.parse(await l.json())}async postJson(t,a,l){const o=await fetch(new URL(t,this.baseUrl),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(a)}),u=await o.json().catch(()=>null);if(!o.ok)throw new Error((u==null?void 0:u.error)??`Request failed with ${o.status}`);return l?l.parse(u):u}async getPhaseOneSnapshot(t){const{fallbackToMock:a=!0,fallbackSnapshot:l=zN}=t??{};try{const o=await fetch(new URL("/api/bootstrap",this.baseUrl));if(!o.ok)throw new Error(`Bootstrap request failed with ${o.status}`);const u=await o.json();return cN.parse(u)}catch(o){if(!a)throw o;return l()}}async getHubDirectory(){return this.readJson(new URL("/api/hub/directory",this.baseUrl),nN)}async getHubRecentSessions(){return this.readJson(new URL("/api/hub/recent-sessions",this.baseUrl),aN)}async getSessionLocation(t){return this.readJson(new URL(`/api/sessions/${t}/location`,this.baseUrl),iN)}async getWorkspaceDirectory(t){const a=new URL("/api/workspace",this.baseUrl);return t!=null&&t.selectedSessionId&&a.searchParams.set("selectedSessionId",t.selectedSessionId),this.readJson(a,rN)}async getWorkspaceSessionPage(t){const a=new URL("/api/workspace/sessions",this.baseUrl);return a.searchParams.set("bucket",j6.parse(t.bucket)),t.projectId&&a.searchParams.set("projectId",t.projectId),t.cursor&&a.searchParams.set("cursor",t.cursor),typeof t.limit=="number"&&Number.isFinite(t.limit)&&a.searchParams.set("limit",String(Math.max(1,Math.floor(t.limit)))),t.selectedSessionId&&a.searchParams.set("selectedSessionId",t.selectedSessionId),this.readJson(a,lN)}async getWorkspaceSessionDetail(t){const a=new URL("/api/workspace/session-detail",this.baseUrl);return a.searchParams.set("sessionId",t),this.readJson(a,tN)}async getSessionTimeline(t,a){const l=new URL(`/api/sessions/${t}/timeline`,this.baseUrl);return a!=null&&a.view&&l.searchParams.set("view",a.view),this.readJson(l,u6)}async getSessionChangeSets(t){return this.readJson(new URL(`/api/sessions/${t}/change-sets`,this.baseUrl),{parse:a=>Array.isArray(a)?a.map(l=>f6.parse(l)):[]})}async getSessionBootstrap(t){return this.readJson(new URL(`/api/sessions/${t}/bootstrap`,this.baseUrl),Ew)}async getSessionToolCallDetail(t,a){const l=new URL(`/api/sessions/${t}/tool-detail`,this.baseUrl);return l.searchParams.set("entryId",a),this.readJson(l,oN)}async getSessionChangeSetFileDiff(t,a){const l=new URL(`/api/sessions/${t}/change-set-file-diff`,this.baseUrl);return l.searchParams.set("changeSetId",a.changeSetId),l.searchParams.set("path",a.path),a.itemId&&l.searchParams.set("itemId",a.itemId),this.readJson(l,lw)}async getSessionGitWorkspace(t){return this.readJson(new URL(`/api/sessions/${t}/git-workspace`,this.baseUrl),m6)}async getSessionGitWorkspaceFileDiff(t,a){const l=new URL(`/api/sessions/${t}/git-workspace/file-diff`,this.baseUrl);return l.searchParams.set("path",a.path),a.previousPath&&l.searchParams.set("previousPath",a.previousPath),this.readJson(l,uw)}async getSessionGitHistory(t){return this.readJson(new URL(`/api/sessions/${t}/git/history`,this.baseUrl),mw)}async getSessionGitHistoryFileDiff(t,a){const l=new URL(`/api/sessions/${t}/git/history/file-diff`,this.baseUrl);return l.searchParams.set("commitOid",a.commitOid),l.searchParams.set("path",a.path),a.previousPath&&l.searchParams.set("previousPath",a.previousPath),this.readJson(l,hw)}async getSessionRunWorkbench(t){return this.readJson(new URL(`/api/sessions/${t}/run-workbench`,this.baseUrl),y6)}async saveSessionRunCommand(t){return this.postJson(`/api/sessions/${t.sessionId}/run-commands`,{action:t.action,commandId:t.commandId??null,command:t.command??null},Cw)}async generateSessionRunCommand(t){return this.postJson(`/api/sessions/${t.sessionId}/run-commands/generate`,{prompt:t.prompt,model:t.model},Rw)}async saveSessionRunWebsite(t){return this.postJson(`/api/sessions/${t.sessionId}/run-websites`,{action:t.action,websiteId:t.websiteId??null,website:t.website??null},Tw)}async generateSessionRunWebsite(t){return this.postJson(`/api/sessions/${t.sessionId}/run-websites/generate`,{prompt:t.prompt,model:t.model},Dw)}async executeSessionTerminalAction(t){return this.postJson(`/api/sessions/${t.sessionId}/terminals`,{action:t.action,commandId:t.commandId??null,terminalId:t.terminalId??null},Ow)}async getSessionTerminalOutput(t){const a=new URL(`/api/sessions/${t.sessionId}/terminals/${t.terminalId}/output`,this.baseUrl);return typeof t.cursor=="number"&&Number.isFinite(t.cursor)&&a.searchParams.set("cursor",String(Math.max(0,Math.floor(t.cursor)))),this.readJson(a,Nw)}async getSessionPlan(t){return this.readJson(new URL(`/api/sessions/${t}/plan`,this.baseUrl),{parse:a=>a==null?null:J0.parse(a)})}async getSessionInteractions(t){return this.readJson(new URL(`/api/sessions/${t}/interactions`,this.baseUrl),{parse:a=>Array.isArray(a)?a.map(l=>e_.parse(l)):[]})}async getSessionRecoverySnapshot(t){return this.readJson(new URL(`/api/sessions/${t}/recovery`,this.baseUrl),kw)}async getProjectSkills(t){return this.readJson(new URL(`/api/projects/${t}/skills`,this.baseUrl),{parse:a=>Array.isArray(a)?a.map(l=>Wj.parse(l)):[]})}async getCodexCommands(){return this.readJson(new URL("/api/codex/commands",this.baseUrl),M4)}async refreshCodexCommands(){return this.postJson("/api/codex/commands/refresh",{},M4)}async listDirectories(t){const a=new URL("/api/directories",this.baseUrl);return t.agentId&&a.searchParams.set("agentId",t.agentId),t.path&&a.searchParams.set("path",t.path),this.readJson(a,{parse:l=>Array.isArray(l)?l.map(o=>x6.parse(o)):[]})}async createDirectory(t){return this.postJson("/api/directories",t,Yw)}async createProject(t){return this.postJson("/api/projects",t)}async createSession(t){var a;return this.postJson("/api/sessions",{...t,attachments:(a=t.attachments)==null?void 0:a.map(l=>T4.parse(l)),serviceTier:t.serviceTier,planMode:t.planMode,yoloMode:t.yoloMode})}async updateSession(t){return this.postJson(`/api/sessions/${t.sessionId}/actions`,{action:t.action,name:t.name})}async updateThread(t){return this.postJson(`/api/threads/${t.projectId}/actions`,{action:t.action,name:t.name,orderedProjectIds:t.orderedProjectIds})}async sendSessionInput(t){var a;return this.postJson(`/api/sessions/${t.sessionId}/input`,{input:t.input,attachments:(a=t.attachments)==null?void 0:a.map(l=>T4.parse(l)),model:t.model,reasoningEffort:t.reasoningEffort,serviceTier:t.serviceTier,planMode:t.planMode,yoloMode:t.yoloMode})}async executeSessionCommand(t){return this.postJson(`/api/sessions/${t.sessionId}/commands/execute`,{input:t.input},R4)}async respondToSessionCommand(t){return this.postJson(`/api/sessions/${t.sessionId}/commands/respond`,{panelId:t.panelId,optionId:t.optionId??null,text:t.text??null},R4)}async respondToSessionInteraction(t){return this.postJson(`/api/sessions/${t.sessionId}/interactions/${t.requestId}/respond`,{optionId:t.optionId??null,text:t.text??null,answers:t.answers??null})}async interruptSession(t){return this.postJson(`/api/sessions/${t}/interrupt`,{})}async registerAgent(t){return this.postJson("/api/agents/register",t,A4)}async heartbeatAgent(t){return this.postJson("/api/agents/heartbeat",t,A4)}async updateAgent(t){return this.postJson(`/api/agents/${t.agentId}/actions`,{action:t.action,display_name:t.displayName??null},dN)}async getWebPushPublicConfig(){return this.readJson(new URL("/api/push/public-key",this.baseUrl),_N)}async upsertWebPushSubscription(t){return this.postJson("/api/push/subscriptions",{subscription:t.subscription,settings:l_.parse(t.settings),device:t.device??null},yN)}async removeWebPushSubscription(t){return this.postJson("/api/push/subscriptions/remove",pN.parse(t))}async sendWebPushTest(t){return this.postJson("/api/push/test",gN.parse(t),vN)}async executeSessionGitAction(t){return this.postJson(`/api/sessions/${t.sessionId}/git/actions`,{action:t.action,path:t.path,branch:t.branch,message:t.message},pw)}async getDevManagerSnapshot(t){const a=new URL("/api/dev-manager",this.baseUrl);return t!=null&&t.includeServiceProbe&&a.searchParams.set("includeServiceProbe","1"),this.readJson(a,u0)}async saveDevManagerConfig(t){return this.postJson("/api/dev-manager/config",Bw.parse(t),u0)}async executeDevManagerAction(t){return this.postJson("/api/dev-manager/actions",t,Kw)}createEventStream(t,a){var ye;let m=null,y=((ye=a==null?void 0:a.sessionId)==null?void 0:ye.trim())??"",g="",S=!1,p=0,v=null,w=!1,N=!1,j=!1,T=0;const A=typeof document<"u"&&typeof document.visibilityState=="string",U=()=>A&&document.visibilityState==="hidden",I=(a==null?void 0:a.reconnectWhenHidden)===!0,E=R=>(R==null?void 0:R.readyState)===WebSocket.OPEN||(R==null?void 0:R.readyState)===WebSocket.CONNECTING,L=()=>{v!==null&&(globalThis.clearTimeout(v),v=null)},W=(R,H)=>{var X;(X=a==null?void 0:a.onStatus)==null||X.call(a,{state:R,attempt:p,maxAttempts:5,error:H})},ee=R=>{const H=m;!H||H.readyState!==WebSocket.OPEN||(g&&g!==R&&(H.send(JSON.stringify({type:"session.unsubscribe",sessionId:g})),g=""),!(!R||g===R)&&(g=R,H.send(JSON.stringify({type:"session.subscribe",sessionId:R}))))},F=R=>{if(S||w)return;if(!I&&U()){w=!1,j=!0,L(),W("failed",R);return}if(p+=1,!I&&p>5){p=5,j=!0,W("failed",R);return}w=!0,j=!1,W("reconnecting",R),L();const H=I?Math.min(p,5):p,X=Math.min(1e4,1200*2**Math.max(0,H-1));v=globalThis.setTimeout(()=>{w=!1,G()},X)},G=()=>{if(S||E(m))return;L(),w=!1,j=!1;const R=new WebSocket(this.wsBaseUrl);m=R,R.addEventListener("open",()=>{S||m!==R||(w=!1,N=!1,p=0,W("connected"),ee(y))}),R.addEventListener("message",H=>{if(m!==R)return;const X=bN.safeParse(JSON.parse(H.data));X.success&&t(X.data)}),R.addEventListener("error",()=>{if(S||m!==R)return;const H=`无法连接到 ${this.wsBaseUrl}`;R.readyState!==WebSocket.OPEN&&F(H)}),R.addEventListener("close",H=>{var oe;if(m===R&&(m=null),S||m!==null)return;const X=((oe=H.reason)==null?void 0:oe.trim())||`WebSocket 已断开(code ${H.code||"unknown"})`;F(X)})},Q=R=>{if(S||E(m)||N)return;const H=Date.now();H-T<1500||(T=H,N=!0,p=0,w=!1,j=!1,L(),W("reconnecting",R),G())},Y=()=>{document.visibilityState==="visible"&&(j||!E(m))&&Q("应用回到前台,正在恢复连接")},pe=()=>{(j||!E(m))&&Q("页面恢复显示,正在恢复连接")},ne=()=>{(j||!E(m))&&Q("窗口重新聚焦,正在恢复连接")},V=()=>{(j||!E(m))&&Q("网络已恢复,正在重新连接")};return typeof window<"u"&&(window.addEventListener("pageshow",pe),window.addEventListener("focus",ne),window.addEventListener("online",V)),typeof document<"u"&&document.addEventListener("visibilitychange",Y),G(),{setSessionId:R=>{y=(R==null?void 0:R.trim())??"",!S&&ee(y)},close:()=>{S=!0,w=!1,N=!1,j=!1,L(),typeof window<"u"&&(window.removeEventListener("pageshow",pe),window.removeEventListener("focus",ne),window.removeEventListener("online",V)),typeof document<"u"&&document.removeEventListener("visibilitychange",Y);const R=m;if((R==null?void 0:R.readyState)===WebSocket.OPEN&&g&&R.send(JSON.stringify({type:"session.unsubscribe",sessionId:g})),g="",m=null,(R==null?void 0:R.readyState)===WebSocket.CONNECTING){const H=()=>{try{R.close()}catch{}};R.addEventListener("open",H,{once:!0});return}R==null||R.close()}}}connectEvents(t,a){const l=this.createEventStream(t,a);return()=>{l.close()}}}const E6=(e,t)=>new BN(e,(t==null?void 0:t.wsBaseUrl)??k6(e)),C6=e=>{const t=(e==null?void 0:e.trim())??"";if(!t)return null;try{const a=new URL(t);return a.port?`${a.hostname}:${a.port}`:a.hostname}catch{return t.replace(/\/+$/,"")||null}},ac=e=>{var t;return((t=e.display_name)==null?void 0:t.trim())||e.name.trim()||C6(e.direct_base_url)||"未命名节点"},HN=e=>{var a;const t=((a=e.display_name)==null?void 0:a.trim())??"";return!t||t===e.name?null:e.name},dg=e=>C6(e.direct_base_url)||e.host||e.tailscale_ip||e.tailscale_dns_name||e.direct_base_url,Jm="panda:last-agent-id",ep="panda:last-session-id",Nf="panda:pending-session-id",kf="panda:pending-project-id",Ef="panda:pending-directory-picker",Ou="panda:pending-session-handoff",Cf="panda:selected-agent-connection-hint",$N=3e4,FN=1800*1e3,af=e=>typeof e=="object"&&e!==null,qN=e=>{if(!af(e))return null;const{sessionId:t,agentId:a,projectId:l,createdAt:o,session:u,project:f,optimisticEntry:m}=e;return typeof t!="string"||typeof a!="string"||typeof l!="string"||typeof o!="string"||!af(u)||u.id!==t||u.agent_id!==a||u.project_id!==l||f!==null&&(!af(f)||f.id!==l||f.agent_id!==a||typeof f.name!="string"||typeof f.path!="string")||m!==null&&(!af(m)||typeof m.id!="string"||typeof m.kind!="string"||typeof m.body!="string"||typeof m.timestamp!="string")?null:{sessionId:t,agentId:a,projectId:l,createdAt:o,session:u,project:f??null,optimisticEntry:m??null}},WN=e=>{const t=new Date(e.createdAt).getTime();return Number.isFinite(t)?Date.now()-t>$N:!0},KN=e=>{if(!af(e))return null;const{agentId:t,name:a,displayName:l,directBaseUrl:o,wsBaseUrl:u,createdAt:f}=e;return typeof t!="string"||typeof a!="string"||l!==null&&typeof l!="string"||typeof o!="string"||typeof u!="string"||typeof f!="string"?null:{agentId:t,name:a,displayName:l,directBaseUrl:o,wsBaseUrl:u,createdAt:f}},QN=e=>{const t=new Date(e.createdAt).getTime();return Number.isFinite(t)?Date.now()-t>FN:!0},GN=e=>{if(!(typeof window>"u"))try{if(!e){window.sessionStorage.removeItem(Ou);return}window.sessionStorage.setItem(Ou,JSON.stringify(e))}catch{}},o_=e=>{if(typeof window>"u")return null;try{const t=window.sessionStorage.getItem(Ou);if(!t)return null;const a=qN(JSON.parse(t));return!a||WN(a)?(window.sessionStorage.removeItem(Ou),null):e&&a.sessionId!==e?null:a}catch{return null}},YN=e=>{if(!(typeof window>"u"))try{const t=o_();if(e&&(t!=null&&t.sessionId)&&t.sessionId!==e)return;window.sessionStorage.removeItem(Ou)}catch{}},VN=e=>{if(!(typeof window>"u"))try{if(!e){window.sessionStorage.removeItem(Cf);return}window.sessionStorage.setItem(Cf,JSON.stringify(e))}catch{}},Bf=e=>{if(typeof window>"u")return null;try{const t=window.sessionStorage.getItem(Cf);if(!t)return null;const a=KN(JSON.parse(t));return!a||QN(a)?(window.sessionStorage.removeItem(Cf),null):e&&a.agentId!==e?null:a}catch{return null}},cc=()=>{if(typeof window>"u")return null;try{return window.localStorage.getItem(Jm)}catch{return null}},Zi=e=>{if(!(typeof window>"u"))try{if(e){window.localStorage.setItem(Jm,e);return}window.localStorage.removeItem(Jm)}catch{}},tp=()=>{if(typeof window>"u")return null;try{return window.localStorage.getItem(ep)}catch{return null}},na=e=>{if(!(typeof window>"u"))try{if(e){window.localStorage.setItem(ep,e);return}window.localStorage.removeItem(ep)}catch{}},Wr=e=>{if(!(typeof window>"u"))try{if(e){window.sessionStorage.setItem(Nf,e);return}window.sessionStorage.removeItem(Nf)}catch{}},ZN=()=>{if(typeof window>"u")return null;try{const e=window.sessionStorage.getItem(Nf);return e&&window.sessionStorage.removeItem(Nf),e}catch{return null}},uu=e=>{if(!(typeof window>"u"))try{if(e){window.sessionStorage.setItem(kf,e);return}window.sessionStorage.removeItem(kf)}catch{}},XN=()=>{if(typeof window>"u")return null;try{const e=window.sessionStorage.getItem(kf);return e&&window.sessionStorage.removeItem(kf),e}catch{return null}},rf=e=>{if(!(typeof window>"u"))try{if(e){window.sessionStorage.setItem(Ef,"1");return}window.sessionStorage.removeItem(Ef)}catch{}},JN=()=>{if(typeof window>"u")return!1;try{const e=window.sessionStorage.getItem(Ef);return e&&window.sessionStorage.removeItem(Ef),e==="1"}catch{return!1}},T6=()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem(Jm),window.localStorage.removeItem(ep),window.sessionStorage.removeItem(Nf),window.sessionStorage.removeItem(kf),window.sessionStorage.removeItem(Ef),window.sessionStorage.removeItem(Ou),window.sessionStorage.removeItem(Cf)}catch{}},np=lc("Preferences",{web:()=>ao(()=>import("./web-CUbAH58p.js"),[]).then(e=>new e.PreferencesWeb)}),ek=new Set(["4173","4174"]),tk="PandaMobile",M6="hub_url",R6="onboarding_completed",d0=new Set;let Vi={platform:Cu(),hubUrl:"",onboardingCompleted:!1};const A6=()=>{for(const e of d0)e()},nk=e=>(d0.add(e),()=>{d0.delete(e)}),ic=e=>{const t=(e==null?void 0:e.trim())??"";if(!t)return"";try{return new URL(t).toString().replace(/\/+$/,"")}catch{return t.replace(/\/+$/,"")}},sk=()=>typeof window>"u"?null:window.location.origin||null,D6=e=>{if(typeof window>"u")return`http://localhost:${e}`;const t=window.location.protocol==="https:"?"https:":"http:",a=window.location.hostname||"localhost";return`${t}//${a}:${e}`},ak=()=>ic(D6(4242)),ik=()=>{const e=ic(void 0);if(e)return e;const t=sk();if(!t)return"http://localhost:4343";const a=window.location.port.trim();return ek.has(a)?D6(4343):ic(t)},rk=()=>ic(void 0),lk=()=>!1,ok=()=>{const e=Cu();if(e==="web")return{platform:e,hubUrl:ik(),onboardingCompleted:!0};const t=rk();return{platform:e,hubUrl:t,onboardingCompleted:!!t}},I4=async e=>{if(Pa()){const{value:t}=await np.get({key:e});return t}if(typeof window>"u")return null;try{return window.localStorage.getItem(`panda:runtime:${e}`)}catch{return null}},L4=async(e,t)=>{if(Pa()){if(t===null){await np.remove({key:e});return}await np.set({key:e,value:t});return}if(!(typeof window>"u"))try{if(t===null){window.localStorage.removeItem(`panda:runtime:${e}`);return}window.localStorage.setItem(`panda:runtime:${e}`,t)}catch{}},ck=async()=>{const e=ok();Pa()&&await np.configure({group:tk});const[t,a]=await Promise.all([I4(M6),I4(R6)]),l=e.platform==="web"?e.hubUrl:ic(t)||e.hubUrl,o=e.platform==="web"?!0:a==="true"||!!(l&&e.onboardingCompleted);return Vi={platform:e.platform,hubUrl:l,onboardingCompleted:o},A6(),Vi},f0=()=>Vi,uk=()=>ic(Vi.hubUrl),dk=()=>{const e=f0();return e.platform==="web"?lk():!e.hubUrl||!e.onboardingCompleted},O6=async e=>{const t=e.hubUrl===void 0?Vi.hubUrl:ic(e.hubUrl),a=e.onboardingCompleted??Vi.onboardingCompleted;return Vi={...Vi,hubUrl:t,onboardingCompleted:a},Vi.platform!=="web"&&await Promise.all([L4(M6,t||null),L4(R6,a?"true":"false")]),A6(),Vi},yp=()=>_.useSyncExternalStore(nk,f0,f0),fk=new Set(["localhost","127.0.0.1","::1"]),I6=()=>ak(),Fu=()=>uk(),P4=new Map,hk={direct:"Agent 直连",hub:"Hub 聚合"},mk=1e4,pk=1e4,L6=1e4,gk=1e4,U4=1200,z4=5e3;let km=null,h0=0,iu=null,du=null,sp=0,ru=null,Em=null,m0=0,lu=null;const p0=new Map,Cm=new Map,Tm=new Map,si=e=>(e==null?void 0:e.trim())??"",P6=e=>{const t=(e==null?void 0:e.trim())??"";return t?t.replace(/^\[|\]$/g,"").replace(/\.+$/,"").toLowerCase():""},U6=e=>fk.has(P6(e)),Iu=e=>{const t=(e==null?void 0:e.trim())??"";if(!t)return"";try{const a=new URL(t),l=P6(a.hostname);return l&&(a.hostname=l),a.toString().replace(/\/+$/,"")}catch{return t}},Lu=()=>typeof window>"u"||Pa()?!1:U6(window.location.hostname),_k=e=>{const t=e.trim();if(!t)return U4;try{const a=new URL(t);return U6(a.hostname)?U4:z4}catch{return z4}},Pu=async e=>{const t=e.trim();if(!t)return!1;const a=Tm.get(t),l=Date.now();if(a&&l-a.checkedAt<gk)return a.reachable;const o=new AbortController,u=globalThis.setTimeout(()=>o.abort(),_k(t));try{const m=(await fetch(`${t}/health`,{signal:o.signal})).ok;return Tm.set(t,{reachable:m,checkedAt:Date.now()}),m}catch{return Tm.set(t,{reachable:!1,checkedAt:Date.now()}),!1}finally{clearTimeout(u)}},qu=(e,t)=>{const a=`${e}::${(t==null?void 0:t.trim())??""}`,l=P4.get(a);if(l)return l;const o=E6(e,{wsBaseUrl:t});return P4.set(a,o),o},B4=()=>qu(z6()),H4=e=>{const t=e(du);du=t,sp=t?Date.now():0},c_=(e,t,a)=>({mode:"direct",label:e,baseUrl:t,client:qu(t,a)}),z6=()=>{const e=Fu();if(!e)throw new Error("尚未配置 Panda Hub 地址,请先完成应用连接设置。");return e},pf=e=>{const t=e==="hub"?z6():I6();return{mode:e,label:hk[e],baseUrl:t,client:qu(t)}},B6=e=>Iu(e.direct_base_url),yk=e=>Iu(e.ws_base_url),$4=e=>{const t=B6(e)||e.tailscale_dns_name||e.tailscale_ip||e.host;return`无法直连节点 ${ac(e)}(${t})。请确认当前浏览器已加入 Tailscale 网络,且目标 agent 在线。`},vk=async()=>{if(!Lu())return null;const e=Date.now();if(Em&&e-m0<L6)return Em;if(lu)return lu;lu=(async()=>{const t=I6();if(!await Pu(t))return null;const a=await qu(t).getPhaseOneSnapshot({fallbackToMock:!1});return Em=a,m0=Date.now(),a})().catch(()=>null);try{return await lu}finally{lu=null}},H6=async e=>{var l,o;const t=await vk(),a=((o=(l=t==null?void 0:t.agents[0])==null?void 0:l.id)==null?void 0:o.trim())??"";return!!(a&&a===e.trim())},$6=async e=>{if(await H6(e.id))return{...pf("direct"),label:`Agent 直连 · ${ac(e)}(本机)`};const t=B6(e),a=yk(e);return c_(`Agent 直连 · ${ac(e)}`,t,a||void 0)},bk=async e=>{if(await H6(e.agent_id))return{...pf("direct"),label:`Agent 直连 · ${e.agent_id}(本机)`};const t=Iu(e.direct_base_url),a=Iu(e.ws_base_url);return c_(`Agent 直连 · ${e.agent_id}`,t,a||void 0)},F6=e=>{var l;const t=si(e.agentId);if(!t)return null;const a=Bf(t);return a!=null&&a.directBaseUrl.trim()?c_(`Agent 直连 · ${((l=a.displayName)==null?void 0:l.trim())||a.name.trim()||t}`,Iu(a.directBaseUrl),Iu(a.wsBaseUrl)||void 0):null},F4=async e=>{const t=F6(e);if(t!=null&&t.baseUrl&&(await Pu(t.baseUrl)||!Lu()))return t;const a=await W6(),l=a?q6(a,e):null;if(!l)return null;const o=await $6(l);return o.baseUrl&&(await Pu(o.baseUrl)||!Lu())?o:null},q6=(e,t)=>{const a=si(t.agentId);return a?e.agents.find(l=>l.id===a)??null:null},xk=e=>{const t=si(e.sessionId),a=si(e.projectId),l=si(e.agentId);return l?`agent:${l}`:a?`project:${a}`:t?`session:${t}`:""},W6=async()=>{const e=Date.now();if(du&&e-sp<L6)return du;if(ru)return ru;ru=(async()=>{const t=Fu();if(!t)return null;const a=await qu(t).getHubDirectory();return du=a,sp=Date.now(),a})().catch(()=>null);try{return await ru}finally{ru=null}},Sk=async()=>{if(!Lu())return pf("hub");const e=Date.now();if(km&&e-h0<mk)return km;if(iu)return iu;iu=(async()=>{const t=Fu(),a=t&&await Pu(t)?pf("hub"):pf("direct");return km=a,h0=Date.now(),a})();try{return await iu}finally{iu=null}},jk=async e=>{const t=xk(e),a=Date.now(),l=t?p0.get(t):null;if(l&&a-l.cachedAt<pk)return l.target;const o=t?Cm.get(t):null;if(o)return o;const u=(async()=>{const f=si(e.sessionId),m=si(e.agentId),y=F6(e),g=Fu();if(!g&&!y&&!m)throw new Error("尚未配置 Panda Hub 地址,请先完成应用连接设置。");const S=g?qu(g):null;if(m){const N=await F4(e);if(N)return N}if(f){const N=S?await S.getSessionLocation(f).catch(()=>null):null;if(!N){const T=m?await F4(e):null;if(T)return T;throw new Error("Hub 未返回目标会话位置,无法建立直连。")}const j=await bk(N);if(!j.baseUrl)throw new Error(`无法直连节点 ${N.agent_id}(${N.direct_base_url||N.ws_base_url||"unknown"})。请确认当前浏览器已加入 Tailscale 网络,且目标 agent 在线。`);if(await Pu(j.baseUrl)||!Lu())return j;throw new Error(`无法直连节点 ${N.agent_id}(${N.direct_base_url||N.ws_base_url||"unknown"})。请确认当前浏览器已加入 Tailscale 网络,且目标 agent 在线。`)}if(si(e.projectId)&&!si(e.agentId))throw new Error("Project-scoped connection resolution now requires agentId.");const p=await W6(),v=p?q6(p,e):null;if(!v)throw new Error("Hub 未返回目标节点信息,无法建立直连。");const w=await $6(v);if(!w.baseUrl)throw new Error($4(v));if(await Pu(w.baseUrl)||!Lu())return w;throw new Error($4(v))})();t&&Cm.set(t,u);try{const f=await u;return t&&p0.set(t,{target:f,cachedAt:Date.now()}),f}finally{t&&Cm.delete(t)}},xn=async e=>!(si(e==null?void 0:e.sessionId)||si(e==null?void 0:e.projectId)||si(e==null?void 0:e.agentId))?Sk():jk(e??{}),wk=()=>{km=null,h0=0,iu=null,du=null,sp=0,ru=null,Em=null,m0=0,lu=null,p0.clear(),Cm.clear(),Tm.clear()},K6=1,Nk=10080*60*1e3,Q6="panda-web-cache",Uu="app-state",G6="react-query",q4="panda:storage-persist-result",kk=new Set(["directory","bootstrap","timeline","timeline-optimistic","change-sets","plan","interactions","codex-commands","project-skills","settings-connection"]),u_=()=>typeof window<"u"&&typeof window.indexedDB<"u",Ek=e=>typeof e[0]=="string"&&kk.has(e[0]),Y6=async()=>u_()?await new Promise((e,t)=>{const a=window.indexedDB.open(Q6,1);a.onupgradeneeded=()=>{const l=a.result;l.objectStoreNames.contains(Uu)||l.createObjectStore(Uu)},a.onsuccess=()=>e(a.result),a.onerror=()=>t(a.error??new Error("Unable to open Panda cache database."))}):null,Ck=async()=>{const e=await Y6();if(!e)return null;try{return await new Promise((t,a)=>{const u=e.transaction(Uu,"readonly").objectStore(Uu).get(G6);u.onsuccess=()=>t(u.result??null),u.onerror=()=>a(u.error??new Error("Unable to read Panda cache record."))})}finally{e.close()}},Tk=async e=>{const t=await Y6();if(t)try{await new Promise((a,l)=>{const o=t.transaction(Uu,"readwrite");o.objectStore(Uu).put(e,G6),o.oncomplete=()=>a(),o.onerror=()=>l(o.error??new Error("Unable to write Panda cache record.")),o.onabort=()=>l(o.error??new Error("Writing Panda cache record was aborted."))})}finally{t.close()}},ap=async()=>{u_()&&await new Promise(e=>{const t=window.indexedDB.deleteDatabase(Q6);t.onsuccess=()=>e(),t.onerror=()=>e(),t.onblocked=()=>e()})},Mk=async e=>{if(u_())try{const t=await Ck();if(!t)return;const a=Date.now()-t.persistedAt>Nk;if(t.version!==K6||a){await ap();return}_9(e,t.clientState)}catch{await ap().catch(()=>{})}},Rk=async()=>{if(!(typeof navigator>"u"||typeof window>"u"||!("storage"in navigator)||typeof navigator.storage.persist!="function"))try{if(window.localStorage.getItem(q4))return;const t=await navigator.storage.persist();window.localStorage.setItem(q4,t?"granted":"denied")}catch{}},Ak=e=>{if(typeof window>"u")return()=>{};Rk();let t=null,a=null,l=!1,o=!1;const u=async()=>{if(!o){if(a){l=!0;return}a=(async()=>{const S=g9(e,{shouldDehydrateQuery:p=>Ek(p.queryKey)});await Tk({version:K6,persistedAt:Date.now(),clientState:S})})();try{await a}catch{}finally{a=null,l&&(l=!1,u())}}},f=(S=!1)=>{if(!o){if(t!==null&&(window.clearTimeout(t),t=null),S){u();return}t=window.setTimeout(()=>{t=null,u()},1200)}},m=e.getQueryCache().subscribe(()=>{f(!1)}),y=()=>{document.visibilityState==="hidden"&&f(!0)},g=()=>{f(!0)};return document.addEventListener("visibilitychange",y),window.addEventListener("pagehide",g),()=>{o=!0,m(),document.removeEventListener("visibilitychange",y),window.removeEventListener("pagehide",g),t!==null&&(window.clearTimeout(t),t=null)}},V6=async e=>{wk(),T6(),await ap().catch(()=>{}),e.removeQueries({predicate:t=>typeof t.queryKey[0]=="string"&&t.queryKey[0]!=="pwa-install-diagnostics"})},Dk=()=>{const e=Ei(),t=La(),a=yp();return i.jsx("main",{className:"runtime-onboarding",children:i.jsxs("div",{className:"runtime-onboarding__shell",children:[i.jsxs("section",{className:"runtime-onboarding__hero",children:[i.jsx("span",{className:"runtime-onboarding__eyebrow",children:"首次连接"}),i.jsx("h1",{className:"runtime-onboarding__title",children:"输入 Panda 访问地址"}),i.jsx("p",{className:"runtime-onboarding__summary",children:"填一次,之后打开就能直接进入。也支持扫码。"})]}),i.jsx("section",{className:"settings-panel runtime-onboarding__panel",children:i.jsx(t6,{title:"Hub 地址",description:"填写电脑上显示的访问地址。",initialHubUrl:a.hubUrl,hint:"手机能直接打开这个地址就可以。",saveLabel:"保存并进入",savingLabel:"连接中",saveDescription:"保存后立即进入,之后也能在设置里修改。",saveSuccessMessage:"地址已保存,正在进入 Panda。",onSaveSuccess:async l=>{await O6({hubUrl:l.url,onboardingCompleted:!0}),await V6(t),await e({to:"/nodes",replace:!0})}})})]})})},Ki=["directory","hub"],Ok=["directory","hub","recent-sessions"],rs=["directory","workspace"],Ik=["bootstrap","hub"],Lk=rs,W4=e=>{if(e==null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},Pk=(e,t)=>{if(e.length!==t.length)return!1;for(let a=0;a<e.length;a+=1)if(!d_(e[a],t[a]))return!1;return!0},d_=(e,t)=>{if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return Pk(e,t);if(W4(e)&&W4(t)){const a=Object.keys(e),l=Object.keys(t);if(a.length!==l.length)return!1;for(const o of a)if(!(o in t)||!d_(e[o],t[o]))return!1;return!0}return!1},gf=(e,t)=>e!==void 0&&d_(e,t)?e:t,Mm=(e,t,a)=>{if(!e||e.length===0)return t;const l=new Map(e.map(u=>[a(u),u])),o=t.map(u=>gf(l.get(a(u)),u));return e.length===o.length&&e.every((u,f)=>u===o[f])?e:o},K4=(e,t,a,l=new Date().toISOString())=>{if(!e)return e;let o=!1;const u=e.agents.map(f=>{if(f.id!==t||!Object.entries(a).some(([g,S])=>f[g]!==S))return f;const y={...f,...a};return o=!0,y});return o?{...e,generated_at:l,agents:u}:e},Z6=(e,t)=>{if(!e)return t;const a=Mm(e.agents,t.agents,o=>o.id),l=gf(e.generated_at,t.generated_at);return e.agents===a&&e.generated_at===l?e:{...t,generated_at:l,agents:a}},Uk=180,zk=()=>{const e=La(),{hubUrl:t}=yp(),a=_.useRef(null),l=cc(),o=Bf(l),u=!!(l&&o);return _.useEffect(()=>{if(!t||u)return;let f=!1,m,y=!1,g=!1,S=!1;const p=()=>{a.current!==null&&(window.clearTimeout(a.current),a.current=null)},v=(T,A)=>{const U=new Date().toISOString();e.setQueryData(Ki,I=>K4(I,T,{status:A},U)??I),H4(I=>K4(I,T,{status:A},U)??I)},w=async()=>{try{const T=await B4().getHubDirectory();if(f)return;H4(()=>T),e.setQueryData(Ki,A=>Z6(A,T))}catch{}},N=()=>{p(),a.current=window.setTimeout(()=>{a.current=null,w()},Uk)},j=T=>{var A,U;if(T.type==="agent.online"){if(S){S=!1;return}const I=typeof((A=T.payload)==null?void 0:A.agentId)=="string"?T.payload.agentId.trim():"";if(!I)return;v(I,"online"),N();return}if(T.type==="agent.offline"){const I=typeof((U=T.payload)==null?void 0:U.agentId)=="string"?T.payload.agentId.trim():"";if(!I)return;v(I,"offline"),N();return}T.type==="snapshot.changed"&&N()};w();try{m=B4().connectEvents(j,{reconnectWhenHidden:!0,onStatus:T=>{if(T.state==="connected"){S=!0,y&&g&&(g=!1,N()),y=!0;return}y&&(g=!0)}})}catch{}return()=>{f=!0,p(),m==null||m()}},[t,e,u]),null},Hf=e=>[...e].sort((t,a)=>{const l=Number(a.pinned)-Number(t.pinned);return l!==0?l:+new Date(a.last_event_at)-+new Date(t.last_event_at)}),ro=e=>{if(!e)return e;const t=new Map(e.project_stats.map(a=>[a.project_id,a]));return{...e,project_stats:e.projects.map(a=>{const l=e.sessions.filter(u=>u.project_id===a.id),o=t.get(a.id);return{project_id:a.id,visible_session_count:l.filter(u=>!u.archived).length,archived_session_count:(o==null?void 0:o.archived_session_count)??0,hidden_history_count:(o==null?void 0:o.hidden_history_count)??0}})}},Bk=e=>({id:e.id,agent_id:e.agent_id,project_id:e.project_id,archived:e.archived,title:e.title,last_event_at:e.last_event_at,pinned:e.pinned,run_state:e.run_state,run_state_changed_at:e.run_state_changed_at,subagent:e.subagent}),Hk=e=>({id:e.id,agent_id:e.agent_id,name:e.name,display_name:e.display_name,pinned:e.pinned,path:e.path}),g0=e=>{if(!e)return null;const t={};return typeof e.title=="string"&&(t.title=e.title),typeof e.archived=="boolean"&&(t.archived=e.archived),typeof e.pinned=="boolean"&&(t.pinned=e.pinned),typeof e.last_event_at=="string"&&(t.last_event_at=e.last_event_at),(e.run_state==="idle"||e.run_state==="running"||e.run_state==="completed")&&(t.run_state=e.run_state),(e.run_state_changed_at===null||typeof e.run_state_changed_at=="string")&&(t.run_state_changed_at=e.run_state_changed_at),(e.subagent===null||typeof e.subagent=="object"&&e.subagent!==null)&&(t.subagent=e.subagent),Object.keys(t).length>0?t:null},ip=(e,t)=>!!(e!=null&&e.sessions.some(a=>a.id===t)),rp=(e,t,a)=>!e||!ip(e,t)?e:ro({...e,sessions:Hf(e.sessions.map(l=>l.id===t?{...l,...a}:l))}),_0=(e,t,a)=>{if(!e)return e;const l=e.sessions.find(f=>f.id===t);if(!l)return e;const o=new Date(a).getTime(),u=new Date(l.last_event_at).getTime();return!Number.isFinite(o)||Number.isFinite(u)&&o<=u?e:rp(e,t,{last_event_at:a})},lf=(e,t,a)=>{if(!e)return e;const{last_event_at:l,...o}=a;let u=rp(e,t,o);return typeof l=="string"&&l.trim()&&(u=_0(u,t,l)),u},X6=(e,t,a)=>{if(!e||t.length===0)return e;const l=new Set(t);return ro({...e,sessions:Hf(e.sessions.map(o=>l.has(o.id)?{...o,...a}:o))})},J6=(e,t)=>{var u;if(!e||t.length===0)return e;const a=new Set(t),l=e.sessions.filter(f=>!a.has(f.id)),o=a.has(e.active_session_id)?((u=l[0])==null?void 0:u.id)??"":e.active_session_id;return ro({...e,active_session_id:o,sessions:Hf(l)})},fu=(e,t,a)=>!e||!e.projects.some(l=>l.id===t)?e:ro({...e,projects:e.projects.map(l=>l.id===t?{...l,...a}:l)}),lp=(e,t)=>{if(!e||t.length===0||e.projects.length<=1)return e;const a=new Map(e.projects.map(u=>[u.id,u])),l=new Set,o=[];for(const u of t){const f=a.get(u);!f||l.has(u)||(l.add(u),o.push(f))}for(const u of e.projects)l.has(u.id)||o.push(u);return o.every((u,f)=>{var m;return u.id===((m=e.projects[f])==null?void 0:m.id)})?e:ro({...e,projects:o})},op=(e,t)=>{var o;if(!e)return e;const a=e.sessions.filter(u=>u.project_id!==t),l=a.some(u=>u.id===e.active_session_id)?e.active_session_id:((o=a[0])==null?void 0:o.id)??"";return ro({...e,active_session_id:l,projects:e.projects.filter(u=>u.id!==t),sessions:Hf(a)})},e3=(e,t)=>{if(!e)return e;const a=Bk(t),l=[a,...e.sessions.filter(o=>o.id!==a.id)];return ro({...e,generated_at:new Date().toISOString(),active_session_id:a.id,sessions:Hf(l)})},$k=(e,t)=>{if(!e)return e;const a=Hk(t),l=[a,...e.projects.filter(o=>o.id!==a.id)];return ro({...e,generated_at:new Date().toISOString(),projects:l})},Fk=(e,t)=>{if(!e)return t;const a=t.agent?gf(e.agent??void 0,t.agent):e.agent===null?e.agent:null,l=Mm(e.projects,t.projects,y=>y.id),o=Mm(e.project_stats,t.project_stats,y=>y.project_id),u=Mm(e.sessions,t.sessions,y=>y.id),f=gf(e.generated_at,t.generated_at),m=gf(e.active_session_id,t.active_session_id);return e.agent===a&&e.projects===l&&e.project_stats===o&&e.sessions===u&&e.generated_at===f&&e.active_session_id===m?e:{...t,generated_at:f,agent:a,projects:l,project_stats:o,sessions:u,active_session_id:m}},qk=async()=>{const e=await xn();if(e.mode==="direct"){const t=await e.client.getPhaseOneSnapshot({fallbackToMock:!1});return{generated_at:t.generated_at,agents:t.agents}}return e.client.getHubDirectory()},Wk=async()=>{const e=await xn();if(e.mode==="direct"){const t=await e.client.getPhaseOneSnapshot({fallbackToMock:!1});return{generated_at:t.generated_at,recent_sessions:[...t.sessions].sort((a,l)=>+new Date(l.last_event_at)-+new Date(a.last_event_at)).slice(0,24).map(a=>({id:a.id,title:a.title,run_state:a.run_state,run_state_changed_at:a.run_state_changed_at,latest_assistant_message:a.latest_assistant_message}))}}return e.client.getHubRecentSessions()},Kk=async e=>(await xn(e==null?void 0:e.scope)).client.getWorkspaceDirectory({selectedSessionId:(e==null?void 0:e.selectedSessionId)??null}),Qk=(e,t)=>Z6(e,t),Gk=(e,t)=>Fk(e,t),y0=e=>{var t,a,l;return[...rs,((t=e==null?void 0:e.scope)==null?void 0:t.agentId)??"",(a=e==null?void 0:e.scope)!=null&&a.agentId?"":((l=e==null?void 0:e.scope)==null?void 0:l.sessionId)??""]},t3=e=>({queryKey:Ki,enabled:(e==null?void 0:e.enabled)??!0,queryFn:qk,structuralSharing:Qk,staleTime:3e4,refetchInterval:3e5,refetchOnMount:!1,refetchOnWindowFocus:!1,retry:1}),Yk=()=>({queryKey:Ok,queryFn:Wk,staleTime:3e4,refetchInterval:!1,refetchOnMount:!1,refetchOnWindowFocus:!1,retry:1}),n3=e=>({queryKey:y0(e),enabled:(e==null?void 0:e.enabled)??!0,queryFn:()=>Kk(e),placeholderData:i9,structuralSharing:Gk,staleTime:1e4,refetchInterval:!1,refetchOnMount:!1,refetchOnWindowFocus:!1,retry:1}),s3=async e=>e.fetchQuery(t3()),Vk=async e=>e.fetchQuery(Yk()),of=async(e,t)=>e.fetchQuery(n3(t));var Q4;(function(e){e[e.Sunday=1]="Sunday",e[e.Monday=2]="Monday",e[e.Tuesday=3]="Tuesday",e[e.Wednesday=4]="Wednesday",e[e.Thursday=5]="Thursday",e[e.Friday=6]="Friday",e[e.Saturday=7]="Saturday"})(Q4||(Q4={}));const $f=lc("LocalNotifications",{web:()=>ao(()=>import("./web-Bj1-jnZe.js"),[]).then(e=>new e.LocalNotificationsWeb)}),a3="panda:notification-settings",i3="panda:notified-completions",f_="panda:web-push-subscription-state",Zk=280,r3="session-completions",fg={completionNotificationsEnabled:!1};let Tf=Pa()?"default":"unsupported";const Ff=()=>{const e=Fu();if(!e)throw new Error("尚未配置 Panda Hub 地址。");return E6(e)},l3=e=>({completionNotificationsEnabled:(e==null?void 0:e.completionNotificationsEnabled)===!0}),Xk=(e,t)=>e.length<=t?e:`${e.slice(0,t-1).trimEnd()}…`,o3=()=>{if(typeof window>"u")return{};try{const e=window.localStorage.getItem(i3);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"?{}:Object.fromEntries(Object.entries(t).filter(a=>typeof a[0]=="string"&&typeof a[1]=="string"))}catch{return{}}},Jk=e=>{if(!(typeof window>"u"))try{window.localStorage.setItem(i3,JSON.stringify(e))}catch{}},eE=e=>{if(!e||typeof e!="object")return null;const t=typeof e.endpoint=="string"?e.endpoint.trim():"",a=typeof e.updatedAt=="string"?e.updatedAt.trim():"";return!t||!a?null:{completionNotificationsEnabled:e.completionNotificationsEnabled===!0,endpoint:t,updatedAt:a}},c3=()=>{if(typeof window>"u")return null;try{return eE(JSON.parse(window.localStorage.getItem(f_)??"null"))}catch{return null}},u3=e=>{if(!(typeof window>"u"))try{window.localStorage.setItem(f_,JSON.stringify(e))}catch{}},cp=()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem(f_)}catch{}},d3=async()=>{if(typeof navigator>"u"||!("serviceWorker"in navigator))throw new Error("当前环境没有可用的 Service Worker。");return navigator.serviceWorker.ready},tE=e=>{const t="=".repeat((4-e.length%4)%4),a=(e+t).replace(/-/g,"+").replace(/_/g,"/"),l=window.atob(a),o=new Uint8Array(l.length);for(let u=0;u<l.length;u+=1)o[u]=l.charCodeAt(u);return o},h_=async()=>{const e=await d3();return"pushManager"in e?e.pushManager.getSubscription():null},f3=e=>{var u,f;const t=e.toJSON(),a=e.endpoint.trim(),l=typeof((u=t.keys)==null?void 0:u.p256dh)=="string"?t.keys.p256dh.trim():"",o=typeof((f=t.keys)==null?void 0:f.auth)=="string"?t.keys.auth.trim():"";if(!a||!l||!o)throw new Error("浏览器返回的推送订阅信息不完整。");return{endpoint:a,expirationTime:typeof e.expirationTime=="number"?e.expirationTime:null,keys:{p256dh:l,auth:o}}},h3=async()=>{try{return await Ff().getWebPushPublicConfig()}catch(e){throw new Error(e instanceof Error?e.message:"无法读取 Hub Web Push 配置。")}},v0=()=>{if(typeof window>"u")return fg;try{const e=window.localStorage.getItem(a3);return e?l3(JSON.parse(e)):fg}catch{return fg}},Zd=e=>{if(!(typeof window>"u"))try{window.localStorage.setItem(a3,JSON.stringify(l3(e)))}catch{}},qf=()=>Pa()?!0:typeof window>"u"?!1:window.isSecureContext&&"Notification"in window&&"serviceWorker"in navigator,zu=()=>Pa()||!qf()?!1:"PushManager"in window,hu=()=>Pa()?Tf:qf()?Notification.permission:"unsupported",m3=e=>e==="granted"?"granted":e==="denied"?"denied":e==="prompt"?"default":"unsupported",p3=async()=>{gp()&&await $f.createChannel({id:r3,name:"任务完成提醒",description:"Panda 对话和任务完成提醒",importance:4,visibility:1,vibration:!0,lights:!0}).catch(()=>{})},m_=async()=>{if(Pa()){const e=await $f.checkPermissions();return Tf=m3(e.display),Tf}return qf()?Notification.permission:"unsupported"},nE=async()=>{if(Pa()){await p3();const e=await $f.requestPermissions();return Tf=m3(e.display),Tf}return qf()?Notification.requestPermission():"unsupported"},b0=()=>{var e;return((e=c3())==null?void 0:e.completionNotificationsEnabled)===!0},sE=async e=>{if(!e.completionNotificationsEnabled||hu()!=="granted")return{synced:!1,reason:"notifications-disabled"};if(!zu())return{synced:!1,reason:"unsupported"};const t=await h3();if(!t.supported||!t.vapid_public_key)return cp(),{synced:!1,reason:"hub-unsupported"};const a=await h_();if(!a)return cp(),{synced:!1,reason:"missing-browser-subscription"};const l=await Ff().upsertWebPushSubscription({subscription:f3(a),settings:{completion_notifications_enabled:e.completionNotificationsEnabled},device:{label:cu()?"installed-pwa":"browser-tab",user_agent:typeof navigator<"u"?navigator.userAgent:null}});return u3({completionNotificationsEnabled:l.settings.completion_notifications_enabled,endpoint:l.endpoint,updatedAt:l.updated_at}),{synced:!0,endpoint:l.endpoint}},G4=async e=>{if(!zu())throw new Error("当前环境不支持 Web Push。");const t=await h3();if(!t.supported||!t.vapid_public_key)throw new Error(t.reason??"Hub 当前没有可用的 Web Push 配置。");const a=await d3(),o=await a.pushManager.getSubscription()??null??await a.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:tE(t.vapid_public_key)}),u=await Ff().upsertWebPushSubscription({subscription:f3(o),settings:{completion_notifications_enabled:e.completionNotificationsEnabled},device:{label:cu()?"installed-pwa":"browser-tab",user_agent:typeof navigator<"u"?navigator.userAgent:null}});return u3({completionNotificationsEnabled:u.settings.completion_notifications_enabled,endpoint:u.endpoint,updatedAt:u.updated_at}),u},aE=async()=>{if(!zu())return cp(),{removed:!1};const e=await h_();if(e){try{await Ff().removeWebPushSubscription({endpoint:e.endpoint})}catch{}try{await e.unsubscribe()}catch{}}return cp(),{removed:!!e}},iE=async()=>{var l,o;if(!zu())throw new Error("当前环境不支持 Web Push。");if(hu()!=="granted")throw new Error("请先授予系统通知权限。");const e=await h_(),t=c3(),a=((l=e==null?void 0:e.endpoint)==null?void 0:l.trim())||((o=t==null?void 0:t.endpoint)==null?void 0:o.trim())||"";if(!a)throw new Error("当前设备还没有可用的 Web Push 订阅。");return await Ff().sendWebPushTest({endpoint:a}),{ok:!0,endpoint:a}},cu=()=>{if(typeof window>"u")return!1;const e=navigator;return window.matchMedia("(display-mode: standalone)").matches||e.standalone===!0},Y4=()=>typeof navigator>"u"?!1:/Android/i.test(navigator.userAgent),rE=e=>{if(typeof e!="string")return"";const t=e.replace(/\r\n/g,`
67
+ `).replace(/\s+/g," ").trim();return t?Xk(t,Zk):""},lE=(e,t)=>o3()[e]===t,hg=(e,t)=>{const a=o3();a[e]!==t&&Jk({...a,[e]:t})},g3=async e=>{if(!qf())return!1;if(Pa()){if(await m_()!=="granted")return!1;await p3();try{return await $f.schedule({notifications:[{id:Math.abs(Array.from(`${e.sessionId}:${e.completedAt}`).reduce((a,l)=>a*31+l.charCodeAt(0)|0,17)),title:e.title,body:e.body,channelId:r3,schedule:{at:new Date(Date.now()+250),allowWhileIdle:!0},extra:{url:e.url,sessionId:e.sessionId,completedAt:e.completedAt}}]}),!0}catch{return!1}}if(typeof window>"u")return!1;const t={body:e.body,tag:`session-completed:${e.sessionId}:${e.completedAt}`,icon:"/pwa-512.png",badge:"/pwa-192.png",data:{sessionId:e.sessionId,url:e.url,completedAt:e.completedAt}};try{return await(await navigator.serviceWorker.ready).showNotification(e.title,t),!0}catch{try{const a=new Notification(e.title,t);return a.onclick=()=>{window.focus(),window.location.assign(e.url)},!0}catch{return!1}}},oE=async e=>{if(!Pa())return()=>{};const t=await $f.addListener("localNotificationActionPerformed",a=>{var o;const l=typeof((o=a.notification.extra)==null?void 0:o.url)=="string"?a.notification.extra.url.trim():"";l&&e(l)});return()=>{t.remove()}},cE=1200,uE=e=>typeof document>"u"?!1:document.visibilityState==="visible"&&tp()===e,_3=e=>{var t;return((t=e==null?void 0:e.title)==null?void 0:t.trim())||"当前会话"},dE=e=>e.run_state!=="completed"?null:(typeof e.run_state_changed_at=="string"?e.run_state_changed_at.trim():"")||null,fE=(e,t)=>{if(!e||(typeof e.completionReason=="string"?e.completionReason:"completed")!=="completed")return null;const l=typeof e.sessionId=="string"?e.sessionId.trim():"",o=typeof e.completedAt=="string"?e.completedAt.trim():"";if(!l||!o)return null;const u=(t==null?void 0:t.recent_sessions.find(y=>y.id===l))??null,f=typeof e.sessionTitle=="string"&&e.sessionTitle.trim()||_3(u),m=(typeof e.finalReply=="string"?e.finalReply:"")||(u==null?void 0:u.latest_assistant_message)||"";return{sessionId:l,completedAt:o,sessionTitle:f,finalReply:m}},hE=(e,t)=>{const a=new Map(((e==null?void 0:e.recent_sessions)??[]).map(l=>[l.id,l]));return t.recent_sessions.flatMap(l=>{var m;const o=dE(l);if(!o)return[];const u=((m=l.latest_assistant_message)==null?void 0:m.trim())??"";if(!u)return[];const f=a.get(l.id);return(f==null?void 0:f.run_state)==="completed"&&f.run_state_changed_at===o?[]:[{sessionId:l.id,completedAt:o,sessionTitle:_3(l),finalReply:u}]})},mE=(e,t,a)=>{if(!e||!a)return e;let l=!1;const o=e.recent_sessions.map(u=>{if(u.id!==t)return u;const f=a.run_state==="idle"||a.run_state==="running"||a.run_state==="completed"?a.run_state:null,m={...u,...typeof a.title=="string"?{title:a.title}:null,...f?{run_state:f}:null,...a.run_state_changed_at===null||typeof a.run_state_changed_at=="string"?{run_state_changed_at:a.run_state_changed_at}:null,...a.latest_assistant_message===null||typeof a.latest_assistant_message=="string"?{latest_assistant_message:a.latest_assistant_message}:null};return l=l||m.title!==u.title||m.run_state!==u.run_state||m.run_state_changed_at!==u.run_state_changed_at||m.latest_assistant_message!==u.latest_assistant_message,m});return l?{...e,recent_sessions:o}:e},pE=({})=>{const e=La(),t=_.useRef(void 0),a=_.useRef(new Set),l=_.useRef(null),o=_.useRef(!1),u=cc(),f=Bf(u),m=u&&f?u:null;return _.useEffect(()=>{const y=async I=>{if(!v0().completionNotificationsEnabled||hu()!=="granted")return;if(b0()){hg(I.sessionId,I.completedAt);return}const L=`${I.sessionId}:${I.completedAt}`;if(!a.current.has(L)&&!lE(I.sessionId,I.completedAt)){if(uE(I.sessionId)){hg(I.sessionId,I.completedAt);return}a.current.add(L);try{await g3({sessionId:I.sessionId,completedAt:I.completedAt,title:I.sessionTitle,body:rE(I.finalReply),url:`/session/${I.sessionId}`})&&hg(I.sessionId,I.completedAt)}finally{a.current.delete(L)}}},g=async I=>{for(const E of I)await y(E)};let S=!1,p,v=!1,w=!1,N=!1;const j=async()=>{if(!m)return Vk(e);const E=await(await xn({agentId:m})).client.getPhaseOneSnapshot({fallbackToMock:!1});return{generated_at:E.generated_at,recent_sessions:[...E.sessions].sort((L,W)=>+new Date(W.last_event_at)-+new Date(L.last_event_at)).slice(0,24).map(L=>({id:L.id,title:L.title,run_state:L.run_state,run_state_changed_at:L.run_state_changed_at,latest_assistant_message:L.latest_assistant_message}))}};j().then(I=>{S||(t.current=I)}).catch(()=>{});const T=async()=>{if(!o.current){o.current=!0;try{const I=await j();if(S)return;const E=t.current;if(t.current=I,!E)return;await g(hE(E,I))}catch{}finally{o.current=!1}}},A=()=>{l.current!==null&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,T()},cE)},U=I=>{var E,L;if(I.type==="turn.completed"){const W=fE(I.payload,t.current);W&&y(W);return}if(I.type==="session.updated"){const W=typeof((E=I.payload)==null?void 0:E.sessionId)=="string"?I.payload.sessionId.trim():"",ee=(L=I.payload)!=null&&L.sessionPatch&&typeof I.payload.sessionPatch=="object"?I.payload.sessionPatch:null;W&&ee&&(t.current=mE(t.current,W,ee));return}I.type==="agent.online"&&N&&(N=!1)};return xn(m?{agentId:m}:void 0).then(I=>{S||(p=I.client.connectEvents(U,{reconnectWhenHidden:!0,onStatus:E=>{if(E.state==="connected"){N=!0,v&&w&&(w=!1,A()),v=!0;return}v&&(w=!0)}}))}),()=>{S=!0,l.current!==null&&(clearTimeout(l.current),l.current=null),p==null||p()}},[e,m]),null},p_=e=>e.replace(/[\\/]+$/,""),up=e=>p_(e).replace(/\\/g,"/").toLowerCase(),gE=e=>{const t=p_(e.trim());if(!t)return"新线程";const a=t.split(/[\\/]+/).filter(Boolean),l=a[a.length-1];return l?l.endsWith(":")?t:l:t},y3=e=>{if(!e)return null;const t=e.trim();if(!t||t==="/"||/^[A-Za-z]:[\\/]?$/.test(t))return null;const a=p_(t),l=Math.max(a.lastIndexOf("/"),a.lastIndexOf("\\"));if(l<0)return null;const o=a.slice(0,l);return o?/^[A-Za-z]:$/.test(o)?`${o}\\`:o:a.startsWith("/")?"/":null},v3=async e=>(await xn({agentId:e.agentId})).client.listDirectories(e),_E=async e=>(await xn({agentId:e.agentId})).client.createDirectory(e),yE=async e=>{const t=e.bootstrapQueryKey??["bootstrap"],a=e.projects.find(u=>u.agent_id===e.agentId&&up(u.path)===up(e.path));if(a)return a;const o=await(await xn({agentId:e.agentId})).client.createProject({agentId:e.agentId,name:gE(e.path),path:e.path});return e.queryClient.invalidateQueries({queryKey:t}),o.project},V4=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"M3 7.5A2.5 2.5 0 0 1 5.5 5H10l2 2h6.5A2.5 2.5 0 0 1 21 9.5v8A2.5 2.5 0 0 1 18.5 20h-13A2.5 2.5 0 0 1 3 17.5z"})}),vE=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"m9 6 6 6-6 6"})}),bE=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"m5 12 4.5 4.5L19 7"})}),Z4=e=>!!(e&&/^[A-Za-z]:[\\/]?$/.test(e.trim())),xE=({agentId:e,initialPath:t=null,title:a="选择开发版代码目录",subtitle:l="按需展开目录,只在你进入某一层时加载它的子目录。",confirmLabel:o="使用这个目录",onClose:u,onSelect:f})=>{const[m,y]=_.useState(t),[g,S]=_.useState(t),[p,v]=_.useState([]),[w,N]=_.useState(!0),[j,T]=_.useState(null);_.useEffect(()=>{y(t),S(t)},[t]),_.useEffect(()=>{let L=!1;return N(!0),T(null),v3({agentId:e,path:m}).then(W=>{L||v(W)}).catch(W=>{L||(T(W instanceof Error?W.message:"目录列表加载失败。"),v([]))}).finally(()=>{L||N(!1)}),()=>{L=!0}},[e,m]);const A=y3(m),U=A!==null||Z4(m),I=()=>{if(A!==null){y(A),S(A);return}Z4(m)&&(y(null),S(null))},E=L=>{y(L),S(L)};return i.jsxs("div",{className:"sheet-wrap sheet-wrap--centered",role:"dialog","aria-modal":"true","aria-label":a,children:[i.jsx("button",{type:"button",className:"sheet-wrap__scrim","aria-label":"关闭目录选择",onClick:u}),i.jsx("div",{className:"sheet-wrap__center",children:i.jsx("section",{className:"directory-picker settings-directory-picker",children:i.jsxs("div",{className:"directory-picker__panel",children:[i.jsx("header",{className:"directory-picker__header",children:i.jsxs("div",{className:"directory-picker__heading",children:[i.jsx("h2",{children:a}),l?i.jsx("p",{children:l}):null]})}),i.jsxs("div",{className:"directory-picker__field",children:[i.jsx("span",{className:"directory-picker__field-label",children:"当前路径"}),i.jsxs("button",{type:"button",className:`directory-picker__path ${g===m?"is-selected":""}`,onClick:()=>{m&&S(m)},disabled:!m,"aria-pressed":g===m,children:[i.jsx("span",{className:"directory-picker__path-icon",children:i.jsx(V4,{})}),i.jsx("span",{className:"directory-picker__path-value",children:m??"根目录"})]})]}),i.jsxs("div",{className:"directory-picker__field",children:[i.jsx("span",{className:"directory-picker__field-label",children:"目录"}),i.jsx("div",{className:"directory-picker__list",role:"listbox","aria-label":"目录列表",children:w?i.jsx("div",{className:"directory-picker__state",children:"正在读取目录…"}):j?i.jsx("div",{className:"directory-picker__state is-error",children:j}):p.length===0?i.jsx("div",{className:"directory-picker__state",children:"当前目录下没有可用子目录"}):p.map(L=>{const W=g===L.path;return i.jsxs("div",{className:`directory-picker__row ${W?"is-selected":""}`,children:[i.jsxs("button",{type:"button",className:"directory-picker__row-main",onClick:()=>{S(L.path)},onDoubleClick:()=>{L.has_children&&E(L.path)},"aria-selected":W,children:[i.jsx("span",{className:"directory-picker__row-icon",children:i.jsx(V4,{})}),i.jsx("span",{className:"directory-picker__row-name",children:L.name}),W?i.jsx("span",{className:"directory-picker__row-check",children:i.jsx(bE,{})}):null]}),L.has_children?i.jsx("button",{type:"button",className:"directory-picker__row-enter-button","aria-label":`进入 ${L.name}`,onClick:()=>E(L.path),children:i.jsx("span",{className:"directory-picker__row-enter","aria-hidden":"true",children:i.jsx(vE,{})})}):null]},L.path)})})]}),i.jsx("footer",{className:"directory-picker__footer",children:i.jsxs("div",{className:"directory-picker__footer-actions",children:[U?i.jsx("button",{type:"button",className:"directory-picker__secondary",onClick:I,children:i.jsx("span",{children:"返回上级"})}):null,i.jsx("button",{type:"button",className:"directory-picker__secondary",onClick:u,children:i.jsx("span",{children:"取消"})}),i.jsx("button",{type:"button",className:"directory-picker__primary",disabled:!g,onClick:()=>{g&&f(g)},children:o})]})})]})})})]})},b3="panda-dev-manager-last-apk-download",SE=9e4,om=e=>{if(!e)return"未记录";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString("zh-CN",{hour12:!1})},jE=e=>typeof e!="number"||!Number.isFinite(e)||e<=0?"未知":e<1024*1024?`${Math.round(e/1024)} KB`:`${Math.round(e/1024/1024*10)/10} MB`,wE=()=>{if(typeof window>"u")return null;try{const e=window.localStorage.getItem(b3);if(!e)return null;const t=JSON.parse(e);return typeof t.artifactId!="string"||typeof t.triggeredAt!="number"||!Number.isFinite(t.triggeredAt)?null:{artifactId:t.artifactId,triggeredAt:t.triggeredAt}}catch{return null}},NE=e=>{if(!(typeof window>"u"))try{window.localStorage.setItem(b3,JSON.stringify({artifactId:e,triggeredAt:Date.now()}))}catch{}},cm=e=>e==="succeeded"?"通过":e==="failed"?"异常":"进行中",mg=e=>e==="succeeded"?"is-success":e==="failed"?"is-danger":"is-muted",X4=e=>e==null?"未测试":e?"通过":"异常",J4=e=>e==null?"is-muted":e?"is-success":"is-danger",Dl=e=>e?`http://127.0.0.1:${e}`:"",um=e=>e?`ws://127.0.0.1:${e}/ws`:"",eb=e=>({...e}),pg=(e,t)=>{if(!e||e.config.updated_at!==t.config.updated_at)return t;const a=new Map(e.services.map(l=>[l.key,l]));return{...t,services:t.services.map(l=>{if(l.probe)return l;const o=a.get(l.key);return o!=null&&o.probe?{...l,probe:o.probe}:l})}},kE=({isActive:e,agentId:t})=>{var ie;const a=La(),[l,o]=_.useState(null),[u,f]=_.useState(null),[m,y]=_.useState(""),[g,S]=_.useState(!1),[p,v]=_.useState(null),[w,N]=_.useState(!1),j=t?{agentId:t}:void 0,T=["settings-dev-manager",t??"no-agent"],A=is({queryKey:T,queryFn:async()=>{const k=await xn(j),K=a.getQueryData(T),_e=await k.client.getDevManagerSnapshot({includeServiceProbe:!1});return{baseUrl:k.baseUrl,snapshot:pg(K==null?void 0:K.snapshot,_e)}},enabled:e&&!!t,refetchOnWindowFocus:!1,staleTime:0,refetchInterval:k=>{const K=k.state.data;return K!=null&&K.snapshot.jobs.some(_e=>_e.status==="running")?2e3:!1}});_.useEffect(()=>{var K;const k=(K=A.data)==null?void 0:K.snapshot.config;k&&(l&&u===k.updated_at||(o(eb(k)),f(k.updated_at),y(""),S(!1)))},[A.data,l,u]);const U=ss({mutationFn:async()=>{if(!j)throw new Error("当前没有可用的开发节点,暂时无法保存开发版配置。");if(!l)throw new Error("开发版配置还没有加载完成。");return(await xn(j)).client.saveDevManagerConfig({...l,npm_token:m||null,clear_npm_token:g})},onSuccess:k=>{a.setQueryData(T,K=>({baseUrl:(K==null?void 0:K.baseUrl)??"",snapshot:pg(K==null?void 0:K.snapshot,k)})),o(eb(k.config)),f(k.config.updated_at),y(""),S(!1),v("开发版配置已保存。")},onError:k=>{v(k instanceof Error?k.message:"保存配置失败。")}}),I=ss({mutationFn:async k=>{if(!j)throw new Error("当前没有可用的开发节点,暂时无法执行开发版管理操作。");return(await xn(j)).client.executeDevManagerAction({action:k})},onSuccess:(k,K)=>{var _e;a.setQueryData(T,fe=>({baseUrl:(fe==null?void 0:fe.baseUrl)??"",snapshot:pg(fe==null?void 0:fe.snapshot,k.snapshot)})),v(K==="install-latest-release"?"后台升级助手已启动,当前连接会短时断开,请等待正式版自动恢复。":((_e=k.job)==null?void 0:_e.summary)??"任务已启动。")},onError:k=>{v(k instanceof Error?k.message:"执行操作失败。")}}),E=((ie=A.data)==null?void 0:ie.snapshot)??null,L=(E==null?void 0:E.jobs[0])??null,W=(E==null?void 0:E.jobs.find(k=>k.status==="running"))??null,ee=(E==null?void 0:E.jobs.find(k=>k.kind==="npm-publish"))??null,F=(E==null?void 0:E.jobs.find(k=>k.kind==="release-install-run"))??null,G=L,Q=_.useMemo(()=>(E==null?void 0:E.services.filter(k=>k.key.startsWith("dev-")))??[],[E]),Y=_.useMemo(()=>(E==null?void 0:E.services.filter(k=>k.key.startsWith("release-")))??[],[E]),pe=_.useMemo(()=>Q.some(k=>k.status==="running")?"部分或全部运行中":Q.some(k=>k.status==="degraded")?"存在异常":"未运行",[Q]),ne=(k,K)=>{o(_e=>_e&&{..._e,[k]:K})},V=(k,K)=>{const _e=Number(K)||null;o(fe=>{if(!fe)return fe;const Te={...fe,[k]:_e};if(k==="dev_hub_port"){const re=Dl(fe.dev_hub_port),we=Dl(_e);fe.dev_agent_hub_url===re&&(Te.dev_agent_hub_url=we),fe.dev_web_hub_url===re&&(Te.dev_web_hub_url=we)}if(k==="dev_agent_port"){const re=Dl(fe.dev_agent_port),we=Dl(_e),ve=um(fe.dev_agent_port),ze=um(_e);fe.dev_agent_direct_base_url===re&&(Te.dev_agent_direct_base_url=we),fe.dev_agent_ws_base_url===ve&&(Te.dev_agent_ws_base_url=ze)}if(k==="release_hub_port"){const re=Dl(fe.release_hub_port),we=Dl(_e);fe.release_agent_hub_url===re&&(Te.release_agent_hub_url=we)}if(k==="release_agent_port"){const re=Dl(fe.release_agent_port),we=Dl(_e),ve=um(fe.release_agent_port),ze=um(_e);fe.release_agent_direct_base_url===re&&(Te.release_agent_direct_base_url=we),fe.release_agent_ws_base_url===ve&&(Te.release_agent_ws_base_url=ze)}return Te})},ye=async()=>{if(!(E!=null&&E.apk_artifact)){v("当前还没有可下载的 APK。");return}if(!j){v("当前没有可用的开发节点,暂时无法下载 APK。");return}const k=wE();if((k==null?void 0:k.artifactId)===E.apk_artifact.artifact_id&&Date.now()-k.triggeredAt<SE){v("同一个 APK 刚刚已经触发过下载。如果安装确认没有弹出,请先查看系统下载列表或等待浏览器处理完成。");return}const K=await xn(j),_e=new URL(E.apk_artifact.download_path,K.baseUrl).toString();NE(E.apk_artifact.artifact_id),window.open(_e,"_blank","noopener,noreferrer"),v("APK 下载已触发。")},R=k=>{ne("repo_path",k),N(!1),v(`已选中开发版目录:${k}`)},H=I.isPending;if(A.isLoading&&!E)return i.jsx("p",{className:"settings-block__status",children:"正在加载开发版管理信息…"});if(A.error instanceof Error)return i.jsx("p",{className:"settings-block__status",children:A.error.message});if(!t)return i.jsx("p",{className:"settings-block__status",children:"当前没有可用的代码线程节点,请先在会话里连接到目标 agent,再使用开发版管理。"});if(!E||!l)return i.jsx("p",{className:"settings-block__status",children:"当前还没有可用的开发版管理数据。"});const X=I.variables,oe=E.node_runtime.versions.length>0;return i.jsxs("div",{className:"settings-content-stack",children:[i.jsxs("section",{className:"settings-panel settings-panel--hero",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsxs("div",{children:[i.jsx("h3",{className:"settings-panel__title",children:"开发版与正式版双环境"}),i.jsx("p",{className:"settings-panel__subtitle",children:"正式版保持默认可用,开发版走独立端口和独立命令。首屏只读取轻量快照,状态测试按端口连通性快测。"})]})}),i.jsxs("div",{className:"settings-summary-strip",children:[i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"开发版代码"}),i.jsx("strong",{children:E.config.repo_path??"未配置"})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"正式版版本"}),i.jsx("strong",{children:E.current_version??"未检测到"})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"开发版状态"}),i.jsx("strong",{children:pe})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"最新 APK"}),i.jsx("strong",{children:E.apk_artifact?om(E.apk_artifact.built_at):"尚未生成"})]})]})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsxs("div",{className:"settings-panel__header",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"settings-panel__title",children:"基础配置"}),i.jsx("p",{className:"settings-panel__subtitle",children:"保存开发版路径、nvm 版本、启动参数,以及正式版升级后自动恢复所需配置。"})]}),i.jsx("div",{className:"settings-actions-row",children:i.jsx("button",{type:"button",className:"settings-inline-action",onClick:()=>void U.mutateAsync(),disabled:U.isPending,children:U.isPending?"保存中…":"保存配置"})})]}),i.jsxs("div",{className:"dev-manager-form-grid",children:[i.jsxs("div",{className:"dev-manager-form-section dev-manager-field--wide",children:[i.jsx("strong",{children:"开发版运行配置"}),i.jsx("p",{children:"这些配置直接用于启动、重启、停止开发版 Hub + Agent + Web。启动参数会追加到对应启动命令末尾。"})]}),i.jsxs("div",{className:"settings-field dev-manager-field--wide",children:[i.jsx("span",{children:"开发版代码路径"}),i.jsx("input",{type:"text",className:`dev-manager-path-display ${l.repo_path?"is-selected":""}`,value:l.repo_path??"",placeholder:t?"点击下方按钮选择目录":"当前没有可用节点,暂时无法浏览目录",readOnly:!0,onClick:()=>{t&&N(!0)}}),i.jsxs("div",{className:"settings-actions-row dev-manager-path-actions",children:[i.jsx("button",{type:"button",className:"settings-inline-action",onClick:()=>N(!0),disabled:!t,children:"选择目录"}),i.jsx("button",{type:"button",className:"settings-ghost-button",onClick:()=>ne("repo_path",null),disabled:!l.repo_path,children:"清空"})]}),i.jsx("small",{className:"dev-manager-field-hint",children:"使用内置目录弹层懒加载浏览;这里只保存最终选中的开发版仓库路径。"})]}),i.jsxs("div",{className:"settings-field",children:[i.jsx("span",{children:"Node 版本"}),i.jsxs("select",{value:l.nvm_version??"",onChange:k=>ne("nvm_version",k.target.value||null),children:[i.jsx("option",{value:"",children:"保持系统默认"}),E.node_runtime.versions.map(k=>i.jsx("option",{value:k,children:k},k))]}),i.jsx("small",{className:`dev-manager-field-hint ${oe?"":"is-danger"}`,children:oe?E.node_runtime.manager==="nvm-windows"?"下拉内容包含当前正在运行的 Node 版本,以及这台电脑上 nvm-windows 已安装的版本。":"下拉内容至少包含当前正在运行的 Node 版本;如果这台电脑安装了 nvm-windows,也会一并列出。":E.node_runtime.error||"当前没有检测到可用的 Node 版本。"})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"npm 令牌"}),i.jsx("input",{type:"password",value:m,onChange:k=>{S(!1),y(k.target.value)},placeholder:E.credentials.has_npm_token?`已保存:${E.credentials.npm_token_hint??"******"}`:"输入新的 npm token"})]}),i.jsx("div",{className:"settings-actions-row dev-manager-token-actions",children:i.jsx("button",{type:"button",className:"settings-ghost-button",onClick:()=>{y(""),S(!0)},children:"清空令牌"})}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"开发版 Hub 端口"}),i.jsx("input",{type:"number",value:l.dev_hub_port??"",onChange:k=>V("dev_hub_port",k.target.value)})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"开发版 Agent 端口"}),i.jsx("input",{type:"number",value:l.dev_agent_port??"",onChange:k=>V("dev_agent_port",k.target.value)})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"开发版 Web 端口"}),i.jsx("input",{type:"number",value:l.dev_web_port??"",onChange:k=>V("dev_web_port",k.target.value)})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"开发版 Agent -> Hub URL"}),i.jsx("input",{type:"text",value:l.dev_agent_hub_url,onChange:k=>ne("dev_agent_hub_url",k.target.value)})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"开发版 Agent 直连 URL"}),i.jsx("input",{type:"text",value:l.dev_agent_direct_base_url,onChange:k=>ne("dev_agent_direct_base_url",k.target.value)})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"开发版 Agent WS URL"}),i.jsx("input",{type:"text",value:l.dev_agent_ws_base_url,onChange:k=>ne("dev_agent_ws_base_url",k.target.value)})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"开发版 Agent 名称"}),i.jsx("input",{type:"text",value:l.dev_agent_name,onChange:k=>ne("dev_agent_name",k.target.value),placeholder:"留空后默认显示为直连地址 host:port"})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"开发版 Web -> Hub URL"}),i.jsx("input",{type:"text",value:l.dev_web_hub_url,onChange:k=>ne("dev_web_hub_url",k.target.value)})]}),i.jsxs("label",{className:"settings-field dev-manager-field--wide",children:[i.jsx("span",{children:"开发版 Hub 追加参数"}),i.jsx("textarea",{value:l.dev_hub_args,onChange:k=>ne("dev_hub_args",k.target.value),placeholder:"会直接追加到 corepack pnpm dev:hub 后面"})]}),i.jsxs("label",{className:"settings-field dev-manager-field--wide",children:[i.jsx("span",{children:"开发版 Agent 追加参数"}),i.jsx("textarea",{value:l.dev_agent_args,onChange:k=>ne("dev_agent_args",k.target.value),placeholder:"会直接追加到 corepack pnpm dev:agent 后面"})]}),i.jsxs("label",{className:"settings-field dev-manager-field--wide",children:[i.jsx("span",{children:"开发版 Web 追加参数"}),i.jsx("textarea",{value:l.dev_web_args,onChange:k=>ne("dev_web_args",k.target.value),placeholder:"会直接追加到开发版 Web 的 vite 命令后面"})]}),i.jsxs("div",{className:"dev-manager-form-section dev-manager-field--wide",children:[i.jsx("strong",{children:"正式版自动恢复配置"}),i.jsx("p",{children:"这些配置不是给当前已运行的正式版实时改端口,而是点击“安装并运行”后,后台升级助手用它重新拉起正式版 Hub + Agent。"})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"正式版 Hub 端口(自动恢复)"}),i.jsx("input",{type:"number",value:l.release_hub_port??"",onChange:k=>V("release_hub_port",k.target.value)})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"正式版 Agent 端口(自动恢复)"}),i.jsx("input",{type:"number",value:l.release_agent_port??"",onChange:k=>V("release_agent_port",k.target.value)})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"正式版 Agent -> Hub URL(自动恢复)"}),i.jsx("input",{type:"text",value:l.release_agent_hub_url,onChange:k=>ne("release_agent_hub_url",k.target.value)})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"正式版 Agent 直连 URL(自动恢复)"}),i.jsx("input",{type:"text",value:l.release_agent_direct_base_url,onChange:k=>ne("release_agent_direct_base_url",k.target.value)})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"正式版 Agent WS URL(自动恢复)"}),i.jsx("input",{type:"text",value:l.release_agent_ws_base_url,onChange:k=>ne("release_agent_ws_base_url",k.target.value)})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"正式版 Agent 名称(自动恢复)"}),i.jsx("input",{type:"text",value:l.release_agent_name,onChange:k=>ne("release_agent_name",k.target.value),placeholder:"留空后默认显示为直连地址 host:port"})]}),i.jsxs("label",{className:"settings-field dev-manager-field--wide",children:[i.jsx("span",{children:"正式版 Hub 追加参数(自动恢复)"}),i.jsx("textarea",{value:l.release_hub_args,onChange:k=>ne("release_hub_args",k.target.value),placeholder:"会直接追加到 panda hub 后面"})]}),i.jsxs("label",{className:"settings-field dev-manager-field--wide",children:[i.jsx("span",{children:"正式版 Agent 追加参数(自动恢复)"}),i.jsx("textarea",{value:l.release_agent_args,onChange:k=>ne("release_agent_args",k.target.value),placeholder:"会直接注入 panda agent 命令后面"})]})]})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsxs("div",{className:"settings-panel__header",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"settings-panel__title",children:"开发版运行控制"}),i.jsx("p",{className:"settings-panel__subtitle",children:"启动、重启、停止开发版 Hub / Agent / Web。进入页面默认不做探测,点击状态测试后仅按端口连通性快速判断。"})]}),i.jsxs("div",{className:"settings-actions-row",children:[i.jsx("button",{type:"button",className:"settings-inline-action",onClick:()=>void I.mutateAsync("start-development"),disabled:H,children:X==="start-development"&&I.isPending?"启动中…":"启动"}),i.jsx("button",{type:"button",className:"settings-inline-action",onClick:()=>void I.mutateAsync("restart-development"),disabled:H,children:X==="restart-development"&&I.isPending?"重启中…":"重启"}),i.jsx("button",{type:"button",className:"settings-ghost-button",onClick:()=>void I.mutateAsync("stop-development"),disabled:H,children:X==="stop-development"&&I.isPending?"停止中…":"停止"}),i.jsx("button",{type:"button",className:"settings-ghost-button",onClick:()=>void I.mutateAsync("probe-development"),disabled:H,children:X==="probe-development"&&I.isPending?"测试中…":"状态测试"})]})]}),i.jsx("div",{className:"dev-manager-service-grid",children:Q.map(k=>{var K,_e;return i.jsxs("article",{className:`settings-diagnostic-list__item dev-manager-service-card is-${k.status}`,children:[i.jsx("strong",{children:k.label}),i.jsxs("span",{children:["上次测试:"," ",i.jsx("strong",{className:J4((K=k.probe)==null?void 0:K.ok),children:X4((_e=k.probe)==null?void 0:_e.ok)})]}),i.jsxs("span",{children:["端口:",k.configured_port??"未配置"]}),k.detected_pids.length>0?i.jsxs("span",{children:["PID:",k.detected_pids.join(", ")]}):null]},k.key)})})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsxs("div",{className:"settings-panel__header",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"settings-panel__title",children:"npm 发布与正式版恢复"}),i.jsx("p",{className:"settings-panel__subtitle",children:"发布最新 npm 包,或者自动安装并恢复正式版 Hub + Agent。"})]}),i.jsxs("div",{className:"settings-actions-row",children:[i.jsx("button",{type:"button",className:"settings-inline-action",onClick:()=>void I.mutateAsync("publish-npm"),disabled:I.isPending,children:X==="publish-npm"&&I.isPending?"发布中…":"发布"}),i.jsx("button",{type:"button",className:"settings-ghost-button",onClick:()=>void I.mutateAsync("install-latest-release"),disabled:I.isPending,children:X==="install-latest-release"&&I.isPending?"切换中…":"安装并运行"})]})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前正式版版本"}),i.jsx("span",{children:E.current_version??"未检测到"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"最近 npm 发布"}),i.jsx("span",{className:ee?mg(ee.status):"is-muted",children:ee?cm(ee.status):"未执行"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"最近正式版恢复"}),i.jsx("span",{className:F?mg(F.status):"is-muted",children:F?cm(F.status):"未执行"})]}),Y.map(k=>{var K,_e;return i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:k.label}),i.jsx("span",{className:J4((K=k.probe)==null?void 0:K.ok),children:X4((_e=k.probe)==null?void 0:_e.ok)})]},k.key)})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsxs("div",{className:"settings-panel__header",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"settings-panel__title",children:"APK 编译与下载"}),i.jsx("p",{className:"settings-panel__subtitle",children:"直接用开发版源码产出 release APK,并提供下载入口。"})]}),i.jsxs("div",{className:"settings-actions-row",children:[i.jsx("button",{type:"button",className:"settings-inline-action",onClick:()=>void I.mutateAsync("build-apk"),disabled:I.isPending,children:X==="build-apk"&&I.isPending?"编译中…":"编译 APK"}),i.jsx("button",{type:"button",className:"settings-ghost-button",onClick:()=>void ye(),disabled:!E.apk_artifact,children:"下载 APK"})]})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"最近构建时间"}),i.jsx("span",{children:E.apk_artifact?om(E.apk_artifact.built_at):"尚未构建"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"版本"}),i.jsx("span",{children:E.apk_artifact?`${E.apk_artifact.version_name??"未知"}${E.apk_artifact.version_code?` (${E.apk_artifact.version_code})`:""}`:"尚未构建"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"文件大小"}),i.jsx("span",{children:E.apk_artifact?jE(E.apk_artifact.size_bytes):"尚未构建"})]})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsxs("div",{children:[i.jsx("h3",{className:"settings-panel__title",children:"任务日志"}),i.jsx("p",{className:"settings-panel__subtitle",children:"这里只显示最近一次任务的日志;更早的历史记录仍会保留在后台状态文件中。"})]})}),p?i.jsx("p",{className:"settings-block__status",children:p}):null,W?i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前运行中"}),i.jsxs("span",{children:[W.title," · ",cm(W.status)]})]}):null,G?i.jsx("div",{className:"settings-log-list",children:i.jsxs("article",{className:"settings-log-item dev-manager-job",children:[i.jsxs("div",{className:"settings-log-item__meta",children:[i.jsx("strong",{children:G.title}),i.jsx("span",{children:om(G.started_at??G.created_at)})]}),i.jsxs("div",{className:`settings-log-item__kind ${mg(G.status)}`,children:[cm(G.status),G.disconnect_expected?" · 会中断连接":""]}),G.summary?i.jsx("div",{className:"dev-manager-job__summary",children:G.summary}):null,G.logs.length>0?i.jsx("pre",{className:"settings-log-item__detail",children:G.logs.slice(-16).map(k=>`[${om(k.timestamp)}] ${k.message}`).join(`
68
+ `)}):null]},G.id)}):i.jsx("p",{className:"settings-block__status",children:"还没有开发版管理任务记录。"})]}),w&&t?i.jsx(xE,{agentId:t,initialPath:l.repo_path,onClose:()=>N(!1),onSelect:R}):null]})},x3=lc("App",{web:()=>ao(()=>import("./web-BotMTTU8.js"),[]).then(e=>new e.AppWeb)}),EE=lc("Browser",{web:()=>ao(()=>import("./web-CgzXeV2w.js"),[]).then(e=>new e.BrowserWeb)}),CE=e=>{const t=(e==null?void 0:e.trim())??"";return t?t.replace(/\/+$/,""):""},TE=async()=>{if(!gp())return{platform:Cu(),version:null,build:null,appId:null};const e=await x3.getInfo();return{platform:Cu(),version:e.version??null,build:e.build??null,appId:e.id??null}},S3=e=>{const t=CE(e);return t?new URL("/downloads/android/latest.json",t).toString():""},ME=async e=>{const t=S3(e);if(!t)throw new Error("当前还没有配置可用的 Hub 地址。");const a=await fetch(t,{cache:"no-store"});if(!a.ok)throw new Error(`更新清单请求失败(HTTP ${a.status})。`);const l=await a.json(),o=Array.isArray(l.release_notes)?l.release_notes.filter(f=>typeof f=="string"&&f.trim().length>0):[];if(l.platform!=="android"||typeof l.version_name!="string"||typeof l.version_code!="number"||typeof l.published_at!="string"||typeof l.apk_url!="string")throw new Error("Hub 返回的 Android 更新清单格式无效。");const u=new URL(l.apk_url,t).toString();return{platform:"android",version_name:l.version_name,version_code:l.version_code,published_at:l.published_at,apk_url:u,release_notes:o}},RE=e=>{const t=Number(e);return Number.isFinite(t)?t:null},AE=(e,t)=>{if(!e||!t)return!1;const a=RE(e.build);return typeof a=="number"?t.version_code>a:t.version_name!==e.version},DE=async e=>{if(!e.trim())throw new Error("当前没有可用的 APK 下载地址。");await EE.open({url:e})},j3="panda:session-model",w3="panda:command-execution-model",g_="panda:session-model-options",x0="panda:session-model-options-updated",N3="panda:session-reasoning",k3="panda:session-fast-mode",E3="panda:session-plan-mode",C3="panda:session-yolo-mode",Bu=[{id:"gpt-5.4",label:"gpt-5.4",value:"gpt-5.4"},{id:"gpt-5.3-codex",label:"gpt-5.3-codex",value:"gpt-5.3-codex"},{id:"gpt-5.3",label:"gpt-5.3",value:"gpt-5.3"},{id:"gpt-5.4-mini",label:"gpt-5.4-mini",value:"gpt-5.4-mini"},{id:"gpt-5.2",label:"gpt-5.2",value:"gpt-5.2"}],Mf=[{label:"低",value:"low"},{label:"中",value:"medium"},{label:"高",value:"high"},{label:"极高",value:"xhigh"}];var y2;const T3=((y2=Bu[0])==null?void 0:y2.value)??"gpt-5.4",tb="gpt-5.4-mini",OE=Mf[2].value,$r=e=>typeof e=="string"?e.trim():"",IE=(e,t)=>{if(!e||typeof e!="object")return null;const a=e,l=$r(a.value),o=$r(a.label)||l,u=$r(a.id)||l||`custom-model-${t+1}`;if(!o||!l)return null;const f=$r(a.description);return{id:u,label:o,value:l,description:f||null}},LE=e=>{const t=new Set,a=new Set;return e.flatMap(l=>{const o=l.value.toLowerCase();if(a.has(o))return[];a.add(o);let u=l.id,f=2;for(;t.has(u);)u=`${l.id}-${f}`,f+=1;return t.add(u),[{...l,id:u}]})},M3=e=>{if(!Array.isArray(e))return Bu;const t=LE(e.flatMap((a,l)=>{const o=IE(a,l);return o?[o]:[]}));return t.length>0?t:Bu},Wf=e=>{if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}},PE=()=>{typeof window>"u"||window.dispatchEvent(new Event(x0))},Kf=(e,t)=>{if(!(typeof window>"u"))try{window.localStorage.setItem(e,t)}catch{}},__=(e,t=!1)=>{const a=Wf(e);return a==="true"?!0:a==="false"?!1:t},y_=(e,t)=>{Kf(e,t?"true":"false")},Wu=(e,t)=>{const a=t==null?void 0:t.trim();return a?`${e}:${a}`:null},Xd=e=>{const t=$r(e==null?void 0:e.value)||"",a=$r(e==null?void 0:e.label)||t;return{id:$r(e==null?void 0:e.id)||$r(e==null?void 0:e.value)||`custom-model-${Date.now()}`,label:a,value:t,description:$r(e==null?void 0:e.description)||null}},UE=()=>vp().map(({id:e,...t})=>t),vp=()=>{const e=Wf(g_);if(!e)return Bu;try{return M3(JSON.parse(e))}catch{return Bu}},zE=e=>{const t=M3(e);Kf(g_,JSON.stringify(t)),PE()},BE=e=>Mf.some(t=>t.value===e),v_=()=>{var a;const e=Wf(j3),t=vp();return t.some(l=>l.value===e)?e:((a=t[0])==null?void 0:a.value)??T3},Rm=()=>{const e=Wf(w3),t=vp();if(t.some(l=>l.value===e))return e;const a=t.find(l=>l.value===tb)??t[0];return(a==null?void 0:a.value)??tb},R3=()=>{const e=Wf(N3);return BE(e)?e:OE},_f=e=>{Kf(j3,e)},gg=e=>{Kf(w3,e)},A3=e=>{Kf(N3,e)},nb=e=>{const t=Wu(k3,e);return t?__(t):!1},sb=e=>{const t=Wu(E3,e);return t?__(t):!1},ab=e=>{const t=Wu(C3,e);return t?__(t):!1},D3=(e,t)=>{const a=Wu(k3,e);a&&y_(a,t)},O3=(e,t)=>{const a=Wu(E3,e);a&&y_(a,t)},I3=(e,t)=>{const a=Wu(C3,e);a&&y_(a,t)},HE=(e,t)=>{D3(e,t.isFastModeEnabled),O3(e,t.isPlanModeEnabled),I3(e,t.isYoloModeEnabled)},dp=(e,t=UE())=>{var a,l;return((a=t.find(o=>o.value===e))==null?void 0:a.label)??(typeof e=="string"&&e.trim()?e.trim():((l=t[0])==null?void 0:l.label)??T3)},$E=e=>{var t;return((t=Mf.find(a=>a.value===e))==null?void 0:t.label)??Mf[2].label},FE=JSON.parse('[{"id":"absolutely","light":{"codeThemeId":"absolutely","theme":{"accent":"#cc7d5e","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#2d2d2b","opaqueWindows":true,"semanticColors":{"diffAdded":"#00c853","diffRemoved":"#ff5f38","skill":"#cc7d5e"},"surface":"#f9f9f7"},"variant":"light"},"dark":{"codeThemeId":"absolutely","theme":{"accent":"#cc7d5e","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#f9f9f7","opaqueWindows":false,"semanticColors":{"diffAdded":"#00c853","diffRemoved":"#ff5f38","skill":"#cc7d5e"},"surface":"#2d2d2b"},"variant":"dark"}},{"id":"ayu","dark":{"codeThemeId":"ayu","theme":{"accent":"#e6b450","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#bfbdb6","opaqueWindows":false,"semanticColors":{"diffAdded":"#7fd962","diffRemoved":"#ea6c73","skill":"#cda1fa"},"surface":"#0b0e14"},"variant":"dark"}},{"id":"catppuccin","light":{"codeThemeId":"catppuccin","theme":{"accent":"#8839ef","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#4c4f69","opaqueWindows":true,"semanticColors":{"diffAdded":"#40a02b","diffRemoved":"#d20f39","skill":"#8839ef"},"surface":"#eff1f5"},"variant":"light"},"dark":{"codeThemeId":"catppuccin","theme":{"accent":"#cba6f7","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#cdd6f4","opaqueWindows":false,"semanticColors":{"diffAdded":"#a6e3a1","diffRemoved":"#f38ba8","skill":"#cba6f7"},"surface":"#1e1e2e"},"variant":"dark"}},{"id":"codex","light":{"codeThemeId":"codex","theme":{"accent":"#0169cc","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#0d0d0d","opaqueWindows":true,"semanticColors":{"diffAdded":"#00a240","diffRemoved":"#e02e2a","skill":"#751ed9"},"surface":"#ffffff"},"variant":"light"},"dark":{"codeThemeId":"codex","theme":{"accent":"#0169cc","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#fcfcfc","opaqueWindows":false,"semanticColors":{"diffAdded":"#00a240","diffRemoved":"#e02e2a","skill":"#b06dff"},"surface":"#111111"},"variant":"dark"}},{"id":"dracula","dark":{"codeThemeId":"dracula","theme":{"accent":"#ff79c6","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#f8f8f2","opaqueWindows":false,"semanticColors":{"diffAdded":"#50fa7b","diffRemoved":"#ff5555","skill":"#ff79c6"},"surface":"#282a36"},"variant":"dark"}},{"id":"everforest","light":{"codeThemeId":"everforest","theme":{"accent":"#93b259","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#5c6a72","opaqueWindows":true,"semanticColors":{"diffAdded":"#8da101","diffRemoved":"#f85552","skill":"#df69ba"},"surface":"#fdf6e3"},"variant":"light"},"dark":{"codeThemeId":"everforest","theme":{"accent":"#a7c080","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#d3c6aa","opaqueWindows":false,"semanticColors":{"diffAdded":"#a7c080","diffRemoved":"#e67e80","skill":"#d699b6"},"surface":"#2d353b"},"variant":"dark"}},{"id":"github","light":{"codeThemeId":"github","theme":{"accent":"#0969da","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#1f2328","opaqueWindows":true,"semanticColors":{"diffAdded":"#1a7f37","diffRemoved":"#cf222e","skill":"#8250df"},"surface":"#ffffff"},"variant":"light"},"dark":{"codeThemeId":"github","theme":{"accent":"#1f6feb","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#e6edf3","opaqueWindows":false,"semanticColors":{"diffAdded":"#3fb950","diffRemoved":"#f85149","skill":"#bc8cff"},"surface":"#0d1117"},"variant":"dark"}},{"id":"gruvbox","light":{"codeThemeId":"gruvbox","theme":{"accent":"#458588","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#3c3836","opaqueWindows":true,"semanticColors":{"diffAdded":"#3c3836","diffRemoved":"#cc241d","skill":"#b16286"},"surface":"#fbf1c7"},"variant":"light"},"dark":{"codeThemeId":"gruvbox","theme":{"accent":"#458588","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#ebdbb2","opaqueWindows":false,"semanticColors":{"diffAdded":"#ebdbb2","diffRemoved":"#cc241d","skill":"#b16286"},"surface":"#282828"},"variant":"dark"}},{"id":"linear","light":{"codeThemeId":"linear","theme":{"accent":"#5e6ad2","contrast":45,"fonts":{"code":null,"ui":"Inter"},"ink":"#2a3140","opaqueWindows":true,"semanticColors":{"diffAdded":"#00a240","diffRemoved":"#ba2623","skill":"#8160d8"},"surface":"#f7f8fa"},"variant":"light"},"dark":{"codeThemeId":"linear","theme":{"accent":"#5e6ad2","contrast":60,"fonts":{"code":null,"ui":"Inter"},"ink":"#e6e9ef","opaqueWindows":true,"semanticColors":{"diffAdded":"#7ad9c0","diffRemoved":"#fa423e","skill":"#c2a1ff"},"surface":"#17181d"},"variant":"dark"}},{"id":"lobster","dark":{"codeThemeId":"lobster","theme":{"accent":"#ff5c5c","contrast":60,"fonts":{"code":null,"ui":"Satoshi"},"ink":"#e4e4e7","opaqueWindows":true,"semanticColors":{"diffAdded":"#22c55e","diffRemoved":"#ff5c5c","skill":"#3b82f6"},"surface":"#111827"},"variant":"dark"}},{"id":"material","dark":{"codeThemeId":"material","theme":{"accent":"#80cbc4","contrast":60,"fonts":{"code":null,"ui":"Satoshi"},"ink":"#eeffff","opaqueWindows":true,"semanticColors":{"diffAdded":"#c3e88d","diffRemoved":"#f07178","skill":"#c792ea"},"surface":"#212121"},"variant":"dark"}},{"id":"matrix","dark":{"codeThemeId":"matrix","theme":{"accent":"#1eff5a","contrast":60,"fonts":{"code":null,"ui":"ui-monospace, \\"SFMono-Regular\\", \\"SF Mono\\", Menlo, Consolas, \\"Liberation Mono\\", monospace"},"ink":"#b8ffca","opaqueWindows":true,"semanticColors":{"diffAdded":"#1eff5a","diffRemoved":"#fa423e","skill":"#1eff5a"},"surface":"#040805"},"variant":"dark"}},{"id":"monokai","dark":{"codeThemeId":"monokai","theme":{"accent":"#99947c","contrast":60,"fonts":{"code":null,"ui":"ui-monospace, \\"SFMono-Regular\\", \\"SF Mono\\", Menlo, Consolas, \\"Liberation Mono\\", monospace"},"ink":"#f8f8f2","opaqueWindows":true,"semanticColors":{"diffAdded":"#86b42b","diffRemoved":"#c4265e","skill":"#8c6bc8"},"surface":"#272822"},"variant":"dark"}},{"id":"night-owl","dark":{"codeThemeId":"night-owl","theme":{"accent":"#44596b","contrast":60,"fonts":{"code":null,"ui":"ui-monospace, \\"SFMono-Regular\\", \\"SF Mono\\", Menlo, Consolas, \\"Liberation Mono\\", monospace"},"ink":"#d6deeb","opaqueWindows":true,"semanticColors":{"diffAdded":"#c5e478","diffRemoved":"#ef5350","skill":"#c792ea"},"surface":"#011627"},"variant":"dark"}},{"id":"nord","dark":{"codeThemeId":"nord","theme":{"accent":"#88c0d0","contrast":60,"fonts":{"code":null,"ui":"ui-monospace, \\"SFMono-Regular\\", \\"SF Mono\\", Menlo, Consolas, \\"Liberation Mono\\", monospace"},"ink":"#d8dee9","opaqueWindows":true,"semanticColors":{"diffAdded":"#a3be8c","diffRemoved":"#bf616a","skill":"#b48ead"},"surface":"#2e3440"},"variant":"dark"}},{"id":"notion","light":{"codeThemeId":"notion","theme":{"accent":"#3183d8","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#37352f","opaqueWindows":true,"semanticColors":{"diffAdded":"#008000","diffRemoved":"#a31515","skill":"#0000ff"},"surface":"#ffffff"},"variant":"light"},"dark":{"codeThemeId":"notion","theme":{"accent":"#3183d8","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#d9d9d8","opaqueWindows":true,"semanticColors":{"diffAdded":"#4ec9b0","diffRemoved":"#fa423e","skill":"#3183d8"},"surface":"#191919"},"variant":"dark"}},{"id":"one","light":{"codeThemeId":"one","theme":{"accent":"#526fff","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#383a42","opaqueWindows":true,"semanticColors":{"diffAdded":"#3bba54","diffRemoved":"#e45649","skill":"#526fff"},"surface":"#fafafa"},"variant":"light"},"dark":{"codeThemeId":"one","theme":{"accent":"#4d78cc","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#abb2bf","opaqueWindows":true,"semanticColors":{"diffAdded":"#8cc265","diffRemoved":"#e05561","skill":"#c162de"},"surface":"#282c34"},"variant":"dark"}},{"id":"oscurange","dark":{"codeThemeId":"oscurange","theme":{"accent":"#f9b98c","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#e6e6e6","opaqueWindows":true,"semanticColors":{"diffAdded":"#40c977","diffRemoved":"#fa423e","skill":"#479ffa"},"surface":"#0b0b0f"},"variant":"dark"}},{"id":"proof","light":{"codeThemeId":"proof","theme":{"accent":"#3d755d","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#2f312d","opaqueWindows":false,"semanticColors":{"diffAdded":"#3d755d","diffRemoved":"#ba2623","skill":"#5f6ac2"},"surface":"#f5f3ed"},"variant":"light"}},{"id":"rose-pine","light":{"codeThemeId":"rose-pine","theme":{"accent":"#d7827e","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#575279","opaqueWindows":false,"semanticColors":{"diffAdded":"#56949f","diffRemoved":"#797593","skill":"#907aa9"},"surface":"#faf4ed"},"variant":"light"},"dark":{"codeThemeId":"rose-pine","theme":{"accent":"#ea9a97","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#e0def4","opaqueWindows":true,"semanticColors":{"diffAdded":"#9ccfd8","diffRemoved":"#908caa","skill":"#c4a7e7"},"surface":"#232136"},"variant":"dark"}},{"id":"sentry","dark":{"codeThemeId":"sentry","theme":{"accent":"#7055f6","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#e6dff9","opaqueWindows":true,"semanticColors":{"diffAdded":"#8ee6d7","diffRemoved":"#fa423e","skill":"#7055f6"},"surface":"#2d2935"},"variant":"dark"}},{"id":"solarized","light":{"codeThemeId":"solarized","theme":{"accent":"#b58900","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#657b83","opaqueWindows":false,"semanticColors":{"diffAdded":"#859900","diffRemoved":"#dc322f","skill":"#d33682"},"surface":"#fdf6e3"},"variant":"light"},"dark":{"codeThemeId":"solarized","theme":{"accent":"#d30102","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#839496","opaqueWindows":true,"semanticColors":{"diffAdded":"#859900","diffRemoved":"#dc322f","skill":"#d33682"},"surface":"#002b36"},"variant":"dark"}},{"id":"temple","dark":{"codeThemeId":"temple","theme":{"accent":"#e4f222","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#c7e6da","opaqueWindows":true,"semanticColors":{"diffAdded":"#40c977","diffRemoved":"#fa423e","skill":"#e4f222"},"surface":"#02120c"},"variant":"dark"}},{"id":"tokyo-night","dark":{"codeThemeId":"tokyo-night","theme":{"accent":"#3d59a1","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#a9b1d6","opaqueWindows":true,"semanticColors":{"diffAdded":"#449dab","diffRemoved":"#914c54","skill":"#9d7cd8"},"surface":"#1a1b26"},"variant":"dark"}},{"id":"vscode-plus","light":{"codeThemeId":"vscode-plus","theme":{"accent":"#007acc","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#000000","opaqueWindows":false,"semanticColors":{"diffAdded":"#008000","diffRemoved":"#ee0000","skill":"#0000ff"},"surface":"#ffffff"},"variant":"light"},"dark":{"codeThemeId":"vscode-plus","theme":{"accent":"#007acc","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#d4d4d4","opaqueWindows":true,"semanticColors":{"diffAdded":"#369432","diffRemoved":"#f44747","skill":"#000080"},"surface":"#1e1e1e"},"variant":"dark"}}]'),qE={themes:FE},L3="panda:theme-settings",WE=13,KE=12,P3="codex",b_="codex",QE='-apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", sans-serif',GE='ui-monospace, "SFMono-Regular", "SF Mono", "Cascadia Mono", "Cascadia Code", Consolas, monospace',YE=/\b(?:serif|sans-serif|monospace|cursive|fantasy|system-ui|emoji|math|fangsong|ui-serif|ui-sans-serif|ui-monospace|ui-rounded)\b/i,ib=(e,t)=>{const a=e==null?void 0:e.trim();return a?YE.test(a)?a:`${a}, ${t}`:t},VE={absolutely:"Absolutely",ayu:"Ayu",catppuccin:"Catppuccin",codex:"Codex",dracula:"Dracula",everforest:"Everforest",github:"GitHub",gruvbox:"Gruvbox",linear:"Linear",lobster:"Lobster",material:"Material",matrix:"Matrix",monokai:"Monokai","night-owl":"Night Owl",nord:"Nord",notion:"Notion",one:"One",oscurange:"Oscurange",proof:"Proof","rose-pine":"Rose Pine",sentry:"Sentry",solarized:"Solarized",temple:"Temple","tokyo-night":"Tokyo Night","vscode-plus":"VSCode Plus"},Ku=(e,t,a)=>Math.min(a,Math.max(t,e)),Io=(e,t)=>{const l=e.trim().match(/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i);if(!l)return t;const[,o]=l;return`#${(o.length===3?o.split("").map(f=>`${f}${f}`).join(""):o).toUpperCase()}`},Lr=e=>{const t=Io(e,"#000000").slice(1);return{r:Number.parseInt(t.slice(0,2),16),g:Number.parseInt(t.slice(2,4),16),b:Number.parseInt(t.slice(4,6),16)}},ZE=(e,t,a)=>`#${[e,t,a].map(l=>Ku(Math.round(l),0,255).toString(16).padStart(2,"0")).join("").toUpperCase()}`,xt=(e,t,a)=>{const l=Lr(e),o=Lr(t),u=Ku(a,0,1);return ZE(l.r+(o.r-l.r)*u,l.g+(o.g-l.g)*u,l.b+(o.b-l.b)*u)},XE=e=>{const{r:t,g:a,b:l}=Lr(e),o=u=>{const f=u/255;return f<=.03928?f/12.92:((f+.055)/1.055)**2.4};return o(t)*.2126+o(a)*.7152+o(l)*.0722},JE=e=>XE(e)>.5?"#0D1117":"#FFFFFF",Dr=(e,t)=>{const a=Math.round(Ku(t,0,1)*100);return a>=100?e:`color-mix(in srgb, ${e} ${a}%, transparent)`},U3=qE.themes,z3=(e,t)=>{var l,o;const a=t==="light"?e.light:e.dark;return a?{id:e.id,label:VE[e.id]??e.id,codeThemeId:a.codeThemeId,variant:t,accent:Io(a.theme.accent,"#0169CC"),background:Io(a.theme.surface,"#FFFFFF"),foreground:Io(a.theme.ink,"#0D0D0D"),contrast:Ku(Number(a.theme.contrast),0,100),opaqueWindows:!!a.theme.opaqueWindows,semanticColors:{diffAdded:Io(a.theme.semanticColors.diffAdded,"#00A240"),diffRemoved:Io(a.theme.semanticColors.diffRemoved,"#E02E2A"),skill:Io(a.theme.semanticColors.skill,"#751ED9")},fonts:{ui:((l=a.theme.fonts.ui)==null?void 0:l.trim())||null,code:((o=a.theme.fonts.code)==null?void 0:o.trim())||null}}:null},S0=U3.map(e=>z3(e,"light")).filter(e=>!!e),Rf=U3.map(e=>z3(e,"dark")).filter(e=>!!e);Rf.find(e=>e.id===b_)??Rf[0];const ec={mode:"system",lightThemeId:P3,darkThemeId:b_,uiFontSize:WE,codeFontSize:KE},B3=e=>Ku(Number(e),11,18),H3=e=>Ku(Number(e),10,18),x_=()=>typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",bp=e=>S0.find(t=>t.id===e)??S0[0],xp=e=>Rf.find(t=>t.id===e)??Rf[0],rb=(e,t=ec,a="light")=>a==="dark"?{...t,darkThemeId:xp(e).id}:{...t,lightThemeId:bp(e).id},Bl=e=>({mode:(e==null?void 0:e.mode)==="light"||(e==null?void 0:e.mode)==="dark"||(e==null?void 0:e.mode)==="system"?e.mode:ec.mode,lightThemeId:bp((e==null?void 0:e.lightThemeId)??P3).id,darkThemeId:xp((e==null?void 0:e.darkThemeId)??b_).id,uiFontSize:B3((e==null?void 0:e.uiFontSize)??ec.uiFontSize),codeFontSize:H3((e==null?void 0:e.codeFontSize)??ec.codeFontSize)}),$3=()=>{if(typeof window>"u")return ec;try{const e=window.localStorage.getItem(L3);return e?Bl(JSON.parse(e)):ec}catch{return ec}},Jd=e=>{if(!(typeof window>"u"))try{window.localStorage.setItem(L3,JSON.stringify(Bl(e)))}catch{}},eC=(e,t)=>e==="system"?t:e,Ir=(e,t=x_())=>{const a=Bl(e),l=eC(a.mode,t),o=bp(a.lightThemeId),u=xp(a.darkThemeId),f=l==="dark"?u:o;return{...a,appearance:l,lightTheme:o,darkTheme:u,activeTheme:f,uiFontFamily:ib(f.fonts.ui,QE),codeFontFamily:ib(f.fonts.code,GE)}},tC=e=>{if(typeof window>"u")return()=>{};const t=window.matchMedia("(prefers-color-scheme: dark)"),a=()=>{e(t.matches?"dark":"light")};return a(),t.addEventListener("change",a),()=>{t.removeEventListener("change",a)}},nC=(e,t)=>{const a=Ir(e,t),l=a.activeTheme,o=t==="dark",u=(l.contrast-(o?60:45))/100,f=l.semanticColors.diffAdded,m=l.semanticColors.diffRemoved,y=l.semanticColors.skill,g=Lr(f),S=Lr(m),p=Lr(y),v=Lr(l.accent),w=Lr(l.background),N=Lr(l.foreground),j=l.background,T=o?xt(l.background,"#FFFFFF",.05+u*.08):xt(l.background,"#FFFFFF",.42+u*.16),A=o?xt(l.background,"#FFFFFF",.07+u*.08):xt(l.background,"#FFFFFF",.78+u*.1),U=o?xt(l.background,"#FFFFFF",.1+u*.08):xt(l.background,"#FFFFFF",.56+u*.14),I=o?xt(l.background,"#FFFFFF",.14+u*.08):xt(l.background,l.foreground,.1+u*.12),E=o?xt(l.background,"#000000",.08-u*.06):xt(l.background,l.foreground,.03+u*.08),L=o?xt(l.background,"#FFFFFF",.08+u*.06):xt(l.background,l.foreground,.06+u*.08),W=o?xt(l.background,"#FFFFFF",.14+u*.08):xt(l.background,l.foreground,.14+u*.1),ee=o?xt(l.background,"#FFFFFF",.22+u*.08):xt(l.background,l.foreground,.22+u*.1),F=o?xt(l.background,"#FFFFFF",.08+u*.04):xt(l.background,l.foreground,.1+u*.08),G=l.foreground,Q=o?xt(l.foreground,l.background,.28-u*.1):xt(l.foreground,l.background,.5-u*.14),Y=o?xt(l.foreground,l.background,.46-u*.1):xt(l.foreground,l.background,.64-u*.14),pe=xt(l.foreground,l.background,o?.58:.74),ne=l.accent,V=o?xt(l.accent,"#FFFFFF",.18):xt(l.accent,"#FFFFFF",.24),ye=o?xt(l.accent,l.background,.78):xt(l.accent,l.background,.88),R=o?xt(l.accent,l.background,.84):xt(l.accent,l.background,.92),H=JE(ne),X=o?xt(l.background,"#FFFFFF",.1):xt(l.background,l.foreground,.08),oe=o?xt(l.background,"#000000",.06):xt(l.background,l.foreground,.035),ie=o?xt(l.background,"#FFFFFF",.05):xt(l.background,l.foreground,.06),k=o?xt(l.background,"#FFFFFF",.03):xt(l.background,l.foreground,.085),K=o?xt(l.background,"#FFFFFF",.065):xt(l.background,l.foreground,.05),_e=xt(l.foreground,l.background,o?.42:.68),fe=o?xt(l.background,"#FFFFFF",.08):xt(l.foreground,l.background,.18),Te=o?xt(l.background,"#FFFFFF",.08):xt(l.background,l.foreground,.06),re=o?xt(l.background,"#FFFFFF",.12):xt(l.background,l.foreground,.1),we=o?xt(l.background,"#FFFFFF",.14+u*.05):xt(l.background,l.foreground,.12+u*.08),ve=l.opaqueWindows?1:o?.92:.95,ze=l.opaqueWindows?1:o?.94:.965,Be=l.opaqueWindows?1:.94;return{"--theme-id":l.id,"--theme-code-theme-id":l.codeThemeId,"--theme-window-opaque":l.opaqueWindows?"1":"0","--theme-accent":ne,"--theme-accent-rgb":`${v.r} ${v.g} ${v.b}`,"--theme-background":l.background,"--theme-background-rgb":`${w.r} ${w.g} ${w.b}`,"--theme-foreground":l.foreground,"--theme-foreground-rgb":`${N.r} ${N.g} ${N.b}`,"--theme-shadow-rgb":o?"0 0 0":"39 28 17","--theme-ui-font":a.uiFontFamily,"--theme-code-font":a.codeFontFamily,"--theme-ui-font-size":`${a.uiFontSize}px`,"--theme-code-font-size":`${a.codeFontSize}px`,"--color-surface-base":j,"--color-surface-elevated":T,"--color-surface-panel":A,"--color-surface-raised":U,"--color-surface-panel-strong":I,"--color-surface-sidebar":Dr(E,ze),"--color-surface-sidebar-elevated":Dr(L,ze),"--color-surface-border":W,"--color-surface-border-strong":ee,"--color-surface-border-soft":F,"--color-surface-overlay":Dr(I,ve),"--color-surface-floating":Dr(A,ve),"--color-surface-tooltip":Dr(fe,Be),"--color-surface-code":oe,"--color-surface-code-muted":ie,"--color-surface-code-gutter":k,"--color-surface-code-meta":K,"--color-surface-inline-code":X,"--color-surface-hover":Te,"--color-surface-pressed":re,"--color-surface-danger-soft":Dr(m,o?.14:.08),"--color-surface-success-soft":Dr(f,o?.14:.08),"--color-text-primary":G,"--color-text-secondary":Q,"--color-text-muted":Y,"--color-text-tertiary":pe,"--color-text-on-accent":H,"--color-text-link":ne,"--color-text-link-hover":V,"--color-text-danger":m,"--color-text-success":f,"--color-accent-primary":ne,"--color-accent-primary-soft":ye,"--color-accent-secondary":V,"--color-accent-secondary-soft":R,"--color-accent-contrast":H,"--color-accent-primary-rgb":`${v.r} ${v.g} ${v.b}`,"--color-success":f,"--color-warning":xt(l.accent,f,.35),"--color-danger":m,"--color-status-online":ne,"--color-status-offline":o?"#76808A":"#A5ACA4","--color-skill":y,"--color-skill-rgb":`${p.r} ${p.g} ${p.b}`,"--color-code-keyword":y,"--color-code-title":ne,"--color-code-string":xt(f,l.foreground,o?.26:.18),"--color-code-number":xt(y,ne,.36),"--color-code-comment":xt(l.foreground,l.background,o?.52:.72),"--color-code-meta-text":_e,"--color-code-add":f,"--color-code-add-rgb":`${g.r} ${g.g} ${g.b}`,"--color-code-add-bg":Dr(f,o?.16:.11),"--color-code-remove":m,"--color-code-remove-rgb":`${S.r} ${S.g} ${S.b}`,"--color-code-remove-bg":Dr(m,o?.18:.11),"--color-divider":we,"--color-overlay-scrim":l.opaqueWindows?o?"rgba(8, 10, 12, 0.66)":"rgba(23, 20, 17, 0.14)":o?"rgba(8, 10, 12, 0.54)":"rgba(23, 20, 17, 0.09)","--shadow-soft":o?"0 24px 54px rgba(0, 0, 0, 0.34)":"0 24px 54px rgba(24, 18, 12, 0.08)","--shadow-panel":o?"0 10px 26px rgba(0, 0, 0, 0.24)":"0 10px 26px rgba(37, 23, 10, 0.06)","--shadow-sm":o?"0 2px 12px rgba(0, 0, 0, 0.18)":"0 2px 12px rgba(37, 23, 10, 0.05)","--shadow-overlay":o?"0 20px 44px rgba(0, 0, 0, 0.36)":"0 18px 40px rgba(42, 26, 12, 0.1)","--font-display":a.uiFontFamily,"--font-sans":a.uiFontFamily,"--font-mono":a.codeFontFamily,"--font-size-ui-base":`${a.uiFontSize}px`,"--font-size-code-base":`${a.codeFontSize}px`}},F3=(e,t=x_())=>{if(typeof document>"u")return;const a=Ir(e,t),l=nC(a,a.appearance),o=document.documentElement;o.dataset.theme=a.appearance,o.dataset.uiTheme=a.appearance,o.dataset.themeId=a.activeTheme.id,o.dataset.codeThemeId=a.activeTheme.codeThemeId,o.dataset.windowStyle=a.activeTheme.opaqueWindows?"opaque":"soft",o.style.colorScheme=a.appearance;for(const[u,f]of Object.entries(l))o.style.setProperty(u,f)},sC=async()=>{if(await ap().catch(()=>{}),"serviceWorker"in navigator){const t=await navigator.serviceWorker.getRegistrations();await Promise.all(t.map(a=>a.unregister()))}if("caches"in window){const t=await window.caches.keys();await Promise.all(t.map(a=>window.caches.delete(a)))}const e=window.indexedDB;if(typeof e.databases=="function"){const t=await e.databases();await Promise.all(t.map(a=>a.name).filter(a=>!!a).map(a=>new Promise(l=>{const o=e.deleteDatabase(a);o.onsuccess=()=>l(),o.onerror=()=>l(),o.onblocked=()=>l()})))}window.localStorage.clear(),window.sessionStorage.clear()},S_="panda:pwa-install-log",aC=48,Es=e=>((e==null?void 0:e.trim())??"")||null,q3=()=>{if(typeof window>"u")return[];try{const e=window.localStorage.getItem(S_);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.map(a=>{if(!a||typeof a!="object")return null;const l=a;return typeof l.id!="string"||typeof l.timestamp!="string"||typeof l.kind!="string"||typeof l.message!="string"?null:{id:l.id,timestamp:l.timestamp,kind:l.kind,message:l.message,detail:Es(l.detail)}}).filter(a=>!!a).sort((a,l)=>+new Date(l.timestamp)-+new Date(a.timestamp)):[]}catch{return[]}},iC=e=>{if(!(typeof window>"u"))try{window.localStorage.setItem(S_,JSON.stringify(e.slice(0,aC)))}catch{}},rC=()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem(S_)}catch{}},Ol=e=>{const t=q3(),a={id:`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,timestamp:new Date().toISOString(),kind:e.kind,message:e.message.trim(),detail:Es(e.detail)};return iC([a,...t]),a},lb=(e,t)=>{var a;return((a=e.find(l=>l.kind===t))==null?void 0:a.timestamp)??null},lC=async e=>{const t=await fetch(e,{cache:"no-store"});if(!t.ok)throw new Error(`HTTP ${t.status}`);return await t.json()},oC=async e=>{try{let t=await fetch(e,{method:"HEAD",cache:"no-store"});return(t.status===405||t.status===501)&&(t=await fetch(e,{method:"GET",cache:"no-store"})),{ok:t.ok,status:t.status,error:null}}catch(t){return{ok:!1,status:null,error:t instanceof Error?t.message:"Unknown fetch failure"}}},cC=async()=>{if(typeof document>"u"||typeof window>"u")return{href:null,present:!1,ok:!1,error:"Document is unavailable.",id:null,name:null,shortName:null,startUrl:null,scope:null,display:null,displayOverride:[],themeColor:null,backgroundColor:null,icons:[]};const e=document.querySelector('link[rel~="manifest"]'),t=Es(e==null?void 0:e.href);if(!t)return{href:null,present:!1,ok:!1,error:"页面没有 manifest 链接。",id:null,name:null,shortName:null,startUrl:null,scope:null,display:null,displayOverride:[],themeColor:null,backgroundColor:null,icons:[]};try{const a=await lC(t),l=Array.isArray(a.icons)?a.icons:[],o=await Promise.all(l.slice(0,8).map(async u=>{const f=u,m=Es(typeof f.src=="string"?f.src:null);if(!m)return{src:"(missing)",purpose:Es(typeof f.purpose=="string"?f.purpose:null),sizes:Es(typeof f.sizes=="string"?f.sizes:null),type:Es(typeof f.type=="string"?f.type:null),ok:!1,status:null,error:"Icon src is missing."};const y=new URL(m,t).toString(),g=await oC(y);return{src:y,purpose:Es(typeof f.purpose=="string"?f.purpose:null),sizes:Es(typeof f.sizes=="string"?f.sizes:null),type:Es(typeof f.type=="string"?f.type:null),ok:g.ok,status:g.status,error:g.error}}));return{href:t,present:!0,ok:!0,error:null,id:Es(typeof a.id=="string"?a.id:null),name:Es(typeof a.name=="string"?a.name:null),shortName:Es(typeof a.short_name=="string"?a.short_name:null),startUrl:Es(typeof a.start_url=="string"?a.start_url:null),scope:Es(typeof a.scope=="string"?a.scope:null),display:Es(typeof a.display=="string"?a.display:null),displayOverride:Array.isArray(a.display_override)?a.display_override.filter(u=>typeof u=="string"):[],themeColor:Es(typeof a.theme_color=="string"?a.theme_color:null),backgroundColor:Es(typeof a.background_color=="string"?a.background_color:null),icons:o}}catch(a){return{href:t,present:!0,ok:!1,error:a instanceof Error?a.message:"Manifest fetch failed.",id:null,name:null,shortName:null,startUrl:null,scope:null,display:null,displayOverride:[],themeColor:null,backgroundColor:null,icons:[]}}},uC=async()=>{if(typeof navigator>"u"||!("serviceWorker"in navigator))return{supported:!1,controller:!1,registrations:[]};try{const e=await navigator.serviceWorker.getRegistrations();return{supported:!0,controller:!!navigator.serviceWorker.controller,registrations:e.map(t=>{var a,l,o;return{scope:t.scope,activeScriptUrl:((a=t.active)==null?void 0:a.scriptURL)??null,waitingScriptUrl:((l=t.waiting)==null?void 0:l.scriptURL)??null,installingScriptUrl:((o=t.installing)==null?void 0:o.scriptURL)??null}})}}catch{return{supported:!0,controller:!!navigator.serviceWorker.controller,registrations:[]}}},dC=e=>{const t=e.standaloneDisplayMode||e.navigatorStandalone;return t&&e.appInstalledSeen?{label:"较像已安装应用",confidence:"medium",detail:"当前页面正以独立窗口打开,并且这个站点记录到过 appinstalled 事件,更像是真正安装后的应用入口。"}:t?{label:"更像主屏幕快捷方式",confidence:"medium",detail:"当前页面虽然已脱离浏览器标签页,但站点本地没有观测到 appinstalled 事件,无法证明系统级安装已经完成,更像是主屏幕快捷方式。"}:e.installPromptAvailable?{label:"可触发安装流程",confidence:"high",detail:"浏览器已经提供 beforeinstallprompt 事件,设置页里的安装按钮可以主动弹出安装流程。"}:e.beforeInstallPromptSeen?{label:"浏览器曾允许安装",confidence:"low",detail:"站点历史上收到过 beforeinstallprompt,但当前页面没有可用的安装事件,可能需要刷新页面、重新访问或等待浏览器重新评估。"}:{label:"当前不像可安装应用",confidence:"medium",detail:"浏览器当前没有给出可用的安装事件,页面更像普通标签页或只能走“添加到主屏幕”的快捷方式链路。"}},fC=e=>{const t=[];if(e.secureContext||t.push("当前页面不是安全上下文,Chrome 不会提供完整的 PWA 安装链路。"),!e.manifest.present)t.push("页面没有 manifest 链接,浏览器无法把当前站点识别为可安装 Web App。");else if(!e.manifest.ok)t.push(`manifest 读取失败:${e.manifest.error??"未知错误"}。`);else{(!e.manifest.display||e.manifest.display==="browser")&&t.push("manifest 没有声明 standalone/minimal-ui 显示模式,浏览器更可能只给快捷方式。"),!e.manifest.name&&!e.manifest.shortName&&t.push("manifest 缺少 name/short_name,安装身份信息不完整。");const l=e.manifest.icons.some(f=>f.ok&&(f.sizes??"").includes("192x192")),o=e.manifest.icons.some(f=>f.ok&&(f.sizes??"").includes("512x512"));(!l||!o)&&t.push("manifest 图标里缺少可访问的 192x192 或 512x512 图标,Android 安装链路可能会退化。");const u=e.manifest.icons.filter(f=>!f.ok);u.length>0&&t.push(`有 ${u.length} 个 manifest 图标资源探测失败,安装时可能因为图标拉取失败而退化或失败。`)}return e.serviceWorker.supported?e.serviceWorker.registrations.length===0&&t.push("当前页面没有检测到 Service Worker 注册,Chrome 往往不会提供完整安装流程。"):t.push("当前浏览器不支持 Service Worker,无法满足完整的 PWA 安装条件。"),!e.installPromptAvailable&&!e.launchedStandalone&&e.secureContext&&e.manifest.ok&&e.serviceWorker.registrations.length>0&&t.push("浏览器当前没有下发 beforeinstallprompt,设置页按钮无法主动触发安装,只能走浏览器菜单的安装/添加到主屏幕入口。"),e.logs.find(l=>{var o;return l.kind==="install-choice"&&((o=l.detail)==null?void 0:o.toLowerCase().includes("accepted"))})&&!e.appInstalledSeen&&t.push("站点记录到用户接受过安装请求,但没有后续 appinstalled 事件,更像是浏览器回退成快捷方式,或系统级安装没有完成。"),e.launchedStandalone&&!e.appInstalledSeen&&t.push("当前虽然是独立窗口形态,但没有观测到 appinstalled,不能把它视为已经完成系统级安装。"),t},hC=async e=>{const t=q3(),[a,l]=await Promise.all([cC(),uC()]),o=navigator,u=typeof window<"u"&&window.matchMedia("(display-mode: standalone)").matches,f=o.standalone===!0,m=t.some(w=>w.kind==="beforeinstallprompt"),y=t.some(w=>w.kind==="appinstalled"),g=(e==null?void 0:e.installPromptAvailable)===!0,S=u||f,p=[];window.isSecureContext&&p.push("当前是安全上下文。"),a.ok&&p.push("manifest 可读取。"),l.registrations.length>0&&p.push(`检测到 ${l.registrations.length} 个 Service Worker 注册。`),g&&p.push("浏览器已提供可调用的安装事件。"),y&&p.push("站点本地记录到过 appinstalled 事件。");const v=["从桌面图标打开后,确认没有浏览器地址栏或标签栏。","到 Android“设置 -> 应用”里搜索 Panda,若能搜到,更像系统级安装。","到应用抽屉里搜索 Panda;若只在桌面可见而应用抽屉里没有,更像快捷方式。","如果日志里只有“添加到主屏幕”链路,没有 appinstalled,通常不能认定为真正安装完成。"];return{capturedAt:new Date().toISOString(),environment:{href:typeof window>"u"?null:window.location.href,origin:typeof window>"u"?null:window.location.origin,secureContext:typeof window<"u"?window.isSecureContext:!1,online:typeof navigator<"u"&&typeof navigator.onLine=="boolean"?navigator.onLine:null,userAgent:typeof navigator>"u"?null:navigator.userAgent,isAndroid:typeof navigator<"u"?/Android/i.test(navigator.userAgent):!1,standaloneDisplayMode:u,navigatorStandalone:f},promptState:{installPromptAvailable:g,beforeInstallPromptSeen:m,appInstalledSeen:y,lastBeforeInstallPromptAt:lb(t,"beforeinstallprompt"),lastAppInstalledAt:lb(t,"appinstalled")},manifest:a,serviceWorker:l,assessment:dC({standaloneDisplayMode:u,navigatorStandalone:f,installPromptAvailable:g,beforeInstallPromptSeen:m,appInstalledSeen:y}),failureReasons:fC({secureContext:typeof window<"u"?window.isSecureContext:!1,manifest:a,serviceWorker:l,installPromptAvailable:g,appInstalledSeen:y,launchedStandalone:S,logs:t}),successSignals:p,confirmationChecklist:v,logs:t}},mC=e=>{if(typeof window>"u")return()=>{};const t=l=>{(l.key===null||l.key===g_)&&e()},a=()=>{e()};return window.addEventListener("storage",t),window.addEventListener(x0,a),()=>{window.removeEventListener("storage",t),window.removeEventListener(x0,a)}},pC=()=>vp(),gC=()=>Bu,j_=()=>_.useSyncExternalStore(mC,pC,gC);function w_(e){return is(t3(e))}const W3=e=>{var t,a,l;return["codex-commands",((t=e==null?void 0:e.agentId)==null?void 0:t.trim())??"",((a=e==null?void 0:e.projectId)==null?void 0:a.trim())??"",((l=e==null?void 0:e.sessionId)==null?void 0:l.trim())??""]},K3=e=>{const t=(e==null?void 0:e.enabled)??!0;return is({queryKey:W3(e==null?void 0:e.scope),enabled:t,queryFn:async()=>(await xn(e==null?void 0:e.scope)).client.getCodexCommands(),staleTime:0,gcTime:30*6e4,refetchOnWindowFocus:!1,retry:1})},ob=e=>{let t;const a=new Set,l=(g,S)=>{const p=typeof g=="function"?g(t):g;if(!Object.is(p,t)){const v=t;t=S??(typeof p!="object"||p===null)?p:Object.assign({},t,p),a.forEach(w=>w(t,v))}},o=()=>t,m={setState:l,getState:o,getInitialState:()=>y,subscribe:g=>(a.add(g),()=>a.delete(g))},y=t=e(l,o,m);return m},_C=(e=>e?ob(e):ob),yC=e=>e;function vC(e,t=yC){const a=Fr.useSyncExternalStore(e.subscribe,Fr.useCallback(()=>t(e.getState()),[e,t]),Fr.useCallback(()=>t(e.getInitialState()),[e,t]));return Fr.useDebugValue(a),a}const cb=e=>{const t=_C(e),a=l=>vC(t,l);return Object.assign(a,t),a},bC=(e=>e?cb(e):cb),ub=$3(),db=x_(),xa=bC(e=>({panelTab:"git",composerText:"",activeSessionId:null,bottomNavVisible:!0,isSettingsOverlayOpen:!1,themeSettings:ub,systemAppearance:db,resolvedTheme:Ir(ub,db),setPanelTab:t=>e({panelTab:t}),setComposerText:t=>e({composerText:t}),setActiveSessionId:t=>e({activeSessionId:t}),setBottomNavVisible:t=>e({bottomNavVisible:t}),openSettingsOverlay:()=>e({isSettingsOverlayOpen:!0}),closeSettingsOverlay:()=>e({isSettingsOverlayOpen:!1}),setThemeMode:t=>e(a=>{const l=Bl({...a.themeSettings,mode:t});return Jd(l),{themeSettings:l,resolvedTheme:Ir(l,a.systemAppearance)}}),setLightThemeId:t=>e(a=>{const l=Bl(rb(bp(t).id,a.themeSettings,"light"));return Jd(l),{themeSettings:l,resolvedTheme:Ir(l,a.systemAppearance)}}),setDarkThemeId:t=>e(a=>{const l=Bl({...rb(xp(t).id,a.themeSettings,"dark")});return Jd(l),{themeSettings:l,resolvedTheme:Ir(l,a.systemAppearance)}}),setUiFontSize:t=>e(a=>{const l=Bl({...a.themeSettings,uiFontSize:t});return Jd(l),{themeSettings:l,resolvedTheme:Ir(l,a.systemAppearance)}}),setCodeFontSize:t=>e(a=>{const l=Bl({...a.themeSettings,codeFontSize:t});return Jd(l),{themeSettings:l,resolvedTheme:Ir(l,a.systemAppearance)}}),setSystemAppearance:t=>e(a=>({systemAppearance:t,resolvedTheme:Ir(a.themeSettings,t)}))})),fb=980,dm=[{id:"theme",title:"主题",description:"调整界面的颜色风格。",icon:"theme"},{id:"models",title:"模型维护",description:"维护可选模型、默认模型和展示顺序。",icon:"models"},{id:"cache",title:"缓存",description:"解决页面没更新的问题。",icon:"cache"},{id:"notifications",title:"移动提醒",description:"安装到桌面,并在对话完成后接收系统通知。",icon:"notifications"},{id:"installation",title:"安装诊断",description:"判断当前是不是安装版,并分析为什么安装失败。",icon:"installation"},{id:"connection",title:"连接状态",description:"查看现在连到哪台设备。",icon:"connection"},{id:"dev-manager",title:"开发版管理",description:"维护开发版、npm 发布、自升级和 APK 编译下载。",icon:"dev-manager"}],xC=[{id:"appearance",label:"外观与模型",sections:["theme","models","cache"]},{id:"notifications",label:"提醒与安装",sections:["notifications","installation"]},{id:"connection",label:"连接与设备",sections:["connection","dev-manager"]}],SC=[{value:"light",label:"浅色",icon:"sun"},{value:"dark",label:"深色",icon:"moon"},{value:"system",label:"系统",icon:"system"}],jC=(e,t,a,l)=>["const pandaTheme = {",` codeThemeId: "${e}",`,` accent: "${t.toLowerCase()}",`,` contrast: ${a},`,` opaqueWindows: ${l},`,"}"],wC=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"m15 6-6 6 6 6"})}),NC=({open:e})=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:e?"m6 9 6 6 6-6":"m9 6 6 6-6 6"})}),kC=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"M9 6h.01M9 12h.01M9 18h.01M15 6h.01M15 12h.01M15 18h.01"})}),EC=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"M12 5v14M5 12h14"})}),CC=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"m4 20 4.2-1 9.2-9.2a1.8 1.8 0 0 0 0-2.6l-.6-.6a1.8 1.8 0 0 0-2.6 0L5 15.8 4 20Z"}),i.jsx("path",{d:"m13.5 6.5 4 4"})]}),TC=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M4.5 7h15"}),i.jsx("path",{d:"M9.5 4.5h5"}),i.jsx("path",{d:"M7 7l.6 11a1.8 1.8 0 0 0 1.8 1.7h5.2a1.8 1.8 0 0 0 1.8-1.7L17 7"}),i.jsx("path",{d:"M10 10.5v5.2"}),i.jsx("path",{d:"M14 10.5v5.2"})]}),MC=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"m12 6-5 5M12 6l5 5M12 6v12"})}),RC=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"m12 18-5-5M12 18l5-5M12 18V6"})}),hb=({icon:e})=>e==="cache"?i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M5 8.5C5 6.57 8.13 5 12 5s7 1.57 7 3.5S15.87 12 12 12 5 10.43 5 8.5Z"}),i.jsx("path",{d:"M5 8.5v7c0 1.93 3.13 3.5 7 3.5s7-1.57 7-3.5v-7"}),i.jsx("path",{d:"M5 12c0 1.93 3.13 3.5 7 3.5s7-1.57 7-3.5"})]}):e==="models"?i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M5 7.5h14M5 12h14M5 16.5h14"}),i.jsx("path",{d:"M8 5.5h.01M8 10h.01M8 14.5h.01"})]}):e==="connection"?i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M9.5 14.5a3.5 3.5 0 0 1 0-5l1.5-1.5a3.5 3.5 0 0 1 5 5L15 14"}),i.jsx("path",{d:"M14.5 9.5a3.5 3.5 0 0 1 0 5L13 16a3.5 3.5 0 0 1-5-5L9 10"})]}):e==="dev-manager"?i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M12 3.75v4.5"}),i.jsx("path",{d:"M12 15.75v4.5"}),i.jsx("path",{d:"M3.75 12h4.5"}),i.jsx("path",{d:"M15.75 12h4.5"}),i.jsx("path",{d:"m6.7 6.7 3.1 3.1"}),i.jsx("path",{d:"m14.2 14.2 3.1 3.1"}),i.jsx("path",{d:"m17.3 6.7-3.1 3.1"}),i.jsx("path",{d:"m9.8 14.2-3.1 3.1"}),i.jsx("circle",{cx:"12",cy:"12",r:"2.9"})]}):e==="notifications"?i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M6.5 9.5a5.5 5.5 0 0 1 11 0c0 5.25 1.9 6.83 1.9 6.83H4.6S6.5 14.75 6.5 9.5Z"}),i.jsx("path",{d:"M10 18.25a2.1 2.1 0 0 0 4 0"})]}):e==="installation"?i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M12 3.75v10.5"}),i.jsx("path",{d:"m8.5 10.75 3.5 3.5 3.5-3.5"}),i.jsx("path",{d:"M5.25 16.75h13.5"}),i.jsx("path",{d:"M6 19.25h12"})]}):i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M12 4.75v2.1M12 17.15v2.1M4.78 4.78l1.49 1.49M17.73 17.73l1.49 1.49M2.75 12h2.1M19.15 12h2.1M4.78 19.22l1.49-1.49M17.73 6.27l1.49-1.49"}),i.jsx("circle",{cx:"12",cy:"12",r:"3.85"})]}),AC=({icon:e,active:t})=>{const a=t?2:1.8;return e==="sun"?i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:a,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("circle",{cx:"12",cy:"12",r:"4.1"}),i.jsx("path",{d:"M12 2.75v2.1M12 19.15v2.1M4.78 4.78l1.49 1.49M17.73 17.73l1.49 1.49M2.75 12h2.1M19.15 12h2.1M4.78 19.22l1.49-1.49M17.73 6.27l1.49-1.49"})]}):e==="moon"?i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:a,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"M20.2 14.1A8.5 8.5 0 1 1 9.9 3.8a6.9 6.9 0 0 0 10.3 10.3Z"})}):i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:a,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("rect",{x:"3.5",y:"5",width:"17",height:"12",rx:"2.4"}),i.jsx("path",{d:"M8 19h8"})]})},DC=({title:e,caption:t,accent:a,background:l,foreground:o,lines:u})=>i.jsxs("div",{className:"theme-preview-panel",style:{"--preview-accent":a,"--preview-background":l,"--preview-foreground":o},children:[i.jsxs("div",{className:"theme-preview-panel__meta",children:[i.jsx("span",{children:e}),i.jsx("span",{children:t})]}),i.jsx("pre",{className:"theme-preview-panel__code","aria-label":`${e} 主题预览`,children:u.map(f=>i.jsx("code",{children:f},f))})]}),Zc=({label:e,value:t})=>i.jsxs("div",{className:"settings-row settings-row--token",children:[i.jsx("div",{className:"settings-row__copy",children:i.jsx("span",{className:"settings-row__label",children:e})}),i.jsxs("div",{className:"theme-token",children:[i.jsx("span",{className:"theme-token__swatch",style:{"--token-color":t}}),i.jsx("span",{children:t})]})]}),fm=({label:e,value:t})=>i.jsxs("div",{className:"settings-row settings-row--token",children:[i.jsx("div",{className:"settings-row__copy",children:i.jsx("span",{className:"settings-row__label",children:e})}),i.jsx("div",{className:"theme-token",children:t})]}),mb=({label:e,value:t,mono:a})=>i.jsxs("div",{className:"settings-row settings-row--token",children:[i.jsx("div",{className:"settings-row__copy",children:i.jsx("span",{className:"settings-row__label",children:e})}),i.jsx("div",{className:`theme-token theme-token--font ${a?"is-mono":""}`,children:t})]}),pb=({label:e,value:t,onChange:a,min:l,max:o})=>i.jsxs("div",{className:"settings-row settings-row--size",children:[i.jsx("div",{className:"settings-row__copy",children:i.jsx("span",{className:"settings-row__label",children:e})}),i.jsxs("div",{className:"theme-stepper",children:[i.jsx("button",{type:"button",className:"theme-stepper__button",onClick:()=>a(t-1),"aria-label":`${e} 减小 1px`,children:"-"}),i.jsxs("label",{className:"theme-stepper__input-wrap",children:[i.jsx("input",{className:"theme-stepper__input",type:"number",min:l,max:o,step:1,value:t,onChange:u=>a(Number(u.target.value))}),i.jsx("span",{children:"px"})]}),i.jsx("button",{type:"button",className:"theme-stepper__button",onClick:()=>a(t+1),"aria-label":`${e} 增大 1px`,children:"+"})]})]}),gb=(e,t,a,l)=>{if(t===a)return e;const o=e.findIndex(S=>S.id===t),u=e.findIndex(S=>S.id===a);if(o<0||u<0)return e;const f=[...e],[m]=f.splice(o,1);if(!m)return e;const y=f.findIndex(S=>S.id===a),g=l==="before"?y:y+1;return f.splice(g,0,m),f},Xc=e=>{if(!e)return"未记录";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString("zh-CN",{hour12:!1})},hm=e=>typeof e!="number"||!Number.isFinite(e)?"未测得":`${Math.max(0,Math.round(e))} ms`,_g=async(e,t)=>{const a=await t0(t);return{label:e,...a}},Q3=({mode:e="page",onRequestClose:t}={})=>{var wn,xs;const a=Ei(),l=La(),o=yp(),{data:u}=w_(),[f,m]=_.useState(!1),[y,g]=_.useState(null),[S,p]=_.useState(null),[v,w]=_.useState("theme"),[N,j]=_.useState(null),[T,A]=_.useState(()=>typeof window<"u"&&window.innerWidth>=fb),[U,I]=_.useState(()=>v0()),[E,L]=_.useState(()=>hu()),[W,ee]=_.useState(()=>zu()),[F,G]=_.useState(()=>b0()),[Q,Y]=_.useState(!1),[pe,ne]=_.useState(!1),[V,ye]=_.useState(null),[R,H]=_.useState(!1),[X,oe]=_.useState(()=>cu()),[ie,k]=_.useState(()=>Y4()),[K,_e]=_.useState(0),fe=xa(D=>D.themeSettings),Te=xa(D=>D.resolvedTheme),re=xa(D=>D.systemAppearance),we=xa(D=>D.setThemeMode),ve=xa(D=>D.setLightThemeId),ze=xa(D=>D.setDarkThemeId),Be=xa(D=>D.setUiFontSize),St=xa(D=>D.setCodeFontSize),Ke=j_(),[tt,nn]=_.useState(()=>v_()),[Xt,jn]=_.useState(()=>Rm()),[zt,Bt]=_.useState(null),[_t,vt]=_.useState(()=>Xd()),[dt,cn]=_.useState(null),[Pn,ke]=_.useState(null),[Z,me]=_.useState(null),Ce=typeof window>"u"?null:cc(),Oe=typeof window>"u"?null:tp(),le=(u==null?void 0:u.agents.find(D=>D.id===Ce))??(u==null?void 0:u.agents[0]),Ae=((wn=le==null?void 0:le.direct_base_url)==null?void 0:wn.trim().replace(/\/+$/,""))??"",qe=o.platform!=="web",bt=v==="cache"||N==="cache",At=le!=null&&le.id?{agentId:le.id}:void 0,ce=W3(At),Me=is({queryKey:["settings-connection",o.hubUrl,(le==null?void 0:le.id)??"",Ae],queryFn:async()=>{const D=await xn(),[he,et,It]=await Promise.all([_g(D.label,D.baseUrl),_g("Panda Hub",Fu()),Ae?_g((le==null?void 0:le.name)??"当前节点",Ae):Promise.resolve(null)]);return{modeLabel:D.mode==="hub"?"通过 Panda Hub":"直接连接",backendLabel:D.label,backendUrl:D.baseUrl,healthOk:he.healthOk,latencyMs:he.latencyMs,checkedAt:he.checkedAt,activeProbe:he,hubProbe:et,agentProbe:It}},enabled:v==="connection"||N==="connection",staleTime:0,refetchOnWindowFocus:!1}),Re=is({queryKey:["installed-app-info",o.platform],queryFn:()=>TE(),enabled:qe,staleTime:3e4,refetchOnWindowFocus:!1}),We=is({queryKey:["android-release-manifest",o.hubUrl],queryFn:()=>ME(o.hubUrl),enabled:o.platform==="android"&&!!o.hubUrl&&(v==="connection"||N==="connection"),staleTime:0,refetchOnWindowFocus:!1}),Xe=K3({enabled:bt&&!!At,scope:At}),Je=()=>{_e(D=>D+1)},Tt=is({queryKey:["pwa-install-diagnostics",K,!!V,X],queryFn:async()=>hC({installPromptAvailable:!!V}),enabled:v==="installation"||N==="installation",staleTime:0,refetchOnWindowFocus:!1}),Wt=ss({mutationFn:async()=>{if(!At)throw new Error("当前没有可用节点,无法刷新命令目录。");return(await xn(At)).client.refreshCodexCommands()},onMutate:()=>{g(null)},onSuccess:D=>{l.setQueryData(ce,D),g(`命令目录已刷新,共 ${D.commands.length} 条,CLI 版本 ${D.cli_version??"未知"}。`)},onError:D=>{g(D instanceof Error?D.message:"刷新命令目录失败。")}});_.useEffect(()=>{if(typeof window>"u")return;const D=()=>{const he=window.innerWidth>=fb;A(he)};return D(),window.addEventListener("resize",D),()=>{window.removeEventListener("resize",D)}},[]),_.useEffect(()=>{g(null)},[(xs=Me.data)==null?void 0:xs.backendUrl]),_.useEffect(()=>{T&&j(v)},[v,T]),_.useEffect(()=>{cn(null)},[v]),_.useEffect(()=>{if(typeof window>"u")return;const D=It=>{It.preventDefault(),ye(It),Ol({kind:"beforeinstallprompt",message:"浏览器提供了可调用的安装事件。",detail:window.location.href}),Je()},he=()=>{ye(null),oe(!0),p("应用已安装到桌面。"),Ol({kind:"appinstalled",message:"站点收到 appinstalled 事件。",detail:"浏览器报告安装流程已经完成或被接受。"}),Je()},et=()=>{L(hu()),I(v0()),oe(cu()),k(Y4()),Ol({kind:"visibilitychange",message:`页面切换为 ${document.visibilityState}。`,detail:`standalone=${cu()?"yes":"no"}`}),Je()};return window.addEventListener("beforeinstallprompt",D),window.addEventListener("appinstalled",he),document.addEventListener("visibilitychange",et),()=>{window.removeEventListener("beforeinstallprompt",D),window.removeEventListener("appinstalled",he),document.removeEventListener("visibilitychange",et)}},[]),_.useEffect(()=>{if(Ke.length===0||Ke.some(he=>he.value===tt))return;const D=Ke[0].value;_f(D),nn(D)},[Ke,tt]),_.useEffect(()=>{var he;if(Ke.length===0||Ke.some(et=>et.value===Xt))return;const D=((he=Ke.find(et=>et.value==="gpt-5.4-mini"))==null?void 0:he.value)??Ke[0].value;gg(D),jn(D)},[Xt,Ke]),_.useEffect(()=>{const D=()=>{m_().then(he=>{L(he)}).catch(()=>{L(hu())}),ee(zu()),G(b0())};return D(),window.addEventListener("focus",D),document.addEventListener("visibilitychange",D),()=>{window.removeEventListener("focus",D),document.removeEventListener("visibilitychange",D)}},[]),_.useEffect(()=>{if(E!=="granted"||!U.completionNotificationsEnabled||!W)return;let D=!1;return Y(!0),sE(U).then(he=>{D||G(he.synced)}).catch(()=>{D||G(!1)}).finally(()=>{D||Y(!1)}),()=>{D=!0}},[W,E,U]);const ls=()=>{if(e==="overlay"){t==null||t();return}if(Oe){Zi((le==null?void 0:le.id)??null),na(Oe),a({to:"/"});return}a({to:"/nodes"})},Nt=D=>{e==="overlay"&&(t==null||t()),a({to:D})},Un=async()=>{g(null),m(!0);try{await sC(),g("缓存已清理,正在重新载入…"),window.setTimeout(()=>{window.location.replace(`/settings?cache-reset=${Date.now()}`)},180)}catch{m(!1),g("清理失败,请在浏览器设置中手动清理站点数据。")}},Cn=async()=>{if(p(null),E!=="granted"){const D=await nE();if(L(D),D==="granted"){if(!W){const he={completionNotificationsEnabled:!0};Zd(he),I(he),p(qe?"系统通知已开启,任务完成时会直接走原生通知。":"系统通知已开启,但当前环境不支持后台 Web Push。");return}Y(!0);try{const he={completionNotificationsEnabled:!0};await G4(he),Zd(he),I(he),G(!0),p("系统通知和后台 Web Push 都已开启。");return}catch(he){G(!1),p(he instanceof Error?he.message:"通知权限已开启,但 Web Push 订阅失败。");return}finally{Y(!1)}}if(D==="denied"){p("系统通知已被拒绝,请到浏览器或系统设置里重新开启。");return}p("还没有拿到通知权限,可以稍后再试一次。");return}if(U.completionNotificationsEnabled){Y(!0);try{await aE();const D={completionNotificationsEnabled:!1};Zd(D),I(D),G(!1),p("完成提醒已关闭,后台推送订阅也已移除。")}catch(D){p(D instanceof Error?D.message:"关闭 Web Push 订阅失败。")}finally{Y(!1)}return}if(!W){const D={completionNotificationsEnabled:!0};Zd(D),I(D),p(qe?"原生通知已开启,后续会沿用当前 App 的在线事件提醒。":"当前环境不支持后台 Web Push,只能在页面在线时提醒。");return}Y(!0);try{const D={completionNotificationsEnabled:!0};await G4(D),Zd(D),I(D),G(!0),p("完成提醒已开启,Hub 会在会话完成后推送到这台手机。")}catch(D){G(!1),p(D instanceof Error?D.message:"开启 Web Push 失败。")}finally{Y(!1)}},Dn=async()=>{p(null),ne(!0);try{if(qe){await g3({sessionId:"settings-test",completedAt:new Date().toISOString(),title:"Panda 测试提醒",body:"这是一条来自 Android 壳的本地通知测试。",url:"/settings"}),p("测试通知已发出,请看当前设备的系统通知栏。");return}await iE(),p("测试推送已发出,请看手机或当前设备的通知栏。")}catch(D){p(D instanceof Error?D.message:"发送测试推送失败。")}finally{ne(!1)}},De=async()=>{if(!V){Ol({kind:"install-unavailable",message:"当前页面没有可用的安装事件。",detail:ie?"浏览器没有下发 beforeinstallprompt,只能走菜单里的安装应用或添加到主屏幕。":"当前浏览器没有提供可调用的安装对话框。"}),Je(),p(ie?"请在浏览器菜单里选择“安装应用”或“添加到主屏幕”。":"当前浏览器没有提供安装弹窗,请使用浏览器的“添加到主屏幕”。");return}H(!0),p(null),Ol({kind:"install-button-click",message:"用户点击了设置页里的安装按钮。",detail:"准备调用浏览器安装对话框。"}),Je();try{Ol({kind:"install-prompt-shown",message:"已调用浏览器安装对话框。",detail:"等待用户在系统安装弹窗里做出选择。"}),await V.prompt();const D=await V.userChoice;Ol({kind:"install-choice",message:D.outcome==="accepted"?"用户接受了安装请求。":"用户取消了安装请求。",detail:`outcome=${D.outcome}; platform=${D.platform}`}),Je(),D.outcome==="accepted"?p("安装请求已提交,请回到桌面查看。"):p("你取消了这次安装。")}catch(D){Ol({kind:"install-error",message:"调用浏览器安装流程时报错。",detail:D instanceof Error?D.message:"Unknown install error"}),Je(),p("浏览器没有完成安装流程,请查看下方安装诊断。")}finally{ye(null),H(!1),oe(cu()),Je()}},Qt=D=>{var he,et,It;if(zE(D),!D.some(pt=>pt.value===tt)){const pt=((he=D[0])==null?void 0:he.value)??"";pt&&(_f(pt),nn(pt))}if(!D.some(pt=>pt.value===Xt)){const pt=((et=D.find(ct=>ct.value==="gpt-5.4-mini"))==null?void 0:et.value)??((It=D[0])==null?void 0:It.value)??"";pt&&(gg(pt),jn(pt))}},On=()=>{Bt("new"),vt(Xd()),cn(null)},Ts=D=>{Bt(D.id),vt({...D}),cn(null)},Ua=()=>{Bt(null),vt(Xd()),cn(null)},Us=()=>{var ct;const D=_t.label.trim(),he=_t.value.trim();if(!D||!he){cn("请填写显示名和模型 ID。");return}if(Ke.find(gn=>gn.value.toLowerCase()===he.toLowerCase()&&gn.id!==zt)){cn(`模型 ID ${he} 已存在。`);return}const It={..._t,label:D,value:he,description:((ct=_t.description)==null?void 0:ct.trim())||null},pt=zt==="new"?[...Ke,It]:Ke.map(gn=>gn.id===zt?It:gn);Qt(pt),Bt(null),vt(Xd()),cn(zt==="new"?"模型已添加。":"模型已更新。")},Ci=D=>{const he=Ke.filter(et=>et.id!==D);if(he.length===0){cn("至少保留一个模型。");return}Qt(he),zt===D&&(Bt(null),vt(Xd())),cn("模型已删除。")},Fn=D=>{_f(D),nn(D),cn(`默认模型已切换为 ${D}。`)},Ys=D=>{gg(D),jn(D),cn(`命令执行模型已切换为 ${D}。`)},te=(D,he)=>{const et=Ke.findIndex(ct=>ct.id===D);if(et<0)return;const It=he==="up"?et-1:et+1;if(It<0||It>=Ke.length)return;const pt=Ke[It];pt&&Qt(gb(Ke,D,pt.id,he==="up"?"before":"after"))},Ie=(D,he)=>{ke(he),me(null),D.dataTransfer.effectAllowed="move",D.dataTransfer.setData("text/plain",he)},$e=(D,he)=>{if(!Pn||Pn===he)return;D.preventDefault();const et=D.currentTarget.getBoundingClientRect(),It=D.clientY<et.top+et.height/2?"before":"after";me(pt=>(pt==null?void 0:pt.modelId)===he&&pt.position===It?pt:{modelId:he,position:It})},at=D=>{!Pn||!Z||Z.modelId!==D||(Qt(gb(Ke,Pn,D,Z.position)),ke(null),me(null))},Ut=()=>{ke(null),me(null)},ft=Te.appearance,Mt=ft==="light"?S0:Rf,qn=ft==="light"?fe.lightThemeId:fe.darkThemeId,jt=Mt.find(D=>D.id===qn)??Mt[0],zs=Te.activeTheme,Kt=jC(jt.codeThemeId,jt.accent,jt.contrast,jt.opaqueWindows),bs=fe.mode==="system"?`当前跟随系统:${re==="dark"?"深色":"浅色"}`:`当前固定为${Te.appearance==="dark"?"深色":"浅色"}模式`,Wn="当前正在显示",P=jt.opaqueWindows?"不透明窗口":"半透明窗口",be=dm.find(D=>D.id===v)??dm[0],Le={"--settings-mobile-sticky-safe-area":qe?"0px":"var(--app-safe-area-top)"},He=`${jt.label} · ${P} · 对比度 ${jt.contrast}`,Ge=Ke.find(D=>D.value===tt)??Ke[0]??null,ht=Ke.find(D=>D.value===Xt)??Ke.find(D=>D.value==="gpt-5.4-mini")??Ke[0]??null,mt=D=>{var he;return D==="theme"?Te.activeTheme.label:D==="models"?(Ge==null?void 0:Ge.label)??`${Ke.length} 个模型`:D==="cache"?y||(Xe.data?`${Xe.data.commands.length} 条命令`:"站点与命令目录"):D==="notifications"?U.completionNotificationsEnabled?"已开启":"未开启":D==="installation"?X?"已安装":"检查状态":(he=Me.data)!=null&&he.healthOk?Me.data.modeLabel:(le==null?void 0:le.name)??"查看链路"},ot=()=>i.jsx("div",{className:"settings-mobile-layout",children:i.jsx("div",{className:"settings-mobile-sections",role:"list","aria-label":"设置分组",children:xC.map(D=>i.jsx("section",{className:"settings-mobile-group","aria-label":D.label,children:D.sections.map(he=>{const et=dm.find(ct=>ct.id===he);if(!et)return null;const It=N===et.id,pt=mt(et.id);return i.jsxs(_.Fragment,{children:[i.jsxs("button",{type:"button",className:`settings-mobile-row ${It?"is-active":""}`,"data-section":et.id,onClick:()=>{w(et.id),j(ct=>ct===et.id?null:et.id)},"aria-expanded":It,"aria-controls":`settings-mobile-detail-${et.id}`,children:[i.jsx("span",{className:"settings-mobile-row__icon","data-section":et.id,"aria-hidden":"true",children:i.jsx(hb,{icon:et.icon})}),i.jsx("span",{className:"settings-mobile-row__copy",children:i.jsx("span",{className:"settings-mobile-row__title",children:et.title})}),i.jsx("span",{className:"settings-mobile-row__summary",children:pt}),i.jsx("span",{className:"settings-mobile-row__chevron","aria-hidden":"true",children:i.jsx(NC,{open:!1})})]}),It?i.jsx("section",{className:"settings-mobile-detail settings-mobile-detail--inline",id:`settings-mobile-detail-${et.id}`,children:sn(et.id)}):null]},et.id)})},D.id))})}),Xn=()=>i.jsxs("div",{className:"settings-content-stack",children:[i.jsxs("section",{className:"settings-panel settings-panel--hero",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsxs("div",{children:[i.jsx("h3",{className:"settings-panel__title",children:"外观"}),i.jsx("p",{className:"settings-panel__subtitle",children:"先选浅色或深色,再挑一个你喜欢的风格。"})]})}),i.jsx("div",{className:"settings-control-grid",children:i.jsxs("div",{className:"settings-control-block settings-control-block--full",children:[i.jsx("span",{className:"settings-control-block__label",children:"显示方式"}),i.jsx("div",{className:"theme-mode-switch",role:"tablist","aria-label":"主题模式",children:SC.map(D=>{const he=D.value===fe.mode;return i.jsxs("button",{type:"button",className:`theme-mode-switch__button ${he?"is-active":""}`,onClick:()=>we(D.value),role:"tab","aria-selected":he,children:[i.jsx(AC,{icon:D.icon,active:he}),i.jsx("span",{children:D.label})]},D.value)})}),i.jsx("p",{className:"settings-control-block__hint",children:bs})]})})]}),i.jsxs("div",{className:"settings-theme-layout",children:[i.jsxs("section",{className:"settings-panel",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:ft==="light"?"浅色风格":"深色风格"})})}),i.jsxs("div",{className:"settings-theme-selector",children:[i.jsx("label",{className:"settings-select settings-select--wide",children:i.jsx("select",{value:jt.id,onChange:D=>{if(ft==="light"){ve(D.target.value);return}ze(D.target.value)},"aria-label":ft==="light"?"选择浅色主题":"选择深色主题",children:Mt.map(D=>i.jsx("option",{value:D.id,children:D.label},`${D.variant}-${D.id}`))})}),i.jsxs("div",{className:"settings-theme-selector__summary",children:[i.jsxs("div",{className:"settings-theme-selector__swatches","aria-hidden":"true",children:[i.jsx("span",{style:{"--theme-card-color":jt.background}}),i.jsx("span",{style:{"--theme-card-color":jt.foreground}}),i.jsx("span",{style:{"--theme-card-color":jt.accent}}),i.jsx("span",{style:{"--theme-card-color":jt.semanticColors.diffAdded}}),i.jsx("span",{style:{"--theme-card-color":jt.semanticColors.diffRemoved}})]}),i.jsxs("div",{className:"settings-theme-selector__copy",children:[i.jsx("strong",{children:jt.label}),i.jsx("span",{children:He})]}),jt.id===zs.id&&jt.variant===Te.appearance?i.jsx("span",{className:"settings-theme-selector__badge",children:"当前"}):i.jsx("span",{className:"settings-theme-selector__badge is-muted",children:"已选"})]})]})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsxs("div",{className:"settings-panel__header",children:[i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"风格细节"})}),i.jsx("div",{className:"theme-status-badge",children:Wn})]}),i.jsx(DC,{title:ft==="light"?"浅色预览":"深色预览",caption:jt.label,accent:jt.accent,background:jt.background,foreground:jt.foreground,lines:Kt}),i.jsxs("div",{className:"settings-list",children:[i.jsx(fm,{label:"代码风格",value:jt.codeThemeId}),i.jsx(fm,{label:"当前模式",value:jt.variant}),i.jsx(fm,{label:"对比度",value:String(jt.contrast)}),i.jsx(fm,{label:"面板质感",value:P}),i.jsx(Zc,{label:"强调色",value:jt.accent}),i.jsx(Zc,{label:"背景色",value:jt.background}),i.jsx(Zc,{label:"文字色",value:jt.foreground}),i.jsx(Zc,{label:"新增颜色",value:jt.semanticColors.diffAdded}),i.jsx(Zc,{label:"删除颜色",value:jt.semanticColors.diffRemoved}),i.jsx(Zc,{label:"特殊强调",value:jt.semanticColors.skill}),i.jsx(mb,{label:"界面字体",value:jt.fonts.ui??"null"}),i.jsx(mb,{label:"代码字体",value:jt.fonts.code??"null",mono:!0})]})]})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"字号"})})}),i.jsxs("div",{className:"settings-list",children:[i.jsx(pb,{label:"界面字号",value:fe.uiFontSize,onChange:D=>Be(B3(D)),min:11,max:18}),i.jsx(pb,{label:"代码字号",value:fe.codeFontSize,onChange:D=>St(H3(D)),min:10,max:18})]})]})]}),Jt=()=>{var D;return i.jsxs("div",{className:"settings-content-stack",children:[i.jsxs("section",{className:"settings-panel settings-panel--hero",children:[i.jsxs("div",{className:"settings-panel__header",children:[i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"模型列表"})}),i.jsxs("button",{type:"button",className:"settings-inline-action",onClick:On,children:[i.jsx(EC,{}),"新增模型"]})]}),i.jsxs("div",{className:"settings-summary-strip",children:[i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"首位模型"}),i.jsx("strong",{children:((D=Ke[0])==null?void 0:D.label)??"未配置"})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"当前默认"}),i.jsx("strong",{children:(Ge==null?void 0:Ge.label)??"未配置"})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"命令执行模型"}),i.jsx("strong",{children:(ht==null?void 0:ht.label)??"未配置"})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"可选数量"}),i.jsxs("strong",{children:[Ke.length," 个"]})]})]})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"模型角色"})})}),i.jsxs("div",{className:"settings-model-editor__grid",children:[i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"默认模型"}),i.jsx("select",{value:tt,onChange:he=>Fn(he.target.value),children:Ke.map(he=>i.jsx("option",{value:he.value,children:he.label},he.id))})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"命令执行模型"}),i.jsx("select",{value:Xt,onChange:he=>Ys(he.target.value),children:Ke.map(he=>i.jsx("option",{value:he.value,children:he.label},he.id))})]})]})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"维护模型"})})}),dt?i.jsx("div",{className:"settings-inline-status",role:"alert",children:dt}):null,i.jsx("div",{className:"settings-model-list",role:"list","aria-label":"模型列表",children:Ke.map((he,et)=>{const It=Pn===he.id,pt=(Z==null?void 0:Z.modelId)===he.id&&Z.position==="before",ct=(Z==null?void 0:Z.modelId)===he.id&&Z.position==="after",gn=he.value===tt;return i.jsxs("article",{className:`settings-model-card ${It?"is-dragging":""} ${pt?"is-drop-before":""} ${ct?"is-drop-after":""}`,draggable:!0,onDragStart:zn=>Ie(zn,he.id),onDragOver:zn=>$e(zn,he.id),onDrop:zn=>{zn.preventDefault(),at(he.id)},onDragEnd:Ut,role:"listitem",children:[i.jsxs("div",{className:"settings-model-card__main",children:[i.jsx("span",{className:"settings-model-card__grip","aria-hidden":"true",children:i.jsx(kC,{})}),i.jsxs("div",{className:"settings-model-card__copy",children:[i.jsxs("div",{className:"settings-model-card__title-row",children:[i.jsx("strong",{children:he.label}),gn?i.jsx("span",{className:"settings-model-card__badge",children:"默认"}):null]}),i.jsx("code",{className:"settings-model-card__value",children:he.value})]})]}),i.jsxs("div",{className:"settings-model-card__actions",children:[i.jsx("button",{type:"button",className:`settings-mini-button settings-model-card__primary-action ${gn?"is-active":""}`,onClick:()=>Fn(he.value),children:"设为默认"}),i.jsxs("div",{className:"settings-model-card__icon-actions",children:[i.jsx("button",{type:"button",className:"settings-icon-button",onClick:()=>te(he.id,"up"),disabled:et===0,"aria-label":`上移 ${he.label}`,children:i.jsx(MC,{})}),i.jsx("button",{type:"button",className:"settings-icon-button",onClick:()=>te(he.id,"down"),disabled:et===Ke.length-1,"aria-label":`下移 ${he.label}`,children:i.jsx(RC,{})}),i.jsx("button",{type:"button",className:"settings-icon-button",onClick:()=>Ts(he),"aria-label":`编辑 ${he.label}`,children:i.jsx(CC,{})}),i.jsx("button",{type:"button",className:"settings-icon-button is-danger",onClick:()=>Ci(he.id),disabled:Ke.length<=1,"aria-label":`删除 ${he.label}`,children:i.jsx(TC,{})})]})]})]},he.id)})}),zt?i.jsxs("div",{className:"settings-model-editor",children:[i.jsx("div",{className:"settings-model-editor__header",children:i.jsx("strong",{children:zt==="new"?"新增模型":"编辑模型"})}),i.jsxs("div",{className:"settings-model-editor__grid",children:[i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"显示名"}),i.jsx("input",{type:"text",value:_t.label,onChange:he=>vt(et=>({...et,label:he.target.value})),placeholder:"例如:gpt-5.4"})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"模型 ID"}),i.jsx("input",{type:"text",value:_t.value,onChange:he=>vt(et=>({...et,value:he.target.value})),placeholder:"例如:gpt-5.4"})]})]}),i.jsxs("div",{className:"settings-model-editor__actions",children:[i.jsx("button",{type:"button",className:"settings-ghost-button",onClick:Ua,children:"取消"}),i.jsx("button",{type:"button",className:"settings-inline-action",onClick:Us,children:"保存"})]})]}):null]})]})},Jn=()=>{var D,he;return i.jsxs("div",{className:"settings-content-stack",children:[i.jsxs("section",{className:"settings-panel",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"页面缓存"})})}),i.jsxs("div",{className:"settings-summary-strip",children:[i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"适合什么时候用"}),i.jsx("strong",{children:"页面资源或本地缓存异常"})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"常见表现"}),i.jsx("strong",{children:"样式没更新、列表卡旧、页面反复异常"})]})]})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"清理缓存"})})}),i.jsxs("button",{type:"button",className:"settings-action",onClick:()=>void Un(),disabled:f,children:[i.jsxs("div",{className:"settings-action__copy",children:[i.jsx("strong",{children:"清理并刷新"}),i.jsx("span",{children:"删除页面资源缓存和本地会话缓存,强制重新加载最新页面。"})]}),i.jsx("span",{className:"settings-action__state",children:f?"处理中…":"→"})]}),y?i.jsx("p",{className:"settings-block__status",children:y}):null]}),i.jsxs("section",{className:"settings-panel",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"移动端诊断"})})}),i.jsxs("button",{type:"button",className:"settings-action",onClick:()=>Nt("/diagnostics"),children:[i.jsxs("div",{className:"settings-action__copy",children:[i.jsx("strong",{children:"打开安卓诊断页"}),i.jsx("span",{children:"在手机上检查样式能力、资源加载、Service Worker 和缓存状态,并可上传到后端日志。"})]}),i.jsx("span",{className:"settings-action__state",children:"→"})]})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"命令目录缓存"})})}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前 CLI"}),i.jsx("span",{children:((D=Xe.data)==null?void 0:D.cli_version)??"检测中…"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"最近刷新"}),i.jsx("span",{children:((he=Xe.data)==null?void 0:he.loaded_at)??"尚未生成"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"命令数量"}),i.jsx("span",{children:Xe.data?`${Xe.data.commands.length} 条`:"检测中…"})]}),i.jsxs("button",{type:"button",className:"settings-action",onClick:()=>void Wt.mutateAsync(),disabled:Wt.isPending,children:[i.jsxs("div",{className:"settings-action__copy",children:[i.jsx("strong",{children:"刷新命令目录"}),i.jsx("span",{children:"重新从当前 Codex CLI 对应版本拉取命令并覆盖本地缓存文件。"})]}),i.jsx("span",{className:"settings-action__state",children:Wt.isPending?"刷新中…":"→"})]})]})]})},as=()=>{var ct,gn,zn,za,Bs,Hs,Vs,$s,ri,Ti,er,tr,nr,sr,Ba,Ms,Ha,ar,Zs,Ss,ir,rr;const D=Re.data,he=We.data,et=!!(he!=null&&he.apk_url),It=AE(D,he),pt=S3(o.hubUrl);return i.jsxs("div",{className:"settings-content-stack",children:[qe?i.jsxs("section",{className:"settings-panel settings-panel--hero",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"Hub 连接配置"})})}),i.jsxs("div",{className:"settings-summary-strip",children:[i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"当前 Hub"}),i.jsx("strong",{children:o.hubUrl||"未配置"})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"首启状态"}),i.jsx("strong",{children:o.onboardingCompleted?"已完成":"未完成"})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"App 形态"}),i.jsx("strong",{children:"Capacitor Android"})]})]})]}):i.jsxs("section",{className:"settings-panel settings-panel--hero",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"网页端连接基线"})})}),i.jsxs("div",{className:"settings-summary-strip",children:[i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"当前网页入口"}),i.jsx("strong",{children:o.hubUrl||"未检测到"})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"地址来源"}),i.jsx("strong",{children:"浏览器访问地址"})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"缓存策略"}),i.jsx("strong",{children:"同源页面 + 本地查询缓存"})]})]})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:qe?"重新设置 Hub":"当前访问方式"})})}),qe?i.jsx(t6,{title:"输入新的 Hub 地址",description:"扫码或手动输入后,保存即可让 APK 用新地址重新建立连接。",currentHubUrl:o.hubUrl,initialHubUrl:o.hubUrl,hint:"保存后会清理旧的查询缓存、会话定位和连接判定缓存,避免继续误连到旧 Hub。",saveLabel:"保存并重连",savingLabel:"正在保存地址",saveDescription:"新的 Hub 地址会持久化到本机,后续重新打开 APK 会继续沿用。",saveSuccessMessage:"Hub 地址已保存,连接缓存和旧会话定位已重置。",onSaveSuccess:async li=>{await O6({hubUrl:li.url,onboardingCompleted:!0}),await V6(l),Me.refetch(),We.refetch(),Re.refetch()}}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前 Hub 地址"}),i.jsx("span",{children:o.hubUrl||"未检测到"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"可修改性"}),i.jsx("span",{children:"网页端跟随浏览器打开的地址,不额外保存本地覆盖配置。"})]})]})]}),o.platform==="android"?i.jsxs("section",{className:"settings-panel",children:[i.jsxs("div",{className:"settings-panel__header",children:[i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"App 升级"})}),i.jsx("div",{className:"settings-actions-row",children:i.jsx("button",{type:"button",className:"settings-inline-action",onClick:()=>{Re.refetch(),We.refetch()},children:"刷新版本"})})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前版本"}),i.jsx("span",{children:(D==null?void 0:D.version)??"检测中…"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前 build"}),i.jsx("span",{children:(D==null?void 0:D.build)??"检测中…"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"应用包名"}),i.jsx("span",{children:(D==null?void 0:D.appId)??"检测中…"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"更新清单"}),i.jsx("span",{children:pt||"等待 Hub 地址"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"最新发布"}),i.jsx("span",{children:We.isLoading?"检测中…":he?`${he.version_name} (${he.version_code})`:We.error instanceof Error?We.error.message:"未检测到"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"升级状态"}),i.jsx("span",{className:It?"is-ok":"is-muted",children:It?"发现新版本":et?"当前已是最新":"等待发布 APK"})]}),he!=null&&he.published_at?i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"发布时间"}),i.jsx("span",{children:Xc(he.published_at)})]}):null,i.jsxs("button",{type:"button",className:"settings-action",onClick:()=>{he!=null&&he.apk_url&&DE(he.apk_url)},disabled:!(he!=null&&he.apk_url),children:[i.jsxs("div",{className:"settings-action__copy",children:[i.jsx("strong",{children:It?"下载并覆盖安装新版 APK":"打开最新 APK 下载地址"}),i.jsx("span",{children:"通过同一个 `applicationId` 和固定签名覆盖安装,旧配置和本地数据会保留,不需要卸载重装。"})]}),i.jsx("span",{className:"settings-action__state",children:he!=null&&he.apk_url?"→":"未就绪"})]}),he!=null&&he.release_notes.length?i.jsx("div",{className:"settings-diagnostic-list",children:he.release_notes.map(li=>i.jsxs("div",{className:"settings-diagnostic-list__item",children:[i.jsx("strong",{children:"发布说明"}),i.jsx("span",{children:li})]},li))}):null]}):null,i.jsxs("section",{className:"settings-panel settings-panel--hero",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"当前设备"})})}),i.jsxs("div",{className:"settings-summary-strip",children:[i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"设备名称"}),i.jsx("strong",{children:(le==null?void 0:le.name)??"未选择节点"})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"连接方式"}),i.jsx("strong",{children:((ct=Me.data)==null?void 0:ct.modeLabel)??"检测中…"})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"当前链路延迟"}),i.jsx("strong",{className:(gn=Me.data)!=null&&gn.healthOk?"is-ok":"is-muted",children:Me.isLoading?"检测中…":hm((zn=Me.data)==null?void 0:zn.latencyMs)})]})]})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsxs("div",{className:"settings-panel__header",children:[i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"当前链路"})}),i.jsx("div",{className:"settings-actions-row",children:i.jsx("button",{type:"button",className:"settings-inline-action",onClick:()=>{Me.refetch()},children:"刷新延迟"})})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"服务名称"}),i.jsx("span",{children:((za=Me.data)==null?void 0:za.backendLabel)??"检测中…"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"服务地址"}),i.jsx("span",{children:((Bs=Me.data)==null?void 0:Bs.backendUrl)??"检测中…"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前状态"}),i.jsx("span",{className:(Hs=Me.data)!=null&&Hs.healthOk?"is-ok":"is-muted",children:Me.isLoading?"检测中…":(Vs=Me.data)!=null&&Vs.healthOk?"在线":(($s=Me.data)==null?void 0:$s.activeProbe.error)??"无法连接"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前延迟"}),i.jsx("span",{children:hm((ri=Me.data)==null?void 0:ri.latencyMs)})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"最近探测"}),i.jsx("span",{children:Xc((Ti=Me.data)==null?void 0:Ti.checkedAt)})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"设备标识"}),i.jsx("span",{children:(le==null?void 0:le.id)??"未选择节点"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"最近会话"}),i.jsx("span",{children:Oe??"未选择会话"})]})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"延迟对比"})})}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"Hub 延迟"}),i.jsx("span",{children:hm((er=Me.data)==null?void 0:er.hubProbe.latencyMs)})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"Hub 状态"}),i.jsx("span",{className:(tr=Me.data)!=null&&tr.hubProbe.healthOk?"is-ok":"is-muted",children:(nr=Me.data)!=null&&nr.hubProbe.healthOk?"在线":((sr=Me.data)==null?void 0:sr.hubProbe.error)??"无法连接"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"Hub 地址"}),i.jsx("span",{children:((Ba=Me.data)==null?void 0:Ba.hubProbe.url)??"检测中…"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前 Agent 延迟"}),i.jsx("span",{children:hm((Ha=(Ms=Me.data)==null?void 0:Ms.agentProbe)==null?void 0:Ha.latencyMs)})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前 Agent 状态"}),i.jsx("span",{className:(Zs=(ar=Me.data)==null?void 0:ar.agentProbe)!=null&&Zs.healthOk?"is-ok":"is-muted",children:(Ss=Me.data)!=null&&Ss.agentProbe?Me.data.agentProbe.healthOk?"在线":Me.data.agentProbe.error??"无法连接":"未选择节点"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前 Agent 地址"}),i.jsx("span",{children:((rr=(ir=Me.data)==null?void 0:ir.agentProbe)==null?void 0:rr.url)||Ae||"未配置"})]})]})]})},In=()=>{const D=qe?"原生 APK":X?"已安装":"未安装",he=E==="granted"?"已允许":E==="denied"?"已拒绝":E==="default"?"待授权":"不支持",et=qe?E==="granted"?"原生通知":"等待授权":W?Q?"同步中":F?"已连接":U.completionNotificationsEnabled&&E==="granted"?"待连接":"未连接":"不支持",It=qe?E==="granted"&&U.completionNotificationsEnabled?"已开启":"未开启":E==="granted"&&U.completionNotificationsEnabled?F?"后台可达":W?"前台兜底":"仅前台":"未开启",pt=qe?"Capacitor 本地通知":W?F?"Hub Web Push + 系统通知":"系统通知,后台通道待建立":"系统通知(仅页面在线)",ct=qe?E==="granted"?"通常可见,细节取决于系统设置":"先授予通知权限":F?X?"已具备条件":"大多可见,安装后更稳":W?"先建立后台通道":"当前环境很难稳定锁屏提醒",gn=E==="unsupported"||Q,zn=E==="granted"&&U.completionNotificationsEnabled?"关闭完成提醒":Q?"正在建立后台提醒":"开启完成提醒",za=E==="unsupported"?"当前环境不支持系统通知,需要 HTTPS、Service Worker 和受支持浏览器。":qe?"开启后会在当前 App 收到任务完成事件时直接走原生系统通知。":W?"开启后会向 Hub 注册这台设备,后台或锁屏时也能收到完成提醒。":"当前环境只能在页面在线时提醒,建议安装到桌面并使用支持 Web Push 的浏览器。",Bs=E==="unsupported"?"不可用":Q?"同步中…":E==="granted"&&U.completionNotificationsEnabled?F?"已连接":W?"待连接":"已开启":"→",Hs=qe?E==="granted"&&U.completionNotificationsEnabled:E==="granted"&&U.completionNotificationsEnabled&&F&&!Q,Vs=qe?"直接在当前 APK 里发一条本地测试通知,确认系统权限和展示链路正常。":F?"立刻让 Hub 给当前这台设备发一条测试通知,用来确认后台链路是否真的可达。":"只有当前设备已经完成 Web Push 注册后,才能发送测试通知。";return i.jsxs("div",{className:"settings-content-stack",children:[i.jsxs("section",{className:"settings-panel settings-panel--hero",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"安卓优先提醒"})})}),i.jsxs("div",{className:"settings-summary-strip",children:[i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"桌面安装"}),i.jsx("strong",{children:D})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"系统通知权限"}),i.jsx("strong",{children:he})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"完成提醒"}),i.jsx("strong",{children:It})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"后台 Web Push"}),i.jsx("strong",{children:et})]})]})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:qe?"当前交付形态":"安装到桌面"})})}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"推荐平台"}),i.jsx("span",{children:qe?"当前已经是 Android APK":ie?"Android 当前设备":"Android 效果最佳"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前形态"}),i.jsx("span",{children:qe?"本地前端壳 + 局域网后端":X?"已是桌面应用":"浏览器标签页"})]}),i.jsxs("button",{type:"button",className:"settings-action",onClick:()=>void De(),disabled:qe||X||R,children:[i.jsxs("div",{className:"settings-action__copy",children:[i.jsx("strong",{children:qe?"已经是可安装 APK":X?"已经安装":"安装到桌面"}),i.jsx("span",{children:qe?"当前无需再走 PWA 安装链路,后续升级直接下载新版 APK 覆盖安装即可。":X?"现在可以直接从桌面图标进入 Panda。":"安装后更像应用,系统通知和锁屏提醒也更稳定。"})]}),i.jsx("span",{className:"settings-action__state",children:qe||X?"✓":R?"处理中…":"→"})]})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"对话完成提醒"})})}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"提醒方式"}),i.jsx("span",{children:pt})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"锁屏可见"}),i.jsx("span",{children:ct})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"后台通道"}),i.jsx("span",{children:et})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"触发时机"}),i.jsx("span",{children:qe?"App 在线时收到完成事件后,直接发原生系统通知":W?"Hub 收到对话完成后主动推送":"页面在线时收到完成事件后提醒"})]}),i.jsxs("button",{type:"button",className:"settings-action",onClick:()=>void Cn(),disabled:gn,children:[i.jsxs("div",{className:"settings-action__copy",children:[i.jsx("strong",{children:zn}),i.jsx("span",{children:za})]}),i.jsx("span",{className:"settings-action__state",children:Bs})]}),i.jsxs("button",{type:"button",className:"settings-action",onClick:()=>void Dn(),disabled:!Hs||pe,children:[i.jsxs("div",{className:"settings-action__copy",children:[i.jsx("strong",{children:qe?pe?"正在发送测试通知":"发送测试通知":pe?"正在发送测试推送":"发送测试推送"}),i.jsx("span",{children:Vs})]}),i.jsx("span",{className:"settings-action__state",children:pe?"发送中…":Hs?"→":"未就绪"})]}),S?i.jsx("p",{className:"settings-block__status",children:S}):null]})]})},pn=()=>{const D=Tt.data,he=D!=null&&D.promptState.installPromptAvailable?"可主动触发":D!=null&&D.promptState.beforeInstallPromptSeen?"本地曾出现":"未出现",et=D!=null&&D.promptState.appInstalledSeen?"记录到过":"未记录到",It=D!=null&&D.manifest.ok?"正常":D!=null&&D.manifest.present?"读取失败":"缺失",pt=D!=null&&D.serviceWorker.registrations.length?`${D.serviceWorker.registrations.length} 个注册`:D!=null&&D.serviceWorker.supported?"未注册":"不支持";return i.jsxs("div",{className:"settings-content-stack",children:[i.jsxs("section",{className:"settings-panel settings-panel--hero",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"安装结果判断"})})}),i.jsxs("div",{className:"settings-summary-strip",children:[i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"当前研判"}),i.jsx("strong",{children:(D==null?void 0:D.assessment.label)??"检测中…"})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"安装事件"}),i.jsx("strong",{children:he})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"appinstalled"}),i.jsx("strong",{children:et})]})]})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsxs("div",{className:"settings-panel__header",children:[i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"当前状态"})}),i.jsxs("div",{className:"settings-actions-row",children:[i.jsx("button",{type:"button",className:"settings-inline-action",onClick:()=>{Tt.refetch()},children:"刷新诊断"}),i.jsx("button",{type:"button",className:"settings-ghost-button",onClick:()=>{rC(),Je()},children:"清空日志"})]})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前窗口形态"}),i.jsx("span",{children:D?D.environment.standaloneDisplayMode||D.environment.navigatorStandalone?"独立窗口 / 主屏幕入口":"浏览器标签页":"检测中…"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"系统级安装研判"}),i.jsx("span",{children:(D==null?void 0:D.assessment.label)??"检测中…"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"研判置信度"}),i.jsx("span",{children:(D==null?void 0:D.assessment.confidence)??"检测中…"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前说明"}),i.jsx("span",{children:(D==null?void 0:D.assessment.detail)??"正在分析…"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"最近抓取时间"}),i.jsx("span",{children:Xc(D==null?void 0:D.capturedAt)})]})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"PWA 条件与安装信号"})})}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"安全上下文"}),i.jsx("span",{children:D!=null&&D.environment.secureContext?"是":"否"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"manifest"}),i.jsx("span",{children:It})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"manifest display"}),i.jsx("span",{children:(D==null?void 0:D.manifest.display)??"未声明"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"Service Worker"}),i.jsx("span",{children:pt})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前可主动触发安装"}),i.jsx("span",{children:D!=null&&D.promptState.installPromptAvailable?"可以":"不可以"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"最近 beforeinstallprompt"}),i.jsx("span",{children:Xc(D==null?void 0:D.promptState.lastBeforeInstallPromptAt)})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"最近 appinstalled"}),i.jsx("span",{children:Xc(D==null?void 0:D.promptState.lastAppInstalledAt)})]})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"为什么当前可能安装失败"})})}),Tt.isLoading?i.jsx("p",{className:"settings-block__status",children:"正在收集安装诊断…"}):D!=null&&D.failureReasons.length?i.jsx("div",{className:"settings-diagnostic-list",children:D.failureReasons.map((ct,gn)=>i.jsxs("div",{className:"settings-diagnostic-list__item",children:[i.jsxs("strong",{children:["原因 ",gn+1]}),i.jsx("span",{children:ct})]},`${gn}-${ct}`))}):i.jsx("p",{className:"settings-block__status",children:"当前没有发现明显的前端侧阻断条件;如果仍无法完成系统级安装,更像是浏览器策略、安装链路回退或平台侧判断导致。"})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"成功信号与人工确认"})})}),D!=null&&D.successSignals.length?i.jsx("div",{className:"settings-diagnostic-list",children:D.successSignals.map((ct,gn)=>i.jsxs("div",{className:"settings-diagnostic-list__item",children:[i.jsxs("strong",{children:["信号 ",gn+1]}),i.jsx("span",{children:ct})]},`${gn}-${ct}`))}):null,i.jsx("div",{className:"settings-diagnostic-list",children:(D==null?void 0:D.confirmationChecklist.map((ct,gn)=>i.jsxs("div",{className:"settings-diagnostic-list__item",children:[i.jsxs("strong",{children:["确认 ",gn+1]}),i.jsx("span",{children:ct})]},`${gn}-${ct}`)))??null})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"浏览器安装事件日志"})})}),Tt.isLoading?i.jsx("p",{className:"settings-block__status",children:"正在读取日志…"}):D!=null&&D.logs.length?i.jsx("div",{className:"settings-log-list",children:D.logs.map(ct=>i.jsxs("article",{className:"settings-log-item",children:[i.jsxs("div",{className:"settings-log-item__meta",children:[i.jsx("strong",{children:ct.message}),i.jsx("span",{children:Xc(ct.timestamp)})]}),i.jsx("div",{className:"settings-log-item__kind",children:ct.kind}),ct.detail?i.jsx("pre",{className:"settings-log-item__detail",children:ct.detail}):null]},ct.id))}):i.jsx("p",{className:"settings-block__status",children:"还没有本地安装日志。后续在这个页面触发安装、刷新页面、出现 beforeinstallprompt 或 appinstalled 后,这里会自动积累证据。"})]})]})},sn=D=>D==="models"?Jt():D==="cache"?Jn():D==="notifications"?In():D==="installation"?pn():D==="connection"?as():D==="dev-manager"?i.jsx(kE,{isActive:v==="dev-manager"||N==="dev-manager",agentId:(le==null?void 0:le.id)??null}):Xn();return i.jsx("div",{className:"conversation-page settings-screen settings-screen--workspace",style:Le,children:i.jsx("div",{className:"conversation-main settings-screen__main settings-screen__workspace-main",children:i.jsx("div",{className:"settings-screen__body",children:i.jsxs("div",{className:"settings-shell",children:[i.jsxs("header",{className:"settings-page-header",children:[i.jsx("button",{type:"button",className:"settings-card__back",onClick:ls,"aria-label":"返回会话",children:i.jsx(wC,{})}),i.jsx("div",{className:"settings-page-header__copy",children:i.jsx("h1",{className:"settings-page-header__title",children:"设置"})})]}),T?i.jsxs("div",{className:"settings-workspace",children:[i.jsxs("aside",{className:"settings-sidebar",children:[i.jsx("div",{className:"settings-sidebar__title",children:"设置"}),i.jsx("nav",{className:"settings-sidebar__nav","aria-label":"设置导航",children:dm.map(D=>{const he=D.id===v;return i.jsxs("button",{type:"button",className:`settings-sidebar__item ${he?"is-active":""}`,onClick:()=>w(D.id),children:[i.jsx(hb,{icon:D.icon}),i.jsx("span",{children:D.title})]},D.id)})})]}),i.jsxs("main",{className:"settings-stage",children:[i.jsx("header",{className:"settings-stage__header",children:i.jsxs("div",{children:[i.jsx("h2",{className:"settings-stage__title",children:be.title}),i.jsx("p",{className:"settings-stage__description",children:be.description})]})}),sn(v)]})]}):ot()]})})})})},OC=({onClose:e})=>{const t=_.useRef(null);return _.useEffect(()=>{var u;if(typeof document>"u")return;const a=document.documentElement.style.overflow,l=document.body.style.overflow;document.documentElement.style.overflow="hidden",document.body.style.overflow="hidden",(u=t.current)==null||u.focus();const o=f=>{f.key==="Escape"&&(f.preventDefault(),e())};return window.addEventListener("keydown",o),()=>{window.removeEventListener("keydown",o),document.documentElement.style.overflow=a,document.body.style.overflow=l}},[e]),i.jsx("div",{ref:t,className:"settings-overlay",role:"dialog","aria-modal":"true","aria-label":"设置",tabIndex:-1,children:i.jsx(Q3,{mode:"overlay",onRequestClose:e})})},IC=()=>{const e=Ei();yp();const t=xa(p=>p.themeSettings),a=xa(p=>p.systemAppearance),l=xa(p=>p.setSystemAppearance),o=xa(p=>p.isSettingsOverlayOpen),u=xa(p=>p.closeSettingsOverlay),f=Ia({select:p=>p.location.pathname}),m=_.useRef(null),y=cc(),g=Bf(y),S=!!(y&&g);return _.useEffect(()=>{F3(t,a)},[a,t]),_.useEffect(()=>tC(l),[l]),_.useEffect(()=>{m_().catch(()=>{})},[]),_.useEffect(()=>{let p;return oE(v=>{e({to:v}).catch(()=>{typeof window<"u"&&window.location.assign(v)})}).then(v=>{p=v}),()=>{p==null||p()}},[e]),_.useEffect(()=>{if(!o){m.current=null;return}if(m.current===null){m.current=f;return}f!==m.current&&u()},[u,o,f]),dk()?i.jsx(Dk,{}):i.jsxs("div",{className:"app-shell",children:[S?null:i.jsx(zk,{}),i.jsx(pE,{}),i.jsx("div",{className:"app-shell__content","aria-hidden":o,children:i.jsx(Z2,{})}),o?i.jsx(OC,{onClose:u}):null]})};/**
69
+ * @license lucide-react v0.577.0 - ISC
70
+ *
71
+ * This source code is licensed under the ISC license.
72
+ * See the LICENSE file in the root directory of this source tree.
73
+ */const G3=(...e)=>e.filter((t,a,l)=>!!t&&t.trim()!==""&&l.indexOf(t)===a).join(" ").trim();/**
74
+ * @license lucide-react v0.577.0 - ISC
75
+ *
76
+ * This source code is licensed under the ISC license.
77
+ * See the LICENSE file in the root directory of this source tree.
78
+ */const LC=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
79
+ * @license lucide-react v0.577.0 - ISC
80
+ *
81
+ * This source code is licensed under the ISC license.
82
+ * See the LICENSE file in the root directory of this source tree.
83
+ */const PC=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,a,l)=>l?l.toUpperCase():a.toLowerCase());/**
84
+ * @license lucide-react v0.577.0 - ISC
85
+ *
86
+ * This source code is licensed under the ISC license.
87
+ * See the LICENSE file in the root directory of this source tree.
88
+ */const _b=e=>{const t=PC(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
89
+ * @license lucide-react v0.577.0 - ISC
90
+ *
91
+ * This source code is licensed under the ISC license.
92
+ * See the LICENSE file in the root directory of this source tree.
93
+ */var UC={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"};/**
94
+ * @license lucide-react v0.577.0 - ISC
95
+ *
96
+ * This source code is licensed under the ISC license.
97
+ * See the LICENSE file in the root directory of this source tree.
98
+ */const zC=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};/**
99
+ * @license lucide-react v0.577.0 - ISC
100
+ *
101
+ * This source code is licensed under the ISC license.
102
+ * See the LICENSE file in the root directory of this source tree.
103
+ */const BC=_.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:a=2,absoluteStrokeWidth:l,className:o="",children:u,iconNode:f,...m},y)=>_.createElement("svg",{ref:y,...UC,width:t,height:t,stroke:e,strokeWidth:l?Number(a)*24/Number(t):a,className:G3("lucide",o),...!u&&!zC(m)&&{"aria-hidden":"true"},...m},[...f.map(([g,S])=>_.createElement(g,S)),...Array.isArray(u)?u:[u]]));/**
104
+ * @license lucide-react v0.577.0 - ISC
105
+ *
106
+ * This source code is licensed under the ISC license.
107
+ * See the LICENSE file in the root directory of this source tree.
108
+ */const Sp=(e,t)=>{const a=_.forwardRef(({className:l,...o},u)=>_.createElement(BC,{ref:u,iconNode:t,className:G3(`lucide-${LC(_b(e))}`,`lucide-${e}`,l),...o}));return a.displayName=_b(e),a};/**
109
+ * @license lucide-react v0.577.0 - ISC
110
+ *
111
+ * This source code is licensed under the ISC license.
112
+ * See the LICENSE file in the root directory of this source tree.
113
+ */const HC=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}],["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"}]],$C=Sp("pencil-line",HC);/**
114
+ * @license lucide-react v0.577.0 - ISC
115
+ *
116
+ * This source code is licensed under the ISC license.
117
+ * See the LICENSE file in the root directory of this source tree.
118
+ */const FC=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],qC=Sp("pin",FC);/**
119
+ * @license lucide-react v0.577.0 - ISC
120
+ *
121
+ * This source code is licensed under the ISC license.
122
+ * See the LICENSE file in the root directory of this source tree.
123
+ */const WC=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],KC=Sp("rotate-cw",WC);/**
124
+ * @license lucide-react v0.577.0 - ISC
125
+ *
126
+ * This source code is licensed under the ISC license.
127
+ * See the LICENSE file in the root directory of this source tree.
128
+ */const QC=[["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"}]],Y3=Sp("trash-2",QC),yg=({message:e})=>i.jsx("p",{className:"empty-copy",children:e}),GC=async e=>(await xn()).client.updateAgent({agentId:e.agentId,action:e.action,displayName:e.displayName??null}),YC=(e,t,a)=>e&&{...e,agents:e.agents.map(l=>l.id===t?{...l,...a}:l)},VC=(e,t)=>e&&{...e,agents:e.agents.filter(a=>a.id!==t)},ZC=()=>{var R,H;const e=Ei(),t=La(),{data:a,isPending:l,isFetching:o,error:u}=w_(),[f,m]=_.useState(!1),[y,g]=_.useState(null),[S,p]=_.useState(""),[v,w]=_.useState(null),[N,j]=_.useState(null),[T,A]=_.useState(null),[U,I]=_.useState(null),[E,L]=_.useState(!1),W=a??T,ee=(W==null?void 0:W.agents)??[];_.useEffect(()=>{let X=!1;return xn().then(oe=>{X||m(oe.mode==="hub")}).catch(()=>{X||m(!1)}),()=>{X=!0}},[]),_.useEffect(()=>{a&&(A(a),I(null))},[a]),_.useEffect(()=>{if(a||E)return;let X=!1;const oe=window.setTimeout(()=>{X||(L(!0),I(null),t.removeQueries({queryKey:Ki}),s3(t).then(ie=>{X||A(ie)}).catch(ie=>{X||I(ie instanceof Error?ie.message:"节点列表刷新失败")}).finally(()=>{X||L(!1)}))},1200);return()=>{X=!0,window.clearTimeout(oe)}},[t,a,E]);const F=_.useMemo(()=>ee.find(X=>X.id===y)??null,[ee,y]),G=_.useMemo(()=>ee.find(X=>X.id===v)??null,[ee,v]),Q=ss({mutationFn:GC,onMutate:async X=>{j(null),await t.cancelQueries({queryKey:Ki});const oe=t.getQueryData(Ki);return X.action==="rename"&&t.setQueryData(Ki,ie=>{var k;return YC(ie,X.agentId,{display_name:((k=X.displayName)==null?void 0:k.trim())||null})}),X.action==="delete"&&t.setQueryData(Ki,ie=>VC(ie,X.agentId)),{previousSnapshot:oe}},onSuccess:(X,oe)=>{oe.action==="rename"&&(g(null),p("")),oe.action==="delete"&&w(null)},onError:(X,oe,ie)=>{ie!=null&&ie.previousSnapshot&&t.setQueryData(Ki,ie.previousSnapshot),j(X instanceof Error?X.message:"节点操作失败")},onSettled:async()=>{await t.invalidateQueries({queryKey:Ki})}}),Y=Q.isPending?((R=Q.variables)==null?void 0:R.action)??null:null,pe=Q.isPending?((H=Q.variables)==null?void 0:H.agentId)??null:null,ne=X=>{Zi(X.id),na(null),Wr(null),uu(null),rf(!1),VN({agentId:X.id,name:X.name,displayName:X.display_name??null,directBaseUrl:X.direct_base_url,wsBaseUrl:X.ws_base_url,createdAt:new Date().toISOString()}),e({to:"/"})},V=F&&typeof document<"u"?ki.createPortal(i.jsxs("div",{className:"sheet-wrap sheet-wrap--centered",role:"dialog","aria-modal":"true",children:[i.jsx("button",{type:"button",className:"sheet-wrap__scrim",onClick:()=>{g(null),p(""),j(null)},"aria-label":"关闭节点备注面板"}),i.jsx("div",{className:"sheet-wrap__center",children:i.jsxs("div",{className:"sheet-panel sheet-panel--form sheet-panel--centered node-sheet",children:[i.jsx("div",{className:"node-sheet__eyebrow",children:"节点备注"}),i.jsx("div",{className:"sheet-panel__title",children:"修改显示名称"}),i.jsx("p",{className:"node-sheet__description",children:"留空后会恢复显示为原始节点名。"}),i.jsxs("div",{className:"node-sheet__meta",children:[i.jsx("span",{children:F.name}),i.jsx("span",{children:dg(F)})]}),i.jsx("input",{className:"sheet-panel__input",value:S,onChange:X=>p(X.target.value),placeholder:F.name,autoFocus:!0}),N?i.jsx("p",{className:"error-text",children:N}):null,i.jsxs("div",{className:"sheet-panel__actions",children:[i.jsx("button",{type:"button",className:"sheet-panel__button",onClick:()=>{g(null),p(""),j(null)},children:"取消"}),i.jsx("button",{type:"button",className:"sheet-panel__button is-primary",disabled:Y==="rename"&&pe===F.id,onClick:()=>{Q.mutate({agentId:F.id,action:"rename",displayName:S.trim()||null})},children:Y==="rename"&&pe===F.id?"保存中...":"保存"})]})]})})]}),document.body):null,ye=G&&typeof document<"u"?ki.createPortal(i.jsxs("div",{className:"sheet-wrap sheet-wrap--centered",role:"dialog","aria-modal":"true",children:[i.jsx("button",{type:"button",className:"sheet-wrap__scrim",onClick:()=>{w(null),j(null)},"aria-label":"关闭删除节点面板"}),i.jsx("div",{className:"sheet-wrap__center",children:i.jsxs("div",{className:"sheet-panel sheet-panel--form sheet-panel--centered node-sheet node-sheet--danger",children:[i.jsx("div",{className:"node-sheet__eyebrow is-danger",children:"删除注册"}),i.jsx("div",{className:"sheet-panel__title",children:"确认移除这个节点?"}),i.jsx("p",{className:"node-sheet__description",children:"这只会删除当前 Hub 里的注册记录,不会删除远端机器。agent 重新注册后可以再次加入。"}),i.jsxs("div",{className:"node-sheet__meta",children:[i.jsx("span",{children:ac(G)}),i.jsx("span",{children:dg(G)})]}),N?i.jsx("p",{className:"error-text",children:N}):null,i.jsxs("div",{className:"sheet-panel__actions",children:[i.jsx("button",{type:"button",className:"sheet-panel__button",onClick:()=>{w(null),j(null)},children:"取消"}),i.jsx("button",{type:"button",className:"sheet-panel__button node-sheet__button-danger",disabled:Y==="delete"&&pe===G.id,onClick:()=>{Q.mutate({agentId:G.id,action:"delete"})},children:Y==="delete"&&pe===G.id?"删除中...":"确认删除"})]})]})})]}),document.body):null;return i.jsxs("div",{className:"nodes-screen",children:[i.jsxs("div",{className:"nodes-screen__header",children:[i.jsx("h1",{children:"节点列表"}),i.jsx("p",{children:"查看所有在线节点和局域网地址"})]}),i.jsx("div",{className:"nodes-screen__content node-list",children:!W&&(l||o||E)?i.jsx(yg,{message:"正在读取节点列表..."}):!W&&(u||U)?i.jsx(yg,{message:u instanceof Error?u.message:U??"节点列表加载失败"}):ee.length===0?i.jsx(yg,{message:"暂无节点"}):ee.map(X=>{const oe=HN(X),ie=ac(X),k=Y==="rename"&&pe===X.id,K=Y==="delete"&&pe===X.id;return i.jsxs("article",{className:`node-card ${f?"node-card--manageable":""}`,children:[i.jsxs("button",{type:"button",className:"node-card__surface",onClick:()=>ne(X),children:[i.jsxs("div",{className:"node-card__title-stack",children:[i.jsx("strong",{children:ie}),oe?i.jsxs("span",{className:"node-card__secondary-name",children:["原名称 · ",oe]}):null]}),i.jsx("div",{className:"node-card__ip",children:dg(X)})]}),i.jsxs("div",{className:"node-card__rail",children:[i.jsx("span",{className:`node-status-dot ${X.status}`,"aria-label":X.status==="online"?"节点在线":"节点离线",title:X.status==="online"?"节点在线":"节点离线"}),f?i.jsxs("div",{className:"node-card__actions",children:[i.jsx("button",{type:"button",className:"node-card__icon-button","aria-label":`修改 ${ie} 的备注名称`,title:"修改备注名称",disabled:K,onClick:()=>{w(null),j(null),g(X.id),p(X.display_name??"")},children:i.jsx($C,{size:16,strokeWidth:2})}),i.jsx("button",{type:"button",className:"node-card__icon-button is-danger","aria-label":`删除 ${ie} 节点注册`,title:"删除注册节点",disabled:k,onClick:()=>{g(null),p(""),j(null),w(X.id)},children:i.jsx(Y3,{size:16,strokeWidth:2})})]}):null]})]},X.id)})}),V,ye]})};function XC(e){return is({queryKey:(e==null?void 0:e.queryKey)??Ik,queryFn:async()=>(await xn(e==null?void 0:e.scope)).client.getPhaseOneSnapshot({fallbackToMock:!1}),refetchInterval:3e5,refetchOnWindowFocus:!1,retry:1})}const JC=(e,t)=>{for(const[,a]of e){const l=a==null?void 0:a.sessions.find(o=>o.id===t);if(l!=null&&l.agent_id)return l.agent_id}return null},eT=()=>{var y,g;const{sessionId:e}=$u({strict:!1}),t=Ei(),a=La(),l=o_(e),o=XC({queryKey:["session-route-bridge",e??""]}),u=e?JC(a.getQueriesData({queryKey:rs}),e):null,f=e?((g=(y=o.data)==null?void 0:y.sessions.find(S=>S.id===e))==null?void 0:g.agent_id)??null:null,m=(l==null?void 0:l.agentId)??u??f??cc();return _.useEffect(()=>{if(!e){t({to:"/",replace:!0});return}!m&&(o.isPending||o.isFetching)||(na(e),Wr(e),m&&Zi(m),t({to:"/",replace:!0}))},[t,m,e,o.isFetching,o.isPending]),null},tT=(e,t)=>e==="offline"?"offline":e==="online"&&t==="connected"?"online":e==="online"?"reconnecting":"offline",nT=e=>{switch(e){case"online":return"节点在线";case"reconnecting":return"节点重连中";case"offline":return"节点离线";default:return"节点状态未知"}};function V3(e){return is(n3(e))}const sT=24,j0={sessions:[],nextCursor:null,totalCount:0,isLoading:!1,error:null,initialized:!1},Z3=e=>e.trim(),aT=e=>[...e].sort((t,a)=>Number(a.pinned)-Number(t.pinned)||+new Date(a.last_event_at)-+new Date(t.last_event_at)),iT=(e,t)=>{const a=new Map;for(const l of e)a.set(l.id,l);for(const l of t)a.set(l.id,l);return aT([...a.values()])},mm=(e,t)=>e[Z3(t)]??j0;function X3(e){var g,S,p;const[t,a]=_.useState({}),[l,o]=_.useState({}),u=_.useCallback(()=>{a({}),o({})},[]);_.useEffect(()=>{u()},[(g=e==null?void 0:e.scope)==null?void 0:g.agentId,(S=e==null?void 0:e.scope)==null?void 0:S.projectId,(p=e==null?void 0:e.scope)==null?void 0:p.sessionId,e==null?void 0:e.selectedSessionId,u]);const f=_.useCallback(async(v,w)=>{const N=Z3(w);if(!N)return;const j=v==="history"?a:o,T=mm(v==="history"?t:l,N);if(!T.isLoading&&!(T.initialized&&T.nextCursor===null)){j(A=>({...A,[N]:{...mm(A,N),isLoading:!0,error:null}}));try{const U=await(await xn(e==null?void 0:e.scope)).client.getWorkspaceSessionPage({bucket:v,projectId:N,cursor:T.initialized?T.nextCursor:null,limit:sT,selectedSessionId:(e==null?void 0:e.selectedSessionId)??null});j(I=>{const E=mm(I,N);return{...I,[N]:{sessions:iT(E.sessions,U.sessions),nextCursor:U.next_cursor,totalCount:U.total_count,isLoading:!1,error:null,initialized:!0}}})}catch(A){j(U=>({...U,[N]:{...mm(U,N),isLoading:!1,error:A instanceof Error?A.message:"加载会话分页失败",initialized:!0}}))}}},[l,t,e==null?void 0:e.scope,e==null?void 0:e.selectedSessionId]),m=_.useCallback(async v=>{await f("history",v)},[f]),y=_.useCallback(async v=>{await f("archived",v)},[f]);return{historyState:t,archivedState:l,loadMoreHistory:m,loadMoreArchived:y,reset:u}}const rT=180*1e3,ou=6,J3="panda:completed-session-seen-at",vg=6,lT=220,pm=e=>{e.cancelable&&e.preventDefault()},yb=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"M3 7.5A2.5 2.5 0 0 1 5.5 5H10l2 2h6.5A2.5 2.5 0 0 1 21 9.5v8A2.5 2.5 0 0 1 18.5 20h-13A2.5 2.5 0 0 1 3 17.5z"})}),oT=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:i.jsx("path",{d:"M12 5v14M5 12h14"})}),cT=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("rect",{x:"3",y:"4",width:"6",height:"6",rx:"1.5"}),i.jsx("rect",{x:"15",y:"4",width:"6",height:"6",rx:"1.5"}),i.jsx("rect",{x:"3",y:"14",width:"6",height:"6",rx:"1.5"}),i.jsx("rect",{x:"15",y:"14",width:"6",height:"6",rx:"1.5"})]}),uT=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"M5 6.5A2.5 2.5 0 0 1 7.5 4h9A2.5 2.5 0 0 1 19 6.5v6A2.5 2.5 0 0 1 16.5 15H11l-4.5 4v-4H7.5A2.5 2.5 0 0 1 5 12.5z"})}),dT=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M3 7.5A2.5 2.5 0 0 1 5.5 5H10l2 2h6.5A2.5 2.5 0 0 1 21 9.5v8A2.5 2.5 0 0 1 18.5 20h-13A2.5 2.5 0 0 1 3 17.5z"}),i.jsx("path",{d:"M16.5 10.5v5"}),i.jsx("path",{d:"M14 13h5"})]}),vb=({open:e})=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:e?"is-open":"",children:i.jsx("path",{d:"m9 6 6 6-6 6"})}),fT=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"m9 6 6 6-6 6"})}),hT=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"m15 6-6 6 6 6"})}),mT=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M10.33 4.32c.6-1.76 2.74-1.76 3.34 0a1.78 1.78 0 0 0 2.66 1l.18-.1c1.6-.92 3.4.88 2.48 2.48l-.1.18a1.78 1.78 0 0 0 1 2.66c1.76.6 1.76 2.74 0 3.34a1.78 1.78 0 0 0-1 2.66l.1.18c.92 1.6-.88 3.4-2.48 2.48l-.18-.1a1.78 1.78 0 0 0-2.66 1c-.6 1.76-2.74 1.76-3.34 0a1.78 1.78 0 0 0-2.66-1l-.18.1c-1.6.92-3.4-.88-2.48-2.48l.1-.18a1.78 1.78 0 0 0-1-2.66c-1.76-.6-1.76-2.74 0-3.34a1.78 1.78 0 0 0 1-2.66l-.1-.18c-.92-1.6.88-3.4 2.48-2.48l.18.1a1.78 1.78 0 0 0 2.66-1Z"}),i.jsx("circle",{cx:"12",cy:"12",r:"3.15"})]}),pT=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("circle",{cx:"6",cy:"12",r:"1",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"12",cy:"12",r:"1",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"18",cy:"12",r:"1",fill:"currentColor",stroke:"none"})]}),gT=e=>{const t=Date.now(),a=new Date(e).getTime(),l=Math.max(0,t-a),o=60*1e3,u=60*o,f=24*u;return l<u?`${Math.max(1,Math.floor(l/o))}分钟`:l<f?`${Math.max(1,Math.floor(l/u))}小时`:`${Math.max(1,Math.floor(l/f))}天`},bg=e=>e.run_state==="completed"&&e.run_state_changed_at&&Date.now()-new Date(e.run_state_changed_at).getTime()>rT?"idle":e.run_state??"idle",_T=(e,t)=>Number(t.pinned)-Number(e.pinned)||+new Date(t.last_event_at)-+new Date(e.last_event_at),yT=(e,t)=>{if(e.length<=ou)return e;if(!t)return e.slice(0,ou);const a=e.findIndex(l=>l.id===t);return a===-1||a<ou?e.slice(0,ou):[...e.slice(0,ou-1),e[a]]},vT=()=>{if(typeof window>"u")return{};try{const e=window.localStorage.getItem(J3);if(!e)return{};const t=JSON.parse(e);return t&&typeof t=="object"?t:{}}catch{return{}}},xg=(e,t)=>e.length===t.length&&e.every((a,l)=>a===t[l]),bT=(e,t)=>{if(!t||t.length===0||e.length<=1)return e;const a=new Map(e.map(u=>[u.id,u])),l=new Set,o=[];for(const u of t){const f=a.get(u);!f||l.has(u)||(l.add(u),o.push(f))}for(const u of e)l.has(u.id)||o.push(u);return o},xT=(e,t,a)=>{if(t<0||t>=e.length||a<0||a>=e.length||t===a)return e;const l=[...e],[o]=l.splice(t,1);return o?(l.splice(a,0,o),l):e},ST=(e,t,a)=>{if(t.length===0)return e;const l=new Set(t);let o=0;return e.map(u=>{if(!l.has(u))return u;const f=a[o]??u;return o+=1,f})},Jc=(e,t)=>`${e}:${t}`,e5=_.memo(function({open:t,progress:a=t?1:0,isDragging:l=!1,desktopPinned:o=!1,isDesktopResizing:u=!1,onClose:f,onDesktopResizeStart:m,currentAgent:y,agentIndicatorState:g,projects:S,sessions:p,projectStats:v=[],historySessionsByProject:w={},archivedSessionsByProject:N={},historyPageStateByProject:j={},archivedPageStateByProject:T={},activeSessionId:A,onCreateSession:U,onCreateDirectoryThread:I,onSelectSession:E,onSessionAction:L,onThreadAction:W,onOpenSettings:ee,onLoadMoreHistory:F,onLoadMoreArchived:G,pendingSessionActionId:Q,pendingThreadActionId:Y}){const pe=Ei(),ne=a>.001,V=!!y,ye=V?g??((y==null?void 0:y.status)==="online"?"online":"offline"):null,R=ye?nT(ye):"未选择节点",H=_.useRef({threads:null,archived:null}),X=_.useRef({}),oe=_.useRef(null),ie=_.useRef(null),k=_.useRef(null),K=_.useRef(null),_e=_.useRef(null),fe=_.useRef({}),Te=_.useRef(null),[re,we]=_.useState({}),[ve,ze]=_.useState(null),[Be,St]=_.useState(null),Ke=_.useMemo(()=>p.map(P=>{const be=re[P.id];return be?{...P,...be.pinned===void 0?null:{pinned:be.pinned}}:P}).filter(P=>{var be;return!((be=re[P.id])!=null&&be.hidden)}),[re,p]),tt=_.useMemo(()=>new Map(v.map(P=>[P.project_id,P])),[v]),nn=(Be==null?void 0:Be.nextGlobalProjectIds)??ve,Xt=_.useMemo(()=>bT(S,nn),[S,nn]),jn=_.useMemo(()=>Ke.filter(P=>!P.subagent),[Ke]),zt=jn.find(P=>P.id===A),Bt=zt==null?void 0:zt.project_id,[_t,vt]=_.useState(Bt?[Bt]:[]),[dt,cn]=_.useState("threads"),[Pn,ke]=_.useState(null),[Z,me]=_.useState(null),[Ce,Oe]=_.useState(null),[le,Ae]=_.useState(null),[qe,bt]=_.useState([]),[At,ce]=_.useState(null),[Me,Re]=_.useState(""),[We,Xe]=_.useState(()=>vT()),Je=_.useMemo(()=>jn.filter(P=>!P.archived),[jn]),Tt=_.useMemo(()=>Je.filter(P=>P.pinned).sort((P,be)=>+new Date(be.last_event_at)-+new Date(P.last_event_at)),[Je]),Wt=_.useMemo(()=>Je.filter(P=>!P.pinned),[Je]),ls=P=>Xt.map(be=>{var as;const Le=tt.get(be.id),He=P==="threads"?Wt.filter(In=>In.project_id===be.id):N[be.id]??[],Ge=P==="threads"?w[be.id]??[]:[],ht=[...He];for(const In of Ge)ht.some(pn=>pn.id===In.id)||ht.push(In);const mt=ht.sort((In,pn)=>_T(In,pn)),ot=P==="threads"?j[be.id]??j0:T[be.id]??j0,Xn=P==="threads"?mt.length+Math.max(0,(Le==null?void 0:Le.hidden_history_count)??0):Math.max(mt.length,(Le==null?void 0:Le.archived_session_count)??0),Jt=P==="threads"?Math.max(0,((Le==null?void 0:Le.hidden_history_count)??0)-ot.sessions.length):Math.max(0,((Le==null?void 0:Le.archived_session_count)??0)-ot.sessions.length),Jn=((as=mt[0])==null?void 0:as.last_event_at)??new Date(0).toISOString();return{project:be,threadSessions:mt,collapsedThreadSessions:yT(mt,A),hiddenSessionCount:Math.max(0,mt.length-ou),totalSessionCount:Xn,pageState:ot,remainingPageCount:Jt,latestEventAt:Jn}}).filter(({totalSessionCount:be})=>be>0),Nt=_.useMemo(()=>ls("threads"),[A,T,N,j,w,Xt,tt,Wt]),Un=_.useMemo(()=>ls("archived"),[A,T,N,j,w,Xt,tt,Wt]);_.useEffect(()=>{we(P=>{let be=!1;const Le={...P};for(const[He,Ge]of Object.entries(P)){const ht=p.find(ot=>ot.id===He);if(!ht){Ge.hidden&&(delete Le[He],be=!0);continue}(Ge.pinned===void 0||ht.pinned===Ge.pinned)&&!Ge.hidden&&(delete Le[He],be=!0)}return be?Le:P})},[p]),_.useEffect(()=>{ze(P=>{if(!P)return P;const be=S.map(He=>He.id),Le=[...P.filter(He=>be.includes(He)),...be.filter(He=>!P.includes(He))];return xg(Le,be)?null:Le})},[S]),_.useEffect(()=>{Bt&&vt(P=>P.includes(Bt)?P:[...P,Bt])},[Bt]),_.useEffect(()=>{cn(zt!=null&&zt.archived?"archived":"threads")},[zt==null?void 0:zt.archived,A]),_.useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(J3,JSON.stringify(We))}catch{}},[We]),_.useEffect(()=>{t||o||(Oe(null),Ae(null),ce(null),me(null))},[o,t]),_.useEffect(()=>{if(!o||!Ce)return;const P=be=>{const Le=be.target;if(!(Le instanceof Element)){Oe(null);return}Le.closest(".thread-group__menu-anchor")||Le.closest(".thread-group__menu")||Oe(null)};return window.addEventListener("pointerdown",P),()=>{window.removeEventListener("pointerdown",P)}},[o,Ce]),_.useEffect(()=>{if(!A)return;const P=jn.find(Le=>Le.id===A);if(!P||bg(P)!=="completed"||!P.run_state_changed_at)return;const be=P.run_state_changed_at;Xe(Le=>Le[P.id]===be?Le:{...Le,[P.id]:be})},[A,jn]),_.useEffect(()=>()=>{oe.current!==null&&globalThis.clearTimeout(oe.current),Dn(),Te.current!==null&&window.cancelAnimationFrame(Te.current)},[]),_.useEffect(()=>{K.current=Be},[Be]),_.useLayoutEffect(()=>{if(typeof window>"u")return;const P={},be=[],Le=Be?Jc(Be.pane,Be.projectId):null;for(const[He,Ge]of Object.entries(X.current)){if(!Ge)continue;const ht=Ge.offsetTop;if(P[He]=ht,Le===He)continue;const mt=fe.current[He];if(mt===void 0)continue;const ot=mt-ht;Math.abs(ot)<.5||(Ge.style.transition="none",Ge.style.transform=`translateY(${ot}px)`,be.push(Ge))}Te.current!==null&&window.cancelAnimationFrame(Te.current),be.length>0&&(Te.current=window.requestAnimationFrame(()=>{for(const He of be)He.style.transition="",He.style.transform=""})),fe.current=P},[Nt,Un,_t,qe,Be==null?void 0:Be.projectId,nn]);const Cn=()=>{oe.current!==null&&(globalThis.clearTimeout(oe.current),oe.current=null)},Dn=()=>{const P=k.current;P&&(P.removeEventListener("selectstart",pm),P.removeEventListener("contextmenu",pm),k.current=null)},De=P=>P==="threads"?Nt:Un,Qt=(P,be,Le,He,Ge)=>{const ht=H.current[be],mt=X.current[Jc(be,P)];if(!ht||!mt)return!1;const ot=De(be).map(et=>et.project.id),Xn=ot.indexOf(P);if(Xn===-1)return!1;const Jt=Xt.map(et=>et.id),Jn=ht.getBoundingClientRect(),as=mt.getBoundingClientRect(),In=mt.offsetHeight,pn=mt.offsetWidth,sn=Ge-as.top,wn=ht.scrollTop,xs=Math.max(wn,ht.scrollTop+ht.clientHeight-In),D=Math.max(wn,Math.min(xs,ht.scrollTop+Ge-Jn.top-sn)),he={pane:be,projectId:P,pointerId:Le,pointerType:He,originIndex:Xn,visibleProjectIds:ot,nextVisibleProjectIds:ot,nextGlobalProjectIds:Jt,previewTop:D,itemHeight:In,itemWidth:pn,pointerOffsetY:sn};return K.current=he,St(he),_e.current=P,!0},On=P=>{St(be=>{if(!be)return be;K.current=be;const Le=H.current[be.pane];if(!Le||!X.current[Jc(be.pane,be.projectId)])return be;const He=Le.getBoundingClientRect(),Ge=Le.scrollTop,ht=Math.max(Ge,Le.scrollTop+Le.clientHeight-be.itemHeight),mt=Math.max(Ge,Math.min(ht,Le.scrollTop+P-He.top-be.pointerOffsetY)),ot=mt+be.itemHeight/2,Xn=be.nextVisibleProjectIds,Jt=Xn.indexOf(be.projectId);if(Jt===-1)return be;const Jn=Xn.filter(D=>D!==be.projectId);let as=0;const In=Jn[0],pn=In?X.current[Jc(be.pane,In)]:null;if(pn&&mt<=pn.offsetTop+pn.offsetHeight*.42)as=0;else for(let D=0;D<Jn.length;D+=1){const he=Jn[D],et=he?X.current[Jc(be.pane,he)]:null;if(!et){as=D+1;continue}const It=et.offsetTop+et.offsetHeight/2;if(ot<=It){as=D;break}as=D+1}const sn=xT(Xn,Jt,as),wn=ST(be.nextGlobalProjectIds,be.visibleProjectIds,sn);if(mt===be.previewTop&&xg(sn,be.nextVisibleProjectIds))return be;const xs={...be,previewTop:mt,nextVisibleProjectIds:sn,nextGlobalProjectIds:wn};return K.current=xs,xs})},Ts=P=>{Cn(),Dn(),ie.current=null;const be=P??K.current;if(K.current=null,St(null),!be||!!xg(be.visibleProjectIds,be.nextVisibleProjectIds)||!W)return;const He=ve??Xt.map(ht=>ht.id),Ge=be.nextGlobalProjectIds;ze(Ge),Promise.resolve(W(be.projectId,"reorder",{orderedProjectIds:Ge})).catch(()=>{ze(He)})},Ua=()=>{Cn(),Dn(),ie.current=null,K.current=null,St(null)};_.useEffect(()=>{if(typeof window>"u"||!K.current)return;const P=He=>{const Ge=K.current;!Ge||Ge.pointerId!==He.pointerId||On(He.clientY)},be=He=>{const Ge=K.current;!Ge||Ge.pointerId!==He.pointerId||Ts(Ge)},Le=He=>{const Ge=K.current;!Ge||Ge.pointerId!==He.pointerId||Ua()};return window.addEventListener("pointermove",P),window.addEventListener("pointerup",be),window.addEventListener("pointercancel",Le),()=>{window.removeEventListener("pointermove",P),window.removeEventListener("pointerup",be),window.removeEventListener("pointercancel",Le)}},[Be==null?void 0:Be.pointerId]);const Us=P=>{vt(be=>be.includes(P)?be.filter(Le=>Le!==P):[...be,P])},Ci=P=>{if(_e.current===P){_e.current=null;return}Us(P)},Fn=(P,be,Le)=>{if(P.pointerType==="mouse"&&P.button!==0)return;Cn();const He=P.currentTarget;Dn(),P.pointerType==="touch"&&(k.current=He,He.addEventListener("selectstart",pm),He.addEventListener("contextmenu",pm)),ie.current={pane:Le,projectId:be,pointerId:P.pointerId,pointerType:P.pointerType,startX:P.clientX,startY:P.clientY,currentX:P.clientX,currentY:P.clientY},P.pointerType!=="touch"&&He.setPointerCapture(P.pointerId),P.pointerType==="touch"&&(oe.current=globalThis.setTimeout(()=>{const Ge=ie.current;if(!Ge||Ge.projectId!==be||Ge.pointerId!==P.pointerId)return;He.hasPointerCapture(P.pointerId)||He.setPointerCapture(P.pointerId),Qt(be,Le,P.pointerId,P.pointerType,Ge.currentY)&&On(Ge.currentY)},lT))},Ys=(P,be,Le)=>{const He=ie.current;if(!He||He.projectId!==be||He.pointerId!==P.pointerId||He.pane!==Le)return;if(He.currentX=P.clientX,He.currentY=P.clientY,(Be==null?void 0:Be.projectId)===be&&Be.pointerId===P.pointerId){P.preventDefault(),On(P.clientY);return}const Ge=P.clientX-He.startX,ht=P.clientY-He.startY;if(He.pointerType==="touch"){(Math.abs(Ge)>vg||Math.abs(ht)>vg)&&Cn();return}Math.abs(ht)<vg||Math.abs(ht)<Math.abs(Ge)||!Qt(be,Le,P.pointerId,P.pointerType,P.clientY)||(P.preventDefault(),On(P.clientY))},te=(P,be)=>{if(P.currentTarget.hasPointerCapture(P.pointerId)&&P.currentTarget.releasePointerCapture(P.pointerId),(Be==null?void 0:Be.projectId)===be&&Be.pointerId===P.pointerId){P.preventDefault(),Ts();return}Cn(),Dn(),ie.current=null},Ie=(P,be)=>{if(P.currentTarget.hasPointerCapture(P.pointerId)&&P.currentTarget.releasePointerCapture(P.pointerId),(Be==null?void 0:Be.projectId)===be&&Be.pointerId===P.pointerId){Ua();return}Cn(),Dn(),ie.current=null},$e=P=>{bt(be=>be.includes(P)?be.filter(Le=>Le!==P):[...be,P])},at=P=>{if(bg(P)!=="completed"||!P.run_state_changed_at)return;const be=P.run_state_changed_at;Xe(Le=>Le[P.id]===be?Le:{...Le,[P.id]:be})},ft=`translateX(-${(dt==="threads"?0:1)*50}%)`,Mt=At&&typeof document<"u"?ki.createPortal(i.jsxs("div",{className:"sheet-wrap sheet-wrap--centered",role:"dialog","aria-modal":"true",children:[i.jsx("button",{type:"button",className:"sheet-wrap__scrim",onClick:()=>{ce(null),Re("")},"aria-label":"关闭重命名面板"}),i.jsx("div",{className:"sheet-wrap__center",children:i.jsxs("div",{className:"sheet-panel sheet-panel--form sheet-panel--centered",children:[i.jsx("div",{className:"sheet-panel__title",children:"编辑线程名称"}),i.jsx("input",{className:"sheet-panel__input",value:Me,onChange:P=>Re(P.target.value),placeholder:"输入线程名称",autoFocus:!0}),i.jsxs("div",{className:"sheet-panel__actions",children:[i.jsx("button",{type:"button",className:"sheet-panel__button",onClick:()=>{ce(null),Re("")},children:"取消"}),i.jsx("button",{type:"button",className:"sheet-panel__button is-primary",disabled:!Me.trim()||Y===At,onClick:()=>{jt()},children:"保存"})]})]})})]}),document.body):null,qn=P=>{Oe(null),Ae(null),ce(P.id),Re(P.display_name??P.name)},jt=async()=>{!At||!Me.trim()||!W||(await W(At,"rename",{name:Me.trim()}),ce(null),Re(""))},zs=(P,be,Le)=>{if(!L)return;const He=re[P.id];be==="pin"||be==="unpin"?we(ht=>({...ht,[P.id]:{...ht[P.id],pinned:be==="pin"}})):be==="delete"&&we(ht=>({...ht,[P.id]:{...ht[P.id],hidden:!0}}));const Ge=L(P.id,be,Le);Ge&&typeof Ge.then=="function"&&Ge.catch(()=>{we(ht=>{const mt={...ht};return He?mt[P.id]=He:delete mt[P.id],mt})})},Kt=P=>{const be=bg(P),Le=be==="completed"&&P.id!==A&&!!P.run_state_changed_at&&We[P.id]!==P.run_state_changed_at,He=o&&Pn===P.id,Ge=!!L&&He,ht=Z===P.id,mt=o&&(Ge||ht);return i.jsxs("div",{className:`thread-session ${P.id===A?"is-active":""}`,onMouseEnter:()=>ke(P.id),onMouseLeave:()=>{ke(ot=>ot===P.id?null:ot),me(ot=>ot===P.id?null:ot)},children:[i.jsx("button",{type:"button",className:`thread-session__icon-button ${Ge?"is-visible":""} ${P.pinned?"is-active":""}`,disabled:Q===P.id,onClick:ot=>{ot.stopPropagation(),zs(P,P.pinned?"unpin":"pin")},"aria-label":P.pinned?"取消置顶会话":"置顶会话",title:P.pinned?"取消置顶":"置顶",children:i.jsx(qC,{strokeWidth:P.pinned?2.1:1.95})}),i.jsxs("div",{className:"thread-session__row",children:[E?i.jsxs("button",{type:"button",className:"thread-session__link thread-session__link--button",title:P.title,onClick:()=>{at(P),E(P.id),f()},children:[i.jsx("span",{className:`thread-session__status is-${Le?"completed":be} ${Le?"is-unread":""} ${mt?"is-hidden":""}`,"aria-hidden":"true"}),i.jsx("div",{className:"thread-session__title",children:P.title})]}):i.jsxs(qm,{to:"/session/$sessionId",params:{sessionId:P.id},title:P.title,onClick:()=>{at(P),f()},className:"thread-session__link",children:[i.jsx("span",{className:`thread-session__status is-${Le?"completed":be} ${Le?"is-unread":""} ${mt?"is-hidden":""}`,"aria-hidden":"true"}),i.jsx("div",{className:"thread-session__title",children:P.title})]}),i.jsx("div",{className:"thread-session__meta",children:o&&He&&L?ht?i.jsx("button",{type:"button",className:"thread-session__delete-confirm",disabled:Q===P.id,onClick:ot=>{ot.stopPropagation(),zs(P,"delete")},children:"确认"}):i.jsx("button",{type:"button",className:"thread-session__delete",disabled:Q===P.id,onClick:ot=>{ot.stopPropagation(),me(P.id)},"aria-label":`删除 ${P.title}`,children:i.jsx(Y3,{strokeWidth:1.95})}):i.jsx("span",{className:"thread-session__time",children:gT(P.last_event_at)})})]})]},P.id)},bs=({project:P,threadSessions:be,collapsedThreadSessions:Le,hiddenSessionCount:He,totalSessionCount:Ge,pageState:ht,remainingPageCount:mt},ot)=>{const Xn=Jc(ot,P.id),Jt=_t.includes(P.id),Jn=qe.includes(P.id),as=P.display_name??P.name,In=!!W&&o&&Ce===P.id,pn=!!W&&le===P.id,sn=ot==="archived",wn=Jn?be:Le,xs=He>0,D=mt>0,he=ot==="threads"?F:G,et=(Be==null?void 0:Be.projectId)===P.id&&Be.pane===ot,It=pn&&typeof document<"u"?ki.createPortal(i.jsxs("div",{className:"sheet-wrap",role:"dialog","aria-modal":"true",children:[i.jsx("button",{type:"button",className:"sheet-wrap__scrim",onClick:()=>Ae(null),"aria-label":"关闭线程菜单"}),i.jsxs("div",{className:"sheet-panel",children:[i.jsx("div",{className:"sheet-panel__title",children:as}),i.jsx("button",{type:"button",className:"sheet-panel__item",onClick:()=>qn(P),children:"编辑名称"}),i.jsx("button",{type:"button",className:"sheet-panel__item",disabled:Y===P.id,onClick:()=>{W==null||W(P.id,sn?"unarchive":"archive"),Ae(null)},children:sn?"取消归档":"归档线程"}),i.jsx("button",{type:"button",className:"sheet-panel__item is-danger",disabled:Y===P.id,onClick:()=>{W==null||W(P.id,"remove"),Ae(null)},children:"移除"})]})]}),document.body):null;return i.jsxs(_.Fragment,{children:[i.jsx("div",{ref:pt=>{X.current[Xn]=pt},className:`thread-group-shell ${et?"is-drag-placeholder":""}`,children:i.jsxs("section",{className:"thread-group",children:[i.jsxs("div",{className:"thread-group__header",children:[i.jsxs("button",{type:"button",className:"thread-group__title",onClick:()=>Ci(P.id),onPointerDown:pt=>Fn(pt,P.id,ot),onPointerMove:pt=>Ys(pt,P.id,ot),onPointerUp:pt=>te(pt,P.id),onPointerCancel:pt=>Ie(pt,P.id),"aria-expanded":Jt,title:as,children:[i.jsx("span",{className:"thread-group__chevron",children:i.jsx(vb,{open:Jt})}),i.jsx("span",{className:"thread-group__icon",children:i.jsx(yb,{})}),i.jsx("span",{className:"thread-group__title-text",children:as})]}),i.jsxs("div",{className:"thread-group__actions",children:[W?i.jsxs("div",{className:"thread-group__menu-anchor",children:[i.jsx("button",{type:"button",className:`thread-group__more ${In||pn?"is-open":""}`,onClick:pt=>{if(pt.stopPropagation(),o){Oe(ct=>ct===P.id?null:P.id);return}Ae(P.id)},"aria-label":`${as} 更多选项`,children:i.jsx(pT,{})}),In?i.jsxs("div",{className:"thread-group__menu",children:[i.jsx("button",{type:"button",className:"thread-group__menu-item",onClick:()=>qn(P),children:"编辑名称"}),i.jsx("button",{type:"button",className:"thread-group__menu-item",disabled:Y===P.id,onClick:()=>{W==null||W(P.id,sn?"unarchive":"archive"),Oe(null)},children:sn?"取消归档":"归档线程"}),i.jsx("button",{type:"button",className:"thread-group__menu-item is-danger",disabled:Y===P.id,onClick:()=>{W==null||W(P.id,"remove"),Oe(null)},children:"移除"})]}):null]}):null,i.jsx("button",{type:"button",className:"thread-group__add",onClick:pt=>{pt.stopPropagation(),U(P.id,P.name)},"aria-label":`在 ${P.name} 下新增会话`,children:i.jsx(oT,{})})]})]}),Jt?Ge===0?i.jsx("div",{className:"thread-group__empty",children:"这个线程还没有会话"}):i.jsxs(i.Fragment,{children:[wn.length>0?i.jsx("div",{className:"thread-group__sessions",children:wn.map(pt=>Kt(pt))}):i.jsx("div",{className:"thread-group__empty",children:ot==="archived"?"这个归档线程还没有已加载的会话":"这个线程还没有已加载的历史会话"}),xs?i.jsx("button",{type:"button",className:"thread-group__session-toggle",onClick:()=>$e(P.id),"aria-expanded":Jn,children:Jn?"折叠显示":"展开显示"}):null,D&&he?i.jsx("button",{type:"button",className:"thread-group__session-toggle",disabled:ht.isLoading,onClick:()=>{he(P.id)},children:ht.isLoading?"加载中...":ot==="archived"?`加载已归档会话 (${mt})`:`加载更早会话 (${mt})`}):null,ht.error?i.jsx("div",{className:"thread-group__empty",children:ht.error}):null]}):null]},P.id)}),It]},P.id)},Wn=P=>{if(!Be||Be.pane!==P)return null;const be=De(P).find(Ge=>Ge.project.id===Be.projectId);if(!be)return null;const Le={top:Be.previewTop,width:`${Be.itemWidth}px`},He=be.project.display_name??be.project.name;return i.jsx("div",{className:"thread-group-drag-preview",style:Le,"aria-hidden":"true",children:i.jsxs("div",{className:"thread-group-drag-preview__header",children:[i.jsx("span",{className:"thread-group-drag-preview__chevron",children:i.jsx(vb,{open:!0})}),i.jsx("span",{className:"thread-group-drag-preview__icon",children:i.jsx(yb,{})}),i.jsx("span",{className:"thread-group-drag-preview__title",children:He})]})})};return i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:`sidebar-scrim ${ne?"is-visible":""}`,style:{opacity:o?0:a,pointerEvents:o?"none":ne?"auto":"none",transition:l?"none":void 0},onClick:f,"aria-label":"关闭侧边栏"}),i.jsxs("aside",{className:`conversation-sidebar ${t?"is-open":""} ${o?"is-desktop-pinned":""} ${u?"is-resizing":""}`,style:{transform:o?"translateX(0)":`translateX(calc(-100% + ${Math.max(0,Math.min(a,1))*100}%))`,transition:l?"none":void 0},children:[o&&m?i.jsx("div",{className:"conversation-sidebar__resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"调整侧边栏宽度",onPointerDown:P=>{P.pointerType!=="touch"&&(P.preventDefault(),P.stopPropagation(),m(P.clientX))}}):null,i.jsxs("div",{className:"conversation-sidebar__header",children:[i.jsxs("div",{className:`conversation-sidebar__brand ${V&&ye?`is-${ye}`:"is-empty"}`,"aria-label":R,title:R,children:[V?i.jsx("span",{className:"conversation-sidebar__status-dot","aria-hidden":"true"}):null,i.jsx("span",{className:"conversation-sidebar__brand-name",children:y?ac(y):"未选择节点"})]}),o?null:i.jsx("button",{type:"button",className:"conversation-sidebar__close",onClick:f,"aria-label":"关闭",children:"×"})]}),i.jsxs("div",{className:"conversation-sidebar__actions",children:[i.jsxs(qm,{to:"/nodes",className:"sidebar-action",onClick:f,children:[i.jsx("span",{className:"sidebar-action__icon",children:i.jsx(cT,{})}),i.jsx("span",{children:"节点列表"})]}),i.jsxs("button",{type:"button",className:"sidebar-action sidebar-action--primary",onClick:()=>{f();const P=S.find(be=>be.id===Bt)??S[0];P?U(P.id,P.name):pe({to:"/nodes"})},children:[i.jsx("span",{className:"sidebar-action__icon",children:i.jsx(uT,{})}),i.jsx("span",{children:"新会话"})]})]}),i.jsx("div",{className:"conversation-sidebar__threads",children:i.jsxs("div",{className:"sidebar-pane-track",style:{transform:ft},children:[i.jsxs("div",{ref:P=>{H.current.threads=P},className:`sidebar-pane ${dt==="threads"?"is-active":"is-inactive"}`,children:[Tt.length>0?i.jsxs("div",{className:"sidebar-pinned",children:[i.jsx("div",{className:"conversation-sidebar__node",children:"置顶会话"}),i.jsx("div",{className:"sidebar-pinned__list",children:Tt.map(P=>Kt(P))})]}):null,i.jsxs("div",{className:"conversation-sidebar__node-row",children:[i.jsx("div",{className:"conversation-sidebar__node",children:"线程"}),I?i.jsx("button",{type:"button",className:"conversation-sidebar__node-action",onClick:I,"aria-label":"新增目录线程",title:"新增目录线程",children:i.jsx(dT,{})}):null]}),Nt.map(P=>bs(P,"threads")),Wn("threads"),i.jsxs("button",{type:"button",className:"thread-archive__toggle",onClick:()=>cn("archived"),children:[i.jsx("span",{children:"已归档"}),i.jsx("span",{className:"thread-archive__icon",children:i.jsx(fT,{})})]})]}),i.jsxs("div",{ref:P=>{H.current.archived=P},className:`sidebar-pane sidebar-pane--archived ${dt==="archived"?"is-active":"is-inactive"}`,children:[i.jsx("div",{className:"conversation-sidebar__node",children:"已归档的线程"}),Un.length>0?i.jsx("div",{className:"thread-archive__list",children:Un.map(P=>bs(P,"archived"))}):i.jsx("div",{className:"thread-archive__empty",children:"暂时没有已归档的线程"}),Wn("archived"),i.jsxs("button",{type:"button",className:"thread-archive__back",onClick:()=>cn("threads"),"aria-label":"返回线程列表",children:[i.jsx("span",{className:"thread-archive__back-icon",children:i.jsx(hT,{})}),i.jsx("span",{children:"返回"})]})]})]})}),i.jsx("div",{className:"conversation-sidebar__footer",children:i.jsxs("button",{type:"button",className:"sidebar-settings",onClick:()=>{f(),ee==null||ee()},"aria-label":"打开设置页",children:[i.jsx("span",{className:"sidebar-settings__icon",children:i.jsx(mT,{})}),i.jsx("span",{children:"设置"})]})})]}),Mt]})}),N_="optimistic-user:",jT="overlay-user:",wT=[N_,jT],NT=5e3,Lo=e=>["timeline-optimistic",e],jp=e=>e.kind==="user"&&wT.some(t=>e.id.startsWith(t)),k_=e=>e.kind==="user"&&!jp(e),E_=e=>e.kind==="user"&&e.id.startsWith(N_),kT=e=>e.kind==="user"&&!E_(e),bb=e=>e.body.replace(/\r\n/g,`
129
+ `).trim(),xb=e=>new Date(e).getTime(),wp=(e,t)=>{if(bb(e)!==bb(t))return!1;const a=xb(e.timestamp),l=xb(t.timestamp);return!Number.isFinite(a)||!Number.isFinite(l)?!0:l>=a-NT},ET=(e,t)=>{const a=t.filter(k_);if(a.length===0)return new Set;const l=new Set,o=new Set;for(const u of e??[]){if(!jp(u))continue;const f=a.findIndex((m,y)=>!l.has(y)&&wp(u,m));f<0||(l.add(f),o.add(u.id))}return o},CT=(e,t)=>{const a=t.map((u,f)=>({entry:u,index:f})).filter(({entry:u})=>k_(u));if(a.length===0)return new Map;const l=new Set,o=new Map;for(const u of e??[]){if(!jp(u))continue;const f=a.find(({entry:m,index:y})=>!l.has(y)&&wp(u,m));f&&(l.add(f.index),(u.attachments??[]).length!==0&&o.set(f.index,N6(f.entry.attachments,u.attachments)))}return o},TT=(e,t)=>{const a=t.filter(kT);if(a.length===0)return new Set;const l=new Set,o=new Set;for(const u of e??[]){if(!E_(u))continue;const f=a.findIndex((m,y)=>!l.has(y)&&wp(u,m));f<0||(l.add(f),o.add(u.id))}return o},MT=e=>{const t=[...e??[]],a=t.map((u,f)=>({entry:u,index:f})).filter(({entry:u})=>k_(u));if(a.length===0)return t;const l=new Set,o=new Set;for(const u of t){if(!jp(u))continue;const f=a.find(({entry:m,index:y})=>!l.has(y)&&wp(u,m));f&&(l.add(f.index),o.add(u.id))}return o.size===0?t:t.filter(u=>!o.has(u.id))},w0=(e,t)=>[...e??[],t],t5=(e,t)=>{const a=CT(e,t),l=ET(e,t),o=[...e??[]].filter(f=>!l.has(f.id)),u=new Set(o.map(f=>f.id));for(const[f,m]of t.entries())u.has(m.id)||(u.add(m.id),o.push(a.has(f)?{...m,attachments:a.get(f)??m.attachments}:m));return o},N0=(e,t)=>[...t5(e,t)].sort((a,l)=>{const o=new Date(a.timestamp).getTime(),u=new Date(l.timestamp).getTime();return!Number.isFinite(o)||!Number.isFinite(u)?0:o-u}),n5=(e,t)=>(e??[]).filter(a=>E_(a)&&!TT([a],t).has(a.id)),RT=(e,t)=>{const a=MT(e),l=n5(t,a);return N0(l,a)},AT=(e,t)=>{if(!e||e.session_id!==t.session_id)return{...t,entries:N0(void 0,t.entries)};const a=e.view==="full_compact"&&t.view==="tail",l=N0(e.entries,t.entries);return{session_id:t.session_id,generated_at:t.generated_at,view:a?e.view:t.view,anchor_entry_id:a?e.anchor_entry_id??t.anchor_entry_id:t.anchor_entry_id,has_earlier_entries:a?!1:t.has_earlier_entries,entries:l}},DT=(e,t)=>(e??[]).filter(a=>a.id!==t),s5="image/",OT=()=>`attachment-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,IT=e=>new Promise((t,a)=>{const l=new FileReader;l.onerror=()=>a(l.error??new Error("无法读取文件")),l.onload=()=>{if(typeof l.result=="string"&&l.result){t(l.result);return}a(new Error("无法读取文件"))},l.readAsDataURL(e)}),a5=async e=>({id:OT(),kind:e.type.startsWith(s5)?"image":"file",name:e.name,mime_type:e.type||null,size_bytes:Number.isFinite(e.size)?Math.max(0,Math.round(e.size)):null,data_url:await IT(e)}),Sb=e=>{var t;return e.kind==="image"||!!((t=e.mime_type)!=null&&t.startsWith(s5))},i5=e=>w6((e??[]).map((t,a)=>({id:t.id||`attachment-${a}`,kind:t.kind,name:t.name,mime_type:t.mime_type??null,size_bytes:t.size_bytes??null,content_url:t.data_url}))),k0=e=>typeof e!="number"||!Number.isFinite(e)||e<=0?null:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`,LT=/\[[^\]]+\]\([^)]+\)|`[^`\n]+`|\*\*.+?\*\*|\*[^*\n][^*\n]*\*|\$[A-Za-z0-9._-]+|\/[A-Za-z][A-Za-z0-9._-]*/g,PT=/^[A-Za-z0-9._-]$/,UT=/^[A-Za-z0-9._-]$/,E0=e=>/\s/.test(e),jb=e=>PT.test(e),zT=e=>UT.test(e),Oa=e=>e.trim().toLowerCase(),BT=e=>Oa(e).split(/[^a-z0-9]+/i).filter(Boolean),wb=e=>e==="repo"?0:e==="user"?1:2,HT=e=>e==="repo"?"项目":e==="user"?"个人":"系统",r5=e=>{const t=[];let a=0;for(const l of e.matchAll(LT)){const o=l[0],u=l.index??0;if(o.startsWith("$")){const f=u>0?e[u-1]??"":"";if(u>0&&!E0(f))continue}if(o.startsWith("/")){const f=u>0?e[u-1]??"":"";if(u>0&&!E0(f))continue}if(u>a&&t.push({kind:"text",value:e.slice(a,u)}),o.startsWith("`")&&o.endsWith("`"))t.push({kind:"code",value:o.slice(1,-1)});else if(o.startsWith("**")&&o.endsWith("**"))t.push({kind:"strong",value:o.slice(2,-2)});else if(o.startsWith("*")&&o.endsWith("*"))t.push({kind:"emphasis",value:o.slice(1,-1)});else if(o.startsWith("[")){const f=/^\[([^\]]+)\]\(([^)]+)\)$/.exec(o);f?t.push({kind:"path-link",label:f[1]??"",path:f[2]??""}):t.push({kind:"text",value:o})}else o.startsWith("/")?t.push({kind:"command",raw:o,name:o.slice(1)}):t.push({kind:"skill",raw:o,name:o.slice(1)});a=u+o.length}return a<e.length&&t.push({kind:"text",value:e.slice(a)}),t},l5=(e,t,a=t)=>{if(t!==a)return null;let l=t;for(;l>0&&jb(e[l-1]??"");)l-=1;const o=l-1;if(o<0||e[o]!=="$")return null;const u=o>0?e[o-1]??"":"";if(o>0&&!E0(u))return null;let f=t;for(;f<e.length&&jb(e[f]??"");)f+=1;return{start:o,end:f,query:e.slice(o+1,t)}},$T=(e,t,a,l)=>{const o=l5(e,t,a);if(!o)return null;const m=(e[o.end]??"").length===0?`$${l} `:`$${l}`,y=`${e.slice(0,o.start)}${m}${e.slice(o.end)}`,g=o.start+m.length;return{value:y,selectionStart:g,selectionEnd:g}},C_=e=>e.startsWith("/"),o5=(e,t,a=t)=>{if(!C_(e)||t!==a)return null;const l=e.search(/\s/),o=l<0?e.length:l;if(t>o)return null;let u=1;for(;u<e.length&&zT(e[u]??"");)u+=1;return t>u?null:{start:0,end:u,query:e.slice(1,t)}},FT=(e,t,a,l)=>{const o=o5(e,t,a);if(!o)return null;const m=(e[o.end]??"").length===0?`/${l} `:`/${l}`,y=`${e.slice(0,o.start)}${m}${e.slice(o.end)}`,g=o.start+m.length;return{value:y,selectionStart:g,selectionEnd:g}},qT=(e,t)=>{const a=Oa(t),l=e.filter(u=>{if(!u.enabled)return!1;if(!a)return!0;const f=Oa(u.name),m=Oa(u.description);return f.includes(a)||m.includes(a)}),o=u=>{if(!a)return 0;const f=Oa(u.name),m=Oa(u.description),y=BT(u.name);return f===a?0:y.some(g=>g===a)?1:f.startsWith(a)?2:y.some(g=>g.startsWith(a))?3:f.includes(a)?4:m.startsWith(a)?5:6};return[...l].sort((u,f)=>{const m=o(u),y=o(f);if(m!==y)return m-y;const g=wb(u.scope)-wb(f.scope);if(g!==0)return g;const S=Oa(u.name),p=Oa(f.name);return S.localeCompare(p)})},WT=(e,t)=>{const a=Oa(t);return[...e.filter(o=>{if(!a)return!0;const u=Oa(o.name),f=Oa(o.description);return u.includes(a)||f.includes(a)})].sort((o,u)=>{const f=Oa(o.name),m=Oa(u.name),y=f===a?0:f.startsWith(a)?1:2,g=m===a?0:m.startsWith(a)?1:2;return y!==g?y-g:o.availability!==u.availability?o.availability==="supported"?-1:1:f.localeCompare(m)})},Sg=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"M3 7.5A2.5 2.5 0 0 1 5.5 5H10l2 2h6.5A2.5 2.5 0 0 1 21 9.5v8A2.5 2.5 0 0 1 18.5 20h-13A2.5 2.5 0 0 1 3 17.5z"})}),KT=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"m9 6 6 6-6 6"})}),Nb=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"m5 12 4.5 4.5L19 7"})}),QT=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M6 6l12 12"}),i.jsx("path",{d:"M18 6 6 18"})]}),kb=e=>!!(e&&/^[A-Za-z]:[\\/]?$/.test(e.trim())),GT=({agentId:e,projects:t,initialPath:a=null,title:l="选择目录",subtitle:o="线程名会使用目录最后一级名称",confirmLabel:u="选择此目录",cancelLabel:f="返回上级",onProjectCreated:m})=>{const y=La(),[g,S]=_.useState(a),[p,v]=_.useState(a),[w,N]=_.useState([]),[j,T]=_.useState(!0),[A,U]=_.useState(null),[I,E]=_.useState(0),[L,W]=_.useState(!1),[ee,F]=_.useState(""),[G,Q]=_.useState(null),Y=_.useRef(null);_.useEffect(()=>{S(a),v(a)},[a]),_.useEffect(()=>{W(!1),F(""),Q(null),ne.reset()},[g]),_.useEffect(()=>{let ve=!1;return T(!0),U(null),v3({agentId:e,path:g}).then(ze=>{ve||N(ze)}).catch(ze=>{ve||(U(ze instanceof Error?ze.message:"目录列表加载失败"),N([]))}).finally(()=>{ve||T(!1)}),()=>{ve=!0}},[e,g,I]),_.useEffect(()=>{var ve,ze;L&&((ve=Y.current)==null||ve.focus(),(ze=Y.current)==null||ze.select())},[L]);const pe=ss({mutationFn:async ve=>yE({agentId:e,path:ve,projects:t,queryClient:y,bootstrapQueryKey:Lk}),onSuccess:ve=>{m(ve)}}),ne=ss({mutationFn:async ve=>_E({agentId:e,parentPath:ve.parentPath,name:ve.name}),onSuccess:({directory:ve})=>{W(!1),F(""),Q(null),v(ve.path),E(ze=>ze+1)}}),V=_.useMemo(()=>{const ve=new Map;for(const ze of t)ve.set(up(ze.path),ze);return ve},[t]),ye=_.useMemo(()=>p?V.get(up(p))??null:null,[V,p]),R=u!=="选择此目录"?u:ye?"在线程中继续":"创建新线程",H=y3(g),X=H!==null||kb(g),oe=!!g,ie=ee.trim(),k=G??(ne.error instanceof Error?ne.error.message:null),K=pe.error instanceof Error?pe.error.message:pe.error?"创建线程失败":null,_e=()=>{if(H!==null){S(H),v(H);return}kb(g)&&(S(null),v(null))},fe=ve=>{S(ve),v(ve)},Te=()=>{W(!1),F(""),Q(null),ne.reset()},re=()=>{g&&(ne.reset(),Q(null),F(""),W(!0))},we=()=>{if(g){if(!ie){Q("目录名称不能为空");return}Q(null),ne.mutate({parentPath:g,name:ie})}};return i.jsx("section",{className:"directory-picker",children:i.jsxs("div",{className:"directory-picker__panel",children:[i.jsx("header",{className:"directory-picker__header",children:i.jsxs("div",{className:"directory-picker__heading",children:[i.jsx("h2",{children:l}),o?i.jsx("p",{children:o}):null]})}),i.jsxs("div",{className:"directory-picker__field",children:[i.jsx("span",{className:"directory-picker__field-label",children:"当前路径"}),i.jsxs("button",{type:"button",className:`directory-picker__path ${p===g?"is-selected":""}`,onClick:()=>{g&&v(g)},disabled:!g,"aria-pressed":p===g,children:[i.jsx("span",{className:"directory-picker__path-icon",children:i.jsx(Sg,{})}),i.jsx("span",{className:"directory-picker__path-value",children:g??"根目录"})]})]}),i.jsxs("div",{className:"directory-picker__field",children:[i.jsx("span",{className:"directory-picker__field-label",children:"目录"}),i.jsx("div",{className:"directory-picker__list",role:"listbox","aria-label":"目录列表",children:j?i.jsx("div",{className:"directory-picker__state",children:"正在读取目录…"}):A?i.jsx("div",{className:"directory-picker__state is-error",children:A}):i.jsxs(i.Fragment,{children:[w.length===0&&!L?i.jsx("div",{className:"directory-picker__state",children:"当前目录下没有可用子目录"}):null,w.map(ve=>{const ze=p===ve.path;return i.jsxs("div",{className:`directory-picker__row ${ze?"is-selected":""}`,children:[i.jsxs("button",{type:"button",className:"directory-picker__row-main",onClick:Be=>{if(ve.has_children&&Be.detail>=2){fe(ve.path);return}v(ve.path)},"aria-selected":ze,children:[i.jsx("span",{className:"directory-picker__row-icon",children:i.jsx(Sg,{})}),i.jsx("span",{className:"directory-picker__row-name",children:ve.name}),!ve.has_children&&ze?i.jsx("span",{className:"directory-picker__row-check",children:i.jsx(Nb,{})}):null]}),ve.has_children?i.jsx("button",{type:"button",className:"directory-picker__row-enter-button","aria-label":`进入 ${ve.name}`,onClick:()=>fe(ve.path),children:i.jsx("span",{className:"directory-picker__row-enter","aria-hidden":"true",children:i.jsx(KT,{})})}):null]},ve.path)}),L?i.jsx("div",{className:"directory-picker__row is-creating",children:i.jsxs("div",{className:"directory-picker__row-editor",children:[i.jsx("span",{className:"directory-picker__row-icon",children:i.jsx(Sg,{})}),i.jsx("input",{ref:Y,type:"text",className:"directory-picker__row-input",value:ee,onChange:ve=>{F(ve.target.value),G&&Q(null),ne.error&&ne.reset()},onKeyDown:ve=>{ve.key==="Enter"&&(ve.preventDefault(),we()),ve.key==="Escape"&&(ve.preventDefault(),Te())},placeholder:"输入目录名称","aria-label":"新目录名称",disabled:ne.isPending}),i.jsxs("div",{className:"directory-picker__row-actions",children:[i.jsx("button",{type:"button",className:"directory-picker__row-action",onClick:we,"aria-label":"确认创建目录",disabled:!ie||ne.isPending,children:i.jsx(Nb,{})}),i.jsx("button",{type:"button",className:"directory-picker__row-action",onClick:Te,"aria-label":"取消创建目录",disabled:ne.isPending,children:i.jsx(QT,{})})]})]})}):null]})})]}),k?i.jsx("div",{className:"directory-picker__feedback is-error",role:"status","aria-live":"polite",children:k}):null,K?i.jsx("div",{className:"directory-picker__feedback is-error",role:"status","aria-live":"polite",children:K}):null,i.jsx("footer",{className:"directory-picker__footer",children:i.jsxs("div",{className:"directory-picker__footer-actions",children:[X?i.jsx("button",{type:"button",className:"directory-picker__secondary",onClick:_e,children:i.jsx("span",{children:f})}):null,oe?i.jsx("button",{type:"button",className:"directory-picker__secondary",onClick:re,disabled:L||ne.isPending,children:i.jsx("span",{children:"新建目录"})}):null,i.jsx("button",{type:"button",className:"directory-picker__primary",disabled:!p||pe.isPending,onClick:()=>{p&&pe.mutate(p)},children:pe.isPending?"创建中…":R})]})})]})})},YT=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 281.999849615234 85.965369875" width="281.999849615234" height="85.965369875" role="img" aria-label="Panda wordmark">\r
130
+ <path fill="#d97757" fill-rule="nonzero" d="M539.0830078125,114.554069519043C537.650695800781,114.554061889648 536.2041015625,114.826202392578 534.7431640625,115.370460510254 533.2822265625,115.914741516113 531.892883300781,116.616561889648 530.5751953125,117.475936889648 529.257507324219,118.335311889648 528.054382324219,119.280624389648 526.9658203125,120.311874389648 525.877258300781,121.343124389648 524.9892578125,122.345733642578 524.3017578125,123.319686889648 522.9267578125,125.153022766113 521.480163574219,127.244171142578 519.9619140625,129.593124389648 518.443664550781,131.942077636719 516.925476074219,134.405624389648 515.4072265625,136.983749389648 513.888977050781,139.561874389648 512.4423828125,142.197296142578 511.0673828125,144.889999389648 509.6923828125,147.582702636719 508.474945068359,150.203796386719 507.4150390625,152.753280639648 506.355133056641,155.302764892578 505.510101318359,157.737655639648 504.8798828125,160.057968139648 504.249664306641,162.378280639648 503.9345703125,164.455108642578 503.9345703125,166.288436889648 503.9345703125,168.981140136719 504.4501953125,171.143905639648 505.4814453125,172.776718139648 506.5126953125,174.409530639648 508.460601806641,175.225936889648 511.3251953125,175.225936889648 512.299133300781,175.225936889648 513.7314453125,174.610046386719 515.6220703125,173.378280639648 517.5126953125,172.146514892578 519.5322265625,170.585311889648 521.6806640625,168.694686889648 523.8291015625,166.804061889648 525.9345703125,164.755889892578 527.9970703125,162.550155639648 530.0595703125,160.344421386719 531.749694824219,158.238952636719 533.0673828125,156.233749389648 534.499694824219,154.113952636719 535.9462890625,151.793640136719 537.4072265625,149.272811889648 538.8681640625,146.751983642578 540.2001953125,144.173858642578 541.4033203125,141.538436889648 542.6064453125,138.903015136719 543.580383300781,136.310577392578 544.3251953125,133.761093139648 545.070007324219,131.211608886719 545.4423828125,128.848327636719 545.4423828125,126.671249389648 545.4423828125,122.374374389648 544.7978515625,119.280624389648 543.5087890625,117.389999389648 542.2197265625,115.499374389648 540.744445800781,114.554061889648 539.0830078125,114.554069519043z M416.966674804688,110.343124389648C413.930206298828,110.343124389648 409.805206298828,113.522811889648 404.591674804688,119.882186889648 401.956268310547,123.147811889648 399.535675048828,126.270210266113 397.329956054688,129.249374389648 395.124237060547,132.228546142578 393.104705810547,135.179061889648 391.271362304688,138.100936889648 389.266143798828,141.251983642578 387.561737060547,144.145202636719 386.158081054688,146.780624389648 384.754425048828,149.416046142578 383.565643310547,151.764999389648 382.591674804688,153.827499389648 379.211456298828,161.103546142578 377.521362304688,166.832702636719 377.521362304688,171.014999389648 377.521362304688,176.343124389648 379.326049804688,179.007186889648 382.935424804688,179.007186889648 386.143768310547,179.007186889648 390.555206298828,177.145202636719 396.169799804688,173.421249389648 401.956268310547,169.468124389648 406.425018310547,165.916046142578 409.576049804688,162.764999389648 412.841674804688,159.327499389648 415.563018798828,156.434265136719 417.740112304688,154.085311889648 419.917205810547,151.736358642578 421.635955810547,149.845733642578 422.896362304688,148.413436889648 424.156768798828,146.981140136719 425.316925048828,145.376983642578 426.376831054688,143.600936889648 427.436706542969,141.824890136719 428.453643798828,139.876983642578 429.427612304688,137.757186889648 427.938018798828,137.413436889648 426.806518554688,136.668640136719 426.033081054688,135.522811889648 425.259643554688,134.376983642578 424.872924804688,133.087921142578 424.872924804688,131.655624389648 424.872924804688,130.509796142578 425.044799804688,128.819686889648 425.388549804688,126.585311889648 425.732299804688,124.350936889648 425.904174804688,122.632186889648 425.904174804688,121.429061889648 425.904174804688,120.397811889648 425.632019042969,119.237655639648 425.087768554688,117.948593139648 424.543487548828,116.659530639648 423.841674804688,115.456405639648 422.982299804688,114.339218139648 422.122924804688,113.222030639648 421.163299560547,112.276718139648 420.103393554688,111.503280639648 419.043487548828,110.729843139648 417.997924804688,110.343124389648 416.966674804688,110.343124389648z M181.0703125,108.538436889648C178.95051574707,108.767608642578 176.6875,109.469429016113 174.28125,110.643905639648 171.875,111.818389892578 169.32551574707,113.623077392578 166.6328125,116.057968139648 163.940093994141,118.492866516113 161.104156494141,121.629585266113 158.125,125.468124389648 155.14582824707,129.306671142578 152.05207824707,133.975936889648 148.84375,139.475936889648 147.869781494141,141.137390136719 146.795562744141,142.956405639648 145.62109375,144.932968139648 144.44660949707,146.909530639648 143.32942199707,149.086608886719 142.26953125,151.464218139648 141.20964050293,153.841827392578 140.32160949707,156.376983642578 139.60546875,159.069686889648 138.88932800293,161.762390136719 138.53125,164.598327636719 138.53125,167.577499389648 138.53125,169.353546142578 139.17578125,170.699890136719 140.46484375,171.616561889648 141.75390625,172.533233642578 143.0859375,172.991561889648 144.4609375,172.991561889648 145.893218994141,172.991561889648 147.75520324707,172.203796386719 150.046875,170.628280639648 152.338531494141,169.052764892578 154.81640625,166.961608886719 157.48046875,164.354843139648 160.14453125,161.748077392578 162.865875244141,158.768905639648 165.64453125,155.417343139648 168.42317199707,152.065780639648 171.00129699707,148.613952636719 173.37890625,145.061874389648 175.756500244141,141.509796142578 177.819000244141,138.014999389648 179.56640625,134.577499389648 181.31379699707,131.139999389648 182.502593994141,128.017608642578 183.1328125,125.210311889648 183.3046875,124.350936889648 183.50520324707,123.334014892578 183.734375,122.159530639648 183.963531494141,120.985054016113 184.178375244141,119.810577392578 184.37890625,118.636093139648 184.57942199707,117.461616516113 184.75129699707,116.373077392578 184.89453125,115.370460510254 185.037750244141,114.367866516113 185.109375,113.637397766113 185.109375,113.179061889648 185.109375,113.064483642578 185.0234375,112.749374389648 184.8515625,112.233749389648 184.6796875,111.718124389648 184.421875,111.188179016113 184.078125,110.643905639648 183.734375,110.099639892578 183.319000244141,109.612655639648 182.83203125,109.182968139648 182.34504699707,108.753280639648 181.815093994141,108.538436889648 181.2421875,108.538436889648L181.0703125,108.538436889648z M453.576049804688,56.2884368896484C455.294799804688,56.2884368896484 456.984893798828,56.6608428955078 458.646362304688,57.4056243896484 460.422393798828,58.0931243896484 461.310424804688,59.0670928955078 461.310424804688,60.3274993896484 461.310424804688,61.0149993896484 461.181518554688,62.1321868896484 460.923706054688,63.6790618896484 460.665893554688,65.2259368896484 460.307800292969,67.2311477661133 459.849487304688,69.6946868896484 459.391143798828,72.1582336425781 458.775268554688,75.2090148925781 458.001831054688,78.8470306396484 457.228393554688,82.4850540161133 456.383331298828,86.8248977661133 455.466674804688,91.8665618896484 455.409362792969,92.4394836425781 455.237487792969,93.5853118896484 454.951049804688,95.3040618896484 454.664581298828,97.0228118896484 454.349487304688,98.8418273925781 454.005737304688,100.761093139648 453.661987304688,102.680366516113 453.346862792969,104.456405639648 453.060424804688,106.089218139648 452.773956298828,107.722030639648 452.602081298828,108.738960266113 452.544799804688,109.139999389648 451.799987792969,113.780624389648 451.198425292969,118.134796142578 450.740112304688,122.202499389648 450.281768798828,126.270210266113 450.052612304688,130.395202636719 450.052612304688,134.577499389648 450.052612304688,137.900421142578 450.138549804688,141.824890136719 450.310424804688,146.350936889648 450.482299804688,150.934265136719 450.911987304688,155.374374389648 451.599487304688,159.671249389648 452.286987304688,163.968124389648 453.289581298828,166.116561889648 454.607299804688,166.116561889648 459.305206298828,166.116561889648 464.977081298828,163.968124389648 471.622924804688,159.671249389648 478.211456298828,155.317077636719 484.570831298828,150.332702636719 490.701049804688,144.718124389648 493.766143798828,141.910827636719 496.659362792969,139.167999267578 499.380737304688,136.489608764648L504.336578369141,131.408462524414 505.0302734375,130.205429077148C506.390960693359,128.092803955078 507.859069824219,126.041038513184 509.4345703125,124.050155639648 512.585632324219,120.068389892578 515.7939453125,116.573593139648 519.0595703125,113.565780639648 522.3251953125,110.557968139648 525.433288574219,108.180366516113 528.3837890625,106.432968139648 531.334289550781,104.685577392578 533.726257324219,103.811874389648 535.5595703125,103.811874389648 536.0751953125,103.811874389648 536.662414550781,103.926460266113 537.3212890625,104.155616760254 537.980163574219,104.384796142578 538.667663574219,104.628280639648 539.3837890625,104.886093139648 540.099914550781,105.143905639648 540.787414550781,105.373077392578 541.4462890625,105.573593139648 542.105163574219,105.774116516113 542.663757324219,105.874374389648 543.1220703125,105.874374389648 543.580383300781,105.874374389648 544.038757324219,105.774116516113 544.4970703125,105.573593139648 544.955383300781,105.373077392578 545.413757324219,105.143905639648 545.8720703125,104.886093139648 546.330383300781,104.628280639648 546.788757324219,104.384796142578 547.2470703125,104.155616760254 547.705383300781,103.926460266113 548.163757324219,103.811874389648 548.6220703125,103.811874389648 549.3095703125,103.811874389648 550.054382324219,104.041046142578 550.8564453125,104.499374389648 551.658508300781,104.957710266113 552.431945800781,105.544952392578 553.1767578125,106.261093139648 553.921569824219,106.977241516113 554.580383300781,107.793647766113 555.1533203125,108.710311889648 555.726257324219,109.626983642578 556.127258300781,110.514999389648 556.3564453125,111.374374389648 556.585632324219,112.405624389648 556.886413574219,113.164741516113 557.2587890625,113.651718139648 557.631164550781,114.138702392578 558.003601074219,114.582710266113 558.3759765625,114.983749389648 558.748352050781,115.384796142578 559.0634765625,115.857452392578 559.3212890625,116.401718139648 559.5791015625,116.945991516113 559.7080078125,117.791046142578 559.7080078125,118.936874389648 559.7080078125,119.509796142578 559.507507324219,120.712921142578 559.1064453125,122.546249389648 558.705383300781,124.379585266113 558.261413574219,126.513702392578 557.7744140625,128.948593139648 557.287414550781,131.383483886719 556.843444824219,133.918640136719 556.4423828125,136.554061889648 556.041320800781,139.189483642578 555.8408203125,141.595733642578 555.8408203125,143.772811889648 555.8408203125,149.903015136719 556.1845703125,154.916046142578 556.8720703125,158.811874389648 557.5595703125,162.707702636719 558.5048828125,165.787139892578 559.7080078125,168.050155639648 560.9111328125,170.313171386719 562.3291015625,171.874374389648 563.9619140625,172.733749389648 565.5947265625,173.593124389648 567.327819824219,174.022811889648 569.1611328125,174.022811889648 573.515319824219,174.022811889648 577.081726074219,173.278015136719 579.8603515625,171.788436889648 582.638977050781,170.298858642578 585.116882324219,168.093124389648 587.2939453125,165.171249389648 587.924133300781,164.369171142578 588.468444824219,163.653015136719 588.9267578125,163.022811889648 589.385070800781,162.392608642578 589.843383789063,162.077499389648 590.3017578125,162.077499389648 591.103820800781,162.077499389648 591.834289550781,162.392608642578 592.4931640625,163.022811889648 593.151977539063,163.653015136719 593.4814453125,164.311874389648 593.4814453125,164.999374389648 593.4814453125,165.916046142578 593.295227050781,166.961608886719 592.9228515625,168.136093139648 592.550476074219,169.310577392578 591.963195800781,170.499374389648 591.1611328125,171.702499389648 590.1298828125,173.478546142578 588.769165039063,175.297546386719 587.0791015625,177.159530639648 585.388977050781,179.021514892578 583.498352050781,180.711608886719 581.4072265625,182.229843139648 579.316101074219,183.748077392578 577.038757324219,184.994171142578 574.5751953125,185.968124389648 572.111633300781,186.942077636719 569.562194824219,187.429061889648 566.9267578125,187.429061889648 563.4892578125,187.429061889648 560.5244140625,186.655624389648 558.0322265625,185.108749389648 555.5400390625,183.561874389648 553.3916015625,181.456405639648 551.5869140625,178.792343139648 549.7822265625,176.128280639648 548.292663574219,173.020202636719 547.1181640625,169.468124389648 545.943664550781,165.916046142578 544.984069824219,162.163436889648 544.2392578125,158.210311889648 541.718444824219,161.876983642578 538.724914550781,165.514999389648 535.2587890625,169.124374389648 531.792663574219,172.733749389648 528.2119140625,175.985046386719 524.5166015625,178.878280639648 520.8212890625,181.771514892578 517.183288574219,184.120468139648 513.6025390625,185.925155639648 510.021820068359,187.729843139648 506.8564453125,188.632186889648 504.1064453125,188.632186889648 502.273101806641,188.632186889648 500.511383056641,188.173858642578 498.8212890625,187.257186889648 497.131195068359,186.340515136719 495.6416015625,185.108749389648 494.3525390625,183.561874389648 493.0634765625,182.014999389648 492.046539306641,180.238952636719 491.3017578125,178.233749389648 490.556976318359,176.228546142578 490.1845703125,174.108749389648 490.1845703125,171.874374389648 490.1845703125,169.639999389648 490.370758056641,167.291046142578 490.7431640625,164.827499389648 491.115570068359,162.363952636719 491.745758056641,159.714218139648 492.6337890625,156.878280639648L493.119232177734,155.466354370117 492.849487304688,155.761093139648C490.385925292969,158.253280639648 487.779174804688,160.788436889648 485.029174804688,163.366561889648 482.279174804688,165.944686889648 479.615112304688,168.264999389648 477.036987304688,170.327499389648 474.458862304688,172.389999389648 471.938018798828,174.251983642578 469.474487304688,175.913436889648 464.604675292969,179.236358642578 460.708862304688,180.897811889648 457.786987304688,180.897811889648 456.641143798828,180.897811889648 455.180206298828,180.496765136719 453.404174804688,179.694686889648 449.794799804688,178.033233642578 446.930206298828,174.996765136719 444.810424804688,170.585311889648 442.747924804688,166.173858642578 441.286987304688,161.561874389648 440.427612304688,156.749374389648 439.568237304688,151.936874389648 438.852081298828,146.551452636719 438.279174804688,140.593124389648 431.117706298828,153.942077636719 421.836456298828,165.801452636719 410.435424804688,176.171249389648 398.977081298828,186.598327636719 387.117706298828,191.811874389648 374.857299804688,191.811874389648 371.477081298828,191.811874389648 368.898956298828,190.007186889648 367.122924804688,186.397811889648 365.346893310547,182.845733642578 364.458862304688,179.150421142578 364.458862304688,175.311874389648 364.458862304688,170.155624389648 364.888549804688,166.317077636719 365.747924804688,163.796249389648L366.740081787109,161.069854736328 361.366027832031,165.944686889648C358.67333984375,168.179061889648 356.037902832031,170.155624389648 353.459777832031,171.874374389648 351.397277832031,173.249374389648 349.43505859375,174.538436889648 347.573059082031,175.741561889648 345.711090087891,176.944686889648 343.834777832031,177.975936889648 341.944152832031,178.835311889648 340.053527832031,179.694686889648 338.076965332031,180.382186889648 336.014465332031,180.897811889648 333.951965332031,181.413436889648 331.68896484375,181.671249389648 329.225402832031,181.671249389648 324.47021484375,181.671249389648 320.60302734375,180.468124389648 317.623840332031,178.061874389648 316.13427734375,176.858749389648 314.830871582031,175.297546386719 313.713684082031,173.378280639648 312.596496582031,171.459014892578 311.62255859375,169.324890136719 310.791809082031,166.975936889648 309.961090087891,164.626983642578 309.244934082031,162.134796142578 308.643371582031,159.499374389648 308.041809082031,156.863952636719 307.54052734375,154.257186889648 307.139465332031,151.679061889648 306.623840332031,148.470733642578 306.136871337891,145.591827392578 305.678527832031,143.042343139648 305.22021484375,140.492858886719 304.690246582031,138.344421386719 304.088684082031,136.597030639648 303.487121582031,134.849639892578 302.756652832031,133.503280639648 301.897277832031,132.557968139648 301.037902832031,131.612655639648 299.920715332031,131.139999389648 298.545715332031,131.139999389648 297.457183837891,131.139999389648 296.425933837891,131.254577636719 295.451965332031,131.483749389648 294.47802734375,131.712921142578 293.461090087891,132.171249389648 292.401184082031,132.858749389648 291.34130859375,133.546249389648 290.18115234375,134.520202636719 288.920715332031,135.780624389648 287.660308837891,137.041046142578 286.18505859375,138.702499389648 284.494934082031,140.764999389648 282.804840087891,142.827499389648 280.871246337891,145.348327636719 278.694152832031,148.327499389648 276.51708984375,151.306671142578 273.967590332031,154.858749389648 271.045715332031,158.983749389648 269.613433837891,160.988952636719 267.92333984375,163.194686889648 265.975402832031,165.600936889648 264.027496337891,168.007186889648 262.03662109375,170.298858642578 260.002746582031,172.475936889648 257.968902587891,174.653015136719 255.97802734375,176.572296142578 254.03010559082,178.233749389648 252.082183837891,179.895202636719 250.363433837891,180.955108642578 248.87385559082,181.413436889648 243.832183837891,180.324890136719 241.31135559082,174.051452636719 241.31135559082,162.593124389648 241.31135559082,159.556671142578 241.65510559082,154.944686889648 242.34260559082,148.757186889648 242.68635559082,145.949890136719 243.08740234375,143.013702392578 243.54573059082,139.948593139648L243.633743286133,139.477767944336 241.3662109375,142.344100952148C239.48274230957,144.571319580078 237.55989074707,146.694686889648 235.59765625,148.714218139648 231.67317199707,152.753280639648 227.705718994141,156.577499389648 223.6953125,160.186874389648 219.51301574707,163.968124389648 215.34504699707,166.918640136719 211.19140625,169.038436889648 207.037750244141,171.158233642578 203.299468994141,172.218124389648 199.9765625,172.218124389648 198.54426574707,172.218124389648 197.12629699707,171.874374389648 195.72265625,171.186874389648 194.319000244141,170.499374389648 193.00129699707,169.597030639648 191.76953125,168.479843139648 190.537750244141,167.362655639648 189.44921875,166.059265136719 188.50390625,164.569686889648 187.55859375,163.080108642578 186.828125,161.533233642578 186.3125,159.929061889648 186.026031494141,159.069686889648 185.768218994141,158.081405639648 185.5390625,156.964218139648 185.30989074707,155.847030639648 185.080718994141,154.815780639648 184.8515625,153.870468139648 184.62239074707,152.925155639648 184.36457824707,152.123077392578 184.078125,151.464218139648 183.791656494141,150.805358886719 183.4765625,150.475936889648 183.1328125,150.475936889648 182.90364074707,150.475936889648 182.416656494141,150.848327636719 181.671875,151.593124389648 180.92707824707,152.337921142578 180.053375244141,153.297546386719 179.05078125,154.472030639648 178.04817199707,155.646514892578 176.97395324707,156.964218139648 175.828125,158.425155639648 174.682281494141,159.886093139648 173.55078125,161.304061889648 172.43359375,162.679061889648 171.31640625,164.054061889648 170.31379699707,165.314483642578 169.42578125,166.460311889648 168.537750244141,167.606140136719 167.8359375,168.465515136719 167.3203125,169.038436889648 165.54426574707,171.043640136719 163.43879699707,173.091827392578 161.00390625,175.182968139648 158.569000244141,177.274108886719 156.13410949707,179.179061889648 153.69921875,180.897811889648 151.264312744141,182.616561889648 149.02995300293,184.020202636719 146.99609375,185.108749389648 144.96223449707,186.197296142578 143.45832824707,186.741561889648 142.484375,186.741561889648 140.30729675293,186.741561889648 138.20182800293,186.383483886719 136.16796875,185.667343139648 134.13410949707,184.951202392578 132.34375,183.905624389648 130.796875,182.530624389648 129.25,181.155624389648 128.00390625,179.465515136719 127.05859375,177.460311889648 126.11328125,175.455108642578 125.640625,173.163436889648 125.640625,170.585311889648 125.640625,166.345733642578 126.485679626465,161.504577636719 128.17578125,156.061874389648 129.020843505859,153.340515136719 130.001953125,150.597686767578 131.119140625,147.833358764648L132.791915893555,144.115005493164 132.34375,144.417343139648C129.36457824707,146.336608886719 126.05598449707,148.370468139648 122.41796875,150.518905639648 118.779945373535,152.667343139648 114.92707824707,154.844421386719 110.859375,157.050155639648 106.791664123535,159.255889892578 102.72395324707,161.418640136719 98.65625,163.538436889648 94.5885391235352,165.658233642578 90.6354141235352,167.663436889648 86.796875,169.554061889648 82.9583282470703,171.444686889648 79.4635391235352,173.106140136719 76.3125,174.538436889648 74.0208282470703,175.569686889648 71.84375,176.729843139648 69.78125,178.018905639648 67.71875,179.307968139648 65.69921875,180.511093139648 63.7226600646973,181.628280639648 61.74609375,182.745468139648 59.7552070617676,183.676452636719 57.7499961853027,184.421249389648 55.7447891235352,185.166046142578 53.625,185.538436889648 51.390625,185.538436889648 50.0729141235352,185.538436889648 48.7981758117676,185.380889892578 47.5664100646973,185.065780639648 46.3346328735352,184.750671386719 45.2317695617676,184.249374389648 44.2578163146973,183.561874389648 43.2838516235352,182.874374389648 42.49609375,182.000671386719 41.8945274353027,180.940780639648 41.29296875,179.880889892578 40.9921875,178.606140136719 40.9921875,177.116561889648 40.9921875,176.314483642578 41.2643203735352,175.569686889648 41.80859375,174.882186889648 42.3528633117676,174.194686889648 43.0546875,173.578796386719 43.9140625,173.034530639648 44.7734375,172.490264892578 45.71875,171.988952636719 46.75,171.530624389648 47.78125,171.072296142578 48.7838516235352,170.671249389648 49.7578086853027,170.327499389648 50.7890586853027,169.926452636719 52.0065078735352,169.511093139648 53.41015625,169.081405639648 54.8138008117676,168.651718139648 56.2317695617676,168.222030639648 57.6640625,167.792343139648 59.0963516235352,167.362655639648 60.4856719970703,166.918640136719 61.83203125,166.460311889648 63.1783828735352,166.001983642578 64.3385391235352,165.543640136719 65.3125,165.085311889648 67.1458282470703,164.111358642578 68.8645782470703,162.879577636719 70.46875,161.389999389648 72.0729141235352,159.900421142578 73.5625,158.267608642578 74.9375,156.491561889648 76.3125,154.715515136719 77.6015625,152.867858886719 78.8046875,150.948593139648 80.0078125,149.029327392578 81.125,147.181671142578 82.1562576293945,145.405624389648 82.84375,144.202499389648 83.5026016235352,142.856140136719 84.1328125,141.366561889648 84.7630157470703,139.876983642578 85.3216094970703,138.387390136719 85.80859375,136.897811889648 86.2955703735352,135.408233642578 86.66796875,133.990264892578 86.92578125,132.643905639648 87.18359375,131.297546386719 87.3125,130.166046142578 87.3125,129.249374389648 87.3125,125.296249389648 86.453125,122.145210266113 84.734375,119.796249389648 83.015625,117.447296142578 80.8671875,116.272811889648 78.2890548706055,116.272811889648 76.6848907470703,116.272811889648 74.8372344970703,116.802764892578 72.74609375,117.862655639648 70.6549453735352,118.922554016113 68.5637969970703,120.197296142578 66.47265625,121.686874389648 64.3815078735352,123.176460266113 62.43359375,124.737655639648 60.62890625,126.370468139648 58.82421875,128.003280639648 57.3776016235352,129.392608642578 56.2890586853027,130.538436889648 53.6536407470703,133.345733642578 51.1757774353027,136.396514892578 48.85546875,139.690780639648 46.53515625,142.985046386719 44.34375,146.365264892578 42.2812461853027,149.831405639648 40.21875,153.297546386719 38.2708320617676,156.778015136719 36.4375,160.272811889648 34.6041641235352,163.767608642578 32.9140625,167.119171142578 31.3671855926514,170.327499389648 30.6796875,173.020202636719 30.0065097808838,175.999374389648 29.3476543426514,179.264999389648 28.6888008117676,182.530624389648 28.1874980926514,186.111358642578 27.8437538146973,190.007186889648 27.2135410308838,197.741561889648 26.7408847808838,204.645202636719 26.4257793426514,210.718124389648 26.1106758117676,216.791046142578 25.4661445617676,222.348327636719 24.4921913146973,227.389999389648 24.1484375,229.223327636719 23.3177070617676,230.841827392578 22.0000057220459,232.245468139648 20.6822910308838,233.649108886719 18.9635410308838,234.350936889648 16.84375,234.350936889648 16.2135410308838,234.350936889648 15.46875,234.193389892578 14.6093778610229,233.878280639648 13.75,233.563171386719 12.93359375,233.119171142578 12.1601552963257,232.546249389648 11.38671875,231.973327636719 10.7278642654419,231.328796386719 10.1835947036743,230.612655639648 9.63932228088379,229.896514892578 9.3671875,229.108749389648 9.3671875,228.249374389648 9.3671875,226.358749389648 9.49609375,224.024108886719 9.75390529632568,221.245468139648 10.01171875,218.466827392578 10.3125,215.673858642578 10.6562471389771,212.866561889648 11,210.059265136719 11.3294267654419,207.509796142578 11.6445322036743,205.218124389648 11.9596347808838,202.926452636719 12.1744785308838,201.322296142578 12.2890615463257,200.405624389648 13.0911455154419,194.504577636719 13.8072910308838,188.130889892578 14.4375,181.284530639648 15.0677080154419,174.438171386719 15.5833330154419,166.975936889648 15.9843711853027,158.897811889648 16.0416660308838,157.179061889648 16.11328125,154.901718139648 16.1992206573486,152.065780639648 16.28515625,149.229843139648 16.37109375,146.365264892578 16.4570331573486,143.472030639648 16.54296875,140.578796386719 16.62890625,137.886093139648 16.71484375,135.393905639648 16.80078125,132.901718139648 16.9010410308838,131.139999389648 17.0156269073486,130.108749389648 17.8177070617676,119.166046142578 20.6822929382324,113.694686889648 25.6093730926514,113.694686889648 26.5833320617676,113.694686889648 27.5143203735352,113.938179016113 28.4023399353027,114.425163269043 29.2903633117676,114.912139892578 30.078125,115.542343139648 30.7656288146973,116.315780639648 31.453125,117.089218139648 31.9973945617676,117.962921142578 32.3984336853027,118.936874389648 32.7994766235352,119.910835266113 33,120.856147766113 33,121.772804260254 33,123.778022766113 32.78515625,125.940780639648 32.3554725646973,128.261093139648 31.9257793426514,130.581405639648 31.4531230926514,132.959014892578 30.9374961853027,135.393905639648 30.4218730926514,137.828796386719 29.9492168426514,140.220733642578 29.51953125,142.569686889648 29.0898418426514,144.918640136719 28.8749980926514,147.067077636719 28.8750019073486,149.014999389648 28.8749980926514,150.676452636719 29.0468730926514,151.507186889648 29.390625,151.507186889648 33.4010391235352,144.288436889648 37.3255195617676,137.943389892578 41.1640663146973,132.472030639648 45.0026016235352,127.000679016113 48.8411445617676,122.460311889648 52.6796836853027,118.850936889648 55.1432266235352,116.559272766113 57.578125,114.453804016113 59.9843788146973,112.534530639648 62.390625,110.615264892578 64.8111953735352,108.953804016113 67.24609375,107.550155639648 69.6809844970703,106.146514892578 72.2018203735352,105.057968139648 74.80859375,104.284538269043 77.4153594970703,103.511093139648 80.1796875,103.095733642578 83.1015625,103.038436889648 85.1067657470703,102.981147766113 87.18359375,103.468124389648 89.33203125,104.499374389648 91.48046875,105.530624389648 93.4140625,107.077499389648 95.1328125,109.139999389648 96.8515548706055,111.202499389648 98.2695236206055,113.709014892578 99.38671875,116.659530639648 100.503898620605,119.610054016113 101.033843994141,122.947296142578 100.976554870605,126.671249389648 101.033843994141,129.535827636719 100.589836120605,132.400421142578 99.6445236206055,135.264999389648 98.6992111206055,138.129577636719 97.4387969970703,140.951202392578 95.86328125,143.729843139648 94.2877578735352,146.508483886719 92.46875,149.186874389648 90.40625,151.764999389648 88.34375,154.343124389648 86.1953125,156.720733642578 83.9609375,158.897811889648 88.6588516235352,157.121765136719 93.4856719970703,154.944686889648 98.4413986206055,152.366561889648 103.397132873535,149.788436889648 108.35285949707,147.009796142578 113.30859375,144.030624389648 118.264320373535,141.051452636719 123.13410949707,137.957702636719 127.91796875,134.749374389648 132.701812744141,131.541046142578 137.27082824707,128.418640136719 141.625,125.382186889648 142.283843994141,124.923858642578 142.87825012207,124.501327514648 143.408203125,124.114616394043L144.405715942383,123.362648010254 144.4609375,123.276718139648C148.0703125,118.091827392578 151.822906494141,113.637397766113 155.71875,109.913436889648 160.244781494141,105.616561889648 164.98567199707,102.451202392578 169.94140625,100.417350769043 174.897125244141,98.3834915161133 179.98176574707,97.3665618896484 185.1953125,97.3665618896484 186.16926574707,97.3665618896484 187.014312744141,97.5670852661133 187.73046875,97.9681243896484 188.44660949707,98.3691711425781 189.0625,98.8847961425781 189.578125,99.5149993896484 190.09375,100.145210266113 190.55207824707,100.847030639648 190.953125,101.620460510254 191.354156494141,102.393905639648 191.75520324707,103.181671142578 192.15625,103.983749389648 192.385406494141,104.499374389648 192.87239074707,105.072296142578 193.6171875,105.702499389648 194.361968994141,106.332710266113 195.135406494141,106.977241516113 195.9375,107.636093139648 196.73957824707,108.294952392578 197.44140625,108.939483642578 198.04296875,109.569686889648 198.64453125,110.199897766113 198.9453125,110.801460266113 198.9453125,111.374374389648 198.9453125,112.577499389648 198.701812744141,113.909530639648 198.21484375,115.370460510254 197.72785949707,116.831405639648 197.197906494141,118.521514892578 196.625,120.440773010254 196.05207824707,122.360054016113 195.522125244141,124.537139892578 195.03515625,126.972023010254 194.54817199707,129.406921386719 194.3046875,132.199890136719 194.3046875,135.350936889648 194.3046875,137.413436889648 194.490875244141,139.762390136719 194.86328125,142.397811889648 195.23567199707,145.033233642578 195.80859375,147.539733886719 196.58203125,149.917343139648 197.35546875,152.294952392578 198.34375,154.285827636719 199.546875,155.889999389648 200.75,157.494171142578 202.15364074707,158.296249389648 203.7578125,158.296249389648 205.705718994141,158.296249389648 207.65364074707,157.737655639648 209.6015625,156.620468139648 211.549468994141,155.503280639648 213.783843994141,153.942077636719 216.3046875,151.936874389648 221.91926574707,147.468124389648 227.24739074707,142.569686889648 232.2890625,137.241561889648 237.330718994141,131.913436889648 242.486968994141,126.613960266113 247.7578125,121.343124389648L247.835861206055,121.282699584961 250.76448059082,113.780624389648C251.33740234375,112.634796142578 251.93896484375,111.732452392578 252.56916809082,111.073593139648 253.199371337891,110.414741516113 253.843902587891,109.927764892578 254.50276184082,109.612655639648 255.16162109375,109.297554016113 255.84912109375,109.097030639648 256.565246582031,109.011093139648 257.281402587891,108.925155639648 258.011871337891,108.882186889648 258.756652832031,108.882186889648 259.67333984375,108.882186889648 260.48974609375,109.512397766113 261.205871582031,110.772811889648 261.922027587891,112.033233642578 262.280090332031,113.780624389648 262.280090332031,116.014999389648 262.280090332031,117.389999389648 262.16552734375,118.679061889648 261.936340332031,119.882186889648 261.707183837891,121.085311889648 261.39208984375,122.317085266113 260.991027832031,123.577499389648 260.589996337891,124.837921142578 260.160308837891,126.198593139648 259.701965332031,127.659530639648 259.24365234375,129.120468139648 258.785308837891,130.796249389648 258.326965332031,132.686874389648 257.983215332031,134.233749389648 257.596496582031,135.952499389648 257.166809082031,137.843124389648 256.737121582031,139.733749389648 256.336090087891,141.653015136719 255.96369934082,143.600936889648 255.59130859375,145.548858642578 255.27619934082,147.453796386719 255.01838684082,149.315780639648 254.76057434082,151.177764892578 254.63166809082,152.853546142578 254.63166809082,154.343124389648 254.63166809082,155.374374389648 254.80354309082,156.434265136719 255.14729309082,157.522811889648 256.75146484375,157.350936889648 259.386871337891,154.944686889648 263.053527832031,150.304061889648 264.944152832031,147.955108642578 267.02099609375,145.376983642578 269.283996582031,142.569686889648 271.547027587891,139.762390136719 273.996246337891,136.668640136719 276.631652832031,133.288436889648 278.57958984375,130.767608642578 280.51318359375,128.418640136719 282.432434082031,126.241561889648 284.351715087891,124.064483642578 286.342590332031,122.159530639648 288.405090332031,120.526718139648 290.467590332031,118.893905639648 292.658996582031,117.604843139648 294.979309082031,116.659530639648 297.299621582031,115.714218139648 299.863433837891,115.241561889648 302.670715332031,115.241561889648 305.64990234375,115.241561889648 308.127746582031,115.886093139648 310.104309082031,117.175155639648 312.080871582031,118.464218139648 313.670715332031,120.240264892578 314.873840332031,122.503280639648 316.076965332031,124.766304016113 317.007965087891,127.473335266113 317.666809082031,130.624374389648 318.32568359375,133.775421142578 318.855621337891,137.241561889648 319.256652832031,141.022811889648 319.600402832031,144.231140136719 319.929840087891,147.410827636719 320.244934082031,150.561874389648 320.56005859375,153.712921142578 321.175933837891,156.534530639648 322.092590332031,159.026718139648 323.00927734375,161.518905639648 324.326965332031,163.538436889648 326.045715332031,165.085311889648 327.764465332031,166.632186889648 330.22802734375,167.405624389648 333.436340332031,167.405624389648 335.89990234375,167.405624389648 338.47802734375,166.832702636719 341.170715332031,165.686874389648 343.863433837891,164.541046142578 346.699371337891,162.951202392578 349.678527832031,160.917343139648 352.65771484375,158.883483886719 355.737121582031,156.491561889648 358.916809082031,153.741561889648 362.096496582031,150.991561889648 365.37646484375,147.983749389648 368.756652832031,144.718124389648 370.074371337891,143.457702636719 371.52099609375,141.867858886719 373.096496582031,139.948593139648 374.672027587891,138.029327392578 376.218902587891,136.181671142578 377.737121582031,134.405624389648 378.496246337891,133.517608642578 379.230285644531,132.694030761719 379.939300537109,131.934921264648L381.199279785156,130.655120849609 385.427612304688,124.264999389648C388.349487304688,120.254585266113 391.672393798828,116.244171142578 395.396362304688,112.233749389648 399.177612304688,108.223335266113 402.729705810547,105.358749389648 406.052612304688,103.639999389648 410.177612304688,101.405624389648 416.107299804688,100.288436889648 423.841674804688,100.288429260254 426.534362792969,100.288436889648 428.826049804688,101.778022766113 430.716674804688,104.757186889648 432.607299804688,107.736358642578 434.039581298828,111.202499389648 435.013549804688,115.155624389648 435.987487792969,119.337921142578 436.474487304688,122.603546142578 436.474487304688,124.952499389648 437.333862304688,122.145210266113 438.107299804688,119.294952392578 438.794799804688,116.401718139648 439.482299804688,113.508491516113 440.083862304688,110.514999389648 440.599487304688,107.421249389648 441.115112304688,104.327499389648 441.587768554688,101.076202392578 442.017456054688,97.6673431396484 442.447143554688,94.2584915161133 442.833862304688,90.6061477661133 443.177612304688,86.7103118896484 443.292175292969,85.679069519043 443.406768798828,84.3613586425781 443.521362304688,82.7571868896484 443.635925292969,81.1530227661133 443.779174804688,79.2623977661133 443.951049804688,77.0853118896484 444.294799804688,72.6165618896484 444.638549804688,68.8496398925781 444.982299804688,65.7845306396484 445.326049804688,62.7194366455078 445.784362792969,60.7285461425781 446.357299804688,59.8118743896484 447.732299804688,57.4629211425781 450.138549804688,56.2884368896484 453.576049804688,56.2884368896484z" transform="translate(-4.522309515625 -27.1750441384583) scale(0.482782)" />\r
131
+ </svg>\r
132
+ \r
133
+ \r
134
+ \r
135
+ `,VT=()=>i.jsx("span",{"aria-hidden":"true",className:"new-thread-hero__logo",dangerouslySetInnerHTML:{__html:YT}}),ZT=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"m15 18-6-6 6-6"})}),XT=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"m9 18 6-6-6-6"})}),Eb=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("circle",{cx:"12",cy:"12",r:"8.5"}),i.jsx("path",{d:"M12 10.4v4.2"}),i.jsx("path",{d:"M12 7.9h.01"})]}),JT=(e,t)=>{var a;return((a=e[t])==null?void 0:a.trim())??""},Cb=()=>typeof window<"u"&&!window.matchMedia("(max-width: 768px)").matches,eM=_.memo(function({requests:t,hasStripBelow:a,pendingRequestId:l,onRespond:o}){const u=t[0]??null,[f,m]=_.useState(null),[y,g]=_.useState(""),[S,p]=_.useState({}),[v,w]=_.useState(0),[N,j]=_.useState(null),[T,A]=_.useState(null);_.useEffect(()=>{m(null),g(""),p({}),w(0),j(null),A(null)},[u==null?void 0:u.id]);const U=u?l===u.id:!1,I=(u==null?void 0:u.kind)==="user_input",E=I&&u.questions.length>0?u.questions[Math.max(0,Math.min(v,u.questions.length-1))]??null:null,L=E?JT(S,E.id):"",W=E?E.options.some(V=>V.label===L):!1,ee=!!(E&&L&&(!W||N===E.id));_.useEffect(()=>{if(!E){j(null);return}if(W){j(null);return}L&&j(E.id)},[W,E,L]);const F=_.useMemo(()=>!u||U?!1:u.kind==="user_input"?E?!!L:!1:f?!0:u.allow_freeform?!!y.trim():!1,[E,L,u,y,U,f]);if(!u)return null;const G=u.questions.reduce((V,ye)=>V+ye.options.length,u.options.length),Q=V=>{U||o({requestId:u.id,optionId:(V==null?void 0:V.optionId)??f,text:(V==null?void 0:V.text)??y,answers:(V==null?void 0:V.answers)??S})},Y=()=>{if(!(!u||u.kind!=="user_input"||!E)){if(v<u.questions.length-1){w(V=>Math.min(V+1,u.questions.length-1));return}Q()}},pe=()=>{if(!u||u.kind!=="user_input"||!E)return;const V={...S,[E.id]:"忽略"};if(p(V),j(null),v<u.questions.length-1){w(ye=>Math.min(ye+1,u.questions.length-1));return}Q({answers:V})},ne=V=>{if(!(!u||u.kind!=="user_input"||!E||U)){if(L===V){Y();return}p(ye=>({...ye,[E.id]:V})),j(null)}};return i.jsx("section",{className:`session-interaction-strip ${a?"has-strip-below":""} ${I?"is-user-input-flow":""}`,children:u.kind==="user_input"&&E?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"session-interaction-flow__header",children:[i.jsx("div",{className:"session-interaction-flow__prompt",children:E.question}),i.jsxs("div",{className:"session-interaction-flow__progress",children:[i.jsx("button",{type:"button",className:"session-interaction-flow__nav","aria-label":"上一题",disabled:v===0||U,onClick:()=>w(V=>Math.max(0,V-1)),children:i.jsx(ZT,{})}),i.jsxs("span",{className:"session-interaction-flow__counter",children:[v+1," / ",u.questions.length]}),i.jsx("button",{type:"button",className:"session-interaction-flow__nav","aria-label":v===u.questions.length-1?"提交回复":"下一题",disabled:U||!F,onClick:Y,children:i.jsx(XT,{})})]})]}),i.jsx("div",{className:"session-interaction-flow__body",children:i.jsxs("div",{className:"session-interaction-flow__list",children:[E.options.map((V,ye)=>i.jsxs("div",{className:`session-interaction-flow__item is-${V.emphasis} ${L===V.label?"is-active":""}`,role:"button",tabIndex:U?-1:0,"aria-pressed":L===V.label,onClick:()=>ne(V.label),onKeyDown:R=>{R.key==="Enter"&&Cb()&&(R.preventDefault(),ne(V.label))},children:[i.jsxs("span",{className:"session-interaction-flow__item-index",children:[ye+1,"."]}),i.jsxs("span",{className:"session-interaction-flow__item-choice",children:[i.jsx("span",{className:"session-interaction-flow__item-label",children:V.label}),V.description?i.jsxs("span",{className:"session-interaction-flow__tooltip-wrap",children:[i.jsx("button",{type:"button",className:"session-interaction-flow__tooltip-trigger","aria-label":`查看 ${V.label} 的说明`,"aria-expanded":T===V.id,onMouseEnter:()=>A(V.id),onMouseLeave:()=>A(R=>R===V.id?null:R),onBlur:()=>A(R=>R===V.id?null:R),onClick:R=>{R.stopPropagation(),A(H=>H===V.id?null:V.id)},children:i.jsx(Eb,{})}),i.jsx("div",{className:`session-interaction-flow__tooltip ${T===V.id?"is-visible":""}`,role:"tooltip",children:V.description})]}):null]})]},V.id)),i.jsx("div",{className:`session-interaction-flow__item is-custom ${ee?"is-active":""}`,children:i.jsxs("div",{className:"session-interaction-flow__custom-input-wrap",children:[i.jsx("input",{type:"text",className:"session-interaction-flow__custom-input",value:W?"":L,disabled:U,placeholder:E.is_secret?"输入敏感信息":"否,请告知如何调整",onFocus:()=>{j(E.id),W&&p(V=>({...V,[E.id]:""}))},onKeyDown:V=>{V.key==="Enter"&&F&&!U&&Cb()&&(V.preventDefault(),Y())},onChange:V=>{j(E.id),p(ye=>({...ye,[E.id]:V.target.value}))}}),i.jsxs("div",{className:"session-interaction-flow__inline-actions",children:[i.jsx("button",{type:"button",className:"session-interaction-flow__ghost",disabled:U,onClick:pe,children:"忽略"}),i.jsx("button",{type:"button",className:"session-interaction-flow__primary",disabled:!F,onClick:Y,children:U?"提交中...":v===u.questions.length-1?u.submit_label??"提交回复":"继续"})]})]})})]})})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"session-interaction-strip__header",children:[i.jsx("span",{className:"session-interaction-strip__icon","aria-hidden":"true",children:i.jsx(Eb,{})}),i.jsxs("div",{className:"session-interaction-strip__copy",children:[i.jsxs("div",{className:"session-interaction-strip__title",children:[u.title,t.length>1?i.jsxs("span",{className:"session-interaction-strip__count",children:["还有 ",t.length-1," 个待处理"]}):null]}),u.description?i.jsx("div",{className:"session-interaction-strip__description",children:u.description}):null]})]}),u.options.length>0?i.jsx("div",{className:"session-interaction-strip__options",children:u.options.map(V=>i.jsxs("button",{type:"button",className:`session-interaction-option is-${V.emphasis} ${f===V.id?"is-active":""}`,disabled:U,onClick:()=>{m(V.id),!u.allow_freeform&&G<=3&&Q({optionId:V.id})},children:[i.jsx("span",{className:"session-interaction-option__label",children:V.label}),V.description?i.jsx("span",{className:"session-interaction-option__description",children:V.description}):null]},V.id))}):null,u.allow_freeform?i.jsxs("label",{className:"session-interaction-strip__freeform",children:[i.jsx("span",{className:"session-interaction-strip__freeform-label",children:"自定义回复"}),i.jsx("textarea",{value:y,disabled:U,placeholder:u.freeform_placeholder??"输入回复内容",onChange:V=>g(V.target.value)})]}):null,u.allow_freeform||u.options.length>3?i.jsx("div",{className:"session-interaction-strip__footer",children:i.jsx("button",{type:"button",className:"session-interaction-strip__submit",disabled:!F,onClick:()=>Q(),children:U?"提交中...":u.submit_label??"继续"})}):null]})})}),tM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M6 6l12 12"}),i.jsx("path",{d:"M18 6 6 18"})]}),nM=({panel:e,isPending:t,onDismiss:a,onSelectOption:l,onSubmitText:o})=>{const[u,f]=_.useState("");return _.useEffect(()=>{f("")},[e.panel_id,e.status]),i.jsxs("section",{className:`session-command-panel is-${e.status}`,children:[i.jsxs("div",{className:"session-command-panel__header",children:[i.jsxs("div",{className:"session-command-panel__command",children:["/",e.command_name]}),i.jsx("button",{type:"button",className:"session-command-panel__close","aria-label":"关闭命令面板",onClick:a,children:i.jsx(tM,{})})]}),i.jsx("div",{className:"session-command-panel__title",children:e.title}),e.description?i.jsx("div",{className:"session-command-panel__description",children:e.description}):null,i.jsx("pre",{className:"session-command-panel__body",children:e.body}),e.input_type==="choice"&&e.options.length>0?i.jsx("div",{className:"session-command-panel__options",children:e.options.map(m=>i.jsxs("button",{type:"button",className:"session-command-panel__option",disabled:t,onClick:()=>l(m.id),children:[i.jsx("span",{className:"session-command-panel__option-label",children:m.label}),m.description?i.jsx("span",{className:"session-command-panel__option-description",children:m.description}):null]},m.id))}):null,e.input_type==="text"?i.jsxs("form",{className:"session-command-panel__form",onSubmit:m=>{m.preventDefault(),!(!u.trim()||t)&&o(u.trim())},children:[i.jsx("input",{className:"session-command-panel__input",value:u,disabled:t,placeholder:e.input_placeholder??"继续输入",onChange:m=>f(m.target.value)}),i.jsx("button",{type:"submit",className:"session-command-panel__submit",disabled:t||!u.trim(),children:e.submit_label??"提交"})]}):null]})},sM=_.memo(function({planSnapshot:t,hasStripAbove:a,hasStripBelow:l}){const[o,u]=_.useState(!0);return t.steps.length?i.jsxs("section",{className:`session-plan-strip ${o?"is-collapsed":""} ${a?"has-strip-above":""} ${l?"has-strip-below":""}`,children:[i.jsxs("button",{type:"button",className:"session-plan-strip__toggle",onClick:()=>u(f=>!f),"aria-expanded":!o,children:[i.jsxs("div",{className:"session-plan-strip__summary",children:[i.jsx("span",{className:"session-plan-strip__summary-mark","aria-hidden":"true",children:i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("rect",{x:"4.5",y:"5",width:"15",height:"14",rx:"2.5"}),i.jsx("path",{d:"M8 9h8"}),i.jsx("path",{d:"M8 13h5.5"}),i.jsx("path",{d:"m15.5 14.5 1.5 1.5 2.5-3"})]})}),i.jsx("span",{className:"session-plan-strip__summary-text",children:i.jsxs("span",{children:["共 ",t.total_count," 个任务,已完成 ",t.completed_count," 个"]})})]}),i.jsx("span",{className:"session-plan-strip__chevron","aria-hidden":"true",children:i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"m8 10 4 4 4-4"})})})]}),o?null:i.jsx(i.Fragment,{children:i.jsx("div",{className:"session-plan-strip__steps",children:t.steps.map((f,m)=>i.jsxs("div",{className:`session-plan-step is-${f.status}`,children:[i.jsx("span",{className:"session-plan-step__dot","aria-hidden":"true",children:f.status==="in_progress"?i.jsx("span",{className:"session-plan-step__spinner"}):null}),i.jsxs("span",{className:"session-plan-step__index",children:[m+1,"."]}),i.jsx("span",{className:"session-plan-step__label",children:f.step})]},f.id))})})]}):null}),aM=(e,t,a)=>{const l=((a==null?void 0:a.enabled)??!0)&&!!e;return is({queryKey:["project-skills",t??"",e],enabled:l,queryFn:async()=>e?(await xn({projectId:e,agentId:t??null})).client.getProjectSkills(e):[],staleTime:6e4,gcTime:10*6e4,refetchOnWindowFocus:!1,retry:1})},Tb=24,iM=e=>{const t=r5(e);return t.length===0?i.jsx("span",{children:" "}):t.map((a,l)=>{const o=`skill-aware-token-${l}`;return a.kind==="skill"?i.jsx("span",{className:"skill-aware-textarea__token is-skill",children:a.raw},o):a.kind==="command"?i.jsx("span",{className:"skill-aware-textarea__token is-command",children:a.raw},o):a.kind==="code"?i.jsx("span",{className:"skill-aware-textarea__token is-code",children:a.value},o):a.kind==="path-link"?i.jsx("span",{className:"skill-aware-textarea__token is-link",children:a.label},o):i.jsx("span",{children:a.value},o)})},Mb=({value:e,onChange:t,onKeyDown:a,placeholder:l,disabled:o=!1,className:u,projectId:f,agentId:m,autoFocus:y=!1})=>{var X;const g=u.includes("composer-fullscreen-sheet__input"),S=_.useRef(null),p=_.useRef(null),[v,w]=_.useState({start:0,end:0}),[N,j]=_.useState(!1),[T,A]=_.useState(!1),[U,I]=_.useState(0),E=_.useMemo(()=>l5(e,v.start,v.end),[v.end,v.start,e]),L=_.useMemo(()=>o5(e,v.start,v.end),[v.end,v.start,e]),W=N&&!o&&!!E&&!T,ee=N&&!o&&!!L&&!T,F=ee?"command":W?"skill":null,G=aM(f,m,{enabled:W}),Q=K3({enabled:ee,scope:m?{agentId:m,projectId:f}:void 0}),Y=_.useMemo(()=>qT(G.data??[],(E==null?void 0:E.query)??"").slice(0,Tb),[E==null?void 0:E.query,G.data]),pe=_.useMemo(()=>{var oe;return WT(((oe=Q.data)==null?void 0:oe.commands)??[],(L==null?void 0:L.query)??"").slice(0,Tb)},[L==null?void 0:L.query,(X=Q.data)==null?void 0:X.commands]);_.useEffect(()=>{I(0)},[E==null?void 0:E.query,E==null?void 0:E.start,L==null?void 0:L.query,e,f]),_.useEffect(()=>{A(!1)},[E==null?void 0:E.query,E==null?void 0:E.start,E==null?void 0:E.end,L==null?void 0:L.query,L==null?void 0:L.start,L==null?void 0:L.end]);const ne=()=>{if(!S.current||!p.current)return;p.current.scrollTop=S.current.scrollTop,p.current.scrollLeft=S.current.scrollLeft;const oe=Math.max(0,S.current.offsetWidth-S.current.clientWidth);p.current.style.setProperty("--skill-aware-textarea-scrollbar-width",`${oe}px`)};_.useEffect(()=>{ne()},[e]),_.useEffect(()=>{if(typeof window>"u"||typeof ResizeObserver>"u")return;const oe=S.current;if(!oe)return;const ie=new ResizeObserver(()=>{ne()});return ie.observe(oe),ne(),()=>{ie.disconnect()}},[]);const V=()=>{S.current&&w({start:S.current.selectionStart??0,end:S.current.selectionEnd??0})},ye=oe=>{if(!S.current)return;const ie=$T(e,S.current.selectionStart??v.start,S.current.selectionEnd??v.end,oe.name);ie&&(t(ie.value),typeof window<"u"&&window.requestAnimationFrame(()=>{S.current&&(S.current.focus(),S.current.setSelectionRange(ie.selectionStart,ie.selectionEnd),w({start:ie.selectionStart,end:ie.selectionEnd}))}))},R=oe=>{if(!S.current)return;const ie=FT(e,S.current.selectionStart??v.start,S.current.selectionEnd??v.end,oe.name);ie&&(t(ie.value),typeof window<"u"&&window.requestAnimationFrame(()=>{S.current&&(S.current.focus(),S.current.setSelectionRange(ie.selectionStart,ie.selectionEnd),w({start:ie.selectionStart,end:ie.selectionEnd}))}))},H=oe=>{const ie=F==="skill"&&Y.length>0||F==="command"&&pe.length>0;if(F&&ie){if(oe.key==="ArrowDown"){oe.preventDefault();const k=F==="command"?pe.length:Y.length;I(K=>(K+1)%k);return}if(oe.key==="ArrowUp"){oe.preventDefault();const k=F==="command"?pe.length:Y.length;I(K=>K-1<0?k-1:K-1);return}if((oe.key==="Enter"||oe.key==="Tab")&&!oe.shiftKey&&!oe.altKey&&!oe.ctrlKey&&!oe.metaKey){if(oe.preventDefault(),F==="command"){const K=pe[U]??pe[0];if(!K)return;R(K);return}const k=Y[U]??Y[0];if(!k)return;ye(k);return}}if(F&&oe.key==="Escape"){oe.preventDefault(),A(!0);return}a==null||a(oe)};return i.jsxs("div",{className:`skill-aware-textarea ${F?"is-picker-open":""} ${g?"is-fullscreen":""}`,children:[ee?i.jsx("div",{className:"skill-mention-picker",role:"listbox","aria-label":"命令建议",children:Q.isLoading?i.jsx("div",{className:"skill-mention-picker__empty",children:"正在加载命令…"}):Q.isError?i.jsx("div",{className:"skill-mention-picker__empty",children:"命令列表加载失败"}):pe.length===0?i.jsx("div",{className:"skill-mention-picker__empty",children:"未找到匹配命令"}):pe.map((oe,ie)=>{const k=ie===U;return i.jsx("button",{type:"button",className:`skill-mention-picker__item ${k?"is-active":""}`,role:"option","aria-selected":k,onMouseDown:K=>{K.preventDefault(),R(oe)},onMouseEnter:()=>I(ie),children:i.jsxs("span",{className:"skill-mention-picker__main",children:[i.jsxs("span",{className:"skill-mention-picker__name",children:["/",oe.name]}),i.jsx("span",{className:"skill-mention-picker__description",children:oe.description})]})},oe.name)})}):W?i.jsx("div",{className:"skill-mention-picker",role:"listbox","aria-label":"技能建议",children:G.isLoading?i.jsx("div",{className:"skill-mention-picker__empty",children:"正在加载技能…"}):G.isError?i.jsx("div",{className:"skill-mention-picker__empty",children:"技能列表加载失败"}):Y.length===0?i.jsx("div",{className:"skill-mention-picker__empty",children:"未找到匹配技能"}):Y.map((oe,ie)=>{const k=ie===U;return i.jsx("button",{type:"button",className:`skill-mention-picker__item ${k?"is-active":""}`,role:"option","aria-selected":k,onMouseDown:K=>{K.preventDefault(),ye(oe)},onMouseEnter:()=>I(ie),children:i.jsxs("span",{className:"skill-mention-picker__main",children:[i.jsxs("span",{className:"skill-mention-picker__name",children:["$",oe.name]}),i.jsx("span",{className:"skill-mention-picker__description",children:oe.description}),i.jsx("span",{className:"skill-mention-picker__scope",children:HT(oe.scope)})]})},`${oe.scope}:${oe.name}:${oe.path}`)})}):null,i.jsxs("div",{className:"skill-aware-textarea__surface",children:[i.jsx("div",{ref:p,className:`${u} skill-aware-textarea__overlay`,"aria-hidden":"true",children:e?iM(e):i.jsx("span",{children:" "})}),i.jsx("textarea",{ref:S,className:`${u} skill-aware-textarea__input`,value:e,disabled:o,placeholder:l,autoFocus:y,onChange:oe=>{t(oe.target.value),A(!1),w({start:oe.target.selectionStart??0,end:oe.target.selectionEnd??0})},onKeyDown:H,onClick:V,onSelect:V,onKeyUp:V,onFocus:()=>{j(!0),A(!1),V()},onBlur:()=>{j(!1)},onScroll:ne})]})]})},jg=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M6 6l12 12"}),i.jsx("path",{d:"M18 6 6 18"})]}),rM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M12 5v14"}),i.jsx("path",{d:"m7 14 5 5 5-5"})]}),lM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M8 3H4v4"}),i.jsx("path",{d:"M16 3h4v4"}),i.jsx("path",{d:"M8 21H4v-4"}),i.jsx("path",{d:"M16 21h4v-4"}),i.jsx("path",{d:"M9 9 4 4"}),i.jsx("path",{d:"m15 9 5-5"}),i.jsx("path",{d:"m9 15-5 5"}),i.jsx("path",{d:"m15 15 5 5"})]}),oM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M12 5v14"}),i.jsx("path",{d:"M5 12h14"})]}),Rb=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"M13 2 5.5 13h5L9 22l9.5-13h-5L13 2Z"})}),Ab=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M9 6h10"}),i.jsx("path",{d:"M9 12h10"}),i.jsx("path",{d:"M9 18h10"}),i.jsx("path",{d:"m4 6 1.5 1.5L7.5 5"}),i.jsx("path",{d:"m4 12 1.5 1.5L7.5 11"}),i.jsx("path",{d:"m4 18 1.5 1.5L7.5 17"})]}),Db=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M7 10V7.8A5 5 0 0 1 12 3a5 5 0 0 1 5 4.8V10"}),i.jsx("path",{d:"M5.5 10h13a1.5 1.5 0 0 1 1.5 1.5v7A2.5 2.5 0 0 1 17.5 21h-11A2.5 2.5 0 0 1 4 18.5v-7A1.5 1.5 0 0 1 5.5 10Z"}),i.jsx("path",{d:"M12 14v2.6"})]}),cM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M12 16V5"}),i.jsx("path",{d:"m8 9 4-4 4 4"}),i.jsx("path",{d:"M20 16.5v1A2.5 2.5 0 0 1 17.5 20h-11A2.5 2.5 0 0 1 4 17.5v-1"})]}),c5=_.memo(function({isDesktopSidebar:t,sidebarShift:a,isSidebarDragging:l,composerError:o,onDismissComposerError:u,interactionRequests:f,pendingInteractionRequestId:m,onRespondInteraction:y,parentSession:g,backgroundAgentSessions:S,isBackgroundAgentsOpen:p,planSnapshot:v,onToggleBackgroundAgents:w,onOpenSession:N,getBackgroundAgentStatusLabel:j,getBackgroundAgentAccent:T,formatBackgroundAgentsLabel:A,hasBackgroundAgentStrip:U,commandPanel:I,isCommandPanelPending:E,onDismissCommandPanel:L,onCommandPanelOptionSelect:W,onCommandPanelTextSubmit:ee,projectId:F=null,agentId:G=null,draft:Q,pendingAttachments:Y,canSendInput:pe,canSubmitInput:ne=!0,isInputLocked:V=!1,inputPlaceholder:ye,readOnlyPlaceholder:R,onDraftChange:H,onUploadFiles:X,onRemoveAttachment:oe,onSubmit:ie,showStopIcon:k,isSendPending:K,onInterrupt:_e,isFastModeEnabled:fe,isPlanModeEnabled:Te,isYoloModeEnabled:re,onToggleFastMode:we,onTogglePlanMode:ve,onToggleYoloMode:ze,showModeBadges:Be=!1,selectedModel:St,modelOptions:Ke=[],selectedReasoning:tt,onSelectModel:nn,onSelectReasoning:Xt,contextUsage:jn,isContextUsageOpen:zt,onToggleContextUsage:Bt,contextUsageRingStyle:_t,usedPercent:vt,remainingPercent:dt,usedTokensLabel:cn,totalTokensLabel:Pn,showJumpToBottom:ke,onJumpToBottom:Z}){const me=_.useId(),[Ce,Oe]=_.useState(!1),[le,Ae]=_.useState(null),qe=_.useRef(null),bt=_.useRef(null),At=f[0]??null,ce=(At==null?void 0:At.kind)==="user_input",Me=f.length>0,Re=!!v&&!ce,We=!ce&&U,Xe=Re||We,Je=Me||Re||We,Tt={transform:`translateX(${a}px)`,transition:l?"none":void 0},Wt=(!!Q.trim()||Y.length>0)&&pe&&ne&&!V&&!K&&!k,ls=pe&&!V,Nt=Be&&(fe||Te||re),Un=()=>{Wt&&(Ae(null),ie())},Cn=De=>{De.key!=="Enter"||De.shiftKey||De.altKey||De.ctrlKey||De.metaKey||De.nativeEvent.isComposing||typeof window<"u"&&window.matchMedia("(max-width: 768px)").matches||(De.preventDefault(),Un())};_.useEffect(()=>{if(!Ce)return;const De=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=De}},[Ce]),_.useEffect(()=>{if(!Ce||typeof window>"u")return;const De=window.matchMedia("(min-width: 769px)"),Qt=()=>{De.matches&&Oe(!1)};return Qt(),typeof De.addEventListener=="function"?(De.addEventListener("change",Qt),()=>{De.removeEventListener("change",Qt)}):(De.addListener(Qt),()=>{De.removeListener(Qt)})},[Ce]),_.useEffect(()=>{if(!le)return;const De=On=>{const Ts=On.target;qe.current&&Ts instanceof Node&&qe.current.contains(Ts)||Ae(null)},Qt=On=>{On.key==="Escape"&&Ae(null)};return window.addEventListener("pointerdown",De),window.addEventListener("keydown",Qt),()=>{window.removeEventListener("pointerdown",De),window.removeEventListener("keydown",Qt)}},[le]);const Dn=De=>Nt?i.jsxs("div",{className:De,"aria-label":"当前已启用的会话模式",children:[fe?i.jsxs("button",{type:"button",className:"composer-mode-badge is-fast",onClick:()=>{Ae(null),we()},"aria-label":"关闭 Fast 模式",children:[i.jsx("span",{className:"composer-mode-badge__icon","aria-hidden":"true",children:i.jsx(Rb,{})}),i.jsx("span",{className:"composer-mode-badge__label",children:"Fast"})]}):null,Te?i.jsxs("button",{type:"button",className:"composer-mode-badge is-plan",onClick:()=>{Ae(null),ve()},"aria-label":"关闭计划模式",children:[i.jsx("span",{className:"composer-mode-badge__icon","aria-hidden":"true",children:i.jsx(Ab,{})}),i.jsx("span",{className:"composer-mode-badge__label",children:"计划"})]}):null,re?i.jsxs("button",{type:"button",className:"composer-mode-badge is-yolo",onClick:()=>{Ae(null),ze()},"aria-label":"关闭 Yolo 模式",children:[i.jsx("span",{className:"composer-mode-badge__icon","aria-hidden":"true",children:i.jsx(Db,{})}),i.jsx("span",{className:"composer-mode-badge__label",children:"Yolo"})]}):null]}):null;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:`composer-wrap ${t?"has-desktop-sidebar":""}`,style:Tt,children:[o?i.jsxs("div",{className:"composer-alert",role:"status","aria-live":"polite",children:[i.jsx("span",{className:"composer-alert__text",children:o}),i.jsx("button",{type:"button",className:"composer-alert__close",onClick:u,"aria-label":"关闭错误提示",children:i.jsx(jg,{})})]}):null,Me?i.jsx(eM,{requests:f,hasStripBelow:Xe,pendingRequestId:m,onRespond:y}):null,Re&&v?i.jsx(sM,{planSnapshot:v,hasStripAbove:Me,hasStripBelow:We}):null,We&&g?i.jsxs("button",{type:"button",className:`background-agents-exit ${Me||Re?"has-strip-above":""}`,onClick:()=>{N(g.id)},children:[i.jsx("span",{className:"background-agents-exit__icon","aria-hidden":"true",children:i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M6 12h12"}),i.jsx("path",{d:"m13 7 5 5-5 5"})]})}),i.jsx("span",{children:"返回主会话"})]}):We&&S.length>0?i.jsxs("section",{className:`background-agents-card ${p?"is-open":""} ${Me||Re?"has-strip-above":""}`,children:[i.jsxs("button",{type:"button",className:"background-agents-card__toggle",onClick:w,"aria-expanded":p,children:[i.jsx("span",{className:"background-agents-card__icon","aria-hidden":"true",children:i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("rect",{x:"7",y:"4",width:"10",height:"7",rx:"2.5"}),i.jsx("path",{d:"M12 11v3"}),i.jsx("circle",{cx:"10",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"14",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"}),i.jsx("path",{d:"M4.5 18a4.5 4.5 0 0 1 4.5-4.5h6A4.5 4.5 0 0 1 19.5 18"})]})}),i.jsxs("span",{className:"background-agents-card__summary",children:[i.jsx("span",{className:"background-agents-card__title",children:A(S.length)}),p?i.jsx("span",{className:"background-agents-card__hint",children:"(@ to tag agents)"}):null]}),i.jsx("span",{className:"background-agents-card__chevron","aria-hidden":"true",children:i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"m8 10 4 4 4-4"})})})]}),p?i.jsx("div",{className:"background-agents-card__list",children:S.map(De=>{var Qt,On;return i.jsxs("button",{type:"button",className:`background-agent-row ${De.run_state==="running"?"is-running":"is-idle"}`,style:{"--agent-accent":T(De)},onClick:()=>{N(De.id)},children:[i.jsx("span",{className:"background-agent-row__accent","aria-hidden":"true"}),i.jsxs("span",{className:"background-agent-row__meta",children:[i.jsxs("span",{className:"background-agent-row__title",children:[i.jsx("span",{className:"background-agent-row__name",children:((Qt=De.subagent)==null?void 0:Qt.nickname)??De.title}),i.jsxs("span",{className:"background-agent-row__role",children:["(",((On=De.subagent)==null?void 0:On.role)??"agent",")"]})]}),i.jsx("span",{className:"background-agent-row__status",children:j(De)})]}),i.jsx("span",{className:"background-agent-row__open",children:"Open"})]},De.id)})}):null]}):null,I?i.jsx(nM,{panel:I,isPending:E,onDismiss:L,onSelectOption:W,onSubmitText:ee}):null,ce?null:i.jsxs("form",{className:`chat-composer ${Je?"is-attached-to-agent-strip":""}`,onSubmit:De=>{De.preventDefault(),Un()},children:[i.jsxs("div",{className:"chat-composer__editor",children:[Y.length>0?i.jsx("div",{className:"chat-composer__attachments",children:Y.map(De=>{const Qt=k0(De.size_bytes);return i.jsxs("div",{className:"chat-composer__attachment-chip",children:[i.jsxs("div",{className:"chat-composer__attachment-copy",children:[i.jsx("span",{className:"chat-composer__attachment-name",children:De.name}),i.jsxs("span",{className:"chat-composer__attachment-meta",children:[De.kind==="image"?"图片":"文件",Qt?` · ${Qt}`:""]})]}),i.jsx("button",{type:"button",className:"chat-composer__attachment-remove","aria-label":`移除 ${De.name}`,onClick:()=>oe(De.id),children:i.jsx(jg,{})})]},De.id)})}):null,i.jsx(Mb,{className:"chat-composer__input",value:Q,disabled:!ls,projectId:F,agentId:G,placeholder:ls?ye??"要求后续变更":R??"当前会话为只读模式",onChange:H,onKeyDown:Cn}),i.jsx("button",{type:"button",className:"composer-fullscreen-toggle","aria-label":"全屏编辑",onClick:()=>Oe(!0),children:i.jsx(lM,{})}),i.jsx("input",{id:me,ref:bt,type:"file",className:"chat-composer__file-input",multiple:!0,onChange:De=>{De.target.files&&De.target.files.length>0&&X(De.target.files),De.target.value=""}})]}),Dn("composer-mode-badges composer-mode-badges--mobile"),i.jsxs("div",{className:"chat-composer__toolbar",children:[i.jsxs("div",{ref:qe,className:"chat-composer__controls",children:[i.jsxs("div",{className:`composer-utility-menu ${le==="utility"?"is-open":""}`,children:[i.jsx("button",{type:"button",className:"composer-utility-menu__trigger","aria-label":"打开额外功能","aria-expanded":le==="utility",onClick:()=>Ae(De=>De==="utility"?null:"utility"),children:i.jsx(oM,{})}),le==="utility"?i.jsxs("div",{className:"composer-utility-menu__popover",role:"menu",children:[i.jsxs("button",{type:"button",className:"composer-utility-menu__item",role:"menuitem",onClick:()=>{var De;Ae(null),(De=bt.current)==null||De.click()},children:[i.jsx("span",{className:"composer-utility-menu__item-icon","aria-hidden":"true",children:i.jsx(cM,{})}),i.jsx("span",{className:"composer-utility-menu__item-label",children:"上传文件"})]}),i.jsxs("button",{type:"button",className:"composer-utility-menu__item",role:"menuitemcheckbox","aria-checked":fe,onClick:we,children:[i.jsx("span",{className:"composer-utility-menu__item-icon","aria-hidden":"true",children:i.jsx(Rb,{})}),i.jsx("span",{className:"composer-utility-menu__item-label",children:"Fast 模式"}),i.jsx("span",{className:`composer-utility-menu__switch ${fe?"is-on":""}`,"aria-hidden":"true",children:i.jsx("span",{className:"composer-utility-menu__switch-thumb"})})]}),i.jsxs("button",{type:"button",className:"composer-utility-menu__item",role:"menuitemcheckbox","aria-checked":Te,onClick:ve,children:[i.jsx("span",{className:"composer-utility-menu__item-icon","aria-hidden":"true",children:i.jsx(Ab,{})}),i.jsx("span",{className:"composer-utility-menu__item-label",children:"计划模式"}),i.jsx("span",{className:`composer-utility-menu__switch ${Te?"is-on":""}`,"aria-hidden":"true",children:i.jsx("span",{className:"composer-utility-menu__switch-thumb"})})]}),i.jsxs("button",{type:"button",className:"composer-utility-menu__item",role:"menuitemcheckbox","aria-checked":re,onClick:ze,children:[i.jsx("span",{className:"composer-utility-menu__item-icon","aria-hidden":"true",children:i.jsx(Db,{})}),i.jsx("span",{className:"composer-utility-menu__item-label",children:"Yolo 模式"}),i.jsx("span",{className:`composer-utility-menu__switch ${re?"is-on":""}`,"aria-hidden":"true",children:i.jsx("span",{className:"composer-utility-menu__switch-thumb"})})]})]}):null]}),i.jsxs("div",{className:`composer-choice ${le==="model"?"is-open":""}`,children:[i.jsxs("button",{type:"button",className:"composer-control","aria-label":"选择模型","aria-expanded":le==="model",onClick:()=>Ae(De=>De==="model"?null:"model"),children:[i.jsx("span",{className:"composer-icon",children:i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M12 3 4 7v10l8 4 8-4V7z"}),i.jsx("path",{d:"m4 7 8 4 8-4"}),i.jsx("path",{d:"M12 11v10"})]})}),i.jsx("span",{className:"composer-control__value",children:dp(St,Ke)})]}),le==="model"?i.jsx("div",{className:"composer-choice-menu",role:"menu","aria-label":"选择模型",children:Ke.map(De=>i.jsxs("button",{type:"button",className:`composer-choice-menu__item ${St===De.value?"is-active":""}`,role:"menuitemradio","aria-checked":St===De.value,onClick:()=>{nn(De.value),Ae(null)},children:[i.jsx("span",{className:"composer-choice-menu__text",children:i.jsx("span",{className:"composer-choice-menu__label",children:De.label})}),St===De.value?i.jsx("span",{className:"composer-choice-menu__check",children:"✓"}):null]},De.value))}):null]}),i.jsxs("div",{className:`composer-choice ${le==="reasoning"?"is-open":""}`,children:[i.jsxs("button",{type:"button",className:"composer-control","aria-label":"选择推理强度","aria-expanded":le==="reasoning",onClick:()=>Ae(De=>De==="reasoning"?null:"reasoning"),children:[i.jsx("span",{className:"composer-icon",children:i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M9.5 3a6.5 6.5 0 0 0-3.7 11.84c.53.38.92.95 1.1 1.57l.1.34c.13.44.54.75 1 .75h7c.46 0 .87-.31 1-.75l.1-.34c.18-.62.57-1.2 1.1-1.57A6.5 6.5 0 0 0 14.5 3z"}),i.jsx("path",{d:"M10 21h4"}),i.jsx("path",{d:"M9 18h6"})]})}),i.jsx("span",{className:"composer-control__value",children:$E(tt)})]}),le==="reasoning"?i.jsx("div",{className:"composer-choice-menu",role:"menu","aria-label":"选择推理强度",children:Mf.map(De=>i.jsxs("button",{type:"button",className:`composer-choice-menu__item ${tt===De.value?"is-active":""}`,role:"menuitemradio","aria-checked":tt===De.value,onClick:()=>{Xt(De.value),Ae(null)},children:[i.jsx("span",{className:"composer-choice-menu__label",children:De.label}),tt===De.value?i.jsx("span",{className:"composer-choice-menu__check",children:"✓"}):null]},De.value))}):null]}),Dn("composer-mode-badges composer-mode-badges--inline")]}),i.jsxs("div",{className:"chat-composer__actions",children:[jn?i.jsxs("div",{className:`composer-context ${zt?"is-open":""}`,children:[i.jsx("button",{type:"button",className:"composer-context__trigger","aria-label":"查看背景信息窗口使用情况",onClick:De=>{De.stopPropagation(),Bt()},children:i.jsx("span",{className:"composer-context__ring",style:_t,children:i.jsx("span",{className:"composer-context__ring-core"})})}),zt?i.jsxs("div",{className:"composer-context__popover",role:"tooltip",children:[i.jsx("div",{className:"composer-context__title",children:"背景信息窗口:"}),i.jsxs("div",{children:[vt,"% 已用(剩余 ",dt,"%)"]}),i.jsxs("div",{children:["已用 ",cn,",共 ",Pn]})]}):null]}):null,i.jsx("button",{type:k?"button":"submit",className:"composer-send",disabled:k?!pe:!Wt,"aria-label":k?"中断":"发送",onClick:()=>{k&&_e()},children:k?i.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:i.jsx("rect",{x:"7",y:"7",width:"10",height:"10",rx:"2.5"})}):i.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:i.jsx("path",{d:"M12 17V7m0 0-4 4m4-4 4 4",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]})]})]}),Ce?i.jsx("div",{className:"composer-fullscreen-sheet",role:"dialog","aria-modal":"true","aria-label":"全屏编辑",children:i.jsxs("div",{className:"composer-fullscreen-sheet__panel",children:[i.jsxs("div",{className:"composer-fullscreen-sheet__header",children:[i.jsx("div",{className:"composer-fullscreen-sheet__title",children:"全屏编辑"}),i.jsx("button",{type:"button",className:"composer-fullscreen-sheet__close","aria-label":"退出全屏编辑",onClick:()=>Oe(!1),children:i.jsx(jg,{})})]}),i.jsx(Mb,{className:"composer-fullscreen-sheet__input",value:Q,disabled:!ls,projectId:F,agentId:G,placeholder:ls?ye??"要求后续变更":R??"当前会话为只读模式",onChange:H,onKeyDown:Cn,autoFocus:!0}),i.jsxs("div",{className:"composer-fullscreen-sheet__footer",children:[i.jsxs("div",{className:"composer-fullscreen-sheet__meta",children:[i.jsx("span",{children:St}),i.jsx("span",{children:tt}),re?i.jsx("span",{children:"Yolo"}):null,Y.length>0?i.jsxs("span",{children:[Y.length," 个附件"]}):null]}),i.jsxs("div",{className:"composer-fullscreen-sheet__actions",children:[i.jsx("button",{type:"button",className:"composer-fullscreen-sheet__button",onClick:()=>Oe(!1),children:"关闭"}),k?i.jsx("button",{type:"button",className:"composer-fullscreen-sheet__button is-primary",disabled:!pe,onClick:_e,children:"中断"}):i.jsx("button",{type:"button",className:"composer-fullscreen-sheet__button is-primary",disabled:!Wt,onClick:()=>{Un(),Oe(!1)},children:"发送"})]})]})]})}):null,ke?i.jsx("button",{type:"button",className:`conversation-jump-bottom ${t?"has-desktop-sidebar":""}`,style:Tt,onClick:Z,"aria-label":"滚动到最下面",children:i.jsx(rM,{})}):null]})}),Ob=10,uM=e=>{const t=e.replace(/\s+/g," ").trim();return t.length<=Ob?t:t.slice(0,Ob).trimEnd()},dM=(e,t)=>{var l,o;const a=uM(e);return a||((o=(l=t[0])==null?void 0:l.name)==null?void 0:o.trim())||"附件"},fM=e=>{var a;const t=/^\/([A-Za-z][A-Za-z0-9._-]*)/.exec(e.trim());return((a=t==null?void 0:t[1])==null?void 0:a.toLowerCase())??""},hM=({currentAgent:e,projects:t,sessions:a,initialProjectId:l=null,entryView:o,isDesktopSidebar:u,sidebarOffset:f,isSidebarDragging:m,onOpenSidebar:y,onProjectSelected:g,onSessionCreated:S})=>{const p=La(),[v,w]=_.useState(""),[N,j]=_.useState(l),[T,A]=_.useState(null),[U,I]=_.useState(null),[E,L]=_.useState(()=>v_()),[W,ee]=_.useState(()=>R3()),[F,G]=_.useState([]),[Q,Y]=_.useState(!1),[pe,ne]=_.useState(!1),[V,ye]=_.useState(!1),[R,H]=_.useState(o),X=j_(),oe=_.useMemo(()=>X.map(({id:re,...we})=>we),[X]),ie=_.useMemo(()=>t.find(re=>re.id===N)??t[0]??null,[t,N]);_.useEffect(()=>{_f(E)},[E]),_.useEffect(()=>{A3(W)},[W]),_.useEffect(()=>{oe.length!==0&&(oe.some(re=>re.value===E)||L(oe[0].value))},[oe,E]),_.useEffect(()=>{H(o)},[o]),_.useEffect(()=>{I(null)},[N]),_.useEffect(()=>{var we,ve;if(N&&t.some(ze=>ze.id===N))return;const re=(l&&t.some(ze=>ze.id===l)?l:null)??((we=a.find(ze=>!ze.archived))==null?void 0:we.project_id)??((ve=t[0])==null?void 0:ve.id)??null;j(re)},[l,t,N,a]);const k=ss({mutationFn:async re=>{if(!ie||!re.input.trim()&&re.attachments.length===0)throw new Error("请先选择线程,再输入第一条消息");return(await(await xn({projectId:re.projectId,agentId:e.id})).client.createSession({agentId:e.id,projectId:re.projectId,title:re.title,input:re.input,attachments:re.attachments,model:re.model,reasoningEffort:re.reasoningEffort,serviceTier:re.serviceTier,planMode:re.planMode,yoloMode:re.yoloMode})).session},onMutate:()=>A(null),onSuccess:async(re,we)=>{const ve=new Date().toISOString(),ze={id:`optimistic-user:${re.id}:create`,kind:"user",title:"你",body:we.input,body_truncated:!1,detail_available:!1,patch_summary:null,session_ids:[],timestamp:re.last_event_at||ve,accent:"primary",attachments:i5(we.attachments)};Zi(e.id),na(re.id),HE(re.id,{isFastModeEnabled:we.serviceTier==="fast",isPlanModeEnabled:we.planMode,isYoloModeEnabled:we.yoloMode}),Wr(re.id),uu(null),GN({sessionId:re.id,agentId:re.agent_id,projectId:re.project_id,createdAt:ve,session:re,project:ie?{id:ie.id,agent_id:ie.agent_id,name:ie.name,display_name:ie.display_name,pinned:ie.pinned,path:ie.path}:null,optimisticEntry:ze}),p.setQueriesData({queryKey:rs},Be=>e3(Be,re)),p.setQueryData(Lo(re.id),Be=>w0(Be,ze)),Y(!1),ne(!1),ye(!1),S(re.id),p.invalidateQueries({queryKey:["plan",re.id]}),p.invalidateQueries({queryKey:["change-sets",re.id]})},onError:re=>{A(re instanceof Error?re.message:"创建会话失败")}}),K=(ie==null?void 0:ie.path)??null,_e=R==="directory-picker",fe={transform:`translateX(${f}px)`,transition:m?"none":void 0},Te=()=>{const re=v.trim();if(!(!re&&F.length===0||k.isPending||!ie)){if(C_(re)){if(F.length>0){A("命令暂不支持附件,请先移除附件后再执行。");return}const we=fM(re);if(we==="model"){if(w(""),oe.length>0){I({panel_id:`new-thread-command-${Date.now()}`,session_id:`new-thread:${ie.id}`,command_name:we,command_text:re,title:"为新会话选择模型",description:"选择后会更新新会话的默认模型,再继续输入真正的首条消息。",status:"awaiting_input",body:"在下面选择一个模型。",submitted_at:new Date().toISOString(),updated_at:new Date().toISOString(),input_type:"choice",options:oe.map(ve=>({id:ve.value,label:ve.label,description:ve.description??null})),input_placeholder:null,submit_label:null,effect:null});return}I({panel_id:`new-thread-command-${Date.now()}`,session_id:`new-thread:${ie.id}`,command_name:we,command_text:re,title:"为新会话选择模型",description:"选择后会更新新会话的默认模型,再继续输入真正的首条消息。",status:"completed",body:"当前没有可选模型,请先去设置页维护模型列表。",submitted_at:new Date().toISOString(),updated_at:new Date().toISOString(),input_type:"none",options:[],input_placeholder:null,submit_label:null,effect:null});return}if(we==="status"){w(""),I({panel_id:`new-thread-command-${Date.now()}`,session_id:`new-thread:${ie.id}`,command_name:we,command_text:re,title:"新会话当前设置",description:"这里展示的是创建下一条会话时会使用的本地设置。",status:"completed",body:[`线程:${ie.display_name??ie.name}`,`模型:${E}`,`推理强度:${W}`,`Fast 模式:${Q?"开启":"关闭"}`,`计划模式:${pe?"开启":"关闭"}`,`Yolo 模式:${V?"开启":"关闭"}`].join(`
136
+ `),submitted_at:new Date().toISOString(),updated_at:new Date().toISOString(),input_type:"none",options:[],input_placeholder:null,submit_label:null,effect:null});return}w(""),I({panel_id:`new-thread-command-${Date.now()}`,session_id:`new-thread:${ie.id}`,command_name:we||"unknown",command_text:re,title:`/${we||"unknown"} 暂不可用`,description:"新建线程阶段目前只接入了少量本地命令。",status:"completed",body:"请先进入已有会话后再执行这个命令,或者先使用 /model 调整新会话默认模型。",submitted_at:new Date().toISOString(),updated_at:new Date().toISOString(),input_type:"none",options:[],input_placeholder:null,submit_label:null,effect:null});return}k.mutate({projectId:ie.id,input:re,title:dM(re,F),attachments:F,model:E,reasoningEffort:W,serviceTier:Q?"fast":void 0,planMode:pe,yoloMode:V})}};return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:`conversation-main conversation-main--new-thread ${u?"has-desktop-sidebar":""}`,style:fe,children:[i.jsxs("div",{className:"conversation-topbar",children:[u?null:i.jsxs("button",{type:"button",className:"conversation-menu",onClick:y,"aria-label":"打开侧边栏",children:[i.jsx("span",{}),i.jsx("span",{className:"short"})]}),i.jsx("div",{className:"conversation-topbar__meta",children:i.jsx("div",{className:"conversation-topbar__title-row",children:i.jsx("h1",{"aria-label":"未命名会话",children:" "})})})]}),i.jsx("div",{className:"conversation-scroll conversation-scroll--empty",children:i.jsx("div",{className:"conversation-thread conversation-thread--empty",children:_e?i.jsx(GT,{agentId:e.id,projects:t,title:"选择目录",subtitle:"",onProjectCreated:re=>{p.setQueriesData({queryKey:rs},we=>$k(we,re)),j(re.id),g(re.id),H("composer")}}):i.jsx("section",{className:"new-thread-hero",children:i.jsxs("div",{className:"new-thread-hero__stack",children:[i.jsx(VT,{}),i.jsxs("label",{className:"new-thread-hero__selector",children:[i.jsx("span",{className:"new-thread-hero__selector-label",children:"在线程中发起会话"}),i.jsx("select",{className:"new-thread-hero__select",value:N??"",onChange:re=>{const we=re.target.value||null;j(we),we&&g(we)},children:t.map(re=>i.jsx("option",{value:re.id,children:re.display_name??re.name},re.id))})]}),K?i.jsx("div",{className:"new-thread-hero__path",children:K}):i.jsx("div",{className:"new-thread-hero__hint",children:"选择一个线程后,直接输入第一条消息即可开始。"}),u?null:i.jsx("button",{type:"button",className:"new-thread-hero__directory-trigger",onClick:()=>H("directory-picker"),children:"新增目录线程"})]})})})})]}),_e?null:i.jsx(c5,{isDesktopSidebar:u,sidebarShift:f,isSidebarDragging:m,composerError:T,onDismissComposerError:()=>A(null),interactionRequests:[],pendingInteractionRequestId:null,onRespondInteraction:()=>{},parentSession:null,backgroundAgentSessions:[],isBackgroundAgentsOpen:!1,planSnapshot:null,onToggleBackgroundAgents:()=>{},onOpenSession:()=>{},getBackgroundAgentStatusLabel:()=>"",getBackgroundAgentAccent:()=>"var(--color-accent-primary)",formatBackgroundAgentsLabel:re=>`${re} background agents`,hasBackgroundAgentStrip:!1,commandPanel:U,isCommandPanelPending:!1,onDismissCommandPanel:()=>I(null),onCommandPanelOptionSelect:re=>{L(re),I(we=>we&&{...we,status:"completed",body:`新会话默认模型已切换为 ${dp(re,oe)}。现在可以继续输入真正的首条消息。`,updated_at:new Date().toISOString(),input_type:"none",options:[]})},onCommandPanelTextSubmit:()=>{},projectId:(ie==null?void 0:ie.id)??null,agentId:e.id,draft:v,pendingAttachments:F,canSendInput:!!ie,inputPlaceholder:ie?`向 ${ie.display_name??ie.name} 发起第一条任务…`:"先选择线程,再输入第一条任务",readOnlyPlaceholder:"先选择线程,再输入第一条任务",onDraftChange:w,onUploadFiles:re=>{const we=[...re];we.length!==0&&(A(null),Promise.all(we.map(ve=>a5(ve))).then(ve=>{G(ze=>[...ze,...ve])}).catch(ve=>{A(ve instanceof Error?ve.message:"无法读取附件")}))},onRemoveAttachment:re=>{G(we=>we.filter(ve=>ve.id!==re))},onSubmit:Te,showStopIcon:!1,isSendPending:k.isPending,onInterrupt:()=>{},isFastModeEnabled:Q,isPlanModeEnabled:pe,isYoloModeEnabled:V,onToggleFastMode:()=>Y(re=>!re),onTogglePlanMode:()=>ne(re=>!re),onToggleYoloMode:()=>ye(re=>!re),showModeBadges:!0,selectedModel:E,modelOptions:oe,selectedReasoning:W,onSelectModel:L,onSelectReasoning:re=>ee(re),contextUsage:null,isContextUsageOpen:!1,onToggleContextUsage:()=>{},usedPercent:0,remainingPercent:0,usedTokensLabel:"0",totalTokensLabel:"0",showJumpToBottom:!1,onJumpToBottom:()=>{}})]})},u5="panda:session-timeline-snapshots",Am=1,mM=1440*60*1e3,d5=12,pM=e=>{if(typeof window>"u")return null;try{const t=window.localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}},gM=(e,t)=>{if(!(typeof window>"u"))try{window.localStorage.setItem(e,JSON.stringify(t))}catch{}},f5=()=>{const e=pM(u5);if(!e||e.version!==Am||!Array.isArray(e.items))return{version:Am,items:[]};const t=Date.now(),a=e.items.filter(l=>!!(l&&typeof l.sessionId=="string"&&typeof l.storedAt=="number"&&l.snapshot&&typeof l.snapshot=="object")).filter(l=>t-l.storedAt<=mM).sort((l,o)=>o.storedAt-l.storedAt).slice(0,d5);return{version:Am,items:a}},_M=e=>{const a=f5().items.find(l=>l.sessionId===e);return a?a.snapshot:null},yM=e=>{if(!e||e.view!=="full_compact")return;const t=Date.now(),a=f5(),l=[{sessionId:e.session_id,storedAt:t,snapshot:e},...a.items.filter(o=>o.sessionId!==e.session_id)].slice(0,d5);gM(u5,{version:Am,items:l})},vM=e=>{var t,a,l;return["session-tool-detail",((t=e==null?void 0:e.scope)==null?void 0:t.sessionId)??"",(a=e==null?void 0:e.scope)!=null&&a.sessionId?"":((l=e==null?void 0:e.scope)==null?void 0:l.agentId)??"",(e==null?void 0:e.sessionId)??"",(e==null?void 0:e.entryId)??""]};function bM(e){return is({queryKey:vM(e),enabled:!!((e==null?void 0:e.enabled)??!0)&&!!(e!=null&&e.sessionId)&&!!(e!=null&&e.entryId),queryFn:async()=>!(e!=null&&e.sessionId)||!(e!=null&&e.entryId)?null:(await xn(e.scope)).client.getSessionToolCallDetail(e.sessionId,e.entryId),refetchInterval:!1,refetchOnMount:!1,refetchOnWindowFocus:!1,retry:1})}const h5=e=>{var t,a,l;return["workspace-session-detail",((t=e==null?void 0:e.scope)==null?void 0:t.sessionId)??"",(a=e==null?void 0:e.scope)!=null&&a.sessionId?"":((l=e==null?void 0:e.scope)==null?void 0:l.agentId)??"",(e==null?void 0:e.sessionId)??""]};function xM(e){return is({queryKey:h5(e),enabled:!!((e==null?void 0:e.enabled)??!0)&&!!(e!=null&&e.sessionId),queryFn:async()=>e!=null&&e.sessionId?(await xn(e.scope)).client.getWorkspaceSessionDetail(e.sessionId):null,refetchInterval:!1,refetchOnMount:!1,refetchOnWindowFocus:!1,retry:1})}const SM={can_stream_live:!1,can_send_input:!1,can_interrupt:!1,can_approve:!1,can_reject:!1,can_show_git:!1,can_show_terminal:!1},jM=e=>({id:e.id,agent_id:e.agent_id,project_id:e.project_id,archived:e.archived,title:e.title,last_event_at:e.last_event_at,pinned:e.pinned,run_state:e.run_state,run_state_changed_at:e.run_state_changed_at,subagent:e.subagent,provider:"codex",mode:"managed",health:"active",branch:"",worktree:"",summary:"",latest_assistant_message:null,context_usage:null,capability:SM}),wM=(e,t)=>e?!t||t.id!==e.id?jM(e):{...t,id:e.id,agent_id:e.agent_id,project_id:e.project_id,archived:e.archived,title:e.title,last_event_at:e.last_event_at,pinned:e.pinned,run_state:e.run_state,run_state_changed_at:e.run_state_changed_at,subagent:e.subagent}:t??null,Ib=e=>{if(!e)return null;const t={};return typeof e.title=="string"&&(t.title=e.title),typeof e.archived=="boolean"&&(t.archived=e.archived),typeof e.pinned=="boolean"&&(t.pinned=e.pinned),typeof e.last_event_at=="string"&&(t.last_event_at=e.last_event_at),(e.run_state==="idle"||e.run_state==="running"||e.run_state==="completed")&&(t.run_state=e.run_state),(e.run_state_changed_at===null||typeof e.run_state_changed_at=="string")&&(t.run_state_changed_at=e.run_state_changed_at),typeof e.summary=="string"&&(t.summary=e.summary),(e.latest_assistant_message===null||typeof e.latest_assistant_message=="string")&&(t.latest_assistant_message=e.latest_assistant_message),typeof e.provider=="string"&&(t.provider=e.provider),typeof e.mode=="string"&&(t.mode=e.mode),typeof e.health=="string"&&(t.health=e.health),typeof e.branch=="string"&&(t.branch=e.branch),typeof e.worktree=="string"&&(t.worktree=e.worktree),(e.context_usage===null||typeof e.context_usage=="object"&&e.context_usage!==null)&&(t.context_usage=e.context_usage),(e.subagent===null||typeof e.subagent=="object"&&e.subagent!==null)&&(t.subagent=e.subagent),typeof e.capability=="object"&&e.capability!==null&&(t.capability=e.capability),Object.keys(t).length>0?t:null},NM=(e,t,a)=>{if(!e||e.session.id!==t)return e;const{last_event_at:l,...o}=a;let u={...e.session,...o};if(typeof l=="string"&&l.trim()){const f=new Date(l).getTime(),m=new Date(e.session.last_event_at).getTime();Number.isFinite(f)&&(!Number.isFinite(m)||f>m)&&(u={...u,last_event_at:l})}return{...e,session:u}},Lb=_.lazy(async()=>({default:(await ao(()=>import("./session-diff-preview-Ch1u5o_s.js"),[])).SessionDiffPreview})),wg=["var(--session-git-graph-1)","var(--session-git-graph-2)","var(--session-git-graph-3)","var(--session-git-graph-4)","var(--session-git-graph-5)","var(--session-git-graph-6)"],m5=14,p5=10,Il=24,eu=48,Ng=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"m9 6 6 6-6 6"})}),kM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M20 11a8 8 0 1 0 2.2 5.5"}),i.jsx("path",{d:"M20 4v7h-7"})]}),EM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M3 12a9 9 0 1 0 2.64-6.36"}),i.jsx("path",{d:"M3 4v5h5"}),i.jsx("path",{d:"M12 7v5l3 2"})]}),Pb=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M9 14 4 9l5-5"}),i.jsx("path",{d:"M4 9h8a8 8 0 1 1 0 16h-1"})]}),Ub=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M7.5 12.5 10.5 15.5 16.5 8.5"}),i.jsx("circle",{cx:"12",cy:"12",r:"8.5"})]}),CM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M12 16V5"}),i.jsx("path",{d:"m7.5 9.5 4.5-4.5 4.5 4.5"}),i.jsx("path",{d:"M5 19h14"})]}),TM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M6 6 18 18"}),i.jsx("path",{d:"M18 6 6 18"})]}),MM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M7 4v10"}),i.jsx("path",{d:"M7 14a4 4 0 0 0 4 4h6"}),i.jsx("path",{d:"M17 6a4 4 0 0 0-4 4H7"}),i.jsx("circle",{cx:"7",cy:"4",r:"2"}),i.jsx("circle",{cx:"17",cy:"6",r:"2"}),i.jsx("circle",{cx:"17",cy:"18",r:"2"})]}),RM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("rect",{x:"4",y:"5",width:"16",height:"11",rx:"2"}),i.jsx("path",{d:"M8 19h8"}),i.jsx("path",{d:"M10 16v3"}),i.jsx("path",{d:"M14 16v3"})]}),AM=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"M7.5 18a4.5 4.5 0 1 1 .9-8.91A5.5 5.5 0 0 1 19 11a3.5 3.5 0 0 1-.5 7Z"})}),DM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M7 4v10"}),i.jsx("path",{d:"M7 14a4 4 0 0 0 4 4h6"}),i.jsx("path",{d:"M7 10a4 4 0 0 1 4-4h6"}),i.jsx("circle",{cx:"7",cy:"4",r:"2"}),i.jsx("circle",{cx:"17",cy:"6",r:"2"}),i.jsx("circle",{cx:"17",cy:"18",r:"2"})]}),Ll=({label:e,icon:t,onClick:a,disabled:l=!1,variant:o="default",pending:u=!1,className:f})=>i.jsx("button",{type:"button",className:`session-git-panel__icon-button is-${o} ${u?"is-pending":""} ${f??""}`.trim(),onClick:a,disabled:l,"aria-label":e,title:e,children:i.jsx("span",{className:"session-git-panel__icon-button-glyph","aria-hidden":"true",children:t})}),zb=e=>{switch(e){case"added":return"A";case"deleted":return"D";case"renamed":return"R";case"untracked":return"U";default:return"M"}},OM=e=>e.status==="renamed"&&e.previous_path?`该变更仅包含重命名:${e.previous_path} -> ${e.path}`:e.status==="deleted"?"该文件已删除,没有可展示的补丁内容。":e.status==="untracked"?"该文件还没有可展示的补丁内容。":"此变更没有可展示的补丁内容。",IM=(e,t)=>t&&t.diff.trim()?"此变更没有可展示的补丁内容。":e.status==="renamed"&&e.previous_path?`该提交仅包含重命名:${e.previous_path} -> ${e.path}`:e.status==="deleted"?"该文件在这次提交中已删除,没有可展示的补丁内容。":"该文件在这次提交中没有可展示的补丁内容。",ef=e=>wg[e%wg.length]??wg[0],Oo=e=>p5+e*m5,gm=(e,t)=>`${e}\0${t}`,T_=e=>Array.isArray(e.parent_oids)?e.parent_oids.filter(Boolean):[],LM=e=>Array.isArray(e.refs)?e.refs.filter(Boolean):[],PM=e=>{var u;const t={};let a=[],l=0;const o=()=>{const f=l;return l+=1,f};for(const f of e){let m=a.findIndex(w=>w.oid===f.oid);m<0&&(a=[...a,{oid:f.oid,colorIndex:o()}],m=a.length-1);const y=a.map(w=>({...w})),g=((u=y[m])==null?void 0:u.colorIndex)??o(),S=[...new Set(T_(f))],p=y.map(w=>({...w}));S.length>0?p[m]={oid:S[0],colorIndex:g}:p.splice(m,1);const v=[];if(S.length>0){const w=p.findIndex(N=>N.oid===S[0]);v.push(w>=0?w:m)}S.slice(1).forEach((w,N)=>{let j=p.findIndex(T=>T.oid===w);j<0&&(j=Math.min(p.length,m+1+N),p.splice(j,0,{oid:w,colorIndex:o()})),v.push(j)}),t[f.oid]={beforeLanes:y,afterLanes:p,laneIndex:m,nodeColorIndex:g,parentLaneIndexes:v},a=p.filter((w,N,j)=>j.findIndex(T=>T.oid===w.oid)===N)}return t},UM=({commit:e,row:t,isLocalHead:a,isRemoteHead:l,isFirstRow:o,maxLaneCount:u})=>{const f=T_(e).length,m=Math.max(u,t.beforeLanes.length,t.afterLanes.length,1),y=Math.max(40,p5*2+(m-1)*m5),g=Oo(t.laneIndex),S=f>1?4.7:3.9,p=Math.max(0,Il-S-1.1),v={"--session-git-graph-width":`${Math.max(48,Math.ceil(y*(56/eu)))}px`};return i.jsx("span",{className:"session-git-history__graph",style:v,children:i.jsxs("svg",{className:`session-git-history__graph-svg ${f>1?"is-merge":""}`,viewBox:`0 0 ${y} ${eu}`,preserveAspectRatio:"xMinYMid meet","aria-hidden":"true",children:[t.beforeLanes.map((w,N)=>i.jsx("path",{d:`M ${Oo(N)} ${o?p:0} L ${Oo(N)} ${p}`,stroke:ef(w.colorIndex),strokeWidth:"2",strokeLinecap:"round",fill:"none",opacity:o?0:1},`before:${w.oid}:${N}`)),t.afterLanes.map((w,N)=>{const j=t.beforeLanes.findIndex(I=>I.oid===w.oid),T=j>=0?Oo(j):Oo(N),A=Oo(N),U=T===A?`M ${A} ${Il} L ${A} ${eu}`:`M ${T} ${Il} C ${T} 27 ${A} 31 ${A} ${eu}`;return i.jsx("path",{d:U,stroke:ef(w.colorIndex),strokeWidth:"2",strokeLinecap:"round",fill:"none"},`after:${w.oid}:${N}`)}),t.parentLaneIndexes.map((w,N)=>{var U;const j=Oo(w),T=ef(((U=t.afterLanes[w])==null?void 0:U.colorIndex)??t.nodeColorIndex),A=j===g?`M ${g} ${Il} L ${j} ${eu}`:`M ${g} ${Il} C ${g} 27 ${j} 31 ${j} ${eu}`;return i.jsx("path",{d:A,stroke:T,strokeWidth:N>0||f>1?"2.2":"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none",opacity:N>0||f>1?.96:.88},`parent:${e.oid}:${N}`)}),i.jsx("circle",{cx:g,cy:Il,r:S,fill:"var(--color-surface-panel)",stroke:ef(t.nodeColorIndex),strokeWidth:f>1?"1.8":"1.55"}),i.jsx("circle",{cx:g,cy:Il,r:a||l?1.6:1.05,fill:ef(t.nodeColorIndex)}),a&&l?i.jsx("circle",{cx:g,cy:Il,r:"6.4",fill:"none",stroke:"color-mix(in oklab, var(--color-accent-primary) 22%, transparent)",strokeWidth:"1",strokeDasharray:"1.5 3"}):null]})})},zM=({workspace:e,history:t,isLoading:a,isHistoryLoading:l,error:o,historyError:u,onRefresh:f,onRefreshHistory:m,onRequestHistory:y,onDiscardFile:g,onDiscardAll:S,onCommitAll:p,onSwitchBranch:v,onPush:w,onLoadWorkspaceFileDiff:N,onLoadHistoryFileDiff:j,pendingAction:T,compact:A=!1})=>{const[U,I]=_.useState("changes"),[E,L]=_.useState({}),[W,ee]=_.useState({}),[F,G]=_.useState({}),[Q,Y]=_.useState({}),[pe,ne]=_.useState({}),[V,ye]=_.useState({}),[R,H]=_.useState({}),[X,oe]=_.useState({}),[ie,k]=_.useState({}),[K,_e]=_.useState(!1),[fe,Te]=_.useState(null),[re,we]=_.useState(""),[ve,ze]=_.useState(null),Be=_.useRef(null);_.useEffect(()=>{L(Me=>{if(!(e!=null&&e.files.length))return{};const Re=new Set(e.files.map(Je=>Je.path));let We=!1;const Xe={};for(const[Je,Tt]of Object.entries(Me)){if(!Re.has(Je)){We=!0;continue}Xe[Je]=Tt}return We?Xe:Me});const ce=new Set((e==null?void 0:e.files.map(Me=>Me.path))??[]);ee(Me=>{let Re=!1;const We={};for(const[Xe,Je]of Object.entries(Me)){if(!ce.has(Xe)){Re=!0;continue}We[Xe]=Je}return Re?We:Me}),G(Me=>{let Re=!1;const We={};for(const[Xe,Je]of Object.entries(Me)){if(!ce.has(Xe)){Re=!0;continue}We[Xe]=Je}return Re?We:Me}),Y(Me=>{let Re=!1;const We={};for(const[Xe,Je]of Object.entries(Me)){if(!ce.has(Xe)){Re=!0;continue}We[Xe]=Je}return Re?We:Me})},[e==null?void 0:e.files]),_.useEffect(()=>{const ce=new Set((t==null?void 0:t.commits.map(Re=>Re.oid))??[]),Me=new Set((t==null?void 0:t.commits.flatMap(Re=>Re.files.map(We=>gm(Re.oid,We.path))))??[]);ne(Re=>{let We=!1;const Xe={};for(const[Je,Tt]of Object.entries(Re)){if(!ce.has(Je)){We=!0;continue}Xe[Je]=Tt}return We?Xe:Re}),ye(Re=>{let We=!1;const Xe={};for(const[Je,Tt]of Object.entries(Re)){if(!ce.has(Je)){We=!0;continue}if(Tt&&!Me.has(gm(Je,Tt))){We=!0,Xe[Je]=null;continue}Xe[Je]=Tt}return We?Xe:Re}),H(Re=>{let We=!1;const Xe={};for(const[Je,Tt]of Object.entries(Re)){if(!Me.has(Je)){We=!0;continue}Xe[Je]=Tt}return We?Xe:Re}),oe(Re=>{let We=!1;const Xe={};for(const[Je,Tt]of Object.entries(Re)){if(!Me.has(Je)){We=!0;continue}Xe[Je]=Tt}return We?Xe:Re}),k(Re=>{let We=!1;const Xe={};for(const[Je,Tt]of Object.entries(Re)){if(!Me.has(Je)){We=!0;continue}Xe[Je]=Tt}return We?Xe:Re})},[t==null?void 0:t.commits]),_.useEffect(()=>{if(!K)return;const ce=Me=>{var Re;(Re=Be.current)!=null&&Re.contains(Me.target)||_e(!1)};return window.addEventListener("pointerdown",ce),()=>{window.removeEventListener("pointerdown",ce)}},[K]),_.useEffect(()=>{e&&(fe==="commit"&&(T==null?void 0:T.action)!=="commit-all"&&e.files.length===0&&(Te(null),we("")),ve&&e.branch===ve&&(ze(null),Te(null),we(""),_e(!1)))},[fe,T==null?void 0:T.action,ve,e]),_.useEffect(()=>{e!=null&&e.branches.length||_e(!1)},[e==null?void 0:e.branches]),_.useEffect(()=>{ee({}),G({}),Y({})},[e==null?void 0:e.updated_at]);const St=(e==null?void 0:e.files)??[],Ke=(t==null?void 0:t.commits)??[],tt=St.length>0,nn=Ke.length>0,Xt=(T==null?void 0:T.action)==="discard-all",jn=(T==null?void 0:T.action)==="commit-all",zt=(T==null?void 0:T.action)==="switch-branch",Bt=(T==null?void 0:T.action)==="push",_t=U==="changes",vt=fe==="switch-branch"&&ve?`提交后切换到 ${ve}`:"提交全部改动",dt=_.useMemo(()=>{if(!e)return null;const ce=[];return e.upstream_branch&&ce.push(e.upstream_branch),e.ahead_count>0&&ce.push(`ahead ${e.ahead_count}`),e.behind_count>0&&ce.push(`behind ${e.behind_count}`),ce.join(" · ")},[e]),cn=_.useMemo(()=>{if(!t)return null;const ce=[t.branch];return t.upstream_branch&&ce.push(t.upstream_branch),ce.join(" · ")},[t]),Pn=_.useMemo(()=>U==="history"?PM(Ke):{},[U,Ke]),ke=_.useMemo(()=>U!=="history"?1:Math.max(1,...Object.values(Pn).map(ce=>Math.max(ce.beforeLanes.length,ce.afterLanes.length,ce.laneIndex+1))),[U,Pn]),Z=(ce,Me)=>{W[ce]||F[ce]||(G(Re=>({...Re,[ce]:!0})),Y(Re=>{const We={...Re};return delete We[ce],We}),N(ce,Me).then(Re=>{ee(We=>({...We,[ce]:Re}))}).catch(Re=>{Y(We=>({...We,[ce]:Re instanceof Error?Re.message:"无法读取该文件的差异。"}))}).finally(()=>{G(Re=>{const We={...Re};return delete We[ce],We})}))};_.useEffect(()=>{if(!(U!=="changes"||St.length===0))for(const ce of St)E[ce.path]&&Z(ce.path,ce.previous_path)},[U,E,St,N,W,F]);const me=()=>{Te(null),we(""),ze(null)},Ce=()=>{ze(null),Te(ce=>ce==="commit"?(we(""),null):"commit")},Oe=()=>{const ce=re.trim();if(ce){if(fe==="switch-branch"&&ve){Promise.resolve(v(ve,ce)).catch(()=>{});return}p(ce)}},le=ce=>{if(!(!e||ce===e.branch||T)){if(_e(!1),e.files.length>0){ze(ce),Te("switch-branch");return}Promise.resolve(v(ce)).catch(()=>{})}},Ae=()=>{if(_t){f();return}m()},qe=()=>{I(ce=>{const Me=ce==="changes"?"history":"changes";return Me==="history"&&y(),Me})},bt=(ce,Me)=>{const Re=gm(ce.oid,Me.path),We=V[ce.oid]===Me.path;ye(Xe=>({...Xe,[ce.oid]:We?null:Me.path})),!(We||R[Re]||X[Re])&&(oe(Xe=>({...Xe,[Re]:!0})),k(Xe=>{const Je={...Xe};return delete Je[Re],Je}),j(ce.oid,Me.path,Me.previous_path).then(Xe=>{H(Je=>({...Je,[Re]:Xe}))}).catch(Xe=>{k(Je=>({...Je,[Re]:Xe instanceof Error?Xe.message:"无法读取该文件的提交差异。"}))}).finally(()=>{oe(Xe=>{const Je={...Xe};return delete Je[Re],Je})}))},At=ce=>{const Me=new Date(ce);return Number.isNaN(Me.getTime())?ce:new Intl.DateTimeFormat("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(Me)};return i.jsxs("section",{className:`session-git-panel ${A?"is-compact":""}`,children:[i.jsxs("div",{className:"session-git-panel__header",children:[i.jsxs("div",{className:"session-git-panel__heading",ref:Be,children:[i.jsxs("button",{type:"button",className:"session-git-panel__branch-button",onClick:()=>_e(ce=>!ce),disabled:!e||!!T,"aria-haspopup":"menu","aria-expanded":K,title:e?`切换分支:${e.branch}`:"分支加载中",children:[i.jsx("span",{className:"session-git-panel__branch-icon","aria-hidden":"true",children:i.jsx(MM,{})}),i.jsx("span",{className:"session-git-panel__branch",children:(e==null?void 0:e.branch)??"加载中"}),i.jsx("span",{className:`session-git-panel__branch-chevron ${K?"is-open":""}`,"aria-hidden":"true",children:i.jsx(Ng,{})})]}),K&&e?i.jsx("div",{className:"session-git-panel__branch-menu",role:"menu","aria-label":"分支列表",children:e.branches.map(ce=>{const Me=ce===e.branch,Re=(T==null?void 0:T.action)==="switch-branch"&&T.branch===ce;return i.jsxs("button",{type:"button",className:`session-git-panel__branch-option ${Me?"is-current":""}`,onClick:()=>le(ce),disabled:Me||!!T,role:"menuitemradio","aria-checked":Me,title:Me?`${ce}(当前)`:`切换到 ${ce}`,children:[i.jsx("span",{className:"session-git-panel__branch-option-name",children:ce}),Me?i.jsx("span",{className:"session-git-panel__branch-option-meta",children:"当前"}):null,Re?i.jsx("span",{className:"session-git-panel__branch-option-meta",children:"切换中"}):null]},ce)})}):null]}),i.jsxs("div",{className:"session-git-panel__toolbar",children:[i.jsx(Ll,{label:_t?"切换到提交历史":"返回修改列表",icon:i.jsx(EM,{}),onClick:qe,disabled:!!T,variant:_t?"default":"primary",className:_t?void 0:"is-active"}),i.jsx(Ll,{label:_t?a?"正在刷新":"刷新":l?"正在刷新历史":"刷新历史",icon:i.jsx(kM,{}),onClick:Ae,disabled:_t?a||!!T:l,pending:_t?a:l}),_t&&tt?i.jsxs(i.Fragment,{children:[i.jsx(Ll,{label:Xt?"正在撤回全部修改":"撤回全部修改",icon:i.jsx(Pb,{}),onClick:S,disabled:!!T,variant:"danger",pending:Xt}),i.jsx(Ll,{label:jn?"正在提交全部修改":fe==="commit"?"收起提交编辑器":"提交全部修改",icon:i.jsx(Ub,{}),onClick:Ce,disabled:!!T,variant:"primary",pending:jn})]}):null,_t&&!tt?i.jsx(Ll,{label:Bt?"正在推送当前分支":"推送当前分支",icon:i.jsx(CM,{}),onClick:w,disabled:!!T,variant:"primary",pending:Bt}):null]})]}),_t&&e?i.jsxs("div",{className:"session-git-panel__summary",children:[i.jsx("span",{className:"session-git-panel__summary-text",children:tt?`${St.length} 个文件待处理`:"当前工作区没有待提交改动"}),dt?i.jsx("span",{className:"session-git-panel__summary-meta",children:dt}):null]}):null,!_t&&t?i.jsxs("div",{className:"session-git-panel__summary",children:[i.jsx("span",{className:"session-git-panel__summary-text",children:nn?`${Ke.length} 条最近提交`:"当前分支还没有提交历史"}),cn?i.jsx("span",{className:"session-git-panel__summary-meta",children:cn}):null]}):null,_t&&fe&&tt?i.jsxs("div",{className:"session-git-panel__composer",children:[i.jsx("div",{className:"session-git-panel__composer-title",children:vt}),i.jsxs("div",{className:"session-git-panel__composer-row",children:[i.jsx("input",{value:re,onChange:ce=>we(ce.target.value),placeholder:"输入 commit message",className:"session-git-panel__input",disabled:!!T}),i.jsx(Ll,{label:fe==="switch-branch"?"提交并切换分支":"确认提交",icon:i.jsx(Ub,{}),onClick:Oe,disabled:!re.trim()||!!T,variant:"primary",pending:jn||zt}),i.jsx(Ll,{label:"取消提交",icon:i.jsx(TM,{}),onClick:me,disabled:!!T})]})]}):null,_t&&o?i.jsx("div",{className:"session-git-panel__notice is-error",children:o}):null,!_t&&u?i.jsx("div",{className:"session-git-panel__notice is-error",children:u}):null,_t&&a&&!e?i.jsx("div",{className:"session-git-panel__empty",children:"正在读取当前工作区改动…"}):null,!_t&&l&&!t?i.jsx("div",{className:"session-git-panel__empty",children:"正在读取当前分支提交历史…"}):null,_t&&!a&&e&&!tt?i.jsx("div",{className:"session-git-panel__empty",children:"当前分支没有待提交改动。你现在可以直接推送当前分支。"}):null,!_t&&!l&&t&&!nn?i.jsx("div",{className:"session-git-panel__empty",children:"当前分支还没有提交历史。"}):null,_t&&tt?i.jsx("div",{className:"session-git-panel__list",children:St.map(ce=>{const Me=!!E[ce.path],Re=(T==null?void 0:T.action)==="discard-file"&&T.path===ce.path,We=W[ce.path],Xe=!!F[ce.path],Je=Q[ce.path]??null;return i.jsxs("article",{className:`session-git-file ${Me?"is-expanded":""}`,children:[i.jsxs("div",{className:"session-git-file__head",children:[i.jsxs("button",{type:"button",className:"session-git-file__toggle",onClick:()=>{const Tt=!Me;L(Wt=>({...Wt,[ce.path]:Tt})),Tt&&Z(ce.path,ce.previous_path)},"aria-expanded":Me,children:[i.jsxs("span",{className:"session-git-file__main",children:[i.jsx("span",{className:"session-git-file__path",children:ce.path}),ce.previous_path?i.jsxs("span",{className:"session-git-file__rename",children:["来自 ",ce.previous_path]}):null]}),i.jsxs("span",{className:"session-git-file__meta",children:[i.jsx("span",{className:`session-git-file__status is-${ce.status}`,children:zb(ce.status)}),i.jsxs("span",{className:"session-git-file__counts",children:[i.jsxs("span",{className:"is-add",children:["+",ce.additions]}),i.jsxs("span",{className:"is-remove",children:["-",ce.deletions]})]}),i.jsx("span",{className:"session-git-file__chevron","aria-hidden":"true",children:i.jsx(Ng,{})})]})]}),i.jsx(Ll,{label:Re?`正在撤回 ${ce.path}`:`撤回 ${ce.path}`,icon:i.jsx(Pb,{}),onClick:()=>g(ce.path),disabled:!!T,variant:"danger",pending:Re,className:"session-git-file__action"})]}),Me?i.jsx("div",{className:"session-git-file__detail",children:Je?i.jsx("div",{className:"session-git-panel__notice is-error",children:Je}):Xe?i.jsx("div",{className:"patch-file-card__empty",children:"正在读取该文件的差异…"}):i.jsx(_.Suspense,{fallback:i.jsx("div",{className:"patch-file-card__empty",children:"正在展开差异…"}),children:i.jsx(Lb,{diffText:(We==null?void 0:We.diff)??"",filePath:ce.path,emptyMessage:OM(ce)})})}):null]},ce.path)})}):null,!_t&&nn?i.jsx("div",{className:"session-git-history",children:Ke.map((ce,Me)=>{const Re=!!pe[ce.oid],We=T_(ce),Xe=V[ce.oid]??null,Je=Pn[ce.oid],Tt=(t==null?void 0:t.head_oid)===ce.oid,Wt=(t==null?void 0:t.upstream_head_oid)===ce.oid,ls=LM(ce).filter(Nt=>!Nt||Nt===(t==null?void 0:t.branch)||Nt===(t==null?void 0:t.upstream_branch)||Nt===`HEAD -> ${t==null?void 0:t.branch}`?!1:Nt!=="HEAD");return i.jsxs("article",{className:`session-git-history__item ${Re?"is-expanded":""} ${We.length>1?"is-merge":""} ${Tt?"is-local-head":""} ${Wt?"is-remote-head":""}`.trim(),children:[i.jsxs("button",{type:"button",className:"session-git-history__toggle",onClick:()=>ne(Nt=>({...Nt,[ce.oid]:!Nt[ce.oid]})),"aria-expanded":Re,children:[Je?i.jsx(UM,{commit:ce,row:Je,isLocalHead:Tt,isRemoteHead:Wt,isFirstRow:Me===0,maxLaneCount:ke}):null,i.jsxs("span",{className:"session-git-history__content",children:[i.jsx("span",{className:"session-git-history__subject",children:ce.subject}),i.jsxs("span",{className:"session-git-history__meta",children:[i.jsx("span",{children:ce.short_oid}),i.jsx("span",{children:ce.author_name}),i.jsx("span",{children:At(ce.committed_at)})]})]}),i.jsxs("span",{className:"session-git-history__refs",children:[Tt?i.jsx("span",{className:"session-git-history__ref is-local",title:"本地当前 HEAD",children:i.jsx(RM,{})}):null,Wt?i.jsx("span",{className:"session-git-history__ref is-remote",title:t!=null&&t.upstream_branch?`云端位置:${t.upstream_branch}`:"云端位置",children:i.jsx(AM,{})}):null,We.length>1?i.jsx("span",{className:"session-git-history__ref is-merge",title:"合并提交",children:i.jsx(DM,{})}):null,ls.slice(0,2).map(Nt=>i.jsx("span",{className:"session-git-history__ref is-label",title:Nt,children:Nt},`${ce.oid}:${Nt}`))]}),i.jsx("span",{className:"session-git-history__chevron","aria-hidden":"true",children:i.jsx(Ng,{})})]}),Re?i.jsx("div",{className:"session-git-history__files",children:i.jsx("div",{className:"session-git-history__files-list",children:ce.files.map(Nt=>{const Un=Xe===Nt.path,Cn=gm(ce.oid,Nt.path),Dn=R[Cn],De=!!X[Cn],Qt=ie[Cn]??null;return i.jsxs("div",{className:`session-git-history-file-row ${Un?"is-selected":""}`,children:[i.jsxs("button",{type:"button",className:`session-git-history-file ${Un?"is-selected":""}`,onClick:()=>bt(ce,Nt),"aria-pressed":Un,children:[i.jsx("span",{className:`session-git-file__status is-${Nt.status}`,children:zb(Nt.status)}),i.jsx("span",{className:"session-git-history-file__path",children:Nt.path}),Nt.previous_path?i.jsxs("span",{className:"session-git-history-file__rename",children:["来自 ",Nt.previous_path]}):null,i.jsx("span",{className:"session-git-history-file__meta",children:Dn?i.jsxs("span",{className:"session-git-history-file__counts",children:[i.jsxs("span",{className:"is-add",children:["+",Dn.additions]}),i.jsxs("span",{className:"is-remove",children:["-",Dn.deletions]})]}):De?i.jsx("span",{className:"session-git-history-file__loading",children:"读取中…"}):i.jsx("span",{className:"session-git-history-file__hint",children:"点击查看"})})]}),Un?i.jsxs("div",{className:"session-git-history__diff is-inline",children:[i.jsxs("div",{className:"session-git-history__diff-header",children:[i.jsx("span",{className:"session-git-history__diff-path",children:Nt.path}),Nt.previous_path?i.jsxs("span",{className:"session-git-history__diff-rename",children:["来自 ",Nt.previous_path]}):null]}),Qt?i.jsx("div",{className:"session-git-panel__notice is-error",children:Qt}):De?i.jsx("div",{className:"patch-file-card__empty",children:"正在读取该文件的提交差异…"}):i.jsx(_.Suspense,{fallback:i.jsx("div",{className:"patch-file-card__empty",children:"正在展开差异…"}),children:i.jsx(Lb,{diffText:(Dn==null?void 0:Dn.diff)??"",filePath:Nt.path,emptyMessage:IM(Nt,Dn??null)})})]}):null]},`${ce.oid}:${Nt.path}`)})})}):null]},ce.oid)})}):null]})},Bb={name:"",description:null,command:"",kill_command:null,cwd:null,shell:"auto",node_version:null,port:null},Hb=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"m8 6 9 6-9 6z"})}),$b=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("rect",{x:"6.5",y:"6.5",width:"11",height:"11",rx:"1.8"})}),BM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"m12 3 1.4 4.6L18 9l-4.6 1.4L12 15l-1.4-4.6L6 9l4.6-1.4Z"}),i.jsx("path",{d:"M18 15.2 18.8 18 21.6 18.8 18.8 19.6 18 22.4 17.2 19.6 14.4 18.8 17.2 18Z"})]}),HM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"m4 20 4.2-1 9.2-9.2a1.8 1.8 0 0 0 0-2.6l-.6-.6a1.8 1.8 0 0 0-2.6 0L5 15.8 4 20Z"}),i.jsx("path",{d:"m13.5 6.5 4 4"})]}),$M=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M4.5 7h15"}),i.jsx("path",{d:"M9.5 4.5h5"}),i.jsx("path",{d:"M7 7l.6 11a1.8 1.8 0 0 0 1.8 1.7h5.2a1.8 1.8 0 0 0 1.8-1.7L17 7"}),i.jsx("path",{d:"M10 10.5v5.2"}),i.jsx("path",{d:"M14 10.5v5.2"})]}),FM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M12 5v14"}),i.jsx("path",{d:"M5 12h14"})]}),Fb={auto:"自动",powershell:"PowerShell",cmd:"CMD",bash:"Bash"},qM=({commands:e,nodeRuntime:t,error:a,pendingRunCommandId:l,pendingKillCommandId:o,pendingDeleteCommandId:u,isSaving:f,isGenerating:m,isStartingAll:y,isStoppingAll:g,generationReason:S,executionModelLabel:p,onRun:v,onRunAll:w,onRunAllKill:N,onRunKill:j,onSave:T,onDelete:A,onGenerate:U})=>{var ye;const[I,E]=_.useState("list"),[L,W]=_.useState(null),[ee,F]=_.useState(Bb),G=_.useMemo(()=>e.find(R=>R.id===L)??null,[e,L]),Q=_.useMemo(()=>{const R=[...(t==null?void 0:t.versions)??[]];return ee.node_version&&!R.includes(ee.node_version)&&R.unshift(ee.node_version),R},[ee.node_version,t==null?void 0:t.versions]),Y=_.useMemo(()=>e.filter(R=>!!R.kill_command).length,[e]),pe=()=>{F(Bb),W(null),E("edit")},ne=R=>{F({name:R.name,description:R.description,command:R.command,kill_command:R.kill_command,cwd:R.cwd,shell:R.shell,node_version:R.node_version,port:R.port}),W(R.id),E("edit")},V=()=>{T({commandId:G==null?void 0:G.id,draft:ee}),f||(E("list"),W(null))};return i.jsxs("div",{className:"session-run-panel",children:[i.jsxs("div",{className:"session-run-panel__header",children:[i.jsxs("div",{className:"session-run-panel__header-copy",children:[i.jsxs("div",{className:"session-run-panel__title-row",children:[i.jsx("h2",{className:"session-run-panel__title",children:"项目命令"}),i.jsxs("span",{className:"session-run-panel__count",children:[e.length," 条"]})]}),i.jsxs("div",{className:"session-run-panel__hint",children:["一键生成使用模型:",p]})]}),i.jsxs("div",{className:"session-run-panel__header-actions",children:[i.jsx("button",{type:"button",className:"session-run-panel__icon-button is-primary","aria-label":y?"正在一键启动项目命令":"一键启动项目命令",title:y?"正在一键启动项目命令":"一键启动项目命令",disabled:e.length===0||y||g,onClick:w,children:i.jsx(Hb,{})}),i.jsx("button",{type:"button",className:"session-run-panel__icon-button is-warning","aria-label":g?"正在一键停止项目命令":"一键停止项目命令",title:g?"正在一键停止项目命令":"一键停止项目命令",disabled:Y===0||y||g,onClick:N,children:i.jsx($b,{})}),i.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":m?"正在一键生成项目命令":"一键生成项目命令",title:m?"正在一键生成项目命令":"一键生成项目命令",disabled:m||y||g,onClick:U,children:i.jsx(BM,{})}),i.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":"新增项目命令",title:"新增项目命令",onClick:pe,children:i.jsx(FM,{})})]})]}),a?i.jsx("div",{className:"session-run-panel__notice is-error",children:a}):null,S?i.jsx("div",{className:"session-run-panel__hint",children:S}):null,I==="edit"?i.jsxs("div",{className:"session-run-panel__card",children:[i.jsx("h3",{className:"session-run-panel__section-title",children:G?"编辑命令":"新增命令"}),i.jsxs("div",{className:"session-run-panel__form-grid",children:[i.jsxs("label",{className:"session-run-panel__field",children:[i.jsx("span",{children:"名称"}),i.jsx("input",{value:ee.name,onChange:R=>F(H=>({...H,name:R.target.value})),className:"session-run-panel__input",placeholder:"例如:启动前端"})]}),i.jsxs("label",{className:"session-run-panel__field",children:[i.jsx("span",{children:"说明"}),i.jsx("input",{value:ee.description??"",onChange:R=>F(H=>({...H,description:R.target.value||null})),className:"session-run-panel__input",placeholder:"给自己留一个短说明"})]}),i.jsxs("label",{className:"session-run-panel__field is-full",children:[i.jsx("span",{children:"命令"}),i.jsx("textarea",{value:ee.command,onChange:R=>F(H=>({...H,command:R.target.value})),className:"session-run-panel__textarea",placeholder:"pnpm dev",rows:4})]}),i.jsxs("label",{className:"session-run-panel__field is-full",children:[i.jsx("span",{children:"停止命令"}),i.jsx("textarea",{value:ee.kill_command??"",onChange:R=>F(H=>({...H,kill_command:R.target.value||null})),className:"session-run-panel__textarea",placeholder:"留空表示不需要单独停止",rows:3})]}),i.jsxs("label",{className:"session-run-panel__field",children:[i.jsx("span",{children:"工作目录"}),i.jsx("input",{value:ee.cwd??"",onChange:R=>F(H=>({...H,cwd:R.target.value||null})),className:"session-run-panel__input",placeholder:"留空表示项目根目录"})]}),i.jsxs("label",{className:"session-run-panel__field",children:[i.jsx("span",{children:"端口"}),i.jsx("input",{value:ee.port??"",onChange:R=>{const H=Number.parseInt(R.target.value,10);F(X=>({...X,port:Number.isFinite(H)&&H>0?H:null}))},className:"session-run-panel__input",placeholder:"例如:5173",inputMode:"numeric"})]}),i.jsxs("label",{className:"session-run-panel__field",children:[i.jsx("span",{children:"Shell"}),i.jsx("select",{value:ee.shell,onChange:R=>F(H=>({...H,shell:R.target.value})),className:"session-run-panel__select",children:Object.entries(Fb).map(([R,H])=>i.jsx("option",{value:R,children:H},R))})]}),i.jsxs("label",{className:"session-run-panel__field",children:[i.jsx("span",{children:"Node 环境"}),i.jsxs("select",{value:ee.node_version??"",onChange:R=>F(H=>({...H,node_version:R.target.value||null})),className:"session-run-panel__select",children:[i.jsx("option",{value:"",children:"默认环境"}),Q.map(R=>i.jsxs("option",{value:R,children:["Node ",R,t!=null&&t.versions.includes(R)?"":"(未检测到)"]},R))]})]})]}),i.jsx("div",{className:"session-run-panel__hint",children:t!=null&&t.versions.length?"Node 版本只会临时注入当前命令,不会修改系统全局环境。":((ye=t==null?void 0:t.error)==null?void 0:ye.trim())||"未检测到可用的 nvm Node 版本,将按默认环境运行。"}),i.jsxs("div",{className:"session-run-panel__form-actions",children:[i.jsx("button",{type:"button",className:"session-run-panel__ghost-button",onClick:()=>E("list"),children:"取消"}),i.jsx("button",{type:"button",className:"session-run-panel__primary-button",disabled:!ee.name.trim()||!ee.command.trim()||f,onClick:V,children:f?"保存中...":G?"保存修改":"保存命令"})]})]}):null,i.jsx("div",{className:"session-run-panel__list",children:e.length>0?e.map(R=>i.jsxs("article",{className:"session-run-panel__command-card",children:[i.jsxs("div",{className:"session-run-panel__command-head",children:[i.jsxs("button",{type:"button",className:"session-run-panel__command-main",onClick:()=>ne(R),children:[i.jsxs("div",{className:"session-run-panel__command-heading",children:[i.jsx("span",{className:"session-run-panel__command-name",children:R.name}),R.description?i.jsx("span",{className:"session-run-panel__command-description",children:R.description}):null]}),i.jsx("div",{className:"session-run-panel__command-line",children:R.command})]}),i.jsxs("div",{className:"session-run-panel__command-actions",children:[R.kill_command?i.jsx("button",{type:"button",className:"session-run-panel__icon-button is-warning","aria-label":`执行 ${R.name} 的停止命令`,title:`执行 ${R.name} 的停止命令`,disabled:o===R.id,onClick:()=>j(R.id),children:i.jsx($b,{})}):null,i.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":`编辑 ${R.name}`,title:`编辑 ${R.name}`,onClick:()=>ne(R),children:i.jsx(HM,{})}),i.jsx("button",{type:"button",className:"session-run-panel__icon-button is-danger","aria-label":`删除 ${R.name}`,title:`删除 ${R.name}`,disabled:u===R.id,onClick:()=>A(R.id),children:i.jsx($M,{})}),i.jsx("button",{type:"button",className:"session-run-panel__icon-button is-primary","aria-label":`运行 ${R.name}`,title:`运行 ${R.name}`,disabled:l===R.id,onClick:()=>v(R.id),children:i.jsx(Hb,{})})]})]}),i.jsx("div",{className:"session-run-panel__command-footer",children:i.jsxs("div",{className:"session-run-panel__command-meta",children:[i.jsx("span",{className:"session-run-panel__command-pill",children:Fb[R.shell]}),R.node_version?i.jsxs("span",{className:"session-run-panel__command-pill is-node",children:["Node ",R.node_version]}):null,R.port?i.jsxs("span",{className:"session-run-panel__command-pill",children:[":",R.port]}):null,R.kill_command?i.jsx("span",{className:"session-run-panel__command-pill is-kill",children:"可停止"}):null,i.jsx("span",{className:"session-run-panel__command-pill",children:R.cwd?R.cwd:"项目根目录"})]})})]},R.id)):i.jsxs("div",{className:"session-run-panel__empty",children:[i.jsx("div",{className:"session-run-panel__empty-title",children:"还没有项目命令"}),i.jsx("div",{className:"session-run-panel__empty-copy",children:"可以手动新增,或直接点击一键生成。"})]})})]})},qb={name:"",description:null,url:""},WM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"m12 3 1.4 4.6L18 9l-4.6 1.4L12 15l-1.4-4.6L6 9l4.6-1.4Z"}),i.jsx("path",{d:"M18 15.2 18.8 18 21.6 18.8 18.8 19.6 18 22.4 17.2 19.6 14.4 18.8 17.2 18Z"})]}),KM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("circle",{cx:"12",cy:"12",r:"8.5"}),i.jsx("path",{d:"M3.8 12h16.4"}),i.jsx("path",{d:"M12 3.7c2.3 2.4 3.6 5.3 3.6 8.3S14.3 17.9 12 20.3c-2.3-2.4-3.6-5.3-3.6-8.3S9.7 6.1 12 3.7Z"})]}),QM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"m4 20 4.2-1 9.2-9.2a1.8 1.8 0 0 0 0-2.6l-.6-.6a1.8 1.8 0 0 0-2.6 0L5 15.8 4 20Z"}),i.jsx("path",{d:"m13.5 6.5 4 4"})]}),GM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M4.5 7h15"}),i.jsx("path",{d:"M9.5 4.5h5"}),i.jsx("path",{d:"M7 7l.6 11a1.8 1.8 0 0 0 1.8 1.7h5.2a1.8 1.8 0 0 0 1.8-1.7L17 7"}),i.jsx("path",{d:"M10 10.5v5.2"}),i.jsx("path",{d:"M14 10.5v5.2"})]}),YM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M12 5v14"}),i.jsx("path",{d:"M5 12h14"})]}),VM=({websites:e,error:t,pendingDeleteWebsiteId:a,isSaving:l,isGenerating:o,generationReason:u,executionModelLabel:f,onOpen:m,onSave:y,onDelete:g,onGenerate:S})=>{const[p,v]=_.useState("list"),[w,N]=_.useState(null),[j,T]=_.useState(qb),A=_.useMemo(()=>e.find(L=>L.id===w)??null,[w,e]),U=()=>{T(qb),N(null),v("edit")},I=L=>{T({name:L.name,description:L.description,url:L.url}),N(L.id),v("edit")},E=()=>{y({websiteId:A==null?void 0:A.id,draft:j}),l||(v("list"),N(null))};return i.jsxs("div",{className:"session-run-panel",children:[i.jsxs("div",{className:"session-run-panel__header",children:[i.jsxs("div",{className:"session-run-panel__header-copy",children:[i.jsxs("div",{className:"session-run-panel__title-row",children:[i.jsx("h2",{className:"session-run-panel__title",children:"项目网页"}),i.jsxs("span",{className:"session-run-panel__count",children:[e.length," 条"]})]}),i.jsxs("div",{className:"session-run-panel__hint",children:["一键生成使用模型:",f]})]}),i.jsxs("div",{className:"session-run-panel__header-actions",children:[i.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":o?"正在一键生成项目网页":"一键生成项目网页",title:o?"正在一键生成项目网页":"一键生成项目网页",disabled:o,onClick:S,children:i.jsx(WM,{})}),i.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":"新增项目网页",title:"新增项目网页",onClick:U,children:i.jsx(YM,{})})]})]}),t?i.jsx("div",{className:"session-run-panel__notice is-error",children:t}):null,u?i.jsx("div",{className:"session-run-panel__hint",children:u}):null,p==="edit"?i.jsxs("div",{className:"session-run-panel__card",children:[i.jsx("h3",{className:"session-run-panel__section-title",children:A?"编辑网页":"新增网页"}),i.jsxs("div",{className:"session-run-panel__form-grid",children:[i.jsxs("label",{className:"session-run-panel__field",children:[i.jsx("span",{children:"名称"}),i.jsx("input",{value:j.name,onChange:L=>T(W=>({...W,name:L.target.value})),className:"session-run-panel__input",placeholder:"例如:前端首页"})]}),i.jsxs("label",{className:"session-run-panel__field",children:[i.jsx("span",{children:"说明"}),i.jsx("input",{value:j.description??"",onChange:L=>T(W=>({...W,description:L.target.value||null})),className:"session-run-panel__input",placeholder:"给自己留一个短说明"})]}),i.jsxs("label",{className:"session-run-panel__field is-full",children:[i.jsx("span",{children:"地址"}),i.jsx("input",{value:j.url,onChange:L=>T(W=>({...W,url:L.target.value})),className:"session-run-panel__input",placeholder:"http://localhost:5173"})]})]}),i.jsxs("div",{className:"session-run-panel__form-actions",children:[i.jsx("button",{type:"button",className:"session-run-panel__ghost-button",onClick:()=>v("list"),children:"取消"}),i.jsx("button",{type:"button",className:"session-run-panel__primary-button",disabled:!j.name.trim()||!j.url.trim()||l,onClick:E,children:l?"保存中...":A?"保存修改":"保存网页"})]})]}):null,i.jsx("div",{className:"session-run-panel__list",children:e.length>0?e.map(L=>i.jsxs("article",{className:"session-run-panel__command-card",children:[i.jsxs("div",{className:"session-run-panel__command-head",children:[i.jsxs("button",{type:"button",className:"session-run-panel__command-main",onClick:()=>I(L),children:[i.jsxs("div",{className:"session-run-panel__command-heading",children:[i.jsx("span",{className:"session-run-panel__command-name",children:L.name}),L.description?i.jsx("span",{className:"session-run-panel__command-description",children:L.description}):null]}),i.jsx("div",{className:"session-run-panel__command-line",children:L.url})]}),i.jsxs("div",{className:"session-run-panel__command-actions",children:[i.jsx("a",{className:"session-run-panel__icon-button is-primary","aria-label":`打开 ${L.name}`,title:`打开 ${L.name}`,href:L.url,target:"_blank",rel:"noreferrer",onClick:()=>m(L),children:i.jsx(KM,{})}),i.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":`编辑 ${L.name}`,title:`编辑 ${L.name}`,onClick:()=>I(L),children:i.jsx(QM,{})}),i.jsx("button",{type:"button",className:"session-run-panel__icon-button is-danger","aria-label":`删除 ${L.name}`,title:`删除 ${L.name}`,disabled:a===L.id,onClick:()=>g(L.id),children:i.jsx(GM,{})})]})]}),i.jsx("div",{className:"session-run-panel__command-footer",children:i.jsx("div",{className:"session-run-panel__command-meta",children:i.jsx("span",{className:"session-run-panel__command-pill",children:"网页"})})})]},L.id)):i.jsxs("div",{className:"session-run-panel__empty",children:[i.jsx("div",{className:"session-run-panel__empty-title",children:"还没有项目网页"}),i.jsx("div",{className:"session-run-panel__empty-copy",children:"可以手动新增,或直接点击一键生成。"})]})})]})},ZM=/\u001b\[([0-9;]*)m/g,XM={stdout:"",stderr:"stderr",system:"system"},Wb={30:"black",31:"red",32:"green",33:"yellow",34:"blue",35:"magenta",36:"cyan",37:"white",90:"bright-black",91:"bright-red",92:"bright-green",93:"bright-yellow",94:"bright-blue",95:"bright-magenta",96:"bright-cyan",97:"bright-white"},C0={fg:null,bg:null,bold:!1,dim:!1,underline:!1},JM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M6 6 18 18"}),i.jsx("path",{d:"M18 6 6 18"})]}),eR=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M8 4H4v4"}),i.jsx("path",{d:"M16 4h4v4"}),i.jsx("path",{d:"M8 20H4v-4"}),i.jsx("path",{d:"M16 20h4v-4"}),i.jsx("path",{d:"M9 9 4 4"}),i.jsx("path",{d:"m15 9 5-5"}),i.jsx("path",{d:"m9 15-5 5"}),i.jsx("path",{d:"m15 15 5 5"})]}),tR=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M9 4H4v5"}),i.jsx("path",{d:"M15 4h5v5"}),i.jsx("path",{d:"M9 20H4v-5"}),i.jsx("path",{d:"M15 20h5v-5"}),i.jsx("path",{d:"m4 9 5-5"}),i.jsx("path",{d:"m20 9-5-5"}),i.jsx("path",{d:"m4 15 5 5"}),i.jsx("path",{d:"m20 15-5 5"})]}),nR=e=>{if(!e)return"刚刚";const t=new Date(e);return Number.isNaN(t.getTime())?"刚刚":new Intl.DateTimeFormat("zh-CN",{hour:"2-digit",minute:"2-digit"}).format(t)},Kb=(e,t)=>{const a=[e];return t.bold&&a.push("is-bold"),t.dim&&a.push("is-dim"),t.underline&&a.push("is-underline"),t.fg&&a.push(`is-fg-${t.fg}`),t.bg&&a.push(`is-bg-${t.bg}`),a.join(" ")},sR=(e,t)=>{if(t===0)return{...C0};if(t===1)return{...e,bold:!0,dim:!1};if(t===2)return{...e,dim:!0,bold:!1};if(t===4)return{...e,underline:!0};if(t===22)return{...e,bold:!1,dim:!1};if(t===24)return{...e,underline:!1};if(t===39)return{...e,fg:null};if(t===49)return{...e,bg:null};const a=Wb[t];if(a)return{...e,fg:a};const l=Wb[t-10];return l&&t>=40?{...e,bg:l}:e},aR=(e,t)=>{const a=[];let l=0,o={...C0};for(const u of e.matchAll(ZM)){const f=u.index??0;f>l&&a.push({text:e.slice(l,f),className:Kb(t,o)});const m=(u[1]??"").split(";").map(y=>Number.parseInt(y||"0",10)).filter(y=>Number.isFinite(y));m.length===0?o={...C0}:o=m.reduce(sR,o),l=f+u[0].length}return l<e.length&&a.push({text:e.slice(l),className:Kb(t,o)}),a.length===0&&a.push({text:e,className:t}),a},g5=_.memo(({chunks:e})=>{const t=_.useMemo(()=>e.map(a=>{const l=XM[a.stream],o=["session-terminal-output__segment",`is-${a.stream}`].join(" ");return{cursor:a.cursor,label:l,segments:aR(a.text,o)}}),[e]);return i.jsx(i.Fragment,{children:t.map(a=>i.jsxs("span",{className:"session-terminal-output__chunk",children:[a.label?i.jsx("span",{className:"session-terminal-output__label",children:a.label}):null,a.segments.map((l,o)=>i.jsx("span",{className:l.className,children:l.text},`${a.cursor}:${o}`))]},a.cursor))})});g5.displayName="TerminalOutput";const iR=({terminals:e,activeTerminalId:t,outputs:a,error:l,compact:o=!1,canToggleFullscreen:u=!1,isFullscreen:f=!1,onSelectTerminal:m,onCloseTerminal:y,onToggleFullscreen:g})=>{const S=_.useRef(null),p=e.find(w=>w.id===t)??e[0]??null,v=p?a[p.id]:null;return _.useEffect(()=>{const w=S.current;w&&(w.scrollTop=w.scrollHeight)},[v==null?void 0:v.chunks,p==null?void 0:p.id]),e.length===0?i.jsx("section",{className:`session-terminal-panel ${o?"is-compact":""}`,children:i.jsxs("div",{className:"session-terminal-panel__empty",children:[i.jsx("div",{className:"session-terminal-panel__empty-title",children:"还没有运行中的命令"}),i.jsx("p",{className:"session-terminal-panel__empty-copy",children:"从右上角的运行按钮启动一个项目命令后,这里会实时显示终端输出。"})]})}):i.jsxs("section",{className:`session-terminal-panel ${o?"is-compact":""}`,children:[i.jsxs("div",{className:"session-terminal-panel__tabs",children:[i.jsx("div",{className:"session-terminal-panel__tab-list",role:"tablist","aria-label":"终端列表",children:e.map(w=>{const N=w.id===(p==null?void 0:p.id);return i.jsxs("div",{className:`session-terminal-panel__tab ${N?"is-active":""}`,children:[i.jsxs("button",{type:"button",className:"session-terminal-panel__tab-button",role:"tab","aria-selected":N,onClick:()=>m(w.id),children:[i.jsx("span",{className:`session-terminal-panel__tab-dot is-${w.status}`,"aria-hidden":"true"}),i.jsx("span",{className:"session-terminal-panel__tab-title",children:w.title}),i.jsx("span",{className:"session-terminal-panel__tab-time",children:nR(w.last_output_at??w.updated_at)})]}),i.jsx("button",{type:"button",className:"session-terminal-panel__tab-close","aria-label":`关闭 ${w.title}`,onClick:j=>{j.stopPropagation(),y(w.id)},children:i.jsx(JM,{})})]},w.id)})}),u&&g?i.jsx("button",{type:"button",className:"session-terminal-panel__fullscreen-button",onClick:g,"aria-label":f?"退出终端全屏":"终端全屏",title:f?"退出终端全屏":"终端全屏",children:f?i.jsx(tR,{}):i.jsx(eR,{})}):null]}),p?i.jsxs(i.Fragment,{children:[l?i.jsx("div",{className:"session-terminal-panel__notice is-error",children:l}):null,v!=null&&v.error?i.jsx("div",{className:"session-terminal-panel__notice is-error",children:v.error}):null,v!=null&&v.truncated?i.jsx("div",{className:"session-terminal-panel__notice",children:"终端输出过长,已自动显示服务端仍保留的最近内容。"}):null,i.jsx("div",{ref:S,className:"session-terminal-panel__output-wrap",children:i.jsx("pre",{className:"session-terminal-output",children:v&&v.chunks.length>0?i.jsx(g5,{chunks:v.chunks}):v!=null&&v.isLoading?i.jsx("span",{className:"session-terminal-output__placeholder",children:"正在读取终端输出..."}):i.jsx("span",{className:"session-terminal-output__placeholder",children:"这个终端暂时还没有输出。"})})})]}):null]})},rR=_.memo(function({conversationMainRef:t,conversationScrollRef:a,isDesktopSidebar:l,sidebarShift:o,isSidebarDragging:u,title:f,titleActions:m,topbarActions:y,onOpenSidebar:g,threadContent:S,connectionStatus:p,sessionRecoveryStatus:v,isConnectionDetailOpen:w,onToggleConnectionDetail:N,showThinkingStatus:j}){const T={transform:`translateX(${o}px)`,transition:u?"none":void 0};return i.jsxs("div",{ref:t,className:`conversation-main ${l?"has-desktop-sidebar":""}`,style:T,children:[i.jsxs("div",{className:"conversation-topbar",children:[l?null:i.jsxs("button",{type:"button",className:"conversation-menu",onClick:g,"aria-label":"打开侧边栏",children:[i.jsx("span",{}),i.jsx("span",{className:"short"})]}),i.jsx("div",{className:"conversation-topbar__meta",children:i.jsxs("div",{className:"conversation-topbar__title-row",children:[i.jsx("h1",{children:f}),m]})}),y]}),i.jsx("div",{ref:a,className:"conversation-scroll",children:i.jsxs("div",{className:"conversation-thread",children:[S,p.state!=="connected"?i.jsx("section",{className:"conversation-entry is-connection-status",children:i.jsxs("div",{className:"connection-status",children:[i.jsx("button",{type:"button",className:"connection-status__pill",onClick:A=>{A.stopPropagation(),N()},children:i.jsx("span",{children:p.state==="failed"?"连接异常":`Reconnecting... ${p.attempt}/${p.maxAttempts}`})}),w&&p.error?i.jsx("div",{className:"connection-status__tooltip",role:"tooltip",children:p.error}):null]})}):null,p.state==="connected"&&v.state!=="idle"?i.jsx("section",{className:"conversation-entry is-connection-status",children:i.jsxs("div",{className:"connection-status",children:[i.jsx("div",{className:"connection-status__pill",children:i.jsx("span",{children:v.state==="recovering"?"恢复会话中...":"会话恢复失败"})}),v.state==="failed"&&v.error?i.jsx("div",{className:"connection-status__tooltip",role:"tooltip",children:v.error}):null]})}):null,j?i.jsx("section",{className:"conversation-entry is-thinking-status",children:i.jsx("div",{className:"thinking-status-pill",children:i.jsx("span",{children:"正在思考"})})}):null]})})]})}),lR="panda:last-session-id",oR=.4,cR=104,uR=1800*1e3,dR=15e3,fR=120*1e3,Qb=1100,_5="panda:desktop-sidebar-width",cf="panda:desktop-sidebar-width-version",uf="2026-03-24-narrow",hR=300,y5=232,tu=y5,mR=460,Gb=72,kg=72,Yb=120,T0=54,Vb=300,pR=640,gR=4200,Eg="local-model-panel:",_R=160,yR={id:"",agent_id:"",name:"",display_name:null,pinned:!1,path:""},vR={id:"",agent_id:"",project_id:"",archived:!1,title:"",last_event_at:"",pinned:!1,run_state:"idle",run_state_changed_at:null,subagent:null},bR={...vR,provider:"codex",mode:"managed",health:"active",branch:"",worktree:"",summary:"",latest_assistant_message:null,context_usage:null,capability:{can_stream_live:!1,can_send_input:!1,can_interrupt:!1,can_approve:!1,can_reject:!1,can_show_git:!1,can_show_terminal:!1}},xR=(e,t)=>{if(!t)return e??null;if(e!=null&&e.sessions.some(o=>o.id===t.sessionId))return e;const a=t.project?[t.project,...((e==null?void 0:e.projects)??[]).filter(o=>{var u;return o.id!==((u=t.project)==null?void 0:u.id)})]:[...(e==null?void 0:e.projects)??[]],l=[t.session,...((e==null?void 0:e.sessions)??[]).filter(o=>o.id!==t.sessionId)];return{generated_at:(e==null?void 0:e.generated_at)??t.createdAt,agent:(e==null?void 0:e.agent)??null,projects:a,project_stats:a.map(o=>{const u=l.filter(m=>m.project_id===o.id),f=e==null?void 0:e.project_stats.find(m=>m.project_id===o.id);return{project_id:o.id,visible_session_count:u.filter(m=>!m.archived).length,archived_session_count:(f==null?void 0:f.archived_session_count)??0,hidden_history_count:(f==null?void 0:f.hidden_history_count)??0}}),sessions:l,active_session_id:t.sessionId}},SR={session_id:"",generated_at:"",view:"tail",anchor_entry_id:null,has_earlier_entries:!1,entries:[]},jR=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("circle",{cx:"6",cy:"12",r:"1",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"12",cy:"12",r:"1",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"18",cy:"12",r:"1",fill:"currentColor",stroke:"none"})]}),wR=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("rect",{x:"9",y:"9",width:"10",height:"10",rx:"2"}),i.jsx("path",{d:"M7 15H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h7a2 2 0 0 1 2 2v1"})]}),NR=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"m7.5 12.5 3 3 6-7"})}),kR=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M6 6l12 12"}),i.jsx("path",{d:"M18 6 6 18"})]}),ER=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"m9 18-6-6 6-6"}),i.jsx("path",{d:"m15 6 6 6-6 6"})]}),CR=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("circle",{cx:"6",cy:"6",r:"2.2"}),i.jsx("circle",{cx:"18",cy:"6",r:"2.2"}),i.jsx("circle",{cx:"12",cy:"18",r:"2.2"}),i.jsx("path",{d:"M8 7.6 10.5 16"}),i.jsx("path",{d:"M16 7.6 13.5 16"}),i.jsx("path",{d:"M8.2 6h7.6"})]}),TR=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2.5"}),i.jsx("path",{d:"m7.5 9 2.8 3-2.8 3"}),i.jsx("path",{d:"M12.8 15H16.5"})]}),MR=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.1",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"M7 5.5 18 12 7 18.5Z"})}),RR=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("circle",{cx:"12",cy:"12",r:"8.4"}),i.jsx("path",{d:"M3.8 12h16.4"}),i.jsx("path",{d:"M12 3.7c2.3 2.3 3.6 5.2 3.6 8.3s-1.3 6-3.6 8.3c-2.3-2.3-3.6-5.2-3.6-8.3s1.3-6 3.6-8.3Z"})]}),AR=()=>i.jsx(KC,{"aria-hidden":"true",strokeWidth:1.9}),Zb=(e,t)=>{const a=new Map;for(const l of e)a.set(l.cursor,l);for(const l of t)a.set(l.cursor,l);return[...a.values()].sort((l,o)=>l.cursor-o.cursor)},DR=800,M_=(e,t,a)=>{const l=e.get(t);if(l!==void 0)return e.delete(t),e.set(t,l),l;const o=a();if(e.set(t,o),e.size>DR){const u=e.keys().next().value;u&&e.delete(u)}return o},OR=new Map,IR=new Map,LR=new Map,M0=()=>ao(()=>import("./session-diff-preview-Ch1u5o_s.js"),[]),PR=_.lazy(async()=>({default:(await M0()).SessionDiffPreview})),R0=(e,t,a)=>i.jsx(_.Suspense,{fallback:i.jsx("div",{className:"patch-file-card__empty",children:"正在载入差异详情…"}),children:i.jsx(PR,{diffText:e,filePath:t,emptyMessage:a})}),UR=e=>i.jsx("span",{className:"conversation-inline-link",children:i.jsx("span",{className:"conversation-inline-link__button",title:e,children:v5(e)})}),zR=/<proposed_plan>([\s\S]*?)<\/proposed_plan>/g,BR=e=>M_(OR,e,()=>r5(e)),Af=e=>e.replace(/\\/g,"/"),HR=e=>{var a;const t=/^\/([A-Za-z][A-Za-z0-9._-]*)/.exec(e.trim());return((a=t==null?void 0:t[1])==null?void 0:a.toLowerCase())??""},$R=e=>e.kind==="system"&&e.title==="context_compacted",Xb=e=>e>=1e3?`${Math.round(e/1e3)}k`:String(Math.round(e)),FR=e=>M_(IR,e,()=>{const t=e.replace(/\r\n/g,`
137
+ `).split(`
138
+ `),a=[];let l=[],o=null;const u=()=>{l.length!==0&&(a.push({kind:"paragraph",lines:[...l]}),l=[])},f=()=>{if(!o||o.items.length===0){o=null;return}a.push({kind:"list",ordered:o.ordered,items:[...o.items]}),o=null};for(const m of t){const y=/^\s{0,3}(#{1,6})\s+(.+?)\s*$/.exec(m),g=/^\s*([-*])\s+(.+)$/.exec(m),S=/^\s*(\d+)\.\s+(.+)$/.exec(m);if(y){u(),f(),a.push({kind:"heading",level:y[1].length,text:y[2].replace(/\s+#+\s*$/,"").trim()});continue}if(g||S){u();const p=!!S,v=((S==null?void 0:S[2])??(g==null?void 0:g[2])??"").trim();(!o||o.ordered!==p)&&(f(),o={ordered:p,items:[]}),o.items.push(v);continue}if(!m.trim()){u(),f();continue}f(),l.push(m)}return u(),f(),a}),qR=e=>M_(LR,e,()=>{const t=[];let a=0;e.replace(zR,(o,u,f)=>{const m=e.slice(a,f);return m.trim()&&t.push({kind:"markdown",content:m.trim()}),typeof u=="string"&&u.trim()?t.push({kind:"proposed-plan",content:u.trim()}):o.trim()&&t.push({kind:"markdown",content:o.trim()}),a=f+o.length,o});const l=e.slice(a);return l.trim()&&t.push({kind:"markdown",content:l.trim()}),t.length===0&&e.trim()&&t.push({kind:"markdown",content:e.trim()}),t}),WR=e=>{const t=e.files.filter(a=>!!a.item_id);return t.length>0?t:e.files.filter(a=>!a.item_id)},Jb=(e,t,a)=>{const l=new Map(((a==null?void 0:a.files)??[]).map(f=>[f.path,f])),o=e.files.filter(f=>!f.item_id);if(o.length>0)return o.map(f=>{var m;return{changeSetId:e.id,path:f.path,pathLabel:Qr(f.path,t),additions:f.additions,deletions:f.deletions,itemId:f.item_id,diffAvailable:f.diff_available,diffText:(m=l.get(f.path))==null?void 0:m.diffText,emptyMessage:"此变更没有可展示的补丁内容"}});const u=new Map;for(const f of e.files)u.set(f.path,f);return[...u.values()].map(f=>{var m;return{changeSetId:e.id,path:f.path,pathLabel:Qr(f.path,t),additions:f.additions,deletions:f.deletions,itemId:f.item_id,diffAvailable:f.diff_available,diffText:(m=l.get(f.path))==null?void 0:m.diffText,emptyMessage:"此变更没有可展示的补丁内容"}})},Dm=(e,t,a)=>`${e}:${a??"summary"}:${t}`,Cg=e=>`turn-summary:${e}`,e2=(e,t)=>`${e}:${t}`,KR=e=>{var t,a;for(let l=e.length-1;l>=0;l-=1)if(((t=e[l])==null?void 0:t.kind)==="user")return((a=e[l])==null?void 0:a.id)??null;return null},t2=(e,t,a)=>({session_id:e,generated_at:new Date().toISOString(),view:"tail",anchor_entry_id:KR(t),has_earlier_entries:a,entries:t}),R_=e=>Array.isArray(e),_m=e=>R_(e)?e:Array.isArray(e==null?void 0:e.entries)?e.entries:[],ym=e=>R_(e)?!1:(e==null?void 0:e.has_earlier_entries)??!1,Tg=e=>R_(e)?"tail":(e==null?void 0:e.view)??"tail",QR=(e,t)=>{const a=new Map((e??[]).map(l=>[l.id,l]));for(const l of t)a.set(l.id,l);return[...a.values()].sort((l,o)=>+new Date(l.started_at)-+new Date(o.started_at))},GR=e=>`${e} background agent${e===1?"":"s"}`,YR=e=>e.startsWith("Reconnecting...")?"retrying":"error",VR=e=>e.startsWith("Reconnecting...")?"Codex 重连中":"Codex 运行异常",v5=e=>{const t=Af(e).replace(/\/+$/,""),a=t.split("/");return a[a.length-1]||t},n2=e=>`${e.kind}\0${e.title}\0${e.body}\0${e.accent}`,ZR=(e,t)=>{if(!t||t.length===0||e.length===0)return e;let a=0;for(;a<e.length&&a<t.length&&n2(e[a])===n2(t[a]);)a+=1;return a<=0||a>=e.length?e:e.slice(a)},XR=e=>{const t=e.trim();if(!t.startsWith("<subagent_notification>"))return null;const a=t.indexOf("{");if(a<0)return null;const l=t.lastIndexOf("}");if(l<=a)return null;try{const o=JSON.parse(t.slice(a,l+1)),u=p=>typeof p=="string"?p.trim():"";if(typeof o.status=="string"){const p=o.status.trim();if(p==="shutdown")return{agentId:typeof o.agent_id=="string"?o.agent_id:null,body:"子代理已关闭",state:"shutdown"};if(p==="completed")return{agentId:typeof o.agent_id=="string"?o.agent_id:null,body:"子代理已完成",state:"completed"};if(p==="errored")return{agentId:typeof o.agent_id=="string"?o.agent_id:null,body:"子代理异常结束",state:"errored"};if(p==="working")return{agentId:typeof o.agent_id=="string"?o.agent_id:null,body:"子代理处理中",state:"working"}}const f=o.status&&typeof o.status=="object"?o.status:null,m=u(f==null?void 0:f.completed),y=u(f==null?void 0:f.errored),g=u(f==null?void 0:f.working),S=u(f==null?void 0:f.shutdown);if(m)return{agentId:typeof o.agent_id=="string"?o.agent_id:null,body:m,state:"completed"};if(y)return{agentId:typeof o.agent_id=="string"?o.agent_id:null,body:y,state:"errored"};if(g)return{agentId:typeof o.agent_id=="string"?o.agent_id:null,body:g,state:"working"};if(S)return{agentId:typeof o.agent_id=="string"?o.agent_id:null,body:S||"子代理已关闭",state:"shutdown"}}catch{return null}return null},Mg=["#2f72d8","#d06a3b","#2d9b7f","#8c62d9","#bf5b7f","#b78b2d"],b5=e=>{const t=(e??"").trim();if(!t)return Mg[0];let a=0;for(let l=0;l<t.length;l+=1)a=a*31+t.charCodeAt(l)>>>0;return Mg[a%Mg.length]},JR=e=>{var t;return b5(((t=e.subagent)==null?void 0:t.nickname)??e.title??e.id)},x5=e=>{let t=-1,a=-1;return e.forEach((l,o)=>{if(!(l.kind!=="system"||l.title!=="status")){if(l.body==="开始处理请求"){t=o;return}l.body==="处理完成"&&(a=o)}}),t>a?t:-1},eA=e=>{var a;const t=x5(e);return t<0?null:((a=e[t])==null?void 0:a.timestamp)??null},tA=e=>{const t=x5(e);if(t<0)return new Set;const a=[],l=new Set;for(const o of e.slice(t)){if(o.kind!=="tool")continue;if(o.title!=="tool-output"){if(a.push({name:o.title}),o.title==="close_agent"){const f=o.session_ids[0]??null;f&&l.delete(f)}continue}const u=a.shift()??null;if((u==null?void 0:u.name)==="spawn_agent"){const f=o.session_ids[0]??null;f&&l.add(f)}}return l},nA=e=>e.run_state==="running"?"is working":e.run_state==="completed"?"completed":"is awaiting instruction",S5=1e4,tf=1200,j5=e=>new Set(((e==null?void 0:e.files)??[]).map(t=>Af(t.path))),w5=(e,t)=>{if(t.size===0)return 0;let a=0;for(const l of e.files)t.has(Af(l.path))&&(a+=1);return a},sA=(e,t,a)=>{const l=+new Date(t);if(!Number.isFinite(l))return!1;const o=j5(a);return e.some(u=>{if(u.source!=="app-server")return!1;const f=+new Date(u.updated_at);return!Number.isFinite(f)||Math.abs(f-l)>S5?!1:o.size===0?!0:w5(u,o)>0})},aA=(e,t)=>{if(!e)return"已处理";const a=Math.max(0,new Date(t).getTime()-new Date(e).getTime()),l=Math.max(0,Math.round(a/1e3)),o=Math.floor(l/60),u=l%60;return o<=0?`已处理 ${u}s`:`已处理 ${o}m ${u}s`},Qr=(e,t)=>{const a=Af(e),l=t?Af(t).replace(/\/+$/,""):"";return l&&a.toLowerCase().startsWith(`${l.toLowerCase()}/`)?a.slice(l.length+1):a},N5=(e,t)=>!e||e.files.length===0?null:{files:e.files.map(a=>({path:a.path,displayPath:Qr(a.path,t),operation:"update",additions:a.additions,deletions:a.deletions,diffText:""})),additions:e.additions,deletions:e.deletions},k5=(e,t)=>{const a=e.split(/\r?\n/),l=[];let o=null,u=[];const f=()=>{o&&(l.push({...o,diffText:u.join(`
139
+ `).trim()}),o=null,u=[])};for(const m of a){const y=m.replace(/\r$/,""),g=y.trimStart();if(y.startsWith("*** Add File: ")){f();const S=y.slice(14).trim();o={path:S,displayPath:Qr(S,t),operation:"add",additions:0,deletions:0,diffText:""};continue}if(y.startsWith("*** Update File: ")){f();const S=y.slice(17).trim();o={path:S,displayPath:Qr(S,t),operation:"update",additions:0,deletions:0,diffText:""};continue}if(y.startsWith("*** Delete File: ")){f();const S=y.slice(17).trim();o={path:S,displayPath:Qr(S,t),operation:"delete",additions:0,deletions:0,diffText:""};continue}if(o){if(y.startsWith("*** End Patch")){f();continue}if(y.startsWith("*** ")){f();continue}y.startsWith("+")?o.additions+=1:y.startsWith("-")&&(o.deletions+=1),(g.startsWith("@@")||y.startsWith("+")||y.startsWith("-")||y.startsWith(" "))&&u.push(g.startsWith("@@")?g:y)}}return f(),l.length===0?null:{files:l,additions:l.reduce((m,y)=>m+y.additions,0),deletions:l.reduce((m,y)=>m+y.deletions,0)}},iA=e=>{if(e.length===0)return null;const t=new Map;for(const l of e)for(const o of l.files){const u=t.get(o.path);if(!u){t.set(o.path,{...o});continue}u.additions+=o.additions,u.deletions+=o.deletions,u.diffText=[u.diffText,o.diffText].filter(Boolean).join(`
140
+ `),u.operation=o.operation}const a=[...t.values()];return{files:a,additions:a.reduce((l,o)=>l+o.additions,0),deletions:a.reduce((l,o)=>l+o.deletions,0)}},vm=(e,t=cR)=>{const a=e.replace(/\s+/g," ").trim();return a.length<=t?a:`${a.slice(0,t-1).trimEnd()}…`},A_=e=>{try{return JSON.parse(e)}catch{return null}},rA=e=>{const t=A_(e.body);if(t){const a=["command","cmd","path","pattern","q","input"];for(const l of a){const o=t[l];if(typeof o=="string"&&o.trim())return vm(o)}}return e.title&&e.title!=="tool-output"?e.body.trim().startsWith("{")||e.body.trim().startsWith("[")?vm(e.title.replace(/-/g," ")):vm(e.body||e.title):vm(e.body||"工具执行")},lA=e=>{if(e.title==="apply_patch")return e.body.trim();const t=A_(e.body);return t&&typeof t.command=="string"&&t.command.trim()?t.command.trim():e.body.trim()||e.title},oA=e=>e.map(t=>{const a=A_(t.body);return a&&typeof a.output=="string"?a.output.trim():t.body.trim()}).filter(Boolean).join(`
141
+
142
+ `),cA=e=>e.kind==="entry"&&e.entry.kind==="user",E5=e=>e.kind==="entry"&&e.entry.kind==="assistant",uA=e=>cA(e)||E5(e),dA=e=>e.kind==="tool-group"?!0:e.entry.kind==="assistant"||e.entry.kind==="thinking"||e.entry.kind==="tool",fA=e=>{if(e.length<=1)return e;const t=[];for(const a of e){const l=t[t.length-1];if(l&&l.kind==="entry"&&a.kind==="entry"&&l.entry.kind==="assistant"&&a.entry.kind==="assistant"&&l.entry.body.trim()===a.entry.body.trim()){t[t.length-1]=a;continue}t.push(a)}return t},hA=e=>`展开 ${e.length} 条过程消息`,mA=e=>`收起 ${e.length} 条过程消息`,pA=(e,t)=>{const a=fA(e.items),{completion:l}=e,o=a.findLastIndex(m=>E5(m));if(o===-1||!l||!t)return{id:e.id,startedAt:e.startedAt,visibleStartItems:o===-1?a:a.slice(0,o),hiddenItems:[],visibleEndItems:o===-1?[]:a.slice(o),completion:l};const u=[],f=[];return a.forEach((m,y)=>{if(y!==o){if(uA(m)){u.push(m);return}f.push(m)}}),{id:e.id,startedAt:e.startedAt,visibleStartItems:u,hiddenItems:f,visibleEndItems:[a[o]],completion:l}},gA=(e,t)=>{const a=[];let l=[],o=null;const u=()=>{for(const m of l)a.push({kind:"item",id:m.kind==="entry"?m.entry.id:m.group.id,item:m});l=[]},f=()=>{o&&((o.items.length>0||o.completion)&&a.push({kind:"turn",turn:pA(o,t)}),o=null)};for(const m of e){if(m.kind==="turn-start"){f(),o={id:m.id,startedAt:m.startedAt,items:l,completion:null},l=[];continue}if(m.kind==="turn-complete"){if(o){o.completion=m;continue}o={id:m.id,startedAt:null,items:l,completion:m},l=[];continue}if(o){if(o.completion&&!dA(m)){f(),l.push(m);continue}o.items.push(m);continue}l.push(m)}return f(),u(),a},_A=e=>e.run_state!=="running"&&Date.now()-new Date(e.last_event_at).getTime()>=uR,yA=(e,t)=>{var g,S;const a=t==null?void 0:t.projectPath,l=(t==null?void 0:t.compactCompletedTurns)??!1,o=[];let u=null,f=!1,m=null,y=[];for(let p=0;p<e.length;p+=1){const v=e[p];if(v.kind==="system"&&v.body==="开始处理请求"){o.push({kind:"turn-start",id:v.id,startedAt:v.timestamp}),m=v.timestamp,y=[];continue}if(v.kind==="system"&&v.body==="处理完成"){o.push({kind:"turn-complete",id:v.id,durationLabel:aA(m,v.timestamp),patchSummary:iA(y),completedAt:v.timestamp}),m=null,y=[];continue}if(v.kind==="tool"&&v.title!=="tool-output"){const w=[];let N=p+1;for(;N<e.length&&((g=e[N])==null?void 0:g.kind)==="tool"&&((S=e[N])==null?void 0:S.title)==="tool-output";)w.push(e[N]),N+=1;u=v.id;const j=v.title==="apply_patch"?N5(v.patch_summary,a)??k5(v.body,a):null;j&&y.push(j),w.length===0&&(f=!0),o.push({kind:"tool-group",group:{id:v.id,commandEntry:v,outputEntries:w,patchSummary:j}}),p=N-1;continue}if(v.kind==="tool"&&v.title==="tool-output"){o.push({kind:"tool-group",group:{id:v.id,commandEntry:v,outputEntries:[],patchSummary:null}}),u=v.id;continue}o.push({kind:"entry",entry:v})}return{blocks:gA(o,l),lastToolGroupId:u,hasRunningToolGroup:f}},vA=e=>e.kind==="entry"?e.entry.timestamp:e.group.commandEntry.timestamp,bA=(e,t)=>{var f,m;const a=[...e.visibleStartItems,...e.hiddenItems,...e.visibleEndItems].map(vA).filter(y=>!!y),l=a.length>0?a[a.length-1]:null,o=e.startedAt??a[0]??((f=e.completion)==null?void 0:f.completedAt)??null,u=((m=e.completion)==null?void 0:m.completedAt)??l??o;return{startMs:o?+new Date(o):null,endMs:u?+new Date(u):null,nextStartMs:t!=null&&t.startedAt?+new Date(t.startedAt):null}},xA=(e,t)=>{const a=+new Date(e.started_at),l=e.completed_at?+new Date(e.completed_at):null,o=t.startMs??(t.endMs!==null?t.endMs-tf:null),u=t.nextStartMs??(t.endMs!==null?t.endMs+tf:Number.POSITIVE_INFINITY);return o!==null&&a<o-tf?!1:a<=u+tf?!0:l!==null&&l<=u+tf},SA=(e,t)=>{if(t===null)return Number.POSITIVE_INFINITY;const a=+new Date(e.updated_at);return Number.isFinite(a)?Math.abs(a-t):Number.POSITIVE_INFINITY},jA=(e,t)=>{const a=[...t].sort((f,m)=>+new Date(f.started_at)-+new Date(m.started_at)),l=new Set,o=e.filter(f=>f.kind==="turn"),u=new Map(o.map((f,m)=>[f.turn.id,m]));return e.map(f=>{var j,T,A;if(f.kind!=="turn")return f;const m=u.get(f.turn.id)??-1,y=m>=0?((j=o[m+1])==null?void 0:j.turn)??null:null,g=bA(f.turn,y),S=((T=f.turn.completion)==null?void 0:T.patchSummary)??null,p=j5(S),w=((A=a.filter(U=>!l.has(U.id)).map(U=>({changeSet:U,overlapCount:w5(U,p),updatedAtDistance:SA(U,g.endMs)})).filter(U=>U.overlapCount>0&&U.updatedAtDistance<=S5).sort((U,I)=>I.overlapCount!==U.overlapCount?I.overlapCount-U.overlapCount:U.changeSet.source!==I.changeSet.source?U.changeSet.source==="app-server"?-1:1:U.updatedAtDistance!==I.updatedAtDistance?U.updatedAtDistance-I.updatedAtDistance:+new Date(U.changeSet.started_at)-+new Date(I.changeSet.started_at))[0])==null?void 0:A.changeSet)??a.find(U=>l.has(U.id)?!1:xA(U,g))??null;return w&&l.add(w.id),{kind:"turn",turn:f.turn,changeSet:w}})},wA=()=>typeof window>"u"?248:Math.max(0,Math.min(248,window.innerWidth-84)),A0=e=>Math.max(y5,Math.min(mR,e)),NA=()=>{if(typeof window>"u")return tu;try{const e=window.localStorage.getItem(_5),t=window.localStorage.getItem(cf);if(!e)return window.localStorage.setItem(cf,uf),tu;const a=Number(e);if(!Number.isFinite(a))return window.localStorage.setItem(cf,uf),tu;const o=t!==uf||a===hR||a>tu?tu:a;return window.localStorage.setItem(cf,uf),A0(o)}catch{return tu}};function bm({active:e,render:t,fallback:a=null}){const[l,o]=_.useState(!e);return _.useEffect(()=>{if(!e){o(!1);return}o(!1);const u=window.requestAnimationFrame(()=>{o(!0)});return()=>{window.cancelAnimationFrame(u)}},[e]),e?l?i.jsx(i.Fragment,{children:t()}):i.jsx(i.Fragment,{children:a}):null}const kA=_.memo(function({sessionId:t,group:a,projectPath:l}){const[o,u]=_.useState({}),f=a.commandEntry.detail_available||a.outputEntries.some(j=>j.detail_available),m=bM({sessionId:t,entryId:a.commandEntry.id,scope:{sessionId:t},enabled:f}),y=m.data,g=(y==null?void 0:y.command_entry)??a.commandEntry,S=y!=null&&y.output_entries&&y.output_entries.length>0?y.output_entries:a.outputEntries,p=g.title==="apply_patch"?k5(g.body,l)??N5(g.patch_summary,l)??a.patchSummary:a.patchSummary,v=lA(g),w=oA(S),N=j=>{u(T=>({...T,[j]:!T[j]}))};return m.isPending&&f&&!y?i.jsx("div",{className:"patch-file-card__empty",children:"正在加载工具详情…"}):g.title==="apply_patch"&&p?p.files.length>1?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"tool-entry__patch-list",children:p.files.map(j=>{const T=`${a.id}:${j.path}`,A=!!o[T];return i.jsxs("div",{className:`tool-entry tool-entry--patch-file ${A?"is-expanded":""}`,children:[i.jsxs("button",{type:"button",className:"tool-entry__toggle",onClick:()=>N(T),"aria-expanded":A,children:[i.jsxs("div",{className:"tool-entry__summary",children:[i.jsx("span",{className:"tool-entry__status",children:"已编辑"}),i.jsx("span",{className:"tool-entry__command",children:UR(j.displayPath)}),i.jsxs("span",{className:"tool-entry__counts",children:[i.jsxs("span",{className:"is-add",children:["+",j.additions]}),i.jsxs("span",{className:"is-remove",children:["-",j.deletions]})]})]}),i.jsx("span",{className:"tool-entry__chevron","aria-hidden":"true",children:i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"m9 6 6 6-6 6"})})})]}),A?i.jsx("div",{className:"tool-entry__details",children:j.diffText.trim()?i.jsxs("div",{className:"patch-file-card",children:[i.jsxs("div",{className:"patch-file-card__header",children:[i.jsx("div",{className:"patch-file-card__path",children:j.displayPath}),i.jsxs("div",{className:"patch-file-card__counts",children:[i.jsxs("span",{className:"is-add",children:["+",j.additions]}),i.jsxs("span",{className:"is-remove",children:["-",j.deletions]})]})]}),i.jsx("div",{className:"patch-file-card__diff",children:R0(j.diffText,j.path,"此变更没有可展示的补丁内容")})]}):i.jsx("div",{className:"patch-file-card__empty",children:"此变更没有可展示的补丁内容"})}):null]},T)})}),m.isError?i.jsx("div",{className:"patch-file-card__empty",children:m.error instanceof Error?m.error.message:"无法加载工具详情。"}):null]}):i.jsxs("div",{className:"tool-entry__patch-list",children:[p.files.map(j=>i.jsxs("div",{className:"patch-file-card",children:[i.jsxs("div",{className:"patch-file-card__header",children:[i.jsx("div",{className:"patch-file-card__path",children:j.displayPath}),i.jsxs("div",{className:"patch-file-card__counts",children:[i.jsxs("span",{className:"is-add",children:["+",j.additions]}),i.jsxs("span",{className:"is-remove",children:["-",j.deletions]})]})]}),i.jsx("div",{className:"patch-file-card__diff",children:R0(j.diffText,j.path,"此变更没有可展示的补丁内容")})]},`${a.id}-${j.path}`)),m.isError?i.jsx("div",{className:"patch-file-card__empty",children:m.error instanceof Error?m.error.message:"无法加载工具详情。"}):null]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"tool-entry__section",children:[i.jsx("div",{className:"tool-entry__label",children:"命令"}),i.jsx("pre",{className:"tool-entry__pre",children:v})]}),w?i.jsxs("div",{className:"tool-entry__section",children:[i.jsx("div",{className:"tool-entry__label",children:"输出"}),i.jsx("pre",{className:"tool-entry__pre",children:w})]}):null,m.isError?i.jsx("div",{className:"patch-file-card__empty",children:m.error instanceof Error?m.error.message:"无法加载工具详情。"}):null]})}),EA=_.memo(function({sessionId:t,sessions:a,sessionRunState:l,isDesktopSidebar:o,projectPath:u,renderedBlocks:f,lastToolGroupId:m,sessionChangeSets:y,isSubagentTimelinePending:g,isInitialTimelinePending:S,hasTimeline:p,proposedPlanReplyDrafts:v,pendingProposedPlanReplyEntryId:w,canRespondToProposedPlan:N,onProposedPlanReplyDraftChange:j,onSubmitProposedPlanReply:T,onPreviewImage:A,changeSetDiffs:U,changeSetDiffErrors:I,loadingChangeSetDiffKeys:E,onLoadSessionChangeSets:L,onLoadChangeSetFileDiff:W,onLoadFullTimeline:ee,timelineLoadState:F}){const[G,Q]=_.useState({}),[Y,pe]=_.useState({}),[ne,V]=_.useState({}),[ye,R]=_.useState(null),[H,X]=_.useState(null),oe=_.useRef(null);_.useEffect(()=>{const ke=Z=>{const me=Z.target;me instanceof Element&&me.closest(".conversation-inline-link")||R(null)};return window.addEventListener("pointerdown",ke),()=>{window.removeEventListener("pointerdown",ke)}},[]),_.useEffect(()=>()=>{oe.current!==null&&window.clearTimeout(oe.current)},[]);const ie=ke=>{Q(Z=>({...Z,[ke]:!Z[ke]}))},k=ke=>{pe(Z=>({...Z,[ke]:!Z[ke]}))},K=ke=>{V(Z=>({...Z,[ke]:!Z[ke]}))};_.useEffect(()=>{var Z;const ke=new Map;for(const me of f){if(me.kind!=="turn")continue;const Ce=me.changeSet;if(!Ce||Ce.status!=="completed"||Ce.files.length===0)continue;const Oe=Cg(me.turn.id),le=Jb(Ce,u,((Z=me.turn.completion)==null?void 0:Z.patchSummary)??null);for(const Ae of le){if(!Ae.changeSetId||!Ae.diffAvailable)continue;const qe=e2(Oe,Ae.path);if(!ne[qe])continue;const bt=Dm(Ae.changeSetId,Ae.path,Ae.itemId);U[bt]||E[bt]||ke.set(bt,{changeSetId:Ae.changeSetId,path:Ae.path,itemId:Ae.itemId??null})}}for(const me of ke.values())W(me)},[U,ne,E,W,u,f]);const _e=async(ke,Z)=>{var Oe;const me=Z.trim();if(!me)return;const Ce=()=>{const le=document.createElement("textarea");le.value=me,le.setAttribute("readonly","true"),le.style.position="fixed",le.style.opacity="0",le.style.pointerEvents="none",document.body.appendChild(le),le.select(),document.execCommand("copy"),document.body.removeChild(le)};try{(Oe=navigator.clipboard)!=null&&Oe.writeText?await navigator.clipboard.writeText(me):Ce(),X(ke),oe.current!==null&&window.clearTimeout(oe.current),oe.current=window.setTimeout(()=>{X(le=>le===ke?null:le),oe.current=null},1400)}catch{}};function fe(ke,Z,me){return R0(ke,Z,me)}function Te(ke,Z,me){const Ce=ye===me,Oe=()=>{R(le=>le===me?null:me)};return i.jsxs("span",{className:`conversation-inline-link ${Ce?"is-active":""}`,children:[i.jsx("span",{role:"button",tabIndex:0,className:"conversation-inline-link__button",onClick:le=>{le.stopPropagation(),Oe()},onKeyDown:le=>{le.key!=="Enter"&&le.key!==" "||(le.preventDefault(),le.stopPropagation(),Oe())},children:ke}),Ce?i.jsx("span",{className:"conversation-inline-link__tooltip",role:"tooltip",children:Z}):null]},me)}function re(ke,Z,me=Qr(ke,u)){return Te(v5(me),me,Z)}function we(ke,Z){return BR(ke).map((Ce,Oe)=>{const le=`${Z}-${Oe}`;return Ce.kind==="text"?i.jsx("span",{children:Ce.value},le):Ce.kind==="code"?i.jsx("code",{className:"conversation-inline-code",children:Ce.value},le):Ce.kind==="strong"?i.jsx("strong",{children:we(Ce.value,`${le}-strong`)},le):Ce.kind==="emphasis"?i.jsx("em",{children:we(Ce.value,`${le}-emphasis`)},le):Ce.kind==="skill"?i.jsx("span",{className:"conversation-skill-token",children:Ce.raw},le):Ce.kind==="command"?i.jsx("span",{className:"conversation-command-token",children:Ce.raw},le):Te(Ce.label,Ce.path,le)})}function ve(ke,Z){return FR(ke).map((Ce,Oe)=>{const le=`${Z}-block-${Oe}`;if(Ce.kind==="heading"){const Ae=Math.min(Ce.level,3),qe=Ae===1?"h1":Ae===2?"h2":"h3";return i.jsx(qe,{className:`conversation-markdown-heading is-level-${Ae}`,children:we(Ce.text,`${le}-heading`)},le)}if(Ce.kind==="list"){const Ae=Ce.ordered?"ol":"ul";return i.jsx(Ae,{className:"conversation-markdown-list",children:Ce.items.map((qe,bt)=>i.jsx("li",{children:we(qe,`${le}-item-${bt}`)},`${le}-item-${bt}`))},le)}return i.jsx("p",{className:"conversation-markdown-paragraph",children:Ce.lines.map((Ae,qe)=>i.jsxs("span",{children:[qe>0?i.jsx("br",{}):null,we(Ae,`${le}-line-${qe}`)]},`${le}-line-${qe}`))},le)})}function ze(ke,Z,me){const Ce=`${ke.id}:proposed-plan:${me}`,Oe=v[Ce]??"",le=w===Ce,Ae=!N||le;return i.jsxs("div",{className:"proposed-plan-card",children:[i.jsx("div",{className:"proposed-plan-card__content",children:ve(Z,`${Ce}:content`)}),i.jsxs("div",{className:"proposed-plan-card__footer",children:[i.jsx("div",{className:"proposed-plan-card__title",children:"实施此计划?"}),i.jsxs("div",{className:"proposed-plan-card__actions",children:[i.jsx("button",{type:"button",className:"proposed-plan-card__confirm",disabled:Ae,onClick:()=>{T(Ce,"是,实施此计划")},children:le?"回复中…":"是,实施此计划"}),i.jsxs("div",{className:"proposed-plan-card__custom",children:[i.jsx("input",{type:"text",className:"proposed-plan-card__input",value:Oe,disabled:Ae,placeholder:"否,请告知如何调整",onChange:qe=>{j(Ce,qe.target.value)},onKeyDown:qe=>{qe.key!=="Enter"||!Oe.trim()||Ae||(qe.preventDefault(),T(Ce,Oe))}}),i.jsx("button",{type:"button",className:"proposed-plan-card__submit",disabled:Ae||!Oe.trim(),onClick:()=>{T(Ce,Oe)},children:le?"回复中…":"回复"})]})]})]})]},Ce)}function Be(ke){const Z=qR(ke.body);return Z.some(Ce=>Ce.kind==="proposed-plan")?Z.map((Ce,Oe)=>{const le=`${ke.id}-content-${Oe}`;return Ce.kind==="markdown"?i.jsx("div",{className:"conversation-entry__rich-block",children:ve(Ce.content,le)},le):ze(ke,Ce.content,Oe)}):ve(ke.body,ke.id)}function St(ke){const Z=N6([],ke.attachments);if(Z.length===0)return null;const me=Z.filter(Sb),Ce=Z.filter(Oe=>!Sb(Oe));return i.jsxs("div",{className:"conversation-entry__attachments",children:[me.length>0?i.jsx("div",{className:"conversation-entry__attachment-grid",children:me.map(Oe=>{const le=k0(Oe.size_bytes),Ae=Oe.name??"图片",qe=`图片${le?` · ${le}`:""}`,bt=i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"conversation-entry__attachment-media",children:Oe.content_url?i.jsxs(i.Fragment,{children:[i.jsx("img",{src:Oe.content_url,alt:Ae,loading:"lazy"}),i.jsx("span",{className:"conversation-entry__attachment-badge",children:"预览"})]}):i.jsx("div",{className:"conversation-entry__attachment-fallback",children:"无法预览"})}),i.jsxs("div",{className:"conversation-entry__attachment-caption",children:[i.jsx("span",{className:"conversation-entry__attachment-title",children:Ae}),i.jsx("span",{className:"conversation-entry__attachment-meta",children:qe})]})]});return Oe.content_url?i.jsx("button",{type:"button",className:"conversation-entry__attachment-card is-image",onClick:()=>A({src:Oe.content_url,label:Ae,meta:qe}),"aria-label":`预览 ${Ae}`,children:bt},`${ke.id}:${Oe.id}`):i.jsx("div",{className:"conversation-entry__attachment-card is-image",children:bt},`${ke.id}:${Oe.id}`)})}):null,Ce.length>0?i.jsx("div",{className:"conversation-entry__file-list",children:Ce.map(Oe=>{const le=k0(Oe.size_bytes),Ae=i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"conversation-entry__file-icon","aria-hidden":"true",children:i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8Z"}),i.jsx("path",{d:"M14 3v5h5"}),i.jsx("path",{d:"M9 13h6"}),i.jsx("path",{d:"M9 17h4"})]})}),i.jsxs("span",{className:"conversation-entry__file-copy",children:[i.jsx("span",{className:"conversation-entry__file-title",children:Oe.name??"附件"}),i.jsxs("span",{className:"conversation-entry__file-meta",children:["文件",le?` · ${le}`:""]})]})]});return Oe.content_url?i.jsx("a",{className:"conversation-entry__file-card",href:Oe.content_url,download:Oe.name??void 0,target:"_blank",rel:"noreferrer",children:Ae},`${ke.id}:${Oe.id}`):i.jsx("div",{className:"conversation-entry__file-card",children:Ae},`${ke.id}:${Oe.id}`)})}):null]})}function Ke(ke,Z){return i.jsx("div",{className:"turn-patch-summary__files",children:Z.map(me=>{const Ce=e2(ke,me.path),Oe=!!ne[Ce],le=me.changeSetId?Dm(me.changeSetId,me.path,me.itemId):null,Ae=le?U[le]:void 0,qe=le?E[le]===!0:!1,bt=le?I[le]??null:null,At=(Ae==null?void 0:Ae.file.diff)??me.diffText??"",ce=(Ae==null?void 0:Ae.empty_message)??me.emptyMessage;return i.jsxs("div",{className:`turn-patch-file ${Oe?"is-expanded":""}`,children:[i.jsxs("button",{type:"button",className:"turn-patch-file__toggle",onClick:()=>{K(Ce),me.changeSetId||L(),le&&me.changeSetId&&me.diffAvailable&&!Ae&&!qe&&W({changeSetId:me.changeSetId,path:me.path,itemId:me.itemId??null})},"aria-expanded":Oe,children:[i.jsx("div",{className:"turn-patch-file__path",children:me.pathLabel}),i.jsxs("div",{className:"turn-patch-file__meta",children:[i.jsxs("span",{className:"turn-patch-summary__counts",children:[i.jsxs("span",{className:"is-add",children:["+",me.additions]}),i.jsxs("span",{className:"is-remove",children:["-",me.deletions]})]}),i.jsx("span",{className:"turn-patch-file__chevron","aria-hidden":"true",children:i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"m9 6 6 6-6 6"})})})]})]}),Oe?i.jsx("div",{className:"turn-patch-file__detail",children:qe?i.jsx("div",{className:"patch-file-card__empty",children:"正在载入差异详情…"}):bt?i.jsx("div",{className:"patch-file-card__empty",children:bt}):me.diffAvailable===!1&&!At.trim()?i.jsx("div",{className:"patch-file-card__empty",children:ce}):i.jsx(bm,{active:Oe,fallback:i.jsx("div",{className:"patch-file-card__empty",children:"正在展开差异…"}),render:()=>fe(At,me.path,ce)})}):null]},Ce)})})}function tt(ke){return WR(ke).map(Z=>{const me=`live:${ke.id}:${Z.item_id??"summary"}:${Z.path}`,Ce=!!ne[me],Oe=ke.status==="running",le=Dm(ke.id,Z.path,Z.item_id),Ae=U[le],qe=E[le]===!0,bt=I[le]??null,At=(Ae==null?void 0:Ae.file.diff)??"",ce=(Ae==null?void 0:Ae.empty_message)??"此变更还没有可展示的补丁内容";return i.jsx("section",{className:"conversation-entry is-tool-group",children:i.jsxs("div",{className:`tool-entry ${Oe?"is-running":"is-complete"} ${Ce?"is-expanded":""} is-patch`,children:[i.jsxs("button",{type:"button",className:"tool-entry__toggle",onClick:()=>{K(me),Z.diff_available&&!Ae&&!qe&&W({changeSetId:ke.id,path:Z.path,itemId:Z.item_id??null})},"aria-expanded":Ce,children:[i.jsxs("div",{className:"tool-entry__summary",children:[i.jsx("span",{className:"tool-entry__status",children:"已编辑"}),i.jsx("span",{className:"tool-entry__command",children:re(Z.path,`${me}:live-link`,Qr(Z.path,u))}),i.jsxs("span",{className:"tool-entry__counts",children:[i.jsxs("span",{className:"is-add",children:["+",Z.additions]}),i.jsxs("span",{className:"is-remove",children:["-",Z.deletions]})]})]}),i.jsx("span",{className:"tool-entry__chevron","aria-hidden":"true",children:i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"m9 6 6 6-6 6"})})})]}),Ce?i.jsx("div",{className:"tool-entry__details",children:qe?i.jsx("div",{className:"patch-file-card__empty",children:"正在载入详情…"}):bt?i.jsx("div",{className:"patch-file-card__empty",children:bt}):!Z.diff_available&&!At.trim()?i.jsx("div",{className:"patch-file-card__empty",children:ce}):i.jsx(bm,{active:Ce,fallback:i.jsx("div",{className:"patch-file-card__empty",children:"正在展开详情…"}),render:()=>i.jsx("div",{className:"tool-entry__patch-list",children:i.jsxs("div",{className:"patch-file-card",children:[i.jsxs("div",{className:"patch-file-card__header",children:[i.jsx("div",{className:"patch-file-card__path",children:Qr(Z.path,u)}),i.jsxs("div",{className:"patch-file-card__counts",children:[i.jsxs("span",{className:"is-add",children:["+",Z.additions]}),i.jsxs("span",{className:"is-remove",children:["-",Z.deletions]})]})]}),i.jsx("div",{className:"patch-file-card__diff",children:fe(At,Z.path,ce)})]})})})}):null]})},me)})}function nn(ke,Z,me){const Ce=Jb(ke,u,me),Oe=Ce.reduce((Ae,qe)=>Ae+qe.additions,0),le=Ce.reduce((Ae,qe)=>Ae+qe.deletions,0);return i.jsxs("div",{className:"turn-patch-summary",children:[i.jsx("div",{className:"turn-patch-summary__header",children:i.jsxs("div",{className:"turn-patch-summary__title",children:[i.jsxs("span",{children:[Ce.length," 个文件已更改"]}),i.jsxs("span",{className:"turn-patch-summary__counts",children:[i.jsxs("span",{className:"is-add",children:["+",Oe]}),i.jsxs("span",{className:"is-remove",children:["-",le]})]})]})}),Ke(Z,Ce)]})}function Xt(ke,Z){return i.jsxs("div",{className:"turn-patch-summary",children:[i.jsx("div",{className:"turn-patch-summary__header",children:i.jsxs("div",{className:"turn-patch-summary__title",children:[i.jsxs("span",{children:[Z.files.length," 个文件已更改"]}),i.jsxs("span",{className:"turn-patch-summary__counts",children:[i.jsxs("span",{className:"is-add",children:["+",Z.additions]}),i.jsxs("span",{className:"is-remove",children:["-",Z.deletions]})]})]})}),Ke(ke,Z.files.map(me=>({path:me.path,pathLabel:me.displayPath,additions:me.additions,deletions:me.deletions,diffText:me.diffText,emptyMessage:"此变更没有可展示的补丁内容"})))]})}function jn(ke,Z){var At,ce;const me=Z.agentId?a.find(Me=>Me.id===Z.agentId)??null:null,Ce=b5(((At=me==null?void 0:me.subagent)==null?void 0:At.nickname)??(me==null?void 0:me.title)??Z.agentId),Oe=`subagent:${ke.id}`,le=!!G[Oe],Ae=Z.state==="working",qe=Z.state==="completed"?"子代理返回":Z.state==="shutdown"?"子代理已关闭":Z.state==="errored"?"子代理异常":"子代理处理中",bt=((ce=me==null?void 0:me.subagent)==null?void 0:ce.nickname)??(me==null?void 0:me.title)??"子代理";return i.jsx("section",{className:"conversation-entry is-tool-group",children:i.jsxs("div",{className:`tool-entry is-subagent ${Ae?"is-running":"is-complete"} ${le?"is-expanded":""}`,style:{"--subagent-accent":Ce},children:[i.jsxs("button",{type:"button",className:"tool-entry__toggle",onClick:()=>ie(Oe),"aria-expanded":le,children:[i.jsxs("div",{className:"tool-entry__summary",children:[i.jsx("span",{className:"tool-entry__status",children:qe}),i.jsx("span",{className:"tool-entry__command tool-entry__command--agent",children:bt})]}),i.jsx("span",{className:"tool-entry__chevron","aria-hidden":"true",children:i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"m9 6 6 6-6 6"})})})]}),le?i.jsx("div",{className:"tool-entry__details",children:i.jsx(bm,{active:le,fallback:i.jsx("div",{className:"patch-file-card__empty",children:"正在展开详情…"}),render:()=>i.jsxs("div",{className:"tool-entry__section",children:[i.jsx("div",{className:"tool-entry__label",children:bt}),i.jsx("div",{className:"tool-entry__markdown",children:ve(Z.body,`${ke.id}-subagent`)})]})})}):null]})},ke.id)}function zt(ke){var Ce,Oe;if(ke.kind==="tool-group"){const{group:le}=ke;if(le.commandEntry.title==="apply_patch"&&sA(y,le.commandEntry.timestamp,le.patchSummary))return null;const Ae=!!G[le.id],qe=l==="running"&&m===le.id&&le.outputEntries.length===0,bt=le.commandEntry.title==="apply_patch"&&!!le.patchSummary,At=bt&&(((Ce=le.patchSummary)==null?void 0:Ce.files.length)??0)>1,ce=bt?le.patchSummary.files.length===1?le.patchSummary.files[0].displayPath:`${le.patchSummary.files.length} 个文件`:rA(le.commandEntry);return i.jsx("section",{className:"conversation-entry is-tool-group",children:i.jsxs("div",{className:`tool-entry ${qe?"is-running":"is-complete"} ${Ae?"is-expanded":""} ${bt?"is-patch":""} ${At?"has-flat-patch-list":""}`,children:[i.jsxs("button",{type:"button",className:"tool-entry__toggle",onClick:()=>ie(le.id),"aria-expanded":Ae,children:[i.jsxs("div",{className:"tool-entry__summary",children:[i.jsx("span",{className:"tool-entry__status",children:bt?"已编辑":qe?"正在执行":"已执行"}),i.jsx("span",{className:"tool-entry__command",children:bt&&((Oe=le.patchSummary)==null?void 0:Oe.files.length)===1?re(le.patchSummary.files[0].path,`${le.id}:patch-link`,le.patchSummary.files[0].displayPath):ce}),bt&&le.patchSummary?i.jsxs("span",{className:"tool-entry__counts",children:[i.jsxs("span",{className:"is-add",children:["+",le.patchSummary.additions]}),i.jsxs("span",{className:"is-remove",children:["-",le.patchSummary.deletions]})]}):null]}),i.jsx("span",{className:"tool-entry__chevron","aria-hidden":"true",children:i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"m9 6 6 6-6 6"})})})]}),Ae?i.jsx("div",{className:"tool-entry__details",children:i.jsx(bm,{active:Ae,fallback:i.jsx("div",{className:"patch-file-card__empty",children:"正在展开详情…"}),render:()=>i.jsx(kA,{sessionId:t,group:le,projectPath:u})})}):null]})},le.id)}const Z=ke.entry,me=Z.kind==="user"?XR(Z.body):null;if(me)return jn(Z,me);if(Z.kind==="thinking")return l!=="running"?null:i.jsx("section",{className:"conversation-entry is-thinking-status",children:i.jsx("div",{className:"thinking-status-pill",children:i.jsx("span",{children:"正在思考"})})},Z.id);if($R(Z))return i.jsx("section",{className:"conversation-context-compact",children:i.jsx("div",{className:"context-compact-divider",children:i.jsx("span",{children:"背景信息已自动压缩"})})},Z.id);if(Z.kind==="system"&&Z.title==="system_prompt")return null;if(Z.kind==="system"&&Z.title==="runtime-status"){const le=YR(Z.body);return i.jsx("section",{className:"conversation-entry is-runtime-status",children:i.jsxs("div",{className:`runtime-status-entry is-${le}`,children:[i.jsx("div",{className:"runtime-status-entry__label",children:VR(Z.body)}),i.jsx("pre",{className:"runtime-status-entry__body",children:Z.body})]})},Z.id)}return i.jsx("section",{className:`conversation-entry ${Z.kind==="user"?"is-user":"is-system"} is-${Z.kind}`,children:Z.kind==="user"?i.jsxs("div",{className:"conversation-entry__stack",children:[i.jsxs("div",{className:"conversation-entry__body",children:[Z.body.trim()?ve(Z.body,Z.id):null,Z.attachments.length>0?St(Z):null]}),Z.body.trim()?i.jsxs("button",{type:"button",className:`conversation-entry__copy ${H===Z.id?"is-copied":""}`,onClick:()=>{_e(Z.id,Z.body)},"aria-label":H===Z.id?"已复制消息":"复制消息",children:[i.jsx("span",{className:"conversation-entry__copy-icon","aria-hidden":"true",children:H===Z.id?i.jsx(NR,{}):i.jsx(wR,{})}),i.jsx("span",{className:"sr-only",children:H===Z.id?"已复制":"复制"})]}):null]}):i.jsxs("div",{className:"conversation-entry__body",children:[Z.body.trim()?Z.kind==="assistant"?Be(Z):ve(Z.body,Z.id):null,Z.attachments.length>0?St(Z):null]})},Z.id)}if(g)return i.jsx("div",{className:"empty-panel",children:"正在载入子代理会话…"});if(S)return i.jsxs("div",{className:"empty-panel empty-panel--loading",role:"status","aria-live":"polite","aria-busy":"true",children:[i.jsxs("span",{className:"empty-panel__loading-dots","aria-hidden":"true",children:[i.jsx("span",{className:"empty-panel__loading-dot"}),i.jsx("span",{className:"empty-panel__loading-dot"}),i.jsx("span",{className:"empty-panel__loading-dot"})]}),i.jsx("span",{className:"sr-only",children:"正在加载会话记录"})]});if(!p)return i.jsx("div",{className:"empty-panel",children:"这个会话还没有历史记录。"});const Bt=F.canLoadEarlierEntries||F.isPulling||F.isLoadingFull,_t=F.isPulling||F.isLoadingFull||F.triggerSource==="click",vt=F.isLoadingFull?"正在加载全部对话…":F.isPulling?F.isReadyToLoad?"松开加载全部":"下拉加载更多":o?"加载全部对话":"点击加载全部",dt=F.isLoadingFull||F.triggerSource==="click"?T0:F.indicatorOffset,cn={opacity:_t?1:0,transform:`translate3d(-50%, calc(-100% + ${dt}px), 0) scale(${_t?1:.92})`},Pn={transform:`rotate(${F.indicatorRotation}deg)`};return i.jsxs(i.Fragment,{children:[Bt?i.jsx("section",{className:`conversation-entry is-history-loader ${F.isReadyToLoad?"is-ready":""}`,children:i.jsxs("div",{className:`timeline-history-loader ${F.isLoadingFull?"is-loading":""} ${F.triggerSource==="click"?"is-click-loading":""}`,children:[i.jsx("span",{className:"timeline-history-loader__indicator",style:cn,"aria-hidden":"true",children:i.jsx("span",{className:"timeline-history-loader__indicator-surface",children:i.jsx("span",{className:"timeline-history-loader__indicator-track",style:Pn,children:i.jsx("span",{className:`timeline-history-loader__indicator-spin ${F.isLoadingFull?"is-loading":""}`,children:i.jsx("span",{className:"timeline-history-loader__indicator-icon",children:i.jsx(AR,{})})})})})}),i.jsx("div",{className:"turn-complete-divider timeline-history-loader__divider",children:F.isLoadingFull?i.jsx("span",{className:"timeline-history-loader__content is-loading",children:i.jsx("span",{children:vt})}):i.jsx("button",{type:"button",className:`timeline-history-loader__button ${F.isPulling?"is-pulling":""}`,onClick:()=>ee("click"),children:vt})})]})}):null,f.map(ke=>{var qe;if(ke.kind==="item")return zt(ke.item);const{turn:Z}=ke,me=ke.changeSet,Ce=((qe=Z.completion)==null?void 0:qe.patchSummary)??null,Oe=!!Y[Z.id],le=Z.hiddenItems.length>0&&!Oe,Ae=Oe?mA(Z.hiddenItems):hA(Z.hiddenItems);return i.jsxs("section",{className:"conversation-turn",children:[Z.visibleStartItems.map(bt=>zt(bt)),Z.hiddenItems.length>0?i.jsxs("div",{className:"conversation-turn__history",children:[i.jsxs("button",{type:"button",className:`turn-history-toggle ${Oe?"is-expanded":""}`,onClick:()=>k(Z.id),"aria-expanded":Oe,children:[i.jsx("span",{className:"turn-history-toggle__label",children:Ae}),i.jsx("span",{className:"turn-history-toggle__chevron","aria-hidden":"true",children:i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"m9 6 6 6-6 6"})})})]}),le?null:Z.hiddenItems.map(bt=>zt(bt))]}):null,Z.completion&&Z.visibleEndItems.length>0?i.jsx("section",{className:"conversation-turn-complete",children:i.jsx("div",{className:"turn-complete-divider",children:i.jsx("span",{children:Z.completion.durationLabel})})}):null,Z.visibleEndItems.map(bt=>zt(bt)),me&&me.source==="app-server"&&me.files.length>0?tt(me):null,Z.completion&&Z.visibleEndItems.length===0?i.jsx("section",{className:"conversation-turn-complete",children:i.jsx("div",{className:"turn-complete-divider",children:i.jsx("span",{children:Z.completion.durationLabel})})}):null,me&&me.status==="completed"&&me.files.length>0?nn(me,Cg(Z.id),Ce):Ce?Xt(Cg(Z.id),Ce):null]},Z.id)})]})}),CA=({sessionId:e,workspaceDirectorySnapshot:t=null,workspaceAgentIndicatorState:a,embedded:l=!1,isDesktopSidebar:o,sidebarOffset:u=0,isSidebarDragging:f=!1,onOpenSidebar:m,onSelectSession:y,onExitToNodes:g}={})=>{var zi,Bi,yd,vd,xr,gl,So,_l,jo,bd,Hi,xd,vi,Rc,Ac,bi,xi,yl;const{sessionId:S}=$u({strict:!1}),p=e??S??"",v=o_(p),w=(v==null?void 0:v.agentId)??cc(),N=Ei(),j=La(),{data:T}=V3({scope:{sessionId:p,agentId:w??void 0},selectedSessionId:p,enabled:!l&&!t}),A=_.useMemo(()=>xR(t??T,v),[T,v,t]),U=(A==null?void 0:A.sessions.find(b=>b.id===p))??null,I=!!(U||v!=null&&v.session),E=xM({sessionId:p,scope:{sessionId:p,agentId:w??void 0},enabled:!!p}),{historyState:L,archivedState:W,loadMoreHistory:ee,loadMoreArchived:F,reset:G}=X3({scope:{sessionId:p},selectedSessionId:p}),Q=_.useRef(null),Y=_.useRef(null),pe=_.useRef(null),ne=_.useRef(null),V=_.useRef(null),[ye,R]=_.useState(!1),[H,X]=_.useState(()=>typeof window<"u"&&window.innerWidth>=Qb),[oe,ie]=_.useState(()=>NA()),[k,K]=_.useState(!1),[_e,fe]=_.useState(""),[Te,re]=_.useState([]),[we,ve]=_.useState(null),[ze,Be]=_.useState(null),[St,Ke]=_.useState(null),[tt,nn]=_.useState(()=>v_()),[Xt,jn]=_.useState(()=>R3()),[zt,Bt]=_.useState(()=>nb(p)),[_t,vt]=_.useState(()=>sb(p)),[dt,cn]=_.useState(()=>ab(p)),Pn=j_(),ke=_.useMemo(()=>Pn.map(({id:b,...O})=>O),[Pn]),[Z,me]=_.useState({}),[Ce,Oe]=_.useState(null),[le,Ae]=_.useState(!1),[qe,bt]=_.useState(!1),[At,ce]=_.useState(""),[Me,Re]=_.useState(!1),[We,Xe]=_.useState(!1),[Je,Tt]=_.useState(null),[Wt,ls]=_.useState(null),[Nt,Un]=_.useState(!1),[Cn,Dn]=_.useState(!1),[De,Qt]=_.useState("code"),[On,Ts]=_.useState(!1),[Ua,Us]=_.useState(null),[Ci,Fn]=_.useState(null),[Ys,te]=_.useState(!1),[Ie,$e]=_.useState(!1),[at,Ut]=_.useState(!1),[ft,Mt]=_.useState(!1),[qn,jt]=_.useState(null),[zs,Kt]=_.useState(null),[bs,Wn]=_.useState({}),[P,be]=_.useState(!1),[Le,He]=_.useState({state:"connected",attempt:0,maxAttempts:5}),[Ge,ht]=_.useState({sessionId:p??null,pending:!!p,error:null}),[mt,ot]=_.useState({state:"idle"}),Xn=_.useRef({}),Jt=_.useRef(A),Jn=_.useRef(null);_.useEffect(()=>{_f(tt)},[tt]),_.useEffect(()=>{A3(Xt)},[Xt]),_.useEffect(()=>{ke.length!==0&&(ke.some(b=>b.value===tt)||nn(ke[0].value))},[ke,tt]),_.useEffect(()=>{Bt(nb(p)),vt(sb(p)),cn(ab(p)),Ke(null),Qt("code"),Ts(!1),Us(null),Fn(null),te(!1),$e(!1),Ut(!1),Mt(!1),jt(null),Kt(null),Wn({}),er({}),nr({}),Ba({}),Ha(0),Zs(!1),ir(!1),li(null),Mi.current=null,Xs.current=null,Qu.current=null,oi.current=null,ja.current=!1,lo.current=!!p},[p]),_.useEffect(()=>{Xn.current=bs},[bs]),_.useEffect(()=>{Jt.current=A},[A]),_.useEffect(()=>{D3(p,zt)},[zt,p]),_.useEffect(()=>{O3(p,_t)},[_t,p]),_.useEffect(()=>{I3(p,dt)},[dt,p]),_.useEffect(()=>{me({}),Oe(null)},[p]),_.useEffect(()=>{D.current=null},[p]),_.useEffect(()=>{if(!we)return;const b=$=>{$.key==="Escape"&&ve(null)},O=document.body.style.overflow;return document.body.style.overflow="hidden",window.addEventListener("keydown",b),()=>{document.body.style.overflow=O,window.removeEventListener("keydown",b)}},[we]);const[as,In]=_.useState(!1),pn=_.useRef(null),sn=_.useRef(null),wn=_.useRef(null),xs=_.useRef(0),D=_.useRef(null),he=_.useRef(0),et=_.useRef(0),It=_.useRef(0),pt=_.useRef(null),ct=_.useRef(null),gn=_.useRef(0),zn=_.useRef(null),za=_.useRef(!1),Bs=_.useRef(!1),Hs=_.useRef(!1),Vs=_.useRef(0),$s=_.useRef(p??null),ri=_.useRef({sessionId:p??null,agentId:null,embedded:l}),[Ti,er]=_.useState({}),[tr,nr]=_.useState({}),[sr,Ba]=_.useState({}),[Ms,Ha]=_.useState(0),[ar,Zs]=_.useState(!1),[Ss,ir]=_.useState(!1),[rr,li]=_.useState(null),Mi=_.useRef(null),Xs=_.useRef(null),Qu=_.useRef(null),oi=_.useRef(null),ja=_.useRef(!1),lo=_.useRef(!1),Ri=_.useRef(new Set),lr=_.useCallback(b=>{if(b.length===0)return;const O=b.map(Se=>`${Se}:`),$=Se=>O.some(Fe=>Se.startsWith(Fe));er(Se=>Object.fromEntries(Object.entries(Se).filter(([Fe])=>!$(Fe)))),nr(Se=>Object.fromEntries(Object.entries(Se).filter(([Fe])=>!$(Fe)))),Ba(Se=>Object.fromEntries(Object.entries(Se).filter(([Fe])=>!$(Fe))))},[]),Ai=_.useCallback(b=>{Ri.current.add(b)},[]),Di=_.useCallback(b=>{Ri.current.delete(b)},[]),Gu=_.useRef(null),os=_.useRef(null),es=_.useRef(null),Vr=_.useRef(null),ci=_.useRef(oe),oo=_.useRef(null),$a=_.useRef(null);let de=wM(U,(zi=E.data)==null?void 0:zi.session)??(v==null?void 0:v.session)??null;const on=(A==null?void 0:A.agent)??null;let Rs=(A==null?void 0:A.projects.find(b=>b.id===(de==null?void 0:de.project_id)))??(v==null?void 0:v.project);const ui=(de==null?void 0:de.capability.can_show_git)??!1,wa=(de==null?void 0:de.capability.can_show_terminal)??!1;ri.current={sessionId:p??null,agentId:(de==null?void 0:de.agent_id)??(on==null?void 0:on.id)??w,embedded:l};const _n=_.useCallback(()=>{var O;const b=(de==null?void 0:de.agent_id)??(on==null?void 0:on.id)??w;return b&&((O=ct.current)==null?void 0:O.agentId)===b?Promise.resolve(ct.current.target):xn({sessionId:p,agentId:b})},[on==null?void 0:on.id,w,de==null?void 0:de.agent_id,p]),Zr=_.useCallback(async b=>{if(l){y==null||y(b);return}na(b),Wr(b),on!=null&&on.id&&Zi(on.id),await N({to:"/",replace:!0})},[on==null?void 0:on.id,l,N,y]),Xr=_.useCallback(async()=>{if(l){g==null||g();return}await N({to:"/nodes"})},[l,N,g]),Qf=b=>b instanceof Element&&!!b.closest('button, textarea, input, a, [role="button"], [role="dialog"]'),Gf=b=>Qf(b),dc=()=>{const b=pe.current;if(!b)return;const O=()=>{b.scrollTo({top:b.scrollHeight,behavior:"auto"})};O(),window.requestAnimationFrame(()=>{O(),window.requestAnimationFrame(O)})},Yf=_.useCallback(()=>{const b=pe.current;return b?b.scrollHeight-b.scrollTop-b.clientHeight<=Gb:!0},[]),Np=_.useCallback(b=>{(b!=null&&b.force||Yf())&&dc()},[Yf]),fc=()=>{const b=pe.current;if(!b){be(!1);return}const O=b.scrollHeight-b.scrollTop-b.clientHeight;be(O>Gb)},ps=_.useCallback(b=>{j.setQueriesData({queryKey:rs},b)},[j]),Yu=_.useCallback((b,O)=>{j.setQueryData(h5({sessionId:b,scope:{sessionId:b}}),$=>NM($??void 0,b,O)??$)},[j]),kp=(A==null?void 0:A.projects)??[],or=(A==null?void 0:A.sessions)??[],Vu=(A==null?void 0:A.project_stats)??[],bn=_.useMemo(()=>{var b;return(b=de==null?void 0:de.subagent)!=null&&b.parent_session_id?or.find(O=>{var $;return O.id===(($=de==null?void 0:de.subagent)==null?void 0:$.parent_session_id)})??null:null},[(Bi=de==null?void 0:de.subagent)==null?void 0:Bi.parent_session_id,or]),Jr=_.useCallback(b=>{const O=b.session_id;O&&(j.setQueryData(Lo(O),$=>n5($,b.entries)),j.setQueryData(["timeline",O],$=>{const Se=AT($,b);return Se.view==="full_compact"&&yM(Se),Se}))},[j]),Vf=_.useCallback(b=>{var un,Os;const O=b.session_id;if(!O)return;const $=ri.current.sessionId===O;Jr(b.timeline),j.setQueryData(["interactions",O],b.interactions),$&&Tt(dn=>dn&&b.interactions.some(ds=>ds.id===dn)?dn:null),j.setQueryData(["plan",O],b.plan_snapshot),b.change_sets.length>0?(lr(b.change_sets.map(dn=>dn.id)),j.setQueryData(["change-sets",O],b.change_sets),Ai(O)):Ri.current.has(O)||(j.setQueryData(["change-sets",O],[]),Di(O)),j.setQueryData(["session-run-workbench",O],b.run_workbench);const Se=(un=b.timeline.entries.at(-1))==null?void 0:un.timestamp,Fe=Se&&(!b.session_patch.last_event_at||+new Date(Se)>+new Date(b.session_patch.last_event_at))?{...b.session_patch,last_event_at:Se}:b.session_patch,kt=Ib(Fe);kt&&Yu(O,kt);const Ve=g0(Fe);Ve&&ip(Jt.current??void 0,O)&&ps(dn=>lf(dn,O,Ve)),$&&(b.session_patch.run_state==="running"||b.session_patch.run_state==="completed"||b.session_patch.run_state==="idle")&&(Re(b.session_patch.run_state==="running"),b.session_patch.run_state!=="running"&&Xe(!1)),$&&((Os=b.run_workbench)!=null&&Os.terminal_snapshot)&&Wn(dn=>{var Pe;const ds=new Set((Pe=b.run_workbench)==null?void 0:Pe.terminal_snapshot.terminals.map(Bn=>Bn.id)),Ln={};for(const[Bn,Ns]of Object.entries(dn))ds.has(Bn)&&(Ln[Bn]=Ns);return Ln}),bn!=null&&bn.id&&j.invalidateQueries({queryKey:["timeline",bn.id,"prefix-source"],exact:!0})},[Jr,lr,Yu,Ai,bn==null?void 0:bn.id,j,Di]),co=_.useCallback(async b=>{var Se;if(!p)return null;const O=p;if(((Se=pt.current)==null?void 0:Se.sessionId)===O)return pt.current.promise;const $=(async()=>{var kt;const Fe=++xs.current;ot({state:"recovering"});try{const un=await(await _n()).client.getSessionBootstrap(p);return xs.current!==Fe?null:(Vf(un),et.current=Date.now(),ot({state:"idle"}),un)}catch(Ve){return xs.current!==Fe||ot({state:"failed",error:Ve instanceof Error?Ve.message:b==="initial"?"会话加载失败。":"会话同步失败。"}),null}finally{((kt=pt.current)==null?void 0:kt.sessionId)===O&&(pt.current=null)}})();return pt.current={sessionId:O,promise:$},$},[Vf,_n,p]),Zu=_.useCallback(b=>{p&&(It.current>0||(It.current=Date.now(),co(b).then(O=>{ht({sessionId:p,pending:!1,error:O?null:"Unable to load session bootstrap."})}).catch(O=>{ht({sessionId:p,pending:!1,error:O instanceof Error?O.message:"Unable to load session bootstrap."})})))},[co,p]),Zf=_.useCallback(async()=>{if(!p||Ri.current.has(p))return;const O=await(await _n()).client.getSessionChangeSets(p);lr(O.map($=>$.id)),j.setQueryData(["change-sets",p],O),Ai(p)},[lr,Ai,j,_n,p]),hc=_.useCallback(async(b="click")=>{if(!p||Ss)return;const O=pe.current;O&&(oi.current=O.scrollHeight,ja.current=!0),li(b),ir(!0);const $=Date.now();try{const Fe=await(await _n()).client.getSessionTimeline(p,{view:"full_compact"});Jr(Fe)}finally{if(b==="click"){const Se=pR-(Date.now()-$);Se>0&&await new Promise(Fe=>{window.setTimeout(Fe,Se)})}ir(!1),Ha(0),Zs(!1),li(null)}},[Jr,Ss,_n,p]),Xf=_.useCallback(async b=>{if(!p)return;const O=Dm(b.changeSetId,b.path,b.itemId);if(!(Ti[O]||sr[O])){Ba($=>({...$,[O]:!0})),nr($=>({...$,[O]:void 0}));try{const Se=await(await _n()).client.getSessionChangeSetFileDiff(p,b);er(Fe=>({...Fe,[O]:Se}))}catch($){nr(Se=>({...Se,[O]:$ instanceof Error?$.message:"无法读取这个文件的差异详情。"}))}finally{Ba($=>({...$,[O]:!1}))}}},[Ti,sr,_n,p]),ia=is({queryKey:["timeline",p],enabled:!1,queryFn:async()=>SR,initialData:p?_M(p)??j.getQueryData(["timeline",p]):void 0,refetchInterval:!1}),uo=is({queryKey:Lo(p),enabled:!1,queryFn:async()=>[],initialData:[]});_.useEffect(()=>{const b=v==null?void 0:v.optimisticEntry;!p||(v==null?void 0:v.sessionId)!==p||!b||j.setQueryData(Lo(p),O=>O!=null&&O.some($=>$.id===b.id)?O:w0(O,b))},[v,j,p]),_.useEffect(()=>{var O;(v==null?void 0:v.sessionId)!==p||!(((O=E.data)==null?void 0:O.session.id)===p||T!=null&&T.sessions.some($=>$.id===p))||YN(p)},[T,v==null?void 0:v.sessionId,(yd=E.data)==null?void 0:yd.session.id,p]);const Ep=_m(ia.data),Cp=uo.data??[],mc=Ep.length>0||Cp.length>0||!!(v!=null&&v.optimisticEntry),di=is({queryKey:["timeline",bn==null?void 0:bn.id,"prefix-source"],enabled:!!(bn!=null&&bn.id),queryFn:async()=>(await(await xn({sessionId:bn.id,projectId:bn.project_id,agentId:bn.agent_id})).client.getSessionTimeline(bn.id,{view:"tail"})).entries,refetchInterval:!1}),el=_.useMemo(()=>{const b=_m(ia.data);return de!=null&&de.subagent?new Set:tA(b)},[de==null?void 0:de.subagent,ia.data]),Xu=_.useMemo(()=>eA(_m(ia.data)),[ia.data]),Ju=_.useMemo(()=>de!=null&&de.subagent?[]:or.filter(b=>{var O;return b.id!==p&&((O=b.subagent)==null?void 0:O.parent_session_id)===p&&!b.archived}).filter(b=>{if(b.run_state==="running")return!0;if(!((de==null?void 0:de.run_state)==="running"||Me))return!1;if(el.has(b.id))return!0;if(!Xu)return!1;const O=new Date(Xu).getTime(),$=new Date(b.last_event_at).getTime();return Number.isFinite(O)&&Number.isFinite($)&&$>=O-fR}).sort((b,O)=>+new Date(O.last_event_at)-+new Date(b.last_event_at)),[Xu,Me,el,de==null?void 0:de.run_state,de==null?void 0:de.subagent,p,or]);_.useEffect(()=>{if(!p){Jn.current=null,Hs.current=!1,Vs.current=0,$s.current=null,ht({sessionId:null,pending:!1,error:null}),He({state:"connected",attempt:0,maxAttempts:5});return}const b=!mc;ht({sessionId:p,pending:b,error:null}),et.current=b?0:Date.now(),It.current=0},[mc,p]),_.useEffect(()=>{if(!p||!Ge.pending)return;if(Le.state==="failed"){Zu("initial");return}if(Le.state!=="connected")return;const b=he.current;if(b<=0)return;const O=window.setTimeout(()=>{et.current>=b||Zu("initial")},1200);return()=>{window.clearTimeout(O)}},[Le.state,Ge.pending,Zu,p]),_.useEffect(()=>{if(!p||Le.state!=="connected"||Ge.pending||mc||!Hs.current||$s.current!==p)return;const b=Vs.current;if(b<=0)return;const O=window.setTimeout(()=>{if(Hs.current&&Vs.current===b){if(et.current>=b){Hs.current=!1,Vs.current=0,$s.current=null;return}Hs.current=!1,Vs.current=0,$s.current=null,co("connected")}},1200);return()=>{window.clearTimeout(O)}},[Le.state,co,mc,Ge.pending,p]);const Jf=is({queryKey:["change-sets",p],enabled:!1,queryFn:async()=>p?(await _n()).client.getSessionChangeSets(p):[],initialData:p?j.getQueryData(["change-sets",p])??[]:[],refetchInterval:!1}),cr=is({queryKey:["session-git-workspace",p],enabled:!!(p&&ui&&De==="git"),queryFn:async()=>(await _n()).client.getSessionGitWorkspace(p),refetchInterval:!1}),Na=is({queryKey:["session-git-history",p],enabled:!1,queryFn:async()=>(await _n()).client.getSessionGitHistory(p),refetchInterval:!1}),ur=is({queryKey:["session-run-workbench",p],enabled:!1,queryFn:async()=>null,initialData:p?j.getQueryData(["session-run-workbench",p])??null:null,refetchInterval:!1}),ra=is({queryKey:["plan",p],enabled:!1,queryFn:async()=>null,initialData:p?j.getQueryData(["plan",p])??null:null,refetchInterval:!1}),ed=is({queryKey:["interactions",p],enabled:!1,queryFn:async()=>[],initialData:p?j.getQueryData(["interactions",p])??[]:[],refetchInterval:!1}),pc=_.useCallback(async(b,O)=>{if(p){Wn($=>{var Se,Fe,kt;return{...$,[b]:{chunks:((Se=$[b])==null?void 0:Se.chunks)??[],nextCursor:((Fe=$[b])==null?void 0:Fe.nextCursor)??0,truncated:((kt=$[b])==null?void 0:kt.truncated)??!1,isLoading:!0,error:null}}});try{const $=await _n(),Se=Xn.current[b],Fe=await $.client.getSessionTerminalOutput({sessionId:p,terminalId:b,cursor:O!=null&&O.force||Se!=null&&Se.truncated||Se==null?void 0:Se.nextCursor});Wn(kt=>{const Ve=kt[b],un=O!=null&&O.force||Fe.truncated||!Ve?Fe.chunks:Zb(Ve.chunks,Fe.chunks);return{...kt,[b]:{chunks:un,nextCursor:Fe.next_cursor,truncated:Fe.truncated,isLoading:!1,error:null}}})}catch($){Wn(Se=>{var Fe,kt,Ve;return{...Se,[b]:{chunks:((Fe=Se[b])==null?void 0:Fe.chunks)??[],nextCursor:((kt=Se[b])==null?void 0:kt.nextCursor)??0,truncated:((Ve=Se[b])==null?void 0:Ve.truncated)??!1,isLoading:!1,error:$ instanceof Error?$.message:"无法读取终端输出。"}}})}}},[p]);_.useEffect(()=>{var Se,Fe;const b=(Se=ur.data)==null?void 0:Se.terminal_snapshot.active_terminal_id,O=(Fe=ur.data)==null?void 0:Fe.terminal_snapshot.terminals.find(kt=>kt.id===b);if(!b||!O)return;const $=bs[b];(!$||$.truncated||$.nextCursor<O.output_cursor)&&pc(b)},[pc,ur.data,bs]);const eh=!!(de!=null&&de.subagent&&(bn!=null&&bn.id)&&di.isPending&&!di.data),tl=_.useMemo(()=>{const b=_m(ia.data);return de!=null&&de.subagent?bn!=null&&bn.id&&di.isPending&&!di.data?[]:ZR(b,di.data):b},[bn==null?void 0:bn.id,di.data,di.isPending,de==null?void 0:de.subagent,ia.data]),nl=_.useMemo(()=>RT(tl,uo.data),[tl,uo.data]);_.useEffect(()=>{p&&window.localStorage.setItem(lR,p)},[p]),_.useEffect(()=>{const b=wn.current;b&&((uo.data??[]).some(O=>O.id===b.optimisticEntryId)||(wn.current=null))},[uo.data]),_.useEffect(()=>{Dn(!1)},[p]),_.useEffect(()=>{ce((de==null?void 0:de.title)??""),bt(!1)},[de==null?void 0:de.title,p]),_.useEffect(()=>{Xe(!1)},[p]),_.useEffect(()=>()=>{pn.current&&window.clearTimeout(pn.current),sn.current&&window.clearTimeout(sn.current),$a.current&&window.cancelAnimationFrame($a.current)},[]),_.useEffect(()=>{if(sn.current&&(window.clearTimeout(sn.current),sn.current=null),!!ze)return sn.current=window.setTimeout(()=>{Be(null),sn.current=null},gR),()=>{sn.current&&(window.clearTimeout(sn.current),sn.current=null)}},[ze]),_.useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(_5,String(A0(oe))),window.localStorage.setItem(cf,uf)}catch{}},[oe]),_.useEffect(()=>{ci.current=oe},[oe]),_.useEffect(()=>{if(typeof window>"u")return;const b=()=>{const O=window.innerWidth>=Qb;X(O),O&&R(!1)};return b(),window.addEventListener("resize",b),()=>{window.removeEventListener("resize",b)}},[]),_.useEffect(()=>{if(!k)return;const b=$=>{const Se=Vr.current;if(!Se)return;const Fe=$.clientX-Se.startX,kt=A0(Se.startWidth+Fe);oo.current=kt,$a.current===null&&($a.current=window.requestAnimationFrame(()=>{$a.current=null;const Ve=oo.current,un=Q.current;Ve===null||!un||un.style.setProperty("--desktop-sidebar-width",`${Ve}px`)}))},O=()=>{$a.current!==null&&(window.cancelAnimationFrame($a.current),$a.current=null);const $=oo.current??ci.current;oo.current=null,Vr.current=null,K(!1),ci.current=$,ie($)};return window.addEventListener("pointermove",b),window.addEventListener("pointerup",O),window.addEventListener("pointercancel",O),()=>{window.removeEventListener("pointermove",b),window.removeEventListener("pointerup",O),window.removeEventListener("pointercancel",O)}},[k]),_.useEffect(()=>{const b=O=>{const $=O.target;Un(!1),In(!1),!($ instanceof Element&&($.closest(".conversation-topbar__actions")||$.closest(".conversation-topbar__title-actions")||$.closest(".picker-sheet")||$.closest(".picker-sheet-wrap")))&&(Ae(!1),te(!1),$e(!1))};return window.addEventListener("pointerdown",b),()=>{window.removeEventListener("pointerdown",b)}},[]),_.useEffect(()=>{const b=Q.current;if(!b||H)return;const O=kt=>{const Ve=kt.touches[0];kt.touches.length!==1||!Ve||Gf(kt.target)||(os.current={startX:Ve.clientX,startY:Ve.clientY})},$=kt=>{if(kt.touches.length!==1)return;const Ve=kt.touches[0];if(!es.current){const Os=os.current;if(!Os)return;const dn=Ve.clientX-Os.startX,ds=Ve.clientY-Os.startY;if(Math.abs(dn)<8&&Math.abs(ds)<8)return;if(Math.abs(dn)<=Math.abs(ds)){os.current=null;return}kc(Os.startX,Os.startY)}od(Ve.clientX,Ve.clientY)&&kt.preventDefault()},Se=kt=>{if(os.current=null,!es.current)return;const Ve=kt.changedTouches[0];if(!Ve){es.current=null,Va(null);return}us(Ve.clientX,Ve.clientY)},Fe=()=>{os.current=null,es.current=null,Va(null)};return b.addEventListener("touchstart",O,{passive:!0,capture:!0}),b.addEventListener("touchmove",$,{passive:!1,capture:!0}),b.addEventListener("touchend",Se,{capture:!0}),b.addEventListener("touchcancel",Fe,{capture:!0}),()=>{b.removeEventListener("touchstart",O,{capture:!0}),b.removeEventListener("touchmove",$,{capture:!0}),b.removeEventListener("touchend",Se,{capture:!0}),b.removeEventListener("touchcancel",Fe,{capture:!0})}},[H,ye]),_.useEffect(()=>{const b=pe.current;if(!b)return;if(ja.current&&oi.current!==null){const $=oi.current,Se=b.scrollHeight;b.scrollTop+=Math.max(0,Se-$),ja.current=!1,oi.current=null;return}if(!p||!lo.current||tl.length===0)return;dc();const O=window.setTimeout(()=>{dc(),lo.current=!1},120);return()=>{window.clearTimeout(O)}},[tl.length,p]),_.useEffect(()=>{const b=pe.current;if(!b)return;const O=()=>{fc()};return O(),b.addEventListener("scroll",O,{passive:!0}),window.addEventListener("resize",O),()=>{b.removeEventListener("scroll",O),window.removeEventListener("resize",O)}},[tl.length,p]),_.useEffect(()=>{const b=pe.current;if(!b)return;const O=ia.data,$=(ym(O)||Tg(O)!=="full_compact")&&!Ss,Se=()=>{Mi.current=null,Xs.current=null,Ha(0),Zs(!1)},Fe=()=>{const dn=$&&Xs.current!==null&&Ms>=kg;Se(),dn&&hc("pull")},kt=dn=>{var ds,Ln;!$||dn.touches.length!==1||b.scrollTop>0||Qf(dn.target)||(Mi.current=((ds=dn.touches[0])==null?void 0:ds.clientX)??null,Xs.current=((Ln=dn.touches[0])==null?void 0:Ln.clientY)??null)},Ve=dn=>{if(dn.defaultPrevented)return;const ds=Mi.current,Ln=Xs.current;if(ds===null||Ln===null||dn.touches.length!==1)return;const Pe=dn.touches[0],Bn=((Pe==null?void 0:Pe.clientX)??ds)-ds,Ns=((Pe==null?void 0:Pe.clientY)??Ln)-Ln;if(Math.abs(Bn)>Math.abs(Ns)){Se();return}if(Ns<=0){Ha(0),Zs(!1);return}if(b.scrollTop>0){Se();return}dn.cancelable&&dn.preventDefault(),Zs(!0),Ha(Math.min(Yb,Ns))},un=()=>{Fe()},Os=()=>{Se()};return b.addEventListener("touchstart",kt,{passive:!0}),b.addEventListener("touchmove",Ve,{passive:!1}),b.addEventListener("touchend",un),b.addEventListener("touchcancel",Os),()=>{b.removeEventListener("touchstart",kt),b.removeEventListener("touchmove",Ve),b.removeEventListener("touchend",un),b.removeEventListener("touchcancel",Os)}},[Ss,hc,Ms,ia.data]),_.useEffect(()=>{var kt,Ve;if(!p){zn.current!==null&&(clearTimeout(zn.current),zn.current=null),(kt=ct.current)==null||kt.stream.setSessionId(null);return}let b=!1;const O=++gn.current,$=ri.current.agentId,Se=()=>{zn.current!==null&&(clearTimeout(zn.current),zn.current=null)},Fe=()=>{l||(Se(),zn.current=setTimeout(()=>{zn.current=null;const un=ri.current;of(j,{scope:{sessionId:un.sessionId,agentId:un.agentId},selectedSessionId:un.sessionId})},_R))};return $&&((Ve=ct.current)==null?void 0:Ve.agentId)===$?(ct.current.stream.setSessionId(p),()=>{b=!0}):(_n().then(un=>{var ds,Ln;if(b||gn.current!==O)return;const Os=un.client.getConnectionKey();if(((ds=ct.current)==null?void 0:ds.key)===Os){ct.current.stream.setSessionId(p);return}(Ln=ct.current)==null||Ln.stream.close(),za.current=!1,Bs.current=!1;const dn=un.client.createEventStream(Pe=>{var Ks,Qn,wo,Xa,Dt,yn,Zn,No,Sr,$i,ko,vl,jr,yh,Hn,Dc,Oc,Sd,jd,vh,Ic,Lc;const Bn=typeof((Ks=Pe.payload)==null?void 0:Ks.sessionId)=="string"?Pe.payload.sessionId:null,Ns=ri.current.sessionId,an=Bn===Ns?Ns:null,Za=typeof((Qn=Pe.payload)==null?void 0:Qn.projectId)=="string"?Pe.payload.projectId:null;if(Pe.type==="agent.online"){if(Bs.current){Bs.current=!1;return}G(),Fe();return}if(Pe.type==="timeline.reset"&&an){et.current=Date.now(),Hs.current=!1,Vs.current=0,$s.current=null,ht({sessionId:an,pending:!1,error:null});const it=Array.isArray((wo=Pe.payload)==null?void 0:wo.entries)?Pe.payload.entries:[],Et=ym(j.getQueryData(["timeline",an]));Jr(t2(an,it,Et));const Ct=(Xa=it[it.length-1])==null?void 0:Xa.timestamp;Ct&&ps(Yt=>_0(Yt,an,Ct)),window.requestAnimationFrame(fc);return}if(Pe.type==="interaction.reset"&&an){const it=Array.isArray((Dt=Pe.payload)==null?void 0:Dt.requests)?Pe.payload.requests:[];j.setQueryData(["interactions",an],it),Tt(Et=>Et&&it.some(Ct=>Ct.id===Et)?Et:null);return}if(Pe.type==="plan.reset"&&an){const it=(yn=Pe.payload)!=null&&yn.planSnapshot&&typeof Pe.payload.planSnapshot=="object"?Pe.payload.planSnapshot:null;j.setQueryData(["plan",an],it);return}if(Pe.type==="timeline.delta"&&an){const it=Array.isArray((Zn=Pe.payload)==null?void 0:Zn.entries)?Pe.payload.entries:[],Et=ym(j.getQueryData(["timeline",an]));Jr(t2(an,t5(void 0,it),Et));const Ct=(No=it[it.length-1])==null?void 0:No.timestamp;Ct&&ps(Yt=>_0(Yt,an,Ct)),Np(),window.requestAnimationFrame(fc);return}if(Pe.type==="interaction.delta"&&an){const it=Array.isArray((Sr=Pe.payload)==null?void 0:Sr.requests)?Pe.payload.requests:[],Et=Array.isArray(($i=Pe.payload)==null?void 0:$i.resolvedRequestIds)?Pe.payload.resolvedRequestIds.filter(Ct=>typeof Ct=="string"&&Ct.trim().length>0):[];j.setQueryData(["interactions",an],Ct=>{const Yt=new Map((Ct??[]).map(Nn=>[Nn.id,Nn]));for(const Nn of it)Yt.set(Nn.id,Nn);for(const Nn of Et)Yt.delete(Nn);return[...Yt.values()].sort((Nn,fa)=>+new Date(fa.updated_at)-+new Date(Nn.updated_at))}),Et.length>0&&Tt(Ct=>Ct&&Et.includes(Ct)?null:Ct);return}if(Pe.type==="plan.delta"&&an){const it=(ko=Pe.payload)!=null&&ko.planSnapshot&&typeof Pe.payload.planSnapshot=="object"?Pe.payload.planSnapshot:null;j.setQueryData(["plan",an],it);return}if(Pe.type==="changeset.reset"&&an){const it=Array.isArray((vl=Pe.payload)==null?void 0:vl.changeSets)?Pe.payload.changeSets:[];it.length>0?(lr(it.map(Et=>Et.id)),j.setQueryData(["change-sets",an],it),Ai(an)):Ri.current.has(an)||(j.setQueryData(["change-sets",an],[]),Di(an));return}if(Pe.type==="changeset.delta"&&an){const it=Array.isArray((jr=Pe.payload)==null?void 0:jr.changeSets)?Pe.payload.changeSets:[];lr(it.map(Et=>Et.id)),j.setQueryData(["change-sets",an],Et=>QR(Et,it));return}if(Pe.type==="terminal.snapshot"&&an){const it=(yh=Pe.payload)!=null&&yh.snapshot&&typeof Pe.payload.snapshot=="object"?Pe.payload.snapshot:null;if(!it)return;j.setQueryData(["session-run-workbench",an],Et=>Et&&{...Et,terminal_snapshot:it}),Wn(Et=>{const Ct=new Set(it.terminals.map(Nn=>Nn.id)),Yt={};for(const[Nn,fa]of Object.entries(Et))Ct.has(Nn)&&(Yt[Nn]=fa);return Yt});return}if(Pe.type==="terminal.delta"&&an){const it=(Hn=Pe.payload)!=null&&Hn.terminal&&typeof Pe.payload.terminal=="object"?Pe.payload.terminal:null,Et=Array.isArray((Dc=Pe.payload)==null?void 0:Dc.chunks)?Pe.payload.chunks:[],Ct=typeof((Oc=Pe.payload)==null?void 0:Oc.activeTerminalId)=="string"?Pe.payload.activeTerminalId:null;if(!it)return;j.setQueryData(["session-run-workbench",an],Yt=>{if(!Yt)return Yt;const Nn=Yt.terminal_snapshot.terminals.filter(Ma=>Ma.id!==it.id),fa=Yt.terminal_snapshot.terminals.findIndex(Ma=>Ma.id===it.id),Eo=[...Nn];return fa<=0?Eo.unshift(it):Eo.splice(fa,0,it),{...Yt,terminal_snapshot:{...Yt.terminal_snapshot,active_terminal_id:Ct,updated_at:it.updated_at,terminals:Eo}}}),Wn(Yt=>{var fa;if(Et.length===0)return Yt;const Nn=Yt[it.id];return{...Yt,[it.id]:{chunks:Zb((Nn==null?void 0:Nn.chunks)??[],Et),nextCursor:typeof((fa=Pe.payload)==null?void 0:fa.nextCursor)=="number"?Pe.payload.nextCursor:it.output_cursor,truncated:(Nn==null?void 0:Nn.truncated)??!1,isLoading:!1,error:null}}});return}if(Pe.type==="thread.updated"&&Za){const it=typeof((Sd=Pe.payload)==null?void 0:Sd.action)=="string"?Pe.payload.action:"",Et=(jd=Pe.payload)!=null&&jd.projectPatch&&typeof Pe.payload.projectPatch=="object"?Pe.payload.projectPatch:null,Ct=Array.isArray((vh=Pe.payload)==null?void 0:vh.orderedProjectIds)?Pe.payload.orderedProjectIds.filter(Yt=>typeof Yt=="string"&&Yt.trim().length>0):[];if((it==="pin"||it==="unpin"||it==="rename")&&Et){ps(Yt=>fu(Yt,Za,Et));return}if(it==="reorder"&&Ct.length>0){ps(Yt=>lp(Yt,Ct));return}if(it==="remove"||it==="archive"){G(),ps(Yt=>op(Yt,Za));return}if(it==="unarchive"){G(),Fe();return}}if(Pe.type==="session.updated"&&Bn){const it=(Ic=Pe.payload)!=null&&Ic.sessionPatch&&typeof Pe.payload.sessionPatch=="object"?g0(Pe.payload.sessionPatch):null,Et=(Lc=Pe.payload)!=null&&Lc.sessionPatch&&typeof Pe.payload.sessionPatch=="object"?Ib(Pe.payload.sessionPatch):null;Et&&Yu(Bn,Et);const Ct=ip(Jt.current??void 0,Bn);if(it&&Ct)ps(Yt=>lf(Yt,Bn,it));else{if(ri.current.embedded&&Bn===Ns&&!Jt.current)return;if(Ct)return;Fe()}an&&((it==null?void 0:it.run_state)==="running"||(it==null?void 0:it.run_state)==="completed"||(it==null?void 0:it.run_state)==="idle")&&(Re(it.run_state==="running"),it.run_state!=="running"&&Xe(!1));return}Pe.type==="turn.completed"&&an&&(Re(!1),Xe(!1),j.setQueryData(["plan",an],null))},{sessionId:p,reconnectWhenHidden:!0,onStatus:Pe=>{if(He(Pe),Pe.state==="connected"){const Bn=Date.now(),Ns=za.current;he.current=Bn,Hs.current=Ns,Vs.current=Ns?Bn:0,$s.current=Ns?p:null,Bs.current=!0,Ns&&(G(),Fe()),za.current=!0,In(!1);return}xs.current+=1,ot({state:"idle"})}});ct.current={key:Os,agentId:$,target:un,stream:dn},dn.setSessionId(p)}).catch(un=>{b||gn.current!==O||He({state:"failed",attempt:0,maxAttempts:5,error:un instanceof Error?un.message:"Unable to connect to live session."})}),()=>{b=!0})},[l,_n,p]),_.useEffect(()=>()=>{var b;gn.current+=1,zn.current!==null&&(clearTimeout(zn.current),zn.current=null),(b=ct.current)==null||b.stream.close(),ct.current=null},[]),_.useEffect(()=>{if(!p||(de==null?void 0:de.run_state)!=="running"||de.context_usage)return;if(D.current!==p){D.current=p;return}let b=!1;const O=window.setTimeout(()=>{b||E.refetch()},1200);return()=>{b=!0,window.clearTimeout(O)}},[p,de==null?void 0:de.context_usage,de==null?void 0:de.run_state,E.refetch]),_.useEffect(()=>{var Fe,kt;if(!p||!I||!de||!Rs||((Fe=E.data)==null?void 0:Fe.session.id)===p||E.isFetching||Jn.current===p||typeof window>"u")return;Jn.current=p;const b=window,O=()=>{E.refetch()},$=(kt=b.requestIdleCallback)==null?void 0:kt.call(b,O,{timeout:1500}),Se=$===void 0?window.setTimeout(O,320):null;return()=>{var Ve;$!==void 0&&((Ve=b.cancelIdleCallback)==null||Ve.call(b,$)),Se!==null&&window.clearTimeout(Se)}},[Rs,de,(vd=E.data)==null?void 0:vd.session.id,E.isFetching,E.refetch,I,p]),_.useEffect(()=>{Ae(!1)},[H,p]);const sl=_.useCallback(b=>{var O;Ke(b),((O=b.effect)==null?void 0:O.type)==="set_session_model"&&(nn(b.effect.model),b.effect.reasoning_effort&&jn(b.effect.reasoning_effort))},[]),la=ss({mutationFn:async b=>(await _n()).client.sendSessionInput(b),onMutate:async b=>{await j.cancelQueries({queryKey:["timeline",b.sessionId]}),Be(null),Xe(!1),Re(!0),Oe(b.proposedPlanEntryId??null);const O=b.clearComposer!==!1;O&&(fe(""),re([])),pn.current&&window.clearTimeout(pn.current);const $=new Date().toISOString(),Se=`${N_}${b.sessionId}:${Date.now()}`;wn.current=O?{optimisticEntryId:Se,draft:b.input,attachments:b.attachments}:null,j.setQueryData(Lo(b.sessionId),Fe=>w0(Fe,{id:Se,kind:"user",title:"你",body:b.input,body_truncated:!1,detail_available:!1,patch_summary:null,session_ids:[],timestamp:$,accent:"primary",attachments:i5(b.attachments)})),ps(Fe=>lf(Fe,b.sessionId,{run_state:"running",run_state_changed_at:$,last_event_at:$}))},onSuccess:async(b,O)=>{Oe(null),O.proposedPlanEntryId&&me($=>{const Se={...$};return delete Se[O.proposedPlanEntryId],Se}),await j.invalidateQueries({queryKey:rs}),await j.invalidateQueries({queryKey:["plan",O.sessionId]}),await j.invalidateQueries({queryKey:["change-sets",O.sessionId]}),pn.current=null},onError:(b,O)=>{Oe(null),Re(!1);const $=wn.current;$&&(j.setQueryData(Lo(O.sessionId),Se=>DT(Se,$.optimisticEntryId)),fe(Se=>Se||$.draft),re(Se=>Se.length>0?Se:$.attachments),wn.current=null),Be(b instanceof Error?b.message:"无法发送消息")}}),gc=ss({mutationFn:async b=>(await _n()).client.executeSessionCommand(b),onMutate:b=>{Be(null),fe(""),re([]);const O=b.input.slice(1).trim().split(/\s+/)[0]??"",$=new Date().toISOString();Ke({panel_id:`command-panel-pending-${Date.now()}`,session_id:b.sessionId,command_name:O,command_text:b.input,title:`正在执行 /${O}`,description:null,status:"running",body:"命令执行中…",submitted_at:$,updated_at:$,input_type:"none",options:[],input_placeholder:null,submit_label:null,effect:null})},onSuccess:async b=>{sl(b.panel),await j.invalidateQueries({queryKey:rs})},onError:(b,O)=>{Ke(null),fe($=>$||O.input),Be(b instanceof Error?b.message:"无法执行命令")}}),fi=ss({mutationFn:async b=>(await _n()).client.respondToSessionCommand(b),onMutate:()=>{Be(null)},onSuccess:async b=>{sl(b.panel),await j.invalidateQueries({queryKey:rs})},onError:b=>{Be(b instanceof Error?b.message:"无法继续执行命令")}}),td=ss({mutationFn:async b=>(await _n()).client.respondToSessionInteraction(b),onMutate:async b=>{Be(null),Tt(b.requestId),j.setQueryData(["interactions",b.sessionId],O=>(O??[]).map($=>$.id===b.requestId?{...$,status:"submitting",updated_at:new Date().toISOString()}:$))},onSuccess:async(b,O)=>{await j.invalidateQueries({queryKey:["interactions",O.sessionId]})},onError:(b,O)=>{j.setQueryData(["interactions",O.sessionId],$=>($??[]).map(Se=>Se.id===O.requestId?{...Se,status:"pending"}:Se)),Tt(null),Be(b instanceof Error?b.message:"无法提交确认回复")}}),Fa=ss({mutationFn:async b=>(await _n()).client.interruptSession(b),onMutate:async b=>{Be(null),Xe(!0),Re(!1),pn.current&&(window.clearTimeout(pn.current),pn.current=null);const O=new Date().toISOString();ps($=>lf($,b,{run_state:"completed",run_state_changed_at:O,last_event_at:O})),j.setQueryData(["plan",b],null)},onSuccess:(b,O)=>{Xe(!1),j.invalidateQueries({queryKey:rs}),j.invalidateQueries({queryKey:["timeline",O]}),j.invalidateQueries({queryKey:["change-sets",O]})},onError:(b,O)=>{Xe(!1),Re(!0),j.invalidateQueries({queryKey:rs}),j.invalidateQueries({queryKey:["plan",O]}),Be(b instanceof Error?b.message:"无法中断会话")}});_.useEffect(()=>{!p||!de||We||Fa.isPending||Re(de.run_state==="running")},[Fa.isPending,We,de,de==null?void 0:de.run_state,p]);const Kn=ss({mutationFn:async b=>(await xn({sessionId:b.sessionId})).client.updateSession(b)}),al=ss({mutationFn:async b=>(await xn({projectId:b.projectId,agentId:b.agentId})).client.updateThread(b)}),Fs=ss({mutationFn:async b=>(await _n()).client.executeSessionGitAction({sessionId:p,action:b.action,path:b.path,branch:b.branch,message:b.message}),onMutate:async()=>{Us(null)},onSuccess:(b,O)=>{j.setQueryData(["session-git-workspace",p],b.workspace),(O.action==="commit-all"||O.action==="switch-branch")&&j.invalidateQueries({queryKey:["session-git-history",p]})},onError:b=>{Us(b instanceof Error?b.message:"无法执行 git 操作")}}),qa=ss({mutationFn:async b=>(await _n()).client.saveSessionRunCommand({sessionId:p,action:b.action,commandId:b.commandId,command:b.command}),onMutate:()=>{Fn(null)},onSuccess:({catalog:b})=>{j.setQueryData(["session-run-workbench",p],O=>O&&{...O,command_catalog:b})},onError:b=>{Fn(b instanceof Error?b.message:"无法保存项目命令。")}}),Wa=ss({mutationFn:async b=>(await _n()).client.saveSessionRunWebsite({sessionId:p,action:b.action,websiteId:b.websiteId,website:b.website}),onMutate:()=>{Fn(null)},onSuccess:({catalog:b})=>{j.setQueryData(["session-run-workbench",p],O=>O&&{...O,website_catalog:b})},onError:b=>{Fn(b instanceof Error?b.message:"无法保存项目网页。")}}),_c=ss({mutationFn:async()=>(await _n()).client.generateSessionRunCommand({sessionId:p,prompt:"",model:Rm()}),onMutate:()=>{Fn(null),jt(null)},onSuccess:({generation:b,catalog:O})=>{j.setQueryData(["session-run-workbench",p],$=>$&&{...$,command_catalog:O}),jt(b.reason)},onError:b=>{Fn(b instanceof Error?b.message:"无法一键生成项目命令。")}}),yc=ss({mutationFn:async()=>(await _n()).client.generateSessionRunWebsite({sessionId:p,prompt:"",model:Rm()}),onMutate:()=>{Fn(null),Kt(null)},onSuccess:({generation:b,catalog:O})=>{j.setQueryData(["session-run-workbench",p],$=>$&&{...$,website_catalog:O}),Kt(b.reason)},onError:b=>{Fn(b instanceof Error?b.message:"无法一键生成项目网页。")}}),cs=ss({mutationFn:async b=>(await _n()).client.executeSessionTerminalAction({sessionId:p,action:b.action,commandId:b.commandId,terminalId:b.terminalId}),onMutate:()=>{Fn(null)},onSuccess:async(b,O)=>{j.setQueryData(["session-run-workbench",p],$=>$&&{...$,terminal_snapshot:b.snapshot}),(O.action==="run-command"||O.action==="run-kill-command")&&b.terminal&&(te(!1),Qt("terminal"),await pc(b.terminal.id,{force:!0})),O.action==="focus"&&O.terminalId&&await pc(O.terminalId),O.action==="close"&&O.terminalId&&Wn($=>{const Se={...$};return delete Se[O.terminalId],Se})},onError:b=>{Fn(b instanceof Error?b.message:"无法执行终端操作。")}}),vc=Jf.data??[],th=de&&Tg(ia.data)!=="tail"?_A(de):!1,js=_.useMemo(()=>yA(nl,{projectPath:Rs==null?void 0:Rs.path,compactCompletedTurns:th}),[th,Rs==null?void 0:Rs.path,nl]),dr=_.useMemo(()=>jA(js.blocks,vc),[js.blocks,vc]),nd=_.useMemo(()=>{const b=ia.data,O=ym(b),$=Tg(b),Se=Math.max(0,Math.min(Yb,Ms)),Fe=Math.max(0,Math.min(1,Se/kg));return{hasEarlierEntries:O,canLoadEarlierEntries:O||$!=="full_compact",isPulling:ar,pullDistance:Se,isReadyToLoad:Se>=kg,isLoadingFull:Ss,indicatorOffset:Ss?T0:Math.min(T0,Se*.75),indicatorRotation:Ss?Vb:Math.round(Fe*Vb),triggerSource:rr}},[Ss,ar,rr,Ms,ia.data]),il=[...dr].reverse().find(b=>b.kind==="turn"&&!b.turn.completion)??null;_.useEffect(()=>{var Se;if(typeof window>"u")return;const b=window,O=(Se=b.requestIdleCallback)==null?void 0:Se.call(b,()=>{M0()},{timeout:1500}),$=O===void 0?window.setTimeout(()=>{M0()},320):null;return()=>{var Fe;O!==void 0&&((Fe=b.cancelIdleCallback)==null||Fe.call(b,O)),$!==null&&window.clearTimeout($)}},[]);const fo=!!(de&&Rs),nh=!!p&&E.isPending&&!de;de??(de=bR),Rs??(Rs=yR);const bc=!!p&&Ge.sessionId!==p,sh=!!p&&!fo&&(Ge.pending||bc||nh),rl=sh?"正在载入会话…":E.error instanceof Error?E.error.message:Ge.error?Ge.error:"没有找到这个会话。",ho=de.capability.can_send_input&&!We,fr=ho&&(a===void 0||a==="online"),ll=(ed.data??[]).filter(b=>b.status==="pending"||b.status==="submitting"),sd=(de.run_state==="running"||Me)&&!We||Fa.isPending,Ka=ho&&ll.length===0&&!sd&&!la.isPending,Oi=(on==null?void 0:on.id)??de.agent_id,xc=_.useCallback((b,O)=>{me($=>{if(!O.trim()){if(!(b in $))return $;const Se={...$};return delete Se[b],Se}return{...$,[b]:O}})},[]),ad=_.useCallback((b,O)=>{const $=O.trim();!$||!Ka||la.mutate({sessionId:de.id,input:$,attachments:[],model:tt,reasoningEffort:Xt,serviceTier:zt?"fast":void 0,planMode:_t,yoloMode:dt,clearComposer:!1,proposedPlanEntryId:b})},[Ka,zt,_t,dt,tt,Xt,la,de.id]),hr=_.useMemo(()=>i.jsx(EA,{sessionId:de.id,sessions:or,sessionRunState:de.run_state,isDesktopSidebar:l?!!o:H,projectPath:Rs.path,renderedBlocks:dr,lastToolGroupId:js.lastToolGroupId,sessionChangeSets:vc,isSubagentTimelinePending:eh,isInitialTimelinePending:!!p&&nl.length===0&&(Ge.pending||bc),hasTimeline:nl.length>0,proposedPlanReplyDrafts:Z,pendingProposedPlanReplyEntryId:Ce,canRespondToProposedPlan:Ka,onProposedPlanReplyDraftChange:xc,onSubmitProposedPlanReply:ad,onPreviewImage:ve,changeSetDiffs:Ti,changeSetDiffErrors:tr,loadingChangeSetDiffKeys:sr,onLoadSessionChangeSets:Zf,onLoadChangeSetFileDiff:Xf,onLoadFullTimeline:()=>{hc()},timelineLoadState:nd},de.id),[Ka,tr,Ti,xc,ad,l,H,o,eh,Zf,Xf,hc,sr,Ce,Rs.path,Z,dr,js.lastToolGroupId,de.id,de.run_state,vc,or,nl.length,nd]),Ii=_.useCallback(async(b,O,$)=>{var Se;Be(null),Ae(!1),O==="pin"||O==="unpin"?ki.flushSync(()=>{ps(Fe=>rp(Fe,b,{pinned:O==="pin"}))}):O==="rename"&&($!=null&&$.trim())&&ps(Fe=>rp(Fe,b,{title:$.trim()}));try{const Fe=await Kn.mutateAsync({sessionId:b,action:O,name:$}),kt=(Se=Fe.affectedSessionIds)!=null&&Se.length?Fe.affectedSessionIds:[b];if(O==="delete"){ps(Ve=>J6(Ve,kt)),G();for(const Ve of kt)j.removeQueries({queryKey:["timeline",Ve],exact:!0}),j.removeQueries({queryKey:Lo(Ve),exact:!0}),j.removeQueries({queryKey:["change-sets",Ve],exact:!0}),Di(Ve)}else ps(Ve=>X6(Ve,kt,{...O==="rename"&&($!=null&&$.trim())?{title:$.trim()}:{pinned:O==="pin"}}));if(b===de.id&&O==="delete"){const Ve=Fe.nextSessionId;Ve?await Zr(Ve):await Xr()}}catch(Fe){j.invalidateQueries({queryKey:rs}),Be(Fe instanceof Error?Fe.message:"无法更新会话")}},[Xr,Zr,j,G,Di,de.id,Kn]),ah=_.useCallback(async(b,O,$)=>{var Fe,kt;Be(null),Ae(!1);const Se=(Fe=$==null?void 0:$.name)==null?void 0:Fe.trim();O==="pin"||O==="unpin"?ki.flushSync(()=>{ps(Ve=>fu(Ve,b,{pinned:O==="pin"}))}):O==="rename"&&Se?ps(Ve=>fu(Ve,b,{display_name:Se})):O==="reorder"&&((kt=$==null?void 0:$.orderedProjectIds)!=null&&kt.length)?ps(Ve=>lp(Ve,$.orderedProjectIds??[])):O==="remove"||O==="archive"?(ps(Ve=>op(Ve,b)),G()):O==="unarchive"&&(G(),j.invalidateQueries({queryKey:rs}));try{const Ve=await al.mutateAsync({projectId:b,agentId:(on==null?void 0:on.id)??de.agent_id,action:O,name:$==null?void 0:$.name,orderedProjectIds:$==null?void 0:$.orderedProjectIds});if(O==="remove"||O==="archive"||O==="unarchive"){const un=Ve.nextSessionId;un?await Zr(un):await Xr()}}catch(Ve){j.invalidateQueries({queryKey:rs}),Be(Ve instanceof Error?Ve.message:"无法更新线程")}},[Xr,Zr,j,G,al]),ih=_.useCallback(async b=>{Oi&&(Zi(Oi),na(null),Wr(null),uu(b),await N({to:"/"}))},[Oi,N]),Tp=((xr=ra.data)==null?void 0:xr.steps.some(b=>b.status==="pending"||b.status==="in_progress"))??!1,rh=de.run_state==="running"||Me,Mp=!!((gl=ra.data)!=null&&gl.updated_at&&Date.now()-new Date(ra.data.updated_at).getTime()<=dR),lh=ra.data&&(Tp||rh&&Mp)?ra.data:null,oa=de.context_usage,Sc=oa?Math.round(oa.percent_used):0,ka=Math.max(0,100-Sc),jc=oa?{"--usage-progress":`${Math.max(0,Math.min(100,oa.percent_used))}%`}:void 0,ca=Le.state==="connected"&&mt.state==="idle"&&rh&&!We&&!Fa.isPending&&!(il!=null&&il.turn.completion),ol=!!bn||Ju.length>0;_.useEffect(()=>{p&&(xs.current+=1,ot({state:"idle"}))},[p]),_.useEffect(()=>{if(!Je)return;(ed.data??[]).some(O=>O.id===Je&&O.status==="submitting")||Tt(null)},[ed.data,Je]),_.useEffect(()=>{var b;!p||!fo||de.run_state==="running"||la.isPending||Fa.isPending||il||(b=ra.data)!=null&&b.is_active||(pn.current&&(window.clearTimeout(pn.current),pn.current=null),Re(!1))},[il,fo,Fa.isPending,(So=ra.data)==null?void 0:So.is_active,la.isPending,de,de==null?void 0:de.run_state,p]);const Js=H?0:wA(),wc=H||ye,mo=H?0:Wt??(ye?Js:0),id=qe&&typeof document<"u"?ki.createPortal(i.jsxs("div",{className:"sheet-wrap sheet-wrap--centered",role:"dialog","aria-modal":"true",children:[i.jsx("button",{type:"button",className:"sheet-wrap__scrim",onClick:()=>{bt(!1),ce(de.title)},"aria-label":"关闭重命名会话面板"}),i.jsx("div",{className:"sheet-wrap__center",children:i.jsxs("div",{className:"sheet-panel sheet-panel--form sheet-panel--centered",children:[i.jsx("div",{className:"sheet-panel__title",children:"重命名会话"}),i.jsx("input",{className:"sheet-panel__input",value:At,onChange:b=>ce(b.target.value),placeholder:"输入会话名称",autoFocus:!0}),i.jsxs("div",{className:"sheet-panel__actions",children:[i.jsx("button",{type:"button",className:"sheet-panel__button",onClick:()=>{bt(!1),ce(de.title)},children:"取消"}),i.jsx("button",{type:"button",className:"sheet-panel__button is-primary",disabled:!At.trim()||Kn.isPending&&((_l=Kn.variables)==null?void 0:_l.sessionId)===de.id,onClick:()=>{Ii(de.id,"rename",At.trim()),bt(!1)},children:"保存"})]})]})})]}),document.body):null,mr=!(l?o:H)&&le&&typeof document<"u"?ki.createPortal(i.jsxs("div",{className:"picker-sheet-wrap",role:"dialog","aria-modal":"true",children:[i.jsx("button",{type:"button",className:"picker-sheet__scrim",onClick:()=>Ae(!1),"aria-label":"关闭会话操作菜单"}),i.jsxs("div",{className:"picker-sheet",children:[i.jsx("div",{className:"picker-sheet__header",children:i.jsx("strong",{children:de.title})}),i.jsxs("div",{className:"picker-sheet__list",children:[i.jsx("button",{type:"button",className:"picker-sheet__item",disabled:Kn.isPending&&((jo=Kn.variables)==null?void 0:jo.sessionId)===de.id,onClick:()=>void Ii(de.id,de.pinned?"unpin":"pin"),children:i.jsx("span",{children:de.pinned?"取消置顶会话":"置顶会话"})}),i.jsx("button",{type:"button",className:"picker-sheet__item",disabled:Kn.isPending&&((bd=Kn.variables)==null?void 0:bd.sessionId)===de.id,onClick:()=>{Ae(!1),bt(!0)},children:i.jsx("span",{children:"重命名会话"})}),i.jsx("button",{type:"button",className:"picker-sheet__item is-danger",disabled:Kn.isPending&&((Hi=Kn.variables)==null?void 0:Hi.sessionId)===de.id,onClick:()=>void Ii(de.id,"delete"),children:i.jsx("span",{children:"删除会话"})})]})]})]}),document.body):null,oh=H?1:Js>0?mo/Js:0,po=!H&&Wt!==null,cl=H?{"--desktop-sidebar-width":`${oe}px`}:void 0,As=l?!!o:H,Ds=l?u:mo,go=l?f:po,hi=Fs.isPending?Fs.variables??null:null,ch=Ua??(cr.error instanceof Error?cr.error.message:null),Nc=Na.error instanceof Error?Na.error.message:null,Qa=Ci??(ur.error instanceof Error?ur.error.message:null),qs=ur.data??null,Ea=(qs==null?void 0:qs.terminal_snapshot)??null,mi=(qs==null?void 0:qs.command_catalog.commands)??[],rd=(qs==null?void 0:qs.website_catalog.websites)??[],Ws=dp(Rm(),ke),Li=(Ea==null?void 0:Ea.terminals.find(b=>b.id===Ea.active_terminal_id))??(Ea==null?void 0:Ea.terminals[0])??null,pi=wa&&De==="terminal",ul=ui&&De==="git",Ca=As&&pi&&On,ua=ul&&As,ws=(pi||ul)&&As&&!Ca,Pi=(pi||ul)&&!As,Ta=cs.isPending&&((xd=cs.variables)==null?void 0:xd.action)==="run-command"?cs.variables.commandId??null:null,Ga=cs.isPending&&((vi=cs.variables)==null?void 0:vi.action)==="run-kill-command"?cs.variables.commandId??null:null,Ya=qa.isPending&&((Rc=qa.variables)==null?void 0:Rc.action)==="delete"?qa.variables.commandId??null:null,ld=Wa.isPending&&((Ac=Wa.variables)==null?void 0:Ac.action)==="delete"?Wa.variables.websiteId??null:null;_.useEffect(()=>{!As&&On&&Ts(!1)},[On,As]);const Va=b=>{Gu.current=b,ls(b)},kc=(b,O,$)=>(es.current={mode:ye?"close":"open",startX:b,startY:O,axis:"pending",pointerId:$},!0),od=(b,O)=>{const $=es.current;if(!$)return!1;const Se=b-$.startX,Fe=O-$.startY;if($.axis==="pending"){if(Math.abs(Se)<8&&Math.abs(Fe)<8)return!1;if($.axis=Math.abs(Se)>Math.abs(Fe)?"x":"y",$.axis==="y")return es.current=null,Va(null),!1}const kt=$.mode==="open"?Math.max(0,Math.min(Js,Se)):Math.max(0,Math.min(Js,Js+Se));return Va(kt),!0},us=(b,O)=>{const $=es.current;if(!$)return;const Se=b-$.startX,Fe=O-$.startY;if($.axis==="pending"&&Math.abs(Fe)>48){es.current=null,Va(null);return}const Ve=($.axis==="x"?Gu.current??($.mode==="open"?Math.max(0,Math.min(Js,Se)):Math.max(0,Math.min(Js,Js+Se))):ye?Js:0)>=Js*oR;R(Ve),es.current=null,Va(null)},Tn=_.useCallback(()=>{if(l){m==null||m();return}R(!0)},[l,m]),Gt=_.useCallback(()=>{In(b=>!b)},[]),Ui=_.useCallback(()=>{Be(null)},[]),da=_.useCallback(()=>{Dn(b=>!b)},[]),cd=_.useCallback(b=>{Zr(b)},[Zr]),gi=_.useCallback(b=>{const O=new Date().toISOString();if(ke.length===0){Ke({panel_id:`${Eg}${Date.now()}`,session_id:de.id,command_name:"model",command_text:b,title:"选择模型",description:"选择后会更新当前会话后续发送时使用的模型。",status:"completed",body:"当前没有可选模型,请先去设置页维护模型列表。",submitted_at:O,updated_at:O,input_type:"none",options:[],input_placeholder:null,submit_label:null,effect:null});return}Ke({panel_id:`${Eg}${Date.now()}`,session_id:de.id,command_name:"model",command_text:b,title:"选择模型",description:"选择后会更新当前会话后续发送时使用的模型。",status:"awaiting_input",body:"在下面选择一个模型。",submitted_at:O,updated_at:O,input_type:"choice",options:ke.map($=>({id:$.value,label:$.label,description:$.description??null})),input_placeholder:null,submit_label:null,effect:null})},[ke,de.id]),uh=_.useCallback(()=>{if(fr){if(C_(_e)){if(Te.length>0){Be("命令暂不支持附件,请先移除附件后再执行。");return}if(HR(_e)==="model"){Be(null),fe(""),gi(_e);return}gc.mutate({sessionId:de.id,input:_e});return}la.mutate({sessionId:de.id,input:_e.trim(),attachments:Te,model:tt,reasoningEffort:Xt,serviceTier:zt?"fast":void 0,planMode:_t,yoloMode:dt})}},[fr,_e,zt,_t,dt,gc,gi,Te,tt,Xt,la,de.id]),dh=_.useCallback(()=>{Ke(null)},[]),dl=_.useCallback(b=>{if(St){if(St.panel_id.startsWith(Eg)){nn(b),Ke(O=>O&&{...O,status:"completed",body:`后续消息将优先使用 ${dp(b,ke)}。`,updated_at:new Date().toISOString(),input_type:"none",options:[]});return}fi.mutate({sessionId:de.id,panelId:St.panel_id,optionId:b})}},[St,fi,ke,de.id]),pr=_.useCallback(b=>{St&&fi.mutate({sessionId:de.id,panelId:St.panel_id,text:b})},[St,fi,de.id]),ud=_.useCallback(b=>{td.mutate({sessionId:de.id,requestId:b.requestId,optionId:b.optionId??null,text:b.text??null,answers:b.answers})},[td,de.id]),_o=_.useCallback(b=>{const O=[...b];O.length!==0&&(Be(null),Promise.all(O.map($=>a5($))).then($=>{re(Se=>[...Se,...$])}).catch($=>{Be($ instanceof Error?$.message:"无法读取附件")}))},[]),dd=_.useCallback(b=>{re(O=>O.filter($=>$.id!==b))},[]),gr=_.useCallback(()=>{Fa.isPending||We||Fa.mutate(de.id)},[Fa,We,de.id]),_i=_.useCallback(()=>{Un(b=>!b)},[]),ea=_.useCallback(b=>{b==="git"&&!ui||b==="terminal"&&!wa||(Us(null),Fn(null),te(!1),$e(!1),Ts(!1),Qt(b))},[ui,wa]);_.useEffect(()=>{if(!ws)return;const b=O=>{var Se,Fe;const $=O.target;$ instanceof Node&&((Se=ne.current)!=null&&Se.contains($)||(Fe=V.current)!=null&&Fe.contains($)||ea("code"))};return window.addEventListener("pointerdown",b),()=>{window.removeEventListener("pointerdown",b)}},[ea,ws]);const yi=_.useCallback(()=>{Us(null),cr.refetch()},[cr]),fd=_.useCallback(()=>{Na.refetch()},[Na]),hd=_.useCallback(()=>{Na.data||Na.isFetching||Na.refetch()},[Na]),fl=_.useCallback(b=>{Fs.mutate({action:"discard-file",path:b})},[Fs]),Ec=_.useCallback(()=>{Fs.mutate({action:"discard-all"})},[Fs]),_r=_.useCallback(b=>{Fs.mutate({action:"commit-all",message:b})},[Fs]),gs=_.useCallback(async(b,O)=>{Us(null);const $=(O==null?void 0:O.trim())??"";$&&await Fs.mutateAsync({action:"commit-all",message:$}),await Fs.mutateAsync({action:"switch-branch",branch:b})},[Fs]),Cc=_.useCallback(()=>{Fs.mutate({action:"push"})},[Fs]),fh=_.useCallback(async(b,O,$)=>(await _n()).client.getSessionGitHistoryFileDiff(de.id,{commitOid:b,path:O,previousPath:$}),[_n,de.id]),Rp=_.useCallback(async(b,O)=>(await _n()).client.getSessionGitWorkspaceFileDiff(de.id,{path:b,previousPath:O}),[_n,de.id]),hh=_.useCallback(b=>{cs.mutate({action:"run-command",commandId:b})},[cs]),mh=_.useCallback(async()=>{if(!(mi.length===0||at||ft)){Ut(!0);try{for(const b of mi)await cs.mutateAsync({action:"run-command",commandId:b.id})}finally{Ut(!1)}}},[at,ft,mi,cs]),Vn=_.useCallback(async()=>{if(at||ft)return;const b=mi.filter(O=>!!O.kill_command);if(b.length!==0){Mt(!0);try{for(const O of b)await cs.mutateAsync({action:"run-kill-command",commandId:O.id})}finally{Mt(!1)}}},[at,ft,mi,cs]),md=_.useCallback(b=>{cs.mutate({action:"run-kill-command",commandId:b})},[cs]),hl=_.useCallback(b=>{qa.mutate({action:b.commandId?"update":"create",commandId:b.commandId,command:b.draft})},[qa]),ml=_.useCallback(b=>{qa.mutate({action:"delete",commandId:b})},[qa]),Tc=_.useCallback(()=>{_c.mutate()},[_c]),yr=_.useCallback(b=>{Wa.mutate({action:b.websiteId?"update":"create",websiteId:b.websiteId,website:b.draft})},[Wa]),vr=_.useCallback(b=>{Wa.mutate({action:"delete",websiteId:b})},[Wa]),ph=_.useCallback(()=>{yc.mutate()},[yc]),pd=_.useCallback(()=>{$e(!1)},[]),Ap=_.useCallback(b=>{cs.mutate({action:"focus",terminalId:b}),Qt("terminal")},[cs]),gh=_.useCallback(b=>{cs.mutate({action:"close",terminalId:b})},[cs]),br=_.useCallback(()=>{!As||!wa||(Qt("terminal"),Ts(b=>!b))},[wa,As]),Mc=_.useMemo(()=>{var b,O,$;return i.jsxs("div",{className:"conversation-topbar__title-actions",children:[i.jsx("button",{type:"button",className:"conversation-topbar__more",onClick:()=>Ae(Se=>!Se),"aria-label":"更多会话选项",children:i.jsx(jR,{})}),le&&As?i.jsxs("div",{className:"topbar-menu",role:"menu",children:[i.jsx("button",{type:"button",className:"topbar-menu__item",disabled:Kn.isPending&&((b=Kn.variables)==null?void 0:b.sessionId)===de.id,onClick:()=>void Ii(de.id,de.pinned?"unpin":"pin"),children:de.pinned?"取消置顶会话":"置顶会话"}),i.jsx("button",{type:"button",className:"topbar-menu__item",disabled:Kn.isPending&&((O=Kn.variables)==null?void 0:O.sessionId)===de.id,onClick:()=>{Ae(!1),bt(!0)},children:"重命名会话"}),i.jsx("button",{type:"button",className:"topbar-menu__item is-danger",disabled:Kn.isPending&&(($=Kn.variables)==null?void 0:$.sessionId)===de.id,onClick:()=>void Ii(de.id,"delete"),children:"删除会话"})]}):null]})},[Ii,le,As,de.id,de.pinned,Kn.isPending,(bi=Kn.variables)==null?void 0:bi.sessionId]),yo=_.useMemo(()=>wa||ui?i.jsxs("div",{className:"conversation-topbar__actions",children:[wa?i.jsxs("div",{className:"conversation-topbar__run-group",children:[i.jsx("button",{type:"button",className:`conversation-topbar__run-button ${Ys?"is-active":""}`,onClick:()=>{$e(!1),te(b=>!b)},"aria-expanded":Ys,"aria-haspopup":"dialog","aria-label":"打开项目命令列表",children:i.jsx(MR,{})}),Ys?i.jsx("div",{className:"conversation-run-popover",role:"dialog","aria-label":"项目命令列表",children:i.jsx(qM,{commands:mi,nodeRuntime:(qs==null?void 0:qs.node_runtime)??null,error:Qa,pendingRunCommandId:Ta,pendingKillCommandId:Ga,pendingDeleteCommandId:Ya,isSaving:qa.isPending,isGenerating:_c.isPending,isStartingAll:at,isStoppingAll:ft,generationReason:qn,executionModelLabel:Ws,onRun:hh,onRunAll:mh,onRunAllKill:Vn,onRunKill:md,onSave:hl,onDelete:ml,onGenerate:Tc})}):null]}):null,wa?i.jsxs("div",{className:"conversation-topbar__run-group",children:[i.jsx("button",{type:"button",className:`conversation-topbar__run-button ${Ie?"is-active":""}`,onClick:()=>{te(!1),$e(b=>!b)},"aria-expanded":Ie,"aria-haspopup":"dialog","aria-label":"打开项目网页列表",children:i.jsx(RR,{})}),Ie?i.jsx("div",{className:"conversation-run-popover",role:"dialog","aria-label":"项目网页列表",children:i.jsx(VM,{websites:rd,error:Qa,pendingDeleteWebsiteId:ld,isSaving:Wa.isPending,isGenerating:yc.isPending,generationReason:zs,executionModelLabel:Ws,onOpen:pd,onSave:yr,onDelete:vr,onGenerate:ph})}):null]}):null,wa||ui?i.jsxs("div",{ref:V,className:"conversation-topbar__view-toggle","aria-label":"切换工作台面板",children:[i.jsx("button",{type:"button",className:`conversation-topbar__view-button ${De==="code"?"is-active":""}`,onClick:()=>ea("code"),"aria-pressed":De==="code","aria-label":"切换到代码会话视图",children:i.jsx(ER,{})}),wa?i.jsx("button",{type:"button",className:`conversation-topbar__view-button ${De==="terminal"?"is-active":""}`,onClick:()=>ea("terminal"),"aria-pressed":De==="terminal","aria-label":"切换到终端视图",children:i.jsx(TR,{})}):null,ui?i.jsx("button",{type:"button",className:`conversation-topbar__view-button ${De==="git"?"is-active":""}`,onClick:()=>ea("git"),"aria-pressed":De==="git","aria-label":"切换到 git 视图",children:i.jsx(CR,{})}):null]}):null]}):null,[De,ui,wa,qn,zs,at,ft,Ws,_c.isPending,yc.isPending,ml,Tc,vr,ph,pd,hh,mh,Vn,hl,yr,ea,Ys,Ie,Ya,ld,Ta,mi,rd,Qa,qa.isPending,Wa.isPending]),_h=i.jsx(zM,{workspace:cr.data??null,history:Na.data??null,isLoading:cr.isPending,isHistoryLoading:Na.isFetching,error:ch,historyError:Nc,onRefresh:yi,onRefreshHistory:fd,onRequestHistory:hd,onDiscardFile:fl,onDiscardAll:Ec,onCommitAll:_r,onSwitchBranch:gs,onPush:Cc,onLoadWorkspaceFileDiff:Rp,onLoadHistoryFileDiff:fh,pendingAction:hi,compact:ua}),pl=i.jsx(iR,{terminals:(Ea==null?void 0:Ea.terminals)??[],activeTerminalId:(Li==null?void 0:Li.id)??null,outputs:bs,error:Qa,compact:ws||Ca,canToggleFullscreen:As,isFullscreen:Ca,onSelectTerminal:Ap,onCloseTerminal:gh,onToggleFullscreen:br}),gd=i.jsx(c5,{isDesktopSidebar:As,sidebarShift:Ds,isSidebarDragging:go,composerError:ze,onDismissComposerError:Ui,interactionRequests:ll,pendingInteractionRequestId:Je,onRespondInteraction:ud,parentSession:bn,backgroundAgentSessions:Ju,isBackgroundAgentsOpen:Cn,planSnapshot:lh,onToggleBackgroundAgents:da,onOpenSession:cd,getBackgroundAgentStatusLabel:nA,getBackgroundAgentAccent:JR,formatBackgroundAgentsLabel:GR,hasBackgroundAgentStrip:ol,commandPanel:St,isCommandPanelPending:gc.isPending||fi.isPending,onDismissCommandPanel:dh,onCommandPanelOptionSelect:dl,onCommandPanelTextSubmit:pr,projectId:de.project_id,agentId:(on==null?void 0:on.id)??de.agent_id,draft:_e,pendingAttachments:Te,canSendInput:ho,canSubmitInput:fr,isInputLocked:ll.length>0,readOnlyPlaceholder:ll.length>0?"请先处理上方确认请求":void 0,onDraftChange:fe,onUploadFiles:_o,onRemoveAttachment:dd,onSubmit:uh,showStopIcon:sd,isSendPending:la.isPending||gc.isPending||fi.isPending,onInterrupt:gr,isFastModeEnabled:zt,isPlanModeEnabled:_t,isYoloModeEnabled:dt,onToggleFastMode:()=>Bt(b=>!b),onTogglePlanMode:()=>vt(b=>!b),onToggleYoloMode:()=>cn(b=>!b),showModeBadges:!0,selectedModel:tt,modelOptions:ke,selectedReasoning:Xt,onSelectModel:nn,onSelectReasoning:b=>jn(b),contextUsage:oa,isContextUsageOpen:Nt,onToggleContextUsage:_i,contextUsageRingStyle:jc,usedPercent:Sc,remainingPercent:ka,usedTokensLabel:Xb((oa==null?void 0:oa.used_tokens)??0),totalTokensLabel:Xb((oa==null?void 0:oa.total_tokens)??0),showJumpToBottom:P,onJumpToBottom:dc}),vo=pi?pl:_h,bo=Pi||Ca,_d=bo?i.jsxs("div",{ref:Y,className:`conversation-main ${As?"has-desktop-sidebar":""} ${Ca?"is-terminal-fullscreen":""}`,style:{transform:`translateX(${Ds}px)`,transition:go?"none":void 0},children:[i.jsxs("div",{className:"conversation-topbar",children:[As?null:i.jsxs("button",{type:"button",className:"conversation-menu",onClick:Tn,"aria-label":"打开侧边栏",children:[i.jsx("span",{}),i.jsx("span",{className:"short"})]}),i.jsx("div",{className:"conversation-topbar__meta",children:i.jsxs("div",{className:"conversation-topbar__title-row",children:[i.jsx("h1",{children:de.title}),Mc]})}),yo]}),i.jsx("div",{ref:pe,className:`conversation-scroll ${bo?"conversation-scroll--workbench":""}`,children:i.jsx("div",{className:`session-workbench-surface ${Ca?"is-terminal-fullscreen":""}`,children:vo})})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:`session-detail-workspace ${ws?"has-workbench-panel":""}`,children:[i.jsx(rR,{conversationMainRef:Y,conversationScrollRef:pe,isDesktopSidebar:As,sidebarShift:Ds,isSidebarDragging:go,title:de.title,titleActions:Mc,topbarActions:yo,onOpenSidebar:Tn,threadContent:hr,connectionStatus:Le,sessionRecoveryStatus:mt,isConnectionDetailOpen:as,onToggleConnectionDetail:Gt,showThinkingStatus:ca}),ws?i.jsx("aside",{ref:ne,className:"session-workbench-rail",children:vo}):null]}),Ca?null:gd]}),xo=i.jsxs(i.Fragment,{children:[id,mr,we&&typeof document<"u"?ki.createPortal(i.jsxs("div",{className:"attachment-lightbox",role:"dialog","aria-modal":"true","aria-label":`预览 ${we.label}`,children:[i.jsx("button",{type:"button",className:"attachment-lightbox__scrim",onClick:()=>ve(null),"aria-label":"关闭图片预览"}),i.jsxs("div",{className:"attachment-lightbox__panel",children:[i.jsx("button",{type:"button",className:"attachment-lightbox__close",onClick:()=>ve(null),"aria-label":"关闭图片预览",children:i.jsx(kR,{})}),i.jsx("div",{className:"attachment-lightbox__frame",children:i.jsx("img",{src:we.src,alt:we.label,className:"attachment-lightbox__image"})}),i.jsxs("div",{className:"attachment-lightbox__meta",children:[i.jsx("div",{className:"attachment-lightbox__title",children:we.label}),i.jsx("div",{className:"attachment-lightbox__hint",children:we.meta})]})]})]}),document.body):null]});if(!fo){const b=i.jsx("div",{className:"conversation-main conversation-main--empty",children:sh?i.jsxs("div",{className:"empty-panel empty-panel--loading",role:"status","aria-live":"polite","aria-busy":"true",children:[i.jsxs("span",{className:"empty-panel__loading-dots","aria-hidden":"true",children:[i.jsx("span",{className:"empty-panel__loading-dot"}),i.jsx("span",{className:"empty-panel__loading-dot"}),i.jsx("span",{className:"empty-panel__loading-dot"})]}),i.jsx("span",{className:"sr-only",children:"正在加载会话"})]}):i.jsx("div",{className:"empty-panel",children:rl})});return l?i.jsxs(i.Fragment,{children:[b,xo]}):i.jsxs("div",{className:"conversation-page",children:[b,xo]})}return l?i.jsxs(i.Fragment,{children:[_d,xo]}):i.jsxs("div",{ref:Q,className:`conversation-page ${H?"has-desktop-sidebar":""}`,style:cl,onPointerDown:b=>{H||b.pointerType!=="touch"&&(b.pointerType==="mouse"&&b.button!==0||Gf(b.target)||(kc(b.clientX,b.clientY,b.pointerId),b.currentTarget.setPointerCapture(b.pointerId)))},onPointerMove:b=>{if(H||b.pointerType==="touch")return;const O=es.current;!O||O.pointerId!==b.pointerId||!od(b.clientX,b.clientY)||b.preventDefault()},onPointerUp:b=>{if(H||b.pointerType==="touch")return;const O=es.current;!O||O.pointerId!==b.pointerId||us(b.clientX,b.clientY)},onPointerCancel:b=>{if(H||b.pointerType==="touch")return;const O=es.current;!O||O.pointerId!==b.pointerId||(es.current=null,Va(null))},children:[i.jsx(e5,{open:wc,progress:oh,isDragging:po,desktopPinned:H,isDesktopResizing:k,onClose:()=>{H||(R(!1),Va(null))},onDesktopResizeStart:b=>{oo.current=ci.current,Vr.current={startX:b,startWidth:ci.current},K(!0)},currentAgent:on??void 0,agentIndicatorState:on?a??(on.status==="online"?"online":"offline"):void 0,projects:kp,sessions:or,projectStats:Vu,historySessionsByProject:Object.fromEntries(Object.entries(L).map(([b,O])=>[b,O.sessions])),archivedSessionsByProject:Object.fromEntries(Object.entries(W).map(([b,O])=>[b,O.sessions])),historyPageStateByProject:L,archivedPageStateByProject:W,activeSessionId:de.id,onCreateSession:b=>{ih(b)},onSessionAction:Ii,onThreadAction:ah,onLoadMoreHistory:b=>{ee(b)},onLoadMoreArchived:b=>{F(b)},pendingSessionActionId:Kn.isPending?((xi=Kn.variables)==null?void 0:xi.sessionId)??null:null,pendingThreadActionId:al.isPending?((yl=al.variables)==null?void 0:yl.projectId)??null:null}),_d,xo]})},TA=({mode:e,agentName:t,agentStatus:a,onOpenNodes:l,onCreateThread:o})=>{if(e==="node")return i.jsxs("section",{className:"session-empty-state is-node-mode",children:[i.jsx("div",{className:"session-empty-state__eyebrow",children:"Panda Workspace"}),i.jsx("div",{className:"session-empty-state__actions",children:i.jsx("button",{type:"button",className:"session-empty-state__button is-primary",onClick:l,children:"选择节点"})})]});const u=a==="online";return i.jsxs("section",{className:"session-empty-state is-session-mode",children:[i.jsxs("div",{className:"session-empty-state__status-row",children:[i.jsx("span",{className:`session-empty-state__status-dot is-${u?"online":"offline"}`,"aria-hidden":"true"}),i.jsxs("div",{className:"session-empty-state__eyebrow",children:["节点 · ",t??"当前节点"]})]}),i.jsxs("div",{className:"session-empty-state__actions",children:[o?i.jsx("button",{type:"button",className:"session-empty-state__button is-primary",onClick:o,children:"新建会话"}):null,i.jsx("button",{type:"button",className:"session-empty-state__button",onClick:l,children:"切换节点"})]})]})},s2=1100,C5="panda:desktop-sidebar-width",df="panda:desktop-sidebar-width-version",ff="2026-03-24-narrow",MA=300,T5=232,nu=T5,RA=460,a2=.4,AA=56,DA=160,i2=5,r2=e=>{const t=new Date((e==null?void 0:e.generated_at)??"").getTime();return Number.isFinite(t)?t:0},OA=(e,t)=>{var l;if(!t)return;let a;for(const[,o]of e)!o||!(((l=o.agent)==null?void 0:l.id)===t||o.projects.some(f=>f.agent_id===t)||o.sessions.some(f=>f.agent_id===t))||(!a||r2(o)>r2(a))&&(a=o);return a},IA=()=>typeof window>"u"?248:Math.max(0,Math.min(248,window.innerWidth-84)),D0=e=>Math.max(T5,Math.min(RA,e)),LA=()=>{if(typeof window>"u")return nu;try{const e=window.localStorage.getItem(C5),t=window.localStorage.getItem(df);if(!e)return window.localStorage.setItem(df,ff),nu;const a=Number(e);if(!Number.isFinite(a))return window.localStorage.setItem(df,ff),nu;const o=t!==ff||a===MA||a>nu?nu:a;return window.localStorage.setItem(df,ff),D0(o)}catch{return nu}},M5=()=>{var Fn,Ys;const e=xa(te=>te.openSettingsOverlay),{agentId:t}=$u({strict:!1}),a=Ei(),l=La(),o=_.useRef(null),[u,f]=_.useState(()=>cc()),[m,y]=_.useState(()=>ZN()??tp()),[g,S]=_.useState(()=>XN()),[p,v]=_.useState(()=>JN()?"directory-picker":"composer"),[w,N]=_.useState(!1),[j,T]=_.useState(()=>typeof window<"u"&&window.innerWidth>=s2),[A,U]=_.useState(()=>LA()),[I,E]=_.useState(!1),[L,W]=_.useState({state:"connected",attempt:0,maxAttempts:i2}),[ee,F]=_.useState(null),G=_.useRef(null),Q=_.useRef(null),Y=_.useRef(null),pe=_.useRef(null),ne=_.useRef(A),V=_.useRef(null),ye=_.useRef(null),R=_.useRef(null),H=_.useRef(0),X=_.useRef(null),oe=_.useRef(!1),ie=_.useRef(!1),k=_.useRef(!1),K=_.useRef(null),_e=_.useRef(null),fe=t??u??null,Te=fe?{agentId:fe}:void 0,we=l.getQueryData(y0({scope:Te}))??OA(l.getQueriesData({queryKey:rs}),fe),ve=m&&!(we!=null&&we.sessions.some(te=>te.id===m))?m:null,ze=_.useRef({agentId:fe,selectedSessionIdHint:ve});Bf(fe);const Be=w_({enabled:!1}),St=Be.data,Ke=V3({scope:Te,selectedSessionId:ve,enabled:!!fe}),tt=Ke.data??we,{historyState:nn,archivedState:Xt,loadMoreHistory:jn,loadMoreArchived:zt,reset:Bt}=X3({scope:Te,selectedSessionId:m??null}),_t=[...Object.values(nn).flatMap(te=>te.sessions),...Object.values(Xt).flatMap(te=>te.sessions)];_.useEffect(()=>{t&&(f(t),Zi(t),y(null))},[t]),_.useEffect(()=>{tt&&(f(te=>{var Ie;return te&&(((Ie=tt.agent)==null?void 0:Ie.id)===te||St!=null&&St.agents.some($e=>$e.id===te))?te:null}),y(te=>te&&(tt.sessions.some(Ie=>Ie.id===te)||_t.some(Ie=>Ie.id===te)||Ke.isPending||Ke.isFetching||Ke.isError)?te:null))},[St==null?void 0:St.agents,_t,tt,Ke.isError,Ke.isFetching,Ke.isPending]),_.useEffect(()=>{t||u||(T6(),a({to:"/nodes",replace:!0}))},[a,t,u]),_.useEffect(()=>{if(!tt||t||!u||m)return;const te=tp(),Ie=tt.sessions.find($e=>$e.id===te)??null;Ie&&(y(Ie.id),na(Ie.id))},[t,u,m,tt]);const vt=(fe?(St==null?void 0:St.agents.find(te=>te.id===fe))??null:null)??null,dt=_.useMemo(()=>{const te=(tt==null?void 0:tt.agent)??(vt?{id:vt.id,name:vt.name,display_name:vt.display_name,status:vt.status}:null);if(!te)return null;const Ie=(vt==null?void 0:vt.status)??te.status,$e=(vt==null?void 0:vt.name)??te.name,at=(vt==null?void 0:vt.display_name)??te.display_name;return te.status===Ie&&te.name===$e&&te.display_name===at?te:{...te,name:$e,display_name:at,status:Ie}},[vt,tt==null?void 0:tt.agent]),cn=dt?tT(dt.status,L.state):void 0,Pn=(tt==null?void 0:tt.projects)??[],ke=(tt==null?void 0:tt.sessions)??[],Z=(tt==null?void 0:tt.project_stats)??[],me=m?ke.find(te=>te.id===m)??null:null,Ce=!!fe&&!dt&&(Be.isPending||Be.isFetching||Ke.isPending||Ke.isFetching),Oe=!!m&&!ke.some(te=>te.id===m)&&(Ke.isPending||Ke.isFetching),le=Ce||Oe,Ae=(me==null?void 0:me.id)??(le?m??null:null);ze.current={agentId:(dt==null?void 0:dt.id)??fe,selectedSessionIdHint:ve},_.useEffect(()=>{const te=(vt==null?void 0:vt.status)??null,Ie=K.current;K.current=te;const $e=(fe==null?void 0:fe.trim())??"";if(!$e||te!=="online"){te!=="online"&&(_e.current=null);return}if(!(Ie!=="online"||!tt))return;const Ut=`${$e}:${Ie!=="online"?"online":"missing"}:${ve??""}`;_e.current!==Ut&&(_e.current=Ut,of(l,{scope:{agentId:$e},selectedSessionId:ve}))},[fe,vt==null?void 0:vt.status,l,tt,ve]),_.useEffect(()=>{var Ut;if(!ze.current.agentId){X.current!==null&&(clearTimeout(X.current),X.current=null),(Ut=R.current)==null||Ut.stream.close(),R.current=null,oe.current=!1,ie.current=!1,k.current=!1;return}let te=!1;const Ie=++H.current,$e=()=>{X.current!==null&&(clearTimeout(X.current),X.current=null)},at=ft=>{const Mt=(ft==null?void 0:ft.includeHubDirectory)??!1;$e(),X.current=setTimeout(()=>{X.current=null;const qn=ze.current,jt=[of(l,{scope:qn.agentId?{agentId:qn.agentId}:void 0,selectedSessionId:qn.selectedSessionIdHint})];Mt&&jt.unshift(s3(l)),Promise.allSettled(jt)},DA)};return xn({agentId:ze.current.agentId}).then(ft=>{var jt,zs;if(te||H.current!==Ie)return;const Mt=ft.client.getConnectionKey();if(((jt=R.current)==null?void 0:jt.key)===Mt)return;(zs=R.current)==null||zs.stream.close(),oe.current=!1,ie.current=!1,k.current=!1;const qn=ft.client.createEventStream(Kt=>{var P,be,Le,He,Ge,ht;const bs=typeof((P=Kt.payload)==null?void 0:P.sessionId)=="string"?Kt.payload.sessionId:null,Wn=typeof((be=Kt.payload)==null?void 0:be.projectId)=="string"?Kt.payload.projectId:null;if(Kt.type==="agent.online"){if(k.current){k.current=!1;return}Bt(),at({includeHubDirectory:!0});return}if(Kt.type==="thread.updated"&&Wn){const mt=typeof((Le=Kt.payload)==null?void 0:Le.action)=="string"?Kt.payload.action:"",ot=(He=Kt.payload)!=null&&He.projectPatch&&typeof Kt.payload.projectPatch=="object"?Kt.payload.projectPatch:null,Xn=Array.isArray((Ge=Kt.payload)==null?void 0:Ge.orderedProjectIds)?Kt.payload.orderedProjectIds.filter(Jt=>typeof Jt=="string"&&Jt.trim().length>0):[];if((mt==="pin"||mt==="unpin"||mt==="rename")&&ot){l.setQueriesData({queryKey:rs},Jt=>fu(Jt,Wn,ot));return}if(mt==="reorder"&&Xn.length>0){l.setQueriesData({queryKey:rs},Jt=>lp(Jt,Xn));return}if(mt==="remove"||mt==="archive"){Bt(),l.setQueriesData({queryKey:rs},Jt=>op(Jt,Wn));return}if(mt==="unarchive"){Bt();const Jt=ze.current;of(l,{scope:Jt.agentId?{agentId:Jt.agentId}:void 0,selectedSessionId:Jt.selectedSessionIdHint});return}}if(Kt.type==="session.updated"&&bs){const mt=(ht=Kt.payload)!=null&&ht.sessionPatch&&typeof Kt.payload.sessionPatch=="object"?g0(Kt.payload.sessionPatch):null,ot=ze.current,Xn=l.getQueryData(y0({scope:ot.agentId?{agentId:ot.agentId}:void 0,selectedSessionId:ot.selectedSessionIdHint})),Jt=ip(Xn,bs);if(mt&&Jt){l.setQueriesData({queryKey:rs},Jn=>lf(Jn,bs,mt));return}if(Jt)return;of(l,{scope:ot.agentId?{agentId:ot.agentId}:void 0,selectedSessionId:ot.selectedSessionIdHint})}},{onStatus:Kt=>{if(W(Kt),Kt.state==="connected"){k.current=!0,oe.current&&ie.current&&(ie.current=!1,Bt(),at({includeHubDirectory:ft.mode==="hub"})),oe.current=!0;return}oe.current&&(ie.current=!0)}});R.current={key:Mt,stream:qn}}).catch(ft=>{te||H.current!==Ie||W({state:"failed",attempt:0,maxAttempts:i2,error:ft instanceof Error?ft.message:"无法建立节点工作区连接"})}),()=>{te=!0}},[dt==null?void 0:dt.id,dt==null?void 0:dt.status,fe,l,Bt]),_.useEffect(()=>()=>{var te;H.current+=1,X.current!==null&&(clearTimeout(X.current),X.current=null),(te=R.current)==null||te.stream.close(),R.current=null},[]),_.useEffect(()=>{ne.current=A},[A]),_.useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(C5,String(D0(A))),window.localStorage.setItem(df,ff)}catch{}},[A]),_.useEffect(()=>{if(typeof window>"u")return;const te=()=>{const Ie=window.innerWidth>=s2;T(Ie),Ie&&(N(!1),F(null))};return te(),window.addEventListener("resize",te),()=>{window.removeEventListener("resize",te)}},[]),_.useEffect(()=>{if(!I)return;const te=$e=>{const at=pe.current;if(!at)return;const Ut=$e.clientX-at.startX,ft=D0(at.startWidth+Ut);V.current=ft,ye.current===null&&(ye.current=window.requestAnimationFrame(()=>{ye.current=null;const Mt=V.current;Mt!==null&&U(Mt)}))},Ie=()=>{ye.current!==null&&(window.cancelAnimationFrame(ye.current),ye.current=null);const $e=V.current??ne.current;V.current=null,pe.current=null,E(!1),ne.current=$e,U($e)};return window.addEventListener("pointermove",te),window.addEventListener("pointerup",Ie),()=>{window.removeEventListener("pointermove",te),window.removeEventListener("pointerup",Ie)}},[I]),_.useEffect(()=>()=>{ye.current!==null&&window.cancelAnimationFrame(ye.current)},[]);const qe=ss({mutationFn:async te=>(await xn({sessionId:te.sessionId})).client.updateSession(te)}),bt=ss({mutationFn:async te=>(await xn({projectId:te.projectId,agentId:te.agentId})).client.updateThread(te)}),At=te=>{l.setQueriesData({queryKey:rs},te)},ce=te=>ke.find(Ie=>Ie.id===te)??_t.find(Ie=>Ie.id===te)??((me==null?void 0:me.id)===te?me:null),Me=async(te,Ie,$e)=>{var ft;const at=await qe.mutateAsync({sessionId:te,action:Ie,name:$e}),Ut=(ft=at.affectedSessionIds)!=null&&ft.length?at.affectedSessionIds:[te];if(Ie==="delete"?(At(Mt=>J6(Mt,Ut)),Bt()):At(Mt=>X6(Mt,Ut,{...Ie==="rename"&&($e!=null&&$e.trim())?{title:$e.trim()}:{pinned:Ie==="pin"}})),Ie==="delete"&&m===te){const Mt=at.nextSessionId;Mt?(na(Mt),y(Mt)):(na(null),y(null))}},Re=async(te,Ie,$e)=>{var ft,Mt;const at=await bt.mutateAsync({projectId:te,agentId:(dt==null?void 0:dt.id)??u??t??"",action:Ie,name:$e==null?void 0:$e.name,orderedProjectIds:$e==null?void 0:$e.orderedProjectIds}),Ut=(ft=$e==null?void 0:$e.name)==null?void 0:ft.trim();Ie==="pin"||Ie==="unpin"?At(qn=>fu(qn,te,{pinned:Ie==="pin"})):Ie==="rename"&&Ut?At(qn=>fu(qn,te,{display_name:Ut})):Ie==="reorder"&&((Mt=$e==null?void 0:$e.orderedProjectIds)!=null&&Mt.length)?At(qn=>lp(qn,$e.orderedProjectIds??[])):Ie==="remove"||Ie==="archive"?(At(qn=>op(qn,te)),Bt()):Ie==="unarchive"&&(Bt(),l.invalidateQueries({queryKey:rs})),me&&me.project_id===te&&(Ie==="remove"||Ie==="archive"||Ie==="unarchive")&&(at.nextSessionId?(na(at.nextSessionId),y(at.nextSessionId)):(na(null),y(null)))},We=async te=>{dt&&(Zi(dt.id),na(null),Wr(null),rf(!1),uu(te),S(te),v("composer"),y(null),await a({to:"/"}))},Xe=async()=>{dt&&(j||(N(!1),De(null)),Zi(dt.id),na(null),Wr(null),uu(null),rf(!0),S(null),v("directory-picker"),y(null),await a({to:"/"}))},Je=async te=>{await We(te)},Tt=async te=>{const Ie=ce(te);S(null),v("composer"),rf(!1),uu(null),Wr(null),Ie&&!ke.some(at=>at.id===te)&&At(at=>e3(at,Ie)),y(te),na(te);const $e=(Ie==null?void 0:Ie.agent_id)??(dt==null?void 0:dt.id)??fe;$e&&(f($e),Zi($e)),t&&await a({to:"/",replace:!0})},Wt=j?0:IA(),ls=j||w,Nt=j?0:ee??(w?Wt:0),Un=j?1:Wt>0?Nt/Wt:0,Cn=!j&&ee!==null,Dn=j?{"--desktop-sidebar-width":`${A}px`}:void 0,De=te=>{G.current=te,F(te)},Qt=te=>te instanceof Element&&!!te.closest('button, textarea, input, a, [role="dialog"]'),On=te=>Qt(te),Ts=(te,Ie,$e)=>(Y.current={mode:w?"close":"open",startX:te,startY:Ie,axis:"pending",pointerId:$e},!0),Ua=(te,Ie)=>{const $e=Y.current;if(!$e)return!1;const at=te-$e.startX,Ut=Ie-$e.startY;if($e.axis==="pending"){if(Math.abs(at)<8&&Math.abs(Ut)<8)return!1;if($e.axis=Math.abs(at)>Math.abs(Ut)?"x":"y",$e.axis==="y")return Y.current=null,De(null),!1}const ft=$e.mode==="open"?Math.max(0,Math.min(Wt,at)):Math.max(0,Math.min(Wt,Wt+at));return De(ft),!0},Us=(te,Ie)=>{const $e=Y.current;if(!$e)return;const at=te-$e.startX,Ut=Ie-$e.startY;if($e.axis==="pending"&&Math.abs(Ut)>48){Y.current=null,De(null);return}const ft=$e.axis==="x"?G.current??($e.mode==="open"?Math.max(0,Math.min(Wt,at)):Math.max(0,Math.min(Wt,Wt+at))):w?Wt:0,Mt=$e.mode==="open"?ft>=Math.min(AA,Wt*a2):ft>=Wt*a2;N(Mt),Y.current=null,De(null)};_.useEffect(()=>{const te=o.current;if(!te||j)return;const Ie=ft=>{const Mt=ft.touches[0];ft.touches.length!==1||!Mt||On(ft.target)||(Q.current={startX:Mt.clientX,startY:Mt.clientY})},$e=ft=>{if(ft.touches.length!==1)return;const Mt=ft.touches[0];if(!Y.current){const jt=Q.current;if(!jt)return;const zs=Mt.clientX-jt.startX,Kt=Mt.clientY-jt.startY;if(Math.abs(zs)<8&&Math.abs(Kt)<8)return;if(Math.abs(zs)<=Math.abs(Kt)){Q.current=null;return}Ts(jt.startX,jt.startY),Q.current=null}Ua(Mt.clientX,Mt.clientY)&&ft.cancelable&&ft.preventDefault()},at=ft=>{if(Q.current=null,!Y.current)return;const Mt=ft.changedTouches[0];if(!Mt){Y.current=null,De(null);return}Us(Mt.clientX,Mt.clientY)},Ut=()=>{Q.current=null,Y.current=null,De(null)};return te.addEventListener("touchstart",Ie,{passive:!0,capture:!0}),te.addEventListener("touchmove",$e,{passive:!1,capture:!0}),te.addEventListener("touchend",at,{capture:!0}),te.addEventListener("touchcancel",Ut,{capture:!0}),()=>{te.removeEventListener("touchstart",Ie,{capture:!0}),te.removeEventListener("touchmove",$e,{capture:!0}),te.removeEventListener("touchend",at,{capture:!0}),te.removeEventListener("touchcancel",Ut,{capture:!0})}},[j,w]);const Ci=()=>i.jsx(i.Fragment,{children:i.jsxs("div",{className:`conversation-main ${j?"has-desktop-sidebar":""}`,style:{transform:`translateX(${Nt}px)`,transition:Cn?"none":void 0},children:[i.jsx("div",{className:"conversation-topbar",children:j?null:i.jsxs("button",{type:"button",className:"conversation-menu",onClick:()=>N(!0),"aria-label":"打开侧边栏",children:[i.jsx("span",{}),i.jsx("span",{className:"short"})]})}),i.jsx("div",{className:"conversation-scroll conversation-scroll--empty",children:i.jsx("div",{className:"conversation-thread conversation-thread--empty",children:i.jsx(TA,{mode:"node",agentName:dt?ac(dt):void 0,agentStatus:(dt==null?void 0:dt.status)??null,onOpenNodes:()=>{a({to:"/nodes"})}})})})]})});return i.jsxs("div",{ref:o,className:`conversation-page ${j?"has-desktop-sidebar":""}`,style:Dn,onPointerDown:te=>{j||te.pointerType!=="touch"&&(te.pointerType==="mouse"&&te.button!==0||On(te.target)||(Ts(te.clientX,te.clientY,te.pointerId),te.currentTarget.setPointerCapture(te.pointerId)))},onPointerMove:te=>{if(j||te.pointerType==="touch")return;const Ie=Y.current;!Ie||Ie.pointerId!==te.pointerId||!Ua(te.clientX,te.clientY)||te.preventDefault()},onPointerUp:te=>{if(j||te.pointerType==="touch")return;const Ie=Y.current;!Ie||Ie.pointerId!==te.pointerId||Us(te.clientX,te.clientY)},onPointerCancel:te=>{if(j||te.pointerType==="touch")return;const Ie=Y.current;!Ie||Ie.pointerId!==te.pointerId||(Y.current=null,De(null))},children:[i.jsx(e5,{open:ls,progress:Un,isDragging:Cn,desktopPinned:j,isDesktopResizing:I,onClose:()=>{j||(N(!1),De(null))},onDesktopResizeStart:te=>{V.current=ne.current,pe.current={startX:te,startWidth:ne.current},E(!0)},currentAgent:dt??void 0,agentIndicatorState:cn,projects:Pn,sessions:ke,projectStats:Z,historySessionsByProject:Object.fromEntries(Object.entries(nn).map(([te,Ie])=>[te,Ie.sessions])),archivedSessionsByProject:Object.fromEntries(Object.entries(Xt).map(([te,Ie])=>[te,Ie.sessions])),historyPageStateByProject:nn,archivedPageStateByProject:Xt,activeSessionId:me==null?void 0:me.id,onCreateSession:te=>{Je(te)},onCreateDirectoryThread:()=>{Xe()},onSelectSession:te=>{Tt(te)},onSessionAction:Me,onThreadAction:Re,onOpenSettings:e,onLoadMoreHistory:te=>{jn(te)},onLoadMoreArchived:te=>{zt(te)},pendingSessionActionId:qe.isPending?((Fn=qe.variables)==null?void 0:Fn.sessionId)??null:null,pendingThreadActionId:bt.isPending?((Ys=bt.variables)==null?void 0:Ys.projectId)??null:null}),Ae?i.jsx(CA,{sessionId:Ae,workspaceDirectorySnapshot:tt??null,workspaceAgentIndicatorState:cn,embedded:!0,isDesktopSidebar:j,sidebarOffset:Nt,isSidebarDragging:Cn,onOpenSidebar:()=>N(!0),onSelectSession:te=>{te&&Tt(te)},onExitToNodes:()=>{Wr(null),na(null),y(null),a({to:"/nodes"})}}):dt?me?null:i.jsx(hM,{currentAgent:dt,projects:Pn,sessions:ke,initialProjectId:g,entryView:p,isDesktopSidebar:j,sidebarOffset:Nt,isSidebarDragging:Cn,onOpenSidebar:()=>N(!0),onProjectSelected:te=>{S(te),v("composer"),rf(!1)},onSessionCreated:te=>{Tt(te)}}):Ci()]})},PA=24,UA=32,R5=e=>{const t=Number(e);if(!Number.isFinite(t))return 0;const a=typeof window<"u"&&Number.isFinite(window.devicePixelRatio)&&window.devicePixelRatio>0?window.devicePixelRatio:1;return Math.max(0,t/a)},Rg=e=>`${Math.round(R5(e)*100)/100}px`,zA=e=>{const t=R5(e);if(!gp())return`${Math.round(t*100)/100}px`;const a=Math.min(UA,Math.max(PA,t+1));return`${Math.round(a*100)/100}px`},BA=()=>{var a,l,o,u;if(typeof document>"u"||typeof window>"u")return;const e=window.PandaSafeArea;if(!e)return;const t=document.documentElement.style;t.setProperty("--native-safe-area-top",zA((a=e.getTopInsetPx)==null?void 0:a.call(e))),t.setProperty("--native-safe-area-right",Rg((l=e.getRightInsetPx)==null?void 0:l.call(e))),t.setProperty("--native-safe-area-bottom",Rg((o=e.getBottomInsetPx)==null?void 0:o.call(e))),t.setProperty("--native-safe-area-left",Rg((u=e.getLeftInsetPx)==null?void 0:u.call(e)))},HA=()=>{var a,l;if(typeof window>"u"||typeof document>"u")return()=>{};const e=()=>{BA()};let t=null;return e(),window.setTimeout(e,0),window.setTimeout(e,250),window.setTimeout(e,800),window.addEventListener("load",e,{once:!0}),window.addEventListener("resize",e),window.addEventListener("orientationchange",e),document.addEventListener("visibilitychange",e),(a=window.visualViewport)==null||a.addEventListener("resize",e),(l=window.visualViewport)==null||l.addEventListener("scroll",e),x3.addListener("resume",e).then(o=>{t=()=>{o.remove()}}).catch(()=>{}),()=>{var o,u;window.removeEventListener("resize",e),window.removeEventListener("orientationchange",e),document.removeEventListener("visibilitychange",e),(o=window.visualViewport)==null||o.removeEventListener("resize",e),(u=window.visualViewport)==null||u.removeEventListener("scroll",e),t==null||t()}},Ag=new R9,$A=async()=>{},FA=_.lazy(async()=>({default:(await ao(()=>import("./diagnostics-page-DXTBGISk.js"),__vite__mapDeps([0,1]))).DiagnosticsPage})),qA=()=>i.jsx(_.Suspense,{fallback:i.jsx("main",{className:"diagnostics-page",children:i.jsx("div",{className:"diagnostics-shell",children:i.jsx("section",{className:"diagnostics-card",children:i.jsx("p",{children:"正在载入诊断页…"})})})}),children:i.jsx(FA,{})}),uc=A7({component:IC}),WA=rc({getParentRoute:()=>uc,path:"/",component:M5}),KA=rc({getParentRoute:()=>uc,path:"/nodes",component:ZC}),QA=rc({getParentRoute:()=>uc,path:"/session/$sessionId",component:eT}),GA=rc({getParentRoute:()=>uc,path:"/new-thread/$agentId",component:M5}),YA=rc({getParentRoute:()=>uc,path:"/settings",component:Q3}),VA=rc({getParentRoute:()=>uc,path:"/diagnostics",component:qA}),ZA=uc.addChildren([WA,KA,QA,GA,YA,VA]),XA=B7({routeTree:ZA,defaultPreload:"intent"});typeof document<"u"&&(F3($3()),HA());$A().catch(()=>{}).then(async()=>{await ck(),await Mk(Ag),Ak(Ag)}).finally(()=>{Xx.createRoot(document.getElementById("root")).render(i.jsx(A9,{client:Ag,children:i.jsx(F7,{router:XA})}))});export{c4 as B,og as C,Eu as E,e0 as L,X2 as W,Fx as g,i as j,_ as r,Ei as u};