@jamiexiongr/panda-hub 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,131 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diagnostics-page-l9_xAlKR.js","assets/diagnostics-page-BmzeM8p1.css"])))=>i.map(i=>d[i]);
2
+ var I4=n=>{throw TypeError(n)};var wp=(n,t,a)=>t.has(n)||I4("Cannot "+a);var I=(n,t,a)=>(wp(n,t,"read from private field"),a?a.call(n):t.get(n)),it=(n,t,a)=>t.has(n)?I4("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,a),He=(n,t,a,l)=>(wp(n,t,"write to private field"),l?l.call(n,a):t.set(n,a),a),kt=(n,t,a)=>(wp(n,t,"access private method"),a);var Ef=(n,t,a,l)=>({set _(c){He(n,t,c,a)},get _(){return I(n,t,l)}});(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))l(c);new MutationObserver(c=>{for(const u of c)if(u.type==="childList")for(const f of u.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&l(f)}).observe(document,{childList:!0,subtree:!0});function a(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 l(c){if(c.ep)return;c.ep=!0;const u=a(c);fetch(c.href,u)}})();const V_="modulepreload",K_=function(n){return"/"+n},P4={},K1=function(t,a,l){let c=Promise.resolve();if(a&&a.length>0){let f=function(m){return Promise.all(m.map(S=>Promise.resolve(S).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=f(a.map(m=>{if(m=K_(m),m in P4)return;P4[m]=!0;const S=m.endsWith(".css"),g=S?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${g}`))return;const x=document.createElement("link");if(x.rel=S?"stylesheet":V_,S||(x.as="script"),x.crossOrigin="",x.href=m,y&&x.setAttribute("nonce",y),document.head.appendChild(x),S)return new Promise((j,k)=>{x.addEventListener("load",j),x.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${m}`)))})}))}function u(f){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=f,window.dispatchEvent(p),!p.defaultPrevented)throw f}return c.then(f=>{for(const p of f||[])p.status==="rejected"&&u(p.reason);return t().catch(u)})};function Z_(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var kp={exports:{}},du={};/**
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 z4;function X_(){if(z4)return du;z4=1;var n=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function a(l,c,u){var f=null;if(u!==void 0&&(f=""+u),c.key!==void 0&&(f=""+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:n,type:l,key:f,ref:c!==void 0?c:null,props:u}}return du.Fragment=t,du.jsx=a,du.jsxs=a,du}var B4;function J_(){return B4||(B4=1,kp.exports=X_()),kp.exports}var r=J_(),Np={exports:{}},St={};/**
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 U4;function e5(){if(U4)return St;U4=1;var n=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),f=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),x=Symbol.iterator;function j(A){return A===null||typeof A!="object"?null:(A=x&&A[x]||A["@@iterator"],typeof A=="function"?A:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,N={};function P(A,te,je){this.props=A,this.context=te,this.refs=N,this.updater=je||k}P.prototype.isReactComponent={},P.prototype.setState=function(A,te){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,te,"setState")},P.prototype.forceUpdate=function(A){this.updater.enqueueForceUpdate(this,A,"forceUpdate")};function H(){}H.prototype=P.prototype;function U(A,te,je){this.props=A,this.context=te,this.refs=N,this.updater=je||k}var R=U.prototype=new H;R.constructor=U,E(R,P.prototype),R.isPureReactComponent=!0;var q=Array.isArray;function re(){}var V={H:null,A:null,T:null,S:null},ee=Object.prototype.hasOwnProperty;function Z(A,te,je){var Se=je.ref;return{$$typeof:n,type:A,key:te,ref:Se!==void 0?Se:null,props:je}}function W(A,te){return Z(A.type,te,A.props)}function F(A){return typeof A=="object"&&A!==null&&A.$$typeof===n}function be(A){var te={"=":"=0",":":"=2"};return"$"+A.replace(/[=:]/g,function(je){return te[je]})}var pe=/\/+/g;function Y(A,te){return typeof A=="object"&&A!==null&&A.key!=null?be(""+A.key):te.toString(36)}function ne(A){switch(A.status){case"fulfilled":return A.value;case"rejected":throw A.reason;default:switch(typeof A.status=="string"?A.then(re,re):(A.status="pending",A.then(function(te){A.status==="pending"&&(A.status="fulfilled",A.value=te)},function(te){A.status==="pending"&&(A.status="rejected",A.reason=te)})),A.status){case"fulfilled":return A.value;case"rejected":throw A.reason}}throw A}function T(A,te,je,Se,Re){var oe=typeof A;(oe==="undefined"||oe==="boolean")&&(A=null);var Ne=!1;if(A===null)Ne=!0;else switch(oe){case"bigint":case"string":case"number":Ne=!0;break;case"object":switch(A.$$typeof){case n:case t:Ne=!0;break;case S:return Ne=A._init,T(Ne(A._payload),te,je,Se,Re)}}if(Ne)return Re=Re(A),Ne=Se===""?"."+Y(A,0):Se,q(Re)?(je="",Ne!=null&&(je=Ne.replace(pe,"$&/")+"/"),T(Re,te,je,"",function(we){return we})):Re!=null&&(F(Re)&&(Re=W(Re,je+(Re.key==null||A&&A.key===Re.key?"":(""+Re.key).replace(pe,"$&/")+"/")+Ne)),te.push(Re)),1;Ne=0;var ie=Se===""?".":Se+":";if(q(A))for(var z=0;z<A.length;z++)Se=A[z],oe=ie+Y(Se,z),Ne+=T(Se,te,je,oe,Re);else if(z=j(A),typeof z=="function")for(A=z.call(A),z=0;!(Se=A.next()).done;)Se=Se.value,oe=ie+Y(Se,z++),Ne+=T(Se,te,je,oe,Re);else if(oe==="object"){if(typeof A.then=="function")return T(ne(A),te,je,Se,Re);throw te=String(A),Error("Objects are not valid as a React child (found: "+(te==="[object Object]"?"object with keys {"+Object.keys(A).join(", ")+"}":te)+"). If you meant to render a collection of children, use an array instead.")}return Ne}function $(A,te,je){if(A==null)return A;var Se=[],Re=0;return T(A,Se,"","",function(oe){return te.call(je,oe,Re++)}),Se}function ue(A){if(A._status===-1){var te=A._result;te=te(),te.then(function(je){(A._status===0||A._status===-1)&&(A._status=1,A._result=je)},function(je){(A._status===0||A._status===-1)&&(A._status=2,A._result=je)}),A._status===-1&&(A._status=0,A._result=te)}if(A._status===1)return A._result.default;throw A._result}var de=typeof reportError=="function"?reportError:function(A){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var te=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(te))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",A);return}console.error(A)},ve={map:$,forEach:function(A,te,je){$(A,function(){te.apply(this,arguments)},je)},count:function(A){var te=0;return $(A,function(){te++}),te},toArray:function(A){return $(A,function(te){return te})||[]},only:function(A){if(!F(A))throw Error("React.Children.only expected to receive a single React element child.");return A}};return St.Activity=g,St.Children=ve,St.Component=P,St.Fragment=a,St.Profiler=c,St.PureComponent=U,St.StrictMode=l,St.Suspense=y,St.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=V,St.__COMPILER_RUNTIME={__proto__:null,c:function(A){return V.H.useMemoCache(A)}},St.cache=function(A){return function(){return A.apply(null,arguments)}},St.cacheSignal=function(){return null},St.cloneElement=function(A,te,je){if(A==null)throw Error("The argument must be a React element, but you passed "+A+".");var Se=E({},A.props),Re=A.key;if(te!=null)for(oe in te.key!==void 0&&(Re=""+te.key),te)!ee.call(te,oe)||oe==="key"||oe==="__self"||oe==="__source"||oe==="ref"&&te.ref===void 0||(Se[oe]=te[oe]);var oe=arguments.length-2;if(oe===1)Se.children=je;else if(1<oe){for(var Ne=Array(oe),ie=0;ie<oe;ie++)Ne[ie]=arguments[ie+2];Se.children=Ne}return Z(A.type,Re,Se)},St.createContext=function(A){return A={$$typeof:f,_currentValue:A,_currentValue2:A,_threadCount:0,Provider:null,Consumer:null},A.Provider=A,A.Consumer={$$typeof:u,_context:A},A},St.createElement=function(A,te,je){var Se,Re={},oe=null;if(te!=null)for(Se in te.key!==void 0&&(oe=""+te.key),te)ee.call(te,Se)&&Se!=="key"&&Se!=="__self"&&Se!=="__source"&&(Re[Se]=te[Se]);var Ne=arguments.length-2;if(Ne===1)Re.children=je;else if(1<Ne){for(var ie=Array(Ne),z=0;z<Ne;z++)ie[z]=arguments[z+2];Re.children=ie}if(A&&A.defaultProps)for(Se in Ne=A.defaultProps,Ne)Re[Se]===void 0&&(Re[Se]=Ne[Se]);return Z(A,oe,Re)},St.createRef=function(){return{current:null}},St.forwardRef=function(A){return{$$typeof:p,render:A}},St.isValidElement=F,St.lazy=function(A){return{$$typeof:S,_payload:{_status:-1,_result:A},_init:ue}},St.memo=function(A,te){return{$$typeof:m,type:A,compare:te===void 0?null:te}},St.startTransition=function(A){var te=V.T,je={};V.T=je;try{var Se=A(),Re=V.S;Re!==null&&Re(je,Se),typeof Se=="object"&&Se!==null&&typeof Se.then=="function"&&Se.then(re,de)}catch(oe){de(oe)}finally{te!==null&&je.types!==null&&(te.types=je.types),V.T=te}},St.unstable_useCacheRefresh=function(){return V.H.useCacheRefresh()},St.use=function(A){return V.H.use(A)},St.useActionState=function(A,te,je){return V.H.useActionState(A,te,je)},St.useCallback=function(A,te){return V.H.useCallback(A,te)},St.useContext=function(A){return V.H.useContext(A)},St.useDebugValue=function(){},St.useDeferredValue=function(A,te){return V.H.useDeferredValue(A,te)},St.useEffect=function(A,te){return V.H.useEffect(A,te)},St.useEffectEvent=function(A){return V.H.useEffectEvent(A)},St.useId=function(){return V.H.useId()},St.useImperativeHandle=function(A,te,je){return V.H.useImperativeHandle(A,te,je)},St.useInsertionEffect=function(A,te){return V.H.useInsertionEffect(A,te)},St.useLayoutEffect=function(A,te){return V.H.useLayoutEffect(A,te)},St.useMemo=function(A,te){return V.H.useMemo(A,te)},St.useOptimistic=function(A,te){return V.H.useOptimistic(A,te)},St.useReducer=function(A,te,je){return V.H.useReducer(A,te,je)},St.useRef=function(A){return V.H.useRef(A)},St.useState=function(A){return V.H.useState(A)},St.useSyncExternalStore=function(A,te,je){return V.H.useSyncExternalStore(A,te,je)},St.useTransition=function(){return V.H.useTransition()},St.version="19.2.4",St}var $4;function nd(){return $4||($4=1,Np.exports=e5()),Np.exports}var _=nd();const Oi=Z_(_);var Cp={exports:{}},fu={},Ep={exports:{}},Tp={};/**
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 H4;function t5(){return H4||(H4=1,(function(n){function t(T,$){var ue=T.length;T.push($);e:for(;0<ue;){var de=ue-1>>>1,ve=T[de];if(0<c(ve,$))T[de]=$,T[ue]=ve,ue=de;else break e}}function a(T){return T.length===0?null:T[0]}function l(T){if(T.length===0)return null;var $=T[0],ue=T.pop();if(ue!==$){T[0]=ue;e:for(var de=0,ve=T.length,A=ve>>>1;de<A;){var te=2*(de+1)-1,je=T[te],Se=te+1,Re=T[Se];if(0>c(je,ue))Se<ve&&0>c(Re,je)?(T[de]=Re,T[Se]=ue,de=Se):(T[de]=je,T[te]=ue,de=te);else if(Se<ve&&0>c(Re,ue))T[de]=Re,T[Se]=ue,de=Se;else break e}}return $}function c(T,$){var ue=T.sortIndex-$.sortIndex;return ue!==0?ue:T.id-$.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;n.unstable_now=function(){return u.now()}}else{var f=Date,p=f.now();n.unstable_now=function(){return f.now()-p}}var y=[],m=[],S=1,g=null,x=3,j=!1,k=!1,E=!1,N=!1,P=typeof setTimeout=="function"?setTimeout:null,H=typeof clearTimeout=="function"?clearTimeout:null,U=typeof setImmediate<"u"?setImmediate:null;function R(T){for(var $=a(m);$!==null;){if($.callback===null)l(m);else if($.startTime<=T)l(m),$.sortIndex=$.expirationTime,t(y,$);else break;$=a(m)}}function q(T){if(E=!1,R(T),!k)if(a(y)!==null)k=!0,re||(re=!0,be());else{var $=a(m);$!==null&&ne(q,$.startTime-T)}}var re=!1,V=-1,ee=5,Z=-1;function W(){return N?!0:!(n.unstable_now()-Z<ee)}function F(){if(N=!1,re){var T=n.unstable_now();Z=T;var $=!0;try{e:{k=!1,E&&(E=!1,H(V),V=-1),j=!0;var ue=x;try{t:{for(R(T),g=a(y);g!==null&&!(g.expirationTime>T&&W());){var de=g.callback;if(typeof de=="function"){g.callback=null,x=g.priorityLevel;var ve=de(g.expirationTime<=T);if(T=n.unstable_now(),typeof ve=="function"){g.callback=ve,R(T),$=!0;break t}g===a(y)&&l(y),R(T)}else l(y);g=a(y)}if(g!==null)$=!0;else{var A=a(m);A!==null&&ne(q,A.startTime-T),$=!1}}break e}finally{g=null,x=ue,j=!1}$=void 0}}finally{$?be():re=!1}}}var be;if(typeof U=="function")be=function(){U(F)};else if(typeof MessageChannel<"u"){var pe=new MessageChannel,Y=pe.port2;pe.port1.onmessage=F,be=function(){Y.postMessage(null)}}else be=function(){P(F,0)};function ne(T,$){V=P(function(){T(n.unstable_now())},$)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(T){T.callback=null},n.unstable_forceFrameRate=function(T){0>T||125<T?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):ee=0<T?Math.floor(1e3/T):5},n.unstable_getCurrentPriorityLevel=function(){return x},n.unstable_next=function(T){switch(x){case 1:case 2:case 3:var $=3;break;default:$=x}var ue=x;x=$;try{return T()}finally{x=ue}},n.unstable_requestPaint=function(){N=!0},n.unstable_runWithPriority=function(T,$){switch(T){case 1:case 2:case 3:case 4:case 5:break;default:T=3}var ue=x;x=T;try{return $()}finally{x=ue}},n.unstable_scheduleCallback=function(T,$,ue){var de=n.unstable_now();switch(typeof ue=="object"&&ue!==null?(ue=ue.delay,ue=typeof ue=="number"&&0<ue?de+ue:de):ue=de,T){case 1:var ve=-1;break;case 2:ve=250;break;case 5:ve=1073741823;break;case 4:ve=1e4;break;default:ve=5e3}return ve=ue+ve,T={id:S++,callback:$,priorityLevel:T,startTime:ue,expirationTime:ve,sortIndex:-1},ue>de?(T.sortIndex=ue,t(m,T),a(y)===null&&T===a(m)&&(E?(H(V),V=-1):E=!0,ne(q,ue-de))):(T.sortIndex=ve,t(y,T),k||j||(k=!0,re||(re=!0,be()))),T},n.unstable_shouldYield=W,n.unstable_wrapCallback=function(T){var $=x;return function(){var ue=x;x=$;try{return T.apply(this,arguments)}finally{x=ue}}}})(Tp)),Tp}var q4;function n5(){return q4||(q4=1,Ep.exports=t5()),Ep.exports}var Mp={exports:{}},hs={};/**
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 F4;function s5(){if(F4)return hs;F4=1;var n=nd();function t(y){var m="https://react.dev/errors/"+y;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var S=2;S<arguments.length;S++)m+="&args[]="+encodeURIComponent(arguments[S])}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 l={d:{f:a,r:function(){throw Error(t(522))},D:a,C:a,L:a,m:a,X:a,S:a,M:a},p:0,findDOMNode:null},c=Symbol.for("react.portal");function u(y,m,S){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:S}}var f=n.__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 hs.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=l,hs.createPortal=function(y,m){var S=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,S)},hs.flushSync=function(y){var m=f.T,S=l.p;try{if(f.T=null,l.p=2,y)return y()}finally{f.T=m,l.p=S,l.d.f()}},hs.preconnect=function(y,m){typeof y=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,l.d.C(y,m))},hs.prefetchDNS=function(y){typeof y=="string"&&l.d.D(y)},hs.preinit=function(y,m){if(typeof y=="string"&&m&&typeof m.as=="string"){var S=m.as,g=p(S,m.crossOrigin),x=typeof m.integrity=="string"?m.integrity:void 0,j=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;S==="style"?l.d.S(y,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:g,integrity:x,fetchPriority:j}):S==="script"&&l.d.X(y,{crossOrigin:g,integrity:x,fetchPriority:j,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},hs.preinitModule=function(y,m){if(typeof y=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var S=p(m.as,m.crossOrigin);l.d.M(y,{crossOrigin:S,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&l.d.M(y)},hs.preload=function(y,m){if(typeof y=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var S=m.as,g=p(S,m.crossOrigin);l.d.L(y,S,{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})}},hs.preloadModule=function(y,m){if(typeof y=="string")if(m){var S=p(m.as,m.crossOrigin);l.d.m(y,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:S,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else l.d.m(y)},hs.requestFormReset=function(y){l.d.r(y)},hs.unstable_batchedUpdates=function(y,m){return y(m)},hs.useFormState=function(y,m,S){return f.H.useFormState(y,m,S)},hs.useFormStatus=function(){return f.H.useHostTransitionStatus()},hs.version="19.2.4",hs}var Q4;function y2(){if(Q4)return Mp.exports;Q4=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(t){console.error(t)}}return n(),Mp.exports=s5(),Mp.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 G4;function a5(){if(G4)return fu;G4=1;var n=n5(),t=nd(),a=y2();function l(e){var s="https://react.dev/errors/"+e;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)s+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+e+"; visit "+s+" 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 s=e,i=e;if(e.alternate)for(;s.return;)s=s.return;else{e=s;do s=e,(s.flags&4098)!==0&&(i=s.return),e=s.return;while(e)}return s.tag===3?i:null}function f(e){if(e.tag===13){var s=e.memoizedState;if(s===null&&(e=e.alternate,e!==null&&(s=e.memoizedState)),s!==null)return s.dehydrated}return null}function p(e){if(e.tag===31){var s=e.memoizedState;if(s===null&&(e=e.alternate,e!==null&&(s=e.memoizedState)),s!==null)return s.dehydrated}return null}function y(e){if(u(e)!==e)throw Error(l(188))}function m(e){var s=e.alternate;if(!s){if(s=u(e),s===null)throw Error(l(188));return s!==e?null:e}for(var i=e,o=s;;){var d=i.return;if(d===null)break;var h=d.alternate;if(h===null){if(o=d.return,o!==null){i=o;continue}break}if(d.child===h.child){for(h=d.child;h;){if(h===i)return y(d),e;if(h===o)return y(d),s;h=h.sibling}throw Error(l(188))}if(i.return!==o.return)i=d,o=h;else{for(var v=!1,w=d.child;w;){if(w===i){v=!0,i=d,o=h;break}if(w===o){v=!0,o=d,i=h;break}w=w.sibling}if(!v){for(w=h.child;w;){if(w===i){v=!0,i=h,o=d;break}if(w===o){v=!0,o=h,i=d;break}w=w.sibling}if(!v)throw Error(l(189))}}if(i.alternate!==o)throw Error(l(190))}if(i.tag!==3)throw Error(l(188));return i.stateNode.current===i?e:s}function S(e){var s=e.tag;if(s===5||s===26||s===27||s===6)return e;for(e=e.child;e!==null;){if(s=S(e),s!==null)return s;e=e.sibling}return null}var g=Object.assign,x=Symbol.for("react.element"),j=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),P=Symbol.for("react.profiler"),H=Symbol.for("react.consumer"),U=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),q=Symbol.for("react.suspense"),re=Symbol.for("react.suspense_list"),V=Symbol.for("react.memo"),ee=Symbol.for("react.lazy"),Z=Symbol.for("react.activity"),W=Symbol.for("react.memo_cache_sentinel"),F=Symbol.iterator;function be(e){return e===null||typeof e!="object"?null:(e=F&&e[F]||e["@@iterator"],typeof e=="function"?e:null)}var pe=Symbol.for("react.client.reference");function Y(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===pe?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case E:return"Fragment";case P:return"Profiler";case N:return"StrictMode";case q:return"Suspense";case re:return"SuspenseList";case Z:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case k:return"Portal";case U:return e.displayName||"Context";case H:return(e._context.displayName||"Context")+".Consumer";case R:var s=e.render;return e=e.displayName,e||(e=s.displayName||s.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case V:return s=e.displayName||null,s!==null?s:Y(e.type)||"Memo";case ee:s=e._payload,e=e._init;try{return Y(e(s))}catch{}}return null}var ne=Array.isArray,T=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ue={pending:!1,data:null,method:null,action:null},de=[],ve=-1;function A(e){return{current:e}}function te(e){0>ve||(e.current=de[ve],de[ve]=null,ve--)}function je(e,s){ve++,de[ve]=e.current,e.current=s}var Se=A(null),Re=A(null),oe=A(null),Ne=A(null);function ie(e,s){switch(je(oe,s),je(Re,e),je(Se,null),s.nodeType){case 9:case 11:e=(e=s.documentElement)&&(e=e.namespaceURI)?i4(e):0;break;default:if(e=s.tagName,s=s.namespaceURI)s=i4(s),e=r4(s,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}te(Se),je(Se,e)}function z(){te(Se),te(Re),te(oe)}function we(e){e.memoizedState!==null&&je(Ne,e);var s=Se.current,i=r4(s,e.type);s!==i&&(je(Re,e),je(Se,i))}function ke(e){Re.current===e&&(te(Se),te(Re)),Ne.current===e&&(te(Ne),lu._currentValue=ue)}var _e,Me;function Ge(e){if(_e===void 0)try{throw Error()}catch(i){var s=i.stack.trim().match(/\n( *(at )?)/);_e=s&&s[1]||"",Me=-1<i.stack.indexOf(`
43
+ at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
44
+ `+_e+e+Me}var at=!1;function ht(e,s){if(!e||at)return"";at=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(s){var xe=function(){throw Error()};if(Object.defineProperty(xe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(xe,[])}catch(ce){var se=ce}Reflect.construct(e,[],xe)}else{try{xe.call()}catch(ce){se=ce}e.call(xe.prototype)}}else{try{throw Error()}catch(ce){se=ce}(xe=e())&&typeof xe.catch=="function"&&xe.catch(function(){})}}catch(ce){if(ce&&se&&typeof ce.stack=="string")return[ce.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 h=o.DetermineComponentFrameRoot(),v=h[0],w=h[1];if(v&&w){var L=v.split(`
45
+ `),J=w.split(`
46
+ `);for(d=o=0;o<L.length&&!L[o].includes("DetermineComponentFrameRoot");)o++;for(;d<J.length&&!J[d].includes("DetermineComponentFrameRoot");)d++;if(o===L.length||d===J.length)for(o=L.length-1,d=J.length-1;1<=o&&0<=d&&L[o]!==J[d];)d--;for(;1<=o&&0<=d;o--,d--)if(L[o]!==J[d]){if(o!==1||d!==1)do if(o--,d--,0>d||L[o]!==J[d]){var me=`
47
+ `+L[o].replace(" at new "," at ");return e.displayName&&me.includes("<anonymous>")&&(me=me.replace("<anonymous>",e.displayName)),me}while(1<=o&&0<=d);break}}}finally{at=!1,Error.prepareStackTrace=i}return(i=e?e.displayName||e.name:"")?Ge(i):""}function Bt(e,s){switch(e.tag){case 26:case 27:case 5:return Ge(e.type);case 16:return Ge("Lazy");case 13:return e.child!==s&&s!==null?Ge("Suspense Fallback"):Ge("Suspense");case 19:return Ge("SuspenseList");case 0:case 15:return ht(e.type,!1);case 11:return ht(e.type.render,!1);case 1:return ht(e.type,!0);case 31:return Ge("Activity");default:return""}}function Ut(e){try{var s="",i=null;do s+=Bt(e,i),i=e,e=e.return;while(e);return s}catch(o){return`
48
+ Error generating stack: `+o.message+`
49
+ `+o.stack}}var Ze=Object.prototype.hasOwnProperty,Zt=n.unstable_scheduleCallback,un=n.unstable_cancelCallback,fe=n.unstable_shouldYield,Ae=n.unstable_requestPaint,Ie=n.unstable_now,Ce=n.unstable_getCurrentPriorityLevel,Fe=n.unstable_ImmediatePriority,tt=n.unstable_UserBlockingPriority,qe=n.unstable_NormalPriority,rn=n.unstable_LowPriority,vn=n.unstable_IdlePriority,zn=n.log,as=n.unstable_setDisableYieldValue,Sn=null,ae=null;function $e(e){if(typeof zn=="function"&&as(e),ae&&typeof ae.setStrictMode=="function")try{ae.setStrictMode(Sn,e)}catch{}}var De=Math.clz32?Math.clz32:Xe,We=Math.log,nt=Math.LN2;function Xe(e){return e>>>=0,e===0?32:31-(We(e)/nt|0)|0}var At=256,nn=262144,Gn=4194304;function gt(e){var s=e&42;if(s!==0)return s;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 kn(e,s,i){var o=e.pendingLanes;if(o===0)return 0;var d=0,h=e.suspendedLanes,v=e.pingedLanes;e=e.warmLanes;var w=o&134217727;return w!==0?(o=w&~h,o!==0?d=gt(o):(v&=w,v!==0?d=gt(v):i||(i=w&~e,i!==0&&(d=gt(i))))):(w=o&~h,w!==0?d=gt(w):v!==0?d=gt(v):i||(i=o&~e,i!==0&&(d=gt(i)))),d===0?0:s!==0&&s!==d&&(s&h)===0&&(h=d&-d,i=s&-s,h>=i||h===32&&(i&4194048)!==0)?s:d}function Ee(e,s){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&s)===0}function Dt(e,s){switch(e){case 1:case 2:case 4:case 8:case 64:return s+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Dn(){var e=Gn;return Gn<<=1,(Gn&62914560)===0&&(Gn=4194304),e}function Wn(e){for(var s=[],i=0;31>i;i++)s.push(e);return s}function Gs(e,s){e.pendingLanes|=s,s!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Bi(e,s,i,o,d,h){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,L=e.expirationTimes,J=e.hiddenUpdates;for(i=v&~i;0<i;){var me=31-De(i),xe=1<<me;w[me]=0,L[me]=-1;var se=J[me];if(se!==null)for(J[me]=null,me=0;me<se.length;me++){var ce=se[me];ce!==null&&(ce.lane&=-536870913)}i&=~xe}o!==0&&ds(e,o,0),h!==0&&d===0&&e.tag!==0&&(e.suspendedLanes|=h&~(v&~s))}function ds(e,s,i){e.pendingLanes|=s,e.suspendedLanes&=~s;var o=31-De(s);e.entangledLanes|=s,e.entanglements[o]=e.entanglements[o]|1073741824|i&261930}function ya(e,s){var i=e.entangledLanes|=s;for(e=e.entanglements;i;){var o=31-De(i),d=1<<o;d&s|e[o]&s&&(e[o]|=s),i&=~d}}function va(e,s){var i=s&-s;return i=(i&42)!==0?1:xt(i),(i&(e.suspendedLanes|s))!==0?0:i}function xt(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 is(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Va(){var e=$.p;return e!==0?e:(e=window.event,e===void 0?32:T4(e.type))}function D(e,s){var i=$.p;try{return $.p=e,s()}finally{$.p=i}}var he=Math.random().toString(36).slice(2),Oe="__reactFiber$"+he,Be="__reactProps$"+he,Ye="__reactContainer$"+he,mt="__reactEvents$"+he,Ct="__reactListeners$"+he,$t="__reactHandles$"+he,hn="__reactResources$"+he,mn="__reactMarker$"+he;function Nn(e){delete e[Oe],delete e[Be],delete e[mt],delete e[Ct],delete e[$t]}function On(e){var s=e[Oe];if(s)return s;for(var i=e.parentNode;i;){if(s=i[Ye]||i[Oe]){if(i=s.alternate,s.child!==null||i!==null&&i.child!==null)for(e=h4(e);e!==null;){if(i=e[Oe])return i;e=h4(e)}return s}e=i,i=e.parentNode}return null}function Cn(e){if(e=e[Oe]||e[Ye]){var s=e.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return e}return null}function En(e){var s=e.tag;if(s===5||s===26||s===27||s===6)return e.stateNode;throw Error(l(33))}function jn(e){var s=e[hn];return s||(s=e[hn]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function C(e){e[mn]=!0}var ge=new Set,lt={};function ot(e,s){pt(e,s),pt(e+"Capture",s)}function pt(e,s){for(lt[e]=s,e=0;e<s.length;e++)ge.add(s[e])}var Et=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]*$"),Yt={},Tn={};function K(e){return Ze.call(Tn,e)?!0:Ze.call(Yt,e)?!1:Et.test(e)?Tn[e]=!0:(Yt[e]=!0,!1)}function pn(e,s,i){if(K(s))if(i===null)e.removeAttribute(s);else{switch(typeof i){case"undefined":case"function":case"symbol":e.removeAttribute(s);return;case"boolean":var o=s.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){e.removeAttribute(s);return}}e.setAttribute(s,""+i)}}function Bn(e,s,i){if(i===null)e.removeAttribute(s);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(s);return}e.setAttribute(s,""+i)}}function wn(e,s,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(s,i,""+o)}}function Xt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function qt(e){var s=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function _a(e,s,i){var o=Object.getOwnPropertyDescriptor(e.constructor.prototype,s);if(!e.hasOwnProperty(s)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var d=o.get,h=o.set;return Object.defineProperty(e,s,{configurable:!0,get:function(){return d.call(this)},set:function(v){i=""+v,h.call(this,v)}}),Object.defineProperty(e,s,{enumerable:o.enumerable}),{getValue:function(){return i},setValue:function(v){i=""+v},stopTracking:function(){e._valueTracker=null,delete e[s]}}}}function ba(e){if(!e._valueTracker){var s=qt(e)?"checked":"value";e._valueTracker=_a(e,s,""+e[s])}}function Ui(e){if(!e)return!1;var s=e._valueTracker;if(!s)return!0;var i=s.getValue(),o="";return e&&(o=qt(e)?e.checked?"true":"false":e.value),e=o,e!==i?(s.setValue(e),!0):!1}function Es(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 Gl=/[\n"\\]/g;function rs(e){return e.replace(Gl,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function ra(e,s,i,o,d,h,v,w){e.name="",v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?e.type=v:e.removeAttribute("type"),s!=null?v==="number"?(s===0&&e.value===""||e.value!=s)&&(e.value=""+Xt(s)):e.value!==""+Xt(s)&&(e.value=""+Xt(s)):v!=="submit"&&v!=="reset"||e.removeAttribute("value"),s!=null?xa(e,v,Xt(s)):i!=null?xa(e,v,Xt(i)):o!=null&&e.removeAttribute("value"),d==null&&h!=null&&(e.defaultChecked=!!h),d!=null&&(e.checked=d&&typeof d!="function"&&typeof d!="symbol"),w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?e.name=""+Xt(w):e.removeAttribute("name")}function Ht(e,s,i,o,d,h,v,w){if(h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.type=h),s!=null||i!=null){if(!(h!=="submit"&&h!=="reset"||s!=null)){ba(e);return}i=i!=null?""+Xt(i):"",s=s!=null?""+Xt(s):i,w||s===e.value||(e.value=s),e.defaultValue=s}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),ba(e)}function xa(e,s,i){s==="number"&&Es(e.ownerDocument)===e||e.defaultValue===""+i||(e.defaultValue=""+i)}function Sa(e,s,i,o){if(e=e.options,s){s={};for(var d=0;d<i.length;d++)s["$"+i[d]]=!0;for(i=0;i<e.length;i++)d=s.hasOwnProperty("$"+e[i].value),e[i].selected!==d&&(e[i].selected=d),d&&o&&(e[i].defaultSelected=!0)}else{for(i=""+Xt(i),s=null,d=0;d<e.length;d++){if(e[d].value===i){e[d].selected=!0,o&&(e[d].defaultSelected=!0);return}s!==null||e[d].disabled||(s=e[d])}s!==null&&(s.selected=!0)}}function Ka(e,s,i){if(s!=null&&(s=""+Xt(s),s!==e.value&&(e.value=s),i==null)){e.defaultValue!==s&&(e.defaultValue=s);return}e.defaultValue=i!=null?""+Xt(i):""}function $i(e,s,i,o){if(s==null){if(o!=null){if(i!=null)throw Error(l(92));if(ne(o)){if(1<o.length)throw Error(l(93));o=o[0]}i=o}i==null&&(i=""),s=i}i=Xt(s),e.defaultValue=i,o=e.textContent,o===i&&o!==""&&o!==null&&(e.value=o),ba(e)}function Aa(e,s){if(s){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=s;return}}e.textContent=s}var pc=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 ud(e,s,i){var o=s.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?o?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="":o?e.setProperty(s,i):typeof i!="number"||i===0||pc.has(s)?s==="float"?e.cssFloat=i:e[s]=(""+i).trim():e[s]=i+"px"}function Za(e,s,i){if(s!=null&&typeof s!="object")throw Error(l(62));if(e=e.style,i!=null){for(var o in i)!i.hasOwnProperty(o)||s!=null&&s.hasOwnProperty(o)||(o.indexOf("--")===0?e.setProperty(o,""):o==="float"?e.cssFloat="":e[o]="");for(var d in s)o=s[d],s.hasOwnProperty(d)&&i[d]!==o&&ud(e,d,o)}else for(var h in s)s.hasOwnProperty(h)&&ud(e,h,s[h])}function Ts(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 Hi=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"]]),Ws=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function qi(e){return Ws.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Ms(){}var Wl=null;function Fi(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Xa=null,Ja=null;function Da(e){var s=Cn(e);if(s&&(e=s.stateNode)){var i=e[Be]||null;e:switch(e=s.stateNode,s.type){case"input":if(ra(e,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),s=i.name,i.type==="radio"&&s!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+rs(""+s)+'"][type="radio"]'),s=0;s<i.length;s++){var o=i[s];if(o!==e&&o.form===e.form){var d=o[Be]||null;if(!d)throw Error(l(90));ra(o,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name)}}for(s=0;s<i.length;s++)o=i[s],o.form===e.form&&Ui(o)}break e;case"textarea":Ka(e,i.value,i.defaultValue);break e;case"select":s=i.value,s!=null&&Sa(e,!!i.multiple,s,!1)}}}var Qi=!1;function gc(e,s,i){if(Qi)return e(s,i);Qi=!0;try{var o=e(s);return o}finally{if(Qi=!1,(Xa!==null||Ja!==null)&&(rf(),Xa&&(s=Xa,e=Ja,Ja=Xa=null,Da(s),e)))for(s=0;s<e.length;s++)Da(e[s])}}function Rs(e,s){var i=e.stateNode;if(i===null)return null;var o=i[Be]||null;if(o===null)return null;i=o[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(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(l(231,s,typeof i));return i}var As=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Oa=!1;if(As)try{var Gi={};Object.defineProperty(Gi,"passive",{get:function(){Oa=!0}}),window.addEventListener("test",Gi,Gi),window.removeEventListener("test",Gi,Gi)}catch{Oa=!1}var Xn=null,_n=null,ei=null;function fs(){if(ei)return ei;var e,s=_n,i=s.length,o,d="value"in Xn?Xn.value:Xn.textContent,h=d.length;for(e=0;e<i&&s[e]===d[e];e++);var v=i-e;for(o=1;o<=v&&s[i-o]===d[h-o];o++);return ei=d.slice(e,1<o?1-o:void 0)}function Ds(e){var s=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&s===13&&(e=13)):e=s,e===10&&(e=13),32<=e||e===13?e:0}function Os(){return!0}function Xr(){return!1}function Yn(e){function s(i,o,d,h,v){this._reactName=i,this._targetInst=d,this.type=o,this.nativeEvent=h,this.target=v,this.currentTarget=null;for(var w in e)e.hasOwnProperty(w)&&(i=e[w],this[w]=i?i(h):h[w]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?Os:Xr,this.isPropagationStopped=Xr,this}return g(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=Os)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=Os)},persist:function(){},isPersistent:Os}),s}var gn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ti=Yn(gn),Wi=g({},gn,{view:0,detail:0}),Yl=Yn(Wi),Jr,La,Yi,ni=g({},Wi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Xl,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!==Yi&&(Yi&&e.type==="mousemove"?(Jr=e.screenX-Yi.screenX,La=e.screenY-Yi.screenY):La=Jr=0,Yi=e),Jr)},movementY:function(e){return"movementY"in e?e.movementY:La}}),yc=Yn(ni),Vl=g({},ni,{dataTransfer:0}),vc=Yn(Vl),dd=g({},Wi,{relatedTarget:0}),Kl=Yn(dd),Th=g({},gn,{animationName:0,elapsedTime:0,pseudoElement:0}),si=Yn(Th),Mh=g({},gn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Rh=Yn(Mh),Ah=g({},gn,{data:0}),Vi=Yn(Ah),Dh={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Oh={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"},Zl={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ys(e){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(e):(e=Zl[e])?!!s[e]:!1}function Xl(){return Ys}var Lh=g({},Wi,{key:function(e){if(e.key){var s=Dh[e.key]||e.key;if(s!=="Unidentified")return s}return e.type==="keypress"?(e=Ds(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Oh[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Xl,charCode:function(e){return e.type==="keypress"?Ds(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ds(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Ih=Yn(Lh),Ph=g({},ni,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),fd=Yn(Ph),Vs=g({},Wi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Xl}),zh=Yn(Vs),hd=g({},gn,{propertyName:0,elapsedTime:0,pseudoElement:0}),Bh=Yn(hd),Uh=g({},ni,{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}),$h=Yn(Uh),md=g({},gn,{newState:0,oldState:0}),Hh=Yn(md),ls=[9,13,27,32],el=As&&"CompositionEvent"in window,ai=null;As&&"documentMode"in document&&(ai=document.documentMode);var qh=As&&"TextEvent"in window&&!ai,pd=As&&(!el||ai&&8<ai&&11>=ai),gd=" ",tl=!1;function ps(e,s){switch(e){case"keyup":return ls.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ks(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ls=!1;function yd(e,s){switch(e){case"compositionend":return Ks(s);case"keypress":return s.which!==32?null:(tl=!0,gd);case"textInput":return e=s.data,e===gd&&tl?null:e;default:return null}}function _c(e,s){if(Ls)return e==="compositionend"||!el&&ps(e,s)?(e=fs(),ei=_n=Xn=null,Ls=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return pd&&s.locale!=="ko"?null:s.data;default:return null}}var bc={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 nl(e){var s=e&&e.nodeName&&e.nodeName.toLowerCase();return s==="input"?!!bc[e.type]:s==="textarea"}function Jl(e,s,i,o){Xa?Ja?Ja.push(o):Ja=[o]:Xa=o,s=hf(s,"onChange"),0<s.length&&(i=new ti("onChange","change",null,i,o),e.push({event:i,listeners:s}))}var Zs=null,sl=null;function al(e){Jg(e,0)}function eo(e){var s=En(e);if(Ui(s))return e}function xc(e,s){if(e==="change")return s}var vd=!1;if(As){var to;if(As){var no="oninput"in document;if(!no){var ja=document.createElement("div");ja.setAttribute("oninput","return;"),no=typeof ja.oninput=="function"}to=no}else to=!1;vd=to&&(!document.documentMode||9<document.documentMode)}function Sc(){Zs&&(Zs.detachEvent("onpropertychange",jc),sl=Zs=null)}function jc(e){if(e.propertyName==="value"&&eo(sl)){var s=[];Jl(s,sl,e,Fi(e)),gc(al,s)}}function _d(e,s,i){e==="focusin"?(Sc(),Zs=s,sl=i,Zs.attachEvent("onpropertychange",jc)):e==="focusout"&&Sc()}function bd(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return eo(sl)}function Fh(e,s){if(e==="click")return eo(s)}function Qh(e,s){if(e==="input"||e==="change")return eo(s)}function Gh(e,s){return e===s&&(e!==0||1/e===1/s)||e!==e&&s!==s}var gs=typeof Object.is=="function"?Object.is:Gh;function Ki(e,s){if(gs(e,s))return!0;if(typeof e!="object"||e===null||typeof s!="object"||s===null)return!1;var i=Object.keys(e),o=Object.keys(s);if(i.length!==o.length)return!1;for(o=0;o<i.length;o++){var d=i[o];if(!Ze.call(s,d)||!gs(e[d],s[d]))return!1}return!0}function xd(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Sd(e,s){var i=xd(e);e=0;for(var o;i;){if(i.nodeType===3){if(o=e+i.textContent.length,e<=s&&o>=s)return{node:i,offset:s-e};e=o}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=xd(i)}}function jd(e,s){return e&&s?e===s?!0:e&&e.nodeType===3?!1:s&&s.nodeType===3?jd(e,s.parentNode):"contains"in e?e.contains(s):e.compareDocumentPosition?!!(e.compareDocumentPosition(s)&16):!1:!1}function wd(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var s=Es(e.document);s instanceof e.HTMLIFrameElement;){try{var i=typeof s.contentWindow.location.href=="string"}catch{i=!1}if(i)e=s.contentWindow;else break;s=Es(e.document)}return s}function wc(e){var s=e&&e.nodeName&&e.nodeName.toLowerCase();return s&&(s==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||s==="textarea"||e.contentEditable==="true")}var Wh=As&&"documentMode"in document&&11>=document.documentMode,Zi=null,kc=null,il=null,Ia=!1;function kd(e,s,i){var o=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;Ia||Zi==null||Zi!==Es(o)||(o=Zi,"selectionStart"in o&&wc(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}),il&&Ki(il,o)||(il=o,o=hf(kc,"onSelect"),0<o.length&&(s=new ti("onSelect","select",null,s,i),e.push({event:s,listeners:o}),s.target=Zi)))}function ii(e,s){var i={};return i[e.toLowerCase()]=s.toLowerCase(),i["Webkit"+e]="webkit"+s,i["Moz"+e]="moz"+s,i}var Xi={animationend:ii("Animation","AnimationEnd"),animationiteration:ii("Animation","AnimationIteration"),animationstart:ii("Animation","AnimationStart"),transitionrun:ii("Transition","TransitionRun"),transitionstart:ii("Transition","TransitionStart"),transitioncancel:ii("Transition","TransitionCancel"),transitionend:ii("Transition","TransitionEnd")},Nc={},Nd={};As&&(Nd=document.createElement("div").style,"AnimationEvent"in window||(delete Xi.animationend.animation,delete Xi.animationiteration.animation,delete Xi.animationstart.animation),"TransitionEvent"in window||delete Xi.transitionend.transition);function ri(e){if(Nc[e])return Nc[e];if(!Xi[e])return e;var s=Xi[e],i;for(i in s)if(s.hasOwnProperty(i)&&i in Nd)return Nc[e]=s[i];return e}var Cd=ri("animationend"),Ed=ri("animationiteration"),Td=ri("animationstart"),Yh=ri("transitionrun"),Md=ri("transitionstart"),Rd=ri("transitioncancel"),Cc=ri("transitionend"),Ad=new Map,so="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(" ");so.push("scrollEnd");function Is(e,s){Ad.set(e,s),ot(s,[e])}var rl=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=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(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},ys=[],li=0,ao=0;function ll(){for(var e=li,s=ao=li=0;s<e;){var i=ys[s];ys[s++]=null;var o=ys[s];ys[s++]=null;var d=ys[s];ys[s++]=null;var h=ys[s];if(ys[s++]=null,o!==null&&d!==null){var v=o.pending;v===null?d.next=d:(d.next=v.next,v.next=d),o.pending=d}h!==0&&Tc(i,d,h)}}function io(e,s,i,o){ys[li++]=e,ys[li++]=s,ys[li++]=i,ys[li++]=o,ao|=o,e.lanes|=o,e=e.alternate,e!==null&&(e.lanes|=o)}function Ec(e,s,i,o){return io(e,s,i,o),ol(e)}function oi(e,s){return io(e,null,null,s),ol(e)}function Tc(e,s,i){e.lanes|=i;var o=e.alternate;o!==null&&(o.lanes|=i);for(var d=!1,h=e.return;h!==null;)h.childLanes|=i,o=h.alternate,o!==null&&(o.childLanes|=i),h.tag===22&&(e=h.stateNode,e===null||e._visibility&1||(d=!0)),e=h,h=h.return;return e.tag===3?(h=e.stateNode,d&&s!==null&&(d=31-De(i),e=h.hiddenUpdates,o=e[d],o===null?e[d]=[s]:o.push(s),s.lane=i|536870912),h):null}function ol(e){if(50<eu)throw eu=0,Ym=null,Error(l(185));for(var s=e.return;s!==null;)e=s,s=e.return;return e.tag===3?e.stateNode:null}var Ji={};function Vh(e,s,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=s,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 vs(e,s,i,o){return new Vh(e,s,i,o)}function ro(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Pa(e,s){var i=e.alternate;return i===null?(i=vs(e.tag,s,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=s,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,s=e.dependencies,i.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i.refCleanup=e.refCleanup,i}function Mc(e,s){e.flags&=65011714;var i=e.alternate;return i===null?(e.childLanes=0,e.lanes=s,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,s=i.dependencies,e.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),e}function cl(e,s,i,o,d,h){var v=0;if(o=e,typeof e=="function")ro(e)&&(v=1);else if(typeof e=="string")v=P_(e,i,Se.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Z:return e=vs(31,i,s,d),e.elementType=Z,e.lanes=h,e;case E:return za(i.children,d,h,s);case N:v=8,d|=24;break;case P:return e=vs(12,i,s,d|2),e.elementType=P,e.lanes=h,e;case q:return e=vs(13,i,s,d),e.elementType=q,e.lanes=h,e;case re:return e=vs(19,i,s,d),e.elementType=re,e.lanes=h,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case U:v=10;break e;case H:v=9;break e;case R:v=11;break e;case V:v=14;break e;case ee:v=16,o=null;break e}v=29,i=Error(l(130,e===null?"null":typeof e,"")),o=null}return s=vs(v,i,s,d),s.elementType=e,s.type=o,s.lanes=h,s}function za(e,s,i,o){return e=vs(7,e,o,s),e.lanes=i,e}function lo(e,s,i){return e=vs(6,e,null,s),e.lanes=i,e}function Rc(e){var s=vs(18,null,null,0);return s.stateNode=e,s}function oo(e,s,i){return s=vs(4,e.children!==null?e.children:[],e.key,s),s.lanes=i,s.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},s}var Ac=new WeakMap;function _s(e,s){if(typeof e=="object"&&e!==null){var i=Ac.get(e);return i!==void 0?i:(s={value:e,source:s,stack:Ut(s)},Ac.set(e,s),s)}return{value:e,source:s,stack:Ut(s)}}var ci=[],ui=0,ul=null,er=0,bs=[],xs=0,wa=null,Xs=1,Js="";function b(e,s){ci[ui++]=er,ci[ui++]=ul,ul=e,er=s}function O(e,s,i){bs[xs++]=Xs,bs[xs++]=Js,bs[xs++]=wa,wa=e;var o=Xs;e=Js;var d=32-De(o)-1;o&=~(1<<d),i+=1;var h=32-De(s)+d;if(30<h){var v=d-d%5;h=(o&(1<<v)-1).toString(32),o>>=v,d-=v,Xs=1<<32-De(s)+d|i<<d|o,Js=h+e}else Xs=1<<h|i<<d|o,Js=e}function Q(e){e.return!==null&&(b(e,1),O(e,1,0))}function le(e){for(;e===ul;)ul=ci[--ui],ci[ui]=null,er=ci[--ui],ci[ui]=null;for(;e===wa;)wa=bs[--xs],bs[xs]=null,Js=bs[--xs],bs[xs]=null,Xs=bs[--xs],bs[xs]=null}function st(e,s){bs[xs++]=Xs,bs[xs++]=Js,bs[xs++]=wa,Xs=s.id,Js=s.overflow,wa=e}var ze=null,Ue=null,Pe=!1,Ln=null,Un=!1,tr=Error(l(519));function ka(e){var s=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw nr(_s(s,e)),tr}function Dc(e){var s=e.stateNode,i=e.type,o=e.memoizedProps;switch(s[Oe]=e,s[Be]=o,i){case"dialog":Rt("cancel",s),Rt("close",s);break;case"iframe":case"object":case"embed":Rt("load",s);break;case"video":case"audio":for(i=0;i<nu.length;i++)Rt(nu[i],s);break;case"source":Rt("error",s);break;case"img":case"image":case"link":Rt("error",s),Rt("load",s);break;case"details":Rt("toggle",s);break;case"input":Rt("invalid",s),Ht(s,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":Rt("invalid",s);break;case"textarea":Rt("invalid",s),$i(s,o.value,o.defaultValue,o.children)}i=o.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||s.textContent===""+i||o.suppressHydrationWarning===!0||s4(s.textContent,i)?(o.popover!=null&&(Rt("beforetoggle",s),Rt("toggle",s)),o.onScroll!=null&&Rt("scroll",s),o.onScrollEnd!=null&&Rt("scrollend",s),o.onClick!=null&&(s.onclick=Ms),s=!0):s=!1,s||ka(e,!0)}function Oc(e){for(ze=e.return;ze;)switch(ze.tag){case 5:case 31:case 13:Un=!1;return;case 27:case 3:Un=!0;return;default:ze=ze.return}}function di(e){if(e!==ze)return!1;if(!Pe)return Oc(e),Pe=!0,!1;var s=e.tag,i;if((i=s!==3&&s!==27)&&((i=s===5)&&(i=e.type,i=!(i!=="form"&&i!=="button")||cp(e.type,e.memoizedProps)),i=!i),i&&Ue&&ka(e),Oc(e),s===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Ue=f4(e)}else if(s===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Ue=f4(e)}else s===27?(s=Ue,gr(e.type)?(e=mp,mp=null,Ue=e):Ue=s):Ue=ze?ua(e.stateNode.nextSibling):null;return!0}function Ba(){Ue=ze=null,Pe=!1}function co(){var e=Ln;return e!==null&&(Us===null?Us=e:Us.push.apply(Us,e),Ln=null),e}function nr(e){Ln===null?Ln=[e]:Ln.push(e)}var uo=A(null),Ua=null,la=null;function Na(e,s,i){je(uo,s._currentValue),s._currentValue=i}function oa(e){e._currentValue=uo.current,te(uo)}function ut(e,s,i){for(;e!==null;){var o=e.alternate;if((e.childLanes&s)!==s?(e.childLanes|=s,o!==null&&(o.childLanes|=s)):o!==null&&(o.childLanes&s)!==s&&(o.childLanes|=s),e===i)break;e=e.return}}function Jt(e,s,i,o){var d=e.child;for(d!==null&&(d.return=e);d!==null;){var h=d.dependencies;if(h!==null){var v=d.child;h=h.firstContext;e:for(;h!==null;){var w=h;h=d;for(var L=0;L<s.length;L++)if(w.context===s[L]){h.lanes|=i,w=h.alternate,w!==null&&(w.lanes|=i),ut(h.return,i,e),o||(v=null);break e}h=w.next}}else if(d.tag===18){if(v=d.return,v===null)throw Error(l(341));v.lanes|=i,h=v.alternate,h!==null&&(h.lanes|=i),ut(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 Tt(e,s,i,o){e=null;for(var d=s,h=!1;d!==null;){if(!h){if((d.flags&524288)!==0)h=!0;else if((d.flags&262144)!==0)break}if(d.tag===10){var v=d.alternate;if(v===null)throw Error(l(387));if(v=v.memoizedProps,v!==null){var w=d.type;gs(d.pendingProps.value,v.value)||(e!==null?e.push(w):e=[w])}}else if(d===Ne.current){if(v=d.alternate,v===null)throw Error(l(387));v.memoizedState.memoizedState!==d.memoizedState.memoizedState&&(e!==null?e.push(lu):e=[lu])}d=d.return}e!==null&&Jt(s,e,i,o),s.flags|=262144}function en(e){for(e=e.firstContext;e!==null;){if(!gs(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ft(e){Ua=e,la=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function dn(e){return fo(Ua,e)}function sr(e,s){return Ua===null&&Ft(e),fo(e,s)}function fo(e,s){var i=s._currentValue;if(s={context:s,memoizedValue:i,next:null},la===null){if(e===null)throw Error(l(308));la=s,e.dependencies={lanes:0,firstContext:s},e.flags|=524288}else la=la.next=s;return i}var Dv=typeof AbortController<"u"?AbortController:function(){var e=[],s=this.signal={aborted:!1,addEventListener:function(i,o){e.push(o)}};this.abort=function(){s.aborted=!0,e.forEach(function(i){return i()})}},Ov=n.unstable_scheduleCallback,Lv=n.unstable_NormalPriority,$n={$$typeof:U,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Kh(){return{controller:new Dv,data:new Map,refCount:0}}function Lc(e){e.refCount--,e.refCount===0&&Ov(Lv,function(){e.controller.abort()})}var Ic=null,Zh=0,ho=0,mo=null;function Iv(e,s){if(Ic===null){var i=Ic=[];Zh=0,ho=ep(),mo={status:"pending",value:void 0,then:function(o){i.push(o)}}}return Zh++,s.then(q0,q0),s}function q0(){if(--Zh===0&&Ic!==null){mo!==null&&(mo.status="fulfilled");var e=Ic;Ic=null,ho=0,mo=null;for(var s=0;s<e.length;s++)(0,e[s])()}}function Pv(e,s){var i=[],o={status:"pending",value:null,reason:null,then:function(d){i.push(d)}};return e.then(function(){o.status="fulfilled",o.value=s;for(var d=0;d<i.length;d++)(0,i[d])(s)},function(d){for(o.status="rejected",o.reason=d,d=0;d<i.length;d++)(0,i[d])(void 0)}),o}var F0=T.S;T.S=function(e,s){Cg=Ie(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&Iv(e,s),F0!==null&&F0(e,s)};var dl=A(null);function Xh(){var e=dl.current;return e!==null?e:fn.pooledCache}function Dd(e,s){s===null?je(dl,dl.current):je(dl,s.pool)}function Q0(){var e=Xh();return e===null?null:{parent:$n._currentValue,pool:e}}var po=Error(l(460)),Jh=Error(l(474)),Od=Error(l(542)),Ld={then:function(){}};function G0(e){return e=e.status,e==="fulfilled"||e==="rejected"}function W0(e,s,i){switch(i=e[i],i===void 0?e.push(s):i!==s&&(s.then(Ms,Ms),s=i),s.status){case"fulfilled":return s.value;case"rejected":throw e=s.reason,V0(e),e;default:if(typeof s.status=="string")s.then(Ms,Ms);else{if(e=fn,e!==null&&100<e.shellSuspendCounter)throw Error(l(482));e=s,e.status="pending",e.then(function(o){if(s.status==="pending"){var d=s;d.status="fulfilled",d.value=o}},function(o){if(s.status==="pending"){var d=s;d.status="rejected",d.reason=o}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw e=s.reason,V0(e),e}throw hl=s,po}}function fl(e){try{var s=e._init;return s(e._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(hl=i,po):i}}var hl=null;function Y0(){if(hl===null)throw Error(l(459));var e=hl;return hl=null,e}function V0(e){if(e===po||e===Od)throw Error(l(483))}var go=null,Pc=0;function Id(e){var s=Pc;return Pc+=1,go===null&&(go=[]),W0(go,e,s)}function zc(e,s){s=s.props.ref,e.ref=s!==void 0?s:null}function Pd(e,s){throw s.$$typeof===x?Error(l(525)):(e=Object.prototype.toString.call(s),Error(l(31,e==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":e)))}function K0(e){function s(G,B){if(e){var X=G.deletions;X===null?(G.deletions=[B],G.flags|=16):X.push(B)}}function i(G,B){if(!e)return null;for(;B!==null;)s(G,B),B=B.sibling;return null}function o(G){for(var B=new Map;G!==null;)G.key!==null?B.set(G.key,G):B.set(G.index,G),G=G.sibling;return B}function d(G,B){return G=Pa(G,B),G.index=0,G.sibling=null,G}function h(G,B,X){return G.index=X,e?(X=G.alternate,X!==null?(X=X.index,X<B?(G.flags|=67108866,B):X):(G.flags|=67108866,B)):(G.flags|=1048576,B)}function v(G){return e&&G.alternate===null&&(G.flags|=67108866),G}function w(G,B,X,ye){return B===null||B.tag!==6?(B=lo(X,G.mode,ye),B.return=G,B):(B=d(B,X),B.return=G,B)}function L(G,B,X,ye){var ct=X.type;return ct===E?me(G,B,X.props.children,ye,X.key):B!==null&&(B.elementType===ct||typeof ct=="object"&&ct!==null&&ct.$$typeof===ee&&fl(ct)===B.type)?(B=d(B,X.props),zc(B,X),B.return=G,B):(B=cl(X.type,X.key,X.props,null,G.mode,ye),zc(B,X),B.return=G,B)}function J(G,B,X,ye){return B===null||B.tag!==4||B.stateNode.containerInfo!==X.containerInfo||B.stateNode.implementation!==X.implementation?(B=oo(X,G.mode,ye),B.return=G,B):(B=d(B,X.children||[]),B.return=G,B)}function me(G,B,X,ye,ct){return B===null||B.tag!==7?(B=za(X,G.mode,ye,ct),B.return=G,B):(B=d(B,X),B.return=G,B)}function xe(G,B,X){if(typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint")return B=lo(""+B,G.mode,X),B.return=G,B;if(typeof B=="object"&&B!==null){switch(B.$$typeof){case j:return X=cl(B.type,B.key,B.props,null,G.mode,X),zc(X,B),X.return=G,X;case k:return B=oo(B,G.mode,X),B.return=G,B;case ee:return B=fl(B),xe(G,B,X)}if(ne(B)||be(B))return B=za(B,G.mode,X,null),B.return=G,B;if(typeof B.then=="function")return xe(G,Id(B),X);if(B.$$typeof===U)return xe(G,sr(G,B),X);Pd(G,B)}return null}function se(G,B,X,ye){var ct=B!==null?B.key:null;if(typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint")return ct!==null?null:w(G,B,""+X,ye);if(typeof X=="object"&&X!==null){switch(X.$$typeof){case j:return X.key===ct?L(G,B,X,ye):null;case k:return X.key===ct?J(G,B,X,ye):null;case ee:return X=fl(X),se(G,B,X,ye)}if(ne(X)||be(X))return ct!==null?null:me(G,B,X,ye,null);if(typeof X.then=="function")return se(G,B,Id(X),ye);if(X.$$typeof===U)return se(G,B,sr(G,X),ye);Pd(G,X)}return null}function ce(G,B,X,ye,ct){if(typeof ye=="string"&&ye!==""||typeof ye=="number"||typeof ye=="bigint")return G=G.get(X)||null,w(B,G,""+ye,ct);if(typeof ye=="object"&&ye!==null){switch(ye.$$typeof){case j:return G=G.get(ye.key===null?X:ye.key)||null,L(B,G,ye,ct);case k:return G=G.get(ye.key===null?X:ye.key)||null,J(B,G,ye,ct);case ee:return ye=fl(ye),ce(G,B,X,ye,ct)}if(ne(ye)||be(ye))return G=G.get(X)||null,me(B,G,ye,ct,null);if(typeof ye.then=="function")return ce(G,B,X,Id(ye),ct);if(ye.$$typeof===U)return ce(G,B,X,sr(B,ye),ct);Pd(B,ye)}return null}function Ve(G,B,X,ye){for(var ct=null,Qt=null,Je=B,wt=B=0,Lt=null;Je!==null&&wt<X.length;wt++){Je.index>wt?(Lt=Je,Je=null):Lt=Je.sibling;var Gt=se(G,Je,X[wt],ye);if(Gt===null){Je===null&&(Je=Lt);break}e&&Je&&Gt.alternate===null&&s(G,Je),B=h(Gt,B,wt),Qt===null?ct=Gt:Qt.sibling=Gt,Qt=Gt,Je=Lt}if(wt===X.length)return i(G,Je),Pe&&b(G,wt),ct;if(Je===null){for(;wt<X.length;wt++)Je=xe(G,X[wt],ye),Je!==null&&(B=h(Je,B,wt),Qt===null?ct=Je:Qt.sibling=Je,Qt=Je);return Pe&&b(G,wt),ct}for(Je=o(Je);wt<X.length;wt++)Lt=ce(Je,G,wt,X[wt],ye),Lt!==null&&(e&&Lt.alternate!==null&&Je.delete(Lt.key===null?wt:Lt.key),B=h(Lt,B,wt),Qt===null?ct=Lt:Qt.sibling=Lt,Qt=Lt);return e&&Je.forEach(function(xr){return s(G,xr)}),Pe&&b(G,wt),ct}function ft(G,B,X,ye){if(X==null)throw Error(l(151));for(var ct=null,Qt=null,Je=B,wt=B=0,Lt=null,Gt=X.next();Je!==null&&!Gt.done;wt++,Gt=X.next()){Je.index>wt?(Lt=Je,Je=null):Lt=Je.sibling;var xr=se(G,Je,Gt.value,ye);if(xr===null){Je===null&&(Je=Lt);break}e&&Je&&xr.alternate===null&&s(G,Je),B=h(xr,B,wt),Qt===null?ct=xr:Qt.sibling=xr,Qt=xr,Je=Lt}if(Gt.done)return i(G,Je),Pe&&b(G,wt),ct;if(Je===null){for(;!Gt.done;wt++,Gt=X.next())Gt=xe(G,Gt.value,ye),Gt!==null&&(B=h(Gt,B,wt),Qt===null?ct=Gt:Qt.sibling=Gt,Qt=Gt);return Pe&&b(G,wt),ct}for(Je=o(Je);!Gt.done;wt++,Gt=X.next())Gt=ce(Je,G,wt,Gt.value,ye),Gt!==null&&(e&&Gt.alternate!==null&&Je.delete(Gt.key===null?wt:Gt.key),B=h(Gt,B,wt),Qt===null?ct=Gt:Qt.sibling=Gt,Qt=Gt);return e&&Je.forEach(function(Y_){return s(G,Y_)}),Pe&&b(G,wt),ct}function cn(G,B,X,ye){if(typeof X=="object"&&X!==null&&X.type===E&&X.key===null&&(X=X.props.children),typeof X=="object"&&X!==null){switch(X.$$typeof){case j:e:{for(var ct=X.key;B!==null;){if(B.key===ct){if(ct=X.type,ct===E){if(B.tag===7){i(G,B.sibling),ye=d(B,X.props.children),ye.return=G,G=ye;break e}}else if(B.elementType===ct||typeof ct=="object"&&ct!==null&&ct.$$typeof===ee&&fl(ct)===B.type){i(G,B.sibling),ye=d(B,X.props),zc(ye,X),ye.return=G,G=ye;break e}i(G,B);break}else s(G,B);B=B.sibling}X.type===E?(ye=za(X.props.children,G.mode,ye,X.key),ye.return=G,G=ye):(ye=cl(X.type,X.key,X.props,null,G.mode,ye),zc(ye,X),ye.return=G,G=ye)}return v(G);case k:e:{for(ct=X.key;B!==null;){if(B.key===ct)if(B.tag===4&&B.stateNode.containerInfo===X.containerInfo&&B.stateNode.implementation===X.implementation){i(G,B.sibling),ye=d(B,X.children||[]),ye.return=G,G=ye;break e}else{i(G,B);break}else s(G,B);B=B.sibling}ye=oo(X,G.mode,ye),ye.return=G,G=ye}return v(G);case ee:return X=fl(X),cn(G,B,X,ye)}if(ne(X))return Ve(G,B,X,ye);if(be(X)){if(ct=be(X),typeof ct!="function")throw Error(l(150));return X=ct.call(X),ft(G,B,X,ye)}if(typeof X.then=="function")return cn(G,B,Id(X),ye);if(X.$$typeof===U)return cn(G,B,sr(G,X),ye);Pd(G,X)}return typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint"?(X=""+X,B!==null&&B.tag===6?(i(G,B.sibling),ye=d(B,X),ye.return=G,G=ye):(i(G,B),ye=lo(X,G.mode,ye),ye.return=G,G=ye),v(G)):i(G,B)}return function(G,B,X,ye){try{Pc=0;var ct=cn(G,B,X,ye);return go=null,ct}catch(Je){if(Je===po||Je===Od)throw Je;var Qt=vs(29,Je,null,G.mode);return Qt.lanes=ye,Qt.return=G,Qt}finally{}}}var ml=K0(!0),Z0=K0(!1),ar=!1;function em(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function tm(e,s){e=e.updateQueue,s.updateQueue===e&&(s.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function ir(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function rr(e,s,i){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,(Vt&2)!==0){var d=o.pending;return d===null?s.next=s:(s.next=d.next,d.next=s),o.pending=s,s=ol(e),Tc(e,null,i),s}return io(e,o,s,i),ol(e)}function Bc(e,s,i){if(s=s.updateQueue,s!==null&&(s=s.shared,(i&4194048)!==0)){var o=s.lanes;o&=e.pendingLanes,i|=o,s.lanes=i,ya(e,i)}}function nm(e,s){var i=e.updateQueue,o=e.alternate;if(o!==null&&(o=o.updateQueue,i===o)){var d=null,h=null;if(i=i.firstBaseUpdate,i!==null){do{var v={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};h===null?d=h=v:h=h.next=v,i=i.next}while(i!==null);h===null?d=h=s:h=h.next=s}else d=h=s;i={baseState:o.baseState,firstBaseUpdate:d,lastBaseUpdate:h,shared:o.shared,callbacks:o.callbacks},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=s:e.next=s,i.lastBaseUpdate=s}var sm=!1;function Uc(){if(sm){var e=mo;if(e!==null)throw e}}function $c(e,s,i,o){sm=!1;var d=e.updateQueue;ar=!1;var h=d.firstBaseUpdate,v=d.lastBaseUpdate,w=d.shared.pending;if(w!==null){d.shared.pending=null;var L=w,J=L.next;L.next=null,v===null?h=J:v.next=J,v=L;var me=e.alternate;me!==null&&(me=me.updateQueue,w=me.lastBaseUpdate,w!==v&&(w===null?me.firstBaseUpdate=J:w.next=J,me.lastBaseUpdate=L))}if(h!==null){var xe=d.baseState;v=0,me=J=L=null,w=h;do{var se=w.lane&-536870913,ce=se!==w.lane;if(ce?(Ot&se)===se:(o&se)===se){se!==0&&se===ho&&(sm=!0),me!==null&&(me=me.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var Ve=e,ft=w;se=s;var cn=i;switch(ft.tag){case 1:if(Ve=ft.payload,typeof Ve=="function"){xe=Ve.call(cn,xe,se);break e}xe=Ve;break e;case 3:Ve.flags=Ve.flags&-65537|128;case 0:if(Ve=ft.payload,se=typeof Ve=="function"?Ve.call(cn,xe,se):Ve,se==null)break e;xe=g({},xe,se);break e;case 2:ar=!0}}se=w.callback,se!==null&&(e.flags|=64,ce&&(e.flags|=8192),ce=d.callbacks,ce===null?d.callbacks=[se]:ce.push(se))}else ce={lane:se,tag:w.tag,payload:w.payload,callback:w.callback,next:null},me===null?(J=me=ce,L=xe):me=me.next=ce,v|=se;if(w=w.next,w===null){if(w=d.shared.pending,w===null)break;ce=w,w=ce.next,ce.next=null,d.lastBaseUpdate=ce,d.shared.pending=null}}while(!0);me===null&&(L=xe),d.baseState=L,d.firstBaseUpdate=J,d.lastBaseUpdate=me,h===null&&(d.shared.lanes=0),dr|=v,e.lanes=v,e.memoizedState=xe}}function X0(e,s){if(typeof e!="function")throw Error(l(191,e));e.call(s)}function J0(e,s){var i=e.callbacks;if(i!==null)for(e.callbacks=null,e=0;e<i.length;e++)X0(i[e],s)}var yo=A(null),zd=A(0);function e8(e,s){e=bi,je(zd,e),je(yo,s),bi=e|s.baseLanes}function am(){je(zd,bi),je(yo,yo.current)}function im(){bi=zd.current,te(yo),te(zd)}var ea=A(null),ca=null;function lr(e){var s=e.alternate;je(In,In.current&1),je(ea,e),ca===null&&(s===null||yo.current!==null||s.memoizedState!==null)&&(ca=e)}function rm(e){je(In,In.current),je(ea,e),ca===null&&(ca=e)}function t8(e){e.tag===22?(je(In,In.current),je(ea,e),ca===null&&(ca=e)):or()}function or(){je(In,In.current),je(ea,ea.current)}function ta(e){te(ea),ca===e&&(ca=null),te(In)}var In=A(0);function Bd(e){for(var s=e;s!==null;){if(s.tag===13){var i=s.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||fp(i)||hp(i)))return s}else if(s.tag===19&&(s.memoizedProps.revealOrder==="forwards"||s.memoizedProps.revealOrder==="backwards"||s.memoizedProps.revealOrder==="unstable_legacy-backwards"||s.memoizedProps.revealOrder==="together")){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===e)break;for(;s.sibling===null;){if(s.return===null||s.return===e)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var fi=0,jt=null,ln=null,Hn=null,Ud=!1,vo=!1,pl=!1,$d=0,Hc=0,_o=null,zv=0;function Mn(){throw Error(l(321))}function lm(e,s){if(s===null)return!1;for(var i=0;i<s.length&&i<e.length;i++)if(!gs(e[i],s[i]))return!1;return!0}function om(e,s,i,o,d,h){return fi=h,jt=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,T.H=e===null||e.memoizedState===null?z8:jm,pl=!1,h=i(o,d),pl=!1,vo&&(h=s8(s,i,o,d)),n8(e),h}function n8(e){T.H=Qc;var s=ln!==null&&ln.next!==null;if(fi=0,Hn=ln=jt=null,Ud=!1,Hc=0,_o=null,s)throw Error(l(300));e===null||qn||(e=e.dependencies,e!==null&&en(e)&&(qn=!0))}function s8(e,s,i,o){jt=e;var d=0;do{if(vo&&(_o=null),Hc=0,vo=!1,25<=d)throw Error(l(301));if(d+=1,Hn=ln=null,e.updateQueue!=null){var h=e.updateQueue;h.lastEffect=null,h.events=null,h.stores=null,h.memoCache!=null&&(h.memoCache.index=0)}T.H=B8,h=s(i,o)}while(vo);return h}function Bv(){var e=T.H,s=e.useState()[0];return s=typeof s.then=="function"?qc(s):s,e=e.useState()[0],(ln!==null?ln.memoizedState:null)!==e&&(jt.flags|=1024),s}function cm(){var e=$d!==0;return $d=0,e}function um(e,s,i){s.updateQueue=e.updateQueue,s.flags&=-2053,e.lanes&=~i}function dm(e){if(Ud){for(e=e.memoizedState;e!==null;){var s=e.queue;s!==null&&(s.pending=null),e=e.next}Ud=!1}fi=0,Hn=ln=jt=null,vo=!1,Hc=$d=0,_o=null}function Ss(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Hn===null?jt.memoizedState=Hn=e:Hn=Hn.next=e,Hn}function Pn(){if(ln===null){var e=jt.alternate;e=e!==null?e.memoizedState:null}else e=ln.next;var s=Hn===null?jt.memoizedState:Hn.next;if(s!==null)Hn=s,ln=e;else{if(e===null)throw jt.alternate===null?Error(l(467)):Error(l(310));ln=e,e={memoizedState:ln.memoizedState,baseState:ln.baseState,baseQueue:ln.baseQueue,queue:ln.queue,next:null},Hn===null?jt.memoizedState=Hn=e:Hn=Hn.next=e}return Hn}function Hd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function qc(e){var s=Hc;return Hc+=1,_o===null&&(_o=[]),e=W0(_o,e,s),s=jt,(Hn===null?s.memoizedState:Hn.next)===null&&(s=s.alternate,T.H=s===null||s.memoizedState===null?z8:jm),e}function qd(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return qc(e);if(e.$$typeof===U)return dn(e)}throw Error(l(438,String(e)))}function fm(e){var s=null,i=jt.updateQueue;if(i!==null&&(s=i.memoCache),s==null){var o=jt.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(s={data:o.data.map(function(d){return d.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),i===null&&(i=Hd(),jt.updateQueue=i),i.memoCache=s,i=s.data[s.index],i===void 0)for(i=s.data[s.index]=Array(e),o=0;o<e;o++)i[o]=W;return s.index++,i}function hi(e,s){return typeof s=="function"?s(e):s}function Fd(e){var s=Pn();return hm(s,ln,e)}function hm(e,s,i){var o=e.queue;if(o===null)throw Error(l(311));o.lastRenderedReducer=i;var d=e.baseQueue,h=o.pending;if(h!==null){if(d!==null){var v=d.next;d.next=h.next,h.next=v}s.baseQueue=d=h,o.pending=null}if(h=e.baseState,d===null)e.memoizedState=h;else{s=d.next;var w=v=null,L=null,J=s,me=!1;do{var xe=J.lane&-536870913;if(xe!==J.lane?(Ot&xe)===xe:(fi&xe)===xe){var se=J.revertLane;if(se===0)L!==null&&(L=L.next={lane:0,revertLane:0,gesture:null,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null}),xe===ho&&(me=!0);else if((fi&se)===se){J=J.next,se===ho&&(me=!0);continue}else xe={lane:0,revertLane:J.revertLane,gesture:null,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null},L===null?(w=L=xe,v=h):L=L.next=xe,jt.lanes|=se,dr|=se;xe=J.action,pl&&i(h,xe),h=J.hasEagerState?J.eagerState:i(h,xe)}else se={lane:xe,revertLane:J.revertLane,gesture:J.gesture,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null},L===null?(w=L=se,v=h):L=L.next=se,jt.lanes|=xe,dr|=xe;J=J.next}while(J!==null&&J!==s);if(L===null?v=h:L.next=w,!gs(h,e.memoizedState)&&(qn=!0,me&&(i=mo,i!==null)))throw i;e.memoizedState=h,e.baseState=v,e.baseQueue=L,o.lastRenderedState=h}return d===null&&(o.lanes=0),[e.memoizedState,o.dispatch]}function mm(e){var s=Pn(),i=s.queue;if(i===null)throw Error(l(311));i.lastRenderedReducer=e;var o=i.dispatch,d=i.pending,h=s.memoizedState;if(d!==null){i.pending=null;var v=d=d.next;do h=e(h,v.action),v=v.next;while(v!==d);gs(h,s.memoizedState)||(qn=!0),s.memoizedState=h,s.baseQueue===null&&(s.baseState=h),i.lastRenderedState=h}return[h,o]}function a8(e,s,i){var o=jt,d=Pn(),h=Pe;if(h){if(i===void 0)throw Error(l(407));i=i()}else i=s();var v=!gs((ln||d).memoizedState,i);if(v&&(d.memoizedState=i,qn=!0),d=d.queue,ym(l8.bind(null,o,d,e),[e]),d.getSnapshot!==s||v||Hn!==null&&Hn.memoizedState.tag&1){if(o.flags|=2048,bo(9,{destroy:void 0},r8.bind(null,o,d,i,s),null),fn===null)throw Error(l(349));h||(fi&127)!==0||i8(o,s,i)}return i}function i8(e,s,i){e.flags|=16384,e={getSnapshot:s,value:i},s=jt.updateQueue,s===null?(s=Hd(),jt.updateQueue=s,s.stores=[e]):(i=s.stores,i===null?s.stores=[e]:i.push(e))}function r8(e,s,i,o){s.value=i,s.getSnapshot=o,o8(s)&&c8(e)}function l8(e,s,i){return i(function(){o8(s)&&c8(e)})}function o8(e){var s=e.getSnapshot;e=e.value;try{var i=s();return!gs(e,i)}catch{return!0}}function c8(e){var s=oi(e,2);s!==null&&$s(s,e,2)}function pm(e){var s=Ss();if(typeof e=="function"){var i=e;if(e=i(),pl){$e(!0);try{i()}finally{$e(!1)}}}return s.memoizedState=s.baseState=e,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:hi,lastRenderedState:e},s}function u8(e,s,i,o){return e.baseState=i,hm(e,ln,typeof o=="function"?o:hi)}function Uv(e,s,i,o,d){if(Wd(e))throw Error(l(485));if(e=s.action,e!==null){var h={payload:d,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(v){h.listeners.push(v)}};T.T!==null?i(!0):h.isTransition=!1,o(h),i=s.pending,i===null?(h.next=s.pending=h,d8(s,h)):(h.next=i.next,s.pending=i.next=h)}}function d8(e,s){var i=s.action,o=s.payload,d=e.state;if(s.isTransition){var h=T.T,v={};T.T=v;try{var w=i(d,o),L=T.S;L!==null&&L(v,w),f8(e,s,w)}catch(J){gm(e,s,J)}finally{h!==null&&v.types!==null&&(h.types=v.types),T.T=h}}else try{h=i(d,o),f8(e,s,h)}catch(J){gm(e,s,J)}}function f8(e,s,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(o){h8(e,s,o)},function(o){return gm(e,s,o)}):h8(e,s,i)}function h8(e,s,i){s.status="fulfilled",s.value=i,m8(s),e.state=i,s=e.pending,s!==null&&(i=s.next,i===s?e.pending=null:(i=i.next,s.next=i,d8(e,i)))}function gm(e,s,i){var o=e.pending;if(e.pending=null,o!==null){o=o.next;do s.status="rejected",s.reason=i,m8(s),s=s.next;while(s!==o)}e.action=null}function m8(e){e=e.listeners;for(var s=0;s<e.length;s++)(0,e[s])()}function p8(e,s){return s}function g8(e,s){if(Pe){var i=fn.formState;if(i!==null){e:{var o=jt;if(Pe){if(Ue){t:{for(var d=Ue,h=Un;d.nodeType!==8;){if(!h){d=null;break t}if(d=ua(d.nextSibling),d===null){d=null;break t}}h=d.data,d=h==="F!"||h==="F"?d:null}if(d){Ue=ua(d.nextSibling),o=d.data==="F!";break e}}ka(o)}o=!1}o&&(s=i[0])}}return i=Ss(),i.memoizedState=i.baseState=s,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:p8,lastRenderedState:s},i.queue=o,i=L8.bind(null,jt,o),o.dispatch=i,o=pm(!1),h=Sm.bind(null,jt,!1,o.queue),o=Ss(),d={state:s,dispatch:null,action:e,pending:null},o.queue=d,i=Uv.bind(null,jt,d,h,i),d.dispatch=i,o.memoizedState=e,[s,i,!1]}function y8(e){var s=Pn();return v8(s,ln,e)}function v8(e,s,i){if(s=hm(e,s,p8)[0],e=Fd(hi)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var o=qc(s)}catch(v){throw v===po?Od:v}else o=s;s=Pn();var d=s.queue,h=d.dispatch;return i!==s.memoizedState&&(jt.flags|=2048,bo(9,{destroy:void 0},$v.bind(null,d,i),null)),[o,h,e]}function $v(e,s){e.action=s}function _8(e){var s=Pn(),i=ln;if(i!==null)return v8(s,i,e);Pn(),s=s.memoizedState,i=Pn();var o=i.queue.dispatch;return i.memoizedState=e,[s,o,!1]}function bo(e,s,i,o){return e={tag:e,create:i,deps:o,inst:s,next:null},s=jt.updateQueue,s===null&&(s=Hd(),jt.updateQueue=s),i=s.lastEffect,i===null?s.lastEffect=e.next=e:(o=i.next,i.next=e,e.next=o,s.lastEffect=e),e}function b8(){return Pn().memoizedState}function Qd(e,s,i,o){var d=Ss();jt.flags|=e,d.memoizedState=bo(1|s,{destroy:void 0},i,o===void 0?null:o)}function Gd(e,s,i,o){var d=Pn();o=o===void 0?null:o;var h=d.memoizedState.inst;ln!==null&&o!==null&&lm(o,ln.memoizedState.deps)?d.memoizedState=bo(s,h,i,o):(jt.flags|=e,d.memoizedState=bo(1|s,h,i,o))}function x8(e,s){Qd(8390656,8,e,s)}function ym(e,s){Gd(2048,8,e,s)}function Hv(e){jt.flags|=4;var s=jt.updateQueue;if(s===null)s=Hd(),jt.updateQueue=s,s.events=[e];else{var i=s.events;i===null?s.events=[e]:i.push(e)}}function S8(e){var s=Pn().memoizedState;return Hv({ref:s,nextImpl:e}),function(){if((Vt&2)!==0)throw Error(l(440));return s.impl.apply(void 0,arguments)}}function j8(e,s){return Gd(4,2,e,s)}function w8(e,s){return Gd(4,4,e,s)}function k8(e,s){if(typeof s=="function"){e=e();var i=s(e);return function(){typeof i=="function"?i():s(null)}}if(s!=null)return e=e(),s.current=e,function(){s.current=null}}function N8(e,s,i){i=i!=null?i.concat([e]):null,Gd(4,4,k8.bind(null,s,e),i)}function vm(){}function C8(e,s){var i=Pn();s=s===void 0?null:s;var o=i.memoizedState;return s!==null&&lm(s,o[1])?o[0]:(i.memoizedState=[e,s],e)}function E8(e,s){var i=Pn();s=s===void 0?null:s;var o=i.memoizedState;if(s!==null&&lm(s,o[1]))return o[0];if(o=e(),pl){$e(!0);try{e()}finally{$e(!1)}}return i.memoizedState=[o,s],o}function _m(e,s,i){return i===void 0||(fi&1073741824)!==0&&(Ot&261930)===0?e.memoizedState=s:(e.memoizedState=i,e=Tg(),jt.lanes|=e,dr|=e,i)}function T8(e,s,i,o){return gs(i,s)?i:yo.current!==null?(e=_m(e,i,o),gs(e,s)||(qn=!0),e):(fi&42)===0||(fi&1073741824)!==0&&(Ot&261930)===0?(qn=!0,e.memoizedState=i):(e=Tg(),jt.lanes|=e,dr|=e,s)}function M8(e,s,i,o,d){var h=$.p;$.p=h!==0&&8>h?h:8;var v=T.T,w={};T.T=w,Sm(e,!1,s,i);try{var L=d(),J=T.S;if(J!==null&&J(w,L),L!==null&&typeof L=="object"&&typeof L.then=="function"){var me=Pv(L,o);Fc(e,s,me,aa(e))}else Fc(e,s,o,aa(e))}catch(xe){Fc(e,s,{then:function(){},status:"rejected",reason:xe},aa())}finally{$.p=h,v!==null&&w.types!==null&&(v.types=w.types),T.T=v}}function qv(){}function bm(e,s,i,o){if(e.tag!==5)throw Error(l(476));var d=R8(e).queue;M8(e,d,s,ue,i===null?qv:function(){return A8(e),i(o)})}function R8(e){var s=e.memoizedState;if(s!==null)return s;s={memoizedState:ue,baseState:ue,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:hi,lastRenderedState:ue},next:null};var i={};return s.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:hi,lastRenderedState:i},next:null},e.memoizedState=s,e=e.alternate,e!==null&&(e.memoizedState=s),s}function A8(e){var s=R8(e);s.next===null&&(s=e.alternate.memoizedState),Fc(e,s.next.queue,{},aa())}function xm(){return dn(lu)}function D8(){return Pn().memoizedState}function O8(){return Pn().memoizedState}function Fv(e){for(var s=e.return;s!==null;){switch(s.tag){case 24:case 3:var i=aa();e=ir(i);var o=rr(s,e,i);o!==null&&($s(o,s,i),Bc(o,s,i)),s={cache:Kh()},e.payload=s;return}s=s.return}}function Qv(e,s,i){var o=aa();i={lane:o,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Wd(e)?I8(s,i):(i=Ec(e,s,i,o),i!==null&&($s(i,e,o),P8(i,s,o)))}function L8(e,s,i){var o=aa();Fc(e,s,i,o)}function Fc(e,s,i,o){var d={lane:o,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(Wd(e))I8(s,d);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=s.lastRenderedReducer,h!==null))try{var v=s.lastRenderedState,w=h(v,i);if(d.hasEagerState=!0,d.eagerState=w,gs(w,v))return io(e,s,d,0),fn===null&&ll(),!1}catch{}finally{}if(i=Ec(e,s,d,o),i!==null)return $s(i,e,o),P8(i,s,o),!0}return!1}function Sm(e,s,i,o){if(o={lane:2,revertLane:ep(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Wd(e)){if(s)throw Error(l(479))}else s=Ec(e,i,o,2),s!==null&&$s(s,e,2)}function Wd(e){var s=e.alternate;return e===jt||s!==null&&s===jt}function I8(e,s){vo=Ud=!0;var i=e.pending;i===null?s.next=s:(s.next=i.next,i.next=s),e.pending=s}function P8(e,s,i){if((i&4194048)!==0){var o=s.lanes;o&=e.pendingLanes,i|=o,s.lanes=i,ya(e,i)}}var Qc={readContext:dn,use:qd,useCallback:Mn,useContext:Mn,useEffect:Mn,useImperativeHandle:Mn,useLayoutEffect:Mn,useInsertionEffect:Mn,useMemo:Mn,useReducer:Mn,useRef:Mn,useState:Mn,useDebugValue:Mn,useDeferredValue:Mn,useTransition:Mn,useSyncExternalStore:Mn,useId:Mn,useHostTransitionStatus:Mn,useFormState:Mn,useActionState:Mn,useOptimistic:Mn,useMemoCache:Mn,useCacheRefresh:Mn};Qc.useEffectEvent=Mn;var z8={readContext:dn,use:qd,useCallback:function(e,s){return Ss().memoizedState=[e,s===void 0?null:s],e},useContext:dn,useEffect:x8,useImperativeHandle:function(e,s,i){i=i!=null?i.concat([e]):null,Qd(4194308,4,k8.bind(null,s,e),i)},useLayoutEffect:function(e,s){return Qd(4194308,4,e,s)},useInsertionEffect:function(e,s){Qd(4,2,e,s)},useMemo:function(e,s){var i=Ss();s=s===void 0?null:s;var o=e();if(pl){$e(!0);try{e()}finally{$e(!1)}}return i.memoizedState=[o,s],o},useReducer:function(e,s,i){var o=Ss();if(i!==void 0){var d=i(s);if(pl){$e(!0);try{i(s)}finally{$e(!1)}}}else d=s;return o.memoizedState=o.baseState=d,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:d},o.queue=e,e=e.dispatch=Qv.bind(null,jt,e),[o.memoizedState,e]},useRef:function(e){var s=Ss();return e={current:e},s.memoizedState=e},useState:function(e){e=pm(e);var s=e.queue,i=L8.bind(null,jt,s);return s.dispatch=i,[e.memoizedState,i]},useDebugValue:vm,useDeferredValue:function(e,s){var i=Ss();return _m(i,e,s)},useTransition:function(){var e=pm(!1);return e=M8.bind(null,jt,e.queue,!0,!1),Ss().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,s,i){var o=jt,d=Ss();if(Pe){if(i===void 0)throw Error(l(407));i=i()}else{if(i=s(),fn===null)throw Error(l(349));(Ot&127)!==0||i8(o,s,i)}d.memoizedState=i;var h={value:i,getSnapshot:s};return d.queue=h,x8(l8.bind(null,o,h,e),[e]),o.flags|=2048,bo(9,{destroy:void 0},r8.bind(null,o,h,i,s),null),i},useId:function(){var e=Ss(),s=fn.identifierPrefix;if(Pe){var i=Js,o=Xs;i=(o&~(1<<32-De(o)-1)).toString(32)+i,s="_"+s+"R_"+i,i=$d++,0<i&&(s+="H"+i.toString(32)),s+="_"}else i=zv++,s="_"+s+"r_"+i.toString(32)+"_";return e.memoizedState=s},useHostTransitionStatus:xm,useFormState:g8,useActionState:g8,useOptimistic:function(e){var s=Ss();s.memoizedState=s.baseState=e;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=i,s=Sm.bind(null,jt,!0,i),i.dispatch=s,[e,s]},useMemoCache:fm,useCacheRefresh:function(){return Ss().memoizedState=Fv.bind(null,jt)},useEffectEvent:function(e){var s=Ss(),i={impl:e};return s.memoizedState=i,function(){if((Vt&2)!==0)throw Error(l(440));return i.impl.apply(void 0,arguments)}}},jm={readContext:dn,use:qd,useCallback:C8,useContext:dn,useEffect:ym,useImperativeHandle:N8,useInsertionEffect:j8,useLayoutEffect:w8,useMemo:E8,useReducer:Fd,useRef:b8,useState:function(){return Fd(hi)},useDebugValue:vm,useDeferredValue:function(e,s){var i=Pn();return T8(i,ln.memoizedState,e,s)},useTransition:function(){var e=Fd(hi)[0],s=Pn().memoizedState;return[typeof e=="boolean"?e:qc(e),s]},useSyncExternalStore:a8,useId:D8,useHostTransitionStatus:xm,useFormState:y8,useActionState:y8,useOptimistic:function(e,s){var i=Pn();return u8(i,ln,e,s)},useMemoCache:fm,useCacheRefresh:O8};jm.useEffectEvent=S8;var B8={readContext:dn,use:qd,useCallback:C8,useContext:dn,useEffect:ym,useImperativeHandle:N8,useInsertionEffect:j8,useLayoutEffect:w8,useMemo:E8,useReducer:mm,useRef:b8,useState:function(){return mm(hi)},useDebugValue:vm,useDeferredValue:function(e,s){var i=Pn();return ln===null?_m(i,e,s):T8(i,ln.memoizedState,e,s)},useTransition:function(){var e=mm(hi)[0],s=Pn().memoizedState;return[typeof e=="boolean"?e:qc(e),s]},useSyncExternalStore:a8,useId:D8,useHostTransitionStatus:xm,useFormState:_8,useActionState:_8,useOptimistic:function(e,s){var i=Pn();return ln!==null?u8(i,ln,e,s):(i.baseState=e,[e,i.queue.dispatch])},useMemoCache:fm,useCacheRefresh:O8};B8.useEffectEvent=S8;function wm(e,s,i,o){s=e.memoizedState,i=i(o,s),i=i==null?s:g({},s,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var km={enqueueSetState:function(e,s,i){e=e._reactInternals;var o=aa(),d=ir(o);d.payload=s,i!=null&&(d.callback=i),s=rr(e,d,o),s!==null&&($s(s,e,o),Bc(s,e,o))},enqueueReplaceState:function(e,s,i){e=e._reactInternals;var o=aa(),d=ir(o);d.tag=1,d.payload=s,i!=null&&(d.callback=i),s=rr(e,d,o),s!==null&&($s(s,e,o),Bc(s,e,o))},enqueueForceUpdate:function(e,s){e=e._reactInternals;var i=aa(),o=ir(i);o.tag=2,s!=null&&(o.callback=s),s=rr(e,o,i),s!==null&&($s(s,e,i),Bc(s,e,i))}};function U8(e,s,i,o,d,h,v){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(o,h,v):s.prototype&&s.prototype.isPureReactComponent?!Ki(i,o)||!Ki(d,h):!0}function $8(e,s,i,o){e=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(i,o),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(i,o),s.state!==e&&km.enqueueReplaceState(s,s.state,null)}function gl(e,s){var i=s;if("ref"in s){i={};for(var o in s)o!=="ref"&&(i[o]=s[o])}if(e=e.defaultProps){i===s&&(i=g({},i));for(var d in e)i[d]===void 0&&(i[d]=e[d])}return i}function H8(e){rl(e)}function q8(e){console.error(e)}function F8(e){rl(e)}function Yd(e,s){try{var i=e.onUncaughtError;i(s.value,{componentStack:s.stack})}catch(o){setTimeout(function(){throw o})}}function Q8(e,s,i){try{var o=e.onCaughtError;o(i.value,{componentStack:i.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(d){setTimeout(function(){throw d})}}function Nm(e,s,i){return i=ir(i),i.tag=3,i.payload={element:null},i.callback=function(){Yd(e,s)},i}function G8(e){return e=ir(e),e.tag=3,e}function W8(e,s,i,o){var d=i.type.getDerivedStateFromError;if(typeof d=="function"){var h=o.value;e.payload=function(){return d(h)},e.callback=function(){Q8(s,i,o)}}var v=i.stateNode;v!==null&&typeof v.componentDidCatch=="function"&&(e.callback=function(){Q8(s,i,o),typeof d!="function"&&(fr===null?fr=new Set([this]):fr.add(this));var w=o.stack;this.componentDidCatch(o.value,{componentStack:w!==null?w:""})})}function Gv(e,s,i,o,d){if(i.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(s=i.alternate,s!==null&&Tt(s,i,d,!0),i=ea.current,i!==null){switch(i.tag){case 31:case 13:return ca===null?lf():i.alternate===null&&Rn===0&&(Rn=3),i.flags&=-257,i.flags|=65536,i.lanes=d,o===Ld?i.flags|=16384:(s=i.updateQueue,s===null?i.updateQueue=new Set([o]):s.add(o),Zm(e,o,d)),!1;case 22:return i.flags|=65536,o===Ld?i.flags|=16384:(s=i.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([o])},i.updateQueue=s):(i=s.retryQueue,i===null?s.retryQueue=new Set([o]):i.add(o)),Zm(e,o,d)),!1}throw Error(l(435,i.tag))}return Zm(e,o,d),lf(),!1}if(Pe)return s=ea.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=d,o!==tr&&(e=Error(l(422),{cause:o}),nr(_s(e,i)))):(o!==tr&&(s=Error(l(423),{cause:o}),nr(_s(s,i))),e=e.current.alternate,e.flags|=65536,d&=-d,e.lanes|=d,o=_s(o,i),d=Nm(e.stateNode,o,d),nm(e,d),Rn!==4&&(Rn=2)),!1;var h=Error(l(520),{cause:o});if(h=_s(h,i),Jc===null?Jc=[h]:Jc.push(h),Rn!==4&&(Rn=2),s===null)return!0;o=_s(o,i),i=s;do{switch(i.tag){case 3:return i.flags|=65536,e=d&-d,i.lanes|=e,e=Nm(i.stateNode,o,e),nm(i,e),!1;case 1:if(s=i.type,h=i.stateNode,(i.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&(fr===null||!fr.has(h))))return i.flags|=65536,d&=-d,i.lanes|=d,d=G8(d),W8(d,e,i,o),nm(i,d),!1}i=i.return}while(i!==null);return!1}var Cm=Error(l(461)),qn=!1;function os(e,s,i,o){s.child=e===null?Z0(s,null,i,o):ml(s,e.child,i,o)}function Y8(e,s,i,o,d){i=i.render;var h=s.ref;if("ref"in o){var v={};for(var w in o)w!=="ref"&&(v[w]=o[w])}else v=o;return Ft(s),o=om(e,s,i,v,h,d),w=cm(),e!==null&&!qn?(um(e,s,d),mi(e,s,d)):(Pe&&w&&Q(s),s.flags|=1,os(e,s,o,d),s.child)}function V8(e,s,i,o,d){if(e===null){var h=i.type;return typeof h=="function"&&!ro(h)&&h.defaultProps===void 0&&i.compare===null?(s.tag=15,s.type=h,K8(e,s,h,o,d)):(e=cl(i.type,null,o,s,s.mode,d),e.ref=s.ref,e.return=s,s.child=e)}if(h=e.child,!Lm(e,d)){var v=h.memoizedProps;if(i=i.compare,i=i!==null?i:Ki,i(v,o)&&e.ref===s.ref)return mi(e,s,d)}return s.flags|=1,e=Pa(h,o),e.ref=s.ref,e.return=s,s.child=e}function K8(e,s,i,o,d){if(e!==null){var h=e.memoizedProps;if(Ki(h,o)&&e.ref===s.ref)if(qn=!1,s.pendingProps=o=h,Lm(e,d))(e.flags&131072)!==0&&(qn=!0);else return s.lanes=e.lanes,mi(e,s,d)}return Em(e,s,i,o,d)}function Z8(e,s,i,o){var d=o.children,h=e!==null?e.memoizedState:null;if(e===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((s.flags&128)!==0){if(h=h!==null?h.baseLanes|i:i,e!==null){for(o=s.child=e.child,d=0;o!==null;)d=d|o.lanes|o.childLanes,o=o.sibling;o=d&~h}else o=0,s.child=null;return X8(e,s,h,i,o)}if((i&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},e!==null&&Dd(s,h!==null?h.cachePool:null),h!==null?e8(s,h):am(),t8(s);else return o=s.lanes=536870912,X8(e,s,h!==null?h.baseLanes|i:i,i,o)}else h!==null?(Dd(s,h.cachePool),e8(s,h),or(),s.memoizedState=null):(e!==null&&Dd(s,null),am(),or());return os(e,s,d,i),s.child}function Gc(e,s){return e!==null&&e.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function X8(e,s,i,o,d){var h=Xh();return h=h===null?null:{parent:$n._currentValue,pool:h},s.memoizedState={baseLanes:i,cachePool:h},e!==null&&Dd(s,null),am(),t8(s),e!==null&&Tt(e,s,o,!0),s.childLanes=d,null}function Vd(e,s){return s=Zd({mode:s.mode,children:s.children},e.mode),s.ref=e.ref,e.child=s,s.return=e,s}function J8(e,s,i){return ml(s,e.child,null,i),e=Vd(s,s.pendingProps),e.flags|=2,ta(s),s.memoizedState=null,e}function Wv(e,s,i){var o=s.pendingProps,d=(s.flags&128)!==0;if(s.flags&=-129,e===null){if(Pe){if(o.mode==="hidden")return e=Vd(s,o),s.lanes=536870912,Gc(null,e);if(rm(s),(e=Ue)?(e=d4(e,Un),e=e!==null&&e.data==="&"?e:null,e!==null&&(s.memoizedState={dehydrated:e,treeContext:wa!==null?{id:Xs,overflow:Js}:null,retryLane:536870912,hydrationErrors:null},i=Rc(e),i.return=s,s.child=i,ze=s,Ue=null)):e=null,e===null)throw ka(s);return s.lanes=536870912,null}return Vd(s,o)}var h=e.memoizedState;if(h!==null){var v=h.dehydrated;if(rm(s),d)if(s.flags&256)s.flags&=-257,s=J8(e,s,i);else if(s.memoizedState!==null)s.child=e.child,s.flags|=128,s=null;else throw Error(l(558));else if(qn||Tt(e,s,i,!1),d=(i&e.childLanes)!==0,qn||d){if(o=fn,o!==null&&(v=va(o,i),v!==0&&v!==h.retryLane))throw h.retryLane=v,oi(e,v),$s(o,e,v),Cm;lf(),s=J8(e,s,i)}else e=h.treeContext,Ue=ua(v.nextSibling),ze=s,Pe=!0,Ln=null,Un=!1,e!==null&&st(s,e),s=Vd(s,o),s.flags|=4096;return s}return e=Pa(e.child,{mode:o.mode,children:o.children}),e.ref=s.ref,s.child=e,e.return=s,e}function Kd(e,s){var i=s.ref;if(i===null)e!==null&&e.ref!==null&&(s.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(l(284));(e===null||e.ref!==i)&&(s.flags|=4194816)}}function Em(e,s,i,o,d){return Ft(s),i=om(e,s,i,o,void 0,d),o=cm(),e!==null&&!qn?(um(e,s,d),mi(e,s,d)):(Pe&&o&&Q(s),s.flags|=1,os(e,s,i,d),s.child)}function eg(e,s,i,o,d,h){return Ft(s),s.updateQueue=null,i=s8(s,o,i,d),n8(e),o=cm(),e!==null&&!qn?(um(e,s,h),mi(e,s,h)):(Pe&&o&&Q(s),s.flags|=1,os(e,s,i,h),s.child)}function tg(e,s,i,o,d){if(Ft(s),s.stateNode===null){var h=Ji,v=i.contextType;typeof v=="object"&&v!==null&&(h=dn(v)),h=new i(o,h),s.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=km,s.stateNode=h,h._reactInternals=s,h=s.stateNode,h.props=o,h.state=s.memoizedState,h.refs={},em(s),v=i.contextType,h.context=typeof v=="object"&&v!==null?dn(v):Ji,h.state=s.memoizedState,v=i.getDerivedStateFromProps,typeof v=="function"&&(wm(s,i,v,o),h.state=s.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(v=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),v!==h.state&&km.enqueueReplaceState(h,h.state,null),$c(s,o,h,d),Uc(),h.state=s.memoizedState),typeof h.componentDidMount=="function"&&(s.flags|=4194308),o=!0}else if(e===null){h=s.stateNode;var w=s.memoizedProps,L=gl(i,w);h.props=L;var J=h.context,me=i.contextType;v=Ji,typeof me=="object"&&me!==null&&(v=dn(me));var xe=i.getDerivedStateFromProps;me=typeof xe=="function"||typeof h.getSnapshotBeforeUpdate=="function",w=s.pendingProps!==w,me||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(w||J!==v)&&$8(s,h,o,v),ar=!1;var se=s.memoizedState;h.state=se,$c(s,o,h,d),Uc(),J=s.memoizedState,w||se!==J||ar?(typeof xe=="function"&&(wm(s,i,xe,o),J=s.memoizedState),(L=ar||U8(s,i,L,o,se,J,v))?(me||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount()),typeof h.componentDidMount=="function"&&(s.flags|=4194308)):(typeof h.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=o,s.memoizedState=J),h.props=o,h.state=J,h.context=v,o=L):(typeof h.componentDidMount=="function"&&(s.flags|=4194308),o=!1)}else{h=s.stateNode,tm(e,s),v=s.memoizedProps,me=gl(i,v),h.props=me,xe=s.pendingProps,se=h.context,J=i.contextType,L=Ji,typeof J=="object"&&J!==null&&(L=dn(J)),w=i.getDerivedStateFromProps,(J=typeof w=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(v!==xe||se!==L)&&$8(s,h,o,L),ar=!1,se=s.memoizedState,h.state=se,$c(s,o,h,d),Uc();var ce=s.memoizedState;v!==xe||se!==ce||ar||e!==null&&e.dependencies!==null&&en(e.dependencies)?(typeof w=="function"&&(wm(s,i,w,o),ce=s.memoizedState),(me=ar||U8(s,i,me,o,se,ce,L)||e!==null&&e.dependencies!==null&&en(e.dependencies))?(J||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(o,ce,L),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(o,ce,L)),typeof h.componentDidUpdate=="function"&&(s.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof h.componentDidUpdate!="function"||v===e.memoizedProps&&se===e.memoizedState||(s.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||v===e.memoizedProps&&se===e.memoizedState||(s.flags|=1024),s.memoizedProps=o,s.memoizedState=ce),h.props=o,h.state=ce,h.context=L,o=me):(typeof h.componentDidUpdate!="function"||v===e.memoizedProps&&se===e.memoizedState||(s.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||v===e.memoizedProps&&se===e.memoizedState||(s.flags|=1024),o=!1)}return h=o,Kd(e,s),o=(s.flags&128)!==0,h||o?(h=s.stateNode,i=o&&typeof i.getDerivedStateFromError!="function"?null:h.render(),s.flags|=1,e!==null&&o?(s.child=ml(s,e.child,null,d),s.child=ml(s,null,i,d)):os(e,s,i,d),s.memoizedState=h.state,e=s.child):e=mi(e,s,d),e}function ng(e,s,i,o){return Ba(),s.flags|=256,os(e,s,i,o),s.child}var Tm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Mm(e){return{baseLanes:e,cachePool:Q0()}}function Rm(e,s,i){return e=e!==null?e.childLanes&~i:0,s&&(e|=sa),e}function sg(e,s,i){var o=s.pendingProps,d=!1,h=(s.flags&128)!==0,v;if((v=h)||(v=e!==null&&e.memoizedState===null?!1:(In.current&2)!==0),v&&(d=!0,s.flags&=-129),v=(s.flags&32)!==0,s.flags&=-33,e===null){if(Pe){if(d?lr(s):or(),(e=Ue)?(e=d4(e,Un),e=e!==null&&e.data!=="&"?e:null,e!==null&&(s.memoizedState={dehydrated:e,treeContext:wa!==null?{id:Xs,overflow:Js}:null,retryLane:536870912,hydrationErrors:null},i=Rc(e),i.return=s,s.child=i,ze=s,Ue=null)):e=null,e===null)throw ka(s);return hp(e)?s.lanes=32:s.lanes=536870912,null}var w=o.children;return o=o.fallback,d?(or(),d=s.mode,w=Zd({mode:"hidden",children:w},d),o=za(o,d,i,null),w.return=s,o.return=s,w.sibling=o,s.child=w,o=s.child,o.memoizedState=Mm(i),o.childLanes=Rm(e,v,i),s.memoizedState=Tm,Gc(null,o)):(lr(s),Am(s,w))}var L=e.memoizedState;if(L!==null&&(w=L.dehydrated,w!==null)){if(h)s.flags&256?(lr(s),s.flags&=-257,s=Dm(e,s,i)):s.memoizedState!==null?(or(),s.child=e.child,s.flags|=128,s=null):(or(),w=o.fallback,d=s.mode,o=Zd({mode:"visible",children:o.children},d),w=za(w,d,i,null),w.flags|=2,o.return=s,w.return=s,o.sibling=w,s.child=o,ml(s,e.child,null,i),o=s.child,o.memoizedState=Mm(i),o.childLanes=Rm(e,v,i),s.memoizedState=Tm,s=Gc(null,o));else if(lr(s),hp(w)){if(v=w.nextSibling&&w.nextSibling.dataset,v)var J=v.dgst;v=J,o=Error(l(419)),o.stack="",o.digest=v,nr({value:o,source:null,stack:null}),s=Dm(e,s,i)}else if(qn||Tt(e,s,i,!1),v=(i&e.childLanes)!==0,qn||v){if(v=fn,v!==null&&(o=va(v,i),o!==0&&o!==L.retryLane))throw L.retryLane=o,oi(e,o),$s(v,e,o),Cm;fp(w)||lf(),s=Dm(e,s,i)}else fp(w)?(s.flags|=192,s.child=e.child,s=null):(e=L.treeContext,Ue=ua(w.nextSibling),ze=s,Pe=!0,Ln=null,Un=!1,e!==null&&st(s,e),s=Am(s,o.children),s.flags|=4096);return s}return d?(or(),w=o.fallback,d=s.mode,L=e.child,J=L.sibling,o=Pa(L,{mode:"hidden",children:o.children}),o.subtreeFlags=L.subtreeFlags&65011712,J!==null?w=Pa(J,w):(w=za(w,d,i,null),w.flags|=2),w.return=s,o.return=s,o.sibling=w,s.child=o,Gc(null,o),o=s.child,w=e.child.memoizedState,w===null?w=Mm(i):(d=w.cachePool,d!==null?(L=$n._currentValue,d=d.parent!==L?{parent:L,pool:L}:d):d=Q0(),w={baseLanes:w.baseLanes|i,cachePool:d}),o.memoizedState=w,o.childLanes=Rm(e,v,i),s.memoizedState=Tm,Gc(e.child,o)):(lr(s),i=e.child,e=i.sibling,i=Pa(i,{mode:"visible",children:o.children}),i.return=s,i.sibling=null,e!==null&&(v=s.deletions,v===null?(s.deletions=[e],s.flags|=16):v.push(e)),s.child=i,s.memoizedState=null,i)}function Am(e,s){return s=Zd({mode:"visible",children:s},e.mode),s.return=e,e.child=s}function Zd(e,s){return e=vs(22,e,null,s),e.lanes=0,e}function Dm(e,s,i){return ml(s,e.child,null,i),e=Am(s,s.pendingProps.children),e.flags|=2,s.memoizedState=null,e}function ag(e,s,i){e.lanes|=s;var o=e.alternate;o!==null&&(o.lanes|=s),ut(e.return,s,i)}function Om(e,s,i,o,d,h){var v=e.memoizedState;v===null?e.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:o,tail:i,tailMode:d,treeForkCount:h}:(v.isBackwards=s,v.rendering=null,v.renderingStartTime=0,v.last=o,v.tail=i,v.tailMode=d,v.treeForkCount=h)}function ig(e,s,i){var o=s.pendingProps,d=o.revealOrder,h=o.tail;o=o.children;var v=In.current,w=(v&2)!==0;if(w?(v=v&1|2,s.flags|=128):v&=1,je(In,v),os(e,s,o,i),o=Pe?er:0,!w&&e!==null&&(e.flags&128)!==0)e:for(e=s.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&ag(e,i,s);else if(e.tag===19)ag(e,i,s);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===s)break e;for(;e.sibling===null;){if(e.return===null||e.return===s)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(d){case"forwards":for(i=s.child,d=null;i!==null;)e=i.alternate,e!==null&&Bd(e)===null&&(d=i),i=i.sibling;i=d,i===null?(d=s.child,s.child=null):(d=i.sibling,i.sibling=null),Om(s,!1,d,i,h,o);break;case"backwards":case"unstable_legacy-backwards":for(i=null,d=s.child,s.child=null;d!==null;){if(e=d.alternate,e!==null&&Bd(e)===null){s.child=d;break}e=d.sibling,d.sibling=i,i=d,d=e}Om(s,!0,i,null,h,o);break;case"together":Om(s,!1,null,null,void 0,o);break;default:s.memoizedState=null}return s.child}function mi(e,s,i){if(e!==null&&(s.dependencies=e.dependencies),dr|=s.lanes,(i&s.childLanes)===0)if(e!==null){if(Tt(e,s,i,!1),(i&s.childLanes)===0)return null}else return null;if(e!==null&&s.child!==e.child)throw Error(l(153));if(s.child!==null){for(e=s.child,i=Pa(e,e.pendingProps),s.child=i,i.return=s;e.sibling!==null;)e=e.sibling,i=i.sibling=Pa(e,e.pendingProps),i.return=s;i.sibling=null}return s.child}function Lm(e,s){return(e.lanes&s)!==0?!0:(e=e.dependencies,!!(e!==null&&en(e)))}function Yv(e,s,i){switch(s.tag){case 3:ie(s,s.stateNode.containerInfo),Na(s,$n,e.memoizedState.cache),Ba();break;case 27:case 5:we(s);break;case 4:ie(s,s.stateNode.containerInfo);break;case 10:Na(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,rm(s),null;break;case 13:var o=s.memoizedState;if(o!==null)return o.dehydrated!==null?(lr(s),s.flags|=128,null):(i&s.child.childLanes)!==0?sg(e,s,i):(lr(s),e=mi(e,s,i),e!==null?e.sibling:null);lr(s);break;case 19:var d=(e.flags&128)!==0;if(o=(i&s.childLanes)!==0,o||(Tt(e,s,i,!1),o=(i&s.childLanes)!==0),d){if(o)return ig(e,s,i);s.flags|=128}if(d=s.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),je(In,In.current),o)break;return null;case 22:return s.lanes=0,Z8(e,s,i,s.pendingProps);case 24:Na(s,$n,e.memoizedState.cache)}return mi(e,s,i)}function rg(e,s,i){if(e!==null)if(e.memoizedProps!==s.pendingProps)qn=!0;else{if(!Lm(e,i)&&(s.flags&128)===0)return qn=!1,Yv(e,s,i);qn=(e.flags&131072)!==0}else qn=!1,Pe&&(s.flags&1048576)!==0&&O(s,er,s.index);switch(s.lanes=0,s.tag){case 16:e:{var o=s.pendingProps;if(e=fl(s.elementType),s.type=e,typeof e=="function")ro(e)?(o=gl(e,o),s.tag=1,s=tg(null,s,e,o,i)):(s.tag=0,s=Em(null,s,e,o,i));else{if(e!=null){var d=e.$$typeof;if(d===R){s.tag=11,s=Y8(null,s,e,o,i);break e}else if(d===V){s.tag=14,s=V8(null,s,e,o,i);break e}}throw s=Y(e)||e,Error(l(306,s,""))}}return s;case 0:return Em(e,s,s.type,s.pendingProps,i);case 1:return o=s.type,d=gl(o,s.pendingProps),tg(e,s,o,d,i);case 3:e:{if(ie(s,s.stateNode.containerInfo),e===null)throw Error(l(387));o=s.pendingProps;var h=s.memoizedState;d=h.element,tm(e,s),$c(s,o,null,i);var v=s.memoizedState;if(o=v.cache,Na(s,$n,o),o!==h.cache&&Jt(s,[$n],i,!0),Uc(),o=v.element,h.isDehydrated)if(h={element:o,isDehydrated:!1,cache:v.cache},s.updateQueue.baseState=h,s.memoizedState=h,s.flags&256){s=ng(e,s,o,i);break e}else if(o!==d){d=_s(Error(l(424)),s),nr(d),s=ng(e,s,o,i);break e}else{switch(e=s.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Ue=ua(e.firstChild),ze=s,Pe=!0,Ln=null,Un=!0,i=Z0(s,null,o,i),s.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(Ba(),o===d){s=mi(e,s,i);break e}os(e,s,o,i)}s=s.child}return s;case 26:return Kd(e,s),e===null?(i=y4(s.type,null,s.pendingProps,null))?s.memoizedState=i:Pe||(i=s.type,e=s.pendingProps,o=mf(oe.current).createElement(i),o[Oe]=s,o[Be]=e,cs(o,i,e),C(o),s.stateNode=o):s.memoizedState=y4(s.type,e.memoizedProps,s.pendingProps,e.memoizedState),null;case 27:return we(s),e===null&&Pe&&(o=s.stateNode=m4(s.type,s.pendingProps,oe.current),ze=s,Un=!0,d=Ue,gr(s.type)?(mp=d,Ue=ua(o.firstChild)):Ue=d),os(e,s,s.pendingProps.children,i),Kd(e,s),e===null&&(s.flags|=4194304),s.child;case 5:return e===null&&Pe&&((d=o=Ue)&&(o=w_(o,s.type,s.pendingProps,Un),o!==null?(s.stateNode=o,ze=s,Ue=ua(o.firstChild),Un=!1,d=!0):d=!1),d||ka(s)),we(s),d=s.type,h=s.pendingProps,v=e!==null?e.memoizedProps:null,o=h.children,cp(d,h)?o=null:v!==null&&cp(d,v)&&(s.flags|=32),s.memoizedState!==null&&(d=om(e,s,Bv,null,null,i),lu._currentValue=d),Kd(e,s),os(e,s,o,i),s.child;case 6:return e===null&&Pe&&((e=i=Ue)&&(i=k_(i,s.pendingProps,Un),i!==null?(s.stateNode=i,ze=s,Ue=null,e=!0):e=!1),e||ka(s)),null;case 13:return sg(e,s,i);case 4:return ie(s,s.stateNode.containerInfo),o=s.pendingProps,e===null?s.child=ml(s,null,o,i):os(e,s,o,i),s.child;case 11:return Y8(e,s,s.type,s.pendingProps,i);case 7:return os(e,s,s.pendingProps,i),s.child;case 8:return os(e,s,s.pendingProps.children,i),s.child;case 12:return os(e,s,s.pendingProps.children,i),s.child;case 10:return o=s.pendingProps,Na(s,s.type,o.value),os(e,s,o.children,i),s.child;case 9:return d=s.type._context,o=s.pendingProps.children,Ft(s),d=dn(d),o=o(d),s.flags|=1,os(e,s,o,i),s.child;case 14:return V8(e,s,s.type,s.pendingProps,i);case 15:return K8(e,s,s.type,s.pendingProps,i);case 19:return ig(e,s,i);case 31:return Wv(e,s,i);case 22:return Z8(e,s,i,s.pendingProps);case 24:return Ft(s),o=dn($n),e===null?(d=Xh(),d===null&&(d=fn,h=Kh(),d.pooledCache=h,h.refCount++,h!==null&&(d.pooledCacheLanes|=i),d=h),s.memoizedState={parent:o,cache:d},em(s),Na(s,$n,d)):((e.lanes&i)!==0&&(tm(e,s),$c(s,null,null,i),Uc()),d=e.memoizedState,h=s.memoizedState,d.parent!==o?(d={parent:o,cache:o},s.memoizedState=d,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=d),Na(s,$n,o)):(o=h.cache,Na(s,$n,o),o!==d.cache&&Jt(s,[$n],i,!0))),os(e,s,s.pendingProps.children,i),s.child;case 29:throw s.pendingProps}throw Error(l(156,s.tag))}function pi(e){e.flags|=4}function Im(e,s,i,o,d){if((s=(e.mode&32)!==0)&&(s=!1),s){if(e.flags|=16777216,(d&335544128)===d)if(e.stateNode.complete)e.flags|=8192;else if(Dg())e.flags|=8192;else throw hl=Ld,Jh}else e.flags&=-16777217}function lg(e,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!S4(s))if(Dg())e.flags|=8192;else throw hl=Ld,Jh}function Xd(e,s){s!==null&&(e.flags|=4),e.flags&16384&&(s=e.tag!==22?Dn():536870912,e.lanes|=s,wo|=s)}function Wc(e,s){if(!Pe)switch(e.tailMode){case"hidden":s=e.tail;for(var i=null;s!==null;)s.alternate!==null&&(i=s),s=s.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?s||e.tail===null?e.tail=null:e.tail.sibling=null:o.sibling=null}}function yn(e){var s=e.alternate!==null&&e.alternate.child===e.child,i=0,o=0;if(s)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,s}function Vv(e,s,i){var o=s.pendingProps;switch(le(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return yn(s),null;case 1:return yn(s),null;case 3:return i=s.stateNode,o=null,e!==null&&(o=e.memoizedState.cache),s.memoizedState.cache!==o&&(s.flags|=2048),oa($n),z(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(di(s)?pi(s):e===null||e.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,co())),yn(s),null;case 26:var d=s.type,h=s.memoizedState;return e===null?(pi(s),h!==null?(yn(s),lg(s,h)):(yn(s),Im(s,d,null,o,i))):h?h!==e.memoizedState?(pi(s),yn(s),lg(s,h)):(yn(s),s.flags&=-16777217):(e=e.memoizedProps,e!==o&&pi(s),yn(s),Im(s,d,e,o,i)),null;case 27:if(ke(s),i=oe.current,d=s.type,e!==null&&s.stateNode!=null)e.memoizedProps!==o&&pi(s);else{if(!o){if(s.stateNode===null)throw Error(l(166));return yn(s),null}e=Se.current,di(s)?Dc(s):(e=m4(d,o,i),s.stateNode=e,pi(s))}return yn(s),null;case 5:if(ke(s),d=s.type,e!==null&&s.stateNode!=null)e.memoizedProps!==o&&pi(s);else{if(!o){if(s.stateNode===null)throw Error(l(166));return yn(s),null}if(h=Se.current,di(s))Dc(s);else{var v=mf(oe.current);switch(h){case 1:h=v.createElementNS("http://www.w3.org/2000/svg",d);break;case 2:h=v.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;default:switch(d){case"svg":h=v.createElementNS("http://www.w3.org/2000/svg",d);break;case"math":h=v.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;case"script":h=v.createElement("div"),h.innerHTML="<script><\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof o.is=="string"?v.createElement("select",{is:o.is}):v.createElement("select"),o.multiple?h.multiple=!0:o.size&&(h.size=o.size);break;default:h=typeof o.is=="string"?v.createElement(d,{is:o.is}):v.createElement(d)}}h[Oe]=s,h[Be]=o;e:for(v=s.child;v!==null;){if(v.tag===5||v.tag===6)h.appendChild(v.stateNode);else if(v.tag!==4&&v.tag!==27&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===s)break e;for(;v.sibling===null;){if(v.return===null||v.return===s)break e;v=v.return}v.sibling.return=v.return,v=v.sibling}s.stateNode=h;e:switch(cs(h,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&&pi(s)}}return yn(s),Im(s,s.type,e===null?null:e.memoizedProps,s.pendingProps,i),null;case 6:if(e&&s.stateNode!=null)e.memoizedProps!==o&&pi(s);else{if(typeof o!="string"&&s.stateNode===null)throw Error(l(166));if(e=oe.current,di(s)){if(e=s.stateNode,i=s.memoizedProps,o=null,d=ze,d!==null)switch(d.tag){case 27:case 5:o=d.memoizedProps}e[Oe]=s,e=!!(e.nodeValue===i||o!==null&&o.suppressHydrationWarning===!0||s4(e.nodeValue,i)),e||ka(s,!0)}else e=mf(e).createTextNode(o),e[Oe]=s,s.stateNode=e}return yn(s),null;case 31:if(i=s.memoizedState,e===null||e.memoizedState!==null){if(o=di(s),i!==null){if(e===null){if(!o)throw Error(l(318));if(e=s.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(557));e[Oe]=s}else Ba(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;yn(s),e=!1}else i=co(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),e=!0;if(!e)return s.flags&256?(ta(s),s):(ta(s),null);if((s.flags&128)!==0)throw Error(l(558))}return yn(s),null;case 13:if(o=s.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(d=di(s),o!==null&&o.dehydrated!==null){if(e===null){if(!d)throw Error(l(318));if(d=s.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(l(317));d[Oe]=s}else Ba(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;yn(s),d=!1}else d=co(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=d),d=!0;if(!d)return s.flags&256?(ta(s),s):(ta(s),null)}return ta(s),(s.flags&128)!==0?(s.lanes=i,s):(i=o!==null,e=e!==null&&e.memoizedState!==null,i&&(o=s.child,d=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(d=o.alternate.memoizedState.cachePool.pool),h=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(h=o.memoizedState.cachePool.pool),h!==d&&(o.flags|=2048)),i!==e&&i&&(s.child.flags|=8192),Xd(s,s.updateQueue),yn(s),null);case 4:return z(),e===null&&ap(s.stateNode.containerInfo),yn(s),null;case 10:return oa(s.type),yn(s),null;case 19:if(te(In),o=s.memoizedState,o===null)return yn(s),null;if(d=(s.flags&128)!==0,h=o.rendering,h===null)if(d)Wc(o,!1);else{if(Rn!==0||e!==null&&(e.flags&128)!==0)for(e=s.child;e!==null;){if(h=Bd(e),h!==null){for(s.flags|=128,Wc(o,!1),e=h.updateQueue,s.updateQueue=e,Xd(s,e),s.subtreeFlags=0,e=i,i=s.child;i!==null;)Mc(i,e),i=i.sibling;return je(In,In.current&1|2),Pe&&b(s,o.treeForkCount),s.child}e=e.sibling}o.tail!==null&&Ie()>sf&&(s.flags|=128,d=!0,Wc(o,!1),s.lanes=4194304)}else{if(!d)if(e=Bd(h),e!==null){if(s.flags|=128,d=!0,e=e.updateQueue,s.updateQueue=e,Xd(s,e),Wc(o,!0),o.tail===null&&o.tailMode==="hidden"&&!h.alternate&&!Pe)return yn(s),null}else 2*Ie()-o.renderingStartTime>sf&&i!==536870912&&(s.flags|=128,d=!0,Wc(o,!1),s.lanes=4194304);o.isBackwards?(h.sibling=s.child,s.child=h):(e=o.last,e!==null?e.sibling=h:s.child=h,o.last=h)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=Ie(),e.sibling=null,i=In.current,je(In,d?i&1|2:i&1),Pe&&b(s,o.treeForkCount),e):(yn(s),null);case 22:case 23:return ta(s),im(),o=s.memoizedState!==null,e!==null?e.memoizedState!==null!==o&&(s.flags|=8192):o&&(s.flags|=8192),o?(i&536870912)!==0&&(s.flags&128)===0&&(yn(s),s.subtreeFlags&6&&(s.flags|=8192)):yn(s),i=s.updateQueue,i!==null&&Xd(s,i.retryQueue),i=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),o=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(o=s.memoizedState.cachePool.pool),o!==i&&(s.flags|=2048),e!==null&&te(dl),null;case 24:return i=null,e!==null&&(i=e.memoizedState.cache),s.memoizedState.cache!==i&&(s.flags|=2048),oa($n),yn(s),null;case 25:return null;case 30:return null}throw Error(l(156,s.tag))}function Kv(e,s){switch(le(s),s.tag){case 1:return e=s.flags,e&65536?(s.flags=e&-65537|128,s):null;case 3:return oa($n),z(),e=s.flags,(e&65536)!==0&&(e&128)===0?(s.flags=e&-65537|128,s):null;case 26:case 27:case 5:return ke(s),null;case 31:if(s.memoizedState!==null){if(ta(s),s.alternate===null)throw Error(l(340));Ba()}return e=s.flags,e&65536?(s.flags=e&-65537|128,s):null;case 13:if(ta(s),e=s.memoizedState,e!==null&&e.dehydrated!==null){if(s.alternate===null)throw Error(l(340));Ba()}return e=s.flags,e&65536?(s.flags=e&-65537|128,s):null;case 19:return te(In),null;case 4:return z(),null;case 10:return oa(s.type),null;case 22:case 23:return ta(s),im(),e!==null&&te(dl),e=s.flags,e&65536?(s.flags=e&-65537|128,s):null;case 24:return oa($n),null;case 25:return null;default:return null}}function og(e,s){switch(le(s),s.tag){case 3:oa($n),z();break;case 26:case 27:case 5:ke(s);break;case 4:z();break;case 31:s.memoizedState!==null&&ta(s);break;case 13:ta(s);break;case 19:te(In);break;case 10:oa(s.type);break;case 22:case 23:ta(s),im(),e!==null&&te(dl);break;case 24:oa($n)}}function Yc(e,s){try{var i=s.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 h=i.create,v=i.inst;o=h(),v.destroy=o}i=i.next}while(i!==d)}}catch(w){an(s,s.return,w)}}function cr(e,s,i){try{var o=s.updateQueue,d=o!==null?o.lastEffect:null;if(d!==null){var h=d.next;o=h;do{if((o.tag&e)===e){var v=o.inst,w=v.destroy;if(w!==void 0){v.destroy=void 0,d=s;var L=i,J=w;try{J()}catch(me){an(d,L,me)}}}o=o.next}while(o!==h)}}catch(me){an(s,s.return,me)}}function cg(e){var s=e.updateQueue;if(s!==null){var i=e.stateNode;try{J0(s,i)}catch(o){an(e,e.return,o)}}}function ug(e,s,i){i.props=gl(e.type,e.memoizedProps),i.state=e.memoizedState;try{i.componentWillUnmount()}catch(o){an(e,s,o)}}function Vc(e,s){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){an(e,s,d)}}function $a(e,s){var i=e.ref,o=e.refCleanup;if(i!==null)if(typeof o=="function")try{o()}catch(d){an(e,s,d)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(d){an(e,s,d)}else i.current=null}function dg(e){var s=e.type,i=e.memoizedProps,o=e.stateNode;try{e:switch(s){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){an(e,e.return,d)}}function Pm(e,s,i){try{var o=e.stateNode;v_(o,e.type,i,s),o[Be]=s}catch(d){an(e,e.return,d)}}function fg(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&gr(e.type)||e.tag===4}function zm(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||fg(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&&gr(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,s,i){var o=e.tag;if(o===5||o===6)e=e.stateNode,s?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(e,s):(s=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,s.appendChild(e),i=i._reactRootContainer,i!=null||s.onclick!==null||(s.onclick=Ms));else if(o!==4&&(o===27&&gr(e.type)&&(i=e.stateNode,s=null),e=e.child,e!==null))for(Bm(e,s,i),e=e.sibling;e!==null;)Bm(e,s,i),e=e.sibling}function Jd(e,s,i){var o=e.tag;if(o===5||o===6)e=e.stateNode,s?i.insertBefore(e,s):i.appendChild(e);else if(o!==4&&(o===27&&gr(e.type)&&(i=e.stateNode),e=e.child,e!==null))for(Jd(e,s,i),e=e.sibling;e!==null;)Jd(e,s,i),e=e.sibling}function hg(e){var s=e.stateNode,i=e.memoizedProps;try{for(var o=e.type,d=s.attributes;d.length;)s.removeAttributeNode(d[0]);cs(s,o,i),s[Oe]=e,s[Be]=i}catch(h){an(e,e.return,h)}}var gi=!1,Fn=!1,Um=!1,mg=typeof WeakSet=="function"?WeakSet:Set,Jn=null;function Zv(e,s){if(e=e.containerInfo,lp=xf,e=wd(e),wc(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,h=o.focusNode;o=o.focusOffset;try{i.nodeType,h.nodeType}catch{i=null;break e}var v=0,w=-1,L=-1,J=0,me=0,xe=e,se=null;t:for(;;){for(var ce;xe!==i||d!==0&&xe.nodeType!==3||(w=v+d),xe!==h||o!==0&&xe.nodeType!==3||(L=v+o),xe.nodeType===3&&(v+=xe.nodeValue.length),(ce=xe.firstChild)!==null;)se=xe,xe=ce;for(;;){if(xe===e)break t;if(se===i&&++J===d&&(w=v),se===h&&++me===o&&(L=v),(ce=xe.nextSibling)!==null)break;xe=se,se=xe.parentNode}xe=ce}i=w===-1||L===-1?null:{start:w,end:L}}else i=null}i=i||{start:0,end:0}}else i=null;for(op={focusedElem:e,selectionRange:i},xf=!1,Jn=s;Jn!==null;)if(s=Jn,e=s.child,(s.subtreeFlags&1028)!==0&&e!==null)e.return=s,Jn=e;else for(;Jn!==null;){switch(s=Jn,h=s.alternate,e=s.flags,s.tag){case 0:if((e&4)!==0&&(e=s.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&&h!==null){e=void 0,i=s,d=h.memoizedProps,h=h.memoizedState,o=i.stateNode;try{var Ve=gl(i.type,d);e=o.getSnapshotBeforeUpdate(Ve,h),o.__reactInternalSnapshotBeforeUpdate=e}catch(ft){an(i,i.return,ft)}}break;case 3:if((e&1024)!==0){if(e=s.stateNode.containerInfo,i=e.nodeType,i===9)dp(e);else if(i===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":dp(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(l(163))}if(e=s.sibling,e!==null){e.return=s.return,Jn=e;break}Jn=s.return}}function pg(e,s,i){var o=i.flags;switch(i.tag){case 0:case 11:case 15:vi(e,i),o&4&&Yc(5,i);break;case 1:if(vi(e,i),o&4)if(e=i.stateNode,s===null)try{e.componentDidMount()}catch(v){an(i,i.return,v)}else{var d=gl(i.type,s.memoizedProps);s=s.memoizedState;try{e.componentDidUpdate(d,s,e.__reactInternalSnapshotBeforeUpdate)}catch(v){an(i,i.return,v)}}o&64&&cg(i),o&512&&Vc(i,i.return);break;case 3:if(vi(e,i),o&64&&(e=i.updateQueue,e!==null)){if(s=null,i.child!==null)switch(i.child.tag){case 27:case 5:s=i.child.stateNode;break;case 1:s=i.child.stateNode}try{J0(e,s)}catch(v){an(i,i.return,v)}}break;case 27:s===null&&o&4&&hg(i);case 26:case 5:vi(e,i),s===null&&o&4&&dg(i),o&512&&Vc(i,i.return);break;case 12:vi(e,i);break;case 31:vi(e,i),o&4&&vg(e,i);break;case 13:vi(e,i),o&4&&_g(e,i),o&64&&(e=i.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(i=r_.bind(null,i),N_(e,i))));break;case 22:if(o=i.memoizedState!==null||gi,!o){s=s!==null&&s.memoizedState!==null||Fn,d=gi;var h=Fn;gi=o,(Fn=s)&&!h?_i(e,i,(i.subtreeFlags&8772)!==0):vi(e,i),gi=d,Fn=h}break;case 30:break;default:vi(e,i)}}function gg(e){var s=e.alternate;s!==null&&(e.alternate=null,gg(s)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(s=e.stateNode,s!==null&&Nn(s)),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 bn=null,Ps=!1;function yi(e,s,i){for(i=i.child;i!==null;)yg(e,s,i),i=i.sibling}function yg(e,s,i){if(ae&&typeof ae.onCommitFiberUnmount=="function")try{ae.onCommitFiberUnmount(Sn,i)}catch{}switch(i.tag){case 26:Fn||$a(i,s),yi(e,s,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:Fn||$a(i,s);var o=bn,d=Ps;gr(i.type)&&(bn=i.stateNode,Ps=!1),yi(e,s,i),au(i.stateNode),bn=o,Ps=d;break;case 5:Fn||$a(i,s);case 6:if(o=bn,d=Ps,bn=null,yi(e,s,i),bn=o,Ps=d,bn!==null)if(Ps)try{(bn.nodeType===9?bn.body:bn.nodeName==="HTML"?bn.ownerDocument.body:bn).removeChild(i.stateNode)}catch(h){an(i,s,h)}else try{bn.removeChild(i.stateNode)}catch(h){an(i,s,h)}break;case 18:bn!==null&&(Ps?(e=bn,c4(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,i.stateNode),Ao(e)):c4(bn,i.stateNode));break;case 4:o=bn,d=Ps,bn=i.stateNode.containerInfo,Ps=!0,yi(e,s,i),bn=o,Ps=d;break;case 0:case 11:case 14:case 15:cr(2,i,s),Fn||cr(4,i,s),yi(e,s,i);break;case 1:Fn||($a(i,s),o=i.stateNode,typeof o.componentWillUnmount=="function"&&ug(i,s,o)),yi(e,s,i);break;case 21:yi(e,s,i);break;case 22:Fn=(o=Fn)||i.memoizedState!==null,yi(e,s,i),Fn=o;break;default:yi(e,s,i)}}function vg(e,s){if(s.memoizedState===null&&(e=s.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Ao(e)}catch(i){an(s,s.return,i)}}}function _g(e,s){if(s.memoizedState===null&&(e=s.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Ao(e)}catch(i){an(s,s.return,i)}}function Xv(e){switch(e.tag){case 31:case 13:case 19:var s=e.stateNode;return s===null&&(s=e.stateNode=new mg),s;case 22:return e=e.stateNode,s=e._retryCache,s===null&&(s=e._retryCache=new mg),s;default:throw Error(l(435,e.tag))}}function ef(e,s){var i=Xv(e);s.forEach(function(o){if(!i.has(o)){i.add(o);var d=l_.bind(null,e,o);o.then(d,d)}})}function zs(e,s){var i=s.deletions;if(i!==null)for(var o=0;o<i.length;o++){var d=i[o],h=e,v=s,w=v;e:for(;w!==null;){switch(w.tag){case 27:if(gr(w.type)){bn=w.stateNode,Ps=!1;break e}break;case 5:bn=w.stateNode,Ps=!1;break e;case 3:case 4:bn=w.stateNode.containerInfo,Ps=!0;break e}w=w.return}if(bn===null)throw Error(l(160));yg(h,v,d),bn=null,Ps=!1,h=d.alternate,h!==null&&(h.return=null),d.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)bg(s,e),s=s.sibling}var Ca=null;function bg(e,s){var i=e.alternate,o=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:zs(s,e),Bs(e),o&4&&(cr(3,e,e.return),Yc(3,e),cr(5,e,e.return));break;case 1:zs(s,e),Bs(e),o&512&&(Fn||i===null||$a(i,i.return)),o&64&&gi&&(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=Ca;if(zs(s,e),Bs(e),o&512&&(Fn||i===null||$a(i,i.return)),o&4){var h=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":h=d.getElementsByTagName("title")[0],(!h||h[mn]||h[Oe]||h.namespaceURI==="http://www.w3.org/2000/svg"||h.hasAttribute("itemprop"))&&(h=d.createElement(o),d.head.insertBefore(h,d.querySelector("head > title"))),cs(h,o,i),h[Oe]=e,C(h),o=h;break e;case"link":var v=b4("link","href",d).get(o+(i.href||""));if(v){for(var w=0;w<v.length;w++)if(h=v[w],h.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&h.getAttribute("rel")===(i.rel==null?null:i.rel)&&h.getAttribute("title")===(i.title==null?null:i.title)&&h.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){v.splice(w,1);break t}}h=d.createElement(o),cs(h,o,i),d.head.appendChild(h);break;case"meta":if(v=b4("meta","content",d).get(o+(i.content||""))){for(w=0;w<v.length;w++)if(h=v[w],h.getAttribute("content")===(i.content==null?null:""+i.content)&&h.getAttribute("name")===(i.name==null?null:i.name)&&h.getAttribute("property")===(i.property==null?null:i.property)&&h.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&h.getAttribute("charset")===(i.charSet==null?null:i.charSet)){v.splice(w,1);break t}}h=d.createElement(o),cs(h,o,i),d.head.appendChild(h);break;default:throw Error(l(468,o))}h[Oe]=e,C(h),o=h}e.stateNode=o}else x4(d,e.type,e.stateNode);else e.stateNode=_4(d,o,e.memoizedProps);else h!==o?(h===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):h.count--,o===null?x4(d,e.type,e.stateNode):_4(d,o,e.memoizedProps)):o===null&&e.stateNode!==null&&Pm(e,e.memoizedProps,i.memoizedProps)}break;case 27:zs(s,e),Bs(e),o&512&&(Fn||i===null||$a(i,i.return)),i!==null&&o&4&&Pm(e,e.memoizedProps,i.memoizedProps);break;case 5:if(zs(s,e),Bs(e),o&512&&(Fn||i===null||$a(i,i.return)),e.flags&32){d=e.stateNode;try{Aa(d,"")}catch(Ve){an(e,e.return,Ve)}}o&4&&e.stateNode!=null&&(d=e.memoizedProps,Pm(e,d,i!==null?i.memoizedProps:d)),o&1024&&(Um=!0);break;case 6:if(zs(s,e),Bs(e),o&4){if(e.stateNode===null)throw Error(l(162));o=e.memoizedProps,i=e.stateNode;try{i.nodeValue=o}catch(Ve){an(e,e.return,Ve)}}break;case 3:if(yf=null,d=Ca,Ca=pf(s.containerInfo),zs(s,e),Ca=d,Bs(e),o&4&&i!==null&&i.memoizedState.isDehydrated)try{Ao(s.containerInfo)}catch(Ve){an(e,e.return,Ve)}Um&&(Um=!1,xg(e));break;case 4:o=Ca,Ca=pf(e.stateNode.containerInfo),zs(s,e),Bs(e),Ca=o;break;case 12:zs(s,e),Bs(e);break;case 31:zs(s,e),Bs(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,ef(e,o)));break;case 13:zs(s,e),Bs(e),e.child.flags&8192&&e.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(nf=Ie()),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,ef(e,o)));break;case 22:d=e.memoizedState!==null;var L=i!==null&&i.memoizedState!==null,J=gi,me=Fn;if(gi=J||d,Fn=me||L,zs(s,e),Fn=me,gi=J,Bs(e),o&8192)e:for(s=e.stateNode,s._visibility=d?s._visibility&-2:s._visibility|1,d&&(i===null||L||gi||Fn||yl(e)),i=null,s=e;;){if(s.tag===5||s.tag===26){if(i===null){L=i=s;try{if(h=L.stateNode,d)v=h.style,typeof v.setProperty=="function"?v.setProperty("display","none","important"):v.display="none";else{w=L.stateNode;var xe=L.memoizedProps.style,se=xe!=null&&xe.hasOwnProperty("display")?xe.display:null;w.style.display=se==null||typeof se=="boolean"?"":(""+se).trim()}}catch(Ve){an(L,L.return,Ve)}}}else if(s.tag===6){if(i===null){L=s;try{L.stateNode.nodeValue=d?"":L.memoizedProps}catch(Ve){an(L,L.return,Ve)}}}else if(s.tag===18){if(i===null){L=s;try{var ce=L.stateNode;d?u4(ce,!0):u4(L.stateNode,!1)}catch(Ve){an(L,L.return,Ve)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===e)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===e)break e;for(;s.sibling===null;){if(s.return===null||s.return===e)break e;i===s&&(i=null),s=s.return}i===s&&(i=null),s.sibling.return=s.return,s=s.sibling}o&4&&(o=e.updateQueue,o!==null&&(i=o.retryQueue,i!==null&&(o.retryQueue=null,ef(e,i))));break;case 19:zs(s,e),Bs(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,ef(e,o)));break;case 30:break;case 21:break;default:zs(s,e),Bs(e)}}function Bs(e){var s=e.flags;if(s&2){try{for(var i,o=e.return;o!==null;){if(fg(o)){i=o;break}o=o.return}if(i==null)throw Error(l(160));switch(i.tag){case 27:var d=i.stateNode,h=zm(e);Jd(e,h,d);break;case 5:var v=i.stateNode;i.flags&32&&(Aa(v,""),i.flags&=-33);var w=zm(e);Jd(e,w,v);break;case 3:case 4:var L=i.stateNode.containerInfo,J=zm(e);Bm(e,J,L);break;default:throw Error(l(161))}}catch(me){an(e,e.return,me)}e.flags&=-3}s&4096&&(e.flags&=-4097)}function xg(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var s=e;xg(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),e=e.sibling}}function vi(e,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)pg(e,s.alternate,s),s=s.sibling}function yl(e){for(e=e.child;e!==null;){var s=e;switch(s.tag){case 0:case 11:case 14:case 15:cr(4,s,s.return),yl(s);break;case 1:$a(s,s.return);var i=s.stateNode;typeof i.componentWillUnmount=="function"&&ug(s,s.return,i),yl(s);break;case 27:au(s.stateNode);case 26:case 5:$a(s,s.return),yl(s);break;case 22:s.memoizedState===null&&yl(s);break;case 30:yl(s);break;default:yl(s)}e=e.sibling}}function _i(e,s,i){for(i=i&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var o=s.alternate,d=e,h=s,v=h.flags;switch(h.tag){case 0:case 11:case 15:_i(d,h,i),Yc(4,h);break;case 1:if(_i(d,h,i),o=h,d=o.stateNode,typeof d.componentDidMount=="function")try{d.componentDidMount()}catch(J){an(o,o.return,J)}if(o=h,d=o.updateQueue,d!==null){var w=o.stateNode;try{var L=d.shared.hiddenCallbacks;if(L!==null)for(d.shared.hiddenCallbacks=null,d=0;d<L.length;d++)X0(L[d],w)}catch(J){an(o,o.return,J)}}i&&v&64&&cg(h),Vc(h,h.return);break;case 27:hg(h);case 26:case 5:_i(d,h,i),i&&o===null&&v&4&&dg(h),Vc(h,h.return);break;case 12:_i(d,h,i);break;case 31:_i(d,h,i),i&&v&4&&vg(d,h);break;case 13:_i(d,h,i),i&&v&4&&_g(d,h);break;case 22:h.memoizedState===null&&_i(d,h,i),Vc(h,h.return);break;case 30:break;default:_i(d,h,i)}s=s.sibling}}function $m(e,s){var i=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),e=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(e=s.memoizedState.cachePool.pool),e!==i&&(e!=null&&e.refCount++,i!=null&&Lc(i))}function Hm(e,s){e=null,s.alternate!==null&&(e=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==e&&(s.refCount++,e!=null&&Lc(e))}function Ea(e,s,i,o){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)Sg(e,s,i,o),s=s.sibling}function Sg(e,s,i,o){var d=s.flags;switch(s.tag){case 0:case 11:case 15:Ea(e,s,i,o),d&2048&&Yc(9,s);break;case 1:Ea(e,s,i,o);break;case 3:Ea(e,s,i,o),d&2048&&(e=null,s.alternate!==null&&(e=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==e&&(s.refCount++,e!=null&&Lc(e)));break;case 12:if(d&2048){Ea(e,s,i,o),e=s.stateNode;try{var h=s.memoizedProps,v=h.id,w=h.onPostCommit;typeof w=="function"&&w(v,s.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(L){an(s,s.return,L)}}else Ea(e,s,i,o);break;case 31:Ea(e,s,i,o);break;case 13:Ea(e,s,i,o);break;case 23:break;case 22:h=s.stateNode,v=s.alternate,s.memoizedState!==null?h._visibility&2?Ea(e,s,i,o):Kc(e,s):h._visibility&2?Ea(e,s,i,o):(h._visibility|=2,xo(e,s,i,o,(s.subtreeFlags&10256)!==0||!1)),d&2048&&$m(v,s);break;case 24:Ea(e,s,i,o),d&2048&&Hm(s.alternate,s);break;default:Ea(e,s,i,o)}}function xo(e,s,i,o,d){for(d=d&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var h=e,v=s,w=i,L=o,J=v.flags;switch(v.tag){case 0:case 11:case 15:xo(h,v,w,L,d),Yc(8,v);break;case 23:break;case 22:var me=v.stateNode;v.memoizedState!==null?me._visibility&2?xo(h,v,w,L,d):Kc(h,v):(me._visibility|=2,xo(h,v,w,L,d)),d&&J&2048&&$m(v.alternate,v);break;case 24:xo(h,v,w,L,d),d&&J&2048&&Hm(v.alternate,v);break;default:xo(h,v,w,L,d)}s=s.sibling}}function Kc(e,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var i=e,o=s,d=o.flags;switch(o.tag){case 22:Kc(i,o),d&2048&&$m(o.alternate,o);break;case 24:Kc(i,o),d&2048&&Hm(o.alternate,o);break;default:Kc(i,o)}s=s.sibling}}var Zc=8192;function So(e,s,i){if(e.subtreeFlags&Zc)for(e=e.child;e!==null;)jg(e,s,i),e=e.sibling}function jg(e,s,i){switch(e.tag){case 26:So(e,s,i),e.flags&Zc&&e.memoizedState!==null&&z_(i,Ca,e.memoizedState,e.memoizedProps);break;case 5:So(e,s,i);break;case 3:case 4:var o=Ca;Ca=pf(e.stateNode.containerInfo),So(e,s,i),Ca=o;break;case 22:e.memoizedState===null&&(o=e.alternate,o!==null&&o.memoizedState!==null?(o=Zc,Zc=16777216,So(e,s,i),Zc=o):So(e,s,i));break;default:So(e,s,i)}}function wg(e){var s=e.alternate;if(s!==null&&(e=s.child,e!==null)){s.child=null;do s=e.sibling,e.sibling=null,e=s;while(e!==null)}}function Xc(e){var s=e.deletions;if((e.flags&16)!==0){if(s!==null)for(var i=0;i<s.length;i++){var o=s[i];Jn=o,Ng(o,e)}wg(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)kg(e),e=e.sibling}function kg(e){switch(e.tag){case 0:case 11:case 15:Xc(e),e.flags&2048&&cr(9,e,e.return);break;case 3:Xc(e);break;case 12:Xc(e);break;case 22:var s=e.stateNode;e.memoizedState!==null&&s._visibility&2&&(e.return===null||e.return.tag!==13)?(s._visibility&=-3,tf(e)):Xc(e);break;default:Xc(e)}}function tf(e){var s=e.deletions;if((e.flags&16)!==0){if(s!==null)for(var i=0;i<s.length;i++){var o=s[i];Jn=o,Ng(o,e)}wg(e)}for(e=e.child;e!==null;){switch(s=e,s.tag){case 0:case 11:case 15:cr(8,s,s.return),tf(s);break;case 22:i=s.stateNode,i._visibility&2&&(i._visibility&=-3,tf(s));break;default:tf(s)}e=e.sibling}}function Ng(e,s){for(;Jn!==null;){var i=Jn;switch(i.tag){case 0:case 11:case 15:cr(8,i,s);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:Lc(i.memoizedState.cache)}if(o=i.child,o!==null)o.return=i,Jn=o;else e:for(i=e;Jn!==null;){o=Jn;var d=o.sibling,h=o.return;if(gg(o),o===i){Jn=null;break e}if(d!==null){d.return=h,Jn=d;break e}Jn=h}}}var Jv={getCacheForType:function(e){var s=dn($n),i=s.data.get(e);return i===void 0&&(i=e(),s.data.set(e,i)),i},cacheSignal:function(){return dn($n).controller.signal}},e_=typeof WeakMap=="function"?WeakMap:Map,Vt=0,fn=null,Mt=null,Ot=0,sn=0,na=null,ur=!1,jo=!1,qm=!1,bi=0,Rn=0,dr=0,vl=0,Fm=0,sa=0,wo=0,Jc=null,Us=null,Qm=!1,nf=0,Cg=0,sf=1/0,af=null,fr=null,Vn=0,hr=null,ko=null,xi=0,Gm=0,Wm=null,Eg=null,eu=0,Ym=null;function aa(){return(Vt&2)!==0&&Ot!==0?Ot&-Ot:T.T!==null?ep():Va()}function Tg(){if(sa===0)if((Ot&536870912)===0||Pe){var e=nn;nn<<=1,(nn&3932160)===0&&(nn=262144),sa=e}else sa=536870912;return e=ea.current,e!==null&&(e.flags|=32),sa}function $s(e,s,i){(e===fn&&(sn===2||sn===9)||e.cancelPendingCommit!==null)&&(No(e,0),mr(e,Ot,sa,!1)),Gs(e,i),((Vt&2)===0||e!==fn)&&(e===fn&&((Vt&2)===0&&(vl|=i),Rn===4&&mr(e,Ot,sa,!1)),Ha(e))}function Mg(e,s,i){if((Vt&6)!==0)throw Error(l(327));var o=!i&&(s&127)===0&&(s&e.expiredLanes)===0||Ee(e,s),d=o?s_(e,s):Km(e,s,!0),h=o;do{if(d===0){jo&&!o&&mr(e,s,0,!1);break}else{if(i=e.current.alternate,h&&!t_(i)){d=Km(e,s,!1),h=!1;continue}if(d===2){if(h=s,e.errorRecoveryDisabledLanes&h)var v=0;else v=e.pendingLanes&-536870913,v=v!==0?v:v&536870912?536870912:0;if(v!==0){s=v;e:{var w=e;d=Jc;var L=w.current.memoizedState.isDehydrated;if(L&&(No(w,v).flags|=256),v=Km(w,v,!1),v!==2){if(qm&&!L){w.errorRecoveryDisabledLanes|=h,vl|=h,d=4;break e}h=Us,Us=d,h!==null&&(Us===null?Us=h:Us.push.apply(Us,h))}d=v}if(h=!1,d!==2)continue}}if(d===1){No(e,0),mr(e,s,0,!0);break}e:{switch(o=e,h=d,h){case 0:case 1:throw Error(l(345));case 4:if((s&4194048)!==s)break;case 6:mr(o,s,sa,!ur);break e;case 2:Us=null;break;case 3:case 5:break;default:throw Error(l(329))}if((s&62914560)===s&&(d=nf+300-Ie(),10<d)){if(mr(o,s,sa,!ur),kn(o,0,!0)!==0)break e;xi=s,o.timeoutHandle=l4(Rg.bind(null,o,i,Us,af,Qm,s,sa,vl,wo,ur,h,"Throttled",-0,0),d);break e}Rg(o,i,Us,af,Qm,s,sa,vl,wo,ur,h,null,-0,0)}}break}while(!0);Ha(e)}function Rg(e,s,i,o,d,h,v,w,L,J,me,xe,se,ce){if(e.timeoutHandle=-1,xe=s.subtreeFlags,xe&8192||(xe&16785408)===16785408){xe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ms},jg(s,h,xe);var Ve=(h&62914560)===h?nf-Ie():(h&4194048)===h?Cg-Ie():0;if(Ve=B_(xe,Ve),Ve!==null){xi=h,e.cancelPendingCommit=Ve(Bg.bind(null,e,s,h,i,o,d,v,w,L,me,xe,null,se,ce)),mr(e,h,v,!J);return}}Bg(e,s,h,i,o,d,v,w,L)}function t_(e){for(var s=e;;){var i=s.tag;if((i===0||i===11||i===15)&&s.flags&16384&&(i=s.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var o=0;o<i.length;o++){var d=i[o],h=d.getSnapshot;d=d.value;try{if(!gs(h(),d))return!1}catch{return!1}}if(i=s.child,s.subtreeFlags&16384&&i!==null)i.return=s,s=i;else{if(s===e)break;for(;s.sibling===null;){if(s.return===null||s.return===e)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function mr(e,s,i,o){s&=~Fm,s&=~vl,e.suspendedLanes|=s,e.pingedLanes&=~s,o&&(e.warmLanes|=s),o=e.expirationTimes;for(var d=s;0<d;){var h=31-De(d),v=1<<h;o[h]=-1,d&=~v}i!==0&&ds(e,i,s)}function rf(){return(Vt&6)===0?(tu(0),!1):!0}function Vm(){if(Mt!==null){if(sn===0)var e=Mt.return;else e=Mt,la=Ua=null,dm(e),go=null,Pc=0,e=Mt;for(;e!==null;)og(e.alternate,e),e=e.return;Mt=null}}function No(e,s){var i=e.timeoutHandle;i!==-1&&(e.timeoutHandle=-1,x_(i)),i=e.cancelPendingCommit,i!==null&&(e.cancelPendingCommit=null,i()),xi=0,Vm(),fn=e,Mt=i=Pa(e.current,null),Ot=s,sn=0,na=null,ur=!1,jo=Ee(e,s),qm=!1,wo=sa=Fm=vl=dr=Rn=0,Us=Jc=null,Qm=!1,(s&8)!==0&&(s|=s&32);var o=e.entangledLanes;if(o!==0)for(e=e.entanglements,o&=s;0<o;){var d=31-De(o),h=1<<d;s|=e[d],o&=~h}return bi=s,ll(),i}function Ag(e,s){jt=null,T.H=Qc,s===po||s===Od?(s=Y0(),sn=3):s===Jh?(s=Y0(),sn=4):sn=s===Cm?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,na=s,Mt===null&&(Rn=1,Yd(e,_s(s,e.current)))}function Dg(){var e=ea.current;return e===null?!0:(Ot&4194048)===Ot?ca===null:(Ot&62914560)===Ot||(Ot&536870912)!==0?e===ca:!1}function Og(){var e=T.H;return T.H=Qc,e===null?Qc:e}function Lg(){var e=T.A;return T.A=Jv,e}function lf(){Rn=4,ur||(Ot&4194048)!==Ot&&ea.current!==null||(jo=!0),(dr&134217727)===0&&(vl&134217727)===0||fn===null||mr(fn,Ot,sa,!1)}function Km(e,s,i){var o=Vt;Vt|=2;var d=Og(),h=Lg();(fn!==e||Ot!==s)&&(af=null,No(e,s)),s=!1;var v=Rn;e:do try{if(sn!==0&&Mt!==null){var w=Mt,L=na;switch(sn){case 8:Vm(),v=6;break e;case 3:case 2:case 9:case 6:ea.current===null&&(s=!0);var J=sn;if(sn=0,na=null,Co(e,w,L,J),i&&jo){v=0;break e}break;default:J=sn,sn=0,na=null,Co(e,w,L,J)}}n_(),v=Rn;break}catch(me){Ag(e,me)}while(!0);return s&&e.shellSuspendCounter++,la=Ua=null,Vt=o,T.H=d,T.A=h,Mt===null&&(fn=null,Ot=0,ll()),v}function n_(){for(;Mt!==null;)Ig(Mt)}function s_(e,s){var i=Vt;Vt|=2;var o=Og(),d=Lg();fn!==e||Ot!==s?(af=null,sf=Ie()+500,No(e,s)):jo=Ee(e,s);e:do try{if(sn!==0&&Mt!==null){s=Mt;var h=na;t:switch(sn){case 1:sn=0,na=null,Co(e,s,h,1);break;case 2:case 9:if(G0(h)){sn=0,na=null,Pg(s);break}s=function(){sn!==2&&sn!==9||fn!==e||(sn=7),Ha(e)},h.then(s,s);break e;case 3:sn=7;break e;case 4:sn=5;break e;case 7:G0(h)?(sn=0,na=null,Pg(s)):(sn=0,na=null,Co(e,s,h,7));break;case 5:var v=null;switch(Mt.tag){case 26:v=Mt.memoizedState;case 5:case 27:var w=Mt;if(v?S4(v):w.stateNode.complete){sn=0,na=null;var L=w.sibling;if(L!==null)Mt=L;else{var J=w.return;J!==null?(Mt=J,of(J)):Mt=null}break t}}sn=0,na=null,Co(e,s,h,5);break;case 6:sn=0,na=null,Co(e,s,h,6);break;case 8:Vm(),Rn=6;break e;default:throw Error(l(462))}}a_();break}catch(me){Ag(e,me)}while(!0);return la=Ua=null,T.H=o,T.A=d,Vt=i,Mt!==null?0:(fn=null,Ot=0,ll(),Rn)}function a_(){for(;Mt!==null&&!fe();)Ig(Mt)}function Ig(e){var s=rg(e.alternate,e,bi);e.memoizedProps=e.pendingProps,s===null?of(e):Mt=s}function Pg(e){var s=e,i=s.alternate;switch(s.tag){case 15:case 0:s=eg(i,s,s.pendingProps,s.type,void 0,Ot);break;case 11:s=eg(i,s,s.pendingProps,s.type.render,s.ref,Ot);break;case 5:dm(s);default:og(i,s),s=Mt=Mc(s,bi),s=rg(i,s,bi)}e.memoizedProps=e.pendingProps,s===null?of(e):Mt=s}function Co(e,s,i,o){la=Ua=null,dm(s),go=null,Pc=0;var d=s.return;try{if(Gv(e,d,s,i,Ot)){Rn=1,Yd(e,_s(i,e.current)),Mt=null;return}}catch(h){if(d!==null)throw Mt=d,h;Rn=1,Yd(e,_s(i,e.current)),Mt=null;return}s.flags&32768?(Pe||o===1?e=!0:jo||(Ot&536870912)!==0?e=!1:(ur=e=!0,(o===2||o===9||o===3||o===6)&&(o=ea.current,o!==null&&o.tag===13&&(o.flags|=16384))),zg(s,e)):of(s)}function of(e){var s=e;do{if((s.flags&32768)!==0){zg(s,ur);return}e=s.return;var i=Vv(s.alternate,s,bi);if(i!==null){Mt=i;return}if(s=s.sibling,s!==null){Mt=s;return}Mt=s=e}while(s!==null);Rn===0&&(Rn=5)}function zg(e,s){do{var i=Kv(e.alternate,e);if(i!==null){i.flags&=32767,Mt=i;return}if(i=e.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!s&&(e=e.sibling,e!==null)){Mt=e;return}Mt=e=i}while(e!==null);Rn=6,Mt=null}function Bg(e,s,i,o,d,h,v,w,L){e.cancelPendingCommit=null;do cf();while(Vn!==0);if((Vt&6)!==0)throw Error(l(327));if(s!==null){if(s===e.current)throw Error(l(177));if(h=s.lanes|s.childLanes,h|=ao,Bi(e,i,h,v,w,L),e===fn&&(Mt=fn=null,Ot=0),ko=s,hr=e,xi=i,Gm=h,Wm=d,Eg=o,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,o_(qe,function(){return Fg(),null})):(e.callbackNode=null,e.callbackPriority=0),o=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||o){o=T.T,T.T=null,d=$.p,$.p=2,v=Vt,Vt|=4;try{Zv(e,s,i)}finally{Vt=v,$.p=d,T.T=o}}Vn=1,Ug(),$g(),Hg()}}function Ug(){if(Vn===1){Vn=0;var e=hr,s=ko,i=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||i){i=T.T,T.T=null;var o=$.p;$.p=2;var d=Vt;Vt|=4;try{bg(s,e);var h=op,v=wd(e.containerInfo),w=h.focusedElem,L=h.selectionRange;if(v!==w&&w&&w.ownerDocument&&jd(w.ownerDocument.documentElement,w)){if(L!==null&&wc(w)){var J=L.start,me=L.end;if(me===void 0&&(me=J),"selectionStart"in w)w.selectionStart=J,w.selectionEnd=Math.min(me,w.value.length);else{var xe=w.ownerDocument||document,se=xe&&xe.defaultView||window;if(se.getSelection){var ce=se.getSelection(),Ve=w.textContent.length,ft=Math.min(L.start,Ve),cn=L.end===void 0?ft:Math.min(L.end,Ve);!ce.extend&&ft>cn&&(v=cn,cn=ft,ft=v);var G=Sd(w,ft),B=Sd(w,cn);if(G&&B&&(ce.rangeCount!==1||ce.anchorNode!==G.node||ce.anchorOffset!==G.offset||ce.focusNode!==B.node||ce.focusOffset!==B.offset)){var X=xe.createRange();X.setStart(G.node,G.offset),ce.removeAllRanges(),ft>cn?(ce.addRange(X),ce.extend(B.node,B.offset)):(X.setEnd(B.node,B.offset),ce.addRange(X))}}}}for(xe=[],ce=w;ce=ce.parentNode;)ce.nodeType===1&&xe.push({element:ce,left:ce.scrollLeft,top:ce.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<xe.length;w++){var ye=xe[w];ye.element.scrollLeft=ye.left,ye.element.scrollTop=ye.top}}xf=!!lp,op=lp=null}finally{Vt=d,$.p=o,T.T=i}}e.current=s,Vn=2}}function $g(){if(Vn===2){Vn=0;var e=hr,s=ko,i=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||i){i=T.T,T.T=null;var o=$.p;$.p=2;var d=Vt;Vt|=4;try{pg(e,s.alternate,s)}finally{Vt=d,$.p=o,T.T=i}}Vn=3}}function Hg(){if(Vn===4||Vn===3){Vn=0,Ae();var e=hr,s=ko,i=xi,o=Eg;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?Vn=5:(Vn=0,ko=hr=null,qg(e,e.pendingLanes));var d=e.pendingLanes;if(d===0&&(fr=null),is(i),s=s.stateNode,ae&&typeof ae.onCommitFiberRoot=="function")try{ae.onCommitFiberRoot(Sn,s,void 0,(s.current.flags&128)===128)}catch{}if(o!==null){s=T.T,d=$.p,$.p=2,T.T=null;try{for(var h=e.onRecoverableError,v=0;v<o.length;v++){var w=o[v];h(w.value,{componentStack:w.stack})}}finally{T.T=s,$.p=d}}(xi&3)!==0&&cf(),Ha(e),d=e.pendingLanes,(i&261930)!==0&&(d&42)!==0?e===Ym?eu++:(eu=0,Ym=e):eu=0,tu(0)}}function qg(e,s){(e.pooledCacheLanes&=s)===0&&(s=e.pooledCache,s!=null&&(e.pooledCache=null,Lc(s)))}function cf(){return Ug(),$g(),Hg(),Fg()}function Fg(){if(Vn!==5)return!1;var e=hr,s=Gm;Gm=0;var i=is(xi),o=T.T,d=$.p;try{$.p=32>i?32:i,T.T=null,i=Wm,Wm=null;var h=hr,v=xi;if(Vn=0,ko=hr=null,xi=0,(Vt&6)!==0)throw Error(l(331));var w=Vt;if(Vt|=4,kg(h.current),Sg(h,h.current,v,i),Vt=w,tu(0,!1),ae&&typeof ae.onPostCommitFiberRoot=="function")try{ae.onPostCommitFiberRoot(Sn,h)}catch{}return!0}finally{$.p=d,T.T=o,qg(e,s)}}function Qg(e,s,i){s=_s(i,s),s=Nm(e.stateNode,s,2),e=rr(e,s,2),e!==null&&(Gs(e,2),Ha(e))}function an(e,s,i){if(e.tag===3)Qg(e,e,i);else for(;s!==null;){if(s.tag===3){Qg(s,e,i);break}else if(s.tag===1){var o=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(fr===null||!fr.has(o))){e=_s(i,e),i=G8(2),o=rr(s,i,2),o!==null&&(W8(i,o,s,e),Gs(o,2),Ha(o));break}}s=s.return}}function Zm(e,s,i){var o=e.pingCache;if(o===null){o=e.pingCache=new e_;var d=new Set;o.set(s,d)}else d=o.get(s),d===void 0&&(d=new Set,o.set(s,d));d.has(i)||(qm=!0,d.add(i),e=i_.bind(null,e,s,i),s.then(e,e))}function i_(e,s,i){var o=e.pingCache;o!==null&&o.delete(s),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,fn===e&&(Ot&i)===i&&(Rn===4||Rn===3&&(Ot&62914560)===Ot&&300>Ie()-nf?(Vt&2)===0&&No(e,0):Fm|=i,wo===Ot&&(wo=0)),Ha(e)}function Gg(e,s){s===0&&(s=Dn()),e=oi(e,s),e!==null&&(Gs(e,s),Ha(e))}function r_(e){var s=e.memoizedState,i=0;s!==null&&(i=s.retryLane),Gg(e,i)}function l_(e,s){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(l(314))}o!==null&&o.delete(s),Gg(e,i)}function o_(e,s){return Zt(e,s)}var uf=null,Eo=null,Xm=!1,df=!1,Jm=!1,pr=0;function Ha(e){e!==Eo&&e.next===null&&(Eo===null?uf=Eo=e:Eo=Eo.next=e),df=!0,Xm||(Xm=!0,u_())}function tu(e,s){if(!Jm&&df){Jm=!0;do for(var i=!1,o=uf;o!==null;){if(e!==0){var d=o.pendingLanes;if(d===0)var h=0;else{var v=o.suspendedLanes,w=o.pingedLanes;h=(1<<31-De(42|e)+1)-1,h&=d&~(v&~w),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(i=!0,Kg(o,h))}else h=Ot,h=kn(o,o===fn?h:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(h&3)===0||Ee(o,h)||(i=!0,Kg(o,h));o=o.next}while(i);Jm=!1}}function c_(){Wg()}function Wg(){df=Xm=!1;var e=0;pr!==0&&b_()&&(e=pr);for(var s=Ie(),i=null,o=uf;o!==null;){var d=o.next,h=Yg(o,s);h===0?(o.next=null,i===null?uf=d:i.next=d,d===null&&(Eo=i)):(i=o,(e!==0||(h&3)!==0)&&(df=!0)),o=d}Vn!==0&&Vn!==5||tu(e),pr!==0&&(pr=0)}function Yg(e,s){for(var i=e.suspendedLanes,o=e.pingedLanes,d=e.expirationTimes,h=e.pendingLanes&-62914561;0<h;){var v=31-De(h),w=1<<v,L=d[v];L===-1?((w&i)===0||(w&o)!==0)&&(d[v]=Dt(w,s)):L<=s&&(e.expiredLanes|=w),h&=~w}if(s=fn,i=Ot,i=kn(e,e===s?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o=e.callbackNode,i===0||e===s&&(sn===2||sn===9)||e.cancelPendingCommit!==null)return o!==null&&o!==null&&un(o),e.callbackNode=null,e.callbackPriority=0;if((i&3)===0||Ee(e,i)){if(s=i&-i,s===e.callbackPriority)return s;switch(o!==null&&un(o),is(i)){case 2:case 8:i=tt;break;case 32:i=qe;break;case 268435456:i=vn;break;default:i=qe}return o=Vg.bind(null,e),i=Zt(i,o),e.callbackPriority=s,e.callbackNode=i,s}return o!==null&&o!==null&&un(o),e.callbackPriority=2,e.callbackNode=null,2}function Vg(e,s){if(Vn!==0&&Vn!==5)return e.callbackNode=null,e.callbackPriority=0,null;var i=e.callbackNode;if(cf()&&e.callbackNode!==i)return null;var o=Ot;return o=kn(e,e===fn?o:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o===0?null:(Mg(e,o,s),Yg(e,Ie()),e.callbackNode!=null&&e.callbackNode===i?Vg.bind(null,e):null)}function Kg(e,s){if(cf())return null;Mg(e,s,!0)}function u_(){S_(function(){(Vt&6)!==0?Zt(Fe,c_):Wg()})}function ep(){if(pr===0){var e=ho;e===0&&(e=At,At<<=1,(At&261888)===0&&(At=256)),pr=e}return pr}function Zg(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:qi(""+e)}function Xg(e,s){var i=s.ownerDocument.createElement("input");return i.name=s.name,i.value=s.value,e.id&&i.setAttribute("form",e.id),s.parentNode.insertBefore(i,s),e=new FormData(e),i.parentNode.removeChild(i),e}function d_(e,s,i,o,d){if(s==="submit"&&i&&i.stateNode===d){var h=Zg((d[Be]||null).action),v=o.submitter;v&&(s=(s=v[Be]||null)?Zg(s.formAction):v.getAttribute("formAction"),s!==null&&(h=s,v=null));var w=new ti("action","action",null,o,d);e.push({event:w,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(pr!==0){var L=v?Xg(d,v):new FormData(d);bm(i,{pending:!0,data:L,method:d.method,action:h},null,L)}}else typeof h=="function"&&(w.preventDefault(),L=v?Xg(d,v):new FormData(d),bm(i,{pending:!0,data:L,method:d.method,action:h},h,L))},currentTarget:d}]})}}for(var tp=0;tp<so.length;tp++){var np=so[tp],f_=np.toLowerCase(),h_=np[0].toUpperCase()+np.slice(1);Is(f_,"on"+h_)}Is(Cd,"onAnimationEnd"),Is(Ed,"onAnimationIteration"),Is(Td,"onAnimationStart"),Is("dblclick","onDoubleClick"),Is("focusin","onFocus"),Is("focusout","onBlur"),Is(Yh,"onTransitionRun"),Is(Md,"onTransitionStart"),Is(Rd,"onTransitionCancel"),Is(Cc,"onTransitionEnd"),pt("onMouseEnter",["mouseout","mouseover"]),pt("onMouseLeave",["mouseout","mouseover"]),pt("onPointerEnter",["pointerout","pointerover"]),pt("onPointerLeave",["pointerout","pointerover"]),ot("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ot("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ot("onBeforeInput",["compositionend","keypress","textInput","paste"]),ot("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ot("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ot("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var nu="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(" "),m_=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(nu));function Jg(e,s){s=(s&4)!==0;for(var i=0;i<e.length;i++){var o=e[i],d=o.event;o=o.listeners;e:{var h=void 0;if(s)for(var v=o.length-1;0<=v;v--){var w=o[v],L=w.instance,J=w.currentTarget;if(w=w.listener,L!==h&&d.isPropagationStopped())break e;h=w,d.currentTarget=J;try{h(d)}catch(me){rl(me)}d.currentTarget=null,h=L}else for(v=0;v<o.length;v++){if(w=o[v],L=w.instance,J=w.currentTarget,w=w.listener,L!==h&&d.isPropagationStopped())break e;h=w,d.currentTarget=J;try{h(d)}catch(me){rl(me)}d.currentTarget=null,h=L}}}}function Rt(e,s){var i=s[mt];i===void 0&&(i=s[mt]=new Set);var o=e+"__bubble";i.has(o)||(e4(s,e,2,!1),i.add(o))}function sp(e,s,i){var o=0;s&&(o|=4),e4(i,e,o,s)}var ff="_reactListening"+Math.random().toString(36).slice(2);function ap(e){if(!e[ff]){e[ff]=!0,ge.forEach(function(i){i!=="selectionchange"&&(m_.has(i)||sp(i,!1,e),sp(i,!0,e))});var s=e.nodeType===9?e:e.ownerDocument;s===null||s[ff]||(s[ff]=!0,sp("selectionchange",!1,s))}}function e4(e,s,i,o){switch(T4(s)){case 2:var d=H_;break;case 8:d=q_;break;default:d=_p}i=d.bind(null,s,i,e),d=void 0,!Oa||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(d=!0),o?d!==void 0?e.addEventListener(s,i,{capture:!0,passive:d}):e.addEventListener(s,i,!0):d!==void 0?e.addEventListener(s,i,{passive:d}):e.addEventListener(s,i,!1)}function ip(e,s,i,o,d){var h=o;if((s&1)===0&&(s&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 L=v.tag;if((L===3||L===4)&&v.stateNode.containerInfo===d)return;v=v.return}for(;w!==null;){if(v=On(w),v===null)return;if(L=v.tag,L===5||L===6||L===26||L===27){o=h=v;continue e}w=w.parentNode}}o=o.return}gc(function(){var J=h,me=Fi(i),xe=[];e:{var se=Ad.get(e);if(se!==void 0){var ce=ti,Ve=e;switch(e){case"keypress":if(Ds(i)===0)break e;case"keydown":case"keyup":ce=Ih;break;case"focusin":Ve="focus",ce=Kl;break;case"focusout":Ve="blur",ce=Kl;break;case"beforeblur":case"afterblur":ce=Kl;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":ce=yc;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ce=vc;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ce=zh;break;case Cd:case Ed:case Td:ce=si;break;case Cc:ce=Bh;break;case"scroll":case"scrollend":ce=Yl;break;case"wheel":ce=$h;break;case"copy":case"cut":case"paste":ce=Rh;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ce=fd;break;case"toggle":case"beforetoggle":ce=Hh}var ft=(s&4)!==0,cn=!ft&&(e==="scroll"||e==="scrollend"),G=ft?se!==null?se+"Capture":null:se;ft=[];for(var B=J,X;B!==null;){var ye=B;if(X=ye.stateNode,ye=ye.tag,ye!==5&&ye!==26&&ye!==27||X===null||G===null||(ye=Rs(B,G),ye!=null&&ft.push(su(B,ye,X))),cn)break;B=B.return}0<ft.length&&(se=new ce(se,Ve,null,i,me),xe.push({event:se,listeners:ft}))}}if((s&7)===0){e:{if(se=e==="mouseover"||e==="pointerover",ce=e==="mouseout"||e==="pointerout",se&&i!==Wl&&(Ve=i.relatedTarget||i.fromElement)&&(On(Ve)||Ve[Ye]))break e;if((ce||se)&&(se=me.window===me?me:(se=me.ownerDocument)?se.defaultView||se.parentWindow:window,ce?(Ve=i.relatedTarget||i.toElement,ce=J,Ve=Ve?On(Ve):null,Ve!==null&&(cn=u(Ve),ft=Ve.tag,Ve!==cn||ft!==5&&ft!==27&&ft!==6)&&(Ve=null)):(ce=null,Ve=J),ce!==Ve)){if(ft=yc,ye="onMouseLeave",G="onMouseEnter",B="mouse",(e==="pointerout"||e==="pointerover")&&(ft=fd,ye="onPointerLeave",G="onPointerEnter",B="pointer"),cn=ce==null?se:En(ce),X=Ve==null?se:En(Ve),se=new ft(ye,B+"leave",ce,i,me),se.target=cn,se.relatedTarget=X,ye=null,On(me)===J&&(ft=new ft(G,B+"enter",Ve,i,me),ft.target=X,ft.relatedTarget=cn,ye=ft),cn=ye,ce&&Ve)t:{for(ft=p_,G=ce,B=Ve,X=0,ye=G;ye;ye=ft(ye))X++;ye=0;for(var ct=B;ct;ct=ft(ct))ye++;for(;0<X-ye;)G=ft(G),X--;for(;0<ye-X;)B=ft(B),ye--;for(;X--;){if(G===B||B!==null&&G===B.alternate){ft=G;break t}G=ft(G),B=ft(B)}ft=null}else ft=null;ce!==null&&t4(xe,se,ce,ft,!1),Ve!==null&&cn!==null&&t4(xe,cn,Ve,ft,!0)}}e:{if(se=J?En(J):window,ce=se.nodeName&&se.nodeName.toLowerCase(),ce==="select"||ce==="input"&&se.type==="file")var Qt=xc;else if(nl(se))if(vd)Qt=Qh;else{Qt=bd;var Je=_d}else ce=se.nodeName,!ce||ce.toLowerCase()!=="input"||se.type!=="checkbox"&&se.type!=="radio"?J&&Ts(J.elementType)&&(Qt=xc):Qt=Fh;if(Qt&&(Qt=Qt(e,J))){Jl(xe,Qt,i,me);break e}Je&&Je(e,se,J),e==="focusout"&&J&&se.type==="number"&&J.memoizedProps.value!=null&&xa(se,"number",se.value)}switch(Je=J?En(J):window,e){case"focusin":(nl(Je)||Je.contentEditable==="true")&&(Zi=Je,kc=J,il=null);break;case"focusout":il=kc=Zi=null;break;case"mousedown":Ia=!0;break;case"contextmenu":case"mouseup":case"dragend":Ia=!1,kd(xe,i,me);break;case"selectionchange":if(Wh)break;case"keydown":case"keyup":kd(xe,i,me)}var wt;if(el)e:{switch(e){case"compositionstart":var Lt="onCompositionStart";break e;case"compositionend":Lt="onCompositionEnd";break e;case"compositionupdate":Lt="onCompositionUpdate";break e}Lt=void 0}else Ls?ps(e,i)&&(Lt="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(Lt="onCompositionStart");Lt&&(pd&&i.locale!=="ko"&&(Ls||Lt!=="onCompositionStart"?Lt==="onCompositionEnd"&&Ls&&(wt=fs()):(Xn=me,_n="value"in Xn?Xn.value:Xn.textContent,Ls=!0)),Je=hf(J,Lt),0<Je.length&&(Lt=new Vi(Lt,e,null,i,me),xe.push({event:Lt,listeners:Je}),wt?Lt.data=wt:(wt=Ks(i),wt!==null&&(Lt.data=wt)))),(wt=qh?yd(e,i):_c(e,i))&&(Lt=hf(J,"onBeforeInput"),0<Lt.length&&(Je=new Vi("onBeforeInput","beforeinput",null,i,me),xe.push({event:Je,listeners:Lt}),Je.data=wt)),d_(xe,e,J,i,me)}Jg(xe,s)})}function su(e,s,i){return{instance:e,listener:s,currentTarget:i}}function hf(e,s){for(var i=s+"Capture",o=[];e!==null;){var d=e,h=d.stateNode;if(d=d.tag,d!==5&&d!==26&&d!==27||h===null||(d=Rs(e,i),d!=null&&o.unshift(su(e,d,h)),d=Rs(e,s),d!=null&&o.push(su(e,d,h))),e.tag===3)return o;e=e.return}return[]}function p_(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function t4(e,s,i,o,d){for(var h=s._reactName,v=[];i!==null&&i!==o;){var w=i,L=w.alternate,J=w.stateNode;if(w=w.tag,L!==null&&L===o)break;w!==5&&w!==26&&w!==27||J===null||(L=J,d?(J=Rs(i,h),J!=null&&v.unshift(su(i,J,L))):d||(J=Rs(i,h),J!=null&&v.push(su(i,J,L)))),i=i.return}v.length!==0&&e.push({event:s,listeners:v})}var g_=/\r\n?/g,y_=/\u0000|\uFFFD/g;function n4(e){return(typeof e=="string"?e:""+e).replace(g_,`
50
+ `).replace(y_,"")}function s4(e,s){return s=n4(s),n4(e)===s}function on(e,s,i,o,d,h){switch(i){case"children":typeof o=="string"?s==="body"||s==="textarea"&&o===""||Aa(e,o):(typeof o=="number"||typeof o=="bigint")&&s!=="body"&&Aa(e,""+o);break;case"className":Bn(e,"class",o);break;case"tabIndex":Bn(e,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":Bn(e,i,o);break;case"style":Za(e,o,h);break;case"data":if(s!=="object"){Bn(e,"data",o);break}case"src":case"href":if(o===""&&(s!=="a"||i!=="href")){e.removeAttribute(i);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(i);break}o=qi(""+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 h=="function"&&(i==="formAction"?(s!=="input"&&on(e,s,"name",d.name,d,null),on(e,s,"formEncType",d.formEncType,d,null),on(e,s,"formMethod",d.formMethod,d,null),on(e,s,"formTarget",d.formTarget,d,null)):(on(e,s,"encType",d.encType,d,null),on(e,s,"method",d.method,d,null),on(e,s,"target",d.target,d,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(i);break}o=qi(""+o),e.setAttribute(i,o);break;case"onClick":o!=null&&(e.onclick=Ms);break;case"onScroll":o!=null&&Rt("scroll",e);break;case"onScrollEnd":o!=null&&Rt("scrollend",e);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(l(61));if(i=o.__html,i!=null){if(d.children!=null)throw Error(l(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=qi(""+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":Rt("beforetoggle",e),Rt("toggle",e),pn(e,"popover",o);break;case"xlinkActuate":wn(e,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":wn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":wn(e,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":wn(e,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":wn(e,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":wn(e,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":wn(e,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":wn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":wn(e,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":pn(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=Hi.get(i)||i,pn(e,i,o))}}function rp(e,s,i,o,d,h){switch(i){case"style":Za(e,o,h);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(l(61));if(i=o.__html,i!=null){if(d.children!=null)throw Error(l(60));e.innerHTML=i}}break;case"children":typeof o=="string"?Aa(e,o):(typeof o=="number"||typeof o=="bigint")&&Aa(e,""+o);break;case"onScroll":o!=null&&Rt("scroll",e);break;case"onScrollEnd":o!=null&&Rt("scrollend",e);break;case"onClick":o!=null&&(e.onclick=Ms);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!lt.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(d=i.endsWith("Capture"),s=i.slice(2,d?i.length-7:void 0),h=e[Be]||null,h=h!=null?h[i]:null,typeof h=="function"&&e.removeEventListener(s,h,d),typeof o=="function")){typeof h!="function"&&h!==null&&(i in e?e[i]=null:e.hasAttribute(i)&&e.removeAttribute(i)),e.addEventListener(s,o,d);break e}i in e?e[i]=o:o===!0?e.setAttribute(i,""):pn(e,i,o)}}}function cs(e,s,i){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Rt("error",e),Rt("load",e);var o=!1,d=!1,h;for(h in i)if(i.hasOwnProperty(h)){var v=i[h];if(v!=null)switch(h){case"src":o=!0;break;case"srcSet":d=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(l(137,s));default:on(e,s,h,v,i,null)}}d&&on(e,s,"srcSet",i.srcSet,i,null),o&&on(e,s,"src",i.src,i,null);return;case"input":Rt("invalid",e);var w=h=v=d=null,L=null,J=null;for(o in i)if(i.hasOwnProperty(o)){var me=i[o];if(me!=null)switch(o){case"name":d=me;break;case"type":v=me;break;case"checked":L=me;break;case"defaultChecked":J=me;break;case"value":h=me;break;case"defaultValue":w=me;break;case"children":case"dangerouslySetInnerHTML":if(me!=null)throw Error(l(137,s));break;default:on(e,s,o,me,i,null)}}Ht(e,h,w,L,J,v,d,!1);return;case"select":Rt("invalid",e),o=v=h=null;for(d in i)if(i.hasOwnProperty(d)&&(w=i[d],w!=null))switch(d){case"value":h=w;break;case"defaultValue":v=w;break;case"multiple":o=w;default:on(e,s,d,w,i,null)}s=h,i=v,e.multiple=!!o,s!=null?Sa(e,!!o,s,!1):i!=null&&Sa(e,!!o,i,!0);return;case"textarea":Rt("invalid",e),h=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":h=w;break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(l(91));break;default:on(e,s,v,w,i,null)}$i(e,o,d,h);return;case"option":for(L in i)if(i.hasOwnProperty(L)&&(o=i[L],o!=null))switch(L){case"selected":e.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:on(e,s,L,o,i,null)}return;case"dialog":Rt("beforetoggle",e),Rt("toggle",e),Rt("cancel",e),Rt("close",e);break;case"iframe":case"object":Rt("load",e);break;case"video":case"audio":for(o=0;o<nu.length;o++)Rt(nu[o],e);break;case"image":Rt("error",e),Rt("load",e);break;case"details":Rt("toggle",e);break;case"embed":case"source":case"link":Rt("error",e),Rt("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(l(137,s));default:on(e,s,J,o,i,null)}return;default:if(Ts(s)){for(me in i)i.hasOwnProperty(me)&&(o=i[me],o!==void 0&&rp(e,s,me,o,i,void 0));return}}for(w in i)i.hasOwnProperty(w)&&(o=i[w],o!=null&&on(e,s,w,o,i,null))}function v_(e,s,i,o){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var d=null,h=null,v=null,w=null,L=null,J=null,me=null;for(ce in i){var xe=i[ce];if(i.hasOwnProperty(ce)&&xe!=null)switch(ce){case"checked":break;case"value":break;case"defaultValue":L=xe;default:o.hasOwnProperty(ce)||on(e,s,ce,null,o,xe)}}for(var se in o){var ce=o[se];if(xe=i[se],o.hasOwnProperty(se)&&(ce!=null||xe!=null))switch(se){case"type":h=ce;break;case"name":d=ce;break;case"checked":J=ce;break;case"defaultChecked":me=ce;break;case"value":v=ce;break;case"defaultValue":w=ce;break;case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(l(137,s));break;default:ce!==xe&&on(e,s,se,ce,o,xe)}}ra(e,v,w,L,J,me,h,d);return;case"select":ce=v=w=se=null;for(h in i)if(L=i[h],i.hasOwnProperty(h)&&L!=null)switch(h){case"value":break;case"multiple":ce=L;default:o.hasOwnProperty(h)||on(e,s,h,null,o,L)}for(d in o)if(h=o[d],L=i[d],o.hasOwnProperty(d)&&(h!=null||L!=null))switch(d){case"value":se=h;break;case"defaultValue":w=h;break;case"multiple":v=h;default:h!==L&&on(e,s,d,h,o,L)}s=w,i=v,o=ce,se!=null?Sa(e,!!i,se,!1):!!o!=!!i&&(s!=null?Sa(e,!!i,s,!0):Sa(e,!!i,i?[]:"",!1));return;case"textarea":ce=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:on(e,s,w,null,o,d)}for(v in o)if(d=o[v],h=i[v],o.hasOwnProperty(v)&&(d!=null||h!=null))switch(v){case"value":se=d;break;case"defaultValue":ce=d;break;case"children":break;case"dangerouslySetInnerHTML":if(d!=null)throw Error(l(91));break;default:d!==h&&on(e,s,v,d,o,h)}Ka(e,se,ce);return;case"option":for(var Ve in i)if(se=i[Ve],i.hasOwnProperty(Ve)&&se!=null&&!o.hasOwnProperty(Ve))switch(Ve){case"selected":e.selected=!1;break;default:on(e,s,Ve,null,o,se)}for(L in o)if(se=o[L],ce=i[L],o.hasOwnProperty(L)&&se!==ce&&(se!=null||ce!=null))switch(L){case"selected":e.selected=se&&typeof se!="function"&&typeof se!="symbol";break;default:on(e,s,L,se,o,ce)}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 ft in i)se=i[ft],i.hasOwnProperty(ft)&&se!=null&&!o.hasOwnProperty(ft)&&on(e,s,ft,null,o,se);for(J in o)if(se=o[J],ce=i[J],o.hasOwnProperty(J)&&se!==ce&&(se!=null||ce!=null))switch(J){case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(l(137,s));break;default:on(e,s,J,se,o,ce)}return;default:if(Ts(s)){for(var cn in i)se=i[cn],i.hasOwnProperty(cn)&&se!==void 0&&!o.hasOwnProperty(cn)&&rp(e,s,cn,void 0,o,se);for(me in o)se=o[me],ce=i[me],!o.hasOwnProperty(me)||se===ce||se===void 0&&ce===void 0||rp(e,s,me,se,o,ce);return}}for(var G in i)se=i[G],i.hasOwnProperty(G)&&se!=null&&!o.hasOwnProperty(G)&&on(e,s,G,null,o,se);for(xe in o)se=o[xe],ce=i[xe],!o.hasOwnProperty(xe)||se===ce||se==null&&ce==null||on(e,s,xe,se,o,ce)}function a4(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function __(){if(typeof performance.getEntriesByType=="function"){for(var e=0,s=0,i=performance.getEntriesByType("resource"),o=0;o<i.length;o++){var d=i[o],h=d.transferSize,v=d.initiatorType,w=d.duration;if(h&&w&&a4(v)){for(v=0,w=d.responseEnd,o+=1;o<i.length;o++){var L=i[o],J=L.startTime;if(J>w)break;var me=L.transferSize,xe=L.initiatorType;me&&a4(xe)&&(L=L.responseEnd,v+=me*(L<w?1:(w-J)/(L-J)))}if(--o,s+=8*(h+v)/(d.duration/1e3),e++,10<e)break}}if(0<e)return s/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var lp=null,op=null;function mf(e){return e.nodeType===9?e:e.ownerDocument}function i4(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 r4(e,s){if(e===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&s==="foreignObject"?0:e}function cp(e,s){return e==="textarea"||e==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var up=null;function b_(){var e=window.event;return e&&e.type==="popstate"?e===up?!1:(up=e,!0):(up=null,!1)}var l4=typeof setTimeout=="function"?setTimeout:void 0,x_=typeof clearTimeout=="function"?clearTimeout:void 0,o4=typeof Promise=="function"?Promise:void 0,S_=typeof queueMicrotask=="function"?queueMicrotask:typeof o4<"u"?function(e){return o4.resolve(null).then(e).catch(j_)}:l4;function j_(e){setTimeout(function(){throw e})}function gr(e){return e==="head"}function c4(e,s){var i=s,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),Ao(s);return}o--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")o++;else if(i==="html")au(e.ownerDocument.documentElement);else if(i==="head"){i=e.ownerDocument.head,au(i);for(var h=i.firstChild;h;){var v=h.nextSibling,w=h.nodeName;h[mn]||w==="SCRIPT"||w==="STYLE"||w==="LINK"&&h.rel.toLowerCase()==="stylesheet"||i.removeChild(h),h=v}}else i==="body"&&au(e.ownerDocument.body);i=d}while(i);Ao(s)}function u4(e,s){var i=e;e=0;do{var o=i.nextSibling;if(i.nodeType===1?s?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(s?(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 dp(e){var s=e.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var i=s;switch(s=s.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":dp(i),Nn(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}e.removeChild(i)}}function w_(e,s,i,o){for(;e.nodeType===1;){var d=i;if(e.nodeName.toLowerCase()!==s.toLowerCase()){if(!o&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(o){if(!e[mn])switch(s){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(h=e.getAttribute("rel"),h==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(h!==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(h=e.getAttribute("src"),(h!==(d.src==null?null:d.src)||e.getAttribute("type")!==(d.type==null?null:d.type)||e.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin))&&h&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(s==="input"&&e.type==="hidden"){var h=d.name==null?null:""+d.name;if(d.type==="hidden"&&e.getAttribute("name")===h)return e}else return e;if(e=ua(e.nextSibling),e===null)break}return null}function k_(e,s,i){if(s==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!i||(e=ua(e.nextSibling),e===null))return null;return e}function d4(e,s){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!s||(e=ua(e.nextSibling),e===null))return null;return e}function fp(e){return e.data==="$?"||e.data==="$~"}function hp(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function N_(e,s){var i=e.ownerDocument;if(e.data==="$~")e._reactRetry=s;else if(e.data!=="$?"||i.readyState!=="loading")s();else{var o=function(){s(),i.removeEventListener("DOMContentLoaded",o)};i.addEventListener("DOMContentLoaded",o),e._reactRetry=o}}function ua(e){for(;e!=null;e=e.nextSibling){var s=e.nodeType;if(s===1||s===3)break;if(s===8){if(s=e.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return e}var mp=null;function f4(e){e=e.nextSibling;for(var s=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"||i==="/&"){if(s===0)return ua(e.nextSibling);s--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||s++}e=e.nextSibling}return null}function h4(e){e=e.previousSibling;for(var s=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(s===0)return e;s--}else i!=="/$"&&i!=="/&"||s++}e=e.previousSibling}return null}function m4(e,s,i){switch(s=mf(i),e){case"html":if(e=s.documentElement,!e)throw Error(l(452));return e;case"head":if(e=s.head,!e)throw Error(l(453));return e;case"body":if(e=s.body,!e)throw Error(l(454));return e;default:throw Error(l(451))}}function au(e){for(var s=e.attributes;s.length;)e.removeAttributeNode(s[0]);Nn(e)}var da=new Map,p4=new Set;function pf(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Si=$.d;$.d={f:C_,r:E_,D:T_,C:M_,L:R_,m:A_,X:O_,S:D_,M:L_};function C_(){var e=Si.f(),s=rf();return e||s}function E_(e){var s=Cn(e);s!==null&&s.tag===5&&s.type==="form"?A8(s):Si.r(e)}var To=typeof document>"u"?null:document;function g4(e,s,i){var o=To;if(o&&typeof s=="string"&&s){var d=rs(s);d='link[rel="'+e+'"][href="'+d+'"]',typeof i=="string"&&(d+='[crossorigin="'+i+'"]'),p4.has(d)||(p4.add(d),e={rel:e,crossOrigin:i,href:s},o.querySelector(d)===null&&(s=o.createElement("link"),cs(s,"link",e),C(s),o.head.appendChild(s)))}}function T_(e){Si.D(e),g4("dns-prefetch",e,null)}function M_(e,s){Si.C(e,s),g4("preconnect",e,s)}function R_(e,s,i){Si.L(e,s,i);var o=To;if(o&&e&&s){var d='link[rel="preload"][as="'+rs(s)+'"]';s==="image"&&i&&i.imageSrcSet?(d+='[imagesrcset="'+rs(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(d+='[imagesizes="'+rs(i.imageSizes)+'"]')):d+='[href="'+rs(e)+'"]';var h=d;switch(s){case"style":h=Mo(e);break;case"script":h=Ro(e)}da.has(h)||(e=g({rel:"preload",href:s==="image"&&i&&i.imageSrcSet?void 0:e,as:s},i),da.set(h,e),o.querySelector(d)!==null||s==="style"&&o.querySelector(iu(h))||s==="script"&&o.querySelector(ru(h))||(s=o.createElement("link"),cs(s,"link",e),C(s),o.head.appendChild(s)))}}function A_(e,s){Si.m(e,s);var i=To;if(i&&e){var o=s&&typeof s.as=="string"?s.as:"script",d='link[rel="modulepreload"][as="'+rs(o)+'"][href="'+rs(e)+'"]',h=d;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=Ro(e)}if(!da.has(h)&&(e=g({rel:"modulepreload",href:e},s),da.set(h,e),i.querySelector(d)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(ru(h)))return}o=i.createElement("link"),cs(o,"link",e),C(o),i.head.appendChild(o)}}}function D_(e,s,i){Si.S(e,s,i);var o=To;if(o&&e){var d=jn(o).hoistableStyles,h=Mo(e);s=s||"default";var v=d.get(h);if(!v){var w={loading:0,preload:null};if(v=o.querySelector(iu(h)))w.loading=5;else{e=g({rel:"stylesheet",href:e,"data-precedence":s},i),(i=da.get(h))&&pp(e,i);var L=v=o.createElement("link");C(L),cs(L,"link",e),L._p=new Promise(function(J,me){L.onload=J,L.onerror=me}),L.addEventListener("load",function(){w.loading|=1}),L.addEventListener("error",function(){w.loading|=2}),w.loading|=4,gf(v,s,o)}v={type:"stylesheet",instance:v,count:1,state:w},d.set(h,v)}}}function O_(e,s){Si.X(e,s);var i=To;if(i&&e){var o=jn(i).hoistableScripts,d=Ro(e),h=o.get(d);h||(h=i.querySelector(ru(d)),h||(e=g({src:e,async:!0},s),(s=da.get(d))&&gp(e,s),h=i.createElement("script"),C(h),cs(h,"link",e),i.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},o.set(d,h))}}function L_(e,s){Si.M(e,s);var i=To;if(i&&e){var o=jn(i).hoistableScripts,d=Ro(e),h=o.get(d);h||(h=i.querySelector(ru(d)),h||(e=g({src:e,async:!0,type:"module"},s),(s=da.get(d))&&gp(e,s),h=i.createElement("script"),C(h),cs(h,"link",e),i.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},o.set(d,h))}}function y4(e,s,i,o){var d=(d=oe.current)?pf(d):null;if(!d)throw Error(l(446));switch(e){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(s=Mo(i.href),i=jn(d).hoistableStyles,o=i.get(s),o||(o={type:"style",instance:null,count:0,state:null},i.set(s,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=Mo(i.href);var h=jn(d).hoistableStyles,v=h.get(e);if(v||(d=d.ownerDocument||d,v={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(e,v),(h=d.querySelector(iu(e)))&&!h._p&&(v.instance=h,v.state.loading=5),da.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},da.set(e,i),h||I_(d,e,i,v.state))),s&&o===null)throw Error(l(528,""));return v}if(s&&o!==null)throw Error(l(529,""));return null;case"script":return s=i.async,i=i.src,typeof i=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=Ro(i),i=jn(d).hoistableScripts,o=i.get(s),o||(o={type:"script",instance:null,count:0,state:null},i.set(s,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,e))}}function Mo(e){return'href="'+rs(e)+'"'}function iu(e){return'link[rel="stylesheet"]['+e+"]"}function v4(e){return g({},e,{"data-precedence":e.precedence,precedence:null})}function I_(e,s,i,o){e.querySelector('link[rel="preload"][as="style"]['+s+"]")?o.loading=1:(s=e.createElement("link"),o.preload=s,s.addEventListener("load",function(){return o.loading|=1}),s.addEventListener("error",function(){return o.loading|=2}),cs(s,"link",i),C(s),e.head.appendChild(s))}function Ro(e){return'[src="'+rs(e)+'"]'}function ru(e){return"script[async]"+e}function _4(e,s,i){if(s.count++,s.instance===null)switch(s.type){case"style":var o=e.querySelector('style[data-href~="'+rs(i.href)+'"]');if(o)return s.instance=o,C(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"),C(o),cs(o,"style",d),gf(o,i.precedence,e),s.instance=o;case"stylesheet":d=Mo(i.href);var h=e.querySelector(iu(d));if(h)return s.state.loading|=4,s.instance=h,C(h),h;o=v4(i),(d=da.get(d))&&pp(o,d),h=(e.ownerDocument||e).createElement("link"),C(h);var v=h;return v._p=new Promise(function(w,L){v.onload=w,v.onerror=L}),cs(h,"link",o),s.state.loading|=4,gf(h,i.precedence,e),s.instance=h;case"script":return h=Ro(i.src),(d=e.querySelector(ru(h)))?(s.instance=d,C(d),d):(o=i,(d=da.get(h))&&(o=g({},i),gp(o,d)),e=e.ownerDocument||e,d=e.createElement("script"),C(d),cs(d,"link",o),e.head.appendChild(d),s.instance=d);case"void":return null;default:throw Error(l(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(o=s.instance,s.state.loading|=4,gf(o,i.precedence,e));return s.instance}function gf(e,s,i){for(var o=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),d=o.length?o[o.length-1]:null,h=d,v=0;v<o.length;v++){var w=o[v];if(w.dataset.precedence===s)h=w;else if(h!==d)break}h?h.parentNode.insertBefore(e,h.nextSibling):(s=i.nodeType===9?i.head:i,s.insertBefore(e,s.firstChild))}function pp(e,s){e.crossOrigin==null&&(e.crossOrigin=s.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=s.referrerPolicy),e.title==null&&(e.title=s.title)}function gp(e,s){e.crossOrigin==null&&(e.crossOrigin=s.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=s.referrerPolicy),e.integrity==null&&(e.integrity=s.integrity)}var yf=null;function b4(e,s,i){if(yf===null){var o=new Map,d=yf=new Map;d.set(i,o)}else d=yf,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 h=i[d];if(!(h[mn]||h[Oe]||e==="link"&&h.getAttribute("rel")==="stylesheet")&&h.namespaceURI!=="http://www.w3.org/2000/svg"){var v=h.getAttribute(s)||"";v=e+v;var w=o.get(v);w?w.push(h):o.set(v,[h])}}return o}function x4(e,s,i){e=e.ownerDocument||e,e.head.insertBefore(i,s==="title"?e.querySelector("head > title"):null)}function P_(e,s,i){if(i===1||s.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;switch(s.rel){case"stylesheet":return e=s.disabled,typeof s.precedence=="string"&&e==null;default:return!0}case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function S4(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function z_(e,s,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=Mo(o.href),h=s.querySelector(iu(d));if(h){s=h._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(e.count++,e=vf.bind(e),s.then(e,e)),i.state.loading|=4,i.instance=h,C(h);return}h=s.ownerDocument||s,o=v4(o),(d=da.get(d))&&pp(o,d),h=h.createElement("link"),C(h);var v=h;v._p=new Promise(function(w,L){v.onload=w,v.onerror=L}),cs(h,"link",o),i.instance=h}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(i,s),(s=i.state.preload)&&(i.state.loading&3)===0&&(e.count++,i=vf.bind(e),s.addEventListener("load",i),s.addEventListener("error",i))}}var yp=0;function B_(e,s){return e.stylesheets&&e.count===0&&bf(e,e.stylesheets),0<e.count||0<e.imgCount?function(i){var o=setTimeout(function(){if(e.stylesheets&&bf(e,e.stylesheets),e.unsuspend){var h=e.unsuspend;e.unsuspend=null,h()}},6e4+s);0<e.imgBytes&&yp===0&&(yp=62500*__());var d=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&bf(e,e.stylesheets),e.unsuspend)){var h=e.unsuspend;e.unsuspend=null,h()}},(e.imgBytes>yp?50:800)+s);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(o),clearTimeout(d)}}:null}function vf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)bf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var _f=null;function bf(e,s){e.stylesheets=null,e.unsuspend!==null&&(e.count++,_f=new Map,s.forEach(U_,e),_f=null,vf.call(e))}function U_(e,s){if(!(s.state.loading&4)){var i=_f.get(e);if(i)var o=i.get(null);else{i=new Map,_f.set(e,i);for(var d=e.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h<d.length;h++){var v=d[h];(v.nodeName==="LINK"||v.getAttribute("media")!=="not all")&&(i.set(v.dataset.precedence,v),o=v)}o&&i.set(null,o)}d=s.instance,v=d.getAttribute("data-precedence"),h=i.get(v)||o,h===o&&i.set(null,d),i.set(v,d),this.count++,o=vf.bind(this),d.addEventListener("load",o),d.addEventListener("error",o),h?h.parentNode.insertBefore(d,h.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(d,e.firstChild)),s.state.loading|=4}}var lu={$$typeof:U,Provider:null,Consumer:null,_currentValue:ue,_currentValue2:ue,_threadCount:0};function $_(e,s,i,o,d,h,v,w,L){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=Wn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Wn(0),this.hiddenUpdates=Wn(null),this.identifierPrefix=o,this.onUncaughtError=d,this.onCaughtError=h,this.onRecoverableError=v,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=L,this.incompleteTransitions=new Map}function j4(e,s,i,o,d,h,v,w,L,J,me,xe){return e=new $_(e,s,i,v,L,J,me,xe,w),s=1,h===!0&&(s|=24),h=vs(3,null,null,s),e.current=h,h.stateNode=e,s=Kh(),s.refCount++,e.pooledCache=s,s.refCount++,h.memoizedState={element:o,isDehydrated:i,cache:s},em(h),e}function w4(e){return e?(e=Ji,e):Ji}function k4(e,s,i,o,d,h){d=w4(d),o.context===null?o.context=d:o.pendingContext=d,o=ir(s),o.payload={element:i},h=h===void 0?null:h,h!==null&&(o.callback=h),i=rr(e,o,s),i!==null&&($s(i,e,s),Bc(i,e,s))}function N4(e,s){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<s?i:s}}function vp(e,s){N4(e,s),(e=e.alternate)&&N4(e,s)}function C4(e){if(e.tag===13||e.tag===31){var s=oi(e,67108864);s!==null&&$s(s,e,67108864),vp(e,67108864)}}function E4(e){if(e.tag===13||e.tag===31){var s=aa();s=xt(s);var i=oi(e,s);i!==null&&$s(i,e,s),vp(e,s)}}var xf=!0;function H_(e,s,i,o){var d=T.T;T.T=null;var h=$.p;try{$.p=2,_p(e,s,i,o)}finally{$.p=h,T.T=d}}function q_(e,s,i,o){var d=T.T;T.T=null;var h=$.p;try{$.p=8,_p(e,s,i,o)}finally{$.p=h,T.T=d}}function _p(e,s,i,o){if(xf){var d=bp(o);if(d===null)ip(e,s,o,Sf,i),M4(e,o);else if(Q_(d,e,s,i,o))o.stopPropagation();else if(M4(e,o),s&4&&-1<F_.indexOf(e)){for(;d!==null;){var h=Cn(d);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var v=gt(h.pendingLanes);if(v!==0){var w=h;for(w.pendingLanes|=2,w.entangledLanes|=2;v;){var L=1<<31-De(v);w.entanglements[1]|=L,v&=~L}Ha(h),(Vt&6)===0&&(sf=Ie()+500,tu(0))}}break;case 31:case 13:w=oi(h,2),w!==null&&$s(w,h,2),rf(),vp(h,2)}if(h=bp(o),h===null&&ip(e,s,o,Sf,i),h===d)break;d=h}d!==null&&o.stopPropagation()}else ip(e,s,o,null,i)}}function bp(e){return e=Fi(e),xp(e)}var Sf=null;function xp(e){if(Sf=null,e=On(e),e!==null){var s=u(e);if(s===null)e=null;else{var i=s.tag;if(i===13){if(e=f(s),e!==null)return e;e=null}else if(i===31){if(e=p(s),e!==null)return e;e=null}else if(i===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;e=null}else s!==e&&(e=null)}}return Sf=e,null}function T4(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(Ce()){case Fe:return 2;case tt:return 8;case qe:case rn:return 32;case vn:return 268435456;default:return 32}default:return 32}}var Sp=!1,yr=null,vr=null,_r=null,ou=new Map,cu=new Map,br=[],F_="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 M4(e,s){switch(e){case"focusin":case"focusout":yr=null;break;case"dragenter":case"dragleave":vr=null;break;case"mouseover":case"mouseout":_r=null;break;case"pointerover":case"pointerout":ou.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":cu.delete(s.pointerId)}}function uu(e,s,i,o,d,h){return e===null||e.nativeEvent!==h?(e={blockedOn:s,domEventName:i,eventSystemFlags:o,nativeEvent:h,targetContainers:[d]},s!==null&&(s=Cn(s),s!==null&&C4(s)),e):(e.eventSystemFlags|=o,s=e.targetContainers,d!==null&&s.indexOf(d)===-1&&s.push(d),e)}function Q_(e,s,i,o,d){switch(s){case"focusin":return yr=uu(yr,e,s,i,o,d),!0;case"dragenter":return vr=uu(vr,e,s,i,o,d),!0;case"mouseover":return _r=uu(_r,e,s,i,o,d),!0;case"pointerover":var h=d.pointerId;return ou.set(h,uu(ou.get(h)||null,e,s,i,o,d)),!0;case"gotpointercapture":return h=d.pointerId,cu.set(h,uu(cu.get(h)||null,e,s,i,o,d)),!0}return!1}function R4(e){var s=On(e.target);if(s!==null){var i=u(s);if(i!==null){if(s=i.tag,s===13){if(s=f(i),s!==null){e.blockedOn=s,D(e.priority,function(){E4(i)});return}}else if(s===31){if(s=p(i),s!==null){e.blockedOn=s,D(e.priority,function(){E4(i)});return}}else if(s===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function jf(e){if(e.blockedOn!==null)return!1;for(var s=e.targetContainers;0<s.length;){var i=bp(e.nativeEvent);if(i===null){i=e.nativeEvent;var o=new i.constructor(i.type,i);Wl=o,i.target.dispatchEvent(o),Wl=null}else return s=Cn(i),s!==null&&C4(s),e.blockedOn=i,!1;s.shift()}return!0}function A4(e,s,i){jf(e)&&i.delete(s)}function G_(){Sp=!1,yr!==null&&jf(yr)&&(yr=null),vr!==null&&jf(vr)&&(vr=null),_r!==null&&jf(_r)&&(_r=null),ou.forEach(A4),cu.forEach(A4)}function wf(e,s){e.blockedOn===s&&(e.blockedOn=null,Sp||(Sp=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,G_)))}var kf=null;function D4(e){kf!==e&&(kf=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){kf===e&&(kf=null);for(var s=0;s<e.length;s+=3){var i=e[s],o=e[s+1],d=e[s+2];if(typeof o!="function"){if(xp(o||i)===null)continue;break}var h=Cn(i);h!==null&&(e.splice(s,3),s-=3,bm(h,{pending:!0,data:d,method:i.method,action:o},o,d))}}))}function Ao(e){function s(L){return wf(L,e)}yr!==null&&wf(yr,e),vr!==null&&wf(vr,e),_r!==null&&wf(_r,e),ou.forEach(s),cu.forEach(s);for(var i=0;i<br.length;i++){var o=br[i];o.blockedOn===e&&(o.blockedOn=null)}for(;0<br.length&&(i=br[0],i.blockedOn===null);)R4(i),i.blockedOn===null&&br.shift();if(i=(e.ownerDocument||e).$$reactFormReplay,i!=null)for(o=0;o<i.length;o+=3){var d=i[o],h=i[o+1],v=d[Be]||null;if(typeof h=="function")v||D4(i);else if(v){var w=null;if(h&&h.hasAttribute("formAction")){if(d=h,v=h[Be]||null)w=v.formAction;else if(xp(d)!==null)continue}else w=v.action;typeof w=="function"?i[o+1]=w:(i.splice(o,3),o-=3),D4(i)}}}function O4(){function e(h){h.canIntercept&&h.info==="react-transition"&&h.intercept({handler:function(){return new Promise(function(v){return d=v})},focusReset:"manual",scroll:"manual"})}function s(){d!==null&&(d(),d=null),o||setTimeout(i,20)}function i(){if(!o&&!navigation.transition){var h=navigation.currentEntry;h&&h.url!=null&&navigation.navigate(h.url,{state:h.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var o=!1,d=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(i,100),function(){o=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),d!==null&&(d(),d=null)}}}function jp(e){this._internalRoot=e}Nf.prototype.render=jp.prototype.render=function(e){var s=this._internalRoot;if(s===null)throw Error(l(409));var i=s.current,o=aa();k4(i,o,e,s,null,null)},Nf.prototype.unmount=jp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var s=e.containerInfo;k4(e.current,2,null,e,null,null),rf(),s[Ye]=null}};function Nf(e){this._internalRoot=e}Nf.prototype.unstable_scheduleHydration=function(e){if(e){var s=Va();e={blockedOn:null,target:e,priority:s};for(var i=0;i<br.length&&s!==0&&s<br[i].priority;i++);br.splice(i,0,e),i===0&&R4(e)}};var L4=t.version;if(L4!=="19.2.4")throw Error(l(527,L4,"19.2.4"));$.findDOMNode=function(e){var s=e._reactInternals;if(s===void 0)throw typeof e.render=="function"?Error(l(188)):(e=Object.keys(e).join(","),Error(l(268,e)));return e=m(s),e=e!==null?S(e):null,e=e===null?null:e.stateNode,e};var W_={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:T,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Cf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Cf.isDisabled&&Cf.supportsFiber)try{Sn=Cf.inject(W_),ae=Cf}catch{}}return fu.createRoot=function(e,s){if(!c(e))throw Error(l(299));var i=!1,o="",d=H8,h=q8,v=F8;return s!=null&&(s.unstable_strictMode===!0&&(i=!0),s.identifierPrefix!==void 0&&(o=s.identifierPrefix),s.onUncaughtError!==void 0&&(d=s.onUncaughtError),s.onCaughtError!==void 0&&(h=s.onCaughtError),s.onRecoverableError!==void 0&&(v=s.onRecoverableError)),s=j4(e,1,!1,null,null,i,o,null,d,h,v,O4),e[Ye]=s.current,ap(e),new jp(s)},fu.hydrateRoot=function(e,s,i){if(!c(e))throw Error(l(299));var o=!1,d="",h=H8,v=q8,w=F8,L=null;return i!=null&&(i.unstable_strictMode===!0&&(o=!0),i.identifierPrefix!==void 0&&(d=i.identifierPrefix),i.onUncaughtError!==void 0&&(h=i.onUncaughtError),i.onCaughtError!==void 0&&(v=i.onCaughtError),i.onRecoverableError!==void 0&&(w=i.onRecoverableError),i.formState!==void 0&&(L=i.formState)),s=j4(e,1,!0,s,i??null,o,d,L,h,v,w,O4),s.context=w4(null),i=s.current,o=aa(),o=xt(o),d=ir(o),d.callback=null,rr(i,d,o),i=o,s.current.lanes=i,Gs(s,i),Ha(s),e[Ye]=s.current,ap(e),new Nf(s)},fu.version="19.2.4",fu}var W4;function i5(){if(W4)return Cp.exports;W4=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(t){console.error(t)}}return n(),Cp.exports=a5(),Cp.exports}var r5=i5(),dc=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(n){return this.listeners.add(n),this.onSubscribe(),()=>{this.listeners.delete(n),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},l5={setTimeout:(n,t)=>setTimeout(n,t),clearTimeout:n=>clearTimeout(n),setInterval:(n,t)=>setInterval(n,t),clearInterval:n=>clearInterval(n)},Mr,V1,i2,o5=(i2=class{constructor(){it(this,Mr,l5);it(this,V1,!1)}setTimeoutProvider(n){He(this,Mr,n)}setTimeout(n,t){return I(this,Mr).setTimeout(n,t)}clearTimeout(n){I(this,Mr).clearTimeout(n)}setInterval(n,t){return I(this,Mr).setInterval(n,t)}clearInterval(n){I(this,Mr).clearInterval(n)}},Mr=new WeakMap,V1=new WeakMap,i2),jl=new o5;function c5(n){setTimeout(n,0)}var $l=typeof window>"u"||"Deno"in globalThis;function Kn(){}function u5(n,t){return typeof n=="function"?n(t):n}function o1(n){return typeof n=="number"&&n>=0&&n!==1/0}function v2(n,t){return Math.max(n+(t||0)-Date.now(),0)}function Hr(n,t){return typeof n=="function"?n(t):n}function ha(n,t){return typeof n=="function"?n(t):n}function Y4(n,t){const{type:a="all",exact:l,fetchStatus:c,predicate:u,queryKey:f,stale:p}=n;if(f){if(l){if(t.queryHash!==Z1(f,t.options))return!1}else if(!zu(t.queryKey,f))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 V4(n,t){const{exact:a,status:l,predicate:c,mutationKey:u}=n;if(u){if(!t.options.mutationKey)return!1;if(a){if(Hl(t.options.mutationKey)!==Hl(u))return!1}else if(!zu(t.options.mutationKey,u))return!1}return!(l&&t.state.status!==l||c&&!c(t))}function Z1(n,t){return((t==null?void 0:t.queryKeyHashFn)||Hl)(n)}function Hl(n){return JSON.stringify(n,(t,a)=>c1(a)?Object.keys(a).sort().reduce((l,c)=>(l[c]=a[c],l),{}):a)}function zu(n,t){return n===t?!0:typeof n!=typeof t?!1:n&&t&&typeof n=="object"&&typeof t=="object"?Object.keys(t).every(a=>zu(n[a],t[a])):!1}var d5=Object.prototype.hasOwnProperty;function _2(n,t,a=0){if(n===t)return n;if(a>500)return t;const l=K4(n)&&K4(t);if(!l&&!(c1(n)&&c1(t)))return t;const u=(l?n:Object.keys(n)).length,f=l?t:Object.keys(t),p=f.length,y=l?new Array(p):{};let m=0;for(let S=0;S<p;S++){const g=l?S:f[S],x=n[g],j=t[g];if(x===j){y[g]=x,(l?S<u:d5.call(n,g))&&m++;continue}if(x===null||j===null||typeof x!="object"||typeof j!="object"){y[g]=j;continue}const k=_2(x,j,a+1);y[g]=k,k===x&&m++}return u===p&&m===u?n:y}function Gf(n,t){if(!t||Object.keys(n).length!==Object.keys(t).length)return!1;for(const a in n)if(n[a]!==t[a])return!1;return!0}function K4(n){return Array.isArray(n)&&n.length===Object.keys(n).length}function c1(n){if(!Z4(n))return!1;const t=n.constructor;if(t===void 0)return!0;const a=t.prototype;return!(!Z4(a)||!a.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(n)!==Object.prototype)}function Z4(n){return Object.prototype.toString.call(n)==="[object Object]"}function f5(n){return new Promise(t=>{jl.setTimeout(t,n)})}function u1(n,t,a){return typeof a.structuralSharing=="function"?a.structuralSharing(n,t):a.structuralSharing!==!1?_2(n,t):t}function h5(n,t,a=0){const l=[...n,t];return a&&l.length>a?l.slice(1):l}function m5(n,t,a=0){const l=[t,...n];return a&&l.length>a?l.slice(0,-1):l}var X1=Symbol();function b2(n,t){return!n.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!n.queryFn||n.queryFn===X1?()=>Promise.reject(new Error(`Missing queryFn: '${n.queryHash}'`)):n.queryFn}function J1(n,t){return typeof n=="function"?n(...t):!!n}function p5(n,t,a){let l=!1,c;return Object.defineProperty(n,"signal",{enumerable:!0,get:()=>(c??(c=t()),l||(l=!0,c.aborted?a():c.addEventListener("abort",a,{once:!0})),c)}),n}var Cl,Rr,Fo,r2,g5=(r2=class extends dc{constructor(){super();it(this,Cl);it(this,Rr);it(this,Fo);He(this,Fo,t=>{if(!$l&&window.addEventListener){const a=()=>t();return window.addEventListener("visibilitychange",a,!1),()=>{window.removeEventListener("visibilitychange",a)}}})}onSubscribe(){I(this,Rr)||this.setEventListener(I(this,Fo))}onUnsubscribe(){var t;this.hasListeners()||((t=I(this,Rr))==null||t.call(this),He(this,Rr,void 0))}setEventListener(t){var a;He(this,Fo,t),(a=I(this,Rr))==null||a.call(this),He(this,Rr,t(l=>{typeof l=="boolean"?this.setFocused(l):this.onFocus()}))}setFocused(t){I(this,Cl)!==t&&(He(this,Cl,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(a=>{a(t)})}isFocused(){var t;return typeof I(this,Cl)=="boolean"?I(this,Cl):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Cl=new WeakMap,Rr=new WeakMap,Fo=new WeakMap,r2),e0=new g5;function d1(){let n,t;const a=new Promise((c,u)=>{n=c,t=u});a.status="pending",a.catch(()=>{});function l(c){Object.assign(a,c),delete a.resolve,delete a.reject}return a.resolve=c=>{l({status:"fulfilled",value:c}),n(c)},a.reject=c=>{l({status:"rejected",reason:c}),t(c)},a}function y5(n){var a;let t;if((a=n.then(l=>(t=l,l),Kn))==null||a.catch(Kn),t!==void 0)return{data:t}}function x2(n){return n}function v5(n){return{mutationKey:n.options.mutationKey,state:n.state,...n.options.scope&&{scope:n.options.scope},...n.meta&&{meta:n.meta}}}function _5(n,t,a){const l=()=>{var u;const c=(u=n.promise)==null?void 0:u.then(t).catch(f=>a(f)?Promise.reject(new Error("redacted")):Promise.reject(f));return c==null||c.catch(Kn),c};return{dehydratedAt:Date.now(),state:{...n.state,...n.state.data!==void 0&&{data:t(n.state.data)}},queryKey:n.queryKey,queryHash:n.queryHash,...n.state.status==="pending"&&{promise:l()},...n.meta&&{meta:n.meta}}}function b5(n){return n.state.isPaused}function x5(n){return n.state.status==="success"}function S5(n){return!0}function j5(n,t={}){var y,m,S,g;const a=t.shouldDehydrateMutation??((y=n.getDefaultOptions().dehydrate)==null?void 0:y.shouldDehydrateMutation)??b5,l=n.getMutationCache().getAll().flatMap(x=>a(x)?[v5(x)]:[]),c=t.shouldDehydrateQuery??((m=n.getDefaultOptions().dehydrate)==null?void 0:m.shouldDehydrateQuery)??x5,u=t.shouldRedactErrors??((S=n.getDefaultOptions().dehydrate)==null?void 0:S.shouldRedactErrors)??S5,f=t.serializeData??((g=n.getDefaultOptions().dehydrate)==null?void 0:g.serializeData)??x2,p=n.getQueryCache().getAll().flatMap(x=>c(x)?[_5(x,f,u)]:[]);return{mutations:l,queries:p}}function w5(n,t,a){var y;if(typeof t!="object"||t===null)return;const l=n.getMutationCache(),c=n.getQueryCache(),u=((y=n.getDefaultOptions().hydrate)==null?void 0:y.deserializeData)??x2,f=t.mutations||[],p=t.queries||[];f.forEach(({state:m,...S})=>{var g,x;l.build(n,{...(g=n.getDefaultOptions().hydrate)==null?void 0:g.mutations,...(x=a==null?void 0:a.defaultOptions)==null?void 0:x.mutations,...S},m)}),p.forEach(({queryKey:m,state:S,queryHash:g,meta:x,promise:j,dehydratedAt:k})=>{var q,re;const E=j?y5(j):void 0,N=S.data===void 0?E==null?void 0:E.data:S.data,P=N===void 0?N:u(N);let H=c.get(g);const U=(H==null?void 0:H.state.status)==="pending",R=(H==null?void 0:H.state.fetchStatus)==="fetching";if(H){const V=E&&k!==void 0&&k>H.state.dataUpdatedAt;if(S.dataUpdatedAt>H.state.dataUpdatedAt||V){const{fetchStatus:ee,...Z}=S;H.setState({...Z,data:P})}}else H=c.build(n,{...(q=n.getDefaultOptions().hydrate)==null?void 0:q.queries,...(re=a==null?void 0:a.defaultOptions)==null?void 0:re.queries,queryKey:m,queryHash:g,meta:x},{...S,data:P,fetchStatus:"idle",status:P!==void 0?"success":S.status});j&&!U&&!R&&(k===void 0||k>H.state.dataUpdatedAt)&&H.fetch(void 0,{initialPromise:Promise.resolve(j).then(u)}).catch(Kn)})}var k5=c5;function N5(){let n=[],t=0,a=p=>{p()},l=p=>{p()},c=k5;const u=p=>{t?n.push(p):c(()=>{a(p)})},f=()=>{const p=n;n=[],p.length&&c(()=>{l(()=>{p.forEach(y=>{a(y)})})})};return{batch:p=>{let y;t++;try{y=p()}finally{t--,t||f()}return y},batchCalls:p=>(...y)=>{u(()=>{p(...y)})},schedule:u,setNotifyFunction:p=>{a=p},setBatchNotifyFunction:p=>{l=p},setScheduler:p=>{c=p}}}var Zn=N5(),Qo,Ar,Go,l2,C5=(l2=class extends dc{constructor(){super();it(this,Qo,!0);it(this,Ar);it(this,Go);He(this,Go,t=>{if(!$l&&window.addEventListener){const a=()=>t(!0),l=()=>t(!1);return window.addEventListener("online",a,!1),window.addEventListener("offline",l,!1),()=>{window.removeEventListener("online",a),window.removeEventListener("offline",l)}}})}onSubscribe(){I(this,Ar)||this.setEventListener(I(this,Go))}onUnsubscribe(){var t;this.hasListeners()||((t=I(this,Ar))==null||t.call(this),He(this,Ar,void 0))}setEventListener(t){var a;He(this,Go,t),(a=I(this,Ar))==null||a.call(this),He(this,Ar,t(this.setOnline.bind(this)))}setOnline(t){I(this,Qo)!==t&&(He(this,Qo,t),this.listeners.forEach(l=>{l(t)}))}isOnline(){return I(this,Qo)}},Qo=new WeakMap,Ar=new WeakMap,Go=new WeakMap,l2),Wf=new C5;function E5(n){return Math.min(1e3*2**n,3e4)}function S2(n){return(n??"online")==="online"?Wf.isOnline():!0}var f1=class extends Error{constructor(n){super("CancelledError"),this.revert=n==null?void 0:n.revert,this.silent=n==null?void 0:n.silent}};function j2(n){let t=!1,a=0,l;const c=d1(),u=()=>c.status!=="pending",f=E=>{var N;if(!u()){const P=new f1(E);x(P),(N=n.onCancel)==null||N.call(n,P)}},p=()=>{t=!0},y=()=>{t=!1},m=()=>e0.isFocused()&&(n.networkMode==="always"||Wf.isOnline())&&n.canRun(),S=()=>S2(n.networkMode)&&n.canRun(),g=E=>{u()||(l==null||l(),c.resolve(E))},x=E=>{u()||(l==null||l(),c.reject(E))},j=()=>new Promise(E=>{var N;l=P=>{(u()||m())&&E(P)},(N=n.onPause)==null||N.call(n)}).then(()=>{var E;l=void 0,u()||(E=n.onContinue)==null||E.call(n)}),k=()=>{if(u())return;let E;const N=a===0?n.initialPromise:void 0;try{E=N??n.fn()}catch(P){E=Promise.reject(P)}Promise.resolve(E).then(g).catch(P=>{var re;if(u())return;const H=n.retry??($l?0:3),U=n.retryDelay??E5,R=typeof U=="function"?U(a,P):U,q=H===!0||typeof H=="number"&&a<H||typeof H=="function"&&H(a,P);if(t||!q){x(P);return}a++,(re=n.onFail)==null||re.call(n,a,P),f5(R).then(()=>m()?void 0:j()).then(()=>{t?x(P):k()})})};return{promise:c,status:()=>c.status,cancel:f,continue:()=>(l==null||l(),c),cancelRetry:p,continueRetry:y,canStart:S,start:()=>(S()?k():j().then(k),c)}}var El,o2,w2=(o2=class{constructor(){it(this,El)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),o1(this.gcTime)&&He(this,El,jl.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(n){this.gcTime=Math.max(this.gcTime||0,n??($l?1/0:300*1e3))}clearGcTimeout(){I(this,El)&&(jl.clearTimeout(I(this,El)),He(this,El,void 0))}},El=new WeakMap,o2),Tl,Wo,fa,Ml,ts,Zu,Rl,Ma,wi,c2,T5=(c2=class extends w2{constructor(t){super();it(this,Ma);it(this,Tl);it(this,Wo);it(this,fa);it(this,Ml);it(this,ts);it(this,Zu);it(this,Rl);He(this,Rl,!1),He(this,Zu,t.defaultOptions),this.setOptions(t.options),this.observers=[],He(this,Ml,t.client),He(this,fa,I(this,Ml).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,He(this,Tl,J4(this.options)),this.state=t.state??I(this,Tl),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=I(this,ts))==null?void 0:t.promise}setOptions(t){if(this.options={...I(this,Zu),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const a=J4(this.options);a.data!==void 0&&(this.setState(X4(a.data,a.dataUpdatedAt)),He(this,Tl,a))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&I(this,fa).remove(this)}setData(t,a){const l=u1(this.state.data,t,this.options);return kt(this,Ma,wi).call(this,{data:l,type:"success",dataUpdatedAt:a==null?void 0:a.updatedAt,manual:a==null?void 0:a.manual}),l}setState(t,a){kt(this,Ma,wi).call(this,{type:"setState",state:t,setStateOptions:a})}cancel(t){var l,c;const a=(l=I(this,ts))==null?void 0:l.promise;return(c=I(this,ts))==null||c.cancel(t),a?a.then(Kn).catch(Kn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(I(this,Tl))}isActive(){return this.observers.some(t=>ha(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===X1||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Hr(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:!v2(this.state.dataUpdatedAt,t)}onFocus(){var a;const t=this.observers.find(l=>l.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(a=I(this,ts))==null||a.continue()}onOnline(){var a;const t=this.observers.find(l=>l.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(a=I(this,ts))==null||a.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),I(this,fa).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(a=>a!==t),this.observers.length||(I(this,ts)&&(I(this,Rl)?I(this,ts).cancel({revert:!0}):I(this,ts).cancelRetry()),this.scheduleGc()),I(this,fa).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||kt(this,Ma,wi).call(this,{type:"invalidate"})}async fetch(t,a){var y,m,S,g,x,j,k,E,N,P,H,U;if(this.state.fetchStatus!=="idle"&&((y=I(this,ts))==null?void 0:y.status())!=="rejected"){if(this.state.data!==void 0&&(a!=null&&a.cancelRefetch))this.cancel({silent:!0});else if(I(this,ts))return I(this,ts).continueRetry(),I(this,ts).promise}if(t&&this.setOptions(t),!this.options.queryFn){const R=this.observers.find(q=>q.options.queryFn);R&&this.setOptions(R.options)}const l=new AbortController,c=R=>{Object.defineProperty(R,"signal",{enumerable:!0,get:()=>(He(this,Rl,!0),l.signal)})},u=()=>{const R=b2(this.options,a),re=(()=>{const V={client:I(this,Ml),queryKey:this.queryKey,meta:this.meta};return c(V),V})();return He(this,Rl,!1),this.options.persister?this.options.persister(R,re,this):R(re)},p=(()=>{const R={fetchOptions:a,options:this.options,queryKey:this.queryKey,client:I(this,Ml),state:this.state,fetchFn:u};return c(R),R})();(m=this.options.behavior)==null||m.onFetch(p,this),He(this,Wo,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((S=p.fetchOptions)==null?void 0:S.meta))&&kt(this,Ma,wi).call(this,{type:"fetch",meta:(g=p.fetchOptions)==null?void 0:g.meta}),He(this,ts,j2({initialPromise:a==null?void 0:a.initialPromise,fn:p.fetchFn,onCancel:R=>{R instanceof f1&&R.revert&&this.setState({...I(this,Wo),fetchStatus:"idle"}),l.abort()},onFail:(R,q)=>{kt(this,Ma,wi).call(this,{type:"failed",failureCount:R,error:q})},onPause:()=>{kt(this,Ma,wi).call(this,{type:"pause"})},onContinue:()=>{kt(this,Ma,wi).call(this,{type:"continue"})},retry:p.options.retry,retryDelay:p.options.retryDelay,networkMode:p.options.networkMode,canRun:()=>!0}));try{const R=await I(this,ts).start();if(R===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(R),(j=(x=I(this,fa).config).onSuccess)==null||j.call(x,R,this),(E=(k=I(this,fa).config).onSettled)==null||E.call(k,R,this.state.error,this),R}catch(R){if(R instanceof f1){if(R.silent)return I(this,ts).promise;if(R.revert){if(this.state.data===void 0)throw R;return this.state.data}}throw kt(this,Ma,wi).call(this,{type:"error",error:R}),(P=(N=I(this,fa).config).onError)==null||P.call(N,R,this),(U=(H=I(this,fa).config).onSettled)==null||U.call(H,this.state.data,R,this),R}finally{this.scheduleGc()}}},Tl=new WeakMap,Wo=new WeakMap,fa=new WeakMap,Ml=new WeakMap,ts=new WeakMap,Zu=new WeakMap,Rl=new WeakMap,Ma=new WeakSet,wi=function(t){const a=l=>{switch(t.type){case"failed":return{...l,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...l,fetchStatus:"paused"};case"continue":return{...l,fetchStatus:"fetching"};case"fetch":return{...l,...k2(l.data,this.options),fetchMeta:t.meta??null};case"success":const c={...l,...X4(t.data,t.dataUpdatedAt),dataUpdateCount:l.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return He(this,Wo,t.manual?c:void 0),c;case"error":const u=t.error;return{...l,error:u,errorUpdateCount:l.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:l.fetchFailureCount+1,fetchFailureReason:u,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...l,isInvalidated:!0};case"setState":return{...l,...t.state}}};this.state=a(this.state),Zn.batch(()=>{this.observers.forEach(l=>{l.onQueryUpdate()}),I(this,fa).notify({query:this,type:"updated",action:t})})},c2);function k2(n,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:S2(t.networkMode)?"fetching":"paused",...n===void 0&&{error:null,status:"pending"}}}function X4(n,t){return{data:n,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function J4(n){const t=typeof n.initialData=="function"?n.initialData():n.initialData,a=t!==void 0,l=a?typeof n.initialDataUpdatedAt=="function"?n.initialDataUpdatedAt():n.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:a?l??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:a?"success":"pending",fetchStatus:"idle"}}var qs,It,Xu,js,Al,Yo,Ei,Dr,Ju,Vo,Ko,Dl,Ol,Or,Zo,tn,Nu,h1,m1,p1,g1,y1,v1,_1,N2,u2,M5=(u2=class extends dc{constructor(t,a){super();it(this,tn);it(this,qs);it(this,It);it(this,Xu);it(this,js);it(this,Al);it(this,Yo);it(this,Ei);it(this,Dr);it(this,Ju);it(this,Vo);it(this,Ko);it(this,Dl);it(this,Ol);it(this,Or);it(this,Zo,new Set);this.options=a,He(this,qs,t),He(this,Dr,null),He(this,Ei,d1()),this.bindMethods(),this.setOptions(a)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(I(this,It).addObserver(this),e6(I(this,It),this.options)?kt(this,tn,Nu).call(this):this.updateResult(),kt(this,tn,g1).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return b1(I(this,It),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return b1(I(this,It),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,kt(this,tn,y1).call(this),kt(this,tn,v1).call(this),I(this,It).removeObserver(this)}setOptions(t){const a=this.options,l=I(this,It);if(this.options=I(this,qs).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ha(this.options.enabled,I(this,It))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");kt(this,tn,_1).call(this),I(this,It).setOptions(this.options),a._defaulted&&!Gf(this.options,a)&&I(this,qs).getQueryCache().notify({type:"observerOptionsUpdated",query:I(this,It),observer:this});const c=this.hasListeners();c&&t6(I(this,It),l,this.options,a)&&kt(this,tn,Nu).call(this),this.updateResult(),c&&(I(this,It)!==l||ha(this.options.enabled,I(this,It))!==ha(a.enabled,I(this,It))||Hr(this.options.staleTime,I(this,It))!==Hr(a.staleTime,I(this,It)))&&kt(this,tn,h1).call(this);const u=kt(this,tn,m1).call(this);c&&(I(this,It)!==l||ha(this.options.enabled,I(this,It))!==ha(a.enabled,I(this,It))||u!==I(this,Or))&&kt(this,tn,p1).call(this,u)}getOptimisticResult(t){const a=I(this,qs).getQueryCache().build(I(this,qs),t),l=this.createResult(a,t);return A5(this,l)&&(He(this,js,l),He(this,Yo,this.options),He(this,Al,I(this,It).state)),l}getCurrentResult(){return I(this,js)}trackResult(t,a){return new Proxy(t,{get:(l,c)=>(this.trackProp(c),a==null||a(c),c==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&I(this,Ei).status==="pending"&&I(this,Ei).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(l,c))})}trackProp(t){I(this,Zo).add(t)}getCurrentQuery(){return I(this,It)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const a=I(this,qs).defaultQueryOptions(t),l=I(this,qs).getQueryCache().build(I(this,qs),a);return l.fetch().then(()=>this.createResult(l,a))}fetch(t){return kt(this,tn,Nu).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),I(this,js)))}createResult(t,a){var Z;const l=I(this,It),c=this.options,u=I(this,js),f=I(this,Al),p=I(this,Yo),m=t!==l?t.state:I(this,Xu),{state:S}=t;let g={...S},x=!1,j;if(a._optimisticResults){const W=this.hasListeners(),F=!W&&e6(t,a),be=W&&t6(t,l,a,c);(F||be)&&(g={...g,...k2(S.data,t.options)}),a._optimisticResults==="isRestoring"&&(g.fetchStatus="idle")}let{error:k,errorUpdatedAt:E,status:N}=g;j=g.data;let P=!1;if(a.placeholderData!==void 0&&j===void 0&&N==="pending"){let W;u!=null&&u.isPlaceholderData&&a.placeholderData===(p==null?void 0:p.placeholderData)?(W=u.data,P=!0):W=typeof a.placeholderData=="function"?a.placeholderData((Z=I(this,Ko))==null?void 0:Z.state.data,I(this,Ko)):a.placeholderData,W!==void 0&&(N="success",j=u1(u==null?void 0:u.data,W,a),x=!0)}if(a.select&&j!==void 0&&!P)if(u&&j===(f==null?void 0:f.data)&&a.select===I(this,Ju))j=I(this,Vo);else try{He(this,Ju,a.select),j=a.select(j),j=u1(u==null?void 0:u.data,j,a),He(this,Vo,j),He(this,Dr,null)}catch(W){He(this,Dr,W)}I(this,Dr)&&(k=I(this,Dr),j=I(this,Vo),E=Date.now(),N="error");const H=g.fetchStatus==="fetching",U=N==="pending",R=N==="error",q=U&&H,re=j!==void 0,ee={status:N,fetchStatus:g.fetchStatus,isPending:U,isSuccess:N==="success",isError:R,isInitialLoading:q,isLoading:q,data:j,dataUpdatedAt:g.dataUpdatedAt,error:k,errorUpdatedAt:E,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:H,isRefetching:H&&!U,isLoadingError:R&&!re,isPaused:g.fetchStatus==="paused",isPlaceholderData:x,isRefetchError:R&&re,isStale:t0(t,a),refetch:this.refetch,promise:I(this,Ei),isEnabled:ha(a.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const W=ee.data!==void 0,F=ee.status==="error"&&!W,be=ne=>{F?ne.reject(ee.error):W&&ne.resolve(ee.data)},pe=()=>{const ne=He(this,Ei,ee.promise=d1());be(ne)},Y=I(this,Ei);switch(Y.status){case"pending":t.queryHash===l.queryHash&&be(Y);break;case"fulfilled":(F||ee.data!==Y.value)&&pe();break;case"rejected":(!F||ee.error!==Y.reason)&&pe();break}}return ee}updateResult(){const t=I(this,js),a=this.createResult(I(this,It),this.options);if(He(this,Al,I(this,It).state),He(this,Yo,this.options),I(this,Al).data!==void 0&&He(this,Ko,I(this,It)),Gf(a,t))return;He(this,js,a);const l=()=>{if(!t)return!0;const{notifyOnChangeProps:c}=this.options,u=typeof c=="function"?c():c;if(u==="all"||!u&&!I(this,Zo).size)return!0;const f=new Set(u??I(this,Zo));return this.options.throwOnError&&f.add("error"),Object.keys(I(this,js)).some(p=>{const y=p;return I(this,js)[y]!==t[y]&&f.has(y)})};kt(this,tn,N2).call(this,{listeners:l()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&kt(this,tn,g1).call(this)}},qs=new WeakMap,It=new WeakMap,Xu=new WeakMap,js=new WeakMap,Al=new WeakMap,Yo=new WeakMap,Ei=new WeakMap,Dr=new WeakMap,Ju=new WeakMap,Vo=new WeakMap,Ko=new WeakMap,Dl=new WeakMap,Ol=new WeakMap,Or=new WeakMap,Zo=new WeakMap,tn=new WeakSet,Nu=function(t){kt(this,tn,_1).call(this);let a=I(this,It).fetch(this.options,t);return t!=null&&t.throwOnError||(a=a.catch(Kn)),a},h1=function(){kt(this,tn,y1).call(this);const t=Hr(this.options.staleTime,I(this,It));if($l||I(this,js).isStale||!o1(t))return;const l=v2(I(this,js).dataUpdatedAt,t)+1;He(this,Dl,jl.setTimeout(()=>{I(this,js).isStale||this.updateResult()},l))},m1=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(I(this,It)):this.options.refetchInterval)??!1},p1=function(t){kt(this,tn,v1).call(this),He(this,Or,t),!($l||ha(this.options.enabled,I(this,It))===!1||!o1(I(this,Or))||I(this,Or)===0)&&He(this,Ol,jl.setInterval(()=>{(this.options.refetchIntervalInBackground||e0.isFocused())&&kt(this,tn,Nu).call(this)},I(this,Or)))},g1=function(){kt(this,tn,h1).call(this),kt(this,tn,p1).call(this,kt(this,tn,m1).call(this))},y1=function(){I(this,Dl)&&(jl.clearTimeout(I(this,Dl)),He(this,Dl,void 0))},v1=function(){I(this,Ol)&&(jl.clearInterval(I(this,Ol)),He(this,Ol,void 0))},_1=function(){const t=I(this,qs).getQueryCache().build(I(this,qs),this.options);if(t===I(this,It))return;const a=I(this,It);He(this,It,t),He(this,Xu,t.state),this.hasListeners()&&(a==null||a.removeObserver(this),t.addObserver(this))},N2=function(t){Zn.batch(()=>{t.listeners&&this.listeners.forEach(a=>{a(I(this,js))}),I(this,qs).getQueryCache().notify({query:I(this,It),type:"observerResultsUpdated"})})},u2);function R5(n,t){return ha(t.enabled,n)!==!1&&n.state.data===void 0&&!(n.state.status==="error"&&t.retryOnMount===!1)}function e6(n,t){return R5(n,t)||n.state.data!==void 0&&b1(n,t,t.refetchOnMount)}function b1(n,t,a){if(ha(t.enabled,n)!==!1&&Hr(t.staleTime,n)!=="static"){const l=typeof a=="function"?a(n):a;return l==="always"||l!==!1&&t0(n,t)}return!1}function t6(n,t,a,l){return(n!==t||ha(l.enabled,n)===!1)&&(!a.suspense||n.state.status!=="error")&&t0(n,a)}function t0(n,t){return ha(t.enabled,n)!==!1&&n.isStaleByTime(Hr(t.staleTime,n))}function A5(n,t){return!Gf(n.getCurrentResult(),t)}function n6(n){return{onFetch:(t,a)=>{var S,g,x,j,k;const l=t.options,c=(x=(g=(S=t.fetchOptions)==null?void 0:S.meta)==null?void 0:g.fetchMore)==null?void 0:x.direction,u=((j=t.state.data)==null?void 0:j.pages)||[],f=((k=t.state.data)==null?void 0:k.pageParams)||[];let p={pages:[],pageParams:[]},y=0;const m=async()=>{let E=!1;const N=U=>{p5(U,()=>t.signal,()=>E=!0)},P=b2(t.options,t.fetchOptions),H=async(U,R,q)=>{if(E)return Promise.reject();if(R==null&&U.pages.length)return Promise.resolve(U);const V=(()=>{const F={client:t.client,queryKey:t.queryKey,pageParam:R,direction:q?"backward":"forward",meta:t.options.meta};return N(F),F})(),ee=await P(V),{maxPages:Z}=t.options,W=q?m5:h5;return{pages:W(U.pages,ee,Z),pageParams:W(U.pageParams,R,Z)}};if(c&&u.length){const U=c==="backward",R=U?D5:s6,q={pages:u,pageParams:f},re=R(l,q);p=await H(q,re,U)}else{const U=n??u.length;do{const R=y===0?f[0]??l.initialPageParam:s6(l,p);if(y>0&&R==null)break;p=await H(p,R),y++}while(y<U)}return p};t.options.persister?t.fetchFn=()=>{var E,N;return(N=(E=t.options).persister)==null?void 0:N.call(E,m,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},a)}:t.fetchFn=m}}}function s6(n,{pages:t,pageParams:a}){const l=t.length-1;return t.length>0?n.getNextPageParam(t[l],t,a[l],a):void 0}function D5(n,{pages:t,pageParams:a}){var l;return t.length>0?(l=n.getPreviousPageParam)==null?void 0:l.call(n,t[0],t,a[0],a):void 0}var ed,Fa,ms,Ll,Qa,kr,d2,O5=(d2=class extends w2{constructor(t){super();it(this,Qa);it(this,ed);it(this,Fa);it(this,ms);it(this,Ll);He(this,ed,t.client),this.mutationId=t.mutationId,He(this,ms,t.mutationCache),He(this,Fa,[]),this.state=t.state||C2(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){I(this,Fa).includes(t)||(I(this,Fa).push(t),this.clearGcTimeout(),I(this,ms).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){He(this,Fa,I(this,Fa).filter(a=>a!==t)),this.scheduleGc(),I(this,ms).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){I(this,Fa).length||(this.state.status==="pending"?this.scheduleGc():I(this,ms).remove(this))}continue(){var t;return((t=I(this,Ll))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var f,p,y,m,S,g,x,j,k,E,N,P,H,U,R,q,re,V;const a=()=>{kt(this,Qa,kr).call(this,{type:"continue"})},l={client:I(this,ed),meta:this.options.meta,mutationKey:this.options.mutationKey};He(this,Ll,j2({fn:()=>this.options.mutationFn?this.options.mutationFn(t,l):Promise.reject(new Error("No mutationFn found")),onFail:(ee,Z)=>{kt(this,Qa,kr).call(this,{type:"failed",failureCount:ee,error:Z})},onPause:()=>{kt(this,Qa,kr).call(this,{type:"pause"})},onContinue:a,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>I(this,ms).canRun(this)}));const c=this.state.status==="pending",u=!I(this,Ll).canStart();try{if(c)a();else{kt(this,Qa,kr).call(this,{type:"pending",variables:t,isPaused:u}),I(this,ms).config.onMutate&&await I(this,ms).config.onMutate(t,this,l);const Z=await((p=(f=this.options).onMutate)==null?void 0:p.call(f,t,l));Z!==this.state.context&&kt(this,Qa,kr).call(this,{type:"pending",context:Z,variables:t,isPaused:u})}const ee=await I(this,Ll).start();return await((m=(y=I(this,ms).config).onSuccess)==null?void 0:m.call(y,ee,t,this.state.context,this,l)),await((g=(S=this.options).onSuccess)==null?void 0:g.call(S,ee,t,this.state.context,l)),await((j=(x=I(this,ms).config).onSettled)==null?void 0:j.call(x,ee,null,this.state.variables,this.state.context,this,l)),await((E=(k=this.options).onSettled)==null?void 0:E.call(k,ee,null,t,this.state.context,l)),kt(this,Qa,kr).call(this,{type:"success",data:ee}),ee}catch(ee){try{await((P=(N=I(this,ms).config).onError)==null?void 0:P.call(N,ee,t,this.state.context,this,l))}catch(Z){Promise.reject(Z)}try{await((U=(H=this.options).onError)==null?void 0:U.call(H,ee,t,this.state.context,l))}catch(Z){Promise.reject(Z)}try{await((q=(R=I(this,ms).config).onSettled)==null?void 0:q.call(R,void 0,ee,this.state.variables,this.state.context,this,l))}catch(Z){Promise.reject(Z)}try{await((V=(re=this.options).onSettled)==null?void 0:V.call(re,void 0,ee,t,this.state.context,l))}catch(Z){Promise.reject(Z)}throw kt(this,Qa,kr).call(this,{type:"error",error:ee}),ee}finally{I(this,ms).runNext(this)}}},ed=new WeakMap,Fa=new WeakMap,ms=new WeakMap,Ll=new WeakMap,Qa=new WeakSet,kr=function(t){const a=l=>{switch(t.type){case"failed":return{...l,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...l,isPaused:!0};case"continue":return{...l,isPaused:!1};case"pending":return{...l,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...l,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...l,data:void 0,error:t.error,failureCount:l.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=a(this.state),Zn.batch(()=>{I(this,Fa).forEach(l=>{l.onMutationUpdate(t)}),I(this,ms).notify({mutation:this,type:"updated",action:t})})},d2);function C2(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ti,Ra,td,f2,L5=(f2=class extends dc{constructor(t={}){super();it(this,Ti);it(this,Ra);it(this,td);this.config=t,He(this,Ti,new Set),He(this,Ra,new Map),He(this,td,0)}build(t,a,l){const c=new O5({client:t,mutationCache:this,mutationId:++Ef(this,td)._,options:t.defaultMutationOptions(a),state:l});return this.add(c),c}add(t){I(this,Ti).add(t);const a=Tf(t);if(typeof a=="string"){const l=I(this,Ra).get(a);l?l.push(t):I(this,Ra).set(a,[t])}this.notify({type:"added",mutation:t})}remove(t){if(I(this,Ti).delete(t)){const a=Tf(t);if(typeof a=="string"){const l=I(this,Ra).get(a);if(l)if(l.length>1){const c=l.indexOf(t);c!==-1&&l.splice(c,1)}else l[0]===t&&I(this,Ra).delete(a)}}this.notify({type:"removed",mutation:t})}canRun(t){const a=Tf(t);if(typeof a=="string"){const l=I(this,Ra).get(a),c=l==null?void 0:l.find(u=>u.state.status==="pending");return!c||c===t}else return!0}runNext(t){var l;const a=Tf(t);if(typeof a=="string"){const c=(l=I(this,Ra).get(a))==null?void 0:l.find(u=>u!==t&&u.state.isPaused);return(c==null?void 0:c.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Zn.batch(()=>{I(this,Ti).forEach(t=>{this.notify({type:"removed",mutation:t})}),I(this,Ti).clear(),I(this,Ra).clear()})}getAll(){return Array.from(I(this,Ti))}find(t){const a={exact:!0,...t};return this.getAll().find(l=>V4(a,l))}findAll(t={}){return this.getAll().filter(a=>V4(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(Kn))))}},Ti=new WeakMap,Ra=new WeakMap,td=new WeakMap,f2);function Tf(n){var t;return(t=n.options.scope)==null?void 0:t.id}var Mi,Lr,Fs,Ri,Pi,Bf,x1,h2,I5=(h2=class extends dc{constructor(a,l){super();it(this,Pi);it(this,Mi);it(this,Lr);it(this,Fs);it(this,Ri);He(this,Mi,a),this.setOptions(l),this.bindMethods(),kt(this,Pi,Bf).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(a){var c;const l=this.options;this.options=I(this,Mi).defaultMutationOptions(a),Gf(this.options,l)||I(this,Mi).getMutationCache().notify({type:"observerOptionsUpdated",mutation:I(this,Fs),observer:this}),l!=null&&l.mutationKey&&this.options.mutationKey&&Hl(l.mutationKey)!==Hl(this.options.mutationKey)?this.reset():((c=I(this,Fs))==null?void 0:c.state.status)==="pending"&&I(this,Fs).setOptions(this.options)}onUnsubscribe(){var a;this.hasListeners()||(a=I(this,Fs))==null||a.removeObserver(this)}onMutationUpdate(a){kt(this,Pi,Bf).call(this),kt(this,Pi,x1).call(this,a)}getCurrentResult(){return I(this,Lr)}reset(){var a;(a=I(this,Fs))==null||a.removeObserver(this),He(this,Fs,void 0),kt(this,Pi,Bf).call(this),kt(this,Pi,x1).call(this)}mutate(a,l){var c;return He(this,Ri,l),(c=I(this,Fs))==null||c.removeObserver(this),He(this,Fs,I(this,Mi).getMutationCache().build(I(this,Mi),this.options)),I(this,Fs).addObserver(this),I(this,Fs).execute(a)}},Mi=new WeakMap,Lr=new WeakMap,Fs=new WeakMap,Ri=new WeakMap,Pi=new WeakSet,Bf=function(){var l;const a=((l=I(this,Fs))==null?void 0:l.state)??C2();He(this,Lr,{...a,isPending:a.status==="pending",isSuccess:a.status==="success",isError:a.status==="error",isIdle:a.status==="idle",mutate:this.mutate,reset:this.reset})},x1=function(a){Zn.batch(()=>{var l,c,u,f,p,y,m,S;if(I(this,Ri)&&this.hasListeners()){const g=I(this,Lr).variables,x=I(this,Lr).context,j={client:I(this,Mi),meta:this.options.meta,mutationKey:this.options.mutationKey};if((a==null?void 0:a.type)==="success"){try{(c=(l=I(this,Ri)).onSuccess)==null||c.call(l,a.data,g,x,j)}catch(k){Promise.reject(k)}try{(f=(u=I(this,Ri)).onSettled)==null||f.call(u,a.data,null,g,x,j)}catch(k){Promise.reject(k)}}else if((a==null?void 0:a.type)==="error"){try{(y=(p=I(this,Ri)).onError)==null||y.call(p,a.error,g,x,j)}catch(k){Promise.reject(k)}try{(S=(m=I(this,Ri)).onSettled)==null||S.call(m,void 0,a.error,g,x,j)}catch(k){Promise.reject(k)}}}this.listeners.forEach(g=>{g(I(this,Lr))})})},h2),Ga,m2,P5=(m2=class extends dc{constructor(t={}){super();it(this,Ga);this.config=t,He(this,Ga,new Map)}build(t,a,l){const c=a.queryKey,u=a.queryHash??Z1(c,a);let f=this.get(u);return f||(f=new T5({client:t,queryKey:c,queryHash:u,options:t.defaultQueryOptions(a),state:l,defaultOptions:t.getQueryDefaults(c)}),this.add(f)),f}add(t){I(this,Ga).has(t.queryHash)||(I(this,Ga).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const a=I(this,Ga).get(t.queryHash);a&&(t.destroy(),a===t&&I(this,Ga).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Zn.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return I(this,Ga).get(t)}getAll(){return[...I(this,Ga).values()]}find(t){const a={exact:!0,...t};return this.getAll().find(l=>Y4(a,l))}findAll(t={}){const a=this.getAll();return Object.keys(t).length>0?a.filter(l=>Y4(t,l)):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()})})}},Ga=new WeakMap,m2),An,Ir,Pr,Xo,Jo,zr,ec,tc,p2,z5=(p2=class{constructor(n={}){it(this,An);it(this,Ir);it(this,Pr);it(this,Xo);it(this,Jo);it(this,zr);it(this,ec);it(this,tc);He(this,An,n.queryCache||new P5),He(this,Ir,n.mutationCache||new L5),He(this,Pr,n.defaultOptions||{}),He(this,Xo,new Map),He(this,Jo,new Map),He(this,zr,0)}mount(){Ef(this,zr)._++,I(this,zr)===1&&(He(this,ec,e0.subscribe(async n=>{n&&(await this.resumePausedMutations(),I(this,An).onFocus())})),He(this,tc,Wf.subscribe(async n=>{n&&(await this.resumePausedMutations(),I(this,An).onOnline())})))}unmount(){var n,t;Ef(this,zr)._--,I(this,zr)===0&&((n=I(this,ec))==null||n.call(this),He(this,ec,void 0),(t=I(this,tc))==null||t.call(this),He(this,tc,void 0))}isFetching(n){return I(this,An).findAll({...n,fetchStatus:"fetching"}).length}isMutating(n){return I(this,Ir).findAll({...n,status:"pending"}).length}getQueryData(n){var a;const t=this.defaultQueryOptions({queryKey:n});return(a=I(this,An).get(t.queryHash))==null?void 0:a.state.data}ensureQueryData(n){const t=this.defaultQueryOptions(n),a=I(this,An).build(this,t),l=a.state.data;return l===void 0?this.fetchQuery(n):(n.revalidateIfStale&&a.isStaleByTime(Hr(t.staleTime,a))&&this.prefetchQuery(t),Promise.resolve(l))}getQueriesData(n){return I(this,An).findAll(n).map(({queryKey:t,state:a})=>{const l=a.data;return[t,l]})}setQueryData(n,t,a){const l=this.defaultQueryOptions({queryKey:n}),c=I(this,An).get(l.queryHash),u=c==null?void 0:c.state.data,f=u5(t,u);if(f!==void 0)return I(this,An).build(this,l).setData(f,{...a,manual:!0})}setQueriesData(n,t,a){return Zn.batch(()=>I(this,An).findAll(n).map(({queryKey:l})=>[l,this.setQueryData(l,t,a)]))}getQueryState(n){var a;const t=this.defaultQueryOptions({queryKey:n});return(a=I(this,An).get(t.queryHash))==null?void 0:a.state}removeQueries(n){const t=I(this,An);Zn.batch(()=>{t.findAll(n).forEach(a=>{t.remove(a)})})}resetQueries(n,t){const a=I(this,An);return Zn.batch(()=>(a.findAll(n).forEach(l=>{l.reset()}),this.refetchQueries({type:"active",...n},t)))}cancelQueries(n,t={}){const a={revert:!0,...t},l=Zn.batch(()=>I(this,An).findAll(n).map(c=>c.cancel(a)));return Promise.all(l).then(Kn).catch(Kn)}invalidateQueries(n,t={}){return Zn.batch(()=>(I(this,An).findAll(n).forEach(a=>{a.invalidate()}),(n==null?void 0:n.refetchType)==="none"?Promise.resolve():this.refetchQueries({...n,type:(n==null?void 0:n.refetchType)??(n==null?void 0:n.type)??"active"},t)))}refetchQueries(n,t={}){const a={...t,cancelRefetch:t.cancelRefetch??!0},l=Zn.batch(()=>I(this,An).findAll(n).filter(c=>!c.isDisabled()&&!c.isStatic()).map(c=>{let u=c.fetch(void 0,a);return a.throwOnError||(u=u.catch(Kn)),c.state.fetchStatus==="paused"?Promise.resolve():u}));return Promise.all(l).then(Kn)}fetchQuery(n){const t=this.defaultQueryOptions(n);t.retry===void 0&&(t.retry=!1);const a=I(this,An).build(this,t);return a.isStaleByTime(Hr(t.staleTime,a))?a.fetch(t):Promise.resolve(a.state.data)}prefetchQuery(n){return this.fetchQuery(n).then(Kn).catch(Kn)}fetchInfiniteQuery(n){return n.behavior=n6(n.pages),this.fetchQuery(n)}prefetchInfiniteQuery(n){return this.fetchInfiniteQuery(n).then(Kn).catch(Kn)}ensureInfiniteQueryData(n){return n.behavior=n6(n.pages),this.ensureQueryData(n)}resumePausedMutations(){return Wf.isOnline()?I(this,Ir).resumePausedMutations():Promise.resolve()}getQueryCache(){return I(this,An)}getMutationCache(){return I(this,Ir)}getDefaultOptions(){return I(this,Pr)}setDefaultOptions(n){He(this,Pr,n)}setQueryDefaults(n,t){I(this,Xo).set(Hl(n),{queryKey:n,defaultOptions:t})}getQueryDefaults(n){const t=[...I(this,Xo).values()],a={};return t.forEach(l=>{zu(n,l.queryKey)&&Object.assign(a,l.defaultOptions)}),a}setMutationDefaults(n,t){I(this,Jo).set(Hl(n),{mutationKey:n,defaultOptions:t})}getMutationDefaults(n){const t=[...I(this,Jo).values()],a={};return t.forEach(l=>{zu(n,l.mutationKey)&&Object.assign(a,l.defaultOptions)}),a}defaultQueryOptions(n){if(n._defaulted)return n;const t={...I(this,Pr).queries,...this.getQueryDefaults(n.queryKey),...n,_defaulted:!0};return t.queryHash||(t.queryHash=Z1(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===X1&&(t.enabled=!1),t}defaultMutationOptions(n){return n!=null&&n._defaulted?n:{...I(this,Pr).mutations,...(n==null?void 0:n.mutationKey)&&this.getMutationDefaults(n.mutationKey),...n,_defaulted:!0}}clear(){I(this,An).clear(),I(this,Ir).clear()}},An=new WeakMap,Ir=new WeakMap,Pr=new WeakMap,Xo=new WeakMap,Jo=new WeakMap,zr=new WeakMap,ec=new WeakMap,tc=new WeakMap,p2),E2=_.createContext(void 0),Vr=n=>{const t=_.useContext(E2);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},B5=({client:n,children:t})=>(_.useEffect(()=>(n.mount(),()=>{n.unmount()}),[n]),r.jsx(E2.Provider,{value:n,children:t})),T2=_.createContext(!1),U5=()=>_.useContext(T2);T2.Provider;function $5(){let n=!1;return{clearReset:()=>{n=!1},reset:()=>{n=!0},isReset:()=>n}}var H5=_.createContext($5()),q5=()=>_.useContext(H5),F5=(n,t,a)=>{const l=a!=null&&a.state.error&&typeof n.throwOnError=="function"?J1(n.throwOnError,[a.state.error,a]):n.throwOnError;(n.suspense||n.experimental_prefetchInRender||l)&&(t.isReset()||(n.retryOnMount=!1))},Q5=n=>{_.useEffect(()=>{n.clearReset()},[n])},G5=({result:n,errorResetBoundary:t,throwOnError:a,query:l,suspense:c})=>n.isError&&!t.isReset()&&!n.isFetching&&l&&(c&&n.data===void 0||J1(a,[n.error,l])),W5=n=>{if(n.suspense){const a=c=>c==="static"?c:Math.max(c??1e3,1e3),l=n.staleTime;n.staleTime=typeof l=="function"?(...c)=>a(l(...c)):a(l),typeof n.gcTime=="number"&&(n.gcTime=Math.max(n.gcTime,1e3))}},Y5=(n,t)=>n.isLoading&&n.isFetching&&!t,V5=(n,t)=>(n==null?void 0:n.suspense)&&t.isPending,a6=(n,t,a)=>t.fetchOptimistic(n).catch(()=>{a.clearReset()});function K5(n,t,a){var x,j,k,E;const l=U5(),c=q5(),u=Vr(),f=u.defaultQueryOptions(n);(j=(x=u.getDefaultOptions().queries)==null?void 0:x._experimental_beforeQuery)==null||j.call(x,f);const p=u.getQueryCache().get(f.queryHash);f._optimisticResults=l?"isRestoring":"optimistic",W5(f),F5(f,c,p),Q5(c);const y=!u.getQueryCache().get(f.queryHash),[m]=_.useState(()=>new t(u,f)),S=m.getOptimisticResult(f),g=!l&&n.subscribed!==!1;if(_.useSyncExternalStore(_.useCallback(N=>{const P=g?m.subscribe(Zn.batchCalls(N)):Kn;return m.updateResult(),P},[m,g]),()=>m.getCurrentResult(),()=>m.getCurrentResult()),_.useEffect(()=>{m.setOptions(f)},[f,m]),V5(f,S))throw a6(f,m,c);if(G5({result:S,errorResetBoundary:c,throwOnError:f.throwOnError,query:p,suspense:f.suspense}))throw S.error;if((E=(k=u.getDefaultOptions().queries)==null?void 0:k._experimental_afterQuery)==null||E.call(k,f,S),f.experimental_prefetchInRender&&!$l&&Y5(S,l)){const N=y?a6(f,m,c):p==null?void 0:p.promise;N==null||N.catch(Kn).finally(()=>{m.updateResult()})}return f.notifyOnChangeProps?S:m.trackResult(S)}function ks(n,t){return K5(n,M5)}function ns(n,t){const a=Vr(),[l]=_.useState(()=>new I5(a,n));_.useEffect(()=>{l.setOptions(n)},[l,n]);const c=_.useSyncExternalStore(_.useCallback(f=>l.subscribe(Zn.batchCalls(f)),[l]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),u=_.useCallback((f,p)=>{l.mutate(f,p).catch(Kn)},[l]);if(c.error&&J1(l.options.throwOnError,[c.error]))throw c.error;return{...c,mutate:u,mutateAsync:c.mutate}}var Mf=typeof window<"u"?_.useLayoutEffect:_.useEffect;function Rp(n){const t=_.useRef({value:n,prev:null}),a=t.current.value;return n!==a&&(t.current={value:n,prev:a}),t.current.prev}function Z5(n,t,a={},l={}){_.useEffect(()=>{if(!n.current||l.disabled||typeof IntersectionObserver!="function")return;const c=new IntersectionObserver(([u])=>{t(u)},a);return c.observe(n.current),()=>{c.disconnect()}},[t,a,l.disabled,n])}function X5(n){const t=_.useRef(null);return _.useImperativeHandle(n,()=>t.current,[]),t}var J5=!1;function Bu(n){return n[n.length-1]}function e9(n){return typeof n=="function"}function Br(n,t){return e9(n)?n(t):n}var t9=Object.prototype.hasOwnProperty,i6=Object.prototype.propertyIsEnumerable,n9=()=>Object.create(null),_l=(n,t)=>wl(n,t,n9);function wl(n,t,a=()=>({}),l=0){if(n===t)return n;if(l>500)return t;const c=t,u=o6(n)&&o6(c);if(!u&&!(Yf(n)&&Yf(c)))return c;const f=u?n:r6(n);if(!f)return c;const p=u?c:r6(c);if(!p)return c;const y=f.length,m=p.length,S=u?new Array(m):a();let g=0;for(let x=0;x<m;x++){const j=u?x:p[x],k=n[j],E=c[j];if(k===E){S[j]=k,(u?x<y:t9.call(n,j))&&g++;continue}if(k===null||E===null||typeof k!="object"||typeof E!="object"){S[j]=E;continue}const N=wl(k,E,a,l+1);S[j]=N,N===k&&g++}return y===m&&g===y?n:S}function r6(n){const t=Object.getOwnPropertyNames(n);for(const c of t)if(!i6.call(n,c))return!1;const a=Object.getOwnPropertySymbols(n);if(a.length===0)return t;const l=t;for(const c of a){if(!i6.call(n,c))return!1;l.push(c)}return l}function Yf(n){if(!l6(n))return!1;const t=n.constructor;if(typeof t>"u")return!0;const a=t.prototype;return!(!l6(a)||!a.hasOwnProperty("isPrototypeOf"))}function l6(n){return Object.prototype.toString.call(n)==="[object Object]"}function o6(n){return Array.isArray(n)&&n.length===Object.keys(n).length}function Il(n,t,a){if(n===t)return!0;if(typeof n!=typeof t)return!1;if(Array.isArray(n)&&Array.isArray(t)){if(n.length!==t.length)return!1;for(let l=0,c=n.length;l<c;l++)if(!Il(n[l],t[l],a))return!1;return!0}if(Yf(n)&&Yf(t)){const l=(a==null?void 0:a.ignoreUndefined)??!0;if(a!=null&&a.partial){for(const f in t)if((!l||t[f]!==void 0)&&!Il(n[f],t[f],a))return!1;return!0}let c=0;if(!l)c=Object.keys(n).length;else for(const f in n)n[f]!==void 0&&c++;let u=0;for(const f in t)if((!l||t[f]!==void 0)&&(u++,u>c||!Il(n[f],t[f],a)))return!1;return c===u}return!1}function nc(n){let t,a;const l=new Promise((c,u)=>{t=c,a=u});return l.status="pending",l.resolve=c=>{l.status="resolved",l.value=c,t(c),n==null||n(c)},l.reject=c=>{l.status="rejected",a(c)},l}function Uu(n){return!!(n&&typeof n=="object"&&typeof n.then=="function")}function s9(n){return n.replace(/[\x00-\x1f\x7f]/g,"")}function c6(n){let t;try{t=decodeURI(n)}catch{t=n.replaceAll(/%[0-9A-F]{2}/gi,a=>{try{return decodeURI(a)}catch{return a}})}return s9(t)}var a9=["http:","https:","mailto:","tel:"];function Vf(n,t){if(!n)return!1;try{const a=new URL(n);return!t.has(a.protocol)}catch{return!1}}function hu(n){if(!n)return{path:n,handledProtocolRelativeURL:!1};if(!/[%\\\x00-\x1f\x7f]/.test(n)&&!n.startsWith("//"))return{path:n,handledProtocolRelativeURL:!1};const t=/%25|%5C/gi;let a=0,l="",c;for(;(c=t.exec(n))!==null;)l+=c6(n.slice(a,c.index))+c[0],a=t.lastIndex;l=l+c6(a?n.slice(a):n);let u=!1;return l.startsWith("//")&&(u=!0,l="/"+l.replace(/^\/+/,"")),{path:l,handledProtocolRelativeURL:u}}function i9(n){return/\s|[^\u0000-\u007F]/.test(n)?n.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):n}function Kf(n){const t=new Map;let a,l;const c=u=>{u.next&&(u.prev?(u.prev.next=u.next,u.next.prev=u.prev,u.next=void 0,l&&(l.next=u,u.prev=l)):(u.next.prev=void 0,a=u.next,u.next=void 0,l&&(u.prev=l,l.next=u)),l=u)};return{get(u){const f=t.get(u);if(f)return c(f),f.value},set(u,f){if(t.size>=n&&a){const y=a;t.delete(y.key),y.next&&(a=y.next,y.next.prev=void 0),y===l&&(l=void 0)}const p=t.get(u);if(p)p.value=f,c(p);else{const y={key:u,value:f,prev:l};l&&(l.next=y),l=y,a||(a=y),t.set(u,y)}},clear(){t.clear(),a=void 0,l=void 0}}}var r9="Invariant failed";function Wr(n,t){if(!n)throw new Error(r9)}var kl=4,M2=5;function l9(n){const t=n.indexOf("{");if(t===-1)return null;const a=n.indexOf("}",t);return a===-1||t+1>=n.length?null:[t,a]}function n0(n,t,a=new Uint16Array(6)){const l=n.indexOf("/",t),c=l===-1?n.length:l,u=n.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=n.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 f=l9(u);if(f){const[p,y]=f,m=u.charCodeAt(p+1);if(m===45){if(p+2<u.length&&u.charCodeAt(p+2)===36){const S=p+3,g=y;if(S<g)return a[0]=3,a[1]=t+p,a[2]=t+S,a[3]=t+g,a[4]=t+y+1,a[5]=c,a}}else if(m===36){const S=p+1,g=p+2;return g===y?(a[0]=2,a[1]=t+p,a[2]=t+S,a[3]=t+g,a[4]=t+y+1,a[5]=n.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 vh(n,t,a,l,c,u,f){var y,m,S,g,x,j,k,E,N,P,H,U,R;f==null||f(a);let p=l;{const q=a.fullPath??a.from,re=q.length,V=((y=a.options)==null?void 0:y.caseSensitive)??n,ee=!!((S=(m=a.options)==null?void 0:m.params)!=null&&S.parse&&((x=(g=a.options)==null?void 0:g.skipRouteOnParseError)!=null&&x.params));for(;p<re;){const W=n0(q,p,t);let F;const be=p,pe=W[5];switch(p=pe+1,u++,W[0]){case 0:{const Y=q.substring(W[2],W[3]);if(V){const ne=(j=c.static)==null?void 0:j.get(Y);if(ne)F=ne;else{c.static??(c.static=new Map);const T=Nl(a.fullPath??a.from);T.parent=c,T.depth=u,F=T,c.static.set(Y,T)}}else{const ne=Y.toLowerCase(),T=(k=c.staticInsensitive)==null?void 0:k.get(ne);if(T)F=T;else{c.staticInsensitive??(c.staticInsensitive=new Map);const $=Nl(a.fullPath??a.from);$.parent=c,$.depth=u,F=$,c.staticInsensitive.set(ne,$)}}break}case 1:{const Y=q.substring(be,W[1]),ne=q.substring(W[4],pe),T=V&&!!(Y||ne),$=Y?T?Y:Y.toLowerCase():void 0,ue=ne?T?ne:ne.toLowerCase():void 0,de=!ee&&((E=c.dynamic)==null?void 0:E.find(ve=>!ve.skipOnParamError&&ve.caseSensitive===T&&ve.prefix===$&&ve.suffix===ue));if(de)F=de;else{const ve=Dp(1,a.fullPath??a.from,T,$,ue);F=ve,ve.depth=u,ve.parent=c,c.dynamic??(c.dynamic=[]),c.dynamic.push(ve)}break}case 3:{const Y=q.substring(be,W[1]),ne=q.substring(W[4],pe),T=V&&!!(Y||ne),$=Y?T?Y:Y.toLowerCase():void 0,ue=ne?T?ne:ne.toLowerCase():void 0,de=!ee&&((N=c.optional)==null?void 0:N.find(ve=>!ve.skipOnParamError&&ve.caseSensitive===T&&ve.prefix===$&&ve.suffix===ue));if(de)F=de;else{const ve=Dp(3,a.fullPath??a.from,T,$,ue);F=ve,ve.parent=c,ve.depth=u,c.optional??(c.optional=[]),c.optional.push(ve)}break}case 2:{const Y=q.substring(be,W[1]),ne=q.substring(W[4],pe),T=V&&!!(Y||ne),$=Y?T?Y:Y.toLowerCase():void 0,ue=ne?T?ne:ne.toLowerCase():void 0,de=Dp(2,a.fullPath??a.from,T,$,ue);F=de,de.parent=c,de.depth=u,c.wildcard??(c.wildcard=[]),c.wildcard.push(de)}}c=F}if(ee&&a.children&&!a.isRoot&&a.id&&a.id.charCodeAt(a.id.lastIndexOf("/")+1)===95){const W=Nl(a.fullPath??a.from);W.kind=M2,W.parent=c,u++,W.depth=u,c.pathless??(c.pathless=[]),c.pathless.push(W),c=W}const Z=(a.path||!a.children)&&!a.isRoot;if(Z&&q.endsWith("/")){const W=Nl(a.fullPath??a.from);W.kind=kl,W.parent=c,u++,W.depth=u,c.index=W,c=W}c.parse=((H=(P=a.options)==null?void 0:P.params)==null?void 0:H.parse)??null,c.skipOnParamError=ee,c.parsingPriority=((R=(U=a.options)==null?void 0:U.skipRouteOnParseError)==null?void 0:R.priority)??0,Z&&!c.route&&(c.route=a,c.fullPath=a.fullPath??a.from)}if(a.children)for(const q of a.children)vh(n,t,q,p,c,u,f)}function Ap(n,t){if(n.skipOnParamError&&!t.skipOnParamError)return-1;if(!n.skipOnParamError&&t.skipOnParamError)return 1;if(n.skipOnParamError&&t.skipOnParamError&&(n.parsingPriority||t.parsingPriority))return t.parsingPriority-n.parsingPriority;if(n.prefix&&t.prefix&&n.prefix!==t.prefix){if(n.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(n.prefix))return 1}if(n.suffix&&t.suffix&&n.suffix!==t.suffix){if(n.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(n.suffix))return 1}return n.prefix&&!t.prefix?-1:!n.prefix&&t.prefix?1:n.suffix&&!t.suffix?-1:!n.suffix&&t.suffix?1:n.caseSensitive&&!t.caseSensitive?-1:!n.caseSensitive&&t.caseSensitive?1:0}function Nr(n){var t,a,l;if(n.pathless)for(const c of n.pathless)Nr(c);if(n.static)for(const c of n.static.values())Nr(c);if(n.staticInsensitive)for(const c of n.staticInsensitive.values())Nr(c);if((t=n.dynamic)!=null&&t.length){n.dynamic.sort(Ap);for(const c of n.dynamic)Nr(c)}if((a=n.optional)!=null&&a.length){n.optional.sort(Ap);for(const c of n.optional)Nr(c)}if((l=n.wildcard)!=null&&l.length){n.wildcard.sort(Ap);for(const c of n.wildcard)Nr(c)}}function Nl(n){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:n,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0}}function Dp(n,t,a,l,c){return{kind:n,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0,caseSensitive:a,prefix:l,suffix:c}}function o9(n,t){const a=Nl("/"),l=new Uint16Array(6);for(const c of n)vh(!1,l,c,1,a,0);Nr(a),t.masksTree=a,t.flatCache=Kf(1e3)}function c9(n,t){n||(n="/");const a=t.flatCache.get(n);if(a)return a;const l=s0(n,t.masksTree);return t.flatCache.set(n,l),l}function u9(n,t,a,l,c){n||(n="/"),l||(l="/");const u=t?`case\0${n}`:n;let f=c.singleCache.get(u);return f||(f=Nl("/"),vh(t,new Uint16Array(6),{from:n},1,f,0),c.singleCache.set(u,f)),s0(l,f,a)}function d9(n,t,a=!1){const l=a?n:`nofuzz\0${n}`,c=t.matchCache.get(l);if(c!==void 0)return c;n||(n="/");let u;try{u=s0(n,t.segmentTree,a)}catch(f){if(f instanceof URIError)u=null;else throw f}return u&&(u.branch=m9(u.route)),t.matchCache.set(l,u),u}function f9(n){return n==="/"?n:n.replace(/\/{1,}$/,"")}function h9(n,t=!1,a){const l=Nl(n.fullPath),c=new Uint16Array(6),u={},f={};let p=0;return vh(t,c,n,1,l,0,y=>{if(a==null||a(y,p),Wr(!(y.id in u),`Duplicate routes found with id: ${String(y.id)}`),u[y.id]=y,p!==0&&y.path){const m=f9(y.fullPath);(!f[m]||y.fullPath.endsWith("/"))&&(f[m]=y)}p++}),Nr(l),{processedTree:{segmentTree:l,singleCache:Kf(1e3),matchCache:Kf(1e3),flatCache:null,masksTree:null},routesById:u,routesByPath:f}}function s0(n,t,a=!1){const l=n.split("/"),c=g9(n,l,t,a);if(!c)return null;const[u]=R2(n,l,c);return{route:c.node.route,rawParams:u,parsedParams:c.parsedParams}}function R2(n,t,a){var S,g,x,j,k,E,N,P,H,U;const l=p9(a.node);let c=null;const u=Object.create(null);let f=((S=a.extract)==null?void 0:S.part)??0,p=((g=a.extract)==null?void 0:g.node)??0,y=((x=a.extract)==null?void 0:x.path)??0,m=((j=a.extract)==null?void 0:j.segment)??0;for(;p<l.length;f++,p++,y++,m++){const R=l[p];if(R.kind===kl)break;if(R.kind===M2){m--,f--,y--;continue}const q=t[f],re=y;if(q&&(y+=q.length),R.kind===1){c??(c=a.node.fullPath.split("/"));const V=c[m],ee=((k=R.prefix)==null?void 0:k.length)??0;if(V.charCodeAt(ee)===123){const Z=((E=R.suffix)==null?void 0:E.length)??0,W=V.substring(ee+2,V.length-Z-1),F=q.substring(ee,q.length-Z);u[W]=decodeURIComponent(F)}else{const Z=V.substring(1);u[Z]=decodeURIComponent(q)}}else if(R.kind===3){if(a.skipped&1<<p){f--,y=re-1;continue}c??(c=a.node.fullPath.split("/"));const V=c[m],ee=((N=R.prefix)==null?void 0:N.length)??0,Z=((P=R.suffix)==null?void 0:P.length)??0,W=V.substring(ee+3,V.length-Z-1),F=R.suffix||R.prefix?q.substring(ee,q.length-Z):q;F&&(u[W]=decodeURIComponent(F))}else if(R.kind===2){const V=R,ee=n.substring(re+(((H=V.prefix)==null?void 0:H.length)??0),n.length-(((U=V.suffix)==null?void 0:U.length)??0)),Z=decodeURIComponent(ee);u["*"]=Z,u._splat=Z;break}}return a.rawParams&&Object.assign(u,a.rawParams),[u,{part:f,node:p,path:y,segment:m}]}function m9(n){const t=[n];for(;n.parentRoute;)n=n.parentRoute,t.push(n);return t.reverse(),t}function p9(n){const t=Array(n.depth+1);do t[n.depth]=n,n=n.parent;while(n);return t}function g9(n,t,a,l){if(n==="/"&&a.index)return{node:a.index,skipped:0};const c=!Bu(t),u=c&&n!=="/",f=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,S=null;for(;p.length;){const g=p.pop(),{node:x,index:j,skipped:k,depth:E,statics:N,dynamics:P,optionals:H}=g;let{extract:U,rawParams:R,parsedParams:q}=g;if(x.skipOnParamError){if(!Op(n,t,g))continue;R=g.rawParams,U=g.extract,q=g.parsedParams}l&&x.route&&x.kind!==kl&&mu(m,g)&&(m=g);const re=j===f;if(re&&(x.route&&!u&&mu(S,g)&&(S=g),!x.optional&&!x.wildcard&&!x.index&&!x.pathless))continue;const V=re?void 0:t[j];let ee;if(re&&x.index){const Z={node:x.index,index:j,skipped:k,depth:E+1,statics:N,dynamics:P,optionals:H,extract:U,rawParams:R,parsedParams:q};let W=!0;if(x.index.skipOnParamError&&(Op(n,t,Z)||(W=!1)),W){if(N===f&&!P&&!H&&!k)return Z;mu(S,Z)&&(S=Z)}}if(x.wildcard&&mu(y,g))for(const Z of x.wildcard){const{prefix:W,suffix:F}=Z;if(W&&(re||!(Z.caseSensitive?V:ee??(ee=V.toLowerCase())).startsWith(W)))continue;if(F){if(re)continue;const pe=t.slice(j).join("/").slice(-F.length);if((Z.caseSensitive?pe:pe.toLowerCase())!==F)continue}const be={node:Z,index:f,skipped:k,depth:E,statics:N,dynamics:P,optionals:H,extract:U,rawParams:R,parsedParams:q};if(!(Z.skipOnParamError&&!Op(n,t,be))){y=be;break}}if(x.optional){const Z=k|1<<E,W=E+1;for(let F=x.optional.length-1;F>=0;F--){const be=x.optional[F];p.push({node:be,index:j,skipped:Z,depth:W,statics:N,dynamics:P,optionals:H,extract:U,rawParams:R,parsedParams:q})}if(!re)for(let F=x.optional.length-1;F>=0;F--){const be=x.optional[F],{prefix:pe,suffix:Y}=be;if(pe||Y){const ne=be.caseSensitive?V:ee??(ee=V.toLowerCase());if(pe&&!ne.startsWith(pe)||Y&&!ne.endsWith(Y))continue}p.push({node:be,index:j+1,skipped:k,depth:W,statics:N,dynamics:P,optionals:H+1,extract:U,rawParams:R,parsedParams:q})}}if(!re&&x.dynamic&&V)for(let Z=x.dynamic.length-1;Z>=0;Z--){const W=x.dynamic[Z],{prefix:F,suffix:be}=W;if(F||be){const pe=W.caseSensitive?V:ee??(ee=V.toLowerCase());if(F&&!pe.startsWith(F)||be&&!pe.endsWith(be))continue}p.push({node:W,index:j+1,skipped:k,depth:E+1,statics:N,dynamics:P+1,optionals:H,extract:U,rawParams:R,parsedParams:q})}if(!re&&x.staticInsensitive){const Z=x.staticInsensitive.get(ee??(ee=V.toLowerCase()));Z&&p.push({node:Z,index:j+1,skipped:k,depth:E+1,statics:N+1,dynamics:P,optionals:H,extract:U,rawParams:R,parsedParams:q})}if(!re&&x.static){const Z=x.static.get(V);Z&&p.push({node:Z,index:j+1,skipped:k,depth:E+1,statics:N+1,dynamics:P,optionals:H,extract:U,rawParams:R,parsedParams:q})}if(x.pathless){const Z=E+1;for(let W=x.pathless.length-1;W>=0;W--){const F=x.pathless[W];p.push({node:F,index:j,skipped:k,depth:Z,statics:N,dynamics:P,optionals:H,extract:U,rawParams:R,parsedParams:q})}}}if(S&&y)return mu(y,S)?S:y;if(S)return S;if(y)return y;if(l&&m){let g=m.index;for(let j=0;j<m.index;j++)g+=t[j].length;const x=g===n.length?"/":n.slice(g);return m.rawParams??(m.rawParams=Object.create(null)),m.rawParams["**"]=decodeURIComponent(x),m}return null}function Op(n,t,a){try{const[l,c]=R2(n,t,a);a.rawParams=l,a.extract=c;const u=a.node.parse(l);return a.parsedParams=Object.assign(Object.create(null),a.parsedParams,u),!0}catch{return null}}function mu(n,t){return n?t.statics>n.statics||t.statics===n.statics&&(t.dynamics>n.dynamics||t.dynamics===n.dynamics&&(t.optionals>n.optionals||t.optionals===n.optionals&&((t.node.kind===kl)>(n.node.kind===kl)||t.node.kind===kl==(n.node.kind===kl)&&t.depth>n.depth))):!0}function Uf(n){return a0(n.filter(t=>t!==void 0).join("/"))}function a0(n){return n.replace(/\/{2,}/g,"/")}function A2(n){return n==="/"?n:n.replace(/^\/{1,}/,"")}function qr(n){const t=n.length;return t>1&&n[t-1]==="/"?n.replace(/\/{1,}$/,""):n}function D2(n){return qr(A2(n))}function Zf(n,t){return n!=null&&n.endsWith("/")&&n!=="/"&&n!==`${t}/`?n.slice(0,-1):n}function y9(n,t,a){return Zf(n,a)===Zf(t,a)}function v9({base:n,to:t,trailingSlash:a="never",cache:l}){const c=t.startsWith("/"),u=!c&&t===".";let f;if(l){f=c?t:u?n:n+"\0"+t;const g=l.get(f);if(g)return g}let p;if(u)p=n.split("/");else if(c)p=t.split("/");else{for(p=n.split("/");p.length>1&&Bu(p)==="";)p.pop();const g=t.split("/");for(let x=0,j=g.length;x<j;x++){const k=g[x];k===""?x?x===j-1&&p.push(k):p=[k]:k===".."?p.pop():k==="."||p.push(k)}}p.length>1&&(Bu(p)===""?a==="never"&&p.pop():a==="always"&&p.push(""));let y,m="";for(let g=0;g<p.length;g++){g>0&&(m+="/");const x=p[g];if(!x)continue;y=n0(x,0,y);const j=y[0];if(j===0){m+=x;continue}const k=y[5],E=x.substring(0,y[1]),N=x.substring(y[4],k),P=x.substring(y[2],y[3]);j===1?m+=E||N?`${E}{$${P}}${N}`:`$${P}`:j===2?m+=E||N?`${E}{$}${N}`:"$":m+=`${E}{-$${P}}${N}`}m=a0(m);const S=m||"/";return f&&l&&l.set(f,S),S}function _9(n){const t=new Map(n.map(c=>[encodeURIComponent(c),c])),a=Array.from(t.keys()).map(c=>c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),l=new RegExp(a,"g");return c=>c.replace(l,u=>t.get(u)??u)}function Lp(n,t,a){const l=t[n];return typeof l!="string"?l:n==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(l)?l:l.split("/").map(c=>d6(c,a)).join("/"):d6(l,a)}function u6({path:n,params:t,decoder:a,...l}){let c=!1;const u=Object.create(null);if(!n||n==="/")return{interpolatedPath:"/",usedParams:u,isMissingParams:c};if(!n.includes("$"))return{interpolatedPath:n,usedParams:u,isMissingParams:c};const f=n.length;let p=0,y,m="";for(;p<f;){const S=p;y=n0(n,S,y);const g=y[5];if(p=g+1,S===g)continue;const x=y[0];if(x===0){m+="/"+n.substring(S,g);continue}if(x===2){const j=t._splat;u._splat=j,u["*"]=j;const k=n.substring(S,y[1]),E=n.substring(y[4],g);if(!j){c=!0,(k||E)&&(m+="/"+k+E);continue}const N=Lp("_splat",t,a);m+="/"+k+N+E;continue}if(x===1){const j=n.substring(y[2],y[3]);!c&&!(j in t)&&(c=!0),u[j]=t[j];const k=n.substring(S,y[1]),E=n.substring(y[4],g),N=Lp(j,t,a)??"undefined";m+="/"+k+N+E;continue}if(x===3){const j=n.substring(y[2],y[3]),k=t[j];if(k==null)continue;u[j]=k;const E=n.substring(S,y[1]),N=n.substring(y[4],g),P=Lp(j,t,a)??"";m+="/"+E+P+N;continue}}return n.endsWith("/")&&(m+="/"),{usedParams:u,interpolatedPath:m||"/",isMissingParams:c}}function d6(n,t){const a=encodeURIComponent(n);return(t==null?void 0:t(a))??a}function Ns(n){return!!(n!=null&&n.isNotFound)}function b9(){try{if(typeof window<"u"&&typeof window.sessionStorage=="object")return window.sessionStorage}catch{}}var S1="tsr-scroll-restoration-v1_3",x9=(n,t)=>{let a;return(...l)=>{a||(a=setTimeout(()=>{n(...l),a=null},t))}};function S9(){const n=b9();if(!n)return null;const t=n.getItem(S1);let a=t?JSON.parse(t):{};return{state:a,set:l=>{a=Br(l,a)||a;try{n.setItem(S1,JSON.stringify(a))}catch{console.warn("[ts-router] Could not persist scroll restoration state to sessionStorage.")}}}}var Rf=S9(),j9=n=>n.state.__TSR_key||n.href;function w9(n){const t=[];let a;for(;a=n.parentNode;)t.push(`${n.tagName}:nth-child(${Array.prototype.indexOf.call(a.children,n)+1})`),n=a;return`${t.reverse().join(" > ")}`.toLowerCase()}var Xf=!1;function k9({storageKey:n,key:t,behavior:a,shouldScrollRestoration:l,scrollToTopSelectors:c,location:u}){var m,S;let f;try{f=JSON.parse(sessionStorage.getItem(n)||"{}")}catch(g){console.error(g);return}const p=t||((m=window.history.state)==null?void 0:m.__TSR_key),y=f[p];Xf=!0;e:{if(l&&y&&Object.keys(y).length>0){for(const j in y){const k=y[j];if(j==="window")window.scrollTo({top:k.scrollY,left:k.scrollX,behavior:a});else if(j){const E=document.querySelector(j);E&&(E.scrollLeft=k.scrollX,E.scrollTop=k.scrollY)}}break e}const g=(u??window.location).hash.split("#",2)[1];if(g){const j=((S=window.history.state)==null?void 0:S.__hashScrollIntoViewOptions)??!0;if(j){const k=document.getElementById(g);k&&k.scrollIntoView(j)}break e}const x={top:0,left:0,behavior:a};if(window.scrollTo(x),c)for(const j of c){if(j==="window")continue;const k=typeof j=="function"?j():document.querySelector(j);k&&k.scrollTo(x)}}Xf=!1}function N9(n,t){if(!Rf||((n.options.scrollRestoration??!1)&&(n.isScrollRestoring=!0),n.isScrollRestorationSetup||!Rf))return;n.isScrollRestorationSetup=!0,Xf=!1;const a=n.options.getScrollRestorationKey||j9;window.history.scrollRestoration="manual";const l=c=>{if(Xf||!n.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=w9(c.target)}const f=a(n.state.location);Rf.set(p=>{const y=p[f]||(p[f]={}),m=y[u]||(y[u]={});if(u==="window")m.scrollX=window.scrollX||0,m.scrollY=window.scrollY||0;else if(u){const S=document.querySelector(u);S&&(m.scrollX=S.scrollLeft||0,m.scrollY=S.scrollTop||0)}return p})};typeof document<"u"&&document.addEventListener("scroll",x9(l,100),!0),n.subscribe("onRendered",c=>{const u=a(c.toLocation);if(!n.resetNextScroll){n.resetNextScroll=!0;return}typeof n.options.scrollRestoration=="function"&&!n.options.scrollRestoration({location:n.latestLocation})||(k9({storageKey:S1,key:u,behavior:n.options.scrollRestorationBehavior,shouldScrollRestoration:n.isScrollRestoring,scrollToTopSelectors:n.options.scrollToTopSelectors,location:n.history.location}),n.isScrollRestoring&&Rf.set(f=>(f[u]||(f[u]={}),f)))})}function C9(n){if(typeof document<"u"&&document.querySelector){const t=n.state.location.state.__hashScrollIntoViewOptions??!0;if(t&&n.state.location.hash!==""){const a=document.getElementById(n.state.location.hash);a&&a.scrollIntoView(t)}}}function E9(n,t=String){const a=new URLSearchParams;for(const l in n){const c=n[l];c!==void 0&&a.set(l,t(c))}return a.toString()}function Ip(n){return n?n==="false"?!1:n==="true"?!0:+n*0===0&&+n+""===n?+n:n:""}function T9(n){const t=new URLSearchParams(n),a=Object.create(null);for(const[l,c]of t.entries()){const u=a[l];u==null?a[l]=Ip(c):Array.isArray(u)?u.push(Ip(c)):a[l]=[u,Ip(c)]}return a}var M9=A9(JSON.parse),R9=D9(JSON.stringify,JSON.parse);function A9(n){return t=>{t[0]==="?"&&(t=t.substring(1));const a=T9(t);for(const l in a){const c=a[l];if(typeof c=="string")try{a[l]=n(c)}catch{}}return a}}function D9(n,t){const a=typeof t=="function";function l(c){if(typeof c=="object"&&c!==null)try{return n(c)}catch{}else if(a&&typeof c=="string")try{return t(c),n(c)}catch{}return c}return c=>{const u=E9(c,l);return u?`?${u}`:""}}var Pl="__root__";function O9(n){if(n.statusCode=n.statusCode||n.code||307,!n._builtLocation&&!n.reloadDocument&&typeof n.href=="string")try{new URL(n.href),n.reloadDocument=!0}catch{}const t=new Headers(n.headers);n.href&&t.get("Location")===null&&t.set("Location",n.href);const a=new Response(null,{status:n.statusCode,headers:t});if(a.options=n,n.throw)throw a;return a}function Qs(n){return n instanceof Response&&!!n.options}function L9(n){return{input:({url:t})=>{for(const a of n)t=j1(a,t);return t},output:({url:t})=>{for(let a=n.length-1;a>=0;a--)t=O2(n[a],t);return t}}}function I9(n){const t=D2(n.basepath),a=`/${t}`,l=`${a}/`,c=n.caseSensitive?a:a.toLowerCase(),u=n.caseSensitive?l:l.toLowerCase();return{input:({url:f})=>{const p=n.caseSensitive?f.pathname:f.pathname.toLowerCase();return p===c?f.pathname="/":p.startsWith(u)&&(f.pathname=f.pathname.slice(a.length)),f},output:({url:f})=>(f.pathname=Uf(["/",t,f.pathname]),f)}}function j1(n,t){var l;const a=(l=n==null?void 0:n.input)==null?void 0:l.call(n,{url:t});if(a){if(typeof a=="string")return new URL(a);if(a instanceof URL)return a}return t}function O2(n,t){var l;const a=(l=n==null?void 0:n.output)==null?void 0:l.call(n,{url:t});if(a){if(typeof a=="string")return new URL(a);if(a instanceof URL)return a}return t}var xn=(n=>(n[n.None=0]="None",n[n.Mutable=1]="Mutable",n[n.Watching=2]="Watching",n[n.RecursedCheck=4]="RecursedCheck",n[n.Recursed=8]="Recursed",n[n.Dirty=16]="Dirty",n[n.Pending=32]="Pending",n))(xn||{});function L2({update:n,notify:t,unwatched:a}){return{link:l,unlink:c,propagate:u,checkDirty:f,shallowPropagate:p};function l(m,S,g){const x=S.depsTail;if(x!==void 0&&x.dep===m)return;const j=x!==void 0?x.nextDep:S.deps;if(j!==void 0&&j.dep===m){j.version=g,S.depsTail=j;return}const k=m.subsTail;if(k!==void 0&&k.version===g&&k.sub===S)return;const E=S.depsTail=m.subsTail={version:g,dep:m,sub:S,prevDep:x,nextDep:j,prevSub:k,nextSub:void 0};j!==void 0&&(j.prevDep=E),x!==void 0?x.nextDep=E:S.deps=E,k!==void 0?k.nextSub=E:m.subs=E}function c(m,S=m.sub){const g=m.dep,x=m.prevDep,j=m.nextDep,k=m.nextSub,E=m.prevSub;return j!==void 0?j.prevDep=x:S.depsTail=x,x!==void 0?x.nextDep=j:S.deps=j,k!==void 0?k.prevSub=E:g.subsTail=E,E!==void 0?E.nextSub=k:(g.subs=k)===void 0&&a(g),j}function u(m){let S=m.nextSub,g;e:do{const x=m.sub;let j=x.flags;if(j&60?j&12?j&4?!(j&48)&&y(m,x)?(x.flags=j|40,j&=1):j=0:x.flags=j&-9|32:j=0:x.flags=j|32,j&2&&t(x),j&1){const k=x.subs;if(k!==void 0){const E=(m=k).nextSub;E!==void 0&&(g={value:S,prev:g},S=E);continue}}if((m=S)!==void 0){S=m.nextSub;continue}for(;g!==void 0;)if(m=g.value,g=g.prev,m!==void 0){S=m.nextSub;continue e}break}while(!0)}function f(m,S){let g,x=0,j=!1;e:do{const k=m.dep,E=k.flags;if(S.flags&16)j=!0;else if((E&17)===17){if(n(k)){const N=k.subs;N.nextSub!==void 0&&p(N),j=!0}}else if((E&33)===33){(m.nextSub!==void 0||m.prevSub!==void 0)&&(g={value:m,prev:g}),m=k.deps,S=k,++x;continue}if(!j){const N=m.nextDep;if(N!==void 0){m=N;continue}}for(;x--;){const N=S.subs,P=N.nextSub!==void 0;if(P?(m=g.value,g=g.prev):m=N,j){if(n(S)){P&&p(N),S=m.sub;continue}j=!1}else S.flags&=-33;S=m.sub;const H=m.nextDep;if(H!==void 0){m=H;continue e}}return j}while(!0)}function p(m){do{const S=m.sub,g=S.flags;(g&48)===32&&(S.flags=g|16,(g&6)===2&&t(S))}while((m=m.nextSub)!==void 0)}function y(m,S){let g=S.depsTail;for(;g!==void 0;){if(g===m)return!0;g=g.prevDep}return!1}}let i0=0,bl=0,Ou=0;const Ai=[],{link:UC,unlink:I2,propagate:$C,checkDirty:P9,shallowPropagate:HC}=L2({update(n){return n.depsTail!==void 0?$9(n):H9(n)},notify(n){var l;let t=Ou,a=t;do if(Ai[t++]=n,n.flags&=-3,n=(l=n.subs)==null?void 0:l.sub,n===void 0||!(n.flags&2))break;while(!0);for(Ou=t;a<--t;){const c=Ai[a];Ai[a++]=Ai[t],Ai[t]=c}},unwatched(n){n.flags&1?n.depsTail!==void 0&&(n.depsTail=void 0,n.flags=17,_h(n)):Q9.call(n)}});function z9(){return i0}function B9(){++i0}function U9(){--i0||F9()}function $9(n){n.depsTail=void 0,n.flags=5;try{const t=n.value;return t!==(n.value=n.getter(t))}finally{n.flags&=-5,_h(n)}}function H9(n){return n.flags=1,n.currentValue!==(n.currentValue=n.pendingValue)}function q9(n){const t=n.flags;if(t&16||t&32&&P9(n.deps,n)){n.depsTail=void 0,n.flags=6;try{n.fn()}finally{n.flags&=-5,_h(n)}}else n.flags=2}function F9(){try{for(;bl<Ou;){const n=Ai[bl];Ai[bl++]=void 0,q9(n)}}finally{for(;bl<Ou;){const n=Ai[bl];Ai[bl++]=void 0,n.flags|=10}bl=0,Ou=0}}function Q9(){this.depsTail=void 0,this.flags=0,_h(this);const n=this.subs;n!==void 0&&I2(n)}function _h(n){const t=n.depsTail;let a=t!==void 0?t.nextDep:n.deps;for(;a!==void 0;)a=I2(a,n)}function r0(n,t,a){var u,f,p;const l=typeof n=="object",c=l?n:void 0;return{next:(u=l?n.next:n)==null?void 0:u.bind(c),error:(f=l?n.error:t)==null?void 0:f.bind(c),complete:(p=l?n.complete:a)==null?void 0:p.bind(c)}}const w1=[];let $f=0;const{link:f6,unlink:G9,propagate:W9,checkDirty:P2,shallowPropagate:h6}=L2({update(n){return n._update()},notify(n){w1[k1++]=n,n.flags&=~xn.Watching},unwatched(n){n.depsTail!==void 0&&(n.depsTail=void 0,n.flags=xn.Mutable|xn.Dirty,Jf(n))}});let Af=0,k1=0,qa;function Jf(n){const t=n.depsTail;let a=t!==void 0?t.nextDep:n.deps;for(;a!==void 0;)a=G9(a,n)}function z2(){if(!(z9()>0)){for(;Af<k1;){const n=w1[Af];w1[Af++]=void 0,n.notify()}Af=0,k1=0}}function B2(n,t){const a=typeof n=="function",l=n,c={_snapshot:a?void 0:n,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:a?xn.None:xn.Mutable,get(){return qa!==void 0&&f6(c,qa,$f),c._snapshot},subscribe(u){const f=r0(u),p={current:!1},y=Y9(()=>{var m;c.get(),p.current?(m=f.next)==null||m.call(f,c._snapshot):p.current=!0});return{unsubscribe:()=>{y.stop()}}},_update(u){const f=qa,p=Object.is;if(a)qa=c,++$f,c.depsTail=void 0;else if(u===void 0)return!1;a&&(c.flags=xn.Mutable|xn.RecursedCheck);try{const y=c._snapshot,m=typeof u=="function"?u(y):u===void 0&&a?l(y):u;return y===void 0||!p(y,m)?(c._snapshot=m,!0):!1}finally{qa=f,a&&(c.flags&=~xn.RecursedCheck),Jf(c)}}};return a?(c.flags=xn.Mutable|xn.Dirty,c.get=function(){const u=c.flags;if(u&xn.Dirty||u&xn.Pending&&P2(c.deps,c)){if(c._update()){const f=c.subs;f!==void 0&&h6(f)}}else u&xn.Pending&&(c.flags=u&~xn.Pending);return qa!==void 0&&f6(c,qa,$f),c._snapshot}):c.set=function(u){if(c._update(u)){const f=c.subs;f!==void 0&&(W9(f),h6(f),z2())}},c}function Y9(n){const t=()=>{const l=qa;qa=a,++$f,a.depsTail=void 0,a.flags=xn.Watching|xn.RecursedCheck;try{return n()}finally{qa=l,a.flags&=~xn.RecursedCheck,Jf(a)}},a={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:xn.Watching|xn.RecursedCheck,notify(){const l=this.flags;l&xn.Dirty||l&xn.Pending&&P2(this.deps,this)?t():this.flags=xn.Watching},stop(){this.flags=xn.None,this.depsTail=void 0,Jf(this)}};return t(),a}class V9{constructor(t){this.atom=B2(t)}setState(t){this.atom.set(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(r0(t))}}class K9{constructor(t){this.atom=B2(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(r0(t))}}function Z9(n){return typeof n=="function"?new K9(n):new V9(n)}function X9(n){try{B9(),n()}finally{U9(),z2()}}function Lu(n){let t;return X9(()=>{t=n()}),t}var N1=n=>{var t;if(!n.rendered)return n.rendered=!0,(t=n.onReady)==null?void 0:t.call(n)},bh=(n,t)=>!!(n.preload&&!n.router.state.matches.some(a=>a.id===t)),zl=(n,t,a=!0)=>{const l={...n.router.options.context??{}},c=a?t:t-1;for(let u=0;u<=c;u++){const f=n.matches[u];if(!f)continue;const p=n.router.getMatch(f.id);p&&Object.assign(l,p.__routeContext,p.__beforeLoadContext)}return l},m6=(n,t)=>{if(!n.matches.length)return;const a=t.routeId,l=n.matches.findIndex(f=>f.routeId===n.router.routeTree.id),c=l>=0?l:0;let u=a?n.matches.findIndex(f=>f.routeId===a):n.firstBadMatchIndex??n.matches.length-1;u<0&&(u=c);for(let f=u;f>=0;f--){const p=n.matches[f];if(n.router.looseRoutesById[p.routeId].options.notFoundComponent)return f}return a?u:c},Ur=(n,t,a)=>{var l,c,u;if(!(!Qs(a)&&!Ns(a)))throw Qs(a)&&a.redirectHandled&&!a.options.reloadDocument||(t&&((l=t._nonReactive.beforeLoadPromise)==null||l.resolve(),(c=t._nonReactive.loaderPromise)==null||c.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=a,n.updateMatch(t.id,f=>({...f,status:Qs(a)?"redirected":f.status==="pending"?"success":f.status,context:zl(n,t.index),isFetching:!1,error:a})),Ns(a)&&!a.routeId&&(a.routeId=t.routeId),(u=t._nonReactive.loadPromise)==null||u.resolve()),Qs(a)&&(n.rendered=!0,a.options._fromLocation=n.location,a.redirectHandled=!0,a=n.router.resolveRedirect(a))),a},U2=(n,t)=>{const a=n.router.getMatch(t);return!!(!a||a._nonReactive.dehydrated)},p6=(n,t,a)=>{const l=zl(n,a);n.updateMatch(t,c=>({...c,context:l}))},pu=(n,t,a,l)=>{var p,y;const{id:c,routeId:u}=n.matches[t],f=n.router.looseRoutesById[u];if(a instanceof Promise)throw a;a.routerCode=l,n.firstBadMatchIndex??(n.firstBadMatchIndex=t),Ur(n,n.router.getMatch(c),a);try{(y=(p=f.options).onError)==null||y.call(p,a)}catch(m){a=m,Ur(n,n.router.getMatch(c),a)}n.updateMatch(c,m=>{var S,g;return(S=m._nonReactive.beforeLoadPromise)==null||S.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}}),!n.preload&&!Qs(a)&&!Ns(a)&&(n.serialError??(n.serialError=a))},$2=(n,t,a,l)=>{var u;if(l._nonReactive.pendingTimeout!==void 0)return;const c=a.options.pendingMs??n.router.options.defaultPendingMs;if(n.onReady&&!bh(n,t)&&(a.options.loader||a.options.beforeLoad||q2(a))&&typeof c=="number"&&c!==1/0&&(a.options.pendingComponent??((u=n.router.options)==null?void 0:u.defaultPendingComponent))){const f=setTimeout(()=>{N1(n)},c);l._nonReactive.pendingTimeout=f}},J9=(n,t,a)=>{const l=n.router.getMatch(t);if(!l._nonReactive.beforeLoadPromise&&!l._nonReactive.loaderPromise)return;$2(n,t,a,l);const c=()=>{const u=n.router.getMatch(t);u.preload&&(u.status==="redirected"||u.status==="notFound")&&Ur(n,u,u.error)};return l._nonReactive.beforeLoadPromise?l._nonReactive.beforeLoadPromise.then(c):c()},eb=(n,t,a,l)=>{const c=n.router.getMatch(t);let u=c._nonReactive.loadPromise;c._nonReactive.loadPromise=nc(()=>{u==null||u.resolve(),u=void 0});const{paramsError:f,searchError:p}=c;f&&pu(n,a,f,"PARSE_PARAMS"),p&&pu(n,a,p,"VALIDATE_SEARCH"),$2(n,t,l,c);const y=new AbortController;let m=!1;const S=()=>{m||(m=!0,n.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,n.updateMatch(t,q=>({...q,isFetching:!1}))};if(!l.options.beforeLoad){Lu(()=>{S(),g()});return}c._nonReactive.beforeLoadPromise=nc();const x={...zl(n,a,!1),...c.__routeContext},{search:j,params:k,cause:E}=c,N=bh(n,t),P={search:j,abortController:y,params:k,preload:N,context:x,location:n.location,navigate:R=>n.router.navigate({...R,_fromLocation:n.location}),buildLocation:n.router.buildLocation,cause:N?"preload":E,matches:n.matches,routeId:l.id,...n.router.options.additionalContext},H=R=>{if(R===void 0){Lu(()=>{S(),g()});return}(Qs(R)||Ns(R))&&(S(),pu(n,a,R,"BEFORE_LOAD")),Lu(()=>{S(),n.updateMatch(t,q=>({...q,__beforeLoadContext:R})),g()})};let U;try{if(U=l.options.beforeLoad(P),Uu(U))return S(),U.catch(R=>{pu(n,a,R,"BEFORE_LOAD")}).then(H)}catch(R){S(),pu(n,a,R,"BEFORE_LOAD")}H(U)},tb=(n,t)=>{const{id:a,routeId:l}=n.matches[t],c=n.router.looseRoutesById[l],u=()=>p(),f=()=>eb(n,a,t,c),p=()=>{if(U2(n,a))return;const y=J9(n,a,c);return Uu(y)?y.then(f):f()};return u()},nb=(n,t,a)=>{var u,f,p,y,m,S;const l=n.router.getMatch(t);if(!l||!a.options.head&&!a.options.scripts&&!a.options.headers)return;const c={ssr:n.router.options.ssr,matches:n.matches,match:l,params:l.params,loaderData:l.loaderData};return Promise.all([(f=(u=a.options).head)==null?void 0:f.call(u,c),(y=(p=a.options).scripts)==null?void 0:y.call(p,c),(S=(m=a.options).headers)==null?void 0:S.call(m,c)]).then(([g,x,j])=>({meta:g==null?void 0:g.meta,links:g==null?void 0:g.links,headScripts:g==null?void 0:g.scripts,headers:j,scripts:x,styles:g==null?void 0:g.styles}))},H2=(n,t,a,l,c)=>{const u=t[l-1],{params:f,loaderDeps:p,abortController:y,cause:m}=n.router.getMatch(a),S=zl(n,l),g=bh(n,a);return{params:f,deps:p,preload:!!g,parentMatchPromise:u,abortController:y,context:S,location:n.location,navigate:x=>n.router.navigate({...x,_fromLocation:n.location}),cause:g?"preload":m,route:c,...n.router.options.additionalContext}},g6=async(n,t,a,l,c)=>{var u,f,p,y,m;try{const S=n.router.getMatch(a);try{(!(J5??n.router.isServer)||S.ssr===!0)&&$u(c);const g=c.options.loader,x=typeof g=="function"?g:g==null?void 0:g.handler,j=x==null?void 0:x(H2(n,t,a,l,c)),k=!!x&&Uu(j);if((k||c._lazyPromise||c._componentsPromise||c.options.head||c.options.scripts||c.options.headers||S._nonReactive.minPendingPromise)&&n.updateMatch(a,N=>({...N,isFetching:"loader"})),x){const N=k?await j:j;Ur(n,n.router.getMatch(a),N),N!==void 0&&n.updateMatch(a,P=>({...P,loaderData:N}))}c._lazyPromise&&await c._lazyPromise;const E=S._nonReactive.minPendingPromise;E&&await E,c._componentsPromise&&await c._componentsPromise,n.updateMatch(a,N=>({...N,error:void 0,context:zl(n,l),status:"success",isFetching:!1,updatedAt:Date.now()}))}catch(g){let x=g;if((x==null?void 0:x.name)==="AbortError"){if(S.abortController.signal.aborted){(u=S._nonReactive.loaderPromise)==null||u.resolve(),S._nonReactive.loaderPromise=void 0;return}n.updateMatch(a,k=>({...k,status:k.status==="pending"?"success":k.status,isFetching:!1,context:zl(n,l)}));return}const j=S._nonReactive.minPendingPromise;j&&await j,Ns(g)&&await((p=(f=c.options.notFoundComponent)==null?void 0:f.preload)==null?void 0:p.call(f)),Ur(n,n.router.getMatch(a),g);try{(m=(y=c.options).onError)==null||m.call(y,g)}catch(k){x=k,Ur(n,n.router.getMatch(a),k)}!Qs(x)&&!Ns(x)&&await $u(c,["errorComponent"]),n.updateMatch(a,k=>({...k,error:x,context:zl(n,l),status:"error",isFetching:!1}))}}catch(S){const g=n.router.getMatch(a);g&&(g._nonReactive.loaderPromise=void 0),Ur(n,g,S)}},sb=async(n,t,a)=>{var j,k,E,N;async function l(P,H,U,R,q){const re=Date.now()-H.updatedAt,V=P?q.options.preloadStaleTime??n.router.options.defaultPreloadStaleTime??3e4:q.options.staleTime??n.router.options.defaultStaleTime??0,ee=q.options.shouldReload,Z=typeof ee=="function"?ee(H2(n,t,c,a,q)):ee,{status:W,invalid:F}=R,be=re>V&&(!!n.forceStaleReload||R.cause==="enter"||U!==void 0&&U!==R.id);f=W==="success"&&(F||(Z??be)),P&&q.options.preload===!1||(f&&!n.sync&&S?(p=!0,(async()=>{var pe,Y;try{await g6(n,t,c,a,q);const ne=n.router.getMatch(c);(pe=ne._nonReactive.loaderPromise)==null||pe.resolve(),(Y=ne._nonReactive.loadPromise)==null||Y.resolve(),ne._nonReactive.loaderPromise=void 0,ne._nonReactive.loadPromise=void 0}catch(ne){Qs(ne)&&await n.router.navigate(ne.options)}})()):W!=="success"||f?await g6(n,t,c,a,q):p6(n,c,a))}const{id:c,routeId:u}=n.matches[a];let f=!1,p=!1;const y=n.router.looseRoutesById[u],m=y.options.loader,S=((typeof m=="function"||m==null?void 0:m.staleReloadMode)??n.router.options.defaultStaleReloadMode)!=="blocking";if(U2(n,c)){if(!n.router.getMatch(c))return n.matches[a];p6(n,c,a)}else{const P=n.router.getMatch(c),H=((j=n.router.state.matches[a])==null?void 0:j.routeId)===u?n.router.state.matches[a].id:(k=n.router.state.matches.find(R=>R.routeId===u))==null?void 0:k.id,U=bh(n,c);if(P._nonReactive.loaderPromise){if(P.status==="success"&&!n.sync&&!P.preload&&S)return P;await P._nonReactive.loaderPromise;const R=n.router.getMatch(c),q=R._nonReactive.error||R.error;q&&Ur(n,R,q),R.status==="pending"&&await l(U,P,H,R,y)}else{const R=U&&!n.router.state.matches.some(re=>re.id===c),q=n.router.getMatch(c);q._nonReactive.loaderPromise=nc(),R!==q.preload&&n.updateMatch(c,re=>({...re,preload:R})),await l(U,P,H,q,y)}}const g=n.router.getMatch(c);p||((E=g._nonReactive.loaderPromise)==null||E.resolve(),(N=g._nonReactive.loadPromise)==null||N.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 x=p?g.isFetching:!1;return x!==g.isFetching||g.invalid!==!1?(n.updateMatch(c,P=>({...P,isFetching:x,invalid:!1})),n.router.getMatch(c)):g};async function y6(n){var x,j;const t=n,a=[];t.router.state.matches.some(k=>k._forcePending)&&N1(t);let l;for(let k=0;k<t.matches.length;k++){try{const E=tb(t,k);Uu(E)&&await E}catch(E){if(Qs(E))throw E;if(Ns(E))l=E;else if(!t.preload)throw E;break}if(t.serialError)break}const c=t.firstBadMatchIndex??t.matches.length,u=l&&!t.preload?m6(t,l):void 0,f=l&&t.preload?0:u!==void 0?Math.min(u+1,c):c;let p,y;for(let k=0;k<f;k++)a.push(sb(t,a,k));try{await Promise.all(a)}catch{const k=await Promise.allSettled(a);for(const E of k){if(E.status!=="rejected")continue;const N=E.reason;if(Qs(N))throw N;Ns(N)?p??(p=N):y??(y=N)}if(y!==void 0)throw y}const m=p??(l&&!t.preload?l:void 0);let S=t.serialError?t.firstBadMatchIndex??0:t.matches.length-1;if(!m&&l&&t.preload)return t.matches;if(m){const k=m6(t,m);Wr(k!==void 0);const E=t.matches[k],N=t.router.looseRoutesById[E.routeId],P=(x=t.router.options)==null?void 0:x.defaultNotFoundComponent;!N.options.notFoundComponent&&P&&(N.options.notFoundComponent=P),m.routeId=E.routeId;const H=E.routeId===t.router.routeTree.id;t.updateMatch(E.id,U=>({...U,...H?{status:"success",globalNotFound:!0,error:void 0}:{status:"notFound",error:m},isFetching:!1})),S=k,await $u(N,["notFoundComponent"])}else if(!t.preload){const k=t.matches[0];k.globalNotFound||(j=t.router.getMatch(k.id))!=null&&j.globalNotFound&&t.updateMatch(k.id,E=>({...E,globalNotFound:!1,error:void 0}))}if(t.serialError&&t.firstBadMatchIndex!==void 0){const k=t.router.looseRoutesById[t.matches[t.firstBadMatchIndex].routeId];await $u(k,["errorComponent"])}for(let k=0;k<=S;k++){const{id:E,routeId:N}=t.matches[k],P=t.router.looseRoutesById[N];try{const H=nb(t,E,P);if(H){const U=await H;t.updateMatch(E,R=>({...R,...U}))}}catch(H){console.error(`Error executing head for route ${N}:`,H)}}const g=N1(t);if(Uu(g)&&await g,m)throw m;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function v6(n,t){const a=t.map(l=>{var c,u;return(u=(c=n.options[l])==null?void 0:c.preload)==null?void 0:u.call(c)}).filter(Boolean);if(a.length!==0)return Promise.all(a)}function $u(n,t=Hf){!n._lazyLoaded&&n._lazyPromise===void 0&&(n.lazyFn?n._lazyPromise=n.lazyFn().then(l=>{const{id:c,...u}=l.options;Object.assign(n.options,u),n._lazyLoaded=!0,n._lazyPromise=void 0}):n._lazyLoaded=!0);const a=()=>n._componentsLoaded?void 0:t===Hf?(()=>{if(n._componentsPromise===void 0){const l=v6(n,Hf);l?n._componentsPromise=l.then(()=>{n._componentsLoaded=!0,n._componentsPromise=void 0}):n._componentsLoaded=!0}return n._componentsPromise})():v6(n,t);return n._lazyPromise?n._lazyPromise.then(a):a()}function q2(n){var t;for(const a of Hf)if((t=n.options[a])!=null&&t.preload)return!0;return!1}var Hf=["component","errorComponent","pendingComponent","notFoundComponent"],Fr="__TSR_index",_6="popstate",b6="beforeunload";function ab(n){let t=n.getLocation();const a=new Set,l=f=>{t=n.getLocation(),a.forEach(p=>p({location:t,action:f}))},c=f=>{n.notifyOnIndexChange??!0?l(f):t=n.getLocation()},u=async({task:f,navigateOpts:p,...y})=>{var g,x;if((p==null?void 0:p.ignoreBlocker)??!1){f();return}const m=((g=n.getBlockers)==null?void 0:g.call(n))??[],S=y.type==="PUSH"||y.type==="REPLACE";if(typeof document<"u"&&m.length&&S)for(const j of m){const k=eh(y.path,y.state);if(await j.blockerFn({currentLocation:t,nextLocation:k,action:y.type})){(x=n.onBlocked)==null||x.call(n);return}}f()};return{get location(){return t},get length(){return n.getLength()},subscribers:a,subscribe:f=>(a.add(f),()=>{a.delete(f)}),push:(f,p,y)=>{const m=t.state[Fr];p=x6(m+1,p),u({task:()=>{n.pushState(f,p),l({type:"PUSH"})},navigateOpts:y,type:"PUSH",path:f,state:p})},replace:(f,p,y)=>{const m=t.state[Fr];p=x6(m,p),u({task:()=>{n.replaceState(f,p),l({type:"REPLACE"})},navigateOpts:y,type:"REPLACE",path:f,state:p})},go:(f,p)=>{u({task:()=>{n.go(f),c({type:"GO",index:f})},navigateOpts:p,type:"GO"})},back:f=>{u({task:()=>{n.back((f==null?void 0:f.ignoreBlocker)??!1),c({type:"BACK"})},navigateOpts:f,type:"BACK"})},forward:f=>{u({task:()=>{n.forward((f==null?void 0:f.ignoreBlocker)??!1),c({type:"FORWARD"})},navigateOpts:f,type:"FORWARD"})},canGoBack:()=>t.state[Fr]!==0,createHref:f=>n.createHref(f),block:f=>{var y;if(!n.setBlockers)return()=>{};const p=((y=n.getBlockers)==null?void 0:y.call(n))??[];return n.setBlockers([...p,f]),()=>{var S,g;const m=((S=n.getBlockers)==null?void 0:S.call(n))??[];(g=n.setBlockers)==null||g.call(n,m.filter(x=>x!==f))}},flush:()=>{var f;return(f=n.flush)==null?void 0:f.call(n)},destroy:()=>{var f;return(f=n.destroy)==null?void 0:f.call(n)},notify:l}}function x6(n,t){t||(t={});const a=l0();return{...t,key:a,__TSR_key:a,[Fr]:n}}function ib(n){var ee,Z;const t=typeof document<"u"?window:void 0,a=t.history.pushState,l=t.history.replaceState;let c=[];const u=()=>c,f=W=>c=W,p=(W=>W),y=(()=>eh(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!((ee=t.history.state)!=null&&ee.__TSR_key)&&!((Z=t.history.state)!=null&&Z.key)){const W=l0();t.history.replaceState({[Fr]:0,key:W,__TSR_key:W},"")}let m=y(),S,g=!1,x=!1,j=!1,k=!1;const E=()=>m;let N,P;const H=()=>{N&&(V._ignoreSubscribers=!0,(N.isPush?t.history.pushState:t.history.replaceState)(N.state,"",N.href),V._ignoreSubscribers=!1,N=void 0,P=void 0,S=void 0)},U=(W,F,be)=>{const pe=p(F);P||(S=m),m=eh(F,be),N={href:pe,state:be,isPush:(N==null?void 0:N.isPush)||W==="push"},P||(P=Promise.resolve().then(()=>H()))},R=W=>{m=y(),V.notify({type:W})},q=async()=>{if(x){x=!1;return}const W=y(),F=W.state[Fr]-m.state[Fr],be=F===1,pe=F===-1,Y=!be&&!pe||g;g=!1;const ne=Y?"GO":pe?"BACK":"FORWARD",T=Y?{type:"GO",index:F}:{type:pe?"BACK":"FORWARD"};if(j)j=!1;else{const $=u();if(typeof document<"u"&&$.length){for(const ue of $)if(await ue.blockerFn({currentLocation:m,nextLocation:W,action:ne})){x=!0,t.history.go(1),V.notify(T);return}}}m=y(),V.notify(T)},re=W=>{if(k){k=!1;return}let F=!1;const be=u();if(typeof document<"u"&&be.length)for(const pe of be){const Y=pe.enableBeforeUnload??!0;if(Y===!0){F=!0;break}if(typeof Y=="function"&&Y()===!0){F=!0;break}}if(F)return W.preventDefault(),W.returnValue=""},V=ab({getLocation:E,getLength:()=>t.history.length,pushState:(W,F)=>U("push",W,F),replaceState:(W,F)=>U("replace",W,F),back:W=>(W&&(j=!0),k=!0,t.history.back()),forward:W=>{W&&(j=!0),k=!0,t.history.forward()},go:W=>{g=!0,t.history.go(W)},createHref:W=>p(W),flush:H,destroy:()=>{t.history.pushState=a,t.history.replaceState=l,t.removeEventListener(b6,re,{capture:!0}),t.removeEventListener(_6,q)},onBlocked:()=>{S&&m!==S&&(m=S)},getBlockers:u,setBlockers:f,notifyOnIndexChange:!1});return t.addEventListener(b6,re,{capture:!0}),t.addEventListener(_6,q),t.history.pushState=function(...W){const F=a.apply(t.history,W);return V._ignoreSubscribers||R("PUSH"),F},t.history.replaceState=function(...W){const F=l.apply(t.history,W);return V._ignoreSubscribers||R("REPLACE"),F},V}function rb(n){let t=n.replace(/[\x00-\x1f\x7f]/g,"");return t.startsWith("//")&&(t="/"+t.replace(/^\/+/,"")),t}function eh(n,t){const a=rb(n),l=a.indexOf("#"),c=a.indexOf("?"),u=l0();return{href:a,pathname:a.substring(0,l>0?c>0?Math.min(l,c):l:c>0?c:a.length),hash:l>-1?a.substring(l):"",search:c>-1?a.slice(c,l===-1?void 0:l):"",state:t||{[Fr]:0,key:u,__TSR_key:u}}}function l0(){return(Math.random()+1).toString(36).substring(7)}function Bl(n){const t=n.resolvedLocation,a=n.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 lb(n){const t=n.filter(a=>a.status!=="redirected");return t.length===n.length?n:t}var ob=class{constructor(n){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,l=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=_9(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=ib()),this.origin=this.options.origin,this.origin||(window!=null&&window.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let S;this.resolvePathCache=Kf(1e3),S=this.buildRouteTree(),this.setRoutes(S)}!this.__store&&this.latestLocation&&(this.__store=Z9(ub(this.latestLocation)),N9(this));let f=!1;const p=this.options.basepath??"/",y=this.options.rewrite;if(c||l!==p||u!==y){this.basepath=p;const S=[],g=D2(p);g&&g!=="/"&&S.push(I9({basepath:p})),y&&S.push(y),this.rewrite=S.length===0?void 0:S.length===1?S[0]:L9(S),this.history&&this.updateLatestLocation(),f=!0}f&&this.__store&&this.__store.setState(S=>({...S,location:this.latestLocation})),typeof window<"u"&&"CSS"in window&&typeof((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=h9(this.routeTree,this.options.caseSensitive,(a,l)=>{a.init({originalIndex:l})});return this.options.routeMasks&&o9(this.options.routeMasks,t.processedTree),t},this.subscribe=(t,a)=>{const l={eventType:t,fn:a};return this.subscribers.add(l),()=>{this.subscribers.delete(l)}},this.emit=t=>{this.subscribers.forEach(a=>{a.eventType===t.type&&a.fn(t)})},this.parseLocation=(t,a)=>{const l=({pathname:p,search:y,hash:m,href:S,state:g})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(p)){const N=this.options.parseSearch(y),P=this.options.stringifySearch(N);return{href:p+P+m,publicHref:S,pathname:hu(p).path,external:!1,searchStr:P,search:_l(a==null?void 0:a.search,N),hash:hu(m.slice(1)).path,state:wl(a==null?void 0:a.state,g)}}const x=new URL(S,this.origin),j=j1(this.rewrite,x),k=this.options.parseSearch(j.search),E=this.options.stringifySearch(k);return j.search=E,{href:j.href.replace(j.origin,""),publicHref:S,pathname:hu(j.pathname).path,external:!!this.rewrite&&j.origin!==this.origin,searchStr:E,search:_l(a==null?void 0:a.search,k),hash:hu(j.hash.slice(1)).path,state:wl(a==null?void 0:a.state,g)}},c=l(t),{__tempLocation:u,__tempKey:f}=c.state;if(u&&(!f||f===this.tempLocationKey)){const p=l(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)=>v9({base:t,to:a0(a),trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(t,a,l)=>typeof t=="string"?this.matchRoutesInternal({pathname:t,search:a},l):this.matchRoutesInternal(t,a),this.getMatchedRoutes=t=>db({pathname:t,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=t=>{const a=this.getMatch(t);a&&(a.abortController.abort(),clearTimeout(a._nonReactive.pendingTimeout),a._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{const t=this.state.matches.filter(l=>l.status==="pending"),a=this.state.matches.filter(l=>l.isFetching==="loader");new Set([...this.state.pendingMatches??[],...t,...a]).forEach(l=>{this.cancelMatch(l.id)})},this.buildLocation=t=>{const a=(c={})=>{var Z,W;const u=c._fromLocation||this.pendingBuiltLocation||this.latestLocation,f=this.matchRoutesLightweight(u);c.from;const p=c.unsafeRelative==="path"?u.pathname:c.from??f.fullPath,y=this.resolvePathWithBase(p,"."),m=f.search,S=Object.assign(Object.create(null),f.params),g=c.to?this.resolvePathWithBase(y,`${c.to}`):this.resolvePathWithBase(y,"."),x=c.params===!1||c.params===null?Object.create(null):(c.params??!0)===!0?S:Object.assign(S,Br(c.params,S)),j=this.getMatchedRoutes(g);let k=j.matchedRoutes;if((!j.foundRoute||j.foundRoute.path!=="/"&&j.routeParams["**"])&&this.options.notFoundRoute&&(k=[...k,this.options.notFoundRoute]),Object.keys(x).length>0)for(const F of k){const be=((Z=F.options.params)==null?void 0:Z.stringify)??F.options.stringifyParams;if(be)try{Object.assign(x,be(x))}catch{}}const E=t.leaveParams?g:hu(u6({path:g,params:x,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path;let N=m;if(t._includeValidateSearch&&((W=this.options.search)!=null&&W.strict)){const F={};k.forEach(be=>{if(be.options.validateSearch)try{Object.assign(F,qf(be.options.validateSearch,{...F,...N}))}catch{}}),N=F}N=fb({search:N,dest:c,destRoutes:k,_includeValidateSearch:t._includeValidateSearch}),N=_l(m,N);const P=this.options.stringifySearch(N),H=c.hash===!0?u.hash:c.hash?Br(c.hash,u.hash):void 0,U=H?`#${H}`:"";let R=c.state===!0?u.state:c.state?Br(c.state,u.state):{};R=wl(u.state,R);const q=`${E}${P}${U}`;let re,V,ee=!1;if(this.rewrite){const F=new URL(q,this.origin),be=O2(this.rewrite,F);re=F.href.replace(F.origin,""),be.origin!==this.origin?(V=be.href,ee=!0):V=be.pathname+be.search+be.hash}else re=i9(q),V=re;return{publicHref:V,href:re,pathname:E,search:N,searchStr:P,state:R,hash:H??"",external:ee,unmaskOnReload:c.unmaskOnReload}},l=(c={},u)=>{const f=a(c);let p=u?a(u):void 0;if(!p){const y=Object.create(null);if(this.options.routeMasks){const m=c9(f.pathname,this.processedTree);if(m){Object.assign(y,m.rawParams);const{from:S,params:g,...x}=m.route,j=g===!1||g===null?Object.create(null):(g??!0)===!0?y:Object.assign(y,Br(g,y));u={from:t.from,...x,params:j},p=a(u)}}}return p&&(f.maskedLocation=p),f};return t.mask?l(t,{from:t.from,...t.mask}):l(t)},this.commitLocation=async({viewTransition:t,ignoreBlocker:a,...l})=>{const c=()=>{const p=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];p.forEach(m=>{l.state[m]=this.latestLocation.state[m]});const y=Il(l.state,this.latestLocation.state);return p.forEach(m=>{delete l.state[m]}),y},u=qr(this.latestLocation.href)===qr(l.href);let f=this.commitLocationPromise;if(this.commitLocationPromise=nc(()=>{f==null||f.resolve(),f=void 0}),u&&c())this.load();else{let{maskedLocation:p,hashScrollIntoView:y,...m}=l;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[l.replace?"replace":"push"](m.publicHref,m.state,{ignoreBlocker:a})}return this.resetNextScroll=l.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:t,resetScroll:a,hashScrollIntoView:l,viewTransition:c,ignoreBlocker:u,href:f,...p}={})=>{if(f){const S=this.history.location.state.__TSR_index,g=eh(f,{__TSR_index:t?S:S+1}),x=new URL(g.pathname,this.origin);p.to=j1(this.rewrite,x).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:l,ignoreBlocker:u});return Promise.resolve().then(()=>{this.pendingBuiltLocation===y&&(this.pendingBuiltLocation=void 0)}),m},this.navigate=async({to:t,reloadDocument:a,href:l,publicHref:c,...u})=>{var p,y;let f=!1;if(l)try{new URL(`${l}`),f=!0}catch{}if(f&&!a&&(a=!0),a){if(t!==void 0||!l){const S=this.buildLocation({to:t,...u});l=l??S.publicHref,c=c??S.publicHref}const m=!f&&c?c:l;if(Vf(m,this.protocolAllowlist))return Promise.resolve();if(!u.ignoreBlocker){const S=((y=(p=this.history).getBlockers)==null?void 0:y.call(p))??[];for(const g of S)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:l,to:t,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();const t=this.matchRoutes(this.latestLocation);this.__store.setState(a=>({...a,status:"pending",statusCode:200,isLoading:!0,location:this.latestLocation,pendingMatches:t,cachedMatches:a.cachedMatches.filter(l=>!t.some(c=>c.id===l.id))}))},this.load=async t=>{let a,l,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,S=this.state.resolvedLocation;this.state.redirect||this.emit({type:"onBeforeNavigate",...Bl({resolvedLocation:S,location:m})}),this.emit({type:"onBeforeLoad",...Bl({resolvedLocation:S,location:m})}),await y6({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=[],x=[],j=[],k=[];Lu(()=>{this.__store.setState(E=>{const N=E.matches,P=E.pendingMatches||E.matches;return g=N.filter(H=>!P.some(U=>U.id===H.id)),x=N.filter(H=>!P.some(U=>U.routeId===H.routeId)),j=P.filter(H=>!N.some(U=>U.routeId===H.routeId)),k=P.filter(H=>N.some(U=>U.routeId===H.routeId)),{...E,isLoading:!1,loadedAt:Date.now(),matches:P,pendingMatches:void 0,cachedMatches:[...E.cachedMatches,...g.filter(H=>H.status!=="error"&&H.status!=="notFound"&&H.status!=="redirected")]}}),this.clearExpiredCache()}),[[x,"onLeave"],[j,"onEnter"],[k,"onStay"]].forEach(([E,N])=>{E.forEach(P=>{var H,U;(U=(H=this.looseRoutesById[P.routeId].options)[N])==null||U.call(H,P)})})})})}})}catch(m){Qs(m)?(a=m,this.navigate({...a.options,replace:!0,ignoreBlocker:!0})):Ns(m)&&(l=m),this.__store.setState(S=>({...S,statusCode:a?a.status:l?404:S.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 f;this.hasNotFoundMatch()?f=404:this.__store.state.matches.some(p=>p.status==="error")&&(f=500),f!==void 0&&this.__store.setState(p=>({...p,statusCode:f}))},this.startViewTransition=t=>{const a=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,a&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let l;if(typeof a=="object"&&this.isViewTransitionTypesSupported){const c=this.latestLocation,u=this.state.resolvedLocation,f=typeof a.types=="function"?a.types(Bl({resolvedLocation:u,location:c})):a.types;if(f===!1){t();return}l={update:t,types:f}}else l=t;document.startViewTransition(l)}else t()},this.updateMatch=(t,a)=>{this.startTransition(()=>{var c;const l=(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":"";l&&(l==="cachedMatches"?this.__store.setState(u=>({...u,cachedMatches:lb(u.cachedMatches.map(f=>f.id===t?a(f):f))})):this.__store.setState(u=>{var f;return{...u,[l]:(f=u[l])==null?void 0:f.map(p=>p.id===t?a(p):p)}}))})},this.getMatch=t=>{var l;const a=c=>c.id===t;return this.state.cachedMatches.find(a)??((l=this.state.pendingMatches)==null?void 0:l.find(a))??this.state.matches.find(a)},this.invalidate=t=>{const a=l=>{var c;return((c=t==null?void 0:t.filter)==null?void 0:c.call(t,l))??!0?{...l,invalid:!0,...t!=null&&t.forcePending||l.status==="error"||l.status==="notFound"?{status:"pending",error:void 0}:void 0}:l};return this.__store.setState(l=>{var c;return{...l,matches:l.matches.map(a),cachedMatches:l.cachedMatches.map(a),pendingMatches:(c=l.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 l=t.options._builtLocation??this.buildLocation(t.options),c=this.getParsedLocationHref(l);t.options.href=c,t.headers.set("Location",c)}else if(a)try{const l=new URL(a);if(this.origin&&l.origin===this.origin){const c=l.pathname+l.search+l.hash;t.options.href=c,t.headers.set("Location",c)}}catch{}if(t.options.href&&!t.options._builtLocation&&Vf(t.options.href,this.protocolAllowlist))throw new Error("Redirect blocked: unsafe protocol");return t.headers.get("Location")||t.headers.set("Location",t.options.href),t},this.clearCache=t=>{const a=t==null?void 0:t.filter;a!==void 0?this.__store.setState(l=>({...l,cachedMatches:l.cachedMatches.filter(c=>!a(c))})):this.__store.setState(l=>({...l,cachedMatches:[]}))},this.clearExpiredCache=()=>{const t=a=>{const l=this.looseRoutesById[a.routeId];if(!l.options.loader)return!0;const c=(a.preload?l.options.preloadGcTime??this.options.defaultPreloadGcTime:l.options.gcTime??this.options.defaultGcTime)??300*1e3;return a.status==="error"?!0:Date.now()-a.updatedAt>=c};this.clearCache({filter:t})},this.loadRouteChunk=$u,this.preloadRoute=async t=>{const a=t._builtLocation??this.buildLocation(t);let l=this.matchRoutes(a,{throwOnError:!0,preload:!0,dest:t});const c=new Set([...this.state.matches,...this.state.pendingMatches??[]].map(f=>f.id)),u=new Set([...c,...this.state.cachedMatches.map(f=>f.id)]);Lu(()=>{l.forEach(f=>{u.has(f.id)||this.__store.setState(p=>({...p,cachedMatches:[...p.cachedMatches,f]}))})});try{return l=await y6({router:this,matches:l,location:a,preload:!0,updateMatch:(f,p)=>{c.has(f)?l=l.map(y=>y.id===f?p(y):y):this.updateMatch(f,p)}}),l}catch(f){if(Qs(f))return f.options.reloadDocument?void 0:await this.preloadRoute({...f.options,_fromLocation:a});Ns(f)||console.error(f);return}},this.matchRoute=(t,a)=>{const l={...t,to:t.to?this.resolvePathWithBase(t.from||"",t.to):void 0,params:t.params||{},leaveParams:!0},c=this.buildLocation(l);if(a!=null&&a.pending&&this.state.status!=="pending")return!1;const u=((a==null?void 0:a.pending)===void 0?!this.state.isLoading:a.pending)?this.latestLocation:this.state.resolvedLocation||this.state.location,f=u9(c.pathname,(a==null?void 0:a.caseSensitive)??!1,(a==null?void 0:a.fuzzy)??!1,u.pathname,this.processedTree);return!f||t.params&&!Il(f.rawParams,t.params,{partial:!0})?!1:(a==null?void 0:a.includeSearch)??!0?Il(u.search,c.search,{partial:!0})?f.rawParams:!1:f.rawParams},this.hasNotFoundMatch=()=>this.__store.state.matches.some(t=>t.status==="notFound"||t.globalNotFound),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...n,caseSensitive:n.caseSensitive??!1,notFoundMode:n.notFoundMode??"fuzzy",stringifySearch:n.stringifySearch??R9,parseSearch:n.parseSearch??M9,protocolAllowlist:n.protocolAllowlist??a9}),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:n,routesByPath:t,processedTree:a}){this.routesById=n,this.routesByPath=t,this.processedTree=a;const l=this.options.notFoundRoute;l&&(l.init({originalIndex:99999999999}),this.routesById[l.id]=l)}get looseRoutesById(){return this.routesById}getParentContext(n){return n!=null&&n.id?n.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(n,t){var g,x;const a=this.getMatchedRoutes(n.pathname),{foundRoute:l,routeParams:c,parsedParams:u}=a;let{matchedRoutes:f}=a,p=!1;(l?l.path!=="/"&&c["**"]:qr(n.pathname))&&(this.options.notFoundRoute?f=[...f,this.options.notFoundRoute]:p=!0);const y=p?mb(this.options.notFoundMode,f):void 0,m=new Array(f.length),S=new Map(this.state.matches.map(j=>[j.routeId,j]));for(let j=0;j<f.length;j++){const k=f[j],E=m[j-1];let N,P,H;{const ne=(E==null?void 0:E.search)??n.search,T=(E==null?void 0:E._strictSearch)??void 0;try{const $=qf(k.options.validateSearch,{...ne})??void 0;N={...ne,...$},P={...T,...$},H=void 0}catch($){let ue=$;if($ instanceof th||(ue=new th($.message,{cause:$})),t!=null&&t.throwOnError)throw ue;N=ne,P={},H=ue}}const U=((x=(g=k.options).loaderDeps)==null?void 0:x.call(g,{search:N}))??"",R=U?JSON.stringify(U):"",{interpolatedPath:q,usedParams:re}=u6({path:k.fullPath,params:c,decoder:this.pathParamsDecoder,server:this.isServer}),V=k.id+q+R,ee=this.getMatch(V),Z=S.get(k.id),W=(ee==null?void 0:ee._strictParams)??re;let F;if(!ee)try{S6(k,re,u,W)}catch(ne){if(Ns(ne)||Qs(ne)?F=ne:F=new cb(ne.message,{cause:ne}),t!=null&&t.throwOnError)throw F}Object.assign(c,W);const be=Z?"stay":"enter";let pe;if(ee)pe={...ee,cause:be,params:(Z==null?void 0:Z.params)??c,_strictParams:W,search:_l(Z?Z.search:ee.search,N),_strictSearch:P};else{const ne=k.options.loader||k.options.beforeLoad||k.lazyFn||q2(k)?"pending":"success";pe={id:V,ssr:k.options.ssr,index:j,routeId:k.id,params:(Z==null?void 0:Z.params)??c,_strictParams:W,pathname:q,updatedAt:Date.now(),search:Z?_l(Z.search,N):N,_strictSearch:P,searchError:void 0,status:ne,isFetching:!1,error:void 0,paramsError:F,__routeContext:void 0,_nonReactive:{loadPromise:nc()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:be,loaderDeps:Z?wl(Z.loaderDeps,U):U,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:k.options.staticData||{},fullPath:k.fullPath}}t!=null&&t.preload||(pe.globalNotFound=y===k.id),pe.searchError=H;const Y=this.getParentContext(E);pe.context={...Y,...pe.__routeContext,...pe.__beforeLoadContext},m[j]=pe}for(let j=0;j<m.length;j++){const k=m[j],E=this.looseRoutesById[k.routeId],N=this.getMatch(k.id),P=S.get(k.routeId);if(k.params=P?_l(P.params,c):c,!N){const H=m[j-1],U=this.getParentContext(H);if(E.options.context){const R={deps:k.loaderDeps,params:k.params,context:U??{},location:n,navigate:q=>this.navigate({...q,_fromLocation:n}),buildLocation:this.buildLocation,cause:k.cause,abortController:k.abortController,preload:!!k.preload,matches:m,routeId:E.id};k.__routeContext=E.options.context(R)??void 0}k.context={...U,...k.__routeContext,...k.__beforeLoadContext}}}return m}matchRoutesLightweight(n){const{matchedRoutes:t,routeParams:a,parsedParams:l}=this.getMatchedRoutes(n.pathname),c=Bu(t),u={...n.search};for(const m of t)try{Object.assign(u,qf(m.options.validateSearch,u))}catch{}const f=Bu(this.state.matches),p=f&&f.routeId===c.id&&n.pathname===this.state.location.pathname;let y;if(p)y=f.params;else{const m=Object.assign(Object.create(null),a);for(const S of t)try{S6(S,a,l??{},m)}catch{}y=m}return{matchedRoutes:t,fullPath:c.fullPath,search:u,params:y}}},th=class extends Error{},cb=class extends Error{};function ub(n){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:n,matches:[],pendingMatches:[],cachedMatches:[],statusCode:200}}function qf(n,t){if(n==null)return{};if("~standard"in n){const a=n["~standard"].validate(t);if(a instanceof Promise)throw new th("Async validation not supported");if(a.issues)throw new th(JSON.stringify(a.issues,void 0,2),{cause:a});return a.value}return"parse"in n?n.parse(t):typeof n=="function"?n(t):{}}function db({pathname:n,routesById:t,processedTree:a}){const l=Object.create(null),c=qr(n);let u,f;const p=d9(c,a,!0);return p&&(u=p.route,Object.assign(l,p.rawParams),f=Object.assign(Object.create(null),p.parsedParams)),{matchedRoutes:(p==null?void 0:p.branch)||[t.__root__],routeParams:l,foundRoute:u,parsedParams:f}}function fb({search:n,dest:t,destRoutes:a,_includeValidateSearch:l}){return hb(a)(n,t,l??!1)}function hb(n){var c;const t={dest:null,_includeValidateSearch:!1,middlewares:[]};for(const u of n){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 f=({search:p,next:y})=>{let m=p;"preSearchFilters"in u.options&&u.options.preSearchFilters&&(m=u.options.preSearchFilters.reduce((g,x)=>x(g),p));const S=y(m);return"postSearchFilters"in u.options&&u.options.postSearchFilters?u.options.postSearchFilters.reduce((g,x)=>x(g),S):S};t.middlewares.push(f)}if(u.options.validateSearch){const f=({search:p,next:y})=>{const m=y(p);if(!t._includeValidateSearch)return m;try{return{...m,...qf(u.options.validateSearch,m)??void 0}}catch{return m}};t.middlewares.push(f)}}const a=({search:u})=>{const f=t.dest;return f.search?f.search===!0?u:Br(f.search,u):{}};t.middlewares.push(a);const l=(u,f,p)=>{if(u>=p.length)return f;const y=p[u];return y({search:f,next:S=>l(u+1,S,p)})};return function(f,p,y){return t.dest=p,t._includeValidateSearch=y,l(0,f,t.middlewares)}}function mb(n,t){if(n!=="root")for(let a=t.length-1;a>=0;a--){const l=t[a];if(l.children)return l.id}return Pl}function S6(n,t,a,l){var u;const c=((u=n.options.params)==null?void 0:u.parse)??n.options.parseParams;if(c)if(n.options.skipRouteOnParseError)for(const f in t)f in a&&(l[f]=a[f]);else{const f=c(l);Object.assign(l,f)}}var pb="Error preloading route! ☝️",F2=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(n){if(this.init=t=>{var y,m;this.originalIndex=t.originalIndex;const a=this.options,l=!(a!=null&&a.path)&&!(a!=null&&a.id);this.parentRoute=(m=(y=this.options).getParentRoute)==null?void 0:m.call(y),l?this._path=Pl:this.parentRoute||Wr(!1);let c=l?Pl:a==null?void 0:a.path;c&&c!=="/"&&(c=A2(c));const u=(a==null?void 0:a.id)||c;let f=l?Pl:Uf([this.parentRoute.id==="__root__"?"":this.parentRoute.id,u]);c==="__root__"&&(c="/"),f!=="__root__"&&(f=Uf(["/",f]));const p=f==="__root__"?"/":Uf([this.parentRoute.fullPath,c]);this._path=c,this._id=f,this._fullPath=p,this._to=qr(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=>O9({from:this.fullPath,...t}),this.options=n||{},this.isRoot=!(n!=null&&n.getParentRoute),n!=null&&n.id&&(n!=null&&n.path))throw new Error("Route cannot have both an 'id' and a 'path' option.")}},gb=class extends F2{constructor(n){super(n)}};function o0(n){const t=n.errorComponent??c0;return r.jsx(yb,{getResetKey:n.getResetKey,onCatch:n.onCatch,children:({error:a,reset:l})=>a?_.createElement(t,{error:a,reset:l}):n.children})}var yb=class extends _.Component{constructor(...n){super(...n),this.state={error:null}}static getDerivedStateFromProps(n){return{resetKey:n.getResetKey()}}static getDerivedStateFromError(n){return{error:n}}reset(){this.setState({error:null})}componentDidUpdate(n,t){t.error&&t.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(n,t){this.props.onCatch&&this.props.onCatch(n,t)}render(){return this.props.children({error:this.state.resetKey!==this.props.getResetKey()?null:this.state.error,reset:()=>{this.reset()}})}};function c0({error:n}){const[t,a]=_.useState(!1);return r.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[r.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),r.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>a(l=>!l),children:t?"Hide Error":"Show Error"})]}),r.jsx("div",{style:{height:".25rem"}}),t?r.jsx("div",{children:r.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:n.message?r.jsx("code",{children:n.message}):null})}):null]})}function vb({children:n,fallback:t=null}){return Q2()?r.jsx(Oi.Fragment,{children:n}):r.jsx(Oi.Fragment,{children:t})}function Q2(){return Oi.useSyncExternalStore(_b,()=>!0,()=>!1)}function _b(){return()=>{}}var G2=_.createContext(null);function pa(n){const t=_.useContext(G2);return n==null||n.warn,t}var Pp={exports:{}},zp={},Bp={exports:{}},Up={};/**
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 j6;function bb(){if(j6)return Up;j6=1;var n=nd();function t(g,x){return g===x&&(g!==0||1/g===1/x)||g!==g&&x!==x}var a=typeof Object.is=="function"?Object.is:t,l=n.useState,c=n.useEffect,u=n.useLayoutEffect,f=n.useDebugValue;function p(g,x){var j=x(),k=l({inst:{value:j,getSnapshot:x}}),E=k[0].inst,N=k[1];return u(function(){E.value=j,E.getSnapshot=x,y(E)&&N({inst:E})},[g,j,x]),c(function(){return y(E)&&N({inst:E}),g(function(){y(E)&&N({inst:E})})},[g]),f(j),j}function y(g){var x=g.getSnapshot;g=g.value;try{var j=x();return!a(g,j)}catch{return!0}}function m(g,x){return x()}var S=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?m:p;return Up.useSyncExternalStore=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:S,Up}var w6;function xb(){return w6||(w6=1,Bp.exports=bb()),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 k6;function Sb(){if(k6)return zp;k6=1;var n=nd(),t=xb();function a(m,S){return m===S&&(m!==0||1/m===1/S)||m!==m&&S!==S}var l=typeof Object.is=="function"?Object.is:a,c=t.useSyncExternalStore,u=n.useRef,f=n.useEffect,p=n.useMemo,y=n.useDebugValue;return zp.useSyncExternalStoreWithSelector=function(m,S,g,x,j){var k=u(null);if(k.current===null){var E={hasValue:!1,value:null};k.current=E}else E=k.current;k=p(function(){function P(re){if(!H){if(H=!0,U=re,re=x(re),j!==void 0&&E.hasValue){var V=E.value;if(j(V,re))return R=V}return R=re}if(V=R,l(U,re))return V;var ee=x(re);return j!==void 0&&j(V,ee)?(U=re,V):(U=re,R=ee)}var H=!1,U,R,q=g===void 0?null:g;return[function(){return P(S())},q===null?void 0:function(){return P(q())}]},[S,g,x,j]);var N=c(m,k[0],k[1]);return f(function(){E.hasValue=!0,E.value=N},[N]),y(N),N},zp}var N6;function jb(){return N6||(N6=1,Pp.exports=Sb()),Pp.exports}var wb=jb();function kb(n,t){return n===t}function Nb(n,t,a=kb){const l=_.useCallback(f=>{if(!n)return()=>{};const{unsubscribe:p}=n.subscribe(f);return p},[n]),c=_.useCallback(()=>n==null?void 0:n.get(),[n]);return wb.useSyncExternalStoreWithSelector(l,c,c,t,a)}function ma(n){const t=pa({warn:(n==null?void 0:n.router)===void 0}),a=(n==null?void 0:n.router)||t,l=_.useRef(void 0);return Nb(a.__store,c=>{if(n!=null&&n.select){if(n.structuralSharing??a.options.defaultStructuralSharing){const u=wl(l.current,n.select(c));return l.current=u,u}return n.select(c)}return c})}var xh=_.createContext(void 0),Cb=_.createContext(void 0);function Kr(n){const t=_.useContext(n.from?Cb:xh);return ma({select:a=>{const l=a.matches.find(c=>n.from?n.from===c.routeId:c.id===t);if(Wr(!((n.shouldThrow??!0)&&!l),`Could not find ${n.from?`an active match from "${n.from}"`:"a nearest match!"}`),l!==void 0)return n.select?n.select(l):l},structuralSharing:n.structuralSharing})}function u0(n){return Kr({from:n.from,strict:n.strict,structuralSharing:n.structuralSharing,select:t=>n.select?n.select(t.loaderData):t.loaderData})}function d0(n){const{select:t,...a}=n;return Kr({...a,select:l=>t?t(l.loaderDeps):l.loaderDeps})}function sd(n){return Kr({from:n.from,shouldThrow:n.shouldThrow,structuralSharing:n.structuralSharing,strict:n.strict,select:t=>{const a=n.strict===!1?t.params:t._strictParams;return n.select?n.select(a):a}})}function f0(n){return Kr({from:n.from,strict:n.strict,shouldThrow:n.shouldThrow,structuralSharing:n.structuralSharing,select:t=>n.select?n.select(t.search):t.search})}function Zr(n){const t=pa();return _.useCallback(a=>t.navigate({...a,from:a.from??(n==null?void 0:n.from)}),[n==null?void 0:n.from,t])}function h0(n){return Kr({...n,select:t=>n.select?n.select(t.context):t.context})}var Er=y2();function Eb(n,t){const a=pa(),l=X5(t),{activeProps:c,inactiveProps:u,activeOptions:f,to:p,preload:y,preloadDelay:m,hashScrollIntoView:S,replace:g,startTransition:x,resetScroll:j,viewTransition:k,children:E,target:N,disabled:P,style:H,className:U,onClick:R,onBlur:q,onFocus:re,onMouseEnter:V,onMouseLeave:ee,onTouchStart:Z,ignoreBlocker:W,params:F,search:be,hash:pe,state:Y,mask:ne,reloadDocument:T,unsafeRelative:$,from:ue,_fromLocation:de,...ve}=n,A=Q2(),te=ma({select:Ce=>{const Fe=Ce.matches[Ce.matches.length-1];return{search:Fe==null?void 0:Fe.search,hash:Ce.location.hash,path:Fe==null?void 0:Fe.pathname}},structuralSharing:!0}),je=n.from,Se=_.useMemo(()=>({...n,from:je}),[a,te,je,n._fromLocation,n.hash,n.to,n.search,n.params,n.state,n.mask,n.unsafeRelative]),Re=_.useMemo(()=>a.buildLocation({...Se}),[a,Se]),oe=Re.maskedLocation?Re.maskedLocation.publicHref:Re.publicHref,Ne=Re.maskedLocation?Re.maskedLocation.external:Re.external,ie=_.useMemo(()=>Ob(oe,Ne,a.history,P),[P,Ne,oe,a.history]),z=_.useMemo(()=>{if(ie!=null&&ie.external)return Vf(ie.href,a.protocolAllowlist)?void 0:ie.href;if(!Lb(p)&&!(typeof p!="string"||p.indexOf(":")===-1))try{return new URL(p),Vf(p,a.protocolAllowlist)?void 0:p}catch{}},[p,ie,a.protocolAllowlist]),we=ma({select:Ce=>{if(z)return!1;if(f!=null&&f.exact){if(!y9(Ce.location.pathname,Re.pathname,a.basepath))return!1}else{const Fe=Zf(Ce.location.pathname,a.basepath),tt=Zf(Re.pathname,a.basepath);if(!(Fe.startsWith(tt)&&(Fe.length===tt.length||Fe[tt.length]==="/")))return!1}return((f==null?void 0:f.includeSearch)??!0)&&!Il(Ce.location.search,Re.search,{partial:!(f!=null&&f.exact),ignoreUndefined:!(f!=null&&f.explicitUndefined)})?!1:f!=null&&f.includeHash?A&&Ce.location.hash===Re.hash:!0}}),ke=we?Br(c,{})??Tb:$p,_e=we?$p:Br(u,{})??$p,Me=[U,ke.className,_e.className].filter(Boolean).join(" "),Ge=(H||ke.style||_e.style)&&{...H,...ke.style,..._e.style},[at,ht]=_.useState(!1),Bt=_.useRef(!1),Ut=n.reloadDocument||z?!1:y??a.options.defaultPreload,Ze=m??a.options.defaultPreloadDelay??0,Zt=_.useCallback(()=>{a.preloadRoute({...Se,_builtLocation:Re}).catch(Ce=>{console.warn(Ce),console.warn(pb)})},[a,Se,Re]);Z5(l,_.useCallback(Ce=>{Ce!=null&&Ce.isIntersecting&&Zt()},[Zt]),Db,{disabled:!!P||Ut!=="viewport"}),_.useEffect(()=>{Bt.current||!P&&Ut==="render"&&(Zt(),Bt.current=!0)},[P,Zt,Ut]);const un=Ce=>{const Fe=Ce.currentTarget.getAttribute("target"),tt=N!==void 0?N:Fe;if(!P&&!Ib(Ce)&&!Ce.defaultPrevented&&(!tt||tt==="_self")&&Ce.button===0){Ce.preventDefault(),Er.flushSync(()=>{ht(!0)});const qe=a.subscribe("onResolved",()=>{qe(),ht(!1)});a.navigate({...Se,replace:g,resetScroll:j,hashScrollIntoView:S,startTransition:x,viewTransition:k,ignoreBlocker:W})}};if(z)return{...ve,ref:l,href:z,...E&&{children:E},...N&&{target:N},...P&&{disabled:P},...H&&{style:H},...U&&{className:U},...R&&{onClick:R},...q&&{onBlur:q},...re&&{onFocus:re},...V&&{onMouseEnter:V},...ee&&{onMouseLeave:ee},...Z&&{onTouchStart:Z}};const fe=Ce=>{if(P||Ut!=="intent")return;if(!Ze){Zt();return}const Fe=Ce.currentTarget;if(gu.has(Fe))return;const tt=setTimeout(()=>{gu.delete(Fe),Zt()},Ze);gu.set(Fe,tt)},Ae=Ce=>{P||Ut!=="intent"||Zt()},Ie=Ce=>{if(P||!Ut||!Ze)return;const Fe=Ce.currentTarget,tt=gu.get(Fe);tt&&(clearTimeout(tt),gu.delete(Fe))};return{...ve,...ke,..._e,href:ie==null?void 0:ie.href,ref:l,onClick:Do([R,un]),onBlur:Do([q,Ie]),onFocus:Do([re,fe]),onMouseEnter:Do([V,fe]),onMouseLeave:Do([ee,Ie]),onTouchStart:Do([Z,Ae]),disabled:!!P,target:N,...Ge&&{style:Ge},...Me&&{className:Me},...P&&Mb,...we&&Rb,...A&&at&&Ab}}var $p={},Tb={className:"active"},Mb={role:"link","aria-disabled":!0},Rb={"data-status":"active","aria-current":"page"},Ab={"data-transitioning":"transitioning"},gu=new WeakMap,Db={rootMargin:"100px"},Do=n=>t=>{for(const a of n)if(a){if(t.defaultPrevented)return;a(t)}};function Ob(n,t,a,l){if(!l)return t?{href:n,external:!0}:{href:a.createHref(n)||"/",external:!1}}function Lb(n){if(typeof n!="string")return!1;const t=n.charCodeAt(0);return t===47?n.charCodeAt(1)!==47:t===46}var Iu=_.forwardRef((n,t)=>{const{_asChild:a,...l}=n,{type:c,...u}=Eb(l,t),f=typeof l.children=="function"?l.children({isActive:u["data-status"]==="active"}):l.children;if(!a){const{disabled:p,...y}=u;return _.createElement("a",y,f)}return _.createElement(a,u,f)});function Ib(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}var Pb=class extends F2{constructor(n){super(n),this.useMatch=t=>Kr({select:t==null?void 0:t.select,from:this.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>h0({...t,from:this.id}),this.useSearch=t=>f0({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useParams=t=>sd({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useLoaderDeps=t=>d0({...t,from:this.id}),this.useLoaderData=t=>u0({...t,from:this.id}),this.useNavigate=()=>Zr({from:this.fullPath}),this.Link=Oi.forwardRef((t,a)=>r.jsx(Iu,{ref:a,from:this.fullPath,...t})),this.$$typeof=Symbol.for("react.memo")}};function Fl(n){return new Pb(n)}var zb=class extends gb{constructor(n){super(n),this.useMatch=t=>Kr({select:t==null?void 0:t.select,from:this.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>h0({...t,from:this.id}),this.useSearch=t=>f0({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useParams=t=>sd({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useLoaderDeps=t=>d0({...t,from:this.id}),this.useLoaderData=t=>u0({...t,from:this.id}),this.useNavigate=()=>Zr({from:this.fullPath}),this.Link=Oi.forwardRef((t,a)=>r.jsx(Iu,{ref:a,from:this.fullPath,...t})),this.$$typeof=Symbol.for("react.memo")}};function Bb(n){return new zb(n)}function C6(n){return typeof n=="object"?new E6(n,{silent:!0}).createRoute(n):new E6(n,{silent:!0}).createRoute}var E6=class{constructor(n,t){this.path=n,this.createRoute=a=>{const l=Fl(a);return l.isRoot=!1,l},this.silent=t==null?void 0:t.silent}},T6=class{constructor(n){this.useMatch=t=>Kr({select:t==null?void 0:t.select,from:this.options.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>h0({...t,from:this.options.id}),this.useSearch=t=>f0({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.options.id}),this.useParams=t=>sd({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.options.id}),this.useLoaderDeps=t=>d0({...t,from:this.options.id}),this.useLoaderData=t=>u0({...t,from:this.options.id}),this.useNavigate=()=>Zr({from:pa().routesById[this.options.id].fullPath}),this.options=n,this.$$typeof=Symbol.for("react.memo")}};function M6(n){return typeof n=="object"?new T6(n):t=>new T6({id:n,...t})}function Ub(n){const t=ma({select:a=>`not-found-${a.location.pathname}-${a.status}`});return r.jsx(o0,{getResetKey:()=>t,onCatch:(a,l)=>{var c;if(Ns(a))(c=n.onCatch)==null||c.call(n,a,l);else throw a},errorComponent:({error:a})=>{var l;if(Ns(a))return(l=n.fallback)==null?void 0:l.call(n,a);throw a},children:n.children})}function $b(){return r.jsx("p",{children:"Not Found"})}function zo(n){return r.jsx(r.Fragment,{children:n.children})}function W2(n,t,a){return t.options.notFoundComponent?r.jsx(t.options.notFoundComponent,{...a}):n.options.defaultNotFoundComponent?r.jsx(n.options.defaultNotFoundComponent,{...a}):r.jsx($b,{})}function Hb(){return pa().isScrollRestoring,null}var Y2=_.memo(function({matchId:t}){var k,E;const a=pa(),l=ma({select:N=>{var U;const P=N.matches.findIndex(R=>R.id===t),H=N.matches[P];return Wr(H),{routeId:H.routeId,ssr:H.ssr,_displayPending:H._displayPending,resetKey:N.loadedAt,parentRouteId:(U=N.matches[P-1])==null?void 0:U.routeId}},structuralSharing:!0}),c=a.routesById[l.routeId],u=c.options.pendingComponent??a.options.defaultPendingComponent,f=u?r.jsx(u,{}):null,p=c.options.errorComponent??a.options.defaultErrorComponent,y=c.options.onCatch??a.options.defaultOnCatch,m=c.isRoot?c.options.notFoundComponent??((k=a.options.notFoundRoute)==null?void 0:k.options.component):c.options.notFoundComponent,S=l.ssr===!1||l.ssr==="data-only",g=(!c.isRoot||c.options.wrapInSuspense||S)&&(c.options.wrapInSuspense??u??(((E=c.options.errorComponent)==null?void 0:E.preload)||S))?_.Suspense:zo,x=p?o0:zo,j=m?Ub:zo;return r.jsxs(c.isRoot?c.options.shellComponent??zo:zo,{children:[r.jsx(xh.Provider,{value:t,children:r.jsx(g,{fallback:f,children:r.jsx(x,{getResetKey:()=>l.resetKey,errorComponent:p||c0,onCatch:(N,P)=>{if(Ns(N))throw N;y==null||y(N,P)},children:r.jsx(j,{fallback:N=>{if(!m||N.routeId&&N.routeId!==l.routeId||!N.routeId&&!c.isRoot)throw N;return _.createElement(m,N)},children:S||l._displayPending?r.jsx(vb,{fallback:f,children:r.jsx(R6,{matchId:t})}):r.jsx(R6,{matchId:t})})})})}),l.parentRouteId===Pl&&a.options.scrollRestoration?r.jsxs(r.Fragment,{children:[r.jsx(qb,{}),r.jsx(Hb,{})]}):null]})});function qb(){const n=pa(),t=_.useRef(void 0);return r.jsx("script",{suppressHydrationWarning:!0,ref:a=>{a&&(t.current===void 0||t.current.href!==n.latestLocation.href)&&(n.emit({type:"onRendered",...Bl(n.state)}),t.current=n.latestLocation)}},n.latestLocation.state.__TSR_key)}var R6=_.memo(function({matchId:t}){var y,m,S,g;const a=pa(),{match:l,key:c,routeId:u}=ma({select:x=>{var N;const j=x.matches.find(P=>P.id===t),k=j.routeId,E=(N=a.routesById[k].options.remountDeps??a.options.defaultRemountDeps)==null?void 0:N({routeId:k,loaderDeps:j.loaderDeps,params:j._strictParams,search:j._strictSearch});return{key:E?JSON.stringify(E):void 0,routeId:k,match:{id:j.id,status:j.status,error:j.error,_forcePending:j._forcePending,_displayPending:j._displayPending}}},structuralSharing:!0}),f=a.routesById[u],p=_.useMemo(()=>{const x=f.options.component??a.options.defaultComponent;return x?r.jsx(x,{},c):r.jsx(V2,{})},[c,f.options.component,a.options.defaultComponent]);if(l._displayPending)throw(y=a.getMatch(l.id))==null?void 0:y._nonReactive.displayPendingPromise;if(l._forcePending)throw(m=a.getMatch(l.id))==null?void 0:m._nonReactive.minPendingPromise;if(l.status==="pending"){const x=f.options.pendingMinMs??a.options.defaultPendingMinMs;if(x){const j=a.getMatch(l.id);if(j&&!j._nonReactive.minPendingPromise){const k=nc();j._nonReactive.minPendingPromise=k,setTimeout(()=>{k.resolve(),j._nonReactive.minPendingPromise=void 0},x)}}throw(S=a.getMatch(l.id))==null?void 0:S._nonReactive.loadPromise}if(l.status==="notFound")return Wr(Ns(l.error)),W2(a,f,l.error);if(l.status==="redirected")throw Wr(Qs(l.error)),(g=a.getMatch(l.id))==null?void 0:g._nonReactive.loadPromise;if(l.status==="error")throw l.error;return p}),V2=_.memo(function(){const t=pa(),a=_.useContext(xh),l=ma({select:m=>{var S;return(S=m.matches.find(g=>g.id===a))==null?void 0:S.routeId}}),c=t.routesById[l],u=ma({select:m=>{const S=m.matches.find(g=>g.id===a);return Wr(S),S.globalNotFound}}),f=ma({select:m=>{var g;const S=m.matches;return(g=S[S.findIndex(x=>x.id===a)+1])==null?void 0:g.id}}),p=t.options.defaultPendingComponent?r.jsx(t.options.defaultPendingComponent,{}):null;if(u)return W2(t,c,void 0);if(!f)return null;const y=r.jsx(Y2,{matchId:f});return l===Pl?r.jsx(_.Suspense,{fallback:p,children:y}):y});function Fb(){const n=pa(),t=_.useRef({router:n,mounted:!1}),[a,l]=_.useState(!1),{hasPendingMatches:c,isLoading:u}=ma({select:g=>({isLoading:g.isLoading,hasPendingMatches:g.matches.some(x=>x.status==="pending")}),structuralSharing:!0}),f=Rp(u),p=u||a||c,y=Rp(p),m=u||c,S=Rp(m);return n.startTransition=g=>{l(!0),_.startTransition(()=>{g(),l(!1)})},_.useEffect(()=>{const g=n.history.subscribe(n.load),x=n.buildLocation({to:n.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return qr(n.latestLocation.publicHref)!==qr(x.publicHref)&&n.commitLocation({...x,replace:!0}),()=>{g()}},[n,n.history]),Mf(()=>{if(typeof window<"u"&&n.ssr||t.current.router===n&&t.current.mounted)return;t.current={router:n,mounted:!0},(async()=>{try{await n.load()}catch(x){console.error(x)}})()},[n]),Mf(()=>{f&&!u&&n.emit({type:"onLoad",...Bl(n.state)})},[f,n,u]),Mf(()=>{S&&!m&&n.emit({type:"onBeforeRouteMount",...Bl(n.state)})},[m,S,n]),Mf(()=>{if(y&&!p){const g=Bl(n.state);n.emit({type:"onResolved",...g}),n.__store.setState(x=>({...x,status:"idle",resolvedLocation:x.location})),g.hrefChanged&&C9(n)}},[p,y,n]),null}function Qb(){const n=pa(),t=n.routesById[Pl].options.pendingComponent??n.options.defaultPendingComponent,a=t?r.jsx(t,{}):null,l=r.jsxs(typeof document<"u"&&n.ssr?zo:_.Suspense,{fallback:a,children:[r.jsx(Fb,{}),r.jsx(Gb,{})]});return n.options.InnerWrap?r.jsx(n.options.InnerWrap,{children:l}):l}function Gb(){const n=pa(),t=ma({select:c=>{var u;return(u=c.matches[0])==null?void 0:u.id}}),a=ma({select:c=>c.loadedAt}),l=t?r.jsx(Y2,{matchId:t}):null;return r.jsx(xh.Provider,{value:t,children:n.options.disableGlobalCatchBoundary?l:r.jsx(o0,{getResetKey:()=>a,errorComponent:c0,onCatch:void 0,children:l})})}var Wb=n=>new Yb(n),Yb=class extends ob{constructor(n){super(n)}};typeof globalThis<"u"?(globalThis.createFileRoute=C6,globalThis.createLazyFileRoute=M6):typeof window<"u"&&(window.createFileRoute=C6,window.createLazyFileRoute=M6);function Vb({router:n,children:t,...a}){Object.keys(a).length>0&&n.update({...n.options,...a,context:{...n.options.context,...a.context}});const l=r.jsx(G2.Provider,{value:n,children:t});return n.options.Wrap?r.jsx(n.options.Wrap,{children:l}):l}function Kb({router:n,...t}){return r.jsx(Vb,{router:n,...t,children:r.jsx(Qb,{})})}const K2=["bootstrap","hub"],yt=["bootstrap","workspace"];var Wt;(function(n){n.assertEqual=c=>{};function t(c){}n.assertIs=t;function a(c){throw new Error}n.assertNever=a,n.arrayToEnum=c=>{const u={};for(const f of c)u[f]=f;return u},n.getValidEnumValues=c=>{const u=n.objectKeys(c).filter(p=>typeof c[c[p]]!="number"),f={};for(const p of u)f[p]=c[p];return n.objectValues(f)},n.objectValues=c=>n.objectKeys(c).map(function(u){return c[u]}),n.objectKeys=typeof Object.keys=="function"?c=>Object.keys(c):c=>{const u=[];for(const f in c)Object.prototype.hasOwnProperty.call(c,f)&&u.push(f);return u},n.find=(c,u)=>{for(const f of c)if(u(f))return f},n.isInteger=typeof Number.isInteger=="function"?c=>Number.isInteger(c):c=>typeof c=="number"&&Number.isFinite(c)&&Math.floor(c)===c;function l(c,u=" | "){return c.map(f=>typeof f=="string"?`'${f}'`:f).join(u)}n.joinValues=l,n.jsonStringifyReplacer=(c,u)=>typeof u=="bigint"?u.toString():u})(Wt||(Wt={}));var A6;(function(n){n.mergeShapes=(t,a)=>({...t,...a})})(A6||(A6={}));const Ke=Wt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Cr=n=>{switch(typeof n){case"undefined":return Ke.undefined;case"string":return Ke.string;case"number":return Number.isNaN(n)?Ke.nan:Ke.number;case"boolean":return Ke.boolean;case"function":return Ke.function;case"bigint":return Ke.bigint;case"symbol":return Ke.symbol;case"object":return Array.isArray(n)?Ke.array:n===null?Ke.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?Ke.promise:typeof Map<"u"&&n instanceof Map?Ke.map:typeof Set<"u"&&n instanceof Set?Ke.set:typeof Date<"u"&&n instanceof Date?Ke.date:Ke.object;default:return Ke.unknown}},Te=Wt.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 zi extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=l=>{this.issues=[...this.issues,l]},this.addIssues=(l=[])=>{this.issues=[...this.issues,...l]};const a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=t}format(t){const a=t||function(u){return u.message},l={_errors:[]},c=u=>{for(const f of u.issues)if(f.code==="invalid_union")f.unionErrors.map(c);else if(f.code==="invalid_return_type")c(f.returnTypeError);else if(f.code==="invalid_arguments")c(f.argumentsError);else if(f.path.length===0)l._errors.push(a(f));else{let p=l,y=0;for(;y<f.path.length;){const m=f.path[y];y===f.path.length-1?(p[m]=p[m]||{_errors:[]},p[m]._errors.push(a(f))):p[m]=p[m]||{_errors:[]},p=p[m],y++}}};return c(this),l}static assert(t){if(!(t instanceof zi))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Wt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=a=>a.message){const a={},l=[];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 l.push(t(c));return{formErrors:l,fieldErrors:a}}get formErrors(){return this.flatten()}}zi.create=n=>new zi(n);const C1=(n,t)=>{let a;switch(n.code){case Te.invalid_type:n.received===Ke.undefined?a="Required":a=`Expected ${n.expected}, received ${n.received}`;break;case Te.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(n.expected,Wt.jsonStringifyReplacer)}`;break;case Te.unrecognized_keys:a=`Unrecognized key(s) in object: ${Wt.joinValues(n.keys,", ")}`;break;case Te.invalid_union:a="Invalid input";break;case Te.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${Wt.joinValues(n.options)}`;break;case Te.invalid_enum_value:a=`Invalid enum value. Expected ${Wt.joinValues(n.options)}, received '${n.received}'`;break;case Te.invalid_arguments:a="Invalid function arguments";break;case Te.invalid_return_type:a="Invalid function return type";break;case Te.invalid_date:a="Invalid date";break;case Te.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(a=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(a=`${a} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?a=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?a=`Invalid input: must end with "${n.validation.endsWith}"`:Wt.assertNever(n.validation):n.validation!=="regex"?a=`Invalid ${n.validation}`:a="Invalid";break;case Te.too_small:n.type==="array"?a=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?a=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?a=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="bigint"?a=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?a=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:a="Invalid input";break;case Te.too_big:n.type==="array"?a=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?a=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?a=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?a=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?a=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:a="Invalid input";break;case Te.custom:a="Invalid input";break;case Te.invalid_intersection_types:a="Intersection results could not be merged";break;case Te.not_multiple_of:a=`Number must be a multiple of ${n.multipleOf}`;break;case Te.not_finite:a="Number must be finite";break;default:a=t.defaultError,Wt.assertNever(n)}return{message:a}};let Zb=C1;function Xb(){return Zb}const Jb=n=>{const{data:t,path:a,errorMaps:l,issueData:c}=n,u=[...a,...c.path||[]],f={...c,path:u};if(c.message!==void 0)return{...c,path:u,message:c.message};let p="";const y=l.filter(m=>!!m).slice().reverse();for(const m of y)p=m(f,{data:t,defaultError:p}).message;return{...c,path:u,message:p}};function Qe(n,t){const a=Xb(),l=Jb({issueData:t,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,a,a===C1?void 0:C1].filter(c=>!!c)});n.common.issues.push(l)}class Cs{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,a){const l=[];for(const c of a){if(c.status==="aborted")return _t;c.status==="dirty"&&t.dirty(),l.push(c.value)}return{status:t.value,value:l}}static async mergeObjectAsync(t,a){const l=[];for(const c of a){const u=await c.key,f=await c.value;l.push({key:u,value:f})}return Cs.mergeObjectSync(t,l)}static mergeObjectSync(t,a){const l={};for(const c of a){const{key:u,value:f}=c;if(u.status==="aborted"||f.status==="aborted")return _t;u.status==="dirty"&&t.dirty(),f.status==="dirty"&&t.dirty(),u.value!=="__proto__"&&(typeof f.value<"u"||c.alwaysSet)&&(l[u.value]=f.value)}return{status:t.value,value:l}}}const _t=Object.freeze({status:"aborted"}),Cu=n=>({status:"dirty",value:n}),ga=n=>({status:"valid",value:n}),D6=n=>n.status==="aborted",O6=n=>n.status==="dirty",sc=n=>n.status==="valid",nh=n=>typeof Promise<"u"&&n instanceof Promise;var et;(function(n){n.errToObj=t=>typeof t=="string"?{message:t}:t||{},n.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(et||(et={}));class Ya{constructor(t,a,l,c){this._cachedPath=[],this.parent=t,this.data=a,this._path=l,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 L6=(n,t)=>{if(sc(t))return{success:!0,data:t.value};if(!n.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 zi(n.common.issues);return this._error=a,this._error}}};function Nt(n){if(!n)return{};const{errorMap:t,invalid_type_error:a,required_error:l,description:c}=n;if(t&&(a||l))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:c}:{errorMap:(f,p)=>{const{message:y}=n;return f.code==="invalid_enum_value"?{message:y??p.defaultError}:typeof p.data>"u"?{message:y??l??p.defaultError}:f.code!=="invalid_type"?{message:p.defaultError}:{message:y??a??p.defaultError}},description:c}}class Pt{get description(){return this._def.description}_getType(t){return Cr(t.data)}_getOrReturnCtx(t,a){return a||{common:t.parent.common,data:t.data,parsedType:Cr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Cs,ctx:{common:t.parent.common,data:t.data,parsedType:Cr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const a=this._parse(t);if(nh(a))throw new Error("Synchronous parse encountered promise.");return a}_parseAsync(t){const a=this._parse(t);return Promise.resolve(a)}parse(t,a){const l=this.safeParse(t,a);if(l.success)return l.data;throw l.error}safeParse(t,a){const l={common:{issues:[],async:(a==null?void 0:a.async)??!1,contextualErrorMap:a==null?void 0:a.errorMap},path:(a==null?void 0:a.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Cr(t)},c=this._parseSync({data:t,path:l.path,parent:l});return L6(l,c)}"~validate"(t){var l,c;const a={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Cr(t)};if(!this["~standard"].async)try{const u=this._parseSync({data:t,path:[],parent:a});return sc(u)?{value:u.value}:{issues:a.common.issues}}catch(u){(c=(l=u==null?void 0:u.message)==null?void 0:l.toLowerCase())!=null&&c.includes("encountered")&&(this["~standard"].async=!0),a.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:a}).then(u=>sc(u)?{value:u.value}:{issues:a.common.issues})}async parseAsync(t,a){const l=await this.safeParseAsync(t,a);if(l.success)return l.data;throw l.error}async safeParseAsync(t,a){const l={common:{issues:[],contextualErrorMap:a==null?void 0:a.errorMap,async:!0},path:(a==null?void 0:a.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Cr(t)},c=this._parse({data:t,path:l.path,parent:l}),u=await(nh(c)?c:Promise.resolve(c));return L6(l,u)}refine(t,a){const l=c=>typeof a=="string"||typeof a>"u"?{message:a}:typeof a=="function"?a(c):a;return this._refinement((c,u)=>{const f=t(c),p=()=>u.addIssue({code:Te.custom,...l(c)});return typeof Promise<"u"&&f instanceof Promise?f.then(y=>y?!0:(p(),!1)):f?!0:(p(),!1)})}refinement(t,a){return this._refinement((l,c)=>t(l)?!0:(c.addIssue(typeof a=="function"?a(l,c):a),!1))}_refinement(t){return new rc({schema:this,typeName:vt.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 Qr.create(this,this._def)}nullable(){return lc.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Wa.create(this)}promise(){return lh.create(this,this._def)}or(t){return ah.create([this,t],this._def)}and(t){return ih.create(this,t,this._def)}transform(t){return new rc({...Nt(this._def),schema:this,typeName:vt.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const a=typeof t=="function"?t:()=>t;return new A1({...Nt(this._def),innerType:this,defaultValue:a,typeName:vt.ZodDefault})}brand(){return new Sx({typeName:vt.ZodBranded,type:this,...Nt(this._def)})}catch(t){const a=typeof t=="function"?t:()=>t;return new D1({...Nt(this._def),innerType:this,catchValue:a,typeName:vt.ZodCatch})}describe(t){const a=this.constructor;return new a({...this._def,description:t})}pipe(t){return m0.create(this,t)}readonly(){return O1.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const ex=/^c[^\s-]{8,}$/i,tx=/^[0-9a-z]+$/,nx=/^[0-9A-HJKMNP-TV-Z]{26}$/i,sx=/^[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,ax=/^[a-z0-9_-]{21}$/i,ix=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,rx=/^[-+]?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)?)??$/,lx=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ox="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Hp;const cx=/^(?:(?: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])$/,ux=/^(?:(?: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])$/,dx=/^(([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]))$/,fx=/^(([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])$/,hx=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,mx=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Z2="((\\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])))",px=new RegExp(`^${Z2}$`);function X2(n){let t="[0-5]\\d";n.precision?t=`${t}\\.\\d{${n.precision}}`:n.precision==null&&(t=`${t}(\\.\\d+)?`);const a=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${a}`}function gx(n){return new RegExp(`^${X2(n)}$`)}function yx(n){let t=`${Z2}T${X2(n)}`;const a=[];return a.push(n.local?"Z?":"Z"),n.offset&&a.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${a.join("|")})`,new RegExp(`^${t}$`)}function vx(n,t){return!!((t==="v4"||!t)&&cx.test(n)||(t==="v6"||!t)&&dx.test(n))}function _x(n,t){if(!ix.test(n))return!1;try{const[a]=n.split(".");if(!a)return!1;const l=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),c=JSON.parse(atob(l));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 bx(n,t){return!!((t==="v4"||!t)&&ux.test(n)||(t==="v6"||!t)&&fx.test(n))}class Li extends Pt{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Ke.string){const u=this._getOrReturnCtx(t);return Qe(u,{code:Te.invalid_type,expected:Ke.string,received:u.parsedType}),_t}const l=new Cs;let c;for(const u of this._def.checks)if(u.kind==="min")t.data.length<u.value&&(c=this._getOrReturnCtx(t,c),Qe(c,{code:Te.too_small,minimum:u.value,type:"string",inclusive:!0,exact:!1,message:u.message}),l.dirty());else if(u.kind==="max")t.data.length>u.value&&(c=this._getOrReturnCtx(t,c),Qe(c,{code:Te.too_big,maximum:u.value,type:"string",inclusive:!0,exact:!1,message:u.message}),l.dirty());else if(u.kind==="length"){const f=t.data.length>u.value,p=t.data.length<u.value;(f||p)&&(c=this._getOrReturnCtx(t,c),f?Qe(c,{code:Te.too_big,maximum:u.value,type:"string",inclusive:!0,exact:!0,message:u.message}):p&&Qe(c,{code:Te.too_small,minimum:u.value,type:"string",inclusive:!0,exact:!0,message:u.message}),l.dirty())}else if(u.kind==="email")lx.test(t.data)||(c=this._getOrReturnCtx(t,c),Qe(c,{validation:"email",code:Te.invalid_string,message:u.message}),l.dirty());else if(u.kind==="emoji")Hp||(Hp=new RegExp(ox,"u")),Hp.test(t.data)||(c=this._getOrReturnCtx(t,c),Qe(c,{validation:"emoji",code:Te.invalid_string,message:u.message}),l.dirty());else if(u.kind==="uuid")sx.test(t.data)||(c=this._getOrReturnCtx(t,c),Qe(c,{validation:"uuid",code:Te.invalid_string,message:u.message}),l.dirty());else if(u.kind==="nanoid")ax.test(t.data)||(c=this._getOrReturnCtx(t,c),Qe(c,{validation:"nanoid",code:Te.invalid_string,message:u.message}),l.dirty());else if(u.kind==="cuid")ex.test(t.data)||(c=this._getOrReturnCtx(t,c),Qe(c,{validation:"cuid",code:Te.invalid_string,message:u.message}),l.dirty());else if(u.kind==="cuid2")tx.test(t.data)||(c=this._getOrReturnCtx(t,c),Qe(c,{validation:"cuid2",code:Te.invalid_string,message:u.message}),l.dirty());else if(u.kind==="ulid")nx.test(t.data)||(c=this._getOrReturnCtx(t,c),Qe(c,{validation:"ulid",code:Te.invalid_string,message:u.message}),l.dirty());else if(u.kind==="url")try{new URL(t.data)}catch{c=this._getOrReturnCtx(t,c),Qe(c,{validation:"url",code:Te.invalid_string,message:u.message}),l.dirty()}else u.kind==="regex"?(u.regex.lastIndex=0,u.regex.test(t.data)||(c=this._getOrReturnCtx(t,c),Qe(c,{validation:"regex",code:Te.invalid_string,message:u.message}),l.dirty())):u.kind==="trim"?t.data=t.data.trim():u.kind==="includes"?t.data.includes(u.value,u.position)||(c=this._getOrReturnCtx(t,c),Qe(c,{code:Te.invalid_string,validation:{includes:u.value,position:u.position},message:u.message}),l.dirty()):u.kind==="toLowerCase"?t.data=t.data.toLowerCase():u.kind==="toUpperCase"?t.data=t.data.toUpperCase():u.kind==="startsWith"?t.data.startsWith(u.value)||(c=this._getOrReturnCtx(t,c),Qe(c,{code:Te.invalid_string,validation:{startsWith:u.value},message:u.message}),l.dirty()):u.kind==="endsWith"?t.data.endsWith(u.value)||(c=this._getOrReturnCtx(t,c),Qe(c,{code:Te.invalid_string,validation:{endsWith:u.value},message:u.message}),l.dirty()):u.kind==="datetime"?yx(u).test(t.data)||(c=this._getOrReturnCtx(t,c),Qe(c,{code:Te.invalid_string,validation:"datetime",message:u.message}),l.dirty()):u.kind==="date"?px.test(t.data)||(c=this._getOrReturnCtx(t,c),Qe(c,{code:Te.invalid_string,validation:"date",message:u.message}),l.dirty()):u.kind==="time"?gx(u).test(t.data)||(c=this._getOrReturnCtx(t,c),Qe(c,{code:Te.invalid_string,validation:"time",message:u.message}),l.dirty()):u.kind==="duration"?rx.test(t.data)||(c=this._getOrReturnCtx(t,c),Qe(c,{validation:"duration",code:Te.invalid_string,message:u.message}),l.dirty()):u.kind==="ip"?vx(t.data,u.version)||(c=this._getOrReturnCtx(t,c),Qe(c,{validation:"ip",code:Te.invalid_string,message:u.message}),l.dirty()):u.kind==="jwt"?_x(t.data,u.alg)||(c=this._getOrReturnCtx(t,c),Qe(c,{validation:"jwt",code:Te.invalid_string,message:u.message}),l.dirty()):u.kind==="cidr"?bx(t.data,u.version)||(c=this._getOrReturnCtx(t,c),Qe(c,{validation:"cidr",code:Te.invalid_string,message:u.message}),l.dirty()):u.kind==="base64"?hx.test(t.data)||(c=this._getOrReturnCtx(t,c),Qe(c,{validation:"base64",code:Te.invalid_string,message:u.message}),l.dirty()):u.kind==="base64url"?mx.test(t.data)||(c=this._getOrReturnCtx(t,c),Qe(c,{validation:"base64url",code:Te.invalid_string,message:u.message}),l.dirty()):Wt.assertNever(u);return{status:l.value,value:t.data}}_regex(t,a,l){return this.refinement(c=>t.test(c),{validation:a,code:Te.invalid_string,...et.errToObj(l)})}_addCheck(t){return new Li({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...et.errToObj(t)})}url(t){return this._addCheck({kind:"url",...et.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...et.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...et.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...et.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...et.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...et.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...et.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...et.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...et.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...et.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...et.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...et.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,...et.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,...et.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...et.errToObj(t)})}regex(t,a){return this._addCheck({kind:"regex",regex:t,...et.errToObj(a)})}includes(t,a){return this._addCheck({kind:"includes",value:t,position:a==null?void 0:a.position,...et.errToObj(a==null?void 0:a.message)})}startsWith(t,a){return this._addCheck({kind:"startsWith",value:t,...et.errToObj(a)})}endsWith(t,a){return this._addCheck({kind:"endsWith",value:t,...et.errToObj(a)})}min(t,a){return this._addCheck({kind:"min",value:t,...et.errToObj(a)})}max(t,a){return this._addCheck({kind:"max",value:t,...et.errToObj(a)})}length(t,a){return this._addCheck({kind:"length",value:t,...et.errToObj(a)})}nonempty(t){return this.min(1,et.errToObj(t))}trim(){return new Li({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Li({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Li({...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}}Li.create=n=>new Li({checks:[],typeName:vt.ZodString,coerce:(n==null?void 0:n.coerce)??!1,...Nt(n)});function xx(n,t){const a=(n.toString().split(".")[1]||"").length,l=(t.toString().split(".")[1]||"").length,c=a>l?a:l,u=Number.parseInt(n.toFixed(c).replace(".","")),f=Number.parseInt(t.toFixed(c).replace(".",""));return u%f/10**c}class ac extends Pt{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)!==Ke.number){const u=this._getOrReturnCtx(t);return Qe(u,{code:Te.invalid_type,expected:Ke.number,received:u.parsedType}),_t}let l;const c=new Cs;for(const u of this._def.checks)u.kind==="int"?Wt.isInteger(t.data)||(l=this._getOrReturnCtx(t,l),Qe(l,{code:Te.invalid_type,expected:"integer",received:"float",message:u.message}),c.dirty()):u.kind==="min"?(u.inclusive?t.data<u.value:t.data<=u.value)&&(l=this._getOrReturnCtx(t,l),Qe(l,{code:Te.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)&&(l=this._getOrReturnCtx(t,l),Qe(l,{code:Te.too_big,maximum:u.value,type:"number",inclusive:u.inclusive,exact:!1,message:u.message}),c.dirty()):u.kind==="multipleOf"?xx(t.data,u.value)!==0&&(l=this._getOrReturnCtx(t,l),Qe(l,{code:Te.not_multiple_of,multipleOf:u.value,message:u.message}),c.dirty()):u.kind==="finite"?Number.isFinite(t.data)||(l=this._getOrReturnCtx(t,l),Qe(l,{code:Te.not_finite,message:u.message}),c.dirty()):Wt.assertNever(u);return{status:c.value,value:t.data}}gte(t,a){return this.setLimit("min",t,!0,et.toString(a))}gt(t,a){return this.setLimit("min",t,!1,et.toString(a))}lte(t,a){return this.setLimit("max",t,!0,et.toString(a))}lt(t,a){return this.setLimit("max",t,!1,et.toString(a))}setLimit(t,a,l,c){return new ac({...this._def,checks:[...this._def.checks,{kind:t,value:a,inclusive:l,message:et.toString(c)}]})}_addCheck(t){return new ac({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:et.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:et.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:et.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:et.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:et.toString(t)})}multipleOf(t,a){return this._addCheck({kind:"multipleOf",value:t,message:et.toString(a)})}finite(t){return this._addCheck({kind:"finite",message:et.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:et.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:et.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"&&Wt.isInteger(t.value))}get isFinite(){let t=null,a=null;for(const l of this._def.checks){if(l.kind==="finite"||l.kind==="int"||l.kind==="multipleOf")return!0;l.kind==="min"?(a===null||l.value>a)&&(a=l.value):l.kind==="max"&&(t===null||l.value<t)&&(t=l.value)}return Number.isFinite(a)&&Number.isFinite(t)}}ac.create=n=>new ac({checks:[],typeName:vt.ZodNumber,coerce:(n==null?void 0:n.coerce)||!1,...Nt(n)});class Hu extends Pt{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)!==Ke.bigint)return this._getInvalidInput(t);let l;const c=new Cs;for(const u of this._def.checks)u.kind==="min"?(u.inclusive?t.data<u.value:t.data<=u.value)&&(l=this._getOrReturnCtx(t,l),Qe(l,{code:Te.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)&&(l=this._getOrReturnCtx(t,l),Qe(l,{code:Te.too_big,type:"bigint",maximum:u.value,inclusive:u.inclusive,message:u.message}),c.dirty()):u.kind==="multipleOf"?t.data%u.value!==BigInt(0)&&(l=this._getOrReturnCtx(t,l),Qe(l,{code:Te.not_multiple_of,multipleOf:u.value,message:u.message}),c.dirty()):Wt.assertNever(u);return{status:c.value,value:t.data}}_getInvalidInput(t){const a=this._getOrReturnCtx(t);return Qe(a,{code:Te.invalid_type,expected:Ke.bigint,received:a.parsedType}),_t}gte(t,a){return this.setLimit("min",t,!0,et.toString(a))}gt(t,a){return this.setLimit("min",t,!1,et.toString(a))}lte(t,a){return this.setLimit("max",t,!0,et.toString(a))}lt(t,a){return this.setLimit("max",t,!1,et.toString(a))}setLimit(t,a,l,c){return new Hu({...this._def,checks:[...this._def.checks,{kind:t,value:a,inclusive:l,message:et.toString(c)}]})}_addCheck(t){return new Hu({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:et.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:et.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:et.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:et.toString(t)})}multipleOf(t,a){return this._addCheck({kind:"multipleOf",value:t,message:et.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}}Hu.create=n=>new Hu({checks:[],typeName:vt.ZodBigInt,coerce:(n==null?void 0:n.coerce)??!1,...Nt(n)});class E1 extends Pt{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Ke.boolean){const l=this._getOrReturnCtx(t);return Qe(l,{code:Te.invalid_type,expected:Ke.boolean,received:l.parsedType}),_t}return ga(t.data)}}E1.create=n=>new E1({typeName:vt.ZodBoolean,coerce:(n==null?void 0:n.coerce)||!1,...Nt(n)});class sh extends Pt{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Ke.date){const u=this._getOrReturnCtx(t);return Qe(u,{code:Te.invalid_type,expected:Ke.date,received:u.parsedType}),_t}if(Number.isNaN(t.data.getTime())){const u=this._getOrReturnCtx(t);return Qe(u,{code:Te.invalid_date}),_t}const l=new Cs;let c;for(const u of this._def.checks)u.kind==="min"?t.data.getTime()<u.value&&(c=this._getOrReturnCtx(t,c),Qe(c,{code:Te.too_small,message:u.message,inclusive:!0,exact:!1,minimum:u.value,type:"date"}),l.dirty()):u.kind==="max"?t.data.getTime()>u.value&&(c=this._getOrReturnCtx(t,c),Qe(c,{code:Te.too_big,message:u.message,inclusive:!0,exact:!1,maximum:u.value,type:"date"}),l.dirty()):Wt.assertNever(u);return{status:l.value,value:new Date(t.data.getTime())}}_addCheck(t){return new sh({...this._def,checks:[...this._def.checks,t]})}min(t,a){return this._addCheck({kind:"min",value:t.getTime(),message:et.toString(a)})}max(t,a){return this._addCheck({kind:"max",value:t.getTime(),message:et.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}}sh.create=n=>new sh({checks:[],coerce:(n==null?void 0:n.coerce)||!1,typeName:vt.ZodDate,...Nt(n)});class I6 extends Pt{_parse(t){if(this._getType(t)!==Ke.symbol){const l=this._getOrReturnCtx(t);return Qe(l,{code:Te.invalid_type,expected:Ke.symbol,received:l.parsedType}),_t}return ga(t.data)}}I6.create=n=>new I6({typeName:vt.ZodSymbol,...Nt(n)});class P6 extends Pt{_parse(t){if(this._getType(t)!==Ke.undefined){const l=this._getOrReturnCtx(t);return Qe(l,{code:Te.invalid_type,expected:Ke.undefined,received:l.parsedType}),_t}return ga(t.data)}}P6.create=n=>new P6({typeName:vt.ZodUndefined,...Nt(n)});class z6 extends Pt{_parse(t){if(this._getType(t)!==Ke.null){const l=this._getOrReturnCtx(t);return Qe(l,{code:Te.invalid_type,expected:Ke.null,received:l.parsedType}),_t}return ga(t.data)}}z6.create=n=>new z6({typeName:vt.ZodNull,...Nt(n)});class T1 extends Pt{constructor(){super(...arguments),this._any=!0}_parse(t){return ga(t.data)}}T1.create=n=>new T1({typeName:vt.ZodAny,...Nt(n)});class B6 extends Pt{constructor(){super(...arguments),this._unknown=!0}_parse(t){return ga(t.data)}}B6.create=n=>new B6({typeName:vt.ZodUnknown,...Nt(n)});class Yr extends Pt{_parse(t){const a=this._getOrReturnCtx(t);return Qe(a,{code:Te.invalid_type,expected:Ke.never,received:a.parsedType}),_t}}Yr.create=n=>new Yr({typeName:vt.ZodNever,...Nt(n)});class U6 extends Pt{_parse(t){if(this._getType(t)!==Ke.undefined){const l=this._getOrReturnCtx(t);return Qe(l,{code:Te.invalid_type,expected:Ke.void,received:l.parsedType}),_t}return ga(t.data)}}U6.create=n=>new U6({typeName:vt.ZodVoid,...Nt(n)});class Wa extends Pt{_parse(t){const{ctx:a,status:l}=this._processInputParams(t),c=this._def;if(a.parsedType!==Ke.array)return Qe(a,{code:Te.invalid_type,expected:Ke.array,received:a.parsedType}),_t;if(c.exactLength!==null){const f=a.data.length>c.exactLength.value,p=a.data.length<c.exactLength.value;(f||p)&&(Qe(a,{code:f?Te.too_big:Te.too_small,minimum:p?c.exactLength.value:void 0,maximum:f?c.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:c.exactLength.message}),l.dirty())}if(c.minLength!==null&&a.data.length<c.minLength.value&&(Qe(a,{code:Te.too_small,minimum:c.minLength.value,type:"array",inclusive:!0,exact:!1,message:c.minLength.message}),l.dirty()),c.maxLength!==null&&a.data.length>c.maxLength.value&&(Qe(a,{code:Te.too_big,maximum:c.maxLength.value,type:"array",inclusive:!0,exact:!1,message:c.maxLength.message}),l.dirty()),a.common.async)return Promise.all([...a.data].map((f,p)=>c.type._parseAsync(new Ya(a,f,a.path,p)))).then(f=>Cs.mergeArray(l,f));const u=[...a.data].map((f,p)=>c.type._parseSync(new Ya(a,f,a.path,p)));return Cs.mergeArray(l,u)}get element(){return this._def.type}min(t,a){return new Wa({...this._def,minLength:{value:t,message:et.toString(a)}})}max(t,a){return new Wa({...this._def,maxLength:{value:t,message:et.toString(a)}})}length(t,a){return new Wa({...this._def,exactLength:{value:t,message:et.toString(a)}})}nonempty(t){return this.min(1,t)}}Wa.create=(n,t)=>new Wa({type:n,minLength:null,maxLength:null,exactLength:null,typeName:vt.ZodArray,...Nt(t)});function Bo(n){if(n instanceof Qn){const t={};for(const a in n.shape){const l=n.shape[a];t[a]=Qr.create(Bo(l))}return new Qn({...n._def,shape:()=>t})}else return n instanceof Wa?new Wa({...n._def,type:Bo(n.element)}):n instanceof Qr?Qr.create(Bo(n.unwrap())):n instanceof lc?lc.create(Bo(n.unwrap())):n instanceof ql?ql.create(n.items.map(t=>Bo(t))):n}class Qn extends Pt{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=Wt.objectKeys(t);return this._cached={shape:t,keys:a},this._cached}_parse(t){if(this._getType(t)!==Ke.object){const m=this._getOrReturnCtx(t);return Qe(m,{code:Te.invalid_type,expected:Ke.object,received:m.parsedType}),_t}const{status:l,ctx:c}=this._processInputParams(t),{shape:u,keys:f}=this._getCached(),p=[];if(!(this._def.catchall instanceof Yr&&this._def.unknownKeys==="strip"))for(const m in c.data)f.includes(m)||p.push(m);const y=[];for(const m of f){const S=u[m],g=c.data[m];y.push({key:{status:"valid",value:m},value:S._parse(new Ya(c,g,c.path,m)),alwaysSet:m in c.data})}if(this._def.catchall instanceof Yr){const m=this._def.unknownKeys;if(m==="passthrough")for(const S of p)y.push({key:{status:"valid",value:S},value:{status:"valid",value:c.data[S]}});else if(m==="strict")p.length>0&&(Qe(c,{code:Te.unrecognized_keys,keys:p}),l.dirty());else if(m!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const m=this._def.catchall;for(const S of p){const g=c.data[S];y.push({key:{status:"valid",value:S},value:m._parse(new Ya(c,g,c.path,S)),alwaysSet:S in c.data})}}return c.common.async?Promise.resolve().then(async()=>{const m=[];for(const S of y){const g=await S.key,x=await S.value;m.push({key:g,value:x,alwaysSet:S.alwaysSet})}return m}).then(m=>Cs.mergeObjectSync(l,m)):Cs.mergeObjectSync(l,y)}get shape(){return this._def.shape()}strict(t){return et.errToObj,new Qn({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(a,l)=>{var u,f;const c=((f=(u=this._def).errorMap)==null?void 0:f.call(u,a,l).message)??l.defaultError;return a.code==="unrecognized_keys"?{message:et.errToObj(t).message??c}:{message:c}}}:{}})}strip(){return new Qn({...this._def,unknownKeys:"strip"})}passthrough(){return new Qn({...this._def,unknownKeys:"passthrough"})}extend(t){return new Qn({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Qn({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:vt.ZodObject})}setKey(t,a){return this.augment({[t]:a})}catchall(t){return new Qn({...this._def,catchall:t})}pick(t){const a={};for(const l of Wt.objectKeys(t))t[l]&&this.shape[l]&&(a[l]=this.shape[l]);return new Qn({...this._def,shape:()=>a})}omit(t){const a={};for(const l of Wt.objectKeys(this.shape))t[l]||(a[l]=this.shape[l]);return new Qn({...this._def,shape:()=>a})}deepPartial(){return Bo(this)}partial(t){const a={};for(const l of Wt.objectKeys(this.shape)){const c=this.shape[l];t&&!t[l]?a[l]=c:a[l]=c.optional()}return new Qn({...this._def,shape:()=>a})}required(t){const a={};for(const l of Wt.objectKeys(this.shape))if(t&&!t[l])a[l]=this.shape[l];else{let u=this.shape[l];for(;u instanceof Qr;)u=u._def.innerType;a[l]=u}return new Qn({...this._def,shape:()=>a})}keyof(){return J2(Wt.objectKeys(this.shape))}}Qn.create=(n,t)=>new Qn({shape:()=>n,unknownKeys:"strip",catchall:Yr.create(),typeName:vt.ZodObject,...Nt(t)});Qn.strictCreate=(n,t)=>new Qn({shape:()=>n,unknownKeys:"strict",catchall:Yr.create(),typeName:vt.ZodObject,...Nt(t)});Qn.lazycreate=(n,t)=>new Qn({shape:n,unknownKeys:"strip",catchall:Yr.create(),typeName:vt.ZodObject,...Nt(t)});class ah extends Pt{_parse(t){const{ctx:a}=this._processInputParams(t),l=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 f=u.map(p=>new zi(p.ctx.common.issues));return Qe(a,{code:Te.invalid_union,unionErrors:f}),_t}if(a.common.async)return Promise.all(l.map(async u=>{const f={...a,common:{...a.common,issues:[]},parent:null};return{result:await u._parseAsync({data:a.data,path:a.path,parent:f}),ctx:f}})).then(c);{let u;const f=[];for(const y of l){const m={...a,common:{...a.common,issues:[]},parent:null},S=y._parseSync({data:a.data,path:a.path,parent:m});if(S.status==="valid")return S;S.status==="dirty"&&!u&&(u={result:S,ctx:m}),m.common.issues.length&&f.push(m.common.issues)}if(u)return a.common.issues.push(...u.ctx.common.issues),u.result;const p=f.map(y=>new zi(y));return Qe(a,{code:Te.invalid_union,unionErrors:p}),_t}}get options(){return this._def.options}}ah.create=(n,t)=>new ah({options:n,typeName:vt.ZodUnion,...Nt(t)});function M1(n,t){const a=Cr(n),l=Cr(t);if(n===t)return{valid:!0,data:n};if(a===Ke.object&&l===Ke.object){const c=Wt.objectKeys(t),u=Wt.objectKeys(n).filter(p=>c.indexOf(p)!==-1),f={...n,...t};for(const p of u){const y=M1(n[p],t[p]);if(!y.valid)return{valid:!1};f[p]=y.data}return{valid:!0,data:f}}else if(a===Ke.array&&l===Ke.array){if(n.length!==t.length)return{valid:!1};const c=[];for(let u=0;u<n.length;u++){const f=n[u],p=t[u],y=M1(f,p);if(!y.valid)return{valid:!1};c.push(y.data)}return{valid:!0,data:c}}else return a===Ke.date&&l===Ke.date&&+n==+t?{valid:!0,data:n}:{valid:!1}}class ih extends Pt{_parse(t){const{status:a,ctx:l}=this._processInputParams(t),c=(u,f)=>{if(D6(u)||D6(f))return _t;const p=M1(u.value,f.value);return p.valid?((O6(u)||O6(f))&&a.dirty(),{status:a.value,value:p.data}):(Qe(l,{code:Te.invalid_intersection_types}),_t)};return l.common.async?Promise.all([this._def.left._parseAsync({data:l.data,path:l.path,parent:l}),this._def.right._parseAsync({data:l.data,path:l.path,parent:l})]).then(([u,f])=>c(u,f)):c(this._def.left._parseSync({data:l.data,path:l.path,parent:l}),this._def.right._parseSync({data:l.data,path:l.path,parent:l}))}}ih.create=(n,t,a)=>new ih({left:n,right:t,typeName:vt.ZodIntersection,...Nt(a)});class ql extends Pt{_parse(t){const{status:a,ctx:l}=this._processInputParams(t);if(l.parsedType!==Ke.array)return Qe(l,{code:Te.invalid_type,expected:Ke.array,received:l.parsedType}),_t;if(l.data.length<this._def.items.length)return Qe(l,{code:Te.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),_t;!this._def.rest&&l.data.length>this._def.items.length&&(Qe(l,{code:Te.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),a.dirty());const u=[...l.data].map((f,p)=>{const y=this._def.items[p]||this._def.rest;return y?y._parse(new Ya(l,f,l.path,p)):null}).filter(f=>!!f);return l.common.async?Promise.all(u).then(f=>Cs.mergeArray(a,f)):Cs.mergeArray(a,u)}get items(){return this._def.items}rest(t){return new ql({...this._def,rest:t})}}ql.create=(n,t)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ql({items:n,typeName:vt.ZodTuple,rest:null,...Nt(t)})};class rh extends Pt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:a,ctx:l}=this._processInputParams(t);if(l.parsedType!==Ke.object)return Qe(l,{code:Te.invalid_type,expected:Ke.object,received:l.parsedType}),_t;const c=[],u=this._def.keyType,f=this._def.valueType;for(const p in l.data)c.push({key:u._parse(new Ya(l,p,l.path,p)),value:f._parse(new Ya(l,l.data[p],l.path,p)),alwaysSet:p in l.data});return l.common.async?Cs.mergeObjectAsync(a,c):Cs.mergeObjectSync(a,c)}get element(){return this._def.valueType}static create(t,a,l){return a instanceof Pt?new rh({keyType:t,valueType:a,typeName:vt.ZodRecord,...Nt(l)}):new rh({keyType:Li.create(),valueType:t,typeName:vt.ZodRecord,...Nt(a)})}}class $6 extends Pt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:a,ctx:l}=this._processInputParams(t);if(l.parsedType!==Ke.map)return Qe(l,{code:Te.invalid_type,expected:Ke.map,received:l.parsedType}),_t;const c=this._def.keyType,u=this._def.valueType,f=[...l.data.entries()].map(([p,y],m)=>({key:c._parse(new Ya(l,p,l.path,[m,"key"])),value:u._parse(new Ya(l,y,l.path,[m,"value"]))}));if(l.common.async){const p=new Map;return Promise.resolve().then(async()=>{for(const y of f){const m=await y.key,S=await y.value;if(m.status==="aborted"||S.status==="aborted")return _t;(m.status==="dirty"||S.status==="dirty")&&a.dirty(),p.set(m.value,S.value)}return{status:a.value,value:p}})}else{const p=new Map;for(const y of f){const m=y.key,S=y.value;if(m.status==="aborted"||S.status==="aborted")return _t;(m.status==="dirty"||S.status==="dirty")&&a.dirty(),p.set(m.value,S.value)}return{status:a.value,value:p}}}}$6.create=(n,t,a)=>new $6({valueType:t,keyType:n,typeName:vt.ZodMap,...Nt(a)});class qu extends Pt{_parse(t){const{status:a,ctx:l}=this._processInputParams(t);if(l.parsedType!==Ke.set)return Qe(l,{code:Te.invalid_type,expected:Ke.set,received:l.parsedType}),_t;const c=this._def;c.minSize!==null&&l.data.size<c.minSize.value&&(Qe(l,{code:Te.too_small,minimum:c.minSize.value,type:"set",inclusive:!0,exact:!1,message:c.minSize.message}),a.dirty()),c.maxSize!==null&&l.data.size>c.maxSize.value&&(Qe(l,{code:Te.too_big,maximum:c.maxSize.value,type:"set",inclusive:!0,exact:!1,message:c.maxSize.message}),a.dirty());const u=this._def.valueType;function f(y){const m=new Set;for(const S of y){if(S.status==="aborted")return _t;S.status==="dirty"&&a.dirty(),m.add(S.value)}return{status:a.value,value:m}}const p=[...l.data.values()].map((y,m)=>u._parse(new Ya(l,y,l.path,m)));return l.common.async?Promise.all(p).then(y=>f(y)):f(p)}min(t,a){return new qu({...this._def,minSize:{value:t,message:et.toString(a)}})}max(t,a){return new qu({...this._def,maxSize:{value:t,message:et.toString(a)}})}size(t,a){return this.min(t,a).max(t,a)}nonempty(t){return this.min(1,t)}}qu.create=(n,t)=>new qu({valueType:n,minSize:null,maxSize:null,typeName:vt.ZodSet,...Nt(t)});class H6 extends Pt{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})}}H6.create=(n,t)=>new H6({getter:n,typeName:vt.ZodLazy,...Nt(t)});class R1 extends Pt{_parse(t){if(t.data!==this._def.value){const a=this._getOrReturnCtx(t);return Qe(a,{received:a.data,code:Te.invalid_literal,expected:this._def.value}),_t}return{status:"valid",value:t.data}}get value(){return this._def.value}}R1.create=(n,t)=>new R1({value:n,typeName:vt.ZodLiteral,...Nt(t)});function J2(n,t){return new ic({values:n,typeName:vt.ZodEnum,...Nt(t)})}class ic extends Pt{_parse(t){if(typeof t.data!="string"){const a=this._getOrReturnCtx(t),l=this._def.values;return Qe(a,{expected:Wt.joinValues(l),received:a.parsedType,code:Te.invalid_type}),_t}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const a=this._getOrReturnCtx(t),l=this._def.values;return Qe(a,{received:a.data,code:Te.invalid_enum_value,options:l}),_t}return ga(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 ic.create(t,{...this._def,...a})}exclude(t,a=this._def){return ic.create(this.options.filter(l=>!t.includes(l)),{...this._def,...a})}}ic.create=J2;class q6 extends Pt{_parse(t){const a=Wt.getValidEnumValues(this._def.values),l=this._getOrReturnCtx(t);if(l.parsedType!==Ke.string&&l.parsedType!==Ke.number){const c=Wt.objectValues(a);return Qe(l,{expected:Wt.joinValues(c),received:l.parsedType,code:Te.invalid_type}),_t}if(this._cache||(this._cache=new Set(Wt.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const c=Wt.objectValues(a);return Qe(l,{received:l.data,code:Te.invalid_enum_value,options:c}),_t}return ga(t.data)}get enum(){return this._def.values}}q6.create=(n,t)=>new q6({values:n,typeName:vt.ZodNativeEnum,...Nt(t)});class lh extends Pt{unwrap(){return this._def.type}_parse(t){const{ctx:a}=this._processInputParams(t);if(a.parsedType!==Ke.promise&&a.common.async===!1)return Qe(a,{code:Te.invalid_type,expected:Ke.promise,received:a.parsedType}),_t;const l=a.parsedType===Ke.promise?a.data:Promise.resolve(a.data);return ga(l.then(c=>this._def.type.parseAsync(c,{path:a.path,errorMap:a.common.contextualErrorMap})))}}lh.create=(n,t)=>new lh({type:n,typeName:vt.ZodPromise,...Nt(t)});class rc extends Pt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===vt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:a,ctx:l}=this._processInputParams(t),c=this._def.effect||null,u={addIssue:f=>{Qe(l,f),f.fatal?a.abort():a.dirty()},get path(){return l.path}};if(u.addIssue=u.addIssue.bind(u),c.type==="preprocess"){const f=c.transform(l.data,u);if(l.common.async)return Promise.resolve(f).then(async p=>{if(a.value==="aborted")return _t;const y=await this._def.schema._parseAsync({data:p,path:l.path,parent:l});return y.status==="aborted"?_t:y.status==="dirty"||a.value==="dirty"?Cu(y.value):y});{if(a.value==="aborted")return _t;const p=this._def.schema._parseSync({data:f,path:l.path,parent:l});return p.status==="aborted"?_t:p.status==="dirty"||a.value==="dirty"?Cu(p.value):p}}if(c.type==="refinement"){const f=p=>{const y=c.refinement(p,u);if(l.common.async)return Promise.resolve(y);if(y instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return p};if(l.common.async===!1){const p=this._def.schema._parseSync({data:l.data,path:l.path,parent:l});return p.status==="aborted"?_t:(p.status==="dirty"&&a.dirty(),f(p.value),{status:a.value,value:p.value})}else return this._def.schema._parseAsync({data:l.data,path:l.path,parent:l}).then(p=>p.status==="aborted"?_t:(p.status==="dirty"&&a.dirty(),f(p.value).then(()=>({status:a.value,value:p.value}))))}if(c.type==="transform")if(l.common.async===!1){const f=this._def.schema._parseSync({data:l.data,path:l.path,parent:l});if(!sc(f))return _t;const p=c.transform(f.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:l.data,path:l.path,parent:l}).then(f=>sc(f)?Promise.resolve(c.transform(f.value,u)).then(p=>({status:a.value,value:p})):_t);Wt.assertNever(c)}}rc.create=(n,t,a)=>new rc({schema:n,typeName:vt.ZodEffects,effect:t,...Nt(a)});rc.createWithPreprocess=(n,t,a)=>new rc({schema:t,effect:{type:"preprocess",transform:n},typeName:vt.ZodEffects,...Nt(a)});class Qr extends Pt{_parse(t){return this._getType(t)===Ke.undefined?ga(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Qr.create=(n,t)=>new Qr({innerType:n,typeName:vt.ZodOptional,...Nt(t)});class lc extends Pt{_parse(t){return this._getType(t)===Ke.null?ga(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}lc.create=(n,t)=>new lc({innerType:n,typeName:vt.ZodNullable,...Nt(t)});class A1 extends Pt{_parse(t){const{ctx:a}=this._processInputParams(t);let l=a.data;return a.parsedType===Ke.undefined&&(l=this._def.defaultValue()),this._def.innerType._parse({data:l,path:a.path,parent:a})}removeDefault(){return this._def.innerType}}A1.create=(n,t)=>new A1({innerType:n,typeName:vt.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Nt(t)});class D1 extends Pt{_parse(t){const{ctx:a}=this._processInputParams(t),l={...a,common:{...a.common,issues:[]}},c=this._def.innerType._parse({data:l.data,path:l.path,parent:{...l}});return nh(c)?c.then(u=>({status:"valid",value:u.status==="valid"?u.value:this._def.catchValue({get error(){return new zi(l.common.issues)},input:l.data})})):{status:"valid",value:c.status==="valid"?c.value:this._def.catchValue({get error(){return new zi(l.common.issues)},input:l.data})}}removeCatch(){return this._def.innerType}}D1.create=(n,t)=>new D1({innerType:n,typeName:vt.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Nt(t)});class F6 extends Pt{_parse(t){if(this._getType(t)!==Ke.nan){const l=this._getOrReturnCtx(t);return Qe(l,{code:Te.invalid_type,expected:Ke.nan,received:l.parsedType}),_t}return{status:"valid",value:t.data}}}F6.create=n=>new F6({typeName:vt.ZodNaN,...Nt(n)});class Sx extends Pt{_parse(t){const{ctx:a}=this._processInputParams(t),l=a.data;return this._def.type._parse({data:l,path:a.path,parent:a})}unwrap(){return this._def.type}}class m0 extends Pt{_parse(t){const{status:a,ctx:l}=this._processInputParams(t);if(l.common.async)return(async()=>{const u=await this._def.in._parseAsync({data:l.data,path:l.path,parent:l});return u.status==="aborted"?_t:u.status==="dirty"?(a.dirty(),Cu(u.value)):this._def.out._parseAsync({data:u.value,path:l.path,parent:l})})();{const c=this._def.in._parseSync({data:l.data,path:l.path,parent:l});return c.status==="aborted"?_t:c.status==="dirty"?(a.dirty(),{status:"dirty",value:c.value}):this._def.out._parseSync({data:c.value,path:l.path,parent:l})}}static create(t,a){return new m0({in:t,out:a,typeName:vt.ZodPipeline})}}class O1 extends Pt{_parse(t){const a=this._def.innerType._parse(t),l=c=>(sc(c)&&(c.value=Object.freeze(c.value)),c);return nh(a)?a.then(c=>l(c)):l(a)}unwrap(){return this._def.innerType}}O1.create=(n,t)=>new O1({innerType:n,typeName:vt.ZodReadonly,...Nt(t)});var vt;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(vt||(vt={}));const M=Li.create,rt=ac.create,Kt=E1.create,jx=T1.create;Yr.create;const bt=Wa.create,Le=Qn.create;ah.create;ih.create;ql.create;const oh=rh.create,ad=R1.create,zt=ic.create;lh.create;Qr.create;lc.create;const e3=zt(["codex","claude"]),wx=zt(["managed","attached-live","history-only"]),kx=zt(["active","idle","attention","offline"]),t3=zt(["idle","running","completed"]),n3=zt(["image","file"]),Nx=zt(["user","repo","system","admin"]),Cx=Le({can_stream_live:Kt(),can_send_input:Kt(),can_interrupt:Kt(),can_approve:Kt(),can_reject:Kt(),can_show_git:Kt(),can_show_terminal:Kt()}),s3=Le({used_tokens:rt(),total_tokens:rt(),remaining_tokens:rt(),percent_used:rt(),cached_input_tokens:rt(),output_tokens:rt(),reasoning_output_tokens:rt(),updated_at:M()}),Ex=zt(["pending","in_progress","completed"]),Tx=Le({id:M(),step:M(),status:Ex}),a3=Le({session_id:M(),turn_id:M().nullable(),source:zt(["rollout","app-server"]),updated_at:M(),explanation:M().nullable().default(null),steps:bt(Tx),completed_count:rt().int().nonnegative(),total_count:rt().int().nonnegative(),is_active:Kt()}),Mx=Le({parent_session_id:M(),root_session_id:M().nullable().default(null),nickname:M().nullable().default(null),role:M().nullable().default(null),depth:rt().int().nonnegative()}),Rx=zt(["user_input","command_execution_approval","file_change_approval","permissions_approval","mcp_elicitation"]),Ax=zt(["pending","submitting","resolved"]),i3=Le({id:M(),label:M(),description:M().nullable().default(null),emphasis:zt(["default","primary","danger"]).default("default")}),Dx=Le({id:M(),header:M().nullable().default(null),question:M(),options:bt(i3).default([]),allow_other:Kt().default(!1),is_secret:Kt().default(!1)}),r3=Le({id:M(),session_id:M(),turn_id:M().nullable().default(null),item_id:M().nullable().default(null),kind:Rx,status:Ax,title:M(),description:M().nullable().default(null),created_at:M(),updated_at:M(),options:bt(i3).default([]),questions:bt(Dx).default([]),allow_freeform:Kt().default(!1),freeform_placeholder:M().nullable().default(null),submit_label:M().nullable().default(null)}),Ox=Le({id:M(),kind:n3,name:M().nullable().default(null),mime_type:M().nullable().default(null),size_bytes:rt().int().nonnegative().nullable().default(null),content_url:M().nullable().default(null)}),Q6=Le({id:M(),kind:n3,name:M(),mime_type:M().nullable().default(null),size_bytes:rt().int().nonnegative().nullable().default(null),data_url:M()}),Lx=Le({name:M(),description:M(),path:M(),scope:Nx,enabled:Kt()}),Ix=zt(["supported","unsupported"]),Px=Le({name:M(),description:M(),availability:Ix.default("supported")}),G6=Le({cli_version:M().nullable().default(null),loaded_at:M(),cache_ttl_ms:rt().int().nonnegative(),commands:bt(Px)});Le({id:M(),label:M(),description:M(),isDefault:Kt(),defaultReasoningEffort:M().nullable().default(null),supportedReasoningEfforts:bt(M()).default([])});const zx=zt(["running","awaiting_input","completed","failed"]),Bx=zt(["none","choice","text"]),Ux=Le({id:M(),label:M(),description:M().nullable().default(null)}),$x=Le({type:ad("set_session_model"),model:M(),reasoning_effort:M().nullable().default(null)}).nullable().default(null),Hx=Le({panel_id:M(),session_id:M(),command_name:M(),command_text:M(),title:M(),description:M().nullable().default(null),status:zx,body:M(),submitted_at:M(),updated_at:M(),input_type:Bx,options:bt(Ux).default([]),input_placeholder:M().nullable().default(null),submit_label:M().nullable().default(null),effect:$x}),W6=Le({panel:Hx}),l3=Le({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:zt(["online","offline"]),provider_availability:bt(e3),project_count:rt(),session_count:rt(),transport:zt(["direct-agent","hub-routed"]),version:M().nullable().default(null),registered_at:M().nullable().default(null),last_seen_at:M().nullable().default(null)}),o3=Le({id:M(),agent_id:M(),name:M(),display_name:M().nullable(),pinned:Kt(),path:M(),branch:M(),worktree:M(),runtime_profiles:bt(M()),preview_url:M().nullable()}),c3=Le({id:M(),agent_id:M(),project_id:M(),provider:e3,archived:Kt(),title:M(),mode:wx,health:kx,branch:M(),worktree:M(),summary:M(),latest_assistant_message:M().nullable().default(null),last_event_at:M(),pinned:Kt(),run_state:t3,run_state_changed_at:M().nullable(),context_usage:s3.nullable().default(null),subagent:Mx.nullable().default(null),capability:Cx}),p0=Le({id:M(),kind:zt(["user","assistant","thinking","tool","system"]),title:M(),body:M(),timestamp:M(),accent:zt(["primary","secondary","muted"]),attachments:bt(Ox).default([])}),qx=zt(["app-server","rollout-fallback"]),Fx=zt(["running","completed"]),Qx=zt(["add","delete","update"]),Gx=Le({path:M(),kind:Qx,move_path:M().nullable(),additions:rt(),deletions:rt(),diff:M(),item_id:M().nullable()}),u3=Le({id:M(),session_id:M(),turn_id:M(),source:qx,status:Fx,started_at:M(),completed_at:M().nullable(),updated_at:M(),aggregated_diff:M(),files:bt(Gx)}),Wx=Le({path:M(),status:zt(["modified","added","deleted","renamed"]),additions:rt(),deletions:rt()}),d3=zt(["modified","added","deleted","renamed","untracked"]),Yx=Le({path:M(),previous_path:M().nullable().default(null),status:d3,additions:rt().int().nonnegative(),deletions:rt().int().nonnegative()}),Vx=Le({session_id:M(),project_id:M(),path:M(),previous_path:M().nullable().default(null),additions:rt().int().nonnegative(),deletions:rt().int().nonnegative(),diff:M()}),f3=Le({session_id:M(),project_id:M(),branch:M(),branches:bt(M()),upstream_branch:M().nullable().default(null),ahead_count:rt().int().nonnegative(),behind_count:rt().int().nonnegative(),files:bt(Yx),updated_at:M()}),Kx=Le({path:M(),previous_path:M().nullable().default(null),status:d3}),Zx=Le({oid:M(),short_oid:M(),subject:M(),author_name:M(),authored_at:M(),committed_at:M(),parent_oids:bt(M()).default([]),refs:bt(M()).default([]),files:bt(Kx)}),Xx=Le({session_id:M(),project_id:M(),commit_oid:M(),path:M(),previous_path:M().nullable().default(null),additions:rt().int().nonnegative(),deletions:rt().int().nonnegative(),diff:M()}),Jx=Le({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:bt(Zx),updated_at:M()});zt(["discard-file","discard-all","commit-all","switch-branch","push"]);const e7=Le({ok:ad(!0),workspace:f3}),h3=zt(["auto","powershell","cmd","bash"]),t7=zt(["user","codex"]),n7=Le({id:M(),name:M(),description:M().nullable().default(null),command:M(),kill_command:M().nullable().default(null),cwd:M().nullable().default(null),shell:h3.default("auto"),node_version:M().nullable().default(null),port:rt().int().positive().nullable().default(null),source:t7.default("user"),created_at:M(),updated_at:M()}),s7=Le({name:M(),description:M().nullable().default(null),command:M(),kill_command:M().nullable().default(null),cwd:M().nullable().default(null),shell:h3.default("auto"),node_version:M().nullable().default(null),port:rt().int().positive().nullable().default(null)}),g0=Le({session_id:M(),project_id:M(),config_path:M(),commands:bt(n7),updated_at:M()}),a7=zt(["user","codex"]),i7=Le({id:M(),name:M(),description:M().nullable().default(null),url:M(),source:a7.default("user"),created_at:M(),updated_at:M()}),r7=Le({name:M(),description:M().nullable().default(null),url:M()}),y0=Le({session_id:M(),project_id:M(),config_path:M(),websites:bt(i7),updated_at:M()}),l7=zt(["queued","running","completed","failed","stopped"]),o7=zt(["stdout","stderr","system"]),c7=Le({cursor:rt().int().nonnegative(),stream:o7,text:M(),timestamp:M()}),v0=Le({id:M(),session_id:M(),project_id:M(),command_id:M().nullable().default(null),title:M(),command:M(),cwd:M(),status:l7,exit_code:rt().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:rt().int().nonnegative(),preview:M().nullable().default(null)}),_0=Le({session_id:M(),project_id:M(),active_terminal_id:M().nullable().default(null),terminals:bt(v0),updated_at:M()}),u7=Le({session_id:M(),project_id:M(),terminal:v0,chunks:bt(c7),next_cursor:rt().int().nonnegative(),truncated:Kt().default(!1)}),d7=Le({run_state:t3.optional(),run_state_changed_at:M().nullable().optional(),summary:M().optional(),latest_assistant_message:M().nullable().optional(),last_event_at:M().optional(),context_usage:s3.nullable().optional()}),f7=Le({session_id:M(),recovered_at:M(),session_patch:d7,timeline:bt(p0),interactions:bt(r3),plan_snapshot:a3.nullable().default(null),change_sets:bt(u3),terminal_snapshot:_0.nullable().default(null)}),h7=Le({manager:zt(["none","nvm-windows"]).default("none"),versions:bt(M()).default([]),error:M().nullable().default(null)}),m7=Le({command_catalog:g0,website_catalog:y0,node_runtime:h7,terminal_snapshot:_0}),p7=Le({catalog:g0}),g7=Le({catalog:y0}),y7=Le({commands:bt(s7),reason:M().nullable().default(null)}),v7=Le({generation:y7,catalog:g0}),_7=Le({websites:bt(r7),reason:M().nullable().default(null)}),b7=Le({generation:_7,catalog:y0}),x7=Le({snapshot:_0,terminal:v0.nullable().default(null)}),S7=Le({id:M(),name:M(),command:M(),port:rt().nullable(),status:zt(["running","stopped","degraded"]),log_excerpt:M()}),j7=Le({id:M(),label:M(),url:M(),status:zt(["ready","starting","stopped"])}),w7=Le({path:M(),name:M(),has_children:Kt()}),k7=Le({id:M(),title:M(),description:M(),status:zt(["pending","approved","rejected"])}),N7=Le({generated_at:M(),agents:bt(l3),projects:bt(o3),sessions:bt(c3),active_session_id:M(),timeline:bt(p0),changed_files:bt(Wx),runtime_processes:bt(S7),previews:bt(j7),approvals:bt(k7)});Le({agent:l3,projects:bt(o3),sessions:bt(c3),active_session_id:M().default(""),generated_at:M()});const Y6=Le({ok:ad(!0),agent_id:M(),heartbeat_interval_ms:rt().int().positive(),heartbeat_timeout_ms:rt().int().positive(),registered_at:M(),received_at:M()}),b0=Le({completion_notifications_enabled:Kt().default(!1)}),C7=Le({p256dh:M(),auth:M()}),E7=Le({endpoint:M().url(),expirationTime:rt().nullable().default(null),keys:C7}),T7=Le({label:M().nullable().default(null),user_agent:M().nullable().default(null)});Le({subscription:E7,settings:b0.default({}),device:T7.default({})});const M7=Le({endpoint:M().url()}),R7=Le({endpoint:M().url()}),A7=Le({supported:Kt(),vapid_public_key:M().nullable().default(null),subject:M().nullable().default(null),reason:M().nullable().default(null)}),D7=Le({ok:ad(!0),subscription_id:M(),endpoint:M().url(),settings:b0,created_at:M(),updated_at:M()}),O7=Le({ok:ad(!0),endpoint:M().url(),delivered_at:M()}),L7=Le({type:zt(["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:oh(jx())}),I7=Le({width:rt().nonnegative(),height:rt().nonnegative(),device_pixel_ratio:rt().nonnegative(),visual_width:rt().nonnegative().nullable().default(null),visual_height:rt().nonnegative().nullable().default(null),screen_width:rt().nonnegative().nullable().default(null),screen_height:rt().nonnegative().nullable().default(null)}),P7=Le({user_agent:M(),language:M().nullable().default(null),languages:bt(M()).default([]),platform:M().nullable().default(null),vendor:M().nullable().default(null),online:Kt().nullable().default(null),cookie_enabled:Kt().nullable().default(null),secure_context:Kt(),standalone_display_mode:Kt(),hardware_concurrency:rt().int().nonnegative().nullable().default(null),device_memory_gb:rt().nonnegative().nullable().default(null),max_touch_points:rt().int().nonnegative().nullable().default(null)}),z7=Le({href:M(),pathname:M(),referrer:M().nullable().default(null),visibility_state:M().nullable().default(null)}),B7=Le({scope:M(),active_script_url:M().nullable().default(null),waiting_script_url:M().nullable().default(null),installing_script_url:M().nullable().default(null)}),U7=Le({supported:Kt(),controller:Kt(),registrations:bt(B7).default([])}),$7=Le({supported:Kt(),keys:bt(M()).default([])}),H7=Le({href:M().nullable().default(null),rel:M().nullable().default(null)}),q7=Le({href:M().nullable().default(null),owner_node:M().nullable().default(null),media:M().nullable().default(null),disabled:Kt(),css_rule_count:rt().int().nonnegative().nullable().default(null)}),F7=Le({url:M(),kind:zt(["stylesheet","script","manifest","icon","other"]),ok:Kt(),status:rt().int().nonnegative().nullable().default(null),content_type:M().nullable().default(null),cache_control:M().nullable().default(null),error:M().nullable().default(null)}),Q7=Le({name:M(),initiator_type:M().nullable().default(null),duration_ms:rt().nonnegative().nullable().default(null),transfer_size:rt().nonnegative().nullable().default(null),decoded_body_size:rt().nonnegative().nullable().default(null)}),G7=Le({x:rt(),y:rt(),width:rt().nonnegative(),height:rt().nonnegative()}),W7=Le({selector:M(),found:Kt(),text_preview:M().nullable().default(null),rect:G7.nullable().default(null),computed:oh(M()).default({})});Le({captured_at:M(),page:z7,environment:P7,viewport:I7,feature_support:oh(Kt()).default({}),service_worker:U7,cache:$7,manifest:H7,stylesheets:bt(q7).default([]),resource_probes:bt(F7).default([]),performance_entries:bt(Q7).default([]),theme_variables:oh(M()).default({}),element_snapshots:bt(W7).default([]),notes:bt(M()).default([])});const Y7=/^(?:image|img|photo|picture|screenshot|图片|照片|截图)(?:[-_ ]?\d+)?\.(?:avif|bmp|gif|heic|heif|jpe?g|png|svg|webp)$/i,us=n=>(n==null?void 0:n.trim())??"",V6="\0",K6=n=>{const t=us(n);return t?Y7.test(t)?1:2+Math.min(t.length,64)/100:0},V7=(n,t)=>{const a=K6(n),l=K6(t);if(l>a)return us(t)||null;if(a>l)return us(n)||null;const c=us(n),u=us(t);return u.length>c.length?u||null:c||null},K7=n=>{const t=us(n.content_url);return t?[n.kind,"content",t].join(V6):[n.kind,"meta",us(n.mime_type).toLowerCase(),typeof n.size_bytes=="number"&&Number.isFinite(n.size_bytes)?String(Math.max(0,Math.round(n.size_bytes))):"",us(n.name).toLowerCase()].join(V6)},Z7=(n,t)=>{const a=us(n.name),l=us(t.name),c=us(n.mime_type),u=us(t.mime_type);return{id:n.id||t.id,kind:n.kind==="image"||t.kind==="image"?"image":n.kind,name:V7(a,l),mime_type:c||u||null,size_bytes:n.size_bytes??t.size_bytes??null,content_url:us(n.content_url)||us(t.content_url)||null}},m3=n=>{if(!n||n.length===0)return[];const t=[],a=new Map;for(const l of n){const c=K7(l),u=a.get(c);if(u===void 0){a.set(c,t.length),t.push({...l,name:us(l.name)||null,mime_type:us(l.mime_type)||null,size_bytes:typeof l.size_bytes=="number"&&Number.isFinite(l.size_bytes)?Math.max(0,Math.round(l.size_bytes)):null,content_url:us(l.content_url)||null});continue}t[u]=Z7(t[u],l)}return t},p3=(n,t)=>m3([...n??[],...t??[]]),Hs=n=>new Date(n).toISOString(),X7=()=>({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:Hs("2026-03-18T10:30:00+08:00"),last_seen_at:Hs("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:Hs("2026-03-18T10:20:00+08:00"),last_seen_at:Hs("2026-03-18T10:55:00+08:00")}],projects:[{id:"project-panda",agent_id:"agent-shanghai-main",name:"panda",display_name:null,pinned:!1,path:"D:/ai/panda",branch:"main",worktree:"default",runtime_profiles:["dev","storybook","test"],preview_url:"https://panda.tailnet.ts.net"},{id:"project-remodex-lab",agent_id:"agent-shanghai-main",name:"remodex",display_name:null,pinned:!1,path:"D:/ai/remodex",branch:"phase1-ui",worktree:"mobile-lab",runtime_profiles:["dev"],preview_url:null},{id:"project-notes",agent_id:"agent-macbook",name:"notes",display_name:null,pinned:!1,path:"D:/Users/dev/notes",branch:"research",worktree:"default",runtime_profiles:["dev"],preview_url:null}],sessions:[{id:"session-managed-1",agent_id:"agent-shanghai-main",project_id:"project-panda",provider:"codex",archived:!1,title:"Stage 1 buildout",mode:"managed",health:"active",branch:"main",worktree:"default",summary:"Monorepo scaffold, PWA shell, agent bootstrap API",latest_assistant_message:"Wiring the shell.",last_event_at:Hs("2026-03-18T10:58:00+08:00"),pinned:!1,run_state:"running",run_state_changed_at:Hs("2026-03-18T10:57:20+08:00"),context_usage:null,subagent:null,capability:{can_stream_live:!0,can_send_input:!0,can_interrupt:!0,can_approve:!0,can_reject:!0,can_show_git:!0,can_show_terminal:!0}},{id:"session-live-2",agent_id:"agent-shanghai-main",project_id:"project-remodex-lab",provider:"codex",archived:!1,title:"Remote attach",mode:"attached-live",health:"idle",branch:"phase1-ui",worktree:"mobile-lab",summary:"",latest_assistant_message:null,last_event_at:Hs("2026-03-18T10:48:00+08:00"),pinned:!1,run_state:"completed",run_state_changed_at:Hs("2026-03-18T10:48:00+08:00"),context_usage:null,subagent:null,capability:{can_stream_live:!0,can_send_input:!1,can_interrupt:!1,can_approve:!1,can_reject:!1,can_show_git:!0,can_show_terminal:!0}},{id:"session-history-3",agent_id:"agent-macbook",project_id:"project-notes",provider:"codex",archived:!1,title:"Research notes",mode:"history-only",health:"offline",branch:"research",worktree:"default",summary:"",latest_assistant_message:null,last_event_at:Hs("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:Hs("2026-03-18T10:40:00+08:00"),accent:"muted",attachments:[]},{id:"entry-2",kind:"user",title:"Prompt",body:"Start stage one.",timestamp:Hs("2026-03-18T10:44:00+08:00"),accent:"primary",attachments:[]},{id:"entry-3",kind:"thinking",title:"Plan",body:"Aligning routes and session state.",timestamp:Hs("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:Hs("2026-03-18T10:48:00+08:00"),accent:"secondary",attachments:[]},{id:"entry-5",kind:"assistant",title:"Focus",body:"Wiring the shell.",timestamp:Hs("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"}]}),J7=()=>X7(),eS=()=>J7(),g3=n=>{const t=new URL(n);return t.protocol=t.protocol==="https:"?"wss:":"ws:",t.pathname="/ws",t.toString()};class tS{constructor(t,a=g3(t)){this.baseUrl=t,this.wsBaseUrl=a}async readJson(t,a){const l=await fetch(t);if(!l.ok)throw new Error(`Request failed with ${l.status}`);return a.parse(await l.json())}async postJson(t,a,l){const 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 l?l.parse(u):u}async getPhaseOneSnapshot(t){const{fallbackToMock:a=!0,fallbackSnapshot:l=eS}=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 N7.parse(u)}catch(c){if(!a)throw c;return l()}}async getSessionTimeline(t){return await this.readJson(new URL(`/api/sessions/${t}/timeline`,this.baseUrl),{parse:l=>Array.isArray(l)?l.map(c=>p0.parse(c)):[]})}async getSessionChangeSets(t){return this.readJson(new URL(`/api/sessions/${t}/change-sets`,this.baseUrl),{parse:a=>Array.isArray(a)?a.map(l=>u3.parse(l)):[]})}async getSessionGitWorkspace(t){return this.readJson(new URL(`/api/sessions/${t}/git-workspace`,this.baseUrl),f3)}async getSessionGitWorkspaceFileDiff(t,a){const l=new URL(`/api/sessions/${t}/git-workspace/file-diff`,this.baseUrl);return l.searchParams.set("path",a.path),a.previousPath&&l.searchParams.set("previousPath",a.previousPath),this.readJson(l,Vx)}async getSessionGitHistory(t){return this.readJson(new URL(`/api/sessions/${t}/git/history`,this.baseUrl),Jx)}async getSessionGitHistoryFileDiff(t,a){const l=new URL(`/api/sessions/${t}/git/history/file-diff`,this.baseUrl);return l.searchParams.set("commitOid",a.commitOid),l.searchParams.set("path",a.path),a.previousPath&&l.searchParams.set("previousPath",a.previousPath),this.readJson(l,Xx)}async getSessionRunWorkbench(t){return this.readJson(new URL(`/api/sessions/${t}/run-workbench`,this.baseUrl),m7)}async saveSessionRunCommand(t){return this.postJson(`/api/sessions/${t.sessionId}/run-commands`,{action:t.action,commandId:t.commandId??null,command:t.command??null},p7)}async generateSessionRunCommand(t){return this.postJson(`/api/sessions/${t.sessionId}/run-commands/generate`,{prompt:t.prompt,model:t.model},v7)}async saveSessionRunWebsite(t){return this.postJson(`/api/sessions/${t.sessionId}/run-websites`,{action:t.action,websiteId:t.websiteId??null,website:t.website??null},g7)}async generateSessionRunWebsite(t){return this.postJson(`/api/sessions/${t.sessionId}/run-websites/generate`,{prompt:t.prompt,model:t.model},b7)}async executeSessionTerminalAction(t){return this.postJson(`/api/sessions/${t.sessionId}/terminals`,{action:t.action,commandId:t.commandId??null,terminalId:t.terminalId??null},x7)}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,u7)}async getSessionPlan(t){return this.readJson(new URL(`/api/sessions/${t}/plan`,this.baseUrl),{parse:a=>a==null?null:a3.parse(a)})}async getSessionInteractions(t){return this.readJson(new URL(`/api/sessions/${t}/interactions`,this.baseUrl),{parse:a=>Array.isArray(a)?a.map(l=>r3.parse(l)):[]})}async getSessionRecoverySnapshot(t){return this.readJson(new URL(`/api/sessions/${t}/recovery`,this.baseUrl),f7)}async getProjectSkills(t){return this.readJson(new URL(`/api/projects/${t}/skills`,this.baseUrl),{parse:a=>Array.isArray(a)?a.map(l=>Lx.parse(l)):[]})}async getCodexCommands(){return this.readJson(new URL("/api/codex/commands",this.baseUrl),G6)}async refreshCodexCommands(){return this.postJson("/api/codex/commands/refresh",{},G6)}async listDirectories(t){const a=new URL("/api/directories",this.baseUrl);return t.agentId&&a.searchParams.set("agentId",t.agentId),t.path&&a.searchParams.set("path",t.path),this.readJson(a,{parse:l=>Array.isArray(l)?l.map(c=>w7.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(l=>Q6.parse(l)),serviceTier:t.serviceTier,planMode:t.planMode,yoloMode:t.yoloMode})}async updateSession(t){return this.postJson(`/api/sessions/${t.sessionId}/actions`,{action:t.action,name:t.name})}async updateThread(t){return this.postJson(`/api/threads/${t.projectId}/actions`,{action:t.action,name:t.name,orderedProjectIds:t.orderedProjectIds})}async sendSessionInput(t){var a;return this.postJson(`/api/sessions/${t.sessionId}/input`,{input:t.input,attachments:(a=t.attachments)==null?void 0:a.map(l=>Q6.parse(l)),model:t.model,reasoningEffort:t.reasoningEffort,serviceTier:t.serviceTier,planMode:t.planMode,yoloMode:t.yoloMode})}async executeSessionCommand(t){return this.postJson(`/api/sessions/${t.sessionId}/commands/execute`,{input:t.input},W6)}async respondToSessionCommand(t){return this.postJson(`/api/sessions/${t.sessionId}/commands/respond`,{panelId:t.panelId,optionId:t.optionId??null,text:t.text??null},W6)}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,Y6)}async heartbeatAgent(t){return this.postJson("/api/agents/heartbeat",t,Y6)}async getWebPushPublicConfig(){return this.readJson(new URL("/api/push/public-key",this.baseUrl),A7)}async upsertWebPushSubscription(t){return this.postJson("/api/push/subscriptions",{subscription:t.subscription,settings:b0.parse(t.settings),device:t.device??null},D7)}async removeWebPushSubscription(t){return this.postJson("/api/push/subscriptions/remove",M7.parse(t))}async sendWebPushTest(t){return this.postJson("/api/push/test",R7.parse(t),O7)}async executeSessionGitAction(t){return this.postJson(`/api/sessions/${t.sessionId}/git/actions`,{action:t.action,path:t.path,branch:t.branch,message:t.message},e7)}connectEvents(t,a){let p=null,y="",m=!1,S=0,g=null,x=!1,j=!1,k=!1,E=0;const N=typeof document<"u"&&typeof document.visibilityState=="string",P=()=>N&&document.visibilityState==="hidden",H=(a==null?void 0:a.reconnectWhenHidden)===!0,U=pe=>(pe==null?void 0:pe.readyState)===WebSocket.OPEN||(pe==null?void 0:pe.readyState)===WebSocket.CONNECTING,R=()=>{g!==null&&(globalThis.clearTimeout(g),g=null)},q=(pe,Y)=>{var ne;(ne=a==null?void 0:a.onStatus)==null||ne.call(a,{state:pe,attempt:S,maxAttempts:5,error:Y})},re=pe=>{if(m||x)return;if(!H&&P()){x=!1,k=!0,R(),q("failed",pe);return}if(S+=1,!H&&S>5){S=5,k=!0,q("failed",pe);return}x=!0,k=!1,q("reconnecting",pe),R();const Y=H?Math.min(S,5):S,ne=Math.min(1e4,1200*2**Math.max(0,Y-1));g=globalThis.setTimeout(()=>{x=!1,V()},ne)},V=()=>{if(m||U(p))return;R(),x=!1,k=!1;const pe=new WebSocket(this.wsBaseUrl);p=pe,pe.addEventListener("open",()=>{var ne;if(m||p!==pe)return;x=!1,j=!1,S=0,q("connected");const Y=(ne=a==null?void 0:a.sessionId)==null?void 0:ne.trim();Y&&(y=Y,p==null||p.send(JSON.stringify({type:"session.subscribe",sessionId:Y})))}),pe.addEventListener("message",Y=>{if(p!==pe)return;const ne=L7.safeParse(JSON.parse(Y.data));ne.success&&t(ne.data)}),pe.addEventListener("error",()=>{if(m||p!==pe)return;const Y=`无法连接到 ${this.wsBaseUrl}`;pe.readyState!==WebSocket.OPEN&&re(Y)}),pe.addEventListener("close",Y=>{var T;if(p===pe&&(p=null),m||p!==null)return;const ne=((T=Y.reason)==null?void 0:T.trim())||`WebSocket 已断开(code ${Y.code||"unknown"})`;re(ne)})},ee=pe=>{if(m||U(p)||j)return;const Y=Date.now();Y-E<1500||(E=Y,j=!0,S=0,x=!1,k=!1,R(),q("reconnecting",pe),V())},Z=()=>{document.visibilityState==="visible"&&(k||!U(p))&&ee("应用回到前台,正在恢复连接")},W=()=>{(k||!U(p))&&ee("页面恢复显示,正在恢复连接")},F=()=>{(k||!U(p))&&ee("窗口重新聚焦,正在恢复连接")},be=()=>{(k||!U(p))&&ee("网络已恢复,正在重新连接")};return typeof window<"u"&&(window.addEventListener("pageshow",W),window.addEventListener("focus",F),window.addEventListener("online",be)),typeof document<"u"&&document.addEventListener("visibilitychange",Z),V(),()=>{m=!0,x=!1,j=!1,k=!1,R(),typeof window<"u"&&(window.removeEventListener("pageshow",W),window.removeEventListener("focus",F),window.removeEventListener("online",be)),typeof document<"u"&&document.removeEventListener("visibilitychange",Z),y&&(p==null?void 0:p.readyState)===WebSocket.OPEN&&p.send(JSON.stringify({type:"session.unsubscribe",sessionId:y})),p==null||p.close()}}}const ch=(n,t)=>new tS(n,(t==null?void 0:t.wsBaseUrl)??g3(n)),nS=new Set(["4173","4174"]),sS=new Set(["localhost","127.0.0.1","::1"]),aS=()=>typeof window>"u"?null:window.location.origin||null,y3=n=>{if(typeof window>"u")return`http://localhost:${n}`;const t=window.location.protocol==="https:"?"https:":"http:",a=window.location.hostname||"localhost";return`${t}//${a}:${n}`},iS=()=>{const n=aS();if(!n)return"http://localhost:4343";const t=window.location.port.trim();return nS.has(t)?y3(4343):n},x0=y3(4242),fc=iS(),S0={direct:ch(x0),hub:ch(fc)},rS={direct:"Agent 直连",hub:"Hub 聚合"},lS=1e4,oS=1e4,v3=1e4,cS=1e4;let qp=null,Z6=0,yu=null,Fp=null,X6=0,vu=null,Qp=null,J6=0,_u=null;const ey=new Map,Gp=new Map,Wp=new Map,Ii=n=>(n==null?void 0:n.trim())??"",_3=n=>{const t=(n==null?void 0:n.trim())??"";return t?t.replace(/^\[|\]$/g,"").replace(/\.+$/,"").toLowerCase():""},uS=n=>sS.has(_3(n)),b3=n=>{const t=(n==null?void 0:n.trim())??"";if(!t)return"";try{const a=new URL(t),l=_3(a.hostname);return l&&(a.hostname=l),a.toString().replace(/\/+$/,"")}catch{return t}},dS=()=>typeof window>"u"?!1:uS(window.location.hostname),Sh=async n=>{const t=n.trim();if(!t)return!1;const a=Wp.get(t),l=Date.now();if(a&&l-a.checkedAt<cS)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 Wp.set(t,{reachable:p,checkedAt:Date.now()}),p}catch{return Wp.set(t,{reachable:!1,checkedAt:Date.now()}),!1}finally{clearTimeout(u)}},L1=n=>({mode:n,label:rS[n],baseUrl:n==="hub"?fc:x0,client:S0[n]}),x3=n=>b3(n.direct_base_url),fS=n=>b3(n.ws_base_url),ty=n=>{const t=x3(n)||n.tailscale_dns_name||n.tailscale_ip||n.host;return`无法直连节点 ${n.name}(${t})。请确认当前浏览器已加入 Tailscale 网络,且目标 agent 在线。`},hS=async()=>{if(!dS())return null;const n=Date.now();if(Qp&&n-J6<v3)return Qp;if(_u)return _u;_u=(async()=>{if(!await Sh(x0))return null;const t=await S0.direct.getPhaseOneSnapshot({fallbackToMock:!1});return Qp=t,J6=Date.now(),t})().catch(()=>null);try{return await _u}finally{_u=null}},mS=async n=>{var l,c;const t=await hS(),a=((c=(l=t==null?void 0:t.agents[0])==null?void 0:l.id)==null?void 0:c.trim())??"";return!!(a&&a===n.id.trim())},pS=async n=>{if(await mS(n))return{...L1("direct"),label:`Agent 直连 · ${n.name}(本机)`};const t=x3(n),a=fS(n);return{mode:"direct",label:`Agent 直连 · ${n.name}`,baseUrl:t,client:ch(t,{wsBaseUrl:a||void 0})}},gS=(n,t)=>{const a=Ii(t.agentId);if(a)return n.agents.find(u=>u.id===a)??null;const l=Ii(t.sessionId);if(l){const u=n.sessions.find(f=>f.id===l);return u?n.agents.find(f=>f.id===u.agent_id)??null:null}const c=Ii(t.projectId);if(c){const u=n.projects.find(f=>f.id===c);return u?n.agents.find(f=>f.id===u.agent_id)??null:null}return null},yS=n=>{const t=Ii(n.sessionId),a=Ii(n.projectId),l=Ii(n.agentId);return t?`session:${t}`:a?`project:${a}`:l?`agent:${l}`:""},vS=async()=>{const n=Date.now();if(Fp&&n-X6<v3)return Fp;if(vu)return vu;vu=(async()=>{if(!await Sh(fc))return null;const t=await S0.hub.getPhaseOneSnapshot({fallbackToMock:!1});return Fp=t,X6=Date.now(),t})().catch(()=>null);try{return await vu}finally{vu=null}},_S=async()=>{const n=Date.now();if(qp&&n-Z6<lS)return qp;if(yu)return yu;yu=(async()=>{const t=await Sh(fc)?L1("hub"):L1("direct");return qp=t,Z6=Date.now(),t})();try{return await yu}finally{yu=null}},bS=async n=>{const t=yS(n),a=Date.now(),l=t?ey.get(t):null;if(l&&a-l.cachedAt<oS)return l.target;const c=t?Gp.get(t):null;if(c)return c;const u=(async()=>{const f=await vS(),p=f?gS(f,n):null;if(!f||!p)throw new Error("Hub 未返回目标节点信息,无法建立直连。");const y=await pS(p);if(!y.baseUrl)throw new Error(ty(p));if(await Sh(y.baseUrl))return y;throw new Error(ty(p))})();t&&Gp.set(t,u);try{const f=await u;return t&&ey.set(t,{target:f,cachedAt:Date.now()}),f}finally{t&&Gp.delete(t)}},ss=async n=>!(Ii(n==null?void 0:n.sessionId)||Ii(n==null?void 0:n.projectId)||Ii(n==null?void 0:n.agentId))?_S():bS(n??{}),S3="panda:notification-settings",j3="panda:notified-completions",j0="panda:web-push-subscription-state",xS=280,Yp={completionNotificationsEnabled:!1},id=ch(fc),w3=n=>({completionNotificationsEnabled:(n==null?void 0:n.completionNotificationsEnabled)===!0}),SS=(n,t)=>n.length<=t?n:`${n.slice(0,t-1).trimEnd()}…`,k3=()=>{if(typeof window>"u")return{};try{const n=window.localStorage.getItem(j3);if(!n)return{};const t=JSON.parse(n);return!t||typeof t!="object"?{}:Object.fromEntries(Object.entries(t).filter(a=>typeof a[0]=="string"&&typeof a[1]=="string"))}catch{return{}}},jS=n=>{if(!(typeof window>"u"))try{window.localStorage.setItem(j3,JSON.stringify(n))}catch{}},wS=n=>{if(!n||typeof n!="object")return null;const t=typeof n.endpoint=="string"?n.endpoint.trim():"",a=typeof n.updatedAt=="string"?n.updatedAt.trim():"";return!t||!a?null:{completionNotificationsEnabled:n.completionNotificationsEnabled===!0,endpoint:t,updatedAt:a}},N3=()=>{if(typeof window>"u")return null;try{return wS(JSON.parse(window.localStorage.getItem(j0)??"null"))}catch{return null}},C3=n=>{if(!(typeof window>"u"))try{window.localStorage.setItem(j0,JSON.stringify(n))}catch{}},uh=()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem(j0)}catch{}},E3=async()=>{if(typeof navigator>"u"||!("serviceWorker"in navigator))throw new Error("当前环境没有可用的 Service Worker。");return navigator.serviceWorker.ready},kS=n=>{const t="=".repeat((4-n.length%4)%4),a=(n+t).replace(/-/g,"+").replace(/_/g,"/"),l=window.atob(a),c=new Uint8Array(l.length);for(let u=0;u<l.length;u+=1)c[u]=l.charCodeAt(u);return c},w0=async()=>{const n=await E3();return"pushManager"in n?n.pushManager.getSubscription():null},T3=n=>{var u,f;const t=n.toJSON(),a=n.endpoint.trim(),l=typeof((u=t.keys)==null?void 0:u.p256dh)=="string"?t.keys.p256dh.trim():"",c=typeof((f=t.keys)==null?void 0:f.auth)=="string"?t.keys.auth.trim():"";if(!a||!l||!c)throw new Error("浏览器返回的推送订阅信息不完整。");return{endpoint:a,expirationTime:typeof n.expirationTime=="number"?n.expirationTime:null,keys:{p256dh:l,auth:c}}},M3=async()=>{try{return await id.getWebPushPublicConfig()}catch(n){throw new Error(n instanceof Error?n.message:"无法读取 Hub Web Push 配置。")}},I1=()=>{if(typeof window>"u")return Yp;try{const n=window.localStorage.getItem(S3);return n?w3(JSON.parse(n)):Yp}catch{return Yp}},bu=n=>{if(!(typeof window>"u"))try{window.localStorage.setItem(S3,JSON.stringify(w3(n)))}catch{}},jh=()=>typeof window>"u"?!1:window.isSecureContext&&"Notification"in window&&"serviceWorker"in navigator,oc=()=>jh()?"PushManager"in window:!1,qo=()=>jh()?Notification.permission:"unsupported",NS=async()=>jh()?Notification.requestPermission():"unsupported",P1=()=>{var n;return((n=N3())==null?void 0:n.completionNotificationsEnabled)===!0},CS=async n=>{if(!n.completionNotificationsEnabled||qo()!=="granted")return{synced:!1,reason:"notifications-disabled"};if(!oc())return{synced:!1,reason:"unsupported"};const t=await M3();if(!t.supported||!t.vapid_public_key)return uh(),{synced:!1,reason:"hub-unsupported"};const a=await w0();if(!a)return uh(),{synced:!1,reason:"missing-browser-subscription"};const l=await id.upsertWebPushSubscription({subscription:T3(a),settings:{completion_notifications_enabled:n.completionNotificationsEnabled},device:{label:$o()?"installed-pwa":"browser-tab",user_agent:typeof navigator<"u"?navigator.userAgent:null}});return C3({completionNotificationsEnabled:l.settings.completion_notifications_enabled,endpoint:l.endpoint,updatedAt:l.updated_at}),{synced:!0,endpoint:l.endpoint}},ny=async n=>{if(!oc())throw new Error("当前环境不支持 Web Push。");const t=await M3();if(!t.supported||!t.vapid_public_key)throw new Error(t.reason??"Hub 当前没有可用的 Web Push 配置。");const a=await E3(),c=await a.pushManager.getSubscription()??null??await a.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:kS(t.vapid_public_key)}),u=await id.upsertWebPushSubscription({subscription:T3(c),settings:{completion_notifications_enabled:n.completionNotificationsEnabled},device:{label:$o()?"installed-pwa":"browser-tab",user_agent:typeof navigator<"u"?navigator.userAgent:null}});return C3({completionNotificationsEnabled:u.settings.completion_notifications_enabled,endpoint:u.endpoint,updatedAt:u.updated_at}),u},ES=async()=>{if(!oc())return uh(),{removed:!1};const n=await w0();if(n){try{await id.removeWebPushSubscription({endpoint:n.endpoint})}catch{}try{await n.unsubscribe()}catch{}}return uh(),{removed:!!n}},TS=async()=>{var l,c;if(!oc())throw new Error("当前环境不支持 Web Push。");if(qo()!=="granted")throw new Error("请先授予系统通知权限。");const n=await w0(),t=N3(),a=((l=n==null?void 0:n.endpoint)==null?void 0:l.trim())||((c=t==null?void 0:t.endpoint)==null?void 0:c.trim())||"";if(!a)throw new Error("当前设备还没有可用的 Web Push 订阅。");return await id.sendWebPushTest({endpoint:a}),{ok:!0,endpoint:a}},$o=()=>{if(typeof window>"u")return!1;const n=navigator;return window.matchMedia("(display-mode: standalone)").matches||n.standalone===!0},sy=()=>typeof navigator>"u"?!1:/Android/i.test(navigator.userAgent),MS=n=>{if(typeof n!="string")return"";const t=n.replace(/\r\n/g,`
67
+ `).replace(/\s+/g," ").trim();return t?SS(t,xS):""},RS=(n,t)=>k3()[n]===t,Vp=(n,t)=>{const a=k3();a[n]!==t&&jS({...a,[n]:t})},AS=async n=>{if(typeof window>"u"||!jh())return!1;const t={body:n.body,tag:`session-completed:${n.sessionId}:${n.completedAt}`,icon:"/pwa-512.png",badge:"/pwa-192.png",data:{sessionId:n.sessionId,url:n.url,completedAt:n.completedAt}};try{return await(await navigator.serviceWorker.ready).showNotification(n.title,t),!0}catch{try{const a=new Notification(n.title,t);return a.onclick=()=>{window.focus(),window.location.assign(n.url)},!0}catch{return!1}}},dh="panda:last-agent-id",fh="panda:last-session-id",Fu="panda:pending-session-id",Qu="panda:pending-project-id",Gu="panda:pending-directory-picker",DS=()=>{if(typeof window>"u")return null;try{return window.localStorage.getItem(dh)}catch{return null}},$r=n=>{if(!(typeof window>"u"))try{if(n){window.localStorage.setItem(dh,n);return}window.localStorage.removeItem(dh)}catch{}},Wu=()=>{if(typeof window>"u")return null;try{return window.localStorage.getItem(fh)}catch{return null}},ws=n=>{if(!(typeof window>"u"))try{if(n){window.localStorage.setItem(fh,n);return}window.localStorage.removeItem(fh)}catch{}},Yu=n=>{if(!(typeof window>"u"))try{if(n){window.sessionStorage.setItem(Fu,n);return}window.sessionStorage.removeItem(Fu)}catch{}},OS=()=>{if(typeof window>"u")return null;try{const n=window.sessionStorage.getItem(Fu);return n&&window.sessionStorage.removeItem(Fu),n}catch{return null}},Ho=n=>{if(!(typeof window>"u"))try{if(n){window.sessionStorage.setItem(Qu,n);return}window.sessionStorage.removeItem(Qu)}catch{}},LS=()=>{if(typeof window>"u")return null;try{const n=window.sessionStorage.getItem(Qu);return n&&window.sessionStorage.removeItem(Qu),n}catch{return null}},xu=n=>{if(!(typeof window>"u"))try{if(n){window.sessionStorage.setItem(Gu,"1");return}window.sessionStorage.removeItem(Gu)}catch{}},IS=()=>{if(typeof window>"u")return!1;try{const n=window.sessionStorage.getItem(Gu);return n&&window.sessionStorage.removeItem(Gu),n==="1"}catch{return!1}},PS=()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem(dh),window.localStorage.removeItem(fh),window.sessionStorage.removeItem(Fu),window.sessionStorage.removeItem(Qu),window.sessionStorage.removeItem(Gu)}catch{}},zS=1200,BS=n=>typeof document>"u"?!1:document.visibilityState==="visible"&&Wu()===n,R3=n=>{var t;return((t=n==null?void 0:n.title)==null?void 0:t.trim())||"当前会话"},US=n=>n.run_state!=="completed"?null:(typeof n.run_state_changed_at=="string"?n.run_state_changed_at.trim():"")||null,$S=(n,t)=>{if(!n||(typeof n.completionReason=="string"?n.completionReason:"completed")!=="completed")return null;const l=typeof n.sessionId=="string"?n.sessionId.trim():"",c=typeof n.completedAt=="string"?n.completedAt.trim():"";if(!l||!c)return null;const u=(t==null?void 0:t.sessions.find(y=>y.id===l))??null,f=typeof n.sessionTitle=="string"&&n.sessionTitle.trim()||R3(u),p=(typeof n.finalReply=="string"?n.finalReply:"")||(u==null?void 0:u.latest_assistant_message)||"";return{sessionId:l,completedAt:c,sessionTitle:f,finalReply:p}},HS=(n,t)=>{const a=new Map(((n==null?void 0:n.sessions)??[]).map(l=>[l.id,l]));return t.sessions.flatMap(l=>{var p;const c=US(l);if(!c)return[];const u=((p=l.latest_assistant_message)==null?void 0:p.trim())??"";if(!u)return[];const f=a.get(l.id);return(f==null?void 0:f.run_state)==="completed"&&f.run_state_changed_at===c?[]:[{sessionId:l.id,completedAt:c,sessionTitle:R3(l),finalReply:u}]})},qS=({snapshot:n})=>{const t=Vr(),a=_.useRef(n),l=_.useRef(new Set),c=_.useRef(null),u=_.useRef(!1);return _.useEffect(()=>{a.current=n},[n]),_.useEffect(()=>{const f=async j=>{if(!I1().completionNotificationsEnabled||qo()!=="granted")return;if(P1()){Vp(j.sessionId,j.completedAt);return}const E=`${j.sessionId}:${j.completedAt}`;if(!l.current.has(E)&&!RS(j.sessionId,j.completedAt)){if(BS(j.sessionId)){Vp(j.sessionId,j.completedAt);return}l.current.add(E);try{await AS({sessionId:j.sessionId,completedAt:j.completedAt,title:j.sessionTitle,body:MS(j.finalReply),url:`/session/${j.sessionId}`})&&Vp(j.sessionId,j.completedAt)}finally{l.current.delete(E)}}},p=async j=>{for(const k of j)await f(k)};let y=!1,m;const S=async()=>{if(!u.current){u.current=!0;try{const k=await(await ss()).client.getPhaseOneSnapshot({fallbackToMock:!1});if(y)return;const E=a.current;if(a.current=k,t.setQueryData(K2,k),!E)return;await p(HS(E,k))}catch{}finally{u.current=!1}}},g=()=>{c.current!==null&&clearTimeout(c.current),c.current=setTimeout(()=>{c.current=null,S()},zS)},x=j=>{if(j.type==="turn.completed"){const k=$S(j.payload,a.current);k&&f(k);return}(j.type==="snapshot.changed"||j.type==="agent.online")&&g()};return ss().then(j=>{y||(m=j.client.connectEvents(x,{reconnectWhenHidden:!0}))}),()=>{y=!0,c.current!==null&&(clearTimeout(c.current),c.current=null),m==null||m()}},[t]),null},FS=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"}}]'),QS={themes:FS},A3="panda:theme-settings",GS=13,WS=12,D3="codex",k0="codex",YS='-apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", sans-serif',VS='ui-monospace, "SFMono-Regular", "SF Mono", "Cascadia Mono", "Cascadia Code", Consolas, monospace',KS=/\b(?:serif|sans-serif|monospace|cursive|fantasy|system-ui|emoji|math|fangsong|ui-serif|ui-sans-serif|ui-monospace|ui-rounded)\b/i,ay=(n,t)=>{const a=n==null?void 0:n.trim();return a?KS.test(a)?a:`${a}, ${t}`:t},ZS={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"},hc=(n,t,a)=>Math.min(a,Math.max(t,n)),Sl=(n,t)=>{const l=n.trim().match(/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i);if(!l)return t;const[,c]=l;return`#${(c.length===3?c.split("").map(f=>`${f}${f}`).join(""):c).toUpperCase()}`},Ci=n=>{const t=Sl(n,"#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)}},XS=(n,t,a)=>`#${[n,t,a].map(l=>hc(Math.round(l),0,255).toString(16).padStart(2,"0")).join("").toUpperCase()}`,dt=(n,t,a)=>{const l=Ci(n),c=Ci(t),u=hc(a,0,1);return XS(l.r+(c.r-l.r)*u,l.g+(c.g-l.g)*u,l.b+(c.b-l.b)*u)},JS=n=>{const{r:t,g:a,b:l}=Ci(n),c=u=>{const f=u/255;return f<=.03928?f/12.92:((f+.055)/1.055)**2.4};return c(t)*.2126+c(a)*.7152+c(l)*.0722},ej=n=>JS(n)>.5?"#0D1117":"#FFFFFF",ji=(n,t)=>{const a=Math.round(hc(t,0,1)*100);return a>=100?n:`color-mix(in srgb, ${n} ${a}%, transparent)`},O3=QS.themes,L3=(n,t)=>{var l,c;const a=t==="light"?n.light:n.dark;return a?{id:n.id,label:ZS[n.id]??n.id,codeThemeId:a.codeThemeId,variant:t,accent:Sl(a.theme.accent,"#0169CC"),background:Sl(a.theme.surface,"#FFFFFF"),foreground:Sl(a.theme.ink,"#0D0D0D"),contrast:hc(Number(a.theme.contrast),0,100),opaqueWindows:!!a.theme.opaqueWindows,semanticColors:{diffAdded:Sl(a.theme.semanticColors.diffAdded,"#00A240"),diffRemoved:Sl(a.theme.semanticColors.diffRemoved,"#E02E2A"),skill:Sl(a.theme.semanticColors.skill,"#751ED9")},fonts:{ui:((l=a.theme.fonts.ui)==null?void 0:l.trim())||null,code:((c=a.theme.fonts.code)==null?void 0:c.trim())||null}}:null},z1=O3.map(n=>L3(n,"light")).filter(n=>!!n),Vu=O3.map(n=>L3(n,"dark")).filter(n=>!!n);Vu.find(n=>n.id===k0)??Vu[0];const Ul={mode:"system",lightThemeId:D3,darkThemeId:k0,uiFontSize:GS,codeFontSize:WS},I3=n=>hc(Number(n),11,18),P3=n=>hc(Number(n),10,18),N0=()=>typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",wh=n=>z1.find(t=>t.id===n)??z1[0],kh=n=>Vu.find(t=>t.id===n)??Vu[0],iy=(n,t=Ul,a="light")=>a==="dark"?{...t,darkThemeId:kh(n).id}:{...t,lightThemeId:wh(n).id},Tr=n=>({mode:(n==null?void 0:n.mode)==="light"||(n==null?void 0:n.mode)==="dark"||(n==null?void 0:n.mode)==="system"?n.mode:Ul.mode,lightThemeId:wh((n==null?void 0:n.lightThemeId)??D3).id,darkThemeId:kh((n==null?void 0:n.darkThemeId)??k0).id,uiFontSize:I3((n==null?void 0:n.uiFontSize)??Ul.uiFontSize),codeFontSize:P3((n==null?void 0:n.codeFontSize)??Ul.codeFontSize)}),z3=()=>{if(typeof window>"u")return Ul;try{const n=window.localStorage.getItem(A3);return n?Tr(JSON.parse(n)):Ul}catch{return Ul}},Su=n=>{if(!(typeof window>"u"))try{window.localStorage.setItem(A3,JSON.stringify(Tr(n)))}catch{}},tj=(n,t)=>n==="system"?t:n,Ni=(n,t=N0())=>{const a=Tr(n),l=tj(a.mode,t),c=wh(a.lightThemeId),u=kh(a.darkThemeId),f=l==="dark"?u:c;return{...a,appearance:l,lightTheme:c,darkTheme:u,activeTheme:f,uiFontFamily:ay(f.fonts.ui,YS),codeFontFamily:ay(f.fonts.code,VS)}},nj=n=>{if(typeof window>"u")return()=>{};const t=window.matchMedia("(prefers-color-scheme: dark)"),a=()=>{n(t.matches?"dark":"light")};return a(),t.addEventListener("change",a),()=>{t.removeEventListener("change",a)}},sj=(n,t)=>{const a=Ni(n,t),l=a.activeTheme,c=t==="dark",u=(l.contrast-(c?60:45))/100,f=l.semanticColors.diffAdded,p=l.semanticColors.diffRemoved,y=l.semanticColors.skill,m=Ci(f),S=Ci(p),g=Ci(y),x=Ci(l.accent),j=Ci(l.background),k=Ci(l.foreground),E=l.background,N=c?dt(l.background,"#FFFFFF",.05+u*.08):dt(l.background,"#FFFFFF",.42+u*.16),P=c?dt(l.background,"#FFFFFF",.07+u*.08):dt(l.background,"#FFFFFF",.78+u*.1),H=c?dt(l.background,"#FFFFFF",.1+u*.08):dt(l.background,"#FFFFFF",.56+u*.14),U=c?dt(l.background,"#FFFFFF",.14+u*.08):dt(l.background,l.foreground,.1+u*.12),R=c?dt(l.background,"#000000",.08-u*.06):dt(l.background,l.foreground,.03+u*.08),q=c?dt(l.background,"#FFFFFF",.08+u*.06):dt(l.background,l.foreground,.06+u*.08),re=c?dt(l.background,"#FFFFFF",.14+u*.08):dt(l.background,l.foreground,.14+u*.1),V=c?dt(l.background,"#FFFFFF",.22+u*.08):dt(l.background,l.foreground,.22+u*.1),ee=c?dt(l.background,"#FFFFFF",.08+u*.04):dt(l.background,l.foreground,.1+u*.08),Z=l.foreground,W=c?dt(l.foreground,l.background,.28-u*.1):dt(l.foreground,l.background,.5-u*.14),F=c?dt(l.foreground,l.background,.46-u*.1):dt(l.foreground,l.background,.64-u*.14),be=dt(l.foreground,l.background,c?.58:.74),pe=l.accent,Y=c?dt(l.accent,"#FFFFFF",.18):dt(l.accent,"#FFFFFF",.24),ne=c?dt(l.accent,l.background,.78):dt(l.accent,l.background,.88),T=c?dt(l.accent,l.background,.84):dt(l.accent,l.background,.92),$=ej(pe),ue=c?dt(l.background,"#FFFFFF",.1):dt(l.background,l.foreground,.08),de=c?dt(l.background,"#000000",.06):dt(l.background,l.foreground,.035),ve=c?dt(l.background,"#FFFFFF",.05):dt(l.background,l.foreground,.06),A=c?dt(l.background,"#FFFFFF",.03):dt(l.background,l.foreground,.085),te=c?dt(l.background,"#FFFFFF",.065):dt(l.background,l.foreground,.05),je=dt(l.foreground,l.background,c?.42:.68),Se=c?dt(l.background,"#FFFFFF",.08):dt(l.foreground,l.background,.18),Re=c?dt(l.background,"#FFFFFF",.08):dt(l.background,l.foreground,.06),oe=c?dt(l.background,"#FFFFFF",.12):dt(l.background,l.foreground,.1),Ne=c?dt(l.background,"#FFFFFF",.14+u*.05):dt(l.background,l.foreground,.12+u*.08),ie=l.opaqueWindows?1:c?.92:.95,z=l.opaqueWindows?1:c?.94:.965,we=l.opaqueWindows?1:.94;return{"--theme-id":l.id,"--theme-code-theme-id":l.codeThemeId,"--theme-window-opaque":l.opaqueWindows?"1":"0","--theme-accent":pe,"--theme-accent-rgb":`${x.r} ${x.g} ${x.b}`,"--theme-background":l.background,"--theme-background-rgb":`${j.r} ${j.g} ${j.b}`,"--theme-foreground":l.foreground,"--theme-foreground-rgb":`${k.r} ${k.g} ${k.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":E,"--color-surface-elevated":N,"--color-surface-panel":P,"--color-surface-raised":H,"--color-surface-panel-strong":U,"--color-surface-sidebar":ji(R,z),"--color-surface-sidebar-elevated":ji(q,z),"--color-surface-border":re,"--color-surface-border-strong":V,"--color-surface-border-soft":ee,"--color-surface-overlay":ji(U,ie),"--color-surface-floating":ji(P,ie),"--color-surface-tooltip":ji(Se,we),"--color-surface-code":de,"--color-surface-code-muted":ve,"--color-surface-code-gutter":A,"--color-surface-code-meta":te,"--color-surface-inline-code":ue,"--color-surface-hover":Re,"--color-surface-pressed":oe,"--color-surface-danger-soft":ji(p,c?.14:.08),"--color-surface-success-soft":ji(f,c?.14:.08),"--color-text-primary":Z,"--color-text-secondary":W,"--color-text-muted":F,"--color-text-tertiary":be,"--color-text-on-accent":$,"--color-text-link":pe,"--color-text-link-hover":Y,"--color-text-danger":p,"--color-text-success":f,"--color-accent-primary":pe,"--color-accent-primary-soft":ne,"--color-accent-secondary":Y,"--color-accent-secondary-soft":T,"--color-accent-contrast":$,"--color-accent-primary-rgb":`${x.r} ${x.g} ${x.b}`,"--color-success":f,"--color-warning":dt(l.accent,f,.35),"--color-danger":p,"--color-status-online":pe,"--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":pe,"--color-code-string":dt(f,l.foreground,c?.26:.18),"--color-code-number":dt(y,pe,.36),"--color-code-comment":dt(l.foreground,l.background,c?.52:.72),"--color-code-meta-text":je,"--color-code-add":f,"--color-code-add-rgb":`${m.r} ${m.g} ${m.b}`,"--color-code-add-bg":ji(f,c?.16:.11),"--color-code-remove":p,"--color-code-remove-rgb":`${S.r} ${S.g} ${S.b}`,"--color-code-remove-bg":ji(p,c?.18:.11),"--color-divider":Ne,"--color-overlay-scrim":l.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`}},B3=(n,t=N0())=>{if(typeof document>"u")return;const a=Ni(n,t),l=sj(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,f]of Object.entries(l))c.style.setProperty(u,f)};function rd(n){return ks({queryKey:(n==null?void 0:n.queryKey)??K2,queryFn:async()=>(await ss(n==null?void 0:n.scope)).client.getPhaseOneSnapshot({fallbackToMock:!1}),refetchInterval:3e5,refetchOnWindowFocus:!1,retry:1})}const ry=n=>{let t;const a=new Set,l=(m,S)=>{const g=typeof m=="function"?m(t):m;if(!Object.is(g,t)){const x=t;t=S??(typeof g!="object"||g===null)?g:Object.assign({},t,g),a.forEach(j=>j(t,x))}},c=()=>t,p={setState:l,getState:c,getInitialState:()=>y,subscribe:m=>(a.add(m),()=>a.delete(m))},y=t=n(l,c,p);return p},aj=(n=>n?ry(n):ry),ij=n=>n;function rj(n,t=ij){const a=Oi.useSyncExternalStore(n.subscribe,Oi.useCallback(()=>t(n.getState()),[n,t]),Oi.useCallback(()=>t(n.getInitialState()),[n,t]));return Oi.useDebugValue(a),a}const ly=n=>{const t=aj(n),a=l=>rj(t,l);return Object.assign(a,t),a},lj=(n=>n?ly(n):ly),oy=z3(),cy=N0(),Ta=lj(n=>({panelTab:"git",composerText:"",activeSessionId:null,bottomNavVisible:!0,themeSettings:oy,systemAppearance:cy,resolvedTheme:Ni(oy,cy),setPanelTab:t=>n({panelTab:t}),setComposerText:t=>n({composerText:t}),setActiveSessionId:t=>n({activeSessionId:t}),setBottomNavVisible:t=>n({bottomNavVisible:t}),setThemeMode:t=>n(a=>{const l=Tr({...a.themeSettings,mode:t});return Su(l),{themeSettings:l,resolvedTheme:Ni(l,a.systemAppearance)}}),setLightThemeId:t=>n(a=>{const l=Tr(iy(wh(t).id,a.themeSettings,"light"));return Su(l),{themeSettings:l,resolvedTheme:Ni(l,a.systemAppearance)}}),setDarkThemeId:t=>n(a=>{const l=Tr({...iy(kh(t).id,a.themeSettings,"dark")});return Su(l),{themeSettings:l,resolvedTheme:Ni(l,a.systemAppearance)}}),setUiFontSize:t=>n(a=>{const l=Tr({...a.themeSettings,uiFontSize:t});return Su(l),{themeSettings:l,resolvedTheme:Ni(l,a.systemAppearance)}}),setCodeFontSize:t=>n(a=>{const l=Tr({...a.themeSettings,codeFontSize:t});return Su(l),{themeSettings:l,resolvedTheme:Ni(l,a.systemAppearance)}}),setSystemAppearance:t=>n(a=>({systemAppearance:t,resolvedTheme:Ni(a.themeSettings,t)}))})),oj=()=>{const{data:n}=rd(),t=Ta(c=>c.themeSettings),a=Ta(c=>c.systemAppearance),l=Ta(c=>c.setSystemAppearance);return _.useEffect(()=>{B3(t,a)},[a,t]),_.useEffect(()=>nj(l),[l]),r.jsxs("div",{className:"app-shell",children:[r.jsx(qS,{snapshot:n}),r.jsx("div",{className:"app-shell__content",children:r.jsx(V2,{})})]})},cj=n=>n.tailscale_dns_name||n.tailscale_ip||n.host||n.direct_base_url,uj=({message:n})=>r.jsx("p",{className:"empty-copy",children:n}),dj=()=>{const n=Zr(),{data:t}=rd(),a=(t==null?void 0:t.agents)??[];return r.jsxs("div",{className:"nodes-screen",children:[r.jsxs("div",{className:"nodes-screen__header",children:[r.jsx("h1",{children:"节点列表"}),r.jsx("p",{children:"查看所有在线节点和局域网地址"})]}),r.jsx("div",{className:"nodes-screen__content node-list",children:a.length===0?r.jsx(uj,{message:"暂无节点"}):a.map(l=>{const c=Wu(),u=(t==null?void 0:t.sessions.find(f=>f.id===c&&f.agent_id===l.id))??null;return r.jsxs("button",{type:"button",className:"node-card",onClick:()=>{$r(l.id),ws((u==null?void 0:u.id)??null),Yu((u==null?void 0:u.id)??null),n({to:"/"})},children:[r.jsxs("div",{className:"node-card__header",children:[r.jsx("strong",{children:l.name}),r.jsx("span",{className:`node-status-dot ${l.status}`})]}),r.jsx("div",{className:"node-card__ip",children:cj(l)})]},l.id)})})]})},ld=n=>[...n].sort((t,a)=>{const l=Number(a.pinned)-Number(t.pinned);return l!==0?l:+new Date(a.last_event_at)-+new Date(t.last_event_at)}),hh=(n,t)=>!!(n!=null&&n.sessions.some(a=>a.id===t)),mh=(n,t,a)=>!n||!hh(n,t)?n:{...n,sessions:ld(n.sessions.map(l=>l.id===t?{...l,...a}:l))},B1=(n,t,a)=>{if(!n)return n;const l=n.sessions.find(f=>f.id===t);if(!l)return n;const c=new Date(a).getTime(),u=new Date(l.last_event_at).getTime();return!Number.isFinite(c)||Number.isFinite(u)&&c<=u?n:mh(n,t,{last_event_at:a})},Eu=(n,t,a)=>{if(!n)return n;const{last_event_at:l,...c}=a;let u=mh(n,t,c);return typeof l=="string"&&l.trim()&&(u=B1(u,t,l)),u},U3=(n,t,a)=>{if(!n||t.length===0)return n;const l=new Set(t);return{...n,sessions:ld(n.sessions.map(c=>l.has(c.id)?{...c,...a}:c))}},$3=(n,t)=>{var u;if(!n||t.length===0)return n;const a=new Set(t),l=n.sessions.filter(f=>!a.has(f.id)),c=a.has(n.active_session_id)?((u=l[0])==null?void 0:u.id)??"":n.active_session_id;return{...n,active_session_id:c,sessions:ld(l)}},ph=(n,t,a)=>!n||!n.projects.some(l=>l.id===t)?n:{...n,projects:n.projects.map(l=>l.id===t?{...l,...a}:l)},H3=(n,t)=>{if(!n||t.length===0||n.projects.length<=1)return n;const a=new Map(n.projects.map(u=>[u.id,u])),l=new Set,c=[];for(const u of t){const f=a.get(u);!f||l.has(u)||(l.add(u),c.push(f))}for(const u of n.projects)l.has(u.id)||c.push(u);return c.every((u,f)=>{var p;return u.id===((p=n.projects[f])==null?void 0:p.id)})?n:{...n,projects:c}},q3=(n,t)=>{var c;if(!n)return n;const a=n.sessions.filter(u=>u.project_id!==t),l=a.some(u=>u.id===n.active_session_id)?n.active_session_id:((c=a[0])==null?void 0:c.id)??"";return{...n,active_session_id:l,projects:n.projects.filter(u=>u.id!==t),sessions:ld(a)}},uy=(n,t)=>n&&{...n,generated_at:new Date().toISOString(),projects:[t,...n.projects.filter(a=>a.id!==t.id)]},fj=(n,t)=>{if(!n)return n;const a=[t,...n.sessions.filter(l=>l.id!==t.id)];return{...n,generated_at:new Date().toISOString(),active_session_id:t.id,sessions:ld(a)}};/**
68
+ * @license lucide-react v0.577.0 - ISC
69
+ *
70
+ * This source code is licensed under the ISC license.
71
+ * See the LICENSE file in the root directory of this source tree.
72
+ */const F3=(...n)=>n.filter((t,a,l)=>!!t&&t.trim()!==""&&l.indexOf(t)===a).join(" ").trim();/**
73
+ * @license lucide-react v0.577.0 - ISC
74
+ *
75
+ * This source code is licensed under the ISC license.
76
+ * See the LICENSE file in the root directory of this source tree.
77
+ */const hj=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
78
+ * @license lucide-react v0.577.0 - ISC
79
+ *
80
+ * This source code is licensed under the ISC license.
81
+ * See the LICENSE file in the root directory of this source tree.
82
+ */const mj=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,a,l)=>l?l.toUpperCase():a.toLowerCase());/**
83
+ * @license lucide-react v0.577.0 - ISC
84
+ *
85
+ * This source code is licensed under the ISC license.
86
+ * See the LICENSE file in the root directory of this source tree.
87
+ */const dy=n=>{const t=mj(n);return t.charAt(0).toUpperCase()+t.slice(1)};/**
88
+ * @license lucide-react v0.577.0 - ISC
89
+ *
90
+ * This source code is licensed under the ISC license.
91
+ * See the LICENSE file in the root directory of this source tree.
92
+ */var pj={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"};/**
93
+ * @license lucide-react v0.577.0 - ISC
94
+ *
95
+ * This source code is licensed under the ISC license.
96
+ * See the LICENSE file in the root directory of this source tree.
97
+ */const gj=n=>{for(const t in n)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};/**
98
+ * @license lucide-react v0.577.0 - ISC
99
+ *
100
+ * This source code is licensed under the ISC license.
101
+ * See the LICENSE file in the root directory of this source tree.
102
+ */const yj=_.forwardRef(({color:n="currentColor",size:t=24,strokeWidth:a=2,absoluteStrokeWidth:l,className:c="",children:u,iconNode:f,...p},y)=>_.createElement("svg",{ref:y,...pj,width:t,height:t,stroke:n,strokeWidth:l?Number(a)*24/Number(t):a,className:F3("lucide",c),...!u&&!gj(p)&&{"aria-hidden":"true"},...p},[...f.map(([m,S])=>_.createElement(m,S)),...Array.isArray(u)?u:[u]]));/**
103
+ * @license lucide-react v0.577.0 - ISC
104
+ *
105
+ * This source code is licensed under the ISC license.
106
+ * See the LICENSE file in the root directory of this source tree.
107
+ */const Q3=(n,t)=>{const a=_.forwardRef(({className:l,...c},u)=>_.createElement(yj,{ref:u,iconNode:t,className:F3(`lucide-${hj(dy(n))}`,`lucide-${n}`,l),...c}));return a.displayName=dy(n),a};/**
108
+ * @license lucide-react v0.577.0 - ISC
109
+ *
110
+ * This source code is licensed under the ISC license.
111
+ * See the LICENSE file in the root directory of this source tree.
112
+ */const vj=[["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"}]],_j=Q3("pin",vj);/**
113
+ * @license lucide-react v0.577.0 - ISC
114
+ *
115
+ * This source code is licensed under the ISC license.
116
+ * See the LICENSE file in the root directory of this source tree.
117
+ */const bj=[["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"}]],xj=Q3("trash-2",bj),Sj=180*1e3,G3=8640*60*1e3,Uo=6,W3="panda:completed-session-seen-at",Kp=6,jj=220,fy=()=>r.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:r.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"})}),wj=()=>r.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:r.jsx("path",{d:"M12 5v14M5 12h14"})}),kj=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("rect",{x:"3",y:"4",width:"6",height:"6",rx:"1.5"}),r.jsx("rect",{x:"15",y:"4",width:"6",height:"6",rx:"1.5"}),r.jsx("rect",{x:"3",y:"14",width:"6",height:"6",rx:"1.5"}),r.jsx("rect",{x:"15",y:"14",width:"6",height:"6",rx:"1.5"})]}),Nj=()=>r.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:r.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"})}),Cj=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[r.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"}),r.jsx("path",{d:"M16.5 10.5v5"}),r.jsx("path",{d:"M14 13h5"})]}),hy=({open:n})=>r.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:n?"is-open":"",children:r.jsx("path",{d:"m9 6 6 6-6 6"})}),Ej=()=>r.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"m9 6 6 6-6 6"})}),Tj=()=>r.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"m15 6-6 6 6 6"})}),Mj=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.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"}),r.jsx("circle",{cx:"12",cy:"12",r:"3.15"})]}),Rj=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("circle",{cx:"6",cy:"12",r:"1",fill:"currentColor",stroke:"none"}),r.jsx("circle",{cx:"12",cy:"12",r:"1",fill:"currentColor",stroke:"none"}),r.jsx("circle",{cx:"18",cy:"12",r:"1",fill:"currentColor",stroke:"none"})]}),Aj=n=>{const t=Date.now(),a=new Date(n).getTime(),l=Math.max(0,t-a),c=60*1e3,u=60*c,f=24*u;return l<u?`${Math.max(1,Math.floor(l/c))}分钟`:l<f?`${Math.max(1,Math.floor(l/u))}小时`:`${Math.max(1,Math.floor(l/f))}天`},Zp=n=>n.run_state==="completed"&&n.run_state_changed_at&&Date.now()-new Date(n.run_state_changed_at).getTime()>Sj?"idle":n.run_state??"idle",Dj=(n,t)=>n.archived||n.id===t||Date.now()-new Date(n.last_event_at).getTime()<=G3,Oj=(n,t)=>Number(t.pinned)-Number(n.pinned)||+new Date(t.last_event_at)-+new Date(n.last_event_at),Lj=(n,t)=>n.id===t||Date.now()-new Date(n.last_event_at).getTime()<=G3,Ij=(n,t)=>{if(n.length<=Uo)return n;if(!t)return n.slice(0,Uo);const a=n.findIndex(l=>l.id===t);return a===-1||a<Uo?n.slice(0,Uo):[...n.slice(0,Uo-1),n[a]]},Pj=()=>{if(typeof window>"u")return{};try{const n=window.localStorage.getItem(W3);if(!n)return{};const t=JSON.parse(n);return t&&typeof t=="object"?t:{}}catch{return{}}},Xp=(n,t)=>n.length===t.length&&n.every((a,l)=>a===t[l]),zj=(n,t)=>{if(!t||t.length===0||n.length<=1)return n;const a=new Map(n.map(u=>[u.id,u])),l=new Set,c=[];for(const u of t){const f=a.get(u);!f||l.has(u)||(l.add(u),c.push(f))}for(const u of n)l.has(u.id)||c.push(u);return c},Bj=(n,t,a)=>{if(t<0||t>=n.length||a<0||a>=n.length||t===a)return n;const l=[...n],[c]=l.splice(t,1);return c?(l.splice(a,0,c),l):n},Uj=(n,t,a)=>{if(t.length===0)return n;const l=new Set(t);let c=0;return n.map(u=>{if(!l.has(u))return u;const f=a[c]??u;return c+=1,f})},Y3=_.memo(function({open:t,progress:a=t?1:0,isDragging:l=!1,desktopPinned:c=!1,isDesktopResizing:u=!1,onClose:f,onDesktopResizeStart:p,currentAgent:y,projects:m,sessions:S,activeSessionId:g,onCreateSession:x,onCreateDirectoryThread:j,onSelectSession:k,onSessionAction:E,onThreadAction:N,pendingSessionActionId:P,pendingThreadActionId:H}){const U=Zr(),R=a>.001,q=!!y,re=(y==null?void 0:y.status)==="online",V=_.useRef({threads:null,archived:null}),ee=_.useRef({}),Z=_.useRef(null),W=_.useRef(null),F=_.useRef(null),be=_.useRef(null),pe=_.useRef({}),Y=_.useRef(null),[ne,T]=_.useState({}),[$,ue]=_.useState(null),[de,ve]=_.useState(null),A=_.useMemo(()=>S.map(D=>{const he=ne[D.id];return he?{...D,...he.pinned===void 0?null:{pinned:he.pinned}}:D}).filter(D=>{var he;return!((he=ne[D.id])!=null&&he.hidden)}),[ne,S]),te=(de==null?void 0:de.nextGlobalProjectIds)??$,je=_.useMemo(()=>zj(m,te),[m,te]),Se=_.useMemo(()=>A.filter(D=>!D.subagent&&Dj(D,g)),[g,A]),Re=Se.find(D=>D.id===g),oe=Re==null?void 0:Re.project_id,[Ne,ie]=_.useState(oe?[oe]:[]),[z,we]=_.useState("threads"),[ke,_e]=_.useState(null),[Me,Ge]=_.useState(null),[at,ht]=_.useState(null),[Bt,Ut]=_.useState(null),[Ze,Zt]=_.useState([]),[un,fe]=_.useState(null),[Ae,Ie]=_.useState(""),[Ce,Fe]=_.useState(()=>Pj()),tt=_.useMemo(()=>Se.filter(D=>!D.archived),[Se]),qe=_.useMemo(()=>tt.filter(D=>D.pinned).sort((D,he)=>+new Date(he.last_event_at)-+new Date(D.last_event_at)),[tt]),rn=_.useMemo(()=>tt.filter(D=>!D.pinned),[tt]),vn=_.useMemo(()=>Se.filter(D=>D.archived),[Se]),zn=D=>je.map(he=>{var mt;const Be=D.filter(Ct=>Ct.project_id===he.id).sort((Ct,$t)=>Oj(Ct,$t)).filter(Ct=>Lj(Ct,g)),Ye=((mt=Be[0])==null?void 0:mt.last_event_at)??new Date(0).toISOString();return{project:he,threadSessions:Be,collapsedThreadSessions:Ij(Be,g),hiddenSessionCount:Math.max(0,Be.length-Uo),latestEventAt:Ye}}).filter(({threadSessions:he})=>he.length>0),as=_.useMemo(()=>zn(rn),[g,je,rn]),Sn=_.useMemo(()=>zn(vn),[g,vn,je]);_.useEffect(()=>{T(D=>{let he=!1;const Oe={...D};for(const[Be,Ye]of Object.entries(D)){const mt=S.find($t=>$t.id===Be);if(!mt){Ye.hidden&&(delete Oe[Be],he=!0);continue}(Ye.pinned===void 0||mt.pinned===Ye.pinned)&&!Ye.hidden&&(delete Oe[Be],he=!0)}return he?Oe:D})},[S]),_.useEffect(()=>{ue(D=>{if(!D)return D;const he=m.map(Be=>Be.id),Oe=[...D.filter(Be=>he.includes(Be)),...he.filter(Be=>!D.includes(Be))];return Xp(Oe,he)?null:Oe})},[m]),_.useEffect(()=>{oe&&ie(D=>D.includes(oe)?D:[...D,oe])},[oe]),_.useEffect(()=>{we(Re!=null&&Re.archived?"archived":"threads")},[Re==null?void 0:Re.archived,g]),_.useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(W3,JSON.stringify(Ce))}catch{}},[Ce]),_.useEffect(()=>{t||c||(ht(null),Ut(null),fe(null),Ge(null))},[c,t]),_.useEffect(()=>{if(!c||!at)return;const D=he=>{const Oe=he.target;if(!(Oe instanceof Element)){ht(null);return}Oe.closest(".thread-group__menu-anchor")||Oe.closest(".thread-group__menu")||ht(null)};return window.addEventListener("pointerdown",D),()=>{window.removeEventListener("pointerdown",D)}},[c,at]),_.useEffect(()=>{if(!g)return;const D=Se.find(Oe=>Oe.id===g);if(!D||Zp(D)!=="completed"||!D.run_state_changed_at)return;const he=D.run_state_changed_at;Fe(Oe=>Oe[D.id]===he?Oe:{...Oe,[D.id]:he})},[g,Se]),_.useEffect(()=>()=>{Z.current!==null&&globalThis.clearTimeout(Z.current),Y.current!==null&&window.cancelAnimationFrame(Y.current)},[]),_.useEffect(()=>{F.current=de},[de]),_.useLayoutEffect(()=>{if(typeof window>"u")return;const D={},he=[];for(const[Oe,Be]of Object.entries(ee.current)){if(!Be)continue;const Ye=Be.offsetTop;if(D[Oe]=Ye,(de==null?void 0:de.projectId)===Oe)continue;const mt=pe.current[Oe];if(mt===void 0)continue;const Ct=mt-Ye;Math.abs(Ct)<.5||(Be.style.transition="none",Be.style.transform=`translateY(${Ct}px)`,he.push(Be))}Y.current!==null&&window.cancelAnimationFrame(Y.current),he.length>0&&(Y.current=window.requestAnimationFrame(()=>{for(const Oe of he)Oe.style.transition="",Oe.style.transform=""})),pe.current=D},[as,Sn,Ne,Ze,de==null?void 0:de.projectId,te]);const ae=()=>{Z.current!==null&&(globalThis.clearTimeout(Z.current),Z.current=null)},$e=D=>D==="threads"?as:Sn,De=(D,he,Oe,Be,Ye)=>{const mt=V.current[he],Ct=ee.current[D];if(!mt||!Ct)return!1;const $t=$e(he).map(pt=>pt.project.id),hn=$t.indexOf(D);if(hn===-1)return!1;const mn=je.map(pt=>pt.id),Nn=mt.getBoundingClientRect(),On=Ct.getBoundingClientRect(),Cn=Ct.offsetHeight,En=Ct.offsetWidth,jn=Ye-On.top,C=mt.scrollTop,ge=Math.max(C,mt.scrollTop+mt.clientHeight-Cn),lt=Math.max(C,Math.min(ge,mt.scrollTop+Ye-Nn.top-jn)),ot={pane:he,projectId:D,pointerId:Oe,pointerType:Be,originIndex:hn,visibleProjectIds:$t,nextVisibleProjectIds:$t,nextGlobalProjectIds:mn,previewTop:lt,itemHeight:Cn,itemWidth:En,pointerOffsetY:jn};return F.current=ot,ve(ot),be.current=D,!0},We=D=>{ve(he=>{if(!he)return he;F.current=he;const Oe=V.current[he.pane];if(!Oe||!ee.current[he.projectId])return he;const Be=Oe.getBoundingClientRect(),Ye=Oe.scrollTop,mt=Math.max(Ye,Oe.scrollTop+Oe.clientHeight-he.itemHeight),Ct=Math.max(Ye,Math.min(mt,Oe.scrollTop+D-Be.top-he.pointerOffsetY)),$t=Ct+he.itemHeight/2,hn=he.nextVisibleProjectIds,mn=hn.indexOf(he.projectId);if(mn===-1)return he;const Nn=hn.filter(lt=>lt!==he.projectId);let On=0;const Cn=Nn[0],En=Cn?ee.current[Cn]:null;if(En&&Ct<=En.offsetTop+En.offsetHeight*.42)On=0;else for(let lt=0;lt<Nn.length;lt+=1){const ot=Nn[lt],pt=ot?ee.current[ot]:null;if(!pt){On=lt+1;continue}const Et=pt.offsetTop+pt.offsetHeight/2;if($t<=Et){On=lt;break}On=lt+1}const jn=Bj(hn,mn,On),C=Uj(he.nextGlobalProjectIds,he.visibleProjectIds,jn);if(Ct===he.previewTop&&Xp(jn,he.nextVisibleProjectIds))return he;const ge={...he,previewTop:Ct,nextVisibleProjectIds:jn,nextGlobalProjectIds:C};return F.current=ge,ge})},nt=D=>{ae(),W.current=null;const he=D??F.current;if(F.current=null,ve(null),!he||!!Xp(he.visibleProjectIds,he.nextVisibleProjectIds)||!N)return;const Be=$??je.map(mt=>mt.id),Ye=he.nextGlobalProjectIds;ue(Ye),Promise.resolve(N(he.projectId,"reorder",{orderedProjectIds:Ye})).catch(()=>{ue(Be)})},Xe=()=>{ae(),W.current=null,F.current=null,ve(null)};_.useEffect(()=>{if(typeof window>"u"||!F.current)return;const D=Be=>{const Ye=F.current;!Ye||Ye.pointerId!==Be.pointerId||We(Be.clientY)},he=Be=>{const Ye=F.current;!Ye||Ye.pointerId!==Be.pointerId||nt(Ye)},Oe=Be=>{const Ye=F.current;!Ye||Ye.pointerId!==Be.pointerId||Xe()};return window.addEventListener("pointermove",D),window.addEventListener("pointerup",he),window.addEventListener("pointercancel",Oe),()=>{window.removeEventListener("pointermove",D),window.removeEventListener("pointerup",he),window.removeEventListener("pointercancel",Oe)}},[de==null?void 0:de.pointerId]);const At=D=>{ie(he=>he.includes(D)?he.filter(Oe=>Oe!==D):[...he,D])},nn=D=>{if(be.current===D){be.current=null;return}At(D)},Gn=(D,he,Oe)=>{if(D.pointerType==="mouse"&&D.button!==0)return;ae();const Be=D.currentTarget;W.current={pane:Oe,projectId:he,pointerId:D.pointerId,pointerType:D.pointerType,startX:D.clientX,startY:D.clientY,currentX:D.clientX,currentY:D.clientY},D.pointerType!=="touch"&&Be.setPointerCapture(D.pointerId),D.pointerType==="touch"&&(Z.current=globalThis.setTimeout(()=>{const Ye=W.current;if(!Ye||Ye.projectId!==he||Ye.pointerId!==D.pointerId)return;Be.hasPointerCapture(D.pointerId)||Be.setPointerCapture(D.pointerId),De(he,Oe,D.pointerId,D.pointerType,Ye.currentY)&&We(Ye.currentY)},jj))},gt=(D,he,Oe)=>{const Be=W.current;if(!Be||Be.projectId!==he||Be.pointerId!==D.pointerId||Be.pane!==Oe)return;if(Be.currentX=D.clientX,Be.currentY=D.clientY,(de==null?void 0:de.projectId)===he&&de.pointerId===D.pointerId){D.preventDefault(),We(D.clientY);return}const Ye=D.clientX-Be.startX,mt=D.clientY-Be.startY;if(Be.pointerType==="touch"){(Math.abs(Ye)>Kp||Math.abs(mt)>Kp)&&ae();return}Math.abs(mt)<Kp||Math.abs(mt)<Math.abs(Ye)||!De(he,Oe,D.pointerId,D.pointerType,D.clientY)||(D.preventDefault(),We(D.clientY))},kn=(D,he)=>{if(D.currentTarget.hasPointerCapture(D.pointerId)&&D.currentTarget.releasePointerCapture(D.pointerId),(de==null?void 0:de.projectId)===he&&de.pointerId===D.pointerId){D.preventDefault(),nt();return}ae(),W.current=null},Ee=(D,he)=>{if(D.currentTarget.hasPointerCapture(D.pointerId)&&D.currentTarget.releasePointerCapture(D.pointerId),(de==null?void 0:de.projectId)===he&&de.pointerId===D.pointerId){Xe();return}ae(),W.current=null},Dt=D=>{Zt(he=>he.includes(D)?he.filter(Oe=>Oe!==D):[...he,D])},Dn=D=>{if(Zp(D)!=="completed"||!D.run_state_changed_at)return;const he=D.run_state_changed_at;Fe(Oe=>Oe[D.id]===he?Oe:{...Oe,[D.id]:he})},Gs=`translateX(-${(z==="threads"?0:1)*50}%)`,Bi=un&&typeof document<"u"?Er.createPortal(r.jsxs("div",{className:"sheet-wrap sheet-wrap--centered",role:"dialog","aria-modal":"true",children:[r.jsx("button",{type:"button",className:"sheet-wrap__scrim",onClick:()=>{fe(null),Ie("")},"aria-label":"关闭重命名面板"}),r.jsx("div",{className:"sheet-wrap__center",children:r.jsxs("div",{className:"sheet-panel sheet-panel--form sheet-panel--centered",children:[r.jsx("div",{className:"sheet-panel__title",children:"编辑线程名称"}),r.jsx("input",{className:"sheet-panel__input",value:Ae,onChange:D=>Ie(D.target.value),placeholder:"输入线程名称",autoFocus:!0}),r.jsxs("div",{className:"sheet-panel__actions",children:[r.jsx("button",{type:"button",className:"sheet-panel__button",onClick:()=>{fe(null),Ie("")},children:"取消"}),r.jsx("button",{type:"button",className:"sheet-panel__button is-primary",disabled:!Ae.trim()||H===un,onClick:()=>{ya()},children:"保存"})]})]})})]}),document.body):null,ds=D=>{ht(null),Ut(null),fe(D.id),Ie(D.display_name??D.name)},ya=async()=>{!un||!Ae.trim()||!N||(await N(un,"rename",{name:Ae.trim()}),fe(null),Ie(""))},va=(D,he,Oe)=>{if(!E)return;const Be=ne[D.id];he==="pin"||he==="unpin"?T(mt=>({...mt,[D.id]:{...mt[D.id],pinned:he==="pin"}})):he==="delete"&&T(mt=>({...mt,[D.id]:{...mt[D.id],hidden:!0}}));const Ye=E(D.id,he,Oe);Ye&&typeof Ye.then=="function"&&Ye.catch(()=>{T(mt=>{const Ct={...mt};return Be?Ct[D.id]=Be:delete Ct[D.id],Ct})})},xt=D=>{const he=Zp(D),Oe=he==="completed"&&D.id!==g&&!!D.run_state_changed_at&&Ce[D.id]!==D.run_state_changed_at,Be=c&&ke===D.id,Ye=!!E&&Be,mt=Me===D.id,Ct=c&&(Ye||mt);return r.jsxs("div",{className:`thread-session ${D.id===g?"is-active":""}`,onMouseEnter:()=>_e(D.id),onMouseLeave:()=>{_e($t=>$t===D.id?null:$t),Ge($t=>$t===D.id?null:$t)},children:[r.jsx("button",{type:"button",className:`thread-session__icon-button ${Ye?"is-visible":""} ${D.pinned?"is-active":""}`,disabled:P===D.id,onClick:$t=>{$t.stopPropagation(),va(D,D.pinned?"unpin":"pin")},"aria-label":D.pinned?"取消置顶会话":"置顶会话",title:D.pinned?"取消置顶":"置顶",children:r.jsx(_j,{strokeWidth:D.pinned?2.1:1.95})}),r.jsxs("div",{className:"thread-session__row",children:[k?r.jsxs("button",{type:"button",className:"thread-session__link thread-session__link--button",title:D.title,onClick:()=>{Dn(D),k(D.id),f()},children:[r.jsx("span",{className:`thread-session__status is-${Oe?"completed":he} ${Oe?"is-unread":""} ${Ct?"is-hidden":""}`,"aria-hidden":"true"}),r.jsx("div",{className:"thread-session__title",children:D.title})]}):r.jsxs(Iu,{to:"/session/$sessionId",params:{sessionId:D.id},title:D.title,onClick:()=>{Dn(D),f()},className:"thread-session__link",children:[r.jsx("span",{className:`thread-session__status is-${Oe?"completed":he} ${Oe?"is-unread":""} ${Ct?"is-hidden":""}`,"aria-hidden":"true"}),r.jsx("div",{className:"thread-session__title",children:D.title})]}),r.jsx("div",{className:"thread-session__meta",children:c&&Be&&E?mt?r.jsx("button",{type:"button",className:"thread-session__delete-confirm",disabled:P===D.id,onClick:$t=>{$t.stopPropagation(),va(D,"delete")},children:"确认"}):r.jsx("button",{type:"button",className:"thread-session__delete",disabled:P===D.id,onClick:$t=>{$t.stopPropagation(),Ge(D.id)},"aria-label":`删除 ${D.title}`,children:r.jsx(xj,{strokeWidth:1.95})}):r.jsx("span",{className:"thread-session__time",children:Aj(D.last_event_at)})})]})]},D.id)},is=({project:D,threadSessions:he,collapsedThreadSessions:Oe,hiddenSessionCount:Be},Ye)=>{const mt=Ne.includes(D.id),Ct=Ze.includes(D.id),$t=D.display_name??D.name,hn=!!N&&c&&at===D.id,mn=!!N&&Bt===D.id,Nn=he.every(C=>C.archived),On=Ct?he:Oe,Cn=Be>0,En=(de==null?void 0:de.projectId)===D.id&&de.pane===Ye,jn=mn&&typeof document<"u"?Er.createPortal(r.jsxs("div",{className:"sheet-wrap",role:"dialog","aria-modal":"true",children:[r.jsx("button",{type:"button",className:"sheet-wrap__scrim",onClick:()=>Ut(null),"aria-label":"关闭线程菜单"}),r.jsxs("div",{className:"sheet-panel",children:[r.jsx("div",{className:"sheet-panel__title",children:$t}),r.jsx("button",{type:"button",className:"sheet-panel__item",onClick:()=>ds(D),children:"编辑名称"}),r.jsx("button",{type:"button",className:"sheet-panel__item",disabled:H===D.id,onClick:()=>{N==null||N(D.id,Nn?"unarchive":"archive"),Ut(null)},children:Nn?"取消归档":"归档线程"}),r.jsx("button",{type:"button",className:"sheet-panel__item is-danger",disabled:H===D.id,onClick:()=>{N==null||N(D.id,"remove"),Ut(null)},children:"移除"})]})]}),document.body):null;return r.jsxs(_.Fragment,{children:[r.jsx("div",{ref:C=>{ee.current[D.id]=C},className:`thread-group-shell ${En?"is-drag-placeholder":""}`,children:r.jsxs("section",{className:"thread-group",children:[r.jsxs("div",{className:"thread-group__header",children:[r.jsxs("button",{type:"button",className:"thread-group__title",onClick:()=>nn(D.id),onPointerDown:C=>Gn(C,D.id,Ye),onPointerMove:C=>gt(C,D.id,Ye),onPointerUp:C=>kn(C,D.id),onPointerCancel:C=>Ee(C,D.id),"aria-expanded":mt,title:$t,children:[r.jsx("span",{className:"thread-group__chevron",children:r.jsx(hy,{open:mt})}),r.jsx("span",{className:"thread-group__icon",children:r.jsx(fy,{})}),r.jsx("span",{className:"thread-group__title-text",children:$t})]}),r.jsxs("div",{className:"thread-group__actions",children:[N?r.jsxs("div",{className:"thread-group__menu-anchor",children:[r.jsx("button",{type:"button",className:`thread-group__more ${hn||mn?"is-open":""}`,onClick:C=>{if(C.stopPropagation(),c){ht(ge=>ge===D.id?null:D.id);return}Ut(D.id)},"aria-label":`${$t} 更多选项`,children:r.jsx(Rj,{})}),hn?r.jsxs("div",{className:"thread-group__menu",children:[r.jsx("button",{type:"button",className:"thread-group__menu-item",onClick:()=>ds(D),children:"编辑名称"}),r.jsx("button",{type:"button",className:"thread-group__menu-item",disabled:H===D.id,onClick:()=>{N==null||N(D.id,Nn?"unarchive":"archive"),ht(null)},children:Nn?"取消归档":"归档线程"}),r.jsx("button",{type:"button",className:"thread-group__menu-item is-danger",disabled:H===D.id,onClick:()=>{N==null||N(D.id,"remove"),ht(null)},children:"移除"})]}):null]}):null,r.jsx("button",{type:"button",className:"thread-group__add",onClick:C=>{C.stopPropagation(),x(D.id,D.name)},"aria-label":`在 ${D.name} 下新增会话`,children:r.jsx(wj,{})})]})]}),mt?he.length===0?r.jsx("div",{className:"thread-group__empty",children:"这个线程还没有会话"}):r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"thread-group__sessions",children:On.map(C=>xt(C))}),Cn?r.jsx("button",{type:"button",className:"thread-group__session-toggle",onClick:()=>Dt(D.id),"aria-expanded":Ct,children:Ct?"折叠显示":"展开显示"}):null]}):null]},D.id)}),jn]},D.id)},Va=D=>{if(!de||de.pane!==D)return null;const he=$e(D).find(Ye=>Ye.project.id===de.projectId);if(!he)return null;const Oe={top:de.previewTop,width:`${de.itemWidth}px`},Be=he.project.display_name??he.project.name;return r.jsx("div",{className:"thread-group-drag-preview",style:Oe,"aria-hidden":"true",children:r.jsxs("div",{className:"thread-group-drag-preview__header",children:[r.jsx("span",{className:"thread-group-drag-preview__chevron",children:r.jsx(hy,{open:!0})}),r.jsx("span",{className:"thread-group-drag-preview__icon",children:r.jsx(fy,{})}),r.jsx("span",{className:"thread-group-drag-preview__title",children:Be})]})})};return r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",className:`sidebar-scrim ${R?"is-visible":""}`,style:{opacity:c?0:a,pointerEvents:c?"none":R?"auto":"none",transition:l?"none":void 0},onClick:f,"aria-label":"关闭侧边栏"}),r.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:l?"none":void 0},children:[c&&p?r.jsx("div",{className:"conversation-sidebar__resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"调整侧边栏宽度",onPointerDown:D=>{D.pointerType!=="touch"&&(D.preventDefault(),D.stopPropagation(),p(D.clientX))}}):null,r.jsxs("div",{className:"conversation-sidebar__header",children:[r.jsxs("div",{className:`conversation-sidebar__brand ${q?`is-${re?"online":"offline"}`:"is-empty"}`,"aria-label":q?re?"节点在线":"节点断开":"未选择节点",title:q?re?"节点在线":"节点断开":"未选择节点",children:[q?r.jsx("span",{className:"conversation-sidebar__status-dot","aria-hidden":"true"}):null,r.jsx("span",{className:"conversation-sidebar__brand-name",children:(y==null?void 0:y.name)??"未选择节点"})]}),c?null:r.jsx("button",{type:"button",className:"conversation-sidebar__close",onClick:f,"aria-label":"关闭",children:"×"})]}),r.jsxs("div",{className:"conversation-sidebar__actions",children:[r.jsxs(Iu,{to:"/nodes",className:"sidebar-action",onClick:f,children:[r.jsx("span",{className:"sidebar-action__icon",children:r.jsx(kj,{})}),r.jsx("span",{children:"节点列表"})]}),r.jsxs("button",{type:"button",className:"sidebar-action sidebar-action--primary",onClick:()=>{f();const D=m.find(he=>he.id===oe)??m[0];D?x(D.id,D.name):U({to:"/nodes"})},children:[r.jsx("span",{className:"sidebar-action__icon",children:r.jsx(Nj,{})}),r.jsx("span",{children:"新会话"})]})]}),r.jsx("div",{className:"conversation-sidebar__threads",children:r.jsxs("div",{className:"sidebar-pane-track",style:{transform:Gs},children:[r.jsxs("div",{ref:D=>{V.current.threads=D},className:`sidebar-pane ${z==="threads"?"is-active":"is-inactive"}`,children:[qe.length>0?r.jsxs("div",{className:"sidebar-pinned",children:[r.jsx("div",{className:"conversation-sidebar__node",children:"置顶会话"}),r.jsx("div",{className:"sidebar-pinned__list",children:qe.map(D=>xt(D))})]}):null,r.jsxs("div",{className:"conversation-sidebar__node-row",children:[r.jsx("div",{className:"conversation-sidebar__node",children:"线程"}),j?r.jsx("button",{type:"button",className:"conversation-sidebar__node-action",onClick:j,"aria-label":"新增目录线程",title:"新增目录线程",children:r.jsx(Cj,{})}):null]}),as.map(D=>is(D,"threads")),Va("threads"),r.jsxs("button",{type:"button",className:"thread-archive__toggle",onClick:()=>we("archived"),children:[r.jsx("span",{children:"已归档"}),r.jsx("span",{className:"thread-archive__icon",children:r.jsx(Ej,{})})]})]}),r.jsxs("div",{ref:D=>{V.current.archived=D},className:`sidebar-pane sidebar-pane--archived ${z==="archived"?"is-active":"is-inactive"}`,children:[r.jsx("div",{className:"conversation-sidebar__node",children:"已归档的线程"}),Sn.length>0?r.jsx("div",{className:"thread-archive__list",children:Sn.map(D=>is(D,"archived"))}):r.jsx("div",{className:"thread-archive__empty",children:"暂时没有已归档的线程"}),Va("archived"),r.jsxs("button",{type:"button",className:"thread-archive__back",onClick:()=>we("threads"),"aria-label":"返回线程列表",children:[r.jsx("span",{className:"thread-archive__back-icon",children:r.jsx(Tj,{})}),r.jsx("span",{children:"返回"})]})]})]})}),r.jsx("div",{className:"conversation-sidebar__footer",children:r.jsxs(Iu,{to:"/settings",className:"sidebar-settings",onClick:f,"aria-label":"打开设置页",children:[r.jsx("span",{className:"sidebar-settings__icon",children:r.jsx(Mj,{})}),r.jsx("span",{children:"设置"})]})})]}),Bi]})}),C0="optimistic-user:",$j="overlay-user:",Hj=[C0,$j],qj=5e3,ki=n=>["timeline-optimistic",n],Nh=n=>n.kind==="user"&&Hj.some(t=>n.id.startsWith(t)),E0=n=>n.kind==="user"&&!Nh(n),T0=n=>n.kind==="user"&&n.id.startsWith(C0),Fj=n=>n.kind==="user"&&!T0(n),my=n=>n.body.replace(/\r\n/g,`
118
+ `).trim(),py=n=>new Date(n).getTime(),Ch=(n,t)=>{if(my(n)!==my(t))return!1;const a=py(n.timestamp),l=py(t.timestamp);return!Number.isFinite(a)||!Number.isFinite(l)?!0:l>=a-qj},Qj=(n,t)=>{const a=t.filter(E0);if(a.length===0)return new Set;const l=new Set,c=new Set;for(const u of n??[]){if(!Nh(u))continue;const f=a.findIndex((p,y)=>!l.has(y)&&Ch(u,p));f<0||(l.add(f),c.add(u.id))}return c},Gj=(n,t)=>{const a=t.map((u,f)=>({entry:u,index:f})).filter(({entry:u})=>E0(u));if(a.length===0)return new Map;const l=new Set,c=new Map;for(const u of n??[]){if(!Nh(u))continue;const f=a.find(({entry:p,index:y})=>!l.has(y)&&Ch(u,p));f&&(l.add(f.index),(u.attachments??[]).length!==0&&c.set(f.index,p3(f.entry.attachments,u.attachments)))}return c},Wj=(n,t)=>{const a=t.filter(Fj);if(a.length===0)return new Set;const l=new Set,c=new Set;for(const u of n??[]){if(!T0(u))continue;const f=a.findIndex((p,y)=>!l.has(y)&&Ch(u,p));f<0||(l.add(f),c.add(u.id))}return c},Yj=n=>{const t=[...n??[]],a=t.map((u,f)=>({entry:u,index:f})).filter(({entry:u})=>E0(u));if(a.length===0)return t;const l=new Set,c=new Set;for(const u of t){if(!Nh(u))continue;const f=a.find(({entry:p,index:y})=>!l.has(y)&&Ch(u,p));f&&(l.add(f.index),c.add(u.id))}return c.size===0?t:t.filter(u=>!c.has(u.id))},V3=(n,t)=>[...n??[],t],K3=(n,t)=>{const a=Gj(n,t),l=Qj(n,t),c=[...n??[]].filter(f=>!l.has(f.id)),u=new Set(c.map(f=>f.id));for(const[f,p]of t.entries())u.has(p.id)||(u.add(p.id),c.push(a.has(f)?{...p,attachments:a.get(f)??p.attachments}:p));return c},Ff=(n,t)=>[...K3(n,t)].sort((a,l)=>{const c=new Date(a.timestamp).getTime(),u=new Date(l.timestamp).getTime();return!Number.isFinite(c)||!Number.isFinite(u)?0:c-u}),Tu=(n,t)=>(n??[]).filter(a=>T0(a)&&!Wj([a],t).has(a.id)),Vj=(n,t)=>{const a=Yj(n),l=Tu(t,a);return Ff(l,a)},Kj=(n,t)=>(n??[]).filter(a=>a.id!==t),Z3="panda:session-model",X3="panda:command-execution-model",M0="panda:session-model-options",U1="panda:session-model-options-updated",J3="panda:session-reasoning",ev="panda:session-fast-mode",tv="panda:session-plan-mode",nv="panda:session-yolo-mode",cc=[{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"}],Ku=[{label:"低",value:"low"},{label:"中",value:"medium"},{label:"高",value:"high"},{label:"极高",value:"xhigh"}];var g2;const sv=((g2=cc[0])==null?void 0:g2.value)??"gpt-5.4",gy="gpt-5.4-mini",Zj=Ku[2].value,Di=n=>typeof n=="string"?n.trim():"",Xj=(n,t)=>{if(!n||typeof n!="object")return null;const a=n,l=Di(a.value),c=Di(a.label)||l,u=Di(a.id)||l||`custom-model-${t+1}`;if(!c||!l)return null;const f=Di(a.description);return{id:u,label:c,value:l,description:f||null}},Jj=n=>{const t=new Set,a=new Set;return n.flatMap(l=>{const c=l.value.toLowerCase();if(a.has(c))return[];a.add(c);let u=l.id,f=2;for(;t.has(u);)u=`${l.id}-${f}`,f+=1;return t.add(u),[{...l,id:u}]})},av=n=>{if(!Array.isArray(n))return cc;const t=Jj(n.flatMap((a,l)=>{const c=Xj(a,l);return c?[c]:[]}));return t.length>0?t:cc},od=n=>{if(typeof window>"u")return null;try{return window.localStorage.getItem(n)}catch{return null}},ew=()=>{typeof window>"u"||window.dispatchEvent(new Event(U1))},cd=(n,t)=>{if(!(typeof window>"u"))try{window.localStorage.setItem(n,t)}catch{}},R0=(n,t=!1)=>{const a=od(n);return a==="true"?!0:a==="false"?!1:t},A0=(n,t)=>{cd(n,t?"true":"false")},mc=(n,t)=>{const a=t==null?void 0:t.trim();return a?`${n}:${a}`:null},ju=n=>{const t=Di(n==null?void 0:n.value)||"",a=Di(n==null?void 0:n.label)||t;return{id:Di(n==null?void 0:n.id)||Di(n==null?void 0:n.value)||`custom-model-${Date.now()}`,label:a,value:t,description:Di(n==null?void 0:n.description)||null}},tw=()=>Eh().map(({id:n,...t})=>t),Eh=()=>{const n=od(M0);if(!n)return cc;try{return av(JSON.parse(n))}catch{return cc}},nw=n=>{const t=av(n);cd(M0,JSON.stringify(t)),ew()},sw=n=>Ku.some(t=>t.value===n),D0=()=>{var a;const n=od(Z3),t=Eh();return t.some(l=>l.value===n)?n:((a=t[0])==null?void 0:a.value)??sv},Qf=()=>{const n=od(X3),t=Eh();if(t.some(l=>l.value===n))return n;const a=t.find(l=>l.value===gy)??t[0];return(a==null?void 0:a.value)??gy},iv=()=>{const n=od(J3);return sw(n)?n:Zj},Pu=n=>{cd(Z3,n)},Jp=n=>{cd(X3,n)},rv=n=>{cd(J3,n)},yy=n=>{const t=mc(ev,n);return t?R0(t):!1},vy=n=>{const t=mc(tv,n);return t?R0(t):!1},_y=n=>{const t=mc(nv,n);return t?R0(t):!1},lv=(n,t)=>{const a=mc(ev,n);a&&A0(a,t)},ov=(n,t)=>{const a=mc(tv,n);a&&A0(a,t)},cv=(n,t)=>{const a=mc(nv,n);a&&A0(a,t)},aw=(n,t)=>{lv(n,t.isFastModeEnabled),ov(n,t.isPlanModeEnabled),cv(n,t.isYoloModeEnabled)},gh=(n,t=tw())=>{var a,l;return((a=t.find(c=>c.value===n))==null?void 0:a.label)??(typeof n=="string"&&n.trim()?n.trim():((l=t[0])==null?void 0:l.label)??sv)},iw=n=>{var t;return((t=Ku.find(a=>a.value===n))==null?void 0:t.label)??Ku[2].label},uv="image/",rw=()=>`attachment-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,lw=n=>new Promise((t,a)=>{const l=new FileReader;l.onerror=()=>a(l.error??new Error("无法读取文件")),l.onload=()=>{if(typeof l.result=="string"&&l.result){t(l.result);return}a(new Error("无法读取文件"))},l.readAsDataURL(n)}),dv=async n=>({id:rw(),kind:n.type.startsWith(uv)?"image":"file",name:n.name,mime_type:n.type||null,size_bytes:Number.isFinite(n.size)?Math.max(0,Math.round(n.size)):null,data_url:await lw(n)}),by=n=>{var t;return n.kind==="image"||!!((t=n.mime_type)!=null&&t.startsWith(uv))},fv=n=>m3((n??[]).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}))),$1=n=>typeof n!="number"||!Number.isFinite(n)||n<=0?null:n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`,ow=/\[[^\]]+\]\([^)]+\)|`[^`\n]+`|\*\*.+?\*\*|\*[^*\n][^*\n]*\*|\$[A-Za-z0-9._-]+|\/[A-Za-z][A-Za-z0-9._-]*/g,cw=/^[A-Za-z0-9._-]$/,uw=/^[A-Za-z0-9._-]$/,H1=n=>/\s/.test(n),xy=n=>cw.test(n),dw=n=>uw.test(n),ia=n=>n.trim().toLowerCase(),fw=n=>ia(n).split(/[^a-z0-9]+/i).filter(Boolean),Sy=n=>n==="repo"?0:n==="user"?1:2,hw=n=>n==="repo"?"项目":n==="user"?"个人":"系统",hv=n=>{const t=[];let a=0;for(const l of n.matchAll(ow)){const c=l[0],u=l.index??0;if(c.startsWith("$")){const f=u>0?n[u-1]??"":"";if(u>0&&!H1(f))continue}if(c.startsWith("/")){const f=u>0?n[u-1]??"":"";if(u>0&&!H1(f))continue}if(u>a&&t.push({kind:"text",value:n.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 f=/^\[([^\]]+)\]\(([^)]+)\)$/.exec(c);f?t.push({kind:"path-link",label:f[1]??"",path:f[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<n.length&&t.push({kind:"text",value:n.slice(a)}),t},mv=(n,t,a=t)=>{if(t!==a)return null;let l=t;for(;l>0&&xy(n[l-1]??"");)l-=1;const c=l-1;if(c<0||n[c]!=="$")return null;const u=c>0?n[c-1]??"":"";if(c>0&&!H1(u))return null;let f=t;for(;f<n.length&&xy(n[f]??"");)f+=1;return{start:c,end:f,query:n.slice(c+1,t)}},mw=(n,t,a,l)=>{const c=mv(n,t,a);if(!c)return null;const p=(n[c.end]??"").length===0?`$${l} `:`$${l}`,y=`${n.slice(0,c.start)}${p}${n.slice(c.end)}`,m=c.start+p.length;return{value:y,selectionStart:m,selectionEnd:m}},O0=n=>n.startsWith("/"),pv=(n,t,a=t)=>{if(!O0(n)||t!==a)return null;const l=n.search(/\s/),c=l<0?n.length:l;if(t>c)return null;let u=1;for(;u<n.length&&dw(n[u]??"");)u+=1;return t>u?null:{start:0,end:u,query:n.slice(1,t)}},pw=(n,t,a,l)=>{const c=pv(n,t,a);if(!c)return null;const p=(n[c.end]??"").length===0?`/${l} `:`/${l}`,y=`${n.slice(0,c.start)}${p}${n.slice(c.end)}`,m=c.start+p.length;return{value:y,selectionStart:m,selectionEnd:m}},gw=(n,t)=>{const a=ia(t),l=n.filter(u=>{if(!u.enabled)return!1;if(!a)return!0;const f=ia(u.name),p=ia(u.description);return f.includes(a)||p.includes(a)}),c=u=>{if(!a)return 0;const f=ia(u.name),p=ia(u.description),y=fw(u.name);return f===a?0:y.some(m=>m===a)?1:f.startsWith(a)?2:y.some(m=>m.startsWith(a))?3:f.includes(a)?4:p.startsWith(a)?5:6};return[...l].sort((u,f)=>{const p=c(u),y=c(f);if(p!==y)return p-y;const m=Sy(u.scope)-Sy(f.scope);if(m!==0)return m;const S=ia(u.name),g=ia(f.name);return S.localeCompare(g)})},yw=(n,t)=>{const a=ia(t);return[...n.filter(c=>{if(!a)return!0;const u=ia(c.name),f=ia(c.description);return u.includes(a)||f.includes(a)})].sort((c,u)=>{const f=ia(c.name),p=ia(u.name),y=f===a?0:f.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:f.localeCompare(p)})},vw=n=>{if(typeof window>"u")return()=>{};const t=l=>{(l.key===null||l.key===M0)&&n()},a=()=>{n()};return window.addEventListener("storage",t),window.addEventListener(U1,a),()=>{window.removeEventListener("storage",t),window.removeEventListener(U1,a)}},_w=()=>Eh(),bw=()=>cc,L0=()=>_.useSyncExternalStore(vw,_w,bw),I0=n=>n.replace(/[\\/]+$/,""),yh=n=>I0(n).replace(/\\/g,"/").toLowerCase(),xw=n=>{const t=I0(n.trim());if(!t)return"新线程";const a=t.split(/[\\/]+/).filter(Boolean),l=a[a.length-1];return l?l.endsWith(":")?t:l:t},Sw=n=>{if(!n)return null;const t=n.trim();if(!t||t==="/"||/^[A-Za-z]:[\\/]?$/.test(t))return null;const a=I0(t),l=Math.max(a.lastIndexOf("/"),a.lastIndexOf("\\"));if(l<0)return null;const c=a.slice(0,l);return c?/^[A-Za-z]:$/.test(c)?`${c}\\`:c:a.startsWith("/")?"/":null},jw=async n=>(await ss({agentId:n.agentId})).client.listDirectories(n),ww=async n=>{const t=n.bootstrapQueryKey??["bootstrap"],a=n.projects.find(u=>u.agent_id===n.agentId&&yh(u.path)===yh(n.path));if(a)return n.queryClient.setQueryData(t,u=>uy(u,a)),a;const c=await(await ss({agentId:n.agentId})).client.createProject({agentId:n.agentId,name:xw(n.path),path:n.path});return n.queryClient.setQueryData(t,u=>uy(u,c.project)),n.queryClient.invalidateQueries({queryKey:t}),c.project},jy=()=>r.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:r.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"})}),kw=()=>r.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:r.jsx("path",{d:"m9 6 6 6-6 6"})}),Nw=()=>r.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:r.jsx("path",{d:"m5 12 4.5 4.5L19 7"})}),wy=n=>!!(n&&/^[A-Za-z]:[\\/]?$/.test(n.trim())),Cw=({agentId:n,projects:t,initialPath:a=null,title:l="选择目录",subtitle:c="线程名会使用目录最后一级名称",confirmLabel:u="选择此目录",cancelLabel:f="返回上级",onProjectCreated:p})=>{const y=Vr(),[m,S]=_.useState(a),[g,x]=_.useState(a),[j,k]=_.useState([]),[E,N]=_.useState(!0),[P,H]=_.useState(null);_.useEffect(()=>{S(a),x(a)},[a]),_.useEffect(()=>{let F=!1;return N(!0),H(null),jw({agentId:n,path:m}).then(be=>{F||k(be)}).catch(be=>{F||(H(be instanceof Error?be.message:"目录列表加载失败"),k([]))}).finally(()=>{F||N(!1)}),()=>{F=!0}},[n,m]);const U=ns({mutationFn:async F=>ww({agentId:n,path:F,projects:t,queryClient:y,bootstrapQueryKey:yt}),onSuccess:F=>{p(F)}}),R=_.useMemo(()=>{const F=new Map;for(const be of t)F.set(yh(be.path),be);return F},[t]),q=_.useMemo(()=>g?R.get(yh(g))??null:null,[R,g]),re=u!=="选择此目录"?u:q?"在线程中继续":"创建新线程",V=Sw(m),ee=V!==null||wy(m),Z=()=>{if(V!==null){S(V),x(V);return}wy(m)&&(S(null),x(null))},W=F=>{S(F),x(F)};return r.jsx("section",{className:"directory-picker",children:r.jsxs("div",{className:"directory-picker__panel",children:[r.jsx("header",{className:"directory-picker__header",children:r.jsxs("div",{className:"directory-picker__heading",children:[r.jsx("h2",{children:l}),c?r.jsx("p",{children:c}):null]})}),r.jsxs("div",{className:"directory-picker__field",children:[r.jsx("span",{className:"directory-picker__field-label",children:"当前路径"}),r.jsxs("button",{type:"button",className:`directory-picker__path ${g===m?"is-selected":""}`,onClick:()=>{m&&x(m)},disabled:!m,"aria-pressed":g===m,children:[r.jsx("span",{className:"directory-picker__path-icon",children:r.jsx(jy,{})}),r.jsx("span",{className:"directory-picker__path-value",children:m??"根目录"})]})]}),r.jsxs("div",{className:"directory-picker__field",children:[r.jsx("span",{className:"directory-picker__field-label",children:"目录"}),r.jsx("div",{className:"directory-picker__list",role:"listbox","aria-label":"目录列表",children:E?r.jsx("div",{className:"directory-picker__state",children:"正在读取目录…"}):P?r.jsx("div",{className:"directory-picker__state is-error",children:P}):j.length===0?r.jsx("div",{className:"directory-picker__state",children:"当前目录下没有可用子目录"}):j.map(F=>{const be=g===F.path;return r.jsx("div",{className:`directory-picker__row ${be?"is-selected":""}`,children:r.jsxs("button",{type:"button",className:"directory-picker__row-main",onClick:pe=>{const Y=pe.target;if(F.has_children&&Y.closest('[data-enter-directory="true"]')){W(F.path);return}x(F.path)},onDoubleClick:()=>{F.has_children&&W(F.path)},"aria-selected":be,children:[r.jsx("span",{className:"directory-picker__row-icon",children:r.jsx(jy,{})}),r.jsx("span",{className:"directory-picker__row-name",children:F.name}),F.has_children?r.jsx("span",{className:"directory-picker__row-enter","data-enter-directory":"true","aria-hidden":"true",children:r.jsx(kw,{})}):be?r.jsx("span",{className:"directory-picker__row-check",children:r.jsx(Nw,{})}):null]})},F.path)})})]}),U.error?r.jsx("div",{className:"directory-picker__feedback is-error",role:"status","aria-live":"polite",children:U.error instanceof Error?U.error.message:"创建线程失败"}):null,r.jsx("footer",{className:"directory-picker__footer",children:r.jsxs("div",{className:"directory-picker__footer-actions",children:[ee?r.jsx("button",{type:"button",className:"directory-picker__secondary",onClick:Z,children:r.jsx("span",{children:f})}):null,r.jsx("button",{type:"button",className:"directory-picker__primary",disabled:!g||U.isPending,onClick:()=>{g&&U.mutate(g)},children:U.isPending?"创建中…":re})]})})]})})},Ew=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 281.999849615234 85.965369875" width="281.999849615234" height="85.965369875" role="img" aria-label="Panda wordmark">
119
+ <path fill="#d97757" fill-rule="nonzero" d="M539.0830078125,114.554069519043C537.650695800781,114.554061889648 536.2041015625,114.826202392578 534.7431640625,115.370460510254 533.2822265625,115.914741516113 531.892883300781,116.616561889648 530.5751953125,117.475936889648 529.257507324219,118.335311889648 528.054382324219,119.280624389648 526.9658203125,120.311874389648 525.877258300781,121.343124389648 524.9892578125,122.345733642578 524.3017578125,123.319686889648 522.9267578125,125.153022766113 521.480163574219,127.244171142578 519.9619140625,129.593124389648 518.443664550781,131.942077636719 516.925476074219,134.405624389648 515.4072265625,136.983749389648 513.888977050781,139.561874389648 512.4423828125,142.197296142578 511.0673828125,144.889999389648 509.6923828125,147.582702636719 508.474945068359,150.203796386719 507.4150390625,152.753280639648 506.355133056641,155.302764892578 505.510101318359,157.737655639648 504.8798828125,160.057968139648 504.249664306641,162.378280639648 503.9345703125,164.455108642578 503.9345703125,166.288436889648 503.9345703125,168.981140136719 504.4501953125,171.143905639648 505.4814453125,172.776718139648 506.5126953125,174.409530639648 508.460601806641,175.225936889648 511.3251953125,175.225936889648 512.299133300781,175.225936889648 513.7314453125,174.610046386719 515.6220703125,173.378280639648 517.5126953125,172.146514892578 519.5322265625,170.585311889648 521.6806640625,168.694686889648 523.8291015625,166.804061889648 525.9345703125,164.755889892578 527.9970703125,162.550155639648 530.0595703125,160.344421386719 531.749694824219,158.238952636719 533.0673828125,156.233749389648 534.499694824219,154.113952636719 535.9462890625,151.793640136719 537.4072265625,149.272811889648 538.8681640625,146.751983642578 540.2001953125,144.173858642578 541.4033203125,141.538436889648 542.6064453125,138.903015136719 543.580383300781,136.310577392578 544.3251953125,133.761093139648 545.070007324219,131.211608886719 545.4423828125,128.848327636719 545.4423828125,126.671249389648 545.4423828125,122.374374389648 544.7978515625,119.280624389648 543.5087890625,117.389999389648 542.2197265625,115.499374389648 540.744445800781,114.554061889648 539.0830078125,114.554069519043z M416.966674804688,110.343124389648C413.930206298828,110.343124389648 409.805206298828,113.522811889648 404.591674804688,119.882186889648 401.956268310547,123.147811889648 399.535675048828,126.270210266113 397.329956054688,129.249374389648 395.124237060547,132.228546142578 393.104705810547,135.179061889648 391.271362304688,138.100936889648 389.266143798828,141.251983642578 387.561737060547,144.145202636719 386.158081054688,146.780624389648 384.754425048828,149.416046142578 383.565643310547,151.764999389648 382.591674804688,153.827499389648 379.211456298828,161.103546142578 377.521362304688,166.832702636719 377.521362304688,171.014999389648 377.521362304688,176.343124389648 379.326049804688,179.007186889648 382.935424804688,179.007186889648 386.143768310547,179.007186889648 390.555206298828,177.145202636719 396.169799804688,173.421249389648 401.956268310547,169.468124389648 406.425018310547,165.916046142578 409.576049804688,162.764999389648 412.841674804688,159.327499389648 415.563018798828,156.434265136719 417.740112304688,154.085311889648 419.917205810547,151.736358642578 421.635955810547,149.845733642578 422.896362304688,148.413436889648 424.156768798828,146.981140136719 425.316925048828,145.376983642578 426.376831054688,143.600936889648 427.436706542969,141.824890136719 428.453643798828,139.876983642578 429.427612304688,137.757186889648 427.938018798828,137.413436889648 426.806518554688,136.668640136719 426.033081054688,135.522811889648 425.259643554688,134.376983642578 424.872924804688,133.087921142578 424.872924804688,131.655624389648 424.872924804688,130.509796142578 425.044799804688,128.819686889648 425.388549804688,126.585311889648 425.732299804688,124.350936889648 425.904174804688,122.632186889648 425.904174804688,121.429061889648 425.904174804688,120.397811889648 425.632019042969,119.237655639648 425.087768554688,117.948593139648 424.543487548828,116.659530639648 423.841674804688,115.456405639648 422.982299804688,114.339218139648 422.122924804688,113.222030639648 421.163299560547,112.276718139648 420.103393554688,111.503280639648 419.043487548828,110.729843139648 417.997924804688,110.343124389648 416.966674804688,110.343124389648z M181.0703125,108.538436889648C178.95051574707,108.767608642578 176.6875,109.469429016113 174.28125,110.643905639648 171.875,111.818389892578 169.32551574707,113.623077392578 166.6328125,116.057968139648 163.940093994141,118.492866516113 161.104156494141,121.629585266113 158.125,125.468124389648 155.14582824707,129.306671142578 152.05207824707,133.975936889648 148.84375,139.475936889648 147.869781494141,141.137390136719 146.795562744141,142.956405639648 145.62109375,144.932968139648 144.44660949707,146.909530639648 143.32942199707,149.086608886719 142.26953125,151.464218139648 141.20964050293,153.841827392578 140.32160949707,156.376983642578 139.60546875,159.069686889648 138.88932800293,161.762390136719 138.53125,164.598327636719 138.53125,167.577499389648 138.53125,169.353546142578 139.17578125,170.699890136719 140.46484375,171.616561889648 141.75390625,172.533233642578 143.0859375,172.991561889648 144.4609375,172.991561889648 145.893218994141,172.991561889648 147.75520324707,172.203796386719 150.046875,170.628280639648 152.338531494141,169.052764892578 154.81640625,166.961608886719 157.48046875,164.354843139648 160.14453125,161.748077392578 162.865875244141,158.768905639648 165.64453125,155.417343139648 168.42317199707,152.065780639648 171.00129699707,148.613952636719 173.37890625,145.061874389648 175.756500244141,141.509796142578 177.819000244141,138.014999389648 179.56640625,134.577499389648 181.31379699707,131.139999389648 182.502593994141,128.017608642578 183.1328125,125.210311889648 183.3046875,124.350936889648 183.50520324707,123.334014892578 183.734375,122.159530639648 183.963531494141,120.985054016113 184.178375244141,119.810577392578 184.37890625,118.636093139648 184.57942199707,117.461616516113 184.75129699707,116.373077392578 184.89453125,115.370460510254 185.037750244141,114.367866516113 185.109375,113.637397766113 185.109375,113.179061889648 185.109375,113.064483642578 185.0234375,112.749374389648 184.8515625,112.233749389648 184.6796875,111.718124389648 184.421875,111.188179016113 184.078125,110.643905639648 183.734375,110.099639892578 183.319000244141,109.612655639648 182.83203125,109.182968139648 182.34504699707,108.753280639648 181.815093994141,108.538436889648 181.2421875,108.538436889648L181.0703125,108.538436889648z M453.576049804688,56.2884368896484C455.294799804688,56.2884368896484 456.984893798828,56.6608428955078 458.646362304688,57.4056243896484 460.422393798828,58.0931243896484 461.310424804688,59.0670928955078 461.310424804688,60.3274993896484 461.310424804688,61.0149993896484 461.181518554688,62.1321868896484 460.923706054688,63.6790618896484 460.665893554688,65.2259368896484 460.307800292969,67.2311477661133 459.849487304688,69.6946868896484 459.391143798828,72.1582336425781 458.775268554688,75.2090148925781 458.001831054688,78.8470306396484 457.228393554688,82.4850540161133 456.383331298828,86.8248977661133 455.466674804688,91.8665618896484 455.409362792969,92.4394836425781 455.237487792969,93.5853118896484 454.951049804688,95.3040618896484 454.664581298828,97.0228118896484 454.349487304688,98.8418273925781 454.005737304688,100.761093139648 453.661987304688,102.680366516113 453.346862792969,104.456405639648 453.060424804688,106.089218139648 452.773956298828,107.722030639648 452.602081298828,108.738960266113 452.544799804688,109.139999389648 451.799987792969,113.780624389648 451.198425292969,118.134796142578 450.740112304688,122.202499389648 450.281768798828,126.270210266113 450.052612304688,130.395202636719 450.052612304688,134.577499389648 450.052612304688,137.900421142578 450.138549804688,141.824890136719 450.310424804688,146.350936889648 450.482299804688,150.934265136719 450.911987304688,155.374374389648 451.599487304688,159.671249389648 452.286987304688,163.968124389648 453.289581298828,166.116561889648 454.607299804688,166.116561889648 459.305206298828,166.116561889648 464.977081298828,163.968124389648 471.622924804688,159.671249389648 478.211456298828,155.317077636719 484.570831298828,150.332702636719 490.701049804688,144.718124389648 493.766143798828,141.910827636719 496.659362792969,139.167999267578 499.380737304688,136.489608764648L504.336578369141,131.408462524414 505.0302734375,130.205429077148C506.390960693359,128.092803955078 507.859069824219,126.041038513184 509.4345703125,124.050155639648 512.585632324219,120.068389892578 515.7939453125,116.573593139648 519.0595703125,113.565780639648 522.3251953125,110.557968139648 525.433288574219,108.180366516113 528.3837890625,106.432968139648 531.334289550781,104.685577392578 533.726257324219,103.811874389648 535.5595703125,103.811874389648 536.0751953125,103.811874389648 536.662414550781,103.926460266113 537.3212890625,104.155616760254 537.980163574219,104.384796142578 538.667663574219,104.628280639648 539.3837890625,104.886093139648 540.099914550781,105.143905639648 540.787414550781,105.373077392578 541.4462890625,105.573593139648 542.105163574219,105.774116516113 542.663757324219,105.874374389648 543.1220703125,105.874374389648 543.580383300781,105.874374389648 544.038757324219,105.774116516113 544.4970703125,105.573593139648 544.955383300781,105.373077392578 545.413757324219,105.143905639648 545.8720703125,104.886093139648 546.330383300781,104.628280639648 546.788757324219,104.384796142578 547.2470703125,104.155616760254 547.705383300781,103.926460266113 548.163757324219,103.811874389648 548.6220703125,103.811874389648 549.3095703125,103.811874389648 550.054382324219,104.041046142578 550.8564453125,104.499374389648 551.658508300781,104.957710266113 552.431945800781,105.544952392578 553.1767578125,106.261093139648 553.921569824219,106.977241516113 554.580383300781,107.793647766113 555.1533203125,108.710311889648 555.726257324219,109.626983642578 556.127258300781,110.514999389648 556.3564453125,111.374374389648 556.585632324219,112.405624389648 556.886413574219,113.164741516113 557.2587890625,113.651718139648 557.631164550781,114.138702392578 558.003601074219,114.582710266113 558.3759765625,114.983749389648 558.748352050781,115.384796142578 559.0634765625,115.857452392578 559.3212890625,116.401718139648 559.5791015625,116.945991516113 559.7080078125,117.791046142578 559.7080078125,118.936874389648 559.7080078125,119.509796142578 559.507507324219,120.712921142578 559.1064453125,122.546249389648 558.705383300781,124.379585266113 558.261413574219,126.513702392578 557.7744140625,128.948593139648 557.287414550781,131.383483886719 556.843444824219,133.918640136719 556.4423828125,136.554061889648 556.041320800781,139.189483642578 555.8408203125,141.595733642578 555.8408203125,143.772811889648 555.8408203125,149.903015136719 556.1845703125,154.916046142578 556.8720703125,158.811874389648 557.5595703125,162.707702636719 558.5048828125,165.787139892578 559.7080078125,168.050155639648 560.9111328125,170.313171386719 562.3291015625,171.874374389648 563.9619140625,172.733749389648 565.5947265625,173.593124389648 567.327819824219,174.022811889648 569.1611328125,174.022811889648 573.515319824219,174.022811889648 577.081726074219,173.278015136719 579.8603515625,171.788436889648 582.638977050781,170.298858642578 585.116882324219,168.093124389648 587.2939453125,165.171249389648 587.924133300781,164.369171142578 588.468444824219,163.653015136719 588.9267578125,163.022811889648 589.385070800781,162.392608642578 589.843383789063,162.077499389648 590.3017578125,162.077499389648 591.103820800781,162.077499389648 591.834289550781,162.392608642578 592.4931640625,163.022811889648 593.151977539063,163.653015136719 593.4814453125,164.311874389648 593.4814453125,164.999374389648 593.4814453125,165.916046142578 593.295227050781,166.961608886719 592.9228515625,168.136093139648 592.550476074219,169.310577392578 591.963195800781,170.499374389648 591.1611328125,171.702499389648 590.1298828125,173.478546142578 588.769165039063,175.297546386719 587.0791015625,177.159530639648 585.388977050781,179.021514892578 583.498352050781,180.711608886719 581.4072265625,182.229843139648 579.316101074219,183.748077392578 577.038757324219,184.994171142578 574.5751953125,185.968124389648 572.111633300781,186.942077636719 569.562194824219,187.429061889648 566.9267578125,187.429061889648 563.4892578125,187.429061889648 560.5244140625,186.655624389648 558.0322265625,185.108749389648 555.5400390625,183.561874389648 553.3916015625,181.456405639648 551.5869140625,178.792343139648 549.7822265625,176.128280639648 548.292663574219,173.020202636719 547.1181640625,169.468124389648 545.943664550781,165.916046142578 544.984069824219,162.163436889648 544.2392578125,158.210311889648 541.718444824219,161.876983642578 538.724914550781,165.514999389648 535.2587890625,169.124374389648 531.792663574219,172.733749389648 528.2119140625,175.985046386719 524.5166015625,178.878280639648 520.8212890625,181.771514892578 517.183288574219,184.120468139648 513.6025390625,185.925155639648 510.021820068359,187.729843139648 506.8564453125,188.632186889648 504.1064453125,188.632186889648 502.273101806641,188.632186889648 500.511383056641,188.173858642578 498.8212890625,187.257186889648 497.131195068359,186.340515136719 495.6416015625,185.108749389648 494.3525390625,183.561874389648 493.0634765625,182.014999389648 492.046539306641,180.238952636719 491.3017578125,178.233749389648 490.556976318359,176.228546142578 490.1845703125,174.108749389648 490.1845703125,171.874374389648 490.1845703125,169.639999389648 490.370758056641,167.291046142578 490.7431640625,164.827499389648 491.115570068359,162.363952636719 491.745758056641,159.714218139648 492.6337890625,156.878280639648L493.119232177734,155.466354370117 492.849487304688,155.761093139648C490.385925292969,158.253280639648 487.779174804688,160.788436889648 485.029174804688,163.366561889648 482.279174804688,165.944686889648 479.615112304688,168.264999389648 477.036987304688,170.327499389648 474.458862304688,172.389999389648 471.938018798828,174.251983642578 469.474487304688,175.913436889648 464.604675292969,179.236358642578 460.708862304688,180.897811889648 457.786987304688,180.897811889648 456.641143798828,180.897811889648 455.180206298828,180.496765136719 453.404174804688,179.694686889648 449.794799804688,178.033233642578 446.930206298828,174.996765136719 444.810424804688,170.585311889648 442.747924804688,166.173858642578 441.286987304688,161.561874389648 440.427612304688,156.749374389648 439.568237304688,151.936874389648 438.852081298828,146.551452636719 438.279174804688,140.593124389648 431.117706298828,153.942077636719 421.836456298828,165.801452636719 410.435424804688,176.171249389648 398.977081298828,186.598327636719 387.117706298828,191.811874389648 374.857299804688,191.811874389648 371.477081298828,191.811874389648 368.898956298828,190.007186889648 367.122924804688,186.397811889648 365.346893310547,182.845733642578 364.458862304688,179.150421142578 364.458862304688,175.311874389648 364.458862304688,170.155624389648 364.888549804688,166.317077636719 365.747924804688,163.796249389648L366.740081787109,161.069854736328 361.366027832031,165.944686889648C358.67333984375,168.179061889648 356.037902832031,170.155624389648 353.459777832031,171.874374389648 351.397277832031,173.249374389648 349.43505859375,174.538436889648 347.573059082031,175.741561889648 345.711090087891,176.944686889648 343.834777832031,177.975936889648 341.944152832031,178.835311889648 340.053527832031,179.694686889648 338.076965332031,180.382186889648 336.014465332031,180.897811889648 333.951965332031,181.413436889648 331.68896484375,181.671249389648 329.225402832031,181.671249389648 324.47021484375,181.671249389648 320.60302734375,180.468124389648 317.623840332031,178.061874389648 316.13427734375,176.858749389648 314.830871582031,175.297546386719 313.713684082031,173.378280639648 312.596496582031,171.459014892578 311.62255859375,169.324890136719 310.791809082031,166.975936889648 309.961090087891,164.626983642578 309.244934082031,162.134796142578 308.643371582031,159.499374389648 308.041809082031,156.863952636719 307.54052734375,154.257186889648 307.139465332031,151.679061889648 306.623840332031,148.470733642578 306.136871337891,145.591827392578 305.678527832031,143.042343139648 305.22021484375,140.492858886719 304.690246582031,138.344421386719 304.088684082031,136.597030639648 303.487121582031,134.849639892578 302.756652832031,133.503280639648 301.897277832031,132.557968139648 301.037902832031,131.612655639648 299.920715332031,131.139999389648 298.545715332031,131.139999389648 297.457183837891,131.139999389648 296.425933837891,131.254577636719 295.451965332031,131.483749389648 294.47802734375,131.712921142578 293.461090087891,132.171249389648 292.401184082031,132.858749389648 291.34130859375,133.546249389648 290.18115234375,134.520202636719 288.920715332031,135.780624389648 287.660308837891,137.041046142578 286.18505859375,138.702499389648 284.494934082031,140.764999389648 282.804840087891,142.827499389648 280.871246337891,145.348327636719 278.694152832031,148.327499389648 276.51708984375,151.306671142578 273.967590332031,154.858749389648 271.045715332031,158.983749389648 269.613433837891,160.988952636719 267.92333984375,163.194686889648 265.975402832031,165.600936889648 264.027496337891,168.007186889648 262.03662109375,170.298858642578 260.002746582031,172.475936889648 257.968902587891,174.653015136719 255.97802734375,176.572296142578 254.03010559082,178.233749389648 252.082183837891,179.895202636719 250.363433837891,180.955108642578 248.87385559082,181.413436889648 243.832183837891,180.324890136719 241.31135559082,174.051452636719 241.31135559082,162.593124389648 241.31135559082,159.556671142578 241.65510559082,154.944686889648 242.34260559082,148.757186889648 242.68635559082,145.949890136719 243.08740234375,143.013702392578 243.54573059082,139.948593139648L243.633743286133,139.477767944336 241.3662109375,142.344100952148C239.48274230957,144.571319580078 237.55989074707,146.694686889648 235.59765625,148.714218139648 231.67317199707,152.753280639648 227.705718994141,156.577499389648 223.6953125,160.186874389648 219.51301574707,163.968124389648 215.34504699707,166.918640136719 211.19140625,169.038436889648 207.037750244141,171.158233642578 203.299468994141,172.218124389648 199.9765625,172.218124389648 198.54426574707,172.218124389648 197.12629699707,171.874374389648 195.72265625,171.186874389648 194.319000244141,170.499374389648 193.00129699707,169.597030639648 191.76953125,168.479843139648 190.537750244141,167.362655639648 189.44921875,166.059265136719 188.50390625,164.569686889648 187.55859375,163.080108642578 186.828125,161.533233642578 186.3125,159.929061889648 186.026031494141,159.069686889648 185.768218994141,158.081405639648 185.5390625,156.964218139648 185.30989074707,155.847030639648 185.080718994141,154.815780639648 184.8515625,153.870468139648 184.62239074707,152.925155639648 184.36457824707,152.123077392578 184.078125,151.464218139648 183.791656494141,150.805358886719 183.4765625,150.475936889648 183.1328125,150.475936889648 182.90364074707,150.475936889648 182.416656494141,150.848327636719 181.671875,151.593124389648 180.92707824707,152.337921142578 180.053375244141,153.297546386719 179.05078125,154.472030639648 178.04817199707,155.646514892578 176.97395324707,156.964218139648 175.828125,158.425155639648 174.682281494141,159.886093139648 173.55078125,161.304061889648 172.43359375,162.679061889648 171.31640625,164.054061889648 170.31379699707,165.314483642578 169.42578125,166.460311889648 168.537750244141,167.606140136719 167.8359375,168.465515136719 167.3203125,169.038436889648 165.54426574707,171.043640136719 163.43879699707,173.091827392578 161.00390625,175.182968139648 158.569000244141,177.274108886719 156.13410949707,179.179061889648 153.69921875,180.897811889648 151.264312744141,182.616561889648 149.02995300293,184.020202636719 146.99609375,185.108749389648 144.96223449707,186.197296142578 143.45832824707,186.741561889648 142.484375,186.741561889648 140.30729675293,186.741561889648 138.20182800293,186.383483886719 136.16796875,185.667343139648 134.13410949707,184.951202392578 132.34375,183.905624389648 130.796875,182.530624389648 129.25,181.155624389648 128.00390625,179.465515136719 127.05859375,177.460311889648 126.11328125,175.455108642578 125.640625,173.163436889648 125.640625,170.585311889648 125.640625,166.345733642578 126.485679626465,161.504577636719 128.17578125,156.061874389648 129.020843505859,153.340515136719 130.001953125,150.597686767578 131.119140625,147.833358764648L132.791915893555,144.115005493164 132.34375,144.417343139648C129.36457824707,146.336608886719 126.05598449707,148.370468139648 122.41796875,150.518905639648 118.779945373535,152.667343139648 114.92707824707,154.844421386719 110.859375,157.050155639648 106.791664123535,159.255889892578 102.72395324707,161.418640136719 98.65625,163.538436889648 94.5885391235352,165.658233642578 90.6354141235352,167.663436889648 86.796875,169.554061889648 82.9583282470703,171.444686889648 79.4635391235352,173.106140136719 76.3125,174.538436889648 74.0208282470703,175.569686889648 71.84375,176.729843139648 69.78125,178.018905639648 67.71875,179.307968139648 65.69921875,180.511093139648 63.7226600646973,181.628280639648 61.74609375,182.745468139648 59.7552070617676,183.676452636719 57.7499961853027,184.421249389648 55.7447891235352,185.166046142578 53.625,185.538436889648 51.390625,185.538436889648 50.0729141235352,185.538436889648 48.7981758117676,185.380889892578 47.5664100646973,185.065780639648 46.3346328735352,184.750671386719 45.2317695617676,184.249374389648 44.2578163146973,183.561874389648 43.2838516235352,182.874374389648 42.49609375,182.000671386719 41.8945274353027,180.940780639648 41.29296875,179.880889892578 40.9921875,178.606140136719 40.9921875,177.116561889648 40.9921875,176.314483642578 41.2643203735352,175.569686889648 41.80859375,174.882186889648 42.3528633117676,174.194686889648 43.0546875,173.578796386719 43.9140625,173.034530639648 44.7734375,172.490264892578 45.71875,171.988952636719 46.75,171.530624389648 47.78125,171.072296142578 48.7838516235352,170.671249389648 49.7578086853027,170.327499389648 50.7890586853027,169.926452636719 52.0065078735352,169.511093139648 53.41015625,169.081405639648 54.8138008117676,168.651718139648 56.2317695617676,168.222030639648 57.6640625,167.792343139648 59.0963516235352,167.362655639648 60.4856719970703,166.918640136719 61.83203125,166.460311889648 63.1783828735352,166.001983642578 64.3385391235352,165.543640136719 65.3125,165.085311889648 67.1458282470703,164.111358642578 68.8645782470703,162.879577636719 70.46875,161.389999389648 72.0729141235352,159.900421142578 73.5625,158.267608642578 74.9375,156.491561889648 76.3125,154.715515136719 77.6015625,152.867858886719 78.8046875,150.948593139648 80.0078125,149.029327392578 81.125,147.181671142578 82.1562576293945,145.405624389648 82.84375,144.202499389648 83.5026016235352,142.856140136719 84.1328125,141.366561889648 84.7630157470703,139.876983642578 85.3216094970703,138.387390136719 85.80859375,136.897811889648 86.2955703735352,135.408233642578 86.66796875,133.990264892578 86.92578125,132.643905639648 87.18359375,131.297546386719 87.3125,130.166046142578 87.3125,129.249374389648 87.3125,125.296249389648 86.453125,122.145210266113 84.734375,119.796249389648 83.015625,117.447296142578 80.8671875,116.272811889648 78.2890548706055,116.272811889648 76.6848907470703,116.272811889648 74.8372344970703,116.802764892578 72.74609375,117.862655639648 70.6549453735352,118.922554016113 68.5637969970703,120.197296142578 66.47265625,121.686874389648 64.3815078735352,123.176460266113 62.43359375,124.737655639648 60.62890625,126.370468139648 58.82421875,128.003280639648 57.3776016235352,129.392608642578 56.2890586853027,130.538436889648 53.6536407470703,133.345733642578 51.1757774353027,136.396514892578 48.85546875,139.690780639648 46.53515625,142.985046386719 44.34375,146.365264892578 42.2812461853027,149.831405639648 40.21875,153.297546386719 38.2708320617676,156.778015136719 36.4375,160.272811889648 34.6041641235352,163.767608642578 32.9140625,167.119171142578 31.3671855926514,170.327499389648 30.6796875,173.020202636719 30.0065097808838,175.999374389648 29.3476543426514,179.264999389648 28.6888008117676,182.530624389648 28.1874980926514,186.111358642578 27.8437538146973,190.007186889648 27.2135410308838,197.741561889648 26.7408847808838,204.645202636719 26.4257793426514,210.718124389648 26.1106758117676,216.791046142578 25.4661445617676,222.348327636719 24.4921913146973,227.389999389648 24.1484375,229.223327636719 23.3177070617676,230.841827392578 22.0000057220459,232.245468139648 20.6822910308838,233.649108886719 18.9635410308838,234.350936889648 16.84375,234.350936889648 16.2135410308838,234.350936889648 15.46875,234.193389892578 14.6093778610229,233.878280639648 13.75,233.563171386719 12.93359375,233.119171142578 12.1601552963257,232.546249389648 11.38671875,231.973327636719 10.7278642654419,231.328796386719 10.1835947036743,230.612655639648 9.63932228088379,229.896514892578 9.3671875,229.108749389648 9.3671875,228.249374389648 9.3671875,226.358749389648 9.49609375,224.024108886719 9.75390529632568,221.245468139648 10.01171875,218.466827392578 10.3125,215.673858642578 10.6562471389771,212.866561889648 11,210.059265136719 11.3294267654419,207.509796142578 11.6445322036743,205.218124389648 11.9596347808838,202.926452636719 12.1744785308838,201.322296142578 12.2890615463257,200.405624389648 13.0911455154419,194.504577636719 13.8072910308838,188.130889892578 14.4375,181.284530639648 15.0677080154419,174.438171386719 15.5833330154419,166.975936889648 15.9843711853027,158.897811889648 16.0416660308838,157.179061889648 16.11328125,154.901718139648 16.1992206573486,152.065780639648 16.28515625,149.229843139648 16.37109375,146.365264892578 16.4570331573486,143.472030639648 16.54296875,140.578796386719 16.62890625,137.886093139648 16.71484375,135.393905639648 16.80078125,132.901718139648 16.9010410308838,131.139999389648 17.0156269073486,130.108749389648 17.8177070617676,119.166046142578 20.6822929382324,113.694686889648 25.6093730926514,113.694686889648 26.5833320617676,113.694686889648 27.5143203735352,113.938179016113 28.4023399353027,114.425163269043 29.2903633117676,114.912139892578 30.078125,115.542343139648 30.7656288146973,116.315780639648 31.453125,117.089218139648 31.9973945617676,117.962921142578 32.3984336853027,118.936874389648 32.7994766235352,119.910835266113 33,120.856147766113 33,121.772804260254 33,123.778022766113 32.78515625,125.940780639648 32.3554725646973,128.261093139648 31.9257793426514,130.581405639648 31.4531230926514,132.959014892578 30.9374961853027,135.393905639648 30.4218730926514,137.828796386719 29.9492168426514,140.220733642578 29.51953125,142.569686889648 29.0898418426514,144.918640136719 28.8749980926514,147.067077636719 28.8750019073486,149.014999389648 28.8749980926514,150.676452636719 29.0468730926514,151.507186889648 29.390625,151.507186889648 33.4010391235352,144.288436889648 37.3255195617676,137.943389892578 41.1640663146973,132.472030639648 45.0026016235352,127.000679016113 48.8411445617676,122.460311889648 52.6796836853027,118.850936889648 55.1432266235352,116.559272766113 57.578125,114.453804016113 59.9843788146973,112.534530639648 62.390625,110.615264892578 64.8111953735352,108.953804016113 67.24609375,107.550155639648 69.6809844970703,106.146514892578 72.2018203735352,105.057968139648 74.80859375,104.284538269043 77.4153594970703,103.511093139648 80.1796875,103.095733642578 83.1015625,103.038436889648 85.1067657470703,102.981147766113 87.18359375,103.468124389648 89.33203125,104.499374389648 91.48046875,105.530624389648 93.4140625,107.077499389648 95.1328125,109.139999389648 96.8515548706055,111.202499389648 98.2695236206055,113.709014892578 99.38671875,116.659530639648 100.503898620605,119.610054016113 101.033843994141,122.947296142578 100.976554870605,126.671249389648 101.033843994141,129.535827636719 100.589836120605,132.400421142578 99.6445236206055,135.264999389648 98.6992111206055,138.129577636719 97.4387969970703,140.951202392578 95.86328125,143.729843139648 94.2877578735352,146.508483886719 92.46875,149.186874389648 90.40625,151.764999389648 88.34375,154.343124389648 86.1953125,156.720733642578 83.9609375,158.897811889648 88.6588516235352,157.121765136719 93.4856719970703,154.944686889648 98.4413986206055,152.366561889648 103.397132873535,149.788436889648 108.35285949707,147.009796142578 113.30859375,144.030624389648 118.264320373535,141.051452636719 123.13410949707,137.957702636719 127.91796875,134.749374389648 132.701812744141,131.541046142578 137.27082824707,128.418640136719 141.625,125.382186889648 142.283843994141,124.923858642578 142.87825012207,124.501327514648 143.408203125,124.114616394043L144.405715942383,123.362648010254 144.4609375,123.276718139648C148.0703125,118.091827392578 151.822906494141,113.637397766113 155.71875,109.913436889648 160.244781494141,105.616561889648 164.98567199707,102.451202392578 169.94140625,100.417350769043 174.897125244141,98.3834915161133 179.98176574707,97.3665618896484 185.1953125,97.3665618896484 186.16926574707,97.3665618896484 187.014312744141,97.5670852661133 187.73046875,97.9681243896484 188.44660949707,98.3691711425781 189.0625,98.8847961425781 189.578125,99.5149993896484 190.09375,100.145210266113 190.55207824707,100.847030639648 190.953125,101.620460510254 191.354156494141,102.393905639648 191.75520324707,103.181671142578 192.15625,103.983749389648 192.385406494141,104.499374389648 192.87239074707,105.072296142578 193.6171875,105.702499389648 194.361968994141,106.332710266113 195.135406494141,106.977241516113 195.9375,107.636093139648 196.73957824707,108.294952392578 197.44140625,108.939483642578 198.04296875,109.569686889648 198.64453125,110.199897766113 198.9453125,110.801460266113 198.9453125,111.374374389648 198.9453125,112.577499389648 198.701812744141,113.909530639648 198.21484375,115.370460510254 197.72785949707,116.831405639648 197.197906494141,118.521514892578 196.625,120.440773010254 196.05207824707,122.360054016113 195.522125244141,124.537139892578 195.03515625,126.972023010254 194.54817199707,129.406921386719 194.3046875,132.199890136719 194.3046875,135.350936889648 194.3046875,137.413436889648 194.490875244141,139.762390136719 194.86328125,142.397811889648 195.23567199707,145.033233642578 195.80859375,147.539733886719 196.58203125,149.917343139648 197.35546875,152.294952392578 198.34375,154.285827636719 199.546875,155.889999389648 200.75,157.494171142578 202.15364074707,158.296249389648 203.7578125,158.296249389648 205.705718994141,158.296249389648 207.65364074707,157.737655639648 209.6015625,156.620468139648 211.549468994141,155.503280639648 213.783843994141,153.942077636719 216.3046875,151.936874389648 221.91926574707,147.468124389648 227.24739074707,142.569686889648 232.2890625,137.241561889648 237.330718994141,131.913436889648 242.486968994141,126.613960266113 247.7578125,121.343124389648L247.835861206055,121.282699584961 250.76448059082,113.780624389648C251.33740234375,112.634796142578 251.93896484375,111.732452392578 252.56916809082,111.073593139648 253.199371337891,110.414741516113 253.843902587891,109.927764892578 254.50276184082,109.612655639648 255.16162109375,109.297554016113 255.84912109375,109.097030639648 256.565246582031,109.011093139648 257.281402587891,108.925155639648 258.011871337891,108.882186889648 258.756652832031,108.882186889648 259.67333984375,108.882186889648 260.48974609375,109.512397766113 261.205871582031,110.772811889648 261.922027587891,112.033233642578 262.280090332031,113.780624389648 262.280090332031,116.014999389648 262.280090332031,117.389999389648 262.16552734375,118.679061889648 261.936340332031,119.882186889648 261.707183837891,121.085311889648 261.39208984375,122.317085266113 260.991027832031,123.577499389648 260.589996337891,124.837921142578 260.160308837891,126.198593139648 259.701965332031,127.659530639648 259.24365234375,129.120468139648 258.785308837891,130.796249389648 258.326965332031,132.686874389648 257.983215332031,134.233749389648 257.596496582031,135.952499389648 257.166809082031,137.843124389648 256.737121582031,139.733749389648 256.336090087891,141.653015136719 255.96369934082,143.600936889648 255.59130859375,145.548858642578 255.27619934082,147.453796386719 255.01838684082,149.315780639648 254.76057434082,151.177764892578 254.63166809082,152.853546142578 254.63166809082,154.343124389648 254.63166809082,155.374374389648 254.80354309082,156.434265136719 255.14729309082,157.522811889648 256.75146484375,157.350936889648 259.386871337891,154.944686889648 263.053527832031,150.304061889648 264.944152832031,147.955108642578 267.02099609375,145.376983642578 269.283996582031,142.569686889648 271.547027587891,139.762390136719 273.996246337891,136.668640136719 276.631652832031,133.288436889648 278.57958984375,130.767608642578 280.51318359375,128.418640136719 282.432434082031,126.241561889648 284.351715087891,124.064483642578 286.342590332031,122.159530639648 288.405090332031,120.526718139648 290.467590332031,118.893905639648 292.658996582031,117.604843139648 294.979309082031,116.659530639648 297.299621582031,115.714218139648 299.863433837891,115.241561889648 302.670715332031,115.241561889648 305.64990234375,115.241561889648 308.127746582031,115.886093139648 310.104309082031,117.175155639648 312.080871582031,118.464218139648 313.670715332031,120.240264892578 314.873840332031,122.503280639648 316.076965332031,124.766304016113 317.007965087891,127.473335266113 317.666809082031,130.624374389648 318.32568359375,133.775421142578 318.855621337891,137.241561889648 319.256652832031,141.022811889648 319.600402832031,144.231140136719 319.929840087891,147.410827636719 320.244934082031,150.561874389648 320.56005859375,153.712921142578 321.175933837891,156.534530639648 322.092590332031,159.026718139648 323.00927734375,161.518905639648 324.326965332031,163.538436889648 326.045715332031,165.085311889648 327.764465332031,166.632186889648 330.22802734375,167.405624389648 333.436340332031,167.405624389648 335.89990234375,167.405624389648 338.47802734375,166.832702636719 341.170715332031,165.686874389648 343.863433837891,164.541046142578 346.699371337891,162.951202392578 349.678527832031,160.917343139648 352.65771484375,158.883483886719 355.737121582031,156.491561889648 358.916809082031,153.741561889648 362.096496582031,150.991561889648 365.37646484375,147.983749389648 368.756652832031,144.718124389648 370.074371337891,143.457702636719 371.52099609375,141.867858886719 373.096496582031,139.948593139648 374.672027587891,138.029327392578 376.218902587891,136.181671142578 377.737121582031,134.405624389648 378.496246337891,133.517608642578 379.230285644531,132.694030761719 379.939300537109,131.934921264648L381.199279785156,130.655120849609 385.427612304688,124.264999389648C388.349487304688,120.254585266113 391.672393798828,116.244171142578 395.396362304688,112.233749389648 399.177612304688,108.223335266113 402.729705810547,105.358749389648 406.052612304688,103.639999389648 410.177612304688,101.405624389648 416.107299804688,100.288436889648 423.841674804688,100.288429260254 426.534362792969,100.288436889648 428.826049804688,101.778022766113 430.716674804688,104.757186889648 432.607299804688,107.736358642578 434.039581298828,111.202499389648 435.013549804688,115.155624389648 435.987487792969,119.337921142578 436.474487304688,122.603546142578 436.474487304688,124.952499389648 437.333862304688,122.145210266113 438.107299804688,119.294952392578 438.794799804688,116.401718139648 439.482299804688,113.508491516113 440.083862304688,110.514999389648 440.599487304688,107.421249389648 441.115112304688,104.327499389648 441.587768554688,101.076202392578 442.017456054688,97.6673431396484 442.447143554688,94.2584915161133 442.833862304688,90.6061477661133 443.177612304688,86.7103118896484 443.292175292969,85.679069519043 443.406768798828,84.3613586425781 443.521362304688,82.7571868896484 443.635925292969,81.1530227661133 443.779174804688,79.2623977661133 443.951049804688,77.0853118896484 444.294799804688,72.6165618896484 444.638549804688,68.8496398925781 444.982299804688,65.7845306396484 445.326049804688,62.7194366455078 445.784362792969,60.7285461425781 446.357299804688,59.8118743896484 447.732299804688,57.4629211425781 450.138549804688,56.2884368896484 453.576049804688,56.2884368896484z" transform="translate(-4.522309515625 -27.1750441384583) scale(0.482782)" />\r
120
+ </svg>\r
121
+ \r
122
+ \r
123
+ \r
124
+ `,Tw=()=>r.jsx("span",{"aria-hidden":"true",className:"new-thread-hero__logo",dangerouslySetInnerHTML:{__html:Ew}}),Mw=()=>r.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:r.jsx("path",{d:"m15 18-6-6 6-6"})}),Rw=()=>r.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:r.jsx("path",{d:"m9 18 6-6-6-6"})}),ky=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("circle",{cx:"12",cy:"12",r:"8.5"}),r.jsx("path",{d:"M12 10.4v4.2"}),r.jsx("path",{d:"M12 7.9h.01"})]}),Aw=(n,t)=>{var a;return((a=n[t])==null?void 0:a.trim())??""},Ny=()=>typeof window<"u"&&!window.matchMedia("(max-width: 768px)").matches,Dw=_.memo(function({requests:t,hasStripBelow:a,pendingRequestId:l,onRespond:c}){const u=t[0]??null,[f,p]=_.useState(null),[y,m]=_.useState(""),[S,g]=_.useState({}),[x,j]=_.useState(0),[k,E]=_.useState(null),[N,P]=_.useState(null);_.useEffect(()=>{p(null),m(""),g({}),j(0),E(null),P(null)},[u==null?void 0:u.id]);const H=u?l===u.id:!1,U=(u==null?void 0:u.kind)==="user_input",R=U&&u.questions.length>0?u.questions[Math.max(0,Math.min(x,u.questions.length-1))]??null:null,q=R?Aw(S,R.id):"",re=R?R.options.some(Y=>Y.label===q):!1,V=!!(R&&q&&(!re||k===R.id));_.useEffect(()=>{if(!R){E(null);return}if(re){E(null);return}q&&E(R.id)},[re,R,q]);const ee=_.useMemo(()=>!u||H?!1:u.kind==="user_input"?R?!!q:!1:f?!0:u.allow_freeform?!!y.trim():!1,[R,q,u,y,H,f]);if(!u)return null;const Z=u.questions.reduce((Y,ne)=>Y+ne.options.length,u.options.length),W=Y=>{H||c({requestId:u.id,optionId:(Y==null?void 0:Y.optionId)??f,text:(Y==null?void 0:Y.text)??y,answers:(Y==null?void 0:Y.answers)??S})},F=()=>{if(!(!u||u.kind!=="user_input"||!R)){if(x<u.questions.length-1){j(Y=>Math.min(Y+1,u.questions.length-1));return}W()}},be=()=>{if(!u||u.kind!=="user_input"||!R)return;const Y={...S,[R.id]:"忽略"};if(g(Y),E(null),x<u.questions.length-1){j(ne=>Math.min(ne+1,u.questions.length-1));return}W({answers:Y})},pe=Y=>{if(!(!u||u.kind!=="user_input"||!R||H)){if(q===Y){F();return}g(ne=>({...ne,[R.id]:Y})),E(null)}};return r.jsx("section",{className:`session-interaction-strip ${a?"has-strip-below":""} ${U?"is-user-input-flow":""}`,children:u.kind==="user_input"&&R?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"session-interaction-flow__header",children:[r.jsx("div",{className:"session-interaction-flow__prompt",children:R.question}),r.jsxs("div",{className:"session-interaction-flow__progress",children:[r.jsx("button",{type:"button",className:"session-interaction-flow__nav","aria-label":"上一题",disabled:x===0||H,onClick:()=>j(Y=>Math.max(0,Y-1)),children:r.jsx(Mw,{})}),r.jsxs("span",{className:"session-interaction-flow__counter",children:[x+1," / ",u.questions.length]}),r.jsx("button",{type:"button",className:"session-interaction-flow__nav","aria-label":x===u.questions.length-1?"提交回复":"下一题",disabled:H||!ee,onClick:F,children:r.jsx(Rw,{})})]})]}),r.jsx("div",{className:"session-interaction-flow__body",children:r.jsxs("div",{className:"session-interaction-flow__list",children:[R.options.map((Y,ne)=>r.jsxs("div",{className:`session-interaction-flow__item is-${Y.emphasis} ${q===Y.label?"is-active":""}`,role:"button",tabIndex:H?-1:0,"aria-pressed":q===Y.label,onClick:()=>pe(Y.label),onKeyDown:T=>{T.key==="Enter"&&Ny()&&(T.preventDefault(),pe(Y.label))},children:[r.jsxs("span",{className:"session-interaction-flow__item-index",children:[ne+1,"."]}),r.jsxs("span",{className:"session-interaction-flow__item-choice",children:[r.jsx("span",{className:"session-interaction-flow__item-label",children:Y.label}),Y.description?r.jsxs("span",{className:"session-interaction-flow__tooltip-wrap",children:[r.jsx("button",{type:"button",className:"session-interaction-flow__tooltip-trigger","aria-label":`查看 ${Y.label} 的说明`,"aria-expanded":N===Y.id,onMouseEnter:()=>P(Y.id),onMouseLeave:()=>P(T=>T===Y.id?null:T),onBlur:()=>P(T=>T===Y.id?null:T),onClick:T=>{T.stopPropagation(),P($=>$===Y.id?null:Y.id)},children:r.jsx(ky,{})}),r.jsx("div",{className:`session-interaction-flow__tooltip ${N===Y.id?"is-visible":""}`,role:"tooltip",children:Y.description})]}):null]})]},Y.id)),r.jsx("div",{className:`session-interaction-flow__item is-custom ${V?"is-active":""}`,children:r.jsxs("div",{className:"session-interaction-flow__custom-input-wrap",children:[r.jsx("input",{type:"text",className:"session-interaction-flow__custom-input",value:re?"":q,disabled:H,placeholder:R.is_secret?"输入敏感信息":"否,请告知如何调整",onFocus:()=>{E(R.id),re&&g(Y=>({...Y,[R.id]:""}))},onKeyDown:Y=>{Y.key==="Enter"&&ee&&!H&&Ny()&&(Y.preventDefault(),F())},onChange:Y=>{E(R.id),g(ne=>({...ne,[R.id]:Y.target.value}))}}),r.jsxs("div",{className:"session-interaction-flow__inline-actions",children:[r.jsx("button",{type:"button",className:"session-interaction-flow__ghost",disabled:H,onClick:be,children:"忽略"}),r.jsx("button",{type:"button",className:"session-interaction-flow__primary",disabled:!ee,onClick:F,children:H?"提交中...":x===u.questions.length-1?u.submit_label??"提交回复":"继续"})]})]})})]})})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"session-interaction-strip__header",children:[r.jsx("span",{className:"session-interaction-strip__icon","aria-hidden":"true",children:r.jsx(ky,{})}),r.jsxs("div",{className:"session-interaction-strip__copy",children:[r.jsxs("div",{className:"session-interaction-strip__title",children:[u.title,t.length>1?r.jsxs("span",{className:"session-interaction-strip__count",children:["还有 ",t.length-1," 个待处理"]}):null]}),u.description?r.jsx("div",{className:"session-interaction-strip__description",children:u.description}):null]})]}),u.options.length>0?r.jsx("div",{className:"session-interaction-strip__options",children:u.options.map(Y=>r.jsxs("button",{type:"button",className:`session-interaction-option is-${Y.emphasis} ${f===Y.id?"is-active":""}`,disabled:H,onClick:()=>{p(Y.id),!u.allow_freeform&&Z<=3&&W({optionId:Y.id})},children:[r.jsx("span",{className:"session-interaction-option__label",children:Y.label}),Y.description?r.jsx("span",{className:"session-interaction-option__description",children:Y.description}):null]},Y.id))}):null,u.allow_freeform?r.jsxs("label",{className:"session-interaction-strip__freeform",children:[r.jsx("span",{className:"session-interaction-strip__freeform-label",children:"自定义回复"}),r.jsx("textarea",{value:y,disabled:H,placeholder:u.freeform_placeholder??"输入回复内容",onChange:Y=>m(Y.target.value)})]}):null,u.allow_freeform||u.options.length>3?r.jsx("div",{className:"session-interaction-strip__footer",children:r.jsx("button",{type:"button",className:"session-interaction-strip__submit",disabled:!ee,onClick:()=>W(),children:H?"提交中...":u.submit_label??"继续"})}):null]})})}),Ow=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M6 6l12 12"}),r.jsx("path",{d:"M18 6 6 18"})]}),Lw=({panel:n,isPending:t,onDismiss:a,onSelectOption:l,onSubmitText:c})=>{const[u,f]=_.useState("");return _.useEffect(()=>{f("")},[n.panel_id,n.status]),r.jsxs("section",{className:`session-command-panel is-${n.status}`,children:[r.jsxs("div",{className:"session-command-panel__header",children:[r.jsxs("div",{className:"session-command-panel__command",children:["/",n.command_name]}),r.jsx("button",{type:"button",className:"session-command-panel__close","aria-label":"关闭命令面板",onClick:a,children:r.jsx(Ow,{})})]}),r.jsx("div",{className:"session-command-panel__title",children:n.title}),n.description?r.jsx("div",{className:"session-command-panel__description",children:n.description}):null,r.jsx("pre",{className:"session-command-panel__body",children:n.body}),n.input_type==="choice"&&n.options.length>0?r.jsx("div",{className:"session-command-panel__options",children:n.options.map(p=>r.jsxs("button",{type:"button",className:"session-command-panel__option",disabled:t,onClick:()=>l(p.id),children:[r.jsx("span",{className:"session-command-panel__option-label",children:p.label}),p.description?r.jsx("span",{className:"session-command-panel__option-description",children:p.description}):null]},p.id))}):null,n.input_type==="text"?r.jsxs("form",{className:"session-command-panel__form",onSubmit:p=>{p.preventDefault(),!(!u.trim()||t)&&c(u.trim())},children:[r.jsx("input",{className:"session-command-panel__input",value:u,disabled:t,placeholder:n.input_placeholder??"继续输入",onChange:p=>f(p.target.value)}),r.jsx("button",{type:"submit",className:"session-command-panel__submit",disabled:t||!u.trim(),children:n.submit_label??"提交"})]}):null]})},Iw=_.memo(function({planSnapshot:t,hasStripAbove:a,hasStripBelow:l}){const[c,u]=_.useState(!0);return t.steps.length?r.jsxs("section",{className:`session-plan-strip ${c?"is-collapsed":""} ${a?"has-strip-above":""} ${l?"has-strip-below":""}`,children:[r.jsxs("button",{type:"button",className:"session-plan-strip__toggle",onClick:()=>u(f=>!f),"aria-expanded":!c,children:[r.jsxs("div",{className:"session-plan-strip__summary",children:[r.jsx("span",{className:"session-plan-strip__summary-mark","aria-hidden":"true",children:r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("rect",{x:"4.5",y:"5",width:"15",height:"14",rx:"2.5"}),r.jsx("path",{d:"M8 9h8"}),r.jsx("path",{d:"M8 13h5.5"}),r.jsx("path",{d:"m15.5 14.5 1.5 1.5 2.5-3"})]})}),r.jsx("span",{className:"session-plan-strip__summary-text",children:r.jsxs("span",{children:["共 ",t.total_count," 个任务,已完成 ",t.completed_count," 个"]})})]}),r.jsx("span",{className:"session-plan-strip__chevron","aria-hidden":"true",children:r.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"m8 10 4 4 4-4"})})})]}),c?null:r.jsx(r.Fragment,{children:r.jsx("div",{className:"session-plan-strip__steps",children:t.steps.map((f,p)=>r.jsxs("div",{className:`session-plan-step is-${f.status}`,children:[r.jsx("span",{className:"session-plan-step__dot","aria-hidden":"true",children:f.status==="in_progress"?r.jsx("span",{className:"session-plan-step__spinner"}):null}),r.jsxs("span",{className:"session-plan-step__index",children:[p+1,"."]}),r.jsx("span",{className:"session-plan-step__label",children:f.step})]},f.id))})})]}):null}),Pw=n=>{const t=(n==null?void 0:n.enabled)??!0;return ks({queryKey:["codex-commands"],enabled:t,queryFn:async()=>(await ss()).client.getCodexCommands(),staleTime:0,gcTime:30*6e4,refetchOnWindowFocus:!1,retry:1})},zw=(n,t)=>{const a=((t==null?void 0:t.enabled)??!0)&&!!n;return ks({queryKey:["project-skills",n],enabled:a,queryFn:async()=>n?(await ss({projectId:n})).client.getProjectSkills(n):[],staleTime:6e4,gcTime:10*6e4,refetchOnWindowFocus:!1,retry:1})},Cy=24,Bw=n=>{const t=hv(n);return t.length===0?r.jsx("span",{children:" "}):t.map((a,l)=>{const c=`skill-aware-token-${l}`;return a.kind==="skill"?r.jsx("span",{className:"skill-aware-textarea__token is-skill",children:a.raw},c):a.kind==="command"?r.jsx("span",{className:"skill-aware-textarea__token is-command",children:a.raw},c):a.kind==="code"?r.jsx("span",{className:"skill-aware-textarea__token is-code",children:a.value},c):a.kind==="path-link"?r.jsx("span",{className:"skill-aware-textarea__token is-link",children:a.label},c):r.jsx("span",{children:a.value},c)})},Ey=({value:n,onChange:t,onKeyDown:a,placeholder:l,disabled:c=!1,className:u,projectId:f,autoFocus:p=!1})=>{var $;const y=u.includes("composer-fullscreen-sheet__input"),m=_.useRef(null),S=_.useRef(null),[g,x]=_.useState({start:0,end:0}),[j,k]=_.useState(!1),[E,N]=_.useState(!1),[P,H]=_.useState(0),U=_.useMemo(()=>mv(n,g.start,g.end),[g.end,g.start,n]),R=_.useMemo(()=>pv(n,g.start,g.end),[g.end,g.start,n]),q=j&&!c&&!!U&&!E,re=j&&!c&&!!R&&!E,V=re?"command":q?"skill":null,ee=zw(f,{enabled:q}),Z=Pw({enabled:re}),W=_.useMemo(()=>gw(ee.data??[],(U==null?void 0:U.query)??"").slice(0,Cy),[U==null?void 0:U.query,ee.data]),F=_.useMemo(()=>{var ue;return yw(((ue=Z.data)==null?void 0:ue.commands)??[],(R==null?void 0:R.query)??"").slice(0,Cy)},[R==null?void 0:R.query,($=Z.data)==null?void 0:$.commands]);_.useEffect(()=>{H(0)},[U==null?void 0:U.query,U==null?void 0:U.start,R==null?void 0:R.query,n,f]),_.useEffect(()=>{N(!1)},[U==null?void 0:U.query,U==null?void 0:U.start,U==null?void 0:U.end,R==null?void 0:R.query,R==null?void 0:R.start,R==null?void 0:R.end]);const be=()=>{!m.current||!S.current||(S.current.scrollTop=m.current.scrollTop,S.current.scrollLeft=m.current.scrollLeft)},pe=()=>{m.current&&x({start:m.current.selectionStart??0,end:m.current.selectionEnd??0})},Y=ue=>{if(!m.current)return;const de=mw(n,m.current.selectionStart??g.start,m.current.selectionEnd??g.end,ue.name);de&&(t(de.value),typeof window<"u"&&window.requestAnimationFrame(()=>{m.current&&(m.current.focus(),m.current.setSelectionRange(de.selectionStart,de.selectionEnd),x({start:de.selectionStart,end:de.selectionEnd}))}))},ne=ue=>{if(!m.current)return;const de=pw(n,m.current.selectionStart??g.start,m.current.selectionEnd??g.end,ue.name);de&&(t(de.value),typeof window<"u"&&window.requestAnimationFrame(()=>{m.current&&(m.current.focus(),m.current.setSelectionRange(de.selectionStart,de.selectionEnd),x({start:de.selectionStart,end:de.selectionEnd}))}))},T=ue=>{const de=V==="skill"&&W.length>0||V==="command"&&F.length>0;if(V&&de){if(ue.key==="ArrowDown"){ue.preventDefault();const ve=V==="command"?F.length:W.length;H(A=>(A+1)%ve);return}if(ue.key==="ArrowUp"){ue.preventDefault();const ve=V==="command"?F.length:W.length;H(A=>A-1<0?ve-1:A-1);return}if((ue.key==="Enter"||ue.key==="Tab")&&!ue.shiftKey&&!ue.altKey&&!ue.ctrlKey&&!ue.metaKey){if(ue.preventDefault(),V==="command"){const A=F[P]??F[0];if(!A)return;ne(A);return}const ve=W[P]??W[0];if(!ve)return;Y(ve);return}}if(V&&ue.key==="Escape"){ue.preventDefault(),N(!0);return}a==null||a(ue)};return r.jsxs("div",{className:`skill-aware-textarea ${V?"is-picker-open":""} ${y?"is-fullscreen":""}`,children:[re?r.jsx("div",{className:"skill-mention-picker",role:"listbox","aria-label":"命令建议",children:Z.isLoading?r.jsx("div",{className:"skill-mention-picker__empty",children:"正在加载命令…"}):Z.isError?r.jsx("div",{className:"skill-mention-picker__empty",children:"命令列表加载失败"}):F.length===0?r.jsx("div",{className:"skill-mention-picker__empty",children:"未找到匹配命令"}):F.map((ue,de)=>{const ve=de===P;return r.jsx("button",{type:"button",className:`skill-mention-picker__item ${ve?"is-active":""}`,role:"option","aria-selected":ve,onMouseDown:A=>{A.preventDefault(),ne(ue)},onMouseEnter:()=>H(de),children:r.jsxs("span",{className:"skill-mention-picker__main",children:[r.jsxs("span",{className:"skill-mention-picker__name",children:["/",ue.name]}),r.jsx("span",{className:"skill-mention-picker__description",children:ue.description})]})},ue.name)})}):q?r.jsx("div",{className:"skill-mention-picker",role:"listbox","aria-label":"技能建议",children:ee.isLoading?r.jsx("div",{className:"skill-mention-picker__empty",children:"正在加载技能…"}):ee.isError?r.jsx("div",{className:"skill-mention-picker__empty",children:"技能列表加载失败"}):W.length===0?r.jsx("div",{className:"skill-mention-picker__empty",children:"未找到匹配技能"}):W.map((ue,de)=>{const ve=de===P;return r.jsx("button",{type:"button",className:`skill-mention-picker__item ${ve?"is-active":""}`,role:"option","aria-selected":ve,onMouseDown:A=>{A.preventDefault(),Y(ue)},onMouseEnter:()=>H(de),children:r.jsxs("span",{className:"skill-mention-picker__main",children:[r.jsxs("span",{className:"skill-mention-picker__name",children:["$",ue.name]}),r.jsx("span",{className:"skill-mention-picker__description",children:ue.description}),r.jsx("span",{className:"skill-mention-picker__scope",children:hw(ue.scope)})]})},`${ue.scope}:${ue.name}:${ue.path}`)})}):null,r.jsxs("div",{className:"skill-aware-textarea__surface",children:[r.jsx("div",{ref:S,className:`${u} skill-aware-textarea__overlay`,"aria-hidden":"true",children:n?Bw(n):r.jsx("span",{children:" "})}),r.jsx("textarea",{ref:m,className:`${u} skill-aware-textarea__input`,value:n,disabled:c,placeholder:l,autoFocus:p,onChange:ue=>{t(ue.target.value),N(!1),x({start:ue.target.selectionStart??0,end:ue.target.selectionEnd??0})},onKeyDown:T,onClick:pe,onSelect:pe,onKeyUp:pe,onFocus:()=>{k(!0),N(!1),pe()},onBlur:()=>{k(!1)},onScroll:be})]})]})},e1=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M6 6l12 12"}),r.jsx("path",{d:"M18 6 6 18"})]}),Uw=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M12 5v14"}),r.jsx("path",{d:"m7 14 5 5 5-5"})]}),$w=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M8 3H4v4"}),r.jsx("path",{d:"M16 3h4v4"}),r.jsx("path",{d:"M8 21H4v-4"}),r.jsx("path",{d:"M16 21h4v-4"}),r.jsx("path",{d:"M9 9 4 4"}),r.jsx("path",{d:"m15 9 5-5"}),r.jsx("path",{d:"m9 15-5 5"}),r.jsx("path",{d:"m15 15 5 5"})]}),Hw=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M12 5v14"}),r.jsx("path",{d:"M5 12h14"})]}),Ty=()=>r.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:r.jsx("path",{d:"M13 2 5.5 13h5L9 22l9.5-13h-5L13 2Z"})}),My=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M9 6h10"}),r.jsx("path",{d:"M9 12h10"}),r.jsx("path",{d:"M9 18h10"}),r.jsx("path",{d:"m4 6 1.5 1.5L7.5 5"}),r.jsx("path",{d:"m4 12 1.5 1.5L7.5 11"}),r.jsx("path",{d:"m4 18 1.5 1.5L7.5 17"})]}),Ry=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M7 10V7.8A5 5 0 0 1 12 3a5 5 0 0 1 5 4.8V10"}),r.jsx("path",{d:"M5.5 10h13a1.5 1.5 0 0 1 1.5 1.5v7A2.5 2.5 0 0 1 17.5 21h-11A2.5 2.5 0 0 1 4 18.5v-7A1.5 1.5 0 0 1 5.5 10Z"}),r.jsx("path",{d:"M12 14v2.6"})]}),qw=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M12 16V5"}),r.jsx("path",{d:"m8 9 4-4 4 4"}),r.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"})]}),gv=_.memo(function({isDesktopSidebar:t,sidebarShift:a,isSidebarDragging:l,composerError:c,onDismissComposerError:u,interactionRequests:f,pendingInteractionRequestId:p,onRespondInteraction:y,parentSession:m,backgroundAgentSessions:S,isBackgroundAgentsOpen:g,planSnapshot:x,onToggleBackgroundAgents:j,onOpenSession:k,getBackgroundAgentStatusLabel:E,getBackgroundAgentAccent:N,formatBackgroundAgentsLabel:P,hasBackgroundAgentStrip:H,commandPanel:U,isCommandPanelPending:R,onDismissCommandPanel:q,onCommandPanelOptionSelect:re,onCommandPanelTextSubmit:V,projectId:ee=null,draft:Z,pendingAttachments:W,canSendInput:F,isInputLocked:be=!1,inputPlaceholder:pe,readOnlyPlaceholder:Y,onDraftChange:ne,onUploadFiles:T,onRemoveAttachment:$,onSubmit:ue,showStopIcon:de,isSendPending:ve,onInterrupt:A,isFastModeEnabled:te,isPlanModeEnabled:je,isYoloModeEnabled:Se,onToggleFastMode:Re,onTogglePlanMode:oe,onToggleYoloMode:Ne,showModeBadges:ie=!1,selectedModel:z,modelOptions:we=[],selectedReasoning:ke,onSelectModel:_e,onSelectReasoning:Me,contextUsage:Ge,isContextUsageOpen:at,onToggleContextUsage:ht,contextUsageRingStyle:Bt,usedPercent:Ut,remainingPercent:Ze,usedTokensLabel:Zt,totalTokensLabel:un,showJumpToBottom:fe,onJumpToBottom:Ae}){const Ie=_.useId(),[Ce,Fe]=_.useState(!1),[tt,qe]=_.useState(null),rn=_.useRef(null),vn=_.useRef(null),zn=f[0]??null,as=(zn==null?void 0:zn.kind)==="user_input",Sn=f.length>0,ae=!!x&&!as,$e=!as&&H,De=ae||$e,We=Sn||ae||$e,nt={transform:`translateX(${a}px)`,transition:l?"none":void 0},Xe=(!!Z.trim()||W.length>0)&&F&&!be&&!ve&&!de,At=F&&!be,nn=ie&&(te||je||Se),Gn=()=>{Xe&&(qe(null),ue())},gt=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(),Gn())};_.useEffect(()=>{if(!Ce)return;const Ee=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=Ee}},[Ce]),_.useEffect(()=>{if(!Ce||typeof window>"u")return;const Ee=window.matchMedia("(min-width: 769px)"),Dt=()=>{Ee.matches&&Fe(!1)};return Dt(),typeof Ee.addEventListener=="function"?(Ee.addEventListener("change",Dt),()=>{Ee.removeEventListener("change",Dt)}):(Ee.addListener(Dt),()=>{Ee.removeListener(Dt)})},[Ce]),_.useEffect(()=>{if(!tt)return;const Ee=Dn=>{const Wn=Dn.target;rn.current&&Wn instanceof Node&&rn.current.contains(Wn)||qe(null)},Dt=Dn=>{Dn.key==="Escape"&&qe(null)};return window.addEventListener("pointerdown",Ee),window.addEventListener("keydown",Dt),()=>{window.removeEventListener("pointerdown",Ee),window.removeEventListener("keydown",Dt)}},[tt]);const kn=Ee=>nn?r.jsxs("div",{className:Ee,"aria-label":"当前已启用的会话模式",children:[te?r.jsxs("button",{type:"button",className:"composer-mode-badge is-fast",onClick:()=>{qe(null),Re()},"aria-label":"关闭 Fast 模式",children:[r.jsx("span",{className:"composer-mode-badge__icon","aria-hidden":"true",children:r.jsx(Ty,{})}),r.jsx("span",{className:"composer-mode-badge__label",children:"Fast"})]}):null,je?r.jsxs("button",{type:"button",className:"composer-mode-badge is-plan",onClick:()=>{qe(null),oe()},"aria-label":"关闭计划模式",children:[r.jsx("span",{className:"composer-mode-badge__icon","aria-hidden":"true",children:r.jsx(My,{})}),r.jsx("span",{className:"composer-mode-badge__label",children:"计划"})]}):null,Se?r.jsxs("button",{type:"button",className:"composer-mode-badge is-yolo",onClick:()=>{qe(null),Ne()},"aria-label":"关闭 Yolo 模式",children:[r.jsx("span",{className:"composer-mode-badge__icon","aria-hidden":"true",children:r.jsx(Ry,{})}),r.jsx("span",{className:"composer-mode-badge__label",children:"Yolo"})]}):null]}):null;return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:`composer-wrap ${t?"has-desktop-sidebar":""}`,style:nt,children:[c?r.jsxs("div",{className:"composer-alert",role:"status","aria-live":"polite",children:[r.jsx("span",{className:"composer-alert__text",children:c}),r.jsx("button",{type:"button",className:"composer-alert__close",onClick:u,"aria-label":"关闭错误提示",children:r.jsx(e1,{})})]}):null,Sn?r.jsx(Dw,{requests:f,hasStripBelow:De,pendingRequestId:p,onRespond:y}):null,ae&&x?r.jsx(Iw,{planSnapshot:x,hasStripAbove:Sn,hasStripBelow:$e}):null,$e&&m?r.jsxs("button",{type:"button",className:`background-agents-exit ${Sn||ae?"has-strip-above":""}`,onClick:()=>{k(m.id)},children:[r.jsx("span",{className:"background-agents-exit__icon","aria-hidden":"true",children:r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M6 12h12"}),r.jsx("path",{d:"m13 7 5 5-5 5"})]})}),r.jsx("span",{children:"返回主会话"})]}):$e&&S.length>0?r.jsxs("section",{className:`background-agents-card ${g?"is-open":""} ${Sn||ae?"has-strip-above":""}`,children:[r.jsxs("button",{type:"button",className:"background-agents-card__toggle",onClick:j,"aria-expanded":g,children:[r.jsx("span",{className:"background-agents-card__icon","aria-hidden":"true",children:r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("rect",{x:"7",y:"4",width:"10",height:"7",rx:"2.5"}),r.jsx("path",{d:"M12 11v3"}),r.jsx("circle",{cx:"10",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"}),r.jsx("circle",{cx:"14",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"}),r.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"})]})}),r.jsxs("span",{className:"background-agents-card__summary",children:[r.jsx("span",{className:"background-agents-card__title",children:P(S.length)}),g?r.jsx("span",{className:"background-agents-card__hint",children:"(@ to tag agents)"}):null]}),r.jsx("span",{className:"background-agents-card__chevron","aria-hidden":"true",children:r.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"m8 10 4 4 4-4"})})})]}),g?r.jsx("div",{className:"background-agents-card__list",children:S.map(Ee=>{var Dt,Dn;return r.jsxs("button",{type:"button",className:`background-agent-row ${Ee.run_state==="running"?"is-running":"is-idle"}`,style:{"--agent-accent":N(Ee)},onClick:()=>{k(Ee.id)},children:[r.jsx("span",{className:"background-agent-row__accent","aria-hidden":"true"}),r.jsxs("span",{className:"background-agent-row__meta",children:[r.jsxs("span",{className:"background-agent-row__title",children:[r.jsx("span",{className:"background-agent-row__name",children:((Dt=Ee.subagent)==null?void 0:Dt.nickname)??Ee.title}),r.jsxs("span",{className:"background-agent-row__role",children:["(",((Dn=Ee.subagent)==null?void 0:Dn.role)??"agent",")"]})]}),r.jsx("span",{className:"background-agent-row__status",children:E(Ee)})]}),r.jsx("span",{className:"background-agent-row__open",children:"Open"})]},Ee.id)})}):null]}):null,U?r.jsx(Lw,{panel:U,isPending:R,onDismiss:q,onSelectOption:re,onSubmitText:V}):null,as?null:r.jsxs("form",{className:`chat-composer ${We?"is-attached-to-agent-strip":""}`,onSubmit:Ee=>{Ee.preventDefault(),Gn()},children:[r.jsxs("div",{className:"chat-composer__editor",children:[W.length>0?r.jsx("div",{className:"chat-composer__attachments",children:W.map(Ee=>{const Dt=$1(Ee.size_bytes);return r.jsxs("div",{className:"chat-composer__attachment-chip",children:[r.jsxs("div",{className:"chat-composer__attachment-copy",children:[r.jsx("span",{className:"chat-composer__attachment-name",children:Ee.name}),r.jsxs("span",{className:"chat-composer__attachment-meta",children:[Ee.kind==="image"?"图片":"文件",Dt?` · ${Dt}`:""]})]}),r.jsx("button",{type:"button",className:"chat-composer__attachment-remove","aria-label":`移除 ${Ee.name}`,onClick:()=>$(Ee.id),children:r.jsx(e1,{})})]},Ee.id)})}):null,r.jsx(Ey,{className:"chat-composer__input",value:Z,disabled:!At,projectId:ee,placeholder:At?pe??"要求后续变更":Y??"当前会话为只读模式",onChange:ne,onKeyDown:gt}),r.jsx("button",{type:"button",className:"composer-fullscreen-toggle","aria-label":"全屏编辑",onClick:()=>Fe(!0),children:r.jsx($w,{})}),r.jsx("input",{id:Ie,ref:vn,type:"file",className:"chat-composer__file-input",multiple:!0,onChange:Ee=>{Ee.target.files&&Ee.target.files.length>0&&T(Ee.target.files),Ee.target.value=""}})]}),kn("composer-mode-badges composer-mode-badges--mobile"),r.jsxs("div",{className:"chat-composer__toolbar",children:[r.jsxs("div",{ref:rn,className:"chat-composer__controls",children:[r.jsxs("div",{className:`composer-utility-menu ${tt==="utility"?"is-open":""}`,children:[r.jsx("button",{type:"button",className:"composer-utility-menu__trigger","aria-label":"打开额外功能","aria-expanded":tt==="utility",onClick:()=>qe(Ee=>Ee==="utility"?null:"utility"),children:r.jsx(Hw,{})}),tt==="utility"?r.jsxs("div",{className:"composer-utility-menu__popover",role:"menu",children:[r.jsxs("button",{type:"button",className:"composer-utility-menu__item",role:"menuitem",onClick:()=>{var Ee;qe(null),(Ee=vn.current)==null||Ee.click()},children:[r.jsx("span",{className:"composer-utility-menu__item-icon","aria-hidden":"true",children:r.jsx(qw,{})}),r.jsx("span",{className:"composer-utility-menu__item-label",children:"上传文件"})]}),r.jsxs("button",{type:"button",className:"composer-utility-menu__item",role:"menuitemcheckbox","aria-checked":te,onClick:Re,children:[r.jsx("span",{className:"composer-utility-menu__item-icon","aria-hidden":"true",children:r.jsx(Ty,{})}),r.jsx("span",{className:"composer-utility-menu__item-label",children:"Fast 模式"}),r.jsx("span",{className:`composer-utility-menu__switch ${te?"is-on":""}`,"aria-hidden":"true",children:r.jsx("span",{className:"composer-utility-menu__switch-thumb"})})]}),r.jsxs("button",{type:"button",className:"composer-utility-menu__item",role:"menuitemcheckbox","aria-checked":je,onClick:oe,children:[r.jsx("span",{className:"composer-utility-menu__item-icon","aria-hidden":"true",children:r.jsx(My,{})}),r.jsx("span",{className:"composer-utility-menu__item-label",children:"计划模式"}),r.jsx("span",{className:`composer-utility-menu__switch ${je?"is-on":""}`,"aria-hidden":"true",children:r.jsx("span",{className:"composer-utility-menu__switch-thumb"})})]}),r.jsxs("button",{type:"button",className:"composer-utility-menu__item",role:"menuitemcheckbox","aria-checked":Se,onClick:Ne,children:[r.jsx("span",{className:"composer-utility-menu__item-icon","aria-hidden":"true",children:r.jsx(Ry,{})}),r.jsx("span",{className:"composer-utility-menu__item-label",children:"Yolo 模式"}),r.jsx("span",{className:`composer-utility-menu__switch ${Se?"is-on":""}`,"aria-hidden":"true",children:r.jsx("span",{className:"composer-utility-menu__switch-thumb"})})]})]}):null]}),r.jsxs("div",{className:`composer-choice ${tt==="model"?"is-open":""}`,children:[r.jsxs("button",{type:"button",className:"composer-control","aria-label":"选择模型","aria-expanded":tt==="model",onClick:()=>qe(Ee=>Ee==="model"?null:"model"),children:[r.jsx("span",{className:"composer-icon",children:r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M12 3 4 7v10l8 4 8-4V7z"}),r.jsx("path",{d:"m4 7 8 4 8-4"}),r.jsx("path",{d:"M12 11v10"})]})}),r.jsx("span",{className:"composer-control__value",children:gh(z,we)})]}),tt==="model"?r.jsx("div",{className:"composer-choice-menu",role:"menu","aria-label":"选择模型",children:we.map(Ee=>r.jsxs("button",{type:"button",className:`composer-choice-menu__item ${z===Ee.value?"is-active":""}`,role:"menuitemradio","aria-checked":z===Ee.value,onClick:()=>{_e(Ee.value),qe(null)},children:[r.jsx("span",{className:"composer-choice-menu__text",children:r.jsx("span",{className:"composer-choice-menu__label",children:Ee.label})}),z===Ee.value?r.jsx("span",{className:"composer-choice-menu__check",children:"✓"}):null]},Ee.value))}):null]}),r.jsxs("div",{className:`composer-choice ${tt==="reasoning"?"is-open":""}`,children:[r.jsxs("button",{type:"button",className:"composer-control","aria-label":"选择推理强度","aria-expanded":tt==="reasoning",onClick:()=>qe(Ee=>Ee==="reasoning"?null:"reasoning"),children:[r.jsx("span",{className:"composer-icon",children:r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[r.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"}),r.jsx("path",{d:"M10 21h4"}),r.jsx("path",{d:"M9 18h6"})]})}),r.jsx("span",{className:"composer-control__value",children:iw(ke)})]}),tt==="reasoning"?r.jsx("div",{className:"composer-choice-menu",role:"menu","aria-label":"选择推理强度",children:Ku.map(Ee=>r.jsxs("button",{type:"button",className:`composer-choice-menu__item ${ke===Ee.value?"is-active":""}`,role:"menuitemradio","aria-checked":ke===Ee.value,onClick:()=>{Me(Ee.value),qe(null)},children:[r.jsx("span",{className:"composer-choice-menu__label",children:Ee.label}),ke===Ee.value?r.jsx("span",{className:"composer-choice-menu__check",children:"✓"}):null]},Ee.value))}):null]}),kn("composer-mode-badges composer-mode-badges--inline")]}),r.jsxs("div",{className:"chat-composer__actions",children:[Ge?r.jsxs("div",{className:`composer-context ${at?"is-open":""}`,children:[r.jsx("button",{type:"button",className:"composer-context__trigger","aria-label":"查看背景信息窗口使用情况",onClick:Ee=>{Ee.stopPropagation(),ht()},children:r.jsx("span",{className:"composer-context__ring",style:Bt,children:r.jsx("span",{className:"composer-context__ring-core"})})}),at?r.jsxs("div",{className:"composer-context__popover",role:"tooltip",children:[r.jsx("div",{className:"composer-context__title",children:"背景信息窗口:"}),r.jsxs("div",{children:[Ut,"% 已用(剩余 ",Ze,"%)"]}),r.jsxs("div",{children:["已用 ",Zt,",共 ",un]})]}):null]}):null,r.jsx("button",{type:de?"button":"submit",className:"composer-send",disabled:de?!F:!Xe,"aria-label":de?"中断":"发送",onClick:()=>{de&&A()},children:de?r.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:r.jsx("rect",{x:"7",y:"7",width:"10",height:"10",rx:"2.5"})}):r.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:r.jsx("path",{d:"M12 17V7m0 0-4 4m4-4 4 4",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]})]})]}),Ce?r.jsx("div",{className:"composer-fullscreen-sheet",role:"dialog","aria-modal":"true","aria-label":"全屏编辑",children:r.jsxs("div",{className:"composer-fullscreen-sheet__panel",children:[r.jsxs("div",{className:"composer-fullscreen-sheet__header",children:[r.jsx("div",{className:"composer-fullscreen-sheet__title",children:"全屏编辑"}),r.jsx("button",{type:"button",className:"composer-fullscreen-sheet__close","aria-label":"退出全屏编辑",onClick:()=>Fe(!1),children:r.jsx(e1,{})})]}),r.jsx(Ey,{className:"composer-fullscreen-sheet__input",value:Z,disabled:!At,projectId:ee,placeholder:At?pe??"要求后续变更":Y??"当前会话为只读模式",onChange:ne,onKeyDown:gt,autoFocus:!0}),r.jsxs("div",{className:"composer-fullscreen-sheet__footer",children:[r.jsxs("div",{className:"composer-fullscreen-sheet__meta",children:[r.jsx("span",{children:z}),r.jsx("span",{children:ke}),Se?r.jsx("span",{children:"Yolo"}):null,W.length>0?r.jsxs("span",{children:[W.length," 个附件"]}):null]}),r.jsxs("div",{className:"composer-fullscreen-sheet__actions",children:[r.jsx("button",{type:"button",className:"composer-fullscreen-sheet__button",onClick:()=>Fe(!1),children:"关闭"}),de?r.jsx("button",{type:"button",className:"composer-fullscreen-sheet__button is-primary",disabled:!F,onClick:A,children:"中断"}):r.jsx("button",{type:"button",className:"composer-fullscreen-sheet__button is-primary",disabled:!Xe,onClick:()=>{Gn(),Fe(!1)},children:"发送"})]})]})]})}):null,fe?r.jsx("button",{type:"button",className:`conversation-jump-bottom ${t?"has-desktop-sidebar":""}`,style:nt,onClick:Ae,"aria-label":"滚动到最下面",children:r.jsx(Uw,{})}):null]})}),Ay=10,Fw=n=>{const t=n.replace(/\s+/g," ").trim();return t.length<=Ay?t:t.slice(0,Ay).trimEnd()},Qw=(n,t)=>{var l,c;const a=Fw(n);return a||((c=(l=t[0])==null?void 0:l.name)==null?void 0:c.trim())||"附件"},Gw=n=>{var a;const t=/^\/([A-Za-z][A-Za-z0-9._-]*)/.exec(n.trim());return((a=t==null?void 0:t[1])==null?void 0:a.toLowerCase())??""},Ww=({currentAgent:n,projects:t,sessions:a,initialProjectId:l=null,entryView:c,isDesktopSidebar:u,sidebarOffset:f,isSidebarDragging:p,onOpenSidebar:y,onProjectSelected:m,onSessionCreated:S})=>{const g=Vr(),[x,j]=_.useState(""),[k,E]=_.useState(l),[N,P]=_.useState(null),[H,U]=_.useState(null),[R,q]=_.useState(()=>D0()),[re,V]=_.useState(()=>iv()),[ee,Z]=_.useState([]),[W,F]=_.useState(!1),[be,pe]=_.useState(!1),[Y,ne]=_.useState(!1),[T,$]=_.useState(c),ue=L0(),de=_.useMemo(()=>ue.map(({id:oe,...Ne})=>Ne),[ue]),ve=_.useMemo(()=>t.find(oe=>oe.id===k)??t[0]??null,[t,k]);_.useEffect(()=>{Pu(R)},[R]),_.useEffect(()=>{rv(re)},[re]),_.useEffect(()=>{de.length!==0&&(de.some(oe=>oe.value===R)||q(de[0].value))},[de,R]),_.useEffect(()=>{$(c)},[c]),_.useEffect(()=>{U(null)},[k]),_.useEffect(()=>{var Ne,ie;if(k&&t.some(z=>z.id===k))return;const oe=(l&&t.some(z=>z.id===l)?l:null)??((Ne=a.find(z=>!z.archived))==null?void 0:Ne.project_id)??((ie=t[0])==null?void 0:ie.id)??null;E(oe)},[l,t,k,a]),_.useEffect(()=>{t.length===0&&$("directory-picker")},[t.length]);const A=ns({mutationFn:async oe=>{if(!ve||!oe.input.trim()&&oe.attachments.length===0)throw new Error("请先选择线程,再输入第一条消息");return(await(await ss({projectId:oe.projectId,agentId:n.id})).client.createSession({agentId:n.id,projectId:oe.projectId,title:oe.title,input:oe.input,attachments:oe.attachments,model:oe.model,reasoningEffort:oe.reasoningEffort,serviceTier:oe.serviceTier,planMode:oe.planMode,yoloMode:oe.yoloMode})).session},onMutate:()=>P(null),onSuccess:async(oe,Ne)=>{const ie={id:`optimistic-user:${oe.id}:create`,kind:"user",title:"你",body:Ne.input,timestamp:oe.last_event_at,accent:"primary",attachments:fv(Ne.attachments)};$r(n.id),ws(oe.id),aw(oe.id,{isFastModeEnabled:Ne.serviceTier==="fast",isPlanModeEnabled:Ne.planMode,isYoloModeEnabled:Ne.yoloMode}),Yu(null),Ho(null),g.setQueryData(yt,z=>fj(z,oe)),g.setQueryData(ki(oe.id),z=>V3(z,ie)),F(!1),pe(!1),ne(!1),S(oe.id),g.invalidateQueries({queryKey:["plan",oe.id]}),g.invalidateQueries({queryKey:["change-sets",oe.id]})},onError:oe=>{P(oe instanceof Error?oe.message:"创建会话失败")}}),te=(ve==null?void 0:ve.path)??null,je=T==="directory-picker",Se={transform:`translateX(${f}px)`,transition:p?"none":void 0},Re=()=>{const oe=x.trim();if(!(!oe&&ee.length===0||A.isPending||!ve)){if(O0(oe)){if(ee.length>0){P("命令暂不支持附件,请先移除附件后再执行。");return}const Ne=Gw(oe);if(Ne==="model"){if(j(""),de.length>0){U({panel_id:`new-thread-command-${Date.now()}`,session_id:`new-thread:${ve.id}`,command_name:Ne,command_text:oe,title:"为新会话选择模型",description:"选择后会更新新会话的默认模型,再继续输入真正的首条消息。",status:"awaiting_input",body:"在下面选择一个模型。",submitted_at:new Date().toISOString(),updated_at:new Date().toISOString(),input_type:"choice",options:de.map(ie=>({id:ie.value,label:ie.label,description:ie.description??null})),input_placeholder:null,submit_label:null,effect:null});return}U({panel_id:`new-thread-command-${Date.now()}`,session_id:`new-thread:${ve.id}`,command_name:Ne,command_text:oe,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(Ne==="status"){j(""),U({panel_id:`new-thread-command-${Date.now()}`,session_id:`new-thread:${ve.id}`,command_name:Ne,command_text:oe,title:"新会话当前设置",description:"这里展示的是创建下一条会话时会使用的本地设置。",status:"completed",body:[`线程:${ve.display_name??ve.name}`,`模型:${R}`,`推理强度:${re}`,`Fast 模式:${W?"开启":"关闭"}`,`计划模式:${be?"开启":"关闭"}`,`Yolo 模式:${Y?"开启":"关闭"}`].join(`
125
+ `),submitted_at:new Date().toISOString(),updated_at:new Date().toISOString(),input_type:"none",options:[],input_placeholder:null,submit_label:null,effect:null});return}j(""),U({panel_id:`new-thread-command-${Date.now()}`,session_id:`new-thread:${ve.id}`,command_name:Ne||"unknown",command_text:oe,title:`/${Ne||"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}A.mutate({projectId:ve.id,input:oe,title:Qw(oe,ee),attachments:ee,model:R,reasoningEffort:re,serviceTier:W?"fast":void 0,planMode:be,yoloMode:Y})}};return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:`conversation-main conversation-main--new-thread ${u?"has-desktop-sidebar":""}`,style:Se,children:[r.jsxs("div",{className:"conversation-topbar",children:[u?null:r.jsxs("button",{type:"button",className:"conversation-menu",onClick:y,"aria-label":"打开侧边栏",children:[r.jsx("span",{}),r.jsx("span",{className:"short"})]}),r.jsx("div",{className:"conversation-topbar__meta",children:r.jsx("div",{className:"conversation-topbar__title-row",children:r.jsx("h1",{"aria-label":"未命名会话",children:" "})})})]}),r.jsx("div",{className:"conversation-scroll conversation-scroll--empty",children:r.jsx("div",{className:"conversation-thread conversation-thread--empty",children:je?r.jsx(Cw,{agentId:n.id,projects:t,title:"选择目录",subtitle:"",onProjectCreated:oe=>{E(oe.id),m(oe.id),$("composer")}}):r.jsx("section",{className:"new-thread-hero",children:r.jsxs("div",{className:"new-thread-hero__stack",children:[r.jsx(Tw,{}),r.jsxs("label",{className:"new-thread-hero__selector",children:[r.jsx("span",{className:"new-thread-hero__selector-label",children:"在线程中发起会话"}),r.jsx("select",{className:"new-thread-hero__select",value:k??"",onChange:oe=>{const Ne=oe.target.value||null;E(Ne),Ne&&m(Ne)},children:t.map(oe=>r.jsx("option",{value:oe.id,children:oe.display_name??oe.name},oe.id))})]}),te?r.jsx("div",{className:"new-thread-hero__path",children:te}):r.jsx("div",{className:"new-thread-hero__hint",children:"选择一个线程后,直接输入第一条消息即可开始。"}),u?null:r.jsx("button",{type:"button",className:"new-thread-hero__directory-trigger",onClick:()=>$("directory-picker"),children:"新增目录线程"})]})})})})]}),je?null:r.jsx(gv,{isDesktopSidebar:u,sidebarShift:f,isSidebarDragging:p,composerError:N,onDismissComposerError:()=>P(null),interactionRequests:[],pendingInteractionRequestId:null,onRespondInteraction:()=>{},parentSession:null,backgroundAgentSessions:[],isBackgroundAgentsOpen:!1,planSnapshot:null,onToggleBackgroundAgents:()=>{},onOpenSession:()=>{},getBackgroundAgentStatusLabel:()=>"",getBackgroundAgentAccent:()=>"var(--color-accent-primary)",formatBackgroundAgentsLabel:oe=>`${oe} background agents`,hasBackgroundAgentStrip:!1,commandPanel:H,isCommandPanelPending:!1,onDismissCommandPanel:()=>U(null),onCommandPanelOptionSelect:oe=>{q(oe),U(Ne=>Ne&&{...Ne,status:"completed",body:`新会话默认模型已切换为 ${gh(oe,de)}。现在可以继续输入真正的首条消息。`,updated_at:new Date().toISOString(),input_type:"none",options:[]})},onCommandPanelTextSubmit:()=>{},projectId:(ve==null?void 0:ve.id)??null,draft:x,pendingAttachments:ee,canSendInput:!!ve,inputPlaceholder:ve?`向 ${ve.display_name??ve.name} 发起第一条任务…`:"先选择线程,再输入第一条任务",readOnlyPlaceholder:"先选择线程,再输入第一条任务",onDraftChange:j,onUploadFiles:oe=>{const Ne=[...oe];Ne.length!==0&&(P(null),Promise.all(Ne.map(ie=>dv(ie))).then(ie=>{Z(z=>[...z,...ie])}).catch(ie=>{P(ie instanceof Error?ie.message:"无法读取附件")}))},onRemoveAttachment:oe=>{Z(Ne=>Ne.filter(ie=>ie.id!==oe))},onSubmit:Re,showStopIcon:!1,isSendPending:A.isPending,onInterrupt:()=>{},isFastModeEnabled:W,isPlanModeEnabled:be,isYoloModeEnabled:Y,onToggleFastMode:()=>F(oe=>!oe),onTogglePlanMode:()=>pe(oe=>!oe),onToggleYoloMode:()=>ne(oe=>!oe),showModeBadges:!0,selectedModel:R,modelOptions:de,selectedReasoning:re,onSelectModel:q,onSelectReasoning:oe=>V(oe),contextUsage:null,isContextUsageOpen:!1,onToggleContextUsage:()=>{},usedPercent:0,remainingPercent:0,usedTokensLabel:"0",totalTokensLabel:"0",showJumpToBottom:!1,onJumpToBottom:()=>{}})]})},Dy=_.lazy(async()=>({default:(await K1(()=>import("./session-diff-preview-BEUxjpKW.js"),[])).SessionDiffPreview})),t1=["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)"],yv=14,vv=10,Sr=24,Oo=48,n1=()=>r.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:r.jsx("path",{d:"m9 6 6 6-6 6"})}),Yw=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M20 11a8 8 0 1 0 2.2 5.5"}),r.jsx("path",{d:"M20 4v7h-7"})]}),Vw=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M3 12a9 9 0 1 0 2.64-6.36"}),r.jsx("path",{d:"M3 4v5h5"}),r.jsx("path",{d:"M12 7v5l3 2"})]}),Oy=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M9 14 4 9l5-5"}),r.jsx("path",{d:"M4 9h8a8 8 0 1 1 0 16h-1"})]}),Ly=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M7.5 12.5 10.5 15.5 16.5 8.5"}),r.jsx("circle",{cx:"12",cy:"12",r:"8.5"})]}),Kw=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M12 16V5"}),r.jsx("path",{d:"m7.5 9.5 4.5-4.5 4.5 4.5"}),r.jsx("path",{d:"M5 19h14"})]}),Zw=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M6 6 18 18"}),r.jsx("path",{d:"M18 6 6 18"})]}),Xw=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M7 4v10"}),r.jsx("path",{d:"M7 14a4 4 0 0 0 4 4h6"}),r.jsx("path",{d:"M17 6a4 4 0 0 0-4 4H7"}),r.jsx("circle",{cx:"7",cy:"4",r:"2"}),r.jsx("circle",{cx:"17",cy:"6",r:"2"}),r.jsx("circle",{cx:"17",cy:"18",r:"2"})]}),Jw=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("rect",{x:"4",y:"5",width:"16",height:"11",rx:"2"}),r.jsx("path",{d:"M8 19h8"}),r.jsx("path",{d:"M10 16v3"}),r.jsx("path",{d:"M14 16v3"})]}),ek=()=>r.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:r.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"})}),tk=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M7 4v10"}),r.jsx("path",{d:"M7 14a4 4 0 0 0 4 4h6"}),r.jsx("path",{d:"M7 10a4 4 0 0 1 4-4h6"}),r.jsx("circle",{cx:"7",cy:"4",r:"2"}),r.jsx("circle",{cx:"17",cy:"6",r:"2"}),r.jsx("circle",{cx:"17",cy:"18",r:"2"})]}),jr=({label:n,icon:t,onClick:a,disabled:l=!1,variant:c="default",pending:u=!1,className:f})=>r.jsx("button",{type:"button",className:`session-git-panel__icon-button is-${c} ${u?"is-pending":""} ${f??""}`.trim(),onClick:a,disabled:l,"aria-label":n,title:n,children:r.jsx("span",{className:"session-git-panel__icon-button-glyph","aria-hidden":"true",children:t})}),Iy=n=>{switch(n){case"added":return"A";case"deleted":return"D";case"renamed":return"R";case"untracked":return"U";default:return"M"}},nk=n=>n.status==="renamed"&&n.previous_path?`该变更仅包含重命名:${n.previous_path} -> ${n.path}`:n.status==="deleted"?"该文件已删除,没有可展示的补丁内容。":n.status==="untracked"?"该文件还没有可展示的补丁内容。":"此变更没有可展示的补丁内容。",sk=(n,t)=>t&&t.diff.trim()?"此变更没有可展示的补丁内容。":n.status==="renamed"&&n.previous_path?`该提交仅包含重命名:${n.previous_path} -> ${n.path}`:n.status==="deleted"?"该文件在这次提交中已删除,没有可展示的补丁内容。":"该文件在这次提交中没有可展示的补丁内容。",wu=n=>t1[n%t1.length]??t1[0],xl=n=>vv+n*yv,Df=(n,t)=>`${n}\0${t}`,P0=n=>Array.isArray(n.parent_oids)?n.parent_oids.filter(Boolean):[],ak=n=>Array.isArray(n.refs)?n.refs.filter(Boolean):[],ik=n=>{var u;const t={};let a=[],l=0;const c=()=>{const f=l;return l+=1,f};for(const f of n){let p=a.findIndex(j=>j.oid===f.oid);p<0&&(a=[...a,{oid:f.oid,colorIndex:c()}],p=a.length-1);const y=a.map(j=>({...j})),m=((u=y[p])==null?void 0:u.colorIndex)??c(),S=[...new Set(P0(f))],g=y.map(j=>({...j}));S.length>0?g[p]={oid:S[0],colorIndex:m}:g.splice(p,1);const x=[];if(S.length>0){const j=g.findIndex(k=>k.oid===S[0]);x.push(j>=0?j:p)}S.slice(1).forEach((j,k)=>{let E=g.findIndex(N=>N.oid===j);E<0&&(E=Math.min(g.length,p+1+k),g.splice(E,0,{oid:j,colorIndex:c()})),x.push(E)}),t[f.oid]={beforeLanes:y,afterLanes:g,laneIndex:p,nodeColorIndex:m,parentLaneIndexes:x},a=g.filter((j,k,E)=>E.findIndex(N=>N.oid===j.oid)===k)}return t},rk=({commit:n,row:t,isLocalHead:a,isRemoteHead:l,isFirstRow:c,maxLaneCount:u})=>{const f=P0(n).length,p=Math.max(u,t.beforeLanes.length,t.afterLanes.length,1),y=Math.max(40,vv*2+(p-1)*yv),m=xl(t.laneIndex),S=f>1?4.7:3.9,g=Math.max(0,Sr-S-1.1),x={"--session-git-graph-width":`${Math.max(48,Math.ceil(y*(56/Oo)))}px`};return r.jsx("span",{className:"session-git-history__graph",style:x,children:r.jsxs("svg",{className:`session-git-history__graph-svg ${f>1?"is-merge":""}`,viewBox:`0 0 ${y} ${Oo}`,preserveAspectRatio:"xMinYMid meet","aria-hidden":"true",children:[t.beforeLanes.map((j,k)=>r.jsx("path",{d:`M ${xl(k)} ${c?g:0} L ${xl(k)} ${g}`,stroke:wu(j.colorIndex),strokeWidth:"2",strokeLinecap:"round",fill:"none",opacity:c?0:1},`before:${j.oid}:${k}`)),t.afterLanes.map((j,k)=>{const E=t.beforeLanes.findIndex(U=>U.oid===j.oid),N=E>=0?xl(E):xl(k),P=xl(k),H=N===P?`M ${P} ${Sr} L ${P} ${Oo}`:`M ${N} ${Sr} C ${N} 27 ${P} 31 ${P} ${Oo}`;return r.jsx("path",{d:H,stroke:wu(j.colorIndex),strokeWidth:"2",strokeLinecap:"round",fill:"none"},`after:${j.oid}:${k}`)}),t.parentLaneIndexes.map((j,k)=>{var H;const E=xl(j),N=wu(((H=t.afterLanes[j])==null?void 0:H.colorIndex)??t.nodeColorIndex),P=E===m?`M ${m} ${Sr} L ${E} ${Oo}`:`M ${m} ${Sr} C ${m} 27 ${E} 31 ${E} ${Oo}`;return r.jsx("path",{d:P,stroke:N,strokeWidth:k>0||f>1?"2.2":"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none",opacity:k>0||f>1?.96:.88},`parent:${n.oid}:${k}`)}),r.jsx("circle",{cx:m,cy:Sr,r:S,fill:"var(--color-surface-panel)",stroke:wu(t.nodeColorIndex),strokeWidth:f>1?"1.8":"1.55"}),r.jsx("circle",{cx:m,cy:Sr,r:a||l?1.6:1.05,fill:wu(t.nodeColorIndex)}),a&&l?r.jsx("circle",{cx:m,cy:Sr,r:"6.4",fill:"none",stroke:"color-mix(in oklab, var(--color-accent-primary) 22%, transparent)",strokeWidth:"1",strokeDasharray:"1.5 3"}):null]})})},lk=({workspace:n,history:t,isLoading:a,isHistoryLoading:l,error:c,historyError:u,onRefresh:f,onRefreshHistory:p,onRequestHistory:y,onDiscardFile:m,onDiscardAll:S,onCommitAll:g,onSwitchBranch:x,onPush:j,onLoadWorkspaceFileDiff:k,onLoadHistoryFileDiff:E,pendingAction:N,compact:P=!1})=>{const[H,U]=_.useState("changes"),[R,q]=_.useState({}),[re,V]=_.useState({}),[ee,Z]=_.useState({}),[W,F]=_.useState({}),[be,pe]=_.useState({}),[Y,ne]=_.useState({}),[T,$]=_.useState({}),[ue,de]=_.useState({}),[ve,A]=_.useState({}),[te,je]=_.useState(!1),[Se,Re]=_.useState(null),[oe,Ne]=_.useState(""),[ie,z]=_.useState(null),we=_.useRef(null);_.useEffect(()=>{q($e=>{if(!(n!=null&&n.files.length))return{};const De=new Set(n.files.map(Xe=>Xe.path));let We=!1;const nt={};for(const[Xe,At]of Object.entries($e)){if(!De.has(Xe)){We=!0;continue}nt[Xe]=At}return We?nt:$e});const ae=new Set((n==null?void 0:n.files.map($e=>$e.path))??[]);V($e=>{let De=!1;const We={};for(const[nt,Xe]of Object.entries($e)){if(!ae.has(nt)){De=!0;continue}We[nt]=Xe}return De?We:$e}),Z($e=>{let De=!1;const We={};for(const[nt,Xe]of Object.entries($e)){if(!ae.has(nt)){De=!0;continue}We[nt]=Xe}return De?We:$e}),F($e=>{let De=!1;const We={};for(const[nt,Xe]of Object.entries($e)){if(!ae.has(nt)){De=!0;continue}We[nt]=Xe}return De?We:$e})},[n==null?void 0:n.files]),_.useEffect(()=>{const ae=new Set((t==null?void 0:t.commits.map(De=>De.oid))??[]),$e=new Set((t==null?void 0:t.commits.flatMap(De=>De.files.map(We=>Df(De.oid,We.path))))??[]);pe(De=>{let We=!1;const nt={};for(const[Xe,At]of Object.entries(De)){if(!ae.has(Xe)){We=!0;continue}nt[Xe]=At}return We?nt:De}),ne(De=>{let We=!1;const nt={};for(const[Xe,At]of Object.entries(De)){if(!ae.has(Xe)){We=!0;continue}if(At&&!$e.has(Df(Xe,At))){We=!0,nt[Xe]=null;continue}nt[Xe]=At}return We?nt:De}),$(De=>{let We=!1;const nt={};for(const[Xe,At]of Object.entries(De)){if(!$e.has(Xe)){We=!0;continue}nt[Xe]=At}return We?nt:De}),de(De=>{let We=!1;const nt={};for(const[Xe,At]of Object.entries(De)){if(!$e.has(Xe)){We=!0;continue}nt[Xe]=At}return We?nt:De}),A(De=>{let We=!1;const nt={};for(const[Xe,At]of Object.entries(De)){if(!$e.has(Xe)){We=!0;continue}nt[Xe]=At}return We?nt:De})},[t==null?void 0:t.commits]),_.useEffect(()=>{if(!te)return;const ae=$e=>{var De;(De=we.current)!=null&&De.contains($e.target)||je(!1)};return window.addEventListener("pointerdown",ae),()=>{window.removeEventListener("pointerdown",ae)}},[te]),_.useEffect(()=>{n&&(Se==="commit"&&(N==null?void 0:N.action)!=="commit-all"&&n.files.length===0&&(Re(null),Ne("")),ie&&n.branch===ie&&(z(null),Re(null),Ne(""),je(!1)))},[Se,N==null?void 0:N.action,ie,n]),_.useEffect(()=>{n!=null&&n.branches.length||je(!1)},[n==null?void 0:n.branches]),_.useEffect(()=>{V({}),Z({}),F({})},[n==null?void 0:n.updated_at]);const ke=(n==null?void 0:n.files)??[],_e=(t==null?void 0:t.commits)??[],Me=ke.length>0,Ge=_e.length>0,at=(N==null?void 0:N.action)==="discard-all",ht=(N==null?void 0:N.action)==="commit-all",Bt=(N==null?void 0:N.action)==="switch-branch",Ut=(N==null?void 0:N.action)==="push",Ze=H==="changes",Zt=Se==="switch-branch"&&ie?`提交后切换到 ${ie}`:"提交全部改动",un=_.useMemo(()=>{if(!n)return null;const ae=[];return n.upstream_branch&&ae.push(n.upstream_branch),n.ahead_count>0&&ae.push(`ahead ${n.ahead_count}`),n.behind_count>0&&ae.push(`behind ${n.behind_count}`),ae.join(" · ")},[n]),fe=_.useMemo(()=>{if(!t)return null;const ae=[t.branch];return t.upstream_branch&&ae.push(t.upstream_branch),ae.join(" · ")},[t]),Ae=_.useMemo(()=>H==="history"?ik(_e):{},[H,_e]),Ie=_.useMemo(()=>H!=="history"?1:Math.max(1,...Object.values(Ae).map(ae=>Math.max(ae.beforeLanes.length,ae.afterLanes.length,ae.laneIndex+1))),[H,Ae]),Ce=(ae,$e)=>{re[ae]||ee[ae]||(Z(De=>({...De,[ae]:!0})),F(De=>{const We={...De};return delete We[ae],We}),k(ae,$e).then(De=>{V(We=>({...We,[ae]:De}))}).catch(De=>{F(We=>({...We,[ae]:De instanceof Error?De.message:"无法读取该文件的差异。"}))}).finally(()=>{Z(De=>{const We={...De};return delete We[ae],We})}))};_.useEffect(()=>{if(!(H!=="changes"||ke.length===0))for(const ae of ke)R[ae.path]&&Ce(ae.path,ae.previous_path)},[H,R,ke,k,re,ee]);const Fe=()=>{Re(null),Ne(""),z(null)},tt=()=>{z(null),Re(ae=>ae==="commit"?(Ne(""),null):"commit")},qe=()=>{const ae=oe.trim();if(ae){if(Se==="switch-branch"&&ie){Promise.resolve(x(ie,ae)).catch(()=>{});return}g(ae)}},rn=ae=>{if(!(!n||ae===n.branch||N)){if(je(!1),n.files.length>0){z(ae),Re("switch-branch");return}Promise.resolve(x(ae)).catch(()=>{})}},vn=()=>{if(Ze){f();return}p()},zn=()=>{U(ae=>{const $e=ae==="changes"?"history":"changes";return $e==="history"&&y(),$e})},as=(ae,$e)=>{const De=Df(ae.oid,$e.path),We=Y[ae.oid]===$e.path;ne(nt=>({...nt,[ae.oid]:We?null:$e.path})),!(We||T[De]||ue[De])&&(de(nt=>({...nt,[De]:!0})),A(nt=>{const Xe={...nt};return delete Xe[De],Xe}),E(ae.oid,$e.path,$e.previous_path).then(nt=>{$(Xe=>({...Xe,[De]:nt}))}).catch(nt=>{A(Xe=>({...Xe,[De]:nt instanceof Error?nt.message:"无法读取该文件的提交差异。"}))}).finally(()=>{de(nt=>{const Xe={...nt};return delete Xe[De],Xe})}))},Sn=ae=>{const $e=new Date(ae);return Number.isNaN($e.getTime())?ae:new Intl.DateTimeFormat("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}).format($e)};return r.jsxs("section",{className:`session-git-panel ${P?"is-compact":""}`,children:[r.jsxs("div",{className:"session-git-panel__header",children:[r.jsxs("div",{className:"session-git-panel__heading",ref:we,children:[r.jsxs("button",{type:"button",className:"session-git-panel__branch-button",onClick:()=>je(ae=>!ae),disabled:!n||!!N,"aria-haspopup":"menu","aria-expanded":te,title:n?`切换分支:${n.branch}`:"分支加载中",children:[r.jsx("span",{className:"session-git-panel__branch-icon","aria-hidden":"true",children:r.jsx(Xw,{})}),r.jsx("span",{className:"session-git-panel__branch",children:(n==null?void 0:n.branch)??"加载中"}),r.jsx("span",{className:`session-git-panel__branch-chevron ${te?"is-open":""}`,"aria-hidden":"true",children:r.jsx(n1,{})})]}),te&&n?r.jsx("div",{className:"session-git-panel__branch-menu",role:"menu","aria-label":"分支列表",children:n.branches.map(ae=>{const $e=ae===n.branch,De=(N==null?void 0:N.action)==="switch-branch"&&N.branch===ae;return r.jsxs("button",{type:"button",className:`session-git-panel__branch-option ${$e?"is-current":""}`,onClick:()=>rn(ae),disabled:$e||!!N,role:"menuitemradio","aria-checked":$e,title:$e?`${ae}(当前)`:`切换到 ${ae}`,children:[r.jsx("span",{className:"session-git-panel__branch-option-name",children:ae}),$e?r.jsx("span",{className:"session-git-panel__branch-option-meta",children:"当前"}):null,De?r.jsx("span",{className:"session-git-panel__branch-option-meta",children:"切换中"}):null]},ae)})}):null]}),r.jsxs("div",{className:"session-git-panel__toolbar",children:[r.jsx(jr,{label:Ze?"切换到提交历史":"返回修改列表",icon:r.jsx(Vw,{}),onClick:zn,disabled:!!N,variant:Ze?"default":"primary",className:Ze?void 0:"is-active"}),r.jsx(jr,{label:Ze?a?"正在刷新":"刷新":l?"正在刷新历史":"刷新历史",icon:r.jsx(Yw,{}),onClick:vn,disabled:Ze?a||!!N:l,pending:Ze?a:l}),Ze&&Me?r.jsxs(r.Fragment,{children:[r.jsx(jr,{label:at?"正在撤回全部修改":"撤回全部修改",icon:r.jsx(Oy,{}),onClick:S,disabled:!!N,variant:"danger",pending:at}),r.jsx(jr,{label:ht?"正在提交全部修改":Se==="commit"?"收起提交编辑器":"提交全部修改",icon:r.jsx(Ly,{}),onClick:tt,disabled:!!N,variant:"primary",pending:ht})]}):null,Ze&&!Me?r.jsx(jr,{label:Ut?"正在推送当前分支":"推送当前分支",icon:r.jsx(Kw,{}),onClick:j,disabled:!!N,variant:"primary",pending:Ut}):null]})]}),Ze&&n?r.jsxs("div",{className:"session-git-panel__summary",children:[r.jsx("span",{className:"session-git-panel__summary-text",children:Me?`${ke.length} 个文件待处理`:"当前工作区没有待提交改动"}),un?r.jsx("span",{className:"session-git-panel__summary-meta",children:un}):null]}):null,!Ze&&t?r.jsxs("div",{className:"session-git-panel__summary",children:[r.jsx("span",{className:"session-git-panel__summary-text",children:Ge?`${_e.length} 条最近提交`:"当前分支还没有提交历史"}),fe?r.jsx("span",{className:"session-git-panel__summary-meta",children:fe}):null]}):null,Ze&&Se&&Me?r.jsxs("div",{className:"session-git-panel__composer",children:[r.jsx("div",{className:"session-git-panel__composer-title",children:Zt}),r.jsxs("div",{className:"session-git-panel__composer-row",children:[r.jsx("input",{value:oe,onChange:ae=>Ne(ae.target.value),placeholder:"输入 commit message",className:"session-git-panel__input",disabled:!!N}),r.jsx(jr,{label:Se==="switch-branch"?"提交并切换分支":"确认提交",icon:r.jsx(Ly,{}),onClick:qe,disabled:!oe.trim()||!!N,variant:"primary",pending:ht||Bt}),r.jsx(jr,{label:"取消提交",icon:r.jsx(Zw,{}),onClick:Fe,disabled:!!N})]})]}):null,Ze&&c?r.jsx("div",{className:"session-git-panel__notice is-error",children:c}):null,!Ze&&u?r.jsx("div",{className:"session-git-panel__notice is-error",children:u}):null,Ze&&a&&!n?r.jsx("div",{className:"session-git-panel__empty",children:"正在读取当前工作区改动…"}):null,!Ze&&l&&!t?r.jsx("div",{className:"session-git-panel__empty",children:"正在读取当前分支提交历史…"}):null,Ze&&!a&&n&&!Me?r.jsx("div",{className:"session-git-panel__empty",children:"当前分支没有待提交改动。你现在可以直接推送当前分支。"}):null,!Ze&&!l&&t&&!Ge?r.jsx("div",{className:"session-git-panel__empty",children:"当前分支还没有提交历史。"}):null,Ze&&Me?r.jsx("div",{className:"session-git-panel__list",children:ke.map(ae=>{const $e=!!R[ae.path],De=(N==null?void 0:N.action)==="discard-file"&&N.path===ae.path,We=re[ae.path],nt=!!ee[ae.path],Xe=W[ae.path]??null;return r.jsxs("article",{className:`session-git-file ${$e?"is-expanded":""}`,children:[r.jsxs("div",{className:"session-git-file__head",children:[r.jsxs("button",{type:"button",className:"session-git-file__toggle",onClick:()=>{const At=!$e;q(nn=>({...nn,[ae.path]:At})),At&&Ce(ae.path,ae.previous_path)},"aria-expanded":$e,children:[r.jsxs("span",{className:"session-git-file__main",children:[r.jsx("span",{className:"session-git-file__path",children:ae.path}),ae.previous_path?r.jsxs("span",{className:"session-git-file__rename",children:["来自 ",ae.previous_path]}):null]}),r.jsxs("span",{className:"session-git-file__meta",children:[r.jsx("span",{className:`session-git-file__status is-${ae.status}`,children:Iy(ae.status)}),r.jsxs("span",{className:"session-git-file__counts",children:[r.jsxs("span",{className:"is-add",children:["+",ae.additions]}),r.jsxs("span",{className:"is-remove",children:["-",ae.deletions]})]}),r.jsx("span",{className:"session-git-file__chevron","aria-hidden":"true",children:r.jsx(n1,{})})]})]}),r.jsx(jr,{label:De?`正在撤回 ${ae.path}`:`撤回 ${ae.path}`,icon:r.jsx(Oy,{}),onClick:()=>m(ae.path),disabled:!!N,variant:"danger",pending:De,className:"session-git-file__action"})]}),$e?r.jsx("div",{className:"session-git-file__detail",children:Xe?r.jsx("div",{className:"session-git-panel__notice is-error",children:Xe}):nt?r.jsx("div",{className:"patch-file-card__empty",children:"正在读取该文件的差异…"}):r.jsx(_.Suspense,{fallback:r.jsx("div",{className:"patch-file-card__empty",children:"正在展开差异…"}),children:r.jsx(Dy,{diffText:(We==null?void 0:We.diff)??"",filePath:ae.path,emptyMessage:nk(ae)})})}):null]},ae.path)})}):null,!Ze&&Ge?r.jsx("div",{className:"session-git-history",children:_e.map((ae,$e)=>{const De=!!be[ae.oid],We=P0(ae),nt=Y[ae.oid]??null,Xe=Ae[ae.oid],At=(t==null?void 0:t.head_oid)===ae.oid,nn=(t==null?void 0:t.upstream_head_oid)===ae.oid,Gn=ak(ae).filter(gt=>!gt||gt===(t==null?void 0:t.branch)||gt===(t==null?void 0:t.upstream_branch)||gt===`HEAD -> ${t==null?void 0:t.branch}`?!1:gt!=="HEAD");return r.jsxs("article",{className:`session-git-history__item ${De?"is-expanded":""} ${We.length>1?"is-merge":""} ${At?"is-local-head":""} ${nn?"is-remote-head":""}`.trim(),children:[r.jsxs("button",{type:"button",className:"session-git-history__toggle",onClick:()=>pe(gt=>({...gt,[ae.oid]:!gt[ae.oid]})),"aria-expanded":De,children:[Xe?r.jsx(rk,{commit:ae,row:Xe,isLocalHead:At,isRemoteHead:nn,isFirstRow:$e===0,maxLaneCount:Ie}):null,r.jsxs("span",{className:"session-git-history__content",children:[r.jsx("span",{className:"session-git-history__subject",children:ae.subject}),r.jsxs("span",{className:"session-git-history__meta",children:[r.jsx("span",{children:ae.short_oid}),r.jsx("span",{children:ae.author_name}),r.jsx("span",{children:Sn(ae.committed_at)})]})]}),r.jsxs("span",{className:"session-git-history__refs",children:[At?r.jsx("span",{className:"session-git-history__ref is-local",title:"本地当前 HEAD",children:r.jsx(Jw,{})}):null,nn?r.jsx("span",{className:"session-git-history__ref is-remote",title:t!=null&&t.upstream_branch?`云端位置:${t.upstream_branch}`:"云端位置",children:r.jsx(ek,{})}):null,We.length>1?r.jsx("span",{className:"session-git-history__ref is-merge",title:"合并提交",children:r.jsx(tk,{})}):null,Gn.slice(0,2).map(gt=>r.jsx("span",{className:"session-git-history__ref is-label",title:gt,children:gt},`${ae.oid}:${gt}`))]}),r.jsx("span",{className:"session-git-history__chevron","aria-hidden":"true",children:r.jsx(n1,{})})]}),De?r.jsx("div",{className:"session-git-history__files",children:r.jsx("div",{className:"session-git-history__files-list",children:ae.files.map(gt=>{const kn=nt===gt.path,Ee=Df(ae.oid,gt.path),Dt=T[Ee],Dn=!!ue[Ee],Wn=ve[Ee]??null;return r.jsxs("div",{className:`session-git-history-file-row ${kn?"is-selected":""}`,children:[r.jsxs("button",{type:"button",className:`session-git-history-file ${kn?"is-selected":""}`,onClick:()=>as(ae,gt),"aria-pressed":kn,children:[r.jsx("span",{className:`session-git-file__status is-${gt.status}`,children:Iy(gt.status)}),r.jsx("span",{className:"session-git-history-file__path",children:gt.path}),gt.previous_path?r.jsxs("span",{className:"session-git-history-file__rename",children:["来自 ",gt.previous_path]}):null,r.jsx("span",{className:"session-git-history-file__meta",children:Dt?r.jsxs("span",{className:"session-git-history-file__counts",children:[r.jsxs("span",{className:"is-add",children:["+",Dt.additions]}),r.jsxs("span",{className:"is-remove",children:["-",Dt.deletions]})]}):Dn?r.jsx("span",{className:"session-git-history-file__loading",children:"读取中…"}):r.jsx("span",{className:"session-git-history-file__hint",children:"点击查看"})})]}),kn?r.jsxs("div",{className:"session-git-history__diff is-inline",children:[r.jsxs("div",{className:"session-git-history__diff-header",children:[r.jsx("span",{className:"session-git-history__diff-path",children:gt.path}),gt.previous_path?r.jsxs("span",{className:"session-git-history__diff-rename",children:["来自 ",gt.previous_path]}):null]}),Wn?r.jsx("div",{className:"session-git-panel__notice is-error",children:Wn}):Dn?r.jsx("div",{className:"patch-file-card__empty",children:"正在读取该文件的提交差异…"}):r.jsx(_.Suspense,{fallback:r.jsx("div",{className:"patch-file-card__empty",children:"正在展开差异…"}),children:r.jsx(Dy,{diffText:(Dt==null?void 0:Dt.diff)??"",filePath:gt.path,emptyMessage:sk(gt,Dt??null)})})]}):null]},`${ae.oid}:${gt.path}`)})})}):null]},ae.oid)})}):null]})},Py={name:"",description:null,command:"",kill_command:null,cwd:null,shell:"auto",node_version:null,port:null},zy=()=>r.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:r.jsx("path",{d:"m8 6 9 6-9 6z"})}),By=()=>r.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:r.jsx("rect",{x:"6.5",y:"6.5",width:"11",height:"11",rx:"1.8"})}),ok=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"m12 3 1.4 4.6L18 9l-4.6 1.4L12 15l-1.4-4.6L6 9l4.6-1.4Z"}),r.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"})]}),ck=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.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"}),r.jsx("path",{d:"m13.5 6.5 4 4"})]}),uk=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M4.5 7h15"}),r.jsx("path",{d:"M9.5 4.5h5"}),r.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"}),r.jsx("path",{d:"M10 10.5v5.2"}),r.jsx("path",{d:"M14 10.5v5.2"})]}),dk=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M12 5v14"}),r.jsx("path",{d:"M5 12h14"})]}),Uy={auto:"自动",powershell:"PowerShell",cmd:"CMD",bash:"Bash"},fk=({commands:n,nodeRuntime:t,error:a,pendingRunCommandId:l,pendingKillCommandId:c,pendingDeleteCommandId:u,isSaving:f,isGenerating:p,isStartingAll:y,isStoppingAll:m,generationReason:S,executionModelLabel:g,onRun:x,onRunAll:j,onRunAllKill:k,onRunKill:E,onSave:N,onDelete:P,onGenerate:H})=>{var ne;const[U,R]=_.useState("list"),[q,re]=_.useState(null),[V,ee]=_.useState(Py),Z=_.useMemo(()=>n.find(T=>T.id===q)??null,[n,q]),W=_.useMemo(()=>{const T=[...(t==null?void 0:t.versions)??[]];return V.node_version&&!T.includes(V.node_version)&&T.unshift(V.node_version),T},[V.node_version,t==null?void 0:t.versions]),F=_.useMemo(()=>n.filter(T=>!!T.kill_command).length,[n]),be=()=>{ee(Py),re(null),R("edit")},pe=T=>{ee({name:T.name,description:T.description,command:T.command,kill_command:T.kill_command,cwd:T.cwd,shell:T.shell,node_version:T.node_version,port:T.port}),re(T.id),R("edit")},Y=()=>{N({commandId:Z==null?void 0:Z.id,draft:V}),f||(R("list"),re(null))};return r.jsxs("div",{className:"session-run-panel",children:[r.jsxs("div",{className:"session-run-panel__header",children:[r.jsxs("div",{className:"session-run-panel__header-copy",children:[r.jsxs("div",{className:"session-run-panel__title-row",children:[r.jsx("h2",{className:"session-run-panel__title",children:"项目命令"}),r.jsxs("span",{className:"session-run-panel__count",children:[n.length," 条"]})]}),r.jsxs("div",{className:"session-run-panel__hint",children:["一键生成使用模型:",g]})]}),r.jsxs("div",{className:"session-run-panel__header-actions",children:[r.jsx("button",{type:"button",className:"session-run-panel__icon-button is-primary","aria-label":y?"正在一键启动项目命令":"一键启动项目命令",title:y?"正在一键启动项目命令":"一键启动项目命令",disabled:n.length===0||y||m,onClick:j,children:r.jsx(zy,{})}),r.jsx("button",{type:"button",className:"session-run-panel__icon-button is-warning","aria-label":m?"正在一键停止项目命令":"一键停止项目命令",title:m?"正在一键停止项目命令":"一键停止项目命令",disabled:F===0||y||m,onClick:k,children:r.jsx(By,{})}),r.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":p?"正在一键生成项目命令":"一键生成项目命令",title:p?"正在一键生成项目命令":"一键生成项目命令",disabled:p||y||m,onClick:H,children:r.jsx(ok,{})}),r.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":"新增项目命令",title:"新增项目命令",onClick:be,children:r.jsx(dk,{})})]})]}),a?r.jsx("div",{className:"session-run-panel__notice is-error",children:a}):null,S?r.jsx("div",{className:"session-run-panel__hint",children:S}):null,U==="edit"?r.jsxs("div",{className:"session-run-panel__card",children:[r.jsx("h3",{className:"session-run-panel__section-title",children:Z?"编辑命令":"新增命令"}),r.jsxs("div",{className:"session-run-panel__form-grid",children:[r.jsxs("label",{className:"session-run-panel__field",children:[r.jsx("span",{children:"名称"}),r.jsx("input",{value:V.name,onChange:T=>ee($=>({...$,name:T.target.value})),className:"session-run-panel__input",placeholder:"例如:启动前端"})]}),r.jsxs("label",{className:"session-run-panel__field",children:[r.jsx("span",{children:"说明"}),r.jsx("input",{value:V.description??"",onChange:T=>ee($=>({...$,description:T.target.value||null})),className:"session-run-panel__input",placeholder:"给自己留一个短说明"})]}),r.jsxs("label",{className:"session-run-panel__field is-full",children:[r.jsx("span",{children:"命令"}),r.jsx("textarea",{value:V.command,onChange:T=>ee($=>({...$,command:T.target.value})),className:"session-run-panel__textarea",placeholder:"pnpm dev",rows:4})]}),r.jsxs("label",{className:"session-run-panel__field is-full",children:[r.jsx("span",{children:"停止命令"}),r.jsx("textarea",{value:V.kill_command??"",onChange:T=>ee($=>({...$,kill_command:T.target.value||null})),className:"session-run-panel__textarea",placeholder:"留空表示不需要单独停止",rows:3})]}),r.jsxs("label",{className:"session-run-panel__field",children:[r.jsx("span",{children:"工作目录"}),r.jsx("input",{value:V.cwd??"",onChange:T=>ee($=>({...$,cwd:T.target.value||null})),className:"session-run-panel__input",placeholder:"留空表示项目根目录"})]}),r.jsxs("label",{className:"session-run-panel__field",children:[r.jsx("span",{children:"端口"}),r.jsx("input",{value:V.port??"",onChange:T=>{const $=Number.parseInt(T.target.value,10);ee(ue=>({...ue,port:Number.isFinite($)&&$>0?$:null}))},className:"session-run-panel__input",placeholder:"例如:5173",inputMode:"numeric"})]}),r.jsxs("label",{className:"session-run-panel__field",children:[r.jsx("span",{children:"Shell"}),r.jsx("select",{value:V.shell,onChange:T=>ee($=>({...$,shell:T.target.value})),className:"session-run-panel__select",children:Object.entries(Uy).map(([T,$])=>r.jsx("option",{value:T,children:$},T))})]}),r.jsxs("label",{className:"session-run-panel__field",children:[r.jsx("span",{children:"Node 环境"}),r.jsxs("select",{value:V.node_version??"",onChange:T=>ee($=>({...$,node_version:T.target.value||null})),className:"session-run-panel__select",children:[r.jsx("option",{value:"",children:"默认环境"}),W.map(T=>r.jsxs("option",{value:T,children:["Node ",T,t!=null&&t.versions.includes(T)?"":"(未检测到)"]},T))]})]})]}),r.jsx("div",{className:"session-run-panel__hint",children:t!=null&&t.versions.length?"Node 版本只会临时注入当前命令,不会修改系统全局环境。":((ne=t==null?void 0:t.error)==null?void 0:ne.trim())||"未检测到可用的 nvm Node 版本,将按默认环境运行。"}),r.jsxs("div",{className:"session-run-panel__form-actions",children:[r.jsx("button",{type:"button",className:"session-run-panel__ghost-button",onClick:()=>R("list"),children:"取消"}),r.jsx("button",{type:"button",className:"session-run-panel__primary-button",disabled:!V.name.trim()||!V.command.trim()||f,onClick:Y,children:f?"保存中...":Z?"保存修改":"保存命令"})]})]}):null,r.jsx("div",{className:"session-run-panel__list",children:n.length>0?n.map(T=>r.jsxs("article",{className:"session-run-panel__command-card",children:[r.jsxs("div",{className:"session-run-panel__command-head",children:[r.jsxs("button",{type:"button",className:"session-run-panel__command-main",onClick:()=>pe(T),children:[r.jsxs("div",{className:"session-run-panel__command-heading",children:[r.jsx("span",{className:"session-run-panel__command-name",children:T.name}),T.description?r.jsx("span",{className:"session-run-panel__command-description",children:T.description}):null]}),r.jsx("div",{className:"session-run-panel__command-line",children:T.command})]}),r.jsxs("div",{className:"session-run-panel__command-actions",children:[T.kill_command?r.jsx("button",{type:"button",className:"session-run-panel__icon-button is-warning","aria-label":`执行 ${T.name} 的停止命令`,title:`执行 ${T.name} 的停止命令`,disabled:c===T.id,onClick:()=>E(T.id),children:r.jsx(By,{})}):null,r.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":`编辑 ${T.name}`,title:`编辑 ${T.name}`,onClick:()=>pe(T),children:r.jsx(ck,{})}),r.jsx("button",{type:"button",className:"session-run-panel__icon-button is-danger","aria-label":`删除 ${T.name}`,title:`删除 ${T.name}`,disabled:u===T.id,onClick:()=>P(T.id),children:r.jsx(uk,{})}),r.jsx("button",{type:"button",className:"session-run-panel__icon-button is-primary","aria-label":`运行 ${T.name}`,title:`运行 ${T.name}`,disabled:l===T.id,onClick:()=>x(T.id),children:r.jsx(zy,{})})]})]}),r.jsx("div",{className:"session-run-panel__command-footer",children:r.jsxs("div",{className:"session-run-panel__command-meta",children:[r.jsx("span",{className:"session-run-panel__command-pill",children:Uy[T.shell]}),T.node_version?r.jsxs("span",{className:"session-run-panel__command-pill is-node",children:["Node ",T.node_version]}):null,T.port?r.jsxs("span",{className:"session-run-panel__command-pill",children:[":",T.port]}):null,T.kill_command?r.jsx("span",{className:"session-run-panel__command-pill is-kill",children:"可停止"}):null,r.jsx("span",{className:"session-run-panel__command-pill",children:T.cwd?T.cwd:"项目根目录"})]})})]},T.id)):r.jsxs("div",{className:"session-run-panel__empty",children:[r.jsx("div",{className:"session-run-panel__empty-title",children:"还没有项目命令"}),r.jsx("div",{className:"session-run-panel__empty-copy",children:"可以手动新增,或直接点击一键生成。"})]})})]})},$y={name:"",description:null,url:""},hk=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"m12 3 1.4 4.6L18 9l-4.6 1.4L12 15l-1.4-4.6L6 9l4.6-1.4Z"}),r.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"})]}),mk=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("circle",{cx:"12",cy:"12",r:"8.5"}),r.jsx("path",{d:"M3.8 12h16.4"}),r.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"})]}),pk=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.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"}),r.jsx("path",{d:"m13.5 6.5 4 4"})]}),gk=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M4.5 7h15"}),r.jsx("path",{d:"M9.5 4.5h5"}),r.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"}),r.jsx("path",{d:"M10 10.5v5.2"}),r.jsx("path",{d:"M14 10.5v5.2"})]}),yk=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M12 5v14"}),r.jsx("path",{d:"M5 12h14"})]}),vk=({websites:n,error:t,pendingDeleteWebsiteId:a,isSaving:l,isGenerating:c,generationReason:u,executionModelLabel:f,onOpen:p,onSave:y,onDelete:m,onGenerate:S})=>{const[g,x]=_.useState("list"),[j,k]=_.useState(null),[E,N]=_.useState($y),P=_.useMemo(()=>n.find(q=>q.id===j)??null,[j,n]),H=()=>{N($y),k(null),x("edit")},U=q=>{N({name:q.name,description:q.description,url:q.url}),k(q.id),x("edit")},R=()=>{y({websiteId:P==null?void 0:P.id,draft:E}),l||(x("list"),k(null))};return r.jsxs("div",{className:"session-run-panel",children:[r.jsxs("div",{className:"session-run-panel__header",children:[r.jsxs("div",{className:"session-run-panel__header-copy",children:[r.jsxs("div",{className:"session-run-panel__title-row",children:[r.jsx("h2",{className:"session-run-panel__title",children:"项目网页"}),r.jsxs("span",{className:"session-run-panel__count",children:[n.length," 条"]})]}),r.jsxs("div",{className:"session-run-panel__hint",children:["一键生成使用模型:",f]})]}),r.jsxs("div",{className:"session-run-panel__header-actions",children:[r.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":c?"正在一键生成项目网页":"一键生成项目网页",title:c?"正在一键生成项目网页":"一键生成项目网页",disabled:c,onClick:S,children:r.jsx(hk,{})}),r.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":"新增项目网页",title:"新增项目网页",onClick:H,children:r.jsx(yk,{})})]})]}),t?r.jsx("div",{className:"session-run-panel__notice is-error",children:t}):null,u?r.jsx("div",{className:"session-run-panel__hint",children:u}):null,g==="edit"?r.jsxs("div",{className:"session-run-panel__card",children:[r.jsx("h3",{className:"session-run-panel__section-title",children:P?"编辑网页":"新增网页"}),r.jsxs("div",{className:"session-run-panel__form-grid",children:[r.jsxs("label",{className:"session-run-panel__field",children:[r.jsx("span",{children:"名称"}),r.jsx("input",{value:E.name,onChange:q=>N(re=>({...re,name:q.target.value})),className:"session-run-panel__input",placeholder:"例如:前端首页"})]}),r.jsxs("label",{className:"session-run-panel__field",children:[r.jsx("span",{children:"说明"}),r.jsx("input",{value:E.description??"",onChange:q=>N(re=>({...re,description:q.target.value||null})),className:"session-run-panel__input",placeholder:"给自己留一个短说明"})]}),r.jsxs("label",{className:"session-run-panel__field is-full",children:[r.jsx("span",{children:"地址"}),r.jsx("input",{value:E.url,onChange:q=>N(re=>({...re,url:q.target.value})),className:"session-run-panel__input",placeholder:"http://localhost:5173"})]})]}),r.jsxs("div",{className:"session-run-panel__form-actions",children:[r.jsx("button",{type:"button",className:"session-run-panel__ghost-button",onClick:()=>x("list"),children:"取消"}),r.jsx("button",{type:"button",className:"session-run-panel__primary-button",disabled:!E.name.trim()||!E.url.trim()||l,onClick:R,children:l?"保存中...":P?"保存修改":"保存网页"})]})]}):null,r.jsx("div",{className:"session-run-panel__list",children:n.length>0?n.map(q=>r.jsxs("article",{className:"session-run-panel__command-card",children:[r.jsxs("div",{className:"session-run-panel__command-head",children:[r.jsxs("button",{type:"button",className:"session-run-panel__command-main",onClick:()=>U(q),children:[r.jsxs("div",{className:"session-run-panel__command-heading",children:[r.jsx("span",{className:"session-run-panel__command-name",children:q.name}),q.description?r.jsx("span",{className:"session-run-panel__command-description",children:q.description}):null]}),r.jsx("div",{className:"session-run-panel__command-line",children:q.url})]}),r.jsxs("div",{className:"session-run-panel__command-actions",children:[r.jsx("a",{className:"session-run-panel__icon-button is-primary","aria-label":`打开 ${q.name}`,title:`打开 ${q.name}`,href:q.url,target:"_blank",rel:"noreferrer",onClick:()=>p(q),children:r.jsx(mk,{})}),r.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":`编辑 ${q.name}`,title:`编辑 ${q.name}`,onClick:()=>U(q),children:r.jsx(pk,{})}),r.jsx("button",{type:"button",className:"session-run-panel__icon-button is-danger","aria-label":`删除 ${q.name}`,title:`删除 ${q.name}`,disabled:a===q.id,onClick:()=>m(q.id),children:r.jsx(gk,{})})]})]}),r.jsx("div",{className:"session-run-panel__command-footer",children:r.jsx("div",{className:"session-run-panel__command-meta",children:r.jsx("span",{className:"session-run-panel__command-pill",children:"网页"})})})]},q.id)):r.jsxs("div",{className:"session-run-panel__empty",children:[r.jsx("div",{className:"session-run-panel__empty-title",children:"还没有项目网页"}),r.jsx("div",{className:"session-run-panel__empty-copy",children:"可以手动新增,或直接点击一键生成。"})]})})]})},_k=/\u001b\[([0-9;]*)m/g,bk={stdout:"",stderr:"stderr",system:"system"},Hy={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"},q1={fg:null,bg:null,bold:!1,dim:!1,underline:!1},xk=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M6 6 18 18"}),r.jsx("path",{d:"M18 6 6 18"})]}),Sk=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M8 4H4v4"}),r.jsx("path",{d:"M16 4h4v4"}),r.jsx("path",{d:"M8 20H4v-4"}),r.jsx("path",{d:"M16 20h4v-4"}),r.jsx("path",{d:"M9 9 4 4"}),r.jsx("path",{d:"m15 9 5-5"}),r.jsx("path",{d:"m9 15-5 5"}),r.jsx("path",{d:"m15 15 5 5"})]}),jk=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M9 4H4v5"}),r.jsx("path",{d:"M15 4h5v5"}),r.jsx("path",{d:"M9 20H4v-5"}),r.jsx("path",{d:"M15 20h5v-5"}),r.jsx("path",{d:"m4 9 5-5"}),r.jsx("path",{d:"m20 9-5-5"}),r.jsx("path",{d:"m4 15 5 5"}),r.jsx("path",{d:"m20 15-5 5"})]}),wk=n=>{if(!n)return"刚刚";const t=new Date(n);return Number.isNaN(t.getTime())?"刚刚":new Intl.DateTimeFormat("zh-CN",{hour:"2-digit",minute:"2-digit"}).format(t)},qy=(n,t)=>{const a=[n];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(" ")},kk=(n,t)=>{if(t===0)return{...q1};if(t===1)return{...n,bold:!0,dim:!1};if(t===2)return{...n,dim:!0,bold:!1};if(t===4)return{...n,underline:!0};if(t===22)return{...n,bold:!1,dim:!1};if(t===24)return{...n,underline:!1};if(t===39)return{...n,fg:null};if(t===49)return{...n,bg:null};const a=Hy[t];if(a)return{...n,fg:a};const l=Hy[t-10];return l&&t>=40?{...n,bg:l}:n},Nk=(n,t)=>{const a=[];let l=0,c={...q1};for(const u of n.matchAll(_k)){const f=u.index??0;f>l&&a.push({text:n.slice(l,f),className:qy(t,c)});const p=(u[1]??"").split(";").map(y=>Number.parseInt(y||"0",10)).filter(y=>Number.isFinite(y));p.length===0?c={...q1}:c=p.reduce(kk,c),l=f+u[0].length}return l<n.length&&a.push({text:n.slice(l),className:qy(t,c)}),a.length===0&&a.push({text:n,className:t}),a},_v=_.memo(({chunks:n})=>{const t=_.useMemo(()=>n.map(a=>{const l=bk[a.stream],c=["session-terminal-output__segment",`is-${a.stream}`].join(" ");return{cursor:a.cursor,label:l,segments:Nk(a.text,c)}}),[n]);return r.jsx(r.Fragment,{children:t.map(a=>r.jsxs("span",{className:"session-terminal-output__chunk",children:[a.label?r.jsx("span",{className:"session-terminal-output__label",children:a.label}):null,a.segments.map((l,c)=>r.jsx("span",{className:l.className,children:l.text},`${a.cursor}:${c}`))]},a.cursor))})});_v.displayName="TerminalOutput";const Ck=({terminals:n,activeTerminalId:t,outputs:a,error:l,compact:c=!1,canToggleFullscreen:u=!1,isFullscreen:f=!1,onSelectTerminal:p,onCloseTerminal:y,onToggleFullscreen:m})=>{const S=_.useRef(null),g=n.find(j=>j.id===t)??n[0]??null,x=g?a[g.id]:null;return _.useEffect(()=>{const j=S.current;j&&(j.scrollTop=j.scrollHeight)},[x==null?void 0:x.chunks,g==null?void 0:g.id]),n.length===0?r.jsx("section",{className:`session-terminal-panel ${c?"is-compact":""}`,children:r.jsxs("div",{className:"session-terminal-panel__empty",children:[r.jsx("div",{className:"session-terminal-panel__empty-title",children:"还没有运行中的命令"}),r.jsx("p",{className:"session-terminal-panel__empty-copy",children:"从右上角的运行按钮启动一个项目命令后,这里会实时显示终端输出。"})]})}):r.jsxs("section",{className:`session-terminal-panel ${c?"is-compact":""}`,children:[r.jsxs("div",{className:"session-terminal-panel__tabs",children:[r.jsx("div",{className:"session-terminal-panel__tab-list",role:"tablist","aria-label":"终端列表",children:n.map(j=>{const k=j.id===(g==null?void 0:g.id);return r.jsxs("div",{className:`session-terminal-panel__tab ${k?"is-active":""}`,children:[r.jsxs("button",{type:"button",className:"session-terminal-panel__tab-button",role:"tab","aria-selected":k,onClick:()=>p(j.id),children:[r.jsx("span",{className:`session-terminal-panel__tab-dot is-${j.status}`,"aria-hidden":"true"}),r.jsx("span",{className:"session-terminal-panel__tab-title",children:j.title}),r.jsx("span",{className:"session-terminal-panel__tab-time",children:wk(j.last_output_at??j.updated_at)})]}),r.jsx("button",{type:"button",className:"session-terminal-panel__tab-close","aria-label":`关闭 ${j.title}`,onClick:E=>{E.stopPropagation(),y(j.id)},children:r.jsx(xk,{})})]},j.id)})}),u&&m?r.jsx("button",{type:"button",className:"session-terminal-panel__fullscreen-button",onClick:m,"aria-label":f?"退出终端全屏":"终端全屏",title:f?"退出终端全屏":"终端全屏",children:f?r.jsx(jk,{}):r.jsx(Sk,{})}):null]}),g?r.jsxs(r.Fragment,{children:[l?r.jsx("div",{className:"session-terminal-panel__notice is-error",children:l}):null,x!=null&&x.error?r.jsx("div",{className:"session-terminal-panel__notice is-error",children:x.error}):null,x!=null&&x.truncated?r.jsx("div",{className:"session-terminal-panel__notice",children:"终端输出过长,已自动显示服务端仍保留的最近内容。"}):null,r.jsx("div",{ref:S,className:"session-terminal-panel__output-wrap",children:r.jsx("pre",{className:"session-terminal-output",children:x&&x.chunks.length>0?r.jsx(_v,{chunks:x.chunks}):x!=null&&x.isLoading?r.jsx("span",{className:"session-terminal-output__placeholder",children:"正在读取终端输出..."}):r.jsx("span",{className:"session-terminal-output__placeholder",children:"这个终端暂时还没有输出。"})})})]}):null]})},Ek=_.memo(function({conversationMainRef:t,conversationScrollRef:a,isDesktopSidebar:l,sidebarShift:c,isSidebarDragging:u,title:f,titleActions:p,topbarActions:y,onOpenSidebar:m,threadContent:S,connectionStatus:g,sessionRecoveryStatus:x,isConnectionDetailOpen:j,onToggleConnectionDetail:k,showThinkingStatus:E}){const N={transform:`translateX(${c}px)`,transition:u?"none":void 0};return r.jsxs("div",{ref:t,className:`conversation-main ${l?"has-desktop-sidebar":""}`,style:N,children:[r.jsxs("div",{className:"conversation-topbar",children:[l?null:r.jsxs("button",{type:"button",className:"conversation-menu",onClick:m,"aria-label":"打开侧边栏",children:[r.jsx("span",{}),r.jsx("span",{className:"short"})]}),r.jsx("div",{className:"conversation-topbar__meta",children:r.jsxs("div",{className:"conversation-topbar__title-row",children:[r.jsx("h1",{children:f}),p]})}),y]}),r.jsx("div",{ref:a,className:"conversation-scroll",children:r.jsxs("div",{className:"conversation-thread",children:[S,g.state!=="connected"?r.jsx("section",{className:"conversation-entry is-connection-status",children:r.jsxs("div",{className:"connection-status",children:[r.jsx("button",{type:"button",className:"connection-status__pill",onClick:P=>{P.stopPropagation(),k()},children:r.jsx("span",{children:g.state==="failed"?"连接异常":`Reconnecting... ${g.attempt}/${g.maxAttempts}`})}),j&&g.error?r.jsx("div",{className:"connection-status__tooltip",role:"tooltip",children:g.error}):null]})}):null,g.state==="connected"&&x.state!=="idle"?r.jsx("section",{className:"conversation-entry is-connection-status",children:r.jsxs("div",{className:"connection-status",children:[r.jsx("div",{className:"connection-status__pill",children:r.jsx("span",{children:x.state==="recovering"?"恢复会话中...":"会话恢复失败"})}),x.state==="failed"&&x.error?r.jsx("div",{className:"connection-status__tooltip",role:"tooltip",children:x.error}):null]})}):null,E?r.jsx("section",{className:"conversation-entry is-thinking-status",children:r.jsx("div",{className:"thinking-status-pill",children:r.jsx("span",{children:"正在思考"})})}):null]})})]})}),Fy="panda:last-session-id",Tk=.4,Mk=104,Rk=1800*1e3,Ak=15e3,Dk=120*1e3,Qy=2e3,Ok=5e3,Lk=1500,Gy=1100,bv="panda:desktop-sidebar-width",Mu="panda:desktop-sidebar-width-version",Ru="2026-03-24-narrow",Ik=300,xv=232,Lo=xv,Pk=460,zk=72,Bk=4200,s1="local-model-panel:",Uk=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("circle",{cx:"6",cy:"12",r:"1",fill:"currentColor",stroke:"none"}),r.jsx("circle",{cx:"12",cy:"12",r:"1",fill:"currentColor",stroke:"none"}),r.jsx("circle",{cx:"18",cy:"12",r:"1",fill:"currentColor",stroke:"none"})]}),$k=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("rect",{x:"9",y:"9",width:"10",height:"10",rx:"2"}),r.jsx("path",{d:"M7 15H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h7a2 2 0 0 1 2 2v1"})]}),Hk=()=>r.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:r.jsx("path",{d:"m7.5 12.5 3 3 6-7"})}),qk=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M6 6l12 12"}),r.jsx("path",{d:"M18 6 6 18"})]}),Fk=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"m9 18-6-6 6-6"}),r.jsx("path",{d:"m15 6 6 6-6 6"})]}),Qk=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("circle",{cx:"6",cy:"6",r:"2.2"}),r.jsx("circle",{cx:"18",cy:"6",r:"2.2"}),r.jsx("circle",{cx:"12",cy:"18",r:"2.2"}),r.jsx("path",{d:"M8 7.6 10.5 16"}),r.jsx("path",{d:"M16 7.6 13.5 16"}),r.jsx("path",{d:"M8.2 6h7.6"})]}),Gk=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2.5"}),r.jsx("path",{d:"m7.5 9 2.8 3-2.8 3"}),r.jsx("path",{d:"M12.8 15H16.5"})]}),Wk=()=>r.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.1",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:r.jsx("path",{d:"M7 5.5 18 12 7 18.5Z"})}),Yk=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("circle",{cx:"12",cy:"12",r:"8.4"}),r.jsx("path",{d:"M3.8 12h16.4"}),r.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"})]}),Wy=(n,t)=>{const a=new Map;for(const l of n)a.set(l.cursor,l);for(const l of t)a.set(l.cursor,l);return[...a.values()].sort((l,c)=>l.cursor-c.cursor)},Vk=800,z0=(n,t,a)=>{const l=n.get(t);if(l!==void 0)return n.delete(t),n.set(t,l),l;const c=a();if(n.set(t,c),n.size>Vk){const u=n.keys().next().value;u&&n.delete(u)}return c},Kk=new Map,Zk=new Map,Xk=new Map,F1=()=>K1(()=>import("./session-diff-preview-BEUxjpKW.js"),[]),Jk=_.lazy(async()=>({default:(await F1()).SessionDiffPreview})),eN=/<proposed_plan>([\s\S]*?)<\/proposed_plan>/g,tN=n=>z0(Kk,n,()=>hv(n)),Q1=n=>n.replace(/\\/g,"/"),nN=n=>{var a;const t=/^\/([A-Za-z][A-Za-z0-9._-]*)/.exec(n.trim());return((a=t==null?void 0:t[1])==null?void 0:a.toLowerCase())??""},sN=n=>n.kind==="system"&&n.title==="context_compacted",Yy=n=>n>=1e3?`${Math.round(n/1e3)}k`:String(Math.round(n)),aN=n=>z0(Zk,n,()=>{const t=n.replace(/\r\n/g,`
126
+ `).split(`
127
+ `),a=[];let l=[],c=null;const u=()=>{l.length!==0&&(a.push({kind:"paragraph",lines:[...l]}),l=[])},f=()=>{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),S=/^\s*(\d+)\.\s+(.+)$/.exec(p);if(y){u(),f(),a.push({kind:"heading",level:y[1].length,text:y[2].replace(/\s+#+\s*$/,"").trim()});continue}if(m||S){u();const g=!!S,x=((S==null?void 0:S[2])??(m==null?void 0:m[2])??"").trim();(!c||c.ordered!==g)&&(f(),c={ordered:g,items:[]}),c.items.push(x);continue}if(!p.trim()){u(),f();continue}f(),l.push(p)}return u(),f(),a}),iN=n=>z0(Xk,n,()=>{const t=[];let a=0;n.replace(eN,(c,u,f)=>{const p=n.slice(a,f);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=f+c.length,c});const l=n.slice(a);return l.trim()&&t.push({kind:"markdown",content:l.trim()}),t.length===0&&n.trim()&&t.push({kind:"markdown",content:n.trim()}),t}),rN=n=>{const t=n.files.filter(a=>!!a.item_id);return t.length>0?t:n.files.filter(a=>!a.item_id)},lN=(n,t)=>{const a=n.files.filter(c=>!c.item_id);if(a.length>0)return a.map(c=>({path:c.path,pathLabel:Gr(c.path,t),additions:c.additions,deletions:c.deletions,diff:c.diff,emptyMessage:"此变更没有可展示的补丁内容"}));const l=new Map;for(const c of n.files)l.set(c.path,c);return[...l.values()].map(c=>({path:c.path,pathLabel:Gr(c.path,t),additions:c.additions,deletions:c.deletions,diff:c.diff,emptyMessage:"此变更没有可展示的补丁内容"}))},oN=n=>`${n} background agent${n===1?"":"s"}`,cN=n=>n.startsWith("Reconnecting...")?"retrying":"error",uN=n=>n.startsWith("Reconnecting...")?"Codex 重连中":"Codex 运行异常",Vy=n=>{const t=n.trim();if(!t)return null;try{return JSON.parse(t)}catch{return null}},a1=(n,t)=>{const a=n==null?void 0:n[t];return typeof a=="string"&&a.trim()?a.trim():null},dN=n=>{const t=Q1(n).replace(/\/+$/,""),a=t.split("/");return a[a.length-1]||t},Ky=n=>`${n.kind}\0${n.title}\0${n.body}\0${n.accent}`,fN=(n,t)=>{if(!t||t.length===0||n.length===0)return n;let a=0;for(;a<n.length&&a<t.length&&Ky(n[a])===Ky(t[a]);)a+=1;return a<=0||a>=n.length?n:n.slice(a)},hN=n=>{const t=n.trim();if(!t.startsWith("<subagent_notification>"))return null;const a=t.indexOf("{");if(a<0)return null;const l=t.lastIndexOf("}");if(l<=a)return null;try{const c=JSON.parse(t.slice(a,l+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 f=c.status&&typeof c.status=="object"?c.status:null,p=u(f==null?void 0:f.completed),y=u(f==null?void 0:f.errored),m=u(f==null?void 0:f.working),S=u(f==null?void 0:f.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(S)return{agentId:typeof c.agent_id=="string"?c.agent_id:null,body:S||"子代理已关闭",state:"shutdown"}}catch{return null}return null},i1=["#2f72d8","#d06a3b","#2d9b7f","#8c62d9","#bf5b7f","#b78b2d"],Sv=n=>{const t=(n??"").trim();if(!t)return i1[0];let a=0;for(let l=0;l<t.length;l+=1)a=a*31+t.charCodeAt(l)>>>0;return i1[a%i1.length]},mN=n=>{var t;return Sv(((t=n.subagent)==null?void 0:t.nickname)??n.title??n.id)},jv=n=>{let t=-1,a=-1;return n.forEach((l,c)=>{if(!(l.kind!=="system"||l.title!=="status")){if(l.body==="开始处理请求"){t=c;return}l.body==="处理完成"&&(a=c)}}),t>a?t:-1},pN=n=>{var a;const t=jv(n);return t<0?null:((a=n[t])==null?void 0:a.timestamp)??null},gN=n=>{const t=jv(n);if(t<0)return new Set;const a=[],l=new Set;for(const c of n.slice(t)){if(c.kind!=="tool")continue;if(c.title!=="tool-output"){if(a.push({name:c.title}),c.title==="close_agent"){const f=Vy(c.body),p=a1(f,"id");p&&l.delete(p)}continue}const u=a.shift()??null;if((u==null?void 0:u.name)==="spawn_agent"){const f=Vy(c.body),p=a1(f,"agent_id")??a1(f,"id");p&&l.add(p)}}return l},yN=n=>n.run_state==="running"?"is working":n.run_state==="completed"?"completed":"is awaiting instruction",vN=(n,t)=>{const a=+new Date(t);return Number.isFinite(a)?n.some(l=>{if(l.source!=="app-server")return!1;const c=+new Date(l.updated_at);return Number.isFinite(c)&&Math.abs(c-a)<=1e4}):!1},_N=(n,t)=>{if(!n)return"已处理";const a=Math.max(0,new Date(t).getTime()-new Date(n).getTime()),l=Math.max(0,Math.round(a/1e3)),c=Math.floor(l/60),u=l%60;return c<=0?`已处理 ${u}s`:`已处理 ${c}m ${u}s`},Gr=(n,t)=>{const a=Q1(n),l=t?Q1(t).replace(/\/+$/,""):"";return l&&a.toLowerCase().startsWith(`${l.toLowerCase()}/`)?a.slice(l.length+1):a},bN=(n,t)=>{const a=n.split(/\r?\n/),l=[];let c=null,u=[];const f=()=>{c&&(l.push({...c,diffText:u.join(`
128
+ `).trim()}),c=null,u=[])};for(const p of a){const y=p.replace(/\r$/,""),m=y.trimStart();if(y.startsWith("*** Add File: ")){f();const S=y.slice(14).trim();c={path:S,displayPath:Gr(S,t),operation:"add",additions:0,deletions:0,diffText:""};continue}if(y.startsWith("*** Update File: ")){f();const S=y.slice(17).trim();c={path:S,displayPath:Gr(S,t),operation:"update",additions:0,deletions:0,diffText:""};continue}if(y.startsWith("*** Delete File: ")){f();const S=y.slice(17).trim();c={path:S,displayPath:Gr(S,t),operation:"delete",additions:0,deletions:0,diffText:""};continue}if(c){if(y.startsWith("*** End Patch")){f();continue}if(y.startsWith("*** ")){f();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 f(),l.length===0?null:{files:l,additions:l.reduce((p,y)=>p+y.additions,0),deletions:l.reduce((p,y)=>p+y.deletions,0)}},xN=n=>{if(n.length===0)return null;const t=new Map;for(const l of n)for(const c of l.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(`
129
+ `),u.operation=c.operation}const a=[...t.values()];return{files:a,additions:a.reduce((l,c)=>l+c.additions,0),deletions:a.reduce((l,c)=>l+c.deletions,0)}},Of=(n,t=Mk)=>{const a=n.replace(/\s+/g," ").trim();return a.length<=t?a:`${a.slice(0,t-1).trimEnd()}…`},B0=n=>{try{return JSON.parse(n)}catch{return null}},SN=n=>{const t=B0(n.body);if(t){const a=["command","cmd","path","pattern","q","input"];for(const l of a){const c=t[l];if(typeof c=="string"&&c.trim())return Of(c)}}return n.title&&n.title!=="tool-output"?n.body.trim().startsWith("{")||n.body.trim().startsWith("[")?Of(n.title.replace(/-/g," ")):Of(n.body||n.title):Of(n.body||"工具执行")},jN=n=>{if(n.title==="apply_patch")return n.body.trim();const t=B0(n.body);return t&&typeof t.command=="string"&&t.command.trim()?t.command.trim():n.body.trim()||n.title},wN=n=>n.map(t=>{const a=B0(t.body);return a&&typeof a.output=="string"?a.output.trim():t.body.trim()}).filter(Boolean).join(`
130
+
131
+ `),kN=n=>n.kind==="entry"&&n.entry.kind==="user",wv=n=>n.kind==="entry"&&n.entry.kind==="assistant",NN=n=>kN(n)||wv(n),CN=n=>n.kind==="tool-group"?!0:n.entry.kind==="assistant"||n.entry.kind==="thinking"||n.entry.kind==="tool",EN=n=>{if(n.length<=1)return n;const t=[];for(const a of n){const l=t[t.length-1];if(l&&l.kind==="entry"&&a.kind==="entry"&&l.entry.kind==="assistant"&&a.entry.kind==="assistant"&&l.entry.body.trim()===a.entry.body.trim()){t[t.length-1]=a;continue}t.push(a)}return t},TN=n=>{let t=0,a=0,l=0;for(const c of n){if(c.kind==="tool-group"){t+=1;continue}if(c.entry.kind==="thinking"){a+=1;continue}c.entry.kind==="system"&&(l+=1)}return{totalCount:n.length,commandCount:t,thinkingCount:a,systemCount:l}},MN=n=>{const t=TN(n),a=[];return t.commandCount>0&&a.push(`${t.commandCount} 条命令`),t.thinkingCount>0&&a.push(`${t.thinkingCount} 条思考`),t.systemCount>0&&a.push(`${t.systemCount} 条系统消息`),a.length>0?`展开 ${t.totalCount} 条过程消息(${a.join(",")})`:`展开 ${t.totalCount} 条过程消息`},RN=n=>`收起 ${n.length} 条过程消息`,AN=(n,t)=>{const a=EN(n.items),{completion:l}=n,c=a.findLastIndex(p=>wv(p));if(c===-1||!l||!t)return{id:n.id,startedAt:n.startedAt,visibleStartItems:c===-1?a:a.slice(0,c),hiddenItems:[],visibleEndItems:c===-1?[]:a.slice(c),completion:l};const u=[],f=[];return a.forEach((p,y)=>{if(y!==c){if(NN(p)){u.push(p);return}f.push(p)}}),{id:n.id,startedAt:n.startedAt,visibleStartItems:u,hiddenItems:f,visibleEndItems:[a[c]],completion:l}},DN=(n,t)=>{const a=[];let l=[],c=null;const u=()=>{for(const p of l)a.push({kind:"item",id:p.kind==="entry"?p.entry.id:p.group.id,item:p});l=[]},f=()=>{c&&((c.items.length>0||c.completion)&&a.push({kind:"turn",turn:AN(c,t)}),c=null)};for(const p of n){if(p.kind==="turn-start"){f(),c={id:p.id,startedAt:p.startedAt,items:l,completion:null},l=[];continue}if(p.kind==="turn-complete"){if(c){c.completion=p;continue}c={id:p.id,startedAt:null,items:l,completion:p},l=[];continue}if(c){if(c.completion&&!CN(p)){f(),l.push(p);continue}c.items.push(p);continue}l.push(p)}return f(),u(),a},ON=n=>n.run_state!=="running"&&Date.now()-new Date(n.last_event_at).getTime()>=Rk,LN=(n,t)=>{var m,S;const a=t==null?void 0:t.projectPath,l=(t==null?void 0:t.compactCompletedTurns)??!1,c=[];let u=null,f=!1,p=null,y=[];for(let g=0;g<n.length;g+=1){const x=n[g];if(x.kind==="system"&&x.body==="开始处理请求"){c.push({kind:"turn-start",id:x.id,startedAt:x.timestamp}),p=x.timestamp,y=[];continue}if(x.kind==="system"&&x.body==="处理完成"){c.push({kind:"turn-complete",id:x.id,durationLabel:_N(p,x.timestamp),patchSummary:xN(y),completedAt:x.timestamp}),p=null,y=[];continue}if(x.kind==="tool"&&x.title!=="tool-output"){const j=[];let k=g+1;for(;k<n.length&&((m=n[k])==null?void 0:m.kind)==="tool"&&((S=n[k])==null?void 0:S.title)==="tool-output";)j.push(n[k]),k+=1;u=x.id;const E=x.title==="apply_patch"?bN(x.body,a):null;E&&y.push(E),j.length===0&&(f=!0),c.push({kind:"tool-group",group:{id:x.id,commandEntry:x,outputEntries:j,patchSummary:E}}),g=k-1;continue}if(x.kind==="tool"&&x.title==="tool-output"){c.push({kind:"tool-group",group:{id:x.id,commandEntry:x,outputEntries:[],patchSummary:null}}),u=x.id;continue}c.push({kind:"entry",entry:x})}return{blocks:DN(c,l),lastToolGroupId:u,hasRunningToolGroup:f}},IN=n=>n.kind==="entry"?n.entry.timestamp:n.group.commandEntry.timestamp,PN=(n,t)=>{var f,p;const a=[...n.visibleStartItems,...n.hiddenItems,...n.visibleEndItems].map(IN).filter(y=>!!y),l=a.length>0?a[a.length-1]:null,c=n.startedAt??a[0]??((f=n.completion)==null?void 0:f.completedAt)??null,u=((p=n.completion)==null?void 0:p.completedAt)??l??c;return{startMs:c?+new Date(c):null,endMs:u?+new Date(u):null,nextStartMs:t!=null&&t.startedAt?+new Date(t.startedAt):null}},zN=(n,t)=>{const a=[...t].sort((f,p)=>+new Date(f.started_at)-+new Date(p.started_at)),l=new Set,c=n.filter(f=>f.kind==="turn"),u=new Map(c.map((f,p)=>[f.turn.id,p]));return n.map(f=>{var k;if(f.kind!=="turn")return f;const p=u.get(f.turn.id)??-1,y=p>=0?((k=c[p+1])==null?void 0:k.turn)??null:null,m=PN(f.turn,y),S=m.startMs??(m.endMs!==null?m.endMs-1200:null),g=m.nextStartMs??(m.endMs!==null?m.endMs+1200:Number.POSITIVE_INFINITY),x=a.find(E=>{if(l.has(E.id))return!1;const N=+new Date(E.started_at),P=E.completed_at?+new Date(E.completed_at):null;return S!==null&&N<S-1200?!1:N<=g+1200||P!==null&&P<=g+1200})??null;return x&&l.add(x.id),{kind:"turn",turn:f.turn,changeSet:x}})},BN=()=>typeof window>"u"?248:Math.max(0,Math.min(248,window.innerWidth-84)),G1=n=>Math.max(xv,Math.min(Pk,n)),UN=()=>{if(typeof window>"u")return Lo;try{const n=window.localStorage.getItem(bv),t=window.localStorage.getItem(Mu);if(!n)return window.localStorage.setItem(Mu,Ru),Lo;const a=Number(n);if(!Number.isFinite(a))return window.localStorage.setItem(Mu,Ru),Lo;const c=t!==Ru||a===Ik||a>Lo?Lo:a;return window.localStorage.setItem(Mu,Ru),G1(c)}catch{return Lo}};function Lf({active:n,render:t,fallback:a=null}){const[l,c]=_.useState(!n);return _.useEffect(()=>{if(!n){c(!1);return}c(!1);const u=window.requestAnimationFrame(()=>{c(!0)});return()=>{window.cancelAnimationFrame(u)}},[n]),n?l?r.jsx(r.Fragment,{children:t()}):r.jsx(r.Fragment,{children:a}):null}const $N=_.memo(function({sessions:t,sessionRunState:a,projectPath:l,renderedBlocks:c,lastToolGroupId:u,sessionChangeSets:f,isSubagentTimelinePending:p,hasTimeline:y,proposedPlanReplyDrafts:m,pendingProposedPlanReplyEntryId:S,canRespondToProposedPlan:g,onProposedPlanReplyDraftChange:x,onSubmitProposedPlanReply:j,onPreviewImage:k}){const[E,N]=_.useState({}),[P,H]=_.useState({}),[U,R]=_.useState({}),[q,re]=_.useState(null),[V,ee]=_.useState(null),Z=_.useRef(null);_.useEffect(()=>{const ie=z=>{const we=z.target;we instanceof Element&&we.closest(".conversation-inline-link")||re(null)};return window.addEventListener("pointerdown",ie),()=>{window.removeEventListener("pointerdown",ie)}},[]),_.useEffect(()=>()=>{Z.current!==null&&window.clearTimeout(Z.current)},[]);const W=ie=>{N(z=>({...z,[ie]:!z[ie]}))},F=ie=>{H(z=>({...z,[ie]:!z[ie]}))},be=ie=>{R(z=>({...z,[ie]:!z[ie]}))},pe=async(ie,z)=>{var _e;const we=z.trim();if(!we)return;const ke=()=>{const Me=document.createElement("textarea");Me.value=we,Me.setAttribute("readonly","true"),Me.style.position="fixed",Me.style.opacity="0",Me.style.pointerEvents="none",document.body.appendChild(Me),Me.select(),document.execCommand("copy"),document.body.removeChild(Me)};try{(_e=navigator.clipboard)!=null&&_e.writeText?await navigator.clipboard.writeText(we):ke(),ee(ie),Z.current!==null&&window.clearTimeout(Z.current),Z.current=window.setTimeout(()=>{ee(Me=>Me===ie?null:Me),Z.current=null},1400)}catch{}};function Y(ie,z,we){return r.jsx(_.Suspense,{fallback:r.jsx("div",{className:"patch-file-card__empty",children:"正在载入差异详情…"}),children:r.jsx(Jk,{diffText:ie,filePath:z,emptyMessage:we})})}function ne(ie,z,we){const ke=q===we;return r.jsxs("span",{className:`conversation-inline-link ${ke?"is-active":""}`,children:[r.jsx("button",{type:"button",className:"conversation-inline-link__button",onClick:_e=>{_e.stopPropagation(),re(Me=>Me===we?null:we)},children:ie}),ke?r.jsx("span",{className:"conversation-inline-link__tooltip",role:"tooltip",children:z}):null]},we)}function T(ie,z,we=Gr(ie,l)){return ne(dN(we),we,z)}function $(ie,z){return tN(ie).map((ke,_e)=>{const Me=`${z}-${_e}`;return ke.kind==="text"?r.jsx("span",{children:ke.value},Me):ke.kind==="code"?r.jsx("code",{className:"conversation-inline-code",children:ke.value},Me):ke.kind==="strong"?r.jsx("strong",{children:$(ke.value,`${Me}-strong`)},Me):ke.kind==="emphasis"?r.jsx("em",{children:$(ke.value,`${Me}-emphasis`)},Me):ke.kind==="skill"?r.jsx("span",{className:"conversation-skill-token",children:ke.raw},Me):ke.kind==="command"?r.jsx("span",{className:"conversation-command-token",children:ke.raw},Me):ne(ke.label,ke.path,Me)})}function ue(ie,z){return aN(ie).map((ke,_e)=>{const Me=`${z}-block-${_e}`;if(ke.kind==="heading"){const Ge=Math.min(ke.level,3),at=Ge===1?"h1":Ge===2?"h2":"h3";return r.jsx(at,{className:`conversation-markdown-heading is-level-${Ge}`,children:$(ke.text,`${Me}-heading`)},Me)}if(ke.kind==="list"){const Ge=ke.ordered?"ol":"ul";return r.jsx(Ge,{className:"conversation-markdown-list",children:ke.items.map((at,ht)=>r.jsx("li",{children:$(at,`${Me}-item-${ht}`)},`${Me}-item-${ht}`))},Me)}return r.jsx("p",{className:"conversation-markdown-paragraph",children:ke.lines.map((Ge,at)=>r.jsxs("span",{children:[at>0?r.jsx("br",{}):null,$(Ge,`${Me}-line-${at}`)]},`${Me}-line-${at}`))},Me)})}function de(ie,z,we){const ke=`${ie.id}:proposed-plan:${we}`,_e=m[ke]??"",Me=S===ke,Ge=!g||Me;return r.jsxs("div",{className:"proposed-plan-card",children:[r.jsx("div",{className:"proposed-plan-card__content",children:ue(z,`${ke}:content`)}),r.jsxs("div",{className:"proposed-plan-card__footer",children:[r.jsx("div",{className:"proposed-plan-card__title",children:"实施此计划?"}),r.jsxs("div",{className:"proposed-plan-card__actions",children:[r.jsx("button",{type:"button",className:"proposed-plan-card__confirm",disabled:Ge,onClick:()=>{j(ke,"是,实施此计划")},children:Me?"回复中…":"是,实施此计划"}),r.jsxs("div",{className:"proposed-plan-card__custom",children:[r.jsx("input",{type:"text",className:"proposed-plan-card__input",value:_e,disabled:Ge,placeholder:"否,请告知如何调整",onChange:at=>{x(ke,at.target.value)},onKeyDown:at=>{at.key!=="Enter"||!_e.trim()||Ge||(at.preventDefault(),j(ke,_e))}}),r.jsx("button",{type:"button",className:"proposed-plan-card__submit",disabled:Ge||!_e.trim(),onClick:()=>{j(ke,_e)},children:Me?"回复中…":"回复"})]})]})]})]},ke)}function ve(ie){const z=iN(ie.body);return z.some(ke=>ke.kind==="proposed-plan")?z.map((ke,_e)=>{const Me=`${ie.id}-content-${_e}`;return ke.kind==="markdown"?r.jsx("div",{className:"conversation-entry__rich-block",children:ue(ke.content,Me)},Me):de(ie,ke.content,_e)}):ue(ie.body,ie.id)}function A(ie){const z=p3([],ie.attachments);if(z.length===0)return null;const we=z.filter(by),ke=z.filter(_e=>!by(_e));return r.jsxs("div",{className:"conversation-entry__attachments",children:[we.length>0?r.jsx("div",{className:"conversation-entry__attachment-grid",children:we.map(_e=>{const Me=$1(_e.size_bytes),Ge=_e.name??"图片",at=`图片${Me?` · ${Me}`:""}`,ht=r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"conversation-entry__attachment-media",children:_e.content_url?r.jsxs(r.Fragment,{children:[r.jsx("img",{src:_e.content_url,alt:Ge,loading:"lazy"}),r.jsx("span",{className:"conversation-entry__attachment-badge",children:"预览"})]}):r.jsx("div",{className:"conversation-entry__attachment-fallback",children:"无法预览"})}),r.jsxs("div",{className:"conversation-entry__attachment-caption",children:[r.jsx("span",{className:"conversation-entry__attachment-title",children:Ge}),r.jsx("span",{className:"conversation-entry__attachment-meta",children:at})]})]});return _e.content_url?r.jsx("button",{type:"button",className:"conversation-entry__attachment-card is-image",onClick:()=>k({src:_e.content_url,label:Ge,meta:at}),"aria-label":`预览 ${Ge}`,children:ht},`${ie.id}:${_e.id}`):r.jsx("div",{className:"conversation-entry__attachment-card is-image",children:ht},`${ie.id}:${_e.id}`)})}):null,ke.length>0?r.jsx("div",{className:"conversation-entry__file-list",children:ke.map(_e=>{const Me=$1(_e.size_bytes),Ge=r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"conversation-entry__file-icon","aria-hidden":"true",children:r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8Z"}),r.jsx("path",{d:"M14 3v5h5"}),r.jsx("path",{d:"M9 13h6"}),r.jsx("path",{d:"M9 17h4"})]})}),r.jsxs("span",{className:"conversation-entry__file-copy",children:[r.jsx("span",{className:"conversation-entry__file-title",children:_e.name??"附件"}),r.jsxs("span",{className:"conversation-entry__file-meta",children:["文件",Me?` · ${Me}`:""]})]})]});return _e.content_url?r.jsx("a",{className:"conversation-entry__file-card",href:_e.content_url,download:_e.name??void 0,target:"_blank",rel:"noreferrer",children:Ge},`${ie.id}:${_e.id}`):r.jsx("div",{className:"conversation-entry__file-card",children:Ge},`${ie.id}:${_e.id}`)})}):null]})}function te(ie,z){return r.jsx("div",{className:"turn-patch-summary__files",children:z.map(we=>{const ke=`${ie}:${we.path}`,_e=!!U[ke];return r.jsxs("div",{className:`turn-patch-file ${_e?"is-expanded":""}`,children:[r.jsxs("button",{type:"button",className:"turn-patch-file__toggle",onClick:()=>be(ke),"aria-expanded":_e,children:[r.jsx("div",{className:"turn-patch-file__path",children:we.pathLabel}),r.jsxs("div",{className:"turn-patch-file__meta",children:[r.jsxs("span",{className:"turn-patch-summary__counts",children:[r.jsxs("span",{className:"is-add",children:["+",we.additions]}),r.jsxs("span",{className:"is-remove",children:["-",we.deletions]})]}),r.jsx("span",{className:"turn-patch-file__chevron","aria-hidden":"true",children:r.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"m9 6 6 6-6 6"})})})]})]}),_e?r.jsx("div",{className:"turn-patch-file__detail",children:r.jsx(Lf,{active:_e,fallback:r.jsx("div",{className:"patch-file-card__empty",children:"正在展开差异…"}),render:()=>Y(we.diff,we.path,we.emptyMessage)})}):null]},ke)})})}function je(ie){return rN(ie).map(z=>{const we=`live:${ie.id}:${z.item_id??"summary"}:${z.path}`,ke=!!U[we],_e=ie.status==="running";return r.jsx("section",{className:"conversation-entry is-tool-group",children:r.jsxs("div",{className:`tool-entry ${_e?"is-running":"is-complete"} ${ke?"is-expanded":""} is-patch`,children:[r.jsxs("button",{type:"button",className:"tool-entry__toggle",onClick:()=>be(we),"aria-expanded":ke,children:[r.jsxs("div",{className:"tool-entry__summary",children:[r.jsx("span",{className:"tool-entry__status",children:"已编辑"}),r.jsx("span",{className:"tool-entry__command",children:T(z.path,`${we}:live-link`,Gr(z.path,l))}),r.jsxs("span",{className:"tool-entry__counts",children:[r.jsxs("span",{className:"is-add",children:["+",z.additions]}),r.jsxs("span",{className:"is-remove",children:["-",z.deletions]})]})]}),r.jsx("span",{className:"tool-entry__chevron","aria-hidden":"true",children:r.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"m9 6 6 6-6 6"})})})]}),ke?r.jsx("div",{className:"tool-entry__details",children:r.jsx(Lf,{active:ke,fallback:r.jsx("div",{className:"patch-file-card__empty",children:"正在展开详情…"}),render:()=>r.jsx("div",{className:"tool-entry__patch-list",children:r.jsxs("div",{className:"patch-file-card",children:[r.jsxs("div",{className:"patch-file-card__header",children:[r.jsx("div",{className:"patch-file-card__path",children:Gr(z.path,l)}),r.jsxs("div",{className:"patch-file-card__counts",children:[r.jsxs("span",{className:"is-add",children:["+",z.additions]}),r.jsxs("span",{className:"is-remove",children:["-",z.deletions]})]})]}),r.jsx("div",{className:"patch-file-card__diff",children:Y(z.diff,z.path,"此变更还没有可展示的补丁内容")})]})})})}):null]})},we)})}function Se(ie){const z=lN(ie,l),we=z.reduce((_e,Me)=>_e+Me.additions,0),ke=z.reduce((_e,Me)=>_e+Me.deletions,0);return r.jsxs("div",{className:"turn-patch-summary",children:[r.jsx("div",{className:"turn-patch-summary__header",children:r.jsxs("div",{className:"turn-patch-summary__title",children:[r.jsxs("span",{children:[z.length," 个文件已更改"]}),r.jsxs("span",{className:"turn-patch-summary__counts",children:[r.jsxs("span",{className:"is-add",children:["+",we]}),r.jsxs("span",{className:"is-remove",children:["-",ke]})]})]})}),te(`summary:${ie.id}`,z)]})}function Re(ie,z){return r.jsxs("div",{className:"turn-patch-summary",children:[r.jsx("div",{className:"turn-patch-summary__header",children:r.jsxs("div",{className:"turn-patch-summary__title",children:[r.jsxs("span",{children:[z.files.length," 个文件已更改"]}),r.jsxs("span",{className:"turn-patch-summary__counts",children:[r.jsxs("span",{className:"is-add",children:["+",z.additions]}),r.jsxs("span",{className:"is-remove",children:["-",z.deletions]})]})]})}),te(ie,z.files.map(we=>({path:we.path,pathLabel:we.displayPath,additions:we.additions,deletions:we.deletions,diff:we.diffText,emptyMessage:"此变更没有可展示的补丁内容"})))]})}function oe(ie,z){var Bt,Ut;const we=z.agentId?t.find(Ze=>Ze.id===z.agentId)??null:null,ke=Sv(((Bt=we==null?void 0:we.subagent)==null?void 0:Bt.nickname)??(we==null?void 0:we.title)??z.agentId),_e=`subagent:${ie.id}`,Me=!!E[_e],Ge=z.state==="working",at=z.state==="completed"?"子代理返回":z.state==="shutdown"?"子代理已关闭":z.state==="errored"?"子代理异常":"子代理处理中",ht=((Ut=we==null?void 0:we.subagent)==null?void 0:Ut.nickname)??(we==null?void 0:we.title)??"子代理";return r.jsx("section",{className:"conversation-entry is-tool-group",children:r.jsxs("div",{className:`tool-entry is-subagent ${Ge?"is-running":"is-complete"} ${Me?"is-expanded":""}`,style:{"--subagent-accent":ke},children:[r.jsxs("button",{type:"button",className:"tool-entry__toggle",onClick:()=>W(_e),"aria-expanded":Me,children:[r.jsxs("div",{className:"tool-entry__summary",children:[r.jsx("span",{className:"tool-entry__status",children:at}),r.jsx("span",{className:"tool-entry__command tool-entry__command--agent",children:ht})]}),r.jsx("span",{className:"tool-entry__chevron","aria-hidden":"true",children:r.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"m9 6 6 6-6 6"})})})]}),Me?r.jsx("div",{className:"tool-entry__details",children:r.jsx(Lf,{active:Me,fallback:r.jsx("div",{className:"patch-file-card__empty",children:"正在展开详情…"}),render:()=>r.jsxs("div",{className:"tool-entry__section",children:[r.jsx("div",{className:"tool-entry__label",children:ht}),r.jsx("div",{className:"tool-entry__markdown",children:ue(z.body,`${ie.id}-subagent`)})]})})}):null]})},ie.id)}function Ne(ie){var ke;if(ie.kind==="tool-group"){const{group:_e}=ie;if(_e.commandEntry.title==="apply_patch"&&vN(f,_e.commandEntry.timestamp))return null;const Me=!!E[_e.id],Ge=a==="running"&&u===_e.id&&_e.outputEntries.length===0,at=_e.commandEntry.title==="apply_patch"&&!!_e.patchSummary,ht=at?_e.patchSummary.files.length===1?_e.patchSummary.files[0].displayPath:`${_e.patchSummary.files.length} 个文件`:SN(_e.commandEntry),Bt=jN(_e.commandEntry),Ut=wN(_e.outputEntries);return r.jsx("section",{className:"conversation-entry is-tool-group",children:r.jsxs("div",{className:`tool-entry ${Ge?"is-running":"is-complete"} ${Me?"is-expanded":""} ${at?"is-patch":""}`,children:[r.jsxs("button",{type:"button",className:"tool-entry__toggle",onClick:()=>W(_e.id),"aria-expanded":Me,children:[r.jsxs("div",{className:"tool-entry__summary",children:[r.jsx("span",{className:"tool-entry__status",children:at?"已编辑":Ge?"正在执行":"已执行"}),r.jsx("span",{className:"tool-entry__command",children:at&&((ke=_e.patchSummary)==null?void 0:ke.files.length)===1?T(_e.patchSummary.files[0].path,`${_e.id}:patch-link`,_e.patchSummary.files[0].displayPath):ht}),at&&_e.patchSummary?r.jsxs("span",{className:"tool-entry__counts",children:[r.jsxs("span",{className:"is-add",children:["+",_e.patchSummary.additions]}),r.jsxs("span",{className:"is-remove",children:["-",_e.patchSummary.deletions]})]}):null]}),r.jsx("span",{className:"tool-entry__chevron","aria-hidden":"true",children:r.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"m9 6 6 6-6 6"})})})]}),Me?r.jsx("div",{className:"tool-entry__details",children:r.jsx(Lf,{active:Me,fallback:r.jsx("div",{className:"patch-file-card__empty",children:"正在展开详情…"}),render:()=>at&&_e.patchSummary?r.jsx("div",{className:"tool-entry__patch-list",children:_e.patchSummary.files.map(Ze=>r.jsxs("div",{className:"patch-file-card",children:[r.jsxs("div",{className:"patch-file-card__header",children:[r.jsx("div",{className:"patch-file-card__path",children:Ze.displayPath}),r.jsxs("div",{className:"patch-file-card__counts",children:[r.jsxs("span",{className:"is-add",children:["+",Ze.additions]}),r.jsxs("span",{className:"is-remove",children:["-",Ze.deletions]})]})]}),r.jsx("div",{className:"patch-file-card__diff",children:Y(Ze.diffText,Ze.path,"此变更没有可展示的补丁内容")})]},`${_e.id}-${Ze.path}`))}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"tool-entry__section",children:[r.jsx("div",{className:"tool-entry__label",children:"命令"}),r.jsx("pre",{className:"tool-entry__pre",children:Bt})]}),Ut?r.jsxs("div",{className:"tool-entry__section",children:[r.jsx("div",{className:"tool-entry__label",children:"输出"}),r.jsx("pre",{className:"tool-entry__pre",children:Ut})]}):null]})})}):null]})},_e.id)}const z=ie.entry,we=z.kind==="user"?hN(z.body):null;if(we)return oe(z,we);if(z.kind==="thinking")return a!=="running"?null:r.jsx("section",{className:"conversation-entry is-thinking-status",children:r.jsx("div",{className:"thinking-status-pill",children:r.jsx("span",{children:"正在思考"})})},z.id);if(sN(z))return r.jsx("section",{className:"conversation-context-compact",children:r.jsx("div",{className:"context-compact-divider",children:r.jsx("span",{children:"背景信息已自动压缩"})})},z.id);if(z.kind==="system"&&z.title==="system_prompt")return null;if(z.kind==="system"&&z.title==="runtime-status"){const _e=cN(z.body);return r.jsx("section",{className:"conversation-entry is-runtime-status",children:r.jsxs("div",{className:`runtime-status-entry is-${_e}`,children:[r.jsx("div",{className:"runtime-status-entry__label",children:uN(z.body)}),r.jsx("pre",{className:"runtime-status-entry__body",children:z.body})]})},z.id)}return r.jsx("section",{className:`conversation-entry ${z.kind==="user"?"is-user":"is-system"} is-${z.kind}`,children:z.kind==="user"?r.jsxs("div",{className:"conversation-entry__stack",children:[r.jsxs("div",{className:"conversation-entry__body",children:[z.body.trim()?ue(z.body,z.id):null,z.attachments.length>0?A(z):null]}),z.body.trim()?r.jsxs("button",{type:"button",className:`conversation-entry__copy ${V===z.id?"is-copied":""}`,onClick:()=>{pe(z.id,z.body)},"aria-label":V===z.id?"已复制消息":"复制消息",children:[r.jsx("span",{className:"conversation-entry__copy-icon","aria-hidden":"true",children:V===z.id?r.jsx(Hk,{}):r.jsx($k,{})}),r.jsx("span",{className:"sr-only",children:V===z.id?"已复制":"复制"})]}):null]}):r.jsxs("div",{className:"conversation-entry__body",children:[z.body.trim()?z.kind==="assistant"?ve(z):ue(z.body,z.id):null,z.attachments.length>0?A(z):null]})},z.id)}return p?r.jsx("div",{className:"empty-panel",children:"正在载入子代理会话…"}):y?c.map(ie=>{var at;if(ie.kind==="item")return Ne(ie.item);const{turn:z}=ie,we=ie.changeSet,ke=((at=z.completion)==null?void 0:at.patchSummary)??null,_e=!!P[z.id],Me=z.hiddenItems.length>0&&!_e,Ge=_e?RN(z.hiddenItems):MN(z.hiddenItems);return r.jsxs("section",{className:"conversation-turn",children:[z.visibleStartItems.map(ht=>Ne(ht)),z.hiddenItems.length>0?r.jsxs("div",{className:"conversation-turn__history",children:[r.jsxs("button",{type:"button",className:`turn-history-toggle ${_e?"is-expanded":""}`,onClick:()=>F(z.id),"aria-expanded":_e,children:[r.jsx("span",{className:"turn-history-toggle__label",children:Ge}),r.jsx("span",{className:"turn-history-toggle__chevron","aria-hidden":"true",children:r.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"m9 6 6 6-6 6"})})})]}),Me?null:z.hiddenItems.map(ht=>Ne(ht))]}):null,z.completion&&z.visibleEndItems.length>0?r.jsx("section",{className:"conversation-turn-complete",children:r.jsx("div",{className:"turn-complete-divider",children:r.jsx("span",{children:z.completion.durationLabel})})}):null,z.visibleEndItems.map(ht=>Ne(ht)),we&&we.source==="app-server"&&we.files.length>0?je(we):null,z.completion&&z.visibleEndItems.length===0?r.jsx("section",{className:"conversation-turn-complete",children:r.jsx("div",{className:"turn-complete-divider",children:r.jsx("span",{children:z.completion.durationLabel})})}):null,we&&we.status==="completed"&&we.files.length>0?Se(we):ke?Re(`turn-summary:${z.id}`,ke):null]},z.id)}):r.jsx("div",{className:"empty-panel",children:"这个会话还没有历史记录。"})}),HN=({sessionId:n,embedded:t=!1,isDesktopSidebar:a,sidebarOffset:l=0,isSidebarDragging:c=!1,onOpenSidebar:u,onSelectSession:f,onExitToNodes:p}={})=>{var za,lo,Rc,oo,Ac,_s,ci,ui,ul,er,bs,xs,wa,Xs,Js;const{sessionId:y}=sd({strict:!1}),m=n??y??"",S=Zr(),g=Vr(),{data:x}=rd({queryKey:yt,scope:{sessionId:m}}),j=_.useRef(null),k=_.useRef(null),E=_.useRef(null),N=_.useRef(null),P=_.useRef(null),[H,U]=_.useState(!1),[R,q]=_.useState(()=>typeof window<"u"&&window.innerWidth>=Gy),[re,V]=_.useState(()=>UN()),[ee,Z]=_.useState(!1),[W,F]=_.useState(""),[be,pe]=_.useState([]),[Y,ne]=_.useState(null),[T,$]=_.useState(null),[ue,de]=_.useState(null),[ve,A]=_.useState(()=>D0()),[te,je]=_.useState(()=>iv()),[Se,Re]=_.useState(()=>yy(m)),[oe,Ne]=_.useState(()=>vy(m)),[ie,z]=_.useState(()=>_y(m)),we=L0(),ke=_.useMemo(()=>we.map(({id:b,...O})=>O),[we]),[_e,Me]=_.useState({}),[Ge,at]=_.useState(null),[ht,Bt]=_.useState(!1),[Ut,Ze]=_.useState(!1),[Zt,un]=_.useState(""),[fe,Ae]=_.useState(!1),[Ie,Ce]=_.useState(!1),[Fe,tt]=_.useState(null),[qe,rn]=_.useState(null),[vn,zn]=_.useState(!1),[as,Sn]=_.useState(!1),[ae,$e]=_.useState("code"),[De,We]=_.useState(!1),[nt,Xe]=_.useState(null),[At,nn]=_.useState(null),[Gn,gt]=_.useState(!1),[kn,Ee]=_.useState(!1),[Dt,Dn]=_.useState(!1),[Wn,Gs]=_.useState(!1),[Bi,ds]=_.useState(null),[ya,va]=_.useState(null),[xt,is]=_.useState({}),[Va,D]=_.useState(!1),[he,Oe]=_.useState({state:"connected",attempt:0,maxAttempts:5}),[Be,Ye]=_.useState({state:"idle"}),mt=_.useRef({});_.useEffect(()=>{Pu(ve)},[ve]),_.useEffect(()=>{rv(te)},[te]),_.useEffect(()=>{ke.length!==0&&(ke.some(b=>b.value===ve)||A(ke[0].value))},[ke,ve]),_.useEffect(()=>{Re(yy(m)),Ne(vy(m)),z(_y(m)),de(null),$e("code"),We(!1),Xe(null),nn(null),gt(!1),Ee(!1),Dn(!1),Gs(!1),ds(null),va(null),is({})},[m]),_.useEffect(()=>{mt.current=xt},[xt]),_.useEffect(()=>{lv(m,Se)},[Se,m]),_.useEffect(()=>{ov(m,oe)},[oe,m]),_.useEffect(()=>{cv(m,ie)},[ie,m]),_.useEffect(()=>{Me({}),at(null)},[m]),_.useEffect(()=>{if(!Y)return;const b=Q=>{Q.key==="Escape"&&ne(null)},O=document.body.style.overflow;return document.body.style.overflow="hidden",window.addEventListener("keydown",b),()=>{document.body.style.overflow=O,window.removeEventListener("keydown",b)}},[Y]);const[Ct,$t]=_.useState(!1),hn=_.useRef(null),mn=_.useRef(null),Nn=_.useRef(null),On=_.useRef({}),Cn=_.useRef({}),En=_.useRef(null),jn=_.useRef(null),C=_.useRef(0),ge=_.useRef(0),lt=_.useRef(null),ot=_.useRef(null),pt=_.useRef(null),Et=_.useRef(re),Yt=_.useRef(null),Tn=_.useRef(null),K=x==null?void 0:x.sessions.find(b=>b.id===m),pn=(x==null?void 0:x.agents.find(b=>b.id===(K==null?void 0:K.agent_id)))??(x==null?void 0:x.agents[0]),Bn=x==null?void 0:x.projects.find(b=>b.id===(K==null?void 0:K.project_id)),wn=(K==null?void 0:K.capability.can_show_git)??!1,Xt=(K==null?void 0:K.capability.can_show_terminal)??!1,qt=_.useCallback(()=>ss({sessionId:m,projectId:(K==null?void 0:K.project_id)??null,agentId:(K==null?void 0:K.agent_id)??null}),[K==null?void 0:K.agent_id,K==null?void 0:K.project_id,m]),_a=_.useCallback(async b=>{if(t){f==null||f(b);return}window.localStorage.setItem(Fy,b),await S({to:"/session/$sessionId",params:{sessionId:b}})},[t,S,f]),ba=_.useCallback(async()=>{if(t){p==null||p();return}await S({to:"/nodes"})},[t,S,p]),Ui=b=>b instanceof Element&&!!b.closest('button, textarea, input, a, [role="dialog"]'),Es=()=>{const b=E.current;if(!b)return;const O=()=>{b.scrollTo({top:b.scrollHeight,behavior:"auto"})};O(),window.requestAnimationFrame(()=>{O(),window.requestAnimationFrame(O)})},Gl=()=>{const b=E.current;if(!b){D(!1);return}const O=b.scrollHeight-b.scrollTop-b.clientHeight;D(O>zk)},rs=_.useMemo(()=>((x==null?void 0:x.projects)??[]).filter(b=>b.agent_id===(pn==null?void 0:pn.id)),[pn==null?void 0:pn.id,x==null?void 0:x.projects]),ra=_.useMemo(()=>((x==null?void 0:x.sessions)??[]).filter(b=>b.agent_id===(pn==null?void 0:pn.id)).sort((b,O)=>Number(O.pinned)-Number(b.pinned)||+new Date(O.last_event_at)-+new Date(b.last_event_at)),[pn==null?void 0:pn.id,x==null?void 0:x.sessions]),Ht=_.useMemo(()=>{var b;return(b=K==null?void 0:K.subagent)!=null&&b.parent_session_id?ra.find(O=>{var Q;return O.id===((Q=K.subagent)==null?void 0:Q.parent_session_id)})??null:null},[(za=K==null?void 0:K.subagent)==null?void 0:za.parent_session_id,ra]),xa=ks({queryKey:["timeline",m],enabled:!!m,queryFn:async()=>{const O=await(await qt()).client.getSessionTimeline(m);return g.setQueryData(ki(m),Q=>Tu(Q,O)),Ff(g.getQueryData(["timeline",m]),O)},initialData:m===(x==null?void 0:x.active_session_id)?x.timeline:void 0,refetchInterval:!1}),Sa=ks({queryKey:ki(m),enabled:!1,queryFn:async()=>[],initialData:[]}),Ka=ks({queryKey:["timeline",Ht==null?void 0:Ht.id,"prefix-source"],enabled:!!(Ht!=null&&Ht.id),queryFn:async()=>(await ss({sessionId:Ht.id,projectId:Ht.project_id,agentId:Ht.agent_id})).client.getSessionTimeline(Ht.id),refetchInterval:!1}),$i=_.useMemo(()=>K!=null&&K.subagent?new Set:gN(xa.data??[]),[K==null?void 0:K.subagent,xa.data]),Aa=_.useMemo(()=>pN(xa.data??[]),[xa.data]),pc=_.useMemo(()=>K!=null&&K.subagent?[]:ra.filter(b=>{var O;return b.id!==m&&((O=b.subagent)==null?void 0:O.parent_session_id)===m&&!b.archived}).filter(b=>{if(b.run_state==="running")return!0;if(!((K==null?void 0:K.run_state)==="running"||fe))return!1;if($i.has(b.id))return!0;if(!Aa)return!1;const O=new Date(Aa).getTime(),Q=new Date(b.last_event_at).getTime();return Number.isFinite(O)&&Number.isFinite(Q)&&Q>=O-Dk}).sort((b,O)=>+new Date(O.last_event_at)-+new Date(b.last_event_at)),[Aa,fe,$i,K==null?void 0:K.run_state,K==null?void 0:K.subagent,m,ra]),ud=ks({queryKey:["change-sets",m],enabled:!!m,queryFn:async()=>(await qt()).client.getSessionChangeSets(m),refetchInterval:!1}),Za=ks({queryKey:["session-git-workspace",m],enabled:!!(m&&wn&&ae==="git"),queryFn:async()=>(await qt()).client.getSessionGitWorkspace(m),refetchInterval:!1}),Ts=ks({queryKey:["session-git-history",m],enabled:!1,queryFn:async()=>(await qt()).client.getSessionGitHistory(m),refetchInterval:!1}),Hi=ks({queryKey:["session-run-workbench",m],enabled:!!(m&&Xt),queryFn:async()=>(await qt()).client.getSessionRunWorkbench(m),refetchInterval:!1}),Ws=ks({queryKey:["plan",m],enabled:!!m,queryFn:async()=>(await qt()).client.getSessionPlan(m),refetchInterval:!1}),qi=ks({queryKey:["interactions",m],enabled:!!m,queryFn:async()=>(await qt()).client.getSessionInteractions(m),refetchInterval:!1,initialData:[]}),Ms=_.useCallback(async(b,O)=>{if(m){is(Q=>{var le,st,ze;return{...Q,[b]:{chunks:((le=Q[b])==null?void 0:le.chunks)??[],nextCursor:((st=Q[b])==null?void 0:st.nextCursor)??0,truncated:((ze=Q[b])==null?void 0:ze.truncated)??!1,isLoading:!0,error:null}}});try{const Q=await qt(),le=mt.current[b],st=await Q.client.getSessionTerminalOutput({sessionId:m,terminalId:b,cursor:O!=null&&O.force||le!=null&&le.truncated||le==null?void 0:le.nextCursor});is(ze=>{const Ue=ze[b],Pe=O!=null&&O.force||st.truncated||!Ue?st.chunks:Wy(Ue.chunks,st.chunks);return{...ze,[b]:{chunks:Pe,nextCursor:st.next_cursor,truncated:st.truncated,isLoading:!1,error:null}}})}catch(Q){is(le=>{var st,ze,Ue;return{...le,[b]:{chunks:((st=le[b])==null?void 0:st.chunks)??[],nextCursor:((ze=le[b])==null?void 0:ze.nextCursor)??0,truncated:((Ue=le[b])==null?void 0:Ue.truncated)??!1,isLoading:!1,error:Q instanceof Error?Q.message:"无法读取终端输出。"}}})}}},[m]),Wl=_.useCallback(b=>{var ze;if(!m||b.session_id!==m)return;g.setQueryData(ki(m),Ue=>Tu(Ue,b.timeline)),g.setQueryData(["timeline",m],Ue=>Ff(Ue,b.timeline)),g.setQueryData(["interactions",m],b.interactions),tt(Ue=>Ue&&b.interactions.some(Pe=>Pe.id===Ue)?Ue:null),g.setQueryData(["plan",m],b.plan_snapshot),g.setQueryData(["change-sets",m],b.change_sets);const O=b.terminal_snapshot;O&&(g.setQueryData(["session-run-workbench",m],Ue=>Ue&&{...Ue,terminal_snapshot:O}),is(Ue=>{const Pe=new Set(O.terminals.map(Un=>Un.id)),Ln={};for(const[Un,tr]of Object.entries(Ue))Pe.has(Un)&&(Ln[Un]=tr);return Ln}));const Q=(ze=b.timeline.at(-1))==null?void 0:ze.timestamp,le=Q&&(!b.session_patch.last_event_at||+new Date(Q)>+new Date(b.session_patch.last_event_at))?{...b.session_patch,last_event_at:Q}:b.session_patch,st=g.getQueryData(yt);hh(st,m)?g.setQueryData(yt,Ue=>Eu(Ue,m,le)):g.invalidateQueries({queryKey:yt}),(b.session_patch.run_state==="running"||b.session_patch.run_state==="completed"||b.session_patch.run_state==="idle")&&(Ae(b.session_patch.run_state==="running"),b.session_patch.run_state!=="running"&&Ce(!1)),Xt&&(g.getQueryData(["session-run-workbench",m])||g.invalidateQueries({queryKey:["session-run-workbench",m],exact:!0})),Ht!=null&&Ht.id&&g.invalidateQueries({queryKey:["timeline",Ht.id,"prefix-source"],exact:!0}),Es()},[Xt,Ht==null?void 0:Ht.id,g,m]),Fi=_.useCallback(async b=>{if(!m)return;const O=++ge.current;Ye({state:"recovering"});try{const le=await(await qt()).client.getSessionRecoverySnapshot(m);if(ge.current!==O)return;Wl(le),jn.current=null,Ye({state:"idle"})}catch(Q){if(ge.current!==O)return;Ye({state:"failed",error:Q instanceof Error?Q.message:b==="foreground"?"前台恢复失败。":"会话同步失败。"})}},[Wl,qt,m]),Xa=_.useCallback(()=>{if(!m)return;const b=Date.now();b-C.current<Lk||(C.current=b,jn.current=b,he.state==="connected"&&Fi("foreground"))},[he.state,Fi,m]);_.useEffect(()=>{var le,st;const b=(le=Hi.data)==null?void 0:le.terminal_snapshot.active_terminal_id,O=(st=Hi.data)==null?void 0:st.terminal_snapshot.terminals.find(ze=>ze.id===b);if(!b||!O)return;const Q=xt[b];(!Q||Q.truncated||Q.nextCursor<O.output_cursor)&&Ms(b)},[Ms,Hi.data,xt]);const Ja=!!(K!=null&&K.subagent&&(Ht!=null&&Ht.id)&&Ka.isPending&&!Ka.data),Da=_.useMemo(()=>K!=null&&K.subagent?Ht!=null&&Ht.id&&Ka.isPending&&!Ka.data?[]:fN(xa.data??[],Ka.data):xa.data??[],[Ht==null?void 0:Ht.id,Ka.data,K==null?void 0:K.subagent,xa.data]),Qi=_.useMemo(()=>Vj(Da,Sa.data),[Da,Sa.data]);_.useEffect(()=>{m&&window.localStorage.setItem(Fy,m)},[m]),_.useEffect(()=>{const b=Nn.current;b&&((Sa.data??[]).some(O=>O.id===b.optimisticEntryId)||(Nn.current=null))},[Sa.data]),_.useEffect(()=>{Sn(!1)},[m]),_.useEffect(()=>{un((K==null?void 0:K.title)??""),Ze(!1)},[K==null?void 0:K.title,m]),_.useEffect(()=>{Ce(!1)},[m]),_.useEffect(()=>()=>{hn.current&&window.clearTimeout(hn.current),mn.current&&window.clearTimeout(mn.current),Tn.current&&window.cancelAnimationFrame(Tn.current)},[]),_.useEffect(()=>{if(mn.current&&(window.clearTimeout(mn.current),mn.current=null),!!T)return mn.current=window.setTimeout(()=>{$(null),mn.current=null},Bk),()=>{mn.current&&(window.clearTimeout(mn.current),mn.current=null)}},[T]),_.useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(bv,String(G1(re))),window.localStorage.setItem(Mu,Ru)}catch{}},[re]),_.useEffect(()=>{Et.current=re},[re]),_.useEffect(()=>{if(typeof window>"u")return;const b=()=>{const O=window.innerWidth>=Gy;q(O),O&&U(!1)};return b(),window.addEventListener("resize",b),()=>{window.removeEventListener("resize",b)}},[]),_.useEffect(()=>{if(!ee)return;const b=Q=>{const le=pt.current;if(!le)return;const st=Q.clientX-le.startX,ze=G1(le.startWidth+st);Yt.current=ze,Tn.current===null&&(Tn.current=window.requestAnimationFrame(()=>{Tn.current=null;const Ue=Yt.current,Pe=j.current;Ue===null||!Pe||Pe.style.setProperty("--desktop-sidebar-width",`${Ue}px`)}))},O=()=>{Tn.current!==null&&(window.cancelAnimationFrame(Tn.current),Tn.current=null);const Q=Yt.current??Et.current;Yt.current=null,pt.current=null,Z(!1),Et.current=Q,V(Q)};return window.addEventListener("pointermove",b),window.addEventListener("pointerup",O),window.addEventListener("pointercancel",O),()=>{window.removeEventListener("pointermove",b),window.removeEventListener("pointerup",O),window.removeEventListener("pointercancel",O)}},[ee]),_.useEffect(()=>{const b=O=>{const Q=O.target;zn(!1),$t(!1),!(Q instanceof Element&&(Q.closest(".conversation-topbar__actions")||Q.closest(".conversation-topbar__title-actions")||Q.closest(".picker-sheet")||Q.closest(".picker-sheet-wrap")))&&(Bt(!1),gt(!1),Ee(!1))};return window.addEventListener("pointerdown",b),()=>{window.removeEventListener("pointerdown",b)}},[]),_.useEffect(()=>{const b=j.current;if(!b||R)return;const O=ze=>{if(ze.touches.length!==1||Ui(ze.target))return;const Ue=ze.touches[0];Sc(Ue.clientX,Ue.clientY)},Q=ze=>{if(ze.touches.length!==1||!ot.current)return;const Ue=ze.touches[0];jc(Ue.clientX,Ue.clientY)&&ze.preventDefault()},le=ze=>{if(!ot.current)return;const Ue=ze.changedTouches[0];if(!Ue){ot.current=null,ja(null);return}_d(Ue.clientX,Ue.clientY)},st=()=>{ot.current=null,ja(null)};return b.addEventListener("touchstart",O,{passive:!0,capture:!0}),b.addEventListener("touchmove",Q,{passive:!1,capture:!0}),b.addEventListener("touchend",le,{capture:!0}),b.addEventListener("touchcancel",st,{capture:!0}),()=>{b.removeEventListener("touchstart",O,{capture:!0}),b.removeEventListener("touchmove",Q,{capture:!0}),b.removeEventListener("touchend",le,{capture:!0}),b.removeEventListener("touchcancel",st,{capture:!0})}},[R,H]),_.useEffect(()=>{if(!m)return;Es();const b=window.setTimeout(Es,120);return()=>{window.clearTimeout(b)}},[Da.length,m]),_.useEffect(()=>{const b=E.current;if(!b)return;const O=()=>{Gl()};return O(),b.addEventListener("scroll",O,{passive:!0}),window.addEventListener("resize",O),()=>{b.removeEventListener("scroll",O),window.removeEventListener("resize",O)}},[Da.length,m]),_.useEffect(()=>{let b=!1,O;return qt().then(Q=>{b||(O=Q.client.connectEvents(le=>{var Ue,Pe,Ln,Un,tr,ka,Dc,Oc,di,Ba,co,nr,uo,Ua,la,Na,oa;const st=typeof((Ue=le.payload)==null?void 0:Ue.sessionId)=="string"?le.payload.sessionId:null,ze=st===m;if(le.type==="agent.online"||le.type==="snapshot.changed"){g.invalidateQueries({queryKey:yt});return}if(le.type==="timeline.reset"&&ze){const ut=Array.isArray((Pe=le.payload)==null?void 0:Pe.entries)?le.payload.entries:[];g.setQueryData(ki(m),Tt=>Tu(Tt,ut)),g.setQueryData(["timeline",m],Tt=>Ff(Tt,ut));const Jt=(Ln=ut[ut.length-1])==null?void 0:Ln.timestamp;Jt&&g.setQueryData(yt,Tt=>B1(Tt,m,Jt)),Es();return}if(le.type==="interaction.reset"&&ze){const ut=Array.isArray((Un=le.payload)==null?void 0:Un.requests)?le.payload.requests:[];g.setQueryData(["interactions",m],ut),tt(Jt=>Jt&&ut.some(Tt=>Tt.id===Jt)?Jt:null);return}if(le.type==="plan.reset"&&ze){const ut=(tr=le.payload)!=null&&tr.planSnapshot&&typeof le.payload.planSnapshot=="object"?le.payload.planSnapshot:null;g.setQueryData(["plan",m],ut);return}if(le.type==="timeline.delta"&&ze){const ut=Array.isArray((ka=le.payload)==null?void 0:ka.entries)?le.payload.entries:[];g.setQueryData(ki(m),Tt=>Tu(Tt,ut)),g.setQueryData(["timeline",m],Tt=>K3(Tt,ut));const Jt=(Dc=ut[ut.length-1])==null?void 0:Dc.timestamp;Jt&&g.setQueryData(yt,Tt=>B1(Tt,m,Jt)),Es();return}if(le.type==="interaction.delta"&&ze){const ut=Array.isArray((Oc=le.payload)==null?void 0:Oc.requests)?le.payload.requests:[],Jt=Array.isArray((di=le.payload)==null?void 0:di.resolvedRequestIds)?le.payload.resolvedRequestIds.filter(Tt=>typeof Tt=="string"&&Tt.trim().length>0):[];g.setQueryData(["interactions",m],Tt=>{const en=new Map((Tt??[]).map(Ft=>[Ft.id,Ft]));for(const Ft of ut)en.set(Ft.id,Ft);for(const Ft of Jt)en.delete(Ft);return[...en.values()].sort((Ft,dn)=>+new Date(dn.updated_at)-+new Date(Ft.updated_at))}),Jt.length>0&&tt(Tt=>Tt&&Jt.includes(Tt)?null:Tt);return}if(le.type==="plan.delta"&&ze){const ut=(Ba=le.payload)!=null&&Ba.planSnapshot&&typeof le.payload.planSnapshot=="object"?le.payload.planSnapshot:null;g.setQueryData(["plan",m],ut);return}if(le.type==="changeset.reset"&&ze){const ut=Array.isArray((co=le.payload)==null?void 0:co.changeSets)?le.payload.changeSets:[];g.setQueryData(["change-sets",m],ut);return}if(le.type==="changeset.delta"&&ze){const ut=Array.isArray((nr=le.payload)==null?void 0:nr.changeSets)?le.payload.changeSets:[];g.setQueryData(["change-sets",m],Jt=>{const Tt=new Map((Jt??[]).map(en=>[en.id,en]));for(const en of ut)Tt.set(en.id,en);return[...Tt.values()].sort((en,Ft)=>+new Date(en.started_at)-+new Date(Ft.started_at))});return}if(le.type==="terminal.snapshot"&&ze){const ut=(uo=le.payload)!=null&&uo.snapshot&&typeof le.payload.snapshot=="object"?le.payload.snapshot:null;if(!ut)return;g.setQueryData(["session-run-workbench",m],Jt=>Jt&&{...Jt,terminal_snapshot:ut}),is(Jt=>{const Tt=new Set(ut.terminals.map(Ft=>Ft.id)),en={};for(const[Ft,dn]of Object.entries(Jt))Tt.has(Ft)&&(en[Ft]=dn);return en});return}if(le.type==="terminal.delta"&&ze){const ut=(Ua=le.payload)!=null&&Ua.terminal&&typeof le.payload.terminal=="object"?le.payload.terminal:null,Jt=Array.isArray((la=le.payload)==null?void 0:la.chunks)?le.payload.chunks:[],Tt=typeof((Na=le.payload)==null?void 0:Na.activeTerminalId)=="string"?le.payload.activeTerminalId:null;if(!ut)return;g.setQueryData(["session-run-workbench",m],en=>{if(!en)return en;const Ft=en.terminal_snapshot.terminals.filter(fo=>fo.id!==ut.id),dn=en.terminal_snapshot.terminals.findIndex(fo=>fo.id===ut.id),sr=[...Ft];return dn<=0?sr.unshift(ut):sr.splice(dn,0,ut),{...en,terminal_snapshot:{...en.terminal_snapshot,active_terminal_id:Tt,updated_at:ut.updated_at,terminals:sr}}}),is(en=>{var dn;if(Jt.length===0)return en;const Ft=en[ut.id];return{...en,[ut.id]:{chunks:Wy((Ft==null?void 0:Ft.chunks)??[],Jt),nextCursor:typeof((dn=le.payload)==null?void 0:dn.nextCursor)=="number"?le.payload.nextCursor:ut.output_cursor,truncated:(Ft==null?void 0:Ft.truncated)??!1,isLoading:!1,error:null}}});return}if(le.type==="session.updated"&&st){const ut=(oa=le.payload)!=null&&oa.sessionPatch&&typeof le.payload.sessionPatch=="object"?le.payload.sessionPatch:null,Jt=g.getQueryData(yt);ut&&hh(Jt,st)?g.setQueryData(yt,Tt=>Eu(Tt,st,ut)):g.invalidateQueries({queryKey:yt}),ze&&((ut==null?void 0:ut.run_state)==="running"||(ut==null?void 0:ut.run_state)==="completed"||(ut==null?void 0:ut.run_state)==="idle")&&(Ae(ut.run_state==="running"),ut.run_state!=="running"&&Ce(!1));return}le.type==="turn.completed"&&ze&&(Ae(!1),Ce(!1),g.setQueryData(["plan",m],null))},{sessionId:m,reconnectWhenHidden:!0,onStatus:le=>{if(Oe(le),le.state==="connected"){$t(!1),Fi(jn.current!=null?"foreground":"connected");return}ge.current+=1,Ye({state:"idle"})}}))}),()=>{b=!0,O==null||O()}},[g,qt,Fi,m]),_.useEffect(()=>{if(!m||(K==null?void 0:K.run_state)!=="running"||K.context_usage)return;let b=!1;const O=window.setTimeout(()=>{b||g.invalidateQueries({queryKey:yt})},1200);return()=>{b=!0,window.clearTimeout(O)}},[g,m,K==null?void 0:K.context_usage,K==null?void 0:K.run_state]),_.useEffect(()=>{Bt(!1)},[R,m]);const gc=_.useCallback(b=>{var O;de(b),((O=b.effect)==null?void 0:O.type)==="set_session_model"&&(A(b.effect.model),b.effect.reasoning_effort&&je(b.effect.reasoning_effort))},[]),Rs=ns({mutationFn:async b=>(await qt()).client.sendSessionInput(b),onMutate:async b=>{await g.cancelQueries({queryKey:["timeline",b.sessionId]}),$(null),Ce(!1),Ae(!0),at(b.proposedPlanEntryId??null);const O=b.clearComposer!==!1;O&&(F(""),pe([])),hn.current&&window.clearTimeout(hn.current);const Q=new Date().toISOString(),le=`${C0}${b.sessionId}:${Date.now()}`;Nn.current=O?{optimisticEntryId:le,draft:b.input,attachments:b.attachments}:null,g.setQueryData(ki(b.sessionId),st=>V3(st,{id:le,kind:"user",title:"你",body:b.input,timestamp:Q,accent:"primary",attachments:fv(b.attachments)})),g.setQueryData(yt,st=>{var ze;return Eu(st,b.sessionId,{run_state:"running",run_state_changed_at:Q,last_event_at:Q,summary:b.input||((ze=b.attachments[0])==null?void 0:ze.name)||"附件"})})},onSuccess:async(b,O)=>{at(null),O.proposedPlanEntryId&&Me(Q=>{const le={...Q};return delete le[O.proposedPlanEntryId],le}),await g.invalidateQueries({queryKey:yt}),await g.invalidateQueries({queryKey:["plan",O.sessionId]}),await g.invalidateQueries({queryKey:["change-sets",O.sessionId]}),hn.current=null},onError:(b,O)=>{at(null),Ae(!1);const Q=Nn.current;Q&&(g.setQueryData(ki(O.sessionId),le=>Kj(le,Q.optimisticEntryId)),F(le=>le||Q.draft),pe(le=>le.length>0?le:Q.attachments),Nn.current=null),$(b instanceof Error?b.message:"无法发送消息")}}),As=ns({mutationFn:async b=>(await qt()).client.executeSessionCommand(b),onMutate:b=>{$(null),F(""),pe([]);const O=b.input.slice(1).trim().split(/\s+/)[0]??"",Q=new Date().toISOString();de({panel_id:`command-panel-pending-${Date.now()}`,session_id:b.sessionId,command_name:O,command_text:b.input,title:`正在执行 /${O}`,description:null,status:"running",body:"命令执行中…",submitted_at:Q,updated_at:Q,input_type:"none",options:[],input_placeholder:null,submit_label:null,effect:null})},onSuccess:async b=>{gc(b.panel),await g.invalidateQueries({queryKey:yt})},onError:(b,O)=>{de(null),F(Q=>Q||O.input),$(b instanceof Error?b.message:"无法执行命令")}}),Oa=ns({mutationFn:async b=>(await qt()).client.respondToSessionCommand(b),onMutate:()=>{$(null)},onSuccess:async b=>{gc(b.panel),await g.invalidateQueries({queryKey:yt})},onError:b=>{$(b instanceof Error?b.message:"无法继续执行命令")}}),Gi=ns({mutationFn:async b=>(await qt()).client.respondToSessionInteraction(b),onMutate:async b=>{$(null),tt(b.requestId),g.setQueryData(["interactions",b.sessionId],O=>(O??[]).map(Q=>Q.id===b.requestId?{...Q,status:"submitting",updated_at:new Date().toISOString()}:Q))},onSuccess:async(b,O)=>{await g.invalidateQueries({queryKey:["interactions",O.sessionId]})},onError:(b,O)=>{g.setQueryData(["interactions",O.sessionId],Q=>(Q??[]).map(le=>le.id===O.requestId?{...le,status:"pending"}:le)),tt(null),$(b instanceof Error?b.message:"无法提交确认回复")}}),Xn=ns({mutationFn:async b=>(await qt()).client.interruptSession(b),onMutate:async b=>{$(null),Ce(!0),Ae(!1),hn.current&&(window.clearTimeout(hn.current),hn.current=null);const O=new Date().toISOString(),Q=g.getQueryData(yt);return g.setQueryData(yt,le=>Eu(le,b,{run_state:"completed",run_state_changed_at:O,last_event_at:O})),g.setQueryData(["plan",b],null),{previousSnapshot:Q,targetSessionId:b}},onSuccess:(b,O)=>{Ce(!1),g.invalidateQueries({queryKey:yt}),g.invalidateQueries({queryKey:["timeline",O]}),g.invalidateQueries({queryKey:["change-sets",O]})},onError:(b,O,Q)=>{Ce(!1),Ae(!0),Q!=null&&Q.previousSnapshot&&g.setQueryData(yt,Q.previousSnapshot),g.invalidateQueries({queryKey:["plan",O]}),$(b instanceof Error?b.message:"无法中断会话")}});_.useEffect(()=>{!m||!K||Ie||Xn.isPending||Ae(K.run_state==="running")},[Xn.isPending,Ie,K,K==null?void 0:K.run_state,m]);const _n=ns({mutationFn:async b=>(await ss({sessionId:b.sessionId})).client.updateSession(b)}),ei=ns({mutationFn:async b=>(await ss({projectId:b.projectId})).client.updateThread(b)}),fs=ns({mutationFn:async b=>(await qt()).client.executeSessionGitAction({sessionId:m,action:b.action,path:b.path,branch:b.branch,message:b.message}),onMutate:async()=>{Xe(null)},onSuccess:(b,O)=>{g.setQueryData(["session-git-workspace",m],b.workspace),(O.action==="commit-all"||O.action==="switch-branch")&&g.invalidateQueries({queryKey:["session-git-history",m]})},onError:b=>{Xe(b instanceof Error?b.message:"无法执行 git 操作")}}),Ds=ns({mutationFn:async b=>(await qt()).client.saveSessionRunCommand({sessionId:m,action:b.action,commandId:b.commandId,command:b.command}),onMutate:()=>{nn(null)},onSuccess:({catalog:b})=>{g.setQueryData(["session-run-workbench",m],O=>O&&{...O,command_catalog:b})},onError:b=>{nn(b instanceof Error?b.message:"无法保存项目命令。")}}),Os=ns({mutationFn:async b=>(await qt()).client.saveSessionRunWebsite({sessionId:m,action:b.action,websiteId:b.websiteId,website:b.website}),onMutate:()=>{nn(null)},onSuccess:({catalog:b})=>{g.setQueryData(["session-run-workbench",m],O=>O&&{...O,website_catalog:b})},onError:b=>{nn(b instanceof Error?b.message:"无法保存项目网页。")}}),Xr=ns({mutationFn:async()=>(await qt()).client.generateSessionRunCommand({sessionId:m,prompt:"",model:Qf()}),onMutate:()=>{nn(null),ds(null)},onSuccess:({generation:b,catalog:O})=>{g.setQueryData(["session-run-workbench",m],Q=>Q&&{...Q,command_catalog:O}),ds(b.reason)},onError:b=>{nn(b instanceof Error?b.message:"无法一键生成项目命令。")}}),Yn=ns({mutationFn:async()=>(await qt()).client.generateSessionRunWebsite({sessionId:m,prompt:"",model:Qf()}),onMutate:()=>{nn(null),va(null)},onSuccess:({generation:b,catalog:O})=>{g.setQueryData(["session-run-workbench",m],Q=>Q&&{...Q,website_catalog:O}),va(b.reason)},onError:b=>{nn(b instanceof Error?b.message:"无法一键生成项目网页。")}}),gn=ns({mutationFn:async b=>(await qt()).client.executeSessionTerminalAction({sessionId:m,action:b.action,commandId:b.commandId,terminalId:b.terminalId}),onMutate:()=>{nn(null)},onSuccess:async(b,O)=>{g.setQueryData(["session-run-workbench",m],Q=>Q&&{...Q,terminal_snapshot:b.snapshot}),(O.action==="run-command"||O.action==="run-kill-command")&&b.terminal&&(gt(!1),$e("terminal"),await Ms(b.terminal.id,{force:!0})),O.action==="focus"&&O.terminalId&&await Ms(O.terminalId),O.action==="close"&&O.terminalId&&is(Q=>{const le={...Q};return delete le[O.terminalId],le})},onError:b=>{nn(b instanceof Error?b.message:"无法执行终端操作。")}}),ti=ud.data??[],Wi=K?ON(K):!1,Yl=_.useMemo(()=>LN(Qi,{projectPath:Bn==null?void 0:Bn.path,compactCompletedTurns:Wi}),[Wi,Bn==null?void 0:Bn.path,Qi]),Jr=_.useMemo(()=>zN(Yl.blocks,ti),[Yl.blocks,ti]),La=[...Jr].reverse().find(b=>b.kind==="turn"&&!b.turn.completion)??null;if(_.useEffect(()=>{var le;if(typeof window>"u")return;const b=window,O=(le=b.requestIdleCallback)==null?void 0:le.call(b,()=>{F1()},{timeout:1500}),Q=O===void 0?window.setTimeout(()=>{F1()},320):null;return()=>{var st;O!==void 0&&((st=b.cancelIdleCallback)==null||st.call(b,O)),Q!==null&&window.clearTimeout(Q)}},[]),!x||!K||!Bn)return r.jsx("div",{className:"conversation-page",children:r.jsx("div",{className:"conversation-main conversation-main--empty",children:r.jsx("div",{className:"empty-panel",children:"没有找到这个会话。"})})});const Yi=K.capability.can_send_input&&!Ie,ni=(qi.data??[]).filter(b=>b.status==="pending"||b.status==="submitting"),yc=(K.run_state==="running"||fe)&&!Ie||Xn.isPending,Vl=Yi&&ni.length===0&&!yc&&!Rs.isPending,vc=(pn==null?void 0:pn.id)??K.agent_id,dd=_.useCallback((b,O)=>{Me(Q=>{if(!O.trim()){if(!(b in Q))return Q;const le={...Q};return delete le[b],le}return{...Q,[b]:O}})},[]),Kl=_.useCallback((b,O)=>{const Q=O.trim();!Q||!Vl||Rs.mutate({sessionId:K.id,input:Q,attachments:[],model:ve,reasoningEffort:te,serviceTier:Se?"fast":void 0,planMode:oe,yoloMode:ie,clearComposer:!1,proposedPlanEntryId:b})},[Vl,Se,oe,ie,ve,te,Rs,K.id]),Th=_.useMemo(()=>r.jsx($N,{sessions:x.sessions,sessionRunState:K.run_state,projectPath:Bn.path,renderedBlocks:Jr,lastToolGroupId:Yl.lastToolGroupId,sessionChangeSets:ti,isSubagentTimelinePending:Ja,hasTimeline:Qi.length>0,proposedPlanReplyDrafts:_e,pendingProposedPlanReplyEntryId:Ge,canRespondToProposedPlan:Vl,onProposedPlanReplyDraftChange:dd,onSubmitProposedPlanReply:Kl,onPreviewImage:ne},K.id),[Vl,dd,Kl,Ja,Ge,Bn.path,_e,Jr,Yl.lastToolGroupId,K.id,K.run_state,ti,x.sessions,Qi.length]),si=_.useCallback(async(b,O,Q)=>{var st;$(null),Bt(!1);const le=g.getQueryData(yt);O==="pin"||O==="unpin"?Er.flushSync(()=>{g.setQueryData(yt,ze=>mh(ze,b,{pinned:O==="pin"}))}):O==="rename"&&(Q!=null&&Q.trim())&&g.setQueryData(yt,ze=>mh(ze,b,{title:Q.trim()}));try{const ze=await _n.mutateAsync({sessionId:b,action:O,name:Q}),Ue=(st=ze.affectedSessionIds)!=null&&st.length?ze.affectedSessionIds:[b];if(O==="delete"){g.setQueryData(yt,Pe=>$3(Pe,Ue));for(const Pe of Ue)g.removeQueries({queryKey:["timeline",Pe],exact:!0}),g.removeQueries({queryKey:ki(Pe),exact:!0}),g.removeQueries({queryKey:["change-sets",Pe],exact:!0})}else g.setQueryData(yt,Pe=>U3(Pe,Ue,{...O==="rename"&&(Q!=null&&Q.trim())?{title:Q.trim()}:{pinned:O==="pin"}}));if(b===K.id&&O==="delete"){const Pe=ze.nextSessionId;Pe?await _a(Pe):await ba()}}catch(ze){g.setQueryData(yt,le),$(ze instanceof Error?ze.message:"无法更新会话")}},[ba,_a,g,K.id,_n]),Mh=_.useCallback(async(b,O,Q)=>{var ze,Ue;$(null),Bt(!1);const le=g.getQueryData(yt),st=(ze=Q==null?void 0:Q.name)==null?void 0:ze.trim();O==="pin"||O==="unpin"?Er.flushSync(()=>{g.setQueryData(yt,Pe=>ph(Pe,b,{pinned:O==="pin"}))}):O==="rename"&&st?g.setQueryData(yt,Pe=>ph(Pe,b,{display_name:st})):O==="reorder"&&((Ue=Q==null?void 0:Q.orderedProjectIds)!=null&&Ue.length)?g.setQueryData(yt,Pe=>H3(Pe,Q.orderedProjectIds??[])):O==="remove"||O==="archive"?g.setQueryData(yt,Pe=>q3(Pe,b)):O==="unarchive"&&g.setQueryData(yt,Pe=>Pe&&{...Pe,sessions:Pe.sessions.map(Ln=>Ln.project_id===b?{...Ln,archived:!1}:Ln)});try{const Pe=await ei.mutateAsync({projectId:b,action:O,name:Q==null?void 0:Q.name,orderedProjectIds:Q==null?void 0:Q.orderedProjectIds});if(O==="remove"||O==="archive"||O==="unarchive"){const Ln=Pe.nextSessionId;Ln?await _a(Ln):await ba()}}catch(Pe){g.setQueryData(yt,le),$(Pe instanceof Error?Pe.message:"无法更新线程")}},[ba,_a,g,ei]),Rh=_.useCallback(async b=>{vc&&($r(vc),ws(null),Yu(null),Ho(b),await S({to:"/"}))},[vc,S]),Ah=((lo=Ws.data)==null?void 0:lo.steps.some(b=>b.status==="pending"||b.status==="in_progress"))??!1,Vi=K.run_state==="running"||fe,Dh=!!((Rc=Ws.data)!=null&&Rc.updated_at&&Date.now()-new Date(Ws.data.updated_at).getTime()<=Ak),Oh=Ws.data&&(Ah||Vi&&Dh)?Ws.data:null,Zl=Math.max(0,$i.size-pc.length),Ys=K.context_usage,Xl=Ys?Math.round(Ys.percent_used):0,Lh=Math.max(0,100-Xl),Ih=Ys?{"--usage-progress":`${Math.max(0,Math.min(100,Ys.percent_used))}%`}:void 0,Ph=he.state==="connected"&&Be.state==="idle"&&Vi&&!Ie&&!Xn.isPending&&!(La!=null&&La.turn.completion),fd=!!Ht||pc.length>0;_.useEffect(()=>{m&&(Cn.current[m]={planAt:0,backgroundAgentsAt:0},En.current=null,jn.current=null,C.current=0,ge.current+=1,Ye({state:"idle"}))},[m]),_.useEffect(()=>{if(!m)return;const b=Cn.current[m]??(Cn.current[m]={planAt:0,backgroundAgentsAt:0});Ws.data&&(b.planAt=0),Zl<=0&&(b.backgroundAgentsAt=0)},[Zl,Ws.data,m]),_.useEffect(()=>{if(!Fe)return;(qi.data??[]).some(O=>O.id===Fe&&O.status==="submitting")||tt(null)},[qi.data,Fe]),_.useEffect(()=>{if(!m||typeof window>"u"||typeof document>"u")return;const b=Ue=>{if(Ue==="online"||he.state!=="connected")return!0;const Pe=En.current;return Pe==null?!1:Date.now()-Pe>=Ok},O=Ue=>{if(document.visibilityState!=="hidden"){if(!b(Ue)){En.current=null;return}En.current=null,Xa()}},Q=()=>{if(document.visibilityState==="hidden"){En.current=Date.now();return}O("visible")},le=()=>{O("pageshow")},st=()=>{O("focus")},ze=()=>{O("online")};return document.addEventListener("visibilitychange",Q),window.addEventListener("pageshow",le),window.addEventListener("focus",st),window.addEventListener("online",ze),()=>{document.removeEventListener("visibilitychange",Q),window.removeEventListener("pageshow",le),window.removeEventListener("focus",st),window.removeEventListener("online",ze)}},[he.state,Xa,m]),_.useEffect(()=>{var b;!m||!K||K.run_state==="running"||Rs.isPending||Xn.isPending||La||(b=Ws.data)!=null&&b.is_active||(hn.current&&(window.clearTimeout(hn.current),hn.current=null),Ae(!1))},[La,Xn.isPending,(oo=Ws.data)==null?void 0:oo.is_active,Rs.isPending,K,K==null?void 0:K.run_state,m]),_.useEffect(()=>{var le;if(!m||!K||he.state!=="connected"||K.run_state!=="running")return;const b=((le=Da[Da.length-1])==null?void 0:le.timestamp)??K.last_event_at;if(!b||Date.now()-new Date(b).getTime()<2500||On.current[m]===b)return;On.current[m]=b;const Q=window.setTimeout(()=>{g.invalidateQueries({queryKey:yt})},900);return()=>{window.clearTimeout(Q)}},[he.state,Da,g,K,K==null?void 0:K.last_event_at,K==null?void 0:K.run_state,m]),_.useEffect(()=>{if(!m||!K||he.state!=="connected"||!Vi)return;const b=Cn.current[m]??(Cn.current[m]={planAt:0,backgroundAgentsAt:0}),O=Vi&&!Ws.data,Q=!K.subagent&&$i.size>0&&Zl>0;if(!O&&!Q)return;const le=window.setTimeout(()=>{const st=Date.now();O&&st-b.planAt>=Qy&&(b.planAt=st,g.invalidateQueries({queryKey:["plan",m]})),Q&&st-b.backgroundAgentsAt>=Qy&&(b.backgroundAgentsAt=st,g.invalidateQueries({queryKey:yt}))},160);return()=>{window.clearTimeout(le)}},[La,he.state,Vi,Zl,$i.size,Ws.data,g,K,K==null?void 0:K.subagent,m]);const Vs=R?0:BN(),zh=R||H,hd=R?0:qe??(H?Vs:0),Bh=Ut&&typeof document<"u"?Er.createPortal(r.jsxs("div",{className:"sheet-wrap sheet-wrap--centered",role:"dialog","aria-modal":"true",children:[r.jsx("button",{type:"button",className:"sheet-wrap__scrim",onClick:()=>{Ze(!1),un(K.title)},"aria-label":"关闭重命名会话面板"}),r.jsx("div",{className:"sheet-wrap__center",children:r.jsxs("div",{className:"sheet-panel sheet-panel--form sheet-panel--centered",children:[r.jsx("div",{className:"sheet-panel__title",children:"重命名会话"}),r.jsx("input",{className:"sheet-panel__input",value:Zt,onChange:b=>un(b.target.value),placeholder:"输入会话名称",autoFocus:!0}),r.jsxs("div",{className:"sheet-panel__actions",children:[r.jsx("button",{type:"button",className:"sheet-panel__button",onClick:()=>{Ze(!1),un(K.title)},children:"取消"}),r.jsx("button",{type:"button",className:"sheet-panel__button is-primary",disabled:!Zt.trim()||_n.isPending&&((Ac=_n.variables)==null?void 0:Ac.sessionId)===K.id,onClick:()=>{si(K.id,"rename",Zt.trim()),Ze(!1)},children:"保存"})]})]})})]}),document.body):null,Uh=!(t?a:R)&&ht&&typeof document<"u"?Er.createPortal(r.jsxs("div",{className:"picker-sheet-wrap",role:"dialog","aria-modal":"true",children:[r.jsx("button",{type:"button",className:"picker-sheet__scrim",onClick:()=>Bt(!1),"aria-label":"关闭会话操作菜单"}),r.jsxs("div",{className:"picker-sheet",children:[r.jsx("div",{className:"picker-sheet__header",children:r.jsx("strong",{children:K.title})}),r.jsxs("div",{className:"picker-sheet__list",children:[r.jsx("button",{type:"button",className:"picker-sheet__item",disabled:_n.isPending&&((_s=_n.variables)==null?void 0:_s.sessionId)===K.id,onClick:()=>void si(K.id,K.pinned?"unpin":"pin"),children:r.jsx("span",{children:K.pinned?"取消置顶会话":"置顶会话"})}),r.jsx("button",{type:"button",className:"picker-sheet__item",disabled:_n.isPending&&((ci=_n.variables)==null?void 0:ci.sessionId)===K.id,onClick:()=>{Bt(!1),Ze(!0)},children:r.jsx("span",{children:"重命名会话"})}),r.jsx("button",{type:"button",className:"picker-sheet__item is-danger",disabled:_n.isPending&&((ui=_n.variables)==null?void 0:ui.sessionId)===K.id,onClick:()=>void si(K.id,"delete"),children:r.jsx("span",{children:"删除会话"})})]})]})]}),document.body):null,$h=R?1:Vs>0?hd/Vs:0,md=!R&&qe!==null,Hh=R?{"--desktop-sidebar-width":`${re}px`}:void 0,ls=t?!!a:R,el=t?l:hd,ai=t?c:md,qh=fs.isPending?fs.variables??null:null,pd=nt??(Za.error instanceof Error?Za.error.message:null),gd=Ts.error instanceof Error?Ts.error.message:null,tl=At??(Hi.error instanceof Error?Hi.error.message:null),ps=Hi.data??null,Ks=(ps==null?void 0:ps.terminal_snapshot)??null,Ls=(ps==null?void 0:ps.command_catalog.commands)??[],yd=(ps==null?void 0:ps.website_catalog.websites)??[],_c=gh(Qf(),ke),bc=(Ks==null?void 0:Ks.terminals.find(b=>b.id===Ks.active_terminal_id))??(Ks==null?void 0:Ks.terminals[0])??null,nl=Xt&&ae==="terminal",Jl=wn&&ae==="git",Zs=ls&&nl&&De,sl=Jl&&ls,al=(nl||Jl)&&ls&&!Zs,eo=(nl||Jl)&&!ls,xc=gn.isPending&&((ul=gn.variables)==null?void 0:ul.action)==="run-command"?gn.variables.commandId??null:null,vd=gn.isPending&&((er=gn.variables)==null?void 0:er.action)==="run-kill-command"?gn.variables.commandId??null:null,to=Ds.isPending&&((bs=Ds.variables)==null?void 0:bs.action)==="delete"?Ds.variables.commandId??null:null,no=Os.isPending&&((xs=Os.variables)==null?void 0:xs.action)==="delete"?Os.variables.websiteId??null:null;_.useEffect(()=>{!ls&&De&&We(!1)},[De,ls]);const ja=b=>{lt.current=b,rn(b)},Sc=(b,O,Q)=>(ot.current={mode:H?"close":"open",startX:b,startY:O,axis:"pending",pointerId:Q},!0),jc=(b,O)=>{const Q=ot.current;if(!Q)return!1;const le=b-Q.startX,st=O-Q.startY;if(Q.axis==="pending"){if(Math.abs(le)<8&&Math.abs(st)<8)return!1;if(Q.axis=Math.abs(le)>Math.abs(st)?"x":"y",Q.axis==="y")return ot.current=null,ja(null),!1}const ze=Q.mode==="open"?Math.max(0,Math.min(Vs,le)):Math.max(0,Math.min(Vs,Vs+le));return ja(ze),!0},_d=(b,O)=>{const Q=ot.current;if(!Q)return;const le=b-Q.startX,st=O-Q.startY;if(Q.axis==="pending"&&Math.abs(st)>48){ot.current=null,ja(null);return}const Ue=(Q.axis==="x"?lt.current??(Q.mode==="open"?Math.max(0,Math.min(Vs,le)):Math.max(0,Math.min(Vs,Vs+le))):H?Vs:0)>=Vs*Tk;U(Ue),ot.current=null,ja(null)},bd=_.useCallback(()=>{if(t){u==null||u();return}U(!0)},[t,u]),Fh=_.useCallback(()=>{$t(b=>!b)},[]),Qh=_.useCallback(()=>{$(null)},[]),Gh=_.useCallback(()=>{Sn(b=>!b)},[]),gs=_.useCallback(b=>{_a(b)},[_a]),Ki=_.useCallback(b=>{const O=new Date().toISOString();if(ke.length===0){de({panel_id:`${s1}${Date.now()}`,session_id:K.id,command_name:"model",command_text:b,title:"选择模型",description:"选择后会更新当前会话后续发送时使用的模型。",status:"completed",body:"当前没有可选模型,请先去设置页维护模型列表。",submitted_at:O,updated_at:O,input_type:"none",options:[],input_placeholder:null,submit_label:null,effect:null});return}de({panel_id:`${s1}${Date.now()}`,session_id:K.id,command_name:"model",command_text:b,title:"选择模型",description:"选择后会更新当前会话后续发送时使用的模型。",status:"awaiting_input",body:"在下面选择一个模型。",submitted_at:O,updated_at:O,input_type:"choice",options:ke.map(Q=>({id:Q.value,label:Q.label,description:Q.description??null})),input_placeholder:null,submit_label:null,effect:null})},[ke,K.id]),xd=_.useCallback(()=>{if(O0(W)){if(be.length>0){$("命令暂不支持附件,请先移除附件后再执行。");return}if(nN(W)==="model"){$(null),F(""),Ki(W);return}As.mutate({sessionId:K.id,input:W});return}Rs.mutate({sessionId:K.id,input:W.trim(),attachments:be,model:ve,reasoningEffort:te,serviceTier:Se?"fast":void 0,planMode:oe,yoloMode:ie})},[W,Se,oe,ie,As,Ki,be,ve,te,Rs,K.id]),Sd=_.useCallback(()=>{de(null)},[]),jd=_.useCallback(b=>{if(ue){if(ue.panel_id.startsWith(s1)){A(b),de(O=>O&&{...O,status:"completed",body:`后续消息将优先使用 ${gh(b,ke)}。`,updated_at:new Date().toISOString(),input_type:"none",options:[]});return}Oa.mutate({sessionId:K.id,panelId:ue.panel_id,optionId:b})}},[ue,Oa,ke,K.id]),wd=_.useCallback(b=>{ue&&Oa.mutate({sessionId:K.id,panelId:ue.panel_id,text:b})},[ue,Oa,K.id]),wc=_.useCallback(b=>{Gi.mutate({sessionId:K.id,requestId:b.requestId,optionId:b.optionId??null,text:b.text??null,answers:b.answers})},[Gi,K.id]),Wh=_.useCallback(b=>{const O=[...b];O.length!==0&&($(null),Promise.all(O.map(Q=>dv(Q))).then(Q=>{pe(le=>[...le,...Q])}).catch(Q=>{$(Q instanceof Error?Q.message:"无法读取附件")}))},[]),Zi=_.useCallback(b=>{pe(O=>O.filter(Q=>Q.id!==b))},[]),kc=_.useCallback(()=>{Xn.isPending||Ie||Xn.mutate(K.id)},[Xn,Ie,K.id]),il=_.useCallback(()=>{zn(b=>!b)},[]),Ia=_.useCallback(b=>{b==="git"&&!wn||b==="terminal"&&!Xt||(Xe(null),nn(null),gt(!1),Ee(!1),We(!1),$e(b))},[wn,Xt]);_.useEffect(()=>{if(!al)return;const b=O=>{var le,st;const Q=O.target;Q instanceof Node&&((le=N.current)!=null&&le.contains(Q)||(st=P.current)!=null&&st.contains(Q)||Ia("code"))};return window.addEventListener("pointerdown",b),()=>{window.removeEventListener("pointerdown",b)}},[Ia,al]);const kd=_.useCallback(()=>{Xe(null),Za.refetch()},[Za]),ii=_.useCallback(()=>{Ts.refetch()},[Ts]),Xi=_.useCallback(()=>{Ts.data||Ts.isFetching||Ts.refetch()},[Ts]),Nc=_.useCallback(b=>{fs.mutate({action:"discard-file",path:b})},[fs]),Nd=_.useCallback(()=>{fs.mutate({action:"discard-all"})},[fs]),ri=_.useCallback(b=>{fs.mutate({action:"commit-all",message:b})},[fs]),Cd=_.useCallback(async(b,O)=>{Xe(null);const Q=(O==null?void 0:O.trim())??"";Q&&await fs.mutateAsync({action:"commit-all",message:Q}),await fs.mutateAsync({action:"switch-branch",branch:b})},[fs]),Ed=_.useCallback(()=>{fs.mutate({action:"push"})},[fs]),Td=_.useCallback(async(b,O,Q)=>(await qt()).client.getSessionGitHistoryFileDiff(K.id,{commitOid:b,path:O,previousPath:Q}),[qt,K.id]),Yh=_.useCallback(async(b,O)=>(await qt()).client.getSessionGitWorkspaceFileDiff(K.id,{path:b,previousPath:O}),[qt,K.id]),Md=_.useCallback(b=>{gn.mutate({action:"run-command",commandId:b})},[gn]),Rd=_.useCallback(async()=>{if(!(Ls.length===0||Dt||Wn)){Dn(!0);try{for(const b of Ls)await gn.mutateAsync({action:"run-command",commandId:b.id})}finally{Dn(!1)}}},[Dt,Wn,Ls,gn]),Cc=_.useCallback(async()=>{if(Dt||Wn)return;const b=Ls.filter(O=>!!O.kill_command);if(b.length!==0){Gs(!0);try{for(const O of b)await gn.mutateAsync({action:"run-kill-command",commandId:O.id})}finally{Gs(!1)}}},[Dt,Wn,Ls,gn]),Ad=_.useCallback(b=>{gn.mutate({action:"run-kill-command",commandId:b})},[gn]),so=_.useCallback(b=>{Ds.mutate({action:b.commandId?"update":"create",commandId:b.commandId,command:b.draft})},[Ds]),Is=_.useCallback(b=>{Ds.mutate({action:"delete",commandId:b})},[Ds]),rl=_.useCallback(()=>{Xr.mutate()},[Xr]),ys=_.useCallback(b=>{Os.mutate({action:b.websiteId?"update":"create",websiteId:b.websiteId,website:b.draft})},[Os]),li=_.useCallback(b=>{Os.mutate({action:"delete",websiteId:b})},[Os]),ao=_.useCallback(()=>{Yn.mutate()},[Yn]),ll=_.useCallback(()=>{Ee(!1)},[]),io=_.useCallback(b=>{gn.mutate({action:"focus",terminalId:b}),$e("terminal")},[gn]),Ec=_.useCallback(b=>{gn.mutate({action:"close",terminalId:b})},[gn]),oi=_.useCallback(()=>{!ls||!Xt||($e("terminal"),We(b=>!b))},[Xt,ls]),Tc=_.useMemo(()=>{var b,O,Q;return r.jsxs("div",{className:"conversation-topbar__title-actions",children:[r.jsx("button",{type:"button",className:"conversation-topbar__more",onClick:()=>Bt(le=>!le),"aria-label":"更多会话选项",children:r.jsx(Uk,{})}),ht&&ls?r.jsxs("div",{className:"topbar-menu",role:"menu",children:[r.jsx("button",{type:"button",className:"topbar-menu__item",disabled:_n.isPending&&((b=_n.variables)==null?void 0:b.sessionId)===K.id,onClick:()=>void si(K.id,K.pinned?"unpin":"pin"),children:K.pinned?"取消置顶会话":"置顶会话"}),r.jsx("button",{type:"button",className:"topbar-menu__item",disabled:_n.isPending&&((O=_n.variables)==null?void 0:O.sessionId)===K.id,onClick:()=>{Bt(!1),Ze(!0)},children:"重命名会话"}),r.jsx("button",{type:"button",className:"topbar-menu__item is-danger",disabled:_n.isPending&&((Q=_n.variables)==null?void 0:Q.sessionId)===K.id,onClick:()=>void si(K.id,"delete"),children:"删除会话"})]}):null]})},[si,ht,ls,K.id,K.pinned,_n.isPending,(wa=_n.variables)==null?void 0:wa.sessionId]),ol=_.useMemo(()=>Xt||wn?r.jsxs("div",{className:"conversation-topbar__actions",children:[Xt?r.jsxs("div",{className:"conversation-topbar__run-group",children:[r.jsx("button",{type:"button",className:`conversation-topbar__run-button ${Gn?"is-active":""}`,onClick:()=>{Ee(!1),gt(b=>!b)},"aria-expanded":Gn,"aria-haspopup":"dialog","aria-label":"打开项目命令列表",children:r.jsx(Wk,{})}),Gn?r.jsx("div",{className:"conversation-run-popover",role:"dialog","aria-label":"项目命令列表",children:r.jsx(fk,{commands:Ls,nodeRuntime:(ps==null?void 0:ps.node_runtime)??null,error:tl,pendingRunCommandId:xc,pendingKillCommandId:vd,pendingDeleteCommandId:to,isSaving:Ds.isPending,isGenerating:Xr.isPending,isStartingAll:Dt,isStoppingAll:Wn,generationReason:Bi,executionModelLabel:_c,onRun:Md,onRunAll:Rd,onRunAllKill:Cc,onRunKill:Ad,onSave:so,onDelete:Is,onGenerate:rl})}):null]}):null,Xt?r.jsxs("div",{className:"conversation-topbar__run-group",children:[r.jsx("button",{type:"button",className:`conversation-topbar__run-button ${kn?"is-active":""}`,onClick:()=>{gt(!1),Ee(b=>!b)},"aria-expanded":kn,"aria-haspopup":"dialog","aria-label":"打开项目网页列表",children:r.jsx(Yk,{})}),kn?r.jsx("div",{className:"conversation-run-popover",role:"dialog","aria-label":"项目网页列表",children:r.jsx(vk,{websites:yd,error:tl,pendingDeleteWebsiteId:no,isSaving:Os.isPending,isGenerating:Yn.isPending,generationReason:ya,executionModelLabel:_c,onOpen:ll,onSave:ys,onDelete:li,onGenerate:ao})}):null]}):null,Xt||wn?r.jsxs("div",{ref:P,className:"conversation-topbar__view-toggle","aria-label":"切换工作台面板",children:[r.jsx("button",{type:"button",className:`conversation-topbar__view-button ${ae==="code"?"is-active":""}`,onClick:()=>Ia("code"),"aria-pressed":ae==="code","aria-label":"切换到代码会话视图",children:r.jsx(Fk,{})}),Xt?r.jsx("button",{type:"button",className:`conversation-topbar__view-button ${ae==="terminal"?"is-active":""}`,onClick:()=>Ia("terminal"),"aria-pressed":ae==="terminal","aria-label":"切换到终端视图",children:r.jsx(Gk,{})}):null,wn?r.jsx("button",{type:"button",className:`conversation-topbar__view-button ${ae==="git"?"is-active":""}`,onClick:()=>Ia("git"),"aria-pressed":ae==="git","aria-label":"切换到 git 视图",children:r.jsx(Qk,{})}):null]}):null]}):null,[ae,wn,Xt,Bi,ya,Dt,Wn,_c,Xr.isPending,Yn.isPending,Is,rl,li,ao,ll,Md,Rd,Cc,so,ys,Ia,Gn,kn,to,no,xc,Ls,yd,tl,Ds.isPending,Os.isPending]),Ji=r.jsx(lk,{workspace:Za.data??null,history:Ts.data??null,isLoading:Za.isPending,isHistoryLoading:Ts.isFetching,error:pd,historyError:gd,onRefresh:kd,onRefreshHistory:ii,onRequestHistory:Xi,onDiscardFile:Nc,onDiscardAll:Nd,onCommitAll:ri,onSwitchBranch:Cd,onPush:Ed,onLoadWorkspaceFileDiff:Yh,onLoadHistoryFileDiff:Td,pendingAction:qh,compact:sl}),Vh=r.jsx(Ck,{terminals:(Ks==null?void 0:Ks.terminals)??[],activeTerminalId:(bc==null?void 0:bc.id)??null,outputs:xt,error:tl,compact:al||Zs,canToggleFullscreen:ls,isFullscreen:Zs,onSelectTerminal:io,onCloseTerminal:Ec,onToggleFullscreen:oi}),vs=r.jsx(gv,{isDesktopSidebar:ls,sidebarShift:el,isSidebarDragging:ai,composerError:T,onDismissComposerError:Qh,interactionRequests:ni,pendingInteractionRequestId:Fe,onRespondInteraction:wc,parentSession:Ht,backgroundAgentSessions:pc,isBackgroundAgentsOpen:as,planSnapshot:Oh,onToggleBackgroundAgents:Gh,onOpenSession:gs,getBackgroundAgentStatusLabel:yN,getBackgroundAgentAccent:mN,formatBackgroundAgentsLabel:oN,hasBackgroundAgentStrip:fd,commandPanel:ue,isCommandPanelPending:As.isPending||Oa.isPending,onDismissCommandPanel:Sd,onCommandPanelOptionSelect:jd,onCommandPanelTextSubmit:wd,projectId:K.project_id,draft:W,pendingAttachments:be,canSendInput:Yi,isInputLocked:ni.length>0,readOnlyPlaceholder:ni.length>0?"请先处理上方确认请求":void 0,onDraftChange:F,onUploadFiles:Wh,onRemoveAttachment:Zi,onSubmit:xd,showStopIcon:yc,isSendPending:Rs.isPending||As.isPending||Oa.isPending,onInterrupt:kc,isFastModeEnabled:Se,isPlanModeEnabled:oe,isYoloModeEnabled:ie,onToggleFastMode:()=>Re(b=>!b),onTogglePlanMode:()=>Ne(b=>!b),onToggleYoloMode:()=>z(b=>!b),showModeBadges:!0,selectedModel:ve,modelOptions:ke,selectedReasoning:te,onSelectModel:A,onSelectReasoning:b=>je(b),contextUsage:Ys,isContextUsageOpen:vn,onToggleContextUsage:il,contextUsageRingStyle:Ih,usedPercent:Xl,remainingPercent:Lh,usedTokensLabel:Yy((Ys==null?void 0:Ys.used_tokens)??0),totalTokensLabel:Yy((Ys==null?void 0:Ys.total_tokens)??0),showJumpToBottom:Va,onJumpToBottom:Es}),ro=nl?Vh:Ji,Mc=eo||Zs?r.jsxs("div",{ref:k,className:`conversation-main ${ls?"has-desktop-sidebar":""} ${Zs?"is-terminal-fullscreen":""}`,style:{transform:`translateX(${el}px)`,transition:ai?"none":void 0},children:[r.jsxs("div",{className:"conversation-topbar",children:[ls?null:r.jsxs("button",{type:"button",className:"conversation-menu",onClick:bd,"aria-label":"打开侧边栏",children:[r.jsx("span",{}),r.jsx("span",{className:"short"})]}),r.jsx("div",{className:"conversation-topbar__meta",children:r.jsxs("div",{className:"conversation-topbar__title-row",children:[r.jsx("h1",{children:K.title}),Tc]})}),ol]}),r.jsx("div",{ref:E,className:"conversation-scroll",children:r.jsx("div",{className:`session-workbench-surface ${Zs?"is-terminal-fullscreen":""}`,children:ro})})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:`session-detail-workspace ${al?"has-workbench-panel":""}`,children:[r.jsx(Ek,{conversationMainRef:k,conversationScrollRef:E,isDesktopSidebar:ls,sidebarShift:el,isSidebarDragging:ai,title:K.title,titleActions:Tc,topbarActions:ol,onOpenSidebar:bd,threadContent:Th,connectionStatus:he,sessionRecoveryStatus:Be,isConnectionDetailOpen:Ct,onToggleConnectionDetail:Fh,showThinkingStatus:Ph}),al?r.jsx("aside",{ref:N,className:"session-workbench-rail",children:ro}):null]}),Zs?null:vs]}),cl=r.jsxs(r.Fragment,{children:[Bh,Uh,Y&&typeof document<"u"?Er.createPortal(r.jsxs("div",{className:"attachment-lightbox",role:"dialog","aria-modal":"true","aria-label":`预览 ${Y.label}`,children:[r.jsx("button",{type:"button",className:"attachment-lightbox__scrim",onClick:()=>ne(null),"aria-label":"关闭图片预览"}),r.jsxs("div",{className:"attachment-lightbox__panel",children:[r.jsx("button",{type:"button",className:"attachment-lightbox__close",onClick:()=>ne(null),"aria-label":"关闭图片预览",children:r.jsx(qk,{})}),r.jsx("div",{className:"attachment-lightbox__frame",children:r.jsx("img",{src:Y.src,alt:Y.label,className:"attachment-lightbox__image"})}),r.jsxs("div",{className:"attachment-lightbox__meta",children:[r.jsx("div",{className:"attachment-lightbox__title",children:Y.label}),r.jsx("div",{className:"attachment-lightbox__hint",children:Y.meta})]})]})]}),document.body):null]});return t?r.jsxs(r.Fragment,{children:[Mc,cl]}):r.jsxs("div",{ref:j,className:`conversation-page ${R?"has-desktop-sidebar":""}`,style:Hh,onPointerDown:b=>{R||b.pointerType==="mouse"&&b.button!==0||Ui(b.target)||(Sc(b.clientX,b.clientY,b.pointerId),b.currentTarget.setPointerCapture(b.pointerId))},onPointerMove:b=>{if(R)return;const O=ot.current;!O||O.pointerId!==b.pointerId||!jc(b.clientX,b.clientY)||b.preventDefault()},onPointerUp:b=>{if(R)return;const O=ot.current;!O||O.pointerId!==b.pointerId||_d(b.clientX,b.clientY)},onPointerCancel:b=>{if(R)return;const O=ot.current;!O||O.pointerId!==b.pointerId||(ot.current=null,ja(null))},children:[r.jsx(Y3,{open:zh,progress:$h,isDragging:md,desktopPinned:R,isDesktopResizing:ee,onClose:()=>{R||(U(!1),ja(null))},onDesktopResizeStart:b=>{Yt.current=Et.current,pt.current={startX:b,startWidth:Et.current},Z(!0)},currentAgent:pn,projects:rs,sessions:ra,activeSessionId:K.id,onCreateSession:b=>{Rh(b)},onSessionAction:si,onThreadAction:Mh,pendingSessionActionId:_n.isPending?((Xs=_n.variables)==null?void 0:Xs.sessionId)??null:null,pendingThreadActionId:ei.isPending?((Js=ei.variables)==null?void 0:Js.projectId)??null:null}),Mc,cl]})},qN=({mode:n,agentName:t,agentStatus:a,onOpenNodes:l,onCreateThread:c})=>{if(n==="node")return r.jsxs("section",{className:"session-empty-state is-node-mode",children:[r.jsx("div",{className:"session-empty-state__eyebrow",children:"Panda Workspace"}),r.jsx("div",{className:"session-empty-state__actions",children:r.jsx("button",{type:"button",className:"session-empty-state__button is-primary",onClick:l,children:"选择节点"})})]});const u=a==="online";return r.jsxs("section",{className:"session-empty-state is-session-mode",children:[r.jsxs("div",{className:"session-empty-state__status-row",children:[r.jsx("span",{className:`session-empty-state__status-dot is-${u?"online":"offline"}`,"aria-hidden":"true"}),r.jsxs("div",{className:"session-empty-state__eyebrow",children:["节点 · ",t??"当前节点"]})]}),r.jsxs("div",{className:"session-empty-state__actions",children:[c?r.jsx("button",{type:"button",className:"session-empty-state__button is-primary",onClick:c,children:"新建会话"}):null,r.jsx("button",{type:"button",className:"session-empty-state__button",onClick:l,children:"切换节点"})]})]})},Zy=1100,kv="panda:desktop-sidebar-width",Au="panda:desktop-sidebar-width-version",Du="2026-03-24-narrow",FN=300,Nv=232,Io=Nv,QN=460,GN=.4,WN=()=>typeof window>"u"?248:Math.max(0,Math.min(248,window.innerWidth-84)),W1=n=>Math.max(Nv,Math.min(QN,n)),YN=()=>{if(typeof window>"u")return Io;try{const n=window.localStorage.getItem(kv),t=window.localStorage.getItem(Au);if(!n)return window.localStorage.setItem(Au,Du),Io;const a=Number(n);if(!Number.isFinite(a))return window.localStorage.setItem(Au,Du),Io;const c=t!==Du||a===FN||a>Io?Io:a;return window.localStorage.setItem(Au,Du),W1(c)}catch{return Io}},U0=()=>{var Zt,un;const{sessionId:n,agentId:t}=sd({strict:!1}),a=Zr(),l=Vr(),c=_.useRef(null),u=_.useRef(null),[f,p]=_.useState(()=>DS()),[y,m]=_.useState(()=>OS()??Wu()),[S,g]=_.useState(()=>LS()),[x,j]=_.useState(()=>IS()?"directory-picker":"composer"),[k,E]=_.useState(!1),[N,P]=_.useState(()=>typeof window<"u"&&window.innerWidth>=Zy),[H,U]=_.useState(()=>YN()),[R,q]=_.useState(!1),[re,V]=_.useState(null),ee=_.useRef(null),Z=_.useRef(null),W=_.useRef(null),F=_.useRef(H),be=_.useRef(null),pe=_.useRef(null),Y=n?{sessionId:n,agentId:t??f}:{agentId:t??f},{data:ne}=rd({queryKey:yt,scope:Y}),T=(ne==null?void 0:ne.sessions.find(fe=>fe.id===n))??null;_.useEffect(()=>{if(ne){if(t&&ne.agents.some(fe=>fe.id===t)&&(p(t),$r(t),n||m(null)),T!=null&&T.agent_id&&u.current!==T.id){u.current=T.id,p(T.agent_id),m(T.id),g(null),$r(T.agent_id),ws(T.id);return}n||(u.current=null),p(fe=>fe&&ne.agents.some(Ae=>Ae.id===fe)?fe:null),m(fe=>fe&&ne.sessions.some(Ae=>Ae.id===fe)?fe:null)}},[t,T==null?void 0:T.agent_id,T==null?void 0:T.id,n,ne]),_.useEffect(()=>{t||n||f||(PS(),a({to:"/nodes",replace:!0}))},[a,t,n,f]),_.useEffect(()=>{if(!ne||t||n||!f||y)return;const fe=Wu(),Ae=ne.sessions.find(Ie=>Ie.id===fe&&Ie.agent_id===f)??null;Ae&&(m(Ae.id),ws(Ae.id))},[t,n,f,y,ne]);const $=(f?ne==null?void 0:ne.agents.find(fe=>fe.id===f):null)??null,ue=_.useMemo(()=>$?((ne==null?void 0:ne.projects)??[]).filter(fe=>fe.agent_id===$.id):[],[$,ne==null?void 0:ne.projects]),de=_.useMemo(()=>$?((ne==null?void 0:ne.sessions)??[]).filter(fe=>fe.agent_id===$.id).sort((fe,Ae)=>Number(Ae.pinned)-Number(fe.pinned)||+new Date(Ae.last_event_at)-+new Date(fe.last_event_at)):[],[$,ne==null?void 0:ne.sessions]),ve=y&&$?de.find(fe=>fe.id===y)??null:null;_.useEffect(()=>{if(ve)return;let fe=!1,Ae;return ss({sessionId:n,agentId:t??f??($==null?void 0:$.id)??null}).then(Ie=>{fe||(Ae=Ie.client.connectEvents(Ce=>{var tt,qe;const Fe=typeof((tt=Ce.payload)==null?void 0:tt.sessionId)=="string"?Ce.payload.sessionId:null;if(Ce.type==="agent.online"||Ce.type==="snapshot.changed"){l.invalidateQueries({queryKey:yt});return}if(Ce.type==="session.updated"&&Fe){const rn=(qe=Ce.payload)!=null&&qe.sessionPatch&&typeof Ce.payload.sessionPatch=="object"?Ce.payload.sessionPatch:null,vn=l.getQueryData(yt);if(rn&&hh(vn,Fe)){l.setQueryData(yt,zn=>Eu(zn,Fe,rn));return}l.invalidateQueries({queryKey:yt})}}))}),()=>{fe=!0,Ae==null||Ae()}},[ve,$==null?void 0:$.id,l,t,n,f]),_.useEffect(()=>{F.current=H},[H]),_.useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(kv,String(W1(H))),window.localStorage.setItem(Au,Du)}catch{}},[H]),_.useEffect(()=>{if(typeof window>"u")return;const fe=()=>{const Ae=window.innerWidth>=Zy;P(Ae),Ae&&(E(!1),V(null))};return fe(),window.addEventListener("resize",fe),()=>{window.removeEventListener("resize",fe)}},[]),_.useEffect(()=>{if(!R)return;const fe=Ie=>{const Ce=W.current;if(!Ce)return;const Fe=Ie.clientX-Ce.startX,tt=W1(Ce.startWidth+Fe);be.current=tt,pe.current===null&&(pe.current=window.requestAnimationFrame(()=>{pe.current=null;const qe=be.current;qe!==null&&U(qe)}))},Ae=()=>{pe.current!==null&&(window.cancelAnimationFrame(pe.current),pe.current=null);const Ie=be.current??F.current;be.current=null,W.current=null,q(!1),F.current=Ie,U(Ie)};return window.addEventListener("pointermove",fe),window.addEventListener("pointerup",Ae),()=>{window.removeEventListener("pointermove",fe),window.removeEventListener("pointerup",Ae)}},[R]),_.useEffect(()=>()=>{pe.current!==null&&window.cancelAnimationFrame(pe.current)},[]);const A=ns({mutationFn:async fe=>(await ss({sessionId:fe.sessionId})).client.updateSession(fe)}),te=ns({mutationFn:async fe=>(await ss({projectId:fe.projectId})).client.updateThread(fe)}),je=async(fe,Ae,Ie)=>{var tt;const Ce=await A.mutateAsync({sessionId:fe,action:Ae,name:Ie}),Fe=(tt=Ce.affectedSessionIds)!=null&&tt.length?Ce.affectedSessionIds:[fe];if(Ae==="delete"?l.setQueryData(yt,qe=>$3(qe,Fe)):l.setQueryData(yt,qe=>U3(qe,Fe,{...Ae==="rename"&&(Ie!=null&&Ie.trim())?{title:Ie.trim()}:{pinned:Ae==="pin"}})),Ae==="delete"&&y===fe){const qe=Ce.nextSessionId;qe?(ws(qe),m(qe)):(ws(null),m(null))}},Se=async(fe,Ae,Ie)=>{var tt,qe;const Ce=await te.mutateAsync({projectId:fe,action:Ae,name:Ie==null?void 0:Ie.name,orderedProjectIds:Ie==null?void 0:Ie.orderedProjectIds}),Fe=(tt=Ie==null?void 0:Ie.name)==null?void 0:tt.trim();Ae==="pin"||Ae==="unpin"?l.setQueryData(yt,rn=>ph(rn,fe,{pinned:Ae==="pin"})):Ae==="rename"&&Fe?l.setQueryData(yt,rn=>ph(rn,fe,{display_name:Fe})):Ae==="reorder"&&((qe=Ie==null?void 0:Ie.orderedProjectIds)!=null&&qe.length)?l.setQueryData(yt,rn=>H3(rn,Ie.orderedProjectIds??[])):Ae==="remove"||Ae==="archive"?l.setQueryData(yt,rn=>q3(rn,fe)):Ae==="unarchive"&&l.invalidateQueries({queryKey:yt}),ve&&ve.project_id===fe&&(Ae==="remove"||Ae==="archive"||Ae==="unarchive")&&(Ce.nextSessionId?(ws(Ce.nextSessionId),m(Ce.nextSessionId)):(ws(null),m(null)))},Re=async fe=>{$&&($r($.id),ws(null),Yu(null),xu(!1),Ho(fe),g(fe),j("composer"),m(null),await a({to:"/"}))},oe=async()=>{$&&(N||(E(!1),Ge(null)),$r($.id),ws(null),Yu(null),Ho(null),xu(!0),g(null),j("directory-picker"),m(null),await a({to:"/"}))},Ne=async fe=>{await Re(fe)},ie=N?0:WN(),z=N||k,we=N?0:re??(k?ie:0),ke=N?1:ie>0?we/ie:0,_e=!N&&re!==null,Me=N?{"--desktop-sidebar-width":`${H}px`}:void 0,Ge=fe=>{ee.current=fe,V(fe)},at=fe=>fe instanceof Element&&!!fe.closest('button, textarea, input, a, [role="dialog"]'),ht=(fe,Ae,Ie)=>(Z.current={mode:k?"close":"open",startX:fe,startY:Ae,axis:"pending",pointerId:Ie},!0),Bt=(fe,Ae)=>{const Ie=Z.current;if(!Ie)return!1;const Ce=fe-Ie.startX,Fe=Ae-Ie.startY;if(Ie.axis==="pending"){if(Math.abs(Ce)<8&&Math.abs(Fe)<8)return!1;if(Ie.axis=Math.abs(Ce)>Math.abs(Fe)?"x":"y",Ie.axis==="y")return Z.current=null,Ge(null),!1}const tt=Ie.mode==="open"?Math.max(0,Math.min(ie,Ce)):Math.max(0,Math.min(ie,ie+Ce));return Ge(tt),!0},Ut=(fe,Ae)=>{const Ie=Z.current;if(!Ie)return;const Ce=fe-Ie.startX,Fe=Ae-Ie.startY;if(Ie.axis==="pending"&&Math.abs(Fe)>48){Z.current=null,Ge(null);return}const qe=(Ie.axis==="x"?ee.current??(Ie.mode==="open"?Math.max(0,Math.min(ie,Ce)):Math.max(0,Math.min(ie,ie+Ce))):k?ie:0)>=ie*GN;E(qe),Z.current=null,Ge(null)},Ze=()=>r.jsx(r.Fragment,{children:r.jsxs("div",{className:`conversation-main ${N?"has-desktop-sidebar":""}`,style:{transform:`translateX(${we}px)`,transition:_e?"none":void 0},children:[r.jsx("div",{className:"conversation-topbar",children:N?null:r.jsxs("button",{type:"button",className:"conversation-menu",onClick:()=>E(!0),"aria-label":"打开侧边栏",children:[r.jsx("span",{}),r.jsx("span",{className:"short"})]})}),r.jsx("div",{className:"conversation-scroll conversation-scroll--empty",children:r.jsx("div",{className:"conversation-thread conversation-thread--empty",children:r.jsx(qN,{mode:"node",agentName:$==null?void 0:$.name,agentStatus:($==null?void 0:$.status)??null,onOpenNodes:()=>{a({to:"/nodes"})}})})})]})});return r.jsxs("div",{ref:c,className:`conversation-page ${N?"has-desktop-sidebar":""}`,style:Me,onPointerDown:fe=>{N||fe.pointerType==="mouse"&&fe.button!==0||at(fe.target)||(ht(fe.clientX,fe.clientY,fe.pointerId),fe.currentTarget.setPointerCapture(fe.pointerId))},onPointerMove:fe=>{if(N)return;const Ae=Z.current;!Ae||Ae.pointerId!==fe.pointerId||!Bt(fe.clientX,fe.clientY)||fe.preventDefault()},onPointerUp:fe=>{if(N)return;const Ae=Z.current;!Ae||Ae.pointerId!==fe.pointerId||Ut(fe.clientX,fe.clientY)},onPointerCancel:fe=>{if(N)return;const Ae=Z.current;!Ae||Ae.pointerId!==fe.pointerId||(Z.current=null,Ge(null))},children:[r.jsx(Y3,{open:z,progress:ke,isDragging:_e,desktopPinned:N,isDesktopResizing:R,onClose:()=>{N||(E(!1),Ge(null))},onDesktopResizeStart:fe=>{be.current=F.current,W.current={startX:fe,startWidth:F.current},q(!0)},currentAgent:$??void 0,projects:ue,sessions:de,activeSessionId:ve==null?void 0:ve.id,onCreateSession:fe=>{Ne(fe)},onCreateDirectoryThread:()=>{oe()},onSelectSession:fe=>{g(null),j("composer"),xu(!1),Ho(null),m(fe),ws(fe)},onSessionAction:je,onThreadAction:Se,pendingSessionActionId:A.isPending?((Zt=A.variables)==null?void 0:Zt.sessionId)??null:null,pendingThreadActionId:te.isPending?((un=te.variables)==null?void 0:un.projectId)??null:null}),$?ve?r.jsx(HN,{sessionId:ve.id,embedded:!0,isDesktopSidebar:N,sidebarOffset:we,isSidebarDragging:_e,onOpenSidebar:()=>E(!0),onSelectSession:fe=>{m(fe),ws(fe)},onExitToNodes:()=>{m(null),a({to:"/nodes"})}}):r.jsx(Ww,{currentAgent:$,projects:ue,sessions:de,initialProjectId:S,entryView:x,isDesktopSidebar:N,sidebarOffset:we,isSidebarDragging:_e,onOpenSidebar:()=>E(!0),onProjectSelected:fe=>{g(fe),j("composer"),xu(!1)},onSessionCreated:fe=>{g(null),j("composer"),xu(!1),Ho(null),m(fe),ws(fe)}}):Ze()]})},Cv=1,VN=10080*60*1e3,Ev="panda-web-cache",uc="app-state",Tv="react-query",Xy="panda:storage-persist-result",KN=new Set(["bootstrap","timeline","timeline-optimistic","change-sets","plan","interactions","codex-commands","project-skills","settings-connection"]),$0=()=>typeof window<"u"&&typeof window.indexedDB<"u",ZN=n=>typeof n[0]=="string"&&KN.has(n[0]),Mv=async()=>$0()?await new Promise((n,t)=>{const a=window.indexedDB.open(Ev,1);a.onupgradeneeded=()=>{const l=a.result;l.objectStoreNames.contains(uc)||l.createObjectStore(uc)},a.onsuccess=()=>n(a.result),a.onerror=()=>t(a.error??new Error("Unable to open Panda cache database."))}):null,XN=async()=>{const n=await Mv();if(!n)return null;try{return await new Promise((t,a)=>{const u=n.transaction(uc,"readonly").objectStore(uc).get(Tv);u.onsuccess=()=>t(u.result??null),u.onerror=()=>a(u.error??new Error("Unable to read Panda cache record."))})}finally{n.close()}},JN=async n=>{const t=await Mv();if(t)try{await new Promise((a,l)=>{const c=t.transaction(uc,"readwrite");c.objectStore(uc).put(n,Tv),c.oncomplete=()=>a(),c.onerror=()=>l(c.error??new Error("Unable to write Panda cache record.")),c.onabort=()=>l(c.error??new Error("Writing Panda cache record was aborted."))})}finally{t.close()}},Y1=async()=>{$0()&&await new Promise(n=>{const t=window.indexedDB.deleteDatabase(Ev);t.onsuccess=()=>n(),t.onerror=()=>n(),t.onblocked=()=>n()})},eC=async n=>{if($0())try{const t=await XN();if(!t)return;const a=Date.now()-t.persistedAt>VN;if(t.version!==Cv||a){await Y1();return}w5(n,t.clientState)}catch{await Y1().catch(()=>{})}},tC=async()=>{if(!(typeof navigator>"u"||typeof window>"u"||!("storage"in navigator)||typeof navigator.storage.persist!="function"))try{if(window.localStorage.getItem(Xy))return;const t=await navigator.storage.persist();window.localStorage.setItem(Xy,t?"granted":"denied")}catch{}},nC=n=>{if(typeof window>"u")return()=>{};tC();let t=null,a=null,l=!1,c=!1;const u=async()=>{if(!c){if(a){l=!0;return}a=(async()=>{const S=j5(n,{shouldDehydrateQuery:g=>ZN(g.queryKey)});await JN({version:Cv,persistedAt:Date.now(),clientState:S})})();try{await a}catch{}finally{a=null,l&&(l=!1,u())}}},f=(S=!1)=>{if(!c){if(t!==null&&(window.clearTimeout(t),t=null),S){u();return}t=window.setTimeout(()=>{t=null,u()},1200)}},p=n.getQueryCache().subscribe(()=>{f(!1)}),y=()=>{document.visibilityState==="hidden"&&f(!0)},m=()=>{f(!0)};return document.addEventListener("visibilitychange",y),window.addEventListener("pagehide",m),()=>{c=!0,p(),document.removeEventListener("visibilitychange",y),window.removeEventListener("pagehide",m),t!==null&&(window.clearTimeout(t),t=null)}},sC=async()=>{if(await Y1().catch(()=>{}),"serviceWorker"in navigator){const t=await navigator.serviceWorker.getRegistrations();await Promise.all(t.map(a=>a.unregister()))}if("caches"in window){const t=await window.caches.keys();await Promise.all(t.map(a=>window.caches.delete(a)))}const n=window.indexedDB;if(typeof n.databases=="function"){const t=await n.databases();await Promise.all(t.map(a=>a.name).filter(a=>!!a).map(a=>new Promise(l=>{const c=n.deleteDatabase(a);c.onsuccess=()=>l(),c.onerror=()=>l(),c.onblocked=()=>l()})))}window.localStorage.clear(),window.sessionStorage.clear()},H0="panda:pwa-install-log",aC=48,es=n=>((n==null?void 0:n.trim())??"")||null,Rv=()=>{if(typeof window>"u")return[];try{const n=window.localStorage.getItem(H0);if(!n)return[];const t=JSON.parse(n);return Array.isArray(t)?t.map(a=>{if(!a||typeof a!="object")return null;const l=a;return typeof l.id!="string"||typeof l.timestamp!="string"||typeof l.kind!="string"||typeof l.message!="string"?null:{id:l.id,timestamp:l.timestamp,kind:l.kind,message:l.message,detail:es(l.detail)}}).filter(a=>!!a).sort((a,l)=>+new Date(l.timestamp)-+new Date(a.timestamp)):[]}catch{return[]}},iC=n=>{if(!(typeof window>"u"))try{window.localStorage.setItem(H0,JSON.stringify(n.slice(0,aC)))}catch{}},rC=()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem(H0)}catch{}},wr=n=>{const t=Rv(),a={id:`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,timestamp:new Date().toISOString(),kind:n.kind,message:n.message.trim(),detail:es(n.detail)};return iC([a,...t]),a},Jy=(n,t)=>{var a;return((a=n.find(l=>l.kind===t))==null?void 0:a.timestamp)??null},lC=async n=>{const t=await fetch(n,{cache:"no-store"});if(!t.ok)throw new Error(`HTTP ${t.status}`);return await t.json()},oC=async n=>{try{let t=await fetch(n,{method:"HEAD",cache:"no-store"});return(t.status===405||t.status===501)&&(t=await fetch(n,{method:"GET",cache:"no-store"})),{ok:t.ok,status:t.status,error:null}}catch(t){return{ok:!1,status:null,error:t instanceof Error?t.message:"Unknown fetch failure"}}},cC=async()=>{if(typeof document>"u"||typeof window>"u")return{href:null,present:!1,ok:!1,error:"Document is unavailable.",id:null,name:null,shortName:null,startUrl:null,scope:null,display:null,displayOverride:[],themeColor:null,backgroundColor:null,icons:[]};const n=document.querySelector('link[rel~="manifest"]'),t=es(n==null?void 0:n.href);if(!t)return{href:null,present:!1,ok:!1,error:"页面没有 manifest 链接。",id:null,name:null,shortName:null,startUrl:null,scope:null,display:null,displayOverride:[],themeColor:null,backgroundColor:null,icons:[]};try{const a=await lC(t),l=Array.isArray(a.icons)?a.icons:[],c=await Promise.all(l.slice(0,8).map(async u=>{const f=u,p=es(typeof f.src=="string"?f.src:null);if(!p)return{src:"(missing)",purpose:es(typeof f.purpose=="string"?f.purpose:null),sizes:es(typeof f.sizes=="string"?f.sizes:null),type:es(typeof f.type=="string"?f.type:null),ok:!1,status:null,error:"Icon src is missing."};const y=new URL(p,t).toString(),m=await oC(y);return{src:y,purpose:es(typeof f.purpose=="string"?f.purpose:null),sizes:es(typeof f.sizes=="string"?f.sizes:null),type:es(typeof f.type=="string"?f.type:null),ok:m.ok,status:m.status,error:m.error}}));return{href:t,present:!0,ok:!0,error:null,id:es(typeof a.id=="string"?a.id:null),name:es(typeof a.name=="string"?a.name:null),shortName:es(typeof a.short_name=="string"?a.short_name:null),startUrl:es(typeof a.start_url=="string"?a.start_url:null),scope:es(typeof a.scope=="string"?a.scope:null),display:es(typeof a.display=="string"?a.display:null),displayOverride:Array.isArray(a.display_override)?a.display_override.filter(u=>typeof u=="string"):[],themeColor:es(typeof a.theme_color=="string"?a.theme_color:null),backgroundColor:es(typeof a.background_color=="string"?a.background_color:null),icons:c}}catch(a){return{href:t,present:!0,ok:!1,error:a instanceof Error?a.message:"Manifest fetch failed.",id:null,name:null,shortName:null,startUrl:null,scope:null,display:null,displayOverride:[],themeColor:null,backgroundColor:null,icons:[]}}},uC=async()=>{if(typeof navigator>"u"||!("serviceWorker"in navigator))return{supported:!1,controller:!1,registrations:[]};try{const n=await navigator.serviceWorker.getRegistrations();return{supported:!0,controller:!!navigator.serviceWorker.controller,registrations:n.map(t=>{var a,l,c;return{scope:t.scope,activeScriptUrl:((a=t.active)==null?void 0:a.scriptURL)??null,waitingScriptUrl:((l=t.waiting)==null?void 0:l.scriptURL)??null,installingScriptUrl:((c=t.installing)==null?void 0:c.scriptURL)??null}})}}catch{return{supported:!0,controller:!!navigator.serviceWorker.controller,registrations:[]}}},dC=n=>{const t=n.standaloneDisplayMode||n.navigatorStandalone;return t&&n.appInstalledSeen?{label:"较像已安装应用",confidence:"medium",detail:"当前页面正以独立窗口打开,并且这个站点记录到过 appinstalled 事件,更像是真正安装后的应用入口。"}:t?{label:"更像主屏幕快捷方式",confidence:"medium",detail:"当前页面虽然已脱离浏览器标签页,但站点本地没有观测到 appinstalled 事件,无法证明系统级安装已经完成,更像是主屏幕快捷方式。"}:n.installPromptAvailable?{label:"可触发安装流程",confidence:"high",detail:"浏览器已经提供 beforeinstallprompt 事件,设置页里的安装按钮可以主动弹出安装流程。"}:n.beforeInstallPromptSeen?{label:"浏览器曾允许安装",confidence:"low",detail:"站点历史上收到过 beforeinstallprompt,但当前页面没有可用的安装事件,可能需要刷新页面、重新访问或等待浏览器重新评估。"}:{label:"当前不像可安装应用",confidence:"medium",detail:"浏览器当前没有给出可用的安装事件,页面更像普通标签页或只能走“添加到主屏幕”的快捷方式链路。"}},fC=n=>{const t=[];if(n.secureContext||t.push("当前页面不是安全上下文,Chrome 不会提供完整的 PWA 安装链路。"),!n.manifest.present)t.push("页面没有 manifest 链接,浏览器无法把当前站点识别为可安装 Web App。");else if(!n.manifest.ok)t.push(`manifest 读取失败:${n.manifest.error??"未知错误"}。`);else{(!n.manifest.display||n.manifest.display==="browser")&&t.push("manifest 没有声明 standalone/minimal-ui 显示模式,浏览器更可能只给快捷方式。"),!n.manifest.name&&!n.manifest.shortName&&t.push("manifest 缺少 name/short_name,安装身份信息不完整。");const l=n.manifest.icons.some(f=>f.ok&&(f.sizes??"").includes("192x192")),c=n.manifest.icons.some(f=>f.ok&&(f.sizes??"").includes("512x512"));(!l||!c)&&t.push("manifest 图标里缺少可访问的 192x192 或 512x512 图标,Android 安装链路可能会退化。");const u=n.manifest.icons.filter(f=>!f.ok);u.length>0&&t.push(`有 ${u.length} 个 manifest 图标资源探测失败,安装时可能因为图标拉取失败而退化或失败。`)}return n.serviceWorker.supported?n.serviceWorker.registrations.length===0&&t.push("当前页面没有检测到 Service Worker 注册,Chrome 往往不会提供完整安装流程。"):t.push("当前浏览器不支持 Service Worker,无法满足完整的 PWA 安装条件。"),!n.installPromptAvailable&&!n.launchedStandalone&&n.secureContext&&n.manifest.ok&&n.serviceWorker.registrations.length>0&&t.push("浏览器当前没有下发 beforeinstallprompt,设置页按钮无法主动触发安装,只能走浏览器菜单的安装/添加到主屏幕入口。"),n.logs.find(l=>{var c;return l.kind==="install-choice"&&((c=l.detail)==null?void 0:c.toLowerCase().includes("accepted"))})&&!n.appInstalledSeen&&t.push("站点记录到用户接受过安装请求,但没有后续 appinstalled 事件,更像是浏览器回退成快捷方式,或系统级安装没有完成。"),n.launchedStandalone&&!n.appInstalledSeen&&t.push("当前虽然是独立窗口形态,但没有观测到 appinstalled,不能把它视为已经完成系统级安装。"),t},hC=async n=>{const t=Rv(),[a,l]=await Promise.all([cC(),uC()]),c=navigator,u=typeof window<"u"&&window.matchMedia("(display-mode: standalone)").matches,f=c.standalone===!0,p=t.some(j=>j.kind==="beforeinstallprompt"),y=t.some(j=>j.kind==="appinstalled"),m=(n==null?void 0:n.installPromptAvailable)===!0,S=u||f,g=[];window.isSecureContext&&g.push("当前是安全上下文。"),a.ok&&g.push("manifest 可读取。"),l.registrations.length>0&&g.push(`检测到 ${l.registrations.length} 个 Service Worker 注册。`),m&&g.push("浏览器已提供可调用的安装事件。"),y&&g.push("站点本地记录到过 appinstalled 事件。");const x=["从桌面图标打开后,确认没有浏览器地址栏或标签栏。","到 Android“设置 -> 应用”里搜索 Panda,若能搜到,更像系统级安装。","到应用抽屉里搜索 Panda;若只在桌面可见而应用抽屉里没有,更像快捷方式。","如果日志里只有“添加到主屏幕”链路,没有 appinstalled,通常不能认定为真正安装完成。"];return{capturedAt:new Date().toISOString(),environment:{href:typeof window>"u"?null:window.location.href,origin:typeof window>"u"?null:window.location.origin,secureContext:typeof window<"u"?window.isSecureContext:!1,online:typeof navigator<"u"&&typeof navigator.onLine=="boolean"?navigator.onLine:null,userAgent:typeof navigator>"u"?null:navigator.userAgent,isAndroid:typeof navigator<"u"?/Android/i.test(navigator.userAgent):!1,standaloneDisplayMode:u,navigatorStandalone:f},promptState:{installPromptAvailable:m,beforeInstallPromptSeen:p,appInstalledSeen:y,lastBeforeInstallPromptAt:Jy(t,"beforeinstallprompt"),lastAppInstalledAt:Jy(t,"appinstalled")},manifest:a,serviceWorker:l,assessment:dC({standaloneDisplayMode:u,navigatorStandalone:f,installPromptAvailable:m,beforeInstallPromptSeen:p,appInstalledSeen:y}),failureReasons:fC({secureContext:typeof window<"u"?window.isSecureContext:!1,manifest:a,serviceWorker:l,installPromptAvailable:m,appInstalledSeen:y,launchedStandalone:S,logs:t}),successSignals:g,confirmationChecklist:x,logs:t}},e2=980,If=[{id:"theme",title:"主题",description:"调整界面的颜色风格。",icon:"theme"},{id:"models",title:"模型维护",description:"维护可选模型、默认模型和展示顺序。",icon:"models"},{id:"cache",title:"缓存",description:"解决页面没更新的问题。",icon:"cache"},{id:"notifications",title:"移动提醒",description:"安装到桌面,并在对话完成后接收系统通知。",icon:"notifications"},{id:"installation",title:"安装诊断",description:"判断当前是不是安装版,并分析为什么安装失败。",icon:"installation"},{id:"connection",title:"连接状态",description:"查看现在连到哪台设备。",icon:"connection"}],mC=[{value:"light",label:"浅色",icon:"sun"},{value:"dark",label:"深色",icon:"moon"},{value:"system",label:"系统",icon:"system"}],pC=(n,t,a,l)=>["const pandaTheme = {",` codeThemeId: "${n}",`,` accent: "${t.toLowerCase()}",`,` contrast: ${a},`,` opaqueWindows: ${l},`,"}"],gC=()=>r.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:r.jsx("path",{d:"m15 6-6 6 6 6"})}),yC=({open:n})=>r.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:r.jsx("path",{d:n?"m6 9 6 6 6-6":"m9 6 6 6-6 6"})}),vC=()=>r.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:r.jsx("path",{d:"M9 6h.01M9 12h.01M9 18h.01M15 6h.01M15 12h.01M15 18h.01"})}),_C=()=>r.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:r.jsx("path",{d:"M12 5v14M5 12h14"})}),bC=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.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"}),r.jsx("path",{d:"m13.5 6.5 4 4"})]}),xC=()=>r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M4.5 7h15"}),r.jsx("path",{d:"M9.5 4.5h5"}),r.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"}),r.jsx("path",{d:"M10 10.5v5.2"}),r.jsx("path",{d:"M14 10.5v5.2"})]}),SC=()=>r.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:r.jsx("path",{d:"m12 6-5 5M12 6l5 5M12 6v12"})}),jC=()=>r.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:r.jsx("path",{d:"m12 18-5-5M12 18l5-5M12 18V6"})}),t2=({icon:n})=>n==="cache"?r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.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"}),r.jsx("path",{d:"M5 8.5v7c0 1.93 3.13 3.5 7 3.5s7-1.57 7-3.5v-7"}),r.jsx("path",{d:"M5 12c0 1.93 3.13 3.5 7 3.5s7-1.57 7-3.5"})]}):n==="models"?r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M5 7.5h14M5 12h14M5 16.5h14"}),r.jsx("path",{d:"M8 5.5h.01M8 10h.01M8 14.5h.01"})]}):n==="connection"?r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.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"}),r.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"})]}):n==="notifications"?r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.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"}),r.jsx("path",{d:"M10 18.25a2.1 2.1 0 0 0 4 0"})]}):n==="installation"?r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M12 3.75v10.5"}),r.jsx("path",{d:"m8.5 10.75 3.5 3.5 3.5-3.5"}),r.jsx("path",{d:"M5.25 16.75h13.5"}),r.jsx("path",{d:"M6 19.25h12"})]}):r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.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"}),r.jsx("circle",{cx:"12",cy:"12",r:"3.85"})]}),wC=({icon:n,active:t})=>{const a=t?2:1.8;return n==="sun"?r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:a,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("circle",{cx:"12",cy:"12",r:"4.1"}),r.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"})]}):n==="moon"?r.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:a,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:r.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"})}):r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:a,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("rect",{x:"3.5",y:"5",width:"17",height:"12",rx:"2.4"}),r.jsx("path",{d:"M8 19h8"})]})},kC=({title:n,caption:t,accent:a,background:l,foreground:c,lines:u})=>r.jsxs("div",{className:"theme-preview-panel",style:{"--preview-accent":a,"--preview-background":l,"--preview-foreground":c},children:[r.jsxs("div",{className:"theme-preview-panel__meta",children:[r.jsx("span",{children:n}),r.jsx("span",{children:t})]}),r.jsx("pre",{className:"theme-preview-panel__code","aria-label":`${n} 主题预览`,children:u.map(f=>r.jsx("code",{children:f},f))})]}),Po=({label:n,value:t})=>r.jsxs("div",{className:"settings-row settings-row--token",children:[r.jsx("div",{className:"settings-row__copy",children:r.jsx("span",{className:"settings-row__label",children:n})}),r.jsxs("div",{className:"theme-token",children:[r.jsx("span",{className:"theme-token__swatch",style:{"--token-color":t}}),r.jsx("span",{children:t})]})]}),Pf=({label:n,value:t})=>r.jsxs("div",{className:"settings-row settings-row--token",children:[r.jsx("div",{className:"settings-row__copy",children:r.jsx("span",{className:"settings-row__label",children:n})}),r.jsx("div",{className:"theme-token",children:t})]}),n2=({label:n,value:t,mono:a})=>r.jsxs("div",{className:"settings-row settings-row--token",children:[r.jsx("div",{className:"settings-row__copy",children:r.jsx("span",{className:"settings-row__label",children:n})}),r.jsx("div",{className:`theme-token theme-token--font ${a?"is-mono":""}`,children:t})]}),s2=({label:n,value:t,onChange:a,min:l,max:c})=>r.jsxs("div",{className:"settings-row settings-row--size",children:[r.jsx("div",{className:"settings-row__copy",children:r.jsx("span",{className:"settings-row__label",children:n})}),r.jsxs("div",{className:"theme-stepper",children:[r.jsx("button",{type:"button",className:"theme-stepper__button",onClick:()=>a(t-1),"aria-label":`${n} 减小 1px`,children:"-"}),r.jsxs("label",{className:"theme-stepper__input-wrap",children:[r.jsx("input",{className:"theme-stepper__input",type:"number",min:l,max:c,step:1,value:t,onChange:u=>a(Number(u.target.value))}),r.jsx("span",{children:"px"})]}),r.jsx("button",{type:"button",className:"theme-stepper__button",onClick:()=>a(t+1),"aria-label":`${n} 增大 1px`,children:"+"})]})]}),a2=(n,t,a,l)=>{if(t===a)return n;const c=n.findIndex(S=>S.id===t),u=n.findIndex(S=>S.id===a);if(c<0||u<0)return n;const f=[...n],[p]=f.splice(c,1);if(!p)return n;const y=f.findIndex(S=>S.id===a),m=l==="before"?y:y+1;return f.splice(m,0,p),f},ku=n=>{if(!n)return"未记录";const t=new Date(n);return Number.isNaN(t.getTime())?n:t.toLocaleString("zh-CN",{hour12:!1})},zf=n=>typeof n!="number"||!Number.isFinite(n)?"未测得":`${Math.max(0,Math.round(n))} ms`,Av=n=>{const t=(n==null?void 0:n.trim())??"";return t?t.replace(/\/+$/,""):""},r1=async(n,t)=>{const a=Av(t),l=new Date().toISOString();if(!a)return{label:n,url:"",healthOk:!1,latencyMs:null,checkedAt:l,error:"地址为空"};const c=new AbortController,u=window.setTimeout(()=>c.abort(),5e3),f=typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now();try{const p=await fetch(`${a}/health`,{cache:"no-store",signal:c.signal}),y=typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now();return{label:n,url:a,healthOk:p.ok,latencyMs:y-f,checkedAt:l,error:p.ok?null:`HTTP ${p.status}`}}catch(p){return{label:n,url:a,healthOk:!1,latencyMs:null,checkedAt:l,error:p instanceof Error?p.message:"连接失败"}}finally{clearTimeout(u)}},NC=()=>{var jn;const n=Zr(),t=Vr(),{data:a}=rd(),[l,c]=_.useState(!1),[u,f]=_.useState(null),[p,y]=_.useState(null),[m,S]=_.useState("theme"),[g,x]=_.useState(null),[j,k]=_.useState(()=>typeof window<"u"&&window.innerWidth>=e2),[E,N]=_.useState(()=>I1()),[P,H]=_.useState(()=>qo()),[U,R]=_.useState(()=>oc()),[q,re]=_.useState(()=>P1()),[V,ee]=_.useState(!1),[Z,W]=_.useState(!1),[F,be]=_.useState(null),[pe,Y]=_.useState(!1),[ne,T]=_.useState(()=>$o()),[$,ue]=_.useState(()=>sy()),[de,ve]=_.useState(0),A=Ta(C=>C.themeSettings),te=Ta(C=>C.resolvedTheme),je=Ta(C=>C.systemAppearance),Se=Ta(C=>C.setThemeMode),Re=Ta(C=>C.setLightThemeId),oe=Ta(C=>C.setDarkThemeId),Ne=Ta(C=>C.setUiFontSize),ie=Ta(C=>C.setCodeFontSize),z=L0(),[we,ke]=_.useState(()=>D0()),[_e,Me]=_.useState(()=>Qf()),[Ge,at]=_.useState(null),[ht,Bt]=_.useState(()=>ju()),[Ut,Ze]=_.useState(null),[Zt,un]=_.useState(null),[fe,Ae]=_.useState(null),Ie=typeof window>"u"?null:Wu(),Ce=(a==null?void 0:a.sessions.find(C=>C.id===Ie))??(a==null?void 0:a.sessions.find(C=>C.id===a.active_session_id))??(a==null?void 0:a.sessions.find(C=>!C.archived))??(a==null?void 0:a.sessions[0]),Fe=(a==null?void 0:a.agents.find(C=>C.id===(Ce==null?void 0:Ce.agent_id)))??(a==null?void 0:a.agents[0]),tt=Av(Fe==null?void 0:Fe.direct_base_url),qe=ks({queryKey:["settings-connection",(Fe==null?void 0:Fe.id)??"",tt],queryFn:async()=>{const C=await ss(),[ge,lt,ot]=await Promise.all([r1(C.label,C.baseUrl),r1("Panda Hub",fc),tt?r1((Fe==null?void 0:Fe.name)??"当前节点",tt):Promise.resolve(null)]);return{modeLabel:C.mode==="hub"?"通过 Panda Hub":"直接连接",backendLabel:C.label,backendUrl:C.baseUrl,healthOk:ge.healthOk,latencyMs:ge.latencyMs,checkedAt:ge.checkedAt,activeProbe:ge,hubProbe:lt,agentProbe:ot}},enabled:m==="connection"||g==="connection",staleTime:0,refetchOnWindowFocus:!1}),rn=ks({queryKey:["codex-commands"],queryFn:async()=>(await ss()).client.getCodexCommands(),staleTime:0,refetchOnWindowFocus:!1}),vn=()=>{ve(C=>C+1)},zn=ks({queryKey:["pwa-install-diagnostics",de,!!F,ne],queryFn:async()=>hC({installPromptAvailable:!!F}),enabled:m==="installation"||g==="installation",staleTime:0,refetchOnWindowFocus:!1}),as=ns({mutationFn:async()=>(await ss()).client.refreshCodexCommands(),onMutate:()=>{f(null)},onSuccess:async C=>{t.setQueryData(["codex-commands"],C),await t.invalidateQueries({queryKey:["codex-commands"]}),f(`命令目录已刷新,共 ${C.commands.length} 条,CLI 版本 ${C.cli_version??"未知"}。`)},onError:C=>{f(C instanceof Error?C.message:"刷新命令目录失败。")}});_.useEffect(()=>{if(typeof window>"u")return;const C=()=>{const ge=window.innerWidth>=e2;k(ge)};return C(),window.addEventListener("resize",C),()=>{window.removeEventListener("resize",C)}},[]),_.useEffect(()=>{f(null)},[(jn=qe.data)==null?void 0:jn.backendUrl]),_.useEffect(()=>{j&&x(m)},[m,j]),_.useEffect(()=>{Ze(null)},[m]),_.useEffect(()=>{if(typeof window>"u")return;const C=ot=>{ot.preventDefault(),be(ot),wr({kind:"beforeinstallprompt",message:"浏览器提供了可调用的安装事件。",detail:window.location.href}),vn()},ge=()=>{be(null),T(!0),y("应用已安装到桌面。"),wr({kind:"appinstalled",message:"站点收到 appinstalled 事件。",detail:"浏览器报告安装流程已经完成或被接受。"}),vn()},lt=()=>{H(qo()),N(I1()),T($o()),ue(sy()),wr({kind:"visibilitychange",message:`页面切换为 ${document.visibilityState}。`,detail:`standalone=${$o()?"yes":"no"}`}),vn()};return window.addEventListener("beforeinstallprompt",C),window.addEventListener("appinstalled",ge),document.addEventListener("visibilitychange",lt),()=>{window.removeEventListener("beforeinstallprompt",C),window.removeEventListener("appinstalled",ge),document.removeEventListener("visibilitychange",lt)}},[]),_.useEffect(()=>{if(z.length===0||z.some(ge=>ge.value===we))return;const C=z[0].value;Pu(C),ke(C)},[z,we]),_.useEffect(()=>{var ge;if(z.length===0||z.some(lt=>lt.value===_e))return;const C=((ge=z.find(lt=>lt.value==="gpt-5.4-mini"))==null?void 0:ge.value)??z[0].value;Jp(C),Me(C)},[_e,z]),_.useEffect(()=>{const C=()=>{H(qo()),R(oc()),re(P1())};return C(),window.addEventListener("focus",C),document.addEventListener("visibilitychange",C),()=>{window.removeEventListener("focus",C),document.removeEventListener("visibilitychange",C)}},[]),_.useEffect(()=>{if(P!=="granted"||!E.completionNotificationsEnabled||!U)return;let C=!1;return ee(!0),CS(E).then(ge=>{C||re(ge.synced)}).catch(()=>{C||re(!1)}).finally(()=>{C||ee(!1)}),()=>{C=!0}},[U,P,E]);const Sn=()=>{if(Ce!=null&&Ce.id){$r(Ce.agent_id),ws(Ce.id),n({to:"/"});return}n({to:"/nodes"})},ae=async()=>{f(null),c(!0);try{await sC(),f("缓存已清理,正在重新载入…"),window.setTimeout(()=>{window.location.replace(`/settings?cache-reset=${Date.now()}`)},180)}catch{c(!1),f("清理失败,请在浏览器设置中手动清理站点数据。")}},$e=async()=>{if(y(null),P!=="granted"){const C=await NS();if(H(C),C==="granted"){if(!U){const ge={completionNotificationsEnabled:!0};bu(ge),N(ge),y("系统通知已开启,但当前环境不支持后台 Web Push。");return}ee(!0);try{const ge={completionNotificationsEnabled:!0};await ny(ge),bu(ge),N(ge),re(!0),y("系统通知和后台 Web Push 都已开启。");return}catch(ge){re(!1),y(ge instanceof Error?ge.message:"通知权限已开启,但 Web Push 订阅失败。");return}finally{ee(!1)}}if(C==="denied"){y("系统通知已被拒绝,请到浏览器或系统设置里重新开启。");return}y("还没有拿到通知权限,可以稍后再试一次。");return}if(E.completionNotificationsEnabled){ee(!0);try{await ES();const C={completionNotificationsEnabled:!1};bu(C),N(C),re(!1),y("完成提醒已关闭,后台推送订阅也已移除。")}catch(C){y(C instanceof Error?C.message:"关闭 Web Push 订阅失败。")}finally{ee(!1)}return}if(!U){const C={completionNotificationsEnabled:!0};bu(C),N(C),y("当前环境不支持后台 Web Push,只能在页面在线时提醒。");return}ee(!0);try{const C={completionNotificationsEnabled:!0};await ny(C),bu(C),N(C),re(!0),y("完成提醒已开启,Hub 会在会话完成后推送到这台手机。")}catch(C){re(!1),y(C instanceof Error?C.message:"开启 Web Push 失败。")}finally{ee(!1)}},De=async()=>{y(null),W(!0);try{await TS(),y("测试推送已发出,请看手机或当前设备的通知栏。")}catch(C){y(C instanceof Error?C.message:"发送测试推送失败。")}finally{W(!1)}},We=async()=>{if(!F){wr({kind:"install-unavailable",message:"当前页面没有可用的安装事件。",detail:$?"浏览器没有下发 beforeinstallprompt,只能走菜单里的安装应用或添加到主屏幕。":"当前浏览器没有提供可调用的安装对话框。"}),vn(),y($?"请在浏览器菜单里选择“安装应用”或“添加到主屏幕”。":"当前浏览器没有提供安装弹窗,请使用浏览器的“添加到主屏幕”。");return}Y(!0),y(null),wr({kind:"install-button-click",message:"用户点击了设置页里的安装按钮。",detail:"准备调用浏览器安装对话框。"}),vn();try{wr({kind:"install-prompt-shown",message:"已调用浏览器安装对话框。",detail:"等待用户在系统安装弹窗里做出选择。"}),await F.prompt();const C=await F.userChoice;wr({kind:"install-choice",message:C.outcome==="accepted"?"用户接受了安装请求。":"用户取消了安装请求。",detail:`outcome=${C.outcome}; platform=${C.platform}`}),vn(),C.outcome==="accepted"?y("安装请求已提交,请回到桌面查看。"):y("你取消了这次安装。")}catch(C){wr({kind:"install-error",message:"调用浏览器安装流程时报错。",detail:C instanceof Error?C.message:"Unknown install error"}),vn(),y("浏览器没有完成安装流程,请查看下方安装诊断。")}finally{be(null),Y(!1),T($o()),vn()}},nt=C=>{var ge,lt,ot;if(nw(C),!C.some(pt=>pt.value===we)){const pt=((ge=C[0])==null?void 0:ge.value)??"";pt&&(Pu(pt),ke(pt))}if(!C.some(pt=>pt.value===_e)){const pt=((lt=C.find(Et=>Et.value==="gpt-5.4-mini"))==null?void 0:lt.value)??((ot=C[0])==null?void 0:ot.value)??"";pt&&(Jp(pt),Me(pt))}},Xe=()=>{at("new"),Bt(ju()),Ze(null)},At=C=>{at(C.id),Bt({...C}),Ze(null)},nn=()=>{at(null),Bt(ju()),Ze(null)},Gn=()=>{var Et;const C=ht.label.trim(),ge=ht.value.trim();if(!C||!ge){Ze("请填写显示名和模型 ID。");return}if(z.find(Yt=>Yt.value.toLowerCase()===ge.toLowerCase()&&Yt.id!==Ge)){Ze(`模型 ID ${ge} 已存在。`);return}const ot={...ht,label:C,value:ge,description:((Et=ht.description)==null?void 0:Et.trim())||null},pt=Ge==="new"?[...z,ot]:z.map(Yt=>Yt.id===Ge?ot:Yt);nt(pt),at(null),Bt(ju()),Ze(Ge==="new"?"模型已添加。":"模型已更新。")},gt=C=>{const ge=z.filter(lt=>lt.id!==C);if(ge.length===0){Ze("至少保留一个模型。");return}nt(ge),Ge===C&&(at(null),Bt(ju())),Ze("模型已删除。")},kn=C=>{Pu(C),ke(C),Ze(`默认模型已切换为 ${C}。`)},Ee=C=>{Jp(C),Me(C),Ze(`命令执行模型已切换为 ${C}。`)},Dt=(C,ge)=>{const lt=z.findIndex(Et=>Et.id===C);if(lt<0)return;const ot=ge==="up"?lt-1:lt+1;if(ot<0||ot>=z.length)return;const pt=z[ot];pt&&nt(a2(z,C,pt.id,ge==="up"?"before":"after"))},Dn=(C,ge)=>{un(ge),Ae(null),C.dataTransfer.effectAllowed="move",C.dataTransfer.setData("text/plain",ge)},Wn=(C,ge)=>{if(!Zt||Zt===ge)return;C.preventDefault();const lt=C.currentTarget.getBoundingClientRect(),ot=C.clientY<lt.top+lt.height/2?"before":"after";Ae(pt=>(pt==null?void 0:pt.modelId)===ge&&pt.position===ot?pt:{modelId:ge,position:ot})},Gs=C=>{!Zt||!fe||fe.modelId!==C||(nt(a2(z,Zt,C,fe.position)),un(null),Ae(null))},Bi=()=>{un(null),Ae(null)},ds=te.appearance,ya=ds==="light"?z1:Vu,va=ds==="light"?A.lightThemeId:A.darkThemeId,xt=ya.find(C=>C.id===va)??ya[0],is=te.activeTheme,Va=pC(xt.codeThemeId,xt.accent,xt.contrast,xt.opaqueWindows),D=A.mode==="system"?`当前跟随系统:${je==="dark"?"深色":"浅色"}`:`当前固定为${te.appearance==="dark"?"深色":"浅色"}模式`,he="当前正在显示",Oe=xt.opaqueWindows?"不透明窗口":"半透明窗口",Be=If.find(C=>C.id===m)??If[0],Ye=`${xt.label} · ${Oe} · 对比度 ${xt.contrast}`,mt=z.find(C=>C.value===we)??z[0]??null,Ct=z.find(C=>C.value===_e)??z.find(C=>C.value==="gpt-5.4-mini")??z[0]??null,$t=()=>r.jsxs("div",{className:"settings-content-stack",children:[r.jsxs("section",{className:"settings-panel settings-panel--hero",children:[r.jsx("div",{className:"settings-panel__header",children:r.jsxs("div",{children:[r.jsx("h3",{className:"settings-panel__title",children:"外观"}),r.jsx("p",{className:"settings-panel__subtitle",children:"先选浅色或深色,再挑一个你喜欢的风格。"})]})}),r.jsx("div",{className:"settings-control-grid",children:r.jsxs("div",{className:"settings-control-block settings-control-block--full",children:[r.jsx("span",{className:"settings-control-block__label",children:"显示方式"}),r.jsx("div",{className:"theme-mode-switch",role:"tablist","aria-label":"主题模式",children:mC.map(C=>{const ge=C.value===A.mode;return r.jsxs("button",{type:"button",className:`theme-mode-switch__button ${ge?"is-active":""}`,onClick:()=>Se(C.value),role:"tab","aria-selected":ge,children:[r.jsx(wC,{icon:C.icon,active:ge}),r.jsx("span",{children:C.label})]},C.value)})}),r.jsx("p",{className:"settings-control-block__hint",children:D})]})})]}),r.jsxs("div",{className:"settings-theme-layout",children:[r.jsxs("section",{className:"settings-panel",children:[r.jsx("div",{className:"settings-panel__header",children:r.jsx("div",{children:r.jsx("h3",{className:"settings-panel__title",children:ds==="light"?"浅色风格":"深色风格"})})}),r.jsxs("div",{className:"settings-theme-selector",children:[r.jsx("label",{className:"settings-select settings-select--wide",children:r.jsx("select",{value:xt.id,onChange:C=>{if(ds==="light"){Re(C.target.value);return}oe(C.target.value)},"aria-label":ds==="light"?"选择浅色主题":"选择深色主题",children:ya.map(C=>r.jsx("option",{value:C.id,children:C.label},`${C.variant}-${C.id}`))})}),r.jsxs("div",{className:"settings-theme-selector__summary",children:[r.jsxs("div",{className:"settings-theme-selector__swatches","aria-hidden":"true",children:[r.jsx("span",{style:{"--theme-card-color":xt.background}}),r.jsx("span",{style:{"--theme-card-color":xt.foreground}}),r.jsx("span",{style:{"--theme-card-color":xt.accent}}),r.jsx("span",{style:{"--theme-card-color":xt.semanticColors.diffAdded}}),r.jsx("span",{style:{"--theme-card-color":xt.semanticColors.diffRemoved}})]}),r.jsxs("div",{className:"settings-theme-selector__copy",children:[r.jsx("strong",{children:xt.label}),r.jsx("span",{children:Ye})]}),xt.id===is.id&&xt.variant===te.appearance?r.jsx("span",{className:"settings-theme-selector__badge",children:"当前"}):r.jsx("span",{className:"settings-theme-selector__badge is-muted",children:"已选"})]})]})]}),r.jsxs("section",{className:"settings-panel",children:[r.jsxs("div",{className:"settings-panel__header",children:[r.jsx("div",{children:r.jsx("h3",{className:"settings-panel__title",children:"风格细节"})}),r.jsx("div",{className:"theme-status-badge",children:he})]}),r.jsx(kC,{title:ds==="light"?"浅色预览":"深色预览",caption:xt.label,accent:xt.accent,background:xt.background,foreground:xt.foreground,lines:Va}),r.jsxs("div",{className:"settings-list",children:[r.jsx(Pf,{label:"代码风格",value:xt.codeThemeId}),r.jsx(Pf,{label:"当前模式",value:xt.variant}),r.jsx(Pf,{label:"对比度",value:String(xt.contrast)}),r.jsx(Pf,{label:"面板质感",value:Oe}),r.jsx(Po,{label:"强调色",value:xt.accent}),r.jsx(Po,{label:"背景色",value:xt.background}),r.jsx(Po,{label:"文字色",value:xt.foreground}),r.jsx(Po,{label:"新增颜色",value:xt.semanticColors.diffAdded}),r.jsx(Po,{label:"删除颜色",value:xt.semanticColors.diffRemoved}),r.jsx(Po,{label:"特殊强调",value:xt.semanticColors.skill}),r.jsx(n2,{label:"界面字体",value:xt.fonts.ui??"null"}),r.jsx(n2,{label:"代码字体",value:xt.fonts.code??"null",mono:!0})]})]})]}),r.jsxs("section",{className:"settings-panel",children:[r.jsx("div",{className:"settings-panel__header",children:r.jsx("div",{children:r.jsx("h3",{className:"settings-panel__title",children:"字号"})})}),r.jsxs("div",{className:"settings-list",children:[r.jsx(s2,{label:"界面字号",value:A.uiFontSize,onChange:C=>Ne(I3(C)),min:11,max:18}),r.jsx(s2,{label:"代码字号",value:A.codeFontSize,onChange:C=>ie(P3(C)),min:10,max:18})]})]})]}),hn=()=>{var C;return r.jsxs("div",{className:"settings-content-stack",children:[r.jsxs("section",{className:"settings-panel settings-panel--hero",children:[r.jsxs("div",{className:"settings-panel__header",children:[r.jsx("div",{children:r.jsx("h3",{className:"settings-panel__title",children:"模型列表"})}),r.jsxs("button",{type:"button",className:"settings-inline-action",onClick:Xe,children:[r.jsx(_C,{}),"新增模型"]})]}),r.jsxs("div",{className:"settings-summary-strip",children:[r.jsxs("div",{className:"settings-summary-strip__item",children:[r.jsx("span",{children:"首位模型"}),r.jsx("strong",{children:((C=z[0])==null?void 0:C.label)??"未配置"})]}),r.jsxs("div",{className:"settings-summary-strip__item",children:[r.jsx("span",{children:"当前默认"}),r.jsx("strong",{children:(mt==null?void 0:mt.label)??"未配置"})]}),r.jsxs("div",{className:"settings-summary-strip__item",children:[r.jsx("span",{children:"命令执行模型"}),r.jsx("strong",{children:(Ct==null?void 0:Ct.label)??"未配置"})]}),r.jsxs("div",{className:"settings-summary-strip__item",children:[r.jsx("span",{children:"可选数量"}),r.jsxs("strong",{children:[z.length," 个"]})]})]})]}),r.jsxs("section",{className:"settings-panel",children:[r.jsx("div",{className:"settings-panel__header",children:r.jsx("div",{children:r.jsx("h3",{className:"settings-panel__title",children:"模型角色"})})}),r.jsxs("div",{className:"settings-model-editor__grid",children:[r.jsxs("label",{className:"settings-field",children:[r.jsx("span",{children:"默认模型"}),r.jsx("select",{value:we,onChange:ge=>kn(ge.target.value),children:z.map(ge=>r.jsx("option",{value:ge.value,children:ge.label},ge.id))})]}),r.jsxs("label",{className:"settings-field",children:[r.jsx("span",{children:"命令执行模型"}),r.jsx("select",{value:_e,onChange:ge=>Ee(ge.target.value),children:z.map(ge=>r.jsx("option",{value:ge.value,children:ge.label},ge.id))})]})]})]}),r.jsxs("section",{className:"settings-panel",children:[r.jsx("div",{className:"settings-panel__header",children:r.jsx("div",{children:r.jsx("h3",{className:"settings-panel__title",children:"维护模型"})})}),Ut?r.jsx("div",{className:"settings-inline-status",role:"alert",children:Ut}):null,r.jsx("div",{className:"settings-model-list",role:"list","aria-label":"模型列表",children:z.map((ge,lt)=>{const ot=Zt===ge.id,pt=(fe==null?void 0:fe.modelId)===ge.id&&fe.position==="before",Et=(fe==null?void 0:fe.modelId)===ge.id&&fe.position==="after",Yt=ge.value===we;return r.jsxs("article",{className:`settings-model-card ${ot?"is-dragging":""} ${pt?"is-drop-before":""} ${Et?"is-drop-after":""}`,draggable:!0,onDragStart:Tn=>Dn(Tn,ge.id),onDragOver:Tn=>Wn(Tn,ge.id),onDrop:Tn=>{Tn.preventDefault(),Gs(ge.id)},onDragEnd:Bi,role:"listitem",children:[r.jsxs("div",{className:"settings-model-card__main",children:[r.jsx("span",{className:"settings-model-card__grip","aria-hidden":"true",children:r.jsx(vC,{})}),r.jsxs("div",{className:"settings-model-card__copy",children:[r.jsxs("div",{className:"settings-model-card__title-row",children:[r.jsx("strong",{children:ge.label}),Yt?r.jsx("span",{className:"settings-model-card__badge",children:"默认"}):null]}),r.jsx("code",{className:"settings-model-card__value",children:ge.value})]})]}),r.jsxs("div",{className:"settings-model-card__actions",children:[r.jsx("button",{type:"button",className:`settings-mini-button ${Yt?"is-active":""}`,onClick:()=>kn(ge.value),children:"设为默认"}),r.jsx("button",{type:"button",className:"settings-icon-button",onClick:()=>Dt(ge.id,"up"),disabled:lt===0,"aria-label":`上移 ${ge.label}`,children:r.jsx(SC,{})}),r.jsx("button",{type:"button",className:"settings-icon-button",onClick:()=>Dt(ge.id,"down"),disabled:lt===z.length-1,"aria-label":`下移 ${ge.label}`,children:r.jsx(jC,{})}),r.jsx("button",{type:"button",className:"settings-icon-button",onClick:()=>At(ge),"aria-label":`编辑 ${ge.label}`,children:r.jsx(bC,{})}),r.jsx("button",{type:"button",className:"settings-icon-button is-danger",onClick:()=>gt(ge.id),disabled:z.length<=1,"aria-label":`删除 ${ge.label}`,children:r.jsx(xC,{})})]})]},ge.id)})}),Ge?r.jsxs("div",{className:"settings-model-editor",children:[r.jsx("div",{className:"settings-model-editor__header",children:r.jsx("strong",{children:Ge==="new"?"新增模型":"编辑模型"})}),r.jsxs("div",{className:"settings-model-editor__grid",children:[r.jsxs("label",{className:"settings-field",children:[r.jsx("span",{children:"显示名"}),r.jsx("input",{type:"text",value:ht.label,onChange:ge=>Bt(lt=>({...lt,label:ge.target.value})),placeholder:"例如:gpt-5.4"})]}),r.jsxs("label",{className:"settings-field",children:[r.jsx("span",{children:"模型 ID"}),r.jsx("input",{type:"text",value:ht.value,onChange:ge=>Bt(lt=>({...lt,value:ge.target.value})),placeholder:"例如:gpt-5.4"})]})]}),r.jsxs("div",{className:"settings-model-editor__actions",children:[r.jsx("button",{type:"button",className:"settings-ghost-button",onClick:nn,children:"取消"}),r.jsx("button",{type:"button",className:"settings-inline-action",onClick:Gn,children:"保存"})]})]}):null]})]})},mn=()=>{var C,ge;return r.jsxs("div",{className:"settings-content-stack",children:[r.jsxs("section",{className:"settings-panel",children:[r.jsx("div",{className:"settings-panel__header",children:r.jsx("div",{children:r.jsx("h3",{className:"settings-panel__title",children:"页面缓存"})})}),r.jsxs("div",{className:"settings-summary-strip",children:[r.jsxs("div",{className:"settings-summary-strip__item",children:[r.jsx("span",{children:"适合什么时候用"}),r.jsx("strong",{children:"页面资源或本地缓存异常"})]}),r.jsxs("div",{className:"settings-summary-strip__item",children:[r.jsx("span",{children:"常见表现"}),r.jsx("strong",{children:"样式没更新、列表卡旧、页面反复异常"})]})]})]}),r.jsxs("section",{className:"settings-panel",children:[r.jsx("div",{className:"settings-panel__header",children:r.jsx("div",{children:r.jsx("h3",{className:"settings-panel__title",children:"清理缓存"})})}),r.jsxs("button",{type:"button",className:"settings-action",onClick:()=>void ae(),disabled:l,children:[r.jsxs("div",{className:"settings-action__copy",children:[r.jsx("strong",{children:"清理并刷新"}),r.jsx("span",{children:"删除页面资源缓存和本地会话缓存,强制重新加载最新页面。"})]}),r.jsx("span",{className:"settings-action__state",children:l?"处理中…":"→"})]}),u?r.jsx("p",{className:"settings-block__status",children:u}):null]}),r.jsxs("section",{className:"settings-panel",children:[r.jsx("div",{className:"settings-panel__header",children:r.jsx("div",{children:r.jsx("h3",{className:"settings-panel__title",children:"移动端诊断"})})}),r.jsxs("button",{type:"button",className:"settings-action",onClick:()=>void n({to:"/diagnostics"}),children:[r.jsxs("div",{className:"settings-action__copy",children:[r.jsx("strong",{children:"打开安卓诊断页"}),r.jsx("span",{children:"在手机上检查样式能力、资源加载、Service Worker 和缓存状态,并可上传到后端日志。"})]}),r.jsx("span",{className:"settings-action__state",children:"→"})]})]}),r.jsxs("section",{className:"settings-panel",children:[r.jsx("div",{className:"settings-panel__header",children:r.jsx("div",{children:r.jsx("h3",{className:"settings-panel__title",children:"命令目录缓存"})})}),r.jsxs("div",{className:"settings-meta",children:[r.jsx("span",{children:"当前 CLI"}),r.jsx("span",{children:((C=rn.data)==null?void 0:C.cli_version)??"检测中…"})]}),r.jsxs("div",{className:"settings-meta",children:[r.jsx("span",{children:"最近刷新"}),r.jsx("span",{children:((ge=rn.data)==null?void 0:ge.loaded_at)??"尚未生成"})]}),r.jsxs("div",{className:"settings-meta",children:[r.jsx("span",{children:"命令数量"}),r.jsx("span",{children:rn.data?`${rn.data.commands.length} 条`:"检测中…"})]}),r.jsxs("button",{type:"button",className:"settings-action",onClick:()=>void as.mutateAsync(),disabled:as.isPending,children:[r.jsxs("div",{className:"settings-action__copy",children:[r.jsx("strong",{children:"刷新命令目录"}),r.jsx("span",{children:"重新从当前 Codex CLI 对应版本拉取命令并覆盖本地缓存文件。"})]}),r.jsx("span",{className:"settings-action__state",children:as.isPending?"刷新中…":"→"})]})]})]})},Nn=()=>{var C,ge,lt,ot,pt,Et,Yt,Tn,K,pn,Bn,wn,Xt,qt,_a,ba,Ui,Es,Gl,rs,ra,Ht;return r.jsxs("div",{className:"settings-content-stack",children:[r.jsxs("section",{className:"settings-panel settings-panel--hero",children:[r.jsx("div",{className:"settings-panel__header",children:r.jsx("div",{children:r.jsx("h3",{className:"settings-panel__title",children:"当前设备"})})}),r.jsxs("div",{className:"settings-summary-strip",children:[r.jsxs("div",{className:"settings-summary-strip__item",children:[r.jsx("span",{children:"设备名称"}),r.jsx("strong",{children:(Fe==null?void 0:Fe.name)??"未选择节点"})]}),r.jsxs("div",{className:"settings-summary-strip__item",children:[r.jsx("span",{children:"连接方式"}),r.jsx("strong",{children:((C=qe.data)==null?void 0:C.modeLabel)??"检测中…"})]}),r.jsxs("div",{className:"settings-summary-strip__item",children:[r.jsx("span",{children:"当前链路延迟"}),r.jsx("strong",{className:(ge=qe.data)!=null&&ge.healthOk?"is-ok":"is-muted",children:qe.isLoading?"检测中…":zf((lt=qe.data)==null?void 0:lt.latencyMs)})]})]})]}),r.jsxs("section",{className:"settings-panel",children:[r.jsxs("div",{className:"settings-panel__header",children:[r.jsx("div",{children:r.jsx("h3",{className:"settings-panel__title",children:"当前链路"})}),r.jsx("div",{className:"settings-actions-row",children:r.jsx("button",{type:"button",className:"settings-inline-action",onClick:()=>{qe.refetch()},children:"刷新延迟"})})]}),r.jsxs("div",{className:"settings-meta",children:[r.jsx("span",{children:"服务名称"}),r.jsx("span",{children:((ot=qe.data)==null?void 0:ot.backendLabel)??"检测中…"})]}),r.jsxs("div",{className:"settings-meta",children:[r.jsx("span",{children:"服务地址"}),r.jsx("span",{children:((pt=qe.data)==null?void 0:pt.backendUrl)??"检测中…"})]}),r.jsxs("div",{className:"settings-meta",children:[r.jsx("span",{children:"当前状态"}),r.jsx("span",{className:(Et=qe.data)!=null&&Et.healthOk?"is-ok":"is-muted",children:qe.isLoading?"检测中…":(Yt=qe.data)!=null&&Yt.healthOk?"在线":((Tn=qe.data)==null?void 0:Tn.activeProbe.error)??"无法连接"})]}),r.jsxs("div",{className:"settings-meta",children:[r.jsx("span",{children:"当前延迟"}),r.jsx("span",{children:zf((K=qe.data)==null?void 0:K.latencyMs)})]}),r.jsxs("div",{className:"settings-meta",children:[r.jsx("span",{children:"最近探测"}),r.jsx("span",{children:ku((pn=qe.data)==null?void 0:pn.checkedAt)})]}),r.jsxs("div",{className:"settings-meta",children:[r.jsx("span",{children:"设备标识"}),r.jsx("span",{children:(Fe==null?void 0:Fe.id)??"未选择节点"})]}),r.jsxs("div",{className:"settings-meta",children:[r.jsx("span",{children:"最近会话"}),r.jsx("span",{children:(Ce==null?void 0:Ce.title)??"未选择会话"})]})]}),r.jsxs("section",{className:"settings-panel",children:[r.jsx("div",{className:"settings-panel__header",children:r.jsx("div",{children:r.jsx("h3",{className:"settings-panel__title",children:"延迟对比"})})}),r.jsxs("div",{className:"settings-meta",children:[r.jsx("span",{children:"Hub 延迟"}),r.jsx("span",{children:zf((Bn=qe.data)==null?void 0:Bn.hubProbe.latencyMs)})]}),r.jsxs("div",{className:"settings-meta",children:[r.jsx("span",{children:"Hub 状态"}),r.jsx("span",{className:(wn=qe.data)!=null&&wn.hubProbe.healthOk?"is-ok":"is-muted",children:(Xt=qe.data)!=null&&Xt.hubProbe.healthOk?"在线":((qt=qe.data)==null?void 0:qt.hubProbe.error)??"无法连接"})]}),r.jsxs("div",{className:"settings-meta",children:[r.jsx("span",{children:"Hub 地址"}),r.jsx("span",{children:((_a=qe.data)==null?void 0:_a.hubProbe.url)??"检测中…"})]}),r.jsxs("div",{className:"settings-meta",children:[r.jsx("span",{children:"当前 Agent 延迟"}),r.jsx("span",{children:zf((Ui=(ba=qe.data)==null?void 0:ba.agentProbe)==null?void 0:Ui.latencyMs)})]}),r.jsxs("div",{className:"settings-meta",children:[r.jsx("span",{children:"当前 Agent 状态"}),r.jsx("span",{className:(Gl=(Es=qe.data)==null?void 0:Es.agentProbe)!=null&&Gl.healthOk?"is-ok":"is-muted",children:(rs=qe.data)!=null&&rs.agentProbe?qe.data.agentProbe.healthOk?"在线":qe.data.agentProbe.error??"无法连接":"未选择节点"})]}),r.jsxs("div",{className:"settings-meta",children:[r.jsx("span",{children:"当前 Agent 地址"}),r.jsx("span",{children:((Ht=(ra=qe.data)==null?void 0:ra.agentProbe)==null?void 0:Ht.url)||tt||"未配置"})]})]})]})},On=()=>{const C=ne?"已安装":"未安装",ge=P==="granted"?"已允许":P==="denied"?"已拒绝":P==="default"?"待授权":"不支持",lt=U?V?"同步中":q?"已连接":E.completionNotificationsEnabled&&P==="granted"?"待连接":"未连接":"不支持",ot=P==="granted"&&E.completionNotificationsEnabled?q?"后台可达":U?"前台兜底":"仅前台":"未开启",pt=U?q?"Hub Web Push + 系统通知":"系统通知,后台通道待建立":"系统通知(仅页面在线)",Et=q?ne?"已具备条件":"大多可见,安装后更稳":U?"先建立后台通道":"当前环境很难稳定锁屏提醒",Yt=P==="unsupported"||V,Tn=P==="granted"&&E.completionNotificationsEnabled?"关闭完成提醒":V?"正在建立后台提醒":"开启完成提醒",K=P==="unsupported"?"当前环境不支持系统通知,需要 HTTPS、Service Worker 和受支持浏览器。":U?"开启后会向 Hub 注册这台设备,后台或锁屏时也能收到完成提醒。":"当前环境只能在页面在线时提醒,建议安装到桌面并使用支持 Web Push 的浏览器。",pn=P==="unsupported"?"不可用":V?"同步中…":P==="granted"&&E.completionNotificationsEnabled?q?"已连接":U?"待连接":"已开启":"→",Bn=P==="granted"&&E.completionNotificationsEnabled&&q&&!V,wn=q?"立刻让 Hub 给当前这台设备发一条测试通知,用来确认后台链路是否真的可达。":"只有当前设备已经完成 Web Push 注册后,才能发送测试通知。";return r.jsxs("div",{className:"settings-content-stack",children:[r.jsxs("section",{className:"settings-panel settings-panel--hero",children:[r.jsx("div",{className:"settings-panel__header",children:r.jsx("div",{children:r.jsx("h3",{className:"settings-panel__title",children:"安卓优先提醒"})})}),r.jsxs("div",{className:"settings-summary-strip",children:[r.jsxs("div",{className:"settings-summary-strip__item",children:[r.jsx("span",{children:"桌面安装"}),r.jsx("strong",{children:C})]}),r.jsxs("div",{className:"settings-summary-strip__item",children:[r.jsx("span",{children:"系统通知权限"}),r.jsx("strong",{children:ge})]}),r.jsxs("div",{className:"settings-summary-strip__item",children:[r.jsx("span",{children:"完成提醒"}),r.jsx("strong",{children:ot})]}),r.jsxs("div",{className:"settings-summary-strip__item",children:[r.jsx("span",{children:"后台 Web Push"}),r.jsx("strong",{children:lt})]})]})]}),r.jsxs("section",{className:"settings-panel",children:[r.jsx("div",{className:"settings-panel__header",children:r.jsx("div",{children:r.jsx("h3",{className:"settings-panel__title",children:"安装到桌面"})})}),r.jsxs("div",{className:"settings-meta",children:[r.jsx("span",{children:"推荐平台"}),r.jsx("span",{children:$?"Android 当前设备":"Android 效果最佳"})]}),r.jsxs("div",{className:"settings-meta",children:[r.jsx("span",{children:"当前形态"}),r.jsx("span",{children:ne?"已是桌面应用":"浏览器标签页"})]}),r.jsxs("button",{type:"button",className:"settings-action",onClick:()=>void We(),disabled:ne||pe,children:[r.jsxs("div",{className:"settings-action__copy",children:[r.jsx("strong",{children:ne?"已经安装":"安装到桌面"}),r.jsx("span",{children:ne?"现在可以直接从桌面图标进入 Panda。":"安装后更像应用,系统通知和锁屏提醒也更稳定。"})]}),r.jsx("span",{className:"settings-action__state",children:ne?"✓":pe?"处理中…":"→"})]})]}),r.jsxs("section",{className:"settings-panel",children:[r.jsx("div",{className:"settings-panel__header",children:r.jsx("div",{children:r.jsx("h3",{className:"settings-panel__title",children:"对话完成提醒"})})}),r.jsxs("div",{className:"settings-meta",children:[r.jsx("span",{children:"提醒方式"}),r.jsx("span",{children:pt})]}),r.jsxs("div",{className:"settings-meta",children:[r.jsx("span",{children:"锁屏可见"}),r.jsx("span",{children:Et})]}),r.jsxs("div",{className:"settings-meta",children:[r.jsx("span",{children:"后台通道"}),r.jsx("span",{children:lt})]}),r.jsxs("div",{className:"settings-meta",children:[r.jsx("span",{children:"触发时机"}),r.jsx("span",{children:U?"Hub 收到对话完成后主动推送":"页面在线时收到完成事件后提醒"})]}),r.jsxs("button",{type:"button",className:"settings-action",onClick:()=>void $e(),disabled:Yt,children:[r.jsxs("div",{className:"settings-action__copy",children:[r.jsx("strong",{children:Tn}),r.jsx("span",{children:K})]}),r.jsx("span",{className:"settings-action__state",children:pn})]}),r.jsxs("button",{type:"button",className:"settings-action",onClick:()=>void De(),disabled:!Bn||Z,children:[r.jsxs("div",{className:"settings-action__copy",children:[r.jsx("strong",{children:Z?"正在发送测试推送":"发送测试推送"}),r.jsx("span",{children:wn})]}),r.jsx("span",{className:"settings-action__state",children:Z?"发送中…":Bn?"→":"未就绪"})]}),p?r.jsx("p",{className:"settings-block__status",children:p}):null]})]})},Cn=()=>{const C=zn.data,ge=C!=null&&C.promptState.installPromptAvailable?"可主动触发":C!=null&&C.promptState.beforeInstallPromptSeen?"本地曾出现":"未出现",lt=C!=null&&C.promptState.appInstalledSeen?"记录到过":"未记录到",ot=C!=null&&C.manifest.ok?"正常":C!=null&&C.manifest.present?"读取失败":"缺失",pt=C!=null&&C.serviceWorker.registrations.length?`${C.serviceWorker.registrations.length} 个注册`:C!=null&&C.serviceWorker.supported?"未注册":"不支持";return r.jsxs("div",{className:"settings-content-stack",children:[r.jsxs("section",{className:"settings-panel settings-panel--hero",children:[r.jsx("div",{className:"settings-panel__header",children:r.jsx("div",{children:r.jsx("h3",{className:"settings-panel__title",children:"安装结果判断"})})}),r.jsxs("div",{className:"settings-summary-strip",children:[r.jsxs("div",{className:"settings-summary-strip__item",children:[r.jsx("span",{children:"当前研判"}),r.jsx("strong",{children:(C==null?void 0:C.assessment.label)??"检测中…"})]}),r.jsxs("div",{className:"settings-summary-strip__item",children:[r.jsx("span",{children:"安装事件"}),r.jsx("strong",{children:ge})]}),r.jsxs("div",{className:"settings-summary-strip__item",children:[r.jsx("span",{children:"appinstalled"}),r.jsx("strong",{children:lt})]})]})]}),r.jsxs("section",{className:"settings-panel",children:[r.jsxs("div",{className:"settings-panel__header",children:[r.jsx("div",{children:r.jsx("h3",{className:"settings-panel__title",children:"当前状态"})}),r.jsxs("div",{className:"settings-actions-row",children:[r.jsx("button",{type:"button",className:"settings-inline-action",onClick:()=>{zn.refetch()},children:"刷新诊断"}),r.jsx("button",{type:"button",className:"settings-ghost-button",onClick:()=>{rC(),vn()},children:"清空日志"})]})]}),r.jsxs("div",{className:"settings-meta",children:[r.jsx("span",{children:"当前窗口形态"}),r.jsx("span",{children:C?C.environment.standaloneDisplayMode||C.environment.navigatorStandalone?"独立窗口 / 主屏幕入口":"浏览器标签页":"检测中…"})]}),r.jsxs("div",{className:"settings-meta",children:[r.jsx("span",{children:"系统级安装研判"}),r.jsx("span",{children:(C==null?void 0:C.assessment.label)??"检测中…"})]}),r.jsxs("div",{className:"settings-meta",children:[r.jsx("span",{children:"研判置信度"}),r.jsx("span",{children:(C==null?void 0:C.assessment.confidence)??"检测中…"})]}),r.jsxs("div",{className:"settings-meta",children:[r.jsx("span",{children:"当前说明"}),r.jsx("span",{children:(C==null?void 0:C.assessment.detail)??"正在分析…"})]}),r.jsxs("div",{className:"settings-meta",children:[r.jsx("span",{children:"最近抓取时间"}),r.jsx("span",{children:ku(C==null?void 0:C.capturedAt)})]})]}),r.jsxs("section",{className:"settings-panel",children:[r.jsx("div",{className:"settings-panel__header",children:r.jsx("div",{children:r.jsx("h3",{className:"settings-panel__title",children:"PWA 条件与安装信号"})})}),r.jsxs("div",{className:"settings-meta",children:[r.jsx("span",{children:"安全上下文"}),r.jsx("span",{children:C!=null&&C.environment.secureContext?"是":"否"})]}),r.jsxs("div",{className:"settings-meta",children:[r.jsx("span",{children:"manifest"}),r.jsx("span",{children:ot})]}),r.jsxs("div",{className:"settings-meta",children:[r.jsx("span",{children:"manifest display"}),r.jsx("span",{children:(C==null?void 0:C.manifest.display)??"未声明"})]}),r.jsxs("div",{className:"settings-meta",children:[r.jsx("span",{children:"Service Worker"}),r.jsx("span",{children:pt})]}),r.jsxs("div",{className:"settings-meta",children:[r.jsx("span",{children:"当前可主动触发安装"}),r.jsx("span",{children:C!=null&&C.promptState.installPromptAvailable?"可以":"不可以"})]}),r.jsxs("div",{className:"settings-meta",children:[r.jsx("span",{children:"最近 beforeinstallprompt"}),r.jsx("span",{children:ku(C==null?void 0:C.promptState.lastBeforeInstallPromptAt)})]}),r.jsxs("div",{className:"settings-meta",children:[r.jsx("span",{children:"最近 appinstalled"}),r.jsx("span",{children:ku(C==null?void 0:C.promptState.lastAppInstalledAt)})]})]}),r.jsxs("section",{className:"settings-panel",children:[r.jsx("div",{className:"settings-panel__header",children:r.jsx("div",{children:r.jsx("h3",{className:"settings-panel__title",children:"为什么当前可能安装失败"})})}),zn.isLoading?r.jsx("p",{className:"settings-block__status",children:"正在收集安装诊断…"}):C!=null&&C.failureReasons.length?r.jsx("div",{className:"settings-diagnostic-list",children:C.failureReasons.map((Et,Yt)=>r.jsxs("div",{className:"settings-diagnostic-list__item",children:[r.jsxs("strong",{children:["原因 ",Yt+1]}),r.jsx("span",{children:Et})]},`${Yt}-${Et}`))}):r.jsx("p",{className:"settings-block__status",children:"当前没有发现明显的前端侧阻断条件;如果仍无法完成系统级安装,更像是浏览器策略、安装链路回退或平台侧判断导致。"})]}),r.jsxs("section",{className:"settings-panel",children:[r.jsx("div",{className:"settings-panel__header",children:r.jsx("div",{children:r.jsx("h3",{className:"settings-panel__title",children:"成功信号与人工确认"})})}),C!=null&&C.successSignals.length?r.jsx("div",{className:"settings-diagnostic-list",children:C.successSignals.map((Et,Yt)=>r.jsxs("div",{className:"settings-diagnostic-list__item",children:[r.jsxs("strong",{children:["信号 ",Yt+1]}),r.jsx("span",{children:Et})]},`${Yt}-${Et}`))}):null,r.jsx("div",{className:"settings-diagnostic-list",children:(C==null?void 0:C.confirmationChecklist.map((Et,Yt)=>r.jsxs("div",{className:"settings-diagnostic-list__item",children:[r.jsxs("strong",{children:["确认 ",Yt+1]}),r.jsx("span",{children:Et})]},`${Yt}-${Et}`)))??null})]}),r.jsxs("section",{className:"settings-panel",children:[r.jsx("div",{className:"settings-panel__header",children:r.jsx("div",{children:r.jsx("h3",{className:"settings-panel__title",children:"浏览器安装事件日志"})})}),zn.isLoading?r.jsx("p",{className:"settings-block__status",children:"正在读取日志…"}):C!=null&&C.logs.length?r.jsx("div",{className:"settings-log-list",children:C.logs.map(Et=>r.jsxs("article",{className:"settings-log-item",children:[r.jsxs("div",{className:"settings-log-item__meta",children:[r.jsx("strong",{children:Et.message}),r.jsx("span",{children:ku(Et.timestamp)})]}),r.jsx("div",{className:"settings-log-item__kind",children:Et.kind}),Et.detail?r.jsx("pre",{className:"settings-log-item__detail",children:Et.detail}):null]},Et.id))}):r.jsx("p",{className:"settings-block__status",children:"还没有本地安装日志。后续在这个页面触发安装、刷新页面、出现 beforeinstallprompt 或 appinstalled 后,这里会自动积累证据。"})]})]})},En=C=>C==="models"?hn():C==="cache"?mn():C==="notifications"?On():C==="installation"?Cn():C==="connection"?Nn():$t();return r.jsx("div",{className:"conversation-page settings-screen settings-screen--workspace",children:r.jsx("div",{className:"conversation-main settings-screen__main settings-screen__workspace-main",children:r.jsx("div",{className:"settings-screen__body",children:r.jsxs("div",{className:"settings-shell",children:[r.jsxs("header",{className:"settings-page-header",children:[r.jsx("button",{type:"button",className:"settings-card__back",onClick:Sn,"aria-label":"返回会话",children:r.jsx(gC,{})}),r.jsx("div",{className:"settings-page-header__copy",children:r.jsx("h1",{className:"settings-page-header__title",children:"设置"})})]}),j?r.jsxs("div",{className:"settings-workspace",children:[r.jsxs("aside",{className:"settings-sidebar",children:[r.jsx("div",{className:"settings-sidebar__title",children:"设置"}),r.jsx("nav",{className:"settings-sidebar__nav","aria-label":"设置导航",children:If.map(C=>{const ge=C.id===m;return r.jsxs("button",{type:"button",className:`settings-sidebar__item ${ge?"is-active":""}`,onClick:()=>S(C.id),children:[r.jsx(t2,{icon:C.icon}),r.jsx("span",{children:C.title})]},C.id)})})]}),r.jsxs("main",{className:"settings-stage",children:[r.jsx("header",{className:"settings-stage__header",children:r.jsxs("div",{children:[r.jsx("h2",{className:"settings-stage__title",children:Be.title}),r.jsx("p",{className:"settings-stage__description",children:Be.description})]})}),En(m)]})]}):r.jsx("div",{className:"settings-mobile-sections",children:If.map(C=>{const ge=g===C.id;return r.jsxs("section",{className:`settings-mobile-card ${ge?"is-open":""}`,children:[r.jsxs("button",{type:"button",className:"settings-mobile-card__header",onClick:()=>{S(C.id),x(lt=>lt===C.id?null:C.id)},"aria-expanded":ge,children:[r.jsxs("span",{className:"settings-mobile-card__title-wrap",children:[r.jsx("span",{className:"settings-mobile-card__icon",children:r.jsx(t2,{icon:C.icon})}),r.jsx("span",{className:"settings-mobile-card__copy",children:r.jsx("span",{className:"settings-mobile-card__title",children:C.title})})]}),r.jsx("span",{className:`settings-mobile-card__chevron ${ge?"is-open":""}`,children:r.jsx(yC,{open:ge})})]}),ge?r.jsx("div",{className:"settings-mobile-card__body",children:En(C.id)}):null]},C.id)})})]})})})})},l1=new z5,CC=async()=>{},EC=_.lazy(async()=>({default:(await K1(()=>import("./diagnostics-page-l9_xAlKR.js"),__vite__mapDeps([0,1]))).DiagnosticsPage})),TC=()=>r.jsx(_.Suspense,{fallback:r.jsx("main",{className:"diagnostics-page",children:r.jsx("div",{className:"diagnostics-shell",children:r.jsx("section",{className:"diagnostics-card",children:r.jsx("p",{children:"正在载入诊断页…"})})})}),children:r.jsx(EC,{})}),Ql=Bb({component:oj}),MC=Fl({getParentRoute:()=>Ql,path:"/",component:U0}),RC=Fl({getParentRoute:()=>Ql,path:"/nodes",component:dj}),AC=Fl({getParentRoute:()=>Ql,path:"/session/$sessionId",component:U0}),DC=Fl({getParentRoute:()=>Ql,path:"/new-thread/$agentId",component:U0}),OC=Fl({getParentRoute:()=>Ql,path:"/settings",component:NC}),LC=Fl({getParentRoute:()=>Ql,path:"/diagnostics",component:TC}),IC=Ql.addChildren([MC,RC,AC,DC,OC,LC]),PC=Wb({routeTree:IC,defaultPreload:"intent"});typeof document<"u"&&B3(z3());CC().catch(()=>{}).then(async()=>{await eC(l1),nC(l1)}).finally(()=>{r5.createRoot(document.getElementById("root")).render(r.jsx(B5,{client:l1,children:r.jsx(Kb,{router:PC})}))});export{Z_ as g,r as j,_ as r,Zr as u};