@jamiexiongr/panda-hub 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/chunk-HEZ5JMF3.mjs +55 -0
- package/dist/chunk-NPUEJ7HU.mjs +15520 -0
- package/dist/cli.mjs +7 -0
- package/dist/index.mjs +7 -0
- package/dist/src-DT2GYCA4.mjs +68 -0
- package/dist/web/apple-touch-icon.png +0 -0
- package/dist/web/assets/diagnostics-page-BmzeM8p1.css +1 -0
- package/dist/web/assets/diagnostics-page-DnSAjsY5.js +1 -0
- package/dist/web/assets/index-C_piwCwO.js +124 -0
- package/dist/web/assets/index-DfUcIUg_.css +1 -0
- package/dist/web/assets/session-diff-preview-DLGNrbUv.js +3 -0
- package/dist/web/icon.svg +6 -0
- package/dist/web/index.html +23 -0
- package/dist/web/logo.png +0 -0
- package/dist/web/manifest.webmanifest +1 -0
- package/dist/web/maskable-512.png +0 -0
- package/dist/web/panda-ink-logo.svg +70 -0
- package/dist/web/pwa-192.png +0 -0
- package/dist/web/pwa-512.png +0 -0
- package/dist/web/registerSW.js +1 -0
- package/dist/web/small-icon.svg +4 -0
- package/dist/web/sw.js +1 -0
- package/dist/web/workbox-01f28f5c.js +1 -0
- package/package.json +28 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diagnostics-page-DnSAjsY5.js","assets/diagnostics-page-BmzeM8p1.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
var ob=s=>{throw TypeError(s)};var ip=(s,t,a)=>t.has(s)||ob("Cannot "+a);var L=(s,t,a)=>(ip(s,t,"read from private field"),a?a.call(s):t.get(s)),Je=(s,t,a)=>t.has(s)?ob("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,a),ze=(s,t,a,r)=>(ip(s,t,"write to private field"),r?r.call(s,a):t.set(s,a),a),bt=(s,t,a)=>(ip(s,t,"access private method"),a);var uf=(s,t,a,r)=>({set _(c){ze(s,t,c,a)},get _(){return L(s,t,r)}});(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))r(c);new MutationObserver(c=>{for(const u of c)if(u.type==="childList")for(const h of u.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&r(h)}).observe(document,{childList:!0,subtree:!0});function a(c){const u={};return c.integrity&&(u.integrity=c.integrity),c.referrerPolicy&&(u.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?u.credentials="include":c.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function r(c){if(c.ep)return;c.ep=!0;const u=a(c);fetch(c.href,u)}})();const Jj="modulepreload",ew=function(s){return"/"+s},cb={},Tg=function(t,a,r){let c=Promise.resolve();if(a&&a.length>0){let h=function(m){return Promise.all(m.map(x=>Promise.resolve(x).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const p=document.querySelector("meta[property=csp-nonce]"),y=(p==null?void 0:p.nonce)||(p==null?void 0:p.getAttribute("nonce"));c=h(a.map(m=>{if(m=ew(m),m in cb)return;cb[m]=!0;const x=m.endsWith(".css"),g=x?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${g}`))return;const S=document.createElement("link");if(S.rel=x?"stylesheet":Jj,x||(S.as="script"),S.crossOrigin="",S.href=m,y&&S.setAttribute("nonce",y),document.head.appendChild(S),x)return new Promise((k,N)=>{S.addEventListener("load",k),S.addEventListener("error",()=>N(new Error(`Unable to preload CSS for ${m}`)))})}))}function u(h){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=h,window.dispatchEvent(p),!p.defaultPrevented)throw h}return c.then(h=>{for(const p of h||[])p.status==="rejected"&&u(p.reason);return t().catch(u)})};function tw(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var rp={exports:{}},Xc={};/**
|
|
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 ub;function nw(){if(ub)return Xc;ub=1;var s=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function a(r,c,u){var h=null;if(u!==void 0&&(h=""+u),c.key!==void 0&&(h=""+c.key),"key"in c){u={};for(var p in c)p!=="key"&&(u[p]=c[p])}else u=c;return c=u.ref,{$$typeof:s,type:r,key:h,ref:c!==void 0?c:null,props:u}}return Xc.Fragment=t,Xc.jsx=a,Xc.jsxs=a,Xc}var db;function sw(){return db||(db=1,rp.exports=nw()),rp.exports}var l=sw(),lp={exports:{}},ht={};/**
|
|
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 fb;function aw(){if(fb)return ht;fb=1;var s=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),h=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),S=Symbol.iterator;function k(A){return A===null||typeof A!="object"?null:(A=S&&A[S]||A["@@iterator"],typeof A=="function"?A:null)}var N={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},T=Object.assign,C={};function I(A,ne,be){this.props=A,this.context=ne,this.refs=C,this.updater=be||N}I.prototype.isReactComponent={},I.prototype.setState=function(A,ne){if(typeof A!="object"&&typeof A!="function"&&A!=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,A,ne,"setState")},I.prototype.forceUpdate=function(A){this.updater.enqueueForceUpdate(this,A,"forceUpdate")};function V(){}V.prototype=I.prototype;function $(A,ne,be){this.props=A,this.context=ne,this.refs=C,this.updater=be||N}var R=$.prototype=new V;R.constructor=$,T(R,I.prototype),R.isPureReactComponent=!0;var G=Array.isArray;function ue(){}var Z={H:null,A:null,T:null,S:null},ie=Object.prototype.hasOwnProperty;function te(A,ne,be){var Q=be.ref;return{$$typeof:s,type:A,key:ne,ref:Q!==void 0?Q:null,props:be}}function Y(A,ne){return te(A.type,ne,A.props)}function H(A){return typeof A=="object"&&A!==null&&A.$$typeof===s}function _e(A){var ne={"=":"=0",":":"=2"};return"$"+A.replace(/[=:]/g,function(be){return ne[be]})}var je=/\/+/g;function ae(A,ne){return typeof A=="object"&&A!==null&&A.key!=null?_e(""+A.key):ne.toString(36)}function ce(A){switch(A.status){case"fulfilled":return A.value;case"rejected":throw A.reason;default:switch(typeof A.status=="string"?A.then(ue,ue):(A.status="pending",A.then(function(ne){A.status==="pending"&&(A.status="fulfilled",A.value=ne)},function(ne){A.status==="pending"&&(A.status="rejected",A.reason=ne)})),A.status){case"fulfilled":return A.value;case"rejected":throw A.reason}}throw A}function E(A,ne,be,Q,pe){var Ce=typeof A;(Ce==="undefined"||Ce==="boolean")&&(A=null);var Le=!1;if(A===null)Le=!0;else switch(Ce){case"bigint":case"string":case"number":Le=!0;break;case"object":switch(A.$$typeof){case s:case t:Le=!0;break;case x:return Le=A._init,E(Le(A._payload),ne,be,Q,pe)}}if(Le)return pe=pe(A),Le=Q===""?"."+ae(A,0):Q,G(pe)?(be="",Le!=null&&(be=Le.replace(je,"$&/")+"/"),E(pe,ne,be,"",function(Se){return Se})):pe!=null&&(H(pe)&&(pe=Y(pe,be+(pe.key==null||A&&A.key===pe.key?"":(""+pe.key).replace(je,"$&/")+"/")+Le)),ne.push(pe)),1;Le=0;var he=Q===""?".":Q+":";if(G(A))for(var q=0;q<A.length;q++)Q=A[q],Ce=he+ae(Q,q),Le+=E(Q,ne,be,Ce,pe);else if(q=k(A),typeof q=="function")for(A=q.call(A),q=0;!(Q=A.next()).done;)Q=Q.value,Ce=he+ae(Q,q++),Le+=E(Q,ne,be,Ce,pe);else if(Ce==="object"){if(typeof A.then=="function")return E(ce(A),ne,be,Q,pe);throw ne=String(A),Error("Objects are not valid as a React child (found: "+(ne==="[object Object]"?"object with keys {"+Object.keys(A).join(", ")+"}":ne)+"). If you meant to render a collection of children, use an array instead.")}return Le}function U(A,ne,be){if(A==null)return A;var Q=[],pe=0;return E(A,Q,"","",function(Ce){return ne.call(be,Ce,pe++)}),Q}function ee(A){if(A._status===-1){var ne=A._result;ne=ne(),ne.then(function(be){(A._status===0||A._status===-1)&&(A._status=1,A._result=be)},function(be){(A._status===0||A._status===-1)&&(A._status=2,A._result=be)}),A._status===-1&&(A._status=0,A._result=ne)}if(A._status===1)return A._result.default;throw A._result}var W=typeof reportError=="function"?reportError:function(A){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var ne=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof A=="object"&&A!==null&&typeof A.message=="string"?String(A.message):String(A),error:A});if(!window.dispatchEvent(ne))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",A);return}console.error(A)},xe={map:U,forEach:function(A,ne,be){U(A,function(){ne.apply(this,arguments)},be)},count:function(A){var ne=0;return U(A,function(){ne++}),ne},toArray:function(A){return U(A,function(ne){return ne})||[]},only:function(A){if(!H(A))throw Error("React.Children.only expected to receive a single React element child.");return A}};return ht.Activity=g,ht.Children=xe,ht.Component=I,ht.Fragment=a,ht.Profiler=c,ht.PureComponent=$,ht.StrictMode=r,ht.Suspense=y,ht.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Z,ht.__COMPILER_RUNTIME={__proto__:null,c:function(A){return Z.H.useMemoCache(A)}},ht.cache=function(A){return function(){return A.apply(null,arguments)}},ht.cacheSignal=function(){return null},ht.cloneElement=function(A,ne,be){if(A==null)throw Error("The argument must be a React element, but you passed "+A+".");var Q=T({},A.props),pe=A.key;if(ne!=null)for(Ce in ne.key!==void 0&&(pe=""+ne.key),ne)!ie.call(ne,Ce)||Ce==="key"||Ce==="__self"||Ce==="__source"||Ce==="ref"&&ne.ref===void 0||(Q[Ce]=ne[Ce]);var Ce=arguments.length-2;if(Ce===1)Q.children=be;else if(1<Ce){for(var Le=Array(Ce),he=0;he<Ce;he++)Le[he]=arguments[he+2];Q.children=Le}return te(A.type,pe,Q)},ht.createContext=function(A){return A={$$typeof:h,_currentValue:A,_currentValue2:A,_threadCount:0,Provider:null,Consumer:null},A.Provider=A,A.Consumer={$$typeof:u,_context:A},A},ht.createElement=function(A,ne,be){var Q,pe={},Ce=null;if(ne!=null)for(Q in ne.key!==void 0&&(Ce=""+ne.key),ne)ie.call(ne,Q)&&Q!=="key"&&Q!=="__self"&&Q!=="__source"&&(pe[Q]=ne[Q]);var Le=arguments.length-2;if(Le===1)pe.children=be;else if(1<Le){for(var he=Array(Le),q=0;q<Le;q++)he[q]=arguments[q+2];pe.children=he}if(A&&A.defaultProps)for(Q in Le=A.defaultProps,Le)pe[Q]===void 0&&(pe[Q]=Le[Q]);return te(A,Ce,pe)},ht.createRef=function(){return{current:null}},ht.forwardRef=function(A){return{$$typeof:p,render:A}},ht.isValidElement=H,ht.lazy=function(A){return{$$typeof:x,_payload:{_status:-1,_result:A},_init:ee}},ht.memo=function(A,ne){return{$$typeof:m,type:A,compare:ne===void 0?null:ne}},ht.startTransition=function(A){var ne=Z.T,be={};Z.T=be;try{var Q=A(),pe=Z.S;pe!==null&&pe(be,Q),typeof Q=="object"&&Q!==null&&typeof Q.then=="function"&&Q.then(ue,W)}catch(Ce){W(Ce)}finally{ne!==null&&be.types!==null&&(ne.types=be.types),Z.T=ne}},ht.unstable_useCacheRefresh=function(){return Z.H.useCacheRefresh()},ht.use=function(A){return Z.H.use(A)},ht.useActionState=function(A,ne,be){return Z.H.useActionState(A,ne,be)},ht.useCallback=function(A,ne){return Z.H.useCallback(A,ne)},ht.useContext=function(A){return Z.H.useContext(A)},ht.useDebugValue=function(){},ht.useDeferredValue=function(A,ne){return Z.H.useDeferredValue(A,ne)},ht.useEffect=function(A,ne){return Z.H.useEffect(A,ne)},ht.useEffectEvent=function(A){return Z.H.useEffectEvent(A)},ht.useId=function(){return Z.H.useId()},ht.useImperativeHandle=function(A,ne,be){return Z.H.useImperativeHandle(A,ne,be)},ht.useInsertionEffect=function(A,ne){return Z.H.useInsertionEffect(A,ne)},ht.useLayoutEffect=function(A,ne){return Z.H.useLayoutEffect(A,ne)},ht.useMemo=function(A,ne){return Z.H.useMemo(A,ne)},ht.useOptimistic=function(A,ne){return Z.H.useOptimistic(A,ne)},ht.useReducer=function(A,ne,be){return Z.H.useReducer(A,ne,be)},ht.useRef=function(A){return Z.H.useRef(A)},ht.useState=function(A){return Z.H.useState(A)},ht.useSyncExternalStore=function(A,ne,be){return Z.H.useSyncExternalStore(A,ne,be)},ht.useTransition=function(){return Z.H.useTransition()},ht.version="19.2.4",ht}var hb;function Bu(){return hb||(hb=1,lp.exports=aw()),lp.exports}var _=Bu();const Si=tw(_);var op={exports:{}},Jc={},cp={exports:{}},up={};/**
|
|
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 mb;function iw(){return mb||(mb=1,(function(s){function t(E,U){var ee=E.length;E.push(U);e:for(;0<ee;){var W=ee-1>>>1,xe=E[W];if(0<c(xe,U))E[W]=U,E[ee]=xe,ee=W;else break e}}function a(E){return E.length===0?null:E[0]}function r(E){if(E.length===0)return null;var U=E[0],ee=E.pop();if(ee!==U){E[0]=ee;e:for(var W=0,xe=E.length,A=xe>>>1;W<A;){var ne=2*(W+1)-1,be=E[ne],Q=ne+1,pe=E[Q];if(0>c(be,ee))Q<xe&&0>c(pe,be)?(E[W]=pe,E[Q]=ee,W=Q):(E[W]=be,E[ne]=ee,W=ne);else if(Q<xe&&0>c(pe,ee))E[W]=pe,E[Q]=ee,W=Q;else break e}}return U}function c(E,U){var ee=E.sortIndex-U.sortIndex;return ee!==0?ee:E.id-U.id}if(s.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;s.unstable_now=function(){return u.now()}}else{var h=Date,p=h.now();s.unstable_now=function(){return h.now()-p}}var y=[],m=[],x=1,g=null,S=3,k=!1,N=!1,T=!1,C=!1,I=typeof setTimeout=="function"?setTimeout:null,V=typeof clearTimeout=="function"?clearTimeout:null,$=typeof setImmediate<"u"?setImmediate:null;function R(E){for(var U=a(m);U!==null;){if(U.callback===null)r(m);else if(U.startTime<=E)r(m),U.sortIndex=U.expirationTime,t(y,U);else break;U=a(m)}}function G(E){if(T=!1,R(E),!N)if(a(y)!==null)N=!0,ue||(ue=!0,_e());else{var U=a(m);U!==null&&ce(G,U.startTime-E)}}var ue=!1,Z=-1,ie=5,te=-1;function Y(){return C?!0:!(s.unstable_now()-te<ie)}function H(){if(C=!1,ue){var E=s.unstable_now();te=E;var U=!0;try{e:{N=!1,T&&(T=!1,V(Z),Z=-1),k=!0;var ee=S;try{t:{for(R(E),g=a(y);g!==null&&!(g.expirationTime>E&&Y());){var W=g.callback;if(typeof W=="function"){g.callback=null,S=g.priorityLevel;var xe=W(g.expirationTime<=E);if(E=s.unstable_now(),typeof xe=="function"){g.callback=xe,R(E),U=!0;break t}g===a(y)&&r(y),R(E)}else r(y);g=a(y)}if(g!==null)U=!0;else{var A=a(m);A!==null&&ce(G,A.startTime-E),U=!1}}break e}finally{g=null,S=ee,k=!1}U=void 0}}finally{U?_e():ue=!1}}}var _e;if(typeof $=="function")_e=function(){$(H)};else if(typeof MessageChannel<"u"){var je=new MessageChannel,ae=je.port2;je.port1.onmessage=H,_e=function(){ae.postMessage(null)}}else _e=function(){I(H,0)};function ce(E,U){Z=I(function(){E(s.unstable_now())},U)}s.unstable_IdlePriority=5,s.unstable_ImmediatePriority=1,s.unstable_LowPriority=4,s.unstable_NormalPriority=3,s.unstable_Profiling=null,s.unstable_UserBlockingPriority=2,s.unstable_cancelCallback=function(E){E.callback=null},s.unstable_forceFrameRate=function(E){0>E||125<E?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):ie=0<E?Math.floor(1e3/E):5},s.unstable_getCurrentPriorityLevel=function(){return S},s.unstable_next=function(E){switch(S){case 1:case 2:case 3:var U=3;break;default:U=S}var ee=S;S=U;try{return E()}finally{S=ee}},s.unstable_requestPaint=function(){C=!0},s.unstable_runWithPriority=function(E,U){switch(E){case 1:case 2:case 3:case 4:case 5:break;default:E=3}var ee=S;S=E;try{return U()}finally{S=ee}},s.unstable_scheduleCallback=function(E,U,ee){var W=s.unstable_now();switch(typeof ee=="object"&&ee!==null?(ee=ee.delay,ee=typeof ee=="number"&&0<ee?W+ee:W):ee=W,E){case 1:var xe=-1;break;case 2:xe=250;break;case 5:xe=1073741823;break;case 4:xe=1e4;break;default:xe=5e3}return xe=ee+xe,E={id:x++,callback:U,priorityLevel:E,startTime:ee,expirationTime:xe,sortIndex:-1},ee>W?(E.sortIndex=ee,t(m,E),a(y)===null&&E===a(m)&&(T?(V(Z),Z=-1):T=!0,ce(G,ee-W))):(E.sortIndex=xe,t(y,E),N||k||(N=!0,ue||(ue=!0,_e()))),E},s.unstable_shouldYield=Y,s.unstable_wrapCallback=function(E){var U=S;return function(){var ee=S;S=U;try{return E.apply(this,arguments)}finally{S=ee}}}})(up)),up}var pb;function rw(){return pb||(pb=1,cp.exports=iw()),cp.exports}var dp={exports:{}},ns={};/**
|
|
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 gb;function lw(){if(gb)return ns;gb=1;var s=Bu();function t(y){var m="https://react.dev/errors/"+y;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var x=2;x<arguments.length;x++)m+="&args[]="+encodeURIComponent(arguments[x])}return"Minified React error #"+y+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(){}var r={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},c=Symbol.for("react.portal");function u(y,m,x){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:g==null?null:""+g,children:y,containerInfo:m,implementation:x}}var h=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function p(y,m){if(y==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return ns.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,ns.createPortal=function(y,m){var x=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(t(299));return u(y,m,null,x)},ns.flushSync=function(y){var m=h.T,x=r.p;try{if(h.T=null,r.p=2,y)return y()}finally{h.T=m,r.p=x,r.d.f()}},ns.preconnect=function(y,m){typeof y=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,r.d.C(y,m))},ns.prefetchDNS=function(y){typeof y=="string"&&r.d.D(y)},ns.preinit=function(y,m){if(typeof y=="string"&&m&&typeof m.as=="string"){var x=m.as,g=p(x,m.crossOrigin),S=typeof m.integrity=="string"?m.integrity:void 0,k=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;x==="style"?r.d.S(y,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:g,integrity:S,fetchPriority:k}):x==="script"&&r.d.X(y,{crossOrigin:g,integrity:S,fetchPriority:k,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},ns.preinitModule=function(y,m){if(typeof y=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var x=p(m.as,m.crossOrigin);r.d.M(y,{crossOrigin:x,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&r.d.M(y)},ns.preload=function(y,m){if(typeof y=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var x=m.as,g=p(x,m.crossOrigin);r.d.L(y,x,{crossOrigin:g,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},ns.preloadModule=function(y,m){if(typeof y=="string")if(m){var x=p(m.as,m.crossOrigin);r.d.m(y,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:x,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else r.d.m(y)},ns.requestFormReset=function(y){r.d.r(y)},ns.unstable_batchedUpdates=function(y,m){return y(m)},ns.useFormState=function(y,m,x){return h.H.useFormState(y,m,x)},ns.useFormStatus=function(){return h.H.useHostTransitionStatus()},ns.version="19.2.4",ns}var yb;function U0(){if(yb)return dp.exports;yb=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(t){console.error(t)}}return s(),dp.exports=lw(),dp.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 vb;function ow(){if(vb)return Jc;vb=1;var s=rw(),t=Bu(),a=U0();function r(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)n+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function u(e){var n=e,i=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(i=n.return),e=n.return;while(e)}return n.tag===3?i:null}function h(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function p(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function y(e){if(u(e)!==e)throw Error(r(188))}function m(e){var n=e.alternate;if(!n){if(n=u(e),n===null)throw Error(r(188));return n!==e?null:e}for(var i=e,o=n;;){var d=i.return;if(d===null)break;var f=d.alternate;if(f===null){if(o=d.return,o!==null){i=o;continue}break}if(d.child===f.child){for(f=d.child;f;){if(f===i)return y(d),e;if(f===o)return y(d),n;f=f.sibling}throw Error(r(188))}if(i.return!==o.return)i=d,o=f;else{for(var v=!1,w=d.child;w;){if(w===i){v=!0,i=d,o=f;break}if(w===o){v=!0,o=d,i=f;break}w=w.sibling}if(!v){for(w=f.child;w;){if(w===i){v=!0,i=f,o=d;break}if(w===o){v=!0,o=f,i=d;break}w=w.sibling}if(!v)throw Error(r(189))}}if(i.alternate!==o)throw Error(r(190))}if(i.tag!==3)throw Error(r(188));return i.stateNode.current===i?e:n}function x(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=x(e),n!==null)return n;e=e.sibling}return null}var g=Object.assign,S=Symbol.for("react.element"),k=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),I=Symbol.for("react.profiler"),V=Symbol.for("react.consumer"),$=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),G=Symbol.for("react.suspense"),ue=Symbol.for("react.suspense_list"),Z=Symbol.for("react.memo"),ie=Symbol.for("react.lazy"),te=Symbol.for("react.activity"),Y=Symbol.for("react.memo_cache_sentinel"),H=Symbol.iterator;function _e(e){return e===null||typeof e!="object"?null:(e=H&&e[H]||e["@@iterator"],typeof e=="function"?e:null)}var je=Symbol.for("react.client.reference");function ae(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===je?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case T:return"Fragment";case I:return"Profiler";case C:return"StrictMode";case G:return"Suspense";case ue:return"SuspenseList";case te:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case N:return"Portal";case $:return e.displayName||"Context";case V:return(e._context.displayName||"Context")+".Consumer";case R:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Z:return n=e.displayName||null,n!==null?n:ae(e.type)||"Memo";case ie:n=e._payload,e=e._init;try{return ae(e(n))}catch{}}return null}var ce=Array.isArray,E=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee={pending:!1,data:null,method:null,action:null},W=[],xe=-1;function A(e){return{current:e}}function ne(e){0>xe||(e.current=W[xe],W[xe]=null,xe--)}function be(e,n){xe++,W[xe]=e.current,e.current=n}var Q=A(null),pe=A(null),Ce=A(null),Le=A(null);function he(e,n){switch(be(Ce,n),be(pe,e),be(Q,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?R_(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=R_(n),e=A_(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}ne(Q),be(Q,e)}function q(){ne(Q),ne(pe),ne(Ce)}function Se(e){e.memoizedState!==null&&be(Le,e);var n=Q.current,i=A_(n,e.type);n!==i&&(be(pe,e),be(Q,i))}function Ne(e){pe.current===e&&(ne(Q),ne(pe)),Le.current===e&&(ne(Le),Kc._currentValue=ee)}var me,Te;function Ge(e){if(me===void 0)try{throw Error()}catch(i){var n=i.stack.trim().match(/\n( *(at )?)/);me=n&&n[1]||"",Te=-1<i.stack.indexOf(`
|
|
43
|
+
at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
44
|
+
`+me+e+Te}var Ue=!1;function gt(e,n){if(!e||Ue)return"";Ue=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(n){var ve=function(){throw Error()};if(Object.defineProperty(ve.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ve,[])}catch(re){var se=re}Reflect.construct(e,[],ve)}else{try{ve.call()}catch(re){se=re}e.call(ve.prototype)}}else{try{throw Error()}catch(re){se=re}(ve=e())&&typeof ve.catch=="function"&&ve.catch(function(){})}}catch(re){if(re&&se&&typeof re.stack=="string")return[re.stack,se.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var d=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");d&&d.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var f=o.DetermineComponentFrameRoot(),v=f[0],w=f[1];if(v&&w){var O=v.split(`
|
|
45
|
+
`),J=w.split(`
|
|
46
|
+
`);for(d=o=0;o<O.length&&!O[o].includes("DetermineComponentFrameRoot");)o++;for(;d<J.length&&!J[d].includes("DetermineComponentFrameRoot");)d++;if(o===O.length||d===J.length)for(o=O.length-1,d=J.length-1;1<=o&&0<=d&&O[o]!==J[d];)d--;for(;1<=o&&0<=d;o--,d--)if(O[o]!==J[d]){if(o!==1||d!==1)do if(o--,d--,0>d||O[o]!==J[d]){var fe=`
|
|
47
|
+
`+O[o].replace(" at new "," at ");return e.displayName&&fe.includes("<anonymous>")&&(fe=fe.replace("<anonymous>",e.displayName)),fe}while(1<=o&&0<=d);break}}}finally{Ue=!1,Error.prepareStackTrace=i}return(i=e?e.displayName||e.name:"")?Ge(i):""}function Lt(e,n){switch(e.tag){case 26:case 27:case 5:return Ge(e.type);case 16:return Ge("Lazy");case 13:return e.child!==n&&n!==null?Ge("Suspense Fallback"):Ge("Suspense");case 19:return Ge("SuspenseList");case 0:case 15:return gt(e.type,!1);case 11:return gt(e.type.render,!1);case 1:return gt(e.type,!0);case 31:return Ge("Activity");default:return""}}function St(e){try{var n="",i=null;do n+=Lt(e,i),i=e,e=e.return;while(e);return n}catch(o){return`
|
|
48
|
+
Error generating stack: `+o.message+`
|
|
49
|
+
`+o.stack}}var st=Object.prototype.hasOwnProperty,tn=s.unstable_scheduleCallback,$t=s.unstable_cancelCallback,de=s.unstable_shouldYield,Ae=s.unstable_requestPaint,Re=s.unstable_now,Oe=s.unstable_getCurrentPriorityLevel,Ke=s.unstable_ImmediatePriority,mt=s.unstable_UserBlockingPriority,kt=s.unstable_NormalPriority,rn=s.unstable_LowPriority,Bn=s.unstable_IdlePriority,On=s.log,nn=s.unstable_setDisableYieldValue,ln=null,oe=null;function qe(e){if(typeof On=="function"&&nn(e),oe&&typeof oe.setStrictMode=="function")try{oe.setStrictMode(ln,e)}catch{}}var De=Math.clz32?Math.clz32:$e,Ie=Math.log,We=Math.LN2;function $e(e){return e>>>=0,e===0?32:31-(Ie(e)/We|0)|0}var He=256,Ee=262144,Ut=4194304;function at(e){var n=e&42;if(n!==0)return n;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64: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 e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function pn(e,n,i){var o=e.pendingLanes;if(o===0)return 0;var d=0,f=e.suspendedLanes,v=e.pingedLanes;e=e.warmLanes;var w=o&134217727;return w!==0?(o=w&~f,o!==0?d=at(o):(v&=w,v!==0?d=at(v):i||(i=w&~e,i!==0&&(d=at(i))))):(w=o&~f,w!==0?d=at(w):v!==0?d=at(v):i||(i=o&~e,i!==0&&(d=at(i)))),d===0?0:n!==0&&n!==d&&(n&f)===0&&(f=d&-d,i=n&-n,f>=i||f===32&&(i&4194048)!==0)?n:d}function Pn(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function xn(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+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 n+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 ps(){var e=Ut;return Ut<<=1,(Ut&62914560)===0&&(Ut=4194304),e}function gs(e){for(var n=[],i=0;31>i;i++)n.push(e);return n}function as(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ci(e,n,i,o,d,f){var v=e.pendingLanes;e.pendingLanes=i,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=i,e.entangledLanes&=i,e.errorRecoveryDisabledLanes&=i,e.shellSuspendCounter=0;var w=e.entanglements,O=e.expirationTimes,J=e.hiddenUpdates;for(i=v&~i;0<i;){var fe=31-De(i),ve=1<<fe;w[fe]=0,O[fe]=-1;var se=J[fe];if(se!==null)for(J[fe]=null,fe=0;fe<se.length;fe++){var re=se[fe];re!==null&&(re.lane&=-536870913)}i&=~ve}o!==0&&la(e,o,0),f!==0&&d===0&&e.tag!==0&&(e.suspendedLanes|=f&~(v&~n))}function la(e,n,i){e.pendingLanes|=n,e.suspendedLanes&=~n;var o=31-De(n);e.entangledLanes|=n,e.entanglements[o]=e.entanglements[o]|1073741824|i&261930}function Gs(e,n){var i=e.entangledLanes|=n;for(e=e.entanglements;i;){var o=31-De(i),d=1<<o;d&n|e[o]&n&&(e[o]|=n),i&=~d}}function is(e,n){var i=n&-n;return i=(i&42)!==0?1:xa(i),(i&(e.suspendedLanes|n))!==0?0:i}function xa(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Vs(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function rs(){var e=U.p;return e!==0?e:(e=window.event,e===void 0?32:tb(e.type))}function j(e,n){var i=U.p;try{return U.p=e,n()}finally{U.p=i}}var z=Math.random().toString(36).slice(2),ge="__reactFiber$"+z,we="__reactProps$"+z,ke="__reactContainer$"+z,Ve="__reactEvents$"+z,ct="__reactListeners$"+z,Nt="__reactHandles$"+z,Un="__reactResources$"+z,Jn="__reactMarker$"+z;function Ht(e){delete e[ge],delete e[we],delete e[Ve],delete e[ct],delete e[Nt]}function wn(e){var n=e[ge];if(n)return n;for(var i=e.parentNode;i;){if(n=i[ke]||i[ge]){if(i=n.alternate,n.child!==null||i!==null&&i.child!==null)for(e=P_(e);e!==null;){if(i=e[ge])return i;e=P_(e)}return n}e=i,i=e.parentNode}return null}function kn(e){if(e=e[ge]||e[ke]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function Ln(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(r(33))}function un(e){var n=e[Un];return n||(n=e[Un]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function B(e){e[Jn]=!0}var on=new Set,gn={};function yn(e,n){sn(e,n),sn(e+"Capture",n)}function sn(e,n){for(gn[e]=n,e=0;e<n.length;e++)on.add(n[e])}var Ft=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]*$"),Fa={},Rr={};function Fu(e){return st.call(Rr,e)?!0:st.call(Fa,e)?!1:Ft.test(e)?Rr[e]=!0:(Fa[e]=!0,!1)}function Sa(e,n,i){if(Fu(n))if(i===null)e.removeAttribute(n);else{switch(typeof i){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var o=n.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,""+i)}}function Rl(e,n,i){if(i===null)e.removeAttribute(n);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+i)}}function oa(e,n,i,o){if(o===null)e.removeAttribute(i);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(i);return}e.setAttributeNS(n,i,""+o)}}function qn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function dn(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Qa(e,n,i){var o=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var d=o.get,f=o.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return d.call(this)},set:function(v){i=""+v,f.call(this,v)}}),Object.defineProperty(e,n,{enumerable:o.enumerable}),{getValue:function(){return i},setValue:function(v){i=""+v},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function Ti(e){if(!e._valueTracker){var n=dn(e)?"checked":"value";e._valueTracker=Qa(e,n,""+e[n])}}function Ga(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var i=n.getValue(),o="";return e&&(o=dn(e)?e.checked?"true":"false":e.value),e=o,e!==i?(n.setValue(e),!0):!1}function ja(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Wo=/[\n"\\]/g;function es(e){return e.replace(Wo,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function Xo(e,n,i,o,d,f,v,w){e.name="",v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?e.type=v:e.removeAttribute("type"),n!=null?v==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+qn(n)):e.value!==""+qn(n)&&(e.value=""+qn(n)):v!=="submit"&&v!=="reset"||e.removeAttribute("value"),n!=null?ys(e,v,qn(n)):i!=null?ys(e,v,qn(i)):o!=null&&e.removeAttribute("value"),d==null&&f!=null&&(e.defaultChecked=!!f),d!=null&&(e.checked=d&&typeof d!="function"&&typeof d!="symbol"),w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?e.name=""+qn(w):e.removeAttribute("name")}function Va(e,n,i,o,d,f,v,w){if(f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.type=f),n!=null||i!=null){if(!(f!=="submit"&&f!=="reset"||n!=null)){Ti(e);return}i=i!=null?""+qn(i):"",n=n!=null?""+qn(n):i,w||n===e.value||(e.value=n),e.defaultValue=n}o=o??d,o=typeof o!="function"&&typeof o!="symbol"&&!!o,e.checked=w?e.checked:!!o,e.defaultChecked=!!o,v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(e.name=v),Ti(e)}function ys(e,n,i){n==="number"&&ja(e.ownerDocument)===e||e.defaultValue===""+i||(e.defaultValue=""+i)}function Rs(e,n,i,o){if(e=e.options,n){n={};for(var d=0;d<i.length;d++)n["$"+i[d]]=!0;for(i=0;i<e.length;i++)d=n.hasOwnProperty("$"+e[i].value),e[i].selected!==d&&(e[i].selected=d),d&&o&&(e[i].defaultSelected=!0)}else{for(i=""+qn(i),n=null,d=0;d<e.length;d++){if(e[d].value===i){e[d].selected=!0,o&&(e[d].defaultSelected=!0);return}n!==null||e[d].disabled||(n=e[d])}n!==null&&(n.selected=!0)}}function vs(e,n,i){if(n!=null&&(n=""+qn(n),n!==e.value&&(e.value=n),i==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=i!=null?""+qn(i):""}function Al(e,n,i,o){if(n==null){if(o!=null){if(i!=null)throw Error(r(92));if(ce(o)){if(1<o.length)throw Error(r(93));o=o[0]}i=o}i==null&&(i=""),n=i}i=qn(n),e.defaultValue=i,o=e.textContent,o===i&&o!==""&&o!==null&&(e.value=o),Ti(e)}function ca(e,n){if(n){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=n;return}}e.textContent=n}var Qu=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function wa(e,n,i){var o=n.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?o?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":o?e.setProperty(n,i):typeof i!="number"||i===0||Qu.has(n)?n==="float"?e.cssFloat=i:e[n]=(""+i).trim():e[n]=i+"px"}function Ar(e,n,i){if(n!=null&&typeof n!="object")throw Error(r(62));if(e=e.style,i!=null){for(var o in i)!i.hasOwnProperty(o)||n!=null&&n.hasOwnProperty(o)||(o.indexOf("--")===0?e.setProperty(o,""):o==="float"?e.cssFloat="":e[o]="");for(var d in n)o=n[d],n.hasOwnProperty(d)&&i[d]!==o&&wa(e,d,o)}else for(var f in n)n.hasOwnProperty(f)&&wa(e,f,n[f])}function Dl(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ka=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"]]),Ol=/^[\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 ua(e){return Ol.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Ks(){}var As=null;function fn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var da=null,Nn=null;function Ys(e){var n=kn(e);if(n&&(e=n.stateNode)){var i=e[we]||null;e:switch(e=n.stateNode,n.type){case"input":if(Xo(e,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),n=i.name,i.type==="radio"&&n!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+es(""+n)+'"][type="radio"]'),n=0;n<i.length;n++){var o=i[n];if(o!==e&&o.form===e.form){var d=o[we]||null;if(!d)throw Error(r(90));Xo(o,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name)}}for(n=0;n<i.length;n++)o=i[n],o.form===e.form&&Ga(o)}break e;case"textarea":vs(e,i.value,i.defaultValue);break e;case"select":n=i.value,n!=null&&Rs(e,!!i.multiple,n,!1)}}}var Ds=!1;function Dr(e,n,i){if(Ds)return e(n,i);Ds=!0;try{var o=e(n);return o}finally{if(Ds=!1,(da!==null||Nn!==null)&&(qd(),da&&(n=da,e=Nn,Nn=da=null,Ys(n),e)))for(n=0;n<e.length;n++)Ys(e[n])}}function Na(e,n){var i=e.stateNode;if(i===null)return null;var o=i[we]||null;if(o===null)return null;i=o[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(o=!o.disabled)||(e=e.type,o=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!o;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(r(231,n,typeof i));return i}var Zt=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ei=!1;if(Zt)try{var Mi={};Object.defineProperty(Mi,"passive",{get:function(){Ei=!0}}),window.addEventListener("test",Mi,Mi),window.removeEventListener("test",Mi,Mi)}catch{Ei=!1}var Os=null,Or=null,fa=null;function Jo(){if(fa)return fa;var e,n=Or,i=n.length,o,d="value"in Os?Os.value:Os.textContent,f=d.length;for(e=0;e<i&&n[e]===d[e];e++);var v=i-e;for(o=1;o<=v&&n[i-o]===d[f-o];o++);return fa=d.slice(e,1<o?1-o:void 0)}function Ka(e){var n=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&n===13&&(e=13)):e=n,e===10&&(e=13),32<=e||e===13?e:0}function Lr(){return!0}function Ir(){return!1}function $n(e){function n(i,o,d,f,v){this._reactName=i,this._targetInst=d,this.type=o,this.nativeEvent=f,this.target=v,this.currentTarget=null;for(var w in e)e.hasOwnProperty(w)&&(i=e[w],this[w]=i?i(f):f[w]);return this.isDefaultPrevented=(f.defaultPrevented!=null?f.defaultPrevented:f.returnValue===!1)?Lr:Ir,this.isPropagationStopped=Ir,this}return g(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=Lr)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=Lr)},persist:function(){},isPersistent:Lr}),n}var Ca={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},zr=$n(Ca),Br=g({},Ca,{view:0,detail:0}),Ya=$n(Br),ec,tc,Pr,Ta=g({},Br,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:zl,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Pr&&(Pr&&e.type==="mousemove"?(ec=e.screenX-Pr.screenX,tc=e.screenY-Pr.screenY):tc=ec=0,Pr=e),ec)},movementY:function(e){return"movementY"in e?e.movementY:tc}}),Gu=$n(Ta),oh=g({},Ta,{dataTransfer:0}),Ll=$n(oh),Ls=g({},Br,{relatedTarget:0}),Il=$n(Ls),ch=g({},Ca,{animationName:0,elapsedTime:0,pseudoElement:0}),uh=$n(ch),dh=g({},Ca,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),fh=$n(dh),Is=g({},Ca,{data:0}),Vu=$n(Is),Ku={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},hh={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"},mh={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ph(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=mh[e])?!!n[e]:!1}function zl(){return ph}var gh=g({},Br,{key:function(e){if(e.key){var n=Ku[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=Ka(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?hh[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:zl,charCode:function(e){return e.type==="keypress"?Ka(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ka(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Vn=$n(gh),nc=g({},Ta,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Bl=$n(nc),yh=g({},Br,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:zl}),vh=$n(yh),_h=g({},Ca,{propertyName:0,elapsedTime:0,pseudoElement:0}),Pl=$n(_h),_s=g({},Ta,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Zs=$n(_s),Za=g({},Ca,{newState:0,oldState:0}),Yu=$n(Za),sc=[9,13,27,32],Ur=Zt&&"CompositionEvent"in window,Ea=null;Zt&&"documentMode"in document&&(Ea=document.documentMode);var ac=Zt&&"TextEvent"in window&&!Ea,Ma=Zt&&(!Ur||Ea&&8<Ea&&11>=Ea),Zu=" ",Ri=!1;function Wu(e,n){switch(e){case"keyup":return sc.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ic(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ai=!1;function Xu(e,n){switch(e){case"compositionend":return ic(n);case"keypress":return n.which!==32?null:(Ri=!0,Zu);case"textInput":return e=n.data,e===Zu&&Ri?null:e;default:return null}}function Ju(e,n){if(Ai)return e==="compositionend"||!Ur&&Wu(e,n)?(e=Jo(),fa=Or=Os=null,Ai=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return Ma&&n.locale!=="ko"?null:n.data;default:return null}}var Ra={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 rc(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!Ra[e.type]:n==="textarea"}function lc(e,n,i,o){da?Nn?Nn.push(o):Nn=[o]:da=o,n=Kd(n,"onChange"),0<n.length&&(i=new zr("onChange","change",null,i,o),e.push({event:i,listeners:n}))}var Di=null,Oi=null;function bh(e){k_(e,0)}function Ul(e){var n=Ln(e);if(Ga(n))return e}function ed(e,n){if(e==="change")return n}var td=!1;if(Zt){var ql;if(Zt){var oc="oninput"in document;if(!oc){var nd=document.createElement("div");nd.setAttribute("oninput","return;"),oc=typeof nd.oninput=="function"}ql=oc}else ql=!1;td=ql&&(!document.documentMode||9<document.documentMode)}function sd(){Di&&(Di.detachEvent("onpropertychange",ad),Oi=Di=null)}function ad(e){if(e.propertyName==="value"&&Ul(Oi)){var n=[];lc(n,Oi,e,fn(e)),Dr(bh,n)}}function xh(e,n,i){e==="focusin"?(sd(),Di=n,Oi=i,Di.attachEvent("onpropertychange",ad)):e==="focusout"&&sd()}function Sh(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ul(Oi)}function jh(e,n){if(e==="click")return Ul(n)}function wh(e,n){if(e==="input"||e==="change")return Ul(n)}function kh(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var Cn=typeof Object.is=="function"?Object.is:kh;function qr(e,n){if(Cn(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var i=Object.keys(e),o=Object.keys(n);if(i.length!==o.length)return!1;for(o=0;o<i.length;o++){var d=i[o];if(!st.call(n,d)||!Cn(e[d],n[d]))return!1}return!0}function id(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function rd(e,n){var i=id(e);e=0;for(var o;i;){if(i.nodeType===3){if(o=e+i.textContent.length,e<=n&&o>=n)return{node:i,offset:n-e};e=o}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=id(i)}}function ld(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?ld(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function od(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=ja(e.document);n instanceof e.HTMLIFrameElement;){try{var i=typeof n.contentWindow.location.href=="string"}catch{i=!1}if(i)e=n.contentWindow;else break;n=ja(e.document)}return n}function cc(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var Nh=Zt&&"documentMode"in document&&11>=document.documentMode,Li=null,uc=null,$r=null,$l=!1;function dc(e,n,i){var o=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;$l||Li==null||Li!==ja(o)||(o=Li,"selectionStart"in o&&cc(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),$r&&qr($r,o)||($r=o,o=Kd(uc,"onSelect"),0<o.length&&(n=new zr("onSelect","select",null,n,i),e.push({event:n,listeners:o}),n.target=Li)))}function Aa(e,n){var i={};return i[e.toLowerCase()]=n.toLowerCase(),i["Webkit"+e]="webkit"+n,i["Moz"+e]="moz"+n,i}var Ii={animationend:Aa("Animation","AnimationEnd"),animationiteration:Aa("Animation","AnimationIteration"),animationstart:Aa("Animation","AnimationStart"),transitionrun:Aa("Transition","TransitionRun"),transitionstart:Aa("Transition","TransitionStart"),transitioncancel:Aa("Transition","TransitionCancel"),transitionend:Aa("Transition","TransitionEnd")},Hl={},fc={};Zt&&(fc=document.createElement("div").style,"AnimationEvent"in window||(delete Ii.animationend.animation,delete Ii.animationiteration.animation,delete Ii.animationstart.animation),"TransitionEvent"in window||delete Ii.transitionend.transition);function Da(e){if(Hl[e])return Hl[e];if(!Ii[e])return e;var n=Ii[e],i;for(i in n)if(n.hasOwnProperty(i)&&i in fc)return Hl[e]=n[i];return e}var hc=Da("animationend"),mc=Da("animationiteration"),pc=Da("animationstart"),cd=Da("transitionrun"),Ch=Da("transitionstart"),Th=Da("transitioncancel"),ud=Da("transitionend"),gc=new Map,Fl="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(" ");Fl.push("scrollEnd");function zs(e,n){gc.set(e,n),yn(n,[e])}var Ql=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},bs=[],Wa=0,dd=0;function Hr(){for(var e=Wa,n=dd=Wa=0;n<e;){var i=bs[n];bs[n++]=null;var o=bs[n];bs[n++]=null;var d=bs[n];bs[n++]=null;var f=bs[n];if(bs[n++]=null,o!==null&&d!==null){var v=o.pending;v===null?d.next=d:(d.next=v.next,v.next=d),o.pending=d}f!==0&&yc(i,d,f)}}function Fr(e,n,i,o){bs[Wa++]=e,bs[Wa++]=n,bs[Wa++]=i,bs[Wa++]=o,dd|=o,e.lanes|=o,e=e.alternate,e!==null&&(e.lanes|=o)}function Gl(e,n,i,o){return Fr(e,n,i,o),Qr(e)}function Oa(e,n){return Fr(e,null,null,n),Qr(e)}function yc(e,n,i){e.lanes|=i;var o=e.alternate;o!==null&&(o.lanes|=i);for(var d=!1,f=e.return;f!==null;)f.childLanes|=i,o=f.alternate,o!==null&&(o.childLanes|=i),f.tag===22&&(e=f.stateNode,e===null||e._visibility&1||(d=!0)),e=f,f=f.return;return e.tag===3?(f=e.stateNode,d&&n!==null&&(d=31-De(i),e=f.hiddenUpdates,o=e[d],o===null?e[d]=[n]:o.push(n),n.lane=i|536870912),f):null}function Qr(e){if(50<qc)throw qc=0,Em=null,Error(r(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var Xa={};function fd(e,n,i,o){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ts(e,n,i,o){return new fd(e,n,i,o)}function Vl(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ws(e,n){var i=e.alternate;return i===null?(i=ts(e.tag,n,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=n,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&65011712,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,n=e.dependencies,i.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i.refCleanup=e.refCleanup,i}function vc(e,n){e.flags&=65011714;var i=e.alternate;return i===null?(e.childLanes=0,e.lanes=n,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=i.childLanes,e.lanes=i.lanes,e.child=i.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=i.memoizedProps,e.memoizedState=i.memoizedState,e.updateQueue=i.updateQueue,e.type=i.type,n=i.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function Gr(e,n,i,o,d,f){var v=0;if(o=e,typeof e=="function")Vl(e)&&(v=1);else if(typeof e=="string")v=qj(e,i,Q.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case te:return e=ts(31,i,n,d),e.elementType=te,e.lanes=f,e;case T:return La(i.children,d,f,n);case C:v=8,d|=24;break;case I:return e=ts(12,i,n,d|2),e.elementType=I,e.lanes=f,e;case G:return e=ts(13,i,n,d),e.elementType=G,e.lanes=f,e;case ue:return e=ts(19,i,n,d),e.elementType=ue,e.lanes=f,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case $:v=10;break e;case V:v=9;break e;case R:v=11;break e;case Z:v=14;break e;case ie:v=16,o=null;break e}v=29,i=Error(r(130,e===null?"null":typeof e,"")),o=null}return n=ts(v,i,n,d),n.elementType=e,n.type=o,n.lanes=f,n}function La(e,n,i,o){return e=ts(7,e,o,n),e.lanes=i,e}function Kl(e,n,i){return e=ts(6,e,null,n),e.lanes=i,e}function _c(e){var n=ts(18,null,null,0);return n.stateNode=e,n}function Yl(e,n,i){return n=ts(4,e.children!==null?e.children:[],e.key,n),n.lanes=i,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var b=new WeakMap;function D(e,n){if(typeof e=="object"&&e!==null){var i=b.get(e);return i!==void 0?i:(n={value:e,source:n,stack:St(n)},b.set(e,n),n)}return{value:e,source:n,stack:St(n)}}var K=[],le=0,et=null,Ye=0,pt=[],ot=0,Hn=null,Bs=1,Ps="";function Xs(e,n){K[le++]=Ye,K[le++]=et,et=e,Ye=n}function bc(e,n,i){pt[ot++]=Bs,pt[ot++]=Ps,pt[ot++]=Hn,Hn=e;var o=Bs;e=Ps;var d=32-De(o)-1;o&=~(1<<d),i+=1;var f=32-De(n)+d;if(30<f){var v=d-d%5;f=(o&(1<<v)-1).toString(32),o>>=v,d-=v,Bs=1<<32-De(n)+d|i<<d|o,Ps=f+e}else Bs=1<<f|i<<d|o,Ps=e}function Zl(e){e.return!==null&&(Xs(e,1),bc(e,1,0))}function Wl(e){for(;e===et;)et=K[--le],K[le]=null,Ye=K[--le],K[le]=null;for(;e===Hn;)Hn=pt[--ot],pt[ot]=null,Ps=pt[--ot],pt[ot]=null,Bs=pt[--ot],pt[ot]=null}function xc(e,n){pt[ot++]=Bs,pt[ot++]=Ps,pt[ot++]=Hn,Bs=n.id,Ps=n.overflow,Hn=e}var Tn=null,Wt=null,jt=!1,ha=null,ls=!1,Xl=Error(r(519));function ma(e){var n=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw os(D(n,e)),Xl}function it(e){var n=e.stateNode,i=e.type,o=e.memoizedProps;switch(n[ge]=e,n[we]=o,i){case"dialog":Tt("cancel",n),Tt("close",n);break;case"iframe":case"object":case"embed":Tt("load",n);break;case"video":case"audio":for(i=0;i<Hc.length;i++)Tt(Hc[i],n);break;case"source":Tt("error",n);break;case"img":case"image":case"link":Tt("error",n),Tt("load",n);break;case"details":Tt("toggle",n);break;case"input":Tt("invalid",n),Va(n,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":Tt("invalid",n);break;case"textarea":Tt("invalid",n),Al(n,o.value,o.defaultValue,o.children)}i=o.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||n.textContent===""+i||o.suppressHydrationWarning===!0||E_(n.textContent,i)?(o.popover!=null&&(Tt("beforetoggle",n),Tt("toggle",n)),o.onScroll!=null&&Tt("scroll",n),o.onScrollEnd!=null&&Tt("scrollend",n),o.onClick!=null&&(n.onclick=Ks),n=!0):n=!1,n||ma(e,!0)}function Qt(e){for(Tn=e.return;Tn;)switch(Tn.tag){case 5:case 31:case 13:ls=!1;return;case 27:case 3:ls=!0;return;default:Tn=Tn.return}}function wt(e){if(e!==Tn)return!1;if(!jt)return Qt(e),jt=!0,!1;var n=e.tag,i;if((i=n!==3&&n!==27)&&((i=n===5)&&(i=e.type,i=!(i!=="form"&&i!=="button")||Fm(e.type,e.memoizedProps)),i=!i),i&&Wt&&ma(e),Qt(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));Wt=B_(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));Wt=B_(e)}else n===27?(n=Wt,Zi(e.type)?(e=Ym,Ym=null,Wt=e):Wt=n):Wt=Tn?ea(e.stateNode.nextSibling):null;return!0}function Ot(){Wt=Tn=null,jt=!1}function Gt(){var e=ha;return e!==null&&(ws===null?ws=e:ws.push.apply(ws,e),ha=null),e}function os(e){ha===null?ha=[e]:ha.push(e)}var Vr=A(null),pa=null,Ja=null;function zi(e,n,i){be(Vr,n._currentValue),n._currentValue=i}function ei(e){e._currentValue=Vr.current,ne(Vr)}function Eh(e,n,i){for(;e!==null;){var o=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,o!==null&&(o.childLanes|=n)):o!==null&&(o.childLanes&n)!==n&&(o.childLanes|=n),e===i)break;e=e.return}}function Mh(e,n,i,o){var d=e.child;for(d!==null&&(d.return=e);d!==null;){var f=d.dependencies;if(f!==null){var v=d.child;f=f.firstContext;e:for(;f!==null;){var w=f;f=d;for(var O=0;O<n.length;O++)if(w.context===n[O]){f.lanes|=i,w=f.alternate,w!==null&&(w.lanes|=i),Eh(f.return,i,e),o||(v=null);break e}f=w.next}}else if(d.tag===18){if(v=d.return,v===null)throw Error(r(341));v.lanes|=i,f=v.alternate,f!==null&&(f.lanes|=i),Eh(v,i,e),v=null}else v=d.child;if(v!==null)v.return=d;else for(v=d;v!==null;){if(v===e){v=null;break}if(d=v.sibling,d!==null){d.return=v.return,v=d;break}v=v.return}d=v}}function Jl(e,n,i,o){e=null;for(var d=n,f=!1;d!==null;){if(!f){if((d.flags&524288)!==0)f=!0;else if((d.flags&262144)!==0)break}if(d.tag===10){var v=d.alternate;if(v===null)throw Error(r(387));if(v=v.memoizedProps,v!==null){var w=d.type;Cn(d.pendingProps.value,v.value)||(e!==null?e.push(w):e=[w])}}else if(d===Le.current){if(v=d.alternate,v===null)throw Error(r(387));v.memoizedState.memoizedState!==d.memoizedState.memoizedState&&(e!==null?e.push(Kc):e=[Kc])}d=d.return}e!==null&&Mh(n,e,i,o),n.flags|=262144}function hd(e){for(e=e.firstContext;e!==null;){if(!Cn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Kr(e){pa=e,Ja=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Kn(e){return my(pa,e)}function md(e,n){return pa===null&&Kr(e),my(e,n)}function my(e,n){var i=n._currentValue;if(n={context:n,memoizedValue:i,next:null},Ja===null){if(e===null)throw Error(r(308));Ja=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else Ja=Ja.next=n;return i}var z1=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(i,o){e.push(o)}};this.abort=function(){n.aborted=!0,e.forEach(function(i){return i()})}},B1=s.unstable_scheduleCallback,P1=s.unstable_NormalPriority,En={$$typeof:$,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Rh(){return{controller:new z1,data:new Map,refCount:0}}function Sc(e){e.refCount--,e.refCount===0&&B1(P1,function(){e.controller.abort()})}var jc=null,Ah=0,eo=0,to=null;function U1(e,n){if(jc===null){var i=jc=[];Ah=0,eo=Lm(),to={status:"pending",value:void 0,then:function(o){i.push(o)}}}return Ah++,n.then(py,py),n}function py(){if(--Ah===0&&jc!==null){to!==null&&(to.status="fulfilled");var e=jc;jc=null,eo=0,to=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function q1(e,n){var i=[],o={status:"pending",value:null,reason:null,then:function(d){i.push(d)}};return e.then(function(){o.status="fulfilled",o.value=n;for(var d=0;d<i.length;d++)(0,i[d])(n)},function(d){for(o.status="rejected",o.reason=d,d=0;d<i.length;d++)(0,i[d])(void 0)}),o}var gy=E.S;E.S=function(e,n){Jv=Re(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&U1(e,n),gy!==null&&gy(e,n)};var Yr=A(null);function Dh(){var e=Yr.current;return e!==null?e:an.pooledCache}function pd(e,n){n===null?be(Yr,Yr.current):be(Yr,n.pool)}function yy(){var e=Dh();return e===null?null:{parent:En._currentValue,pool:e}}var no=Error(r(460)),Oh=Error(r(474)),gd=Error(r(542)),yd={then:function(){}};function vy(e){return e=e.status,e==="fulfilled"||e==="rejected"}function _y(e,n,i){switch(i=e[i],i===void 0?e.push(n):i!==n&&(n.then(Ks,Ks),n=i),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,xy(e),e;default:if(typeof n.status=="string")n.then(Ks,Ks);else{if(e=an,e!==null&&100<e.shellSuspendCounter)throw Error(r(482));e=n,e.status="pending",e.then(function(o){if(n.status==="pending"){var d=n;d.status="fulfilled",d.value=o}},function(o){if(n.status==="pending"){var d=n;d.status="rejected",d.reason=o}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,xy(e),e}throw Wr=n,no}}function Zr(e){try{var n=e._init;return n(e._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(Wr=i,no):i}}var Wr=null;function by(){if(Wr===null)throw Error(r(459));var e=Wr;return Wr=null,e}function xy(e){if(e===no||e===gd)throw Error(r(483))}var so=null,wc=0;function vd(e){var n=wc;return wc+=1,so===null&&(so=[]),_y(so,e,n)}function kc(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function _d(e,n){throw n.$$typeof===S?Error(r(525)):(e=Object.prototype.toString.call(n),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function Sy(e){function n(F,P){if(e){var X=F.deletions;X===null?(F.deletions=[P],F.flags|=16):X.push(P)}}function i(F,P){if(!e)return null;for(;P!==null;)n(F,P),P=P.sibling;return null}function o(F){for(var P=new Map;F!==null;)F.key!==null?P.set(F.key,F):P.set(F.index,F),F=F.sibling;return P}function d(F,P){return F=Ws(F,P),F.index=0,F.sibling=null,F}function f(F,P,X){return F.index=X,e?(X=F.alternate,X!==null?(X=X.index,X<P?(F.flags|=67108866,P):X):(F.flags|=67108866,P)):(F.flags|=1048576,P)}function v(F){return e&&F.alternate===null&&(F.flags|=67108866),F}function w(F,P,X,ye){return P===null||P.tag!==6?(P=Kl(X,F.mode,ye),P.return=F,P):(P=d(P,X),P.return=F,P)}function O(F,P,X,ye){var tt=X.type;return tt===T?fe(F,P,X.props.children,ye,X.key):P!==null&&(P.elementType===tt||typeof tt=="object"&&tt!==null&&tt.$$typeof===ie&&Zr(tt)===P.type)?(P=d(P,X.props),kc(P,X),P.return=F,P):(P=Gr(X.type,X.key,X.props,null,F.mode,ye),kc(P,X),P.return=F,P)}function J(F,P,X,ye){return P===null||P.tag!==4||P.stateNode.containerInfo!==X.containerInfo||P.stateNode.implementation!==X.implementation?(P=Yl(X,F.mode,ye),P.return=F,P):(P=d(P,X.children||[]),P.return=F,P)}function fe(F,P,X,ye,tt){return P===null||P.tag!==7?(P=La(X,F.mode,ye,tt),P.return=F,P):(P=d(P,X),P.return=F,P)}function ve(F,P,X){if(typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint")return P=Kl(""+P,F.mode,X),P.return=F,P;if(typeof P=="object"&&P!==null){switch(P.$$typeof){case k:return X=Gr(P.type,P.key,P.props,null,F.mode,X),kc(X,P),X.return=F,X;case N:return P=Yl(P,F.mode,X),P.return=F,P;case ie:return P=Zr(P),ve(F,P,X)}if(ce(P)||_e(P))return P=La(P,F.mode,X,null),P.return=F,P;if(typeof P.then=="function")return ve(F,vd(P),X);if(P.$$typeof===$)return ve(F,md(F,P),X);_d(F,P)}return null}function se(F,P,X,ye){var tt=P!==null?P.key:null;if(typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint")return tt!==null?null:w(F,P,""+X,ye);if(typeof X=="object"&&X!==null){switch(X.$$typeof){case k:return X.key===tt?O(F,P,X,ye):null;case N:return X.key===tt?J(F,P,X,ye):null;case ie:return X=Zr(X),se(F,P,X,ye)}if(ce(X)||_e(X))return tt!==null?null:fe(F,P,X,ye,null);if(typeof X.then=="function")return se(F,P,vd(X),ye);if(X.$$typeof===$)return se(F,P,md(F,X),ye);_d(F,X)}return null}function re(F,P,X,ye,tt){if(typeof ye=="string"&&ye!==""||typeof ye=="number"||typeof ye=="bigint")return F=F.get(X)||null,w(P,F,""+ye,tt);if(typeof ye=="object"&&ye!==null){switch(ye.$$typeof){case k:return F=F.get(ye.key===null?X:ye.key)||null,O(P,F,ye,tt);case N:return F=F.get(ye.key===null?X:ye.key)||null,J(P,F,ye,tt);case ie:return ye=Zr(ye),re(F,P,X,ye,tt)}if(ce(ye)||_e(ye))return F=F.get(X)||null,fe(P,F,ye,tt,null);if(typeof ye.then=="function")return re(F,P,X,vd(ye),tt);if(ye.$$typeof===$)return re(F,P,X,md(P,ye),tt);_d(P,ye)}return null}function Fe(F,P,X,ye){for(var tt=null,It=null,Ze=P,_t=P=0,Mt=null;Ze!==null&&_t<X.length;_t++){Ze.index>_t?(Mt=Ze,Ze=null):Mt=Ze.sibling;var zt=se(F,Ze,X[_t],ye);if(zt===null){Ze===null&&(Ze=Mt);break}e&&Ze&&zt.alternate===null&&n(F,Ze),P=f(zt,P,_t),It===null?tt=zt:It.sibling=zt,It=zt,Ze=Mt}if(_t===X.length)return i(F,Ze),jt&&Xs(F,_t),tt;if(Ze===null){for(;_t<X.length;_t++)Ze=ve(F,X[_t],ye),Ze!==null&&(P=f(Ze,P,_t),It===null?tt=Ze:It.sibling=Ze,It=Ze);return jt&&Xs(F,_t),tt}for(Ze=o(Ze);_t<X.length;_t++)Mt=re(Ze,F,_t,X[_t],ye),Mt!==null&&(e&&Mt.alternate!==null&&Ze.delete(Mt.key===null?_t:Mt.key),P=f(Mt,P,_t),It===null?tt=Mt:It.sibling=Mt,It=Mt);return e&&Ze.forEach(function(tr){return n(F,tr)}),jt&&Xs(F,_t),tt}function lt(F,P,X,ye){if(X==null)throw Error(r(151));for(var tt=null,It=null,Ze=P,_t=P=0,Mt=null,zt=X.next();Ze!==null&&!zt.done;_t++,zt=X.next()){Ze.index>_t?(Mt=Ze,Ze=null):Mt=Ze.sibling;var tr=se(F,Ze,zt.value,ye);if(tr===null){Ze===null&&(Ze=Mt);break}e&&Ze&&tr.alternate===null&&n(F,Ze),P=f(tr,P,_t),It===null?tt=tr:It.sibling=tr,It=tr,Ze=Mt}if(zt.done)return i(F,Ze),jt&&Xs(F,_t),tt;if(Ze===null){for(;!zt.done;_t++,zt=X.next())zt=ve(F,zt.value,ye),zt!==null&&(P=f(zt,P,_t),It===null?tt=zt:It.sibling=zt,It=zt);return jt&&Xs(F,_t),tt}for(Ze=o(Ze);!zt.done;_t++,zt=X.next())zt=re(Ze,F,_t,zt.value,ye),zt!==null&&(e&&zt.alternate!==null&&Ze.delete(zt.key===null?_t:zt.key),P=f(zt,P,_t),It===null?tt=zt:It.sibling=zt,It=zt);return e&&Ze.forEach(function(Xj){return n(F,Xj)}),jt&&Xs(F,_t),tt}function en(F,P,X,ye){if(typeof X=="object"&&X!==null&&X.type===T&&X.key===null&&(X=X.props.children),typeof X=="object"&&X!==null){switch(X.$$typeof){case k:e:{for(var tt=X.key;P!==null;){if(P.key===tt){if(tt=X.type,tt===T){if(P.tag===7){i(F,P.sibling),ye=d(P,X.props.children),ye.return=F,F=ye;break e}}else if(P.elementType===tt||typeof tt=="object"&&tt!==null&&tt.$$typeof===ie&&Zr(tt)===P.type){i(F,P.sibling),ye=d(P,X.props),kc(ye,X),ye.return=F,F=ye;break e}i(F,P);break}else n(F,P);P=P.sibling}X.type===T?(ye=La(X.props.children,F.mode,ye,X.key),ye.return=F,F=ye):(ye=Gr(X.type,X.key,X.props,null,F.mode,ye),kc(ye,X),ye.return=F,F=ye)}return v(F);case N:e:{for(tt=X.key;P!==null;){if(P.key===tt)if(P.tag===4&&P.stateNode.containerInfo===X.containerInfo&&P.stateNode.implementation===X.implementation){i(F,P.sibling),ye=d(P,X.children||[]),ye.return=F,F=ye;break e}else{i(F,P);break}else n(F,P);P=P.sibling}ye=Yl(X,F.mode,ye),ye.return=F,F=ye}return v(F);case ie:return X=Zr(X),en(F,P,X,ye)}if(ce(X))return Fe(F,P,X,ye);if(_e(X)){if(tt=_e(X),typeof tt!="function")throw Error(r(150));return X=tt.call(X),lt(F,P,X,ye)}if(typeof X.then=="function")return en(F,P,vd(X),ye);if(X.$$typeof===$)return en(F,P,md(F,X),ye);_d(F,X)}return typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint"?(X=""+X,P!==null&&P.tag===6?(i(F,P.sibling),ye=d(P,X),ye.return=F,F=ye):(i(F,P),ye=Kl(X,F.mode,ye),ye.return=F,F=ye),v(F)):i(F,P)}return function(F,P,X,ye){try{wc=0;var tt=en(F,P,X,ye);return so=null,tt}catch(Ze){if(Ze===no||Ze===gd)throw Ze;var It=ts(29,Ze,null,F.mode);return It.lanes=ye,It.return=F,It}finally{}}}var Xr=Sy(!0),jy=Sy(!1),Bi=!1;function Lh(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ih(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Pi(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ui(e,n,i){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,(Pt&2)!==0){var d=o.pending;return d===null?n.next=n:(n.next=d.next,d.next=n),o.pending=n,n=Qr(e),yc(e,null,i),n}return Fr(e,o,n,i),Qr(e)}function Nc(e,n,i){if(n=n.updateQueue,n!==null&&(n=n.shared,(i&4194048)!==0)){var o=n.lanes;o&=e.pendingLanes,i|=o,n.lanes=i,Gs(e,i)}}function zh(e,n){var i=e.updateQueue,o=e.alternate;if(o!==null&&(o=o.updateQueue,i===o)){var d=null,f=null;if(i=i.firstBaseUpdate,i!==null){do{var v={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};f===null?d=f=v:f=f.next=v,i=i.next}while(i!==null);f===null?d=f=n:f=f.next=n}else d=f=n;i={baseState:o.baseState,firstBaseUpdate:d,lastBaseUpdate:f,shared:o.shared,callbacks:o.callbacks},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=n:e.next=n,i.lastBaseUpdate=n}var Bh=!1;function Cc(){if(Bh){var e=to;if(e!==null)throw e}}function Tc(e,n,i,o){Bh=!1;var d=e.updateQueue;Bi=!1;var f=d.firstBaseUpdate,v=d.lastBaseUpdate,w=d.shared.pending;if(w!==null){d.shared.pending=null;var O=w,J=O.next;O.next=null,v===null?f=J:v.next=J,v=O;var fe=e.alternate;fe!==null&&(fe=fe.updateQueue,w=fe.lastBaseUpdate,w!==v&&(w===null?fe.firstBaseUpdate=J:w.next=J,fe.lastBaseUpdate=O))}if(f!==null){var ve=d.baseState;v=0,fe=J=O=null,w=f;do{var se=w.lane&-536870913,re=se!==w.lane;if(re?(Et&se)===se:(o&se)===se){se!==0&&se===eo&&(Bh=!0),fe!==null&&(fe=fe.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var Fe=e,lt=w;se=n;var en=i;switch(lt.tag){case 1:if(Fe=lt.payload,typeof Fe=="function"){ve=Fe.call(en,ve,se);break e}ve=Fe;break e;case 3:Fe.flags=Fe.flags&-65537|128;case 0:if(Fe=lt.payload,se=typeof Fe=="function"?Fe.call(en,ve,se):Fe,se==null)break e;ve=g({},ve,se);break e;case 2:Bi=!0}}se=w.callback,se!==null&&(e.flags|=64,re&&(e.flags|=8192),re=d.callbacks,re===null?d.callbacks=[se]:re.push(se))}else re={lane:se,tag:w.tag,payload:w.payload,callback:w.callback,next:null},fe===null?(J=fe=re,O=ve):fe=fe.next=re,v|=se;if(w=w.next,w===null){if(w=d.shared.pending,w===null)break;re=w,w=re.next,re.next=null,d.lastBaseUpdate=re,d.shared.pending=null}}while(!0);fe===null&&(O=ve),d.baseState=O,d.firstBaseUpdate=J,d.lastBaseUpdate=fe,f===null&&(d.shared.lanes=0),Qi|=v,e.lanes=v,e.memoizedState=ve}}function wy(e,n){if(typeof e!="function")throw Error(r(191,e));e.call(n)}function ky(e,n){var i=e.callbacks;if(i!==null)for(e.callbacks=null,e=0;e<i.length;e++)wy(i[e],n)}var ao=A(null),bd=A(0);function Ny(e,n){e=ci,be(bd,e),be(ao,n),ci=e|n.baseLanes}function Ph(){be(bd,ci),be(ao,ao.current)}function Uh(){ci=bd.current,ne(ao),ne(bd)}var Us=A(null),Js=null;function qi(e){var n=e.alternate;be(Sn,Sn.current&1),be(Us,e),Js===null&&(n===null||ao.current!==null||n.memoizedState!==null)&&(Js=e)}function qh(e){be(Sn,Sn.current),be(Us,e),Js===null&&(Js=e)}function Cy(e){e.tag===22?(be(Sn,Sn.current),be(Us,e),Js===null&&(Js=e)):$i()}function $i(){be(Sn,Sn.current),be(Us,Us.current)}function qs(e){ne(Us),Js===e&&(Js=null),ne(Sn)}var Sn=A(0);function xd(e){for(var n=e;n!==null;){if(n.tag===13){var i=n.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||Vm(i)||Km(i)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var ti=0,yt=null,Xt=null,Mn=null,Sd=!1,io=!1,Jr=!1,jd=0,Ec=0,ro=null,$1=0;function vn(){throw Error(r(321))}function $h(e,n){if(n===null)return!1;for(var i=0;i<n.length&&i<e.length;i++)if(!Cn(e[i],n[i]))return!1;return!0}function Hh(e,n,i,o,d,f){return ti=f,yt=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,E.H=e===null||e.memoizedState===null?uv:am,Jr=!1,f=i(o,d),Jr=!1,io&&(f=Ey(n,i,o,d)),Ty(e),f}function Ty(e){E.H=Ac;var n=Xt!==null&&Xt.next!==null;if(ti=0,Mn=Xt=yt=null,Sd=!1,Ec=0,ro=null,n)throw Error(r(300));e===null||Rn||(e=e.dependencies,e!==null&&hd(e)&&(Rn=!0))}function Ey(e,n,i,o){yt=e;var d=0;do{if(io&&(ro=null),Ec=0,io=!1,25<=d)throw Error(r(301));if(d+=1,Mn=Xt=null,e.updateQueue!=null){var f=e.updateQueue;f.lastEffect=null,f.events=null,f.stores=null,f.memoCache!=null&&(f.memoCache.index=0)}E.H=dv,f=n(i,o)}while(io);return f}function H1(){var e=E.H,n=e.useState()[0];return n=typeof n.then=="function"?Mc(n):n,e=e.useState()[0],(Xt!==null?Xt.memoizedState:null)!==e&&(yt.flags|=1024),n}function Fh(){var e=jd!==0;return jd=0,e}function Qh(e,n,i){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~i}function Gh(e){if(Sd){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}Sd=!1}ti=0,Mn=Xt=yt=null,io=!1,Ec=jd=0,ro=null}function cs(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Mn===null?yt.memoizedState=Mn=e:Mn=Mn.next=e,Mn}function jn(){if(Xt===null){var e=yt.alternate;e=e!==null?e.memoizedState:null}else e=Xt.next;var n=Mn===null?yt.memoizedState:Mn.next;if(n!==null)Mn=n,Xt=e;else{if(e===null)throw yt.alternate===null?Error(r(467)):Error(r(310));Xt=e,e={memoizedState:Xt.memoizedState,baseState:Xt.baseState,baseQueue:Xt.baseQueue,queue:Xt.queue,next:null},Mn===null?yt.memoizedState=Mn=e:Mn=Mn.next=e}return Mn}function wd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Mc(e){var n=Ec;return Ec+=1,ro===null&&(ro=[]),e=_y(ro,e,n),n=yt,(Mn===null?n.memoizedState:Mn.next)===null&&(n=n.alternate,E.H=n===null||n.memoizedState===null?uv:am),e}function kd(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Mc(e);if(e.$$typeof===$)return Kn(e)}throw Error(r(438,String(e)))}function Vh(e){var n=null,i=yt.updateQueue;if(i!==null&&(n=i.memoCache),n==null){var o=yt.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(n={data:o.data.map(function(d){return d.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),i===null&&(i=wd(),yt.updateQueue=i),i.memoCache=n,i=n.data[n.index],i===void 0)for(i=n.data[n.index]=Array(e),o=0;o<e;o++)i[o]=Y;return n.index++,i}function ni(e,n){return typeof n=="function"?n(e):n}function Nd(e){var n=jn();return Kh(n,Xt,e)}function Kh(e,n,i){var o=e.queue;if(o===null)throw Error(r(311));o.lastRenderedReducer=i;var d=e.baseQueue,f=o.pending;if(f!==null){if(d!==null){var v=d.next;d.next=f.next,f.next=v}n.baseQueue=d=f,o.pending=null}if(f=e.baseState,d===null)e.memoizedState=f;else{n=d.next;var w=v=null,O=null,J=n,fe=!1;do{var ve=J.lane&-536870913;if(ve!==J.lane?(Et&ve)===ve:(ti&ve)===ve){var se=J.revertLane;if(se===0)O!==null&&(O=O.next={lane:0,revertLane:0,gesture:null,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null}),ve===eo&&(fe=!0);else if((ti&se)===se){J=J.next,se===eo&&(fe=!0);continue}else ve={lane:0,revertLane:J.revertLane,gesture:null,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null},O===null?(w=O=ve,v=f):O=O.next=ve,yt.lanes|=se,Qi|=se;ve=J.action,Jr&&i(f,ve),f=J.hasEagerState?J.eagerState:i(f,ve)}else se={lane:ve,revertLane:J.revertLane,gesture:J.gesture,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null},O===null?(w=O=se,v=f):O=O.next=se,yt.lanes|=ve,Qi|=ve;J=J.next}while(J!==null&&J!==n);if(O===null?v=f:O.next=w,!Cn(f,e.memoizedState)&&(Rn=!0,fe&&(i=to,i!==null)))throw i;e.memoizedState=f,e.baseState=v,e.baseQueue=O,o.lastRenderedState=f}return d===null&&(o.lanes=0),[e.memoizedState,o.dispatch]}function Yh(e){var n=jn(),i=n.queue;if(i===null)throw Error(r(311));i.lastRenderedReducer=e;var o=i.dispatch,d=i.pending,f=n.memoizedState;if(d!==null){i.pending=null;var v=d=d.next;do f=e(f,v.action),v=v.next;while(v!==d);Cn(f,n.memoizedState)||(Rn=!0),n.memoizedState=f,n.baseQueue===null&&(n.baseState=f),i.lastRenderedState=f}return[f,o]}function My(e,n,i){var o=yt,d=jn(),f=jt;if(f){if(i===void 0)throw Error(r(407));i=i()}else i=n();var v=!Cn((Xt||d).memoizedState,i);if(v&&(d.memoizedState=i,Rn=!0),d=d.queue,Xh(Dy.bind(null,o,d,e),[e]),d.getSnapshot!==n||v||Mn!==null&&Mn.memoizedState.tag&1){if(o.flags|=2048,lo(9,{destroy:void 0},Ay.bind(null,o,d,i,n),null),an===null)throw Error(r(349));f||(ti&127)!==0||Ry(o,n,i)}return i}function Ry(e,n,i){e.flags|=16384,e={getSnapshot:n,value:i},n=yt.updateQueue,n===null?(n=wd(),yt.updateQueue=n,n.stores=[e]):(i=n.stores,i===null?n.stores=[e]:i.push(e))}function Ay(e,n,i,o){n.value=i,n.getSnapshot=o,Oy(n)&&Ly(e)}function Dy(e,n,i){return i(function(){Oy(n)&&Ly(e)})}function Oy(e){var n=e.getSnapshot;e=e.value;try{var i=n();return!Cn(e,i)}catch{return!0}}function Ly(e){var n=Oa(e,2);n!==null&&ks(n,e,2)}function Zh(e){var n=cs();if(typeof e=="function"){var i=e;if(e=i(),Jr){qe(!0);try{i()}finally{qe(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ni,lastRenderedState:e},n}function Iy(e,n,i,o){return e.baseState=i,Kh(e,Xt,typeof o=="function"?o:ni)}function F1(e,n,i,o,d){if(Ed(e))throw Error(r(485));if(e=n.action,e!==null){var f={payload:d,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(v){f.listeners.push(v)}};E.T!==null?i(!0):f.isTransition=!1,o(f),i=n.pending,i===null?(f.next=n.pending=f,zy(n,f)):(f.next=i.next,n.pending=i.next=f)}}function zy(e,n){var i=n.action,o=n.payload,d=e.state;if(n.isTransition){var f=E.T,v={};E.T=v;try{var w=i(d,o),O=E.S;O!==null&&O(v,w),By(e,n,w)}catch(J){Wh(e,n,J)}finally{f!==null&&v.types!==null&&(f.types=v.types),E.T=f}}else try{f=i(d,o),By(e,n,f)}catch(J){Wh(e,n,J)}}function By(e,n,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(o){Py(e,n,o)},function(o){return Wh(e,n,o)}):Py(e,n,i)}function Py(e,n,i){n.status="fulfilled",n.value=i,Uy(n),e.state=i,n=e.pending,n!==null&&(i=n.next,i===n?e.pending=null:(i=i.next,n.next=i,zy(e,i)))}function Wh(e,n,i){var o=e.pending;if(e.pending=null,o!==null){o=o.next;do n.status="rejected",n.reason=i,Uy(n),n=n.next;while(n!==o)}e.action=null}function Uy(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function qy(e,n){return n}function $y(e,n){if(jt){var i=an.formState;if(i!==null){e:{var o=yt;if(jt){if(Wt){t:{for(var d=Wt,f=ls;d.nodeType!==8;){if(!f){d=null;break t}if(d=ea(d.nextSibling),d===null){d=null;break t}}f=d.data,d=f==="F!"||f==="F"?d:null}if(d){Wt=ea(d.nextSibling),o=d.data==="F!";break e}}ma(o)}o=!1}o&&(n=i[0])}}return i=cs(),i.memoizedState=i.baseState=n,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:qy,lastRenderedState:n},i.queue=o,i=lv.bind(null,yt,o),o.dispatch=i,o=Zh(!1),f=sm.bind(null,yt,!1,o.queue),o=cs(),d={state:n,dispatch:null,action:e,pending:null},o.queue=d,i=F1.bind(null,yt,d,f,i),d.dispatch=i,o.memoizedState=e,[n,i,!1]}function Hy(e){var n=jn();return Fy(n,Xt,e)}function Fy(e,n,i){if(n=Kh(e,n,qy)[0],e=Nd(ni)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var o=Mc(n)}catch(v){throw v===no?gd:v}else o=n;n=jn();var d=n.queue,f=d.dispatch;return i!==n.memoizedState&&(yt.flags|=2048,lo(9,{destroy:void 0},Q1.bind(null,d,i),null)),[o,f,e]}function Q1(e,n){e.action=n}function Qy(e){var n=jn(),i=Xt;if(i!==null)return Fy(n,i,e);jn(),n=n.memoizedState,i=jn();var o=i.queue.dispatch;return i.memoizedState=e,[n,o,!1]}function lo(e,n,i,o){return e={tag:e,create:i,deps:o,inst:n,next:null},n=yt.updateQueue,n===null&&(n=wd(),yt.updateQueue=n),i=n.lastEffect,i===null?n.lastEffect=e.next=e:(o=i.next,i.next=e,e.next=o,n.lastEffect=e),e}function Gy(){return jn().memoizedState}function Cd(e,n,i,o){var d=cs();yt.flags|=e,d.memoizedState=lo(1|n,{destroy:void 0},i,o===void 0?null:o)}function Td(e,n,i,o){var d=jn();o=o===void 0?null:o;var f=d.memoizedState.inst;Xt!==null&&o!==null&&$h(o,Xt.memoizedState.deps)?d.memoizedState=lo(n,f,i,o):(yt.flags|=e,d.memoizedState=lo(1|n,f,i,o))}function Vy(e,n){Cd(8390656,8,e,n)}function Xh(e,n){Td(2048,8,e,n)}function G1(e){yt.flags|=4;var n=yt.updateQueue;if(n===null)n=wd(),yt.updateQueue=n,n.events=[e];else{var i=n.events;i===null?n.events=[e]:i.push(e)}}function Ky(e){var n=jn().memoizedState;return G1({ref:n,nextImpl:e}),function(){if((Pt&2)!==0)throw Error(r(440));return n.impl.apply(void 0,arguments)}}function Yy(e,n){return Td(4,2,e,n)}function Zy(e,n){return Td(4,4,e,n)}function Wy(e,n){if(typeof n=="function"){e=e();var i=n(e);return function(){typeof i=="function"?i():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function Xy(e,n,i){i=i!=null?i.concat([e]):null,Td(4,4,Wy.bind(null,n,e),i)}function Jh(){}function Jy(e,n){var i=jn();n=n===void 0?null:n;var o=i.memoizedState;return n!==null&&$h(n,o[1])?o[0]:(i.memoizedState=[e,n],e)}function ev(e,n){var i=jn();n=n===void 0?null:n;var o=i.memoizedState;if(n!==null&&$h(n,o[1]))return o[0];if(o=e(),Jr){qe(!0);try{e()}finally{qe(!1)}}return i.memoizedState=[o,n],o}function em(e,n,i){return i===void 0||(ti&1073741824)!==0&&(Et&261930)===0?e.memoizedState=n:(e.memoizedState=i,e=t_(),yt.lanes|=e,Qi|=e,i)}function tv(e,n,i,o){return Cn(i,n)?i:ao.current!==null?(e=em(e,i,o),Cn(e,n)||(Rn=!0),e):(ti&42)===0||(ti&1073741824)!==0&&(Et&261930)===0?(Rn=!0,e.memoizedState=i):(e=t_(),yt.lanes|=e,Qi|=e,n)}function nv(e,n,i,o,d){var f=U.p;U.p=f!==0&&8>f?f:8;var v=E.T,w={};E.T=w,sm(e,!1,n,i);try{var O=d(),J=E.S;if(J!==null&&J(w,O),O!==null&&typeof O=="object"&&typeof O.then=="function"){var fe=q1(O,o);Rc(e,n,fe,Fs(e))}else Rc(e,n,o,Fs(e))}catch(ve){Rc(e,n,{then:function(){},status:"rejected",reason:ve},Fs())}finally{U.p=f,v!==null&&w.types!==null&&(v.types=w.types),E.T=v}}function V1(){}function tm(e,n,i,o){if(e.tag!==5)throw Error(r(476));var d=sv(e).queue;nv(e,d,n,ee,i===null?V1:function(){return av(e),i(o)})}function sv(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:ee,baseState:ee,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ni,lastRenderedState:ee},next:null};var i={};return n.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ni,lastRenderedState:i},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function av(e){var n=sv(e);n.next===null&&(n=e.alternate.memoizedState),Rc(e,n.next.queue,{},Fs())}function nm(){return Kn(Kc)}function iv(){return jn().memoizedState}function rv(){return jn().memoizedState}function K1(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var i=Fs();e=Pi(i);var o=Ui(n,e,i);o!==null&&(ks(o,n,i),Nc(o,n,i)),n={cache:Rh()},e.payload=n;return}n=n.return}}function Y1(e,n,i){var o=Fs();i={lane:o,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Ed(e)?ov(n,i):(i=Gl(e,n,i,o),i!==null&&(ks(i,e,o),cv(i,n,o)))}function lv(e,n,i){var o=Fs();Rc(e,n,i,o)}function Rc(e,n,i,o){var d={lane:o,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(Ed(e))ov(n,d);else{var f=e.alternate;if(e.lanes===0&&(f===null||f.lanes===0)&&(f=n.lastRenderedReducer,f!==null))try{var v=n.lastRenderedState,w=f(v,i);if(d.hasEagerState=!0,d.eagerState=w,Cn(w,v))return Fr(e,n,d,0),an===null&&Hr(),!1}catch{}finally{}if(i=Gl(e,n,d,o),i!==null)return ks(i,e,o),cv(i,n,o),!0}return!1}function sm(e,n,i,o){if(o={lane:2,revertLane:Lm(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Ed(e)){if(n)throw Error(r(479))}else n=Gl(e,i,o,2),n!==null&&ks(n,e,2)}function Ed(e){var n=e.alternate;return e===yt||n!==null&&n===yt}function ov(e,n){io=Sd=!0;var i=e.pending;i===null?n.next=n:(n.next=i.next,i.next=n),e.pending=n}function cv(e,n,i){if((i&4194048)!==0){var o=n.lanes;o&=e.pendingLanes,i|=o,n.lanes=i,Gs(e,i)}}var Ac={readContext:Kn,use:kd,useCallback:vn,useContext:vn,useEffect:vn,useImperativeHandle:vn,useLayoutEffect:vn,useInsertionEffect:vn,useMemo:vn,useReducer:vn,useRef:vn,useState:vn,useDebugValue:vn,useDeferredValue:vn,useTransition:vn,useSyncExternalStore:vn,useId:vn,useHostTransitionStatus:vn,useFormState:vn,useActionState:vn,useOptimistic:vn,useMemoCache:vn,useCacheRefresh:vn};Ac.useEffectEvent=vn;var uv={readContext:Kn,use:kd,useCallback:function(e,n){return cs().memoizedState=[e,n===void 0?null:n],e},useContext:Kn,useEffect:Vy,useImperativeHandle:function(e,n,i){i=i!=null?i.concat([e]):null,Cd(4194308,4,Wy.bind(null,n,e),i)},useLayoutEffect:function(e,n){return Cd(4194308,4,e,n)},useInsertionEffect:function(e,n){Cd(4,2,e,n)},useMemo:function(e,n){var i=cs();n=n===void 0?null:n;var o=e();if(Jr){qe(!0);try{e()}finally{qe(!1)}}return i.memoizedState=[o,n],o},useReducer:function(e,n,i){var o=cs();if(i!==void 0){var d=i(n);if(Jr){qe(!0);try{i(n)}finally{qe(!1)}}}else d=n;return o.memoizedState=o.baseState=d,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:d},o.queue=e,e=e.dispatch=Y1.bind(null,yt,e),[o.memoizedState,e]},useRef:function(e){var n=cs();return e={current:e},n.memoizedState=e},useState:function(e){e=Zh(e);var n=e.queue,i=lv.bind(null,yt,n);return n.dispatch=i,[e.memoizedState,i]},useDebugValue:Jh,useDeferredValue:function(e,n){var i=cs();return em(i,e,n)},useTransition:function(){var e=Zh(!1);return e=nv.bind(null,yt,e.queue,!0,!1),cs().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,i){var o=yt,d=cs();if(jt){if(i===void 0)throw Error(r(407));i=i()}else{if(i=n(),an===null)throw Error(r(349));(Et&127)!==0||Ry(o,n,i)}d.memoizedState=i;var f={value:i,getSnapshot:n};return d.queue=f,Vy(Dy.bind(null,o,f,e),[e]),o.flags|=2048,lo(9,{destroy:void 0},Ay.bind(null,o,f,i,n),null),i},useId:function(){var e=cs(),n=an.identifierPrefix;if(jt){var i=Ps,o=Bs;i=(o&~(1<<32-De(o)-1)).toString(32)+i,n="_"+n+"R_"+i,i=jd++,0<i&&(n+="H"+i.toString(32)),n+="_"}else i=$1++,n="_"+n+"r_"+i.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:nm,useFormState:$y,useActionState:$y,useOptimistic:function(e){var n=cs();n.memoizedState=n.baseState=e;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=i,n=sm.bind(null,yt,!0,i),i.dispatch=n,[e,n]},useMemoCache:Vh,useCacheRefresh:function(){return cs().memoizedState=K1.bind(null,yt)},useEffectEvent:function(e){var n=cs(),i={impl:e};return n.memoizedState=i,function(){if((Pt&2)!==0)throw Error(r(440));return i.impl.apply(void 0,arguments)}}},am={readContext:Kn,use:kd,useCallback:Jy,useContext:Kn,useEffect:Xh,useImperativeHandle:Xy,useInsertionEffect:Yy,useLayoutEffect:Zy,useMemo:ev,useReducer:Nd,useRef:Gy,useState:function(){return Nd(ni)},useDebugValue:Jh,useDeferredValue:function(e,n){var i=jn();return tv(i,Xt.memoizedState,e,n)},useTransition:function(){var e=Nd(ni)[0],n=jn().memoizedState;return[typeof e=="boolean"?e:Mc(e),n]},useSyncExternalStore:My,useId:iv,useHostTransitionStatus:nm,useFormState:Hy,useActionState:Hy,useOptimistic:function(e,n){var i=jn();return Iy(i,Xt,e,n)},useMemoCache:Vh,useCacheRefresh:rv};am.useEffectEvent=Ky;var dv={readContext:Kn,use:kd,useCallback:Jy,useContext:Kn,useEffect:Xh,useImperativeHandle:Xy,useInsertionEffect:Yy,useLayoutEffect:Zy,useMemo:ev,useReducer:Yh,useRef:Gy,useState:function(){return Yh(ni)},useDebugValue:Jh,useDeferredValue:function(e,n){var i=jn();return Xt===null?em(i,e,n):tv(i,Xt.memoizedState,e,n)},useTransition:function(){var e=Yh(ni)[0],n=jn().memoizedState;return[typeof e=="boolean"?e:Mc(e),n]},useSyncExternalStore:My,useId:iv,useHostTransitionStatus:nm,useFormState:Qy,useActionState:Qy,useOptimistic:function(e,n){var i=jn();return Xt!==null?Iy(i,Xt,e,n):(i.baseState=e,[e,i.queue.dispatch])},useMemoCache:Vh,useCacheRefresh:rv};dv.useEffectEvent=Ky;function im(e,n,i,o){n=e.memoizedState,i=i(o,n),i=i==null?n:g({},n,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var rm={enqueueSetState:function(e,n,i){e=e._reactInternals;var o=Fs(),d=Pi(o);d.payload=n,i!=null&&(d.callback=i),n=Ui(e,d,o),n!==null&&(ks(n,e,o),Nc(n,e,o))},enqueueReplaceState:function(e,n,i){e=e._reactInternals;var o=Fs(),d=Pi(o);d.tag=1,d.payload=n,i!=null&&(d.callback=i),n=Ui(e,d,o),n!==null&&(ks(n,e,o),Nc(n,e,o))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var i=Fs(),o=Pi(i);o.tag=2,n!=null&&(o.callback=n),n=Ui(e,o,i),n!==null&&(ks(n,e,i),Nc(n,e,i))}};function fv(e,n,i,o,d,f,v){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(o,f,v):n.prototype&&n.prototype.isPureReactComponent?!qr(i,o)||!qr(d,f):!0}function hv(e,n,i,o){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(i,o),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(i,o),n.state!==e&&rm.enqueueReplaceState(n,n.state,null)}function el(e,n){var i=n;if("ref"in n){i={};for(var o in n)o!=="ref"&&(i[o]=n[o])}if(e=e.defaultProps){i===n&&(i=g({},i));for(var d in e)i[d]===void 0&&(i[d]=e[d])}return i}function mv(e){Ql(e)}function pv(e){console.error(e)}function gv(e){Ql(e)}function Md(e,n){try{var i=e.onUncaughtError;i(n.value,{componentStack:n.stack})}catch(o){setTimeout(function(){throw o})}}function yv(e,n,i){try{var o=e.onCaughtError;o(i.value,{componentStack:i.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(d){setTimeout(function(){throw d})}}function lm(e,n,i){return i=Pi(i),i.tag=3,i.payload={element:null},i.callback=function(){Md(e,n)},i}function vv(e){return e=Pi(e),e.tag=3,e}function _v(e,n,i,o){var d=i.type.getDerivedStateFromError;if(typeof d=="function"){var f=o.value;e.payload=function(){return d(f)},e.callback=function(){yv(n,i,o)}}var v=i.stateNode;v!==null&&typeof v.componentDidCatch=="function"&&(e.callback=function(){yv(n,i,o),typeof d!="function"&&(Gi===null?Gi=new Set([this]):Gi.add(this));var w=o.stack;this.componentDidCatch(o.value,{componentStack:w!==null?w:""})})}function Z1(e,n,i,o,d){if(i.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(n=i.alternate,n!==null&&Jl(n,i,d,!0),i=Us.current,i!==null){switch(i.tag){case 31:case 13:return Js===null?$d():i.alternate===null&&_n===0&&(_n=3),i.flags&=-257,i.flags|=65536,i.lanes=d,o===yd?i.flags|=16384:(n=i.updateQueue,n===null?i.updateQueue=new Set([o]):n.add(o),Am(e,o,d)),!1;case 22:return i.flags|=65536,o===yd?i.flags|=16384:(n=i.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([o])},i.updateQueue=n):(i=n.retryQueue,i===null?n.retryQueue=new Set([o]):i.add(o)),Am(e,o,d)),!1}throw Error(r(435,i.tag))}return Am(e,o,d),$d(),!1}if(jt)return n=Us.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=d,o!==Xl&&(e=Error(r(422),{cause:o}),os(D(e,i)))):(o!==Xl&&(n=Error(r(423),{cause:o}),os(D(n,i))),e=e.current.alternate,e.flags|=65536,d&=-d,e.lanes|=d,o=D(o,i),d=lm(e.stateNode,o,d),zh(e,d),_n!==4&&(_n=2)),!1;var f=Error(r(520),{cause:o});if(f=D(f,i),Uc===null?Uc=[f]:Uc.push(f),_n!==4&&(_n=2),n===null)return!0;o=D(o,i),i=n;do{switch(i.tag){case 3:return i.flags|=65536,e=d&-d,i.lanes|=e,e=lm(i.stateNode,o,e),zh(i,e),!1;case 1:if(n=i.type,f=i.stateNode,(i.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||f!==null&&typeof f.componentDidCatch=="function"&&(Gi===null||!Gi.has(f))))return i.flags|=65536,d&=-d,i.lanes|=d,d=vv(d),_v(d,e,i,o),zh(i,d),!1}i=i.return}while(i!==null);return!1}var om=Error(r(461)),Rn=!1;function Yn(e,n,i,o){n.child=e===null?jy(n,null,i,o):Xr(n,e.child,i,o)}function bv(e,n,i,o,d){i=i.render;var f=n.ref;if("ref"in o){var v={};for(var w in o)w!=="ref"&&(v[w]=o[w])}else v=o;return Kr(n),o=Hh(e,n,i,v,f,d),w=Fh(),e!==null&&!Rn?(Qh(e,n,d),si(e,n,d)):(jt&&w&&Zl(n),n.flags|=1,Yn(e,n,o,d),n.child)}function xv(e,n,i,o,d){if(e===null){var f=i.type;return typeof f=="function"&&!Vl(f)&&f.defaultProps===void 0&&i.compare===null?(n.tag=15,n.type=f,Sv(e,n,f,o,d)):(e=Gr(i.type,null,o,n,n.mode,d),e.ref=n.ref,e.return=n,n.child=e)}if(f=e.child,!gm(e,d)){var v=f.memoizedProps;if(i=i.compare,i=i!==null?i:qr,i(v,o)&&e.ref===n.ref)return si(e,n,d)}return n.flags|=1,e=Ws(f,o),e.ref=n.ref,e.return=n,n.child=e}function Sv(e,n,i,o,d){if(e!==null){var f=e.memoizedProps;if(qr(f,o)&&e.ref===n.ref)if(Rn=!1,n.pendingProps=o=f,gm(e,d))(e.flags&131072)!==0&&(Rn=!0);else return n.lanes=e.lanes,si(e,n,d)}return cm(e,n,i,o,d)}function jv(e,n,i,o){var d=o.children,f=e!==null?e.memoizedState:null;if(e===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((n.flags&128)!==0){if(f=f!==null?f.baseLanes|i:i,e!==null){for(o=n.child=e.child,d=0;o!==null;)d=d|o.lanes|o.childLanes,o=o.sibling;o=d&~f}else o=0,n.child=null;return wv(e,n,f,i,o)}if((i&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&pd(n,f!==null?f.cachePool:null),f!==null?Ny(n,f):Ph(),Cy(n);else return o=n.lanes=536870912,wv(e,n,f!==null?f.baseLanes|i:i,i,o)}else f!==null?(pd(n,f.cachePool),Ny(n,f),$i(),n.memoizedState=null):(e!==null&&pd(n,null),Ph(),$i());return Yn(e,n,d,i),n.child}function Dc(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function wv(e,n,i,o,d){var f=Dh();return f=f===null?null:{parent:En._currentValue,pool:f},n.memoizedState={baseLanes:i,cachePool:f},e!==null&&pd(n,null),Ph(),Cy(n),e!==null&&Jl(e,n,o,!0),n.childLanes=d,null}function Rd(e,n){return n=Dd({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function kv(e,n,i){return Xr(n,e.child,null,i),e=Rd(n,n.pendingProps),e.flags|=2,qs(n),n.memoizedState=null,e}function W1(e,n,i){var o=n.pendingProps,d=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(jt){if(o.mode==="hidden")return e=Rd(n,o),n.lanes=536870912,Dc(null,e);if(qh(n),(e=Wt)?(e=z_(e,ls),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:Hn!==null?{id:Bs,overflow:Ps}:null,retryLane:536870912,hydrationErrors:null},i=_c(e),i.return=n,n.child=i,Tn=n,Wt=null)):e=null,e===null)throw ma(n);return n.lanes=536870912,null}return Rd(n,o)}var f=e.memoizedState;if(f!==null){var v=f.dehydrated;if(qh(n),d)if(n.flags&256)n.flags&=-257,n=kv(e,n,i);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(r(558));else if(Rn||Jl(e,n,i,!1),d=(i&e.childLanes)!==0,Rn||d){if(o=an,o!==null&&(v=is(o,i),v!==0&&v!==f.retryLane))throw f.retryLane=v,Oa(e,v),ks(o,e,v),om;$d(),n=kv(e,n,i)}else e=f.treeContext,Wt=ea(v.nextSibling),Tn=n,jt=!0,ha=null,ls=!1,e!==null&&xc(n,e),n=Rd(n,o),n.flags|=4096;return n}return e=Ws(e.child,{mode:o.mode,children:o.children}),e.ref=n.ref,n.child=e,e.return=n,e}function Ad(e,n){var i=n.ref;if(i===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(r(284));(e===null||e.ref!==i)&&(n.flags|=4194816)}}function cm(e,n,i,o,d){return Kr(n),i=Hh(e,n,i,o,void 0,d),o=Fh(),e!==null&&!Rn?(Qh(e,n,d),si(e,n,d)):(jt&&o&&Zl(n),n.flags|=1,Yn(e,n,i,d),n.child)}function Nv(e,n,i,o,d,f){return Kr(n),n.updateQueue=null,i=Ey(n,o,i,d),Ty(e),o=Fh(),e!==null&&!Rn?(Qh(e,n,f),si(e,n,f)):(jt&&o&&Zl(n),n.flags|=1,Yn(e,n,i,f),n.child)}function Cv(e,n,i,o,d){if(Kr(n),n.stateNode===null){var f=Xa,v=i.contextType;typeof v=="object"&&v!==null&&(f=Kn(v)),f=new i(o,f),n.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,f.updater=rm,n.stateNode=f,f._reactInternals=n,f=n.stateNode,f.props=o,f.state=n.memoizedState,f.refs={},Lh(n),v=i.contextType,f.context=typeof v=="object"&&v!==null?Kn(v):Xa,f.state=n.memoizedState,v=i.getDerivedStateFromProps,typeof v=="function"&&(im(n,i,v,o),f.state=n.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(v=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),v!==f.state&&rm.enqueueReplaceState(f,f.state,null),Tc(n,o,f,d),Cc(),f.state=n.memoizedState),typeof f.componentDidMount=="function"&&(n.flags|=4194308),o=!0}else if(e===null){f=n.stateNode;var w=n.memoizedProps,O=el(i,w);f.props=O;var J=f.context,fe=i.contextType;v=Xa,typeof fe=="object"&&fe!==null&&(v=Kn(fe));var ve=i.getDerivedStateFromProps;fe=typeof ve=="function"||typeof f.getSnapshotBeforeUpdate=="function",w=n.pendingProps!==w,fe||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(w||J!==v)&&hv(n,f,o,v),Bi=!1;var se=n.memoizedState;f.state=se,Tc(n,o,f,d),Cc(),J=n.memoizedState,w||se!==J||Bi?(typeof ve=="function"&&(im(n,i,ve,o),J=n.memoizedState),(O=Bi||fv(n,i,O,o,se,J,v))?(fe||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount()),typeof f.componentDidMount=="function"&&(n.flags|=4194308)):(typeof f.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=o,n.memoizedState=J),f.props=o,f.state=J,f.context=v,o=O):(typeof f.componentDidMount=="function"&&(n.flags|=4194308),o=!1)}else{f=n.stateNode,Ih(e,n),v=n.memoizedProps,fe=el(i,v),f.props=fe,ve=n.pendingProps,se=f.context,J=i.contextType,O=Xa,typeof J=="object"&&J!==null&&(O=Kn(J)),w=i.getDerivedStateFromProps,(J=typeof w=="function"||typeof f.getSnapshotBeforeUpdate=="function")||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(v!==ve||se!==O)&&hv(n,f,o,O),Bi=!1,se=n.memoizedState,f.state=se,Tc(n,o,f,d),Cc();var re=n.memoizedState;v!==ve||se!==re||Bi||e!==null&&e.dependencies!==null&&hd(e.dependencies)?(typeof w=="function"&&(im(n,i,w,o),re=n.memoizedState),(fe=Bi||fv(n,i,fe,o,se,re,O)||e!==null&&e.dependencies!==null&&hd(e.dependencies))?(J||typeof f.UNSAFE_componentWillUpdate!="function"&&typeof f.componentWillUpdate!="function"||(typeof f.componentWillUpdate=="function"&&f.componentWillUpdate(o,re,O),typeof f.UNSAFE_componentWillUpdate=="function"&&f.UNSAFE_componentWillUpdate(o,re,O)),typeof f.componentDidUpdate=="function"&&(n.flags|=4),typeof f.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof f.componentDidUpdate!="function"||v===e.memoizedProps&&se===e.memoizedState||(n.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||v===e.memoizedProps&&se===e.memoizedState||(n.flags|=1024),n.memoizedProps=o,n.memoizedState=re),f.props=o,f.state=re,f.context=O,o=fe):(typeof f.componentDidUpdate!="function"||v===e.memoizedProps&&se===e.memoizedState||(n.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||v===e.memoizedProps&&se===e.memoizedState||(n.flags|=1024),o=!1)}return f=o,Ad(e,n),o=(n.flags&128)!==0,f||o?(f=n.stateNode,i=o&&typeof i.getDerivedStateFromError!="function"?null:f.render(),n.flags|=1,e!==null&&o?(n.child=Xr(n,e.child,null,d),n.child=Xr(n,null,i,d)):Yn(e,n,i,d),n.memoizedState=f.state,e=n.child):e=si(e,n,d),e}function Tv(e,n,i,o){return Ot(),n.flags|=256,Yn(e,n,i,o),n.child}var um={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function dm(e){return{baseLanes:e,cachePool:yy()}}function fm(e,n,i){return e=e!==null?e.childLanes&~i:0,n&&(e|=Hs),e}function Ev(e,n,i){var o=n.pendingProps,d=!1,f=(n.flags&128)!==0,v;if((v=f)||(v=e!==null&&e.memoizedState===null?!1:(Sn.current&2)!==0),v&&(d=!0,n.flags&=-129),v=(n.flags&32)!==0,n.flags&=-33,e===null){if(jt){if(d?qi(n):$i(),(e=Wt)?(e=z_(e,ls),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:Hn!==null?{id:Bs,overflow:Ps}:null,retryLane:536870912,hydrationErrors:null},i=_c(e),i.return=n,n.child=i,Tn=n,Wt=null)):e=null,e===null)throw ma(n);return Km(e)?n.lanes=32:n.lanes=536870912,null}var w=o.children;return o=o.fallback,d?($i(),d=n.mode,w=Dd({mode:"hidden",children:w},d),o=La(o,d,i,null),w.return=n,o.return=n,w.sibling=o,n.child=w,o=n.child,o.memoizedState=dm(i),o.childLanes=fm(e,v,i),n.memoizedState=um,Dc(null,o)):(qi(n),hm(n,w))}var O=e.memoizedState;if(O!==null&&(w=O.dehydrated,w!==null)){if(f)n.flags&256?(qi(n),n.flags&=-257,n=mm(e,n,i)):n.memoizedState!==null?($i(),n.child=e.child,n.flags|=128,n=null):($i(),w=o.fallback,d=n.mode,o=Dd({mode:"visible",children:o.children},d),w=La(w,d,i,null),w.flags|=2,o.return=n,w.return=n,o.sibling=w,n.child=o,Xr(n,e.child,null,i),o=n.child,o.memoizedState=dm(i),o.childLanes=fm(e,v,i),n.memoizedState=um,n=Dc(null,o));else if(qi(n),Km(w)){if(v=w.nextSibling&&w.nextSibling.dataset,v)var J=v.dgst;v=J,o=Error(r(419)),o.stack="",o.digest=v,os({value:o,source:null,stack:null}),n=mm(e,n,i)}else if(Rn||Jl(e,n,i,!1),v=(i&e.childLanes)!==0,Rn||v){if(v=an,v!==null&&(o=is(v,i),o!==0&&o!==O.retryLane))throw O.retryLane=o,Oa(e,o),ks(v,e,o),om;Vm(w)||$d(),n=mm(e,n,i)}else Vm(w)?(n.flags|=192,n.child=e.child,n=null):(e=O.treeContext,Wt=ea(w.nextSibling),Tn=n,jt=!0,ha=null,ls=!1,e!==null&&xc(n,e),n=hm(n,o.children),n.flags|=4096);return n}return d?($i(),w=o.fallback,d=n.mode,O=e.child,J=O.sibling,o=Ws(O,{mode:"hidden",children:o.children}),o.subtreeFlags=O.subtreeFlags&65011712,J!==null?w=Ws(J,w):(w=La(w,d,i,null),w.flags|=2),w.return=n,o.return=n,o.sibling=w,n.child=o,Dc(null,o),o=n.child,w=e.child.memoizedState,w===null?w=dm(i):(d=w.cachePool,d!==null?(O=En._currentValue,d=d.parent!==O?{parent:O,pool:O}:d):d=yy(),w={baseLanes:w.baseLanes|i,cachePool:d}),o.memoizedState=w,o.childLanes=fm(e,v,i),n.memoizedState=um,Dc(e.child,o)):(qi(n),i=e.child,e=i.sibling,i=Ws(i,{mode:"visible",children:o.children}),i.return=n,i.sibling=null,e!==null&&(v=n.deletions,v===null?(n.deletions=[e],n.flags|=16):v.push(e)),n.child=i,n.memoizedState=null,i)}function hm(e,n){return n=Dd({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function Dd(e,n){return e=ts(22,e,null,n),e.lanes=0,e}function mm(e,n,i){return Xr(n,e.child,null,i),e=hm(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function Mv(e,n,i){e.lanes|=n;var o=e.alternate;o!==null&&(o.lanes|=n),Eh(e.return,n,i)}function pm(e,n,i,o,d,f){var v=e.memoizedState;v===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:o,tail:i,tailMode:d,treeForkCount:f}:(v.isBackwards=n,v.rendering=null,v.renderingStartTime=0,v.last=o,v.tail=i,v.tailMode=d,v.treeForkCount=f)}function Rv(e,n,i){var o=n.pendingProps,d=o.revealOrder,f=o.tail;o=o.children;var v=Sn.current,w=(v&2)!==0;if(w?(v=v&1|2,n.flags|=128):v&=1,be(Sn,v),Yn(e,n,o,i),o=jt?Ye:0,!w&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Mv(e,i,n);else if(e.tag===19)Mv(e,i,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(d){case"forwards":for(i=n.child,d=null;i!==null;)e=i.alternate,e!==null&&xd(e)===null&&(d=i),i=i.sibling;i=d,i===null?(d=n.child,n.child=null):(d=i.sibling,i.sibling=null),pm(n,!1,d,i,f,o);break;case"backwards":case"unstable_legacy-backwards":for(i=null,d=n.child,n.child=null;d!==null;){if(e=d.alternate,e!==null&&xd(e)===null){n.child=d;break}e=d.sibling,d.sibling=i,i=d,d=e}pm(n,!0,i,null,f,o);break;case"together":pm(n,!1,null,null,void 0,o);break;default:n.memoizedState=null}return n.child}function si(e,n,i){if(e!==null&&(n.dependencies=e.dependencies),Qi|=n.lanes,(i&n.childLanes)===0)if(e!==null){if(Jl(e,n,i,!1),(i&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(r(153));if(n.child!==null){for(e=n.child,i=Ws(e,e.pendingProps),n.child=i,i.return=n;e.sibling!==null;)e=e.sibling,i=i.sibling=Ws(e,e.pendingProps),i.return=n;i.sibling=null}return n.child}function gm(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&hd(e)))}function X1(e,n,i){switch(n.tag){case 3:he(n,n.stateNode.containerInfo),zi(n,En,e.memoizedState.cache),Ot();break;case 27:case 5:Se(n);break;case 4:he(n,n.stateNode.containerInfo);break;case 10:zi(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,qh(n),null;break;case 13:var o=n.memoizedState;if(o!==null)return o.dehydrated!==null?(qi(n),n.flags|=128,null):(i&n.child.childLanes)!==0?Ev(e,n,i):(qi(n),e=si(e,n,i),e!==null?e.sibling:null);qi(n);break;case 19:var d=(e.flags&128)!==0;if(o=(i&n.childLanes)!==0,o||(Jl(e,n,i,!1),o=(i&n.childLanes)!==0),d){if(o)return Rv(e,n,i);n.flags|=128}if(d=n.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),be(Sn,Sn.current),o)break;return null;case 22:return n.lanes=0,jv(e,n,i,n.pendingProps);case 24:zi(n,En,e.memoizedState.cache)}return si(e,n,i)}function Av(e,n,i){if(e!==null)if(e.memoizedProps!==n.pendingProps)Rn=!0;else{if(!gm(e,i)&&(n.flags&128)===0)return Rn=!1,X1(e,n,i);Rn=(e.flags&131072)!==0}else Rn=!1,jt&&(n.flags&1048576)!==0&&bc(n,Ye,n.index);switch(n.lanes=0,n.tag){case 16:e:{var o=n.pendingProps;if(e=Zr(n.elementType),n.type=e,typeof e=="function")Vl(e)?(o=el(e,o),n.tag=1,n=Cv(null,n,e,o,i)):(n.tag=0,n=cm(null,n,e,o,i));else{if(e!=null){var d=e.$$typeof;if(d===R){n.tag=11,n=bv(null,n,e,o,i);break e}else if(d===Z){n.tag=14,n=xv(null,n,e,o,i);break e}}throw n=ae(e)||e,Error(r(306,n,""))}}return n;case 0:return cm(e,n,n.type,n.pendingProps,i);case 1:return o=n.type,d=el(o,n.pendingProps),Cv(e,n,o,d,i);case 3:e:{if(he(n,n.stateNode.containerInfo),e===null)throw Error(r(387));o=n.pendingProps;var f=n.memoizedState;d=f.element,Ih(e,n),Tc(n,o,null,i);var v=n.memoizedState;if(o=v.cache,zi(n,En,o),o!==f.cache&&Mh(n,[En],i,!0),Cc(),o=v.element,f.isDehydrated)if(f={element:o,isDehydrated:!1,cache:v.cache},n.updateQueue.baseState=f,n.memoizedState=f,n.flags&256){n=Tv(e,n,o,i);break e}else if(o!==d){d=D(Error(r(424)),n),os(d),n=Tv(e,n,o,i);break e}else{switch(e=n.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Wt=ea(e.firstChild),Tn=n,jt=!0,ha=null,ls=!0,i=jy(n,null,o,i),n.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(Ot(),o===d){n=si(e,n,i);break e}Yn(e,n,o,i)}n=n.child}return n;case 26:return Ad(e,n),e===null?(i=H_(n.type,null,n.pendingProps,null))?n.memoizedState=i:jt||(i=n.type,e=n.pendingProps,o=Yd(Ce.current).createElement(i),o[ge]=n,o[we]=e,Zn(o,i,e),B(o),n.stateNode=o):n.memoizedState=H_(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return Se(n),e===null&&jt&&(o=n.stateNode=U_(n.type,n.pendingProps,Ce.current),Tn=n,ls=!0,d=Wt,Zi(n.type)?(Ym=d,Wt=ea(o.firstChild)):Wt=d),Yn(e,n,n.pendingProps.children,i),Ad(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&jt&&((d=o=Wt)&&(o=Tj(o,n.type,n.pendingProps,ls),o!==null?(n.stateNode=o,Tn=n,Wt=ea(o.firstChild),ls=!1,d=!0):d=!1),d||ma(n)),Se(n),d=n.type,f=n.pendingProps,v=e!==null?e.memoizedProps:null,o=f.children,Fm(d,f)?o=null:v!==null&&Fm(d,v)&&(n.flags|=32),n.memoizedState!==null&&(d=Hh(e,n,H1,null,null,i),Kc._currentValue=d),Ad(e,n),Yn(e,n,o,i),n.child;case 6:return e===null&&jt&&((e=i=Wt)&&(i=Ej(i,n.pendingProps,ls),i!==null?(n.stateNode=i,Tn=n,Wt=null,e=!0):e=!1),e||ma(n)),null;case 13:return Ev(e,n,i);case 4:return he(n,n.stateNode.containerInfo),o=n.pendingProps,e===null?n.child=Xr(n,null,o,i):Yn(e,n,o,i),n.child;case 11:return bv(e,n,n.type,n.pendingProps,i);case 7:return Yn(e,n,n.pendingProps,i),n.child;case 8:return Yn(e,n,n.pendingProps.children,i),n.child;case 12:return Yn(e,n,n.pendingProps.children,i),n.child;case 10:return o=n.pendingProps,zi(n,n.type,o.value),Yn(e,n,o.children,i),n.child;case 9:return d=n.type._context,o=n.pendingProps.children,Kr(n),d=Kn(d),o=o(d),n.flags|=1,Yn(e,n,o,i),n.child;case 14:return xv(e,n,n.type,n.pendingProps,i);case 15:return Sv(e,n,n.type,n.pendingProps,i);case 19:return Rv(e,n,i);case 31:return W1(e,n,i);case 22:return jv(e,n,i,n.pendingProps);case 24:return Kr(n),o=Kn(En),e===null?(d=Dh(),d===null&&(d=an,f=Rh(),d.pooledCache=f,f.refCount++,f!==null&&(d.pooledCacheLanes|=i),d=f),n.memoizedState={parent:o,cache:d},Lh(n),zi(n,En,d)):((e.lanes&i)!==0&&(Ih(e,n),Tc(n,null,null,i),Cc()),d=e.memoizedState,f=n.memoizedState,d.parent!==o?(d={parent:o,cache:o},n.memoizedState=d,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=d),zi(n,En,o)):(o=f.cache,zi(n,En,o),o!==d.cache&&Mh(n,[En],i,!0))),Yn(e,n,n.pendingProps.children,i),n.child;case 29:throw n.pendingProps}throw Error(r(156,n.tag))}function ai(e){e.flags|=4}function ym(e,n,i,o,d){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(d&335544128)===d)if(e.stateNode.complete)e.flags|=8192;else if(i_())e.flags|=8192;else throw Wr=yd,Oh}else e.flags&=-16777217}function Dv(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!K_(n))if(i_())e.flags|=8192;else throw Wr=yd,Oh}function Od(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?ps():536870912,e.lanes|=n,fo|=n)}function Oc(e,n){if(!jt)switch(e.tailMode){case"hidden":n=e.tail;for(var i=null;n!==null;)n.alternate!==null&&(i=n),n=n.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var o=null;i!==null;)i.alternate!==null&&(o=i),i=i.sibling;o===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:o.sibling=null}}function cn(e){var n=e.alternate!==null&&e.alternate.child===e.child,i=0,o=0;if(n)for(var d=e.child;d!==null;)i|=d.lanes|d.childLanes,o|=d.subtreeFlags&65011712,o|=d.flags&65011712,d.return=e,d=d.sibling;else for(d=e.child;d!==null;)i|=d.lanes|d.childLanes,o|=d.subtreeFlags,o|=d.flags,d.return=e,d=d.sibling;return e.subtreeFlags|=o,e.childLanes=i,n}function J1(e,n,i){var o=n.pendingProps;switch(Wl(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return cn(n),null;case 1:return cn(n),null;case 3:return i=n.stateNode,o=null,e!==null&&(o=e.memoizedState.cache),n.memoizedState.cache!==o&&(n.flags|=2048),ei(En),q(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(wt(n)?ai(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Gt())),cn(n),null;case 26:var d=n.type,f=n.memoizedState;return e===null?(ai(n),f!==null?(cn(n),Dv(n,f)):(cn(n),ym(n,d,null,o,i))):f?f!==e.memoizedState?(ai(n),cn(n),Dv(n,f)):(cn(n),n.flags&=-16777217):(e=e.memoizedProps,e!==o&&ai(n),cn(n),ym(n,d,e,o,i)),null;case 27:if(Ne(n),i=Ce.current,d=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==o&&ai(n);else{if(!o){if(n.stateNode===null)throw Error(r(166));return cn(n),null}e=Q.current,wt(n)?it(n):(e=U_(d,o,i),n.stateNode=e,ai(n))}return cn(n),null;case 5:if(Ne(n),d=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==o&&ai(n);else{if(!o){if(n.stateNode===null)throw Error(r(166));return cn(n),null}if(f=Q.current,wt(n))it(n);else{var v=Yd(Ce.current);switch(f){case 1:f=v.createElementNS("http://www.w3.org/2000/svg",d);break;case 2:f=v.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;default:switch(d){case"svg":f=v.createElementNS("http://www.w3.org/2000/svg",d);break;case"math":f=v.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;case"script":f=v.createElement("div"),f.innerHTML="<script><\/script>",f=f.removeChild(f.firstChild);break;case"select":f=typeof o.is=="string"?v.createElement("select",{is:o.is}):v.createElement("select"),o.multiple?f.multiple=!0:o.size&&(f.size=o.size);break;default:f=typeof o.is=="string"?v.createElement(d,{is:o.is}):v.createElement(d)}}f[ge]=n,f[we]=o;e:for(v=n.child;v!==null;){if(v.tag===5||v.tag===6)f.appendChild(v.stateNode);else if(v.tag!==4&&v.tag!==27&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===n)break e;for(;v.sibling===null;){if(v.return===null||v.return===n)break e;v=v.return}v.sibling.return=v.return,v=v.sibling}n.stateNode=f;e:switch(Zn(f,d,o),d){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&ai(n)}}return cn(n),ym(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,i),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==o&&ai(n);else{if(typeof o!="string"&&n.stateNode===null)throw Error(r(166));if(e=Ce.current,wt(n)){if(e=n.stateNode,i=n.memoizedProps,o=null,d=Tn,d!==null)switch(d.tag){case 27:case 5:o=d.memoizedProps}e[ge]=n,e=!!(e.nodeValue===i||o!==null&&o.suppressHydrationWarning===!0||E_(e.nodeValue,i)),e||ma(n,!0)}else e=Yd(e).createTextNode(o),e[ge]=n,n.stateNode=e}return cn(n),null;case 31:if(i=n.memoizedState,e===null||e.memoizedState!==null){if(o=wt(n),i!==null){if(e===null){if(!o)throw Error(r(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(557));e[ge]=n}else Ot(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;cn(n),e=!1}else i=Gt(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),e=!0;if(!e)return n.flags&256?(qs(n),n):(qs(n),null);if((n.flags&128)!==0)throw Error(r(558))}return cn(n),null;case 13:if(o=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(d=wt(n),o!==null&&o.dehydrated!==null){if(e===null){if(!d)throw Error(r(318));if(d=n.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(r(317));d[ge]=n}else Ot(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;cn(n),d=!1}else d=Gt(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=d),d=!0;if(!d)return n.flags&256?(qs(n),n):(qs(n),null)}return qs(n),(n.flags&128)!==0?(n.lanes=i,n):(i=o!==null,e=e!==null&&e.memoizedState!==null,i&&(o=n.child,d=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(d=o.alternate.memoizedState.cachePool.pool),f=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(f=o.memoizedState.cachePool.pool),f!==d&&(o.flags|=2048)),i!==e&&i&&(n.child.flags|=8192),Od(n,n.updateQueue),cn(n),null);case 4:return q(),e===null&&Pm(n.stateNode.containerInfo),cn(n),null;case 10:return ei(n.type),cn(n),null;case 19:if(ne(Sn),o=n.memoizedState,o===null)return cn(n),null;if(d=(n.flags&128)!==0,f=o.rendering,f===null)if(d)Oc(o,!1);else{if(_n!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(f=xd(e),f!==null){for(n.flags|=128,Oc(o,!1),e=f.updateQueue,n.updateQueue=e,Od(n,e),n.subtreeFlags=0,e=i,i=n.child;i!==null;)vc(i,e),i=i.sibling;return be(Sn,Sn.current&1|2),jt&&Xs(n,o.treeForkCount),n.child}e=e.sibling}o.tail!==null&&Re()>Pd&&(n.flags|=128,d=!0,Oc(o,!1),n.lanes=4194304)}else{if(!d)if(e=xd(f),e!==null){if(n.flags|=128,d=!0,e=e.updateQueue,n.updateQueue=e,Od(n,e),Oc(o,!0),o.tail===null&&o.tailMode==="hidden"&&!f.alternate&&!jt)return cn(n),null}else 2*Re()-o.renderingStartTime>Pd&&i!==536870912&&(n.flags|=128,d=!0,Oc(o,!1),n.lanes=4194304);o.isBackwards?(f.sibling=n.child,n.child=f):(e=o.last,e!==null?e.sibling=f:n.child=f,o.last=f)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=Re(),e.sibling=null,i=Sn.current,be(Sn,d?i&1|2:i&1),jt&&Xs(n,o.treeForkCount),e):(cn(n),null);case 22:case 23:return qs(n),Uh(),o=n.memoizedState!==null,e!==null?e.memoizedState!==null!==o&&(n.flags|=8192):o&&(n.flags|=8192),o?(i&536870912)!==0&&(n.flags&128)===0&&(cn(n),n.subtreeFlags&6&&(n.flags|=8192)):cn(n),i=n.updateQueue,i!==null&&Od(n,i.retryQueue),i=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),o=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),o!==i&&(n.flags|=2048),e!==null&&ne(Yr),null;case 24:return i=null,e!==null&&(i=e.memoizedState.cache),n.memoizedState.cache!==i&&(n.flags|=2048),ei(En),cn(n),null;case 25:return null;case 30:return null}throw Error(r(156,n.tag))}function ej(e,n){switch(Wl(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return ei(En),q(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return Ne(n),null;case 31:if(n.memoizedState!==null){if(qs(n),n.alternate===null)throw Error(r(340));Ot()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(qs(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(r(340));Ot()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return ne(Sn),null;case 4:return q(),null;case 10:return ei(n.type),null;case 22:case 23:return qs(n),Uh(),e!==null&&ne(Yr),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return ei(En),null;case 25:return null;default:return null}}function Ov(e,n){switch(Wl(n),n.tag){case 3:ei(En),q();break;case 26:case 27:case 5:Ne(n);break;case 4:q();break;case 31:n.memoizedState!==null&&qs(n);break;case 13:qs(n);break;case 19:ne(Sn);break;case 10:ei(n.type);break;case 22:case 23:qs(n),Uh(),e!==null&&ne(Yr);break;case 24:ei(En)}}function Lc(e,n){try{var i=n.updateQueue,o=i!==null?i.lastEffect:null;if(o!==null){var d=o.next;i=d;do{if((i.tag&e)===e){o=void 0;var f=i.create,v=i.inst;o=f(),v.destroy=o}i=i.next}while(i!==d)}}catch(w){Kt(n,n.return,w)}}function Hi(e,n,i){try{var o=n.updateQueue,d=o!==null?o.lastEffect:null;if(d!==null){var f=d.next;o=f;do{if((o.tag&e)===e){var v=o.inst,w=v.destroy;if(w!==void 0){v.destroy=void 0,d=n;var O=i,J=w;try{J()}catch(fe){Kt(d,O,fe)}}}o=o.next}while(o!==f)}}catch(fe){Kt(n,n.return,fe)}}function Lv(e){var n=e.updateQueue;if(n!==null){var i=e.stateNode;try{ky(n,i)}catch(o){Kt(e,e.return,o)}}}function Iv(e,n,i){i.props=el(e.type,e.memoizedProps),i.state=e.memoizedState;try{i.componentWillUnmount()}catch(o){Kt(e,n,o)}}function Ic(e,n){try{var i=e.ref;if(i!==null){switch(e.tag){case 26:case 27:case 5:var o=e.stateNode;break;case 30:o=e.stateNode;break;default:o=e.stateNode}typeof i=="function"?e.refCleanup=i(o):i.current=o}}catch(d){Kt(e,n,d)}}function Ia(e,n){var i=e.ref,o=e.refCleanup;if(i!==null)if(typeof o=="function")try{o()}catch(d){Kt(e,n,d)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(d){Kt(e,n,d)}else i.current=null}function zv(e){var n=e.type,i=e.memoizedProps,o=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":i.autoFocus&&o.focus();break e;case"img":i.src?o.src=i.src:i.srcSet&&(o.srcset=i.srcSet)}}catch(d){Kt(e,e.return,d)}}function vm(e,n,i){try{var o=e.stateNode;Sj(o,e.type,i,n),o[we]=n}catch(d){Kt(e,e.return,d)}}function Bv(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Zi(e.type)||e.tag===4}function _m(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Bv(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Zi(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function bm(e,n,i){var o=e.tag;if(o===5||o===6)e=e.stateNode,n?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(e,n):(n=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,n.appendChild(e),i=i._reactRootContainer,i!=null||n.onclick!==null||(n.onclick=Ks));else if(o!==4&&(o===27&&Zi(e.type)&&(i=e.stateNode,n=null),e=e.child,e!==null))for(bm(e,n,i),e=e.sibling;e!==null;)bm(e,n,i),e=e.sibling}function Ld(e,n,i){var o=e.tag;if(o===5||o===6)e=e.stateNode,n?i.insertBefore(e,n):i.appendChild(e);else if(o!==4&&(o===27&&Zi(e.type)&&(i=e.stateNode),e=e.child,e!==null))for(Ld(e,n,i),e=e.sibling;e!==null;)Ld(e,n,i),e=e.sibling}function Pv(e){var n=e.stateNode,i=e.memoizedProps;try{for(var o=e.type,d=n.attributes;d.length;)n.removeAttributeNode(d[0]);Zn(n,o,i),n[ge]=e,n[we]=i}catch(f){Kt(e,e.return,f)}}var ii=!1,An=!1,xm=!1,Uv=typeof WeakSet=="function"?WeakSet:Set,Fn=null;function tj(e,n){if(e=e.containerInfo,$m=nf,e=od(e),cc(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var o=i.getSelection&&i.getSelection();if(o&&o.rangeCount!==0){i=o.anchorNode;var d=o.anchorOffset,f=o.focusNode;o=o.focusOffset;try{i.nodeType,f.nodeType}catch{i=null;break e}var v=0,w=-1,O=-1,J=0,fe=0,ve=e,se=null;t:for(;;){for(var re;ve!==i||d!==0&&ve.nodeType!==3||(w=v+d),ve!==f||o!==0&&ve.nodeType!==3||(O=v+o),ve.nodeType===3&&(v+=ve.nodeValue.length),(re=ve.firstChild)!==null;)se=ve,ve=re;for(;;){if(ve===e)break t;if(se===i&&++J===d&&(w=v),se===f&&++fe===o&&(O=v),(re=ve.nextSibling)!==null)break;ve=se,se=ve.parentNode}ve=re}i=w===-1||O===-1?null:{start:w,end:O}}else i=null}i=i||{start:0,end:0}}else i=null;for(Hm={focusedElem:e,selectionRange:i},nf=!1,Fn=n;Fn!==null;)if(n=Fn,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,Fn=e;else for(;Fn!==null;){switch(n=Fn,f=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(i=0;i<e.length;i++)d=e[i],d.ref.impl=d.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&f!==null){e=void 0,i=n,d=f.memoizedProps,f=f.memoizedState,o=i.stateNode;try{var Fe=el(i.type,d);e=o.getSnapshotBeforeUpdate(Fe,f),o.__reactInternalSnapshotBeforeUpdate=e}catch(lt){Kt(i,i.return,lt)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,i=e.nodeType,i===9)Gm(e);else if(i===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Gm(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(r(163))}if(e=n.sibling,e!==null){e.return=n.return,Fn=e;break}Fn=n.return}}function qv(e,n,i){var o=i.flags;switch(i.tag){case 0:case 11:case 15:li(e,i),o&4&&Lc(5,i);break;case 1:if(li(e,i),o&4)if(e=i.stateNode,n===null)try{e.componentDidMount()}catch(v){Kt(i,i.return,v)}else{var d=el(i.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(d,n,e.__reactInternalSnapshotBeforeUpdate)}catch(v){Kt(i,i.return,v)}}o&64&&Lv(i),o&512&&Ic(i,i.return);break;case 3:if(li(e,i),o&64&&(e=i.updateQueue,e!==null)){if(n=null,i.child!==null)switch(i.child.tag){case 27:case 5:n=i.child.stateNode;break;case 1:n=i.child.stateNode}try{ky(e,n)}catch(v){Kt(i,i.return,v)}}break;case 27:n===null&&o&4&&Pv(i);case 26:case 5:li(e,i),n===null&&o&4&&zv(i),o&512&&Ic(i,i.return);break;case 12:li(e,i);break;case 31:li(e,i),o&4&&Fv(e,i);break;case 13:li(e,i),o&4&&Qv(e,i),o&64&&(e=i.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(i=uj.bind(null,i),Mj(e,i))));break;case 22:if(o=i.memoizedState!==null||ii,!o){n=n!==null&&n.memoizedState!==null||An,d=ii;var f=An;ii=o,(An=n)&&!f?oi(e,i,(i.subtreeFlags&8772)!==0):li(e,i),ii=d,An=f}break;case 30:break;default:li(e,i)}}function $v(e){var n=e.alternate;n!==null&&(e.alternate=null,$v(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&Ht(n)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var hn=null,xs=!1;function ri(e,n,i){for(i=i.child;i!==null;)Hv(e,n,i),i=i.sibling}function Hv(e,n,i){if(oe&&typeof oe.onCommitFiberUnmount=="function")try{oe.onCommitFiberUnmount(ln,i)}catch{}switch(i.tag){case 26:An||Ia(i,n),ri(e,n,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:An||Ia(i,n);var o=hn,d=xs;Zi(i.type)&&(hn=i.stateNode,xs=!1),ri(e,n,i),Qc(i.stateNode),hn=o,xs=d;break;case 5:An||Ia(i,n);case 6:if(o=hn,d=xs,hn=null,ri(e,n,i),hn=o,xs=d,hn!==null)if(xs)try{(hn.nodeType===9?hn.body:hn.nodeName==="HTML"?hn.ownerDocument.body:hn).removeChild(i.stateNode)}catch(f){Kt(i,n,f)}else try{hn.removeChild(i.stateNode)}catch(f){Kt(i,n,f)}break;case 18:hn!==null&&(xs?(e=hn,L_(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,i.stateNode),bo(e)):L_(hn,i.stateNode));break;case 4:o=hn,d=xs,hn=i.stateNode.containerInfo,xs=!0,ri(e,n,i),hn=o,xs=d;break;case 0:case 11:case 14:case 15:Hi(2,i,n),An||Hi(4,i,n),ri(e,n,i);break;case 1:An||(Ia(i,n),o=i.stateNode,typeof o.componentWillUnmount=="function"&&Iv(i,n,o)),ri(e,n,i);break;case 21:ri(e,n,i);break;case 22:An=(o=An)||i.memoizedState!==null,ri(e,n,i),An=o;break;default:ri(e,n,i)}}function Fv(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{bo(e)}catch(i){Kt(n,n.return,i)}}}function Qv(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{bo(e)}catch(i){Kt(n,n.return,i)}}function nj(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new Uv),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new Uv),n;default:throw Error(r(435,e.tag))}}function Id(e,n){var i=nj(e);n.forEach(function(o){if(!i.has(o)){i.add(o);var d=dj.bind(null,e,o);o.then(d,d)}})}function Ss(e,n){var i=n.deletions;if(i!==null)for(var o=0;o<i.length;o++){var d=i[o],f=e,v=n,w=v;e:for(;w!==null;){switch(w.tag){case 27:if(Zi(w.type)){hn=w.stateNode,xs=!1;break e}break;case 5:hn=w.stateNode,xs=!1;break e;case 3:case 4:hn=w.stateNode.containerInfo,xs=!0;break e}w=w.return}if(hn===null)throw Error(r(160));Hv(f,v,d),hn=null,xs=!1,f=d.alternate,f!==null&&(f.return=null),d.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Gv(n,e),n=n.sibling}var ga=null;function Gv(e,n){var i=e.alternate,o=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ss(n,e),js(e),o&4&&(Hi(3,e,e.return),Lc(3,e),Hi(5,e,e.return));break;case 1:Ss(n,e),js(e),o&512&&(An||i===null||Ia(i,i.return)),o&64&&ii&&(e=e.updateQueue,e!==null&&(o=e.callbacks,o!==null&&(i=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=i===null?o:i.concat(o))));break;case 26:var d=ga;if(Ss(n,e),js(e),o&512&&(An||i===null||Ia(i,i.return)),o&4){var f=i!==null?i.memoizedState:null;if(o=e.memoizedState,i===null)if(o===null)if(e.stateNode===null){e:{o=e.type,i=e.memoizedProps,d=d.ownerDocument||d;t:switch(o){case"title":f=d.getElementsByTagName("title")[0],(!f||f[Jn]||f[ge]||f.namespaceURI==="http://www.w3.org/2000/svg"||f.hasAttribute("itemprop"))&&(f=d.createElement(o),d.head.insertBefore(f,d.querySelector("head > title"))),Zn(f,o,i),f[ge]=e,B(f),o=f;break e;case"link":var v=G_("link","href",d).get(o+(i.href||""));if(v){for(var w=0;w<v.length;w++)if(f=v[w],f.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&f.getAttribute("rel")===(i.rel==null?null:i.rel)&&f.getAttribute("title")===(i.title==null?null:i.title)&&f.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){v.splice(w,1);break t}}f=d.createElement(o),Zn(f,o,i),d.head.appendChild(f);break;case"meta":if(v=G_("meta","content",d).get(o+(i.content||""))){for(w=0;w<v.length;w++)if(f=v[w],f.getAttribute("content")===(i.content==null?null:""+i.content)&&f.getAttribute("name")===(i.name==null?null:i.name)&&f.getAttribute("property")===(i.property==null?null:i.property)&&f.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&f.getAttribute("charset")===(i.charSet==null?null:i.charSet)){v.splice(w,1);break t}}f=d.createElement(o),Zn(f,o,i),d.head.appendChild(f);break;default:throw Error(r(468,o))}f[ge]=e,B(f),o=f}e.stateNode=o}else V_(d,e.type,e.stateNode);else e.stateNode=Q_(d,o,e.memoizedProps);else f!==o?(f===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):f.count--,o===null?V_(d,e.type,e.stateNode):Q_(d,o,e.memoizedProps)):o===null&&e.stateNode!==null&&vm(e,e.memoizedProps,i.memoizedProps)}break;case 27:Ss(n,e),js(e),o&512&&(An||i===null||Ia(i,i.return)),i!==null&&o&4&&vm(e,e.memoizedProps,i.memoizedProps);break;case 5:if(Ss(n,e),js(e),o&512&&(An||i===null||Ia(i,i.return)),e.flags&32){d=e.stateNode;try{ca(d,"")}catch(Fe){Kt(e,e.return,Fe)}}o&4&&e.stateNode!=null&&(d=e.memoizedProps,vm(e,d,i!==null?i.memoizedProps:d)),o&1024&&(xm=!0);break;case 6:if(Ss(n,e),js(e),o&4){if(e.stateNode===null)throw Error(r(162));o=e.memoizedProps,i=e.stateNode;try{i.nodeValue=o}catch(Fe){Kt(e,e.return,Fe)}}break;case 3:if(Xd=null,d=ga,ga=Zd(n.containerInfo),Ss(n,e),ga=d,js(e),o&4&&i!==null&&i.memoizedState.isDehydrated)try{bo(n.containerInfo)}catch(Fe){Kt(e,e.return,Fe)}xm&&(xm=!1,Vv(e));break;case 4:o=ga,ga=Zd(e.stateNode.containerInfo),Ss(n,e),js(e),ga=o;break;case 12:Ss(n,e),js(e);break;case 31:Ss(n,e),js(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,Id(e,o)));break;case 13:Ss(n,e),js(e),e.child.flags&8192&&e.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(Bd=Re()),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,Id(e,o)));break;case 22:d=e.memoizedState!==null;var O=i!==null&&i.memoizedState!==null,J=ii,fe=An;if(ii=J||d,An=fe||O,Ss(n,e),An=fe,ii=J,js(e),o&8192)e:for(n=e.stateNode,n._visibility=d?n._visibility&-2:n._visibility|1,d&&(i===null||O||ii||An||tl(e)),i=null,n=e;;){if(n.tag===5||n.tag===26){if(i===null){O=i=n;try{if(f=O.stateNode,d)v=f.style,typeof v.setProperty=="function"?v.setProperty("display","none","important"):v.display="none";else{w=O.stateNode;var ve=O.memoizedProps.style,se=ve!=null&&ve.hasOwnProperty("display")?ve.display:null;w.style.display=se==null||typeof se=="boolean"?"":(""+se).trim()}}catch(Fe){Kt(O,O.return,Fe)}}}else if(n.tag===6){if(i===null){O=n;try{O.stateNode.nodeValue=d?"":O.memoizedProps}catch(Fe){Kt(O,O.return,Fe)}}}else if(n.tag===18){if(i===null){O=n;try{var re=O.stateNode;d?I_(re,!0):I_(O.stateNode,!1)}catch(Fe){Kt(O,O.return,Fe)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===e)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;i===n&&(i=null),n=n.return}i===n&&(i=null),n.sibling.return=n.return,n=n.sibling}o&4&&(o=e.updateQueue,o!==null&&(i=o.retryQueue,i!==null&&(o.retryQueue=null,Id(e,i))));break;case 19:Ss(n,e),js(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,Id(e,o)));break;case 30:break;case 21:break;default:Ss(n,e),js(e)}}function js(e){var n=e.flags;if(n&2){try{for(var i,o=e.return;o!==null;){if(Bv(o)){i=o;break}o=o.return}if(i==null)throw Error(r(160));switch(i.tag){case 27:var d=i.stateNode,f=_m(e);Ld(e,f,d);break;case 5:var v=i.stateNode;i.flags&32&&(ca(v,""),i.flags&=-33);var w=_m(e);Ld(e,w,v);break;case 3:case 4:var O=i.stateNode.containerInfo,J=_m(e);bm(e,J,O);break;default:throw Error(r(161))}}catch(fe){Kt(e,e.return,fe)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function Vv(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;Vv(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function li(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)qv(e,n.alternate,n),n=n.sibling}function tl(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:Hi(4,n,n.return),tl(n);break;case 1:Ia(n,n.return);var i=n.stateNode;typeof i.componentWillUnmount=="function"&&Iv(n,n.return,i),tl(n);break;case 27:Qc(n.stateNode);case 26:case 5:Ia(n,n.return),tl(n);break;case 22:n.memoizedState===null&&tl(n);break;case 30:tl(n);break;default:tl(n)}e=e.sibling}}function oi(e,n,i){for(i=i&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var o=n.alternate,d=e,f=n,v=f.flags;switch(f.tag){case 0:case 11:case 15:oi(d,f,i),Lc(4,f);break;case 1:if(oi(d,f,i),o=f,d=o.stateNode,typeof d.componentDidMount=="function")try{d.componentDidMount()}catch(J){Kt(o,o.return,J)}if(o=f,d=o.updateQueue,d!==null){var w=o.stateNode;try{var O=d.shared.hiddenCallbacks;if(O!==null)for(d.shared.hiddenCallbacks=null,d=0;d<O.length;d++)wy(O[d],w)}catch(J){Kt(o,o.return,J)}}i&&v&64&&Lv(f),Ic(f,f.return);break;case 27:Pv(f);case 26:case 5:oi(d,f,i),i&&o===null&&v&4&&zv(f),Ic(f,f.return);break;case 12:oi(d,f,i);break;case 31:oi(d,f,i),i&&v&4&&Fv(d,f);break;case 13:oi(d,f,i),i&&v&4&&Qv(d,f);break;case 22:f.memoizedState===null&&oi(d,f,i),Ic(f,f.return);break;case 30:break;default:oi(d,f,i)}n=n.sibling}}function Sm(e,n){var i=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==i&&(e!=null&&e.refCount++,i!=null&&Sc(i))}function jm(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&Sc(e))}function ya(e,n,i,o){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Kv(e,n,i,o),n=n.sibling}function Kv(e,n,i,o){var d=n.flags;switch(n.tag){case 0:case 11:case 15:ya(e,n,i,o),d&2048&&Lc(9,n);break;case 1:ya(e,n,i,o);break;case 3:ya(e,n,i,o),d&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&Sc(e)));break;case 12:if(d&2048){ya(e,n,i,o),e=n.stateNode;try{var f=n.memoizedProps,v=f.id,w=f.onPostCommit;typeof w=="function"&&w(v,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(O){Kt(n,n.return,O)}}else ya(e,n,i,o);break;case 31:ya(e,n,i,o);break;case 13:ya(e,n,i,o);break;case 23:break;case 22:f=n.stateNode,v=n.alternate,n.memoizedState!==null?f._visibility&2?ya(e,n,i,o):zc(e,n):f._visibility&2?ya(e,n,i,o):(f._visibility|=2,oo(e,n,i,o,(n.subtreeFlags&10256)!==0||!1)),d&2048&&Sm(v,n);break;case 24:ya(e,n,i,o),d&2048&&jm(n.alternate,n);break;default:ya(e,n,i,o)}}function oo(e,n,i,o,d){for(d=d&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var f=e,v=n,w=i,O=o,J=v.flags;switch(v.tag){case 0:case 11:case 15:oo(f,v,w,O,d),Lc(8,v);break;case 23:break;case 22:var fe=v.stateNode;v.memoizedState!==null?fe._visibility&2?oo(f,v,w,O,d):zc(f,v):(fe._visibility|=2,oo(f,v,w,O,d)),d&&J&2048&&Sm(v.alternate,v);break;case 24:oo(f,v,w,O,d),d&&J&2048&&jm(v.alternate,v);break;default:oo(f,v,w,O,d)}n=n.sibling}}function zc(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var i=e,o=n,d=o.flags;switch(o.tag){case 22:zc(i,o),d&2048&&Sm(o.alternate,o);break;case 24:zc(i,o),d&2048&&jm(o.alternate,o);break;default:zc(i,o)}n=n.sibling}}var Bc=8192;function co(e,n,i){if(e.subtreeFlags&Bc)for(e=e.child;e!==null;)Yv(e,n,i),e=e.sibling}function Yv(e,n,i){switch(e.tag){case 26:co(e,n,i),e.flags&Bc&&e.memoizedState!==null&&$j(i,ga,e.memoizedState,e.memoizedProps);break;case 5:co(e,n,i);break;case 3:case 4:var o=ga;ga=Zd(e.stateNode.containerInfo),co(e,n,i),ga=o;break;case 22:e.memoizedState===null&&(o=e.alternate,o!==null&&o.memoizedState!==null?(o=Bc,Bc=16777216,co(e,n,i),Bc=o):co(e,n,i));break;default:co(e,n,i)}}function Zv(e){var n=e.alternate;if(n!==null&&(e=n.child,e!==null)){n.child=null;do n=e.sibling,e.sibling=null,e=n;while(e!==null)}}function Pc(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var i=0;i<n.length;i++){var o=n[i];Fn=o,Xv(o,e)}Zv(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Wv(e),e=e.sibling}function Wv(e){switch(e.tag){case 0:case 11:case 15:Pc(e),e.flags&2048&&Hi(9,e,e.return);break;case 3:Pc(e);break;case 12:Pc(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,zd(e)):Pc(e);break;default:Pc(e)}}function zd(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var i=0;i<n.length;i++){var o=n[i];Fn=o,Xv(o,e)}Zv(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:Hi(8,n,n.return),zd(n);break;case 22:i=n.stateNode,i._visibility&2&&(i._visibility&=-3,zd(n));break;default:zd(n)}e=e.sibling}}function Xv(e,n){for(;Fn!==null;){var i=Fn;switch(i.tag){case 0:case 11:case 15:Hi(8,i,n);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var o=i.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:Sc(i.memoizedState.cache)}if(o=i.child,o!==null)o.return=i,Fn=o;else e:for(i=e;Fn!==null;){o=Fn;var d=o.sibling,f=o.return;if($v(o),o===i){Fn=null;break e}if(d!==null){d.return=f,Fn=d;break e}Fn=f}}}var sj={getCacheForType:function(e){var n=Kn(En),i=n.data.get(e);return i===void 0&&(i=e(),n.data.set(e,i)),i},cacheSignal:function(){return Kn(En).controller.signal}},aj=typeof WeakMap=="function"?WeakMap:Map,Pt=0,an=null,Ct=null,Et=0,Vt=0,$s=null,Fi=!1,uo=!1,wm=!1,ci=0,_n=0,Qi=0,nl=0,km=0,Hs=0,fo=0,Uc=null,ws=null,Nm=!1,Bd=0,Jv=0,Pd=1/0,Ud=null,Gi=null,In=0,Vi=null,ho=null,ui=0,Cm=0,Tm=null,e_=null,qc=0,Em=null;function Fs(){return(Pt&2)!==0&&Et!==0?Et&-Et:E.T!==null?Lm():rs()}function t_(){if(Hs===0)if((Et&536870912)===0||jt){var e=Ee;Ee<<=1,(Ee&3932160)===0&&(Ee=262144),Hs=e}else Hs=536870912;return e=Us.current,e!==null&&(e.flags|=32),Hs}function ks(e,n,i){(e===an&&(Vt===2||Vt===9)||e.cancelPendingCommit!==null)&&(mo(e,0),Ki(e,Et,Hs,!1)),as(e,i),((Pt&2)===0||e!==an)&&(e===an&&((Pt&2)===0&&(nl|=i),_n===4&&Ki(e,Et,Hs,!1)),za(e))}function n_(e,n,i){if((Pt&6)!==0)throw Error(r(327));var o=!i&&(n&127)===0&&(n&e.expiredLanes)===0||Pn(e,n),d=o?lj(e,n):Rm(e,n,!0),f=o;do{if(d===0){uo&&!o&&Ki(e,n,0,!1);break}else{if(i=e.current.alternate,f&&!ij(i)){d=Rm(e,n,!1),f=!1;continue}if(d===2){if(f=n,e.errorRecoveryDisabledLanes&f)var v=0;else v=e.pendingLanes&-536870913,v=v!==0?v:v&536870912?536870912:0;if(v!==0){n=v;e:{var w=e;d=Uc;var O=w.current.memoizedState.isDehydrated;if(O&&(mo(w,v).flags|=256),v=Rm(w,v,!1),v!==2){if(wm&&!O){w.errorRecoveryDisabledLanes|=f,nl|=f,d=4;break e}f=ws,ws=d,f!==null&&(ws===null?ws=f:ws.push.apply(ws,f))}d=v}if(f=!1,d!==2)continue}}if(d===1){mo(e,0),Ki(e,n,0,!0);break}e:{switch(o=e,f=d,f){case 0:case 1:throw Error(r(345));case 4:if((n&4194048)!==n)break;case 6:Ki(o,n,Hs,!Fi);break e;case 2:ws=null;break;case 3:case 5:break;default:throw Error(r(329))}if((n&62914560)===n&&(d=Bd+300-Re(),10<d)){if(Ki(o,n,Hs,!Fi),pn(o,0,!0)!==0)break e;ui=n,o.timeoutHandle=D_(s_.bind(null,o,i,ws,Ud,Nm,n,Hs,nl,fo,Fi,f,"Throttled",-0,0),d);break e}s_(o,i,ws,Ud,Nm,n,Hs,nl,fo,Fi,f,null,-0,0)}}break}while(!0);za(e)}function s_(e,n,i,o,d,f,v,w,O,J,fe,ve,se,re){if(e.timeoutHandle=-1,ve=n.subtreeFlags,ve&8192||(ve&16785408)===16785408){ve={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ks},Yv(n,f,ve);var Fe=(f&62914560)===f?Bd-Re():(f&4194048)===f?Jv-Re():0;if(Fe=Hj(ve,Fe),Fe!==null){ui=f,e.cancelPendingCommit=Fe(d_.bind(null,e,n,f,i,o,d,v,w,O,fe,ve,null,se,re)),Ki(e,f,v,!J);return}}d_(e,n,f,i,o,d,v,w,O)}function ij(e){for(var n=e;;){var i=n.tag;if((i===0||i===11||i===15)&&n.flags&16384&&(i=n.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var o=0;o<i.length;o++){var d=i[o],f=d.getSnapshot;d=d.value;try{if(!Cn(f(),d))return!1}catch{return!1}}if(i=n.child,n.subtreeFlags&16384&&i!==null)i.return=n,n=i;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Ki(e,n,i,o){n&=~km,n&=~nl,e.suspendedLanes|=n,e.pingedLanes&=~n,o&&(e.warmLanes|=n),o=e.expirationTimes;for(var d=n;0<d;){var f=31-De(d),v=1<<f;o[f]=-1,d&=~v}i!==0&&la(e,i,n)}function qd(){return(Pt&6)===0?($c(0),!1):!0}function Mm(){if(Ct!==null){if(Vt===0)var e=Ct.return;else e=Ct,Ja=pa=null,Gh(e),so=null,wc=0,e=Ct;for(;e!==null;)Ov(e.alternate,e),e=e.return;Ct=null}}function mo(e,n){var i=e.timeoutHandle;i!==-1&&(e.timeoutHandle=-1,kj(i)),i=e.cancelPendingCommit,i!==null&&(e.cancelPendingCommit=null,i()),ui=0,Mm(),an=e,Ct=i=Ws(e.current,null),Et=n,Vt=0,$s=null,Fi=!1,uo=Pn(e,n),wm=!1,fo=Hs=km=nl=Qi=_n=0,ws=Uc=null,Nm=!1,(n&8)!==0&&(n|=n&32);var o=e.entangledLanes;if(o!==0)for(e=e.entanglements,o&=n;0<o;){var d=31-De(o),f=1<<d;n|=e[d],o&=~f}return ci=n,Hr(),i}function a_(e,n){yt=null,E.H=Ac,n===no||n===gd?(n=by(),Vt=3):n===Oh?(n=by(),Vt=4):Vt=n===om?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,$s=n,Ct===null&&(_n=1,Md(e,D(n,e.current)))}function i_(){var e=Us.current;return e===null?!0:(Et&4194048)===Et?Js===null:(Et&62914560)===Et||(Et&536870912)!==0?e===Js:!1}function r_(){var e=E.H;return E.H=Ac,e===null?Ac:e}function l_(){var e=E.A;return E.A=sj,e}function $d(){_n=4,Fi||(Et&4194048)!==Et&&Us.current!==null||(uo=!0),(Qi&134217727)===0&&(nl&134217727)===0||an===null||Ki(an,Et,Hs,!1)}function Rm(e,n,i){var o=Pt;Pt|=2;var d=r_(),f=l_();(an!==e||Et!==n)&&(Ud=null,mo(e,n)),n=!1;var v=_n;e:do try{if(Vt!==0&&Ct!==null){var w=Ct,O=$s;switch(Vt){case 8:Mm(),v=6;break e;case 3:case 2:case 9:case 6:Us.current===null&&(n=!0);var J=Vt;if(Vt=0,$s=null,po(e,w,O,J),i&&uo){v=0;break e}break;default:J=Vt,Vt=0,$s=null,po(e,w,O,J)}}rj(),v=_n;break}catch(fe){a_(e,fe)}while(!0);return n&&e.shellSuspendCounter++,Ja=pa=null,Pt=o,E.H=d,E.A=f,Ct===null&&(an=null,Et=0,Hr()),v}function rj(){for(;Ct!==null;)o_(Ct)}function lj(e,n){var i=Pt;Pt|=2;var o=r_(),d=l_();an!==e||Et!==n?(Ud=null,Pd=Re()+500,mo(e,n)):uo=Pn(e,n);e:do try{if(Vt!==0&&Ct!==null){n=Ct;var f=$s;t:switch(Vt){case 1:Vt=0,$s=null,po(e,n,f,1);break;case 2:case 9:if(vy(f)){Vt=0,$s=null,c_(n);break}n=function(){Vt!==2&&Vt!==9||an!==e||(Vt=7),za(e)},f.then(n,n);break e;case 3:Vt=7;break e;case 4:Vt=5;break e;case 7:vy(f)?(Vt=0,$s=null,c_(n)):(Vt=0,$s=null,po(e,n,f,7));break;case 5:var v=null;switch(Ct.tag){case 26:v=Ct.memoizedState;case 5:case 27:var w=Ct;if(v?K_(v):w.stateNode.complete){Vt=0,$s=null;var O=w.sibling;if(O!==null)Ct=O;else{var J=w.return;J!==null?(Ct=J,Hd(J)):Ct=null}break t}}Vt=0,$s=null,po(e,n,f,5);break;case 6:Vt=0,$s=null,po(e,n,f,6);break;case 8:Mm(),_n=6;break e;default:throw Error(r(462))}}oj();break}catch(fe){a_(e,fe)}while(!0);return Ja=pa=null,E.H=o,E.A=d,Pt=i,Ct!==null?0:(an=null,Et=0,Hr(),_n)}function oj(){for(;Ct!==null&&!de();)o_(Ct)}function o_(e){var n=Av(e.alternate,e,ci);e.memoizedProps=e.pendingProps,n===null?Hd(e):Ct=n}function c_(e){var n=e,i=n.alternate;switch(n.tag){case 15:case 0:n=Nv(i,n,n.pendingProps,n.type,void 0,Et);break;case 11:n=Nv(i,n,n.pendingProps,n.type.render,n.ref,Et);break;case 5:Gh(n);default:Ov(i,n),n=Ct=vc(n,ci),n=Av(i,n,ci)}e.memoizedProps=e.pendingProps,n===null?Hd(e):Ct=n}function po(e,n,i,o){Ja=pa=null,Gh(n),so=null,wc=0;var d=n.return;try{if(Z1(e,d,n,i,Et)){_n=1,Md(e,D(i,e.current)),Ct=null;return}}catch(f){if(d!==null)throw Ct=d,f;_n=1,Md(e,D(i,e.current)),Ct=null;return}n.flags&32768?(jt||o===1?e=!0:uo||(Et&536870912)!==0?e=!1:(Fi=e=!0,(o===2||o===9||o===3||o===6)&&(o=Us.current,o!==null&&o.tag===13&&(o.flags|=16384))),u_(n,e)):Hd(n)}function Hd(e){var n=e;do{if((n.flags&32768)!==0){u_(n,Fi);return}e=n.return;var i=J1(n.alternate,n,ci);if(i!==null){Ct=i;return}if(n=n.sibling,n!==null){Ct=n;return}Ct=n=e}while(n!==null);_n===0&&(_n=5)}function u_(e,n){do{var i=ej(e.alternate,e);if(i!==null){i.flags&=32767,Ct=i;return}if(i=e.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!n&&(e=e.sibling,e!==null)){Ct=e;return}Ct=e=i}while(e!==null);_n=6,Ct=null}function d_(e,n,i,o,d,f,v,w,O){e.cancelPendingCommit=null;do Fd();while(In!==0);if((Pt&6)!==0)throw Error(r(327));if(n!==null){if(n===e.current)throw Error(r(177));if(f=n.lanes|n.childLanes,f|=dd,Ci(e,i,f,v,w,O),e===an&&(Ct=an=null,Et=0),ho=n,Vi=e,ui=i,Cm=f,Tm=d,e_=o,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,fj(kt,function(){return g_(),null})):(e.callbackNode=null,e.callbackPriority=0),o=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||o){o=E.T,E.T=null,d=U.p,U.p=2,v=Pt,Pt|=4;try{tj(e,n,i)}finally{Pt=v,U.p=d,E.T=o}}In=1,f_(),h_(),m_()}}function f_(){if(In===1){In=0;var e=Vi,n=ho,i=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||i){i=E.T,E.T=null;var o=U.p;U.p=2;var d=Pt;Pt|=4;try{Gv(n,e);var f=Hm,v=od(e.containerInfo),w=f.focusedElem,O=f.selectionRange;if(v!==w&&w&&w.ownerDocument&&ld(w.ownerDocument.documentElement,w)){if(O!==null&&cc(w)){var J=O.start,fe=O.end;if(fe===void 0&&(fe=J),"selectionStart"in w)w.selectionStart=J,w.selectionEnd=Math.min(fe,w.value.length);else{var ve=w.ownerDocument||document,se=ve&&ve.defaultView||window;if(se.getSelection){var re=se.getSelection(),Fe=w.textContent.length,lt=Math.min(O.start,Fe),en=O.end===void 0?lt:Math.min(O.end,Fe);!re.extend&<>en&&(v=en,en=lt,lt=v);var F=rd(w,lt),P=rd(w,en);if(F&&P&&(re.rangeCount!==1||re.anchorNode!==F.node||re.anchorOffset!==F.offset||re.focusNode!==P.node||re.focusOffset!==P.offset)){var X=ve.createRange();X.setStart(F.node,F.offset),re.removeAllRanges(),lt>en?(re.addRange(X),re.extend(P.node,P.offset)):(X.setEnd(P.node,P.offset),re.addRange(X))}}}}for(ve=[],re=w;re=re.parentNode;)re.nodeType===1&&ve.push({element:re,left:re.scrollLeft,top:re.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<ve.length;w++){var ye=ve[w];ye.element.scrollLeft=ye.left,ye.element.scrollTop=ye.top}}nf=!!$m,Hm=$m=null}finally{Pt=d,U.p=o,E.T=i}}e.current=n,In=2}}function h_(){if(In===2){In=0;var e=Vi,n=ho,i=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||i){i=E.T,E.T=null;var o=U.p;U.p=2;var d=Pt;Pt|=4;try{qv(e,n.alternate,n)}finally{Pt=d,U.p=o,E.T=i}}In=3}}function m_(){if(In===4||In===3){In=0,Ae();var e=Vi,n=ho,i=ui,o=e_;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?In=5:(In=0,ho=Vi=null,p_(e,e.pendingLanes));var d=e.pendingLanes;if(d===0&&(Gi=null),Vs(i),n=n.stateNode,oe&&typeof oe.onCommitFiberRoot=="function")try{oe.onCommitFiberRoot(ln,n,void 0,(n.current.flags&128)===128)}catch{}if(o!==null){n=E.T,d=U.p,U.p=2,E.T=null;try{for(var f=e.onRecoverableError,v=0;v<o.length;v++){var w=o[v];f(w.value,{componentStack:w.stack})}}finally{E.T=n,U.p=d}}(ui&3)!==0&&Fd(),za(e),d=e.pendingLanes,(i&261930)!==0&&(d&42)!==0?e===Em?qc++:(qc=0,Em=e):qc=0,$c(0)}}function p_(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,Sc(n)))}function Fd(){return f_(),h_(),m_(),g_()}function g_(){if(In!==5)return!1;var e=Vi,n=Cm;Cm=0;var i=Vs(ui),o=E.T,d=U.p;try{U.p=32>i?32:i,E.T=null,i=Tm,Tm=null;var f=Vi,v=ui;if(In=0,ho=Vi=null,ui=0,(Pt&6)!==0)throw Error(r(331));var w=Pt;if(Pt|=4,Wv(f.current),Kv(f,f.current,v,i),Pt=w,$c(0,!1),oe&&typeof oe.onPostCommitFiberRoot=="function")try{oe.onPostCommitFiberRoot(ln,f)}catch{}return!0}finally{U.p=d,E.T=o,p_(e,n)}}function y_(e,n,i){n=D(i,n),n=lm(e.stateNode,n,2),e=Ui(e,n,2),e!==null&&(as(e,2),za(e))}function Kt(e,n,i){if(e.tag===3)y_(e,e,i);else for(;n!==null;){if(n.tag===3){y_(n,e,i);break}else if(n.tag===1){var o=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(Gi===null||!Gi.has(o))){e=D(i,e),i=vv(2),o=Ui(n,i,2),o!==null&&(_v(i,o,n,e),as(o,2),za(o));break}}n=n.return}}function Am(e,n,i){var o=e.pingCache;if(o===null){o=e.pingCache=new aj;var d=new Set;o.set(n,d)}else d=o.get(n),d===void 0&&(d=new Set,o.set(n,d));d.has(i)||(wm=!0,d.add(i),e=cj.bind(null,e,n,i),n.then(e,e))}function cj(e,n,i){var o=e.pingCache;o!==null&&o.delete(n),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,an===e&&(Et&i)===i&&(_n===4||_n===3&&(Et&62914560)===Et&&300>Re()-Bd?(Pt&2)===0&&mo(e,0):km|=i,fo===Et&&(fo=0)),za(e)}function v_(e,n){n===0&&(n=ps()),e=Oa(e,n),e!==null&&(as(e,n),za(e))}function uj(e){var n=e.memoizedState,i=0;n!==null&&(i=n.retryLane),v_(e,i)}function dj(e,n){var i=0;switch(e.tag){case 31:case 13:var o=e.stateNode,d=e.memoizedState;d!==null&&(i=d.retryLane);break;case 19:o=e.stateNode;break;case 22:o=e.stateNode._retryCache;break;default:throw Error(r(314))}o!==null&&o.delete(n),v_(e,i)}function fj(e,n){return tn(e,n)}var Qd=null,go=null,Dm=!1,Gd=!1,Om=!1,Yi=0;function za(e){e!==go&&e.next===null&&(go===null?Qd=go=e:go=go.next=e),Gd=!0,Dm||(Dm=!0,mj())}function $c(e,n){if(!Om&&Gd){Om=!0;do for(var i=!1,o=Qd;o!==null;){if(e!==0){var d=o.pendingLanes;if(d===0)var f=0;else{var v=o.suspendedLanes,w=o.pingedLanes;f=(1<<31-De(42|e)+1)-1,f&=d&~(v&~w),f=f&201326741?f&201326741|1:f?f|2:0}f!==0&&(i=!0,S_(o,f))}else f=Et,f=pn(o,o===an?f:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(f&3)===0||Pn(o,f)||(i=!0,S_(o,f));o=o.next}while(i);Om=!1}}function hj(){__()}function __(){Gd=Dm=!1;var e=0;Yi!==0&&wj()&&(e=Yi);for(var n=Re(),i=null,o=Qd;o!==null;){var d=o.next,f=b_(o,n);f===0?(o.next=null,i===null?Qd=d:i.next=d,d===null&&(go=i)):(i=o,(e!==0||(f&3)!==0)&&(Gd=!0)),o=d}In!==0&&In!==5||$c(e),Yi!==0&&(Yi=0)}function b_(e,n){for(var i=e.suspendedLanes,o=e.pingedLanes,d=e.expirationTimes,f=e.pendingLanes&-62914561;0<f;){var v=31-De(f),w=1<<v,O=d[v];O===-1?((w&i)===0||(w&o)!==0)&&(d[v]=xn(w,n)):O<=n&&(e.expiredLanes|=w),f&=~w}if(n=an,i=Et,i=pn(e,e===n?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o=e.callbackNode,i===0||e===n&&(Vt===2||Vt===9)||e.cancelPendingCommit!==null)return o!==null&&o!==null&&$t(o),e.callbackNode=null,e.callbackPriority=0;if((i&3)===0||Pn(e,i)){if(n=i&-i,n===e.callbackPriority)return n;switch(o!==null&&$t(o),Vs(i)){case 2:case 8:i=mt;break;case 32:i=kt;break;case 268435456:i=Bn;break;default:i=kt}return o=x_.bind(null,e),i=tn(i,o),e.callbackPriority=n,e.callbackNode=i,n}return o!==null&&o!==null&&$t(o),e.callbackPriority=2,e.callbackNode=null,2}function x_(e,n){if(In!==0&&In!==5)return e.callbackNode=null,e.callbackPriority=0,null;var i=e.callbackNode;if(Fd()&&e.callbackNode!==i)return null;var o=Et;return o=pn(e,e===an?o:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o===0?null:(n_(e,o,n),b_(e,Re()),e.callbackNode!=null&&e.callbackNode===i?x_.bind(null,e):null)}function S_(e,n){if(Fd())return null;n_(e,n,!0)}function mj(){Nj(function(){(Pt&6)!==0?tn(Ke,hj):__()})}function Lm(){if(Yi===0){var e=eo;e===0&&(e=He,He<<=1,(He&261888)===0&&(He=256)),Yi=e}return Yi}function j_(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:ua(""+e)}function w_(e,n){var i=n.ownerDocument.createElement("input");return i.name=n.name,i.value=n.value,e.id&&i.setAttribute("form",e.id),n.parentNode.insertBefore(i,n),e=new FormData(e),i.parentNode.removeChild(i),e}function pj(e,n,i,o,d){if(n==="submit"&&i&&i.stateNode===d){var f=j_((d[we]||null).action),v=o.submitter;v&&(n=(n=v[we]||null)?j_(n.formAction):v.getAttribute("formAction"),n!==null&&(f=n,v=null));var w=new zr("action","action",null,o,d);e.push({event:w,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(Yi!==0){var O=v?w_(d,v):new FormData(d);tm(i,{pending:!0,data:O,method:d.method,action:f},null,O)}}else typeof f=="function"&&(w.preventDefault(),O=v?w_(d,v):new FormData(d),tm(i,{pending:!0,data:O,method:d.method,action:f},f,O))},currentTarget:d}]})}}for(var Im=0;Im<Fl.length;Im++){var zm=Fl[Im],gj=zm.toLowerCase(),yj=zm[0].toUpperCase()+zm.slice(1);zs(gj,"on"+yj)}zs(hc,"onAnimationEnd"),zs(mc,"onAnimationIteration"),zs(pc,"onAnimationStart"),zs("dblclick","onDoubleClick"),zs("focusin","onFocus"),zs("focusout","onBlur"),zs(cd,"onTransitionRun"),zs(Ch,"onTransitionStart"),zs(Th,"onTransitionCancel"),zs(ud,"onTransitionEnd"),sn("onMouseEnter",["mouseout","mouseover"]),sn("onMouseLeave",["mouseout","mouseover"]),sn("onPointerEnter",["pointerout","pointerover"]),sn("onPointerLeave",["pointerout","pointerover"]),yn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),yn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),yn("onBeforeInput",["compositionend","keypress","textInput","paste"]),yn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),yn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),yn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Hc="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(" "),vj=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Hc));function k_(e,n){n=(n&4)!==0;for(var i=0;i<e.length;i++){var o=e[i],d=o.event;o=o.listeners;e:{var f=void 0;if(n)for(var v=o.length-1;0<=v;v--){var w=o[v],O=w.instance,J=w.currentTarget;if(w=w.listener,O!==f&&d.isPropagationStopped())break e;f=w,d.currentTarget=J;try{f(d)}catch(fe){Ql(fe)}d.currentTarget=null,f=O}else for(v=0;v<o.length;v++){if(w=o[v],O=w.instance,J=w.currentTarget,w=w.listener,O!==f&&d.isPropagationStopped())break e;f=w,d.currentTarget=J;try{f(d)}catch(fe){Ql(fe)}d.currentTarget=null,f=O}}}}function Tt(e,n){var i=n[Ve];i===void 0&&(i=n[Ve]=new Set);var o=e+"__bubble";i.has(o)||(N_(n,e,2,!1),i.add(o))}function Bm(e,n,i){var o=0;n&&(o|=4),N_(i,e,o,n)}var Vd="_reactListening"+Math.random().toString(36).slice(2);function Pm(e){if(!e[Vd]){e[Vd]=!0,on.forEach(function(i){i!=="selectionchange"&&(vj.has(i)||Bm(i,!1,e),Bm(i,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[Vd]||(n[Vd]=!0,Bm("selectionchange",!1,n))}}function N_(e,n,i,o){switch(tb(n)){case 2:var d=Gj;break;case 8:d=Vj;break;default:d=ep}i=d.bind(null,n,i,e),d=void 0,!Ei||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(d=!0),o?d!==void 0?e.addEventListener(n,i,{capture:!0,passive:d}):e.addEventListener(n,i,!0):d!==void 0?e.addEventListener(n,i,{passive:d}):e.addEventListener(n,i,!1)}function Um(e,n,i,o,d){var f=o;if((n&1)===0&&(n&2)===0&&o!==null)e:for(;;){if(o===null)return;var v=o.tag;if(v===3||v===4){var w=o.stateNode.containerInfo;if(w===d)break;if(v===4)for(v=o.return;v!==null;){var O=v.tag;if((O===3||O===4)&&v.stateNode.containerInfo===d)return;v=v.return}for(;w!==null;){if(v=wn(w),v===null)return;if(O=v.tag,O===5||O===6||O===26||O===27){o=f=v;continue e}w=w.parentNode}}o=o.return}Dr(function(){var J=f,fe=fn(i),ve=[];e:{var se=gc.get(e);if(se!==void 0){var re=zr,Fe=e;switch(e){case"keypress":if(Ka(i)===0)break e;case"keydown":case"keyup":re=Vn;break;case"focusin":Fe="focus",re=Il;break;case"focusout":Fe="blur",re=Il;break;case"beforeblur":case"afterblur":re=Il;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":re=Gu;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":re=Ll;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":re=vh;break;case hc:case mc:case pc:re=uh;break;case ud:re=Pl;break;case"scroll":case"scrollend":re=Ya;break;case"wheel":re=Zs;break;case"copy":case"cut":case"paste":re=fh;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":re=Bl;break;case"toggle":case"beforetoggle":re=Yu}var lt=(n&4)!==0,en=!lt&&(e==="scroll"||e==="scrollend"),F=lt?se!==null?se+"Capture":null:se;lt=[];for(var P=J,X;P!==null;){var ye=P;if(X=ye.stateNode,ye=ye.tag,ye!==5&&ye!==26&&ye!==27||X===null||F===null||(ye=Na(P,F),ye!=null&<.push(Fc(P,ye,X))),en)break;P=P.return}0<lt.length&&(se=new re(se,Fe,null,i,fe),ve.push({event:se,listeners:lt}))}}if((n&7)===0){e:{if(se=e==="mouseover"||e==="pointerover",re=e==="mouseout"||e==="pointerout",se&&i!==As&&(Fe=i.relatedTarget||i.fromElement)&&(wn(Fe)||Fe[ke]))break e;if((re||se)&&(se=fe.window===fe?fe:(se=fe.ownerDocument)?se.defaultView||se.parentWindow:window,re?(Fe=i.relatedTarget||i.toElement,re=J,Fe=Fe?wn(Fe):null,Fe!==null&&(en=u(Fe),lt=Fe.tag,Fe!==en||lt!==5&<!==27&<!==6)&&(Fe=null)):(re=null,Fe=J),re!==Fe)){if(lt=Gu,ye="onMouseLeave",F="onMouseEnter",P="mouse",(e==="pointerout"||e==="pointerover")&&(lt=Bl,ye="onPointerLeave",F="onPointerEnter",P="pointer"),en=re==null?se:Ln(re),X=Fe==null?se:Ln(Fe),se=new lt(ye,P+"leave",re,i,fe),se.target=en,se.relatedTarget=X,ye=null,wn(fe)===J&&(lt=new lt(F,P+"enter",Fe,i,fe),lt.target=X,lt.relatedTarget=en,ye=lt),en=ye,re&&Fe)t:{for(lt=_j,F=re,P=Fe,X=0,ye=F;ye;ye=lt(ye))X++;ye=0;for(var tt=P;tt;tt=lt(tt))ye++;for(;0<X-ye;)F=lt(F),X--;for(;0<ye-X;)P=lt(P),ye--;for(;X--;){if(F===P||P!==null&&F===P.alternate){lt=F;break t}F=lt(F),P=lt(P)}lt=null}else lt=null;re!==null&&C_(ve,se,re,lt,!1),Fe!==null&&en!==null&&C_(ve,en,Fe,lt,!0)}}e:{if(se=J?Ln(J):window,re=se.nodeName&&se.nodeName.toLowerCase(),re==="select"||re==="input"&&se.type==="file")var It=ed;else if(rc(se))if(td)It=wh;else{It=Sh;var Ze=xh}else re=se.nodeName,!re||re.toLowerCase()!=="input"||se.type!=="checkbox"&&se.type!=="radio"?J&&Dl(J.elementType)&&(It=ed):It=jh;if(It&&(It=It(e,J))){lc(ve,It,i,fe);break e}Ze&&Ze(e,se,J),e==="focusout"&&J&&se.type==="number"&&J.memoizedProps.value!=null&&ys(se,"number",se.value)}switch(Ze=J?Ln(J):window,e){case"focusin":(rc(Ze)||Ze.contentEditable==="true")&&(Li=Ze,uc=J,$r=null);break;case"focusout":$r=uc=Li=null;break;case"mousedown":$l=!0;break;case"contextmenu":case"mouseup":case"dragend":$l=!1,dc(ve,i,fe);break;case"selectionchange":if(Nh)break;case"keydown":case"keyup":dc(ve,i,fe)}var _t;if(Ur)e:{switch(e){case"compositionstart":var Mt="onCompositionStart";break e;case"compositionend":Mt="onCompositionEnd";break e;case"compositionupdate":Mt="onCompositionUpdate";break e}Mt=void 0}else Ai?Wu(e,i)&&(Mt="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(Mt="onCompositionStart");Mt&&(Ma&&i.locale!=="ko"&&(Ai||Mt!=="onCompositionStart"?Mt==="onCompositionEnd"&&Ai&&(_t=Jo()):(Os=fe,Or="value"in Os?Os.value:Os.textContent,Ai=!0)),Ze=Kd(J,Mt),0<Ze.length&&(Mt=new Vu(Mt,e,null,i,fe),ve.push({event:Mt,listeners:Ze}),_t?Mt.data=_t:(_t=ic(i),_t!==null&&(Mt.data=_t)))),(_t=ac?Xu(e,i):Ju(e,i))&&(Mt=Kd(J,"onBeforeInput"),0<Mt.length&&(Ze=new Vu("onBeforeInput","beforeinput",null,i,fe),ve.push({event:Ze,listeners:Mt}),Ze.data=_t)),pj(ve,e,J,i,fe)}k_(ve,n)})}function Fc(e,n,i){return{instance:e,listener:n,currentTarget:i}}function Kd(e,n){for(var i=n+"Capture",o=[];e!==null;){var d=e,f=d.stateNode;if(d=d.tag,d!==5&&d!==26&&d!==27||f===null||(d=Na(e,i),d!=null&&o.unshift(Fc(e,d,f)),d=Na(e,n),d!=null&&o.push(Fc(e,d,f))),e.tag===3)return o;e=e.return}return[]}function _j(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function C_(e,n,i,o,d){for(var f=n._reactName,v=[];i!==null&&i!==o;){var w=i,O=w.alternate,J=w.stateNode;if(w=w.tag,O!==null&&O===o)break;w!==5&&w!==26&&w!==27||J===null||(O=J,d?(J=Na(i,f),J!=null&&v.unshift(Fc(i,J,O))):d||(J=Na(i,f),J!=null&&v.push(Fc(i,J,O)))),i=i.return}v.length!==0&&e.push({event:n,listeners:v})}var bj=/\r\n?/g,xj=/\u0000|\uFFFD/g;function T_(e){return(typeof e=="string"?e:""+e).replace(bj,`
|
|
50
|
+
`).replace(xj,"")}function E_(e,n){return n=T_(n),T_(e)===n}function Jt(e,n,i,o,d,f){switch(i){case"children":typeof o=="string"?n==="body"||n==="textarea"&&o===""||ca(e,o):(typeof o=="number"||typeof o=="bigint")&&n!=="body"&&ca(e,""+o);break;case"className":Rl(e,"class",o);break;case"tabIndex":Rl(e,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":Rl(e,i,o);break;case"style":Ar(e,o,f);break;case"data":if(n!=="object"){Rl(e,"data",o);break}case"src":case"href":if(o===""&&(n!=="a"||i!=="href")){e.removeAttribute(i);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(i);break}o=ua(""+o),e.setAttribute(i,o);break;case"action":case"formAction":if(typeof o=="function"){e.setAttribute(i,"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 f=="function"&&(i==="formAction"?(n!=="input"&&Jt(e,n,"name",d.name,d,null),Jt(e,n,"formEncType",d.formEncType,d,null),Jt(e,n,"formMethod",d.formMethod,d,null),Jt(e,n,"formTarget",d.formTarget,d,null)):(Jt(e,n,"encType",d.encType,d,null),Jt(e,n,"method",d.method,d,null),Jt(e,n,"target",d.target,d,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(i);break}o=ua(""+o),e.setAttribute(i,o);break;case"onClick":o!=null&&(e.onclick=Ks);break;case"onScroll":o!=null&&Tt("scroll",e);break;case"onScrollEnd":o!=null&&Tt("scrollend",e);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(r(61));if(i=o.__html,i!=null){if(d.children!=null)throw Error(r(60));e.innerHTML=i}}break;case"multiple":e.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":e.muted=o&&typeof o!="function"&&typeof o!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o=="function"||typeof o=="boolean"||typeof o=="symbol"){e.removeAttribute("xlink:href");break}i=ua(""+o),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(i,""+o):e.removeAttribute(i);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":o&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(i,""):e.removeAttribute(i);break;case"capture":case"download":o===!0?e.setAttribute(i,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(i,o):e.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?e.setAttribute(i,o):e.removeAttribute(i);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?e.removeAttribute(i):e.setAttribute(i,o);break;case"popover":Tt("beforetoggle",e),Tt("toggle",e),Sa(e,"popover",o);break;case"xlinkActuate":oa(e,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":oa(e,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":oa(e,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":oa(e,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":oa(e,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":oa(e,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":oa(e,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":oa(e,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":oa(e,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":Sa(e,"is",o);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=ka.get(i)||i,Sa(e,i,o))}}function qm(e,n,i,o,d,f){switch(i){case"style":Ar(e,o,f);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(r(61));if(i=o.__html,i!=null){if(d.children!=null)throw Error(r(60));e.innerHTML=i}}break;case"children":typeof o=="string"?ca(e,o):(typeof o=="number"||typeof o=="bigint")&&ca(e,""+o);break;case"onScroll":o!=null&&Tt("scroll",e);break;case"onScrollEnd":o!=null&&Tt("scrollend",e);break;case"onClick":o!=null&&(e.onclick=Ks);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!gn.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(d=i.endsWith("Capture"),n=i.slice(2,d?i.length-7:void 0),f=e[we]||null,f=f!=null?f[i]:null,typeof f=="function"&&e.removeEventListener(n,f,d),typeof o=="function")){typeof f!="function"&&f!==null&&(i in e?e[i]=null:e.hasAttribute(i)&&e.removeAttribute(i)),e.addEventListener(n,o,d);break e}i in e?e[i]=o:o===!0?e.setAttribute(i,""):Sa(e,i,o)}}}function Zn(e,n,i){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Tt("error",e),Tt("load",e);var o=!1,d=!1,f;for(f in i)if(i.hasOwnProperty(f)){var v=i[f];if(v!=null)switch(f){case"src":o=!0;break;case"srcSet":d=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:Jt(e,n,f,v,i,null)}}d&&Jt(e,n,"srcSet",i.srcSet,i,null),o&&Jt(e,n,"src",i.src,i,null);return;case"input":Tt("invalid",e);var w=f=v=d=null,O=null,J=null;for(o in i)if(i.hasOwnProperty(o)){var fe=i[o];if(fe!=null)switch(o){case"name":d=fe;break;case"type":v=fe;break;case"checked":O=fe;break;case"defaultChecked":J=fe;break;case"value":f=fe;break;case"defaultValue":w=fe;break;case"children":case"dangerouslySetInnerHTML":if(fe!=null)throw Error(r(137,n));break;default:Jt(e,n,o,fe,i,null)}}Va(e,f,w,O,J,v,d,!1);return;case"select":Tt("invalid",e),o=v=f=null;for(d in i)if(i.hasOwnProperty(d)&&(w=i[d],w!=null))switch(d){case"value":f=w;break;case"defaultValue":v=w;break;case"multiple":o=w;default:Jt(e,n,d,w,i,null)}n=f,i=v,e.multiple=!!o,n!=null?Rs(e,!!o,n,!1):i!=null&&Rs(e,!!o,i,!0);return;case"textarea":Tt("invalid",e),f=d=o=null;for(v in i)if(i.hasOwnProperty(v)&&(w=i[v],w!=null))switch(v){case"value":o=w;break;case"defaultValue":d=w;break;case"children":f=w;break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(r(91));break;default:Jt(e,n,v,w,i,null)}Al(e,o,d,f);return;case"option":for(O in i)if(i.hasOwnProperty(O)&&(o=i[O],o!=null))switch(O){case"selected":e.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:Jt(e,n,O,o,i,null)}return;case"dialog":Tt("beforetoggle",e),Tt("toggle",e),Tt("cancel",e),Tt("close",e);break;case"iframe":case"object":Tt("load",e);break;case"video":case"audio":for(o=0;o<Hc.length;o++)Tt(Hc[o],e);break;case"image":Tt("error",e),Tt("load",e);break;case"details":Tt("toggle",e);break;case"embed":case"source":case"link":Tt("error",e),Tt("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(J in i)if(i.hasOwnProperty(J)&&(o=i[J],o!=null))switch(J){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:Jt(e,n,J,o,i,null)}return;default:if(Dl(n)){for(fe in i)i.hasOwnProperty(fe)&&(o=i[fe],o!==void 0&&qm(e,n,fe,o,i,void 0));return}}for(w in i)i.hasOwnProperty(w)&&(o=i[w],o!=null&&Jt(e,n,w,o,i,null))}function Sj(e,n,i,o){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var d=null,f=null,v=null,w=null,O=null,J=null,fe=null;for(re in i){var ve=i[re];if(i.hasOwnProperty(re)&&ve!=null)switch(re){case"checked":break;case"value":break;case"defaultValue":O=ve;default:o.hasOwnProperty(re)||Jt(e,n,re,null,o,ve)}}for(var se in o){var re=o[se];if(ve=i[se],o.hasOwnProperty(se)&&(re!=null||ve!=null))switch(se){case"type":f=re;break;case"name":d=re;break;case"checked":J=re;break;case"defaultChecked":fe=re;break;case"value":v=re;break;case"defaultValue":w=re;break;case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(r(137,n));break;default:re!==ve&&Jt(e,n,se,re,o,ve)}}Xo(e,v,w,O,J,fe,f,d);return;case"select":re=v=w=se=null;for(f in i)if(O=i[f],i.hasOwnProperty(f)&&O!=null)switch(f){case"value":break;case"multiple":re=O;default:o.hasOwnProperty(f)||Jt(e,n,f,null,o,O)}for(d in o)if(f=o[d],O=i[d],o.hasOwnProperty(d)&&(f!=null||O!=null))switch(d){case"value":se=f;break;case"defaultValue":w=f;break;case"multiple":v=f;default:f!==O&&Jt(e,n,d,f,o,O)}n=w,i=v,o=re,se!=null?Rs(e,!!i,se,!1):!!o!=!!i&&(n!=null?Rs(e,!!i,n,!0):Rs(e,!!i,i?[]:"",!1));return;case"textarea":re=se=null;for(w in i)if(d=i[w],i.hasOwnProperty(w)&&d!=null&&!o.hasOwnProperty(w))switch(w){case"value":break;case"children":break;default:Jt(e,n,w,null,o,d)}for(v in o)if(d=o[v],f=i[v],o.hasOwnProperty(v)&&(d!=null||f!=null))switch(v){case"value":se=d;break;case"defaultValue":re=d;break;case"children":break;case"dangerouslySetInnerHTML":if(d!=null)throw Error(r(91));break;default:d!==f&&Jt(e,n,v,d,o,f)}vs(e,se,re);return;case"option":for(var Fe in i)if(se=i[Fe],i.hasOwnProperty(Fe)&&se!=null&&!o.hasOwnProperty(Fe))switch(Fe){case"selected":e.selected=!1;break;default:Jt(e,n,Fe,null,o,se)}for(O in o)if(se=o[O],re=i[O],o.hasOwnProperty(O)&&se!==re&&(se!=null||re!=null))switch(O){case"selected":e.selected=se&&typeof se!="function"&&typeof se!="symbol";break;default:Jt(e,n,O,se,o,re)}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 lt in i)se=i[lt],i.hasOwnProperty(lt)&&se!=null&&!o.hasOwnProperty(lt)&&Jt(e,n,lt,null,o,se);for(J in o)if(se=o[J],re=i[J],o.hasOwnProperty(J)&&se!==re&&(se!=null||re!=null))switch(J){case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(r(137,n));break;default:Jt(e,n,J,se,o,re)}return;default:if(Dl(n)){for(var en in i)se=i[en],i.hasOwnProperty(en)&&se!==void 0&&!o.hasOwnProperty(en)&&qm(e,n,en,void 0,o,se);for(fe in o)se=o[fe],re=i[fe],!o.hasOwnProperty(fe)||se===re||se===void 0&&re===void 0||qm(e,n,fe,se,o,re);return}}for(var F in i)se=i[F],i.hasOwnProperty(F)&&se!=null&&!o.hasOwnProperty(F)&&Jt(e,n,F,null,o,se);for(ve in o)se=o[ve],re=i[ve],!o.hasOwnProperty(ve)||se===re||se==null&&re==null||Jt(e,n,ve,se,o,re)}function M_(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function jj(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,i=performance.getEntriesByType("resource"),o=0;o<i.length;o++){var d=i[o],f=d.transferSize,v=d.initiatorType,w=d.duration;if(f&&w&&M_(v)){for(v=0,w=d.responseEnd,o+=1;o<i.length;o++){var O=i[o],J=O.startTime;if(J>w)break;var fe=O.transferSize,ve=O.initiatorType;fe&&M_(ve)&&(O=O.responseEnd,v+=fe*(O<w?1:(w-J)/(O-J)))}if(--o,n+=8*(f+v)/(d.duration/1e3),e++,10<e)break}}if(0<e)return n/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var $m=null,Hm=null;function Yd(e){return e.nodeType===9?e:e.ownerDocument}function R_(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function A_(e,n){if(e===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&n==="foreignObject"?0:e}function Fm(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var Qm=null;function wj(){var e=window.event;return e&&e.type==="popstate"?e===Qm?!1:(Qm=e,!0):(Qm=null,!1)}var D_=typeof setTimeout=="function"?setTimeout:void 0,kj=typeof clearTimeout=="function"?clearTimeout:void 0,O_=typeof Promise=="function"?Promise:void 0,Nj=typeof queueMicrotask=="function"?queueMicrotask:typeof O_<"u"?function(e){return O_.resolve(null).then(e).catch(Cj)}:D_;function Cj(e){setTimeout(function(){throw e})}function Zi(e){return e==="head"}function L_(e,n){var i=n,o=0;do{var d=i.nextSibling;if(e.removeChild(i),d&&d.nodeType===8)if(i=d.data,i==="/$"||i==="/&"){if(o===0){e.removeChild(d),bo(n);return}o--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")o++;else if(i==="html")Qc(e.ownerDocument.documentElement);else if(i==="head"){i=e.ownerDocument.head,Qc(i);for(var f=i.firstChild;f;){var v=f.nextSibling,w=f.nodeName;f[Jn]||w==="SCRIPT"||w==="STYLE"||w==="LINK"&&f.rel.toLowerCase()==="stylesheet"||i.removeChild(f),f=v}}else i==="body"&&Qc(e.ownerDocument.body);i=d}while(i);bo(n)}function I_(e,n){var i=e;e=0;do{var o=i.nextSibling;if(i.nodeType===1?n?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(n?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),o&&o.nodeType===8)if(i=o.data,i==="/$"){if(e===0)break;e--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||e++;i=o}while(i)}function Gm(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var i=n;switch(n=n.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":Gm(i),Ht(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}e.removeChild(i)}}function Tj(e,n,i,o){for(;e.nodeType===1;){var d=i;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!o&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(o){if(!e[Jn])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(f=e.getAttribute("rel"),f==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(f!==d.rel||e.getAttribute("href")!==(d.href==null||d.href===""?null:d.href)||e.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin)||e.getAttribute("title")!==(d.title==null?null:d.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(f=e.getAttribute("src"),(f!==(d.src==null?null:d.src)||e.getAttribute("type")!==(d.type==null?null:d.type)||e.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin))&&f&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var f=d.name==null?null:""+d.name;if(d.type==="hidden"&&e.getAttribute("name")===f)return e}else return e;if(e=ea(e.nextSibling),e===null)break}return null}function Ej(e,n,i){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!i||(e=ea(e.nextSibling),e===null))return null;return e}function z_(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=ea(e.nextSibling),e===null))return null;return e}function Vm(e){return e.data==="$?"||e.data==="$~"}function Km(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Mj(e,n){var i=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||i.readyState!=="loading")n();else{var o=function(){n(),i.removeEventListener("DOMContentLoaded",o)};i.addEventListener("DOMContentLoaded",o),e._reactRetry=o}}function ea(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return e}var Ym=null;function B_(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"||i==="/&"){if(n===0)return ea(e.nextSibling);n--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||n++}e=e.nextSibling}return null}function P_(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(n===0)return e;n--}else i!=="/$"&&i!=="/&"||n++}e=e.previousSibling}return null}function U_(e,n,i){switch(n=Yd(i),e){case"html":if(e=n.documentElement,!e)throw Error(r(452));return e;case"head":if(e=n.head,!e)throw Error(r(453));return e;case"body":if(e=n.body,!e)throw Error(r(454));return e;default:throw Error(r(451))}}function Qc(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);Ht(e)}var ta=new Map,q_=new Set;function Zd(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var di=U.d;U.d={f:Rj,r:Aj,D:Dj,C:Oj,L:Lj,m:Ij,X:Bj,S:zj,M:Pj};function Rj(){var e=di.f(),n=qd();return e||n}function Aj(e){var n=kn(e);n!==null&&n.tag===5&&n.type==="form"?av(n):di.r(e)}var yo=typeof document>"u"?null:document;function $_(e,n,i){var o=yo;if(o&&typeof n=="string"&&n){var d=es(n);d='link[rel="'+e+'"][href="'+d+'"]',typeof i=="string"&&(d+='[crossorigin="'+i+'"]'),q_.has(d)||(q_.add(d),e={rel:e,crossOrigin:i,href:n},o.querySelector(d)===null&&(n=o.createElement("link"),Zn(n,"link",e),B(n),o.head.appendChild(n)))}}function Dj(e){di.D(e),$_("dns-prefetch",e,null)}function Oj(e,n){di.C(e,n),$_("preconnect",e,n)}function Lj(e,n,i){di.L(e,n,i);var o=yo;if(o&&e&&n){var d='link[rel="preload"][as="'+es(n)+'"]';n==="image"&&i&&i.imageSrcSet?(d+='[imagesrcset="'+es(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(d+='[imagesizes="'+es(i.imageSizes)+'"]')):d+='[href="'+es(e)+'"]';var f=d;switch(n){case"style":f=vo(e);break;case"script":f=_o(e)}ta.has(f)||(e=g({rel:"preload",href:n==="image"&&i&&i.imageSrcSet?void 0:e,as:n},i),ta.set(f,e),o.querySelector(d)!==null||n==="style"&&o.querySelector(Gc(f))||n==="script"&&o.querySelector(Vc(f))||(n=o.createElement("link"),Zn(n,"link",e),B(n),o.head.appendChild(n)))}}function Ij(e,n){di.m(e,n);var i=yo;if(i&&e){var o=n&&typeof n.as=="string"?n.as:"script",d='link[rel="modulepreload"][as="'+es(o)+'"][href="'+es(e)+'"]',f=d;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":f=_o(e)}if(!ta.has(f)&&(e=g({rel:"modulepreload",href:e},n),ta.set(f,e),i.querySelector(d)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(Vc(f)))return}o=i.createElement("link"),Zn(o,"link",e),B(o),i.head.appendChild(o)}}}function zj(e,n,i){di.S(e,n,i);var o=yo;if(o&&e){var d=un(o).hoistableStyles,f=vo(e);n=n||"default";var v=d.get(f);if(!v){var w={loading:0,preload:null};if(v=o.querySelector(Gc(f)))w.loading=5;else{e=g({rel:"stylesheet",href:e,"data-precedence":n},i),(i=ta.get(f))&&Zm(e,i);var O=v=o.createElement("link");B(O),Zn(O,"link",e),O._p=new Promise(function(J,fe){O.onload=J,O.onerror=fe}),O.addEventListener("load",function(){w.loading|=1}),O.addEventListener("error",function(){w.loading|=2}),w.loading|=4,Wd(v,n,o)}v={type:"stylesheet",instance:v,count:1,state:w},d.set(f,v)}}}function Bj(e,n){di.X(e,n);var i=yo;if(i&&e){var o=un(i).hoistableScripts,d=_o(e),f=o.get(d);f||(f=i.querySelector(Vc(d)),f||(e=g({src:e,async:!0},n),(n=ta.get(d))&&Wm(e,n),f=i.createElement("script"),B(f),Zn(f,"link",e),i.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},o.set(d,f))}}function Pj(e,n){di.M(e,n);var i=yo;if(i&&e){var o=un(i).hoistableScripts,d=_o(e),f=o.get(d);f||(f=i.querySelector(Vc(d)),f||(e=g({src:e,async:!0,type:"module"},n),(n=ta.get(d))&&Wm(e,n),f=i.createElement("script"),B(f),Zn(f,"link",e),i.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},o.set(d,f))}}function H_(e,n,i,o){var d=(d=Ce.current)?Zd(d):null;if(!d)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(n=vo(i.href),i=un(d).hoistableStyles,o=i.get(n),o||(o={type:"style",instance:null,count:0,state:null},i.set(n,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){e=vo(i.href);var f=un(d).hoistableStyles,v=f.get(e);if(v||(d=d.ownerDocument||d,v={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},f.set(e,v),(f=d.querySelector(Gc(e)))&&!f._p&&(v.instance=f,v.state.loading=5),ta.has(e)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},ta.set(e,i),f||Uj(d,e,i,v.state))),n&&o===null)throw Error(r(528,""));return v}if(n&&o!==null)throw Error(r(529,""));return null;case"script":return n=i.async,i=i.src,typeof i=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=_o(i),i=un(d).hoistableScripts,o=i.get(n),o||(o={type:"script",instance:null,count:0,state:null},i.set(n,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,e))}}function vo(e){return'href="'+es(e)+'"'}function Gc(e){return'link[rel="stylesheet"]['+e+"]"}function F_(e){return g({},e,{"data-precedence":e.precedence,precedence:null})}function Uj(e,n,i,o){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?o.loading=1:(n=e.createElement("link"),o.preload=n,n.addEventListener("load",function(){return o.loading|=1}),n.addEventListener("error",function(){return o.loading|=2}),Zn(n,"link",i),B(n),e.head.appendChild(n))}function _o(e){return'[src="'+es(e)+'"]'}function Vc(e){return"script[async]"+e}function Q_(e,n,i){if(n.count++,n.instance===null)switch(n.type){case"style":var o=e.querySelector('style[data-href~="'+es(i.href)+'"]');if(o)return n.instance=o,B(o),o;var d=g({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return o=(e.ownerDocument||e).createElement("style"),B(o),Zn(o,"style",d),Wd(o,i.precedence,e),n.instance=o;case"stylesheet":d=vo(i.href);var f=e.querySelector(Gc(d));if(f)return n.state.loading|=4,n.instance=f,B(f),f;o=F_(i),(d=ta.get(d))&&Zm(o,d),f=(e.ownerDocument||e).createElement("link"),B(f);var v=f;return v._p=new Promise(function(w,O){v.onload=w,v.onerror=O}),Zn(f,"link",o),n.state.loading|=4,Wd(f,i.precedence,e),n.instance=f;case"script":return f=_o(i.src),(d=e.querySelector(Vc(f)))?(n.instance=d,B(d),d):(o=i,(d=ta.get(f))&&(o=g({},i),Wm(o,d)),e=e.ownerDocument||e,d=e.createElement("script"),B(d),Zn(d,"link",o),e.head.appendChild(d),n.instance=d);case"void":return null;default:throw Error(r(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(o=n.instance,n.state.loading|=4,Wd(o,i.precedence,e));return n.instance}function Wd(e,n,i){for(var o=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),d=o.length?o[o.length-1]:null,f=d,v=0;v<o.length;v++){var w=o[v];if(w.dataset.precedence===n)f=w;else if(f!==d)break}f?f.parentNode.insertBefore(e,f.nextSibling):(n=i.nodeType===9?i.head:i,n.insertBefore(e,n.firstChild))}function Zm(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function Wm(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var Xd=null;function G_(e,n,i){if(Xd===null){var o=new Map,d=Xd=new Map;d.set(i,o)}else d=Xd,o=d.get(i),o||(o=new Map,d.set(i,o));if(o.has(e))return o;for(o.set(e,null),i=i.getElementsByTagName(e),d=0;d<i.length;d++){var f=i[d];if(!(f[Jn]||f[ge]||e==="link"&&f.getAttribute("rel")==="stylesheet")&&f.namespaceURI!=="http://www.w3.org/2000/svg"){var v=f.getAttribute(n)||"";v=e+v;var w=o.get(v);w?w.push(f):o.set(v,[f])}}return o}function V_(e,n,i){e=e.ownerDocument||e,e.head.insertBefore(i,n==="title"?e.querySelector("head > title"):null)}function qj(e,n,i){if(i===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return e=n.disabled,typeof n.precedence=="string"&&e==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function K_(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function $j(e,n,i,o){if(i.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var d=vo(o.href),f=n.querySelector(Gc(d));if(f){n=f._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=Jd.bind(e),n.then(e,e)),i.state.loading|=4,i.instance=f,B(f);return}f=n.ownerDocument||n,o=F_(o),(d=ta.get(d))&&Zm(o,d),f=f.createElement("link"),B(f);var v=f;v._p=new Promise(function(w,O){v.onload=w,v.onerror=O}),Zn(f,"link",o),i.instance=f}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(i,n),(n=i.state.preload)&&(i.state.loading&3)===0&&(e.count++,i=Jd.bind(e),n.addEventListener("load",i),n.addEventListener("error",i))}}var Xm=0;function Hj(e,n){return e.stylesheets&&e.count===0&&tf(e,e.stylesheets),0<e.count||0<e.imgCount?function(i){var o=setTimeout(function(){if(e.stylesheets&&tf(e,e.stylesheets),e.unsuspend){var f=e.unsuspend;e.unsuspend=null,f()}},6e4+n);0<e.imgBytes&&Xm===0&&(Xm=62500*jj());var d=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&tf(e,e.stylesheets),e.unsuspend)){var f=e.unsuspend;e.unsuspend=null,f()}},(e.imgBytes>Xm?50:800)+n);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(o),clearTimeout(d)}}:null}function Jd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)tf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var ef=null;function tf(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ef=new Map,n.forEach(Fj,e),ef=null,Jd.call(e))}function Fj(e,n){if(!(n.state.loading&4)){var i=ef.get(e);if(i)var o=i.get(null);else{i=new Map,ef.set(e,i);for(var d=e.querySelectorAll("link[data-precedence],style[data-precedence]"),f=0;f<d.length;f++){var v=d[f];(v.nodeName==="LINK"||v.getAttribute("media")!=="not all")&&(i.set(v.dataset.precedence,v),o=v)}o&&i.set(null,o)}d=n.instance,v=d.getAttribute("data-precedence"),f=i.get(v)||o,f===o&&i.set(null,d),i.set(v,d),this.count++,o=Jd.bind(this),d.addEventListener("load",o),d.addEventListener("error",o),f?f.parentNode.insertBefore(d,f.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(d,e.firstChild)),n.state.loading|=4}}var Kc={$$typeof:$,Provider:null,Consumer:null,_currentValue:ee,_currentValue2:ee,_threadCount:0};function Qj(e,n,i,o,d,f,v,w,O){this.tag=1,this.containerInfo=e,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=gs(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gs(0),this.hiddenUpdates=gs(null),this.identifierPrefix=o,this.onUncaughtError=d,this.onCaughtError=f,this.onRecoverableError=v,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=O,this.incompleteTransitions=new Map}function Y_(e,n,i,o,d,f,v,w,O,J,fe,ve){return e=new Qj(e,n,i,v,O,J,fe,ve,w),n=1,f===!0&&(n|=24),f=ts(3,null,null,n),e.current=f,f.stateNode=e,n=Rh(),n.refCount++,e.pooledCache=n,n.refCount++,f.memoizedState={element:o,isDehydrated:i,cache:n},Lh(f),e}function Z_(e){return e?(e=Xa,e):Xa}function W_(e,n,i,o,d,f){d=Z_(d),o.context===null?o.context=d:o.pendingContext=d,o=Pi(n),o.payload={element:i},f=f===void 0?null:f,f!==null&&(o.callback=f),i=Ui(e,o,n),i!==null&&(ks(i,e,n),Nc(i,e,n))}function X_(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<n?i:n}}function Jm(e,n){X_(e,n),(e=e.alternate)&&X_(e,n)}function J_(e){if(e.tag===13||e.tag===31){var n=Oa(e,67108864);n!==null&&ks(n,e,67108864),Jm(e,67108864)}}function eb(e){if(e.tag===13||e.tag===31){var n=Fs();n=xa(n);var i=Oa(e,n);i!==null&&ks(i,e,n),Jm(e,n)}}var nf=!0;function Gj(e,n,i,o){var d=E.T;E.T=null;var f=U.p;try{U.p=2,ep(e,n,i,o)}finally{U.p=f,E.T=d}}function Vj(e,n,i,o){var d=E.T;E.T=null;var f=U.p;try{U.p=8,ep(e,n,i,o)}finally{U.p=f,E.T=d}}function ep(e,n,i,o){if(nf){var d=tp(o);if(d===null)Um(e,n,o,sf,i),nb(e,o);else if(Yj(d,e,n,i,o))o.stopPropagation();else if(nb(e,o),n&4&&-1<Kj.indexOf(e)){for(;d!==null;){var f=kn(d);if(f!==null)switch(f.tag){case 3:if(f=f.stateNode,f.current.memoizedState.isDehydrated){var v=at(f.pendingLanes);if(v!==0){var w=f;for(w.pendingLanes|=2,w.entangledLanes|=2;v;){var O=1<<31-De(v);w.entanglements[1]|=O,v&=~O}za(f),(Pt&6)===0&&(Pd=Re()+500,$c(0))}}break;case 31:case 13:w=Oa(f,2),w!==null&&ks(w,f,2),qd(),Jm(f,2)}if(f=tp(o),f===null&&Um(e,n,o,sf,i),f===d)break;d=f}d!==null&&o.stopPropagation()}else Um(e,n,o,null,i)}}function tp(e){return e=fn(e),np(e)}var sf=null;function np(e){if(sf=null,e=wn(e),e!==null){var n=u(e);if(n===null)e=null;else{var i=n.tag;if(i===13){if(e=h(n),e!==null)return e;e=null}else if(i===31){if(e=p(n),e!==null)return e;e=null}else if(i===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return sf=e,null}function tb(e){switch(e){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(Oe()){case Ke:return 2;case mt:return 8;case kt:case rn:return 32;case Bn:return 268435456;default:return 32}default:return 32}}var sp=!1,Wi=null,Xi=null,Ji=null,Yc=new Map,Zc=new Map,er=[],Kj="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 nb(e,n){switch(e){case"focusin":case"focusout":Wi=null;break;case"dragenter":case"dragleave":Xi=null;break;case"mouseover":case"mouseout":Ji=null;break;case"pointerover":case"pointerout":Yc.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Zc.delete(n.pointerId)}}function Wc(e,n,i,o,d,f){return e===null||e.nativeEvent!==f?(e={blockedOn:n,domEventName:i,eventSystemFlags:o,nativeEvent:f,targetContainers:[d]},n!==null&&(n=kn(n),n!==null&&J_(n)),e):(e.eventSystemFlags|=o,n=e.targetContainers,d!==null&&n.indexOf(d)===-1&&n.push(d),e)}function Yj(e,n,i,o,d){switch(n){case"focusin":return Wi=Wc(Wi,e,n,i,o,d),!0;case"dragenter":return Xi=Wc(Xi,e,n,i,o,d),!0;case"mouseover":return Ji=Wc(Ji,e,n,i,o,d),!0;case"pointerover":var f=d.pointerId;return Yc.set(f,Wc(Yc.get(f)||null,e,n,i,o,d)),!0;case"gotpointercapture":return f=d.pointerId,Zc.set(f,Wc(Zc.get(f)||null,e,n,i,o,d)),!0}return!1}function sb(e){var n=wn(e.target);if(n!==null){var i=u(n);if(i!==null){if(n=i.tag,n===13){if(n=h(i),n!==null){e.blockedOn=n,j(e.priority,function(){eb(i)});return}}else if(n===31){if(n=p(i),n!==null){e.blockedOn=n,j(e.priority,function(){eb(i)});return}}else if(n===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function af(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var i=tp(e.nativeEvent);if(i===null){i=e.nativeEvent;var o=new i.constructor(i.type,i);As=o,i.target.dispatchEvent(o),As=null}else return n=kn(i),n!==null&&J_(n),e.blockedOn=i,!1;n.shift()}return!0}function ab(e,n,i){af(e)&&i.delete(n)}function Zj(){sp=!1,Wi!==null&&af(Wi)&&(Wi=null),Xi!==null&&af(Xi)&&(Xi=null),Ji!==null&&af(Ji)&&(Ji=null),Yc.forEach(ab),Zc.forEach(ab)}function rf(e,n){e.blockedOn===n&&(e.blockedOn=null,sp||(sp=!0,s.unstable_scheduleCallback(s.unstable_NormalPriority,Zj)))}var lf=null;function ib(e){lf!==e&&(lf=e,s.unstable_scheduleCallback(s.unstable_NormalPriority,function(){lf===e&&(lf=null);for(var n=0;n<e.length;n+=3){var i=e[n],o=e[n+1],d=e[n+2];if(typeof o!="function"){if(np(o||i)===null)continue;break}var f=kn(i);f!==null&&(e.splice(n,3),n-=3,tm(f,{pending:!0,data:d,method:i.method,action:o},o,d))}}))}function bo(e){function n(O){return rf(O,e)}Wi!==null&&rf(Wi,e),Xi!==null&&rf(Xi,e),Ji!==null&&rf(Ji,e),Yc.forEach(n),Zc.forEach(n);for(var i=0;i<er.length;i++){var o=er[i];o.blockedOn===e&&(o.blockedOn=null)}for(;0<er.length&&(i=er[0],i.blockedOn===null);)sb(i),i.blockedOn===null&&er.shift();if(i=(e.ownerDocument||e).$$reactFormReplay,i!=null)for(o=0;o<i.length;o+=3){var d=i[o],f=i[o+1],v=d[we]||null;if(typeof f=="function")v||ib(i);else if(v){var w=null;if(f&&f.hasAttribute("formAction")){if(d=f,v=f[we]||null)w=v.formAction;else if(np(d)!==null)continue}else w=v.action;typeof w=="function"?i[o+1]=w:(i.splice(o,3),o-=3),ib(i)}}}function rb(){function e(f){f.canIntercept&&f.info==="react-transition"&&f.intercept({handler:function(){return new Promise(function(v){return d=v})},focusReset:"manual",scroll:"manual"})}function n(){d!==null&&(d(),d=null),o||setTimeout(i,20)}function i(){if(!o&&!navigation.transition){var f=navigation.currentEntry;f&&f.url!=null&&navigation.navigate(f.url,{state:f.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var o=!1,d=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(i,100),function(){o=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),d!==null&&(d(),d=null)}}}function ap(e){this._internalRoot=e}of.prototype.render=ap.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(r(409));var i=n.current,o=Fs();W_(i,o,e,n,null,null)},of.prototype.unmount=ap.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;W_(e.current,2,null,e,null,null),qd(),n[ke]=null}};function of(e){this._internalRoot=e}of.prototype.unstable_scheduleHydration=function(e){if(e){var n=rs();e={blockedOn:null,target:e,priority:n};for(var i=0;i<er.length&&n!==0&&n<er[i].priority;i++);er.splice(i,0,e),i===0&&sb(e)}};var lb=t.version;if(lb!=="19.2.4")throw Error(r(527,lb,"19.2.4"));U.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(r(188)):(e=Object.keys(e).join(","),Error(r(268,e)));return e=m(n),e=e!==null?x(e):null,e=e===null?null:e.stateNode,e};var Wj={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:E,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var cf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!cf.isDisabled&&cf.supportsFiber)try{ln=cf.inject(Wj),oe=cf}catch{}}return Jc.createRoot=function(e,n){if(!c(e))throw Error(r(299));var i=!1,o="",d=mv,f=pv,v=gv;return n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onUncaughtError!==void 0&&(d=n.onUncaughtError),n.onCaughtError!==void 0&&(f=n.onCaughtError),n.onRecoverableError!==void 0&&(v=n.onRecoverableError)),n=Y_(e,1,!1,null,null,i,o,null,d,f,v,rb),e[ke]=n.current,Pm(e),new ap(n)},Jc.hydrateRoot=function(e,n,i){if(!c(e))throw Error(r(299));var o=!1,d="",f=mv,v=pv,w=gv,O=null;return i!=null&&(i.unstable_strictMode===!0&&(o=!0),i.identifierPrefix!==void 0&&(d=i.identifierPrefix),i.onUncaughtError!==void 0&&(f=i.onUncaughtError),i.onCaughtError!==void 0&&(v=i.onCaughtError),i.onRecoverableError!==void 0&&(w=i.onRecoverableError),i.formState!==void 0&&(O=i.formState)),n=Y_(e,1,!0,n,i??null,o,d,O,f,v,w,rb),n.context=Z_(null),i=n.current,o=Fs(),o=xa(o),d=Pi(o),d.callback=null,Ui(i,d,o),i=o,n.current.lanes=i,as(n,i),za(n),e[ke]=n.current,Pm(e),new of(n)},Jc.version="19.2.4",Jc}var _b;function cw(){if(_b)return op.exports;_b=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(t){console.error(t)}}return s(),op.exports=ow(),op.exports}var uw=cw(),Yo=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(s){return this.listeners.add(s),this.onSubscribe(),()=>{this.listeners.delete(s),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},dw={setTimeout:(s,t)=>setTimeout(s,t),clearTimeout:s=>clearTimeout(s),setInterval:(s,t)=>setInterval(s,t),clearInterval:s=>clearInterval(s)},ur,Cg,T0,fw=(T0=class{constructor(){Je(this,ur,dw);Je(this,Cg,!1)}setTimeoutProvider(s){ze(this,ur,s)}setTimeout(s,t){return L(this,ur).setTimeout(s,t)}clearTimeout(s){L(this,ur).clearTimeout(s)}setInterval(s,t){return L(this,ur).setInterval(s,t)}clearInterval(s){L(this,ur).clearInterval(s)}},ur=new WeakMap,Cg=new WeakMap,T0),ll=new fw;function hw(s){setTimeout(s,0)}var kl=typeof window>"u"||"Deno"in globalThis;function fs(){}function mw(s,t){return typeof s=="function"?s(t):s}function Up(s){return typeof s=="number"&&s>=0&&s!==1/0}function q0(s,t){return Math.max(s+(t||0)-Date.now(),0)}function Sr(s,t){return typeof s=="function"?s(t):s}function sa(s,t){return typeof s=="function"?s(t):s}function bb(s,t){const{type:a="all",exact:r,fetchStatus:c,predicate:u,queryKey:h,stale:p}=s;if(h){if(r){if(t.queryHash!==Eg(h,t.options))return!1}else if(!bu(t.queryKey,h))return!1}if(a!=="all"){const y=t.isActive();if(a==="active"&&!y||a==="inactive"&&y)return!1}return!(typeof p=="boolean"&&t.isStale()!==p||c&&c!==t.state.fetchStatus||u&&!u(t))}function xb(s,t){const{exact:a,status:r,predicate:c,mutationKey:u}=s;if(u){if(!t.options.mutationKey)return!1;if(a){if(Nl(t.options.mutationKey)!==Nl(u))return!1}else if(!bu(t.options.mutationKey,u))return!1}return!(r&&t.state.status!==r||c&&!c(t))}function Eg(s,t){return((t==null?void 0:t.queryKeyHashFn)||Nl)(s)}function Nl(s){return JSON.stringify(s,(t,a)=>qp(a)?Object.keys(a).sort().reduce((r,c)=>(r[c]=a[c],r),{}):a)}function bu(s,t){return s===t?!0:typeof s!=typeof t?!1:s&&t&&typeof s=="object"&&typeof t=="object"?Object.keys(t).every(a=>bu(s[a],t[a])):!1}var pw=Object.prototype.hasOwnProperty;function $0(s,t,a=0){if(s===t)return s;if(a>500)return t;const r=Sb(s)&&Sb(t);if(!r&&!(qp(s)&&qp(t)))return t;const u=(r?s:Object.keys(s)).length,h=r?t:Object.keys(t),p=h.length,y=r?new Array(p):{};let m=0;for(let x=0;x<p;x++){const g=r?x:h[x],S=s[g],k=t[g];if(S===k){y[g]=S,(r?x<u:pw.call(s,g))&&m++;continue}if(S===null||k===null||typeof S!="object"||typeof k!="object"){y[g]=k;continue}const N=$0(S,k,a+1);y[g]=N,N===S&&m++}return u===p&&m===u?s:y}function Tf(s,t){if(!t||Object.keys(s).length!==Object.keys(t).length)return!1;for(const a in s)if(s[a]!==t[a])return!1;return!0}function Sb(s){return Array.isArray(s)&&s.length===Object.keys(s).length}function qp(s){if(!jb(s))return!1;const t=s.constructor;if(t===void 0)return!0;const a=t.prototype;return!(!jb(a)||!a.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(s)!==Object.prototype)}function jb(s){return Object.prototype.toString.call(s)==="[object Object]"}function gw(s){return new Promise(t=>{ll.setTimeout(t,s)})}function $p(s,t,a){return typeof a.structuralSharing=="function"?a.structuralSharing(s,t):a.structuralSharing!==!1?$0(s,t):t}function yw(s,t,a=0){const r=[...s,t];return a&&r.length>a?r.slice(1):r}function vw(s,t,a=0){const r=[t,...s];return a&&r.length>a?r.slice(0,-1):r}var Mg=Symbol();function H0(s,t){return!s.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!s.queryFn||s.queryFn===Mg?()=>Promise.reject(new Error(`Missing queryFn: '${s.queryHash}'`)):s.queryFn}function Rg(s,t){return typeof s=="function"?s(...t):!!s}function _w(s,t,a){let r=!1,c;return Object.defineProperty(s,"signal",{enumerable:!0,get:()=>(c??(c=t()),r||(r=!0,c.aborted?a():c.addEventListener("abort",a,{once:!0})),c)}),s}var dl,dr,Mo,E0,bw=(E0=class extends Yo{constructor(){super();Je(this,dl);Je(this,dr);Je(this,Mo);ze(this,Mo,t=>{if(!kl&&window.addEventListener){const a=()=>t();return window.addEventListener("visibilitychange",a,!1),()=>{window.removeEventListener("visibilitychange",a)}}})}onSubscribe(){L(this,dr)||this.setEventListener(L(this,Mo))}onUnsubscribe(){var t;this.hasListeners()||((t=L(this,dr))==null||t.call(this),ze(this,dr,void 0))}setEventListener(t){var a;ze(this,Mo,t),(a=L(this,dr))==null||a.call(this),ze(this,dr,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){L(this,dl)!==t&&(ze(this,dl,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(a=>{a(t)})}isFocused(){var t;return typeof L(this,dl)=="boolean"?L(this,dl):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},dl=new WeakMap,dr=new WeakMap,Mo=new WeakMap,E0),Ag=new bw;function Hp(){let s,t;const a=new Promise((c,u)=>{s=c,t=u});a.status="pending",a.catch(()=>{});function r(c){Object.assign(a,c),delete a.resolve,delete a.reject}return a.resolve=c=>{r({status:"fulfilled",value:c}),s(c)},a.reject=c=>{r({status:"rejected",reason:c}),t(c)},a}var xw=hw;function Sw(){let s=[],t=0,a=p=>{p()},r=p=>{p()},c=xw;const u=p=>{t?s.push(p):c(()=>{a(p)})},h=()=>{const p=s;s=[],p.length&&c(()=>{r(()=>{p.forEach(y=>{a(y)})})})};return{batch:p=>{let y;t++;try{y=p()}finally{t--,t||h()}return y},batchCalls:p=>(...y)=>{u(()=>{p(...y)})},schedule:u,setNotifyFunction:p=>{a=p},setBatchNotifyFunction:p=>{r=p},setScheduler:p=>{c=p}}}var zn=Sw(),Ro,fr,Ao,M0,jw=(M0=class extends Yo{constructor(){super();Je(this,Ro,!0);Je(this,fr);Je(this,Ao);ze(this,Ao,t=>{if(!kl&&window.addEventListener){const a=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",a,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",a),window.removeEventListener("offline",r)}}})}onSubscribe(){L(this,fr)||this.setEventListener(L(this,Ao))}onUnsubscribe(){var t;this.hasListeners()||((t=L(this,fr))==null||t.call(this),ze(this,fr,void 0))}setEventListener(t){var a;ze(this,Ao,t),(a=L(this,fr))==null||a.call(this),ze(this,fr,t(this.setOnline.bind(this)))}setOnline(t){L(this,Ro)!==t&&(ze(this,Ro,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return L(this,Ro)}},Ro=new WeakMap,fr=new WeakMap,Ao=new WeakMap,M0),Ef=new jw;function ww(s){return Math.min(1e3*2**s,3e4)}function F0(s){return(s??"online")==="online"?Ef.isOnline():!0}var Fp=class extends Error{constructor(s){super("CancelledError"),this.revert=s==null?void 0:s.revert,this.silent=s==null?void 0:s.silent}};function Q0(s){let t=!1,a=0,r;const c=Hp(),u=()=>c.status!=="pending",h=T=>{var C;if(!u()){const I=new Fp(T);S(I),(C=s.onCancel)==null||C.call(s,I)}},p=()=>{t=!0},y=()=>{t=!1},m=()=>Ag.isFocused()&&(s.networkMode==="always"||Ef.isOnline())&&s.canRun(),x=()=>F0(s.networkMode)&&s.canRun(),g=T=>{u()||(r==null||r(),c.resolve(T))},S=T=>{u()||(r==null||r(),c.reject(T))},k=()=>new Promise(T=>{var C;r=I=>{(u()||m())&&T(I)},(C=s.onPause)==null||C.call(s)}).then(()=>{var T;r=void 0,u()||(T=s.onContinue)==null||T.call(s)}),N=()=>{if(u())return;let T;const C=a===0?s.initialPromise:void 0;try{T=C??s.fn()}catch(I){T=Promise.reject(I)}Promise.resolve(T).then(g).catch(I=>{var ue;if(u())return;const V=s.retry??(kl?0:3),$=s.retryDelay??ww,R=typeof $=="function"?$(a,I):$,G=V===!0||typeof V=="number"&&a<V||typeof V=="function"&&V(a,I);if(t||!G){S(I);return}a++,(ue=s.onFail)==null||ue.call(s,a,I),gw(R).then(()=>m()?void 0:k()).then(()=>{t?S(I):N()})})};return{promise:c,status:()=>c.status,cancel:h,continue:()=>(r==null||r(),c),cancelRetry:p,continueRetry:y,canStart:x,start:()=>(x()?N():k().then(N),c)}}var fl,R0,G0=(R0=class{constructor(){Je(this,fl)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Up(this.gcTime)&&ze(this,fl,ll.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(s){this.gcTime=Math.max(this.gcTime||0,s??(kl?1/0:300*1e3))}clearGcTimeout(){L(this,fl)&&(ll.clearTimeout(L(this,fl)),ze(this,fl,void 0))}},fl=new WeakMap,R0),hl,Do,na,ml,Qn,Du,pl,_a,hi,A0,kw=(A0=class extends G0{constructor(t){super();Je(this,_a);Je(this,hl);Je(this,Do);Je(this,na);Je(this,ml);Je(this,Qn);Je(this,Du);Je(this,pl);ze(this,pl,!1),ze(this,Du,t.defaultOptions),this.setOptions(t.options),this.observers=[],ze(this,ml,t.client),ze(this,na,L(this,ml).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,ze(this,hl,kb(this.options)),this.state=t.state??L(this,hl),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=L(this,Qn))==null?void 0:t.promise}setOptions(t){if(this.options={...L(this,Du),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const a=kb(this.options);a.data!==void 0&&(this.setState(wb(a.data,a.dataUpdatedAt)),ze(this,hl,a))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&L(this,na).remove(this)}setData(t,a){const r=$p(this.state.data,t,this.options);return bt(this,_a,hi).call(this,{data:r,type:"success",dataUpdatedAt:a==null?void 0:a.updatedAt,manual:a==null?void 0:a.manual}),r}setState(t,a){bt(this,_a,hi).call(this,{type:"setState",state:t,setStateOptions:a})}cancel(t){var r,c;const a=(r=L(this,Qn))==null?void 0:r.promise;return(c=L(this,Qn))==null||c.cancel(t),a?a.then(fs).catch(fs):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(L(this,hl))}isActive(){return this.observers.some(t=>sa(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Mg||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Sr(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:!q0(this.state.dataUpdatedAt,t)}onFocus(){var a;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(a=L(this,Qn))==null||a.continue()}onOnline(){var a;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(a=L(this,Qn))==null||a.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),L(this,na).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(a=>a!==t),this.observers.length||(L(this,Qn)&&(L(this,pl)?L(this,Qn).cancel({revert:!0}):L(this,Qn).cancelRetry()),this.scheduleGc()),L(this,na).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||bt(this,_a,hi).call(this,{type:"invalidate"})}async fetch(t,a){var y,m,x,g,S,k,N,T,C,I,V,$;if(this.state.fetchStatus!=="idle"&&((y=L(this,Qn))==null?void 0:y.status())!=="rejected"){if(this.state.data!==void 0&&(a!=null&&a.cancelRefetch))this.cancel({silent:!0});else if(L(this,Qn))return L(this,Qn).continueRetry(),L(this,Qn).promise}if(t&&this.setOptions(t),!this.options.queryFn){const R=this.observers.find(G=>G.options.queryFn);R&&this.setOptions(R.options)}const r=new AbortController,c=R=>{Object.defineProperty(R,"signal",{enumerable:!0,get:()=>(ze(this,pl,!0),r.signal)})},u=()=>{const R=H0(this.options,a),ue=(()=>{const Z={client:L(this,ml),queryKey:this.queryKey,meta:this.meta};return c(Z),Z})();return ze(this,pl,!1),this.options.persister?this.options.persister(R,ue,this):R(ue)},p=(()=>{const R={fetchOptions:a,options:this.options,queryKey:this.queryKey,client:L(this,ml),state:this.state,fetchFn:u};return c(R),R})();(m=this.options.behavior)==null||m.onFetch(p,this),ze(this,Do,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((x=p.fetchOptions)==null?void 0:x.meta))&&bt(this,_a,hi).call(this,{type:"fetch",meta:(g=p.fetchOptions)==null?void 0:g.meta}),ze(this,Qn,Q0({initialPromise:a==null?void 0:a.initialPromise,fn:p.fetchFn,onCancel:R=>{R instanceof Fp&&R.revert&&this.setState({...L(this,Do),fetchStatus:"idle"}),r.abort()},onFail:(R,G)=>{bt(this,_a,hi).call(this,{type:"failed",failureCount:R,error:G})},onPause:()=>{bt(this,_a,hi).call(this,{type:"pause"})},onContinue:()=>{bt(this,_a,hi).call(this,{type:"continue"})},retry:p.options.retry,retryDelay:p.options.retryDelay,networkMode:p.options.networkMode,canRun:()=>!0}));try{const R=await L(this,Qn).start();if(R===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(R),(k=(S=L(this,na).config).onSuccess)==null||k.call(S,R,this),(T=(N=L(this,na).config).onSettled)==null||T.call(N,R,this.state.error,this),R}catch(R){if(R instanceof Fp){if(R.silent)return L(this,Qn).promise;if(R.revert){if(this.state.data===void 0)throw R;return this.state.data}}throw bt(this,_a,hi).call(this,{type:"error",error:R}),(I=(C=L(this,na).config).onError)==null||I.call(C,R,this),($=(V=L(this,na).config).onSettled)==null||$.call(V,this.state.data,R,this),R}finally{this.scheduleGc()}}},hl=new WeakMap,Do=new WeakMap,na=new WeakMap,ml=new WeakMap,Qn=new WeakMap,Du=new WeakMap,pl=new WeakMap,_a=new WeakSet,hi=function(t){const a=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...V0(r.data,this.options),fetchMeta:t.meta??null};case"success":const c={...r,...wb(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return ze(this,Do,t.manual?c:void 0),c;case"error":const u=t.error;return{...r,error:u,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:u,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=a(this.state),zn.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),L(this,na).notify({query:this,type:"updated",action:t})})},A0);function V0(s,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:F0(t.networkMode)?"fetching":"paused",...s===void 0&&{error:null,status:"pending"}}}function wb(s,t){return{data:s,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function kb(s){const t=typeof s.initialData=="function"?s.initialData():s.initialData,a=t!==void 0,r=a?typeof s.initialDataUpdatedAt=="function"?s.initialDataUpdatedAt():s.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:a?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:a?"success":"pending",fetchStatus:"idle"}}var Cs,Rt,Ou,us,gl,Oo,gi,hr,Lu,Lo,Io,yl,vl,mr,zo,qt,uu,Qp,Gp,Vp,Kp,Yp,Zp,Wp,K0,D0,Nw=(D0=class extends Yo{constructor(t,a){super();Je(this,qt);Je(this,Cs);Je(this,Rt);Je(this,Ou);Je(this,us);Je(this,gl);Je(this,Oo);Je(this,gi);Je(this,hr);Je(this,Lu);Je(this,Lo);Je(this,Io);Je(this,yl);Je(this,vl);Je(this,mr);Je(this,zo,new Set);this.options=a,ze(this,Cs,t),ze(this,hr,null),ze(this,gi,Hp()),this.bindMethods(),this.setOptions(a)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(L(this,Rt).addObserver(this),Nb(L(this,Rt),this.options)?bt(this,qt,uu).call(this):this.updateResult(),bt(this,qt,Kp).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Xp(L(this,Rt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Xp(L(this,Rt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,bt(this,qt,Yp).call(this),bt(this,qt,Zp).call(this),L(this,Rt).removeObserver(this)}setOptions(t){const a=this.options,r=L(this,Rt);if(this.options=L(this,Cs).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof sa(this.options.enabled,L(this,Rt))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");bt(this,qt,Wp).call(this),L(this,Rt).setOptions(this.options),a._defaulted&&!Tf(this.options,a)&&L(this,Cs).getQueryCache().notify({type:"observerOptionsUpdated",query:L(this,Rt),observer:this});const c=this.hasListeners();c&&Cb(L(this,Rt),r,this.options,a)&&bt(this,qt,uu).call(this),this.updateResult(),c&&(L(this,Rt)!==r||sa(this.options.enabled,L(this,Rt))!==sa(a.enabled,L(this,Rt))||Sr(this.options.staleTime,L(this,Rt))!==Sr(a.staleTime,L(this,Rt)))&&bt(this,qt,Qp).call(this);const u=bt(this,qt,Gp).call(this);c&&(L(this,Rt)!==r||sa(this.options.enabled,L(this,Rt))!==sa(a.enabled,L(this,Rt))||u!==L(this,mr))&&bt(this,qt,Vp).call(this,u)}getOptimisticResult(t){const a=L(this,Cs).getQueryCache().build(L(this,Cs),t),r=this.createResult(a,t);return Tw(this,r)&&(ze(this,us,r),ze(this,Oo,this.options),ze(this,gl,L(this,Rt).state)),r}getCurrentResult(){return L(this,us)}trackResult(t,a){return new Proxy(t,{get:(r,c)=>(this.trackProp(c),a==null||a(c),c==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&L(this,gi).status==="pending"&&L(this,gi).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,c))})}trackProp(t){L(this,zo).add(t)}getCurrentQuery(){return L(this,Rt)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const a=L(this,Cs).defaultQueryOptions(t),r=L(this,Cs).getQueryCache().build(L(this,Cs),a);return r.fetch().then(()=>this.createResult(r,a))}fetch(t){return bt(this,qt,uu).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),L(this,us)))}createResult(t,a){var te;const r=L(this,Rt),c=this.options,u=L(this,us),h=L(this,gl),p=L(this,Oo),m=t!==r?t.state:L(this,Ou),{state:x}=t;let g={...x},S=!1,k;if(a._optimisticResults){const Y=this.hasListeners(),H=!Y&&Nb(t,a),_e=Y&&Cb(t,r,a,c);(H||_e)&&(g={...g,...V0(x.data,t.options)}),a._optimisticResults==="isRestoring"&&(g.fetchStatus="idle")}let{error:N,errorUpdatedAt:T,status:C}=g;k=g.data;let I=!1;if(a.placeholderData!==void 0&&k===void 0&&C==="pending"){let Y;u!=null&&u.isPlaceholderData&&a.placeholderData===(p==null?void 0:p.placeholderData)?(Y=u.data,I=!0):Y=typeof a.placeholderData=="function"?a.placeholderData((te=L(this,Io))==null?void 0:te.state.data,L(this,Io)):a.placeholderData,Y!==void 0&&(C="success",k=$p(u==null?void 0:u.data,Y,a),S=!0)}if(a.select&&k!==void 0&&!I)if(u&&k===(h==null?void 0:h.data)&&a.select===L(this,Lu))k=L(this,Lo);else try{ze(this,Lu,a.select),k=a.select(k),k=$p(u==null?void 0:u.data,k,a),ze(this,Lo,k),ze(this,hr,null)}catch(Y){ze(this,hr,Y)}L(this,hr)&&(N=L(this,hr),k=L(this,Lo),T=Date.now(),C="error");const V=g.fetchStatus==="fetching",$=C==="pending",R=C==="error",G=$&&V,ue=k!==void 0,ie={status:C,fetchStatus:g.fetchStatus,isPending:$,isSuccess:C==="success",isError:R,isInitialLoading:G,isLoading:G,data:k,dataUpdatedAt:g.dataUpdatedAt,error:N,errorUpdatedAt:T,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:g.dataUpdateCount>0||g.errorUpdateCount>0,isFetchedAfterMount:g.dataUpdateCount>m.dataUpdateCount||g.errorUpdateCount>m.errorUpdateCount,isFetching:V,isRefetching:V&&!$,isLoadingError:R&&!ue,isPaused:g.fetchStatus==="paused",isPlaceholderData:S,isRefetchError:R&&ue,isStale:Dg(t,a),refetch:this.refetch,promise:L(this,gi),isEnabled:sa(a.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const Y=ie.data!==void 0,H=ie.status==="error"&&!Y,_e=ce=>{H?ce.reject(ie.error):Y&&ce.resolve(ie.data)},je=()=>{const ce=ze(this,gi,ie.promise=Hp());_e(ce)},ae=L(this,gi);switch(ae.status){case"pending":t.queryHash===r.queryHash&&_e(ae);break;case"fulfilled":(H||ie.data!==ae.value)&&je();break;case"rejected":(!H||ie.error!==ae.reason)&&je();break}}return ie}updateResult(){const t=L(this,us),a=this.createResult(L(this,Rt),this.options);if(ze(this,gl,L(this,Rt).state),ze(this,Oo,this.options),L(this,gl).data!==void 0&&ze(this,Io,L(this,Rt)),Tf(a,t))return;ze(this,us,a);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:c}=this.options,u=typeof c=="function"?c():c;if(u==="all"||!u&&!L(this,zo).size)return!0;const h=new Set(u??L(this,zo));return this.options.throwOnError&&h.add("error"),Object.keys(L(this,us)).some(p=>{const y=p;return L(this,us)[y]!==t[y]&&h.has(y)})};bt(this,qt,K0).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&bt(this,qt,Kp).call(this)}},Cs=new WeakMap,Rt=new WeakMap,Ou=new WeakMap,us=new WeakMap,gl=new WeakMap,Oo=new WeakMap,gi=new WeakMap,hr=new WeakMap,Lu=new WeakMap,Lo=new WeakMap,Io=new WeakMap,yl=new WeakMap,vl=new WeakMap,mr=new WeakMap,zo=new WeakMap,qt=new WeakSet,uu=function(t){bt(this,qt,Wp).call(this);let a=L(this,Rt).fetch(this.options,t);return t!=null&&t.throwOnError||(a=a.catch(fs)),a},Qp=function(){bt(this,qt,Yp).call(this);const t=Sr(this.options.staleTime,L(this,Rt));if(kl||L(this,us).isStale||!Up(t))return;const r=q0(L(this,us).dataUpdatedAt,t)+1;ze(this,yl,ll.setTimeout(()=>{L(this,us).isStale||this.updateResult()},r))},Gp=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(L(this,Rt)):this.options.refetchInterval)??!1},Vp=function(t){bt(this,qt,Zp).call(this),ze(this,mr,t),!(kl||sa(this.options.enabled,L(this,Rt))===!1||!Up(L(this,mr))||L(this,mr)===0)&&ze(this,vl,ll.setInterval(()=>{(this.options.refetchIntervalInBackground||Ag.isFocused())&&bt(this,qt,uu).call(this)},L(this,mr)))},Kp=function(){bt(this,qt,Qp).call(this),bt(this,qt,Vp).call(this,bt(this,qt,Gp).call(this))},Yp=function(){L(this,yl)&&(ll.clearTimeout(L(this,yl)),ze(this,yl,void 0))},Zp=function(){L(this,vl)&&(ll.clearInterval(L(this,vl)),ze(this,vl,void 0))},Wp=function(){const t=L(this,Cs).getQueryCache().build(L(this,Cs),this.options);if(t===L(this,Rt))return;const a=L(this,Rt);ze(this,Rt,t),ze(this,Ou,t.state),this.hasListeners()&&(a==null||a.removeObserver(this),t.addObserver(this))},K0=function(t){zn.batch(()=>{t.listeners&&this.listeners.forEach(a=>{a(L(this,us))}),L(this,Cs).getQueryCache().notify({query:L(this,Rt),type:"observerResultsUpdated"})})},D0);function Cw(s,t){return sa(t.enabled,s)!==!1&&s.state.data===void 0&&!(s.state.status==="error"&&t.retryOnMount===!1)}function Nb(s,t){return Cw(s,t)||s.state.data!==void 0&&Xp(s,t,t.refetchOnMount)}function Xp(s,t,a){if(sa(t.enabled,s)!==!1&&Sr(t.staleTime,s)!=="static"){const r=typeof a=="function"?a(s):a;return r==="always"||r!==!1&&Dg(s,t)}return!1}function Cb(s,t,a,r){return(s!==t||sa(r.enabled,s)===!1)&&(!a.suspense||s.state.status!=="error")&&Dg(s,a)}function Dg(s,t){return sa(t.enabled,s)!==!1&&s.isStaleByTime(Sr(t.staleTime,s))}function Tw(s,t){return!Tf(s.getCurrentResult(),t)}function Tb(s){return{onFetch:(t,a)=>{var x,g,S,k,N;const r=t.options,c=(S=(g=(x=t.fetchOptions)==null?void 0:x.meta)==null?void 0:g.fetchMore)==null?void 0:S.direction,u=((k=t.state.data)==null?void 0:k.pages)||[],h=((N=t.state.data)==null?void 0:N.pageParams)||[];let p={pages:[],pageParams:[]},y=0;const m=async()=>{let T=!1;const C=$=>{_w($,()=>t.signal,()=>T=!0)},I=H0(t.options,t.fetchOptions),V=async($,R,G)=>{if(T)return Promise.reject();if(R==null&&$.pages.length)return Promise.resolve($);const Z=(()=>{const H={client:t.client,queryKey:t.queryKey,pageParam:R,direction:G?"backward":"forward",meta:t.options.meta};return C(H),H})(),ie=await I(Z),{maxPages:te}=t.options,Y=G?vw:yw;return{pages:Y($.pages,ie,te),pageParams:Y($.pageParams,R,te)}};if(c&&u.length){const $=c==="backward",R=$?Ew:Eb,G={pages:u,pageParams:h},ue=R(r,G);p=await V(G,ue,$)}else{const $=s??u.length;do{const R=y===0?h[0]??r.initialPageParam:Eb(r,p);if(y>0&&R==null)break;p=await V(p,R),y++}while(y<$)}return p};t.options.persister?t.fetchFn=()=>{var T,C;return(C=(T=t.options).persister)==null?void 0:C.call(T,m,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},a)}:t.fetchFn=m}}}function Eb(s,{pages:t,pageParams:a}){const r=t.length-1;return t.length>0?s.getNextPageParam(t[r],t,a[r],a):void 0}function Ew(s,{pages:t,pageParams:a}){var r;return t.length>0?(r=s.getPreviousPageParam)==null?void 0:r.call(s,t[0],t,a[0],a):void 0}var Iu,Pa,ss,_l,Ua,ar,O0,Mw=(O0=class extends G0{constructor(t){super();Je(this,Ua);Je(this,Iu);Je(this,Pa);Je(this,ss);Je(this,_l);ze(this,Iu,t.client),this.mutationId=t.mutationId,ze(this,ss,t.mutationCache),ze(this,Pa,[]),this.state=t.state||Y0(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){L(this,Pa).includes(t)||(L(this,Pa).push(t),this.clearGcTimeout(),L(this,ss).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){ze(this,Pa,L(this,Pa).filter(a=>a!==t)),this.scheduleGc(),L(this,ss).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){L(this,Pa).length||(this.state.status==="pending"?this.scheduleGc():L(this,ss).remove(this))}continue(){var t;return((t=L(this,_l))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var h,p,y,m,x,g,S,k,N,T,C,I,V,$,R,G,ue,Z;const a=()=>{bt(this,Ua,ar).call(this,{type:"continue"})},r={client:L(this,Iu),meta:this.options.meta,mutationKey:this.options.mutationKey};ze(this,_l,Q0({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(ie,te)=>{bt(this,Ua,ar).call(this,{type:"failed",failureCount:ie,error:te})},onPause:()=>{bt(this,Ua,ar).call(this,{type:"pause"})},onContinue:a,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>L(this,ss).canRun(this)}));const c=this.state.status==="pending",u=!L(this,_l).canStart();try{if(c)a();else{bt(this,Ua,ar).call(this,{type:"pending",variables:t,isPaused:u}),L(this,ss).config.onMutate&&await L(this,ss).config.onMutate(t,this,r);const te=await((p=(h=this.options).onMutate)==null?void 0:p.call(h,t,r));te!==this.state.context&&bt(this,Ua,ar).call(this,{type:"pending",context:te,variables:t,isPaused:u})}const ie=await L(this,_l).start();return await((m=(y=L(this,ss).config).onSuccess)==null?void 0:m.call(y,ie,t,this.state.context,this,r)),await((g=(x=this.options).onSuccess)==null?void 0:g.call(x,ie,t,this.state.context,r)),await((k=(S=L(this,ss).config).onSettled)==null?void 0:k.call(S,ie,null,this.state.variables,this.state.context,this,r)),await((T=(N=this.options).onSettled)==null?void 0:T.call(N,ie,null,t,this.state.context,r)),bt(this,Ua,ar).call(this,{type:"success",data:ie}),ie}catch(ie){try{await((I=(C=L(this,ss).config).onError)==null?void 0:I.call(C,ie,t,this.state.context,this,r))}catch(te){Promise.reject(te)}try{await(($=(V=this.options).onError)==null?void 0:$.call(V,ie,t,this.state.context,r))}catch(te){Promise.reject(te)}try{await((G=(R=L(this,ss).config).onSettled)==null?void 0:G.call(R,void 0,ie,this.state.variables,this.state.context,this,r))}catch(te){Promise.reject(te)}try{await((Z=(ue=this.options).onSettled)==null?void 0:Z.call(ue,void 0,ie,t,this.state.context,r))}catch(te){Promise.reject(te)}throw bt(this,Ua,ar).call(this,{type:"error",error:ie}),ie}finally{L(this,ss).runNext(this)}}},Iu=new WeakMap,Pa=new WeakMap,ss=new WeakMap,_l=new WeakMap,Ua=new WeakSet,ar=function(t){const a=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,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{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=a(this.state),zn.batch(()=>{L(this,Pa).forEach(r=>{r.onMutationUpdate(t)}),L(this,ss).notify({mutation:this,type:"updated",action:t})})},O0);function Y0(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var yi,ba,zu,L0,Rw=(L0=class extends Yo{constructor(t={}){super();Je(this,yi);Je(this,ba);Je(this,zu);this.config=t,ze(this,yi,new Set),ze(this,ba,new Map),ze(this,zu,0)}build(t,a,r){const c=new Mw({client:t,mutationCache:this,mutationId:++uf(this,zu)._,options:t.defaultMutationOptions(a),state:r});return this.add(c),c}add(t){L(this,yi).add(t);const a=df(t);if(typeof a=="string"){const r=L(this,ba).get(a);r?r.push(t):L(this,ba).set(a,[t])}this.notify({type:"added",mutation:t})}remove(t){if(L(this,yi).delete(t)){const a=df(t);if(typeof a=="string"){const r=L(this,ba).get(a);if(r)if(r.length>1){const c=r.indexOf(t);c!==-1&&r.splice(c,1)}else r[0]===t&&L(this,ba).delete(a)}}this.notify({type:"removed",mutation:t})}canRun(t){const a=df(t);if(typeof a=="string"){const r=L(this,ba).get(a),c=r==null?void 0:r.find(u=>u.state.status==="pending");return!c||c===t}else return!0}runNext(t){var r;const a=df(t);if(typeof a=="string"){const c=(r=L(this,ba).get(a))==null?void 0:r.find(u=>u!==t&&u.state.isPaused);return(c==null?void 0:c.continue())??Promise.resolve()}else return Promise.resolve()}clear(){zn.batch(()=>{L(this,yi).forEach(t=>{this.notify({type:"removed",mutation:t})}),L(this,yi).clear(),L(this,ba).clear()})}getAll(){return Array.from(L(this,yi))}find(t){const a={exact:!0,...t};return this.getAll().find(r=>xb(a,r))}findAll(t={}){return this.getAll().filter(a=>xb(t,a))}notify(t){zn.batch(()=>{this.listeners.forEach(a=>{a(t)})})}resumePausedMutations(){const t=this.getAll().filter(a=>a.state.isPaused);return zn.batch(()=>Promise.all(t.map(a=>a.continue().catch(fs))))}},yi=new WeakMap,ba=new WeakMap,zu=new WeakMap,L0);function df(s){var t;return(t=s.options.scope)==null?void 0:t.id}var vi,pr,Ts,_i,ki,bf,Jp,I0,Aw=(I0=class extends Yo{constructor(a,r){super();Je(this,ki);Je(this,vi);Je(this,pr);Je(this,Ts);Je(this,_i);ze(this,vi,a),this.setOptions(r),this.bindMethods(),bt(this,ki,bf).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(a){var c;const r=this.options;this.options=L(this,vi).defaultMutationOptions(a),Tf(this.options,r)||L(this,vi).getMutationCache().notify({type:"observerOptionsUpdated",mutation:L(this,Ts),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Nl(r.mutationKey)!==Nl(this.options.mutationKey)?this.reset():((c=L(this,Ts))==null?void 0:c.state.status)==="pending"&&L(this,Ts).setOptions(this.options)}onUnsubscribe(){var a;this.hasListeners()||(a=L(this,Ts))==null||a.removeObserver(this)}onMutationUpdate(a){bt(this,ki,bf).call(this),bt(this,ki,Jp).call(this,a)}getCurrentResult(){return L(this,pr)}reset(){var a;(a=L(this,Ts))==null||a.removeObserver(this),ze(this,Ts,void 0),bt(this,ki,bf).call(this),bt(this,ki,Jp).call(this)}mutate(a,r){var c;return ze(this,_i,r),(c=L(this,Ts))==null||c.removeObserver(this),ze(this,Ts,L(this,vi).getMutationCache().build(L(this,vi),this.options)),L(this,Ts).addObserver(this),L(this,Ts).execute(a)}},vi=new WeakMap,pr=new WeakMap,Ts=new WeakMap,_i=new WeakMap,ki=new WeakSet,bf=function(){var r;const a=((r=L(this,Ts))==null?void 0:r.state)??Y0();ze(this,pr,{...a,isPending:a.status==="pending",isSuccess:a.status==="success",isError:a.status==="error",isIdle:a.status==="idle",mutate:this.mutate,reset:this.reset})},Jp=function(a){zn.batch(()=>{var r,c,u,h,p,y,m,x;if(L(this,_i)&&this.hasListeners()){const g=L(this,pr).variables,S=L(this,pr).context,k={client:L(this,vi),meta:this.options.meta,mutationKey:this.options.mutationKey};if((a==null?void 0:a.type)==="success"){try{(c=(r=L(this,_i)).onSuccess)==null||c.call(r,a.data,g,S,k)}catch(N){Promise.reject(N)}try{(h=(u=L(this,_i)).onSettled)==null||h.call(u,a.data,null,g,S,k)}catch(N){Promise.reject(N)}}else if((a==null?void 0:a.type)==="error"){try{(y=(p=L(this,_i)).onError)==null||y.call(p,a.error,g,S,k)}catch(N){Promise.reject(N)}try{(x=(m=L(this,_i)).onSettled)==null||x.call(m,void 0,a.error,g,S,k)}catch(N){Promise.reject(N)}}}this.listeners.forEach(g=>{g(L(this,pr))})})},I0),qa,z0,Dw=(z0=class extends Yo{constructor(t={}){super();Je(this,qa);this.config=t,ze(this,qa,new Map)}build(t,a,r){const c=a.queryKey,u=a.queryHash??Eg(c,a);let h=this.get(u);return h||(h=new kw({client:t,queryKey:c,queryHash:u,options:t.defaultQueryOptions(a),state:r,defaultOptions:t.getQueryDefaults(c)}),this.add(h)),h}add(t){L(this,qa).has(t.queryHash)||(L(this,qa).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const a=L(this,qa).get(t.queryHash);a&&(t.destroy(),a===t&&L(this,qa).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){zn.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return L(this,qa).get(t)}getAll(){return[...L(this,qa).values()]}find(t){const a={exact:!0,...t};return this.getAll().find(r=>bb(a,r))}findAll(t={}){const a=this.getAll();return Object.keys(t).length>0?a.filter(r=>bb(t,r)):a}notify(t){zn.batch(()=>{this.listeners.forEach(a=>{a(t)})})}onFocus(){zn.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){zn.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},qa=new WeakMap,z0),bn,gr,yr,Bo,Po,vr,Uo,qo,B0,Ow=(B0=class{constructor(s={}){Je(this,bn);Je(this,gr);Je(this,yr);Je(this,Bo);Je(this,Po);Je(this,vr);Je(this,Uo);Je(this,qo);ze(this,bn,s.queryCache||new Dw),ze(this,gr,s.mutationCache||new Rw),ze(this,yr,s.defaultOptions||{}),ze(this,Bo,new Map),ze(this,Po,new Map),ze(this,vr,0)}mount(){uf(this,vr)._++,L(this,vr)===1&&(ze(this,Uo,Ag.subscribe(async s=>{s&&(await this.resumePausedMutations(),L(this,bn).onFocus())})),ze(this,qo,Ef.subscribe(async s=>{s&&(await this.resumePausedMutations(),L(this,bn).onOnline())})))}unmount(){var s,t;uf(this,vr)._--,L(this,vr)===0&&((s=L(this,Uo))==null||s.call(this),ze(this,Uo,void 0),(t=L(this,qo))==null||t.call(this),ze(this,qo,void 0))}isFetching(s){return L(this,bn).findAll({...s,fetchStatus:"fetching"}).length}isMutating(s){return L(this,gr).findAll({...s,status:"pending"}).length}getQueryData(s){var a;const t=this.defaultQueryOptions({queryKey:s});return(a=L(this,bn).get(t.queryHash))==null?void 0:a.state.data}ensureQueryData(s){const t=this.defaultQueryOptions(s),a=L(this,bn).build(this,t),r=a.state.data;return r===void 0?this.fetchQuery(s):(s.revalidateIfStale&&a.isStaleByTime(Sr(t.staleTime,a))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(s){return L(this,bn).findAll(s).map(({queryKey:t,state:a})=>{const r=a.data;return[t,r]})}setQueryData(s,t,a){const r=this.defaultQueryOptions({queryKey:s}),c=L(this,bn).get(r.queryHash),u=c==null?void 0:c.state.data,h=mw(t,u);if(h!==void 0)return L(this,bn).build(this,r).setData(h,{...a,manual:!0})}setQueriesData(s,t,a){return zn.batch(()=>L(this,bn).findAll(s).map(({queryKey:r})=>[r,this.setQueryData(r,t,a)]))}getQueryState(s){var a;const t=this.defaultQueryOptions({queryKey:s});return(a=L(this,bn).get(t.queryHash))==null?void 0:a.state}removeQueries(s){const t=L(this,bn);zn.batch(()=>{t.findAll(s).forEach(a=>{t.remove(a)})})}resetQueries(s,t){const a=L(this,bn);return zn.batch(()=>(a.findAll(s).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...s},t)))}cancelQueries(s,t={}){const a={revert:!0,...t},r=zn.batch(()=>L(this,bn).findAll(s).map(c=>c.cancel(a)));return Promise.all(r).then(fs).catch(fs)}invalidateQueries(s,t={}){return zn.batch(()=>(L(this,bn).findAll(s).forEach(a=>{a.invalidate()}),(s==null?void 0:s.refetchType)==="none"?Promise.resolve():this.refetchQueries({...s,type:(s==null?void 0:s.refetchType)??(s==null?void 0:s.type)??"active"},t)))}refetchQueries(s,t={}){const a={...t,cancelRefetch:t.cancelRefetch??!0},r=zn.batch(()=>L(this,bn).findAll(s).filter(c=>!c.isDisabled()&&!c.isStatic()).map(c=>{let u=c.fetch(void 0,a);return a.throwOnError||(u=u.catch(fs)),c.state.fetchStatus==="paused"?Promise.resolve():u}));return Promise.all(r).then(fs)}fetchQuery(s){const t=this.defaultQueryOptions(s);t.retry===void 0&&(t.retry=!1);const a=L(this,bn).build(this,t);return a.isStaleByTime(Sr(t.staleTime,a))?a.fetch(t):Promise.resolve(a.state.data)}prefetchQuery(s){return this.fetchQuery(s).then(fs).catch(fs)}fetchInfiniteQuery(s){return s.behavior=Tb(s.pages),this.fetchQuery(s)}prefetchInfiniteQuery(s){return this.fetchInfiniteQuery(s).then(fs).catch(fs)}ensureInfiniteQueryData(s){return s.behavior=Tb(s.pages),this.ensureQueryData(s)}resumePausedMutations(){return Ef.isOnline()?L(this,gr).resumePausedMutations():Promise.resolve()}getQueryCache(){return L(this,bn)}getMutationCache(){return L(this,gr)}getDefaultOptions(){return L(this,yr)}setDefaultOptions(s){ze(this,yr,s)}setQueryDefaults(s,t){L(this,Bo).set(Nl(s),{queryKey:s,defaultOptions:t})}getQueryDefaults(s){const t=[...L(this,Bo).values()],a={};return t.forEach(r=>{bu(s,r.queryKey)&&Object.assign(a,r.defaultOptions)}),a}setMutationDefaults(s,t){L(this,Po).set(Nl(s),{mutationKey:s,defaultOptions:t})}getMutationDefaults(s){const t=[...L(this,Po).values()],a={};return t.forEach(r=>{bu(s,r.mutationKey)&&Object.assign(a,r.defaultOptions)}),a}defaultQueryOptions(s){if(s._defaulted)return s;const t={...L(this,yr).queries,...this.getQueryDefaults(s.queryKey),...s,_defaulted:!0};return t.queryHash||(t.queryHash=Eg(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===Mg&&(t.enabled=!1),t}defaultMutationOptions(s){return s!=null&&s._defaulted?s:{...L(this,yr).mutations,...(s==null?void 0:s.mutationKey)&&this.getMutationDefaults(s.mutationKey),...s,_defaulted:!0}}clear(){L(this,bn).clear(),L(this,gr).clear()}},bn=new WeakMap,gr=new WeakMap,yr=new WeakMap,Bo=new WeakMap,Po=new WeakMap,vr=new WeakMap,Uo=new WeakMap,qo=new WeakMap,B0),Z0=_.createContext(void 0),Tl=s=>{const t=_.useContext(Z0);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Lw=({client:s,children:t})=>(_.useEffect(()=>(s.mount(),()=>{s.unmount()}),[s]),l.jsx(Z0.Provider,{value:s,children:t})),W0=_.createContext(!1),Iw=()=>_.useContext(W0);W0.Provider;function zw(){let s=!1;return{clearReset:()=>{s=!1},reset:()=>{s=!0},isReset:()=>s}}var Bw=_.createContext(zw()),Pw=()=>_.useContext(Bw),Uw=(s,t,a)=>{const r=a!=null&&a.state.error&&typeof s.throwOnError=="function"?Rg(s.throwOnError,[a.state.error,a]):s.throwOnError;(s.suspense||s.experimental_prefetchInRender||r)&&(t.isReset()||(s.retryOnMount=!1))},qw=s=>{_.useEffect(()=>{s.clearReset()},[s])},$w=({result:s,errorResetBoundary:t,throwOnError:a,query:r,suspense:c})=>s.isError&&!t.isReset()&&!s.isFetching&&r&&(c&&s.data===void 0||Rg(a,[s.error,r])),Hw=s=>{if(s.suspense){const a=c=>c==="static"?c:Math.max(c??1e3,1e3),r=s.staleTime;s.staleTime=typeof r=="function"?(...c)=>a(r(...c)):a(r),typeof s.gcTime=="number"&&(s.gcTime=Math.max(s.gcTime,1e3))}},Fw=(s,t)=>s.isLoading&&s.isFetching&&!t,Qw=(s,t)=>(s==null?void 0:s.suspense)&&t.isPending,Mb=(s,t,a)=>t.fetchOptimistic(s).catch(()=>{a.clearReset()});function Gw(s,t,a){var S,k,N,T;const r=Iw(),c=Pw(),u=Tl(),h=u.defaultQueryOptions(s);(k=(S=u.getDefaultOptions().queries)==null?void 0:S._experimental_beforeQuery)==null||k.call(S,h);const p=u.getQueryCache().get(h.queryHash);h._optimisticResults=r?"isRestoring":"optimistic",Hw(h),Uw(h,c,p),qw(c);const y=!u.getQueryCache().get(h.queryHash),[m]=_.useState(()=>new t(u,h)),x=m.getOptimisticResult(h),g=!r&&s.subscribed!==!1;if(_.useSyncExternalStore(_.useCallback(C=>{const I=g?m.subscribe(zn.batchCalls(C)):fs;return m.updateResult(),I},[m,g]),()=>m.getCurrentResult(),()=>m.getCurrentResult()),_.useEffect(()=>{m.setOptions(h)},[h,m]),Qw(h,x))throw Mb(h,m,c);if($w({result:x,errorResetBoundary:c,throwOnError:h.throwOnError,query:p,suspense:h.suspense}))throw x.error;if((T=(N=u.getDefaultOptions().queries)==null?void 0:N._experimental_afterQuery)==null||T.call(N,h,x),h.experimental_prefetchInRender&&!kl&&Fw(x,r)){const C=y?Mb(h,m,c):p==null?void 0:p.promise;C==null||C.catch(fs).finally(()=>{m.updateResult()})}return h.notifyOnChangeProps?x:m.trackResult(x)}function Es(s,t){return Gw(s,Nw)}function Gn(s,t){const a=Tl(),[r]=_.useState(()=>new Aw(a,s));_.useEffect(()=>{r.setOptions(s)},[r,s]);const c=_.useSyncExternalStore(_.useCallback(h=>r.subscribe(zn.batchCalls(h)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),u=_.useCallback((h,p)=>{r.mutate(h,p).catch(fs)},[r]);if(c.error&&Rg(r.options.throwOnError,[c.error]))throw c.error;return{...c,mutate:u,mutateAsync:c.mutate}}var ff=typeof window<"u"?_.useLayoutEffect:_.useEffect;function fp(s){const t=_.useRef({value:s,prev:null}),a=t.current.value;return s!==a&&(t.current={value:s,prev:a}),t.current.prev}function Vw(s,t,a={},r={}){_.useEffect(()=>{if(!s.current||r.disabled||typeof IntersectionObserver!="function")return;const c=new IntersectionObserver(([u])=>{t(u)},a);return c.observe(s.current),()=>{c.disconnect()}},[t,a,r.disabled,s])}function Kw(s){const t=_.useRef(null);return _.useImperativeHandle(s,()=>t.current,[]),t}var Yw=!1;function xu(s){return s[s.length-1]}function Zw(s){return typeof s=="function"}function _r(s,t){return Zw(s)?s(t):s}var Ww=Object.prototype.hasOwnProperty,Rb=Object.prototype.propertyIsEnumerable,Xw=()=>Object.create(null),sl=(s,t)=>ol(s,t,Xw);function ol(s,t,a=()=>({}),r=0){if(s===t)return s;if(r>500)return t;const c=t,u=Ob(s)&&Ob(c);if(!u&&!(Mf(s)&&Mf(c)))return c;const h=u?s:Ab(s);if(!h)return c;const p=u?c:Ab(c);if(!p)return c;const y=h.length,m=p.length,x=u?new Array(m):a();let g=0;for(let S=0;S<m;S++){const k=u?S:p[S],N=s[k],T=c[k];if(N===T){x[k]=N,(u?S<y:Ww.call(s,k))&&g++;continue}if(N===null||T===null||typeof N!="object"||typeof T!="object"){x[k]=T;continue}const C=ol(N,T,a,r+1);x[k]=C,C===N&&g++}return y===m&&g===y?s:x}function Ab(s){const t=Object.getOwnPropertyNames(s);for(const c of t)if(!Rb.call(s,c))return!1;const a=Object.getOwnPropertySymbols(s);if(a.length===0)return t;const r=t;for(const c of a){if(!Rb.call(s,c))return!1;r.push(c)}return r}function Mf(s){if(!Db(s))return!1;const t=s.constructor;if(typeof t>"u")return!0;const a=t.prototype;return!(!Db(a)||!a.hasOwnProperty("isPrototypeOf"))}function Db(s){return Object.prototype.toString.call(s)==="[object Object]"}function Ob(s){return Array.isArray(s)&&s.length===Object.keys(s).length}function bl(s,t,a){if(s===t)return!0;if(typeof s!=typeof t)return!1;if(Array.isArray(s)&&Array.isArray(t)){if(s.length!==t.length)return!1;for(let r=0,c=s.length;r<c;r++)if(!bl(s[r],t[r],a))return!1;return!0}if(Mf(s)&&Mf(t)){const r=(a==null?void 0:a.ignoreUndefined)??!0;if(a!=null&&a.partial){for(const h in t)if((!r||t[h]!==void 0)&&!bl(s[h],t[h],a))return!1;return!0}let c=0;if(!r)c=Object.keys(s).length;else for(const h in s)s[h]!==void 0&&c++;let u=0;for(const h in t)if((!r||t[h]!==void 0)&&(u++,u>c||!bl(s[h],t[h],a)))return!1;return c===u}return!1}function $o(s){let t,a;const r=new Promise((c,u)=>{t=c,a=u});return r.status="pending",r.resolve=c=>{r.status="resolved",r.value=c,t(c),s==null||s(c)},r.reject=c=>{r.status="rejected",a(c)},r}function Su(s){return!!(s&&typeof s=="object"&&typeof s.then=="function")}function Jw(s){return s.replace(/[\x00-\x1f\x7f]/g,"")}function Lb(s){let t;try{t=decodeURI(s)}catch{t=s.replaceAll(/%[0-9A-F]{2}/gi,a=>{try{return decodeURI(a)}catch{return a}})}return Jw(t)}var ek=["http:","https:","mailto:","tel:"];function Rf(s,t){if(!s)return!1;try{const a=new URL(s);return!t.has(a.protocol)}catch{return!1}}function eu(s){if(!s)return{path:s,handledProtocolRelativeURL:!1};if(!/[%\\\x00-\x1f\x7f]/.test(s)&&!s.startsWith("//"))return{path:s,handledProtocolRelativeURL:!1};const t=/%25|%5C/gi;let a=0,r="",c;for(;(c=t.exec(s))!==null;)r+=Lb(s.slice(a,c.index))+c[0],a=t.lastIndex;r=r+Lb(a?s.slice(a):s);let u=!1;return r.startsWith("//")&&(u=!0,r="/"+r.replace(/^\/+/,"")),{path:r,handledProtocolRelativeURL:u}}function tk(s){return/\s|[^\u0000-\u007F]/.test(s)?s.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):s}function Af(s){const t=new Map;let a,r;const c=u=>{u.next&&(u.prev?(u.prev.next=u.next,u.next.prev=u.prev,u.next=void 0,r&&(r.next=u,u.prev=r)):(u.next.prev=void 0,a=u.next,u.next=void 0,r&&(u.prev=r,r.next=u)),r=u)};return{get(u){const h=t.get(u);if(h)return c(h),h.value},set(u,h){if(t.size>=s&&a){const y=a;t.delete(y.key),y.next&&(a=y.next,y.next.prev=void 0),y===r&&(r=void 0)}const p=t.get(u);if(p)p.value=h,c(p);else{const y={key:u,value:h,prev:r};r&&(r.next=y),r=y,a||(a=y),t.set(u,y)}},clear(){t.clear(),a=void 0,r=void 0}}}var nk="Invariant failed";function Cr(s,t){if(!s)throw new Error(nk)}var cl=4,X0=5;function sk(s){const t=s.indexOf("{");if(t===-1)return null;const a=s.indexOf("}",t);return a===-1||t+1>=s.length?null:[t,a]}function Og(s,t,a=new Uint16Array(6)){const r=s.indexOf("/",t),c=r===-1?s.length:r,u=s.substring(t,c);if(!u||!u.includes("$"))return a[0]=0,a[1]=t,a[2]=t,a[3]=c,a[4]=c,a[5]=c,a;if(u==="$"){const p=s.length;return a[0]=2,a[1]=t,a[2]=t,a[3]=p,a[4]=p,a[5]=p,a}if(u.charCodeAt(0)===36)return a[0]=1,a[1]=t,a[2]=t+1,a[3]=c,a[4]=c,a[5]=c,a;const h=sk(u);if(h){const[p,y]=h,m=u.charCodeAt(p+1);if(m===45){if(p+2<u.length&&u.charCodeAt(p+2)===36){const x=p+3,g=y;if(x<g)return a[0]=3,a[1]=t+p,a[2]=t+x,a[3]=t+g,a[4]=t+y+1,a[5]=c,a}}else if(m===36){const x=p+1,g=p+2;return g===y?(a[0]=2,a[1]=t+p,a[2]=t+x,a[3]=t+g,a[4]=t+y+1,a[5]=s.length,a):(a[0]=1,a[1]=t+p,a[2]=t+g,a[3]=t+y,a[4]=t+y+1,a[5]=c,a)}}return a[0]=0,a[1]=t,a[2]=t,a[3]=c,a[4]=c,a[5]=c,a}function Wf(s,t,a,r,c,u,h){var y,m,x,g,S,k,N,T,C,I,V,$,R;h==null||h(a);let p=r;{const G=a.fullPath??a.from,ue=G.length,Z=((y=a.options)==null?void 0:y.caseSensitive)??s,ie=!!((x=(m=a.options)==null?void 0:m.params)!=null&&x.parse&&((S=(g=a.options)==null?void 0:g.skipRouteOnParseError)!=null&&S.params));for(;p<ue;){const Y=Og(G,p,t);let H;const _e=p,je=Y[5];switch(p=je+1,u++,Y[0]){case 0:{const ae=G.substring(Y[2],Y[3]);if(Z){const ce=(k=c.static)==null?void 0:k.get(ae);if(ce)H=ce;else{c.static??(c.static=new Map);const E=ul(a.fullPath??a.from);E.parent=c,E.depth=u,H=E,c.static.set(ae,E)}}else{const ce=ae.toLowerCase(),E=(N=c.staticInsensitive)==null?void 0:N.get(ce);if(E)H=E;else{c.staticInsensitive??(c.staticInsensitive=new Map);const U=ul(a.fullPath??a.from);U.parent=c,U.depth=u,H=U,c.staticInsensitive.set(ce,U)}}break}case 1:{const ae=G.substring(_e,Y[1]),ce=G.substring(Y[4],je),E=Z&&!!(ae||ce),U=ae?E?ae:ae.toLowerCase():void 0,ee=ce?E?ce:ce.toLowerCase():void 0,W=!ie&&((T=c.dynamic)==null?void 0:T.find(xe=>!xe.skipOnParamError&&xe.caseSensitive===E&&xe.prefix===U&&xe.suffix===ee));if(W)H=W;else{const xe=mp(1,a.fullPath??a.from,E,U,ee);H=xe,xe.depth=u,xe.parent=c,c.dynamic??(c.dynamic=[]),c.dynamic.push(xe)}break}case 3:{const ae=G.substring(_e,Y[1]),ce=G.substring(Y[4],je),E=Z&&!!(ae||ce),U=ae?E?ae:ae.toLowerCase():void 0,ee=ce?E?ce:ce.toLowerCase():void 0,W=!ie&&((C=c.optional)==null?void 0:C.find(xe=>!xe.skipOnParamError&&xe.caseSensitive===E&&xe.prefix===U&&xe.suffix===ee));if(W)H=W;else{const xe=mp(3,a.fullPath??a.from,E,U,ee);H=xe,xe.parent=c,xe.depth=u,c.optional??(c.optional=[]),c.optional.push(xe)}break}case 2:{const ae=G.substring(_e,Y[1]),ce=G.substring(Y[4],je),E=Z&&!!(ae||ce),U=ae?E?ae:ae.toLowerCase():void 0,ee=ce?E?ce:ce.toLowerCase():void 0,W=mp(2,a.fullPath??a.from,E,U,ee);H=W,W.parent=c,W.depth=u,c.wildcard??(c.wildcard=[]),c.wildcard.push(W)}}c=H}if(ie&&a.children&&!a.isRoot&&a.id&&a.id.charCodeAt(a.id.lastIndexOf("/")+1)===95){const Y=ul(a.fullPath??a.from);Y.kind=X0,Y.parent=c,u++,Y.depth=u,c.pathless??(c.pathless=[]),c.pathless.push(Y),c=Y}const te=(a.path||!a.children)&&!a.isRoot;if(te&&G.endsWith("/")){const Y=ul(a.fullPath??a.from);Y.kind=cl,Y.parent=c,u++,Y.depth=u,c.index=Y,c=Y}c.parse=((V=(I=a.options)==null?void 0:I.params)==null?void 0:V.parse)??null,c.skipOnParamError=ie,c.parsingPriority=((R=($=a.options)==null?void 0:$.skipRouteOnParseError)==null?void 0:R.priority)??0,te&&!c.route&&(c.route=a,c.fullPath=a.fullPath??a.from)}if(a.children)for(const G of a.children)Wf(s,t,G,p,c,u,h)}function hp(s,t){if(s.skipOnParamError&&!t.skipOnParamError)return-1;if(!s.skipOnParamError&&t.skipOnParamError)return 1;if(s.skipOnParamError&&t.skipOnParamError&&(s.parsingPriority||t.parsingPriority))return t.parsingPriority-s.parsingPriority;if(s.prefix&&t.prefix&&s.prefix!==t.prefix){if(s.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(s.prefix))return 1}if(s.suffix&&t.suffix&&s.suffix!==t.suffix){if(s.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(s.suffix))return 1}return s.prefix&&!t.prefix?-1:!s.prefix&&t.prefix?1:s.suffix&&!t.suffix?-1:!s.suffix&&t.suffix?1:s.caseSensitive&&!t.caseSensitive?-1:!s.caseSensitive&&t.caseSensitive?1:0}function rr(s){var t,a,r;if(s.pathless)for(const c of s.pathless)rr(c);if(s.static)for(const c of s.static.values())rr(c);if(s.staticInsensitive)for(const c of s.staticInsensitive.values())rr(c);if((t=s.dynamic)!=null&&t.length){s.dynamic.sort(hp);for(const c of s.dynamic)rr(c)}if((a=s.optional)!=null&&a.length){s.optional.sort(hp);for(const c of s.optional)rr(c)}if((r=s.wildcard)!=null&&r.length){s.wildcard.sort(hp);for(const c of s.wildcard)rr(c)}}function ul(s){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:s,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0}}function mp(s,t,a,r,c){return{kind:s,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:r,suffix:c}}function ak(s,t){const a=ul("/"),r=new Uint16Array(6);for(const c of s)Wf(!1,r,c,1,a,0);rr(a),t.masksTree=a,t.flatCache=Af(1e3)}function ik(s,t){s||(s="/");const a=t.flatCache.get(s);if(a)return a;const r=Lg(s,t.masksTree);return t.flatCache.set(s,r),r}function rk(s,t,a,r,c){s||(s="/"),r||(r="/");const u=t?`case\0${s}`:s;let h=c.singleCache.get(u);return h||(h=ul("/"),Wf(t,new Uint16Array(6),{from:s},1,h,0),c.singleCache.set(u,h)),Lg(r,h,a)}function lk(s,t,a=!1){const r=a?s:`nofuzz\0${s}`,c=t.matchCache.get(r);if(c!==void 0)return c;s||(s="/");let u;try{u=Lg(s,t.segmentTree,a)}catch(h){if(h instanceof URIError)u=null;else throw h}return u&&(u.branch=uk(u.route)),t.matchCache.set(r,u),u}function ok(s){return s==="/"?s:s.replace(/\/{1,}$/,"")}function ck(s,t=!1,a){const r=ul(s.fullPath),c=new Uint16Array(6),u={},h={};let p=0;return Wf(t,c,s,1,r,0,y=>{if(a==null||a(y,p),Cr(!(y.id in u),`Duplicate routes found with id: ${String(y.id)}`),u[y.id]=y,p!==0&&y.path){const m=ok(y.fullPath);(!h[m]||y.fullPath.endsWith("/"))&&(h[m]=y)}p++}),rr(r),{processedTree:{segmentTree:r,singleCache:Af(1e3),matchCache:Af(1e3),flatCache:null,masksTree:null},routesById:u,routesByPath:h}}function Lg(s,t,a=!1){const r=s.split("/"),c=fk(s,r,t,a);if(!c)return null;const[u]=J0(s,r,c);return{route:c.node.route,rawParams:u,parsedParams:c.parsedParams}}function J0(s,t,a){var x,g,S,k,N,T,C,I,V,$;const r=dk(a.node);let c=null;const u=Object.create(null);let h=((x=a.extract)==null?void 0:x.part)??0,p=((g=a.extract)==null?void 0:g.node)??0,y=((S=a.extract)==null?void 0:S.path)??0,m=((k=a.extract)==null?void 0:k.segment)??0;for(;p<r.length;h++,p++,y++,m++){const R=r[p];if(R.kind===cl)break;if(R.kind===X0){m--,h--,y--;continue}const G=t[h],ue=y;if(G&&(y+=G.length),R.kind===1){c??(c=a.node.fullPath.split("/"));const Z=c[m],ie=((N=R.prefix)==null?void 0:N.length)??0;if(Z.charCodeAt(ie)===123){const te=((T=R.suffix)==null?void 0:T.length)??0,Y=Z.substring(ie+2,Z.length-te-1),H=G.substring(ie,G.length-te);u[Y]=decodeURIComponent(H)}else{const te=Z.substring(1);u[te]=decodeURIComponent(G)}}else if(R.kind===3){if(a.skipped&1<<p){h--,y=ue-1;continue}c??(c=a.node.fullPath.split("/"));const Z=c[m],ie=((C=R.prefix)==null?void 0:C.length)??0,te=((I=R.suffix)==null?void 0:I.length)??0,Y=Z.substring(ie+3,Z.length-te-1),H=R.suffix||R.prefix?G.substring(ie,G.length-te):G;H&&(u[Y]=decodeURIComponent(H))}else if(R.kind===2){const Z=R,ie=s.substring(ue+(((V=Z.prefix)==null?void 0:V.length)??0),s.length-((($=Z.suffix)==null?void 0:$.length)??0)),te=decodeURIComponent(ie);u["*"]=te,u._splat=te;break}}return a.rawParams&&Object.assign(u,a.rawParams),[u,{part:h,node:p,path:y,segment:m}]}function uk(s){const t=[s];for(;s.parentRoute;)s=s.parentRoute,t.push(s);return t.reverse(),t}function dk(s){const t=Array(s.depth+1);do t[s.depth]=s,s=s.parent;while(s);return t}function fk(s,t,a,r){if(s==="/"&&a.index)return{node:a.index,skipped:0};const c=!xu(t),u=c&&s!=="/",h=t.length-(c?1:0),p=[{node:a,index:1,skipped:0,depth:1,statics:1,dynamics:0,optionals:0}];let y=null,m=null,x=null;for(;p.length;){const g=p.pop(),{node:S,index:k,skipped:N,depth:T,statics:C,dynamics:I,optionals:V}=g;let{extract:$,rawParams:R,parsedParams:G}=g;if(S.skipOnParamError){if(!pp(s,t,g))continue;R=g.rawParams,$=g.extract,G=g.parsedParams}r&&S.route&&S.kind!==cl&&tu(m,g)&&(m=g);const ue=k===h;if(ue&&(S.route&&!u&&tu(x,g)&&(x=g),!S.optional&&!S.wildcard&&!S.index&&!S.pathless))continue;const Z=ue?void 0:t[k];let ie;if(ue&&S.index){const te={node:S.index,index:k,skipped:N,depth:T+1,statics:C,dynamics:I,optionals:V,extract:$,rawParams:R,parsedParams:G};let Y=!0;if(S.index.skipOnParamError&&(pp(s,t,te)||(Y=!1)),Y){if(C===h&&!I&&!V&&!N)return te;tu(x,te)&&(x=te)}}if(S.wildcard&&tu(y,g))for(const te of S.wildcard){const{prefix:Y,suffix:H}=te;if(Y&&(ue||!(te.caseSensitive?Z:ie??(ie=Z.toLowerCase())).startsWith(Y)))continue;if(H){if(ue)continue;const je=t.slice(k).join("/").slice(-H.length);if((te.caseSensitive?je:je.toLowerCase())!==H)continue}const _e={node:te,index:h,skipped:N,depth:T,statics:C,dynamics:I,optionals:V,extract:$,rawParams:R,parsedParams:G};if(!(te.skipOnParamError&&!pp(s,t,_e))){y=_e;break}}if(S.optional){const te=N|1<<T,Y=T+1;for(let H=S.optional.length-1;H>=0;H--){const _e=S.optional[H];p.push({node:_e,index:k,skipped:te,depth:Y,statics:C,dynamics:I,optionals:V,extract:$,rawParams:R,parsedParams:G})}if(!ue)for(let H=S.optional.length-1;H>=0;H--){const _e=S.optional[H],{prefix:je,suffix:ae}=_e;if(je||ae){const ce=_e.caseSensitive?Z:ie??(ie=Z.toLowerCase());if(je&&!ce.startsWith(je)||ae&&!ce.endsWith(ae))continue}p.push({node:_e,index:k+1,skipped:N,depth:Y,statics:C,dynamics:I,optionals:V+1,extract:$,rawParams:R,parsedParams:G})}}if(!ue&&S.dynamic&&Z)for(let te=S.dynamic.length-1;te>=0;te--){const Y=S.dynamic[te],{prefix:H,suffix:_e}=Y;if(H||_e){const je=Y.caseSensitive?Z:ie??(ie=Z.toLowerCase());if(H&&!je.startsWith(H)||_e&&!je.endsWith(_e))continue}p.push({node:Y,index:k+1,skipped:N,depth:T+1,statics:C,dynamics:I+1,optionals:V,extract:$,rawParams:R,parsedParams:G})}if(!ue&&S.staticInsensitive){const te=S.staticInsensitive.get(ie??(ie=Z.toLowerCase()));te&&p.push({node:te,index:k+1,skipped:N,depth:T+1,statics:C+1,dynamics:I,optionals:V,extract:$,rawParams:R,parsedParams:G})}if(!ue&&S.static){const te=S.static.get(Z);te&&p.push({node:te,index:k+1,skipped:N,depth:T+1,statics:C+1,dynamics:I,optionals:V,extract:$,rawParams:R,parsedParams:G})}if(S.pathless){const te=T+1;for(let Y=S.pathless.length-1;Y>=0;Y--){const H=S.pathless[Y];p.push({node:H,index:k,skipped:N,depth:te,statics:C,dynamics:I,optionals:V,extract:$,rawParams:R,parsedParams:G})}}}if(x&&y)return tu(y,x)?x:y;if(x)return x;if(y)return y;if(r&&m){let g=m.index;for(let k=0;k<m.index;k++)g+=t[k].length;const S=g===s.length?"/":s.slice(g);return m.rawParams??(m.rawParams=Object.create(null)),m.rawParams["**"]=decodeURIComponent(S),m}return null}function pp(s,t,a){try{const[r,c]=J0(s,t,a);a.rawParams=r,a.extract=c;const u=a.node.parse(r);return a.parsedParams=Object.assign(Object.create(null),a.parsedParams,u),!0}catch{return null}}function tu(s,t){return s?t.statics>s.statics||t.statics===s.statics&&(t.dynamics>s.dynamics||t.dynamics===s.dynamics&&(t.optionals>s.optionals||t.optionals===s.optionals&&((t.node.kind===cl)>(s.node.kind===cl)||t.node.kind===cl==(s.node.kind===cl)&&t.depth>s.depth))):!0}function xf(s){return Ig(s.filter(t=>t!==void 0).join("/"))}function Ig(s){return s.replace(/\/{2,}/g,"/")}function eS(s){return s==="/"?s:s.replace(/^\/{1,}/,"")}function jr(s){const t=s.length;return t>1&&s[t-1]==="/"?s.replace(/\/{1,}$/,""):s}function tS(s){return jr(eS(s))}function Df(s,t){return s!=null&&s.endsWith("/")&&s!=="/"&&s!==`${t}/`?s.slice(0,-1):s}function hk(s,t,a){return Df(s,a)===Df(t,a)}function mk({base:s,to:t,trailingSlash:a="never",cache:r}){const c=t.startsWith("/"),u=!c&&t===".";let h;if(r){h=c?t:u?s:s+"\0"+t;const g=r.get(h);if(g)return g}let p;if(u)p=s.split("/");else if(c)p=t.split("/");else{for(p=s.split("/");p.length>1&&xu(p)==="";)p.pop();const g=t.split("/");for(let S=0,k=g.length;S<k;S++){const N=g[S];N===""?S?S===k-1&&p.push(N):p=[N]:N===".."?p.pop():N==="."||p.push(N)}}p.length>1&&(xu(p)===""?a==="never"&&p.pop():a==="always"&&p.push(""));let y,m="";for(let g=0;g<p.length;g++){g>0&&(m+="/");const S=p[g];if(!S)continue;y=Og(S,0,y);const k=y[0];if(k===0){m+=S;continue}const N=y[5],T=S.substring(0,y[1]),C=S.substring(y[4],N),I=S.substring(y[2],y[3]);k===1?m+=T||C?`${T}{$${I}}${C}`:`$${I}`:k===2?m+=T||C?`${T}{$}${C}`:"$":m+=`${T}{-$${I}}${C}`}m=Ig(m);const x=m||"/";return h&&r&&r.set(h,x),x}function pk(s){const t=new Map(s.map(c=>[encodeURIComponent(c),c])),a=Array.from(t.keys()).map(c=>c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),r=new RegExp(a,"g");return c=>c.replace(r,u=>t.get(u)??u)}function gp(s,t,a){const r=t[s];return typeof r!="string"?r:s==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split("/").map(c=>zb(c,a)).join("/"):zb(r,a)}function Ib({path:s,params:t,decoder:a,...r}){let c=!1;const u=Object.create(null);if(!s||s==="/")return{interpolatedPath:"/",usedParams:u,isMissingParams:c};if(!s.includes("$"))return{interpolatedPath:s,usedParams:u,isMissingParams:c};const h=s.length;let p=0,y,m="";for(;p<h;){const x=p;y=Og(s,x,y);const g=y[5];if(p=g+1,x===g)continue;const S=y[0];if(S===0){m+="/"+s.substring(x,g);continue}if(S===2){const k=t._splat;u._splat=k,u["*"]=k;const N=s.substring(x,y[1]),T=s.substring(y[4],g);if(!k){c=!0,(N||T)&&(m+="/"+N+T);continue}const C=gp("_splat",t,a);m+="/"+N+C+T;continue}if(S===1){const k=s.substring(y[2],y[3]);!c&&!(k in t)&&(c=!0),u[k]=t[k];const N=s.substring(x,y[1]),T=s.substring(y[4],g),C=gp(k,t,a)??"undefined";m+="/"+N+C+T;continue}if(S===3){const k=s.substring(y[2],y[3]),N=t[k];if(N==null)continue;u[k]=N;const T=s.substring(x,y[1]),C=s.substring(y[4],g),I=gp(k,t,a)??"";m+="/"+T+I+C;continue}}return s.endsWith("/")&&(m+="/"),{usedParams:u,interpolatedPath:m||"/",isMissingParams:c}}function zb(s,t){const a=encodeURIComponent(s);return(t==null?void 0:t(a))??a}function hs(s){return!!(s!=null&&s.isNotFound)}function gk(){try{if(typeof window<"u"&&typeof window.sessionStorage=="object")return window.sessionStorage}catch{}}var eg="tsr-scroll-restoration-v1_3",yk=(s,t)=>{let a;return(...r)=>{a||(a=setTimeout(()=>{s(...r),a=null},t))}};function vk(){const s=gk();if(!s)return null;const t=s.getItem(eg);let a=t?JSON.parse(t):{};return{state:a,set:r=>{a=_r(r,a)||a;try{s.setItem(eg,JSON.stringify(a))}catch{console.warn("[ts-router] Could not persist scroll restoration state to sessionStorage.")}}}}var hf=vk(),_k=s=>s.state.__TSR_key||s.href;function bk(s){const t=[];let a;for(;a=s.parentNode;)t.push(`${s.tagName}:nth-child(${Array.prototype.indexOf.call(a.children,s)+1})`),s=a;return`${t.reverse().join(" > ")}`.toLowerCase()}var Of=!1;function xk({storageKey:s,key:t,behavior:a,shouldScrollRestoration:r,scrollToTopSelectors:c,location:u}){var m,x;let h;try{h=JSON.parse(sessionStorage.getItem(s)||"{}")}catch(g){console.error(g);return}const p=t||((m=window.history.state)==null?void 0:m.__TSR_key),y=h[p];Of=!0;e:{if(r&&y&&Object.keys(y).length>0){for(const k in y){const N=y[k];if(k==="window")window.scrollTo({top:N.scrollY,left:N.scrollX,behavior:a});else if(k){const T=document.querySelector(k);T&&(T.scrollLeft=N.scrollX,T.scrollTop=N.scrollY)}}break e}const g=(u??window.location).hash.split("#",2)[1];if(g){const k=((x=window.history.state)==null?void 0:x.__hashScrollIntoViewOptions)??!0;if(k){const N=document.getElementById(g);N&&N.scrollIntoView(k)}break e}const S={top:0,left:0,behavior:a};if(window.scrollTo(S),c)for(const k of c){if(k==="window")continue;const N=typeof k=="function"?k():document.querySelector(k);N&&N.scrollTo(S)}}Of=!1}function Sk(s,t){if(!hf||((s.options.scrollRestoration??!1)&&(s.isScrollRestoring=!0),s.isScrollRestorationSetup||!hf))return;s.isScrollRestorationSetup=!0,Of=!1;const a=s.options.getScrollRestorationKey||_k;window.history.scrollRestoration="manual";const r=c=>{if(Of||!s.isScrollRestoring)return;let u="";if(c.target===document||c.target===window)u="window";else{const p=c.target.getAttribute("data-scroll-restoration-id");p?u=`[data-scroll-restoration-id="${p}"]`:u=bk(c.target)}const h=a(s.state.location);hf.set(p=>{const y=p[h]||(p[h]={}),m=y[u]||(y[u]={});if(u==="window")m.scrollX=window.scrollX||0,m.scrollY=window.scrollY||0;else if(u){const x=document.querySelector(u);x&&(m.scrollX=x.scrollLeft||0,m.scrollY=x.scrollTop||0)}return p})};typeof document<"u"&&document.addEventListener("scroll",yk(r,100),!0),s.subscribe("onRendered",c=>{const u=a(c.toLocation);if(!s.resetNextScroll){s.resetNextScroll=!0;return}typeof s.options.scrollRestoration=="function"&&!s.options.scrollRestoration({location:s.latestLocation})||(xk({storageKey:eg,key:u,behavior:s.options.scrollRestorationBehavior,shouldScrollRestoration:s.isScrollRestoring,scrollToTopSelectors:s.options.scrollToTopSelectors,location:s.history.location}),s.isScrollRestoring&&hf.set(h=>(h[u]||(h[u]={}),h)))})}function jk(s){if(typeof document<"u"&&document.querySelector){const t=s.state.location.state.__hashScrollIntoViewOptions??!0;if(t&&s.state.location.hash!==""){const a=document.getElementById(s.state.location.hash);a&&a.scrollIntoView(t)}}}function wk(s,t=String){const a=new URLSearchParams;for(const r in s){const c=s[r];c!==void 0&&a.set(r,t(c))}return a.toString()}function yp(s){return s?s==="false"?!1:s==="true"?!0:+s*0===0&&+s+""===s?+s:s:""}function kk(s){const t=new URLSearchParams(s),a=Object.create(null);for(const[r,c]of t.entries()){const u=a[r];u==null?a[r]=yp(c):Array.isArray(u)?u.push(yp(c)):a[r]=[u,yp(c)]}return a}var Nk=Tk(JSON.parse),Ck=Ek(JSON.stringify,JSON.parse);function Tk(s){return t=>{t[0]==="?"&&(t=t.substring(1));const a=kk(t);for(const r in a){const c=a[r];if(typeof c=="string")try{a[r]=s(c)}catch{}}return a}}function Ek(s,t){const a=typeof t=="function";function r(c){if(typeof c=="object"&&c!==null)try{return s(c)}catch{}else if(a&&typeof c=="string")try{return t(c),s(c)}catch{}return c}return c=>{const u=wk(c,r);return u?`?${u}`:""}}var xl="__root__";function Mk(s){if(s.statusCode=s.statusCode||s.code||307,!s._builtLocation&&!s.reloadDocument&&typeof s.href=="string")try{new URL(s.href),s.reloadDocument=!0}catch{}const t=new Headers(s.headers);s.href&&t.get("Location")===null&&t.set("Location",s.href);const a=new Response(null,{status:s.statusCode,headers:t});if(a.options=s,s.throw)throw a;return a}function Ms(s){return s instanceof Response&&!!s.options}function Rk(s){return{input:({url:t})=>{for(const a of s)t=tg(a,t);return t},output:({url:t})=>{for(let a=s.length-1;a>=0;a--)t=nS(s[a],t);return t}}}function Ak(s){const t=tS(s.basepath),a=`/${t}`,r=`${a}/`,c=s.caseSensitive?a:a.toLowerCase(),u=s.caseSensitive?r:r.toLowerCase();return{input:({url:h})=>{const p=s.caseSensitive?h.pathname:h.pathname.toLowerCase();return p===c?h.pathname="/":p.startsWith(u)&&(h.pathname=h.pathname.slice(a.length)),h},output:({url:h})=>(h.pathname=xf(["/",t,h.pathname]),h)}}function tg(s,t){var r;const a=(r=s==null?void 0:s.input)==null?void 0:r.call(s,{url:t});if(a){if(typeof a=="string")return new URL(a);if(a instanceof URL)return a}return t}function nS(s,t){var r;const a=(r=s==null?void 0:s.output)==null?void 0:r.call(s,{url:t});if(a){if(typeof a=="string")return new URL(a);if(a instanceof URL)return a}return t}var mn=(s=>(s[s.None=0]="None",s[s.Mutable=1]="Mutable",s[s.Watching=2]="Watching",s[s.RecursedCheck=4]="RecursedCheck",s[s.Recursed=8]="Recursed",s[s.Dirty=16]="Dirty",s[s.Pending=32]="Pending",s))(mn||{});function sS({update:s,notify:t,unwatched:a}){return{link:r,unlink:c,propagate:u,checkDirty:h,shallowPropagate:p};function r(m,x,g){const S=x.depsTail;if(S!==void 0&&S.dep===m)return;const k=S!==void 0?S.nextDep:x.deps;if(k!==void 0&&k.dep===m){k.version=g,x.depsTail=k;return}const N=m.subsTail;if(N!==void 0&&N.version===g&&N.sub===x)return;const T=x.depsTail=m.subsTail={version:g,dep:m,sub:x,prevDep:S,nextDep:k,prevSub:N,nextSub:void 0};k!==void 0&&(k.prevDep=T),S!==void 0?S.nextDep=T:x.deps=T,N!==void 0?N.nextSub=T:m.subs=T}function c(m,x=m.sub){const g=m.dep,S=m.prevDep,k=m.nextDep,N=m.nextSub,T=m.prevSub;return k!==void 0?k.prevDep=S:x.depsTail=S,S!==void 0?S.nextDep=k:x.deps=k,N!==void 0?N.prevSub=T:g.subsTail=T,T!==void 0?T.nextSub=N:(g.subs=N)===void 0&&a(g),k}function u(m){let x=m.nextSub,g;e:do{const S=m.sub;let k=S.flags;if(k&60?k&12?k&4?!(k&48)&&y(m,S)?(S.flags=k|40,k&=1):k=0:S.flags=k&-9|32:k=0:S.flags=k|32,k&2&&t(S),k&1){const N=S.subs;if(N!==void 0){const T=(m=N).nextSub;T!==void 0&&(g={value:x,prev:g},x=T);continue}}if((m=x)!==void 0){x=m.nextSub;continue}for(;g!==void 0;)if(m=g.value,g=g.prev,m!==void 0){x=m.nextSub;continue e}break}while(!0)}function h(m,x){let g,S=0,k=!1;e:do{const N=m.dep,T=N.flags;if(x.flags&16)k=!0;else if((T&17)===17){if(s(N)){const C=N.subs;C.nextSub!==void 0&&p(C),k=!0}}else if((T&33)===33){(m.nextSub!==void 0||m.prevSub!==void 0)&&(g={value:m,prev:g}),m=N.deps,x=N,++S;continue}if(!k){const C=m.nextDep;if(C!==void 0){m=C;continue}}for(;S--;){const C=x.subs,I=C.nextSub!==void 0;if(I?(m=g.value,g=g.prev):m=C,k){if(s(x)){I&&p(C),x=m.sub;continue}k=!1}else x.flags&=-33;x=m.sub;const V=m.nextDep;if(V!==void 0){m=V;continue e}}return k}while(!0)}function p(m){do{const x=m.sub,g=x.flags;(g&48)===32&&(x.flags=g|16,(g&6)===2&&t(x))}while((m=m.nextSub)!==void 0)}function y(m,x){let g=x.depsTail;for(;g!==void 0;){if(g===m)return!0;g=g.prevDep}return!1}}let zg=0,al=0,gu=0;const bi=[],{link:Q4,unlink:aS,propagate:G4,checkDirty:Dk,shallowPropagate:V4}=sS({update(s){return s.depsTail!==void 0?zk(s):Bk(s)},notify(s){var r;let t=gu,a=t;do if(bi[t++]=s,s.flags&=-3,s=(r=s.subs)==null?void 0:r.sub,s===void 0||!(s.flags&2))break;while(!0);for(gu=t;a<--t;){const c=bi[a];bi[a++]=bi[t],bi[t]=c}},unwatched(s){s.flags&1?s.depsTail!==void 0&&(s.depsTail=void 0,s.flags=17,Xf(s)):qk.call(s)}});function Ok(){return zg}function Lk(){++zg}function Ik(){--zg||Uk()}function zk(s){s.depsTail=void 0,s.flags=5;try{const t=s.value;return t!==(s.value=s.getter(t))}finally{s.flags&=-5,Xf(s)}}function Bk(s){return s.flags=1,s.currentValue!==(s.currentValue=s.pendingValue)}function Pk(s){const t=s.flags;if(t&16||t&32&&Dk(s.deps,s)){s.depsTail=void 0,s.flags=6;try{s.fn()}finally{s.flags&=-5,Xf(s)}}else s.flags=2}function Uk(){try{for(;al<gu;){const s=bi[al];bi[al++]=void 0,Pk(s)}}finally{for(;al<gu;){const s=bi[al];bi[al++]=void 0,s.flags|=10}al=0,gu=0}}function qk(){this.depsTail=void 0,this.flags=0,Xf(this);const s=this.subs;s!==void 0&&aS(s)}function Xf(s){const t=s.depsTail;let a=t!==void 0?t.nextDep:s.deps;for(;a!==void 0;)a=aS(a,s)}function Bg(s,t,a){var u,h,p;const r=typeof s=="object",c=r?s:void 0;return{next:(u=r?s.next:s)==null?void 0:u.bind(c),error:(h=r?s.error:t)==null?void 0:h.bind(c),complete:(p=r?s.complete:a)==null?void 0:p.bind(c)}}const ng=[];let Sf=0;const{link:Bb,unlink:$k,propagate:Hk,checkDirty:iS,shallowPropagate:Pb}=sS({update(s){return s._update()},notify(s){ng[sg++]=s,s.flags&=~mn.Watching},unwatched(s){s.depsTail!==void 0&&(s.depsTail=void 0,s.flags=mn.Mutable|mn.Dirty,Lf(s))}});let mf=0,sg=0,Ba;function Lf(s){const t=s.depsTail;let a=t!==void 0?t.nextDep:s.deps;for(;a!==void 0;)a=$k(a,s)}function rS(){if(!(Ok()>0)){for(;mf<sg;){const s=ng[mf];ng[mf++]=void 0,s.notify()}mf=0,sg=0}}function lS(s,t){const a=typeof s=="function",r=s,c={_snapshot:a?void 0:s,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:a?mn.None:mn.Mutable,get(){return Ba!==void 0&&Bb(c,Ba,Sf),c._snapshot},subscribe(u){const h=Bg(u),p={current:!1},y=Fk(()=>{var m;c.get(),p.current?(m=h.next)==null||m.call(h,c._snapshot):p.current=!0});return{unsubscribe:()=>{y.stop()}}},_update(u){const h=Ba,p=Object.is;if(a)Ba=c,++Sf,c.depsTail=void 0;else if(u===void 0)return!1;a&&(c.flags=mn.Mutable|mn.RecursedCheck);try{const y=c._snapshot,m=typeof u=="function"?u(y):u===void 0&&a?r(y):u;return y===void 0||!p(y,m)?(c._snapshot=m,!0):!1}finally{Ba=h,a&&(c.flags&=~mn.RecursedCheck),Lf(c)}}};return a?(c.flags=mn.Mutable|mn.Dirty,c.get=function(){const u=c.flags;if(u&mn.Dirty||u&mn.Pending&&iS(c.deps,c)){if(c._update()){const h=c.subs;h!==void 0&&Pb(h)}}else u&mn.Pending&&(c.flags=u&~mn.Pending);return Ba!==void 0&&Bb(c,Ba,Sf),c._snapshot}):c.set=function(u){if(c._update(u)){const h=c.subs;h!==void 0&&(Hk(h),Pb(h),rS())}},c}function Fk(s){const t=()=>{const r=Ba;Ba=a,++Sf,a.depsTail=void 0,a.flags=mn.Watching|mn.RecursedCheck;try{return s()}finally{Ba=r,a.flags&=~mn.RecursedCheck,Lf(a)}},a={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:mn.Watching|mn.RecursedCheck,notify(){const r=this.flags;r&mn.Dirty||r&mn.Pending&&iS(this.deps,this)?t():this.flags=mn.Watching},stop(){this.flags=mn.None,this.depsTail=void 0,Lf(this)}};return t(),a}class Qk{constructor(t){this.atom=lS(t)}setState(t){this.atom.set(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(Bg(t))}}class Gk{constructor(t){this.atom=lS(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(Bg(t))}}function Vk(s){return typeof s=="function"?new Gk(s):new Qk(s)}function Kk(s){try{Lk(),s()}finally{Ik(),rS()}}function yu(s){let t;return Kk(()=>{t=s()}),t}var ag=s=>{var t;if(!s.rendered)return s.rendered=!0,(t=s.onReady)==null?void 0:t.call(s)},Jf=(s,t)=>!!(s.preload&&!s.router.state.matches.some(a=>a.id===t)),Sl=(s,t,a=!0)=>{const r={...s.router.options.context??{}},c=a?t:t-1;for(let u=0;u<=c;u++){const h=s.matches[u];if(!h)continue;const p=s.router.getMatch(h.id);p&&Object.assign(r,p.__routeContext,p.__beforeLoadContext)}return r},Ub=(s,t)=>{if(!s.matches.length)return;const a=t.routeId,r=s.matches.findIndex(h=>h.routeId===s.router.routeTree.id),c=r>=0?r:0;let u=a?s.matches.findIndex(h=>h.routeId===a):s.firstBadMatchIndex??s.matches.length-1;u<0&&(u=c);for(let h=u;h>=0;h--){const p=s.matches[h];if(s.router.looseRoutesById[p.routeId].options.notFoundComponent)return h}return a?u:c},br=(s,t,a)=>{var r,c,u;if(!(!Ms(a)&&!hs(a)))throw Ms(a)&&a.redirectHandled&&!a.options.reloadDocument||(t&&((r=t._nonReactive.beforeLoadPromise)==null||r.resolve(),(c=t._nonReactive.loaderPromise)==null||c.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=a,s.updateMatch(t.id,h=>({...h,status:Ms(a)?"redirected":h.status==="pending"?"success":h.status,context:Sl(s,t.index),isFetching:!1,error:a})),hs(a)&&!a.routeId&&(a.routeId=t.routeId),(u=t._nonReactive.loadPromise)==null||u.resolve()),Ms(a)&&(s.rendered=!0,a.options._fromLocation=s.location,a.redirectHandled=!0,a=s.router.resolveRedirect(a))),a},oS=(s,t)=>{const a=s.router.getMatch(t);return!!(!a||a._nonReactive.dehydrated)},qb=(s,t,a)=>{const r=Sl(s,a);s.updateMatch(t,c=>({...c,context:r}))},nu=(s,t,a,r)=>{var p,y;const{id:c,routeId:u}=s.matches[t],h=s.router.looseRoutesById[u];if(a instanceof Promise)throw a;a.routerCode=r,s.firstBadMatchIndex??(s.firstBadMatchIndex=t),br(s,s.router.getMatch(c),a);try{(y=(p=h.options).onError)==null||y.call(p,a)}catch(m){a=m,br(s,s.router.getMatch(c),a)}s.updateMatch(c,m=>{var x,g;return(x=m._nonReactive.beforeLoadPromise)==null||x.resolve(),m._nonReactive.beforeLoadPromise=void 0,(g=m._nonReactive.loadPromise)==null||g.resolve(),{...m,error:a,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController}}),!s.preload&&!Ms(a)&&!hs(a)&&(s.serialError??(s.serialError=a))},cS=(s,t,a,r)=>{var u;if(r._nonReactive.pendingTimeout!==void 0)return;const c=a.options.pendingMs??s.router.options.defaultPendingMs;if(s.onReady&&!Jf(s,t)&&(a.options.loader||a.options.beforeLoad||dS(a))&&typeof c=="number"&&c!==1/0&&(a.options.pendingComponent??((u=s.router.options)==null?void 0:u.defaultPendingComponent))){const h=setTimeout(()=>{ag(s)},c);r._nonReactive.pendingTimeout=h}},Yk=(s,t,a)=>{const r=s.router.getMatch(t);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;cS(s,t,a,r);const c=()=>{const u=s.router.getMatch(t);u.preload&&(u.status==="redirected"||u.status==="notFound")&&br(s,u,u.error)};return r._nonReactive.beforeLoadPromise?r._nonReactive.beforeLoadPromise.then(c):c()},Zk=(s,t,a,r)=>{const c=s.router.getMatch(t);let u=c._nonReactive.loadPromise;c._nonReactive.loadPromise=$o(()=>{u==null||u.resolve(),u=void 0});const{paramsError:h,searchError:p}=c;h&&nu(s,a,h,"PARSE_PARAMS"),p&&nu(s,a,p,"VALIDATE_SEARCH"),cS(s,t,r,c);const y=new AbortController;let m=!1;const x=()=>{m||(m=!0,s.updateMatch(t,R=>({...R,isFetching:"beforeLoad",fetchCount:R.fetchCount+1,abortController:y})))},g=()=>{var R;(R=c._nonReactive.beforeLoadPromise)==null||R.resolve(),c._nonReactive.beforeLoadPromise=void 0,s.updateMatch(t,G=>({...G,isFetching:!1}))};if(!r.options.beforeLoad){yu(()=>{x(),g()});return}c._nonReactive.beforeLoadPromise=$o();const S={...Sl(s,a,!1),...c.__routeContext},{search:k,params:N,cause:T}=c,C=Jf(s,t),I={search:k,abortController:y,params:N,preload:C,context:S,location:s.location,navigate:R=>s.router.navigate({...R,_fromLocation:s.location}),buildLocation:s.router.buildLocation,cause:C?"preload":T,matches:s.matches,routeId:r.id,...s.router.options.additionalContext},V=R=>{if(R===void 0){yu(()=>{x(),g()});return}(Ms(R)||hs(R))&&(x(),nu(s,a,R,"BEFORE_LOAD")),yu(()=>{x(),s.updateMatch(t,G=>({...G,__beforeLoadContext:R})),g()})};let $;try{if($=r.options.beforeLoad(I),Su($))return x(),$.catch(R=>{nu(s,a,R,"BEFORE_LOAD")}).then(V)}catch(R){x(),nu(s,a,R,"BEFORE_LOAD")}V($)},Wk=(s,t)=>{const{id:a,routeId:r}=s.matches[t],c=s.router.looseRoutesById[r],u=()=>p(),h=()=>Zk(s,a,t,c),p=()=>{if(oS(s,a))return;const y=Yk(s,a,c);return Su(y)?y.then(h):h()};return u()},Xk=(s,t,a)=>{var u,h,p,y,m,x;const r=s.router.getMatch(t);if(!r||!a.options.head&&!a.options.scripts&&!a.options.headers)return;const c={ssr:s.router.options.ssr,matches:s.matches,match:r,params:r.params,loaderData:r.loaderData};return Promise.all([(h=(u=a.options).head)==null?void 0:h.call(u,c),(y=(p=a.options).scripts)==null?void 0:y.call(p,c),(x=(m=a.options).headers)==null?void 0:x.call(m,c)]).then(([g,S,k])=>({meta:g==null?void 0:g.meta,links:g==null?void 0:g.links,headScripts:g==null?void 0:g.scripts,headers:k,scripts:S,styles:g==null?void 0:g.styles}))},uS=(s,t,a,r,c)=>{const u=t[r-1],{params:h,loaderDeps:p,abortController:y,cause:m}=s.router.getMatch(a),x=Sl(s,r),g=Jf(s,a);return{params:h,deps:p,preload:!!g,parentMatchPromise:u,abortController:y,context:x,location:s.location,navigate:S=>s.router.navigate({...S,_fromLocation:s.location}),cause:g?"preload":m,route:c,...s.router.options.additionalContext}},$b=async(s,t,a,r,c)=>{var u,h,p,y,m;try{const x=s.router.getMatch(a);try{(!(Yw??s.router.isServer)||x.ssr===!0)&&ju(c);const g=c.options.loader,S=typeof g=="function"?g:g==null?void 0:g.handler,k=S==null?void 0:S(uS(s,t,a,r,c)),N=!!S&&Su(k);if((N||c._lazyPromise||c._componentsPromise||c.options.head||c.options.scripts||c.options.headers||x._nonReactive.minPendingPromise)&&s.updateMatch(a,C=>({...C,isFetching:"loader"})),S){const C=N?await k:k;br(s,s.router.getMatch(a),C),C!==void 0&&s.updateMatch(a,I=>({...I,loaderData:C}))}c._lazyPromise&&await c._lazyPromise;const T=x._nonReactive.minPendingPromise;T&&await T,c._componentsPromise&&await c._componentsPromise,s.updateMatch(a,C=>({...C,error:void 0,context:Sl(s,r),status:"success",isFetching:!1,updatedAt:Date.now()}))}catch(g){let S=g;if((S==null?void 0:S.name)==="AbortError"){if(x.abortController.signal.aborted){(u=x._nonReactive.loaderPromise)==null||u.resolve(),x._nonReactive.loaderPromise=void 0;return}s.updateMatch(a,N=>({...N,status:N.status==="pending"?"success":N.status,isFetching:!1,context:Sl(s,r)}));return}const k=x._nonReactive.minPendingPromise;k&&await k,hs(g)&&await((p=(h=c.options.notFoundComponent)==null?void 0:h.preload)==null?void 0:p.call(h)),br(s,s.router.getMatch(a),g);try{(m=(y=c.options).onError)==null||m.call(y,g)}catch(N){S=N,br(s,s.router.getMatch(a),N)}!Ms(S)&&!hs(S)&&await ju(c,["errorComponent"]),s.updateMatch(a,N=>({...N,error:S,context:Sl(s,r),status:"error",isFetching:!1}))}}catch(x){const g=s.router.getMatch(a);g&&(g._nonReactive.loaderPromise=void 0),br(s,g,x)}},Jk=async(s,t,a)=>{var k,N,T,C;async function r(I,V,$,R,G){const ue=Date.now()-V.updatedAt,Z=I?G.options.preloadStaleTime??s.router.options.defaultPreloadStaleTime??3e4:G.options.staleTime??s.router.options.defaultStaleTime??0,ie=G.options.shouldReload,te=typeof ie=="function"?ie(uS(s,t,c,a,G)):ie,{status:Y,invalid:H}=R,_e=ue>Z&&(!!s.forceStaleReload||R.cause==="enter"||$!==void 0&&$!==R.id);h=Y==="success"&&(H||(te??_e)),I&&G.options.preload===!1||(h&&!s.sync&&x?(p=!0,(async()=>{var je,ae;try{await $b(s,t,c,a,G);const ce=s.router.getMatch(c);(je=ce._nonReactive.loaderPromise)==null||je.resolve(),(ae=ce._nonReactive.loadPromise)==null||ae.resolve(),ce._nonReactive.loaderPromise=void 0,ce._nonReactive.loadPromise=void 0}catch(ce){Ms(ce)&&await s.router.navigate(ce.options)}})()):Y!=="success"||h?await $b(s,t,c,a,G):qb(s,c,a))}const{id:c,routeId:u}=s.matches[a];let h=!1,p=!1;const y=s.router.looseRoutesById[u],m=y.options.loader,x=((typeof m=="function"||m==null?void 0:m.staleReloadMode)??s.router.options.defaultStaleReloadMode)!=="blocking";if(oS(s,c)){if(!s.router.getMatch(c))return s.matches[a];qb(s,c,a)}else{const I=s.router.getMatch(c),V=((k=s.router.state.matches[a])==null?void 0:k.routeId)===u?s.router.state.matches[a].id:(N=s.router.state.matches.find(R=>R.routeId===u))==null?void 0:N.id,$=Jf(s,c);if(I._nonReactive.loaderPromise){if(I.status==="success"&&!s.sync&&!I.preload&&x)return I;await I._nonReactive.loaderPromise;const R=s.router.getMatch(c),G=R._nonReactive.error||R.error;G&&br(s,R,G),R.status==="pending"&&await r($,I,V,R,y)}else{const R=$&&!s.router.state.matches.some(ue=>ue.id===c),G=s.router.getMatch(c);G._nonReactive.loaderPromise=$o(),R!==G.preload&&s.updateMatch(c,ue=>({...ue,preload:R})),await r($,I,V,G,y)}}const g=s.router.getMatch(c);p||((T=g._nonReactive.loaderPromise)==null||T.resolve(),(C=g._nonReactive.loadPromise)==null||C.resolve(),g._nonReactive.loadPromise=void 0),clearTimeout(g._nonReactive.pendingTimeout),g._nonReactive.pendingTimeout=void 0,p||(g._nonReactive.loaderPromise=void 0),g._nonReactive.dehydrated=void 0;const S=p?g.isFetching:!1;return S!==g.isFetching||g.invalid!==!1?(s.updateMatch(c,I=>({...I,isFetching:S,invalid:!1})),s.router.getMatch(c)):g};async function Hb(s){var S,k;const t=s,a=[];t.router.state.matches.some(N=>N._forcePending)&&ag(t);let r;for(let N=0;N<t.matches.length;N++){try{const T=Wk(t,N);Su(T)&&await T}catch(T){if(Ms(T))throw T;if(hs(T))r=T;else if(!t.preload)throw T;break}if(t.serialError)break}const c=t.firstBadMatchIndex??t.matches.length,u=r&&!t.preload?Ub(t,r):void 0,h=r&&t.preload?0:u!==void 0?Math.min(u+1,c):c;let p,y;for(let N=0;N<h;N++)a.push(Jk(t,a,N));try{await Promise.all(a)}catch{const N=await Promise.allSettled(a);for(const T of N){if(T.status!=="rejected")continue;const C=T.reason;if(Ms(C))throw C;hs(C)?p??(p=C):y??(y=C)}if(y!==void 0)throw y}const m=p??(r&&!t.preload?r:void 0);let x=t.serialError?t.firstBadMatchIndex??0:t.matches.length-1;if(!m&&r&&t.preload)return t.matches;if(m){const N=Ub(t,m);Cr(N!==void 0);const T=t.matches[N],C=t.router.looseRoutesById[T.routeId],I=(S=t.router.options)==null?void 0:S.defaultNotFoundComponent;!C.options.notFoundComponent&&I&&(C.options.notFoundComponent=I),m.routeId=T.routeId;const V=T.routeId===t.router.routeTree.id;t.updateMatch(T.id,$=>({...$,...V?{status:"success",globalNotFound:!0,error:void 0}:{status:"notFound",error:m},isFetching:!1})),x=N,await ju(C,["notFoundComponent"])}else if(!t.preload){const N=t.matches[0];N.globalNotFound||(k=t.router.getMatch(N.id))!=null&&k.globalNotFound&&t.updateMatch(N.id,T=>({...T,globalNotFound:!1,error:void 0}))}if(t.serialError&&t.firstBadMatchIndex!==void 0){const N=t.router.looseRoutesById[t.matches[t.firstBadMatchIndex].routeId];await ju(N,["errorComponent"])}for(let N=0;N<=x;N++){const{id:T,routeId:C}=t.matches[N],I=t.router.looseRoutesById[C];try{const V=Xk(t,T,I);if(V){const $=await V;t.updateMatch(T,R=>({...R,...$}))}}catch(V){console.error(`Error executing head for route ${C}:`,V)}}const g=ag(t);if(Su(g)&&await g,m)throw m;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function Fb(s,t){const a=t.map(r=>{var c,u;return(u=(c=s.options[r])==null?void 0:c.preload)==null?void 0:u.call(c)}).filter(Boolean);if(a.length!==0)return Promise.all(a)}function ju(s,t=jf){!s._lazyLoaded&&s._lazyPromise===void 0&&(s.lazyFn?s._lazyPromise=s.lazyFn().then(r=>{const{id:c,...u}=r.options;Object.assign(s.options,u),s._lazyLoaded=!0,s._lazyPromise=void 0}):s._lazyLoaded=!0);const a=()=>s._componentsLoaded?void 0:t===jf?(()=>{if(s._componentsPromise===void 0){const r=Fb(s,jf);r?s._componentsPromise=r.then(()=>{s._componentsLoaded=!0,s._componentsPromise=void 0}):s._componentsLoaded=!0}return s._componentsPromise})():Fb(s,t);return s._lazyPromise?s._lazyPromise.then(a):a()}function dS(s){var t;for(const a of jf)if((t=s.options[a])!=null&&t.preload)return!0;return!1}var jf=["component","errorComponent","pendingComponent","notFoundComponent"],wr="__TSR_index",Qb="popstate",Gb="beforeunload";function eN(s){let t=s.getLocation();const a=new Set,r=h=>{t=s.getLocation(),a.forEach(p=>p({location:t,action:h}))},c=h=>{s.notifyOnIndexChange??!0?r(h):t=s.getLocation()},u=async({task:h,navigateOpts:p,...y})=>{var g,S;if((p==null?void 0:p.ignoreBlocker)??!1){h();return}const m=((g=s.getBlockers)==null?void 0:g.call(s))??[],x=y.type==="PUSH"||y.type==="REPLACE";if(typeof document<"u"&&m.length&&x)for(const k of m){const N=If(y.path,y.state);if(await k.blockerFn({currentLocation:t,nextLocation:N,action:y.type})){(S=s.onBlocked)==null||S.call(s);return}}h()};return{get location(){return t},get length(){return s.getLength()},subscribers:a,subscribe:h=>(a.add(h),()=>{a.delete(h)}),push:(h,p,y)=>{const m=t.state[wr];p=Vb(m+1,p),u({task:()=>{s.pushState(h,p),r({type:"PUSH"})},navigateOpts:y,type:"PUSH",path:h,state:p})},replace:(h,p,y)=>{const m=t.state[wr];p=Vb(m,p),u({task:()=>{s.replaceState(h,p),r({type:"REPLACE"})},navigateOpts:y,type:"REPLACE",path:h,state:p})},go:(h,p)=>{u({task:()=>{s.go(h),c({type:"GO",index:h})},navigateOpts:p,type:"GO"})},back:h=>{u({task:()=>{s.back((h==null?void 0:h.ignoreBlocker)??!1),c({type:"BACK"})},navigateOpts:h,type:"BACK"})},forward:h=>{u({task:()=>{s.forward((h==null?void 0:h.ignoreBlocker)??!1),c({type:"FORWARD"})},navigateOpts:h,type:"FORWARD"})},canGoBack:()=>t.state[wr]!==0,createHref:h=>s.createHref(h),block:h=>{var y;if(!s.setBlockers)return()=>{};const p=((y=s.getBlockers)==null?void 0:y.call(s))??[];return s.setBlockers([...p,h]),()=>{var x,g;const m=((x=s.getBlockers)==null?void 0:x.call(s))??[];(g=s.setBlockers)==null||g.call(s,m.filter(S=>S!==h))}},flush:()=>{var h;return(h=s.flush)==null?void 0:h.call(s)},destroy:()=>{var h;return(h=s.destroy)==null?void 0:h.call(s)},notify:r}}function Vb(s,t){t||(t={});const a=Pg();return{...t,key:a,__TSR_key:a,[wr]:s}}function tN(s){var ie,te;const t=typeof document<"u"?window:void 0,a=t.history.pushState,r=t.history.replaceState;let c=[];const u=()=>c,h=Y=>c=Y,p=(Y=>Y),y=(()=>If(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!((ie=t.history.state)!=null&&ie.__TSR_key)&&!((te=t.history.state)!=null&&te.key)){const Y=Pg();t.history.replaceState({[wr]:0,key:Y,__TSR_key:Y},"")}let m=y(),x,g=!1,S=!1,k=!1,N=!1;const T=()=>m;let C,I;const V=()=>{C&&(Z._ignoreSubscribers=!0,(C.isPush?t.history.pushState:t.history.replaceState)(C.state,"",C.href),Z._ignoreSubscribers=!1,C=void 0,I=void 0,x=void 0)},$=(Y,H,_e)=>{const je=p(H);I||(x=m),m=If(H,_e),C={href:je,state:_e,isPush:(C==null?void 0:C.isPush)||Y==="push"},I||(I=Promise.resolve().then(()=>V()))},R=Y=>{m=y(),Z.notify({type:Y})},G=async()=>{if(S){S=!1;return}const Y=y(),H=Y.state[wr]-m.state[wr],_e=H===1,je=H===-1,ae=!_e&&!je||g;g=!1;const ce=ae?"GO":je?"BACK":"FORWARD",E=ae?{type:"GO",index:H}:{type:je?"BACK":"FORWARD"};if(k)k=!1;else{const U=u();if(typeof document<"u"&&U.length){for(const ee of U)if(await ee.blockerFn({currentLocation:m,nextLocation:Y,action:ce})){S=!0,t.history.go(1),Z.notify(E);return}}}m=y(),Z.notify(E)},ue=Y=>{if(N){N=!1;return}let H=!1;const _e=u();if(typeof document<"u"&&_e.length)for(const je of _e){const ae=je.enableBeforeUnload??!0;if(ae===!0){H=!0;break}if(typeof ae=="function"&&ae()===!0){H=!0;break}}if(H)return Y.preventDefault(),Y.returnValue=""},Z=eN({getLocation:T,getLength:()=>t.history.length,pushState:(Y,H)=>$("push",Y,H),replaceState:(Y,H)=>$("replace",Y,H),back:Y=>(Y&&(k=!0),N=!0,t.history.back()),forward:Y=>{Y&&(k=!0),N=!0,t.history.forward()},go:Y=>{g=!0,t.history.go(Y)},createHref:Y=>p(Y),flush:V,destroy:()=>{t.history.pushState=a,t.history.replaceState=r,t.removeEventListener(Gb,ue,{capture:!0}),t.removeEventListener(Qb,G)},onBlocked:()=>{x&&m!==x&&(m=x)},getBlockers:u,setBlockers:h,notifyOnIndexChange:!1});return t.addEventListener(Gb,ue,{capture:!0}),t.addEventListener(Qb,G),t.history.pushState=function(...Y){const H=a.apply(t.history,Y);return Z._ignoreSubscribers||R("PUSH"),H},t.history.replaceState=function(...Y){const H=r.apply(t.history,Y);return Z._ignoreSubscribers||R("REPLACE"),H},Z}function nN(s){let t=s.replace(/[\x00-\x1f\x7f]/g,"");return t.startsWith("//")&&(t="/"+t.replace(/^\/+/,"")),t}function If(s,t){const a=nN(s),r=a.indexOf("#"),c=a.indexOf("?"),u=Pg();return{href:a,pathname:a.substring(0,r>0?c>0?Math.min(r,c):r:c>0?c:a.length),hash:r>-1?a.substring(r):"",search:c>-1?a.slice(c,r===-1?void 0:r):"",state:t||{[wr]:0,key:u,__TSR_key:u}}}function Pg(){return(Math.random()+1).toString(36).substring(7)}function jl(s){const t=s.resolvedLocation,a=s.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 sN(s){const t=s.filter(a=>a.status!=="redirected");return t.length===s.length?s:t}var aN=class{constructor(s){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 m;const a=this.options,r=this.basepath??(a==null?void 0:a.basepath)??"/",c=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=pk(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=tN()),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 x;this.resolvePathCache=Af(1e3),x=this.buildRouteTree(),this.setRoutes(x)}!this.__store&&this.latestLocation&&(this.__store=Vk(rN(this.latestLocation)),Sk(this));let h=!1;const p=this.options.basepath??"/",y=this.options.rewrite;if(c||r!==p||u!==y){this.basepath=p;const x=[],g=tS(p);g&&g!=="/"&&x.push(Ak({basepath:p})),y&&x.push(y),this.rewrite=x.length===0?void 0:x.length===1?x[0]:Rk(x),this.history&&this.updateLatestLocation(),h=!0}h&&this.__store&&this.__store.setState(x=>({...x,location:this.latestLocation})),typeof window<"u"&&"CSS"in window&&typeof((m=window.CSS)==null?void 0:m.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=ck(this.routeTree,this.options.caseSensitive,(a,r)=>{a.init({originalIndex:r})});return this.options.routeMasks&&ak(this.options.routeMasks,t.processedTree),t},this.subscribe=(t,a)=>{const r={eventType:t,fn:a};return this.subscribers.add(r),()=>{this.subscribers.delete(r)}},this.emit=t=>{this.subscribers.forEach(a=>{a.eventType===t.type&&a.fn(t)})},this.parseLocation=(t,a)=>{const r=({pathname:p,search:y,hash:m,href:x,state:g})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(p)){const C=this.options.parseSearch(y),I=this.options.stringifySearch(C);return{href:p+I+m,publicHref:x,pathname:eu(p).path,external:!1,searchStr:I,search:sl(a==null?void 0:a.search,C),hash:eu(m.slice(1)).path,state:ol(a==null?void 0:a.state,g)}}const S=new URL(x,this.origin),k=tg(this.rewrite,S),N=this.options.parseSearch(k.search),T=this.options.stringifySearch(N);return k.search=T,{href:k.href.replace(k.origin,""),publicHref:x,pathname:eu(k.pathname).path,external:!!this.rewrite&&k.origin!==this.origin,searchStr:T,search:sl(a==null?void 0:a.search,N),hash:eu(k.hash.slice(1)).path,state:ol(a==null?void 0:a.state,g)}},c=r(t),{__tempLocation:u,__tempKey:h}=c.state;if(u&&(!h||h===this.tempLocationKey)){const p=r(u);return p.state.key=c.state.key,p.state.__TSR_key=c.state.__TSR_key,delete p.state.__tempLocation,{...p,maskedLocation:c}}return c},this.resolvePathWithBase=(t,a)=>mk({base:t,to:Ig(a),trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(t,a,r)=>typeof t=="string"?this.matchRoutesInternal({pathname:t,search:a},r):this.matchRoutesInternal(t,a),this.getMatchedRoutes=t=>lN({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(r=>r.status==="pending"),a=this.state.matches.filter(r=>r.isFetching==="loader");new Set([...this.state.pendingMatches??[],...t,...a]).forEach(r=>{this.cancelMatch(r.id)})},this.buildLocation=t=>{const a=(c={})=>{var te,Y;const u=c._fromLocation||this.pendingBuiltLocation||this.latestLocation,h=this.matchRoutesLightweight(u);c.from;const p=c.unsafeRelative==="path"?u.pathname:c.from??h.fullPath,y=this.resolvePathWithBase(p,"."),m=h.search,x=Object.assign(Object.create(null),h.params),g=c.to?this.resolvePathWithBase(y,`${c.to}`):this.resolvePathWithBase(y,"."),S=c.params===!1||c.params===null?Object.create(null):(c.params??!0)===!0?x:Object.assign(x,_r(c.params,x)),k=this.getMatchedRoutes(g);let N=k.matchedRoutes;if((!k.foundRoute||k.foundRoute.path!=="/"&&k.routeParams["**"])&&this.options.notFoundRoute&&(N=[...N,this.options.notFoundRoute]),Object.keys(S).length>0)for(const H of N){const _e=((te=H.options.params)==null?void 0:te.stringify)??H.options.stringifyParams;if(_e)try{Object.assign(S,_e(S))}catch{}}const T=t.leaveParams?g:eu(Ib({path:g,params:S,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path;let C=m;if(t._includeValidateSearch&&((Y=this.options.search)!=null&&Y.strict)){const H={};N.forEach(_e=>{if(_e.options.validateSearch)try{Object.assign(H,wf(_e.options.validateSearch,{...H,...C}))}catch{}}),C=H}C=oN({search:C,dest:c,destRoutes:N,_includeValidateSearch:t._includeValidateSearch}),C=sl(m,C);const I=this.options.stringifySearch(C),V=c.hash===!0?u.hash:c.hash?_r(c.hash,u.hash):void 0,$=V?`#${V}`:"";let R=c.state===!0?u.state:c.state?_r(c.state,u.state):{};R=ol(u.state,R);const G=`${T}${I}${$}`;let ue,Z,ie=!1;if(this.rewrite){const H=new URL(G,this.origin),_e=nS(this.rewrite,H);ue=H.href.replace(H.origin,""),_e.origin!==this.origin?(Z=_e.href,ie=!0):Z=_e.pathname+_e.search+_e.hash}else ue=tk(G),Z=ue;return{publicHref:Z,href:ue,pathname:T,search:C,searchStr:I,state:R,hash:V??"",external:ie,unmaskOnReload:c.unmaskOnReload}},r=(c={},u)=>{const h=a(c);let p=u?a(u):void 0;if(!p){const y=Object.create(null);if(this.options.routeMasks){const m=ik(h.pathname,this.processedTree);if(m){Object.assign(y,m.rawParams);const{from:x,params:g,...S}=m.route,k=g===!1||g===null?Object.create(null):(g??!0)===!0?y:Object.assign(y,_r(g,y));u={from:t.from,...S,params:k},p=a(u)}}}return p&&(h.maskedLocation=p),h};return t.mask?r(t,{from:t.from,...t.mask}):r(t)},this.commitLocation=async({viewTransition:t,ignoreBlocker:a,...r})=>{const c=()=>{const p=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];p.forEach(m=>{r.state[m]=this.latestLocation.state[m]});const y=bl(r.state,this.latestLocation.state);return p.forEach(m=>{delete r.state[m]}),y},u=jr(this.latestLocation.href)===jr(r.href);let h=this.commitLocationPromise;if(this.commitLocationPromise=$o(()=>{h==null||h.resolve(),h=void 0}),u&&c())this.load();else{let{maskedLocation:p,hashScrollIntoView:y,...m}=r;p&&(m={...p,state:{...p.state,__tempKey:void 0,__tempLocation:{...m,search:m.searchStr,state:{...m.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(m.unmaskOnReload??this.options.unmaskOnReload??!1)&&(m.state.__tempKey=this.tempLocationKey)),m.state.__hashScrollIntoViewOptions=y??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=t,this.history[r.replace?"replace":"push"](m.publicHref,m.state,{ignoreBlocker:a})}return this.resetNextScroll=r.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:t,resetScroll:a,hashScrollIntoView:r,viewTransition:c,ignoreBlocker:u,href:h,...p}={})=>{if(h){const x=this.history.location.state.__TSR_index,g=If(h,{__TSR_index:t?x:x+1}),S=new URL(g.pathname,this.origin);p.to=tg(this.rewrite,S).pathname,p.search=this.options.parseSearch(g.search),p.hash=g.hash.slice(1)}const y=this.buildLocation({...p,_includeValidateSearch:!0});this.pendingBuiltLocation=y;const m=this.commitLocation({...y,viewTransition:c,replace:t,resetScroll:a,hashScrollIntoView:r,ignoreBlocker:u});return Promise.resolve().then(()=>{this.pendingBuiltLocation===y&&(this.pendingBuiltLocation=void 0)}),m},this.navigate=async({to:t,reloadDocument:a,href:r,publicHref:c,...u})=>{var p,y;let h=!1;if(r)try{new URL(`${r}`),h=!0}catch{}if(h&&!a&&(a=!0),a){if(t!==void 0||!r){const x=this.buildLocation({to:t,...u});r=r??x.publicHref,c=c??x.publicHref}const m=!h&&c?c:r;if(Rf(m,this.protocolAllowlist))return Promise.resolve();if(!u.ignoreBlocker){const x=((y=(p=this.history).getBlockers)==null?void 0:y.call(p))??[];for(const g of x)if(g!=null&&g.blockerFn&&await g.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return Promise.resolve()}return u.replace?window.location.replace(m):window.location.href=m,Promise.resolve()}return this.buildAndCommitLocation({...u,href:r,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(r=>!t.some(c=>c.id===r.id))}))},this.load=async t=>{let a,r,c;const u=this.state.resolvedLocation??this.state.location;for(c=new Promise(p=>{this.startTransition(async()=>{var y;try{this.beforeLoad();const m=this.latestLocation,x=this.state.resolvedLocation;this.state.redirect||this.emit({type:"onBeforeNavigate",...jl({resolvedLocation:x,location:m})}),this.emit({type:"onBeforeLoad",...jl({resolvedLocation:x,location:m})}),await Hb({router:this,sync:t==null?void 0:t.sync,forceStaleReload:u.href===m.href,matches:this.state.pendingMatches,location:m,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let g=[],S=[],k=[],N=[];yu(()=>{this.__store.setState(T=>{const C=T.matches,I=T.pendingMatches||T.matches;return g=C.filter(V=>!I.some($=>$.id===V.id)),S=C.filter(V=>!I.some($=>$.routeId===V.routeId)),k=I.filter(V=>!C.some($=>$.routeId===V.routeId)),N=I.filter(V=>C.some($=>$.routeId===V.routeId)),{...T,isLoading:!1,loadedAt:Date.now(),matches:I,pendingMatches:void 0,cachedMatches:[...T.cachedMatches,...g.filter(V=>V.status!=="error"&&V.status!=="notFound"&&V.status!=="redirected")]}}),this.clearExpiredCache()}),[[S,"onLeave"],[k,"onEnter"],[N,"onStay"]].forEach(([T,C])=>{T.forEach(I=>{var V,$;($=(V=this.looseRoutesById[I.routeId].options)[C])==null||$.call(V,I)})})})})}})}catch(m){Ms(m)?(a=m,this.navigate({...a.options,replace:!0,ignoreBlocker:!0})):hs(m)&&(r=m),this.__store.setState(x=>({...x,statusCode:a?a.status:r?404:x.matches.some(g=>g.status==="error")?500:200,redirect:a}))}this.latestLoadPromise===c&&((y=this.commitLocationPromise)==null||y.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),p()})}),this.latestLoadPromise=c,await c;this.latestLoadPromise&&c!==this.latestLoadPromise;)await this.latestLoadPromise;let h;this.hasNotFoundMatch()?h=404:this.__store.state.matches.some(p=>p.status==="error")&&(h=500),h!==void 0&&this.__store.setState(p=>({...p,statusCode:h}))},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 r;if(typeof a=="object"&&this.isViewTransitionTypesSupported){const c=this.latestLocation,u=this.state.resolvedLocation,h=typeof a.types=="function"?a.types(jl({resolvedLocation:u,location:c})):a.types;if(h===!1){t();return}r={update:t,types:h}}else r=t;document.startViewTransition(r)}else t()},this.updateMatch=(t,a)=>{this.startTransition(()=>{var c;const r=(c=this.state.pendingMatches)!=null&&c.some(u=>u.id===t)?"pendingMatches":this.state.matches.some(u=>u.id===t)?"matches":this.state.cachedMatches.some(u=>u.id===t)?"cachedMatches":"";r&&(r==="cachedMatches"?this.__store.setState(u=>({...u,cachedMatches:sN(u.cachedMatches.map(h=>h.id===t?a(h):h))})):this.__store.setState(u=>{var h;return{...u,[r]:(h=u[r])==null?void 0:h.map(p=>p.id===t?a(p):p)}}))})},this.getMatch=t=>{var r;const a=c=>c.id===t;return this.state.cachedMatches.find(a)??((r=this.state.pendingMatches)==null?void 0:r.find(a))??this.state.matches.find(a)},this.invalidate=t=>{const a=r=>{var c;return((c=t==null?void 0:t.filter)==null?void 0:c.call(t,r))??!0?{...r,invalid:!0,...t!=null&&t.forcePending||r.status==="error"||r.status==="notFound"?{status:"pending",error:void 0}:void 0}:r};return this.__store.setState(r=>{var c;return{...r,matches:r.matches.map(a),cachedMatches:r.cachedMatches.map(a),pendingMatches:(c=r.pendingMatches)==null?void 0:c.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 r=t.options._builtLocation??this.buildLocation(t.options),c=this.getParsedLocationHref(r);t.options.href=c,t.headers.set("Location",c)}else if(a)try{const r=new URL(a);if(this.origin&&r.origin===this.origin){const c=r.pathname+r.search+r.hash;t.options.href=c,t.headers.set("Location",c)}}catch{}if(t.options.href&&!t.options._builtLocation&&Rf(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(r=>({...r,cachedMatches:r.cachedMatches.filter(c=>!a(c))})):this.__store.setState(r=>({...r,cachedMatches:[]}))},this.clearExpiredCache=()=>{const t=a=>{const r=this.looseRoutesById[a.routeId];if(!r.options.loader)return!0;const c=(a.preload?r.options.preloadGcTime??this.options.defaultPreloadGcTime:r.options.gcTime??this.options.defaultGcTime)??300*1e3;return a.status==="error"?!0:Date.now()-a.updatedAt>=c};this.clearCache({filter:t})},this.loadRouteChunk=ju,this.preloadRoute=async t=>{const a=t._builtLocation??this.buildLocation(t);let r=this.matchRoutes(a,{throwOnError:!0,preload:!0,dest:t});const c=new Set([...this.state.matches,...this.state.pendingMatches??[]].map(h=>h.id)),u=new Set([...c,...this.state.cachedMatches.map(h=>h.id)]);yu(()=>{r.forEach(h=>{u.has(h.id)||this.__store.setState(p=>({...p,cachedMatches:[...p.cachedMatches,h]}))})});try{return r=await Hb({router:this,matches:r,location:a,preload:!0,updateMatch:(h,p)=>{c.has(h)?r=r.map(y=>y.id===h?p(y):y):this.updateMatch(h,p)}}),r}catch(h){if(Ms(h))return h.options.reloadDocument?void 0:await this.preloadRoute({...h.options,_fromLocation:a});hs(h)||console.error(h);return}},this.matchRoute=(t,a)=>{const r={...t,to:t.to?this.resolvePathWithBase(t.from||"",t.to):void 0,params:t.params||{},leaveParams:!0},c=this.buildLocation(r);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,h=rk(c.pathname,(a==null?void 0:a.caseSensitive)??!1,(a==null?void 0:a.fuzzy)??!1,u.pathname,this.processedTree);return!h||t.params&&!bl(h.rawParams,t.params,{partial:!0})?!1:(a==null?void 0:a.includeSearch)??!0?bl(u.search,c.search,{partial:!0})?h.rawParams:!1:h.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,...s,caseSensitive:s.caseSensitive??!1,notFoundMode:s.notFoundMode??"fuzzy",stringifySearch:s.stringifySearch??Ck,parseSearch:s.parseSearch??Nk,protocolAllowlist:s.protocolAllowlist??ek}),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:s,routesByPath:t,processedTree:a}){this.routesById=s,this.routesByPath=t,this.processedTree=a;const r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}get looseRoutesById(){return this.routesById}getParentContext(s){return s!=null&&s.id?s.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(s,t){var g,S;const a=this.getMatchedRoutes(s.pathname),{foundRoute:r,routeParams:c,parsedParams:u}=a;let{matchedRoutes:h}=a,p=!1;(r?r.path!=="/"&&c["**"]:jr(s.pathname))&&(this.options.notFoundRoute?h=[...h,this.options.notFoundRoute]:p=!0);const y=p?uN(this.options.notFoundMode,h):void 0,m=new Array(h.length),x=new Map(this.state.matches.map(k=>[k.routeId,k]));for(let k=0;k<h.length;k++){const N=h[k],T=m[k-1];let C,I,V;{const ce=(T==null?void 0:T.search)??s.search,E=(T==null?void 0:T._strictSearch)??void 0;try{const U=wf(N.options.validateSearch,{...ce})??void 0;C={...ce,...U},I={...E,...U},V=void 0}catch(U){let ee=U;if(U instanceof zf||(ee=new zf(U.message,{cause:U})),t!=null&&t.throwOnError)throw ee;C=ce,I={},V=ee}}const $=((S=(g=N.options).loaderDeps)==null?void 0:S.call(g,{search:C}))??"",R=$?JSON.stringify($):"",{interpolatedPath:G,usedParams:ue}=Ib({path:N.fullPath,params:c,decoder:this.pathParamsDecoder,server:this.isServer}),Z=N.id+G+R,ie=this.getMatch(Z),te=x.get(N.id),Y=(ie==null?void 0:ie._strictParams)??ue;let H;if(!ie)try{Kb(N,ue,u,Y)}catch(ce){if(hs(ce)||Ms(ce)?H=ce:H=new iN(ce.message,{cause:ce}),t!=null&&t.throwOnError)throw H}Object.assign(c,Y);const _e=te?"stay":"enter";let je;if(ie)je={...ie,cause:_e,params:(te==null?void 0:te.params)??c,_strictParams:Y,search:sl(te?te.search:ie.search,C),_strictSearch:I};else{const ce=N.options.loader||N.options.beforeLoad||N.lazyFn||dS(N)?"pending":"success";je={id:Z,ssr:N.options.ssr,index:k,routeId:N.id,params:(te==null?void 0:te.params)??c,_strictParams:Y,pathname:G,updatedAt:Date.now(),search:te?sl(te.search,C):C,_strictSearch:I,searchError:void 0,status:ce,isFetching:!1,error:void 0,paramsError:H,__routeContext:void 0,_nonReactive:{loadPromise:$o()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:_e,loaderDeps:te?ol(te.loaderDeps,$):$,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||(je.globalNotFound=y===N.id),je.searchError=V;const ae=this.getParentContext(T);je.context={...ae,...je.__routeContext,...je.__beforeLoadContext},m[k]=je}for(let k=0;k<m.length;k++){const N=m[k],T=this.looseRoutesById[N.routeId],C=this.getMatch(N.id),I=x.get(N.routeId);if(N.params=I?sl(I.params,c):c,!C){const V=m[k-1],$=this.getParentContext(V);if(T.options.context){const R={deps:N.loaderDeps,params:N.params,context:$??{},location:s,navigate:G=>this.navigate({...G,_fromLocation:s}),buildLocation:this.buildLocation,cause:N.cause,abortController:N.abortController,preload:!!N.preload,matches:m,routeId:T.id};N.__routeContext=T.options.context(R)??void 0}N.context={...$,...N.__routeContext,...N.__beforeLoadContext}}}return m}matchRoutesLightweight(s){const{matchedRoutes:t,routeParams:a,parsedParams:r}=this.getMatchedRoutes(s.pathname),c=xu(t),u={...s.search};for(const m of t)try{Object.assign(u,wf(m.options.validateSearch,u))}catch{}const h=xu(this.state.matches),p=h&&h.routeId===c.id&&s.pathname===this.state.location.pathname;let y;if(p)y=h.params;else{const m=Object.assign(Object.create(null),a);for(const x of t)try{Kb(x,a,r??{},m)}catch{}y=m}return{matchedRoutes:t,fullPath:c.fullPath,search:u,params:y}}},zf=class extends Error{},iN=class extends Error{};function rN(s){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:s,matches:[],pendingMatches:[],cachedMatches:[],statusCode:200}}function wf(s,t){if(s==null)return{};if("~standard"in s){const a=s["~standard"].validate(t);if(a instanceof Promise)throw new zf("Async validation not supported");if(a.issues)throw new zf(JSON.stringify(a.issues,void 0,2),{cause:a});return a.value}return"parse"in s?s.parse(t):typeof s=="function"?s(t):{}}function lN({pathname:s,routesById:t,processedTree:a}){const r=Object.create(null),c=jr(s);let u,h;const p=lk(c,a,!0);return p&&(u=p.route,Object.assign(r,p.rawParams),h=Object.assign(Object.create(null),p.parsedParams)),{matchedRoutes:(p==null?void 0:p.branch)||[t.__root__],routeParams:r,foundRoute:u,parsedParams:h}}function oN({search:s,dest:t,destRoutes:a,_includeValidateSearch:r}){return cN(a)(s,t,r??!1)}function cN(s){var c;const t={dest:null,_includeValidateSearch:!1,middlewares:[]};for(const u of s){if("search"in u.options)(c=u.options.search)!=null&&c.middlewares&&t.middlewares.push(...u.options.search.middlewares);else if(u.options.preSearchFilters||u.options.postSearchFilters){const h=({search:p,next:y})=>{let m=p;"preSearchFilters"in u.options&&u.options.preSearchFilters&&(m=u.options.preSearchFilters.reduce((g,S)=>S(g),p));const x=y(m);return"postSearchFilters"in u.options&&u.options.postSearchFilters?u.options.postSearchFilters.reduce((g,S)=>S(g),x):x};t.middlewares.push(h)}if(u.options.validateSearch){const h=({search:p,next:y})=>{const m=y(p);if(!t._includeValidateSearch)return m;try{return{...m,...wf(u.options.validateSearch,m)??void 0}}catch{return m}};t.middlewares.push(h)}}const a=({search:u})=>{const h=t.dest;return h.search?h.search===!0?u:_r(h.search,u):{}};t.middlewares.push(a);const r=(u,h,p)=>{if(u>=p.length)return h;const y=p[u];return y({search:h,next:x=>r(u+1,x,p)})};return function(h,p,y){return t.dest=p,t._includeValidateSearch=y,r(0,h,t.middlewares)}}function uN(s,t){if(s!=="root")for(let a=t.length-1;a>=0;a--){const r=t[a];if(r.children)return r.id}return xl}function Kb(s,t,a,r){var u;const c=((u=s.options.params)==null?void 0:u.parse)??s.options.parseParams;if(c)if(s.options.skipRouteOnParseError)for(const h in t)h in a&&(r[h]=a[h]);else{const h=c(r);Object.assign(r,h)}}var dN="Error preloading route! ☝️",fS=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(s){if(this.init=t=>{var y,m;this.originalIndex=t.originalIndex;const a=this.options,r=!(a!=null&&a.path)&&!(a!=null&&a.id);this.parentRoute=(m=(y=this.options).getParentRoute)==null?void 0:m.call(y),r?this._path=xl:this.parentRoute||Cr(!1);let c=r?xl:a==null?void 0:a.path;c&&c!=="/"&&(c=eS(c));const u=(a==null?void 0:a.id)||c;let h=r?xl:xf([this.parentRoute.id==="__root__"?"":this.parentRoute.id,u]);c==="__root__"&&(c="/"),h!=="__root__"&&(h=xf(["/",h]));const p=h==="__root__"?"/":xf([this.parentRoute.fullPath,c]);this._path=c,this._id=h,this._fullPath=p,this._to=jr(p)},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=>Mk({from:this.fullPath,...t}),this.options=s||{},this.isRoot=!(s!=null&&s.getParentRoute),s!=null&&s.id&&(s!=null&&s.path))throw new Error("Route cannot have both an 'id' and a 'path' option.")}},fN=class extends fS{constructor(s){super(s)}};function Ug(s){const t=s.errorComponent??qg;return l.jsx(hN,{getResetKey:s.getResetKey,onCatch:s.onCatch,children:({error:a,reset:r})=>a?_.createElement(t,{error:a,reset:r}):s.children})}var hN=class extends _.Component{constructor(...s){super(...s),this.state={error:null}}static getDerivedStateFromProps(s){return{resetKey:s.getResetKey()}}static getDerivedStateFromError(s){return{error:s}}reset(){this.setState({error:null})}componentDidUpdate(s,t){t.error&&t.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(s,t){this.props.onCatch&&this.props.onCatch(s,t)}render(){return this.props.children({error:this.state.resetKey!==this.props.getResetKey()?null:this.state.error,reset:()=>{this.reset()}})}};function qg({error:s}){const[t,a]=_.useState(!1);return l.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[l.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),l.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>a(r=>!r),children:t?"Hide Error":"Show Error"})]}),l.jsx("div",{style:{height:".25rem"}}),t?l.jsx("div",{children:l.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:s.message?l.jsx("code",{children:s.message}):null})}):null]})}function mN({children:s,fallback:t=null}){return hS()?l.jsx(Si.Fragment,{children:s}):l.jsx(Si.Fragment,{children:t})}function hS(){return Si.useSyncExternalStore(pN,()=>!0,()=>!1)}function pN(){return()=>{}}var mS=_.createContext(null);function ia(s){const t=_.useContext(mS);return s==null||s.warn,t}var vp={exports:{}},_p={},bp={exports:{}},xp={};/**
|
|
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 Yb;function gN(){if(Yb)return xp;Yb=1;var s=Bu();function t(g,S){return g===S&&(g!==0||1/g===1/S)||g!==g&&S!==S}var a=typeof Object.is=="function"?Object.is:t,r=s.useState,c=s.useEffect,u=s.useLayoutEffect,h=s.useDebugValue;function p(g,S){var k=S(),N=r({inst:{value:k,getSnapshot:S}}),T=N[0].inst,C=N[1];return u(function(){T.value=k,T.getSnapshot=S,y(T)&&C({inst:T})},[g,k,S]),c(function(){return y(T)&&C({inst:T}),g(function(){y(T)&&C({inst:T})})},[g]),h(k),k}function y(g){var S=g.getSnapshot;g=g.value;try{var k=S();return!a(g,k)}catch{return!0}}function m(g,S){return S()}var x=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?m:p;return xp.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:x,xp}var Zb;function yN(){return Zb||(Zb=1,bp.exports=gN()),bp.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 Wb;function vN(){if(Wb)return _p;Wb=1;var s=Bu(),t=yN();function a(m,x){return m===x&&(m!==0||1/m===1/x)||m!==m&&x!==x}var r=typeof Object.is=="function"?Object.is:a,c=t.useSyncExternalStore,u=s.useRef,h=s.useEffect,p=s.useMemo,y=s.useDebugValue;return _p.useSyncExternalStoreWithSelector=function(m,x,g,S,k){var N=u(null);if(N.current===null){var T={hasValue:!1,value:null};N.current=T}else T=N.current;N=p(function(){function I(ue){if(!V){if(V=!0,$=ue,ue=S(ue),k!==void 0&&T.hasValue){var Z=T.value;if(k(Z,ue))return R=Z}return R=ue}if(Z=R,r($,ue))return Z;var ie=S(ue);return k!==void 0&&k(Z,ie)?($=ue,Z):($=ue,R=ie)}var V=!1,$,R,G=g===void 0?null:g;return[function(){return I(x())},G===null?void 0:function(){return I(G())}]},[x,g,S,k]);var C=c(m,N[0],N[1]);return h(function(){T.hasValue=!0,T.value=C},[C]),y(C),C},_p}var Xb;function _N(){return Xb||(Xb=1,vp.exports=vN()),vp.exports}var bN=_N();function xN(s,t){return s===t}function SN(s,t,a=xN){const r=_.useCallback(h=>{if(!s)return()=>{};const{unsubscribe:p}=s.subscribe(h);return p},[s]),c=_.useCallback(()=>s==null?void 0:s.get(),[s]);return bN.useSyncExternalStoreWithSelector(r,c,c,t,a)}function aa(s){const t=ia({warn:(s==null?void 0:s.router)===void 0}),a=(s==null?void 0:s.router)||t,r=_.useRef(void 0);return SN(a.__store,c=>{if(s!=null&&s.select){if(s.structuralSharing??a.options.defaultStructuralSharing){const u=ol(r.current,s.select(c));return r.current=u,u}return s.select(c)}return c})}var eh=_.createContext(void 0),jN=_.createContext(void 0);function Er(s){const t=_.useContext(s.from?jN:eh);return aa({select:a=>{const r=a.matches.find(c=>s.from?s.from===c.routeId:c.id===t);if(Cr(!((s.shouldThrow??!0)&&!r),`Could not find ${s.from?`an active match from "${s.from}"`:"a nearest match!"}`),r!==void 0)return s.select?s.select(r):r},structuralSharing:s.structuralSharing})}function $g(s){return Er({from:s.from,strict:s.strict,structuralSharing:s.structuralSharing,select:t=>s.select?s.select(t.loaderData):t.loaderData})}function Hg(s){const{select:t,...a}=s;return Er({...a,select:r=>t?t(r.loaderDeps):r.loaderDeps})}function Pu(s){return Er({from:s.from,shouldThrow:s.shouldThrow,structuralSharing:s.structuralSharing,strict:s.strict,select:t=>{const a=s.strict===!1?t.params:t._strictParams;return s.select?s.select(a):a}})}function Fg(s){return Er({from:s.from,strict:s.strict,shouldThrow:s.shouldThrow,structuralSharing:s.structuralSharing,select:t=>s.select?s.select(t.search):t.search})}function Mr(s){const t=ia();return _.useCallback(a=>t.navigate({...a,from:a.from??(s==null?void 0:s.from)}),[s==null?void 0:s.from,t])}function Qg(s){return Er({...s,select:t=>s.select?s.select(t.context):t.context})}var or=U0();function wN(s,t){const a=ia(),r=Kw(t),{activeProps:c,inactiveProps:u,activeOptions:h,to:p,preload:y,preloadDelay:m,hashScrollIntoView:x,replace:g,startTransition:S,resetScroll:k,viewTransition:N,children:T,target:C,disabled:I,style:V,className:$,onClick:R,onBlur:G,onFocus:ue,onMouseEnter:Z,onMouseLeave:ie,onTouchStart:te,ignoreBlocker:Y,params:H,search:_e,hash:je,state:ae,mask:ce,reloadDocument:E,unsafeRelative:U,from:ee,_fromLocation:W,...xe}=s,A=hS(),ne=aa({select:Oe=>{const Ke=Oe.matches[Oe.matches.length-1];return{search:Ke==null?void 0:Ke.search,hash:Oe.location.hash,path:Ke==null?void 0:Ke.pathname}},structuralSharing:!0}),be=s.from,Q=_.useMemo(()=>({...s,from:be}),[a,ne,be,s._fromLocation,s.hash,s.to,s.search,s.params,s.state,s.mask,s.unsafeRelative]),pe=_.useMemo(()=>a.buildLocation({...Q}),[a,Q]),Ce=pe.maskedLocation?pe.maskedLocation.publicHref:pe.publicHref,Le=pe.maskedLocation?pe.maskedLocation.external:pe.external,he=_.useMemo(()=>MN(Ce,Le,a.history,I),[I,Le,Ce,a.history]),q=_.useMemo(()=>{if(he!=null&&he.external)return Rf(he.href,a.protocolAllowlist)?void 0:he.href;if(!RN(p)&&!(typeof p!="string"||p.indexOf(":")===-1))try{return new URL(p),Rf(p,a.protocolAllowlist)?void 0:p}catch{}},[p,he,a.protocolAllowlist]),Se=aa({select:Oe=>{if(q)return!1;if(h!=null&&h.exact){if(!hk(Oe.location.pathname,pe.pathname,a.basepath))return!1}else{const Ke=Df(Oe.location.pathname,a.basepath),mt=Df(pe.pathname,a.basepath);if(!(Ke.startsWith(mt)&&(Ke.length===mt.length||Ke[mt.length]==="/")))return!1}return((h==null?void 0:h.includeSearch)??!0)&&!bl(Oe.location.search,pe.search,{partial:!(h!=null&&h.exact),ignoreUndefined:!(h!=null&&h.explicitUndefined)})?!1:h!=null&&h.includeHash?A&&Oe.location.hash===pe.hash:!0}}),Ne=Se?_r(c,{})??kN:Sp,me=Se?Sp:_r(u,{})??Sp,Te=[$,Ne.className,me.className].filter(Boolean).join(" "),Ge=(V||Ne.style||me.style)&&{...V,...Ne.style,...me.style},[Ue,gt]=_.useState(!1),Lt=_.useRef(!1),St=s.reloadDocument||q?!1:y??a.options.defaultPreload,st=m??a.options.defaultPreloadDelay??0,tn=_.useCallback(()=>{a.preloadRoute({...Q,_builtLocation:pe}).catch(Oe=>{console.warn(Oe),console.warn(dN)})},[a,Q,pe]);Vw(r,_.useCallback(Oe=>{Oe!=null&&Oe.isIntersecting&&tn()},[tn]),EN,{disabled:!!I||St!=="viewport"}),_.useEffect(()=>{Lt.current||!I&&St==="render"&&(tn(),Lt.current=!0)},[I,tn,St]);const $t=Oe=>{const Ke=Oe.currentTarget.getAttribute("target"),mt=C!==void 0?C:Ke;if(!I&&!AN(Oe)&&!Oe.defaultPrevented&&(!mt||mt==="_self")&&Oe.button===0){Oe.preventDefault(),or.flushSync(()=>{gt(!0)});const kt=a.subscribe("onResolved",()=>{kt(),gt(!1)});a.navigate({...Q,replace:g,resetScroll:k,hashScrollIntoView:x,startTransition:S,viewTransition:N,ignoreBlocker:Y})}};if(q)return{...xe,ref:r,href:q,...T&&{children:T},...C&&{target:C},...I&&{disabled:I},...V&&{style:V},...$&&{className:$},...R&&{onClick:R},...G&&{onBlur:G},...ue&&{onFocus:ue},...Z&&{onMouseEnter:Z},...ie&&{onMouseLeave:ie},...te&&{onTouchStart:te}};const de=Oe=>{if(I||St!=="intent")return;if(!st){tn();return}const Ke=Oe.currentTarget;if(su.has(Ke))return;const mt=setTimeout(()=>{su.delete(Ke),tn()},st);su.set(Ke,mt)},Ae=Oe=>{I||St!=="intent"||tn()},Re=Oe=>{if(I||!St||!st)return;const Ke=Oe.currentTarget,mt=su.get(Ke);mt&&(clearTimeout(mt),su.delete(Ke))};return{...xe,...Ne,...me,href:he==null?void 0:he.href,ref:r,onClick:xo([R,$t]),onBlur:xo([G,Re]),onFocus:xo([ue,de]),onMouseEnter:xo([Z,de]),onMouseLeave:xo([ie,Re]),onTouchStart:xo([te,Ae]),disabled:!!I,target:C,...Ge&&{style:Ge},...Te&&{className:Te},...I&&NN,...Se&&CN,...A&&Ue&&TN}}var Sp={},kN={className:"active"},NN={role:"link","aria-disabled":!0},CN={"data-status":"active","aria-current":"page"},TN={"data-transitioning":"transitioning"},su=new WeakMap,EN={rootMargin:"100px"},xo=s=>t=>{for(const a of s)if(a){if(t.defaultPrevented)return;a(t)}};function MN(s,t,a,r){if(!r)return t?{href:s,external:!0}:{href:a.createHref(s)||"/",external:!1}}function RN(s){if(typeof s!="string")return!1;const t=s.charCodeAt(0);return t===47?s.charCodeAt(1)!==47:t===46}var vu=_.forwardRef((s,t)=>{const{_asChild:a,...r}=s,{type:c,...u}=wN(r,t),h=typeof r.children=="function"?r.children({isActive:u["data-status"]==="active"}):r.children;if(!a){const{disabled:p,...y}=u;return _.createElement("a",y,h)}return _.createElement(a,u,h)});function AN(s){return!!(s.metaKey||s.altKey||s.ctrlKey||s.shiftKey)}var DN=class extends fS{constructor(s){super(s),this.useMatch=t=>Er({select:t==null?void 0:t.select,from:this.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>Qg({...t,from:this.id}),this.useSearch=t=>Fg({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useParams=t=>Pu({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useLoaderDeps=t=>Hg({...t,from:this.id}),this.useLoaderData=t=>$g({...t,from:this.id}),this.useNavigate=()=>Mr({from:this.fullPath}),this.Link=Si.forwardRef((t,a)=>l.jsx(vu,{ref:a,from:this.fullPath,...t})),this.$$typeof=Symbol.for("react.memo")}};function El(s){return new DN(s)}var ON=class extends fN{constructor(s){super(s),this.useMatch=t=>Er({select:t==null?void 0:t.select,from:this.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>Qg({...t,from:this.id}),this.useSearch=t=>Fg({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useParams=t=>Pu({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useLoaderDeps=t=>Hg({...t,from:this.id}),this.useLoaderData=t=>$g({...t,from:this.id}),this.useNavigate=()=>Mr({from:this.fullPath}),this.Link=Si.forwardRef((t,a)=>l.jsx(vu,{ref:a,from:this.fullPath,...t})),this.$$typeof=Symbol.for("react.memo")}};function LN(s){return new ON(s)}function Jb(s){return typeof s=="object"?new ex(s,{silent:!0}).createRoute(s):new ex(s,{silent:!0}).createRoute}var ex=class{constructor(s,t){this.path=s,this.createRoute=a=>{const r=El(a);return r.isRoot=!1,r},this.silent=t==null?void 0:t.silent}},tx=class{constructor(s){this.useMatch=t=>Er({select:t==null?void 0:t.select,from:this.options.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>Qg({...t,from:this.options.id}),this.useSearch=t=>Fg({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.options.id}),this.useParams=t=>Pu({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.options.id}),this.useLoaderDeps=t=>Hg({...t,from:this.options.id}),this.useLoaderData=t=>$g({...t,from:this.options.id}),this.useNavigate=()=>Mr({from:ia().routesById[this.options.id].fullPath}),this.options=s,this.$$typeof=Symbol.for("react.memo")}};function nx(s){return typeof s=="object"?new tx(s):t=>new tx({id:s,...t})}function IN(s){const t=aa({select:a=>`not-found-${a.location.pathname}-${a.status}`});return l.jsx(Ug,{getResetKey:()=>t,onCatch:(a,r)=>{var c;if(hs(a))(c=s.onCatch)==null||c.call(s,a,r);else throw a},errorComponent:({error:a})=>{var r;if(hs(a))return(r=s.fallback)==null?void 0:r.call(s,a);throw a},children:s.children})}function zN(){return l.jsx("p",{children:"Not Found"})}function No(s){return l.jsx(l.Fragment,{children:s.children})}function pS(s,t,a){return t.options.notFoundComponent?l.jsx(t.options.notFoundComponent,{...a}):s.options.defaultNotFoundComponent?l.jsx(s.options.defaultNotFoundComponent,{...a}):l.jsx(zN,{})}function BN(){return ia().isScrollRestoring,null}var gS=_.memo(function({matchId:t}){var N,T;const a=ia(),r=aa({select:C=>{var $;const I=C.matches.findIndex(R=>R.id===t),V=C.matches[I];return Cr(V),{routeId:V.routeId,ssr:V.ssr,_displayPending:V._displayPending,resetKey:C.loadedAt,parentRouteId:($=C.matches[I-1])==null?void 0:$.routeId}},structuralSharing:!0}),c=a.routesById[r.routeId],u=c.options.pendingComponent??a.options.defaultPendingComponent,h=u?l.jsx(u,{}):null,p=c.options.errorComponent??a.options.defaultErrorComponent,y=c.options.onCatch??a.options.defaultOnCatch,m=c.isRoot?c.options.notFoundComponent??((N=a.options.notFoundRoute)==null?void 0:N.options.component):c.options.notFoundComponent,x=r.ssr===!1||r.ssr==="data-only",g=(!c.isRoot||c.options.wrapInSuspense||x)&&(c.options.wrapInSuspense??u??(((T=c.options.errorComponent)==null?void 0:T.preload)||x))?_.Suspense:No,S=p?Ug:No,k=m?IN:No;return l.jsxs(c.isRoot?c.options.shellComponent??No:No,{children:[l.jsx(eh.Provider,{value:t,children:l.jsx(g,{fallback:h,children:l.jsx(S,{getResetKey:()=>r.resetKey,errorComponent:p||qg,onCatch:(C,I)=>{if(hs(C))throw C;y==null||y(C,I)},children:l.jsx(k,{fallback:C=>{if(!m||C.routeId&&C.routeId!==r.routeId||!C.routeId&&!c.isRoot)throw C;return _.createElement(m,C)},children:x||r._displayPending?l.jsx(mN,{fallback:h,children:l.jsx(sx,{matchId:t})}):l.jsx(sx,{matchId:t})})})})}),r.parentRouteId===xl&&a.options.scrollRestoration?l.jsxs(l.Fragment,{children:[l.jsx(PN,{}),l.jsx(BN,{})]}):null]})});function PN(){const s=ia(),t=_.useRef(void 0);return l.jsx("script",{suppressHydrationWarning:!0,ref:a=>{a&&(t.current===void 0||t.current.href!==s.latestLocation.href)&&(s.emit({type:"onRendered",...jl(s.state)}),t.current=s.latestLocation)}},s.latestLocation.state.__TSR_key)}var sx=_.memo(function({matchId:t}){var y,m,x,g;const a=ia(),{match:r,key:c,routeId:u}=aa({select:S=>{var C;const k=S.matches.find(I=>I.id===t),N=k.routeId,T=(C=a.routesById[N].options.remountDeps??a.options.defaultRemountDeps)==null?void 0:C({routeId:N,loaderDeps:k.loaderDeps,params:k._strictParams,search:k._strictSearch});return{key:T?JSON.stringify(T):void 0,routeId:N,match:{id:k.id,status:k.status,error:k.error,_forcePending:k._forcePending,_displayPending:k._displayPending}}},structuralSharing:!0}),h=a.routesById[u],p=_.useMemo(()=>{const S=h.options.component??a.options.defaultComponent;return S?l.jsx(S,{},c):l.jsx(yS,{})},[c,h.options.component,a.options.defaultComponent]);if(r._displayPending)throw(y=a.getMatch(r.id))==null?void 0:y._nonReactive.displayPendingPromise;if(r._forcePending)throw(m=a.getMatch(r.id))==null?void 0:m._nonReactive.minPendingPromise;if(r.status==="pending"){const S=h.options.pendingMinMs??a.options.defaultPendingMinMs;if(S){const k=a.getMatch(r.id);if(k&&!k._nonReactive.minPendingPromise){const N=$o();k._nonReactive.minPendingPromise=N,setTimeout(()=>{N.resolve(),k._nonReactive.minPendingPromise=void 0},S)}}throw(x=a.getMatch(r.id))==null?void 0:x._nonReactive.loadPromise}if(r.status==="notFound")return Cr(hs(r.error)),pS(a,h,r.error);if(r.status==="redirected")throw Cr(Ms(r.error)),(g=a.getMatch(r.id))==null?void 0:g._nonReactive.loadPromise;if(r.status==="error")throw r.error;return p}),yS=_.memo(function(){const t=ia(),a=_.useContext(eh),r=aa({select:m=>{var x;return(x=m.matches.find(g=>g.id===a))==null?void 0:x.routeId}}),c=t.routesById[r],u=aa({select:m=>{const x=m.matches.find(g=>g.id===a);return Cr(x),x.globalNotFound}}),h=aa({select:m=>{var g;const x=m.matches;return(g=x[x.findIndex(S=>S.id===a)+1])==null?void 0:g.id}}),p=t.options.defaultPendingComponent?l.jsx(t.options.defaultPendingComponent,{}):null;if(u)return pS(t,c,void 0);if(!h)return null;const y=l.jsx(gS,{matchId:h});return r===xl?l.jsx(_.Suspense,{fallback:p,children:y}):y});function UN(){const s=ia(),t=_.useRef({router:s,mounted:!1}),[a,r]=_.useState(!1),{hasPendingMatches:c,isLoading:u}=aa({select:g=>({isLoading:g.isLoading,hasPendingMatches:g.matches.some(S=>S.status==="pending")}),structuralSharing:!0}),h=fp(u),p=u||a||c,y=fp(p),m=u||c,x=fp(m);return s.startTransition=g=>{r(!0),_.startTransition(()=>{g(),r(!1)})},_.useEffect(()=>{const g=s.history.subscribe(s.load),S=s.buildLocation({to:s.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return jr(s.latestLocation.publicHref)!==jr(S.publicHref)&&s.commitLocation({...S,replace:!0}),()=>{g()}},[s,s.history]),ff(()=>{if(typeof window<"u"&&s.ssr||t.current.router===s&&t.current.mounted)return;t.current={router:s,mounted:!0},(async()=>{try{await s.load()}catch(S){console.error(S)}})()},[s]),ff(()=>{h&&!u&&s.emit({type:"onLoad",...jl(s.state)})},[h,s,u]),ff(()=>{x&&!m&&s.emit({type:"onBeforeRouteMount",...jl(s.state)})},[m,x,s]),ff(()=>{if(y&&!p){const g=jl(s.state);s.emit({type:"onResolved",...g}),s.__store.setState(S=>({...S,status:"idle",resolvedLocation:S.location})),g.hrefChanged&&jk(s)}},[p,y,s]),null}function qN(){const s=ia(),t=s.routesById[xl].options.pendingComponent??s.options.defaultPendingComponent,a=t?l.jsx(t,{}):null,r=l.jsxs(typeof document<"u"&&s.ssr?No:_.Suspense,{fallback:a,children:[l.jsx(UN,{}),l.jsx($N,{})]});return s.options.InnerWrap?l.jsx(s.options.InnerWrap,{children:r}):r}function $N(){const s=ia(),t=aa({select:c=>{var u;return(u=c.matches[0])==null?void 0:u.id}}),a=aa({select:c=>c.loadedAt}),r=t?l.jsx(gS,{matchId:t}):null;return l.jsx(eh.Provider,{value:t,children:s.options.disableGlobalCatchBoundary?r:l.jsx(Ug,{getResetKey:()=>a,errorComponent:qg,onCatch:void 0,children:r})})}var HN=s=>new FN(s),FN=class extends aN{constructor(s){super(s)}};typeof globalThis<"u"?(globalThis.createFileRoute=Jb,globalThis.createLazyFileRoute=nx):typeof window<"u"&&(window.createFileRoute=Jb,window.createLazyFileRoute=nx);function QN({router:s,children:t,...a}){Object.keys(a).length>0&&s.update({...s.options,...a,context:{...s.options.context,...a.context}});const r=l.jsx(mS.Provider,{value:s,children:t});return s.options.Wrap?l.jsx(s.options.Wrap,{children:r}):r}function GN({router:s,...t}){return l.jsx(QN,{router:s,...t,children:l.jsx(qN,{})})}var Bt;(function(s){s.assertEqual=c=>{};function t(c){}s.assertIs=t;function a(c){throw new Error}s.assertNever=a,s.arrayToEnum=c=>{const u={};for(const h of c)u[h]=h;return u},s.getValidEnumValues=c=>{const u=s.objectKeys(c).filter(p=>typeof c[c[p]]!="number"),h={};for(const p of u)h[p]=c[p];return s.objectValues(h)},s.objectValues=c=>s.objectKeys(c).map(function(u){return c[u]}),s.objectKeys=typeof Object.keys=="function"?c=>Object.keys(c):c=>{const u=[];for(const h in c)Object.prototype.hasOwnProperty.call(c,h)&&u.push(h);return u},s.find=(c,u)=>{for(const h of c)if(u(h))return h},s.isInteger=typeof Number.isInteger=="function"?c=>Number.isInteger(c):c=>typeof c=="number"&&Number.isFinite(c)&&Math.floor(c)===c;function r(c,u=" | "){return c.map(h=>typeof h=="string"?`'${h}'`:h).join(u)}s.joinValues=r,s.jsonStringifyReplacer=(c,u)=>typeof u=="bigint"?u.toString():u})(Bt||(Bt={}));var ax;(function(s){s.mergeShapes=(t,a)=>({...t,...a})})(ax||(ax={}));const Qe=Bt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),lr=s=>{switch(typeof s){case"undefined":return Qe.undefined;case"string":return Qe.string;case"number":return Number.isNaN(s)?Qe.nan:Qe.number;case"boolean":return Qe.boolean;case"function":return Qe.function;case"bigint":return Qe.bigint;case"symbol":return Qe.symbol;case"object":return Array.isArray(s)?Qe.array:s===null?Qe.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?Qe.promise:typeof Map<"u"&&s instanceof Map?Qe.map:typeof Set<"u"&&s instanceof Set?Qe.set:typeof Date<"u"&&s instanceof Date?Qe.date:Qe.object;default:return Qe.unknown}},Me=Bt.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 Ni extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};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},r={_errors:[]},c=u=>{for(const h of u.issues)if(h.code==="invalid_union")h.unionErrors.map(c);else if(h.code==="invalid_return_type")c(h.returnTypeError);else if(h.code==="invalid_arguments")c(h.argumentsError);else if(h.path.length===0)r._errors.push(a(h));else{let p=r,y=0;for(;y<h.path.length;){const m=h.path[y];y===h.path.length-1?(p[m]=p[m]||{_errors:[]},p[m]._errors.push(a(h))):p[m]=p[m]||{_errors:[]},p=p[m],y++}}};return c(this),r}static assert(t){if(!(t instanceof Ni))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Bt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=a=>a.message){const a={},r=[];for(const c of this.issues)if(c.path.length>0){const u=c.path[0];a[u]=a[u]||[],a[u].push(t(c))}else r.push(t(c));return{formErrors:r,fieldErrors:a}}get formErrors(){return this.flatten()}}Ni.create=s=>new Ni(s);const ig=(s,t)=>{let a;switch(s.code){case Me.invalid_type:s.received===Qe.undefined?a="Required":a=`Expected ${s.expected}, received ${s.received}`;break;case Me.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(s.expected,Bt.jsonStringifyReplacer)}`;break;case Me.unrecognized_keys:a=`Unrecognized key(s) in object: ${Bt.joinValues(s.keys,", ")}`;break;case Me.invalid_union:a="Invalid input";break;case Me.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${Bt.joinValues(s.options)}`;break;case Me.invalid_enum_value:a=`Invalid enum value. Expected ${Bt.joinValues(s.options)}, received '${s.received}'`;break;case Me.invalid_arguments:a="Invalid function arguments";break;case Me.invalid_return_type:a="Invalid function return type";break;case Me.invalid_date:a="Invalid date";break;case Me.invalid_string:typeof s.validation=="object"?"includes"in s.validation?(a=`Invalid input: must include "${s.validation.includes}"`,typeof s.validation.position=="number"&&(a=`${a} at one or more positions greater than or equal to ${s.validation.position}`)):"startsWith"in s.validation?a=`Invalid input: must start with "${s.validation.startsWith}"`:"endsWith"in s.validation?a=`Invalid input: must end with "${s.validation.endsWith}"`:Bt.assertNever(s.validation):s.validation!=="regex"?a=`Invalid ${s.validation}`:a="Invalid";break;case Me.too_small:s.type==="array"?a=`Array must contain ${s.exact?"exactly":s.inclusive?"at least":"more than"} ${s.minimum} element(s)`:s.type==="string"?a=`String must contain ${s.exact?"exactly":s.inclusive?"at least":"over"} ${s.minimum} character(s)`:s.type==="number"?a=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="bigint"?a=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="date"?a=`Date must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(s.minimum))}`:a="Invalid input";break;case Me.too_big:s.type==="array"?a=`Array must contain ${s.exact?"exactly":s.inclusive?"at most":"less than"} ${s.maximum} element(s)`:s.type==="string"?a=`String must contain ${s.exact?"exactly":s.inclusive?"at most":"under"} ${s.maximum} character(s)`:s.type==="number"?a=`Number must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="bigint"?a=`BigInt must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="date"?a=`Date must be ${s.exact?"exactly":s.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(s.maximum))}`:a="Invalid input";break;case Me.custom:a="Invalid input";break;case Me.invalid_intersection_types:a="Intersection results could not be merged";break;case Me.not_multiple_of:a=`Number must be a multiple of ${s.multipleOf}`;break;case Me.not_finite:a="Number must be finite";break;default:a=t.defaultError,Bt.assertNever(s)}return{message:a}};let VN=ig;function KN(){return VN}const YN=s=>{const{data:t,path:a,errorMaps:r,issueData:c}=s,u=[...a,...c.path||[]],h={...c,path:u};if(c.message!==void 0)return{...c,path:u,message:c.message};let p="";const y=r.filter(m=>!!m).slice().reverse();for(const m of y)p=m(h,{data:t,defaultError:p}).message;return{...c,path:u,message:p}};function Pe(s,t){const a=KN(),r=YN({issueData:t,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,a,a===ig?void 0:ig].filter(c=>!!c)});s.common.issues.push(r)}class ms{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,a){const r=[];for(const c of a){if(c.status==="aborted")return ft;c.status==="dirty"&&t.dirty(),r.push(c.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,a){const r=[];for(const c of a){const u=await c.key,h=await c.value;r.push({key:u,value:h})}return ms.mergeObjectSync(t,r)}static mergeObjectSync(t,a){const r={};for(const c of a){const{key:u,value:h}=c;if(u.status==="aborted"||h.status==="aborted")return ft;u.status==="dirty"&&t.dirty(),h.status==="dirty"&&t.dirty(),u.value!=="__proto__"&&(typeof h.value<"u"||c.alwaysSet)&&(r[u.value]=h.value)}return{status:t.value,value:r}}}const ft=Object.freeze({status:"aborted"}),du=s=>({status:"dirty",value:s}),ra=s=>({status:"valid",value:s}),ix=s=>s.status==="aborted",rx=s=>s.status==="dirty",Ho=s=>s.status==="valid",Bf=s=>typeof Promise<"u"&&s instanceof Promise;var Xe;(function(s){s.errToObj=t=>typeof t=="string"?{message:t}:t||{},s.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(Xe||(Xe={}));class Ha{constructor(t,a,r,c){this._cachedPath=[],this.parent=t,this.data=a,this._path=r,this._key=c}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 lx=(s,t)=>{if(Ho(t))return{success:!0,data:t.value};if(!s.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 Ni(s.common.issues);return this._error=a,this._error}}};function xt(s){if(!s)return{};const{errorMap:t,invalid_type_error:a,required_error:r,description:c}=s;if(t&&(a||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:c}:{errorMap:(h,p)=>{const{message:y}=s;return h.code==="invalid_enum_value"?{message:y??p.defaultError}:typeof p.data>"u"?{message:y??r??p.defaultError}:h.code!=="invalid_type"?{message:p.defaultError}:{message:y??a??p.defaultError}},description:c}}class At{get description(){return this._def.description}_getType(t){return lr(t.data)}_getOrReturnCtx(t,a){return a||{common:t.parent.common,data:t.data,parsedType:lr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new ms,ctx:{common:t.parent.common,data:t.data,parsedType:lr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const a=this._parse(t);if(Bf(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 r=this.safeParse(t,a);if(r.success)return r.data;throw r.error}safeParse(t,a){const r={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:lr(t)},c=this._parseSync({data:t,path:r.path,parent:r});return lx(r,c)}"~validate"(t){var r,c;const a={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:lr(t)};if(!this["~standard"].async)try{const u=this._parseSync({data:t,path:[],parent:a});return Ho(u)?{value:u.value}:{issues:a.common.issues}}catch(u){(c=(r=u==null?void 0:u.message)==null?void 0:r.toLowerCase())!=null&&c.includes("encountered")&&(this["~standard"].async=!0),a.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:a}).then(u=>Ho(u)?{value:u.value}:{issues:a.common.issues})}async parseAsync(t,a){const r=await this.safeParseAsync(t,a);if(r.success)return r.data;throw r.error}async safeParseAsync(t,a){const r={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:lr(t)},c=this._parse({data:t,path:r.path,parent:r}),u=await(Bf(c)?c:Promise.resolve(c));return lx(r,u)}refine(t,a){const r=c=>typeof a=="string"||typeof a>"u"?{message:a}:typeof a=="function"?a(c):a;return this._refinement((c,u)=>{const h=t(c),p=()=>u.addIssue({code:Me.custom,...r(c)});return typeof Promise<"u"&&h instanceof Promise?h.then(y=>y?!0:(p(),!1)):h?!0:(p(),!1)})}refinement(t,a){return this._refinement((r,c)=>t(r)?!0:(c.addIssue(typeof a=="function"?a(r,c):a),!1))}_refinement(t){return new Go({schema:this,typeName:ut.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 kr.create(this,this._def)}nullable(){return Vo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return $a.create(this)}promise(){return Hf.create(this,this._def)}or(t){return Uf.create([this,t],this._def)}and(t){return qf.create(this,t,this._def)}transform(t){return new Go({...xt(this._def),schema:this,typeName:ut.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const a=typeof t=="function"?t:()=>t;return new ug({...xt(this._def),innerType:this,defaultValue:a,typeName:ut.ZodDefault})}brand(){return new v2({typeName:ut.ZodBranded,type:this,...xt(this._def)})}catch(t){const a=typeof t=="function"?t:()=>t;return new dg({...xt(this._def),innerType:this,catchValue:a,typeName:ut.ZodCatch})}describe(t){const a=this.constructor;return new a({...this._def,description:t})}pipe(t){return Gg.create(this,t)}readonly(){return fg.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const ZN=/^c[^\s-]{8,}$/i,WN=/^[0-9a-z]+$/,XN=/^[0-9A-HJKMNP-TV-Z]{26}$/i,JN=/^[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,e2=/^[a-z0-9_-]{21}$/i,t2=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,n2=/^[-+]?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)?)??$/,s2=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,a2="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let jp;const i2=/^(?:(?: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])$/,r2=/^(?:(?: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])$/,l2=/^(([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]))$/,o2=/^(([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])$/,c2=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,u2=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,vS="((\\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])))",d2=new RegExp(`^${vS}$`);function _S(s){let t="[0-5]\\d";s.precision?t=`${t}\\.\\d{${s.precision}}`:s.precision==null&&(t=`${t}(\\.\\d+)?`);const a=s.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${a}`}function f2(s){return new RegExp(`^${_S(s)}$`)}function h2(s){let t=`${vS}T${_S(s)}`;const a=[];return a.push(s.local?"Z?":"Z"),s.offset&&a.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${a.join("|")})`,new RegExp(`^${t}$`)}function m2(s,t){return!!((t==="v4"||!t)&&i2.test(s)||(t==="v6"||!t)&&l2.test(s))}function p2(s,t){if(!t2.test(s))return!1;try{const[a]=s.split(".");if(!a)return!1;const r=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),c=JSON.parse(atob(r));return!(typeof c!="object"||c===null||"typ"in c&&(c==null?void 0:c.typ)!=="JWT"||!c.alg||t&&c.alg!==t)}catch{return!1}}function g2(s,t){return!!((t==="v4"||!t)&&r2.test(s)||(t==="v6"||!t)&&o2.test(s))}class ji extends At{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Qe.string){const u=this._getOrReturnCtx(t);return Pe(u,{code:Me.invalid_type,expected:Qe.string,received:u.parsedType}),ft}const r=new ms;let c;for(const u of this._def.checks)if(u.kind==="min")t.data.length<u.value&&(c=this._getOrReturnCtx(t,c),Pe(c,{code:Me.too_small,minimum:u.value,type:"string",inclusive:!0,exact:!1,message:u.message}),r.dirty());else if(u.kind==="max")t.data.length>u.value&&(c=this._getOrReturnCtx(t,c),Pe(c,{code:Me.too_big,maximum:u.value,type:"string",inclusive:!0,exact:!1,message:u.message}),r.dirty());else if(u.kind==="length"){const h=t.data.length>u.value,p=t.data.length<u.value;(h||p)&&(c=this._getOrReturnCtx(t,c),h?Pe(c,{code:Me.too_big,maximum:u.value,type:"string",inclusive:!0,exact:!0,message:u.message}):p&&Pe(c,{code:Me.too_small,minimum:u.value,type:"string",inclusive:!0,exact:!0,message:u.message}),r.dirty())}else if(u.kind==="email")s2.test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"email",code:Me.invalid_string,message:u.message}),r.dirty());else if(u.kind==="emoji")jp||(jp=new RegExp(a2,"u")),jp.test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"emoji",code:Me.invalid_string,message:u.message}),r.dirty());else if(u.kind==="uuid")JN.test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"uuid",code:Me.invalid_string,message:u.message}),r.dirty());else if(u.kind==="nanoid")e2.test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"nanoid",code:Me.invalid_string,message:u.message}),r.dirty());else if(u.kind==="cuid")ZN.test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"cuid",code:Me.invalid_string,message:u.message}),r.dirty());else if(u.kind==="cuid2")WN.test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"cuid2",code:Me.invalid_string,message:u.message}),r.dirty());else if(u.kind==="ulid")XN.test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"ulid",code:Me.invalid_string,message:u.message}),r.dirty());else if(u.kind==="url")try{new URL(t.data)}catch{c=this._getOrReturnCtx(t,c),Pe(c,{validation:"url",code:Me.invalid_string,message:u.message}),r.dirty()}else u.kind==="regex"?(u.regex.lastIndex=0,u.regex.test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"regex",code:Me.invalid_string,message:u.message}),r.dirty())):u.kind==="trim"?t.data=t.data.trim():u.kind==="includes"?t.data.includes(u.value,u.position)||(c=this._getOrReturnCtx(t,c),Pe(c,{code:Me.invalid_string,validation:{includes:u.value,position:u.position},message:u.message}),r.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)||(c=this._getOrReturnCtx(t,c),Pe(c,{code:Me.invalid_string,validation:{startsWith:u.value},message:u.message}),r.dirty()):u.kind==="endsWith"?t.data.endsWith(u.value)||(c=this._getOrReturnCtx(t,c),Pe(c,{code:Me.invalid_string,validation:{endsWith:u.value},message:u.message}),r.dirty()):u.kind==="datetime"?h2(u).test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{code:Me.invalid_string,validation:"datetime",message:u.message}),r.dirty()):u.kind==="date"?d2.test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{code:Me.invalid_string,validation:"date",message:u.message}),r.dirty()):u.kind==="time"?f2(u).test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{code:Me.invalid_string,validation:"time",message:u.message}),r.dirty()):u.kind==="duration"?n2.test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"duration",code:Me.invalid_string,message:u.message}),r.dirty()):u.kind==="ip"?m2(t.data,u.version)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"ip",code:Me.invalid_string,message:u.message}),r.dirty()):u.kind==="jwt"?p2(t.data,u.alg)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"jwt",code:Me.invalid_string,message:u.message}),r.dirty()):u.kind==="cidr"?g2(t.data,u.version)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"cidr",code:Me.invalid_string,message:u.message}),r.dirty()):u.kind==="base64"?c2.test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"base64",code:Me.invalid_string,message:u.message}),r.dirty()):u.kind==="base64url"?u2.test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"base64url",code:Me.invalid_string,message:u.message}),r.dirty()):Bt.assertNever(u);return{status:r.value,value:t.data}}_regex(t,a,r){return this.refinement(c=>t.test(c),{validation:a,code:Me.invalid_string,...Xe.errToObj(r)})}_addCheck(t){return new ji({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Xe.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Xe.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Xe.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Xe.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Xe.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Xe.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Xe.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Xe.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Xe.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Xe.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Xe.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Xe.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Xe.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,...Xe.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,...Xe.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...Xe.errToObj(t)})}regex(t,a){return this._addCheck({kind:"regex",regex:t,...Xe.errToObj(a)})}includes(t,a){return this._addCheck({kind:"includes",value:t,position:a==null?void 0:a.position,...Xe.errToObj(a==null?void 0:a.message)})}startsWith(t,a){return this._addCheck({kind:"startsWith",value:t,...Xe.errToObj(a)})}endsWith(t,a){return this._addCheck({kind:"endsWith",value:t,...Xe.errToObj(a)})}min(t,a){return this._addCheck({kind:"min",value:t,...Xe.errToObj(a)})}max(t,a){return this._addCheck({kind:"max",value:t,...Xe.errToObj(a)})}length(t,a){return this._addCheck({kind:"length",value:t,...Xe.errToObj(a)})}nonempty(t){return this.min(1,Xe.errToObj(t))}trim(){return new ji({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ji({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ji({...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}}ji.create=s=>new ji({checks:[],typeName:ut.ZodString,coerce:(s==null?void 0:s.coerce)??!1,...xt(s)});function y2(s,t){const a=(s.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,c=a>r?a:r,u=Number.parseInt(s.toFixed(c).replace(".","")),h=Number.parseInt(t.toFixed(c).replace(".",""));return u%h/10**c}class Fo extends At{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)!==Qe.number){const u=this._getOrReturnCtx(t);return Pe(u,{code:Me.invalid_type,expected:Qe.number,received:u.parsedType}),ft}let r;const c=new ms;for(const u of this._def.checks)u.kind==="int"?Bt.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),Pe(r,{code:Me.invalid_type,expected:"integer",received:"float",message:u.message}),c.dirty()):u.kind==="min"?(u.inclusive?t.data<u.value:t.data<=u.value)&&(r=this._getOrReturnCtx(t,r),Pe(r,{code:Me.too_small,minimum:u.value,type:"number",inclusive:u.inclusive,exact:!1,message:u.message}),c.dirty()):u.kind==="max"?(u.inclusive?t.data>u.value:t.data>=u.value)&&(r=this._getOrReturnCtx(t,r),Pe(r,{code:Me.too_big,maximum:u.value,type:"number",inclusive:u.inclusive,exact:!1,message:u.message}),c.dirty()):u.kind==="multipleOf"?y2(t.data,u.value)!==0&&(r=this._getOrReturnCtx(t,r),Pe(r,{code:Me.not_multiple_of,multipleOf:u.value,message:u.message}),c.dirty()):u.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),Pe(r,{code:Me.not_finite,message:u.message}),c.dirty()):Bt.assertNever(u);return{status:c.value,value:t.data}}gte(t,a){return this.setLimit("min",t,!0,Xe.toString(a))}gt(t,a){return this.setLimit("min",t,!1,Xe.toString(a))}lte(t,a){return this.setLimit("max",t,!0,Xe.toString(a))}lt(t,a){return this.setLimit("max",t,!1,Xe.toString(a))}setLimit(t,a,r,c){return new Fo({...this._def,checks:[...this._def.checks,{kind:t,value:a,inclusive:r,message:Xe.toString(c)}]})}_addCheck(t){return new Fo({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Xe.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Xe.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Xe.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Xe.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Xe.toString(t)})}multipleOf(t,a){return this._addCheck({kind:"multipleOf",value:t,message:Xe.toString(a)})}finite(t){return this._addCheck({kind:"finite",message:Xe.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Xe.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Xe.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"&&Bt.isInteger(t.value))}get isFinite(){let t=null,a=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(a===null||r.value>a)&&(a=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(a)&&Number.isFinite(t)}}Fo.create=s=>new Fo({checks:[],typeName:ut.ZodNumber,coerce:(s==null?void 0:s.coerce)||!1,...xt(s)});class wu extends At{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)!==Qe.bigint)return this._getInvalidInput(t);let r;const c=new ms;for(const u of this._def.checks)u.kind==="min"?(u.inclusive?t.data<u.value:t.data<=u.value)&&(r=this._getOrReturnCtx(t,r),Pe(r,{code:Me.too_small,type:"bigint",minimum:u.value,inclusive:u.inclusive,message:u.message}),c.dirty()):u.kind==="max"?(u.inclusive?t.data>u.value:t.data>=u.value)&&(r=this._getOrReturnCtx(t,r),Pe(r,{code:Me.too_big,type:"bigint",maximum:u.value,inclusive:u.inclusive,message:u.message}),c.dirty()):u.kind==="multipleOf"?t.data%u.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),Pe(r,{code:Me.not_multiple_of,multipleOf:u.value,message:u.message}),c.dirty()):Bt.assertNever(u);return{status:c.value,value:t.data}}_getInvalidInput(t){const a=this._getOrReturnCtx(t);return Pe(a,{code:Me.invalid_type,expected:Qe.bigint,received:a.parsedType}),ft}gte(t,a){return this.setLimit("min",t,!0,Xe.toString(a))}gt(t,a){return this.setLimit("min",t,!1,Xe.toString(a))}lte(t,a){return this.setLimit("max",t,!0,Xe.toString(a))}lt(t,a){return this.setLimit("max",t,!1,Xe.toString(a))}setLimit(t,a,r,c){return new wu({...this._def,checks:[...this._def.checks,{kind:t,value:a,inclusive:r,message:Xe.toString(c)}]})}_addCheck(t){return new wu({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Xe.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Xe.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Xe.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Xe.toString(t)})}multipleOf(t,a){return this._addCheck({kind:"multipleOf",value:t,message:Xe.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}}wu.create=s=>new wu({checks:[],typeName:ut.ZodBigInt,coerce:(s==null?void 0:s.coerce)??!1,...xt(s)});class rg extends At{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Qe.boolean){const r=this._getOrReturnCtx(t);return Pe(r,{code:Me.invalid_type,expected:Qe.boolean,received:r.parsedType}),ft}return ra(t.data)}}rg.create=s=>new rg({typeName:ut.ZodBoolean,coerce:(s==null?void 0:s.coerce)||!1,...xt(s)});class Pf extends At{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Qe.date){const u=this._getOrReturnCtx(t);return Pe(u,{code:Me.invalid_type,expected:Qe.date,received:u.parsedType}),ft}if(Number.isNaN(t.data.getTime())){const u=this._getOrReturnCtx(t);return Pe(u,{code:Me.invalid_date}),ft}const r=new ms;let c;for(const u of this._def.checks)u.kind==="min"?t.data.getTime()<u.value&&(c=this._getOrReturnCtx(t,c),Pe(c,{code:Me.too_small,message:u.message,inclusive:!0,exact:!1,minimum:u.value,type:"date"}),r.dirty()):u.kind==="max"?t.data.getTime()>u.value&&(c=this._getOrReturnCtx(t,c),Pe(c,{code:Me.too_big,message:u.message,inclusive:!0,exact:!1,maximum:u.value,type:"date"}),r.dirty()):Bt.assertNever(u);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Pf({...this._def,checks:[...this._def.checks,t]})}min(t,a){return this._addCheck({kind:"min",value:t.getTime(),message:Xe.toString(a)})}max(t,a){return this._addCheck({kind:"max",value:t.getTime(),message:Xe.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}}Pf.create=s=>new Pf({checks:[],coerce:(s==null?void 0:s.coerce)||!1,typeName:ut.ZodDate,...xt(s)});class ox extends At{_parse(t){if(this._getType(t)!==Qe.symbol){const r=this._getOrReturnCtx(t);return Pe(r,{code:Me.invalid_type,expected:Qe.symbol,received:r.parsedType}),ft}return ra(t.data)}}ox.create=s=>new ox({typeName:ut.ZodSymbol,...xt(s)});class cx extends At{_parse(t){if(this._getType(t)!==Qe.undefined){const r=this._getOrReturnCtx(t);return Pe(r,{code:Me.invalid_type,expected:Qe.undefined,received:r.parsedType}),ft}return ra(t.data)}}cx.create=s=>new cx({typeName:ut.ZodUndefined,...xt(s)});class ux extends At{_parse(t){if(this._getType(t)!==Qe.null){const r=this._getOrReturnCtx(t);return Pe(r,{code:Me.invalid_type,expected:Qe.null,received:r.parsedType}),ft}return ra(t.data)}}ux.create=s=>new ux({typeName:ut.ZodNull,...xt(s)});class lg extends At{constructor(){super(...arguments),this._any=!0}_parse(t){return ra(t.data)}}lg.create=s=>new lg({typeName:ut.ZodAny,...xt(s)});class dx extends At{constructor(){super(...arguments),this._unknown=!0}_parse(t){return ra(t.data)}}dx.create=s=>new dx({typeName:ut.ZodUnknown,...xt(s)});class Tr extends At{_parse(t){const a=this._getOrReturnCtx(t);return Pe(a,{code:Me.invalid_type,expected:Qe.never,received:a.parsedType}),ft}}Tr.create=s=>new Tr({typeName:ut.ZodNever,...xt(s)});class fx extends At{_parse(t){if(this._getType(t)!==Qe.undefined){const r=this._getOrReturnCtx(t);return Pe(r,{code:Me.invalid_type,expected:Qe.void,received:r.parsedType}),ft}return ra(t.data)}}fx.create=s=>new fx({typeName:ut.ZodVoid,...xt(s)});class $a extends At{_parse(t){const{ctx:a,status:r}=this._processInputParams(t),c=this._def;if(a.parsedType!==Qe.array)return Pe(a,{code:Me.invalid_type,expected:Qe.array,received:a.parsedType}),ft;if(c.exactLength!==null){const h=a.data.length>c.exactLength.value,p=a.data.length<c.exactLength.value;(h||p)&&(Pe(a,{code:h?Me.too_big:Me.too_small,minimum:p?c.exactLength.value:void 0,maximum:h?c.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:c.exactLength.message}),r.dirty())}if(c.minLength!==null&&a.data.length<c.minLength.value&&(Pe(a,{code:Me.too_small,minimum:c.minLength.value,type:"array",inclusive:!0,exact:!1,message:c.minLength.message}),r.dirty()),c.maxLength!==null&&a.data.length>c.maxLength.value&&(Pe(a,{code:Me.too_big,maximum:c.maxLength.value,type:"array",inclusive:!0,exact:!1,message:c.maxLength.message}),r.dirty()),a.common.async)return Promise.all([...a.data].map((h,p)=>c.type._parseAsync(new Ha(a,h,a.path,p)))).then(h=>ms.mergeArray(r,h));const u=[...a.data].map((h,p)=>c.type._parseSync(new Ha(a,h,a.path,p)));return ms.mergeArray(r,u)}get element(){return this._def.type}min(t,a){return new $a({...this._def,minLength:{value:t,message:Xe.toString(a)}})}max(t,a){return new $a({...this._def,maxLength:{value:t,message:Xe.toString(a)}})}length(t,a){return new $a({...this._def,exactLength:{value:t,message:Xe.toString(a)}})}nonempty(t){return this.min(1,t)}}$a.create=(s,t)=>new $a({type:s,minLength:null,maxLength:null,exactLength:null,typeName:ut.ZodArray,...xt(t)});function Co(s){if(s instanceof Dn){const t={};for(const a in s.shape){const r=s.shape[a];t[a]=kr.create(Co(r))}return new Dn({...s._def,shape:()=>t})}else return s instanceof $a?new $a({...s._def,type:Co(s.element)}):s instanceof kr?kr.create(Co(s.unwrap())):s instanceof Vo?Vo.create(Co(s.unwrap())):s instanceof Cl?Cl.create(s.items.map(t=>Co(t))):s}class Dn extends At{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=Bt.objectKeys(t);return this._cached={shape:t,keys:a},this._cached}_parse(t){if(this._getType(t)!==Qe.object){const m=this._getOrReturnCtx(t);return Pe(m,{code:Me.invalid_type,expected:Qe.object,received:m.parsedType}),ft}const{status:r,ctx:c}=this._processInputParams(t),{shape:u,keys:h}=this._getCached(),p=[];if(!(this._def.catchall instanceof Tr&&this._def.unknownKeys==="strip"))for(const m in c.data)h.includes(m)||p.push(m);const y=[];for(const m of h){const x=u[m],g=c.data[m];y.push({key:{status:"valid",value:m},value:x._parse(new Ha(c,g,c.path,m)),alwaysSet:m in c.data})}if(this._def.catchall instanceof Tr){const m=this._def.unknownKeys;if(m==="passthrough")for(const x of p)y.push({key:{status:"valid",value:x},value:{status:"valid",value:c.data[x]}});else if(m==="strict")p.length>0&&(Pe(c,{code:Me.unrecognized_keys,keys:p}),r.dirty());else if(m!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const m=this._def.catchall;for(const x of p){const g=c.data[x];y.push({key:{status:"valid",value:x},value:m._parse(new Ha(c,g,c.path,x)),alwaysSet:x in c.data})}}return c.common.async?Promise.resolve().then(async()=>{const m=[];for(const x of y){const g=await x.key,S=await x.value;m.push({key:g,value:S,alwaysSet:x.alwaysSet})}return m}).then(m=>ms.mergeObjectSync(r,m)):ms.mergeObjectSync(r,y)}get shape(){return this._def.shape()}strict(t){return Xe.errToObj,new Dn({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(a,r)=>{var u,h;const c=((h=(u=this._def).errorMap)==null?void 0:h.call(u,a,r).message)??r.defaultError;return a.code==="unrecognized_keys"?{message:Xe.errToObj(t).message??c}:{message:c}}}:{}})}strip(){return new Dn({...this._def,unknownKeys:"strip"})}passthrough(){return new Dn({...this._def,unknownKeys:"passthrough"})}extend(t){return new Dn({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Dn({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:ut.ZodObject})}setKey(t,a){return this.augment({[t]:a})}catchall(t){return new Dn({...this._def,catchall:t})}pick(t){const a={};for(const r of Bt.objectKeys(t))t[r]&&this.shape[r]&&(a[r]=this.shape[r]);return new Dn({...this._def,shape:()=>a})}omit(t){const a={};for(const r of Bt.objectKeys(this.shape))t[r]||(a[r]=this.shape[r]);return new Dn({...this._def,shape:()=>a})}deepPartial(){return Co(this)}partial(t){const a={};for(const r of Bt.objectKeys(this.shape)){const c=this.shape[r];t&&!t[r]?a[r]=c:a[r]=c.optional()}return new Dn({...this._def,shape:()=>a})}required(t){const a={};for(const r of Bt.objectKeys(this.shape))if(t&&!t[r])a[r]=this.shape[r];else{let u=this.shape[r];for(;u instanceof kr;)u=u._def.innerType;a[r]=u}return new Dn({...this._def,shape:()=>a})}keyof(){return bS(Bt.objectKeys(this.shape))}}Dn.create=(s,t)=>new Dn({shape:()=>s,unknownKeys:"strip",catchall:Tr.create(),typeName:ut.ZodObject,...xt(t)});Dn.strictCreate=(s,t)=>new Dn({shape:()=>s,unknownKeys:"strict",catchall:Tr.create(),typeName:ut.ZodObject,...xt(t)});Dn.lazycreate=(s,t)=>new Dn({shape:s,unknownKeys:"strip",catchall:Tr.create(),typeName:ut.ZodObject,...xt(t)});class Uf extends At{_parse(t){const{ctx:a}=this._processInputParams(t),r=this._def.options;function c(u){for(const p of u)if(p.result.status==="valid")return p.result;for(const p of u)if(p.result.status==="dirty")return a.common.issues.push(...p.ctx.common.issues),p.result;const h=u.map(p=>new Ni(p.ctx.common.issues));return Pe(a,{code:Me.invalid_union,unionErrors:h}),ft}if(a.common.async)return Promise.all(r.map(async u=>{const h={...a,common:{...a.common,issues:[]},parent:null};return{result:await u._parseAsync({data:a.data,path:a.path,parent:h}),ctx:h}})).then(c);{let u;const h=[];for(const y of r){const m={...a,common:{...a.common,issues:[]},parent:null},x=y._parseSync({data:a.data,path:a.path,parent:m});if(x.status==="valid")return x;x.status==="dirty"&&!u&&(u={result:x,ctx:m}),m.common.issues.length&&h.push(m.common.issues)}if(u)return a.common.issues.push(...u.ctx.common.issues),u.result;const p=h.map(y=>new Ni(y));return Pe(a,{code:Me.invalid_union,unionErrors:p}),ft}}get options(){return this._def.options}}Uf.create=(s,t)=>new Uf({options:s,typeName:ut.ZodUnion,...xt(t)});function og(s,t){const a=lr(s),r=lr(t);if(s===t)return{valid:!0,data:s};if(a===Qe.object&&r===Qe.object){const c=Bt.objectKeys(t),u=Bt.objectKeys(s).filter(p=>c.indexOf(p)!==-1),h={...s,...t};for(const p of u){const y=og(s[p],t[p]);if(!y.valid)return{valid:!1};h[p]=y.data}return{valid:!0,data:h}}else if(a===Qe.array&&r===Qe.array){if(s.length!==t.length)return{valid:!1};const c=[];for(let u=0;u<s.length;u++){const h=s[u],p=t[u],y=og(h,p);if(!y.valid)return{valid:!1};c.push(y.data)}return{valid:!0,data:c}}else return a===Qe.date&&r===Qe.date&&+s==+t?{valid:!0,data:s}:{valid:!1}}class qf extends At{_parse(t){const{status:a,ctx:r}=this._processInputParams(t),c=(u,h)=>{if(ix(u)||ix(h))return ft;const p=og(u.value,h.value);return p.valid?((rx(u)||rx(h))&&a.dirty(),{status:a.value,value:p.data}):(Pe(r,{code:Me.invalid_intersection_types}),ft)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([u,h])=>c(u,h)):c(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}qf.create=(s,t,a)=>new qf({left:s,right:t,typeName:ut.ZodIntersection,...xt(a)});class Cl extends At{_parse(t){const{status:a,ctx:r}=this._processInputParams(t);if(r.parsedType!==Qe.array)return Pe(r,{code:Me.invalid_type,expected:Qe.array,received:r.parsedType}),ft;if(r.data.length<this._def.items.length)return Pe(r,{code:Me.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ft;!this._def.rest&&r.data.length>this._def.items.length&&(Pe(r,{code:Me.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),a.dirty());const u=[...r.data].map((h,p)=>{const y=this._def.items[p]||this._def.rest;return y?y._parse(new Ha(r,h,r.path,p)):null}).filter(h=>!!h);return r.common.async?Promise.all(u).then(h=>ms.mergeArray(a,h)):ms.mergeArray(a,u)}get items(){return this._def.items}rest(t){return new Cl({...this._def,rest:t})}}Cl.create=(s,t)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Cl({items:s,typeName:ut.ZodTuple,rest:null,...xt(t)})};class $f extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:a,ctx:r}=this._processInputParams(t);if(r.parsedType!==Qe.object)return Pe(r,{code:Me.invalid_type,expected:Qe.object,received:r.parsedType}),ft;const c=[],u=this._def.keyType,h=this._def.valueType;for(const p in r.data)c.push({key:u._parse(new Ha(r,p,r.path,p)),value:h._parse(new Ha(r,r.data[p],r.path,p)),alwaysSet:p in r.data});return r.common.async?ms.mergeObjectAsync(a,c):ms.mergeObjectSync(a,c)}get element(){return this._def.valueType}static create(t,a,r){return a instanceof At?new $f({keyType:t,valueType:a,typeName:ut.ZodRecord,...xt(r)}):new $f({keyType:ji.create(),valueType:t,typeName:ut.ZodRecord,...xt(a)})}}class hx extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:a,ctx:r}=this._processInputParams(t);if(r.parsedType!==Qe.map)return Pe(r,{code:Me.invalid_type,expected:Qe.map,received:r.parsedType}),ft;const c=this._def.keyType,u=this._def.valueType,h=[...r.data.entries()].map(([p,y],m)=>({key:c._parse(new Ha(r,p,r.path,[m,"key"])),value:u._parse(new Ha(r,y,r.path,[m,"value"]))}));if(r.common.async){const p=new Map;return Promise.resolve().then(async()=>{for(const y of h){const m=await y.key,x=await y.value;if(m.status==="aborted"||x.status==="aborted")return ft;(m.status==="dirty"||x.status==="dirty")&&a.dirty(),p.set(m.value,x.value)}return{status:a.value,value:p}})}else{const p=new Map;for(const y of h){const m=y.key,x=y.value;if(m.status==="aborted"||x.status==="aborted")return ft;(m.status==="dirty"||x.status==="dirty")&&a.dirty(),p.set(m.value,x.value)}return{status:a.value,value:p}}}}hx.create=(s,t,a)=>new hx({valueType:t,keyType:s,typeName:ut.ZodMap,...xt(a)});class ku extends At{_parse(t){const{status:a,ctx:r}=this._processInputParams(t);if(r.parsedType!==Qe.set)return Pe(r,{code:Me.invalid_type,expected:Qe.set,received:r.parsedType}),ft;const c=this._def;c.minSize!==null&&r.data.size<c.minSize.value&&(Pe(r,{code:Me.too_small,minimum:c.minSize.value,type:"set",inclusive:!0,exact:!1,message:c.minSize.message}),a.dirty()),c.maxSize!==null&&r.data.size>c.maxSize.value&&(Pe(r,{code:Me.too_big,maximum:c.maxSize.value,type:"set",inclusive:!0,exact:!1,message:c.maxSize.message}),a.dirty());const u=this._def.valueType;function h(y){const m=new Set;for(const x of y){if(x.status==="aborted")return ft;x.status==="dirty"&&a.dirty(),m.add(x.value)}return{status:a.value,value:m}}const p=[...r.data.values()].map((y,m)=>u._parse(new Ha(r,y,r.path,m)));return r.common.async?Promise.all(p).then(y=>h(y)):h(p)}min(t,a){return new ku({...this._def,minSize:{value:t,message:Xe.toString(a)}})}max(t,a){return new ku({...this._def,maxSize:{value:t,message:Xe.toString(a)}})}size(t,a){return this.min(t,a).max(t,a)}nonempty(t){return this.min(1,t)}}ku.create=(s,t)=>new ku({valueType:s,minSize:null,maxSize:null,typeName:ut.ZodSet,...xt(t)});class mx extends At{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})}}mx.create=(s,t)=>new mx({getter:s,typeName:ut.ZodLazy,...xt(t)});class cg extends At{_parse(t){if(t.data!==this._def.value){const a=this._getOrReturnCtx(t);return Pe(a,{received:a.data,code:Me.invalid_literal,expected:this._def.value}),ft}return{status:"valid",value:t.data}}get value(){return this._def.value}}cg.create=(s,t)=>new cg({value:s,typeName:ut.ZodLiteral,...xt(t)});function bS(s,t){return new Qo({values:s,typeName:ut.ZodEnum,...xt(t)})}class Qo extends At{_parse(t){if(typeof t.data!="string"){const a=this._getOrReturnCtx(t),r=this._def.values;return Pe(a,{expected:Bt.joinValues(r),received:a.parsedType,code:Me.invalid_type}),ft}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const a=this._getOrReturnCtx(t),r=this._def.values;return Pe(a,{received:a.data,code:Me.invalid_enum_value,options:r}),ft}return ra(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 Qo.create(t,{...this._def,...a})}exclude(t,a=this._def){return Qo.create(this.options.filter(r=>!t.includes(r)),{...this._def,...a})}}Qo.create=bS;class px extends At{_parse(t){const a=Bt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==Qe.string&&r.parsedType!==Qe.number){const c=Bt.objectValues(a);return Pe(r,{expected:Bt.joinValues(c),received:r.parsedType,code:Me.invalid_type}),ft}if(this._cache||(this._cache=new Set(Bt.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const c=Bt.objectValues(a);return Pe(r,{received:r.data,code:Me.invalid_enum_value,options:c}),ft}return ra(t.data)}get enum(){return this._def.values}}px.create=(s,t)=>new px({values:s,typeName:ut.ZodNativeEnum,...xt(t)});class Hf extends At{unwrap(){return this._def.type}_parse(t){const{ctx:a}=this._processInputParams(t);if(a.parsedType!==Qe.promise&&a.common.async===!1)return Pe(a,{code:Me.invalid_type,expected:Qe.promise,received:a.parsedType}),ft;const r=a.parsedType===Qe.promise?a.data:Promise.resolve(a.data);return ra(r.then(c=>this._def.type.parseAsync(c,{path:a.path,errorMap:a.common.contextualErrorMap})))}}Hf.create=(s,t)=>new Hf({type:s,typeName:ut.ZodPromise,...xt(t)});class Go extends At{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ut.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:a,ctx:r}=this._processInputParams(t),c=this._def.effect||null,u={addIssue:h=>{Pe(r,h),h.fatal?a.abort():a.dirty()},get path(){return r.path}};if(u.addIssue=u.addIssue.bind(u),c.type==="preprocess"){const h=c.transform(r.data,u);if(r.common.async)return Promise.resolve(h).then(async p=>{if(a.value==="aborted")return ft;const y=await this._def.schema._parseAsync({data:p,path:r.path,parent:r});return y.status==="aborted"?ft:y.status==="dirty"||a.value==="dirty"?du(y.value):y});{if(a.value==="aborted")return ft;const p=this._def.schema._parseSync({data:h,path:r.path,parent:r});return p.status==="aborted"?ft:p.status==="dirty"||a.value==="dirty"?du(p.value):p}}if(c.type==="refinement"){const h=p=>{const y=c.refinement(p,u);if(r.common.async)return Promise.resolve(y);if(y instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return p};if(r.common.async===!1){const p=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return p.status==="aborted"?ft:(p.status==="dirty"&&a.dirty(),h(p.value),{status:a.value,value:p.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(p=>p.status==="aborted"?ft:(p.status==="dirty"&&a.dirty(),h(p.value).then(()=>({status:a.value,value:p.value}))))}if(c.type==="transform")if(r.common.async===!1){const h=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Ho(h))return ft;const p=c.transform(h.value,u);if(p instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:a.value,value:p}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(h=>Ho(h)?Promise.resolve(c.transform(h.value,u)).then(p=>({status:a.value,value:p})):ft);Bt.assertNever(c)}}Go.create=(s,t,a)=>new Go({schema:s,typeName:ut.ZodEffects,effect:t,...xt(a)});Go.createWithPreprocess=(s,t,a)=>new Go({schema:t,effect:{type:"preprocess",transform:s},typeName:ut.ZodEffects,...xt(a)});class kr extends At{_parse(t){return this._getType(t)===Qe.undefined?ra(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}kr.create=(s,t)=>new kr({innerType:s,typeName:ut.ZodOptional,...xt(t)});class Vo extends At{_parse(t){return this._getType(t)===Qe.null?ra(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Vo.create=(s,t)=>new Vo({innerType:s,typeName:ut.ZodNullable,...xt(t)});class ug extends At{_parse(t){const{ctx:a}=this._processInputParams(t);let r=a.data;return a.parsedType===Qe.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:a.path,parent:a})}removeDefault(){return this._def.innerType}}ug.create=(s,t)=>new ug({innerType:s,typeName:ut.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...xt(t)});class dg extends At{_parse(t){const{ctx:a}=this._processInputParams(t),r={...a,common:{...a.common,issues:[]}},c=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Bf(c)?c.then(u=>({status:"valid",value:u.status==="valid"?u.value:this._def.catchValue({get error(){return new Ni(r.common.issues)},input:r.data})})):{status:"valid",value:c.status==="valid"?c.value:this._def.catchValue({get error(){return new Ni(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}dg.create=(s,t)=>new dg({innerType:s,typeName:ut.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...xt(t)});class gx extends At{_parse(t){if(this._getType(t)!==Qe.nan){const r=this._getOrReturnCtx(t);return Pe(r,{code:Me.invalid_type,expected:Qe.nan,received:r.parsedType}),ft}return{status:"valid",value:t.data}}}gx.create=s=>new gx({typeName:ut.ZodNaN,...xt(s)});class v2 extends At{_parse(t){const{ctx:a}=this._processInputParams(t),r=a.data;return this._def.type._parse({data:r,path:a.path,parent:a})}unwrap(){return this._def.type}}class Gg extends At{_parse(t){const{status:a,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const u=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return u.status==="aborted"?ft:u.status==="dirty"?(a.dirty(),du(u.value)):this._def.out._parseAsync({data:u.value,path:r.path,parent:r})})();{const c=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?ft:c.status==="dirty"?(a.dirty(),{status:"dirty",value:c.value}):this._def.out._parseSync({data:c.value,path:r.path,parent:r})}}static create(t,a){return new Gg({in:t,out:a,typeName:ut.ZodPipeline})}}class fg extends At{_parse(t){const a=this._def.innerType._parse(t),r=c=>(Ho(c)&&(c.value=Object.freeze(c.value)),c);return Bf(a)?a.then(c=>r(c)):r(a)}unwrap(){return this._def.innerType}}fg.create=(s,t)=>new fg({innerType:s,typeName:ut.ZodReadonly,...xt(t)});var ut;(function(s){s.ZodString="ZodString",s.ZodNumber="ZodNumber",s.ZodNaN="ZodNaN",s.ZodBigInt="ZodBigInt",s.ZodBoolean="ZodBoolean",s.ZodDate="ZodDate",s.ZodSymbol="ZodSymbol",s.ZodUndefined="ZodUndefined",s.ZodNull="ZodNull",s.ZodAny="ZodAny",s.ZodUnknown="ZodUnknown",s.ZodNever="ZodNever",s.ZodVoid="ZodVoid",s.ZodArray="ZodArray",s.ZodObject="ZodObject",s.ZodUnion="ZodUnion",s.ZodDiscriminatedUnion="ZodDiscriminatedUnion",s.ZodIntersection="ZodIntersection",s.ZodTuple="ZodTuple",s.ZodRecord="ZodRecord",s.ZodMap="ZodMap",s.ZodSet="ZodSet",s.ZodFunction="ZodFunction",s.ZodLazy="ZodLazy",s.ZodLiteral="ZodLiteral",s.ZodEnum="ZodEnum",s.ZodEffects="ZodEffects",s.ZodNativeEnum="ZodNativeEnum",s.ZodOptional="ZodOptional",s.ZodNullable="ZodNullable",s.ZodDefault="ZodDefault",s.ZodCatch="ZodCatch",s.ZodPromise="ZodPromise",s.ZodBranded="ZodBranded",s.ZodPipeline="ZodPipeline",s.ZodReadonly="ZodReadonly"})(ut||(ut={}));const M=ji.create,nt=Fo.create,Yt=rg.create,_2=lg.create;Tr.create;const vt=$a.create,Be=Dn.create;Uf.create;qf.create;Cl.create;const Ff=$f.create,Vg=cg.create,Dt=Qo.create;Hf.create;kr.create;Vo.create;const xS=Dt(["codex","claude"]),b2=Dt(["managed","attached-live","history-only"]),x2=Dt(["active","idle","attention","offline"]),S2=Dt(["idle","running","completed"]),SS=Dt(["image","file"]),j2=Dt(["user","repo","system","admin"]),w2=Be({can_stream_live:Yt(),can_send_input:Yt(),can_interrupt:Yt(),can_approve:Yt(),can_reject:Yt(),can_show_git:Yt(),can_show_terminal:Yt()}),k2=Be({used_tokens:nt(),total_tokens:nt(),remaining_tokens:nt(),percent_used:nt(),cached_input_tokens:nt(),output_tokens:nt(),reasoning_output_tokens:nt(),updated_at:M()}),N2=Dt(["pending","in_progress","completed"]),C2=Be({id:M(),step:M(),status:N2}),T2=Be({session_id:M(),turn_id:M().nullable(),source:Dt(["rollout","app-server"]),updated_at:M(),explanation:M().nullable().default(null),steps:vt(C2),completed_count:nt().int().nonnegative(),total_count:nt().int().nonnegative(),is_active:Yt()}),E2=Be({parent_session_id:M(),root_session_id:M().nullable().default(null),nickname:M().nullable().default(null),role:M().nullable().default(null),depth:nt().int().nonnegative()}),M2=Dt(["user_input","command_execution_approval","file_change_approval","permissions_approval","mcp_elicitation"]),R2=Dt(["pending","submitting","resolved"]),jS=Be({id:M(),label:M(),description:M().nullable().default(null),emphasis:Dt(["default","primary","danger"]).default("default")}),A2=Be({id:M(),header:M().nullable().default(null),question:M(),options:vt(jS).default([]),allow_other:Yt().default(!1),is_secret:Yt().default(!1)}),D2=Be({id:M(),session_id:M(),turn_id:M().nullable().default(null),item_id:M().nullable().default(null),kind:M2,status:R2,title:M(),description:M().nullable().default(null),created_at:M(),updated_at:M(),options:vt(jS).default([]),questions:vt(A2).default([]),allow_freeform:Yt().default(!1),freeform_placeholder:M().nullable().default(null),submit_label:M().nullable().default(null)}),O2=Be({id:M(),kind:SS,name:M().nullable().default(null),mime_type:M().nullable().default(null),size_bytes:nt().int().nonnegative().nullable().default(null),content_url:M().nullable().default(null)}),yx=Be({id:M(),kind:SS,name:M(),mime_type:M().nullable().default(null),size_bytes:nt().int().nonnegative().nullable().default(null),data_url:M()}),L2=Be({name:M(),description:M(),path:M(),scope:j2,enabled:Yt()}),I2=Dt(["supported","unsupported"]),z2=Be({name:M(),description:M(),availability:I2.default("supported")}),vx=Be({cli_version:M().nullable().default(null),loaded_at:M(),cache_ttl_ms:nt().int().nonnegative(),commands:vt(z2)});Be({id:M(),label:M(),description:M(),isDefault:Yt(),defaultReasoningEffort:M().nullable().default(null),supportedReasoningEfforts:vt(M()).default([])});const B2=Dt(["running","awaiting_input","completed","failed"]),P2=Dt(["none","choice","text"]),U2=Be({id:M(),label:M(),description:M().nullable().default(null)}),q2=Be({type:Vg("set_session_model"),model:M(),reasoning_effort:M().nullable().default(null)}).nullable().default(null),$2=Be({panel_id:M(),session_id:M(),command_name:M(),command_text:M(),title:M(),description:M().nullable().default(null),status:B2,body:M(),submitted_at:M(),updated_at:M(),input_type:P2,options:vt(U2).default([]),input_placeholder:M().nullable().default(null),submit_label:M().nullable().default(null),effect:q2}),_x=Be({panel:$2}),wS=Be({id:M(),name:M(),host:M(),tailscale_ip:M().nullable().default(null),tailscale_dns_name:M().nullable().default(null),direct_base_url:M(),ws_base_url:M(),status:Dt(["online","offline"]),provider_availability:vt(xS),project_count:nt(),session_count:nt(),transport:Dt(["direct-agent","hub-routed"]),version:M().nullable().default(null),registered_at:M().nullable().default(null),last_seen_at:M().nullable().default(null)}),kS=Be({id:M(),agent_id:M(),name:M(),display_name:M().nullable(),pinned:Yt(),path:M(),branch:M(),worktree:M(),runtime_profiles:vt(M()),preview_url:M().nullable()}),NS=Be({id:M(),agent_id:M(),project_id:M(),provider:xS,archived:Yt(),title:M(),mode:b2,health:x2,branch:M(),worktree:M(),summary:M(),last_event_at:M(),pinned:Yt(),run_state:S2,run_state_changed_at:M().nullable(),context_usage:k2.nullable().default(null),subagent:E2.nullable().default(null),capability:w2}),CS=Be({id:M(),kind:Dt(["user","assistant","thinking","tool","system"]),title:M(),body:M(),timestamp:M(),accent:Dt(["primary","secondary","muted"]),attachments:vt(O2).default([])}),H2=Dt(["app-server","rollout-fallback"]),F2=Dt(["running","completed"]),Q2=Dt(["add","delete","update"]),G2=Be({path:M(),kind:Q2,move_path:M().nullable(),additions:nt(),deletions:nt(),diff:M(),item_id:M().nullable()}),V2=Be({id:M(),session_id:M(),turn_id:M(),source:H2,status:F2,started_at:M(),completed_at:M().nullable(),updated_at:M(),aggregated_diff:M(),files:vt(G2)}),K2=Be({path:M(),status:Dt(["modified","added","deleted","renamed"]),additions:nt(),deletions:nt()}),TS=Dt(["modified","added","deleted","renamed","untracked"]),Y2=Be({path:M(),previous_path:M().nullable().default(null),status:TS,additions:nt().int().nonnegative(),deletions:nt().int().nonnegative()}),Z2=Be({session_id:M(),project_id:M(),path:M(),previous_path:M().nullable().default(null),additions:nt().int().nonnegative(),deletions:nt().int().nonnegative(),diff:M()}),ES=Be({session_id:M(),project_id:M(),branch:M(),branches:vt(M()),upstream_branch:M().nullable().default(null),ahead_count:nt().int().nonnegative(),behind_count:nt().int().nonnegative(),files:vt(Y2),updated_at:M()}),W2=Be({path:M(),previous_path:M().nullable().default(null),status:TS}),X2=Be({oid:M(),short_oid:M(),subject:M(),author_name:M(),authored_at:M(),committed_at:M(),parent_oids:vt(M()).default([]),refs:vt(M()).default([]),files:vt(W2)}),J2=Be({session_id:M(),project_id:M(),commit_oid:M(),path:M(),previous_path:M().nullable().default(null),additions:nt().int().nonnegative(),deletions:nt().int().nonnegative(),diff:M()}),eC=Be({session_id:M(),project_id:M(),branch:M(),upstream_branch:M().nullable().default(null),head_oid:M().nullable().default(null),upstream_head_oid:M().nullable().default(null),commits:vt(X2),updated_at:M()});Dt(["discard-file","discard-all","commit-all","switch-branch","push"]);const tC=Be({ok:Vg(!0),workspace:ES}),MS=Dt(["auto","powershell","cmd","bash"]),nC=Dt(["user","codex"]),sC=Be({id:M(),name:M(),description:M().nullable().default(null),command:M(),kill_command:M().nullable().default(null),cwd:M().nullable().default(null),shell:MS.default("auto"),node_version:M().nullable().default(null),port:nt().int().positive().nullable().default(null),source:nC.default("user"),created_at:M(),updated_at:M()}),aC=Be({name:M(),description:M().nullable().default(null),command:M(),kill_command:M().nullable().default(null),cwd:M().nullable().default(null),shell:MS.default("auto"),node_version:M().nullable().default(null),port:nt().int().positive().nullable().default(null)}),Kg=Be({session_id:M(),project_id:M(),config_path:M(),commands:vt(sC),updated_at:M()}),iC=Dt(["user","codex"]),rC=Be({id:M(),name:M(),description:M().nullable().default(null),url:M(),source:iC.default("user"),created_at:M(),updated_at:M()}),lC=Be({name:M(),description:M().nullable().default(null),url:M()}),Yg=Be({session_id:M(),project_id:M(),config_path:M(),websites:vt(rC),updated_at:M()}),oC=Dt(["queued","running","completed","failed","stopped"]),cC=Dt(["stdout","stderr","system"]),uC=Be({cursor:nt().int().nonnegative(),stream:cC,text:M(),timestamp:M()}),Zg=Be({id:M(),session_id:M(),project_id:M(),command_id:M().nullable().default(null),title:M(),command:M(),cwd:M(),status:oC,exit_code:nt().int().nullable().default(null),created_at:M(),started_at:M().nullable().default(null),completed_at:M().nullable().default(null),updated_at:M(),last_output_at:M().nullable().default(null),output_cursor:nt().int().nonnegative(),preview:M().nullable().default(null)}),RS=Be({session_id:M(),project_id:M(),active_terminal_id:M().nullable().default(null),terminals:vt(Zg),updated_at:M()}),dC=Be({session_id:M(),project_id:M(),terminal:Zg,chunks:vt(uC),next_cursor:nt().int().nonnegative(),truncated:Yt().default(!1)}),fC=Be({manager:Dt(["none","nvm-windows"]).default("none"),versions:vt(M()).default([]),error:M().nullable().default(null)}),hC=Be({command_catalog:Kg,website_catalog:Yg,node_runtime:fC,terminal_snapshot:RS}),mC=Be({catalog:Kg}),pC=Be({catalog:Yg}),gC=Be({commands:vt(aC),reason:M().nullable().default(null)}),yC=Be({generation:gC,catalog:Kg}),vC=Be({websites:vt(lC),reason:M().nullable().default(null)}),_C=Be({generation:vC,catalog:Yg}),bC=Be({snapshot:RS,terminal:Zg.nullable().default(null)}),xC=Be({id:M(),name:M(),command:M(),port:nt().nullable(),status:Dt(["running","stopped","degraded"]),log_excerpt:M()}),SC=Be({id:M(),label:M(),url:M(),status:Dt(["ready","starting","stopped"])}),jC=Be({path:M(),name:M(),has_children:Yt()}),wC=Be({id:M(),title:M(),description:M(),status:Dt(["pending","approved","rejected"])}),kC=Be({generated_at:M(),agents:vt(wS),projects:vt(kS),sessions:vt(NS),active_session_id:M(),timeline:vt(CS),changed_files:vt(K2),runtime_processes:vt(xC),previews:vt(SC),approvals:vt(wC)});Be({agent:wS,projects:vt(kS),sessions:vt(NS),active_session_id:M().default(""),generated_at:M()});const bx=Be({ok:Vg(!0),agent_id:M(),heartbeat_interval_ms:nt().int().positive(),heartbeat_timeout_ms:nt().int().positive(),registered_at:M(),received_at:M()}),NC=Be({type:Dt(["agent.online","snapshot.changed","session.updated","timeline.delta","timeline.reset","interaction.delta","interaction.reset","plan.delta","plan.reset","changeset.delta","changeset.reset","terminal.snapshot","terminal.delta","turn.delta","turn.completed","approval.requested"]),timestamp:M(),payload:Ff(_2())}),CC=Be({width:nt().nonnegative(),height:nt().nonnegative(),device_pixel_ratio:nt().nonnegative(),visual_width:nt().nonnegative().nullable().default(null),visual_height:nt().nonnegative().nullable().default(null),screen_width:nt().nonnegative().nullable().default(null),screen_height:nt().nonnegative().nullable().default(null)}),TC=Be({user_agent:M(),language:M().nullable().default(null),languages:vt(M()).default([]),platform:M().nullable().default(null),vendor:M().nullable().default(null),online:Yt().nullable().default(null),cookie_enabled:Yt().nullable().default(null),secure_context:Yt(),standalone_display_mode:Yt(),hardware_concurrency:nt().int().nonnegative().nullable().default(null),device_memory_gb:nt().nonnegative().nullable().default(null),max_touch_points:nt().int().nonnegative().nullable().default(null)}),EC=Be({href:M(),pathname:M(),referrer:M().nullable().default(null),visibility_state:M().nullable().default(null)}),MC=Be({scope:M(),active_script_url:M().nullable().default(null),waiting_script_url:M().nullable().default(null),installing_script_url:M().nullable().default(null)}),RC=Be({supported:Yt(),controller:Yt(),registrations:vt(MC).default([])}),AC=Be({supported:Yt(),keys:vt(M()).default([])}),DC=Be({href:M().nullable().default(null),rel:M().nullable().default(null)}),OC=Be({href:M().nullable().default(null),owner_node:M().nullable().default(null),media:M().nullable().default(null),disabled:Yt(),css_rule_count:nt().int().nonnegative().nullable().default(null)}),LC=Be({url:M(),kind:Dt(["stylesheet","script","manifest","icon","other"]),ok:Yt(),status:nt().int().nonnegative().nullable().default(null),content_type:M().nullable().default(null),cache_control:M().nullable().default(null),error:M().nullable().default(null)}),IC=Be({name:M(),initiator_type:M().nullable().default(null),duration_ms:nt().nonnegative().nullable().default(null),transfer_size:nt().nonnegative().nullable().default(null),decoded_body_size:nt().nonnegative().nullable().default(null)}),zC=Be({x:nt(),y:nt(),width:nt().nonnegative(),height:nt().nonnegative()}),BC=Be({selector:M(),found:Yt(),text_preview:M().nullable().default(null),rect:zC.nullable().default(null),computed:Ff(M()).default({})});Be({captured_at:M(),page:EC,environment:TC,viewport:CC,feature_support:Ff(Yt()).default({}),service_worker:RC,cache:AC,manifest:DC,stylesheets:vt(OC).default([]),resource_probes:vt(LC).default([]),performance_entries:vt(IC).default([]),theme_variables:Ff(M()).default({}),element_snapshots:vt(BC).default([]),notes:vt(M()).default([])});const PC=/^(?:image|img|photo|picture|screenshot|图片|照片|截图)(?:[-_ ]?\d+)?\.(?:avif|bmp|gif|heic|heif|jpe?g|png|svg|webp)$/i,Wn=s=>(s==null?void 0:s.trim())??"",xx="\0",Sx=s=>{const t=Wn(s);return t?PC.test(t)?1:2+Math.min(t.length,64)/100:0},UC=(s,t)=>{const a=Sx(s),r=Sx(t);if(r>a)return Wn(t)||null;if(a>r)return Wn(s)||null;const c=Wn(s),u=Wn(t);return u.length>c.length?u||null:c||null},qC=s=>{const t=Wn(s.content_url);return t?[s.kind,"content",t].join(xx):[s.kind,"meta",Wn(s.mime_type).toLowerCase(),typeof s.size_bytes=="number"&&Number.isFinite(s.size_bytes)?String(Math.max(0,Math.round(s.size_bytes))):"",Wn(s.name).toLowerCase()].join(xx)},$C=(s,t)=>{const a=Wn(s.name),r=Wn(t.name),c=Wn(s.mime_type),u=Wn(t.mime_type);return{id:s.id||t.id,kind:s.kind==="image"||t.kind==="image"?"image":s.kind,name:UC(a,r),mime_type:c||u||null,size_bytes:s.size_bytes??t.size_bytes??null,content_url:Wn(s.content_url)||Wn(t.content_url)||null}},AS=s=>{if(!s||s.length===0)return[];const t=[],a=new Map;for(const r of s){const c=qC(r),u=a.get(c);if(u===void 0){a.set(c,t.length),t.push({...r,name:Wn(r.name)||null,mime_type:Wn(r.mime_type)||null,size_bytes:typeof r.size_bytes=="number"&&Number.isFinite(r.size_bytes)?Math.max(0,Math.round(r.size_bytes)):null,content_url:Wn(r.content_url)||null});continue}t[u]=$C(t[u],r)}return t},DS=(s,t)=>AS([...s??[],...t??[]]),Ns=s=>new Date(s).toISOString(),HC=()=>({generated_at:new Date().toISOString(),active_session_id:"session-managed-1",agents:[{id:"agent-shanghai-main",name:"studio-main",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:Ns("2026-03-18T10:30:00+08:00"),last_seen_at:Ns("2026-03-18T10:58:00+08:00")},{id:"agent-macbook",name:"macbook-air",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:Ns("2026-03-18T10:20:00+08:00"),last_seen_at:Ns("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",last_event_at:Ns("2026-03-18T10:58:00+08:00"),pinned:!1,run_state:"running",run_state_changed_at:Ns("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:"",last_event_at:Ns("2026-03-18T10:48:00+08:00"),pinned:!1,run_state:"completed",run_state_changed_at:Ns("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:"",last_event_at:Ns("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.",timestamp:Ns("2026-03-18T10:40:00+08:00"),accent:"muted",attachments:[]},{id:"entry-2",kind:"user",title:"Prompt",body:"Start stage one.",timestamp:Ns("2026-03-18T10:44:00+08:00"),accent:"primary",attachments:[]},{id:"entry-3",kind:"thinking",title:"Plan",body:"Aligning routes and session state.",timestamp:Ns("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.",timestamp:Ns("2026-03-18T10:48:00+08:00"),accent:"secondary",attachments:[]},{id:"entry-5",kind:"assistant",title:"Focus",body:"Wiring the shell.",timestamp:Ns("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"}]}),FC=()=>HC(),QC=()=>FC(),OS=s=>{const t=new URL(s);return t.protocol=t.protocol==="https:"?"wss:":"ws:",t.pathname="/ws",t.toString()};class GC{constructor(t,a=OS(t)){this.baseUrl=t,this.wsBaseUrl=a}async readJson(t,a){const r=await fetch(t);if(!r.ok)throw new Error(`Request failed with ${r.status}`);return a.parse(await r.json())}async postJson(t,a,r){const c=await fetch(new URL(t,this.baseUrl),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(a)}),u=await c.json().catch(()=>null);if(!c.ok)throw new Error((u==null?void 0:u.error)??`Request failed with ${c.status}`);return r?r.parse(u):u}async getPhaseOneSnapshot(t){const{fallbackToMock:a=!0,fallbackSnapshot:r=QC}=t??{};try{const c=await fetch(new URL("/api/bootstrap",this.baseUrl));if(!c.ok)throw new Error(`Bootstrap request failed with ${c.status}`);const u=await c.json();return kC.parse(u)}catch(c){if(!a)throw c;return r()}}async getSessionTimeline(t){return await this.readJson(new URL(`/api/sessions/${t}/timeline`,this.baseUrl),{parse:r=>Array.isArray(r)?r.map(c=>CS.parse(c)):[]})}async getSessionChangeSets(t){return this.readJson(new URL(`/api/sessions/${t}/change-sets`,this.baseUrl),{parse:a=>Array.isArray(a)?a.map(r=>V2.parse(r)):[]})}async getSessionGitWorkspace(t){return this.readJson(new URL(`/api/sessions/${t}/git-workspace`,this.baseUrl),ES)}async getSessionGitWorkspaceFileDiff(t,a){const r=new URL(`/api/sessions/${t}/git-workspace/file-diff`,this.baseUrl);return r.searchParams.set("path",a.path),a.previousPath&&r.searchParams.set("previousPath",a.previousPath),this.readJson(r,Z2)}async getSessionGitHistory(t){return this.readJson(new URL(`/api/sessions/${t}/git/history`,this.baseUrl),eC)}async getSessionGitHistoryFileDiff(t,a){const r=new URL(`/api/sessions/${t}/git/history/file-diff`,this.baseUrl);return r.searchParams.set("commitOid",a.commitOid),r.searchParams.set("path",a.path),a.previousPath&&r.searchParams.set("previousPath",a.previousPath),this.readJson(r,J2)}async getSessionRunWorkbench(t){return this.readJson(new URL(`/api/sessions/${t}/run-workbench`,this.baseUrl),hC)}async saveSessionRunCommand(t){return this.postJson(`/api/sessions/${t.sessionId}/run-commands`,{action:t.action,commandId:t.commandId??null,command:t.command??null},mC)}async generateSessionRunCommand(t){return this.postJson(`/api/sessions/${t.sessionId}/run-commands/generate`,{prompt:t.prompt,model:t.model},yC)}async saveSessionRunWebsite(t){return this.postJson(`/api/sessions/${t.sessionId}/run-websites`,{action:t.action,websiteId:t.websiteId??null,website:t.website??null},pC)}async generateSessionRunWebsite(t){return this.postJson(`/api/sessions/${t.sessionId}/run-websites/generate`,{prompt:t.prompt,model:t.model},_C)}async executeSessionTerminalAction(t){return this.postJson(`/api/sessions/${t.sessionId}/terminals`,{action:t.action,commandId:t.commandId??null,terminalId:t.terminalId??null},bC)}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,dC)}async getSessionPlan(t){return this.readJson(new URL(`/api/sessions/${t}/plan`,this.baseUrl),{parse:a=>a==null?null:T2.parse(a)})}async getSessionInteractions(t){return this.readJson(new URL(`/api/sessions/${t}/interactions`,this.baseUrl),{parse:a=>Array.isArray(a)?a.map(r=>D2.parse(r)):[]})}async getProjectSkills(t){return this.readJson(new URL(`/api/projects/${t}/skills`,this.baseUrl),{parse:a=>Array.isArray(a)?a.map(r=>L2.parse(r)):[]})}async getCodexCommands(){return this.readJson(new URL("/api/codex/commands",this.baseUrl),vx)}async refreshCodexCommands(){return this.postJson("/api/codex/commands/refresh",{},vx)}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:r=>Array.isArray(r)?r.map(c=>jC.parse(c)):[]})}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(r=>yx.parse(r)),serviceTier:t.serviceTier,planMode:t.planMode})}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(r=>yx.parse(r)),model:t.model,reasoningEffort:t.reasoningEffort,serviceTier:t.serviceTier,planMode:t.planMode})}async executeSessionCommand(t){return this.postJson(`/api/sessions/${t.sessionId}/commands/execute`,{input:t.input},_x)}async respondToSessionCommand(t){return this.postJson(`/api/sessions/${t.sessionId}/commands/respond`,{panelId:t.panelId,optionId:t.optionId??null,text:t.text??null},_x)}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,bx)}async heartbeatAgent(t){return this.postJson("/api/agents/heartbeat",t,bx)}async executeSessionGitAction(t){return this.postJson(`/api/sessions/${t.sessionId}/git/actions`,{action:t.action,path:t.path,branch:t.branch,message:t.message},tC)}connectEvents(t,a){let u=null,h="",p=!1,y=0,m=null,x=!1;const g=()=>{m!==null&&(globalThis.clearTimeout(m),m=null)},S=(T,C)=>{var I;(I=a==null?void 0:a.onStatus)==null||I.call(a,{state:T,attempt:y,maxAttempts:5,error:C})},k=T=>{if(!p&&!x){if(y+=1,y>5){y=5,S("failed",T);return}x=!0,S("reconnecting",T),g(),m=globalThis.setTimeout(()=>{x=!1,N()},1200)}},N=()=>{g(),x=!1,u=new WebSocket(this.wsBaseUrl),u.addEventListener("open",()=>{var C;x=!1,y=0,S("connected");const T=(C=a==null?void 0:a.sessionId)==null?void 0:C.trim();T&&(h=T,u==null||u.send(JSON.stringify({type:"session.subscribe",sessionId:T})))}),u.addEventListener("message",T=>{const C=NC.safeParse(JSON.parse(T.data));C.success&&t(C.data)}),u.addEventListener("error",()=>{if(p)return;const T=`无法连接到 ${this.wsBaseUrl}`;(u==null?void 0:u.readyState)!==WebSocket.OPEN&&k(T)}),u.addEventListener("close",T=>{var I;if(p)return;const C=((I=T.reason)==null?void 0:I.trim())||`WebSocket 已断开(code ${T.code||"unknown"})`;k(C)})};return N(),()=>{p=!0,x=!1,g(),h&&(u==null?void 0:u.readyState)===WebSocket.OPEN&&u.send(JSON.stringify({type:"session.unsubscribe",sessionId:h})),u==null||u.close()}}}const hg=(s,t)=>new GC(s,(t==null?void 0:t.wsBaseUrl)??OS(s)),LS=s=>{if(typeof window>"u")return`http://localhost:${s}`;const t=window.location.protocol==="https:"?"https:":"http:",a=window.location.hostname||"localhost";return`${t}//${a}:${s}`},IS=LS(4242),th=LS(4343),zS={direct:hg(IS),hub:hg(th)},VC={direct:"Agent 直连",hub:"Hub 聚合"},KC=1e4,YC=1e4,ZC=1e4,WC=1e4;let wp=null,jx=0,au=null,kp=null,wx=0,iu=null;const kx=new Map,Np=new Map,Cp=new Map,wi=s=>(s==null?void 0:s.trim())??"",Wg=async s=>{const t=s.trim();if(!t)return!1;const a=Cp.get(t),r=Date.now();if(a&&r-a.checkedAt<WC)return a.reachable;const c=new AbortController,u=globalThis.setTimeout(()=>c.abort(),1200);try{const p=(await fetch(`${t}/health`,{signal:c.signal})).ok;return Cp.set(t,{reachable:p,checkedAt:Date.now()}),p}catch{return Cp.set(t,{reachable:!1,checkedAt:Date.now()}),!1}finally{clearTimeout(u)}},Nx=s=>({mode:s,label:VC[s],baseUrl:s==="hub"?th:IS,client:zS[s]}),BS=s=>s.direct_base_url.trim(),XC=s=>s.ws_base_url.trim(),Cx=s=>{const t=BS(s)||s.tailscale_dns_name||s.tailscale_ip||s.host;return`无法直连节点 ${s.name}(${t})。请确认当前浏览器已加入 Tailscale 网络,且目标 agent 在线。`},JC=s=>{const t=BS(s),a=XC(s);return{mode:"direct",label:`Agent 直连 · ${s.name}`,baseUrl:t,client:hg(t,{wsBaseUrl:a||void 0})}},eT=(s,t)=>{const a=wi(t.agentId);if(a)return s.agents.find(u=>u.id===a)??null;const r=wi(t.sessionId);if(r){const u=s.sessions.find(h=>h.id===r);return u?s.agents.find(h=>h.id===u.agent_id)??null:null}const c=wi(t.projectId);if(c){const u=s.projects.find(h=>h.id===c);return u?s.agents.find(h=>h.id===u.agent_id)??null:null}return null},tT=s=>{const t=wi(s.sessionId),a=wi(s.projectId),r=wi(s.agentId);return t?`session:${t}`:a?`project:${a}`:r?`agent:${r}`:""},nT=async()=>{const s=Date.now();if(kp&&s-wx<ZC)return kp;if(iu)return iu;iu=(async()=>{if(!await Wg(th))return null;const t=await zS.hub.getPhaseOneSnapshot({fallbackToMock:!1});return kp=t,wx=Date.now(),t})().catch(()=>null);try{return await iu}finally{iu=null}},sT=async()=>{const s=Date.now();if(wp&&s-jx<KC)return wp;if(au)return au;au=(async()=>{const t=await Wg(th)?Nx("hub"):Nx("direct");return wp=t,jx=Date.now(),t})();try{return await au}finally{au=null}},aT=async s=>{const t=tT(s),a=Date.now(),r=t?kx.get(t):null;if(r&&a-r.cachedAt<YC)return r.target;const c=t?Np.get(t):null;if(c)return c;const u=(async()=>{const h=await nT(),p=h?eT(h,s):null;if(!h||!p)throw new Error("Hub 未返回目标节点信息,无法建立直连。");const y=JC(p);if(!y.baseUrl)throw new Error(Cx(p));if(await Wg(y.baseUrl))return y;throw new Error(Cx(p))})();t&&Np.set(t,u);try{const h=await u;return t&&kx.set(t,{target:h,cachedAt:Date.now()}),h}finally{t&&Np.delete(t)}},Xn=async s=>!(wi(s==null?void 0:s.sessionId)||wi(s==null?void 0:s.projectId)||wi(s==null?void 0:s.agentId))?sT():aT(s??{}),PS="panda:notification-settings",US="panda:notified-completions",Tp={completionNotificationsEnabled:!1},qS=s=>({completionNotificationsEnabled:(s==null?void 0:s.completionNotificationsEnabled)===!0}),$S=()=>{if(typeof window>"u")return{};try{const s=window.localStorage.getItem(US);if(!s)return{};const t=JSON.parse(s);return!t||typeof t!="object"?{}:Object.fromEntries(Object.entries(t).filter(a=>typeof a[0]=="string"&&typeof a[1]=="string"))}catch{return{}}},iT=s=>{if(!(typeof window>"u"))try{window.localStorage.setItem(US,JSON.stringify(s))}catch{}},mg=()=>{if(typeof window>"u")return Tp;try{const s=window.localStorage.getItem(PS);return s?qS(JSON.parse(s)):Tp}catch{return Tp}},Tx=s=>{if(!(typeof window>"u"))try{window.localStorage.setItem(PS,JSON.stringify(qS(s)))}catch{}},Xg=()=>typeof window>"u"?!1:window.isSecureContext&&"Notification"in window&&"serviceWorker"in navigator,pg=()=>Xg()?Notification.permission:"unsupported",rT=async()=>Xg()?Notification.requestPermission():"unsupported",Ep=()=>{if(typeof window>"u")return!1;const s=navigator;return window.matchMedia("(display-mode: standalone)").matches||s.standalone===!0},Ex=()=>typeof navigator>"u"?!1:/Android/i.test(navigator.userAgent),lT=(s,t)=>$S()[s]===t,Mx=(s,t)=>{const a=$S();a[s]!==t&&iT({...a,[s]:t})},oT=async s=>{if(typeof window>"u"||!Xg())return!1;const t={body:s.body,tag:`session-completed:${s.sessionId}:${s.completedAt}`,icon:"/pwa-512.png",badge:"/pwa-192.png",data:{sessionId:s.sessionId,url:s.url,completedAt:s.completedAt}};try{return await(await navigator.serviceWorker.ready).showNotification(s.title,t),!0}catch{try{const a=new Notification(s.title,t);return a.onclick=()=>{window.focus(),window.location.assign(s.url)},!0}catch{return!1}}},Qf="panda:last-agent-id",Gf="panda:last-session-id",Nu="panda:pending-session-id",Cu="panda:pending-project-id",Tu="panda:pending-directory-picker",cT=()=>{if(typeof window>"u")return null;try{return window.localStorage.getItem(Qf)}catch{return null}},xr=s=>{if(!(typeof window>"u"))try{if(s){window.localStorage.setItem(Qf,s);return}window.localStorage.removeItem(Qf)}catch{}},Eu=()=>{if(typeof window>"u")return null;try{return window.localStorage.getItem(Gf)}catch{return null}},ds=s=>{if(!(typeof window>"u"))try{if(s){window.localStorage.setItem(Gf,s);return}window.localStorage.removeItem(Gf)}catch{}},Mu=s=>{if(!(typeof window>"u"))try{if(s){window.sessionStorage.setItem(Nu,s);return}window.sessionStorage.removeItem(Nu)}catch{}},uT=()=>{if(typeof window>"u")return null;try{const s=window.sessionStorage.getItem(Nu);return s&&window.sessionStorage.removeItem(Nu),s}catch{return null}},Eo=s=>{if(!(typeof window>"u"))try{if(s){window.sessionStorage.setItem(Cu,s);return}window.sessionStorage.removeItem(Cu)}catch{}},dT=()=>{if(typeof window>"u")return null;try{const s=window.sessionStorage.getItem(Cu);return s&&window.sessionStorage.removeItem(Cu),s}catch{return null}},ru=s=>{if(!(typeof window>"u"))try{if(s){window.sessionStorage.setItem(Tu,"1");return}window.sessionStorage.removeItem(Tu)}catch{}},fT=()=>{if(typeof window>"u")return!1;try{const s=window.sessionStorage.getItem(Tu);return s&&window.sessionStorage.removeItem(Tu),s==="1"}catch{return!1}},hT=()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem(Qf),window.localStorage.removeItem(Gf),window.sessionStorage.removeItem(Nu),window.sessionStorage.removeItem(Cu),window.sessionStorage.removeItem(Tu)}catch{}},mT=s=>typeof document>"u"?!1:document.visibilityState==="visible"&&Eu()===s,pT=s=>{if(!s)return null;const t=typeof s.sessionId=="string"?s.sessionId:null,a=s.sessionPatch&&typeof s.sessionPatch=="object"?s.sessionPatch:null;if(!t||!a)return null;const r=typeof a.run_state=="string"?a.run_state:null,c=typeof a.run_state_changed_at=="string"?a.run_state_changed_at:null;return r!=="completed"||!c?null:{sessionId:t,completedAt:c}},gT=({snapshot:s})=>{const t=_.useRef(s);return _.useEffect(()=>{t.current=s},[s]),_.useEffect(()=>{let a=!1,r;return Xn().then(c=>{a||(r=c.client.connectEvents(u=>{var k,N;if(u.type!=="session.updated")return;const h=pT(u.payload);if(!h||!mg().completionNotificationsEnabled||pg()!=="granted"||lT(h.sessionId,h.completedAt))return;if(mT(h.sessionId)){Mx(h.sessionId,h.completedAt);return}const y=((k=t.current)==null?void 0:k.sessions.find(T=>T.id===h.sessionId))??null,x=`${((N=y==null?void 0:y.title)==null?void 0:N.trim())||"当前会话"} 已完成`,g="最终回复已经生成,点开即可继续查看。",S=`/session/${h.sessionId}`;oT({sessionId:h.sessionId,completedAt:h.completedAt,title:x,body:g,url:S}).then(T=>{T&&Mx(h.sessionId,h.completedAt)})}))}),()=>{a=!0,r==null||r()}},[]),null},yT=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"}}]'),vT={themes:yT},HS="panda:theme-settings",_T=13,bT=12,FS="codex",Jg="codex",xT='-apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", sans-serif',ST='ui-monospace, "SFMono-Regular", "SF Mono", "Cascadia Mono", "Cascadia Code", Consolas, monospace',jT=/\b(?:serif|sans-serif|monospace|cursive|fantasy|system-ui|emoji|math|fangsong|ui-serif|ui-sans-serif|ui-monospace|ui-rounded)\b/i,Rx=(s,t)=>{const a=s==null?void 0:s.trim();return a?jT.test(a)?a:`${a}, ${t}`:t},wT={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"},Zo=(s,t,a)=>Math.min(a,Math.max(t,s)),rl=(s,t)=>{const r=s.trim().match(/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i);if(!r)return t;const[,c]=r;return`#${(c.length===3?c.split("").map(h=>`${h}${h}`).join(""):c).toUpperCase()}`},pi=s=>{const t=rl(s,"#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)}},kT=(s,t,a)=>`#${[s,t,a].map(r=>Zo(Math.round(r),0,255).toString(16).padStart(2,"0")).join("").toUpperCase()}`,rt=(s,t,a)=>{const r=pi(s),c=pi(t),u=Zo(a,0,1);return kT(r.r+(c.r-r.r)*u,r.g+(c.g-r.g)*u,r.b+(c.b-r.b)*u)},NT=s=>{const{r:t,g:a,b:r}=pi(s),c=u=>{const h=u/255;return h<=.03928?h/12.92:((h+.055)/1.055)**2.4};return c(t)*.2126+c(a)*.7152+c(r)*.0722},CT=s=>NT(s)>.5?"#0D1117":"#FFFFFF",fi=(s,t)=>{const a=Math.round(Zo(t,0,1)*100);return a>=100?s:`color-mix(in srgb, ${s} ${a}%, transparent)`},QS=vT.themes,GS=(s,t)=>{var r,c;const a=t==="light"?s.light:s.dark;return a?{id:s.id,label:wT[s.id]??s.id,codeThemeId:a.codeThemeId,variant:t,accent:rl(a.theme.accent,"#0169CC"),background:rl(a.theme.surface,"#FFFFFF"),foreground:rl(a.theme.ink,"#0D0D0D"),contrast:Zo(Number(a.theme.contrast),0,100),opaqueWindows:!!a.theme.opaqueWindows,semanticColors:{diffAdded:rl(a.theme.semanticColors.diffAdded,"#00A240"),diffRemoved:rl(a.theme.semanticColors.diffRemoved,"#E02E2A"),skill:rl(a.theme.semanticColors.skill,"#751ED9")},fonts:{ui:((r=a.theme.fonts.ui)==null?void 0:r.trim())||null,code:((c=a.theme.fonts.code)==null?void 0:c.trim())||null}}:null},gg=QS.map(s=>GS(s,"light")).filter(s=>!!s),Ru=QS.map(s=>GS(s,"dark")).filter(s=>!!s);Ru.find(s=>s.id===Jg)??Ru[0];const wl={mode:"system",lightThemeId:FS,darkThemeId:Jg,uiFontSize:_T,codeFontSize:bT},VS=s=>Zo(Number(s),11,18),KS=s=>Zo(Number(s),10,18),ey=()=>typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",nh=s=>gg.find(t=>t.id===s)??gg[0],sh=s=>Ru.find(t=>t.id===s)??Ru[0],Ax=(s,t=wl,a="light")=>a==="dark"?{...t,darkThemeId:sh(s).id}:{...t,lightThemeId:nh(s).id},cr=s=>({mode:(s==null?void 0:s.mode)==="light"||(s==null?void 0:s.mode)==="dark"||(s==null?void 0:s.mode)==="system"?s.mode:wl.mode,lightThemeId:nh((s==null?void 0:s.lightThemeId)??FS).id,darkThemeId:sh((s==null?void 0:s.darkThemeId)??Jg).id,uiFontSize:VS((s==null?void 0:s.uiFontSize)??wl.uiFontSize),codeFontSize:KS((s==null?void 0:s.codeFontSize)??wl.codeFontSize)}),YS=()=>{if(typeof window>"u")return wl;try{const s=window.localStorage.getItem(HS);return s?cr(JSON.parse(s)):wl}catch{return wl}},lu=s=>{if(!(typeof window>"u"))try{window.localStorage.setItem(HS,JSON.stringify(cr(s)))}catch{}},TT=(s,t)=>s==="system"?t:s,mi=(s,t=ey())=>{const a=cr(s),r=TT(a.mode,t),c=nh(a.lightThemeId),u=sh(a.darkThemeId),h=r==="dark"?u:c;return{...a,appearance:r,lightTheme:c,darkTheme:u,activeTheme:h,uiFontFamily:Rx(h.fonts.ui,xT),codeFontFamily:Rx(h.fonts.code,ST)}},ET=s=>{if(typeof window>"u")return()=>{};const t=window.matchMedia("(prefers-color-scheme: dark)"),a=()=>{s(t.matches?"dark":"light")};return a(),t.addEventListener("change",a),()=>{t.removeEventListener("change",a)}},MT=(s,t)=>{const a=mi(s,t),r=a.activeTheme,c=t==="dark",u=(r.contrast-(c?60:45))/100,h=r.semanticColors.diffAdded,p=r.semanticColors.diffRemoved,y=r.semanticColors.skill,m=pi(h),x=pi(p),g=pi(y),S=pi(r.accent),k=pi(r.background),N=pi(r.foreground),T=r.background,C=c?rt(r.background,"#FFFFFF",.05+u*.08):rt(r.background,"#FFFFFF",.42+u*.16),I=c?rt(r.background,"#FFFFFF",.07+u*.08):rt(r.background,"#FFFFFF",.78+u*.1),V=c?rt(r.background,"#FFFFFF",.1+u*.08):rt(r.background,"#FFFFFF",.56+u*.14),$=c?rt(r.background,"#FFFFFF",.14+u*.08):rt(r.background,r.foreground,.1+u*.12),R=c?rt(r.background,"#000000",.08-u*.06):rt(r.background,r.foreground,.03+u*.08),G=c?rt(r.background,"#FFFFFF",.08+u*.06):rt(r.background,r.foreground,.06+u*.08),ue=c?rt(r.background,"#FFFFFF",.14+u*.08):rt(r.background,r.foreground,.14+u*.1),Z=c?rt(r.background,"#FFFFFF",.22+u*.08):rt(r.background,r.foreground,.22+u*.1),ie=c?rt(r.background,"#FFFFFF",.08+u*.04):rt(r.background,r.foreground,.1+u*.08),te=r.foreground,Y=c?rt(r.foreground,r.background,.28-u*.1):rt(r.foreground,r.background,.5-u*.14),H=c?rt(r.foreground,r.background,.46-u*.1):rt(r.foreground,r.background,.64-u*.14),_e=rt(r.foreground,r.background,c?.58:.74),je=r.accent,ae=c?rt(r.accent,"#FFFFFF",.18):rt(r.accent,"#FFFFFF",.24),ce=c?rt(r.accent,r.background,.78):rt(r.accent,r.background,.88),E=c?rt(r.accent,r.background,.84):rt(r.accent,r.background,.92),U=CT(je),ee=c?rt(r.background,"#FFFFFF",.1):rt(r.background,r.foreground,.08),W=c?rt(r.background,"#000000",.06):rt(r.background,r.foreground,.035),xe=c?rt(r.background,"#FFFFFF",.05):rt(r.background,r.foreground,.06),A=c?rt(r.background,"#FFFFFF",.03):rt(r.background,r.foreground,.085),ne=c?rt(r.background,"#FFFFFF",.065):rt(r.background,r.foreground,.05),be=rt(r.foreground,r.background,c?.42:.68),Q=c?rt(r.background,"#FFFFFF",.08):rt(r.foreground,r.background,.18),pe=c?rt(r.background,"#FFFFFF",.08):rt(r.background,r.foreground,.06),Ce=c?rt(r.background,"#FFFFFF",.12):rt(r.background,r.foreground,.1),Le=c?rt(r.background,"#FFFFFF",.14+u*.05):rt(r.background,r.foreground,.12+u*.08),he=r.opaqueWindows?1:c?.92:.95,q=r.opaqueWindows?1:c?.94:.965,Se=r.opaqueWindows?1:.94;return{"--theme-id":r.id,"--theme-code-theme-id":r.codeThemeId,"--theme-window-opaque":r.opaqueWindows?"1":"0","--theme-accent":je,"--theme-accent-rgb":`${S.r} ${S.g} ${S.b}`,"--theme-background":r.background,"--theme-background-rgb":`${k.r} ${k.g} ${k.b}`,"--theme-foreground":r.foreground,"--theme-foreground-rgb":`${N.r} ${N.g} ${N.b}`,"--theme-shadow-rgb":c?"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":T,"--color-surface-elevated":C,"--color-surface-panel":I,"--color-surface-raised":V,"--color-surface-panel-strong":$,"--color-surface-sidebar":fi(R,q),"--color-surface-sidebar-elevated":fi(G,q),"--color-surface-border":ue,"--color-surface-border-strong":Z,"--color-surface-border-soft":ie,"--color-surface-overlay":fi($,he),"--color-surface-floating":fi(I,he),"--color-surface-tooltip":fi(Q,Se),"--color-surface-code":W,"--color-surface-code-muted":xe,"--color-surface-code-gutter":A,"--color-surface-code-meta":ne,"--color-surface-inline-code":ee,"--color-surface-hover":pe,"--color-surface-pressed":Ce,"--color-surface-danger-soft":fi(p,c?.14:.08),"--color-surface-success-soft":fi(h,c?.14:.08),"--color-text-primary":te,"--color-text-secondary":Y,"--color-text-muted":H,"--color-text-tertiary":_e,"--color-text-on-accent":U,"--color-text-link":je,"--color-text-link-hover":ae,"--color-text-danger":p,"--color-text-success":h,"--color-accent-primary":je,"--color-accent-primary-soft":ce,"--color-accent-secondary":ae,"--color-accent-secondary-soft":E,"--color-accent-contrast":U,"--color-accent-primary-rgb":`${S.r} ${S.g} ${S.b}`,"--color-success":h,"--color-warning":rt(r.accent,h,.35),"--color-danger":p,"--color-status-online":je,"--color-status-offline":c?"#76808A":"#A5ACA4","--color-skill":y,"--color-skill-rgb":`${g.r} ${g.g} ${g.b}`,"--color-code-keyword":y,"--color-code-title":je,"--color-code-string":rt(h,r.foreground,c?.26:.18),"--color-code-number":rt(y,je,.36),"--color-code-comment":rt(r.foreground,r.background,c?.52:.72),"--color-code-meta-text":be,"--color-code-add":h,"--color-code-add-rgb":`${m.r} ${m.g} ${m.b}`,"--color-code-add-bg":fi(h,c?.16:.11),"--color-code-remove":p,"--color-code-remove-rgb":`${x.r} ${x.g} ${x.b}`,"--color-code-remove-bg":fi(p,c?.18:.11),"--color-divider":Le,"--color-overlay-scrim":r.opaqueWindows?c?"rgba(8, 10, 12, 0.66)":"rgba(23, 20, 17, 0.14)":c?"rgba(8, 10, 12, 0.54)":"rgba(23, 20, 17, 0.09)","--shadow-soft":c?"0 24px 54px rgba(0, 0, 0, 0.34)":"0 24px 54px rgba(24, 18, 12, 0.08)","--shadow-panel":c?"0 10px 26px rgba(0, 0, 0, 0.24)":"0 10px 26px rgba(37, 23, 10, 0.06)","--shadow-sm":c?"0 2px 12px rgba(0, 0, 0, 0.18)":"0 2px 12px rgba(37, 23, 10, 0.05)","--shadow-overlay":c?"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`}},ZS=(s,t=ey())=>{if(typeof document>"u")return;const a=mi(s,t),r=MT(a,a.appearance),c=document.documentElement;c.dataset.theme=a.appearance,c.dataset.uiTheme=a.appearance,c.dataset.themeId=a.activeTheme.id,c.dataset.codeThemeId=a.activeTheme.codeThemeId,c.dataset.windowStyle=a.activeTheme.opaqueWindows?"opaque":"soft",c.style.colorScheme=a.appearance;for(const[u,h]of Object.entries(r))c.style.setProperty(u,h)},RT=["bootstrap","hub"],dt=["bootstrap","workspace"];function Uu(s){return Es({queryKey:(s==null?void 0:s.queryKey)??RT,queryFn:async()=>(await Xn(s==null?void 0:s.scope)).client.getPhaseOneSnapshot({fallbackToMock:!1}),refetchInterval:3e5,refetchOnWindowFocus:!1,retry:1})}const Dx=s=>{let t;const a=new Set,r=(m,x)=>{const g=typeof m=="function"?m(t):m;if(!Object.is(g,t)){const S=t;t=x??(typeof g!="object"||g===null)?g:Object.assign({},t,g),a.forEach(k=>k(t,S))}},c=()=>t,p={setState:r,getState:c,getInitialState:()=>y,subscribe:m=>(a.add(m),()=>a.delete(m))},y=t=s(r,c,p);return p},AT=(s=>s?Dx(s):Dx),DT=s=>s;function OT(s,t=DT){const a=Si.useSyncExternalStore(s.subscribe,Si.useCallback(()=>t(s.getState()),[s,t]),Si.useCallback(()=>t(s.getInitialState()),[s,t]));return Si.useDebugValue(a),a}const Ox=s=>{const t=AT(s),a=r=>OT(t,r);return Object.assign(a,t),a},LT=(s=>s?Ox(s):Ox),Lx=YS(),Ix=ey(),va=LT(s=>({panelTab:"git",composerText:"",activeSessionId:null,bottomNavVisible:!0,themeSettings:Lx,systemAppearance:Ix,resolvedTheme:mi(Lx,Ix),setPanelTab:t=>s({panelTab:t}),setComposerText:t=>s({composerText:t}),setActiveSessionId:t=>s({activeSessionId:t}),setBottomNavVisible:t=>s({bottomNavVisible:t}),setThemeMode:t=>s(a=>{const r=cr({...a.themeSettings,mode:t});return lu(r),{themeSettings:r,resolvedTheme:mi(r,a.systemAppearance)}}),setLightThemeId:t=>s(a=>{const r=cr(Ax(nh(t).id,a.themeSettings,"light"));return lu(r),{themeSettings:r,resolvedTheme:mi(r,a.systemAppearance)}}),setDarkThemeId:t=>s(a=>{const r=cr({...Ax(sh(t).id,a.themeSettings,"dark")});return lu(r),{themeSettings:r,resolvedTheme:mi(r,a.systemAppearance)}}),setUiFontSize:t=>s(a=>{const r=cr({...a.themeSettings,uiFontSize:t});return lu(r),{themeSettings:r,resolvedTheme:mi(r,a.systemAppearance)}}),setCodeFontSize:t=>s(a=>{const r=cr({...a.themeSettings,codeFontSize:t});return lu(r),{themeSettings:r,resolvedTheme:mi(r,a.systemAppearance)}}),setSystemAppearance:t=>s(a=>({systemAppearance:t,resolvedTheme:mi(a.themeSettings,t)}))})),IT=()=>{const{data:s}=Uu(),t=va(c=>c.themeSettings),a=va(c=>c.systemAppearance),r=va(c=>c.setSystemAppearance);return _.useEffect(()=>{ZS(t,a)},[a,t]),_.useEffect(()=>ET(r),[r]),l.jsxs("div",{className:"app-shell",children:[l.jsx(gT,{snapshot:s}),l.jsx("div",{className:"app-shell__content",children:l.jsx(yS,{})})]})},zT=s=>s.tailscale_dns_name||s.tailscale_ip||s.host||s.direct_base_url,BT=({message:s})=>l.jsx("p",{className:"empty-copy",children:s}),PT=()=>{const s=Mr(),{data:t}=Uu(),a=(t==null?void 0:t.agents)??[];return l.jsxs("div",{className:"nodes-screen",children:[l.jsxs("div",{className:"nodes-screen__header",children:[l.jsx("h1",{children:"节点列表"}),l.jsx("p",{children:"查看所有在线节点和局域网地址"})]}),l.jsx("div",{className:"nodes-screen__content node-list",children:a.length===0?l.jsx(BT,{message:"暂无节点"}):a.map(r=>{const c=Eu(),u=(t==null?void 0:t.sessions.find(h=>h.id===c&&h.agent_id===r.id))??null;return l.jsxs("button",{type:"button",className:"node-card",onClick:()=>{xr(r.id),ds((u==null?void 0:u.id)??null),Mu((u==null?void 0:u.id)??null),s({to:"/"})},children:[l.jsxs("div",{className:"node-card__header",children:[l.jsx("strong",{children:r.name}),l.jsx("span",{className:`node-status-dot ${r.status}`})]}),l.jsx("div",{className:"node-card__ip",children:zT(r)})]},r.id)})})]})},qu=s=>[...s].sort((t,a)=>{const r=Number(a.pinned)-Number(t.pinned);return r!==0?r:+new Date(a.last_event_at)-+new Date(t.last_event_at)}),ty=(s,t)=>!!(s!=null&&s.sessions.some(a=>a.id===t)),Vf=(s,t,a)=>!s||!ty(s,t)?s:{...s,sessions:qu(s.sessions.map(r=>r.id===t?{...r,...a}:r))},yg=(s,t,a)=>{if(!s)return s;const r=s.sessions.find(h=>h.id===t);if(!r)return s;const c=new Date(a).getTime(),u=new Date(r.last_event_at).getTime();return!Number.isFinite(c)||Number.isFinite(u)&&c<=u?s:Vf(s,t,{last_event_at:a})},kf=(s,t,a)=>{if(!s)return s;const{last_event_at:r,...c}=a;let u=Vf(s,t,c);return typeof r=="string"&&r.trim()&&(u=yg(u,t,r)),u},WS=(s,t,a)=>{if(!s||t.length===0)return s;const r=new Set(t);return{...s,sessions:qu(s.sessions.map(c=>r.has(c.id)?{...c,...a}:c))}},XS=(s,t)=>{var u;if(!s||t.length===0)return s;const a=new Set(t),r=s.sessions.filter(h=>!a.has(h.id)),c=a.has(s.active_session_id)?((u=r[0])==null?void 0:u.id)??"":s.active_session_id;return{...s,active_session_id:c,sessions:qu(r)}},Kf=(s,t,a)=>!s||!s.projects.some(r=>r.id===t)?s:{...s,projects:s.projects.map(r=>r.id===t?{...r,...a}:r)},JS=(s,t)=>{if(!s||t.length===0||s.projects.length<=1)return s;const a=new Map(s.projects.map(u=>[u.id,u])),r=new Set,c=[];for(const u of t){const h=a.get(u);!h||r.has(u)||(r.add(u),c.push(h))}for(const u of s.projects)r.has(u.id)||c.push(u);return c.every((u,h)=>{var p;return u.id===((p=s.projects[h])==null?void 0:p.id)})?s:{...s,projects:c}},e1=(s,t)=>{var c;if(!s)return s;const a=s.sessions.filter(u=>u.project_id!==t),r=a.some(u=>u.id===s.active_session_id)?s.active_session_id:((c=a[0])==null?void 0:c.id)??"";return{...s,active_session_id:r,projects:s.projects.filter(u=>u.id!==t),sessions:qu(a)}},zx=(s,t)=>s&&{...s,generated_at:new Date().toISOString(),projects:[t,...s.projects.filter(a=>a.id!==t.id)]},UT=(s,t)=>{if(!s)return s;const a=[t,...s.sessions.filter(r=>r.id!==t.id)];return{...s,generated_at:new Date().toISOString(),active_session_id:t.id,sessions:qu(a)}};/**
|
|
67
|
+
* @license lucide-react v0.577.0 - ISC
|
|
68
|
+
*
|
|
69
|
+
* This source code is licensed under the ISC license.
|
|
70
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
71
|
+
*/const t1=(...s)=>s.filter((t,a,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===a).join(" ").trim();/**
|
|
72
|
+
* @license lucide-react v0.577.0 - ISC
|
|
73
|
+
*
|
|
74
|
+
* This source code is licensed under the ISC license.
|
|
75
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
76
|
+
*/const qT=s=>s.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
|
|
77
|
+
* @license lucide-react v0.577.0 - ISC
|
|
78
|
+
*
|
|
79
|
+
* This source code is licensed under the ISC license.
|
|
80
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
81
|
+
*/const $T=s=>s.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,a,r)=>r?r.toUpperCase():a.toLowerCase());/**
|
|
82
|
+
* @license lucide-react v0.577.0 - ISC
|
|
83
|
+
*
|
|
84
|
+
* This source code is licensed under the ISC license.
|
|
85
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
86
|
+
*/const Bx=s=>{const t=$T(s);return t.charAt(0).toUpperCase()+t.slice(1)};/**
|
|
87
|
+
* @license lucide-react v0.577.0 - ISC
|
|
88
|
+
*
|
|
89
|
+
* This source code is licensed under the ISC license.
|
|
90
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
91
|
+
*/var HT={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"};/**
|
|
92
|
+
* @license lucide-react v0.577.0 - ISC
|
|
93
|
+
*
|
|
94
|
+
* This source code is licensed under the ISC license.
|
|
95
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
96
|
+
*/const FT=s=>{for(const t in s)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};/**
|
|
97
|
+
* @license lucide-react v0.577.0 - ISC
|
|
98
|
+
*
|
|
99
|
+
* This source code is licensed under the ISC license.
|
|
100
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
101
|
+
*/const QT=_.forwardRef(({color:s="currentColor",size:t=24,strokeWidth:a=2,absoluteStrokeWidth:r,className:c="",children:u,iconNode:h,...p},y)=>_.createElement("svg",{ref:y,...HT,width:t,height:t,stroke:s,strokeWidth:r?Number(a)*24/Number(t):a,className:t1("lucide",c),...!u&&!FT(p)&&{"aria-hidden":"true"},...p},[...h.map(([m,x])=>_.createElement(m,x)),...Array.isArray(u)?u:[u]]));/**
|
|
102
|
+
* @license lucide-react v0.577.0 - ISC
|
|
103
|
+
*
|
|
104
|
+
* This source code is licensed under the ISC license.
|
|
105
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
106
|
+
*/const n1=(s,t)=>{const a=_.forwardRef(({className:r,...c},u)=>_.createElement(QT,{ref:u,iconNode:t,className:t1(`lucide-${qT(Bx(s))}`,`lucide-${s}`,r),...c}));return a.displayName=Bx(s),a};/**
|
|
107
|
+
* @license lucide-react v0.577.0 - ISC
|
|
108
|
+
*
|
|
109
|
+
* This source code is licensed under the ISC license.
|
|
110
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
111
|
+
*/const GT=[["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"}]],VT=n1("pin",GT);/**
|
|
112
|
+
* @license lucide-react v0.577.0 - ISC
|
|
113
|
+
*
|
|
114
|
+
* This source code is licensed under the ISC license.
|
|
115
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
116
|
+
*/const KT=[["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"}]],YT=n1("trash-2",KT),ZT=180*1e3,s1=8640*60*1e3,To=6,a1="panda:completed-session-seen-at",Mp=6,WT=220,Px=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:l.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"})}),XT=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:l.jsx("path",{d:"M12 5v14M5 12h14"})}),JT=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("rect",{x:"3",y:"4",width:"6",height:"6",rx:"1.5"}),l.jsx("rect",{x:"15",y:"4",width:"6",height:"6",rx:"1.5"}),l.jsx("rect",{x:"3",y:"14",width:"6",height:"6",rx:"1.5"}),l.jsx("rect",{x:"15",y:"14",width:"6",height:"6",rx:"1.5"})]}),eE=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:l.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"})}),tE=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[l.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"}),l.jsx("path",{d:"M16.5 10.5v5"}),l.jsx("path",{d:"M14 13h5"})]}),Ux=({open:s})=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:s?"is-open":"",children:l.jsx("path",{d:"m9 6 6 6-6 6"})}),nE=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"m9 6 6 6-6 6"})}),sE=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"m15 6-6 6 6 6"})}),aE=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.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"}),l.jsx("circle",{cx:"12",cy:"12",r:"3.15"})]}),iE=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("circle",{cx:"6",cy:"12",r:"1",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"12",cy:"12",r:"1",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"18",cy:"12",r:"1",fill:"currentColor",stroke:"none"})]}),rE=s=>{const t=Date.now(),a=new Date(s).getTime(),r=Math.max(0,t-a),c=60*1e3,u=60*c,h=24*u;return r<u?`${Math.max(1,Math.floor(r/c))}分钟`:r<h?`${Math.max(1,Math.floor(r/u))}小时`:`${Math.max(1,Math.floor(r/h))}天`},Rp=s=>s.run_state==="completed"&&s.run_state_changed_at&&Date.now()-new Date(s.run_state_changed_at).getTime()>ZT?"idle":s.run_state??"idle",lE=(s,t)=>s.archived||s.id===t||Date.now()-new Date(s.last_event_at).getTime()<=s1,oE=(s,t)=>Number(t.pinned)-Number(s.pinned)||+new Date(t.last_event_at)-+new Date(s.last_event_at),cE=(s,t)=>s.id===t||Date.now()-new Date(s.last_event_at).getTime()<=s1,uE=(s,t)=>{if(s.length<=To)return s;if(!t)return s.slice(0,To);const a=s.findIndex(r=>r.id===t);return a===-1||a<To?s.slice(0,To):[...s.slice(0,To-1),s[a]]},dE=()=>{if(typeof window>"u")return{};try{const s=window.localStorage.getItem(a1);if(!s)return{};const t=JSON.parse(s);return t&&typeof t=="object"?t:{}}catch{return{}}},Ap=(s,t)=>s.length===t.length&&s.every((a,r)=>a===t[r]),fE=(s,t)=>{if(!t||t.length===0||s.length<=1)return s;const a=new Map(s.map(u=>[u.id,u])),r=new Set,c=[];for(const u of t){const h=a.get(u);!h||r.has(u)||(r.add(u),c.push(h))}for(const u of s)r.has(u.id)||c.push(u);return c},hE=(s,t,a)=>{if(t<0||t>=s.length||a<0||a>=s.length||t===a)return s;const r=[...s],[c]=r.splice(t,1);return c?(r.splice(a,0,c),r):s},mE=(s,t,a)=>{if(t.length===0)return s;const r=new Set(t);let c=0;return s.map(u=>{if(!r.has(u))return u;const h=a[c]??u;return c+=1,h})},i1=_.memo(function({open:t,progress:a=t?1:0,isDragging:r=!1,desktopPinned:c=!1,isDesktopResizing:u=!1,onClose:h,onDesktopResizeStart:p,currentAgent:y,projects:m,sessions:x,activeSessionId:g,onCreateSession:S,onCreateDirectoryThread:k,onSelectSession:N,onSessionAction:T,onThreadAction:C,pendingSessionActionId:I,pendingThreadActionId:V}){const $=Mr(),R=a>.001,G=!!y,ue=(y==null?void 0:y.status)==="online",Z=_.useRef({threads:null,archived:null}),ie=_.useRef({}),te=_.useRef(null),Y=_.useRef(null),H=_.useRef(null),_e=_.useRef(null),je=_.useRef({}),ae=_.useRef(null),[ce,E]=_.useState({}),[U,ee]=_.useState(null),[W,xe]=_.useState(null),A=_.useMemo(()=>x.map(j=>{const z=ce[j.id];return z?{...j,...z.pinned===void 0?null:{pinned:z.pinned}}:j}).filter(j=>{var z;return!((z=ce[j.id])!=null&&z.hidden)}),[ce,x]),ne=(W==null?void 0:W.nextGlobalProjectIds)??U,be=_.useMemo(()=>fE(m,ne),[m,ne]),Q=_.useMemo(()=>A.filter(j=>!j.subagent&&lE(j,g)),[g,A]),pe=Q.find(j=>j.id===g),Ce=pe==null?void 0:pe.project_id,[Le,he]=_.useState(Ce?[Ce]:[]),[q,Se]=_.useState("threads"),[Ne,me]=_.useState(null),[Te,Ge]=_.useState(null),[Ue,gt]=_.useState(null),[Lt,St]=_.useState(null),[st,tn]=_.useState([]),[$t,de]=_.useState(null),[Ae,Re]=_.useState(""),[Oe,Ke]=_.useState(()=>dE()),mt=_.useMemo(()=>Q.filter(j=>!j.archived),[Q]),kt=_.useMemo(()=>mt.filter(j=>j.pinned).sort((j,z)=>+new Date(z.last_event_at)-+new Date(j.last_event_at)),[mt]),rn=_.useMemo(()=>mt.filter(j=>!j.pinned),[mt]),Bn=_.useMemo(()=>Q.filter(j=>j.archived),[Q]),On=j=>be.map(z=>{var Ve;const we=j.filter(ct=>ct.project_id===z.id).sort((ct,Nt)=>oE(ct,Nt)).filter(ct=>cE(ct,g)),ke=((Ve=we[0])==null?void 0:Ve.last_event_at)??new Date(0).toISOString();return{project:z,threadSessions:we,collapsedThreadSessions:uE(we,g),hiddenSessionCount:Math.max(0,we.length-To),latestEventAt:ke}}).filter(({threadSessions:z})=>z.length>0),nn=_.useMemo(()=>On(rn),[g,be,rn]),ln=_.useMemo(()=>On(Bn),[g,Bn,be]);_.useEffect(()=>{E(j=>{let z=!1;const ge={...j};for(const[we,ke]of Object.entries(j)){const Ve=x.find(Nt=>Nt.id===we);if(!Ve){ke.hidden&&(delete ge[we],z=!0);continue}(ke.pinned===void 0||Ve.pinned===ke.pinned)&&!ke.hidden&&(delete ge[we],z=!0)}return z?ge:j})},[x]),_.useEffect(()=>{ee(j=>{if(!j)return j;const z=m.map(we=>we.id),ge=[...j.filter(we=>z.includes(we)),...z.filter(we=>!j.includes(we))];return Ap(ge,z)?null:ge})},[m]),_.useEffect(()=>{Ce&&he(j=>j.includes(Ce)?j:[...j,Ce])},[Ce]),_.useEffect(()=>{Se(pe!=null&&pe.archived?"archived":"threads")},[pe==null?void 0:pe.archived,g]),_.useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(a1,JSON.stringify(Oe))}catch{}},[Oe]),_.useEffect(()=>{t||c||(gt(null),St(null),de(null),Ge(null))},[c,t]),_.useEffect(()=>{if(!c||!Ue)return;const j=z=>{const ge=z.target;if(!(ge instanceof Element)){gt(null);return}ge.closest(".thread-group__menu-anchor")||ge.closest(".thread-group__menu")||gt(null)};return window.addEventListener("pointerdown",j),()=>{window.removeEventListener("pointerdown",j)}},[c,Ue]),_.useEffect(()=>{if(!g)return;const j=Q.find(ge=>ge.id===g);if(!j||Rp(j)!=="completed"||!j.run_state_changed_at)return;const z=j.run_state_changed_at;Ke(ge=>ge[j.id]===z?ge:{...ge,[j.id]:z})},[g,Q]),_.useEffect(()=>()=>{te.current!==null&&globalThis.clearTimeout(te.current),ae.current!==null&&window.cancelAnimationFrame(ae.current)},[]),_.useEffect(()=>{H.current=W},[W]),_.useLayoutEffect(()=>{if(typeof window>"u")return;const j={},z=[];for(const[ge,we]of Object.entries(ie.current)){if(!we)continue;const ke=we.offsetTop;if(j[ge]=ke,(W==null?void 0:W.projectId)===ge)continue;const Ve=je.current[ge];if(Ve===void 0)continue;const ct=Ve-ke;Math.abs(ct)<.5||(we.style.transition="none",we.style.transform=`translateY(${ct}px)`,z.push(we))}ae.current!==null&&window.cancelAnimationFrame(ae.current),z.length>0&&(ae.current=window.requestAnimationFrame(()=>{for(const ge of z)ge.style.transition="",ge.style.transform=""})),je.current=j},[nn,ln,Le,st,W==null?void 0:W.projectId,ne]);const oe=()=>{te.current!==null&&(globalThis.clearTimeout(te.current),te.current=null)},qe=j=>j==="threads"?nn:ln,De=(j,z,ge,we,ke)=>{const Ve=Z.current[z],ct=ie.current[j];if(!Ve||!ct)return!1;const Nt=qe(z).map(sn=>sn.project.id),Un=Nt.indexOf(j);if(Un===-1)return!1;const Jn=be.map(sn=>sn.id),Ht=Ve.getBoundingClientRect(),wn=ct.getBoundingClientRect(),kn=ct.offsetHeight,Ln=ct.offsetWidth,un=ke-wn.top,B=Ve.scrollTop,on=Math.max(B,Ve.scrollTop+Ve.clientHeight-kn),gn=Math.max(B,Math.min(on,Ve.scrollTop+ke-Ht.top-un)),yn={pane:z,projectId:j,pointerId:ge,pointerType:we,originIndex:Un,visibleProjectIds:Nt,nextVisibleProjectIds:Nt,nextGlobalProjectIds:Jn,previewTop:gn,itemHeight:kn,itemWidth:Ln,pointerOffsetY:un};return H.current=yn,xe(yn),_e.current=j,!0},Ie=j=>{xe(z=>{if(!z)return z;H.current=z;const ge=Z.current[z.pane];if(!ge||!ie.current[z.projectId])return z;const we=ge.getBoundingClientRect(),ke=ge.scrollTop,Ve=Math.max(ke,ge.scrollTop+ge.clientHeight-z.itemHeight),ct=Math.max(ke,Math.min(Ve,ge.scrollTop+j-we.top-z.pointerOffsetY)),Nt=ct+z.itemHeight/2,Un=z.nextVisibleProjectIds,Jn=Un.indexOf(z.projectId);if(Jn===-1)return z;const Ht=Un.filter(gn=>gn!==z.projectId);let wn=0;const kn=Ht[0],Ln=kn?ie.current[kn]:null;if(Ln&&ct<=Ln.offsetTop+Ln.offsetHeight*.42)wn=0;else for(let gn=0;gn<Ht.length;gn+=1){const yn=Ht[gn],sn=yn?ie.current[yn]:null;if(!sn){wn=gn+1;continue}const Ft=sn.offsetTop+sn.offsetHeight/2;if(Nt<=Ft){wn=gn;break}wn=gn+1}const un=hE(Un,Jn,wn),B=mE(z.nextGlobalProjectIds,z.visibleProjectIds,un);if(ct===z.previewTop&&Ap(un,z.nextVisibleProjectIds))return z;const on={...z,previewTop:ct,nextVisibleProjectIds:un,nextGlobalProjectIds:B};return H.current=on,on})},We=j=>{oe(),Y.current=null;const z=j??H.current;if(H.current=null,xe(null),!z||!!Ap(z.visibleProjectIds,z.nextVisibleProjectIds)||!C)return;const we=U??be.map(Ve=>Ve.id),ke=z.nextGlobalProjectIds;ee(ke),Promise.resolve(C(z.projectId,"reorder",{orderedProjectIds:ke})).catch(()=>{ee(we)})},$e=()=>{oe(),Y.current=null,H.current=null,xe(null)};_.useEffect(()=>{if(typeof window>"u"||!H.current)return;const j=we=>{const ke=H.current;!ke||ke.pointerId!==we.pointerId||Ie(we.clientY)},z=we=>{const ke=H.current;!ke||ke.pointerId!==we.pointerId||We(ke)},ge=we=>{const ke=H.current;!ke||ke.pointerId!==we.pointerId||$e()};return window.addEventListener("pointermove",j),window.addEventListener("pointerup",z),window.addEventListener("pointercancel",ge),()=>{window.removeEventListener("pointermove",j),window.removeEventListener("pointerup",z),window.removeEventListener("pointercancel",ge)}},[W==null?void 0:W.pointerId]);const He=j=>{he(z=>z.includes(j)?z.filter(ge=>ge!==j):[...z,j])},Ee=j=>{if(_e.current===j){_e.current=null;return}He(j)},Ut=(j,z,ge)=>{if(j.pointerType==="mouse"&&j.button!==0)return;oe();const we=j.currentTarget;Y.current={pane:ge,projectId:z,pointerId:j.pointerId,pointerType:j.pointerType,startX:j.clientX,startY:j.clientY,currentX:j.clientX,currentY:j.clientY},j.pointerType!=="touch"&&we.setPointerCapture(j.pointerId),j.pointerType==="touch"&&(te.current=globalThis.setTimeout(()=>{const ke=Y.current;if(!ke||ke.projectId!==z||ke.pointerId!==j.pointerId)return;we.hasPointerCapture(j.pointerId)||we.setPointerCapture(j.pointerId),De(z,ge,j.pointerId,j.pointerType,ke.currentY)&&Ie(ke.currentY)},WT))},at=(j,z,ge)=>{const we=Y.current;if(!we||we.projectId!==z||we.pointerId!==j.pointerId||we.pane!==ge)return;if(we.currentX=j.clientX,we.currentY=j.clientY,(W==null?void 0:W.projectId)===z&&W.pointerId===j.pointerId){j.preventDefault(),Ie(j.clientY);return}const ke=j.clientX-we.startX,Ve=j.clientY-we.startY;if(we.pointerType==="touch"){(Math.abs(ke)>Mp||Math.abs(Ve)>Mp)&&oe();return}Math.abs(Ve)<Mp||Math.abs(Ve)<Math.abs(ke)||!De(z,ge,j.pointerId,j.pointerType,j.clientY)||(j.preventDefault(),Ie(j.clientY))},pn=(j,z)=>{if(j.currentTarget.hasPointerCapture(j.pointerId)&&j.currentTarget.releasePointerCapture(j.pointerId),(W==null?void 0:W.projectId)===z&&W.pointerId===j.pointerId){j.preventDefault(),We();return}oe(),Y.current=null},Pn=(j,z)=>{if(j.currentTarget.hasPointerCapture(j.pointerId)&&j.currentTarget.releasePointerCapture(j.pointerId),(W==null?void 0:W.projectId)===z&&W.pointerId===j.pointerId){$e();return}oe(),Y.current=null},xn=j=>{tn(z=>z.includes(j)?z.filter(ge=>ge!==j):[...z,j])},ps=j=>{if(Rp(j)!=="completed"||!j.run_state_changed_at)return;const z=j.run_state_changed_at;Ke(ge=>ge[j.id]===z?ge:{...ge,[j.id]:z})},as=`translateX(-${(q==="threads"?0:1)*50}%)`,Ci=$t&&typeof document<"u"?or.createPortal(l.jsxs("div",{className:"sheet-wrap sheet-wrap--centered",role:"dialog","aria-modal":"true",children:[l.jsx("button",{type:"button",className:"sheet-wrap__scrim",onClick:()=>{de(null),Re("")},"aria-label":"关闭重命名面板"}),l.jsx("div",{className:"sheet-wrap__center",children:l.jsxs("div",{className:"sheet-panel sheet-panel--form sheet-panel--centered",children:[l.jsx("div",{className:"sheet-panel__title",children:"编辑线程名称"}),l.jsx("input",{className:"sheet-panel__input",value:Ae,onChange:j=>Re(j.target.value),placeholder:"输入线程名称",autoFocus:!0}),l.jsxs("div",{className:"sheet-panel__actions",children:[l.jsx("button",{type:"button",className:"sheet-panel__button",onClick:()=>{de(null),Re("")},children:"取消"}),l.jsx("button",{type:"button",className:"sheet-panel__button is-primary",disabled:!Ae.trim()||V===$t,onClick:()=>{Gs()},children:"保存"})]})]})})]}),document.body):null,la=j=>{gt(null),St(null),de(j.id),Re(j.display_name??j.name)},Gs=async()=>{!$t||!Ae.trim()||!C||(await C($t,"rename",{name:Ae.trim()}),de(null),Re(""))},is=(j,z,ge)=>{if(!T)return;const we=ce[j.id];z==="pin"||z==="unpin"?E(Ve=>({...Ve,[j.id]:{...Ve[j.id],pinned:z==="pin"}})):z==="delete"&&E(Ve=>({...Ve,[j.id]:{...Ve[j.id],hidden:!0}}));const ke=T(j.id,z,ge);ke&&typeof ke.then=="function"&&ke.catch(()=>{E(Ve=>{const ct={...Ve};return we?ct[j.id]=we:delete ct[j.id],ct})})},xa=j=>{const z=Rp(j),ge=z==="completed"&&j.id!==g&&!!j.run_state_changed_at&&Oe[j.id]!==j.run_state_changed_at,we=c&&Ne===j.id,ke=!!T&&we,Ve=Te===j.id,ct=c&&(ke||Ve);return l.jsxs("div",{className:`thread-session ${j.id===g?"is-active":""}`,onMouseEnter:()=>me(j.id),onMouseLeave:()=>{me(Nt=>Nt===j.id?null:Nt),Ge(Nt=>Nt===j.id?null:Nt)},children:[l.jsx("button",{type:"button",className:`thread-session__icon-button ${ke?"is-visible":""} ${j.pinned?"is-active":""}`,disabled:I===j.id,onClick:Nt=>{Nt.stopPropagation(),is(j,j.pinned?"unpin":"pin")},"aria-label":j.pinned?"取消置顶会话":"置顶会话",title:j.pinned?"取消置顶":"置顶",children:l.jsx(VT,{strokeWidth:j.pinned?2.1:1.95})}),l.jsxs("div",{className:"thread-session__row",children:[N?l.jsxs("button",{type:"button",className:"thread-session__link thread-session__link--button",title:j.title,onClick:()=>{ps(j),N(j.id),h()},children:[l.jsx("span",{className:`thread-session__status is-${ge?"completed":z} ${ge?"is-unread":""} ${ct?"is-hidden":""}`,"aria-hidden":"true"}),l.jsx("div",{className:"thread-session__title",children:j.title})]}):l.jsxs(vu,{to:"/session/$sessionId",params:{sessionId:j.id},title:j.title,onClick:()=>{ps(j),h()},className:"thread-session__link",children:[l.jsx("span",{className:`thread-session__status is-${ge?"completed":z} ${ge?"is-unread":""} ${ct?"is-hidden":""}`,"aria-hidden":"true"}),l.jsx("div",{className:"thread-session__title",children:j.title})]}),l.jsx("div",{className:"thread-session__meta",children:c&&we&&T?Ve?l.jsx("button",{type:"button",className:"thread-session__delete-confirm",disabled:I===j.id,onClick:Nt=>{Nt.stopPropagation(),is(j,"delete")},children:"确认"}):l.jsx("button",{type:"button",className:"thread-session__delete",disabled:I===j.id,onClick:Nt=>{Nt.stopPropagation(),Ge(j.id)},"aria-label":`删除 ${j.title}`,children:l.jsx(YT,{strokeWidth:1.95})}):l.jsx("span",{className:"thread-session__time",children:rE(j.last_event_at)})})]})]},j.id)},Vs=({project:j,threadSessions:z,collapsedThreadSessions:ge,hiddenSessionCount:we},ke)=>{const Ve=Le.includes(j.id),ct=st.includes(j.id),Nt=j.display_name??j.name,Un=!!C&&c&&Ue===j.id,Jn=!!C&&Lt===j.id,Ht=z.every(B=>B.archived),wn=ct?z:ge,kn=we>0,Ln=(W==null?void 0:W.projectId)===j.id&&W.pane===ke,un=Jn&&typeof document<"u"?or.createPortal(l.jsxs("div",{className:"sheet-wrap",role:"dialog","aria-modal":"true",children:[l.jsx("button",{type:"button",className:"sheet-wrap__scrim",onClick:()=>St(null),"aria-label":"关闭线程菜单"}),l.jsxs("div",{className:"sheet-panel",children:[l.jsx("div",{className:"sheet-panel__title",children:Nt}),l.jsx("button",{type:"button",className:"sheet-panel__item",onClick:()=>la(j),children:"编辑名称"}),l.jsx("button",{type:"button",className:"sheet-panel__item",disabled:V===j.id,onClick:()=>{C==null||C(j.id,Ht?"unarchive":"archive"),St(null)},children:Ht?"取消归档":"归档线程"}),l.jsx("button",{type:"button",className:"sheet-panel__item is-danger",disabled:V===j.id,onClick:()=>{C==null||C(j.id,"remove"),St(null)},children:"移除"})]})]}),document.body):null;return l.jsxs(_.Fragment,{children:[l.jsx("div",{ref:B=>{ie.current[j.id]=B},className:`thread-group-shell ${Ln?"is-drag-placeholder":""}`,children:l.jsxs("section",{className:"thread-group",children:[l.jsxs("div",{className:"thread-group__header",children:[l.jsxs("button",{type:"button",className:"thread-group__title",onClick:()=>Ee(j.id),onPointerDown:B=>Ut(B,j.id,ke),onPointerMove:B=>at(B,j.id,ke),onPointerUp:B=>pn(B,j.id),onPointerCancel:B=>Pn(B,j.id),"aria-expanded":Ve,title:Nt,children:[l.jsx("span",{className:"thread-group__chevron",children:l.jsx(Ux,{open:Ve})}),l.jsx("span",{className:"thread-group__icon",children:l.jsx(Px,{})}),l.jsx("span",{className:"thread-group__title-text",children:Nt})]}),l.jsxs("div",{className:"thread-group__actions",children:[C?l.jsxs("div",{className:"thread-group__menu-anchor",children:[l.jsx("button",{type:"button",className:`thread-group__more ${Un||Jn?"is-open":""}`,onClick:B=>{if(B.stopPropagation(),c){gt(on=>on===j.id?null:j.id);return}St(j.id)},"aria-label":`${Nt} 更多选项`,children:l.jsx(iE,{})}),Un?l.jsxs("div",{className:"thread-group__menu",children:[l.jsx("button",{type:"button",className:"thread-group__menu-item",onClick:()=>la(j),children:"编辑名称"}),l.jsx("button",{type:"button",className:"thread-group__menu-item",disabled:V===j.id,onClick:()=>{C==null||C(j.id,Ht?"unarchive":"archive"),gt(null)},children:Ht?"取消归档":"归档线程"}),l.jsx("button",{type:"button",className:"thread-group__menu-item is-danger",disabled:V===j.id,onClick:()=>{C==null||C(j.id,"remove"),gt(null)},children:"移除"})]}):null]}):null,l.jsx("button",{type:"button",className:"thread-group__add",onClick:B=>{B.stopPropagation(),S(j.id,j.name)},"aria-label":`在 ${j.name} 下新增会话`,children:l.jsx(XT,{})})]})]}),Ve?z.length===0?l.jsx("div",{className:"thread-group__empty",children:"这个线程还没有会话"}):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"thread-group__sessions",children:wn.map(B=>xa(B))}),kn?l.jsx("button",{type:"button",className:"thread-group__session-toggle",onClick:()=>xn(j.id),"aria-expanded":ct,children:ct?"折叠显示":"展开显示"}):null]}):null]},j.id)}),un]},j.id)},rs=j=>{if(!W||W.pane!==j)return null;const z=qe(j).find(ke=>ke.project.id===W.projectId);if(!z)return null;const ge={top:W.previewTop,width:`${W.itemWidth}px`},we=z.project.display_name??z.project.name;return l.jsx("div",{className:"thread-group-drag-preview",style:ge,"aria-hidden":"true",children:l.jsxs("div",{className:"thread-group-drag-preview__header",children:[l.jsx("span",{className:"thread-group-drag-preview__chevron",children:l.jsx(Ux,{open:!0})}),l.jsx("span",{className:"thread-group-drag-preview__icon",children:l.jsx(Px,{})}),l.jsx("span",{className:"thread-group-drag-preview__title",children:we})]})})};return l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:`sidebar-scrim ${R?"is-visible":""}`,style:{opacity:c?0:a,pointerEvents:c?"none":R?"auto":"none",transition:r?"none":void 0},onClick:h,"aria-label":"关闭侧边栏"}),l.jsxs("aside",{className:`conversation-sidebar ${t?"is-open":""} ${c?"is-desktop-pinned":""} ${u?"is-resizing":""}`,style:{transform:c?"translateX(0)":`translateX(calc(-100% + ${Math.max(0,Math.min(a,1))*100}%))`,transition:r?"none":void 0},children:[c&&p?l.jsx("div",{className:"conversation-sidebar__resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"调整侧边栏宽度",onPointerDown:j=>{j.pointerType!=="touch"&&(j.preventDefault(),j.stopPropagation(),p(j.clientX))}}):null,l.jsxs("div",{className:"conversation-sidebar__header",children:[l.jsxs("div",{className:`conversation-sidebar__brand ${G?`is-${ue?"online":"offline"}`:"is-empty"}`,"aria-label":G?ue?"节点在线":"节点断开":"未选择节点",title:G?ue?"节点在线":"节点断开":"未选择节点",children:[G?l.jsx("span",{className:"conversation-sidebar__status-dot","aria-hidden":"true"}):null,l.jsx("span",{className:"conversation-sidebar__brand-name",children:(y==null?void 0:y.name)??"未选择节点"})]}),c?null:l.jsx("button",{type:"button",className:"conversation-sidebar__close",onClick:h,"aria-label":"关闭",children:"×"})]}),l.jsxs("div",{className:"conversation-sidebar__actions",children:[l.jsxs(vu,{to:"/nodes",className:"sidebar-action",onClick:h,children:[l.jsx("span",{className:"sidebar-action__icon",children:l.jsx(JT,{})}),l.jsx("span",{children:"节点列表"})]}),l.jsxs("button",{type:"button",className:"sidebar-action sidebar-action--primary",onClick:()=>{h();const j=m.find(z=>z.id===Ce)??m[0];j?S(j.id,j.name):$({to:"/nodes"})},children:[l.jsx("span",{className:"sidebar-action__icon",children:l.jsx(eE,{})}),l.jsx("span",{children:"新会话"})]})]}),l.jsx("div",{className:"conversation-sidebar__threads",children:l.jsxs("div",{className:"sidebar-pane-track",style:{transform:as},children:[l.jsxs("div",{ref:j=>{Z.current.threads=j},className:`sidebar-pane ${q==="threads"?"is-active":"is-inactive"}`,children:[kt.length>0?l.jsxs("div",{className:"sidebar-pinned",children:[l.jsx("div",{className:"conversation-sidebar__node",children:"置顶会话"}),l.jsx("div",{className:"sidebar-pinned__list",children:kt.map(j=>xa(j))})]}):null,l.jsxs("div",{className:"conversation-sidebar__node-row",children:[l.jsx("div",{className:"conversation-sidebar__node",children:"线程"}),k?l.jsx("button",{type:"button",className:"conversation-sidebar__node-action",onClick:k,"aria-label":"新增目录线程",title:"新增目录线程",children:l.jsx(tE,{})}):null]}),nn.map(j=>Vs(j,"threads")),rs("threads"),l.jsxs("button",{type:"button",className:"thread-archive__toggle",onClick:()=>Se("archived"),children:[l.jsx("span",{children:"已归档"}),l.jsx("span",{className:"thread-archive__icon",children:l.jsx(nE,{})})]})]}),l.jsxs("div",{ref:j=>{Z.current.archived=j},className:`sidebar-pane sidebar-pane--archived ${q==="archived"?"is-active":"is-inactive"}`,children:[l.jsx("div",{className:"conversation-sidebar__node",children:"已归档的线程"}),ln.length>0?l.jsx("div",{className:"thread-archive__list",children:ln.map(j=>Vs(j,"archived"))}):l.jsx("div",{className:"thread-archive__empty",children:"暂时没有已归档的线程"}),rs("archived"),l.jsxs("button",{type:"button",className:"thread-archive__back",onClick:()=>Se("threads"),"aria-label":"返回线程列表",children:[l.jsx("span",{className:"thread-archive__back-icon",children:l.jsx(sE,{})}),l.jsx("span",{children:"返回"})]})]})]})}),l.jsx("div",{className:"conversation-sidebar__footer",children:l.jsxs(vu,{to:"/settings",className:"sidebar-settings",onClick:h,"aria-label":"打开设置页",children:[l.jsx("span",{className:"sidebar-settings__icon",children:l.jsx(aE,{})}),l.jsx("span",{children:"设置"})]})})]}),Ci]})}),ny="optimistic-user:",pE="overlay-user:",gE=[ny,pE],yE=5e3,ir=s=>["timeline-optimistic",s],ah=s=>s.kind==="user"&&gE.some(t=>s.id.startsWith(t)),sy=s=>s.kind==="user"&&!ah(s),ay=s=>s.kind==="user"&&s.id.startsWith(ny),vE=s=>s.kind==="user"&&!ay(s),qx=s=>s.body.replace(/\r\n/g,`
|
|
117
|
+
`).trim(),$x=s=>new Date(s).getTime(),ih=(s,t)=>{if(qx(s)!==qx(t))return!1;const a=$x(s.timestamp),r=$x(t.timestamp);return!Number.isFinite(a)||!Number.isFinite(r)?!0:r>=a-yE},_E=(s,t)=>{const a=t.filter(sy);if(a.length===0)return new Set;const r=new Set,c=new Set;for(const u of s??[]){if(!ah(u))continue;const h=a.findIndex((p,y)=>!r.has(y)&&ih(u,p));h<0||(r.add(h),c.add(u.id))}return c},bE=(s,t)=>{const a=t.map((u,h)=>({entry:u,index:h})).filter(({entry:u})=>sy(u));if(a.length===0)return new Map;const r=new Set,c=new Map;for(const u of s??[]){if(!ah(u))continue;const h=a.find(({entry:p,index:y})=>!r.has(y)&&ih(u,p));h&&(r.add(h.index),(u.attachments??[]).length!==0&&c.set(h.index,DS(h.entry.attachments,u.attachments)))}return c},xE=(s,t)=>{const a=t.filter(vE);if(a.length===0)return new Set;const r=new Set,c=new Set;for(const u of s??[]){if(!ay(u))continue;const h=a.findIndex((p,y)=>!r.has(y)&&ih(u,p));h<0||(r.add(h),c.add(u.id))}return c},SE=s=>{const t=[...s??[]],a=t.map((u,h)=>({entry:u,index:h})).filter(({entry:u})=>sy(u));if(a.length===0)return t;const r=new Set,c=new Set;for(const u of t){if(!ah(u))continue;const h=a.find(({entry:p,index:y})=>!r.has(y)&&ih(u,p));h&&(r.add(h.index),c.add(u.id))}return c.size===0?t:t.filter(u=>!c.has(u.id))},r1=(s,t)=>[...s??[],t],l1=(s,t)=>{const a=bE(s,t),r=_E(s,t),c=[...s??[]].filter(h=>!r.has(h.id)),u=new Set(c.map(h=>h.id));for(const[h,p]of t.entries())u.has(p.id)||(u.add(p.id),c.push(a.has(h)?{...p,attachments:a.get(h)??p.attachments}:p));return c},vg=(s,t)=>[...l1(s,t)].sort((a,r)=>{const c=new Date(a.timestamp).getTime(),u=new Date(r.timestamp).getTime();return!Number.isFinite(c)||!Number.isFinite(u)?0:c-u}),Nf=(s,t)=>(s??[]).filter(a=>ay(a)&&!xE([a],t).has(a.id)),jE=(s,t)=>{const a=SE(s),r=Nf(t,a);return vg(r,a)},wE=(s,t)=>(s??[]).filter(a=>a.id!==t),o1="panda:session-model",c1="panda:command-execution-model",iy="panda:session-model-options",_g="panda:session-model-options-updated",u1="panda:session-reasoning",d1="panda:session-fast-mode",f1="panda:session-plan-mode",Ko=[{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"}],Au=[{label:"低",value:"low"},{label:"中",value:"medium"},{label:"高",value:"high"},{label:"极高",value:"xhigh"}];var P0;const h1=((P0=Ko[0])==null?void 0:P0.value)??"gpt-5.4",Hx="gpt-5.4-mini",kE=Au[2].value,xi=s=>typeof s=="string"?s.trim():"",NE=(s,t)=>{if(!s||typeof s!="object")return null;const a=s,r=xi(a.value),c=xi(a.label)||r,u=xi(a.id)||r||`custom-model-${t+1}`;if(!c||!r)return null;const h=xi(a.description);return{id:u,label:c,value:r,description:h||null}},CE=s=>{const t=new Set,a=new Set;return s.flatMap(r=>{const c=r.value.toLowerCase();if(a.has(c))return[];a.add(c);let u=r.id,h=2;for(;t.has(u);)u=`${r.id}-${h}`,h+=1;return t.add(u),[{...r,id:u}]})},m1=s=>{if(!Array.isArray(s))return Ko;const t=CE(s.flatMap((a,r)=>{const c=NE(a,r);return c?[c]:[]}));return t.length>0?t:Ko},$u=s=>{if(typeof window>"u")return null;try{return window.localStorage.getItem(s)}catch{return null}},TE=()=>{typeof window>"u"||window.dispatchEvent(new Event(_g))},Hu=(s,t)=>{if(!(typeof window>"u"))try{window.localStorage.setItem(s,t)}catch{}},p1=(s,t=!1)=>{const a=$u(s);return a==="true"?!0:a==="false"?!1:t},g1=(s,t)=>{Hu(s,t?"true":"false")},rh=(s,t)=>{const a=t==null?void 0:t.trim();return a?`${s}:${a}`:null},ou=s=>{const t=xi(s==null?void 0:s.value)||"",a=xi(s==null?void 0:s.label)||t;return{id:xi(s==null?void 0:s.id)||xi(s==null?void 0:s.value)||`custom-model-${Date.now()}`,label:a,value:t,description:xi(s==null?void 0:s.description)||null}},EE=()=>lh().map(({id:s,...t})=>t),lh=()=>{const s=$u(iy);if(!s)return Ko;try{return m1(JSON.parse(s))}catch{return Ko}},ME=s=>{const t=m1(s);Hu(iy,JSON.stringify(t)),TE()},RE=s=>Au.some(t=>t.value===s),ry=()=>{var a;const s=$u(o1),t=lh();return t.some(r=>r.value===s)?s:((a=t[0])==null?void 0:a.value)??h1},Cf=()=>{const s=$u(c1),t=lh();if(t.some(r=>r.value===s))return s;const a=t.find(r=>r.value===Hx)??t[0];return(a==null?void 0:a.value)??Hx},y1=()=>{const s=$u(u1);return RE(s)?s:kE},_u=s=>{Hu(o1,s)},Dp=s=>{Hu(c1,s)},v1=s=>{Hu(u1,s)},Fx=s=>{const t=rh(d1,s);return t?p1(t):!1},Qx=s=>{const t=rh(f1,s);return t?p1(t):!1},_1=(s,t)=>{const a=rh(d1,s);a&&g1(a,t)},b1=(s,t)=>{const a=rh(f1,s);a&&g1(a,t)},AE=(s,t)=>{_1(s,t.isFastModeEnabled),b1(s,t.isPlanModeEnabled)},Yf=(s,t=EE())=>{var a,r;return((a=t.find(c=>c.value===s))==null?void 0:a.label)??(typeof s=="string"&&s.trim()?s.trim():((r=t[0])==null?void 0:r.label)??h1)},DE=s=>{var t;return((t=Au.find(a=>a.value===s))==null?void 0:t.label)??Au[2].label},x1="image/",OE=()=>`attachment-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,LE=s=>new Promise((t,a)=>{const r=new FileReader;r.onerror=()=>a(r.error??new Error("无法读取文件")),r.onload=()=>{if(typeof r.result=="string"&&r.result){t(r.result);return}a(new Error("无法读取文件"))},r.readAsDataURL(s)}),S1=async s=>({id:OE(),kind:s.type.startsWith(x1)?"image":"file",name:s.name,mime_type:s.type||null,size_bytes:Number.isFinite(s.size)?Math.max(0,Math.round(s.size)):null,data_url:await LE(s)}),Gx=s=>{var t;return s.kind==="image"||!!((t=s.mime_type)!=null&&t.startsWith(x1))},j1=s=>AS((s??[]).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}))),bg=s=>typeof s!="number"||!Number.isFinite(s)||s<=0?null:s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`,IE=/\[[^\]]+\]\([^)]+\)|`[^`\n]+`|\*\*.+?\*\*|\*[^*\n][^*\n]*\*|\$[A-Za-z0-9._-]+|\/[A-Za-z][A-Za-z0-9._-]*/g,zE=/^[A-Za-z0-9._-]$/,BE=/^[A-Za-z0-9._-]$/,xg=s=>/\s/.test(s),Vx=s=>zE.test(s),PE=s=>BE.test(s),Qs=s=>s.trim().toLowerCase(),UE=s=>Qs(s).split(/[^a-z0-9]+/i).filter(Boolean),Kx=s=>s==="repo"?0:s==="user"?1:2,qE=s=>s==="repo"?"项目":s==="user"?"个人":"系统",w1=s=>{const t=[];let a=0;for(const r of s.matchAll(IE)){const c=r[0],u=r.index??0;if(c.startsWith("$")){const h=u>0?s[u-1]??"":"";if(u>0&&!xg(h))continue}if(c.startsWith("/")){const h=u>0?s[u-1]??"":"";if(u>0&&!xg(h))continue}if(u>a&&t.push({kind:"text",value:s.slice(a,u)}),c.startsWith("`")&&c.endsWith("`"))t.push({kind:"code",value:c.slice(1,-1)});else if(c.startsWith("**")&&c.endsWith("**"))t.push({kind:"strong",value:c.slice(2,-2)});else if(c.startsWith("*")&&c.endsWith("*"))t.push({kind:"emphasis",value:c.slice(1,-1)});else if(c.startsWith("[")){const h=/^\[([^\]]+)\]\(([^)]+)\)$/.exec(c);h?t.push({kind:"path-link",label:h[1]??"",path:h[2]??""}):t.push({kind:"text",value:c})}else c.startsWith("/")?t.push({kind:"command",raw:c,name:c.slice(1)}):t.push({kind:"skill",raw:c,name:c.slice(1)});a=u+c.length}return a<s.length&&t.push({kind:"text",value:s.slice(a)}),t},k1=(s,t,a=t)=>{if(t!==a)return null;let r=t;for(;r>0&&Vx(s[r-1]??"");)r-=1;const c=r-1;if(c<0||s[c]!=="$")return null;const u=c>0?s[c-1]??"":"";if(c>0&&!xg(u))return null;let h=t;for(;h<s.length&&Vx(s[h]??"");)h+=1;return{start:c,end:h,query:s.slice(c+1,t)}},$E=(s,t,a,r)=>{const c=k1(s,t,a);if(!c)return null;const p=(s[c.end]??"").length===0?`$${r} `:`$${r}`,y=`${s.slice(0,c.start)}${p}${s.slice(c.end)}`,m=c.start+p.length;return{value:y,selectionStart:m,selectionEnd:m}},ly=s=>s.startsWith("/"),N1=(s,t,a=t)=>{if(!ly(s)||t!==a)return null;const r=s.search(/\s/),c=r<0?s.length:r;if(t>c)return null;let u=1;for(;u<s.length&&PE(s[u]??"");)u+=1;return t>u?null:{start:0,end:u,query:s.slice(1,t)}},HE=(s,t,a,r)=>{const c=N1(s,t,a);if(!c)return null;const p=(s[c.end]??"").length===0?`/${r} `:`/${r}`,y=`${s.slice(0,c.start)}${p}${s.slice(c.end)}`,m=c.start+p.length;return{value:y,selectionStart:m,selectionEnd:m}},FE=(s,t)=>{const a=Qs(t),r=s.filter(u=>{if(!u.enabled)return!1;if(!a)return!0;const h=Qs(u.name),p=Qs(u.description);return h.includes(a)||p.includes(a)}),c=u=>{if(!a)return 0;const h=Qs(u.name),p=Qs(u.description),y=UE(u.name);return h===a?0:y.some(m=>m===a)?1:h.startsWith(a)?2:y.some(m=>m.startsWith(a))?3:h.includes(a)?4:p.startsWith(a)?5:6};return[...r].sort((u,h)=>{const p=c(u),y=c(h);if(p!==y)return p-y;const m=Kx(u.scope)-Kx(h.scope);if(m!==0)return m;const x=Qs(u.name),g=Qs(h.name);return x.localeCompare(g)})},QE=(s,t)=>{const a=Qs(t);return[...s.filter(c=>{if(!a)return!0;const u=Qs(c.name),h=Qs(c.description);return u.includes(a)||h.includes(a)})].sort((c,u)=>{const h=Qs(c.name),p=Qs(u.name),y=h===a?0:h.startsWith(a)?1:2,m=p===a?0:p.startsWith(a)?1:2;return y!==m?y-m:c.availability!==u.availability?c.availability==="supported"?-1:1:h.localeCompare(p)})},GE=s=>{if(typeof window>"u")return()=>{};const t=r=>{(r.key===null||r.key===iy)&&s()},a=()=>{s()};return window.addEventListener("storage",t),window.addEventListener(_g,a),()=>{window.removeEventListener("storage",t),window.removeEventListener(_g,a)}},VE=()=>lh(),KE=()=>Ko,oy=()=>_.useSyncExternalStore(GE,VE,KE),cy=s=>s.replace(/[\\/]+$/,""),Zf=s=>cy(s).replace(/\\/g,"/").toLowerCase(),YE=s=>{const t=cy(s.trim());if(!t)return"新线程";const a=t.split(/[\\/]+/).filter(Boolean),r=a[a.length-1];return r?r.endsWith(":")?t:r:t},ZE=s=>{if(!s)return null;const t=s.trim();if(!t||t==="/"||/^[A-Za-z]:[\\/]?$/.test(t))return null;const a=cy(t),r=Math.max(a.lastIndexOf("/"),a.lastIndexOf("\\"));if(r<0)return null;const c=a.slice(0,r);return c?/^[A-Za-z]:$/.test(c)?`${c}\\`:c:a.startsWith("/")?"/":null},WE=async s=>(await Xn({agentId:s.agentId})).client.listDirectories(s),XE=async s=>{const t=s.bootstrapQueryKey??["bootstrap"],a=s.projects.find(u=>u.agent_id===s.agentId&&Zf(u.path)===Zf(s.path));if(a)return s.queryClient.setQueryData(t,u=>zx(u,a)),a;const c=await(await Xn({agentId:s.agentId})).client.createProject({agentId:s.agentId,name:YE(s.path),path:s.path});return s.queryClient.setQueryData(t,u=>zx(u,c.project)),s.queryClient.invalidateQueries({queryKey:t}),c.project},Yx=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.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"})}),JE=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"m9 6 6 6-6 6"})}),eM=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"m5 12 4.5 4.5L19 7"})}),Zx=s=>!!(s&&/^[A-Za-z]:[\\/]?$/.test(s.trim())),tM=({agentId:s,projects:t,initialPath:a=null,title:r="选择目录",subtitle:c="线程名会使用目录最后一级名称",confirmLabel:u="选择此目录",cancelLabel:h="返回上级",onProjectCreated:p})=>{const y=Tl(),[m,x]=_.useState(a),[g,S]=_.useState(a),[k,N]=_.useState([]),[T,C]=_.useState(!0),[I,V]=_.useState(null);_.useEffect(()=>{x(a),S(a)},[a]),_.useEffect(()=>{let H=!1;return C(!0),V(null),WE({agentId:s,path:m}).then(_e=>{H||N(_e)}).catch(_e=>{H||(V(_e instanceof Error?_e.message:"目录列表加载失败"),N([]))}).finally(()=>{H||C(!1)}),()=>{H=!0}},[s,m]);const $=Gn({mutationFn:async H=>XE({agentId:s,path:H,projects:t,queryClient:y,bootstrapQueryKey:dt}),onSuccess:H=>{p(H)}}),R=_.useMemo(()=>{const H=new Map;for(const _e of t)H.set(Zf(_e.path),_e);return H},[t]),G=_.useMemo(()=>g?R.get(Zf(g))??null:null,[R,g]),ue=u!=="选择此目录"?u:G?"在线程中继续":"创建新线程",Z=ZE(m),ie=Z!==null||Zx(m),te=()=>{if(Z!==null){x(Z),S(Z);return}Zx(m)&&(x(null),S(null))},Y=H=>{x(H),S(H)};return l.jsx("section",{className:"directory-picker",children:l.jsxs("div",{className:"directory-picker__panel",children:[l.jsx("header",{className:"directory-picker__header",children:l.jsxs("div",{className:"directory-picker__heading",children:[l.jsx("h2",{children:r}),c?l.jsx("p",{children:c}):null]})}),l.jsxs("div",{className:"directory-picker__field",children:[l.jsx("span",{className:"directory-picker__field-label",children:"当前路径"}),l.jsxs("button",{type:"button",className:`directory-picker__path ${g===m?"is-selected":""}`,onClick:()=>{m&&S(m)},disabled:!m,"aria-pressed":g===m,children:[l.jsx("span",{className:"directory-picker__path-icon",children:l.jsx(Yx,{})}),l.jsx("span",{className:"directory-picker__path-value",children:m??"根目录"})]})]}),l.jsxs("div",{className:"directory-picker__field",children:[l.jsx("span",{className:"directory-picker__field-label",children:"目录"}),l.jsx("div",{className:"directory-picker__list",role:"listbox","aria-label":"目录列表",children:T?l.jsx("div",{className:"directory-picker__state",children:"正在读取目录…"}):I?l.jsx("div",{className:"directory-picker__state is-error",children:I}):k.length===0?l.jsx("div",{className:"directory-picker__state",children:"当前目录下没有可用子目录"}):k.map(H=>{const _e=g===H.path;return l.jsx("div",{className:`directory-picker__row ${_e?"is-selected":""}`,children:l.jsxs("button",{type:"button",className:"directory-picker__row-main",onClick:je=>{const ae=je.target;if(H.has_children&&ae.closest('[data-enter-directory="true"]')){Y(H.path);return}S(H.path)},onDoubleClick:()=>{H.has_children&&Y(H.path)},"aria-selected":_e,children:[l.jsx("span",{className:"directory-picker__row-icon",children:l.jsx(Yx,{})}),l.jsx("span",{className:"directory-picker__row-name",children:H.name}),H.has_children?l.jsx("span",{className:"directory-picker__row-enter","data-enter-directory":"true","aria-hidden":"true",children:l.jsx(JE,{})}):_e?l.jsx("span",{className:"directory-picker__row-check",children:l.jsx(eM,{})}):null]})},H.path)})})]}),$.error?l.jsx("div",{className:"directory-picker__feedback is-error",role:"status","aria-live":"polite",children:$.error instanceof Error?$.error.message:"创建线程失败"}):null,l.jsx("footer",{className:"directory-picker__footer",children:l.jsxs("div",{className:"directory-picker__footer-actions",children:[ie?l.jsx("button",{type:"button",className:"directory-picker__secondary",onClick:te,children:l.jsx("span",{children:h})}):null,l.jsx("button",{type:"button",className:"directory-picker__primary",disabled:!g||$.isPending,onClick:()=>{g&&$.mutate(g)},children:$.isPending?"创建中…":ue})]})})]})})},nM=()=>l.jsx("img",{src:"/icon.svg",alt:"","aria-hidden":"true",className:"new-thread-hero__logo"}),sM=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"m15 18-6-6 6-6"})}),aM=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"m9 18 6-6-6-6"})}),Wx=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("circle",{cx:"12",cy:"12",r:"8.5"}),l.jsx("path",{d:"M12 10.4v4.2"}),l.jsx("path",{d:"M12 7.9h.01"})]}),iM=(s,t)=>{var a;return((a=s[t])==null?void 0:a.trim())??""},Xx=()=>typeof window<"u"&&!window.matchMedia("(max-width: 768px)").matches,rM=_.memo(function({requests:t,hasStripBelow:a,pendingRequestId:r,onRespond:c}){const u=t[0]??null,[h,p]=_.useState(null),[y,m]=_.useState(""),[x,g]=_.useState({}),[S,k]=_.useState(0),[N,T]=_.useState(null),[C,I]=_.useState(null);_.useEffect(()=>{p(null),m(""),g({}),k(0),T(null),I(null)},[u==null?void 0:u.id]);const V=u?r===u.id:!1,$=(u==null?void 0:u.kind)==="user_input",R=$&&u.questions.length>0?u.questions[Math.max(0,Math.min(S,u.questions.length-1))]??null:null,G=R?iM(x,R.id):"",ue=R?R.options.some(ae=>ae.label===G):!1,Z=!!(R&&G&&(!ue||N===R.id));_.useEffect(()=>{if(!R){T(null);return}if(ue){T(null);return}G&&T(R.id)},[ue,R,G]);const ie=_.useMemo(()=>!u||V?!1:u.kind==="user_input"?R?!!G:!1:h?!0:u.allow_freeform?!!y.trim():!1,[R,G,u,y,V,h]);if(!u)return null;const te=u.questions.reduce((ae,ce)=>ae+ce.options.length,u.options.length),Y=ae=>{V||c({requestId:u.id,optionId:(ae==null?void 0:ae.optionId)??h,text:(ae==null?void 0:ae.text)??y,answers:(ae==null?void 0:ae.answers)??x})},H=()=>{if(!(!u||u.kind!=="user_input"||!R)){if(S<u.questions.length-1){k(ae=>Math.min(ae+1,u.questions.length-1));return}Y()}},_e=()=>{if(!u||u.kind!=="user_input"||!R)return;const ae={...x,[R.id]:"忽略"};if(g(ae),T(null),S<u.questions.length-1){k(ce=>Math.min(ce+1,u.questions.length-1));return}Y({answers:ae})},je=ae=>{if(!(!u||u.kind!=="user_input"||!R||V)){if(G===ae){H();return}g(ce=>({...ce,[R.id]:ae})),T(null)}};return l.jsx("section",{className:`session-interaction-strip ${a?"has-strip-below":""} ${$?"is-user-input-flow":""}`,children:u.kind==="user_input"&&R?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"session-interaction-flow__header",children:[l.jsx("div",{className:"session-interaction-flow__prompt",children:R.question}),l.jsxs("div",{className:"session-interaction-flow__progress",children:[l.jsx("button",{type:"button",className:"session-interaction-flow__nav","aria-label":"上一题",disabled:S===0||V,onClick:()=>k(ae=>Math.max(0,ae-1)),children:l.jsx(sM,{})}),l.jsxs("span",{className:"session-interaction-flow__counter",children:[S+1," / ",u.questions.length]}),l.jsx("button",{type:"button",className:"session-interaction-flow__nav","aria-label":S===u.questions.length-1?"提交回复":"下一题",disabled:V||!ie,onClick:H,children:l.jsx(aM,{})})]})]}),l.jsx("div",{className:"session-interaction-flow__body",children:l.jsxs("div",{className:"session-interaction-flow__list",children:[R.options.map((ae,ce)=>l.jsxs("div",{className:`session-interaction-flow__item is-${ae.emphasis} ${G===ae.label?"is-active":""}`,role:"button",tabIndex:V?-1:0,"aria-pressed":G===ae.label,onClick:()=>je(ae.label),onKeyDown:E=>{E.key==="Enter"&&Xx()&&(E.preventDefault(),je(ae.label))},children:[l.jsxs("span",{className:"session-interaction-flow__item-index",children:[ce+1,"."]}),l.jsxs("span",{className:"session-interaction-flow__item-choice",children:[l.jsx("span",{className:"session-interaction-flow__item-label",children:ae.label}),ae.description?l.jsxs("span",{className:"session-interaction-flow__tooltip-wrap",children:[l.jsx("button",{type:"button",className:"session-interaction-flow__tooltip-trigger","aria-label":`查看 ${ae.label} 的说明`,"aria-expanded":C===ae.id,onMouseEnter:()=>I(ae.id),onMouseLeave:()=>I(E=>E===ae.id?null:E),onBlur:()=>I(E=>E===ae.id?null:E),onClick:E=>{E.stopPropagation(),I(U=>U===ae.id?null:ae.id)},children:l.jsx(Wx,{})}),l.jsx("div",{className:`session-interaction-flow__tooltip ${C===ae.id?"is-visible":""}`,role:"tooltip",children:ae.description})]}):null]})]},ae.id)),l.jsx("div",{className:`session-interaction-flow__item is-custom ${Z?"is-active":""}`,children:l.jsxs("div",{className:"session-interaction-flow__custom-input-wrap",children:[l.jsx("input",{type:"text",className:"session-interaction-flow__custom-input",value:ue?"":G,disabled:V,placeholder:R.is_secret?"输入敏感信息":"否,请告知如何调整",onFocus:()=>{T(R.id),ue&&g(ae=>({...ae,[R.id]:""}))},onKeyDown:ae=>{ae.key==="Enter"&&ie&&!V&&Xx()&&(ae.preventDefault(),H())},onChange:ae=>{T(R.id),g(ce=>({...ce,[R.id]:ae.target.value}))}}),l.jsxs("div",{className:"session-interaction-flow__inline-actions",children:[l.jsx("button",{type:"button",className:"session-interaction-flow__ghost",disabled:V,onClick:_e,children:"忽略"}),l.jsx("button",{type:"button",className:"session-interaction-flow__primary",disabled:!ie,onClick:H,children:V?"提交中...":S===u.questions.length-1?u.submit_label??"提交回复":"继续"})]})]})})]})})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"session-interaction-strip__header",children:[l.jsx("span",{className:"session-interaction-strip__icon","aria-hidden":"true",children:l.jsx(Wx,{})}),l.jsxs("div",{className:"session-interaction-strip__copy",children:[l.jsxs("div",{className:"session-interaction-strip__title",children:[u.title,t.length>1?l.jsxs("span",{className:"session-interaction-strip__count",children:["还有 ",t.length-1," 个待处理"]}):null]}),u.description?l.jsx("div",{className:"session-interaction-strip__description",children:u.description}):null]})]}),u.options.length>0?l.jsx("div",{className:"session-interaction-strip__options",children:u.options.map(ae=>l.jsxs("button",{type:"button",className:`session-interaction-option is-${ae.emphasis} ${h===ae.id?"is-active":""}`,disabled:V,onClick:()=>{p(ae.id),!u.allow_freeform&&te<=3&&Y({optionId:ae.id})},children:[l.jsx("span",{className:"session-interaction-option__label",children:ae.label}),ae.description?l.jsx("span",{className:"session-interaction-option__description",children:ae.description}):null]},ae.id))}):null,u.allow_freeform?l.jsxs("label",{className:"session-interaction-strip__freeform",children:[l.jsx("span",{className:"session-interaction-strip__freeform-label",children:"自定义回复"}),l.jsx("textarea",{value:y,disabled:V,placeholder:u.freeform_placeholder??"输入回复内容",onChange:ae=>m(ae.target.value)})]}):null,u.allow_freeform||u.options.length>3?l.jsx("div",{className:"session-interaction-strip__footer",children:l.jsx("button",{type:"button",className:"session-interaction-strip__submit",disabled:!ie,onClick:()=>Y(),children:V?"提交中...":u.submit_label??"继续"})}):null]})})}),lM=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M6 6l12 12"}),l.jsx("path",{d:"M18 6 6 18"})]}),oM=({panel:s,isPending:t,onDismiss:a,onSelectOption:r,onSubmitText:c})=>{const[u,h]=_.useState("");return _.useEffect(()=>{h("")},[s.panel_id,s.status]),l.jsxs("section",{className:`session-command-panel is-${s.status}`,children:[l.jsxs("div",{className:"session-command-panel__header",children:[l.jsxs("div",{className:"session-command-panel__command",children:["/",s.command_name]}),l.jsx("button",{type:"button",className:"session-command-panel__close","aria-label":"关闭命令面板",onClick:a,children:l.jsx(lM,{})})]}),l.jsx("div",{className:"session-command-panel__title",children:s.title}),s.description?l.jsx("div",{className:"session-command-panel__description",children:s.description}):null,l.jsx("pre",{className:"session-command-panel__body",children:s.body}),s.input_type==="choice"&&s.options.length>0?l.jsx("div",{className:"session-command-panel__options",children:s.options.map(p=>l.jsxs("button",{type:"button",className:"session-command-panel__option",disabled:t,onClick:()=>r(p.id),children:[l.jsx("span",{className:"session-command-panel__option-label",children:p.label}),p.description?l.jsx("span",{className:"session-command-panel__option-description",children:p.description}):null]},p.id))}):null,s.input_type==="text"?l.jsxs("form",{className:"session-command-panel__form",onSubmit:p=>{p.preventDefault(),!(!u.trim()||t)&&c(u.trim())},children:[l.jsx("input",{className:"session-command-panel__input",value:u,disabled:t,placeholder:s.input_placeholder??"继续输入",onChange:p=>h(p.target.value)}),l.jsx("button",{type:"submit",className:"session-command-panel__submit",disabled:t||!u.trim(),children:s.submit_label??"提交"})]}):null]})},cM=_.memo(function({planSnapshot:t,hasStripAbove:a,hasStripBelow:r}){const[c,u]=_.useState(!0);return t.steps.length?l.jsxs("section",{className:`session-plan-strip ${c?"is-collapsed":""} ${a?"has-strip-above":""} ${r?"has-strip-below":""}`,children:[l.jsxs("button",{type:"button",className:"session-plan-strip__toggle",onClick:()=>u(h=>!h),"aria-expanded":!c,children:[l.jsxs("div",{className:"session-plan-strip__summary",children:[l.jsx("span",{className:"session-plan-strip__summary-mark","aria-hidden":"true",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("rect",{x:"4.5",y:"5",width:"15",height:"14",rx:"2.5"}),l.jsx("path",{d:"M8 9h8"}),l.jsx("path",{d:"M8 13h5.5"}),l.jsx("path",{d:"m15.5 14.5 1.5 1.5 2.5-3"})]})}),l.jsx("span",{className:"session-plan-strip__summary-text",children:l.jsxs("span",{children:["共 ",t.total_count," 个任务,已完成 ",t.completed_count," 个"]})})]}),l.jsx("span",{className:"session-plan-strip__chevron","aria-hidden":"true",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"m8 10 4 4 4-4"})})})]}),c?null:l.jsx(l.Fragment,{children:l.jsx("div",{className:"session-plan-strip__steps",children:t.steps.map((h,p)=>l.jsxs("div",{className:`session-plan-step is-${h.status}`,children:[l.jsx("span",{className:"session-plan-step__dot","aria-hidden":"true",children:h.status==="in_progress"?l.jsx("span",{className:"session-plan-step__spinner"}):null}),l.jsxs("span",{className:"session-plan-step__index",children:[p+1,"."]}),l.jsx("span",{className:"session-plan-step__label",children:h.step})]},h.id))})})]}):null}),uM=s=>{const t=(s==null?void 0:s.enabled)??!0;return Es({queryKey:["codex-commands"],enabled:t,queryFn:async()=>(await Xn()).client.getCodexCommands(),staleTime:0,gcTime:30*6e4,refetchOnWindowFocus:!1,retry:1})},dM=(s,t)=>{const a=((t==null?void 0:t.enabled)??!0)&&!!s;return Es({queryKey:["project-skills",s],enabled:a,queryFn:async()=>s?(await Xn({projectId:s})).client.getProjectSkills(s):[],staleTime:6e4,gcTime:10*6e4,refetchOnWindowFocus:!1,retry:1})},Jx=24,fM=s=>{const t=w1(s);return t.length===0?l.jsx("span",{children:" "}):t.map((a,r)=>{const c=`skill-aware-token-${r}`;return a.kind==="skill"?l.jsx("span",{className:"skill-aware-textarea__token is-skill",children:a.raw},c):a.kind==="command"?l.jsx("span",{className:"skill-aware-textarea__token is-command",children:a.raw},c):a.kind==="code"?l.jsx("span",{className:"skill-aware-textarea__token is-code",children:a.value},c):a.kind==="path-link"?l.jsx("span",{className:"skill-aware-textarea__token is-link",children:a.label},c):l.jsx("span",{children:a.value},c)})},e0=({value:s,onChange:t,onKeyDown:a,placeholder:r,disabled:c=!1,className:u,projectId:h,autoFocus:p=!1})=>{var U;const y=u.includes("composer-fullscreen-sheet__input"),m=_.useRef(null),x=_.useRef(null),[g,S]=_.useState({start:0,end:0}),[k,N]=_.useState(!1),[T,C]=_.useState(!1),[I,V]=_.useState(0),$=_.useMemo(()=>k1(s,g.start,g.end),[g.end,g.start,s]),R=_.useMemo(()=>N1(s,g.start,g.end),[g.end,g.start,s]),G=k&&!c&&!!$&&!T,ue=k&&!c&&!!R&&!T,Z=ue?"command":G?"skill":null,ie=dM(h,{enabled:G}),te=uM({enabled:ue}),Y=_.useMemo(()=>FE(ie.data??[],($==null?void 0:$.query)??"").slice(0,Jx),[$==null?void 0:$.query,ie.data]),H=_.useMemo(()=>{var ee;return QE(((ee=te.data)==null?void 0:ee.commands)??[],(R==null?void 0:R.query)??"").slice(0,Jx)},[R==null?void 0:R.query,(U=te.data)==null?void 0:U.commands]);_.useEffect(()=>{V(0)},[$==null?void 0:$.query,$==null?void 0:$.start,R==null?void 0:R.query,s,h]),_.useEffect(()=>{C(!1)},[$==null?void 0:$.query,$==null?void 0:$.start,$==null?void 0:$.end,R==null?void 0:R.query,R==null?void 0:R.start,R==null?void 0:R.end]);const _e=()=>{!m.current||!x.current||(x.current.scrollTop=m.current.scrollTop,x.current.scrollLeft=m.current.scrollLeft)},je=()=>{m.current&&S({start:m.current.selectionStart??0,end:m.current.selectionEnd??0})},ae=ee=>{if(!m.current)return;const W=$E(s,m.current.selectionStart??g.start,m.current.selectionEnd??g.end,ee.name);W&&(t(W.value),typeof window<"u"&&window.requestAnimationFrame(()=>{m.current&&(m.current.focus(),m.current.setSelectionRange(W.selectionStart,W.selectionEnd),S({start:W.selectionStart,end:W.selectionEnd}))}))},ce=ee=>{if(!m.current)return;const W=HE(s,m.current.selectionStart??g.start,m.current.selectionEnd??g.end,ee.name);W&&(t(W.value),typeof window<"u"&&window.requestAnimationFrame(()=>{m.current&&(m.current.focus(),m.current.setSelectionRange(W.selectionStart,W.selectionEnd),S({start:W.selectionStart,end:W.selectionEnd}))}))},E=ee=>{const W=Z==="skill"&&Y.length>0||Z==="command"&&H.length>0;if(Z&&W){if(ee.key==="ArrowDown"){ee.preventDefault();const xe=Z==="command"?H.length:Y.length;V(A=>(A+1)%xe);return}if(ee.key==="ArrowUp"){ee.preventDefault();const xe=Z==="command"?H.length:Y.length;V(A=>A-1<0?xe-1:A-1);return}if((ee.key==="Enter"||ee.key==="Tab")&&!ee.shiftKey&&!ee.altKey&&!ee.ctrlKey&&!ee.metaKey){if(ee.preventDefault(),Z==="command"){const A=H[I]??H[0];if(!A)return;ce(A);return}const xe=Y[I]??Y[0];if(!xe)return;ae(xe);return}}if(Z&&ee.key==="Escape"){ee.preventDefault(),C(!0);return}a==null||a(ee)};return l.jsxs("div",{className:`skill-aware-textarea ${Z?"is-picker-open":""} ${y?"is-fullscreen":""}`,children:[ue?l.jsx("div",{className:"skill-mention-picker",role:"listbox","aria-label":"命令建议",children:te.isLoading?l.jsx("div",{className:"skill-mention-picker__empty",children:"正在加载命令…"}):te.isError?l.jsx("div",{className:"skill-mention-picker__empty",children:"命令列表加载失败"}):H.length===0?l.jsx("div",{className:"skill-mention-picker__empty",children:"未找到匹配命令"}):H.map((ee,W)=>{const xe=W===I;return l.jsx("button",{type:"button",className:`skill-mention-picker__item ${xe?"is-active":""}`,role:"option","aria-selected":xe,onMouseDown:A=>{A.preventDefault(),ce(ee)},onMouseEnter:()=>V(W),children:l.jsxs("span",{className:"skill-mention-picker__main",children:[l.jsxs("span",{className:"skill-mention-picker__name",children:["/",ee.name]}),l.jsx("span",{className:"skill-mention-picker__description",children:ee.description})]})},ee.name)})}):G?l.jsx("div",{className:"skill-mention-picker",role:"listbox","aria-label":"技能建议",children:ie.isLoading?l.jsx("div",{className:"skill-mention-picker__empty",children:"正在加载技能…"}):ie.isError?l.jsx("div",{className:"skill-mention-picker__empty",children:"技能列表加载失败"}):Y.length===0?l.jsx("div",{className:"skill-mention-picker__empty",children:"未找到匹配技能"}):Y.map((ee,W)=>{const xe=W===I;return l.jsx("button",{type:"button",className:`skill-mention-picker__item ${xe?"is-active":""}`,role:"option","aria-selected":xe,onMouseDown:A=>{A.preventDefault(),ae(ee)},onMouseEnter:()=>V(W),children:l.jsxs("span",{className:"skill-mention-picker__main",children:[l.jsxs("span",{className:"skill-mention-picker__name",children:["$",ee.name]}),l.jsx("span",{className:"skill-mention-picker__description",children:ee.description}),l.jsx("span",{className:"skill-mention-picker__scope",children:qE(ee.scope)})]})},`${ee.scope}:${ee.name}:${ee.path}`)})}):null,l.jsxs("div",{className:"skill-aware-textarea__surface",children:[l.jsx("div",{ref:x,className:`${u} skill-aware-textarea__overlay`,"aria-hidden":"true",children:s?fM(s):l.jsx("span",{children:" "})}),l.jsx("textarea",{ref:m,className:`${u} skill-aware-textarea__input`,value:s,disabled:c,placeholder:r,autoFocus:p,onChange:ee=>{t(ee.target.value),C(!1),S({start:ee.target.selectionStart??0,end:ee.target.selectionEnd??0})},onKeyDown:E,onClick:je,onSelect:je,onKeyUp:je,onFocus:()=>{N(!0),C(!1),je()},onBlur:()=>{N(!1)},onScroll:_e})]})]})},Op=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M6 6l12 12"}),l.jsx("path",{d:"M18 6 6 18"})]}),hM=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M12 5v14"}),l.jsx("path",{d:"m7 14 5 5 5-5"})]}),mM=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M8 3H4v4"}),l.jsx("path",{d:"M16 3h4v4"}),l.jsx("path",{d:"M8 21H4v-4"}),l.jsx("path",{d:"M16 21h4v-4"}),l.jsx("path",{d:"M9 9 4 4"}),l.jsx("path",{d:"m15 9 5-5"}),l.jsx("path",{d:"m9 15-5 5"}),l.jsx("path",{d:"m15 15 5 5"})]}),pM=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M12 5v14"}),l.jsx("path",{d:"M5 12h14"})]}),t0=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"M13 2 5.5 13h5L9 22l9.5-13h-5L13 2Z"})}),n0=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M9 6h10"}),l.jsx("path",{d:"M9 12h10"}),l.jsx("path",{d:"M9 18h10"}),l.jsx("path",{d:"m4 6 1.5 1.5L7.5 5"}),l.jsx("path",{d:"m4 12 1.5 1.5L7.5 11"}),l.jsx("path",{d:"m4 18 1.5 1.5L7.5 17"})]}),gM=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M12 16V5"}),l.jsx("path",{d:"m8 9 4-4 4 4"}),l.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"})]}),C1=_.memo(function({isDesktopSidebar:t,sidebarShift:a,isSidebarDragging:r,composerError:c,onDismissComposerError:u,interactionRequests:h,pendingInteractionRequestId:p,onRespondInteraction:y,parentSession:m,backgroundAgentSessions:x,isBackgroundAgentsOpen:g,planSnapshot:S,onToggleBackgroundAgents:k,onOpenSession:N,getBackgroundAgentStatusLabel:T,getBackgroundAgentAccent:C,formatBackgroundAgentsLabel:I,hasBackgroundAgentStrip:V,commandPanel:$,isCommandPanelPending:R,onDismissCommandPanel:G,onCommandPanelOptionSelect:ue,onCommandPanelTextSubmit:Z,projectId:ie=null,draft:te,pendingAttachments:Y,canSendInput:H,isInputLocked:_e=!1,inputPlaceholder:je,readOnlyPlaceholder:ae,onDraftChange:ce,onUploadFiles:E,onRemoveAttachment:U,onSubmit:ee,showStopIcon:W,isSendPending:xe,onInterrupt:A,isFastModeEnabled:ne,isPlanModeEnabled:be,onToggleFastMode:Q,onTogglePlanMode:pe,showModeBadges:Ce=!1,selectedModel:Le,modelOptions:he=[],selectedReasoning:q,onSelectModel:Se,onSelectReasoning:Ne,contextUsage:me,isContextUsageOpen:Te,onToggleContextUsage:Ge,contextUsageRingStyle:Ue,usedPercent:gt,remainingPercent:Lt,usedTokensLabel:St,totalTokensLabel:st,showJumpToBottom:tn,onJumpToBottom:$t}){const de=_.useId(),[Ae,Re]=_.useState(!1),[Oe,Ke]=_.useState(null),mt=_.useRef(null),kt=_.useRef(null),rn=h[0]??null,Bn=(rn==null?void 0:rn.kind)==="user_input",On=h.length>0,nn=!!S&&!Bn,ln=!Bn&&V,oe=nn||ln,qe=On||nn||ln,De={transform:`translateX(${a}px)`,transition:r?"none":void 0},Ie=(!!te.trim()||Y.length>0)&&H&&!_e&&!xe&&!W,We=H&&!_e,$e=()=>{Ie&&(Ke(null),ee())},He=Ee=>{Ee.key!=="Enter"||Ee.shiftKey||Ee.altKey||Ee.ctrlKey||Ee.metaKey||Ee.nativeEvent.isComposing||typeof window<"u"&&window.matchMedia("(max-width: 768px)").matches||(Ee.preventDefault(),$e())};return _.useEffect(()=>{if(!Ae)return;const Ee=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=Ee}},[Ae]),_.useEffect(()=>{if(!Ae||typeof window>"u")return;const Ee=window.matchMedia("(min-width: 769px)"),Ut=()=>{Ee.matches&&Re(!1)};return Ut(),typeof Ee.addEventListener=="function"?(Ee.addEventListener("change",Ut),()=>{Ee.removeEventListener("change",Ut)}):(Ee.addListener(Ut),()=>{Ee.removeListener(Ut)})},[Ae]),_.useEffect(()=>{if(!Oe)return;const Ee=at=>{const pn=at.target;mt.current&&pn instanceof Node&&mt.current.contains(pn)||Ke(null)},Ut=at=>{at.key==="Escape"&&Ke(null)};return window.addEventListener("pointerdown",Ee),window.addEventListener("keydown",Ut),()=>{window.removeEventListener("pointerdown",Ee),window.removeEventListener("keydown",Ut)}},[Oe]),l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:`composer-wrap ${t?"has-desktop-sidebar":""}`,style:De,children:[c?l.jsxs("div",{className:"composer-alert",role:"status","aria-live":"polite",children:[l.jsx("span",{className:"composer-alert__text",children:c}),l.jsx("button",{type:"button",className:"composer-alert__close",onClick:u,"aria-label":"关闭错误提示",children:l.jsx(Op,{})})]}):null,On?l.jsx(rM,{requests:h,hasStripBelow:oe,pendingRequestId:p,onRespond:y}):null,nn&&S?l.jsx(cM,{planSnapshot:S,hasStripAbove:On,hasStripBelow:ln}):null,ln&&m?l.jsxs("button",{type:"button",className:`background-agents-exit ${On||nn?"has-strip-above":""}`,onClick:()=>{N(m.id)},children:[l.jsx("span",{className:"background-agents-exit__icon","aria-hidden":"true",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M6 12h12"}),l.jsx("path",{d:"m13 7 5 5-5 5"})]})}),l.jsx("span",{children:"返回主会话"})]}):ln&&x.length>0?l.jsxs("section",{className:`background-agents-card ${g?"is-open":""} ${On||nn?"has-strip-above":""}`,children:[l.jsxs("button",{type:"button",className:"background-agents-card__toggle",onClick:k,"aria-expanded":g,children:[l.jsx("span",{className:"background-agents-card__icon","aria-hidden":"true",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("rect",{x:"7",y:"4",width:"10",height:"7",rx:"2.5"}),l.jsx("path",{d:"M12 11v3"}),l.jsx("circle",{cx:"10",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"14",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"}),l.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"})]})}),l.jsxs("span",{className:"background-agents-card__summary",children:[l.jsx("span",{className:"background-agents-card__title",children:I(x.length)}),g?l.jsx("span",{className:"background-agents-card__hint",children:"(@ to tag agents)"}):null]}),l.jsx("span",{className:"background-agents-card__chevron","aria-hidden":"true",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"m8 10 4 4 4-4"})})})]}),g?l.jsx("div",{className:"background-agents-card__list",children:x.map(Ee=>{var Ut,at;return l.jsxs("button",{type:"button",className:`background-agent-row ${Ee.run_state==="running"?"is-running":"is-idle"}`,style:{"--agent-accent":C(Ee)},onClick:()=>{N(Ee.id)},children:[l.jsx("span",{className:"background-agent-row__accent","aria-hidden":"true"}),l.jsxs("span",{className:"background-agent-row__meta",children:[l.jsxs("span",{className:"background-agent-row__title",children:[l.jsx("span",{className:"background-agent-row__name",children:((Ut=Ee.subagent)==null?void 0:Ut.nickname)??Ee.title}),l.jsxs("span",{className:"background-agent-row__role",children:["(",((at=Ee.subagent)==null?void 0:at.role)??"agent",")"]})]}),l.jsx("span",{className:"background-agent-row__status",children:T(Ee)})]}),l.jsx("span",{className:"background-agent-row__open",children:"Open"})]},Ee.id)})}):null]}):null,$?l.jsx(oM,{panel:$,isPending:R,onDismiss:G,onSelectOption:ue,onSubmitText:Z}):null,Bn?null:l.jsxs("form",{className:`chat-composer ${qe?"is-attached-to-agent-strip":""}`,onSubmit:Ee=>{Ee.preventDefault(),$e()},children:[l.jsxs("div",{className:"chat-composer__editor",children:[Y.length>0?l.jsx("div",{className:"chat-composer__attachments",children:Y.map(Ee=>{const Ut=bg(Ee.size_bytes);return l.jsxs("div",{className:"chat-composer__attachment-chip",children:[l.jsxs("div",{className:"chat-composer__attachment-copy",children:[l.jsx("span",{className:"chat-composer__attachment-name",children:Ee.name}),l.jsxs("span",{className:"chat-composer__attachment-meta",children:[Ee.kind==="image"?"图片":"文件",Ut?` · ${Ut}`:""]})]}),l.jsx("button",{type:"button",className:"chat-composer__attachment-remove","aria-label":`移除 ${Ee.name}`,onClick:()=>U(Ee.id),children:l.jsx(Op,{})})]},Ee.id)})}):null,l.jsx(e0,{className:"chat-composer__input",value:te,disabled:!We,projectId:ie,placeholder:We?je??"要求后续变更":ae??"当前会话为只读模式",onChange:ce,onKeyDown:He}),l.jsx("button",{type:"button",className:"composer-fullscreen-toggle","aria-label":"全屏编辑",onClick:()=>Re(!0),children:l.jsx(mM,{})}),l.jsx("input",{id:de,ref:kt,type:"file",className:"chat-composer__file-input",multiple:!0,onChange:Ee=>{Ee.target.files&&Ee.target.files.length>0&&E(Ee.target.files),Ee.target.value=""}})]}),l.jsxs("div",{className:"chat-composer__toolbar",children:[l.jsxs("div",{ref:mt,className:"chat-composer__controls",children:[l.jsxs("div",{className:`composer-utility-menu ${Oe==="utility"?"is-open":""}`,children:[l.jsx("button",{type:"button",className:"composer-utility-menu__trigger","aria-label":"打开额外功能","aria-expanded":Oe==="utility",onClick:()=>Ke(Ee=>Ee==="utility"?null:"utility"),children:l.jsx(pM,{})}),Oe==="utility"?l.jsxs("div",{className:"composer-utility-menu__popover",role:"menu",children:[l.jsxs("button",{type:"button",className:"composer-utility-menu__item",role:"menuitem",onClick:()=>{var Ee;Ke(null),(Ee=kt.current)==null||Ee.click()},children:[l.jsx("span",{className:"composer-utility-menu__item-icon","aria-hidden":"true",children:l.jsx(gM,{})}),l.jsx("span",{className:"composer-utility-menu__item-label",children:"上传文件"})]}),l.jsxs("button",{type:"button",className:"composer-utility-menu__item",role:"menuitemcheckbox","aria-checked":ne,onClick:Q,children:[l.jsx("span",{className:"composer-utility-menu__item-icon","aria-hidden":"true",children:l.jsx(t0,{})}),l.jsx("span",{className:"composer-utility-menu__item-label",children:"Fast 模式"}),l.jsx("span",{className:`composer-utility-menu__switch ${ne?"is-on":""}`,"aria-hidden":"true",children:l.jsx("span",{className:"composer-utility-menu__switch-thumb"})})]}),l.jsxs("button",{type:"button",className:"composer-utility-menu__item",role:"menuitemcheckbox","aria-checked":be,onClick:pe,children:[l.jsx("span",{className:"composer-utility-menu__item-icon","aria-hidden":"true",children:l.jsx(n0,{})}),l.jsx("span",{className:"composer-utility-menu__item-label",children:"计划模式"}),l.jsx("span",{className:`composer-utility-menu__switch ${be?"is-on":""}`,"aria-hidden":"true",children:l.jsx("span",{className:"composer-utility-menu__switch-thumb"})})]})]}):null]}),l.jsxs("div",{className:`composer-choice ${Oe==="model"?"is-open":""}`,children:[l.jsxs("button",{type:"button",className:"composer-control","aria-label":"选择模型","aria-expanded":Oe==="model",onClick:()=>Ke(Ee=>Ee==="model"?null:"model"),children:[l.jsx("span",{className:"composer-icon",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M12 3 4 7v10l8 4 8-4V7z"}),l.jsx("path",{d:"m4 7 8 4 8-4"}),l.jsx("path",{d:"M12 11v10"})]})}),l.jsx("span",{className:"composer-control__value",children:Yf(Le,he)})]}),Oe==="model"?l.jsx("div",{className:"composer-choice-menu",role:"menu","aria-label":"选择模型",children:he.map(Ee=>l.jsxs("button",{type:"button",className:`composer-choice-menu__item ${Le===Ee.value?"is-active":""}`,role:"menuitemradio","aria-checked":Le===Ee.value,onClick:()=>{Se(Ee.value),Ke(null)},children:[l.jsx("span",{className:"composer-choice-menu__text",children:l.jsx("span",{className:"composer-choice-menu__label",children:Ee.label})}),Le===Ee.value?l.jsx("span",{className:"composer-choice-menu__check",children:"✓"}):null]},Ee.value))}):null]}),l.jsxs("div",{className:`composer-choice ${Oe==="reasoning"?"is-open":""}`,children:[l.jsxs("button",{type:"button",className:"composer-control","aria-label":"选择推理强度","aria-expanded":Oe==="reasoning",onClick:()=>Ke(Ee=>Ee==="reasoning"?null:"reasoning"),children:[l.jsx("span",{className:"composer-icon",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[l.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"}),l.jsx("path",{d:"M10 21h4"}),l.jsx("path",{d:"M9 18h6"})]})}),l.jsx("span",{className:"composer-control__value",children:DE(q)})]}),Oe==="reasoning"?l.jsx("div",{className:"composer-choice-menu",role:"menu","aria-label":"选择推理强度",children:Au.map(Ee=>l.jsxs("button",{type:"button",className:`composer-choice-menu__item ${q===Ee.value?"is-active":""}`,role:"menuitemradio","aria-checked":q===Ee.value,onClick:()=>{Ne(Ee.value),Ke(null)},children:[l.jsx("span",{className:"composer-choice-menu__label",children:Ee.label}),q===Ee.value?l.jsx("span",{className:"composer-choice-menu__check",children:"✓"}):null]},Ee.value))}):null]}),Ce&&(ne||be)?l.jsxs("div",{className:"composer-mode-badges","aria-label":"当前已启用的会话模式",children:[ne?l.jsxs("button",{type:"button",className:"composer-mode-badge is-fast",onClick:()=>{Ke(null),Q()},"aria-label":"关闭 Fast 模式",children:[l.jsx("span",{className:"composer-mode-badge__icon","aria-hidden":"true",children:l.jsx(t0,{})}),l.jsx("span",{className:"composer-mode-badge__label",children:"Fast"})]}):null,be?l.jsxs("button",{type:"button",className:"composer-mode-badge is-plan",onClick:()=>{Ke(null),pe()},"aria-label":"关闭计划模式",children:[l.jsx("span",{className:"composer-mode-badge__icon","aria-hidden":"true",children:l.jsx(n0,{})}),l.jsx("span",{className:"composer-mode-badge__label",children:"计划"})]}):null]}):null]}),l.jsxs("div",{className:"chat-composer__actions",children:[me?l.jsxs("div",{className:`composer-context ${Te?"is-open":""}`,children:[l.jsx("button",{type:"button",className:"composer-context__trigger","aria-label":"查看背景信息窗口使用情况",onClick:Ee=>{Ee.stopPropagation(),Ge()},children:l.jsx("span",{className:"composer-context__ring",style:Ue,children:l.jsx("span",{className:"composer-context__ring-core"})})}),Te?l.jsxs("div",{className:"composer-context__popover",role:"tooltip",children:[l.jsx("div",{className:"composer-context__title",children:"背景信息窗口:"}),l.jsxs("div",{children:[gt,"% 已用(剩余 ",Lt,"%)"]}),l.jsxs("div",{children:["已用 ",St,",共 ",st]})]}):null]}):null,l.jsx("button",{type:W?"button":"submit",className:"composer-send",disabled:W?!H:!Ie,"aria-label":W?"中断":"发送",onClick:()=>{W&&A()},children:W?l.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:l.jsx("rect",{x:"7",y:"7",width:"10",height:"10",rx:"2.5"})}):l.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:l.jsx("path",{d:"M12 17V7m0 0-4 4m4-4 4 4",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]})]})]}),Ae?l.jsx("div",{className:"composer-fullscreen-sheet",role:"dialog","aria-modal":"true","aria-label":"全屏编辑",children:l.jsxs("div",{className:"composer-fullscreen-sheet__panel",children:[l.jsxs("div",{className:"composer-fullscreen-sheet__header",children:[l.jsx("div",{className:"composer-fullscreen-sheet__title",children:"全屏编辑"}),l.jsx("button",{type:"button",className:"composer-fullscreen-sheet__close","aria-label":"退出全屏编辑",onClick:()=>Re(!1),children:l.jsx(Op,{})})]}),l.jsx(e0,{className:"composer-fullscreen-sheet__input",value:te,disabled:!We,projectId:ie,placeholder:We?je??"要求后续变更":ae??"当前会话为只读模式",onChange:ce,onKeyDown:He,autoFocus:!0}),l.jsxs("div",{className:"composer-fullscreen-sheet__footer",children:[l.jsxs("div",{className:"composer-fullscreen-sheet__meta",children:[l.jsx("span",{children:Le}),l.jsx("span",{children:q}),Y.length>0?l.jsxs("span",{children:[Y.length," 个附件"]}):null]}),l.jsxs("div",{className:"composer-fullscreen-sheet__actions",children:[l.jsx("button",{type:"button",className:"composer-fullscreen-sheet__button",onClick:()=>Re(!1),children:"关闭"}),W?l.jsx("button",{type:"button",className:"composer-fullscreen-sheet__button is-primary",disabled:!H,onClick:A,children:"中断"}):l.jsx("button",{type:"button",className:"composer-fullscreen-sheet__button is-primary",disabled:!Ie,onClick:()=>{$e(),Re(!1)},children:"发送"})]})]})]})}):null,tn?l.jsx("button",{type:"button",className:`conversation-jump-bottom ${t?"has-desktop-sidebar":""}`,style:De,onClick:$t,"aria-label":"滚动到最下面",children:l.jsx(hM,{})}):null]})}),s0=10,yM=s=>{const t=s.replace(/\s+/g," ").trim();return t.length<=s0?t:t.slice(0,s0).trimEnd()},vM=(s,t)=>{var r,c;const a=yM(s);return a||((c=(r=t[0])==null?void 0:r.name)==null?void 0:c.trim())||"附件"},_M=s=>{var a;const t=/^\/([A-Za-z][A-Za-z0-9._-]*)/.exec(s.trim());return((a=t==null?void 0:t[1])==null?void 0:a.toLowerCase())??""},bM=({currentAgent:s,projects:t,sessions:a,initialProjectId:r=null,entryView:c,isDesktopSidebar:u,sidebarOffset:h,isSidebarDragging:p,onOpenSidebar:y,onProjectSelected:m,onSessionCreated:x})=>{const g=Tl(),[S,k]=_.useState(""),[N,T]=_.useState(r),[C,I]=_.useState(null),[V,$]=_.useState(null),[R,G]=_.useState(()=>ry()),[ue,Z]=_.useState(()=>y1()),[ie,te]=_.useState([]),[Y,H]=_.useState(!1),[_e,je]=_.useState(!1),[ae,ce]=_.useState(c),E=oy(),U=_.useMemo(()=>E.map(({id:Q,...pe})=>pe),[E]),ee=_.useMemo(()=>t.find(Q=>Q.id===N)??t[0]??null,[t,N]);_.useEffect(()=>{_u(R)},[R]),_.useEffect(()=>{v1(ue)},[ue]),_.useEffect(()=>{U.length!==0&&(U.some(Q=>Q.value===R)||G(U[0].value))},[U,R]),_.useEffect(()=>{ce(c)},[c]),_.useEffect(()=>{$(null)},[N]),_.useEffect(()=>{var pe,Ce;if(N&&t.some(Le=>Le.id===N))return;const Q=(r&&t.some(Le=>Le.id===r)?r:null)??((pe=a.find(Le=>!Le.archived))==null?void 0:pe.project_id)??((Ce=t[0])==null?void 0:Ce.id)??null;T(Q)},[r,t,N,a]),_.useEffect(()=>{t.length===0&&ce("directory-picker")},[t.length]);const W=Gn({mutationFn:async Q=>{if(!ee||!Q.input.trim()&&Q.attachments.length===0)throw new Error("请先选择线程,再输入第一条消息");return(await(await Xn({projectId:Q.projectId,agentId:s.id})).client.createSession({agentId:s.id,projectId:Q.projectId,title:Q.title,input:Q.input,attachments:Q.attachments,model:Q.model,reasoningEffort:Q.reasoningEffort,serviceTier:Q.serviceTier,planMode:Q.planMode})).session},onMutate:()=>I(null),onSuccess:async(Q,pe)=>{const Ce={id:`optimistic-user:${Q.id}:create`,kind:"user",title:"你",body:pe.input,timestamp:Q.last_event_at,accent:"primary",attachments:j1(pe.attachments)};xr(s.id),ds(Q.id),AE(Q.id,{isFastModeEnabled:pe.serviceTier==="fast",isPlanModeEnabled:pe.planMode}),Mu(null),Eo(null),g.setQueryData(dt,Le=>UT(Le,Q)),g.setQueryData(ir(Q.id),Le=>r1(Le,Ce)),H(!1),je(!1),x(Q.id),g.invalidateQueries({queryKey:["plan",Q.id]}),g.invalidateQueries({queryKey:["change-sets",Q.id]})},onError:Q=>{I(Q instanceof Error?Q.message:"创建会话失败")}}),xe=(ee==null?void 0:ee.path)??null,A=ae==="directory-picker",ne={transform:`translateX(${h}px)`,transition:p?"none":void 0},be=()=>{const Q=S.trim();if(!(!Q&&ie.length===0||W.isPending||!ee)){if(ly(Q)){if(ie.length>0){I("命令暂不支持附件,请先移除附件后再执行。");return}const pe=_M(Q);if(pe==="model"){if(k(""),U.length>0){$({panel_id:`new-thread-command-${Date.now()}`,session_id:`new-thread:${ee.id}`,command_name:pe,command_text:Q,title:"为新会话选择模型",description:"选择后会更新新会话的默认模型,再继续输入真正的首条消息。",status:"awaiting_input",body:"在下面选择一个模型。",submitted_at:new Date().toISOString(),updated_at:new Date().toISOString(),input_type:"choice",options:U.map(Ce=>({id:Ce.value,label:Ce.label,description:Ce.description??null})),input_placeholder:null,submit_label:null,effect:null});return}$({panel_id:`new-thread-command-${Date.now()}`,session_id:`new-thread:${ee.id}`,command_name:pe,command_text:Q,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(pe==="status"){k(""),$({panel_id:`new-thread-command-${Date.now()}`,session_id:`new-thread:${ee.id}`,command_name:pe,command_text:Q,title:"新会话当前设置",description:"这里展示的是创建下一条会话时会使用的本地设置。",status:"completed",body:[`线程:${ee.display_name??ee.name}`,`模型:${R}`,`推理强度:${ue}`,`Fast 模式:${Y?"开启":"关闭"}`,`计划模式:${_e?"开启":"关闭"}`].join(`
|
|
118
|
+
`),submitted_at:new Date().toISOString(),updated_at:new Date().toISOString(),input_type:"none",options:[],input_placeholder:null,submit_label:null,effect:null});return}k(""),$({panel_id:`new-thread-command-${Date.now()}`,session_id:`new-thread:${ee.id}`,command_name:pe||"unknown",command_text:Q,title:`/${pe||"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}W.mutate({projectId:ee.id,input:Q,title:vM(Q,ie),attachments:ie,model:R,reasoningEffort:ue,serviceTier:Y?"fast":void 0,planMode:_e})}};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:`conversation-main conversation-main--new-thread ${u?"has-desktop-sidebar":""}`,style:ne,children:[l.jsxs("div",{className:"conversation-topbar",children:[u?null:l.jsxs("button",{type:"button",className:"conversation-menu",onClick:y,"aria-label":"打开侧边栏",children:[l.jsx("span",{}),l.jsx("span",{className:"short"})]}),l.jsx("div",{className:"conversation-topbar__meta",children:l.jsx("div",{className:"conversation-topbar__title-row",children:l.jsx("h1",{"aria-label":"未命名会话",children:" "})})})]}),l.jsx("div",{className:"conversation-scroll conversation-scroll--empty",children:l.jsx("div",{className:"conversation-thread conversation-thread--empty",children:A?l.jsx(tM,{agentId:s.id,projects:t,title:"选择目录",subtitle:"",onProjectCreated:Q=>{T(Q.id),m(Q.id),ce("composer")}}):l.jsx("section",{className:"new-thread-hero",children:l.jsxs("div",{className:"new-thread-hero__stack",children:[l.jsx(nM,{}),l.jsxs("label",{className:"new-thread-hero__selector",children:[l.jsx("span",{className:"new-thread-hero__selector-label",children:"在线程中发起会话"}),l.jsx("select",{className:"new-thread-hero__select",value:N??"",onChange:Q=>{const pe=Q.target.value||null;T(pe),pe&&m(pe)},children:t.map(Q=>l.jsx("option",{value:Q.id,children:Q.display_name??Q.name},Q.id))})]}),xe?l.jsx("div",{className:"new-thread-hero__path",children:xe}):l.jsx("div",{className:"new-thread-hero__hint",children:"选择一个线程后,直接输入第一条消息即可开始。"}),u?null:l.jsx("button",{type:"button",className:"new-thread-hero__directory-trigger",onClick:()=>ce("directory-picker"),children:"新增目录线程"})]})})})})]}),A?null:l.jsx(C1,{isDesktopSidebar:u,sidebarShift:h,isSidebarDragging:p,composerError:C,onDismissComposerError:()=>I(null),interactionRequests:[],pendingInteractionRequestId:null,onRespondInteraction:()=>{},parentSession:null,backgroundAgentSessions:[],isBackgroundAgentsOpen:!1,planSnapshot:null,onToggleBackgroundAgents:()=>{},onOpenSession:()=>{},getBackgroundAgentStatusLabel:()=>"",getBackgroundAgentAccent:()=>"var(--color-accent-primary)",formatBackgroundAgentsLabel:Q=>`${Q} background agents`,hasBackgroundAgentStrip:!1,commandPanel:V,isCommandPanelPending:!1,onDismissCommandPanel:()=>$(null),onCommandPanelOptionSelect:Q=>{G(Q),$(pe=>pe&&{...pe,status:"completed",body:`新会话默认模型已切换为 ${Yf(Q,U)}。现在可以继续输入真正的首条消息。`,updated_at:new Date().toISOString(),input_type:"none",options:[]})},onCommandPanelTextSubmit:()=>{},projectId:(ee==null?void 0:ee.id)??null,draft:S,pendingAttachments:ie,canSendInput:!!ee,inputPlaceholder:ee?`向 ${ee.display_name??ee.name} 发起第一条任务…`:"先选择线程,再输入第一条任务",readOnlyPlaceholder:"先选择线程,再输入第一条任务",onDraftChange:k,onUploadFiles:Q=>{const pe=[...Q];pe.length!==0&&(I(null),Promise.all(pe.map(Ce=>S1(Ce))).then(Ce=>{te(Le=>[...Le,...Ce])}).catch(Ce=>{I(Ce instanceof Error?Ce.message:"无法读取附件")}))},onRemoveAttachment:Q=>{te(pe=>pe.filter(Ce=>Ce.id!==Q))},onSubmit:be,showStopIcon:!1,isSendPending:W.isPending,onInterrupt:()=>{},isFastModeEnabled:Y,isPlanModeEnabled:_e,onToggleFastMode:()=>H(Q=>!Q),onTogglePlanMode:()=>je(Q=>!Q),showModeBadges:!0,selectedModel:R,modelOptions:U,selectedReasoning:ue,onSelectModel:G,onSelectReasoning:Q=>Z(Q),contextUsage:null,isContextUsageOpen:!1,onToggleContextUsage:()=>{},usedPercent:0,remainingPercent:0,usedTokensLabel:"0",totalTokensLabel:"0",showJumpToBottom:!1,onJumpToBottom:()=>{}})]})},a0=_.lazy(async()=>({default:(await Tg(()=>import("./session-diff-preview-DLGNrbUv.js"),[])).SessionDiffPreview})),Lp=["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)"],T1=14,E1=10,nr=24,So=48,Ip=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"m9 6 6 6-6 6"})}),xM=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M20 11a8 8 0 1 0 2.2 5.5"}),l.jsx("path",{d:"M20 4v7h-7"})]}),SM=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M3 12a9 9 0 1 0 2.64-6.36"}),l.jsx("path",{d:"M3 4v5h5"}),l.jsx("path",{d:"M12 7v5l3 2"})]}),i0=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M9 14 4 9l5-5"}),l.jsx("path",{d:"M4 9h8a8 8 0 1 1 0 16h-1"})]}),r0=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M7.5 12.5 10.5 15.5 16.5 8.5"}),l.jsx("circle",{cx:"12",cy:"12",r:"8.5"})]}),jM=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M12 16V5"}),l.jsx("path",{d:"m7.5 9.5 4.5-4.5 4.5 4.5"}),l.jsx("path",{d:"M5 19h14"})]}),wM=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M6 6 18 18"}),l.jsx("path",{d:"M18 6 6 18"})]}),kM=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M7 4v10"}),l.jsx("path",{d:"M7 14a4 4 0 0 0 4 4h6"}),l.jsx("path",{d:"M17 6a4 4 0 0 0-4 4H7"}),l.jsx("circle",{cx:"7",cy:"4",r:"2"}),l.jsx("circle",{cx:"17",cy:"6",r:"2"}),l.jsx("circle",{cx:"17",cy:"18",r:"2"})]}),NM=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("rect",{x:"4",y:"5",width:"16",height:"11",rx:"2"}),l.jsx("path",{d:"M8 19h8"}),l.jsx("path",{d:"M10 16v3"}),l.jsx("path",{d:"M14 16v3"})]}),CM=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.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"})}),TM=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M7 4v10"}),l.jsx("path",{d:"M7 14a4 4 0 0 0 4 4h6"}),l.jsx("path",{d:"M7 10a4 4 0 0 1 4-4h6"}),l.jsx("circle",{cx:"7",cy:"4",r:"2"}),l.jsx("circle",{cx:"17",cy:"6",r:"2"}),l.jsx("circle",{cx:"17",cy:"18",r:"2"})]}),sr=({label:s,icon:t,onClick:a,disabled:r=!1,variant:c="default",pending:u=!1,className:h})=>l.jsx("button",{type:"button",className:`session-git-panel__icon-button is-${c} ${u?"is-pending":""} ${h??""}`.trim(),onClick:a,disabled:r,"aria-label":s,title:s,children:l.jsx("span",{className:"session-git-panel__icon-button-glyph","aria-hidden":"true",children:t})}),l0=s=>{switch(s){case"added":return"A";case"deleted":return"D";case"renamed":return"R";case"untracked":return"U";default:return"M"}},EM=s=>s.status==="renamed"&&s.previous_path?`该变更仅包含重命名:${s.previous_path} -> ${s.path}`:s.status==="deleted"?"该文件已删除,没有可展示的补丁内容。":s.status==="untracked"?"该文件还没有可展示的补丁内容。":"此变更没有可展示的补丁内容。",MM=(s,t)=>t&&t.diff.trim()?"此变更没有可展示的补丁内容。":s.status==="renamed"&&s.previous_path?`该提交仅包含重命名:${s.previous_path} -> ${s.path}`:s.status==="deleted"?"该文件在这次提交中已删除,没有可展示的补丁内容。":"该文件在这次提交中没有可展示的补丁内容。",cu=s=>Lp[s%Lp.length]??Lp[0],il=s=>E1+s*T1,pf=(s,t)=>`${s}\0${t}`,uy=s=>Array.isArray(s.parent_oids)?s.parent_oids.filter(Boolean):[],RM=s=>Array.isArray(s.refs)?s.refs.filter(Boolean):[],AM=s=>{var u;const t={};let a=[],r=0;const c=()=>{const h=r;return r+=1,h};for(const h of s){let p=a.findIndex(k=>k.oid===h.oid);p<0&&(a=[...a,{oid:h.oid,colorIndex:c()}],p=a.length-1);const y=a.map(k=>({...k})),m=((u=y[p])==null?void 0:u.colorIndex)??c(),x=[...new Set(uy(h))],g=y.map(k=>({...k}));x.length>0?g[p]={oid:x[0],colorIndex:m}:g.splice(p,1);const S=[];if(x.length>0){const k=g.findIndex(N=>N.oid===x[0]);S.push(k>=0?k:p)}x.slice(1).forEach((k,N)=>{let T=g.findIndex(C=>C.oid===k);T<0&&(T=Math.min(g.length,p+1+N),g.splice(T,0,{oid:k,colorIndex:c()})),S.push(T)}),t[h.oid]={beforeLanes:y,afterLanes:g,laneIndex:p,nodeColorIndex:m,parentLaneIndexes:S},a=g.filter((k,N,T)=>T.findIndex(C=>C.oid===k.oid)===N)}return t},DM=({commit:s,row:t,isLocalHead:a,isRemoteHead:r,isFirstRow:c,maxLaneCount:u})=>{const h=uy(s).length,p=Math.max(u,t.beforeLanes.length,t.afterLanes.length,1),y=Math.max(40,E1*2+(p-1)*T1),m=il(t.laneIndex),x=h>1?4.7:3.9,g=Math.max(0,nr-x-1.1),S={"--session-git-graph-width":`${Math.max(48,Math.ceil(y*(56/So)))}px`};return l.jsx("span",{className:"session-git-history__graph",style:S,children:l.jsxs("svg",{className:`session-git-history__graph-svg ${h>1?"is-merge":""}`,viewBox:`0 0 ${y} ${So}`,preserveAspectRatio:"xMinYMid meet","aria-hidden":"true",children:[t.beforeLanes.map((k,N)=>l.jsx("path",{d:`M ${il(N)} ${c?g:0} L ${il(N)} ${g}`,stroke:cu(k.colorIndex),strokeWidth:"2",strokeLinecap:"round",fill:"none",opacity:c?0:1},`before:${k.oid}:${N}`)),t.afterLanes.map((k,N)=>{const T=t.beforeLanes.findIndex($=>$.oid===k.oid),C=T>=0?il(T):il(N),I=il(N),V=C===I?`M ${I} ${nr} L ${I} ${So}`:`M ${C} ${nr} C ${C} 27 ${I} 31 ${I} ${So}`;return l.jsx("path",{d:V,stroke:cu(k.colorIndex),strokeWidth:"2",strokeLinecap:"round",fill:"none"},`after:${k.oid}:${N}`)}),t.parentLaneIndexes.map((k,N)=>{var V;const T=il(k),C=cu(((V=t.afterLanes[k])==null?void 0:V.colorIndex)??t.nodeColorIndex),I=T===m?`M ${m} ${nr} L ${T} ${So}`:`M ${m} ${nr} C ${m} 27 ${T} 31 ${T} ${So}`;return l.jsx("path",{d:I,stroke:C,strokeWidth:N>0||h>1?"2.2":"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none",opacity:N>0||h>1?.96:.88},`parent:${s.oid}:${N}`)}),l.jsx("circle",{cx:m,cy:nr,r:x,fill:"var(--color-surface-panel)",stroke:cu(t.nodeColorIndex),strokeWidth:h>1?"1.8":"1.55"}),l.jsx("circle",{cx:m,cy:nr,r:a||r?1.6:1.05,fill:cu(t.nodeColorIndex)}),a&&r?l.jsx("circle",{cx:m,cy:nr,r:"6.4",fill:"none",stroke:"color-mix(in oklab, var(--color-accent-primary) 22%, transparent)",strokeWidth:"1",strokeDasharray:"1.5 3"}):null]})})},OM=({workspace:s,history:t,isLoading:a,isHistoryLoading:r,error:c,historyError:u,onRefresh:h,onRefreshHistory:p,onRequestHistory:y,onDiscardFile:m,onDiscardAll:x,onCommitAll:g,onSwitchBranch:S,onPush:k,onLoadWorkspaceFileDiff:N,onLoadHistoryFileDiff:T,pendingAction:C,compact:I=!1})=>{const[V,$]=_.useState("changes"),[R,G]=_.useState({}),[ue,Z]=_.useState({}),[ie,te]=_.useState({}),[Y,H]=_.useState({}),[_e,je]=_.useState({}),[ae,ce]=_.useState({}),[E,U]=_.useState({}),[ee,W]=_.useState({}),[xe,A]=_.useState({}),[ne,be]=_.useState(!1),[Q,pe]=_.useState(null),[Ce,Le]=_.useState(""),[he,q]=_.useState(null),Se=_.useRef(null);_.useEffect(()=>{G(qe=>{if(!(s!=null&&s.files.length))return{};const De=new Set(s.files.map($e=>$e.path));let Ie=!1;const We={};for(const[$e,He]of Object.entries(qe)){if(!De.has($e)){Ie=!0;continue}We[$e]=He}return Ie?We:qe});const oe=new Set((s==null?void 0:s.files.map(qe=>qe.path))??[]);Z(qe=>{let De=!1;const Ie={};for(const[We,$e]of Object.entries(qe)){if(!oe.has(We)){De=!0;continue}Ie[We]=$e}return De?Ie:qe}),te(qe=>{let De=!1;const Ie={};for(const[We,$e]of Object.entries(qe)){if(!oe.has(We)){De=!0;continue}Ie[We]=$e}return De?Ie:qe}),H(qe=>{let De=!1;const Ie={};for(const[We,$e]of Object.entries(qe)){if(!oe.has(We)){De=!0;continue}Ie[We]=$e}return De?Ie:qe})},[s==null?void 0:s.files]),_.useEffect(()=>{const oe=new Set((t==null?void 0:t.commits.map(De=>De.oid))??[]),qe=new Set((t==null?void 0:t.commits.flatMap(De=>De.files.map(Ie=>pf(De.oid,Ie.path))))??[]);je(De=>{let Ie=!1;const We={};for(const[$e,He]of Object.entries(De)){if(!oe.has($e)){Ie=!0;continue}We[$e]=He}return Ie?We:De}),ce(De=>{let Ie=!1;const We={};for(const[$e,He]of Object.entries(De)){if(!oe.has($e)){Ie=!0;continue}if(He&&!qe.has(pf($e,He))){Ie=!0,We[$e]=null;continue}We[$e]=He}return Ie?We:De}),U(De=>{let Ie=!1;const We={};for(const[$e,He]of Object.entries(De)){if(!qe.has($e)){Ie=!0;continue}We[$e]=He}return Ie?We:De}),W(De=>{let Ie=!1;const We={};for(const[$e,He]of Object.entries(De)){if(!qe.has($e)){Ie=!0;continue}We[$e]=He}return Ie?We:De}),A(De=>{let Ie=!1;const We={};for(const[$e,He]of Object.entries(De)){if(!qe.has($e)){Ie=!0;continue}We[$e]=He}return Ie?We:De})},[t==null?void 0:t.commits]),_.useEffect(()=>{if(!ne)return;const oe=qe=>{var De;(De=Se.current)!=null&&De.contains(qe.target)||be(!1)};return window.addEventListener("pointerdown",oe),()=>{window.removeEventListener("pointerdown",oe)}},[ne]),_.useEffect(()=>{s&&(Q==="commit"&&(C==null?void 0:C.action)!=="commit-all"&&s.files.length===0&&(pe(null),Le("")),he&&s.branch===he&&(q(null),pe(null),Le(""),be(!1)))},[Q,C==null?void 0:C.action,he,s]),_.useEffect(()=>{s!=null&&s.branches.length||be(!1)},[s==null?void 0:s.branches]),_.useEffect(()=>{Z({}),te({}),H({})},[s==null?void 0:s.updated_at]);const Ne=(s==null?void 0:s.files)??[],me=(t==null?void 0:t.commits)??[],Te=Ne.length>0,Ge=me.length>0,Ue=(C==null?void 0:C.action)==="discard-all",gt=(C==null?void 0:C.action)==="commit-all",Lt=(C==null?void 0:C.action)==="switch-branch",St=(C==null?void 0:C.action)==="push",st=V==="changes",tn=Q==="switch-branch"&&he?`提交后切换到 ${he}`:"提交全部改动",$t=_.useMemo(()=>{if(!s)return null;const oe=[];return s.upstream_branch&&oe.push(s.upstream_branch),s.ahead_count>0&&oe.push(`ahead ${s.ahead_count}`),s.behind_count>0&&oe.push(`behind ${s.behind_count}`),oe.join(" · ")},[s]),de=_.useMemo(()=>{if(!t)return null;const oe=[t.branch];return t.upstream_branch&&oe.push(t.upstream_branch),oe.join(" · ")},[t]),Ae=_.useMemo(()=>V==="history"?AM(me):{},[V,me]),Re=_.useMemo(()=>V!=="history"?1:Math.max(1,...Object.values(Ae).map(oe=>Math.max(oe.beforeLanes.length,oe.afterLanes.length,oe.laneIndex+1))),[V,Ae]),Oe=(oe,qe)=>{ue[oe]||ie[oe]||(te(De=>({...De,[oe]:!0})),H(De=>{const Ie={...De};return delete Ie[oe],Ie}),N(oe,qe).then(De=>{Z(Ie=>({...Ie,[oe]:De}))}).catch(De=>{H(Ie=>({...Ie,[oe]:De instanceof Error?De.message:"无法读取该文件的差异。"}))}).finally(()=>{te(De=>{const Ie={...De};return delete Ie[oe],Ie})}))};_.useEffect(()=>{if(!(V!=="changes"||Ne.length===0))for(const oe of Ne)R[oe.path]&&Oe(oe.path,oe.previous_path)},[V,R,Ne,N,ue,ie]);const Ke=()=>{pe(null),Le(""),q(null)},mt=()=>{q(null),pe(oe=>oe==="commit"?(Le(""),null):"commit")},kt=()=>{const oe=Ce.trim();if(oe){if(Q==="switch-branch"&&he){Promise.resolve(S(he,oe)).catch(()=>{});return}g(oe)}},rn=oe=>{if(!(!s||oe===s.branch||C)){if(be(!1),s.files.length>0){q(oe),pe("switch-branch");return}Promise.resolve(S(oe)).catch(()=>{})}},Bn=()=>{if(st){h();return}p()},On=()=>{$(oe=>{const qe=oe==="changes"?"history":"changes";return qe==="history"&&y(),qe})},nn=(oe,qe)=>{const De=pf(oe.oid,qe.path),Ie=ae[oe.oid]===qe.path;ce(We=>({...We,[oe.oid]:Ie?null:qe.path})),!(Ie||E[De]||ee[De])&&(W(We=>({...We,[De]:!0})),A(We=>{const $e={...We};return delete $e[De],$e}),T(oe.oid,qe.path,qe.previous_path).then(We=>{U($e=>({...$e,[De]:We}))}).catch(We=>{A($e=>({...$e,[De]:We instanceof Error?We.message:"无法读取该文件的提交差异。"}))}).finally(()=>{W(We=>{const $e={...We};return delete $e[De],$e})}))},ln=oe=>{const qe=new Date(oe);return Number.isNaN(qe.getTime())?oe:new Intl.DateTimeFormat("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(qe)};return l.jsxs("section",{className:`session-git-panel ${I?"is-compact":""}`,children:[l.jsxs("div",{className:"session-git-panel__header",children:[l.jsxs("div",{className:"session-git-panel__heading",ref:Se,children:[l.jsxs("button",{type:"button",className:"session-git-panel__branch-button",onClick:()=>be(oe=>!oe),disabled:!s||!!C,"aria-haspopup":"menu","aria-expanded":ne,title:s?`切换分支:${s.branch}`:"分支加载中",children:[l.jsx("span",{className:"session-git-panel__branch-icon","aria-hidden":"true",children:l.jsx(kM,{})}),l.jsx("span",{className:"session-git-panel__branch",children:(s==null?void 0:s.branch)??"加载中"}),l.jsx("span",{className:`session-git-panel__branch-chevron ${ne?"is-open":""}`,"aria-hidden":"true",children:l.jsx(Ip,{})})]}),ne&&s?l.jsx("div",{className:"session-git-panel__branch-menu",role:"menu","aria-label":"分支列表",children:s.branches.map(oe=>{const qe=oe===s.branch,De=(C==null?void 0:C.action)==="switch-branch"&&C.branch===oe;return l.jsxs("button",{type:"button",className:`session-git-panel__branch-option ${qe?"is-current":""}`,onClick:()=>rn(oe),disabled:qe||!!C,role:"menuitemradio","aria-checked":qe,title:qe?`${oe}(当前)`:`切换到 ${oe}`,children:[l.jsx("span",{className:"session-git-panel__branch-option-name",children:oe}),qe?l.jsx("span",{className:"session-git-panel__branch-option-meta",children:"当前"}):null,De?l.jsx("span",{className:"session-git-panel__branch-option-meta",children:"切换中"}):null]},oe)})}):null]}),l.jsxs("div",{className:"session-git-panel__toolbar",children:[l.jsx(sr,{label:st?"切换到提交历史":"返回修改列表",icon:l.jsx(SM,{}),onClick:On,disabled:!!C,variant:st?"default":"primary",className:st?void 0:"is-active"}),l.jsx(sr,{label:st?a?"正在刷新":"刷新":r?"正在刷新历史":"刷新历史",icon:l.jsx(xM,{}),onClick:Bn,disabled:st?a||!!C:r,pending:st?a:r}),st&&Te?l.jsxs(l.Fragment,{children:[l.jsx(sr,{label:Ue?"正在撤回全部修改":"撤回全部修改",icon:l.jsx(i0,{}),onClick:x,disabled:!!C,variant:"danger",pending:Ue}),l.jsx(sr,{label:gt?"正在提交全部修改":Q==="commit"?"收起提交编辑器":"提交全部修改",icon:l.jsx(r0,{}),onClick:mt,disabled:!!C,variant:"primary",pending:gt})]}):null,st&&!Te?l.jsx(sr,{label:St?"正在推送当前分支":"推送当前分支",icon:l.jsx(jM,{}),onClick:k,disabled:!!C,variant:"primary",pending:St}):null]})]}),st&&s?l.jsxs("div",{className:"session-git-panel__summary",children:[l.jsx("span",{className:"session-git-panel__summary-text",children:Te?`${Ne.length} 个文件待处理`:"当前工作区没有待提交改动"}),$t?l.jsx("span",{className:"session-git-panel__summary-meta",children:$t}):null]}):null,!st&&t?l.jsxs("div",{className:"session-git-panel__summary",children:[l.jsx("span",{className:"session-git-panel__summary-text",children:Ge?`${me.length} 条最近提交`:"当前分支还没有提交历史"}),de?l.jsx("span",{className:"session-git-panel__summary-meta",children:de}):null]}):null,st&&Q&&Te?l.jsxs("div",{className:"session-git-panel__composer",children:[l.jsx("div",{className:"session-git-panel__composer-title",children:tn}),l.jsxs("div",{className:"session-git-panel__composer-row",children:[l.jsx("input",{value:Ce,onChange:oe=>Le(oe.target.value),placeholder:"输入 commit message",className:"session-git-panel__input",disabled:!!C}),l.jsx(sr,{label:Q==="switch-branch"?"提交并切换分支":"确认提交",icon:l.jsx(r0,{}),onClick:kt,disabled:!Ce.trim()||!!C,variant:"primary",pending:gt||Lt}),l.jsx(sr,{label:"取消提交",icon:l.jsx(wM,{}),onClick:Ke,disabled:!!C})]})]}):null,st&&c?l.jsx("div",{className:"session-git-panel__notice is-error",children:c}):null,!st&&u?l.jsx("div",{className:"session-git-panel__notice is-error",children:u}):null,st&&a&&!s?l.jsx("div",{className:"session-git-panel__empty",children:"正在读取当前工作区改动…"}):null,!st&&r&&!t?l.jsx("div",{className:"session-git-panel__empty",children:"正在读取当前分支提交历史…"}):null,st&&!a&&s&&!Te?l.jsx("div",{className:"session-git-panel__empty",children:"当前分支没有待提交改动。你现在可以直接推送当前分支。"}):null,!st&&!r&&t&&!Ge?l.jsx("div",{className:"session-git-panel__empty",children:"当前分支还没有提交历史。"}):null,st&&Te?l.jsx("div",{className:"session-git-panel__list",children:Ne.map(oe=>{const qe=!!R[oe.path],De=(C==null?void 0:C.action)==="discard-file"&&C.path===oe.path,Ie=ue[oe.path],We=!!ie[oe.path],$e=Y[oe.path]??null;return l.jsxs("article",{className:`session-git-file ${qe?"is-expanded":""}`,children:[l.jsxs("div",{className:"session-git-file__head",children:[l.jsxs("button",{type:"button",className:"session-git-file__toggle",onClick:()=>{const He=!qe;G(Ee=>({...Ee,[oe.path]:He})),He&&Oe(oe.path,oe.previous_path)},"aria-expanded":qe,children:[l.jsxs("span",{className:"session-git-file__main",children:[l.jsx("span",{className:"session-git-file__path",children:oe.path}),oe.previous_path?l.jsxs("span",{className:"session-git-file__rename",children:["来自 ",oe.previous_path]}):null]}),l.jsxs("span",{className:"session-git-file__meta",children:[l.jsx("span",{className:`session-git-file__status is-${oe.status}`,children:l0(oe.status)}),l.jsxs("span",{className:"session-git-file__counts",children:[l.jsxs("span",{className:"is-add",children:["+",oe.additions]}),l.jsxs("span",{className:"is-remove",children:["-",oe.deletions]})]}),l.jsx("span",{className:"session-git-file__chevron","aria-hidden":"true",children:l.jsx(Ip,{})})]})]}),l.jsx(sr,{label:De?`正在撤回 ${oe.path}`:`撤回 ${oe.path}`,icon:l.jsx(i0,{}),onClick:()=>m(oe.path),disabled:!!C,variant:"danger",pending:De,className:"session-git-file__action"})]}),qe?l.jsx("div",{className:"session-git-file__detail",children:$e?l.jsx("div",{className:"session-git-panel__notice is-error",children:$e}):We?l.jsx("div",{className:"patch-file-card__empty",children:"正在读取该文件的差异…"}):l.jsx(_.Suspense,{fallback:l.jsx("div",{className:"patch-file-card__empty",children:"正在展开差异…"}),children:l.jsx(a0,{diffText:(Ie==null?void 0:Ie.diff)??"",filePath:oe.path,emptyMessage:EM(oe)})})}):null]},oe.path)})}):null,!st&&Ge?l.jsx("div",{className:"session-git-history",children:me.map((oe,qe)=>{const De=!!_e[oe.oid],Ie=uy(oe),We=ae[oe.oid]??null,$e=Ae[oe.oid],He=(t==null?void 0:t.head_oid)===oe.oid,Ee=(t==null?void 0:t.upstream_head_oid)===oe.oid,Ut=RM(oe).filter(at=>!at||at===(t==null?void 0:t.branch)||at===(t==null?void 0:t.upstream_branch)||at===`HEAD -> ${t==null?void 0:t.branch}`?!1:at!=="HEAD");return l.jsxs("article",{className:`session-git-history__item ${De?"is-expanded":""} ${Ie.length>1?"is-merge":""} ${He?"is-local-head":""} ${Ee?"is-remote-head":""}`.trim(),children:[l.jsxs("button",{type:"button",className:"session-git-history__toggle",onClick:()=>je(at=>({...at,[oe.oid]:!at[oe.oid]})),"aria-expanded":De,children:[$e?l.jsx(DM,{commit:oe,row:$e,isLocalHead:He,isRemoteHead:Ee,isFirstRow:qe===0,maxLaneCount:Re}):null,l.jsxs("span",{className:"session-git-history__content",children:[l.jsx("span",{className:"session-git-history__subject",children:oe.subject}),l.jsxs("span",{className:"session-git-history__meta",children:[l.jsx("span",{children:oe.short_oid}),l.jsx("span",{children:oe.author_name}),l.jsx("span",{children:ln(oe.committed_at)})]})]}),l.jsxs("span",{className:"session-git-history__refs",children:[He?l.jsx("span",{className:"session-git-history__ref is-local",title:"本地当前 HEAD",children:l.jsx(NM,{})}):null,Ee?l.jsx("span",{className:"session-git-history__ref is-remote",title:t!=null&&t.upstream_branch?`云端位置:${t.upstream_branch}`:"云端位置",children:l.jsx(CM,{})}):null,Ie.length>1?l.jsx("span",{className:"session-git-history__ref is-merge",title:"合并提交",children:l.jsx(TM,{})}):null,Ut.slice(0,2).map(at=>l.jsx("span",{className:"session-git-history__ref is-label",title:at,children:at},`${oe.oid}:${at}`))]}),l.jsx("span",{className:"session-git-history__chevron","aria-hidden":"true",children:l.jsx(Ip,{})})]}),De?l.jsx("div",{className:"session-git-history__files",children:l.jsx("div",{className:"session-git-history__files-list",children:oe.files.map(at=>{const pn=We===at.path,Pn=pf(oe.oid,at.path),xn=E[Pn],ps=!!ee[Pn],gs=xe[Pn]??null;return l.jsxs("div",{className:`session-git-history-file-row ${pn?"is-selected":""}`,children:[l.jsxs("button",{type:"button",className:`session-git-history-file ${pn?"is-selected":""}`,onClick:()=>nn(oe,at),"aria-pressed":pn,children:[l.jsx("span",{className:`session-git-file__status is-${at.status}`,children:l0(at.status)}),l.jsx("span",{className:"session-git-history-file__path",children:at.path}),at.previous_path?l.jsxs("span",{className:"session-git-history-file__rename",children:["来自 ",at.previous_path]}):null,l.jsx("span",{className:"session-git-history-file__meta",children:xn?l.jsxs("span",{className:"session-git-history-file__counts",children:[l.jsxs("span",{className:"is-add",children:["+",xn.additions]}),l.jsxs("span",{className:"is-remove",children:["-",xn.deletions]})]}):ps?l.jsx("span",{className:"session-git-history-file__loading",children:"读取中…"}):l.jsx("span",{className:"session-git-history-file__hint",children:"点击查看"})})]}),pn?l.jsxs("div",{className:"session-git-history__diff is-inline",children:[l.jsxs("div",{className:"session-git-history__diff-header",children:[l.jsx("span",{className:"session-git-history__diff-path",children:at.path}),at.previous_path?l.jsxs("span",{className:"session-git-history__diff-rename",children:["来自 ",at.previous_path]}):null]}),gs?l.jsx("div",{className:"session-git-panel__notice is-error",children:gs}):ps?l.jsx("div",{className:"patch-file-card__empty",children:"正在读取该文件的提交差异…"}):l.jsx(_.Suspense,{fallback:l.jsx("div",{className:"patch-file-card__empty",children:"正在展开差异…"}),children:l.jsx(a0,{diffText:(xn==null?void 0:xn.diff)??"",filePath:at.path,emptyMessage:MM(at,xn??null)})})]}):null]},`${oe.oid}:${at.path}`)})})}):null]},oe.oid)})}):null]})},o0={name:"",description:null,command:"",kill_command:null,cwd:null,shell:"auto",node_version:null,port:null},c0=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"m8 6 9 6-9 6z"})}),u0=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("rect",{x:"6.5",y:"6.5",width:"11",height:"11",rx:"1.8"})}),LM=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"m12 3 1.4 4.6L18 9l-4.6 1.4L12 15l-1.4-4.6L6 9l4.6-1.4Z"}),l.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"})]}),IM=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.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"}),l.jsx("path",{d:"m13.5 6.5 4 4"})]}),zM=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M4.5 7h15"}),l.jsx("path",{d:"M9.5 4.5h5"}),l.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"}),l.jsx("path",{d:"M10 10.5v5.2"}),l.jsx("path",{d:"M14 10.5v5.2"})]}),BM=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M12 5v14"}),l.jsx("path",{d:"M5 12h14"})]}),d0={auto:"自动",powershell:"PowerShell",cmd:"CMD",bash:"Bash"},PM=({commands:s,nodeRuntime:t,error:a,pendingRunCommandId:r,pendingKillCommandId:c,pendingDeleteCommandId:u,isSaving:h,isGenerating:p,isStartingAll:y,isStoppingAll:m,generationReason:x,executionModelLabel:g,onRun:S,onRunAll:k,onRunAllKill:N,onRunKill:T,onSave:C,onDelete:I,onGenerate:V})=>{var ce;const[$,R]=_.useState("list"),[G,ue]=_.useState(null),[Z,ie]=_.useState(o0),te=_.useMemo(()=>s.find(E=>E.id===G)??null,[s,G]),Y=_.useMemo(()=>{const E=[...(t==null?void 0:t.versions)??[]];return Z.node_version&&!E.includes(Z.node_version)&&E.unshift(Z.node_version),E},[Z.node_version,t==null?void 0:t.versions]),H=_.useMemo(()=>s.filter(E=>!!E.kill_command).length,[s]),_e=()=>{ie(o0),ue(null),R("edit")},je=E=>{ie({name:E.name,description:E.description,command:E.command,kill_command:E.kill_command,cwd:E.cwd,shell:E.shell,node_version:E.node_version,port:E.port}),ue(E.id),R("edit")},ae=()=>{C({commandId:te==null?void 0:te.id,draft:Z}),h||(R("list"),ue(null))};return l.jsxs("div",{className:"session-run-panel",children:[l.jsxs("div",{className:"session-run-panel__header",children:[l.jsxs("div",{className:"session-run-panel__header-copy",children:[l.jsxs("div",{className:"session-run-panel__title-row",children:[l.jsx("h2",{className:"session-run-panel__title",children:"项目命令"}),l.jsxs("span",{className:"session-run-panel__count",children:[s.length," 条"]})]}),l.jsxs("div",{className:"session-run-panel__hint",children:["一键生成使用模型:",g]})]}),l.jsxs("div",{className:"session-run-panel__header-actions",children:[l.jsx("button",{type:"button",className:"session-run-panel__icon-button is-primary","aria-label":y?"正在一键启动项目命令":"一键启动项目命令",title:y?"正在一键启动项目命令":"一键启动项目命令",disabled:s.length===0||y||m,onClick:k,children:l.jsx(c0,{})}),l.jsx("button",{type:"button",className:"session-run-panel__icon-button is-warning","aria-label":m?"正在一键停止项目命令":"一键停止项目命令",title:m?"正在一键停止项目命令":"一键停止项目命令",disabled:H===0||y||m,onClick:N,children:l.jsx(u0,{})}),l.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":p?"正在一键生成项目命令":"一键生成项目命令",title:p?"正在一键生成项目命令":"一键生成项目命令",disabled:p||y||m,onClick:V,children:l.jsx(LM,{})}),l.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":"新增项目命令",title:"新增项目命令",onClick:_e,children:l.jsx(BM,{})})]})]}),a?l.jsx("div",{className:"session-run-panel__notice is-error",children:a}):null,x?l.jsx("div",{className:"session-run-panel__hint",children:x}):null,$==="edit"?l.jsxs("div",{className:"session-run-panel__card",children:[l.jsx("h3",{className:"session-run-panel__section-title",children:te?"编辑命令":"新增命令"}),l.jsxs("div",{className:"session-run-panel__form-grid",children:[l.jsxs("label",{className:"session-run-panel__field",children:[l.jsx("span",{children:"名称"}),l.jsx("input",{value:Z.name,onChange:E=>ie(U=>({...U,name:E.target.value})),className:"session-run-panel__input",placeholder:"例如:启动前端"})]}),l.jsxs("label",{className:"session-run-panel__field",children:[l.jsx("span",{children:"说明"}),l.jsx("input",{value:Z.description??"",onChange:E=>ie(U=>({...U,description:E.target.value||null})),className:"session-run-panel__input",placeholder:"给自己留一个短说明"})]}),l.jsxs("label",{className:"session-run-panel__field is-full",children:[l.jsx("span",{children:"命令"}),l.jsx("textarea",{value:Z.command,onChange:E=>ie(U=>({...U,command:E.target.value})),className:"session-run-panel__textarea",placeholder:"pnpm dev",rows:4})]}),l.jsxs("label",{className:"session-run-panel__field is-full",children:[l.jsx("span",{children:"停止命令"}),l.jsx("textarea",{value:Z.kill_command??"",onChange:E=>ie(U=>({...U,kill_command:E.target.value||null})),className:"session-run-panel__textarea",placeholder:"留空表示不需要单独停止",rows:3})]}),l.jsxs("label",{className:"session-run-panel__field",children:[l.jsx("span",{children:"工作目录"}),l.jsx("input",{value:Z.cwd??"",onChange:E=>ie(U=>({...U,cwd:E.target.value||null})),className:"session-run-panel__input",placeholder:"留空表示项目根目录"})]}),l.jsxs("label",{className:"session-run-panel__field",children:[l.jsx("span",{children:"端口"}),l.jsx("input",{value:Z.port??"",onChange:E=>{const U=Number.parseInt(E.target.value,10);ie(ee=>({...ee,port:Number.isFinite(U)&&U>0?U:null}))},className:"session-run-panel__input",placeholder:"例如:5173",inputMode:"numeric"})]}),l.jsxs("label",{className:"session-run-panel__field",children:[l.jsx("span",{children:"Shell"}),l.jsx("select",{value:Z.shell,onChange:E=>ie(U=>({...U,shell:E.target.value})),className:"session-run-panel__select",children:Object.entries(d0).map(([E,U])=>l.jsx("option",{value:E,children:U},E))})]}),l.jsxs("label",{className:"session-run-panel__field",children:[l.jsx("span",{children:"Node 环境"}),l.jsxs("select",{value:Z.node_version??"",onChange:E=>ie(U=>({...U,node_version:E.target.value||null})),className:"session-run-panel__select",children:[l.jsx("option",{value:"",children:"默认环境"}),Y.map(E=>l.jsxs("option",{value:E,children:["Node ",E,t!=null&&t.versions.includes(E)?"":"(未检测到)"]},E))]})]})]}),l.jsx("div",{className:"session-run-panel__hint",children:t!=null&&t.versions.length?"Node 版本只会临时注入当前命令,不会修改系统全局环境。":((ce=t==null?void 0:t.error)==null?void 0:ce.trim())||"未检测到可用的 nvm Node 版本,将按默认环境运行。"}),l.jsxs("div",{className:"session-run-panel__form-actions",children:[l.jsx("button",{type:"button",className:"session-run-panel__ghost-button",onClick:()=>R("list"),children:"取消"}),l.jsx("button",{type:"button",className:"session-run-panel__primary-button",disabled:!Z.name.trim()||!Z.command.trim()||h,onClick:ae,children:h?"保存中...":te?"保存修改":"保存命令"})]})]}):null,l.jsx("div",{className:"session-run-panel__list",children:s.length>0?s.map(E=>l.jsxs("article",{className:"session-run-panel__command-card",children:[l.jsxs("div",{className:"session-run-panel__command-head",children:[l.jsxs("button",{type:"button",className:"session-run-panel__command-main",onClick:()=>je(E),children:[l.jsxs("div",{className:"session-run-panel__command-heading",children:[l.jsx("span",{className:"session-run-panel__command-name",children:E.name}),E.description?l.jsx("span",{className:"session-run-panel__command-description",children:E.description}):null]}),l.jsx("div",{className:"session-run-panel__command-line",children:E.command})]}),l.jsxs("div",{className:"session-run-panel__command-actions",children:[E.kill_command?l.jsx("button",{type:"button",className:"session-run-panel__icon-button is-warning","aria-label":`执行 ${E.name} 的停止命令`,title:`执行 ${E.name} 的停止命令`,disabled:c===E.id,onClick:()=>T(E.id),children:l.jsx(u0,{})}):null,l.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":`编辑 ${E.name}`,title:`编辑 ${E.name}`,onClick:()=>je(E),children:l.jsx(IM,{})}),l.jsx("button",{type:"button",className:"session-run-panel__icon-button is-danger","aria-label":`删除 ${E.name}`,title:`删除 ${E.name}`,disabled:u===E.id,onClick:()=>I(E.id),children:l.jsx(zM,{})}),l.jsx("button",{type:"button",className:"session-run-panel__icon-button is-primary","aria-label":`运行 ${E.name}`,title:`运行 ${E.name}`,disabled:r===E.id,onClick:()=>S(E.id),children:l.jsx(c0,{})})]})]}),l.jsx("div",{className:"session-run-panel__command-footer",children:l.jsxs("div",{className:"session-run-panel__command-meta",children:[l.jsx("span",{className:"session-run-panel__command-pill",children:d0[E.shell]}),E.node_version?l.jsxs("span",{className:"session-run-panel__command-pill is-node",children:["Node ",E.node_version]}):null,E.port?l.jsxs("span",{className:"session-run-panel__command-pill",children:[":",E.port]}):null,E.kill_command?l.jsx("span",{className:"session-run-panel__command-pill is-kill",children:"可停止"}):null,l.jsx("span",{className:"session-run-panel__command-pill",children:E.cwd?E.cwd:"项目根目录"})]})})]},E.id)):l.jsxs("div",{className:"session-run-panel__empty",children:[l.jsx("div",{className:"session-run-panel__empty-title",children:"还没有项目命令"}),l.jsx("div",{className:"session-run-panel__empty-copy",children:"可以手动新增,或直接点击一键生成。"})]})})]})},f0={name:"",description:null,url:""},UM=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"m12 3 1.4 4.6L18 9l-4.6 1.4L12 15l-1.4-4.6L6 9l4.6-1.4Z"}),l.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"})]}),qM=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("circle",{cx:"12",cy:"12",r:"8.5"}),l.jsx("path",{d:"M3.8 12h16.4"}),l.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"})]}),$M=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.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"}),l.jsx("path",{d:"m13.5 6.5 4 4"})]}),HM=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M4.5 7h15"}),l.jsx("path",{d:"M9.5 4.5h5"}),l.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"}),l.jsx("path",{d:"M10 10.5v5.2"}),l.jsx("path",{d:"M14 10.5v5.2"})]}),FM=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M12 5v14"}),l.jsx("path",{d:"M5 12h14"})]}),QM=({websites:s,error:t,pendingDeleteWebsiteId:a,isSaving:r,isGenerating:c,generationReason:u,executionModelLabel:h,onOpen:p,onSave:y,onDelete:m,onGenerate:x})=>{const[g,S]=_.useState("list"),[k,N]=_.useState(null),[T,C]=_.useState(f0),I=_.useMemo(()=>s.find(G=>G.id===k)??null,[k,s]),V=()=>{C(f0),N(null),S("edit")},$=G=>{C({name:G.name,description:G.description,url:G.url}),N(G.id),S("edit")},R=()=>{y({websiteId:I==null?void 0:I.id,draft:T}),r||(S("list"),N(null))};return l.jsxs("div",{className:"session-run-panel",children:[l.jsxs("div",{className:"session-run-panel__header",children:[l.jsxs("div",{className:"session-run-panel__header-copy",children:[l.jsxs("div",{className:"session-run-panel__title-row",children:[l.jsx("h2",{className:"session-run-panel__title",children:"项目网页"}),l.jsxs("span",{className:"session-run-panel__count",children:[s.length," 条"]})]}),l.jsxs("div",{className:"session-run-panel__hint",children:["一键生成使用模型:",h]})]}),l.jsxs("div",{className:"session-run-panel__header-actions",children:[l.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":c?"正在一键生成项目网页":"一键生成项目网页",title:c?"正在一键生成项目网页":"一键生成项目网页",disabled:c,onClick:x,children:l.jsx(UM,{})}),l.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":"新增项目网页",title:"新增项目网页",onClick:V,children:l.jsx(FM,{})})]})]}),t?l.jsx("div",{className:"session-run-panel__notice is-error",children:t}):null,u?l.jsx("div",{className:"session-run-panel__hint",children:u}):null,g==="edit"?l.jsxs("div",{className:"session-run-panel__card",children:[l.jsx("h3",{className:"session-run-panel__section-title",children:I?"编辑网页":"新增网页"}),l.jsxs("div",{className:"session-run-panel__form-grid",children:[l.jsxs("label",{className:"session-run-panel__field",children:[l.jsx("span",{children:"名称"}),l.jsx("input",{value:T.name,onChange:G=>C(ue=>({...ue,name:G.target.value})),className:"session-run-panel__input",placeholder:"例如:前端首页"})]}),l.jsxs("label",{className:"session-run-panel__field",children:[l.jsx("span",{children:"说明"}),l.jsx("input",{value:T.description??"",onChange:G=>C(ue=>({...ue,description:G.target.value||null})),className:"session-run-panel__input",placeholder:"给自己留一个短说明"})]}),l.jsxs("label",{className:"session-run-panel__field is-full",children:[l.jsx("span",{children:"地址"}),l.jsx("input",{value:T.url,onChange:G=>C(ue=>({...ue,url:G.target.value})),className:"session-run-panel__input",placeholder:"http://localhost:5173"})]})]}),l.jsxs("div",{className:"session-run-panel__form-actions",children:[l.jsx("button",{type:"button",className:"session-run-panel__ghost-button",onClick:()=>S("list"),children:"取消"}),l.jsx("button",{type:"button",className:"session-run-panel__primary-button",disabled:!T.name.trim()||!T.url.trim()||r,onClick:R,children:r?"保存中...":I?"保存修改":"保存网页"})]})]}):null,l.jsx("div",{className:"session-run-panel__list",children:s.length>0?s.map(G=>l.jsxs("article",{className:"session-run-panel__command-card",children:[l.jsxs("div",{className:"session-run-panel__command-head",children:[l.jsxs("button",{type:"button",className:"session-run-panel__command-main",onClick:()=>$(G),children:[l.jsxs("div",{className:"session-run-panel__command-heading",children:[l.jsx("span",{className:"session-run-panel__command-name",children:G.name}),G.description?l.jsx("span",{className:"session-run-panel__command-description",children:G.description}):null]}),l.jsx("div",{className:"session-run-panel__command-line",children:G.url})]}),l.jsxs("div",{className:"session-run-panel__command-actions",children:[l.jsx("a",{className:"session-run-panel__icon-button is-primary","aria-label":`打开 ${G.name}`,title:`打开 ${G.name}`,href:G.url,target:"_blank",rel:"noreferrer",onClick:()=>p(G),children:l.jsx(qM,{})}),l.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":`编辑 ${G.name}`,title:`编辑 ${G.name}`,onClick:()=>$(G),children:l.jsx($M,{})}),l.jsx("button",{type:"button",className:"session-run-panel__icon-button is-danger","aria-label":`删除 ${G.name}`,title:`删除 ${G.name}`,disabled:a===G.id,onClick:()=>m(G.id),children:l.jsx(HM,{})})]})]}),l.jsx("div",{className:"session-run-panel__command-footer",children:l.jsx("div",{className:"session-run-panel__command-meta",children:l.jsx("span",{className:"session-run-panel__command-pill",children:"网页"})})})]},G.id)):l.jsxs("div",{className:"session-run-panel__empty",children:[l.jsx("div",{className:"session-run-panel__empty-title",children:"还没有项目网页"}),l.jsx("div",{className:"session-run-panel__empty-copy",children:"可以手动新增,或直接点击一键生成。"})]})})]})},GM=/\u001b\[([0-9;]*)m/g,VM={stdout:"",stderr:"stderr",system:"system"},h0={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"},Sg={fg:null,bg:null,bold:!1,dim:!1,underline:!1},KM=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M6 6 18 18"}),l.jsx("path",{d:"M18 6 6 18"})]}),YM=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M8 4H4v4"}),l.jsx("path",{d:"M16 4h4v4"}),l.jsx("path",{d:"M8 20H4v-4"}),l.jsx("path",{d:"M16 20h4v-4"}),l.jsx("path",{d:"M9 9 4 4"}),l.jsx("path",{d:"m15 9 5-5"}),l.jsx("path",{d:"m9 15-5 5"}),l.jsx("path",{d:"m15 15 5 5"})]}),ZM=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M9 4H4v5"}),l.jsx("path",{d:"M15 4h5v5"}),l.jsx("path",{d:"M9 20H4v-5"}),l.jsx("path",{d:"M15 20h5v-5"}),l.jsx("path",{d:"m4 9 5-5"}),l.jsx("path",{d:"m20 9-5-5"}),l.jsx("path",{d:"m4 15 5 5"}),l.jsx("path",{d:"m20 15-5 5"})]}),WM=s=>{if(!s)return"刚刚";const t=new Date(s);return Number.isNaN(t.getTime())?"刚刚":new Intl.DateTimeFormat("zh-CN",{hour:"2-digit",minute:"2-digit"}).format(t)},m0=(s,t)=>{const a=[s];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(" ")},XM=(s,t)=>{if(t===0)return{...Sg};if(t===1)return{...s,bold:!0,dim:!1};if(t===2)return{...s,dim:!0,bold:!1};if(t===4)return{...s,underline:!0};if(t===22)return{...s,bold:!1,dim:!1};if(t===24)return{...s,underline:!1};if(t===39)return{...s,fg:null};if(t===49)return{...s,bg:null};const a=h0[t];if(a)return{...s,fg:a};const r=h0[t-10];return r&&t>=40?{...s,bg:r}:s},JM=(s,t)=>{const a=[];let r=0,c={...Sg};for(const u of s.matchAll(GM)){const h=u.index??0;h>r&&a.push({text:s.slice(r,h),className:m0(t,c)});const p=(u[1]??"").split(";").map(y=>Number.parseInt(y||"0",10)).filter(y=>Number.isFinite(y));p.length===0?c={...Sg}:c=p.reduce(XM,c),r=h+u[0].length}return r<s.length&&a.push({text:s.slice(r),className:m0(t,c)}),a.length===0&&a.push({text:s,className:t}),a},M1=_.memo(({chunks:s})=>{const t=_.useMemo(()=>s.map(a=>{const r=VM[a.stream],c=["session-terminal-output__segment",`is-${a.stream}`].join(" ");return{cursor:a.cursor,label:r,segments:JM(a.text,c)}}),[s]);return l.jsx(l.Fragment,{children:t.map(a=>l.jsxs("span",{className:"session-terminal-output__chunk",children:[a.label?l.jsx("span",{className:"session-terminal-output__label",children:a.label}):null,a.segments.map((r,c)=>l.jsx("span",{className:r.className,children:r.text},`${a.cursor}:${c}`))]},a.cursor))})});M1.displayName="TerminalOutput";const eR=({terminals:s,activeTerminalId:t,outputs:a,error:r,compact:c=!1,canToggleFullscreen:u=!1,isFullscreen:h=!1,onSelectTerminal:p,onCloseTerminal:y,onToggleFullscreen:m})=>{const x=_.useRef(null),g=s.find(k=>k.id===t)??s[0]??null,S=g?a[g.id]:null;return _.useEffect(()=>{const k=x.current;k&&(k.scrollTop=k.scrollHeight)},[S==null?void 0:S.chunks,g==null?void 0:g.id]),s.length===0?l.jsx("section",{className:`session-terminal-panel ${c?"is-compact":""}`,children:l.jsxs("div",{className:"session-terminal-panel__empty",children:[l.jsx("div",{className:"session-terminal-panel__empty-title",children:"还没有运行中的命令"}),l.jsx("p",{className:"session-terminal-panel__empty-copy",children:"从右上角的运行按钮启动一个项目命令后,这里会实时显示终端输出。"})]})}):l.jsxs("section",{className:`session-terminal-panel ${c?"is-compact":""}`,children:[l.jsxs("div",{className:"session-terminal-panel__tabs",children:[l.jsx("div",{className:"session-terminal-panel__tab-list",role:"tablist","aria-label":"终端列表",children:s.map(k=>{const N=k.id===(g==null?void 0:g.id);return l.jsxs("div",{className:`session-terminal-panel__tab ${N?"is-active":""}`,children:[l.jsxs("button",{type:"button",className:"session-terminal-panel__tab-button",role:"tab","aria-selected":N,onClick:()=>p(k.id),children:[l.jsx("span",{className:`session-terminal-panel__tab-dot is-${k.status}`,"aria-hidden":"true"}),l.jsx("span",{className:"session-terminal-panel__tab-title",children:k.title}),l.jsx("span",{className:"session-terminal-panel__tab-time",children:WM(k.last_output_at??k.updated_at)})]}),l.jsx("button",{type:"button",className:"session-terminal-panel__tab-close","aria-label":`关闭 ${k.title}`,onClick:T=>{T.stopPropagation(),y(k.id)},children:l.jsx(KM,{})})]},k.id)})}),u&&m?l.jsx("button",{type:"button",className:"session-terminal-panel__fullscreen-button",onClick:m,"aria-label":h?"退出终端全屏":"终端全屏",title:h?"退出终端全屏":"终端全屏",children:h?l.jsx(ZM,{}):l.jsx(YM,{})}):null]}),g?l.jsxs(l.Fragment,{children:[r?l.jsx("div",{className:"session-terminal-panel__notice is-error",children:r}):null,S!=null&&S.error?l.jsx("div",{className:"session-terminal-panel__notice is-error",children:S.error}):null,S!=null&&S.truncated?l.jsx("div",{className:"session-terminal-panel__notice",children:"终端输出过长,已自动显示服务端仍保留的最近内容。"}):null,l.jsx("div",{ref:x,className:"session-terminal-panel__output-wrap",children:l.jsx("pre",{className:"session-terminal-output",children:S&&S.chunks.length>0?l.jsx(M1,{chunks:S.chunks}):S!=null&&S.isLoading?l.jsx("span",{className:"session-terminal-output__placeholder",children:"正在读取终端输出..."}):l.jsx("span",{className:"session-terminal-output__placeholder",children:"这个终端暂时还没有输出。"})})})]}):null]})},tR=_.memo(function({conversationMainRef:t,conversationScrollRef:a,isDesktopSidebar:r,sidebarShift:c,isSidebarDragging:u,title:h,titleActions:p,topbarActions:y,onOpenSidebar:m,threadContent:x,connectionStatus:g,isConnectionDetailOpen:S,onToggleConnectionDetail:k,showThinkingStatus:N}){const T={transform:`translateX(${c}px)`,transition:u?"none":void 0};return l.jsxs("div",{ref:t,className:`conversation-main ${r?"has-desktop-sidebar":""}`,style:T,children:[l.jsxs("div",{className:"conversation-topbar",children:[r?null:l.jsxs("button",{type:"button",className:"conversation-menu",onClick:m,"aria-label":"打开侧边栏",children:[l.jsx("span",{}),l.jsx("span",{className:"short"})]}),l.jsx("div",{className:"conversation-topbar__meta",children:l.jsxs("div",{className:"conversation-topbar__title-row",children:[l.jsx("h1",{children:h}),p]})}),y]}),l.jsx("div",{ref:a,className:"conversation-scroll",children:l.jsxs("div",{className:"conversation-thread",children:[x,g.state!=="connected"?l.jsx("section",{className:"conversation-entry is-connection-status",children:l.jsxs("div",{className:"connection-status",children:[l.jsx("button",{type:"button",className:"connection-status__pill",onClick:C=>{C.stopPropagation(),k()},children:l.jsx("span",{children:g.state==="failed"?"连接异常":`Reconnecting... ${g.attempt}/${g.maxAttempts}`})}),S&&g.error?l.jsx("div",{className:"connection-status__tooltip",role:"tooltip",children:g.error}):null]})}):null,N?l.jsx("section",{className:"conversation-entry is-thinking-status",children:l.jsx("div",{className:"thinking-status-pill",children:l.jsx("span",{children:"正在思考"})})}):null]})})]})}),p0="panda:last-session-id",nR=.4,sR=104,aR=1800*1e3,iR=15e3,rR=120*1e3,g0=2e3,y0=1100,R1="panda:desktop-sidebar-width",fu="panda:desktop-sidebar-width-version",hu="2026-03-24-narrow",lR=300,A1=232,jo=A1,oR=460,cR=72,uR=4200,zp="local-model-panel:",dR=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("circle",{cx:"6",cy:"12",r:"1",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"12",cy:"12",r:"1",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"18",cy:"12",r:"1",fill:"currentColor",stroke:"none"})]}),fR=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("rect",{x:"9",y:"9",width:"10",height:"10",rx:"2"}),l.jsx("path",{d:"M7 15H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h7a2 2 0 0 1 2 2v1"})]}),hR=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"m7.5 12.5 3 3 6-7"})}),mR=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M6 6l12 12"}),l.jsx("path",{d:"M18 6 6 18"})]}),pR=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"m9 18-6-6 6-6"}),l.jsx("path",{d:"m15 6 6 6-6 6"})]}),gR=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("circle",{cx:"6",cy:"6",r:"2.2"}),l.jsx("circle",{cx:"18",cy:"6",r:"2.2"}),l.jsx("circle",{cx:"12",cy:"18",r:"2.2"}),l.jsx("path",{d:"M8 7.6 10.5 16"}),l.jsx("path",{d:"M16 7.6 13.5 16"}),l.jsx("path",{d:"M8.2 6h7.6"})]}),yR=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2.5"}),l.jsx("path",{d:"m7.5 9 2.8 3-2.8 3"}),l.jsx("path",{d:"M12.8 15H16.5"})]}),vR=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.1",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"M7 5.5 18 12 7 18.5Z"})}),_R=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("circle",{cx:"12",cy:"12",r:"8.4"}),l.jsx("path",{d:"M3.8 12h16.4"}),l.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"})]}),v0=(s,t)=>{const a=new Map;for(const r of s)a.set(r.cursor,r);for(const r of t)a.set(r.cursor,r);return[...a.values()].sort((r,c)=>r.cursor-c.cursor)},bR=800,dy=(s,t,a)=>{const r=s.get(t);if(r!==void 0)return s.delete(t),s.set(t,r),r;const c=a();if(s.set(t,c),s.size>bR){const u=s.keys().next().value;u&&s.delete(u)}return c},xR=new Map,SR=new Map,jR=new Map,jg=()=>Tg(()=>import("./session-diff-preview-DLGNrbUv.js"),[]),wR=_.lazy(async()=>({default:(await jg()).SessionDiffPreview})),kR=/<proposed_plan>([\s\S]*?)<\/proposed_plan>/g,NR=s=>dy(xR,s,()=>w1(s)),wg=s=>s.replace(/\\/g,"/"),CR=s=>{var a;const t=/^\/([A-Za-z][A-Za-z0-9._-]*)/.exec(s.trim());return((a=t==null?void 0:t[1])==null?void 0:a.toLowerCase())??""},TR=s=>s.kind==="system"&&s.title==="context_compacted",_0=s=>s>=1e3?`${Math.round(s/1e3)}k`:String(Math.round(s)),ER=s=>dy(SR,s,()=>{const t=s.replace(/\r\n/g,`
|
|
119
|
+
`).split(`
|
|
120
|
+
`),a=[];let r=[],c=null;const u=()=>{r.length!==0&&(a.push({kind:"paragraph",lines:[...r]}),r=[])},h=()=>{if(!c||c.items.length===0){c=null;return}a.push({kind:"list",ordered:c.ordered,items:[...c.items]}),c=null};for(const p of t){const y=/^\s{0,3}(#{1,6})\s+(.+?)\s*$/.exec(p),m=/^\s*([-*])\s+(.+)$/.exec(p),x=/^\s*(\d+)\.\s+(.+)$/.exec(p);if(y){u(),h(),a.push({kind:"heading",level:y[1].length,text:y[2].replace(/\s+#+\s*$/,"").trim()});continue}if(m||x){u();const g=!!x,S=((x==null?void 0:x[2])??(m==null?void 0:m[2])??"").trim();(!c||c.ordered!==g)&&(h(),c={ordered:g,items:[]}),c.items.push(S);continue}if(!p.trim()){u(),h();continue}h(),r.push(p)}return u(),h(),a}),MR=s=>dy(jR,s,()=>{const t=[];let a=0;s.replace(kR,(c,u,h)=>{const p=s.slice(a,h);return p.trim()&&t.push({kind:"markdown",content:p.trim()}),typeof u=="string"&&u.trim()?t.push({kind:"proposed-plan",content:u.trim()}):c.trim()&&t.push({kind:"markdown",content:c.trim()}),a=h+c.length,c});const r=s.slice(a);return r.trim()&&t.push({kind:"markdown",content:r.trim()}),t.length===0&&s.trim()&&t.push({kind:"markdown",content:s.trim()}),t}),RR=s=>{const t=s.files.filter(a=>!!a.item_id);return t.length>0?t:s.files.filter(a=>!a.item_id)},AR=(s,t)=>{const a=s.files.filter(c=>!c.item_id);if(a.length>0)return a.map(c=>({path:c.path,pathLabel:Nr(c.path,t),additions:c.additions,deletions:c.deletions,diff:c.diff,emptyMessage:"此变更没有可展示的补丁内容"}));const r=new Map;for(const c of s.files)r.set(c.path,c);return[...r.values()].map(c=>({path:c.path,pathLabel:Nr(c.path,t),additions:c.additions,deletions:c.deletions,diff:c.diff,emptyMessage:"此变更没有可展示的补丁内容"}))},DR=s=>`${s} background agent${s===1?"":"s"}`,OR=s=>s.startsWith("Reconnecting...")?"retrying":"error",LR=s=>s.startsWith("Reconnecting...")?"Codex 重连中":"Codex 运行异常",b0=s=>{const t=s.trim();if(!t)return null;try{return JSON.parse(t)}catch{return null}},Bp=(s,t)=>{const a=s==null?void 0:s[t];return typeof a=="string"&&a.trim()?a.trim():null},IR=s=>{const t=wg(s).replace(/\/+$/,""),a=t.split("/");return a[a.length-1]||t},x0=s=>`${s.kind}\0${s.title}\0${s.body}\0${s.accent}`,zR=(s,t)=>{if(!t||t.length===0||s.length===0)return s;let a=0;for(;a<s.length&&a<t.length&&x0(s[a])===x0(t[a]);)a+=1;return a<=0||a>=s.length?s:s.slice(a)},BR=s=>{const t=s.trim();if(!t.startsWith("<subagent_notification>"))return null;const a=t.indexOf("{");if(a<0)return null;const r=t.lastIndexOf("}");if(r<=a)return null;try{const c=JSON.parse(t.slice(a,r+1)),u=g=>typeof g=="string"?g.trim():"";if(typeof c.status=="string"){const g=c.status.trim();if(g==="shutdown")return{agentId:typeof c.agent_id=="string"?c.agent_id:null,body:"子代理已关闭",state:"shutdown"};if(g==="completed")return{agentId:typeof c.agent_id=="string"?c.agent_id:null,body:"子代理已完成",state:"completed"};if(g==="errored")return{agentId:typeof c.agent_id=="string"?c.agent_id:null,body:"子代理异常结束",state:"errored"};if(g==="working")return{agentId:typeof c.agent_id=="string"?c.agent_id:null,body:"子代理处理中",state:"working"}}const h=c.status&&typeof c.status=="object"?c.status:null,p=u(h==null?void 0:h.completed),y=u(h==null?void 0:h.errored),m=u(h==null?void 0:h.working),x=u(h==null?void 0:h.shutdown);if(p)return{agentId:typeof c.agent_id=="string"?c.agent_id:null,body:p,state:"completed"};if(y)return{agentId:typeof c.agent_id=="string"?c.agent_id:null,body:y,state:"errored"};if(m)return{agentId:typeof c.agent_id=="string"?c.agent_id:null,body:m,state:"working"};if(x)return{agentId:typeof c.agent_id=="string"?c.agent_id:null,body:x||"子代理已关闭",state:"shutdown"}}catch{return null}return null},Pp=["#2f72d8","#d06a3b","#2d9b7f","#8c62d9","#bf5b7f","#b78b2d"],D1=s=>{const t=(s??"").trim();if(!t)return Pp[0];let a=0;for(let r=0;r<t.length;r+=1)a=a*31+t.charCodeAt(r)>>>0;return Pp[a%Pp.length]},PR=s=>{var t;return D1(((t=s.subagent)==null?void 0:t.nickname)??s.title??s.id)},O1=s=>{let t=-1,a=-1;return s.forEach((r,c)=>{if(!(r.kind!=="system"||r.title!=="status")){if(r.body==="开始处理请求"){t=c;return}r.body==="处理完成"&&(a=c)}}),t>a?t:-1},UR=s=>{var a;const t=O1(s);return t<0?null:((a=s[t])==null?void 0:a.timestamp)??null},qR=s=>{const t=O1(s);if(t<0)return new Set;const a=[],r=new Set;for(const c of s.slice(t)){if(c.kind!=="tool")continue;if(c.title!=="tool-output"){if(a.push({name:c.title}),c.title==="close_agent"){const h=b0(c.body),p=Bp(h,"id");p&&r.delete(p)}continue}const u=a.shift()??null;if((u==null?void 0:u.name)==="spawn_agent"){const h=b0(c.body),p=Bp(h,"agent_id")??Bp(h,"id");p&&r.add(p)}}return r},$R=s=>s.run_state==="running"?"is working":s.run_state==="completed"?"completed":"is awaiting instruction",HR=(s,t)=>{const a=+new Date(t);return Number.isFinite(a)?s.some(r=>{if(r.source!=="app-server")return!1;const c=+new Date(r.updated_at);return Number.isFinite(c)&&Math.abs(c-a)<=1e4}):!1},FR=(s,t)=>{if(!s)return"已处理";const a=Math.max(0,new Date(t).getTime()-new Date(s).getTime()),r=Math.max(0,Math.round(a/1e3)),c=Math.floor(r/60),u=r%60;return c<=0?`已处理 ${u}s`:`已处理 ${c}m ${u}s`},Nr=(s,t)=>{const a=wg(s),r=t?wg(t).replace(/\/+$/,""):"";return r&&a.toLowerCase().startsWith(`${r.toLowerCase()}/`)?a.slice(r.length+1):a},QR=(s,t)=>{const a=s.split(/\r?\n/),r=[];let c=null,u=[];const h=()=>{c&&(r.push({...c,diffText:u.join(`
|
|
121
|
+
`).trim()}),c=null,u=[])};for(const p of a){const y=p.replace(/\r$/,""),m=y.trimStart();if(y.startsWith("*** Add File: ")){h();const x=y.slice(14).trim();c={path:x,displayPath:Nr(x,t),operation:"add",additions:0,deletions:0,diffText:""};continue}if(y.startsWith("*** Update File: ")){h();const x=y.slice(17).trim();c={path:x,displayPath:Nr(x,t),operation:"update",additions:0,deletions:0,diffText:""};continue}if(y.startsWith("*** Delete File: ")){h();const x=y.slice(17).trim();c={path:x,displayPath:Nr(x,t),operation:"delete",additions:0,deletions:0,diffText:""};continue}if(c){if(y.startsWith("*** End Patch")){h();continue}if(y.startsWith("*** ")){h();continue}y.startsWith("+")?c.additions+=1:y.startsWith("-")&&(c.deletions+=1),(m.startsWith("@@")||y.startsWith("+")||y.startsWith("-")||y.startsWith(" "))&&u.push(m.startsWith("@@")?m:y)}}return h(),r.length===0?null:{files:r,additions:r.reduce((p,y)=>p+y.additions,0),deletions:r.reduce((p,y)=>p+y.deletions,0)}},GR=s=>{if(s.length===0)return null;const t=new Map;for(const r of s)for(const c of r.files){const u=t.get(c.path);if(!u){t.set(c.path,{...c});continue}u.additions+=c.additions,u.deletions+=c.deletions,u.diffText=[u.diffText,c.diffText].filter(Boolean).join(`
|
|
122
|
+
`),u.operation=c.operation}const a=[...t.values()];return{files:a,additions:a.reduce((r,c)=>r+c.additions,0),deletions:a.reduce((r,c)=>r+c.deletions,0)}},gf=(s,t=sR)=>{const a=s.replace(/\s+/g," ").trim();return a.length<=t?a:`${a.slice(0,t-1).trimEnd()}…`},fy=s=>{try{return JSON.parse(s)}catch{return null}},VR=s=>{const t=fy(s.body);if(t){const a=["command","cmd","path","pattern","q","input"];for(const r of a){const c=t[r];if(typeof c=="string"&&c.trim())return gf(c)}}return s.title&&s.title!=="tool-output"?s.body.trim().startsWith("{")||s.body.trim().startsWith("[")?gf(s.title.replace(/-/g," ")):gf(s.body||s.title):gf(s.body||"工具执行")},KR=s=>{if(s.title==="apply_patch")return s.body.trim();const t=fy(s.body);return t&&typeof t.command=="string"&&t.command.trim()?t.command.trim():s.body.trim()||s.title},YR=s=>s.map(t=>{const a=fy(t.body);return a&&typeof a.output=="string"?a.output.trim():t.body.trim()}).filter(Boolean).join(`
|
|
123
|
+
|
|
124
|
+
`),ZR=s=>s.kind==="entry"&&s.entry.kind==="user",WR=s=>s.kind==="entry"&&s.entry.kind==="assistant",XR=s=>s.kind==="tool-group"?!0:s.entry.kind==="assistant"||s.entry.kind==="thinking"||s.entry.kind==="tool",JR=s=>{if(s.length<=1)return s;const t=[];for(const a of s){const r=t[t.length-1];if(r&&r.kind==="entry"&&a.kind==="entry"&&r.entry.kind==="assistant"&&a.entry.kind==="assistant"&&r.entry.body.trim()===a.entry.body.trim()){t[t.length-1]=a;continue}t.push(a)}return t},e4=(s,t)=>{const a=JR(s.items),{completion:r}=s,c=a.findLastIndex(h=>WR(h));if(c===-1||!r||!t)return{id:s.id,startedAt:s.startedAt,visibleStartItems:c===-1?a:a.slice(0,c),hiddenItems:[],visibleEndItems:c===-1?[]:a.slice(c),completion:r};let u=0;for(;u<a.length&&ZR(a[u]);)u+=1;return{id:s.id,startedAt:s.startedAt,visibleStartItems:a.slice(0,u),hiddenItems:[...a.slice(u,c),...a.slice(c+1)],visibleEndItems:[a[c]],completion:r}},t4=(s,t)=>{const a=[];let r=[],c=null;const u=()=>{for(const p of r)a.push({kind:"item",id:p.kind==="entry"?p.entry.id:p.group.id,item:p});r=[]},h=()=>{c&&((c.items.length>0||c.completion)&&a.push({kind:"turn",turn:e4(c,t)}),c=null)};for(const p of s){if(p.kind==="turn-start"){h(),c={id:p.id,startedAt:p.startedAt,items:r,completion:null},r=[];continue}if(p.kind==="turn-complete"){if(c){c.completion=p;continue}c={id:p.id,startedAt:null,items:r,completion:p},r=[];continue}if(c){if(c.completion&&!XR(p)){h(),r.push(p);continue}c.items.push(p);continue}r.push(p)}return h(),u(),a},n4=s=>s.run_state!=="running"&&Date.now()-new Date(s.last_event_at).getTime()>=aR,s4=(s,t)=>{var m,x;const a=t==null?void 0:t.projectPath,r=(t==null?void 0:t.compactCompletedTurns)??!1,c=[];let u=null,h=!1,p=null,y=[];for(let g=0;g<s.length;g+=1){const S=s[g];if(S.kind==="system"&&S.body==="开始处理请求"){c.push({kind:"turn-start",id:S.id,startedAt:S.timestamp}),p=S.timestamp,y=[];continue}if(S.kind==="system"&&S.body==="处理完成"){c.push({kind:"turn-complete",id:S.id,durationLabel:FR(p,S.timestamp),patchSummary:GR(y),completedAt:S.timestamp}),p=null,y=[];continue}if(S.kind==="tool"&&S.title!=="tool-output"){const k=[];let N=g+1;for(;N<s.length&&((m=s[N])==null?void 0:m.kind)==="tool"&&((x=s[N])==null?void 0:x.title)==="tool-output";)k.push(s[N]),N+=1;u=S.id;const T=S.title==="apply_patch"?QR(S.body,a):null;T&&y.push(T),k.length===0&&(h=!0),c.push({kind:"tool-group",group:{id:S.id,commandEntry:S,outputEntries:k,patchSummary:T}}),g=N-1;continue}if(S.kind==="tool"&&S.title==="tool-output"){c.push({kind:"tool-group",group:{id:S.id,commandEntry:S,outputEntries:[],patchSummary:null}}),u=S.id;continue}c.push({kind:"entry",entry:S})}return{blocks:t4(c,r),lastToolGroupId:u,hasRunningToolGroup:h}},a4=s=>s.kind==="entry"?s.entry.timestamp:s.group.commandEntry.timestamp,i4=(s,t)=>{var h,p;const a=[...s.visibleStartItems,...s.hiddenItems,...s.visibleEndItems].map(a4).filter(y=>!!y),r=a.length>0?a[a.length-1]:null,c=s.startedAt??a[0]??((h=s.completion)==null?void 0:h.completedAt)??null,u=((p=s.completion)==null?void 0:p.completedAt)??r??c;return{startMs:c?+new Date(c):null,endMs:u?+new Date(u):null,nextStartMs:t!=null&&t.startedAt?+new Date(t.startedAt):null}},r4=(s,t)=>{const a=[...t].sort((h,p)=>+new Date(h.started_at)-+new Date(p.started_at)),r=new Set,c=s.filter(h=>h.kind==="turn"),u=new Map(c.map((h,p)=>[h.turn.id,p]));return s.map(h=>{var N;if(h.kind!=="turn")return h;const p=u.get(h.turn.id)??-1,y=p>=0?((N=c[p+1])==null?void 0:N.turn)??null:null,m=i4(h.turn,y),x=m.startMs??(m.endMs!==null?m.endMs-1200:null),g=m.nextStartMs??(m.endMs!==null?m.endMs+1200:Number.POSITIVE_INFINITY),S=a.find(T=>{if(r.has(T.id))return!1;const C=+new Date(T.started_at),I=T.completed_at?+new Date(T.completed_at):null;return x!==null&&C<x-1200?!1:C<=g+1200||I!==null&&I<=g+1200})??null;return S&&r.add(S.id),{kind:"turn",turn:h.turn,changeSet:S}})},l4=()=>typeof window>"u"?248:Math.max(0,Math.min(248,window.innerWidth-84)),kg=s=>Math.max(A1,Math.min(oR,s)),o4=()=>{if(typeof window>"u")return jo;try{const s=window.localStorage.getItem(R1),t=window.localStorage.getItem(fu);if(!s)return window.localStorage.setItem(fu,hu),jo;const a=Number(s);if(!Number.isFinite(a))return window.localStorage.setItem(fu,hu),jo;const c=t!==hu||a===lR||a>jo?jo:a;return window.localStorage.setItem(fu,hu),kg(c)}catch{return jo}};function yf({active:s,render:t,fallback:a=null}){const[r,c]=_.useState(!s);return _.useEffect(()=>{if(!s){c(!1);return}c(!1);const u=window.requestAnimationFrame(()=>{c(!0)});return()=>{window.cancelAnimationFrame(u)}},[s]),s?r?l.jsx(l.Fragment,{children:t()}):l.jsx(l.Fragment,{children:a}):null}const c4=_.memo(function({sessions:t,sessionRunState:a,projectPath:r,renderedBlocks:c,lastToolGroupId:u,sessionChangeSets:h,isSubagentTimelinePending:p,hasTimeline:y,proposedPlanReplyDrafts:m,pendingProposedPlanReplyEntryId:x,canRespondToProposedPlan:g,onProposedPlanReplyDraftChange:S,onSubmitProposedPlanReply:k,onPreviewImage:N}){const[T,C]=_.useState({}),[I,V]=_.useState({}),[$,R]=_.useState({}),[G,ue]=_.useState(null),[Z,ie]=_.useState(null),te=_.useRef(null);_.useEffect(()=>{const he=q=>{const Se=q.target;Se instanceof Element&&Se.closest(".conversation-inline-link")||ue(null)};return window.addEventListener("pointerdown",he),()=>{window.removeEventListener("pointerdown",he)}},[]),_.useEffect(()=>()=>{te.current!==null&&window.clearTimeout(te.current)},[]);const Y=he=>{C(q=>({...q,[he]:!q[he]}))},H=he=>{V(q=>({...q,[he]:!q[he]}))},_e=he=>{R(q=>({...q,[he]:!q[he]}))},je=async(he,q)=>{var me;const Se=q.trim();if(!Se)return;const Ne=()=>{const Te=document.createElement("textarea");Te.value=Se,Te.setAttribute("readonly","true"),Te.style.position="fixed",Te.style.opacity="0",Te.style.pointerEvents="none",document.body.appendChild(Te),Te.select(),document.execCommand("copy"),document.body.removeChild(Te)};try{(me=navigator.clipboard)!=null&&me.writeText?await navigator.clipboard.writeText(Se):Ne(),ie(he),te.current!==null&&window.clearTimeout(te.current),te.current=window.setTimeout(()=>{ie(Te=>Te===he?null:Te),te.current=null},1400)}catch{}};function ae(he,q,Se){return l.jsx(_.Suspense,{fallback:l.jsx("div",{className:"patch-file-card__empty",children:"正在载入差异详情…"}),children:l.jsx(wR,{diffText:he,filePath:q,emptyMessage:Se})})}function ce(he,q,Se){const Ne=G===Se;return l.jsxs("span",{className:`conversation-inline-link ${Ne?"is-active":""}`,children:[l.jsx("button",{type:"button",className:"conversation-inline-link__button",onClick:me=>{me.stopPropagation(),ue(Te=>Te===Se?null:Se)},children:he}),Ne?l.jsx("span",{className:"conversation-inline-link__tooltip",role:"tooltip",children:q}):null]},Se)}function E(he,q,Se=Nr(he,r)){return ce(IR(Se),Se,q)}function U(he,q){return NR(he).map((Ne,me)=>{const Te=`${q}-${me}`;return Ne.kind==="text"?l.jsx("span",{children:Ne.value},Te):Ne.kind==="code"?l.jsx("code",{className:"conversation-inline-code",children:Ne.value},Te):Ne.kind==="strong"?l.jsx("strong",{children:U(Ne.value,`${Te}-strong`)},Te):Ne.kind==="emphasis"?l.jsx("em",{children:U(Ne.value,`${Te}-emphasis`)},Te):Ne.kind==="skill"?l.jsx("span",{className:"conversation-skill-token",children:Ne.raw},Te):Ne.kind==="command"?l.jsx("span",{className:"conversation-command-token",children:Ne.raw},Te):ce(Ne.label,Ne.path,Te)})}function ee(he,q){return ER(he).map((Ne,me)=>{const Te=`${q}-block-${me}`;if(Ne.kind==="heading"){const Ge=Math.min(Ne.level,3),Ue=Ge===1?"h1":Ge===2?"h2":"h3";return l.jsx(Ue,{className:`conversation-markdown-heading is-level-${Ge}`,children:U(Ne.text,`${Te}-heading`)},Te)}if(Ne.kind==="list"){const Ge=Ne.ordered?"ol":"ul";return l.jsx(Ge,{className:"conversation-markdown-list",children:Ne.items.map((Ue,gt)=>l.jsx("li",{children:U(Ue,`${Te}-item-${gt}`)},`${Te}-item-${gt}`))},Te)}return l.jsx("p",{className:"conversation-markdown-paragraph",children:Ne.lines.map((Ge,Ue)=>l.jsxs("span",{children:[Ue>0?l.jsx("br",{}):null,U(Ge,`${Te}-line-${Ue}`)]},`${Te}-line-${Ue}`))},Te)})}function W(he,q,Se){const Ne=`${he.id}:proposed-plan:${Se}`,me=m[Ne]??"",Te=x===Ne,Ge=!g||Te;return l.jsxs("div",{className:"proposed-plan-card",children:[l.jsx("div",{className:"proposed-plan-card__content",children:ee(q,`${Ne}:content`)}),l.jsxs("div",{className:"proposed-plan-card__footer",children:[l.jsx("div",{className:"proposed-plan-card__title",children:"实施此计划?"}),l.jsxs("div",{className:"proposed-plan-card__actions",children:[l.jsx("button",{type:"button",className:"proposed-plan-card__confirm",disabled:Ge,onClick:()=>{k(Ne,"是,实施此计划")},children:Te?"回复中…":"是,实施此计划"}),l.jsxs("div",{className:"proposed-plan-card__custom",children:[l.jsx("input",{type:"text",className:"proposed-plan-card__input",value:me,disabled:Ge,placeholder:"否,请告知如何调整",onChange:Ue=>{S(Ne,Ue.target.value)},onKeyDown:Ue=>{Ue.key!=="Enter"||!me.trim()||Ge||(Ue.preventDefault(),k(Ne,me))}}),l.jsx("button",{type:"button",className:"proposed-plan-card__submit",disabled:Ge||!me.trim(),onClick:()=>{k(Ne,me)},children:Te?"回复中…":"回复"})]})]})]})]},Ne)}function xe(he){const q=MR(he.body);return q.some(Ne=>Ne.kind==="proposed-plan")?q.map((Ne,me)=>{const Te=`${he.id}-content-${me}`;return Ne.kind==="markdown"?l.jsx("div",{className:"conversation-entry__rich-block",children:ee(Ne.content,Te)},Te):W(he,Ne.content,me)}):ee(he.body,he.id)}function A(he){const q=DS([],he.attachments);if(q.length===0)return null;const Se=q.filter(Gx),Ne=q.filter(me=>!Gx(me));return l.jsxs("div",{className:"conversation-entry__attachments",children:[Se.length>0?l.jsx("div",{className:"conversation-entry__attachment-grid",children:Se.map(me=>{const Te=bg(me.size_bytes),Ge=me.name??"图片",Ue=`图片${Te?` · ${Te}`:""}`,gt=l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"conversation-entry__attachment-media",children:me.content_url?l.jsxs(l.Fragment,{children:[l.jsx("img",{src:me.content_url,alt:Ge,loading:"lazy"}),l.jsx("span",{className:"conversation-entry__attachment-badge",children:"预览"})]}):l.jsx("div",{className:"conversation-entry__attachment-fallback",children:"无法预览"})}),l.jsxs("div",{className:"conversation-entry__attachment-caption",children:[l.jsx("span",{className:"conversation-entry__attachment-title",children:Ge}),l.jsx("span",{className:"conversation-entry__attachment-meta",children:Ue})]})]});return me.content_url?l.jsx("button",{type:"button",className:"conversation-entry__attachment-card is-image",onClick:()=>N({src:me.content_url,label:Ge,meta:Ue}),"aria-label":`预览 ${Ge}`,children:gt},`${he.id}:${me.id}`):l.jsx("div",{className:"conversation-entry__attachment-card is-image",children:gt},`${he.id}:${me.id}`)})}):null,Ne.length>0?l.jsx("div",{className:"conversation-entry__file-list",children:Ne.map(me=>{const Te=bg(me.size_bytes),Ge=l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"conversation-entry__file-icon","aria-hidden":"true",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8Z"}),l.jsx("path",{d:"M14 3v5h5"}),l.jsx("path",{d:"M9 13h6"}),l.jsx("path",{d:"M9 17h4"})]})}),l.jsxs("span",{className:"conversation-entry__file-copy",children:[l.jsx("span",{className:"conversation-entry__file-title",children:me.name??"附件"}),l.jsxs("span",{className:"conversation-entry__file-meta",children:["文件",Te?` · ${Te}`:""]})]})]});return me.content_url?l.jsx("a",{className:"conversation-entry__file-card",href:me.content_url,download:me.name??void 0,target:"_blank",rel:"noreferrer",children:Ge},`${he.id}:${me.id}`):l.jsx("div",{className:"conversation-entry__file-card",children:Ge},`${he.id}:${me.id}`)})}):null]})}function ne(he,q){return l.jsx("div",{className:"turn-patch-summary__files",children:q.map(Se=>{const Ne=`${he}:${Se.path}`,me=!!$[Ne];return l.jsxs("div",{className:`turn-patch-file ${me?"is-expanded":""}`,children:[l.jsxs("button",{type:"button",className:"turn-patch-file__toggle",onClick:()=>_e(Ne),"aria-expanded":me,children:[l.jsx("div",{className:"turn-patch-file__path",children:Se.pathLabel}),l.jsxs("div",{className:"turn-patch-file__meta",children:[l.jsxs("span",{className:"turn-patch-summary__counts",children:[l.jsxs("span",{className:"is-add",children:["+",Se.additions]}),l.jsxs("span",{className:"is-remove",children:["-",Se.deletions]})]}),l.jsx("span",{className:"turn-patch-file__chevron","aria-hidden":"true",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"m9 6 6 6-6 6"})})})]})]}),me?l.jsx("div",{className:"turn-patch-file__detail",children:l.jsx(yf,{active:me,fallback:l.jsx("div",{className:"patch-file-card__empty",children:"正在展开差异…"}),render:()=>ae(Se.diff,Se.path,Se.emptyMessage)})}):null]},Ne)})})}function be(he){return RR(he).map(q=>{const Se=`live:${he.id}:${q.item_id??"summary"}:${q.path}`,Ne=!!$[Se],me=he.status==="running";return l.jsx("section",{className:"conversation-entry is-tool-group",children:l.jsxs("div",{className:`tool-entry ${me?"is-running":"is-complete"} ${Ne?"is-expanded":""} is-patch`,children:[l.jsxs("button",{type:"button",className:"tool-entry__toggle",onClick:()=>_e(Se),"aria-expanded":Ne,children:[l.jsxs("div",{className:"tool-entry__summary",children:[l.jsx("span",{className:"tool-entry__status",children:"已编辑"}),l.jsx("span",{className:"tool-entry__command",children:E(q.path,`${Se}:live-link`,Nr(q.path,r))}),l.jsxs("span",{className:"tool-entry__counts",children:[l.jsxs("span",{className:"is-add",children:["+",q.additions]}),l.jsxs("span",{className:"is-remove",children:["-",q.deletions]})]})]}),l.jsx("span",{className:"tool-entry__chevron","aria-hidden":"true",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"m9 6 6 6-6 6"})})})]}),Ne?l.jsx("div",{className:"tool-entry__details",children:l.jsx(yf,{active:Ne,fallback:l.jsx("div",{className:"patch-file-card__empty",children:"正在展开详情…"}),render:()=>l.jsx("div",{className:"tool-entry__patch-list",children:l.jsxs("div",{className:"patch-file-card",children:[l.jsxs("div",{className:"patch-file-card__header",children:[l.jsx("div",{className:"patch-file-card__path",children:Nr(q.path,r)}),l.jsxs("div",{className:"patch-file-card__counts",children:[l.jsxs("span",{className:"is-add",children:["+",q.additions]}),l.jsxs("span",{className:"is-remove",children:["-",q.deletions]})]})]}),l.jsx("div",{className:"patch-file-card__diff",children:ae(q.diff,q.path,"此变更还没有可展示的补丁内容")})]})})})}):null]})},Se)})}function Q(he){const q=AR(he,r),Se=q.reduce((me,Te)=>me+Te.additions,0),Ne=q.reduce((me,Te)=>me+Te.deletions,0);return l.jsxs("div",{className:"turn-patch-summary",children:[l.jsx("div",{className:"turn-patch-summary__header",children:l.jsxs("div",{className:"turn-patch-summary__title",children:[l.jsxs("span",{children:[q.length," 个文件已更改"]}),l.jsxs("span",{className:"turn-patch-summary__counts",children:[l.jsxs("span",{className:"is-add",children:["+",Se]}),l.jsxs("span",{className:"is-remove",children:["-",Ne]})]})]})}),ne(`summary:${he.id}`,q)]})}function pe(he,q){return l.jsxs("div",{className:"turn-patch-summary",children:[l.jsx("div",{className:"turn-patch-summary__header",children:l.jsxs("div",{className:"turn-patch-summary__title",children:[l.jsxs("span",{children:[q.files.length," 个文件已更改"]}),l.jsxs("span",{className:"turn-patch-summary__counts",children:[l.jsxs("span",{className:"is-add",children:["+",q.additions]}),l.jsxs("span",{className:"is-remove",children:["-",q.deletions]})]})]})}),ne(he,q.files.map(Se=>({path:Se.path,pathLabel:Se.displayPath,additions:Se.additions,deletions:Se.deletions,diff:Se.diffText,emptyMessage:"此变更没有可展示的补丁内容"})))]})}function Ce(he,q){var Lt,St;const Se=q.agentId?t.find(st=>st.id===q.agentId)??null:null,Ne=D1(((Lt=Se==null?void 0:Se.subagent)==null?void 0:Lt.nickname)??(Se==null?void 0:Se.title)??q.agentId),me=`subagent:${he.id}`,Te=!!T[me],Ge=q.state==="working",Ue=q.state==="completed"?"子代理返回":q.state==="shutdown"?"子代理已关闭":q.state==="errored"?"子代理异常":"子代理处理中",gt=((St=Se==null?void 0:Se.subagent)==null?void 0:St.nickname)??(Se==null?void 0:Se.title)??"子代理";return l.jsx("section",{className:"conversation-entry is-tool-group",children:l.jsxs("div",{className:`tool-entry is-subagent ${Ge?"is-running":"is-complete"} ${Te?"is-expanded":""}`,style:{"--subagent-accent":Ne},children:[l.jsxs("button",{type:"button",className:"tool-entry__toggle",onClick:()=>Y(me),"aria-expanded":Te,children:[l.jsxs("div",{className:"tool-entry__summary",children:[l.jsx("span",{className:"tool-entry__status",children:Ue}),l.jsx("span",{className:"tool-entry__command tool-entry__command--agent",children:gt})]}),l.jsx("span",{className:"tool-entry__chevron","aria-hidden":"true",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"m9 6 6 6-6 6"})})})]}),Te?l.jsx("div",{className:"tool-entry__details",children:l.jsx(yf,{active:Te,fallback:l.jsx("div",{className:"patch-file-card__empty",children:"正在展开详情…"}),render:()=>l.jsxs("div",{className:"tool-entry__section",children:[l.jsx("div",{className:"tool-entry__label",children:gt}),l.jsx("div",{className:"tool-entry__markdown",children:ee(q.body,`${he.id}-subagent`)})]})})}):null]})},he.id)}function Le(he){var Ne;if(he.kind==="tool-group"){const{group:me}=he;if(me.commandEntry.title==="apply_patch"&&HR(h,me.commandEntry.timestamp))return null;const Te=!!T[me.id],Ge=a==="running"&&u===me.id&&me.outputEntries.length===0,Ue=me.commandEntry.title==="apply_patch"&&!!me.patchSummary,gt=Ue?me.patchSummary.files.length===1?me.patchSummary.files[0].displayPath:`${me.patchSummary.files.length} 个文件`:VR(me.commandEntry),Lt=KR(me.commandEntry),St=YR(me.outputEntries);return l.jsx("section",{className:"conversation-entry is-tool-group",children:l.jsxs("div",{className:`tool-entry ${Ge?"is-running":"is-complete"} ${Te?"is-expanded":""} ${Ue?"is-patch":""}`,children:[l.jsxs("button",{type:"button",className:"tool-entry__toggle",onClick:()=>Y(me.id),"aria-expanded":Te,children:[l.jsxs("div",{className:"tool-entry__summary",children:[l.jsx("span",{className:"tool-entry__status",children:Ue?"已编辑":Ge?"正在执行":"已执行"}),l.jsx("span",{className:"tool-entry__command",children:Ue&&((Ne=me.patchSummary)==null?void 0:Ne.files.length)===1?E(me.patchSummary.files[0].path,`${me.id}:patch-link`,me.patchSummary.files[0].displayPath):gt}),Ue&&me.patchSummary?l.jsxs("span",{className:"tool-entry__counts",children:[l.jsxs("span",{className:"is-add",children:["+",me.patchSummary.additions]}),l.jsxs("span",{className:"is-remove",children:["-",me.patchSummary.deletions]})]}):null]}),l.jsx("span",{className:"tool-entry__chevron","aria-hidden":"true",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"m9 6 6 6-6 6"})})})]}),Te?l.jsx("div",{className:"tool-entry__details",children:l.jsx(yf,{active:Te,fallback:l.jsx("div",{className:"patch-file-card__empty",children:"正在展开详情…"}),render:()=>Ue&&me.patchSummary?l.jsx("div",{className:"tool-entry__patch-list",children:me.patchSummary.files.map(st=>l.jsxs("div",{className:"patch-file-card",children:[l.jsxs("div",{className:"patch-file-card__header",children:[l.jsx("div",{className:"patch-file-card__path",children:st.displayPath}),l.jsxs("div",{className:"patch-file-card__counts",children:[l.jsxs("span",{className:"is-add",children:["+",st.additions]}),l.jsxs("span",{className:"is-remove",children:["-",st.deletions]})]})]}),l.jsx("div",{className:"patch-file-card__diff",children:ae(st.diffText,st.path,"此变更没有可展示的补丁内容")})]},`${me.id}-${st.path}`))}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"tool-entry__section",children:[l.jsx("div",{className:"tool-entry__label",children:"命令"}),l.jsx("pre",{className:"tool-entry__pre",children:Lt})]}),St?l.jsxs("div",{className:"tool-entry__section",children:[l.jsx("div",{className:"tool-entry__label",children:"输出"}),l.jsx("pre",{className:"tool-entry__pre",children:St})]}):null]})})}):null]})},me.id)}const q=he.entry,Se=q.kind==="user"?BR(q.body):null;if(Se)return Ce(q,Se);if(q.kind==="thinking")return a!=="running"?null:l.jsx("section",{className:"conversation-entry is-thinking-status",children:l.jsx("div",{className:"thinking-status-pill",children:l.jsx("span",{children:"正在思考"})})},q.id);if(TR(q))return l.jsx("section",{className:"conversation-context-compact",children:l.jsx("div",{className:"context-compact-divider",children:l.jsx("span",{children:"背景信息已自动压缩"})})},q.id);if(q.kind==="system"&&q.title==="system_prompt")return null;if(q.kind==="system"&&q.title==="runtime-status"){const me=OR(q.body);return l.jsx("section",{className:"conversation-entry is-runtime-status",children:l.jsxs("div",{className:`runtime-status-entry is-${me}`,children:[l.jsx("div",{className:"runtime-status-entry__label",children:LR(q.body)}),l.jsx("pre",{className:"runtime-status-entry__body",children:q.body})]})},q.id)}return l.jsx("section",{className:`conversation-entry ${q.kind==="user"?"is-user":"is-system"} is-${q.kind}`,children:q.kind==="user"?l.jsxs("div",{className:"conversation-entry__stack",children:[l.jsxs("div",{className:"conversation-entry__body",children:[q.body.trim()?ee(q.body,q.id):null,q.attachments.length>0?A(q):null]}),q.body.trim()?l.jsxs("button",{type:"button",className:`conversation-entry__copy ${Z===q.id?"is-copied":""}`,onClick:()=>{je(q.id,q.body)},"aria-label":Z===q.id?"已复制消息":"复制消息",children:[l.jsx("span",{className:"conversation-entry__copy-icon","aria-hidden":"true",children:Z===q.id?l.jsx(hR,{}):l.jsx(fR,{})}),l.jsx("span",{className:"sr-only",children:Z===q.id?"已复制":"复制"})]}):null]}):l.jsxs("div",{className:"conversation-entry__body",children:[q.body.trim()?q.kind==="assistant"?xe(q):ee(q.body,q.id):null,q.attachments.length>0?A(q):null]})},q.id)}return p?l.jsx("div",{className:"empty-panel",children:"正在载入子代理会话…"}):y?c.map(he=>{var Ge;if(he.kind==="item")return Le(he.item);const{turn:q}=he,Se=he.changeSet,Ne=((Ge=q.completion)==null?void 0:Ge.patchSummary)??null,me=!!I[q.id],Te=q.hiddenItems.length>0&&!me;return l.jsxs("section",{className:"conversation-turn",children:[q.visibleStartItems.map(Ue=>Le(Ue)),q.hiddenItems.length>0?l.jsxs("div",{className:"conversation-turn__history",children:[l.jsxs("button",{type:"button",className:`turn-history-toggle ${me?"is-expanded":""}`,onClick:()=>H(q.id),"aria-expanded":me,children:[l.jsx("span",{className:"turn-history-toggle__label",children:me?`收起前${q.hiddenItems.length}条消息`:`上${q.hiddenItems.length}条消息`}),l.jsx("span",{className:"turn-history-toggle__chevron","aria-hidden":"true",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"m9 6 6 6-6 6"})})})]}),Te?null:q.hiddenItems.map(Ue=>Le(Ue))]}):null,q.completion&&q.visibleEndItems.length>0?l.jsx("section",{className:"conversation-turn-complete",children:l.jsx("div",{className:"turn-complete-divider",children:l.jsx("span",{children:q.completion.durationLabel})})}):null,q.visibleEndItems.map(Ue=>Le(Ue)),Se&&Se.source==="app-server"&&Se.files.length>0?be(Se):null,q.completion&&q.visibleEndItems.length===0?l.jsx("section",{className:"conversation-turn-complete",children:l.jsx("div",{className:"turn-complete-divider",children:l.jsx("span",{children:q.completion.durationLabel})})}):null,Se&&Se.status==="completed"&&Se.files.length>0?Q(Se):Ne?pe(`turn-summary:${q.id}`,Ne):null]},q.id)}):l.jsx("div",{className:"empty-panel",children:"这个会话还没有历史记录。"})}),u4=({sessionId:s,embedded:t=!1,isDesktopSidebar:a,sidebarOffset:r=0,isSidebarDragging:c=!1,onOpenSidebar:u,onSelectSession:h,onExitToNodes:p}={})=>{var Gl,Oa,yc,Qr,Xa,fd,ts,Vl,Ws,vc,Gr,La,Kl,_c,Yl;const{sessionId:y}=Pu({strict:!1}),m=s??y??"",x=Mr(),g=Tl(),{data:S}=Uu({queryKey:dt,scope:{sessionId:m}}),k=_.useRef(null),N=_.useRef(null),T=_.useRef(null),C=_.useRef(null),I=_.useRef(null),[V,$]=_.useState(!1),[R,G]=_.useState(()=>typeof window<"u"&&window.innerWidth>=y0),[ue,Z]=_.useState(()=>o4()),[ie,te]=_.useState(!1),[Y,H]=_.useState(""),[_e,je]=_.useState([]),[ae,ce]=_.useState(null),[E,U]=_.useState(null),[ee,W]=_.useState(null),[xe,A]=_.useState(()=>ry()),[ne,be]=_.useState(()=>y1()),[Q,pe]=_.useState(()=>Fx(m)),[Ce,Le]=_.useState(()=>Qx(m)),he=oy(),q=_.useMemo(()=>he.map(({id:b,...D})=>D),[he]),[Se,Ne]=_.useState({}),[me,Te]=_.useState(null),[Ge,Ue]=_.useState(!1),[gt,Lt]=_.useState(!1),[St,st]=_.useState(""),[tn,$t]=_.useState(!1),[de,Ae]=_.useState(!1),[Re,Oe]=_.useState(null),[Ke,mt]=_.useState(null),[kt,rn]=_.useState(!1),[Bn,On]=_.useState(!1),[nn,ln]=_.useState("code"),[oe,qe]=_.useState(!1),[De,Ie]=_.useState(null),[We,$e]=_.useState(null),[He,Ee]=_.useState(!1),[Ut,at]=_.useState(!1),[pn,Pn]=_.useState(!1),[xn,ps]=_.useState(!1),[gs,as]=_.useState(null),[Ci,la]=_.useState(null),[Gs,is]=_.useState({}),[xa,Vs]=_.useState(!1),[rs,j]=_.useState({state:"connected",attempt:0,maxAttempts:5}),z=_.useRef({});_.useEffect(()=>{_u(xe)},[xe]),_.useEffect(()=>{v1(ne)},[ne]),_.useEffect(()=>{q.length!==0&&(q.some(b=>b.value===xe)||A(q[0].value))},[q,xe]),_.useEffect(()=>{pe(Fx(m)),Le(Qx(m)),W(null),ln("code"),qe(!1),Ie(null),$e(null),Ee(!1),at(!1),Pn(!1),ps(!1),as(null),la(null),is({})},[m]),_.useEffect(()=>{z.current=Gs},[Gs]),_.useEffect(()=>{_1(m,Q)},[Q,m]),_.useEffect(()=>{b1(m,Ce)},[Ce,m]),_.useEffect(()=>{Ne({}),Te(null)},[m]),_.useEffect(()=>{if(!ae)return;const b=K=>{K.key==="Escape"&&ce(null)},D=document.body.style.overflow;return document.body.style.overflow="hidden",window.addEventListener("keydown",b),()=>{document.body.style.overflow=D,window.removeEventListener("keydown",b)}},[ae]);const[ge,we]=_.useState(!1),ke=_.useRef(null),Ve=_.useRef(null),ct=_.useRef(null),Nt=_.useRef({}),Un=_.useRef({}),Jn=_.useRef(null),Ht=_.useRef(null),wn=_.useRef(null),kn=_.useRef(ue),Ln=_.useRef(null),un=_.useRef(null),B=S==null?void 0:S.sessions.find(b=>b.id===m),on=(S==null?void 0:S.agents.find(b=>b.id===(B==null?void 0:B.agent_id)))??(S==null?void 0:S.agents[0]),gn=S==null?void 0:S.projects.find(b=>b.id===(B==null?void 0:B.project_id)),yn=(B==null?void 0:B.capability.can_show_git)??!1,sn=(B==null?void 0:B.capability.can_show_terminal)??!1,Ft=_.useCallback(()=>Xn({sessionId:m,projectId:(B==null?void 0:B.project_id)??null,agentId:(B==null?void 0:B.agent_id)??null}),[B==null?void 0:B.agent_id,B==null?void 0:B.project_id,m]),Fa=_.useCallback(async b=>{if(t){h==null||h(b);return}window.localStorage.setItem(p0,b),await x({to:"/session/$sessionId",params:{sessionId:b}})},[t,x,h]),Rr=_.useCallback(async()=>{if(t){p==null||p();return}await x({to:"/nodes"})},[t,x,p]),Fu=b=>b instanceof Element&&!!b.closest('button, textarea, input, a, [role="dialog"]'),Sa=()=>{const b=T.current;if(!b)return;const D=()=>{b.scrollTo({top:b.scrollHeight,behavior:"auto"})};D(),window.requestAnimationFrame(()=>{D(),window.requestAnimationFrame(D)})},Rl=()=>{const b=T.current;if(!b){Vs(!1);return}const D=b.scrollHeight-b.scrollTop-b.clientHeight;Vs(D>cR)},oa=_.useMemo(()=>((S==null?void 0:S.projects)??[]).filter(b=>b.agent_id===(on==null?void 0:on.id)),[on==null?void 0:on.id,S==null?void 0:S.projects]),qn=_.useMemo(()=>((S==null?void 0:S.sessions)??[]).filter(b=>b.agent_id===(on==null?void 0:on.id)).sort((b,D)=>Number(D.pinned)-Number(b.pinned)||+new Date(D.last_event_at)-+new Date(b.last_event_at)),[on==null?void 0:on.id,S==null?void 0:S.sessions]),dn=_.useMemo(()=>{var b;return(b=B==null?void 0:B.subagent)!=null&&b.parent_session_id?qn.find(D=>{var K;return D.id===((K=B.subagent)==null?void 0:K.parent_session_id)})??null:null},[(Gl=B==null?void 0:B.subagent)==null?void 0:Gl.parent_session_id,qn]),Qa=Es({queryKey:["timeline",m],enabled:!!m,queryFn:async()=>{const D=await(await Ft()).client.getSessionTimeline(m);return g.setQueryData(ir(m),K=>Nf(K,D)),vg(g.getQueryData(["timeline",m]),D)},initialData:m===(S==null?void 0:S.active_session_id)?S.timeline:void 0,refetchInterval:!1}),Ti=Es({queryKey:ir(m),enabled:!1,queryFn:async()=>[],initialData:[]}),Ga=Es({queryKey:["timeline",dn==null?void 0:dn.id,"prefix-source"],enabled:!!(dn!=null&&dn.id),queryFn:async()=>(await Xn({sessionId:dn.id,projectId:dn.project_id,agentId:dn.agent_id})).client.getSessionTimeline(dn.id),refetchInterval:!1}),ja=_.useMemo(()=>B!=null&&B.subagent?new Set:qR(Qa.data??[]),[B==null?void 0:B.subagent,Qa.data]),Wo=_.useMemo(()=>UR(Qa.data??[]),[Qa.data]),es=_.useMemo(()=>B!=null&&B.subagent?[]:qn.filter(b=>{var D;return b.id!==m&&((D=b.subagent)==null?void 0:D.parent_session_id)===m&&!b.archived}).filter(b=>{if(b.run_state==="running")return!0;if(!((B==null?void 0:B.run_state)==="running"||tn))return!1;if(ja.has(b.id))return!0;if(!Wo)return!1;const D=new Date(Wo).getTime(),K=new Date(b.last_event_at).getTime();return Number.isFinite(D)&&Number.isFinite(K)&&K>=D-rR}).sort((b,D)=>+new Date(D.last_event_at)-+new Date(b.last_event_at)),[Wo,tn,ja,B==null?void 0:B.run_state,B==null?void 0:B.subagent,m,qn]),Xo=Es({queryKey:["change-sets",m],enabled:!!m,queryFn:async()=>(await Ft()).client.getSessionChangeSets(m),refetchInterval:!1}),Va=Es({queryKey:["session-git-workspace",m],enabled:!!(m&&yn&&nn==="git"),queryFn:async()=>(await Ft()).client.getSessionGitWorkspace(m),refetchInterval:!1}),ys=Es({queryKey:["session-git-history",m],enabled:!1,queryFn:async()=>(await Ft()).client.getSessionGitHistory(m),refetchInterval:!1}),Rs=Es({queryKey:["session-run-workbench",m],enabled:!!(m&&sn),queryFn:async()=>(await Ft()).client.getSessionRunWorkbench(m),refetchInterval:!1}),vs=Es({queryKey:["plan",m],enabled:!!m,queryFn:async()=>(await Ft()).client.getSessionPlan(m),refetchInterval:!1}),Al=Es({queryKey:["interactions",m],enabled:!!m,queryFn:async()=>(await Ft()).client.getSessionInteractions(m),refetchInterval:!1,initialData:[]}),ca=_.useCallback(async(b,D)=>{if(m){is(K=>{var le,et,Ye;return{...K,[b]:{chunks:((le=K[b])==null?void 0:le.chunks)??[],nextCursor:((et=K[b])==null?void 0:et.nextCursor)??0,truncated:((Ye=K[b])==null?void 0:Ye.truncated)??!1,isLoading:!0,error:null}}});try{const K=await Ft(),le=z.current[b],et=await K.client.getSessionTerminalOutput({sessionId:m,terminalId:b,cursor:D!=null&&D.force||le!=null&&le.truncated||le==null?void 0:le.nextCursor});is(Ye=>{const pt=Ye[b],ot=D!=null&&D.force||et.truncated||!pt?et.chunks:v0(pt.chunks,et.chunks);return{...Ye,[b]:{chunks:ot,nextCursor:et.next_cursor,truncated:et.truncated,isLoading:!1,error:null}}})}catch(K){is(le=>{var et,Ye,pt;return{...le,[b]:{chunks:((et=le[b])==null?void 0:et.chunks)??[],nextCursor:((Ye=le[b])==null?void 0:Ye.nextCursor)??0,truncated:((pt=le[b])==null?void 0:pt.truncated)??!1,isLoading:!1,error:K instanceof Error?K.message:"无法读取终端输出。"}}})}}},[m]);_.useEffect(()=>{var le,et;const b=(le=Rs.data)==null?void 0:le.terminal_snapshot.active_terminal_id,D=(et=Rs.data)==null?void 0:et.terminal_snapshot.terminals.find(Ye=>Ye.id===b);if(!b||!D)return;const K=Gs[b];(!K||K.truncated||K.nextCursor<D.output_cursor)&&ca(b)},[ca,Rs.data,Gs]);const Qu=!!(B!=null&&B.subagent&&(dn!=null&&dn.id)&&Ga.isPending&&!Ga.data),wa=_.useMemo(()=>B!=null&&B.subagent?dn!=null&&dn.id&&Ga.isPending&&!Ga.data?[]:zR(Qa.data??[],Ga.data):Qa.data??[],[dn==null?void 0:dn.id,Ga.data,B==null?void 0:B.subagent,Qa.data]),Ar=_.useMemo(()=>jE(wa,Ti.data),[wa,Ti.data]);_.useEffect(()=>{m&&window.localStorage.setItem(p0,m)},[m]),_.useEffect(()=>{const b=ct.current;b&&((Ti.data??[]).some(D=>D.id===b.optimisticEntryId)||(ct.current=null))},[Ti.data]),_.useEffect(()=>{On(!1)},[m]),_.useEffect(()=>{st((B==null?void 0:B.title)??""),Lt(!1)},[B==null?void 0:B.title,m]),_.useEffect(()=>{Ae(!1)},[m]),_.useEffect(()=>()=>{ke.current&&window.clearTimeout(ke.current),Ve.current&&window.clearTimeout(Ve.current),un.current&&window.cancelAnimationFrame(un.current)},[]),_.useEffect(()=>{if(Ve.current&&(window.clearTimeout(Ve.current),Ve.current=null),!!E)return Ve.current=window.setTimeout(()=>{U(null),Ve.current=null},uR),()=>{Ve.current&&(window.clearTimeout(Ve.current),Ve.current=null)}},[E]),_.useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(R1,String(kg(ue))),window.localStorage.setItem(fu,hu)}catch{}},[ue]),_.useEffect(()=>{kn.current=ue},[ue]),_.useEffect(()=>{if(typeof window>"u")return;const b=()=>{const D=window.innerWidth>=y0;G(D),D&&$(!1)};return b(),window.addEventListener("resize",b),()=>{window.removeEventListener("resize",b)}},[]),_.useEffect(()=>{if(!ie)return;const b=K=>{const le=wn.current;if(!le)return;const et=K.clientX-le.startX,Ye=kg(le.startWidth+et);Ln.current=Ye,un.current===null&&(un.current=window.requestAnimationFrame(()=>{un.current=null;const pt=Ln.current,ot=k.current;pt===null||!ot||ot.style.setProperty("--desktop-sidebar-width",`${pt}px`)}))},D=()=>{un.current!==null&&(window.cancelAnimationFrame(un.current),un.current=null);const K=Ln.current??kn.current;Ln.current=null,wn.current=null,te(!1),kn.current=K,Z(K)};return window.addEventListener("pointermove",b),window.addEventListener("pointerup",D),window.addEventListener("pointercancel",D),()=>{window.removeEventListener("pointermove",b),window.removeEventListener("pointerup",D),window.removeEventListener("pointercancel",D)}},[ie]),_.useEffect(()=>{const b=D=>{const K=D.target;rn(!1),we(!1),!(K instanceof Element&&(K.closest(".conversation-topbar__actions")||K.closest(".conversation-topbar__title-actions")||K.closest(".picker-sheet")||K.closest(".picker-sheet-wrap")))&&(Ue(!1),Ee(!1),at(!1))};return window.addEventListener("pointerdown",b),()=>{window.removeEventListener("pointerdown",b)}},[]),_.useEffect(()=>{const b=k.current;if(!b||R)return;const D=Ye=>{if(Ye.touches.length!==1||Fu(Ye.target))return;const pt=Ye.touches[0];rc(pt.clientX,pt.clientY)},K=Ye=>{if(Ye.touches.length!==1||!Ht.current)return;const pt=Ye.touches[0];lc(pt.clientX,pt.clientY)&&Ye.preventDefault()},le=Ye=>{if(!Ht.current)return;const pt=Ye.changedTouches[0];if(!pt){Ht.current=null,Ra(null);return}Di(pt.clientX,pt.clientY)},et=()=>{Ht.current=null,Ra(null)};return b.addEventListener("touchstart",D,{passive:!0,capture:!0}),b.addEventListener("touchmove",K,{passive:!1,capture:!0}),b.addEventListener("touchend",le,{capture:!0}),b.addEventListener("touchcancel",et,{capture:!0}),()=>{b.removeEventListener("touchstart",D,{capture:!0}),b.removeEventListener("touchmove",K,{capture:!0}),b.removeEventListener("touchend",le,{capture:!0}),b.removeEventListener("touchcancel",et,{capture:!0})}},[R,V]),_.useEffect(()=>{if(!m)return;Sa();const b=window.setTimeout(Sa,120);return()=>{window.clearTimeout(b)}},[wa.length,m]),_.useEffect(()=>{const b=T.current;if(!b)return;const D=()=>{Rl()};return D(),b.addEventListener("scroll",D,{passive:!0}),window.addEventListener("resize",D),()=>{b.removeEventListener("scroll",D),window.removeEventListener("resize",D)}},[wa.length,m]),_.useEffect(()=>{let b=!1,D;return Ft().then(K=>{b||(D=K.client.connectEvents(le=>{var pt,ot,Hn,Bs,Ps,Xs,bc,Zl,Wl,xc,Tn,Wt,jt,ha,ls,Xl,ma;const et=typeof((pt=le.payload)==null?void 0:pt.sessionId)=="string"?le.payload.sessionId:null,Ye=et===m;if(le.type==="agent.online"||le.type==="snapshot.changed"){g.invalidateQueries({queryKey:dt});return}if(le.type==="timeline.reset"&&Ye){const it=Array.isArray((ot=le.payload)==null?void 0:ot.entries)?le.payload.entries:[];g.setQueryData(ir(m),wt=>Nf(wt,it)),g.setQueryData(["timeline",m],wt=>vg(wt,it));const Qt=(Hn=it[it.length-1])==null?void 0:Hn.timestamp;Qt&&g.setQueryData(dt,wt=>yg(wt,m,Qt)),Sa();return}if(le.type==="interaction.reset"&&Ye){const it=Array.isArray((Bs=le.payload)==null?void 0:Bs.requests)?le.payload.requests:[];g.setQueryData(["interactions",m],it),Oe(Qt=>Qt&&it.some(wt=>wt.id===Qt)?Qt:null);return}if(le.type==="plan.reset"&&Ye){const it=(Ps=le.payload)!=null&&Ps.planSnapshot&&typeof le.payload.planSnapshot=="object"?le.payload.planSnapshot:null;g.setQueryData(["plan",m],it);return}if(le.type==="timeline.delta"&&Ye){const it=Array.isArray((Xs=le.payload)==null?void 0:Xs.entries)?le.payload.entries:[];g.setQueryData(ir(m),wt=>Nf(wt,it)),g.setQueryData(["timeline",m],wt=>l1(wt,it));const Qt=(bc=it[it.length-1])==null?void 0:bc.timestamp;Qt&&g.setQueryData(dt,wt=>yg(wt,m,Qt)),Sa();return}if(le.type==="interaction.delta"&&Ye){const it=Array.isArray((Zl=le.payload)==null?void 0:Zl.requests)?le.payload.requests:[],Qt=Array.isArray((Wl=le.payload)==null?void 0:Wl.resolvedRequestIds)?le.payload.resolvedRequestIds.filter(wt=>typeof wt=="string"&&wt.trim().length>0):[];g.setQueryData(["interactions",m],wt=>{const Ot=new Map((wt??[]).map(Gt=>[Gt.id,Gt]));for(const Gt of it)Ot.set(Gt.id,Gt);for(const Gt of Qt)Ot.delete(Gt);return[...Ot.values()].sort((Gt,os)=>+new Date(os.updated_at)-+new Date(Gt.updated_at))}),Qt.length>0&&Oe(wt=>wt&&Qt.includes(wt)?null:wt);return}if(le.type==="plan.delta"&&Ye){const it=(xc=le.payload)!=null&&xc.planSnapshot&&typeof le.payload.planSnapshot=="object"?le.payload.planSnapshot:null;g.setQueryData(["plan",m],it);return}if(le.type==="changeset.reset"&&Ye){const it=Array.isArray((Tn=le.payload)==null?void 0:Tn.changeSets)?le.payload.changeSets:[];g.setQueryData(["change-sets",m],it);return}if(le.type==="changeset.delta"&&Ye){const it=Array.isArray((Wt=le.payload)==null?void 0:Wt.changeSets)?le.payload.changeSets:[];g.setQueryData(["change-sets",m],Qt=>{const wt=new Map((Qt??[]).map(Ot=>[Ot.id,Ot]));for(const Ot of it)wt.set(Ot.id,Ot);return[...wt.values()].sort((Ot,Gt)=>+new Date(Ot.started_at)-+new Date(Gt.started_at))});return}if(le.type==="terminal.snapshot"&&Ye){const it=(jt=le.payload)!=null&&jt.snapshot&&typeof le.payload.snapshot=="object"?le.payload.snapshot:null;if(!it)return;g.setQueryData(["session-run-workbench",m],Qt=>Qt&&{...Qt,terminal_snapshot:it}),is(Qt=>{const wt=new Set(it.terminals.map(Gt=>Gt.id)),Ot={};for(const[Gt,os]of Object.entries(Qt))wt.has(Gt)&&(Ot[Gt]=os);return Ot});return}if(le.type==="terminal.delta"&&Ye){const it=(ha=le.payload)!=null&&ha.terminal&&typeof le.payload.terminal=="object"?le.payload.terminal:null,Qt=Array.isArray((ls=le.payload)==null?void 0:ls.chunks)?le.payload.chunks:[],wt=typeof((Xl=le.payload)==null?void 0:Xl.activeTerminalId)=="string"?le.payload.activeTerminalId:null;if(!it)return;g.setQueryData(["session-run-workbench",m],Ot=>{if(!Ot)return Ot;const Gt=Ot.terminal_snapshot.terminals.filter(pa=>pa.id!==it.id),os=Ot.terminal_snapshot.terminals.findIndex(pa=>pa.id===it.id),Vr=[...Gt];return os<=0?Vr.unshift(it):Vr.splice(os,0,it),{...Ot,terminal_snapshot:{...Ot.terminal_snapshot,active_terminal_id:wt,updated_at:it.updated_at,terminals:Vr}}}),is(Ot=>{var os;if(Qt.length===0)return Ot;const Gt=Ot[it.id];return{...Ot,[it.id]:{chunks:v0((Gt==null?void 0:Gt.chunks)??[],Qt),nextCursor:typeof((os=le.payload)==null?void 0:os.nextCursor)=="number"?le.payload.nextCursor:it.output_cursor,truncated:(Gt==null?void 0:Gt.truncated)??!1,isLoading:!1,error:null}}});return}if(le.type==="session.updated"&&et){const it=(ma=le.payload)!=null&&ma.sessionPatch&&typeof le.payload.sessionPatch=="object"?le.payload.sessionPatch:null,Qt=g.getQueryData(dt);it&&ty(Qt,et)?g.setQueryData(dt,wt=>kf(wt,et,it)):g.invalidateQueries({queryKey:dt}),Ye&&((it==null?void 0:it.run_state)==="running"||(it==null?void 0:it.run_state)==="completed"||(it==null?void 0:it.run_state)==="idle")&&($t(it.run_state==="running"),it.run_state!=="running"&&Ae(!1));return}le.type==="turn.completed"&&Ye&&($t(!1),Ae(!1),g.setQueryData(["plan",m],null))},{sessionId:m,onStatus:le=>{j(le),le.state==="connected"&&we(!1)}}))}),()=>{b=!0,D==null||D()}},[g,Ft,m]),_.useEffect(()=>{if(!m||(B==null?void 0:B.run_state)!=="running"||B.context_usage)return;let b=!1;const D=window.setTimeout(()=>{b||g.invalidateQueries({queryKey:dt})},1200);return()=>{b=!0,window.clearTimeout(D)}},[g,m,B==null?void 0:B.context_usage,B==null?void 0:B.run_state]),_.useEffect(()=>{Ue(!1)},[R,m]);const Dl=_.useCallback(b=>{var D;W(b),((D=b.effect)==null?void 0:D.type)==="set_session_model"&&(A(b.effect.model),b.effect.reasoning_effort&&be(b.effect.reasoning_effort))},[]),ka=Gn({mutationFn:async b=>(await Ft()).client.sendSessionInput(b),onMutate:async b=>{await g.cancelQueries({queryKey:["timeline",b.sessionId]}),U(null),Ae(!1),$t(!0),Te(b.proposedPlanEntryId??null);const D=b.clearComposer!==!1;D&&(H(""),je([])),ke.current&&window.clearTimeout(ke.current);const K=new Date().toISOString(),le=`${ny}${b.sessionId}:${Date.now()}`;ct.current=D?{optimisticEntryId:le,draft:b.input,attachments:b.attachments}:null,g.setQueryData(ir(b.sessionId),et=>r1(et,{id:le,kind:"user",title:"你",body:b.input,timestamp:K,accent:"primary",attachments:j1(b.attachments)})),g.setQueryData(dt,et=>{var Ye;return kf(et,b.sessionId,{run_state:"running",run_state_changed_at:K,last_event_at:K,summary:b.input||((Ye=b.attachments[0])==null?void 0:Ye.name)||"附件"})})},onSuccess:async(b,D)=>{Te(null),D.proposedPlanEntryId&&Ne(K=>{const le={...K};return delete le[D.proposedPlanEntryId],le}),await g.invalidateQueries({queryKey:dt}),await g.invalidateQueries({queryKey:["plan",D.sessionId]}),await g.invalidateQueries({queryKey:["change-sets",D.sessionId]}),ke.current=null},onError:(b,D)=>{Te(null),$t(!1);const K=ct.current;K&&(g.setQueryData(ir(D.sessionId),le=>wE(le,K.optimisticEntryId)),H(le=>le||K.draft),je(le=>le.length>0?le:K.attachments),ct.current=null),U(b instanceof Error?b.message:"无法发送消息")}}),Ol=Gn({mutationFn:async b=>(await Ft()).client.executeSessionCommand(b),onMutate:b=>{U(null),H(""),je([]);const D=b.input.slice(1).trim().split(/\s+/)[0]??"",K=new Date().toISOString();W({panel_id:`command-panel-pending-${Date.now()}`,session_id:b.sessionId,command_name:D,command_text:b.input,title:`正在执行 /${D}`,description:null,status:"running",body:"命令执行中…",submitted_at:K,updated_at:K,input_type:"none",options:[],input_placeholder:null,submit_label:null,effect:null})},onSuccess:async b=>{Dl(b.panel),await g.invalidateQueries({queryKey:dt})},onError:(b,D)=>{W(null),H(K=>K||D.input),U(b instanceof Error?b.message:"无法执行命令")}}),ua=Gn({mutationFn:async b=>(await Ft()).client.respondToSessionCommand(b),onMutate:()=>{U(null)},onSuccess:async b=>{Dl(b.panel),await g.invalidateQueries({queryKey:dt})},onError:b=>{U(b instanceof Error?b.message:"无法继续执行命令")}}),Ks=Gn({mutationFn:async b=>(await Ft()).client.respondToSessionInteraction(b),onMutate:async b=>{U(null),Oe(b.requestId),g.setQueryData(["interactions",b.sessionId],D=>(D??[]).map(K=>K.id===b.requestId?{...K,status:"submitting",updated_at:new Date().toISOString()}:K))},onSuccess:async(b,D)=>{await g.invalidateQueries({queryKey:["interactions",D.sessionId]})},onError:(b,D)=>{g.setQueryData(["interactions",D.sessionId],K=>(K??[]).map(le=>le.id===D.requestId?{...le,status:"pending"}:le)),Oe(null),U(b instanceof Error?b.message:"无法提交确认回复")}}),As=Gn({mutationFn:async b=>(await Ft()).client.interruptSession(b),onMutate:async b=>{U(null),Ae(!0),$t(!1),ke.current&&(window.clearTimeout(ke.current),ke.current=null);const D=new Date().toISOString(),K=g.getQueryData(dt);return g.setQueryData(dt,le=>kf(le,b,{run_state:"completed",run_state_changed_at:D,last_event_at:D})),g.setQueryData(["plan",b],null),{previousSnapshot:K,targetSessionId:b}},onSuccess:(b,D)=>{Ae(!1),g.invalidateQueries({queryKey:dt}),g.invalidateQueries({queryKey:["timeline",D]}),g.invalidateQueries({queryKey:["change-sets",D]})},onError:(b,D,K)=>{Ae(!1),$t(!0),K!=null&&K.previousSnapshot&&g.setQueryData(dt,K.previousSnapshot),g.invalidateQueries({queryKey:["plan",D]}),U(b instanceof Error?b.message:"无法中断会话")}});_.useEffect(()=>{!m||!B||de||As.isPending||$t(B.run_state==="running")},[As.isPending,de,B,B==null?void 0:B.run_state,m]);const fn=Gn({mutationFn:async b=>(await Xn({sessionId:b.sessionId})).client.updateSession(b)}),da=Gn({mutationFn:async b=>(await Xn({projectId:b.projectId})).client.updateThread(b)}),Nn=Gn({mutationFn:async b=>(await Ft()).client.executeSessionGitAction({sessionId:m,action:b.action,path:b.path,branch:b.branch,message:b.message}),onMutate:async()=>{Ie(null)},onSuccess:(b,D)=>{g.setQueryData(["session-git-workspace",m],b.workspace),(D.action==="commit-all"||D.action==="switch-branch")&&g.invalidateQueries({queryKey:["session-git-history",m]})},onError:b=>{Ie(b instanceof Error?b.message:"无法执行 git 操作")}}),Ys=Gn({mutationFn:async b=>(await Ft()).client.saveSessionRunCommand({sessionId:m,action:b.action,commandId:b.commandId,command:b.command}),onMutate:()=>{$e(null)},onSuccess:({catalog:b})=>{g.setQueryData(["session-run-workbench",m],D=>D&&{...D,command_catalog:b})},onError:b=>{$e(b instanceof Error?b.message:"无法保存项目命令。")}}),Ds=Gn({mutationFn:async b=>(await Ft()).client.saveSessionRunWebsite({sessionId:m,action:b.action,websiteId:b.websiteId,website:b.website}),onMutate:()=>{$e(null)},onSuccess:({catalog:b})=>{g.setQueryData(["session-run-workbench",m],D=>D&&{...D,website_catalog:b})},onError:b=>{$e(b instanceof Error?b.message:"无法保存项目网页。")}}),Dr=Gn({mutationFn:async()=>(await Ft()).client.generateSessionRunCommand({sessionId:m,prompt:"",model:Cf()}),onMutate:()=>{$e(null),as(null)},onSuccess:({generation:b,catalog:D})=>{g.setQueryData(["session-run-workbench",m],K=>K&&{...K,command_catalog:D}),as(b.reason)},onError:b=>{$e(b instanceof Error?b.message:"无法一键生成项目命令。")}}),Na=Gn({mutationFn:async()=>(await Ft()).client.generateSessionRunWebsite({sessionId:m,prompt:"",model:Cf()}),onMutate:()=>{$e(null),la(null)},onSuccess:({generation:b,catalog:D})=>{g.setQueryData(["session-run-workbench",m],K=>K&&{...K,website_catalog:D}),la(b.reason)},onError:b=>{$e(b instanceof Error?b.message:"无法一键生成项目网页。")}}),Zt=Gn({mutationFn:async b=>(await Ft()).client.executeSessionTerminalAction({sessionId:m,action:b.action,commandId:b.commandId,terminalId:b.terminalId}),onMutate:()=>{$e(null)},onSuccess:async(b,D)=>{g.setQueryData(["session-run-workbench",m],K=>K&&{...K,terminal_snapshot:b.snapshot}),(D.action==="run-command"||D.action==="run-kill-command")&&b.terminal&&(Ee(!1),ln("terminal"),await ca(b.terminal.id,{force:!0})),D.action==="focus"&&D.terminalId&&await ca(D.terminalId),D.action==="close"&&D.terminalId&&is(K=>{const le={...K};return delete le[D.terminalId],le})},onError:b=>{$e(b instanceof Error?b.message:"无法执行终端操作。")}}),Ei=Xo.data??[],Mi=B?n4(B):!1,Os=_.useMemo(()=>s4(Ar,{projectPath:gn==null?void 0:gn.path,compactCompletedTurns:Mi}),[Mi,gn==null?void 0:gn.path,Ar]),Or=_.useMemo(()=>r4(Os.blocks,Ei),[Os.blocks,Ei]),fa=[...Or].reverse().find(b=>b.kind==="turn"&&!b.turn.completion)??null;if(_.useEffect(()=>{var le;if(typeof window>"u")return;const b=window,D=(le=b.requestIdleCallback)==null?void 0:le.call(b,()=>{jg()},{timeout:1500}),K=D===void 0?window.setTimeout(()=>{jg()},320):null;return()=>{var et;D!==void 0&&((et=b.cancelIdleCallback)==null||et.call(b,D)),K!==null&&window.clearTimeout(K)}},[]),!S||!B||!gn)return l.jsx("div",{className:"conversation-page",children:l.jsx("div",{className:"conversation-main conversation-main--empty",children:l.jsx("div",{className:"empty-panel",children:"没有找到这个会话。"})})});const Jo=B.capability.can_send_input&&!de,Ka=(Al.data??[]).filter(b=>b.status==="pending"||b.status==="submitting"),Lr=(B.run_state==="running"||tn)&&!de||As.isPending,Ir=Jo&&Ka.length===0&&!Lr&&!ka.isPending,$n=(on==null?void 0:on.id)??B.agent_id,Ca=_.useCallback((b,D)=>{Ne(K=>{if(!D.trim()){if(!(b in K))return K;const le={...K};return delete le[b],le}return{...K,[b]:D}})},[]),zr=_.useCallback((b,D)=>{const K=D.trim();!K||!Ir||ka.mutate({sessionId:B.id,input:K,attachments:[],model:xe,reasoningEffort:ne,serviceTier:Q?"fast":void 0,planMode:Ce,clearComposer:!1,proposedPlanEntryId:b})},[Ir,Q,Ce,xe,ne,ka,B.id]),Br=_.useMemo(()=>l.jsx(c4,{sessions:S.sessions,sessionRunState:B.run_state,projectPath:gn.path,renderedBlocks:Or,lastToolGroupId:Os.lastToolGroupId,sessionChangeSets:Ei,isSubagentTimelinePending:Qu,hasTimeline:Ar.length>0,proposedPlanReplyDrafts:Se,pendingProposedPlanReplyEntryId:me,canRespondToProposedPlan:Ir,onProposedPlanReplyDraftChange:Ca,onSubmitProposedPlanReply:zr,onPreviewImage:ce},B.id),[Ir,Ca,zr,Qu,me,gn.path,Se,Or,Os.lastToolGroupId,B.id,B.run_state,Ei,S.sessions,Ar.length]),Ya=_.useCallback(async(b,D,K)=>{var et;U(null),Ue(!1);const le=g.getQueryData(dt);D==="pin"||D==="unpin"?or.flushSync(()=>{g.setQueryData(dt,Ye=>Vf(Ye,b,{pinned:D==="pin"}))}):D==="rename"&&(K!=null&&K.trim())&&g.setQueryData(dt,Ye=>Vf(Ye,b,{title:K.trim()}));try{const Ye=await fn.mutateAsync({sessionId:b,action:D,name:K}),pt=(et=Ye.affectedSessionIds)!=null&&et.length?Ye.affectedSessionIds:[b];if(D==="delete"){g.setQueryData(dt,ot=>XS(ot,pt));for(const ot of pt)g.removeQueries({queryKey:["timeline",ot],exact:!0}),g.removeQueries({queryKey:ir(ot),exact:!0}),g.removeQueries({queryKey:["change-sets",ot],exact:!0})}else g.setQueryData(dt,ot=>WS(ot,pt,{...D==="rename"&&(K!=null&&K.trim())?{title:K.trim()}:{pinned:D==="pin"}}));if(b===B.id&&D==="delete"){const ot=Ye.nextSessionId;ot?await Fa(ot):await Rr()}}catch(Ye){g.setQueryData(dt,le),U(Ye instanceof Error?Ye.message:"无法更新会话")}},[Rr,Fa,g,B.id,fn]),ec=_.useCallback(async(b,D,K)=>{var Ye,pt;U(null),Ue(!1);const le=g.getQueryData(dt),et=(Ye=K==null?void 0:K.name)==null?void 0:Ye.trim();D==="pin"||D==="unpin"?or.flushSync(()=>{g.setQueryData(dt,ot=>Kf(ot,b,{pinned:D==="pin"}))}):D==="rename"&&et?g.setQueryData(dt,ot=>Kf(ot,b,{display_name:et})):D==="reorder"&&((pt=K==null?void 0:K.orderedProjectIds)!=null&&pt.length)?g.setQueryData(dt,ot=>JS(ot,K.orderedProjectIds??[])):D==="remove"||D==="archive"?g.setQueryData(dt,ot=>e1(ot,b)):D==="unarchive"&&g.setQueryData(dt,ot=>ot&&{...ot,sessions:ot.sessions.map(Hn=>Hn.project_id===b?{...Hn,archived:!1}:Hn)});try{const ot=await da.mutateAsync({projectId:b,action:D,name:K==null?void 0:K.name,orderedProjectIds:K==null?void 0:K.orderedProjectIds});if(D==="remove"||D==="archive"||D==="unarchive"){const Hn=ot.nextSessionId;Hn?await Fa(Hn):await Rr()}}catch(ot){g.setQueryData(dt,le),U(ot instanceof Error?ot.message:"无法更新线程")}},[Rr,Fa,g,da]),tc=_.useCallback(async b=>{$n&&(xr($n),ds(null),Mu(null),Eo(b),await x({to:"/"}))},[$n,x]),Pr=((Oa=vs.data)==null?void 0:Oa.steps.some(b=>b.status==="pending"||b.status==="in_progress"))??!1,Ta=B.run_state==="running"||tn,Gu=!!((yc=vs.data)!=null&&yc.updated_at&&Date.now()-new Date(vs.data.updated_at).getTime()<=iR),oh=vs.data&&(Pr||Ta&&Gu)?vs.data:null,Ll=Math.max(0,ja.size-es.length),Ls=B.context_usage,Il=Ls?Math.round(Ls.percent_used):0,ch=Math.max(0,100-Il),uh=Ls?{"--usage-progress":`${Math.max(0,Math.min(100,Ls.percent_used))}%`}:void 0,dh=rs.state==="connected"&&Ta&&!de&&!As.isPending&&!(fa!=null&&fa.turn.completion),fh=!!dn||es.length>0;_.useEffect(()=>{m&&(Un.current[m]={planAt:0,backgroundAgentsAt:0})},[m]),_.useEffect(()=>{if(!m)return;const b=Un.current[m]??(Un.current[m]={planAt:0,backgroundAgentsAt:0});vs.data&&(b.planAt=0),Ll<=0&&(b.backgroundAgentsAt=0)},[Ll,vs.data,m]),_.useEffect(()=>{if(!Re)return;(Al.data??[]).some(D=>D.id===Re&&D.status==="submitting")||Oe(null)},[Al.data,Re]),_.useEffect(()=>{var b;!m||!B||B.run_state==="running"||ka.isPending||As.isPending||fa||(b=vs.data)!=null&&b.is_active||(ke.current&&(window.clearTimeout(ke.current),ke.current=null),$t(!1))},[fa,As.isPending,(Qr=vs.data)==null?void 0:Qr.is_active,ka.isPending,B,B==null?void 0:B.run_state,m]),_.useEffect(()=>{var le;if(!m||!B||rs.state!=="connected"||B.run_state!=="running")return;const b=((le=wa[wa.length-1])==null?void 0:le.timestamp)??B.last_event_at;if(!b||Date.now()-new Date(b).getTime()<2500||Nt.current[m]===b)return;Nt.current[m]=b;const K=window.setTimeout(()=>{g.invalidateQueries({queryKey:dt})},900);return()=>{window.clearTimeout(K)}},[rs.state,wa,g,B,B==null?void 0:B.last_event_at,B==null?void 0:B.run_state,m]),_.useEffect(()=>{if(!m||!B||rs.state!=="connected"||!Ta)return;const b=Un.current[m]??(Un.current[m]={planAt:0,backgroundAgentsAt:0}),D=Ta&&!vs.data,K=!B.subagent&&ja.size>0&&Ll>0;if(!D&&!K)return;const le=window.setTimeout(()=>{const et=Date.now();D&&et-b.planAt>=g0&&(b.planAt=et,g.invalidateQueries({queryKey:["plan",m]})),K&&et-b.backgroundAgentsAt>=g0&&(b.backgroundAgentsAt=et,g.invalidateQueries({queryKey:dt}))},160);return()=>{window.clearTimeout(le)}},[fa,rs.state,Ta,Ll,ja.size,vs.data,g,B,B==null?void 0:B.subagent,m]);const Is=R?0:l4(),Vu=R||V,Ku=R?0:Ke??(V?Is:0),hh=gt&&typeof document<"u"?or.createPortal(l.jsxs("div",{className:"sheet-wrap sheet-wrap--centered",role:"dialog","aria-modal":"true",children:[l.jsx("button",{type:"button",className:"sheet-wrap__scrim",onClick:()=>{Lt(!1),st(B.title)},"aria-label":"关闭重命名会话面板"}),l.jsx("div",{className:"sheet-wrap__center",children:l.jsxs("div",{className:"sheet-panel sheet-panel--form sheet-panel--centered",children:[l.jsx("div",{className:"sheet-panel__title",children:"重命名会话"}),l.jsx("input",{className:"sheet-panel__input",value:St,onChange:b=>st(b.target.value),placeholder:"输入会话名称",autoFocus:!0}),l.jsxs("div",{className:"sheet-panel__actions",children:[l.jsx("button",{type:"button",className:"sheet-panel__button",onClick:()=>{Lt(!1),st(B.title)},children:"取消"}),l.jsx("button",{type:"button",className:"sheet-panel__button is-primary",disabled:!St.trim()||fn.isPending&&((Xa=fn.variables)==null?void 0:Xa.sessionId)===B.id,onClick:()=>{Ya(B.id,"rename",St.trim()),Lt(!1)},children:"保存"})]})]})})]}),document.body):null,mh=!(t?a:R)&&Ge&&typeof document<"u"?or.createPortal(l.jsxs("div",{className:"picker-sheet-wrap",role:"dialog","aria-modal":"true",children:[l.jsx("button",{type:"button",className:"picker-sheet__scrim",onClick:()=>Ue(!1),"aria-label":"关闭会话操作菜单"}),l.jsxs("div",{className:"picker-sheet",children:[l.jsx("div",{className:"picker-sheet__header",children:l.jsx("strong",{children:B.title})}),l.jsxs("div",{className:"picker-sheet__list",children:[l.jsx("button",{type:"button",className:"picker-sheet__item",disabled:fn.isPending&&((fd=fn.variables)==null?void 0:fd.sessionId)===B.id,onClick:()=>void Ya(B.id,B.pinned?"unpin":"pin"),children:l.jsx("span",{children:B.pinned?"取消置顶会话":"置顶会话"})}),l.jsx("button",{type:"button",className:"picker-sheet__item",disabled:fn.isPending&&((ts=fn.variables)==null?void 0:ts.sessionId)===B.id,onClick:()=>{Ue(!1),Lt(!0)},children:l.jsx("span",{children:"重命名会话"})}),l.jsx("button",{type:"button",className:"picker-sheet__item is-danger",disabled:fn.isPending&&((Vl=fn.variables)==null?void 0:Vl.sessionId)===B.id,onClick:()=>void Ya(B.id,"delete"),children:l.jsx("span",{children:"删除会话"})})]})]})]}),document.body):null,ph=R?1:Is>0?Ku/Is:0,zl=!R&&Ke!==null,gh=R?{"--desktop-sidebar-width":`${ue}px`}:void 0,Vn=t?!!a:R,nc=t?r:Ku,Bl=t?c:zl,yh=Nn.isPending?Nn.variables??null:null,vh=De??(Va.error instanceof Error?Va.error.message:null),_h=ys.error instanceof Error?ys.error.message:null,Pl=We??(Rs.error instanceof Error?Rs.error.message:null),_s=Rs.data??null,Zs=(_s==null?void 0:_s.terminal_snapshot)??null,Za=(_s==null?void 0:_s.command_catalog.commands)??[],Yu=(_s==null?void 0:_s.website_catalog.websites)??[],sc=Yf(Cf(),q),Ur=(Zs==null?void 0:Zs.terminals.find(b=>b.id===Zs.active_terminal_id))??(Zs==null?void 0:Zs.terminals[0])??null,Ea=sn&&nn==="terminal",ac=yn&&nn==="git",Ma=Vn&&Ea&&oe,Zu=ac&&Vn,Ri=(Ea||ac)&&Vn&&!Ma,Wu=(Ea||ac)&&!Vn,ic=Zt.isPending&&((Ws=Zt.variables)==null?void 0:Ws.action)==="run-command"?Zt.variables.commandId??null:null,Ai=Zt.isPending&&((vc=Zt.variables)==null?void 0:vc.action)==="run-kill-command"?Zt.variables.commandId??null:null,Xu=Ys.isPending&&((Gr=Ys.variables)==null?void 0:Gr.action)==="delete"?Ys.variables.commandId??null:null,Ju=Ds.isPending&&((La=Ds.variables)==null?void 0:La.action)==="delete"?Ds.variables.websiteId??null:null;_.useEffect(()=>{!Vn&&oe&&qe(!1)},[oe,Vn]);const Ra=b=>{Jn.current=b,mt(b)},rc=(b,D,K)=>(Ht.current={mode:V?"close":"open",startX:b,startY:D,axis:"pending",pointerId:K},!0),lc=(b,D)=>{const K=Ht.current;if(!K)return!1;const le=b-K.startX,et=D-K.startY;if(K.axis==="pending"){if(Math.abs(le)<8&&Math.abs(et)<8)return!1;if(K.axis=Math.abs(le)>Math.abs(et)?"x":"y",K.axis==="y")return Ht.current=null,Ra(null),!1}const Ye=K.mode==="open"?Math.max(0,Math.min(Is,le)):Math.max(0,Math.min(Is,Is+le));return Ra(Ye),!0},Di=(b,D)=>{const K=Ht.current;if(!K)return;const le=b-K.startX,et=D-K.startY;if(K.axis==="pending"&&Math.abs(et)>48){Ht.current=null,Ra(null);return}const pt=(K.axis==="x"?Jn.current??(K.mode==="open"?Math.max(0,Math.min(Is,le)):Math.max(0,Math.min(Is,Is+le))):V?Is:0)>=Is*nR;$(pt),Ht.current=null,Ra(null)},Oi=_.useCallback(()=>{if(t){u==null||u();return}$(!0)},[t,u]),bh=_.useCallback(()=>{we(b=>!b)},[]),Ul=_.useCallback(()=>{U(null)},[]),ed=_.useCallback(()=>{On(b=>!b)},[]),td=_.useCallback(b=>{Fa(b)},[Fa]),ql=_.useCallback(b=>{const D=new Date().toISOString();if(q.length===0){W({panel_id:`${zp}${Date.now()}`,session_id:B.id,command_name:"model",command_text:b,title:"选择模型",description:"选择后会更新当前会话后续发送时使用的模型。",status:"completed",body:"当前没有可选模型,请先去设置页维护模型列表。",submitted_at:D,updated_at:D,input_type:"none",options:[],input_placeholder:null,submit_label:null,effect:null});return}W({panel_id:`${zp}${Date.now()}`,session_id:B.id,command_name:"model",command_text:b,title:"选择模型",description:"选择后会更新当前会话后续发送时使用的模型。",status:"awaiting_input",body:"在下面选择一个模型。",submitted_at:D,updated_at:D,input_type:"choice",options:q.map(K=>({id:K.value,label:K.label,description:K.description??null})),input_placeholder:null,submit_label:null,effect:null})},[q,B.id]),oc=_.useCallback(()=>{if(ly(Y)){if(_e.length>0){U("命令暂不支持附件,请先移除附件后再执行。");return}if(CR(Y)==="model"){U(null),H(""),ql(Y);return}Ol.mutate({sessionId:B.id,input:Y});return}ka.mutate({sessionId:B.id,input:Y.trim(),attachments:_e,model:xe,reasoningEffort:ne,serviceTier:Q?"fast":void 0,planMode:Ce})},[Y,Q,Ce,Ol,ql,_e,xe,ne,ka,B.id]),nd=_.useCallback(()=>{W(null)},[]),sd=_.useCallback(b=>{if(ee){if(ee.panel_id.startsWith(zp)){A(b),W(D=>D&&{...D,status:"completed",body:`后续消息将优先使用 ${Yf(b,q)}。`,updated_at:new Date().toISOString(),input_type:"none",options:[]});return}ua.mutate({sessionId:B.id,panelId:ee.panel_id,optionId:b})}},[ee,ua,q,B.id]),ad=_.useCallback(b=>{ee&&ua.mutate({sessionId:B.id,panelId:ee.panel_id,text:b})},[ee,ua,B.id]),xh=_.useCallback(b=>{Ks.mutate({sessionId:B.id,requestId:b.requestId,optionId:b.optionId??null,text:b.text??null,answers:b.answers})},[Ks,B.id]),Sh=_.useCallback(b=>{const D=[...b];D.length!==0&&(U(null),Promise.all(D.map(K=>S1(K))).then(K=>{je(le=>[...le,...K])}).catch(K=>{U(K instanceof Error?K.message:"无法读取附件")}))},[]),jh=_.useCallback(b=>{je(D=>D.filter(K=>K.id!==b))},[]),wh=_.useCallback(()=>{As.isPending||de||As.mutate(B.id)},[As,de,B.id]),kh=_.useCallback(()=>{rn(b=>!b)},[]),Cn=_.useCallback(b=>{b==="git"&&!yn||b==="terminal"&&!sn||(Ie(null),$e(null),Ee(!1),at(!1),qe(!1),ln(b))},[yn,sn]);_.useEffect(()=>{if(!Ri)return;const b=D=>{var le,et;const K=D.target;K instanceof Node&&((le=C.current)!=null&&le.contains(K)||(et=I.current)!=null&&et.contains(K)||Cn("code"))};return window.addEventListener("pointerdown",b),()=>{window.removeEventListener("pointerdown",b)}},[Cn,Ri]);const qr=_.useCallback(()=>{Ie(null),Va.refetch()},[Va]),id=_.useCallback(()=>{ys.refetch()},[ys]),rd=_.useCallback(()=>{ys.data||ys.isFetching||ys.refetch()},[ys]),ld=_.useCallback(b=>{Nn.mutate({action:"discard-file",path:b})},[Nn]),od=_.useCallback(()=>{Nn.mutate({action:"discard-all"})},[Nn]),cc=_.useCallback(b=>{Nn.mutate({action:"commit-all",message:b})},[Nn]),Nh=_.useCallback(async(b,D)=>{Ie(null);const K=(D==null?void 0:D.trim())??"";K&&await Nn.mutateAsync({action:"commit-all",message:K}),await Nn.mutateAsync({action:"switch-branch",branch:b})},[Nn]),Li=_.useCallback(()=>{Nn.mutate({action:"push"})},[Nn]),uc=_.useCallback(async(b,D,K)=>(await Ft()).client.getSessionGitHistoryFileDiff(B.id,{commitOid:b,path:D,previousPath:K}),[Ft,B.id]),$r=_.useCallback(async(b,D)=>(await Ft()).client.getSessionGitWorkspaceFileDiff(B.id,{path:b,previousPath:D}),[Ft,B.id]),$l=_.useCallback(b=>{Zt.mutate({action:"run-command",commandId:b})},[Zt]),dc=_.useCallback(async()=>{if(!(Za.length===0||pn||xn)){Pn(!0);try{for(const b of Za)await Zt.mutateAsync({action:"run-command",commandId:b.id})}finally{Pn(!1)}}},[pn,xn,Za,Zt]),Aa=_.useCallback(async()=>{if(pn||xn)return;const b=Za.filter(D=>!!D.kill_command);if(b.length!==0){ps(!0);try{for(const D of b)await Zt.mutateAsync({action:"run-kill-command",commandId:D.id})}finally{ps(!1)}}},[pn,xn,Za,Zt]),Ii=_.useCallback(b=>{Zt.mutate({action:"run-kill-command",commandId:b})},[Zt]),Hl=_.useCallback(b=>{Ys.mutate({action:b.commandId?"update":"create",commandId:b.commandId,command:b.draft})},[Ys]),fc=_.useCallback(b=>{Ys.mutate({action:"delete",commandId:b})},[Ys]),Da=_.useCallback(()=>{Dr.mutate()},[Dr]),hc=_.useCallback(b=>{Ds.mutate({action:b.websiteId?"update":"create",websiteId:b.websiteId,website:b.draft})},[Ds]),mc=_.useCallback(b=>{Ds.mutate({action:"delete",websiteId:b})},[Ds]),pc=_.useCallback(()=>{Na.mutate()},[Na]),cd=_.useCallback(()=>{at(!1)},[]),Ch=_.useCallback(b=>{Zt.mutate({action:"focus",terminalId:b}),ln("terminal")},[Zt]),Th=_.useCallback(b=>{Zt.mutate({action:"close",terminalId:b})},[Zt]),ud=_.useCallback(()=>{!Vn||!sn||(ln("terminal"),qe(b=>!b))},[sn,Vn]),gc=_.useMemo(()=>{var b,D,K;return l.jsxs("div",{className:"conversation-topbar__title-actions",children:[l.jsx("button",{type:"button",className:"conversation-topbar__more",onClick:()=>Ue(le=>!le),"aria-label":"更多会话选项",children:l.jsx(dR,{})}),Ge&&Vn?l.jsxs("div",{className:"topbar-menu",role:"menu",children:[l.jsx("button",{type:"button",className:"topbar-menu__item",disabled:fn.isPending&&((b=fn.variables)==null?void 0:b.sessionId)===B.id,onClick:()=>void Ya(B.id,B.pinned?"unpin":"pin"),children:B.pinned?"取消置顶会话":"置顶会话"}),l.jsx("button",{type:"button",className:"topbar-menu__item",disabled:fn.isPending&&((D=fn.variables)==null?void 0:D.sessionId)===B.id,onClick:()=>{Ue(!1),Lt(!0)},children:"重命名会话"}),l.jsx("button",{type:"button",className:"topbar-menu__item is-danger",disabled:fn.isPending&&((K=fn.variables)==null?void 0:K.sessionId)===B.id,onClick:()=>void Ya(B.id,"delete"),children:"删除会话"})]}):null]})},[Ya,Ge,Vn,B.id,B.pinned,fn.isPending,(Kl=fn.variables)==null?void 0:Kl.sessionId]),Fl=_.useMemo(()=>sn||yn?l.jsxs("div",{className:"conversation-topbar__actions",children:[sn?l.jsxs("div",{className:"conversation-topbar__run-group",children:[l.jsx("button",{type:"button",className:`conversation-topbar__run-button ${He?"is-active":""}`,onClick:()=>{at(!1),Ee(b=>!b)},"aria-expanded":He,"aria-haspopup":"dialog","aria-label":"打开项目命令列表",children:l.jsx(vR,{})}),He?l.jsx("div",{className:"conversation-run-popover",role:"dialog","aria-label":"项目命令列表",children:l.jsx(PM,{commands:Za,nodeRuntime:(_s==null?void 0:_s.node_runtime)??null,error:Pl,pendingRunCommandId:ic,pendingKillCommandId:Ai,pendingDeleteCommandId:Xu,isSaving:Ys.isPending,isGenerating:Dr.isPending,isStartingAll:pn,isStoppingAll:xn,generationReason:gs,executionModelLabel:sc,onRun:$l,onRunAll:dc,onRunAllKill:Aa,onRunKill:Ii,onSave:Hl,onDelete:fc,onGenerate:Da})}):null]}):null,sn?l.jsxs("div",{className:"conversation-topbar__run-group",children:[l.jsx("button",{type:"button",className:`conversation-topbar__run-button ${Ut?"is-active":""}`,onClick:()=>{Ee(!1),at(b=>!b)},"aria-expanded":Ut,"aria-haspopup":"dialog","aria-label":"打开项目网页列表",children:l.jsx(_R,{})}),Ut?l.jsx("div",{className:"conversation-run-popover",role:"dialog","aria-label":"项目网页列表",children:l.jsx(QM,{websites:Yu,error:Pl,pendingDeleteWebsiteId:Ju,isSaving:Ds.isPending,isGenerating:Na.isPending,generationReason:Ci,executionModelLabel:sc,onOpen:cd,onSave:hc,onDelete:mc,onGenerate:pc})}):null]}):null,sn||yn?l.jsxs("div",{ref:I,className:"conversation-topbar__view-toggle","aria-label":"切换工作台面板",children:[l.jsx("button",{type:"button",className:`conversation-topbar__view-button ${nn==="code"?"is-active":""}`,onClick:()=>Cn("code"),"aria-pressed":nn==="code","aria-label":"切换到代码会话视图",children:l.jsx(pR,{})}),sn?l.jsx("button",{type:"button",className:`conversation-topbar__view-button ${nn==="terminal"?"is-active":""}`,onClick:()=>Cn("terminal"),"aria-pressed":nn==="terminal","aria-label":"切换到终端视图",children:l.jsx(yR,{})}):null,yn?l.jsx("button",{type:"button",className:`conversation-topbar__view-button ${nn==="git"?"is-active":""}`,onClick:()=>Cn("git"),"aria-pressed":nn==="git","aria-label":"切换到 git 视图",children:l.jsx(gR,{})}):null]}):null]}):null,[nn,yn,sn,gs,Ci,pn,xn,sc,Dr.isPending,Na.isPending,fc,Da,mc,pc,cd,$l,dc,Aa,Hl,hc,Cn,He,Ut,Xu,Ju,ic,Za,Yu,Pl,Ys.isPending,Ds.isPending]),zs=l.jsx(OM,{workspace:Va.data??null,history:ys.data??null,isLoading:Va.isPending,isHistoryLoading:ys.isFetching,error:vh,historyError:_h,onRefresh:qr,onRefreshHistory:id,onRequestHistory:rd,onDiscardFile:ld,onDiscardAll:od,onCommitAll:cc,onSwitchBranch:Nh,onPush:Li,onLoadWorkspaceFileDiff:$r,onLoadHistoryFileDiff:uc,pendingAction:yh,compact:Zu}),Ql=l.jsx(eR,{terminals:(Zs==null?void 0:Zs.terminals)??[],activeTerminalId:(Ur==null?void 0:Ur.id)??null,outputs:Gs,error:Pl,compact:Ri||Ma,canToggleFullscreen:Vn,isFullscreen:Ma,onSelectTerminal:Ch,onCloseTerminal:Th,onToggleFullscreen:ud}),bs=l.jsx(C1,{isDesktopSidebar:Vn,sidebarShift:nc,isSidebarDragging:Bl,composerError:E,onDismissComposerError:Ul,interactionRequests:Ka,pendingInteractionRequestId:Re,onRespondInteraction:xh,parentSession:dn,backgroundAgentSessions:es,isBackgroundAgentsOpen:Bn,planSnapshot:oh,onToggleBackgroundAgents:ed,onOpenSession:td,getBackgroundAgentStatusLabel:$R,getBackgroundAgentAccent:PR,formatBackgroundAgentsLabel:DR,hasBackgroundAgentStrip:fh,commandPanel:ee,isCommandPanelPending:Ol.isPending||ua.isPending,onDismissCommandPanel:nd,onCommandPanelOptionSelect:sd,onCommandPanelTextSubmit:ad,projectId:B.project_id,draft:Y,pendingAttachments:_e,canSendInput:Jo,isInputLocked:Ka.length>0,readOnlyPlaceholder:Ka.length>0?"请先处理上方确认请求":void 0,onDraftChange:H,onUploadFiles:Sh,onRemoveAttachment:jh,onSubmit:oc,showStopIcon:Lr,isSendPending:ka.isPending||Ol.isPending||ua.isPending,onInterrupt:wh,isFastModeEnabled:Q,isPlanModeEnabled:Ce,onToggleFastMode:()=>pe(b=>!b),onTogglePlanMode:()=>Le(b=>!b),showModeBadges:!0,selectedModel:xe,modelOptions:q,selectedReasoning:ne,onSelectModel:A,onSelectReasoning:b=>be(b),contextUsage:Ls,isContextUsageOpen:kt,onToggleContextUsage:kh,contextUsageRingStyle:uh,usedPercent:Il,remainingPercent:ch,usedTokensLabel:_0((Ls==null?void 0:Ls.used_tokens)??0),totalTokensLabel:_0((Ls==null?void 0:Ls.total_tokens)??0),showJumpToBottom:xa,onJumpToBottom:Sa}),Wa=Ea?Ql:zs,Hr=Wu||Ma?l.jsxs("div",{ref:N,className:`conversation-main ${Vn?"has-desktop-sidebar":""} ${Ma?"is-terminal-fullscreen":""}`,style:{transform:`translateX(${nc}px)`,transition:Bl?"none":void 0},children:[l.jsxs("div",{className:"conversation-topbar",children:[Vn?null:l.jsxs("button",{type:"button",className:"conversation-menu",onClick:Oi,"aria-label":"打开侧边栏",children:[l.jsx("span",{}),l.jsx("span",{className:"short"})]}),l.jsx("div",{className:"conversation-topbar__meta",children:l.jsxs("div",{className:"conversation-topbar__title-row",children:[l.jsx("h1",{children:B.title}),gc]})}),Fl]}),l.jsx("div",{ref:T,className:"conversation-scroll",children:l.jsx("div",{className:`session-workbench-surface ${Ma?"is-terminal-fullscreen":""}`,children:Wa})})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:`session-detail-workspace ${Ri?"has-workbench-panel":""}`,children:[l.jsx(tR,{conversationMainRef:N,conversationScrollRef:T,isDesktopSidebar:Vn,sidebarShift:nc,isSidebarDragging:Bl,title:B.title,titleActions:gc,topbarActions:Fl,onOpenSidebar:Oi,threadContent:Br,connectionStatus:rs,isConnectionDetailOpen:ge,onToggleConnectionDetail:bh,showThinkingStatus:dh}),Ri?l.jsx("aside",{ref:C,className:"session-workbench-rail",children:Wa}):null]}),Ma?null:bs]}),Fr=l.jsxs(l.Fragment,{children:[hh,mh,ae&&typeof document<"u"?or.createPortal(l.jsxs("div",{className:"attachment-lightbox",role:"dialog","aria-modal":"true","aria-label":`预览 ${ae.label}`,children:[l.jsx("button",{type:"button",className:"attachment-lightbox__scrim",onClick:()=>ce(null),"aria-label":"关闭图片预览"}),l.jsxs("div",{className:"attachment-lightbox__panel",children:[l.jsx("button",{type:"button",className:"attachment-lightbox__close",onClick:()=>ce(null),"aria-label":"关闭图片预览",children:l.jsx(mR,{})}),l.jsx("div",{className:"attachment-lightbox__frame",children:l.jsx("img",{src:ae.src,alt:ae.label,className:"attachment-lightbox__image"})}),l.jsxs("div",{className:"attachment-lightbox__meta",children:[l.jsx("div",{className:"attachment-lightbox__title",children:ae.label}),l.jsx("div",{className:"attachment-lightbox__hint",children:ae.meta})]})]})]}),document.body):null]});return t?l.jsxs(l.Fragment,{children:[Hr,Fr]}):l.jsxs("div",{ref:k,className:`conversation-page ${R?"has-desktop-sidebar":""}`,style:gh,onPointerDown:b=>{R||b.pointerType==="mouse"&&b.button!==0||Fu(b.target)||(rc(b.clientX,b.clientY,b.pointerId),b.currentTarget.setPointerCapture(b.pointerId))},onPointerMove:b=>{if(R)return;const D=Ht.current;!D||D.pointerId!==b.pointerId||!lc(b.clientX,b.clientY)||b.preventDefault()},onPointerUp:b=>{if(R)return;const D=Ht.current;!D||D.pointerId!==b.pointerId||Di(b.clientX,b.clientY)},onPointerCancel:b=>{if(R)return;const D=Ht.current;!D||D.pointerId!==b.pointerId||(Ht.current=null,Ra(null))},children:[l.jsx(i1,{open:Vu,progress:ph,isDragging:zl,desktopPinned:R,isDesktopResizing:ie,onClose:()=>{R||($(!1),Ra(null))},onDesktopResizeStart:b=>{Ln.current=kn.current,wn.current={startX:b,startWidth:kn.current},te(!0)},currentAgent:on,projects:oa,sessions:qn,activeSessionId:B.id,onCreateSession:b=>{tc(b)},onSessionAction:Ya,onThreadAction:ec,pendingSessionActionId:fn.isPending?((_c=fn.variables)==null?void 0:_c.sessionId)??null:null,pendingThreadActionId:da.isPending?((Yl=da.variables)==null?void 0:Yl.projectId)??null:null}),Hr,Fr]})},d4=({mode:s,agentName:t,agentStatus:a,onOpenNodes:r,onCreateThread:c})=>{if(s==="node")return l.jsxs("section",{className:"session-empty-state is-node-mode",children:[l.jsx("div",{className:"session-empty-state__eyebrow",children:"Panda Workspace"}),l.jsx("div",{className:"session-empty-state__actions",children:l.jsx("button",{type:"button",className:"session-empty-state__button is-primary",onClick:r,children:"选择节点"})})]});const u=a==="online";return l.jsxs("section",{className:"session-empty-state is-session-mode",children:[l.jsxs("div",{className:"session-empty-state__status-row",children:[l.jsx("span",{className:`session-empty-state__status-dot is-${u?"online":"offline"}`,"aria-hidden":"true"}),l.jsxs("div",{className:"session-empty-state__eyebrow",children:["节点 · ",t??"当前节点"]})]}),l.jsxs("div",{className:"session-empty-state__actions",children:[c?l.jsx("button",{type:"button",className:"session-empty-state__button is-primary",onClick:c,children:"新建会话"}):null,l.jsx("button",{type:"button",className:"session-empty-state__button",onClick:r,children:"切换节点"})]})]})},S0=1100,L1="panda:desktop-sidebar-width",mu="panda:desktop-sidebar-width-version",pu="2026-03-24-narrow",f4=300,I1=232,wo=I1,h4=460,m4=.4,p4=()=>typeof window>"u"?248:Math.max(0,Math.min(248,window.innerWidth-84)),Ng=s=>Math.max(I1,Math.min(h4,s)),g4=()=>{if(typeof window>"u")return wo;try{const s=window.localStorage.getItem(L1),t=window.localStorage.getItem(mu);if(!s)return window.localStorage.setItem(mu,pu),wo;const a=Number(s);if(!Number.isFinite(a))return window.localStorage.setItem(mu,pu),wo;const c=t!==pu||a===f4||a>wo?wo:a;return window.localStorage.setItem(mu,pu),Ng(c)}catch{return wo}},hy=()=>{var tn,$t;const{sessionId:s,agentId:t}=Pu({strict:!1}),a=Mr(),r=Tl(),c=_.useRef(null),u=_.useRef(null),[h,p]=_.useState(()=>cT()),[y,m]=_.useState(()=>uT()??Eu()),[x,g]=_.useState(()=>dT()),[S,k]=_.useState(()=>fT()?"directory-picker":"composer"),[N,T]=_.useState(!1),[C,I]=_.useState(()=>typeof window<"u"&&window.innerWidth>=S0),[V,$]=_.useState(()=>g4()),[R,G]=_.useState(!1),[ue,Z]=_.useState(null),ie=_.useRef(null),te=_.useRef(null),Y=_.useRef(null),H=_.useRef(V),_e=_.useRef(null),je=_.useRef(null),ae=s?{sessionId:s,agentId:t??h}:{agentId:t??h},{data:ce}=Uu({queryKey:dt,scope:ae}),E=(ce==null?void 0:ce.sessions.find(de=>de.id===s))??null;_.useEffect(()=>{if(ce){if(t&&ce.agents.some(de=>de.id===t)&&(p(t),xr(t),s||m(null)),E!=null&&E.agent_id&&u.current!==E.id){u.current=E.id,p(E.agent_id),m(E.id),g(null),xr(E.agent_id),ds(E.id);return}s||(u.current=null),p(de=>de&&ce.agents.some(Ae=>Ae.id===de)?de:null),m(de=>de&&ce.sessions.some(Ae=>Ae.id===de)?de:null)}},[t,E==null?void 0:E.agent_id,E==null?void 0:E.id,s,ce]),_.useEffect(()=>{t||s||h||(hT(),a({to:"/nodes",replace:!0}))},[a,t,s,h]),_.useEffect(()=>{if(!ce||t||s||!h||y)return;const de=Eu(),Ae=ce.sessions.find(Re=>Re.id===de&&Re.agent_id===h)??null;Ae&&(m(Ae.id),ds(Ae.id))},[t,s,h,y,ce]);const U=(h?ce==null?void 0:ce.agents.find(de=>de.id===h):null)??null,ee=_.useMemo(()=>U?((ce==null?void 0:ce.projects)??[]).filter(de=>de.agent_id===U.id):[],[U,ce==null?void 0:ce.projects]),W=_.useMemo(()=>U?((ce==null?void 0:ce.sessions)??[]).filter(de=>de.agent_id===U.id).sort((de,Ae)=>Number(Ae.pinned)-Number(de.pinned)||+new Date(Ae.last_event_at)-+new Date(de.last_event_at)):[],[U,ce==null?void 0:ce.sessions]),xe=y&&U?W.find(de=>de.id===y)??null:null;_.useEffect(()=>{if(xe)return;let de=!1,Ae;return Xn({sessionId:s,agentId:t??h??(U==null?void 0:U.id)??null}).then(Re=>{de||(Ae=Re.client.connectEvents(Oe=>{var mt,kt;const Ke=typeof((mt=Oe.payload)==null?void 0:mt.sessionId)=="string"?Oe.payload.sessionId:null;if(Oe.type==="agent.online"||Oe.type==="snapshot.changed"){r.invalidateQueries({queryKey:dt});return}if(Oe.type==="session.updated"&&Ke){const rn=(kt=Oe.payload)!=null&&kt.sessionPatch&&typeof Oe.payload.sessionPatch=="object"?Oe.payload.sessionPatch:null,Bn=r.getQueryData(dt);if(rn&&ty(Bn,Ke)){r.setQueryData(dt,On=>kf(On,Ke,rn));return}r.invalidateQueries({queryKey:dt})}}))}),()=>{de=!0,Ae==null||Ae()}},[xe,U==null?void 0:U.id,r,t,s,h]),_.useEffect(()=>{H.current=V},[V]),_.useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(L1,String(Ng(V))),window.localStorage.setItem(mu,pu)}catch{}},[V]),_.useEffect(()=>{if(typeof window>"u")return;const de=()=>{const Ae=window.innerWidth>=S0;I(Ae),Ae&&(T(!1),Z(null))};return de(),window.addEventListener("resize",de),()=>{window.removeEventListener("resize",de)}},[]),_.useEffect(()=>{if(!R)return;const de=Re=>{const Oe=Y.current;if(!Oe)return;const Ke=Re.clientX-Oe.startX,mt=Ng(Oe.startWidth+Ke);_e.current=mt,je.current===null&&(je.current=window.requestAnimationFrame(()=>{je.current=null;const kt=_e.current;kt!==null&&$(kt)}))},Ae=()=>{je.current!==null&&(window.cancelAnimationFrame(je.current),je.current=null);const Re=_e.current??H.current;_e.current=null,Y.current=null,G(!1),H.current=Re,$(Re)};return window.addEventListener("pointermove",de),window.addEventListener("pointerup",Ae),()=>{window.removeEventListener("pointermove",de),window.removeEventListener("pointerup",Ae)}},[R]),_.useEffect(()=>()=>{je.current!==null&&window.cancelAnimationFrame(je.current)},[]);const A=Gn({mutationFn:async de=>(await Xn({sessionId:de.sessionId})).client.updateSession(de)}),ne=Gn({mutationFn:async de=>(await Xn({projectId:de.projectId})).client.updateThread(de)}),be=async(de,Ae,Re)=>{var mt;const Oe=await A.mutateAsync({sessionId:de,action:Ae,name:Re}),Ke=(mt=Oe.affectedSessionIds)!=null&&mt.length?Oe.affectedSessionIds:[de];if(Ae==="delete"?r.setQueryData(dt,kt=>XS(kt,Ke)):r.setQueryData(dt,kt=>WS(kt,Ke,{...Ae==="rename"&&(Re!=null&&Re.trim())?{title:Re.trim()}:{pinned:Ae==="pin"}})),Ae==="delete"&&y===de){const kt=Oe.nextSessionId;kt?(ds(kt),m(kt)):(ds(null),m(null))}},Q=async(de,Ae,Re)=>{var mt,kt;const Oe=await ne.mutateAsync({projectId:de,action:Ae,name:Re==null?void 0:Re.name,orderedProjectIds:Re==null?void 0:Re.orderedProjectIds}),Ke=(mt=Re==null?void 0:Re.name)==null?void 0:mt.trim();Ae==="pin"||Ae==="unpin"?r.setQueryData(dt,rn=>Kf(rn,de,{pinned:Ae==="pin"})):Ae==="rename"&&Ke?r.setQueryData(dt,rn=>Kf(rn,de,{display_name:Ke})):Ae==="reorder"&&((kt=Re==null?void 0:Re.orderedProjectIds)!=null&&kt.length)?r.setQueryData(dt,rn=>JS(rn,Re.orderedProjectIds??[])):Ae==="remove"||Ae==="archive"?r.setQueryData(dt,rn=>e1(rn,de)):Ae==="unarchive"&&r.invalidateQueries({queryKey:dt}),xe&&xe.project_id===de&&(Ae==="remove"||Ae==="archive"||Ae==="unarchive")&&(Oe.nextSessionId?(ds(Oe.nextSessionId),m(Oe.nextSessionId)):(ds(null),m(null)))},pe=async de=>{U&&(xr(U.id),ds(null),Mu(null),ru(!1),Eo(de),g(de),k("composer"),m(null),await a({to:"/"}))},Ce=async()=>{U&&(C||(T(!1),Ge(null)),xr(U.id),ds(null),Mu(null),Eo(null),ru(!0),g(null),k("directory-picker"),m(null),await a({to:"/"}))},Le=async de=>{await pe(de)},he=C?0:p4(),q=C||N,Se=C?0:ue??(N?he:0),Ne=C?1:he>0?Se/he:0,me=!C&&ue!==null,Te=C?{"--desktop-sidebar-width":`${V}px`}:void 0,Ge=de=>{ie.current=de,Z(de)},Ue=de=>de instanceof Element&&!!de.closest('button, textarea, input, a, [role="dialog"]'),gt=(de,Ae,Re)=>(te.current={mode:N?"close":"open",startX:de,startY:Ae,axis:"pending",pointerId:Re},!0),Lt=(de,Ae)=>{const Re=te.current;if(!Re)return!1;const Oe=de-Re.startX,Ke=Ae-Re.startY;if(Re.axis==="pending"){if(Math.abs(Oe)<8&&Math.abs(Ke)<8)return!1;if(Re.axis=Math.abs(Oe)>Math.abs(Ke)?"x":"y",Re.axis==="y")return te.current=null,Ge(null),!1}const mt=Re.mode==="open"?Math.max(0,Math.min(he,Oe)):Math.max(0,Math.min(he,he+Oe));return Ge(mt),!0},St=(de,Ae)=>{const Re=te.current;if(!Re)return;const Oe=de-Re.startX,Ke=Ae-Re.startY;if(Re.axis==="pending"&&Math.abs(Ke)>48){te.current=null,Ge(null);return}const kt=(Re.axis==="x"?ie.current??(Re.mode==="open"?Math.max(0,Math.min(he,Oe)):Math.max(0,Math.min(he,he+Oe))):N?he:0)>=he*m4;T(kt),te.current=null,Ge(null)},st=()=>l.jsx(l.Fragment,{children:l.jsxs("div",{className:`conversation-main ${C?"has-desktop-sidebar":""}`,style:{transform:`translateX(${Se}px)`,transition:me?"none":void 0},children:[l.jsx("div",{className:"conversation-topbar",children:C?null:l.jsxs("button",{type:"button",className:"conversation-menu",onClick:()=>T(!0),"aria-label":"打开侧边栏",children:[l.jsx("span",{}),l.jsx("span",{className:"short"})]})}),l.jsx("div",{className:"conversation-scroll conversation-scroll--empty",children:l.jsx("div",{className:"conversation-thread conversation-thread--empty",children:l.jsx(d4,{mode:"node",agentName:U==null?void 0:U.name,agentStatus:(U==null?void 0:U.status)??null,onOpenNodes:()=>{a({to:"/nodes"})}})})})]})});return l.jsxs("div",{ref:c,className:`conversation-page ${C?"has-desktop-sidebar":""}`,style:Te,onPointerDown:de=>{C||de.pointerType==="mouse"&&de.button!==0||Ue(de.target)||(gt(de.clientX,de.clientY,de.pointerId),de.currentTarget.setPointerCapture(de.pointerId))},onPointerMove:de=>{if(C)return;const Ae=te.current;!Ae||Ae.pointerId!==de.pointerId||!Lt(de.clientX,de.clientY)||de.preventDefault()},onPointerUp:de=>{if(C)return;const Ae=te.current;!Ae||Ae.pointerId!==de.pointerId||St(de.clientX,de.clientY)},onPointerCancel:de=>{if(C)return;const Ae=te.current;!Ae||Ae.pointerId!==de.pointerId||(te.current=null,Ge(null))},children:[l.jsx(i1,{open:q,progress:Ne,isDragging:me,desktopPinned:C,isDesktopResizing:R,onClose:()=>{C||(T(!1),Ge(null))},onDesktopResizeStart:de=>{_e.current=H.current,Y.current={startX:de,startWidth:H.current},G(!0)},currentAgent:U??void 0,projects:ee,sessions:W,activeSessionId:xe==null?void 0:xe.id,onCreateSession:de=>{Le(de)},onCreateDirectoryThread:()=>{Ce()},onSelectSession:de=>{g(null),k("composer"),ru(!1),Eo(null),m(de),ds(de)},onSessionAction:be,onThreadAction:Q,pendingSessionActionId:A.isPending?((tn=A.variables)==null?void 0:tn.sessionId)??null:null,pendingThreadActionId:ne.isPending?(($t=ne.variables)==null?void 0:$t.projectId)??null:null}),U?xe?l.jsx(u4,{sessionId:xe.id,embedded:!0,isDesktopSidebar:C,sidebarOffset:Se,isSidebarDragging:me,onOpenSidebar:()=>T(!0),onSelectSession:de=>{m(de),ds(de)},onExitToNodes:()=>{m(null),a({to:"/nodes"})}}):l.jsx(bM,{currentAgent:U,projects:ee,sessions:W,initialProjectId:x,entryView:S,isDesktopSidebar:C,sidebarOffset:Se,isSidebarDragging:me,onOpenSidebar:()=>T(!0),onProjectSelected:de=>{g(de),k("composer"),ru(!1)},onSessionCreated:de=>{g(null),k("composer"),ru(!1),Eo(null),m(de),ds(de)}}):st()]})},y4=async()=>{if("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 s=window.indexedDB;if(typeof s.databases=="function"){const t=await s.databases();await Promise.all(t.map(a=>a.name).filter(a=>!!a).map(a=>new Promise(r=>{const c=s.deleteDatabase(a);c.onsuccess=()=>r(),c.onerror=()=>r(),c.onblocked=()=>r()})))}window.localStorage.clear(),window.sessionStorage.clear()},j0=980,vf=[{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:"connection",title:"连接状态",description:"查看现在连到哪台设备。",icon:"connection"}],v4=[{value:"light",label:"浅色",icon:"sun"},{value:"dark",label:"深色",icon:"moon"},{value:"system",label:"系统",icon:"system"}],_4=(s,t,a,r)=>["const pandaTheme = {",` codeThemeId: "${s}",`,` accent: "${t.toLowerCase()}",`,` contrast: ${a},`,` opaqueWindows: ${r},`,"}"],b4=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"m15 6-6 6 6 6"})}),x4=({open:s})=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:s?"m6 9 6 6 6-6":"m9 6 6 6-6 6"})}),S4=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"M9 6h.01M9 12h.01M9 18h.01M15 6h.01M15 12h.01M15 18h.01"})}),j4=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"M12 5v14M5 12h14"})}),w4=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.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"}),l.jsx("path",{d:"m13.5 6.5 4 4"})]}),k4=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M4.5 7h15"}),l.jsx("path",{d:"M9.5 4.5h5"}),l.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"}),l.jsx("path",{d:"M10 10.5v5.2"}),l.jsx("path",{d:"M14 10.5v5.2"})]}),N4=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"m12 6-5 5M12 6l5 5M12 6v12"})}),C4=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"m12 18-5-5M12 18l5-5M12 18V6"})}),w0=({icon:s})=>s==="cache"?l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.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"}),l.jsx("path",{d:"M5 8.5v7c0 1.93 3.13 3.5 7 3.5s7-1.57 7-3.5v-7"}),l.jsx("path",{d:"M5 12c0 1.93 3.13 3.5 7 3.5s7-1.57 7-3.5"})]}):s==="models"?l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M5 7.5h14M5 12h14M5 16.5h14"}),l.jsx("path",{d:"M8 5.5h.01M8 10h.01M8 14.5h.01"})]}):s==="connection"?l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.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"}),l.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"})]}):s==="notifications"?l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.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"}),l.jsx("path",{d:"M10 18.25a2.1 2.1 0 0 0 4 0"})]}):l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.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"}),l.jsx("circle",{cx:"12",cy:"12",r:"3.85"})]}),T4=({icon:s,active:t})=>{const a=t?2:1.8;return s==="sun"?l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:a,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("circle",{cx:"12",cy:"12",r:"4.1"}),l.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"})]}):s==="moon"?l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:a,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.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"})}):l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:a,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("rect",{x:"3.5",y:"5",width:"17",height:"12",rx:"2.4"}),l.jsx("path",{d:"M8 19h8"})]})},E4=({title:s,caption:t,accent:a,background:r,foreground:c,lines:u})=>l.jsxs("div",{className:"theme-preview-panel",style:{"--preview-accent":a,"--preview-background":r,"--preview-foreground":c},children:[l.jsxs("div",{className:"theme-preview-panel__meta",children:[l.jsx("span",{children:s}),l.jsx("span",{children:t})]}),l.jsx("pre",{className:"theme-preview-panel__code","aria-label":`${s} 主题预览`,children:u.map(h=>l.jsx("code",{children:h},h))})]}),ko=({label:s,value:t})=>l.jsxs("div",{className:"settings-row settings-row--token",children:[l.jsx("div",{className:"settings-row__copy",children:l.jsx("span",{className:"settings-row__label",children:s})}),l.jsxs("div",{className:"theme-token",children:[l.jsx("span",{className:"theme-token__swatch",style:{"--token-color":t}}),l.jsx("span",{children:t})]})]}),_f=({label:s,value:t})=>l.jsxs("div",{className:"settings-row settings-row--token",children:[l.jsx("div",{className:"settings-row__copy",children:l.jsx("span",{className:"settings-row__label",children:s})}),l.jsx("div",{className:"theme-token",children:t})]}),k0=({label:s,value:t,mono:a})=>l.jsxs("div",{className:"settings-row settings-row--token",children:[l.jsx("div",{className:"settings-row__copy",children:l.jsx("span",{className:"settings-row__label",children:s})}),l.jsx("div",{className:`theme-token theme-token--font ${a?"is-mono":""}`,children:t})]}),N0=({label:s,value:t,onChange:a,min:r,max:c})=>l.jsxs("div",{className:"settings-row settings-row--size",children:[l.jsx("div",{className:"settings-row__copy",children:l.jsx("span",{className:"settings-row__label",children:s})}),l.jsxs("div",{className:"theme-stepper",children:[l.jsx("button",{type:"button",className:"theme-stepper__button",onClick:()=>a(t-1),"aria-label":`${s} 减小 1px`,children:"-"}),l.jsxs("label",{className:"theme-stepper__input-wrap",children:[l.jsx("input",{className:"theme-stepper__input",type:"number",min:r,max:c,step:1,value:t,onChange:u=>a(Number(u.target.value))}),l.jsx("span",{children:"px"})]}),l.jsx("button",{type:"button",className:"theme-stepper__button",onClick:()=>a(t+1),"aria-label":`${s} 增大 1px`,children:"+"})]})]}),C0=(s,t,a,r)=>{if(t===a)return s;const c=s.findIndex(x=>x.id===t),u=s.findIndex(x=>x.id===a);if(c<0||u<0)return s;const h=[...s],[p]=h.splice(c,1);if(!p)return s;const y=h.findIndex(x=>x.id===a),m=r==="before"?y:y+1;return h.splice(m,0,p),h},M4=()=>{var rs;const s=Mr(),t=Tl(),{data:a}=Uu(),[r,c]=_.useState(!1),[u,h]=_.useState(null),[p,y]=_.useState(null),[m,x]=_.useState("theme"),[g,S]=_.useState(null),[k,N]=_.useState(()=>typeof window<"u"&&window.innerWidth>=j0),[T,C]=_.useState(()=>mg()),[I,V]=_.useState(()=>pg()),[$,R]=_.useState(null),[G,ue]=_.useState(!1),[Z,ie]=_.useState(()=>Ep()),[te,Y]=_.useState(()=>Ex()),H=va(j=>j.themeSettings),_e=va(j=>j.resolvedTheme),je=va(j=>j.systemAppearance),ae=va(j=>j.setThemeMode),ce=va(j=>j.setLightThemeId),E=va(j=>j.setDarkThemeId),U=va(j=>j.setUiFontSize),ee=va(j=>j.setCodeFontSize),W=oy(),[xe,A]=_.useState(()=>ry()),[ne,be]=_.useState(()=>Cf()),[Q,pe]=_.useState(null),[Ce,Le]=_.useState(()=>ou()),[he,q]=_.useState(null),[Se,Ne]=_.useState(null),[me,Te]=_.useState(null),Ge=typeof window>"u"?null:Eu(),Ue=(a==null?void 0:a.sessions.find(j=>j.id===Ge))??(a==null?void 0:a.sessions.find(j=>j.id===a.active_session_id))??(a==null?void 0:a.sessions.find(j=>!j.archived))??(a==null?void 0:a.sessions[0]),gt=(a==null?void 0:a.agents.find(j=>j.id===(Ue==null?void 0:Ue.agent_id)))??(a==null?void 0:a.agents[0]),Lt=Es({queryKey:["settings-connection"],queryFn:async()=>{const j=await Xn(),z=await fetch(`${j.baseUrl}/health`);return{modeLabel:j.mode==="hub"?"通过 Panda Hub":"直接连接",backendLabel:j.label,backendUrl:j.baseUrl,healthOk:z.ok}}}),St=Es({queryKey:["codex-commands"],queryFn:async()=>(await Xn()).client.getCodexCommands(),staleTime:0,refetchOnWindowFocus:!1}),st=Gn({mutationFn:async()=>(await Xn()).client.refreshCodexCommands(),onMutate:()=>{h(null)},onSuccess:async j=>{t.setQueryData(["codex-commands"],j),await t.invalidateQueries({queryKey:["codex-commands"]}),h(`命令目录已刷新,共 ${j.commands.length} 条,CLI 版本 ${j.cli_version??"未知"}。`)},onError:j=>{h(j instanceof Error?j.message:"刷新命令目录失败。")}});_.useEffect(()=>{if(typeof window>"u")return;const j=()=>{const z=window.innerWidth>=j0;N(z)};return j(),window.addEventListener("resize",j),()=>{window.removeEventListener("resize",j)}},[]),_.useEffect(()=>{h(null)},[(rs=Lt.data)==null?void 0:rs.backendUrl]),_.useEffect(()=>{k&&S(m)},[m,k]),_.useEffect(()=>{q(null)},[m]),_.useEffect(()=>{if(typeof window>"u")return;const j=we=>{we.preventDefault(),R(we)},z=()=>{R(null),ie(!0),y("应用已安装到桌面。")},ge=()=>{V(pg()),C(mg()),ie(Ep()),Y(Ex())};return window.addEventListener("beforeinstallprompt",j),window.addEventListener("appinstalled",z),document.addEventListener("visibilitychange",ge),()=>{window.removeEventListener("beforeinstallprompt",j),window.removeEventListener("appinstalled",z),document.removeEventListener("visibilitychange",ge)}},[]),_.useEffect(()=>{if(W.length===0||W.some(z=>z.value===xe))return;const j=W[0].value;_u(j),A(j)},[W,xe]),_.useEffect(()=>{var z;if(W.length===0||W.some(ge=>ge.value===ne))return;const j=((z=W.find(ge=>ge.value==="gpt-5.4-mini"))==null?void 0:z.value)??W[0].value;Dp(j),be(j)},[ne,W]);const tn=()=>{if(Ue!=null&&Ue.id){xr(Ue.agent_id),ds(Ue.id),s({to:"/"});return}s({to:"/nodes"})},$t=async()=>{h(null),c(!0);try{await y4(),h("缓存已清理,正在重新载入…"),window.setTimeout(()=>{window.location.replace(`/settings?cache-reset=${Date.now()}`)},180)}catch{c(!1),h("清理失败,请在浏览器设置中手动清理站点数据。")}},de=async()=>{if(I!=="granted"){const z=await rT();if(V(z),z==="granted"){const ge={completionNotificationsEnabled:!0};Tx(ge),C(ge),y("系统通知已开启,后续对话完成会提醒你。");return}if(z==="denied"){y("系统通知已被拒绝,请到浏览器或系统设置里重新开启。");return}y("还没有拿到通知权限,可以稍后再试一次。");return}const j={completionNotificationsEnabled:!T.completionNotificationsEnabled};Tx(j),C(j),y(j.completionNotificationsEnabled?"完成提醒已开启。":"完成提醒已关闭。")},Ae=async()=>{if(!$){y(te?"请在浏览器菜单里选择“安装应用”或“添加到主屏幕”。":"当前浏览器没有提供安装弹窗,请使用浏览器的“添加到主屏幕”。");return}ue(!0),y(null);try{await $.prompt(),(await $.userChoice).outcome==="accepted"?y("安装请求已提交,请回到桌面查看。"):y("你取消了这次安装。")}finally{R(null),ue(!1),ie(Ep())}},Re=j=>{var z,ge,we;if(ME(j),!j.some(ke=>ke.value===xe)){const ke=((z=j[0])==null?void 0:z.value)??"";ke&&(_u(ke),A(ke))}if(!j.some(ke=>ke.value===ne)){const ke=((ge=j.find(Ve=>Ve.value==="gpt-5.4-mini"))==null?void 0:ge.value)??((we=j[0])==null?void 0:we.value)??"";ke&&(Dp(ke),be(ke))}},Oe=()=>{pe("new"),Le(ou()),q(null)},Ke=j=>{pe(j.id),Le({...j}),q(null)},mt=()=>{pe(null),Le(ou()),q(null)},kt=()=>{var Ve;const j=Ce.label.trim(),z=Ce.value.trim();if(!j||!z){q("请填写显示名和模型 ID。");return}if(W.find(ct=>ct.value.toLowerCase()===z.toLowerCase()&&ct.id!==Q)){q(`模型 ID ${z} 已存在。`);return}const we={...Ce,label:j,value:z,description:((Ve=Ce.description)==null?void 0:Ve.trim())||null},ke=Q==="new"?[...W,we]:W.map(ct=>ct.id===Q?we:ct);Re(ke),pe(null),Le(ou()),q(Q==="new"?"模型已添加。":"模型已更新。")},rn=j=>{const z=W.filter(ge=>ge.id!==j);if(z.length===0){q("至少保留一个模型。");return}Re(z),Q===j&&(pe(null),Le(ou())),q("模型已删除。")},Bn=j=>{_u(j),A(j),q(`默认模型已切换为 ${j}。`)},On=j=>{Dp(j),be(j),q(`命令执行模型已切换为 ${j}。`)},nn=(j,z)=>{const ge=W.findIndex(Ve=>Ve.id===j);if(ge<0)return;const we=z==="up"?ge-1:ge+1;if(we<0||we>=W.length)return;const ke=W[we];ke&&Re(C0(W,j,ke.id,z==="up"?"before":"after"))},ln=(j,z)=>{Ne(z),Te(null),j.dataTransfer.effectAllowed="move",j.dataTransfer.setData("text/plain",z)},oe=(j,z)=>{if(!Se||Se===z)return;j.preventDefault();const ge=j.currentTarget.getBoundingClientRect(),we=j.clientY<ge.top+ge.height/2?"before":"after";Te(ke=>(ke==null?void 0:ke.modelId)===z&&ke.position===we?ke:{modelId:z,position:we})},qe=j=>{!Se||!me||me.modelId!==j||(Re(C0(W,Se,j,me.position)),Ne(null),Te(null))},De=()=>{Ne(null),Te(null)},Ie=_e.appearance,We=Ie==="light"?gg:Ru,$e=Ie==="light"?H.lightThemeId:H.darkThemeId,He=We.find(j=>j.id===$e)??We[0],Ee=_e.activeTheme,Ut=_4(He.codeThemeId,He.accent,He.contrast,He.opaqueWindows),at=H.mode==="system"?`当前跟随系统:${je==="dark"?"深色":"浅色"}`:`当前固定为${_e.appearance==="dark"?"深色":"浅色"}模式`,pn="当前正在显示",Pn=He.opaqueWindows?"不透明窗口":"半透明窗口",xn=vf.find(j=>j.id===m)??vf[0],ps=`${He.label} · ${Pn} · 对比度 ${He.contrast}`,gs=W.find(j=>j.value===xe)??W[0]??null,as=W.find(j=>j.value===ne)??W.find(j=>j.value==="gpt-5.4-mini")??W[0]??null,Ci=()=>l.jsxs("div",{className:"settings-content-stack",children:[l.jsxs("section",{className:"settings-panel settings-panel--hero",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsxs("div",{children:[l.jsx("h3",{className:"settings-panel__title",children:"外观"}),l.jsx("p",{className:"settings-panel__subtitle",children:"先选浅色或深色,再挑一个你喜欢的风格。"})]})}),l.jsx("div",{className:"settings-control-grid",children:l.jsxs("div",{className:"settings-control-block settings-control-block--full",children:[l.jsx("span",{className:"settings-control-block__label",children:"显示方式"}),l.jsx("div",{className:"theme-mode-switch",role:"tablist","aria-label":"主题模式",children:v4.map(j=>{const z=j.value===H.mode;return l.jsxs("button",{type:"button",className:`theme-mode-switch__button ${z?"is-active":""}`,onClick:()=>ae(j.value),role:"tab","aria-selected":z,children:[l.jsx(T4,{icon:j.icon,active:z}),l.jsx("span",{children:j.label})]},j.value)})}),l.jsx("p",{className:"settings-control-block__hint",children:at})]})})]}),l.jsxs("div",{className:"settings-theme-layout",children:[l.jsxs("section",{className:"settings-panel",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:Ie==="light"?"浅色风格":"深色风格"})})}),l.jsxs("div",{className:"settings-theme-selector",children:[l.jsx("label",{className:"settings-select settings-select--wide",children:l.jsx("select",{value:He.id,onChange:j=>{if(Ie==="light"){ce(j.target.value);return}E(j.target.value)},"aria-label":Ie==="light"?"选择浅色主题":"选择深色主题",children:We.map(j=>l.jsx("option",{value:j.id,children:j.label},`${j.variant}-${j.id}`))})}),l.jsxs("div",{className:"settings-theme-selector__summary",children:[l.jsxs("div",{className:"settings-theme-selector__swatches","aria-hidden":"true",children:[l.jsx("span",{style:{"--theme-card-color":He.background}}),l.jsx("span",{style:{"--theme-card-color":He.foreground}}),l.jsx("span",{style:{"--theme-card-color":He.accent}}),l.jsx("span",{style:{"--theme-card-color":He.semanticColors.diffAdded}}),l.jsx("span",{style:{"--theme-card-color":He.semanticColors.diffRemoved}})]}),l.jsxs("div",{className:"settings-theme-selector__copy",children:[l.jsx("strong",{children:He.label}),l.jsx("span",{children:ps})]}),He.id===Ee.id&&He.variant===_e.appearance?l.jsx("span",{className:"settings-theme-selector__badge",children:"当前"}):l.jsx("span",{className:"settings-theme-selector__badge is-muted",children:"已选"})]})]})]}),l.jsxs("section",{className:"settings-panel",children:[l.jsxs("div",{className:"settings-panel__header",children:[l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"风格细节"})}),l.jsx("div",{className:"theme-status-badge",children:pn})]}),l.jsx(E4,{title:Ie==="light"?"浅色预览":"深色预览",caption:He.label,accent:He.accent,background:He.background,foreground:He.foreground,lines:Ut}),l.jsxs("div",{className:"settings-list",children:[l.jsx(_f,{label:"代码风格",value:He.codeThemeId}),l.jsx(_f,{label:"当前模式",value:He.variant}),l.jsx(_f,{label:"对比度",value:String(He.contrast)}),l.jsx(_f,{label:"面板质感",value:Pn}),l.jsx(ko,{label:"强调色",value:He.accent}),l.jsx(ko,{label:"背景色",value:He.background}),l.jsx(ko,{label:"文字色",value:He.foreground}),l.jsx(ko,{label:"新增颜色",value:He.semanticColors.diffAdded}),l.jsx(ko,{label:"删除颜色",value:He.semanticColors.diffRemoved}),l.jsx(ko,{label:"特殊强调",value:He.semanticColors.skill}),l.jsx(k0,{label:"界面字体",value:He.fonts.ui??"null"}),l.jsx(k0,{label:"代码字体",value:He.fonts.code??"null",mono:!0})]})]})]}),l.jsxs("section",{className:"settings-panel",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"字号"})})}),l.jsxs("div",{className:"settings-list",children:[l.jsx(N0,{label:"界面字号",value:H.uiFontSize,onChange:j=>U(VS(j)),min:11,max:18}),l.jsx(N0,{label:"代码字号",value:H.codeFontSize,onChange:j=>ee(KS(j)),min:10,max:18})]})]})]}),la=()=>{var j;return l.jsxs("div",{className:"settings-content-stack",children:[l.jsxs("section",{className:"settings-panel settings-panel--hero",children:[l.jsxs("div",{className:"settings-panel__header",children:[l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"模型列表"})}),l.jsxs("button",{type:"button",className:"settings-inline-action",onClick:Oe,children:[l.jsx(j4,{}),"新增模型"]})]}),l.jsxs("div",{className:"settings-summary-strip",children:[l.jsxs("div",{className:"settings-summary-strip__item",children:[l.jsx("span",{children:"首位模型"}),l.jsx("strong",{children:((j=W[0])==null?void 0:j.label)??"未配置"})]}),l.jsxs("div",{className:"settings-summary-strip__item",children:[l.jsx("span",{children:"当前默认"}),l.jsx("strong",{children:(gs==null?void 0:gs.label)??"未配置"})]}),l.jsxs("div",{className:"settings-summary-strip__item",children:[l.jsx("span",{children:"命令执行模型"}),l.jsx("strong",{children:(as==null?void 0:as.label)??"未配置"})]}),l.jsxs("div",{className:"settings-summary-strip__item",children:[l.jsx("span",{children:"可选数量"}),l.jsxs("strong",{children:[W.length," 个"]})]})]})]}),l.jsxs("section",{className:"settings-panel",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"模型角色"})})}),l.jsxs("div",{className:"settings-model-editor__grid",children:[l.jsxs("label",{className:"settings-field",children:[l.jsx("span",{children:"默认模型"}),l.jsx("select",{value:xe,onChange:z=>Bn(z.target.value),children:W.map(z=>l.jsx("option",{value:z.value,children:z.label},z.id))})]}),l.jsxs("label",{className:"settings-field",children:[l.jsx("span",{children:"命令执行模型"}),l.jsx("select",{value:ne,onChange:z=>On(z.target.value),children:W.map(z=>l.jsx("option",{value:z.value,children:z.label},z.id))})]})]})]}),l.jsxs("section",{className:"settings-panel",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"维护模型"})})}),he?l.jsx("div",{className:"settings-inline-status",role:"alert",children:he}):null,l.jsx("div",{className:"settings-model-list",role:"list","aria-label":"模型列表",children:W.map((z,ge)=>{const we=Se===z.id,ke=(me==null?void 0:me.modelId)===z.id&&me.position==="before",Ve=(me==null?void 0:me.modelId)===z.id&&me.position==="after",ct=z.value===xe;return l.jsxs("article",{className:`settings-model-card ${we?"is-dragging":""} ${ke?"is-drop-before":""} ${Ve?"is-drop-after":""}`,draggable:!0,onDragStart:Nt=>ln(Nt,z.id),onDragOver:Nt=>oe(Nt,z.id),onDrop:Nt=>{Nt.preventDefault(),qe(z.id)},onDragEnd:De,role:"listitem",children:[l.jsxs("div",{className:"settings-model-card__main",children:[l.jsx("span",{className:"settings-model-card__grip","aria-hidden":"true",children:l.jsx(S4,{})}),l.jsxs("div",{className:"settings-model-card__copy",children:[l.jsxs("div",{className:"settings-model-card__title-row",children:[l.jsx("strong",{children:z.label}),ct?l.jsx("span",{className:"settings-model-card__badge",children:"默认"}):null]}),l.jsx("code",{className:"settings-model-card__value",children:z.value})]})]}),l.jsxs("div",{className:"settings-model-card__actions",children:[l.jsx("button",{type:"button",className:`settings-mini-button ${ct?"is-active":""}`,onClick:()=>Bn(z.value),children:"设为默认"}),l.jsx("button",{type:"button",className:"settings-icon-button",onClick:()=>nn(z.id,"up"),disabled:ge===0,"aria-label":`上移 ${z.label}`,children:l.jsx(N4,{})}),l.jsx("button",{type:"button",className:"settings-icon-button",onClick:()=>nn(z.id,"down"),disabled:ge===W.length-1,"aria-label":`下移 ${z.label}`,children:l.jsx(C4,{})}),l.jsx("button",{type:"button",className:"settings-icon-button",onClick:()=>Ke(z),"aria-label":`编辑 ${z.label}`,children:l.jsx(w4,{})}),l.jsx("button",{type:"button",className:"settings-icon-button is-danger",onClick:()=>rn(z.id),disabled:W.length<=1,"aria-label":`删除 ${z.label}`,children:l.jsx(k4,{})})]})]},z.id)})}),Q?l.jsxs("div",{className:"settings-model-editor",children:[l.jsx("div",{className:"settings-model-editor__header",children:l.jsx("strong",{children:Q==="new"?"新增模型":"编辑模型"})}),l.jsxs("div",{className:"settings-model-editor__grid",children:[l.jsxs("label",{className:"settings-field",children:[l.jsx("span",{children:"显示名"}),l.jsx("input",{type:"text",value:Ce.label,onChange:z=>Le(ge=>({...ge,label:z.target.value})),placeholder:"例如:gpt-5.4"})]}),l.jsxs("label",{className:"settings-field",children:[l.jsx("span",{children:"模型 ID"}),l.jsx("input",{type:"text",value:Ce.value,onChange:z=>Le(ge=>({...ge,value:z.target.value})),placeholder:"例如:gpt-5.4"})]})]}),l.jsxs("div",{className:"settings-model-editor__actions",children:[l.jsx("button",{type:"button",className:"settings-ghost-button",onClick:mt,children:"取消"}),l.jsx("button",{type:"button",className:"settings-inline-action",onClick:kt,children:"保存"})]})]}):null]})]})},Gs=()=>{var j,z;return l.jsxs("div",{className:"settings-content-stack",children:[l.jsxs("section",{className:"settings-panel",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"页面缓存"})})}),l.jsxs("div",{className:"settings-summary-strip",children:[l.jsxs("div",{className:"settings-summary-strip__item",children:[l.jsx("span",{children:"适合什么时候用"}),l.jsx("strong",{children:"页面样式没更新"})]}),l.jsxs("div",{className:"settings-summary-strip__item",children:[l.jsx("span",{children:"常见表现"}),l.jsx("strong",{children:"手机和电脑显示不一样"})]})]})]}),l.jsxs("section",{className:"settings-panel",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"清理缓存"})})}),l.jsxs("button",{type:"button",className:"settings-action",onClick:()=>void $t(),disabled:r,children:[l.jsxs("div",{className:"settings-action__copy",children:[l.jsx("strong",{children:"清理并刷新"}),l.jsx("span",{children:"删除旧缓存,重新加载最新页面。"})]}),l.jsx("span",{className:"settings-action__state",children:r?"处理中…":"→"})]}),u?l.jsx("p",{className:"settings-block__status",children:u}):null]}),l.jsxs("section",{className:"settings-panel",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"移动端诊断"})})}),l.jsxs("button",{type:"button",className:"settings-action",onClick:()=>void s({to:"/diagnostics"}),children:[l.jsxs("div",{className:"settings-action__copy",children:[l.jsx("strong",{children:"打开安卓诊断页"}),l.jsx("span",{children:"在手机上检查样式能力、资源加载、Service Worker 和缓存状态,并可上传到后端日志。"})]}),l.jsx("span",{className:"settings-action__state",children:"→"})]})]}),l.jsxs("section",{className:"settings-panel",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"命令目录缓存"})})}),l.jsxs("div",{className:"settings-meta",children:[l.jsx("span",{children:"当前 CLI"}),l.jsx("span",{children:((j=St.data)==null?void 0:j.cli_version)??"检测中…"})]}),l.jsxs("div",{className:"settings-meta",children:[l.jsx("span",{children:"最近刷新"}),l.jsx("span",{children:((z=St.data)==null?void 0:z.loaded_at)??"尚未生成"})]}),l.jsxs("div",{className:"settings-meta",children:[l.jsx("span",{children:"命令数量"}),l.jsx("span",{children:St.data?`${St.data.commands.length} 条`:"检测中…"})]}),l.jsxs("button",{type:"button",className:"settings-action",onClick:()=>void st.mutateAsync(),disabled:st.isPending,children:[l.jsxs("div",{className:"settings-action__copy",children:[l.jsx("strong",{children:"刷新命令目录"}),l.jsx("span",{children:"重新从当前 Codex CLI 对应版本拉取命令并覆盖本地缓存文件。"})]}),l.jsx("span",{className:"settings-action__state",children:st.isPending?"刷新中…":"→"})]})]})]})},is=()=>{var j,z,ge,we,ke;return l.jsxs("div",{className:"settings-content-stack",children:[l.jsxs("section",{className:"settings-panel settings-panel--hero",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"当前设备"})})}),l.jsxs("div",{className:"settings-summary-strip",children:[l.jsxs("div",{className:"settings-summary-strip__item",children:[l.jsx("span",{children:"设备名称"}),l.jsx("strong",{children:(gt==null?void 0:gt.name)??"未选择节点"})]}),l.jsxs("div",{className:"settings-summary-strip__item",children:[l.jsx("span",{children:"连接方式"}),l.jsx("strong",{children:((j=Lt.data)==null?void 0:j.modeLabel)??"检测中…"})]}),l.jsxs("div",{className:"settings-summary-strip__item",children:[l.jsx("span",{children:"状态"}),l.jsx("strong",{className:(z=Lt.data)!=null&&z.healthOk?"is-ok":"is-muted",children:Lt.isLoading?"检测中…":(ge=Lt.data)!=null&&ge.healthOk?"在线":"无法连接"})]})]})]}),l.jsxs("section",{className:"settings-panel",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"更多信息"})})}),l.jsxs("div",{className:"settings-meta",children:[l.jsx("span",{children:"服务名称"}),l.jsx("span",{children:((we=Lt.data)==null?void 0:we.backendLabel)??"检测中…"})]}),l.jsxs("div",{className:"settings-meta",children:[l.jsx("span",{children:"服务地址"}),l.jsx("span",{children:((ke=Lt.data)==null?void 0:ke.backendUrl)??"检测中…"})]}),l.jsxs("div",{className:"settings-meta",children:[l.jsx("span",{children:"设备标识"}),l.jsx("span",{children:(gt==null?void 0:gt.id)??"未选择节点"})]}),l.jsxs("div",{className:"settings-meta",children:[l.jsx("span",{children:"最近会话"}),l.jsx("span",{children:(Ue==null?void 0:Ue.title)??"未选择会话"})]})]})]})},xa=()=>{const j=Z?"已安装":"未安装",z=I==="granted"?"已允许":I==="denied"?"已拒绝":I==="default"?"待授权":"不支持",ge=I==="granted"&&T.completionNotificationsEnabled?"已开启":"未开启";return l.jsxs("div",{className:"settings-content-stack",children:[l.jsxs("section",{className:"settings-panel settings-panel--hero",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"安卓优先提醒"})})}),l.jsxs("div",{className:"settings-summary-strip",children:[l.jsxs("div",{className:"settings-summary-strip__item",children:[l.jsx("span",{children:"桌面安装"}),l.jsx("strong",{children:j})]}),l.jsxs("div",{className:"settings-summary-strip__item",children:[l.jsx("span",{children:"系统通知权限"}),l.jsx("strong",{children:z})]}),l.jsxs("div",{className:"settings-summary-strip__item",children:[l.jsx("span",{children:"完成提醒"}),l.jsx("strong",{children:ge})]})]})]}),l.jsxs("section",{className:"settings-panel",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"安装到桌面"})})}),l.jsxs("div",{className:"settings-meta",children:[l.jsx("span",{children:"推荐平台"}),l.jsx("span",{children:te?"Android 当前设备":"Android 效果最佳"})]}),l.jsxs("div",{className:"settings-meta",children:[l.jsx("span",{children:"当前形态"}),l.jsx("span",{children:Z?"已是桌面应用":"浏览器标签页"})]}),l.jsxs("button",{type:"button",className:"settings-action",onClick:()=>void Ae(),disabled:Z||G,children:[l.jsxs("div",{className:"settings-action__copy",children:[l.jsx("strong",{children:Z?"已经安装":"安装到桌面"}),l.jsx("span",{children:Z?"现在可以直接从桌面图标进入 Panda。":"安装后更像应用,系统通知和锁屏提醒也更稳定。"})]}),l.jsx("span",{className:"settings-action__state",children:Z?"✓":G?"处理中…":"→"})]})]}),l.jsxs("section",{className:"settings-panel",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"对话完成提醒"})})}),l.jsxs("div",{className:"settings-meta",children:[l.jsx("span",{children:"提醒方式"}),l.jsx("span",{children:"系统通知"})]}),l.jsxs("div",{className:"settings-meta",children:[l.jsx("span",{children:"锁屏可见"}),l.jsx("span",{children:Z?"已具备条件":"建议先安装到桌面"})]}),l.jsxs("div",{className:"settings-meta",children:[l.jsx("span",{children:"触发时机"}),l.jsx("span",{children:"收到对话完成事件后提醒"})]}),l.jsxs("button",{type:"button",className:"settings-action",onClick:()=>void de(),disabled:I==="unsupported",children:[l.jsxs("div",{className:"settings-action__copy",children:[l.jsx("strong",{children:I==="granted"&&T.completionNotificationsEnabled?"关闭完成提醒":"开启完成提醒"}),l.jsx("span",{children:I==="unsupported"?"当前环境不支持系统通知,需要 HTTPS、Service Worker 和受支持浏览器。":"当会话生成最终回复后,以系统通知方式提醒你。"})]}),l.jsx("span",{className:"settings-action__state",children:I==="unsupported"?"不可用":I==="granted"&&T.completionNotificationsEnabled?"✓":"→"})]}),p?l.jsx("p",{className:"settings-block__status",children:p}):null]})]})},Vs=j=>j==="models"?la():j==="cache"?Gs():j==="notifications"?xa():j==="connection"?is():Ci();return l.jsx("div",{className:"conversation-page settings-screen settings-screen--workspace",children:l.jsx("div",{className:"conversation-main settings-screen__main settings-screen__workspace-main",children:l.jsx("div",{className:"settings-screen__body",children:l.jsxs("div",{className:"settings-shell",children:[l.jsxs("header",{className:"settings-page-header",children:[l.jsx("button",{type:"button",className:"settings-card__back",onClick:tn,"aria-label":"返回会话",children:l.jsx(b4,{})}),l.jsx("div",{className:"settings-page-header__copy",children:l.jsx("h1",{className:"settings-page-header__title",children:"设置"})})]}),k?l.jsxs("div",{className:"settings-workspace",children:[l.jsxs("aside",{className:"settings-sidebar",children:[l.jsx("div",{className:"settings-sidebar__title",children:"设置"}),l.jsx("nav",{className:"settings-sidebar__nav","aria-label":"设置导航",children:vf.map(j=>{const z=j.id===m;return l.jsxs("button",{type:"button",className:`settings-sidebar__item ${z?"is-active":""}`,onClick:()=>x(j.id),children:[l.jsx(w0,{icon:j.icon}),l.jsx("span",{children:j.title})]},j.id)})})]}),l.jsxs("main",{className:"settings-stage",children:[l.jsx("header",{className:"settings-stage__header",children:l.jsxs("div",{children:[l.jsx("h2",{className:"settings-stage__title",children:xn.title}),l.jsx("p",{className:"settings-stage__description",children:xn.description})]})}),Vs(m)]})]}):l.jsx("div",{className:"settings-mobile-sections",children:vf.map(j=>{const z=g===j.id;return l.jsxs("section",{className:`settings-mobile-card ${z?"is-open":""}`,children:[l.jsxs("button",{type:"button",className:"settings-mobile-card__header",onClick:()=>{x(j.id),S(ge=>ge===j.id?null:j.id)},"aria-expanded":z,children:[l.jsxs("span",{className:"settings-mobile-card__title-wrap",children:[l.jsx("span",{className:"settings-mobile-card__icon",children:l.jsx(w0,{icon:j.icon})}),l.jsx("span",{className:"settings-mobile-card__copy",children:l.jsx("span",{className:"settings-mobile-card__title",children:j.title})})]}),l.jsx("span",{className:`settings-mobile-card__chevron ${z?"is-open":""}`,children:l.jsx(x4,{open:z})})]}),z?l.jsx("div",{className:"settings-mobile-card__body",children:Vs(j.id)}):null]},j.id)})})]})})})})},R4=new Ow,A4=async()=>{},D4=_.lazy(async()=>({default:(await Tg(()=>import("./diagnostics-page-DnSAjsY5.js"),__vite__mapDeps([0,1]))).DiagnosticsPage})),O4=()=>l.jsx(_.Suspense,{fallback:l.jsx("main",{className:"diagnostics-page",children:l.jsx("div",{className:"diagnostics-shell",children:l.jsx("section",{className:"diagnostics-card",children:l.jsx("p",{children:"正在载入诊断页…"})})})}),children:l.jsx(D4,{})}),Ml=LN({component:IT}),L4=El({getParentRoute:()=>Ml,path:"/",component:hy}),I4=El({getParentRoute:()=>Ml,path:"/nodes",component:PT}),z4=El({getParentRoute:()=>Ml,path:"/session/$sessionId",component:hy}),B4=El({getParentRoute:()=>Ml,path:"/new-thread/$agentId",component:hy}),P4=El({getParentRoute:()=>Ml,path:"/settings",component:M4}),U4=El({getParentRoute:()=>Ml,path:"/diagnostics",component:O4}),q4=Ml.addChildren([L4,I4,z4,B4,P4,U4]),$4=HN({routeTree:q4,defaultPreload:"intent"});typeof document<"u"&&ZS(YS());A4().finally(()=>{uw.createRoot(document.getElementById("root")).render(l.jsx(Lw,{client:R4,children:l.jsx(GN,{router:$4})}))});export{tw as g,l as j,_ as r,Mr as u};
|