@jamiexiongr/panda-hub 0.1.25 → 0.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-KWFBUSH3.mjs → chunk-EUY5V2XS.mjs} +113 -35
- package/dist/{chunk-QSMTYAZX.mjs → chunk-R7HNONWG.mjs} +2 -2
- package/dist/cli.mjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/{src-ILWWSZFE.mjs → src-SMFYPE6P.mjs} +1 -1
- package/dist/web/assets/{diagnostics-page-CUUs5mBW.js → diagnostics-page-cP5VtBfz.js} +1 -1
- package/dist/web/assets/index-C1sZm04V.js +148 -0
- package/dist/web/assets/{session-diff-preview-BXSETWfx.js → session-diff-preview-DwKy91Si.js} +1 -1
- package/dist/web/assets/{session-file-markdown-preview-CNB0_vuB.js → session-file-markdown-preview-BCKRbAnB.js} +1 -1
- package/dist/web/assets/{session-file-preview-page-DZKIRsxQ.js → session-file-preview-page-tFsJlNPN.js} +3 -3
- package/dist/web/assets/{web-BufOpPB2.js → web-BhBxIFnA.js} +1 -1
- package/dist/web/assets/{web-c9a9eQ4-.js → web-Cx7LKGTD.js} +1 -1
- package/dist/web/assets/{web-CVdkFm8V.js → web-D1qcSAMu.js} +1 -1
- package/dist/web/assets/{web-D7DF4ZhP.js → web-DuZa6nLj.js} +1 -1
- package/dist/web/assets/{web-BiRQ43B_.js → web-eR1IoQga.js} +1 -1
- package/dist/web/assets/{xml-C8Jwua6u.js → xml-M87tW4nh.js} +1 -1
- package/dist/web/index.html +1 -1
- package/dist/web/sw.js +1 -1
- package/package.json +1 -1
- package/dist/web/assets/index-BV97xtnA.js +0 -148
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/session-diff-preview-DwKy91Si.js","assets/xml-M87tW4nh.js","assets/session-file-preview-page-tFsJlNPN.js","assets/diagnostics-page-cP5VtBfz.js","assets/diagnostics-page-BmzeM8p1.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
var _v=e=>{throw TypeError(e)};var X1=(e,t,a)=>t.has(e)||_v("Cannot "+a);var $=(e,t,a)=>(X1(e,t,"read from private field"),a?a.call(e):t.get(e)),dt=(e,t,a)=>t.has(e)?_v("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,a),Qe=(e,t,a,l)=>(X1(e,t,"write to private field"),l?l.call(e,a):t.set(e,a),a),Lt=(e,t,a)=>(X1(e,t,"access private method"),a);var _m=(e,t,a,l)=>({set _(o){Qe(e,t,o,a)},get _(){return $(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 X5="modulepreload",J5=function(e){return"/"+e},yv={},Zr=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=J5(g),g in yv)return;yv[g]=!0;const S=g.endsWith(".css"),p=S?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${p}`))return;const b=document.createElement("link");if(b.rel=S?"stylesheet":X5,S||(b.as="script"),b.crossOrigin="",b.href=g,y&&b.setAttribute("nonce",y),document.head.appendChild(b),S)return new Promise((w,N)=>{b.addEventListener("load",w),b.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 e9(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var J1={exports:{}},pf={};/**
|
|
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 vv;function t9(){if(vv)return pf;vv=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 pf.Fragment=t,pf.jsx=a,pf.jsxs=a,pf}var bv;function n9(){return bv||(bv=1,J1.exports=t9()),J1.exports}var i=n9(),eg={exports:{}},Mt={};/**
|
|
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 xv;function s9(){if(xv)return Mt;xv=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"),b=Symbol.iterator;function w(L){return L===null||typeof L!="object"?null:(L=b&&L[b]||L["@@iterator"],typeof L=="function"?L:null)}var N={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,T={};function D(L,ae,ke){this.props=L,this.context=ae,this.refs=T,this.updater=ke||N}D.prototype.isReactComponent={},D.prototype.setState=function(L,ae){if(typeof L!="object"&&typeof L!="function"&&L!=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,L,ae,"setState")},D.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function z(){}z.prototype=D.prototype;function I(L,ae,ke){this.props=L,this.context=ae,this.refs=T,this.updater=ke||N}var k=I.prototype=new z;k.constructor=I,j(k,D.prototype),k.isPureReactComponent=!0;var P=Array.isArray;function Q(){}var se={H:null,A:null,T:null,S:null},W=Object.prototype.hasOwnProperty;function V(L,ae,ke){var U=ke.ref;return{$$typeof:e,type:L,key:ae,ref:U!==void 0?U:null,props:ke}}function Y(L,ae){return V(L.type,ae,L.props)}function ee(L){return typeof L=="object"&&L!==null&&L.$$typeof===e}function me(L){var ae={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(ke){return ae[ke]})}var ge=/\/+/g;function te(L,ae){return typeof L=="object"&&L!==null&&L.key!=null?me(""+L.key):ae.toString(36)}function xe(L){switch(L.status){case"fulfilled":return L.value;case"rejected":throw L.reason;default:switch(typeof L.status=="string"?L.then(Q,Q):(L.status="pending",L.then(function(ae){L.status==="pending"&&(L.status="fulfilled",L.value=ae)},function(ae){L.status==="pending"&&(L.status="rejected",L.reason=ae)})),L.status){case"fulfilled":return L.value;case"rejected":throw L.reason}}throw L}function C(L,ae,ke,U,ve){var Z=typeof L;(Z==="undefined"||Z==="boolean")&&(L=null);var Se=!1;if(L===null)Se=!0;else switch(Z){case"bigint":case"string":case"number":Se=!0;break;case"object":switch(L.$$typeof){case e:case t:Se=!0;break;case S:return Se=L._init,C(Se(L._payload),ae,ke,U,ve)}}if(Se)return ve=ve(L),Se=U===""?"."+te(L,0):U,P(ve)?(ke="",Se!=null&&(ke=Se.replace(ge,"$&/")+"/"),C(ve,ae,ke,"",function(Ie){return Ie})):ve!=null&&(ee(ve)&&(ve=Y(ve,ke+(ve.key==null||L&&L.key===ve.key?"":(""+ve.key).replace(ge,"$&/")+"/")+Se)),ae.push(ve)),1;Se=0;var je=U===""?".":U+":";if(P(L))for(var Oe=0;Oe<L.length;Oe++)U=L[Oe],Z=je+te(U,Oe),Se+=C(U,ae,ke,Z,ve);else if(Oe=w(L),typeof Oe=="function")for(L=Oe.call(L),Oe=0;!(U=L.next()).done;)U=U.value,Z=je+te(U,Oe++),Se+=C(U,ae,ke,Z,ve);else if(Z==="object"){if(typeof L.then=="function")return C(xe(L),ae,ke,U,ve);throw ae=String(L),Error("Objects are not valid as a React child (found: "+(ae==="[object Object]"?"object with keys {"+Object.keys(L).join(", ")+"}":ae)+"). If you meant to render a collection of children, use an array instead.")}return Se}function q(L,ae,ke){if(L==null)return L;var U=[],ve=0;return C(L,U,"","",function(Z){return ae.call(ke,Z,ve++)}),U}function ie(L){if(L._status===-1){var ae=L._result;ae=ae(),ae.then(function(ke){(L._status===0||L._status===-1)&&(L._status=1,L._result=ke)},function(ke){(L._status===0||L._status===-1)&&(L._status=2,L._result=ke)}),L._status===-1&&(L._status=0,L._result=ae)}if(L._status===1)return L._result.default;throw L._result}var he=typeof reportError=="function"?reportError:function(L){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var ae=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof L=="object"&&L!==null&&typeof L.message=="string"?String(L.message):String(L),error:L});if(!window.dispatchEvent(ae))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",L);return}console.error(L)},re={map:q,forEach:function(L,ae,ke){q(L,function(){ae.apply(this,arguments)},ke)},count:function(L){var ae=0;return q(L,function(){ae++}),ae},toArray:function(L){return q(L,function(ae){return ae})||[]},only:function(L){if(!ee(L))throw Error("React.Children.only expected to receive a single React element child.");return L}};return Mt.Activity=p,Mt.Children=re,Mt.Component=D,Mt.Fragment=a,Mt.Profiler=o,Mt.PureComponent=I,Mt.StrictMode=l,Mt.Suspense=y,Mt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=se,Mt.__COMPILER_RUNTIME={__proto__:null,c:function(L){return se.H.useMemoCache(L)}},Mt.cache=function(L){return function(){return L.apply(null,arguments)}},Mt.cacheSignal=function(){return null},Mt.cloneElement=function(L,ae,ke){if(L==null)throw Error("The argument must be a React element, but you passed "+L+".");var U=j({},L.props),ve=L.key;if(ae!=null)for(Z in ae.key!==void 0&&(ve=""+ae.key),ae)!W.call(ae,Z)||Z==="key"||Z==="__self"||Z==="__source"||Z==="ref"&&ae.ref===void 0||(U[Z]=ae[Z]);var Z=arguments.length-2;if(Z===1)U.children=ke;else if(1<Z){for(var Se=Array(Z),je=0;je<Z;je++)Se[je]=arguments[je+2];U.children=Se}return V(L.type,ve,U)},Mt.createContext=function(L){return L={$$typeof:f,_currentValue:L,_currentValue2:L,_threadCount:0,Provider:null,Consumer:null},L.Provider=L,L.Consumer={$$typeof:u,_context:L},L},Mt.createElement=function(L,ae,ke){var U,ve={},Z=null;if(ae!=null)for(U in ae.key!==void 0&&(Z=""+ae.key),ae)W.call(ae,U)&&U!=="key"&&U!=="__self"&&U!=="__source"&&(ve[U]=ae[U]);var Se=arguments.length-2;if(Se===1)ve.children=ke;else if(1<Se){for(var je=Array(Se),Oe=0;Oe<Se;Oe++)je[Oe]=arguments[Oe+2];ve.children=je}if(L&&L.defaultProps)for(U in Se=L.defaultProps,Se)ve[U]===void 0&&(ve[U]=Se[U]);return V(L,Z,ve)},Mt.createRef=function(){return{current:null}},Mt.forwardRef=function(L){return{$$typeof:m,render:L}},Mt.isValidElement=ee,Mt.lazy=function(L){return{$$typeof:S,_payload:{_status:-1,_result:L},_init:ie}},Mt.memo=function(L,ae){return{$$typeof:g,type:L,compare:ae===void 0?null:ae}},Mt.startTransition=function(L){var ae=se.T,ke={};se.T=ke;try{var U=L(),ve=se.S;ve!==null&&ve(ke,U),typeof U=="object"&&U!==null&&typeof U.then=="function"&&U.then(Q,he)}catch(Z){he(Z)}finally{ae!==null&&ke.types!==null&&(ae.types=ke.types),se.T=ae}},Mt.unstable_useCacheRefresh=function(){return se.H.useCacheRefresh()},Mt.use=function(L){return se.H.use(L)},Mt.useActionState=function(L,ae,ke){return se.H.useActionState(L,ae,ke)},Mt.useCallback=function(L,ae){return se.H.useCallback(L,ae)},Mt.useContext=function(L){return se.H.useContext(L)},Mt.useDebugValue=function(){},Mt.useDeferredValue=function(L,ae){return se.H.useDeferredValue(L,ae)},Mt.useEffect=function(L,ae){return se.H.useEffect(L,ae)},Mt.useEffectEvent=function(L){return se.H.useEffectEvent(L)},Mt.useId=function(){return se.H.useId()},Mt.useImperativeHandle=function(L,ae,ke){return se.H.useImperativeHandle(L,ae,ke)},Mt.useInsertionEffect=function(L,ae){return se.H.useInsertionEffect(L,ae)},Mt.useLayoutEffect=function(L,ae){return se.H.useLayoutEffect(L,ae)},Mt.useMemo=function(L,ae){return se.H.useMemo(L,ae)},Mt.useOptimistic=function(L,ae){return se.H.useOptimistic(L,ae)},Mt.useReducer=function(L,ae,ke){return se.H.useReducer(L,ae,ke)},Mt.useRef=function(L){return se.H.useRef(L)},Mt.useState=function(L){return se.H.useState(L)},Mt.useSyncExternalStore=function(L,ae,ke){return se.H.useSyncExternalStore(L,ae,ke)},Mt.useTransition=function(){return se.H.useTransition()},Mt.version="19.2.4",Mt}var Sv;function rh(){return Sv||(Sv=1,eg.exports=s9()),eg.exports}var _=rh();const qr=e9(_);var tg={exports:{}},gf={},ng={exports:{}},sg={};/**
|
|
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 jv;function a9(){return jv||(jv=1,(function(e){function t(C,q){var ie=C.length;C.push(q);e:for(;0<ie;){var he=ie-1>>>1,re=C[he];if(0<o(re,q))C[he]=q,C[ie]=re,ie=he;else break e}}function a(C){return C.length===0?null:C[0]}function l(C){if(C.length===0)return null;var q=C[0],ie=C.pop();if(ie!==q){C[0]=ie;e:for(var he=0,re=C.length,L=re>>>1;he<L;){var ae=2*(he+1)-1,ke=C[ae],U=ae+1,ve=C[U];if(0>o(ke,ie))U<re&&0>o(ve,ke)?(C[he]=ve,C[U]=ie,he=U):(C[he]=ke,C[ae]=ie,he=ae);else if(U<re&&0>o(ve,ie))C[he]=ve,C[U]=ie,he=U;else break e}}return q}function o(C,q){var ie=C.sortIndex-q.sortIndex;return ie!==0?ie:C.id-q.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,b=3,w=!1,N=!1,j=!1,T=!1,D=typeof setTimeout=="function"?setTimeout:null,z=typeof clearTimeout=="function"?clearTimeout:null,I=typeof setImmediate<"u"?setImmediate:null;function k(C){for(var q=a(g);q!==null;){if(q.callback===null)l(g);else if(q.startTime<=C)l(g),q.sortIndex=q.expirationTime,t(y,q);else break;q=a(g)}}function P(C){if(j=!1,k(C),!N)if(a(y)!==null)N=!0,Q||(Q=!0,me());else{var q=a(g);q!==null&&xe(P,q.startTime-C)}}var Q=!1,se=-1,W=5,V=-1;function Y(){return T?!0:!(e.unstable_now()-V<W)}function ee(){if(T=!1,Q){var C=e.unstable_now();V=C;var q=!0;try{e:{N=!1,j&&(j=!1,z(se),se=-1),w=!0;var ie=b;try{t:{for(k(C),p=a(y);p!==null&&!(p.expirationTime>C&&Y());){var he=p.callback;if(typeof he=="function"){p.callback=null,b=p.priorityLevel;var re=he(p.expirationTime<=C);if(C=e.unstable_now(),typeof re=="function"){p.callback=re,k(C),q=!0;break t}p===a(y)&&l(y),k(C)}else l(y);p=a(y)}if(p!==null)q=!0;else{var L=a(g);L!==null&&xe(P,L.startTime-C),q=!1}}break e}finally{p=null,b=ie,w=!1}q=void 0}}finally{q?me():Q=!1}}}var me;if(typeof I=="function")me=function(){I(ee)};else if(typeof MessageChannel<"u"){var ge=new MessageChannel,te=ge.port2;ge.port1.onmessage=ee,me=function(){te.postMessage(null)}}else me=function(){D(ee,0)};function xe(C,q){se=D(function(){C(e.unstable_now())},q)}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(C){C.callback=null},e.unstable_forceFrameRate=function(C){0>C||125<C?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):W=0<C?Math.floor(1e3/C):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(C){switch(b){case 1:case 2:case 3:var q=3;break;default:q=b}var ie=b;b=q;try{return C()}finally{b=ie}},e.unstable_requestPaint=function(){T=!0},e.unstable_runWithPriority=function(C,q){switch(C){case 1:case 2:case 3:case 4:case 5:break;default:C=3}var ie=b;b=C;try{return q()}finally{b=ie}},e.unstable_scheduleCallback=function(C,q,ie){var he=e.unstable_now();switch(typeof ie=="object"&&ie!==null?(ie=ie.delay,ie=typeof ie=="number"&&0<ie?he+ie:he):ie=he,C){case 1:var re=-1;break;case 2:re=250;break;case 5:re=1073741823;break;case 4:re=1e4;break;default:re=5e3}return re=ie+re,C={id:S++,callback:q,priorityLevel:C,startTime:ie,expirationTime:re,sortIndex:-1},ie>he?(C.sortIndex=ie,t(g,C),a(y)===null&&C===a(g)&&(j?(z(se),se=-1):j=!0,xe(P,ie-he))):(C.sortIndex=re,t(y,C),N||w||(N=!0,Q||(Q=!0,me()))),C},e.unstable_shouldYield=Y,e.unstable_wrapCallback=function(C){var q=b;return function(){var ie=b;b=q;try{return C.apply(this,arguments)}finally{b=ie}}}})(sg)),sg}var wv;function i9(){return wv||(wv=1,ng.exports=a9()),ng.exports}var ag={exports:{}},$s={};/**
|
|
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 Nv;function r9(){if(Nv)return $s;Nv=1;var e=rh();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 $s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=l,$s.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)},$s.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()}},$s.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))},$s.prefetchDNS=function(y){typeof y=="string"&&l.d.D(y)},$s.preinit=function(y,g){if(typeof y=="string"&&g&&typeof g.as=="string"){var S=g.as,p=m(S,g.crossOrigin),b=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:b,fetchPriority:w}):S==="script"&&l.d.X(y,{crossOrigin:p,integrity:b,fetchPriority:w,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},$s.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)},$s.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})}},$s.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)},$s.requestFormReset=function(y){l.d.r(y)},$s.unstable_batchedUpdates=function(y,g){return y(g)},$s.useFormState=function(y,g,S){return f.H.useFormState(y,g,S)},$s.useFormStatus=function(){return f.H.useHostTransitionStatus()},$s.version="19.2.4",$s}var kv;function T2(){if(kv)return ag.exports;kv=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(),ag.exports=r9(),ag.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 Ev;function l9(){if(Ev)return gf;Ev=1;var e=i9(),t=rh(),a=T2();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,R=d.child;R;){if(R===r){x=!0,r=d,c=h;break}if(R===c){x=!0,c=d,r=h;break}R=R.sibling}if(!x){for(R=h.child;R;){if(R===r){x=!0,r=h,c=d;break}if(R===c){x=!0,c=h,r=d;break}R=R.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,b=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"),D=Symbol.for("react.profiler"),z=Symbol.for("react.consumer"),I=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),Q=Symbol.for("react.suspense_list"),se=Symbol.for("react.memo"),W=Symbol.for("react.lazy"),V=Symbol.for("react.activity"),Y=Symbol.for("react.memo_cache_sentinel"),ee=Symbol.iterator;function me(n){return n===null||typeof n!="object"?null:(n=ee&&n[ee]||n["@@iterator"],typeof n=="function"?n:null)}var ge=Symbol.for("react.client.reference");function te(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===ge?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case j:return"Fragment";case D:return"Profiler";case T:return"StrictMode";case P:return"Suspense";case Q:return"SuspenseList";case V:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case N:return"Portal";case I:return n.displayName||"Context";case z:return(n._context.displayName||"Context")+".Consumer";case k:var s=n.render;return n=n.displayName,n||(n=s.displayName||s.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case se:return s=n.displayName||null,s!==null?s:te(n.type)||"Memo";case W:s=n._payload,n=n._init;try{return te(n(s))}catch{}}return null}var xe=Array.isArray,C=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ie={pending:!1,data:null,method:null,action:null},he=[],re=-1;function L(n){return{current:n}}function ae(n){0>re||(n.current=he[re],he[re]=null,re--)}function ke(n,s){re++,he[re]=n.current,n.current=s}var U=L(null),ve=L(null),Z=L(null),Se=L(null);function je(n,s){switch(ke(Z,s),ke(ve,n),ke(U,null),s.nodeType){case 9:case 11:n=(n=s.documentElement)&&(n=n.namespaceURI)?B8(n):0;break;default:if(n=s.tagName,s=s.namespaceURI)s=B8(s),n=H8(s,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}ae(U),ke(U,n)}function Oe(){ae(U),ae(ve),ae(Z)}function Ie(n){n.memoizedState!==null&&ke(Se,n);var s=U.current,r=H8(s,n.type);s!==r&&(ke(ve,n),ke(U,r))}function wt(n){ve.current===n&&(ae(U),ae(ve)),Se.current===n&&(ae(Se),df._currentValue=ie)}var qe,bt;function Ut(n){if(qe===void 0)try{throw Error()}catch(r){var s=r.stack.trim().match(/\n( *(at )?)/);qe=s&&s[1]||"",bt=-1<r.stack.indexOf(`
|
|
43
|
+
at`)?" (<anonymous>)":-1<r.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
44
|
+
`+qe+n+bt}var $t=!1;function zt(n,s){if(!n||$t)return"";$t=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var c={DetermineComponentFrameRoot:function(){try{if(s){var Me=function(){throw Error()};if(Object.defineProperty(Me.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Me,[])}catch(ye){var fe=ye}Reflect.construct(n,[],Me)}else{try{Me.call()}catch(ye){fe=ye}n.call(Me.prototype)}}else{try{throw Error()}catch(ye){fe=ye}(Me=n())&&typeof Me.catch=="function"&&Me.catch(function(){})}}catch(ye){if(ye&&fe&&typeof ye.stack=="string")return[ye.stack,fe.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],R=h[1];if(x&&R){var H=x.split(`
|
|
45
|
+
`),de=R.split(`
|
|
46
|
+
`);for(d=c=0;c<H.length&&!H[c].includes("DetermineComponentFrameRoot");)c++;for(;d<de.length&&!de[d].includes("DetermineComponentFrameRoot");)d++;if(c===H.length||d===de.length)for(c=H.length-1,d=de.length-1;1<=c&&0<=d&&H[c]!==de[d];)d--;for(;1<=c&&0<=d;c--,d--)if(H[c]!==de[d]){if(c!==1||d!==1)do if(c--,d--,0>d||H[c]!==de[d]){var Ne=`
|
|
47
|
+
`+H[c].replace(" at new "," at ");return n.displayName&&Ne.includes("<anonymous>")&&(Ne=Ne.replace("<anonymous>",n.displayName)),Ne}while(1<=c&&0<=d);break}}}finally{$t=!1,Error.prepareStackTrace=r}return(r=n?n.displayName||n.name:"")?Ut(r):""}function xt(n,s){switch(n.tag){case 26:case 27:case 5:return Ut(n.type);case 16:return Ut("Lazy");case 13:return n.child!==s&&s!==null?Ut("Suspense Fallback"):Ut("Suspense");case 19:return Ut("SuspenseList");case 0:case 15:return zt(n.type,!1);case 11:return zt(n.type.render,!1);case 1:return zt(n.type,!0);case 31:return Ut("Activity");default:return""}}function it(n){try{var s="",r=null;do s+=xt(n,r),r=n,n=n.return;while(n);return s}catch(c){return`
|
|
48
|
+
Error generating stack: `+c.message+`
|
|
49
|
+
`+c.stack}}var ot=Object.prototype.hasOwnProperty,ln=e.unstable_scheduleCallback,on=e.unstable_cancelCallback,kn=e.unstable_shouldYield,En=e.unstable_requestPaint,ht=e.unstable_now,Ve=e.unstable_getCurrentPriorityLevel,Ke=e.unstable_ImmediatePriority,Nt=e.unstable_UserBlockingPriority,Bt=e.unstable_NormalPriority,Jt=e.unstable_LowPriority,Dt=e.unstable_IdlePriority,Ze=e.log,un=e.unstable_setDisableYieldValue,ut=null,_e=null;function Fe(n){if(typeof Ze=="function"&&un(n),_e&&typeof _e.setStrictMode=="function")try{_e.setStrictMode(ut,n)}catch{}}var X=Math.clz32?Math.clz32:ue,B=Math.log,oe=Math.LN2;function ue(n){return n>>>=0,n===0?32:31-(B(n)/oe|0)|0}var we=256,Re=262144,He=4194304;function ze(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 rt(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 R=c&134217727;return R!==0?(c=R&~h,c!==0?d=ze(c):(x&=R,x!==0?d=ze(x):r||(r=R&~n,r!==0&&(d=ze(r))))):(R=c&~h,R!==0?d=ze(R):x!==0?d=ze(x):r||(r=c&~n,r!==0&&(d=ze(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 It(n,s){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&s)===0}function Ft(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 Le(){var n=He;return He<<=1,(He&62914560)===0&&(He=4194304),n}function Et(n){for(var s=[],r=0;31>r;r++)s.push(n);return s}function Cn(n,s){n.pendingLanes|=s,s!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function hs(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 R=n.entanglements,H=n.expirationTimes,de=n.hiddenUpdates;for(r=x&~r;0<r;){var Ne=31-X(r),Me=1<<Ne;R[Ne]=0,H[Ne]=-1;var fe=de[Ne];if(fe!==null)for(de[Ne]=null,Ne=0;Ne<fe.length;Ne++){var ye=fe[Ne];ye!==null&&(ye.lane&=-536870913)}r&=~Me}c!==0&&na(n,c,0),h!==0&&d===0&&n.tag!==0&&(n.suspendedLanes|=h&~(x&~s))}function na(n,s,r){n.pendingLanes|=s,n.suspendedLanes&=~s;var c=31-X(s);n.entangledLanes|=s,n.entanglements[c]=n.entanglements[c]|1073741824|r&261930}function Ws(n,s){var r=n.entangledLanes|=s;for(n=n.entanglements;r;){var c=31-X(r),d=1<<c;d&s|n[c]&s&&(n[c]|=s),r&=~d}}function Ja(n,s){var r=s&-s;return r=(r&42)!==0?1:Rs(r),(r&(n.suspendedLanes|s))!==0?0:r}function Rs(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 Na(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function Pa(){var n=q.p;return n!==0?n:(n=window.event,n===void 0?32:uv(n.type))}function ms(n,s){var r=q.p;try{return q.p=n,s()}finally{q.p=r}}var dn=Math.random().toString(36).slice(2),pn="__reactFiber$"+dn,Un="__reactProps$"+dn,ps="__reactContainer$"+dn,Ps="__reactEvents$"+dn,Us="__reactListeners$"+dn,Ms="__reactHandles$"+dn,xs="__reactResources$"+dn,As="__reactMarker$"+dn;function Rt(n){delete n[pn],delete n[Un],delete n[Ps],delete n[Us],delete n[Ms]}function J(n){var s=n[pn];if(s)return s;for(var r=n.parentNode;r;){if(s=r[ps]||r[pn]){if(r=s.alternate,s.child!==null||r!==null&&r.child!==null)for(n=G8(n);n!==null;){if(r=n[pn])return r;n=G8(n)}return s}n=r,r=n.parentNode}return null}function M(n){if(n=n[pn]||n[ps]){var s=n.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return n}return null}function G(n){var s=n.tag;if(s===5||s===26||s===27||s===6)return n.stateNode;throw Error(l(33))}function Ee(n){var s=n[xs];return s||(s=n[xs]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function De(n){n[As]=!0}var Pe=new Set,$e={};function Je(n,s){Ye(n,s),Ye(n+"Capture",s)}function Ye(n,s){for($e[n]=s,n=0;n<s.length;n++)Pe.add(s[n])}var en=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={},$n={};function gn(n){return ot.call($n,n)?!0:ot.call(jt,n)?!1:en.test(n)?$n[n]=!0:(jt[n]=!0,!1)}function bn(n,s,r){if(gn(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 Tn(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 xn(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 zn(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function Ss(n){var s=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function _n(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 qt(n){if(!n._valueTracker){var s=Ss(n)?"checked":"value";n._valueTracker=_n(n,s,""+n[s])}}function yn(n){if(!n)return!1;var s=n._valueTracker;if(!s)return!0;var r=s.getValue(),c="";return n&&(c=Ss(n)?n.checked?"true":"false":n.value),n=c,n!==r?(s.setValue(n),!0):!1}function Zn(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 A=/[\n"\\]/g;function le(n){return n.replace(A,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function tt(n,s,r,c,d,h,x,R){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=""+zn(s)):n.value!==""+zn(s)&&(n.value=""+zn(s)):x!=="submit"&&x!=="reset"||n.removeAttribute("value"),s!=null?cn(n,x,zn(s)):r!=null?cn(n,x,zn(r)):c!=null&&n.removeAttribute("value"),d==null&&h!=null&&(n.defaultChecked=!!h),d!=null&&(n.checked=d&&typeof d!="function"&&typeof d!="symbol"),R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"?n.name=""+zn(R):n.removeAttribute("name")}function Ht(n,s,r,c,d,h,x,R){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)){qt(n);return}r=r!=null?""+zn(r):"",s=s!=null?""+zn(s):r,R||s===n.value||(n.value=s),n.defaultValue=s}c=c??d,c=typeof c!="function"&&typeof c!="symbol"&&!!c,n.checked=R?n.checked:!!c,n.defaultChecked=!!c,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(n.name=x),qt(n)}function cn(n,s,r){s==="number"&&Zn(n.ownerDocument)===n||n.defaultValue===""+r||(n.defaultValue=""+r)}function mt(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=""+zn(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 St(n,s,r){if(s!=null&&(s=""+zn(s),s!==n.value&&(n.value=s),r==null)){n.defaultValue!==s&&(n.defaultValue=s);return}n.defaultValue=r!=null?""+zn(r):""}function Rn(n,s,r,c){if(s==null){if(c!=null){if(r!=null)throw Error(l(92));if(xe(c)){if(1<c.length)throw Error(l(93));c=c[0]}r=c}r==null&&(r=""),s=r}r=zn(s),n.defaultValue=r,c=n.textContent,c===r&&c!==""&&c!==null&&(n.value=c),qt(n)}function Ks(n,s){if(s){var r=n.firstChild;if(r&&r===n.lastChild&&r.nodeType===3){r.nodeValue=s;return}}n.textContent=s}var ei=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 zs(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||ei.has(s)?s==="float"?n.cssFloat=r:n[s]=(""+r).trim():n[s]=r+"px"}function Qs(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&&zs(n,d,c)}else for(var h in s)s.hasOwnProperty(h)&&zs(n,h,s[h])}function ka(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 ti=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"]]),nr=/^[\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 ni(n){return nr.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function Gs(){}var si=null;function ai(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var sa=null,aa=null;function ii(n){var s=M(n);if(s&&(n=s.stateNode)){var r=n[Un]||null;e:switch(n=s.stateNode,s.type){case"input":if(tt(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="'+le(""+s)+'"][type="radio"]'),s=0;s<r.length;s++){var c=r[s];if(c!==n&&c.form===n.form){var d=c[Un]||null;if(!d)throw Error(l(90));tt(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&&yn(c)}break e;case"textarea":St(n,r.value,r.defaultValue);break e;case"select":s=r.value,s!=null&&mt(n,!!r.multiple,s,!1)}}}var sr=!1;function ri(n,s,r){if(sr)return n(s,r);sr=!0;try{var c=n(s);return c}finally{if(sr=!1,(sa!==null||aa!==null)&&(Yh(),sa&&(s=sa,n=aa,aa=sa=null,ii(s),n)))for(s=0;s<n.length;s++)ii(n[s])}}function Ds(n,s){var r=n.stateNode;if(r===null)return null;var c=r[Un]||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 Bs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ar=!1;if(Bs)try{var ia={};Object.defineProperty(ia,"passive",{get:function(){ar=!0}}),window.addEventListener("test",ia,ia),window.removeEventListener("test",ia,ia)}catch{ar=!1}var Ea=null,ir=null,_c=null;function Xr(){if(_c)return _c;var n,s=ir,r=s.length,c,d="value"in Ea?Ea.value:Ea.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 _c=d.slice(n,1<c?1-c:void 0)}function rr(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 Jr(){return!0}function el(){return!1}function ss(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 R in n)n.hasOwnProperty(R)&&(r=n[R],this[R]=r?r(h):h[R]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?Jr:el,this.isPropagationStopped=el,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=Jr)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=Jr)},persist:function(){},isPersistent:Jr}),s}var Ca={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ei=ss(Ca),tl=p({},Ca,{view:0,detail:0}),uo=ss(tl),js,fo,li,Ci=p({},tl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:as,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!==li&&(li&&n.type==="mousemove"?(js=n.screenX-li.screenX,fo=n.screenY-li.screenY):fo=js=0,li=n),js)},movementY:function(n){return"movementY"in n?n.movementY:fo}}),oi=ss(Ci),pe=p({},Ci,{dataTransfer:0}),Sn=ss(pe),ra=p({},tl,{relatedTarget:0}),la=ss(ra),oa=p({},Ca,{animationName:0,elapsedTime:0,pseudoElement:0}),tn=ss(oa),nl=p({},Ca,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),yc=ss(nl),ph=p({},Ca,{data:0}),dd=ss(ph),vc={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},gh={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"},Lp={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function fd(n){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(n):(n=Lp[n])?!!s[n]:!1}function as(){return fd}var hd=p({},tl,{key:function(n){if(n.key){var s=vc[n.key]||n.key;if(s!=="Unidentified")return s}return n.type==="keypress"?(n=rr(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?gh[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:as,charCode:function(n){return n.type==="keypress"?rr(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?rr(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),Pp=ss(hd),lr=p({},Ci,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),_h=ss(lr),jn=p({},tl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:as}),sl=ss(jn),yh=p({},Ca,{propertyName:0,elapsedTime:0,pseudoElement:0}),bc=ss(yh),md=p({},Ci,{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}),vh=ss(md),xc=p({},Ca,{newState:0,oldState:0}),bh=ss(xc),ca=[9,13,27,32],or=Bs&&"CompositionEvent"in window,ho=null;Bs&&"documentMode"in document&&(ho=document.documentMode);var Up=Bs&&"TextEvent"in window&&!ho,mo=Bs&&(!or||ho&&8<ho&&11>=ho),Ti=" ",pd=!1;function Sc(n,s){switch(n){case"keyup":return ca.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function gd(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var al=!1;function il(n,s){switch(n){case"compositionend":return gd(s);case"keypress":return s.which!==32?null:(pd=!0,Ti);case"textInput":return n=s.data,n===Ti&&pd?null:n;default:return null}}function Ua(n,s){if(al)return n==="compositionend"||!or&&Sc(n,s)?(n=Xr(),_c=ir=Ea=null,al=!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 mo&&s.locale!=="ko"?null:s.data;default:return null}}var rl={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 po(n){var s=n&&n.nodeName&&n.nodeName.toLowerCase();return s==="input"?!!rl[n.type]:s==="textarea"}function Ri(n,s,r,c){sa?aa?aa.push(c):aa=[c]:sa=c,s=nm(s,"onChange"),0<s.length&&(r=new Ei("onChange","change",null,r,c),n.push({event:r,listeners:s}))}var cr=null,Mi=null;function xh(n){O8(n,0)}function Ai(n){var s=G(n);if(yn(s))return n}function ll(n,s){if(n==="change")return s}var _d=!1;if(Bs){var za;if(Bs){var ol="oninput"in document;if(!ol){var ur=document.createElement("div");ur.setAttribute("oninput","return;"),ol=typeof ur.oninput=="function"}za=ol}else za=!1;_d=za&&(!document.documentMode||9<document.documentMode)}function yd(){cr&&(cr.detachEvent("onpropertychange",Ba),Mi=cr=null)}function Ba(n){if(n.propertyName==="value"&&Ai(Mi)){var s=[];Ri(s,Mi,n,ai(n)),ri(xh,s)}}function Xn(n,s,r){n==="focusin"?(yd(),cr=s,Mi=r,cr.attachEvent("onpropertychange",Ba)):n==="focusout"&&yd()}function jc(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return Ai(Mi)}function Ys(n,s){if(n==="click")return Ai(s)}function wc(n,s){if(n==="input"||n==="change")return Ai(s)}function ci(n,s){return n===s&&(n!==0||1/n===1/s)||n!==n&&s!==s}var Gn=typeof Object.is=="function"?Object.is:ci;function Di(n,s){if(Gn(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(!ot.call(s,d)||!Gn(n[d],s[d]))return!1}return!0}function go(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function is(n,s){var r=go(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=go(r)}}function _o(n,s){return n&&s?n===s?!0:n&&n.nodeType===3?!1:s&&s.nodeType===3?_o(n,s.parentNode):"contains"in n?n.contains(s):n.compareDocumentPosition?!!(n.compareDocumentPosition(s)&16):!1:!1}function vd(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var s=Zn(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=Zn(n.document)}return s}function cl(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 bd=Bs&&"documentMode"in document&&11>=document.documentMode,dr=null,fr=null,Oi=null,xd=!1;function Sd(n,s,r){var c=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;xd||dr==null||dr!==Zn(c)||(c=dr,"selectionStart"in c&&cl(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}),Oi&&Di(Oi,c)||(Oi=c,c=nm(fr,"onSelect"),0<c.length&&(s=new Ei("onSelect","select",null,s,r),n.push({event:s,listeners:c}),s.target=dr)))}function Ii(n,s){var r={};return r[n.toLowerCase()]=s.toLowerCase(),r["Webkit"+n]="webkit"+s,r["Moz"+n]="moz"+s,r}var ul={animationend:Ii("Animation","AnimationEnd"),animationiteration:Ii("Animation","AnimationIteration"),animationstart:Ii("Animation","AnimationStart"),transitionrun:Ii("Transition","TransitionRun"),transitionstart:Ii("Transition","TransitionStart"),transitioncancel:Ii("Transition","TransitionCancel"),transitionend:Ii("Transition","TransitionEnd")},yo={},Nc={};Bs&&(Nc=document.createElement("div").style,"AnimationEvent"in window||(delete ul.animationend.animation,delete ul.animationiteration.animation,delete ul.animationstart.animation),"TransitionEvent"in window||delete ul.transitionend.transition);function Ha(n){if(yo[n])return yo[n];if(!ul[n])return n;var s=ul[n],r;for(r in s)if(s.hasOwnProperty(r)&&r in Nc)return yo[n]=s[r];return n}var jd=Ha("animationend"),vo=Ha("animationiteration"),kc=Ha("animationstart"),Sh=Ha("transitionrun"),jh=Ha("transitionstart"),wh=Ha("transitioncancel"),wd=Ha("transitionend"),Nh=new Map,ui="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(" ");ui.push("scrollEnd");function Ta(n,s){Nh.set(n,s),Je(s,[n])}var Ec=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)},ua=[],hr=0,Nd=0;function Cc(){for(var n=hr,s=Nd=hr=0;s<n;){var r=ua[s];ua[s++]=null;var c=ua[s];ua[s++]=null;var d=ua[s];ua[s++]=null;var h=ua[s];if(ua[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&&kh(r,d,h)}}function Hs(n,s,r,c){ua[hr++]=n,ua[hr++]=s,ua[hr++]=r,ua[hr++]=c,Nd|=c,n.lanes|=c,n=n.alternate,n!==null&&(n.lanes|=c)}function Tc(n,s,r,c){return Hs(n,s,r,c),Rc(n)}function mr(n,s){return Hs(n,null,null,s),Rc(n)}function kh(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-X(r),n=h.hiddenUpdates,c=n[d],c===null?n[d]=[s]:c.push(s),s.lane=r|536870912),h):null}function Rc(n){if(50<sf)throw sf=0,S1=null,Error(l(185));for(var s=n.return;s!==null;)n=s,s=n.return;return n.tag===3?n.stateNode:null}var dl={};function Ra(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 Vs(n,s,r,c){return new Ra(n,s,r,c)}function Mc(n){return n=n.prototype,!(!n||!n.isReactComponent)}function di(n,s){var r=n.alternate;return r===null?(r=Vs(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 Eh(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 Ac(n,s,r,c,d,h){var x=0;if(c=n,typeof n=="function")Mc(n)&&(x=1);else if(typeof n=="string")x=B5(n,r,U.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case V:return n=Vs(31,r,s,d),n.elementType=V,n.lanes=h,n;case j:return Li(r.children,d,h,s);case T:x=8,d|=24;break;case D:return n=Vs(12,r,s,d|2),n.elementType=D,n.lanes=h,n;case P:return n=Vs(13,r,s,d),n.elementType=P,n.lanes=h,n;case Q:return n=Vs(19,r,s,d),n.elementType=Q,n.lanes=h,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case I:x=10;break e;case z:x=9;break e;case k:x=11;break e;case se:x=14;break e;case W:x=16,c=null;break e}x=29,r=Error(l(130,n===null?"null":typeof n,"")),c=null}return s=Vs(x,r,s,d),s.elementType=n,s.type=c,s.lanes=h,s}function Li(n,s,r,c){return n=Vs(7,n,c,s),n.lanes=r,n}function kd(n,s,r){return n=Vs(6,n,null,s),n.lanes=r,n}function ws(n){var s=Vs(18,null,null,0);return s.stateNode=n,s}function bo(n,s,r){return s=Vs(4,n.children!==null?n.children:[],n.key,s),s.lanes=r,s.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},s}var Dc=new WeakMap;function da(n,s){if(typeof n=="object"&&n!==null){var r=Dc.get(n);return r!==void 0?r:(s={value:n,source:s,stack:it(s)},Dc.set(n,s),s)}return{value:n,source:s,stack:it(s)}}var fl=[],hl=0,pr=null,Ns=0,Yn=[],cs=0,fi=null,fa=1,ha="";function ma(n,s){fl[hl++]=Ns,fl[hl++]=pr,pr=n,Ns=s}function Oc(n,s,r){Yn[cs++]=fa,Yn[cs++]=ha,Yn[cs++]=fi,fi=n;var c=fa;n=ha;var d=32-X(c)-1;c&=~(1<<d),r+=1;var h=32-X(s)+d;if(30<h){var x=d-d%5;h=(c&(1<<x)-1).toString(32),c>>=x,d-=x,fa=1<<32-X(s)+d|r<<d|c,ha=h+n}else fa=1<<h|r<<d|c,ha=n}function hi(n){n.return!==null&&(ma(n,1),Oc(n,1,0))}function Ed(n){for(;n===pr;)pr=fl[--hl],fl[hl]=null,Ns=fl[--hl],fl[hl]=null;for(;n===fi;)fi=Yn[--cs],Yn[cs]=null,ha=Yn[--cs],Yn[cs]=null,fa=Yn[--cs],Yn[cs]=null}function ml(n,s){Yn[cs++]=fa,Yn[cs++]=ha,Yn[cs++]=fi,fa=s.id,ha=s.overflow,fi=n}var gs=null,On=null,Wt=!1,mi=null,Zs=!1,$a=Error(l(519));function pi(n){var s=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw xo(da(s,n)),$a}function Cd(n){var s=n.stateNode,r=n.type,c=n.memoizedProps;switch(s[pn]=n,s[Un]=c,r){case"dialog":Yt("cancel",s),Yt("close",s);break;case"iframe":case"object":case"embed":Yt("load",s);break;case"video":case"audio":for(r=0;r<rf.length;r++)Yt(rf[r],s);break;case"source":Yt("error",s);break;case"img":case"image":case"link":Yt("error",s),Yt("load",s);break;case"details":Yt("toggle",s);break;case"input":Yt("invalid",s),Ht(s,c.value,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name,!0);break;case"select":Yt("invalid",s);break;case"textarea":Yt("invalid",s),Rn(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||U8(s.textContent,r)?(c.popover!=null&&(Yt("beforetoggle",s),Yt("toggle",s)),c.onScroll!=null&&Yt("scroll",s),c.onScrollEnd!=null&&Yt("scrollend",s),c.onClick!=null&&(s.onclick=Gs),s=!0):s=!1,s||pi(n,!0)}function Td(n){for(gs=n.return;gs;)switch(gs.tag){case 5:case 31:case 13:Zs=!1;return;case 27:case 3:Zs=!0;return;default:gs=gs.return}}function gr(n){if(n!==gs)return!1;if(!Wt)return Td(n),Wt=!0,!1;var s=n.tag,r;if((r=s!==3&&s!==27)&&((r=s===5)&&(r=n.type,r=!(r!=="form"&&r!=="button")||P1(n.type,n.memoizedProps)),r=!r),r&&On&&pi(n),Td(n),s===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(l(317));On=Q8(n)}else if(s===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(l(317));On=Q8(n)}else s===27?(s=On,Rl(n.type)?(n=$1,$1=null,On=n):On=s):On=gs?Wa(n.stateNode.nextSibling):null;return!0}function _r(){On=gs=null,Wt=!1}function Rd(){var n=mi;return n!==null&&(ya===null?ya=n:ya.push.apply(ya,n),mi=null),n}function xo(n){mi===null?mi=[n]:mi.push(n)}var Md=L(null),Pi=null,gi=null;function Ui(n,s,r){ke(Md,s._currentValue),s._currentValue=r}function _i(n){n._currentValue=Md.current,ae(Md)}function Ad(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 Dd(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 R=h;h=d;for(var H=0;H<s.length;H++)if(R.context===s[H]){h.lanes|=r,R=h.alternate,R!==null&&(R.lanes|=r),Ad(h.return,r,n),c||(x=null);break e}h=R.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),Ad(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 pl(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 R=d.type;Gn(d.pendingProps.value,x.value)||(n!==null?n.push(R):n=[R])}}else if(d===Se.current){if(x=d.alternate,x===null)throw Error(l(387));x.memoizedState.memoizedState!==d.memoizedState.memoizedState&&(n!==null?n.push(df):n=[df])}d=d.return}n!==null&&Dd(s,n,r,c),s.flags|=262144}function Ic(n){for(n=n.firstContext;n!==null;){if(!Gn(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function yr(n){Pi=n,gi=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function _s(n){return Ch(Pi,n)}function yi(n,s){return Pi===null&&yr(n),Ch(n,s)}function Ch(n,s){var r=s._currentValue;if(s={context:s,memoizedValue:r,next:null},gi===null){if(n===null)throw Error(l(308));gi=s,n.dependencies={lanes:0,firstContext:s},n.flags|=524288}else gi=gi.next=s;return r}var zp=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()})}},Bp=e.unstable_scheduleCallback,Hp=e.unstable_NormalPriority,Jn={$$typeof:I,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Od(){return{controller:new zp,data:new Map,refCount:0}}function So(n){n.refCount--,n.refCount===0&&Bp(Hp,function(){n.controller.abort()})}var jo=null,Id=0,gl=0,vr=null;function Th(n,s){if(jo===null){var r=jo=[];Id=0,gl=C1(),vr={status:"pending",value:void 0,then:function(c){r.push(c)}}}return Id++,s.then(Ld,Ld),s}function Ld(){if(--Id===0&&jo!==null){vr!==null&&(vr.status="fulfilled");var n=jo;jo=null,gl=0,vr=null;for(var s=0;s<n.length;s++)(0,n[s])()}}function $p(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 Pd=C.S;C.S=function(n,s){o8=ht(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&Th(n,s),Pd!==null&&Pd(n,s)};var zi=L(null);function Lc(){var n=zi.current;return n!==null?n:Bn.pooledCache}function wo(n,s){s===null?ke(zi,zi.current):ke(zi,s.pool)}function Ud(){var n=Lc();return n===null?null:{parent:Jn._currentValue,pool:n}}var br=Error(l(460)),Pc=Error(l(474)),Uc=Error(l(542)),zc={then:function(){}};function Rh(n){return n=n.status,n==="fulfilled"||n==="rejected"}function zd(n,s,r){switch(r=n[r],r===void 0?n.push(s):r!==s&&(s.then(Gs,Gs),s=r),s.status){case"fulfilled":return s.value;case"rejected":throw n=s.reason,Ah(n),n;default:if(typeof s.status=="string")s.then(Gs,Gs);else{if(n=Bn,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,Ah(n),n}throw xr=s,br}}function Bi(n){try{var s=n._init;return s(n._payload)}catch(r){throw r!==null&&typeof r=="object"&&typeof r.then=="function"?(xr=r,br):r}}var xr=null;function Mh(){if(xr===null)throw Error(l(459));var n=xr;return xr=null,n}function Ah(n){if(n===br||n===Uc)throw Error(l(483))}var Sr=null,_l=0;function No(n){var s=_l;return _l+=1,Sr===null&&(Sr=[]),zd(Sr,n,s)}function Hi(n,s){s=s.props.ref,n.ref=s!==void 0?s:null}function ko(n,s){throw s.$$typeof===b?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(ne,K){if(n){var ce=ne.deletions;ce===null?(ne.deletions=[K],ne.flags|=16):ce.push(K)}}function r(ne,K){if(!n)return null;for(;K!==null;)s(ne,K),K=K.sibling;return null}function c(ne){for(var K=new Map;ne!==null;)ne.key!==null?K.set(ne.key,ne):K.set(ne.index,ne),ne=ne.sibling;return K}function d(ne,K){return ne=di(ne,K),ne.index=0,ne.sibling=null,ne}function h(ne,K,ce){return ne.index=ce,n?(ce=ne.alternate,ce!==null?(ce=ce.index,ce<K?(ne.flags|=67108866,K):ce):(ne.flags|=67108866,K)):(ne.flags|=1048576,K)}function x(ne){return n&&ne.alternate===null&&(ne.flags|=67108866),ne}function R(ne,K,ce,Te){return K===null||K.tag!==6?(K=kd(ce,ne.mode,Te),K.return=ne,K):(K=d(K,ce),K.return=ne,K)}function H(ne,K,ce,Te){var ft=ce.type;return ft===j?Ne(ne,K,ce.props.children,Te,ce.key):K!==null&&(K.elementType===ft||typeof ft=="object"&&ft!==null&&ft.$$typeof===W&&Bi(ft)===K.type)?(K=d(K,ce.props),Hi(K,ce),K.return=ne,K):(K=Ac(ce.type,ce.key,ce.props,null,ne.mode,Te),Hi(K,ce),K.return=ne,K)}function de(ne,K,ce,Te){return K===null||K.tag!==4||K.stateNode.containerInfo!==ce.containerInfo||K.stateNode.implementation!==ce.implementation?(K=bo(ce,ne.mode,Te),K.return=ne,K):(K=d(K,ce.children||[]),K.return=ne,K)}function Ne(ne,K,ce,Te,ft){return K===null||K.tag!==7?(K=Li(ce,ne.mode,Te,ft),K.return=ne,K):(K=d(K,ce),K.return=ne,K)}function Me(ne,K,ce){if(typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint")return K=kd(""+K,ne.mode,ce),K.return=ne,K;if(typeof K=="object"&&K!==null){switch(K.$$typeof){case w:return ce=Ac(K.type,K.key,K.props,null,ne.mode,ce),Hi(ce,K),ce.return=ne,ce;case N:return K=bo(K,ne.mode,ce),K.return=ne,K;case W:return K=Bi(K),Me(ne,K,ce)}if(xe(K)||me(K))return K=Li(K,ne.mode,ce,null),K.return=ne,K;if(typeof K.then=="function")return Me(ne,No(K),ce);if(K.$$typeof===I)return Me(ne,yi(ne,K),ce);ko(ne,K)}return null}function fe(ne,K,ce,Te){var ft=K!==null?K.key:null;if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return ft!==null?null:R(ne,K,""+ce,Te);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case w:return ce.key===ft?H(ne,K,ce,Te):null;case N:return ce.key===ft?de(ne,K,ce,Te):null;case W:return ce=Bi(ce),fe(ne,K,ce,Te)}if(xe(ce)||me(ce))return ft!==null?null:Ne(ne,K,ce,Te,null);if(typeof ce.then=="function")return fe(ne,K,No(ce),Te);if(ce.$$typeof===I)return fe(ne,K,yi(ne,ce),Te);ko(ne,ce)}return null}function ye(ne,K,ce,Te,ft){if(typeof Te=="string"&&Te!==""||typeof Te=="number"||typeof Te=="bigint")return ne=ne.get(ce)||null,R(K,ne,""+Te,ft);if(typeof Te=="object"&&Te!==null){switch(Te.$$typeof){case w:return ne=ne.get(Te.key===null?ce:Te.key)||null,H(K,ne,Te,ft);case N:return ne=ne.get(Te.key===null?ce:Te.key)||null,de(K,ne,Te,ft);case W:return Te=Bi(Te),ye(ne,K,ce,Te,ft)}if(xe(Te)||me(Te))return ne=ne.get(ce)||null,Ne(K,ne,Te,ft,null);if(typeof Te.then=="function")return ye(ne,K,ce,No(Te),ft);if(Te.$$typeof===I)return ye(ne,K,ce,yi(K,Te),ft);ko(K,Te)}return null}function et(ne,K,ce,Te){for(var ft=null,fn=null,lt=K,Ot=K=0,Xt=null;lt!==null&&Ot<ce.length;Ot++){lt.index>Ot?(Xt=lt,lt=null):Xt=lt.sibling;var hn=fe(ne,lt,ce[Ot],Te);if(hn===null){lt===null&&(lt=Xt);break}n&<&&hn.alternate===null&&s(ne,lt),K=h(hn,K,Ot),fn===null?ft=hn:fn.sibling=hn,fn=hn,lt=Xt}if(Ot===ce.length)return r(ne,lt),Wt&&ma(ne,Ot),ft;if(lt===null){for(;Ot<ce.length;Ot++)lt=Me(ne,ce[Ot],Te),lt!==null&&(K=h(lt,K,Ot),fn===null?ft=lt:fn.sibling=lt,fn=lt);return Wt&&ma(ne,Ot),ft}for(lt=c(lt);Ot<ce.length;Ot++)Xt=ye(lt,ne,Ot,ce[Ot],Te),Xt!==null&&(n&&Xt.alternate!==null&<.delete(Xt.key===null?Ot:Xt.key),K=h(Xt,K,Ot),fn===null?ft=Xt:fn.sibling=Xt,fn=Xt);return n&<.forEach(function(Il){return s(ne,Il)}),Wt&&ma(ne,Ot),ft}function _t(ne,K,ce,Te){if(ce==null)throw Error(l(151));for(var ft=null,fn=null,lt=K,Ot=K=0,Xt=null,hn=ce.next();lt!==null&&!hn.done;Ot++,hn=ce.next()){lt.index>Ot?(Xt=lt,lt=null):Xt=lt.sibling;var Il=fe(ne,lt,hn.value,Te);if(Il===null){lt===null&&(lt=Xt);break}n&<&&Il.alternate===null&&s(ne,lt),K=h(Il,K,Ot),fn===null?ft=Il:fn.sibling=Il,fn=Il,lt=Xt}if(hn.done)return r(ne,lt),Wt&&ma(ne,Ot),ft;if(lt===null){for(;!hn.done;Ot++,hn=ce.next())hn=Me(ne,hn.value,Te),hn!==null&&(K=h(hn,K,Ot),fn===null?ft=hn:fn.sibling=hn,fn=hn);return Wt&&ma(ne,Ot),ft}for(lt=c(lt);!hn.done;Ot++,hn=ce.next())hn=ye(lt,ne,Ot,hn.value,Te),hn!==null&&(n&&hn.alternate!==null&<.delete(hn.key===null?Ot:hn.key),K=h(hn,K,Ot),fn===null?ft=hn:fn.sibling=hn,fn=hn);return n&<.forEach(function(Z5){return s(ne,Z5)}),Wt&&ma(ne,Ot),ft}function Pn(ne,K,ce,Te){if(typeof ce=="object"&&ce!==null&&ce.type===j&&ce.key===null&&(ce=ce.props.children),typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case w:e:{for(var ft=ce.key;K!==null;){if(K.key===ft){if(ft=ce.type,ft===j){if(K.tag===7){r(ne,K.sibling),Te=d(K,ce.props.children),Te.return=ne,ne=Te;break e}}else if(K.elementType===ft||typeof ft=="object"&&ft!==null&&ft.$$typeof===W&&Bi(ft)===K.type){r(ne,K.sibling),Te=d(K,ce.props),Hi(Te,ce),Te.return=ne,ne=Te;break e}r(ne,K);break}else s(ne,K);K=K.sibling}ce.type===j?(Te=Li(ce.props.children,ne.mode,Te,ce.key),Te.return=ne,ne=Te):(Te=Ac(ce.type,ce.key,ce.props,null,ne.mode,Te),Hi(Te,ce),Te.return=ne,ne=Te)}return x(ne);case N:e:{for(ft=ce.key;K!==null;){if(K.key===ft)if(K.tag===4&&K.stateNode.containerInfo===ce.containerInfo&&K.stateNode.implementation===ce.implementation){r(ne,K.sibling),Te=d(K,ce.children||[]),Te.return=ne,ne=Te;break e}else{r(ne,K);break}else s(ne,K);K=K.sibling}Te=bo(ce,ne.mode,Te),Te.return=ne,ne=Te}return x(ne);case W:return ce=Bi(ce),Pn(ne,K,ce,Te)}if(xe(ce))return et(ne,K,ce,Te);if(me(ce)){if(ft=me(ce),typeof ft!="function")throw Error(l(150));return ce=ft.call(ce),_t(ne,K,ce,Te)}if(typeof ce.then=="function")return Pn(ne,K,No(ce),Te);if(ce.$$typeof===I)return Pn(ne,K,yi(ne,ce),Te);ko(ne,ce)}return typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint"?(ce=""+ce,K!==null&&K.tag===6?(r(ne,K.sibling),Te=d(K,ce),Te.return=ne,ne=Te):(r(ne,K),Te=kd(ce,ne.mode,Te),Te.return=ne,ne=Te),x(ne)):r(ne,K)}return function(ne,K,ce,Te){try{_l=0;var ft=Pn(ne,K,ce,Te);return Sr=null,ft}catch(lt){if(lt===br||lt===Uc)throw lt;var fn=Vs(29,lt,null,ne.mode);return fn.lanes=Te,fn.return=ne,fn}finally{}}}var $i=Bd(!0),Hd=Bd(!1),vi=!1;function Bc(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Hc(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=Rc(n),kh(n,null,r),s}return Hs(n,c,s,r),Rc(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,Ws(n,r)}}function $c(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 Fc=!1;function vl(){if(Fc){var n=vr;if(n!==null)throw n}}function bl(n,s,r,c){Fc=!1;var d=n.updateQueue;vi=!1;var h=d.firstBaseUpdate,x=d.lastBaseUpdate,R=d.shared.pending;if(R!==null){d.shared.pending=null;var H=R,de=H.next;H.next=null,x===null?h=de:x.next=de,x=H;var Ne=n.alternate;Ne!==null&&(Ne=Ne.updateQueue,R=Ne.lastBaseUpdate,R!==x&&(R===null?Ne.firstBaseUpdate=de:R.next=de,Ne.lastBaseUpdate=H))}if(h!==null){var Me=d.baseState;x=0,Ne=de=H=null,R=h;do{var fe=R.lane&-536870913,ye=fe!==R.lane;if(ye?(Zt&fe)===fe:(c&fe)===fe){fe!==0&&fe===gl&&(Fc=!0),Ne!==null&&(Ne=Ne.next={lane:0,tag:R.tag,payload:R.payload,callback:null,next:null});e:{var et=n,_t=R;fe=s;var Pn=r;switch(_t.tag){case 1:if(et=_t.payload,typeof et=="function"){Me=et.call(Pn,Me,fe);break e}Me=et;break e;case 3:et.flags=et.flags&-65537|128;case 0:if(et=_t.payload,fe=typeof et=="function"?et.call(Pn,Me,fe):et,fe==null)break e;Me=p({},Me,fe);break e;case 2:vi=!0}}fe=R.callback,fe!==null&&(n.flags|=64,ye&&(n.flags|=8192),ye=d.callbacks,ye===null?d.callbacks=[fe]:ye.push(fe))}else ye={lane:fe,tag:R.tag,payload:R.payload,callback:R.callback,next:null},Ne===null?(de=Ne=ye,H=Me):Ne=Ne.next=ye,x|=fe;if(R=R.next,R===null){if(R=d.shared.pending,R===null)break;ye=R,R=ye.next,ye.next=null,d.lastBaseUpdate=ye,d.shared.pending=null}}while(!0);Ne===null&&(H=Me),d.baseState=H,d.firstBaseUpdate=de,d.lastBaseUpdate=Ne,h===null&&(d.shared.lanes=0),Nl|=x,n.lanes=x,n.memoizedState=Me}}function $d(n,s){if(typeof n!="function")throw Error(l(191,n));n.call(s)}function Fd(n,s){var r=n.callbacks;if(r!==null)for(n.callbacks=null,n=0;n<r.length;n++)$d(r[n],s)}var jr=L(null),Eo=L(0);function qd(n,s){n=Mr,ke(Eo,n),ke(jr,s),Mr=n|s.baseLanes}function v(){ke(Eo,Mr),ke(jr,jr.current)}function O(){Mr=Eo.current,ae(jr),ae(Eo)}var F=L(null),be=null;function Ue(n){var s=n.alternate;ke(yt,yt.current&1),ke(F,n),be===null&&(s===null||jr.current!==null||s.memoizedState!==null)&&(be=n)}function gt(n){ke(yt,yt.current),ke(F,n),be===null&&(be=n)}function Xe(n){n.tag===22?(ke(yt,yt.current),ke(F,n),be===null&&(be=n)):Kt()}function Kt(){ke(yt,yt.current),ke(F,F.current)}function In(n){ae(F),be===n&&(be=null),ae(yt)}var yt=L(0);function rs(n){for(var s=n;s!==null;){if(s.tag===13){var r=s.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||B1(r)||H1(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 es=0,Ce=null,Ct=null,nn=null,Qt=!1,Fi=!1,qi=!1,Co=0,xl=0,wr=null,Dh=0;function Fn(){throw Error(l(321))}function qc(n,s){if(s===null)return!1;for(var r=0;r<s.length&&r<n.length;r++)if(!Gn(n[r],s[r]))return!1;return!0}function Wc(n,s,r,c,d,h){return es=h,Ce=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,C.H=n===null||n.memoizedState===null?vy:Zp,qi=!1,h=r(c,d),qi=!1,Fi&&(h=Kd(s,r,c,d)),Wd(n),h}function Wd(n){C.H=Gd;var s=Ct!==null&&Ct.next!==null;if(es=0,nn=Ct=Ce=null,Qt=!1,xl=0,wr=null,s)throw Error(l(300));n===null||us||(n=n.dependencies,n!==null&&Ic(n)&&(us=!0))}function Kd(n,s,r,c){Ce=n;var d=0;do{if(Fi&&(wr=null),xl=0,Fi=!1,25<=d)throw Error(l(301));if(d+=1,nn=Ct=null,n.updateQueue!=null){var h=n.updateQueue;h.lastEffect=null,h.events=null,h.stores=null,h.memoCache!=null&&(h.memoCache.index=0)}C.H=by,h=s(r,c)}while(Fi);return h}function Oh(){var n=C.H,s=n.useState()[0];return s=typeof s.then=="function"?Sl(s):s,n=n.useState()[0],(Ct!==null?Ct.memoizedState:null)!==n&&(Ce.flags|=1024),s}function Kc(){var n=Co!==0;return Co=0,n}function Qc(n,s,r){s.updateQueue=n.updateQueue,s.flags&=-2053,n.lanes&=~r}function Gc(n){if(Qt){for(n=n.memoizedState;n!==null;){var s=n.queue;s!==null&&(s.pending=null),n=n.next}Qt=!1}es=0,nn=Ct=Ce=null,Fi=!1,xl=Co=0,wr=null}function ks(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return nn===null?Ce.memoizedState=nn=n:nn=nn.next=n,nn}function Wn(){if(Ct===null){var n=Ce.alternate;n=n!==null?n.memoizedState:null}else n=Ct.next;var s=nn===null?Ce.memoizedState:nn.next;if(s!==null)nn=s,Ct=n;else{if(n===null)throw Ce.alternate===null?Error(l(467)):Error(l(310));Ct=n,n={memoizedState:Ct.memoizedState,baseState:Ct.baseState,baseQueue:Ct.baseQueue,queue:Ct.queue,next:null},nn===null?Ce.memoizedState=nn=n:nn=nn.next=n}return nn}function To(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Sl(n){var s=xl;return xl+=1,wr===null&&(wr=[]),n=zd(wr,n,s),s=Ce,(nn===null?s.memoizedState:nn.next)===null&&(s=s.alternate,C.H=s===null||s.memoizedState===null?vy:Zp),n}function Ro(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return Sl(n);if(n.$$typeof===I)return _s(n)}throw Error(l(438,String(n)))}function Yc(n){var s=null,r=Ce.updateQueue;if(r!==null&&(s=r.memoCache),s==null){var c=Ce.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=To(),Ce.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]=Y;return s.index++,r}function Fa(n,s){return typeof s=="function"?s(n):s}function Mo(n){var s=Wn();return st(s,Ct,n)}function st(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 R=x=null,H=null,de=s,Ne=!1;do{var Me=de.lane&-536870913;if(Me!==de.lane?(Zt&Me)===Me:(es&Me)===Me){var fe=de.revertLane;if(fe===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null}),Me===gl&&(Ne=!0);else if((es&fe)===fe){de=de.next,fe===gl&&(Ne=!0);continue}else Me={lane:0,revertLane:de.revertLane,gesture:null,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null},H===null?(R=H=Me,x=h):H=H.next=Me,Ce.lanes|=fe,Nl|=fe;Me=de.action,qi&&r(h,Me),h=de.hasEagerState?de.eagerState:r(h,Me)}else fe={lane:Me,revertLane:de.revertLane,gesture:de.gesture,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null},H===null?(R=H=fe,x=h):H=H.next=fe,Ce.lanes|=Me,Nl|=Me;de=de.next}while(de!==null&&de!==s);if(H===null?x=h:H.next=R,!Gn(h,n.memoizedState)&&(us=!0,Ne&&(r=vr,r!==null)))throw r;n.memoizedState=h,n.baseState=x,n.baseQueue=H,c.lastRenderedState=h}return d===null&&(c.lanes=0),[n.memoizedState,c.dispatch]}function Vt(n){var s=Wn(),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);Gn(h,s.memoizedState)||(us=!0),s.memoizedState=h,s.baseQueue===null&&(s.baseState=h),r.lastRenderedState=h}return[h,c]}function Mn(n,s,r){var c=Ce,d=Wn(),h=Wt;if(h){if(r===void 0)throw Error(l(407));r=r()}else r=s();var x=!Gn((Ct||d).memoizedState,r);if(x&&(d.memoizedState=r,us=!0),d=d.queue,Wp(qa.bind(null,c,d,n),[n]),d.getSnapshot!==s||x||nn!==null&&nn.memoizedState.tag&1){if(c.flags|=2048,Xc(9,{destroy:void 0},Hn.bind(null,c,d,r,s),null),Bn===null)throw Error(l(349));h||(es&127)!==0||sn(c,s,r)}return r}function sn(n,s,r){n.flags|=16384,n={getSnapshot:s,value:r},s=Ce.updateQueue,s===null?(s=To(),Ce.updateQueue=s,s.stores=[n]):(r=s.stores,r===null?s.stores=[n]:r.push(n))}function Hn(n,s,r,c){s.value=r,s.getSnapshot=c,Vc(s)&&Zc(n)}function qa(n,s,r){return r(function(){Vc(s)&&Zc(n)})}function Vc(n){var s=n.getSnapshot;n=n.value;try{var r=s();return!Gn(n,r)}catch{return!0}}function Zc(n){var s=mr(n,2);s!==null&&va(s,n,2)}function Fp(n){var s=ks();if(typeof n=="function"){var r=n;if(n=r(),qi){Fe(!0);try{r()}finally{Fe(!1)}}}return s.memoizedState=s.baseState=n,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fa,lastRenderedState:n},s}function W_(n,s,r,c){return n.baseState=r,st(n,Ct,typeof c=="function"?c:Fa)}function Fx(n,s,r,c,d){if(Ph(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)}};C.T!==null?r(!0):h.isTransition=!1,c(h),r=s.pending,r===null?(h.next=s.pending=h,K_(s,h)):(h.next=r.next,s.pending=r.next=h)}}function K_(n,s){var r=s.action,c=s.payload,d=n.state;if(s.isTransition){var h=C.T,x={};C.T=x;try{var R=r(d,c),H=C.S;H!==null&&H(x,R),Q_(n,s,R)}catch(de){qp(n,s,de)}finally{h!==null&&x.types!==null&&(h.types=x.types),C.T=h}}else try{h=r(d,c),Q_(n,s,h)}catch(de){qp(n,s,de)}}function Q_(n,s,r){r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(function(c){G_(n,s,c)},function(c){return qp(n,s,c)}):G_(n,s,r)}function G_(n,s,r){s.status="fulfilled",s.value=r,Y_(s),n.state=r,s=n.pending,s!==null&&(r=s.next,r===s?n.pending=null:(r=r.next,s.next=r,K_(n,r)))}function qp(n,s,r){var c=n.pending;if(n.pending=null,c!==null){c=c.next;do s.status="rejected",s.reason=r,Y_(s),s=s.next;while(s!==c)}n.action=null}function Y_(n){n=n.listeners;for(var s=0;s<n.length;s++)(0,n[s])()}function V_(n,s){return s}function Z_(n,s){if(Wt){var r=Bn.formState;if(r!==null){e:{var c=Ce;if(Wt){if(On){t:{for(var d=On,h=Zs;d.nodeType!==8;){if(!h){d=null;break t}if(d=Wa(d.nextSibling),d===null){d=null;break t}}h=d.data,d=h==="F!"||h==="F"?d:null}if(d){On=Wa(d.nextSibling),c=d.data==="F!";break e}}pi(c)}c=!1}c&&(s=r[0])}}return r=ks(),r.memoizedState=r.baseState=s,c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:V_,lastRenderedState:s},r.queue=c,r=gy.bind(null,Ce,c),c.dispatch=r,c=Fp(!1),h=Vp.bind(null,Ce,!1,c.queue),c=ks(),d={state:s,dispatch:null,action:n,pending:null},c.queue=d,r=Fx.bind(null,Ce,d,h,r),d.dispatch=r,c.memoizedState=n,[s,r,!1]}function X_(n){var s=Wn();return J_(s,Ct,n)}function J_(n,s,r){if(s=st(n,s,V_)[0],n=Mo(Fa)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var c=Sl(s)}catch(x){throw x===br?Uc:x}else c=s;s=Wn();var d=s.queue,h=d.dispatch;return r!==s.memoizedState&&(Ce.flags|=2048,Xc(9,{destroy:void 0},qx.bind(null,d,r),null)),[c,h,n]}function qx(n,s){n.action=s}function ey(n){var s=Wn(),r=Ct;if(r!==null)return J_(s,r,n);Wn(),s=s.memoizedState,r=Wn();var c=r.queue.dispatch;return r.memoizedState=n,[s,c,!1]}function Xc(n,s,r,c){return n={tag:n,create:r,deps:c,inst:s,next:null},s=Ce.updateQueue,s===null&&(s=To(),Ce.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 ty(){return Wn().memoizedState}function Ih(n,s,r,c){var d=ks();Ce.flags|=n,d.memoizedState=Xc(1|s,{destroy:void 0},r,c===void 0?null:c)}function Lh(n,s,r,c){var d=Wn();c=c===void 0?null:c;var h=d.memoizedState.inst;Ct!==null&&c!==null&&qc(c,Ct.memoizedState.deps)?d.memoizedState=Xc(s,h,r,c):(Ce.flags|=n,d.memoizedState=Xc(1|s,h,r,c))}function ny(n,s){Ih(8390656,8,n,s)}function Wp(n,s){Lh(2048,8,n,s)}function Wx(n){Ce.flags|=4;var s=Ce.updateQueue;if(s===null)s=To(),Ce.updateQueue=s,s.events=[n];else{var r=s.events;r===null?s.events=[n]:r.push(n)}}function sy(n){var s=Wn().memoizedState;return Wx({ref:s,nextImpl:n}),function(){if((vn&2)!==0)throw Error(l(440));return s.impl.apply(void 0,arguments)}}function ay(n,s){return Lh(4,2,n,s)}function iy(n,s){return Lh(4,4,n,s)}function ry(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 ly(n,s,r){r=r!=null?r.concat([n]):null,Lh(4,4,ry.bind(null,s,n),r)}function Kp(){}function oy(n,s){var r=Wn();s=s===void 0?null:s;var c=r.memoizedState;return s!==null&&qc(s,c[1])?c[0]:(r.memoizedState=[n,s],n)}function cy(n,s){var r=Wn();s=s===void 0?null:s;var c=r.memoizedState;if(s!==null&&qc(s,c[1]))return c[0];if(c=n(),qi){Fe(!0);try{n()}finally{Fe(!1)}}return r.memoizedState=[c,s],c}function Qp(n,s,r){return r===void 0||(es&1073741824)!==0&&(Zt&261930)===0?n.memoizedState=s:(n.memoizedState=r,n=u8(),Ce.lanes|=n,Nl|=n,r)}function uy(n,s,r,c){return Gn(r,s)?r:jr.current!==null?(n=Qp(n,r,c),Gn(n,s)||(us=!0),n):(es&42)===0||(es&1073741824)!==0&&(Zt&261930)===0?(us=!0,n.memoizedState=r):(n=u8(),Ce.lanes|=n,Nl|=n,s)}function dy(n,s,r,c,d){var h=q.p;q.p=h!==0&&8>h?h:8;var x=C.T,R={};C.T=R,Vp(n,!1,s,r);try{var H=d(),de=C.S;if(de!==null&&de(R,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var Ne=$p(H,c);Qd(n,s,Ne,Da(n))}else Qd(n,s,c,Da(n))}catch(Me){Qd(n,s,{then:function(){},status:"rejected",reason:Me},Da())}finally{q.p=h,x!==null&&R.types!==null&&(x.types=R.types),C.T=x}}function Kx(){}function Gp(n,s,r,c){if(n.tag!==5)throw Error(l(476));var d=fy(n).queue;dy(n,d,s,ie,r===null?Kx:function(){return hy(n),r(c)})}function fy(n){var s=n.memoizedState;if(s!==null)return s;s={memoizedState:ie,baseState:ie,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fa,lastRenderedState:ie},next:null};var r={};return s.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fa,lastRenderedState:r},next:null},n.memoizedState=s,n=n.alternate,n!==null&&(n.memoizedState=s),s}function hy(n){var s=fy(n);s.next===null&&(s=n.alternate.memoizedState),Qd(n,s.next.queue,{},Da())}function Yp(){return _s(df)}function my(){return Wn().memoizedState}function py(){return Wn().memoizedState}function Qx(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&&(va(c,s,r),yl(c,s,r)),s={cache:Od()},n.payload=s;return}s=s.return}}function Gx(n,s,r){var c=Da();r={lane:c,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ph(n)?_y(s,r):(r=Tc(n,s,r,c),r!==null&&(va(r,n,c),yy(r,s,c)))}function gy(n,s,r){var c=Da();Qd(n,s,r,c)}function Qd(n,s,r,c){var d={lane:c,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(Ph(n))_y(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,R=h(x,r);if(d.hasEagerState=!0,d.eagerState=R,Gn(R,x))return Hs(n,s,d,0),Bn===null&&Cc(),!1}catch{}finally{}if(r=Tc(n,s,d,c),r!==null)return va(r,n,c),yy(r,s,c),!0}return!1}function Vp(n,s,r,c){if(c={lane:2,revertLane:C1(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Ph(n)){if(s)throw Error(l(479))}else s=Tc(n,r,c,2),s!==null&&va(s,n,2)}function Ph(n){var s=n.alternate;return n===Ce||s!==null&&s===Ce}function _y(n,s){Fi=Qt=!0;var r=n.pending;r===null?s.next=s:(s.next=r.next,r.next=s),n.pending=s}function yy(n,s,r){if((r&4194048)!==0){var c=s.lanes;c&=n.pendingLanes,r|=c,s.lanes=r,Ws(n,r)}}var Gd={readContext:_s,use:Ro,useCallback:Fn,useContext:Fn,useEffect:Fn,useImperativeHandle:Fn,useLayoutEffect:Fn,useInsertionEffect:Fn,useMemo:Fn,useReducer:Fn,useRef:Fn,useState:Fn,useDebugValue:Fn,useDeferredValue:Fn,useTransition:Fn,useSyncExternalStore:Fn,useId:Fn,useHostTransitionStatus:Fn,useFormState:Fn,useActionState:Fn,useOptimistic:Fn,useMemoCache:Fn,useCacheRefresh:Fn};Gd.useEffectEvent=Fn;var vy={readContext:_s,use:Ro,useCallback:function(n,s){return ks().memoizedState=[n,s===void 0?null:s],n},useContext:_s,useEffect:ny,useImperativeHandle:function(n,s,r){r=r!=null?r.concat([n]):null,Ih(4194308,4,ry.bind(null,s,n),r)},useLayoutEffect:function(n,s){return Ih(4194308,4,n,s)},useInsertionEffect:function(n,s){Ih(4,2,n,s)},useMemo:function(n,s){var r=ks();s=s===void 0?null:s;var c=n();if(qi){Fe(!0);try{n()}finally{Fe(!1)}}return r.memoizedState=[c,s],c},useReducer:function(n,s,r){var c=ks();if(r!==void 0){var d=r(s);if(qi){Fe(!0);try{r(s)}finally{Fe(!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=Gx.bind(null,Ce,n),[c.memoizedState,n]},useRef:function(n){var s=ks();return n={current:n},s.memoizedState=n},useState:function(n){n=Fp(n);var s=n.queue,r=gy.bind(null,Ce,s);return s.dispatch=r,[n.memoizedState,r]},useDebugValue:Kp,useDeferredValue:function(n,s){var r=ks();return Qp(r,n,s)},useTransition:function(){var n=Fp(!1);return n=dy.bind(null,Ce,n.queue,!0,!1),ks().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,s,r){var c=Ce,d=ks();if(Wt){if(r===void 0)throw Error(l(407));r=r()}else{if(r=s(),Bn===null)throw Error(l(349));(Zt&127)!==0||sn(c,s,r)}d.memoizedState=r;var h={value:r,getSnapshot:s};return d.queue=h,ny(qa.bind(null,c,h,n),[n]),c.flags|=2048,Xc(9,{destroy:void 0},Hn.bind(null,c,h,r,s),null),r},useId:function(){var n=ks(),s=Bn.identifierPrefix;if(Wt){var r=ha,c=fa;r=(c&~(1<<32-X(c)-1)).toString(32)+r,s="_"+s+"R_"+r,r=Co++,0<r&&(s+="H"+r.toString(32)),s+="_"}else r=Dh++,s="_"+s+"r_"+r.toString(32)+"_";return n.memoizedState=s},useHostTransitionStatus:Yp,useFormState:Z_,useActionState:Z_,useOptimistic:function(n){var s=ks();s.memoizedState=s.baseState=n;var r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=r,s=Vp.bind(null,Ce,!0,r),r.dispatch=s,[n,s]},useMemoCache:Yc,useCacheRefresh:function(){return ks().memoizedState=Qx.bind(null,Ce)},useEffectEvent:function(n){var s=ks(),r={impl:n};return s.memoizedState=r,function(){if((vn&2)!==0)throw Error(l(440));return r.impl.apply(void 0,arguments)}}},Zp={readContext:_s,use:Ro,useCallback:oy,useContext:_s,useEffect:Wp,useImperativeHandle:ly,useInsertionEffect:ay,useLayoutEffect:iy,useMemo:cy,useReducer:Mo,useRef:ty,useState:function(){return Mo(Fa)},useDebugValue:Kp,useDeferredValue:function(n,s){var r=Wn();return uy(r,Ct.memoizedState,n,s)},useTransition:function(){var n=Mo(Fa)[0],s=Wn().memoizedState;return[typeof n=="boolean"?n:Sl(n),s]},useSyncExternalStore:Mn,useId:my,useHostTransitionStatus:Yp,useFormState:X_,useActionState:X_,useOptimistic:function(n,s){var r=Wn();return W_(r,Ct,n,s)},useMemoCache:Yc,useCacheRefresh:py};Zp.useEffectEvent=sy;var by={readContext:_s,use:Ro,useCallback:oy,useContext:_s,useEffect:Wp,useImperativeHandle:ly,useInsertionEffect:ay,useLayoutEffect:iy,useMemo:cy,useReducer:Vt,useRef:ty,useState:function(){return Vt(Fa)},useDebugValue:Kp,useDeferredValue:function(n,s){var r=Wn();return Ct===null?Qp(r,n,s):uy(r,Ct.memoizedState,n,s)},useTransition:function(){var n=Vt(Fa)[0],s=Wn().memoizedState;return[typeof n=="boolean"?n:Sl(n),s]},useSyncExternalStore:Mn,useId:my,useHostTransitionStatus:Yp,useFormState:ey,useActionState:ey,useOptimistic:function(n,s){var r=Wn();return Ct!==null?W_(r,Ct,n,s):(r.baseState=n,[n,r.queue.dispatch])},useMemoCache:Yc,useCacheRefresh:py};by.useEffectEvent=sy;function Xp(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 Jp={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&&(va(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&&(va(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&&(va(s,n,r),yl(s,n,r))}};function xy(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?!Di(r,c)||!Di(d,h):!0}function Sy(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&&Jp.enqueueReplaceState(s,s.state,null)}function Ao(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 jy(n){Ec(n)}function wy(n){console.error(n)}function Ny(n){Ec(n)}function Uh(n,s){try{var r=n.onUncaughtError;r(s.value,{componentStack:s.stack})}catch(c){setTimeout(function(){throw c})}}function ky(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 e1(n,s,r){return r=bi(r),r.tag=3,r.payload={element:null},r.callback=function(){Uh(n,s)},r}function Ey(n){return n=bi(n),n.tag=3,n}function Cy(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(){ky(s,r,c)}}var x=r.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(n.callback=function(){ky(s,r,c),typeof d!="function"&&(kl===null?kl=new Set([this]):kl.add(this));var R=c.stack;this.componentDidCatch(c.value,{componentStack:R!==null?R:""})})}function Yx(n,s,r,c,d){if(r.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){if(s=r.alternate,s!==null&&pl(s,r,d,!0),r=F.current,r!==null){switch(r.tag){case 31:case 13:return be===null?Vh():r.alternate===null&&ts===0&&(ts=3),r.flags&=-257,r.flags|=65536,r.lanes=d,c===zc?r.flags|=16384:(s=r.updateQueue,s===null?r.updateQueue=new Set([c]):s.add(c),N1(n,c,d)),!1;case 22:return r.flags|=65536,c===zc?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)),N1(n,c,d)),!1}throw Error(l(435,r.tag))}return N1(n,c,d),Vh(),!1}if(Wt)return s=F.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=d,c!==$a&&(n=Error(l(422),{cause:c}),xo(da(n,r)))):(c!==$a&&(s=Error(l(423),{cause:c}),xo(da(s,r))),n=n.current.alternate,n.flags|=65536,d&=-d,n.lanes|=d,c=da(c,r),d=e1(n.stateNode,c,d),$c(n,d),ts!==4&&(ts=2)),!1;var h=Error(l(520),{cause:c});if(h=da(h,r),nf===null?nf=[h]:nf.push(h),ts!==4&&(ts=2),s===null)return!0;c=da(c,r),r=s;do{switch(r.tag){case 3:return r.flags|=65536,n=d&-d,r.lanes|=n,n=e1(r.stateNode,c,n),$c(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"&&(kl===null||!kl.has(h))))return r.flags|=65536,d&=-d,r.lanes|=d,d=Ey(d),Cy(d,n,r,c),$c(r,d),!1}r=r.return}while(r!==null);return!1}var t1=Error(l(461)),us=!1;function Os(n,s,r,c){s.child=n===null?Hd(s,null,r,c):$i(s,n.child,r,c)}function Ty(n,s,r,c,d){r=r.render;var h=s.ref;if("ref"in c){var x={};for(var R in c)R!=="ref"&&(x[R]=c[R])}else x=c;return yr(s),c=Wc(n,s,r,x,h,d),R=Kc(),n!==null&&!us?(Qc(n,s,d),Nr(n,s,d)):(Wt&&R&&hi(s),s.flags|=1,Os(n,s,c,d),s.child)}function Ry(n,s,r,c,d){if(n===null){var h=r.type;return typeof h=="function"&&!Mc(h)&&h.defaultProps===void 0&&r.compare===null?(s.tag=15,s.type=h,My(n,s,h,c,d)):(n=Ac(r.type,null,c,s,s.mode,d),n.ref=s.ref,n.return=s,s.child=n)}if(h=n.child,!c1(n,d)){var x=h.memoizedProps;if(r=r.compare,r=r!==null?r:Di,r(x,c)&&n.ref===s.ref)return Nr(n,s,d)}return s.flags|=1,n=di(h,c),n.ref=s.ref,n.return=s,s.child=n}function My(n,s,r,c,d){if(n!==null){var h=n.memoizedProps;if(Di(h,c)&&n.ref===s.ref)if(us=!1,s.pendingProps=c=h,c1(n,d))(n.flags&131072)!==0&&(us=!0);else return s.lanes=n.lanes,Nr(n,s,d)}return n1(n,s,r,c,d)}function Ay(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 Dy(n,s,h,r,c)}if((r&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},n!==null&&wo(s,h!==null?h.cachePool:null),h!==null?qd(s,h):v(),Xe(s);else return c=s.lanes=536870912,Dy(n,s,h!==null?h.baseLanes|r:r,r,c)}else h!==null?(wo(s,h.cachePool),qd(s,h),Kt(),s.memoizedState=null):(n!==null&&wo(s,null),v(),Kt());return Os(n,s,d,r),s.child}function Yd(n,s){return n!==null&&n.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function Dy(n,s,r,c,d){var h=Lc();return h=h===null?null:{parent:Jn._currentValue,pool:h},s.memoizedState={baseLanes:r,cachePool:h},n!==null&&wo(s,null),v(),Xe(s),n!==null&&pl(n,s,c,!0),s.childLanes=d,null}function zh(n,s){return s=Hh({mode:s.mode,children:s.children},n.mode),s.ref=n.ref,n.child=s,s.return=n,s}function Oy(n,s,r){return $i(s,n.child,null,r),n=zh(s,s.pendingProps),n.flags|=2,In(s),s.memoizedState=null,n}function Vx(n,s,r){var c=s.pendingProps,d=(s.flags&128)!==0;if(s.flags&=-129,n===null){if(Wt){if(c.mode==="hidden")return n=zh(s,c),s.lanes=536870912,Yd(null,n);if(gt(s),(n=On)?(n=K8(n,Zs),n=n!==null&&n.data==="&"?n:null,n!==null&&(s.memoizedState={dehydrated:n,treeContext:fi!==null?{id:fa,overflow:ha}:null,retryLane:536870912,hydrationErrors:null},r=ws(n),r.return=s,s.child=r,gs=s,On=null)):n=null,n===null)throw pi(s);return s.lanes=536870912,null}return zh(s,c)}var h=n.memoizedState;if(h!==null){var x=h.dehydrated;if(gt(s),d)if(s.flags&256)s.flags&=-257,s=Oy(n,s,r);else if(s.memoizedState!==null)s.child=n.child,s.flags|=128,s=null;else throw Error(l(558));else if(us||pl(n,s,r,!1),d=(r&n.childLanes)!==0,us||d){if(c=Bn,c!==null&&(x=Ja(c,r),x!==0&&x!==h.retryLane))throw h.retryLane=x,mr(n,x),va(c,n,x),t1;Vh(),s=Oy(n,s,r)}else n=h.treeContext,On=Wa(x.nextSibling),gs=s,Wt=!0,mi=null,Zs=!1,n!==null&&ml(s,n),s=zh(s,c),s.flags|=4096;return s}return n=di(n.child,{mode:c.mode,children:c.children}),n.ref=s.ref,s.child=n,n.return=s,n}function Bh(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 n1(n,s,r,c,d){return yr(s),r=Wc(n,s,r,c,void 0,d),c=Kc(),n!==null&&!us?(Qc(n,s,d),Nr(n,s,d)):(Wt&&c&&hi(s),s.flags|=1,Os(n,s,r,d),s.child)}function Iy(n,s,r,c,d,h){return yr(s),s.updateQueue=null,r=Kd(s,c,r,d),Wd(n),c=Kc(),n!==null&&!us?(Qc(n,s,h),Nr(n,s,h)):(Wt&&c&&hi(s),s.flags|=1,Os(n,s,r,h),s.child)}function Ly(n,s,r,c,d){if(yr(s),s.stateNode===null){var h=dl,x=r.contextType;typeof x=="object"&&x!==null&&(h=_s(x)),h=new r(c,h),s.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=Jp,s.stateNode=h,h._reactInternals=s,h=s.stateNode,h.props=c,h.state=s.memoizedState,h.refs={},Bc(s),x=r.contextType,h.context=typeof x=="object"&&x!==null?_s(x):dl,h.state=s.memoizedState,x=r.getDerivedStateFromProps,typeof x=="function"&&(Xp(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&&Jp.enqueueReplaceState(h,h.state,null),bl(s,c,h,d),vl(),h.state=s.memoizedState),typeof h.componentDidMount=="function"&&(s.flags|=4194308),c=!0}else if(n===null){h=s.stateNode;var R=s.memoizedProps,H=Ao(r,R);h.props=H;var de=h.context,Ne=r.contextType;x=dl,typeof Ne=="object"&&Ne!==null&&(x=_s(Ne));var Me=r.getDerivedStateFromProps;Ne=typeof Me=="function"||typeof h.getSnapshotBeforeUpdate=="function",R=s.pendingProps!==R,Ne||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(R||de!==x)&&Sy(s,h,c,x),vi=!1;var fe=s.memoizedState;h.state=fe,bl(s,c,h,d),vl(),de=s.memoizedState,R||fe!==de||vi?(typeof Me=="function"&&(Xp(s,r,Me,c),de=s.memoizedState),(H=vi||xy(s,r,H,c,fe,de,x))?(Ne||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=de),h.props=c,h.state=de,h.context=x,c=H):(typeof h.componentDidMount=="function"&&(s.flags|=4194308),c=!1)}else{h=s.stateNode,Hc(n,s),x=s.memoizedProps,Ne=Ao(r,x),h.props=Ne,Me=s.pendingProps,fe=h.context,de=r.contextType,H=dl,typeof de=="object"&&de!==null&&(H=_s(de)),R=r.getDerivedStateFromProps,(de=typeof R=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(x!==Me||fe!==H)&&Sy(s,h,c,H),vi=!1,fe=s.memoizedState,h.state=fe,bl(s,c,h,d),vl();var ye=s.memoizedState;x!==Me||fe!==ye||vi||n!==null&&n.dependencies!==null&&Ic(n.dependencies)?(typeof R=="function"&&(Xp(s,r,R,c),ye=s.memoizedState),(Ne=vi||xy(s,r,Ne,c,fe,ye,H)||n!==null&&n.dependencies!==null&&Ic(n.dependencies))?(de||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(c,ye,H),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(c,ye,H)),typeof h.componentDidUpdate=="function"&&(s.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof h.componentDidUpdate!="function"||x===n.memoizedProps&&fe===n.memoizedState||(s.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||x===n.memoizedProps&&fe===n.memoizedState||(s.flags|=1024),s.memoizedProps=c,s.memoizedState=ye),h.props=c,h.state=ye,h.context=H,c=Ne):(typeof h.componentDidUpdate!="function"||x===n.memoizedProps&&fe===n.memoizedState||(s.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||x===n.memoizedProps&&fe===n.memoizedState||(s.flags|=1024),c=!1)}return h=c,Bh(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=$i(s,n.child,null,d),s.child=$i(s,null,r,d)):Os(n,s,r,d),s.memoizedState=h.state,n=s.child):n=Nr(n,s,d),n}function Py(n,s,r,c){return _r(),s.flags|=256,Os(n,s,r,c),s.child}var s1={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function a1(n){return{baseLanes:n,cachePool:Ud()}}function i1(n,s,r){return n=n!==null?n.childLanes&~r:0,s&&(n|=Aa),n}function Uy(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:(yt.current&2)!==0),x&&(d=!0,s.flags&=-129),x=(s.flags&32)!==0,s.flags&=-33,n===null){if(Wt){if(d?Ue(s):Kt(),(n=On)?(n=K8(n,Zs),n=n!==null&&n.data!=="&"?n:null,n!==null&&(s.memoizedState={dehydrated:n,treeContext:fi!==null?{id:fa,overflow:ha}:null,retryLane:536870912,hydrationErrors:null},r=ws(n),r.return=s,s.child=r,gs=s,On=null)):n=null,n===null)throw pi(s);return H1(n)?s.lanes=32:s.lanes=536870912,null}var R=c.children;return c=c.fallback,d?(Kt(),d=s.mode,R=Hh({mode:"hidden",children:R},d),c=Li(c,d,r,null),R.return=s,c.return=s,R.sibling=c,s.child=R,c=s.child,c.memoizedState=a1(r),c.childLanes=i1(n,x,r),s.memoizedState=s1,Yd(null,c)):(Ue(s),r1(s,R))}var H=n.memoizedState;if(H!==null&&(R=H.dehydrated,R!==null)){if(h)s.flags&256?(Ue(s),s.flags&=-257,s=l1(n,s,r)):s.memoizedState!==null?(Kt(),s.child=n.child,s.flags|=128,s=null):(Kt(),R=c.fallback,d=s.mode,c=Hh({mode:"visible",children:c.children},d),R=Li(R,d,r,null),R.flags|=2,c.return=s,R.return=s,c.sibling=R,s.child=c,$i(s,n.child,null,r),c=s.child,c.memoizedState=a1(r),c.childLanes=i1(n,x,r),s.memoizedState=s1,s=Yd(null,c));else if(Ue(s),H1(R)){if(x=R.nextSibling&&R.nextSibling.dataset,x)var de=x.dgst;x=de,c=Error(l(419)),c.stack="",c.digest=x,xo({value:c,source:null,stack:null}),s=l1(n,s,r)}else if(us||pl(n,s,r,!1),x=(r&n.childLanes)!==0,us||x){if(x=Bn,x!==null&&(c=Ja(x,r),c!==0&&c!==H.retryLane))throw H.retryLane=c,mr(n,c),va(x,n,c),t1;B1(R)||Vh(),s=l1(n,s,r)}else B1(R)?(s.flags|=192,s.child=n.child,s=null):(n=H.treeContext,On=Wa(R.nextSibling),gs=s,Wt=!0,mi=null,Zs=!1,n!==null&&ml(s,n),s=r1(s,c.children),s.flags|=4096);return s}return d?(Kt(),R=c.fallback,d=s.mode,H=n.child,de=H.sibling,c=di(H,{mode:"hidden",children:c.children}),c.subtreeFlags=H.subtreeFlags&65011712,de!==null?R=di(de,R):(R=Li(R,d,r,null),R.flags|=2),R.return=s,c.return=s,c.sibling=R,s.child=c,Yd(null,c),c=s.child,R=n.child.memoizedState,R===null?R=a1(r):(d=R.cachePool,d!==null?(H=Jn._currentValue,d=d.parent!==H?{parent:H,pool:H}:d):d=Ud(),R={baseLanes:R.baseLanes|r,cachePool:d}),c.memoizedState=R,c.childLanes=i1(n,x,r),s.memoizedState=s1,Yd(n.child,c)):(Ue(s),r=n.child,n=r.sibling,r=di(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 r1(n,s){return s=Hh({mode:"visible",children:s},n.mode),s.return=n,n.child=s}function Hh(n,s){return n=Vs(22,n,null,s),n.lanes=0,n}function l1(n,s,r){return $i(s,n.child,null,r),n=r1(s,s.pendingProps.children),n.flags|=2,s.memoizedState=null,n}function zy(n,s,r){n.lanes|=s;var c=n.alternate;c!==null&&(c.lanes|=s),Ad(n.return,s,r)}function o1(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 By(n,s,r){var c=s.pendingProps,d=c.revealOrder,h=c.tail;c=c.children;var x=yt.current,R=(x&2)!==0;if(R?(x=x&1|2,s.flags|=128):x&=1,ke(yt,x),Os(n,s,c,r),c=Wt?Ns:0,!R&&n!==null&&(n.flags&128)!==0)e:for(n=s.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&zy(n,r,s);else if(n.tag===19)zy(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&&rs(n)===null&&(d=r),r=r.sibling;r=d,r===null?(d=s.child,s.child=null):(d=r.sibling,r.sibling=null),o1(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&&rs(n)===null){s.child=d;break}n=d.sibling,d.sibling=r,r=d,d=n}o1(s,!0,r,null,h,c);break;case"together":o1(s,!1,null,null,void 0,c);break;default:s.memoizedState=null}return s.child}function Nr(n,s,r){if(n!==null&&(s.dependencies=n.dependencies),Nl|=s.lanes,(r&s.childLanes)===0)if(n!==null){if(pl(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=di(n,n.pendingProps),s.child=r,r.return=s;n.sibling!==null;)n=n.sibling,r=r.sibling=di(n,n.pendingProps),r.return=s;r.sibling=null}return s.child}function c1(n,s){return(n.lanes&s)!==0?!0:(n=n.dependencies,!!(n!==null&&Ic(n)))}function Zx(n,s,r){switch(s.tag){case 3:je(s,s.stateNode.containerInfo),Ui(s,Jn,n.memoizedState.cache),_r();break;case 27:case 5:Ie(s);break;case 4:je(s,s.stateNode.containerInfo);break;case 10:Ui(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,gt(s),null;break;case 13:var c=s.memoizedState;if(c!==null)return c.dehydrated!==null?(Ue(s),s.flags|=128,null):(r&s.child.childLanes)!==0?Uy(n,s,r):(Ue(s),n=Nr(n,s,r),n!==null?n.sibling:null);Ue(s);break;case 19:var d=(n.flags&128)!==0;if(c=(r&s.childLanes)!==0,c||(pl(n,s,r,!1),c=(r&s.childLanes)!==0),d){if(c)return By(n,s,r);s.flags|=128}if(d=s.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),ke(yt,yt.current),c)break;return null;case 22:return s.lanes=0,Ay(n,s,r,s.pendingProps);case 24:Ui(s,Jn,n.memoizedState.cache)}return Nr(n,s,r)}function Hy(n,s,r){if(n!==null)if(n.memoizedProps!==s.pendingProps)us=!0;else{if(!c1(n,r)&&(s.flags&128)===0)return us=!1,Zx(n,s,r);us=(n.flags&131072)!==0}else us=!1,Wt&&(s.flags&1048576)!==0&&Oc(s,Ns,s.index);switch(s.lanes=0,s.tag){case 16:e:{var c=s.pendingProps;if(n=Bi(s.elementType),s.type=n,typeof n=="function")Mc(n)?(c=Ao(n,c),s.tag=1,s=Ly(null,s,n,c,r)):(s.tag=0,s=n1(null,s,n,c,r));else{if(n!=null){var d=n.$$typeof;if(d===k){s.tag=11,s=Ty(null,s,n,c,r);break e}else if(d===se){s.tag=14,s=Ry(null,s,n,c,r);break e}}throw s=te(n)||n,Error(l(306,s,""))}}return s;case 0:return n1(n,s,s.type,s.pendingProps,r);case 1:return c=s.type,d=Ao(c,s.pendingProps),Ly(n,s,c,d,r);case 3:e:{if(je(s,s.stateNode.containerInfo),n===null)throw Error(l(387));c=s.pendingProps;var h=s.memoizedState;d=h.element,Hc(n,s),bl(s,c,null,r);var x=s.memoizedState;if(c=x.cache,Ui(s,Jn,c),c!==h.cache&&Dd(s,[Jn],r,!0),vl(),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=Py(n,s,c,r);break e}else if(c!==d){d=da(Error(l(424)),s),xo(d),s=Py(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(On=Wa(n.firstChild),gs=s,Wt=!0,mi=null,Zs=!0,r=Hd(s,null,c,r),s.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling}else{if(_r(),c===d){s=Nr(n,s,r);break e}Os(n,s,c,r)}s=s.child}return s;case 26:return Bh(n,s),n===null?(r=X8(s.type,null,s.pendingProps,null))?s.memoizedState=r:Wt||(r=s.type,n=s.pendingProps,c=sm(Z.current).createElement(r),c[pn]=s,c[Un]=n,Is(c,r,n),De(c),s.stateNode=c):s.memoizedState=X8(s.type,n.memoizedProps,s.pendingProps,n.memoizedState),null;case 27:return Ie(s),n===null&&Wt&&(c=s.stateNode=Y8(s.type,s.pendingProps,Z.current),gs=s,Zs=!0,d=On,Rl(s.type)?($1=d,On=Wa(c.firstChild)):On=d),Os(n,s,s.pendingProps.children,r),Bh(n,s),n===null&&(s.flags|=4194304),s.child;case 5:return n===null&&Wt&&((d=c=On)&&(c=E5(c,s.type,s.pendingProps,Zs),c!==null?(s.stateNode=c,gs=s,On=Wa(c.firstChild),Zs=!1,d=!0):d=!1),d||pi(s)),Ie(s),d=s.type,h=s.pendingProps,x=n!==null?n.memoizedProps:null,c=h.children,P1(d,h)?c=null:x!==null&&P1(d,x)&&(s.flags|=32),s.memoizedState!==null&&(d=Wc(n,s,Oh,null,null,r),df._currentValue=d),Bh(n,s),Os(n,s,c,r),s.child;case 6:return n===null&&Wt&&((n=r=On)&&(r=C5(r,s.pendingProps,Zs),r!==null?(s.stateNode=r,gs=s,On=null,n=!0):n=!1),n||pi(s)),null;case 13:return Uy(n,s,r);case 4:return je(s,s.stateNode.containerInfo),c=s.pendingProps,n===null?s.child=$i(s,null,c,r):Os(n,s,c,r),s.child;case 11:return Ty(n,s,s.type,s.pendingProps,r);case 7:return Os(n,s,s.pendingProps,r),s.child;case 8:return Os(n,s,s.pendingProps.children,r),s.child;case 12:return Os(n,s,s.pendingProps.children,r),s.child;case 10:return c=s.pendingProps,Ui(s,s.type,c.value),Os(n,s,c.children,r),s.child;case 9:return d=s.type._context,c=s.pendingProps.children,yr(s),d=_s(d),c=c(d),s.flags|=1,Os(n,s,c,r),s.child;case 14:return Ry(n,s,s.type,s.pendingProps,r);case 15:return My(n,s,s.type,s.pendingProps,r);case 19:return By(n,s,r);case 31:return Vx(n,s,r);case 22:return Ay(n,s,r,s.pendingProps);case 24:return yr(s),c=_s(Jn),n===null?(d=Lc(),d===null&&(d=Bn,h=Od(),d.pooledCache=h,h.refCount++,h!==null&&(d.pooledCacheLanes|=r),d=h),s.memoizedState={parent:c,cache:d},Bc(s),Ui(s,Jn,d)):((n.lanes&r)!==0&&(Hc(n,s),bl(s,null,null,r),vl()),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),Ui(s,Jn,c)):(c=h.cache,Ui(s,Jn,c),c!==d.cache&&Dd(s,[Jn],r,!0))),Os(n,s,s.pendingProps.children,r),s.child;case 29:throw s.pendingProps}throw Error(l(156,s.tag))}function kr(n){n.flags|=4}function u1(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(m8())n.flags|=8192;else throw xr=zc,Pc}else n.flags&=-16777217}function $y(n,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!sv(s))if(m8())n.flags|=8192;else throw xr=zc,Pc}function $h(n,s){s!==null&&(n.flags|=4),n.flags&16384&&(s=n.tag!==22?Le():536870912,n.lanes|=s,nu|=s)}function Vd(n,s){if(!Wt)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 qn(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 Xx(n,s,r){var c=s.pendingProps;switch(Ed(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return qn(s),null;case 1:return qn(s),null;case 3:return r=s.stateNode,c=null,n!==null&&(c=n.memoizedState.cache),s.memoizedState.cache!==c&&(s.flags|=2048),_i(Jn),Oe(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(n===null||n.child===null)&&(gr(s)?kr(s):n===null||n.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Rd())),qn(s),null;case 26:var d=s.type,h=s.memoizedState;return n===null?(kr(s),h!==null?(qn(s),$y(s,h)):(qn(s),u1(s,d,null,c,r))):h?h!==n.memoizedState?(kr(s),qn(s),$y(s,h)):(qn(s),s.flags&=-16777217):(n=n.memoizedProps,n!==c&&kr(s),qn(s),u1(s,d,n,c,r)),null;case 27:if(wt(s),r=Z.current,d=s.type,n!==null&&s.stateNode!=null)n.memoizedProps!==c&&kr(s);else{if(!c){if(s.stateNode===null)throw Error(l(166));return qn(s),null}n=U.current,gr(s)?Cd(s):(n=Y8(d,c,r),s.stateNode=n,kr(s))}return qn(s),null;case 5:if(wt(s),d=s.type,n!==null&&s.stateNode!=null)n.memoizedProps!==c&&kr(s);else{if(!c){if(s.stateNode===null)throw Error(l(166));return qn(s),null}if(h=U.current,gr(s))Cd(s);else{var x=sm(Z.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[pn]=s,h[Un]=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(Is(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&&kr(s)}}return qn(s),u1(s,s.type,n===null?null:n.memoizedProps,s.pendingProps,r),null;case 6:if(n&&s.stateNode!=null)n.memoizedProps!==c&&kr(s);else{if(typeof c!="string"&&s.stateNode===null)throw Error(l(166));if(n=Z.current,gr(s)){if(n=s.stateNode,r=s.memoizedProps,c=null,d=gs,d!==null)switch(d.tag){case 27:case 5:c=d.memoizedProps}n[pn]=s,n=!!(n.nodeValue===r||c!==null&&c.suppressHydrationWarning===!0||U8(n.nodeValue,r)),n||pi(s,!0)}else n=sm(n).createTextNode(c),n[pn]=s,s.stateNode=n}return qn(s),null;case 31:if(r=s.memoizedState,n===null||n.memoizedState!==null){if(c=gr(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[pn]=s}else _r(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;qn(s),n=!1}else r=Rd(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=r),n=!0;if(!n)return s.flags&256?(In(s),s):(In(s),null);if((s.flags&128)!==0)throw Error(l(558))}return qn(s),null;case 13:if(c=s.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(d=gr(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[pn]=s}else _r(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;qn(s),d=!1}else d=Rd(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=d),d=!0;if(!d)return s.flags&256?(In(s),s):(In(s),null)}return In(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),$h(s,s.updateQueue),qn(s),null);case 4:return Oe(),n===null&&A1(s.stateNode.containerInfo),qn(s),null;case 10:return _i(s.type),qn(s),null;case 19:if(ae(yt),c=s.memoizedState,c===null)return qn(s),null;if(d=(s.flags&128)!==0,h=c.rendering,h===null)if(d)Vd(c,!1);else{if(ts!==0||n!==null&&(n.flags&128)!==0)for(n=s.child;n!==null;){if(h=rs(n),h!==null){for(s.flags|=128,Vd(c,!1),n=h.updateQueue,s.updateQueue=n,$h(s,n),s.subtreeFlags=0,n=r,r=s.child;r!==null;)Eh(r,n),r=r.sibling;return ke(yt,yt.current&1|2),Wt&&ma(s,c.treeForkCount),s.child}n=n.sibling}c.tail!==null&&ht()>Qh&&(s.flags|=128,d=!0,Vd(c,!1),s.lanes=4194304)}else{if(!d)if(n=rs(h),n!==null){if(s.flags|=128,d=!0,n=n.updateQueue,s.updateQueue=n,$h(s,n),Vd(c,!0),c.tail===null&&c.tailMode==="hidden"&&!h.alternate&&!Wt)return qn(s),null}else 2*ht()-c.renderingStartTime>Qh&&r!==536870912&&(s.flags|=128,d=!0,Vd(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=ht(),n.sibling=null,r=yt.current,ke(yt,d?r&1|2:r&1),Wt&&ma(s,c.treeForkCount),n):(qn(s),null);case 22:case 23:return In(s),O(),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&&(qn(s),s.subtreeFlags&6&&(s.flags|=8192)):qn(s),r=s.updateQueue,r!==null&&$h(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&&ae(zi),null;case 24:return r=null,n!==null&&(r=n.memoizedState.cache),s.memoizedState.cache!==r&&(s.flags|=2048),_i(Jn),qn(s),null;case 25:return null;case 30:return null}throw Error(l(156,s.tag))}function Jx(n,s){switch(Ed(s),s.tag){case 1:return n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 3:return _i(Jn),Oe(),n=s.flags,(n&65536)!==0&&(n&128)===0?(s.flags=n&-65537|128,s):null;case 26:case 27:case 5:return wt(s),null;case 31:if(s.memoizedState!==null){if(In(s),s.alternate===null)throw Error(l(340));_r()}return n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 13:if(In(s),n=s.memoizedState,n!==null&&n.dehydrated!==null){if(s.alternate===null)throw Error(l(340));_r()}return n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 19:return ae(yt),null;case 4:return Oe(),null;case 10:return _i(s.type),null;case 22:case 23:return In(s),O(),n!==null&&ae(zi),n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 24:return _i(Jn),null;case 25:return null;default:return null}}function Fy(n,s){switch(Ed(s),s.tag){case 3:_i(Jn),Oe();break;case 26:case 27:case 5:wt(s);break;case 4:Oe();break;case 31:s.memoizedState!==null&&In(s);break;case 13:In(s);break;case 19:ae(yt);break;case 10:_i(s.type);break;case 22:case 23:In(s),O(),n!==null&&ae(zi);break;case 24:_i(Jn)}}function Zd(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(R){Dn(s,s.return,R)}}function jl(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,R=x.destroy;if(R!==void 0){x.destroy=void 0,d=s;var H=r,de=R;try{de()}catch(Ne){Dn(d,H,Ne)}}}c=c.next}while(c!==h)}}catch(Ne){Dn(s,s.return,Ne)}}function qy(n){var s=n.updateQueue;if(s!==null){var r=n.stateNode;try{Fd(s,r)}catch(c){Dn(n,n.return,c)}}}function Wy(n,s,r){r.props=Ao(n.type,n.memoizedProps),r.state=n.memoizedState;try{r.componentWillUnmount()}catch(c){Dn(n,s,c)}}function Xd(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){Dn(n,s,d)}}function Wi(n,s){var r=n.ref,c=n.refCleanup;if(r!==null)if(typeof c=="function")try{c()}catch(d){Dn(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){Dn(n,s,d)}else r.current=null}function Ky(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){Dn(n,n.return,d)}}function d1(n,s,r){try{var c=n.stateNode;x5(c,n.type,r,s),c[Un]=s}catch(d){Dn(n,n.return,d)}}function Qy(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&Rl(n.type)||n.tag===4}function f1(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||Qy(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&&Rl(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 h1(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=Gs));else if(c!==4&&(c===27&&Rl(n.type)&&(r=n.stateNode,s=null),n=n.child,n!==null))for(h1(n,s,r),n=n.sibling;n!==null;)h1(n,s,r),n=n.sibling}function Fh(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&&Rl(n.type)&&(r=n.stateNode),n=n.child,n!==null))for(Fh(n,s,r),n=n.sibling;n!==null;)Fh(n,s,r),n=n.sibling}function Gy(n){var s=n.stateNode,r=n.memoizedProps;try{for(var c=n.type,d=s.attributes;d.length;)s.removeAttributeNode(d[0]);Is(s,c,r),s[pn]=n,s[Un]=r}catch(h){Dn(n,n.return,h)}}var Er=!1,ds=!1,m1=!1,Yy=typeof WeakSet=="function"?WeakSet:Set,Es=null;function e5(n,s){if(n=n.containerInfo,I1=um,n=vd(n),cl(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,R=-1,H=-1,de=0,Ne=0,Me=n,fe=null;t:for(;;){for(var ye;Me!==r||d!==0&&Me.nodeType!==3||(R=x+d),Me!==h||c!==0&&Me.nodeType!==3||(H=x+c),Me.nodeType===3&&(x+=Me.nodeValue.length),(ye=Me.firstChild)!==null;)fe=Me,Me=ye;for(;;){if(Me===n)break t;if(fe===r&&++de===d&&(R=x),fe===h&&++Ne===c&&(H=x),(ye=Me.nextSibling)!==null)break;Me=fe,fe=Me.parentNode}Me=ye}r=R===-1||H===-1?null:{start:R,end:H}}else r=null}r=r||{start:0,end:0}}else r=null;for(L1={focusedElem:n,selectionRange:r},um=!1,Es=s;Es!==null;)if(s=Es,n=s.child,(s.subtreeFlags&1028)!==0&&n!==null)n.return=s,Es=n;else for(;Es!==null;){switch(s=Es,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 et=Ao(r.type,d);n=c.getSnapshotBeforeUpdate(et,h),c.__reactInternalSnapshotBeforeUpdate=n}catch(_t){Dn(r,r.return,_t)}}break;case 3:if((n&1024)!==0){if(n=s.stateNode.containerInfo,r=n.nodeType,r===9)z1(n);else if(r===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":z1(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,Es=n;break}Es=s.return}}function Vy(n,s,r){var c=r.flags;switch(r.tag){case 0:case 11:case 15:Tr(n,r),c&4&&Zd(5,r);break;case 1:if(Tr(n,r),c&4)if(n=r.stateNode,s===null)try{n.componentDidMount()}catch(x){Dn(r,r.return,x)}else{var d=Ao(r.type,s.memoizedProps);s=s.memoizedState;try{n.componentDidUpdate(d,s,n.__reactInternalSnapshotBeforeUpdate)}catch(x){Dn(r,r.return,x)}}c&64&&qy(r),c&512&&Xd(r,r.return);break;case 3:if(Tr(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{Fd(n,s)}catch(x){Dn(r,r.return,x)}}break;case 27:s===null&&c&4&&Gy(r);case 26:case 5:Tr(n,r),s===null&&c&4&&Ky(r),c&512&&Xd(r,r.return);break;case 12:Tr(n,r);break;case 31:Tr(n,r),c&4&&Jy(n,r);break;case 13:Tr(n,r),c&4&&e8(n,r),c&64&&(n=r.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(r=c5.bind(null,r),T5(n,r))));break;case 22:if(c=r.memoizedState!==null||Er,!c){s=s!==null&&s.memoizedState!==null||ds,d=Er;var h=ds;Er=c,(ds=s)&&!h?Rr(n,r,(r.subtreeFlags&8772)!==0):Tr(n,r),Er=d,ds=h}break;case 30:break;default:Tr(n,r)}}function Zy(n){var s=n.alternate;s!==null&&(n.alternate=null,Zy(s)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(s=n.stateNode,s!==null&&Rt(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 Kn=null,pa=!1;function Cr(n,s,r){for(r=r.child;r!==null;)Xy(n,s,r),r=r.sibling}function Xy(n,s,r){if(_e&&typeof _e.onCommitFiberUnmount=="function")try{_e.onCommitFiberUnmount(ut,r)}catch{}switch(r.tag){case 26:ds||Wi(r,s),Cr(n,s,r),r.memoizedState?r.memoizedState.count--:r.stateNode&&(r=r.stateNode,r.parentNode.removeChild(r));break;case 27:ds||Wi(r,s);var c=Kn,d=pa;Rl(r.type)&&(Kn=r.stateNode,pa=!1),Cr(n,s,r),of(r.stateNode),Kn=c,pa=d;break;case 5:ds||Wi(r,s);case 6:if(c=Kn,d=pa,Kn=null,Cr(n,s,r),Kn=c,pa=d,Kn!==null)if(pa)try{(Kn.nodeType===9?Kn.body:Kn.nodeName==="HTML"?Kn.ownerDocument.body:Kn).removeChild(r.stateNode)}catch(h){Dn(r,s,h)}else try{Kn.removeChild(r.stateNode)}catch(h){Dn(r,s,h)}break;case 18:Kn!==null&&(pa?(n=Kn,q8(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,r.stateNode),uu(n)):q8(Kn,r.stateNode));break;case 4:c=Kn,d=pa,Kn=r.stateNode.containerInfo,pa=!0,Cr(n,s,r),Kn=c,pa=d;break;case 0:case 11:case 14:case 15:jl(2,r,s),ds||jl(4,r,s),Cr(n,s,r);break;case 1:ds||(Wi(r,s),c=r.stateNode,typeof c.componentWillUnmount=="function"&&Wy(r,s,c)),Cr(n,s,r);break;case 21:Cr(n,s,r);break;case 22:ds=(c=ds)||r.memoizedState!==null,Cr(n,s,r),ds=c;break;default:Cr(n,s,r)}}function Jy(n,s){if(s.memoizedState===null&&(n=s.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{uu(n)}catch(r){Dn(s,s.return,r)}}}function e8(n,s){if(s.memoizedState===null&&(n=s.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{uu(n)}catch(r){Dn(s,s.return,r)}}function t5(n){switch(n.tag){case 31:case 13:case 19:var s=n.stateNode;return s===null&&(s=n.stateNode=new Yy),s;case 22:return n=n.stateNode,s=n._retryCache,s===null&&(s=n._retryCache=new Yy),s;default:throw Error(l(435,n.tag))}}function qh(n,s){var r=t5(n);s.forEach(function(c){if(!r.has(c)){r.add(c);var d=u5.bind(null,n,c);c.then(d,d)}})}function ga(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,R=x;e:for(;R!==null;){switch(R.tag){case 27:if(Rl(R.type)){Kn=R.stateNode,pa=!1;break e}break;case 5:Kn=R.stateNode,pa=!1;break e;case 3:case 4:Kn=R.stateNode.containerInfo,pa=!0;break e}R=R.return}if(Kn===null)throw Error(l(160));Xy(h,x,d),Kn=null,pa=!1,h=d.alternate,h!==null&&(h.return=null),d.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)t8(s,n),s=s.sibling}var Si=null;function t8(n,s){var r=n.alternate,c=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:ga(s,n),_a(n),c&4&&(jl(3,n,n.return),Zd(3,n),jl(5,n,n.return));break;case 1:ga(s,n),_a(n),c&512&&(ds||r===null||Wi(r,r.return)),c&64&&Er&&(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(ga(s,n),_a(n),c&512&&(ds||r===null||Wi(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[As]||h[pn]||h.namespaceURI==="http://www.w3.org/2000/svg"||h.hasAttribute("itemprop"))&&(h=d.createElement(c),d.head.insertBefore(h,d.querySelector("head > title"))),Is(h,c,r),h[pn]=n,De(h),c=h;break e;case"link":var x=tv("link","href",d).get(c+(r.href||""));if(x){for(var R=0;R<x.length;R++)if(h=x[R],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(R,1);break t}}h=d.createElement(c),Is(h,c,r),d.head.appendChild(h);break;case"meta":if(x=tv("meta","content",d).get(c+(r.content||""))){for(R=0;R<x.length;R++)if(h=x[R],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(R,1);break t}}h=d.createElement(c),Is(h,c,r),d.head.appendChild(h);break;default:throw Error(l(468,c))}h[pn]=n,De(h),c=h}n.stateNode=c}else nv(d,n.type,n.stateNode);else n.stateNode=ev(d,c,n.memoizedProps);else h!==c?(h===null?r.stateNode!==null&&(r=r.stateNode,r.parentNode.removeChild(r)):h.count--,c===null?nv(d,n.type,n.stateNode):ev(d,c,n.memoizedProps)):c===null&&n.stateNode!==null&&d1(n,n.memoizedProps,r.memoizedProps)}break;case 27:ga(s,n),_a(n),c&512&&(ds||r===null||Wi(r,r.return)),r!==null&&c&4&&d1(n,n.memoizedProps,r.memoizedProps);break;case 5:if(ga(s,n),_a(n),c&512&&(ds||r===null||Wi(r,r.return)),n.flags&32){d=n.stateNode;try{Ks(d,"")}catch(et){Dn(n,n.return,et)}}c&4&&n.stateNode!=null&&(d=n.memoizedProps,d1(n,d,r!==null?r.memoizedProps:d)),c&1024&&(m1=!0);break;case 6:if(ga(s,n),_a(n),c&4){if(n.stateNode===null)throw Error(l(162));c=n.memoizedProps,r=n.stateNode;try{r.nodeValue=c}catch(et){Dn(n,n.return,et)}}break;case 3:if(rm=null,d=Si,Si=am(s.containerInfo),ga(s,n),Si=d,_a(n),c&4&&r!==null&&r.memoizedState.isDehydrated)try{uu(s.containerInfo)}catch(et){Dn(n,n.return,et)}m1&&(m1=!1,n8(n));break;case 4:c=Si,Si=am(n.stateNode.containerInfo),ga(s,n),_a(n),Si=c;break;case 12:ga(s,n),_a(n);break;case 31:ga(s,n),_a(n),c&4&&(c=n.updateQueue,c!==null&&(n.updateQueue=null,qh(n,c)));break;case 13:ga(s,n),_a(n),n.child.flags&8192&&n.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(Kh=ht()),c&4&&(c=n.updateQueue,c!==null&&(n.updateQueue=null,qh(n,c)));break;case 22:d=n.memoizedState!==null;var H=r!==null&&r.memoizedState!==null,de=Er,Ne=ds;if(Er=de||d,ds=Ne||H,ga(s,n),ds=Ne,Er=de,_a(n),c&8192)e:for(s=n.stateNode,s._visibility=d?s._visibility&-2:s._visibility|1,d&&(r===null||H||Er||ds||Do(n)),r=null,s=n;;){if(s.tag===5||s.tag===26){if(r===null){H=r=s;try{if(h=H.stateNode,d)x=h.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{R=H.stateNode;var Me=H.memoizedProps.style,fe=Me!=null&&Me.hasOwnProperty("display")?Me.display:null;R.style.display=fe==null||typeof fe=="boolean"?"":(""+fe).trim()}}catch(et){Dn(H,H.return,et)}}}else if(s.tag===6){if(r===null){H=s;try{H.stateNode.nodeValue=d?"":H.memoizedProps}catch(et){Dn(H,H.return,et)}}}else if(s.tag===18){if(r===null){H=s;try{var ye=H.stateNode;d?W8(ye,!0):W8(H.stateNode,!1)}catch(et){Dn(H,H.return,et)}}}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,qh(n,r))));break;case 19:ga(s,n),_a(n),c&4&&(c=n.updateQueue,c!==null&&(n.updateQueue=null,qh(n,c)));break;case 30:break;case 21:break;default:ga(s,n),_a(n)}}function _a(n){var s=n.flags;if(s&2){try{for(var r,c=n.return;c!==null;){if(Qy(c)){r=c;break}c=c.return}if(r==null)throw Error(l(160));switch(r.tag){case 27:var d=r.stateNode,h=f1(n);Fh(n,h,d);break;case 5:var x=r.stateNode;r.flags&32&&(Ks(x,""),r.flags&=-33);var R=f1(n);Fh(n,R,x);break;case 3:case 4:var H=r.stateNode.containerInfo,de=f1(n);h1(n,de,H);break;default:throw Error(l(161))}}catch(Ne){Dn(n,n.return,Ne)}n.flags&=-3}s&4096&&(n.flags&=-4097)}function n8(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var s=n;n8(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),n=n.sibling}}function Tr(n,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)Vy(n,s.alternate,s),s=s.sibling}function Do(n){for(n=n.child;n!==null;){var s=n;switch(s.tag){case 0:case 11:case 14:case 15:jl(4,s,s.return),Do(s);break;case 1:Wi(s,s.return);var r=s.stateNode;typeof r.componentWillUnmount=="function"&&Wy(s,s.return,r),Do(s);break;case 27:of(s.stateNode);case 26:case 5:Wi(s,s.return),Do(s);break;case 22:s.memoizedState===null&&Do(s);break;case 30:Do(s);break;default:Do(s)}n=n.sibling}}function Rr(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:Rr(d,h,r),Zd(4,h);break;case 1:if(Rr(d,h,r),c=h,d=c.stateNode,typeof d.componentDidMount=="function")try{d.componentDidMount()}catch(de){Dn(c,c.return,de)}if(c=h,d=c.updateQueue,d!==null){var R=c.stateNode;try{var H=d.shared.hiddenCallbacks;if(H!==null)for(d.shared.hiddenCallbacks=null,d=0;d<H.length;d++)$d(H[d],R)}catch(de){Dn(c,c.return,de)}}r&&x&64&&qy(h),Xd(h,h.return);break;case 27:Gy(h);case 26:case 5:Rr(d,h,r),r&&c===null&&x&4&&Ky(h),Xd(h,h.return);break;case 12:Rr(d,h,r);break;case 31:Rr(d,h,r),r&&x&4&&Jy(d,h);break;case 13:Rr(d,h,r),r&&x&4&&e8(d,h);break;case 22:h.memoizedState===null&&Rr(d,h,r),Xd(h,h.return);break;case 30:break;default:Rr(d,h,r)}s=s.sibling}}function p1(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&&So(r))}function g1(n,s){n=null,s.alternate!==null&&(n=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==n&&(s.refCount++,n!=null&&So(n))}function ji(n,s,r,c){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)s8(n,s,r,c),s=s.sibling}function s8(n,s,r,c){var d=s.flags;switch(s.tag){case 0:case 11:case 15:ji(n,s,r,c),d&2048&&Zd(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&&So(n)));break;case 12:if(d&2048){ji(n,s,r,c),n=s.stateNode;try{var h=s.memoizedProps,x=h.id,R=h.onPostCommit;typeof R=="function"&&R(x,s.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(H){Dn(s,s.return,H)}}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):Jd(n,s):h._visibility&2?ji(n,s,r,c):(h._visibility|=2,Jc(n,s,r,c,(s.subtreeFlags&10256)!==0||!1)),d&2048&&p1(x,s);break;case 24:ji(n,s,r,c),d&2048&&g1(s.alternate,s);break;default:ji(n,s,r,c)}}function Jc(n,s,r,c,d){for(d=d&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var h=n,x=s,R=r,H=c,de=x.flags;switch(x.tag){case 0:case 11:case 15:Jc(h,x,R,H,d),Zd(8,x);break;case 23:break;case 22:var Ne=x.stateNode;x.memoizedState!==null?Ne._visibility&2?Jc(h,x,R,H,d):Jd(h,x):(Ne._visibility|=2,Jc(h,x,R,H,d)),d&&de&2048&&p1(x.alternate,x);break;case 24:Jc(h,x,R,H,d),d&&de&2048&&g1(x.alternate,x);break;default:Jc(h,x,R,H,d)}s=s.sibling}}function Jd(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:Jd(r,c),d&2048&&p1(c.alternate,c);break;case 24:Jd(r,c),d&2048&&g1(c.alternate,c);break;default:Jd(r,c)}s=s.sibling}}var ef=8192;function eu(n,s,r){if(n.subtreeFlags&ef)for(n=n.child;n!==null;)a8(n,s,r),n=n.sibling}function a8(n,s,r){switch(n.tag){case 26:eu(n,s,r),n.flags&ef&&n.memoizedState!==null&&H5(r,Si,n.memoizedState,n.memoizedProps);break;case 5:eu(n,s,r);break;case 3:case 4:var c=Si;Si=am(n.stateNode.containerInfo),eu(n,s,r),Si=c;break;case 22:n.memoizedState===null&&(c=n.alternate,c!==null&&c.memoizedState!==null?(c=ef,ef=16777216,eu(n,s,r),ef=c):eu(n,s,r));break;default:eu(n,s,r)}}function i8(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 tf(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];Es=c,l8(c,n)}i8(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)r8(n),n=n.sibling}function r8(n){switch(n.tag){case 0:case 11:case 15:tf(n),n.flags&2048&&jl(9,n,n.return);break;case 3:tf(n);break;case 12:tf(n);break;case 22:var s=n.stateNode;n.memoizedState!==null&&s._visibility&2&&(n.return===null||n.return.tag!==13)?(s._visibility&=-3,Wh(n)):tf(n);break;default:tf(n)}}function Wh(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];Es=c,l8(c,n)}i8(n)}for(n=n.child;n!==null;){switch(s=n,s.tag){case 0:case 11:case 15:jl(8,s,s.return),Wh(s);break;case 22:r=s.stateNode,r._visibility&2&&(r._visibility&=-3,Wh(s));break;default:Wh(s)}n=n.sibling}}function l8(n,s){for(;Es!==null;){var r=Es;switch(r.tag){case 0:case 11:case 15:jl(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:So(r.memoizedState.cache)}if(c=r.child,c!==null)c.return=r,Es=c;else e:for(r=n;Es!==null;){c=Es;var d=c.sibling,h=c.return;if(Zy(c),c===r){Es=null;break e}if(d!==null){d.return=h,Es=d;break e}Es=h}}}var n5={getCacheForType:function(n){var s=_s(Jn),r=s.data.get(n);return r===void 0&&(r=n(),s.data.set(n,r)),r},cacheSignal:function(){return _s(Jn).controller.signal}},s5=typeof WeakMap=="function"?WeakMap:Map,vn=0,Bn=null,Gt=null,Zt=0,An=0,Ma=null,wl=!1,tu=!1,_1=!1,Mr=0,ts=0,Nl=0,Oo=0,y1=0,Aa=0,nu=0,nf=null,ya=null,v1=!1,Kh=0,o8=0,Qh=1/0,Gh=null,kl=null,ys=0,El=null,su=null,Ar=0,b1=0,x1=null,c8=null,sf=0,S1=null;function Da(){return(vn&2)!==0&&Zt!==0?Zt&-Zt:C.T!==null?C1():Pa()}function u8(){if(Aa===0)if((Zt&536870912)===0||Wt){var n=Re;Re<<=1,(Re&3932160)===0&&(Re=262144),Aa=n}else Aa=536870912;return n=F.current,n!==null&&(n.flags|=32),Aa}function va(n,s,r){(n===Bn&&(An===2||An===9)||n.cancelPendingCommit!==null)&&(au(n,0),Cl(n,Zt,Aa,!1)),Cn(n,r),((vn&2)===0||n!==Bn)&&(n===Bn&&((vn&2)===0&&(Oo|=r),ts===4&&Cl(n,Zt,Aa,!1)),Ki(n))}function d8(n,s,r){if((vn&6)!==0)throw Error(l(327));var c=!r&&(s&127)===0&&(s&n.expiredLanes)===0||It(n,s),d=c?r5(n,s):w1(n,s,!0),h=c;do{if(d===0){tu&&!c&&Cl(n,s,0,!1);break}else{if(r=n.current.alternate,h&&!a5(r)){d=w1(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 R=n;d=nf;var H=R.current.memoizedState.isDehydrated;if(H&&(au(R,x).flags|=256),x=w1(R,x,!1),x!==2){if(_1&&!H){R.errorRecoveryDisabledLanes|=h,Oo|=h,d=4;break e}h=ya,ya=d,h!==null&&(ya===null?ya=h:ya.push.apply(ya,h))}d=x}if(h=!1,d!==2)continue}}if(d===1){au(n,0),Cl(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:Cl(c,s,Aa,!wl);break e;case 2:ya=null;break;case 3:case 5:break;default:throw Error(l(329))}if((s&62914560)===s&&(d=Kh+300-ht(),10<d)){if(Cl(c,s,Aa,!wl),rt(c,0,!0)!==0)break e;Ar=s,c.timeoutHandle=$8(f8.bind(null,c,r,ya,Gh,v1,s,Aa,Oo,nu,wl,h,"Throttled",-0,0),d);break e}f8(c,r,ya,Gh,v1,s,Aa,Oo,nu,wl,h,null,-0,0)}}break}while(!0);Ki(n)}function f8(n,s,r,c,d,h,x,R,H,de,Ne,Me,fe,ye){if(n.timeoutHandle=-1,Me=s.subtreeFlags,Me&8192||(Me&16785408)===16785408){Me={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Gs},a8(s,h,Me);var et=(h&62914560)===h?Kh-ht():(h&4194048)===h?o8-ht():0;if(et=$5(Me,et),et!==null){Ar=h,n.cancelPendingCommit=et(b8.bind(null,n,s,h,r,c,d,x,R,H,Ne,Me,null,fe,ye)),Cl(n,h,x,!de);return}}b8(n,s,h,r,c,d,x,R,H)}function a5(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(!Gn(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 Cl(n,s,r,c){s&=~y1,s&=~Oo,n.suspendedLanes|=s,n.pingedLanes&=~s,c&&(n.warmLanes|=s),c=n.expirationTimes;for(var d=s;0<d;){var h=31-X(d),x=1<<h;c[h]=-1,d&=~x}r!==0&&na(n,r,s)}function Yh(){return(vn&6)===0?(af(0),!1):!0}function j1(){if(Gt!==null){if(An===0)var n=Gt.return;else n=Gt,gi=Pi=null,Gc(n),Sr=null,_l=0,n=Gt;for(;n!==null;)Fy(n.alternate,n),n=n.return;Gt=null}}function au(n,s){var r=n.timeoutHandle;r!==-1&&(n.timeoutHandle=-1,w5(r)),r=n.cancelPendingCommit,r!==null&&(n.cancelPendingCommit=null,r()),Ar=0,j1(),Bn=n,Gt=r=di(n.current,null),Zt=s,An=0,Ma=null,wl=!1,tu=It(n,s),_1=!1,nu=Aa=y1=Oo=Nl=ts=0,ya=nf=null,v1=!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-X(c),h=1<<d;s|=n[d],c&=~h}return Mr=s,Cc(),r}function h8(n,s){Ce=null,C.H=Gd,s===br||s===Uc?(s=Mh(),An=3):s===Pc?(s=Mh(),An=4):An=s===t1?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,Ma=s,Gt===null&&(ts=1,Uh(n,da(s,n.current)))}function m8(){var n=F.current;return n===null?!0:(Zt&4194048)===Zt?be===null:(Zt&62914560)===Zt||(Zt&536870912)!==0?n===be:!1}function p8(){var n=C.H;return C.H=Gd,n===null?Gd:n}function g8(){var n=C.A;return C.A=n5,n}function Vh(){ts=4,wl||(Zt&4194048)!==Zt&&F.current!==null||(tu=!0),(Nl&134217727)===0&&(Oo&134217727)===0||Bn===null||Cl(Bn,Zt,Aa,!1)}function w1(n,s,r){var c=vn;vn|=2;var d=p8(),h=g8();(Bn!==n||Zt!==s)&&(Gh=null,au(n,s)),s=!1;var x=ts;e:do try{if(An!==0&&Gt!==null){var R=Gt,H=Ma;switch(An){case 8:j1(),x=6;break e;case 3:case 2:case 9:case 6:F.current===null&&(s=!0);var de=An;if(An=0,Ma=null,iu(n,R,H,de),r&&tu){x=0;break e}break;default:de=An,An=0,Ma=null,iu(n,R,H,de)}}i5(),x=ts;break}catch(Ne){h8(n,Ne)}while(!0);return s&&n.shellSuspendCounter++,gi=Pi=null,vn=c,C.H=d,C.A=h,Gt===null&&(Bn=null,Zt=0,Cc()),x}function i5(){for(;Gt!==null;)_8(Gt)}function r5(n,s){var r=vn;vn|=2;var c=p8(),d=g8();Bn!==n||Zt!==s?(Gh=null,Qh=ht()+500,au(n,s)):tu=It(n,s);e:do try{if(An!==0&&Gt!==null){s=Gt;var h=Ma;t:switch(An){case 1:An=0,Ma=null,iu(n,s,h,1);break;case 2:case 9:if(Rh(h)){An=0,Ma=null,y8(s);break}s=function(){An!==2&&An!==9||Bn!==n||(An=7),Ki(n)},h.then(s,s);break e;case 3:An=7;break e;case 4:An=5;break e;case 7:Rh(h)?(An=0,Ma=null,y8(s)):(An=0,Ma=null,iu(n,s,h,7));break;case 5:var x=null;switch(Gt.tag){case 26:x=Gt.memoizedState;case 5:case 27:var R=Gt;if(x?sv(x):R.stateNode.complete){An=0,Ma=null;var H=R.sibling;if(H!==null)Gt=H;else{var de=R.return;de!==null?(Gt=de,Zh(de)):Gt=null}break t}}An=0,Ma=null,iu(n,s,h,5);break;case 6:An=0,Ma=null,iu(n,s,h,6);break;case 8:j1(),ts=6;break e;default:throw Error(l(462))}}l5();break}catch(Ne){h8(n,Ne)}while(!0);return gi=Pi=null,C.H=c,C.A=d,vn=r,Gt!==null?0:(Bn=null,Zt=0,Cc(),ts)}function l5(){for(;Gt!==null&&!kn();)_8(Gt)}function _8(n){var s=Hy(n.alternate,n,Mr);n.memoizedProps=n.pendingProps,s===null?Zh(n):Gt=s}function y8(n){var s=n,r=s.alternate;switch(s.tag){case 15:case 0:s=Iy(r,s,s.pendingProps,s.type,void 0,Zt);break;case 11:s=Iy(r,s,s.pendingProps,s.type.render,s.ref,Zt);break;case 5:Gc(s);default:Fy(r,s),s=Gt=Eh(s,Mr),s=Hy(r,s,Mr)}n.memoizedProps=n.pendingProps,s===null?Zh(n):Gt=s}function iu(n,s,r,c){gi=Pi=null,Gc(s),Sr=null,_l=0;var d=s.return;try{if(Yx(n,d,s,r,Zt)){ts=1,Uh(n,da(r,n.current)),Gt=null;return}}catch(h){if(d!==null)throw Gt=d,h;ts=1,Uh(n,da(r,n.current)),Gt=null;return}s.flags&32768?(Wt||c===1?n=!0:tu||(Zt&536870912)!==0?n=!1:(wl=n=!0,(c===2||c===9||c===3||c===6)&&(c=F.current,c!==null&&c.tag===13&&(c.flags|=16384))),v8(s,n)):Zh(s)}function Zh(n){var s=n;do{if((s.flags&32768)!==0){v8(s,wl);return}n=s.return;var r=Xx(s.alternate,s,Mr);if(r!==null){Gt=r;return}if(s=s.sibling,s!==null){Gt=s;return}Gt=s=n}while(s!==null);ts===0&&(ts=5)}function v8(n,s){do{var r=Jx(n.alternate,n);if(r!==null){r.flags&=32767,Gt=r;return}if(r=n.return,r!==null&&(r.flags|=32768,r.subtreeFlags=0,r.deletions=null),!s&&(n=n.sibling,n!==null)){Gt=n;return}Gt=n=r}while(n!==null);ts=6,Gt=null}function b8(n,s,r,c,d,h,x,R,H){n.cancelPendingCommit=null;do Xh();while(ys!==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|=Nd,hs(n,r,h,x,R,H),n===Bn&&(Gt=Bn=null,Zt=0),su=s,El=n,Ar=r,b1=h,x1=d,c8=c,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,d5(Bt,function(){return N8(),null})):(n.callbackNode=null,n.callbackPriority=0),c=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||c){c=C.T,C.T=null,d=q.p,q.p=2,x=vn,vn|=4;try{e5(n,s,r)}finally{vn=x,q.p=d,C.T=c}}ys=1,x8(),S8(),j8()}}function x8(){if(ys===1){ys=0;var n=El,s=su,r=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||r){r=C.T,C.T=null;var c=q.p;q.p=2;var d=vn;vn|=4;try{t8(s,n);var h=L1,x=vd(n.containerInfo),R=h.focusedElem,H=h.selectionRange;if(x!==R&&R&&R.ownerDocument&&_o(R.ownerDocument.documentElement,R)){if(H!==null&&cl(R)){var de=H.start,Ne=H.end;if(Ne===void 0&&(Ne=de),"selectionStart"in R)R.selectionStart=de,R.selectionEnd=Math.min(Ne,R.value.length);else{var Me=R.ownerDocument||document,fe=Me&&Me.defaultView||window;if(fe.getSelection){var ye=fe.getSelection(),et=R.textContent.length,_t=Math.min(H.start,et),Pn=H.end===void 0?_t:Math.min(H.end,et);!ye.extend&&_t>Pn&&(x=Pn,Pn=_t,_t=x);var ne=is(R,_t),K=is(R,Pn);if(ne&&K&&(ye.rangeCount!==1||ye.anchorNode!==ne.node||ye.anchorOffset!==ne.offset||ye.focusNode!==K.node||ye.focusOffset!==K.offset)){var ce=Me.createRange();ce.setStart(ne.node,ne.offset),ye.removeAllRanges(),_t>Pn?(ye.addRange(ce),ye.extend(K.node,K.offset)):(ce.setEnd(K.node,K.offset),ye.addRange(ce))}}}}for(Me=[],ye=R;ye=ye.parentNode;)ye.nodeType===1&&Me.push({element:ye,left:ye.scrollLeft,top:ye.scrollTop});for(typeof R.focus=="function"&&R.focus(),R=0;R<Me.length;R++){var Te=Me[R];Te.element.scrollLeft=Te.left,Te.element.scrollTop=Te.top}}um=!!I1,L1=I1=null}finally{vn=d,q.p=c,C.T=r}}n.current=s,ys=2}}function S8(){if(ys===2){ys=0;var n=El,s=su,r=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||r){r=C.T,C.T=null;var c=q.p;q.p=2;var d=vn;vn|=4;try{Vy(n,s.alternate,s)}finally{vn=d,q.p=c,C.T=r}}ys=3}}function j8(){if(ys===4||ys===3){ys=0,En();var n=El,s=su,r=Ar,c=c8;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?ys=5:(ys=0,su=El=null,w8(n,n.pendingLanes));var d=n.pendingLanes;if(d===0&&(kl=null),Na(r),s=s.stateNode,_e&&typeof _e.onCommitFiberRoot=="function")try{_e.onCommitFiberRoot(ut,s,void 0,(s.current.flags&128)===128)}catch{}if(c!==null){s=C.T,d=q.p,q.p=2,C.T=null;try{for(var h=n.onRecoverableError,x=0;x<c.length;x++){var R=c[x];h(R.value,{componentStack:R.stack})}}finally{C.T=s,q.p=d}}(Ar&3)!==0&&Xh(),Ki(n),d=n.pendingLanes,(r&261930)!==0&&(d&42)!==0?n===S1?sf++:(sf=0,S1=n):sf=0,af(0)}}function w8(n,s){(n.pooledCacheLanes&=s)===0&&(s=n.pooledCache,s!=null&&(n.pooledCache=null,So(s)))}function Xh(){return x8(),S8(),j8(),N8()}function N8(){if(ys!==5)return!1;var n=El,s=b1;b1=0;var r=Na(Ar),c=C.T,d=q.p;try{q.p=32>r?32:r,C.T=null,r=x1,x1=null;var h=El,x=Ar;if(ys=0,su=El=null,Ar=0,(vn&6)!==0)throw Error(l(331));var R=vn;if(vn|=4,r8(h.current),s8(h,h.current,x,r),vn=R,af(0,!1),_e&&typeof _e.onPostCommitFiberRoot=="function")try{_e.onPostCommitFiberRoot(ut,h)}catch{}return!0}finally{q.p=d,C.T=c,w8(n,s)}}function k8(n,s,r){s=da(r,s),s=e1(n.stateNode,s,2),n=xi(n,s,2),n!==null&&(Cn(n,2),Ki(n))}function Dn(n,s,r){if(n.tag===3)k8(n,n,r);else for(;s!==null;){if(s.tag===3){k8(s,n,r);break}else if(s.tag===1){var c=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(kl===null||!kl.has(c))){n=da(r,n),r=Ey(2),c=xi(s,r,2),c!==null&&(Cy(r,c,s,n),Cn(c,2),Ki(c));break}}s=s.return}}function N1(n,s,r){var c=n.pingCache;if(c===null){c=n.pingCache=new s5;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)||(_1=!0,d.add(r),n=o5.bind(null,n,s,r),s.then(n,n))}function o5(n,s,r){var c=n.pingCache;c!==null&&c.delete(s),n.pingedLanes|=n.suspendedLanes&r,n.warmLanes&=~r,Bn===n&&(Zt&r)===r&&(ts===4||ts===3&&(Zt&62914560)===Zt&&300>ht()-Kh?(vn&2)===0&&au(n,0):y1|=r,nu===Zt&&(nu=0)),Ki(n)}function E8(n,s){s===0&&(s=Le()),n=mr(n,s),n!==null&&(Cn(n,s),Ki(n))}function c5(n){var s=n.memoizedState,r=0;s!==null&&(r=s.retryLane),E8(n,r)}function u5(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),E8(n,r)}function d5(n,s){return ln(n,s)}var Jh=null,ru=null,k1=!1,em=!1,E1=!1,Tl=0;function Ki(n){n!==ru&&n.next===null&&(ru===null?Jh=ru=n:ru=ru.next=n),em=!0,k1||(k1=!0,h5())}function af(n,s){if(!E1&&em){E1=!0;do for(var r=!1,c=Jh;c!==null;){if(n!==0){var d=c.pendingLanes;if(d===0)var h=0;else{var x=c.suspendedLanes,R=c.pingedLanes;h=(1<<31-X(42|n)+1)-1,h&=d&~(x&~R),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(r=!0,M8(c,h))}else h=Zt,h=rt(c,c===Bn?h:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(h&3)===0||It(c,h)||(r=!0,M8(c,h));c=c.next}while(r);E1=!1}}function f5(){C8()}function C8(){em=k1=!1;var n=0;Tl!==0&&j5()&&(n=Tl);for(var s=ht(),r=null,c=Jh;c!==null;){var d=c.next,h=T8(c,s);h===0?(c.next=null,r===null?Jh=d:r.next=d,d===null&&(ru=r)):(r=c,(n!==0||(h&3)!==0)&&(em=!0)),c=d}ys!==0&&ys!==5||af(n),Tl!==0&&(Tl=0)}function T8(n,s){for(var r=n.suspendedLanes,c=n.pingedLanes,d=n.expirationTimes,h=n.pendingLanes&-62914561;0<h;){var x=31-X(h),R=1<<x,H=d[x];H===-1?((R&r)===0||(R&c)!==0)&&(d[x]=Ft(R,s)):H<=s&&(n.expiredLanes|=R),h&=~R}if(s=Bn,r=Zt,r=rt(n,n===s?r:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),c=n.callbackNode,r===0||n===s&&(An===2||An===9)||n.cancelPendingCommit!==null)return c!==null&&c!==null&&on(c),n.callbackNode=null,n.callbackPriority=0;if((r&3)===0||It(n,r)){if(s=r&-r,s===n.callbackPriority)return s;switch(c!==null&&on(c),Na(r)){case 2:case 8:r=Nt;break;case 32:r=Bt;break;case 268435456:r=Dt;break;default:r=Bt}return c=R8.bind(null,n),r=ln(r,c),n.callbackPriority=s,n.callbackNode=r,s}return c!==null&&c!==null&&on(c),n.callbackPriority=2,n.callbackNode=null,2}function R8(n,s){if(ys!==0&&ys!==5)return n.callbackNode=null,n.callbackPriority=0,null;var r=n.callbackNode;if(Xh()&&n.callbackNode!==r)return null;var c=Zt;return c=rt(n,n===Bn?c:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),c===0?null:(d8(n,c,s),T8(n,ht()),n.callbackNode!=null&&n.callbackNode===r?R8.bind(null,n):null)}function M8(n,s){if(Xh())return null;d8(n,s,!0)}function h5(){N5(function(){(vn&6)!==0?ln(Ke,f5):C8()})}function C1(){if(Tl===0){var n=gl;n===0&&(n=we,we<<=1,(we&261888)===0&&(we=256)),Tl=n}return Tl}function A8(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:ni(""+n)}function D8(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 m5(n,s,r,c,d){if(s==="submit"&&r&&r.stateNode===d){var h=A8((d[Un]||null).action),x=c.submitter;x&&(s=(s=x[Un]||null)?A8(s.formAction):x.getAttribute("formAction"),s!==null&&(h=s,x=null));var R=new Ei("action","action",null,c,d);n.push({event:R,listeners:[{instance:null,listener:function(){if(c.defaultPrevented){if(Tl!==0){var H=x?D8(d,x):new FormData(d);Gp(r,{pending:!0,data:H,method:d.method,action:h},null,H)}}else typeof h=="function"&&(R.preventDefault(),H=x?D8(d,x):new FormData(d),Gp(r,{pending:!0,data:H,method:d.method,action:h},h,H))},currentTarget:d}]})}}for(var T1=0;T1<ui.length;T1++){var R1=ui[T1],p5=R1.toLowerCase(),g5=R1[0].toUpperCase()+R1.slice(1);Ta(p5,"on"+g5)}Ta(jd,"onAnimationEnd"),Ta(vo,"onAnimationIteration"),Ta(kc,"onAnimationStart"),Ta("dblclick","onDoubleClick"),Ta("focusin","onFocus"),Ta("focusout","onBlur"),Ta(Sh,"onTransitionRun"),Ta(jh,"onTransitionStart"),Ta(wh,"onTransitionCancel"),Ta(wd,"onTransitionEnd"),Ye("onMouseEnter",["mouseout","mouseover"]),Ye("onMouseLeave",["mouseout","mouseover"]),Ye("onPointerEnter",["pointerout","pointerover"]),Ye("onPointerLeave",["pointerout","pointerover"]),Je("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Je("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Je("onBeforeInput",["compositionend","keypress","textInput","paste"]),Je("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Je("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Je("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var rf="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(" "),_5=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(rf));function O8(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 R=c[x],H=R.instance,de=R.currentTarget;if(R=R.listener,H!==h&&d.isPropagationStopped())break e;h=R,d.currentTarget=de;try{h(d)}catch(Ne){Ec(Ne)}d.currentTarget=null,h=H}else for(x=0;x<c.length;x++){if(R=c[x],H=R.instance,de=R.currentTarget,R=R.listener,H!==h&&d.isPropagationStopped())break e;h=R,d.currentTarget=de;try{h(d)}catch(Ne){Ec(Ne)}d.currentTarget=null,h=H}}}}function Yt(n,s){var r=s[Ps];r===void 0&&(r=s[Ps]=new Set);var c=n+"__bubble";r.has(c)||(I8(s,n,2,!1),r.add(c))}function M1(n,s,r){var c=0;s&&(c|=4),I8(r,n,c,s)}var tm="_reactListening"+Math.random().toString(36).slice(2);function A1(n){if(!n[tm]){n[tm]=!0,Pe.forEach(function(r){r!=="selectionchange"&&(_5.has(r)||M1(r,!1,n),M1(r,!0,n))});var s=n.nodeType===9?n:n.ownerDocument;s===null||s[tm]||(s[tm]=!0,M1("selectionchange",!1,s))}}function I8(n,s,r,c){switch(uv(s)){case 2:var d=W5;break;case 8:d=K5;break;default:d=Q1}r=d.bind(null,s,r,n),d=void 0,!ar||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 D1(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 R=c.stateNode.containerInfo;if(R===d)break;if(x===4)for(x=c.return;x!==null;){var H=x.tag;if((H===3||H===4)&&x.stateNode.containerInfo===d)return;x=x.return}for(;R!==null;){if(x=J(R),x===null)return;if(H=x.tag,H===5||H===6||H===26||H===27){c=h=x;continue e}R=R.parentNode}}c=c.return}ri(function(){var de=h,Ne=ai(r),Me=[];e:{var fe=Nh.get(n);if(fe!==void 0){var ye=Ei,et=n;switch(n){case"keypress":if(rr(r)===0)break e;case"keydown":case"keyup":ye=Pp;break;case"focusin":et="focus",ye=la;break;case"focusout":et="blur",ye=la;break;case"beforeblur":case"afterblur":ye=la;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":ye=oi;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ye=Sn;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ye=sl;break;case jd:case vo:case kc:ye=tn;break;case wd:ye=bc;break;case"scroll":case"scrollend":ye=uo;break;case"wheel":ye=vh;break;case"copy":case"cut":case"paste":ye=yc;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ye=_h;break;case"toggle":case"beforetoggle":ye=bh}var _t=(s&4)!==0,Pn=!_t&&(n==="scroll"||n==="scrollend"),ne=_t?fe!==null?fe+"Capture":null:fe;_t=[];for(var K=de,ce;K!==null;){var Te=K;if(ce=Te.stateNode,Te=Te.tag,Te!==5&&Te!==26&&Te!==27||ce===null||ne===null||(Te=Ds(K,ne),Te!=null&&_t.push(lf(K,Te,ce))),Pn)break;K=K.return}0<_t.length&&(fe=new ye(fe,et,null,r,Ne),Me.push({event:fe,listeners:_t}))}}if((s&7)===0){e:{if(fe=n==="mouseover"||n==="pointerover",ye=n==="mouseout"||n==="pointerout",fe&&r!==si&&(et=r.relatedTarget||r.fromElement)&&(J(et)||et[ps]))break e;if((ye||fe)&&(fe=Ne.window===Ne?Ne:(fe=Ne.ownerDocument)?fe.defaultView||fe.parentWindow:window,ye?(et=r.relatedTarget||r.toElement,ye=de,et=et?J(et):null,et!==null&&(Pn=u(et),_t=et.tag,et!==Pn||_t!==5&&_t!==27&&_t!==6)&&(et=null)):(ye=null,et=de),ye!==et)){if(_t=oi,Te="onMouseLeave",ne="onMouseEnter",K="mouse",(n==="pointerout"||n==="pointerover")&&(_t=_h,Te="onPointerLeave",ne="onPointerEnter",K="pointer"),Pn=ye==null?fe:G(ye),ce=et==null?fe:G(et),fe=new _t(Te,K+"leave",ye,r,Ne),fe.target=Pn,fe.relatedTarget=ce,Te=null,J(Ne)===de&&(_t=new _t(ne,K+"enter",et,r,Ne),_t.target=ce,_t.relatedTarget=Pn,Te=_t),Pn=Te,ye&&et)t:{for(_t=y5,ne=ye,K=et,ce=0,Te=ne;Te;Te=_t(Te))ce++;Te=0;for(var ft=K;ft;ft=_t(ft))Te++;for(;0<ce-Te;)ne=_t(ne),ce--;for(;0<Te-ce;)K=_t(K),Te--;for(;ce--;){if(ne===K||K!==null&&ne===K.alternate){_t=ne;break t}ne=_t(ne),K=_t(K)}_t=null}else _t=null;ye!==null&&L8(Me,fe,ye,_t,!1),et!==null&&Pn!==null&&L8(Me,Pn,et,_t,!0)}}e:{if(fe=de?G(de):window,ye=fe.nodeName&&fe.nodeName.toLowerCase(),ye==="select"||ye==="input"&&fe.type==="file")var fn=ll;else if(po(fe))if(_d)fn=wc;else{fn=jc;var lt=Xn}else ye=fe.nodeName,!ye||ye.toLowerCase()!=="input"||fe.type!=="checkbox"&&fe.type!=="radio"?de&&ka(de.elementType)&&(fn=ll):fn=Ys;if(fn&&(fn=fn(n,de))){Ri(Me,fn,r,Ne);break e}lt&<(n,fe,de),n==="focusout"&&de&&fe.type==="number"&&de.memoizedProps.value!=null&&cn(fe,"number",fe.value)}switch(lt=de?G(de):window,n){case"focusin":(po(lt)||lt.contentEditable==="true")&&(dr=lt,fr=de,Oi=null);break;case"focusout":Oi=fr=dr=null;break;case"mousedown":xd=!0;break;case"contextmenu":case"mouseup":case"dragend":xd=!1,Sd(Me,r,Ne);break;case"selectionchange":if(bd)break;case"keydown":case"keyup":Sd(Me,r,Ne)}var Ot;if(or)e:{switch(n){case"compositionstart":var Xt="onCompositionStart";break e;case"compositionend":Xt="onCompositionEnd";break e;case"compositionupdate":Xt="onCompositionUpdate";break e}Xt=void 0}else al?Sc(n,r)&&(Xt="onCompositionEnd"):n==="keydown"&&r.keyCode===229&&(Xt="onCompositionStart");Xt&&(mo&&r.locale!=="ko"&&(al||Xt!=="onCompositionStart"?Xt==="onCompositionEnd"&&al&&(Ot=Xr()):(Ea=Ne,ir="value"in Ea?Ea.value:Ea.textContent,al=!0)),lt=nm(de,Xt),0<lt.length&&(Xt=new dd(Xt,n,null,r,Ne),Me.push({event:Xt,listeners:lt}),Ot?Xt.data=Ot:(Ot=gd(r),Ot!==null&&(Xt.data=Ot)))),(Ot=Up?il(n,r):Ua(n,r))&&(Xt=nm(de,"onBeforeInput"),0<Xt.length&&(lt=new dd("onBeforeInput","beforeinput",null,r,Ne),Me.push({event:lt,listeners:Xt}),lt.data=Ot)),m5(Me,n,de,r,Ne)}O8(Me,s)})}function lf(n,s,r){return{instance:n,listener:s,currentTarget:r}}function nm(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=Ds(n,r),d!=null&&c.unshift(lf(n,d,h)),d=Ds(n,s),d!=null&&c.push(lf(n,d,h))),n.tag===3)return c;n=n.return}return[]}function y5(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function L8(n,s,r,c,d){for(var h=s._reactName,x=[];r!==null&&r!==c;){var R=r,H=R.alternate,de=R.stateNode;if(R=R.tag,H!==null&&H===c)break;R!==5&&R!==26&&R!==27||de===null||(H=de,d?(de=Ds(r,h),de!=null&&x.unshift(lf(r,de,H))):d||(de=Ds(r,h),de!=null&&x.push(lf(r,de,H)))),r=r.return}x.length!==0&&n.push({event:s,listeners:x})}var v5=/\r\n?/g,b5=/\u0000|\uFFFD/g;function P8(n){return(typeof n=="string"?n:""+n).replace(v5,`
|
|
50
|
+
`).replace(b5,"")}function U8(n,s){return s=P8(s),P8(n)===s}function Ln(n,s,r,c,d,h){switch(r){case"children":typeof c=="string"?s==="body"||s==="textarea"&&c===""||Ks(n,c):(typeof c=="number"||typeof c=="bigint")&&s!=="body"&&Ks(n,""+c);break;case"className":Tn(n,"class",c);break;case"tabIndex":Tn(n,"tabindex",c);break;case"dir":case"role":case"viewBox":case"width":case"height":Tn(n,r,c);break;case"style":Qs(n,c,h);break;case"data":if(s!=="object"){Tn(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=ni(""+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"&&Ln(n,s,"name",d.name,d,null),Ln(n,s,"formEncType",d.formEncType,d,null),Ln(n,s,"formMethod",d.formMethod,d,null),Ln(n,s,"formTarget",d.formTarget,d,null)):(Ln(n,s,"encType",d.encType,d,null),Ln(n,s,"method",d.method,d,null),Ln(n,s,"target",d.target,d,null)));if(c==null||typeof c=="symbol"||typeof c=="boolean"){n.removeAttribute(r);break}c=ni(""+c),n.setAttribute(r,c);break;case"onClick":c!=null&&(n.onclick=Gs);break;case"onScroll":c!=null&&Yt("scroll",n);break;case"onScrollEnd":c!=null&&Yt("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=ni(""+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":Yt("beforetoggle",n),Yt("toggle",n),bn(n,"popover",c);break;case"xlinkActuate":xn(n,"http://www.w3.org/1999/xlink","xlink:actuate",c);break;case"xlinkArcrole":xn(n,"http://www.w3.org/1999/xlink","xlink:arcrole",c);break;case"xlinkRole":xn(n,"http://www.w3.org/1999/xlink","xlink:role",c);break;case"xlinkShow":xn(n,"http://www.w3.org/1999/xlink","xlink:show",c);break;case"xlinkTitle":xn(n,"http://www.w3.org/1999/xlink","xlink:title",c);break;case"xlinkType":xn(n,"http://www.w3.org/1999/xlink","xlink:type",c);break;case"xmlBase":xn(n,"http://www.w3.org/XML/1998/namespace","xml:base",c);break;case"xmlLang":xn(n,"http://www.w3.org/XML/1998/namespace","xml:lang",c);break;case"xmlSpace":xn(n,"http://www.w3.org/XML/1998/namespace","xml:space",c);break;case"is":bn(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=ti.get(r)||r,bn(n,r,c))}}function O1(n,s,r,c,d,h){switch(r){case"style":Qs(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"?Ks(n,c):(typeof c=="number"||typeof c=="bigint")&&Ks(n,""+c);break;case"onScroll":c!=null&&Yt("scroll",n);break;case"onScrollEnd":c!=null&&Yt("scrollend",n);break;case"onClick":c!=null&&(n.onclick=Gs);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!$e.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[Un]||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,""):bn(n,r,c)}}}function Is(n,s,r){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Yt("error",n),Yt("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:Ln(n,s,h,x,r,null)}}d&&Ln(n,s,"srcSet",r.srcSet,r,null),c&&Ln(n,s,"src",r.src,r,null);return;case"input":Yt("invalid",n);var R=h=x=d=null,H=null,de=null;for(c in r)if(r.hasOwnProperty(c)){var Ne=r[c];if(Ne!=null)switch(c){case"name":d=Ne;break;case"type":x=Ne;break;case"checked":H=Ne;break;case"defaultChecked":de=Ne;break;case"value":h=Ne;break;case"defaultValue":R=Ne;break;case"children":case"dangerouslySetInnerHTML":if(Ne!=null)throw Error(l(137,s));break;default:Ln(n,s,c,Ne,r,null)}}Ht(n,h,R,H,de,x,d,!1);return;case"select":Yt("invalid",n),c=x=h=null;for(d in r)if(r.hasOwnProperty(d)&&(R=r[d],R!=null))switch(d){case"value":h=R;break;case"defaultValue":x=R;break;case"multiple":c=R;default:Ln(n,s,d,R,r,null)}s=h,r=x,n.multiple=!!c,s!=null?mt(n,!!c,s,!1):r!=null&&mt(n,!!c,r,!0);return;case"textarea":Yt("invalid",n),h=d=c=null;for(x in r)if(r.hasOwnProperty(x)&&(R=r[x],R!=null))switch(x){case"value":c=R;break;case"defaultValue":d=R;break;case"children":h=R;break;case"dangerouslySetInnerHTML":if(R!=null)throw Error(l(91));break;default:Ln(n,s,x,R,r,null)}Rn(n,c,d,h);return;case"option":for(H in r)if(r.hasOwnProperty(H)&&(c=r[H],c!=null))switch(H){case"selected":n.selected=c&&typeof c!="function"&&typeof c!="symbol";break;default:Ln(n,s,H,c,r,null)}return;case"dialog":Yt("beforetoggle",n),Yt("toggle",n),Yt("cancel",n),Yt("close",n);break;case"iframe":case"object":Yt("load",n);break;case"video":case"audio":for(c=0;c<rf.length;c++)Yt(rf[c],n);break;case"image":Yt("error",n),Yt("load",n);break;case"details":Yt("toggle",n);break;case"embed":case"source":case"link":Yt("error",n),Yt("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(de in r)if(r.hasOwnProperty(de)&&(c=r[de],c!=null))switch(de){case"children":case"dangerouslySetInnerHTML":throw Error(l(137,s));default:Ln(n,s,de,c,r,null)}return;default:if(ka(s)){for(Ne in r)r.hasOwnProperty(Ne)&&(c=r[Ne],c!==void 0&&O1(n,s,Ne,c,r,void 0));return}}for(R in r)r.hasOwnProperty(R)&&(c=r[R],c!=null&&Ln(n,s,R,c,r,null))}function x5(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,R=null,H=null,de=null,Ne=null;for(ye in r){var Me=r[ye];if(r.hasOwnProperty(ye)&&Me!=null)switch(ye){case"checked":break;case"value":break;case"defaultValue":H=Me;default:c.hasOwnProperty(ye)||Ln(n,s,ye,null,c,Me)}}for(var fe in c){var ye=c[fe];if(Me=r[fe],c.hasOwnProperty(fe)&&(ye!=null||Me!=null))switch(fe){case"type":h=ye;break;case"name":d=ye;break;case"checked":de=ye;break;case"defaultChecked":Ne=ye;break;case"value":x=ye;break;case"defaultValue":R=ye;break;case"children":case"dangerouslySetInnerHTML":if(ye!=null)throw Error(l(137,s));break;default:ye!==Me&&Ln(n,s,fe,ye,c,Me)}}tt(n,x,R,H,de,Ne,h,d);return;case"select":ye=x=R=fe=null;for(h in r)if(H=r[h],r.hasOwnProperty(h)&&H!=null)switch(h){case"value":break;case"multiple":ye=H;default:c.hasOwnProperty(h)||Ln(n,s,h,null,c,H)}for(d in c)if(h=c[d],H=r[d],c.hasOwnProperty(d)&&(h!=null||H!=null))switch(d){case"value":fe=h;break;case"defaultValue":R=h;break;case"multiple":x=h;default:h!==H&&Ln(n,s,d,h,c,H)}s=R,r=x,c=ye,fe!=null?mt(n,!!r,fe,!1):!!c!=!!r&&(s!=null?mt(n,!!r,s,!0):mt(n,!!r,r?[]:"",!1));return;case"textarea":ye=fe=null;for(R in r)if(d=r[R],r.hasOwnProperty(R)&&d!=null&&!c.hasOwnProperty(R))switch(R){case"value":break;case"children":break;default:Ln(n,s,R,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":fe=d;break;case"defaultValue":ye=d;break;case"children":break;case"dangerouslySetInnerHTML":if(d!=null)throw Error(l(91));break;default:d!==h&&Ln(n,s,x,d,c,h)}St(n,fe,ye);return;case"option":for(var et in r)if(fe=r[et],r.hasOwnProperty(et)&&fe!=null&&!c.hasOwnProperty(et))switch(et){case"selected":n.selected=!1;break;default:Ln(n,s,et,null,c,fe)}for(H in c)if(fe=c[H],ye=r[H],c.hasOwnProperty(H)&&fe!==ye&&(fe!=null||ye!=null))switch(H){case"selected":n.selected=fe&&typeof fe!="function"&&typeof fe!="symbol";break;default:Ln(n,s,H,fe,c,ye)}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 _t in r)fe=r[_t],r.hasOwnProperty(_t)&&fe!=null&&!c.hasOwnProperty(_t)&&Ln(n,s,_t,null,c,fe);for(de in c)if(fe=c[de],ye=r[de],c.hasOwnProperty(de)&&fe!==ye&&(fe!=null||ye!=null))switch(de){case"children":case"dangerouslySetInnerHTML":if(fe!=null)throw Error(l(137,s));break;default:Ln(n,s,de,fe,c,ye)}return;default:if(ka(s)){for(var Pn in r)fe=r[Pn],r.hasOwnProperty(Pn)&&fe!==void 0&&!c.hasOwnProperty(Pn)&&O1(n,s,Pn,void 0,c,fe);for(Ne in c)fe=c[Ne],ye=r[Ne],!c.hasOwnProperty(Ne)||fe===ye||fe===void 0&&ye===void 0||O1(n,s,Ne,fe,c,ye);return}}for(var ne in r)fe=r[ne],r.hasOwnProperty(ne)&&fe!=null&&!c.hasOwnProperty(ne)&&Ln(n,s,ne,null,c,fe);for(Me in c)fe=c[Me],ye=r[Me],!c.hasOwnProperty(Me)||fe===ye||fe==null&&ye==null||Ln(n,s,Me,fe,c,ye)}function z8(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function S5(){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,R=d.duration;if(h&&R&&z8(x)){for(x=0,R=d.responseEnd,c+=1;c<r.length;c++){var H=r[c],de=H.startTime;if(de>R)break;var Ne=H.transferSize,Me=H.initiatorType;Ne&&z8(Me)&&(H=H.responseEnd,x+=Ne*(H<R?1:(R-de)/(H-de)))}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 I1=null,L1=null;function sm(n){return n.nodeType===9?n:n.ownerDocument}function B8(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 H8(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 P1(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 U1=null;function j5(){var n=window.event;return n&&n.type==="popstate"?n===U1?!1:(U1=n,!0):(U1=null,!1)}var $8=typeof setTimeout=="function"?setTimeout:void 0,w5=typeof clearTimeout=="function"?clearTimeout:void 0,F8=typeof Promise=="function"?Promise:void 0,N5=typeof queueMicrotask=="function"?queueMicrotask:typeof F8<"u"?function(n){return F8.resolve(null).then(n).catch(k5)}:$8;function k5(n){setTimeout(function(){throw n})}function Rl(n){return n==="head"}function q8(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),uu(s);return}c--}else if(r==="$"||r==="$?"||r==="$~"||r==="$!"||r==="&")c++;else if(r==="html")of(n.ownerDocument.documentElement);else if(r==="head"){r=n.ownerDocument.head,of(r);for(var h=r.firstChild;h;){var x=h.nextSibling,R=h.nodeName;h[As]||R==="SCRIPT"||R==="STYLE"||R==="LINK"&&h.rel.toLowerCase()==="stylesheet"||r.removeChild(h),h=x}}else r==="body"&&of(n.ownerDocument.body);r=d}while(r);uu(s)}function W8(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 z1(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":z1(r),Rt(r);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(r.rel.toLowerCase()==="stylesheet")continue}n.removeChild(r)}}function E5(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[As])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=Wa(n.nextSibling),n===null)break}return null}function C5(n,s,r){if(s==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!r||(n=Wa(n.nextSibling),n===null))return null;return n}function K8(n,s){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!s||(n=Wa(n.nextSibling),n===null))return null;return n}function B1(n){return n.data==="$?"||n.data==="$~"}function H1(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function T5(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 Wa(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 $1=null;function Q8(n){n=n.nextSibling;for(var s=0;n;){if(n.nodeType===8){var r=n.data;if(r==="/$"||r==="/&"){if(s===0)return Wa(n.nextSibling);s--}else r!=="$"&&r!=="$!"&&r!=="$?"&&r!=="$~"&&r!=="&"||s++}n=n.nextSibling}return null}function G8(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 Y8(n,s,r){switch(s=sm(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 of(n){for(var s=n.attributes;s.length;)n.removeAttributeNode(s[0]);Rt(n)}var Ka=new Map,V8=new Set;function am(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var Dr=q.d;q.d={f:R5,r:M5,D:A5,C:D5,L:O5,m:I5,X:P5,S:L5,M:U5};function R5(){var n=Dr.f(),s=Yh();return n||s}function M5(n){var s=M(n);s!==null&&s.tag===5&&s.type==="form"?hy(s):Dr.r(n)}var lu=typeof document>"u"?null:document;function Z8(n,s,r){var c=lu;if(c&&typeof s=="string"&&s){var d=le(s);d='link[rel="'+n+'"][href="'+d+'"]',typeof r=="string"&&(d+='[crossorigin="'+r+'"]'),V8.has(d)||(V8.add(d),n={rel:n,crossOrigin:r,href:s},c.querySelector(d)===null&&(s=c.createElement("link"),Is(s,"link",n),De(s),c.head.appendChild(s)))}}function A5(n){Dr.D(n),Z8("dns-prefetch",n,null)}function D5(n,s){Dr.C(n,s),Z8("preconnect",n,s)}function O5(n,s,r){Dr.L(n,s,r);var c=lu;if(c&&n&&s){var d='link[rel="preload"][as="'+le(s)+'"]';s==="image"&&r&&r.imageSrcSet?(d+='[imagesrcset="'+le(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(d+='[imagesizes="'+le(r.imageSizes)+'"]')):d+='[href="'+le(n)+'"]';var h=d;switch(s){case"style":h=ou(n);break;case"script":h=cu(n)}Ka.has(h)||(n=p({rel:"preload",href:s==="image"&&r&&r.imageSrcSet?void 0:n,as:s},r),Ka.set(h,n),c.querySelector(d)!==null||s==="style"&&c.querySelector(cf(h))||s==="script"&&c.querySelector(uf(h))||(s=c.createElement("link"),Is(s,"link",n),De(s),c.head.appendChild(s)))}}function I5(n,s){Dr.m(n,s);var r=lu;if(r&&n){var c=s&&typeof s.as=="string"?s.as:"script",d='link[rel="modulepreload"][as="'+le(c)+'"][href="'+le(n)+'"]',h=d;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=cu(n)}if(!Ka.has(h)&&(n=p({rel:"modulepreload",href:n},s),Ka.set(h,n),r.querySelector(d)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(uf(h)))return}c=r.createElement("link"),Is(c,"link",n),De(c),r.head.appendChild(c)}}}function L5(n,s,r){Dr.S(n,s,r);var c=lu;if(c&&n){var d=Ee(c).hoistableStyles,h=ou(n);s=s||"default";var x=d.get(h);if(!x){var R={loading:0,preload:null};if(x=c.querySelector(cf(h)))R.loading=5;else{n=p({rel:"stylesheet",href:n,"data-precedence":s},r),(r=Ka.get(h))&&F1(n,r);var H=x=c.createElement("link");De(H),Is(H,"link",n),H._p=new Promise(function(de,Ne){H.onload=de,H.onerror=Ne}),H.addEventListener("load",function(){R.loading|=1}),H.addEventListener("error",function(){R.loading|=2}),R.loading|=4,im(x,s,c)}x={type:"stylesheet",instance:x,count:1,state:R},d.set(h,x)}}}function P5(n,s){Dr.X(n,s);var r=lu;if(r&&n){var c=Ee(r).hoistableScripts,d=cu(n),h=c.get(d);h||(h=r.querySelector(uf(d)),h||(n=p({src:n,async:!0},s),(s=Ka.get(d))&&q1(n,s),h=r.createElement("script"),De(h),Is(h,"link",n),r.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},c.set(d,h))}}function U5(n,s){Dr.M(n,s);var r=lu;if(r&&n){var c=Ee(r).hoistableScripts,d=cu(n),h=c.get(d);h||(h=r.querySelector(uf(d)),h||(n=p({src:n,async:!0,type:"module"},s),(s=Ka.get(d))&&q1(n,s),h=r.createElement("script"),De(h),Is(h,"link",n),r.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},c.set(d,h))}}function X8(n,s,r,c){var d=(d=Z.current)?am(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=ou(r.href),r=Ee(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=ou(r.href);var h=Ee(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(cf(n)))&&!h._p&&(x.instance=h,x.state.loading=5),Ka.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},Ka.set(n,r),h||z5(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=cu(r),r=Ee(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 ou(n){return'href="'+le(n)+'"'}function cf(n){return'link[rel="stylesheet"]['+n+"]"}function J8(n){return p({},n,{"data-precedence":n.precedence,precedence:null})}function z5(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}),Is(s,"link",r),De(s),n.head.appendChild(s))}function cu(n){return'[src="'+le(n)+'"]'}function uf(n){return"script[async]"+n}function ev(n,s,r){if(s.count++,s.instance===null)switch(s.type){case"style":var c=n.querySelector('style[data-href~="'+le(r.href)+'"]');if(c)return s.instance=c,De(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"),De(c),Is(c,"style",d),im(c,r.precedence,n),s.instance=c;case"stylesheet":d=ou(r.href);var h=n.querySelector(cf(d));if(h)return s.state.loading|=4,s.instance=h,De(h),h;c=J8(r),(d=Ka.get(d))&&F1(c,d),h=(n.ownerDocument||n).createElement("link"),De(h);var x=h;return x._p=new Promise(function(R,H){x.onload=R,x.onerror=H}),Is(h,"link",c),s.state.loading|=4,im(h,r.precedence,n),s.instance=h;case"script":return h=cu(r.src),(d=n.querySelector(uf(h)))?(s.instance=d,De(d),d):(c=r,(d=Ka.get(h))&&(c=p({},r),q1(c,d)),n=n.ownerDocument||n,d=n.createElement("script"),De(d),Is(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,im(c,r.precedence,n));return s.instance}function im(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 R=c[x];if(R.dataset.precedence===s)h=R;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 F1(n,s){n.crossOrigin==null&&(n.crossOrigin=s.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=s.referrerPolicy),n.title==null&&(n.title=s.title)}function q1(n,s){n.crossOrigin==null&&(n.crossOrigin=s.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=s.referrerPolicy),n.integrity==null&&(n.integrity=s.integrity)}var rm=null;function tv(n,s,r){if(rm===null){var c=new Map,d=rm=new Map;d.set(r,c)}else d=rm,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[As]||h[pn]||n==="link"&&h.getAttribute("rel")==="stylesheet")&&h.namespaceURI!=="http://www.w3.org/2000/svg"){var x=h.getAttribute(s)||"";x=n+x;var R=c.get(x);R?R.push(h):c.set(x,[h])}}return c}function nv(n,s,r){n=n.ownerDocument||n,n.head.insertBefore(r,s==="title"?n.querySelector("head > title"):null)}function B5(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 sv(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function H5(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=ou(c.href),h=s.querySelector(cf(d));if(h){s=h._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(n.count++,n=lm.bind(n),s.then(n,n)),r.state.loading|=4,r.instance=h,De(h);return}h=s.ownerDocument||s,c=J8(c),(d=Ka.get(d))&&F1(c,d),h=h.createElement("link"),De(h);var x=h;x._p=new Promise(function(R,H){x.onload=R,x.onerror=H}),Is(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=lm.bind(n),s.addEventListener("load",r),s.addEventListener("error",r))}}var W1=0;function $5(n,s){return n.stylesheets&&n.count===0&&cm(n,n.stylesheets),0<n.count||0<n.imgCount?function(r){var c=setTimeout(function(){if(n.stylesheets&&cm(n,n.stylesheets),n.unsuspend){var h=n.unsuspend;n.unsuspend=null,h()}},6e4+s);0<n.imgBytes&&W1===0&&(W1=62500*S5());var d=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&cm(n,n.stylesheets),n.unsuspend)){var h=n.unsuspend;n.unsuspend=null,h()}},(n.imgBytes>W1?50:800)+s);return n.unsuspend=r,function(){n.unsuspend=null,clearTimeout(c),clearTimeout(d)}}:null}function lm(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)cm(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var om=null;function cm(n,s){n.stylesheets=null,n.unsuspend!==null&&(n.count++,om=new Map,s.forEach(F5,n),om=null,lm.call(n))}function F5(n,s){if(!(s.state.loading&4)){var r=om.get(n);if(r)var c=r.get(null);else{r=new Map,om.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=lm.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 df={$$typeof:I,Provider:null,Consumer:null,_currentValue:ie,_currentValue2:ie,_threadCount:0};function q5(n,s,r,c,d,h,x,R,H){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=Et(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Et(0),this.hiddenUpdates=Et(null),this.identifierPrefix=c,this.onUncaughtError=d,this.onCaughtError=h,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function av(n,s,r,c,d,h,x,R,H,de,Ne,Me){return n=new q5(n,s,r,x,H,de,Ne,Me,R),s=1,h===!0&&(s|=24),h=Vs(3,null,null,s),n.current=h,h.stateNode=n,s=Od(),s.refCount++,n.pooledCache=s,s.refCount++,h.memoizedState={element:c,isDehydrated:r,cache:s},Bc(h),n}function iv(n){return n?(n=dl,n):dl}function rv(n,s,r,c,d,h){d=iv(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&&(va(r,n,s),yl(r,n,s))}function lv(n,s){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var r=n.retryLane;n.retryLane=r!==0&&r<s?r:s}}function K1(n,s){lv(n,s),(n=n.alternate)&&lv(n,s)}function ov(n){if(n.tag===13||n.tag===31){var s=mr(n,67108864);s!==null&&va(s,n,67108864),K1(n,67108864)}}function cv(n){if(n.tag===13||n.tag===31){var s=Da();s=Rs(s);var r=mr(n,s);r!==null&&va(r,n,s),K1(n,s)}}var um=!0;function W5(n,s,r,c){var d=C.T;C.T=null;var h=q.p;try{q.p=2,Q1(n,s,r,c)}finally{q.p=h,C.T=d}}function K5(n,s,r,c){var d=C.T;C.T=null;var h=q.p;try{q.p=8,Q1(n,s,r,c)}finally{q.p=h,C.T=d}}function Q1(n,s,r,c){if(um){var d=G1(c);if(d===null)D1(n,s,c,dm,r),dv(n,c);else if(G5(d,n,s,r,c))c.stopPropagation();else if(dv(n,c),s&4&&-1<Q5.indexOf(n)){for(;d!==null;){var h=M(d);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var x=ze(h.pendingLanes);if(x!==0){var R=h;for(R.pendingLanes|=2,R.entangledLanes|=2;x;){var H=1<<31-X(x);R.entanglements[1]|=H,x&=~H}Ki(h),(vn&6)===0&&(Qh=ht()+500,af(0))}}break;case 31:case 13:R=mr(h,2),R!==null&&va(R,h,2),Yh(),K1(h,2)}if(h=G1(c),h===null&&D1(n,s,c,dm,r),h===d)break;d=h}d!==null&&c.stopPropagation()}else D1(n,s,c,null,r)}}function G1(n){return n=ai(n),Y1(n)}var dm=null;function Y1(n){if(dm=null,n=J(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 dm=n,null}function uv(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(Ve()){case Ke:return 2;case Nt:return 8;case Bt:case Jt:return 32;case Dt:return 268435456;default:return 32}default:return 32}}var V1=!1,Ml=null,Al=null,Dl=null,ff=new Map,hf=new Map,Ol=[],Q5="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 dv(n,s){switch(n){case"focusin":case"focusout":Ml=null;break;case"dragenter":case"dragleave":Al=null;break;case"mouseover":case"mouseout":Dl=null;break;case"pointerover":case"pointerout":ff.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":hf.delete(s.pointerId)}}function mf(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=M(s),s!==null&&ov(s)),n):(n.eventSystemFlags|=c,s=n.targetContainers,d!==null&&s.indexOf(d)===-1&&s.push(d),n)}function G5(n,s,r,c,d){switch(s){case"focusin":return Ml=mf(Ml,n,s,r,c,d),!0;case"dragenter":return Al=mf(Al,n,s,r,c,d),!0;case"mouseover":return Dl=mf(Dl,n,s,r,c,d),!0;case"pointerover":var h=d.pointerId;return ff.set(h,mf(ff.get(h)||null,n,s,r,c,d)),!0;case"gotpointercapture":return h=d.pointerId,hf.set(h,mf(hf.get(h)||null,n,s,r,c,d)),!0}return!1}function fv(n){var s=J(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,ms(n.priority,function(){cv(r)});return}}else if(s===31){if(s=m(r),s!==null){n.blockedOn=s,ms(n.priority,function(){cv(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 fm(n){if(n.blockedOn!==null)return!1;for(var s=n.targetContainers;0<s.length;){var r=G1(n.nativeEvent);if(r===null){r=n.nativeEvent;var c=new r.constructor(r.type,r);si=c,r.target.dispatchEvent(c),si=null}else return s=M(r),s!==null&&ov(s),n.blockedOn=r,!1;s.shift()}return!0}function hv(n,s,r){fm(n)&&r.delete(s)}function Y5(){V1=!1,Ml!==null&&fm(Ml)&&(Ml=null),Al!==null&&fm(Al)&&(Al=null),Dl!==null&&fm(Dl)&&(Dl=null),ff.forEach(hv),hf.forEach(hv)}function hm(n,s){n.blockedOn===s&&(n.blockedOn=null,V1||(V1=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Y5)))}var mm=null;function mv(n){mm!==n&&(mm=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){mm===n&&(mm=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(Y1(c||r)===null)continue;break}var h=M(r);h!==null&&(n.splice(s,3),s-=3,Gp(h,{pending:!0,data:d,method:r.method,action:c},c,d))}}))}function uu(n){function s(H){return hm(H,n)}Ml!==null&&hm(Ml,n),Al!==null&&hm(Al,n),Dl!==null&&hm(Dl,n),ff.forEach(s),hf.forEach(s);for(var r=0;r<Ol.length;r++){var c=Ol[r];c.blockedOn===n&&(c.blockedOn=null)}for(;0<Ol.length&&(r=Ol[0],r.blockedOn===null);)fv(r),r.blockedOn===null&&Ol.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[Un]||null;if(typeof h=="function")x||mv(r);else if(x){var R=null;if(h&&h.hasAttribute("formAction")){if(d=h,x=h[Un]||null)R=x.formAction;else if(Y1(d)!==null)continue}else R=x.action;typeof R=="function"?r[c+1]=R:(r.splice(c,3),c-=3),mv(r)}}}function pv(){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 Z1(n){this._internalRoot=n}pm.prototype.render=Z1.prototype.render=function(n){var s=this._internalRoot;if(s===null)throw Error(l(409));var r=s.current,c=Da();rv(r,c,n,s,null,null)},pm.prototype.unmount=Z1.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var s=n.containerInfo;rv(n.current,2,null,n,null,null),Yh(),s[ps]=null}};function pm(n){this._internalRoot=n}pm.prototype.unstable_scheduleHydration=function(n){if(n){var s=Pa();n={blockedOn:null,target:n,priority:s};for(var r=0;r<Ol.length&&s!==0&&s<Ol[r].priority;r++);Ol.splice(r,0,n),r===0&&fv(n)}};var gv=t.version;if(gv!=="19.2.4")throw Error(l(527,gv,"19.2.4"));q.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 V5={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:C,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var gm=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!gm.isDisabled&&gm.supportsFiber)try{ut=gm.inject(V5),_e=gm}catch{}}return gf.createRoot=function(n,s){if(!o(n))throw Error(l(299));var r=!1,c="",d=jy,h=wy,x=Ny;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=av(n,1,!1,null,null,r,c,null,d,h,x,pv),n[ps]=s.current,A1(n),new Z1(s)},gf.hydrateRoot=function(n,s,r){if(!o(n))throw Error(l(299));var c=!1,d="",h=jy,x=wy,R=Ny,H=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&&(R=r.onRecoverableError),r.formState!==void 0&&(H=r.formState)),s=av(n,1,!0,s,r??null,c,d,H,h,x,R,pv),s.context=iv(null),r=s.current,c=Da(),c=Rs(c),d=bi(c),d.callback=null,xi(r,d,c),r=c,s.current.lanes=r,Cn(s,r),Ki(s),n[ps]=s.current,A1(n),new pm(s)},gf.version="19.2.4",gf}var Cv;function o9(){if(Cv)return tg.exports;Cv=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(),tg.exports=l9(),tg.exports}var c9=o9(),sd=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(){}},u9={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},ql,q0,_2,d9=(_2=class{constructor(){dt(this,ql,u9);dt(this,q0,!1)}setTimeoutProvider(e){Qe(this,ql,e)}setTimeout(e,t){return $(this,ql).setTimeout(e,t)}clearTimeout(e){$(this,ql).clearTimeout(e)}setInterval(e,t){return $(this,ql).setInterval(e,t)}clearInterval(e){$(this,ql).clearInterval(e)}},ql=new WeakMap,q0=new WeakMap,_2),qo=new d9;function f9(e){setTimeout(e,0)}var oc=typeof window>"u"||"Deno"in globalThis;function vs(){}function h9(e,t){return typeof e=="function"?e(t):e}function $g(e){return typeof e=="number"&&e>=0&&e!==1/0}function R2(e,t){return Math.max(e+(t||0)-Date.now(),0)}function to(e,t){return typeof e=="function"?e(t):e}function Ga(e,t){return typeof e=="function"?e(t):e}function Tv(e,t){const{type:a="all",exact:l,fetchStatus:o,predicate:u,queryKey:f,stale:m}=e;if(f){if(l){if(t.queryHash!==W0(f,t.options))return!1}else if(!Bf(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 Rv(e,t){const{exact:a,status:l,predicate:o,mutationKey:u}=e;if(u){if(!t.options.mutationKey)return!1;if(a){if(cc(t.options.mutationKey)!==cc(u))return!1}else if(!Bf(t.options.mutationKey,u))return!1}return!(l&&t.state.status!==l||o&&!o(t))}function W0(e,t){return((t==null?void 0:t.queryKeyHashFn)||cc)(e)}function cc(e){return JSON.stringify(e,(t,a)=>Fg(a)?Object.keys(a).sort().reduce((l,o)=>(l[o]=a[o],l),{}):a)}function Bf(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(a=>Bf(e[a],t[a])):!1}var m9=Object.prototype.hasOwnProperty;function M2(e,t,a=0){if(e===t)return e;if(a>500)return t;const l=Mv(e)&&Mv(t);if(!l&&!(Fg(e)&&Fg(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],b=e[p],w=t[p];if(b===w){y[p]=b,(l?S<u:m9.call(e,p))&&g++;continue}if(b===null||w===null||typeof b!="object"||typeof w!="object"){y[p]=w;continue}const N=M2(b,w,a+1);y[p]=N,N===b&&g++}return u===m&&g===u?e:y}function Qm(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 Mv(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Fg(e){if(!Av(e))return!1;const t=e.constructor;if(t===void 0)return!0;const a=t.prototype;return!(!Av(a)||!a.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Av(e){return Object.prototype.toString.call(e)==="[object Object]"}function p9(e){return new Promise(t=>{qo.setTimeout(t,e)})}function qg(e,t,a){return typeof a.structuralSharing=="function"?a.structuralSharing(e,t):a.structuralSharing!==!1?M2(e,t):t}function g9(e){return e}function _9(e,t,a=0){const l=[...e,t];return a&&l.length>a?l.slice(1):l}function y9(e,t,a=0){const l=[t,...e];return a&&l.length>a?l.slice(0,-1):l}var K0=Symbol();function A2(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===K0?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Q0(e,t){return typeof e=="function"?e(...t):!!e}function v9(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 Go,Wl,Ru,y2,b9=(y2=class extends sd{constructor(){super();dt(this,Go);dt(this,Wl);dt(this,Ru);Qe(this,Ru,t=>{if(!oc&&window.addEventListener){const a=()=>t();return window.addEventListener("visibilitychange",a,!1),()=>{window.removeEventListener("visibilitychange",a)}}})}onSubscribe(){$(this,Wl)||this.setEventListener($(this,Ru))}onUnsubscribe(){var t;this.hasListeners()||((t=$(this,Wl))==null||t.call(this),Qe(this,Wl,void 0))}setEventListener(t){var a;Qe(this,Ru,t),(a=$(this,Wl))==null||a.call(this),Qe(this,Wl,t(l=>{typeof l=="boolean"?this.setFocused(l):this.onFocus()}))}setFocused(t){$(this,Go)!==t&&(Qe(this,Go,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(a=>{a(t)})}isFocused(){var t;return typeof $(this,Go)=="boolean"?$(this,Go):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Go=new WeakMap,Wl=new WeakMap,Ru=new WeakMap,y2),G0=new b9;function Wg(){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 x9(e){var a;let t;if((a=e.then(l=>(t=l,l),vs))==null||a.catch(vs),t!==void 0)return{data:t}}function D2(e){return e}function S9(e){return{mutationKey:e.options.mutationKey,state:e.state,...e.options.scope&&{scope:e.options.scope},...e.meta&&{meta:e.meta}}}function j9(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(vs),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 w9(e){return e.state.isPaused}function N9(e){return e.state.status==="success"}function k9(e){return!0}function E9(e,t={}){var y,g,S,p;const a=t.shouldDehydrateMutation??((y=e.getDefaultOptions().dehydrate)==null?void 0:y.shouldDehydrateMutation)??w9,l=e.getMutationCache().getAll().flatMap(b=>a(b)?[S9(b)]:[]),o=t.shouldDehydrateQuery??((g=e.getDefaultOptions().dehydrate)==null?void 0:g.shouldDehydrateQuery)??N9,u=t.shouldRedactErrors??((S=e.getDefaultOptions().dehydrate)==null?void 0:S.shouldRedactErrors)??k9,f=t.serializeData??((p=e.getDefaultOptions().dehydrate)==null?void 0:p.serializeData)??D2,m=e.getQueryCache().getAll().flatMap(b=>o(b)?[j9(b,f,u)]:[]);return{mutations:l,queries:m}}function C9(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)??D2,f=t.mutations||[],m=t.queries||[];f.forEach(({state:g,...S})=>{var p,b;l.build(e,{...(p=e.getDefaultOptions().hydrate)==null?void 0:p.mutations,...(b=a==null?void 0:a.defaultOptions)==null?void 0:b.mutations,...S},g)}),m.forEach(({queryKey:g,state:S,queryHash:p,meta:b,promise:w,dehydratedAt:N})=>{var P,Q;const j=w?x9(w):void 0,T=S.data===void 0?j==null?void 0:j.data:S.data,D=T===void 0?T:u(T);let z=o.get(p);const I=(z==null?void 0:z.state.status)==="pending",k=(z==null?void 0:z.state.fetchStatus)==="fetching";if(z){const se=j&&N!==void 0&&N>z.state.dataUpdatedAt;if(S.dataUpdatedAt>z.state.dataUpdatedAt||se){const{fetchStatus:W,...V}=S;z.setState({...V,data:D})}}else z=o.build(e,{...(P=e.getDefaultOptions().hydrate)==null?void 0:P.queries,...(Q=a==null?void 0:a.defaultOptions)==null?void 0:Q.queries,queryKey:g,queryHash:p,meta:b},{...S,data:D,fetchStatus:"idle",status:D!==void 0?"success":S.status});w&&!I&&!k&&(N===void 0||N>z.state.dataUpdatedAt)&&z.fetch(void 0,{initialPromise:Promise.resolve(w).then(u)}).catch(vs)})}var T9=f9;function R9(){let e=[],t=0,a=m=>{m()},l=m=>{m()},o=T9;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 bs=R9(),Mu,Kl,Au,v2,M9=(v2=class extends sd{constructor(){super();dt(this,Mu,!0);dt(this,Kl);dt(this,Au);Qe(this,Au,t=>{if(!oc&&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(){$(this,Kl)||this.setEventListener($(this,Au))}onUnsubscribe(){var t;this.hasListeners()||((t=$(this,Kl))==null||t.call(this),Qe(this,Kl,void 0))}setEventListener(t){var a;Qe(this,Au,t),(a=$(this,Kl))==null||a.call(this),Qe(this,Kl,t(this.setOnline.bind(this)))}setOnline(t){$(this,Mu)!==t&&(Qe(this,Mu,t),this.listeners.forEach(l=>{l(t)}))}isOnline(){return $(this,Mu)}},Mu=new WeakMap,Kl=new WeakMap,Au=new WeakMap,v2),Gm=new M9;function A9(e){return Math.min(1e3*2**e,3e4)}function O2(e){return(e??"online")==="online"?Gm.isOnline():!0}var Kg=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function I2(e){let t=!1,a=0,l;const o=Wg(),u=()=>o.status!=="pending",f=j=>{var T;if(!u()){const D=new Kg(j);b(D),(T=e.onCancel)==null||T.call(e,D)}},m=()=>{t=!0},y=()=>{t=!1},g=()=>G0.isFocused()&&(e.networkMode==="always"||Gm.isOnline())&&e.canRun(),S=()=>O2(e.networkMode)&&e.canRun(),p=j=>{u()||(l==null||l(),o.resolve(j))},b=j=>{u()||(l==null||l(),o.reject(j))},w=()=>new Promise(j=>{var T;l=D=>{(u()||g())&&j(D)},(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(D){j=Promise.reject(D)}Promise.resolve(j).then(p).catch(D=>{var Q;if(u())return;const z=e.retry??(oc?0:3),I=e.retryDelay??A9,k=typeof I=="function"?I(a,D):I,P=z===!0||typeof z=="number"&&a<z||typeof z=="function"&&z(a,D);if(t||!P){b(D);return}a++,(Q=e.onFail)==null||Q.call(e,a,D),p9(k).then(()=>g()?void 0:w()).then(()=>{t?b(D):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 Yo,b2,L2=(b2=class{constructor(){dt(this,Yo)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),$g(this.gcTime)&&Qe(this,Yo,qo.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(oc?1/0:300*1e3))}clearGcTimeout(){$(this,Yo)&&(qo.clearTimeout($(this,Yo)),Qe(this,Yo,void 0))}},Yo=new WeakMap,b2),Vo,Du,Qa,Zo,Ts,th,Xo,wi,Ir,x2,D9=(x2=class extends L2{constructor(t){super();dt(this,wi);dt(this,Vo);dt(this,Du);dt(this,Qa);dt(this,Zo);dt(this,Ts);dt(this,th);dt(this,Xo);Qe(this,Xo,!1),Qe(this,th,t.defaultOptions),this.setOptions(t.options),this.observers=[],Qe(this,Zo,t.client),Qe(this,Qa,$(this,Zo).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Qe(this,Vo,Ov(this.options)),this.state=t.state??$(this,Vo),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=$(this,Ts))==null?void 0:t.promise}setOptions(t){if(this.options={...$(this,th),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const a=Ov(this.options);a.data!==void 0&&(this.setState(Dv(a.data,a.dataUpdatedAt)),Qe(this,Vo,a))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&$(this,Qa).remove(this)}setData(t,a){const l=qg(this.state.data,t,this.options);return Lt(this,wi,Ir).call(this,{data:l,type:"success",dataUpdatedAt:a==null?void 0:a.updatedAt,manual:a==null?void 0:a.manual}),l}setState(t,a){Lt(this,wi,Ir).call(this,{type:"setState",state:t,setStateOptions:a})}cancel(t){var l,o;const a=(l=$(this,Ts))==null?void 0:l.promise;return(o=$(this,Ts))==null||o.cancel(t),a?a.then(vs).catch(vs):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState($(this,Vo))}isActive(){return this.observers.some(t=>Ga(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===K0||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>to(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:!R2(this.state.dataUpdatedAt,t)}onFocus(){var a;const t=this.observers.find(l=>l.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(a=$(this,Ts))==null||a.continue()}onOnline(){var a;const t=this.observers.find(l=>l.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(a=$(this,Ts))==null||a.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),$(this,Qa).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(a=>a!==t),this.observers.length||($(this,Ts)&&($(this,Xo)?$(this,Ts).cancel({revert:!0}):$(this,Ts).cancelRetry()),this.scheduleGc()),$(this,Qa).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Lt(this,wi,Ir).call(this,{type:"invalidate"})}async fetch(t,a){var y,g,S,p,b,w,N,j,T,D,z,I;if(this.state.fetchStatus!=="idle"&&((y=$(this,Ts))==null?void 0:y.status())!=="rejected"){if(this.state.data!==void 0&&(a!=null&&a.cancelRefetch))this.cancel({silent:!0});else if($(this,Ts))return $(this,Ts).continueRetry(),$(this,Ts).promise}if(t&&this.setOptions(t),!this.options.queryFn){const k=this.observers.find(P=>P.options.queryFn);k&&this.setOptions(k.options)}const l=new AbortController,o=k=>{Object.defineProperty(k,"signal",{enumerable:!0,get:()=>(Qe(this,Xo,!0),l.signal)})},u=()=>{const k=A2(this.options,a),Q=(()=>{const se={client:$(this,Zo),queryKey:this.queryKey,meta:this.meta};return o(se),se})();return Qe(this,Xo,!1),this.options.persister?this.options.persister(k,Q,this):k(Q)},m=(()=>{const k={fetchOptions:a,options:this.options,queryKey:this.queryKey,client:$(this,Zo),state:this.state,fetchFn:u};return o(k),k})();(g=this.options.behavior)==null||g.onFetch(m,this),Qe(this,Du,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((S=m.fetchOptions)==null?void 0:S.meta))&&Lt(this,wi,Ir).call(this,{type:"fetch",meta:(p=m.fetchOptions)==null?void 0:p.meta}),Qe(this,Ts,I2({initialPromise:a==null?void 0:a.initialPromise,fn:m.fetchFn,onCancel:k=>{k instanceof Kg&&k.revert&&this.setState({...$(this,Du),fetchStatus:"idle"}),l.abort()},onFail:(k,P)=>{Lt(this,wi,Ir).call(this,{type:"failed",failureCount:k,error:P})},onPause:()=>{Lt(this,wi,Ir).call(this,{type:"pause"})},onContinue:()=>{Lt(this,wi,Ir).call(this,{type:"continue"})},retry:m.options.retry,retryDelay:m.options.retryDelay,networkMode:m.options.networkMode,canRun:()=>!0}));try{const k=await $(this,Ts).start();if(k===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(k),(w=(b=$(this,Qa).config).onSuccess)==null||w.call(b,k,this),(j=(N=$(this,Qa).config).onSettled)==null||j.call(N,k,this.state.error,this),k}catch(k){if(k instanceof Kg){if(k.silent)return $(this,Ts).promise;if(k.revert){if(this.state.data===void 0)throw k;return this.state.data}}throw Lt(this,wi,Ir).call(this,{type:"error",error:k}),(D=(T=$(this,Qa).config).onError)==null||D.call(T,k,this),(I=(z=$(this,Qa).config).onSettled)==null||I.call(z,this.state.data,k,this),k}finally{this.scheduleGc()}}},Vo=new WeakMap,Du=new WeakMap,Qa=new WeakMap,Zo=new WeakMap,Ts=new WeakMap,th=new WeakMap,Xo=new WeakMap,wi=new WeakSet,Ir=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,...P2(l.data,this.options),fetchMeta:t.meta??null};case"success":const o={...l,...Dv(t.data,t.dataUpdatedAt),dataUpdateCount:l.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Qe(this,Du,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),bs.batch(()=>{this.observers.forEach(l=>{l.onQueryUpdate()}),$(this,Qa).notify({query:this,type:"updated",action:t})})},x2);function P2(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:O2(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Dv(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Ov(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 xa,an,nh,Xs,Jo,Ou,Ur,Ql,sh,Iu,Lu,ec,tc,Gl,Pu,Nn,Nf,Qg,Gg,Yg,Vg,Zg,Xg,Jg,U2,S2,O9=(S2=class extends sd{constructor(t,a){super();dt(this,Nn);dt(this,xa);dt(this,an);dt(this,nh);dt(this,Xs);dt(this,Jo);dt(this,Ou);dt(this,Ur);dt(this,Ql);dt(this,sh);dt(this,Iu);dt(this,Lu);dt(this,ec);dt(this,tc);dt(this,Gl);dt(this,Pu,new Set);this.options=a,Qe(this,xa,t),Qe(this,Ql,null),Qe(this,Ur,Wg()),this.bindMethods(),this.setOptions(a)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&($(this,an).addObserver(this),Iv($(this,an),this.options)?Lt(this,Nn,Nf).call(this):this.updateResult(),Lt(this,Nn,Vg).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return e0($(this,an),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return e0($(this,an),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Lt(this,Nn,Zg).call(this),Lt(this,Nn,Xg).call(this),$(this,an).removeObserver(this)}setOptions(t){const a=this.options,l=$(this,an);if(this.options=$(this,xa).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ga(this.options.enabled,$(this,an))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Lt(this,Nn,Jg).call(this),$(this,an).setOptions(this.options),a._defaulted&&!Qm(this.options,a)&&$(this,xa).getQueryCache().notify({type:"observerOptionsUpdated",query:$(this,an),observer:this});const o=this.hasListeners();o&&Lv($(this,an),l,this.options,a)&&Lt(this,Nn,Nf).call(this),this.updateResult(),o&&($(this,an)!==l||Ga(this.options.enabled,$(this,an))!==Ga(a.enabled,$(this,an))||to(this.options.staleTime,$(this,an))!==to(a.staleTime,$(this,an)))&&Lt(this,Nn,Qg).call(this);const u=Lt(this,Nn,Gg).call(this);o&&($(this,an)!==l||Ga(this.options.enabled,$(this,an))!==Ga(a.enabled,$(this,an))||u!==$(this,Gl))&&Lt(this,Nn,Yg).call(this,u)}getOptimisticResult(t){const a=$(this,xa).getQueryCache().build($(this,xa),t),l=this.createResult(a,t);return L9(this,l)&&(Qe(this,Xs,l),Qe(this,Ou,this.options),Qe(this,Jo,$(this,an).state)),l}getCurrentResult(){return $(this,Xs)}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&&$(this,Ur).status==="pending"&&$(this,Ur).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(l,o))})}trackProp(t){$(this,Pu).add(t)}getCurrentQuery(){return $(this,an)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const a=$(this,xa).defaultQueryOptions(t),l=$(this,xa).getQueryCache().build($(this,xa),a);return l.fetch().then(()=>this.createResult(l,a))}fetch(t){return Lt(this,Nn,Nf).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),$(this,Xs)))}createResult(t,a){var V;const l=$(this,an),o=this.options,u=$(this,Xs),f=$(this,Jo),m=$(this,Ou),g=t!==l?t.state:$(this,nh),{state:S}=t;let p={...S},b=!1,w;if(a._optimisticResults){const Y=this.hasListeners(),ee=!Y&&Iv(t,a),me=Y&&Lv(t,l,a,o);(ee||me)&&(p={...p,...P2(S.data,t.options)}),a._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:N,errorUpdatedAt:j,status:T}=p;w=p.data;let D=!1;if(a.placeholderData!==void 0&&w===void 0&&T==="pending"){let Y;u!=null&&u.isPlaceholderData&&a.placeholderData===(m==null?void 0:m.placeholderData)?(Y=u.data,D=!0):Y=typeof a.placeholderData=="function"?a.placeholderData((V=$(this,Lu))==null?void 0:V.state.data,$(this,Lu)):a.placeholderData,Y!==void 0&&(T="success",w=qg(u==null?void 0:u.data,Y,a),b=!0)}if(a.select&&w!==void 0&&!D)if(u&&w===(f==null?void 0:f.data)&&a.select===$(this,sh))w=$(this,Iu);else try{Qe(this,sh,a.select),w=a.select(w),w=qg(u==null?void 0:u.data,w,a),Qe(this,Iu,w),Qe(this,Ql,null)}catch(Y){Qe(this,Ql,Y)}$(this,Ql)&&(N=$(this,Ql),w=$(this,Iu),j=Date.now(),T="error");const z=p.fetchStatus==="fetching",I=T==="pending",k=T==="error",P=I&&z,Q=w!==void 0,W={status:T,fetchStatus:p.fetchStatus,isPending:I,isSuccess:T==="success",isError:k,isInitialLoading:P,isLoading:P,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:z,isRefetching:z&&!I,isLoadingError:k&&!Q,isPaused:p.fetchStatus==="paused",isPlaceholderData:b,isRefetchError:k&&Q,isStale:Y0(t,a),refetch:this.refetch,promise:$(this,Ur),isEnabled:Ga(a.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const Y=W.data!==void 0,ee=W.status==="error"&&!Y,me=xe=>{ee?xe.reject(W.error):Y&&xe.resolve(W.data)},ge=()=>{const xe=Qe(this,Ur,W.promise=Wg());me(xe)},te=$(this,Ur);switch(te.status){case"pending":t.queryHash===l.queryHash&&me(te);break;case"fulfilled":(ee||W.data!==te.value)&&ge();break;case"rejected":(!ee||W.error!==te.reason)&&ge();break}}return W}updateResult(){const t=$(this,Xs),a=this.createResult($(this,an),this.options);if(Qe(this,Jo,$(this,an).state),Qe(this,Ou,this.options),$(this,Jo).data!==void 0&&Qe(this,Lu,$(this,an)),Qm(a,t))return;Qe(this,Xs,a);const l=()=>{if(!t)return!0;const{notifyOnChangeProps:o}=this.options,u=typeof o=="function"?o():o;if(u==="all"||!u&&!$(this,Pu).size)return!0;const f=new Set(u??$(this,Pu));return this.options.throwOnError&&f.add("error"),Object.keys($(this,Xs)).some(m=>{const y=m;return $(this,Xs)[y]!==t[y]&&f.has(y)})};Lt(this,Nn,U2).call(this,{listeners:l()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Lt(this,Nn,Vg).call(this)}},xa=new WeakMap,an=new WeakMap,nh=new WeakMap,Xs=new WeakMap,Jo=new WeakMap,Ou=new WeakMap,Ur=new WeakMap,Ql=new WeakMap,sh=new WeakMap,Iu=new WeakMap,Lu=new WeakMap,ec=new WeakMap,tc=new WeakMap,Gl=new WeakMap,Pu=new WeakMap,Nn=new WeakSet,Nf=function(t){Lt(this,Nn,Jg).call(this);let a=$(this,an).fetch(this.options,t);return t!=null&&t.throwOnError||(a=a.catch(vs)),a},Qg=function(){Lt(this,Nn,Zg).call(this);const t=to(this.options.staleTime,$(this,an));if(oc||$(this,Xs).isStale||!$g(t))return;const l=R2($(this,Xs).dataUpdatedAt,t)+1;Qe(this,ec,qo.setTimeout(()=>{$(this,Xs).isStale||this.updateResult()},l))},Gg=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval($(this,an)):this.options.refetchInterval)??!1},Yg=function(t){Lt(this,Nn,Xg).call(this),Qe(this,Gl,t),!(oc||Ga(this.options.enabled,$(this,an))===!1||!$g($(this,Gl))||$(this,Gl)===0)&&Qe(this,tc,qo.setInterval(()=>{(this.options.refetchIntervalInBackground||G0.isFocused())&&Lt(this,Nn,Nf).call(this)},$(this,Gl)))},Vg=function(){Lt(this,Nn,Qg).call(this),Lt(this,Nn,Yg).call(this,Lt(this,Nn,Gg).call(this))},Zg=function(){$(this,ec)&&(qo.clearTimeout($(this,ec)),Qe(this,ec,void 0))},Xg=function(){$(this,tc)&&(qo.clearInterval($(this,tc)),Qe(this,tc,void 0))},Jg=function(){const t=$(this,xa).getQueryCache().build($(this,xa),this.options);if(t===$(this,an))return;const a=$(this,an);Qe(this,an,t),Qe(this,nh,t.state),this.hasListeners()&&(a==null||a.removeObserver(this),t.addObserver(this))},U2=function(t){bs.batch(()=>{t.listeners&&this.listeners.forEach(a=>{a($(this,Xs))}),$(this,xa).getQueryCache().notify({query:$(this,an),type:"observerResultsUpdated"})})},S2);function I9(e,t){return Ga(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Iv(e,t){return I9(e,t)||e.state.data!==void 0&&e0(e,t,t.refetchOnMount)}function e0(e,t,a){if(Ga(t.enabled,e)!==!1&&to(t.staleTime,e)!=="static"){const l=typeof a=="function"?a(e):a;return l==="always"||l!==!1&&Y0(e,t)}return!1}function Lv(e,t,a,l){return(e!==t||Ga(l.enabled,e)===!1)&&(!a.suspense||e.state.status!=="error")&&Y0(e,a)}function Y0(e,t){return Ga(t.enabled,e)!==!1&&e.isStaleByTime(to(t.staleTime,e))}function L9(e,t){return!Qm(e.getCurrentResult(),t)}function Pv(e){return{onFetch:(t,a)=>{var S,p,b,w,N;const l=t.options,o=(b=(p=(S=t.fetchOptions)==null?void 0:S.meta)==null?void 0:p.fetchMore)==null?void 0:b.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=>{v9(I,()=>t.signal,()=>j=!0)},D=A2(t.options,t.fetchOptions),z=async(I,k,P)=>{if(j)return Promise.reject();if(k==null&&I.pages.length)return Promise.resolve(I);const se=(()=>{const ee={client:t.client,queryKey:t.queryKey,pageParam:k,direction:P?"backward":"forward",meta:t.options.meta};return T(ee),ee})(),W=await D(se),{maxPages:V}=t.options,Y=P?y9:_9;return{pages:Y(I.pages,W,V),pageParams:Y(I.pageParams,k,V)}};if(o&&u.length){const I=o==="backward",k=I?P9:Uv,P={pages:u,pageParams:f},Q=k(l,P);m=await z(P,Q,I)}else{const I=e??u.length;do{const k=y===0?f[0]??l.initialPageParam:Uv(l,m);if(y>0&&k==null)break;m=await z(m,k),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 Uv(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 P9(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 ah,Yi,Fs,nc,Vi,Bl,j2,U9=(j2=class extends L2{constructor(t){super();dt(this,Vi);dt(this,ah);dt(this,Yi);dt(this,Fs);dt(this,nc);Qe(this,ah,t.client),this.mutationId=t.mutationId,Qe(this,Fs,t.mutationCache),Qe(this,Yi,[]),this.state=t.state||z2(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){$(this,Yi).includes(t)||($(this,Yi).push(t),this.clearGcTimeout(),$(this,Fs).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Qe(this,Yi,$(this,Yi).filter(a=>a!==t)),this.scheduleGc(),$(this,Fs).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){$(this,Yi).length||(this.state.status==="pending"?this.scheduleGc():$(this,Fs).remove(this))}continue(){var t;return((t=$(this,nc))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var f,m,y,g,S,p,b,w,N,j,T,D,z,I,k,P,Q,se;const a=()=>{Lt(this,Vi,Bl).call(this,{type:"continue"})},l={client:$(this,ah),meta:this.options.meta,mutationKey:this.options.mutationKey};Qe(this,nc,I2({fn:()=>this.options.mutationFn?this.options.mutationFn(t,l):Promise.reject(new Error("No mutationFn found")),onFail:(W,V)=>{Lt(this,Vi,Bl).call(this,{type:"failed",failureCount:W,error:V})},onPause:()=>{Lt(this,Vi,Bl).call(this,{type:"pause"})},onContinue:a,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>$(this,Fs).canRun(this)}));const o=this.state.status==="pending",u=!$(this,nc).canStart();try{if(o)a();else{Lt(this,Vi,Bl).call(this,{type:"pending",variables:t,isPaused:u}),$(this,Fs).config.onMutate&&await $(this,Fs).config.onMutate(t,this,l);const V=await((m=(f=this.options).onMutate)==null?void 0:m.call(f,t,l));V!==this.state.context&&Lt(this,Vi,Bl).call(this,{type:"pending",context:V,variables:t,isPaused:u})}const W=await $(this,nc).start();return await((g=(y=$(this,Fs).config).onSuccess)==null?void 0:g.call(y,W,t,this.state.context,this,l)),await((p=(S=this.options).onSuccess)==null?void 0:p.call(S,W,t,this.state.context,l)),await((w=(b=$(this,Fs).config).onSettled)==null?void 0:w.call(b,W,null,this.state.variables,this.state.context,this,l)),await((j=(N=this.options).onSettled)==null?void 0:j.call(N,W,null,t,this.state.context,l)),Lt(this,Vi,Bl).call(this,{type:"success",data:W}),W}catch(W){try{await((D=(T=$(this,Fs).config).onError)==null?void 0:D.call(T,W,t,this.state.context,this,l))}catch(V){Promise.reject(V)}try{await((I=(z=this.options).onError)==null?void 0:I.call(z,W,t,this.state.context,l))}catch(V){Promise.reject(V)}try{await((P=(k=$(this,Fs).config).onSettled)==null?void 0:P.call(k,void 0,W,this.state.variables,this.state.context,this,l))}catch(V){Promise.reject(V)}try{await((se=(Q=this.options).onSettled)==null?void 0:se.call(Q,void 0,W,t,this.state.context,l))}catch(V){Promise.reject(V)}throw Lt(this,Vi,Bl).call(this,{type:"error",error:W}),W}finally{$(this,Fs).runNext(this)}}},ah=new WeakMap,Yi=new WeakMap,Fs=new WeakMap,nc=new WeakMap,Vi=new WeakSet,Bl=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),bs.batch(()=>{$(this,Yi).forEach(l=>{l.onMutationUpdate(t)}),$(this,Fs).notify({mutation:this,type:"updated",action:t})})},j2);function z2(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var zr,Ni,ih,w2,z9=(w2=class extends sd{constructor(t={}){super();dt(this,zr);dt(this,Ni);dt(this,ih);this.config=t,Qe(this,zr,new Set),Qe(this,Ni,new Map),Qe(this,ih,0)}build(t,a,l){const o=new U9({client:t,mutationCache:this,mutationId:++_m(this,ih)._,options:t.defaultMutationOptions(a),state:l});return this.add(o),o}add(t){$(this,zr).add(t);const a=ym(t);if(typeof a=="string"){const l=$(this,Ni).get(a);l?l.push(t):$(this,Ni).set(a,[t])}this.notify({type:"added",mutation:t})}remove(t){if($(this,zr).delete(t)){const a=ym(t);if(typeof a=="string"){const l=$(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&&$(this,Ni).delete(a)}}this.notify({type:"removed",mutation:t})}canRun(t){const a=ym(t);if(typeof a=="string"){const l=$(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=ym(t);if(typeof a=="string"){const o=(l=$(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(){bs.batch(()=>{$(this,zr).forEach(t=>{this.notify({type:"removed",mutation:t})}),$(this,zr).clear(),$(this,Ni).clear()})}getAll(){return Array.from($(this,zr))}find(t){const a={exact:!0,...t};return this.getAll().find(l=>Rv(a,l))}findAll(t={}){return this.getAll().filter(a=>Rv(t,a))}notify(t){bs.batch(()=>{this.listeners.forEach(a=>{a(t)})})}resumePausedMutations(){const t=this.getAll().filter(a=>a.state.isPaused);return bs.batch(()=>Promise.all(t.map(a=>a.continue().catch(vs))))}},zr=new WeakMap,Ni=new WeakMap,ih=new WeakMap,w2);function ym(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Br,Yl,Sa,Hr,Yr,Om,t0,N2,B9=(N2=class extends sd{constructor(a,l){super();dt(this,Yr);dt(this,Br);dt(this,Yl);dt(this,Sa);dt(this,Hr);Qe(this,Br,a),this.setOptions(l),this.bindMethods(),Lt(this,Yr,Om).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=$(this,Br).defaultMutationOptions(a),Qm(this.options,l)||$(this,Br).getMutationCache().notify({type:"observerOptionsUpdated",mutation:$(this,Sa),observer:this}),l!=null&&l.mutationKey&&this.options.mutationKey&&cc(l.mutationKey)!==cc(this.options.mutationKey)?this.reset():((o=$(this,Sa))==null?void 0:o.state.status)==="pending"&&$(this,Sa).setOptions(this.options)}onUnsubscribe(){var a;this.hasListeners()||(a=$(this,Sa))==null||a.removeObserver(this)}onMutationUpdate(a){Lt(this,Yr,Om).call(this),Lt(this,Yr,t0).call(this,a)}getCurrentResult(){return $(this,Yl)}reset(){var a;(a=$(this,Sa))==null||a.removeObserver(this),Qe(this,Sa,void 0),Lt(this,Yr,Om).call(this),Lt(this,Yr,t0).call(this)}mutate(a,l){var o;return Qe(this,Hr,l),(o=$(this,Sa))==null||o.removeObserver(this),Qe(this,Sa,$(this,Br).getMutationCache().build($(this,Br),this.options)),$(this,Sa).addObserver(this),$(this,Sa).execute(a)}},Br=new WeakMap,Yl=new WeakMap,Sa=new WeakMap,Hr=new WeakMap,Yr=new WeakSet,Om=function(){var l;const a=((l=$(this,Sa))==null?void 0:l.state)??z2();Qe(this,Yl,{...a,isPending:a.status==="pending",isSuccess:a.status==="success",isError:a.status==="error",isIdle:a.status==="idle",mutate:this.mutate,reset:this.reset})},t0=function(a){bs.batch(()=>{var l,o,u,f,m,y,g,S;if($(this,Hr)&&this.hasListeners()){const p=$(this,Yl).variables,b=$(this,Yl).context,w={client:$(this,Br),meta:this.options.meta,mutationKey:this.options.mutationKey};if((a==null?void 0:a.type)==="success"){try{(o=(l=$(this,Hr)).onSuccess)==null||o.call(l,a.data,p,b,w)}catch(N){Promise.reject(N)}try{(f=(u=$(this,Hr)).onSettled)==null||f.call(u,a.data,null,p,b,w)}catch(N){Promise.reject(N)}}else if((a==null?void 0:a.type)==="error"){try{(y=(m=$(this,Hr)).onError)==null||y.call(m,a.error,p,b,w)}catch(N){Promise.reject(N)}try{(S=(g=$(this,Hr)).onSettled)==null||S.call(g,void 0,a.error,p,b,w)}catch(N){Promise.reject(N)}}}this.listeners.forEach(p=>{p($(this,Yl))})})},N2),Zi,k2,H9=(k2=class extends sd{constructor(t={}){super();dt(this,Zi);this.config=t,Qe(this,Zi,new Map)}build(t,a,l){const o=a.queryKey,u=a.queryHash??W0(o,a);let f=this.get(u);return f||(f=new D9({client:t,queryKey:o,queryHash:u,options:t.defaultQueryOptions(a),state:l,defaultOptions:t.getQueryDefaults(o)}),this.add(f)),f}add(t){$(this,Zi).has(t.queryHash)||($(this,Zi).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const a=$(this,Zi).get(t.queryHash);a&&(t.destroy(),a===t&&$(this,Zi).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){bs.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return $(this,Zi).get(t)}getAll(){return[...$(this,Zi).values()]}find(t){const a={exact:!0,...t};return this.getAll().find(l=>Tv(a,l))}findAll(t={}){const a=this.getAll();return Object.keys(t).length>0?a.filter(l=>Tv(t,l)):a}notify(t){bs.batch(()=>{this.listeners.forEach(a=>{a(t)})})}onFocus(){bs.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){bs.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Zi=new WeakMap,k2),ns,Vl,Zl,Uu,zu,Xl,Bu,Hu,E2,$9=(E2=class{constructor(e={}){dt(this,ns);dt(this,Vl);dt(this,Zl);dt(this,Uu);dt(this,zu);dt(this,Xl);dt(this,Bu);dt(this,Hu);Qe(this,ns,e.queryCache||new H9),Qe(this,Vl,e.mutationCache||new z9),Qe(this,Zl,e.defaultOptions||{}),Qe(this,Uu,new Map),Qe(this,zu,new Map),Qe(this,Xl,0)}mount(){_m(this,Xl)._++,$(this,Xl)===1&&(Qe(this,Bu,G0.subscribe(async e=>{e&&(await this.resumePausedMutations(),$(this,ns).onFocus())})),Qe(this,Hu,Gm.subscribe(async e=>{e&&(await this.resumePausedMutations(),$(this,ns).onOnline())})))}unmount(){var e,t;_m(this,Xl)._--,$(this,Xl)===0&&((e=$(this,Bu))==null||e.call(this),Qe(this,Bu,void 0),(t=$(this,Hu))==null||t.call(this),Qe(this,Hu,void 0))}isFetching(e){return $(this,ns).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return $(this,Vl).findAll({...e,status:"pending"}).length}getQueryData(e){var a;const t=this.defaultQueryOptions({queryKey:e});return(a=$(this,ns).get(t.queryHash))==null?void 0:a.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),a=$(this,ns).build(this,t),l=a.state.data;return l===void 0?this.fetchQuery(e):(e.revalidateIfStale&&a.isStaleByTime(to(t.staleTime,a))&&this.prefetchQuery(t),Promise.resolve(l))}getQueriesData(e){return $(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=$(this,ns).get(l.queryHash),u=o==null?void 0:o.state.data,f=h9(t,u);if(f!==void 0)return $(this,ns).build(this,l).setData(f,{...a,manual:!0})}setQueriesData(e,t,a){return bs.batch(()=>$(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=$(this,ns).get(t.queryHash))==null?void 0:a.state}removeQueries(e){const t=$(this,ns);bs.batch(()=>{t.findAll(e).forEach(a=>{t.remove(a)})})}resetQueries(e,t){const a=$(this,ns);return bs.batch(()=>(a.findAll(e).forEach(l=>{l.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const a={revert:!0,...t},l=bs.batch(()=>$(this,ns).findAll(e).map(o=>o.cancel(a)));return Promise.all(l).then(vs).catch(vs)}invalidateQueries(e,t={}){return bs.batch(()=>($(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=bs.batch(()=>$(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(vs)),o.state.fetchStatus==="paused"?Promise.resolve():u}));return Promise.all(l).then(vs)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const a=$(this,ns).build(this,t);return a.isStaleByTime(to(t.staleTime,a))?a.fetch(t):Promise.resolve(a.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(vs).catch(vs)}fetchInfiniteQuery(e){return e.behavior=Pv(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(vs).catch(vs)}ensureInfiniteQueryData(e){return e.behavior=Pv(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Gm.isOnline()?$(this,Vl).resumePausedMutations():Promise.resolve()}getQueryCache(){return $(this,ns)}getMutationCache(){return $(this,Vl)}getDefaultOptions(){return $(this,Zl)}setDefaultOptions(e){Qe(this,Zl,e)}setQueryDefaults(e,t){$(this,Uu).set(cc(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...$(this,Uu).values()],a={};return t.forEach(l=>{Bf(e,l.queryKey)&&Object.assign(a,l.defaultOptions)}),a}setMutationDefaults(e,t){$(this,zu).set(cc(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...$(this,zu).values()],a={};return t.forEach(l=>{Bf(e,l.mutationKey)&&Object.assign(a,l.defaultOptions)}),a}defaultQueryOptions(e){if(e._defaulted)return e;const t={...$(this,Zl).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=W0(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===K0&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...$(this,Zl).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){$(this,ns).clear(),$(this,Vl).clear()}},ns=new WeakMap,Vl=new WeakMap,Zl=new WeakMap,Uu=new WeakMap,zu=new WeakMap,Xl=new WeakMap,Bu=new WeakMap,Hu=new WeakMap,E2),B2=_.createContext(void 0),La=e=>{const t=_.useContext(B2);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},F9=({client:e,children:t})=>(_.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),i.jsx(B2.Provider,{value:e,children:t})),H2=_.createContext(!1),q9=()=>_.useContext(H2);H2.Provider;function W9(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var K9=_.createContext(W9()),Q9=()=>_.useContext(K9),G9=(e,t,a)=>{const l=a!=null&&a.state.error&&typeof e.throwOnError=="function"?Q0(e.throwOnError,[a.state.error,a]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||l)&&(t.isReset()||(e.retryOnMount=!1))},Y9=e=>{_.useEffect(()=>{e.clearReset()},[e])},V9=({result:e,errorResetBoundary:t,throwOnError:a,query:l,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&l&&(o&&e.data===void 0||Q0(a,[e.error,l])),Z9=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))}},X9=(e,t)=>e.isLoading&&e.isFetching&&!t,J9=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,zv=(e,t,a)=>t.fetchOptimistic(e).catch(()=>{a.clearReset()});function eS(e,t,a){var b,w,N,j;const l=q9(),o=Q9(),u=La(),f=u.defaultQueryOptions(e);(w=(b=u.getDefaultOptions().queries)==null?void 0:b._experimental_beforeQuery)==null||w.call(b,f);const m=u.getQueryCache().get(f.queryHash);f._optimisticResults=l?"isRestoring":"optimistic",Z9(f),G9(f,o,m),Y9(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 D=p?g.subscribe(bs.batchCalls(T)):vs;return g.updateResult(),D},[g,p]),()=>g.getCurrentResult(),()=>g.getCurrentResult()),_.useEffect(()=>{g.setOptions(f)},[f,g]),J9(f,S))throw zv(f,g,o);if(V9({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&&!oc&&X9(S,l)){const T=y?zv(f,g,o):m==null?void 0:m.promise;T==null||T.catch(vs).finally(()=>{g.updateResult()})}return f.notifyOnChangeProps?S:g.trackResult(S)}function ls(e,t){return eS(e,O9)}function TD(e){return e}function Vn(e,t){const a=La(),[l]=_.useState(()=>new B9(a,e));_.useEffect(()=>{l.setOptions(e)},[l,e]);const o=_.useSyncExternalStore(_.useCallback(f=>l.subscribe(bs.batchCalls(f)),[l]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),u=_.useCallback((f,m)=>{l.mutate(f,m).catch(vs)},[l]);if(o.error&&Q0(l.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:u,mutateAsync:o.mutate}}var vm=typeof window<"u"?_.useLayoutEffect:_.useEffect;function ig(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 tS(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 nS(e){const t=_.useRef(null);return _.useImperativeHandle(e,()=>t.current,[]),t}var sS=!1;function Hf(e){return e[e.length-1]}function aS(e){return typeof e=="function"}function Jl(e,t){return aS(e)?e(t):e}var iS=Object.prototype.hasOwnProperty,Bv=Object.prototype.propertyIsEnumerable,rS=()=>Object.create(null),Io=(e,t)=>Wo(e,t,rS);function Wo(e,t,a=()=>({}),l=0){if(e===t)return e;if(l>500)return t;const o=t,u=Fv(e)&&Fv(o);if(!u&&!(Ym(e)&&Ym(o)))return o;const f=u?e:Hv(e);if(!f)return o;const m=u?o:Hv(o);if(!m)return o;const y=f.length,g=m.length,S=u?new Array(g):a();let p=0;for(let b=0;b<g;b++){const w=u?b:m[b],N=e[w],j=o[w];if(N===j){S[w]=N,(u?b<y:iS.call(e,w))&&p++;continue}if(N===null||j===null||typeof N!="object"||typeof j!="object"){S[w]=j;continue}const T=Wo(N,j,a,l+1);S[w]=T,T===N&&p++}return y===g&&p===y?e:S}function Hv(e){const t=Object.getOwnPropertyNames(e);for(const o of t)if(!Bv.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(!Bv.call(e,o))return!1;l.push(o)}return l}function Ym(e){if(!$v(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const a=t.prototype;return!(!$v(a)||!a.hasOwnProperty("isPrototypeOf"))}function $v(e){return Object.prototype.toString.call(e)==="[object Object]"}function Fv(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function sc(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(!sc(e[l],t[l],a))return!1;return!0}if(Ym(e)&&Ym(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)&&!sc(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||!sc(e[f],t[f],a)))return!1;return o===u}return!1}function $u(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 $f(e){return!!(e&&typeof e=="object"&&typeof e.then=="function")}function lS(e){return e.replace(/[\x00-\x1f\x7f]/g,"")}function qv(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 lS(t)}var oS=["http:","https:","mailto:","tel:"];function Vm(e,t){if(!e)return!1;try{const a=new URL(e);return!t.has(a.protocol)}catch{return!1}}function _f(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+=qv(e.slice(a,o.index))+o[0],a=t.lastIndex;l=l+qv(a?e.slice(a):e);let u=!1;return l.startsWith("//")&&(u=!0,l="/"+l.replace(/^\/+/,"")),{path:l,handledProtocolRelativeURL:u}}function cS(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Zm(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 uS="Invariant failed";function io(e,t){if(!e)throw new Error(uS)}var Ko=4,$2=5;function dS(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 V0(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=dS(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 Np(e,t,a,l,o,u,f){var y,g,S,p,b,w,N,j,T,D,z,I,k;f==null||f(a);let m=l;{const P=a.fullPath??a.from,Q=P.length,se=((y=a.options)==null?void 0:y.caseSensitive)??e,W=!!((S=(g=a.options)==null?void 0:g.params)!=null&&S.parse&&((b=(p=a.options)==null?void 0:p.skipRouteOnParseError)!=null&&b.params));for(;m<Q;){const Y=V0(P,m,t);let ee;const me=m,ge=Y[5];switch(m=ge+1,u++,Y[0]){case 0:{const te=P.substring(Y[2],Y[3]);if(se){const xe=(w=o.static)==null?void 0:w.get(te);if(xe)ee=xe;else{o.static??(o.static=new Map);const C=Qo(a.fullPath??a.from);C.parent=o,C.depth=u,ee=C,o.static.set(te,C)}}else{const xe=te.toLowerCase(),C=(N=o.staticInsensitive)==null?void 0:N.get(xe);if(C)ee=C;else{o.staticInsensitive??(o.staticInsensitive=new Map);const q=Qo(a.fullPath??a.from);q.parent=o,q.depth=u,ee=q,o.staticInsensitive.set(xe,q)}}break}case 1:{const te=P.substring(me,Y[1]),xe=P.substring(Y[4],ge),C=se&&!!(te||xe),q=te?C?te:te.toLowerCase():void 0,ie=xe?C?xe:xe.toLowerCase():void 0,he=!W&&((j=o.dynamic)==null?void 0:j.find(re=>!re.skipOnParamError&&re.caseSensitive===C&&re.prefix===q&&re.suffix===ie));if(he)ee=he;else{const re=lg(1,a.fullPath??a.from,C,q,ie);ee=re,re.depth=u,re.parent=o,o.dynamic??(o.dynamic=[]),o.dynamic.push(re)}break}case 3:{const te=P.substring(me,Y[1]),xe=P.substring(Y[4],ge),C=se&&!!(te||xe),q=te?C?te:te.toLowerCase():void 0,ie=xe?C?xe:xe.toLowerCase():void 0,he=!W&&((T=o.optional)==null?void 0:T.find(re=>!re.skipOnParamError&&re.caseSensitive===C&&re.prefix===q&&re.suffix===ie));if(he)ee=he;else{const re=lg(3,a.fullPath??a.from,C,q,ie);ee=re,re.parent=o,re.depth=u,o.optional??(o.optional=[]),o.optional.push(re)}break}case 2:{const te=P.substring(me,Y[1]),xe=P.substring(Y[4],ge),C=se&&!!(te||xe),q=te?C?te:te.toLowerCase():void 0,ie=xe?C?xe:xe.toLowerCase():void 0,he=lg(2,a.fullPath??a.from,C,q,ie);ee=he,he.parent=o,he.depth=u,o.wildcard??(o.wildcard=[]),o.wildcard.push(he)}}o=ee}if(W&&a.children&&!a.isRoot&&a.id&&a.id.charCodeAt(a.id.lastIndexOf("/")+1)===95){const Y=Qo(a.fullPath??a.from);Y.kind=$2,Y.parent=o,u++,Y.depth=u,o.pathless??(o.pathless=[]),o.pathless.push(Y),o=Y}const V=(a.path||!a.children)&&!a.isRoot;if(V&&P.endsWith("/")){const Y=Qo(a.fullPath??a.from);Y.kind=Ko,Y.parent=o,u++,Y.depth=u,o.index=Y,o=Y}o.parse=((z=(D=a.options)==null?void 0:D.params)==null?void 0:z.parse)??null,o.skipOnParamError=W,o.parsingPriority=((k=(I=a.options)==null?void 0:I.skipRouteOnParseError)==null?void 0:k.priority)??0,V&&!o.route&&(o.route=a,o.fullPath=a.fullPath??a.from)}if(a.children)for(const P of a.children)Np(e,t,P,m,o,u,f)}function rg(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 Hl(e){var t,a,l;if(e.pathless)for(const o of e.pathless)Hl(o);if(e.static)for(const o of e.static.values())Hl(o);if(e.staticInsensitive)for(const o of e.staticInsensitive.values())Hl(o);if((t=e.dynamic)!=null&&t.length){e.dynamic.sort(rg);for(const o of e.dynamic)Hl(o)}if((a=e.optional)!=null&&a.length){e.optional.sort(rg);for(const o of e.optional)Hl(o)}if((l=e.wildcard)!=null&&l.length){e.wildcard.sort(rg);for(const o of e.wildcard)Hl(o)}}function Qo(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 lg(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 fS(e,t){const a=Qo("/"),l=new Uint16Array(6);for(const o of e)Np(!1,l,o,1,a,0);Hl(a),t.masksTree=a,t.flatCache=Zm(1e3)}function hS(e,t){e||(e="/");const a=t.flatCache.get(e);if(a)return a;const l=Z0(e,t.masksTree);return t.flatCache.set(e,l),l}function mS(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=Qo("/"),Np(t,new Uint16Array(6),{from:e},1,f,0),o.singleCache.set(u,f)),Z0(l,f,a)}function pS(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=Z0(e,t.segmentTree,a)}catch(f){if(f instanceof URIError)u=null;else throw f}return u&&(u.branch=yS(u.route)),t.matchCache.set(l,u),u}function gS(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function _S(e,t=!1,a){const l=Qo(e.fullPath),o=new Uint16Array(6),u={},f={};let m=0;return Np(t,o,e,1,l,0,y=>{if(a==null||a(y,m),io(!(y.id in u),`Duplicate routes found with id: ${String(y.id)}`),u[y.id]=y,m!==0&&y.path){const g=gS(y.fullPath);(!f[g]||y.fullPath.endsWith("/"))&&(f[g]=y)}m++}),Hl(l),{processedTree:{segmentTree:l,singleCache:Zm(1e3),matchCache:Zm(1e3),flatCache:null,masksTree:null},routesById:u,routesByPath:f}}function Z0(e,t,a=!1){const l=e.split("/"),o=bS(e,l,t,a);if(!o)return null;const[u]=F2(e,l,o);return{route:o.node.route,rawParams:u,parsedParams:o.parsedParams}}function F2(e,t,a){var S,p,b,w,N,j,T,D,z,I;const l=vS(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=((b=a.extract)==null?void 0:b.path)??0,g=((w=a.extract)==null?void 0:w.segment)??0;for(;m<l.length;f++,m++,y++,g++){const k=l[m];if(k.kind===Ko)break;if(k.kind===$2){g--,f--,y--;continue}const P=t[f],Q=y;if(P&&(y+=P.length),k.kind===1){o??(o=a.node.fullPath.split("/"));const se=o[g],W=((N=k.prefix)==null?void 0:N.length)??0;if(se.charCodeAt(W)===123){const V=((j=k.suffix)==null?void 0:j.length)??0,Y=se.substring(W+2,se.length-V-1),ee=P.substring(W,P.length-V);u[Y]=decodeURIComponent(ee)}else{const V=se.substring(1);u[V]=decodeURIComponent(P)}}else if(k.kind===3){if(a.skipped&1<<m){f--,y=Q-1;continue}o??(o=a.node.fullPath.split("/"));const se=o[g],W=((T=k.prefix)==null?void 0:T.length)??0,V=((D=k.suffix)==null?void 0:D.length)??0,Y=se.substring(W+3,se.length-V-1),ee=k.suffix||k.prefix?P.substring(W,P.length-V):P;ee&&(u[Y]=decodeURIComponent(ee))}else if(k.kind===2){const se=k,W=e.substring(Q+(((z=se.prefix)==null?void 0:z.length)??0),e.length-(((I=se.suffix)==null?void 0:I.length)??0)),V=decodeURIComponent(W);u["*"]=V,u._splat=V;break}}return a.rawParams&&Object.assign(u,a.rawParams),[u,{part:f,node:m,path:y,segment:g}]}function yS(e){const t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function vS(e){const t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function bS(e,t,a,l){if(e==="/"&&a.index)return{node:a.index,skipped:0};const o=!Hf(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:b,index:w,skipped:N,depth:j,statics:T,dynamics:D,optionals:z}=p;let{extract:I,rawParams:k,parsedParams:P}=p;if(b.skipOnParamError){if(!og(e,t,p))continue;k=p.rawParams,I=p.extract,P=p.parsedParams}l&&b.route&&b.kind!==Ko&&yf(g,p)&&(g=p);const Q=w===f;if(Q&&(b.route&&!u&&yf(S,p)&&(S=p),!b.optional&&!b.wildcard&&!b.index&&!b.pathless))continue;const se=Q?void 0:t[w];let W;if(Q&&b.index){const V={node:b.index,index:w,skipped:N,depth:j+1,statics:T,dynamics:D,optionals:z,extract:I,rawParams:k,parsedParams:P};let Y=!0;if(b.index.skipOnParamError&&(og(e,t,V)||(Y=!1)),Y){if(T===f&&!D&&!z&&!N)return V;yf(S,V)&&(S=V)}}if(b.wildcard&&yf(y,p))for(const V of b.wildcard){const{prefix:Y,suffix:ee}=V;if(Y&&(Q||!(V.caseSensitive?se:W??(W=se.toLowerCase())).startsWith(Y)))continue;if(ee){if(Q)continue;const ge=t.slice(w).join("/").slice(-ee.length);if((V.caseSensitive?ge:ge.toLowerCase())!==ee)continue}const me={node:V,index:f,skipped:N,depth:j,statics:T,dynamics:D,optionals:z,extract:I,rawParams:k,parsedParams:P};if(!(V.skipOnParamError&&!og(e,t,me))){y=me;break}}if(b.optional){const V=N|1<<j,Y=j+1;for(let ee=b.optional.length-1;ee>=0;ee--){const me=b.optional[ee];m.push({node:me,index:w,skipped:V,depth:Y,statics:T,dynamics:D,optionals:z,extract:I,rawParams:k,parsedParams:P})}if(!Q)for(let ee=b.optional.length-1;ee>=0;ee--){const me=b.optional[ee],{prefix:ge,suffix:te}=me;if(ge||te){const xe=me.caseSensitive?se:W??(W=se.toLowerCase());if(ge&&!xe.startsWith(ge)||te&&!xe.endsWith(te))continue}m.push({node:me,index:w+1,skipped:N,depth:Y,statics:T,dynamics:D,optionals:z+1,extract:I,rawParams:k,parsedParams:P})}}if(!Q&&b.dynamic&&se)for(let V=b.dynamic.length-1;V>=0;V--){const Y=b.dynamic[V],{prefix:ee,suffix:me}=Y;if(ee||me){const ge=Y.caseSensitive?se:W??(W=se.toLowerCase());if(ee&&!ge.startsWith(ee)||me&&!ge.endsWith(me))continue}m.push({node:Y,index:w+1,skipped:N,depth:j+1,statics:T,dynamics:D+1,optionals:z,extract:I,rawParams:k,parsedParams:P})}if(!Q&&b.staticInsensitive){const V=b.staticInsensitive.get(W??(W=se.toLowerCase()));V&&m.push({node:V,index:w+1,skipped:N,depth:j+1,statics:T+1,dynamics:D,optionals:z,extract:I,rawParams:k,parsedParams:P})}if(!Q&&b.static){const V=b.static.get(se);V&&m.push({node:V,index:w+1,skipped:N,depth:j+1,statics:T+1,dynamics:D,optionals:z,extract:I,rawParams:k,parsedParams:P})}if(b.pathless){const V=j+1;for(let Y=b.pathless.length-1;Y>=0;Y--){const ee=b.pathless[Y];m.push({node:ee,index:w,skipped:N,depth:V,statics:T,dynamics:D,optionals:z,extract:I,rawParams:k,parsedParams:P})}}}if(S&&y)return yf(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 b=p===e.length?"/":e.slice(p);return g.rawParams??(g.rawParams=Object.create(null)),g.rawParams["**"]=decodeURIComponent(b),g}return null}function og(e,t,a){try{const[l,o]=F2(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 yf(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===Ko)>(e.node.kind===Ko)||t.node.kind===Ko==(e.node.kind===Ko)&&t.depth>e.depth))):!0}function Im(e){return X0(e.filter(t=>t!==void 0).join("/"))}function X0(e){return e.replace(/\/{2,}/g,"/")}function q2(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function no(e){const t=e.length;return t>1&&e[t-1]==="/"?e.replace(/\/{1,}$/,""):e}function W2(e){return no(q2(e))}function Xm(e,t){return e!=null&&e.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function xS(e,t,a){return Xm(e,a)===Xm(t,a)}function SS({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&&Hf(m)==="";)m.pop();const p=t.split("/");for(let b=0,w=p.length;b<w;b++){const N=p[b];N===""?b?b===w-1&&m.push(N):m=[N]:N===".."?m.pop():N==="."||m.push(N)}}m.length>1&&(Hf(m)===""?a==="never"&&m.pop():a==="always"&&m.push(""));let y,g="";for(let p=0;p<m.length;p++){p>0&&(g+="/");const b=m[p];if(!b)continue;y=V0(b,0,y);const w=y[0];if(w===0){g+=b;continue}const N=y[5],j=b.substring(0,y[1]),T=b.substring(y[4],N),D=b.substring(y[2],y[3]);w===1?g+=j||T?`${j}{$${D}}${T}`:`$${D}`:w===2?g+=j||T?`${j}{$}${T}`:"$":g+=`${j}{-$${D}}${T}`}g=X0(g);const S=g||"/";return f&&l&&l.set(f,S),S}function jS(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 cg(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=>Kv(o,a)).join("/"):Kv(l,a)}function Wv({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=V0(e,S,y);const p=y[5];if(m=p+1,S===p)continue;const b=y[0];if(b===0){g+="/"+e.substring(S,p);continue}if(b===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=cg("_splat",t,a);g+="/"+N+T+j;continue}if(b===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=cg(w,t,a)??"undefined";g+="/"+N+T+j;continue}if(b===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),D=cg(w,t,a)??"";g+="/"+j+D+T;continue}}return e.endsWith("/")&&(g+="/"),{usedParams:u,interpolatedPath:g||"/",isMissingParams:o}}function Kv(e,t){const a=encodeURIComponent(e);return(t==null?void 0:t(a))??a}function ea(e){return!!(e!=null&&e.isNotFound)}function wS(){try{if(typeof window<"u"&&typeof window.sessionStorage=="object")return window.sessionStorage}catch{}}var n0="tsr-scroll-restoration-v1_3",NS=(e,t)=>{let a;return(...l)=>{a||(a=setTimeout(()=>{e(...l),a=null},t))}};function kS(){const e=wS();if(!e)return null;const t=e.getItem(n0);let a=t?JSON.parse(t):{};return{state:a,set:l=>{a=Jl(l,a)||a;try{e.setItem(n0,JSON.stringify(a))}catch{console.warn("[ts-router] Could not persist scroll restoration state to sessionStorage.")}}}}var bm=kS(),ES=e=>e.state.__TSR_key||e.href;function CS(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 Jm=!1;function TS({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];Jm=!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 b={top:0,left:0,behavior:a};if(window.scrollTo(b),o)for(const w of o){if(w==="window")continue;const N=typeof w=="function"?w():document.querySelector(w);N&&N.scrollTo(b)}}Jm=!1}function RS(e,t){if(!bm||((e.options.scrollRestoration??!1)&&(e.isScrollRestoring=!0),e.isScrollRestorationSetup||!bm))return;e.isScrollRestorationSetup=!0,Jm=!1;const a=e.options.getScrollRestorationKey||ES;window.history.scrollRestoration="manual";const l=o=>{if(Jm||!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=CS(o.target)}const f=a(e.state.location);bm.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",NS(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})||(TS({storageKey:n0,key:u,behavior:e.options.scrollRestorationBehavior,shouldScrollRestoration:e.isScrollRestoring,scrollToTopSelectors:e.options.scrollToTopSelectors,location:e.history.location}),e.isScrollRestoring&&bm.set(f=>(f[u]||(f[u]={}),f)))})}function MS(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 AS(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 ug(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function DS(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]=ug(o):Array.isArray(u)?u.push(ug(o)):a[l]=[u,ug(o)]}return a}var OS=LS(JSON.parse),IS=PS(JSON.stringify,JSON.parse);function LS(e){return t=>{t[0]==="?"&&(t=t.substring(1));const a=DS(t);for(const l in a){const o=a[l];if(typeof o=="string")try{a[l]=e(o)}catch{}}return a}}function PS(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=AS(o,l);return u?`?${u}`:""}}var ac="__root__";function US(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 wa(e){return e instanceof Response&&!!e.options}function zS(e){return{input:({url:t})=>{for(const a of e)t=s0(a,t);return t},output:({url:t})=>{for(let a=e.length-1;a>=0;a--)t=K2(e[a],t);return t}}}function BS(e){const t=W2(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=Im(["/",t,f.pathname]),f)}}function s0(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 K2(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 Qn=(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))(Qn||{});function Q2({update:e,notify:t,unwatched:a}){return{link:l,unlink:o,propagate:u,checkDirty:f,shallowPropagate:m};function l(g,S,p){const b=S.depsTail;if(b!==void 0&&b.dep===g)return;const w=b!==void 0?b.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:b,nextDep:w,prevSub:N,nextSub:void 0};w!==void 0&&(w.prevDep=j),b!==void 0?b.nextDep=j:S.deps=j,N!==void 0?N.nextSub=j:g.subs=j}function o(g,S=g.sub){const p=g.dep,b=g.prevDep,w=g.nextDep,N=g.nextSub,j=g.prevSub;return w!==void 0?w.prevDep=b:S.depsTail=b,b!==void 0?b.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 b=g.sub;let w=b.flags;if(w&60?w&12?w&4?!(w&48)&&y(g,b)?(b.flags=w|40,w&=1):w=0:b.flags=w&-9|32:w=0:b.flags=w|32,w&2&&t(b),w&1){const N=b.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,b=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,++b;continue}if(!w){const T=g.nextDep;if(T!==void 0){g=T;continue}}for(;b--;){const T=S.subs,D=T.nextSub!==void 0;if(D?(g=p.value,p=p.prev):g=T,w){if(e(S)){D&&m(T),S=g.sub;continue}w=!1}else S.flags&=-33;S=g.sub;const z=g.nextDep;if(z!==void 0){g=z;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 J0=0,Lo=0,If=0;const $r=[],{link:RD,unlink:G2,propagate:MD,checkDirty:HS,shallowPropagate:AD}=Q2({update(e){return e.depsTail!==void 0?WS(e):KS(e)},notify(e){var l;let t=If,a=t;do if($r[t++]=e,e.flags&=-3,e=(l=e.subs)==null?void 0:l.sub,e===void 0||!(e.flags&2))break;while(!0);for(If=t;a<--t;){const o=$r[a];$r[a++]=$r[t],$r[t]=o}},unwatched(e){e.flags&1?e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,kp(e)):YS.call(e)}});function $S(){return J0}function FS(){++J0}function qS(){--J0||GS()}function WS(e){e.depsTail=void 0,e.flags=5;try{const t=e.value;return t!==(e.value=e.getter(t))}finally{e.flags&=-5,kp(e)}}function KS(e){return e.flags=1,e.currentValue!==(e.currentValue=e.pendingValue)}function QS(e){const t=e.flags;if(t&16||t&32&&HS(e.deps,e)){e.depsTail=void 0,e.flags=6;try{e.fn()}finally{e.flags&=-5,kp(e)}}else e.flags=2}function GS(){try{for(;Lo<If;){const e=$r[Lo];$r[Lo++]=void 0,QS(e)}}finally{for(;Lo<If;){const e=$r[Lo];$r[Lo++]=void 0,e.flags|=10}Lo=0,If=0}}function YS(){this.depsTail=void 0,this.flags=0,kp(this);const e=this.subs;e!==void 0&&G2(e)}function kp(e){const t=e.depsTail;let a=t!==void 0?t.nextDep:e.deps;for(;a!==void 0;)a=G2(a,e)}function e_(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 a0=[];let Lm=0;const{link:Qv,unlink:VS,propagate:ZS,checkDirty:Y2,shallowPropagate:Gv}=Q2({update(e){return e._update()},notify(e){a0[i0++]=e,e.flags&=~Qn.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=Qn.Mutable|Qn.Dirty,ep(e))}});let xm=0,i0=0,Qi;function ep(e){const t=e.depsTail;let a=t!==void 0?t.nextDep:e.deps;for(;a!==void 0;)a=VS(a,e)}function V2(){if(!($S()>0)){for(;xm<i0;){const e=a0[xm];a0[xm++]=void 0,e.notify()}xm=0,i0=0}}function Z2(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?Qn.None:Qn.Mutable,get(){return Qi!==void 0&&Qv(o,Qi,Lm),o._snapshot},subscribe(u){const f=e_(u),m={current:!1},y=XS(()=>{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=Qi,m=Object.is;if(a)Qi=o,++Lm,o.depsTail=void 0;else if(u===void 0)return!1;a&&(o.flags=Qn.Mutable|Qn.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{Qi=f,a&&(o.flags&=~Qn.RecursedCheck),ep(o)}}};return a?(o.flags=Qn.Mutable|Qn.Dirty,o.get=function(){const u=o.flags;if(u&Qn.Dirty||u&Qn.Pending&&Y2(o.deps,o)){if(o._update()){const f=o.subs;f!==void 0&&Gv(f)}}else u&Qn.Pending&&(o.flags=u&~Qn.Pending);return Qi!==void 0&&Qv(o,Qi,Lm),o._snapshot}):o.set=function(u){if(o._update(u)){const f=o.subs;f!==void 0&&(ZS(f),Gv(f),V2())}},o}function XS(e){const t=()=>{const l=Qi;Qi=a,++Lm,a.depsTail=void 0,a.flags=Qn.Watching|Qn.RecursedCheck;try{return e()}finally{Qi=l,a.flags&=~Qn.RecursedCheck,ep(a)}},a={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:Qn.Watching|Qn.RecursedCheck,notify(){const l=this.flags;l&Qn.Dirty||l&Qn.Pending&&Y2(this.deps,this)?t():this.flags=Qn.Watching},stop(){this.flags=Qn.None,this.depsTail=void 0,ep(this)}};return t(),a}class JS{constructor(t){this.atom=Z2(t)}setState(t){this.atom.set(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(e_(t))}}class e7{constructor(t){this.atom=Z2(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(e_(t))}}function t7(e){return typeof e=="function"?new e7(e):new JS(e)}function n7(e){try{FS(),e()}finally{qS(),V2()}}function Lf(e){let t;return n7(()=>{t=e()}),t}var r0=e=>{var t;if(!e.rendered)return e.rendered=!0,(t=e.onReady)==null?void 0:t.call(e)},Ep=(e,t)=>!!(e.preload&&!e.router.state.matches.some(a=>a.id===t)),ic=(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},Yv=(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},eo=(e,t,a)=>{var l,o,u;if(!(!wa(a)&&!ea(a)))throw wa(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:wa(a)?"redirected":f.status==="pending"?"success":f.status,context:ic(e,t.index),isFetching:!1,error:a})),ea(a)&&!a.routeId&&(a.routeId=t.routeId),(u=t._nonReactive.loadPromise)==null||u.resolve()),wa(a)&&(e.rendered=!0,a.options._fromLocation=e.location,a.redirectHandled=!0,a=e.router.resolveRedirect(a))),a},X2=(e,t)=>{const a=e.router.getMatch(t);return!!(!a||a._nonReactive.dehydrated)},Vv=(e,t,a)=>{const l=ic(e,a);e.updateMatch(t,o=>({...o,context:l}))},vf=(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),eo(e,e.router.getMatch(o),a);try{(y=(m=f.options).onError)==null||y.call(m,a)}catch(g){a=g,eo(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&&!wa(a)&&!ea(a)&&(e.serialError??(e.serialError=a))},J2=(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&&!Ep(e,t)&&(a.options.loader||a.options.beforeLoad||t6(a))&&typeof o=="number"&&o!==1/0&&(a.options.pendingComponent??((u=e.router.options)==null?void 0:u.defaultPendingComponent))){const f=setTimeout(()=>{r0(e)},o);l._nonReactive.pendingTimeout=f}},s7=(e,t,a)=>{const l=e.router.getMatch(t);if(!l._nonReactive.beforeLoadPromise&&!l._nonReactive.loaderPromise)return;J2(e,t,a,l);const o=()=>{const u=e.router.getMatch(t);u.preload&&(u.status==="redirected"||u.status==="notFound")&&eo(e,u,u.error)};return l._nonReactive.beforeLoadPromise?l._nonReactive.beforeLoadPromise.then(o):o()},a7=(e,t,a,l)=>{const o=e.router.getMatch(t);let u=o._nonReactive.loadPromise;o._nonReactive.loadPromise=$u(()=>{u==null||u.resolve(),u=void 0});const{paramsError:f,searchError:m}=o;f&&vf(e,a,f,"PARSE_PARAMS"),m&&vf(e,a,m,"VALIDATE_SEARCH"),J2(e,t,l,o);const y=new AbortController;let g=!1;const S=()=>{g||(g=!0,e.updateMatch(t,k=>({...k,isFetching:"beforeLoad",fetchCount:k.fetchCount+1,abortController:y})))},p=()=>{var k;(k=o._nonReactive.beforeLoadPromise)==null||k.resolve(),o._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,P=>({...P,isFetching:!1}))};if(!l.options.beforeLoad){Lf(()=>{S(),p()});return}o._nonReactive.beforeLoadPromise=$u();const b={...ic(e,a,!1),...o.__routeContext},{search:w,params:N,cause:j}=o,T=Ep(e,t),D={search:w,abortController:y,params:N,preload:T,context:b,location:e.location,navigate:k=>e.router.navigate({...k,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:T?"preload":j,matches:e.matches,routeId:l.id,...e.router.options.additionalContext},z=k=>{if(k===void 0){Lf(()=>{S(),p()});return}(wa(k)||ea(k))&&(S(),vf(e,a,k,"BEFORE_LOAD")),Lf(()=>{S(),e.updateMatch(t,P=>({...P,__beforeLoadContext:k})),p()})};let I;try{if(I=l.options.beforeLoad(D),$f(I))return S(),I.catch(k=>{vf(e,a,k,"BEFORE_LOAD")}).then(z)}catch(k){S(),vf(e,a,k,"BEFORE_LOAD")}z(I)},i7=(e,t)=>{const{id:a,routeId:l}=e.matches[t],o=e.router.looseRoutesById[l],u=()=>m(),f=()=>a7(e,a,t,o),m=()=>{if(X2(e,a))return;const y=s7(e,a,o);return $f(y)?y.then(f):f()};return u()},r7=(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,b,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:b,styles:p==null?void 0:p.styles}))},e6=(e,t,a,l,o)=>{const u=t[l-1],{params:f,loaderDeps:m,abortController:y,cause:g}=e.router.getMatch(a),S=ic(e,l),p=Ep(e,a);return{params:f,deps:m,preload:!!p,parentMatchPromise:u,abortController:y,context:S,location:e.location,navigate:b=>e.router.navigate({...b,_fromLocation:e.location}),cause:p?"preload":g,route:o,...e.router.options.additionalContext}},Zv=async(e,t,a,l,o)=>{var u,f,m,y,g;try{const S=e.router.getMatch(a);try{(!(sS??e.router.isServer)||S.ssr===!0)&&Ff(o);const p=o.options.loader,b=typeof p=="function"?p:p==null?void 0:p.handler,w=b==null?void 0:b(e6(e,t,a,l,o)),N=!!b&&$f(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"})),b){const T=N?await w:w;eo(e,e.router.getMatch(a),T),T!==void 0&&e.updateMatch(a,D=>({...D,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:ic(e,l),status:"success",isFetching:!1,updatedAt:Date.now()}))}catch(p){let b=p;if((b==null?void 0:b.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:ic(e,l)}));return}const w=S._nonReactive.minPendingPromise;w&&await w,ea(p)&&await((m=(f=o.options.notFoundComponent)==null?void 0:f.preload)==null?void 0:m.call(f)),eo(e,e.router.getMatch(a),p);try{(g=(y=o.options).onError)==null||g.call(y,p)}catch(N){b=N,eo(e,e.router.getMatch(a),N)}!wa(b)&&!ea(b)&&await Ff(o,["errorComponent"]),e.updateMatch(a,N=>({...N,error:b,context:ic(e,l),status:"error",isFetching:!1}))}}catch(S){const p=e.router.getMatch(a);p&&(p._nonReactive.loaderPromise=void 0),eo(e,p,S)}},l7=async(e,t,a)=>{var w,N,j,T;async function l(D,z,I,k,P){const Q=Date.now()-z.updatedAt,se=D?P.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:P.options.staleTime??e.router.options.defaultStaleTime??0,W=P.options.shouldReload,V=typeof W=="function"?W(e6(e,t,o,a,P)):W,{status:Y,invalid:ee}=k,me=Q>se&&(!!e.forceStaleReload||k.cause==="enter"||I!==void 0&&I!==k.id);f=Y==="success"&&(ee||(V??me)),D&&P.options.preload===!1||(f&&!e.sync&&S?(m=!0,(async()=>{var ge,te;try{await Zv(e,t,o,a,P);const xe=e.router.getMatch(o);(ge=xe._nonReactive.loaderPromise)==null||ge.resolve(),(te=xe._nonReactive.loadPromise)==null||te.resolve(),xe._nonReactive.loaderPromise=void 0,xe._nonReactive.loadPromise=void 0}catch(xe){wa(xe)&&await e.router.navigate(xe.options)}})()):Y!=="success"||f?await Zv(e,t,o,a,P):Vv(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(X2(e,o)){if(!e.router.getMatch(o))return e.matches[a];Vv(e,o,a)}else{const D=e.router.getMatch(o),z=((w=e.router.state.matches[a])==null?void 0:w.routeId)===u?e.router.state.matches[a].id:(N=e.router.state.matches.find(k=>k.routeId===u))==null?void 0:N.id,I=Ep(e,o);if(D._nonReactive.loaderPromise){if(D.status==="success"&&!e.sync&&!D.preload&&S)return D;await D._nonReactive.loaderPromise;const k=e.router.getMatch(o),P=k._nonReactive.error||k.error;P&&eo(e,k,P),k.status==="pending"&&await l(I,D,z,k,y)}else{const k=I&&!e.router.state.matches.some(Q=>Q.id===o),P=e.router.getMatch(o);P._nonReactive.loaderPromise=$u(),k!==P.preload&&e.updateMatch(o,Q=>({...Q,preload:k})),await l(I,D,z,P,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 b=m?p.isFetching:!1;return b!==p.isFetching||p.invalid!==!1?(e.updateMatch(o,D=>({...D,isFetching:b,invalid:!1})),e.router.getMatch(o)):p};async function Xv(e){var b,w;const t=e,a=[];t.router.state.matches.some(N=>N._forcePending)&&r0(t);let l;for(let N=0;N<t.matches.length;N++){try{const j=i7(t,N);$f(j)&&await j}catch(j){if(wa(j))throw j;if(ea(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?Yv(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(l7(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(wa(T))throw T;ea(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=Yv(t,g);io(N!==void 0);const j=t.matches[N],T=t.router.looseRoutesById[j.routeId],D=(b=t.router.options)==null?void 0:b.defaultNotFoundComponent;!T.options.notFoundComponent&&D&&(T.options.notFoundComponent=D),g.routeId=j.routeId;const z=j.routeId===t.router.routeTree.id;t.updateMatch(j.id,I=>({...I,...z?{status:"success",globalNotFound:!0,error:void 0}:{status:"notFound",error:g},isFetching:!1})),S=N,await Ff(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 Ff(N,["errorComponent"])}for(let N=0;N<=S;N++){const{id:j,routeId:T}=t.matches[N],D=t.router.looseRoutesById[T];try{const z=r7(t,j,D);if(z){const I=await z;t.updateMatch(j,k=>({...k,...I}))}}catch(z){console.error(`Error executing head for route ${T}:`,z)}}const p=r0(t);if($f(p)&&await p,g)throw g;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function Jv(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 Ff(e,t=Pm){!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===Pm?(()=>{if(e._componentsPromise===void 0){const l=Jv(e,Pm);l?e._componentsPromise=l.then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0}):e._componentsLoaded=!0}return e._componentsPromise})():Jv(e,t);return e._lazyPromise?e._lazyPromise.then(a):a()}function t6(e){var t;for(const a of Pm)if((t=e.options[a])!=null&&t.preload)return!0;return!1}var Pm=["component","errorComponent","pendingComponent","notFoundComponent"],so="__TSR_index",e4="popstate",t4="beforeunload";function o7(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,b;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=tp(y.path,y.state);if(await w.blockerFn({currentLocation:t,nextLocation:N,action:y.type})){(b=e.onBlocked)==null||b.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[so];m=n4(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[so];m=n4(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[so]!==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(b=>b!==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 n4(e,t){t||(t={});const a=t_();return{...t,key:a,__TSR_key:a,[so]:e}}function c7(e){var W,V;const t=typeof document<"u"?window:void 0,a=t.history.pushState,l=t.history.replaceState;let o=[];const u=()=>o,f=Y=>o=Y,m=(Y=>Y),y=(()=>tp(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!((W=t.history.state)!=null&&W.__TSR_key)&&!((V=t.history.state)!=null&&V.key)){const Y=t_();t.history.replaceState({[so]:0,key:Y,__TSR_key:Y},"")}let g=y(),S,p=!1,b=!1,w=!1,N=!1;const j=()=>g;let T,D;const z=()=>{T&&(se._ignoreSubscribers=!0,(T.isPush?t.history.pushState:t.history.replaceState)(T.state,"",T.href),se._ignoreSubscribers=!1,T=void 0,D=void 0,S=void 0)},I=(Y,ee,me)=>{const ge=m(ee);D||(S=g),g=tp(ee,me),T={href:ge,state:me,isPush:(T==null?void 0:T.isPush)||Y==="push"},D||(D=Promise.resolve().then(()=>z()))},k=Y=>{g=y(),se.notify({type:Y})},P=async()=>{if(b){b=!1;return}const Y=y(),ee=Y.state[so]-g.state[so],me=ee===1,ge=ee===-1,te=!me&&!ge||p;p=!1;const xe=te?"GO":ge?"BACK":"FORWARD",C=te?{type:"GO",index:ee}:{type:ge?"BACK":"FORWARD"};if(w)w=!1;else{const q=u();if(typeof document<"u"&&q.length){for(const ie of q)if(await ie.blockerFn({currentLocation:g,nextLocation:Y,action:xe})){b=!0,t.history.go(1),se.notify(C);return}}}g=y(),se.notify(C)},Q=Y=>{if(N){N=!1;return}let ee=!1;const me=u();if(typeof document<"u"&&me.length)for(const ge of me){const te=ge.enableBeforeUnload??!0;if(te===!0){ee=!0;break}if(typeof te=="function"&&te()===!0){ee=!0;break}}if(ee)return Y.preventDefault(),Y.returnValue=""},se=o7({getLocation:j,getLength:()=>t.history.length,pushState:(Y,ee)=>I("push",Y,ee),replaceState:(Y,ee)=>I("replace",Y,ee),back:Y=>(Y&&(w=!0),N=!0,t.history.back()),forward:Y=>{Y&&(w=!0),N=!0,t.history.forward()},go:Y=>{p=!0,t.history.go(Y)},createHref:Y=>m(Y),flush:z,destroy:()=>{t.history.pushState=a,t.history.replaceState=l,t.removeEventListener(t4,Q,{capture:!0}),t.removeEventListener(e4,P)},onBlocked:()=>{S&&g!==S&&(g=S)},getBlockers:u,setBlockers:f,notifyOnIndexChange:!1});return t.addEventListener(t4,Q,{capture:!0}),t.addEventListener(e4,P),t.history.pushState=function(...Y){const ee=a.apply(t.history,Y);return se._ignoreSubscribers||k("PUSH"),ee},t.history.replaceState=function(...Y){const ee=l.apply(t.history,Y);return se._ignoreSubscribers||k("REPLACE"),ee},se}function u7(e){let t=e.replace(/[\x00-\x1f\x7f]/g,"");return t.startsWith("//")&&(t="/"+t.replace(/^\/+/,"")),t}function tp(e,t){const a=u7(e),l=a.indexOf("#"),o=a.indexOf("?"),u=t_();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||{[so]:0,key:u,__TSR_key:u}}}function t_(){return(Math.random()+1).toString(36).substring(7)}function rc(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 d7(e){const t=e.filter(a=>a.status!=="redirected");return t.length===e.length?e:t}var f7=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=jS(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=c7()),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=Zm(1e3),S=this.buildRouteTree(),this.setRoutes(S)}!this.__store&&this.latestLocation&&(this.__store=t7(m7(this.latestLocation)),RS(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=W2(m);p&&p!=="/"&&S.push(BS({basepath:m})),y&&S.push(y),this.rewrite=S.length===0?void 0:S.length===1?S[0]:zS(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=_S(this.routeTree,this.options.caseSensitive,(a,l)=>{a.init({originalIndex:l})});return this.options.routeMasks&&fS(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),D=this.options.stringifySearch(T);return{href:m+D+g,publicHref:S,pathname:_f(m).path,external:!1,searchStr:D,search:Io(a==null?void 0:a.search,T),hash:_f(g.slice(1)).path,state:Wo(a==null?void 0:a.state,p)}}const b=new URL(S,this.origin),w=s0(this.rewrite,b),N=this.options.parseSearch(w.search),j=this.options.stringifySearch(N);return w.search=j,{href:w.href.replace(w.origin,""),publicHref:S,pathname:_f(w.pathname).path,external:!!this.rewrite&&w.origin!==this.origin,searchStr:j,search:Io(a==null?void 0:a.search,N),hash:_f(w.hash.slice(1)).path,state:Wo(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)=>SS({base:t,to:X0(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=>p7({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 V,Y;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,"."),b=o.params===!1||o.params===null?Object.create(null):(o.params??!0)===!0?S:Object.assign(S,Jl(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(b).length>0)for(const ee of N){const me=((V=ee.options.params)==null?void 0:V.stringify)??ee.options.stringifyParams;if(me)try{Object.assign(b,me(b))}catch{}}const j=t.leaveParams?p:_f(Wv({path:p,params:b,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path;let T=g;if(t._includeValidateSearch&&((Y=this.options.search)!=null&&Y.strict)){const ee={};N.forEach(me=>{if(me.options.validateSearch)try{Object.assign(ee,Um(me.options.validateSearch,{...ee,...T}))}catch{}}),T=ee}T=g7({search:T,dest:o,destRoutes:N,_includeValidateSearch:t._includeValidateSearch}),T=Io(g,T);const D=this.options.stringifySearch(T),z=o.hash===!0?u.hash:o.hash?Jl(o.hash,u.hash):void 0,I=z?`#${z}`:"";let k=o.state===!0?u.state:o.state?Jl(o.state,u.state):{};k=Wo(u.state,k);const P=`${j}${D}${I}`;let Q,se,W=!1;if(this.rewrite){const ee=new URL(P,this.origin),me=K2(this.rewrite,ee);Q=ee.href.replace(ee.origin,""),me.origin!==this.origin?(se=me.href,W=!0):se=me.pathname+me.search+me.hash}else Q=cS(P),se=Q;return{publicHref:se,href:Q,pathname:j,search:T,searchStr:D,state:k,hash:z??"",external:W,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=hS(f.pathname,this.processedTree);if(g){Object.assign(y,g.rawParams);const{from:S,params:p,...b}=g.route,w=p===!1||p===null?Object.create(null):(p??!0)===!0?y:Object.assign(y,Jl(p,y));u={from:t.from,...b,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=sc(l.state,this.latestLocation.state);return m.forEach(g=>{delete l.state[g]}),y},u=no(this.latestLocation.href)===no(l.href);let f=this.commitLocationPromise;if(this.commitLocationPromise=$u(()=>{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=tp(f,{__TSR_index:t?S:S+1}),b=new URL(p.pathname,this.origin);m.to=s0(this.rewrite,b).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(Vm(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",...rc({resolvedLocation:S,location:g})}),this.emit({type:"onBeforeLoad",...rc({resolvedLocation:S,location:g})}),await Xv({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=[],b=[],w=[],N=[];Lf(()=>{this.__store.setState(j=>{const T=j.matches,D=j.pendingMatches||j.matches;return p=T.filter(z=>!D.some(I=>I.id===z.id)),b=T.filter(z=>!D.some(I=>I.routeId===z.routeId)),w=D.filter(z=>!T.some(I=>I.routeId===z.routeId)),N=D.filter(z=>T.some(I=>I.routeId===z.routeId)),{...j,isLoading:!1,loadedAt:Date.now(),matches:D,pendingMatches:void 0,cachedMatches:[...j.cachedMatches,...p.filter(z=>z.status!=="error"&&z.status!=="notFound"&&z.status!=="redirected")]}}),this.clearExpiredCache()}),[[b,"onLeave"],[w,"onEnter"],[N,"onStay"]].forEach(([j,T])=>{j.forEach(D=>{var z,I;(I=(z=this.looseRoutesById[D.routeId].options)[T])==null||I.call(z,D)})})})})}})}catch(g){wa(g)?(a=g,this.navigate({...a.options,replace:!0,ignoreBlocker:!0})):ea(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(rc({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:d7(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&&Vm(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=Ff,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)]);Lf(()=>{l.forEach(f=>{u.has(f.id)||this.__store.setState(m=>({...m,cachedMatches:[...m.cachedMatches,f]}))})});try{return l=await Xv({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(wa(f))return f.options.reloadDocument?void 0:await this.preloadRoute({...f.options,_fromLocation:a});ea(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=mS(o.pathname,(a==null?void 0:a.caseSensitive)??!1,(a==null?void 0:a.fuzzy)??!1,u.pathname,this.processedTree);return!f||t.params&&!sc(f.rawParams,t.params,{partial:!0})?!1:(a==null?void 0:a.includeSearch)??!0?sc(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??IS,parseSearch:e.parseSearch??OS,protocolAllowlist:e.protocolAllowlist??oS}),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,b;const a=this.getMatchedRoutes(e.pathname),{foundRoute:l,routeParams:o,parsedParams:u}=a;let{matchedRoutes:f}=a,m=!1;(l?l.path!=="/"&&o["**"]:no(e.pathname))&&(this.options.notFoundRoute?f=[...f,this.options.notFoundRoute]:m=!0);const y=m?y7(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,D,z;{const xe=(j==null?void 0:j.search)??e.search,C=(j==null?void 0:j._strictSearch)??void 0;try{const q=Um(N.options.validateSearch,{...xe})??void 0;T={...xe,...q},D={...C,...q},z=void 0}catch(q){let ie=q;if(q instanceof np||(ie=new np(q.message,{cause:q})),t!=null&&t.throwOnError)throw ie;T=xe,D={},z=ie}}const I=((b=(p=N.options).loaderDeps)==null?void 0:b.call(p,{search:T}))??"",k=I?JSON.stringify(I):"",{interpolatedPath:P,usedParams:Q}=Wv({path:N.fullPath,params:o,decoder:this.pathParamsDecoder,server:this.isServer}),se=N.id+P+k,W=this.getMatch(se),V=S.get(N.id),Y=(W==null?void 0:W._strictParams)??Q;let ee;if(!W)try{s4(N,Q,u,Y)}catch(xe){if(ea(xe)||wa(xe)?ee=xe:ee=new h7(xe.message,{cause:xe}),t!=null&&t.throwOnError)throw ee}Object.assign(o,Y);const me=V?"stay":"enter";let ge;if(W)ge={...W,cause:me,params:(V==null?void 0:V.params)??o,_strictParams:Y,search:Io(V?V.search:W.search,T),_strictSearch:D};else{const xe=N.options.loader||N.options.beforeLoad||N.lazyFn||t6(N)?"pending":"success";ge={id:se,ssr:N.options.ssr,index:w,routeId:N.id,params:(V==null?void 0:V.params)??o,_strictParams:Y,pathname:P,updatedAt:Date.now(),search:V?Io(V.search,T):T,_strictSearch:D,searchError:void 0,status:xe,isFetching:!1,error:void 0,paramsError:ee,__routeContext:void 0,_nonReactive:{loadPromise:$u()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:me,loaderDeps:V?Wo(V.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||(ge.globalNotFound=y===N.id),ge.searchError=z;const te=this.getParentContext(j);ge.context={...te,...ge.__routeContext,...ge.__beforeLoadContext},g[w]=ge}for(let w=0;w<g.length;w++){const N=g[w],j=this.looseRoutesById[N.routeId],T=this.getMatch(N.id),D=S.get(N.routeId);if(N.params=D?Io(D.params,o):o,!T){const z=g[w-1],I=this.getParentContext(z);if(j.options.context){const k={deps:N.loaderDeps,params:N.params,context:I??{},location:e,navigate:P=>this.navigate({...P,_fromLocation:e}),buildLocation:this.buildLocation,cause:N.cause,abortController:N.abortController,preload:!!N.preload,matches:g,routeId:j.id};N.__routeContext=j.options.context(k)??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=Hf(t),u={...e.search};for(const g of t)try{Object.assign(u,Um(g.options.validateSearch,u))}catch{}const f=Hf(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{s4(S,a,l??{},g)}catch{}y=g}return{matchedRoutes:t,fullPath:o.fullPath,search:u,params:y}}},np=class extends Error{},h7=class extends Error{};function m7(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:e,matches:[],pendingMatches:[],cachedMatches:[],statusCode:200}}function Um(e,t){if(e==null)return{};if("~standard"in e){const a=e["~standard"].validate(t);if(a instanceof Promise)throw new np("Async validation not supported");if(a.issues)throw new np(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 p7({pathname:e,routesById:t,processedTree:a}){const l=Object.create(null),o=no(e);let u,f;const m=pS(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 g7({search:e,dest:t,destRoutes:a,_includeValidateSearch:l}){return _7(a)(e,t,l??!1)}function _7(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,b)=>b(p),m));const S=y(g);return"postSearchFilters"in u.options&&u.options.postSearchFilters?u.options.postSearchFilters.reduce((p,b)=>b(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,...Um(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:Jl(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 y7(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 ac}function s4(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 v7="Error preloading route! ☝️",n6=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=ac:this.parentRoute||io(!1);let o=l?ac:a==null?void 0:a.path;o&&o!=="/"&&(o=q2(o));const u=(a==null?void 0:a.id)||o;let f=l?ac:Im([this.parentRoute.id==="__root__"?"":this.parentRoute.id,u]);o==="__root__"&&(o="/"),f!=="__root__"&&(f=Im(["/",f]));const m=f==="__root__"?"/":Im([this.parentRoute.fullPath,o]);this._path=o,this._id=f,this._fullPath=m,this._to=no(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=>US({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.")}},b7=class extends n6{constructor(e){super(e)}};function n_(e){const t=e.errorComponent??s_;return i.jsx(x7,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:a,reset:l})=>a?_.createElement(t,{error:a,reset:l}):e.children})}var x7=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 s_({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 S7({children:e,fallback:t=null}){return s6()?i.jsx(qr.Fragment,{children:e}):i.jsx(qr.Fragment,{children:t})}function s6(){return qr.useSyncExternalStore(j7,()=>!0,()=>!1)}function j7(){return()=>{}}var a6=_.createContext(null);function Za(e){const t=_.useContext(a6);return e==null||e.warn,t}var dg={exports:{}},fg={},hg={exports:{}},mg={};/**
|
|
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 a4;function w7(){if(a4)return mg;a4=1;var e=rh();function t(p,b){return p===b&&(p!==0||1/p===1/b)||p!==p&&b!==b}var a=typeof Object.is=="function"?Object.is:t,l=e.useState,o=e.useEffect,u=e.useLayoutEffect,f=e.useDebugValue;function m(p,b){var w=b(),N=l({inst:{value:w,getSnapshot:b}}),j=N[0].inst,T=N[1];return u(function(){j.value=w,j.getSnapshot=b,y(j)&&T({inst:j})},[p,w,b]),o(function(){return y(j)&&T({inst:j}),p(function(){y(j)&&T({inst:j})})},[p]),f(w),w}function y(p){var b=p.getSnapshot;p=p.value;try{var w=b();return!a(p,w)}catch{return!0}}function g(p,b){return b()}var S=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?g:m;return mg.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:S,mg}var i4;function N7(){return i4||(i4=1,hg.exports=w7()),hg.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 r4;function k7(){if(r4)return fg;r4=1;var e=rh(),t=N7();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 fg.useSyncExternalStoreWithSelector=function(g,S,p,b,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 D(Q){if(!z){if(z=!0,I=Q,Q=b(Q),w!==void 0&&j.hasValue){var se=j.value;if(w(se,Q))return k=se}return k=Q}if(se=k,l(I,Q))return se;var W=b(Q);return w!==void 0&&w(se,W)?(I=Q,se):(I=Q,k=W)}var z=!1,I,k,P=p===void 0?null:p;return[function(){return D(S())},P===null?void 0:function(){return D(P())}]},[S,p,b,w]);var T=o(g,N[0],N[1]);return f(function(){j.hasValue=!0,j.value=T},[T]),y(T),T},fg}var l4;function E7(){return l4||(l4=1,dg.exports=k7()),dg.exports}var C7=E7();function T7(e,t){return e===t}function R7(e,t,a=T7){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 C7.useSyncExternalStoreWithSelector(l,o,o,t,a)}function Ia(e){const t=Za({warn:(e==null?void 0:e.router)===void 0}),a=(e==null?void 0:e.router)||t,l=_.useRef(void 0);return R7(a.__store,o=>{if(e!=null&&e.select){if(e.structuralSharing??a.options.defaultStructuralSharing){const u=Wo(l.current,e.select(o));return l.current=u,u}return e.select(o)}return o})}var Cp=_.createContext(void 0),M7=_.createContext(void 0);function lo(e){const t=_.useContext(e.from?M7:Cp);return Ia({select:a=>{const l=a.matches.find(o=>e.from?e.from===o.routeId:o.id===t);if(io(!((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 a_(e){return lo({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function i_(e){const{select:t,...a}=e;return lo({...a,select:l=>t?t(l.loaderDeps):l.loaderDeps})}function ad(e){return lo({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 r_(e){return lo({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function ki(e){const t=Za();return _.useCallback(a=>t.navigate({...a,from:a.from??(e==null?void 0:e.from)}),[e==null?void 0:e.from,t])}function l_(e){return lo({...e,select:t=>e.select?e.select(t.context):t.context})}var Ya=T2();function A7(e,t){const a=Za(),l=nS(t),{activeProps:o,inactiveProps:u,activeOptions:f,to:m,preload:y,preloadDelay:g,hashScrollIntoView:S,replace:p,startTransition:b,resetScroll:w,viewTransition:N,children:j,target:T,disabled:D,style:z,className:I,onClick:k,onBlur:P,onFocus:Q,onMouseEnter:se,onMouseLeave:W,onTouchStart:V,ignoreBlocker:Y,params:ee,search:me,hash:ge,state:te,mask:xe,reloadDocument:C,unsafeRelative:q,from:ie,_fromLocation:he,...re}=e,L=s6(),ae=Ia({select:Ve=>{const Ke=Ve.matches[Ve.matches.length-1];return{search:Ke==null?void 0:Ke.search,hash:Ve.location.hash,path:Ke==null?void 0:Ke.pathname}},structuralSharing:!0}),ke=e.from,U=_.useMemo(()=>({...e,from:ke}),[a,ae,ke,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),ve=_.useMemo(()=>a.buildLocation({...U}),[a,U]),Z=ve.maskedLocation?ve.maskedLocation.publicHref:ve.publicHref,Se=ve.maskedLocation?ve.maskedLocation.external:ve.external,je=_.useMemo(()=>U7(Z,Se,a.history,D),[D,Se,Z,a.history]),Oe=_.useMemo(()=>{if(je!=null&&je.external)return Vm(je.href,a.protocolAllowlist)?void 0:je.href;if(!z7(m)&&!(typeof m!="string"||m.indexOf(":")===-1))try{return new URL(m),Vm(m,a.protocolAllowlist)?void 0:m}catch{}},[m,je,a.protocolAllowlist]),Ie=Ia({select:Ve=>{if(Oe)return!1;if(f!=null&&f.exact){if(!xS(Ve.location.pathname,ve.pathname,a.basepath))return!1}else{const Ke=Xm(Ve.location.pathname,a.basepath),Nt=Xm(ve.pathname,a.basepath);if(!(Ke.startsWith(Nt)&&(Ke.length===Nt.length||Ke[Nt.length]==="/")))return!1}return((f==null?void 0:f.includeSearch)??!0)&&!sc(Ve.location.search,ve.search,{partial:!(f!=null&&f.exact),ignoreUndefined:!(f!=null&&f.explicitUndefined)})?!1:f!=null&&f.includeHash?L&&Ve.location.hash===ve.hash:!0}}),wt=Ie?Jl(o,{})??D7:pg,qe=Ie?pg:Jl(u,{})??pg,bt=[I,wt.className,qe.className].filter(Boolean).join(" "),Ut=(z||wt.style||qe.style)&&{...z,...wt.style,...qe.style},[$t,zt]=_.useState(!1),xt=_.useRef(!1),it=e.reloadDocument||Oe?!1:y??a.options.defaultPreload,ot=g??a.options.defaultPreloadDelay??0,ln=_.useCallback(()=>{a.preloadRoute({...U,_builtLocation:ve}).catch(Ve=>{console.warn(Ve),console.warn(v7)})},[a,U,ve]);tS(l,_.useCallback(Ve=>{Ve!=null&&Ve.isIntersecting&&ln()},[ln]),P7,{disabled:!!D||it!=="viewport"}),_.useEffect(()=>{xt.current||!D&&it==="render"&&(ln(),xt.current=!0)},[D,ln,it]);const on=Ve=>{const Ke=Ve.currentTarget.getAttribute("target"),Nt=T!==void 0?T:Ke;if(!D&&!B7(Ve)&&!Ve.defaultPrevented&&(!Nt||Nt==="_self")&&Ve.button===0){Ve.preventDefault(),Ya.flushSync(()=>{zt(!0)});const Bt=a.subscribe("onResolved",()=>{Bt(),zt(!1)});a.navigate({...U,replace:p,resetScroll:w,hashScrollIntoView:S,startTransition:b,viewTransition:N,ignoreBlocker:Y})}};if(Oe)return{...re,ref:l,href:Oe,...j&&{children:j},...T&&{target:T},...D&&{disabled:D},...z&&{style:z},...I&&{className:I},...k&&{onClick:k},...P&&{onBlur:P},...Q&&{onFocus:Q},...se&&{onMouseEnter:se},...W&&{onMouseLeave:W},...V&&{onTouchStart:V}};const kn=Ve=>{if(D||it!=="intent")return;if(!ot){ln();return}const Ke=Ve.currentTarget;if(bf.has(Ke))return;const Nt=setTimeout(()=>{bf.delete(Ke),ln()},ot);bf.set(Ke,Nt)},En=Ve=>{D||it!=="intent"||ln()},ht=Ve=>{if(D||!it||!ot)return;const Ke=Ve.currentTarget,Nt=bf.get(Ke);Nt&&(clearTimeout(Nt),bf.delete(Ke))};return{...re,...wt,...qe,href:je==null?void 0:je.href,ref:l,onClick:du([k,on]),onBlur:du([P,ht]),onFocus:du([Q,kn]),onMouseEnter:du([se,kn]),onMouseLeave:du([W,ht]),onTouchStart:du([V,En]),disabled:!!D,target:T,...Ut&&{style:Ut},...bt&&{className:bt},...D&&O7,...Ie&&I7,...L&&$t&&L7}}var pg={},D7={className:"active"},O7={role:"link","aria-disabled":!0},I7={"data-status":"active","aria-current":"page"},L7={"data-transitioning":"transitioning"},bf=new WeakMap,P7={rootMargin:"100px"},du=e=>t=>{for(const a of e)if(a){if(t.defaultPrevented)return;a(t)}};function U7(e,t,a,l){if(!l)return t?{href:e,external:!0}:{href:a.createHref(e)||"/",external:!1}}function z7(e){if(typeof e!="string")return!1;const t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var sp=_.forwardRef((e,t)=>{const{_asChild:a,...l}=e,{type:o,...u}=A7(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 B7(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var H7=class extends n6{constructor(e){super(e),this.useMatch=t=>lo({select:t==null?void 0:t.select,from:this.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>l_({...t,from:this.id}),this.useSearch=t=>r_({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useParams=t=>ad({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useLoaderDeps=t=>i_({...t,from:this.id}),this.useLoaderData=t=>a_({...t,from:this.id}),this.useNavigate=()=>ki({from:this.fullPath}),this.Link=qr.forwardRef((t,a)=>i.jsx(sp,{ref:a,from:this.fullPath,...t})),this.$$typeof=Symbol.for("react.memo")}};function hc(e){return new H7(e)}var $7=class extends b7{constructor(e){super(e),this.useMatch=t=>lo({select:t==null?void 0:t.select,from:this.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>l_({...t,from:this.id}),this.useSearch=t=>r_({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useParams=t=>ad({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useLoaderDeps=t=>i_({...t,from:this.id}),this.useLoaderData=t=>a_({...t,from:this.id}),this.useNavigate=()=>ki({from:this.fullPath}),this.Link=qr.forwardRef((t,a)=>i.jsx(sp,{ref:a,from:this.fullPath,...t})),this.$$typeof=Symbol.for("react.memo")}};function F7(e){return new $7(e)}function o4(e){return typeof e=="object"?new c4(e,{silent:!0}).createRoute(e):new c4(e,{silent:!0}).createRoute}var c4=class{constructor(e,t){this.path=e,this.createRoute=a=>{const l=hc(a);return l.isRoot=!1,l},this.silent=t==null?void 0:t.silent}},u4=class{constructor(e){this.useMatch=t=>lo({select:t==null?void 0:t.select,from:this.options.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>l_({...t,from:this.options.id}),this.useSearch=t=>r_({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.options.id}),this.useParams=t=>ad({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.options.id}),this.useLoaderDeps=t=>i_({...t,from:this.options.id}),this.useLoaderData=t=>a_({...t,from:this.options.id}),this.useNavigate=()=>ki({from:Za().routesById[this.options.id].fullPath}),this.options=e,this.$$typeof=Symbol.for("react.memo")}};function d4(e){return typeof e=="object"?new u4(e):t=>new u4({id:e,...t})}function q7(e){const t=Ia({select:a=>`not-found-${a.location.pathname}-${a.status}`});return i.jsx(n_,{getResetKey:()=>t,onCatch:(a,l)=>{var o;if(ea(a))(o=e.onCatch)==null||o.call(e,a,l);else throw a},errorComponent:({error:a})=>{var l;if(ea(a))return(l=e.fallback)==null?void 0:l.call(e,a);throw a},children:e.children})}function W7(){return i.jsx("p",{children:"Not Found"})}function vu(e){return i.jsx(i.Fragment,{children:e.children})}function i6(e,t,a){return t.options.notFoundComponent?i.jsx(t.options.notFoundComponent,{...a}):e.options.defaultNotFoundComponent?i.jsx(e.options.defaultNotFoundComponent,{...a}):i.jsx(W7,{})}function K7(){return Za().isScrollRestoring,null}var r6=_.memo(function({matchId:t}){var N,j;const a=Za(),l=Ia({select:T=>{var I;const D=T.matches.findIndex(k=>k.id===t),z=T.matches[D];return io(z),{routeId:z.routeId,ssr:z.ssr,_displayPending:z._displayPending,resetKey:T.loadedAt,parentRouteId:(I=T.matches[D-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:vu,b=m?n_:vu,w=g?q7:vu;return i.jsxs(o.isRoot?o.options.shellComponent??vu:vu,{children:[i.jsx(Cp.Provider,{value:t,children:i.jsx(p,{fallback:f,children:i.jsx(b,{getResetKey:()=>l.resetKey,errorComponent:m||s_,onCatch:(T,D)=>{if(ea(T))throw T;y==null||y(T,D)},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(S7,{fallback:f,children:i.jsx(f4,{matchId:t})}):i.jsx(f4,{matchId:t})})})})}),l.parentRouteId===ac&&a.options.scrollRestoration?i.jsxs(i.Fragment,{children:[i.jsx(Q7,{}),i.jsx(K7,{})]}):null]})});function Q7(){const e=Za(),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",...rc(e.state)}),t.current=e.latestLocation)}},e.latestLocation.state.__TSR_key)}var f4=_.memo(function({matchId:t}){var y,g,S,p;const a=Za(),{match:l,key:o,routeId:u}=Ia({select:b=>{var T;const w=b.matches.find(D=>D.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 b=f.options.component??a.options.defaultComponent;return b?i.jsx(b,{},o):i.jsx(l6,{})},[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 b=f.options.pendingMinMs??a.options.defaultPendingMinMs;if(b){const w=a.getMatch(l.id);if(w&&!w._nonReactive.minPendingPromise){const N=$u();w._nonReactive.minPendingPromise=N,setTimeout(()=>{N.resolve(),w._nonReactive.minPendingPromise=void 0},b)}}throw(S=a.getMatch(l.id))==null?void 0:S._nonReactive.loadPromise}if(l.status==="notFound")return io(ea(l.error)),i6(a,f,l.error);if(l.status==="redirected")throw io(wa(l.error)),(p=a.getMatch(l.id))==null?void 0:p._nonReactive.loadPromise;if(l.status==="error")throw l.error;return m}),l6=_.memo(function(){const t=Za(),a=_.useContext(Cp),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 io(S),S.globalNotFound}}),f=Ia({select:g=>{var p;const S=g.matches;return(p=S[S.findIndex(b=>b.id===a)+1])==null?void 0:p.id}}),m=t.options.defaultPendingComponent?i.jsx(t.options.defaultPendingComponent,{}):null;if(u)return i6(t,o,void 0);if(!f)return null;const y=i.jsx(r6,{matchId:f});return l===ac?i.jsx(_.Suspense,{fallback:m,children:y}):y});function G7(){const e=Za(),t=_.useRef({router:e,mounted:!1}),[a,l]=_.useState(!1),{hasPendingMatches:o,isLoading:u}=Ia({select:p=>({isLoading:p.isLoading,hasPendingMatches:p.matches.some(b=>b.status==="pending")}),structuralSharing:!0}),f=ig(u),m=u||a||o,y=ig(m),g=u||o,S=ig(g);return e.startTransition=p=>{l(!0),_.startTransition(()=>{p(),l(!1)})},_.useEffect(()=>{const p=e.history.subscribe(e.load),b=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return no(e.latestLocation.publicHref)!==no(b.publicHref)&&e.commitLocation({...b,replace:!0}),()=>{p()}},[e,e.history]),vm(()=>{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(b){console.error(b)}})()},[e]),vm(()=>{f&&!u&&e.emit({type:"onLoad",...rc(e.state)})},[f,e,u]),vm(()=>{S&&!g&&e.emit({type:"onBeforeRouteMount",...rc(e.state)})},[g,S,e]),vm(()=>{if(y&&!m){const p=rc(e.state);e.emit({type:"onResolved",...p}),e.__store.setState(b=>({...b,status:"idle",resolvedLocation:b.location})),p.hrefChanged&&MS(e)}},[m,y,e]),null}function Y7(){const e=Za(),t=e.routesById[ac].options.pendingComponent??e.options.defaultPendingComponent,a=t?i.jsx(t,{}):null,l=i.jsxs(typeof document<"u"&&e.ssr?vu:_.Suspense,{fallback:a,children:[i.jsx(G7,{}),i.jsx(V7,{})]});return e.options.InnerWrap?i.jsx(e.options.InnerWrap,{children:l}):l}function V7(){const e=Za(),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(r6,{matchId:t}):null;return i.jsx(Cp.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?l:i.jsx(n_,{getResetKey:()=>a,errorComponent:s_,onCatch:void 0,children:l})})}var Z7=e=>new X7(e),X7=class extends f7{constructor(e){super(e)}};typeof globalThis<"u"?(globalThis.createFileRoute=o4,globalThis.createLazyFileRoute=d4):typeof window<"u"&&(window.createFileRoute=o4,window.createLazyFileRoute=d4);function J7({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(a6.Provider,{value:e,children:t});return e.options.Wrap?i.jsx(e.options.Wrap,{children:l}):l}function ej({router:e,...t}){return i.jsx(J7,{router:e,...t,children:i.jsx(Y7,{})})}/*! Capacitor: https://capacitorjs.com/ - MIT License */var Fu;(function(e){e.Unimplemented="UNIMPLEMENTED",e.Unavailable="UNAVAILABLE"})(Fu||(Fu={}));class gg extends Error{constructor(t,a,l){super(t),this.message=t,this.code=a,this.data=l}}const tj=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"},nj=e=>{const t=e.CapacitorCustomPlatform||null,a=e.Capacitor||{},l=a.Plugins=a.Plugins||{},o=()=>t!==null?t.name:tj(e),u=()=>o()!=="web",f=p=>{const b=g.get(p);return!!(b!=null&&b.platforms.has(o())||m(p))},m=p=>{var b;return(b=a.PluginHeaders)===null||b===void 0?void 0:b.find(w=>w.name===p)},y=p=>e.console.error(p),g=new Map,S=(p,b={})=>{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 D=async()=>(!T&&N in b?T=typeof b[N]=="function"?T=await b[N]():T=b[N]:t!==null&&!T&&"web"in b&&(T=typeof b.web=="function"?T=await b.web():T=b.web),T),z=(W,V)=>{var Y,ee;if(j){const me=j==null?void 0:j.methods.find(ge=>V===ge.name);if(me)return me.rtype==="promise"?ge=>a.nativePromise(p,V.toString(),ge):(ge,te)=>a.nativeCallback(p,V.toString(),ge,te);if(W)return(Y=W[V])===null||Y===void 0?void 0:Y.bind(W)}else{if(W)return(ee=W[V])===null||ee===void 0?void 0:ee.bind(W);throw new gg(`"${p}" plugin is not implemented on ${N}`,Fu.Unimplemented)}},I=W=>{let V;const Y=(...ee)=>{const me=D().then(ge=>{const te=z(ge,W);if(te){const xe=te(...ee);return V=xe==null?void 0:xe.remove,xe}else throw new gg(`"${p}.${W}()" is not implemented on ${N}`,Fu.Unimplemented)});return W==="addListener"&&(me.remove=async()=>V()),me};return Y.toString=()=>`${W.toString()}() { [capacitor code] }`,Object.defineProperty(Y,"name",{value:W,writable:!1,configurable:!1}),Y},k=I("addListener"),P=I("removeListener"),Q=(W,V)=>{const Y=k({eventName:W},V),ee=async()=>{const ge=await Y;P({eventName:W,callbackId:ge},V)},me=new Promise(ge=>Y.then(()=>ge({remove:ee})));return me.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await ee()},me},se=new Proxy({},{get(W,V){switch(V){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return j?Q:k;case"removeListener":return P;default:return I(V)}}});return l[p]=se,g.set(p,{name:p,proxy:se,platforms:new Set([...Object.keys(b),...j?[N]:[]])}),se};return a.convertFileSrc||(a.convertFileSrc=p=>p),a.getPlatform=o,a.handleError=y,a.isNativePlatform=u,a.isPluginAvailable=f,a.registerPlugin=S,a.Exception=gg,a.DEBUG=!!a.DEBUG,a.isLoggingEnabled=!!a.isLoggingEnabled,a},sj=e=>e.Capacitor=nj(e),Qr=sj(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),mc=Qr.registerPlugin;class o6{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 Qr.Exception(t,Fu.Unimplemented)}unavailable(t="not available"){return new Qr.Exception(t,Fu.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 h4=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),m4=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class aj extends o6{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=m4(o).trim(),u=m4(u).trim(),a[o]=u}),a}async setCookie(t){try{const a=h4(t.key),l=h4(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)}}}mc("CapacitorCookies",{web:()=>new aj});const ij=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)}),rj=(e={})=>{const t=Object.keys(e);return Object.keys(e).map(o=>o.toLocaleLowerCase()).reduce((o,u,f)=>(o[u]=e[t[f]],o),{})},lj=(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,oj=(e,t={})=>{const a=Object.assign({method:e.method||"GET",headers:e.headers},t),o=rj(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 cj extends o6{async request(t){const a=oj(t,t.webFetchExtra),l=lj(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 ij(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,b)=>{S[b]=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"}))}}mc("CapacitorHttp",{web:()=>new cj});var l0;(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"})(l0||(l0={}));var p4;(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"})(p4||(p4={}));var o0;(function(e){e[e["640x480"]=0]="640x480",e[e["1280x720"]=1]="1280x720",e[e["1920x1080"]=2]="1920x1080",e[e["3840x2160"]=3]="3840x2160"})(o0||(o0={}));var c0;(function(e){e.Front="FRONT",e.Back="BACK"})(c0||(c0={}));var g4;(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"})(g4||(g4={}));var _4;(function(e){e[e.HOME=0]="HOME",e[e.UNKNOWN=1]="UNKNOWN",e[e.WORK=2]="WORK"})(_4||(_4={}));var y4;(function(e){e[e.HOME=0]="HOME",e[e.UNKNOWN=1]="UNKNOWN",e[e.WORK=2]="WORK"})(y4||(y4={}));var v4;(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"})(v4||(v4={}));var b4;(function(e){e[e.OPEN=1]="OPEN",e[e.WEP=2]="WEP",e[e.WPA=3]="WPA"})(b4||(b4={}));const Po=mc("BarcodeScanner",{web:()=>Zr(()=>import("./web-D1qcSAMu.js"),[]).then(e=>new e.BarcodeScannerWeb)}),uj=8e3,ap=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,"")}},c6=e=>new Error(`连接探测超时(${e} ms),请确认手机能直接访问该 Hub 地址。`),dj=(e,t)=>{if(!(e instanceof Error))return"连接失败";const a=e.message.trim();return e.name==="AbortError"||e.name==="TimeoutError"||/aborted/i.test(a)?c6(t).message:a||"连接失败"},u0=async(e,t)=>{const a=ap(e),l=new Date().toISOString();if(!a)return{url:"",healthOk:!1,latencyMs:null,checkedAt:l,error:"地址为空"};const o=uj,u=`${a}/health`,f=typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now(),m=new AbortController,y=window.setTimeout(()=>m.abort(c6(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:dj(g,o)}}finally{clearTimeout(y)}},fj=()=>{var e;try{const t=(e=Qr.getPlatform)==null?void 0:e.call(Qr);if(t==="android"||t==="ios")return t}catch{}return"web"},qu=()=>fj(),u6=()=>{var e;try{return((e=Qr.isNativePlatform)==null?void 0:e.call(Qr))===!0}catch{return!1}},Tp=()=>qu()==="android"&&u6(),hj=()=>qu()==="ios"&&u6(),qs=()=>Tp()||hj(),x4=e=>typeof e!="number"||!Number.isFinite(e)?"未测得":`${Math.max(0,Math.round(e))} ms`,mj=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString("zh-CN",{hour12:!1})},_g=e=>{var l;const t=e.trim();if(!t)return"";try{const o=new URL(t);if(o.protocol==="http:"||o.protocol==="https:")return ap(o.toString())}catch{}const a=(l=t.match(/https?:\/\/[^\s]+/i))==null?void 0:l[0];return a?ap(a):""},pj=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")?_g(u.searchParams.get("url")??""):_g(u.toString())}catch{return _g(o)}}return""},gj=()=>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"})]}),_j=()=>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"})}),d6=({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),[b,w]=_.useState({loading:!1,result:null}),[N,j]=_.useState({saving:!1}),[T,D]=_.useState(null),[z,I]=_.useState({active:!1,starting:!1}),k=_.useRef([]),P=ap(S),Q=qs();_.useEffect(()=>{p(l)},[l]),_.useEffect(()=>{if(!(typeof document>"u"))return document.documentElement.classList.toggle("hub-scanner-active",z.active),document.body.classList.toggle("hub-scanner-active",z.active),()=>{document.documentElement.classList.remove("hub-scanner-active"),document.body.classList.remove("hub-scanner-active")}},[z.active]),_.useEffect(()=>()=>{(async()=>(await Promise.all(k.current.map(ge=>ge.remove().catch(()=>{}))),k.current=[],await Po.stopScan().catch(()=>{})))()},[]);const se=async()=>{const ge=[...k.current];k.current=[],await Promise.all(ge.map(te=>te.remove().catch(()=>{})))},W=async()=>{I(ge=>({...ge,active:!1})),await se(),await Po.stopScan().catch(()=>{})},V=async()=>{if(!P){D({tone:"danger",text:"请先输入可访问的 Hub 地址。"});return}D(null),w({loading:!0,result:null});const ge=await u0(P);w({loading:!1,result:ge}),D({tone:ge.healthOk?"success":"danger",text:ge.healthOk?`连接成功,延迟 ${x4(ge.latencyMs)}。`:ge.error??"连接测试失败。"})},Y=async()=>{var ge;if(!P){D({tone:"danger",text:"请先输入可访问的 Hub 地址。"});return}D(null),j({saving:!0});try{const te=((ge=b.result)==null?void 0:ge.url)===P?b.result:await u0(P);if(w({loading:!1,result:te}),!te.healthOk){D({tone:"danger",text:te.error??"请先确认 Hub 地址可访问,再继续保存。"});return}await g(te),D({tone:"success",text:y})}catch(te){D({tone:"danger",text:te instanceof Error?te.message:"保存 Hub 地址失败。"})}finally{j({saving:!1})}},ee=async()=>{if(Q){D(null),I({active:!1,starting:!0});try{if(!(await Po.isSupported()).supported){D({tone:"danger",text:"当前设备不支持扫码填入,请手动输入地址。"});return}const te=await Po.requestPermissions();if(te.camera!=="granted"&&te.camera!=="limited"){D({tone:"danger",text:"需要相机权限才能扫码,请在系统设置中允许 Panda 使用相机。"});return}const xe=await Promise.all([Po.addListener("barcodesScanned",C=>{const q=C.barcodes.map(pj).find(Boolean);if(!q){D({tone:"danger",text:"二维码已识别,但没有拿到可用的 Hub 地址。"}),W();return}p(q),w({loading:!1,result:null}),D({tone:"success",text:"已通过扫码填入地址,可以直接测试或保存。"}),W()}),Po.addListener("scanError",C=>{D({tone:"danger",text:C.message||"扫码失败,请稍后重试。"}),W()})]);k.current=xe,I({active:!0,starting:!1}),await Po.startScan({formats:[l0.QrCode],lensFacing:c0.Back,resolution:o0["1280x720"]})}catch(ge){await W(),D({tone:"danger",text:ge instanceof Error?ge.message:"无法启动扫码,请稍后重试。"})}finally{I(ge=>({...ge,starting:!1}))}}},me=z.active&&typeof document<"u"?Ya.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:()=>{W()},"aria-label":"关闭扫码",children:i.jsx(_j,{})})]}),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:()=>{W()},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:ge=>{p(ge.target.value),w({loading:!1,result:null}),D(null)}}),Q?i.jsxs("button",{type:"button",className:"hub-connection-form__scan",onClick:()=>{ee()},disabled:z.starting||N.saving||b.loading,"aria-label":"扫码填入 Hub 地址",children:[i.jsx(gj,{}),i.jsx("span",{children:z.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:()=>{Y()},disabled:!P||N.saving||z.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:()=>{V()},disabled:!P||b.loading||N.saving||z.starting,children:b.loading?"测试中…":"测试连接"})]}),b.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:b.result.url})]}),i.jsxs("div",{className:"hub-connection-form__probe-item",children:[i.jsx("span",{children:"连通结果"}),i.jsx("strong",{className:b.result.healthOk?"is-ok":"is-danger",children:b.result.healthOk?"Hub 在线":b.result.error??"无法连接"})]}),i.jsxs("div",{className:"hub-connection-form__probe-item",children:[i.jsx("span",{children:"延迟"}),i.jsx("strong",{children:x4(b.result.latencyMs)})]}),i.jsxs("div",{className:"hub-connection-form__probe-item",children:[i.jsx("span",{children:"最近探测"}),i.jsx("strong",{children:mj(b.result.checkedAt)})]})]}):null,T?i.jsx("p",{className:`hub-connection-form__notice is-${T.tone}`,children:T.text}):null]}),me]})};var S4;(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"})(S4||(S4={}));const lh=mc("LocalNotifications",{web:()=>Zr(()=>import("./web-BhBxIFnA.js"),[]).then(e=>new e.LocalNotificationsWeb)});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 j4;(function(e){e.mergeShapes=(t,a)=>({...t,...a})})(j4||(j4={}));const nt=mn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),$l=e=>{switch(typeof e){case"undefined":return nt.undefined;case"string":return nt.string;case"number":return Number.isNaN(e)?nt.nan:nt.number;case"boolean":return nt.boolean;case"function":return nt.function;case"bigint":return nt.bigint;case"symbol":return nt.symbol;case"object":return Array.isArray(e)?nt.array:e===null?nt.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?nt.promise:typeof Map<"u"&&e instanceof Map?nt.map:typeof Set<"u"&&e instanceof Set?nt.set:typeof Date<"u"&&e instanceof Date?nt.date:nt.object;default:return nt.unknown}},Be=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 Vr 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 Vr))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()}}Vr.create=e=>new Vr(e);const d0=(e,t)=>{let a;switch(e.code){case Be.invalid_type:e.received===nt.undefined?a="Required":a=`Expected ${e.expected}, received ${e.received}`;break;case Be.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(e.expected,mn.jsonStringifyReplacer)}`;break;case Be.unrecognized_keys:a=`Unrecognized key(s) in object: ${mn.joinValues(e.keys,", ")}`;break;case Be.invalid_union:a="Invalid input";break;case Be.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${mn.joinValues(e.options)}`;break;case Be.invalid_enum_value:a=`Invalid enum value. Expected ${mn.joinValues(e.options)}, received '${e.received}'`;break;case Be.invalid_arguments:a="Invalid function arguments";break;case Be.invalid_return_type:a="Invalid function return type";break;case Be.invalid_date:a="Invalid date";break;case Be.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 Be.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 Be.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 Be.custom:a="Invalid input";break;case Be.invalid_intersection_types:a="Intersection results could not be merged";break;case Be.not_multiple_of:a=`Number must be a multiple of ${e.multipleOf}`;break;case Be.not_finite:a="Number must be finite";break;default:a=t.defaultError,mn.assertNever(e)}return{message:a}};let yj=d0;function vj(){return yj}const bj=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 Ge(e,t){const a=vj(),l=bj({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,a,a===d0?void 0:d0].filter(o=>!!o)});e.common.issues.push(l)}class ta{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 Tt;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 ta.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 Tt;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 Tt=Object.freeze({status:"aborted"}),kf=e=>({status:"dirty",value:e}),Xa=e=>({status:"valid",value:e}),w4=e=>e.status==="aborted",N4=e=>e.status==="dirty",Wu=e=>e.status==="valid",ip=e=>typeof Promise<"u"&&e instanceof Promise;var ct;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(ct||(ct={}));class tr{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 k4=(e,t)=>{if(Wu(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 Vr(e.common.issues);return this._error=a,this._error}}};function Pt(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 rn{get description(){return this._def.description}_getType(t){return $l(t.data)}_getOrReturnCtx(t,a){return a||{common:t.parent.common,data:t.data,parsedType:$l(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new ta,ctx:{common:t.parent.common,data:t.data,parsedType:$l(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const a=this._parse(t);if(ip(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:$l(t)},o=this._parseSync({data:t,path:l.path,parent:l});return k4(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:$l(t)};if(!this["~standard"].async)try{const u=this._parseSync({data:t,path:[],parent:a});return Wu(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=>Wu(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:$l(t)},o=this._parse({data:t,path:l.path,parent:l}),u=await(ip(o)?o:Promise.resolve(o));return k4(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:Be.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 Gu({schema:this,typeName:kt.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 ao.create(this,this._def)}nullable(){return Yu.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return er.create(this)}promise(){return up.create(this,this._def)}or(t){return lp.create([this,t],this._def)}and(t){return op.create(this,t,this._def)}transform(t){return new Gu({...Pt(this._def),schema:this,typeName:kt.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const a=typeof t=="function"?t:()=>t;return new g0({...Pt(this._def),innerType:this,defaultValue:a,typeName:kt.ZodDefault})}brand(){return new Fj({typeName:kt.ZodBranded,type:this,...Pt(this._def)})}catch(t){const a=typeof t=="function"?t:()=>t;return new _0({...Pt(this._def),innerType:this,catchValue:a,typeName:kt.ZodCatch})}describe(t){const a=this.constructor;return new a({...this._def,description:t})}pipe(t){return o_.create(this,t)}readonly(){return y0.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const xj=/^c[^\s-]{8,}$/i,Sj=/^[0-9a-z]+$/,jj=/^[0-9A-HJKMNP-TV-Z]{26}$/i,wj=/^[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,Nj=/^[a-z0-9_-]{21}$/i,kj=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ej=/^[-+]?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)?)??$/,Cj=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Tj="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let yg;const Rj=/^(?:(?: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])$/,Mj=/^(?:(?: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])$/,Aj=/^(([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]))$/,Dj=/^(([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])$/,Oj=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ij=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,f6="((\\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])))",Lj=new RegExp(`^${f6}$`);function h6(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 Pj(e){return new RegExp(`^${h6(e)}$`)}function Uj(e){let t=`${f6}T${h6(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 zj(e,t){return!!((t==="v4"||!t)&&Rj.test(e)||(t==="v6"||!t)&&Aj.test(e))}function Bj(e,t){if(!kj.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 Hj(e,t){return!!((t==="v4"||!t)&&Mj.test(e)||(t==="v6"||!t)&&Dj.test(e))}class Wr extends rn{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==nt.string){const u=this._getOrReturnCtx(t);return Ge(u,{code:Be.invalid_type,expected:nt.string,received:u.parsedType}),Tt}const l=new ta;let o;for(const u of this._def.checks)if(u.kind==="min")t.data.length<u.value&&(o=this._getOrReturnCtx(t,o),Ge(o,{code:Be.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),Ge(o,{code:Be.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?Ge(o,{code:Be.too_big,maximum:u.value,type:"string",inclusive:!0,exact:!0,message:u.message}):m&&Ge(o,{code:Be.too_small,minimum:u.value,type:"string",inclusive:!0,exact:!0,message:u.message}),l.dirty())}else if(u.kind==="email")Cj.test(t.data)||(o=this._getOrReturnCtx(t,o),Ge(o,{validation:"email",code:Be.invalid_string,message:u.message}),l.dirty());else if(u.kind==="emoji")yg||(yg=new RegExp(Tj,"u")),yg.test(t.data)||(o=this._getOrReturnCtx(t,o),Ge(o,{validation:"emoji",code:Be.invalid_string,message:u.message}),l.dirty());else if(u.kind==="uuid")wj.test(t.data)||(o=this._getOrReturnCtx(t,o),Ge(o,{validation:"uuid",code:Be.invalid_string,message:u.message}),l.dirty());else if(u.kind==="nanoid")Nj.test(t.data)||(o=this._getOrReturnCtx(t,o),Ge(o,{validation:"nanoid",code:Be.invalid_string,message:u.message}),l.dirty());else if(u.kind==="cuid")xj.test(t.data)||(o=this._getOrReturnCtx(t,o),Ge(o,{validation:"cuid",code:Be.invalid_string,message:u.message}),l.dirty());else if(u.kind==="cuid2")Sj.test(t.data)||(o=this._getOrReturnCtx(t,o),Ge(o,{validation:"cuid2",code:Be.invalid_string,message:u.message}),l.dirty());else if(u.kind==="ulid")jj.test(t.data)||(o=this._getOrReturnCtx(t,o),Ge(o,{validation:"ulid",code:Be.invalid_string,message:u.message}),l.dirty());else if(u.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),Ge(o,{validation:"url",code:Be.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),Ge(o,{validation:"regex",code:Be.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),Ge(o,{code:Be.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),Ge(o,{code:Be.invalid_string,validation:{startsWith:u.value},message:u.message}),l.dirty()):u.kind==="endsWith"?t.data.endsWith(u.value)||(o=this._getOrReturnCtx(t,o),Ge(o,{code:Be.invalid_string,validation:{endsWith:u.value},message:u.message}),l.dirty()):u.kind==="datetime"?Uj(u).test(t.data)||(o=this._getOrReturnCtx(t,o),Ge(o,{code:Be.invalid_string,validation:"datetime",message:u.message}),l.dirty()):u.kind==="date"?Lj.test(t.data)||(o=this._getOrReturnCtx(t,o),Ge(o,{code:Be.invalid_string,validation:"date",message:u.message}),l.dirty()):u.kind==="time"?Pj(u).test(t.data)||(o=this._getOrReturnCtx(t,o),Ge(o,{code:Be.invalid_string,validation:"time",message:u.message}),l.dirty()):u.kind==="duration"?Ej.test(t.data)||(o=this._getOrReturnCtx(t,o),Ge(o,{validation:"duration",code:Be.invalid_string,message:u.message}),l.dirty()):u.kind==="ip"?zj(t.data,u.version)||(o=this._getOrReturnCtx(t,o),Ge(o,{validation:"ip",code:Be.invalid_string,message:u.message}),l.dirty()):u.kind==="jwt"?Bj(t.data,u.alg)||(o=this._getOrReturnCtx(t,o),Ge(o,{validation:"jwt",code:Be.invalid_string,message:u.message}),l.dirty()):u.kind==="cidr"?Hj(t.data,u.version)||(o=this._getOrReturnCtx(t,o),Ge(o,{validation:"cidr",code:Be.invalid_string,message:u.message}),l.dirty()):u.kind==="base64"?Oj.test(t.data)||(o=this._getOrReturnCtx(t,o),Ge(o,{validation:"base64",code:Be.invalid_string,message:u.message}),l.dirty()):u.kind==="base64url"?Ij.test(t.data)||(o=this._getOrReturnCtx(t,o),Ge(o,{validation:"base64url",code:Be.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:Be.invalid_string,...ct.errToObj(l)})}_addCheck(t){return new Wr({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ct.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ct.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ct.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ct.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ct.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ct.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ct.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ct.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ct.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...ct.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...ct.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ct.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...ct.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,...ct.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,...ct.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...ct.errToObj(t)})}regex(t,a){return this._addCheck({kind:"regex",regex:t,...ct.errToObj(a)})}includes(t,a){return this._addCheck({kind:"includes",value:t,position:a==null?void 0:a.position,...ct.errToObj(a==null?void 0:a.message)})}startsWith(t,a){return this._addCheck({kind:"startsWith",value:t,...ct.errToObj(a)})}endsWith(t,a){return this._addCheck({kind:"endsWith",value:t,...ct.errToObj(a)})}min(t,a){return this._addCheck({kind:"min",value:t,...ct.errToObj(a)})}max(t,a){return this._addCheck({kind:"max",value:t,...ct.errToObj(a)})}length(t,a){return this._addCheck({kind:"length",value:t,...ct.errToObj(a)})}nonempty(t){return this.min(1,ct.errToObj(t))}trim(){return new Wr({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Wr({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Wr({...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}}Wr.create=e=>new Wr({checks:[],typeName:kt.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...Pt(e)});function $j(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 Ku extends rn{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)!==nt.number){const u=this._getOrReturnCtx(t);return Ge(u,{code:Be.invalid_type,expected:nt.number,received:u.parsedType}),Tt}let l;const o=new ta;for(const u of this._def.checks)u.kind==="int"?mn.isInteger(t.data)||(l=this._getOrReturnCtx(t,l),Ge(l,{code:Be.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),Ge(l,{code:Be.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),Ge(l,{code:Be.too_big,maximum:u.value,type:"number",inclusive:u.inclusive,exact:!1,message:u.message}),o.dirty()):u.kind==="multipleOf"?$j(t.data,u.value)!==0&&(l=this._getOrReturnCtx(t,l),Ge(l,{code:Be.not_multiple_of,multipleOf:u.value,message:u.message}),o.dirty()):u.kind==="finite"?Number.isFinite(t.data)||(l=this._getOrReturnCtx(t,l),Ge(l,{code:Be.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,ct.toString(a))}gt(t,a){return this.setLimit("min",t,!1,ct.toString(a))}lte(t,a){return this.setLimit("max",t,!0,ct.toString(a))}lt(t,a){return this.setLimit("max",t,!1,ct.toString(a))}setLimit(t,a,l,o){return new Ku({...this._def,checks:[...this._def.checks,{kind:t,value:a,inclusive:l,message:ct.toString(o)}]})}_addCheck(t){return new Ku({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ct.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ct.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ct.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ct.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ct.toString(t)})}multipleOf(t,a){return this._addCheck({kind:"multipleOf",value:t,message:ct.toString(a)})}finite(t){return this._addCheck({kind:"finite",message:ct.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ct.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ct.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)}}Ku.create=e=>new Ku({checks:[],typeName:kt.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Pt(e)});class qf extends rn{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)!==nt.bigint)return this._getInvalidInput(t);let l;const o=new ta;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),Ge(l,{code:Be.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),Ge(l,{code:Be.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),Ge(l,{code:Be.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 Ge(a,{code:Be.invalid_type,expected:nt.bigint,received:a.parsedType}),Tt}gte(t,a){return this.setLimit("min",t,!0,ct.toString(a))}gt(t,a){return this.setLimit("min",t,!1,ct.toString(a))}lte(t,a){return this.setLimit("max",t,!0,ct.toString(a))}lt(t,a){return this.setLimit("max",t,!1,ct.toString(a))}setLimit(t,a,l,o){return new qf({...this._def,checks:[...this._def.checks,{kind:t,value:a,inclusive:l,message:ct.toString(o)}]})}_addCheck(t){return new qf({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ct.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ct.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ct.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ct.toString(t)})}multipleOf(t,a){return this._addCheck({kind:"multipleOf",value:t,message:ct.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}}qf.create=e=>new qf({checks:[],typeName:kt.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...Pt(e)});class f0 extends rn{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==nt.boolean){const l=this._getOrReturnCtx(t);return Ge(l,{code:Be.invalid_type,expected:nt.boolean,received:l.parsedType}),Tt}return Xa(t.data)}}f0.create=e=>new f0({typeName:kt.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Pt(e)});class rp extends rn{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==nt.date){const u=this._getOrReturnCtx(t);return Ge(u,{code:Be.invalid_type,expected:nt.date,received:u.parsedType}),Tt}if(Number.isNaN(t.data.getTime())){const u=this._getOrReturnCtx(t);return Ge(u,{code:Be.invalid_date}),Tt}const l=new ta;let o;for(const u of this._def.checks)u.kind==="min"?t.data.getTime()<u.value&&(o=this._getOrReturnCtx(t,o),Ge(o,{code:Be.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),Ge(o,{code:Be.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 rp({...this._def,checks:[...this._def.checks,t]})}min(t,a){return this._addCheck({kind:"min",value:t.getTime(),message:ct.toString(a)})}max(t,a){return this._addCheck({kind:"max",value:t.getTime(),message:ct.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}}rp.create=e=>new rp({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:kt.ZodDate,...Pt(e)});class E4 extends rn{_parse(t){if(this._getType(t)!==nt.symbol){const l=this._getOrReturnCtx(t);return Ge(l,{code:Be.invalid_type,expected:nt.symbol,received:l.parsedType}),Tt}return Xa(t.data)}}E4.create=e=>new E4({typeName:kt.ZodSymbol,...Pt(e)});class C4 extends rn{_parse(t){if(this._getType(t)!==nt.undefined){const l=this._getOrReturnCtx(t);return Ge(l,{code:Be.invalid_type,expected:nt.undefined,received:l.parsedType}),Tt}return Xa(t.data)}}C4.create=e=>new C4({typeName:kt.ZodUndefined,...Pt(e)});class T4 extends rn{_parse(t){if(this._getType(t)!==nt.null){const l=this._getOrReturnCtx(t);return Ge(l,{code:Be.invalid_type,expected:nt.null,received:l.parsedType}),Tt}return Xa(t.data)}}T4.create=e=>new T4({typeName:kt.ZodNull,...Pt(e)});class h0 extends rn{constructor(){super(...arguments),this._any=!0}_parse(t){return Xa(t.data)}}h0.create=e=>new h0({typeName:kt.ZodAny,...Pt(e)});class R4 extends rn{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Xa(t.data)}}R4.create=e=>new R4({typeName:kt.ZodUnknown,...Pt(e)});class ro extends rn{_parse(t){const a=this._getOrReturnCtx(t);return Ge(a,{code:Be.invalid_type,expected:nt.never,received:a.parsedType}),Tt}}ro.create=e=>new ro({typeName:kt.ZodNever,...Pt(e)});class M4 extends rn{_parse(t){if(this._getType(t)!==nt.undefined){const l=this._getOrReturnCtx(t);return Ge(l,{code:Be.invalid_type,expected:nt.void,received:l.parsedType}),Tt}return Xa(t.data)}}M4.create=e=>new M4({typeName:kt.ZodVoid,...Pt(e)});class er extends rn{_parse(t){const{ctx:a,status:l}=this._processInputParams(t),o=this._def;if(a.parsedType!==nt.array)return Ge(a,{code:Be.invalid_type,expected:nt.array,received:a.parsedType}),Tt;if(o.exactLength!==null){const f=a.data.length>o.exactLength.value,m=a.data.length<o.exactLength.value;(f||m)&&(Ge(a,{code:f?Be.too_big:Be.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&&(Ge(a,{code:Be.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&&(Ge(a,{code:Be.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 tr(a,f,a.path,m)))).then(f=>ta.mergeArray(l,f));const u=[...a.data].map((f,m)=>o.type._parseSync(new tr(a,f,a.path,m)));return ta.mergeArray(l,u)}get element(){return this._def.type}min(t,a){return new er({...this._def,minLength:{value:t,message:ct.toString(a)}})}max(t,a){return new er({...this._def,maxLength:{value:t,message:ct.toString(a)}})}length(t,a){return new er({...this._def,exactLength:{value:t,message:ct.toString(a)}})}nonempty(t){return this.min(1,t)}}er.create=(e,t)=>new er({type:e,minLength:null,maxLength:null,exactLength:null,typeName:kt.ZodArray,...Pt(t)});function bu(e){if(e instanceof fs){const t={};for(const a in e.shape){const l=e.shape[a];t[a]=ao.create(bu(l))}return new fs({...e._def,shape:()=>t})}else return e instanceof er?new er({...e._def,type:bu(e.element)}):e instanceof ao?ao.create(bu(e.unwrap())):e instanceof Yu?Yu.create(bu(e.unwrap())):e instanceof uc?uc.create(e.items.map(t=>bu(t))):e}class fs extends rn{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)!==nt.object){const g=this._getOrReturnCtx(t);return Ge(g,{code:Be.invalid_type,expected:nt.object,received:g.parsedType}),Tt}const{status:l,ctx:o}=this._processInputParams(t),{shape:u,keys:f}=this._getCached(),m=[];if(!(this._def.catchall instanceof ro&&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 tr(o,p,o.path,g)),alwaysSet:g in o.data})}if(this._def.catchall instanceof ro){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&&(Ge(o,{code:Be.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 tr(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,b=await S.value;g.push({key:p,value:b,alwaysSet:S.alwaysSet})}return g}).then(g=>ta.mergeObjectSync(l,g)):ta.mergeObjectSync(l,y)}get shape(){return this._def.shape()}strict(t){return ct.errToObj,new fs({...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:ct.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new fs({...this._def,unknownKeys:"strip"})}passthrough(){return new fs({...this._def,unknownKeys:"passthrough"})}extend(t){return new fs({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new fs({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:kt.ZodObject})}setKey(t,a){return this.augment({[t]:a})}catchall(t){return new fs({...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 fs({...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 fs({...this._def,shape:()=>a})}deepPartial(){return bu(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 fs({...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 ao;)u=u._def.innerType;a[l]=u}return new fs({...this._def,shape:()=>a})}keyof(){return m6(mn.objectKeys(this.shape))}}fs.create=(e,t)=>new fs({shape:()=>e,unknownKeys:"strip",catchall:ro.create(),typeName:kt.ZodObject,...Pt(t)});fs.strictCreate=(e,t)=>new fs({shape:()=>e,unknownKeys:"strict",catchall:ro.create(),typeName:kt.ZodObject,...Pt(t)});fs.lazycreate=(e,t)=>new fs({shape:e,unknownKeys:"strip",catchall:ro.create(),typeName:kt.ZodObject,...Pt(t)});class lp extends rn{_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 Vr(m.ctx.common.issues));return Ge(a,{code:Be.invalid_union,unionErrors:f}),Tt}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 Vr(y));return Ge(a,{code:Be.invalid_union,unionErrors:m}),Tt}}get options(){return this._def.options}}lp.create=(e,t)=>new lp({options:e,typeName:kt.ZodUnion,...Pt(t)});function m0(e,t){const a=$l(e),l=$l(t);if(e===t)return{valid:!0,data:e};if(a===nt.object&&l===nt.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=m0(e[m],t[m]);if(!y.valid)return{valid:!1};f[m]=y.data}return{valid:!0,data:f}}else if(a===nt.array&&l===nt.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=m0(f,m);if(!y.valid)return{valid:!1};o.push(y.data)}return{valid:!0,data:o}}else return a===nt.date&&l===nt.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class op extends rn{_parse(t){const{status:a,ctx:l}=this._processInputParams(t),o=(u,f)=>{if(w4(u)||w4(f))return Tt;const m=m0(u.value,f.value);return m.valid?((N4(u)||N4(f))&&a.dirty(),{status:a.value,value:m.data}):(Ge(l,{code:Be.invalid_intersection_types}),Tt)};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}))}}op.create=(e,t,a)=>new op({left:e,right:t,typeName:kt.ZodIntersection,...Pt(a)});class uc extends rn{_parse(t){const{status:a,ctx:l}=this._processInputParams(t);if(l.parsedType!==nt.array)return Ge(l,{code:Be.invalid_type,expected:nt.array,received:l.parsedType}),Tt;if(l.data.length<this._def.items.length)return Ge(l,{code:Be.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Tt;!this._def.rest&&l.data.length>this._def.items.length&&(Ge(l,{code:Be.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 tr(l,f,l.path,m)):null}).filter(f=>!!f);return l.common.async?Promise.all(u).then(f=>ta.mergeArray(a,f)):ta.mergeArray(a,u)}get items(){return this._def.items}rest(t){return new uc({...this._def,rest:t})}}uc.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new uc({items:e,typeName:kt.ZodTuple,rest:null,...Pt(t)})};class cp extends rn{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!==nt.object)return Ge(l,{code:Be.invalid_type,expected:nt.object,received:l.parsedType}),Tt;const o=[],u=this._def.keyType,f=this._def.valueType;for(const m in l.data)o.push({key:u._parse(new tr(l,m,l.path,m)),value:f._parse(new tr(l,l.data[m],l.path,m)),alwaysSet:m in l.data});return l.common.async?ta.mergeObjectAsync(a,o):ta.mergeObjectSync(a,o)}get element(){return this._def.valueType}static create(t,a,l){return a instanceof rn?new cp({keyType:t,valueType:a,typeName:kt.ZodRecord,...Pt(l)}):new cp({keyType:Wr.create(),valueType:t,typeName:kt.ZodRecord,...Pt(a)})}}class A4 extends rn{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!==nt.map)return Ge(l,{code:Be.invalid_type,expected:nt.map,received:l.parsedType}),Tt;const o=this._def.keyType,u=this._def.valueType,f=[...l.data.entries()].map(([m,y],g)=>({key:o._parse(new tr(l,m,l.path,[g,"key"])),value:u._parse(new tr(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 Tt;(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 Tt;(g.status==="dirty"||S.status==="dirty")&&a.dirty(),m.set(g.value,S.value)}return{status:a.value,value:m}}}}A4.create=(e,t,a)=>new A4({valueType:t,keyType:e,typeName:kt.ZodMap,...Pt(a)});class Wf extends rn{_parse(t){const{status:a,ctx:l}=this._processInputParams(t);if(l.parsedType!==nt.set)return Ge(l,{code:Be.invalid_type,expected:nt.set,received:l.parsedType}),Tt;const o=this._def;o.minSize!==null&&l.data.size<o.minSize.value&&(Ge(l,{code:Be.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&&(Ge(l,{code:Be.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 Tt;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 tr(l,y,l.path,g)));return l.common.async?Promise.all(m).then(y=>f(y)):f(m)}min(t,a){return new Wf({...this._def,minSize:{value:t,message:ct.toString(a)}})}max(t,a){return new Wf({...this._def,maxSize:{value:t,message:ct.toString(a)}})}size(t,a){return this.min(t,a).max(t,a)}nonempty(t){return this.min(1,t)}}Wf.create=(e,t)=>new Wf({valueType:e,minSize:null,maxSize:null,typeName:kt.ZodSet,...Pt(t)});class D4 extends rn{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})}}D4.create=(e,t)=>new D4({getter:e,typeName:kt.ZodLazy,...Pt(t)});class p0 extends rn{_parse(t){if(t.data!==this._def.value){const a=this._getOrReturnCtx(t);return Ge(a,{received:a.data,code:Be.invalid_literal,expected:this._def.value}),Tt}return{status:"valid",value:t.data}}get value(){return this._def.value}}p0.create=(e,t)=>new p0({value:e,typeName:kt.ZodLiteral,...Pt(t)});function m6(e,t){return new Qu({values:e,typeName:kt.ZodEnum,...Pt(t)})}class Qu extends rn{_parse(t){if(typeof t.data!="string"){const a=this._getOrReturnCtx(t),l=this._def.values;return Ge(a,{expected:mn.joinValues(l),received:a.parsedType,code:Be.invalid_type}),Tt}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 Ge(a,{received:a.data,code:Be.invalid_enum_value,options:l}),Tt}return Xa(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 Qu.create(t,{...this._def,...a})}exclude(t,a=this._def){return Qu.create(this.options.filter(l=>!t.includes(l)),{...this._def,...a})}}Qu.create=m6;class O4 extends rn{_parse(t){const a=mn.getValidEnumValues(this._def.values),l=this._getOrReturnCtx(t);if(l.parsedType!==nt.string&&l.parsedType!==nt.number){const o=mn.objectValues(a);return Ge(l,{expected:mn.joinValues(o),received:l.parsedType,code:Be.invalid_type}),Tt}if(this._cache||(this._cache=new Set(mn.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const o=mn.objectValues(a);return Ge(l,{received:l.data,code:Be.invalid_enum_value,options:o}),Tt}return Xa(t.data)}get enum(){return this._def.values}}O4.create=(e,t)=>new O4({values:e,typeName:kt.ZodNativeEnum,...Pt(t)});class up extends rn{unwrap(){return this._def.type}_parse(t){const{ctx:a}=this._processInputParams(t);if(a.parsedType!==nt.promise&&a.common.async===!1)return Ge(a,{code:Be.invalid_type,expected:nt.promise,received:a.parsedType}),Tt;const l=a.parsedType===nt.promise?a.data:Promise.resolve(a.data);return Xa(l.then(o=>this._def.type.parseAsync(o,{path:a.path,errorMap:a.common.contextualErrorMap})))}}up.create=(e,t)=>new up({type:e,typeName:kt.ZodPromise,...Pt(t)});class Gu extends rn{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===kt.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=>{Ge(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 Tt;const y=await this._def.schema._parseAsync({data:m,path:l.path,parent:l});return y.status==="aborted"?Tt:y.status==="dirty"||a.value==="dirty"?kf(y.value):y});{if(a.value==="aborted")return Tt;const m=this._def.schema._parseSync({data:f,path:l.path,parent:l});return m.status==="aborted"?Tt:m.status==="dirty"||a.value==="dirty"?kf(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"?Tt:(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"?Tt:(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(!Wu(f))return Tt;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=>Wu(f)?Promise.resolve(o.transform(f.value,u)).then(m=>({status:a.value,value:m})):Tt);mn.assertNever(o)}}Gu.create=(e,t,a)=>new Gu({schema:e,typeName:kt.ZodEffects,effect:t,...Pt(a)});Gu.createWithPreprocess=(e,t,a)=>new Gu({schema:t,effect:{type:"preprocess",transform:e},typeName:kt.ZodEffects,...Pt(a)});class ao extends rn{_parse(t){return this._getType(t)===nt.undefined?Xa(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}ao.create=(e,t)=>new ao({innerType:e,typeName:kt.ZodOptional,...Pt(t)});class Yu extends rn{_parse(t){return this._getType(t)===nt.null?Xa(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Yu.create=(e,t)=>new Yu({innerType:e,typeName:kt.ZodNullable,...Pt(t)});class g0 extends rn{_parse(t){const{ctx:a}=this._processInputParams(t);let l=a.data;return a.parsedType===nt.undefined&&(l=this._def.defaultValue()),this._def.innerType._parse({data:l,path:a.path,parent:a})}removeDefault(){return this._def.innerType}}g0.create=(e,t)=>new g0({innerType:e,typeName:kt.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Pt(t)});class _0 extends rn{_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 ip(o)?o.then(u=>({status:"valid",value:u.status==="valid"?u.value:this._def.catchValue({get error(){return new Vr(l.common.issues)},input:l.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Vr(l.common.issues)},input:l.data})}}removeCatch(){return this._def.innerType}}_0.create=(e,t)=>new _0({innerType:e,typeName:kt.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Pt(t)});class I4 extends rn{_parse(t){if(this._getType(t)!==nt.nan){const l=this._getOrReturnCtx(t);return Ge(l,{code:Be.invalid_type,expected:nt.nan,received:l.parsedType}),Tt}return{status:"valid",value:t.data}}}I4.create=e=>new I4({typeName:kt.ZodNaN,...Pt(e)});class Fj extends rn{_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 o_ extends rn{_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"?Tt:u.status==="dirty"?(a.dirty(),kf(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"?Tt: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 o_({in:t,out:a,typeName:kt.ZodPipeline})}}class y0 extends rn{_parse(t){const a=this._def.innerType._parse(t),l=o=>(Wu(o)&&(o.value=Object.freeze(o.value)),o);return ip(a)?a.then(o=>l(o)):l(a)}unwrap(){return this._def.innerType}}y0.create=(e,t)=>new y0({innerType:e,typeName:kt.ZodReadonly,...Pt(t)});var kt;(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"})(kt||(kt={}));const E=Wr.create,We=Ku.create,At=f0.create,qj=h0.create;ro.create;const at=er.create,Ae=fs.create;lp.create;op.create;uc.create;const dp=cp.create,oo=p0.create,vt=Qu.create;up.create;ao.create;Yu.create;const p6=vt(["codex","claude"]),Wj=vt(["managed","attached-live","history-only"]),Kj=vt(["active","idle","attention","offline"]),g6=vt(["idle","running","completed"]),_6=vt(["image","file"]),Qj=vt(["user","repo","system","admin"]),Gj=Ae({can_stream_live:At(),can_send_input:At(),can_interrupt:At(),can_approve:At(),can_reject:At(),can_show_git:At(),can_show_terminal:At()}),y6=Ae({used_tokens:We(),total_tokens:We(),remaining_tokens:We(),percent_used:We(),cached_input_tokens:We(),output_tokens:We(),reasoning_output_tokens:We(),updated_at:E()}),Yj=vt(["pending","in_progress","completed"]),Vj=Ae({id:E(),step:E(),status:Yj}),c_=Ae({session_id:E(),turn_id:E().nullable(),source:vt(["rollout","app-server"]),updated_at:E(),explanation:E().nullable().default(null),steps:at(Vj),completed_count:We().int().nonnegative(),total_count:We().int().nonnegative(),is_active:At()}),Zj=Ae({parent_session_id:E(),root_session_id:E().nullable().default(null),nickname:E().nullable().default(null),role:E().nullable().default(null),depth:We().int().nonnegative()}),Xj=vt(["user_input","command_execution_approval","file_change_approval","permissions_approval","mcp_elicitation"]),Jj=vt(["pending","submitting","resolved"]),v6=Ae({id:E(),label:E(),description:E().nullable().default(null),emphasis:vt(["default","primary","danger"]).default("default")}),ew=Ae({id:E(),header:E().nullable().default(null),question:E(),options:at(v6).default([]),allow_other:At().default(!1),is_secret:At().default(!1)}),u_=Ae({id:E(),session_id:E(),turn_id:E().nullable().default(null),item_id:E().nullable().default(null),kind:Xj,status:Jj,title:E(),description:E().nullable().default(null),created_at:E(),updated_at:E(),options:at(v6).default([]),questions:at(ew).default([]),allow_freeform:At().default(!1),freeform_placeholder:E().nullable().default(null),submit_label:E().nullable().default(null)}),tw=Ae({id:E(),kind:_6,name:E().nullable().default(null),mime_type:E().nullable().default(null),size_bytes:We().int().nonnegative().nullable().default(null),content_url:E().nullable().default(null)}),L4=Ae({id:E(),kind:_6,name:E(),mime_type:E().nullable().default(null),size_bytes:We().int().nonnegative().nullable().default(null),data_url:E()}),nw=Ae({name:E(),description:E(),path:E(),scope:Qj,enabled:At()}),sw=vt(["supported","unsupported"]),aw=Ae({name:E(),description:E(),availability:sw.default("supported")}),P4=Ae({cli_version:E().nullable().default(null),loaded_at:E(),cache_ttl_ms:We().int().nonnegative(),commands:at(aw)});Ae({id:E(),label:E(),description:E(),isDefault:At(),defaultReasoningEffort:E().nullable().default(null),supportedReasoningEfforts:at(E()).default([])});const iw=vt(["running","awaiting_input","completed","failed"]),rw=vt(["none","choice","text"]),lw=Ae({id:E(),label:E(),description:E().nullable().default(null)}),ow=Ae({type:oo("set_session_model"),model:E(),reasoning_effort:E().nullable().default(null)}).nullable().default(null),cw=Ae({panel_id:E(),session_id:E(),command_name:E(),command_text:E(),title:E(),description:E().nullable().default(null),status:iw,body:E(),submitted_at:E(),updated_at:E(),input_type:rw,options:at(lw).default([]),input_placeholder:E().nullable().default(null),submit_label:E().nullable().default(null),effect:ow}),U4=Ae({panel:cw}),uw=vt(["online","offline"]),Rp=Ae({id:E(),name:E(),display_name:E().nullable().default(null),host:E(),tailscale_ip:E().nullable().default(null),tailscale_dns_name:E().nullable().default(null),direct_base_url:E(),ws_base_url:E(),status:uw,provider_availability:at(p6),project_count:We(),session_count:We(),transport:vt(["direct-agent","hub-routed"]),version:E().nullable().default(null),registered_at:E().nullable().default(null),last_seen_at:E().nullable().default(null)}),d_=Ae({id:E(),agent_id:E(),name:E(),display_name:E().nullable(),pinned:At(),path:E(),branch:E(),worktree:E(),runtime_profiles:at(E()),preview_url:E().nullable()}),oh=Ae({id:E(),agent_id:E(),project_id:E(),provider:p6,archived:At(),title:E(),mode:Wj,health:Kj,branch:E(),worktree:E(),summary:E(),latest_assistant_message:E().nullable().default(null),last_event_at:E(),pinned:At(),run_state:g6,run_state_changed_at:E().nullable(),context_usage:y6.nullable().default(null),subagent:Zj.nullable().default(null),capability:Gj}),dw=Ae({path:E(),additions:We(),deletions:We()}),fw=Ae({files:at(dw),additions:We(),deletions:We()}),Kf=Ae({id:E(),kind:vt(["user","assistant","thinking","tool","system"]),title:E(),body:E(),body_truncated:At().default(!1),detail_available:At().default(!1),patch_summary:fw.nullable().default(null),session_ids:at(E()).default([]),timestamp:E(),accent:vt(["primary","secondary","muted"]),attachments:at(tw).default([])}),hw=vt(["tail","full_compact"]),b6=Ae({session_id:E(),generated_at:E(),view:hw,anchor_entry_id:E().nullable().default(null),has_earlier_entries:At().default(!1),entries:at(Kf)}),mw=vt(["app-server","rollout-fallback"]),pw=vt(["running","completed"]),gw=vt(["add","delete","update"]),f_=Ae({path:E(),kind:gw,move_path:E().nullable(),additions:We(),deletions:We(),diff:E(),item_id:E().nullable()}),_w=f_.omit({diff:!0}).extend({diff_available:At().default(!1)}),x6=Ae({id:E(),session_id:E(),turn_id:E(),source:mw,status:pw,started_at:E(),completed_at:E().nullable(),updated_at:E(),aggregated_diff:E(),files:at(f_)}),S6=x6.omit({aggregated_diff:!0,files:!0}).extend({aggregated_diff_available:At().default(!1),files:at(_w)}),yw=Ae({session_id:E(),change_set_id:E(),file:f_,empty_message:E().default("此变更没有可展示的补丁内容")}),vw=Ae({path:E(),status:vt(["modified","added","deleted","renamed"]),additions:We(),deletions:We()}),j6=vt(["modified","added","deleted","renamed","untracked"]),bw=Ae({path:E(),previous_path:E().nullable().default(null),status:j6,additions:We().int().nonnegative(),deletions:We().int().nonnegative()}),xw=Ae({session_id:E(),project_id:E(),path:E(),previous_path:E().nullable().default(null),additions:We().int().nonnegative(),deletions:We().int().nonnegative(),diff:E()}),h_=Ae({session_id:E(),project_id:E(),branch:E(),branches:at(E()),upstream_branch:E().nullable().default(null),ahead_count:We().int().nonnegative(),behind_count:We().int().nonnegative(),files:at(bw),updated_at:E()}),Sw=Ae({path:E(),previous_path:E().nullable().default(null),status:j6}),jw=Ae({oid:E(),short_oid:E(),subject:E(),author_name:E(),authored_at:E(),committed_at:E(),parent_oids:at(E()).default([]),refs:at(E()).default([]),files:at(Sw)}),ww=Ae({session_id:E(),project_id:E(),commit_oid:E(),path:E(),previous_path:E().nullable().default(null),additions:We().int().nonnegative(),deletions:We().int().nonnegative(),diff:E()}),Nw=Ae({session_id:E(),project_id:E(),branch:E(),upstream_branch:E().nullable().default(null),head_oid:E().nullable().default(null),upstream_head_oid:E().nullable().default(null),commits:at(jw),updated_at:E()});vt(["discard-file","discard-all","commit-all","switch-branch","push"]);const kw=Ae({ok:oo(!0),workspace:h_});vt(["rollback"]);const Ew=Ae({ok:oo(!0),turn_id:E(),change_set_id:E(),workspace:h_}),Cw=vt(["directory","file"]),w6=vt(["markdown","code","text","image","binary"]),Tw=Ae({path:E(),name:E(),kind:Cw,has_children:At(),extension:E().nullable().default(null),file_kind:w6.nullable().default(null),size_bytes:We().int().nonnegative().nullable().default(null)}),Rw=Ae({session_id:E(),project_id:E(),root_path:E(),parent_path:E().nullable().default(null),nodes:at(Tw),loaded_at:E()}),Mw=Ae({session_id:E(),project_id:E(),path:E(),name:E(),extension:E().nullable().default(null),file_kind:w6,mime_type:E().nullable().default(null),size_bytes:We().int().nonnegative().nullable().default(null),encoding:vt(["utf8","base64"]).nullable().default(null),is_truncated:At(),content_text:E().nullable().default(null),content_base64:E().nullable().default(null),loaded_at:E()}),N6=vt(["auto","powershell","cmd","bash"]),Aw=vt(["user","codex"]),Dw=Ae({id:E(),name:E(),description:E().nullable().default(null),command:E(),kill_command:E().nullable().default(null),cwd:E().nullable().default(null),shell:N6.default("auto"),node_version:E().nullable().default(null),port:We().int().positive().nullable().default(null),source:Aw.default("user"),created_at:E(),updated_at:E()}),Ow=Ae({name:E(),description:E().nullable().default(null),command:E(),kill_command:E().nullable().default(null),cwd:E().nullable().default(null),shell:N6.default("auto"),node_version:E().nullable().default(null),port:We().int().positive().nullable().default(null)}),m_=Ae({session_id:E(),project_id:E(),config_path:E(),commands:at(Dw),updated_at:E()}),Iw=vt(["user","codex"]),Lw=Ae({id:E(),name:E(),description:E().nullable().default(null),url:E(),source:Iw.default("user"),created_at:E(),updated_at:E()}),Pw=Ae({name:E(),description:E().nullable().default(null),url:E()}),p_=Ae({session_id:E(),project_id:E(),config_path:E(),websites:at(Lw),updated_at:E()}),Uw=vt(["queued","running","completed","failed","stopped"]),zw=vt(["stdout","stderr","system"]),Bw=Ae({cursor:We().int().nonnegative(),stream:zw,text:E(),timestamp:E()}),g_=Ae({id:E(),session_id:E(),project_id:E(),command_id:E().nullable().default(null),title:E(),command:E(),cwd:E(),status:Uw,exit_code:We().int().nullable().default(null),created_at:E(),started_at:E().nullable().default(null),completed_at:E().nullable().default(null),updated_at:E(),last_output_at:E().nullable().default(null),output_cursor:We().int().nonnegative(),preview:E().nullable().default(null)}),__=Ae({session_id:E(),project_id:E(),active_terminal_id:E().nullable().default(null),terminals:at(g_),updated_at:E()}),Hw=Ae({session_id:E(),project_id:E(),terminal:g_,chunks:at(Bw),next_cursor:We().int().nonnegative(),truncated:At().default(!1)}),k6=Ae({run_state:g6.optional(),run_state_changed_at:E().nullable().optional(),summary:E().optional(),latest_assistant_message:E().nullable().optional(),last_event_at:E().optional(),context_usage:y6.nullable().optional()}),$w=Ae({session_id:E(),recovered_at:E(),session_patch:k6,timeline:at(Kf),interactions:at(u_),plan_snapshot:c_.nullable().default(null),change_sets:at(x6),terminal_snapshot:__.nullable().default(null)}),E6=Ae({manager:vt(["none","nvm-windows"]).default("none"),versions:at(E()).default([]),error:E().nullable().default(null)}),C6=Ae({command_catalog:m_,website_catalog:p_,node_runtime:E6,terminal_snapshot:__}),Fw=Ae({session_id:E(),generated_at:E(),session_patch:k6,timeline:b6,interactions:at(u_),plan_snapshot:c_.nullable().default(null),run_workbench:C6.nullable().default(null),change_sets:at(S6).default([])}),qw=Ae({catalog:m_}),Ww=Ae({catalog:p_}),Kw=Ae({commands:at(Ow),reason:E().nullable().default(null)}),Qw=Ae({generation:Kw,catalog:m_}),Gw=Ae({websites:at(Pw),reason:E().nullable().default(null)}),Yw=Ae({generation:Gw,catalog:p_}),Vw=Ae({snapshot:__,terminal:g_.nullable().default(null)}),Zw=vt(["dev-hub","dev-agent","dev-web","release-hub","release-agent"]),Xw=vt(["unknown","running","stopped","degraded"]),Jw=vt(["process","windows-service"]),eN=vt(["missing","running","stopped","unknown"]),tN=vt(["dev-start","dev-restart","dev-stop","dev-probe","npm-publish","release-service-install","release-service-uninstall","release-install-package","release-restart","release-install-run","apk-build"]),nN=vt(["running","succeeded","failed"]),sN=vt(["info","success","warn","error"]),T6=Ae({repo_path:E().nullable().default(null),nvm_version:E().nullable().default(null),dev_hub_port:We().int().positive().nullable().default(null),dev_hub_args:E().default(""),dev_agent_port:We().int().positive().nullable().default(null),dev_agent_hub_url:E().default(""),dev_agent_direct_base_url:E().default(""),dev_agent_ws_base_url:E().default(""),dev_agent_name:E().default(""),dev_agent_args:E().default(""),dev_web_port:We().int().positive().nullable().default(null),dev_web_hub_url:E().default(""),dev_web_args:E().default(""),release_hub_port:We().int().positive().nullable().default(null),release_hub_service_name:E().default("PandaHub"),release_hub_args:E().default(""),release_agent_port:We().int().positive().nullable().default(null),release_agent_service_name:E().default("PandaAgent"),release_agent_hub_url:E().default(""),release_agent_direct_base_url:E().default(""),release_agent_ws_base_url:E().default(""),release_agent_name:E().default(""),release_agent_args:E().default(""),updated_at:E().nullable().default(null)}),aN=T6.extend({npm_token:E().nullable().default(null),clear_npm_token:At().default(!1)}),iN=Ae({has_npm_token:At(),npm_token_hint:E().nullable().default(null)}),rN=Ae({checked_at:E(),url:E().nullable().default(null),ok:At(),status_code:We().int().nullable().default(null),duration_ms:We().int().nonnegative().nullable().default(null),message:E().nullable().default(null)}),lN=Ae({key:Zw,label:E(),status:Xw,manager:Jw.default("process"),service_name:E().nullable().default(null),service_registered:At().default(!1),service_status:eN.nullable().default(null),configured_port:We().int().positive().nullable().default(null),detected_pids:at(We().int().positive()).default([]),probe:rN.nullable().default(null)}),oN=Ae({id:E(),timestamp:E(),level:sN,message:E()}),R6=Ae({id:E(),kind:tN,title:E(),status:nN,created_at:E(),started_at:E().nullable().default(null),finished_at:E().nullable().default(null),summary:E().nullable().default(null),error:E().nullable().default(null),disconnect_expected:At().default(!1),logs:at(oN).default([])}),cN=Ae({artifact_id:E(),file_name:E(),size_bytes:We().int().nonnegative(),built_at:E(),published_at:E().nullable().default(null),version_name:E().nullable().default(null),version_code:We().int().nullable().default(null),download_path:E()}),v0=Ae({generated_at:E(),config:T6,credentials:iN,node_runtime:E6,services:at(lN),current_version:E().nullable().default(null),apk_artifact:cN.nullable().default(null),jobs:at(R6).default([])});Ae({action:vt(["start-development","restart-development","stop-development","probe-development","publish-npm","install-release-services","uninstall-release-services","install-latest-release-package","restart-release-services","install-latest-release","build-apk"])});const uN=Ae({ok:oo(!0),snapshot:v0,job:R6.nullable().default(null)}),dN=Ae({id:E(),name:E(),command:E(),port:We().nullable(),status:vt(["running","stopped","degraded"]),log_excerpt:E()}),fN=Ae({id:E(),label:E(),url:E(),status:vt(["ready","starting","stopped"])}),M6=Ae({path:E(),name:E(),has_children:At()}),hN=Ae({directory:M6}),mN=Ae({id:E(),title:E(),description:E(),status:vt(["pending","approved","rejected"])}),pN=Ae({project_id:E(),visible_session_count:We().int().nonnegative(),archived_session_count:We().int().nonnegative(),hidden_history_count:We().int().nonnegative()}),gN=d_.pick({id:!0,agent_id:!0,name:!0,display_name:!0,pinned:!0,path:!0}),_N=Rp.pick({id:!0,name:!0,display_name:!0,status:!0}),A6=oh.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}),yN=oh.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}),vN=Ae({generated_at:E(),session:yN}),bN=Ae({generated_at:E(),agents:at(Rp)}),xN=oh.pick({id:!0,title:!0,run_state:!0,run_state_changed_at:!0,latest_assistant_message:!0}),SN=Ae({generated_at:E(),recent_sessions:at(xN)}),jN=Ae({session_id:E(),agent_id:E(),project_id:E(),direct_base_url:E(),ws_base_url:E()}),wN=Ae({generated_at:E(),agent:_N.nullable().default(null),projects:at(gN),project_stats:at(pN).default([]),sessions:at(A6),active_session_id:E()}),D6=vt(["archived","history"]),NN=Ae({bucket:D6,project_id:E().nullable().default(null),sessions:at(A6),next_cursor:E().nullable().default(null),total_count:We().int().nonnegative()}),kN=Ae({session_id:E(),entry_id:E(),command_entry:Kf,output_entries:at(Kf).default([])}),EN=Ae({generated_at:E(),agents:at(Rp),projects:at(d_),sessions:at(oh),active_session_id:E(),timeline:at(Kf),changed_files:at(vw),runtime_processes:at(dN),previews:at(fN),approvals:at(mN)});Ae({agent:Rp,projects:at(d_),sessions:at(oh),active_session_id:E().default(""),generated_at:E()});const z4=Ae({ok:oo(!0),agent_id:E(),heartbeat_interval_ms:We().int().positive(),heartbeat_timeout_ms:We().int().positive(),registered_at:E(),received_at:E()}),CN=vt(["rename","delete"]);Ae({action:CN,display_name:E().nullable().default(null)});const TN=Ae({ok:oo(!0)}),y_=Ae({completion_notifications_enabled:At().default(!1)}),RN=Ae({p256dh:E(),auth:E()}),MN=Ae({endpoint:E().url(),expirationTime:We().nullable().default(null),keys:RN}),AN=Ae({label:E().nullable().default(null),user_agent:E().nullable().default(null)});Ae({subscription:MN,settings:y_.default({}),device:AN.default({})});const DN=Ae({endpoint:E().url()}),ON=Ae({endpoint:E().url()}),IN=Ae({supported:At(),vapid_public_key:E().nullable().default(null),subject:E().nullable().default(null),reason:E().nullable().default(null)}),LN=Ae({ok:oo(!0),subscription_id:E(),endpoint:E().url(),settings:y_,created_at:E(),updated_at:E()}),PN=Ae({ok:oo(!0),endpoint:E().url(),delivered_at:E()}),UN=Ae({type:vt(["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:E(),payload:dp(qj())}),zN=Ae({width:We().nonnegative(),height:We().nonnegative(),device_pixel_ratio:We().nonnegative(),visual_width:We().nonnegative().nullable().default(null),visual_height:We().nonnegative().nullable().default(null),screen_width:We().nonnegative().nullable().default(null),screen_height:We().nonnegative().nullable().default(null)}),BN=Ae({user_agent:E(),language:E().nullable().default(null),languages:at(E()).default([]),platform:E().nullable().default(null),vendor:E().nullable().default(null),online:At().nullable().default(null),cookie_enabled:At().nullable().default(null),secure_context:At(),standalone_display_mode:At(),hardware_concurrency:We().int().nonnegative().nullable().default(null),device_memory_gb:We().nonnegative().nullable().default(null),max_touch_points:We().int().nonnegative().nullable().default(null)}),HN=Ae({href:E(),pathname:E(),referrer:E().nullable().default(null),visibility_state:E().nullable().default(null)}),$N=Ae({scope:E(),active_script_url:E().nullable().default(null),waiting_script_url:E().nullable().default(null),installing_script_url:E().nullable().default(null)}),FN=Ae({supported:At(),controller:At(),registrations:at($N).default([])}),qN=Ae({supported:At(),keys:at(E()).default([])}),WN=Ae({href:E().nullable().default(null),rel:E().nullable().default(null)}),KN=Ae({href:E().nullable().default(null),owner_node:E().nullable().default(null),media:E().nullable().default(null),disabled:At(),css_rule_count:We().int().nonnegative().nullable().default(null)}),QN=Ae({url:E(),kind:vt(["stylesheet","script","manifest","icon","other"]),ok:At(),status:We().int().nonnegative().nullable().default(null),content_type:E().nullable().default(null),cache_control:E().nullable().default(null),error:E().nullable().default(null)}),GN=Ae({name:E(),initiator_type:E().nullable().default(null),duration_ms:We().nonnegative().nullable().default(null),transfer_size:We().nonnegative().nullable().default(null),decoded_body_size:We().nonnegative().nullable().default(null)}),YN=Ae({x:We(),y:We(),width:We().nonnegative(),height:We().nonnegative()}),VN=Ae({selector:E(),found:At(),text_preview:E().nullable().default(null),rect:YN.nullable().default(null),computed:dp(E()).default({})});Ae({captured_at:E(),page:HN,environment:BN,viewport:zN,feature_support:dp(At()).default({}),service_worker:FN,cache:qN,manifest:WN,stylesheets:at(KN).default([]),resource_probes:at(QN).default([]),performance_entries:at(GN).default([]),theme_variables:dp(E()).default({}),element_snapshots:at(VN).default([]),notes:at(E()).default([])});const ZN=/^(?:image|img|photo|picture|screenshot|图片|照片|截图)(?:[-_ ]?\d+)?\.(?:avif|bmp|gif|heic|heif|jpe?g|png|svg|webp)$/i,Ls=e=>(e==null?void 0:e.trim())??"",B4="\0",H4=e=>{const t=Ls(e);return t?ZN.test(t)?1:2+Math.min(t.length,64)/100:0},XN=(e,t)=>{const a=H4(e),l=H4(t);if(l>a)return Ls(t)||null;if(a>l)return Ls(e)||null;const o=Ls(e),u=Ls(t);return u.length>o.length?u||null:o||null},JN=e=>{const t=Ls(e.content_url);return t?[e.kind,"content",t].join(B4):[e.kind,"meta",Ls(e.mime_type).toLowerCase(),typeof e.size_bytes=="number"&&Number.isFinite(e.size_bytes)?String(Math.max(0,Math.round(e.size_bytes))):"",Ls(e.name).toLowerCase()].join(B4)},ek=(e,t)=>{const a=Ls(e.name),l=Ls(t.name),o=Ls(e.mime_type),u=Ls(t.mime_type);return{id:e.id||t.id,kind:e.kind==="image"||t.kind==="image"?"image":e.kind,name:XN(a,l),mime_type:o||u||null,size_bytes:e.size_bytes??t.size_bytes??null,content_url:Ls(e.content_url)||Ls(t.content_url)||null}},O6=e=>{if(!e||e.length===0)return[];const t=[],a=new Map;for(const l of e){const o=JN(l),u=a.get(o);if(u===void 0){a.set(o,t.length),t.push({...l,name:Ls(l.name)||null,mime_type:Ls(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:Ls(l.content_url)||null});continue}t[u]=ek(t[u],l)}return t},I6=(e,t)=>O6([...e??[],...t??[]]),ba=e=>new Date(e).toISOString(),tk=()=>({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:ba("2026-03-18T10:30:00+08:00"),last_seen_at:ba("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:ba("2026-03-18T10:20:00+08:00"),last_seen_at:ba("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:ba("2026-03-18T10:58:00+08:00"),pinned:!1,run_state:"running",run_state_changed_at:ba("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:ba("2026-03-18T10:48:00+08:00"),pinned:!1,run_state:"completed",run_state_changed_at:ba("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:ba("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:ba("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:ba("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:ba("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:ba("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:ba("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"}]}),nk=()=>tk(),sk=()=>nk(),L6=e=>{const t=new URL(e);return t.protocol=t.protocol==="https:"?"wss:":"ws:",t.pathname="/ws",t.toString()};class ak{constructor(t,a=L6(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=sk}=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 EN.parse(u)}catch(o){if(!a)throw o;return l()}}async getHubDirectory(){return this.readJson(new URL("/api/hub/directory",this.baseUrl),bN)}async getHubRecentSessions(){return this.readJson(new URL("/api/hub/recent-sessions",this.baseUrl),SN)}async getSessionLocation(t){return this.readJson(new URL(`/api/sessions/${t}/location`,this.baseUrl),jN)}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,wN)}async getWorkspaceSessionPage(t){const a=new URL("/api/workspace/sessions",this.baseUrl);return a.searchParams.set("bucket",D6.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,NN)}async getWorkspaceSessionDetail(t){const a=new URL("/api/workspace/session-detail",this.baseUrl);return a.searchParams.set("sessionId",t),this.readJson(a,vN)}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,b6)}async getSessionChangeSets(t){return this.readJson(new URL(`/api/sessions/${t}/change-sets`,this.baseUrl),{parse:a=>Array.isArray(a)?a.map(l=>S6.parse(l)):[]})}async getSessionBootstrap(t){return this.readJson(new URL(`/api/sessions/${t}/bootstrap`,this.baseUrl),Fw)}async getSessionToolCallDetail(t,a){const l=new URL(`/api/sessions/${t}/tool-detail`,this.baseUrl);return l.searchParams.set("entryId",a),this.readJson(l,kN)}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,yw)}async getSessionGitWorkspace(t){return this.readJson(new URL(`/api/sessions/${t}/git-workspace`,this.baseUrl),h_)}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,xw)}async getSessionGitHistory(t){return this.readJson(new URL(`/api/sessions/${t}/git/history`,this.baseUrl),Nw)}async getSessionFilePreviewTree(t,a){var u;const l=new URL(`/api/sessions/${t}/file-preview/tree`,this.baseUrl),o=(u=a==null?void 0:a.path)==null?void 0:u.trim();return o&&l.searchParams.set("path",o),this.readJson(l,Rw)}async getSessionFilePreviewContent(t,a){const l=new URL(`/api/sessions/${t}/file-preview/content`,this.baseUrl);return l.searchParams.set("path",a.path),this.readJson(l,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,ww)}async getSessionRunWorkbench(t){return this.readJson(new URL(`/api/sessions/${t}/run-workbench`,this.baseUrl),C6)}async saveSessionRunCommand(t){return this.postJson(`/api/sessions/${t.sessionId}/run-commands`,{action:t.action,commandId:t.commandId??null,command:t.command??null},qw)}async generateSessionRunCommand(t){return this.postJson(`/api/sessions/${t.sessionId}/run-commands/generate`,{prompt:t.prompt,model:t.model},Qw)}async saveSessionRunWebsite(t){return this.postJson(`/api/sessions/${t.sessionId}/run-websites`,{action:t.action,websiteId:t.websiteId??null,website:t.website??null},Ww)}async generateSessionRunWebsite(t){return this.postJson(`/api/sessions/${t.sessionId}/run-websites/generate`,{prompt:t.prompt,model:t.model},Yw)}async executeSessionTerminalAction(t){return this.postJson(`/api/sessions/${t.sessionId}/terminals`,{action:t.action,commandId:t.commandId??null,terminalId:t.terminalId??null},Vw)}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,Hw)}async getSessionPlan(t){return this.readJson(new URL(`/api/sessions/${t}/plan`,this.baseUrl),{parse:a=>a==null?null:c_.parse(a)})}async getSessionInteractions(t){return this.readJson(new URL(`/api/sessions/${t}/interactions`,this.baseUrl),{parse:a=>Array.isArray(a)?a.map(l=>u_.parse(l)):[]})}async getSessionRecoverySnapshot(t){return this.readJson(new URL(`/api/sessions/${t}/recovery`,this.baseUrl),$w)}async getProjectSkills(t){return this.readJson(new URL(`/api/projects/${t}/skills`,this.baseUrl),{parse:a=>Array.isArray(a)?a.map(l=>nw.parse(l)):[]})}async getCodexCommands(){return this.readJson(new URL("/api/codex/commands",this.baseUrl),P4)}async refreshCodexCommands(){return this.postJson("/api/codex/commands/refresh",{},P4)}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=>M6.parse(o)):[]})}async createDirectory(t){return this.postJson("/api/directories",t,hN)}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=>L4.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=>L4.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},U4)}async respondToSessionCommand(t){return this.postJson(`/api/sessions/${t.sessionId}/commands/respond`,{panelId:t.panelId,optionId:t.optionId??null,text:t.text??null},U4)}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,z4)}async heartbeatAgent(t){return this.postJson("/api/agents/heartbeat",t,z4)}async updateAgent(t){return this.postJson(`/api/agents/${t.agentId}/actions`,{action:t.action,display_name:t.displayName??null},TN)}async getWebPushPublicConfig(){return this.readJson(new URL("/api/push/public-key",this.baseUrl),IN)}async upsertWebPushSubscription(t){return this.postJson("/api/push/subscriptions",{subscription:t.subscription,settings:y_.parse(t.settings),device:t.device??null},LN)}async removeWebPushSubscription(t){return this.postJson("/api/push/subscriptions/remove",DN.parse(t))}async sendWebPushTest(t){return this.postJson("/api/push/test",ON.parse(t),PN)}async executeSessionGitAction(t){return this.postJson(`/api/sessions/${t.sessionId}/git/actions`,{action:t.action,path:t.path,branch:t.branch,message:t.message},kw)}async executeSessionTurnAction(t){return this.postJson(`/api/sessions/${t.sessionId}/turns/${t.turnId}/actions`,{action:t.action},Ew)}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,v0)}async saveDevManagerConfig(t){return this.postJson("/api/dev-manager/config",aN.parse(t),v0)}async executeDevManagerAction(t){return this.postJson("/api/dev-manager/actions",t,uN)}createEventStream(t,a){var xe;let m=null,y=((xe=a==null?void 0:a.sessionId)==null?void 0:xe.trim())??"",g="",S=!1,p=0,b=null,w=!1,N=!1,j=!1,T=0;const D=typeof document<"u"&&typeof document.visibilityState=="string",z=()=>D&&document.visibilityState==="hidden",I=(a==null?void 0:a.reconnectWhenHidden)===!0,k=C=>(C==null?void 0:C.readyState)===WebSocket.OPEN||(C==null?void 0:C.readyState)===WebSocket.CONNECTING,P=()=>{b!==null&&(globalThis.clearTimeout(b),b=null)},Q=(C,q)=>{var ie;(ie=a==null?void 0:a.onStatus)==null||ie.call(a,{state:C,attempt:p,maxAttempts:5,error:q})},se=C=>{const q=m;!q||q.readyState!==WebSocket.OPEN||(g&&g!==C&&(q.send(JSON.stringify({type:"session.unsubscribe",sessionId:g})),g=""),!(!C||g===C)&&(g=C,q.send(JSON.stringify({type:"session.subscribe",sessionId:C}))))},W=C=>{if(S||w)return;if(!I&&z()){w=!1,j=!0,P(),Q("failed",C);return}if(p+=1,!I&&p>5){p=5,j=!0,Q("failed",C);return}w=!0,j=!1,Q("reconnecting",C),P();const q=I?Math.min(p,5):p,ie=Math.min(1e4,1200*2**Math.max(0,q-1));b=globalThis.setTimeout(()=>{w=!1,V()},ie)},V=()=>{if(S||k(m))return;P(),w=!1,j=!1;const C=new WebSocket(this.wsBaseUrl);m=C,C.addEventListener("open",()=>{S||m!==C||(w=!1,N=!1,p=0,Q("connected"),se(y))}),C.addEventListener("message",q=>{if(m!==C)return;const ie=UN.safeParse(JSON.parse(q.data));ie.success&&t(ie.data)}),C.addEventListener("error",()=>{if(S||m!==C)return;const q=`无法连接到 ${this.wsBaseUrl}`;C.readyState!==WebSocket.OPEN&&W(q)}),C.addEventListener("close",q=>{var he;if(m===C&&(m=null),S||m!==null)return;const ie=((he=q.reason)==null?void 0:he.trim())||`WebSocket 已断开(code ${q.code||"unknown"})`;W(ie)})},Y=C=>{if(S||k(m)||N)return;const q=Date.now();q-T<1500||(T=q,N=!0,p=0,w=!1,j=!1,P(),Q("reconnecting",C),V())},ee=()=>{document.visibilityState==="visible"&&(j||!k(m))&&Y("应用回到前台,正在恢复连接")},me=()=>{(j||!k(m))&&Y("页面恢复显示,正在恢复连接")},ge=()=>{(j||!k(m))&&Y("窗口重新聚焦,正在恢复连接")},te=()=>{(j||!k(m))&&Y("网络已恢复,正在重新连接")};return typeof window<"u"&&(window.addEventListener("pageshow",me),window.addEventListener("focus",ge),window.addEventListener("online",te)),typeof document<"u"&&document.addEventListener("visibilitychange",ee),V(),{setSessionId:C=>{y=(C==null?void 0:C.trim())??"",!S&&se(y)},close:()=>{S=!0,w=!1,N=!1,j=!1,P(),typeof window<"u"&&(window.removeEventListener("pageshow",me),window.removeEventListener("focus",ge),window.removeEventListener("online",te)),typeof document<"u"&&document.removeEventListener("visibilitychange",ee);const C=m;if((C==null?void 0:C.readyState)===WebSocket.OPEN&&g&&C.send(JSON.stringify({type:"session.unsubscribe",sessionId:g})),g="",m=null,(C==null?void 0:C.readyState)===WebSocket.CONNECTING){const q=()=>{try{C.close()}catch{}};C.addEventListener("open",q,{once:!0});return}C==null||C.close()}}}connectEvents(t,a){const l=this.createEventStream(t,a);return()=>{l.close()}}}const P6=(e,t)=>new ak(e,(t==null?void 0:t.wsBaseUrl)??L6(e)),U6=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}},dc=e=>{var t;return((t=e.display_name)==null?void 0:t.trim())||e.name.trim()||U6(e.direct_base_url)||"未命名节点"},ik=e=>{var a;const t=((a=e.display_name)==null?void 0:a.trim())??"";return!t||t===e.name?null:e.name},vg=e=>U6(e.direct_base_url)||e.host||e.tailscale_ip||e.tailscale_dns_name||e.direct_base_url,fp="panda:last-agent-id",hp="panda:last-session-id",Qf="panda:pending-session-id",Gf="panda:pending-project-id",Yf="panda:pending-directory-picker",Vu="panda:pending-session-handoff",Vf="panda:selected-agent-connection-hint",rk=3e4,lk=1800*1e3,Ef=e=>typeof e=="object"&&e!==null,ok=e=>{if(!Ef(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"||!Ef(u)||u.id!==t||u.agent_id!==a||u.project_id!==l||f!==null&&(!Ef(f)||f.id!==l||f.agent_id!==a||typeof f.name!="string"||typeof f.path!="string")||m!==null&&(!Ef(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}},ck=e=>{const t=new Date(e.createdAt).getTime();return Number.isFinite(t)?Date.now()-t>rk:!0},uk=e=>{if(!Ef(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}},dk=e=>{const t=new Date(e.createdAt).getTime();return Number.isFinite(t)?Date.now()-t>lk:!0},fk=e=>{if(!(typeof window>"u"))try{if(!e){window.sessionStorage.removeItem(Vu);return}window.sessionStorage.setItem(Vu,JSON.stringify(e))}catch{}},v_=e=>{if(typeof window>"u")return null;try{const t=window.sessionStorage.getItem(Vu);if(!t)return null;const a=ok(JSON.parse(t));return!a||ck(a)?(window.sessionStorage.removeItem(Vu),null):e&&a.sessionId!==e?null:a}catch{return null}},hk=e=>{if(!(typeof window>"u"))try{const t=v_();if(e&&(t!=null&&t.sessionId)&&t.sessionId!==e)return;window.sessionStorage.removeItem(Vu)}catch{}},mk=e=>{if(!(typeof window>"u"))try{if(!e){window.sessionStorage.removeItem(Vf);return}window.sessionStorage.setItem(Vf,JSON.stringify(e))}catch{}},ch=e=>{if(typeof window>"u")return null;try{const t=window.sessionStorage.getItem(Vf);if(!t)return null;const a=uk(JSON.parse(t));return!a||dk(a)?(window.sessionStorage.removeItem(Vf),null):e&&a.agentId!==e?null:a}catch{return null}},pc=()=>{if(typeof window>"u")return null;try{return window.localStorage.getItem(fp)}catch{return null}},Ji=e=>{if(!(typeof window>"u"))try{if(e){window.localStorage.setItem(fp,e);return}window.localStorage.removeItem(fp)}catch{}},mp=()=>{if(typeof window>"u")return null;try{return window.localStorage.getItem(hp)}catch{return null}},Js=e=>{if(!(typeof window>"u"))try{if(e){window.localStorage.setItem(hp,e);return}window.localStorage.removeItem(hp)}catch{}},Kr=e=>{if(!(typeof window>"u"))try{if(e){window.sessionStorage.setItem(Qf,e);return}window.sessionStorage.removeItem(Qf)}catch{}},pk=()=>{if(typeof window>"u")return null;try{const e=window.sessionStorage.getItem(Qf);return e&&window.sessionStorage.removeItem(Qf),e}catch{return null}},ku=e=>{if(!(typeof window>"u"))try{if(e){window.sessionStorage.setItem(Gf,e);return}window.sessionStorage.removeItem(Gf)}catch{}},gk=()=>{if(typeof window>"u")return null;try{const e=window.sessionStorage.getItem(Gf);return e&&window.sessionStorage.removeItem(Gf),e}catch{return null}},Cf=e=>{if(!(typeof window>"u"))try{if(e){window.sessionStorage.setItem(Yf,"1");return}window.sessionStorage.removeItem(Yf)}catch{}},_k=()=>{if(typeof window>"u")return!1;try{const e=window.sessionStorage.getItem(Yf);return e&&window.sessionStorage.removeItem(Yf),e==="1"}catch{return!1}},z6=()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem(fp),window.localStorage.removeItem(hp),window.sessionStorage.removeItem(Qf),window.sessionStorage.removeItem(Gf),window.sessionStorage.removeItem(Yf),window.sessionStorage.removeItem(Vu),window.sessionStorage.removeItem(Vf)}catch{}},pp=mc("Preferences",{web:()=>Zr(()=>import("./web-eR1IoQga.js"),[]).then(e=>new e.PreferencesWeb)}),yk=new Set(["4173","4174"]),vk="PandaMobile",B6="hub_url",H6="onboarding_completed",b0=new Set;let Xi={platform:qu(),hubUrl:"",onboardingCompleted:!1};const $6=()=>{for(const e of b0)e()},bk=e=>(b0.add(e),()=>{b0.delete(e)}),fc=e=>{const t=(e==null?void 0:e.trim())??"";if(!t)return"";try{return new URL(t).toString().replace(/\/+$/,"")}catch{return t.replace(/\/+$/,"")}},xk=()=>typeof window>"u"?null:window.location.origin||null,F6=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}`},Sk=()=>fc(F6(4242)),jk=()=>{const e=fc(void 0);if(e)return e;const t=xk();if(!t)return"http://localhost:4343";const a=window.location.port.trim();return yk.has(a)?F6(4343):fc(t)},wk=()=>fc(void 0),Nk=()=>!1,kk=()=>{const e=qu();if(e==="web")return{platform:e,hubUrl:jk(),onboardingCompleted:!0};const t=wk();return{platform:e,hubUrl:t,onboardingCompleted:!!t}},$4=async e=>{if(qs()){const{value:t}=await pp.get({key:e});return t}if(typeof window>"u")return null;try{return window.localStorage.getItem(`panda:runtime:${e}`)}catch{return null}},F4=async(e,t)=>{if(qs()){if(t===null){await pp.remove({key:e});return}await pp.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{}},Ek=async()=>{const e=kk();qs()&&await pp.configure({group:vk});const[t,a]=await Promise.all([$4(B6),$4(H6)]),l=e.platform==="web"?e.hubUrl:fc(t)||e.hubUrl,o=e.platform==="web"?!0:a==="true"||!!(l&&e.onboardingCompleted);return Xi={platform:e.platform,hubUrl:l,onboardingCompleted:o},$6(),Xi},x0=()=>Xi,Ck=()=>fc(Xi.hubUrl),Tk=()=>{const e=x0();return e.platform==="web"?Nk():!e.hubUrl||!e.onboardingCompleted},q6=async e=>{const t=e.hubUrl===void 0?Xi.hubUrl:fc(e.hubUrl),a=e.onboardingCompleted??Xi.onboardingCompleted;return Xi={...Xi,hubUrl:t,onboardingCompleted:a},Xi.platform!=="web"&&await Promise.all([F4(B6,t||null),F4(H6,a?"true":"false")]),$6(),Xi},Mp=()=>_.useSyncExternalStore(bk,x0,x0),Rk=new Set(["localhost","127.0.0.1","::1"]),W6=()=>Sk(),id=()=>Ck(),q4=new Map,Mk={direct:"Agent 直连",hub:"Hub 聚合"},Ak=1e4,Dk=1e4,K6=1e4,Ok=1e4,W4=1200,K4=5e3;let zm=null,S0=0,xu=null,Eu=null,gp=0,Su=null,Bm=null,j0=0,ju=null;const w0=new Map,Hm=new Map,$m=new Map,Va=e=>(e==null?void 0:e.trim())??"",Q6=e=>{const t=(e==null?void 0:e.trim())??"";return t?t.replace(/^\[|\]$/g,"").replace(/\.+$/,"").toLowerCase():""},G6=e=>Rk.has(Q6(e)),Zu=e=>{const t=(e==null?void 0:e.trim())??"";if(!t)return"";try{const a=new URL(t),l=Q6(a.hostname);return l&&(a.hostname=l),a.toString().replace(/\/+$/,"")}catch{return t}},Xu=()=>typeof window>"u"||qs()?!1:G6(window.location.hostname),Ik=e=>{const t=e.trim();if(!t)return W4;try{const a=new URL(t);return G6(a.hostname)?W4:K4}catch{return K4}},Ju=async e=>{const t=e.trim();if(!t)return!1;const a=$m.get(t),l=Date.now();if(a&&l-a.checkedAt<Ok)return a.reachable;const o=new AbortController,u=globalThis.setTimeout(()=>o.abort(),Ik(t));try{const m=(await fetch(`${t}/health`,{signal:o.signal})).ok;return $m.set(t,{reachable:m,checkedAt:Date.now()}),m}catch{return $m.set(t,{reachable:!1,checkedAt:Date.now()}),!1}finally{clearTimeout(u)}},rd=(e,t)=>{const a=`${e}::${(t==null?void 0:t.trim())??""}`,l=q4.get(a);if(l)return l;const o=P6(e,{wsBaseUrl:t});return q4.set(a,o),o},Q4=()=>rd(Y6()),G4=e=>{const t=e(Eu);Eu=t,gp=t?Date.now():0},b_=(e,t,a)=>({mode:"direct",label:e,baseUrl:t,client:rd(t,a)}),Y6=()=>{const e=id();if(!e)throw new Error("尚未配置 Panda Hub 地址,请先完成应用连接设置。");return e},Pf=e=>{const t=e==="hub"?Y6():W6();return{mode:e,label:Mk[e],baseUrl:t,client:rd(t)}},V6=e=>Zu(e.direct_base_url),Lk=e=>Zu(e.ws_base_url),Y4=e=>{const t=V6(e)||e.tailscale_dns_name||e.tailscale_ip||e.host;return`无法直连节点 ${dc(e)}(${t})。请确认当前浏览器已加入 Tailscale 网络,且目标 agent 在线。`},Pk=async()=>{if(!Xu())return null;const e=Date.now();if(Bm&&e-j0<K6)return Bm;if(ju)return ju;ju=(async()=>{const t=W6();if(!await Ju(t))return null;const a=await rd(t).getPhaseOneSnapshot({fallbackToMock:!1});return Bm=a,j0=Date.now(),a})().catch(()=>null);try{return await ju}finally{ju=null}},Z6=async e=>{var l,o;const t=await Pk(),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())},X6=async e=>{if(await Z6(e.id))return{...Pf("direct"),label:`Agent 直连 · ${dc(e)}(本机)`};const t=V6(e),a=Lk(e);return b_(`Agent 直连 · ${dc(e)}`,t,a||void 0)},Uk=async e=>{if(await Z6(e.agent_id))return{...Pf("direct"),label:`Agent 直连 · ${e.agent_id}(本机)`};const t=Zu(e.direct_base_url),a=Zu(e.ws_base_url);return b_(`Agent 直连 · ${e.agent_id}`,t,a||void 0)},J6=e=>{var l;const t=Va(e.agentId);if(!t)return null;const a=ch(t);return a!=null&&a.directBaseUrl.trim()?b_(`Agent 直连 · ${((l=a.displayName)==null?void 0:l.trim())||a.name.trim()||t}`,Zu(a.directBaseUrl),Zu(a.wsBaseUrl)||void 0):null},V4=async e=>{const t=J6(e);if(t!=null&&t.baseUrl&&(await Ju(t.baseUrl)||!Xu()))return t;const a=await t3(),l=a?e3(a,e):null;if(!l)return null;const o=await X6(l);return o.baseUrl&&(await Ju(o.baseUrl)||!Xu())?o:null},e3=(e,t)=>{const a=Va(t.agentId);return a?e.agents.find(l=>l.id===a)??null:null},zk=e=>{const t=Va(e.sessionId),a=Va(e.projectId),l=Va(e.agentId);return l?`agent:${l}`:a?`project:${a}`:t?`session:${t}`:""},t3=async()=>{const e=Date.now();if(Eu&&e-gp<K6)return Eu;if(Su)return Su;Su=(async()=>{const t=id();if(!t)return null;const a=await rd(t).getHubDirectory();return Eu=a,gp=Date.now(),a})().catch(()=>null);try{return await Su}finally{Su=null}},Bk=async()=>{if(!Xu())return Pf("hub");const e=Date.now();if(zm&&e-S0<Ak)return zm;if(xu)return xu;xu=(async()=>{const t=id(),a=t&&await Ju(t)?Pf("hub"):Pf("direct");return zm=a,S0=Date.now(),a})();try{return await xu}finally{xu=null}},Hk=async e=>{const t=zk(e),a=Date.now(),l=t?w0.get(t):null;if(l&&a-l.cachedAt<Dk)return l.target;const o=t?Hm.get(t):null;if(o)return o;const u=(async()=>{const f=Va(e.sessionId),m=Va(e.agentId),y=J6(e),g=id();if(!g&&!y&&!m)throw new Error("尚未配置 Panda Hub 地址,请先完成应用连接设置。");const S=g?rd(g):null;if(m){const N=await V4(e);if(N)return N}if(f){const N=S?await S.getSessionLocation(f).catch(()=>null):null;if(!N){const T=m?await V4(e):null;if(T)return T;throw new Error("Hub 未返回目标会话位置,无法建立直连。")}const j=await Uk(N);if(!j.baseUrl)throw new Error(`无法直连节点 ${N.agent_id}(${N.direct_base_url||N.ws_base_url||"unknown"})。请确认当前浏览器已加入 Tailscale 网络,且目标 agent 在线。`);if(await Ju(j.baseUrl)||!Xu())return j;throw new Error(`无法直连节点 ${N.agent_id}(${N.direct_base_url||N.ws_base_url||"unknown"})。请确认当前浏览器已加入 Tailscale 网络,且目标 agent 在线。`)}if(Va(e.projectId)&&!Va(e.agentId))throw new Error("Project-scoped connection resolution now requires agentId.");const p=await t3(),b=p?e3(p,e):null;if(!b)throw new Error("Hub 未返回目标节点信息,无法建立直连。");const w=await X6(b);if(!w.baseUrl)throw new Error(Y4(b));if(await Ju(w.baseUrl)||!Xu())return w;throw new Error(Y4(b))})();t&&Hm.set(t,u);try{const f=await u;return t&&w0.set(t,{target:f,cachedAt:Date.now()}),f}finally{t&&Hm.delete(t)}},wn=async e=>!(Va(e==null?void 0:e.sessionId)||Va(e==null?void 0:e.projectId)||Va(e==null?void 0:e.agentId))?Bk():Hk(e??{}),$k=()=>{zm=null,S0=0,xu=null,Eu=null,gp=0,Su=null,Bm=null,j0=0,ju=null,w0.clear(),Hm.clear(),$m.clear()},n3="panda:notification-settings",s3="panda:notified-completions",x_="panda:web-push-subscription-state",Fk=280,a3="session-completions",bg={completionNotificationsEnabled:!1};let Zf=qs()?"default":"unsupported";const uh=()=>{const e=id();if(!e)throw new Error("尚未配置 Panda Hub 地址。");return P6(e)},i3=e=>({completionNotificationsEnabled:(e==null?void 0:e.completionNotificationsEnabled)===!0}),qk=(e,t)=>e.length<=t?e:`${e.slice(0,t-1).trimEnd()}…`,r3=()=>{if(typeof window>"u")return{};try{const e=window.localStorage.getItem(s3);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{}}},Wk=e=>{if(!(typeof window>"u"))try{window.localStorage.setItem(s3,JSON.stringify(e))}catch{}},Kk=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}},l3=()=>{if(typeof window>"u")return null;try{return Kk(JSON.parse(window.localStorage.getItem(x_)??"null"))}catch{return null}},o3=e=>{if(!(typeof window>"u"))try{window.localStorage.setItem(x_,JSON.stringify(e))}catch{}},_p=()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem(x_)}catch{}},c3=async()=>{if(typeof navigator>"u"||!("serviceWorker"in navigator))throw new Error("当前环境没有可用的 Service Worker。");return navigator.serviceWorker.ready},Qk=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},S_=async()=>{const e=await c3();return"pushManager"in e?e.pushManager.getSubscription():null},u3=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}}},d3=async()=>{try{return await uh().getWebPushPublicConfig()}catch(e){throw new Error(e instanceof Error?e.message:"无法读取 Hub Web Push 配置。")}},N0=()=>{if(typeof window>"u")return bg;try{const e=window.localStorage.getItem(n3);return e?i3(JSON.parse(e)):bg}catch{return bg}},Ho=e=>{if(!(typeof window>"u"))try{window.localStorage.setItem(n3,JSON.stringify(i3(e)))}catch{}},dh=()=>qs()?!0:typeof window>"u"?!1:window.isSecureContext&&"Notification"in window&&"serviceWorker"in navigator,ed=()=>qs()||!dh()?!1:"PushManager"in window,Cu=()=>qs()?Zf:dh()?Notification.permission:"unsupported",f3=e=>e==="granted"?"granted":e==="denied"?"denied":e==="prompt"?"default":"unsupported",h3=async()=>{Tp()&&await lh.createChannel({id:a3,name:"任务完成提醒",description:"Panda 对话和任务完成提醒",importance:4,visibility:1,vibration:!0,lights:!0}).catch(()=>{})},j_=async()=>{if(qs()){const e=await lh.checkPermissions();return Zf=f3(e.display),Zf}return dh()?Notification.permission:"unsupported"},k0=async()=>{if(qs()){await h3();const e=await lh.requestPermissions();return Zf=f3(e.display),Zf}return dh()?Notification.requestPermission():"unsupported"},E0=()=>{var e;return((e=l3())==null?void 0:e.completionNotificationsEnabled)===!0},Gk=async e=>{if(!e.completionNotificationsEnabled||Cu()!=="granted")return{synced:!1,reason:"notifications-disabled"};if(!ed())return{synced:!1,reason:"unsupported"};const t=await d3();if(!t.supported||!t.vapid_public_key)return _p(),{synced:!1,reason:"hub-unsupported"};const a=await S_();if(!a)return _p(),{synced:!1,reason:"missing-browser-subscription"};const l=await uh().upsertWebPushSubscription({subscription:u3(a),settings:{completion_notifications_enabled:e.completionNotificationsEnabled},device:{label:Nu()?"installed-pwa":"browser-tab",user_agent:typeof navigator<"u"?navigator.userAgent:null}});return o3({completionNotificationsEnabled:l.settings.completion_notifications_enabled,endpoint:l.endpoint,updatedAt:l.updated_at}),{synced:!0,endpoint:l.endpoint}},Z4=async e=>{if(!ed())throw new Error("当前环境不支持 Web Push。");const t=await d3();if(!t.supported||!t.vapid_public_key)throw new Error(t.reason??"Hub 当前没有可用的 Web Push 配置。");const a=await c3(),o=await a.pushManager.getSubscription()??null??await a.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:Qk(t.vapid_public_key)}),u=await uh().upsertWebPushSubscription({subscription:u3(o),settings:{completion_notifications_enabled:e.completionNotificationsEnabled},device:{label:Nu()?"installed-pwa":"browser-tab",user_agent:typeof navigator<"u"?navigator.userAgent:null}});return o3({completionNotificationsEnabled:u.settings.completion_notifications_enabled,endpoint:u.endpoint,updatedAt:u.updated_at}),u},Yk=async()=>{if(!ed())return _p(),{removed:!1};const e=await S_();if(e){try{await uh().removeWebPushSubscription({endpoint:e.endpoint})}catch{}try{await e.unsubscribe()}catch{}}return _p(),{removed:!!e}},Vk=async()=>{var l,o;if(!ed())throw new Error("当前环境不支持 Web Push。");if(Cu()!=="granted")throw new Error("请先授予系统通知权限。");const e=await S_(),t=l3(),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 uh().sendWebPushTest({endpoint:a}),{ok:!0,endpoint:a}},Nu=()=>{if(typeof window>"u")return!1;const e=navigator;return window.matchMedia("(display-mode: standalone)").matches||e.standalone===!0},X4=()=>typeof navigator>"u"?!1:/Android/i.test(navigator.userAgent),Zk=e=>{if(typeof e!="string")return"";const t=e.replace(/\r\n/g,`
|
|
67
|
+
`).replace(/\s+/g," ").trim();return t?qk(t,Fk):""},Xk=(e,t)=>r3()[e]===t,xg=(e,t)=>{const a=r3();a[e]!==t&&Wk({...a,[e]:t})},m3=async e=>{if(!dh())return!1;if(qs()){if(await j_()!=="granted")return!1;await h3();try{return await lh.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:a3,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}}},Jk=async e=>{if(!qs())return()=>{};const t=await lh.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()}},p3=1,eE=10080*60*1e3,g3="panda-web-cache",td="app-state",_3="react-query",J4="panda:storage-persist-result",tE=new Set(["directory","bootstrap","timeline","timeline-optimistic","change-sets","plan","interactions","codex-commands","project-skills","settings-connection"]),w_=()=>typeof window<"u"&&typeof window.indexedDB<"u",nE=e=>typeof e[0]=="string"&&tE.has(e[0]),y3=async()=>w_()?await new Promise((e,t)=>{const a=window.indexedDB.open(g3,1);a.onupgradeneeded=()=>{const l=a.result;l.objectStoreNames.contains(td)||l.createObjectStore(td)},a.onsuccess=()=>e(a.result),a.onerror=()=>t(a.error??new Error("Unable to open Panda cache database."))}):null,sE=async()=>{const e=await y3();if(!e)return null;try{return await new Promise((t,a)=>{const u=e.transaction(td,"readonly").objectStore(td).get(_3);u.onsuccess=()=>t(u.result??null),u.onerror=()=>a(u.error??new Error("Unable to read Panda cache record."))})}finally{e.close()}},aE=async e=>{const t=await y3();if(t)try{await new Promise((a,l)=>{const o=t.transaction(td,"readwrite");o.objectStore(td).put(e,_3),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()}},yp=async()=>{w_()&&await new Promise(e=>{const t=window.indexedDB.deleteDatabase(g3);t.onsuccess=()=>e(),t.onerror=()=>e(),t.onblocked=()=>e()})},iE=async e=>{if(w_())try{const t=await sE();if(!t)return;const a=Date.now()-t.persistedAt>eE;if(t.version!==p3||a){await yp();return}C9(e,t.clientState)}catch{await yp().catch(()=>{})}},rE=async()=>{if(!(typeof navigator>"u"||typeof window>"u"||!("storage"in navigator)||typeof navigator.storage.persist!="function"))try{if(window.localStorage.getItem(J4))return;const t=await navigator.storage.persist();window.localStorage.setItem(J4,t?"granted":"denied")}catch{}},lE=e=>{if(typeof window>"u")return()=>{};rE();let t=null,a=null,l=!1,o=!1;const u=async()=>{if(!o){if(a){l=!0;return}a=(async()=>{const S=E9(e,{shouldDehydrateQuery:p=>nE(p.queryKey)});await aE({version:p3,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)}},v3=async e=>{$k(),z6(),await yp().catch(()=>{}),e.removeQueries({predicate:t=>typeof t.queryKey[0]=="string"&&t.queryKey[0]!=="pwa-install-diagnostics"})},oE=()=>{const e=ki(),t=La(),a=Mp();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(d6,{title:"Hub 地址",description:"填写电脑上显示的访问地址。",initialHubUrl:a.hubUrl,hint:"手机能直接打开这个地址就可以。",saveLabel:"保存并进入",savingLabel:"连接中",saveDescription:"保存后立即进入,之后也能在设置里修改。",saveSuccessMessage:"地址已保存,正在进入 Panda。",onSaveSuccess:async l=>{await q6({hubUrl:l.url,onboardingCompleted:!0}),qs()&&await k0().catch(()=>"unsupported")==="granted"&&Ho({completionNotificationsEnabled:!0}),await v3(t),await e({to:"/nodes",replace:!0})}})})]})})},Gi=["directory","hub"],cE=["directory","hub","recent-sessions"],os=["directory","workspace"],uE=["bootstrap","hub"],dE=os,eb=e=>{if(e==null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},fE=(e,t)=>{if(e.length!==t.length)return!1;for(let a=0;a<e.length;a+=1)if(!N_(e[a],t[a]))return!1;return!0},N_=(e,t)=>{if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return fE(e,t);if(eb(e)&&eb(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)||!N_(e[o],t[o]))return!1;return!0}return!1},Uf=(e,t)=>e!==void 0&&N_(e,t)?e:t,Fm=(e,t,a)=>{if(!e||e.length===0)return t;const l=new Map(e.map(u=>[a(u),u])),o=t.map(u=>Uf(l.get(a(u)),u));return e.length===o.length&&e.every((u,f)=>u===o[f])?e:o},tb=(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},b3=(e,t)=>{if(!e)return t;const a=Fm(e.agents,t.agents,o=>o.id),l=Uf(e.generated_at,t.generated_at);return e.agents===a&&e.generated_at===l?e:{...t,generated_at:l,agents:a}},hE=180,mE=()=>{const e=La(),{hubUrl:t}=Mp(),a=_.useRef(null),l=pc(),o=ch(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)},b=(T,D)=>{const z=new Date().toISOString();e.setQueryData(Gi,I=>tb(I,T,{status:D},z)??I),G4(I=>tb(I,T,{status:D},z)??I)},w=async()=>{try{const T=await Q4().getHubDirectory();if(f)return;G4(()=>T),e.setQueryData(Gi,D=>b3(D,T))}catch{}},N=()=>{p(),a.current=window.setTimeout(()=>{a.current=null,w()},hE)},j=T=>{var D,z;if(T.type==="agent.online"){if(S){S=!1;return}const I=typeof((D=T.payload)==null?void 0:D.agentId)=="string"?T.payload.agentId.trim():"";if(!I)return;b(I,"online"),N();return}if(T.type==="agent.offline"){const I=typeof((z=T.payload)==null?void 0:z.agentId)=="string"?T.payload.agentId.trim():"";if(!I)return;b(I,"offline"),N();return}T.type==="snapshot.changed"&&N()};w();try{m=Q4().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},fh=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)}),co=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}})}},pE=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}),gE=e=>({id:e.id,agent_id:e.agent_id,name:e.name,display_name:e.display_name,pinned:e.pinned,path:e.path}),C0=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},vp=(e,t)=>!!(e!=null&&e.sessions.some(a=>a.id===t)),bp=(e,t,a)=>!e||!vp(e,t)?e:co({...e,sessions:fh(e.sessions.map(l=>l.id===t?{...l,...a}:l))}),T0=(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:bp(e,t,{last_event_at:a})},Tf=(e,t,a)=>{if(!e)return e;const{last_event_at:l,...o}=a;let u=bp(e,t,o);return typeof l=="string"&&l.trim()&&(u=T0(u,t,l)),u},x3=(e,t,a)=>{if(!e||t.length===0)return e;const l=new Set(t);return co({...e,sessions:fh(e.sessions.map(o=>l.has(o.id)?{...o,...a}:o))})},S3=(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 co({...e,active_session_id:o,sessions:fh(l)})},Tu=(e,t,a)=>!e||!e.projects.some(l=>l.id===t)?e:co({...e,projects:e.projects.map(l=>l.id===t?{...l,...a}:l)}),xp=(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:co({...e,projects:o})},Sp=(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 co({...e,active_session_id:l,projects:e.projects.filter(u=>u.id!==t),sessions:fh(a)})},j3=(e,t)=>{if(!e)return e;const a=pE(t),l=[a,...e.sessions.filter(o=>o.id!==a.id)];return co({...e,generated_at:new Date().toISOString(),active_session_id:a.id,sessions:fh(l)})},_E=(e,t)=>{if(!e)return e;const a=gE(t),l=[a,...e.projects.filter(o=>o.id!==a.id)];return co({...e,generated_at:new Date().toISOString(),projects:l})},yE=(e,t)=>{if(!e)return t;const a=t.agent?Uf(e.agent??void 0,t.agent):e.agent===null?e.agent:null,l=Fm(e.projects,t.projects,y=>y.id),o=Fm(e.project_stats,t.project_stats,y=>y.project_id),u=Fm(e.sessions,t.sessions,y=>y.id),f=Uf(e.generated_at,t.generated_at),m=Uf(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}},vE=async()=>{const e=await wn();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()},bE=async()=>{const e=await wn();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()},xE=async e=>(await wn(e==null?void 0:e.scope)).client.getWorkspaceDirectory({selectedSessionId:(e==null?void 0:e.selectedSessionId)??null}),SE=(e,t)=>b3(e,t),jE=(e,t)=>yE(e,t),R0=e=>{var t,a,l;return[...os,((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)??""]},w3=e=>({queryKey:Gi,enabled:(e==null?void 0:e.enabled)??!0,queryFn:vE,structuralSharing:SE,staleTime:3e4,refetchInterval:3e5,refetchOnMount:!1,refetchOnWindowFocus:!1,retry:1}),wE=()=>({queryKey:cE,queryFn:bE,staleTime:3e4,refetchInterval:!1,refetchOnMount:!1,refetchOnWindowFocus:!1,retry:1}),N3=e=>({queryKey:R0(e),enabled:(e==null?void 0:e.enabled)??!0,queryFn:()=>xE(e),placeholderData:g9,structuralSharing:jE,staleTime:1e4,refetchInterval:!1,refetchOnMount:!1,refetchOnWindowFocus:!1,retry:1}),k3=async e=>e.fetchQuery(w3()),NE=async e=>e.fetchQuery(wE()),Rf=async(e,t)=>e.fetchQuery(N3(t)),kE=1200,EE=e=>typeof document>"u"?!1:document.visibilityState==="visible"&&mp()===e,E3=e=>{var t;return((t=e==null?void 0:e.title)==null?void 0:t.trim())||"当前会话"},CE=e=>e.run_state!=="completed"?null:(typeof e.run_state_changed_at=="string"?e.run_state_changed_at.trim():"")||null,TE=(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()||E3(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}},RE=(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=CE(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:E3(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},AE=({})=>{const e=La(),t=_.useRef(void 0),a=_.useRef(new Set),l=_.useRef(null),o=_.useRef(!1),u=pc(),f=ch(u),m=u&&f?u:null;return _.useEffect(()=>{const y=async I=>{const k=N0();if(!qs()&&!k.completionNotificationsEnabled||Cu()!=="granted")return;if(E0()){xg(I.sessionId,I.completedAt);return}const P=`${I.sessionId}:${I.completedAt}`;if(!a.current.has(P)&&!Xk(I.sessionId,I.completedAt)){if(EE(I.sessionId)){xg(I.sessionId,I.completedAt);return}a.current.add(P);try{await m3({sessionId:I.sessionId,completedAt:I.completedAt,title:I.sessionTitle,body:Zk(I.finalReply),url:`/session/${I.sessionId}`})&&xg(I.sessionId,I.completedAt)}finally{a.current.delete(P)}}},g=async I=>{for(const k of I)await y(k)};let S=!1,p,b=!1,w=!1,N=!1;const j=async()=>{if(!m)return NE(e);const k=await(await wn({agentId:m})).client.getPhaseOneSnapshot({fallbackToMock:!1});return{generated_at:k.generated_at,recent_sessions:[...k.sessions].sort((P,Q)=>+new Date(Q.last_event_at)-+new Date(P.last_event_at)).slice(0,24).map(P=>({id:P.id,title:P.title,run_state:P.run_state,run_state_changed_at:P.run_state_changed_at,latest_assistant_message:P.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 k=t.current;if(t.current=I,!k)return;await g(RE(k,I))}catch{}finally{o.current=!1}}},D=()=>{l.current!==null&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,T()},kE)},z=I=>{var k,P;if(I.type==="turn.completed"){const Q=TE(I.payload,t.current);Q&&y(Q);return}if(I.type==="session.updated"){const Q=typeof((k=I.payload)==null?void 0:k.sessionId)=="string"?I.payload.sessionId.trim():"",se=(P=I.payload)!=null&&P.sessionPatch&&typeof I.payload.sessionPatch=="object"?I.payload.sessionPatch:null;Q&&se&&(t.current=ME(t.current,Q,se));return}I.type==="agent.online"&&N&&(N=!1)};return wn(m?{agentId:m}:void 0).then(I=>{S||(p=I.client.connectEvents(z,{reconnectWhenHidden:!0,onStatus:k=>{if(k.state==="connected"){N=!0,b&&w&&(w=!1,D()),b=!0;return}b&&(w=!0)}}))}),()=>{S=!0,l.current!==null&&(clearTimeout(l.current),l.current=null),p==null||p()}},[e,m]),null},k_=e=>e.replace(/[\\/]+$/,""),jp=e=>k_(e).replace(/\\/g,"/").toLowerCase(),DE=e=>{const t=k_(e.trim());if(!t)return"新线程";const a=t.split(/[\\/]+/).filter(Boolean),l=a[a.length-1];return l?l.endsWith(":")?t:l:t},C3=e=>{if(!e)return null;const t=e.trim();if(!t||t==="/"||/^[A-Za-z]:[\\/]?$/.test(t))return null;const a=k_(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},T3=async e=>(await wn({agentId:e.agentId})).client.listDirectories(e),OE=async e=>(await wn({agentId:e.agentId})).client.createDirectory(e),IE=async e=>{const t=e.bootstrapQueryKey??["bootstrap"],a=e.projects.find(u=>u.agent_id===e.agentId&&jp(u.path)===jp(e.path));if(a)return a;const o=await(await wn({agentId:e.agentId})).client.createProject({agentId:e.agentId,name:DE(e.path),path:e.path});return e.queryClient.invalidateQueries({queryKey:t}),o.project},nb=()=>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"})}),LE=()=>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"})}),PE=()=>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"})}),sb=e=>!!(e&&/^[A-Za-z]:[\\/]?$/.test(e.trim())),UE=({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,b]=_.useState([]),[w,N]=_.useState(!0),[j,T]=_.useState(null);_.useEffect(()=>{y(t),S(t)},[t]),_.useEffect(()=>{let P=!1;return N(!0),T(null),T3({agentId:e,path:m}).then(Q=>{P||b(Q)}).catch(Q=>{P||(T(Q instanceof Error?Q.message:"目录列表加载失败。"),b([]))}).finally(()=>{P||N(!1)}),()=>{P=!0}},[e,m]);const D=C3(m),z=D!==null||sb(m),I=()=>{if(D!==null){y(D),S(D);return}sb(m)&&(y(null),S(null))},k=P=>{y(P),S(P)};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(nb,{})}),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(P=>{const Q=g===P.path;return i.jsxs("div",{className:`directory-picker__row ${Q?"is-selected":""}`,children:[i.jsxs("button",{type:"button",className:"directory-picker__row-main",onClick:()=>{S(P.path)},onDoubleClick:()=>{P.has_children&&k(P.path)},"aria-selected":Q,children:[i.jsx("span",{className:"directory-picker__row-icon",children:i.jsx(nb,{})}),i.jsx("span",{className:"directory-picker__row-name",children:P.name}),Q?i.jsx("span",{className:"directory-picker__row-check",children:i.jsx(PE,{})}):null]}),P.has_children?i.jsx("button",{type:"button",className:"directory-picker__row-enter-button","aria-label":`进入 ${P.name}`,onClick:()=>k(P.path),children:i.jsx("span",{className:"directory-picker__row-enter","aria-hidden":"true",children:i.jsx(LE,{})})}):null]},P.path)})})]}),i.jsx("footer",{className:"directory-picker__footer",children:i.jsxs("div",{className:"directory-picker__footer-actions",children:[z?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})]})})]})})})]})},R3="panda-dev-manager-last-apk-download",zE=9e4,Sm=e=>{if(!e)return"未记录";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString("zh-CN",{hour12:!1})},BE=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`,HE=()=>{if(typeof window>"u")return null;try{const e=window.localStorage.getItem(R3);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}},$E=e=>{if(!(typeof window>"u"))try{window.localStorage.setItem(R3,JSON.stringify({artifactId:e,triggeredAt:Date.now()}))}catch{}},Uo=e=>e==="succeeded"?"通过":e==="failed"?"异常":"进行中",fu=e=>e==="succeeded"?"is-success":e==="failed"?"is-danger":"is-muted",ab=e=>e==null?"未测试":e?"通过":"异常",ib=e=>e==null?"is-muted":e?"is-success":"is-danger",FE=e=>e?e==="running"?"运行中":e==="stopped"?"已停止":e==="missing"?"未注册":"未知":"未注册",Ll=e=>e?`http://127.0.0.1:${e}`:"",jm=e=>e?`ws://127.0.0.1:${e}/ws`:"",rb=e=>({...e}),Sg=(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})}},qE=({isActive:e,agentId:t})=>{var ke;const a=La(),[l,o]=_.useState(null),[u,f]=_.useState(null),[m,y]=_.useState(""),[g,S]=_.useState(!1),[p,b]=_.useState(null),[w,N]=_.useState(!1),j=t?{agentId:t}:void 0,T=["settings-dev-manager",t??"no-agent"],D=ls({queryKey:T,queryFn:async()=>{const U=await wn(j),ve=a.getQueryData(T),Z=await U.client.getDevManagerSnapshot({includeServiceProbe:!1});return{baseUrl:U.baseUrl,snapshot:Sg(ve==null?void 0:ve.snapshot,Z)}},enabled:e&&!!t,refetchOnWindowFocus:!1,staleTime:0,refetchInterval:U=>{const ve=U.state.data;return ve!=null&&ve.snapshot.jobs.some(Z=>Z.status==="running")?2e3:!1}});_.useEffect(()=>{var ve;const U=(ve=D.data)==null?void 0:ve.snapshot.config;U&&(l&&u===U.updated_at||(o(rb(U)),f(U.updated_at),y(""),S(!1)))},[D.data,l,u]);const z=Vn({mutationFn:async()=>{if(!j)throw new Error("当前没有可用的开发节点,暂时无法保存开发版配置。");if(!l)throw new Error("开发版配置还没有加载完成。");return(await wn(j)).client.saveDevManagerConfig({...l,npm_token:m||null,clear_npm_token:g})},onSuccess:U=>{a.setQueryData(T,ve=>({baseUrl:(ve==null?void 0:ve.baseUrl)??"",snapshot:Sg(ve==null?void 0:ve.snapshot,U)})),o(rb(U.config)),f(U.config.updated_at),y(""),S(!1),b("开发版配置已保存。")},onError:U=>{b(U instanceof Error?U.message:"保存配置失败。")}}),I=Vn({mutationFn:async U=>{if(!j)throw new Error("当前没有可用的开发节点,暂时无法执行开发版管理操作。");return(await wn(j)).client.executeDevManagerAction({action:U})},onSuccess:(U,ve)=>{var Z,Se,je,Oe;a.setQueryData(T,Ie=>({baseUrl:(Ie==null?void 0:Ie.baseUrl)??"",snapshot:Sg(Ie==null?void 0:Ie.snapshot,U.snapshot)})),b(ve==="restart-release-services"?"后台重启助手已启动,当前连接会短时断开,请等待正式版自动恢复。":ve==="install-latest-release"?"后台升级助手已启动,当前连接会短时断开,请等待正式版自动恢复。":ve==="install-latest-release-package"?((Z=U.job)==null?void 0:Z.summary)??"正式版 npm 安装任务已启动。":ve==="install-release-services"?((Se=U.job)==null?void 0:Se.summary)??"正式版服务注册任务已启动。":ve==="uninstall-release-services"?((je=U.job)==null?void 0:je.summary)??"正式版服务移除任务已启动。":((Oe=U.job)==null?void 0:Oe.summary)??"任务已启动。")},onError:U=>{b(U instanceof Error?U.message:"执行操作失败。")}}),k=((ke=D.data)==null?void 0:ke.snapshot)??null,P=(k==null?void 0:k.jobs[0])??null,Q=(k==null?void 0:k.jobs.find(U=>U.status==="running"))??null,se=(k==null?void 0:k.jobs.find(U=>U.kind==="npm-publish"))??null,W=(k==null?void 0:k.jobs.find(U=>U.kind==="release-service-install"))??null,V=(k==null?void 0:k.jobs.find(U=>U.kind==="release-service-uninstall"))??null,Y=(k==null?void 0:k.jobs.find(U=>U.kind==="release-install-package"))??null,ee=(k==null?void 0:k.jobs.find(U=>U.kind==="release-restart"))??(k==null?void 0:k.jobs.find(U=>U.kind==="release-install-run"))??null,me=P,ge=_.useMemo(()=>(k==null?void 0:k.services.filter(U=>U.key.startsWith("dev-")))??[],[k]),te=_.useMemo(()=>(k==null?void 0:k.services.filter(U=>U.key.startsWith("release-")))??[],[k]),xe=_.useMemo(()=>ge.some(U=>U.status==="running")?"部分或全部运行中":ge.some(U=>U.status==="degraded")?"存在异常":"未运行",[ge]),C=(U,ve)=>{o(Z=>Z&&{...Z,[U]:ve})},q=(U,ve)=>{const Z=Number(ve)||null;o(Se=>{if(!Se)return Se;const je={...Se,[U]:Z};if(U==="dev_hub_port"){const Oe=Ll(Se.dev_hub_port),Ie=Ll(Z);Se.dev_agent_hub_url===Oe&&(je.dev_agent_hub_url=Ie),Se.dev_web_hub_url===Oe&&(je.dev_web_hub_url=Ie)}if(U==="dev_agent_port"){const Oe=Ll(Se.dev_agent_port),Ie=Ll(Z),wt=jm(Se.dev_agent_port),qe=jm(Z);Se.dev_agent_direct_base_url===Oe&&(je.dev_agent_direct_base_url=Ie),Se.dev_agent_ws_base_url===wt&&(je.dev_agent_ws_base_url=qe)}if(U==="release_hub_port"){const Oe=Ll(Se.release_hub_port),Ie=Ll(Z);Se.release_agent_hub_url===Oe&&(je.release_agent_hub_url=Ie)}if(U==="release_agent_port"){const Oe=Ll(Se.release_agent_port),Ie=Ll(Z),wt=jm(Se.release_agent_port),qe=jm(Z);Se.release_agent_direct_base_url===Oe&&(je.release_agent_direct_base_url=Ie),Se.release_agent_ws_base_url===wt&&(je.release_agent_ws_base_url=qe)}return je})},ie=async()=>{if(!(k!=null&&k.apk_artifact)){b("当前还没有可下载的 APK。");return}if(!j){b("当前没有可用的开发节点,暂时无法下载 APK。");return}const U=HE();if((U==null?void 0:U.artifactId)===k.apk_artifact.artifact_id&&Date.now()-U.triggeredAt<zE){b("同一个 APK 刚刚已经触发过下载。如果安装确认没有弹出,请先查看系统下载列表或等待浏览器处理完成。");return}const ve=await wn(j),Z=new URL(k.apk_artifact.download_path,ve.baseUrl).toString();$E(k.apk_artifact.artifact_id),window.open(Z,"_blank","noopener,noreferrer"),b("APK 下载已触发。")},he=U=>{C("repo_path",U),N(!1),b(`已选中开发版目录:${U}`)},re=I.isPending;if(D.isLoading&&!k)return i.jsx("p",{className:"settings-block__status",children:"正在加载开发版管理信息…"});if(D.error instanceof Error)return i.jsx("p",{className:"settings-block__status",children:D.error.message});if(!t)return i.jsx("p",{className:"settings-block__status",children:"当前没有可用的代码线程节点,请先在会话里连接到目标 agent,再使用开发版管理。"});if(!k||!l)return i.jsx("p",{className:"settings-block__status",children:"当前还没有可用的开发版管理数据。"});const L=I.variables,ae=k.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:k.config.repo_path??"未配置"})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"正式版版本"}),i.jsx("strong",{children:k.current_version??"未检测到"})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"开发版状态"}),i.jsx("strong",{children:xe})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"最新 APK"}),i.jsx("strong",{children:k.apk_artifact?Sm(k.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 z.mutateAsync(),disabled:z.isPending,children:z.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:()=>C("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:U=>C("nvm_version",U.target.value||null),children:[i.jsx("option",{value:"",children:"保持系统默认"}),k.node_runtime.versions.map(U=>i.jsx("option",{value:U,children:U},U))]}),i.jsx("small",{className:`dev-manager-field-hint ${ae?"":"is-danger"}`,children:ae?k.node_runtime.manager==="nvm-windows"?"下拉内容包含当前正在运行的 Node 版本,以及这台电脑上 nvm-windows 已安装的版本。":"下拉内容至少包含当前正在运行的 Node 版本;如果这台电脑安装了 nvm-windows,也会一并列出。":k.node_runtime.error||"当前没有检测到可用的 Node 版本。"})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"npm 令牌"}),i.jsx("input",{type:"password",value:m,onChange:U=>{S(!1),y(U.target.value)},placeholder:k.credentials.has_npm_token?`已保存:${k.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:U=>q("dev_hub_port",U.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:U=>q("dev_agent_port",U.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:U=>q("dev_web_port",U.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:U=>C("dev_agent_hub_url",U.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:U=>C("dev_agent_direct_base_url",U.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:U=>C("dev_agent_ws_base_url",U.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:U=>C("dev_agent_name",U.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:U=>C("dev_web_hub_url",U.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:U=>C("dev_hub_args",U.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:U=>C("dev_agent_args",U.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:U=>C("dev_web_args",U.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:U=>q("release_hub_port",U.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:U=>q("release_agent_port",U.target.value)})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"正式版 Hub 服务名"}),i.jsx("input",{type:"text",value:l.release_hub_service_name,onChange:U=>C("release_hub_service_name",U.target.value),placeholder:"PandaHub"})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"正式版 Agent 服务名"}),i.jsx("input",{type:"text",value:l.release_agent_service_name,onChange:U=>C("release_agent_service_name",U.target.value),placeholder:"PandaAgent"})]}),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:U=>C("release_agent_hub_url",U.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:U=>C("release_agent_direct_base_url",U.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:U=>C("release_agent_ws_base_url",U.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:U=>C("release_agent_name",U.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:U=>C("release_hub_args",U.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:U=>C("release_agent_args",U.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:re,children:L==="start-development"&&I.isPending?"启动中…":"启动"}),i.jsx("button",{type:"button",className:"settings-inline-action",onClick:()=>void I.mutateAsync("restart-development"),disabled:re,children:L==="restart-development"&&I.isPending?"重启中…":"重启"}),i.jsx("button",{type:"button",className:"settings-ghost-button",onClick:()=>void I.mutateAsync("stop-development"),disabled:re,children:L==="stop-development"&&I.isPending?"停止中…":"停止"}),i.jsx("button",{type:"button",className:"settings-ghost-button",onClick:()=>void I.mutateAsync("probe-development"),disabled:re,children:L==="probe-development"&&I.isPending?"测试中…":"状态测试"})]})]}),i.jsx("div",{className:"dev-manager-service-grid",children:ge.map(U=>{var ve,Z;return i.jsxs("article",{className:`settings-diagnostic-list__item dev-manager-service-card is-${U.status}`,children:[i.jsx("strong",{children:U.label}),i.jsxs("span",{children:["上次测试:"," ",i.jsx("strong",{className:ib((ve=U.probe)==null?void 0:ve.ok),children:ab((Z=U.probe)==null?void 0:Z.ok)})]}),i.jsxs("span",{children:["端口:",U.configured_port??"未配置"]}),U.detected_pids.length>0?i.jsxs("span",{children:["PID:",U.detected_pids.join(", ")]}):null]},U.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:L==="publish-npm"&&I.isPending?"发布中…":"发布"}),i.jsx("button",{type:"button",className:"settings-ghost-button",onClick:()=>void I.mutateAsync("install-latest-release-package"),disabled:I.isPending,children:L==="install-latest-release-package"&&I.isPending?"安装中…":"安装最新正式版"}),i.jsx("button",{type:"button",className:"settings-ghost-button",onClick:()=>void I.mutateAsync("restart-release-services"),disabled:I.isPending,children:L==="restart-release-services"&&I.isPending?"重启中…":"重启正式版"}),i.jsx("button",{type:"button",className:"settings-ghost-button",onClick:()=>void I.mutateAsync("install-release-services"),disabled:I.isPending,children:L==="install-release-services"&&I.isPending?"注册中…":"注册/更新服务"}),i.jsx("button",{type:"button",className:"settings-ghost-button",onClick:()=>void I.mutateAsync("uninstall-release-services"),disabled:I.isPending,children:L==="uninstall-release-services"&&I.isPending?"移除中…":"移除服务"})]})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前正式版版本"}),i.jsx("span",{children:k.current_version??"未检测到"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"最近 npm 发布"}),i.jsx("span",{className:se?fu(se.status):"is-muted",children:se?Uo(se.status):"未执行"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"最近正式版安装"}),i.jsx("span",{className:Y?fu(Y.status):"is-muted",children:Y?Uo(Y.status):"未执行"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"最近正式版恢复"}),i.jsx("span",{className:ee?fu(ee.status):"is-muted",children:ee?Uo(ee.status):"未执行"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"最近服务注册"}),i.jsx("span",{className:W?fu(W.status):"is-muted",children:W?Uo(W.status):"未执行"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"最近服务移除"}),i.jsx("span",{className:V?fu(V.status):"is-muted",children:V?Uo(V.status):"未执行"})]}),te.map(U=>{var ve,Z;return i.jsxs("article",{className:`settings-diagnostic-list__item dev-manager-service-card is-${U.status}`,children:[i.jsx("strong",{children:U.label}),i.jsxs("span",{children:["当前模式:"," ",i.jsx("strong",{children:U.manager==="windows-service"?"Windows 服务":"普通进程"})]}),i.jsxs("span",{children:["服务名:",U.service_name??"未配置"]}),i.jsxs("span",{children:["服务控制器:"," ",i.jsx("strong",{className:U.service_registered?"":"is-muted",children:FE(U.service_registered?U.service_status:"missing")})]}),i.jsxs("span",{children:["探测结果:"," ",i.jsx("strong",{className:ib((ve=U.probe)==null?void 0:ve.ok),children:ab((Z=U.probe)==null?void 0:Z.ok)})]}),i.jsxs("span",{children:["端口:",U.configured_port??"未配置"]})]},U.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:L==="build-apk"&&I.isPending?"编译中…":"编译 APK"}),i.jsx("button",{type:"button",className:"settings-ghost-button",onClick:()=>void ie(),disabled:!k.apk_artifact,children:"下载 APK"})]})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"最近构建时间"}),i.jsx("span",{children:k.apk_artifact?Sm(k.apk_artifact.built_at):"尚未构建"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"版本"}),i.jsx("span",{children:k.apk_artifact?`${k.apk_artifact.version_name??"未知"}${k.apk_artifact.version_code?` (${k.apk_artifact.version_code})`:""}`:"尚未构建"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"文件大小"}),i.jsx("span",{children:k.apk_artifact?BE(k.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,Q?i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前运行中"}),i.jsxs("span",{children:[Q.title," · ",Uo(Q.status)]})]}):null,me?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:me.title}),i.jsx("span",{children:Sm(me.started_at??me.created_at)})]}),i.jsxs("div",{className:`settings-log-item__kind ${fu(me.status)}`,children:[Uo(me.status),me.disconnect_expected?" · 会中断连接":""]}),me.summary?i.jsx("div",{className:"dev-manager-job__summary",children:me.summary}):null,me.logs.length>0?i.jsx("pre",{className:"settings-log-item__detail",children:me.logs.slice(-16).map(U=>`[${Sm(U.timestamp)}] ${U.message}`).join(`
|
|
68
|
+
`)}):null]},me.id)}):i.jsx("p",{className:"settings-block__status",children:"还没有开发版管理任务记录。"})]}),w&&t?i.jsx(UE,{agentId:t,initialPath:l.repo_path,onClose:()=>N(!1),onSelect:he}):null]})},M3=mc("App",{web:()=>Zr(()=>import("./web-DuZa6nLj.js"),[]).then(e=>new e.AppWeb)}),WE=mc("Browser",{web:()=>Zr(()=>import("./web-Cx7LKGTD.js"),[]).then(e=>new e.BrowserWeb)}),KE=e=>{const t=(e==null?void 0:e.trim())??"";return t?t.replace(/\/+$/,""):""},QE=async()=>{if(!Tp())return{platform:qu(),version:null,build:null,appId:null};const e=await M3.getInfo();return{platform:qu(),version:e.version??null,build:e.build??null,appId:e.id??null}},A3=e=>{const t=KE(e);return t?new URL("/downloads/android/latest.json",t).toString():""},GE=async e=>{const t=A3(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}},YE=e=>{const t=Number(e);return Number.isFinite(t)?t:null},VE=(e,t)=>{if(!e||!t)return!1;const a=YE(e.build);return typeof a=="number"?t.version_code>a:t.version_name!==e.version},ZE=async e=>{if(!e.trim())throw new Error("当前没有可用的 APK 下载地址。");await WE.open({url:e})},D3="panda:session-model",O3="panda:command-execution-model",I3="panda:title-generation-model",E_="panda:session-model-options",M0="panda:session-model-options-updated",L3="panda:session-reasoning",P3="panda:session-fast-mode",U3="panda:session-plan-mode",z3="panda:session-yolo-mode",nd=[{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"}],Xf=[{label:"低",value:"low"},{label:"中",value:"medium"},{label:"高",value:"high"},{label:"极高",value:"xhigh"}];var C2;const B3=((C2=nd[0])==null?void 0:C2.value)??"gpt-5.4",lb="gpt-5.4-mini",ob="gpt-5.4-mini",XE=Xf[2].value,Fr=e=>typeof e=="string"?e.trim():"",JE=(e,t)=>{if(!e||typeof e!="object")return null;const a=e,l=Fr(a.value),o=Fr(a.label)||l,u=Fr(a.id)||l||`custom-model-${t+1}`;if(!o||!l)return null;const f=Fr(a.description);return{id:u,label:o,value:l,description:f||null}},eC=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}]})},H3=e=>{if(!Array.isArray(e))return nd;const t=eC(e.flatMap((a,l)=>{const o=JE(a,l);return o?[o]:[]}));return t.length>0?t:nd},ld=e=>{if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}},tC=()=>{typeof window>"u"||window.dispatchEvent(new Event(M0))},od=(e,t)=>{if(!(typeof window>"u"))try{window.localStorage.setItem(e,t)}catch{}},C_=(e,t=!1)=>{const a=ld(e);return a==="true"?!0:a==="false"?!1:t},T_=(e,t)=>{od(e,t?"true":"false")},cd=(e,t)=>{const a=t==null?void 0:t.trim();return a?`${e}:${a}`:null},xf=e=>{const t=Fr(e==null?void 0:e.value)||"",a=Fr(e==null?void 0:e.label)||t;return{id:Fr(e==null?void 0:e.id)||Fr(e==null?void 0:e.value)||`custom-model-${Date.now()}`,label:a,value:t,description:Fr(e==null?void 0:e.description)||null}},nC=()=>hh().map(({id:e,...t})=>t),hh=()=>{const e=ld(E_);if(!e)return nd;try{return H3(JSON.parse(e))}catch{return nd}},sC=e=>{const t=H3(e);od(E_,JSON.stringify(t)),tC()},aC=e=>Xf.some(t=>t.value===e),R_=()=>{var a;const e=ld(D3),t=hh();return t.some(l=>l.value===e)?e:((a=t[0])==null?void 0:a.value)??B3},qm=()=>{const e=ld(O3),t=hh();if(t.some(l=>l.value===e))return e;const a=t.find(l=>l.value===lb)??t[0];return(a==null?void 0:a.value)??lb},$3=()=>{const e=ld(I3),t=hh();if(t.some(l=>l.value===e))return e;const a=t.find(l=>l.value===ob)??t[0];return(a==null?void 0:a.value)??ob},F3=()=>{const e=ld(L3);return aC(e)?e:XE},zf=e=>{od(D3,e)},jg=e=>{od(O3,e)},wg=e=>{od(I3,e)},q3=e=>{od(L3,e)},cb=e=>{const t=cd(P3,e);return t?C_(t):!1},ub=e=>{const t=cd(U3,e);return t?C_(t):!1},db=e=>{const t=cd(z3,e);return t?C_(t):!1},W3=(e,t)=>{const a=cd(P3,e);a&&T_(a,t)},K3=(e,t)=>{const a=cd(U3,e);a&&T_(a,t)},Q3=(e,t)=>{const a=cd(z3,e);a&&T_(a,t)},iC=(e,t)=>{W3(e,t.isFastModeEnabled),K3(e,t.isPlanModeEnabled),Q3(e,t.isYoloModeEnabled)},wp=(e,t=nC())=>{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)??B3)},rC=e=>{var t;return((t=Xf.find(a=>a.value===e))==null?void 0:t.label)??Xf[2].label},lC=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"}}]'),oC={themes:lC},G3="panda:theme-settings",cC=13,uC=12,Y3="codex",M_="codex",dC='-apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", sans-serif',fC='ui-monospace, "SFMono-Regular", "SF Mono", "Cascadia Mono", "Cascadia Code", Consolas, monospace',hC=/\b(?:serif|sans-serif|monospace|cursive|fantasy|system-ui|emoji|math|fangsong|ui-serif|ui-sans-serif|ui-monospace|ui-rounded)\b/i,fb=(e,t)=>{const a=e==null?void 0:e.trim();return a?hC.test(a)?a:`${a}, ${t}`:t},mC={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"},ud=(e,t,a)=>Math.min(a,Math.max(t,e)),$o=(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()}`},Pr=e=>{const t=$o(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)}},pC=(e,t,a)=>`#${[e,t,a].map(l=>ud(Math.round(l),0,255).toString(16).padStart(2,"0")).join("").toUpperCase()}`,pt=(e,t,a)=>{const l=Pr(e),o=Pr(t),u=ud(a,0,1);return pC(l.r+(o.r-l.r)*u,l.g+(o.g-l.g)*u,l.b+(o.b-l.b)*u)},gC=e=>{const{r:t,g:a,b:l}=Pr(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},_C=e=>gC(e)>.5?"#0D1117":"#FFFFFF",Or=(e,t)=>{const a=Math.round(ud(t,0,1)*100);return a>=100?e:`color-mix(in srgb, ${e} ${a}%, transparent)`},V3=oC.themes,Z3=(e,t)=>{var l,o;const a=t==="light"?e.light:e.dark;return a?{id:e.id,label:mC[e.id]??e.id,codeThemeId:a.codeThemeId,variant:t,accent:$o(a.theme.accent,"#0169CC"),background:$o(a.theme.surface,"#FFFFFF"),foreground:$o(a.theme.ink,"#0D0D0D"),contrast:ud(Number(a.theme.contrast),0,100),opaqueWindows:!!a.theme.opaqueWindows,semanticColors:{diffAdded:$o(a.theme.semanticColors.diffAdded,"#00A240"),diffRemoved:$o(a.theme.semanticColors.diffRemoved,"#E02E2A"),skill:$o(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},A0=V3.map(e=>Z3(e,"light")).filter(e=>!!e),Jf=V3.map(e=>Z3(e,"dark")).filter(e=>!!e);Jf.find(e=>e.id===M_)??Jf[0];const lc={mode:"system",lightThemeId:Y3,darkThemeId:M_,uiFontSize:cC,codeFontSize:uC},X3=e=>ud(Number(e),11,18),J3=e=>ud(Number(e),10,18),A_=()=>typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",Ap=e=>A0.find(t=>t.id===e)??A0[0],Dp=e=>Jf.find(t=>t.id===e)??Jf[0],hb=(e,t=lc,a="light")=>a==="dark"?{...t,darkThemeId:Dp(e).id}:{...t,lightThemeId:Ap(e).id},Fl=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:lc.mode,lightThemeId:Ap((e==null?void 0:e.lightThemeId)??Y3).id,darkThemeId:Dp((e==null?void 0:e.darkThemeId)??M_).id,uiFontSize:X3((e==null?void 0:e.uiFontSize)??lc.uiFontSize),codeFontSize:J3((e==null?void 0:e.codeFontSize)??lc.codeFontSize)}),ex=()=>{if(typeof window>"u")return lc;try{const e=window.localStorage.getItem(G3);return e?Fl(JSON.parse(e)):lc}catch{return lc}},Sf=e=>{if(!(typeof window>"u"))try{window.localStorage.setItem(G3,JSON.stringify(Fl(e)))}catch{}},yC=(e,t)=>e==="system"?t:e,Lr=(e,t=A_())=>{const a=Fl(e),l=yC(a.mode,t),o=Ap(a.lightThemeId),u=Dp(a.darkThemeId),f=l==="dark"?u:o;return{...a,appearance:l,lightTheme:o,darkTheme:u,activeTheme:f,uiFontFamily:fb(f.fonts.ui,dC),codeFontFamily:fb(f.fonts.code,fC)}},vC=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)}},bC=(e,t)=>{const a=Lr(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=Pr(f),S=Pr(m),p=Pr(y),b=Pr(l.accent),w=Pr(l.background),N=Pr(l.foreground),j=l.background,T=o?pt(l.background,"#FFFFFF",.05+u*.08):pt(l.background,"#FFFFFF",.42+u*.16),D=o?pt(l.background,"#FFFFFF",.07+u*.08):pt(l.background,"#FFFFFF",.78+u*.1),z=o?pt(l.background,"#FFFFFF",.1+u*.08):pt(l.background,"#FFFFFF",.56+u*.14),I=o?pt(l.background,"#FFFFFF",.14+u*.08):pt(l.background,l.foreground,.1+u*.12),k=o?pt(l.background,"#000000",.08-u*.06):pt(l.background,l.foreground,.03+u*.08),P=o?pt(l.background,"#FFFFFF",.08+u*.06):pt(l.background,l.foreground,.06+u*.08),Q=o?pt(l.background,"#FFFFFF",.14+u*.08):pt(l.background,l.foreground,.14+u*.1),se=o?pt(l.background,"#FFFFFF",.22+u*.08):pt(l.background,l.foreground,.22+u*.1),W=o?pt(l.background,"#FFFFFF",.08+u*.04):pt(l.background,l.foreground,.1+u*.08),V=l.foreground,Y=o?pt(l.foreground,l.background,.28-u*.1):pt(l.foreground,l.background,.5-u*.14),ee=o?pt(l.foreground,l.background,.46-u*.1):pt(l.foreground,l.background,.64-u*.14),me=pt(l.foreground,l.background,o?.58:.74),ge=l.accent,te=o?pt(l.accent,"#FFFFFF",.18):pt(l.accent,"#FFFFFF",.24),xe=o?pt(l.accent,l.background,.78):pt(l.accent,l.background,.88),C=o?pt(l.accent,l.background,.84):pt(l.accent,l.background,.92),q=_C(ge),ie=o?pt(l.background,"#FFFFFF",.1):pt(l.background,l.foreground,.08),he=o?pt(l.background,"#000000",.06):pt(l.background,l.foreground,.035),re=o?pt(l.background,"#FFFFFF",.05):pt(l.background,l.foreground,.06),L=o?pt(l.background,"#FFFFFF",.03):pt(l.background,l.foreground,.085),ae=o?pt(l.background,"#FFFFFF",.065):pt(l.background,l.foreground,.05),ke=pt(l.foreground,l.background,o?.42:.68),U=o?pt(l.background,"#FFFFFF",.08):pt(l.foreground,l.background,.18),ve=o?pt(l.background,"#FFFFFF",.08):pt(l.background,l.foreground,.06),Z=o?pt(l.background,"#FFFFFF",.12):pt(l.background,l.foreground,.1),Se=o?pt(l.background,"#FFFFFF",.14+u*.05):pt(l.background,l.foreground,.12+u*.08),je=l.opaqueWindows?1:o?.92:.95,Oe=l.opaqueWindows?1:o?.94:.965,Ie=l.opaqueWindows?1:.94;return{"--theme-id":l.id,"--theme-code-theme-id":l.codeThemeId,"--theme-window-opaque":l.opaqueWindows?"1":"0","--theme-accent":ge,"--theme-accent-rgb":`${b.r} ${b.g} ${b.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":D,"--color-surface-raised":z,"--color-surface-panel-strong":I,"--color-surface-sidebar":Or(k,Oe),"--color-surface-sidebar-elevated":Or(P,Oe),"--color-surface-border":Q,"--color-surface-border-strong":se,"--color-surface-border-soft":W,"--color-surface-overlay":Or(I,je),"--color-surface-floating":Or(D,je),"--color-surface-tooltip":Or(U,Ie),"--color-surface-code":he,"--color-surface-code-muted":re,"--color-surface-code-gutter":L,"--color-surface-code-meta":ae,"--color-surface-inline-code":ie,"--color-surface-hover":ve,"--color-surface-pressed":Z,"--color-surface-danger-soft":Or(m,o?.14:.08),"--color-surface-success-soft":Or(f,o?.14:.08),"--color-text-primary":V,"--color-text-secondary":Y,"--color-text-muted":ee,"--color-text-tertiary":me,"--color-text-on-accent":q,"--color-text-link":ge,"--color-text-link-hover":te,"--color-text-danger":m,"--color-text-success":f,"--color-accent-primary":ge,"--color-accent-primary-soft":xe,"--color-accent-secondary":te,"--color-accent-secondary-soft":C,"--color-accent-contrast":q,"--color-accent-primary-rgb":`${b.r} ${b.g} ${b.b}`,"--color-success":f,"--color-warning":pt(l.accent,f,.35),"--color-danger":m,"--color-status-online":ge,"--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":ge,"--color-code-string":pt(f,l.foreground,o?.26:.18),"--color-code-number":pt(y,ge,.36),"--color-code-comment":pt(l.foreground,l.background,o?.52:.72),"--color-code-meta-text":ke,"--color-code-add":f,"--color-code-add-rgb":`${g.r} ${g.g} ${g.b}`,"--color-code-add-bg":Or(f,o?.16:.11),"--color-code-remove":m,"--color-code-remove-rgb":`${S.r} ${S.g} ${S.b}`,"--color-code-remove-bg":Or(m,o?.18:.11),"--color-divider":Se,"--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`}},tx=(e,t=A_())=>{if(typeof document>"u")return;const a=Lr(e,t),l=bC(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)},xC=async()=>{if(await yp().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()},D_="panda:pwa-install-log",SC=48,Cs=e=>((e==null?void 0:e.trim())??"")||null,nx=()=>{if(typeof window>"u")return[];try{const e=window.localStorage.getItem(D_);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:Cs(l.detail)}}).filter(a=>!!a).sort((a,l)=>+new Date(l.timestamp)-+new Date(a.timestamp)):[]}catch{return[]}},jC=e=>{if(!(typeof window>"u"))try{window.localStorage.setItem(D_,JSON.stringify(e.slice(0,SC)))}catch{}},wC=()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem(D_)}catch{}},Pl=e=>{const t=nx(),a={id:`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,timestamp:new Date().toISOString(),kind:e.kind,message:e.message.trim(),detail:Cs(e.detail)};return jC([a,...t]),a},mb=(e,t)=>{var a;return((a=e.find(l=>l.kind===t))==null?void 0:a.timestamp)??null},NC=async e=>{const t=await fetch(e,{cache:"no-store"});if(!t.ok)throw new Error(`HTTP ${t.status}`);return await t.json()},kC=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"}}},EC=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=Cs(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 NC(t),l=Array.isArray(a.icons)?a.icons:[],o=await Promise.all(l.slice(0,8).map(async u=>{const f=u,m=Cs(typeof f.src=="string"?f.src:null);if(!m)return{src:"(missing)",purpose:Cs(typeof f.purpose=="string"?f.purpose:null),sizes:Cs(typeof f.sizes=="string"?f.sizes:null),type:Cs(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 kC(y);return{src:y,purpose:Cs(typeof f.purpose=="string"?f.purpose:null),sizes:Cs(typeof f.sizes=="string"?f.sizes:null),type:Cs(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:Cs(typeof a.id=="string"?a.id:null),name:Cs(typeof a.name=="string"?a.name:null),shortName:Cs(typeof a.short_name=="string"?a.short_name:null),startUrl:Cs(typeof a.start_url=="string"?a.start_url:null),scope:Cs(typeof a.scope=="string"?a.scope:null),display:Cs(typeof a.display=="string"?a.display:null),displayOverride:Array.isArray(a.display_override)?a.display_override.filter(u=>typeof u=="string"):[],themeColor:Cs(typeof a.theme_color=="string"?a.theme_color:null),backgroundColor:Cs(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:[]}}},CC=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:[]}}},TC=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:"浏览器当前没有给出可用的安装事件,页面更像普通标签页或只能走“添加到主屏幕”的快捷方式链路。"}},RC=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},MC=async e=>{const t=nx(),[a,l]=await Promise.all([EC(),CC()]),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 b=["从桌面图标打开后,确认没有浏览器地址栏或标签栏。","到 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:mb(t,"beforeinstallprompt"),lastAppInstalledAt:mb(t,"appinstalled")},manifest:a,serviceWorker:l,assessment:TC({standaloneDisplayMode:u,navigatorStandalone:f,installPromptAvailable:g,beforeInstallPromptSeen:m,appInstalledSeen:y}),failureReasons:RC({secureContext:typeof window<"u"?window.isSecureContext:!1,manifest:a,serviceWorker:l,installPromptAvailable:g,appInstalledSeen:y,launchedStandalone:S,logs:t}),successSignals:p,confirmationChecklist:b,logs:t}},AC=e=>{if(typeof window>"u")return()=>{};const t=l=>{(l.key===null||l.key===E_)&&e()},a=()=>{e()};return window.addEventListener("storage",t),window.addEventListener(M0,a),()=>{window.removeEventListener("storage",t),window.removeEventListener(M0,a)}},DC=()=>hh(),OC=()=>nd,O_=()=>_.useSyncExternalStore(AC,DC,OC);function I_(e){return ls(w3(e))}const sx=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())??""]},ax=e=>{const t=(e==null?void 0:e.enabled)??!0;return ls({queryKey:sx(e==null?void 0:e.scope),enabled:t,queryFn:async()=>(await wn(e==null?void 0:e.scope)).client.getCodexCommands(),staleTime:0,gcTime:30*6e4,refetchOnWindowFocus:!1,retry:1})},pb=e=>{let t;const a=new Set,l=(g,S)=>{const p=typeof g=="function"?g(t):g;if(!Object.is(p,t)){const b=t;t=S??(typeof p!="object"||p===null)?p:Object.assign({},t,p),a.forEach(w=>w(t,b))}},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},IC=(e=>e?pb(e):pb),LC=e=>e;function PC(e,t=LC){const a=qr.useSyncExternalStore(e.subscribe,qr.useCallback(()=>t(e.getState()),[e,t]),qr.useCallback(()=>t(e.getInitialState()),[e,t]));return qr.useDebugValue(a),a}const gb=e=>{const t=IC(e),a=l=>PC(t,l);return Object.assign(a,t),a},UC=(e=>e?gb(e):gb),_b=ex(),yb=A_(),ja=UC(e=>({panelTab:"git",composerText:"",activeSessionId:null,bottomNavVisible:!0,isSettingsOverlayOpen:!1,themeSettings:_b,systemAppearance:yb,resolvedTheme:Lr(_b,yb),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=Fl({...a.themeSettings,mode:t});return Sf(l),{themeSettings:l,resolvedTheme:Lr(l,a.systemAppearance)}}),setLightThemeId:t=>e(a=>{const l=Fl(hb(Ap(t).id,a.themeSettings,"light"));return Sf(l),{themeSettings:l,resolvedTheme:Lr(l,a.systemAppearance)}}),setDarkThemeId:t=>e(a=>{const l=Fl({...hb(Dp(t).id,a.themeSettings,"dark")});return Sf(l),{themeSettings:l,resolvedTheme:Lr(l,a.systemAppearance)}}),setUiFontSize:t=>e(a=>{const l=Fl({...a.themeSettings,uiFontSize:t});return Sf(l),{themeSettings:l,resolvedTheme:Lr(l,a.systemAppearance)}}),setCodeFontSize:t=>e(a=>{const l=Fl({...a.themeSettings,codeFontSize:t});return Sf(l),{themeSettings:l,resolvedTheme:Lr(l,a.systemAppearance)}}),setSystemAppearance:t=>e(a=>({systemAppearance:t,resolvedTheme:Lr(a.themeSettings,t)}))})),vb=980,wm=[{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"}],zC=[{id:"appearance",label:"外观与模型",sections:["theme","models","cache"]},{id:"notifications",label:"提醒与安装",sections:["notifications","installation"]},{id:"connection",label:"连接与设备",sections:["connection","dev-manager"]}],BC=[{value:"light",label:"浅色",icon:"sun"},{value:"dark",label:"深色",icon:"moon"},{value:"system",label:"系统",icon:"system"}],HC=(e,t,a,l)=>["const pandaTheme = {",` codeThemeId: "${e}",`,` accent: "${t.toLowerCase()}",`,` contrast: ${a},`,` opaqueWindows: ${l},`,"}"],$C=()=>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"})}),FC=({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"})}),qC=()=>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"})}),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:"M12 5v14M5 12h14"})}),KC=()=>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"})]}),QC=()=>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"})]}),GC=()=>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"})}),YC=()=>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"})}),bb=({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"})]}),VC=({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"})]})},ZC=({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))})]}),hu=({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})]})]}),Nm=({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})]}),xb=({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})]}),Sb=({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:"+"})]})]}),jb=(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},mu=e=>{if(!e)return"未记录";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString("zh-CN",{hour12:!1})},km=e=>typeof e!="number"||!Number.isFinite(e)?"未测得":`${Math.max(0,Math.round(e))} ms`,Ng=async(e,t)=>{const a=await u0(t);return{label:e,...a}},ix=({mode:e="page",onRequestClose:t}={})=>{var yn,Zn;const a=ki(),l=La(),o=Mp(),{data:u}=I_(),[f,m]=_.useState(!1),[y,g]=_.useState(null),[S,p]=_.useState(null),[b,w]=_.useState("theme"),[N,j]=_.useState(null),[T,D]=_.useState(()=>typeof window<"u"&&window.innerWidth>=vb),[z,I]=_.useState(()=>N0()),[k,P]=_.useState(()=>Cu()),[Q,se]=_.useState(()=>ed()),[W,V]=_.useState(()=>E0()),[Y,ee]=_.useState(!1),[me,ge]=_.useState(!1),[te,xe]=_.useState(null),[C,q]=_.useState(!1),[ie,he]=_.useState(()=>Nu()),[re,L]=_.useState(()=>X4()),[ae,ke]=_.useState(0),U=ja(A=>A.themeSettings),ve=ja(A=>A.resolvedTheme),Z=ja(A=>A.systemAppearance),Se=ja(A=>A.setThemeMode),je=ja(A=>A.setLightThemeId),Oe=ja(A=>A.setDarkThemeId),Ie=ja(A=>A.setUiFontSize),wt=ja(A=>A.setCodeFontSize),qe=O_(),[bt,Ut]=_.useState(()=>R_()),[$t,zt]=_.useState(()=>qm()),[xt,it]=_.useState(()=>$3()),[ot,ln]=_.useState(null),[on,kn]=_.useState(()=>xf()),[En,ht]=_.useState(null),[Ve,Ke]=_.useState(null),[Nt,Bt]=_.useState(null),Jt=typeof window>"u"?null:pc(),Dt=typeof window>"u"?null:mp(),Ze=(u==null?void 0:u.agents.find(A=>A.id===Jt))??(u==null?void 0:u.agents[0]),un=((yn=Ze==null?void 0:Ze.direct_base_url)==null?void 0:yn.trim().replace(/\/+$/,""))??"",ut=o.platform!=="web",_e=b==="cache"||N==="cache",Fe=Ze!=null&&Ze.id?{agentId:Ze.id}:void 0,X=sx(Fe),B=ls({queryKey:["settings-connection",o.hubUrl,(Ze==null?void 0:Ze.id)??"",un],queryFn:async()=>{const A=await wn(),[le,tt,Ht]=await Promise.all([Ng(A.label,A.baseUrl),Ng("Panda Hub",id()),un?Ng((Ze==null?void 0:Ze.name)??"当前节点",un):Promise.resolve(null)]);return{modeLabel:A.mode==="hub"?"通过 Panda Hub":"直接连接",backendLabel:A.label,backendUrl:A.baseUrl,healthOk:le.healthOk,latencyMs:le.latencyMs,checkedAt:le.checkedAt,activeProbe:le,hubProbe:tt,agentProbe:Ht}},enabled:b==="connection"||N==="connection",staleTime:0,refetchOnWindowFocus:!1}),oe=ls({queryKey:["installed-app-info",o.platform],queryFn:()=>QE(),enabled:ut,staleTime:3e4,refetchOnWindowFocus:!1}),ue=ls({queryKey:["android-release-manifest",o.hubUrl],queryFn:()=>GE(o.hubUrl),enabled:o.platform==="android"&&!!o.hubUrl&&(b==="connection"||N==="connection"),staleTime:0,refetchOnWindowFocus:!1}),we=ax({enabled:_e&&!!Fe,scope:Fe}),Re=()=>{ke(A=>A+1)},He=ls({queryKey:["pwa-install-diagnostics",ae,!!te,ie],queryFn:async()=>MC({installPromptAvailable:!!te}),enabled:b==="installation"||N==="installation",staleTime:0,refetchOnWindowFocus:!1}),ze=Vn({mutationFn:async()=>{if(!Fe)throw new Error("当前没有可用节点,无法刷新命令目录。");return(await wn(Fe)).client.refreshCodexCommands()},onMutate:()=>{g(null)},onSuccess:A=>{l.setQueryData(X,A),g(`命令目录已刷新,共 ${A.commands.length} 条,CLI 版本 ${A.cli_version??"未知"}。`)},onError:A=>{g(A instanceof Error?A.message:"刷新命令目录失败。")}});_.useEffect(()=>{if(typeof window>"u")return;const A=()=>{const le=window.innerWidth>=vb;D(le)};return A(),window.addEventListener("resize",A),()=>{window.removeEventListener("resize",A)}},[]),_.useEffect(()=>{g(null)},[(Zn=B.data)==null?void 0:Zn.backendUrl]),_.useEffect(()=>{T&&j(b)},[b,T]),_.useEffect(()=>{ht(null)},[b]),_.useEffect(()=>{if(typeof window>"u")return;const A=Ht=>{Ht.preventDefault(),xe(Ht),Pl({kind:"beforeinstallprompt",message:"浏览器提供了可调用的安装事件。",detail:window.location.href}),Re()},le=()=>{xe(null),he(!0),p("应用已安装到桌面。"),Pl({kind:"appinstalled",message:"站点收到 appinstalled 事件。",detail:"浏览器报告安装流程已经完成或被接受。"}),Re()},tt=()=>{P(Cu()),I(N0()),he(Nu()),L(X4()),Pl({kind:"visibilitychange",message:`页面切换为 ${document.visibilityState}。`,detail:`standalone=${Nu()?"yes":"no"}`}),Re()};return window.addEventListener("beforeinstallprompt",A),window.addEventListener("appinstalled",le),document.addEventListener("visibilitychange",tt),()=>{window.removeEventListener("beforeinstallprompt",A),window.removeEventListener("appinstalled",le),document.removeEventListener("visibilitychange",tt)}},[]),_.useEffect(()=>{if(qe.length===0||qe.some(le=>le.value===bt))return;const A=qe[0].value;zf(A),Ut(A)},[qe,bt]),_.useEffect(()=>{var le;if(qe.length===0||qe.some(tt=>tt.value===$t))return;const A=((le=qe.find(tt=>tt.value==="gpt-5.4-mini"))==null?void 0:le.value)??qe[0].value;jg(A),zt(A)},[$t,qe]),_.useEffect(()=>{var le;if(qe.length===0||qe.some(tt=>tt.value===xt))return;const A=((le=qe.find(tt=>tt.value==="gpt-5.4-mini"))==null?void 0:le.value)??qe[0].value;wg(A),it(A)},[qe,xt]),_.useEffect(()=>{const A=()=>{j_().then(le=>{P(le)}).catch(()=>{P(Cu())}),se(ed()),V(E0())};return A(),window.addEventListener("focus",A),document.addEventListener("visibilitychange",A),()=>{window.removeEventListener("focus",A),document.removeEventListener("visibilitychange",A)}},[]),_.useEffect(()=>{if(k!=="granted"||!z.completionNotificationsEnabled||!Q)return;let A=!1;return ee(!0),Gk(z).then(le=>{A||V(le.synced)}).catch(()=>{A||V(!1)}).finally(()=>{A||ee(!1)}),()=>{A=!0}},[Q,k,z]);const rt=()=>{if(e==="overlay"){t==null||t();return}if(Dt){Ji((Ze==null?void 0:Ze.id)??null),Js(Dt),a({to:"/"});return}a({to:"/nodes"})},It=A=>{e==="overlay"&&(t==null||t()),a({to:A})},Ft=async()=>{g(null),m(!0);try{await xC(),g("缓存已清理,正在重新载入…"),window.setTimeout(()=>{window.location.replace(`/settings?cache-reset=${Date.now()}`)},180)}catch{m(!1),g("清理失败,请在浏览器设置中手动清理站点数据。")}},Le=async()=>{if(p(null),ut){if(k==="granted"){p("当前已经拿到系统通知权限;完成提醒会自动跟随系统权限生效。");return}const A=await k0();if(P(A),A==="granted"){const le={completionNotificationsEnabled:!0};Ho(le),I(le),p("系统通知已开启,后续任务完成会直接走原生通知。");return}if(A==="denied"){p("系统通知已被拒绝,请到系统设置里重新开启。");return}p("还没有拿到通知权限,可以稍后再试一次。");return}if(k!=="granted"){const A=await k0();if(P(A),A==="granted"){if(!Q){const le={completionNotificationsEnabled:!0};Ho(le),I(le),p(ut?"系统通知已开启,任务完成时会直接走原生通知。":"系统通知已开启,但当前环境不支持后台 Web Push。");return}ee(!0);try{const le={completionNotificationsEnabled:!0};await Z4(le),Ho(le),I(le),V(!0),p("系统通知和后台 Web Push 都已开启。");return}catch(le){V(!1),p(le instanceof Error?le.message:"通知权限已开启,但 Web Push 订阅失败。");return}finally{ee(!1)}}if(A==="denied"){p("系统通知已被拒绝,请到浏览器或系统设置里重新开启。");return}p("还没有拿到通知权限,可以稍后再试一次。");return}if(z.completionNotificationsEnabled){ee(!0);try{await Yk();const A={completionNotificationsEnabled:!1};Ho(A),I(A),V(!1),p("完成提醒已关闭,后台推送订阅也已移除。")}catch(A){p(A instanceof Error?A.message:"关闭 Web Push 订阅失败。")}finally{ee(!1)}return}if(!Q){const A={completionNotificationsEnabled:!0};Ho(A),I(A),p(ut?"原生通知已开启,后续会沿用当前 App 的在线事件提醒。":"当前环境不支持后台 Web Push,只能在页面在线时提醒。");return}ee(!0);try{const A={completionNotificationsEnabled:!0};await Z4(A),Ho(A),I(A),V(!0),p("完成提醒已开启,Hub 会在会话完成后推送到这台手机。")}catch(A){V(!1),p(A instanceof Error?A.message:"开启 Web Push 失败。")}finally{ee(!1)}},Et=async()=>{p(null),ge(!0);try{if(ut){await m3({sessionId:"settings-test",completedAt:new Date().toISOString(),title:"Panda 测试提醒",body:"这是一条来自 Android 壳的本地通知测试。",url:"/settings"}),p("测试通知已发出,请看当前设备的系统通知栏。");return}await Vk(),p("测试推送已发出,请看手机或当前设备的通知栏。")}catch(A){p(A instanceof Error?A.message:"发送测试推送失败。")}finally{ge(!1)}},Cn=async()=>{if(!te){Pl({kind:"install-unavailable",message:"当前页面没有可用的安装事件。",detail:re?"浏览器没有下发 beforeinstallprompt,只能走菜单里的安装应用或添加到主屏幕。":"当前浏览器没有提供可调用的安装对话框。"}),Re(),p(re?"请在浏览器菜单里选择“安装应用”或“添加到主屏幕”。":"当前浏览器没有提供安装弹窗,请使用浏览器的“添加到主屏幕”。");return}q(!0),p(null),Pl({kind:"install-button-click",message:"用户点击了设置页里的安装按钮。",detail:"准备调用浏览器安装对话框。"}),Re();try{Pl({kind:"install-prompt-shown",message:"已调用浏览器安装对话框。",detail:"等待用户在系统安装弹窗里做出选择。"}),await te.prompt();const A=await te.userChoice;Pl({kind:"install-choice",message:A.outcome==="accepted"?"用户接受了安装请求。":"用户取消了安装请求。",detail:`outcome=${A.outcome}; platform=${A.platform}`}),Re(),A.outcome==="accepted"?p("安装请求已提交,请回到桌面查看。"):p("你取消了这次安装。")}catch(A){Pl({kind:"install-error",message:"调用浏览器安装流程时报错。",detail:A instanceof Error?A.message:"Unknown install error"}),Re(),p("浏览器没有完成安装流程,请查看下方安装诊断。")}finally{xe(null),q(!1),he(Nu()),Re()}},hs=A=>{var le,tt,Ht,cn,mt;if(sC(A),!A.some(St=>St.value===bt)){const St=((le=A[0])==null?void 0:le.value)??"";St&&(zf(St),Ut(St))}if(!A.some(St=>St.value===$t)){const St=((tt=A.find(Rn=>Rn.value==="gpt-5.4-mini"))==null?void 0:tt.value)??((Ht=A[0])==null?void 0:Ht.value)??"";St&&(jg(St),zt(St))}if(!A.some(St=>St.value===xt)){const St=((cn=A.find(Rn=>Rn.value==="gpt-5.4-mini"))==null?void 0:cn.value)??((mt=A[0])==null?void 0:mt.value)??"";St&&(wg(St),it(St))}},na=()=>{ln("new"),kn(xf()),ht(null)},Ws=A=>{ln(A.id),kn({...A}),ht(null)},Ja=()=>{ln(null),kn(xf()),ht(null)},Rs=()=>{var mt;const A=on.label.trim(),le=on.value.trim();if(!A||!le){ht("请填写显示名和模型 ID。");return}if(qe.find(St=>St.value.toLowerCase()===le.toLowerCase()&&St.id!==ot)){ht(`模型 ID ${le} 已存在。`);return}const Ht={...on,label:A,value:le,description:((mt=on.description)==null?void 0:mt.trim())||null},cn=ot==="new"?[...qe,Ht]:qe.map(St=>St.id===ot?Ht:St);hs(cn),ln(null),kn(xf()),ht(ot==="new"?"模型已添加。":"模型已更新。")},Na=A=>{const le=qe.filter(tt=>tt.id!==A);if(le.length===0){ht("至少保留一个模型。");return}hs(le),ot===A&&(ln(null),kn(xf())),ht("模型已删除。")},Pa=A=>{zf(A),Ut(A),ht(`默认模型已切换为 ${A}。`)},ms=A=>{jg(A),zt(A),ht(`命令执行模型已切换为 ${A}。`)},dn=A=>{wg(A),it(A),ht(`标题生成模型已切换为 ${A}。`)},pn=(A,le)=>{const tt=qe.findIndex(mt=>mt.id===A);if(tt<0)return;const Ht=le==="up"?tt-1:tt+1;if(Ht<0||Ht>=qe.length)return;const cn=qe[Ht];cn&&hs(jb(qe,A,cn.id,le==="up"?"before":"after"))},Un=(A,le)=>{Ke(le),Bt(null),A.dataTransfer.effectAllowed="move",A.dataTransfer.setData("text/plain",le)},ps=(A,le)=>{if(!Ve||Ve===le)return;A.preventDefault();const tt=A.currentTarget.getBoundingClientRect(),Ht=A.clientY<tt.top+tt.height/2?"before":"after";Bt(cn=>(cn==null?void 0:cn.modelId)===le&&cn.position===Ht?cn:{modelId:le,position:Ht})},Ps=A=>{!Ve||!Nt||Nt.modelId!==A||(hs(jb(qe,Ve,A,Nt.position)),Ke(null),Bt(null))},Us=()=>{Ke(null),Bt(null)},Ms=ve.appearance,xs=Ms==="light"?A0:Jf,As=Ms==="light"?U.lightThemeId:U.darkThemeId,Rt=xs.find(A=>A.id===As)??xs[0],J=ve.activeTheme,M=HC(Rt.codeThemeId,Rt.accent,Rt.contrast,Rt.opaqueWindows),G=U.mode==="system"?`当前跟随系统:${Z==="dark"?"深色":"浅色"}`:`当前固定为${ve.appearance==="dark"?"深色":"浅色"}模式`,Ee="当前正在显示",De=Rt.opaqueWindows?"不透明窗口":"半透明窗口",Pe=wm.find(A=>A.id===b)??wm[0],$e={"--settings-mobile-sticky-safe-area":ut?"0px":"var(--app-safe-area-top)"},Je=`${Rt.label} · ${De} · 对比度 ${Rt.contrast}`,Ye=qe.find(A=>A.value===bt)??qe[0]??null,en=qe.find(A=>A.value===$t)??qe.find(A=>A.value==="gpt-5.4-mini")??qe[0]??null,jt=qe.find(A=>A.value===xt)??qe.find(A=>A.value==="gpt-5.4-mini")??qe[0]??null,$n=A=>{var le;return A==="theme"?ve.activeTheme.label:A==="models"?(Ye==null?void 0:Ye.label)??`${qe.length} 个模型`:A==="cache"?y||(we.data?`${we.data.commands.length} 条命令`:"站点与命令目录"):A==="notifications"?z.completionNotificationsEnabled?"已开启":"未开启":A==="installation"?ie?"已安装":"检查状态":(le=B.data)!=null&&le.healthOk?B.data.modeLabel:(Ze==null?void 0:Ze.name)??"查看链路"},gn=()=>i.jsx("div",{className:"settings-mobile-layout",children:i.jsx("div",{className:"settings-mobile-sections",role:"list","aria-label":"设置分组",children:zC.map(A=>i.jsx("section",{className:"settings-mobile-group","aria-label":A.label,children:A.sections.map(le=>{const tt=wm.find(mt=>mt.id===le);if(!tt)return null;const Ht=N===tt.id,cn=$n(tt.id);return i.jsxs(_.Fragment,{children:[i.jsxs("button",{type:"button",className:`settings-mobile-row ${Ht?"is-active":""}`,"data-section":tt.id,onClick:()=>{w(tt.id),j(mt=>mt===tt.id?null:tt.id)},"aria-expanded":Ht,"aria-controls":`settings-mobile-detail-${tt.id}`,children:[i.jsx("span",{className:"settings-mobile-row__icon","data-section":tt.id,"aria-hidden":"true",children:i.jsx(bb,{icon:tt.icon})}),i.jsx("span",{className:"settings-mobile-row__copy",children:i.jsx("span",{className:"settings-mobile-row__title",children:tt.title})}),i.jsx("span",{className:"settings-mobile-row__summary",children:cn}),i.jsx("span",{className:"settings-mobile-row__chevron","aria-hidden":"true",children:i.jsx(FC,{open:!1})})]}),Ht?i.jsx("section",{className:"settings-mobile-detail settings-mobile-detail--inline",id:`settings-mobile-detail-${tt.id}`,children:qt(tt.id)}):null]},tt.id)})},A.id))})}),bn=()=>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:BC.map(A=>{const le=A.value===U.mode;return i.jsxs("button",{type:"button",className:`theme-mode-switch__button ${le?"is-active":""}`,onClick:()=>Se(A.value),role:"tab","aria-selected":le,children:[i.jsx(VC,{icon:A.icon,active:le}),i.jsx("span",{children:A.label})]},A.value)})}),i.jsx("p",{className:"settings-control-block__hint",children:G})]})})]}),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:Ms==="light"?"浅色风格":"深色风格"})})}),i.jsxs("div",{className:"settings-theme-selector",children:[i.jsx("label",{className:"settings-select settings-select--wide",children:i.jsx("select",{value:Rt.id,onChange:A=>{if(Ms==="light"){je(A.target.value);return}Oe(A.target.value)},"aria-label":Ms==="light"?"选择浅色主题":"选择深色主题",children:xs.map(A=>i.jsx("option",{value:A.id,children:A.label},`${A.variant}-${A.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":Rt.background}}),i.jsx("span",{style:{"--theme-card-color":Rt.foreground}}),i.jsx("span",{style:{"--theme-card-color":Rt.accent}}),i.jsx("span",{style:{"--theme-card-color":Rt.semanticColors.diffAdded}}),i.jsx("span",{style:{"--theme-card-color":Rt.semanticColors.diffRemoved}})]}),i.jsxs("div",{className:"settings-theme-selector__copy",children:[i.jsx("strong",{children:Rt.label}),i.jsx("span",{children:Je})]}),Rt.id===J.id&&Rt.variant===ve.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:Ee})]}),i.jsx(ZC,{title:Ms==="light"?"浅色预览":"深色预览",caption:Rt.label,accent:Rt.accent,background:Rt.background,foreground:Rt.foreground,lines:M}),i.jsxs("div",{className:"settings-list",children:[i.jsx(Nm,{label:"代码风格",value:Rt.codeThemeId}),i.jsx(Nm,{label:"当前模式",value:Rt.variant}),i.jsx(Nm,{label:"对比度",value:String(Rt.contrast)}),i.jsx(Nm,{label:"面板质感",value:De}),i.jsx(hu,{label:"强调色",value:Rt.accent}),i.jsx(hu,{label:"背景色",value:Rt.background}),i.jsx(hu,{label:"文字色",value:Rt.foreground}),i.jsx(hu,{label:"新增颜色",value:Rt.semanticColors.diffAdded}),i.jsx(hu,{label:"删除颜色",value:Rt.semanticColors.diffRemoved}),i.jsx(hu,{label:"特殊强调",value:Rt.semanticColors.skill}),i.jsx(xb,{label:"界面字体",value:Rt.fonts.ui??"null"}),i.jsx(xb,{label:"代码字体",value:Rt.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(Sb,{label:"界面字号",value:U.uiFontSize,onChange:A=>Ie(X3(A)),min:11,max:18}),i.jsx(Sb,{label:"代码字号",value:U.codeFontSize,onChange:A=>wt(J3(A)),min:10,max:18})]})]})]}),Tn=()=>{var A;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:na,children:[i.jsx(WC,{}),"新增模型"]})]}),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:((A=qe[0])==null?void 0:A.label)??"未配置"})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"当前默认"}),i.jsx("strong",{children:(Ye==null?void 0:Ye.label)??"未配置"})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"命令执行模型"}),i.jsx("strong",{children:(en==null?void 0:en.label)??"未配置"})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"标题生成模型"}),i.jsx("strong",{children:(jt==null?void 0:jt.label)??"未配置"})]})]})]}),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:bt,onChange:le=>Pa(le.target.value),children:qe.map(le=>i.jsx("option",{value:le.value,children:le.label},le.id))})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"命令执行模型"}),i.jsx("select",{value:$t,onChange:le=>ms(le.target.value),children:qe.map(le=>i.jsx("option",{value:le.value,children:le.label},le.id))})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"标题生成模型"}),i.jsx("select",{value:xt,onChange:le=>dn(le.target.value),children:qe.map(le=>i.jsx("option",{value:le.value,children:le.label},le.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:"维护模型"})})}),En?i.jsx("div",{className:"settings-inline-status",role:"alert",children:En}):null,i.jsx("div",{className:"settings-model-list",role:"list","aria-label":"模型列表",children:qe.map((le,tt)=>{const Ht=Ve===le.id,cn=(Nt==null?void 0:Nt.modelId)===le.id&&Nt.position==="before",mt=(Nt==null?void 0:Nt.modelId)===le.id&&Nt.position==="after",St=le.value===bt;return i.jsxs("article",{className:`settings-model-card ${Ht?"is-dragging":""} ${cn?"is-drop-before":""} ${mt?"is-drop-after":""}`,draggable:!0,onDragStart:Rn=>Un(Rn,le.id),onDragOver:Rn=>ps(Rn,le.id),onDrop:Rn=>{Rn.preventDefault(),Ps(le.id)},onDragEnd:Us,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(qC,{})}),i.jsxs("div",{className:"settings-model-card__copy",children:[i.jsxs("div",{className:"settings-model-card__title-row",children:[i.jsx("strong",{children:le.label}),St?i.jsx("span",{className:"settings-model-card__badge",children:"默认"}):null]}),i.jsx("code",{className:"settings-model-card__value",children:le.value})]})]}),i.jsxs("div",{className:"settings-model-card__actions",children:[i.jsx("button",{type:"button",className:`settings-mini-button settings-model-card__primary-action ${St?"is-active":""}`,onClick:()=>Pa(le.value),children:"设为默认"}),i.jsxs("div",{className:"settings-model-card__icon-actions",children:[i.jsx("button",{type:"button",className:"settings-icon-button",onClick:()=>pn(le.id,"up"),disabled:tt===0,"aria-label":`上移 ${le.label}`,children:i.jsx(GC,{})}),i.jsx("button",{type:"button",className:"settings-icon-button",onClick:()=>pn(le.id,"down"),disabled:tt===qe.length-1,"aria-label":`下移 ${le.label}`,children:i.jsx(YC,{})}),i.jsx("button",{type:"button",className:"settings-icon-button",onClick:()=>Ws(le),"aria-label":`编辑 ${le.label}`,children:i.jsx(KC,{})}),i.jsx("button",{type:"button",className:"settings-icon-button is-danger",onClick:()=>Na(le.id),disabled:qe.length<=1,"aria-label":`删除 ${le.label}`,children:i.jsx(QC,{})})]})]})]},le.id)})}),ot?i.jsxs("div",{className:"settings-model-editor",children:[i.jsx("div",{className:"settings-model-editor__header",children:i.jsx("strong",{children:ot==="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:on.label,onChange:le=>kn(tt=>({...tt,label:le.target.value})),placeholder:"例如:gpt-5.4"})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"模型 ID"}),i.jsx("input",{type:"text",value:on.value,onChange:le=>kn(tt=>({...tt,value:le.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:Ja,children:"取消"}),i.jsx("button",{type:"button",className:"settings-inline-action",onClick:Rs,children:"保存"})]})]}):null]})]})},xn=()=>{var A,le;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 Ft(),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:()=>It("/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:((A=we.data)==null?void 0:A.cli_version)??"检测中…"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"最近刷新"}),i.jsx("span",{children:((le=we.data)==null?void 0:le.loaded_at)??"尚未生成"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"命令数量"}),i.jsx("span",{children:we.data?`${we.data.commands.length} 条`:"检测中…"})]}),i.jsxs("button",{type:"button",className:"settings-action",onClick:()=>void ze.mutateAsync(),disabled:ze.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:ze.isPending?"刷新中…":"→"})]})]})]})},zn=()=>{var mt,St,Rn,Ks,ei,zs,Qs,ka,ti,nr,ni,Gs,si,ai,sa,aa,ii,sr,ri,Ds,Bs,ar;const A=oe.data,le=ue.data,tt=!!(le!=null&&le.apk_url),Ht=VE(A,le),cn=A3(o.hubUrl);return i.jsxs("div",{className:"settings-content-stack",children:[ut?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:ut?"重新设置 Hub":"当前访问方式"})})}),ut?i.jsx(d6,{title:"输入新的 Hub 地址",description:"扫码或手动输入后,保存即可让 APK 用新地址重新建立连接。",currentHubUrl:o.hubUrl,initialHubUrl:o.hubUrl,hint:"保存后会清理旧的查询缓存、会话定位和连接判定缓存,避免继续误连到旧 Hub。",saveLabel:"保存并重连",savingLabel:"正在保存地址",saveDescription:"新的 Hub 地址会持久化到本机,后续重新打开 APK 会继续沿用。",saveSuccessMessage:"Hub 地址已保存,连接缓存和旧会话定位已重置。",onSaveSuccess:async ia=>{await q6({hubUrl:ia.url,onboardingCompleted:!0}),await v3(l),B.refetch(),ue.refetch(),oe.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:()=>{oe.refetch(),ue.refetch()},children:"刷新版本"})})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前版本"}),i.jsx("span",{children:(A==null?void 0:A.version)??"检测中…"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前 build"}),i.jsx("span",{children:(A==null?void 0:A.build)??"检测中…"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"应用包名"}),i.jsx("span",{children:(A==null?void 0:A.appId)??"检测中…"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"更新清单"}),i.jsx("span",{children:cn||"等待 Hub 地址"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"最新发布"}),i.jsx("span",{children:ue.isLoading?"检测中…":le?`${le.version_name} (${le.version_code})`:ue.error instanceof Error?ue.error.message:"未检测到"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"升级状态"}),i.jsx("span",{className:Ht?"is-ok":"is-muted",children:Ht?"发现新版本":tt?"当前已是最新":"等待发布 APK"})]}),le!=null&&le.published_at?i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"发布时间"}),i.jsx("span",{children:mu(le.published_at)})]}):null,i.jsxs("button",{type:"button",className:"settings-action",onClick:()=>{le!=null&&le.apk_url&&ZE(le.apk_url)},disabled:!(le!=null&&le.apk_url),children:[i.jsxs("div",{className:"settings-action__copy",children:[i.jsx("strong",{children:Ht?"下载并覆盖安装新版 APK":"打开最新 APK 下载地址"}),i.jsx("span",{children:"通过同一个 `applicationId` 和固定签名覆盖安装,旧配置和本地数据会保留,不需要卸载重装。"})]}),i.jsx("span",{className:"settings-action__state",children:le!=null&&le.apk_url?"→":"未就绪"})]}),le!=null&&le.release_notes.length?i.jsx("div",{className:"settings-diagnostic-list",children:le.release_notes.map(ia=>i.jsxs("div",{className:"settings-diagnostic-list__item",children:[i.jsx("strong",{children:"发布说明"}),i.jsx("span",{children:ia})]},ia))}):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:(Ze==null?void 0:Ze.name)??"未选择节点"})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"连接方式"}),i.jsx("strong",{children:((mt=B.data)==null?void 0:mt.modeLabel)??"检测中…"})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"当前链路延迟"}),i.jsx("strong",{className:(St=B.data)!=null&&St.healthOk?"is-ok":"is-muted",children:B.isLoading?"检测中…":km((Rn=B.data)==null?void 0:Rn.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:()=>{B.refetch()},children:"刷新延迟"})})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"服务名称"}),i.jsx("span",{children:((Ks=B.data)==null?void 0:Ks.backendLabel)??"检测中…"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"服务地址"}),i.jsx("span",{children:((ei=B.data)==null?void 0:ei.backendUrl)??"检测中…"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前状态"}),i.jsx("span",{className:(zs=B.data)!=null&&zs.healthOk?"is-ok":"is-muted",children:B.isLoading?"检测中…":(Qs=B.data)!=null&&Qs.healthOk?"在线":((ka=B.data)==null?void 0:ka.activeProbe.error)??"无法连接"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前延迟"}),i.jsx("span",{children:km((ti=B.data)==null?void 0:ti.latencyMs)})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"最近探测"}),i.jsx("span",{children:mu((nr=B.data)==null?void 0:nr.checkedAt)})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"设备标识"}),i.jsx("span",{children:(Ze==null?void 0:Ze.id)??"未选择节点"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"最近会话"}),i.jsx("span",{children:Dt??"未选择会话"})]})]}),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:km((ni=B.data)==null?void 0:ni.hubProbe.latencyMs)})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"Hub 状态"}),i.jsx("span",{className:(Gs=B.data)!=null&&Gs.hubProbe.healthOk?"is-ok":"is-muted",children:(si=B.data)!=null&&si.hubProbe.healthOk?"在线":((ai=B.data)==null?void 0:ai.hubProbe.error)??"无法连接"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"Hub 地址"}),i.jsx("span",{children:((sa=B.data)==null?void 0:sa.hubProbe.url)??"检测中…"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前 Agent 延迟"}),i.jsx("span",{children:km((ii=(aa=B.data)==null?void 0:aa.agentProbe)==null?void 0:ii.latencyMs)})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前 Agent 状态"}),i.jsx("span",{className:(ri=(sr=B.data)==null?void 0:sr.agentProbe)!=null&&ri.healthOk?"is-ok":"is-muted",children:(Ds=B.data)!=null&&Ds.agentProbe?B.data.agentProbe.healthOk?"在线":B.data.agentProbe.error??"无法连接":"未选择节点"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前 Agent 地址"}),i.jsx("span",{children:((ar=(Bs=B.data)==null?void 0:Bs.agentProbe)==null?void 0:ar.url)||un||"未配置"})]})]})]})},Ss=()=>{const A=ut?"原生 APK":ie?"已安装":"未安装",le=k==="granted"?"已允许":k==="denied"?"已拒绝":k==="default"?"待授权":"不支持",tt=ut?k==="granted"?"原生通知":"等待授权":Q?Y?"同步中":W?"已连接":z.completionNotificationsEnabled&&k==="granted"?"待连接":"未连接":"不支持",Ht=ut?k==="granted"?"已开启":"待授权":k==="granted"&&z.completionNotificationsEnabled?W?"后台可达":Q?"前台兜底":"仅前台":"未开启",cn=ut?"原生系统通知":Q?W?"Hub Web Push + 系统通知":"系统通知,后台通道待建立":"系统通知(仅页面在线)",mt=ut?k==="granted"?"通常可见,细节取决于系统设置":"先授予通知权限":W?ie?"已具备条件":"大多可见,安装后更稳":Q?"先建立后台通道":"当前环境很难稳定锁屏提醒",St=k==="unsupported"||!ut&&Y,Rn=ut?k==="granted"?"系统通知已开启":"申请通知权限":k==="granted"&&z.completionNotificationsEnabled?"关闭完成提醒":Y?"正在建立后台提醒":"开启完成提醒",Ks=k==="unsupported"?"当前环境不支持系统通知,需要 HTTPS、Service Worker 和受支持浏览器。":ut?k==="granted"?"首次连接时也会自动申请;这里主要用于补检查权限状态。":"如果首次连接时错过了授权,这里可以补申请一次。":Q?"开启后会向 Hub 注册这台设备,后台或锁屏时也能收到完成提醒。":"当前环境只能在页面在线时提醒,建议安装到桌面并使用支持 Web Push 的浏览器。",ei=ut?k==="unsupported"?"不可用":k==="granted"?"已开启":"→":k==="unsupported"?"不可用":Y?"同步中…":k==="granted"&&z.completionNotificationsEnabled?W?"已连接":Q?"待连接":"已开启":"→",zs=ut?k==="granted":k==="granted"&&z.completionNotificationsEnabled&&W&&!Y,Qs=ut?"直接在当前 APK 里发一条本地测试通知,确认系统权限和展示链路正常。":W?"立刻让 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:A})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"系统通知权限"}),i.jsx("strong",{children:le})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"完成提醒"}),i.jsx("strong",{children:Ht})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"后台 Web Push"}),i.jsx("strong",{children:tt})]})]})]}),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:ut?"当前交付形态":"安装到桌面"})})}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"推荐平台"}),i.jsx("span",{children:ut?"当前已经是 Android APK":re?"Android 当前设备":"Android 效果最佳"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前形态"}),i.jsx("span",{children:ut?"本地前端壳 + 局域网后端":ie?"已是桌面应用":"浏览器标签页"})]}),i.jsxs("button",{type:"button",className:"settings-action",onClick:()=>void Cn(),disabled:ut||ie||C,children:[i.jsxs("div",{className:"settings-action__copy",children:[i.jsx("strong",{children:ut?"已经是可安装 APK":ie?"已经安装":"安装到桌面"}),i.jsx("span",{children:ut?"当前无需再走 PWA 安装链路,后续升级直接下载新版 APK 覆盖安装即可。":ie?"现在可以直接从桌面图标进入 Panda。":"安装后更像应用,系统通知和锁屏提醒也更稳定。"})]}),i.jsx("span",{className:"settings-action__state",children:ut||ie?"✓":C?"处理中…":"→"})]})]}),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:cn})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"锁屏可见"}),i.jsx("span",{children:mt})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"后台通道"}),i.jsx("span",{children:tt})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"触发时机"}),i.jsx("span",{children:ut?"App 在线时收到完成事件后,直接发原生系统通知":Q?"Hub 收到对话完成后主动推送":"页面在线时收到完成事件后提醒"})]}),i.jsxs("button",{type:"button",className:"settings-action",onClick:()=>void Le(),disabled:St,children:[i.jsxs("div",{className:"settings-action__copy",children:[i.jsx("strong",{children:Rn}),i.jsx("span",{children:Ks})]}),i.jsx("span",{className:"settings-action__state",children:ei})]}),i.jsxs("button",{type:"button",className:"settings-action",onClick:()=>void Et(),disabled:!zs||me,children:[i.jsxs("div",{className:"settings-action__copy",children:[i.jsx("strong",{children:ut?me?"正在发送测试通知":"发送测试通知":me?"正在发送测试推送":"发送测试推送"}),i.jsx("span",{children:Qs})]}),i.jsx("span",{className:"settings-action__state",children:me?"发送中…":zs?"→":"未就绪"})]}),S?i.jsx("p",{className:"settings-block__status",children:S}):null]})]})},_n=()=>{const A=He.data,le=A!=null&&A.promptState.installPromptAvailable?"可主动触发":A!=null&&A.promptState.beforeInstallPromptSeen?"本地曾出现":"未出现",tt=A!=null&&A.promptState.appInstalledSeen?"记录到过":"未记录到",Ht=A!=null&&A.manifest.ok?"正常":A!=null&&A.manifest.present?"读取失败":"缺失",cn=A!=null&&A.serviceWorker.registrations.length?`${A.serviceWorker.registrations.length} 个注册`:A!=null&&A.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:(A==null?void 0:A.assessment.label)??"检测中…"})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"安装事件"}),i.jsx("strong",{children:le})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"appinstalled"}),i.jsx("strong",{children:tt})]})]})]}),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:()=>{He.refetch()},children:"刷新诊断"}),i.jsx("button",{type:"button",className:"settings-ghost-button",onClick:()=>{wC(),Re()},children:"清空日志"})]})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前窗口形态"}),i.jsx("span",{children:A?A.environment.standaloneDisplayMode||A.environment.navigatorStandalone?"独立窗口 / 主屏幕入口":"浏览器标签页":"检测中…"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"系统级安装研判"}),i.jsx("span",{children:(A==null?void 0:A.assessment.label)??"检测中…"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"研判置信度"}),i.jsx("span",{children:(A==null?void 0:A.assessment.confidence)??"检测中…"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前说明"}),i.jsx("span",{children:(A==null?void 0:A.assessment.detail)??"正在分析…"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"最近抓取时间"}),i.jsx("span",{children:mu(A==null?void 0:A.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:A!=null&&A.environment.secureContext?"是":"否"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"manifest"}),i.jsx("span",{children:Ht})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"manifest display"}),i.jsx("span",{children:(A==null?void 0:A.manifest.display)??"未声明"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"Service Worker"}),i.jsx("span",{children:cn})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前可主动触发安装"}),i.jsx("span",{children:A!=null&&A.promptState.installPromptAvailable?"可以":"不可以"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"最近 beforeinstallprompt"}),i.jsx("span",{children:mu(A==null?void 0:A.promptState.lastBeforeInstallPromptAt)})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"最近 appinstalled"}),i.jsx("span",{children:mu(A==null?void 0:A.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:"为什么当前可能安装失败"})})}),He.isLoading?i.jsx("p",{className:"settings-block__status",children:"正在收集安装诊断…"}):A!=null&&A.failureReasons.length?i.jsx("div",{className:"settings-diagnostic-list",children:A.failureReasons.map((mt,St)=>i.jsxs("div",{className:"settings-diagnostic-list__item",children:[i.jsxs("strong",{children:["原因 ",St+1]}),i.jsx("span",{children:mt})]},`${St}-${mt}`))}):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:"成功信号与人工确认"})})}),A!=null&&A.successSignals.length?i.jsx("div",{className:"settings-diagnostic-list",children:A.successSignals.map((mt,St)=>i.jsxs("div",{className:"settings-diagnostic-list__item",children:[i.jsxs("strong",{children:["信号 ",St+1]}),i.jsx("span",{children:mt})]},`${St}-${mt}`))}):null,i.jsx("div",{className:"settings-diagnostic-list",children:(A==null?void 0:A.confirmationChecklist.map((mt,St)=>i.jsxs("div",{className:"settings-diagnostic-list__item",children:[i.jsxs("strong",{children:["确认 ",St+1]}),i.jsx("span",{children:mt})]},`${St}-${mt}`)))??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:"浏览器安装事件日志"})})}),He.isLoading?i.jsx("p",{className:"settings-block__status",children:"正在读取日志…"}):A!=null&&A.logs.length?i.jsx("div",{className:"settings-log-list",children:A.logs.map(mt=>i.jsxs("article",{className:"settings-log-item",children:[i.jsxs("div",{className:"settings-log-item__meta",children:[i.jsx("strong",{children:mt.message}),i.jsx("span",{children:mu(mt.timestamp)})]}),i.jsx("div",{className:"settings-log-item__kind",children:mt.kind}),mt.detail?i.jsx("pre",{className:"settings-log-item__detail",children:mt.detail}):null]},mt.id))}):i.jsx("p",{className:"settings-block__status",children:"还没有本地安装日志。后续在这个页面触发安装、刷新页面、出现 beforeinstallprompt 或 appinstalled 后,这里会自动积累证据。"})]})]})},qt=A=>A==="models"?Tn():A==="cache"?xn():A==="notifications"?Ss():A==="installation"?_n():A==="connection"?zn():A==="dev-manager"?i.jsx(qE,{isActive:b==="dev-manager"||N==="dev-manager",agentId:(Ze==null?void 0:Ze.id)??null}):bn();return i.jsx("div",{className:"conversation-page settings-screen settings-screen--workspace",style:$e,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:rt,"aria-label":"返回会话",children:i.jsx($C,{})}),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:wm.map(A=>{const le=A.id===b;return i.jsxs("button",{type:"button",className:`settings-sidebar__item ${le?"is-active":""}`,onClick:()=>w(A.id),children:[i.jsx(bb,{icon:A.icon}),i.jsx("span",{children:A.title})]},A.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:Pe.title}),i.jsx("p",{className:"settings-stage__description",children:Pe.description})]})}),qt(b)]})]}):gn()]})})})})},XC=({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(ix,{mode:"overlay",onRequestClose:e})})},JC=()=>{const e=ki();Mp();const t=ja(p=>p.themeSettings),a=ja(p=>p.systemAppearance),l=ja(p=>p.setSystemAppearance),o=ja(p=>p.isSettingsOverlayOpen),u=ja(p=>p.closeSettingsOverlay),f=Ia({select:p=>p.location.pathname}),m=_.useRef(null),y=pc(),g=ch(y),S=!!(y&&g);return _.useEffect(()=>{tx(t,a)},[a,t]),_.useEffect(()=>vC(l),[l]),_.useEffect(()=>{j_().catch(()=>{})},[]),_.useEffect(()=>{let p;return Jk(b=>{e({to:b}).catch(()=>{typeof window<"u"&&window.location.assign(b)})}).then(b=>{p=b}),()=>{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]),Tk()?i.jsx(oE,{}):i.jsxs("div",{className:"app-shell",children:[S?null:i.jsx(mE,{}),i.jsx(AE,{}),i.jsx("div",{className:"app-shell__content","aria-hidden":o,children:i.jsx(l6,{})}),o?i.jsx(XC,{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 rx=(...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 eT=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 tT=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 wb=e=>{const t=tT(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 nT={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 sT=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 aT=_.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:a=2,absoluteStrokeWidth:l,className:o="",children:u,iconNode:f,...m},y)=>_.createElement("svg",{ref:y,...nT,width:t,height:t,stroke:e,strokeWidth:l?Number(a)*24/Number(t):a,className:rx("lucide",o),...!u&&!sT(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 mh=(e,t)=>{const a=_.forwardRef(({className:l,...o},u)=>_.createElement(aT,{ref:u,iconNode:t,className:rx(`lucide-${eT(wb(e))}`,`lucide-${e}`,l),...o}));return a.displayName=wb(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 iT=[["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"}]],rT=mh("pencil-line",iT);/**
|
|
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 lT=[["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"}]],oT=mh("pin",lT);/**
|
|
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 cT=[["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"}]],uT=mh("rotate-cw",cT);/**
|
|
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 dT=[["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"}]],lx=mh("trash-2",dT);/**
|
|
129
|
+
* @license lucide-react v0.577.0 - ISC
|
|
130
|
+
*
|
|
131
|
+
* This source code is licensed under the ISC license.
|
|
132
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
133
|
+
*/const fT=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],hT=mh("undo-2",fT),kg=({message:e})=>i.jsx("p",{className:"empty-copy",children:e}),mT=async e=>(await wn()).client.updateAgent({agentId:e.agentId,action:e.action,displayName:e.displayName??null}),pT=(e,t,a)=>e&&{...e,agents:e.agents.map(l=>l.id===t?{...l,...a}:l)},gT=(e,t)=>e&&{...e,agents:e.agents.filter(a=>a.id!==t)},_T=()=>{var C,q;const e=ki(),t=La(),{data:a,isPending:l,isFetching:o,error:u}=I_(),[f,m]=_.useState(!1),[y,g]=_.useState(null),[S,p]=_.useState(""),[b,w]=_.useState(null),[N,j]=_.useState(null),[T,D]=_.useState(null),[z,I]=_.useState(null),[k,P]=_.useState(!1),Q=a??T,se=(Q==null?void 0:Q.agents)??[];_.useEffect(()=>{let ie=!1;return wn().then(he=>{ie||m(he.mode==="hub")}).catch(()=>{ie||m(!1)}),()=>{ie=!0}},[]),_.useEffect(()=>{a&&(D(a),I(null))},[a]),_.useEffect(()=>{if(a||k)return;let ie=!1;const he=window.setTimeout(()=>{ie||(P(!0),I(null),t.removeQueries({queryKey:Gi}),k3(t).then(re=>{ie||D(re)}).catch(re=>{ie||I(re instanceof Error?re.message:"节点列表刷新失败")}).finally(()=>{ie||P(!1)}))},1200);return()=>{ie=!0,window.clearTimeout(he)}},[t,a,k]);const W=_.useMemo(()=>se.find(ie=>ie.id===y)??null,[se,y]),V=_.useMemo(()=>se.find(ie=>ie.id===b)??null,[se,b]),Y=Vn({mutationFn:mT,onMutate:async ie=>{j(null),await t.cancelQueries({queryKey:Gi});const he=t.getQueryData(Gi);return ie.action==="rename"&&t.setQueryData(Gi,re=>{var L;return pT(re,ie.agentId,{display_name:((L=ie.displayName)==null?void 0:L.trim())||null})}),ie.action==="delete"&&t.setQueryData(Gi,re=>gT(re,ie.agentId)),{previousSnapshot:he}},onSuccess:(ie,he)=>{he.action==="rename"&&(g(null),p("")),he.action==="delete"&&w(null)},onError:(ie,he,re)=>{re!=null&&re.previousSnapshot&&t.setQueryData(Gi,re.previousSnapshot),j(ie instanceof Error?ie.message:"节点操作失败")},onSettled:async()=>{await t.invalidateQueries({queryKey:Gi})}}),ee=Y.isPending?((C=Y.variables)==null?void 0:C.action)??null:null,me=Y.isPending?((q=Y.variables)==null?void 0:q.agentId)??null:null,ge=ie=>{Ji(ie.id),Js(null),Kr(null),ku(null),Cf(!1),mk({agentId:ie.id,name:ie.name,displayName:ie.display_name??null,directBaseUrl:ie.direct_base_url,wsBaseUrl:ie.ws_base_url,createdAt:new Date().toISOString()}),e({to:"/"})},te=W&&typeof document<"u"?Ya.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:W.name}),i.jsx("span",{children:vg(W)})]}),i.jsx("input",{className:"sheet-panel__input",value:S,onChange:ie=>p(ie.target.value),placeholder:W.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:ee==="rename"&&me===W.id,onClick:()=>{Y.mutate({agentId:W.id,action:"rename",displayName:S.trim()||null})},children:ee==="rename"&&me===W.id?"保存中...":"保存"})]})]})})]}),document.body):null,xe=V&&typeof document<"u"?Ya.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:dc(V)}),i.jsx("span",{children:vg(V)})]}),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:ee==="delete"&&me===V.id,onClick:()=>{Y.mutate({agentId:V.id,action:"delete"})},children:ee==="delete"&&me===V.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:!Q&&(l||o||k)?i.jsx(kg,{message:"正在读取节点列表..."}):!Q&&(u||z)?i.jsx(kg,{message:u instanceof Error?u.message:z??"节点列表加载失败"}):se.length===0?i.jsx(kg,{message:"暂无节点"}):se.map(ie=>{const he=ik(ie),re=dc(ie),L=ee==="rename"&&me===ie.id,ae=ee==="delete"&&me===ie.id;return i.jsxs("article",{className:`node-card ${f?"node-card--manageable":""}`,children:[i.jsxs("button",{type:"button",className:"node-card__surface",onClick:()=>ge(ie),children:[i.jsxs("div",{className:"node-card__title-stack",children:[i.jsx("strong",{children:re}),he?i.jsxs("span",{className:"node-card__secondary-name",children:["原名称 · ",he]}):null]}),i.jsx("div",{className:"node-card__ip",children:vg(ie)})]}),i.jsxs("div",{className:"node-card__rail",children:[i.jsx("span",{className:`node-status-dot ${ie.status}`,"aria-label":ie.status==="online"?"节点在线":"节点离线",title:ie.status==="online"?"节点在线":"节点离线"}),f?i.jsxs("div",{className:"node-card__actions",children:[i.jsx("button",{type:"button",className:"node-card__icon-button","aria-label":`修改 ${re} 的备注名称`,title:"修改备注名称",disabled:ae,onClick:()=>{w(null),j(null),g(ie.id),p(ie.display_name??"")},children:i.jsx(rT,{size:16,strokeWidth:2})}),i.jsx("button",{type:"button",className:"node-card__icon-button is-danger","aria-label":`删除 ${re} 节点注册`,title:"删除注册节点",disabled:L,onClick:()=>{g(null),p(""),j(null),w(ie.id)},children:i.jsx(lx,{size:16,strokeWidth:2})})]}):null]})]},ie.id)})}),te,xe]})};function yT(e){return ls({queryKey:(e==null?void 0:e.queryKey)??uE,queryFn:async()=>(await wn(e==null?void 0:e.scope)).client.getPhaseOneSnapshot({fallbackToMock:!1}),refetchInterval:3e5,refetchOnWindowFocus:!1,retry:1})}const vT=(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},bT=()=>{var y,g;const{sessionId:e}=ad({strict:!1}),t=ki(),a=La(),l=v_(e),o=yT({queryKey:["session-route-bridge",e??""]}),u=e?vT(a.getQueriesData({queryKey:os}),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??pc();return _.useEffect(()=>{if(!e){t({to:"/",replace:!0});return}!m&&(o.isPending||o.isFetching)||(Js(e),Kr(e),m&&Ji(m),t({to:"/",replace:!0}))},[t,m,e,o.isFetching,o.isPending]),null},xT=(e,t)=>e==="offline"?"offline":e==="online"&&t==="connected"?"online":e==="online"?"reconnecting":"offline",ST=e=>{switch(e){case"online":return"节点在线";case"reconnecting":return"节点重连中";case"offline":return"节点离线";default:return"节点状态未知"}};function ox(e){return ls(N3(e))}const jT=24,D0={sessions:[],nextCursor:null,totalCount:0,isLoading:!1,error:null,initialized:!1},cx=e=>e.trim(),wT=e=>[...e].sort((t,a)=>Number(a.pinned)-Number(t.pinned)||+new Date(a.last_event_at)-+new Date(t.last_event_at)),NT=(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 wT([...a.values()])},Em=(e,t)=>e[cx(t)]??D0;function ux(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(b,w)=>{const N=cx(w);if(!N)return;const j=b==="history"?a:o,T=Em(b==="history"?t:l,N);if(!T.isLoading&&!(T.initialized&&T.nextCursor===null)){j(D=>({...D,[N]:{...Em(D,N),isLoading:!0,error:null}}));try{const z=await(await wn(e==null?void 0:e.scope)).client.getWorkspaceSessionPage({bucket:b,projectId:N,cursor:T.initialized?T.nextCursor:null,limit:jT,selectedSessionId:(e==null?void 0:e.selectedSessionId)??null});j(I=>{const k=Em(I,N);return{...I,[N]:{sessions:NT(k.sessions,z.sessions),nextCursor:z.next_cursor,totalCount:z.total_count,isLoading:!1,error:null,initialized:!0}}})}catch(D){j(z=>({...z,[N]:{...Em(z,N),isLoading:!1,error:D instanceof Error?D.message:"加载会话分页失败",initialized:!0}}))}}},[l,t,e==null?void 0:e.scope,e==null?void 0:e.selectedSessionId]),m=_.useCallback(async b=>{await f("history",b)},[f]),y=_.useCallback(async b=>{await f("archived",b)},[f]);return{historyState:t,archivedState:l,loadMoreHistory:m,loadMoreArchived:y,reset:u}}const kT=180*1e3,wu=6,dx="panda:completed-session-seen-at",Eg=6,ET=220,Cm=e=>{e.cancelable&&e.preventDefault()},Nb=()=>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"})}),CT=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:i.jsx("path",{d:"M12 5v14M5 12h14"})}),TT=()=>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"})]}),RT=()=>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"})}),MT=()=>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"})]}),kb=({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"})}),AT=()=>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"})}),DT=()=>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"})}),OT=()=>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"})]}),IT=()=>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"})]}),LT=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))}天`},Cg=e=>e.run_state==="completed"&&e.run_state_changed_at&&Date.now()-new Date(e.run_state_changed_at).getTime()>kT?"idle":e.run_state??"idle",PT=(e,t)=>Number(t.pinned)-Number(e.pinned)||+new Date(t.last_event_at)-+new Date(e.last_event_at),UT=(e,t)=>{if(e.length<=wu)return e;if(!t)return e.slice(0,wu);const a=e.findIndex(l=>l.id===t);return a===-1||a<wu?e.slice(0,wu):[...e.slice(0,wu-1),e[a]]},zT=()=>{if(typeof window>"u")return{};try{const e=window.localStorage.getItem(dx);if(!e)return{};const t=JSON.parse(e);return t&&typeof t=="object"?t:{}}catch{return{}}},Tg=(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},HT=(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},$T=(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})},pu=(e,t)=>`${e}:${t}`,fx=_.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:b=[],historySessionsByProject:w={},archivedSessionsByProject:N={},historyPageStateByProject:j={},archivedPageStateByProject:T={},activeSessionId:D,onCreateSession:z,onCreateDirectoryThread:I,onSelectSession:k,onSessionAction:P,onThreadAction:Q,onOpenSettings:se,onLoadMoreHistory:W,onLoadMoreArchived:V,pendingSessionActionId:Y,pendingThreadActionId:ee}){const me=ki(),ge=a>.001,te=!!y,xe=te?g??((y==null?void 0:y.status)==="online"?"online":"offline"):null,C=xe?ST(xe):"未选择节点",q=_.useRef({threads:null,archived:null}),ie=_.useRef({}),he=_.useRef(null),re=_.useRef(null),L=_.useRef(null),ae=_.useRef(null),ke=_.useRef(null),U=_.useRef({}),ve=_.useRef(null),[Z,Se]=_.useState({}),[je,Oe]=_.useState(null),[Ie,wt]=_.useState(null),qe=_.useMemo(()=>p.map(M=>{const G=Z[M.id];return G?{...M,...G.pinned===void 0?null:{pinned:G.pinned}}:M}).filter(M=>{var G;return!((G=Z[M.id])!=null&&G.hidden)}),[Z,p]),bt=_.useMemo(()=>new Map(b.map(M=>[M.project_id,M])),[b]),Ut=(Ie==null?void 0:Ie.nextGlobalProjectIds)??je,$t=_.useMemo(()=>BT(S,Ut),[S,Ut]),zt=_.useMemo(()=>qe.filter(M=>!M.subagent),[qe]),xt=zt.find(M=>M.id===D),it=xt==null?void 0:xt.project_id,[ot,ln]=_.useState(it?[it]:[]),[on,kn]=_.useState("threads"),[En,ht]=_.useState(null),[Ve,Ke]=_.useState(null),[Nt,Bt]=_.useState(null),[Jt,Dt]=_.useState(null),[Ze,un]=_.useState([]),[ut,_e]=_.useState(null),[Fe,X]=_.useState(""),[B,oe]=_.useState(()=>zT()),ue=_.useMemo(()=>zt.filter(M=>!M.archived),[zt]),we=_.useMemo(()=>ue.filter(M=>M.pinned).sort((M,G)=>+new Date(G.last_event_at)-+new Date(M.last_event_at)),[ue]),Re=_.useMemo(()=>ue.filter(M=>!M.pinned),[ue]),He=M=>$t.map(G=>{var gn;const Ee=bt.get(G.id),De=M==="threads"?Re.filter(bn=>bn.project_id===G.id):N[G.id]??[],Pe=M==="threads"?w[G.id]??[]:[],$e=[...De];for(const bn of Pe)$e.some(Tn=>Tn.id===bn.id)||$e.push(bn);const Je=$e.sort((bn,Tn)=>PT(bn,Tn)),Ye=M==="threads"?j[G.id]??D0:T[G.id]??D0,en=M==="threads"?Je.length+Math.max(0,(Ee==null?void 0:Ee.hidden_history_count)??0):Math.max(Je.length,(Ee==null?void 0:Ee.archived_session_count)??0),jt=M==="threads"?Math.max(0,((Ee==null?void 0:Ee.hidden_history_count)??0)-Ye.sessions.length):Math.max(0,((Ee==null?void 0:Ee.archived_session_count)??0)-Ye.sessions.length),$n=((gn=Je[0])==null?void 0:gn.last_event_at)??new Date(0).toISOString();return{project:G,threadSessions:Je,collapsedThreadSessions:UT(Je,D),hiddenSessionCount:Math.max(0,Je.length-wu),totalSessionCount:en,pageState:Ye,remainingPageCount:jt,latestEventAt:$n}}).filter(({totalSessionCount:G})=>G>0),ze=_.useMemo(()=>He("threads"),[D,T,N,j,w,$t,bt,Re]),rt=_.useMemo(()=>He("archived"),[D,T,N,j,w,$t,bt,Re]);_.useEffect(()=>{Se(M=>{let G=!1;const Ee={...M};for(const[De,Pe]of Object.entries(M)){const $e=p.find(Ye=>Ye.id===De);if(!$e){Pe.hidden&&(delete Ee[De],G=!0);continue}(Pe.pinned===void 0||$e.pinned===Pe.pinned)&&!Pe.hidden&&(delete Ee[De],G=!0)}return G?Ee:M})},[p]),_.useEffect(()=>{Oe(M=>{if(!M)return M;const G=S.map(De=>De.id),Ee=[...M.filter(De=>G.includes(De)),...G.filter(De=>!M.includes(De))];return Tg(Ee,G)?null:Ee})},[S]),_.useEffect(()=>{it&&ln(M=>M.includes(it)?M:[...M,it])},[it]),_.useEffect(()=>{kn(xt!=null&&xt.archived?"archived":"threads")},[xt==null?void 0:xt.archived,D]),_.useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(dx,JSON.stringify(B))}catch{}},[B]),_.useEffect(()=>{t||o||(Bt(null),Dt(null),_e(null),Ke(null))},[o,t]),_.useEffect(()=>{if(!o||!Nt)return;const M=G=>{const Ee=G.target;if(!(Ee instanceof Element)){Bt(null);return}Ee.closest(".thread-group__menu-anchor")||Ee.closest(".thread-group__menu")||Bt(null)};return window.addEventListener("pointerdown",M),()=>{window.removeEventListener("pointerdown",M)}},[o,Nt]),_.useEffect(()=>{if(!D)return;const M=zt.find(Ee=>Ee.id===D);if(!M||Cg(M)!=="completed"||!M.run_state_changed_at)return;const G=M.run_state_changed_at;oe(Ee=>Ee[M.id]===G?Ee:{...Ee,[M.id]:G})},[D,zt]),_.useEffect(()=>()=>{he.current!==null&&globalThis.clearTimeout(he.current),Ft(),ve.current!==null&&window.cancelAnimationFrame(ve.current)},[]),_.useEffect(()=>{ae.current=Ie},[Ie]),_.useLayoutEffect(()=>{if(typeof window>"u")return;const M={},G=[],Ee=Ie?pu(Ie.pane,Ie.projectId):null;for(const[De,Pe]of Object.entries(ie.current)){if(!Pe)continue;const $e=Pe.offsetTop;if(M[De]=$e,Ee===De)continue;const Je=U.current[De];if(Je===void 0)continue;const Ye=Je-$e;Math.abs(Ye)<.5||(Pe.style.transition="none",Pe.style.transform=`translateY(${Ye}px)`,G.push(Pe))}ve.current!==null&&window.cancelAnimationFrame(ve.current),G.length>0&&(ve.current=window.requestAnimationFrame(()=>{for(const De of G)De.style.transition="",De.style.transform=""})),U.current=M},[ze,rt,ot,Ze,Ie==null?void 0:Ie.projectId,Ut]);const It=()=>{he.current!==null&&(globalThis.clearTimeout(he.current),he.current=null)},Ft=()=>{const M=L.current;M&&(M.removeEventListener("selectstart",Cm),M.removeEventListener("contextmenu",Cm),L.current=null)},Le=M=>M==="threads"?ze:rt,Et=(M,G,Ee,De,Pe)=>{const $e=q.current[G],Je=ie.current[pu(G,M)];if(!$e||!Je)return!1;const Ye=Le(G).map(yn=>yn.project.id),en=Ye.indexOf(M);if(en===-1)return!1;const jt=$t.map(yn=>yn.id),$n=$e.getBoundingClientRect(),gn=Je.getBoundingClientRect(),bn=Je.offsetHeight,Tn=Je.offsetWidth,xn=Pe-gn.top,zn=$e.scrollTop,Ss=Math.max(zn,$e.scrollTop+$e.clientHeight-bn),_n=Math.max(zn,Math.min(Ss,$e.scrollTop+Pe-$n.top-xn)),qt={pane:G,projectId:M,pointerId:Ee,pointerType:De,originIndex:en,visibleProjectIds:Ye,nextVisibleProjectIds:Ye,nextGlobalProjectIds:jt,previewTop:_n,itemHeight:bn,itemWidth:Tn,pointerOffsetY:xn};return ae.current=qt,wt(qt),ke.current=M,!0},Cn=M=>{wt(G=>{if(!G)return G;ae.current=G;const Ee=q.current[G.pane];if(!Ee||!ie.current[pu(G.pane,G.projectId)])return G;const De=Ee.getBoundingClientRect(),Pe=Ee.scrollTop,$e=Math.max(Pe,Ee.scrollTop+Ee.clientHeight-G.itemHeight),Je=Math.max(Pe,Math.min($e,Ee.scrollTop+M-De.top-G.pointerOffsetY)),Ye=Je+G.itemHeight/2,en=G.nextVisibleProjectIds,jt=en.indexOf(G.projectId);if(jt===-1)return G;const $n=en.filter(_n=>_n!==G.projectId);let gn=0;const bn=$n[0],Tn=bn?ie.current[pu(G.pane,bn)]:null;if(Tn&&Je<=Tn.offsetTop+Tn.offsetHeight*.42)gn=0;else for(let _n=0;_n<$n.length;_n+=1){const qt=$n[_n],yn=qt?ie.current[pu(G.pane,qt)]:null;if(!yn){gn=_n+1;continue}const Zn=yn.offsetTop+yn.offsetHeight/2;if(Ye<=Zn){gn=_n;break}gn=_n+1}const xn=HT(en,jt,gn),zn=$T(G.nextGlobalProjectIds,G.visibleProjectIds,xn);if(Je===G.previewTop&&Tg(xn,G.nextVisibleProjectIds))return G;const Ss={...G,previewTop:Je,nextVisibleProjectIds:xn,nextGlobalProjectIds:zn};return ae.current=Ss,Ss})},hs=M=>{It(),Ft(),re.current=null;const G=M??ae.current;if(ae.current=null,wt(null),!G||!!Tg(G.visibleProjectIds,G.nextVisibleProjectIds)||!Q)return;const De=je??$t.map($e=>$e.id),Pe=G.nextGlobalProjectIds;Oe(Pe),Promise.resolve(Q(G.projectId,"reorder",{orderedProjectIds:Pe})).catch(()=>{Oe(De)})},na=()=>{It(),Ft(),re.current=null,ae.current=null,wt(null)};_.useEffect(()=>{if(typeof window>"u"||!ae.current)return;const M=De=>{const Pe=ae.current;!Pe||Pe.pointerId!==De.pointerId||Cn(De.clientY)},G=De=>{const Pe=ae.current;!Pe||Pe.pointerId!==De.pointerId||hs(Pe)},Ee=De=>{const Pe=ae.current;!Pe||Pe.pointerId!==De.pointerId||na()};return window.addEventListener("pointermove",M),window.addEventListener("pointerup",G),window.addEventListener("pointercancel",Ee),()=>{window.removeEventListener("pointermove",M),window.removeEventListener("pointerup",G),window.removeEventListener("pointercancel",Ee)}},[Ie==null?void 0:Ie.pointerId]);const Ws=M=>{ln(G=>G.includes(M)?G.filter(Ee=>Ee!==M):[...G,M])},Ja=M=>{if(ke.current===M){ke.current=null;return}Ws(M)},Rs=(M,G,Ee)=>{if(M.pointerType==="mouse"&&M.button!==0)return;It();const De=M.currentTarget;Ft(),M.pointerType==="touch"&&(L.current=De,De.addEventListener("selectstart",Cm),De.addEventListener("contextmenu",Cm)),re.current={pane:Ee,projectId:G,pointerId:M.pointerId,pointerType:M.pointerType,startX:M.clientX,startY:M.clientY,currentX:M.clientX,currentY:M.clientY},M.pointerType!=="touch"&&De.setPointerCapture(M.pointerId),M.pointerType==="touch"&&(he.current=globalThis.setTimeout(()=>{const Pe=re.current;if(!Pe||Pe.projectId!==G||Pe.pointerId!==M.pointerId)return;De.hasPointerCapture(M.pointerId)||De.setPointerCapture(M.pointerId),Et(G,Ee,M.pointerId,M.pointerType,Pe.currentY)&&Cn(Pe.currentY)},ET))},Na=(M,G,Ee)=>{const De=re.current;if(!De||De.projectId!==G||De.pointerId!==M.pointerId||De.pane!==Ee)return;if(De.currentX=M.clientX,De.currentY=M.clientY,(Ie==null?void 0:Ie.projectId)===G&&Ie.pointerId===M.pointerId){M.preventDefault(),Cn(M.clientY);return}const Pe=M.clientX-De.startX,$e=M.clientY-De.startY;if(De.pointerType==="touch"){(Math.abs(Pe)>Eg||Math.abs($e)>Eg)&&It();return}Math.abs($e)<Eg||Math.abs($e)<Math.abs(Pe)||!Et(G,Ee,M.pointerId,M.pointerType,M.clientY)||(M.preventDefault(),Cn(M.clientY))},Pa=(M,G)=>{if(M.currentTarget.hasPointerCapture(M.pointerId)&&M.currentTarget.releasePointerCapture(M.pointerId),(Ie==null?void 0:Ie.projectId)===G&&Ie.pointerId===M.pointerId){M.preventDefault(),hs();return}It(),Ft(),re.current=null},ms=(M,G)=>{if(M.currentTarget.hasPointerCapture(M.pointerId)&&M.currentTarget.releasePointerCapture(M.pointerId),(Ie==null?void 0:Ie.projectId)===G&&Ie.pointerId===M.pointerId){na();return}It(),Ft(),re.current=null},dn=M=>{un(G=>G.includes(M)?G.filter(Ee=>Ee!==M):[...G,M])},pn=M=>{if(Cg(M)!=="completed"||!M.run_state_changed_at)return;const G=M.run_state_changed_at;oe(Ee=>Ee[M.id]===G?Ee:{...Ee,[M.id]:G})},ps=`translateX(-${(on==="threads"?0:1)*50}%)`,Ps=ut&&typeof document<"u"?Ya.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:()=>{_e(null),X("")},"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:Fe,onChange:M=>X(M.target.value),placeholder:"输入线程名称",autoFocus:!0}),i.jsxs("div",{className:"sheet-panel__actions",children:[i.jsx("button",{type:"button",className:"sheet-panel__button",onClick:()=>{_e(null),X("")},children:"取消"}),i.jsx("button",{type:"button",className:"sheet-panel__button is-primary",disabled:!Fe.trim()||ee===ut,onClick:()=>{Ms()},children:"保存"})]})]})})]}),document.body):null,Us=M=>{Bt(null),Dt(null),_e(M.id),X(M.display_name??M.name)},Ms=async()=>{!ut||!Fe.trim()||!Q||(await Q(ut,"rename",{name:Fe.trim()}),_e(null),X(""))},xs=(M,G,Ee)=>{if(!P)return;const De=Z[M.id];G==="pin"||G==="unpin"?Se($e=>({...$e,[M.id]:{...$e[M.id],pinned:G==="pin"}})):G==="delete"&&Se($e=>({...$e,[M.id]:{...$e[M.id],hidden:!0}}));const Pe=P(M.id,G,Ee);Pe&&typeof Pe.then=="function"&&Pe.catch(()=>{Se($e=>{const Je={...$e};return De?Je[M.id]=De:delete Je[M.id],Je})})},As=M=>{const G=Cg(M),Ee=G==="completed"&&M.id!==D&&!!M.run_state_changed_at&&B[M.id]!==M.run_state_changed_at,De=o&&En===M.id,Pe=!!P&&De,$e=Ve===M.id,Je=o&&(Pe||$e);return i.jsxs("div",{className:`thread-session ${M.id===D?"is-active":""}`,onMouseEnter:()=>ht(M.id),onMouseLeave:()=>{ht(Ye=>Ye===M.id?null:Ye),Ke(Ye=>Ye===M.id?null:Ye)},children:[i.jsx("button",{type:"button",className:`thread-session__icon-button ${Pe?"is-visible":""} ${M.pinned?"is-active":""}`,disabled:Y===M.id,onClick:Ye=>{Ye.stopPropagation(),xs(M,M.pinned?"unpin":"pin")},"aria-label":M.pinned?"取消置顶会话":"置顶会话",title:M.pinned?"取消置顶":"置顶",children:i.jsx(oT,{strokeWidth:M.pinned?2.1:1.95})}),i.jsxs("div",{className:"thread-session__row",children:[k?i.jsxs("button",{type:"button",className:"thread-session__link thread-session__link--button",title:M.title,onClick:()=>{pn(M),k(M.id),f()},children:[i.jsx("span",{className:`thread-session__status is-${Ee?"completed":G} ${Ee?"is-unread":""} ${Je?"is-hidden":""}`,"aria-hidden":"true"}),i.jsx("div",{className:"thread-session__title",children:M.title})]}):i.jsxs(sp,{to:"/session/$sessionId",params:{sessionId:M.id},title:M.title,onClick:()=>{pn(M),f()},className:"thread-session__link",children:[i.jsx("span",{className:`thread-session__status is-${Ee?"completed":G} ${Ee?"is-unread":""} ${Je?"is-hidden":""}`,"aria-hidden":"true"}),i.jsx("div",{className:"thread-session__title",children:M.title})]}),i.jsx("div",{className:"thread-session__meta",children:o&&De&&P?$e?i.jsx("button",{type:"button",className:"thread-session__delete-confirm",disabled:Y===M.id,onClick:Ye=>{Ye.stopPropagation(),xs(M,"delete")},children:"确认"}):i.jsx("button",{type:"button",className:"thread-session__delete",disabled:Y===M.id,onClick:Ye=>{Ye.stopPropagation(),Ke(M.id)},"aria-label":`删除 ${M.title}`,children:i.jsx(lx,{strokeWidth:1.95})}):i.jsx("span",{className:"thread-session__time",children:LT(M.last_event_at)})})]})]},M.id)},Rt=({project:M,threadSessions:G,collapsedThreadSessions:Ee,hiddenSessionCount:De,totalSessionCount:Pe,pageState:$e,remainingPageCount:Je},Ye)=>{const en=pu(Ye,M.id),jt=ot.includes(M.id),$n=Ze.includes(M.id),gn=M.display_name??M.name,bn=!!Q&&o&&Nt===M.id,Tn=!!Q&&Jt===M.id,xn=Ye==="archived",zn=$n?G:Ee,Ss=De>0,_n=Je>0,qt=Ye==="threads"?W:V,yn=(Ie==null?void 0:Ie.projectId)===M.id&&Ie.pane===Ye,Zn=Tn&&typeof document<"u"?Ya.createPortal(i.jsxs("div",{className:"sheet-wrap",role:"dialog","aria-modal":"true",children:[i.jsx("button",{type:"button",className:"sheet-wrap__scrim",onClick:()=>Dt(null),"aria-label":"关闭线程菜单"}),i.jsxs("div",{className:"sheet-panel",children:[i.jsx("div",{className:"sheet-panel__title",children:gn}),i.jsx("button",{type:"button",className:"sheet-panel__item",onClick:()=>Us(M),children:"编辑名称"}),i.jsx("button",{type:"button",className:"sheet-panel__item",disabled:ee===M.id,onClick:()=>{Q==null||Q(M.id,xn?"unarchive":"archive"),Dt(null)},children:xn?"取消归档":"归档线程"}),i.jsx("button",{type:"button",className:"sheet-panel__item is-danger",disabled:ee===M.id,onClick:()=>{Q==null||Q(M.id,"remove"),Dt(null)},children:"移除"})]})]}),document.body):null;return i.jsxs(_.Fragment,{children:[i.jsx("div",{ref:A=>{ie.current[en]=A},className:`thread-group-shell ${yn?"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:()=>Ja(M.id),onPointerDown:A=>Rs(A,M.id,Ye),onPointerMove:A=>Na(A,M.id,Ye),onPointerUp:A=>Pa(A,M.id),onPointerCancel:A=>ms(A,M.id),"aria-expanded":jt,title:gn,children:[i.jsx("span",{className:"thread-group__chevron",children:i.jsx(kb,{open:jt})}),i.jsx("span",{className:"thread-group__icon",children:i.jsx(Nb,{})}),i.jsx("span",{className:"thread-group__title-text",children:gn})]}),i.jsxs("div",{className:"thread-group__actions",children:[Q?i.jsxs("div",{className:"thread-group__menu-anchor",children:[i.jsx("button",{type:"button",className:`thread-group__more ${bn||Tn?"is-open":""}`,onClick:A=>{if(A.stopPropagation(),o){Bt(le=>le===M.id?null:M.id);return}Dt(M.id)},"aria-label":`${gn} 更多选项`,children:i.jsx(IT,{})}),bn?i.jsxs("div",{className:"thread-group__menu",children:[i.jsx("button",{type:"button",className:"thread-group__menu-item",onClick:()=>Us(M),children:"编辑名称"}),i.jsx("button",{type:"button",className:"thread-group__menu-item",disabled:ee===M.id,onClick:()=>{Q==null||Q(M.id,xn?"unarchive":"archive"),Bt(null)},children:xn?"取消归档":"归档线程"}),i.jsx("button",{type:"button",className:"thread-group__menu-item is-danger",disabled:ee===M.id,onClick:()=>{Q==null||Q(M.id,"remove"),Bt(null)},children:"移除"})]}):null]}):null,i.jsx("button",{type:"button",className:"thread-group__add",onClick:A=>{A.stopPropagation(),z(M.id,M.name)},"aria-label":`在 ${M.name} 下新增会话`,children:i.jsx(CT,{})})]})]}),jt?Pe===0?i.jsx("div",{className:"thread-group__empty",children:"这个线程还没有会话"}):i.jsxs(i.Fragment,{children:[zn.length>0?i.jsx("div",{className:"thread-group__sessions",children:zn.map(A=>As(A))}):i.jsx("div",{className:"thread-group__empty",children:Ye==="archived"?"这个归档线程还没有已加载的会话":"这个线程还没有已加载的历史会话"}),Ss?i.jsx("button",{type:"button",className:"thread-group__session-toggle",onClick:()=>dn(M.id),"aria-expanded":$n,children:$n?"折叠显示":"展开显示"}):null,_n&&qt?i.jsx("button",{type:"button",className:"thread-group__session-toggle",disabled:$e.isLoading,onClick:()=>{qt(M.id)},children:$e.isLoading?"加载中...":Ye==="archived"?`加载已归档会话 (${Je})`:`加载更早会话 (${Je})`}):null,$e.error?i.jsx("div",{className:"thread-group__empty",children:$e.error}):null]}):null]},M.id)}),Zn]},M.id)},J=M=>{if(!Ie||Ie.pane!==M)return null;const G=Le(M).find(Pe=>Pe.project.id===Ie.projectId);if(!G)return null;const Ee={top:Ie.previewTop,width:`${Ie.itemWidth}px`},De=G.project.display_name??G.project.name;return i.jsx("div",{className:"thread-group-drag-preview",style:Ee,"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(kb,{open:!0})}),i.jsx("span",{className:"thread-group-drag-preview__icon",children:i.jsx(Nb,{})}),i.jsx("span",{className:"thread-group-drag-preview__title",children:De})]})})};return i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:`sidebar-scrim ${ge?"is-visible":""}`,style:{opacity:o?0:a,pointerEvents:o?"none":ge?"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:M=>{M.pointerType!=="touch"&&(M.preventDefault(),M.stopPropagation(),m(M.clientX))}}):null,i.jsxs("div",{className:"conversation-sidebar__header",children:[i.jsxs("div",{className:`conversation-sidebar__brand ${te&&xe?`is-${xe}`:"is-empty"}`,"aria-label":C,title:C,children:[te?i.jsx("span",{className:"conversation-sidebar__status-dot","aria-hidden":"true"}):null,i.jsx("span",{className:"conversation-sidebar__brand-name",children:y?dc(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(sp,{to:"/nodes",className:"sidebar-action",onClick:f,children:[i.jsx("span",{className:"sidebar-action__icon",children:i.jsx(TT,{})}),i.jsx("span",{children:"节点列表"})]}),i.jsxs("button",{type:"button",className:"sidebar-action sidebar-action--primary",onClick:()=>{f();const M=S.find(G=>G.id===it)??S[0];M?z(M.id,M.name):me({to:"/nodes"})},children:[i.jsx("span",{className:"sidebar-action__icon",children:i.jsx(RT,{})}),i.jsx("span",{children:"新会话"})]})]}),i.jsx("div",{className:"conversation-sidebar__threads",children:i.jsxs("div",{className:"sidebar-pane-track",style:{transform:ps},children:[i.jsxs("div",{ref:M=>{q.current.threads=M},className:`sidebar-pane ${on==="threads"?"is-active":"is-inactive"}`,children:[we.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:we.map(M=>As(M))})]}):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(MT,{})}):null]}),ze.map(M=>Rt(M,"threads")),J("threads"),i.jsxs("button",{type:"button",className:"thread-archive__toggle",onClick:()=>kn("archived"),children:[i.jsx("span",{children:"已归档"}),i.jsx("span",{className:"thread-archive__icon",children:i.jsx(AT,{})})]})]}),i.jsxs("div",{ref:M=>{q.current.archived=M},className:`sidebar-pane sidebar-pane--archived ${on==="archived"?"is-active":"is-inactive"}`,children:[i.jsx("div",{className:"conversation-sidebar__node",children:"已归档的线程"}),rt.length>0?i.jsx("div",{className:"thread-archive__list",children:rt.map(M=>Rt(M,"archived"))}):i.jsx("div",{className:"thread-archive__empty",children:"暂时没有已归档的线程"}),J("archived"),i.jsxs("button",{type:"button",className:"thread-archive__back",onClick:()=>kn("threads"),"aria-label":"返回线程列表",children:[i.jsx("span",{className:"thread-archive__back-icon",children:i.jsx(DT,{})}),i.jsx("span",{children:"返回"})]})]})]})}),i.jsx("div",{className:"conversation-sidebar__footer",children:i.jsxs("button",{type:"button",className:"sidebar-settings",onClick:()=>{f(),se==null||se()},"aria-label":"打开设置页",children:[i.jsx("span",{className:"sidebar-settings__icon",children:i.jsx(OT,{})}),i.jsx("span",{children:"设置"})]})})]}),Ps]})}),L_="optimistic-user:",FT="overlay-user:",qT=[L_,FT],WT=5e3,Fo=e=>["timeline-optimistic",e],Op=e=>e.kind==="user"&&qT.some(t=>e.id.startsWith(t)),P_=e=>e.kind==="user"&&!Op(e),U_=e=>e.kind==="user"&&e.id.startsWith(L_),KT=e=>e.kind==="user"&&!U_(e),Eb=e=>e.body.replace(/\r\n/g,`
|
|
134
|
+
`).trim(),Cb=e=>new Date(e).getTime(),Ip=(e,t)=>{if(Eb(e)!==Eb(t))return!1;const a=Cb(e.timestamp),l=Cb(t.timestamp);return!Number.isFinite(a)||!Number.isFinite(l)?!0:l>=a-WT},QT=(e,t)=>{const a=t.filter(P_);if(a.length===0)return new Set;const l=new Set,o=new Set;for(const u of e??[]){if(!Op(u))continue;const f=a.findIndex((m,y)=>!l.has(y)&&Ip(u,m));f<0||(l.add(f),o.add(u.id))}return o},GT=(e,t)=>{const a=t.map((u,f)=>({entry:u,index:f})).filter(({entry:u})=>P_(u));if(a.length===0)return new Map;const l=new Set,o=new Map;for(const u of e??[]){if(!Op(u))continue;const f=a.find(({entry:m,index:y})=>!l.has(y)&&Ip(u,m));f&&(l.add(f.index),(u.attachments??[]).length!==0&&o.set(f.index,I6(f.entry.attachments,u.attachments)))}return o},YT=(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(!U_(u))continue;const f=a.findIndex((m,y)=>!l.has(y)&&Ip(u,m));f<0||(l.add(f),o.add(u.id))}return o},VT=e=>{const t=[...e??[]],a=t.map((u,f)=>({entry:u,index:f})).filter(({entry:u})=>P_(u));if(a.length===0)return t;const l=new Set,o=new Set;for(const u of t){if(!Op(u))continue;const f=a.find(({entry:m,index:y})=>!l.has(y)&&Ip(u,m));f&&(l.add(f.index),o.add(u.id))}return o.size===0?t:t.filter(u=>!o.has(u.id))},O0=(e,t)=>[...e??[],t],hx=(e,t)=>{const a=GT(e,t),l=QT(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},I0=(e,t)=>[...hx(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}),mx=(e,t)=>(e??[]).filter(a=>U_(a)&&!YT([a],t).has(a.id)),ZT=(e,t)=>{const a=VT(e),l=mx(t,a);return I0(l,a)},XT=(e,t)=>{if(!e||e.session_id!==t.session_id)return{...t,entries:I0(void 0,t.entries)};const a=e.view==="full_compact"&&t.view==="tail",l=I0(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}},JT=(e,t)=>(e??[]).filter(a=>a.id!==t),px="image/",eR=()=>`attachment-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,tR=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)}),gx=async e=>({id:eR(),kind:e.type.startsWith(px)?"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 tR(e)}),Tb=e=>{var t;return e.kind==="image"||!!((t=e.mime_type)!=null&&t.startsWith(px))},_x=e=>O6((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}))),L0=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`,nR=/\[[^\]]+\]\([^)]+\)|`[^`\n]+`|\*\*.+?\*\*|\*[^*\n][^*\n]*\*|\$[A-Za-z0-9._-]+|\/[A-Za-z][A-Za-z0-9._-]*/g,sR=/^[A-Za-z0-9._-]$/,aR=/^[A-Za-z0-9._-]$/,P0=e=>/\s/.test(e),Rb=e=>sR.test(e),iR=e=>aR.test(e),Oa=e=>e.trim().toLowerCase(),rR=e=>Oa(e).split(/[^a-z0-9]+/i).filter(Boolean),Mb=e=>e==="repo"?0:e==="user"?1:2,lR=e=>e==="repo"?"项目":e==="user"?"个人":"系统",yx=e=>{const t=[];let a=0;for(const l of e.matchAll(nR)){const o=l[0],u=l.index??0;if(o.startsWith("$")){const f=u>0?e[u-1]??"":"";if(u>0&&!P0(f))continue}if(o.startsWith("/")){const f=u>0?e[u-1]??"":"";if(u>0&&!P0(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},vx=(e,t,a=t)=>{if(t!==a)return null;let l=t;for(;l>0&&Rb(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&&!P0(u))return null;let f=t;for(;f<e.length&&Rb(e[f]??"");)f+=1;return{start:o,end:f,query:e.slice(o+1,t)}},oR=(e,t,a,l)=>{const o=vx(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}},z_=e=>e.startsWith("/"),bx=(e,t,a=t)=>{if(!z_(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&&iR(e[u]??"");)u+=1;return t>u?null:{start:0,end:u,query:e.slice(1,t)}},cR=(e,t,a,l)=>{const o=bx(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}},uR=(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=rR(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=Mb(u.scope)-Mb(f.scope);if(g!==0)return g;const S=Oa(u.name),p=Oa(f.name);return S.localeCompare(p)})},dR=(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)})},Rg=()=>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"})}),fR=()=>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"})}),Ab=()=>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"})}),hR=()=>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"})]}),Db=e=>!!(e&&/^[A-Za-z]:[\\/]?$/.test(e.trim())),mR=({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,b]=_.useState(a),[w,N]=_.useState([]),[j,T]=_.useState(!0),[D,z]=_.useState(null),[I,k]=_.useState(0),[P,Q]=_.useState(!1),[se,W]=_.useState(""),[V,Y]=_.useState(null),ee=_.useRef(null);_.useEffect(()=>{S(a),b(a)},[a]),_.useEffect(()=>{Q(!1),W(""),Y(null),ge.reset()},[g]),_.useEffect(()=>{let je=!1;return T(!0),z(null),T3({agentId:e,path:g}).then(Oe=>{je||N(Oe)}).catch(Oe=>{je||(z(Oe instanceof Error?Oe.message:"目录列表加载失败"),N([]))}).finally(()=>{je||T(!1)}),()=>{je=!0}},[e,g,I]),_.useEffect(()=>{var je,Oe;P&&((je=ee.current)==null||je.focus(),(Oe=ee.current)==null||Oe.select())},[P]);const me=Vn({mutationFn:async je=>IE({agentId:e,path:je,projects:t,queryClient:y,bootstrapQueryKey:dE}),onSuccess:je=>{m(je)}}),ge=Vn({mutationFn:async je=>OE({agentId:e,parentPath:je.parentPath,name:je.name}),onSuccess:({directory:je})=>{Q(!1),W(""),Y(null),b(je.path),k(Oe=>Oe+1)}}),te=_.useMemo(()=>{const je=new Map;for(const Oe of t)je.set(jp(Oe.path),Oe);return je},[t]),xe=_.useMemo(()=>p?te.get(jp(p))??null:null,[te,p]),C=u!=="选择此目录"?u:xe?"在线程中继续":"创建新线程",q=C3(g),ie=q!==null||Db(g),he=!!g,re=se.trim(),L=V??(ge.error instanceof Error?ge.error.message:null),ae=me.error instanceof Error?me.error.message:me.error?"创建线程失败":null,ke=()=>{if(q!==null){S(q),b(q);return}Db(g)&&(S(null),b(null))},U=je=>{S(je),b(je)},ve=()=>{Q(!1),W(""),Y(null),ge.reset()},Z=()=>{g&&(ge.reset(),Y(null),W(""),Q(!0))},Se=()=>{if(g){if(!re){Y("目录名称不能为空");return}Y(null),ge.mutate({parentPath:g,name:re})}};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&&b(g)},disabled:!g,"aria-pressed":p===g,children:[i.jsx("span",{className:"directory-picker__path-icon",children:i.jsx(Rg,{})}),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:"正在读取目录…"}):D?i.jsx("div",{className:"directory-picker__state is-error",children:D}):i.jsxs(i.Fragment,{children:[w.length===0&&!P?i.jsx("div",{className:"directory-picker__state",children:"当前目录下没有可用子目录"}):null,w.map(je=>{const Oe=p===je.path;return i.jsxs("div",{className:`directory-picker__row ${Oe?"is-selected":""}`,children:[i.jsxs("button",{type:"button",className:"directory-picker__row-main",onClick:Ie=>{if(je.has_children&&Ie.detail>=2){U(je.path);return}b(je.path)},"aria-selected":Oe,children:[i.jsx("span",{className:"directory-picker__row-icon",children:i.jsx(Rg,{})}),i.jsx("span",{className:"directory-picker__row-name",children:je.name}),!je.has_children&&Oe?i.jsx("span",{className:"directory-picker__row-check",children:i.jsx(Ab,{})}):null]}),je.has_children?i.jsx("button",{type:"button",className:"directory-picker__row-enter-button","aria-label":`进入 ${je.name}`,onClick:()=>U(je.path),children:i.jsx("span",{className:"directory-picker__row-enter","aria-hidden":"true",children:i.jsx(fR,{})})}):null]},je.path)}),P?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(Rg,{})}),i.jsx("input",{ref:ee,type:"text",className:"directory-picker__row-input",value:se,onChange:je=>{W(je.target.value),V&&Y(null),ge.error&&ge.reset()},onKeyDown:je=>{je.key==="Enter"&&(je.preventDefault(),Se()),je.key==="Escape"&&(je.preventDefault(),ve())},placeholder:"输入目录名称","aria-label":"新目录名称",disabled:ge.isPending}),i.jsxs("div",{className:"directory-picker__row-actions",children:[i.jsx("button",{type:"button",className:"directory-picker__row-action",onClick:Se,"aria-label":"确认创建目录",disabled:!re||ge.isPending,children:i.jsx(Ab,{})}),i.jsx("button",{type:"button",className:"directory-picker__row-action",onClick:ve,"aria-label":"取消创建目录",disabled:ge.isPending,children:i.jsx(hR,{})})]})]})}):null]})})]}),L?i.jsx("div",{className:"directory-picker__feedback is-error",role:"status","aria-live":"polite",children:L}):null,ae?i.jsx("div",{className:"directory-picker__feedback is-error",role:"status","aria-live":"polite",children:ae}):null,i.jsx("footer",{className:"directory-picker__footer",children:i.jsxs("div",{className:"directory-picker__footer-actions",children:[ie?i.jsx("button",{type:"button",className:"directory-picker__secondary",onClick:ke,children:i.jsx("span",{children:f})}):null,he?i.jsx("button",{type:"button",className:"directory-picker__secondary",onClick:Z,disabled:P||ge.isPending,children:i.jsx("span",{children:"新建目录"})}):null,i.jsx("button",{type:"button",className:"directory-picker__primary",disabled:!p||me.isPending,onClick:()=>{p&&me.mutate(p)},children:me.isPending?"创建中…":C})]})})]})})},pR=`<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
|
|
135
|
+
<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
|
|
136
|
+
</svg>\r
|
|
137
|
+
\r
|
|
138
|
+
\r
|
|
139
|
+
\r
|
|
140
|
+
`,gR=()=>i.jsx("span",{"aria-hidden":"true",className:"new-thread-hero__logo",dangerouslySetInnerHTML:{__html:pR}}),_R=()=>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"})}),yR=()=>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"})}),Ob=()=>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"})]}),vR=(e,t)=>{var a;return((a=e[t])==null?void 0:a.trim())??""},Ib=()=>typeof window<"u"&&!window.matchMedia("(max-width: 768px)").matches,bR=_.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({}),[b,w]=_.useState(0),[N,j]=_.useState(null),[T,D]=_.useState(null);_.useEffect(()=>{m(null),g(""),p({}),w(0),j(null),D(null)},[u==null?void 0:u.id]);const z=u?l===u.id:!1,I=(u==null?void 0:u.kind)==="user_input",k=I&&u.questions.length>0?u.questions[Math.max(0,Math.min(b,u.questions.length-1))]??null:null,P=k?vR(S,k.id):"",Q=k?k.options.some(te=>te.label===P):!1,se=!!(k&&P&&(!Q||N===k.id));_.useEffect(()=>{if(!k){j(null);return}if(Q){j(null);return}P&&j(k.id)},[Q,k,P]);const W=_.useMemo(()=>!u||z?!1:u.kind==="user_input"?k?!!P:!1:f?!0:u.allow_freeform?!!y.trim():!1,[k,P,u,y,z,f]);if(!u)return null;const V=u.questions.reduce((te,xe)=>te+xe.options.length,u.options.length),Y=te=>{z||o({requestId:u.id,optionId:(te==null?void 0:te.optionId)??f,text:(te==null?void 0:te.text)??y,answers:(te==null?void 0:te.answers)??S})},ee=()=>{if(!(!u||u.kind!=="user_input"||!k)){if(b<u.questions.length-1){w(te=>Math.min(te+1,u.questions.length-1));return}Y()}},me=()=>{if(!u||u.kind!=="user_input"||!k)return;const te={...S,[k.id]:"忽略"};if(p(te),j(null),b<u.questions.length-1){w(xe=>Math.min(xe+1,u.questions.length-1));return}Y({answers:te})},ge=te=>{if(!(!u||u.kind!=="user_input"||!k||z)){if(P===te){ee();return}p(xe=>({...xe,[k.id]:te})),j(null)}};return i.jsx("section",{className:`session-interaction-strip ${a?"has-strip-below":""} ${I?"is-user-input-flow":""}`,children:u.kind==="user_input"&&k?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"session-interaction-flow__header",children:[i.jsx("div",{className:"session-interaction-flow__prompt",children:k.question}),i.jsxs("div",{className:"session-interaction-flow__progress",children:[i.jsx("button",{type:"button",className:"session-interaction-flow__nav","aria-label":"上一题",disabled:b===0||z,onClick:()=>w(te=>Math.max(0,te-1)),children:i.jsx(_R,{})}),i.jsxs("span",{className:"session-interaction-flow__counter",children:[b+1," / ",u.questions.length]}),i.jsx("button",{type:"button",className:"session-interaction-flow__nav","aria-label":b===u.questions.length-1?"提交回复":"下一题",disabled:z||!W,onClick:ee,children:i.jsx(yR,{})})]})]}),i.jsx("div",{className:"session-interaction-flow__body",children:i.jsxs("div",{className:"session-interaction-flow__list",children:[k.options.map((te,xe)=>i.jsxs("div",{className:`session-interaction-flow__item is-${te.emphasis} ${P===te.label?"is-active":""}`,role:"button",tabIndex:z?-1:0,"aria-pressed":P===te.label,onClick:()=>ge(te.label),onKeyDown:C=>{C.key==="Enter"&&Ib()&&(C.preventDefault(),ge(te.label))},children:[i.jsxs("span",{className:"session-interaction-flow__item-index",children:[xe+1,"."]}),i.jsxs("span",{className:"session-interaction-flow__item-choice",children:[i.jsx("span",{className:"session-interaction-flow__item-label",children:te.label}),te.description?i.jsxs("span",{className:"session-interaction-flow__tooltip-wrap",children:[i.jsx("button",{type:"button",className:"session-interaction-flow__tooltip-trigger","aria-label":`查看 ${te.label} 的说明`,"aria-expanded":T===te.id,onMouseEnter:()=>D(te.id),onMouseLeave:()=>D(C=>C===te.id?null:C),onBlur:()=>D(C=>C===te.id?null:C),onClick:C=>{C.stopPropagation(),D(q=>q===te.id?null:te.id)},children:i.jsx(Ob,{})}),i.jsx("div",{className:`session-interaction-flow__tooltip ${T===te.id?"is-visible":""}`,role:"tooltip",children:te.description})]}):null]})]},te.id)),i.jsx("div",{className:`session-interaction-flow__item is-custom ${se?"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:Q?"":P,disabled:z,placeholder:k.is_secret?"输入敏感信息":"否,请告知如何调整",onFocus:()=>{j(k.id),Q&&p(te=>({...te,[k.id]:""}))},onKeyDown:te=>{te.key==="Enter"&&W&&!z&&Ib()&&(te.preventDefault(),ee())},onChange:te=>{j(k.id),p(xe=>({...xe,[k.id]:te.target.value}))}}),i.jsxs("div",{className:"session-interaction-flow__inline-actions",children:[i.jsx("button",{type:"button",className:"session-interaction-flow__ghost",disabled:z,onClick:me,children:"忽略"}),i.jsx("button",{type:"button",className:"session-interaction-flow__primary",disabled:!W,onClick:ee,children:z?"提交中...":b===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(Ob,{})}),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(te=>i.jsxs("button",{type:"button",className:`session-interaction-option is-${te.emphasis} ${f===te.id?"is-active":""}`,disabled:z,onClick:()=>{m(te.id),!u.allow_freeform&&V<=3&&Y({optionId:te.id})},children:[i.jsx("span",{className:"session-interaction-option__label",children:te.label}),te.description?i.jsx("span",{className:"session-interaction-option__description",children:te.description}):null]},te.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:z,placeholder:u.freeform_placeholder??"输入回复内容",onChange:te=>g(te.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:!W,onClick:()=>Y(),children:z?"提交中...":u.submit_label??"继续"})}):null]})})}),xR=()=>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"})]}),SR=({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(xR,{})})]}),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]})},jR=_.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}),wR=(e,t,a)=>{const l=((a==null?void 0:a.enabled)??!0)&&!!e;return ls({queryKey:["project-skills",t??"",e],enabled:l,queryFn:async()=>e?(await wn({projectId:e,agentId:t??null})).client.getProjectSkills(e):[],staleTime:6e4,gcTime:10*6e4,refetchOnWindowFocus:!1,retry:1})},Lb=24,NR=e=>{const t=yx(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)})},Pb=({value:e,onChange:t,onKeyDown:a,placeholder:l,disabled:o=!1,className:u,projectId:f,agentId:m,autoFocus:y=!1})=>{var ie;const g=u.includes("composer-fullscreen-sheet__input"),S=_.useRef(null),p=_.useRef(null),[b,w]=_.useState({start:0,end:0}),[N,j]=_.useState(!1),[T,D]=_.useState(!1),[z,I]=_.useState(0),k=_.useMemo(()=>vx(e,b.start,b.end),[b.end,b.start,e]),P=_.useMemo(()=>bx(e,b.start,b.end),[b.end,b.start,e]),Q=N&&!o&&!!k&&!T,se=N&&!o&&!!P&&!T,W=se?"command":Q?"skill":null,V=wR(f,m,{enabled:Q}),Y=ax({enabled:se,scope:m?{agentId:m,projectId:f}:void 0}),ee=_.useMemo(()=>uR(V.data??[],(k==null?void 0:k.query)??"").slice(0,Lb),[k==null?void 0:k.query,V.data]),me=_.useMemo(()=>{var he;return dR(((he=Y.data)==null?void 0:he.commands)??[],(P==null?void 0:P.query)??"").slice(0,Lb)},[P==null?void 0:P.query,(ie=Y.data)==null?void 0:ie.commands]);_.useEffect(()=>{I(0)},[k==null?void 0:k.query,k==null?void 0:k.start,P==null?void 0:P.query,e,f]),_.useEffect(()=>{D(!1)},[k==null?void 0:k.query,k==null?void 0:k.start,k==null?void 0:k.end,P==null?void 0:P.query,P==null?void 0:P.start,P==null?void 0:P.end]);const ge=()=>{if(!S.current||!p.current)return;const he=S.current,re=p.current;re.scrollTop=he.scrollTop,re.scrollLeft=he.scrollLeft;const L=Math.max(0,he.offsetWidth-he.clientWidth);re.style.setProperty("--skill-aware-textarea-scrollbar-width",`${L}px`),re.style.setProperty("--skill-aware-textarea-padding-inline-end",window.getComputedStyle(he).paddingInlineEnd)};_.useEffect(()=>{ge()},[e]),_.useEffect(()=>{if(typeof window>"u"||typeof ResizeObserver>"u")return;const he=S.current;if(!he)return;const re=new ResizeObserver(()=>{ge()});return re.observe(he),ge(),()=>{re.disconnect()}},[]);const te=()=>{S.current&&w({start:S.current.selectionStart??0,end:S.current.selectionEnd??0})},xe=he=>{if(!S.current)return;const re=oR(e,S.current.selectionStart??b.start,S.current.selectionEnd??b.end,he.name);re&&(t(re.value),typeof window<"u"&&window.requestAnimationFrame(()=>{S.current&&(S.current.focus(),S.current.setSelectionRange(re.selectionStart,re.selectionEnd),w({start:re.selectionStart,end:re.selectionEnd}))}))},C=he=>{if(!S.current)return;const re=cR(e,S.current.selectionStart??b.start,S.current.selectionEnd??b.end,he.name);re&&(t(re.value),typeof window<"u"&&window.requestAnimationFrame(()=>{S.current&&(S.current.focus(),S.current.setSelectionRange(re.selectionStart,re.selectionEnd),w({start:re.selectionStart,end:re.selectionEnd}))}))},q=he=>{const re=W==="skill"&&ee.length>0||W==="command"&&me.length>0;if(W&&re){if(he.key==="ArrowDown"){he.preventDefault();const L=W==="command"?me.length:ee.length;I(ae=>(ae+1)%L);return}if(he.key==="ArrowUp"){he.preventDefault();const L=W==="command"?me.length:ee.length;I(ae=>ae-1<0?L-1:ae-1);return}if((he.key==="Enter"||he.key==="Tab")&&!he.shiftKey&&!he.altKey&&!he.ctrlKey&&!he.metaKey){if(he.preventDefault(),W==="command"){const ae=me[z]??me[0];if(!ae)return;C(ae);return}const L=ee[z]??ee[0];if(!L)return;xe(L);return}}if(W&&he.key==="Escape"){he.preventDefault(),D(!0);return}a==null||a(he)};return i.jsxs("div",{className:`skill-aware-textarea ${W?"is-picker-open":""} ${g?"is-fullscreen":""}`,children:[se?i.jsx("div",{className:"skill-mention-picker",role:"listbox","aria-label":"命令建议",children:Y.isLoading?i.jsx("div",{className:"skill-mention-picker__empty",children:"正在加载命令…"}):Y.isError?i.jsx("div",{className:"skill-mention-picker__empty",children:"命令列表加载失败"}):me.length===0?i.jsx("div",{className:"skill-mention-picker__empty",children:"未找到匹配命令"}):me.map((he,re)=>{const L=re===z;return i.jsx("button",{type:"button",className:`skill-mention-picker__item ${L?"is-active":""}`,role:"option","aria-selected":L,onMouseDown:ae=>{ae.preventDefault(),C(he)},onMouseEnter:()=>I(re),children:i.jsxs("span",{className:"skill-mention-picker__main",children:[i.jsxs("span",{className:"skill-mention-picker__name",children:["/",he.name]}),i.jsx("span",{className:"skill-mention-picker__description",children:he.description})]})},he.name)})}):Q?i.jsx("div",{className:"skill-mention-picker",role:"listbox","aria-label":"技能建议",children:V.isLoading?i.jsx("div",{className:"skill-mention-picker__empty",children:"正在加载技能…"}):V.isError?i.jsx("div",{className:"skill-mention-picker__empty",children:"技能列表加载失败"}):ee.length===0?i.jsx("div",{className:"skill-mention-picker__empty",children:"未找到匹配技能"}):ee.map((he,re)=>{const L=re===z;return i.jsx("button",{type:"button",className:`skill-mention-picker__item ${L?"is-active":""}`,role:"option","aria-selected":L,onMouseDown:ae=>{ae.preventDefault(),xe(he)},onMouseEnter:()=>I(re),children:i.jsxs("span",{className:"skill-mention-picker__main",children:[i.jsxs("span",{className:"skill-mention-picker__name",children:["$",he.name]}),i.jsx("span",{className:"skill-mention-picker__description",children:he.description}),i.jsx("span",{className:"skill-mention-picker__scope",children:lR(he.scope)})]})},`${he.scope}:${he.name}:${he.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?NR(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:he=>{t(he.target.value),D(!1),w({start:he.target.selectionStart??0,end:he.target.selectionEnd??0})},onKeyDown:q,onClick:te,onSelect:te,onKeyUp:te,onFocus:()=>{j(!0),D(!1),te()},onBlur:()=>{j(!1)},onScroll:ge})]})]})},Mg=()=>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"})]}),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:"M12 5v14"}),i.jsx("path",{d:"m7 14 5 5 5-5"})]}),ER=()=>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"})]}),CR=()=>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"})]}),Ub=()=>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"})}),zb=()=>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"})]}),Bb=()=>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"})]}),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:"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"})]}),xx=_.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:b,onToggleBackgroundAgents:w,onOpenSession:N,getBackgroundAgentStatusLabel:j,getBackgroundAgentAccent:T,formatBackgroundAgentsLabel:D,hasBackgroundAgentStrip:z,commandPanel:I,isCommandPanelPending:k,onDismissCommandPanel:P,onCommandPanelOptionSelect:Q,onCommandPanelTextSubmit:se,projectId:W=null,agentId:V=null,draft:Y,pendingAttachments:ee,canSendInput:me,canSubmitInput:ge=!0,isInputLocked:te=!1,inputPlaceholder:xe,readOnlyPlaceholder:C,onDraftChange:q,onUploadFiles:ie,onRemoveAttachment:he,onSubmit:re,showStopIcon:L,isSendPending:ae,onInterrupt:ke,isFastModeEnabled:U,isPlanModeEnabled:ve,isYoloModeEnabled:Z,onToggleFastMode:Se,onTogglePlanMode:je,onToggleYoloMode:Oe,showModeBadges:Ie=!1,selectedModel:wt,modelOptions:qe=[],selectedReasoning:bt,onSelectModel:Ut,onSelectReasoning:$t,contextUsage:zt,isContextUsageOpen:xt,onToggleContextUsage:it,contextUsageRingStyle:ot,usedPercent:ln,remainingPercent:on,usedTokensLabel:kn,totalTokensLabel:En,showJumpToBottom:ht,onJumpToBottom:Ve}){const Ke=_.useId(),[Nt,Bt]=_.useState(!1),[Jt,Dt]=_.useState(null),Ze=_.useRef(null),un=_.useRef(null),ut=f[0]??null,_e=(ut==null?void 0:ut.kind)==="user_input",Fe=f.length>0,X=!!b&&!_e,B=!_e&&z,oe=X||B,ue=Fe||X||B,we={transform:`translateX(${a}px)`,transition:l?"none":void 0},Re=(!!Y.trim()||ee.length>0)&&me&&ge&&!te&&!ae&&!L,He=me&&!te,ze=Ie&&(U||ve||Z),rt=()=>{Re&&(Dt(null),re())},It=Le=>{Le.key!=="Enter"||Le.shiftKey||Le.altKey||Le.ctrlKey||Le.metaKey||Le.nativeEvent.isComposing||typeof window<"u"&&window.matchMedia("(max-width: 768px)").matches||(Le.preventDefault(),rt())};_.useEffect(()=>{if(!Nt)return;const Le=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=Le}},[Nt]),_.useEffect(()=>{if(!Nt||typeof window>"u")return;const Le=window.matchMedia("(min-width: 769px)"),Et=()=>{Le.matches&&Bt(!1)};return Et(),typeof Le.addEventListener=="function"?(Le.addEventListener("change",Et),()=>{Le.removeEventListener("change",Et)}):(Le.addListener(Et),()=>{Le.removeListener(Et)})},[Nt]),_.useEffect(()=>{if(!Jt)return;const Le=Cn=>{const hs=Cn.target;Ze.current&&hs instanceof Node&&Ze.current.contains(hs)||Dt(null)},Et=Cn=>{Cn.key==="Escape"&&Dt(null)};return window.addEventListener("pointerdown",Le),window.addEventListener("keydown",Et),()=>{window.removeEventListener("pointerdown",Le),window.removeEventListener("keydown",Et)}},[Jt]);const Ft=Le=>ze?i.jsxs("div",{className:Le,"aria-label":"当前已启用的会话模式",children:[U?i.jsxs("button",{type:"button",className:"composer-mode-badge is-fast",onClick:()=>{Dt(null),Se()},"aria-label":"关闭 Fast 模式",children:[i.jsx("span",{className:"composer-mode-badge__icon","aria-hidden":"true",children:i.jsx(Ub,{})}),i.jsx("span",{className:"composer-mode-badge__label",children:"Fast"})]}):null,ve?i.jsxs("button",{type:"button",className:"composer-mode-badge is-plan",onClick:()=>{Dt(null),je()},"aria-label":"关闭计划模式",children:[i.jsx("span",{className:"composer-mode-badge__icon","aria-hidden":"true",children:i.jsx(zb,{})}),i.jsx("span",{className:"composer-mode-badge__label",children:"计划"})]}):null,Z?i.jsxs("button",{type:"button",className:"composer-mode-badge is-yolo",onClick:()=>{Dt(null),Oe()},"aria-label":"关闭 Yolo 模式",children:[i.jsx("span",{className:"composer-mode-badge__icon","aria-hidden":"true",children:i.jsx(Bb,{})}),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:we,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(Mg,{})})]}):null,Fe?i.jsx(bR,{requests:f,hasStripBelow:oe,pendingRequestId:m,onRespond:y}):null,X&&b?i.jsx(jR,{planSnapshot:b,hasStripAbove:Fe,hasStripBelow:B}):null,B&&g?i.jsxs("button",{type:"button",className:`background-agents-exit ${Fe||X?"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:"返回主会话"})]}):B&&S.length>0?i.jsxs("section",{className:`background-agents-card ${p?"is-open":""} ${Fe||X?"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:D(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(Le=>{var Et,Cn;return i.jsxs("button",{type:"button",className:`background-agent-row ${Le.run_state==="running"?"is-running":"is-idle"}`,style:{"--agent-accent":T(Le)},onClick:()=>{N(Le.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:((Et=Le.subagent)==null?void 0:Et.nickname)??Le.title}),i.jsxs("span",{className:"background-agent-row__role",children:["(",((Cn=Le.subagent)==null?void 0:Cn.role)??"agent",")"]})]}),i.jsx("span",{className:"background-agent-row__status",children:j(Le)})]}),i.jsx("span",{className:"background-agent-row__open",children:"Open"})]},Le.id)})}):null]}):null,I?i.jsx(SR,{panel:I,isPending:k,onDismiss:P,onSelectOption:Q,onSubmitText:se}):null,_e?null:i.jsxs("form",{className:`chat-composer ${ue?"is-attached-to-agent-strip":""}`,onSubmit:Le=>{Le.preventDefault(),rt()},children:[i.jsxs("div",{className:"chat-composer__editor",children:[ee.length>0?i.jsx("div",{className:"chat-composer__attachments",children:ee.map(Le=>{const Et=L0(Le.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:Le.name}),i.jsxs("span",{className:"chat-composer__attachment-meta",children:[Le.kind==="image"?"图片":"文件",Et?` · ${Et}`:""]})]}),i.jsx("button",{type:"button",className:"chat-composer__attachment-remove","aria-label":`移除 ${Le.name}`,onClick:()=>he(Le.id),children:i.jsx(Mg,{})})]},Le.id)})}):null,i.jsx(Pb,{className:"chat-composer__input",value:Y,disabled:!He,projectId:W,agentId:V,placeholder:He?xe??"要求后续变更":C??"当前会话为只读模式",onChange:q,onKeyDown:It}),i.jsx("button",{type:"button",className:"composer-fullscreen-toggle","aria-label":"全屏编辑",onClick:()=>Bt(!0),children:i.jsx(ER,{})}),i.jsx("input",{id:Ke,ref:un,type:"file",className:"chat-composer__file-input",multiple:!0,onChange:Le=>{Le.target.files&&Le.target.files.length>0&&ie(Le.target.files),Le.target.value=""}})]}),Ft("composer-mode-badges composer-mode-badges--mobile"),i.jsxs("div",{className:"chat-composer__toolbar",children:[i.jsxs("div",{ref:Ze,className:"chat-composer__controls",children:[i.jsxs("div",{className:`composer-utility-menu ${Jt==="utility"?"is-open":""}`,children:[i.jsx("button",{type:"button",className:"composer-utility-menu__trigger","aria-label":"打开额外功能","aria-expanded":Jt==="utility",onClick:()=>Dt(Le=>Le==="utility"?null:"utility"),children:i.jsx(CR,{})}),Jt==="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 Le;Dt(null),(Le=un.current)==null||Le.click()},children:[i.jsx("span",{className:"composer-utility-menu__item-icon","aria-hidden":"true",children:i.jsx(TR,{})}),i.jsx("span",{className:"composer-utility-menu__item-label",children:"上传文件"})]}),i.jsxs("button",{type:"button",className:"composer-utility-menu__item",role:"menuitemcheckbox","aria-checked":U,onClick:Se,children:[i.jsx("span",{className:"composer-utility-menu__item-icon","aria-hidden":"true",children:i.jsx(Ub,{})}),i.jsx("span",{className:"composer-utility-menu__item-label",children:"Fast 模式"}),i.jsx("span",{className:`composer-utility-menu__switch ${U?"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":ve,onClick:je,children:[i.jsx("span",{className:"composer-utility-menu__item-icon","aria-hidden":"true",children:i.jsx(zb,{})}),i.jsx("span",{className:"composer-utility-menu__item-label",children:"计划模式"}),i.jsx("span",{className:`composer-utility-menu__switch ${ve?"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":Z,onClick:Oe,children:[i.jsx("span",{className:"composer-utility-menu__item-icon","aria-hidden":"true",children:i.jsx(Bb,{})}),i.jsx("span",{className:"composer-utility-menu__item-label",children:"Yolo 模式"}),i.jsx("span",{className:`composer-utility-menu__switch ${Z?"is-on":""}`,"aria-hidden":"true",children:i.jsx("span",{className:"composer-utility-menu__switch-thumb"})})]})]}):null]}),i.jsxs("div",{className:`composer-choice ${Jt==="model"?"is-open":""}`,children:[i.jsxs("button",{type:"button",className:"composer-control","aria-label":"选择模型","aria-expanded":Jt==="model",onClick:()=>Dt(Le=>Le==="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:wp(wt,qe)})]}),Jt==="model"?i.jsx("div",{className:"composer-choice-menu",role:"menu","aria-label":"选择模型",children:qe.map(Le=>i.jsxs("button",{type:"button",className:`composer-choice-menu__item ${wt===Le.value?"is-active":""}`,role:"menuitemradio","aria-checked":wt===Le.value,onClick:()=>{Ut(Le.value),Dt(null)},children:[i.jsx("span",{className:"composer-choice-menu__text",children:i.jsx("span",{className:"composer-choice-menu__label",children:Le.label})}),wt===Le.value?i.jsx("span",{className:"composer-choice-menu__check",children:"✓"}):null]},Le.value))}):null]}),i.jsxs("div",{className:`composer-choice ${Jt==="reasoning"?"is-open":""}`,children:[i.jsxs("button",{type:"button",className:"composer-control","aria-label":"选择推理强度","aria-expanded":Jt==="reasoning",onClick:()=>Dt(Le=>Le==="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:rC(bt)})]}),Jt==="reasoning"?i.jsx("div",{className:"composer-choice-menu",role:"menu","aria-label":"选择推理强度",children:Xf.map(Le=>i.jsxs("button",{type:"button",className:`composer-choice-menu__item ${bt===Le.value?"is-active":""}`,role:"menuitemradio","aria-checked":bt===Le.value,onClick:()=>{$t(Le.value),Dt(null)},children:[i.jsx("span",{className:"composer-choice-menu__label",children:Le.label}),bt===Le.value?i.jsx("span",{className:"composer-choice-menu__check",children:"✓"}):null]},Le.value))}):null]}),Ft("composer-mode-badges composer-mode-badges--inline")]}),i.jsxs("div",{className:"chat-composer__actions",children:[zt?i.jsxs("div",{className:`composer-context ${xt?"is-open":""}`,children:[i.jsx("button",{type:"button",className:"composer-context__trigger","aria-label":"查看背景信息窗口使用情况",onClick:Le=>{Le.stopPropagation(),it()},children:i.jsx("span",{className:"composer-context__ring",style:ot,children:i.jsx("span",{className:"composer-context__ring-core"})})}),xt?i.jsxs("div",{className:"composer-context__popover",role:"tooltip",children:[i.jsx("div",{className:"composer-context__title",children:"背景信息窗口:"}),i.jsxs("div",{children:[ln,"% 已用(剩余 ",on,"%)"]}),i.jsxs("div",{children:["已用 ",kn,",共 ",En]})]}):null]}):null,i.jsx("button",{type:L?"button":"submit",className:"composer-send",disabled:L?!me:!Re,"aria-label":L?"中断":"发送",onClick:()=>{L&&ke()},children:L?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"})})})]})]})]})]}),Nt?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:()=>Bt(!1),children:i.jsx(Mg,{})})]}),i.jsx(Pb,{className:"composer-fullscreen-sheet__input",value:Y,disabled:!He,projectId:W,agentId:V,placeholder:He?xe??"要求后续变更":C??"当前会话为只读模式",onChange:q,onKeyDown:It,autoFocus:!0}),i.jsxs("div",{className:"composer-fullscreen-sheet__footer",children:[i.jsxs("div",{className:"composer-fullscreen-sheet__meta",children:[i.jsx("span",{children:wt}),i.jsx("span",{children:bt}),Z?i.jsx("span",{children:"Yolo"}):null,ee.length>0?i.jsxs("span",{children:[ee.length," 个附件"]}):null]}),i.jsxs("div",{className:"composer-fullscreen-sheet__actions",children:[i.jsx("button",{type:"button",className:"composer-fullscreen-sheet__button",onClick:()=>Bt(!1),children:"关闭"}),L?i.jsx("button",{type:"button",className:"composer-fullscreen-sheet__button is-primary",disabled:!me,onClick:ke,children:"中断"}):i.jsx("button",{type:"button",className:"composer-fullscreen-sheet__button is-primary",disabled:!Re,onClick:()=>{rt(),Bt(!1)},children:"发送"})]})]})]})}):null,ht?i.jsx("button",{type:"button",className:`conversation-jump-bottom ${t?"has-desktop-sidebar":""}`,style:we,onClick:Ve,"aria-label":"滚动到最下面",children:i.jsx(kR,{})}):null]})}),Hb=10,RR=e=>{const t=e.replace(/\s+/g," ").trim();return t.length<=Hb?t:t.slice(0,Hb).trimEnd()},MR=(e,t)=>{var l,o;const a=RR(e);return a||((o=(l=t[0])==null?void 0:l.name)==null?void 0:o.trim())||"附件"},AR=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())??""},DR=({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(),[b,w]=_.useState(""),[N,j]=_.useState(l),[T,D]=_.useState(null),[z,I]=_.useState(null),[k,P]=_.useState(()=>R_()),[Q,se]=_.useState(()=>F3()),[W,V]=_.useState([]),[Y,ee]=_.useState(!1),[me,ge]=_.useState(!1),[te,xe]=_.useState(!1),[C,q]=_.useState(o),ie=O_(),he=_.useMemo(()=>ie.map(({id:Z,...Se})=>Se),[ie]),re=_.useMemo(()=>t.find(Z=>Z.id===N)??t[0]??null,[t,N]);_.useEffect(()=>{zf(k)},[k]),_.useEffect(()=>{q3(Q)},[Q]),_.useEffect(()=>{he.length!==0&&(he.some(Z=>Z.value===k)||P(he[0].value))},[he,k]),_.useEffect(()=>{q(o)},[o]),_.useEffect(()=>{I(null)},[N]),_.useEffect(()=>{var Se,je;if(N&&t.some(Oe=>Oe.id===N))return;const Z=(l&&t.some(Oe=>Oe.id===l)?l:null)??((Se=a.find(Oe=>!Oe.archived))==null?void 0:Se.project_id)??((je=t[0])==null?void 0:je.id)??null;j(Z)},[l,t,N,a]);const L=Vn({mutationFn:async Z=>{if(!re||!Z.input.trim()&&Z.attachments.length===0)throw new Error("请先选择线程,再输入第一条消息");return(await(await wn({projectId:Z.projectId,agentId:e.id})).client.createSession({agentId:e.id,projectId:Z.projectId,title:Z.title,input:Z.input,attachments:Z.attachments,model:Z.model,titleGenerationModel:Z.titleGenerationModel,reasoningEffort:Z.reasoningEffort,serviceTier:Z.serviceTier,planMode:Z.planMode,yoloMode:Z.yoloMode})).session},onMutate:()=>D(null),onSuccess:async(Z,Se)=>{const je=new Date().toISOString(),Oe={id:`optimistic-user:${Z.id}:create`,kind:"user",title:"你",body:Se.input,body_truncated:!1,detail_available:!1,patch_summary:null,session_ids:[],timestamp:Z.last_event_at||je,accent:"primary",attachments:_x(Se.attachments)};Ji(e.id),Js(Z.id),iC(Z.id,{isFastModeEnabled:Se.serviceTier==="fast",isPlanModeEnabled:Se.planMode,isYoloModeEnabled:Se.yoloMode}),Kr(Z.id),ku(null),fk({sessionId:Z.id,agentId:Z.agent_id,projectId:Z.project_id,createdAt:je,session:Z,project:re?{id:re.id,agent_id:re.agent_id,name:re.name,display_name:re.display_name,pinned:re.pinned,path:re.path}:null,optimisticEntry:Oe}),p.setQueriesData({queryKey:os},Ie=>j3(Ie,Z)),p.setQueryData(Fo(Z.id),Ie=>O0(Ie,Oe)),ee(!1),ge(!1),xe(!1),S(Z.id),p.invalidateQueries({queryKey:["plan",Z.id]}),p.invalidateQueries({queryKey:["change-sets",Z.id]})},onError:Z=>{D(Z instanceof Error?Z.message:"创建会话失败")}}),ae=(re==null?void 0:re.path)??null,ke=C==="directory-picker",U={transform:`translateX(${f}px)`,transition:m?"none":void 0},ve=()=>{const Z=b.trim();if(!(!Z&&W.length===0||L.isPending||!re)){if(z_(Z)){if(W.length>0){D("命令暂不支持附件,请先移除附件后再执行。");return}const Se=AR(Z);if(Se==="model"){if(w(""),he.length>0){I({panel_id:`new-thread-command-${Date.now()}`,session_id:`new-thread:${re.id}`,command_name:Se,command_text:Z,title:"为新会话选择模型",description:"选择后会更新新会话的默认模型,再继续输入真正的首条消息。",status:"awaiting_input",body:"在下面选择一个模型。",submitted_at:new Date().toISOString(),updated_at:new Date().toISOString(),input_type:"choice",options:he.map(je=>({id:je.value,label:je.label,description:je.description??null})),input_placeholder:null,submit_label:null,effect:null});return}I({panel_id:`new-thread-command-${Date.now()}`,session_id:`new-thread:${re.id}`,command_name:Se,command_text:Z,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(Se==="status"){w(""),I({panel_id:`new-thread-command-${Date.now()}`,session_id:`new-thread:${re.id}`,command_name:Se,command_text:Z,title:"新会话当前设置",description:"这里展示的是创建下一条会话时会使用的本地设置。",status:"completed",body:[`线程:${re.display_name??re.name}`,`模型:${k}`,`推理强度:${Q}`,`Fast 模式:${Y?"开启":"关闭"}`,`计划模式:${me?"开启":"关闭"}`,`Yolo 模式:${te?"开启":"关闭"}`].join(`
|
|
141
|
+
`),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:${re.id}`,command_name:Se||"unknown",command_text:Z,title:`/${Se||"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}L.mutate({projectId:re.id,input:Z,title:MR(Z,W),attachments:W,model:k,titleGenerationModel:$3(),reasoningEffort:Q,serviceTier:Y?"fast":void 0,planMode:me,yoloMode:te})}};return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:`conversation-main conversation-main--new-thread ${u?"has-desktop-sidebar":""}`,style:U,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:ke?i.jsx(mR,{agentId:e.id,projects:t,title:"选择目录",subtitle:"",onProjectCreated:Z=>{p.setQueriesData({queryKey:os},Se=>_E(Se,Z)),j(Z.id),g(Z.id),q("composer")}}):i.jsx("section",{className:"new-thread-hero",children:i.jsxs("div",{className:"new-thread-hero__stack",children:[i.jsx(gR,{}),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:Z=>{const Se=Z.target.value||null;j(Se),Se&&g(Se)},children:t.map(Z=>i.jsx("option",{value:Z.id,children:Z.display_name??Z.name},Z.id))})]}),ae?i.jsx("div",{className:"new-thread-hero__path",children:ae}):i.jsx("div",{className:"new-thread-hero__hint",children:"选择一个线程后,直接输入第一条消息即可开始。"}),u?null:i.jsx("button",{type:"button",className:"new-thread-hero__directory-trigger",onClick:()=>q("directory-picker"),children:"新增目录线程"})]})})})})]}),ke?null:i.jsx(xx,{isDesktopSidebar:u,sidebarShift:f,isSidebarDragging:m,composerError:T,onDismissComposerError:()=>D(null),interactionRequests:[],pendingInteractionRequestId:null,onRespondInteraction:()=>{},parentSession:null,backgroundAgentSessions:[],isBackgroundAgentsOpen:!1,planSnapshot:null,onToggleBackgroundAgents:()=>{},onOpenSession:()=>{},getBackgroundAgentStatusLabel:()=>"",getBackgroundAgentAccent:()=>"var(--color-accent-primary)",formatBackgroundAgentsLabel:Z=>`${Z} background agents`,hasBackgroundAgentStrip:!1,commandPanel:z,isCommandPanelPending:!1,onDismissCommandPanel:()=>I(null),onCommandPanelOptionSelect:Z=>{P(Z),I(Se=>Se&&{...Se,status:"completed",body:`新会话默认模型已切换为 ${wp(Z,he)}。现在可以继续输入真正的首条消息。`,updated_at:new Date().toISOString(),input_type:"none",options:[]})},onCommandPanelTextSubmit:()=>{},projectId:(re==null?void 0:re.id)??null,agentId:e.id,draft:b,pendingAttachments:W,canSendInput:!!re,inputPlaceholder:re?`向 ${re.display_name??re.name} 发起第一条任务…`:"先选择线程,再输入第一条任务",readOnlyPlaceholder:"先选择线程,再输入第一条任务",onDraftChange:w,onUploadFiles:Z=>{const Se=[...Z];Se.length!==0&&(D(null),Promise.all(Se.map(je=>gx(je))).then(je=>{V(Oe=>[...Oe,...je])}).catch(je=>{D(je instanceof Error?je.message:"无法读取附件")}))},onRemoveAttachment:Z=>{V(Se=>Se.filter(je=>je.id!==Z))},onSubmit:ve,showStopIcon:!1,isSendPending:L.isPending,onInterrupt:()=>{},isFastModeEnabled:Y,isPlanModeEnabled:me,isYoloModeEnabled:te,onToggleFastMode:()=>ee(Z=>!Z),onTogglePlanMode:()=>ge(Z=>!Z),onToggleYoloMode:()=>xe(Z=>!Z),showModeBadges:!0,selectedModel:k,modelOptions:he,selectedReasoning:Q,onSelectModel:P,onSelectReasoning:Z=>se(Z),contextUsage:null,isContextUsageOpen:!1,onToggleContextUsage:()=>{},usedPercent:0,remainingPercent:0,usedTokensLabel:"0",totalTokensLabel:"0",showJumpToBottom:!1,onJumpToBottom:()=>{}})]})},Sx="panda:session-timeline-snapshots",Wm=1,OR=1440*60*1e3,jx=12,IR=e=>{if(typeof window>"u")return null;try{const t=window.localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}},LR=(e,t)=>{if(!(typeof window>"u"))try{window.localStorage.setItem(e,JSON.stringify(t))}catch{}},wx=()=>{const e=IR(Sx);if(!e||e.version!==Wm||!Array.isArray(e.items))return{version:Wm,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<=OR).sort((l,o)=>o.storedAt-l.storedAt).slice(0,jx);return{version:Wm,items:a}},PR=e=>{const a=wx().items.find(l=>l.sessionId===e);return a?a.snapshot:null},UR=e=>{if(!e||e.view!=="full_compact")return;const t=Date.now(),a=wx(),l=[{sessionId:e.session_id,storedAt:t,snapshot:e},...a.items.filter(o=>o.sessionId!==e.session_id)].slice(0,jx);LR(Sx,{version:Wm,items:l})},zR=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 BR(e){return ls({queryKey:zR(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 wn(e.scope)).client.getSessionToolCallDetail(e.sessionId,e.entryId),refetchInterval:!1,refetchOnMount:!1,refetchOnWindowFocus:!1,retry:1})}const Nx=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 HR(e){return ls({queryKey:Nx(e),enabled:!!((e==null?void 0:e.enabled)??!0)&&!!(e!=null&&e.sessionId),queryFn:async()=>e!=null&&e.sessionId?(await wn(e.scope)).client.getWorkspaceSessionDetail(e.sessionId):null,refetchInterval:!1,refetchOnMount:!1,refetchOnWindowFocus:!1,retry:1})}const $R={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},FR=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:$R}),qR=(e,t)=>e?!t||t.id!==e.id?FR(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,$b=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},WR=(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}},Fb=_.lazy(async()=>({default:(await Zr(()=>import("./session-diff-preview-DwKy91Si.js"),__vite__mapDeps([0,1]))).SessionDiffPreview})),Ag=["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)"],kx=14,Ex=10,Ul=24,gu=48,Dg=()=>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"})}),KR=()=>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"})]}),QR=()=>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"})]}),qb=()=>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"})]}),Wb=()=>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"})]}),GR=()=>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"})]}),YR=()=>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"})]}),VR=()=>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"})]}),ZR=()=>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"})]}),XR=()=>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"})}),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("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"})]}),zl=({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})}),Kb=e=>{switch(e){case"added":return"A";case"deleted":return"D";case"renamed":return"R";case"untracked":return"U";default:return"M"}},eM=e=>e.status==="renamed"&&e.previous_path?`该变更仅包含重命名:${e.previous_path} -> ${e.path}`:e.status==="deleted"?"该文件已删除,没有可展示的补丁内容。":e.status==="untracked"?"该文件还没有可展示的补丁内容。":"此变更没有可展示的补丁内容。",tM=(e,t)=>t&&t.diff.trim()?"此变更没有可展示的补丁内容。":e.status==="renamed"&&e.previous_path?`该提交仅包含重命名:${e.previous_path} -> ${e.path}`:e.status==="deleted"?"该文件在这次提交中已删除,没有可展示的补丁内容。":"该文件在这次提交中没有可展示的补丁内容。",jf=e=>Ag[e%Ag.length]??Ag[0],zo=e=>Ex+e*kx,Tm=(e,t)=>`${e}\0${t}`,B_=e=>Array.isArray(e.parent_oids)?e.parent_oids.filter(Boolean):[],nM=e=>Array.isArray(e.refs)?e.refs.filter(Boolean):[],sM=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(B_(f))],p=y.map(w=>({...w}));S.length>0?p[m]={oid:S[0],colorIndex:g}:p.splice(m,1);const b=[];if(S.length>0){const w=p.findIndex(N=>N.oid===S[0]);b.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()})),b.push(j)}),t[f.oid]={beforeLanes:y,afterLanes:p,laneIndex:m,nodeColorIndex:g,parentLaneIndexes:b},a=p.filter((w,N,j)=>j.findIndex(T=>T.oid===w.oid)===N)}return t},aM=({commit:e,row:t,isLocalHead:a,isRemoteHead:l,isFirstRow:o,maxLaneCount:u})=>{const f=B_(e).length,m=Math.max(u,t.beforeLanes.length,t.afterLanes.length,1),y=Math.max(40,Ex*2+(m-1)*kx),g=zo(t.laneIndex),S=f>1?4.7:3.9,p=Math.max(0,Ul-S-1.1),b={"--session-git-graph-width":`${Math.max(48,Math.ceil(y*(56/gu)))}px`};return i.jsx("span",{className:"session-git-history__graph",style:b,children:i.jsxs("svg",{className:`session-git-history__graph-svg ${f>1?"is-merge":""}`,viewBox:`0 0 ${y} ${gu}`,preserveAspectRatio:"xMinYMid meet","aria-hidden":"true",children:[t.beforeLanes.map((w,N)=>i.jsx("path",{d:`M ${zo(N)} ${o?p:0} L ${zo(N)} ${p}`,stroke:jf(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?zo(j):zo(N),D=zo(N),z=T===D?`M ${D} ${Ul} L ${D} ${gu}`:`M ${T} ${Ul} C ${T} 27 ${D} 31 ${D} ${gu}`;return i.jsx("path",{d:z,stroke:jf(w.colorIndex),strokeWidth:"2",strokeLinecap:"round",fill:"none"},`after:${w.oid}:${N}`)}),t.parentLaneIndexes.map((w,N)=>{var z;const j=zo(w),T=jf(((z=t.afterLanes[w])==null?void 0:z.colorIndex)??t.nodeColorIndex),D=j===g?`M ${g} ${Ul} L ${j} ${gu}`:`M ${g} ${Ul} C ${g} 27 ${j} 31 ${j} ${gu}`;return i.jsx("path",{d:D,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:Ul,r:S,fill:"var(--color-surface-panel)",stroke:jf(t.nodeColorIndex),strokeWidth:f>1?"1.8":"1.55"}),i.jsx("circle",{cx:g,cy:Ul,r:a||l?1.6:1.05,fill:jf(t.nodeColorIndex)}),a&&l?i.jsx("circle",{cx:g,cy:Ul,r:"6.4",fill:"none",stroke:"color-mix(in oklab, var(--color-accent-primary) 22%, transparent)",strokeWidth:"1",strokeDasharray:"1.5 3"}):null]})})},iM=({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:b,onPush:w,onLoadWorkspaceFileDiff:N,onLoadHistoryFileDiff:j,pendingAction:T,compact:D=!1})=>{const[z,I]=_.useState("changes"),[k,P]=_.useState({}),[Q,se]=_.useState({}),[W,V]=_.useState({}),[Y,ee]=_.useState({}),[me,ge]=_.useState({}),[te,xe]=_.useState({}),[C,q]=_.useState({}),[ie,he]=_.useState({}),[re,L]=_.useState({}),[ae,ke]=_.useState(!1),[U,ve]=_.useState(null),[Z,Se]=_.useState(""),[je,Oe]=_.useState(null),Ie=_.useRef(null);_.useEffect(()=>{P(Fe=>{if(!(e!=null&&e.files.length))return{};const X=new Set(e.files.map(ue=>ue.path));let B=!1;const oe={};for(const[ue,we]of Object.entries(Fe)){if(!X.has(ue)){B=!0;continue}oe[ue]=we}return B?oe:Fe});const _e=new Set((e==null?void 0:e.files.map(Fe=>Fe.path))??[]);se(Fe=>{let X=!1;const B={};for(const[oe,ue]of Object.entries(Fe)){if(!_e.has(oe)){X=!0;continue}B[oe]=ue}return X?B:Fe}),V(Fe=>{let X=!1;const B={};for(const[oe,ue]of Object.entries(Fe)){if(!_e.has(oe)){X=!0;continue}B[oe]=ue}return X?B:Fe}),ee(Fe=>{let X=!1;const B={};for(const[oe,ue]of Object.entries(Fe)){if(!_e.has(oe)){X=!0;continue}B[oe]=ue}return X?B:Fe})},[e==null?void 0:e.files]),_.useEffect(()=>{const _e=new Set((t==null?void 0:t.commits.map(X=>X.oid))??[]),Fe=new Set((t==null?void 0:t.commits.flatMap(X=>X.files.map(B=>Tm(X.oid,B.path))))??[]);ge(X=>{let B=!1;const oe={};for(const[ue,we]of Object.entries(X)){if(!_e.has(ue)){B=!0;continue}oe[ue]=we}return B?oe:X}),xe(X=>{let B=!1;const oe={};for(const[ue,we]of Object.entries(X)){if(!_e.has(ue)){B=!0;continue}if(we&&!Fe.has(Tm(ue,we))){B=!0,oe[ue]=null;continue}oe[ue]=we}return B?oe:X}),q(X=>{let B=!1;const oe={};for(const[ue,we]of Object.entries(X)){if(!Fe.has(ue)){B=!0;continue}oe[ue]=we}return B?oe:X}),he(X=>{let B=!1;const oe={};for(const[ue,we]of Object.entries(X)){if(!Fe.has(ue)){B=!0;continue}oe[ue]=we}return B?oe:X}),L(X=>{let B=!1;const oe={};for(const[ue,we]of Object.entries(X)){if(!Fe.has(ue)){B=!0;continue}oe[ue]=we}return B?oe:X})},[t==null?void 0:t.commits]),_.useEffect(()=>{if(!ae)return;const _e=Fe=>{var X;(X=Ie.current)!=null&&X.contains(Fe.target)||ke(!1)};return window.addEventListener("pointerdown",_e),()=>{window.removeEventListener("pointerdown",_e)}},[ae]),_.useEffect(()=>{e&&(U==="commit"&&(T==null?void 0:T.action)!=="commit-all"&&e.files.length===0&&(ve(null),Se("")),je&&e.branch===je&&(Oe(null),ve(null),Se(""),ke(!1)))},[U,T==null?void 0:T.action,je,e]),_.useEffect(()=>{e!=null&&e.branches.length||ke(!1)},[e==null?void 0:e.branches]),_.useEffect(()=>{se({}),V({}),ee({})},[e==null?void 0:e.updated_at]);const wt=(e==null?void 0:e.files)??[],qe=(t==null?void 0:t.commits)??[],bt=wt.length>0,Ut=qe.length>0,$t=(T==null?void 0:T.action)==="discard-all",zt=(T==null?void 0:T.action)==="commit-all",xt=(T==null?void 0:T.action)==="switch-branch",it=(T==null?void 0:T.action)==="push",ot=z==="changes",ln=U==="switch-branch"&&je?`提交后切换到 ${je}`:"提交全部改动",on=_.useMemo(()=>{if(!e)return null;const _e=[];return e.upstream_branch&&_e.push(e.upstream_branch),e.ahead_count>0&&_e.push(`ahead ${e.ahead_count}`),e.behind_count>0&&_e.push(`behind ${e.behind_count}`),_e.join(" · ")},[e]),kn=_.useMemo(()=>{if(!t)return null;const _e=[t.branch];return t.upstream_branch&&_e.push(t.upstream_branch),_e.join(" · ")},[t]),En=_.useMemo(()=>z==="history"?sM(qe):{},[z,qe]),ht=_.useMemo(()=>z!=="history"?1:Math.max(1,...Object.values(En).map(_e=>Math.max(_e.beforeLanes.length,_e.afterLanes.length,_e.laneIndex+1))),[z,En]),Ve=(_e,Fe)=>{Q[_e]||W[_e]||(V(X=>({...X,[_e]:!0})),ee(X=>{const B={...X};return delete B[_e],B}),N(_e,Fe).then(X=>{se(B=>({...B,[_e]:X}))}).catch(X=>{ee(B=>({...B,[_e]:X instanceof Error?X.message:"无法读取该文件的差异。"}))}).finally(()=>{V(X=>{const B={...X};return delete B[_e],B})}))};_.useEffect(()=>{if(!(z!=="changes"||wt.length===0))for(const _e of wt)k[_e.path]&&Ve(_e.path,_e.previous_path)},[z,k,wt,N,Q,W]);const Ke=()=>{ve(null),Se(""),Oe(null)},Nt=()=>{Oe(null),ve(_e=>_e==="commit"?(Se(""),null):"commit")},Bt=()=>{const _e=Z.trim();if(_e){if(U==="switch-branch"&&je){Promise.resolve(b(je,_e)).catch(()=>{});return}p(_e)}},Jt=_e=>{if(!(!e||_e===e.branch||T)){if(ke(!1),e.files.length>0){Oe(_e),ve("switch-branch");return}Promise.resolve(b(_e)).catch(()=>{})}},Dt=()=>{if(ot){f();return}m()},Ze=()=>{I(_e=>{const Fe=_e==="changes"?"history":"changes";return Fe==="history"&&y(),Fe})},un=(_e,Fe)=>{const X=Tm(_e.oid,Fe.path),B=te[_e.oid]===Fe.path;xe(oe=>({...oe,[_e.oid]:B?null:Fe.path})),!(B||C[X]||ie[X])&&(he(oe=>({...oe,[X]:!0})),L(oe=>{const ue={...oe};return delete ue[X],ue}),j(_e.oid,Fe.path,Fe.previous_path).then(oe=>{q(ue=>({...ue,[X]:oe}))}).catch(oe=>{L(ue=>({...ue,[X]:oe instanceof Error?oe.message:"无法读取该文件的提交差异。"}))}).finally(()=>{he(oe=>{const ue={...oe};return delete ue[X],ue})}))},ut=_e=>{const Fe=new Date(_e);return Number.isNaN(Fe.getTime())?_e:new Intl.DateTimeFormat("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(Fe)};return i.jsxs("section",{className:`session-git-panel ${D?"is-compact":""}`,children:[i.jsxs("div",{className:"session-git-panel__header",children:[i.jsxs("div",{className:"session-git-panel__heading",ref:Ie,children:[i.jsxs("button",{type:"button",className:"session-git-panel__branch-button",onClick:()=>ke(_e=>!_e),disabled:!e||!!T,"aria-haspopup":"menu","aria-expanded":ae,title:e?`切换分支:${e.branch}`:"分支加载中",children:[i.jsx("span",{className:"session-git-panel__branch-icon","aria-hidden":"true",children:i.jsx(VR,{})}),i.jsx("span",{className:"session-git-panel__branch",children:(e==null?void 0:e.branch)??"加载中"}),i.jsx("span",{className:`session-git-panel__branch-chevron ${ae?"is-open":""}`,"aria-hidden":"true",children:i.jsx(Dg,{})})]}),ae&&e?i.jsx("div",{className:"session-git-panel__branch-menu",role:"menu","aria-label":"分支列表",children:e.branches.map(_e=>{const Fe=_e===e.branch,X=(T==null?void 0:T.action)==="switch-branch"&&T.branch===_e;return i.jsxs("button",{type:"button",className:`session-git-panel__branch-option ${Fe?"is-current":""}`,onClick:()=>Jt(_e),disabled:Fe||!!T,role:"menuitemradio","aria-checked":Fe,title:Fe?`${_e}(当前)`:`切换到 ${_e}`,children:[i.jsx("span",{className:"session-git-panel__branch-option-name",children:_e}),Fe?i.jsx("span",{className:"session-git-panel__branch-option-meta",children:"当前"}):null,X?i.jsx("span",{className:"session-git-panel__branch-option-meta",children:"切换中"}):null]},_e)})}):null]}),i.jsxs("div",{className:"session-git-panel__toolbar",children:[i.jsx(zl,{label:ot?"切换到提交历史":"返回修改列表",icon:i.jsx(QR,{}),onClick:Ze,disabled:!!T,variant:ot?"default":"primary",className:ot?void 0:"is-active"}),i.jsx(zl,{label:ot?a?"正在刷新":"刷新":l?"正在刷新历史":"刷新历史",icon:i.jsx(KR,{}),onClick:Dt,disabled:ot?a||!!T:l,pending:ot?a:l}),ot&&bt?i.jsxs(i.Fragment,{children:[i.jsx(zl,{label:$t?"正在撤回全部修改":"撤回全部修改",icon:i.jsx(qb,{}),onClick:S,disabled:!!T,variant:"danger",pending:$t}),i.jsx(zl,{label:zt?"正在提交全部修改":U==="commit"?"收起提交编辑器":"提交全部修改",icon:i.jsx(Wb,{}),onClick:Nt,disabled:!!T,variant:"primary",pending:zt})]}):null,ot&&!bt?i.jsx(zl,{label:it?"正在推送当前分支":"推送当前分支",icon:i.jsx(GR,{}),onClick:w,disabled:!!T,variant:"primary",pending:it}):null]})]}),ot&&e?i.jsxs("div",{className:"session-git-panel__summary",children:[i.jsx("span",{className:"session-git-panel__summary-text",children:bt?`${wt.length} 个文件待处理`:"当前工作区没有待提交改动"}),on?i.jsx("span",{className:"session-git-panel__summary-meta",children:on}):null]}):null,!ot&&t?i.jsxs("div",{className:"session-git-panel__summary",children:[i.jsx("span",{className:"session-git-panel__summary-text",children:Ut?`${qe.length} 条最近提交`:"当前分支还没有提交历史"}),kn?i.jsx("span",{className:"session-git-panel__summary-meta",children:kn}):null]}):null,ot&&U&&bt?i.jsxs("div",{className:"session-git-panel__composer",children:[i.jsx("div",{className:"session-git-panel__composer-title",children:ln}),i.jsxs("div",{className:"session-git-panel__composer-row",children:[i.jsx("input",{value:Z,onChange:_e=>Se(_e.target.value),placeholder:"输入 commit message",className:"session-git-panel__input",disabled:!!T}),i.jsx(zl,{label:U==="switch-branch"?"提交并切换分支":"确认提交",icon:i.jsx(Wb,{}),onClick:Bt,disabled:!Z.trim()||!!T,variant:"primary",pending:zt||xt}),i.jsx(zl,{label:"取消提交",icon:i.jsx(YR,{}),onClick:Ke,disabled:!!T})]})]}):null,ot&&o?i.jsx("div",{className:"session-git-panel__notice is-error",children:o}):null,!ot&&u?i.jsx("div",{className:"session-git-panel__notice is-error",children:u}):null,ot&&a&&!e?i.jsx("div",{className:"session-git-panel__empty",children:"正在读取当前工作区改动…"}):null,!ot&&l&&!t?i.jsx("div",{className:"session-git-panel__empty",children:"正在读取当前分支提交历史…"}):null,ot&&!a&&e&&!bt?i.jsx("div",{className:"session-git-panel__empty",children:"当前分支没有待提交改动。你现在可以直接推送当前分支。"}):null,!ot&&!l&&t&&!Ut?i.jsx("div",{className:"session-git-panel__empty",children:"当前分支还没有提交历史。"}):null,ot&&bt?i.jsx("div",{className:"session-git-panel__list",children:wt.map(_e=>{const Fe=!!k[_e.path],X=(T==null?void 0:T.action)==="discard-file"&&T.path===_e.path,B=Q[_e.path],oe=!!W[_e.path],ue=Y[_e.path]??null;return i.jsxs("article",{className:`session-git-file ${Fe?"is-expanded":""}`,children:[i.jsxs("div",{className:"session-git-file__head",children:[i.jsxs("button",{type:"button",className:"session-git-file__toggle",onClick:()=>{const we=!Fe;P(Re=>({...Re,[_e.path]:we})),we&&Ve(_e.path,_e.previous_path)},"aria-expanded":Fe,children:[i.jsxs("span",{className:"session-git-file__main",children:[i.jsx("span",{className:"session-git-file__path",children:_e.path}),_e.previous_path?i.jsxs("span",{className:"session-git-file__rename",children:["来自 ",_e.previous_path]}):null]}),i.jsxs("span",{className:"session-git-file__meta",children:[i.jsx("span",{className:`session-git-file__status is-${_e.status}`,children:Kb(_e.status)}),i.jsxs("span",{className:"session-git-file__counts",children:[i.jsxs("span",{className:"is-add",children:["+",_e.additions]}),i.jsxs("span",{className:"is-remove",children:["-",_e.deletions]})]}),i.jsx("span",{className:"session-git-file__chevron","aria-hidden":"true",children:i.jsx(Dg,{})})]})]}),i.jsx(zl,{label:X?`正在撤回 ${_e.path}`:`撤回 ${_e.path}`,icon:i.jsx(qb,{}),onClick:()=>g(_e.path),disabled:!!T,variant:"danger",pending:X,className:"session-git-file__action"})]}),Fe?i.jsx("div",{className:"session-git-file__detail",children:ue?i.jsx("div",{className:"session-git-panel__notice is-error",children:ue}):oe?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(Fb,{diffText:(B==null?void 0:B.diff)??"",filePath:_e.path,emptyMessage:eM(_e)})})}):null]},_e.path)})}):null,!ot&&Ut?i.jsx("div",{className:"session-git-history",children:qe.map((_e,Fe)=>{const X=!!me[_e.oid],B=B_(_e),oe=te[_e.oid]??null,ue=En[_e.oid],we=(t==null?void 0:t.head_oid)===_e.oid,Re=(t==null?void 0:t.upstream_head_oid)===_e.oid,He=nM(_e).filter(ze=>!ze||ze===(t==null?void 0:t.branch)||ze===(t==null?void 0:t.upstream_branch)||ze===`HEAD -> ${t==null?void 0:t.branch}`?!1:ze!=="HEAD");return i.jsxs("article",{className:`session-git-history__item ${X?"is-expanded":""} ${B.length>1?"is-merge":""} ${we?"is-local-head":""} ${Re?"is-remote-head":""}`.trim(),children:[i.jsxs("button",{type:"button",className:"session-git-history__toggle",onClick:()=>ge(ze=>({...ze,[_e.oid]:!ze[_e.oid]})),"aria-expanded":X,children:[ue?i.jsx(aM,{commit:_e,row:ue,isLocalHead:we,isRemoteHead:Re,isFirstRow:Fe===0,maxLaneCount:ht}):null,i.jsxs("span",{className:"session-git-history__content",children:[i.jsx("span",{className:"session-git-history__subject",children:_e.subject}),i.jsxs("span",{className:"session-git-history__meta",children:[i.jsx("span",{children:_e.short_oid}),i.jsx("span",{children:_e.author_name}),i.jsx("span",{children:ut(_e.committed_at)})]})]}),i.jsxs("span",{className:"session-git-history__refs",children:[we?i.jsx("span",{className:"session-git-history__ref is-local",title:"本地当前 HEAD",children:i.jsx(ZR,{})}):null,Re?i.jsx("span",{className:"session-git-history__ref is-remote",title:t!=null&&t.upstream_branch?`云端位置:${t.upstream_branch}`:"云端位置",children:i.jsx(XR,{})}):null,B.length>1?i.jsx("span",{className:"session-git-history__ref is-merge",title:"合并提交",children:i.jsx(JR,{})}):null,He.slice(0,2).map(ze=>i.jsx("span",{className:"session-git-history__ref is-label",title:ze,children:ze},`${_e.oid}:${ze}`))]}),i.jsx("span",{className:"session-git-history__chevron","aria-hidden":"true",children:i.jsx(Dg,{})})]}),X?i.jsx("div",{className:"session-git-history__files",children:i.jsx("div",{className:"session-git-history__files-list",children:_e.files.map(ze=>{const rt=oe===ze.path,It=Tm(_e.oid,ze.path),Ft=C[It],Le=!!ie[It],Et=re[It]??null;return i.jsxs("div",{className:`session-git-history-file-row ${rt?"is-selected":""}`,children:[i.jsxs("button",{type:"button",className:`session-git-history-file ${rt?"is-selected":""}`,onClick:()=>un(_e,ze),"aria-pressed":rt,children:[i.jsx("span",{className:`session-git-file__status is-${ze.status}`,children:Kb(ze.status)}),i.jsx("span",{className:"session-git-history-file__path",children:ze.path}),ze.previous_path?i.jsxs("span",{className:"session-git-history-file__rename",children:["来自 ",ze.previous_path]}):null,i.jsx("span",{className:"session-git-history-file__meta",children:Ft?i.jsxs("span",{className:"session-git-history-file__counts",children:[i.jsxs("span",{className:"is-add",children:["+",Ft.additions]}),i.jsxs("span",{className:"is-remove",children:["-",Ft.deletions]})]}):Le?i.jsx("span",{className:"session-git-history-file__loading",children:"读取中…"}):i.jsx("span",{className:"session-git-history-file__hint",children:"点击查看"})})]}),rt?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:ze.path}),ze.previous_path?i.jsxs("span",{className:"session-git-history__diff-rename",children:["来自 ",ze.previous_path]}):null]}),Et?i.jsx("div",{className:"session-git-panel__notice is-error",children:Et}):Le?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(Fb,{diffText:(Ft==null?void 0:Ft.diff)??"",filePath:ze.path,emptyMessage:tM(ze,Ft??null)})})]}):null]},`${_e.oid}:${ze.path}`)})})}):null]},_e.oid)})}):null]})},Qb={name:"",description:null,command:"",kill_command:null,cwd:null,shell:"auto",node_version:null,port:null},Gb=()=>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"})}),Yb=()=>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"})}),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("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"})]}),lM=()=>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"})]}),oM=()=>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"})]}),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 5v14"}),i.jsx("path",{d:"M5 12h14"})]}),Vb={auto:"自动",powershell:"PowerShell",cmd:"CMD",bash:"Bash"},uM=({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:b,onRunAll:w,onRunAllKill:N,onRunKill:j,onSave:T,onDelete:D,onGenerate:z})=>{var xe;const[I,k]=_.useState("list"),[P,Q]=_.useState(null),[se,W]=_.useState(Qb),V=_.useMemo(()=>e.find(C=>C.id===P)??null,[e,P]),Y=_.useMemo(()=>{const C=[...(t==null?void 0:t.versions)??[]];return se.node_version&&!C.includes(se.node_version)&&C.unshift(se.node_version),C},[se.node_version,t==null?void 0:t.versions]),ee=_.useMemo(()=>e.filter(C=>!!C.kill_command).length,[e]),me=()=>{W(Qb),Q(null),k("edit")},ge=C=>{W({name:C.name,description:C.description,command:C.command,kill_command:C.kill_command,cwd:C.cwd,shell:C.shell,node_version:C.node_version,port:C.port}),Q(C.id),k("edit")},te=()=>{T({commandId:V==null?void 0:V.id,draft:se}),f||(k("list"),Q(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(Gb,{})}),i.jsx("button",{type:"button",className:"session-run-panel__icon-button is-warning","aria-label":g?"正在一键停止项目命令":"一键停止项目命令",title:g?"正在一键停止项目命令":"一键停止项目命令",disabled:ee===0||y||g,onClick:N,children:i.jsx(Yb,{})}),i.jsx("button",{type:"button",className:`session-run-panel__icon-button ${m?"is-loading":""}`,"aria-label":m?"正在一键生成项目命令":"一键生成项目命令",title:m?"正在一键生成项目命令":"一键生成项目命令","aria-busy":m,disabled:m||y||g,onClick:z,children:i.jsx(rM,{})}),i.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":"新增项目命令",title:"新增项目命令",onClick:me,children:i.jsx(cM,{})})]})]}),a?i.jsx("div",{className:"session-run-panel__notice is-error",children:a}):null,m?i.jsx("div",{className:"session-run-panel__notice is-loading",role:"status","aria-live":"polite",children:"正在分析项目并生成推荐命令…"}):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:V?"编辑命令":"新增命令"}),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:se.name,onChange:C=>W(q=>({...q,name:C.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:se.description??"",onChange:C=>W(q=>({...q,description:C.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:se.command,onChange:C=>W(q=>({...q,command:C.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:se.kill_command??"",onChange:C=>W(q=>({...q,kill_command:C.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:se.cwd??"",onChange:C=>W(q=>({...q,cwd:C.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:se.port??"",onChange:C=>{const q=Number.parseInt(C.target.value,10);W(ie=>({...ie,port:Number.isFinite(q)&&q>0?q: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:se.shell,onChange:C=>W(q=>({...q,shell:C.target.value})),className:"session-run-panel__select",children:Object.entries(Vb).map(([C,q])=>i.jsx("option",{value:C,children:q},C))})]}),i.jsxs("label",{className:"session-run-panel__field",children:[i.jsx("span",{children:"Node 环境"}),i.jsxs("select",{value:se.node_version??"",onChange:C=>W(q=>({...q,node_version:C.target.value||null})),className:"session-run-panel__select",children:[i.jsx("option",{value:"",children:"默认环境"}),Y.map(C=>i.jsxs("option",{value:C,children:["Node ",C,t!=null&&t.versions.includes(C)?"":"(未检测到)"]},C))]})]})]}),i.jsx("div",{className:"session-run-panel__hint",children:t!=null&&t.versions.length?"Node 版本只会临时注入当前命令,不会修改系统全局环境。":((xe=t==null?void 0:t.error)==null?void 0:xe.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:()=>k("list"),children:"取消"}),i.jsx("button",{type:"button",className:"session-run-panel__primary-button",disabled:!se.name.trim()||!se.command.trim()||f,onClick:te,children:f?"保存中...":V?"保存修改":"保存命令"})]})]}):null,i.jsx("div",{className:"session-run-panel__list",children:e.length>0?e.map(C=>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:()=>ge(C),children:[i.jsxs("div",{className:"session-run-panel__command-heading",children:[i.jsx("span",{className:"session-run-panel__command-name",children:C.name}),C.description?i.jsx("span",{className:"session-run-panel__command-description",children:C.description}):null]}),i.jsx("div",{className:"session-run-panel__command-line",children:C.command})]}),i.jsxs("div",{className:"session-run-panel__command-actions",children:[C.kill_command?i.jsx("button",{type:"button",className:"session-run-panel__icon-button is-warning","aria-label":`执行 ${C.name} 的停止命令`,title:`执行 ${C.name} 的停止命令`,disabled:o===C.id,onClick:()=>j(C.id),children:i.jsx(Yb,{})}):null,i.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":`编辑 ${C.name}`,title:`编辑 ${C.name}`,onClick:()=>ge(C),children:i.jsx(lM,{})}),i.jsx("button",{type:"button",className:"session-run-panel__icon-button is-danger","aria-label":`删除 ${C.name}`,title:`删除 ${C.name}`,disabled:u===C.id,onClick:()=>D(C.id),children:i.jsx(oM,{})}),i.jsx("button",{type:"button",className:"session-run-panel__icon-button is-primary","aria-label":`运行 ${C.name}`,title:`运行 ${C.name}`,disabled:l===C.id,onClick:()=>b(C.id),children:i.jsx(Gb,{})})]})]}),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:Vb[C.shell]}),C.node_version?i.jsxs("span",{className:"session-run-panel__command-pill is-node",children:["Node ",C.node_version]}):null,C.port?i.jsxs("span",{className:"session-run-panel__command-pill",children:[":",C.port]}):null,C.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:C.cwd?C.cwd:"项目根目录"})]})})]},C.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:"可以手动新增,或直接点击一键生成。"})]})})]})},Zb={name:"",description:null,url:""},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:"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"})]}),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("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"})]}),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"})]}),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:"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"})]}),pM=()=>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"})]}),gM=({websites:e,error:t,pendingDeleteWebsiteId:a,isSaving:l,isGenerating:o,generationReason:u,executionModelLabel:f,onOpen:m,onSave:y,onDelete:g,onGenerate:S})=>{const[p,b]=_.useState("list"),[w,N]=_.useState(null),[j,T]=_.useState(Zb),D=_.useMemo(()=>e.find(P=>P.id===w)??null,[w,e]),z=()=>{T(Zb),N(null),b("edit")},I=P=>{T({name:P.name,description:P.description,url:P.url}),N(P.id),b("edit")},k=()=>{y({websiteId:D==null?void 0:D.id,draft:j}),l||(b("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 ${o?"is-loading":""}`,"aria-label":o?"正在一键生成项目网页":"一键生成项目网页",title:o?"正在一键生成项目网页":"一键生成项目网页","aria-busy":o,disabled:o,onClick:S,children:i.jsx(dM,{})}),i.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":"新增项目网页",title:"新增项目网页",onClick:z,children:i.jsx(pM,{})})]})]}),t?i.jsx("div",{className:"session-run-panel__notice is-error",children:t}):null,o?i.jsx("div",{className:"session-run-panel__notice is-loading",role:"status","aria-live":"polite",children:"正在分析项目并生成推荐网页…"}):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:D?"编辑网页":"新增网页"}),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:P=>T(Q=>({...Q,name:P.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:P=>T(Q=>({...Q,description:P.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:P=>T(Q=>({...Q,url:P.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:()=>b("list"),children:"取消"}),i.jsx("button",{type:"button",className:"session-run-panel__primary-button",disabled:!j.name.trim()||!j.url.trim()||l,onClick:k,children:l?"保存中...":D?"保存修改":"保存网页"})]})]}):null,i.jsx("div",{className:"session-run-panel__list",children:e.length>0?e.map(P=>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(P),children:[i.jsxs("div",{className:"session-run-panel__command-heading",children:[i.jsx("span",{className:"session-run-panel__command-name",children:P.name}),P.description?i.jsx("span",{className:"session-run-panel__command-description",children:P.description}):null]}),i.jsx("div",{className:"session-run-panel__command-line",children:P.url})]}),i.jsxs("div",{className:"session-run-panel__command-actions",children:[i.jsx("a",{className:"session-run-panel__icon-button is-primary","aria-label":`打开 ${P.name}`,title:`打开 ${P.name}`,href:P.url,target:"_blank",rel:"noreferrer",onClick:()=>m(P),children:i.jsx(fM,{})}),i.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":`编辑 ${P.name}`,title:`编辑 ${P.name}`,onClick:()=>I(P),children:i.jsx(hM,{})}),i.jsx("button",{type:"button",className:"session-run-panel__icon-button is-danger","aria-label":`删除 ${P.name}`,title:`删除 ${P.name}`,disabled:a===P.id,onClick:()=>g(P.id),children:i.jsx(mM,{})})]})]}),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:"网页"})})})]},P.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:"可以手动新增,或直接点击一键生成。"})]})})]})},_M=/\u001b\[([0-9;]*)m/g,yM={stdout:"",stderr:"stderr",system:"system"},Xb={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"},U0={fg:null,bg:null,bold:!1,dim:!1,underline:!1},vM=()=>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"})]}),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:"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"})]}),xM=()=>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"})]}),SM=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)},Jb=(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(" ")},jM=(e,t)=>{if(t===0)return{...U0};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=Xb[t];if(a)return{...e,fg:a};const l=Xb[t-10];return l&&t>=40?{...e,bg:l}:e},wM=(e,t)=>{const a=[];let l=0,o={...U0};for(const u of e.matchAll(_M)){const f=u.index??0;f>l&&a.push({text:e.slice(l,f),className:Jb(t,o)});const m=(u[1]??"").split(";").map(y=>Number.parseInt(y||"0",10)).filter(y=>Number.isFinite(y));m.length===0?o={...U0}:o=m.reduce(jM,o),l=f+u[0].length}return l<e.length&&a.push({text:e.slice(l),className:Jb(t,o)}),a.length===0&&a.push({text:e,className:t}),a},Cx=_.memo(({chunks:e})=>{const t=_.useMemo(()=>e.map(a=>{const l=yM[a.stream],o=["session-terminal-output__segment",`is-${a.stream}`].join(" ");return{cursor:a.cursor,label:l,segments:wM(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))})});Cx.displayName="TerminalOutput";const NM=({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,b=p?a[p.id]:null;return _.useEffect(()=>{const w=S.current;w&&(w.scrollTop=w.scrollHeight)},[b==null?void 0:b.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:SM(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(vM,{})})]},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(xM,{}):i.jsx(bM,{})}):null]}),p?i.jsxs(i.Fragment,{children:[l?i.jsx("div",{className:"session-terminal-panel__notice is-error",children:l}):null,b!=null&&b.error?i.jsx("div",{className:"session-terminal-panel__notice is-error",children:b.error}):null,b!=null&&b.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:b&&b.chunks.length>0?i.jsx(Cx,{chunks:b.chunks}):b!=null&&b.isLoading?i.jsx("span",{className:"session-terminal-output__placeholder",children:"正在读取终端输出..."}):i.jsx("span",{className:"session-terminal-output__placeholder",children:"这个终端暂时还没有输出。"})})})]}):null]})},kM=_.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:b,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:D=>{D.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"&&b.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:b.state==="recovering"?"恢复会话中...":"会话恢复失败"})}),b.state==="failed"&&b.error?i.jsx("div",{className:"connection-status__tooltip",role:"tooltip",children:b.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]})})]})}),EM="panda:last-session-id",CM=.4,TM=104,RM=1800*1e3,MM=15e3,AM=120*1e3,e2=1100,Tx="panda:desktop-sidebar-width",Mf="panda:desktop-sidebar-width-version",Af="2026-03-24-narrow",DM=300,Rx=232,_u=Rx,OM=460,t2=72,Og=72,n2=120,z0=54,s2=300,IM=640,LM=4200,Ig="local-model-panel:",PM=160,UM={id:"",agent_id:"",name:"",display_name:null,pinned:!1,path:""},zM={id:"",agent_id:"",project_id:"",archived:!1,title:"",last_event_at:"",pinned:!1,run_state:"idle",run_state_changed_at:null,subagent:null},BM={...zM,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}},HM=(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}},$M={session_id:"",generated_at:"",view:"tail",anchor_entry_id:null,has_earlier_entries:!1,entries:[]},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("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"})]}),a2=()=>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"})]}),i2=()=>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"})}),qM=()=>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"})]}),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:"m9 18-6-6 6-6"}),i.jsx("path",{d:"m15 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("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"})]}),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("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"})]}),GM=()=>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"})}),YM=()=>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"})]}),VM=()=>i.jsx(uT,{"aria-hidden":"true",strokeWidth:1.9}),r2=()=>i.jsx(hT,{"aria-hidden":"true",strokeWidth:1.9}),Bo=12,ZM=_.memo(function({isActive:t,label:a,path:l,tokenKey:o,onToggle:u}){const f=_.useRef(null),m=_.useRef(null),[y,g]=_.useState(void 0);return _.useEffect(()=>{if(!t){g(void 0);return}const S=()=>{const b=f.current,w=m.current;if(!b||!w)return;const N=b.getBoundingClientRect(),j=typeof window<"u"?window.innerWidth:document.documentElement.clientWidth,T=typeof window<"u"?window.innerHeight:document.documentElement.clientHeight,D=Math.max(220,Math.min(520,j-Bo*2));w.style.width=`${D}px`,w.style.maxWidth=`${D}px`;const z=w.getBoundingClientRect(),I=Math.min(Math.max(N.left,Bo),Math.max(Bo,j-Bo-D)),k=N.top-z.height-8,P=k>=Bo?k:Math.min(N.bottom+8,T-Bo-z.height);g({left:`${I}px`,top:`${Math.max(Bo,P)}px`,width:`${D}px`,maxWidth:`${D}px`})},p=window.requestAnimationFrame(S);return window.addEventListener("resize",S),document.addEventListener("scroll",S,!0),()=>{window.cancelAnimationFrame(p),window.removeEventListener("resize",S),document.removeEventListener("scroll",S,!0)}},[t,l]),i.jsxs("span",{ref:f,className:`conversation-inline-link ${t?"is-active":""}`,children:[i.jsx("span",{role:"button",tabIndex:0,className:"conversation-inline-link__button",onClick:S=>{S.stopPropagation(),u()},onKeyDown:S=>{S.key!=="Enter"&&S.key!==" "||(S.preventDefault(),S.stopPropagation(),u())},children:a}),t&&typeof document<"u"?Ya.createPortal(i.jsx("span",{ref:m,className:"conversation-inline-link__tooltip",role:"tooltip",style:y,children:l}),document.body):null]},o)}),l2=(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)},XM=800,H_=(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>XM){const u=e.keys().next().value;u&&e.delete(u)}return o},JM=new Map,eA=new Map,tA=new Map,B0=()=>Zr(()=>import("./session-diff-preview-DwKy91Si.js"),__vite__mapDeps([0,1])),nA=_.lazy(async()=>({default:(await B0()).SessionDiffPreview})),H0=(e,t,a)=>i.jsx(_.Suspense,{fallback:i.jsx("div",{className:"patch-file-card__empty",children:"正在载入差异详情…"}),children:i.jsx(nA,{diffText:e,filePath:t,emptyMessage:a})}),sA=e=>i.jsx("span",{className:"conversation-inline-link",children:i.jsx("span",{className:"conversation-inline-link__button",title:e,children:Mx(e)})}),aA=/<proposed_plan>([\s\S]*?)<\/proposed_plan>/g,iA=e=>H_(JM,e,()=>yx(e)),eh=e=>e.replace(/\\/g,"/"),rA=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),lA=e=>{var l,o;const t=/^\s*(\d+)\.\s+(.+)$/.exec(e);if(t)return{ordered:!0,ordinal:Number.parseInt(t[1]??"",10),text:((l=t[2])==null?void 0:l.trim())??""};const a=/^\s*[-*]\s+(.+)$/.exec(e);return a?{ordered:!1,ordinal:null,text:((o=a[1])==null?void 0:o.trim())??""}:null},oA=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())??""},cA=e=>e.kind==="system"&&e.title==="context_compacted",o2=e=>e>=1e3?`${Math.round(e/1e3)}k`:String(Math.round(e)),uA=e=>H_(eA,e,()=>{var m;const t=e.replace(/\r\n/g,`
|
|
142
|
+
`).split(`
|
|
143
|
+
`),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(let y=0;y<t.length;y+=1){const g=t[y],S=/^\s{0,3}(```+|~~~+)[ \t]*([^`]*)$/.exec(g);if(S){u(),f();const w=S[1]??"```",N=(S[2]??"").trim(),j=N?((m=N.split(/\s+/,1)[0])==null?void 0:m.toLowerCase())??null:null,T=new RegExp(`^\\s{0,3}${rA(w)}\\s*$`),D=[];for(y+=1;y<t.length&&!T.test(t[y]??"");)D.push(t[y]??""),y+=1;a.push({kind:"code",rawInfo:N,language:j,content:D.join(`
|
|
144
|
+
`)});continue}const p=/^\s{0,3}(#{1,6})\s+(.+?)\s*$/.exec(g),b=lA(g);if(p){u(),f(),a.push({kind:"heading",level:p[1].length,text:p[2].replace(/\s+#+\s*$/,"").trim()});continue}if(b){u(),(!o||o.ordered!==b.ordered)&&(f(),o={ordered:b.ordered,items:[]}),o.items.push({text:b.text,ordinal:b.ordinal});continue}if(!g.trim()){u();continue}f(),l.push(g)}return u(),f(),a}),dA=e=>H_(tA,e,()=>{const t=[];let a=0;e.replace(aA,(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}),fA=e=>{const t=e.files.filter(a=>!!a.item_id);return t.length>0?t:e.files.filter(a=>!a.item_id)},c2=(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:Gr(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:Gr(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:"此变更没有可展示的补丁内容"}})},Km=(e,t,a)=>`${e}:${a??"summary"}:${t}`,Lg=e=>`turn-summary:${e}`,u2=(e,t)=>`${e}:${t}`,hA=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},d2=(e,t,a)=>({session_id:e,generated_at:new Date().toISOString(),view:"tail",anchor_entry_id:hA(t),has_earlier_entries:a,entries:t}),$_=e=>Array.isArray(e),Rm=e=>$_(e)?e:Array.isArray(e==null?void 0:e.entries)?e.entries:[],Mm=e=>$_(e)?!1:(e==null?void 0:e.has_earlier_entries)??!1,Pg=e=>$_(e)?"tail":(e==null?void 0:e.view)??"tail",mA=(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))},pA=e=>`${e} background agent${e===1?"":"s"}`,gA=e=>e.startsWith("Reconnecting...")?"retrying":"error",_A=e=>e.startsWith("Reconnecting...")?"Codex 重连中":"Codex 运行异常",Mx=e=>{const t=eh(e).replace(/\/+$/,""),a=t.split("/");return a[a.length-1]||t},f2=e=>`${e.kind}\0${e.title}\0${e.body}\0${e.accent}`,yA=(e,t)=>{if(!t||t.length===0||e.length===0)return e;let a=0;for(;a<e.length&&a<t.length&&f2(e[a])===f2(t[a]);)a+=1;return a<=0||a>=e.length?e:e.slice(a)},vA=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},Ug=["#2f72d8","#d06a3b","#2d9b7f","#8c62d9","#bf5b7f","#b78b2d"],Ax=e=>{const t=(e??"").trim();if(!t)return Ug[0];let a=0;for(let l=0;l<t.length;l+=1)a=a*31+t.charCodeAt(l)>>>0;return Ug[a%Ug.length]},bA=e=>{var t;return Ax(((t=e.subagent)==null?void 0:t.nickname)??e.title??e.id)},Dx=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},xA=e=>{var a;const t=Dx(e);return t<0?null:((a=e[t])==null?void 0:a.timestamp)??null},SA=e=>{const t=Dx(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},jA=e=>e.run_state==="running"?"is working":e.run_state==="completed"?"completed":"is awaiting instruction",Ox=1e4,wf=1200,Ix=e=>new Set(((e==null?void 0:e.files)??[]).map(t=>eh(t.path))),Lx=(e,t)=>{if(t.size===0)return 0;let a=0;for(const l of e.files)t.has(eh(l.path))&&(a+=1);return a},wA=(e,t,a)=>{const l=+new Date(t);if(!Number.isFinite(l))return!1;const o=Ix(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)>Ox?!1:o.size===0?!0:Lx(u,o)>0})},NA=(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`},Gr=(e,t)=>{const a=eh(e),l=t?eh(t).replace(/\/+$/,""):"";return l&&a.toLowerCase().startsWith(`${l.toLowerCase()}/`)?a.slice(l.length+1):a},Px=(e,t)=>!e||e.files.length===0?null:{files:e.files.map(a=>({path:a.path,displayPath:Gr(a.path,t),operation:"update",additions:a.additions,deletions:a.deletions,diffText:""})),additions:e.additions,deletions:e.deletions},Ux=(e,t)=>{const a=e.split(/\r?\n/),l=[];let o=null,u=[];const f=()=>{o&&(l.push({...o,diffText:u.join(`
|
|
145
|
+
`).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:Gr(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:Gr(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:Gr(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)}},kA=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(`
|
|
146
|
+
`),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)}},Am=(e,t=TM)=>{const a=e.replace(/\s+/g," ").trim();return a.length<=t?a:`${a.slice(0,t-1).trimEnd()}…`},F_=e=>{try{return JSON.parse(e)}catch{return null}},EA=e=>{const t=F_(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 Am(o)}}return e.title&&e.title!=="tool-output"?e.body.trim().startsWith("{")||e.body.trim().startsWith("[")?Am(e.title.replace(/-/g," ")):Am(e.body||e.title):Am(e.body||"工具执行")},CA=e=>{if(e.title==="apply_patch")return e.body.trim();const t=F_(e.body);return t&&typeof t.command=="string"&&t.command.trim()?t.command.trim():e.body.trim()||e.title},TA=e=>e.map(t=>{const a=F_(t.body);return a&&typeof a.output=="string"?a.output.trim():t.body.trim()}).filter(Boolean).join(`
|
|
147
|
+
|
|
148
|
+
`),RA=e=>e.kind==="entry"&&e.entry.kind==="user",zx=e=>e.kind==="entry"&&e.entry.kind==="assistant",MA=e=>RA(e)||zx(e),AA=e=>e.kind==="tool-group"?!0:e.entry.kind==="assistant"||e.entry.kind==="thinking"||e.entry.kind==="tool",DA=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},OA=e=>`展开 ${e.length} 条过程消息`,IA=e=>`收起 ${e.length} 条过程消息`,LA=(e,t)=>{const a=DA(e.items),{completion:l}=e,o=a.findLastIndex(m=>zx(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(MA(m)){u.push(m);return}f.push(m)}}),{id:e.id,startedAt:e.startedAt,visibleStartItems:u,hiddenItems:f,visibleEndItems:[a[o]],completion:l}},PA=(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:LA(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&&!AA(m)){f(),l.push(m);continue}o.items.push(m);continue}l.push(m)}return f(),u(),a},UA=e=>e.run_state!=="running"&&Date.now()-new Date(e.last_event_at).getTime()>=RM,zA=(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 b=e[p];if(b.kind==="system"&&b.body==="开始处理请求"){o.push({kind:"turn-start",id:b.id,startedAt:b.timestamp}),m=b.timestamp,y=[];continue}if(b.kind==="system"&&b.body==="处理完成"){o.push({kind:"turn-complete",id:b.id,durationLabel:NA(m,b.timestamp),patchSummary:kA(y),completedAt:b.timestamp}),m=null,y=[];continue}if(b.kind==="tool"&&b.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=b.id;const j=b.title==="apply_patch"?Px(b.patch_summary,a)??Ux(b.body,a):null;j&&y.push(j),w.length===0&&(f=!0),o.push({kind:"tool-group",group:{id:b.id,commandEntry:b,outputEntries:w,patchSummary:j}}),p=N-1;continue}if(b.kind==="tool"&&b.title==="tool-output"){o.push({kind:"tool-group",group:{id:b.id,commandEntry:b,outputEntries:[],patchSummary:null}}),u=b.id;continue}o.push({kind:"entry",entry:b})}return{blocks:PA(o,l),lastToolGroupId:u,hasRunningToolGroup:f}},BA=e=>e.kind==="entry"?e.entry.timestamp:e.group.commandEntry.timestamp,HA=(e,t)=>{var f,m;const a=[...e.visibleStartItems,...e.hiddenItems,...e.visibleEndItems].map(BA).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}},$A=(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-wf:null),u=t.nextStartMs??(t.endMs!==null?t.endMs+wf:Number.POSITIVE_INFINITY);return o!==null&&a<o-wf?!1:a<=u+wf?!0:l!==null&&l<=u+wf},FA=(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},qA=(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,D;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=HA(f.turn,y),S=((T=f.turn.completion)==null?void 0:T.patchSummary)??null,p=Ix(S),w=((D=a.filter(z=>!l.has(z.id)).map(z=>({changeSet:z,overlapCount:Lx(z,p),updatedAtDistance:FA(z,g.endMs)})).filter(z=>z.overlapCount>0&&z.updatedAtDistance<=Ox).sort((z,I)=>I.overlapCount!==z.overlapCount?I.overlapCount-z.overlapCount:z.changeSet.source!==I.changeSet.source?z.changeSet.source==="app-server"?-1:1:z.updatedAtDistance!==I.updatedAtDistance?z.updatedAtDistance-I.updatedAtDistance:+new Date(z.changeSet.started_at)-+new Date(I.changeSet.started_at))[0])==null?void 0:D.changeSet)??a.find(z=>l.has(z.id)?!1:$A(z,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)),$0=e=>Math.max(Rx,Math.min(OM,e)),KA=()=>{if(typeof window>"u")return _u;try{const e=window.localStorage.getItem(Tx),t=window.localStorage.getItem(Mf);if(!e)return window.localStorage.setItem(Mf,Af),_u;const a=Number(e);if(!Number.isFinite(a))return window.localStorage.setItem(Mf,Af),_u;const o=t!==Af||a===DM||a>_u?_u:a;return window.localStorage.setItem(Mf,Af),$0(o)}catch{return _u}};function Dm({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 QA=_.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=BR({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"?Ux(g.body,l)??Px(g.patch_summary,l)??a.patchSummary:a.patchSummary,b=CA(g),w=TA(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}`,D=!!o[T];return i.jsxs("div",{className:`tool-entry tool-entry--patch-file ${D?"is-expanded":""}`,children:[i.jsxs("button",{type:"button",className:"tool-entry__toggle",onClick:()=>N(T),"aria-expanded":D,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:sA(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"})})})]}),D?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:H0(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:H0(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:b})]}),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]})}),GA=_.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:b,pendingProposedPlanReplyEntryId:w,canRespondToProposedPlan:N,onProposedPlanReplyDraftChange:j,onSubmitProposedPlanReply:T,onPreviewImage:D,changeSetDiffs:z,changeSetDiffErrors:I,loadingChangeSetDiffKeys:k,onLoadSessionChangeSets:P,onLoadChangeSetFileDiff:Q,onLoadFullTimeline:se,timelineLoadState:W,canRollbackChangeSets:V,pendingRollbackTurnId:Y,rollbackTurnError:ee,rolledBackTurnIds:me,onRollbackTurn:ge}){const[te,xe]=_.useState({}),[C,q]=_.useState({}),[ie,he]=_.useState({}),[re,L]=_.useState(null),[ae,ke]=_.useState(null),[U,ve]=_.useState(null),Z=_.useRef(null),Se=_.useRef(null),je=_.useMemo(()=>{var X;return((X=[...f].reverse().find(B=>B.kind==="turn"&&!!B.turn.completion))==null?void 0:X.turn.id)??null},[f]);_.useEffect(()=>{const X=B=>{const oe=B.target;oe instanceof Element&&oe.closest(".conversation-inline-link")||L(null)};return window.addEventListener("pointerdown",X),()=>{window.removeEventListener("pointerdown",X)}},[]),_.useEffect(()=>()=>{Z.current!==null&&window.clearTimeout(Z.current),Se.current!==null&&window.clearTimeout(Se.current)},[]);const Oe=X=>{xe(B=>({...B,[X]:!B[X]}))},Ie=X=>{q(B=>({...B,[X]:!B[X]}))},wt=X=>{he(B=>({...B,[X]:!B[X]}))};_.useEffect(()=>{var B;const X=new Map;for(const oe of f){if(oe.kind!=="turn")continue;const ue=oe.changeSet;if(!ue||ue.status!=="completed"||ue.files.length===0)continue;const we=Lg(oe.turn.id),Re=c2(ue,u,((B=oe.turn.completion)==null?void 0:B.patchSummary)??null);for(const He of Re){if(!He.changeSetId||!He.diffAvailable)continue;const ze=u2(we,He.path);if(!ie[ze])continue;const rt=Km(He.changeSetId,He.path,He.itemId);z[rt]||k[rt]||X.set(rt,{changeSetId:He.changeSetId,path:He.path,itemId:He.itemId??null})}}for(const oe of X.values())Q(oe)},[z,ie,k,Q,u,f]);const qe=async X=>{var ue;const B=X.trim();if(!B)return!1;const oe=()=>{const we=document.createElement("textarea");we.value=B,we.setAttribute("readonly","true"),we.style.position="fixed",we.style.opacity="0",we.style.pointerEvents="none",document.body.appendChild(we),we.select(),document.execCommand("copy"),document.body.removeChild(we)};try{return(ue=navigator.clipboard)!=null&&ue.writeText?await navigator.clipboard.writeText(B):oe(),!0}catch{return!1}},bt=async(X,B)=>{await qe(B)&&(ke(X),Z.current!==null&&window.clearTimeout(Z.current),Z.current=window.setTimeout(()=>{ke(ue=>ue===X?null:ue),Z.current=null},1400))},Ut=async(X,B)=>{await qe(B)&&(ve(X),Se.current!==null&&window.clearTimeout(Se.current),Se.current=window.setTimeout(()=>{ve(ue=>ue===X?null:ue),Se.current=null},1400))};function $t(X,B,oe){return H0(X,B,oe)}function zt(X,B,oe){const ue=re===oe,we=()=>{L(Re=>Re===oe?null:oe)};return i.jsx(ZM,{isActive:ue,label:X,path:B,tokenKey:oe,onToggle:we},oe)}function xt(X,B,oe=Gr(X,u)){return zt(Mx(oe),oe,B)}function it(X,B){return iA(X).map((ue,we)=>{const Re=`${B}-${we}`;return ue.kind==="text"?i.jsx("span",{children:ue.value},Re):ue.kind==="code"?i.jsx("code",{className:"conversation-inline-code",children:ue.value},Re):ue.kind==="strong"?i.jsx("strong",{children:it(ue.value,`${Re}-strong`)},Re):ue.kind==="emphasis"?i.jsx("em",{children:it(ue.value,`${Re}-emphasis`)},Re):ue.kind==="skill"?i.jsx("span",{className:"conversation-skill-token",children:ue.raw},Re):ue.kind==="command"?i.jsx("span",{className:"conversation-command-token",children:ue.raw},Re):zt(ue.label,ue.path,Re)})}function ot(X,B){return uA(X).map((ue,we)=>{const Re=`${B}-block-${we}`;if(ue.kind==="heading"){const He=Math.min(ue.level,3),ze=He===1?"h1":He===2?"h2":"h3";return i.jsx(ze,{className:`conversation-markdown-heading is-level-${He}`,children:it(ue.text,`${Re}-heading`)},Re)}if(ue.kind==="list"){const He=ue.ordered?"ol":"ul";return i.jsx(He,{className:"conversation-markdown-list",children:ue.items.map((ze,rt)=>i.jsx("li",{value:ue.ordered?ze.ordinal??void 0:void 0,children:it(ze.text,`${Re}-item-${rt}`)},`${Re}-item-${rt}`))},Re)}if(ue.kind==="code"){const He=`${Re}-meta`;return i.jsxs("div",{className:"conversation-markdown-code-block",children:[ue.rawInfo?i.jsxs("div",{className:"conversation-markdown-code-block__meta",children:[i.jsx("span",{className:"conversation-markdown-code-block__meta-label",children:ue.rawInfo}),i.jsxs("button",{type:"button",className:`conversation-markdown-code-block__copy ${U===He?"is-copied":""}`,onClick:()=>{Ut(He,ue.content)},"aria-label":U===He?"已复制代码块内容":"复制代码块内容",children:[i.jsx("span",{className:"conversation-markdown-code-block__copy-icon","aria-hidden":"true",children:U===He?i.jsx(i2,{}):i.jsx(a2,{})}),i.jsx("span",{className:"sr-only",children:U===He?"已复制":"复制"})]})]}):null,i.jsx("pre",{className:"conversation-markdown-code-block__pre",children:i.jsx("code",{children:ue.content})})]},Re)}return i.jsx("p",{className:"conversation-markdown-paragraph",children:ue.lines.map((He,ze)=>i.jsxs("span",{children:[ze>0?i.jsx("br",{}):null,it(He,`${Re}-line-${ze}`)]},`${Re}-line-${ze}`))},Re)})}function ln(X,B,oe){const ue=`${X.id}:proposed-plan:${oe}`,we=b[ue]??"",Re=w===ue,He=!N||Re;return i.jsxs("div",{className:"proposed-plan-card",children:[i.jsx("div",{className:"proposed-plan-card__content",children:ot(B,`${ue}: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:He,onClick:()=>{T(ue,"是,实施此计划")},children:Re?"回复中…":"是,实施此计划"}),i.jsxs("div",{className:"proposed-plan-card__custom",children:[i.jsx("input",{type:"text",className:"proposed-plan-card__input",value:we,disabled:He,placeholder:"否,请告知如何调整",onChange:ze=>{j(ue,ze.target.value)},onKeyDown:ze=>{ze.key!=="Enter"||!we.trim()||He||(ze.preventDefault(),T(ue,we))}}),i.jsx("button",{type:"button",className:"proposed-plan-card__submit",disabled:He||!we.trim(),onClick:()=>{T(ue,we)},children:Re?"回复中…":"回复"})]})]})]})]},ue)}function on(X){const B=dA(X.body);return B.some(ue=>ue.kind==="proposed-plan")?B.map((ue,we)=>{const Re=`${X.id}-content-${we}`;return ue.kind==="markdown"?i.jsx("div",{className:"conversation-entry__rich-block",children:ot(ue.content,Re)},Re):ln(X,ue.content,we)}):ot(X.body,X.id)}function kn(X){const B=I6([],X.attachments);if(B.length===0)return null;const oe=B.filter(Tb),ue=B.filter(we=>!Tb(we));return i.jsxs("div",{className:"conversation-entry__attachments",children:[oe.length>0?i.jsx("div",{className:"conversation-entry__attachment-grid",children:oe.map(we=>{const Re=L0(we.size_bytes),He=we.name??"图片",ze=`图片${Re?` · ${Re}`:""}`,rt=i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"conversation-entry__attachment-media",children:we.content_url?i.jsxs(i.Fragment,{children:[i.jsx("img",{src:we.content_url,alt:He,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:He}),i.jsx("span",{className:"conversation-entry__attachment-meta",children:ze})]})]});return we.content_url?i.jsx("button",{type:"button",className:"conversation-entry__attachment-card is-image",onClick:()=>D({src:we.content_url,label:He,meta:ze}),"aria-label":`预览 ${He}`,children:rt},`${X.id}:${we.id}`):i.jsx("div",{className:"conversation-entry__attachment-card is-image",children:rt},`${X.id}:${we.id}`)})}):null,ue.length>0?i.jsx("div",{className:"conversation-entry__file-list",children:ue.map(we=>{const Re=L0(we.size_bytes),He=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:we.name??"附件"}),i.jsxs("span",{className:"conversation-entry__file-meta",children:["文件",Re?` · ${Re}`:""]})]})]});return we.content_url?i.jsx("a",{className:"conversation-entry__file-card",href:we.content_url,download:we.name??void 0,target:"_blank",rel:"noreferrer",children:He},`${X.id}:${we.id}`):i.jsx("div",{className:"conversation-entry__file-card",children:He},`${X.id}:${we.id}`)})}):null]})}function En(X,B){return i.jsx("div",{className:"turn-patch-summary__files",children:B.map(oe=>{const ue=u2(X,oe.path),we=!!ie[ue],Re=oe.changeSetId?Km(oe.changeSetId,oe.path,oe.itemId):null,He=Re?z[Re]:void 0,ze=Re?k[Re]===!0:!1,rt=Re?I[Re]??null:null,It=(He==null?void 0:He.file.diff)??oe.diffText??"",Ft=(He==null?void 0:He.empty_message)??oe.emptyMessage;return i.jsxs("div",{className:`turn-patch-file ${we?"is-expanded":""}`,children:[i.jsxs("button",{type:"button",className:"turn-patch-file__toggle",onClick:()=>{wt(ue),oe.changeSetId||P(),Re&&oe.changeSetId&&oe.diffAvailable&&!He&&!ze&&Q({changeSetId:oe.changeSetId,path:oe.path,itemId:oe.itemId??null})},"aria-expanded":we,children:[i.jsx("div",{className:"turn-patch-file__path",children:oe.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:["+",oe.additions]}),i.jsxs("span",{className:"is-remove",children:["-",oe.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"})})})]})]}),we?i.jsx("div",{className:"turn-patch-file__detail",children:ze?i.jsx("div",{className:"patch-file-card__empty",children:"正在载入差异详情…"}):rt?i.jsx("div",{className:"patch-file-card__empty",children:rt}):oe.diffAvailable===!1&&!It.trim()?i.jsx("div",{className:"patch-file-card__empty",children:Ft}):i.jsx(Dm,{active:we,fallback:i.jsx("div",{className:"patch-file-card__empty",children:"正在展开差异…"}),render:()=>$t(It,oe.path,Ft)})}):null]},ue)})})}function ht(X){return fA(X).map(B=>{const oe=`live:${X.id}:${B.item_id??"summary"}:${B.path}`,ue=!!ie[oe],we=X.status==="running",Re=Km(X.id,B.path,B.item_id),He=z[Re],ze=k[Re]===!0,rt=I[Re]??null,It=(He==null?void 0:He.file.diff)??"",Ft=(He==null?void 0:He.empty_message)??"此变更还没有可展示的补丁内容";return i.jsx("section",{className:"conversation-entry is-tool-group",children:i.jsxs("div",{className:`tool-entry ${we?"is-running":"is-complete"} ${ue?"is-expanded":""} is-patch`,children:[i.jsxs("button",{type:"button",className:"tool-entry__toggle",onClick:()=>{wt(oe),B.diff_available&&!He&&!ze&&Q({changeSetId:X.id,path:B.path,itemId:B.item_id??null})},"aria-expanded":ue,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:xt(B.path,`${oe}:live-link`,Gr(B.path,u))}),i.jsxs("span",{className:"tool-entry__counts",children:[i.jsxs("span",{className:"is-add",children:["+",B.additions]}),i.jsxs("span",{className:"is-remove",children:["-",B.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"})})})]}),ue?i.jsx("div",{className:"tool-entry__details",children:ze?i.jsx("div",{className:"patch-file-card__empty",children:"正在载入详情…"}):rt?i.jsx("div",{className:"patch-file-card__empty",children:rt}):!B.diff_available&&!It.trim()?i.jsx("div",{className:"patch-file-card__empty",children:Ft}):i.jsx(Dm,{active:ue,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:Gr(B.path,u)}),i.jsxs("div",{className:"patch-file-card__counts",children:[i.jsxs("span",{className:"is-add",children:["+",B.additions]}),i.jsxs("span",{className:"is-remove",children:["-",B.deletions]})]})]}),i.jsx("div",{className:"patch-file-card__diff",children:$t(It,B.path,Ft)})]})})})}):null]})},oe)})}const Ve=X=>{const B=V&&je===X&&!me[X],oe=(ee==null?void 0:ee.turnId)===X?ee.message:null;return{isEligible:B,isPending:Y===X,error:oe}};function Ke(X,B,oe,ue){const we=c2(X,u,ue),Re=we.reduce((rt,It)=>rt+It.additions,0),He=we.reduce((rt,It)=>rt+It.deletions,0),ze=Ve(B);return i.jsxs("div",{className:"turn-patch-summary",children:[i.jsxs("div",{className:"turn-patch-summary__header",children:[i.jsxs("div",{className:"turn-patch-summary__title",children:[i.jsxs("span",{children:[we.length," 个文件已更改"]}),i.jsxs("span",{className:"turn-patch-summary__counts",children:[i.jsxs("span",{className:"is-add",children:["+",Re]}),i.jsxs("span",{className:"is-remove",children:["-",He]})]})]}),ze.isEligible?i.jsx("div",{className:"turn-patch-summary__actions",children:i.jsx("button",{type:"button",className:"turn-patch-summary__action",onClick:()=>ge(B),disabled:ze.isPending,"aria-label":ze.isPending?"正在回滚这轮改动":"回滚这轮改动",title:ze.isPending?"正在回滚这轮改动":"回滚这轮改动",children:i.jsx(r2,{})})}):null]}),ze.error?i.jsx("div",{className:"turn-patch-summary__notice is-error",children:ze.error}):null,En(oe,we)]})}function Nt(X,B,oe){const ue=Ve(X);return i.jsxs("div",{className:"turn-patch-summary",children:[i.jsxs("div",{className:"turn-patch-summary__header",children:[i.jsxs("div",{className:"turn-patch-summary__title",children:[i.jsxs("span",{children:[oe.files.length," 个文件已更改"]}),i.jsxs("span",{className:"turn-patch-summary__counts",children:[i.jsxs("span",{className:"is-add",children:["+",oe.additions]}),i.jsxs("span",{className:"is-remove",children:["-",oe.deletions]})]})]}),ue.isEligible?i.jsx("div",{className:"turn-patch-summary__actions",children:i.jsx("button",{type:"button",className:"turn-patch-summary__action",onClick:()=>ge(X),disabled:ue.isPending,"aria-label":ue.isPending?"正在回滚这轮改动":"回滚这轮改动",title:ue.isPending?"正在回滚这轮改动":"回滚这轮改动",children:i.jsx(r2,{})})}):null]}),ue.error?i.jsx("div",{className:"turn-patch-summary__notice is-error",children:ue.error}):null,En(B,oe.files.map(we=>({path:we.path,pathLabel:we.displayPath,additions:we.additions,deletions:we.deletions,diffText:we.diffText,emptyMessage:"此变更没有可展示的补丁内容"})))]})}function Bt(X,B){var It,Ft;const oe=B.agentId?a.find(Le=>Le.id===B.agentId)??null:null,ue=Ax(((It=oe==null?void 0:oe.subagent)==null?void 0:It.nickname)??(oe==null?void 0:oe.title)??B.agentId),we=`subagent:${X.id}`,Re=!!te[we],He=B.state==="working",ze=B.state==="completed"?"子代理返回":B.state==="shutdown"?"子代理已关闭":B.state==="errored"?"子代理异常":"子代理处理中",rt=((Ft=oe==null?void 0:oe.subagent)==null?void 0:Ft.nickname)??(oe==null?void 0:oe.title)??"子代理";return i.jsx("section",{className:"conversation-entry is-tool-group",children:i.jsxs("div",{className:`tool-entry is-subagent ${He?"is-running":"is-complete"} ${Re?"is-expanded":""}`,style:{"--subagent-accent":ue},children:[i.jsxs("button",{type:"button",className:"tool-entry__toggle",onClick:()=>Oe(we),"aria-expanded":Re,children:[i.jsxs("div",{className:"tool-entry__summary",children:[i.jsx("span",{className:"tool-entry__status",children:ze}),i.jsx("span",{className:"tool-entry__command tool-entry__command--agent",children:rt})]}),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"})})})]}),Re?i.jsx("div",{className:"tool-entry__details",children:i.jsx(Dm,{active:Re,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:rt}),i.jsx("div",{className:"tool-entry__markdown",children:ot(B.body,`${X.id}-subagent`)})]})})}):null]})},X.id)}function Jt(X){var ue,we;if(X.kind==="tool-group"){const{group:Re}=X;if(Re.commandEntry.title==="apply_patch"&&wA(y,Re.commandEntry.timestamp,Re.patchSummary))return null;const He=!!te[Re.id],ze=l==="running"&&m===Re.id&&Re.outputEntries.length===0,rt=Re.commandEntry.title==="apply_patch"&&!!Re.patchSummary,It=rt&&(((ue=Re.patchSummary)==null?void 0:ue.files.length)??0)>1,Ft=rt?Re.patchSummary.files.length===1?Re.patchSummary.files[0].displayPath:`${Re.patchSummary.files.length} 个文件`:EA(Re.commandEntry);return i.jsx("section",{className:"conversation-entry is-tool-group",children:i.jsxs("div",{className:`tool-entry ${ze?"is-running":"is-complete"} ${He?"is-expanded":""} ${rt?"is-patch":""} ${It?"has-flat-patch-list":""}`,children:[i.jsxs("button",{type:"button",className:"tool-entry__toggle",onClick:()=>Oe(Re.id),"aria-expanded":He,children:[i.jsxs("div",{className:"tool-entry__summary",children:[i.jsx("span",{className:"tool-entry__status",children:rt?"已编辑":ze?"正在执行":"已执行"}),i.jsx("span",{className:"tool-entry__command",children:rt&&((we=Re.patchSummary)==null?void 0:we.files.length)===1?xt(Re.patchSummary.files[0].path,`${Re.id}:patch-link`,Re.patchSummary.files[0].displayPath):Ft}),rt&&Re.patchSummary?i.jsxs("span",{className:"tool-entry__counts",children:[i.jsxs("span",{className:"is-add",children:["+",Re.patchSummary.additions]}),i.jsxs("span",{className:"is-remove",children:["-",Re.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"})})})]}),He?i.jsx("div",{className:"tool-entry__details",children:i.jsx(Dm,{active:He,fallback:i.jsx("div",{className:"patch-file-card__empty",children:"正在展开详情…"}),render:()=>i.jsx(QA,{sessionId:t,group:Re,projectPath:u})})}):null]})},Re.id)}const B=X.entry,oe=B.kind==="user"?vA(B.body):null;if(oe)return Bt(B,oe);if(B.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:"正在思考"})})},B.id);if(cA(B))return i.jsx("section",{className:"conversation-context-compact",children:i.jsx("div",{className:"context-compact-divider",children:i.jsx("span",{children:"背景信息已自动压缩"})})},B.id);if(B.kind==="system"&&B.title==="system_prompt")return null;if(B.kind==="system"&&B.title==="runtime-status"){const Re=gA(B.body);return i.jsx("section",{className:"conversation-entry is-runtime-status",children:i.jsxs("div",{className:`runtime-status-entry is-${Re}`,children:[i.jsx("div",{className:"runtime-status-entry__label",children:_A(B.body)}),i.jsx("pre",{className:"runtime-status-entry__body",children:B.body})]})},B.id)}return i.jsx("section",{className:`conversation-entry ${B.kind==="user"?"is-user":"is-system"} is-${B.kind}`,children:B.kind==="user"?i.jsxs("div",{className:"conversation-entry__stack",children:[i.jsxs("div",{className:"conversation-entry__body",children:[B.body.trim()?ot(B.body,B.id):null,B.attachments.length>0?kn(B):null]}),B.body.trim()?i.jsxs("button",{type:"button",className:`conversation-entry__copy ${ae===B.id?"is-copied":""}`,onClick:()=>{bt(B.id,B.body)},"aria-label":ae===B.id?"已复制消息":"复制消息",children:[i.jsx("span",{className:"conversation-entry__copy-icon","aria-hidden":"true",children:ae===B.id?i.jsx(i2,{}):i.jsx(a2,{})}),i.jsx("span",{className:"sr-only",children:ae===B.id?"已复制":"复制"})]}):null]}):i.jsxs("div",{className:"conversation-entry__body",children:[B.body.trim()?B.kind==="assistant"?on(B):ot(B.body,B.id):null,B.attachments.length>0?kn(B):null]})},B.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 Dt=W.canLoadEarlierEntries||W.isPulling||W.isLoadingFull,Ze=W.isPulling||W.isLoadingFull||W.triggerSource==="click",un=W.isLoadingFull?"正在加载全部对话…":W.isPulling?W.isReadyToLoad?"松开加载全部":"下拉加载更多":o?"加载全部对话":"点击加载全部",ut=W.isLoadingFull||W.triggerSource==="click"?z0:W.indicatorOffset,_e={opacity:Ze?1:0,transform:`translate3d(-50%, calc(-100% + ${ut}px), 0) scale(${Ze?1:.92})`},Fe={transform:`rotate(${W.indicatorRotation}deg)`};return i.jsxs(i.Fragment,{children:[Dt?i.jsx("section",{className:`conversation-entry is-history-loader ${W.isReadyToLoad?"is-ready":""}`,children:i.jsxs("div",{className:`timeline-history-loader ${W.isLoadingFull?"is-loading":""} ${W.triggerSource==="click"?"is-click-loading":""}`,children:[i.jsx("span",{className:"timeline-history-loader__indicator",style:_e,"aria-hidden":"true",children:i.jsx("span",{className:"timeline-history-loader__indicator-surface",children:i.jsx("span",{className:"timeline-history-loader__indicator-track",style:Fe,children:i.jsx("span",{className:`timeline-history-loader__indicator-spin ${W.isLoadingFull?"is-loading":""}`,children:i.jsx("span",{className:"timeline-history-loader__indicator-icon",children:i.jsx(VM,{})})})})})}),i.jsx("div",{className:"turn-complete-divider timeline-history-loader__divider",children:W.isLoadingFull?i.jsx("span",{className:"timeline-history-loader__content is-loading",children:i.jsx("span",{children:un})}):i.jsx("button",{type:"button",className:`timeline-history-loader__button ${W.isPulling?"is-pulling":""}`,onClick:()=>se("click"),children:un})})]})}):null,f.map(X=>{var ze;if(X.kind==="item")return Jt(X.item);const{turn:B}=X,oe=X.changeSet,ue=((ze=B.completion)==null?void 0:ze.patchSummary)??null,we=!!C[B.id],Re=B.hiddenItems.length>0&&!we,He=we?IA(B.hiddenItems):OA(B.hiddenItems);return i.jsxs("section",{className:"conversation-turn",children:[B.visibleStartItems.map(rt=>Jt(rt)),B.hiddenItems.length>0?i.jsxs("div",{className:"conversation-turn__history",children:[i.jsxs("button",{type:"button",className:`turn-history-toggle ${we?"is-expanded":""}`,onClick:()=>Ie(B.id),"aria-expanded":we,children:[i.jsx("span",{className:"turn-history-toggle__label",children:He}),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"})})})]}),Re?null:B.hiddenItems.map(rt=>Jt(rt))]}):null,B.completion&&B.visibleEndItems.length>0?i.jsx("section",{className:"conversation-turn-complete",children:i.jsx("div",{className:"turn-complete-divider",children:i.jsx("span",{children:B.completion.durationLabel})})}):null,B.visibleEndItems.map(rt=>Jt(rt)),oe&&oe.source==="app-server"&&oe.files.length>0?ht(oe):null,B.completion&&B.visibleEndItems.length===0?i.jsx("section",{className:"conversation-turn-complete",children:i.jsx("div",{className:"turn-complete-divider",children:i.jsx("span",{children:B.completion.durationLabel})})}):null,oe&&oe.status==="completed"&&oe.files.length>0?Ke(oe,B.id,Lg(B.id),ue):ue?Nt(B.id,Lg(B.id),ue):null]},B.id)})]})}),YA=({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 ko,Bd,$i,Hd,vi,Bc,Hc,bi,xi,yl,$c,Fc,vl,bl,$d,Fd,jr,Eo,qd;const{sessionId:S}=ad({strict:!1}),p=e??S??"",b=v_(p),w=(b==null?void 0:b.agentId)??pc(),N=ki(),j=La(),{data:T}=ox({scope:{sessionId:p,agentId:w??void 0},selectedSessionId:p,enabled:!l&&!t}),D=_.useMemo(()=>HM(t??T,b),[T,b,t]),z=(D==null?void 0:D.sessions.find(v=>v.id===p))??null,I=!!(z||b!=null&&b.session),k=HR({sessionId:p,scope:{sessionId:p,agentId:w??void 0},enabled:!!p}),{historyState:P,archivedState:Q,loadMoreHistory:se,loadMoreArchived:W,reset:V}=ux({scope:{sessionId:p},selectedSessionId:p}),Y=_.useRef(null),ee=_.useRef(null),me=_.useRef(null),ge=_.useRef(null),te=_.useRef(null),[xe,C]=_.useState(!1),[q,ie]=_.useState(()=>typeof window<"u"&&window.innerWidth>=e2),[he,re]=_.useState(()=>KA()),[L,ae]=_.useState(!1),[ke,U]=_.useState(""),[ve,Z]=_.useState([]),[Se,je]=_.useState(null),[Oe,Ie]=_.useState(null),[wt,qe]=_.useState(null),[bt,Ut]=_.useState(()=>R_()),[$t,zt]=_.useState(()=>F3()),[xt,it]=_.useState(()=>cb(p)),[ot,ln]=_.useState(()=>ub(p)),[on,kn]=_.useState(()=>db(p)),En=O_(),ht=_.useMemo(()=>En.map(({id:v,...O})=>O),[En]),[Ve,Ke]=_.useState({}),[Nt,Bt]=_.useState(null),[Jt,Dt]=_.useState(!1),[Ze,un]=_.useState(!1),[ut,_e]=_.useState(""),[Fe,X]=_.useState(!1),[B,oe]=_.useState(!1),[ue,we]=_.useState(null),[Re,He]=_.useState(null),[ze,rt]=_.useState(!1),[It,Ft]=_.useState(!1),[Le,Et]=_.useState("code"),[Cn,hs]=_.useState(!1),[na,Ws]=_.useState(null),[Ja,Rs]=_.useState(null),[Na,Pa]=_.useState({}),[ms,dn]=_.useState(null),[pn,Un]=_.useState(!1),[ps,Ps]=_.useState(!1),[Us,Ms]=_.useState(!1),[xs,As]=_.useState(!1),[Rt,J]=_.useState(null),[M,G]=_.useState(null),[Ee,De]=_.useState({}),[Pe,$e]=_.useState(!1),[Je,Ye]=_.useState({state:"connected",attempt:0,maxAttempts:5}),[en,jt]=_.useState({sessionId:p??null,pending:!!p,error:null}),[$n,gn]=_.useState({state:"idle"}),bn=_.useRef({}),Tn=_.useRef(D),xn=_.useRef(null);_.useEffect(()=>{zf(bt)},[bt]),_.useEffect(()=>{q3($t)},[$t]),_.useEffect(()=>{ht.length!==0&&(ht.some(v=>v.value===bt)||Ut(ht[0].value))},[ht,bt]),_.useEffect(()=>{it(cb(p)),ln(ub(p)),kn(db(p)),qe(null),Et("code"),hs(!1),Ws(null),Rs(null),Pa({}),dn(null),Un(!1),Ps(!1),Ms(!1),As(!1),J(null),G(null),De({}),ni({}),si({}),sa({}),ii(0),ri(!1),Bs(!1),ia(null),Ea.current=null,ir.current=null,_c.current=null,Xr.current=null,rr.current=!1,Jr.current=!!p},[p]),_.useEffect(()=>{bn.current=Ee},[Ee]),_.useEffect(()=>{Tn.current=D},[D]),_.useEffect(()=>{W3(p,xt)},[xt,p]),_.useEffect(()=>{K3(p,ot)},[ot,p]),_.useEffect(()=>{Q3(p,on)},[on,p]),_.useEffect(()=>{Ke({}),Bt(null)},[p]),_.useEffect(()=>{A.current=null},[p]),_.useEffect(()=>{if(!Se)return;const v=F=>{F.key==="Escape"&&je(null)},O=document.body.style.overflow;return document.body.style.overflow="hidden",window.addEventListener("keydown",v),()=>{document.body.style.overflow=O,window.removeEventListener("keydown",v)}},[Se]);const[zn,Ss]=_.useState(!1),_n=_.useRef(null),qt=_.useRef(null),yn=_.useRef(null),Zn=_.useRef(0),A=_.useRef(null),le=_.useRef(0),tt=_.useRef(0),Ht=_.useRef(0),cn=_.useRef(null),mt=_.useRef(null),St=_.useRef(0),Rn=_.useRef(null),Ks=_.useRef(!1),ei=_.useRef(!1),zs=_.useRef(!1),Qs=_.useRef(0),ka=_.useRef(p??null),ti=_.useRef({sessionId:p??null,agentId:null,embedded:l}),[nr,ni]=_.useState({}),[Gs,si]=_.useState({}),[ai,sa]=_.useState({}),[aa,ii]=_.useState(0),[sr,ri]=_.useState(!1),[Ds,Bs]=_.useState(!1),[ar,ia]=_.useState(null),Ea=_.useRef(null),ir=_.useRef(null),_c=_.useRef(null),Xr=_.useRef(null),rr=_.useRef(!1),Jr=_.useRef(!1),el=_.useRef(new Set),ss=_.useCallback(v=>{if(v.length===0)return;const O=v.map(be=>`${be}:`),F=be=>O.some(Ue=>be.startsWith(Ue));ni(be=>Object.fromEntries(Object.entries(be).filter(([Ue])=>!F(Ue)))),si(be=>Object.fromEntries(Object.entries(be).filter(([Ue])=>!F(Ue)))),sa(be=>Object.fromEntries(Object.entries(be).filter(([Ue])=>!F(Ue))))},[]),Ca=_.useCallback(v=>{el.current.add(v)},[]),Ei=_.useCallback(v=>{el.current.delete(v)},[]),tl=_.useRef(null),uo=_.useRef(null),js=_.useRef(null),fo=_.useRef(null),li=_.useRef(he),Ci=_.useRef(null),oi=_.useRef(null);let pe=qR(z,(ko=k.data)==null?void 0:ko.session)??(b==null?void 0:b.session)??null;const Sn=(D==null?void 0:D.agent)??null;let ra=(D==null?void 0:D.projects.find(v=>v.id===(pe==null?void 0:pe.project_id)))??(b==null?void 0:b.project);const la=(pe==null?void 0:pe.capability.can_show_git)??!1,oa=(pe==null?void 0:pe.capability.can_show_terminal)??!1;ti.current={sessionId:p??null,agentId:(pe==null?void 0:pe.agent_id)??(Sn==null?void 0:Sn.id)??w,embedded:l};const tn=_.useCallback(()=>{var O;const v=(pe==null?void 0:pe.agent_id)??(Sn==null?void 0:Sn.id)??w;return v&&((O=mt.current)==null?void 0:O.agentId)===v?Promise.resolve(mt.current.target):wn({sessionId:p,agentId:v})},[Sn==null?void 0:Sn.id,w,pe==null?void 0:pe.agent_id,p]),nl=_.useCallback(async v=>{if(l){y==null||y(v);return}Js(v),Kr(v),Sn!=null&&Sn.id&&Ji(Sn.id),await N({to:"/",replace:!0})},[Sn==null?void 0:Sn.id,l,N,y]),yc=_.useCallback(async()=>{if(l){g==null||g();return}await N({to:"/nodes"})},[l,N,g]),ph=v=>v instanceof Element&&!!v.closest('button, textarea, input, a, [role="button"], [role="dialog"]'),dd=v=>ph(v),vc=()=>{const v=me.current;if(!v)return;const O=()=>{v.scrollTo({top:v.scrollHeight,behavior:"auto"})};O(),window.requestAnimationFrame(()=>{O(),window.requestAnimationFrame(O)})},gh=_.useCallback(()=>{const v=me.current;return v?v.scrollHeight-v.scrollTop-v.clientHeight<=t2:!0},[]),Lp=_.useCallback(v=>{(v!=null&&v.force||gh())&&vc()},[gh]),fd=()=>{const v=me.current;if(!v){$e(!1);return}const O=v.scrollHeight-v.scrollTop-v.clientHeight;$e(O>t2)},as=_.useCallback(v=>{j.setQueriesData({queryKey:os},v)},[j]),hd=_.useCallback((v,O)=>{j.setQueryData(Nx({sessionId:v,scope:{sessionId:v}}),F=>WR(F??void 0,v,O)??F)},[j]),Pp=(D==null?void 0:D.projects)??[],lr=(D==null?void 0:D.sessions)??[],_h=(D==null?void 0:D.project_stats)??[],jn=_.useMemo(()=>{var v;return(v=pe==null?void 0:pe.subagent)!=null&&v.parent_session_id?lr.find(O=>{var F;return O.id===((F=pe==null?void 0:pe.subagent)==null?void 0:F.parent_session_id)})??null:null},[(Bd=pe==null?void 0:pe.subagent)==null?void 0:Bd.parent_session_id,lr]),sl=_.useCallback(v=>{const O=v.session_id;O&&(j.setQueryData(Fo(O),F=>mx(F,v.entries)),j.setQueryData(["timeline",O],F=>{const be=XT(F,v);return be.view==="full_compact"&&UR(be),be}))},[j]),yh=_.useCallback(v=>{var Kt,In;const O=v.session_id;if(!O)return;const F=ti.current.sessionId===O;sl(v.timeline),j.setQueryData(["interactions",O],v.interactions),F&&we(yt=>yt&&v.interactions.some(rs=>rs.id===yt)?yt:null),j.setQueryData(["plan",O],v.plan_snapshot),v.change_sets.length>0?(ss(v.change_sets.map(yt=>yt.id)),j.setQueryData(["change-sets",O],v.change_sets),Ca(O)):el.current.has(O)||(j.setQueryData(["change-sets",O],[]),Ei(O)),j.setQueryData(["session-run-workbench",O],v.run_workbench);const be=(Kt=v.timeline.entries.at(-1))==null?void 0:Kt.timestamp,Ue=be&&(!v.session_patch.last_event_at||+new Date(be)>+new Date(v.session_patch.last_event_at))?{...v.session_patch,last_event_at:be}:v.session_patch,gt=$b(Ue);gt&&hd(O,gt);const Xe=C0(Ue);Xe&&vp(Tn.current??void 0,O)&&as(yt=>Tf(yt,O,Xe)),F&&(v.session_patch.run_state==="running"||v.session_patch.run_state==="completed"||v.session_patch.run_state==="idle")&&(X(v.session_patch.run_state==="running"),v.session_patch.run_state!=="running"&&oe(!1)),F&&((In=v.run_workbench)!=null&&In.terminal_snapshot)&&De(yt=>{var Ce;const rs=new Set((Ce=v.run_workbench)==null?void 0:Ce.terminal_snapshot.terminals.map(Ct=>Ct.id)),es={};for(const[Ct,nn]of Object.entries(yt))rs.has(Ct)&&(es[Ct]=nn);return es}),jn!=null&&jn.id&&j.invalidateQueries({queryKey:["timeline",jn.id,"prefix-source"],exact:!0})},[sl,ss,hd,Ca,jn==null?void 0:jn.id,j,Ei]),bc=_.useCallback(async v=>{var be;if(!p)return null;const O=p;if(((be=cn.current)==null?void 0:be.sessionId)===O)return cn.current.promise;const F=(async()=>{var gt;const Ue=++Zn.current;gn({state:"recovering"});try{const Kt=await(await tn()).client.getSessionBootstrap(p);return Zn.current!==Ue?null:(yh(Kt),tt.current=Date.now(),gn({state:"idle"}),Kt)}catch(Xe){return Zn.current!==Ue||gn({state:"failed",error:Xe instanceof Error?Xe.message:v==="initial"?"会话加载失败。":"会话同步失败。"}),null}finally{((gt=cn.current)==null?void 0:gt.sessionId)===O&&(cn.current=null)}})();return cn.current={sessionId:O,promise:F},F},[yh,tn,p]),md=_.useCallback(v=>{p&&(Ht.current>0||(Ht.current=Date.now(),bc(v).then(O=>{jt({sessionId:p,pending:!1,error:O?null:"Unable to load session bootstrap."})}).catch(O=>{jt({sessionId:p,pending:!1,error:O instanceof Error?O.message:"Unable to load session bootstrap."})})))},[bc,p]),vh=_.useCallback(async()=>{if(!p||el.current.has(p))return;const O=await(await tn()).client.getSessionChangeSets(p);ss(O.map(F=>F.id)),j.setQueryData(["change-sets",p],O),Ca(p)},[ss,Ca,j,tn,p]),xc=_.useCallback(async(v="click")=>{if(!p||Ds)return;const O=me.current;O&&(Xr.current=O.scrollHeight,rr.current=!0),ia(v),Bs(!0);const F=Date.now();try{const Ue=await(await tn()).client.getSessionTimeline(p,{view:"full_compact"});sl(Ue)}finally{if(v==="click"){const be=IM-(Date.now()-F);be>0&&await new Promise(Ue=>{window.setTimeout(Ue,be)})}Bs(!1),ii(0),ri(!1),ia(null)}},[sl,Ds,tn,p]),bh=_.useCallback(async v=>{if(!p)return;const O=Km(v.changeSetId,v.path,v.itemId);if(!(nr[O]||ai[O])){sa(F=>({...F,[O]:!0})),si(F=>({...F,[O]:void 0}));try{const be=await(await tn()).client.getSessionChangeSetFileDiff(p,v);ni(Ue=>({...Ue,[O]:be}))}catch(F){si(be=>({...be,[O]:F instanceof Error?F.message:"无法读取这个文件的差异详情。"}))}finally{sa(F=>({...F,[O]:!1}))}}},[nr,ai,tn,p]),ca=ls({queryKey:["timeline",p],enabled:!1,queryFn:async()=>$M,initialData:p?PR(p)??j.getQueryData(["timeline",p]):void 0,refetchInterval:!1}),or=ls({queryKey:Fo(p),enabled:!1,queryFn:async()=>[],initialData:[]});_.useEffect(()=>{const v=b==null?void 0:b.optimisticEntry;!p||(b==null?void 0:b.sessionId)!==p||!v||j.setQueryData(Fo(p),O=>O!=null&&O.some(F=>F.id===v.id)?O:O0(O,v))},[b,j,p]),_.useEffect(()=>{var O;(b==null?void 0:b.sessionId)!==p||!(((O=k.data)==null?void 0:O.session.id)===p||T!=null&&T.sessions.some(F=>F.id===p))||hk(p)},[T,b==null?void 0:b.sessionId,($i=k.data)==null?void 0:$i.session.id,p]);const ho=Rm(ca.data),Up=or.data??[],mo=ho.length>0||Up.length>0||!!(b!=null&&b.optimisticEntry),Ti=ls({queryKey:["timeline",jn==null?void 0:jn.id,"prefix-source"],enabled:!!(jn!=null&&jn.id),queryFn:async()=>(await(await wn({sessionId:jn.id,projectId:jn.project_id,agentId:jn.agent_id})).client.getSessionTimeline(jn.id,{view:"tail"})).entries,refetchInterval:!1}),pd=_.useMemo(()=>{const v=Rm(ca.data);return pe!=null&&pe.subagent?new Set:SA(v)},[pe==null?void 0:pe.subagent,ca.data]),Sc=_.useMemo(()=>xA(Rm(ca.data)),[ca.data]),gd=_.useMemo(()=>pe!=null&&pe.subagent?[]:lr.filter(v=>{var O;return v.id!==p&&((O=v.subagent)==null?void 0:O.parent_session_id)===p&&!v.archived}).filter(v=>{if(v.run_state==="running")return!0;if(!((pe==null?void 0:pe.run_state)==="running"||Fe))return!1;if(pd.has(v.id))return!0;if(!Sc)return!1;const O=new Date(Sc).getTime(),F=new Date(v.last_event_at).getTime();return Number.isFinite(O)&&Number.isFinite(F)&&F>=O-AM}).sort((v,O)=>+new Date(O.last_event_at)-+new Date(v.last_event_at)),[Sc,Fe,pd,pe==null?void 0:pe.run_state,pe==null?void 0:pe.subagent,p,lr]);_.useEffect(()=>{if(!p){xn.current=null,zs.current=!1,Qs.current=0,ka.current=null,jt({sessionId:null,pending:!1,error:null}),Ye({state:"connected",attempt:0,maxAttempts:5});return}const v=!mo;jt({sessionId:p,pending:v,error:null}),tt.current=v?0:Date.now(),Ht.current=0},[mo,p]),_.useEffect(()=>{if(!p||!en.pending)return;if(Je.state==="failed"){md("initial");return}if(Je.state!=="connected")return;const v=le.current;if(v<=0)return;const O=window.setTimeout(()=>{tt.current>=v||md("initial")},1200);return()=>{window.clearTimeout(O)}},[Je.state,en.pending,md,p]),_.useEffect(()=>{if(!p||Je.state!=="connected"||en.pending||mo||!zs.current||ka.current!==p)return;const v=Qs.current;if(v<=0)return;const O=window.setTimeout(()=>{if(zs.current&&Qs.current===v){if(tt.current>=v){zs.current=!1,Qs.current=0,ka.current=null;return}zs.current=!1,Qs.current=0,ka.current=null,bc("connected")}},1200);return()=>{window.clearTimeout(O)}},[Je.state,bc,mo,en.pending,p]);const al=ls({queryKey:["change-sets",p],enabled:!1,queryFn:async()=>p?(await tn()).client.getSessionChangeSets(p):[],initialData:p?j.getQueryData(["change-sets",p])??[]:[],refetchInterval:!1}),il=ls({queryKey:["session-git-workspace",p],enabled:!!(p&&la&&Le==="git"),queryFn:async()=>(await tn()).client.getSessionGitWorkspace(p),refetchInterval:!1}),Ua=ls({queryKey:["session-git-history",p],enabled:!1,queryFn:async()=>(await tn()).client.getSessionGitHistory(p),refetchInterval:!1}),rl=ls({queryKey:["session-run-workbench",p],enabled:!!p&&oa&&(pn||ps||Le==="terminal"),queryFn:async()=>p?(await tn()).client.getSessionRunWorkbench(p):null,initialData:p?j.getQueryData(["session-run-workbench",p])??null:null,refetchInterval:!1}),po=_.useCallback(async v=>{if(!p)return;const O=["session-run-workbench",p],F=j.getQueryData(O);if(F){j.setQueryData(O,v(F));return}const Ue=await(await tn()).client.getSessionRunWorkbench(p);j.setQueryData(O,v(Ue))},[j,tn,p]),Ri=ls({queryKey:["plan",p],enabled:!1,queryFn:async()=>null,initialData:p?j.getQueryData(["plan",p])??null:null,refetchInterval:!1}),cr=ls({queryKey:["interactions",p],enabled:!1,queryFn:async()=>[],initialData:p?j.getQueryData(["interactions",p])??[]:[],refetchInterval:!1}),Mi=_.useCallback(async(v,O)=>{if(p){De(F=>{var be,Ue,gt;return{...F,[v]:{chunks:((be=F[v])==null?void 0:be.chunks)??[],nextCursor:((Ue=F[v])==null?void 0:Ue.nextCursor)??0,truncated:((gt=F[v])==null?void 0:gt.truncated)??!1,isLoading:!0,error:null}}});try{const F=await tn(),be=bn.current[v],Ue=await F.client.getSessionTerminalOutput({sessionId:p,terminalId:v,cursor:O!=null&&O.force||be!=null&&be.truncated||be==null?void 0:be.nextCursor});De(gt=>{const Xe=gt[v],Kt=O!=null&&O.force||Ue.truncated||!Xe?Ue.chunks:l2(Xe.chunks,Ue.chunks);return{...gt,[v]:{chunks:Kt,nextCursor:Ue.next_cursor,truncated:Ue.truncated,isLoading:!1,error:null}}})}catch(F){De(be=>{var Ue,gt,Xe;return{...be,[v]:{chunks:((Ue=be[v])==null?void 0:Ue.chunks)??[],nextCursor:((gt=be[v])==null?void 0:gt.nextCursor)??0,truncated:((Xe=be[v])==null?void 0:Xe.truncated)??!1,isLoading:!1,error:F instanceof Error?F.message:"无法读取终端输出。"}}})}}},[p]);_.useEffect(()=>{var be,Ue;const v=(be=rl.data)==null?void 0:be.terminal_snapshot.active_terminal_id,O=(Ue=rl.data)==null?void 0:Ue.terminal_snapshot.terminals.find(gt=>gt.id===v);if(!v||!O)return;const F=Ee[v];(!F||F.truncated||F.nextCursor<O.output_cursor)&&Mi(v)},[Mi,rl.data,Ee]);const xh=!!(pe!=null&&pe.subagent&&(jn!=null&&jn.id)&&Ti.isPending&&!Ti.data),Ai=_.useMemo(()=>{const v=Rm(ca.data);return pe!=null&&pe.subagent?jn!=null&&jn.id&&Ti.isPending&&!Ti.data?[]:yA(v,Ti.data):v},[jn==null?void 0:jn.id,Ti.data,Ti.isPending,pe==null?void 0:pe.subagent,ca.data]),ll=_.useMemo(()=>ZT(Ai,or.data),[Ai,or.data]);_.useEffect(()=>{p&&window.localStorage.setItem(EM,p)},[p]),_.useEffect(()=>{const v=yn.current;v&&((or.data??[]).some(O=>O.id===v.optimisticEntryId)||(yn.current=null))},[or.data]),_.useEffect(()=>{Ft(!1)},[p]),_.useEffect(()=>{_e((pe==null?void 0:pe.title)??""),un(!1)},[pe==null?void 0:pe.title,p]),_.useEffect(()=>{oe(!1)},[p]),_.useEffect(()=>()=>{_n.current&&window.clearTimeout(_n.current),qt.current&&window.clearTimeout(qt.current),oi.current&&window.cancelAnimationFrame(oi.current)},[]),_.useEffect(()=>{if(qt.current&&(window.clearTimeout(qt.current),qt.current=null),!!Oe)return qt.current=window.setTimeout(()=>{Ie(null),qt.current=null},LM),()=>{qt.current&&(window.clearTimeout(qt.current),qt.current=null)}},[Oe]),_.useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(Tx,String($0(he))),window.localStorage.setItem(Mf,Af)}catch{}},[he]),_.useEffect(()=>{li.current=he},[he]),_.useEffect(()=>{if(typeof window>"u")return;const v=()=>{const O=window.innerWidth>=e2;ie(O),O&&C(!1)};return v(),window.addEventListener("resize",v),()=>{window.removeEventListener("resize",v)}},[]),_.useEffect(()=>{if(!L)return;const v=F=>{const be=fo.current;if(!be)return;const Ue=F.clientX-be.startX,gt=$0(be.startWidth+Ue);Ci.current=gt,oi.current===null&&(oi.current=window.requestAnimationFrame(()=>{oi.current=null;const Xe=Ci.current,Kt=Y.current;Xe===null||!Kt||Kt.style.setProperty("--desktop-sidebar-width",`${Xe}px`)}))},O=()=>{oi.current!==null&&(window.cancelAnimationFrame(oi.current),oi.current=null);const F=Ci.current??li.current;Ci.current=null,fo.current=null,ae(!1),li.current=F,re(F)};return window.addEventListener("pointermove",v),window.addEventListener("pointerup",O),window.addEventListener("pointercancel",O),()=>{window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",O),window.removeEventListener("pointercancel",O)}},[L]),_.useEffect(()=>{const v=O=>{const F=O.target;rt(!1),Ss(!1),!(F instanceof Element&&(F.closest(".conversation-topbar__actions")||F.closest(".conversation-topbar__title-actions")||F.closest(".picker-sheet")||F.closest(".picker-sheet-wrap")))&&(Dt(!1),Un(!1),Ps(!1))};return window.addEventListener("pointerdown",v),()=>{window.removeEventListener("pointerdown",v)}},[]),_.useEffect(()=>{const v=Y.current;if(!v||q)return;const O=gt=>{const Xe=gt.touches[0];gt.touches.length!==1||!Xe||dd(gt.target)||(uo.current={startX:Xe.clientX,startY:Xe.clientY})},F=gt=>{if(gt.touches.length!==1)return;const Xe=gt.touches[0];if(!js.current){const In=uo.current;if(!In)return;const yt=Xe.clientX-In.startX,rs=Xe.clientY-In.startY;if(Math.abs(yt)<8&&Math.abs(rs)<8)return;if(Math.abs(yt)<=Math.abs(rs)){uo.current=null;return}pi(In.startX,In.startY)}Cd(Xe.clientX,Xe.clientY)&>.preventDefault()},be=gt=>{if(uo.current=null,!js.current)return;const Xe=gt.changedTouches[0];if(!Xe){js.current=null,$a(null);return}Td(Xe.clientX,Xe.clientY)},Ue=()=>{uo.current=null,js.current=null,$a(null)};return v.addEventListener("touchstart",O,{passive:!0,capture:!0}),v.addEventListener("touchmove",F,{passive:!1,capture:!0}),v.addEventListener("touchend",be,{capture:!0}),v.addEventListener("touchcancel",Ue,{capture:!0}),()=>{v.removeEventListener("touchstart",O,{capture:!0}),v.removeEventListener("touchmove",F,{capture:!0}),v.removeEventListener("touchend",be,{capture:!0}),v.removeEventListener("touchcancel",Ue,{capture:!0})}},[q,xe]),_.useEffect(()=>{const v=me.current;if(!v)return;if(rr.current&&Xr.current!==null){const F=Xr.current,be=v.scrollHeight;v.scrollTop+=Math.max(0,be-F),rr.current=!1,Xr.current=null;return}if(!p||!Jr.current||Ai.length===0)return;vc();const O=window.setTimeout(()=>{vc(),Jr.current=!1},120);return()=>{window.clearTimeout(O)}},[Ai.length,p]),_.useEffect(()=>{const v=me.current;if(!v)return;const O=()=>{fd()};return O(),v.addEventListener("scroll",O,{passive:!0}),window.addEventListener("resize",O),()=>{v.removeEventListener("scroll",O),window.removeEventListener("resize",O)}},[Ai.length,p]),_.useEffect(()=>{const v=me.current;if(!v)return;const O=ca.data,F=(Mm(O)||Pg(O)!=="full_compact")&&!Ds,be=()=>{Ea.current=null,ir.current=null,ii(0),ri(!1)},Ue=()=>{const yt=F&&ir.current!==null&&aa>=Og;be(),yt&&xc("pull")},gt=yt=>{var rs,es;!F||yt.touches.length!==1||v.scrollTop>0||ph(yt.target)||(Ea.current=((rs=yt.touches[0])==null?void 0:rs.clientX)??null,ir.current=((es=yt.touches[0])==null?void 0:es.clientY)??null)},Xe=yt=>{if(yt.defaultPrevented)return;const rs=Ea.current,es=ir.current;if(rs===null||es===null||yt.touches.length!==1)return;const Ce=yt.touches[0],Ct=((Ce==null?void 0:Ce.clientX)??rs)-rs,nn=((Ce==null?void 0:Ce.clientY)??es)-es;if(Math.abs(Ct)>Math.abs(nn)){be();return}if(nn<=0){ii(0),ri(!1);return}if(v.scrollTop>0){be();return}yt.cancelable&&yt.preventDefault(),ri(!0),ii(Math.min(n2,nn))},Kt=()=>{Ue()},In=()=>{be()};return v.addEventListener("touchstart",gt,{passive:!0}),v.addEventListener("touchmove",Xe,{passive:!1}),v.addEventListener("touchend",Kt),v.addEventListener("touchcancel",In),()=>{v.removeEventListener("touchstart",gt),v.removeEventListener("touchmove",Xe),v.removeEventListener("touchend",Kt),v.removeEventListener("touchcancel",In)}},[Ds,xc,aa,ca.data]),_.useEffect(()=>{var gt,Xe;if(!p){Rn.current!==null&&(clearTimeout(Rn.current),Rn.current=null),(gt=mt.current)==null||gt.stream.setSessionId(null);return}let v=!1;const O=++St.current,F=ti.current.agentId,be=()=>{Rn.current!==null&&(clearTimeout(Rn.current),Rn.current=null)},Ue=()=>{l||(be(),Rn.current=setTimeout(()=>{Rn.current=null;const Kt=ti.current;Rf(j,{scope:{sessionId:Kt.sessionId,agentId:Kt.agentId},selectedSessionId:Kt.sessionId})},PM))};return F&&((Xe=mt.current)==null?void 0:Xe.agentId)===F?(mt.current.stream.setSessionId(p),()=>{v=!0}):(tn().then(Kt=>{var rs,es;if(v||St.current!==O)return;const In=Kt.client.getConnectionKey();if(((rs=mt.current)==null?void 0:rs.key)===In){mt.current.stream.setSessionId(p);return}(es=mt.current)==null||es.stream.close(),Ks.current=!1,ei.current=!1;const yt=Kt.client.createEventStream(Ce=>{var qi,Co,xl,wr,Dh,Fn,qc,Wc,Wd,Kd,Oh,Kc,Qc,Gc,ks,Wn,To,Sl,Ro,Yc,Fa,Mo;const Ct=typeof((qi=Ce.payload)==null?void 0:qi.sessionId)=="string"?Ce.payload.sessionId:null,nn=ti.current.sessionId,Qt=Ct===nn?nn:null,Fi=typeof((Co=Ce.payload)==null?void 0:Co.projectId)=="string"?Ce.payload.projectId:null;if(Ce.type==="agent.online"){if(ei.current){ei.current=!1;return}V(),Ue();return}if(Ce.type==="timeline.reset"&&Qt){tt.current=Date.now(),zs.current=!1,Qs.current=0,ka.current=null,jt({sessionId:Qt,pending:!1,error:null});const st=Array.isArray((xl=Ce.payload)==null?void 0:xl.entries)?Ce.payload.entries:[],Vt=Mm(j.getQueryData(["timeline",Qt]));sl(d2(Qt,st,Vt));const Mn=(wr=st[st.length-1])==null?void 0:wr.timestamp;Mn&&as(sn=>T0(sn,Qt,Mn)),window.requestAnimationFrame(fd);return}if(Ce.type==="interaction.reset"&&Qt){const st=Array.isArray((Dh=Ce.payload)==null?void 0:Dh.requests)?Ce.payload.requests:[];j.setQueryData(["interactions",Qt],st),we(Vt=>Vt&&st.some(Mn=>Mn.id===Vt)?Vt:null);return}if(Ce.type==="plan.reset"&&Qt){const st=(Fn=Ce.payload)!=null&&Fn.planSnapshot&&typeof Ce.payload.planSnapshot=="object"?Ce.payload.planSnapshot:null;j.setQueryData(["plan",Qt],st);return}if(Ce.type==="timeline.delta"&&Qt){const st=Array.isArray((qc=Ce.payload)==null?void 0:qc.entries)?Ce.payload.entries:[],Vt=Mm(j.getQueryData(["timeline",Qt]));sl(d2(Qt,hx(void 0,st),Vt));const Mn=(Wc=st[st.length-1])==null?void 0:Wc.timestamp;Mn&&as(sn=>T0(sn,Qt,Mn)),Lp(),window.requestAnimationFrame(fd);return}if(Ce.type==="interaction.delta"&&Qt){const st=Array.isArray((Wd=Ce.payload)==null?void 0:Wd.requests)?Ce.payload.requests:[],Vt=Array.isArray((Kd=Ce.payload)==null?void 0:Kd.resolvedRequestIds)?Ce.payload.resolvedRequestIds.filter(Mn=>typeof Mn=="string"&&Mn.trim().length>0):[];j.setQueryData(["interactions",Qt],Mn=>{const sn=new Map((Mn??[]).map(Hn=>[Hn.id,Hn]));for(const Hn of st)sn.set(Hn.id,Hn);for(const Hn of Vt)sn.delete(Hn);return[...sn.values()].sort((Hn,qa)=>+new Date(qa.updated_at)-+new Date(Hn.updated_at))}),Vt.length>0&&we(Mn=>Mn&&Vt.includes(Mn)?null:Mn);return}if(Ce.type==="plan.delta"&&Qt){const st=(Oh=Ce.payload)!=null&&Oh.planSnapshot&&typeof Ce.payload.planSnapshot=="object"?Ce.payload.planSnapshot:null;j.setQueryData(["plan",Qt],st);return}if(Ce.type==="changeset.reset"&&Qt){const st=Array.isArray((Kc=Ce.payload)==null?void 0:Kc.changeSets)?Ce.payload.changeSets:[];st.length>0?(ss(st.map(Vt=>Vt.id)),j.setQueryData(["change-sets",Qt],st),Ca(Qt)):el.current.has(Qt)||(j.setQueryData(["change-sets",Qt],[]),Ei(Qt));return}if(Ce.type==="changeset.delta"&&Qt){const st=Array.isArray((Qc=Ce.payload)==null?void 0:Qc.changeSets)?Ce.payload.changeSets:[];ss(st.map(Vt=>Vt.id)),j.setQueryData(["change-sets",Qt],Vt=>mA(Vt,st));return}if(Ce.type==="terminal.snapshot"&&Qt){const st=(Gc=Ce.payload)!=null&&Gc.snapshot&&typeof Ce.payload.snapshot=="object"?Ce.payload.snapshot:null;if(!st)return;j.setQueryData(["session-run-workbench",Qt],Vt=>Vt&&{...Vt,terminal_snapshot:st}),De(Vt=>{const Mn=new Set(st.terminals.map(Hn=>Hn.id)),sn={};for(const[Hn,qa]of Object.entries(Vt))Mn.has(Hn)&&(sn[Hn]=qa);return sn});return}if(Ce.type==="terminal.delta"&&Qt){const st=(ks=Ce.payload)!=null&&ks.terminal&&typeof Ce.payload.terminal=="object"?Ce.payload.terminal:null,Vt=Array.isArray((Wn=Ce.payload)==null?void 0:Wn.chunks)?Ce.payload.chunks:[],Mn=typeof((To=Ce.payload)==null?void 0:To.activeTerminalId)=="string"?Ce.payload.activeTerminalId:null;if(!st)return;j.setQueryData(["session-run-workbench",Qt],sn=>{if(!sn)return sn;const Hn=sn.terminal_snapshot.terminals.filter(Zc=>Zc.id!==st.id),qa=sn.terminal_snapshot.terminals.findIndex(Zc=>Zc.id===st.id),Vc=[...Hn];return qa<=0?Vc.unshift(st):Vc.splice(qa,0,st),{...sn,terminal_snapshot:{...sn.terminal_snapshot,active_terminal_id:Mn,updated_at:st.updated_at,terminals:Vc}}}),De(sn=>{var qa;if(Vt.length===0)return sn;const Hn=sn[st.id];return{...sn,[st.id]:{chunks:l2((Hn==null?void 0:Hn.chunks)??[],Vt),nextCursor:typeof((qa=Ce.payload)==null?void 0:qa.nextCursor)=="number"?Ce.payload.nextCursor:st.output_cursor,truncated:(Hn==null?void 0:Hn.truncated)??!1,isLoading:!1,error:null}}});return}if(Ce.type==="thread.updated"&&Fi){const st=typeof((Sl=Ce.payload)==null?void 0:Sl.action)=="string"?Ce.payload.action:"",Vt=(Ro=Ce.payload)!=null&&Ro.projectPatch&&typeof Ce.payload.projectPatch=="object"?Ce.payload.projectPatch:null,Mn=Array.isArray((Yc=Ce.payload)==null?void 0:Yc.orderedProjectIds)?Ce.payload.orderedProjectIds.filter(sn=>typeof sn=="string"&&sn.trim().length>0):[];if((st==="pin"||st==="unpin"||st==="rename")&&Vt){as(sn=>Tu(sn,Fi,Vt));return}if(st==="reorder"&&Mn.length>0){as(sn=>xp(sn,Mn));return}if(st==="remove"||st==="archive"){V(),as(sn=>Sp(sn,Fi));return}if(st==="unarchive"){V(),Ue();return}}if(Ce.type==="session.updated"&&Ct){const st=(Fa=Ce.payload)!=null&&Fa.sessionPatch&&typeof Ce.payload.sessionPatch=="object"?C0(Ce.payload.sessionPatch):null,Vt=(Mo=Ce.payload)!=null&&Mo.sessionPatch&&typeof Ce.payload.sessionPatch=="object"?$b(Ce.payload.sessionPatch):null;Vt&&hd(Ct,Vt);const Mn=vp(Tn.current??void 0,Ct);if(st&&Mn)as(sn=>Tf(sn,Ct,st));else{if(ti.current.embedded&&Ct===nn&&!Tn.current)return;if(Mn)return;Ue()}Qt&&((st==null?void 0:st.run_state)==="running"||(st==null?void 0:st.run_state)==="completed"||(st==null?void 0:st.run_state)==="idle")&&(X(st.run_state==="running"),st.run_state!=="running"&&oe(!1));return}Ce.type==="turn.completed"&&Qt&&(X(!1),oe(!1),j.setQueryData(["plan",Qt],null))},{sessionId:p,reconnectWhenHidden:!0,onStatus:Ce=>{if(Ye(Ce),Ce.state==="connected"){const Ct=Date.now(),nn=Ks.current;le.current=Ct,zs.current=nn,Qs.current=nn?Ct:0,ka.current=nn?p:null,ei.current=!0,nn&&(V(),Ue()),Ks.current=!0,Ss(!1);return}Zn.current+=1,gn({state:"idle"})}});mt.current={key:In,agentId:F,target:Kt,stream:yt},yt.setSessionId(p)}).catch(Kt=>{v||St.current!==O||Ye({state:"failed",attempt:0,maxAttempts:5,error:Kt instanceof Error?Kt.message:"Unable to connect to live session."})}),()=>{v=!0})},[l,tn,p]),_.useEffect(()=>()=>{var v;St.current+=1,Rn.current!==null&&(clearTimeout(Rn.current),Rn.current=null),(v=mt.current)==null||v.stream.close(),mt.current=null},[]),_.useEffect(()=>{if(!p||(pe==null?void 0:pe.run_state)!=="running"||pe.context_usage)return;if(A.current!==p){A.current=p;return}let v=!1;const O=window.setTimeout(()=>{v||k.refetch()},1200);return()=>{v=!0,window.clearTimeout(O)}},[p,pe==null?void 0:pe.context_usage,pe==null?void 0:pe.run_state,k.refetch]),_.useEffect(()=>{var Ue,gt;if(!p||!I||!pe||!ra||((Ue=k.data)==null?void 0:Ue.session.id)===p||k.isFetching||xn.current===p||typeof window>"u")return;xn.current=p;const v=window,O=()=>{k.refetch()},F=(gt=v.requestIdleCallback)==null?void 0:gt.call(v,O,{timeout:1500}),be=F===void 0?window.setTimeout(O,320):null;return()=>{var Xe;F!==void 0&&((Xe=v.cancelIdleCallback)==null||Xe.call(v,F)),be!==null&&window.clearTimeout(be)}},[ra,pe,(Hd=k.data)==null?void 0:Hd.session.id,k.isFetching,k.refetch,I,p]),_.useEffect(()=>{Dt(!1)},[q,p]);const _d=_.useCallback(v=>{var O;qe(v),((O=v.effect)==null?void 0:O.type)==="set_session_model"&&(Ut(v.effect.model),v.effect.reasoning_effort&&zt(v.effect.reasoning_effort))},[]),za=Vn({mutationFn:async v=>(await tn()).client.sendSessionInput(v),onMutate:async v=>{await j.cancelQueries({queryKey:["timeline",v.sessionId]}),Ie(null),oe(!1),X(!0),Bt(v.proposedPlanEntryId??null);const O=v.clearComposer!==!1;O&&(U(""),Z([])),_n.current&&window.clearTimeout(_n.current);const F=new Date().toISOString(),be=`${L_}${v.sessionId}:${Date.now()}`;yn.current=O?{optimisticEntryId:be,draft:v.input,attachments:v.attachments}:null,j.setQueryData(Fo(v.sessionId),Ue=>O0(Ue,{id:be,kind:"user",title:"你",body:v.input,body_truncated:!1,detail_available:!1,patch_summary:null,session_ids:[],timestamp:F,accent:"primary",attachments:_x(v.attachments)})),as(Ue=>Tf(Ue,v.sessionId,{run_state:"running",run_state_changed_at:F,last_event_at:F}))},onSuccess:async(v,O)=>{Bt(null),O.proposedPlanEntryId&&Ke(F=>{const be={...F};return delete be[O.proposedPlanEntryId],be}),await j.invalidateQueries({queryKey:os}),await j.invalidateQueries({queryKey:["plan",O.sessionId]}),await j.invalidateQueries({queryKey:["change-sets",O.sessionId]}),_n.current=null},onError:(v,O)=>{Bt(null),X(!1);const F=yn.current;F&&(j.setQueryData(Fo(O.sessionId),be=>JT(be,F.optimisticEntryId)),U(be=>be||F.draft),Z(be=>be.length>0?be:F.attachments),yn.current=null),Ie(v instanceof Error?v.message:"无法发送消息")}}),ol=Vn({mutationFn:async v=>(await tn()).client.executeSessionCommand(v),onMutate:v=>{Ie(null),U(""),Z([]);const O=v.input.slice(1).trim().split(/\s+/)[0]??"",F=new Date().toISOString();qe({panel_id:`command-panel-pending-${Date.now()}`,session_id:v.sessionId,command_name:O,command_text:v.input,title:`正在执行 /${O}`,description:null,status:"running",body:"命令执行中…",submitted_at:F,updated_at:F,input_type:"none",options:[],input_placeholder:null,submit_label:null,effect:null})},onSuccess:async v=>{_d(v.panel),await j.invalidateQueries({queryKey:os})},onError:(v,O)=>{qe(null),U(F=>F||O.input),Ie(v instanceof Error?v.message:"无法执行命令")}}),ur=Vn({mutationFn:async v=>(await tn()).client.respondToSessionCommand(v),onMutate:()=>{Ie(null)},onSuccess:async v=>{_d(v.panel),await j.invalidateQueries({queryKey:os})},onError:v=>{Ie(v instanceof Error?v.message:"无法继续执行命令")}}),yd=Vn({mutationFn:async v=>(await tn()).client.respondToSessionInteraction(v),onMutate:async v=>{Ie(null),we(v.requestId),j.setQueryData(["interactions",v.sessionId],O=>(O??[]).map(F=>F.id===v.requestId?{...F,status:"submitting",updated_at:new Date().toISOString()}:F))},onSuccess:async(v,O)=>{await j.invalidateQueries({queryKey:["interactions",O.sessionId]})},onError:(v,O)=>{j.setQueryData(["interactions",O.sessionId],F=>(F??[]).map(be=>be.id===O.requestId?{...be,status:"pending"}:be)),we(null),Ie(v instanceof Error?v.message:"无法提交确认回复")}}),Ba=Vn({mutationFn:async v=>(await tn()).client.interruptSession(v),onMutate:async v=>{Ie(null),oe(!0),X(!1),_n.current&&(window.clearTimeout(_n.current),_n.current=null);const O=new Date().toISOString();as(F=>Tf(F,v,{run_state:"completed",run_state_changed_at:O,last_event_at:O})),j.setQueryData(["plan",v],null)},onSuccess:(v,O)=>{oe(!1),j.invalidateQueries({queryKey:os}),j.invalidateQueries({queryKey:["timeline",O]}),j.invalidateQueries({queryKey:["change-sets",O]})},onError:(v,O)=>{oe(!1),X(!0),j.invalidateQueries({queryKey:os}),j.invalidateQueries({queryKey:["plan",O]}),Ie(v instanceof Error?v.message:"无法中断会话")}});_.useEffect(()=>{!p||!pe||B||Ba.isPending||X(pe.run_state==="running")},[Ba.isPending,B,pe,pe==null?void 0:pe.run_state,p]);const Xn=Vn({mutationFn:async v=>(await wn({sessionId:v.sessionId})).client.updateSession(v)}),jc=Vn({mutationFn:async v=>(await wn({projectId:v.projectId,agentId:v.agentId})).client.updateThread(v)}),Ys=Vn({mutationFn:async v=>(await tn()).client.executeSessionGitAction({sessionId:p,action:v.action,path:v.path,branch:v.branch,message:v.message}),onMutate:async()=>{Ws(null)},onSuccess:(v,O)=>{j.setQueryData(["session-git-workspace",p],v.workspace),(O.action==="commit-all"||O.action==="switch-branch")&&j.invalidateQueries({queryKey:["session-git-history",p]})},onError:v=>{Ws(v instanceof Error?v.message:"无法执行 git 操作")}}),wc=Vn({mutationFn:async v=>(await tn()).client.executeSessionTurnAction({sessionId:p,turnId:v.turnId,action:"rollback"}),onMutate:()=>{Rs(null)},onSuccess:v=>{Rs(null),Pa(O=>({...O,[v.turn_id]:!0})),j.setQueryData(["session-git-workspace",p],v.workspace)},onError:(v,O)=>{Rs({turnId:O.turnId,message:v instanceof Error?v.message:"无法回滚这轮改动"})}}),ci=Vn({mutationFn:async v=>(await tn()).client.saveSessionRunCommand({sessionId:p,action:v.action,commandId:v.commandId,command:v.command}),onMutate:()=>{dn(null)},onSuccess:async({catalog:v})=>{await po(O=>({...O,command_catalog:v}))},onError:v=>{dn(v instanceof Error?v.message:"无法保存项目命令。")}}),Gn=Vn({mutationFn:async v=>(await tn()).client.saveSessionRunWebsite({sessionId:p,action:v.action,websiteId:v.websiteId,website:v.website}),onMutate:()=>{dn(null)},onSuccess:async({catalog:v})=>{await po(O=>({...O,website_catalog:v}))},onError:v=>{dn(v instanceof Error?v.message:"无法保存项目网页。")}}),Di=Vn({mutationFn:async()=>(await tn()).client.generateSessionRunCommand({sessionId:p,prompt:"",model:qm()}),onMutate:()=>{dn(null),J(null)},onSuccess:async({generation:v,catalog:O})=>{await po(F=>({...F,command_catalog:O})),J(v.reason)},onError:v=>{dn(v instanceof Error?v.message:"无法一键生成项目命令。")}}),go=Vn({mutationFn:async()=>(await tn()).client.generateSessionRunWebsite({sessionId:p,prompt:"",model:qm()}),onMutate:()=>{dn(null),G(null)},onSuccess:async({generation:v,catalog:O})=>{await po(F=>({...F,website_catalog:O})),G(v.reason)},onError:v=>{dn(v instanceof Error?v.message:"无法一键生成项目网页。")}}),is=Vn({mutationFn:async v=>(await tn()).client.executeSessionTerminalAction({sessionId:p,action:v.action,commandId:v.commandId,terminalId:v.terminalId}),onMutate:()=>{dn(null)},onSuccess:async(v,O)=>{j.setQueryData(["session-run-workbench",p],F=>F&&{...F,terminal_snapshot:v.snapshot}),(O.action==="run-command"||O.action==="run-kill-command")&&v.terminal&&(Un(!1),Et("terminal"),await Mi(v.terminal.id,{force:!0})),O.action==="focus"&&O.terminalId&&await Mi(O.terminalId),O.action==="close"&&O.terminalId&&De(F=>{const be={...F};return delete be[O.terminalId],be})},onError:v=>{dn(v instanceof Error?v.message:"无法执行终端操作。")}}),_o=al.data??[],vd=pe&&Pg(ca.data)!=="tail"?UA(pe):!1,cl=_.useMemo(()=>zA(ll,{projectPath:ra==null?void 0:ra.path,compactCompletedTurns:vd}),[vd,ra==null?void 0:ra.path,ll]),bd=_.useMemo(()=>qA(cl.blocks,_o),[cl.blocks,_o]),dr=_.useMemo(()=>{const v=ca.data,O=Mm(v),F=Pg(v),be=Math.max(0,Math.min(n2,aa)),Ue=Math.max(0,Math.min(1,be/Og));return{hasEarlierEntries:O,canLoadEarlierEntries:O||F!=="full_compact",isPulling:sr,pullDistance:be,isReadyToLoad:be>=Og,isLoadingFull:Ds,indicatorOffset:Ds?z0:Math.min(z0,be*.75),indicatorRotation:Ds?s2:Math.round(Ue*s2),triggerSource:ar}},[Ds,sr,ar,aa,ca.data]),fr=[...bd].reverse().find(v=>v.kind==="turn"&&!v.turn.completion)??null;_.useEffect(()=>{var be;if(typeof window>"u")return;const v=window,O=(be=v.requestIdleCallback)==null?void 0:be.call(v,()=>{B0()},{timeout:1500}),F=O===void 0?window.setTimeout(()=>{B0()},320):null;return()=>{var Ue;O!==void 0&&((Ue=v.cancelIdleCallback)==null||Ue.call(v,O)),F!==null&&window.clearTimeout(F)}},[]);const Oi=!!(pe&&ra),xd=!!p&&k.isPending&&!pe;pe??(pe=BM),ra??(ra=UM);const Sd=!!p&&en.sessionId!==p,Ii=!!p&&!Oi&&(en.pending||Sd||xd),ul=Ii?"正在载入会话…":k.error instanceof Error?k.error.message:en.error?en.error:"没有找到这个会话。",yo=pe.capability.can_send_input&&!B,Nc=yo&&(a===void 0||a==="online"),Ha=(cr.data??[]).filter(v=>v.status==="pending"||v.status==="submitting"),jd=(pe.run_state==="running"||Fe)&&!B||Ba.isPending,vo=yo&&Ha.length===0&&!jd&&!za.isPending,kc=(Sn==null?void 0:Sn.id)??pe.agent_id,Sh=_.useCallback((v,O)=>{Ke(F=>{if(!O.trim()){if(!(v in F))return F;const be={...F};return delete be[v],be}return{...F,[v]:O}})},[]),jh=_.useCallback((v,O)=>{const F=O.trim();!F||!vo||za.mutate({sessionId:pe.id,input:F,attachments:[],model:bt,reasoningEffort:$t,serviceTier:xt?"fast":void 0,planMode:ot,yoloMode:on,clearComposer:!1,proposedPlanEntryId:v})},[vo,xt,ot,on,bt,$t,za,pe.id]),wh=_.useCallback(v=>{wc.mutate({turnId:v})},[wc]),wd=wc.isPending?((vi=wc.variables)==null?void 0:vi.turnId)??null:null,Nh=_.useMemo(()=>i.jsx(GA,{sessionId:pe.id,sessions:lr,sessionRunState:pe.run_state,isDesktopSidebar:l?!!o:q,projectPath:ra.path,renderedBlocks:bd,lastToolGroupId:cl.lastToolGroupId,sessionChangeSets:_o,isSubagentTimelinePending:xh,isInitialTimelinePending:!!p&&ll.length===0&&(en.pending||Sd),hasTimeline:ll.length>0,proposedPlanReplyDrafts:Ve,pendingProposedPlanReplyEntryId:Nt,canRespondToProposedPlan:vo,onProposedPlanReplyDraftChange:Sh,onSubmitProposedPlanReply:jh,onPreviewImage:je,changeSetDiffs:nr,changeSetDiffErrors:Gs,loadingChangeSetDiffKeys:ai,onLoadSessionChangeSets:vh,onLoadChangeSetFileDiff:bh,onLoadFullTimeline:()=>{xc()},timelineLoadState:dr,canRollbackChangeSets:la,pendingRollbackTurnId:wd,rollbackTurnError:Ja,rolledBackTurnIds:Na,onRollbackTurn:wh},pe.id),[la,vo,Gs,nr,Sh,jh,l,q,o,xh,vh,bh,xc,ai,wh,Nt,ra.path,Ve,bd,cl.lastToolGroupId,wd,Ja,Na,pe.id,pe.run_state,_o,lr,ll.length,dr]),ui=_.useCallback(async(v,O,F)=>{var be;Ie(null),Dt(!1),O==="pin"||O==="unpin"?Ya.flushSync(()=>{as(Ue=>bp(Ue,v,{pinned:O==="pin"}))}):O==="rename"&&(F!=null&&F.trim())&&as(Ue=>bp(Ue,v,{title:F.trim()}));try{const Ue=await Xn.mutateAsync({sessionId:v,action:O,name:F}),gt=(be=Ue.affectedSessionIds)!=null&&be.length?Ue.affectedSessionIds:[v];if(O==="delete"){as(Xe=>S3(Xe,gt)),V();for(const Xe of gt)j.removeQueries({queryKey:["timeline",Xe],exact:!0}),j.removeQueries({queryKey:Fo(Xe),exact:!0}),j.removeQueries({queryKey:["change-sets",Xe],exact:!0}),Ei(Xe)}else as(Xe=>x3(Xe,gt,{...O==="rename"&&(F!=null&&F.trim())?{title:F.trim()}:{pinned:O==="pin"}}));if(v===pe.id&&O==="delete"){const Xe=Ue.nextSessionId;Xe?await nl(Xe):await yc()}}catch(Ue){j.invalidateQueries({queryKey:os}),Ie(Ue instanceof Error?Ue.message:"无法更新会话")}},[yc,nl,j,V,Ei,pe.id,Xn]),Ta=_.useCallback(async(v,O,F)=>{var Ue,gt;Ie(null),Dt(!1);const be=(Ue=F==null?void 0:F.name)==null?void 0:Ue.trim();O==="pin"||O==="unpin"?Ya.flushSync(()=>{as(Xe=>Tu(Xe,v,{pinned:O==="pin"}))}):O==="rename"&&be?as(Xe=>Tu(Xe,v,{display_name:be})):O==="reorder"&&((gt=F==null?void 0:F.orderedProjectIds)!=null&>.length)?as(Xe=>xp(Xe,F.orderedProjectIds??[])):O==="remove"||O==="archive"?(as(Xe=>Sp(Xe,v)),V()):O==="unarchive"&&(V(),j.invalidateQueries({queryKey:os}));try{const Xe=await jc.mutateAsync({projectId:v,agentId:(Sn==null?void 0:Sn.id)??pe.agent_id,action:O,name:F==null?void 0:F.name,orderedProjectIds:F==null?void 0:F.orderedProjectIds});if(O==="remove"||O==="archive"||O==="unarchive"){const Kt=Xe.nextSessionId;Kt?await nl(Kt):await yc()}}catch(Xe){j.invalidateQueries({queryKey:os}),Ie(Xe instanceof Error?Xe.message:"无法更新线程")}},[yc,nl,j,V,jc]),Ec=_.useCallback(async v=>{kc&&(Ji(kc),Js(null),Kr(null),ku(v),await N({to:"/"}))},[kc,N]),ua=((Bc=Ri.data)==null?void 0:Bc.steps.some(v=>v.status==="pending"||v.status==="in_progress"))??!1,hr=pe.run_state==="running"||Fe,Nd=!!((Hc=Ri.data)!=null&&Hc.updated_at&&Date.now()-new Date(Ri.data.updated_at).getTime()<=MM),Cc=Ri.data&&(ua||hr&&Nd)?Ri.data:null,Hs=pe.context_usage,Tc=Hs?Math.round(Hs.percent_used):0,mr=Math.max(0,100-Tc),kh=Hs?{"--usage-progress":`${Math.max(0,Math.min(100,Hs.percent_used))}%`}:void 0,Rc=Je.state==="connected"&&$n.state==="idle"&&hr&&!B&&!Ba.isPending&&!(fr!=null&&fr.turn.completion),dl=!!jn||gd.length>0;_.useEffect(()=>{p&&(Zn.current+=1,gn({state:"idle"}))},[p]),_.useEffect(()=>{if(!ue)return;(cr.data??[]).some(O=>O.id===ue&&O.status==="submitting")||we(null)},[cr.data,ue]),_.useEffect(()=>{var v;!p||!Oi||pe.run_state==="running"||za.isPending||Ba.isPending||fr||(v=Ri.data)!=null&&v.is_active||(_n.current&&(window.clearTimeout(_n.current),_n.current=null),X(!1))},[fr,Oi,Ba.isPending,(bi=Ri.data)==null?void 0:bi.is_active,za.isPending,pe,pe==null?void 0:pe.run_state,p]);const Ra=q?0:WA(),Vs=q||xe,Mc=q?0:Re??(xe?Ra:0),di=Ze&&typeof document<"u"?Ya.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:()=>{un(!1),_e(pe.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:ut,onChange:v=>_e(v.target.value),placeholder:"输入会话名称",autoFocus:!0}),i.jsxs("div",{className:"sheet-panel__actions",children:[i.jsx("button",{type:"button",className:"sheet-panel__button",onClick:()=>{un(!1),_e(pe.title)},children:"取消"}),i.jsx("button",{type:"button",className:"sheet-panel__button is-primary",disabled:!ut.trim()||Xn.isPending&&((xi=Xn.variables)==null?void 0:xi.sessionId)===pe.id,onClick:()=>{ui(pe.id,"rename",ut.trim()),un(!1)},children:"保存"})]})]})})]}),document.body):null,Eh=!(l?o:q)&&Jt&&typeof document<"u"?Ya.createPortal(i.jsxs("div",{className:"picker-sheet-wrap",role:"dialog","aria-modal":"true",children:[i.jsx("button",{type:"button",className:"picker-sheet__scrim",onClick:()=>Dt(!1),"aria-label":"关闭会话操作菜单"}),i.jsxs("div",{className:"picker-sheet",children:[i.jsx("div",{className:"picker-sheet__header",children:i.jsx("strong",{children:pe.title})}),i.jsxs("div",{className:"picker-sheet__list",children:[i.jsx("button",{type:"button",className:"picker-sheet__item",disabled:Xn.isPending&&((yl=Xn.variables)==null?void 0:yl.sessionId)===pe.id,onClick:()=>void ui(pe.id,pe.pinned?"unpin":"pin"),children:i.jsx("span",{children:pe.pinned?"取消置顶会话":"置顶会话"})}),i.jsx("button",{type:"button",className:"picker-sheet__item",disabled:Xn.isPending&&(($c=Xn.variables)==null?void 0:$c.sessionId)===pe.id,onClick:()=>{Dt(!1),un(!0)},children:i.jsx("span",{children:"重命名会话"})}),i.jsx("button",{type:"button",className:"picker-sheet__item is-danger",disabled:Xn.isPending&&((Fc=Xn.variables)==null?void 0:Fc.sessionId)===pe.id,onClick:()=>void ui(pe.id,"delete"),children:i.jsx("span",{children:"删除会话"})})]})]})]}),document.body):null,Ac=q?1:Ra>0?Mc/Ra:0,Li=!q&&Re!==null,kd=q?{"--desktop-sidebar-width":`${he}px`}:void 0,ws=l?!!o:q,bo=l?u:Mc,Dc=l?f:Li,da=Ys.isPending?Ys.variables??null:null,fl=na??(il.error instanceof Error?il.error.message:null),hl=Ua.error instanceof Error?Ua.error.message:null,pr=ms??(rl.error instanceof Error?rl.error.message:null),Ns=rl.data??null,Yn=(Ns==null?void 0:Ns.terminal_snapshot)??null,cs=(Ns==null?void 0:Ns.command_catalog.commands)??[],fi=(Ns==null?void 0:Ns.website_catalog.websites)??[],fa=wp(qm(),ht),ha=(Yn==null?void 0:Yn.terminals.find(v=>v.id===Yn.active_terminal_id))??(Yn==null?void 0:Yn.terminals[0])??null,ma=oa&&Le==="terminal",Oc=la&&Le==="git",hi=ws&&ma&&Cn,Ed=Oc&&ws,ml=(ma||Oc)&&ws&&!hi,gs=(ma||Oc)&&!ws,On=is.isPending&&((vl=is.variables)==null?void 0:vl.action)==="run-command"?is.variables.commandId??null:null,Wt=is.isPending&&((bl=is.variables)==null?void 0:bl.action)==="run-kill-command"?is.variables.commandId??null:null,mi=ci.isPending&&(($d=ci.variables)==null?void 0:$d.action)==="delete"?ci.variables.commandId??null:null,Zs=Gn.isPending&&((Fd=Gn.variables)==null?void 0:Fd.action)==="delete"?Gn.variables.websiteId??null:null;_.useEffect(()=>{!ws&&Cn&&hs(!1)},[Cn,ws]);const $a=v=>{tl.current=v,He(v)},pi=(v,O,F)=>(js.current={mode:xe?"close":"open",startX:v,startY:O,axis:"pending",pointerId:F},!0),Cd=(v,O)=>{const F=js.current;if(!F)return!1;const be=v-F.startX,Ue=O-F.startY;if(F.axis==="pending"){if(Math.abs(be)<8&&Math.abs(Ue)<8)return!1;if(F.axis=Math.abs(be)>Math.abs(Ue)?"x":"y",F.axis==="y")return js.current=null,$a(null),!1}const gt=F.mode==="open"?Math.max(0,Math.min(Ra,be)):Math.max(0,Math.min(Ra,Ra+be));return $a(gt),!0},Td=(v,O)=>{const F=js.current;if(!F)return;const be=v-F.startX,Ue=O-F.startY;if(F.axis==="pending"&&Math.abs(Ue)>48){js.current=null,$a(null);return}const Xe=(F.axis==="x"?tl.current??(F.mode==="open"?Math.max(0,Math.min(Ra,be)):Math.max(0,Math.min(Ra,Ra+be))):xe?Ra:0)>=Ra*CM;C(Xe),js.current=null,$a(null)},gr=_.useCallback(()=>{if(l){m==null||m();return}C(!0)},[l,m]),_r=_.useCallback(()=>{Ss(v=>!v)},[]),Rd=_.useCallback(()=>{Ie(null)},[]),xo=_.useCallback(()=>{Ft(v=>!v)},[]),Md=_.useCallback(v=>{nl(v)},[nl]),Pi=_.useCallback(v=>{const O=new Date().toISOString();if(ht.length===0){qe({panel_id:`${Ig}${Date.now()}`,session_id:pe.id,command_name:"model",command_text:v,title:"选择模型",description:"选择后会更新当前会话后续发送时使用的模型。",status:"completed",body:"当前没有可选模型,请先去设置页维护模型列表。",submitted_at:O,updated_at:O,input_type:"none",options:[],input_placeholder:null,submit_label:null,effect:null});return}qe({panel_id:`${Ig}${Date.now()}`,session_id:pe.id,command_name:"model",command_text:v,title:"选择模型",description:"选择后会更新当前会话后续发送时使用的模型。",status:"awaiting_input",body:"在下面选择一个模型。",submitted_at:O,updated_at:O,input_type:"choice",options:ht.map(F=>({id:F.value,label:F.label,description:F.description??null})),input_placeholder:null,submit_label:null,effect:null})},[ht,pe.id]),gi=_.useCallback(()=>{if(Nc){if(z_(ke)){if(ve.length>0){Ie("命令暂不支持附件,请先移除附件后再执行。");return}if(oA(ke)==="model"){Ie(null),U(""),Pi(ke);return}ol.mutate({sessionId:pe.id,input:ke});return}za.mutate({sessionId:pe.id,input:ke.trim(),attachments:ve,model:bt,reasoningEffort:$t,serviceTier:xt?"fast":void 0,planMode:ot,yoloMode:on})}},[Nc,ke,xt,ot,on,ol,Pi,ve,bt,$t,za,pe.id]),Ui=_.useCallback(()=>{qe(null)},[]),_i=_.useCallback(v=>{if(wt){if(wt.panel_id.startsWith(Ig)){Ut(v),qe(O=>O&&{...O,status:"completed",body:`后续消息将优先使用 ${wp(v,ht)}。`,updated_at:new Date().toISOString(),input_type:"none",options:[]});return}ur.mutate({sessionId:pe.id,panelId:wt.panel_id,optionId:v})}},[wt,ur,ht,pe.id]),Ad=_.useCallback(v=>{wt&&ur.mutate({sessionId:pe.id,panelId:wt.panel_id,text:v})},[wt,ur,pe.id]),Dd=_.useCallback(v=>{yd.mutate({sessionId:pe.id,requestId:v.requestId,optionId:v.optionId??null,text:v.text??null,answers:v.answers})},[yd,pe.id]),pl=_.useCallback(v=>{const O=[...v];O.length!==0&&(Ie(null),Promise.all(O.map(F=>gx(F))).then(F=>{Z(be=>[...be,...F])}).catch(F=>{Ie(F instanceof Error?F.message:"无法读取附件")}))},[]),Ic=_.useCallback(v=>{Z(O=>O.filter(F=>F.id!==v))},[]),yr=_.useCallback(()=>{Ba.isPending||B||Ba.mutate(pe.id)},[Ba,B,pe.id]),_s=_.useCallback(()=>{rt(v=>!v)},[]),yi=_.useCallback(v=>{v==="git"&&!la||v==="terminal"&&!oa||(Ws(null),dn(null),Un(!1),Ps(!1),hs(!1),Et(v))},[la,oa]);_.useEffect(()=>{if(!ml)return;const v=O=>{var be,Ue;const F=O.target;F instanceof Node&&((be=ge.current)!=null&&be.contains(F)||(Ue=te.current)!=null&&Ue.contains(F)||yi("code"))};return window.addEventListener("pointerdown",v),()=>{window.removeEventListener("pointerdown",v)}},[yi,ml]);const Ch=_.useCallback(()=>{Ws(null),il.refetch()},[il]),zp=_.useCallback(()=>{Ua.refetch()},[Ua]),Bp=_.useCallback(()=>{Ua.data||Ua.isFetching||Ua.refetch()},[Ua]),Hp=_.useCallback(v=>{Ys.mutate({action:"discard-file",path:v})},[Ys]),Jn=_.useCallback(()=>{Ys.mutate({action:"discard-all"})},[Ys]),Od=_.useCallback(v=>{Ys.mutate({action:"commit-all",message:v})},[Ys]),So=_.useCallback(async(v,O)=>{Ws(null);const F=(O==null?void 0:O.trim())??"";F&&await Ys.mutateAsync({action:"commit-all",message:F}),await Ys.mutateAsync({action:"switch-branch",branch:v})},[Ys]),jo=_.useCallback(()=>{Ys.mutate({action:"push"})},[Ys]),Id=_.useCallback(async(v,O,F)=>(await tn()).client.getSessionGitHistoryFileDiff(pe.id,{commitOid:v,path:O,previousPath:F}),[tn,pe.id]),gl=_.useCallback(async(v,O)=>(await tn()).client.getSessionGitWorkspaceFileDiff(pe.id,{path:v,previousPath:O}),[tn,pe.id]),vr=_.useCallback(v=>{is.mutate({action:"run-command",commandId:v})},[is]),Th=_.useCallback(async()=>{if(!(cs.length===0||Us||xs)){Ms(!0);try{for(const v of cs)await is.mutateAsync({action:"run-command",commandId:v.id})}finally{Ms(!1)}}},[Us,xs,cs,is]),Ld=_.useCallback(async()=>{if(Us||xs)return;const v=cs.filter(O=>!!O.kill_command);if(v.length!==0){As(!0);try{for(const O of v)await is.mutateAsync({action:"run-kill-command",commandId:O.id})}finally{As(!1)}}},[Us,xs,cs,is]),$p=_.useCallback(v=>{is.mutate({action:"run-kill-command",commandId:v})},[is]),Pd=_.useCallback(v=>{ci.mutate({action:v.commandId?"update":"create",commandId:v.commandId,command:v.draft})},[ci]),zi=_.useCallback(v=>{ci.mutate({action:"delete",commandId:v})},[ci]),Lc=_.useCallback(()=>{Di.mutate()},[Di]),wo=_.useCallback(v=>{Gn.mutate({action:v.websiteId?"update":"create",websiteId:v.websiteId,website:v.draft})},[Gn]),Ud=_.useCallback(v=>{Gn.mutate({action:"delete",websiteId:v})},[Gn]),br=_.useCallback(()=>{go.mutate()},[go]),Pc=_.useCallback(()=>{Ps(!1)},[]),Uc=_.useCallback(v=>{is.mutate({action:"focus",terminalId:v}),Et("terminal")},[is]),zc=_.useCallback(v=>{is.mutate({action:"close",terminalId:v})},[is]),Rh=_.useCallback(()=>{!ws||!oa||(Et("terminal"),hs(v=>!v))},[oa,ws]),zd=_.useMemo(()=>{var v,O,F;return i.jsxs("div",{className:"conversation-topbar__title-actions",children:[i.jsx("button",{type:"button",className:"conversation-topbar__more",onClick:()=>Dt(be=>!be),"aria-label":"更多会话选项",children:i.jsx(FM,{})}),Jt&&ws?i.jsxs("div",{className:"topbar-menu",role:"menu",children:[i.jsx("button",{type:"button",className:"topbar-menu__item",disabled:Xn.isPending&&((v=Xn.variables)==null?void 0:v.sessionId)===pe.id,onClick:()=>void ui(pe.id,pe.pinned?"unpin":"pin"),children:pe.pinned?"取消置顶会话":"置顶会话"}),i.jsx("button",{type:"button",className:"topbar-menu__item",disabled:Xn.isPending&&((O=Xn.variables)==null?void 0:O.sessionId)===pe.id,onClick:()=>{Dt(!1),un(!0)},children:"重命名会话"}),i.jsx("button",{type:"button",className:"topbar-menu__item is-danger",disabled:Xn.isPending&&((F=Xn.variables)==null?void 0:F.sessionId)===pe.id,onClick:()=>void ui(pe.id,"delete"),children:"删除会话"})]}):null]})},[ui,Jt,ws,pe.id,pe.pinned,Xn.isPending,(jr=Xn.variables)==null?void 0:jr.sessionId]),Bi=_.useMemo(()=>oa||la?i.jsxs("div",{className:"conversation-topbar__actions",children:[oa?i.jsxs("div",{className:"conversation-topbar__run-group",children:[i.jsx("button",{type:"button",className:`conversation-topbar__run-button ${pn?"is-active":""}`,onClick:()=>{Ps(!1),Un(v=>!v)},"aria-expanded":pn,"aria-haspopup":"dialog","aria-label":"打开项目命令列表",children:i.jsx(GM,{})}),pn?i.jsx("div",{className:"conversation-run-popover",role:"dialog","aria-label":"项目命令列表",children:i.jsx(uM,{commands:cs,nodeRuntime:(Ns==null?void 0:Ns.node_runtime)??null,error:pr,pendingRunCommandId:On,pendingKillCommandId:Wt,pendingDeleteCommandId:mi,isSaving:ci.isPending,isGenerating:Di.isPending,isStartingAll:Us,isStoppingAll:xs,generationReason:Rt,executionModelLabel:fa,onRun:vr,onRunAll:Th,onRunAllKill:Ld,onRunKill:$p,onSave:Pd,onDelete:zi,onGenerate:Lc})}):null]}):null,oa?i.jsxs("div",{className:"conversation-topbar__run-group",children:[i.jsx("button",{type:"button",className:`conversation-topbar__run-button ${ps?"is-active":""}`,onClick:()=>{Un(!1),Ps(v=>!v)},"aria-expanded":ps,"aria-haspopup":"dialog","aria-label":"打开项目网页列表",children:i.jsx(YM,{})}),ps?i.jsx("div",{className:"conversation-run-popover",role:"dialog","aria-label":"项目网页列表",children:i.jsx(gM,{websites:fi,error:pr,pendingDeleteWebsiteId:Zs,isSaving:Gn.isPending,isGenerating:go.isPending,generationReason:M,executionModelLabel:fa,onOpen:Pc,onSave:wo,onDelete:Ud,onGenerate:br})}):null]}):null,oa||la?i.jsxs("div",{ref:te,className:"conversation-topbar__view-toggle","aria-label":"切换工作台面板",children:[i.jsx("button",{type:"button",className:`conversation-topbar__view-button ${Le==="code"?"is-active":""}`,onClick:()=>yi("code"),"aria-pressed":Le==="code","aria-label":"切换到代码会话视图",children:i.jsx(WM,{})}),oa?i.jsx("button",{type:"button",className:`conversation-topbar__view-button ${Le==="terminal"?"is-active":""}`,onClick:()=>yi("terminal"),"aria-pressed":Le==="terminal","aria-label":"切换到终端视图",children:i.jsx(QM,{})}):null,la?i.jsx("button",{type:"button",className:`conversation-topbar__view-button ${Le==="git"?"is-active":""}`,onClick:()=>yi("git"),"aria-pressed":Le==="git","aria-label":"切换到 git 视图",children:i.jsx(KM,{})}):null]}):null]}):null,[Le,la,oa,Rt,M,Us,xs,fa,Di.isPending,go.isPending,zi,Lc,Ud,br,Pc,vr,Th,Ld,Pd,wo,yi,pn,ps,mi,Zs,On,cs,fi,pr,ci.isPending,Gn.isPending]),xr=i.jsx(iM,{workspace:il.data??null,history:Ua.data??null,isLoading:il.isPending,isHistoryLoading:Ua.isFetching,error:fl,historyError:hl,onRefresh:Ch,onRefreshHistory:zp,onRequestHistory:Bp,onDiscardFile:Hp,onDiscardAll:Jn,onCommitAll:Od,onSwitchBranch:So,onPush:jo,onLoadWorkspaceFileDiff:gl,onLoadHistoryFileDiff:Id,pendingAction:da,compact:Ed}),Mh=i.jsx(NM,{terminals:(Yn==null?void 0:Yn.terminals)??[],activeTerminalId:(ha==null?void 0:ha.id)??null,outputs:Ee,error:pr,compact:ml||hi,canToggleFullscreen:ws,isFullscreen:hi,onSelectTerminal:Uc,onCloseTerminal:zc,onToggleFullscreen:Rh}),Ah=i.jsx(xx,{isDesktopSidebar:ws,sidebarShift:bo,isSidebarDragging:Dc,composerError:Oe,onDismissComposerError:Rd,interactionRequests:Ha,pendingInteractionRequestId:ue,onRespondInteraction:Dd,parentSession:jn,backgroundAgentSessions:gd,isBackgroundAgentsOpen:It,planSnapshot:Cc,onToggleBackgroundAgents:xo,onOpenSession:Md,getBackgroundAgentStatusLabel:jA,getBackgroundAgentAccent:bA,formatBackgroundAgentsLabel:pA,hasBackgroundAgentStrip:dl,commandPanel:wt,isCommandPanelPending:ol.isPending||ur.isPending,onDismissCommandPanel:Ui,onCommandPanelOptionSelect:_i,onCommandPanelTextSubmit:Ad,projectId:pe.project_id,agentId:(Sn==null?void 0:Sn.id)??pe.agent_id,draft:ke,pendingAttachments:ve,canSendInput:yo,canSubmitInput:Nc,isInputLocked:Ha.length>0,readOnlyPlaceholder:Ha.length>0?"请先处理上方确认请求":void 0,onDraftChange:U,onUploadFiles:pl,onRemoveAttachment:Ic,onSubmit:gi,showStopIcon:jd,isSendPending:za.isPending||ol.isPending||ur.isPending,onInterrupt:yr,isFastModeEnabled:xt,isPlanModeEnabled:ot,isYoloModeEnabled:on,onToggleFastMode:()=>it(v=>!v),onTogglePlanMode:()=>ln(v=>!v),onToggleYoloMode:()=>kn(v=>!v),showModeBadges:!0,selectedModel:bt,modelOptions:ht,selectedReasoning:$t,onSelectModel:Ut,onSelectReasoning:v=>zt(v),contextUsage:Hs,isContextUsageOpen:ze,onToggleContextUsage:_s,contextUsageRingStyle:kh,usedPercent:Tc,remainingPercent:mr,usedTokensLabel:o2((Hs==null?void 0:Hs.used_tokens)??0),totalTokensLabel:o2((Hs==null?void 0:Hs.total_tokens)??0),showJumpToBottom:Pe,onJumpToBottom:vc}),Sr=ma?Mh:xr,_l=gs||hi,No=_l?i.jsxs("div",{ref:ee,className:`conversation-main ${ws?"has-desktop-sidebar":""} ${hi?"is-terminal-fullscreen":""}`,style:{transform:`translateX(${bo}px)`,transition:Dc?"none":void 0},children:[i.jsxs("div",{className:"conversation-topbar",children:[ws?null:i.jsxs("button",{type:"button",className:"conversation-menu",onClick:gr,"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:pe.title}),zd]})}),Bi]}),i.jsx("div",{ref:me,className:`conversation-scroll ${_l?"conversation-scroll--workbench":""}`,children:i.jsx("div",{className:`session-workbench-surface ${hi?"is-terminal-fullscreen":""}`,children:Sr})})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:`session-detail-workspace ${ml?"has-workbench-panel":""}`,children:[i.jsx(kM,{conversationMainRef:ee,conversationScrollRef:me,isDesktopSidebar:ws,sidebarShift:bo,isSidebarDragging:Dc,title:pe.title,titleActions:zd,topbarActions:Bi,onOpenSidebar:gr,threadContent:Nh,connectionStatus:Je,sessionRecoveryStatus:$n,isConnectionDetailOpen:zn,onToggleConnectionDetail:_r,showThinkingStatus:Rc}),ml?i.jsx("aside",{ref:ge,className:"session-workbench-rail",children:Sr}):null]}),hi?null:Ah]}),Hi=i.jsxs(i.Fragment,{children:[di,Eh,Se&&typeof document<"u"?Ya.createPortal(i.jsxs("div",{className:"attachment-lightbox",role:"dialog","aria-modal":"true","aria-label":`预览 ${Se.label}`,children:[i.jsx("button",{type:"button",className:"attachment-lightbox__scrim",onClick:()=>je(null),"aria-label":"关闭图片预览"}),i.jsxs("div",{className:"attachment-lightbox__panel",children:[i.jsx("button",{type:"button",className:"attachment-lightbox__close",onClick:()=>je(null),"aria-label":"关闭图片预览",children:i.jsx(qM,{})}),i.jsx("div",{className:"attachment-lightbox__frame",children:i.jsx("img",{src:Se.src,alt:Se.label,className:"attachment-lightbox__image"})}),i.jsxs("div",{className:"attachment-lightbox__meta",children:[i.jsx("div",{className:"attachment-lightbox__title",children:Se.label}),i.jsx("div",{className:"attachment-lightbox__hint",children:Se.meta})]})]})]}),document.body):null]});if(!Oi){const v=i.jsx("div",{className:"conversation-main conversation-main--empty",children:Ii?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:ul})});return l?i.jsxs(i.Fragment,{children:[v,Hi]}):i.jsxs("div",{className:"conversation-page",children:[v,Hi]})}return l?i.jsxs(i.Fragment,{children:[No,Hi]}):i.jsxs("div",{ref:Y,className:`conversation-page ${q?"has-desktop-sidebar":""}`,style:kd,onPointerDown:v=>{q||v.pointerType!=="touch"&&(v.pointerType==="mouse"&&v.button!==0||dd(v.target)||(pi(v.clientX,v.clientY,v.pointerId),v.currentTarget.setPointerCapture(v.pointerId)))},onPointerMove:v=>{if(q||v.pointerType==="touch")return;const O=js.current;!O||O.pointerId!==v.pointerId||!Cd(v.clientX,v.clientY)||v.preventDefault()},onPointerUp:v=>{if(q||v.pointerType==="touch")return;const O=js.current;!O||O.pointerId!==v.pointerId||Td(v.clientX,v.clientY)},onPointerCancel:v=>{if(q||v.pointerType==="touch")return;const O=js.current;!O||O.pointerId!==v.pointerId||(js.current=null,$a(null))},children:[i.jsx(fx,{open:Vs,progress:Ac,isDragging:Li,desktopPinned:q,isDesktopResizing:L,onClose:()=>{q||(C(!1),$a(null))},onDesktopResizeStart:v=>{Ci.current=li.current,fo.current={startX:v,startWidth:li.current},ae(!0)},currentAgent:Sn??void 0,agentIndicatorState:Sn?a??(Sn.status==="online"?"online":"offline"):void 0,projects:Pp,sessions:lr,projectStats:_h,historySessionsByProject:Object.fromEntries(Object.entries(P).map(([v,O])=>[v,O.sessions])),archivedSessionsByProject:Object.fromEntries(Object.entries(Q).map(([v,O])=>[v,O.sessions])),historyPageStateByProject:P,archivedPageStateByProject:Q,activeSessionId:pe.id,onCreateSession:v=>{Ec(v)},onSessionAction:ui,onThreadAction:Ta,onLoadMoreHistory:v=>{se(v)},onLoadMoreArchived:v=>{W(v)},pendingSessionActionId:Xn.isPending?((Eo=Xn.variables)==null?void 0:Eo.sessionId)??null:null,pendingThreadActionId:jc.isPending?((qd=jc.variables)==null?void 0:qd.projectId)??null:null}),No,Hi]})},VA=({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:"切换节点"})]})]})},h2=1100,Bx="panda:desktop-sidebar-width",Df="panda:desktop-sidebar-width-version",Of="2026-03-24-narrow",ZA=300,Hx=232,yu=Hx,XA=460,zg=.4,JA=56,eD=56,tD=160,m2=5,nD=_.lazy(async()=>({default:(await Zr(()=>import("./session-file-preview-page-tFsJlNPN.js").then(t=>t.s),__vite__mapDeps([2,1]))).SessionFilePreviewPage})),p2=e=>{const t=new Date((e==null?void 0:e.generated_at)??"").getTime();return Number.isFinite(t)?t:0},sD=(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||p2(o)>p2(a))&&(a=o);return a},aD=()=>typeof window>"u"?248:Math.max(0,Math.min(248,window.innerWidth-84)),iD=()=>typeof window>"u"?0:Math.max(window.innerWidth,0),F0=e=>Math.max(Hx,Math.min(XA,e)),rD=()=>{if(typeof window>"u")return yu;try{const e=window.localStorage.getItem(Bx),t=window.localStorage.getItem(Df);if(!e)return window.localStorage.setItem(Df,Of),yu;const a=Number(e);if(!Number.isFinite(a))return window.localStorage.setItem(Df,Of),yu;const o=t!==Of||a===ZA||a>yu?yu:a;return window.localStorage.setItem(Df,Of),F0(o)}catch{return yu}},$x=()=>{var As,Rt;const e=ja(J=>J.openSettingsOverlay),{agentId:t}=ad({strict:!1}),a=ki(),l=La(),o=_.useRef(null),[u,f]=_.useState(()=>pc()),[m,y]=_.useState(()=>pk()??mp()),[g,S]=_.useState(()=>gk()),[p,b]=_.useState(()=>_k()?"directory-picker":"composer"),[w,N]=_.useState(!1),[j,T]=_.useState(!1),[D,z]=_.useState(()=>typeof window<"u"&&window.innerWidth>=h2),[I,k]=_.useState(()=>rD()),[P,Q]=_.useState(!1),[se,W]=_.useState({state:"connected",attempt:0,maxAttempts:m2}),[V,Y]=_.useState(null),[ee,me]=_.useState(null),ge=_.useRef(null),te=_.useRef(null),xe=_.useRef(null),C=_.useRef(null),q=_.useRef(null),ie=_.useRef(I),he=_.useRef(null),re=_.useRef(null),L=_.useRef(null),ae=_.useRef(0),ke=_.useRef(null),U=_.useRef(!1),ve=_.useRef(!1),Z=_.useRef(!1),Se=_.useRef(null),je=_.useRef(null),Oe=t??u??null,Ie=Oe?{agentId:Oe}:void 0,qe=l.getQueryData(R0({scope:Ie}))??sD(l.getQueriesData({queryKey:os}),Oe),bt=m&&!(qe!=null&&qe.sessions.some(J=>J.id===m))?m:null,Ut=_.useRef({agentId:Oe,selectedSessionIdHint:bt});ch(Oe);const $t=I_({enabled:!1}),zt=$t.data,xt=ox({scope:Ie,selectedSessionId:bt,enabled:!!Oe}),it=xt.data??qe,{historyState:ot,archivedState:ln,loadMoreHistory:on,loadMoreArchived:kn,reset:En}=ux({scope:Ie,selectedSessionId:m??null}),ht=[...Object.values(ot).flatMap(J=>J.sessions),...Object.values(ln).flatMap(J=>J.sessions)];_.useEffect(()=>{t&&(f(t),Ji(t),y(null))},[t]),_.useEffect(()=>{it&&(f(J=>{var M;return J&&(((M=it.agent)==null?void 0:M.id)===J||zt!=null&&zt.agents.some(G=>G.id===J))?J:null}),y(J=>J&&(it.sessions.some(M=>M.id===J)||ht.some(M=>M.id===J)||xt.isPending||xt.isFetching||xt.isError)?J:null))},[zt==null?void 0:zt.agents,ht,it,xt.isError,xt.isFetching,xt.isPending]),_.useEffect(()=>{t||u||(z6(),a({to:"/nodes",replace:!0}))},[a,t,u]),_.useEffect(()=>{if(!it||t||!u||m)return;const J=mp(),M=it.sessions.find(G=>G.id===J)??null;M&&(y(M.id),Js(M.id))},[t,u,m,it]);const Ve=(Oe?(zt==null?void 0:zt.agents.find(J=>J.id===Oe))??null:null)??null,Ke=_.useMemo(()=>{const J=(it==null?void 0:it.agent)??(Ve?{id:Ve.id,name:Ve.name,display_name:Ve.display_name,status:Ve.status}:null);if(!J)return null;const M=(Ve==null?void 0:Ve.status)??J.status,G=(Ve==null?void 0:Ve.name)??J.name,Ee=(Ve==null?void 0:Ve.display_name)??J.display_name;return J.status===M&&J.name===G&&J.display_name===Ee?J:{...J,name:G,display_name:Ee,status:M}},[Ve,it==null?void 0:it.agent]),Nt=Ke?xT(Ke.status,se.state):void 0,Bt=(it==null?void 0:it.projects)??[],Jt=(it==null?void 0:it.sessions)??[],Dt=(it==null?void 0:it.project_stats)??[],Ze=m?Jt.find(J=>J.id===m)??null:null,un=Ze?Bt.find(J=>J.id===Ze.project_id)??null:null,ut=!!(Ze&&un);_.useEffect(()=>{T(!1),me(null),te.current=null},[Ze==null?void 0:Ze.id,un==null?void 0:un.id]);const _e=!!Oe&&!Ke&&($t.isPending||$t.isFetching||xt.isPending||xt.isFetching),Fe=!!m&&!Jt.some(J=>J.id===m)&&(xt.isPending||xt.isFetching),X=_e||Fe,B=(Ze==null?void 0:Ze.id)??(X?m??null:null);Ut.current={agentId:(Ke==null?void 0:Ke.id)??Oe,selectedSessionIdHint:bt},_.useEffect(()=>{const J=(Ve==null?void 0:Ve.status)??null,M=Se.current;Se.current=J;const G=(Oe==null?void 0:Oe.trim())??"";if(!G||J!=="online"){J!=="online"&&(je.current=null);return}if(!(M!=="online"||!it))return;const De=`${G}:${M!=="online"?"online":"missing"}:${bt??""}`;je.current!==De&&(je.current=De,Rf(l,{scope:{agentId:G},selectedSessionId:bt}))},[Oe,Ve==null?void 0:Ve.status,l,it,bt]),_.useEffect(()=>{var De;if(!Ut.current.agentId){ke.current!==null&&(clearTimeout(ke.current),ke.current=null),(De=L.current)==null||De.stream.close(),L.current=null,U.current=!1,ve.current=!1,Z.current=!1;return}let J=!1;const M=++ae.current,G=()=>{ke.current!==null&&(clearTimeout(ke.current),ke.current=null)},Ee=Pe=>{const $e=(Pe==null?void 0:Pe.includeHubDirectory)??!1;G(),ke.current=setTimeout(()=>{ke.current=null;const Je=Ut.current,Ye=[Rf(l,{scope:Je.agentId?{agentId:Je.agentId}:void 0,selectedSessionId:Je.selectedSessionIdHint})];$e&&Ye.unshift(k3(l)),Promise.allSettled(Ye)},tD)};return wn({agentId:Ut.current.agentId}).then(Pe=>{var Ye,en;if(J||ae.current!==M)return;const $e=Pe.client.getConnectionKey();if(((Ye=L.current)==null?void 0:Ye.key)===$e)return;(en=L.current)==null||en.stream.close(),U.current=!1,ve.current=!1,Z.current=!1;const Je=Pe.client.createEventStream(jt=>{var bn,Tn,xn,zn,Ss,_n;const $n=typeof((bn=jt.payload)==null?void 0:bn.sessionId)=="string"?jt.payload.sessionId:null,gn=typeof((Tn=jt.payload)==null?void 0:Tn.projectId)=="string"?jt.payload.projectId:null;if(jt.type==="agent.online"){if(Z.current){Z.current=!1;return}En(),Ee({includeHubDirectory:!0});return}if(jt.type==="thread.updated"&&gn){const qt=typeof((xn=jt.payload)==null?void 0:xn.action)=="string"?jt.payload.action:"",yn=(zn=jt.payload)!=null&&zn.projectPatch&&typeof jt.payload.projectPatch=="object"?jt.payload.projectPatch:null,Zn=Array.isArray((Ss=jt.payload)==null?void 0:Ss.orderedProjectIds)?jt.payload.orderedProjectIds.filter(A=>typeof A=="string"&&A.trim().length>0):[];if((qt==="pin"||qt==="unpin"||qt==="rename")&&yn){l.setQueriesData({queryKey:os},A=>Tu(A,gn,yn));return}if(qt==="reorder"&&Zn.length>0){l.setQueriesData({queryKey:os},A=>xp(A,Zn));return}if(qt==="remove"||qt==="archive"){En(),l.setQueriesData({queryKey:os},A=>Sp(A,gn));return}if(qt==="unarchive"){En();const A=Ut.current;Rf(l,{scope:A.agentId?{agentId:A.agentId}:void 0,selectedSessionId:A.selectedSessionIdHint});return}}if(jt.type==="session.updated"&&$n){const qt=(_n=jt.payload)!=null&&_n.sessionPatch&&typeof jt.payload.sessionPatch=="object"?C0(jt.payload.sessionPatch):null,yn=Ut.current,Zn=l.getQueryData(R0({scope:yn.agentId?{agentId:yn.agentId}:void 0,selectedSessionId:yn.selectedSessionIdHint})),A=vp(Zn,$n);if(qt&&A){l.setQueriesData({queryKey:os},le=>Tf(le,$n,qt));return}if(A)return;Rf(l,{scope:yn.agentId?{agentId:yn.agentId}:void 0,selectedSessionId:yn.selectedSessionIdHint})}},{onStatus:jt=>{if(W(jt),jt.state==="connected"){Z.current=!0,U.current&&ve.current&&(ve.current=!1,En(),Ee({includeHubDirectory:Pe.mode==="hub"})),U.current=!0;return}U.current&&(ve.current=!0)}});L.current={key:$e,stream:Je}}).catch(Pe=>{J||ae.current!==M||W({state:"failed",attempt:0,maxAttempts:m2,error:Pe instanceof Error?Pe.message:"无法建立节点工作区连接"})}),()=>{J=!0}},[Ke==null?void 0:Ke.id,Ke==null?void 0:Ke.status,Oe,l,En]),_.useEffect(()=>()=>{var J;ae.current+=1,ke.current!==null&&(clearTimeout(ke.current),ke.current=null),(J=L.current)==null||J.stream.close(),L.current=null},[]),_.useEffect(()=>{ie.current=I},[I]),_.useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(Bx,String(F0(I))),window.localStorage.setItem(Df,Of)}catch{}},[I]),_.useEffect(()=>{if(typeof window>"u")return;const J=()=>{const M=window.innerWidth>=h2;z(M),M&&(N(!1),Y(null))};return J(),window.addEventListener("resize",J),()=>{window.removeEventListener("resize",J)}},[]),_.useEffect(()=>{if(!P)return;const J=G=>{const Ee=q.current;if(!Ee)return;const De=G.clientX-Ee.startX,Pe=F0(Ee.startWidth+De);he.current=Pe,re.current===null&&(re.current=window.requestAnimationFrame(()=>{re.current=null;const $e=he.current;$e!==null&&k($e)}))},M=()=>{re.current!==null&&(window.cancelAnimationFrame(re.current),re.current=null);const G=he.current??ie.current;he.current=null,q.current=null,Q(!1),ie.current=G,k(G)};return window.addEventListener("pointermove",J),window.addEventListener("pointerup",M),()=>{window.removeEventListener("pointermove",J),window.removeEventListener("pointerup",M)}},[P]),_.useEffect(()=>()=>{re.current!==null&&window.cancelAnimationFrame(re.current)},[]);const oe=Vn({mutationFn:async J=>(await wn({sessionId:J.sessionId})).client.updateSession(J)}),ue=Vn({mutationFn:async J=>(await wn({projectId:J.projectId,agentId:J.agentId})).client.updateThread(J)}),we=J=>{l.setQueriesData({queryKey:os},J)},Re=J=>Jt.find(M=>M.id===J)??ht.find(M=>M.id===J)??((Ze==null?void 0:Ze.id)===J?Ze:null),He=async(J,M,G)=>{var Pe;const Ee=await oe.mutateAsync({sessionId:J,action:M,name:G}),De=(Pe=Ee.affectedSessionIds)!=null&&Pe.length?Ee.affectedSessionIds:[J];if(M==="delete"?(we($e=>S3($e,De)),En()):we($e=>x3($e,De,{...M==="rename"&&(G!=null&&G.trim())?{title:G.trim()}:{pinned:M==="pin"}})),M==="delete"&&m===J){const $e=Ee.nextSessionId;$e?(Js($e),y($e)):(Js(null),y(null))}},ze=async(J,M,G)=>{var Pe,$e;const Ee=await ue.mutateAsync({projectId:J,agentId:(Ke==null?void 0:Ke.id)??u??t??"",action:M,name:G==null?void 0:G.name,orderedProjectIds:G==null?void 0:G.orderedProjectIds}),De=(Pe=G==null?void 0:G.name)==null?void 0:Pe.trim();M==="pin"||M==="unpin"?we(Je=>Tu(Je,J,{pinned:M==="pin"})):M==="rename"&&De?we(Je=>Tu(Je,J,{display_name:De})):M==="reorder"&&(($e=G==null?void 0:G.orderedProjectIds)!=null&&$e.length)?we(Je=>xp(Je,G.orderedProjectIds??[])):M==="remove"||M==="archive"?(we(Je=>Sp(Je,J)),En()):M==="unarchive"&&(En(),l.invalidateQueries({queryKey:os})),Ze&&Ze.project_id===J&&(M==="remove"||M==="archive"||M==="unarchive")&&(Ee.nextSessionId?(Js(Ee.nextSessionId),y(Ee.nextSessionId)):(Js(null),y(null)))},rt=async J=>{Ke&&(Ji(Ke.id),Js(null),Kr(null),Cf(!1),ku(J),S(J),b("composer"),y(null),await a({to:"/"}))},It=async()=>{Ke&&(D||(N(!1),ms(null)),Ji(Ke.id),Js(null),Kr(null),ku(null),Cf(!0),S(null),b("directory-picker"),y(null),await a({to:"/"}))},Ft=async J=>{await rt(J)},Le=async J=>{const M=Re(J);S(null),b("composer"),Cf(!1),ku(null),Kr(null),M&&!Jt.some(Ee=>Ee.id===J)&&we(Ee=>j3(Ee,M)),y(J),Js(J);const G=(M==null?void 0:M.agent_id)??(Ke==null?void 0:Ke.id)??Oe;G&&(f(G),Ji(G)),t&&await a({to:"/",replace:!0})},Et=D?0:aD(),Cn=D?0:iD(),hs=D||w,na=D?0:V??(w?Et:0),Ws=D?0:ee??(j?Cn:0),Ja=D?1:Et>0?na/Et:0,Rs=!D&&V!==null,Na=!D&&ee!==null,Pa=D?{"--desktop-sidebar-width":`${I}px`}:{"--workspace-preview-shift":`${Ws}px`},ms=J=>{ge.current=J,Y(J)},dn=J=>{te.current=J,me(J)},pn=J=>J instanceof Element&&!!J.closest('button, textarea, input, a, [role="dialog"]'),Un=J=>pn(J),ps=(J,M,G)=>(C.current={target:"sidebar",mode:w?"close":"open",startX:J,startY:M,axis:"pending",pointerId:G},!0),Ps=(J,M,G)=>ut?(C.current={target:"preview",mode:"open",startX:J,startY:M,axis:"pending",pointerId:G},!0):!1,Us=(J,M)=>{const G=C.current;if(!G)return!1;const Ee=J-G.startX,De=M-G.startY;if(G.axis==="pending"){if(Math.abs(Ee)<8&&Math.abs(De)<8)return!1;if(G.axis=Math.abs(Ee)>Math.abs(De)?"x":"y",G.axis==="y")return C.current=null,ms(null),!1}if(G.target==="preview"){const $e=Math.max(0,Math.min(Cn,-Ee));return dn($e),!0}const Pe=G.mode==="open"?Math.max(0,Math.min(Et,Ee)):Math.max(0,Math.min(Et,Et+Ee));return ms(Pe),!0},Ms=(J,M)=>{const G=C.current;if(!G)return;const Ee=J-G.startX,De=M-G.startY;if(G.axis==="pending"&&Math.abs(De)>48){C.current=null,ms(null);return}if(G.target==="preview"){const Ye=(G.axis==="x"?te.current??Math.max(0,Math.min(Cn,-Ee)):j?Cn:0)>=Math.min(eD,Cn*zg);T(Ye),Ye&&(N(!1),ms(null)),C.current=null,dn(null);return}const Pe=G.axis==="x"?ge.current??(G.mode==="open"?Math.max(0,Math.min(Et,Ee)):Math.max(0,Math.min(Et,Et+Ee))):w?Et:0,$e=G.mode==="open"?Pe>=Math.min(JA,Et*zg):Pe>=Et*zg;N($e),C.current=null,ms(null)};_.useEffect(()=>{const J=o.current;if(!J||D)return;const M=Pe=>{if(j)return;const $e=Pe.touches[0];Pe.touches.length!==1||!$e||Un(Pe.target)||(xe.current={startX:$e.clientX,startY:$e.clientY})},G=Pe=>{if(Pe.touches.length!==1)return;const $e=Pe.touches[0];if(!C.current){const Ye=xe.current;if(!Ye)return;const en=$e.clientX-Ye.startX,jt=$e.clientY-Ye.startY;if(Math.abs(en)<8&&Math.abs(jt)<8)return;if(Math.abs(en)<=Math.abs(jt)){xe.current=null;return}const $n=w&&en<0,gn=!j&&!w&&en>0,bn=!w&&!j&&en<0&&ut,Tn=$n||gn?ps(Ye.startX,Ye.startY):bn?Ps(Ye.startX,Ye.startY):!1;if(xe.current=null,!Tn)return}Us($e.clientX,$e.clientY)&&Pe.cancelable&&Pe.preventDefault()},Ee=Pe=>{if(xe.current=null,!C.current)return;const $e=Pe.changedTouches[0];if(!$e){C.current=null,ms(null),dn(null);return}Ms($e.clientX,$e.clientY)},De=()=>{xe.current=null,C.current=null,ms(null),dn(null)};return J.addEventListener("touchstart",M,{passive:!0,capture:!0}),J.addEventListener("touchmove",G,{passive:!1,capture:!0}),J.addEventListener("touchend",Ee,{capture:!0}),J.addEventListener("touchcancel",De,{capture:!0}),()=>{J.removeEventListener("touchstart",M,{capture:!0}),J.removeEventListener("touchmove",G,{capture:!0}),J.removeEventListener("touchend",Ee,{capture:!0}),J.removeEventListener("touchcancel",De,{capture:!0})}},[ut,D,j,w]);const xs=()=>i.jsx(i.Fragment,{children:i.jsxs("div",{className:`conversation-main ${D?"has-desktop-sidebar":""}`,style:{transform:`translateX(${na}px)`,transition:Rs?"none":void 0},children:[i.jsx("div",{className:"conversation-topbar",children:D?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(VA,{mode:"node",agentName:Ke?dc(Ke):void 0,agentStatus:(Ke==null?void 0:Ke.status)??null,onOpenNodes:()=>{a({to:"/nodes"})}})})})]})});return i.jsxs("div",{ref:o,className:`conversation-page ${D?"has-desktop-sidebar":""}`,style:Pa,onPointerDown:J=>{D||j||J.pointerType!=="touch"&&(J.pointerType==="mouse"&&J.button!==0||Un(J.target)||(ps(J.clientX,J.clientY,J.pointerId),J.currentTarget.setPointerCapture(J.pointerId)))},onPointerMove:J=>{if(D||J.pointerType==="touch")return;const M=C.current;!M||M.pointerId!==J.pointerId||!Us(J.clientX,J.clientY)||J.preventDefault()},onPointerUp:J=>{if(D||J.pointerType==="touch")return;const M=C.current;!M||M.pointerId!==J.pointerId||Ms(J.clientX,J.clientY)},onPointerCancel:J=>{if(D||J.pointerType==="touch")return;const M=C.current;!M||M.pointerId!==J.pointerId||(C.current=null,ms(null),dn(null))},children:[i.jsx(fx,{open:hs,progress:Ja,isDragging:Rs,desktopPinned:D,isDesktopResizing:P,onClose:()=>{D||(N(!1),ms(null))},onDesktopResizeStart:J=>{he.current=ie.current,q.current={startX:J,startWidth:ie.current},Q(!0)},currentAgent:Ke??void 0,agentIndicatorState:Nt,projects:Bt,sessions:Jt,projectStats:Dt,historySessionsByProject:Object.fromEntries(Object.entries(ot).map(([J,M])=>[J,M.sessions])),archivedSessionsByProject:Object.fromEntries(Object.entries(ln).map(([J,M])=>[J,M.sessions])),historyPageStateByProject:ot,archivedPageStateByProject:ln,activeSessionId:Ze==null?void 0:Ze.id,onCreateSession:J=>{Ft(J)},onCreateDirectoryThread:()=>{It()},onSelectSession:J=>{Le(J)},onSessionAction:He,onThreadAction:ze,onOpenSettings:e,onLoadMoreHistory:J=>{on(J)},onLoadMoreArchived:J=>{kn(J)},pendingSessionActionId:oe.isPending?((As=oe.variables)==null?void 0:As.sessionId)??null:null,pendingThreadActionId:ue.isPending?((Rt=ue.variables)==null?void 0:Rt.projectId)??null:null}),i.jsxs("div",{className:`conversation-workspace-stack ${j||Na?"is-preview-open":""} ${Na?"is-dragging":""}`,children:[i.jsx("div",{className:"conversation-workspace-stack__page is-primary",children:B?i.jsx(YA,{sessionId:B,workspaceDirectorySnapshot:it??null,workspaceAgentIndicatorState:Nt,embedded:!0,isDesktopSidebar:D,sidebarOffset:na,isSidebarDragging:Rs,onOpenSidebar:()=>{T(!1),N(!0)},onSelectSession:J=>{J&&Le(J)},onExitToNodes:()=>{Kr(null),Js(null),y(null),a({to:"/nodes"})}}):Ke?Ze?null:i.jsx(DR,{currentAgent:Ke,projects:Bt,sessions:Jt,initialProjectId:g,entryView:p,isDesktopSidebar:D,sidebarOffset:na,isSidebarDragging:Rs,onOpenSidebar:()=>{T(!1),N(!0)},onProjectSelected:J=>{S(J),b("composer"),Cf(!1)},onSessionCreated:J=>{Le(J)}}):xs()}),i.jsx("div",{className:"conversation-workspace-stack__page is-preview",children:i.jsx("div",{className:"session-file-preview-pane",children:Ze&&un&&(j||ee!==null)?i.jsx(_.Suspense,{fallback:i.jsx("div",{className:"session-file-preview-pane__fallback",children:"正在载入预览页…"}),children:i.jsx(nD,{agentId:(Ke==null?void 0:Ke.id)??Oe,sessionId:Ze.id,projectName:un.display_name||un.name,projectPath:un.path,isActive:j,onBack:()=>{T(!1),dn(null)}},Ze.id)}):null})})]})]})},lD=24,oD=32,cD=72,g2="panda:native-safe-area-change",q_=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)},Bg=e=>`${Math.round(q_(e)*100)/100}px`,uD=e=>`${Math.round(e*100)/100}px`,dD=e=>{const t=q_(e);if(!Tp())return`${Math.round(t*100)/100}px`;const a=Math.min(oD,Math.max(lD,t+1));return`${Math.round(a*100)/100}px`},fD=()=>{if(typeof window>"u")return 0;const e=window.visualViewport;if(!e)return 0;const t=window.innerHeight-(e.height+e.offsetTop);return Number.isFinite(t)?Math.max(0,t):0},hD=e=>{var o;if(!qs())return"0px";const t=fD(),a=q_((o=e==null?void 0:e.getKeyboardInsetPx)==null?void 0:o.call(e)),l=t>0?t:a;return l<cD?"0px":uD(l)},mD=()=>{var a,l,o,u;if(typeof document>"u"||typeof window>"u")return;const e=window.PandaSafeArea,t=document.documentElement.style;e&&(t.setProperty("--native-safe-area-top",dD((a=e.getTopInsetPx)==null?void 0:a.call(e))),t.setProperty("--native-safe-area-right",Bg((l=e.getRightInsetPx)==null?void 0:l.call(e))),t.setProperty("--native-safe-area-bottom",Bg((o=e.getBottomInsetPx)==null?void 0:o.call(e))),t.setProperty("--native-safe-area-left",Bg((u=e.getLeftInsetPx)==null?void 0:u.call(e)))),t.setProperty("--native-keyboard-inset-bottom",hD(e))},pD=()=>{var u,f;if(typeof window>"u"||typeof document>"u")return()=>{};const e=()=>{mD()},t=new Set,a=m=>{const y=window.setTimeout(()=>{t.delete(y),e()},m);t.add(y)},l=()=>{e(),a(120),a(280)};let o=null;return e(),a(0),a(250),a(800),window.addEventListener("load",e,{once:!0}),window.addEventListener("resize",e),window.addEventListener("orientationchange",e),window.addEventListener(g2,e),document.addEventListener("visibilitychange",e),document.addEventListener("focusin",l,!0),document.addEventListener("focusout",l,!0),(u=window.visualViewport)==null||u.addEventListener("resize",e),(f=window.visualViewport)==null||f.addEventListener("scroll",e),M3.addListener("resume",e).then(m=>{o=()=>{m.remove()}}).catch(()=>{}),()=>{var m,y;window.removeEventListener("resize",e),window.removeEventListener("orientationchange",e),window.removeEventListener(g2,e),document.removeEventListener("visibilitychange",e),document.removeEventListener("focusin",l,!0),document.removeEventListener("focusout",l,!0),(m=window.visualViewport)==null||m.removeEventListener("resize",e),(y=window.visualViewport)==null||y.removeEventListener("scroll",e);for(const g of t)window.clearTimeout(g);t.clear(),o==null||o()}},Hg=new $9,gD=async()=>{},_D=_.lazy(async()=>({default:(await Zr(()=>import("./diagnostics-page-cP5VtBfz.js"),__vite__mapDeps([3,4]))).DiagnosticsPage})),yD=()=>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(_D,{})}),gc=F7({component:JC}),vD=hc({getParentRoute:()=>gc,path:"/",component:$x}),bD=hc({getParentRoute:()=>gc,path:"/nodes",component:_T}),xD=hc({getParentRoute:()=>gc,path:"/session/$sessionId",component:bT}),SD=hc({getParentRoute:()=>gc,path:"/new-thread/$agentId",component:$x}),jD=hc({getParentRoute:()=>gc,path:"/settings",component:ix}),wD=hc({getParentRoute:()=>gc,path:"/diagnostics",component:yD}),ND=gc.addChildren([vD,bD,xD,SD,jD,wD]),kD=Z7({routeTree:ND,defaultPreload:"intent"});typeof document<"u"&&(tx(ex()),pD());gD().catch(()=>{}).then(async()=>{await Ek(),await iE(Hg),lE(Hg)}).finally(()=>{c9.createRoot(document.getElementById("root")).render(i.jsx(F9,{client:Hg,children:i.jsx(ej,{router:kD})}))});export{p4 as B,gg as C,Fu as E,c0 as L,O9 as Q,sd as S,o6 as W,Zr as _,M2 as a,La as b,q9 as c,Q9 as d,Z9 as e,G9 as f,Y9 as g,vs as h,J9 as i,i as j,zv as k,V9 as l,mh as m,bs as n,wn as o,ls as p,TD as q,_ as r,Qm as s,e9 as t,ki as u};
|