@orion-agents/orion-code 0.3.14 → 0.3.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,20 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalPanel-BpsLphLv.js","assets/TerminalPanel-DLuoa74B.css","assets/FilesPanel-DiXKnFMj.js","assets/useAutoNotice-BeSf9Dfq.js","assets/GitPanel--_Yrbldp.js","assets/DiffViewer-C0A42Lma.js","assets/ReviewPanel-BilzL9Ma.js"])))=>i.map(i=>d[i]);
2
+ var gm=Object.defineProperty;var vm=(n,r,o)=>r in n?gm(n,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[r]=o;var Ft=(n,r,o)=>vm(n,typeof r!="symbol"?r+"":r,o);(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))a(d);new MutationObserver(d=>{for(const f of d)if(f.type==="childList")for(const p of f.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&a(p)}).observe(document,{childList:!0,subtree:!0});function o(d){const f={};return d.integrity&&(f.integrity=d.integrity),d.referrerPolicy&&(f.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?f.credentials="include":d.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function a(d){if(d.ep)return;d.ep=!0;const f=o(d);fetch(d.href,f)}})();function zf(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Sa={exports:{}},Us={},Ca={exports:{}},Ee={};var Md;function ym(){if(Md)return Ee;Md=1;var n=Symbol.for("react.element"),r=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),f=Symbol.for("react.provider"),p=Symbol.for("react.context"),g=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),w=Symbol.for("react.memo"),E=Symbol.for("react.lazy"),S=Symbol.iterator;function P(v){return v===null||typeof v!="object"?null:(v=S&&v[S]||v["@@iterator"],typeof v=="function"?v:null)}var R={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},$=Object.assign,O={};function F(v,M,pe){this.props=v,this.context=M,this.refs=O,this.updater=pe||R}F.prototype.isReactComponent={},F.prototype.setState=function(v,M){if(typeof v!="object"&&typeof v!="function"&&v!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,v,M,"setState")},F.prototype.forceUpdate=function(v){this.updater.enqueueForceUpdate(this,v,"forceUpdate")};function te(){}te.prototype=F.prototype;function L(v,M,pe){this.props=v,this.context=M,this.refs=O,this.updater=pe||R}var ye=L.prototype=new te;ye.constructor=L,$(ye,F.prototype),ye.isPureReactComponent=!0;var J=Array.isArray,ne=Object.prototype.hasOwnProperty,N={current:null},D={key:!0,ref:!0,__self:!0,__source:!0};function Z(v,M,pe){var V,oe={},ge=null,Se=null;if(M!=null)for(V in M.ref!==void 0&&(Se=M.ref),M.key!==void 0&&(ge=""+M.key),M)ne.call(M,V)&&!D.hasOwnProperty(V)&&(oe[V]=M[V]);var be=arguments.length-2;if(be===1)oe.children=pe;else if(1<be){for(var ue=Array(be),Me=0;Me<be;Me++)ue[Me]=arguments[Me+2];oe.children=ue}if(v&&v.defaultProps)for(V in be=v.defaultProps,be)oe[V]===void 0&&(oe[V]=be[V]);return{$$typeof:n,type:v,key:ge,ref:Se,props:oe,_owner:N.current}}function X(v,M){return{$$typeof:n,type:v.type,key:M,ref:v.ref,props:v.props,_owner:v._owner}}function ie(v){return typeof v=="object"&&v!==null&&v.$$typeof===n}function G(v){var M={"=":"=0",":":"=2"};return"$"+v.replace(/[=:]/g,function(pe){return M[pe]})}var je=/\/+/g;function ee(v,M){return typeof v=="object"&&v!==null&&v.key!=null?G(""+v.key):M.toString(36)}function Ce(v,M,pe,V,oe){var ge=typeof v;(ge==="undefined"||ge==="boolean")&&(v=null);var Se=!1;if(v===null)Se=!0;else switch(ge){case"string":case"number":Se=!0;break;case"object":switch(v.$$typeof){case n:case r:Se=!0}}if(Se)return Se=v,oe=oe(Se),v=V===""?"."+ee(Se,0):V,J(oe)?(pe="",v!=null&&(pe=v.replace(je,"$&/")+"/"),Ce(oe,M,pe,"",function(Me){return Me})):oe!=null&&(ie(oe)&&(oe=X(oe,pe+(!oe.key||Se&&Se.key===oe.key?"":(""+oe.key).replace(je,"$&/")+"/")+v)),M.push(oe)),1;if(Se=0,V=V===""?".":V+":",J(v))for(var be=0;be<v.length;be++){ge=v[be];var ue=V+ee(ge,be);Se+=Ce(ge,M,pe,ue,oe)}else if(ue=P(v),typeof ue=="function")for(v=ue.call(v),be=0;!(ge=v.next()).done;)ge=ge.value,ue=V+ee(ge,be++),Se+=Ce(ge,M,pe,ue,oe);else if(ge==="object")throw M=String(v),Error("Objects are not valid as a React child (found: "+(M==="[object Object]"?"object with keys {"+Object.keys(v).join(", ")+"}":M)+"). If you meant to render a collection of children, use an array instead.");return Se}function A(v,M,pe){if(v==null)return v;var V=[],oe=0;return Ce(v,V,"","",function(ge){return M.call(pe,ge,oe++)}),V}function me(v){if(v._status===-1){var M=v._result;M=M(),M.then(function(pe){(v._status===0||v._status===-1)&&(v._status=1,v._result=pe)},function(pe){(v._status===0||v._status===-1)&&(v._status=2,v._result=pe)}),v._status===-1&&(v._status=0,v._result=M)}if(v._status===1)return v._result.default;throw v._result}var ve={current:null},W={transition:null},se={ReactCurrentDispatcher:ve,ReactCurrentBatchConfig:W,ReactCurrentOwner:N};function B(){throw Error("act(...) is not supported in production builds of React.")}return Ee.Children={map:A,forEach:function(v,M,pe){A(v,function(){M.apply(this,arguments)},pe)},count:function(v){var M=0;return A(v,function(){M++}),M},toArray:function(v){return A(v,function(M){return M})||[]},only:function(v){if(!ie(v))throw Error("React.Children.only expected to receive a single React element child.");return v}},Ee.Component=F,Ee.Fragment=o,Ee.Profiler=d,Ee.PureComponent=L,Ee.StrictMode=a,Ee.Suspense=x,Ee.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=se,Ee.act=B,Ee.cloneElement=function(v,M,pe){if(v==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+v+".");var V=$({},v.props),oe=v.key,ge=v.ref,Se=v._owner;if(M!=null){if(M.ref!==void 0&&(ge=M.ref,Se=N.current),M.key!==void 0&&(oe=""+M.key),v.type&&v.type.defaultProps)var be=v.type.defaultProps;for(ue in M)ne.call(M,ue)&&!D.hasOwnProperty(ue)&&(V[ue]=M[ue]===void 0&&be!==void 0?be[ue]:M[ue])}var ue=arguments.length-2;if(ue===1)V.children=pe;else if(1<ue){be=Array(ue);for(var Me=0;Me<ue;Me++)be[Me]=arguments[Me+2];V.children=be}return{$$typeof:n,type:v.type,key:oe,ref:ge,props:V,_owner:Se}},Ee.createContext=function(v){return v={$$typeof:p,_currentValue:v,_currentValue2:v,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},v.Provider={$$typeof:f,_context:v},v.Consumer=v},Ee.createElement=Z,Ee.createFactory=function(v){var M=Z.bind(null,v);return M.type=v,M},Ee.createRef=function(){return{current:null}},Ee.forwardRef=function(v){return{$$typeof:g,render:v}},Ee.isValidElement=ie,Ee.lazy=function(v){return{$$typeof:E,_payload:{_status:-1,_result:v},_init:me}},Ee.memo=function(v,M){return{$$typeof:w,type:v,compare:M===void 0?null:M}},Ee.startTransition=function(v){var M=W.transition;W.transition={};try{v()}finally{W.transition=M}},Ee.unstable_act=B,Ee.useCallback=function(v,M){return ve.current.useCallback(v,M)},Ee.useContext=function(v){return ve.current.useContext(v)},Ee.useDebugValue=function(){},Ee.useDeferredValue=function(v){return ve.current.useDeferredValue(v)},Ee.useEffect=function(v,M){return ve.current.useEffect(v,M)},Ee.useId=function(){return ve.current.useId()},Ee.useImperativeHandle=function(v,M,pe){return ve.current.useImperativeHandle(v,M,pe)},Ee.useInsertionEffect=function(v,M){return ve.current.useInsertionEffect(v,M)},Ee.useLayoutEffect=function(v,M){return ve.current.useLayoutEffect(v,M)},Ee.useMemo=function(v,M){return ve.current.useMemo(v,M)},Ee.useReducer=function(v,M,pe){return ve.current.useReducer(v,M,pe)},Ee.useRef=function(v){return ve.current.useRef(v)},Ee.useState=function(v){return ve.current.useState(v)},Ee.useSyncExternalStore=function(v,M,pe){return ve.current.useSyncExternalStore(v,M,pe)},Ee.useTransition=function(){return ve.current.useTransition()},Ee.version="18.3.1",Ee}var Od;function Va(){return Od||(Od=1,Ca.exports=ym()),Ca.exports}var Ad;function xm(){if(Ad)return Us;Ad=1;var n=Va(),r=Symbol.for("react.element"),o=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,d=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,f={key:!0,ref:!0,__self:!0,__source:!0};function p(g,x,w){var E,S={},P=null,R=null;w!==void 0&&(P=""+w),x.key!==void 0&&(P=""+x.key),x.ref!==void 0&&(R=x.ref);for(E in x)a.call(x,E)&&!f.hasOwnProperty(E)&&(S[E]=x[E]);if(g&&g.defaultProps)for(E in x=g.defaultProps,x)S[E]===void 0&&(S[E]=x[E]);return{$$typeof:r,type:g,key:P,ref:R,props:S,_owner:d.current}}return Us.Fragment=o,Us.jsx=p,Us.jsxs=p,Us}var $d;function wm(){return $d||($d=1,Sa.exports=xm()),Sa.exports}var i=wm(),m=Va();const km=zf(m);var uo={},Na={exports:{}},kt={},ba={exports:{}},_a={};var Ld;function jm(){return Ld||(Ld=1,(function(n){function r(W,se){var B=W.length;W.push(se);e:for(;0<B;){var v=B-1>>>1,M=W[v];if(0<d(M,se))W[v]=se,W[B]=M,B=v;else break e}}function o(W){return W.length===0?null:W[0]}function a(W){if(W.length===0)return null;var se=W[0],B=W.pop();if(B!==se){W[0]=B;e:for(var v=0,M=W.length,pe=M>>>1;v<pe;){var V=2*(v+1)-1,oe=W[V],ge=V+1,Se=W[ge];if(0>d(oe,B))ge<M&&0>d(Se,oe)?(W[v]=Se,W[ge]=B,v=ge):(W[v]=oe,W[V]=B,v=V);else if(ge<M&&0>d(Se,B))W[v]=Se,W[ge]=B,v=ge;else break e}}return se}function d(W,se){var B=W.sortIndex-se.sortIndex;return B!==0?B:W.id-se.id}if(typeof performance=="object"&&typeof performance.now=="function"){var f=performance;n.unstable_now=function(){return f.now()}}else{var p=Date,g=p.now();n.unstable_now=function(){return p.now()-g}}var x=[],w=[],E=1,S=null,P=3,R=!1,$=!1,O=!1,F=typeof setTimeout=="function"?setTimeout:null,te=typeof clearTimeout=="function"?clearTimeout:null,L=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function ye(W){for(var se=o(w);se!==null;){if(se.callback===null)a(w);else if(se.startTime<=W)a(w),se.sortIndex=se.expirationTime,r(x,se);else break;se=o(w)}}function J(W){if(O=!1,ye(W),!$)if(o(x)!==null)$=!0,me(ne);else{var se=o(w);se!==null&&ve(J,se.startTime-W)}}function ne(W,se){$=!1,O&&(O=!1,te(Z),Z=-1),R=!0;var B=P;try{for(ye(se),S=o(x);S!==null&&(!(S.expirationTime>se)||W&&!G());){var v=S.callback;if(typeof v=="function"){S.callback=null,P=S.priorityLevel;var M=v(S.expirationTime<=se);se=n.unstable_now(),typeof M=="function"?S.callback=M:S===o(x)&&a(x),ye(se)}else a(x);S=o(x)}if(S!==null)var pe=!0;else{var V=o(w);V!==null&&ve(J,V.startTime-se),pe=!1}return pe}finally{S=null,P=B,R=!1}}var N=!1,D=null,Z=-1,X=5,ie=-1;function G(){return!(n.unstable_now()-ie<X)}function je(){if(D!==null){var W=n.unstable_now();ie=W;var se=!0;try{se=D(!0,W)}finally{se?ee():(N=!1,D=null)}}else N=!1}var ee;if(typeof L=="function")ee=function(){L(je)};else if(typeof MessageChannel<"u"){var Ce=new MessageChannel,A=Ce.port2;Ce.port1.onmessage=je,ee=function(){A.postMessage(null)}}else ee=function(){F(je,0)};function me(W){D=W,N||(N=!0,ee())}function ve(W,se){Z=F(function(){W(n.unstable_now())},se)}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(W){W.callback=null},n.unstable_continueExecution=function(){$||R||($=!0,me(ne))},n.unstable_forceFrameRate=function(W){0>W||125<W?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):X=0<W?Math.floor(1e3/W):5},n.unstable_getCurrentPriorityLevel=function(){return P},n.unstable_getFirstCallbackNode=function(){return o(x)},n.unstable_next=function(W){switch(P){case 1:case 2:case 3:var se=3;break;default:se=P}var B=P;P=se;try{return W()}finally{P=B}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(W,se){switch(W){case 1:case 2:case 3:case 4:case 5:break;default:W=3}var B=P;P=W;try{return se()}finally{P=B}},n.unstable_scheduleCallback=function(W,se,B){var v=n.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?v+B:v):B=v,W){case 1:var M=-1;break;case 2:M=250;break;case 5:M=1073741823;break;case 4:M=1e4;break;default:M=5e3}return M=B+M,W={id:E++,callback:se,priorityLevel:W,startTime:B,expirationTime:M,sortIndex:-1},B>v?(W.sortIndex=B,r(w,W),o(x)===null&&W===o(w)&&(O?(te(Z),Z=-1):O=!0,ve(J,B-v))):(W.sortIndex=M,r(x,W),$||R||($=!0,me(ne))),W},n.unstable_shouldYield=G,n.unstable_wrapCallback=function(W){var se=P;return function(){var B=P;P=se;try{return W.apply(this,arguments)}finally{P=B}}}})(_a)),_a}var Dd;function Sm(){return Dd||(Dd=1,ba.exports=jm()),ba.exports}var zd;function Cm(){if(zd)return kt;zd=1;var n=Va(),r=Sm();function o(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,s=1;s<arguments.length;s++)t+="&args[]="+encodeURIComponent(arguments[s]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var a=new Set,d={};function f(e,t){p(e,t),p(e+"Capture",t)}function p(e,t){for(d[e]=t,e=0;e<t.length;e++)a.add(t[e])}var g=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),x=Object.prototype.hasOwnProperty,w=/^[: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]*$/,E={},S={};function P(e){return x.call(S,e)?!0:x.call(E,e)?!1:w.test(e)?S[e]=!0:(E[e]=!0,!1)}function R(e,t,s,l){if(s!==null&&s.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return l?!1:s!==null?!s.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function $(e,t,s,l){if(t===null||typeof t>"u"||R(e,t,s,l))return!0;if(l)return!1;if(s!==null)switch(s.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function O(e,t,s,l,c,u,h){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=l,this.attributeNamespace=c,this.mustUseProperty=s,this.propertyName=e,this.type=t,this.sanitizeURL=u,this.removeEmptyString=h}var F={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){F[e]=new O(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];F[t]=new O(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){F[e]=new O(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){F[e]=new O(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){F[e]=new O(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){F[e]=new O(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){F[e]=new O(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){F[e]=new O(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){F[e]=new O(e,5,!1,e.toLowerCase(),null,!1,!1)});var te=/[\-:]([a-z])/g;function L(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(te,L);F[t]=new O(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(te,L);F[t]=new O(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(te,L);F[t]=new O(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){F[e]=new O(e,1,!1,e.toLowerCase(),null,!1,!1)}),F.xlinkHref=new O("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){F[e]=new O(e,1,!1,e.toLowerCase(),null,!0,!0)});function ye(e,t,s,l){var c=F.hasOwnProperty(t)?F[t]:null;(c!==null?c.type!==0:l||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&($(t,s,c,l)&&(s=null),l||c===null?P(t)&&(s===null?e.removeAttribute(t):e.setAttribute(t,""+s)):c.mustUseProperty?e[c.propertyName]=s===null?c.type===3?!1:"":s:(t=c.attributeName,l=c.attributeNamespace,s===null?e.removeAttribute(t):(c=c.type,s=c===3||c===4&&s===!0?"":""+s,l?e.setAttributeNS(l,t,s):e.setAttribute(t,s))))}var J=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,ne=Symbol.for("react.element"),N=Symbol.for("react.portal"),D=Symbol.for("react.fragment"),Z=Symbol.for("react.strict_mode"),X=Symbol.for("react.profiler"),ie=Symbol.for("react.provider"),G=Symbol.for("react.context"),je=Symbol.for("react.forward_ref"),ee=Symbol.for("react.suspense"),Ce=Symbol.for("react.suspense_list"),A=Symbol.for("react.memo"),me=Symbol.for("react.lazy"),ve=Symbol.for("react.offscreen"),W=Symbol.iterator;function se(e){return e===null||typeof e!="object"?null:(e=W&&e[W]||e["@@iterator"],typeof e=="function"?e:null)}var B=Object.assign,v;function M(e){if(v===void 0)try{throw Error()}catch(s){var t=s.stack.trim().match(/\n( *(at )?)/);v=t&&t[1]||""}return`
3
+ `+v+e}var pe=!1;function V(e,t){if(!e||pe)return"";pe=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(T){var l=T}Reflect.construct(e,[],t)}else{try{t.call()}catch(T){l=T}e.call(t.prototype)}else{try{throw Error()}catch(T){l=T}e()}}catch(T){if(T&&l&&typeof T.stack=="string"){for(var c=T.stack.split(`
4
+ `),u=l.stack.split(`
5
+ `),h=c.length-1,y=u.length-1;1<=h&&0<=y&&c[h]!==u[y];)y--;for(;1<=h&&0<=y;h--,y--)if(c[h]!==u[y]){if(h!==1||y!==1)do if(h--,y--,0>y||c[h]!==u[y]){var k=`
6
+ `+c[h].replace(" at new "," at ");return e.displayName&&k.includes("<anonymous>")&&(k=k.replace("<anonymous>",e.displayName)),k}while(1<=h&&0<=y);break}}}finally{pe=!1,Error.prepareStackTrace=s}return(e=e?e.displayName||e.name:"")?M(e):""}function oe(e){switch(e.tag){case 5:return M(e.type);case 16:return M("Lazy");case 13:return M("Suspense");case 19:return M("SuspenseList");case 0:case 2:case 15:return e=V(e.type,!1),e;case 11:return e=V(e.type.render,!1),e;case 1:return e=V(e.type,!0),e;default:return""}}function ge(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case D:return"Fragment";case N:return"Portal";case X:return"Profiler";case Z:return"StrictMode";case ee:return"Suspense";case Ce:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case G:return(e.displayName||"Context")+".Consumer";case ie:return(e._context.displayName||"Context")+".Provider";case je:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case A:return t=e.displayName||null,t!==null?t:ge(e.type)||"Memo";case me:t=e._payload,e=e._init;try{return ge(e(t))}catch{}}return null}function Se(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ge(t);case 8:return t===Z?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function be(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ue(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Me(e){var t=ue(e)?"checked":"value",s=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),l=""+e[t];if(!e.hasOwnProperty(t)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var c=s.get,u=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(h){l=""+h,u.call(this,h)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return l},setValue:function(h){l=""+h},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function bt(e){e._valueTracker||(e._valueTracker=Me(e))}function ht(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var s=t.getValue(),l="";return e&&(l=ue(e)?e.checked?"true":"false":e.value),e=l,e!==s?(t.setValue(e),!0):!1}function Tt(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}}function _t(e,t){var s=t.checked;return B({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:s??e._wrapperState.initialChecked})}function rt(e,t){var s=t.defaultValue==null?"":t.defaultValue,l=t.checked!=null?t.checked:t.defaultChecked;s=be(t.value!=null?t.value:s),e._wrapperState={initialChecked:l,initialValue:s,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Xe(e,t){t=t.checked,t!=null&&ye(e,"checked",t,!1)}function mt(e,t){Xe(e,t);var s=be(t.value),l=t.type;if(s!=null)l==="number"?(s===0&&e.value===""||e.value!=s)&&(e.value=""+s):e.value!==""+s&&(e.value=""+s);else if(l==="submit"||l==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?pn(e,t.type,s):t.hasOwnProperty("defaultValue")&&pn(e,t.type,be(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function fn(e,t,s){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var l=t.type;if(!(l!=="submit"&&l!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,s||t===e.value||(e.value=t),e.defaultValue=t}s=e.name,s!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,s!==""&&(e.name=s)}function pn(e,t,s){(t!=="number"||Tt(e.ownerDocument)!==e)&&(s==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+s&&(e.defaultValue=""+s))}var nn=Array.isArray;function Ut(e,t,s,l){if(e=e.options,t){t={};for(var c=0;c<s.length;c++)t["$"+s[c]]=!0;for(s=0;s<e.length;s++)c=t.hasOwnProperty("$"+e[s].value),e[s].selected!==c&&(e[s].selected=c),c&&l&&(e[s].defaultSelected=!0)}else{for(s=""+be(s),t=null,c=0;c<e.length;c++){if(e[c].value===s){e[c].selected=!0,l&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function Tn(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(o(91));return B({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function dt(e,t){var s=t.value;if(s==null){if(s=t.children,t=t.defaultValue,s!=null){if(t!=null)throw Error(o(92));if(nn(s)){if(1<s.length)throw Error(o(93));s=s[0]}t=s}t==null&&(t=""),s=t}e._wrapperState={initialValue:be(s)}}function tr(e,t){var s=be(t.value),l=be(t.defaultValue);s!=null&&(s=""+s,s!==e.value&&(e.value=s),t.defaultValue==null&&e.defaultValue!==s&&(e.defaultValue=s)),l!=null&&(e.defaultValue=""+l)}function nr(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function rn(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function hn(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?rn(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var mn,Y=(function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,s,l,c){MSApp.execUnsafeLocalFunction(function(){return e(t,s,l,c)})}:e})(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(mn=mn||document.createElement("div"),mn.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=mn.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function xe(e,t){if(t){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=t;return}}e.textContent=t}var _e={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},We=["Webkit","ms","Moz","O"];Object.keys(_e).forEach(function(e){We.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),_e[t]=_e[e]})});function Mt(e,t,s){return t==null||typeof t=="boolean"||t===""?"":s||typeof t!="number"||t===0||_e.hasOwnProperty(e)&&_e[e]?(""+t).trim():t+"px"}function gn(e,t){e=e.style;for(var s in t)if(t.hasOwnProperty(s)){var l=s.indexOf("--")===0,c=Mt(s,t[s],l);s==="float"&&(s="cssFloat"),l?e.setProperty(s,c):e[s]=c}}var rr=B({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ht(e,t){if(t){if(rr[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(o(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(o(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(o(61))}if(t.style!=null&&typeof t.style!="object")throw Error(o(62))}}function Cr(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";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 Nr=null;function br(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var _r=null,vn=null,yn=null;function ls(e){if(e=Es(e)){if(typeof _r!="function")throw Error(o(280));var t=e.stateNode;t&&(t=Ni(t),_r(e.stateNode,e.type,t))}}function as(e){vn?yn?yn.push(e):yn=[e]:vn=e}function cs(){if(vn){var e=vn,t=yn;if(yn=vn=null,ls(e),t)for(e=0;e<t.length;e++)ls(t[e])}}function ni(e,t){return e(t)}function C(){}var b=!1;function z(e,t,s){if(b)return e(t,s);b=!0;try{return ni(e,t,s)}finally{b=!1,(vn!==null||yn!==null)&&(C(),cs())}}function le(e,t){var s=e.stateNode;if(s===null)return null;var l=Ni(s);if(l===null)return null;s=l[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(s&&typeof s!="function")throw Error(o(231,t,typeof s));return s}var de=!1;if(g)try{var Oe={};Object.defineProperty(Oe,"passive",{get:function(){de=!0}}),window.addEventListener("test",Oe,Oe),window.removeEventListener("test",Oe,Oe)}catch{de=!1}function Ve(e,t,s,l,c,u,h,y,k){var T=Array.prototype.slice.call(arguments,3);try{t.apply(s,T)}catch(U){this.onError(U)}}var Ue=!1,Ot=null,Ir=!1,us=null,ot={onError:function(e){Ue=!0,Ot=e}};function ri(e,t,s,l,c,u,h,y,k){Ue=!1,Ot=null,Ve.apply(ot,arguments)}function si(e,t,s,l,c,u,h,y,k){if(ri.apply(this,arguments),Ue){if(Ue){var T=Ot;Ue=!1,Ot=null}else throw Error(o(198));Ir||(Ir=!0,us=T)}}function sn(e){var t=e,s=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(s=t.return),e=t.return;while(e)}return t.tag===3?s:null}function nc(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function rc(e){if(sn(e)!==e)throw Error(o(188))}function bp(e){var t=e.alternate;if(!t){if(t=sn(e),t===null)throw Error(o(188));return t!==e?null:e}for(var s=e,l=t;;){var c=s.return;if(c===null)break;var u=c.alternate;if(u===null){if(l=c.return,l!==null){s=l;continue}break}if(c.child===u.child){for(u=c.child;u;){if(u===s)return rc(c),e;if(u===l)return rc(c),t;u=u.sibling}throw Error(o(188))}if(s.return!==l.return)s=c,l=u;else{for(var h=!1,y=c.child;y;){if(y===s){h=!0,s=c,l=u;break}if(y===l){h=!0,l=c,s=u;break}y=y.sibling}if(!h){for(y=u.child;y;){if(y===s){h=!0,s=u,l=c;break}if(y===l){h=!0,l=u,s=c;break}y=y.sibling}if(!h)throw Error(o(189))}}if(s.alternate!==l)throw Error(o(190))}if(s.tag!==3)throw Error(o(188));return s.stateNode.current===s?e:t}function sc(e){return e=bp(e),e!==null?ic(e):null}function ic(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=ic(e);if(t!==null)return t;e=e.sibling}return null}var oc=r.unstable_scheduleCallback,lc=r.unstable_cancelCallback,_p=r.unstable_shouldYield,Ip=r.unstable_requestPaint,Ke=r.unstable_now,Ep=r.unstable_getCurrentPriorityLevel,qo=r.unstable_ImmediatePriority,ac=r.unstable_UserBlockingPriority,ii=r.unstable_NormalPriority,Pp=r.unstable_LowPriority,cc=r.unstable_IdlePriority,oi=null,on=null;function Rp(e){if(on&&typeof on.onCommitFiberRoot=="function")try{on.onCommitFiberRoot(oi,e,void 0,(e.current.flags&128)===128)}catch{}}var Vt=Math.clz32?Math.clz32:Op,Tp=Math.log,Mp=Math.LN2;function Op(e){return e>>>=0,e===0?32:31-(Tp(e)/Mp|0)|0}var li=64,ai=4194304;function ds(e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function ci(e,t){var s=e.pendingLanes;if(s===0)return 0;var l=0,c=e.suspendedLanes,u=e.pingedLanes,h=s&268435455;if(h!==0){var y=h&~c;y!==0?l=ds(y):(u&=h,u!==0&&(l=ds(u)))}else h=s&~c,h!==0?l=ds(h):u!==0&&(l=ds(u));if(l===0)return 0;if(t!==0&&t!==l&&(t&c)===0&&(c=l&-l,u=t&-t,c>=u||c===16&&(u&4194240)!==0))return t;if((l&4)!==0&&(l|=s&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=l;0<t;)s=31-Vt(t),c=1<<s,l|=e[s],t&=~c;return l}function Ap(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64: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 t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function $p(e,t){for(var s=e.suspendedLanes,l=e.pingedLanes,c=e.expirationTimes,u=e.pendingLanes;0<u;){var h=31-Vt(u),y=1<<h,k=c[h];k===-1?((y&s)===0||(y&l)!==0)&&(c[h]=Ap(y,t)):k<=t&&(e.expiredLanes|=y),u&=~y}}function Uo(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function uc(){var e=li;return li<<=1,(li&4194240)===0&&(li=64),e}function Ho(e){for(var t=[],s=0;31>s;s++)t.push(e);return t}function fs(e,t,s){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Vt(t),e[t]=s}function Lp(e,t){var s=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var l=e.eventTimes;for(e=e.expirationTimes;0<s;){var c=31-Vt(s),u=1<<c;t[c]=0,l[c]=-1,e[c]=-1,s&=~u}}function Vo(e,t){var s=e.entangledLanes|=t;for(e=e.entanglements;s;){var l=31-Vt(s),c=1<<l;c&t|e[l]&t&&(e[l]|=t),s&=~c}}var Ae=0;function dc(e){return e&=-e,1<e?4<e?(e&268435455)!==0?16:536870912:4:1}var fc,Ko,pc,hc,mc,Go=!1,ui=[],Mn=null,On=null,An=null,ps=new Map,hs=new Map,$n=[],Dp="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 submit".split(" ");function gc(e,t){switch(e){case"focusin":case"focusout":Mn=null;break;case"dragenter":case"dragleave":On=null;break;case"mouseover":case"mouseout":An=null;break;case"pointerover":case"pointerout":ps.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":hs.delete(t.pointerId)}}function ms(e,t,s,l,c,u){return e===null||e.nativeEvent!==u?(e={blockedOn:t,domEventName:s,eventSystemFlags:l,nativeEvent:u,targetContainers:[c]},t!==null&&(t=Es(t),t!==null&&Ko(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function zp(e,t,s,l,c){switch(t){case"focusin":return Mn=ms(Mn,e,t,s,l,c),!0;case"dragenter":return On=ms(On,e,t,s,l,c),!0;case"mouseover":return An=ms(An,e,t,s,l,c),!0;case"pointerover":var u=c.pointerId;return ps.set(u,ms(ps.get(u)||null,e,t,s,l,c)),!0;case"gotpointercapture":return u=c.pointerId,hs.set(u,ms(hs.get(u)||null,e,t,s,l,c)),!0}return!1}function vc(e){var t=sr(e.target);if(t!==null){var s=sn(t);if(s!==null){if(t=s.tag,t===13){if(t=nc(s),t!==null){e.blockedOn=t,mc(e.priority,function(){pc(s)});return}}else if(t===3&&s.stateNode.current.memoizedState.isDehydrated){e.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}e.blockedOn=null}function di(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var s=Yo(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(s===null){s=e.nativeEvent;var l=new s.constructor(s.type,s);Nr=l,s.target.dispatchEvent(l),Nr=null}else return t=Es(s),t!==null&&Ko(t),e.blockedOn=s,!1;t.shift()}return!0}function yc(e,t,s){di(e)&&s.delete(t)}function Wp(){Go=!1,Mn!==null&&di(Mn)&&(Mn=null),On!==null&&di(On)&&(On=null),An!==null&&di(An)&&(An=null),ps.forEach(yc),hs.forEach(yc)}function gs(e,t){e.blockedOn===t&&(e.blockedOn=null,Go||(Go=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,Wp)))}function vs(e){function t(c){return gs(c,e)}if(0<ui.length){gs(ui[0],e);for(var s=1;s<ui.length;s++){var l=ui[s];l.blockedOn===e&&(l.blockedOn=null)}}for(Mn!==null&&gs(Mn,e),On!==null&&gs(On,e),An!==null&&gs(An,e),ps.forEach(t),hs.forEach(t),s=0;s<$n.length;s++)l=$n[s],l.blockedOn===e&&(l.blockedOn=null);for(;0<$n.length&&(s=$n[0],s.blockedOn===null);)vc(s),s.blockedOn===null&&$n.shift()}var Er=J.ReactCurrentBatchConfig,fi=!0;function Fp(e,t,s,l){var c=Ae,u=Er.transition;Er.transition=null;try{Ae=1,Qo(e,t,s,l)}finally{Ae=c,Er.transition=u}}function Bp(e,t,s,l){var c=Ae,u=Er.transition;Er.transition=null;try{Ae=4,Qo(e,t,s,l)}finally{Ae=c,Er.transition=u}}function Qo(e,t,s,l){if(fi){var c=Yo(e,t,s,l);if(c===null)pl(e,t,l,pi,s),gc(e,l);else if(zp(c,e,t,s,l))l.stopPropagation();else if(gc(e,l),t&4&&-1<Dp.indexOf(e)){for(;c!==null;){var u=Es(c);if(u!==null&&fc(u),u=Yo(e,t,s,l),u===null&&pl(e,t,l,pi,s),u===c)break;c=u}c!==null&&l.stopPropagation()}else pl(e,t,l,null,s)}}var pi=null;function Yo(e,t,s,l){if(pi=null,e=br(l),e=sr(e),e!==null)if(t=sn(e),t===null)e=null;else if(s=t.tag,s===13){if(e=nc(t),e!==null)return e;e=null}else if(s===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return pi=e,null}function xc(e){switch(e){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Ep()){case qo:return 1;case ac:return 4;case ii:case Pp:return 16;case cc:return 536870912;default:return 16}default:return 16}}var Ln=null,Xo=null,hi=null;function wc(){if(hi)return hi;var e,t=Xo,s=t.length,l,c="value"in Ln?Ln.value:Ln.textContent,u=c.length;for(e=0;e<s&&t[e]===c[e];e++);var h=s-e;for(l=1;l<=h&&t[s-l]===c[u-l];l++);return hi=c.slice(e,1<l?1-l:void 0)}function mi(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function gi(){return!0}function kc(){return!1}function It(e){function t(s,l,c,u,h){this._reactName=s,this._targetInst=c,this.type=l,this.nativeEvent=u,this.target=h,this.currentTarget=null;for(var y in e)e.hasOwnProperty(y)&&(s=e[y],this[y]=s?s(u):u[y]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?gi:kc,this.isPropagationStopped=kc,this}return B(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=gi)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=gi)},persist:function(){},isPersistent:gi}),t}var Pr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Jo=It(Pr),ys=B({},Pr,{view:0,detail:0}),qp=It(ys),Zo,el,xs,vi=B({},ys,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:nl,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!==xs&&(xs&&e.type==="mousemove"?(Zo=e.screenX-xs.screenX,el=e.screenY-xs.screenY):el=Zo=0,xs=e),Zo)},movementY:function(e){return"movementY"in e?e.movementY:el}}),jc=It(vi),Up=B({},vi,{dataTransfer:0}),Hp=It(Up),Vp=B({},ys,{relatedTarget:0}),tl=It(Vp),Kp=B({},Pr,{animationName:0,elapsedTime:0,pseudoElement:0}),Gp=It(Kp),Qp=B({},Pr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Yp=It(Qp),Xp=B({},Pr,{data:0}),Sc=It(Xp),Jp={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Zp={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"},eh={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function th(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=eh[e])?!!t[e]:!1}function nl(){return th}var nh=B({},ys,{key:function(e){if(e.key){var t=Jp[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=mi(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Zp[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:nl,charCode:function(e){return e.type==="keypress"?mi(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?mi(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),rh=It(nh),sh=B({},vi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Cc=It(sh),ih=B({},ys,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:nl}),oh=It(ih),lh=B({},Pr,{propertyName:0,elapsedTime:0,pseudoElement:0}),ah=It(lh),ch=B({},vi,{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}),uh=It(ch),dh=[9,13,27,32],rl=g&&"CompositionEvent"in window,ws=null;g&&"documentMode"in document&&(ws=document.documentMode);var fh=g&&"TextEvent"in window&&!ws,Nc=g&&(!rl||ws&&8<ws&&11>=ws),bc=" ",_c=!1;function Ic(e,t){switch(e){case"keyup":return dh.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ec(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Rr=!1;function ph(e,t){switch(e){case"compositionend":return Ec(t);case"keypress":return t.which!==32?null:(_c=!0,bc);case"textInput":return e=t.data,e===bc&&_c?null:e;default:return null}}function hh(e,t){if(Rr)return e==="compositionend"||!rl&&Ic(e,t)?(e=wc(),hi=Xo=Ln=null,Rr=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Nc&&t.locale!=="ko"?null:t.data;default:return null}}var mh={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 Pc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!mh[e.type]:t==="textarea"}function Rc(e,t,s,l){as(l),t=ji(t,"onChange"),0<t.length&&(s=new Jo("onChange","change",null,s,l),e.push({event:s,listeners:t}))}var ks=null,js=null;function gh(e){Qc(e,0)}function yi(e){var t=$r(e);if(ht(t))return e}function vh(e,t){if(e==="change")return t}var Tc=!1;if(g){var sl;if(g){var il="oninput"in document;if(!il){var Mc=document.createElement("div");Mc.setAttribute("oninput","return;"),il=typeof Mc.oninput=="function"}sl=il}else sl=!1;Tc=sl&&(!document.documentMode||9<document.documentMode)}function Oc(){ks&&(ks.detachEvent("onpropertychange",Ac),js=ks=null)}function Ac(e){if(e.propertyName==="value"&&yi(js)){var t=[];Rc(t,js,e,br(e)),z(gh,t)}}function yh(e,t,s){e==="focusin"?(Oc(),ks=t,js=s,ks.attachEvent("onpropertychange",Ac)):e==="focusout"&&Oc()}function xh(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return yi(js)}function wh(e,t){if(e==="click")return yi(t)}function kh(e,t){if(e==="input"||e==="change")return yi(t)}function jh(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Kt=typeof Object.is=="function"?Object.is:jh;function Ss(e,t){if(Kt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var s=Object.keys(e),l=Object.keys(t);if(s.length!==l.length)return!1;for(l=0;l<s.length;l++){var c=s[l];if(!x.call(t,c)||!Kt(e[c],t[c]))return!1}return!0}function $c(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Lc(e,t){var s=$c(e);e=0;for(var l;s;){if(s.nodeType===3){if(l=e+s.textContent.length,e<=t&&l>=t)return{node:s,offset:t-e};e=l}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=$c(s)}}function Dc(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Dc(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function zc(){for(var e=window,t=Tt();t instanceof e.HTMLIFrameElement;){try{var s=typeof t.contentWindow.location.href=="string"}catch{s=!1}if(s)e=t.contentWindow;else break;t=Tt(e.document)}return t}function ol(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Sh(e){var t=zc(),s=e.focusedElem,l=e.selectionRange;if(t!==s&&s&&s.ownerDocument&&Dc(s.ownerDocument.documentElement,s)){if(l!==null&&ol(s)){if(t=l.start,e=l.end,e===void 0&&(e=t),"selectionStart"in s)s.selectionStart=t,s.selectionEnd=Math.min(e,s.value.length);else if(e=(t=s.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var c=s.textContent.length,u=Math.min(l.start,c);l=l.end===void 0?u:Math.min(l.end,c),!e.extend&&u>l&&(c=l,l=u,u=c),c=Lc(s,u);var h=Lc(s,l);c&&h&&(e.rangeCount!==1||e.anchorNode!==c.node||e.anchorOffset!==c.offset||e.focusNode!==h.node||e.focusOffset!==h.offset)&&(t=t.createRange(),t.setStart(c.node,c.offset),e.removeAllRanges(),u>l?(e.addRange(t),e.extend(h.node,h.offset)):(t.setEnd(h.node,h.offset),e.addRange(t)))}}for(t=[],e=s;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;s<t.length;s++)e=t[s],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Ch=g&&"documentMode"in document&&11>=document.documentMode,Tr=null,ll=null,Cs=null,al=!1;function Wc(e,t,s){var l=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;al||Tr==null||Tr!==Tt(l)||(l=Tr,"selectionStart"in l&&ol(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Cs&&Ss(Cs,l)||(Cs=l,l=ji(ll,"onSelect"),0<l.length&&(t=new Jo("onSelect","select",null,t,s),e.push({event:t,listeners:l}),t.target=Tr)))}function xi(e,t){var s={};return s[e.toLowerCase()]=t.toLowerCase(),s["Webkit"+e]="webkit"+t,s["Moz"+e]="moz"+t,s}var Mr={animationend:xi("Animation","AnimationEnd"),animationiteration:xi("Animation","AnimationIteration"),animationstart:xi("Animation","AnimationStart"),transitionend:xi("Transition","TransitionEnd")},cl={},Fc={};g&&(Fc=document.createElement("div").style,"AnimationEvent"in window||(delete Mr.animationend.animation,delete Mr.animationiteration.animation,delete Mr.animationstart.animation),"TransitionEvent"in window||delete Mr.transitionend.transition);function wi(e){if(cl[e])return cl[e];if(!Mr[e])return e;var t=Mr[e],s;for(s in t)if(t.hasOwnProperty(s)&&s in Fc)return cl[e]=t[s];return e}var Bc=wi("animationend"),qc=wi("animationiteration"),Uc=wi("animationstart"),Hc=wi("transitionend"),Vc=new Map,Kc="abort auxClick 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(" ");function Dn(e,t){Vc.set(e,t),f(t,[e])}for(var ul=0;ul<Kc.length;ul++){var dl=Kc[ul],Nh=dl.toLowerCase(),bh=dl[0].toUpperCase()+dl.slice(1);Dn(Nh,"on"+bh)}Dn(Bc,"onAnimationEnd"),Dn(qc,"onAnimationIteration"),Dn(Uc,"onAnimationStart"),Dn("dblclick","onDoubleClick"),Dn("focusin","onFocus"),Dn("focusout","onBlur"),Dn(Hc,"onTransitionEnd"),p("onMouseEnter",["mouseout","mouseover"]),p("onMouseLeave",["mouseout","mouseover"]),p("onPointerEnter",["pointerout","pointerover"]),p("onPointerLeave",["pointerout","pointerover"]),f("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),f("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),f("onBeforeInput",["compositionend","keypress","textInput","paste"]),f("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),f("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),f("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ns="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(" "),_h=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ns));function Gc(e,t,s){var l=e.type||"unknown-event";e.currentTarget=s,si(l,t,void 0,e),e.currentTarget=null}function Qc(e,t){t=(t&4)!==0;for(var s=0;s<e.length;s++){var l=e[s],c=l.event;l=l.listeners;e:{var u=void 0;if(t)for(var h=l.length-1;0<=h;h--){var y=l[h],k=y.instance,T=y.currentTarget;if(y=y.listener,k!==u&&c.isPropagationStopped())break e;Gc(c,y,T),u=k}else for(h=0;h<l.length;h++){if(y=l[h],k=y.instance,T=y.currentTarget,y=y.listener,k!==u&&c.isPropagationStopped())break e;Gc(c,y,T),u=k}}}if(Ir)throw e=us,Ir=!1,us=null,e}function Le(e,t){var s=t[xl];s===void 0&&(s=t[xl]=new Set);var l=e+"__bubble";s.has(l)||(Yc(t,e,2,!1),s.add(l))}function fl(e,t,s){var l=0;t&&(l|=4),Yc(s,e,l,t)}var ki="_reactListening"+Math.random().toString(36).slice(2);function bs(e){if(!e[ki]){e[ki]=!0,a.forEach(function(s){s!=="selectionchange"&&(_h.has(s)||fl(s,!1,e),fl(s,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ki]||(t[ki]=!0,fl("selectionchange",!1,t))}}function Yc(e,t,s,l){switch(xc(t)){case 1:var c=Fp;break;case 4:c=Bp;break;default:c=Qo}s=c.bind(null,t,s,e),c=void 0,!de||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),l?c!==void 0?e.addEventListener(t,s,{capture:!0,passive:c}):e.addEventListener(t,s,!0):c!==void 0?e.addEventListener(t,s,{passive:c}):e.addEventListener(t,s,!1)}function pl(e,t,s,l,c){var u=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var h=l.tag;if(h===3||h===4){var y=l.stateNode.containerInfo;if(y===c||y.nodeType===8&&y.parentNode===c)break;if(h===4)for(h=l.return;h!==null;){var k=h.tag;if((k===3||k===4)&&(k=h.stateNode.containerInfo,k===c||k.nodeType===8&&k.parentNode===c))return;h=h.return}for(;y!==null;){if(h=sr(y),h===null)return;if(k=h.tag,k===5||k===6){l=u=h;continue e}y=y.parentNode}}l=l.return}z(function(){var T=u,U=br(s),H=[];e:{var q=Vc.get(e);if(q!==void 0){var re=Jo,ce=e;switch(e){case"keypress":if(mi(s)===0)break e;case"keydown":case"keyup":re=rh;break;case"focusin":ce="focus",re=tl;break;case"focusout":ce="blur",re=tl;break;case"beforeblur":case"afterblur":re=tl;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":re=jc;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":re=Hp;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":re=oh;break;case Bc:case qc:case Uc:re=Gp;break;case Hc:re=ah;break;case"scroll":re=qp;break;case"wheel":re=uh;break;case"copy":case"cut":case"paste":re=Yp;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":re=Cc}var fe=(t&4)!==0,Ge=!fe&&e==="scroll",_=fe?q!==null?q+"Capture":null:q;fe=[];for(var j=T,I;j!==null;){I=j;var K=I.stateNode;if(I.tag===5&&K!==null&&(I=K,_!==null&&(K=le(j,_),K!=null&&fe.push(_s(j,K,I)))),Ge)break;j=j.return}0<fe.length&&(q=new re(q,ce,null,s,U),H.push({event:q,listeners:fe}))}}if((t&7)===0){e:{if(q=e==="mouseover"||e==="pointerover",re=e==="mouseout"||e==="pointerout",q&&s!==Nr&&(ce=s.relatedTarget||s.fromElement)&&(sr(ce)||ce[xn]))break e;if((re||q)&&(q=U.window===U?U:(q=U.ownerDocument)?q.defaultView||q.parentWindow:window,re?(ce=s.relatedTarget||s.toElement,re=T,ce=ce?sr(ce):null,ce!==null&&(Ge=sn(ce),ce!==Ge||ce.tag!==5&&ce.tag!==6)&&(ce=null)):(re=null,ce=T),re!==ce)){if(fe=jc,K="onMouseLeave",_="onMouseEnter",j="mouse",(e==="pointerout"||e==="pointerover")&&(fe=Cc,K="onPointerLeave",_="onPointerEnter",j="pointer"),Ge=re==null?q:$r(re),I=ce==null?q:$r(ce),q=new fe(K,j+"leave",re,s,U),q.target=Ge,q.relatedTarget=I,K=null,sr(U)===T&&(fe=new fe(_,j+"enter",ce,s,U),fe.target=I,fe.relatedTarget=Ge,K=fe),Ge=K,re&&ce)t:{for(fe=re,_=ce,j=0,I=fe;I;I=Or(I))j++;for(I=0,K=_;K;K=Or(K))I++;for(;0<j-I;)fe=Or(fe),j--;for(;0<I-j;)_=Or(_),I--;for(;j--;){if(fe===_||_!==null&&fe===_.alternate)break t;fe=Or(fe),_=Or(_)}fe=null}else fe=null;re!==null&&Xc(H,q,re,fe,!1),ce!==null&&Ge!==null&&Xc(H,Ge,ce,fe,!0)}}e:{if(q=T?$r(T):window,re=q.nodeName&&q.nodeName.toLowerCase(),re==="select"||re==="input"&&q.type==="file")var he=vh;else if(Pc(q))if(Tc)he=kh;else{he=xh;var we=yh}else(re=q.nodeName)&&re.toLowerCase()==="input"&&(q.type==="checkbox"||q.type==="radio")&&(he=wh);if(he&&(he=he(e,T))){Rc(H,he,s,U);break e}we&&we(e,q,T),e==="focusout"&&(we=q._wrapperState)&&we.controlled&&q.type==="number"&&pn(q,"number",q.value)}switch(we=T?$r(T):window,e){case"focusin":(Pc(we)||we.contentEditable==="true")&&(Tr=we,ll=T,Cs=null);break;case"focusout":Cs=ll=Tr=null;break;case"mousedown":al=!0;break;case"contextmenu":case"mouseup":case"dragend":al=!1,Wc(H,s,U);break;case"selectionchange":if(Ch)break;case"keydown":case"keyup":Wc(H,s,U)}var ke;if(rl)e:{switch(e){case"compositionstart":var Ne="onCompositionStart";break e;case"compositionend":Ne="onCompositionEnd";break e;case"compositionupdate":Ne="onCompositionUpdate";break e}Ne=void 0}else Rr?Ic(e,s)&&(Ne="onCompositionEnd"):e==="keydown"&&s.keyCode===229&&(Ne="onCompositionStart");Ne&&(Nc&&s.locale!=="ko"&&(Rr||Ne!=="onCompositionStart"?Ne==="onCompositionEnd"&&Rr&&(ke=wc()):(Ln=U,Xo="value"in Ln?Ln.value:Ln.textContent,Rr=!0)),we=ji(T,Ne),0<we.length&&(Ne=new Sc(Ne,e,null,s,U),H.push({event:Ne,listeners:we}),ke?Ne.data=ke:(ke=Ec(s),ke!==null&&(Ne.data=ke)))),(ke=fh?ph(e,s):hh(e,s))&&(T=ji(T,"onBeforeInput"),0<T.length&&(U=new Sc("onBeforeInput","beforeinput",null,s,U),H.push({event:U,listeners:T}),U.data=ke))}Qc(H,t)})}function _s(e,t,s){return{instance:e,listener:t,currentTarget:s}}function ji(e,t){for(var s=t+"Capture",l=[];e!==null;){var c=e,u=c.stateNode;c.tag===5&&u!==null&&(c=u,u=le(e,s),u!=null&&l.unshift(_s(e,u,c)),u=le(e,t),u!=null&&l.push(_s(e,u,c))),e=e.return}return l}function Or(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Xc(e,t,s,l,c){for(var u=t._reactName,h=[];s!==null&&s!==l;){var y=s,k=y.alternate,T=y.stateNode;if(k!==null&&k===l)break;y.tag===5&&T!==null&&(y=T,c?(k=le(s,u),k!=null&&h.unshift(_s(s,k,y))):c||(k=le(s,u),k!=null&&h.push(_s(s,k,y)))),s=s.return}h.length!==0&&e.push({event:t,listeners:h})}var Ih=/\r\n?/g,Eh=/\u0000|\uFFFD/g;function Jc(e){return(typeof e=="string"?e:""+e).replace(Ih,`
7
+ `).replace(Eh,"")}function Si(e,t,s){if(t=Jc(t),Jc(e)!==t&&s)throw Error(o(425))}function Ci(){}var hl=null,ml=null;function gl(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var vl=typeof setTimeout=="function"?setTimeout:void 0,Ph=typeof clearTimeout=="function"?clearTimeout:void 0,Zc=typeof Promise=="function"?Promise:void 0,Rh=typeof queueMicrotask=="function"?queueMicrotask:typeof Zc<"u"?function(e){return Zc.resolve(null).then(e).catch(Th)}:vl;function Th(e){setTimeout(function(){throw e})}function yl(e,t){var s=t,l=0;do{var c=s.nextSibling;if(e.removeChild(s),c&&c.nodeType===8)if(s=c.data,s==="/$"){if(l===0){e.removeChild(c),vs(t);return}l--}else s!=="$"&&s!=="$?"&&s!=="$!"||l++;s=c}while(s);vs(t)}function zn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function eu(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var s=e.data;if(s==="$"||s==="$!"||s==="$?"){if(t===0)return e;t--}else s==="/$"&&t++}e=e.previousSibling}return null}var Ar=Math.random().toString(36).slice(2),ln="__reactFiber$"+Ar,Is="__reactProps$"+Ar,xn="__reactContainer$"+Ar,xl="__reactEvents$"+Ar,Mh="__reactListeners$"+Ar,Oh="__reactHandles$"+Ar;function sr(e){var t=e[ln];if(t)return t;for(var s=e.parentNode;s;){if(t=s[xn]||s[ln]){if(s=t.alternate,t.child!==null||s!==null&&s.child!==null)for(e=eu(e);e!==null;){if(s=e[ln])return s;e=eu(e)}return t}e=s,s=e.parentNode}return null}function Es(e){return e=e[ln]||e[xn],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function $r(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(o(33))}function Ni(e){return e[Is]||null}var wl=[],Lr=-1;function Wn(e){return{current:e}}function De(e){0>Lr||(e.current=wl[Lr],wl[Lr]=null,Lr--)}function $e(e,t){Lr++,wl[Lr]=e.current,e.current=t}var Fn={},lt=Wn(Fn),gt=Wn(!1),ir=Fn;function Dr(e,t){var s=e.type.contextTypes;if(!s)return Fn;var l=e.stateNode;if(l&&l.__reactInternalMemoizedUnmaskedChildContext===t)return l.__reactInternalMemoizedMaskedChildContext;var c={},u;for(u in s)c[u]=t[u];return l&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=c),c}function vt(e){return e=e.childContextTypes,e!=null}function bi(){De(gt),De(lt)}function tu(e,t,s){if(lt.current!==Fn)throw Error(o(168));$e(lt,t),$e(gt,s)}function nu(e,t,s){var l=e.stateNode;if(t=t.childContextTypes,typeof l.getChildContext!="function")return s;l=l.getChildContext();for(var c in l)if(!(c in t))throw Error(o(108,Se(e)||"Unknown",c));return B({},s,l)}function _i(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Fn,ir=lt.current,$e(lt,e),$e(gt,gt.current),!0}function ru(e,t,s){var l=e.stateNode;if(!l)throw Error(o(169));s?(e=nu(e,t,ir),l.__reactInternalMemoizedMergedChildContext=e,De(gt),De(lt),$e(lt,e)):De(gt),$e(gt,s)}var wn=null,Ii=!1,kl=!1;function su(e){wn===null?wn=[e]:wn.push(e)}function Ah(e){Ii=!0,su(e)}function Bn(){if(!kl&&wn!==null){kl=!0;var e=0,t=Ae;try{var s=wn;for(Ae=1;e<s.length;e++){var l=s[e];do l=l(!0);while(l!==null)}wn=null,Ii=!1}catch(c){throw wn!==null&&(wn=wn.slice(e+1)),oc(qo,Bn),c}finally{Ae=t,kl=!1}}return null}var zr=[],Wr=0,Ei=null,Pi=0,At=[],$t=0,or=null,kn=1,jn="";function lr(e,t){zr[Wr++]=Pi,zr[Wr++]=Ei,Ei=e,Pi=t}function iu(e,t,s){At[$t++]=kn,At[$t++]=jn,At[$t++]=or,or=e;var l=kn;e=jn;var c=32-Vt(l)-1;l&=~(1<<c),s+=1;var u=32-Vt(t)+c;if(30<u){var h=c-c%5;u=(l&(1<<h)-1).toString(32),l>>=h,c-=h,kn=1<<32-Vt(t)+c|s<<c|l,jn=u+e}else kn=1<<u|s<<c|l,jn=e}function jl(e){e.return!==null&&(lr(e,1),iu(e,1,0))}function Sl(e){for(;e===Ei;)Ei=zr[--Wr],zr[Wr]=null,Pi=zr[--Wr],zr[Wr]=null;for(;e===or;)or=At[--$t],At[$t]=null,jn=At[--$t],At[$t]=null,kn=At[--$t],At[$t]=null}var Et=null,Pt=null,Fe=!1,Gt=null;function ou(e,t){var s=Wt(5,null,null,0);s.elementType="DELETED",s.stateNode=t,s.return=e,t=e.deletions,t===null?(e.deletions=[s],e.flags|=16):t.push(s)}function lu(e,t){switch(e.tag){case 5:var s=e.type;return t=t.nodeType!==1||s.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Et=e,Pt=zn(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Et=e,Pt=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(s=or!==null?{id:kn,overflow:jn}:null,e.memoizedState={dehydrated:t,treeContext:s,retryLane:1073741824},s=Wt(18,null,null,0),s.stateNode=t,s.return=e,e.child=s,Et=e,Pt=null,!0):!1;default:return!1}}function Cl(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Nl(e){if(Fe){var t=Pt;if(t){var s=t;if(!lu(e,t)){if(Cl(e))throw Error(o(418));t=zn(s.nextSibling);var l=Et;t&&lu(e,t)?ou(l,s):(e.flags=e.flags&-4097|2,Fe=!1,Et=e)}}else{if(Cl(e))throw Error(o(418));e.flags=e.flags&-4097|2,Fe=!1,Et=e}}}function au(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Et=e}function Ri(e){if(e!==Et)return!1;if(!Fe)return au(e),Fe=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!gl(e.type,e.memoizedProps)),t&&(t=Pt)){if(Cl(e))throw cu(),Error(o(418));for(;t;)ou(e,t),t=zn(t.nextSibling)}if(au(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var s=e.data;if(s==="/$"){if(t===0){Pt=zn(e.nextSibling);break e}t--}else s!=="$"&&s!=="$!"&&s!=="$?"||t++}e=e.nextSibling}Pt=null}}else Pt=Et?zn(e.stateNode.nextSibling):null;return!0}function cu(){for(var e=Pt;e;)e=zn(e.nextSibling)}function Fr(){Pt=Et=null,Fe=!1}function bl(e){Gt===null?Gt=[e]:Gt.push(e)}var $h=J.ReactCurrentBatchConfig;function Ps(e,t,s){if(e=s.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(s._owner){if(s=s._owner,s){if(s.tag!==1)throw Error(o(309));var l=s.stateNode}if(!l)throw Error(o(147,e));var c=l,u=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===u?t.ref:(t=function(h){var y=c.refs;h===null?delete y[u]:y[u]=h},t._stringRef=u,t)}if(typeof e!="string")throw Error(o(284));if(!s._owner)throw Error(o(290,e))}return e}function Ti(e,t){throw e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function uu(e){var t=e._init;return t(e._payload)}function du(e){function t(_,j){if(e){var I=_.deletions;I===null?(_.deletions=[j],_.flags|=16):I.push(j)}}function s(_,j){if(!e)return null;for(;j!==null;)t(_,j),j=j.sibling;return null}function l(_,j){for(_=new Map;j!==null;)j.key!==null?_.set(j.key,j):_.set(j.index,j),j=j.sibling;return _}function c(_,j){return _=Yn(_,j),_.index=0,_.sibling=null,_}function u(_,j,I){return _.index=I,e?(I=_.alternate,I!==null?(I=I.index,I<j?(_.flags|=2,j):I):(_.flags|=2,j)):(_.flags|=1048576,j)}function h(_){return e&&_.alternate===null&&(_.flags|=2),_}function y(_,j,I,K){return j===null||j.tag!==6?(j=va(I,_.mode,K),j.return=_,j):(j=c(j,I),j.return=_,j)}function k(_,j,I,K){var he=I.type;return he===D?U(_,j,I.props.children,K,I.key):j!==null&&(j.elementType===he||typeof he=="object"&&he!==null&&he.$$typeof===me&&uu(he)===j.type)?(K=c(j,I.props),K.ref=Ps(_,j,I),K.return=_,K):(K=no(I.type,I.key,I.props,null,_.mode,K),K.ref=Ps(_,j,I),K.return=_,K)}function T(_,j,I,K){return j===null||j.tag!==4||j.stateNode.containerInfo!==I.containerInfo||j.stateNode.implementation!==I.implementation?(j=ya(I,_.mode,K),j.return=_,j):(j=c(j,I.children||[]),j.return=_,j)}function U(_,j,I,K,he){return j===null||j.tag!==7?(j=mr(I,_.mode,K,he),j.return=_,j):(j=c(j,I),j.return=_,j)}function H(_,j,I){if(typeof j=="string"&&j!==""||typeof j=="number")return j=va(""+j,_.mode,I),j.return=_,j;if(typeof j=="object"&&j!==null){switch(j.$$typeof){case ne:return I=no(j.type,j.key,j.props,null,_.mode,I),I.ref=Ps(_,null,j),I.return=_,I;case N:return j=ya(j,_.mode,I),j.return=_,j;case me:var K=j._init;return H(_,K(j._payload),I)}if(nn(j)||se(j))return j=mr(j,_.mode,I,null),j.return=_,j;Ti(_,j)}return null}function q(_,j,I,K){var he=j!==null?j.key:null;if(typeof I=="string"&&I!==""||typeof I=="number")return he!==null?null:y(_,j,""+I,K);if(typeof I=="object"&&I!==null){switch(I.$$typeof){case ne:return I.key===he?k(_,j,I,K):null;case N:return I.key===he?T(_,j,I,K):null;case me:return he=I._init,q(_,j,he(I._payload),K)}if(nn(I)||se(I))return he!==null?null:U(_,j,I,K,null);Ti(_,I)}return null}function re(_,j,I,K,he){if(typeof K=="string"&&K!==""||typeof K=="number")return _=_.get(I)||null,y(j,_,""+K,he);if(typeof K=="object"&&K!==null){switch(K.$$typeof){case ne:return _=_.get(K.key===null?I:K.key)||null,k(j,_,K,he);case N:return _=_.get(K.key===null?I:K.key)||null,T(j,_,K,he);case me:var we=K._init;return re(_,j,I,we(K._payload),he)}if(nn(K)||se(K))return _=_.get(I)||null,U(j,_,K,he,null);Ti(j,K)}return null}function ce(_,j,I,K){for(var he=null,we=null,ke=j,Ne=j=0,nt=null;ke!==null&&Ne<I.length;Ne++){ke.index>Ne?(nt=ke,ke=null):nt=ke.sibling;var Te=q(_,ke,I[Ne],K);if(Te===null){ke===null&&(ke=nt);break}e&&ke&&Te.alternate===null&&t(_,ke),j=u(Te,j,Ne),we===null?he=Te:we.sibling=Te,we=Te,ke=nt}if(Ne===I.length)return s(_,ke),Fe&&lr(_,Ne),he;if(ke===null){for(;Ne<I.length;Ne++)ke=H(_,I[Ne],K),ke!==null&&(j=u(ke,j,Ne),we===null?he=ke:we.sibling=ke,we=ke);return Fe&&lr(_,Ne),he}for(ke=l(_,ke);Ne<I.length;Ne++)nt=re(ke,_,Ne,I[Ne],K),nt!==null&&(e&&nt.alternate!==null&&ke.delete(nt.key===null?Ne:nt.key),j=u(nt,j,Ne),we===null?he=nt:we.sibling=nt,we=nt);return e&&ke.forEach(function(Xn){return t(_,Xn)}),Fe&&lr(_,Ne),he}function fe(_,j,I,K){var he=se(I);if(typeof he!="function")throw Error(o(150));if(I=he.call(I),I==null)throw Error(o(151));for(var we=he=null,ke=j,Ne=j=0,nt=null,Te=I.next();ke!==null&&!Te.done;Ne++,Te=I.next()){ke.index>Ne?(nt=ke,ke=null):nt=ke.sibling;var Xn=q(_,ke,Te.value,K);if(Xn===null){ke===null&&(ke=nt);break}e&&ke&&Xn.alternate===null&&t(_,ke),j=u(Xn,j,Ne),we===null?he=Xn:we.sibling=Xn,we=Xn,ke=nt}if(Te.done)return s(_,ke),Fe&&lr(_,Ne),he;if(ke===null){for(;!Te.done;Ne++,Te=I.next())Te=H(_,Te.value,K),Te!==null&&(j=u(Te,j,Ne),we===null?he=Te:we.sibling=Te,we=Te);return Fe&&lr(_,Ne),he}for(ke=l(_,ke);!Te.done;Ne++,Te=I.next())Te=re(ke,_,Ne,Te.value,K),Te!==null&&(e&&Te.alternate!==null&&ke.delete(Te.key===null?Ne:Te.key),j=u(Te,j,Ne),we===null?he=Te:we.sibling=Te,we=Te);return e&&ke.forEach(function(mm){return t(_,mm)}),Fe&&lr(_,Ne),he}function Ge(_,j,I,K){if(typeof I=="object"&&I!==null&&I.type===D&&I.key===null&&(I=I.props.children),typeof I=="object"&&I!==null){switch(I.$$typeof){case ne:e:{for(var he=I.key,we=j;we!==null;){if(we.key===he){if(he=I.type,he===D){if(we.tag===7){s(_,we.sibling),j=c(we,I.props.children),j.return=_,_=j;break e}}else if(we.elementType===he||typeof he=="object"&&he!==null&&he.$$typeof===me&&uu(he)===we.type){s(_,we.sibling),j=c(we,I.props),j.ref=Ps(_,we,I),j.return=_,_=j;break e}s(_,we);break}else t(_,we);we=we.sibling}I.type===D?(j=mr(I.props.children,_.mode,K,I.key),j.return=_,_=j):(K=no(I.type,I.key,I.props,null,_.mode,K),K.ref=Ps(_,j,I),K.return=_,_=K)}return h(_);case N:e:{for(we=I.key;j!==null;){if(j.key===we)if(j.tag===4&&j.stateNode.containerInfo===I.containerInfo&&j.stateNode.implementation===I.implementation){s(_,j.sibling),j=c(j,I.children||[]),j.return=_,_=j;break e}else{s(_,j);break}else t(_,j);j=j.sibling}j=ya(I,_.mode,K),j.return=_,_=j}return h(_);case me:return we=I._init,Ge(_,j,we(I._payload),K)}if(nn(I))return ce(_,j,I,K);if(se(I))return fe(_,j,I,K);Ti(_,I)}return typeof I=="string"&&I!==""||typeof I=="number"?(I=""+I,j!==null&&j.tag===6?(s(_,j.sibling),j=c(j,I),j.return=_,_=j):(s(_,j),j=va(I,_.mode,K),j.return=_,_=j),h(_)):s(_,j)}return Ge}var Br=du(!0),fu=du(!1),Mi=Wn(null),Oi=null,qr=null,_l=null;function Il(){_l=qr=Oi=null}function El(e){var t=Mi.current;De(Mi),e._currentValue=t}function Pl(e,t,s){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===s)break;e=e.return}}function Ur(e,t){Oi=e,_l=qr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(yt=!0),e.firstContext=null)}function Lt(e){var t=e._currentValue;if(_l!==e)if(e={context:e,memoizedValue:t,next:null},qr===null){if(Oi===null)throw Error(o(308));qr=e,Oi.dependencies={lanes:0,firstContext:e}}else qr=qr.next=e;return t}var ar=null;function Rl(e){ar===null?ar=[e]:ar.push(e)}function pu(e,t,s,l){var c=t.interleaved;return c===null?(s.next=s,Rl(t)):(s.next=c.next,c.next=s),t.interleaved=s,Sn(e,l)}function Sn(e,t){e.lanes|=t;var s=e.alternate;for(s!==null&&(s.lanes|=t),s=e,e=e.return;e!==null;)e.childLanes|=t,s=e.alternate,s!==null&&(s.childLanes|=t),s=e,e=e.return;return s.tag===3?s.stateNode:null}var qn=!1;function Tl(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function hu(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Cn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Un(e,t,s){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Re&2)!==0){var c=l.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),l.pending=t,Sn(e,s)}return c=l.interleaved,c===null?(t.next=t,Rl(l)):(t.next=c.next,c.next=t),l.interleaved=t,Sn(e,s)}function Ai(e,t,s){if(t=t.updateQueue,t!==null&&(t=t.shared,(s&4194240)!==0)){var l=t.lanes;l&=e.pendingLanes,s|=l,t.lanes=s,Vo(e,s)}}function mu(e,t){var s=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,s===l)){var c=null,u=null;if(s=s.firstBaseUpdate,s!==null){do{var h={eventTime:s.eventTime,lane:s.lane,tag:s.tag,payload:s.payload,callback:s.callback,next:null};u===null?c=u=h:u=u.next=h,s=s.next}while(s!==null);u===null?c=u=t:u=u.next=t}else c=u=t;s={baseState:l.baseState,firstBaseUpdate:c,lastBaseUpdate:u,shared:l.shared,effects:l.effects},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=t:e.next=t,s.lastBaseUpdate=t}function $i(e,t,s,l){var c=e.updateQueue;qn=!1;var u=c.firstBaseUpdate,h=c.lastBaseUpdate,y=c.shared.pending;if(y!==null){c.shared.pending=null;var k=y,T=k.next;k.next=null,h===null?u=T:h.next=T,h=k;var U=e.alternate;U!==null&&(U=U.updateQueue,y=U.lastBaseUpdate,y!==h&&(y===null?U.firstBaseUpdate=T:y.next=T,U.lastBaseUpdate=k))}if(u!==null){var H=c.baseState;h=0,U=T=k=null,y=u;do{var q=y.lane,re=y.eventTime;if((l&q)===q){U!==null&&(U=U.next={eventTime:re,lane:0,tag:y.tag,payload:y.payload,callback:y.callback,next:null});e:{var ce=e,fe=y;switch(q=t,re=s,fe.tag){case 1:if(ce=fe.payload,typeof ce=="function"){H=ce.call(re,H,q);break e}H=ce;break e;case 3:ce.flags=ce.flags&-65537|128;case 0:if(ce=fe.payload,q=typeof ce=="function"?ce.call(re,H,q):ce,q==null)break e;H=B({},H,q);break e;case 2:qn=!0}}y.callback!==null&&y.lane!==0&&(e.flags|=64,q=c.effects,q===null?c.effects=[y]:q.push(y))}else re={eventTime:re,lane:q,tag:y.tag,payload:y.payload,callback:y.callback,next:null},U===null?(T=U=re,k=H):U=U.next=re,h|=q;if(y=y.next,y===null){if(y=c.shared.pending,y===null)break;q=y,y=q.next,q.next=null,c.lastBaseUpdate=q,c.shared.pending=null}}while(!0);if(U===null&&(k=H),c.baseState=k,c.firstBaseUpdate=T,c.lastBaseUpdate=U,t=c.shared.interleaved,t!==null){c=t;do h|=c.lane,c=c.next;while(c!==t)}else u===null&&(c.shared.lanes=0);dr|=h,e.lanes=h,e.memoizedState=H}}function gu(e,t,s){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var l=e[t],c=l.callback;if(c!==null){if(l.callback=null,l=s,typeof c!="function")throw Error(o(191,c));c.call(l)}}}var Rs={},an=Wn(Rs),Ts=Wn(Rs),Ms=Wn(Rs);function cr(e){if(e===Rs)throw Error(o(174));return e}function Ml(e,t){switch($e(Ms,t),$e(Ts,e),$e(an,Rs),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:hn(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=hn(t,e)}De(an),$e(an,t)}function Hr(){De(an),De(Ts),De(Ms)}function vu(e){cr(Ms.current);var t=cr(an.current),s=hn(t,e.type);t!==s&&($e(Ts,e),$e(an,s))}function Ol(e){Ts.current===e&&(De(an),De(Ts))}var Be=Wn(0);function Li(e){for(var t=e;t!==null;){if(t.tag===13){var s=t.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||s.data==="$?"||s.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Al=[];function $l(){for(var e=0;e<Al.length;e++)Al[e]._workInProgressVersionPrimary=null;Al.length=0}var Di=J.ReactCurrentDispatcher,Ll=J.ReactCurrentBatchConfig,ur=0,qe=null,Je=null,et=null,zi=!1,Os=!1,As=0,Lh=0;function at(){throw Error(o(321))}function Dl(e,t){if(t===null)return!1;for(var s=0;s<t.length&&s<e.length;s++)if(!Kt(e[s],t[s]))return!1;return!0}function zl(e,t,s,l,c,u){if(ur=u,qe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Di.current=e===null||e.memoizedState===null?Fh:Bh,e=s(l,c),Os){u=0;do{if(Os=!1,As=0,25<=u)throw Error(o(301));u+=1,et=Je=null,t.updateQueue=null,Di.current=qh,e=s(l,c)}while(Os)}if(Di.current=Bi,t=Je!==null&&Je.next!==null,ur=0,et=Je=qe=null,zi=!1,t)throw Error(o(300));return e}function Wl(){var e=As!==0;return As=0,e}function cn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return et===null?qe.memoizedState=et=e:et=et.next=e,et}function Dt(){if(Je===null){var e=qe.alternate;e=e!==null?e.memoizedState:null}else e=Je.next;var t=et===null?qe.memoizedState:et.next;if(t!==null)et=t,Je=e;else{if(e===null)throw Error(o(310));Je=e,e={memoizedState:Je.memoizedState,baseState:Je.baseState,baseQueue:Je.baseQueue,queue:Je.queue,next:null},et===null?qe.memoizedState=et=e:et=et.next=e}return et}function $s(e,t){return typeof t=="function"?t(e):t}function Fl(e){var t=Dt(),s=t.queue;if(s===null)throw Error(o(311));s.lastRenderedReducer=e;var l=Je,c=l.baseQueue,u=s.pending;if(u!==null){if(c!==null){var h=c.next;c.next=u.next,u.next=h}l.baseQueue=c=u,s.pending=null}if(c!==null){u=c.next,l=l.baseState;var y=h=null,k=null,T=u;do{var U=T.lane;if((ur&U)===U)k!==null&&(k=k.next={lane:0,action:T.action,hasEagerState:T.hasEagerState,eagerState:T.eagerState,next:null}),l=T.hasEagerState?T.eagerState:e(l,T.action);else{var H={lane:U,action:T.action,hasEagerState:T.hasEagerState,eagerState:T.eagerState,next:null};k===null?(y=k=H,h=l):k=k.next=H,qe.lanes|=U,dr|=U}T=T.next}while(T!==null&&T!==u);k===null?h=l:k.next=y,Kt(l,t.memoizedState)||(yt=!0),t.memoizedState=l,t.baseState=h,t.baseQueue=k,s.lastRenderedState=l}if(e=s.interleaved,e!==null){c=e;do u=c.lane,qe.lanes|=u,dr|=u,c=c.next;while(c!==e)}else c===null&&(s.lanes=0);return[t.memoizedState,s.dispatch]}function Bl(e){var t=Dt(),s=t.queue;if(s===null)throw Error(o(311));s.lastRenderedReducer=e;var l=s.dispatch,c=s.pending,u=t.memoizedState;if(c!==null){s.pending=null;var h=c=c.next;do u=e(u,h.action),h=h.next;while(h!==c);Kt(u,t.memoizedState)||(yt=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),s.lastRenderedState=u}return[u,l]}function yu(){}function xu(e,t){var s=qe,l=Dt(),c=t(),u=!Kt(l.memoizedState,c);if(u&&(l.memoizedState=c,yt=!0),l=l.queue,ql(ju.bind(null,s,l,e),[e]),l.getSnapshot!==t||u||et!==null&&et.memoizedState.tag&1){if(s.flags|=2048,Ls(9,ku.bind(null,s,l,c,t),void 0,null),tt===null)throw Error(o(349));(ur&30)!==0||wu(s,t,c)}return c}function wu(e,t,s){e.flags|=16384,e={getSnapshot:t,value:s},t=qe.updateQueue,t===null?(t={lastEffect:null,stores:null},qe.updateQueue=t,t.stores=[e]):(s=t.stores,s===null?t.stores=[e]:s.push(e))}function ku(e,t,s,l){t.value=s,t.getSnapshot=l,Su(t)&&Cu(e)}function ju(e,t,s){return s(function(){Su(t)&&Cu(e)})}function Su(e){var t=e.getSnapshot;e=e.value;try{var s=t();return!Kt(e,s)}catch{return!0}}function Cu(e){var t=Sn(e,1);t!==null&&Jt(t,e,1,-1)}function Nu(e){var t=cn();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:$s,lastRenderedState:e},t.queue=e,e=e.dispatch=Wh.bind(null,qe,e),[t.memoizedState,e]}function Ls(e,t,s,l){return e={tag:e,create:t,destroy:s,deps:l,next:null},t=qe.updateQueue,t===null?(t={lastEffect:null,stores:null},qe.updateQueue=t,t.lastEffect=e.next=e):(s=t.lastEffect,s===null?t.lastEffect=e.next=e:(l=s.next,s.next=e,e.next=l,t.lastEffect=e)),e}function bu(){return Dt().memoizedState}function Wi(e,t,s,l){var c=cn();qe.flags|=e,c.memoizedState=Ls(1|t,s,void 0,l===void 0?null:l)}function Fi(e,t,s,l){var c=Dt();l=l===void 0?null:l;var u=void 0;if(Je!==null){var h=Je.memoizedState;if(u=h.destroy,l!==null&&Dl(l,h.deps)){c.memoizedState=Ls(t,s,u,l);return}}qe.flags|=e,c.memoizedState=Ls(1|t,s,u,l)}function _u(e,t){return Wi(8390656,8,e,t)}function ql(e,t){return Fi(2048,8,e,t)}function Iu(e,t){return Fi(4,2,e,t)}function Eu(e,t){return Fi(4,4,e,t)}function Pu(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Ru(e,t,s){return s=s!=null?s.concat([e]):null,Fi(4,4,Pu.bind(null,t,e),s)}function Ul(){}function Tu(e,t){var s=Dt();t=t===void 0?null:t;var l=s.memoizedState;return l!==null&&t!==null&&Dl(t,l[1])?l[0]:(s.memoizedState=[e,t],e)}function Mu(e,t){var s=Dt();t=t===void 0?null:t;var l=s.memoizedState;return l!==null&&t!==null&&Dl(t,l[1])?l[0]:(e=e(),s.memoizedState=[e,t],e)}function Ou(e,t,s){return(ur&21)===0?(e.baseState&&(e.baseState=!1,yt=!0),e.memoizedState=s):(Kt(s,t)||(s=uc(),qe.lanes|=s,dr|=s,e.baseState=!0),t)}function Dh(e,t){var s=Ae;Ae=s!==0&&4>s?s:4,e(!0);var l=Ll.transition;Ll.transition={};try{e(!1),t()}finally{Ae=s,Ll.transition=l}}function Au(){return Dt().memoizedState}function zh(e,t,s){var l=Gn(e);if(s={lane:l,action:s,hasEagerState:!1,eagerState:null,next:null},$u(e))Lu(t,s);else if(s=pu(e,t,s,l),s!==null){var c=pt();Jt(s,e,l,c),Du(s,t,l)}}function Wh(e,t,s){var l=Gn(e),c={lane:l,action:s,hasEagerState:!1,eagerState:null,next:null};if($u(e))Lu(t,c);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var h=t.lastRenderedState,y=u(h,s);if(c.hasEagerState=!0,c.eagerState=y,Kt(y,h)){var k=t.interleaved;k===null?(c.next=c,Rl(t)):(c.next=k.next,k.next=c),t.interleaved=c;return}}catch{}s=pu(e,t,c,l),s!==null&&(c=pt(),Jt(s,e,l,c),Du(s,t,l))}}function $u(e){var t=e.alternate;return e===qe||t!==null&&t===qe}function Lu(e,t){Os=zi=!0;var s=e.pending;s===null?t.next=t:(t.next=s.next,s.next=t),e.pending=t}function Du(e,t,s){if((s&4194240)!==0){var l=t.lanes;l&=e.pendingLanes,s|=l,t.lanes=s,Vo(e,s)}}var Bi={readContext:Lt,useCallback:at,useContext:at,useEffect:at,useImperativeHandle:at,useInsertionEffect:at,useLayoutEffect:at,useMemo:at,useReducer:at,useRef:at,useState:at,useDebugValue:at,useDeferredValue:at,useTransition:at,useMutableSource:at,useSyncExternalStore:at,useId:at,unstable_isNewReconciler:!1},Fh={readContext:Lt,useCallback:function(e,t){return cn().memoizedState=[e,t===void 0?null:t],e},useContext:Lt,useEffect:_u,useImperativeHandle:function(e,t,s){return s=s!=null?s.concat([e]):null,Wi(4194308,4,Pu.bind(null,t,e),s)},useLayoutEffect:function(e,t){return Wi(4194308,4,e,t)},useInsertionEffect:function(e,t){return Wi(4,2,e,t)},useMemo:function(e,t){var s=cn();return t=t===void 0?null:t,e=e(),s.memoizedState=[e,t],e},useReducer:function(e,t,s){var l=cn();return t=s!==void 0?s(t):t,l.memoizedState=l.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},l.queue=e,e=e.dispatch=zh.bind(null,qe,e),[l.memoizedState,e]},useRef:function(e){var t=cn();return e={current:e},t.memoizedState=e},useState:Nu,useDebugValue:Ul,useDeferredValue:function(e){return cn().memoizedState=e},useTransition:function(){var e=Nu(!1),t=e[0];return e=Dh.bind(null,e[1]),cn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,s){var l=qe,c=cn();if(Fe){if(s===void 0)throw Error(o(407));s=s()}else{if(s=t(),tt===null)throw Error(o(349));(ur&30)!==0||wu(l,t,s)}c.memoizedState=s;var u={value:s,getSnapshot:t};return c.queue=u,_u(ju.bind(null,l,u,e),[e]),l.flags|=2048,Ls(9,ku.bind(null,l,u,s,t),void 0,null),s},useId:function(){var e=cn(),t=tt.identifierPrefix;if(Fe){var s=jn,l=kn;s=(l&~(1<<32-Vt(l)-1)).toString(32)+s,t=":"+t+"R"+s,s=As++,0<s&&(t+="H"+s.toString(32)),t+=":"}else s=Lh++,t=":"+t+"r"+s.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Bh={readContext:Lt,useCallback:Tu,useContext:Lt,useEffect:ql,useImperativeHandle:Ru,useInsertionEffect:Iu,useLayoutEffect:Eu,useMemo:Mu,useReducer:Fl,useRef:bu,useState:function(){return Fl($s)},useDebugValue:Ul,useDeferredValue:function(e){var t=Dt();return Ou(t,Je.memoizedState,e)},useTransition:function(){var e=Fl($s)[0],t=Dt().memoizedState;return[e,t]},useMutableSource:yu,useSyncExternalStore:xu,useId:Au,unstable_isNewReconciler:!1},qh={readContext:Lt,useCallback:Tu,useContext:Lt,useEffect:ql,useImperativeHandle:Ru,useInsertionEffect:Iu,useLayoutEffect:Eu,useMemo:Mu,useReducer:Bl,useRef:bu,useState:function(){return Bl($s)},useDebugValue:Ul,useDeferredValue:function(e){var t=Dt();return Je===null?t.memoizedState=e:Ou(t,Je.memoizedState,e)},useTransition:function(){var e=Bl($s)[0],t=Dt().memoizedState;return[e,t]},useMutableSource:yu,useSyncExternalStore:xu,useId:Au,unstable_isNewReconciler:!1};function Qt(e,t){if(e&&e.defaultProps){t=B({},t),e=e.defaultProps;for(var s in e)t[s]===void 0&&(t[s]=e[s]);return t}return t}function Hl(e,t,s,l){t=e.memoizedState,s=s(l,t),s=s==null?t:B({},t,s),e.memoizedState=s,e.lanes===0&&(e.updateQueue.baseState=s)}var qi={isMounted:function(e){return(e=e._reactInternals)?sn(e)===e:!1},enqueueSetState:function(e,t,s){e=e._reactInternals;var l=pt(),c=Gn(e),u=Cn(l,c);u.payload=t,s!=null&&(u.callback=s),t=Un(e,u,c),t!==null&&(Jt(t,e,c,l),Ai(t,e,c))},enqueueReplaceState:function(e,t,s){e=e._reactInternals;var l=pt(),c=Gn(e),u=Cn(l,c);u.tag=1,u.payload=t,s!=null&&(u.callback=s),t=Un(e,u,c),t!==null&&(Jt(t,e,c,l),Ai(t,e,c))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var s=pt(),l=Gn(e),c=Cn(s,l);c.tag=2,t!=null&&(c.callback=t),t=Un(e,c,l),t!==null&&(Jt(t,e,l,s),Ai(t,e,l))}};function zu(e,t,s,l,c,u,h){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,u,h):t.prototype&&t.prototype.isPureReactComponent?!Ss(s,l)||!Ss(c,u):!0}function Wu(e,t,s){var l=!1,c=Fn,u=t.contextType;return typeof u=="object"&&u!==null?u=Lt(u):(c=vt(t)?ir:lt.current,l=t.contextTypes,u=(l=l!=null)?Dr(e,c):Fn),t=new t(s,u),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=qi,e.stateNode=t,t._reactInternals=e,l&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=c,e.__reactInternalMemoizedMaskedChildContext=u),t}function Fu(e,t,s,l){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(s,l),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(s,l),t.state!==e&&qi.enqueueReplaceState(t,t.state,null)}function Vl(e,t,s,l){var c=e.stateNode;c.props=s,c.state=e.memoizedState,c.refs={},Tl(e);var u=t.contextType;typeof u=="object"&&u!==null?c.context=Lt(u):(u=vt(t)?ir:lt.current,c.context=Dr(e,u)),c.state=e.memoizedState,u=t.getDerivedStateFromProps,typeof u=="function"&&(Hl(e,t,u,s),c.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof c.getSnapshotBeforeUpdate=="function"||typeof c.UNSAFE_componentWillMount!="function"&&typeof c.componentWillMount!="function"||(t=c.state,typeof c.componentWillMount=="function"&&c.componentWillMount(),typeof c.UNSAFE_componentWillMount=="function"&&c.UNSAFE_componentWillMount(),t!==c.state&&qi.enqueueReplaceState(c,c.state,null),$i(e,s,c,l),c.state=e.memoizedState),typeof c.componentDidMount=="function"&&(e.flags|=4194308)}function Vr(e,t){try{var s="",l=t;do s+=oe(l),l=l.return;while(l);var c=s}catch(u){c=`
8
+ Error generating stack: `+u.message+`
9
+ `+u.stack}return{value:e,source:t,stack:c,digest:null}}function Kl(e,t,s){return{value:e,source:null,stack:s??null,digest:t??null}}function Gl(e,t){try{console.error(t.value)}catch(s){setTimeout(function(){throw s})}}var Uh=typeof WeakMap=="function"?WeakMap:Map;function Bu(e,t,s){s=Cn(-1,s),s.tag=3,s.payload={element:null};var l=t.value;return s.callback=function(){Yi||(Yi=!0,ca=l),Gl(e,t)},s}function qu(e,t,s){s=Cn(-1,s),s.tag=3;var l=e.type.getDerivedStateFromError;if(typeof l=="function"){var c=t.value;s.payload=function(){return l(c)},s.callback=function(){Gl(e,t)}}var u=e.stateNode;return u!==null&&typeof u.componentDidCatch=="function"&&(s.callback=function(){Gl(e,t),typeof l!="function"&&(Vn===null?Vn=new Set([this]):Vn.add(this));var h=t.stack;this.componentDidCatch(t.value,{componentStack:h!==null?h:""})}),s}function Uu(e,t,s){var l=e.pingCache;if(l===null){l=e.pingCache=new Uh;var c=new Set;l.set(t,c)}else c=l.get(t),c===void 0&&(c=new Set,l.set(t,c));c.has(s)||(c.add(s),e=sm.bind(null,e,t,s),t.then(e,e))}function Hu(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Vu(e,t,s,l,c){return(e.mode&1)===0?(e===t?e.flags|=65536:(e.flags|=128,s.flags|=131072,s.flags&=-52805,s.tag===1&&(s.alternate===null?s.tag=17:(t=Cn(-1,1),t.tag=2,Un(s,t,1))),s.lanes|=1),e):(e.flags|=65536,e.lanes=c,e)}var Hh=J.ReactCurrentOwner,yt=!1;function ft(e,t,s,l){t.child=e===null?fu(t,null,s,l):Br(t,e.child,s,l)}function Ku(e,t,s,l,c){s=s.render;var u=t.ref;return Ur(t,c),l=zl(e,t,s,l,u,c),s=Wl(),e!==null&&!yt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~c,Nn(e,t,c)):(Fe&&s&&jl(t),t.flags|=1,ft(e,t,l,c),t.child)}function Gu(e,t,s,l,c){if(e===null){var u=s.type;return typeof u=="function"&&!ga(u)&&u.defaultProps===void 0&&s.compare===null&&s.defaultProps===void 0?(t.tag=15,t.type=u,Qu(e,t,u,l,c)):(e=no(s.type,null,l,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,(e.lanes&c)===0){var h=u.memoizedProps;if(s=s.compare,s=s!==null?s:Ss,s(h,l)&&e.ref===t.ref)return Nn(e,t,c)}return t.flags|=1,e=Yn(u,l),e.ref=t.ref,e.return=t,t.child=e}function Qu(e,t,s,l,c){if(e!==null){var u=e.memoizedProps;if(Ss(u,l)&&e.ref===t.ref)if(yt=!1,t.pendingProps=l=u,(e.lanes&c)!==0)(e.flags&131072)!==0&&(yt=!0);else return t.lanes=e.lanes,Nn(e,t,c)}return Ql(e,t,s,l,c)}function Yu(e,t,s){var l=t.pendingProps,c=l.children,u=e!==null?e.memoizedState:null;if(l.mode==="hidden")if((t.mode&1)===0)t.memoizedState={baseLanes:0,cachePool:null,transitions:null},$e(Gr,Rt),Rt|=s;else{if((s&1073741824)===0)return e=u!==null?u.baseLanes|s:s,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,$e(Gr,Rt),Rt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},l=u!==null?u.baseLanes:s,$e(Gr,Rt),Rt|=l}else u!==null?(l=u.baseLanes|s,t.memoizedState=null):l=s,$e(Gr,Rt),Rt|=l;return ft(e,t,c,s),t.child}function Xu(e,t){var s=t.ref;(e===null&&s!==null||e!==null&&e.ref!==s)&&(t.flags|=512,t.flags|=2097152)}function Ql(e,t,s,l,c){var u=vt(s)?ir:lt.current;return u=Dr(t,u),Ur(t,c),s=zl(e,t,s,l,u,c),l=Wl(),e!==null&&!yt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~c,Nn(e,t,c)):(Fe&&l&&jl(t),t.flags|=1,ft(e,t,s,c),t.child)}function Ju(e,t,s,l,c){if(vt(s)){var u=!0;_i(t)}else u=!1;if(Ur(t,c),t.stateNode===null)Hi(e,t),Wu(t,s,l),Vl(t,s,l,c),l=!0;else if(e===null){var h=t.stateNode,y=t.memoizedProps;h.props=y;var k=h.context,T=s.contextType;typeof T=="object"&&T!==null?T=Lt(T):(T=vt(s)?ir:lt.current,T=Dr(t,T));var U=s.getDerivedStateFromProps,H=typeof U=="function"||typeof h.getSnapshotBeforeUpdate=="function";H||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(y!==l||k!==T)&&Fu(t,h,l,T),qn=!1;var q=t.memoizedState;h.state=q,$i(t,l,h,c),k=t.memoizedState,y!==l||q!==k||gt.current||qn?(typeof U=="function"&&(Hl(t,s,U,l),k=t.memoizedState),(y=qn||zu(t,s,y,l,q,k,T))?(H||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"&&(t.flags|=4194308)):(typeof h.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=k),h.props=l,h.state=k,h.context=T,l=y):(typeof h.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{h=t.stateNode,hu(e,t),y=t.memoizedProps,T=t.type===t.elementType?y:Qt(t.type,y),h.props=T,H=t.pendingProps,q=h.context,k=s.contextType,typeof k=="object"&&k!==null?k=Lt(k):(k=vt(s)?ir:lt.current,k=Dr(t,k));var re=s.getDerivedStateFromProps;(U=typeof re=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(y!==H||q!==k)&&Fu(t,h,l,k),qn=!1,q=t.memoizedState,h.state=q,$i(t,l,h,c);var ce=t.memoizedState;y!==H||q!==ce||gt.current||qn?(typeof re=="function"&&(Hl(t,s,re,l),ce=t.memoizedState),(T=qn||zu(t,s,T,l,q,ce,k)||!1)?(U||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(l,ce,k),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(l,ce,k)),typeof h.componentDidUpdate=="function"&&(t.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof h.componentDidUpdate!="function"||y===e.memoizedProps&&q===e.memoizedState||(t.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&q===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=ce),h.props=l,h.state=ce,h.context=k,l=T):(typeof h.componentDidUpdate!="function"||y===e.memoizedProps&&q===e.memoizedState||(t.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&q===e.memoizedState||(t.flags|=1024),l=!1)}return Yl(e,t,s,l,u,c)}function Yl(e,t,s,l,c,u){Xu(e,t);var h=(t.flags&128)!==0;if(!l&&!h)return c&&ru(t,s,!1),Nn(e,t,u);l=t.stateNode,Hh.current=t;var y=h&&typeof s.getDerivedStateFromError!="function"?null:l.render();return t.flags|=1,e!==null&&h?(t.child=Br(t,e.child,null,u),t.child=Br(t,null,y,u)):ft(e,t,y,u),t.memoizedState=l.state,c&&ru(t,s,!0),t.child}function Zu(e){var t=e.stateNode;t.pendingContext?tu(e,t.pendingContext,t.pendingContext!==t.context):t.context&&tu(e,t.context,!1),Ml(e,t.containerInfo)}function ed(e,t,s,l,c){return Fr(),bl(c),t.flags|=256,ft(e,t,s,l),t.child}var Xl={dehydrated:null,treeContext:null,retryLane:0};function Jl(e){return{baseLanes:e,cachePool:null,transitions:null}}function td(e,t,s){var l=t.pendingProps,c=Be.current,u=!1,h=(t.flags&128)!==0,y;if((y=h)||(y=e!==null&&e.memoizedState===null?!1:(c&2)!==0),y?(u=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(c|=1),$e(Be,c&1),e===null)return Nl(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?((t.mode&1)===0?t.lanes=1:e.data==="$!"?t.lanes=8:t.lanes=1073741824,null):(h=l.children,e=l.fallback,u?(l=t.mode,u=t.child,h={mode:"hidden",children:h},(l&1)===0&&u!==null?(u.childLanes=0,u.pendingProps=h):u=ro(h,l,0,null),e=mr(e,l,s,null),u.return=t,e.return=t,u.sibling=e,t.child=u,t.child.memoizedState=Jl(s),t.memoizedState=Xl,e):Zl(t,h));if(c=e.memoizedState,c!==null&&(y=c.dehydrated,y!==null))return Vh(e,t,h,l,y,c,s);if(u){u=l.fallback,h=t.mode,c=e.child,y=c.sibling;var k={mode:"hidden",children:l.children};return(h&1)===0&&t.child!==c?(l=t.child,l.childLanes=0,l.pendingProps=k,t.deletions=null):(l=Yn(c,k),l.subtreeFlags=c.subtreeFlags&14680064),y!==null?u=Yn(y,u):(u=mr(u,h,s,null),u.flags|=2),u.return=t,l.return=t,l.sibling=u,t.child=l,l=u,u=t.child,h=e.child.memoizedState,h=h===null?Jl(s):{baseLanes:h.baseLanes|s,cachePool:null,transitions:h.transitions},u.memoizedState=h,u.childLanes=e.childLanes&~s,t.memoizedState=Xl,l}return u=e.child,e=u.sibling,l=Yn(u,{mode:"visible",children:l.children}),(t.mode&1)===0&&(l.lanes=s),l.return=t,l.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=l,t.memoizedState=null,l}function Zl(e,t){return t=ro({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Ui(e,t,s,l){return l!==null&&bl(l),Br(t,e.child,null,s),e=Zl(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Vh(e,t,s,l,c,u,h){if(s)return t.flags&256?(t.flags&=-257,l=Kl(Error(o(422))),Ui(e,t,h,l)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(u=l.fallback,c=t.mode,l=ro({mode:"visible",children:l.children},c,0,null),u=mr(u,c,h,null),u.flags|=2,l.return=t,u.return=t,l.sibling=u,t.child=l,(t.mode&1)!==0&&Br(t,e.child,null,h),t.child.memoizedState=Jl(h),t.memoizedState=Xl,u);if((t.mode&1)===0)return Ui(e,t,h,null);if(c.data==="$!"){if(l=c.nextSibling&&c.nextSibling.dataset,l)var y=l.dgst;return l=y,u=Error(o(419)),l=Kl(u,l,void 0),Ui(e,t,h,l)}if(y=(h&e.childLanes)!==0,yt||y){if(l=tt,l!==null){switch(h&-h){case 4:c=2;break;case 16:c=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:c=32;break;case 536870912:c=268435456;break;default:c=0}c=(c&(l.suspendedLanes|h))!==0?0:c,c!==0&&c!==u.retryLane&&(u.retryLane=c,Sn(e,c),Jt(l,e,c,-1))}return ma(),l=Kl(Error(o(421))),Ui(e,t,h,l)}return c.data==="$?"?(t.flags|=128,t.child=e.child,t=im.bind(null,e),c._reactRetry=t,null):(e=u.treeContext,Pt=zn(c.nextSibling),Et=t,Fe=!0,Gt=null,e!==null&&(At[$t++]=kn,At[$t++]=jn,At[$t++]=or,kn=e.id,jn=e.overflow,or=t),t=Zl(t,l.children),t.flags|=4096,t)}function nd(e,t,s){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),Pl(e.return,t,s)}function ea(e,t,s,l,c){var u=e.memoizedState;u===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:s,tailMode:c}:(u.isBackwards=t,u.rendering=null,u.renderingStartTime=0,u.last=l,u.tail=s,u.tailMode=c)}function rd(e,t,s){var l=t.pendingProps,c=l.revealOrder,u=l.tail;if(ft(e,t,l.children,s),l=Be.current,(l&2)!==0)l=l&1|2,t.flags|=128;else{if(e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&nd(e,s,t);else if(e.tag===19)nd(e,s,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}l&=1}if($e(Be,l),(t.mode&1)===0)t.memoizedState=null;else switch(c){case"forwards":for(s=t.child,c=null;s!==null;)e=s.alternate,e!==null&&Li(e)===null&&(c=s),s=s.sibling;s=c,s===null?(c=t.child,t.child=null):(c=s.sibling,s.sibling=null),ea(t,!1,c,s,u);break;case"backwards":for(s=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&Li(e)===null){t.child=c;break}e=c.sibling,c.sibling=s,s=c,c=e}ea(t,!0,s,null,u);break;case"together":ea(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Hi(e,t){(t.mode&1)===0&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Nn(e,t,s){if(e!==null&&(t.dependencies=e.dependencies),dr|=t.lanes,(s&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,s=Yn(e,e.pendingProps),t.child=s,s.return=t;e.sibling!==null;)e=e.sibling,s=s.sibling=Yn(e,e.pendingProps),s.return=t;s.sibling=null}return t.child}function Kh(e,t,s){switch(t.tag){case 3:Zu(t),Fr();break;case 5:vu(t);break;case 1:vt(t.type)&&_i(t);break;case 4:Ml(t,t.stateNode.containerInfo);break;case 10:var l=t.type._context,c=t.memoizedProps.value;$e(Mi,l._currentValue),l._currentValue=c;break;case 13:if(l=t.memoizedState,l!==null)return l.dehydrated!==null?($e(Be,Be.current&1),t.flags|=128,null):(s&t.child.childLanes)!==0?td(e,t,s):($e(Be,Be.current&1),e=Nn(e,t,s),e!==null?e.sibling:null);$e(Be,Be.current&1);break;case 19:if(l=(s&t.childLanes)!==0,(e.flags&128)!==0){if(l)return rd(e,t,s);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),$e(Be,Be.current),l)break;return null;case 22:case 23:return t.lanes=0,Yu(e,t,s)}return Nn(e,t,s)}var sd,ta,id,od;sd=function(e,t){for(var s=t.child;s!==null;){if(s.tag===5||s.tag===6)e.appendChild(s.stateNode);else if(s.tag!==4&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return;s=s.return}s.sibling.return=s.return,s=s.sibling}},ta=function(){},id=function(e,t,s,l){var c=e.memoizedProps;if(c!==l){e=t.stateNode,cr(an.current);var u=null;switch(s){case"input":c=_t(e,c),l=_t(e,l),u=[];break;case"select":c=B({},c,{value:void 0}),l=B({},l,{value:void 0}),u=[];break;case"textarea":c=Tn(e,c),l=Tn(e,l),u=[];break;default:typeof c.onClick!="function"&&typeof l.onClick=="function"&&(e.onclick=Ci)}Ht(s,l);var h;s=null;for(T in c)if(!l.hasOwnProperty(T)&&c.hasOwnProperty(T)&&c[T]!=null)if(T==="style"){var y=c[T];for(h in y)y.hasOwnProperty(h)&&(s||(s={}),s[h]="")}else T!=="dangerouslySetInnerHTML"&&T!=="children"&&T!=="suppressContentEditableWarning"&&T!=="suppressHydrationWarning"&&T!=="autoFocus"&&(d.hasOwnProperty(T)?u||(u=[]):(u=u||[]).push(T,null));for(T in l){var k=l[T];if(y=c?.[T],l.hasOwnProperty(T)&&k!==y&&(k!=null||y!=null))if(T==="style")if(y){for(h in y)!y.hasOwnProperty(h)||k&&k.hasOwnProperty(h)||(s||(s={}),s[h]="");for(h in k)k.hasOwnProperty(h)&&y[h]!==k[h]&&(s||(s={}),s[h]=k[h])}else s||(u||(u=[]),u.push(T,s)),s=k;else T==="dangerouslySetInnerHTML"?(k=k?k.__html:void 0,y=y?y.__html:void 0,k!=null&&y!==k&&(u=u||[]).push(T,k)):T==="children"?typeof k!="string"&&typeof k!="number"||(u=u||[]).push(T,""+k):T!=="suppressContentEditableWarning"&&T!=="suppressHydrationWarning"&&(d.hasOwnProperty(T)?(k!=null&&T==="onScroll"&&Le("scroll",e),u||y===k||(u=[])):(u=u||[]).push(T,k))}s&&(u=u||[]).push("style",s);var T=u;(t.updateQueue=T)&&(t.flags|=4)}},od=function(e,t,s,l){s!==l&&(t.flags|=4)};function Ds(e,t){if(!Fe)switch(e.tailMode){case"hidden":t=e.tail;for(var s=null;t!==null;)t.alternate!==null&&(s=t),t=t.sibling;s===null?e.tail=null:s.sibling=null;break;case"collapsed":s=e.tail;for(var l=null;s!==null;)s.alternate!==null&&(l=s),s=s.sibling;l===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function ct(e){var t=e.alternate!==null&&e.alternate.child===e.child,s=0,l=0;if(t)for(var c=e.child;c!==null;)s|=c.lanes|c.childLanes,l|=c.subtreeFlags&14680064,l|=c.flags&14680064,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)s|=c.lanes|c.childLanes,l|=c.subtreeFlags,l|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=l,e.childLanes=s,t}function Gh(e,t,s){var l=t.pendingProps;switch(Sl(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ct(t),null;case 1:return vt(t.type)&&bi(),ct(t),null;case 3:return l=t.stateNode,Hr(),De(gt),De(lt),$l(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(Ri(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Gt!==null&&(fa(Gt),Gt=null))),ta(e,t),ct(t),null;case 5:Ol(t);var c=cr(Ms.current);if(s=t.type,e!==null&&t.stateNode!=null)id(e,t,s,l,c),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!l){if(t.stateNode===null)throw Error(o(166));return ct(t),null}if(e=cr(an.current),Ri(t)){l=t.stateNode,s=t.type;var u=t.memoizedProps;switch(l[ln]=t,l[Is]=u,e=(t.mode&1)!==0,s){case"dialog":Le("cancel",l),Le("close",l);break;case"iframe":case"object":case"embed":Le("load",l);break;case"video":case"audio":for(c=0;c<Ns.length;c++)Le(Ns[c],l);break;case"source":Le("error",l);break;case"img":case"image":case"link":Le("error",l),Le("load",l);break;case"details":Le("toggle",l);break;case"input":rt(l,u),Le("invalid",l);break;case"select":l._wrapperState={wasMultiple:!!u.multiple},Le("invalid",l);break;case"textarea":dt(l,u),Le("invalid",l)}Ht(s,u),c=null;for(var h in u)if(u.hasOwnProperty(h)){var y=u[h];h==="children"?typeof y=="string"?l.textContent!==y&&(u.suppressHydrationWarning!==!0&&Si(l.textContent,y,e),c=["children",y]):typeof y=="number"&&l.textContent!==""+y&&(u.suppressHydrationWarning!==!0&&Si(l.textContent,y,e),c=["children",""+y]):d.hasOwnProperty(h)&&y!=null&&h==="onScroll"&&Le("scroll",l)}switch(s){case"input":bt(l),fn(l,u,!0);break;case"textarea":bt(l),nr(l);break;case"select":case"option":break;default:typeof u.onClick=="function"&&(l.onclick=Ci)}l=c,t.updateQueue=l,l!==null&&(t.flags|=4)}else{h=c.nodeType===9?c:c.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=rn(s)),e==="http://www.w3.org/1999/xhtml"?s==="script"?(e=h.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof l.is=="string"?e=h.createElement(s,{is:l.is}):(e=h.createElement(s),s==="select"&&(h=e,l.multiple?h.multiple=!0:l.size&&(h.size=l.size))):e=h.createElementNS(e,s),e[ln]=t,e[Is]=l,sd(e,t,!1,!1),t.stateNode=e;e:{switch(h=Cr(s,l),s){case"dialog":Le("cancel",e),Le("close",e),c=l;break;case"iframe":case"object":case"embed":Le("load",e),c=l;break;case"video":case"audio":for(c=0;c<Ns.length;c++)Le(Ns[c],e);c=l;break;case"source":Le("error",e),c=l;break;case"img":case"image":case"link":Le("error",e),Le("load",e),c=l;break;case"details":Le("toggle",e),c=l;break;case"input":rt(e,l),c=_t(e,l),Le("invalid",e);break;case"option":c=l;break;case"select":e._wrapperState={wasMultiple:!!l.multiple},c=B({},l,{value:void 0}),Le("invalid",e);break;case"textarea":dt(e,l),c=Tn(e,l),Le("invalid",e);break;default:c=l}Ht(s,c),y=c;for(u in y)if(y.hasOwnProperty(u)){var k=y[u];u==="style"?gn(e,k):u==="dangerouslySetInnerHTML"?(k=k?k.__html:void 0,k!=null&&Y(e,k)):u==="children"?typeof k=="string"?(s!=="textarea"||k!=="")&&xe(e,k):typeof k=="number"&&xe(e,""+k):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(d.hasOwnProperty(u)?k!=null&&u==="onScroll"&&Le("scroll",e):k!=null&&ye(e,u,k,h))}switch(s){case"input":bt(e),fn(e,l,!1);break;case"textarea":bt(e),nr(e);break;case"option":l.value!=null&&e.setAttribute("value",""+be(l.value));break;case"select":e.multiple=!!l.multiple,u=l.value,u!=null?Ut(e,!!l.multiple,u,!1):l.defaultValue!=null&&Ut(e,!!l.multiple,l.defaultValue,!0);break;default:typeof c.onClick=="function"&&(e.onclick=Ci)}switch(s){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}}l&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return ct(t),null;case 6:if(e&&t.stateNode!=null)od(e,t,e.memoizedProps,l);else{if(typeof l!="string"&&t.stateNode===null)throw Error(o(166));if(s=cr(Ms.current),cr(an.current),Ri(t)){if(l=t.stateNode,s=t.memoizedProps,l[ln]=t,(u=l.nodeValue!==s)&&(e=Et,e!==null))switch(e.tag){case 3:Si(l.nodeValue,s,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Si(l.nodeValue,s,(e.mode&1)!==0)}u&&(t.flags|=4)}else l=(s.nodeType===9?s:s.ownerDocument).createTextNode(l),l[ln]=t,t.stateNode=l}return ct(t),null;case 13:if(De(Be),l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Fe&&Pt!==null&&(t.mode&1)!==0&&(t.flags&128)===0)cu(),Fr(),t.flags|=98560,u=!1;else if(u=Ri(t),l!==null&&l.dehydrated!==null){if(e===null){if(!u)throw Error(o(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(o(317));u[ln]=t}else Fr(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;ct(t),u=!1}else Gt!==null&&(fa(Gt),Gt=null),u=!0;if(!u)return t.flags&65536?t:null}return(t.flags&128)!==0?(t.lanes=s,t):(l=l!==null,l!==(e!==null&&e.memoizedState!==null)&&l&&(t.child.flags|=8192,(t.mode&1)!==0&&(e===null||(Be.current&1)!==0?Ze===0&&(Ze=3):ma())),t.updateQueue!==null&&(t.flags|=4),ct(t),null);case 4:return Hr(),ta(e,t),e===null&&bs(t.stateNode.containerInfo),ct(t),null;case 10:return El(t.type._context),ct(t),null;case 17:return vt(t.type)&&bi(),ct(t),null;case 19:if(De(Be),u=t.memoizedState,u===null)return ct(t),null;if(l=(t.flags&128)!==0,h=u.rendering,h===null)if(l)Ds(u,!1);else{if(Ze!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(h=Li(e),h!==null){for(t.flags|=128,Ds(u,!1),l=h.updateQueue,l!==null&&(t.updateQueue=l,t.flags|=4),t.subtreeFlags=0,l=s,s=t.child;s!==null;)u=s,e=l,u.flags&=14680066,h=u.alternate,h===null?(u.childLanes=0,u.lanes=e,u.child=null,u.subtreeFlags=0,u.memoizedProps=null,u.memoizedState=null,u.updateQueue=null,u.dependencies=null,u.stateNode=null):(u.childLanes=h.childLanes,u.lanes=h.lanes,u.child=h.child,u.subtreeFlags=0,u.deletions=null,u.memoizedProps=h.memoizedProps,u.memoizedState=h.memoizedState,u.updateQueue=h.updateQueue,u.type=h.type,e=h.dependencies,u.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),s=s.sibling;return $e(Be,Be.current&1|2),t.child}e=e.sibling}u.tail!==null&&Ke()>Qr&&(t.flags|=128,l=!0,Ds(u,!1),t.lanes=4194304)}else{if(!l)if(e=Li(h),e!==null){if(t.flags|=128,l=!0,s=e.updateQueue,s!==null&&(t.updateQueue=s,t.flags|=4),Ds(u,!0),u.tail===null&&u.tailMode==="hidden"&&!h.alternate&&!Fe)return ct(t),null}else 2*Ke()-u.renderingStartTime>Qr&&s!==1073741824&&(t.flags|=128,l=!0,Ds(u,!1),t.lanes=4194304);u.isBackwards?(h.sibling=t.child,t.child=h):(s=u.last,s!==null?s.sibling=h:t.child=h,u.last=h)}return u.tail!==null?(t=u.tail,u.rendering=t,u.tail=t.sibling,u.renderingStartTime=Ke(),t.sibling=null,s=Be.current,$e(Be,l?s&1|2:s&1),t):(ct(t),null);case 22:case 23:return ha(),l=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==l&&(t.flags|=8192),l&&(t.mode&1)!==0?(Rt&1073741824)!==0&&(ct(t),t.subtreeFlags&6&&(t.flags|=8192)):ct(t),null;case 24:return null;case 25:return null}throw Error(o(156,t.tag))}function Qh(e,t){switch(Sl(t),t.tag){case 1:return vt(t.type)&&bi(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Hr(),De(gt),De(lt),$l(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return Ol(t),null;case 13:if(De(Be),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));Fr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return De(Be),null;case 4:return Hr(),null;case 10:return El(t.type._context),null;case 22:case 23:return ha(),null;case 24:return null;default:return null}}var Vi=!1,ut=!1,Yh=typeof WeakSet=="function"?WeakSet:Set,ae=null;function Kr(e,t){var s=e.ref;if(s!==null)if(typeof s=="function")try{s(null)}catch(l){He(e,t,l)}else s.current=null}function na(e,t,s){try{s()}catch(l){He(e,t,l)}}var ld=!1;function Xh(e,t){if(hl=fi,e=zc(),ol(e)){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else e:{s=(s=e.ownerDocument)&&s.defaultView||window;var l=s.getSelection&&s.getSelection();if(l&&l.rangeCount!==0){s=l.anchorNode;var c=l.anchorOffset,u=l.focusNode;l=l.focusOffset;try{s.nodeType,u.nodeType}catch{s=null;break e}var h=0,y=-1,k=-1,T=0,U=0,H=e,q=null;t:for(;;){for(var re;H!==s||c!==0&&H.nodeType!==3||(y=h+c),H!==u||l!==0&&H.nodeType!==3||(k=h+l),H.nodeType===3&&(h+=H.nodeValue.length),(re=H.firstChild)!==null;)q=H,H=re;for(;;){if(H===e)break t;if(q===s&&++T===c&&(y=h),q===u&&++U===l&&(k=h),(re=H.nextSibling)!==null)break;H=q,q=H.parentNode}H=re}s=y===-1||k===-1?null:{start:y,end:k}}else s=null}s=s||{start:0,end:0}}else s=null;for(ml={focusedElem:e,selectionRange:s},fi=!1,ae=t;ae!==null;)if(t=ae,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ae=e;else for(;ae!==null;){t=ae;try{var ce=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(ce!==null){var fe=ce.memoizedProps,Ge=ce.memoizedState,_=t.stateNode,j=_.getSnapshotBeforeUpdate(t.elementType===t.type?fe:Qt(t.type,fe),Ge);_.__reactInternalSnapshotBeforeUpdate=j}break;case 3:var I=t.stateNode.containerInfo;I.nodeType===1?I.textContent="":I.nodeType===9&&I.documentElement&&I.removeChild(I.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(K){He(t,t.return,K)}if(e=t.sibling,e!==null){e.return=t.return,ae=e;break}ae=t.return}return ce=ld,ld=!1,ce}function zs(e,t,s){var l=t.updateQueue;if(l=l!==null?l.lastEffect:null,l!==null){var c=l=l.next;do{if((c.tag&e)===e){var u=c.destroy;c.destroy=void 0,u!==void 0&&na(t,s,u)}c=c.next}while(c!==l)}}function Ki(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var s=t=t.next;do{if((s.tag&e)===e){var l=s.create;s.destroy=l()}s=s.next}while(s!==t)}}function ra(e){var t=e.ref;if(t!==null){var s=e.stateNode;e.tag,e=s,typeof t=="function"?t(e):t.current=e}}function ad(e){var t=e.alternate;t!==null&&(e.alternate=null,ad(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ln],delete t[Is],delete t[xl],delete t[Mh],delete t[Oh])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function cd(e){return e.tag===5||e.tag===3||e.tag===4}function ud(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||cd(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.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 sa(e,t,s){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?s.nodeType===8?s.parentNode.insertBefore(e,t):s.insertBefore(e,t):(s.nodeType===8?(t=s.parentNode,t.insertBefore(e,s)):(t=s,t.appendChild(e)),s=s._reactRootContainer,s!=null||t.onclick!==null||(t.onclick=Ci));else if(l!==4&&(e=e.child,e!==null))for(sa(e,t,s),e=e.sibling;e!==null;)sa(e,t,s),e=e.sibling}function ia(e,t,s){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?s.insertBefore(e,t):s.appendChild(e);else if(l!==4&&(e=e.child,e!==null))for(ia(e,t,s),e=e.sibling;e!==null;)ia(e,t,s),e=e.sibling}var st=null,Yt=!1;function Hn(e,t,s){for(s=s.child;s!==null;)dd(e,t,s),s=s.sibling}function dd(e,t,s){if(on&&typeof on.onCommitFiberUnmount=="function")try{on.onCommitFiberUnmount(oi,s)}catch{}switch(s.tag){case 5:ut||Kr(s,t);case 6:var l=st,c=Yt;st=null,Hn(e,t,s),st=l,Yt=c,st!==null&&(Yt?(e=st,s=s.stateNode,e.nodeType===8?e.parentNode.removeChild(s):e.removeChild(s)):st.removeChild(s.stateNode));break;case 18:st!==null&&(Yt?(e=st,s=s.stateNode,e.nodeType===8?yl(e.parentNode,s):e.nodeType===1&&yl(e,s),vs(e)):yl(st,s.stateNode));break;case 4:l=st,c=Yt,st=s.stateNode.containerInfo,Yt=!0,Hn(e,t,s),st=l,Yt=c;break;case 0:case 11:case 14:case 15:if(!ut&&(l=s.updateQueue,l!==null&&(l=l.lastEffect,l!==null))){c=l=l.next;do{var u=c,h=u.destroy;u=u.tag,h!==void 0&&((u&2)!==0||(u&4)!==0)&&na(s,t,h),c=c.next}while(c!==l)}Hn(e,t,s);break;case 1:if(!ut&&(Kr(s,t),l=s.stateNode,typeof l.componentWillUnmount=="function"))try{l.props=s.memoizedProps,l.state=s.memoizedState,l.componentWillUnmount()}catch(y){He(s,t,y)}Hn(e,t,s);break;case 21:Hn(e,t,s);break;case 22:s.mode&1?(ut=(l=ut)||s.memoizedState!==null,Hn(e,t,s),ut=l):Hn(e,t,s);break;default:Hn(e,t,s)}}function fd(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var s=e.stateNode;s===null&&(s=e.stateNode=new Yh),t.forEach(function(l){var c=om.bind(null,e,l);s.has(l)||(s.add(l),l.then(c,c))})}}function Xt(e,t){var s=t.deletions;if(s!==null)for(var l=0;l<s.length;l++){var c=s[l];try{var u=e,h=t,y=h;e:for(;y!==null;){switch(y.tag){case 5:st=y.stateNode,Yt=!1;break e;case 3:st=y.stateNode.containerInfo,Yt=!0;break e;case 4:st=y.stateNode.containerInfo,Yt=!0;break e}y=y.return}if(st===null)throw Error(o(160));dd(u,h,c),st=null,Yt=!1;var k=c.alternate;k!==null&&(k.return=null),c.return=null}catch(T){He(c,t,T)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)pd(t,e),t=t.sibling}function pd(e,t){var s=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Xt(t,e),un(e),l&4){try{zs(3,e,e.return),Ki(3,e)}catch(fe){He(e,e.return,fe)}try{zs(5,e,e.return)}catch(fe){He(e,e.return,fe)}}break;case 1:Xt(t,e),un(e),l&512&&s!==null&&Kr(s,s.return);break;case 5:if(Xt(t,e),un(e),l&512&&s!==null&&Kr(s,s.return),e.flags&32){var c=e.stateNode;try{xe(c,"")}catch(fe){He(e,e.return,fe)}}if(l&4&&(c=e.stateNode,c!=null)){var u=e.memoizedProps,h=s!==null?s.memoizedProps:u,y=e.type,k=e.updateQueue;if(e.updateQueue=null,k!==null)try{y==="input"&&u.type==="radio"&&u.name!=null&&Xe(c,u),Cr(y,h);var T=Cr(y,u);for(h=0;h<k.length;h+=2){var U=k[h],H=k[h+1];U==="style"?gn(c,H):U==="dangerouslySetInnerHTML"?Y(c,H):U==="children"?xe(c,H):ye(c,U,H,T)}switch(y){case"input":mt(c,u);break;case"textarea":tr(c,u);break;case"select":var q=c._wrapperState.wasMultiple;c._wrapperState.wasMultiple=!!u.multiple;var re=u.value;re!=null?Ut(c,!!u.multiple,re,!1):q!==!!u.multiple&&(u.defaultValue!=null?Ut(c,!!u.multiple,u.defaultValue,!0):Ut(c,!!u.multiple,u.multiple?[]:"",!1))}c[Is]=u}catch(fe){He(e,e.return,fe)}}break;case 6:if(Xt(t,e),un(e),l&4){if(e.stateNode===null)throw Error(o(162));c=e.stateNode,u=e.memoizedProps;try{c.nodeValue=u}catch(fe){He(e,e.return,fe)}}break;case 3:if(Xt(t,e),un(e),l&4&&s!==null&&s.memoizedState.isDehydrated)try{vs(t.containerInfo)}catch(fe){He(e,e.return,fe)}break;case 4:Xt(t,e),un(e);break;case 13:Xt(t,e),un(e),c=e.child,c.flags&8192&&(u=c.memoizedState!==null,c.stateNode.isHidden=u,!u||c.alternate!==null&&c.alternate.memoizedState!==null||(aa=Ke())),l&4&&fd(e);break;case 22:if(U=s!==null&&s.memoizedState!==null,e.mode&1?(ut=(T=ut)||U,Xt(t,e),ut=T):Xt(t,e),un(e),l&8192){if(T=e.memoizedState!==null,(e.stateNode.isHidden=T)&&!U&&(e.mode&1)!==0)for(ae=e,U=e.child;U!==null;){for(H=ae=U;ae!==null;){switch(q=ae,re=q.child,q.tag){case 0:case 11:case 14:case 15:zs(4,q,q.return);break;case 1:Kr(q,q.return);var ce=q.stateNode;if(typeof ce.componentWillUnmount=="function"){l=q,s=q.return;try{t=l,ce.props=t.memoizedProps,ce.state=t.memoizedState,ce.componentWillUnmount()}catch(fe){He(l,s,fe)}}break;case 5:Kr(q,q.return);break;case 22:if(q.memoizedState!==null){gd(H);continue}}re!==null?(re.return=q,ae=re):gd(H)}U=U.sibling}e:for(U=null,H=e;;){if(H.tag===5){if(U===null){U=H;try{c=H.stateNode,T?(u=c.style,typeof u.setProperty=="function"?u.setProperty("display","none","important"):u.display="none"):(y=H.stateNode,k=H.memoizedProps.style,h=k!=null&&k.hasOwnProperty("display")?k.display:null,y.style.display=Mt("display",h))}catch(fe){He(e,e.return,fe)}}}else if(H.tag===6){if(U===null)try{H.stateNode.nodeValue=T?"":H.memoizedProps}catch(fe){He(e,e.return,fe)}}else if((H.tag!==22&&H.tag!==23||H.memoizedState===null||H===e)&&H.child!==null){H.child.return=H,H=H.child;continue}if(H===e)break e;for(;H.sibling===null;){if(H.return===null||H.return===e)break e;U===H&&(U=null),H=H.return}U===H&&(U=null),H.sibling.return=H.return,H=H.sibling}}break;case 19:Xt(t,e),un(e),l&4&&fd(e);break;case 21:break;default:Xt(t,e),un(e)}}function un(e){var t=e.flags;if(t&2){try{e:{for(var s=e.return;s!==null;){if(cd(s)){var l=s;break e}s=s.return}throw Error(o(160))}switch(l.tag){case 5:var c=l.stateNode;l.flags&32&&(xe(c,""),l.flags&=-33);var u=ud(e);ia(e,u,c);break;case 3:case 4:var h=l.stateNode.containerInfo,y=ud(e);sa(e,y,h);break;default:throw Error(o(161))}}catch(k){He(e,e.return,k)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Jh(e,t,s){ae=e,hd(e)}function hd(e,t,s){for(var l=(e.mode&1)!==0;ae!==null;){var c=ae,u=c.child;if(c.tag===22&&l){var h=c.memoizedState!==null||Vi;if(!h){var y=c.alternate,k=y!==null&&y.memoizedState!==null||ut;y=Vi;var T=ut;if(Vi=h,(ut=k)&&!T)for(ae=c;ae!==null;)h=ae,k=h.child,h.tag===22&&h.memoizedState!==null?vd(c):k!==null?(k.return=h,ae=k):vd(c);for(;u!==null;)ae=u,hd(u),u=u.sibling;ae=c,Vi=y,ut=T}md(e)}else(c.subtreeFlags&8772)!==0&&u!==null?(u.return=c,ae=u):md(e)}}function md(e){for(;ae!==null;){var t=ae;if((t.flags&8772)!==0){var s=t.alternate;try{if((t.flags&8772)!==0)switch(t.tag){case 0:case 11:case 15:ut||Ki(5,t);break;case 1:var l=t.stateNode;if(t.flags&4&&!ut)if(s===null)l.componentDidMount();else{var c=t.elementType===t.type?s.memoizedProps:Qt(t.type,s.memoizedProps);l.componentDidUpdate(c,s.memoizedState,l.__reactInternalSnapshotBeforeUpdate)}var u=t.updateQueue;u!==null&&gu(t,u,l);break;case 3:var h=t.updateQueue;if(h!==null){if(s=null,t.child!==null)switch(t.child.tag){case 5:s=t.child.stateNode;break;case 1:s=t.child.stateNode}gu(t,h,s)}break;case 5:var y=t.stateNode;if(s===null&&t.flags&4){s=y;var k=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":k.autoFocus&&s.focus();break;case"img":k.src&&(s.src=k.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var T=t.alternate;if(T!==null){var U=T.memoizedState;if(U!==null){var H=U.dehydrated;H!==null&&vs(H)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(o(163))}ut||t.flags&512&&ra(t)}catch(q){He(t,t.return,q)}}if(t===e){ae=null;break}if(s=t.sibling,s!==null){s.return=t.return,ae=s;break}ae=t.return}}function gd(e){for(;ae!==null;){var t=ae;if(t===e){ae=null;break}var s=t.sibling;if(s!==null){s.return=t.return,ae=s;break}ae=t.return}}function vd(e){for(;ae!==null;){var t=ae;try{switch(t.tag){case 0:case 11:case 15:var s=t.return;try{Ki(4,t)}catch(k){He(t,s,k)}break;case 1:var l=t.stateNode;if(typeof l.componentDidMount=="function"){var c=t.return;try{l.componentDidMount()}catch(k){He(t,c,k)}}var u=t.return;try{ra(t)}catch(k){He(t,u,k)}break;case 5:var h=t.return;try{ra(t)}catch(k){He(t,h,k)}}}catch(k){He(t,t.return,k)}if(t===e){ae=null;break}var y=t.sibling;if(y!==null){y.return=t.return,ae=y;break}ae=t.return}}var Zh=Math.ceil,Gi=J.ReactCurrentDispatcher,oa=J.ReactCurrentOwner,zt=J.ReactCurrentBatchConfig,Re=0,tt=null,Qe=null,it=0,Rt=0,Gr=Wn(0),Ze=0,Ws=null,dr=0,Qi=0,la=0,Fs=null,xt=null,aa=0,Qr=1/0,bn=null,Yi=!1,ca=null,Vn=null,Xi=!1,Kn=null,Ji=0,Bs=0,ua=null,Zi=-1,eo=0;function pt(){return(Re&6)!==0?Ke():Zi!==-1?Zi:Zi=Ke()}function Gn(e){return(e.mode&1)===0?1:(Re&2)!==0&&it!==0?it&-it:$h.transition!==null?(eo===0&&(eo=uc()),eo):(e=Ae,e!==0||(e=window.event,e=e===void 0?16:xc(e.type)),e)}function Jt(e,t,s,l){if(50<Bs)throw Bs=0,ua=null,Error(o(185));fs(e,s,l),((Re&2)===0||e!==tt)&&(e===tt&&((Re&2)===0&&(Qi|=s),Ze===4&&Qn(e,it)),wt(e,l),s===1&&Re===0&&(t.mode&1)===0&&(Qr=Ke()+500,Ii&&Bn()))}function wt(e,t){var s=e.callbackNode;$p(e,t);var l=ci(e,e===tt?it:0);if(l===0)s!==null&&lc(s),e.callbackNode=null,e.callbackPriority=0;else if(t=l&-l,e.callbackPriority!==t){if(s!=null&&lc(s),t===1)e.tag===0?Ah(xd.bind(null,e)):su(xd.bind(null,e)),Rh(function(){(Re&6)===0&&Bn()}),s=null;else{switch(dc(l)){case 1:s=qo;break;case 4:s=ac;break;case 16:s=ii;break;case 536870912:s=cc;break;default:s=ii}s=_d(s,yd.bind(null,e))}e.callbackPriority=t,e.callbackNode=s}}function yd(e,t){if(Zi=-1,eo=0,(Re&6)!==0)throw Error(o(327));var s=e.callbackNode;if(Yr()&&e.callbackNode!==s)return null;var l=ci(e,e===tt?it:0);if(l===0)return null;if((l&30)!==0||(l&e.expiredLanes)!==0||t)t=to(e,l);else{t=l;var c=Re;Re|=2;var u=kd();(tt!==e||it!==t)&&(bn=null,Qr=Ke()+500,pr(e,t));do try{nm();break}catch(y){wd(e,y)}while(!0);Il(),Gi.current=u,Re=c,Qe!==null?t=0:(tt=null,it=0,t=Ze)}if(t!==0){if(t===2&&(c=Uo(e),c!==0&&(l=c,t=da(e,c))),t===1)throw s=Ws,pr(e,0),Qn(e,l),wt(e,Ke()),s;if(t===6)Qn(e,l);else{if(c=e.current.alternate,(l&30)===0&&!em(c)&&(t=to(e,l),t===2&&(u=Uo(e),u!==0&&(l=u,t=da(e,u))),t===1))throw s=Ws,pr(e,0),Qn(e,l),wt(e,Ke()),s;switch(e.finishedWork=c,e.finishedLanes=l,t){case 0:case 1:throw Error(o(345));case 2:hr(e,xt,bn);break;case 3:if(Qn(e,l),(l&130023424)===l&&(t=aa+500-Ke(),10<t)){if(ci(e,0)!==0)break;if(c=e.suspendedLanes,(c&l)!==l){pt(),e.pingedLanes|=e.suspendedLanes&c;break}e.timeoutHandle=vl(hr.bind(null,e,xt,bn),t);break}hr(e,xt,bn);break;case 4:if(Qn(e,l),(l&4194240)===l)break;for(t=e.eventTimes,c=-1;0<l;){var h=31-Vt(l);u=1<<h,h=t[h],h>c&&(c=h),l&=~u}if(l=c,l=Ke()-l,l=(120>l?120:480>l?480:1080>l?1080:1920>l?1920:3e3>l?3e3:4320>l?4320:1960*Zh(l/1960))-l,10<l){e.timeoutHandle=vl(hr.bind(null,e,xt,bn),l);break}hr(e,xt,bn);break;case 5:hr(e,xt,bn);break;default:throw Error(o(329))}}}return wt(e,Ke()),e.callbackNode===s?yd.bind(null,e):null}function da(e,t){var s=Fs;return e.current.memoizedState.isDehydrated&&(pr(e,t).flags|=256),e=to(e,t),e!==2&&(t=xt,xt=s,t!==null&&fa(t)),e}function fa(e){xt===null?xt=e:xt.push.apply(xt,e)}function em(e){for(var t=e;;){if(t.flags&16384){var s=t.updateQueue;if(s!==null&&(s=s.stores,s!==null))for(var l=0;l<s.length;l++){var c=s[l],u=c.getSnapshot;c=c.value;try{if(!Kt(u(),c))return!1}catch{return!1}}}if(s=t.child,t.subtreeFlags&16384&&s!==null)s.return=t,t=s;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Qn(e,t){for(t&=~la,t&=~Qi,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var s=31-Vt(t),l=1<<s;e[s]=-1,t&=~l}}function xd(e){if((Re&6)!==0)throw Error(o(327));Yr();var t=ci(e,0);if((t&1)===0)return wt(e,Ke()),null;var s=to(e,t);if(e.tag!==0&&s===2){var l=Uo(e);l!==0&&(t=l,s=da(e,l))}if(s===1)throw s=Ws,pr(e,0),Qn(e,t),wt(e,Ke()),s;if(s===6)throw Error(o(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,hr(e,xt,bn),wt(e,Ke()),null}function pa(e,t){var s=Re;Re|=1;try{return e(t)}finally{Re=s,Re===0&&(Qr=Ke()+500,Ii&&Bn())}}function fr(e){Kn!==null&&Kn.tag===0&&(Re&6)===0&&Yr();var t=Re;Re|=1;var s=zt.transition,l=Ae;try{if(zt.transition=null,Ae=1,e)return e()}finally{Ae=l,zt.transition=s,Re=t,(Re&6)===0&&Bn()}}function ha(){Rt=Gr.current,De(Gr)}function pr(e,t){e.finishedWork=null,e.finishedLanes=0;var s=e.timeoutHandle;if(s!==-1&&(e.timeoutHandle=-1,Ph(s)),Qe!==null)for(s=Qe.return;s!==null;){var l=s;switch(Sl(l),l.tag){case 1:l=l.type.childContextTypes,l!=null&&bi();break;case 3:Hr(),De(gt),De(lt),$l();break;case 5:Ol(l);break;case 4:Hr();break;case 13:De(Be);break;case 19:De(Be);break;case 10:El(l.type._context);break;case 22:case 23:ha()}s=s.return}if(tt=e,Qe=e=Yn(e.current,null),it=Rt=t,Ze=0,Ws=null,la=Qi=dr=0,xt=Fs=null,ar!==null){for(t=0;t<ar.length;t++)if(s=ar[t],l=s.interleaved,l!==null){s.interleaved=null;var c=l.next,u=s.pending;if(u!==null){var h=u.next;u.next=c,l.next=h}s.pending=l}ar=null}return e}function wd(e,t){do{var s=Qe;try{if(Il(),Di.current=Bi,zi){for(var l=qe.memoizedState;l!==null;){var c=l.queue;c!==null&&(c.pending=null),l=l.next}zi=!1}if(ur=0,et=Je=qe=null,Os=!1,As=0,oa.current=null,s===null||s.return===null){Ze=1,Ws=t,Qe=null;break}e:{var u=e,h=s.return,y=s,k=t;if(t=it,y.flags|=32768,k!==null&&typeof k=="object"&&typeof k.then=="function"){var T=k,U=y,H=U.tag;if((U.mode&1)===0&&(H===0||H===11||H===15)){var q=U.alternate;q?(U.updateQueue=q.updateQueue,U.memoizedState=q.memoizedState,U.lanes=q.lanes):(U.updateQueue=null,U.memoizedState=null)}var re=Hu(h);if(re!==null){re.flags&=-257,Vu(re,h,y,u,t),re.mode&1&&Uu(u,T,t),t=re,k=T;var ce=t.updateQueue;if(ce===null){var fe=new Set;fe.add(k),t.updateQueue=fe}else ce.add(k);break e}else{if((t&1)===0){Uu(u,T,t),ma();break e}k=Error(o(426))}}else if(Fe&&y.mode&1){var Ge=Hu(h);if(Ge!==null){(Ge.flags&65536)===0&&(Ge.flags|=256),Vu(Ge,h,y,u,t),bl(Vr(k,y));break e}}u=k=Vr(k,y),Ze!==4&&(Ze=2),Fs===null?Fs=[u]:Fs.push(u),u=h;do{switch(u.tag){case 3:u.flags|=65536,t&=-t,u.lanes|=t;var _=Bu(u,k,t);mu(u,_);break e;case 1:y=k;var j=u.type,I=u.stateNode;if((u.flags&128)===0&&(typeof j.getDerivedStateFromError=="function"||I!==null&&typeof I.componentDidCatch=="function"&&(Vn===null||!Vn.has(I)))){u.flags|=65536,t&=-t,u.lanes|=t;var K=qu(u,y,t);mu(u,K);break e}}u=u.return}while(u!==null)}Sd(s)}catch(he){t=he,Qe===s&&s!==null&&(Qe=s=s.return);continue}break}while(!0)}function kd(){var e=Gi.current;return Gi.current=Bi,e===null?Bi:e}function ma(){(Ze===0||Ze===3||Ze===2)&&(Ze=4),tt===null||(dr&268435455)===0&&(Qi&268435455)===0||Qn(tt,it)}function to(e,t){var s=Re;Re|=2;var l=kd();(tt!==e||it!==t)&&(bn=null,pr(e,t));do try{tm();break}catch(c){wd(e,c)}while(!0);if(Il(),Re=s,Gi.current=l,Qe!==null)throw Error(o(261));return tt=null,it=0,Ze}function tm(){for(;Qe!==null;)jd(Qe)}function nm(){for(;Qe!==null&&!_p();)jd(Qe)}function jd(e){var t=bd(e.alternate,e,Rt);e.memoizedProps=e.pendingProps,t===null?Sd(e):Qe=t,oa.current=null}function Sd(e){var t=e;do{var s=t.alternate;if(e=t.return,(t.flags&32768)===0){if(s=Gh(s,t,Rt),s!==null){Qe=s;return}}else{if(s=Qh(s,t),s!==null){s.flags&=32767,Qe=s;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Ze=6,Qe=null;return}}if(t=t.sibling,t!==null){Qe=t;return}Qe=t=e}while(t!==null);Ze===0&&(Ze=5)}function hr(e,t,s){var l=Ae,c=zt.transition;try{zt.transition=null,Ae=1,rm(e,t,s,l)}finally{zt.transition=c,Ae=l}return null}function rm(e,t,s,l){do Yr();while(Kn!==null);if((Re&6)!==0)throw Error(o(327));s=e.finishedWork;var c=e.finishedLanes;if(s===null)return null;if(e.finishedWork=null,e.finishedLanes=0,s===e.current)throw Error(o(177));e.callbackNode=null,e.callbackPriority=0;var u=s.lanes|s.childLanes;if(Lp(e,u),e===tt&&(Qe=tt=null,it=0),(s.subtreeFlags&2064)===0&&(s.flags&2064)===0||Xi||(Xi=!0,_d(ii,function(){return Yr(),null})),u=(s.flags&15990)!==0,(s.subtreeFlags&15990)!==0||u){u=zt.transition,zt.transition=null;var h=Ae;Ae=1;var y=Re;Re|=4,oa.current=null,Xh(e,s),pd(s,e),Sh(ml),fi=!!hl,ml=hl=null,e.current=s,Jh(s),Ip(),Re=y,Ae=h,zt.transition=u}else e.current=s;if(Xi&&(Xi=!1,Kn=e,Ji=c),u=e.pendingLanes,u===0&&(Vn=null),Rp(s.stateNode),wt(e,Ke()),t!==null)for(l=e.onRecoverableError,s=0;s<t.length;s++)c=t[s],l(c.value,{componentStack:c.stack,digest:c.digest});if(Yi)throw Yi=!1,e=ca,ca=null,e;return(Ji&1)!==0&&e.tag!==0&&Yr(),u=e.pendingLanes,(u&1)!==0?e===ua?Bs++:(Bs=0,ua=e):Bs=0,Bn(),null}function Yr(){if(Kn!==null){var e=dc(Ji),t=zt.transition,s=Ae;try{if(zt.transition=null,Ae=16>e?16:e,Kn===null)var l=!1;else{if(e=Kn,Kn=null,Ji=0,(Re&6)!==0)throw Error(o(331));var c=Re;for(Re|=4,ae=e.current;ae!==null;){var u=ae,h=u.child;if((ae.flags&16)!==0){var y=u.deletions;if(y!==null){for(var k=0;k<y.length;k++){var T=y[k];for(ae=T;ae!==null;){var U=ae;switch(U.tag){case 0:case 11:case 15:zs(8,U,u)}var H=U.child;if(H!==null)H.return=U,ae=H;else for(;ae!==null;){U=ae;var q=U.sibling,re=U.return;if(ad(U),U===T){ae=null;break}if(q!==null){q.return=re,ae=q;break}ae=re}}}var ce=u.alternate;if(ce!==null){var fe=ce.child;if(fe!==null){ce.child=null;do{var Ge=fe.sibling;fe.sibling=null,fe=Ge}while(fe!==null)}}ae=u}}if((u.subtreeFlags&2064)!==0&&h!==null)h.return=u,ae=h;else e:for(;ae!==null;){if(u=ae,(u.flags&2048)!==0)switch(u.tag){case 0:case 11:case 15:zs(9,u,u.return)}var _=u.sibling;if(_!==null){_.return=u.return,ae=_;break e}ae=u.return}}var j=e.current;for(ae=j;ae!==null;){h=ae;var I=h.child;if((h.subtreeFlags&2064)!==0&&I!==null)I.return=h,ae=I;else e:for(h=j;ae!==null;){if(y=ae,(y.flags&2048)!==0)try{switch(y.tag){case 0:case 11:case 15:Ki(9,y)}}catch(he){He(y,y.return,he)}if(y===h){ae=null;break e}var K=y.sibling;if(K!==null){K.return=y.return,ae=K;break e}ae=y.return}}if(Re=c,Bn(),on&&typeof on.onPostCommitFiberRoot=="function")try{on.onPostCommitFiberRoot(oi,e)}catch{}l=!0}return l}finally{Ae=s,zt.transition=t}}return!1}function Cd(e,t,s){t=Vr(s,t),t=Bu(e,t,1),e=Un(e,t,1),t=pt(),e!==null&&(fs(e,1,t),wt(e,t))}function He(e,t,s){if(e.tag===3)Cd(e,e,s);else for(;t!==null;){if(t.tag===3){Cd(t,e,s);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Vn===null||!Vn.has(l))){e=Vr(s,e),e=qu(t,e,1),t=Un(t,e,1),e=pt(),t!==null&&(fs(t,1,e),wt(t,e));break}}t=t.return}}function sm(e,t,s){var l=e.pingCache;l!==null&&l.delete(t),t=pt(),e.pingedLanes|=e.suspendedLanes&s,tt===e&&(it&s)===s&&(Ze===4||Ze===3&&(it&130023424)===it&&500>Ke()-aa?pr(e,0):la|=s),wt(e,t)}function Nd(e,t){t===0&&((e.mode&1)===0?t=1:(t=ai,ai<<=1,(ai&130023424)===0&&(ai=4194304)));var s=pt();e=Sn(e,t),e!==null&&(fs(e,t,s),wt(e,s))}function im(e){var t=e.memoizedState,s=0;t!==null&&(s=t.retryLane),Nd(e,s)}function om(e,t){var s=0;switch(e.tag){case 13:var l=e.stateNode,c=e.memoizedState;c!==null&&(s=c.retryLane);break;case 19:l=e.stateNode;break;default:throw Error(o(314))}l!==null&&l.delete(t),Nd(e,s)}var bd;bd=function(e,t,s){if(e!==null)if(e.memoizedProps!==t.pendingProps||gt.current)yt=!0;else{if((e.lanes&s)===0&&(t.flags&128)===0)return yt=!1,Kh(e,t,s);yt=(e.flags&131072)!==0}else yt=!1,Fe&&(t.flags&1048576)!==0&&iu(t,Pi,t.index);switch(t.lanes=0,t.tag){case 2:var l=t.type;Hi(e,t),e=t.pendingProps;var c=Dr(t,lt.current);Ur(t,s),c=zl(null,t,l,e,c,s);var u=Wl();return t.flags|=1,typeof c=="object"&&c!==null&&typeof c.render=="function"&&c.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,vt(l)?(u=!0,_i(t)):u=!1,t.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,Tl(t),c.updater=qi,t.stateNode=c,c._reactInternals=t,Vl(t,l,e,s),t=Yl(null,t,l,!0,u,s)):(t.tag=0,Fe&&u&&jl(t),ft(null,t,c,s),t=t.child),t;case 16:l=t.elementType;e:{switch(Hi(e,t),e=t.pendingProps,c=l._init,l=c(l._payload),t.type=l,c=t.tag=am(l),e=Qt(l,e),c){case 0:t=Ql(null,t,l,e,s);break e;case 1:t=Ju(null,t,l,e,s);break e;case 11:t=Ku(null,t,l,e,s);break e;case 14:t=Gu(null,t,l,Qt(l.type,e),s);break e}throw Error(o(306,l,""))}return t;case 0:return l=t.type,c=t.pendingProps,c=t.elementType===l?c:Qt(l,c),Ql(e,t,l,c,s);case 1:return l=t.type,c=t.pendingProps,c=t.elementType===l?c:Qt(l,c),Ju(e,t,l,c,s);case 3:e:{if(Zu(t),e===null)throw Error(o(387));l=t.pendingProps,u=t.memoizedState,c=u.element,hu(e,t),$i(t,l,null,s);var h=t.memoizedState;if(l=h.element,u.isDehydrated)if(u={element:l,isDehydrated:!1,cache:h.cache,pendingSuspenseBoundaries:h.pendingSuspenseBoundaries,transitions:h.transitions},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){c=Vr(Error(o(423)),t),t=ed(e,t,l,s,c);break e}else if(l!==c){c=Vr(Error(o(424)),t),t=ed(e,t,l,s,c);break e}else for(Pt=zn(t.stateNode.containerInfo.firstChild),Et=t,Fe=!0,Gt=null,s=fu(t,null,l,s),t.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(Fr(),l===c){t=Nn(e,t,s);break e}ft(e,t,l,s)}t=t.child}return t;case 5:return vu(t),e===null&&Nl(t),l=t.type,c=t.pendingProps,u=e!==null?e.memoizedProps:null,h=c.children,gl(l,c)?h=null:u!==null&&gl(l,u)&&(t.flags|=32),Xu(e,t),ft(e,t,h,s),t.child;case 6:return e===null&&Nl(t),null;case 13:return td(e,t,s);case 4:return Ml(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=Br(t,null,l,s):ft(e,t,l,s),t.child;case 11:return l=t.type,c=t.pendingProps,c=t.elementType===l?c:Qt(l,c),Ku(e,t,l,c,s);case 7:return ft(e,t,t.pendingProps,s),t.child;case 8:return ft(e,t,t.pendingProps.children,s),t.child;case 12:return ft(e,t,t.pendingProps.children,s),t.child;case 10:e:{if(l=t.type._context,c=t.pendingProps,u=t.memoizedProps,h=c.value,$e(Mi,l._currentValue),l._currentValue=h,u!==null)if(Kt(u.value,h)){if(u.children===c.children&&!gt.current){t=Nn(e,t,s);break e}}else for(u=t.child,u!==null&&(u.return=t);u!==null;){var y=u.dependencies;if(y!==null){h=u.child;for(var k=y.firstContext;k!==null;){if(k.context===l){if(u.tag===1){k=Cn(-1,s&-s),k.tag=2;var T=u.updateQueue;if(T!==null){T=T.shared;var U=T.pending;U===null?k.next=k:(k.next=U.next,U.next=k),T.pending=k}}u.lanes|=s,k=u.alternate,k!==null&&(k.lanes|=s),Pl(u.return,s,t),y.lanes|=s;break}k=k.next}}else if(u.tag===10)h=u.type===t.type?null:u.child;else if(u.tag===18){if(h=u.return,h===null)throw Error(o(341));h.lanes|=s,y=h.alternate,y!==null&&(y.lanes|=s),Pl(h,s,t),h=u.sibling}else h=u.child;if(h!==null)h.return=u;else for(h=u;h!==null;){if(h===t){h=null;break}if(u=h.sibling,u!==null){u.return=h.return,h=u;break}h=h.return}u=h}ft(e,t,c.children,s),t=t.child}return t;case 9:return c=t.type,l=t.pendingProps.children,Ur(t,s),c=Lt(c),l=l(c),t.flags|=1,ft(e,t,l,s),t.child;case 14:return l=t.type,c=Qt(l,t.pendingProps),c=Qt(l.type,c),Gu(e,t,l,c,s);case 15:return Qu(e,t,t.type,t.pendingProps,s);case 17:return l=t.type,c=t.pendingProps,c=t.elementType===l?c:Qt(l,c),Hi(e,t),t.tag=1,vt(l)?(e=!0,_i(t)):e=!1,Ur(t,s),Wu(t,l,c),Vl(t,l,c,s),Yl(null,t,l,!0,e,s);case 19:return rd(e,t,s);case 22:return Yu(e,t,s)}throw Error(o(156,t.tag))};function _d(e,t){return oc(e,t)}function lm(e,t,s,l){this.tag=e,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Wt(e,t,s,l){return new lm(e,t,s,l)}function ga(e){return e=e.prototype,!(!e||!e.isReactComponent)}function am(e){if(typeof e=="function")return ga(e)?1:0;if(e!=null){if(e=e.$$typeof,e===je)return 11;if(e===A)return 14}return 2}function Yn(e,t){var s=e.alternate;return s===null?(s=Wt(e.tag,t,e.key,e.mode),s.elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=t,s.type=e.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=e.flags&14680064,s.childLanes=e.childLanes,s.lanes=e.lanes,s.child=e.child,s.memoizedProps=e.memoizedProps,s.memoizedState=e.memoizedState,s.updateQueue=e.updateQueue,t=e.dependencies,s.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s}function no(e,t,s,l,c,u){var h=2;if(l=e,typeof e=="function")ga(e)&&(h=1);else if(typeof e=="string")h=5;else e:switch(e){case D:return mr(s.children,c,u,t);case Z:h=8,c|=8;break;case X:return e=Wt(12,s,t,c|2),e.elementType=X,e.lanes=u,e;case ee:return e=Wt(13,s,t,c),e.elementType=ee,e.lanes=u,e;case Ce:return e=Wt(19,s,t,c),e.elementType=Ce,e.lanes=u,e;case ve:return ro(s,c,u,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ie:h=10;break e;case G:h=9;break e;case je:h=11;break e;case A:h=14;break e;case me:h=16,l=null;break e}throw Error(o(130,e==null?e:typeof e,""))}return t=Wt(h,s,t,c),t.elementType=e,t.type=l,t.lanes=u,t}function mr(e,t,s,l){return e=Wt(7,e,l,t),e.lanes=s,e}function ro(e,t,s,l){return e=Wt(22,e,l,t),e.elementType=ve,e.lanes=s,e.stateNode={isHidden:!1},e}function va(e,t,s){return e=Wt(6,e,null,t),e.lanes=s,e}function ya(e,t,s){return t=Wt(4,e.children!==null?e.children:[],e.key,t),t.lanes=s,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function cm(e,t,s,l,c){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ho(0),this.expirationTimes=Ho(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ho(0),this.identifierPrefix=l,this.onRecoverableError=c,this.mutableSourceEagerHydrationData=null}function xa(e,t,s,l,c,u,h,y,k){return e=new cm(e,t,s,y,k),t===1?(t=1,u===!0&&(t|=8)):t=0,u=Wt(3,null,null,t),e.current=u,u.stateNode=e,u.memoizedState={element:l,isDehydrated:s,cache:null,transitions:null,pendingSuspenseBoundaries:null},Tl(u),e}function um(e,t,s){var l=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:N,key:l==null?null:""+l,children:e,containerInfo:t,implementation:s}}function Id(e){if(!e)return Fn;e=e._reactInternals;e:{if(sn(e)!==e||e.tag!==1)throw Error(o(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(vt(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(o(171))}if(e.tag===1){var s=e.type;if(vt(s))return nu(e,s,t)}return t}function Ed(e,t,s,l,c,u,h,y,k){return e=xa(s,l,!0,e,c,u,h,y,k),e.context=Id(null),s=e.current,l=pt(),c=Gn(s),u=Cn(l,c),u.callback=t??null,Un(s,u,c),e.current.lanes=c,fs(e,c,l),wt(e,l),e}function so(e,t,s,l){var c=t.current,u=pt(),h=Gn(c);return s=Id(s),t.context===null?t.context=s:t.pendingContext=s,t=Cn(u,h),t.payload={element:e},l=l===void 0?null:l,l!==null&&(t.callback=l),e=Un(c,t,h),e!==null&&(Jt(e,c,h,u),Ai(e,c,h)),h}function io(e){return e=e.current,e.child?(e.child.tag===5,e.child.stateNode):null}function Pd(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var s=e.retryLane;e.retryLane=s!==0&&s<t?s:t}}function wa(e,t){Pd(e,t),(e=e.alternate)&&Pd(e,t)}function dm(){return null}var Rd=typeof reportError=="function"?reportError:function(e){console.error(e)};function ka(e){this._internalRoot=e}oo.prototype.render=ka.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));so(e,t,null,null)},oo.prototype.unmount=ka.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;fr(function(){so(null,e,null,null)}),t[xn]=null}};function oo(e){this._internalRoot=e}oo.prototype.unstable_scheduleHydration=function(e){if(e){var t=hc();e={blockedOn:null,target:e,priority:t};for(var s=0;s<$n.length&&t!==0&&t<$n[s].priority;s++);$n.splice(s,0,e),s===0&&vc(e)}};function ja(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function lo(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Td(){}function fm(e,t,s,l,c){if(c){if(typeof l=="function"){var u=l;l=function(){var T=io(h);u.call(T)}}var h=Ed(t,l,e,0,null,!1,!1,"",Td);return e._reactRootContainer=h,e[xn]=h.current,bs(e.nodeType===8?e.parentNode:e),fr(),h}for(;c=e.lastChild;)e.removeChild(c);if(typeof l=="function"){var y=l;l=function(){var T=io(k);y.call(T)}}var k=xa(e,0,!1,null,null,!1,!1,"",Td);return e._reactRootContainer=k,e[xn]=k.current,bs(e.nodeType===8?e.parentNode:e),fr(function(){so(t,k,s,l)}),k}function ao(e,t,s,l,c){var u=s._reactRootContainer;if(u){var h=u;if(typeof c=="function"){var y=c;c=function(){var k=io(h);y.call(k)}}so(t,h,e,c)}else h=fm(s,t,e,c,l);return io(h)}fc=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var s=ds(t.pendingLanes);s!==0&&(Vo(t,s|1),wt(t,Ke()),(Re&6)===0&&(Qr=Ke()+500,Bn()))}break;case 13:fr(function(){var l=Sn(e,1);if(l!==null){var c=pt();Jt(l,e,1,c)}}),wa(e,1)}},Ko=function(e){if(e.tag===13){var t=Sn(e,134217728);if(t!==null){var s=pt();Jt(t,e,134217728,s)}wa(e,134217728)}},pc=function(e){if(e.tag===13){var t=Gn(e),s=Sn(e,t);if(s!==null){var l=pt();Jt(s,e,t,l)}wa(e,t)}},hc=function(){return Ae},mc=function(e,t){var s=Ae;try{return Ae=e,t()}finally{Ae=s}},_r=function(e,t,s){switch(t){case"input":if(mt(e,s),t=s.name,s.type==="radio"&&t!=null){for(s=e;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<s.length;t++){var l=s[t];if(l!==e&&l.form===e.form){var c=Ni(l);if(!c)throw Error(o(90));ht(l),mt(l,c)}}}break;case"textarea":tr(e,s);break;case"select":t=s.value,t!=null&&Ut(e,!!s.multiple,t,!1)}},ni=pa,C=fr;var pm={usingClientEntryPoint:!1,Events:[Es,$r,Ni,as,cs,pa]},qs={findFiberByHostInstance:sr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},hm={bundleType:qs.bundleType,version:qs.version,rendererPackageName:qs.rendererPackageName,rendererConfig:qs.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:J.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=sc(e),e===null?null:e.stateNode},findFiberByHostInstance:qs.findFiberByHostInstance||dm,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var co=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!co.isDisabled&&co.supportsFiber)try{oi=co.inject(hm),on=co}catch{}}return kt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=pm,kt.createPortal=function(e,t){var s=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!ja(t))throw Error(o(200));return um(e,t,null,s)},kt.createRoot=function(e,t){if(!ja(e))throw Error(o(299));var s=!1,l="",c=Rd;return t!=null&&(t.unstable_strictMode===!0&&(s=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=xa(e,1,!1,null,null,s,!1,l,c),e[xn]=t.current,bs(e.nodeType===8?e.parentNode:e),new ka(t)},kt.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=sc(t),e=e===null?null:e.stateNode,e},kt.flushSync=function(e){return fr(e)},kt.hydrate=function(e,t,s){if(!lo(t))throw Error(o(200));return ao(null,e,t,!0,s)},kt.hydrateRoot=function(e,t,s){if(!ja(e))throw Error(o(405));var l=s!=null&&s.hydratedSources||null,c=!1,u="",h=Rd;if(s!=null&&(s.unstable_strictMode===!0&&(c=!0),s.identifierPrefix!==void 0&&(u=s.identifierPrefix),s.onRecoverableError!==void 0&&(h=s.onRecoverableError)),t=Ed(t,null,e,1,s??null,c,!1,u,h),e[xn]=t.current,bs(e),l)for(e=0;e<l.length;e++)s=l[e],c=s._getVersion,c=c(s._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[s,c]:t.mutableSourceEagerHydrationData.push(s,c);return new oo(t)},kt.render=function(e,t,s){if(!lo(t))throw Error(o(200));return ao(null,e,t,!1,s)},kt.unmountComponentAtNode=function(e){if(!lo(e))throw Error(o(40));return e._reactRootContainer?(fr(function(){ao(null,null,e,!1,function(){e._reactRootContainer=null,e[xn]=null})}),!0):!1},kt.unstable_batchedUpdates=pa,kt.unstable_renderSubtreeIntoContainer=function(e,t,s,l){if(!lo(s))throw Error(o(200));if(e==null||e._reactInternals===void 0)throw Error(o(38));return ao(e,t,s,!1,l)},kt.version="18.3.1-next-f1338f8080-20240426",kt}var Wd;function Nm(){if(Wd)return Na.exports;Wd=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(r){console.error(r)}}return n(),Na.exports=Cm(),Na.exports}var Fd;function bm(){if(Fd)return uo;Fd=1;var n=Nm();return uo.createRoot=n.createRoot,uo.hydrateRoot=n.hydrateRoot,uo}var _m=bm();const Im=zf(_m),Wf={boot:"loading",bootstrap:null,connection:"connecting",connectionAttempt:0,lastCursor:0,lastEventId:null,contextRevision:"",workspaceId:"",workspace:"",workspaces:[],sessions:[],workspaceSessions:{},archivedSessions:{status:"idle",items:[],nextCursor:null,ownerWorkspaceId:""},workspaceProjectSummaries:{},workspaceResourceEpochs:{},workspaceNextCursor:null,sessionNextCursor:null,activeSessionId:null,sessionSync:{},clientTelemetry:{sessionSwitches:0,snapshotCacheHits:0,snapshotLoads:0,snapshotFailures:0},sessionProjectionById:{},sessionRuntimeById:{},transcript:[],tools:[],edits:[],subtasks:[],research:[],permission:null,processing:!1,statusMessage:"正在连接本地 Web Host…",mode:{baseMode:"interactive",pendingBaseMode:null},effort:null,queue:{items:[],limit:16},goal:null,goalEvidence:[],goalActivity:[],diagnostics:null,settings:null,settingsMirror:{status:"idle",document:null,lastGood:null,stale:!1,error:null,generation:0},sessionSnapshot:null,composer:null,modelCatalog:null,plan:null,skills:[],mcpServers:[],toolDetails:[],skillNextCursor:null,mcpNextCursor:null,toolDetailNextCursor:null,loopStats:null,traces:[],pendingAction:null,notice:null,announcement:""},Bd=Object.freeze({status:"idle",requestId:null});function Oo(n){return n.activeSessionId?n.sessionSync[n.activeSessionId]??Bd:Bd}function jr(n){return!!(n.activeSessionId&&n.sessionSnapshot?.session.id===n.activeSessionId&&Oo(n).status==="ready")}function Q({name:n,size:r=18,...o}){return i.jsx("svg",{"aria-hidden":"true",focusable:"false",viewBox:"0 0 24 24",width:r,height:r,fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",...o,children:Em[n]})}const Em={activity:i.jsx("path",{d:"M3 12h4l2.2-6 4.2 12 2.2-6H21"}),add:i.jsx("path",{d:"M12 5v14M5 12h14"}),"arrow-up":i.jsx("path",{d:"m6 11 6-6 6 6M12 5v14"}),branch:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"6",cy:"5",r:"2"}),i.jsx("circle",{cx:"18",cy:"7",r:"2"}),i.jsx("circle",{cx:"6",cy:"19",r:"2"}),i.jsx("path",{d:"M6 7v10M8 12h4a6 6 0 0 0 6-3"})]}),check:i.jsx("path",{d:"m5 12 4 4L19 6"}),chevron:i.jsx("path",{d:"m9 7 5 5-5 5"}),close:i.jsx("path",{d:"m6 6 12 12M18 6 6 18"}),code:i.jsx("path",{d:"m8 9-4 3 4 3M16 9l4 3-4 3M14 5l-4 14"}),copy:i.jsxs(i.Fragment,{children:[i.jsx("rect",{x:"8",y:"8",width:"11",height:"11",rx:"2"}),i.jsx("path",{d:"M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2"})]}),diagnostics:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M4 19V9M10 19V5M16 19v-7M22 19V3"}),i.jsx("path",{d:"M2 19h21"})]}),edit:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M12 20h9"}),i.jsx("path",{d:"M16.5 3.5a2.1 2.1 0 0 1 3 3L8 18l-4 1 1-4Z"})]}),goal:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"12",cy:"12",r:"8"}),i.jsx("circle",{cx:"12",cy:"12",r:"3"}),i.jsx("path",{d:"m15 9 5-5M17 4h3v3"})]}),info:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"12",cy:"12",r:"9"}),i.jsx("path",{d:"M12 11v5M12 8h.01"})]}),keyboard:i.jsxs(i.Fragment,{children:[i.jsx("rect",{x:"2",y:"6",width:"20",height:"12",rx:"2"}),i.jsx("path",{d:"M6 10h.01M10 10h.01M14 10h.01M18 10h.01M6 14h.01M18 14h.01M9.5 14.5h5"})]}),menu:i.jsx("path",{d:"M4 7h16M4 12h16M4 17h16"}),monitor:i.jsxs(i.Fragment,{children:[i.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),i.jsx("path",{d:"M8 21h8M12 17v4"})]}),moon:i.jsx("path",{d:"M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z"}),more:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"5",cy:"12",r:"1",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"12",cy:"12",r:"1",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"19",cy:"12",r:"1",fill:"currentColor",stroke:"none"})]}),pause:i.jsx("path",{d:"M9 5v14M15 5v14"}),refresh:i.jsx("path",{d:"M20 7v5h-5M4 17v-5h5M6.1 9A7 7 0 0 1 18 6l2 6M17.9 15A7 7 0 0 1 6 18l-2-6"}),search:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"11",cy:"11",r:"7"}),i.jsx("path",{d:"m20 20-4-4"})]}),settings:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"12",cy:"12",r:"3"}),i.jsx("path",{d:"M19.4 15a1.7 1.7 0 0 0 .3 1.9l.1.1-2.8 2.8-.1-.1a1.7 1.7 0 0 0-1.9-.3 1.7 1.7 0 0 0-1 1.6v.2h-4V21a1.7 1.7 0 0 0-1-1.6 1.7 1.7 0 0 0-1.9.3l-.1.1L4.2 17l.1-.1a1.7 1.7 0 0 0 .3-1.9A1.7 1.7 0 0 0 3 14H2.8v-4H3a1.7 1.7 0 0 0 1.6-1 1.7 1.7 0 0 0-.3-1.9L4.2 7 7 4.2l.1.1A1.7 1.7 0 0 0 9 4.6a1.7 1.7 0 0 0 1-1.6v-.2h4V3a1.7 1.7 0 0 0 1 1.6 1.7 1.7 0 0 0 1.9-.3l.1-.1L19.8 7l-.1.1a1.7 1.7 0 0 0-.3 1.9 1.7 1.7 0 0 0 1.6 1h.2v4H21a1.7 1.7 0 0 0-1.6 1Z"})]}),sidebar:i.jsxs(i.Fragment,{children:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),i.jsx("path",{d:"M9 4v16"})]}),spark:i.jsx("path",{d:"m12 3 1.5 5.5L19 10l-5.5 1.5L12 17l-1.5-5.5L5 10l5.5-1.5ZM19 16l.7 2.3L22 19l-2.3.7L19 22l-.7-2.3L16 19l2.3-.7Z"}),stop:i.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"}),sun:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"12",cy:"12",r:"4"}),i.jsx("path",{d:"M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"})]}),terminal:i.jsx("path",{d:"m5 7 4 4-4 4M11 16h8"}),trash:i.jsx(i.Fragment,{children:i.jsx("path",{d:"M4 7h16M9 7V4h6v3M7 7l1 13h8l1-13M10 11v5M14 11v5"})}),warning:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M12 3 2.5 20h19Z"}),i.jsx("path",{d:"M12 9v4M12 17h.01"})]}),workspace:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M3 7h7l2 2h9v10H3Z"}),i.jsx("path",{d:"M3 7V5h7l2 2"})]}),"chevron-left":i.jsx("path",{d:"m15 7-5 5 5 5"})};function Xs({children:n,className:r=""}){return i.jsx("div",{className:`markdown ${r}`.trim(),children:Ff(n)})}function Ff(n){const r=n.replace(/\r\n?/g,`
10
+ `).split(`
11
+ `),o=[];let a=0;for(;a<r.length;){const d=r[a];if(!d.trim()){a+=1;continue}const f=d.match(/^\s*```([^`]*)$/);if(f){const E=[];for(a+=1;a<r.length&&!/^\s*```\s*$/.test(r[a]);)E.push(r[a]),a+=1;a<r.length&&(a+=1),o.push(i.jsx(Am,{language:f[1].trim(),content:E.join(`
12
+ `)},`code-${a}`));continue}const p=d.match(/^(#{1,6})\s+(.+)$/);if(p){const E=Math.min(6,p[1].length);o.push(Om(E,Qs(p[2],`heading-${a}`),`heading-${a}`)),a+=1;continue}if(/^\s*>\s?/.test(d)){const E=[];for(;a<r.length&&/^\s*>\s?/.test(r[a]);)E.push(r[a].replace(/^\s*>\s?/,"")),a+=1;o.push(i.jsx("blockquote",{children:Ff(E.join(`
13
+ `))},`quote-${a}`));continue}if(d.match(/^\s*(?:[-*+] |\d+[.)] )(.+)$/)){const E=/^\s*\d/.test(d),S=[],P=E?/^\s*\d+[.)]\s+(.+)$/:/^\s*[-*+]\s+(.+)$/;for(;a<r.length;){const $=r[a].match(P);if(!$)break;S.push($[1]),a+=1}const R=S.map(($,O)=>i.jsx("li",{children:Qs($,`list-${a}-${O}`)},`item-${a}-${O}`));o.push(E?i.jsx("ol",{children:R},`list-${a}`):i.jsx("ul",{children:R},`list-${a}`));continue}const x=Ma(d);if(x&&x.length>=1&&a+1<r.length){const E=Rm(r[a+1]);if(E&&E.length===x.length){const S=[x];for(a+=2;a<r.length;){const P=Ma(r[a]);if(!P||P.length!==x.length)break;S.push(P),a+=1}o.push(Tm(S,E,`table-${a}`));continue}}const w=[d.trim()];for(a+=1;a<r.length&&r[a].trim()&&!Pm(r[a]);)w.push(r[a].trim()),a+=1;o.push(i.jsx("p",{children:Qs(w.join(" "),`paragraph-${a}`)},`paragraph-${a}`))}return o}function Pm(n){return/^\s*```/.test(n)||/^(#{1,6})\s+/.test(n)||/^\s*>\s?/.test(n)||/^\s*(?:[-*+] |\d+[.)] )/.test(n)||Ma(n)!==null}function Ma(n){if(!n.includes("|"))return null;const r=n.split("|"),o=r[0].trim()==="",a=r[r.length-1].trim()==="",d=o&&a?r.slice(1,-1):r;return d.length===0?null:d.map(f=>f.trim())}function Rm(n){if(!n.includes("|")&&!/[-:]/.test(n))return null;let r=n.split("|").map(a=>a.trim());if(r.length>=2&&r[0]===""&&r[r.length-1]===""&&(r=r.slice(1,-1)),r.length<1)return null;const o=[];for(const a of r){if(a===""||!/^:?-+:?$/.test(a))return null;const d=a.startsWith(":"),f=a.endsWith(":");d&&f?o.push("center"):f?o.push("right"):o.push("left")}return o}function Tm(n,r,o){const[a,...d]=n,f=p=>p==="left"?void 0:{textAlign:p};return i.jsxs("table",{className:"markdown-table",children:[i.jsx("thead",{children:i.jsx("tr",{children:a.map((p,g)=>i.jsx("th",{style:f(r[g]),children:Qs(p,`${o}-th-${g}`)},`th-${g}`))})}),i.jsx("tbody",{children:d.map((p,g)=>i.jsx("tr",{children:p.map((x,w)=>i.jsx("td",{style:f(r[w]),children:Qs(x,`${o}-td-${g}-${w}`)},`td-${g}-${w}`))},`tr-${g}`))})]},o)}function Qs(n,r){const o=/(`[^`\n]+`|\*\*[^*\n]+\*\*|\[[^\]\n]+\]\([^\s)]+\))/g,a=[];let d=0,f,p=0;for(;f=o.exec(n);){f.index>d&&a.push(n.slice(d,f.index));const g=f[0],x=`${r}-${p++}`;if(g.startsWith("`"))a.push(i.jsx("code",{children:g.slice(1,-1)},x));else if(g.startsWith("**"))a.push(i.jsx("strong",{children:g.slice(2,-2)},x));else{const w=g.match(/^\[([^\]]+)\]\(([^)]+)\)$/);w&&Mm(w[2])?a.push(i.jsx("a",{href:w[2],target:"_blank",rel:"noopener noreferrer",referrerPolicy:"no-referrer",children:w[1]},x)):a.push(g)}d=f.index+g.length}return d<n.length&&a.push(n.slice(d)),a}function Mm(n){try{const r=new URL(n);return r.protocol==="https:"||r.protocol==="http:"||r.protocol==="mailto:"}catch{return!1}}function Om(n,r,o){return n===1?i.jsx("h1",{children:r},o):n===2?i.jsx("h2",{children:r},o):n===3?i.jsx("h3",{children:r},o):n===4?i.jsx("h4",{children:r},o):n===5?i.jsx("h5",{children:r},o):i.jsx("h6",{children:r},o)}function Am({language:n,content:r}){const[o,a]=m.useState("idle"),d=async()=>{try{await navigator.clipboard.writeText(r),a("copied"),window.setTimeout(()=>a("idle"),1400)}catch{a("failed")}};return i.jsxs("figure",{className:"code-block",children:[i.jsxs("figcaption",{children:[i.jsx("span",{children:n||"text"}),i.jsxs("button",{type:"button",className:"icon-text-button",onClick:d,"aria-label":"复制代码",children:[i.jsx(Q,{name:o==="copied"?"check":"copy",size:15}),o==="copied"?"已复制":o==="failed"?"复制失败":"复制"]})]}),i.jsx("pre",{tabIndex:0,"aria-label":`${n||"文本"}代码块`,children:i.jsx("code",{children:r})})]})}function Rn(n){return n.replace(/\u001b\[[0-?]*[ -/]*[@-~]/g,"").replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/g,"")}function Ka(n,r=8e3){const o=/api.?key|authorization|cookie|password|secret|token/i;let a;try{a=JSON.stringify(n,(f,p)=>f&&o.test(f)?"[REDACTED]":p,2)}catch{a=String(n)}const d=Rn(a);return d.length<=r?d:`${d.slice(0,r)}
14
+ …已截断`}const $m=Object.freeze({activating:"running",closed:"danger",completed:"success",connected:"success",done:"success",draining:"warning",error:"danger",failed:"danger",live:"running",offline:"danger",passed:"success",pending:"running",queued:"running",ready:"success",rejected:"danger",replay:"warning","replay-required":"warning",running:"running",skipped:"warning",streaming:"running",success:"success",timedout:"warning",warning:"warning"}),qd=Object.freeze({danger:"失败",idle:"空闲",running:"进行中",success:"已完成",warning:"部分完成"});function Lm(n){return $m[n.trim().toLowerCase()]??"idle"}function Dm(n){return qd[n]??qd.idle}function Ga({state:n,className:r="",label:o,describe:a=!0}){const d=Lm(n);return i.jsxs(i.Fragment,{children:[i.jsx("span",{className:`state-dot state-${n}${r?` ${r}`:""}`,"data-tone":d,"aria-hidden":"true"}),a?i.jsx("span",{className:"sr-only",children:o??Dm(d)}):null]})}const os="orion.web.composer-drafts.v1",Bf=20,Oa=256*1024,zm=5*1024*1024;function Wm(n,r){return Ao().entries.find(o=>o.workspaceId===n&&o.sessionId===r)??null}function Fm(n){const r=$o();if(!r)return;const o=Object.freeze({...n,references:[...n.references],updatedAt:Date.now()});if(Aa(o)>Oa)throw new Error(`Composer draft exceeds ${Oa} bytes.`);const a=Ao().entries.filter(f=>!(f.workspaceId===n.workspaceId&&f.sessionId===n.sessionId)),d=[o,...a].slice(0,Bf);for(;d.length>0&&Aa({version:1,entries:d})>zm;)d.pop();r.setItem(os,JSON.stringify({version:1,entries:d}))}function Ud(n,r){const o=$o();if(!o)return;const a=Ao().entries.filter(d=>!(d.workspaceId===n&&d.sessionId===r));a.length===0?o.removeItem(os):o.setItem(os,JSON.stringify({version:1,entries:a}))}function Bm(n){const r=$o();if(!r)return;const o=Ao().entries.filter(a=>a.workspaceId!==n);o.length===0?r.removeItem(os):r.setItem(os,JSON.stringify({version:1,entries:o}))}function Ao(){const n=$o();if(!n)return{version:1,entries:[]};try{const r=JSON.parse(n.getItem(os)??"");return r.version!==1||!Array.isArray(r.entries)?{version:1,entries:[]}:{version:1,entries:r.entries.filter(qm).slice(0,Bf)}}catch{return{version:1,entries:[]}}}function qm(n){if(!n||typeof n!="object")return!1;const r=n;return typeof r.workspaceId=="string"&&typeof r.sessionId=="string"&&typeof r.text=="string"&&Array.isArray(r.references)&&typeof r.updatedAt=="number"&&Number.isFinite(r.updatedAt)&&Aa(r)<=Oa}function $o(){try{return typeof window>"u"?null:window.sessionStorage}catch{return null}}function Aa(n){return new TextEncoder().encode(JSON.stringify(n)).byteLength}const qf=/^hmac-sha256:[0-9a-f]{64}$/,Um=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,Hm=/^(?:api[-_]?key|authorization|cookie|password|secret|access[-_]?token|refresh[-_]?token|auth[-_]?token|credential[-_]?value|headers?|env(?:ironment)?[-_]?name)$/i,Vm=["ready","invalid","read-only","unavailable"],Km=["internal","model","global","project","session"],Gm=["global","project","session"],Qm=["live","next-logical-request","new-session","restart"],Ym=["runtime_busy","read_only","invalid_document"],Xm=["system","light","dark"],Jm=["system","reduced"],Zm=["classic","orion-blocksmith"],Uf=["auto","none","minimal","low","medium","high","xhigh","max"],eg=["ask","allow","deny"],tg=["appearance.style","appearance.theme","appearance.motion","defaults.model","defaults.effort","permissions.toolConfirmation"];function $a(n){bo(n);const r=Bt(n,"Settings document");if(qt(r,["schemaVersion","revision","state","writable","hasDocument","workspace","sections","models","credentials","currentSession","diagnostic"]),r.schemaVersion!==1&&r.schemaVersion!==2)throw new Error("Settings schemaVersion is not supported.");const o=r.schemaVersion,a=Nt(r.revision,"Settings revision");if(!qf.test(a))throw new Error("Settings revision is invalid.");const d=tn(r.state,"Settings state",Vm),f=Bt(r.sections,"Settings sections");qt(f,["appearance","defaults","permissions"]);const p=Bt(f.appearance,"Appearance settings");qt(p,o===1?["theme","motion"]:["style","theme","motion"]);const g=Bt(f.defaults,"Default settings");qt(g,["model","effort"]);const x=Bt(f.permissions,"Permission settings");qt(x,["toolConfirmation"]);const w=La(r.models,"Settings models").map(sg),E=La(r.credentials,"Credential status").map(ig),S=r.currentSession===void 0?void 0:og(r.currentSession),P=r.diagnostic===void 0?void 0:lg(r.diagnostic);return{schemaVersion:2,revision:a,state:d,writable:ns(r.writable,"Settings writable"),hasDocument:ns(r.hasDocument,"Settings document availability"),workspace:Nt(r.workspace,"Settings workspace"),sections:{appearance:{style:o===1?dg(d,ns(r.writable,"Settings writable")):Xr(p.style,"Visual style",ug),theme:Xr(p.theme,"Theme",cg),motion:Xr(p.motion,"Motion",fg)},defaults:{model:Xr(g.model,"Default model",mg),effort:Xr(g.effort,"Default effort",pg)},permissions:{toolConfirmation:Xr(x.toolConfirmation,"Tool confirmation",hg)}},models:w,credentials:E,...S?{currentSession:S}:{},...P?{diagnostic:P}:{}}}function ng(n){bo(n);const r=Bt(n,"Settings mutation result");qt(r,["requestId","revision","appliedKeys","settings"]);const o=Nt(r.requestId,"Settings requestId");if(!Um.test(o))throw new Error("Settings requestId is invalid.");const a=$a(r.settings),d=Nt(r.revision,"Settings mutation revision");if(d!==a.revision)throw new Error("Settings mutation revisions do not match.");const f=La(r.appliedKeys,"Applied setting keys").map((p,g)=>tn(p,`Applied setting key ${g+1}`,tg));if(new Set(f).size!==f.length)throw new Error("Settings mutation contains duplicate applied keys.");return{requestId:o,revision:d,appliedKeys:f,settings:a}}function rg(n){const r=Bt(n.payload,"Settings invalidation payload");qt(r,["revision","reason","state"]);const o=Nt(r.revision,"Settings invalidation revision");if(!qf.test(o))throw new Error("Settings invalidation revision is invalid.");return{apiVersion:1,eventId:Nt(n.eventId,"Settings invalidation eventId"),cursor:ag(n.cursor,"Settings invalidation cursor"),sessionId:null,threadId:null,durable:!1,timestamp:Nt(n.timestamp,"Settings invalidation timestamp"),type:"settings_invalidated",payload:{revision:o,reason:tn(r.reason,"Settings invalidation reason",["local-write","external-edit","workspace-change"]),state:tn(r.state,"Settings invalidation state",["ready","invalid"])}}}function Xr(n,r,o){const a=Bt(n,`${r} field`);if(qt(a,["effectiveValue","explicitValue","inheritedValue","source","scope","applies","overridden","writable","blockedReason"]),!o(a.effectiveValue))throw new Error(`${r} effective value is invalid.`);if(a.explicitValue!==void 0&&!o(a.explicitValue))throw new Error(`${r} explicit value is invalid.`);if(a.inheritedValue!==void 0&&!o(a.inheritedValue))throw new Error(`${r} inherited value is invalid.`);const d=a.explicitValue,f=a.inheritedValue;return{effectiveValue:a.effectiveValue,...d===void 0?{}:{explicitValue:d},...f===void 0?{}:{inheritedValue:f},source:tn(a.source,`${r} source`,Km),scope:tn(a.scope,`${r} scope`,Gm),applies:tn(a.applies,`${r} application timing`,Qm),overridden:ns(a.overridden,`${r} override state`),writable:ns(a.writable,`${r} writable state`),...a.blockedReason===void 0?{}:{blockedReason:tn(a.blockedReason,`${r} blocked reason`,Ym)}}}function sg(n,r){const o=Bt(n,`Model ${r+1}`);return qt(o,["id","label","provider"]),{id:Nt(o.id,`Model ${r+1} id`),label:Nt(o.label,`Model ${r+1} label`),...o.provider===void 0?{}:{provider:Nt(o.provider,`Model ${r+1} provider`)}}}function ig(n,r){const o=Bt(n,`Credential ${r+1}`);if(qt(o,["providerId","state","source","writable"]),o.writable!==!1)throw new Error("Browser credential status must be read-only.");return{providerId:Nt(o.providerId,`Credential ${r+1} provider`),state:tn(o.state,`Credential ${r+1} state`,["ready","missing","unavailable"]),source:tn(o.source,`Credential ${r+1} source`,["environment","legacy","none"]),writable:!1}}function og(n){const r=Bt(n,"Current session settings");return qt(r,["model","effort","overridesProjectEffort"]),{model:Nt(r.model,"Current session model"),effort:tn(r.effort,"Current session effort",Uf),overridesProjectEffort:ns(r.overridesProjectEffort,"Current session effort override state")}}function lg(n){const r=Bt(n,"Settings diagnostic");return qt(r,["code","message"]),{code:Nt(r.code,"Settings diagnostic code"),message:Nt(r.message,"Settings diagnostic message")}}function bo(n,r=new Set){if(!(!n||typeof n!="object")){if(r.has(n))throw new Error("Settings response contains a cycle.");r.add(n);try{if(Array.isArray(n)){for(const o of n)bo(o,r);return}for(const[o,a]of Object.entries(n)){if(Hm.test(o))throw new Error("Settings response contains a forbidden secret-bearing field.");bo(a,r)}}finally{r.delete(n)}}}function Bt(n,r){if(!n||typeof n!="object"||Array.isArray(n))throw new Error(`${r} must be an object.`);return n}function La(n,r){if(!Array.isArray(n))throw new Error(`${r} must be an array.`);return n}function Nt(n,r){if(typeof n!="string"||!n.trim())throw new Error(`${r} must be text.`);return n}function ns(n,r){if(typeof n!="boolean")throw new Error(`${r} must be boolean.`);return n}function ag(n,r){if(!Number.isSafeInteger(n)||n<0)throw new Error(`${r} must be a non-negative safe integer.`);return n}function tn(n,r,o){if(typeof n!="string"||!o.includes(n))throw new Error(`${r} is invalid.`);return n}function qt(n,r){const o=new Set(r),a=Object.keys(n).find(d=>!o.has(d));if(a)throw new Error(`Settings response contains an unknown field: ${a}.`)}function cg(n){return typeof n=="string"&&Xm.includes(n)}function ug(n){return typeof n=="string"&&Zm.includes(n)}function dg(n,r){const o=n==="invalid"?"invalid_document":n==="ready"&&r?void 0:"read_only";return{effectiveValue:"orion-blocksmith",inheritedValue:"orion-blocksmith",source:"internal",scope:"global",applies:"live",overridden:!1,writable:n==="ready"&&r,...o?{blockedReason:o}:{}}}function fg(n){return typeof n=="string"&&Jm.includes(n)}function pg(n){return typeof n=="string"&&Uf.includes(n)}function hg(n){return typeof n=="string"&&eg.includes(n)}function mg(n){return typeof n=="string"&&!!n.trim()}const fo="/api/v1",gg="x-orion-web-nonce",Da=100,vg=50,dn=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;class Ie extends Error{constructor(o,a,d,f){super(o);Ft(this,"status");Ft(this,"code");Ft(this,"type");this.status=a,this.code=d,this.type=f,this.name="WebApiError"}}class yg{constructor(){Ft(this,"nonce","")}async bootstrap(){const r=await this.query("/bootstrap");if(!In(r)||r.apiVersion!==1||typeof r.nonce!="string")throw new Ie("Web Host 返回了不兼容的启动协议。",502);return this.nonce=r.nonce,{...r,settings:$a(r.settings)}}async listWorkspaces(r,o){const a=await this.collectionPage(jt("/workspaces",r),o),d=a.items.find(f=>f.active);return{activeId:d?.id??"",activePath:d?.path??"",workspaces:a.items,nextCursor:a.nextCursor}}async listWorkspaceSessions(r,o,a){const d=await this.collectionPage(jt(`/workspaces/${encodeURIComponent(r)}/sessions`,o),a);return{sessions:d.items,nextCursor:d.nextCursor}}workspaceProjectSummary(r,o){return this.query(jt(`/workspaces/${encodeURIComponent(r)}/summary`,o))}async listSessions(r,o){const a=await this.collectionPage(jt("/sessions",r),o);return{sessions:a.items,nextCursor:a.nextCursor}}diagnostics(r){return this.query(jt("/diagnostics",r))}async settings(){return $a(await this.query("/settings"))}async sessionSnapshot(r,o,a){const d=`/sessions/${encodeURIComponent(r)}/snapshot`;return this.query(Ia(jt(d,o),a??null,!0,vg))}composerState(r,o){return this.query(jt(`/sessions/${encodeURIComponent(r)}/composer-state`,o))}modelCatalog(r,o,a){return this.query(Ia(jt(`/sessions/${encodeURIComponent(r)}/model-catalog`,o),a??null,!1,Da))}composerAction(r,o){return this.mutate(`/sessions/${encodeURIComponent(r)}/composer-actions`,"POST",{...o,requestId:ze()})}async skills(r,o){const a=await this.collectionPage(jt("/skills",r),o);return{skills:a.items,nextCursor:a.nextCursor}}async mcp(r,o){const a=await this.collectionPage(jt("/mcp",r),o);return{servers:a.items,nextCursor:a.nextCursor}}async toolDetails(r,o){const a=await this.collectionPage(jt("/tool-details",r),o);return{details:a.items,nextCursor:a.nextCursor}}readToolDetail(r,o,a=0,d=64*1024){const f=new URLSearchParams({offsetBytes:String(a),limitBytes:String(d)});return Zn(f,o),this.query(`/tool-details/${encodeURIComponent(r)}?${f.toString()}`)}listFiles(r,o,a){const d=new URLSearchParams({pageSize:"100"});return Zn(d,r),o&&d.set("parentId",o),a&&d.set("cursor",a),this.query(`/files?${d.toString()}`)}readFileContent(r,o,a){const d=new URLSearchParams({limitBytes:String(65536)});return Zn(d,o),a&&d.set("cursor",a),this.query(`/files/${encodeURIComponent(r)}/content?${d.toString()}`)}writeFileContent(r,o,a,d){return this.mutate("/files/write","POST",{...r,fileId:o,content:a,expectedRevision:d,requestId:ze()},{"X-Orion-User-Gesture":"file-mutation-v1"})}gitStatus(r,o){const a=new URLSearchParams({pageSize:"200"});return Zn(a,r),o&&a.set("cursor",o),this.query(`/git/status?${a.toString()}`)}gitLog(r,o){const a=new URLSearchParams({pageSize:"30"});return Zn(a,r),o&&a.set("cursor",o),this.query(`/git/log?${a.toString()}`)}gitDiff(r,o,a){const d=new URLSearchParams({lineLimit:"240",byteLimit:String(262144)});return Zn(d,o),a&&d.set("cursor",a),this.query(`/git/diff/${encodeURIComponent(r)}?${d.toString()}`)}review(r){return this.query(jt("/review",r))}async terminals(r,o){const a=await this.collectionPage(jt("/terminals",r),o);return{terminals:a.items,nextCursor:a.nextCursor}}createTerminal(r){return this.mutate("/terminals","POST",{...r,requestId:ze()},{"X-Orion-User-Gesture":"terminal-create-v1"})}terminalAttachTicket(r,o){return this.mutate(`/terminals/${encodeURIComponent(r)}/attach-ticket`,"POST",{...o,requestId:ze()})}closeTerminal(r,o){return this.mutate(`/terminals/${encodeURIComponent(r)}`,"DELETE",{...o,requestId:ze()})}terminalSocket(r){const o=location.protocol==="https:"?"wss:":"ws:";return new WebSocket(`${o}//${location.host}${fo}/terminals/${encodeURIComponent(r)}/stream`,"orion-terminal-v1")}async searchFiles(r,o,a,d=50){const f=new URLSearchParams({q:o.slice(0,200),scope:a,limit:String(d)});return Zn(f,r),this.query(`/files/search?${f.toString()}`)}gitStage(r,o,a){return this.mutate("/git/stage","POST",{...r,fileIds:o,expectedRepositoryRevision:a,requestId:ze()},{"X-Orion-User-Gesture":"git-mutation-v1"})}gitUnstage(r,o,a){return this.mutate("/git/unstage","POST",{...r,fileIds:o,expectedRepositoryRevision:a,requestId:ze()},{"X-Orion-User-Gesture":"git-mutation-v1"})}gitCommit(r,o,a){return this.mutate("/git/commit","POST",{...r,message:o,expectedRepositoryRevision:a,requestId:ze()},{"X-Orion-User-Gesture":"git-mutation-v1"})}activateContext(r){return this.mutate("/context/activate","POST",{...r,requestId:ze()})}async setWorkspacePinned(r,o,a){return(await this.mutate(`/workspaces/${encodeURIComponent(r)}/pin`,"POST",{requestId:ze(),pinned:o,...a})).workspace}removeWorkspace(r,o){return this.mutate(`/workspaces/${encodeURIComponent(r)}`,"DELETE",{requestId:ze(),...o})}async activateWorkspace(r,o){const a=await this.mutate("/workspaces/activate","POST",{requestId:ze(),path:r,...o});return{requestId:a.requestId,activeId:a.page.items.find(d=>d.active)?.id??"",activePath:a.active,workspaces:a.page.items,nextCursor:a.page.nextCursor}}async createSession(r){return(await this.mutate("/sessions","POST",{requestId:ze(),...r})).session}activateSession(r,o){return this.mutate(`/sessions/${encodeURIComponent(r)}/activate`,"POST",{requestId:ze(),...o})}async renameSession(r,o,a){return(await this.mutate(`/sessions/${encodeURIComponent(r)}`,"PATCH",{requestId:ze(),name:o,...a})).session}async updateSessionTags(r,o,a){return(await this.mutate(`/sessions/${encodeURIComponent(r)}/tags`,"POST",{requestId:ze(),tags:[...o],...a})).session}async archiveSession(r,o){return(await this.mutate(`/sessions/${encodeURIComponent(r)}/archive`,"POST",{requestId:ze(),...o})).session}async restoreSession(r,o){return(await this.mutate(`/sessions/${encodeURIComponent(r)}/restore`,"POST",{requestId:ze(),...o})).session}async deleteSession(r,o){await this.mutate(`/sessions/${encodeURIComponent(r)}`,"DELETE",{requestId:ze(),...o})}async listArchivedWorkspaceSessions(r,o,a){const d=await this.collectionPage(jt(`/workspaces/${encodeURIComponent(r)}/sessions/archived`,o),a);return{sessions:d.items,nextCursor:d.nextCursor}}command(r){return this.mutate("/commands","POST",{...r,requestId:ze()})}async updateSettings(r,o,a,d=ze()){const f=await this.mutate("/settings","PATCH",{operations:o,expectedRevision:r,...a,requestId:d}),p=ng(f);if(p.requestId!==d)throw new Ie("Host 返回了其他设置请求的结果。",502,"settings_response_invalid");const g=o.map(x=>x.key);if(p.appliedKeys.length!==g.length||g.some(x=>!p.appliedKeys.includes(x)))throw new Ie("Host 返回的设置字段与提交内容不一致。",502,"settings_response_invalid");return p}openSettingsDocument(){return this.mutate("/settings/open-document","POST",{requestId:ze()})}connectEvents(r){let o=Math.max(0,r.cursor??0),a=null,d,f=0,p=!1,g=!1;const x=()=>{if(!(p||g)){if(!navigator.onLine){r.onStatus("offline",f);return}r.onStatus(f===0?"connecting":"reconnecting",f),a=new EventSource(`${fo}/events?cursor=${o}`),a.onopen=()=>{f=0,r.onStatus("live",f)},a.addEventListener("orion",S=>{if(!(p||g))try{const P=xg(S.data);if(P.type==="replay_reset"){o=P.cursor,r.onEvent(P),g=!0,a?.close(),a=null,window.clearTimeout(d);return}if(P.cursor<=o)return;o=P.cursor,r.onEvent(P)}catch(P){r.onProtocolError?.(P instanceof Error?P.message:"无法解析 Web Host 事件流消息。")}}),a.onerror=()=>{if(a?.close(),a=null,p||g)return;f+=1,r.onStatus(navigator.onLine?"reconnecting":"offline",f);const S=Math.min(1e4,500*2**Math.min(f,5));window.clearTimeout(d),d=window.setTimeout(x,S)}}},w=()=>{p||g||a||(window.clearTimeout(d),x())},E=()=>{window.clearTimeout(d),a?.close(),a=null,!g&&r.onStatus("offline",f)};return window.addEventListener("online",w),window.addEventListener("offline",E),x(),{close(){p=!0,window.clearTimeout(d),a?.close(),a=null,window.removeEventListener("online",w),window.removeEventListener("offline",E)},cursor:()=>o}}collectionPage(r,o){return this.query(Ia(r,o??null,!1,Da))}async query(r){const o=await fetch(`${fo}${r}`,{method:"GET",headers:{Accept:"application/json"},credentials:"same-origin",cache:"no-store"});return Hd(o)}async mutate(r,o,a,d={}){if(!this.nonce)throw new Ie("Web Workbench 尚未完成安全握手。",503);const f=await fetch(`${fo}${r}`,{method:o,headers:{Accept:"application/json","Content-Type":"application/json",[gg]:this.nonce,...d},credentials:"same-origin",cache:"no-store",body:JSON.stringify(a)});return Hd(f)}}async function Hd(n){const o=(n.headers.get("content-type")??"").includes("json")?await n.json().catch(()=>null):null;if(!n.ok){const a=In(o)?o:{},d=typeof a.detail=="string"?a.detail:`请求失败 (${n.status})`;throw new Ie(d,n.status,typeof a.code=="string"?a.code:void 0,typeof a.type=="string"?a.type:void 0)}return o}function xg(n){const r=JSON.parse(n);if(!In(r)||r.apiVersion!==1||typeof r.eventId!="string"||!dn.test(r.eventId)||!Number.isSafeInteger(r.cursor)||r.cursor<0||r.sessionId!==null&&typeof r.sessionId!="string"||r.threadId!==null&&typeof r.threadId!="string"||typeof r.durable!="boolean"||typeof r.timestamp!="string"||!["runtime_event","thread_event","workbench_state","replay_reset","settings_invalidated","workspace_resource_invalidated","composer_state_changed","session_runtime_changed","workspace_mutation_changed"].includes(String(r.type))||!In(r.payload))throw new Error("Web Host 事件流消息不符合 Web protocol v1。");if(r.type==="runtime_event"){const o=r.payload.value;if(!In(o)||typeof r.payload.eventType!="string"||o.type!==r.payload.eventType)throw new Error("Web Host 事件流消息判别字段不一致。")}if(r.type==="thread_event"&&(!In(r.payload.value)||typeof r.payload.eventType!="string"||!Number.isSafeInteger(r.payload.sequence)||typeof r.sessionId!="string"||typeof r.threadId!="string"))throw new Error("Thread 事件身份或序列无效。");if(r.type==="workbench_state"&&(typeof r.payload.contextRevision!="string"||!dn.test(r.payload.contextRevision)||typeof r.payload.workspaceId!="string"||!dn.test(r.payload.workspaceId)||typeof r.payload.workspace!="string"||r.payload.activeSessionId!==null&&typeof r.payload.activeSessionId!="string"))throw new Error("Workbench 状态事件无效。");if(r.type==="settings_invalidated"&&(r.sessionId!==null||r.threadId!==null||r.durable!==!1))throw new Error("Settings invalidation 事件身份无效。");if(r.type==="settings_invalidated")return rg(r);if(r.type==="session_runtime_changed"&&(!In(r.payload.runtime)||r.sessionId!==r.payload.runtime.sessionId||!wg(r.payload.runtime)))throw new Error("Session Runtime 状态事件无效。");if(r.type==="workspace_mutation_changed"){const o=r.payload.state;if(typeof r.sessionId!="string"||r.durable!==!1||!In(o)||typeof o.callId!="string"||o.callId.length<1||!["queued","running","completed","failed","cancelled"].includes(String(o.phase))||(o.phase==="queued"?!Number.isSafeInteger(o.queuePosition)||o.queuePosition<1:o.queuePosition!==void 0))throw new Error("Workspace mutation 状态事件无效。")}if(r.type==="workspace_resource_invalidated"&&(r.sessionId!==null||r.threadId!==null||r.durable!==!1||typeof r.payload.workspaceId!="string"||!dn.test(r.payload.workspaceId)||!Array.isArray(r.payload.resources)||r.payload.resources.length<1||r.payload.resources.some(o=>!["files","git","review"].includes(String(o)))||!["context-change","filesystem-change","terminal-command","tool-finished"].includes(String(r.payload.reason))))throw new Error("Workspace resource invalidation 事件无效。");if(r.type==="composer_state_changed"&&(typeof r.sessionId!="string"||r.durable!==!0||!In(r.payload.state)||r.payload.state.apiVersion!==1||r.payload.state.sessionId!==r.sessionId||typeof r.payload.state.controlRevision!="string"||!dn.test(r.payload.state.controlRevision)||typeof r.payload.state.contextRevision!="string"||!dn.test(r.payload.state.contextRevision)))throw new Error("Composer state 事件身份无效。");if(r.type==="replay_reset"&&(typeof r.payload.reason!="string"||r.payload.snapshotRequired!==!0))throw new Error("Replay reset 事件无效。");return r}function wg(n){const r=n.phase==="queued";return typeof n.workspaceId=="string"&&dn.test(n.workspaceId)&&typeof n.sessionId=="string"&&dn.test(n.sessionId)&&typeof n.runtimeRevision=="string"&&dn.test(n.runtimeRevision)&&["cold","starting","idle","queued","running","waiting_approval","stopping","interrupted","failed"].includes(String(n.phase))&&Number.isSafeInteger(n.pendingApprovalCount)&&n.pendingApprovalCount>=0&&typeof n.resident=="boolean"&&Number.isSafeInteger(n.estimatedBytes)&&n.estimatedBytes>=0&&typeof n.updatedAt=="string"&&(r?typeof n.queueId=="string"&&dn.test(n.queueId)&&Number.isSafeInteger(n.queuePosition)&&n.queuePosition>=1:n.queueId===void 0&&n.queuePosition===void 0)}function Ia(n,r=null,o=!1,a=Da){const d=new URLSearchParams({pageSize:String(a)});return r&&d.set("cursor",r),o&&d.set("tail","1"),`${n}${n.includes("?")?"&":"?"}${d.toString()}`}function Zn(n,r){n.set("expectedContextRevision",r.expectedContextRevision),n.set("workspaceId",r.workspaceId)}function jt(n,r){const o=new URLSearchParams;return Zn(o,r),`${n}${n.includes("?")?"&":"?"}${o.toString()}`}function In(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}function ze(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const n=crypto.getRandomValues(new Uint8Array(16));n[6]=n[6]&15|64,n[8]=n[8]&63|128;const r=[...n].map(o=>o.toString(16).padStart(2,"0")).join("");return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`}function kg({state:n,actions:r,insertion:o}){const a=n.workspaceId,d=n.activeSessionId??"",[f,p]=m.useState({workspaceId:a,sessionId:d,text:"",references:[]}),[g,x]=m.useState(null),[w,E]=m.useState(""),[S,P]=m.useState(new Set),R=m.useRef(null),$=`${a}:${d}`,O=m.useRef($);O.current=$;const F=`${f.workspaceId}:${f.sessionId}`,te=!d||!n.bootstrap?.configured||n.connection!=="live"||!jr(n),L=!!n.pendingAction,ye=n.sessionSnapshot?.sessionRuntime.phase==="queued",J=!te&&!L,ne=J&&!ye;m.useEffect(()=>{if(!a||!d){p({workspaceId:a,sessionId:d,text:"",references:[]});return}const ee=Wm(a,d);p({workspaceId:a,sessionId:d,text:ee?.text??"",references:ee?.references??[]}),E(""),P(new Set)},[a,d]),m.useEffect(()=>{if(!(!f.workspaceId||!f.sessionId))try{f.text||f.references.length>0?Fm(f):Ud(f.workspaceId,f.sessionId),E("")}catch(ee){E(ee instanceof Error?ee.message:"草稿无法保存。")}},[f]),m.useEffect(()=>{!o||!d||F!==$||(p(ee=>({...ee,text:ee.text.trim()?`${ee.text.trimEnd()}
15
+
16
+ ${o.text}`:o.text})),requestAnimationFrame(()=>R.current?.focus()))},[$,F,o,d]);const N=F===$?f.text:"",D=F===$?f.references:[],Z=ee=>p(Ce=>({...Ce,workspaceId:a,sessionId:d,text:ee})),X=ee=>{const Ce=new Set(ee.map(Ys));P(A=>new Set([...A].filter(me=>Ce.has(me)))),p(A=>({...A,workspaceId:a,sessionId:d,references:ee}))},ie=async ee=>{const Ce=N.trim();if(!Ce||!ne)return;const A=$;try{ee==="queue"?await r.queue(Ce,D):await r.submit(Ce,D),Ud(a,d),P(new Set),O.current===A&&p({workspaceId:a,sessionId:d,text:"",references:[]}),R.current?.focus()}catch(me){me instanceof Ie&&["context_reference_stale","context_reference_forbidden"].includes(me.code??"")&&P(new Set(D.map(Ys))),E(me instanceof Error?me.message:"发送失败,草稿已保留。"),R.current?.focus()}},G=ee=>{ee.preventDefault(),ie(n.processing?"queue":"submit")},je=ee=>{ee.key!=="Enter"||ee.shiftKey||ee.nativeEvent.isComposing||(ee.preventDefault(),n.processing&&(ee.metaKey||ee.ctrlKey)?ie("submit"):ie(n.processing?"queue":"submit"))};return i.jsxs("div",{className:"composer-control-center",children:[n.composer?.planReview?.status==="awaiting_review"?i.jsx(_g,{state:n,actions:r}):null,D.length>0?i.jsx(bg,{references:D,invalidReferenceKeys:S,onChange:X}):null,i.jsxs("form",{className:"composer composer-v032",onSubmit:G,children:[i.jsx("label",{htmlFor:"orion-composer",className:"sr-only",children:"发送给 Orion"}),i.jsx("textarea",{ref:R,id:"orion-composer",rows:3,maxLength:1e6,value:N,onChange:ee=>Z(ee.target.value),onKeyDown:je,placeholder:L?"正在同步会话控制状态…":ye?`任务正在排队${n.sessionSnapshot?.sessionRuntime.queuePosition?`(第 ${n.sessionSnapshot.sessionRuntime.queuePosition} 位)`:""}`:te?"选择会话并配置模型后开始":n.processing?"输入后续消息;Enter 排队,⌘/Ctrl+Enter Steer":"描述任务,或输入 / 查看命令…",disabled:!ne}),i.jsxs("div",{className:"composer-toolbar composer-control-toolbar",children:[i.jsxs("div",{className:"composer-controls composer-control-row",children:[i.jsx(Ng,{state:n,actions:r,disabled:!ne,references:D,onChange:X,onInsertCommand:()=>Z(N.trim()?`${N.trimEnd()}
17
+ /`:"/")}),i.jsx(za,{label:Rg(n),accessibleLabel:"工作模式",disabled:!ne,value:n.composer?.mode.baseMode??n.mode.baseMode,options:[{value:"interactive",label:"BUILD",detail:"执行、修改并验证当前任务"},{value:"plan",label:"PLAN",detail:"生成计划并等待你的审核"},{value:"auto",label:"AUTO",detail:"自主执行,仍受权限与沙箱约束"}],onSelect:ee=>{ee==="auto"?x("auto"):Ct(r.setMode(ee))}}),i.jsx(za,{label:Tg(n),accessibleLabel:"会话权限",disabled:!ne,value:n.composer?.permission.override??"inherit",options:[{value:"inherit",label:"继承项目",detail:`当前 ${n.composer?.permission.projectDefault??"ask"}`},{value:"ask",label:"ASK",detail:"高风险工具逐次请求批准"},{value:"allow",label:"ALLOW",detail:"允许策略许可的工具,不绕过沙箱"},{value:"deny",label:"DENY",detail:"拒绝需要授权的工具"}],onSelect:ee=>{ee==="allow"?x("allow"):Ct(r.setPermissionOverride(ee==="inherit"?null:ee))}})]}),i.jsxs("div",{className:"composer-actions composer-control-actions",children:[i.jsx(jg,{state:n,actions:r,disabled:!ne}),i.jsx(Cg,{state:n,actions:r,disabled:!ne}),n.processing?i.jsxs(i.Fragment,{children:[i.jsxs("button",{type:"button",className:"icon-text-button stop-button",onClick:()=>Ct(r.interrupt()),disabled:!ne,children:[i.jsx(Q,{name:"stop",size:14}),"停止"]}),i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{ie("submit")},disabled:!N.trim()||!ne,children:"Steer"})]}):null,ye?i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>Ct(r.cancelQueuedTurn()),disabled:!J,children:"取消排队"}):null,i.jsx("button",{type:"submit",className:"send-button composer-send-icon","aria-label":n.processing?"加入消息队列":"发送消息",disabled:!ne||!N.trim(),children:i.jsx(Q,{name:"arrow-up",size:17})})]})]}),D.length>0||w||n.composer?.lastError?i.jsxs("div",{className:"composer-footline",children:[D.length>0?i.jsxs("span",{children:[D.length," 个 Context 引用"]}):null,w?i.jsx("span",{role:"alert",children:w}):n.composer?.lastError?i.jsx("span",{role:"alert",children:n.composer.lastError.message}):null]}):null]}),g?i.jsx(Ig,{kind:g,onCancel:()=>x(null),onConfirm:()=>{const ee=g;x(null),Ct(ee==="auto"?r.setMode("auto"):r.setPermissionOverride("allow"))}}):null]})}function jg({state:n,actions:r,disabled:o}){const a=n.composer?.model,d=["auto",...a?.effort.supportedLevels??[]];return i.jsxs("div",{className:"model-control-cluster",children:[i.jsx(Sg,{state:n,actions:r,disabled:o}),a?.effort.supported?i.jsx(za,{label:n.composer?.pending.model?`${po(a.effort.requested)} → ${po(n.composer.pending.model.effort)}`:po(a.effort.requested),accessibleLabel:"推理强度",disabled:o,value:a.effort.requested,options:d.map(f=>({value:f,label:po(f),detail:f==="auto"?"采用模型或项目默认值":`请求 ${f} reasoning effort`})),onSelect:f=>Ct(r.selectModel(a.modelId,f))}):null]})}function Sg({state:n,actions:r,disabled:o}){const[a,d]=m.useState(!1),[f,p]=m.useState(""),g=m.useRef(null),x=m.useRef(null),w=m.useRef(null),E=n.composer?.model,S=n.modelCatalog,P=n.composer?.pending.model?`${E?.modelId??"模型"} → ${n.composer.pending.model.modelId}`:E?.modelId??"模型",R=f.trim().toLowerCase(),$=new Set((S?.unavailableProviders??[]).map(L=>L.id)),O=(S?.items??[]).filter(L=>!$.has(L.providerId)).filter(L=>[L.id,L.label,L.providerId,L.providerLabel].some(ye=>ye.toLowerCase().includes(R))).slice(0,80),F=new Map;for(const L of O){const ye=L.providerLabel||L.providerId;F.set(ye,[...F.get(ye)??[],L])}const te=()=>{d(!1),p(""),x.current?.focus()};return Lo(a,g,te),i.jsxs("div",{className:"control-menu",ref:g,children:[i.jsxs("button",{ref:x,type:"button",className:"composer-control-trigger","aria-label":"会话模型","aria-haspopup":"menu","aria-expanded":a,disabled:o,onClick:()=>{a?te():(d(!0),S||Ct(r.loadModelCatalog()))},children:[i.jsx("span",{children:P}),i.jsx(Q,{name:"chevron",size:12})]}),a?i.jsxs("div",{className:"control-menu-popover model-catalog-popover",role:"menu","aria-label":"会话模型",ref:w,onKeyDown:L=>Ya(L,te),children:[(S?.items.length??0)>8?i.jsxs("label",{className:"model-catalog-search",children:[i.jsx("span",{className:"sr-only",children:"筛选模型"}),i.jsx("input",{type:"search",value:f,placeholder:"筛选模型…",onChange:L=>p(L.target.value),onKeyDown:L=>{L.key==="ArrowDown"?(L.preventDefault(),Hf(w.current)):L.key==="Escape"&&(L.stopPropagation(),te())}})]}):null,S===null?i.jsx("p",{role:"status",children:"正在加载模型…"}):null,S&&O.length===0?i.jsx("p",{children:"没有匹配的可用模型"}):null,[...F.entries()].map(([L,ye])=>i.jsxs("section",{role:"group","aria-label":L,children:[i.jsx("div",{className:"model-provider-heading",children:L}),ye.map(J=>i.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":J.id===E?.modelId,onClick:()=>{te(),Ct(r.selectModel(J.id))},children:[i.jsxs("span",{children:[i.jsx("strong",{children:J.label}),i.jsxs("small",{children:[es(J.contextWindow)," context",J.reasoning?" · reasoning":""]})]}),J.id===E?.modelId?i.jsx(Q,{name:"check",size:14}):null]},J.id))]},L)),S?.unavailableProviders.map(L=>i.jsxs("section",{role:"group","aria-label":`${L.id} 不可用`,children:[i.jsxs("div",{className:"model-provider-heading state-error",children:[L.id," · 不可用"]}),i.jsx("p",{children:L.reason}),i.jsx("button",{type:"button",role:"menuitem",onClick:()=>Ct(r.loadModelCatalog()),children:"Retry"})]},L.id)),(S?.items.length??0)>80&&!R?i.jsx("p",{children:"显示前 80 项;输入关键词继续筛选。"}):null]}):null]})}function Cg({state:n,actions:r,disabled:o}){const[a,d]=m.useState(!1),f=m.useRef(null),p=m.useRef(null),g=n.composer?.contextUsage,x=g?Math.max(0,Math.min(100,g.percent)):null,w=g?.source==="estimated",E=!!(g&&g.percent>=g.warningThresholdPercent);return Lo(a,f,()=>{d(!1),p.current?.focus()}),i.jsxs("div",{className:"context-meter-wrap",ref:f,children:[i.jsxs("button",{ref:p,type:"button",className:"context-meter-button","aria-label":g?`Context ${w?"估算 ":""}${g.usedTokens} / ${g.safeInputBudget??g.contextWindow} tokens,${g.percent}%${E?",接近压缩阈值":""}`:"Context 用量不可用","aria-haspopup":"dialog","aria-expanded":a,disabled:o,onClick:()=>d(S=>!S),children:[i.jsx("span",{className:"context-meter-ring",style:{"--context-percent":`${x??0}%`},"aria-hidden":"true"}),i.jsx("span",{children:g?`${w?"~":""}${g.percent}%${E?" !":""}`:"Context"})]}),a?i.jsxs("section",{className:"context-popover",role:"dialog","aria-label":"Context 用量详情",children:[i.jsxs("header",{children:[i.jsx("strong",{children:"Context"}),i.jsx("button",{type:"button",className:"icon-button",onClick:()=>d(!1),"aria-label":"关闭 Context 详情",children:i.jsx(Q,{name:"close",size:14})})]}),g?i.jsxs("dl",{children:[i.jsxs("div",{children:[i.jsx("dt",{children:"当前模型"}),i.jsx("dd",{children:g.modelId})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"已使用"}),i.jsx("dd",{children:es(g.usedTokens)})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"安全输入预算"}),i.jsx("dd",{children:es(g.safeInputBudget??g.contextWindow)})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"原始窗口"}),i.jsx("dd",{children:es(g.contextWindow)})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"输出预留"}),i.jsx("dd",{children:es(g.reservedOutputTokens??0)})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"安全余量"}),i.jsx("dd",{children:es(g.safetyMarginTokens??0)})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"来源"}),i.jsx("dd",{children:g.source==="estimated"?"估算 ~":g.source})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"警告阈值"}),i.jsxs("dd",{children:[g.warningThresholdPercent,"%"]})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"自动压缩"}),i.jsx("dd",{children:g.autoCompactEnabled?`${g.autoCompactThresholdPercent}%`:"关闭"})]})]}):i.jsx("p",{children:"Runtime 尚未提供当前模型的 Context 计数。"}),n.composer?.compactAvailable?i.jsx("button",{type:"button",className:"secondary-button",disabled:!g||n.processing,onClick:()=>Ct(r.compactContext()),children:"立即压缩"}):null]}):null]})}function Ng({state:n,actions:r,disabled:o,references:a,onChange:d,onInsertCommand:f}){const[p,g]=m.useState(!1),[x,w]=m.useState("root"),[E,S]=m.useState([]),[P,R]=m.useState(!1),[$,O]=m.useState(""),F=m.useRef(null),te=m.useRef(null);Lo(p,F,()=>g(!1));const L=N=>{a.some(D=>D.kind===N.kind&&D.id===N.id)||d([...a,N]),g(!1),w("root")},ye=async()=>{w("files"),R(!0),O("");try{const N=await r.listFiles();S(N.items.filter(D=>D.readable&&!D.sensitive))}catch(N){O(N instanceof Error?N.message:"文件列表加载失败。")}finally{R(!1)}},J=async N=>{R(!0),O("");try{if(Kd(N)){const D=await r.listFiles(N.id);L({kind:"folder",id:N.id,label:N.name,revision:D.revision})}else if(Mg(N)){const D=await r.readFileContent(N.id);if(D.binary||D.sensitive)throw new Error("该文件不能加入模型 Context。");L({kind:"file",id:N.id,label:N.name,revision:D.revision})}}catch(D){O(D instanceof Error?D.message:"Context 引用加载失败。")}finally{R(!1)}},ne=async()=>{R(!0);try{const N=await r.review();L({kind:"review",id:"working-tree",label:N.truncated?`Review · ${N.totalChangedFiles} files · ${N.changedFiles.length} visible`:`Review · ${N.totalChangedFiles} files`,gitRevision:N.repositoryRevision})}catch(N){O(N instanceof Error?N.message:"Review Context 加载失败。")}finally{R(!1)}};return i.jsxs("div",{className:"control-menu context-launcher",ref:F,children:[i.jsx("button",{type:"button",className:"context-add-button","aria-label":"添加 Context","aria-haspopup":"menu","aria-expanded":p,disabled:o,onClick:()=>{const N=!p;g(N),N&&requestAnimationFrame(()=>Hf(te.current))},children:i.jsx(Q,{name:"add",size:17})}),p?i.jsxs("div",{className:"control-menu-popover context-launcher-menu",role:"menu","aria-label":"添加 Context",ref:te,onKeyDown:N=>Ya(N,()=>g(!1)),children:[x!=="root"?i.jsx("button",{type:"button",role:"menuitem",onClick:()=>w("root"),children:"← 返回"}):null,x==="root"?i.jsxs(i.Fragment,{children:[i.jsx(_n,{label:"文件或目录",detail:"Workspace 内受控读取",onClick:()=>{ye()}}),i.jsx(_n,{label:"当前 Review",detail:"绑定 exact Git revision",onClick:()=>{ne()}}),i.jsx(_n,{label:"历史 Session",detail:"引用受控摘要",onClick:()=>w("sessions")}),i.jsx(_n,{label:"Skill",detail:"绑定已加载能力 digest",onClick:()=>w("skills")}),i.jsx(_n,{label:"命令",detail:"插入 / 命令入口",onClick:()=>{f(),g(!1)}}),a.length>0?i.jsx(_n,{label:"清除 Context",detail:"移除当前草稿全部引用",onClick:()=>{d([]),g(!1)}}):null]}):null,x==="files"?E.map(N=>i.jsx(_n,{label:N.name,detail:Kd(N)?"目录":`${N.sizeBytes??0} bytes`,onClick:()=>{J(N)}},N.id)):null,x==="sessions"?n.sessions.filter(N=>N.id!==n.activeSessionId).map(N=>i.jsx(_n,{label:N.name||`Session ${N.id.slice(0,8)}`,detail:`${N.messageCount} 条消息`,onClick:()=>L({kind:"session",id:N.id,label:N.name||`Session ${N.id.slice(0,8)}`,digest:N.contextDigest})},N.id)):null,x==="skills"?n.skills.filter(N=>N.userInvocable).map(N=>i.jsx(_n,{label:N.name,detail:N.description,onClick:()=>L({kind:"skill",id:N.id,label:N.name,digest:N.digest})},N.id)):null,P?i.jsx("p",{role:"status",children:"正在加载…"}):null,$?i.jsx("p",{role:"alert",children:$}):null]}):null]})}function bg({references:n,invalidReferenceKeys:r,onChange:o}){return i.jsx("div",{className:"context-tray","aria-label":"当前 Context 引用",children:n.map(a=>i.jsxs("span",{className:`context-chip${r.has(Ys(a))?" state-stale":""}`,children:[i.jsx("small",{children:Og(a.kind)}),i.jsx("span",{children:a.label}),r.has(Ys(a))?i.jsx("span",{className:"context-chip-state",children:"已失效,请移除后重新添加"}):null,i.jsx("button",{type:"button","aria-label":`移除 Context ${a.label}`,onClick:()=>o(n.filter(d=>d!==a)),children:i.jsx(Q,{name:"close",size:12})})]},Ys(a)))})}function _g({state:n,actions:r}){const o=n.composer.planReview,[a,d]=m.useState(!1),[f,p]=m.useState(""),g=!!n.pendingAction||n.connection!=="live"||!jr(n);return i.jsxs("section",{className:"plan-review-card","aria-labelledby":"plan-review-title",children:[i.jsxs("div",{children:[i.jsx("span",{className:"eyebrow",children:"PLAN REVIEW"}),i.jsx("h2",{id:"plan-review-title",children:"计划已保存,尚未执行"}),i.jsxs("p",{children:["由 ",o.createdModel," 创建 · digest ",o.planDigest.slice(0,12)]})]}),a?i.jsxs("label",{children:["继续规划反馈",i.jsx("textarea",{rows:2,value:f,onChange:x=>p(x.target.value)})]}):null,i.jsxs("div",{className:"plan-review-actions",children:[i.jsx("button",{type:"button",className:"danger-ghost-button",disabled:g,onClick:()=>Ct(r.reviewPlan(o.planDigest,"cancel")),children:"取消计划"}),a?i.jsx("button",{type:"button",className:"secondary-button",disabled:g||!f.trim(),onClick:()=>Ct(r.reviewPlan(o.planDigest,"continue",f.trim())),children:"提交反馈"}):i.jsx("button",{type:"button",className:"secondary-button",disabled:g,onClick:()=>d(!0),children:"继续规划"}),i.jsx("button",{type:"button",className:"primary-button",disabled:g,onClick:()=>Ct(r.reviewPlan(o.planDigest,"approve")),children:"批准并进入 BUILD"})]})]})}function za({label:n,accessibleLabel:r,value:o,options:a,disabled:d,emptyLabel:f,onOpen:p,onSelect:g}){const[x,w]=m.useState(!1),E=m.useRef(null),S=m.useRef(null),P=m.useRef(null),R=m.useId(),$=()=>{w(!1),S.current?.focus()},O=()=>{w(!0),p?.(),requestAnimationFrame(()=>Eg(P.current))};return Lo(x,E,$),i.jsxs("div",{className:"control-menu",ref:E,children:[i.jsxs("button",{ref:S,type:"button",className:"composer-control-trigger","aria-label":r,"aria-haspopup":"menu","aria-expanded":x,"aria-controls":x?R:void 0,disabled:d,onClick:()=>{x?$():O()},onKeyDown:F=>{F.key==="ArrowDown"&&(F.preventDefault(),O())},children:[i.jsx("span",{children:n}),i.jsx(Q,{name:"chevron",size:12})]}),x?i.jsx("div",{id:R,ref:P,className:"control-menu-popover",role:"menu","aria-label":r,onKeyDown:F=>Ya(F,$),children:a.length===0?i.jsx("p",{children:f??"没有选项"}):a.map(F=>i.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":F.value===o,onClick:()=>{$(),g(F.value)},children:[i.jsxs("span",{children:[i.jsx("strong",{children:F.label}),i.jsx("small",{children:F.detail})]}),F.value===o?i.jsx(Q,{name:"check",size:14}):null]},F.value))}):null]})}function _n({label:n,detail:r,onClick:o}){return i.jsx("button",{type:"button",role:"menuitem",onClick:o,children:i.jsxs("span",{children:[i.jsx("strong",{children:n}),i.jsx("small",{children:r})]})})}function Ig({kind:n,onCancel:r,onConfirm:o}){const[a,d]=m.useState(!1),f=m.useRef(null),p=m.useRef(null);return m.useEffect(()=>{const g=document.querySelector(n==="auto"?'[aria-label="工作模式"]':'[aria-label="会话权限"]');return p.current?.focus(),()=>g?.focus()},[n]),i.jsx("div",{className:"modal-backdrop",onPointerDown:g=>{g.target===g.currentTarget&&r()},children:i.jsxs("section",{ref:f,className:"risk-confirmation",role:"alertdialog","aria-modal":"true","aria-labelledby":"risk-title","aria-describedby":"risk-description",onKeyDown:g=>Pg(g,f.current,r),children:[i.jsx("h2",{id:"risk-title",children:n==="auto"?"启用 AUTO 模式?":"启用会话 ALLOW?"}),i.jsx("p",{id:"risk-description",children:n==="auto"?"Orion 会自主执行多个步骤,但仍受 ToolGateway、沙箱与 Workspace containment 约束。":"策略允许的工具将不再逐次询问;硬拒绝、沙箱和 Workspace 边界仍然生效。"}),i.jsxs("label",{children:[i.jsx("input",{type:"checkbox",checked:a,onChange:g=>d(g.target.checked)}),"我理解这会扩大本会话的默认执行范围"]}),i.jsxs("div",{children:[i.jsx("button",{ref:p,type:"button",className:"secondary-button",onClick:r,children:"取消"}),i.jsx("button",{type:"button",className:"primary-button",disabled:!a,onClick:o,children:"确认启用"})]})]})})}function Qa(n){return n?[...n.querySelectorAll('[role="menuitem"], [role="menuitemradio"]')].filter(r=>!r.disabled):[]}function Hf(n){Qa(n)[0]?.focus()}function Eg(n){const r=Qa(n);(r.find(o=>o.getAttribute("aria-checked")==="true")??r[0])?.focus()}function Ya(n,r){if(n.key==="Escape"){n.preventDefault(),r();return}if(!["ArrowDown","ArrowUp","Home","End"].includes(n.key))return;n.preventDefault();const o=Qa(n.currentTarget);if(o.length===0)return;const a=o.indexOf(document.activeElement),d=n.key==="Home"?0:n.key==="End"?o.length-1:n.key==="ArrowDown"?(Math.max(0,a)+1)%o.length:(a<=0?o.length:a)-1;o[d]?.focus()}function Pg(n,r,o){if(n.key==="Escape"){n.preventDefault(),o();return}if(n.key!=="Tab"||!r)return;const a=[...r.querySelectorAll('button:not(:disabled), input:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])')];if(a.length===0)return;const d=a[0],f=a.at(-1);n.shiftKey&&document.activeElement===d?(n.preventDefault(),f.focus()):!n.shiftKey&&document.activeElement===f&&(n.preventDefault(),d.focus())}function Lo(n,r,o){m.useEffect(()=>{if(!n)return;const a=f=>{r.current?.contains(f.target)||o()},d=f=>{f.key==="Escape"&&o()};return document.addEventListener("pointerdown",a),document.addEventListener("keydown",d),()=>{document.removeEventListener("pointerdown",a),document.removeEventListener("keydown",d)}},[o,n,r])}function Vd(n){return n==="plan"?"PLAN":n==="auto"?"AUTO":"BUILD"}function Rg(n){const r=n.composer?.mode??n.mode,o=Vd(r.baseMode);return r.pendingBaseMode?`${o} → ${Vd(r.pendingBaseMode)}`:o}function Tg(n){const r=n.composer?.permission,o=r?.source==="session"?"Session":"Project",a=`${r?.effective.toUpperCase()??"ASK"} · ${o}`;if((n.composer?.mode.baseMode??n.mode.baseMode)==="auto"&&r?.effective!=="deny")return"AUTO · hard policy";const d=n.composer?.pending.permission;return d?`${a} → ${(d.override??r?.projectDefault??"ask").toUpperCase()} · Session`:a}function po(n){return n==="auto"?"Effort 自动":`Effort ${n}`}function Kd(n){return n.kind==="directory"||n.kind==="symlink"&&n.targetKind==="directory"}function Mg(n){return n.kind==="file"||n.kind==="symlink"&&n.targetKind==="file"}function Og(n){return n==="file"?"FILE":n==="folder"?"FOLDER":n==="review"?"REVIEW":n==="session"?"SESSION":"SKILL"}function Ys(n){return`${n.kind}:${n.id}`}function Ct(n){n.catch(()=>{})}function es(n){return n>=1e3?`${Math.round(n/1e3)}k`:String(n)}const Ag=48,$g=64,Lg=new Set(["user","assistant"]);function Dg(n,r={}){const o=Wg(r.maxBuckets),a=[...n].filter(g=>Number.isFinite(g.order)).sort((g,x)=>g.order-x.order);if(a.length===0)return Object.freeze({anchors:Object.freeze([]),buckets:Object.freeze([]),minOrder:0,maxOrder:0});const d=Math.min(a.length,o),f=Math.ceil(a.length/d),p=[];for(let g=0;g<d;g+=1){const x=a.slice(g*f,(g+1)*f);if(x.length===0)break;p.push(zg(g,x))}return Object.freeze({anchors:Object.freeze(a),buckets:Object.freeze(p),minOrder:p[0]?.startOrder??0,maxOrder:p.at(-1)?.endOrder??0})}function zg(n,r){const o=[],a=new Set;let d=!1,f=null;for(const p of r)a.has(p.kind)||(a.add(p.kind),o.push(p.kind)),p.priority==="error"&&(d=!0,(!f||p.priority==="error")&&(f=p));if(!f){let p=null;for(const g of r)Lg.has(g.kind)&&(p=g);f=p??r[Math.floor((r.length-1)/2)]}return Object.freeze({index:n,startOrder:r[0].order,endOrder:r.at(-1).order,orders:Object.freeze(r.map(p=>p.order)),kinds:Object.freeze(o),hasError:d,jumpOrder:f.order})}function Wg(n){return typeof n!="number"||!Number.isFinite(n)?Ag:Math.min($g,Math.max(1,Math.round(n)))}function Fg(n){switch(n){case"user":return"用户任务";case"assistant":return"Orion 回复";case"tool":return"工具活动";case"edit":return"文件修改";case"subtask":return"子任务";case"research":return"研究";case"system":return"系统/错误"}}function Bg(n,r){const o=n.buckets.findIndex(f=>r>=f.startOrder&&r<=f.endOrder),a=o>=0?n.buckets[o]:void 0,d=a?.kinds.includes("assistant")?"assistant":a?.kinds.includes("user")?"user":a?.kinds[0]??"system";return{bucketIndex:o>=0?o+1:0,bucketCount:n.buckets.length,kindLabel:d?Fg(d):"未知"}}function Gd(n,r){return r<=0?0:r===1?.5:Math.max(0,Math.min(r-1,n))/(r-1)}function ho(n,r){const o=n.buckets.findIndex(a=>r>=a.startOrder&&r<=a.endOrder);return o>=0?o:null}function qg(n){const r=n.kind==="tool"||n.kind==="edit"||n.kind==="subtask"||n.kind==="research"?160:240,o=n.label.length,a=.35+Math.log2(1+o/r)*.55;return Math.max(.15,Math.min(1,a))}const Ug=220,Hg=400;function Vg(n,r={}){const o=typeof r.maxTicks=="number"&&Number.isFinite(r.maxTicks)?Math.max(1,Math.min(Hg,Math.round(r.maxTicks))):Ug,a=[...n].filter(p=>Number.isFinite(p.order)).sort((p,g)=>p.order-g.order);if(a.length===0)return Object.freeze([]);const d=[];if(a.length<=o)for(const p of a)d.push([p]);else{const p=Math.ceil(a.length/o);for(let g=0;g<a.length;g+=p)d.push(a.slice(g,g+p))}const f=d.map((p,g)=>{const x=p.some(R=>R.priority==="error");let E=p.reduce((R,$)=>$.order>R.order?$:R,p[0]),S=-1;for(const R of p){const $=R.priority==="error"?2:R.priority==="turn"?1:0;$>=S&&(S=$,E=R)}const P=Math.max(.15,Math.min(1,p.reduce((R,$)=>R+qg($),0)/p.length+(x?.1:0)));return{index:g,orders:Object.freeze(p.map(R=>R.order)),jumpOrder:E.order,weight:P,hasError:x}});return Object.freeze(f)}function Kg(n){return n>=.72?"history-tick-l":n>=.45?"history-tick-m":"history-tick-s"}function Qd(n){const{clientY:r,railTop:o,railHeight:a,tickCount:d}=n;if(!Number.isFinite(a)||a<=0||d<=0)return 0;const f=(r-o)/a;return Math.max(0,Math.min(d-1,Math.round(f*(d-1))))}function Gg(n,r){let o=null;for(const a of n)a.topInViewport<r-1||(!o||a.topInViewport<o.topInViewport)&&(o=a);return o?.order??null}function Qg(n,r){if(n.anchors.length===0)return null;let o=n.anchors[0].order,a=Number.POSITIVE_INFINITY;for(const d of n.anchors){const f=Math.abs(d.order-r);(f<a||f===a&&d.order>o)&&(o=d.order,a=f)}return o}function Yg(n){const{key:r,currentIndex:o,bucketCount:a,model:d}=n;if(a<=0)return null;const f=n.shiftKey?5:1;if(r==="Home")return d.buckets[0]?.jumpOrder??null;if(r==="End")return d.buckets.at(-1)?.jumpOrder??null;let p;if(r==="ArrowUp"||r==="ArrowLeft")p=o-f;else if(r==="ArrowDown"||r==="ArrowRight")p=o+f;else if(r==="PageUp")p=o-5;else if(r==="PageDown")p=o+5;else return null;const g=Math.max(0,Math.min(a-1,p));return d.buckets[g]?.jumpOrder??null}function Xg({model:n,activeOrder:r,span:o,hasEarlierHistory:a,processing:d,reduceMotion:f,onJumpToOrder:p,onJumpToLatest:g}){const x=m.useRef(null),w=m.useRef(null),E=m.useRef(!1),S=m.useRef(null),P=m.useRef(null),[R,$]=m.useState(!1),[O,F]=m.useState(null),te=m.useMemo(()=>Vg(n.anchors),[n.anchors]),L=te.length,ye=m.useMemo(()=>{if(r===null||L===0)return 0;const A=ho(n,r);return A!==null?A+1:0},[r,n,L]),J=m.useMemo(()=>r===null?null:Bg(n,r),[r,n]),ne=o!==null?ho(n,o.firstOrder)??0:null,N=o!==null?ho(n,o.lastOrder)??n.buckets.length-1:null,D=m.useMemo(()=>te.map(A=>ho(n,A.jumpOrder)),[n,te]),Z=m.useCallback(()=>{S.current!==null&&(window.clearTimeout(S.current),S.current=null),F(null)},[]),X=m.useCallback(A=>{const me=x.current;if(!me)return;const ve=me.getBoundingClientRect(),W=Qd({clientY:A,railTop:ve.top,railHeight:ve.height,tickCount:L}),se=te[W];if(!se)return;const B=n.anchors.find(pe=>pe.order===se.jumpOrder);let v=B?.preview;if(B?.kind==="user"){const V=n.anchors.find(oe=>oe.order>B.order&&oe.kind==="assistant")?.preview;V&&(v=v?`${v}
18
+
19
+ ${V}`:V)}const M=Gd(W,L)*ve.height;F({title:Rn(B?.label??""),preview:v?Rn(v):null,top:Math.max(8,Math.min(ve.height-140,M))})},[n,L,te]),ie=m.useCallback(A=>{P.current=A,S.current!==null&&window.clearTimeout(S.current),S.current=window.setTimeout(()=>{S.current=null;const me=P.current;me===null||w.current!==null||E.current||X(me)},120)},[X]);m.useEffect(()=>{const A=()=>{E.current||Z()};return window.addEventListener("scroll",A,!0),()=>window.removeEventListener("scroll",A,!0)},[Z]),m.useEffect(()=>()=>{S.current!==null&&window.clearTimeout(S.current)},[]);const G=m.useCallback((A,me)=>{const ve=x.current;if(!ve)return;const W=ve.getBoundingClientRect(),se=Qd({clientY:A,railTop:W.top,railHeight:W.height,tickCount:L}),B=te[se];B&&p(B.jumpOrder,me)},[p,L,te]),je=A=>{A.button!==0||w.current!==null||(A.preventDefault(),w.current=A.pointerId,A.currentTarget.setPointerCapture(A.pointerId),document.documentElement.dataset.historyScrubbing="1",E.current=!0,$(!0),Z(),G(A.clientY,"auto"))},ee=A=>{w.current===A.pointerId&&(A.currentTarget.hasPointerCapture(A.pointerId)&&A.currentTarget.releasePointerCapture(A.pointerId),w.current=null,E.current=!1,delete document.documentElement.dataset.historyScrubbing,$(!1),Z())},Ce=A=>{const me=Yg({key:A.key,shiftKey:A.shiftKey,currentIndex:ye-1,bucketCount:n.buckets.length,model:n});me!==null&&(A.preventDefault(),p(me,f?"auto":"smooth"))};return L===0?null:i.jsx("nav",{className:"history-rail","aria-label":"会话历史定位",children:i.jsxs("div",{className:"history-rail-inner",ref:x,children:[i.jsxs("div",{className:"history-slider",role:"slider","aria-label":"已加载会话历史位置","aria-valuemin":0,"aria-valuemax":Math.max(0,n.buckets.length-1),"aria-valuenow":Math.max(0,ye-1),"aria-valuetext":J?`已加载 ${J.bucketIndex}/${J.bucketCount} 个关键节点,当前为${J.kindLabel}${a?";更早历史可在正文顶部加载":""}`:`已加载 ${n.buckets.length} 个关键节点${a?";更早历史可在正文顶部加载":""}`,tabIndex:0,onKeyDown:Ce,onPointerDown:je,onPointerMove:A=>{if(w.current===A.pointerId){G(A.clientY,"auto");return}ie(A.clientY)},onPointerLeave:Z,onPointerUp:ee,onPointerCancel:ee,onLostPointerCapture:ee,onDoubleClick:g,children:[i.jsx("div",{className:"history-ticks","aria-hidden":"true",children:te.map((A,me)=>{const ve=D[me],W=ve!==null&&ne!==null&&N!==null&&ve>=ne&&ve<=N;return i.jsx("span",{className:["history-tick",Kg(A.weight),W?"is-viewport":"",A.hasError?"is-error":"",R?"is-scrubbing":""].filter(Boolean).join(" "),style:{top:`${Gd(A.index,L)*100}%`}},A.index)})}),d?i.jsx("span",{className:"history-live-bar","aria-hidden":"true"}):null]}),O?i.jsxs("div",{className:"history-preview-card",style:{top:O.top},"aria-hidden":"true",children:[i.jsx("strong",{children:O.title}),O.preview?i.jsx("p",{children:O.preview}):null]}):null]})})}const Jg=10;function Zg(n){const{viewportRef:r,model:o,activeSessionId:a,onUserNavigate:d}=n,f=m.useRef(new Map),p=m.useRef(null),g=m.useRef([]),x=m.useRef(null),[w,E]=m.useState(null),[S,P]=m.useState(null),R=m.useRef(d);R.current=d;const $=m.useRef(a),O=m.useRef(o);O.current=o;const F=()=>{if(x.current=null,g.current.length===0)return;const ne=g.current;if(g.current=[],ne.length===0)return;const D=r.current?.getBoundingClientRect().top??0,Z=Gg(ne,D);let X=Number.POSITIVE_INFINITY,ie=Number.NEGATIVE_INFINITY;for(const G of ne)G.topInViewport>=D-1&&(G.order<X&&(X=G.order),G.order>ie&&(ie=G.order));E(G=>G===Z?G:Z),P(G=>{if(!Number.isFinite(X)||!Number.isFinite(ie))return G;const je={firstOrder:X,lastOrder:ie};return G?.firstOrder===je.firstOrder&&G?.lastOrder===je.lastOrder?G:je})},te=()=>{x.current===null&&(x.current=requestAnimationFrame(F))},L=()=>{p.current&&(p.current.disconnect(),p.current=null),x.current!==null&&(cancelAnimationFrame(x.current),x.current=null),g.current=[],f.current.clear(),E(null),P(null)};m.useEffect(()=>{if($.current===a&&p.current)return;$.current=a,L();const ne=r.current;if(!ne||!o.anchors.length||typeof IntersectionObserver>"u")return;const N=new IntersectionObserver(D=>{const X=r.current?.getBoundingClientRect().top??0;for(const ie of D){const G=Number(ie.target.dataset.order);Number.isFinite(G)&&ie.isIntersecting&&g.current.push({order:G,topInViewport:ie.boundingClientRect.top-X})}te()},{root:ne,threshold:[0,.2,.6]});return p.current=N,f.current.clear(),ne.querySelectorAll("li[data-order]").forEach(D=>{const Z=Number(D.dataset.order);Number.isFinite(Z)&&(f.current.set(Z,D),N.observe(D))}),()=>L()},[r,a,o.anchors.length,o.anchors[o.anchors.length-1]?.order]);const ye=m.useCallback((ne,N)=>{if(N){if(f.current.get(ne)===N)return;f.current.set(ne,N),p.current?.observe(N);return}const D=f.current.get(ne);D&&(p.current?.unobserve(D),f.current.delete(ne))},[]);return{activeOrder:w,span:S,registerItem:ye,scrollToOrder:(ne,N="smooth")=>{const D=r.current,Z=Qg(O.current,ne),X=Z!==null?f.current.get(Z):void 0;if(!D||!X){if(!D||O.current.anchors.length===0)return;const G=(ne-O.current.minOrder)/(O.current.maxOrder-O.current.minOrder||1);D.scrollTo({top:Math.max(0,Math.min(1,G))*(D.scrollHeight-D.clientHeight),behavior:N}),R.current?.();return}const ie=X.getBoundingClientRect().top-D.getBoundingClientRect().top+D.scrollTop-Jg;D.scrollTo({top:Math.max(0,ie),behavior:N}),R.current?.()}}}const Ea=40;function gr(n){if(n.length===0)return 0;let r=1;for(let o=0;o<n.length;o+=1)n.charCodeAt(o)===10&&(r+=1);return r}function ev(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}function tv(n){if(n==null)return null;const r=n.trim();if(r.length===0)return{format:"plain",displayText:n,isEnvelope:!1,lineCount:0,isLong:!1};let o;try{o=JSON.parse(r)}catch{return{format:"plain",displayText:n,isEnvelope:!1,lineCount:gr(n),isLong:gr(n)>Ea}}if(ev(o)&&typeof o.output=="string"){const a=o.output;return{format:"envelope",displayText:a,isEnvelope:!0,lineCount:gr(a),isLong:gr(a)>Ea}}try{const a=JSON.stringify(o,null,2);return{format:"json",displayText:a,isEnvelope:!1,lineCount:gr(a),isLong:gr(a)>Ea}}catch{return{format:"plain",displayText:n,isEnvelope:!1,lineCount:gr(n),isLong:!1}}}function Vf({text:n,defaultOpen:r=!1,note:o=null}){const a=tv(n),d=r||!a?.isLong,[f,p]=m.useState(d),[g,x]=m.useState(!1),w=m.useRef(null);if(m.useEffect(()=>()=>{w.current!==null&&window.clearTimeout(w.current)},[]),a===null)return null;const E=Rn(a.displayText),S=async()=>{try{await navigator.clipboard.writeText(a.displayText),x(!0),w.current!==null&&window.clearTimeout(w.current),w.current=window.setTimeout(()=>x(!1),1400)}catch{}},P=i.jsx("pre",{className:"tool-output-text",tabIndex:0,children:E});if(!a.isLong||r)return i.jsxs("div",{className:"tool-output-preview tool-output-preview-open",children:[P,o?i.jsx("p",{className:"truncation-note",children:o}):null]});const R=`${a.lineCount} 行 · ${a.format==="envelope"?"已解包":"文本"}`;return i.jsx("div",{className:"tool-output-preview",children:i.jsxs("details",{className:"tool-output-fold",open:f,onToggle:$=>p($.target.open),children:[i.jsxs("summary",{children:[i.jsxs("span",{children:[R,a.isEnvelope?" · 输出已安全还原换行":""]}),i.jsx("button",{type:"button",className:"text-button",onClick:$=>{$.preventDefault(),S()},children:g?"已复制":"复制原始响应"})]}),P,o?i.jsx("p",{className:"truncation-note",children:o}):null]})})}const Yd=320,nv=300;function rv({state:n,actions:r,onRevealSettings:o,onCreateSession:a,composerInsertion:d}){const f=Oo(n),p=m.useMemo(()=>sv(n),[n.edits,n.research,n.subtasks,n.tools,n.transcript]),[g,x]=m.useState(Yd),w=p.slice(-g),E=m.useRef(null),S=m.useRef(null),P=m.useRef(!0),R=m.useRef(null),[$,O]=m.useState(!0),[F,te]=m.useState(!1),L=m.useMemo(()=>w.map(iv).filter(X=>X!==null),[w]),ye=m.useMemo(()=>Dg(L),[L]),J=Zg({viewportRef:E,model:ye,activeSessionId:n.activeSessionId,onUserNavigate:()=>{P.current=!1,O(!1)}});m.useEffect(()=>{const X=window.matchMedia("(prefers-reduced-motion: reduce)");te(X.matches);const ie=G=>te(G.matches);return X.addEventListener("change",ie),()=>X.removeEventListener("change",ie)},[]),m.useEffect(()=>{x(Yd),P.current=!0,O(!0)},[n.activeSessionId]),m.useLayoutEffect(()=>{const X=E.current;if(X){if(R.current){const ie=R.current;X.scrollTop=ie.top+(X.scrollHeight-ie.height),R.current=null;return}P.current&&(X.scrollTop=X.scrollHeight)}},[w.length,n.processing]),m.useLayoutEffect(()=>{const X=E.current,ie=S.current;if(!X||!ie||typeof ResizeObserver>"u")return;const G=new ResizeObserver(()=>{P.current&&(X.scrollTop=X.scrollHeight)});return G.observe(ie),()=>G.disconnect()},[n.activeSessionId]);const ne=()=>{const X=E.current;if(!X)return;const ie=X.scrollHeight-X.scrollTop-X.clientHeight<72;P.current=ie,O(ie)},N=!!n.sessionSnapshot?.transcript.nextCursor,D=async()=>{const X=E.current;if(X&&(R.current={height:X.scrollHeight,top:X.scrollTop}),p.length>w.length){x(ie=>ie+nv);return}if(N)try{await r.loadOlderTranscript(),x(ie=>ie+100)}catch{R.current=null}},Z=()=>{const X=E.current;X&&(P.current=!0,O(!0),X.scrollTo({top:X.scrollHeight,behavior:"smooth"}))};return i.jsxs("main",{className:"conversation-column",id:"main-content",children:[n.bootstrap?.configured?null:i.jsxs("div",{className:"configuration-banner",role:"status",children:[i.jsx(Q,{name:"warning"}),i.jsxs("div",{children:[i.jsx("strong",{children:"模型尚未配置"}),i.jsx("span",{children:"请在 Orion 配置文件或环境变量中设置凭证。API Key 不会进入浏览器。"})]}),i.jsx("button",{type:"button",className:"secondary-button",onClick:o,children:"转到设置"})]}),i.jsxs("div",{className:"transcript-stage",children:[i.jsx("div",{className:"transcript-viewport",ref:E,role:"region","aria-label":"会话记录",tabIndex:0,onScroll:ne,"aria-busy":n.processing,children:i.jsxs("div",{className:"transcript-content",ref:S,children:[p.length>w.length||N?i.jsx("button",{type:"button",className:"load-history",onClick:()=>{D()},disabled:!!n.pendingAction,children:p.length>w.length?`加载更早内容 · 还剩 ${p.length-w.length} 项`:"从持久记录加载更早内容"}):null,n.activeSessionId?f.status==="failed"&&w.length===0?i.jsx(mo,{icon:"warning",title:"会话快照加载失败",detail:f.error??"请重试当前会话快照。"}):(f.status==="loading"||f.status==="refreshing")&&w.length===0?i.jsx(mo,{icon:"refresh",title:"正在同步会话",detail:"本地 Web Host 正在读取最近的会话快照。"}):w.length===0?i.jsx(mo,{icon:"spark",title:"准备好开始了",detail:"描述要构建、修复或调查的任务。Orion 会实时展示工具、文件变化与验证结果。"}):i.jsx("ol",{className:"timeline","aria-label":"会话记录",children:w.map(X=>i.jsx("li",{id:`conversation-item-${n.activeSessionId??"none"}-${Wa(X)}`,"data-event-id":X.order,"data-order":X.order,ref:ie=>J.registerItem(X.order,ie),children:lv(X,n)},Wa(X)))}):i.jsx(mo,{icon:"workspace",title:"选择或创建一个会话",detail:"Orion 会在当前工作区运行,并沿用 CLI/TUI 的权限与持久化状态。",action:"创建会话",onAction:a}),n.processing?i.jsxs("div",{className:"thinking-indicator",role:"status",children:[i.jsx("span",{}),i.jsx("span",{}),i.jsx("span",{}),i.jsx("span",{children:n.statusMessage||"Orion 正在处理…"})]}):null]})}),i.jsx(Xg,{model:ye,activeOrder:J.activeOrder,span:J.span,hasEarlierHistory:p.length>w.length||N,processing:n.processing,reduceMotion:F,onJumpToOrder:(X,ie)=>J.scrollToOrder(X,ie),onJumpToLatest:Z})]}),!$&&w.length>0?i.jsxs("button",{type:"button",className:"jump-latest",onClick:Z,children:[i.jsx(Q,{name:"arrow-up",size:15}),"回到最新"]}):null,i.jsxs("div",{className:"input-dock",children:[n.permission||n.queue.items.length>0?i.jsxs("div",{className:"input-transients",children:[n.permission?i.jsx(hv,{state:n,actions:r}):null,n.queue.items.length>0?i.jsx(mv,{state:n,actions:r}):null]}):null,i.jsx(kg,{state:n,actions:r,insertion:d})]})]})}function sv(n){const r=new Set(n.tools.map(a=>a.callId));return[...n.transcript.filter(a=>!a.toolActivity?.callId||!r.has(a.toolActivity.callId)).map(a=>({kind:"transcript",order:a.order,value:a})),...n.tools.map(a=>({kind:"tool",order:a.order,value:a})),...n.edits.map(a=>({kind:"edit",order:a.order,value:a})),...n.subtasks.map(a=>({kind:"subtask",order:a.order,value:a})),...n.research.map(a=>({kind:"research",order:a.order,value:a}))].sort((a,d)=>a.order-d.order)}function Wa(n){return n.kind==="transcript"?`entry-${n.value.id}`:n.kind==="tool"?`tool-${n.value.callId}`:n.kind==="edit"?`edit-${n.order}`:n.kind==="subtask"?`subtask-${n.value.taskId}`:`research-${n.value.packetId}`}function iv(n){const r=n.order,o=Wa(n);if(n.kind==="tool")return{order:r,key:o,kind:"tool",label:Hs(n.value.summary)||n.value.name,preview:Jr(n.value.summary),priority:n.value.state==="error"?"error":"activity"};if(n.kind==="edit")return{order:r,key:o,kind:"edit",label:n.value.request.path,preview:Jr(`${n.value.request.path}
20
+ ${n.value.request.newString??""}`),priority:"activity"};if(n.kind==="subtask")return{order:r,key:o,kind:"subtask",label:Hs(n.value.objective)||n.value.role,preview:Jr(n.value.summary||n.value.objective),priority:ov.has(n.value.state)?"error":"activity"};if(n.kind==="research")return{order:r,key:o,kind:"research",label:Hs(n.value.objective)||"Research",preview:Jr(n.value.conclusion||n.value.objective),priority:n.value.stage==="failed"?"error":"activity"};const a=n.value;if(a.toolActivity){const g=a.toolActivity;return{order:r,key:o,kind:"tool",label:Hs(g.summary)||g.name||g.detail||"工具活动",preview:Jr(g.summary||g.body),priority:g.state==="error"?"error":"activity"}}const d=a.role;let f;return d==="user"||d==="assistant"?f="turn":f=d==="error"||d==="command"&&a.command?.success===!1?"error":"activity",(a.errorLayer||a.budgetStop)&&(f="error"),{order:r,key:o,kind:d==="user"?"user":d==="assistant"?"assistant":"system",priority:f,label:Hs(a.content)||a.title||(d==="user"?"用户任务":d==="assistant"?"Orion 回复":Fa(d)),preview:Jr(a.content)}}const ov=new Set(["failed","timed_out","rejected","cancelled"]);function Hs(n){if(!n)return null;const r=n.replace(/\s+/gu," ").trim();return r.length>80?`${r.slice(0,80)}…`:r}function Jr(n){if(!n)return;const r=n.trim();if(r)return r.length<=280?r:`${r.slice(0,280)}…`}function lv(n,r){if(n.kind==="transcript")return i.jsx(av,{entry:n.value});if(n.kind==="tool"){const o=r.transcript.find(a=>a.toolActivity?.callId===n.value.callId)?.toolActivity;return i.jsx(cv,{tool:n.value,activity:o})}return n.kind==="edit"?i.jsx(dv,{edit:n.value}):n.kind==="subtask"?i.jsx(fv,{subtask:n.value}):i.jsx(pv,{research:n.value})}function av({entry:n}){if(n.toolActivity)return i.jsx(uv,{entry:n});if(vv(n))return i.jsxs("details",{className:"reasoning-card",children:[i.jsxs("summary",{children:[i.jsx(Ga,{state:n.live?"running":"ready",describe:!1}),i.jsx("span",{children:n.live?"正在分析":n.title||"推理摘要"}),i.jsx("span",{className:"reasoning-hint",children:"展开查看 Runtime 提供的摘要"})]}),i.jsx(Xs,{children:n.content})]});const r=n.role;return i.jsxs("article",{className:`message-card role-${r}`,"aria-label":Fa(r),children:[i.jsxs("header",{children:[i.jsx("span",{className:"message-avatar","aria-hidden":"true",children:yv(r)}),i.jsx("span",{children:n.title||Fa(r)}),n.live?i.jsx("span",{className:"streaming-label",children:"生成中"}):null,n.command?i.jsx("span",{className:`command-state ${n.command.success?"success":"error"}`,children:n.command.success?"成功":"失败"}):null]}),i.jsx("div",{className:"message-body",children:r==="user"?i.jsx("p",{className:"literal-message",children:n.content}):i.jsx(Xs,{children:n.content})}),n.budgetStop?i.jsxs("div",{className:"budget-stop",role:"status",children:[i.jsx(Q,{name:"pause",size:15}),i.jsxs("span",{children:[n.budgetStop.reason," · 状态已保留"]})]}):null]})}function cv({tool:n,activity:r}){const o=n.workspaceMutation?.phase==="queued"?`等待工作树写入${n.workspaceMutation.queuePosition?`(第 ${n.workspaceMutation.queuePosition} 位)`:""}`:n.workspaceMutation?.phase==="running"?"正在写入工作树":n.state==="running"?"运行中":n.state==="success"?"完成":n.state==="skipped"?"跳过":"失败",a=r?.outputView?.preview||r?.body||n.error||n.summary;return i.jsxs("article",{className:`tool-card tool-${n.state}`,"aria-label":`工具 ${n.name}:${o}`,children:[i.jsxs("div",{className:"tool-card-header",children:[i.jsx("span",{className:`tool-state-icon ${n.state}`,"aria-hidden":"true",children:n.state==="running"?i.jsx("span",{className:"spinner"}):i.jsx(Q,{name:n.state==="success"?"check":n.state==="skipped"?"pause":"warning",size:15})}),i.jsxs("div",{className:"tool-title",children:[i.jsx("strong",{children:n.name}),i.jsxs("span",{children:["#",n.sequence," · ",o,n.duration!==void 0?` · ${Kf(n.duration)}`:""]})]}),n.outputBytes!==void 0?i.jsx("span",{className:"byte-pill",children:Ba(n.outputBytes)}):null]}),n.summary||n.error?i.jsx("p",{className:n.error?"tool-error-copy":"tool-summary",children:Rn(n.error||n.summary||"")}):null,i.jsxs("details",{className:"tool-details",open:n.state==="error",children:[i.jsx("summary",{children:"输入与详情"}),i.jsxs("dl",{className:"tool-meta-grid",children:[i.jsxs("div",{children:[i.jsx("dt",{children:"授权"}),i.jsx("dd",{children:n.authorization?`${n.authorization.approved?"允许":"拒绝"} · ${n.authorization.source}`:"等待 Runtime 记录"})]}),n.artifactId?i.jsxs("div",{children:[i.jsx("dt",{children:"产物"}),i.jsx("dd",{children:i.jsx("code",{children:n.artifactId})})]}):null]}),i.jsxs("div",{className:"tool-detail-section",children:[i.jsx("span",{className:"micro-label",children:"参数(已脱敏)"}),i.jsx("pre",{tabIndex:0,children:Ka(n.args)})]}),a?i.jsxs("div",{className:"tool-detail-section",children:[i.jsx("span",{className:"micro-label",children:"输出预览"}),i.jsx(Vf,{text:a,defaultOpen:n.state==="error",note:r?.outputView?.omittedBytes?`另有 ${Ba(r.outputView.omittedBytes)} 已折叠,可在 Inspector 中查看产物。`:null})]}):null]})]})}function uv({entry:n}){const r=n.toolActivity;return i.jsxs("article",{className:`tool-card tool-${r.state}`,children:[i.jsxs("div",{className:"tool-card-header",children:[i.jsx("span",{className:`tool-state-icon ${r.state}`,"aria-hidden":"true",children:i.jsx(Q,{name:"terminal",size:15})}),i.jsxs("div",{className:"tool-title",children:[i.jsx("strong",{children:r.name}),i.jsx("span",{children:r.detail})]})]}),r.summary?i.jsx("p",{className:"tool-summary",children:r.summary}):null,r.outputView?.preview||r.body?i.jsxs("div",{className:"tool-detail-section tool-output-section",children:[i.jsx("span",{className:"micro-label",children:"输出"}),i.jsx(Vf,{text:r.outputView?.preview||r.body,defaultOpen:r.state==="error",note:r.outputView?.omittedBytes?`另有 ${Ba(r.outputView.omittedBytes)} 已折叠,可在 Inspector 中查看产物。`:null})]}):null]})}function dv({edit:n}){const r=n.request;return i.jsxs("article",{className:"edit-card",children:[i.jsxs("header",{children:[i.jsx("span",{className:"edit-icon",children:i.jsx(Q,{name:"edit",size:15})}),i.jsxs("div",{children:[i.jsx("strong",{children:"文件修改预览"}),i.jsxs("span",{children:[r.kind," · ",r.candidates.length," 个候选"]})]})]}),i.jsx("code",{className:"path-chip",title:r.path,children:r.path}),i.jsxs("details",{children:[i.jsx("summary",{children:"查看替换内容"}),i.jsx("pre",{tabIndex:0,children:Rn(r.newString)})]})]})}function fv({subtask:n}){return i.jsxs("details",{className:`activity-card subtask-card state-${n.state}`,children:[i.jsxs("summary",{children:[i.jsx(Q,{name:"branch",size:16}),i.jsxs("span",{children:[i.jsx("strong",{children:n.role}),i.jsx("small",{children:n.state})]}),n.durationMs!==void 0?i.jsx("time",{children:Kf(n.durationMs)}):null]}),i.jsx("p",{children:n.objective}),n.summary?i.jsx(Xs,{children:n.summary}):null]})}function pv({research:n}){return i.jsxs("details",{className:`activity-card research-card state-${n.stage}`,children:[i.jsxs("summary",{children:[i.jsx(Q,{name:"search",size:16}),i.jsxs("span",{children:[i.jsx("strong",{children:"Research"}),i.jsxs("small",{children:[n.stage," · ",n.sources.length," sources"]})]})]}),n.objective?i.jsx("p",{children:n.objective}):null,n.conclusion?i.jsx(Xs,{children:n.conclusion}):null,n.sources.length>0?i.jsx("ul",{className:"source-list",children:n.sources.map(r=>i.jsxs("li",{children:[i.jsx(Ga,{state:r.status}),i.jsx("span",{children:r.title||r.location||r.id}),i.jsxs("small",{children:[r.provider," · ",r.status]})]},r.id))}):null]})}function hv({state:n,actions:r}){const o=n.permission,a=m.useRef(null),d=m.useRef("");m.useEffect(()=>{d.current!==o.id&&(d.current=o.id,a.current?.focus())},[o.id]);const f=!!n.pendingAction||n.connection!=="live"||!jr(n);return i.jsxs("section",{ref:a,className:"approval-card",role:"region","aria-live":"assertive","aria-labelledby":"approval-title","aria-describedby":"approval-reason",tabIndex:-1,children:[i.jsxs("div",{className:"approval-heading",children:[i.jsx("span",{className:"approval-icon",children:i.jsx(Q,{name:"warning",size:17})}),i.jsxs("div",{children:[i.jsx("span",{className:"eyebrow",children:"需要你的确认"}),i.jsxs("h2",{id:"approval-title",children:["允许 ",o.name,"?"]})]})]}),i.jsx("p",{id:"approval-reason",children:o.reason||"该工具需要在当前权限策略下获得明确授权。"}),i.jsxs("details",{className:"approval-args",children:[i.jsx("summary",{children:"查看脱敏参数"}),i.jsx("pre",{tabIndex:0,children:Ka(o.args,6e3)})]}),i.jsxs("div",{className:"approval-actions",children:[i.jsx("button",{type:"button",className:"danger-ghost-button",onClick:()=>Pn(r.answerPermission(!1)),disabled:f,children:"拒绝"}),i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>Pn(r.answerPermission(!0,"once")),disabled:f,children:"仅本次"}),i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>Pn(r.answerPermission(!0,"project")),disabled:f,children:"允许此项目"}),i.jsx("button",{type:"button",className:"primary-button",onClick:()=>Pn(r.answerPermission(!0,"global")),disabled:f,children:"始终允许"})]}),i.jsx("p",{className:"approval-footnote",children:"项目与全局授权会写入 Orion 配置;拒绝不会丢失当前会话。"})]})}function mv({state:n,actions:r}){const o=!!n.pendingAction||n.connection!=="live"||!jr(n);return i.jsxs("details",{className:"queue-dock",children:[i.jsxs("summary",{children:[i.jsxs("span",{children:[n.queue.items.length," 条排队消息"]}),i.jsx("span",{children:"执行时采用最新 Composer 控制"})]}),i.jsxs("div",{className:"queue-list",children:[n.queue.items.map((a,d)=>i.jsx(gv,{item:a,index:d,count:n.queue.items.length,disabled:o,actions:r},a.id)),i.jsx("button",{type:"button",className:"text-button queue-clear",onClick:()=>Pn(r.clearQueue()),disabled:o,children:"清空队列"})]})]})}function gv({item:n,index:r,count:o,disabled:a,actions:d}){const[f,p]=m.useState(!1),[g,x]=m.useState(n.text);m.useEffect(()=>x(n.text),[n.text]);const w=async()=>{const E=g.trim();E&&(await d.editQueued(n.id,n.revision,E),p(!1))};return i.jsxs("div",{className:"queue-row",children:[i.jsx("span",{className:"queue-index",children:r+1}),f?i.jsx("textarea",{rows:2,value:g,"aria-label":`编辑排队消息 ${r+1}`,onChange:E=>x(E.target.value)}):i.jsx("p",{children:n.text}),i.jsxs("div",{className:"queue-row-actions",children:[i.jsx("button",{type:"button",className:"icon-button","aria-label":`上移排队消息 ${r+1}`,onClick:()=>Pn(d.moveQueued(n.id,n.revision,r-1)),disabled:a||r===0,children:i.jsx(Q,{name:"arrow-up",size:13})}),i.jsx("button",{type:"button",className:"icon-button queue-move-down","aria-label":`下移排队消息 ${r+1}`,onClick:()=>Pn(d.moveQueued(n.id,n.revision,r+1)),disabled:a||r===o-1,children:i.jsx(Q,{name:"arrow-up",size:13})}),f?i.jsx("button",{type:"button",className:"text-button",onClick:()=>Pn(w()),disabled:a||!g.trim(),children:"保存"}):i.jsx("button",{type:"button",className:"text-button",onClick:()=>p(!0),disabled:a,children:"编辑"}),i.jsx("button",{type:"button",className:"icon-button","aria-label":`移除排队消息 ${r+1}`,onClick:()=>Pn(d.removeQueued(n.id,n.revision)),disabled:a,children:i.jsx(Q,{name:"trash",size:14})})]})]})}function mo({icon:n,title:r,detail:o,action:a,onAction:d}){return i.jsxs("section",{className:"empty-conversation",children:[i.jsx("div",{className:"empty-orbit",children:i.jsx(Q,{name:n,size:26})}),i.jsx("h2",{children:r}),i.jsx("p",{children:o}),a&&d?i.jsx("button",{type:"button",className:"primary-button",onClick:d,children:a}):null]})}function vv(n){const r=`${n.title??""}`.toLocaleLowerCase();return r.includes("reason")||r.includes("think")||r.includes("analysis")||r.includes("推理")||r.includes("思考")}function Fa(n){return n==="user"?"你":n==="assistant"?"Orion":n==="command"?"命令":n==="error"?"错误":n==="system"?"系统":n==="status"?"状态":"工具"}function yv(n){return n==="user"?"Y":n==="assistant"?"O":n==="error"?"!":n==="command"?"›":"·"}function Pn(n){n.catch(()=>{})}function Kf(n){return n<1e3?`${Math.round(n)}ms`:n<6e4?`${(n/1e3).toFixed(n<1e4?1:0)}s`:`${Math.floor(n/6e4)}m ${Math.round(n%6e4/1e3)}s`}function Ba(n){return n<1024?`${n} B`:n<1048576?`${(n/1024).toFixed(1)} KB`:`${(n/1048576).toFixed(1)} MB`}const xv=.02,wv=.1;function rs(n,r,o){const a=Number.isFinite(n)?Math.round(n):r;return Math.min(o,Math.max(r,a))}function kv({side:n,clientX:r,bounds:o,minWidth:a,maxWidth:d}){const f=n==="left"?r-o.left:o.right-r;return rs(f,a,d)}function jv(n,r,o){const a=o-r;if(a<=0)return 0;const d=(rs(n,r,o)-r)/a;return Math.round(d*100)}function Sv(n){const{key:r,minWidth:o,maxWidth:a,defaultWidth:d,currentWidth:f,side:p}=n,g=S=>rs(S,o,a);if(r==="Home")return g(o);if(r==="End")return g(a);if(r==="Enter"||r===" ")return g(d);if(r!=="ArrowLeft"&&r!=="ArrowRight")return null;const x=n.shiftKey?wv:xv,w=Math.max(1,Math.round((a-o)*x)),E=(r==="ArrowRight"?1:-1)*(p==="left"?1:-1);return g(f+E*w)}function Gf({side:n,className:r,minWidth:o,maxWidth:a,defaultWidth:d,label:f,width:p,controls:g,boundsRef:x,resizingScope:w="workbench",onPreview:E,onCommit:S}){const P=m.useRef(rs(p??d,o,a)),R=m.useRef(null),$=m.useRef(null),O=m.useRef(null),F=()=>{O.current!==null&&cancelAnimationFrame(O.current),O.current=null},te=()=>{R.current=null,$.current=null,F(),delete document.documentElement.dataset.panelResizing};m.useEffect(()=>te,[]),m.useEffect(()=>{p===void 0||R.current!==null||(P.current=rs(p,o,a))},[p,o,a]);const L=G=>{P.current=G,$.current=G,O.current===null&&(O.current=requestAnimationFrame(()=>{O.current=null;const je=$.current;$.current=null,je!==null&&E(je)}))},ye=G=>{let je;if(x?.current){const ee=x.current.getBoundingClientRect();je={left:ee.left,right:ee.right}}else je=G.currentTarget.closest(".workbench-shell")?.getBoundingClientRect()??{left:0,right:window.innerWidth};return kv({side:n,clientX:G.clientX,bounds:je,minWidth:o,maxWidth:a})},J=G=>{if(G.button!==0||R.current!==null)return;G.preventDefault(),R.current=G.pointerId,G.currentTarget.setPointerCapture(G.pointerId);const je=w==="resource-split"?"resource-split":n;document.documentElement.dataset.panelResizing=je,L(ye(G))},ne=G=>{R.current===G.pointerId&&L(ye(G))},N=G=>{if(R.current!==G.pointerId)return;G.currentTarget.hasPointerCapture(G.pointerId)&&G.currentTarget.releasePointerCapture(G.pointerId);const je=$.current??P.current;te(),E(je),S(je)},D=G=>{if(R.current!==G.pointerId)return;const je=$.current??P.current;te(),E(je),S(je)},Z=G=>{P.current=G,E(G),S(G)},X=G=>{const je=Sv({key:G.key,shiftKey:G.shiftKey,minWidth:o,maxWidth:a,defaultWidth:d,currentWidth:P.current,side:n});je!==null&&(G.preventDefault(),Z(je))},ie=jv(P.current,o,a);return i.jsx("div",{className:`panel-resize-handle panel-resize-handle-${n}${r?` ${r}`:""}`,role:"separator","aria-orientation":"vertical","aria-label":f,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":ie,"aria-valuetext":`${P.current} 像素`,"aria-controls":g,tabIndex:0,title:`${f};方向键调整,Shift 加速,Enter 恢复默认,双击亦可恢复`,onPointerDown:J,onPointerMove:ne,onPointerUp:N,onPointerCancel:N,onLostPointerCapture:D,onKeyDown:X,onDoubleClick:()=>Z(rs(d,o,a)),children:i.jsx("span",{})})}const Cv=["ArrowDown","ArrowUp","Home","End","Escape"];function Nv({label:n,items:r,disabled:o=!1}){const[a,d]=m.useState(!1),f=m.useRef(null),p=m.useRef(null),g=m.useRef([]),x=m.useId(),w=()=>{d(!1),p.current?.focus()};m.useEffect(()=>{if(!a)return;const S=P=>{f.current?.contains(P.target)||d(!1)};return document.addEventListener("pointerdown",S),()=>document.removeEventListener("pointerdown",S)},[a]),m.useEffect(()=>{if(!a)return;const S=r.findIndex(P=>!P.disabled);g.current[S>=0?S:0]?.focus()},[a]);const E=S=>{if(!Cv.includes(S.key))return;if(S.preventDefault(),S.key==="Escape"){w();return}const P=r.map((O,F)=>({item:O,index:F})).filter(O=>!O.item.disabled);if(!P.length)return;const R=P.findIndex(O=>g.current[O.index]===document.activeElement);let $=0;if(S.key==="Home")$=0;else if(S.key==="End")$=P.length-1;else{const O=S.key==="ArrowDown"?1:-1;$=R<0?0:(R+O+P.length)%P.length}g.current[P[$].index]?.focus()};return i.jsxs("div",{className:"session-row-menu",ref:f,children:[i.jsx("button",{ref:p,type:"button",className:"icon-button session-row-menu-trigger","aria-label":n,"aria-haspopup":"menu","aria-expanded":a,disabled:o,onClick:()=>d(S=>!S),onKeyDown:S=>{if(S.key==="ArrowDown"||S.key==="Enter"||S.key===" "){if(a)return;S.preventDefault(),d(!0)}},children:i.jsx(Q,{name:"more",size:15})}),a?i.jsx("div",{className:"session-menu",role:"menu","aria-label":n,onKeyDown:E,children:r.map((S,P)=>i.jsxs("button",{ref:R=>{g.current[P]=R},type:"button",role:"menuitem",className:`session-menu-item${S.danger?" danger":""}`,tabIndex:-1,disabled:S.disabled,"aria-describedby":S.hint?`${x}-${S.id}`:void 0,onClick:()=>{d(!1),S.onSelect()},children:[S.label,S.hint?i.jsx("span",{id:`${x}-${S.id}`,className:"session-menu-hint",children:S.hint}):null]},S.id))}):null]})}const Xa=240,Do=280,Qf=480,Xd=48,Ja=320,Za=420,Yf=3200,Ye=48,Jd=560,Xf="orion.web.workbench-layout.v2",bv="orion.web.work-panel.v1",qa=["agent","review","terminal","files","git"],kr=Object.freeze({schemaVersion:2,projectNavigation:Object.freeze({expanded:!0,widthPx:Do}),workPanel:Object.freeze({expanded:!0,widthPx:Za,activePanel:"agent",agentPanel:"goal"})});function go(n,r){const o=Rv(n),a=Jf(r.projectNavigation.widthPx),d=Zs(r.workPanel.widthPx);if(o<=760)return Object.freeze({projectNavigation:Object.freeze({mode:"drawer",widthPx:0}),conversationWidthPx:o,workPanel:Object.freeze({mode:"drawer",widthPx:0})});if(o<=1180){const w=o-Jd,S=r.projectNavigation.expanded&&w>=Xa?"dock":r.projectNavigation.expanded?"drawer":"rail",P=S==="dock"?Math.min(a,w):S==="rail"?Xd:0;return Object.freeze({projectNavigation:Object.freeze({mode:S,widthPx:P}),conversationWidthPx:Math.max(0,o-P),workPanel:Object.freeze({mode:"drawer",widthPx:0})})}const f=r.projectNavigation.expanded?a:Xd,p=o-f-Jd,g=r.workPanel.expanded&&p>=Ja,x=g?Math.min(d,p):Ye;return Object.freeze({projectNavigation:Object.freeze({mode:r.projectNavigation.expanded?"dock":"rail",widthPx:f}),conversationWidthPx:Math.max(0,o-f-x),workPanel:Object.freeze({mode:g?"dock":"rail",widthPx:x})})}function Jf(n){const r=Number.isFinite(n)?Math.round(n):Do;return Math.min(Qf,Math.max(Xa,r))}function Zs(n){const r=Number.isFinite(n)?Math.round(n):Za;return Math.min(Yf,Math.max(Ja,r))}function _v(n,r=null){if(!n)return Pv(r);try{const o=JSON.parse(n);if(!ko(o)||o.schemaVersion!==2)return kr;const a=ko(o.projectNavigation)?o.projectNavigation:{},d=ko(o.workPanel)?o.workPanel:{};return Zf({schemaVersion:2,projectNavigation:{expanded:typeof a.expanded=="boolean"?a.expanded:!0,widthPx:Jf(Number(a.widthPx))},workPanel:{expanded:typeof d.expanded=="boolean"?d.expanded:!0,widthPx:Zs(Number(d.widthPx)),activePanel:ei(d.activePanel)?d.activePanel:"agent",agentPanel:tp(d.agentPanel)?d.agentPanel:"goal",order:Tv(d.order)}})}catch{return kr}}function Iv(){const n=ep();if(!n)return kr;try{return _v(n.localStorage.getItem(Xf),n.localStorage.getItem(bv))}catch{return kr}}function Ev(n){const r=ep();if(r)try{r.localStorage.setItem(Xf,JSON.stringify(n))}catch{}}function Pv(n){if(!n)return kr;try{const r=JSON.parse(n);return!ko(r)||r.schemaVersion!==1?kr:Zf({schemaVersion:2,projectNavigation:{expanded:!0,widthPx:Do},workPanel:{expanded:typeof r.expanded=="boolean"?r.expanded:!0,widthPx:Zs(Number(r.widthPx)),activePanel:ei(r.activePanel)?r.activePanel:"agent",agentPanel:tp(r.agentPanel)?r.agentPanel:"goal"}})}catch{return kr}}function Zf(n){return Object.freeze({schemaVersion:2,projectNavigation:Object.freeze({...n.projectNavigation}),workPanel:Object.freeze({...n.workPanel})})}function Rv(n){return!Number.isFinite(n)||n<=0?1440:Math.max(320,Math.round(n))}function ep(){return globalThis.window??null}function Tv(n){if(!Array.isArray(n)||n.length!==qa.length)return;const r=new Set;for(const o of n){if(!ei(o)||r.has(o))return;r.add(o)}return Object.freeze([...n])}function ei(n){return["agent","review","terminal","files","git"].includes(String(n))}function tp(n){return["goal","activity","integrations","diagnostics"].includes(String(n))}function ko(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}function np({size:n=20,className:r,pixel:o=!1}){const a=m.useId(),d=`orion-bar-a-${a}`,f=`orion-bar-b-${a}`,p=`orion-bar-c-${a}`;return i.jsx("span",{className:r?`orion-brand-mark ${o?"orion-brand-mark-pixel ":""}${r}`:`orion-brand-mark${o?" orion-brand-mark-pixel":""}`,"aria-hidden":"true",style:{width:n,height:n},children:i.jsxs("svg",{viewBox:"0 0 20 20",width:n,height:n,focusable:"false",role:"presentation",shapeRendering:o?"crispEdges":void 0,children:[i.jsxs("defs",{children:[i.jsxs("linearGradient",{id:d,x1:"0",y1:"0",x2:"0",y2:"1",children:[i.jsx("stop",{offset:"0",className:"orion-mark-stop orion-mark-stop-primary"}),i.jsx("stop",{offset:"1",className:"orion-mark-stop orion-mark-stop-secondary"})]}),i.jsxs("linearGradient",{id:f,x1:"0",y1:"0",x2:"0",y2:"1",children:[i.jsx("stop",{offset:"0",className:"orion-mark-stop orion-mark-stop-primary"}),i.jsx("stop",{offset:"1",className:"orion-mark-stop orion-mark-stop-secondary"})]}),i.jsxs("linearGradient",{id:p,x1:"0",y1:"0",x2:"0",y2:"1",children:[i.jsx("stop",{offset:"0",className:"orion-mark-stop orion-mark-stop-primary"}),i.jsx("stop",{offset:"1",className:"orion-mark-stop orion-mark-stop-secondary"})]})]}),o?[{x:2,y:9,h:9},{x:8,y:4,h:14},{x:14,y:7,h:11}].map(g=>i.jsxs(m.Fragment,{children:[i.jsx("rect",{x:g.x,y:g.y,width:"4",height:Math.max(1,g.h-1),rx:0,style:{fill:"var(--accent)"}}),g.h>1?i.jsx("rect",{x:g.x,y:g.y+g.h-1,width:"4",height:"1",rx:0,style:{fill:"var(--accent-2)"}}):null]},g.x)):i.jsxs(i.Fragment,{children:[i.jsx("rect",{className:"orion-mark-bar",x:"2",y:"9",width:"4",height:"9",rx:2,fill:`url(#${d})`}),i.jsx("rect",{className:"orion-mark-bar",x:"8",y:"4",width:"4",height:"14",rx:2,fill:`url(#${f})`}),i.jsx("rect",{className:"orion-mark-bar",x:"14",y:"7",width:"4",height:"11",rx:2,fill:`url(#${p})`})]})]})})}const jo=5,Zd=7,Ua=1,Mv=Object.freeze({c:[".....",".....",".###.","#....","#....","#....",".###."],d:["....#","....#",".####","#...#","#...#","#...#",".####"],e:[".....",".....",".###.","#...#","#####","#....",".###."],i:["..#..",".....","..#..","..#..","..#..","..#..","..#.."],n:[".....",".....","#.##.","##..#","#...#","#...#","#...#"],o:[".....",".....",".###.","#...#","#...#","#...#",".###."],r:[".....",".....","#.##.","##..#","#....","#....","#...."],"-":[".....",".....",".....",".###.",".....",".....","....."]});function Ov(n){const r=[];let o=0;for(const a of n.toLocaleLowerCase()){const d=Mv[a];d&&d.forEach((f,p)=>{let g=-1;for(let x=0;x<=jo;x+=1){const w=x<jo&&f[x]==="#";w&&g<0?g=x:!w&&g>=0&&(r.push({x:o+g,y:p,w:x-g}),g=-1)}}),o+=jo+Ua}return r}function Av({text:n,scale:r=2,className:o}){const a=m.useMemo(()=>Ov(n),[n]),d=n.length*(jo+Ua)-Ua;return a.length?i.jsx("svg",{className:o?`pixel-wordmark ${o}`:"pixel-wordmark",viewBox:`0 0 ${d} ${Zd}`,width:d*r,height:Zd*r,shapeRendering:"crispEdges",role:"img","aria-label":n,children:a.map(f=>i.jsx("rect",{x:f.x,y:f.y,width:f.w,height:1,style:{fill:"var(--text)"}},`${f.x}-${f.y}`))}):null}const vr=40;function $v({state:n,drawerOpen:r,dockVisible:o,collapsed:a,resizable:d,width:f,onExpand:p,onCollapse:g,onOpenWorkspaceDialog:x,onOpenSettings:w,onLoadMoreWorkspaces:E,onCreateSession:S,onLoadWorkspaceSessions:P,onActivateContext:R,onSetPinned:$,onRemoveWorkspace:O,onRefreshSummary:F,onRenameSession:te,onSessionTags:L,onArchiveSession:ye,onDeleteSession:J,onRestoreSession:ne,onWidthPreview:N,onWidthCommit:D}){const[Z,X]=m.useState(""),[ie,G]=m.useState(0),[je,ee]=m.useState(new Set(n.workspaceId?[n.workspaceId]:[])),Ce=m.useDeferredValue(Z.trim().toLocaleLowerCase()),A=!!n.pendingAction,me=A||n.processing;m.useEffect(()=>{n.workspaceId&&ee(v=>new Set([...v,n.workspaceId]))},[n.workspaceId]),m.useEffect(()=>G(0),[Ce]);const ve=m.useMemo(()=>{const v=[...n.workspaces].sort(Lv);return Ce?v.filter(M=>tf(M,Ce)?!0:(n.workspaceSessions[M.id]?.items??[]).some(pe=>[pe.name,pe.taskSummary,pe.id].filter(V=>!!V).some(V=>V.toLocaleLowerCase().includes(Ce)))):v},[Ce,n.workspaceSessions,n.workspaces]);m.useEffect(()=>{const v=ve.findIndex(M=>M.id===n.workspaceId);v<0||G(M=>v<M||v>=M+vr?Math.floor(v/vr)*vr:M)},[ve,n.workspaceId]);const W=ve.slice(ie,ie+vr),se=!!(Ce&&(n.workspaceNextCursor||Object.values(n.workspaceSessions).some(v=>!!v.nextCursor))),B=v=>{const M=new Set(je);M.has(v.id)?M.delete(v.id):(M.add(v.id),n.workspaceSessions[v.id]?F(v.id):P(v.id)),ee(M)};if(a&&!r){const v=n.workspaces.find(M=>M.id===n.workspaceId);return i.jsxs("aside",{id:"workspace-rail",className:"workspace-rail project-navigator project-navigator-collapsed","aria-label":"项目与会话",hidden:!o,children:[i.jsx("div",{className:"project-rail-brand","aria-hidden":"true",children:i.jsx(np,{size:22})}),i.jsx("button",{type:"button",className:"icon-button project-rail-action","aria-label":"展开项目导航",title:"展开项目导航(⌘/Ctrl+B)",onClick:p,children:i.jsx(Q,{name:"sidebar",size:17})}),i.jsx("button",{type:"button",className:"icon-button project-rail-action","aria-label":"新建会话",title:"新建会话",onClick:S,disabled:A||!n.workspaceId,children:i.jsx(Q,{name:"add",size:18})}),i.jsx("button",{type:"button",className:"icon-button project-rail-action project-rail-workspace","aria-label":v?`打开项目 ${v.label}`:"打开项目导航",title:v?.label??"打开项目导航",onClick:p,children:i.jsx(Q,{name:"workspace",size:17})}),i.jsx("span",{className:"project-rail-spacer"}),i.jsx("button",{type:"button",className:"icon-button project-rail-action","aria-label":"打开设置",title:"设置",onClick:w,children:i.jsx(Q,{name:"settings",size:17})}),i.jsx("span",{className:`connection-dot project-rail-connection ${n.connection}`,"aria-label":Pa(n.connection),title:Pa(n.connection)})]})}return i.jsxs("aside",{id:"project-navigation",className:`workspace-rail project-navigator ${r?"drawer-open":""}`,"aria-label":"项目与会话",hidden:!o,children:[i.jsxs("div",{className:"project-toolbar",children:[i.jsxs("div",{className:"project-toolbar-brand",children:[i.jsx(Av,{text:"orion-code",scale:2}),i.jsx("h2",{className:"sr-only",children:"项目"})]}),i.jsxs("div",{className:"project-toolbar-actions",children:[i.jsx("button",{type:"button",className:"icon-button","aria-label":"收起项目导航",title:"收起项目导航(⌘/Ctrl+B)",onClick:g,children:i.jsx(Q,{name:"chevron-left"})}),i.jsx("button",{type:"button",className:"icon-button","aria-label":"选择其他工作区",title:"打开其他项目",onClick:x,disabled:me,children:i.jsx(Q,{name:"add"})})]})]}),i.jsxs("label",{className:"project-search",children:[i.jsx("span",{className:"sr-only",children:"搜索项目和会话"}),i.jsx(Q,{name:"search",size:15}),i.jsx("input",{type:"search",value:Z,onChange:v=>X(v.target.value),placeholder:"搜索项目和会话"}),Z?i.jsx("button",{type:"button","aria-label":"清除搜索",onClick:()=>X(""),children:i.jsx(Q,{name:"close",size:13})}):null]}),i.jsxs("nav",{className:"project-tree","aria-label":"已知项目","aria-description":se?"搜索仅覆盖已加载的项目和会话;仍有分页内容未加载。":void 0,children:[W.map((v,M)=>{const pe=ie+M,V=ve[pe-1],oe=je.has(v.id)||!!Ce,ge=n.workspaceSessions[v.id],Se=n.workspaceProjectSummaries[v.id],be=tf(v,Ce)?ge?.items??[]:Dv(ge?.items??[],Ce);return i.jsxs(m.Fragment,{children:[pe===0||V?.pinnedOrder!==void 0&&v.pinnedOrder===void 0?i.jsx("h3",{className:"project-group-heading",role:"presentation",children:v.pinnedOrder===void 0?"RECENT":"PINNED"}):null,i.jsxs("section",{className:`project-node ${v.active?"active":""} ${v.available?"":"unavailable"}`,children:[i.jsxs("div",{className:"project-row",children:[i.jsxs("button",{id:`project-${v.id}`,type:"button",className:"project-toggle","aria-expanded":oe,"aria-controls":`project-${v.id}-sessions`,"aria-current":v.active?"page":void 0,onClick:()=>B(v),onKeyDown:ue=>{if(ue.key==="ArrowRight"){ue.preventDefault(),oe?ue.currentTarget.closest(".project-node")?.querySelector(".project-session-main")?.focus():B(v);return}if(ue.key==="ArrowLeft"&&oe){ue.preventDefault(),B(v);return}ef(ue)},children:[i.jsx(Q,{name:"chevron",size:13}),i.jsx("span",{className:"workspace-icon",children:i.jsx(Q,{name:"workspace",size:15})}),i.jsxs("span",{className:"project-copy",children:[i.jsx("strong",{children:v.label}),i.jsx("span",{title:v.path,children:Se?`${Se.detached?Se.head||"detached":Se.branch||"Git"} · ${Se.dirtyCount?`M${Se.dirtyCount}`:"clean"}`:zv(v.path)})]})]}),i.jsx("button",{type:"button",className:"icon-button project-pin","aria-label":`${v.pinnedOrder===void 0?"置顶":"取消置顶"}项目 ${v.label}`,"aria-pressed":v.pinnedOrder!==void 0,onClick:()=>$(v.id,v.pinnedOrder===void 0),disabled:A,children:i.jsx("span",{"aria-hidden":"true",children:v.pinnedOrder===void 0?"○":"●"})}),!v.available&&!v.active?i.jsx("button",{type:"button",className:"icon-button project-remove","aria-label":`移除不可用项目 ${v.label}`,onClick:()=>O(v.id),disabled:A,children:i.jsx(Q,{name:"close",size:13})}):i.jsx("button",{type:"button",className:"icon-button project-add-session","aria-label":`在 ${v.label} 新建会话`,disabled:A||!v.available||!v.active,onClick:S,title:v.active?"新建会话":"先激活项目后新建会话",children:i.jsx(Q,{name:"add",size:14})})]}),oe?i.jsxs(m.Fragment,{children:[i.jsxs("div",{id:`project-${v.id}-sessions`,className:"project-sessions",role:"list","aria-label":`${v.label} 的会话`,children:[ge?.status==="loading"&&!ge.items.length?i.jsx("p",{className:"project-loading",role:"listitem",children:"正在加载会话…"}):null,ge?.status==="error"?i.jsx("div",{role:"listitem",children:i.jsx("button",{type:"button",className:"project-load-error",onClick:()=>P(v.id),children:"加载失败,重试"})}):null,be.map(ue=>{const Me=v.active&&ue.id===n.activeSessionId,bt=n.sessionRuntimeById[ue.id],ht=Fv(bt),Tt=!v.active&&me,_t=qv(bt?.phase),rt=ue.tags??[];return i.jsxs("div",{className:`project-session-row ${Me?"active":""}`,role:"listitem",children:[i.jsxs("button",{type:"button",className:"project-session-main","aria-current":Me?"page":void 0,"aria-disabled":Me||Tt||!v.available,onClick:()=>{Me||R(v.id,ue.id)},disabled:Tt||!v.available,onKeyDown:Xe=>{if(Xe.key==="ArrowLeft"){Xe.preventDefault(),document.getElementById(`project-${v.id}`)?.focus();return}ef(Xe)},children:[i.jsx("span",{className:`session-state ${ht.tone}`,"aria-hidden":"true"}),i.jsxs("span",{children:[i.jsx("strong",{children:ss(ue)}),i.jsxs("small",{children:[nf(ue.updatedAt)," · ",ue.messageCount," 条"]}),rt.length>0?i.jsxs("small",{className:"project-session-tags","aria-label":"会话标签",children:[rt.slice(0,3).map(Xe=>i.jsx("span",{className:"session-tag-badge",children:Xe},Xe)),rt.length>3?i.jsxs("span",{className:"session-tag-more",children:["+",rt.length-3]}):null]}):null,ht.label?i.jsx("small",{className:"project-session-status",children:ht.label}):null]})]}),v.active?i.jsx(Nv,{label:`会话 ${ss(ue)} 操作`,disabled:A,items:[{id:"rename",label:"重命名…",onSelect:()=>te(ue)},{id:"tags",label:"管理标签…",onSelect:()=>L(ue)},{id:"archive",label:"归档",disabled:_t,hint:_t?"会话运行中":void 0,onSelect:()=>ye(ue)},{id:"delete",label:"删除…",danger:!0,disabled:_t,hint:_t?"会话运行中":void 0,onSelect:()=>J(ue)}]}):null]},ue.id)}),ge?.status==="ready"&&!be.length?i.jsx("div",{role:"listitem",children:i.jsx("button",{type:"button",className:"project-empty-session",disabled:me||!v.available,onClick:()=>R(v.id,null),children:Ce?"没有匹配会话":"打开项目"})}):null,ge?.nextCursor?i.jsx("div",{role:"listitem",children:i.jsx("button",{type:"button",className:"text-button project-load-more",onClick:()=>P(v.id,!0),children:"加载更多会话"})}):null]}),v.active&&(n.archivedSessions.items.length>0||n.archivedSessions.status==="loading")?i.jsxs("details",{className:"archived-section",children:[i.jsxs("summary",{children:["已归档(",n.archivedSessions.items.length,n.archivedSessions.status==="loading"?"…":"",")"]}),i.jsx("div",{className:"archived-list",role:"list","aria-label":"已归档会话",children:n.archivedSessions.items.map(ue=>i.jsxs("div",{className:"archived-row",role:"listitem",children:[i.jsxs("span",{className:"archived-copy",children:[i.jsx("strong",{children:ss(ue)}),i.jsx("small",{children:nf(ue.updatedAt)})]}),i.jsx("button",{type:"button",className:"text-button",disabled:A,onClick:()=>ne(ue),children:"还原"}),i.jsx("button",{type:"button",className:"text-button archived-delete",disabled:A,onClick:()=>J(ue),children:"删除"})]},ue.id))})]}):null]}):null]})]},v.id)}),ve.length?null:i.jsxs("div",{className:"empty-rail",children:[i.jsx(Q,{name:"search"}),i.jsx("p",{children:"没有匹配的项目或会话"})]}),ie>0?i.jsx("button",{type:"button",className:"text-button project-window-more",onClick:()=>G(v=>Math.max(0,v-vr)),children:"上一批项目"}):null,ie+vr<ve.length?i.jsx("button",{type:"button",className:"text-button project-window-more",onClick:()=>G(v=>v+vr),children:"下一批项目"}):n.workspaceNextCursor?i.jsx("button",{type:"button",className:"text-button project-window-more",onClick:E,children:"加载更多项目"}):null]}),i.jsxs("footer",{className:"rail-footer",children:[i.jsx("span",{className:`connection-dot ${n.connection}`,"aria-hidden":"true"}),i.jsx("span",{"data-testid":"runtime-connection-state","data-state":n.connection,title:Wv(n.connection),children:Pa(n.connection)}),i.jsx("button",{type:"button",className:"icon-button rail-settings","aria-label":"打开设置",onClick:w,children:i.jsx(Q,{name:"settings",size:14})}),n.bootstrap?.productVersion?i.jsxs("span",{className:"version",children:["v",n.bootstrap.productVersion]}):null]}),d?i.jsx(Gf,{side:"left",minWidth:Xa,maxWidth:Qf,defaultWidth:Do,label:"拖动或按方向键调整项目导航宽度",width:f,controls:"workspace-rail",onPreview:N,onCommit:D}):null]})}function ef(n){if(!["ArrowDown","ArrowUp","Home","End"].includes(n.key))return;const r=n.currentTarget.closest(".project-tree");if(!r)return;const o=Array.from(r.querySelectorAll(".project-toggle:not(:disabled), .project-session-main:not(:disabled)")).filter(f=>f.getClientRects().length>0),a=o.indexOf(n.currentTarget);if(a<0||o.length===0)return;const d=n.key==="Home"?0:n.key==="End"?o.length-1:Math.max(0,Math.min(o.length-1,a+(n.key==="ArrowDown"?1:-1)));n.preventDefault(),o[d]?.focus()}function Lv(n,r){return n.pinnedOrder!==void 0||r.pinnedOrder!==void 0?n.pinnedOrder===void 0?1:r.pinnedOrder===void 0?-1:n.pinnedOrder-r.pinnedOrder:Date.parse(r.lastActivatedAt)-Date.parse(n.lastActivatedAt)}function tf(n,r){return!!(r&&(n.label.toLocaleLowerCase().includes(r)||n.path.toLocaleLowerCase().includes(r)))}function Dv(n,r){return r?n.filter(o=>[o.name,o.taskSummary,o.id,o.model].filter(a=>!!a).some(a=>a.toLocaleLowerCase().includes(r))):n}function ss(n){return n.name||n.taskSummary||`会话 ${n.id.slice(0,8)}`}function rp(n){const r=n.replace(/[\\/]+$/,"");return r.split(/[\\/]/).filter(Boolean).at(-1)??r}function zv(n){return n.length<=31?n:`…${n.slice(-30)}`}function nf(n){const r=Date.parse(n);if(!Number.isFinite(r))return"未知";const o=Math.max(0,Math.floor((Date.now()-r)/6e4));if(o<1)return"刚刚";if(o<60)return`${o} 分钟前`;const a=Math.floor(o/60);if(a<24)return`${a} 小时前`;const d=Math.floor(a/24);return d<30?`${d} 天前`:new Date(r).toLocaleDateString("zh-CN")}function Pa(n){return n==="live"?"已连接":n==="offline"?"离线":n==="replay-required"?"事件流需恢复":n==="closed"?"已关闭":n==="connecting"?"正在连接…":"正在重连…"}function Wv(n){return n==="live"?"本地 Web Host 已连接":n==="offline"?"浏览器离线":n==="replay-required"?"Web Host 事件流需要恢复":n==="closed"?"本地 Web Host 已关闭":n==="connecting"?"正在连接本地 Web Host":"正在重连本地 Web Host"}function Fv(n){return!n||n.phase==="cold"?{label:"",tone:""}:n.pendingApprovalCount>0||n.phase==="waiting_approval"?{label:"等待审批",tone:"approval"}:n.phase==="running"||n.phase==="starting"?{label:n.phase==="starting"?"正在启动":"运行中",tone:"running"}:n.phase==="queued"?{label:n.queuePosition?`排队 ${n.queuePosition}`:"排队中",tone:"queued"}:n.phase==="failed"?{label:"失败",tone:"failed"}:n.phase==="interrupted"?{label:"已中断",tone:"failed"}:n.phase==="stopping"?{label:"正在停止",tone:"running"}:{label:"已就绪",tone:"ready"}}const Bv=new Set(["starting","queued","running","waiting_approval","stopping"]);function qv(n){return n?Bv.has(n):!1}function ti({open:n,onClose:r,labelledBy:o,describedBy:a,className:d="",children:f}){const p=m.useRef(null);m.useEffect(()=>{const x=p.current;x&&(n&&!x.open&&x.showModal(),!n&&x.open&&x.close())},[n]);const g=x=>{x.target===x.currentTarget&&r()};return i.jsx("dialog",{ref:p,className:`modal ${d}`.trim(),"aria-labelledby":o,"aria-describedby":a,onCancel:x=>{x.preventDefault(),r()},onClose:r,onClick:g,children:f})}function Uv({open:n,onClose:r,state:o,onSelect:a,onLoadMore:d}){const[f,p]=m.useState(""),[g,x]=m.useState(""),[w,E]=m.useState(!1),[S,P]=m.useState(!1);m.useEffect(()=>{n&&(p(""),x(""),E(!1),P(!1))},[n]);const R=!!o.pendingAction||w,$=o.workspaces.slice(0,3),O=o.workspaces.slice(3),F=async L=>{const ye=L.trim();if(ye){if(ye===o.workspace){x("该目录已经是当前工作区。");return}x(""),E(!0);try{await a(ye),r()}catch(J){x(J instanceof Error?J.message:"工作区切换失败。")}finally{E(!1)}}},te=L=>{L.preventDefault(),F(f)};return i.jsxs(ti,{open:n,onClose:r,labelledBy:"workspace-dialog-title",describedBy:"workspace-dialog-description",className:"workspace-modal",children:[i.jsxs("div",{className:"modal-header",children:[i.jsxs("div",{children:[i.jsx("span",{className:"eyebrow",children:"LOCAL WORKSPACE"}),i.jsx("h2",{id:"workspace-dialog-title",children:"打开或新增项目"}),i.jsx("p",{id:"workspace-dialog-description",children:"选择一个本地目录作为项目;Host 会解析真实路径并拒绝无效目录。"})]}),i.jsx("button",{type:"button",className:"icon-button",onClick:r,"aria-label":"关闭工作区选择",children:i.jsx(Q,{name:"close"})})]}),i.jsxs("div",{className:"workspace-options",role:"group","aria-label":"常用工作区",children:[$.map(L=>i.jsx(rf,{workspace:L,locked:R,onSelect:F},L.id)),O.length>0?i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:"text-button workspace-toggle-all","aria-expanded":S,onClick:()=>P(L=>!L),children:S?"收起其他工作区":`其他工作区(${O.length})`}),S?O.map(L=>i.jsx(rf,{workspace:L,locked:R,onSelect:F},L.id)):null]}):null,o.workspaceNextCursor?i.jsx("button",{type:"button",className:"text-button",onClick:()=>{d()},disabled:R,children:"加载更多工作区"}):null]}),i.jsxs("form",{className:"workspace-path-form",onSubmit:te,children:[i.jsx("label",{htmlFor:"workspace-path-input",children:"打开其他本地目录"}),i.jsxs("div",{className:"path-input-row",children:[i.jsx("input",{id:"workspace-path-input",value:f,onChange:L=>{p(L.target.value),g&&x("")},placeholder:"/Users/name/project",spellCheck:!1,autoComplete:"off"}),i.jsx("button",{type:"submit",className:"primary-button",disabled:!f.trim()||R,children:w?"打开中…":"打开"})]}),g?i.jsx("p",{className:"field-error",role:"alert",children:g}):null]})]})}function rf({workspace:n,locked:r,onSelect:o}){return i.jsxs("button",{type:"button",className:`workspace-option ${n.active?"active":""}`,disabled:n.active||!n.available||r,onClick:()=>{o(n.path)},children:[i.jsx("span",{className:"workspace-icon",children:i.jsx(Q,{name:"workspace",size:17})}),i.jsxs("span",{children:[i.jsx("strong",{children:n.label||rp(n.path)}),i.jsx("small",{title:n.path,children:n.path})]}),n.active?i.jsx("span",{className:"current-pill",children:"当前"}):n.available?i.jsx(Q,{name:"chevron",size:15}):i.jsx("span",{className:"current-pill",children:"不可用"})]})}function Hv({open:n,onClose:r,session:o,pending:a,onRename:d}){const[f,p]=m.useState(""),[g,x]=m.useState(""),w=o?.id;m.useEffect(()=>{n&&o&&(p(ss(o)),x(""))},[n,w]);const E=async S=>{if(S.preventDefault(),!(!o||!f.trim())){x("");try{await d(o.id,f.trim()),r()}catch(P){x(P instanceof Error?P.message:"重命名失败,请重试。")}}};return i.jsx(ti,{open:n,onClose:r,labelledBy:"rename-title",className:"rename-modal",children:i.jsxs("form",{onSubmit:E,children:[i.jsxs("header",{className:"modal-header",children:[i.jsxs("div",{children:[i.jsx("span",{className:"eyebrow",children:"SESSION"}),i.jsx("h2",{id:"rename-title",children:"重命名会话"})]}),i.jsx("button",{type:"button",className:"icon-button",onClick:r,"aria-label":"关闭重命名窗口",children:i.jsx(Q,{name:"close"})})]}),i.jsxs("div",{className:"rename-body",children:[i.jsx("label",{htmlFor:"session-name",children:"会话名称"}),i.jsx("input",{id:"session-name",value:f,onChange:S=>{p(S.target.value),g&&x("")},maxLength:120,autoFocus:!0}),g?i.jsx("p",{className:"field-error",role:"alert",children:g}):null]}),i.jsxs("footer",{className:"modal-footer",children:[i.jsx("button",{type:"button",className:"secondary-button",onClick:r,children:"取消"}),i.jsx("button",{type:"submit",className:"primary-button",disabled:a||!f.trim(),children:a?"保存中…":"保存"})]})]})})}const sf=8;function Vv({open:n,onClose:r,session:o,pending:a,onSave:d}){const[f,p]=m.useState(()=>o?.tags?[...o.tags]:[]),[g,x]=m.useState(""),[w,E]=m.useState(""),S=o?.id;m.useEffect(()=>{n&&o&&(p(o.tags??[]),x(""),E(""))},[n,S]);const P=()=>{const O=g.trim().slice(0,32);if(x(""),!!O&&!f.includes(O)){if(f.length>=sf){E(`最多 ${sf} 个标签。`);return}p([...f,O]),E("")}},R=O=>p(f.filter(F=>F!==O)),$=async O=>{if(O.preventDefault(),!!o){E("");try{await d(o.id,f),r()}catch(F){E(F instanceof Error?F.message:"保存标签失败,请重试。")}}};return i.jsx(ti,{open:n,onClose:r,labelledBy:"session-tags-title",className:"tags-modal",children:i.jsxs("form",{onSubmit:$,children:[i.jsxs("header",{className:"modal-header",children:[i.jsxs("div",{children:[i.jsx("span",{className:"eyebrow",children:"SESSION"}),i.jsx("h2",{id:"session-tags-title",children:"管理会话标签"})]}),i.jsx("button",{type:"button",className:"icon-button",onClick:r,"aria-label":"关闭标签窗口",children:i.jsx(Q,{name:"close"})})]}),i.jsxs("div",{className:"session-tags-body",children:[o?i.jsx("p",{className:"modal-description",children:ss(o)}):null,i.jsx("div",{className:"session-tags-chips",role:"list","aria-label":"当前标签",children:f.length===0?i.jsx("span",{className:"session-tags-empty",children:"还没有标签,输入后回车添加。"}):f.map(O=>i.jsxs("span",{className:"session-tag-chip",role:"listitem",children:[O,i.jsx("button",{type:"button",className:"icon-button session-tag-remove","aria-label":`移除标签 ${O}`,onClick:()=>R(O),children:i.jsx(Q,{name:"close",size:11})})]},O))}),i.jsx("label",{htmlFor:"session-tag-input",children:"新标签"}),i.jsx("input",{id:"session-tag-input",value:g,onChange:O=>{x(O.target.value),w&&E("")},onKeyDown:O=>{(O.key==="Enter"||O.key===","||O.key===",")&&(O.preventDefault(),P())},placeholder:"回车或逗号添加",maxLength:32,autoFocus:!0}),w?i.jsx("p",{className:"field-error",role:"alert",children:w}):null]}),i.jsxs("footer",{className:"modal-footer",children:[i.jsx("button",{type:"button",className:"secondary-button",onClick:r,children:"取消"}),i.jsx("button",{type:"submit",className:"primary-button",disabled:a,children:a?"保存中…":"保存"})]})]})})}function Kv({open:n,onClose:r,title:o,body:a,confirmLabel:d,danger:f=!1,pending:p=!1,onConfirm:g}){const x=m.useId(),w=async()=>{if(!p)try{await g(),r()}catch{}};return i.jsxs(ti,{open:n,onClose:r,labelledBy:x,className:"confirm-modal",children:[i.jsxs("header",{className:"modal-header",children:[i.jsx("h2",{id:x,children:o}),i.jsx("button",{type:"button",className:"icon-button",onClick:r,"aria-label":"关闭确认窗口",children:i.jsx(Q,{name:"close"})})]}),i.jsx("p",{className:"confirm-body",children:a}),i.jsxs("footer",{className:"modal-footer",children:[i.jsx("button",{type:"button",className:"secondary-button",autoFocus:!0,onClick:r,children:"取消"}),i.jsx("button",{type:"button",className:f?"danger-button":"primary-button",disabled:p,onClick:()=>{w()},children:p?"处理中…":d})]})]})}function Gv({open:n,onClose:r,session:o,pending:a,onConfirm:d}){const f=async()=>{if(o)try{await d(o.id),r()}catch{}};return i.jsxs(ti,{open:n,onClose:r,labelledBy:"confirm-delete-title",describedBy:"confirm-delete-description",className:"delete-modal",children:[i.jsxs("div",{className:"modal-header",children:[i.jsxs("div",{children:[i.jsx("span",{className:"eyebrow",children:"SESSION"}),i.jsx("h2",{id:"confirm-delete-title",children:"删除会话"})]}),i.jsx("button",{type:"button",className:"icon-button",onClick:r,"aria-label":"关闭删除确认",children:i.jsx(Q,{name:"close"})})]}),i.jsxs("p",{id:"confirm-delete-description",className:"confirm-delete-body",children:["将永久删除会话",i.jsx("strong",{children:o?`「${ss(o)}」`:""}),"及其全部记录(消息、文件变更、目标与检查点)。此操作不可恢复。"]}),i.jsxs("footer",{className:"modal-footer",children:[i.jsx("button",{type:"button",className:"secondary-button",onClick:r,children:"取消"}),i.jsx("button",{type:"button",className:"danger-button",disabled:a,onClick:()=>{f()},children:a?"删除中…":"永久删除"})]})]})}const Qv=["appearance.style","appearance.theme","appearance.motion","defaults.model","defaults.effort","permissions.toolConfirmation"];function _o(n,r){return r==="appearance.style"?n.sections.appearance.style:r==="appearance.theme"?n.sections.appearance.theme:r==="appearance.motion"?n.sections.appearance.motion:r==="defaults.model"?n.sections.defaults.model:r==="defaults.effort"?n.sections.defaults.effort:n.sections.permissions.toolConfirmation}function Yv(n){return{"appearance.style":n.sections.appearance.style.effectiveValue,"appearance.theme":n.sections.appearance.theme.effectiveValue,"appearance.motion":n.sections.appearance.motion.effectiveValue,"defaults.model":n.sections.defaults.model.effectiveValue,"defaults.effort":n.sections.defaults.effort.effectiveValue,"permissions.toolConfirmation":n.sections.permissions.toolConfirmation.effectiveValue}}function xr(n){return{openedAtRevision:n.revision,workspace:n.workspace,base:n,values:ey(n),intents:{},serverLatest:null}}function sp(n,r,o){const a=En(n.base,r),d={...n.values,[r]:o},f={...n.intents};return Object.is(o,a)?delete f[r]:f[r]={op:"set",value:o},{...n,values:d,intents:f,serverLatest:null}}function ip(n,r){const o=_o(n.base,r),a={...n.intents};return o.explicitValue===void 0?(delete a[r],{...n,values:{...n.values,[r]:En(n.base,r)},intents:a,serverLatest:null}):(a[r]={op:"unset"},{...n,values:{...n.values,[r]:o.inheritedValue??o.effectiveValue},intents:a,serverLatest:null})}function of(n,r){return{...n,serverLatest:r}}function Xv(n){const r=n.serverLatest;if(!r)return n;let o=xr(r);for(const a of Sr(n)){const d=n.intents[a];if(d){if(d.op==="unset"){o=ip(o,a);continue}o=sp(o,a,d.value)}}return o}function Sr(n){return Qv.filter(r=>n.intents[r]!==void 0)}function Jv(n){return Sr(n).map(r=>{const o=n.intents[r];return o.op==="unset"?{op:"unset",key:r}:{op:"set",key:r,value:o.value}})}function Zv(n){return n.serverLatest?Sr(n).filter(r=>{const o=_o(n.base,r),a=_o(n.serverLatest,r);return!Object.is(o.effectiveValue,a.effectiveValue)||!Object.is(o.explicitValue,a.explicitValue)||o.overridden!==a.overridden||o.source!==a.source}):[]}function En(n,r){const o=_o(n,r);return o.explicitValue??o.effectiveValue}function ey(n){const r=Yv(n);return{"appearance.style":En(n,"appearance.style")??r["appearance.style"],"appearance.theme":En(n,"appearance.theme")??r["appearance.theme"],"appearance.motion":En(n,"appearance.motion")??r["appearance.motion"],"defaults.model":En(n,"defaults.model")??r["defaults.model"],"defaults.effort":En(n,"defaults.effort")??r["defaults.effort"],"permissions.toolConfirmation":En(n,"permissions.toolConfirmation")??r["permissions.toolConfirmation"]}}const Io={phase:"closed",section:"general",draft:null,message:null,problemCode:null,confirmDiscard:!1};function ty(n,r){switch(r.type){case"open":return{...Io,phase:"ready",draft:xr(r.document)};case"close":return Io;case"select_section":return{...n,section:r.section,confirmDiscard:!1};case"set_value":return!n.draft||n.phase==="saving"?n:{...n,phase:"ready",draft:sp(n.draft,r.key,r.value),message:null,problemCode:null,confirmDiscard:!1};case"reset_value":return!n.draft||n.phase==="saving"?n:{...n,phase:"ready",draft:ip(n.draft,r.key),message:null,problemCode:null,confirmDiscard:!1};case"save_started":return{...n,phase:"saving",message:"正在原子应用设置…",problemCode:null,confirmDiscard:!1};case"save_succeeded":return{...n,phase:"success",draft:xr(r.document),message:"设置已安全保存并应用。",problemCode:null,confirmDiscard:!1};case"save_failed":{if(!n.draft)return n;const o=r.code==="settings_revision_conflict";return{...n,phase:o?"conflict":"rejected",draft:r.latest?of(n.draft,r.latest):n.draft,message:r.message,problemCode:r.code,confirmDiscard:!1}}case"server_updated":{if(!n.draft)return{...n,phase:"ready",draft:xr(r.document)};if(n.phase==="saving")return n;if(n.draft.base.revision===r.document.revision){const o=Sr(n.draft).length>0;return{...n,draft:o?{...n.draft,base:r.document}:xr(r.document)}}return n.draft.workspace!==r.document.workspace||Sr(n.draft).length===0?{...n,phase:"ready",draft:xr(r.document),message:"已采用 Host 的最新设置。",problemCode:null,confirmDiscard:!1}:{...n,phase:"conflict",draft:of(n.draft,r.document),message:"Host 设置已更新。你的草稿仍被保留,请选择如何继续。",problemCode:"settings_revision_conflict",confirmDiscard:!1}}case"adopt_server":return n.draft?.serverLatest?{...n,phase:"ready",draft:xr(n.draft.serverLatest),message:"已采用服务器最新值。",problemCode:null}:n;case"rebase":return n.draft?.serverLatest?{...n,phase:"ready",draft:Xv(n.draft),message:"草稿已基于服务器最新值重放;请确认后再次应用。",problemCode:null}:n;case"request_discard":return{...n,confirmDiscard:!0};case"cancel_discard":return{...n,confirmDiscard:!1};case"clear_status":return{...n,phase:"ready",message:null,problemCode:null}}}const ny=["auto","none","minimal","low","medium","high","xhigh","max"],ry=[{id:"general",label:"General",icon:"settings"},{id:"models",label:"Models & Reasoning",icon:"spark"},{id:"permissions",label:"Permissions",icon:"warning"},{id:"advanced",label:"Advanced",icon:"diagnostics"}];function sy({open:n,onClose:r,state:o,actions:a,onGoToSessionControls:d}){const f=m.useRef(null),p=m.useRef(null),g=m.useRef(null),x=m.useRef(null),w=m.useRef(null),E=m.useRef(!1),S=m.useRef(null),P=m.useRef(Io.phase),[R,$]=m.useReducer(ty,Io),[O,F]=m.useState(!1),[te,L]=m.useState(!1),[ye,J]=m.useState(null),ne=o.settings??o.settingsMirror.lastGood,N=ne&&(!o.workspace||ne.workspace===o.workspace)?ne:null;m.useEffect(()=>{const A=f.current;A&&(n&&!A.open&&A.showModal(),!n&&A.open&&A.close())},[n]),m.useEffect(()=>{if(n&&!E.current)N&&($({type:"open",document:N}),w.current=N),F(!1),L(!1),J(null);else if(n&&N&&w.current===null)$({type:"open",document:N}),w.current=N;else if(n&&N&&w.current!==null&&w.current!==N){if(R.phase==="saving")return;w.current=N,$({type:"server_updated",document:N})}else!n&&E.current&&($({type:"close"}),w.current=null,S.current=null);E.current=n},[N,R.phase,n]),m.useEffect(()=>{R.confirmDiscard&&g.current?.focus()},[R.confirmDiscard]),m.useEffect(()=>{const A=P.current;if(P.current=R.phase,!n||A!=="saving"||R.phase!=="success")return;const me=uf();f.current?.contains(me)||p.current?.focus()},[R.phase,n]),m.useEffect(()=>{!n||N||o.settingsMirror.status==="loading"||a.refreshSettings().catch(()=>{})},[a,N,n,o.settingsMirror.status]),m.useEffect(()=>{!n||!R.draft||!o.workspace||R.draft.workspace!==o.workspace&&($({type:"close"}),w.current=null)},[R.draft,n,o.workspace]);const D=R.draft,Z=D?Sr(D):[],X=Z.length>0,ie=o.processing&&Z.some(A=>["defaults.effort","permissions.toolConfirmation"].includes(A)),G=()=>{if(R.phase!=="saving"){if(X){const A=uf();x.current=A instanceof HTMLElement?A:null,$({type:"request_discard"});return}$({type:"close"}),r()}},je=()=>{$({type:"close"}),r()},ee=async A=>{if(A.preventDefault(),!D||!X||R.phase==="saving"||R.phase==="conflict")return;const me=Jv(D),ve=S.current??ze();S.current=ve,$({type:"save_started"});try{const W=await a.updateSettings(D.base.revision,me,ve);S.current=null,w.current=W.settings,$({type:"save_succeeded",document:W.settings})}catch(W){const se=W instanceof Ie?W.code??"settings_rejected":"network";let B;se==="settings_revision_conflict"?(S.current=null,B=await a.refreshSettings().catch(()=>{}),B&&(w.current=B)):W instanceof Ie&&W.status<500&&(S.current=null);const v=se==="settings_revision_conflict"&&!B?"settings_recovery_required":se;$({type:"save_failed",code:v,message:fy(v,W),...B?{latest:B}:{}})}},Ce=A=>{A.target===A.currentTarget&&G()};return i.jsx("dialog",{id:"settings-dialog",ref:f,className:"modal settings-modal","aria-modal":"true","aria-labelledby":"settings-title","aria-describedby":"settings-description",onCancel:A=>{A.preventDefault(),G()},onClick:Ce,children:i.jsxs("form",{onSubmit:ee,children:[i.jsxs("header",{className:"modal-header settings-header",children:[i.jsxs("div",{children:[i.jsx("span",{className:"eyebrow",children:"HOST SETTINGS"}),i.jsx("h2",{id:"settings-title",children:"设置"}),i.jsx("p",{id:"settings-description",children:"由本地 Host 读取、校验并原子保存。"})]}),i.jsx("button",{ref:p,type:"button",className:"icon-button",onClick:G,"aria-label":"关闭设置",disabled:R.phase==="saving",children:i.jsx(Q,{name:"close"})})]}),i.jsxs("div",{className:"settings-layout",children:[i.jsx("nav",{className:"settings-navigation","aria-label":"设置类别",children:ry.map(A=>i.jsxs("button",{type:"button",className:R.section===A.id?"active":"","aria-current":R.section===A.id?"page":void 0,onClick:()=>$({type:"select_section",section:A.id}),children:[i.jsx(Q,{name:A.icon,size:16}),i.jsx("span",{children:A.label})]},A.id))}),i.jsxs("div",{className:"settings-content",children:[i.jsx(uy,{state:o}),D?i.jsxs(i.Fragment,{children:[R.phase==="conflict"?i.jsx(dy,{draft:D,onAdopt:()=>{S.current=null,$({type:"adopt_server"})},onRebase:()=>{S.current=null,$({type:"rebase"})}}):null,R.message&&R.phase!=="conflict"?i.jsxs("div",{className:`settings-inline-message settings-message-${R.phase}`,role:R.phase==="rejected"?"alert":"status","aria-live":R.phase==="rejected"?"assertive":"polite",children:[i.jsx(Q,{name:R.phase==="success"?"check":"info",size:16}),i.jsx("span",{children:R.message})]}):null,R.section==="general"?i.jsx(iy,{document:D.base,draft:D.values,dirtyKeys:Z,saving:R.phase==="saving",onSet:(A,me)=>$({type:"set_value",key:A,value:me}),onReset:A=>$({type:"reset_value",key:A})}):null,R.section==="models"?i.jsx(ly,{document:D.base,draft:D.values,dirtyKeys:Z,runtimeBusy:o.processing,saving:R.phase==="saving",onGoToSessionControls:d,onSet:(A,me)=>$({type:"set_value",key:A,value:me}),onReset:A=>$({type:"reset_value",key:A})}):null,R.section==="permissions"?i.jsx(ay,{document:D.base,value:D.values["permissions.toolConfirmation"],dirtyKeys:Z,runtimeBusy:o.processing,saving:R.phase==="saving",confirmAllow:O,allowAcknowledged:te,onAllowRequested:()=>{L(!1),F(!0)},onAllowAcknowledged:L,onConfirmAllow:()=>{$({type:"set_value",key:"permissions.toolConfirmation",value:"allow"}),F(!1),L(!1)},onCancelAllow:()=>{F(!1),L(!1)},onSet:A=>$({type:"set_value",key:"permissions.toolConfirmation",value:A}),onReset:()=>$({type:"reset_value",key:"permissions.toolConfirmation"})}):null,R.section==="advanced"?i.jsx(cy,{state:o,document:D.base,documentAction:ye,onOpenDocument:()=>{J({tone:"status",message:"正在请求 Host 打开设置文件…"}),a.openSettingsDocument().then(()=>J({tone:"status",message:"已交给系统默认编辑器打开。"})).catch(A=>J({tone:"error",message:A instanceof Error?A.message:"无法打开设置文件。"}))},onRefresh:()=>{J({tone:"status",message:"正在重新载入 Host 设置…"}),a.refreshSettings().then(()=>J({tone:"status",message:"已载入最新设置。"})).catch(A=>J({tone:"error",message:A instanceof Error?A.message:"重新载入失败。"}))}}):null]}):i.jsxs("section",{className:"settings-empty","aria-live":"polite",children:[i.jsx(Q,{name:"refresh"}),i.jsx("h3",{children:"正在读取设置"}),i.jsx("p",{children:"等待本地 Host 返回可验证的设置快照。"})]})]})]}),R.confirmDiscard?i.jsxs("div",{className:"settings-discard-confirm",role:"alertdialog","aria-labelledby":"settings-discard-title","aria-describedby":"settings-discard-description",children:[i.jsxs("div",{children:[i.jsx("strong",{id:"settings-discard-title",children:"放弃未应用的更改?"}),i.jsxs("p",{id:"settings-discard-description",children:["你的 ",Z.length," 项草稿尚未写入 Host。"]})]}),i.jsxs("div",{children:[i.jsx("button",{ref:g,type:"button",className:"secondary-button",onClick:()=>{$({type:"cancel_discard"});const A=x.current;requestAnimationFrame(()=>A?.focus())},children:"继续编辑"}),i.jsx("button",{type:"button",className:"danger-ghost-button",onClick:je,children:"放弃更改"})]})]}):null,i.jsxs("footer",{className:"modal-footer settings-footer",children:[i.jsx("span",{className:"settings-dirty-summary","aria-live":"polite",children:X?`${Z.length} 项未应用`:"没有未应用的更改"}),i.jsx("button",{type:"button",className:"secondary-button",onClick:G,disabled:R.phase==="saving",children:"取消"}),i.jsx("button",{type:"submit",className:"primary-button",disabled:!D||!X||R.phase==="saving"||R.phase==="conflict"||ie||D.base.state!=="ready"||!D.base.writable,children:R.phase==="saving"?"应用中…":`应用 ${Z.length} 项`})]})]})})}function iy({document:n,draft:r,dirtyKeys:o,saving:a,onSet:d,onReset:f}){const p=n.sections.appearance.style,g=n.sections.appearance.theme,x=n.sections.appearance.motion;return i.jsxs(zo,{heading:"通用",detail:"外观偏好由 Host 保存,并在所有 Workbench 窗口保持一致。",children:[i.jsx(is,{id:"settings-style",label:"视觉风格",description:"选择内置的方块工坊外观,或切回经典工作台。",field:p,dirty:o.includes("appearance.style"),onReset:()=>f("appearance.style"),disabled:a||!en(n,p),children:i.jsxs("select",{id:"settings-style",value:r["appearance.style"],disabled:a||!en(n,p),onChange:w=>d("appearance.style",w.target.value),children:[i.jsx("option",{value:"orion-blocksmith",children:"方块工坊(内置,默认)"}),i.jsx("option",{value:"classic",children:"经典"})]})}),i.jsx(is,{id:"settings-theme",label:"主题",description:"跟随系统或固定使用浅色、深色。",field:g,dirty:o.includes("appearance.theme"),onReset:()=>f("appearance.theme"),disabled:a||!en(n,g),children:i.jsxs("select",{id:"settings-theme",value:r["appearance.theme"],disabled:a||!en(n,g),onChange:w=>d("appearance.theme",w.target.value),children:[i.jsx("option",{value:"system",children:"跟随系统"}),i.jsx("option",{value:"dark",children:"深色"}),i.jsx("option",{value:"light",children:"浅色"})]})}),i.jsxs("figure",{className:"appearance-preview","data-preview-style":r["appearance.style"],"data-preview-theme":r["appearance.theme"],"aria-label":`外观预览:${r["appearance.style"]==="orion-blocksmith"?"方块工坊":"经典工作台"},${oy(r["appearance.theme"])}`,children:[i.jsxs("div",{className:"appearance-preview-frame","aria-hidden":"true",children:[i.jsx("span",{className:"appearance-preview-rail"}),i.jsxs("span",{className:"appearance-preview-main",children:[i.jsx("i",{}),i.jsx("i",{})]}),i.jsx("span",{className:"appearance-preview-panel"})]}),i.jsx("figcaption",{children:"纯 CSS 预览 · 均为内置外观,不支持安装或卸载。"})]}),i.jsx(is,{id:"settings-motion",label:"动效",description:"减少非必要动画,保留状态变化。",field:x,dirty:o.includes("appearance.motion"),onReset:()=>f("appearance.motion"),disabled:a||!en(n,x),children:i.jsxs("select",{id:"settings-motion",value:r["appearance.motion"],disabled:a||!en(n,x),onChange:w=>d("appearance.motion",w.target.value),children:[i.jsx("option",{value:"system",children:"跟随系统"}),i.jsx("option",{value:"reduced",children:"减少动效"})]})})]})}function oy(n){return n==="light"?"浅色":n==="dark"?"深色":"跟随系统"}function ly({document:n,draft:r,dirtyKeys:o,saving:a,runtimeBusy:d,onSet:f,onReset:p,onGoToSessionControls:g}){const x=n.sections.defaults.model,w=n.sections.defaults.effort,E=n.models.some(S=>S.id===r["defaults.model"])?n.models:[{id:r["defaults.model"],label:r["defaults.model"]},...n.models];return i.jsxs(zo,{heading:"模型与推理",detail:"项目默认值通常从下一逻辑请求开始生效;当前会话覆盖保持可见。",children:[d?i.jsx(op,{detail:"当前回合正在运行;项目推理强度暂时锁定,默认模型仍可用于新会话。"}):null,i.jsx(is,{id:"settings-model",label:"默认模型",description:"仅展示 Host 提供的可用模型标识。",field:x,dirty:o.includes("defaults.model"),onReset:()=>p("defaults.model"),disabled:a||!en(n,x),children:i.jsx("select",{id:"settings-model",value:r["defaults.model"],disabled:a||!en(n,x),onChange:S=>f("defaults.model",S.target.value),children:E.map(S=>i.jsxs("option",{value:S.id,children:[S.label,S.provider?` · ${S.provider}`:""]},S.id))})}),i.jsx(is,{id:"settings-effort",label:"默认推理强度",description:"模型不支持的强度会由 Host 拒绝,不会静默降级。",field:w,dirty:o.includes("defaults.effort"),onReset:()=>p("defaults.effort"),disabled:a||d||!en(n,w),children:i.jsx("select",{id:"settings-effort",value:r["defaults.effort"],disabled:a||d||!en(n,w),onChange:S=>f("defaults.effort",S.target.value),children:ny.map(S=>i.jsx("option",{value:S,children:S==="auto"?"Auto":S},S))})}),n.currentSession?i.jsxs("div",{className:"settings-readonly-card","aria-label":"当前会话设置",children:[i.jsxs("div",{children:[i.jsx("span",{children:"当前会话"}),i.jsx("strong",{children:n.currentSession.model})]}),i.jsxs("div",{children:[i.jsx("span",{children:"Effort"}),i.jsx("strong",{children:n.currentSession.effort})]}),i.jsx("p",{children:n.currentSession.overridesProjectEffort?"当前会话覆盖了项目推理强度。":"当前会话沿用项目默认值。"}),i.jsx("small",{children:"可在会话输入框使用 /model 或 /effort 调整当前会话。"}),i.jsx("button",{type:"button",className:"text-button",onClick:g,"aria-controls":"orion-composer",children:"转到会话控制"})]}):null,i.jsxs("div",{className:"credential-note",children:[i.jsx(Q,{name:"check",size:16}),i.jsxs("div",{children:[i.jsx("strong",{children:"凭证始终留在 Host"}),i.jsx("p",{children:"浏览器只接收 ready / missing / unavailable 状态,不提供 API Key 输入框。"})]})]})]})}function ay({document:n,value:r,dirtyKeys:o,runtimeBusy:a,saving:d,confirmAllow:f,allowAcknowledged:p,onAllowRequested:g,onAllowAcknowledged:x,onConfirmAllow:w,onCancelAllow:E,onSet:S,onReset:P}){const R=m.useRef(null),$=m.useRef(null),O=n.sections.permissions.toolConfirmation,F=d||a||!en(n,O);return m.useEffect(()=>{f&&$.current?.focus()},[f]),i.jsxs(zo,{heading:"权限",detail:"默认确认策略不改变工作区边界、硬拒绝和高风险保护。",children:[a?i.jsx(op,{}):null,i.jsx(is,{id:"settings-tool-confirmation",label:"工具确认",description:"Ask 逐次询问;Deny 默认拒绝;Allow 仍受 Host 安全策略约束。",field:O,labelControl:!1,dirty:o.includes("permissions.toolConfirmation"),onReset:P,disabled:F,children:i.jsxs("fieldset",{id:"settings-tool-confirmation",className:"segmented-field",disabled:F,children:[i.jsx("legend",{className:"sr-only",children:"默认工具确认策略"}),["ask","allow","deny"].map(te=>i.jsxs("label",{children:[i.jsx("input",{ref:te==="allow"?R:void 0,type:"radio",name:"settings-permission",value:te,checked:r===te,onChange:()=>te==="allow"?g():S(te)}),i.jsx("span",{children:te==="ask"?"Ask":te==="allow"?"Allow":"Deny"})]},te))]})}),f?i.jsxs("div",{className:"settings-risk-confirm",role:"alertdialog","aria-labelledby":"allow-confirm-title","aria-describedby":"allow-confirm-description",children:[i.jsx("strong",{id:"allow-confirm-title",children:"确认启用 Allow"}),i.jsx("p",{id:"allow-confirm-description",children:"Orion 会减少常规工具询问,但硬拒绝、工作区边界和风险检查仍然生效。"}),i.jsxs("label",{children:[i.jsx("input",{ref:$,type:"checkbox",checked:p,onChange:te=>x(te.target.checked)}),i.jsx("span",{children:"我理解这会扩大默认授权范围"})]}),i.jsxs("div",{children:[i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{E(),requestAnimationFrame(()=>R.current?.focus())},children:"保持当前策略"}),i.jsx("button",{type:"button",className:"primary-button",disabled:!p,onClick:w,children:"启用 Allow"})]})]}):null,i.jsx("p",{className:"settings-help",children:"Agent 的 BUILD / PLAN / AUTO 模式与工具确认策略互相独立。"})]})}function cy({state:n,document:r,documentAction:o,onOpenDocument:a,onRefresh:d}){return i.jsxs(zo,{heading:"高级",detail:"配置状态、凭证可用性和集成清单均为只读摘要。",children:[r.diagnostic?i.jsxs("div",{className:"settings-diagnostic",role:"alert",children:[i.jsx(Q,{name:"warning",size:16}),i.jsxs("div",{children:[i.jsx("strong",{children:Rn(r.diagnostic.code)}),i.jsx("p",{children:Rn(r.diagnostic.message)})]})]}):null,i.jsxs("dl",{className:"settings-facts",children:[i.jsxs("div",{children:[i.jsx("dt",{children:"状态"}),i.jsx("dd",{children:xy(r.state)})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"工作区"}),i.jsx("dd",{title:"仅显示目录名",children:rp(r.workspace)||"—"})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"文档"}),i.jsx("dd",{children:r.hasDocument?"已创建":"尚未创建"})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"版本"}),i.jsx("dd",{title:r.revision,children:af(r.revision)})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"Last good"}),i.jsx("dd",{children:n.settingsMirror.lastGood?af(n.settingsMirror.lastGood.revision):"无"})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"Mirror"}),i.jsxs("dd",{children:[n.settingsMirror.status," · g",n.settingsMirror.generation]})]})]}),i.jsxs("div",{className:"settings-advanced-actions",children:[i.jsxs("button",{type:"button",className:"secondary-button",onClick:d,children:[i.jsx(Q,{name:"refresh",size:15}),"重新载入设置"]}),i.jsxs("button",{type:"button",className:"secondary-button",onClick:a,children:[i.jsx(Q,{name:"edit",size:15}),"打开配置文件"]})]}),o?i.jsx("div",{className:`settings-document-action ${o.tone}`,role:o.tone==="error"?"alert":"status",children:o.message}):null,i.jsxs("section",{className:"settings-subsection","aria-labelledby":"credential-status-heading",children:[i.jsx("h4",{id:"credential-status-heading",children:"凭证状态"}),i.jsx("p",{children:"仅显示来源类别与可用性;密钥值、环境变量名和认证头不会进入浏览器。"}),r.credentials.length?i.jsx("ul",{className:"settings-readonly-list",children:r.credentials.map(f=>i.jsxs("li",{children:[i.jsx("span",{children:f.providerId}),i.jsx("span",{className:`settings-state-badge state-${f.state}`,children:f.state}),i.jsx("small",{children:yy(f.source)})]},f.providerId))}):i.jsx("p",{className:"settings-empty-line",children:"Host 未报告凭证槽位。"})]}),i.jsxs("section",{className:"settings-subsection","aria-labelledby":"integration-status-heading",children:[i.jsx("h4",{id:"integration-status-heading",children:"只读能力"}),i.jsx("p",{children:"Skills 与 MCP 在专用配置中管理,此处用于确认 Host 实际加载结果。"}),i.jsxs("div",{className:"settings-capability-grid",children:[i.jsx(lf,{title:"Skills",count:n.skills.length,names:n.skills.map(f=>f.name)}),i.jsx(lf,{title:"MCP",count:n.mcpServers.length,names:n.mcpServers.map(f=>f.name)})]})]})]})}function uy({state:n}){const{settingsMirror:r}=n;return r.status==="loading"?i.jsxs("div",{className:"settings-availability",role:"status",children:[i.jsx(Q,{name:"refresh",size:15})," 正在与 Host 同步设置…"]}):r.error?i.jsxs("div",{className:"settings-availability error",role:"alert",children:[i.jsx(Q,{name:"warning",size:15})," 设置同步失败:",r.error," 当前显示上一次可用值。"]}):r.stale?i.jsxs("div",{className:"settings-availability",role:"status",children:[i.jsx(Q,{name:"refresh",size:15})," Host 已更新设置,正在载入;当前显示上一次可用值。"]}):r.document?.state==="invalid"?i.jsxs("div",{className:"settings-availability error",role:"alert",children:[i.jsx(Q,{name:"warning",size:15})," 设置文档无效。控件已锁定,并保留上一次可用值供参考。"]}):r.document?.state==="read-only"?i.jsxs("div",{className:"settings-availability",role:"status",children:[i.jsx(Q,{name:"info",size:15})," 设置当前为只读状态。"]}):r.document?.state==="unavailable"?i.jsxs("div",{className:"settings-availability error",role:"alert",children:[i.jsx(Q,{name:"warning",size:15})," Host 设置暂不可用;当前显示上一次可用值。"]}):null}function zo({heading:n,detail:r,children:o}){return i.jsxs("section",{className:"settings-section","aria-labelledby":`settings-${cf(n)}-heading`,children:[i.jsxs("header",{className:"settings-section-heading",children:[i.jsx("h3",{id:`settings-${cf(n)}-heading`,children:n}),i.jsx("p",{children:r})]}),i.jsx("div",{className:"settings-section-fields",children:o})]})}function is({id:n,label:r,description:o,field:a,labelControl:d=!0,dirty:f,disabled:p,onReset:g,children:x}){return i.jsxs("div",{className:`settings-field-card ${f?"dirty":""}`,children:[i.jsxs("div",{className:"settings-field-copy",children:[d?i.jsx("label",{htmlFor:n,children:r}):i.jsx("strong",{children:r}),i.jsx("p",{children:o}),i.jsxs("div",{className:"settings-field-meta","aria-label":`${r} 设置来源`,children:[i.jsx("span",{children:py(a.source)}),i.jsx("span",{children:hy(a.scope)}),i.jsx("span",{children:my(a.applies)}),f?i.jsx("strong",{children:"草稿"}):null]}),a.blockedReason?i.jsx("small",{className:"settings-blocked-reason",children:gy(a.blockedReason)}):null]}),i.jsxs("div",{className:"settings-field-control",children:[x,i.jsx("button",{type:"button",className:"text-button",onClick:g,disabled:p||a.explicitValue===void 0&&!f,"aria-label":`重置${r}为继承值`,children:"重置"})]})]})}function dy({draft:n,onAdopt:r,onRebase:o}){const a=Zv(n),d=Sr(n),f=n.serverLatest;return i.jsxs("div",{className:"settings-conflict",role:"alert",children:[i.jsx(Q,{name:"warning",size:17}),i.jsxs("div",{children:[i.jsx("strong",{children:"Host 设置已在其他位置更新"}),i.jsxs("p",{children:["草稿仍被保留",a.length?`;${a.length} 个草稿字段的服务器值发生变化`:"","。"]}),f?i.jsxs("div",{className:"settings-conflict-values","aria-label":"服务器值与我的草稿",children:[i.jsxs("div",{className:"settings-conflict-value-heading","aria-hidden":"true",children:[i.jsx("span",{children:"字段"}),i.jsx("span",{children:"服务器最新值"}),i.jsx("span",{children:"我的草稿"})]}),d.map(p=>i.jsxs("div",{children:[i.jsx("strong",{children:vy(p)}),i.jsx("span",{"data-label":"服务器最新值",children:String(En(f,p))}),i.jsxs("span",{"data-label":"我的草稿",children:[String(n.values[p]),n.intents[p]?.op==="unset"?"(重置)":""]})]},p))]}):null,i.jsxs("div",{children:[i.jsx("button",{type:"button",className:"secondary-button",onClick:r,children:"采用服务器值"}),i.jsx("button",{type:"button",className:"primary-button",onClick:o,children:"基于最新值重试"})]})]})]})}function op({detail:n="当前回合正在运行;相关设置会在 Runtime 空闲后解锁。"}={}){return i.jsxs("div",{className:"settings-busy",role:"status",children:[i.jsx(Q,{name:"activity",size:15})," ",n]})}function lf({title:n,count:r,names:o}){return i.jsxs("div",{className:"settings-capability-card",children:[i.jsx("span",{children:n}),i.jsx("strong",{children:r}),i.jsx("small",{children:o.slice(0,3).join(" · ")||"未加载"})]})}function en(n,r){return n.state==="ready"&&n.writable&&r.writable&&!r.blockedReason}function fy(n,r){const o=r instanceof Error?r.message:"Host 拒绝了设置变更。";switch(n){case"settings_revision_conflict":return"设置已在其他位置更新。你的草稿没有丢失。";case"runtime_busy":return"Runtime 正在处理任务。请等待当前回合结束后再次应用。";case"settings_document_invalid":return"配置文件无效。请在高级页查看 Host 提供的安全诊断。";case"settings_write_forbidden":return"当前设置来源为只读,Host 未执行任何变更。";case"request_id_conflict":return"保存请求标识与先前内容冲突,请重新应用。";case"settings_recovery_required":return"Host 报告设置冲突,但最新设置暂时无法载入。草稿已保留,请重新载入后再试。";case"network":return"未能确认 Host 是否收到请求;保留草稿,可安全重试。";default:return o}}function py(n){return`来源:${n==="internal"?"内置":n==="model"?"模型":n==="global"?"全局":n==="project"?"项目":"会话"}`}function hy(n){return`作用域:${n==="global"?"全局":n==="project"?"项目":"会话"}`}function my(n){return`生效:${n==="live"?"立即":n==="next-logical-request"?"下次请求":n==="new-session"?"新会话":"重启后"}`}function gy(n){return n==="runtime_busy"?"Runtime 正在运行,暂不可修改。":n==="read_only"?"此字段来自只读配置。":"设置文档无效,修复前不可修改。"}function vy(n){return n==="appearance.style"?"视觉风格":n==="appearance.theme"?"主题":n==="appearance.motion"?"动效":n==="defaults.model"?"默认模型":n==="defaults.effort"?"默认推理强度":"工具确认"}function yy(n){return n==="environment"?"环境提供":n==="legacy"?"Host 旧配置":"未配置"}function xy(n){return n==="ready"?"可用":n==="invalid"?"无效":n==="read-only"?"只读":"不可用"}function af(n){return n.length>24?`${n.slice(0,20)}…`:n}function cf(n){return n.replace(/[^a-z0-9]+/gi,"-").replace(/^-|-$/g,"").toLowerCase()||"section"}function uf(){return typeof document>"u"?null:document.activeElement}const wy=["导航","面板","编辑","浮层"],lp=Object.freeze([{id:"toggle-project-navigation",tokens:["Mod","B"],group:"导航",description:"展开或折叠项目导航"},{id:"toggle-work-panel",tokens:["Mod","Shift","B"],group:"导航",description:"展开或折叠右侧工作面板"},{id:"focus-work-panel-1",tokens:["Mod","Shift","1"],group:"面板",description:"切换到 Agent 面板"},{id:"focus-work-panel-2",tokens:["Mod","Shift","2"],group:"面板",description:"切换到审阅面板"},{id:"focus-work-panel-3",tokens:["Mod","Shift","3"],group:"面板",description:"切换到终端面板"},{id:"focus-work-panel-4",tokens:["Mod","Shift","4"],group:"面板",description:"切换到文件面板"},{id:"focus-work-panel-5",tokens:["Mod","Shift","5"],group:"面板",description:"切换到 Git 面板"},{id:"work-panel-tab-nav",tokens:["←","→"],group:"面板",description:"在面板标签之间移动(Home / End 跳到首尾)"},{id:"resize-panel",tokens:["←","→"],group:"面板",description:"聚焦分隔条后按 2% 步长调整宽度,配合 Shift 为 10%"},{id:"resize-panel-reset",tokens:["Enter"],group:"面板",description:"分隔条聚焦时恢复默认宽度(Home 最窄,End 最宽)"},{id:"submit-composer",tokens:["Enter"],group:"编辑",description:"在输入框中发送当前内容"},{id:"newline-composer",tokens:["Shift","Enter"],group:"编辑",description:"在输入框中插入换行而不发送"},{id:"force-submit-composer",tokens:["Mod","Enter"],group:"编辑",description:"Agent 运行中时立即提交(否则进入队列)"},{id:"project-tree-nav",tokens:["↑","↓"],group:"面板",description:"在项目与会话树中移动焦点"},{id:"close-overlay",tokens:["Esc"],group:"浮层",description:"关闭抽屉、对话框或快捷键面板"},{id:"open-shortcut-help",tokens:["Mod","/"],group:"浮层",description:"打开或关闭本快捷键面板"}]);function ky(){if(typeof navigator>"u")return!1;const n=navigator.platform??"";return/mac|iphone|ipad|ipod/i.test(n)||/Mac/i.test(navigator.userAgent??"")}function jy(n,r=ky()){return n.map(a=>a==="Mod"?r?"⌘":"Ctrl":a==="Shift"?r?"⇧":"Shift":a==="Alt"?r?"⌥":"Alt":a.toUpperCase()).join(r?" ":"+")}function Eo(n,r){let o=!1,a=!1,d=!1,f=null;for(const w of r)w==="Mod"?o=!0:w==="Shift"?a=!0:w==="Alt"?d=!0:f=w;if(o!==(n.metaKey||n.ctrlKey)||a!==n.shiftKey||d!==n.altKey||f===null)return!1;const p=n.code??"";if(/^[a-z]$/i.test(f))return p===`Key${f.toUpperCase()}`;if(/^[0-9]$/.test(f))return p===`Digit${f}`;const x=Object.freeze({esc:"escape"})[f.toLowerCase()]??f.toLowerCase();return n.key.toLowerCase()===x}function Po(n){return lp.find(r=>r.id===n)}function Sy(){return wy.map(n=>({group:n,items:lp.filter(r=>r.group===n)})).filter(n=>n.items.length>0)}function Cy({open:n,onClose:r}){const o=m.useRef(null),a="shortcut-help-title";m.useEffect(()=>{const p=o.current;p&&(n&&!p.open&&p.showModal(),!n&&p.open&&p.close())},[n]);const d=p=>{p.target===p.currentTarget&&r()},f=Sy();return i.jsxs("dialog",{ref:o,id:"shortcut-help",className:"modal shortcut-help","aria-labelledby":a,onCancel:p=>{p.preventDefault(),r()},onClose:r,onClick:d,children:[i.jsxs("header",{className:"shortcut-help-header",children:[i.jsxs("div",{children:[i.jsx("span",{className:"eyebrow",children:"KEYBOARD"}),i.jsx("h2",{id:a,children:"键盘快捷键"})]}),i.jsx("button",{type:"button",className:"icon-button",onClick:r,"aria-label":"关闭快捷键面板",children:i.jsx(Q,{name:"close",size:15})})]}),i.jsx("div",{className:"shortcut-help-body",children:f.map(({group:p,items:g})=>i.jsxs("section",{className:"shortcut-help-group",children:[i.jsx("h3",{children:p}),i.jsx("dl",{children:g.map(x=>i.jsxs("div",{className:"shortcut-row",children:[i.jsx("dt",{children:x.description}),i.jsx("dd",{children:i.jsx("kbd",{children:jy(x.tokens)})})]},x.id))})]},p))}),i.jsx("footer",{className:"shortcut-help-footer",children:i.jsxs("p",{children:["按 ",i.jsx("kbd",{children:"Esc"})," 关闭本面板,焦点会回到打开它的位置。"]})})]})}const Ny="modulepreload",by=function(n){return"/"+n},df={},Wo=function(r,o,a){let d=Promise.resolve();if(o&&o.length>0){let x=function(w){return Promise.all(w.map(E=>Promise.resolve(E).then(S=>({status:"fulfilled",value:S}),S=>({status:"rejected",reason:S}))))};document.getElementsByTagName("link");const p=document.querySelector("meta[property=csp-nonce]"),g=p?.nonce||p?.getAttribute("nonce");d=x(o.map(w=>{if(w=by(w),w in df)return;df[w]=!0;const E=w.endsWith(".css"),S=E?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${w}"]${S}`))return;const P=document.createElement("link");if(P.rel=E?"stylesheet":Ny,E||(P.as="script"),P.crossOrigin="",P.href=w,g&&P.setAttribute("nonce",g),document.head.appendChild(P),E)return new Promise((R,$)=>{P.addEventListener("load",R),P.addEventListener("error",()=>$(new Error(`Unable to preload CSS for ${w}`)))})}))}function f(p){const g=new Event("vite:preloadError",{cancelable:!0});if(g.payload=p,window.dispatchEvent(g),!g.defaultPrevented)throw p}return d.then(p=>{for(const g of p||[])g.status==="rejected"&&f(g.reason);return r().catch(f)})},yr=[{id:"goal",label:"Goal",icon:"goal"},{id:"activity",label:"活动",icon:"activity"},{id:"integrations",label:"能力",icon:"branch"},{id:"diagnostics",label:"诊断",icon:"diagnostics"}];function _y({state:n,actions:r,tab:o,onTabChange:a}){const d=m.useId(),f=p=>{if(p.key!=="ArrowLeft"&&p.key!=="ArrowRight"&&p.key!=="Home"&&p.key!=="End")return;p.preventDefault();const g=yr.findIndex(w=>w.id===o),x=p.key==="Home"?0:p.key==="End"?yr.length-1:(g+(p.key==="ArrowRight"?1:-1)+yr.length)%yr.length;a(yr[x].id),requestAnimationFrame(()=>document.getElementById(`${d}-tab-${yr[x].id}`)?.focus())};return i.jsxs("div",{className:"agent-panel",children:[i.jsx("div",{className:"inspector-tabs",role:"tablist","aria-label":"详情类别",onKeyDown:f,children:yr.map(p=>i.jsxs("button",{id:`${d}-tab-${p.id}`,type:"button",role:"tab","aria-selected":o===p.id,"aria-controls":`${d}-panel`,tabIndex:o===p.id?0:-1,onClick:()=>a(p.id),children:[i.jsx(Q,{name:p.icon,size:15}),i.jsx("span",{children:p.label})]},p.id))}),i.jsxs("div",{id:`${d}-panel`,className:"inspector-body",role:"tabpanel","aria-labelledby":`${d}-tab-${o}`,tabIndex:0,children:[o==="goal"?i.jsx(Iy,{state:n,actions:r}):null,o==="activity"?i.jsx(Py,{state:n,actions:r}):null,o==="integrations"?i.jsx(My,{state:n,actions:r}):null,o==="diagnostics"?i.jsx(Oy,{state:n,actions:r}):null]})]})}function Iy({state:n,actions:r}){const o=n.goal,a=n.plan?.body??(typeof n.diagnostics?.plan=="string"?n.diagnostics.plan:""),d=!!n.pendingAction,f=d||n.connection!=="live"||!jr(n),[p,g]=m.useState(!1);if(!o)return i.jsxs("div",{className:"inspector-stack",children:[i.jsxs("section",{className:"inspector-empty-card",children:[i.jsx("div",{className:"empty-mini-icon",children:i.jsx(Q,{name:"goal"})}),i.jsx("h3",{children:"没有活动 Goal"}),i.jsx("p",{children:"Goal 会跨回合保存目标、计划、证据和预算状态。"})]}),i.jsx(Ey,{onCreate:w=>r.controlGoal("create",w),disabled:f||!n.activeSessionId}),i.jsx(ff,{mode:n.mode.baseMode,plan:a})]});const x=o.criteria?.total?Math.round(o.criteria.passed/o.criteria.total*100):0;return i.jsxs("div",{className:"inspector-stack",children:[i.jsxs("section",{className:"goal-card",children:[i.jsxs("header",{children:[i.jsx("span",{className:`goal-status status-${o.status}`,children:o.status.replace(/_/g," ")}),i.jsxs("span",{children:["rev ",o.revision]})]}),i.jsx("h3",{children:o.objective}),o.criteria?i.jsxs("div",{className:"goal-progress",children:[i.jsxs("div",{children:[i.jsx("span",{children:"成功条件"}),i.jsxs("strong",{children:[o.criteria.passed," / ",o.criteria.total]})]}),i.jsx("progress",{value:o.criteria.passed,max:Math.max(1,o.criteria.total),"aria-label":`Goal 条件完成 ${x}%`}),i.jsxs("div",{className:"goal-breakdown",children:[i.jsxs("span",{children:[x,"% 完成"]}),i.jsxs("span",{children:[o.criteria.failed," 失败 · ",o.criteria.stale," 过期"]})]})]}):null,i.jsxs("dl",{className:"metric-grid",children:[i.jsxs("div",{children:[i.jsx("dt",{children:"Tokens"}),i.jsxs("dd",{children:[pf(o.tokensUsed),o.tokenBudget?` / ${pf(o.tokenBudget)}`:""]})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"用时"}),i.jsx("dd",{children:$y(o.timeUsedMs)})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"续跑"}),i.jsx("dd",{children:o.continuationCount})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"Plan"}),i.jsx("dd",{children:o.planRevision?`r${o.planRevision}`:"—"})]})]}),o.nextAction?i.jsxs("div",{className:"next-action",children:[i.jsx("span",{children:"下一步"}),i.jsx("p",{children:o.nextAction})]}):null,o.auditRemaining?.length?i.jsxs("details",{className:"remaining-audit",children:[i.jsxs("summary",{children:["仍需验证 ",o.auditRemaining.length," 项"]}),i.jsx("ul",{children:o.auditRemaining.map((w,E)=>i.jsx("li",{children:w},`${w}-${E}`))})]}):null,i.jsxs("div",{className:"goal-actions",children:[o.status==="active"?i.jsxs("button",{type:"button",className:"secondary-button",onClick:()=>{r.controlGoal("pause")},disabled:f,children:[i.jsx(Q,{name:"pause",size:14}),"暂停"]}):o.status!=="complete"?i.jsxs("button",{type:"button",className:"secondary-button",onClick:()=>{r.controlGoal("resume")},disabled:f,children:[i.jsx(Q,{name:"refresh",size:14}),"恢复"]}):null,i.jsx("button",{type:"button",className:"danger-ghost-button",onClick:()=>g(!0),disabled:f,children:"清除"})]})]}),n.goalEvidence.length>0?i.jsxs("section",{className:"inspector-section",children:[i.jsxs("div",{className:"inspector-section-heading",children:[i.jsx("h3",{children:"最近证据"}),i.jsx("span",{children:n.goalEvidence.length})]}),i.jsx("ul",{className:"evidence-list",children:n.goalEvidence.slice(-8).reverse().map(w=>i.jsxs("li",{children:[i.jsx("span",{className:`evidence-state ${w.result}`,"aria-hidden":"true",children:i.jsx(Q,{name:w.result==="passed"?"check":w.result==="failed"?"close":"more",size:12})}),i.jsxs("div",{children:[i.jsx("strong",{children:w.subject}),i.jsxs("span",{children:[w.kind," · ",w.result]})]})]},w.id))})]}):null,i.jsx(ff,{mode:n.mode.baseMode,plan:a,goalPhase:o.planPhase}),n.goalActivity.length>0?i.jsxs("section",{className:"inspector-section",children:[i.jsx("div",{className:"inspector-section-heading",children:i.jsx("h3",{children:"Goal 轨迹"})}),i.jsx("ol",{className:"compact-timeline",children:n.goalActivity.slice(-10).reverse().map((w,E)=>i.jsxs("li",{children:[i.jsx("span",{className:"timeline-pin","aria-hidden":"true"}),i.jsxs("div",{children:[i.jsx("strong",{children:w.type.replace(/_/g," ")}),i.jsx("p",{children:w.message}),i.jsx("time",{children:Ly(w.timestamp)})]})]},`${w.timestamp}-${E}`))})]}):null,i.jsx(Kv,{open:p,onClose:()=>g(!1),title:"清除此 Goal?",body:"Goal 的目标与进度会从当前会话移除,会话记录仍会保留。",confirmLabel:"清除 Goal",danger:!0,pending:d,onConfirm:()=>r.controlGoal("clear")})]})}function Ey({onCreate:n,disabled:r}){const[o,a]=m.useState(""),d=async f=>{if(f.preventDefault(),!!o.trim())try{await n(o.trim()),a("")}catch{}};return i.jsxs("form",{className:"goal-create",onSubmit:d,children:[i.jsx("label",{htmlFor:"goal-objective",children:"创建 Goal"}),i.jsx("textarea",{id:"goal-objective",rows:3,value:o,onChange:f=>a(f.target.value),placeholder:"输入一个可验证、可持续执行的目标…",disabled:r}),i.jsxs("button",{type:"submit",className:"primary-button",disabled:r||!o.trim(),children:[i.jsx(Q,{name:"goal",size:15}),"开始 Goal"]})]})}function ff({mode:n,plan:r,goalPhase:o}){return i.jsxs("section",{className:"inspector-section plan-section",children:[i.jsxs("div",{className:"inspector-section-heading",children:[i.jsx("h3",{children:"Plan"}),i.jsx("span",{className:`mode-badge mode-${n}`,children:n==="plan"?"PLAN MODE":o||"READ ONLY"})]}),r?i.jsx(Xs,{children:r}):i.jsx("p",{className:"muted-copy",children:"还没有保存的计划。切换到 PLAN 模式后提交任务,Runtime 会生成并保存计划。"})]})}function Py({state:n,actions:r}){const o=m.useMemo(()=>n.tools.filter(a=>Ay(a)),[n.tools]);return i.jsxs("div",{className:"inspector-stack",children:[i.jsxs("section",{className:"inspector-section",children:[i.jsxs("div",{className:"inspector-section-heading",children:[i.jsx("h3",{children:"工具调用"}),i.jsx("span",{children:n.tools.length})]}),n.tools.length?i.jsx("ul",{className:"activity-list",children:n.tools.slice(-20).reverse().map(a=>i.jsx(Ry,{tool:a},a.callId))}):i.jsx(So,{text:"还没有工具活动"})]}),i.jsx(Ty,{state:n,actions:r}),i.jsxs("section",{className:"inspector-section",children:[i.jsxs("div",{className:"inspector-section-heading",children:[i.jsx("h3",{children:"文件变化"}),i.jsx("span",{children:o.length+n.edits.length})]}),o.length||n.edits.length?i.jsxs("ul",{className:"change-list",children:[n.edits.slice(-8).reverse().map(a=>i.jsxs("li",{children:[i.jsx(Q,{name:"edit",size:14}),i.jsxs("div",{children:[i.jsx("strong",{children:ap(a.request.path)}),i.jsxs("span",{children:[a.request.kind," · ",a.request.candidates.length," candidates"]})]})]},a.eventId)),o.slice(-8).reverse().map(a=>i.jsxs("li",{children:[i.jsx(Q,{name:"code",size:14}),i.jsxs("div",{children:[i.jsx("strong",{children:a.name}),i.jsx("span",{children:a.summary||a.state})]})]},a.callId))]}):i.jsx(So,{text:"还没有文件变化"})]}),i.jsxs("section",{className:"inspector-section",children:[i.jsxs("div",{className:"inspector-section-heading",children:[i.jsx("h3",{children:"子代理与研究"}),i.jsx("span",{children:n.subtasks.length+n.research.length})]}),n.subtasks.length?i.jsx("ul",{className:"activity-list",children:n.subtasks.slice(-8).reverse().map(a=>i.jsxs("li",{children:[i.jsx("span",{className:`state-dot state-${a.state}`,"aria-hidden":"true"}),i.jsxs("div",{children:[i.jsx("strong",{children:a.role}),i.jsx("span",{children:a.objective})]}),i.jsx("small",{children:a.state})]},a.taskId))}):null,n.research.length?i.jsx("ul",{className:"activity-list",children:n.research.slice(-6).reverse().map(a=>i.jsxs("li",{children:[i.jsx("span",{className:`state-dot state-${a.stage}`,"aria-hidden":"true"}),i.jsxs("div",{children:[i.jsx("strong",{children:"Research"}),i.jsx("span",{children:a.objective||a.packetId})]}),i.jsx("small",{children:a.stage})]},a.packetId))}):null,!n.subtasks.length&&!n.research.length?i.jsx(So,{text:"还没有子代理或研究活动"}):null]})]})}function Ry({tool:n}){return i.jsxs("li",{children:[i.jsx("span",{className:`state-dot state-${n.state}`,"aria-hidden":"true"}),i.jsxs("div",{children:[i.jsx("strong",{children:n.name}),i.jsx("span",{children:n.summary||`调用 #${n.sequence}`})]}),i.jsx("small",{children:n.duration!==void 0?`${Math.round(n.duration)}ms`:n.state})]})}function Ty({state:n,actions:r}){const[o,a]=m.useState(""),[d,f]=m.useState(""),[p,g]=m.useState(),[x,w]=m.useState(0),[E,S]=m.useState(!1),[P,R]=m.useState("");m.useEffect(()=>{a(""),f(""),g(void 0),R("")},[n.activeSessionId]);const $=async(O,F=0)=>{S(!0),R("");try{const te=await r.readToolDetail(O,F);a(O),f(L=>F===0?te.content:`${L}${te.content}`),g(te.nextOffsetBytes),w(te.totalBytes)}catch(te){R(te instanceof Error?te.message:"工具详情读取失败。")}finally{S(!1)}};return i.jsxs("section",{className:"inspector-section tool-detail-browser",children:[i.jsxs("div",{className:"inspector-section-heading",children:[i.jsx("h3",{children:"持久化输出"}),i.jsxs("button",{type:"button",className:"icon-text-button",onClick:()=>{r.refreshToolDetails()},disabled:!!n.pendingAction,children:[i.jsx(Q,{name:"refresh",size:13}),"刷新"]})]}),n.toolDetails.length?i.jsx("div",{className:"detail-selector",role:"group","aria-label":"工具输出详情",children:n.toolDetails.slice(-20).reverse().map(O=>i.jsxs("button",{type:"button",className:o&&O.artifactId===o?"active":"",disabled:!O.artifactId||E,onClick:()=>O.artifactId&&void $(O.artifactId),children:[i.jsxs("span",{children:[i.jsx("strong",{children:O.toolName}),i.jsxs("small",{children:["#",O.sequence," · ",hf(O.outputBytes)]})]}),i.jsx(Q,{name:"chevron",size:13})]},`${O.callId}:${O.sequence}`))}):i.jsx(So,{text:"没有可读取的持久化输出"}),n.toolDetailNextCursor?i.jsx("button",{type:"button",className:"text-button",onClick:()=>{r.loadMoreToolDetails()},disabled:!!n.pendingAction,children:"加载更多输出记录"}):null,P?i.jsx("p",{className:"field-error",role:"alert",children:P}):null,o?i.jsxs("div",{className:"detail-output",children:[i.jsxs("div",{children:[i.jsxs("span",{children:[hf(x)," · 已脱敏"]}),i.jsx("code",{children:o})]}),i.jsx("pre",{tabIndex:0,children:Rn(d)}),p!==void 0?i.jsx("button",{type:"button",className:"secondary-button",disabled:E,onClick:()=>{$(o,p)},children:E?"读取中…":"加载更多"}):null]}):null]})}function My({state:n,actions:r}){const o=n.skills,a=n.mcpServers;return i.jsxs("div",{className:"inspector-stack",children:[i.jsxs("section",{className:"capability-card",children:[i.jsxs("header",{children:[i.jsx("span",{className:"capability-icon",children:i.jsx(Q,{name:"spark",size:17})}),i.jsxs("div",{children:[i.jsx("h3",{children:"Skills"}),i.jsx("p",{children:"安全描述符,只读"})]}),i.jsx("span",{className:`readiness-pill ${o.length?"ready":""}`,children:o.length?`${o.length} 可用`:"未发现"})]}),o.length?i.jsx("ul",{className:"skill-list",children:o.map(d=>i.jsxs("li",{children:[i.jsxs("div",{children:[i.jsx("strong",{children:d.name}),i.jsxs("span",{children:[d.sourceScope," · ",d.providerId]})]}),i.jsx("p",{children:d.description}),d.requestedCapabilities.length?i.jsx("small",{children:d.requestedCapabilities.join(" · ")}):null]},d.id))}):i.jsx("p",{className:"muted-copy",children:"当前 Runtime 没有公开可用的 Skill 描述符。"})]}),i.jsxs("section",{className:"capability-card",children:[i.jsxs("header",{children:[i.jsx("span",{className:"capability-icon mcp",children:i.jsx(Q,{name:"branch",size:17})}),i.jsxs("div",{children:[i.jsx("h3",{children:"MCP Servers"}),i.jsx("p",{children:"只读配置与运行状态"})]}),i.jsx("span",{className:`readiness-pill ${a.length?"ready":""}`,children:a.length?`${a.length} 已配置`:"未配置"})]}),a.length?i.jsx("ul",{className:"server-list",children:a.map(d=>i.jsxs("li",{children:[i.jsx("span",{className:`state-dot state-${d.state}`,"aria-hidden":"true"}),i.jsxs("div",{children:[i.jsx("code",{children:d.name}),i.jsxs("small",{children:[d.transport," · ",d.toolCount," tools"]})]}),i.jsx("span",{children:d.disabled?"Disabled":d.state})]},d.id))}):i.jsx("p",{className:"muted-copy",children:"没有可用的 MCP Server。浏览器不会接收环境变量或认证 Header。"})]}),n.skillNextCursor||n.mcpNextCursor?i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{r.loadMoreCapabilities()},disabled:!!n.pendingAction,children:"加载更多能力"}):null,i.jsxs("section",{className:"security-note",children:[i.jsx(Q,{name:"info",size:16}),i.jsxs("p",{children:[i.jsx("strong",{children:"能力边界由 Runtime 管理。"})," Web 端只展示描述符和状态,不加载外部插件代码,也不会绕过 ToolGateway。"]})]})]})}function Oy({state:n,actions:r}){const o=n.diagnostics,a=Oo(n);return i.jsxs("div",{className:"inspector-stack",children:[i.jsxs("div",{className:"diagnostics-toolbar",children:[i.jsxs("div",{children:[i.jsx("span",{className:`connection-dot ${n.connection}`,"aria-hidden":"true"}),i.jsx("strong",{children:Dy(n.connection)})]}),i.jsxs("button",{type:"button",className:"icon-text-button",onClick:()=>{r.refreshDiagnostics()},disabled:!!n.pendingAction,children:[i.jsx(Q,{name:"refresh",size:14}),"刷新"]})]}),i.jsxs("section",{className:"inspector-section",children:[i.jsx("div",{className:"inspector-section-heading",children:i.jsx("h3",{children:"Runtime"})}),i.jsxs("dl",{className:"diagnostic-list",children:[i.jsx(St,{label:"版本",value:n.bootstrap?.productVersion??"—"}),i.jsx(St,{label:"工作区",value:ap(n.workspace)||"—"}),i.jsx(St,{label:"会话",value:n.activeSessionId?.slice(0,12)??"未选择"}),i.jsx(St,{label:"模式",value:String(o?.agentMode??n.mode.baseMode)}),i.jsx(St,{label:"权限",value:String(o?.permissionMode??n.settings?.sections.permissions.toolConfirmation.effectiveValue??"—")}),i.jsx(St,{label:"事件游标",value:`${n.lastCursor}`}),i.jsx(St,{label:"事件 UUID",value:n.lastEventId?.slice(0,12)??"—"}),i.jsx(St,{label:"会话快照",value:a.status}),i.jsx(St,{label:"保留事件",value:`${o?.eventStream?.retained??"—"}`}),i.jsx(St,{label:"快照请求",value:o?.session?`${o.session.snapshotRequests} 次 / 失败 ${o.session.snapshotFailures}`:"—"}),i.jsx(St,{label:"快照时延",value:o?.session?`${o.session.snapshotLastMs} ms(累计 ${o.session.snapshotTotalMs} ms)`:"—"}),i.jsx(St,{label:"Session actor",value:o?.session?`${o.session.actors.actorsCreated} 分配 / ${o.session.actors.actorsEvicted} LRU 驱逐`:"—"}),i.jsx(St,{label:"control plane",value:o?.session?`${o.session.controlPlaneInstalls} 次装载 / ${o.session.controlPlaneShutdowns} 次关闭`:"—"}),i.jsx(St,{label:"浏览器切换",value:`${n.clientTelemetry.sessionSwitches} 次 / 缓存命中 ${n.clientTelemetry.snapshotCacheHits} / 加载 ${n.clientTelemetry.snapshotLoads}`})]})]}),o?.contextUsage?i.jsx(vo,{title:"Context usage",value:o.contextUsage}):null,o?.tokenUsage?i.jsx(vo,{title:"Token usage",value:o.tokenUsage}):null,o?.harness?i.jsx(vo,{title:"Harness",value:o.harness}):null,n.loopStats?i.jsx(vo,{title:"Loop statistics",value:n.loopStats}):null,i.jsxs("section",{className:"security-note",children:[i.jsx(Q,{name:"check",size:16}),i.jsx("p",{title:"API Key、认证 Header 和环境值不会返回浏览器。",children:"诊断载荷由 Host 脱敏。"})]})]})}function St({label:n,value:r}){return i.jsxs("div",{children:[i.jsx("dt",{children:n}),i.jsx("dd",{title:r,children:r})]})}function vo({title:n,value:r}){return i.jsxs("details",{className:"json-section",children:[i.jsx("summary",{children:n}),i.jsx("pre",{tabIndex:0,children:Ka(r,12e3)})]})}function So({text:n}){return i.jsxs("div",{className:"empty-small",children:[i.jsx("span",{className:"empty-line","aria-hidden":"true"}),i.jsx("p",{children:n})]})}function Ay(n){return/write|edit|patch|delete|move|rename|mkdir|create/i.test(n.name)}function ap(n){const r=n.replace(/[\\/]+$/,"");return r.split(/[\\/]/).filter(Boolean).at(-1)??r}function pf(n){return new Intl.NumberFormat("zh-CN",{notation:n>99999?"compact":"standard"}).format(n)}function $y(n){return n<1e3?`${Math.round(n)}ms`:n<6e4?`${Math.round(n/1e3)}s`:`${Math.floor(n/6e4)}m ${Math.round(n%6e4/1e3)}s`}function hf(n){return n<1024?`${n} B`:n<1048576?`${(n/1024).toFixed(1)} KB`:`${(n/1048576).toFixed(1)} MB`}function Ly(n){const r=Date.parse(n);return Number.isFinite(r)?new Date(r).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}):""}function Dy(n){return n==="live"?"本地 Web Host 连接正常":n==="offline"?"浏览器离线":n==="replay-required"?"Web Host 事件流需要恢复":n==="closed"?"本地 Web Host 已关闭":n==="connecting"?"正在连接本地 Web Host":"正在重新连接本地 Web Host"}function zy({width:n,onPreview:r,onCommit:o,maxWidth:a=Yf}){return i.jsx(Gf,{side:"right",className:"work-panel-resize-handle",minWidth:Ja,maxWidth:a,defaultWidth:Za,label:"拖动或按方向键调整工作面板宽度",width:n,controls:"work-panel-detail",onPreview:r,onCommit:o})}const Wy=["agent","review","terminal","files","git"],Fy=Object.freeze({agent:{label:"Agent",icon:"spark",kind:"task"},review:{label:"审阅",icon:"edit",kind:"resource"},terminal:{label:"终端",icon:"terminal",kind:"resource"},files:{label:"文件",icon:"workspace",kind:"resource"},git:{label:"Git",icon:"branch",kind:"resource"}}),By=new Map(Wy.map(n=>{const r=Fy[n];return[n,Object.freeze({id:n,label:r.label,icon:r.icon,kind:r.kind})]})),qy=m.lazy(()=>Wo(()=>import("./TerminalPanel-BpsLphLv.js"),__vite__mapDeps([0,1])).then(n=>({default:n.TerminalPanel}))),Uy=m.lazy(()=>Wo(()=>import("./FilesPanel-DiXKnFMj.js"),__vite__mapDeps([2,3])).then(n=>({default:n.FilesPanel}))),Hy=m.lazy(()=>Wo(()=>import("./GitPanel--_Yrbldp.js"),__vite__mapDeps([4,3,5])).then(n=>({default:n.GitPanel}))),Vy=m.lazy(()=>Wo(()=>import("./ReviewPanel-BilzL9Ma.js"),__vite__mapDeps([6,3,5])).then(n=>({default:n.ReviewPanel}))),Ky=["focus-work-panel-1","focus-work-panel-2","focus-work-panel-3","focus-work-panel-4","focus-work-panel-5"],mf=Object.freeze(Object.fromEntries([...By].map(([n,r])=>[n,{label:r.label,icon:r.icon}]))),Gy=new Set(["starting","running","stopping","queued","waiting_approval","interrupted","failed"]);function Qy(n,r){return n?Gy.has(n)?n==="failed"||n==="interrupted"?"failed":n==="queued"||n==="waiting_approval"?"queued":"running":null:r?"running":null}const Ra=["system","light","dark"],Yy={system:"monitor",light:"sun",dark:"moon"},gf={system:"跟随系统",light:"浅色",dark:"深色"};function Xy(n){const r=n??"system",o=Ra.indexOf(r),a=Ra[(o+1)%Ra.length];return{current:r,next:a}}function Jy({state:n,actions:r,mode:o,expanded:a,themePreference:d,onCycleTheme:f,onToggleInspector:p,onShowShortcutHelp:g,activePanel:x,panelOrder:w,agentPanel:E,onExpand:S,onCollapse:P,onPanelChange:R,onAgentPanelChange:$,onWidthPreview:O,onWidthCommit:F,width:te,maxWidthPx:L,onSendToComposer:ye,resourceNavigatorWidths:J,onResourceNavigatorWidthCommit:ne}){const N=m.useRef(null),D=m.useRef(null),Z=m.useRef(a),X=m.useId(),ie=m.useRef(new Set([x]));ie.current.add(x);const G=m.useRef(x==="terminal"||ie.current.has("terminal"));x==="terminal"&&(G.current=!0);const[je,ee]=m.useState(!1),Ce=w&&w.length===qa.length?w:qa,A=n.workspaceResourceEpochs[n.workspaceId]??{files:0,git:0,review:0},me=n.sessionRuntimeById[n.activeSessionId??""]?.phase,ve=Qy(me,n.processing),W=Xy(d);m.useEffect(()=>{const V=Z.current;if(Z.current=a,!(o!=="dock"||V===a)){if(!a){requestAnimationFrame(()=>N.current?.querySelector(`[data-work-panel-id="${x}"]`)?.focus());return}je&&(ee(!1),requestAnimationFrame(()=>D.current?.focus()))}},[x,a,o,je]),m.useEffect(()=>{const V=Po("toggle-work-panel"),oe=ge=>{if(V&&Eo(ge,V.tokens)){ge.preventDefault(),a?P():(ee(!0),S());return}const Se=Ky.findIndex(ue=>{const Me=Po(ue);return Me?Eo(ge,Me.tokens):!1}),be=Ce[Se];be&&(ge.preventDefault(),!(a&&x===be)&&(R(be),a||S()))};return window.addEventListener("keydown",oe),()=>window.removeEventListener("keydown",oe)},[a,o,P,S,R]);const se=V=>{if(V.key==="Escape"&&a&&!V.target.closest('[role="alertdialog"], .terminal-host, input, textarea, [contenteditable]')){V.preventDefault(),P();return}if(o!=="overlay"||!a||V.key!=="Tab")return;const oe=Zy(N.current);if(!oe.length){V.preventDefault(),N.current?.focus();return}const ge=oe.indexOf(document.activeElement);V.shiftKey&&ge<=0?(V.preventDefault(),oe.at(-1)?.focus()):!V.shiftKey&&(ge<0||ge===oe.length-1)&&(V.preventDefault(),oe[0].focus())},B=V=>{if(o==="overlay"){R(V),a||(ee(!0),S());return}if(a&&x===V){P();return}a||ee(!0),R(V),S()},v=(V=!1)=>i.jsxs("nav",{className:V?"work-panel-rail work-panel-rail-overlay":"work-panel-rail","aria-label":"工作面板快捷入口","aria-orientation":V?"horizontal":"vertical",children:[Ce.map((oe,ge)=>{const Se=mf[oe],be=x===oe;return i.jsxs("button",{type:"button",className:"work-panel-rail-button","data-work-panel-id":oe,"aria-label":`打开${Se.label}面板`,"aria-current":be?"page":void 0,title:`${Se.label} · ⌘⇧${ge+1}`,onClick:()=>B(oe),children:[i.jsx(Q,{name:Se.icon,size:17}),oe==="terminal"&&ve?i.jsx(Ga,{state:ve,className:"rail-status-dot",describe:!1}):null]},oe)}),i.jsx("div",{className:"work-panel-rail-spacer"}),i.jsx("button",{type:"button",className:"icon-button shortcut-help-button",onClick:g,"aria-label":"查看键盘快捷键",title:"键盘快捷键(⌘/Ctrl+/)",children:i.jsx(Q,{name:"keyboard",size:17})}),i.jsx("button",{type:"button",className:"icon-button theme-cycle-button",onClick:f,"aria-label":`主题:${gf[W.current]},点击切换为${gf[W.next]}`,children:i.jsx(Q,{name:Yy[W.current],size:17})}),i.jsx("button",{type:"button",className:"icon-button inspector-toggle",onClick:p,"aria-label":a?"关闭工作面板":"打开工作面板","aria-controls":"work-panel","aria-expanded":a,children:i.jsx(Q,{name:"sidebar",size:17})})]}),M=V=>i.jsxs("div",{id:`${X}-${V}`,className:"work-panel-pane",role:"tabpanel","aria-label":mf[V].label,hidden:V!==x,children:[V==="agent"?i.jsx(_y,{state:n,actions:r,tab:E,onTabChange:$}):null,V==="review"?i.jsx(Vy,{workspaceId:n.workspaceId,refreshEpoch:A.review,actions:r,onSendToComposer:ye,navigatorWidthPx:J.review,onNavigatorWidthCommit:oe=>ne("review",oe)}):null,V==="terminal"?i.jsx(qy,{workspaceId:n.workspaceId,workspacePath:n.workspace,styleNonce:n.bootstrap?.nonce??"",available:!!n.bootstrap?.capabilities.terminal,actions:r}):null,V==="files"?i.jsx(Uy,{workspaceId:n.workspaceId,refreshEpoch:A.files,actions:r,navigatorWidthPx:J.files,onNavigatorWidthCommit:oe=>ne("files",oe)}):null,V==="git"?i.jsx(Hy,{workspaceId:n.workspaceId,refreshEpoch:A.git,actions:r,onSendToComposer:ye,navigatorWidthPx:J.git,onNavigatorWidthCommit:oe=>ne("git",oe)}):null]},V),pe=x==="terminal"||!G.current?[x]:[x,"terminal"];return i.jsxs("aside",{ref:N,id:"work-panel",className:`work-panel work-panel-${o} ${a?"drawer-open work-panel-expanded":"work-panel-collapsed"}`,role:o==="overlay"?"dialog":void 0,"aria-modal":o==="overlay"&&a?!0:void 0,"aria-label":"工作面板","data-mode":o,"data-state":a?"expanded":"collapsed",tabIndex:o==="overlay"&&a?-1:void 0,onKeyDownCapture:se,children:[o==="dock"?i.jsxs("div",{className:"work-panel-dock-body",children:[a?i.jsx("section",{ref:D,id:"work-panel-detail",className:"work-panel-detail","aria-label":"工作面板内容",tabIndex:-1,children:i.jsx("div",{className:"work-panel-content",children:i.jsx(m.Suspense,{fallback:i.jsx("p",{className:"resource-loading",children:"正在加载工作面板…"}),children:pe.map(V=>M(V))})})}):null,v()]}):i.jsxs("div",{id:"work-panel-detail",className:"work-panel-detail",hidden:!a,children:[v(!0),i.jsx("div",{className:"work-panel-content",children:i.jsx(m.Suspense,{fallback:i.jsx("p",{className:"resource-loading",children:"正在加载工作面板…"}),children:pe.map(V=>M(V))})})]}),o==="dock"&&a?i.jsx(zy,{width:te,maxWidth:L,onPreview:O,onCommit:F}):null]})}function Zy(n){return n?Array.from(n.querySelectorAll('a[href], button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])')).filter(r=>!r.hasAttribute("disabled")&&!r.closest("[inert]")&&!r.closest("[hidden]")&&r.getClientRects().length>0):[]}const cp="orion.web.right-workspace.v3",Ro=4,Co=300,up=160,dp=420,ex=280,tx=["files","git","review"],To=Object.freeze({files:Co,git:Co,review:Co});function fp(n){return Number.isFinite(n)?Math.min(dp,Math.max(up,Math.round(n))):Co}function rw(n){const r=Number.isFinite(n)?n:0,o=Math.min(dp,r*.48,r-ex);return Math.max(up,Math.floor(o))}const pp=Object.freeze({expanded:!0,activePanel:"agent",detailWidthPx:560,taskSubview:"overview",resourceNavigatorWidthPx:To}),nx=pp;function vf(){return Object.freeze({schemaVersion:Ro,projectNavigation:Object.freeze({expanded:!0,widthPx:280}),workPanel:Object.freeze({byWorkspace:Object.freeze({}),fallback:nx})})}function rx(n){const r=ec(n.agentPanel);return Object.freeze({expanded:n.expanded!==!1,activePanel:ei(n.activePanel)?n.activePanel:"agent",detailWidthPx:Math.max(320,Zs(Number.isFinite(n.widthPx)?Number(n.widthPx)-Ye:560)),taskSubview:r,resourceNavigatorWidthPx:To})}function sx(n,r){return n.workPanel.byWorkspace[r]??n.workPanel.fallback}function hp(n,r,o){const a=n.workPanel.byWorkspace[r]??n.workPanel.fallback,d=Object.freeze({...a,...o,resourceNavigatorWidthPx:o.resourceNavigatorWidthPx??a.resourceNavigatorWidthPx}),f={schemaVersion:Ro,projectNavigation:n.projectNavigation,workPanel:{...n.workPanel,byWorkspace:Object.freeze({...n.workPanel.byWorkspace,[r]:d})}};return Object.freeze(f)}function ix(n,r,o,a){const d=sx(n,r);return hp(n,r,{...d,resourceNavigatorWidthPx:Object.freeze({...d.resourceNavigatorWidthPx,[o]:fp(a)})})}function ox(n){if(!n)return null;try{const r=JSON.parse(n);if(!wr(r))return null;const o=r.schemaVersion;if(o!==3&&o!==Ro)return null;const a=wr(r.projectNavigation)?r.projectNavigation:{},d=wr(r.workPanel)?r.workPanel:{},f=wr(d.byWorkspace)?d.byWorkspace:{},p=wr(d.fallback)?d.fallback:{},g={};for(const[x,w]of Object.entries(f))wr(w)&&(g[x]=yf(w));return Object.freeze({schemaVersion:Ro,projectNavigation:Object.freeze({expanded:a.expanded!==!1,widthPx:Zs(Number(a.widthPx)||280)}),workPanel:Object.freeze({byWorkspace:Object.freeze(g),fallback:yf(p)})})}catch{return null}}function yf(n){return Object.freeze({expanded:n.expanded!==!1,activePanel:ei(n.activePanel)?n.activePanel:"agent",detailWidthPx:mp(Number(n.detailWidthPx)),taskSubview:ec(n.taskSubview),resourceNavigatorWidthPx:lx(n.resourceNavigatorWidthPx)})}function lx(n){if(!wr(n))return To;const r={...To};for(const o of tx){const a=Number(n[o]);Number.isFinite(a)&&(r[o]=fp(a))}return Object.freeze(r)}function mp(n){return Number.isFinite(n)?Math.min(3200,Math.max(360,Math.round(n))):pp.detailWidthPx}function ec(n){const r=String(n);return r==="goal"||r==="overview"?"overview":r==="activity"?"activity":r==="integrations"||r==="capabilities"?"capabilities":r==="diagnostics"?"diagnostics":"overview"}function ax(n){switch(n){case"overview":return"goal";case"activity":return"activity";case"capabilities":return"integrations";case"diagnostics":return"diagnostics"}}function wr(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}function cx(n){return["agent","review","terminal","files","git"].includes(n)}function ux(){const n=globalThis;try{return ox(n.window?.localStorage.getItem(cp)??null)}catch{return null}}function xf(n){const r=globalThis;try{r.window?.localStorage.setItem(cp,JSON.stringify(n))}catch{}}function dx(n,r){const[o,a]=m.useState(ux),d=n??"__fallback__",f=m.useMemo(()=>rx(r),[]),p=m.useMemo(()=>{const w=o?.workPanel.byWorkspace[d]??o?.workPanel.fallback??f;return{workspaceId:d,expanded:w.expanded,activePanel:cx(w.activePanel)?w.activePanel:"agent",agentPanel:ax(w.taskSubview),detailWidthPx:w.detailWidthPx,resourceNavigatorWidthPx:w.resourceNavigatorWidthPx}},[o,d,f]),g=m.useCallback(w=>{a(E=>{const S=E??vf(),P=S.workPanel.byWorkspace[d]??S.workPanel.fallback??f,R={expanded:w.expanded??P.expanded,activePanel:w.activePanel??P.activePanel,detailWidthPx:w.detailWidthPx??P.detailWidthPx,taskSubview:w.agentPanel?ec(w.agentPanel):P.taskSubview,resourceNavigatorWidthPx:P.resourceNavigatorWidthPx},$=hp(S,d,R);return xf($),$})},[d,f]),x=m.useCallback((w,E)=>{a(S=>{const P=S??vf(),R=ix(P,d,w,E);return xf(R),R})},[d]);return{value:p,update:g,setResourceNavigatorWidth:x}}const tc=320,wf=360,fx=1024,px=768,hx=.8;function gp(n){return Number.isFinite(n)&&n>0?Math.round(n):1440}function vp(n){const r=Math.floor(n*hx),o=n-tc-Ye;return Math.max(0,Math.min(r,o))}function kf(n){const r=gp(n.containerWidth),o=Math.max(0,Math.round(n.leftWidthPx)),a=Math.max(0,r-o);if(r<px)return Object.freeze({mode:"drawer",detailWidthPx:0,conversationWidthPx:a,canResize:!1});if(r<fx)return n.expanded?Object.freeze({mode:"drawer",detailWidthPx:0,conversationWidthPx:a,canResize:!0}):Object.freeze({mode:"rail",detailWidthPx:0,conversationWidthPx:a,canResize:!1});if(!n.expanded)return Object.freeze({mode:"rail",detailWidthPx:Ye,conversationWidthPx:a-Ye,canResize:!1});const d=vp(a);if(d<wf)return Object.freeze({mode:"rail",detailWidthPx:Ye,conversationWidthPx:a-Ye,canResize:!1});const f=Math.max(wf,Math.min(mp(n.storedDetailWidthPx),d)),p=a-f-Ye;return p<tc?Object.freeze({mode:"rail",detailWidthPx:Ye,conversationWidthPx:a-Ye,canResize:!1}):Object.freeze({mode:"dock",detailWidthPx:f,conversationWidthPx:p,canResize:d>f})}function jf(n){const r=gp(n.containerWidth),o=n.navigationExpanded?Math.max(240,Math.min(480,Math.round(n.navigationWidthPx))):Ye;let a=kf({containerWidth:r,leftWidthPx:o,expanded:n.workExpanded,storedDetailWidthPx:n.workDetailWidthPx});const d=kf({containerWidth:r,leftWidthPx:Ye,expanded:n.workExpanded,storedDetailWidthPx:n.workDetailWidthPx});return n.navigationExpanded&&(a.mode==="dock"&&a.conversationWidthPx<tc||a.mode!=="dock"&&d.mode==="dock")?(a=d,Object.freeze({projectNavigation:Object.freeze({mode:"rail",widthPx:Ye}),conversationWidthPx:a.conversationWidthPx,workPanel:Object.freeze({mode:a.mode,widthPx:a.mode==="dock"?a.detailWidthPx+Ye:a.detailWidthPx})})):Object.freeze({projectNavigation:Object.freeze({mode:n.navigationExpanded?"dock":"rail",widthPx:o}),conversationWidthPx:a.conversationWidthPx,workPanel:Object.freeze({mode:a.mode,widthPx:a.mode==="dock"?a.detailWidthPx+Ye:a.detailWidthPx})})}function mx(n,r,o){const a=r==="light"||r==="system"&&o;return n==="orion-blocksmith"?a?"#d7d0c1":"#15191b":a?"#f4f5f8":"#090b10"}function er(n,r){return n.some(o=>o.id===r.id)?n.map(o=>o.id===r.id?r:o):[r,...n]}const Mo=1e4,gx=256,vx=256,yx=128,xx=8,yp=8*1024*1024,wx=64;function kx(n=Wf,r){switch(r.type){case"baseline_loaded":{const o=n.workspaceId!==r.bootstrap.workspaceId||n.activeSessionId!==r.bootstrap.activeSessionId?Js(n):n,a=Rf(r.diagnostics,o.mode);return{...o,boot:"ready",bootError:void 0,bootstrap:r.bootstrap,contextRevision:r.bootstrap.contextRevision,workspaceId:r.bootstrap.workspaceId,workspace:r.workspaces.activePath||r.bootstrap.workspace,workspaces:r.workspaces.workspaces,sessions:r.sessions,workspaceSessions:{...o.workspaceSessions,[r.bootstrap.workspaceId]:{status:"ready",items:r.sessions,nextCursor:r.sessionNextCursor}},workspaceNextCursor:r.workspaces.nextCursor,sessionNextCursor:r.sessionNextCursor,activeSessionId:r.bootstrap.activeSessionId,sessionSync:r.bootstrap.activeSessionId?{...o.sessionSync,[r.bootstrap.activeSessionId]:{status:o.sessionProjectionById[r.bootstrap.activeSessionId]?"refreshing":"loading",requestId:null}}:o.sessionSync,settings:r.settings,diagnostics:r.diagnostics,skills:r.skills,skillNextCursor:r.skillNextCursor,mcpServers:r.mcpServers,mcpNextCursor:r.mcpNextCursor,toolDetails:r.toolDetails,toolDetailNextCursor:r.toolDetailNextCursor,notice:o.notice?.domain==="session-snapshot"?null:o.notice,processing:!!r.diagnostics.processing,mode:a,statusMessage:r.bootstrap.configured?"本地 Web Host 已就绪":"模型尚未配置,任务提交已停用",announcement:r.bootstrap.configured?"本地 Web Host 已就绪":"Orion 尚未配置模型"}}case"boot_failed":return{...n,boot:"error",bootError:r.message,connection:Px()?"reconnecting":"offline",announcement:`启动失败:${r.message}`};case"connection_changed":return n.connection==="replay-required"?n:{...n,connection:r.phase,connectionAttempt:r.attempt,announcement:Rx(r.phase,r.attempt)};case"event_received":return jx(n,r.envelope);case"session_snapshot_started":return n.contextRevision!==r.contextRevision||n.workspaceId!==r.workspaceId?n:yo(Gs(n,r.sessionId,{status:r.cached?"refreshing":"loading",requestId:r.requestId}),{snapshotLoads:1});case"session_snapshot_loaded":{const o=r.snapshot.session.id;return!Pf(n,r.contextRevision,r.workspaceId)||!Ef(n,o,r.requestId)?n:n.activeSessionId!==o?r.requestId===void 0?n:If(Cf(n,r.snapshot),o):If(Sf(n,r.snapshot,r.advanceEventCursor!==!1),o)}case"composer_loaded":return r.composer.sessionId!==n.activeSessionId||r.composer.workspaceId!==n.workspaceId||r.composer.contextRevision!==n.contextRevision?n:xp(n,r.composer);case"model_catalog_loaded":return{...n,modelCatalog:r.catalog};case"durable_session_metadata_loaded":return n.contextRevision!==r.contextRevision||n.workspaceId!==r.workspaceId?n:n.activeSessionId!==r.snapshot.session.id?Cf(n,r.snapshot):r.snapshot.runtime.active!==!0?n:Nx(n,r.snapshot);case"older_transcript_loaded":{if(n.activeSessionId!==r.snapshot.session.id||!n.sessionSnapshot)return n;const o=new Set(n.transcript.map(d=>d.id)),a=wp(r.snapshot).filter(d=>!o.has(d.id));return{...n,transcript:[...a,...n.transcript].sort((d,f)=>d.order-f.order).slice(-Mo),sessionSnapshot:{...n.sessionSnapshot,transcript:{items:n.sessionSnapshot.transcript.items,nextCursor:r.snapshot.transcript.nextCursor}},announcement:`已加载 ${a.length} 条更早记录`}}case"sessions_loaded":return{...n,sessions:r.append?Jn(n.sessions,r.sessions,o=>o.id):r.sessions,sessionNextCursor:r.nextCursor,workspaceSessions:n.workspaceId?{...n.workspaceSessions,[n.workspaceId]:{status:"ready",items:r.append?Jn(n.sessions,r.sessions,o=>o.id):r.sessions,nextCursor:r.nextCursor}}:n.workspaceSessions};case"workspaces_loaded":return{...n,workspaceId:r.value.activeId||n.workspaceId,workspace:r.value.activePath||n.workspace,workspaces:r.append?Jn(n.workspaces,r.value.workspaces,o=>o.id):r.value.workspaces,workspaceNextCursor:r.value.nextCursor};case"workspace_sessions_loading":return{...n,workspaceSessions:{...n.workspaceSessions,[r.workspaceId]:{status:"loading",items:n.workspaceSessions[r.workspaceId]?.items??[],nextCursor:n.workspaceSessions[r.workspaceId]?.nextCursor??null}}};case"workspace_sessions_loaded":{const o=n.workspaceSessions[r.workspaceId],a=r.append?Jn(o?.items??[],r.sessions,d=>d.id):r.sessions;return{...n,sessions:r.workspaceId===n.workspaceId?a:n.sessions,sessionNextCursor:r.workspaceId===n.workspaceId?r.nextCursor:n.sessionNextCursor,workspaceSessions:{...n.workspaceSessions,[r.workspaceId]:{status:"ready",items:a,nextCursor:r.nextCursor}}}}case"workspace_sessions_failed":return{...n,workspaceSessions:{...n.workspaceSessions,[r.workspaceId]:{status:"error",items:n.workspaceSessions[r.workspaceId]?.items??[],nextCursor:n.workspaceSessions[r.workspaceId]?.nextCursor??null,error:r.detail}}};case"session_updated":return bf(n,a=>bx(a,r.session));case"session_archived":{const o=Nf(n,r.session.id),a=n.archivedSessions.items.some(d=>d.id===r.session.id);return{...o,archivedSessions:a?o.archivedSessions:{...o.archivedSessions,status:"ready",items:[r.session,...o.archivedSessions.items]}}}case"session_restored":{const o=bf(n,a=>[r.session,...a.filter(d=>d.id!==r.session.id)]);return{...o,archivedSessions:{...o.archivedSessions,items:o.archivedSessions.items.filter(a=>a.id!==r.session.id)}}}case"session_deleted":{const o={...n.sessionRuntimeById};return delete o[r.sessionId],{...Nf(n,r.sessionId),sessionRuntimeById:o,archivedSessions:{...n.archivedSessions,items:n.archivedSessions.items.filter(a=>a.id!==r.sessionId)}}}case"archived_sessions_loading":return r.workspaceId!==n.workspaceId?n:{...n,archivedSessions:{status:"loading",items:n.archivedSessions.ownerWorkspaceId===r.workspaceId?n.archivedSessions.items:[],nextCursor:n.archivedSessions.nextCursor,ownerWorkspaceId:n.archivedSessions.ownerWorkspaceId}};case"archived_sessions_loaded":{if(r.workspaceId!==n.workspaceId)return n;const o=r.append?Jn(n.archivedSessions.items,r.sessions,a=>a.id):r.sessions;return{...n,archivedSessions:{status:"ready",items:o,nextCursor:r.nextCursor,ownerWorkspaceId:r.workspaceId}}}case"archived_sessions_failed":return r.workspaceId!==n.workspaceId?n:{...n,archivedSessions:{...n.archivedSessions,status:"error",ownerWorkspaceId:r.workspaceId,error:r.detail}};case"workspace_project_summary_loaded":return{...n,workspaceProjectSummaries:{...n.workspaceProjectSummaries,[r.summary.workspaceId]:r.summary}};case"settings_loaded":return{...n,settings:r.settings};case"settings_mirror_changed":return{...n,settings:r.snapshot.document??r.snapshot.lastGood,settingsMirror:r.snapshot};case"diagnostics_loaded":return{...n,diagnostics:r.diagnostics,processing:!!(r.diagnostics.processing??n.processing),mode:Rf(r.diagnostics,n.mode)};case"capabilities_loaded":return{...n,skills:r.append?Jn(n.skills,r.skills,o=>o.id):r.skills,skillNextCursor:r.skillNextCursor,mcpServers:r.append?Jn(n.mcpServers,r.mcpServers,o=>o.id):r.mcpServers,mcpNextCursor:r.mcpNextCursor};case"tool_details_loaded":return{...n,toolDetails:r.append?Jn(n.toolDetails,r.details,o=>`${o.sequence}:${o.callId}`):r.details,toolDetailNextCursor:r.nextCursor};case"pending_action":return{...n,pendingAction:r.label};case"notice":return{...n,notice:r.notice};case"approval_resolved":return n.permission?.id!==r.requestId?n:{...n,permission:null,announcement:r.approved?"工具权限已授予":"工具请求已拒绝"};case"snapshot_failed":{if(!Pf(n,r.contextRevision,r.workspaceId))return n;if(!r.sessionId)return n.connection==="replay-required"?n:{...n,notice:{id:r.requestId??n.lastCursor,tone:"warning",title:"会话状态尚未同步",detail:r.detail},announcement:"会话状态尚未同步"};if(!Ef(n,r.sessionId,r.requestId)||r.sessionId!==n.activeSessionId&&r.requestId===void 0)return n;const o=yo(Gs(n,r.sessionId,{status:"failed",requestId:r.requestId??n.sessionSync[r.sessionId]?.requestId??null,error:r.detail}),{snapshotFailures:1});return r.sessionId!==n.activeSessionId||n.connection==="replay-required"?o:{...o,statusMessage:n.sessionSnapshot?.session.id===r.sessionId?"会话刷新失败,当前显示最近状态":"会话快照加载失败",notice:{id:r.requestId??n.lastCursor,tone:"warning",title:"会话快照尚未同步",detail:r.detail,domain:"session-snapshot",sessionId:r.sessionId},announcement:"当前会话快照尚未同步,写操作已暂停"}}case"reset_session_view":{const o=!!r.activeSessionId&&r.activeSessionId!==n.activeSessionId,a=!!(r.activeSessionId&&n.sessionProjectionById[r.activeSessionId]),d={...o?{sessionSwitches:1}:{},...a?{snapshotCacheHits:1}:{}};if(r.activeSessionId&&n.sessionProjectionById[r.activeSessionId]){const g=r.activeSessionId,x=Sf({...n,activeSessionId:g},n.sessionProjectionById[g],!1);return yo({...Gs(x,g,{status:"refreshing",requestId:n.sessionSync[g]?.requestId??null}),notice:n.notice?.domain==="session-snapshot"&&n.notice.sessionId!==g?null:n.notice,statusMessage:"已显示最近会话状态,正在同步…",announcement:"已切换到缓存会话,正在同步最新状态"},d)}const f={...Js(n),activeSessionId:r.activeSessionId,notice:n.notice?.domain==="session-snapshot"&&n.notice.sessionId!==r.activeSessionId?null:n.notice,statusMessage:r.activeSessionId?"正在加载会话快照…":"请选择会话",announcement:r.activeSessionId?"正在加载会话快照":"会话已清除"},p=r.activeSessionId?Gs(f,r.activeSessionId,{status:"loading",requestId:n.sessionSync[r.activeSessionId]?.requestId??null}):f;return yo(p,d)}case"recovering":return{...n,connection:"connecting",replayReason:void 0,notice:null,announcement:"正在重新加载会话状态"}}}function jx(n,r){if(r.type==="replay_reset")return{...n,lastCursor:r.cursor,lastEventId:r.eventId,connection:"replay-required",replayReason:r.payload.reason,notice:{id:r.cursor,tone:"warning",title:"需要重新载入会话",detail:r.payload.reason,domain:"transport"},announcement:"事件历史已超出保留窗口,需要重新载入会话"};if(n.connection==="replay-required"||r.cursor<=n.lastCursor)return n;const o={...n,lastCursor:r.cursor,lastEventId:r.eventId};if(r.type==="settings_invalidated")return{...o,announcement:r.payload.revision===n.settings?.revision?"Host 设置已同步":r.payload.state==="invalid"?"设置文档无效,仍保留上一次可用值":"Host 设置已更新,正在刷新"};if(r.type==="workspace_resource_invalidated"){const d={...n.workspaceResourceEpochs[r.payload.workspaceId]??{files:0,git:0,review:0}};for(const f of r.payload.resources)d[f]=r.cursor;return{...o,workspaceResourceEpochs:{...n.workspaceResourceEpochs,[r.payload.workspaceId]:d},announcement:"项目资源已变化,可用面板正在刷新"}}if(r.type==="workbench_state"){const a=n.workspaceId!==""&&n.workspaceId!==r.payload.workspaceId||n.workspace!==""&&n.workspace!==r.payload.workspace;return{...a?Js(o):o,contextRevision:r.payload.contextRevision,workspaceId:r.payload.workspaceId,workspace:r.payload.workspace,activeSessionId:a?null:n.activeSessionId}}if(r.type==="composer_state_changed"){const a=r.payload.state;return a.sessionId!==o.activeSessionId||a.workspaceId!==o.workspaceId||a.contextRevision!==o.contextRevision?o:xp(o,a)}if(r.type==="session_runtime_changed"){const a=r.payload.runtime,d=o.sessionProjectionById[a.sessionId],f=Bo(o.sessionRuntimeById,a),p=d?Fo(o.sessionProjectionById,{...d,sessionRuntime:a}):o.sessionProjectionById;return a.sessionId!==o.activeSessionId?{...o,sessionProjectionById:p,sessionRuntimeById:f}:{...o,sessionProjectionById:p,sessionRuntimeById:f,processing:["running","waiting_approval","stopping"].includes(a.phase),sessionSnapshot:o.sessionSnapshot?.session.id===a.sessionId?{...o.sessionSnapshot,sessionRuntime:a}:o.sessionSnapshot,composer:o.composer?.sessionId===a.sessionId?{...o.composer,sessionRuntime:a}:o.composer}}if(r.type==="workspace_mutation_changed"){if(r.sessionId!==o.activeSessionId)return o;const a=o.tools.find(f=>f.callId===r.payload.state.callId);if(!a)return o;const d={phase:r.payload.state.phase,...r.payload.state.queuePosition===void 0?{}:{queuePosition:r.payload.state.queuePosition}};return{...o,tools:Ha(o.tools,{...a,workspaceMutation:d}),announcement:d.phase==="queued"?`工具 ${a.name} 正在等待工作树写入`:d.phase==="running"?`工具 ${a.name} 已获得工作树写入权限`:o.announcement}}return r.sessionId!==null&&r.sessionId!==o.activeSessionId?o:r.type==="thread_event"?Sx(o,r.payload.value):Cx(o,r.payload.value,r.eventId,r.cursor,r.timestamp)}function Sx(n,r){const o=r.payload;switch(o.type){case"thread.started":case"thread.resumed":return{...n,statusMessage:"会话线程已就绪"};case"thread.forked":return{...n,statusMessage:"分支线程已就绪"};case"turn.started":return{...n,processing:!0,statusMessage:o.data.mode==="plan"?"正在制定计划…":"Orion 正在处理…",announcement:"新回合已开始"};case"turn.queued":return{...n,statusMessage:"消息已进入 Runtime 队列"};case"turn.queue_expired":return{...n,notice:{id:n.lastCursor,tone:"warning",title:"一条排队消息已过期",detail:`队列项 ${o.data.queueId} 未在时限内开始。`}};case"turn.steered":return{...n,statusMessage:"已将补充指令送入当前回合"};case"turn.interrupt_requested":return{...n,statusMessage:"正在中断当前回合…"};case"turn.committed":return{...n,statusMessage:"回合结果已持久化"};case"plan.review_requested":return{...n,processing:!1,statusMessage:"计划已保存,等待审核",announcement:"计划已准备好,请审核后再执行"};case"plan.review_resolved":return{...n,statusMessage:o.data.action==="approve"?"计划已批准,正在进入 BUILD":o.data.action==="continue"?"已提交继续规划反馈":"计划已取消"};case"turn.completed":return{...n,processing:!1,permission:null,statusMessage:"任务已完成",announcement:"当前回合已完成"};case"turn.failed":return{...n,processing:!1,permission:null,statusMessage:"当前回合失败",notice:{id:n.lastCursor,tone:"error",title:"当前回合失败",detail:o.data.error},announcement:"当前回合失败"};case"turn.interrupted":return{...n,processing:!1,permission:null,statusMessage:"当前回合已中断",announcement:"当前回合已中断"};case"compact.started":return{...n,statusMessage:"正在压缩上下文…"};case"compact.completed":return{...n,statusMessage:"上下文压缩完成"};case"compact.failed":return{...n,statusMessage:"上下文压缩失败",notice:{id:n.lastCursor,tone:"warning",title:"上下文压缩失败",detail:o.data.error}};case"approval.requested":return{...n,statusMessage:`等待确认:${o.data.toolName}`};case"item.started":case"item.delta":case"item.completed":case"item.failed":case"item.interrupted":case"item.indeterminate":case"step.snapshot":case"capability.receipt":case"tool.receipt":return n}}function Cx(n,r,o,a,d){switch(r.type){case"transcript_append":{const f={...r.entry,id:`web-entry-${a}`,eventId:o,order:a,receivedAt:d};return{...n,transcript:No(n.transcript,f,Mo)}}case"transcript_update":if(r.contentDelta!==void 0){const f=n.transcript.find(p=>p.id===r.id);if(!f||r.contentStart===void 0||(f.content??"").length!==r.contentStart){const p="流式回复基线已变化,需要重新载入会话。";return{...n,connection:"replay-required",replayReason:p,notice:{id:a,tone:"warning",title:"需要重新载入会话",detail:p},announcement:p}}}return{...n,transcript:n.transcript.map(f=>f.id===r.id?{...f,...r.patch,...r.contentDelta===void 0?{}:{content:`${f.content??""}${r.contentDelta}`}}:f)};case"transcript_finalize":return{...n,transcript:n.transcript.map(f=>f.id===r.id?{...f,...r.patch,live:!1}:f)};case"transcript_remove":return{...n,transcript:n.transcript.filter(f=>f.id!==r.id)};case"transcript_replace":{const f=Math.max(1,r.entries.length);return{...n,transcript:r.entries.slice(-Mo).map((p,g)=>({...p,eventId:`${o}:${g}`,order:a-1+(g+1)/(f+1),receivedAt:d,live:!1}))}}case"transcript_clear":return{...Js(n),activeSessionId:n.activeSessionId,statusMessage:"新会话已就绪"};case"status_changed":return{...n,statusMessage:r.message};case"permission_requested":return{...n,permission:{...r.request,eventId:o},announcement:`需要确认工具权限:${r.request.name}`};case"tool_started":{const f={callId:r.event.callId,eventId:o,order:a,name:r.event.name,args:r.event.args,sequence:r.event.sequence,state:"running",startedAt:d};return{...n,tools:Ha(n.tools,f),announcement:`工具 ${f.name} 已开始`}}case"tool_finished":{const f=n.tools.find(g=>g.callId===r.event.callId),p={callId:r.event.callId,eventId:f?.eventId??o,order:f?.order??a,name:r.event.name,args:r.event.args,sequence:r.event.sequence,state:r.event.skipped?"skipped":r.event.success?"success":"error",startedAt:f?.startedAt,finishedAt:d,duration:r.event.duration,summary:r.event.summary,error:r.event.error,outputBytes:r.event.outputBytes,artifactId:r.event.artifactRef?.id,authorization:r.event.authorization};return{...n,tools:Ha(n.tools,p),announcement:`工具 ${p.name} ${p.state==="success"?"已完成":p.state==="skipped"?"已跳过":"失败"}`}}case"edit_preview_requested":{const f={eventId:o,order:a,receivedAt:d,request:r.request};return{...n,edits:No(n.edits,f,gx)}}case"session_restored":return{...n,activeSessionId:r.event.sessionId,statusMessage:`已恢复 ${r.event.restoredMessages} 条消息`,announcement:"会话恢复完成",notice:r.event.warnings&&r.event.warnings.length>0?{id:a,tone:"warning",title:"会话已恢复,但有注意事项",detail:r.event.warnings.join(" ")}:n.notice};case"loop_stats_updated":return{...n,loopStats:r.stats};case"trace_event_recorded":return{...n,traces:No(n.traces,r.event,vx)};case"harness_diagnostics_updated":return{...n,diagnostics:{...n.diagnostics??{},harness:r.diagnostics}};case"subtask_event":{const f={...r.event,eventId:o,order:a,updatedAt:d},p=[...n.subtasks.filter(g=>g.taskId!==f.taskId),f].slice(-256);return{...n,subtasks:p}}case"research_event":return{...n,research:Ix(n.research,r.event,o,a,d)};case"goal_event":return _x(n,r.event,d);case"effort_event":return{...n,effort:r.event};case"followup_queue_changed":return{...n,queue:r.snapshot};case"processing_changed":return{...n,processing:r.processing,permission:r.processing?n.permission:null,announcement:r.processing?"Orion 开始处理任务":"Orion 已完成当前处理"};case"agent_mode_changed":return{...n,mode:r.snapshot};case"clear_view":return{...n,transcript:[],tools:[],edits:[]};case"shutdown_requested":return{...n,connection:"closed",processing:!1,permission:null,statusMessage:r.reason??"Web Host 已关闭",announcement:"Orion Web Host 已关闭"};case"session_picker_requested":case"model_picker_requested":return n}}function Sf(n,r,o=!0){const a=wp(r).slice(-Mo),d=jp(r.runtime.agentMode)?r.runtime.agentMode:n.mode.baseMode,f=r.pendingApprovals[0],p=kp(r.goal);return{...Js(n),lastCursor:o?Math.max(n.lastCursor,r.eventCursor):n.lastCursor,activeSessionId:r.session.id,sessionProjectionById:Fo(n.sessionProjectionById,r),sessionRuntimeById:Bo(n.sessionRuntimeById,r.sessionRuntime),sessions:er(n.sessions,r.session),workspaceSessions:n.workspaceId?{...n.workspaceSessions,[n.workspaceId]:{status:"ready",items:er(n.workspaceSessions[n.workspaceId]?.items??n.sessions,r.session),nextCursor:n.workspaceSessions[n.workspaceId]?.nextCursor??n.sessionNextCursor}}:n.workspaceSessions,transcript:a,permission:f?{id:f.id,name:f.toolName,reason:f.reason,args:{...f.sanitizedArguments},eventId:`snapshot:${f.id}`}:null,processing:r.runtime.processing,statusMessage:r.runtime.status,mode:r.composer.mode??{baseMode:d,pendingBaseMode:null},queue:{items:r.composer.queue.items.map(g=>({...g})),limit:r.composer.queue.limit},goal:p,plan:r.plan??null,composer:r.composer,sessionSnapshot:r,diagnostics:{...n.diagnostics??{},activeSessionId:r.session.id,processing:r.runtime.processing,agentMode:d,permissionMode:r.runtime.permissionMode,contextUsage:r.runtime.contextUsage,tokenUsage:r.runtime.tokenUsage,plan:r.plan?.body??null,recoveryDiagnostics:r.recoveryDiagnostics},announcement:"会话快照已同步"}}function Cf(n,r){const o=n.workspaceId?{...n.workspaceSessions,[n.workspaceId]:{status:"ready",items:er(n.workspaceSessions[n.workspaceId]?.items??n.sessions,r.session),nextCursor:n.workspaceSessions[n.workspaceId]?.nextCursor??n.sessionNextCursor}}:n.workspaceSessions;return{...n,sessionProjectionById:Fo(n.sessionProjectionById,r),sessionRuntimeById:Bo(n.sessionRuntimeById,r.sessionRuntime),sessions:er(n.sessions,r.session),workspaceSessions:o}}function xp(n,r){const o=n.sessionProjectionById[r.sessionId],a=o?Fo(n.sessionProjectionById,{...o,sessionRuntime:r.sessionRuntime,composer:r}):n.sessionProjectionById;return{...n,composer:r,sessionSnapshot:n.sessionSnapshot?.session.id===r.sessionId?{...n.sessionSnapshot,sessionRuntime:r.sessionRuntime,composer:r}:n.sessionSnapshot,sessionProjectionById:a,sessionRuntimeById:Bo(n.sessionRuntimeById,r.sessionRuntime),processing:r.processing,mode:r.mode,queue:{items:r.queue.items.map(d=>({...d})),limit:r.queue.limit},diagnostics:{...n.diagnostics??{},contextUsage:r.contextUsage,agentMode:r.mode.baseMode}}}function Nx(n,r){const o=er(n.sessions,r.session),a=n.workspaceSessions[n.workspaceId],d=!n.composer||n.composer.controlRevision===r.composer.controlRevision?r.composer:n.composer;return{...n,sessions:o,workspaceSessions:{...n.workspaceSessions,[n.workspaceId]:{status:"ready",items:er(a?.items??n.sessions,r.session),nextCursor:a?.nextCursor??n.sessionNextCursor}},goal:kp(r.goal),plan:r.plan,composer:d,sessionSnapshot:n.sessionSnapshot?.session.id===r.session.id?{...n.sessionSnapshot,session:r.session,goal:r.goal,plan:r.plan,composer:d,recoveryDiagnostics:r.recoveryDiagnostics}:n.sessionSnapshot,diagnostics:{...n.diagnostics??{},plan:r.plan?.body??null,recoveryDiagnostics:r.recoveryDiagnostics}}}function wp(n){return n.transcript.items.map((r,o)=>{const a=Number.parseInt(r.id.split(":").at(-1)??"",10);return{id:r.id,role:r.role,content:r.content,eventId:`snapshot:${r.id}`,order:-1e9+(Number.isSafeInteger(a)?a:o),receivedAt:Ex(r.timestamp),live:!1}})}function kp(n){if(!n||!Vs(n.state))return null;const r=n.state;if(typeof r.goalId!="string"||typeof r.objective!="string"||typeof r.status!="string")return null;const o=Vs(r.budget)?r.budget:null,a=Vs(r.lastStopDecision)?r.lastStopDecision:null,d=a&&Vs(a.reason)?xo(a.reason.message):xo(r.stopReason),f=Vs(r.criteria)?{passed:Zt(r.criteria.passed),total:Zt(r.criteria.total),failed:Zt(r.criteria.failed),stale:Zt(r.criteria.stale)}:void 0;return{goalId:r.goalId,revision:Zt(r.revision,Zt(r.generation,1)),objective:r.objective,status:r.status,tokenBudget:Ta(r.tokenBudget)??Ta(o?.maxTokens),tokensUsed:Zt(r.tokensUsed),timeUsedMs:Zt(r.timeUsedMs,Zt(r.elapsedMs)),continuationCount:Zt(r.continuationCount),updatedAt:Zt(r.updatedAt),stopReason:d,criteria:f,planRevision:Ta(r.planRevision),planPhase:xo(r.planPhase),nextAction:xo(r.nextAction),auditRemaining:Array.isArray(r.auditRemaining)?r.auditRemaining.filter(p=>typeof p=="string"):void 0}}function Jn(n,r,o){const a=new Map(n.map(d=>[o(d),d]));for(const d of r)a.set(o(d),d);return[...a.values()]}function bx(n,r){const o=n.findIndex(d=>d.id===r.id);if(o<0)return[r,...n];const a=[...n];return a[o]=r,a}function Nf(n,r){const o=n.workspaceId,a=o?n.workspaceSessions[o]:void 0,d=(a?.items??n.sessions).filter(f=>f.id!==r);return{...n,sessions:o?d:n.sessions,workspaceSessions:o?{...n.workspaceSessions,[o]:{status:(a?.status??"ready")==="error"?"error":"ready",items:d,nextCursor:a?.nextCursor??null,error:a?.error}}:n.workspaceSessions}}function bf(n,r){const o=n.workspaceId,a=o?n.workspaceSessions[o]:void 0,d=a?.items??n.sessions,f=r(d),p=a?.status==="error"?"error":a?.status==="loading"?"loading":"ready";return{...n,sessions:o?f:n.sessions,workspaceSessions:o?{...n.workspaceSessions,[o]:{status:p,items:f,nextCursor:a?.nextCursor??null,error:a?.error}}:n.workspaceSessions}}function _x(n,r,o){switch(r.type){case"goal_updated":case"goal_restored":return{...n,goal:r.goal,goalActivity:Zr(n.goalActivity,r.type,"Goal 状态已更新",o)};case"goal_completed":return{...n,goal:r.goal,goalActivity:Zr(n.goalActivity,r.type,r.audit.verificationSummary,o),announcement:"Goal 已完成并通过运行时审计"};case"goal_cleared":return{...n,goal:null,goalEvidence:[],goalActivity:Zr(n.goalActivity,r.type,r.reason,o)};case"goal_plan_updated":return{...n,goal:n.goal?{...n.goal,planRevision:r.planRevision,planPhase:r.phase,nextAction:r.nextAction}:n.goal,goalActivity:Zr(n.goalActivity,r.type,r.nextAction??`Plan phase: ${r.phase}`,o)};case"goal_evidence_recorded":{const a=r.evidence;return{...n,goalEvidence:[...n.goalEvidence.filter(d=>d.id!==a.id),a].slice(-256)}}case"goal_continuation":return{...n,goalActivity:Zr(n.goalActivity,`${r.type}:${r.phase}`,r.reason,o)};case"goal_audit_failed":return{...n,goalActivity:Zr(n.goalActivity,r.type,r.summary,o),notice:{id:Date.parse(o),tone:"warning",title:"Goal 审计尚未通过",detail:r.summary}}}}function Ix(n,r,o,a,d){const p=n.find(x=>x.packetId===r.packetId)??{packetId:r.packetId,eventId:o,order:a,updatedAt:d,stage:"running",sources:[],conflicts:[]};let g;switch(r.type){case"research_started":g={...p,eventId:o,order:a,updatedAt:d,objective:r.objective,mode:r.mode,stage:"running"};break;case"research_source":{const x={id:r.sourceId,provider:r.provider,status:r.status,title:r.title,location:r.displayUrl??r.canonicalUrl??r.projectPath,failureReason:r.failureReason};g={...p,eventId:o,order:a,updatedAt:d,sources:[...p.sources.filter(w=>w.id!==x.id),x].slice(-64)};break}case"research_conflict":g={...p,eventId:o,order:a,updatedAt:d,conflicts:[...p.conflicts.filter(x=>x!==r.claimId),r.claimId].slice(-64)};break;case"research_completed":g={...p,eventId:o,order:a,updatedAt:d,stage:r.stage,auditStatus:r.auditStatus,conclusion:r.conclusion,summary:r.summary};break}return[...n.filter(x=>x.packetId!==r.packetId),g].slice(-128)}function Ha(n,r){return[...n.filter(o=>o.callId!==r.callId),r].sort((o,a)=>o.order-a.order).slice(-1e3)}function Fo(n,r){const o=Object.entries(n).filter(([d])=>d!==r.session.id);o.push([r.session.id,r]);let a=o.reduce((d,[,f])=>d+_f(f),0);for(;o.length>1&&(o.length>xx||a>yp);){const d=o.shift();d&&(a-=_f(d[1]))}return Object.freeze(Object.fromEntries(o))}function Bo(n,r){const o=Object.entries(n).filter(([a])=>a!==r.sessionId);return o.push([r.sessionId,r]),Object.freeze(Object.fromEntries(o.slice(-64)))}function _f(n){try{return JSON.stringify(n).length*2}catch{return yp}}function Js(n){return{...n,transcript:[],tools:[],edits:[],subtasks:[],research:[],permission:null,processing:!1,statusMessage:"",queue:{items:[],limit:16},goal:null,goalEvidence:[],goalActivity:[],sessionSnapshot:null,composer:null,modelCatalog:null,plan:null,loopStats:null,traces:[]}}function Gs(n,r,o){const a={...n.sessionSync};delete a[r],a[r]=o;const d=Object.keys(a).length-wx;return d>0&&Object.keys(a).filter(f=>f!==n.activeSessionId&&f!==r).slice(0,d).forEach(f=>delete a[f]),{...n,sessionSync:a}}function yo(n,r){const o={sessionSwitches:n.clientTelemetry.sessionSwitches+(r.sessionSwitches??0),snapshotCacheHits:n.clientTelemetry.snapshotCacheHits+(r.snapshotCacheHits??0),snapshotLoads:n.clientTelemetry.snapshotLoads+(r.snapshotLoads??0),snapshotFailures:n.clientTelemetry.snapshotFailures+(r.snapshotFailures??0)};return{...n,clientTelemetry:o}}function If(n,r){const o=Gs(n,r,{status:"ready",requestId:n.sessionSync[r]?.requestId??null});return o.notice?.domain!=="session-snapshot"||o.notice.sessionId!==r?o:{...o,notice:null}}function Ef(n,r,o){return o===void 0||n.sessionSync[r]?.requestId===o}function Pf(n,r,o){return(r===void 0||n.contextRevision===r)&&(o===void 0||n.workspaceId===o)}function Zr(n,r,o,a){return No(n,{type:r,message:o,timestamp:a},yx)}function No(n,r,o){const a=[...n,r];return a.length<=o?a:a.slice(a.length-o)}function Rf(n,r){const o=n.agentMode;return jp(o)?{baseMode:o,pendingBaseMode:null}:r}function jp(n){return n==="interactive"||n==="plan"||n==="auto"}function Ex(n){const r=new Date(n);return Number.isFinite(r.getTime())?r.toISOString():new Date(0).toISOString()}function Vs(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}function Zt(n,r=0){return typeof n=="number"&&Number.isFinite(n)?n:r}function Ta(n){return typeof n=="number"&&Number.isFinite(n)?n:void 0}function xo(n){return typeof n=="string"&&n?n:void 0}function Px(){return typeof navigator>"u"||navigator.onLine}function Rx(n,r){return n==="live"?"本地 Web Host 事件流已连接":n==="offline"?"浏览器已离线,本地 Web Host 将在网络恢复后重连":n==="reconnecting"?`正在重新连接本地 Web Host,第 ${Math.max(1,r)} 次尝试`:n==="connecting"?"正在连接本地 Web Host":n==="replay-required"?"本地 Web Host 事件历史需要重新载入":"本地 Web Host 已关闭"}const Tf="orion.web.theme",Mf="orion.web.motion";function Tx(n){const r=Af(Tf),o=Af(Mf),a=Mx(r),d=Ox(o),f=[],p=[];return r!==null&&p.push(Tf),o!==null&&p.push(Mf),n.sections.appearance.theme.explicitValue===void 0&&a&&f.push({op:"set",key:"appearance.theme",value:a}),n.sections.appearance.motion.explicitValue===void 0&&d&&f.push({op:"set",key:"appearance.motion",value:d}),{operations:f,keysToClear:p}}function Of(n){if(!(typeof window>"u"))for(const r of n)try{window.localStorage.removeItem(r)}catch{}}function Af(n){if(typeof window>"u")return null;try{return window.localStorage.getItem(n)}catch{return null}}function Mx(n){return n==="system"||n==="light"||n==="dark"?n:null}function Ox(n){return n==="system"||n==="reduced"?n:null}class Ax{constructor(r){Ft(this,"read");Ft(this,"snapshot",Object.freeze({status:"idle",document:null,lastGood:null,stale:!1,error:null,generation:0}));Ft(this,"listeners",new Set);Ft(this,"inFlight",null);Ft(this,"rerun",!1);Ft(this,"generation",0);Ft(this,"disposed",!1);this.read=r}getSnapshot(){return this.snapshot}subscribe(r){return this.listeners.add(r),()=>this.listeners.delete(r)}ensure(){return this.snapshot.document||this.inFlight?this.inFlight??Promise.resolve(this.snapshot):this.refresh()}refresh(){if(this.disposed)return Promise.resolve(this.snapshot);if(this.inFlight)return this.rerun=!0,this.inFlight;const r=Promise.resolve().then(()=>this.run());return this.inFlight=r,r}accept(r){return this.disposed?this.snapshot:(this.generation+=1,this.inFlight&&(this.rerun=!0),this.publishDocument(r))}invalidate(r,o){return this.snapshot.document?.revision===r&&(o==="ready"?this.snapshot.document.state==="ready":this.snapshot.document.state==="invalid")?Promise.resolve(this.snapshot):(this.setSnapshot({...this.snapshot,stale:!0}),this.refresh())}reset(){this.disposed||(this.generation+=1,this.rerun=!1,this.setSnapshot({status:"idle",document:null,lastGood:null,stale:!1,error:null,generation:this.generation}))}dispose(){this.disposed=!0,this.generation+=1,this.listeners.clear()}async run(){try{do{this.rerun=!1;const r=++this.generation;this.setSnapshot({...this.snapshot,status:this.snapshot.document?"ready":"loading",error:null,generation:r});try{const o=await this.read();if(this.disposed)return this.snapshot;if(r!==this.generation)continue;this.publishDocument(o)}catch(o){if(this.disposed)return this.snapshot;if(r!==this.generation)continue;this.setSnapshot({...this.snapshot,status:this.snapshot.document?"ready":"unavailable",stale:!0,error:o instanceof Error?o.message:"设置读取失败。",generation:r})}}while(this.rerun&&!this.disposed);return this.snapshot}finally{if(this.inFlight=null,this.rerun&&!this.disposed)return this.refresh()}}publishDocument(r){const o=r.state==="ready"?r:this.snapshot.lastGood;return this.setSnapshot({status:"ready",document:r,lastGood:o,stale:!1,error:null,generation:this.generation}),this.snapshot}setSnapshot(r){this.snapshot=Object.freeze(r);for(const o of this.listeners)o()}}function $x(n,r,o){if(n)return n;const a=new Set(r.map(d=>d.id));return o&&a.has(o)?o:r[0]?.id??null}const Lx=7,Dx=2;function zx(){const n=m.useMemo(()=>new yg,[]),r=m.useMemo(()=>new Ax(()=>n.settings()),[n]),[o,a]=m.useReducer(kx,Wf),[d,f]=m.useState(0),p=m.useRef(o),g=m.useRef(null),x=m.useRef(0),w=m.useRef(0),E=m.useRef(new Map),S=m.useRef(0),P=m.useRef(0),R=m.useRef(new Map),$=m.useRef(()=>{}),O=m.useRef(!1);p.current=o,m.useEffect(()=>r.subscribe(()=>{a({type:"settings_mirror_changed",snapshot:r.getSnapshot()})}),[r]);const F=m.useCallback((C,b=Pe(p.current),z={})=>{const le=`${b.workspaceId}:${b.expectedContextRevision}:${C}`,de=R.current.get(le);if(de&&!z.force)return de.promise;const Oe=++P.current;a({type:"session_snapshot_started",sessionId:C,requestId:Oe,cached:!!p.current.sessionProjectionById[C],contextRevision:b.expectedContextRevision,workspaceId:b.workspaceId});const Ve=n.sessionSnapshot(C,b).then(Ue=>($f(Ue,C,b),a({type:"session_snapshot_loaded",snapshot:Ue,requestId:Oe,contextRevision:b.expectedContextRevision,workspaceId:b.workspaceId,advanceEventCursor:g.current===null}),Ue)).catch(Ue=>{const Ot=ts(Ue);throw a({type:"snapshot_failed",sessionId:C,detail:Ot,requestId:Oe,contextRevision:b.expectedContextRevision,workspaceId:b.workspaceId}),new Ie(Ot,Ue instanceof Ie?Ue.status:503,"session_snapshot_sync_failed",Ue instanceof Ie?Ue.type:void 0)}).finally(()=>{R.current.get(le)?.requestId===Oe&&R.current.delete(le)});return R.current.set(le,{requestId:Oe,promise:Ve}),Ve},[n]),te=m.useCallback(async()=>{const C=++w.current;try{const b=await n.bootstrap(),z={expectedContextRevision:b.contextRevision,workspaceId:b.workspaceId};r.reset(),r.accept(b.settings);const[le,de,Oe]=await Promise.all([n.listWorkspaces(z),n.listSessions(z),r.refresh()]),Ve=Fx(b.workspaceId,de.sessions,b.activeSessionId);Ks(b.workspaceId,Ve);const Ue=Object.freeze({...b,activeSessionId:Ve}),Ot=Ve?await n.sessionSnapshot(Ve,z).then(ot=>($f(ot,Ve,z),{snapshot:ot,error:void 0})).catch(ot=>({snapshot:null,error:ot})):{snapshot:null,error:void 0},Ir=await Wx(n,r,Oe.document??Oe.lastGood??b.settings,z);if(C!==w.current)return;a({type:"baseline_loaded",bootstrap:Ue,workspaces:le,sessions:de.sessions,sessionNextCursor:de.nextCursor,diagnostics:{},settings:Ir,skills:[],skillNextCursor:null,mcpServers:[],mcpNextCursor:null,toolDetails:[],toolDetailNextCursor:null}),Ot.snapshot&&a({type:"session_snapshot_loaded",snapshot:Ot.snapshot,contextRevision:z.expectedContextRevision,workspaceId:z.workspaceId}),Ot.error&&a({type:"snapshot_failed",sessionId:Ve,detail:ts(Ot.error),contextRevision:z.expectedContextRevision,workspaceId:z.workspaceId}),$.current();const us=de.sessions.map(ot=>ot.id).filter(ot=>ot!==Ve).slice(0,Lx);$.current=Gx(()=>{C===w.current&&Qx(us,Dx,async ot=>{C===w.current&&await F(ot,z).catch(()=>{})})}),n.workspaceProjectSummary(b.workspaceId,z).then(ot=>{C===w.current&&a({type:"workspace_project_summary_loaded",summary:ot})}).catch(()=>{}),Promise.all([n.diagnostics(z).catch(()=>({})),n.skills(z).catch(()=>({skills:[],nextCursor:null})),n.mcp(z).catch(()=>({servers:[],nextCursor:null})),n.toolDetails(z).catch(()=>({details:[],nextCursor:null}))]).then(([ot,ri,si,sn])=>{C===w.current&&(a({type:"diagnostics_loaded",diagnostics:ot}),a({type:"capabilities_loaded",skills:ri.skills,skillNextCursor:ri.nextCursor,mcpServers:si.servers,mcpNextCursor:si.nextCursor}),a({type:"tool_details_loaded",details:sn.details,nextCursor:sn.nextCursor}))})}catch(b){throw b}},[n,F,r]),L=m.useCallback(async()=>{let C;for(let b=0;b<3;b+=1)try{await te();return}catch(z){if(C=z,!Vx(z)||b===2)break;await Kx(100*3**b)}throw a({type:"boot_failed",message:ts(C)}),C},[te]);m.useEffect(()=>{if(O.current)return;O.current=!0;let C=!0;return L().catch(()=>{}),()=>{C=!1}},[L]),m.useEffect(()=>()=>{$.current()},[]);const ye=o.bootstrap!==null;m.useEffect(()=>{if(!ye)return;const C=n.connectEvents({cursor:p.current.lastCursor,onEvent:b=>{if(a({type:"event_received",envelope:b}),Yx(b)){const z=p.current;if(b.sessionId&&z.contextRevision&&z.workspaceId){const le=b.sessionId,de=++S.current;E.current.set(le,de);const Oe=z.contextRevision,Ve=z.workspaceId;n.sessionSnapshot(le,{expectedContextRevision:Oe,workspaceId:Ve}).then(Ue=>{E.current.get(le)===de&&a({type:"durable_session_metadata_loaded",snapshot:Ue,contextRevision:Oe,workspaceId:Ve})}).catch(()=>{}).finally(()=>{E.current.get(le)===de&&E.current.delete(le)})}}b.type==="settings_invalidated"&&r.invalidate(b.payload.revision,b.payload.state)},onStatus:(b,z)=>a({type:"connection_changed",phase:b,attempt:z}),onProtocolError:b=>a({type:"notice",notice:{id:Date.now(),tone:"error",title:"收到无法识别的 Web Host 事件流消息",detail:b}})});return g.current=C,()=>{C.close(),g.current===C&&(g.current=null)}},[n,ye,r,d]);const J=m.useCallback(()=>{g.current?.close(),g.current=null},[]),ne=m.useCallback(()=>{f(C=>C+1)},[]);m.useEffect(()=>{!o.workspace||o.boot!=="ready"||o.pendingAction||o.bootstrap?.workspace!==o.workspace&&(J(),L().catch(C=>Df(a,"工作区刷新失败",C)).finally(ne))},[L,J,ne,o.boot,o.bootstrap?.workspace,o.pendingAction,o.workspace]),m.useEffect(()=>{o.boot==="ready"&&(o.pendingAction||!o.activeSessionId||o.bootstrap?.workspace===o.workspace&&o.sessionSnapshot?.session.id!==o.activeSessionId&&F(o.activeSessionId).catch(()=>{}))},[F,o.activeSessionId,o.boot,o.bootstrap?.workspace,o.pendingAction,o.sessionSnapshot,o.workspace]);const N=m.useCallback(async(C,b)=>{const z=++x.current;a({type:"pending_action",label:C});try{return await b()}catch(le){throw Hx(le)||Df(a,`${C}失败`,le),le}finally{x.current===z&&a({type:"pending_action",label:null})}},[]),D=m.useCallback(async(C,b)=>N(C,async()=>{if(p.current.connection!=="live")throw new Ie("本地 Web Host 连接尚未就绪,请在连接恢复后重试。",409,"session_not_synchronized");const z=p.current.activeSessionId;if(!z)throw new Ie("当前没有可接收命令的活动会话。",409,"active_session_changed");const le=p.current.sessionSnapshot;if(!le||!jr(p.current))throw new Ie("当前会话快照尚未同步,请刷新后重试。",409,"session_runtime_revision_conflict");try{const de=await n.command({...b,workspaceId:p.current.workspaceId,expectedContextRevision:p.current.contextRevision,expectedSessionId:z,expectedSessionRuntimeRevision:le.sessionRuntime.runtimeRevision});return qx(de),de}catch(de){throw de instanceof Ie&&["context_revision_conflict","active_session_changed","session_runtime_revision_conflict"].includes(de.code??"")?(a({type:"snapshot_failed",sessionId:z,detail:de.message,contextRevision:p.current.contextRevision,workspaceId:p.current.workspaceId}),new Ie(de.message,de.status,"session_runtime_revision_conflict",de.type)):de}}),[n,N]),Z=m.useCallback(async(C,b)=>N(C,async()=>{const z=p.current,le=z.composer;if(z.connection!=="live"||!z.activeSessionId||!jr(z)||!le||le.sessionId!==z.activeSessionId)throw new Ie("Composer 控制状态尚未与活动会话同步。",409,"composer_control_conflict");try{const de=await n.composerAction(z.activeSessionId,{...b,workspaceId:z.workspaceId,expectedContextRevision:z.contextRevision,expectedSessionId:z.activeSessionId,expectedSessionRuntimeRevision:le.sessionRuntime.runtimeRevision,expectedControlRevision:le.controlRevision});return a({type:"composer_loaded",composer:de.state}),de}catch(de){throw de instanceof Ie&&["composer_control_conflict","context_revision_conflict","active_session_changed","session_runtime_revision_conflict"].includes(de.code??"")?(a({type:"snapshot_failed",sessionId:z.activeSessionId,detail:de.message,contextRevision:z.contextRevision,workspaceId:z.workspaceId}),new Ie(de.message,de.status,"composer_control_conflict",de.type)):de}}),[n,N]),X=m.useCallback(()=>N("重新连接",L),[L,N]),ie=m.useCallback(()=>N("刷新诊断",async()=>{const C=++w.current,b=await n.diagnostics(Pe(p.current));C===w.current&&a({type:"diagnostics_loaded",diagnostics:b})}),[n,N]),G=m.useCallback(()=>N("刷新工具详情",async()=>{const C=++w.current,b=await n.toolDetails(Pe(p.current));C===w.current&&a({type:"tool_details_loaded",details:b.details,nextCursor:b.nextCursor})}),[n,N]),je=m.useCallback(()=>N("加载更多工作区",async()=>{const C=Pe(p.current),b=p.current.workspaceNextCursor;if(b)try{const z=await n.listWorkspaces(C,b);a({type:"workspaces_loaded",value:z,append:!0})}catch(z){if(!wo(z))throw z;a({type:"workspaces_loaded",value:await n.listWorkspaces(C)})}}),[n,N]),ee=m.useCallback(()=>N("加载更多会话",async()=>{const C=p.current.sessionNextCursor;if(!C)return;const b=Pe(p.current);try{const z=await n.listSessions(b,C);a({type:"sessions_loaded",sessions:z.sessions,nextCursor:z.nextCursor,append:!0})}catch(z){if(!wo(z))throw z;const le=await n.listSessions(b);a({type:"sessions_loaded",sessions:le.sessions,nextCursor:le.nextCursor})}}),[n,N]),Ce=m.useCallback(async(C,b=!1)=>{const z=Pe(p.current),le=p.current.workspaceSessions[C],de=b?le?.nextCursor:void 0;if(b&&!de)return;a({type:"workspace_sessions_loading",workspaceId:C});const Oe=n.workspaceProjectSummary(C,z).catch(()=>null);try{const Ve=await n.listWorkspaceSessions(C,z,de??void 0);a({type:"workspace_sessions_loaded",workspaceId:C,sessions:Ve.sessions,nextCursor:Ve.nextCursor,append:b});const Ue=await Oe;Ue&&a({type:"workspace_project_summary_loaded",summary:Ue})}catch(Ve){throw a({type:"workspace_sessions_failed",workspaceId:C,detail:ts(Ve)}),Ve}},[n]),A=m.useCallback(async C=>{const b=await n.workspaceProjectSummary(C,Pe(p.current));a({type:"workspace_project_summary_loaded",summary:b})},[n]),me=m.useCallback(()=>N("加载更多能力",async()=>{const C=Pe(p.current),b=p.current.skillNextCursor,z=p.current.mcpNextCursor;if(!(!b&&!z))try{const[le,de]=await Promise.all([b?n.skills(C,b):Promise.resolve({skills:[],nextCursor:null}),z?n.mcp(C,z):Promise.resolve({servers:[],nextCursor:null})]);a({type:"capabilities_loaded",skills:le.skills,skillNextCursor:le.nextCursor,mcpServers:de.servers,mcpNextCursor:de.nextCursor,append:!0})}catch(le){if(!wo(le))throw le;const[de,Oe]=await Promise.all([n.skills(C),n.mcp(C)]);a({type:"capabilities_loaded",skills:de.skills,skillNextCursor:de.nextCursor,mcpServers:Oe.servers,mcpNextCursor:Oe.nextCursor})}}),[n,N]),ve=m.useCallback(()=>N("加载更多工具详情",async()=>{const C=Pe(p.current),b=p.current.toolDetailNextCursor;if(b)try{const z=await n.toolDetails(C,b);a({type:"tool_details_loaded",details:z.details,nextCursor:z.nextCursor,append:!0})}catch(z){if(!wo(z))throw z;const le=await n.toolDetails(C);a({type:"tool_details_loaded",details:le.details,nextCursor:le.nextCursor})}}),[n,N]),W=m.useCallback(async()=>{const C=p.current;if(C.connection!=="replay-required"){if(!C.activeSessionId)return;await F(C.activeSessionId,Pe(C),{force:!0});return}await N("恢复本地 Web Host 事件流",async()=>{J(),a({type:"recovering"});try{await L()}finally{ne()}})},[L,F,J,ne,N]),se=m.useCallback(C=>N("切换工作区",async()=>{J();try{const b=await n.activateWorkspace(C,Pe(p.current));a({type:"workspaces_loaded",value:b}),a({type:"reset_session_view",activeSessionId:null}),await L()}finally{ne()}}),[n,L,J,ne,N]),B=m.useCallback(C=>{const b=p.current;if(b.activeSessionId===C&&b.sessionSnapshot&&b.sessionSync[C]?.status==="ready")return Promise.resolve();const z=Pe(b);return(async()=>{Ks(z.workspaceId,C),a({type:"reset_session_view",activeSessionId:C}),await F(C,z)})()},[F]),v=m.useCallback((C,b)=>C===p.current.workspaceId&&b?B(b):N("切换项目上下文",async()=>{const z=p.current,le=z.contextRevision;if(!le)throw new Ie("工作区上下文尚未完成同步。",409,"context_revision_conflict");if(C===z.workspaceId){Ks(C,b),a({type:"reset_session_view",activeSessionId:b}),b&&await F(b,Pe(z));return}Ks(C,b),J(),++w.current;try{const de=await n.activateContext({expectedContextRevision:le,workspaceId:C,sessionId:b});if(de.contextRevision!==de.bootstrap.contextRevision||de.bootstrap.workspaceId!==C)throw new Ie("Host 返回的项目上下文不一致。",502,"context_response_invalid");a({type:"reset_session_view",activeSessionId:b}),await L()}catch(de){throw de instanceof Ie&&(de.code==="context_revision_conflict"||de.code==="active_session_changed")&&a({type:"snapshot_failed",sessionId:null,detail:de.message}),de}finally{ne()}}),[n,L,F,J,ne,N,B]),M=m.useCallback((C,b)=>N(b?"置顶项目":"取消置顶",async()=>{await n.setWorkspacePinned(C,b,Pe(p.current)),a({type:"workspaces_loaded",value:await n.listWorkspaces(Pe(p.current))})}),[n,N]),pe=m.useCallback(C=>N("移除项目",async()=>{const b=p.current;if(!b.contextRevision)throw new Ie("工作区上下文尚未完成同步。",409,"context_revision_conflict");await n.removeWorkspace(C,Pe(b)),Bm(C),a({type:"workspaces_loaded",value:await n.listWorkspaces(Pe(p.current))})}),[n,N]),V=m.useCallback(()=>N("创建会话",async()=>{const C=Pe(p.current),b=await n.createSession(C);Ks(C.workspaceId,b.id),a({type:"sessions_loaded",sessions:er(p.current.sessions,b),nextCursor:p.current.sessionNextCursor}),a({type:"reset_session_view",activeSessionId:b.id}),await F(b.id,C)}),[n,F,N]),oe=B,ge=m.useCallback(()=>N("加载更早记录",async()=>{const C=p.current.sessionSnapshot,b=p.current.activeSessionId,z=C?.transcript.nextCursor;if(!(!C||!b||!z))try{const le=await n.sessionSnapshot(b,Pe(p.current),z);if(le.session.id!==C.session.id||le.threadId!==C.threadId||le.threadCursor!==C.threadCursor||le.projectionDigest!==C.projectionDigest)throw new Ie("加载历史记录时会话快照发生变化,正在恢复最新快照。",409,"transcript_cursor_stale");a({type:"older_transcript_loaded",snapshot:le})}catch(le){if(!(le instanceof Ie)||le.code!=="transcript_cursor_stale")throw le;J(),a({type:"recovering"});try{await F(b,Pe(p.current),{force:!0})}finally{ne()}}}),[n,F,J,ne,N]),Se=m.useCallback((C,b)=>N("重命名会话",async()=>{const z=await n.renameSession(C,b,Pe(p.current)),le=er(p.current.sessions,z);a({type:"sessions_loaded",sessions:le,nextCursor:p.current.sessionNextCursor})}),[n,N]),be=m.useCallback((C,b)=>N("更新会话标签",async()=>{const z=await n.updateSessionTags(C,b,Pe(p.current));a({type:"session_updated",session:z})}),[n,N]),ue=m.useCallback(C=>N("归档会话",async()=>{const b=await n.archiveSession(C,Pe(p.current));a({type:"session_archived",session:b})}),[n,N]),Me=m.useCallback(C=>N("还原会话",async()=>{const b=await n.restoreSession(C,Pe(p.current));a({type:"session_restored",session:b})}),[n,N]),bt=m.useCallback(C=>N("删除会话",async()=>{await n.deleteSession(C,Pe(p.current)),a({type:"session_deleted",sessionId:C})}),[n,N]),ht=m.useCallback(async(C,b=!1)=>{const z=Pe(p.current),le=p.current.archivedSessions,de=b?le?.nextCursor:void 0;if(!(b&&!de)){a({type:"archived_sessions_loading",workspaceId:C});try{const Oe=await n.listArchivedWorkspaceSessions(C,z,de??void 0);a({type:"archived_sessions_loaded",workspaceId:C,sessions:Oe.sessions,nextCursor:Oe.nextCursor,append:b})}catch(Oe){throw a({type:"archived_sessions_failed",workspaceId:C,detail:ts(Oe)}),Oe}}},[n]),Tt=m.useCallback((C,b)=>D("提交任务",{type:"submit",text:C,contextReferences:b}),[D]),_t=m.useCallback((C,b)=>D("加入队列",{type:"queue_followup",text:C,contextReferences:b}),[D]),rt=m.useCallback(async(C,b)=>{await Z("移除排队消息",{type:"remove_queue_item",itemId:C,expectedItemRevision:b})},[Z]),Xe=m.useCallback(async(C,b,z)=>{await Z("编辑排队消息",{type:"edit_queue_item",itemId:C,expectedItemRevision:b,text:z})},[Z]),mt=m.useCallback(async(C,b,z)=>{await Z("移动排队消息",{type:"move_queue_item",itemId:C,expectedItemRevision:b,targetIndex:z})},[Z]),fn=m.useCallback(async()=>{await D("清空队列",{type:"clear_followups"})},[D]),pn=m.useCallback(async()=>{const C=p.current.sessionSnapshot?.sessionRuntime;if(!C||C.phase!=="queued"||!C.queueId)throw new Ie("排队任务已变化,请等待状态同步后重试。",409,"session_queue_conflict");await D("取消排队任务",{type:"cancel_queued_turn",queueId:C.queueId})},[D]),nn=m.useCallback(async()=>{await D("中断任务",{type:"interrupt"})},[D]),Ut=m.useCallback(async C=>{p.current.mode.baseMode===C&&!p.current.mode.pendingBaseMode||await Z("切换模式",{type:"set_agent_mode",mode:C})},[Z]),Tn=m.useCallback(async C=>{await Z(C===null?"继承项目权限":"切换会话权限",C===null?{type:"clear_permission_override"}:{type:"set_permission_override",value:C})},[Z]),dt=m.useCallback(()=>N("加载模型目录",async()=>{const C=p.current;if(!C.activeSessionId)return;const b=await n.modelCatalog(C.activeSessionId,Pe(C));a({type:"model_catalog_loaded",catalog:b})}),[n,N]),tr=m.useCallback(async(C,b)=>{await Z("切换会话模型",{type:"select_model",modelId:C,...b?{effort:b}:{}})},[Z]),nr=m.useCallback(async()=>{await Z("压缩上下文",{type:"compact_context"})},[Z]),rn=m.useCallback(async(C,b,z)=>{await Z("审核计划",{type:"review_plan",planDigest:C,action:b,...z?{feedback:z}:{}})},[Z]),hn=m.useCallback(async(C,b="once")=>{const z=p.current.permission;z&&(await D(C?"确认工具权限":"拒绝工具权限",{type:"permission_decision",requestPermissionId:z.id,approved:C,scope:b}),a({type:"approval_resolved",requestId:z.id,approved:C}))},[D]),mn=m.useCallback(async(C,b)=>{await D("更新 Goal",{type:"goal_control",goalAction:C,objective:b});const z=++w.current;J();try{const le=p.current.activeSessionId,de=Pe(p.current),[Oe]=await Promise.all([n.diagnostics(de),le?F(le,de,{force:!0}):Promise.resolve()]);if(z!==w.current)return;a({type:"diagnostics_loaded",diagnostics:Oe})}finally{ne()}},[n,F,J,ne,D]),Y=m.useCallback(async()=>{const C=await r.refresh(),b=C.document??C.lastGood;if(!b)throw new Ie(C.error??"设置尚不可用。",503);return b},[r]),xe=m.useCallback(async(C,b,z)=>{if(b.length<1||b.length>20)throw new Ie("设置变更必须包含 1 到 20 个字段。",400,"settings_invalid_operation");const le=await n.updateSettings(C,b,Pe(p.current),z);return r.accept(le.settings),le},[n,r]),_e=m.useCallback(async()=>{await n.openSettingsDocument()},[n]),We=m.useCallback((C,b=0)=>n.readToolDetail(C,Pe(p.current),b),[n]),Mt=m.useCallback((C,b)=>n.listFiles(Pe(p.current),C,b),[n]),gn=m.useCallback((C,b)=>n.readFileContent(C,Pe(p.current),b),[n]),rr=m.useCallback((C,b,z)=>n.writeFileContent(Pe(p.current),C,b,z),[n]),Ht=m.useCallback(C=>n.gitStatus(Pe(p.current),C),[n]),Cr=m.useCallback(C=>n.gitLog(Pe(p.current),C),[n]),Nr=m.useCallback((C,b)=>n.gitDiff(C,Pe(p.current),b),[n]),br=m.useCallback(()=>n.review(Pe(p.current)),[n]),_r=m.useCallback(async()=>(await n.terminals(Pe(p.current))).terminals,[n]),vn=m.useCallback(async(C,b)=>{const z=p.current;if(!z.contextRevision||!z.workspaceId)throw new Ie("工作区上下文尚未完成同步。",409,"context_revision_conflict");return n.createTerminal({expectedContextRevision:z.contextRevision,workspaceId:z.workspaceId,cols:C,rows:b})},[n]),yn=m.useCallback(async C=>{const b=p.current;if(!b.contextRevision||!b.workspaceId)throw new Ie("工作区上下文尚未完成同步。",409,"context_revision_conflict");return n.terminalAttachTicket(C,{expectedContextRevision:b.contextRevision,workspaceId:b.workspaceId})},[n]),ls=m.useCallback(async C=>{const b=p.current;if(!b.contextRevision||!b.workspaceId)throw new Ie("工作区上下文尚未完成同步。",409,"context_revision_conflict");await n.closeTerminal(C,{expectedContextRevision:b.contextRevision,workspaceId:b.workspaceId})},[n]),as=m.useCallback(C=>n.terminalSocket(C),[n]),cs=m.useCallback(()=>a({type:"notice",notice:null}),[]),ni=m.useMemo(()=>({retryBoot:X,refreshDiagnostics:ie,refreshToolDetails:G,loadMoreWorkspaces:je,loadMoreSessions:ee,loadWorkspaceSessions:Ce,refreshWorkspaceProjectSummary:A,loadMoreCapabilities:me,loadMoreToolDetails:ve,recoverSession:W,switchWorkspace:se,activateContext:v,setWorkspacePinned:M,removeWorkspace:pe,createSession:V,activateSession:oe,loadOlderTranscript:ge,renameSession:Se,updateSessionTags:be,archiveSession:ue,restoreSession:Me,deleteSession:bt,loadArchivedWorkspaceSessions:ht,submit:Tt,queue:_t,removeQueued:rt,editQueued:Xe,moveQueued:mt,clearQueue:fn,cancelQueuedTurn:pn,interrupt:nn,setMode:Ut,setPermissionOverride:Tn,loadModelCatalog:dt,selectModel:tr,compactContext:nr,reviewPlan:rn,answerPermission:hn,controlGoal:mn,refreshSettings:Y,updateSettings:xe,openSettingsDocument:_e,readToolDetail:We,listFiles:Mt,readFileContent:gn,writeFileContent:rr,gitStatus:Ht,gitLog:Cr,gitDiff:Nr,review:br,terminals:_r,createTerminal:vn,terminalAttachTicket:yn,closeTerminal:ls,terminalSocket:as,dismissNotice:cs}),[oe,v,ls,vn,Nr,Cr,Ht,Mt,ge,me,ee,ve,je,dt,Ce,hn,fn,pn,nr,rn,mn,V,cs,Xe,nn,_t,gn,We,br,W,ie,Y,G,A,rt,pe,Se,Me,be,ue,bt,ht,X,Ut,Tn,tr,M,Tt,se,mt,yn,as,_r,xe,_e]);return{state:o,actions:ni}}async function Wx(n,r,o,a){let d=o;for(let f=0;f<2;f+=1){const p=Tx(d);if(p.keysToClear.length===0||d.state!=="ready"||!d.writable)return d;if(p.operations.length===0)return Of(p.keysToClear),d;try{const g=await n.updateSettings(d.revision,p.operations,a,ze());return r.accept(g.settings),Of(p.keysToClear),g.settings}catch(g){if(f===0&&g instanceof Ie&&g.code==="settings_revision_conflict"){const x=await r.refresh(),w=x.document??x.lastGood;if(w){d=w;continue}}return d}}return d}function Pe(n){if(!n.contextRevision||!n.workspaceId)throw new Ie("工作区上下文尚未完成同步。",409,"context_revision_conflict");return{expectedContextRevision:n.contextRevision,workspaceId:n.workspaceId}}function $f(n,r,o){if(!(n.session.id===r&&n.sessionRuntime.sessionId===r&&n.sessionRuntime.workspaceId===o.workspaceId&&n.composer.sessionId===r&&n.composer.workspaceId===o.workspaceId&&n.composer.contextRevision===o.expectedContextRevision))throw new Ie("Host 返回的会话快照身份与当前项目上下文不一致。",502,"session_snapshot_identity_mismatch")}const Lf="orion.web.view-id.v1",Sp="orion.web.foreground-session.v1:";function Fx(n,r,o){const a=Cp(`${Sp}${n}`);return $x(a,r,o)}function Ks(n,r){Bx();const o=`${Sp}${n}`;try{r?globalThis.sessionStorage?.setItem(o,r):globalThis.sessionStorage?.removeItem(o)}catch{}}function Bx(){const n=Cp(Lf);if(n)return n;const r=globalThis.crypto?.randomUUID?.()??`view-${Date.now().toString(36)}`;try{globalThis.sessionStorage?.setItem(Lf,r)}catch{}return r}function Cp(n){try{return globalThis.sessionStorage?.getItem(n)??null}catch{return null}}function qx(n){if(n.result.includes("failed")||n.result.includes("invalid")||n.result.includes("rejected")||n.result.includes("ignored")||n.result.includes("full")||n.result==="empty")throw new Ie(Ux(n),409)}function Ux(n){if(n.detail)try{const r=JSON.parse(n.detail);if(typeof r.reason=="string")return r.reason}catch{}return`Runtime 未接受操作:${n.result}`}function Df(n,r,o,a="error"){n({type:"notice",notice:{id:Date.now(),tone:a,title:r,detail:ts(o)}})}function ts(n){return n instanceof Ie||n instanceof Error?n.message:"发生未知错误。"}function wo(n){return n instanceof Ie&&n.code==="collection_cursor_stale"}function Hx(n){return n instanceof Ie&&["composer_control_conflict","session_runtime_revision_conflict","session_snapshot_sync_failed"].includes(n.code??"")}function Vx(n){return n instanceof Ie&&["context_revision_conflict","runtime_busy","active_session_changed"].includes(n.code??"")}function Kx(n){return new Promise(r=>{globalThis.setTimeout(r,n)})}function Gx(n){if(typeof window<"u"&&"requestIdleCallback"in window){const o=window.requestIdleCallback(n,{timeout:1500});return()=>window.cancelIdleCallback(o)}const r=globalThis.setTimeout(n,150);return()=>globalThis.clearTimeout(r)}async function Qx(n,r,o){let a=0;const d=Array.from({length:Math.min(Math.max(1,r),n.length)},async()=>{for(;a<n.length;){const f=n[a];a+=1,f!==void 0&&await o(f)}});await Promise.all(d)}function Yx(n){return n.sessionId?n.type==="runtime_event"?n.payload.value.type==="permission_requested":n.type!=="thread_event"?!1:["approval.requested","plan.review_requested","turn.completed","turn.failed","turn.interrupted"].includes(n.payload.value.payload.type):!1}const Xx=5e3;function Jx(n,r){return r||n.tone==="error"?null:Xx}function Zx({uid:n,notice:r,reconnectNeeded:o,snapshotRetryNeeded:a,pendingAction:d,onDismiss:f,onRecover:p}){const g=o||a,x=!g,w=m.useRef(f);m.useEffect(()=>{w.current=f},[f]);const E=Jx(r,g);m.useEffect(()=>{if(E===null)return;const R=window.setTimeout(()=>w.current(n),E);return()=>window.clearTimeout(R)},[E,n]);const S=`notice-${n}`,P=r.tone==="success"?"check":r.tone==="info"?"info":"warning";return i.jsxs("aside",{className:`workbench-notice notice-${r.tone}`,role:r.tone==="error"?"alert":"status","aria-labelledby":S,children:[i.jsx("span",{className:"notice-icon","aria-hidden":"true",children:i.jsx(Q,{name:P,size:17})}),i.jsxs("div",{children:[i.jsx("strong",{id:S,children:r.title}),r.detail?i.jsx("p",{children:r.detail}):null]}),o?i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>p(n),disabled:d,children:"重建连接"}):null,a?i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>p(n),disabled:d,children:"重试同步"}):null,x?i.jsx("button",{type:"button",className:"icon-button",onClick:()=>f(n),"aria-label":"关闭通知",children:i.jsx(Q,{name:"close",size:15})}):null]})}function ew(){const{state:n,actions:r}=zx(),[o,a]=m.useState(!1),[d,f]=m.useState(Iv),{value:p,update:g,setResourceNavigatorWidth:x}=dx(n.workspaceId,d.workPanel),[w,E]=m.useState(!1),[S,P]=m.useState(!1),[R,$]=m.useState(!1),[O,F]=m.useState(null),[te,L]=m.useState(null),[ye,J]=m.useState(null),[ne,N]=m.useState(!1),[D,Z]=m.useState([]),X=m.useRef(0),ie=m.useRef(n.notice),G=m.useRef(null),[je,ee]=m.useState(null),Ce=m.useRef(null),A=m.useRef(!1),me=m.useRef(!1),ve=m.useRef(null),W=tw(ve),se=W>1180,B=se?jf({containerWidth:W,navigationExpanded:d.projectNavigation.expanded,navigationWidthPx:d.projectNavigation.widthPx,workExpanded:p.expanded,workDetailWidthPx:p.detailWidthPx}):go(W,d),v=B.projectNavigation.mode==="drawer",M=B.workPanel.mode==="drawer",pe=B.workPanel.mode==="rail"&&p.expanded,V=M||pe&&w,oe=M||pe?w:B.workPanel.mode==="dock",ge=V&&w,Se=v&&o,be=Se||ge,ue=n.settings?.state==="ready"?n.settings:n.settingsMirror.lastGood??n.settings,Me=ue?.sections.appearance.theme.effectiveValue,bt=ue?.sections.appearance.motion.effectiveValue,ht=ue?.sections.appearance.style.effectiveValue??"orion-blocksmith",Tt=Oo(n),_t=m.useCallback(()=>{if(!n.workspace)return;const Y=ue?.revision;if(!Y)return;const xe=ue?.sections.appearance.theme.effectiveValue??"system",_e=xe==="system"?"light":xe==="light"?"dark":"system";r.updateSettings(Y,[{op:"set",key:"appearance.theme",value:_e}],ze()).catch(We=>{console.warn("[theme] 主题切换写入失败",We)})},[r,ue,n.workspace]),rt=m.useCallback(Y=>{f(xe=>{const _e={...xe,projectNavigation:{...xe.projectNavigation,...Y}};return Ev(_e),_e})},[]),Xe=m.useCallback(Y=>{g({...Y,detailWidthPx:Y.widthPx===void 0?void 0:Math.max(360,Y.widthPx-Ye)})},[g]),mt=m.useCallback(()=>{Ce.current=document.activeElement instanceof HTMLElement?document.activeElement:null},[]),fn=m.useCallback(()=>{requestAnimationFrame(()=>document.querySelector(".project-search input")?.focus())},[]),pn=m.useCallback(()=>{requestAnimationFrame(()=>document.querySelector('.workspace-rail [aria-label="打开设置"]')?.focus())},[]),nn=m.useCallback(()=>{v&&(mt(),E(!1),a(!0)),pn()},[pn,v,mt]),Ut=m.useCallback(()=>{A.current=Se,Se&&(a(!1),E(!1),Ce.current=null),P(!0)},[Se]),Tn=m.useCallback(()=>{P(!1),A.current&&(A.current=!1,me.current=!0,a(!0))},[]),dt=m.useCallback(()=>{a(!1),E(!1),me.current=!1;const Y=Ce.current;Ce.current=null,Y&&requestAnimationFrame(()=>Y.focus())},[]);m.useLayoutEffect(()=>{document.documentElement.dataset.theme=Me??"system",document.documentElement.dataset.motion=bt??"system",document.documentElement.dataset.uiStyle=ht},[bt,Me,ht]),m.useEffect(()=>{ie.current=n.notice;const Y=n.notice;Y&&G.current!==Y.id&&(G.current=Y.id,Z(xe=>xe.some(_e=>_e.notice.id===Y.id)?xe:[...xe,{uid:++X.current,notice:Y}].slice(-4)))},[n.notice]),m.useEffect(()=>{const Y=n.workspaceId;if(!Y)return;const xe=n.workspaceSessions[Y],_e=n.archivedSessions;xe?.status==="ready"&&(_e.ownerWorkspaceId===Y&&_e.status!=="idle"||r.loadArchivedWorkspaceSessions(Y).catch(()=>{}))},[r,n.archivedSessions,n.workspaceId,n.workspaceSessions]);const tr=m.useCallback(Y=>{const xe=D.find(_e=>_e.uid===Y);xe&&(ie.current?.id===xe.notice.id&&r.dismissNotice(),Z(_e=>_e.filter(We=>We.uid!==Y)))},[r,D]),nr=m.useCallback(Y=>{const xe=D.find(_e=>_e.uid===Y);xe&&(ie.current?.id===xe.notice.id&&r.dismissNotice(),Z(_e=>_e.filter(We=>We.uid!==Y)),r.recoverSession())},[r,D]);m.useEffect(()=>{const Y=window.matchMedia("(prefers-color-scheme: light)"),xe=document.querySelector('meta[name="theme-color"]'),_e=()=>{xe&&(xe.content=mx(ht,Me??"system",Y.matches))};return _e(),Y.addEventListener("change",_e),()=>Y.removeEventListener("change",_e)},[Me,ht]),m.useEffect(()=>{a(!1),E(!1),Ce.current=null,A.current=!1,me.current=!1},[n.activeSessionId,n.workspace]),m.useLayoutEffect(()=>{a(!1),E(!1),Ce.current=null,me.current=!1},[B.projectNavigation.mode,B.workPanel.mode,v,M]),m.useEffect(()=>{const Y=xe=>{const _e=Po("toggle-project-navigation");if(_e&&Eo(xe,_e.tokens)){if(xe.preventDefault(),v){if(o){dt();return}mt(),E(!1),a(!0);return}const We=!d.projectNavigation.expanded,Mt=!!(!We&&document.activeElement?.closest(".workspace-rail")),gn=go(W,{...d,projectNavigation:{...d.projectNavigation,expanded:We}});if(We&&gn.projectNavigation.mode==="drawer"){rt({expanded:We}),mt(),E(!1),a(!0);return}rt({expanded:We}),We?fn():Mt&&requestAnimationFrame(()=>{(document.querySelector('.project-navigator-collapsed [aria-label="展开项目导航"]')??document.querySelector(".mobile-nav-toggle"))?.focus()})}};return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[dt,fn,o,v,d.projectNavigation,mt,W,rt]),m.useEffect(()=>{const Y=Po("open-shortcut-help");if(!Y)return;const xe=_e=>{Eo(_e,Y.tokens)&&(_e.preventDefault(),N(We=>!We))};return window.addEventListener("keydown",xe),()=>window.removeEventListener("keydown",xe)},[]),m.useEffect(()=>{if(!be)return;const Y=document.querySelector(".conversation-column"),xe=document.querySelector(".workspace-rail"),_e=document.querySelector(".work-panel"),We=document.querySelector(".workbench-notice-stack"),Mt=document.querySelector(".skip-link");Y&&(Y.inert=!0),xe&&(xe.inert=ge),_e&&(_e.inert=o),We&&(We.inert=!0),Mt&&(Mt.inert=!0);const gn=window.setTimeout(()=>{const Ht=ge?_e?.querySelector('[aria-label="关闭工作面板"]'):me.current?xe?.querySelector('[aria-label="打开设置"]'):xe?.querySelector(".drawer-close");me.current=!1,Ht?.focus()},0),rr=Ht=>{Ht.key==="Escape"&&!Ht.target?.closest?.('[role="alertdialog"]')&&dt()};return window.addEventListener("keydown",rr),()=>{Y&&(Y.inert=!1),xe&&(xe.inert=!1),_e&&(_e.inert=!1),We&&(We.inert=!1),Mt&&(Mt.inert=!1),window.clearTimeout(gn),window.removeEventListener("keydown",rr)}},[dt,be,o,ge,n.notice]);const rn=m.useCallback(()=>{requestAnimationFrame(()=>document.querySelector("#main-content h1")?.focus())},[]),hn=()=>{a(!1),r.createSession().then(rn,rn)},mn=()=>{A.current=!1,me.current=!1,P(!1),requestAnimationFrame(()=>document.querySelector("#orion-composer")?.focus())};return i.jsxs(i.Fragment,{children:[i.jsx("a",{className:"skip-link",href:"#main-content",children:"跳到主要内容"}),i.jsxs("div",{ref:ve,className:`workbench-shell project-navigation-${B.projectNavigation.mode} work-panel-mode-${B.workPanel.mode} ${pe&&w?"work-panel-transient-overlay":""}`,style:{"--project-navigation-width":`${B.projectNavigation.widthPx}px`,"--project-navigation-preferred-width":`${d.projectNavigation.widthPx}px`,"--work-panel-width":`${B.workPanel.widthPx}px`,"--work-panel-preferred-width":`${p.detailWidthPx+Ye}px`},"aria-busy":n.boot==="loading",children:[i.jsx($v,{state:n,drawerOpen:Se,dockVisible:!0,collapsed:B.projectNavigation.mode==="rail",resizable:B.projectNavigation.mode==="dock",width:B.projectNavigation.widthPx,onExpand:()=>{v?(mt(),E(!1),a(!0)):(rt({expanded:!0}),fn())},onCollapse:()=>{v?dt():rt({expanded:!1})},onOpenWorkspaceDialog:()=>$(!0),onOpenSettings:Ut,onLoadMoreWorkspaces:()=>{r.loadMoreWorkspaces()},onCreateSession:hn,onLoadWorkspaceSessions:(Y,xe)=>{r.loadWorkspaceSessions(Y,xe)},onActivateContext:(Y,xe)=>{a(!1),r.activateContext(Y,xe).then(rn,rn)},onSetPinned:(Y,xe)=>{r.setWorkspacePinned(Y,xe)},onRemoveWorkspace:Y=>{r.removeWorkspace(Y)},onRefreshSummary:Y=>{r.refreshWorkspaceProjectSummary(Y)},onRenameSession:F,onSessionTags:L,onArchiveSession:Y=>{r.archiveSession(Y.id)},onDeleteSession:J,onRestoreSession:Y=>{r.restoreSession(Y.id)},onWidthPreview:Y=>{const xe=go(W,{...d,projectNavigation:{...d.projectNavigation,widthPx:Y}});ve.current?.style.setProperty("--project-navigation-width",`${xe.projectNavigation.widthPx}px`)},onWidthCommit:Y=>rt({widthPx:Y})}),i.jsx(rv,{state:n,actions:r,onRevealSettings:nn,onCreateSession:hn,composerInsertion:je}),i.jsx(Jy,{state:n,actions:r,mode:V?"overlay":"dock",expanded:oe,themePreference:Me,onCycleTheme:_t,onShowShortcutHelp:()=>N(!0),onToggleInspector:()=>{if(M||pe){if(w){dt();return}mt(),a(!1),E(!0);return}Xe({expanded:!p.expanded})},activePanel:p.activePanel,panelOrder:d.workPanel.order,agentPanel:p.agentPanel,onExpand:()=>{M||pe?E(!0):Xe({expanded:!0})},onCollapse:()=>{V?dt():Xe({expanded:!1})},onPanelChange:Y=>Xe({activePanel:Y}),onAgentPanelChange:Y=>Xe({agentPanel:Y}),onWidthPreview:Y=>{const xe=se?jf({containerWidth:W,navigationExpanded:d.projectNavigation.expanded,navigationWidthPx:d.projectNavigation.widthPx,workExpanded:!0,workDetailWidthPx:Math.max(360,Y-Ye)}):go(W,{...d,workPanel:{...d.workPanel,widthPx:Y}});ve.current?.style.setProperty("--work-panel-width",`${xe.workPanel.widthPx}px`)},onWidthCommit:Y=>Xe({widthPx:Y}),width:B.workPanel.widthPx,maxWidthPx:se?vp(W-(d.projectNavigation.expanded?d.projectNavigation.widthPx:Ye))+Ye:void 0,onSendToComposer:Y=>{ee({id:Date.now(),text:Y}),M&&dt(),requestAnimationFrame(()=>document.querySelector("#orion-composer")?.focus())},resourceNavigatorWidths:p.resourceNavigatorWidthPx,onResourceNavigatorWidthCommit:x}),be?i.jsx("button",{type:"button",className:"drawer-scrim","aria-label":"关闭侧边面板",tabIndex:-1,onClick:dt}):null,D.length>0?i.jsx("div",{className:"workbench-notice-stack","aria-live":"polite",children:D.map(Y=>i.jsx(Zx,{uid:Y.uid,notice:Y.notice,reconnectNeeded:n.connection==="replay-required",snapshotRetryNeeded:Y.notice.domain==="session-snapshot"&&Tt.status==="failed",pendingAction:!!n.pendingAction,onDismiss:tr,onRecover:nr},Y.uid))}):null,n.boot!=="ready"?i.jsxs("section",{className:"boot-screen",role:n.boot==="error"?"alert":"status",children:[i.jsx(np,{className:"boot-mark",size:34}),n.boot==="loading"?i.jsxs(i.Fragment,{children:[i.jsx("h1",{children:"正在启动 Orion Workbench"}),i.jsx("p",{children:"建立本地安全握手并恢复工作区状态…"}),i.jsx("span",{className:"boot-loader","aria-hidden":"true"})]}):i.jsxs(i.Fragment,{children:[i.jsx("h1",{children:"无法连接本地 Web Host"}),i.jsx("p",{children:n.bootError||"请确认 Orion Web Host 仍在运行。"}),i.jsxs("button",{type:"button",className:"primary-button",onClick:()=>{r.retryBoot()},disabled:!!n.pendingAction,children:[i.jsx(Q,{name:"refresh",size:15}),"重新连接"]})]})]}):null,i.jsx("div",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:n.announcement})]}),i.jsx(sy,{open:S,onClose:Tn,state:n,actions:r,onGoToSessionControls:mn}),i.jsx(Uv,{open:R,onClose:()=>$(!1),state:n,onSelect:r.switchWorkspace,onLoadMore:r.loadMoreWorkspaces}),i.jsx(Hv,{open:!!O,onClose:()=>F(null),session:O,pending:!!n.pendingAction,onRename:r.renameSession}),i.jsx(Vv,{open:!!te,onClose:()=>L(null),session:te,pending:!!n.pendingAction,onSave:r.updateSessionTags}),i.jsx(Gv,{open:!!ye,onClose:()=>J(null),session:ye,pending:!!n.pendingAction,onConfirm:r.deleteSession}),i.jsx(Cy,{open:ne,onClose:()=>N(!1)})]})}function tw(n){const[r,o]=m.useState(()=>typeof window>"u"?1440:Math.max(320,Math.round(window.innerWidth)));return m.useEffect(()=>{const a=n.current;if(!a)return;const d=()=>{const f=Math.max(320,Math.round(a.getBoundingClientRect().width));o(p=>p===f?p:f)};if(d(),typeof ResizeObserver<"u"){const f=new ResizeObserver(d);return f.observe(a),()=>f.disconnect()}return window.addEventListener("resize",d),()=>window.removeEventListener("resize",d)},[n]),r}const Np=document.getElementById("root");if(!Np)throw new Error("Orion Web root element was not found.");Im.createRoot(Np).render(i.jsx(km.StrictMode,{children:i.jsx(ew,{})}));export{Kv as C,Q as I,Gf as P,Co as R,Ie as W,up as a,rw as b,fp as c,i as j,m as r,Rn as s};