@tea-agent/loop-agent 0.36.1-beta.0 → 0.36.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -12
- package/dist/build-stamp.json +3 -3
- package/dist/cli/command-definitions.js +7 -0
- package/dist/cli/program.js +6 -1
- package/dist/commands/dag-request-interrupt.js +20 -0
- package/dist/executors/pi-sdk-executor.js +34 -0
- package/dist/shared/operator/capabilities.js +76 -3
- package/dist/task/source-prepare/semantic-intake.js +144 -23
- package/dist/worker/console/chat/semantic-activity.js +6 -0
- package/dist/worker/console/chat/workspace-landing.js +1 -0
- package/dist/worker/console/operation-runner.js +48 -0
- package/dist/worker/console/operation-wait.js +41 -0
- package/dist/worker/console/operator-actions.js +235 -26
- package/dist/worker/console/operator-user-error.js +4 -0
- package/dist/worker/console/recovery-cta.js +50 -3
- package/dist/worker/console/recovery-error-copy.js +198 -0
- package/dist/worker/console/static/assets/index-D83DYAFG.css +1 -0
- package/dist/worker/console/static/assets/index-IXm7oYjL.js +59 -0
- package/dist/worker/console/static/index.html +2 -2
- package/dist/worker/console/static-src/app/console-types.js +13 -9
- package/dist/worker/console/static-src/app/useOperatorActions.js +4 -2
- package/dist/worker/console/static-src/app/useRecoveryActions.js +65 -56
- package/dist/worker/console/static-src/app/useRecoveryConsole.js +68 -1
- package/dist/worker/observability/interrupt-eligibility.js +264 -0
- package/dist/worker/observe/static/operator-chrome.d.ts +1 -0
- package/dist/worker/observe/static/operator-chrome.js +5 -0
- package/dist/worker/observe/static/views/dag.js +12 -0
- package/dist/workflows/dag/failure-routing.js +4 -9
- package/dist/workflows/dag/init-hybrid.js +2 -4
- package/dist/workflows/dag/interrupt-request.js +559 -0
- package/dist/workflows/dag/lifecycle.js +0 -4
- package/dist/workflows/dag/node-execution.js +6 -16
- package/dist/workflows/dag/report.js +0 -6
- package/dist/workflows/dag/retry-policy.js +0 -11
- package/dist/workflows/dag/runner.js +72 -4
- package/docs/templates/frontend-task-constraints.md +7 -13
- package/package.json +1 -1
- package/skills/loop-agent/references/command-reference.md +1 -0
- package/dist/worker/console/static/assets/index-2OeZODxk.js +0 -57
- package/dist/worker/console/static/assets/index-DVJlUL8X.css +0 -1
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))s(o);new MutationObserver(o=>{for(const c of o)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&s(d)}).observe(document,{childList:!0,subtree:!0});function i(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerPolicy&&(c.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?c.credentials="include":o.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function s(o){if(o.ep)return;o.ep=!0;const c=i(o);fetch(o.href,c)}})();function Sd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Rc={exports:{}},ss={};var qp;function zS(){if(qp)return ss;qp=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function i(s,o,c){var d=null;if(c!==void 0&&(d=""+c),o.key!==void 0&&(d=""+o.key),"key"in o){c={};for(var h in o)h!=="key"&&(c[h]=o[h])}else c=o;return o=c.ref,{$$typeof:e,type:s,key:d,ref:o!==void 0?o:null,props:c}}return ss.Fragment=r,ss.jsx=i,ss.jsxs=i,ss}var $p;function BS(){return $p||($p=1,Rc.exports=zS()),Rc.exports}var u=BS(),jc={exports:{}},Ae={};var Gp;function HS(){if(Gp)return Ae;Gp=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),d=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),k=Symbol.iterator;function b(I){return I===null||typeof I!="object"?null:(I=k&&I[k]||I["@@iterator"],typeof I=="function"?I:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,z={};function R(I,U,C){this.props=I,this.context=U,this.refs=z,this.updater=C||w}R.prototype.isReactComponent={},R.prototype.setState=function(I,U){if(typeof I!="object"&&typeof I!="function"&&I!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,I,U,"setState")},R.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function A(){}A.prototype=R.prototype;function E(I,U,C){this.props=I,this.context=U,this.refs=z,this.updater=C||w}var F=E.prototype=new A;F.constructor=E,N(F,R.prototype),F.isPureReactComponent=!0;var K=Array.isArray;function O(){}var P={H:null,A:null,T:null,S:null},Y=Object.prototype.hasOwnProperty;function le(I,U,C){var ae=C.ref;return{$$typeof:e,type:I,key:U,ref:ae!==void 0?ae:null,props:C}}function _(I,U){return le(I.type,U,I.props)}function V(I){return typeof I=="object"&&I!==null&&I.$$typeof===e}function G(I){var U={"=":"=0",":":"=2"};return"$"+I.replace(/[=:]/g,function(C){return U[C]})}var ne=/\/+/g;function q(I,U){return typeof I=="object"&&I!==null&&I.key!=null?G(""+I.key):U.toString(36)}function M(I){switch(I.status){case"fulfilled":return I.value;case"rejected":throw I.reason;default:switch(typeof I.status=="string"?I.then(O,O):(I.status="pending",I.then(function(U){I.status==="pending"&&(I.status="fulfilled",I.value=U)},function(U){I.status==="pending"&&(I.status="rejected",I.reason=U)})),I.status){case"fulfilled":return I.value;case"rejected":throw I.reason}}throw I}function D(I,U,C,ae,W){var Q=typeof I;(Q==="undefined"||Q==="boolean")&&(I=null);var ue=!1;if(I===null)ue=!0;else switch(Q){case"bigint":case"string":case"number":ue=!0;break;case"object":switch(I.$$typeof){case e:case r:ue=!0;break;case v:return ue=I._init,D(ue(I._payload),U,C,ae,W)}}if(ue)return W=W(I),ue=ae===""?"."+q(I,0):ae,K(W)?(C="",ue!=null&&(C=ue.replace(ne,"$&/")+"/"),D(W,U,C,"",function(fe){return fe})):W!=null&&(V(W)&&(W=_(W,C+(W.key==null||I&&I.key===W.key?"":(""+W.key).replace(ne,"$&/")+"/")+ue)),U.push(W)),1;ue=0;var me=ae===""?".":ae+":";if(K(I))for(var ge=0;ge<I.length;ge++)ae=I[ge],Q=me+q(ae,ge),ue+=D(ae,U,C,Q,W);else if(ge=b(I),typeof ge=="function")for(I=ge.call(I),ge=0;!(ae=I.next()).done;)ae=ae.value,Q=me+q(ae,ge++),ue+=D(ae,U,C,Q,W);else if(Q==="object"){if(typeof I.then=="function")return D(M(I),U,C,ae,W);throw U=String(I),Error("Objects are not valid as a React child (found: "+(U==="[object Object]"?"object with keys {"+Object.keys(I).join(", ")+"}":U)+"). If you meant to render a collection of children, use an array instead.")}return ue}function H(I,U,C){if(I==null)return I;var ae=[],W=0;return D(I,ae,"","",function(Q){return U.call(C,Q,W++)}),ae}function B(I){if(I._status===-1){var U=I._result;U=U(),U.then(function(C){(I._status===0||I._status===-1)&&(I._status=1,I._result=C)},function(C){(I._status===0||I._status===-1)&&(I._status=2,I._result=C)}),I._status===-1&&(I._status=0,I._result=U)}if(I._status===1)return I._result.default;throw I._result}var te=typeof reportError=="function"?reportError:function(I){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var U=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof I=="object"&&I!==null&&typeof I.message=="string"?String(I.message):String(I),error:I});if(!window.dispatchEvent(U))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",I);return}console.error(I)},T={map:H,forEach:function(I,U,C){H(I,function(){U.apply(this,arguments)},C)},count:function(I){var U=0;return H(I,function(){U++}),U},toArray:function(I){return H(I,function(U){return U})||[]},only:function(I){if(!V(I))throw Error("React.Children.only expected to receive a single React element child.");return I}};return Ae.Activity=y,Ae.Children=T,Ae.Component=R,Ae.Fragment=i,Ae.Profiler=o,Ae.PureComponent=E,Ae.StrictMode=s,Ae.Suspense=p,Ae.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=P,Ae.__COMPILER_RUNTIME={__proto__:null,c:function(I){return P.H.useMemoCache(I)}},Ae.cache=function(I){return function(){return I.apply(null,arguments)}},Ae.cacheSignal=function(){return null},Ae.cloneElement=function(I,U,C){if(I==null)throw Error("The argument must be a React element, but you passed "+I+".");var ae=N({},I.props),W=I.key;if(U!=null)for(Q in U.key!==void 0&&(W=""+U.key),U)!Y.call(U,Q)||Q==="key"||Q==="__self"||Q==="__source"||Q==="ref"&&U.ref===void 0||(ae[Q]=U[Q]);var Q=arguments.length-2;if(Q===1)ae.children=C;else if(1<Q){for(var ue=Array(Q),me=0;me<Q;me++)ue[me]=arguments[me+2];ae.children=ue}return le(I.type,W,ae)},Ae.createContext=function(I){return I={$$typeof:d,_currentValue:I,_currentValue2:I,_threadCount:0,Provider:null,Consumer:null},I.Provider=I,I.Consumer={$$typeof:c,_context:I},I},Ae.createElement=function(I,U,C){var ae,W={},Q=null;if(U!=null)for(ae in U.key!==void 0&&(Q=""+U.key),U)Y.call(U,ae)&&ae!=="key"&&ae!=="__self"&&ae!=="__source"&&(W[ae]=U[ae]);var ue=arguments.length-2;if(ue===1)W.children=C;else if(1<ue){for(var me=Array(ue),ge=0;ge<ue;ge++)me[ge]=arguments[ge+2];W.children=me}if(I&&I.defaultProps)for(ae in ue=I.defaultProps,ue)W[ae]===void 0&&(W[ae]=ue[ae]);return le(I,Q,W)},Ae.createRef=function(){return{current:null}},Ae.forwardRef=function(I){return{$$typeof:h,render:I}},Ae.isValidElement=V,Ae.lazy=function(I){return{$$typeof:v,_payload:{_status:-1,_result:I},_init:B}},Ae.memo=function(I,U){return{$$typeof:g,type:I,compare:U===void 0?null:U}},Ae.startTransition=function(I){var U=P.T,C={};P.T=C;try{var ae=I(),W=P.S;W!==null&&W(C,ae),typeof ae=="object"&&ae!==null&&typeof ae.then=="function"&&ae.then(O,te)}catch(Q){te(Q)}finally{U!==null&&C.types!==null&&(U.types=C.types),P.T=U}},Ae.unstable_useCacheRefresh=function(){return P.H.useCacheRefresh()},Ae.use=function(I){return P.H.use(I)},Ae.useActionState=function(I,U,C){return P.H.useActionState(I,U,C)},Ae.useCallback=function(I,U){return P.H.useCallback(I,U)},Ae.useContext=function(I){return P.H.useContext(I)},Ae.useDebugValue=function(){},Ae.useDeferredValue=function(I,U){return P.H.useDeferredValue(I,U)},Ae.useEffect=function(I,U){return P.H.useEffect(I,U)},Ae.useEffectEvent=function(I){return P.H.useEffectEvent(I)},Ae.useId=function(){return P.H.useId()},Ae.useImperativeHandle=function(I,U,C){return P.H.useImperativeHandle(I,U,C)},Ae.useInsertionEffect=function(I,U){return P.H.useInsertionEffect(I,U)},Ae.useLayoutEffect=function(I,U){return P.H.useLayoutEffect(I,U)},Ae.useMemo=function(I,U){return P.H.useMemo(I,U)},Ae.useOptimistic=function(I,U){return P.H.useOptimistic(I,U)},Ae.useReducer=function(I,U,C){return P.H.useReducer(I,U,C)},Ae.useRef=function(I){return P.H.useRef(I)},Ae.useState=function(I){return P.H.useState(I)},Ae.useSyncExternalStore=function(I,U,C){return P.H.useSyncExternalStore(I,U,C)},Ae.useTransition=function(){return P.H.useTransition()},Ae.version="19.2.8",Ae}var Fp;function kd(){return Fp||(Fp=1,jc.exports=HS()),jc.exports}var S=kd();const Yr=Sd(S);var Tc={exports:{}},ls={},Ec={exports:{}},Nc={};var Pp;function US(){return Pp||(Pp=1,(function(e){function r(D,H){var B=D.length;D.push(H);e:for(;0<B;){var te=B-1>>>1,T=D[te];if(0<o(T,H))D[te]=H,D[B]=T,B=te;else break e}}function i(D){return D.length===0?null:D[0]}function s(D){if(D.length===0)return null;var H=D[0],B=D.pop();if(B!==H){D[0]=B;e:for(var te=0,T=D.length,I=T>>>1;te<I;){var U=2*(te+1)-1,C=D[U],ae=U+1,W=D[ae];if(0>o(C,B))ae<T&&0>o(W,C)?(D[te]=W,D[ae]=B,te=ae):(D[te]=C,D[U]=B,te=U);else if(ae<T&&0>o(W,B))D[te]=W,D[ae]=B,te=ae;else break e}}return H}function o(D,H){var B=D.sortIndex-H.sortIndex;return B!==0?B:D.id-H.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var d=Date,h=d.now();e.unstable_now=function(){return d.now()-h}}var p=[],g=[],v=1,y=null,k=3,b=!1,w=!1,N=!1,z=!1,R=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function F(D){for(var H=i(g);H!==null;){if(H.callback===null)s(g);else if(H.startTime<=D)s(g),H.sortIndex=H.expirationTime,r(p,H);else break;H=i(g)}}function K(D){if(N=!1,F(D),!w)if(i(p)!==null)w=!0,O||(O=!0,G());else{var H=i(g);H!==null&&M(K,H.startTime-D)}}var O=!1,P=-1,Y=5,le=-1;function _(){return z?!0:!(e.unstable_now()-le<Y)}function V(){if(z=!1,O){var D=e.unstable_now();le=D;var H=!0;try{e:{w=!1,N&&(N=!1,A(P),P=-1),b=!0;var B=k;try{t:{for(F(D),y=i(p);y!==null&&!(y.expirationTime>D&&_());){var te=y.callback;if(typeof te=="function"){y.callback=null,k=y.priorityLevel;var T=te(y.expirationTime<=D);if(D=e.unstable_now(),typeof T=="function"){y.callback=T,F(D),H=!0;break t}y===i(p)&&s(p),F(D)}else s(p);y=i(p)}if(y!==null)H=!0;else{var I=i(g);I!==null&&M(K,I.startTime-D),H=!1}}break e}finally{y=null,k=B,b=!1}H=void 0}}finally{H?G():O=!1}}}var G;if(typeof E=="function")G=function(){E(V)};else if(typeof MessageChannel<"u"){var ne=new MessageChannel,q=ne.port2;ne.port1.onmessage=V,G=function(){q.postMessage(null)}}else G=function(){R(V,0)};function M(D,H){P=R(function(){D(e.unstable_now())},H)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(D){D.callback=null},e.unstable_forceFrameRate=function(D){0>D||125<D?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Y=0<D?Math.floor(1e3/D):5},e.unstable_getCurrentPriorityLevel=function(){return k},e.unstable_next=function(D){switch(k){case 1:case 2:case 3:var H=3;break;default:H=k}var B=k;k=H;try{return D()}finally{k=B}},e.unstable_requestPaint=function(){z=!0},e.unstable_runWithPriority=function(D,H){switch(D){case 1:case 2:case 3:case 4:case 5:break;default:D=3}var B=k;k=D;try{return H()}finally{k=B}},e.unstable_scheduleCallback=function(D,H,B){var te=e.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?te+B:te):B=te,D){case 1:var T=-1;break;case 2:T=250;break;case 5:T=1073741823;break;case 4:T=1e4;break;default:T=5e3}return T=B+T,D={id:v++,callback:H,priorityLevel:D,startTime:B,expirationTime:T,sortIndex:-1},B>te?(D.sortIndex=B,r(g,D),i(p)===null&&D===i(g)&&(N?(A(P),P=-1):N=!0,M(K,B-te))):(D.sortIndex=T,r(p,D),w||b||(w=!0,O||(O=!0,G()))),D},e.unstable_shouldYield=_,e.unstable_wrapCallback=function(D){var H=k;return function(){var B=k;k=H;try{return D.apply(this,arguments)}finally{k=B}}}})(Nc)),Nc}var Vp;function qS(){return Vp||(Vp=1,Ec.exports=US()),Ec.exports}var Ic={exports:{}},Pt={};var Yp;function $S(){if(Yp)return Pt;Yp=1;var e=kd();function r(p){var g="https://react.dev/errors/"+p;if(1<arguments.length){g+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)g+="&args[]="+encodeURIComponent(arguments[v])}return"Minified React error #"+p+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var s={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for("react.portal");function c(p,g,v){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:y==null?null:""+y,children:p,containerInfo:g,implementation:v}}var d=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(p,g){if(p==="font")return"";if(typeof g=="string")return g==="use-credentials"?g:""}return Pt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,Pt.createPortal=function(p,g){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!g||g.nodeType!==1&&g.nodeType!==9&&g.nodeType!==11)throw Error(r(299));return c(p,g,null,v)},Pt.flushSync=function(p){var g=d.T,v=s.p;try{if(d.T=null,s.p=2,p)return p()}finally{d.T=g,s.p=v,s.d.f()}},Pt.preconnect=function(p,g){typeof p=="string"&&(g?(g=g.crossOrigin,g=typeof g=="string"?g==="use-credentials"?g:"":void 0):g=null,s.d.C(p,g))},Pt.prefetchDNS=function(p){typeof p=="string"&&s.d.D(p)},Pt.preinit=function(p,g){if(typeof p=="string"&&g&&typeof g.as=="string"){var v=g.as,y=h(v,g.crossOrigin),k=typeof g.integrity=="string"?g.integrity:void 0,b=typeof g.fetchPriority=="string"?g.fetchPriority:void 0;v==="style"?s.d.S(p,typeof g.precedence=="string"?g.precedence:void 0,{crossOrigin:y,integrity:k,fetchPriority:b}):v==="script"&&s.d.X(p,{crossOrigin:y,integrity:k,fetchPriority:b,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},Pt.preinitModule=function(p,g){if(typeof p=="string")if(typeof g=="object"&&g!==null){if(g.as==null||g.as==="script"){var v=h(g.as,g.crossOrigin);s.d.M(p,{crossOrigin:v,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0})}}else g==null&&s.d.M(p)},Pt.preload=function(p,g){if(typeof p=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var v=g.as,y=h(v,g.crossOrigin);s.d.L(p,v,{crossOrigin:y,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0,type:typeof g.type=="string"?g.type:void 0,fetchPriority:typeof g.fetchPriority=="string"?g.fetchPriority:void 0,referrerPolicy:typeof g.referrerPolicy=="string"?g.referrerPolicy:void 0,imageSrcSet:typeof g.imageSrcSet=="string"?g.imageSrcSet:void 0,imageSizes:typeof g.imageSizes=="string"?g.imageSizes:void 0,media:typeof g.media=="string"?g.media:void 0})}},Pt.preloadModule=function(p,g){if(typeof p=="string")if(g){var v=h(g.as,g.crossOrigin);s.d.m(p,{as:typeof g.as=="string"&&g.as!=="script"?g.as:void 0,crossOrigin:v,integrity:typeof g.integrity=="string"?g.integrity:void 0})}else s.d.m(p)},Pt.requestFormReset=function(p){s.d.r(p)},Pt.unstable_batchedUpdates=function(p,g){return p(g)},Pt.useFormState=function(p,g,v){return d.H.useFormState(p,g,v)},Pt.useFormStatus=function(){return d.H.useHostTransitionStatus()},Pt.version="19.2.8",Pt}var Kp;function Ry(){if(Kp)return Ic.exports;Kp=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(r){console.error(r)}}return e(),Ic.exports=$S(),Ic.exports}var Xp;function GS(){if(Xp)return ls;Xp=1;var e=qS(),r=kd(),i=Ry();function s(t){var n="https://react.dev/errors/"+t;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)n+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+t+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function c(t){var n=t,a=t;if(t.alternate)for(;n.return;)n=n.return;else{t=n;do n=t,(n.flags&4098)!==0&&(a=n.return),t=n.return;while(t)}return n.tag===3?a:null}function d(t){if(t.tag===13){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function h(t){if(t.tag===31){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function p(t){if(c(t)!==t)throw Error(s(188))}function g(t){var n=t.alternate;if(!n){if(n=c(t),n===null)throw Error(s(188));return n!==t?null:t}for(var a=t,l=n;;){var f=a.return;if(f===null)break;var m=f.alternate;if(m===null){if(l=f.return,l!==null){a=l;continue}break}if(f.child===m.child){for(m=f.child;m;){if(m===a)return p(f),t;if(m===l)return p(f),n;m=m.sibling}throw Error(s(188))}if(a.return!==l.return)a=f,l=m;else{for(var x=!1,j=f.child;j;){if(j===a){x=!0,a=f,l=m;break}if(j===l){x=!0,l=f,a=m;break}j=j.sibling}if(!x){for(j=m.child;j;){if(j===a){x=!0,a=m,l=f;break}if(j===l){x=!0,l=m,a=f;break}j=j.sibling}if(!x)throw Error(s(189))}}if(a.alternate!==l)throw Error(s(190))}if(a.tag!==3)throw Error(s(188));return a.stateNode.current===a?t:n}function v(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t;for(t=t.child;t!==null;){if(n=v(t),n!==null)return n;t=t.sibling}return null}var y=Object.assign,k=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),N=Symbol.for("react.fragment"),z=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),E=Symbol.for("react.context"),F=Symbol.for("react.forward_ref"),K=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),Y=Symbol.for("react.lazy"),le=Symbol.for("react.activity"),_=Symbol.for("react.memo_cache_sentinel"),V=Symbol.iterator;function G(t){return t===null||typeof t!="object"?null:(t=V&&t[V]||t["@@iterator"],typeof t=="function"?t:null)}var ne=Symbol.for("react.client.reference");function q(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===ne?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case N:return"Fragment";case R:return"Profiler";case z:return"StrictMode";case K:return"Suspense";case O:return"SuspenseList";case le:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case w:return"Portal";case E:return t.displayName||"Context";case A:return(t._context.displayName||"Context")+".Consumer";case F:var n=t.render;return t=t.displayName,t||(t=n.displayName||n.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case P:return n=t.displayName||null,n!==null?n:q(t.type)||"Memo";case Y:n=t._payload,t=t._init;try{return q(t(n))}catch{}}return null}var M=Array.isArray,D=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,H=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,B={pending:!1,data:null,method:null,action:null},te=[],T=-1;function I(t){return{current:t}}function U(t){0>T||(t.current=te[T],te[T]=null,T--)}function C(t,n){T++,te[T]=t.current,t.current=n}var ae=I(null),W=I(null),Q=I(null),ue=I(null);function me(t,n){switch(C(Q,n),C(W,t),C(ae,null),n.nodeType){case 9:case 11:t=(t=n.documentElement)&&(t=t.namespaceURI)?cp(t):0;break;default:if(t=n.tagName,n=n.namespaceURI)n=cp(n),t=dp(n,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}U(ae),C(ae,t)}function ge(){U(ae),U(W),U(Q)}function fe(t){t.memoizedState!==null&&C(ue,t);var n=ae.current,a=dp(n,t.type);n!==a&&(C(W,t),C(ae,a))}function Se(t){W.current===t&&(U(ae),U(W)),ue.current===t&&(U(ue),ns._currentValue=B)}var Me,et;function Ue(t){if(Me===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);Me=n&&n[1]||"",et=-1<a.stack.indexOf(`
|
|
2
|
+
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
+
`+Me+t+et}var ct=!1;function Jt(t,n){if(!t||ct)return"";ct=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(n){var de=function(){throw Error()};if(Object.defineProperty(de.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(de,[])}catch(ie){var ee=ie}Reflect.construct(t,[],de)}else{try{de.call()}catch(ie){ee=ie}t.call(de.prototype)}}else{try{throw Error()}catch(ie){ee=ie}(de=t())&&typeof de.catch=="function"&&de.catch(function(){})}}catch(ie){if(ie&&ee&&typeof ie.stack=="string")return[ie.stack,ee.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var m=l.DetermineComponentFrameRoot(),x=m[0],j=m[1];if(x&&j){var L=x.split(`
|
|
4
|
+
`),J=j.split(`
|
|
5
|
+
`);for(f=l=0;l<L.length&&!L[l].includes("DetermineComponentFrameRoot");)l++;for(;f<J.length&&!J[f].includes("DetermineComponentFrameRoot");)f++;if(l===L.length||f===J.length)for(l=L.length-1,f=J.length-1;1<=l&&0<=f&&L[l]!==J[f];)f--;for(;1<=l&&0<=f;l--,f--)if(L[l]!==J[f]){if(l!==1||f!==1)do if(l--,f--,0>f||L[l]!==J[f]){var oe=`
|
|
6
|
+
`+L[l].replace(" at new "," at ");return t.displayName&&oe.includes("<anonymous>")&&(oe=oe.replace("<anonymous>",t.displayName)),oe}while(1<=l&&0<=f);break}}}finally{ct=!1,Error.prepareStackTrace=a}return(a=t?t.displayName||t.name:"")?Ue(a):""}function Kt(t,n){switch(t.tag){case 26:case 27:case 5:return Ue(t.type);case 16:return Ue("Lazy");case 13:return t.child!==n&&n!==null?Ue("Suspense Fallback"):Ue("Suspense");case 19:return Ue("SuspenseList");case 0:case 15:return Jt(t.type,!1);case 11:return Jt(t.type.render,!1);case 1:return Jt(t.type,!0);case 31:return Ue("Activity");default:return""}}function Nt(t){try{var n="",a=null;do n+=Kt(t,a),a=t,t=t.return;while(t);return n}catch(l){return`
|
|
7
|
+
Error generating stack: `+l.message+`
|
|
8
|
+
`+l.stack}}var Wt=Object.prototype.hasOwnProperty,Gt=e.unstable_scheduleCallback,Ee=e.unstable_cancelCallback,Te=e.unstable_shouldYield,pt=e.unstable_requestPaint,qe=e.unstable_now,_e=e.unstable_getCurrentPriorityLevel,se=e.unstable_ImmediatePriority,he=e.unstable_UserBlockingPriority,be=e.unstable_NormalPriority,we=e.unstable_LowPriority,je=e.unstable_IdlePriority,Je=e.log,It=e.unstable_setDisableYieldValue,mt=null,Le=null;function At(t){if(typeof Je=="function"&&It(t),Le&&typeof Le.setStrictMode=="function")try{Le.setStrictMode(mt,t)}catch{}}var $e=Math.clz32?Math.clz32:Ie,dn=Math.log,Ft=Math.LN2;function Ie(t){return t>>>=0,t===0?32:31-(dn(t)/Ft|0)|0}var Ye=256,Ke=262144,ut=4194304;function wt(t){var n=t&42;if(n!==0)return n;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Mt(t,n,a){var l=t.pendingLanes;if(l===0)return 0;var f=0,m=t.suspendedLanes,x=t.pingedLanes;t=t.warmLanes;var j=l&134217727;return j!==0?(l=j&~m,l!==0?f=wt(l):(x&=j,x!==0?f=wt(x):a||(a=j&~t,a!==0&&(f=wt(a))))):(j=l&~m,j!==0?f=wt(j):x!==0?f=wt(x):a||(a=l&~t,a!==0&&(f=wt(a)))),f===0?0:n!==0&&n!==f&&(n&m)===0&&(m=f&-f,a=n&-n,m>=a||m===32&&(a&4194048)!==0)?n:f}function re(t,n){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&n)===0}function ke(t,n){switch(t){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function gt(){var t=ut;return ut<<=1,(ut&62914560)===0&&(ut=4194304),t}function Xe(t){for(var n=[],a=0;31>a;a++)n.push(t);return n}function _t(t,n){t.pendingLanes|=n,n!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function fn(t,n,a,l,f,m){var x=t.pendingLanes;t.pendingLanes=a,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=a,t.entangledLanes&=a,t.errorRecoveryDisabledLanes&=a,t.shellSuspendCounter=0;var j=t.entanglements,L=t.expirationTimes,J=t.hiddenUpdates;for(a=x&~a;0<a;){var oe=31-$e(a),de=1<<oe;j[oe]=0,L[oe]=-1;var ee=J[oe];if(ee!==null)for(J[oe]=null,oe=0;oe<ee.length;oe++){var ie=ee[oe];ie!==null&&(ie.lane&=-536870913)}a&=~de}l!==0&&Xt(t,l,0),m!==0&&f===0&&t.tag!==0&&(t.suspendedLanes|=m&~(x&~n))}function Xt(t,n,a){t.pendingLanes|=n,t.suspendedLanes&=~n;var l=31-$e(n);t.entangledLanes|=n,t.entanglements[l]=t.entanglements[l]|1073741824|a&261930}function wn(t,n){var a=t.entangledLanes|=n;for(t=t.entanglements;a;){var l=31-$e(a),f=1<<l;f&n|t[l]&n&&(t[l]|=n),a&=~f}}function Un(t,n){var a=n&-n;return a=(a&42)!==0?1:hn(a),(a&(t.suspendedLanes|n))!==0?0:a}function hn(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function br(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function Kd(){var t=H.p;return t!==0?t:(t=window.event,t===void 0?32:Mp(t.type))}function Xd(t,n){var a=H.p;try{return H.p=t,n()}finally{H.p=a}}var xr=Math.random().toString(36).slice(2),Bt="__reactFiber$"+xr,en="__reactProps$"+xr,ki="__reactContainer$"+xr,go="__reactEvents$"+xr,jb="__reactListeners$"+xr,Tb="__reactHandles$"+xr,Qd="__reactResources$"+xr,ya="__reactMarker$"+xr;function yo(t){delete t[Bt],delete t[en],delete t[go],delete t[jb],delete t[Tb]}function wi(t){var n=t[Bt];if(n)return n;for(var a=t.parentNode;a;){if(n=a[ki]||a[Bt]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(t=vp(t);t!==null;){if(a=t[Bt])return a;t=vp(t)}return n}t=a,a=t.parentNode}return null}function Ci(t){if(t=t[Bt]||t[ki]){var n=t.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return t}return null}function va(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t.stateNode;throw Error(s(33))}function Ri(t){var n=t[Qd];return n||(n=t[Qd]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Lt(t){t[ya]=!0}var Zd=new Set,Jd={};function Xr(t,n){ji(t,n),ji(t+"Capture",n)}function ji(t,n){for(Jd[t]=n,t=0;t<n.length;t++)Zd.add(n[t])}var Eb=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Wd={},ef={};function Nb(t){return Wt.call(ef,t)?!0:Wt.call(Wd,t)?!1:Eb.test(t)?ef[t]=!0:(Wd[t]=!0,!1)}function ks(t,n,a){if(Nb(n))if(a===null)t.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":t.removeAttribute(n);return;case"boolean":var l=n.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){t.removeAttribute(n);return}}t.setAttribute(n,""+a)}}function ws(t,n,a){if(a===null)t.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(n);return}t.setAttribute(n,""+a)}}function Qn(t,n,a,l){if(l===null)t.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(a);return}t.setAttributeNS(n,a,""+l)}}function Cn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function tf(t){var n=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Ib(t,n,a){var l=Object.getOwnPropertyDescriptor(t.constructor.prototype,n);if(!t.hasOwnProperty(n)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var f=l.get,m=l.set;return Object.defineProperty(t,n,{configurable:!0,get:function(){return f.call(this)},set:function(x){a=""+x,m.call(this,x)}}),Object.defineProperty(t,n,{enumerable:l.enumerable}),{getValue:function(){return a},setValue:function(x){a=""+x},stopTracking:function(){t._valueTracker=null,delete t[n]}}}}function vo(t){if(!t._valueTracker){var n=tf(t)?"checked":"value";t._valueTracker=Ib(t,n,""+t[n])}}function nf(t){if(!t)return!1;var n=t._valueTracker;if(!n)return!0;var a=n.getValue(),l="";return t&&(l=tf(t)?t.checked?"true":"false":t.value),t=l,t!==a?(n.setValue(t),!0):!1}function Cs(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var Ab=/[\n"\\]/g;function Rn(t){return t.replace(Ab,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function bo(t,n,a,l,f,m,x,j){t.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?t.type=x:t.removeAttribute("type"),n!=null?x==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+Cn(n)):t.value!==""+Cn(n)&&(t.value=""+Cn(n)):x!=="submit"&&x!=="reset"||t.removeAttribute("value"),n!=null?xo(t,x,Cn(n)):a!=null?xo(t,x,Cn(a)):l!=null&&t.removeAttribute("value"),f==null&&m!=null&&(t.defaultChecked=!!m),f!=null&&(t.checked=f&&typeof f!="function"&&typeof f!="symbol"),j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?t.name=""+Cn(j):t.removeAttribute("name")}function rf(t,n,a,l,f,m,x,j){if(m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(t.type=m),n!=null||a!=null){if(!(m!=="submit"&&m!=="reset"||n!=null)){vo(t);return}a=a!=null?""+Cn(a):"",n=n!=null?""+Cn(n):a,j||n===t.value||(t.value=n),t.defaultValue=n}l=l??f,l=typeof l!="function"&&typeof l!="symbol"&&!!l,t.checked=j?t.checked:!!l,t.defaultChecked=!!l,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(t.name=x),vo(t)}function xo(t,n,a){n==="number"&&Cs(t.ownerDocument)===t||t.defaultValue===""+a||(t.defaultValue=""+a)}function Ti(t,n,a,l){if(t=t.options,n){n={};for(var f=0;f<a.length;f++)n["$"+a[f]]=!0;for(a=0;a<t.length;a++)f=n.hasOwnProperty("$"+t[a].value),t[a].selected!==f&&(t[a].selected=f),f&&l&&(t[a].defaultSelected=!0)}else{for(a=""+Cn(a),n=null,f=0;f<t.length;f++){if(t[f].value===a){t[f].selected=!0,l&&(t[f].defaultSelected=!0);return}n!==null||t[f].disabled||(n=t[f])}n!==null&&(n.selected=!0)}}function af(t,n,a){if(n!=null&&(n=""+Cn(n),n!==t.value&&(t.value=n),a==null)){t.defaultValue!==n&&(t.defaultValue=n);return}t.defaultValue=a!=null?""+Cn(a):""}function sf(t,n,a,l){if(n==null){if(l!=null){if(a!=null)throw Error(s(92));if(M(l)){if(1<l.length)throw Error(s(93));l=l[0]}a=l}a==null&&(a=""),n=a}a=Cn(n),t.defaultValue=a,l=t.textContent,l===a&&l!==""&&l!==null&&(t.value=l),vo(t)}function Ei(t,n){if(n){var a=t.firstChild;if(a&&a===t.lastChild&&a.nodeType===3){a.nodeValue=n;return}}t.textContent=n}var Db=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function lf(t,n,a){var l=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?l?t.setProperty(n,""):n==="float"?t.cssFloat="":t[n]="":l?t.setProperty(n,a):typeof a!="number"||a===0||Db.has(n)?n==="float"?t.cssFloat=a:t[n]=(""+a).trim():t[n]=a+"px"}function of(t,n,a){if(n!=null&&typeof n!="object")throw Error(s(62));if(t=t.style,a!=null){for(var l in a)!a.hasOwnProperty(l)||n!=null&&n.hasOwnProperty(l)||(l.indexOf("--")===0?t.setProperty(l,""):l==="float"?t.cssFloat="":t[l]="");for(var f in n)l=n[f],n.hasOwnProperty(f)&&a[f]!==l&&lf(t,f,l)}else for(var m in n)n.hasOwnProperty(m)&&lf(t,m,n[m])}function So(t){if(t.indexOf("-")===-1)return!1;switch(t){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 Ob=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Mb=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Rs(t){return Mb.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function Zn(){}var ko=null;function wo(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Ni=null,Ii=null;function uf(t){var n=Ci(t);if(n&&(t=n.stateNode)){var a=t[en]||null;e:switch(t=n.stateNode,n.type){case"input":if(bo(t,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),n=a.name,a.type==="radio"&&n!=null){for(a=t;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Rn(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var l=a[n];if(l!==t&&l.form===t.form){var f=l[en]||null;if(!f)throw Error(s(90));bo(l,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(n=0;n<a.length;n++)l=a[n],l.form===t.form&&nf(l)}break e;case"textarea":af(t,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&Ti(t,!!a.multiple,n,!1)}}}var Co=!1;function cf(t,n,a){if(Co)return t(n,a);Co=!0;try{var l=t(n);return l}finally{if(Co=!1,(Ni!==null||Ii!==null)&&(fl(),Ni&&(n=Ni,t=Ii,Ii=Ni=null,uf(n),t)))for(n=0;n<t.length;n++)uf(t[n])}}function ba(t,n){var a=t.stateNode;if(a===null)return null;var l=a[en]||null;if(l===null)return null;a=l[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(t=t.type,l=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!l;break e;default:t=!1}if(t)return null;if(a&&typeof a!="function")throw Error(s(231,n,typeof a));return a}var Jn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ro=!1;if(Jn)try{var xa={};Object.defineProperty(xa,"passive",{get:function(){Ro=!0}}),window.addEventListener("test",xa,xa),window.removeEventListener("test",xa,xa)}catch{Ro=!1}var Sr=null,jo=null,js=null;function df(){if(js)return js;var t,n=jo,a=n.length,l,f="value"in Sr?Sr.value:Sr.textContent,m=f.length;for(t=0;t<a&&n[t]===f[t];t++);var x=a-t;for(l=1;l<=x&&n[a-l]===f[m-l];l++);return js=f.slice(t,1<l?1-l:void 0)}function Ts(t){var n=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&n===13&&(t=13)):t=n,t===10&&(t=13),32<=t||t===13?t:0}function Es(){return!0}function ff(){return!1}function tn(t){function n(a,l,f,m,x){this._reactName=a,this._targetInst=f,this.type=l,this.nativeEvent=m,this.target=x,this.currentTarget=null;for(var j in t)t.hasOwnProperty(j)&&(a=t[j],this[j]=a?a(m):m[j]);return this.isDefaultPrevented=(m.defaultPrevented!=null?m.defaultPrevented:m.returnValue===!1)?Es:ff,this.isPropagationStopped=ff,this}return y(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Es)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Es)},persist:function(){},isPersistent:Es}),n}var Qr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ns=tn(Qr),Sa=y({},Qr,{view:0,detail:0}),_b=tn(Sa),To,Eo,ka,Is=y({},Sa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Io,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==ka&&(ka&&t.type==="mousemove"?(To=t.screenX-ka.screenX,Eo=t.screenY-ka.screenY):Eo=To=0,ka=t),To)},movementY:function(t){return"movementY"in t?t.movementY:Eo}}),hf=tn(Is),Lb=y({},Is,{dataTransfer:0}),zb=tn(Lb),Bb=y({},Sa,{relatedTarget:0}),No=tn(Bb),Hb=y({},Qr,{animationName:0,elapsedTime:0,pseudoElement:0}),Ub=tn(Hb),qb=y({},Qr,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),$b=tn(qb),Gb=y({},Qr,{data:0}),mf=tn(Gb),Fb={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Pb={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"},Vb={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Yb(t){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(t):(t=Vb[t])?!!n[t]:!1}function Io(){return Yb}var Kb=y({},Sa,{key:function(t){if(t.key){var n=Fb[t.key]||t.key;if(n!=="Unidentified")return n}return t.type==="keypress"?(t=Ts(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Pb[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Io,charCode:function(t){return t.type==="keypress"?Ts(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Ts(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Xb=tn(Kb),Qb=y({},Is,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),pf=tn(Qb),Zb=y({},Sa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Io}),Jb=tn(Zb),Wb=y({},Qr,{propertyName:0,elapsedTime:0,pseudoElement:0}),ex=tn(Wb),tx=y({},Is,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),nx=tn(tx),rx=y({},Qr,{newState:0,oldState:0}),ix=tn(rx),ax=[9,13,27,32],Ao=Jn&&"CompositionEvent"in window,wa=null;Jn&&"documentMode"in document&&(wa=document.documentMode);var sx=Jn&&"TextEvent"in window&&!wa,gf=Jn&&(!Ao||wa&&8<wa&&11>=wa),yf=" ",vf=!1;function bf(t,n){switch(t){case"keyup":return ax.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function xf(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ai=!1;function lx(t,n){switch(t){case"compositionend":return xf(n);case"keypress":return n.which!==32?null:(vf=!0,yf);case"textInput":return t=n.data,t===yf&&vf?null:t;default:return null}}function ox(t,n){if(Ai)return t==="compositionend"||!Ao&&bf(t,n)?(t=df(),js=jo=Sr=null,Ai=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return gf&&n.locale!=="ko"?null:n.data;default:return null}}var ux={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 Sf(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n==="input"?!!ux[t.type]:n==="textarea"}function kf(t,n,a,l){Ni?Ii?Ii.push(l):Ii=[l]:Ni=l,n=bl(n,"onChange"),0<n.length&&(a=new Ns("onChange","change",null,a,l),t.push({event:a,listeners:n}))}var Ca=null,Ra=null;function cx(t){ip(t,0)}function As(t){var n=va(t);if(nf(n))return t}function wf(t,n){if(t==="change")return n}var Cf=!1;if(Jn){var Do;if(Jn){var Oo="oninput"in document;if(!Oo){var Rf=document.createElement("div");Rf.setAttribute("oninput","return;"),Oo=typeof Rf.oninput=="function"}Do=Oo}else Do=!1;Cf=Do&&(!document.documentMode||9<document.documentMode)}function jf(){Ca&&(Ca.detachEvent("onpropertychange",Tf),Ra=Ca=null)}function Tf(t){if(t.propertyName==="value"&&As(Ra)){var n=[];kf(n,Ra,t,wo(t)),cf(cx,n)}}function dx(t,n,a){t==="focusin"?(jf(),Ca=n,Ra=a,Ca.attachEvent("onpropertychange",Tf)):t==="focusout"&&jf()}function fx(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return As(Ra)}function hx(t,n){if(t==="click")return As(n)}function mx(t,n){if(t==="input"||t==="change")return As(n)}function px(t,n){return t===n&&(t!==0||1/t===1/n)||t!==t&&n!==n}var mn=typeof Object.is=="function"?Object.is:px;function ja(t,n){if(mn(t,n))return!0;if(typeof t!="object"||t===null||typeof n!="object"||n===null)return!1;var a=Object.keys(t),l=Object.keys(n);if(a.length!==l.length)return!1;for(l=0;l<a.length;l++){var f=a[l];if(!Wt.call(n,f)||!mn(t[f],n[f]))return!1}return!0}function Ef(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Nf(t,n){var a=Ef(t);t=0;for(var l;a;){if(a.nodeType===3){if(l=t+a.textContent.length,t<=n&&l>=n)return{node:a,offset:n-t};t=l}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Ef(a)}}function If(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?If(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function Af(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var n=Cs(t.document);n instanceof t.HTMLIFrameElement;){try{var a=typeof n.contentWindow.location.href=="string"}catch{a=!1}if(a)t=n.contentWindow;else break;n=Cs(t.document)}return n}function Mo(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n&&(n==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||n==="textarea"||t.contentEditable==="true")}var gx=Jn&&"documentMode"in document&&11>=document.documentMode,Di=null,_o=null,Ta=null,Lo=!1;function Df(t,n,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Lo||Di==null||Di!==Cs(l)||(l=Di,"selectionStart"in l&&Mo(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}),Ta&&ja(Ta,l)||(Ta=l,l=bl(_o,"onSelect"),0<l.length&&(n=new Ns("onSelect","select",null,n,a),t.push({event:n,listeners:l}),n.target=Di)))}function Zr(t,n){var a={};return a[t.toLowerCase()]=n.toLowerCase(),a["Webkit"+t]="webkit"+n,a["Moz"+t]="moz"+n,a}var Oi={animationend:Zr("Animation","AnimationEnd"),animationiteration:Zr("Animation","AnimationIteration"),animationstart:Zr("Animation","AnimationStart"),transitionrun:Zr("Transition","TransitionRun"),transitionstart:Zr("Transition","TransitionStart"),transitioncancel:Zr("Transition","TransitionCancel"),transitionend:Zr("Transition","TransitionEnd")},zo={},Of={};Jn&&(Of=document.createElement("div").style,"AnimationEvent"in window||(delete Oi.animationend.animation,delete Oi.animationiteration.animation,delete Oi.animationstart.animation),"TransitionEvent"in window||delete Oi.transitionend.transition);function Jr(t){if(zo[t])return zo[t];if(!Oi[t])return t;var n=Oi[t],a;for(a in n)if(n.hasOwnProperty(a)&&a in Of)return zo[t]=n[a];return t}var Mf=Jr("animationend"),_f=Jr("animationiteration"),Lf=Jr("animationstart"),yx=Jr("transitionrun"),vx=Jr("transitionstart"),bx=Jr("transitioncancel"),zf=Jr("transitionend"),Bf=new Map,Bo="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Bo.push("scrollEnd");function _n(t,n){Bf.set(t,n),Xr(n,[t])}var Ds=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},jn=[],Mi=0,Ho=0;function Os(){for(var t=Mi,n=Ho=Mi=0;n<t;){var a=jn[n];jn[n++]=null;var l=jn[n];jn[n++]=null;var f=jn[n];jn[n++]=null;var m=jn[n];if(jn[n++]=null,l!==null&&f!==null){var x=l.pending;x===null?f.next=f:(f.next=x.next,x.next=f),l.pending=f}m!==0&&Hf(a,f,m)}}function Ms(t,n,a,l){jn[Mi++]=t,jn[Mi++]=n,jn[Mi++]=a,jn[Mi++]=l,Ho|=l,t.lanes|=l,t=t.alternate,t!==null&&(t.lanes|=l)}function Uo(t,n,a,l){return Ms(t,n,a,l),_s(t)}function Wr(t,n){return Ms(t,null,null,n),_s(t)}function Hf(t,n,a){t.lanes|=a;var l=t.alternate;l!==null&&(l.lanes|=a);for(var f=!1,m=t.return;m!==null;)m.childLanes|=a,l=m.alternate,l!==null&&(l.childLanes|=a),m.tag===22&&(t=m.stateNode,t===null||t._visibility&1||(f=!0)),t=m,m=m.return;return t.tag===3?(m=t.stateNode,f&&n!==null&&(f=31-$e(a),t=m.hiddenUpdates,l=t[f],l===null?t[f]=[n]:l.push(n),n.lane=a|536870912),m):null}function _s(t){if(50<Xa)throw Xa=0,Xu=null,Error(s(185));for(var n=t.return;n!==null;)t=n,n=t.return;return t.tag===3?t.stateNode:null}var _i={};function xx(t,n,a,l){this.tag=t,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function pn(t,n,a,l){return new xx(t,n,a,l)}function qo(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Wn(t,n){var a=t.alternate;return a===null?(a=pn(t.tag,n,t.key,t.mode),a.elementType=t.elementType,a.type=t.type,a.stateNode=t.stateNode,a.alternate=t,t.alternate=a):(a.pendingProps=n,a.type=t.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=t.flags&65011712,a.childLanes=t.childLanes,a.lanes=t.lanes,a.child=t.child,a.memoizedProps=t.memoizedProps,a.memoizedState=t.memoizedState,a.updateQueue=t.updateQueue,n=t.dependencies,a.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},a.sibling=t.sibling,a.index=t.index,a.ref=t.ref,a.refCleanup=t.refCleanup,a}function Uf(t,n){t.flags&=65011714;var a=t.alternate;return a===null?(t.childLanes=0,t.lanes=n,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=a.childLanes,t.lanes=a.lanes,t.child=a.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=a.memoizedProps,t.memoizedState=a.memoizedState,t.updateQueue=a.updateQueue,t.type=a.type,n=a.dependencies,t.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),t}function Ls(t,n,a,l,f,m){var x=0;if(l=t,typeof t=="function")qo(t)&&(x=1);else if(typeof t=="string")x=RS(t,a,ae.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case le:return t=pn(31,a,n,f),t.elementType=le,t.lanes=m,t;case N:return ei(a.children,f,m,n);case z:x=8,f|=24;break;case R:return t=pn(12,a,n,f|2),t.elementType=R,t.lanes=m,t;case K:return t=pn(13,a,n,f),t.elementType=K,t.lanes=m,t;case O:return t=pn(19,a,n,f),t.elementType=O,t.lanes=m,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case E:x=10;break e;case A:x=9;break e;case F:x=11;break e;case P:x=14;break e;case Y:x=16,l=null;break e}x=29,a=Error(s(130,t===null?"null":typeof t,"")),l=null}return n=pn(x,a,n,f),n.elementType=t,n.type=l,n.lanes=m,n}function ei(t,n,a,l){return t=pn(7,t,l,n),t.lanes=a,t}function $o(t,n,a){return t=pn(6,t,null,n),t.lanes=a,t}function qf(t){var n=pn(18,null,null,0);return n.stateNode=t,n}function Go(t,n,a){return n=pn(4,t.children!==null?t.children:[],t.key,n),n.lanes=a,n.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},n}var $f=new WeakMap;function Tn(t,n){if(typeof t=="object"&&t!==null){var a=$f.get(t);return a!==void 0?a:(n={value:t,source:n,stack:Nt(n)},$f.set(t,n),n)}return{value:t,source:n,stack:Nt(n)}}var Li=[],zi=0,zs=null,Ea=0,En=[],Nn=0,kr=null,qn=1,$n="";function er(t,n){Li[zi++]=Ea,Li[zi++]=zs,zs=t,Ea=n}function Gf(t,n,a){En[Nn++]=qn,En[Nn++]=$n,En[Nn++]=kr,kr=t;var l=qn;t=$n;var f=32-$e(l)-1;l&=~(1<<f),a+=1;var m=32-$e(n)+f;if(30<m){var x=f-f%5;m=(l&(1<<x)-1).toString(32),l>>=x,f-=x,qn=1<<32-$e(n)+f|a<<f|l,$n=m+t}else qn=1<<m|a<<f|l,$n=t}function Fo(t){t.return!==null&&(er(t,1),Gf(t,1,0))}function Po(t){for(;t===zs;)zs=Li[--zi],Li[zi]=null,Ea=Li[--zi],Li[zi]=null;for(;t===kr;)kr=En[--Nn],En[Nn]=null,$n=En[--Nn],En[Nn]=null,qn=En[--Nn],En[Nn]=null}function Ff(t,n){En[Nn++]=qn,En[Nn++]=$n,En[Nn++]=kr,qn=n.id,$n=n.overflow,kr=t}var Ht=null,dt=null,Pe=!1,wr=null,In=!1,Vo=Error(s(519));function Cr(t){var n=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Na(Tn(n,t)),Vo}function Pf(t){var n=t.stateNode,a=t.type,l=t.memoizedProps;switch(n[Bt]=t,n[en]=l,a){case"dialog":Be("cancel",n),Be("close",n);break;case"iframe":case"object":case"embed":Be("load",n);break;case"video":case"audio":for(a=0;a<Za.length;a++)Be(Za[a],n);break;case"source":Be("error",n);break;case"img":case"image":case"link":Be("error",n),Be("load",n);break;case"details":Be("toggle",n);break;case"input":Be("invalid",n),rf(n,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Be("invalid",n);break;case"textarea":Be("invalid",n),sf(n,l.value,l.defaultValue,l.children)}a=l.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||n.textContent===""+a||l.suppressHydrationWarning===!0||op(n.textContent,a)?(l.popover!=null&&(Be("beforetoggle",n),Be("toggle",n)),l.onScroll!=null&&Be("scroll",n),l.onScrollEnd!=null&&Be("scrollend",n),l.onClick!=null&&(n.onclick=Zn),n=!0):n=!1,n||Cr(t,!0)}function Vf(t){for(Ht=t.return;Ht;)switch(Ht.tag){case 5:case 31:case 13:In=!1;return;case 27:case 3:In=!0;return;default:Ht=Ht.return}}function Bi(t){if(t!==Ht)return!1;if(!Pe)return Vf(t),Pe=!0,!1;var n=t.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=t.type,a=!(a!=="form"&&a!=="button")||cc(t.type,t.memoizedProps)),a=!a),a&&dt&&Cr(t),Vf(t),n===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));dt=yp(t)}else if(n===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));dt=yp(t)}else n===27?(n=dt,Br(t.type)?(t=pc,pc=null,dt=t):dt=n):dt=Ht?Dn(t.stateNode.nextSibling):null;return!0}function ti(){dt=Ht=null,Pe=!1}function Yo(){var t=wr;return t!==null&&(sn===null?sn=t:sn.push.apply(sn,t),wr=null),t}function Na(t){wr===null?wr=[t]:wr.push(t)}var Ko=I(null),ni=null,tr=null;function Rr(t,n,a){C(Ko,n._currentValue),n._currentValue=a}function nr(t){t._currentValue=Ko.current,U(Ko)}function Xo(t,n,a){for(;t!==null;){var l=t.alternate;if((t.childLanes&n)!==n?(t.childLanes|=n,l!==null&&(l.childLanes|=n)):l!==null&&(l.childLanes&n)!==n&&(l.childLanes|=n),t===a)break;t=t.return}}function Qo(t,n,a,l){var f=t.child;for(f!==null&&(f.return=t);f!==null;){var m=f.dependencies;if(m!==null){var x=f.child;m=m.firstContext;e:for(;m!==null;){var j=m;m=f;for(var L=0;L<n.length;L++)if(j.context===n[L]){m.lanes|=a,j=m.alternate,j!==null&&(j.lanes|=a),Xo(m.return,a,t),l||(x=null);break e}m=j.next}}else if(f.tag===18){if(x=f.return,x===null)throw Error(s(341));x.lanes|=a,m=x.alternate,m!==null&&(m.lanes|=a),Xo(x,a,t),x=null}else x=f.child;if(x!==null)x.return=f;else for(x=f;x!==null;){if(x===t){x=null;break}if(f=x.sibling,f!==null){f.return=x.return,x=f;break}x=x.return}f=x}}function Hi(t,n,a,l){t=null;for(var f=n,m=!1;f!==null;){if(!m){if((f.flags&524288)!==0)m=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var x=f.alternate;if(x===null)throw Error(s(387));if(x=x.memoizedProps,x!==null){var j=f.type;mn(f.pendingProps.value,x.value)||(t!==null?t.push(j):t=[j])}}else if(f===ue.current){if(x=f.alternate,x===null)throw Error(s(387));x.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(t!==null?t.push(ns):t=[ns])}f=f.return}t!==null&&Qo(n,t,a,l),n.flags|=262144}function Bs(t){for(t=t.firstContext;t!==null;){if(!mn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function ri(t){ni=t,tr=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function Ut(t){return Yf(ni,t)}function Hs(t,n){return ni===null&&ri(t),Yf(t,n)}function Yf(t,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},tr===null){if(t===null)throw Error(s(308));tr=n,t.dependencies={lanes:0,firstContext:n},t.flags|=524288}else tr=tr.next=n;return a}var Sx=typeof AbortController<"u"?AbortController:function(){var t=[],n=this.signal={aborted:!1,addEventListener:function(a,l){t.push(l)}};this.abort=function(){n.aborted=!0,t.forEach(function(a){return a()})}},kx=e.unstable_scheduleCallback,wx=e.unstable_NormalPriority,Ct={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Zo(){return{controller:new Sx,data:new Map,refCount:0}}function Ia(t){t.refCount--,t.refCount===0&&kx(wx,function(){t.controller.abort()})}var Aa=null,Jo=0,Ui=0,qi=null;function Cx(t,n){if(Aa===null){var a=Aa=[];Jo=0,Ui=tc(),qi={status:"pending",value:void 0,then:function(l){a.push(l)}}}return Jo++,n.then(Kf,Kf),n}function Kf(){if(--Jo===0&&Aa!==null){qi!==null&&(qi.status="fulfilled");var t=Aa;Aa=null,Ui=0,qi=null;for(var n=0;n<t.length;n++)(0,t[n])()}}function Rx(t,n){var a=[],l={status:"pending",value:null,reason:null,then:function(f){a.push(f)}};return t.then(function(){l.status="fulfilled",l.value=n;for(var f=0;f<a.length;f++)(0,a[f])(n)},function(f){for(l.status="rejected",l.reason=f,f=0;f<a.length;f++)(0,a[f])(void 0)}),l}var Xf=D.S;D.S=function(t,n){Dm=qe(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&Cx(t,n),Xf!==null&&Xf(t,n)};var ii=I(null);function Wo(){var t=ii.current;return t!==null?t:st.pooledCache}function Us(t,n){n===null?C(ii,ii.current):C(ii,n.pool)}function Qf(){var t=Wo();return t===null?null:{parent:Ct._currentValue,pool:t}}var $i=Error(s(460)),eu=Error(s(474)),qs=Error(s(542)),$s={then:function(){}};function Zf(t){return t=t.status,t==="fulfilled"||t==="rejected"}function Jf(t,n,a){switch(a=t[a],a===void 0?t.push(n):a!==n&&(n.then(Zn,Zn),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,eh(t),t;default:if(typeof n.status=="string")n.then(Zn,Zn);else{if(t=st,t!==null&&100<t.shellSuspendCounter)throw Error(s(482));t=n,t.status="pending",t.then(function(l){if(n.status==="pending"){var f=n;f.status="fulfilled",f.value=l}},function(l){if(n.status==="pending"){var f=n;f.status="rejected",f.reason=l}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,eh(t),t}throw si=n,$i}}function ai(t){try{var n=t._init;return n(t._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(si=a,$i):a}}var si=null;function Wf(){if(si===null)throw Error(s(459));var t=si;return si=null,t}function eh(t){if(t===$i||t===qs)throw Error(s(483))}var Gi=null,Da=0;function Gs(t){var n=Da;return Da+=1,Gi===null&&(Gi=[]),Jf(Gi,t,n)}function Oa(t,n){n=n.props.ref,t.ref=n!==void 0?n:null}function Fs(t,n){throw n.$$typeof===k?Error(s(525)):(t=Object.prototype.toString.call(n),Error(s(31,t==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":t)))}function th(t){function n(X,$){if(t){var Z=X.deletions;Z===null?(X.deletions=[$],X.flags|=16):Z.push($)}}function a(X,$){if(!t)return null;for(;$!==null;)n(X,$),$=$.sibling;return null}function l(X){for(var $=new Map;X!==null;)X.key!==null?$.set(X.key,X):$.set(X.index,X),X=X.sibling;return $}function f(X,$){return X=Wn(X,$),X.index=0,X.sibling=null,X}function m(X,$,Z){return X.index=Z,t?(Z=X.alternate,Z!==null?(Z=Z.index,Z<$?(X.flags|=67108866,$):Z):(X.flags|=67108866,$)):(X.flags|=1048576,$)}function x(X){return t&&X.alternate===null&&(X.flags|=67108866),X}function j(X,$,Z,ce){return $===null||$.tag!==6?($=$o(Z,X.mode,ce),$.return=X,$):($=f($,Z),$.return=X,$)}function L(X,$,Z,ce){var xe=Z.type;return xe===N?oe(X,$,Z.props.children,ce,Z.key):$!==null&&($.elementType===xe||typeof xe=="object"&&xe!==null&&xe.$$typeof===Y&&ai(xe)===$.type)?($=f($,Z.props),Oa($,Z),$.return=X,$):($=Ls(Z.type,Z.key,Z.props,null,X.mode,ce),Oa($,Z),$.return=X,$)}function J(X,$,Z,ce){return $===null||$.tag!==4||$.stateNode.containerInfo!==Z.containerInfo||$.stateNode.implementation!==Z.implementation?($=Go(Z,X.mode,ce),$.return=X,$):($=f($,Z.children||[]),$.return=X,$)}function oe(X,$,Z,ce,xe){return $===null||$.tag!==7?($=ei(Z,X.mode,ce,xe),$.return=X,$):($=f($,Z),$.return=X,$)}function de(X,$,Z){if(typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint")return $=$o(""+$,X.mode,Z),$.return=X,$;if(typeof $=="object"&&$!==null){switch($.$$typeof){case b:return Z=Ls($.type,$.key,$.props,null,X.mode,Z),Oa(Z,$),Z.return=X,Z;case w:return $=Go($,X.mode,Z),$.return=X,$;case Y:return $=ai($),de(X,$,Z)}if(M($)||G($))return $=ei($,X.mode,Z,null),$.return=X,$;if(typeof $.then=="function")return de(X,Gs($),Z);if($.$$typeof===E)return de(X,Hs(X,$),Z);Fs(X,$)}return null}function ee(X,$,Z,ce){var xe=$!==null?$.key:null;if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return xe!==null?null:j(X,$,""+Z,ce);if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case b:return Z.key===xe?L(X,$,Z,ce):null;case w:return Z.key===xe?J(X,$,Z,ce):null;case Y:return Z=ai(Z),ee(X,$,Z,ce)}if(M(Z)||G(Z))return xe!==null?null:oe(X,$,Z,ce,null);if(typeof Z.then=="function")return ee(X,$,Gs(Z),ce);if(Z.$$typeof===E)return ee(X,$,Hs(X,Z),ce);Fs(X,Z)}return null}function ie(X,$,Z,ce,xe){if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return X=X.get(Z)||null,j($,X,""+ce,xe);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case b:return X=X.get(ce.key===null?Z:ce.key)||null,L($,X,ce,xe);case w:return X=X.get(ce.key===null?Z:ce.key)||null,J($,X,ce,xe);case Y:return ce=ai(ce),ie(X,$,Z,ce,xe)}if(M(ce)||G(ce))return X=X.get(Z)||null,oe($,X,ce,xe,null);if(typeof ce.then=="function")return ie(X,$,Z,Gs(ce),xe);if(ce.$$typeof===E)return ie(X,$,Z,Hs($,ce),xe);Fs($,ce)}return null}function ye(X,$,Z,ce){for(var xe=null,Qe=null,ve=$,Oe=$=0,Fe=null;ve!==null&&Oe<Z.length;Oe++){ve.index>Oe?(Fe=ve,ve=null):Fe=ve.sibling;var Ze=ee(X,ve,Z[Oe],ce);if(Ze===null){ve===null&&(ve=Fe);break}t&&ve&&Ze.alternate===null&&n(X,ve),$=m(Ze,$,Oe),Qe===null?xe=Ze:Qe.sibling=Ze,Qe=Ze,ve=Fe}if(Oe===Z.length)return a(X,ve),Pe&&er(X,Oe),xe;if(ve===null){for(;Oe<Z.length;Oe++)ve=de(X,Z[Oe],ce),ve!==null&&($=m(ve,$,Oe),Qe===null?xe=ve:Qe.sibling=ve,Qe=ve);return Pe&&er(X,Oe),xe}for(ve=l(ve);Oe<Z.length;Oe++)Fe=ie(ve,X,Oe,Z[Oe],ce),Fe!==null&&(t&&Fe.alternate!==null&&ve.delete(Fe.key===null?Oe:Fe.key),$=m(Fe,$,Oe),Qe===null?xe=Fe:Qe.sibling=Fe,Qe=Fe);return t&&ve.forEach(function(Gr){return n(X,Gr)}),Pe&&er(X,Oe),xe}function Re(X,$,Z,ce){if(Z==null)throw Error(s(151));for(var xe=null,Qe=null,ve=$,Oe=$=0,Fe=null,Ze=Z.next();ve!==null&&!Ze.done;Oe++,Ze=Z.next()){ve.index>Oe?(Fe=ve,ve=null):Fe=ve.sibling;var Gr=ee(X,ve,Ze.value,ce);if(Gr===null){ve===null&&(ve=Fe);break}t&&ve&&Gr.alternate===null&&n(X,ve),$=m(Gr,$,Oe),Qe===null?xe=Gr:Qe.sibling=Gr,Qe=Gr,ve=Fe}if(Ze.done)return a(X,ve),Pe&&er(X,Oe),xe;if(ve===null){for(;!Ze.done;Oe++,Ze=Z.next())Ze=de(X,Ze.value,ce),Ze!==null&&($=m(Ze,$,Oe),Qe===null?xe=Ze:Qe.sibling=Ze,Qe=Ze);return Pe&&er(X,Oe),xe}for(ve=l(ve);!Ze.done;Oe++,Ze=Z.next())Ze=ie(ve,X,Oe,Ze.value,ce),Ze!==null&&(t&&Ze.alternate!==null&&ve.delete(Ze.key===null?Oe:Ze.key),$=m(Ze,$,Oe),Qe===null?xe=Ze:Qe.sibling=Ze,Qe=Ze);return t&&ve.forEach(function(LS){return n(X,LS)}),Pe&&er(X,Oe),xe}function at(X,$,Z,ce){if(typeof Z=="object"&&Z!==null&&Z.type===N&&Z.key===null&&(Z=Z.props.children),typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case b:e:{for(var xe=Z.key;$!==null;){if($.key===xe){if(xe=Z.type,xe===N){if($.tag===7){a(X,$.sibling),ce=f($,Z.props.children),ce.return=X,X=ce;break e}}else if($.elementType===xe||typeof xe=="object"&&xe!==null&&xe.$$typeof===Y&&ai(xe)===$.type){a(X,$.sibling),ce=f($,Z.props),Oa(ce,Z),ce.return=X,X=ce;break e}a(X,$);break}else n(X,$);$=$.sibling}Z.type===N?(ce=ei(Z.props.children,X.mode,ce,Z.key),ce.return=X,X=ce):(ce=Ls(Z.type,Z.key,Z.props,null,X.mode,ce),Oa(ce,Z),ce.return=X,X=ce)}return x(X);case w:e:{for(xe=Z.key;$!==null;){if($.key===xe)if($.tag===4&&$.stateNode.containerInfo===Z.containerInfo&&$.stateNode.implementation===Z.implementation){a(X,$.sibling),ce=f($,Z.children||[]),ce.return=X,X=ce;break e}else{a(X,$);break}else n(X,$);$=$.sibling}ce=Go(Z,X.mode,ce),ce.return=X,X=ce}return x(X);case Y:return Z=ai(Z),at(X,$,Z,ce)}if(M(Z))return ye(X,$,Z,ce);if(G(Z)){if(xe=G(Z),typeof xe!="function")throw Error(s(150));return Z=xe.call(Z),Re(X,$,Z,ce)}if(typeof Z.then=="function")return at(X,$,Gs(Z),ce);if(Z.$$typeof===E)return at(X,$,Hs(X,Z),ce);Fs(X,Z)}return typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint"?(Z=""+Z,$!==null&&$.tag===6?(a(X,$.sibling),ce=f($,Z),ce.return=X,X=ce):(a(X,$),ce=$o(Z,X.mode,ce),ce.return=X,X=ce),x(X)):a(X,$)}return function(X,$,Z,ce){try{Da=0;var xe=at(X,$,Z,ce);return Gi=null,xe}catch(ve){if(ve===$i||ve===qs)throw ve;var Qe=pn(29,ve,null,X.mode);return Qe.lanes=ce,Qe.return=X,Qe}}}var li=th(!0),nh=th(!1),jr=!1;function tu(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function nu(t,n){t=t.updateQueue,n.updateQueue===t&&(n.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Tr(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Er(t,n,a){var l=t.updateQueue;if(l===null)return null;if(l=l.shared,(We&2)!==0){var f=l.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),l.pending=n,n=_s(t),Hf(t,null,a),n}return Ms(t,l,n,a),_s(t)}function Ma(t,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var l=n.lanes;l&=t.pendingLanes,a|=l,n.lanes=a,wn(t,a)}}function ru(t,n){var a=t.updateQueue,l=t.alternate;if(l!==null&&(l=l.updateQueue,a===l)){var f=null,m=null;if(a=a.firstBaseUpdate,a!==null){do{var x={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};m===null?f=m=x:m=m.next=x,a=a.next}while(a!==null);m===null?f=m=n:m=m.next=n}else f=m=n;a={baseState:l.baseState,firstBaseUpdate:f,lastBaseUpdate:m,shared:l.shared,callbacks:l.callbacks},t.updateQueue=a;return}t=a.lastBaseUpdate,t===null?a.firstBaseUpdate=n:t.next=n,a.lastBaseUpdate=n}var iu=!1;function _a(){if(iu){var t=qi;if(t!==null)throw t}}function La(t,n,a,l){iu=!1;var f=t.updateQueue;jr=!1;var m=f.firstBaseUpdate,x=f.lastBaseUpdate,j=f.shared.pending;if(j!==null){f.shared.pending=null;var L=j,J=L.next;L.next=null,x===null?m=J:x.next=J,x=L;var oe=t.alternate;oe!==null&&(oe=oe.updateQueue,j=oe.lastBaseUpdate,j!==x&&(j===null?oe.firstBaseUpdate=J:j.next=J,oe.lastBaseUpdate=L))}if(m!==null){var de=f.baseState;x=0,oe=J=L=null,j=m;do{var ee=j.lane&-536870913,ie=ee!==j.lane;if(ie?(Ge&ee)===ee:(l&ee)===ee){ee!==0&&ee===Ui&&(iu=!0),oe!==null&&(oe=oe.next={lane:0,tag:j.tag,payload:j.payload,callback:null,next:null});e:{var ye=t,Re=j;ee=n;var at=a;switch(Re.tag){case 1:if(ye=Re.payload,typeof ye=="function"){de=ye.call(at,de,ee);break e}de=ye;break e;case 3:ye.flags=ye.flags&-65537|128;case 0:if(ye=Re.payload,ee=typeof ye=="function"?ye.call(at,de,ee):ye,ee==null)break e;de=y({},de,ee);break e;case 2:jr=!0}}ee=j.callback,ee!==null&&(t.flags|=64,ie&&(t.flags|=8192),ie=f.callbacks,ie===null?f.callbacks=[ee]:ie.push(ee))}else ie={lane:ee,tag:j.tag,payload:j.payload,callback:j.callback,next:null},oe===null?(J=oe=ie,L=de):oe=oe.next=ie,x|=ee;if(j=j.next,j===null){if(j=f.shared.pending,j===null)break;ie=j,j=ie.next,ie.next=null,f.lastBaseUpdate=ie,f.shared.pending=null}}while(!0);oe===null&&(L=de),f.baseState=L,f.firstBaseUpdate=J,f.lastBaseUpdate=oe,m===null&&(f.shared.lanes=0),Or|=x,t.lanes=x,t.memoizedState=de}}function rh(t,n){if(typeof t!="function")throw Error(s(191,t));t.call(n)}function ih(t,n){var a=t.callbacks;if(a!==null)for(t.callbacks=null,t=0;t<a.length;t++)rh(a[t],n)}var Fi=I(null),Ps=I(0);function ah(t,n){t=dr,C(Ps,t),C(Fi,n),dr=t|n.baseLanes}function au(){C(Ps,dr),C(Fi,Fi.current)}function su(){dr=Ps.current,U(Fi),U(Ps)}var gn=I(null),An=null;function Nr(t){var n=t.alternate;C(xt,xt.current&1),C(gn,t),An===null&&(n===null||Fi.current!==null||n.memoizedState!==null)&&(An=t)}function lu(t){C(xt,xt.current),C(gn,t),An===null&&(An=t)}function sh(t){t.tag===22?(C(xt,xt.current),C(gn,t),An===null&&(An=t)):Ir()}function Ir(){C(xt,xt.current),C(gn,gn.current)}function yn(t){U(gn),An===t&&(An=null),U(xt)}var xt=I(0);function Vs(t){for(var n=t;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||hc(a)||mc(a)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var rr=0,De=null,rt=null,Rt=null,Ys=!1,Pi=!1,oi=!1,Ks=0,za=0,Vi=null,jx=0;function yt(){throw Error(s(321))}function ou(t,n){if(n===null)return!1;for(var a=0;a<n.length&&a<t.length;a++)if(!mn(t[a],n[a]))return!1;return!0}function uu(t,n,a,l,f,m){return rr=m,De=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,D.H=t===null||t.memoizedState===null?Gh:Cu,oi=!1,m=a(l,f),oi=!1,Pi&&(m=oh(n,a,l,f)),lh(t),m}function lh(t){D.H=Ua;var n=rt!==null&&rt.next!==null;if(rr=0,Rt=rt=De=null,Ys=!1,za=0,Vi=null,n)throw Error(s(300));t===null||jt||(t=t.dependencies,t!==null&&Bs(t)&&(jt=!0))}function oh(t,n,a,l){De=t;var f=0;do{if(Pi&&(Vi=null),za=0,Pi=!1,25<=f)throw Error(s(301));if(f+=1,Rt=rt=null,t.updateQueue!=null){var m=t.updateQueue;m.lastEffect=null,m.events=null,m.stores=null,m.memoCache!=null&&(m.memoCache.index=0)}D.H=Fh,m=n(a,l)}while(Pi);return m}function Tx(){var t=D.H,n=t.useState()[0];return n=typeof n.then=="function"?Ba(n):n,t=t.useState()[0],(rt!==null?rt.memoizedState:null)!==t&&(De.flags|=1024),n}function cu(){var t=Ks!==0;return Ks=0,t}function du(t,n,a){n.updateQueue=t.updateQueue,n.flags&=-2053,t.lanes&=~a}function fu(t){if(Ys){for(t=t.memoizedState;t!==null;){var n=t.queue;n!==null&&(n.pending=null),t=t.next}Ys=!1}rr=0,Rt=rt=De=null,Pi=!1,za=Ks=0,Vi=null}function Qt(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Rt===null?De.memoizedState=Rt=t:Rt=Rt.next=t,Rt}function St(){if(rt===null){var t=De.alternate;t=t!==null?t.memoizedState:null}else t=rt.next;var n=Rt===null?De.memoizedState:Rt.next;if(n!==null)Rt=n,rt=t;else{if(t===null)throw De.alternate===null?Error(s(467)):Error(s(310));rt=t,t={memoizedState:rt.memoizedState,baseState:rt.baseState,baseQueue:rt.baseQueue,queue:rt.queue,next:null},Rt===null?De.memoizedState=Rt=t:Rt=Rt.next=t}return Rt}function Xs(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ba(t){var n=za;return za+=1,Vi===null&&(Vi=[]),t=Jf(Vi,t,n),n=De,(Rt===null?n.memoizedState:Rt.next)===null&&(n=n.alternate,D.H=n===null||n.memoizedState===null?Gh:Cu),t}function Qs(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Ba(t);if(t.$$typeof===E)return Ut(t)}throw Error(s(438,String(t)))}function hu(t){var n=null,a=De.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var l=De.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(n={data:l.data.map(function(f){return f.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),a===null&&(a=Xs(),De.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(t),l=0;l<t;l++)a[l]=_;return n.index++,a}function ir(t,n){return typeof n=="function"?n(t):n}function Zs(t){var n=St();return mu(n,rt,t)}function mu(t,n,a){var l=t.queue;if(l===null)throw Error(s(311));l.lastRenderedReducer=a;var f=t.baseQueue,m=l.pending;if(m!==null){if(f!==null){var x=f.next;f.next=m.next,m.next=x}n.baseQueue=f=m,l.pending=null}if(m=t.baseState,f===null)t.memoizedState=m;else{n=f.next;var j=x=null,L=null,J=n,oe=!1;do{var de=J.lane&-536870913;if(de!==J.lane?(Ge&de)===de:(rr&de)===de){var ee=J.revertLane;if(ee===0)L!==null&&(L=L.next={lane:0,revertLane:0,gesture:null,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null}),de===Ui&&(oe=!0);else if((rr&ee)===ee){J=J.next,ee===Ui&&(oe=!0);continue}else de={lane:0,revertLane:J.revertLane,gesture:null,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null},L===null?(j=L=de,x=m):L=L.next=de,De.lanes|=ee,Or|=ee;de=J.action,oi&&a(m,de),m=J.hasEagerState?J.eagerState:a(m,de)}else ee={lane:de,revertLane:J.revertLane,gesture:J.gesture,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null},L===null?(j=L=ee,x=m):L=L.next=ee,De.lanes|=de,Or|=de;J=J.next}while(J!==null&&J!==n);if(L===null?x=m:L.next=j,!mn(m,t.memoizedState)&&(jt=!0,oe&&(a=qi,a!==null)))throw a;t.memoizedState=m,t.baseState=x,t.baseQueue=L,l.lastRenderedState=m}return f===null&&(l.lanes=0),[t.memoizedState,l.dispatch]}function pu(t){var n=St(),a=n.queue;if(a===null)throw Error(s(311));a.lastRenderedReducer=t;var l=a.dispatch,f=a.pending,m=n.memoizedState;if(f!==null){a.pending=null;var x=f=f.next;do m=t(m,x.action),x=x.next;while(x!==f);mn(m,n.memoizedState)||(jt=!0),n.memoizedState=m,n.baseQueue===null&&(n.baseState=m),a.lastRenderedState=m}return[m,l]}function uh(t,n,a){var l=De,f=St(),m=Pe;if(m){if(a===void 0)throw Error(s(407));a=a()}else a=n();var x=!mn((rt||f).memoizedState,a);if(x&&(f.memoizedState=a,jt=!0),f=f.queue,vu(fh.bind(null,l,f,t),[t]),f.getSnapshot!==n||x||Rt!==null&&Rt.memoizedState.tag&1){if(l.flags|=2048,Yi(9,{destroy:void 0},dh.bind(null,l,f,a,n),null),st===null)throw Error(s(349));m||(rr&127)!==0||ch(l,n,a)}return a}function ch(t,n,a){t.flags|=16384,t={getSnapshot:n,value:a},n=De.updateQueue,n===null?(n=Xs(),De.updateQueue=n,n.stores=[t]):(a=n.stores,a===null?n.stores=[t]:a.push(t))}function dh(t,n,a,l){n.value=a,n.getSnapshot=l,hh(n)&&mh(t)}function fh(t,n,a){return a(function(){hh(n)&&mh(t)})}function hh(t){var n=t.getSnapshot;t=t.value;try{var a=n();return!mn(t,a)}catch{return!0}}function mh(t){var n=Wr(t,2);n!==null&&ln(n,t,2)}function gu(t){var n=Qt();if(typeof t=="function"){var a=t;if(t=a(),oi){At(!0);try{a()}finally{At(!1)}}}return n.memoizedState=n.baseState=t,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ir,lastRenderedState:t},n}function ph(t,n,a,l){return t.baseState=a,mu(t,rt,typeof l=="function"?l:ir)}function Ex(t,n,a,l,f){if(el(t))throw Error(s(485));if(t=n.action,t!==null){var m={payload:f,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(x){m.listeners.push(x)}};D.T!==null?a(!0):m.isTransition=!1,l(m),a=n.pending,a===null?(m.next=n.pending=m,gh(n,m)):(m.next=a.next,n.pending=a.next=m)}}function gh(t,n){var a=n.action,l=n.payload,f=t.state;if(n.isTransition){var m=D.T,x={};D.T=x;try{var j=a(f,l),L=D.S;L!==null&&L(x,j),yh(t,n,j)}catch(J){yu(t,n,J)}finally{m!==null&&x.types!==null&&(m.types=x.types),D.T=m}}else try{m=a(f,l),yh(t,n,m)}catch(J){yu(t,n,J)}}function yh(t,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){vh(t,n,l)},function(l){return yu(t,n,l)}):vh(t,n,a)}function vh(t,n,a){n.status="fulfilled",n.value=a,bh(n),t.state=a,n=t.pending,n!==null&&(a=n.next,a===n?t.pending=null:(a=a.next,n.next=a,gh(t,a)))}function yu(t,n,a){var l=t.pending;if(t.pending=null,l!==null){l=l.next;do n.status="rejected",n.reason=a,bh(n),n=n.next;while(n!==l)}t.action=null}function bh(t){t=t.listeners;for(var n=0;n<t.length;n++)(0,t[n])()}function xh(t,n){return n}function Sh(t,n){if(Pe){var a=st.formState;if(a!==null){e:{var l=De;if(Pe){if(dt){t:{for(var f=dt,m=In;f.nodeType!==8;){if(!m){f=null;break t}if(f=Dn(f.nextSibling),f===null){f=null;break t}}m=f.data,f=m==="F!"||m==="F"?f:null}if(f){dt=Dn(f.nextSibling),l=f.data==="F!";break e}}Cr(l)}l=!1}l&&(n=a[0])}}return a=Qt(),a.memoizedState=a.baseState=n,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:xh,lastRenderedState:n},a.queue=l,a=Uh.bind(null,De,l),l.dispatch=a,l=gu(!1),m=wu.bind(null,De,!1,l.queue),l=Qt(),f={state:n,dispatch:null,action:t,pending:null},l.queue=f,a=Ex.bind(null,De,f,m,a),f.dispatch=a,l.memoizedState=t,[n,a,!1]}function kh(t){var n=St();return wh(n,rt,t)}function wh(t,n,a){if(n=mu(t,n,xh)[0],t=Zs(ir)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var l=Ba(n)}catch(x){throw x===$i?qs:x}else l=n;n=St();var f=n.queue,m=f.dispatch;return a!==n.memoizedState&&(De.flags|=2048,Yi(9,{destroy:void 0},Nx.bind(null,f,a),null)),[l,m,t]}function Nx(t,n){t.action=n}function Ch(t){var n=St(),a=rt;if(a!==null)return wh(n,a,t);St(),n=n.memoizedState,a=St();var l=a.queue.dispatch;return a.memoizedState=t,[n,l,!1]}function Yi(t,n,a,l){return t={tag:t,create:a,deps:l,inst:n,next:null},n=De.updateQueue,n===null&&(n=Xs(),De.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=t.next=t:(l=a.next,a.next=t,t.next=l,n.lastEffect=t),t}function Rh(){return St().memoizedState}function Js(t,n,a,l){var f=Qt();De.flags|=t,f.memoizedState=Yi(1|n,{destroy:void 0},a,l===void 0?null:l)}function Ws(t,n,a,l){var f=St();l=l===void 0?null:l;var m=f.memoizedState.inst;rt!==null&&l!==null&&ou(l,rt.memoizedState.deps)?f.memoizedState=Yi(n,m,a,l):(De.flags|=t,f.memoizedState=Yi(1|n,m,a,l))}function jh(t,n){Js(8390656,8,t,n)}function vu(t,n){Ws(2048,8,t,n)}function Ix(t){De.flags|=4;var n=De.updateQueue;if(n===null)n=Xs(),De.updateQueue=n,n.events=[t];else{var a=n.events;a===null?n.events=[t]:a.push(t)}}function Th(t){var n=St().memoizedState;return Ix({ref:n,nextImpl:t}),function(){if((We&2)!==0)throw Error(s(440));return n.impl.apply(void 0,arguments)}}function Eh(t,n){return Ws(4,2,t,n)}function Nh(t,n){return Ws(4,4,t,n)}function Ih(t,n){if(typeof n=="function"){t=t();var a=n(t);return function(){typeof a=="function"?a():n(null)}}if(n!=null)return t=t(),n.current=t,function(){n.current=null}}function Ah(t,n,a){a=a!=null?a.concat([t]):null,Ws(4,4,Ih.bind(null,n,t),a)}function bu(){}function Dh(t,n){var a=St();n=n===void 0?null:n;var l=a.memoizedState;return n!==null&&ou(n,l[1])?l[0]:(a.memoizedState=[t,n],t)}function Oh(t,n){var a=St();n=n===void 0?null:n;var l=a.memoizedState;if(n!==null&&ou(n,l[1]))return l[0];if(l=t(),oi){At(!0);try{t()}finally{At(!1)}}return a.memoizedState=[l,n],l}function xu(t,n,a){return a===void 0||(rr&1073741824)!==0&&(Ge&261930)===0?t.memoizedState=n:(t.memoizedState=a,t=Mm(),De.lanes|=t,Or|=t,a)}function Mh(t,n,a,l){return mn(a,n)?a:Fi.current!==null?(t=xu(t,a,l),mn(t,n)||(jt=!0),t):(rr&42)===0||(rr&1073741824)!==0&&(Ge&261930)===0?(jt=!0,t.memoizedState=a):(t=Mm(),De.lanes|=t,Or|=t,n)}function _h(t,n,a,l,f){var m=H.p;H.p=m!==0&&8>m?m:8;var x=D.T,j={};D.T=j,wu(t,!1,n,a);try{var L=f(),J=D.S;if(J!==null&&J(j,L),L!==null&&typeof L=="object"&&typeof L.then=="function"){var oe=Rx(L,l);Ha(t,n,oe,xn(t))}else Ha(t,n,l,xn(t))}catch(de){Ha(t,n,{then:function(){},status:"rejected",reason:de},xn())}finally{H.p=m,x!==null&&j.types!==null&&(x.types=j.types),D.T=x}}function Ax(){}function Su(t,n,a,l){if(t.tag!==5)throw Error(s(476));var f=Lh(t).queue;_h(t,f,n,B,a===null?Ax:function(){return zh(t),a(l)})}function Lh(t){var n=t.memoizedState;if(n!==null)return n;n={memoizedState:B,baseState:B,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ir,lastRenderedState:B},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ir,lastRenderedState:a},next:null},t.memoizedState=n,t=t.alternate,t!==null&&(t.memoizedState=n),n}function zh(t){var n=Lh(t);n.next===null&&(n=t.alternate.memoizedState),Ha(t,n.next.queue,{},xn())}function ku(){return Ut(ns)}function Bh(){return St().memoizedState}function Hh(){return St().memoizedState}function Dx(t){for(var n=t.return;n!==null;){switch(n.tag){case 24:case 3:var a=xn();t=Tr(a);var l=Er(n,t,a);l!==null&&(ln(l,n,a),Ma(l,n,a)),n={cache:Zo()},t.payload=n;return}n=n.return}}function Ox(t,n,a){var l=xn();a={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},el(t)?qh(n,a):(a=Uo(t,n,a,l),a!==null&&(ln(a,t,l),$h(a,n,l)))}function Uh(t,n,a){var l=xn();Ha(t,n,a,l)}function Ha(t,n,a,l){var f={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(el(t))qh(n,f);else{var m=t.alternate;if(t.lanes===0&&(m===null||m.lanes===0)&&(m=n.lastRenderedReducer,m!==null))try{var x=n.lastRenderedState,j=m(x,a);if(f.hasEagerState=!0,f.eagerState=j,mn(j,x))return Ms(t,n,f,0),st===null&&Os(),!1}catch{}if(a=Uo(t,n,f,l),a!==null)return ln(a,t,l),$h(a,n,l),!0}return!1}function wu(t,n,a,l){if(l={lane:2,revertLane:tc(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},el(t)){if(n)throw Error(s(479))}else n=Uo(t,a,l,2),n!==null&&ln(n,t,2)}function el(t){var n=t.alternate;return t===De||n!==null&&n===De}function qh(t,n){Pi=Ys=!0;var a=t.pending;a===null?n.next=n:(n.next=a.next,a.next=n),t.pending=n}function $h(t,n,a){if((a&4194048)!==0){var l=n.lanes;l&=t.pendingLanes,a|=l,n.lanes=a,wn(t,a)}}var Ua={readContext:Ut,use:Qs,useCallback:yt,useContext:yt,useEffect:yt,useImperativeHandle:yt,useLayoutEffect:yt,useInsertionEffect:yt,useMemo:yt,useReducer:yt,useRef:yt,useState:yt,useDebugValue:yt,useDeferredValue:yt,useTransition:yt,useSyncExternalStore:yt,useId:yt,useHostTransitionStatus:yt,useFormState:yt,useActionState:yt,useOptimistic:yt,useMemoCache:yt,useCacheRefresh:yt};Ua.useEffectEvent=yt;var Gh={readContext:Ut,use:Qs,useCallback:function(t,n){return Qt().memoizedState=[t,n===void 0?null:n],t},useContext:Ut,useEffect:jh,useImperativeHandle:function(t,n,a){a=a!=null?a.concat([t]):null,Js(4194308,4,Ih.bind(null,n,t),a)},useLayoutEffect:function(t,n){return Js(4194308,4,t,n)},useInsertionEffect:function(t,n){Js(4,2,t,n)},useMemo:function(t,n){var a=Qt();n=n===void 0?null:n;var l=t();if(oi){At(!0);try{t()}finally{At(!1)}}return a.memoizedState=[l,n],l},useReducer:function(t,n,a){var l=Qt();if(a!==void 0){var f=a(n);if(oi){At(!0);try{a(n)}finally{At(!1)}}}else f=n;return l.memoizedState=l.baseState=f,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:f},l.queue=t,t=t.dispatch=Ox.bind(null,De,t),[l.memoizedState,t]},useRef:function(t){var n=Qt();return t={current:t},n.memoizedState=t},useState:function(t){t=gu(t);var n=t.queue,a=Uh.bind(null,De,n);return n.dispatch=a,[t.memoizedState,a]},useDebugValue:bu,useDeferredValue:function(t,n){var a=Qt();return xu(a,t,n)},useTransition:function(){var t=gu(!1);return t=_h.bind(null,De,t.queue,!0,!1),Qt().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,n,a){var l=De,f=Qt();if(Pe){if(a===void 0)throw Error(s(407));a=a()}else{if(a=n(),st===null)throw Error(s(349));(Ge&127)!==0||ch(l,n,a)}f.memoizedState=a;var m={value:a,getSnapshot:n};return f.queue=m,jh(fh.bind(null,l,m,t),[t]),l.flags|=2048,Yi(9,{destroy:void 0},dh.bind(null,l,m,a,n),null),a},useId:function(){var t=Qt(),n=st.identifierPrefix;if(Pe){var a=$n,l=qn;a=(l&~(1<<32-$e(l)-1)).toString(32)+a,n="_"+n+"R_"+a,a=Ks++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=jx++,n="_"+n+"r_"+a.toString(32)+"_";return t.memoizedState=n},useHostTransitionStatus:ku,useFormState:Sh,useActionState:Sh,useOptimistic:function(t){var n=Qt();n.memoizedState=n.baseState=t;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=wu.bind(null,De,!0,a),a.dispatch=n,[t,n]},useMemoCache:hu,useCacheRefresh:function(){return Qt().memoizedState=Dx.bind(null,De)},useEffectEvent:function(t){var n=Qt(),a={impl:t};return n.memoizedState=a,function(){if((We&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}},Cu={readContext:Ut,use:Qs,useCallback:Dh,useContext:Ut,useEffect:vu,useImperativeHandle:Ah,useInsertionEffect:Eh,useLayoutEffect:Nh,useMemo:Oh,useReducer:Zs,useRef:Rh,useState:function(){return Zs(ir)},useDebugValue:bu,useDeferredValue:function(t,n){var a=St();return Mh(a,rt.memoizedState,t,n)},useTransition:function(){var t=Zs(ir)[0],n=St().memoizedState;return[typeof t=="boolean"?t:Ba(t),n]},useSyncExternalStore:uh,useId:Bh,useHostTransitionStatus:ku,useFormState:kh,useActionState:kh,useOptimistic:function(t,n){var a=St();return ph(a,rt,t,n)},useMemoCache:hu,useCacheRefresh:Hh};Cu.useEffectEvent=Th;var Fh={readContext:Ut,use:Qs,useCallback:Dh,useContext:Ut,useEffect:vu,useImperativeHandle:Ah,useInsertionEffect:Eh,useLayoutEffect:Nh,useMemo:Oh,useReducer:pu,useRef:Rh,useState:function(){return pu(ir)},useDebugValue:bu,useDeferredValue:function(t,n){var a=St();return rt===null?xu(a,t,n):Mh(a,rt.memoizedState,t,n)},useTransition:function(){var t=pu(ir)[0],n=St().memoizedState;return[typeof t=="boolean"?t:Ba(t),n]},useSyncExternalStore:uh,useId:Bh,useHostTransitionStatus:ku,useFormState:Ch,useActionState:Ch,useOptimistic:function(t,n){var a=St();return rt!==null?ph(a,rt,t,n):(a.baseState=t,[t,a.queue.dispatch])},useMemoCache:hu,useCacheRefresh:Hh};Fh.useEffectEvent=Th;function Ru(t,n,a,l){n=t.memoizedState,a=a(l,n),a=a==null?n:y({},n,a),t.memoizedState=a,t.lanes===0&&(t.updateQueue.baseState=a)}var ju={enqueueSetState:function(t,n,a){t=t._reactInternals;var l=xn(),f=Tr(l);f.payload=n,a!=null&&(f.callback=a),n=Er(t,f,l),n!==null&&(ln(n,t,l),Ma(n,t,l))},enqueueReplaceState:function(t,n,a){t=t._reactInternals;var l=xn(),f=Tr(l);f.tag=1,f.payload=n,a!=null&&(f.callback=a),n=Er(t,f,l),n!==null&&(ln(n,t,l),Ma(n,t,l))},enqueueForceUpdate:function(t,n){t=t._reactInternals;var a=xn(),l=Tr(a);l.tag=2,n!=null&&(l.callback=n),n=Er(t,l,a),n!==null&&(ln(n,t,a),Ma(n,t,a))}};function Ph(t,n,a,l,f,m,x){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(l,m,x):n.prototype&&n.prototype.isPureReactComponent?!ja(a,l)||!ja(f,m):!0}function Vh(t,n,a,l){t=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,l),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,l),n.state!==t&&ju.enqueueReplaceState(n,n.state,null)}function ui(t,n){var a=n;if("ref"in n){a={};for(var l in n)l!=="ref"&&(a[l]=n[l])}if(t=t.defaultProps){a===n&&(a=y({},a));for(var f in t)a[f]===void 0&&(a[f]=t[f])}return a}function Yh(t){Ds(t)}function Kh(t){console.error(t)}function Xh(t){Ds(t)}function tl(t,n){try{var a=t.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(l){setTimeout(function(){throw l})}}function Qh(t,n,a){try{var l=t.onCaughtError;l(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function Tu(t,n,a){return a=Tr(a),a.tag=3,a.payload={element:null},a.callback=function(){tl(t,n)},a}function Zh(t){return t=Tr(t),t.tag=3,t}function Jh(t,n,a,l){var f=a.type.getDerivedStateFromError;if(typeof f=="function"){var m=l.value;t.payload=function(){return f(m)},t.callback=function(){Qh(n,a,l)}}var x=a.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(t.callback=function(){Qh(n,a,l),typeof f!="function"&&(Mr===null?Mr=new Set([this]):Mr.add(this));var j=l.stack;this.componentDidCatch(l.value,{componentStack:j!==null?j:""})})}function Mx(t,n,a,l,f){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(n=a.alternate,n!==null&&Hi(n,a,f,!0),a=gn.current,a!==null){switch(a.tag){case 31:case 13:return An===null?hl():a.alternate===null&&vt===0&&(vt=3),a.flags&=-257,a.flags|=65536,a.lanes=f,l===$s?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([l]):n.add(l),Ju(t,l,f)),!1;case 22:return a.flags|=65536,l===$s?a.flags|=16384:(n=a.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([l])},a.updateQueue=n):(a=n.retryQueue,a===null?n.retryQueue=new Set([l]):a.add(l)),Ju(t,l,f)),!1}throw Error(s(435,a.tag))}return Ju(t,l,f),hl(),!1}if(Pe)return n=gn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=f,l!==Vo&&(t=Error(s(422),{cause:l}),Na(Tn(t,a)))):(l!==Vo&&(n=Error(s(423),{cause:l}),Na(Tn(n,a))),t=t.current.alternate,t.flags|=65536,f&=-f,t.lanes|=f,l=Tn(l,a),f=Tu(t.stateNode,l,f),ru(t,f),vt!==4&&(vt=2)),!1;var m=Error(s(520),{cause:l});if(m=Tn(m,a),Ka===null?Ka=[m]:Ka.push(m),vt!==4&&(vt=2),n===null)return!0;l=Tn(l,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,t=f&-f,a.lanes|=t,t=Tu(a.stateNode,l,t),ru(a,t),!1;case 1:if(n=a.type,m=a.stateNode,(a.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||m!==null&&typeof m.componentDidCatch=="function"&&(Mr===null||!Mr.has(m))))return a.flags|=65536,f&=-f,a.lanes|=f,f=Zh(f),Jh(f,t,a,l),ru(a,f),!1}a=a.return}while(a!==null);return!1}var Eu=Error(s(461)),jt=!1;function qt(t,n,a,l){n.child=t===null?nh(n,null,a,l):li(n,t.child,a,l)}function Wh(t,n,a,l,f){a=a.render;var m=n.ref;if("ref"in l){var x={};for(var j in l)j!=="ref"&&(x[j]=l[j])}else x=l;return ri(n),l=uu(t,n,a,x,m,f),j=cu(),t!==null&&!jt?(du(t,n,f),ar(t,n,f)):(Pe&&j&&Fo(n),n.flags|=1,qt(t,n,l,f),n.child)}function em(t,n,a,l,f){if(t===null){var m=a.type;return typeof m=="function"&&!qo(m)&&m.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=m,tm(t,n,m,l,f)):(t=Ls(a.type,null,l,n,n.mode,f),t.ref=n.ref,t.return=n,n.child=t)}if(m=t.child,!Lu(t,f)){var x=m.memoizedProps;if(a=a.compare,a=a!==null?a:ja,a(x,l)&&t.ref===n.ref)return ar(t,n,f)}return n.flags|=1,t=Wn(m,l),t.ref=n.ref,t.return=n,n.child=t}function tm(t,n,a,l,f){if(t!==null){var m=t.memoizedProps;if(ja(m,l)&&t.ref===n.ref)if(jt=!1,n.pendingProps=l=m,Lu(t,f))(t.flags&131072)!==0&&(jt=!0);else return n.lanes=t.lanes,ar(t,n,f)}return Nu(t,n,a,l,f)}function nm(t,n,a,l){var f=l.children,m=t!==null?t.memoizedState:null;if(t===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((n.flags&128)!==0){if(m=m!==null?m.baseLanes|a:a,t!==null){for(l=n.child=t.child,f=0;l!==null;)f=f|l.lanes|l.childLanes,l=l.sibling;l=f&~m}else l=0,n.child=null;return rm(t,n,m,a,l)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},t!==null&&Us(n,m!==null?m.cachePool:null),m!==null?ah(n,m):au(),sh(n);else return l=n.lanes=536870912,rm(t,n,m!==null?m.baseLanes|a:a,a,l)}else m!==null?(Us(n,m.cachePool),ah(n,m),Ir(),n.memoizedState=null):(t!==null&&Us(n,null),au(),Ir());return qt(t,n,f,a),n.child}function qa(t,n){return t!==null&&t.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function rm(t,n,a,l,f){var m=Wo();return m=m===null?null:{parent:Ct._currentValue,pool:m},n.memoizedState={baseLanes:a,cachePool:m},t!==null&&Us(n,null),au(),sh(n),t!==null&&Hi(t,n,l,!0),n.childLanes=f,null}function nl(t,n){return n=il({mode:n.mode,children:n.children},t.mode),n.ref=t.ref,t.child=n,n.return=t,n}function im(t,n,a){return li(n,t.child,null,a),t=nl(n,n.pendingProps),t.flags|=2,yn(n),n.memoizedState=null,t}function _x(t,n,a){var l=n.pendingProps,f=(n.flags&128)!==0;if(n.flags&=-129,t===null){if(Pe){if(l.mode==="hidden")return t=nl(n,l),n.lanes=536870912,qa(null,t);if(lu(n),(t=dt)?(t=gp(t,In),t=t!==null&&t.data==="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:kr!==null?{id:qn,overflow:$n}:null,retryLane:536870912,hydrationErrors:null},a=qf(t),a.return=n,n.child=a,Ht=n,dt=null)):t=null,t===null)throw Cr(n);return n.lanes=536870912,null}return nl(n,l)}var m=t.memoizedState;if(m!==null){var x=m.dehydrated;if(lu(n),f)if(n.flags&256)n.flags&=-257,n=im(t,n,a);else if(n.memoizedState!==null)n.child=t.child,n.flags|=128,n=null;else throw Error(s(558));else if(jt||Hi(t,n,a,!1),f=(a&t.childLanes)!==0,jt||f){if(l=st,l!==null&&(x=Un(l,a),x!==0&&x!==m.retryLane))throw m.retryLane=x,Wr(t,x),ln(l,t,x),Eu;hl(),n=im(t,n,a)}else t=m.treeContext,dt=Dn(x.nextSibling),Ht=n,Pe=!0,wr=null,In=!1,t!==null&&Ff(n,t),n=nl(n,l),n.flags|=4096;return n}return t=Wn(t.child,{mode:l.mode,children:l.children}),t.ref=n.ref,n.child=t,t.return=n,t}function rl(t,n){var a=n.ref;if(a===null)t!==null&&t.ref!==null&&(n.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(s(284));(t===null||t.ref!==a)&&(n.flags|=4194816)}}function Nu(t,n,a,l,f){return ri(n),a=uu(t,n,a,l,void 0,f),l=cu(),t!==null&&!jt?(du(t,n,f),ar(t,n,f)):(Pe&&l&&Fo(n),n.flags|=1,qt(t,n,a,f),n.child)}function am(t,n,a,l,f,m){return ri(n),n.updateQueue=null,a=oh(n,l,a,f),lh(t),l=cu(),t!==null&&!jt?(du(t,n,m),ar(t,n,m)):(Pe&&l&&Fo(n),n.flags|=1,qt(t,n,a,m),n.child)}function sm(t,n,a,l,f){if(ri(n),n.stateNode===null){var m=_i,x=a.contextType;typeof x=="object"&&x!==null&&(m=Ut(x)),m=new a(l,m),n.memoizedState=m.state!==null&&m.state!==void 0?m.state:null,m.updater=ju,n.stateNode=m,m._reactInternals=n,m=n.stateNode,m.props=l,m.state=n.memoizedState,m.refs={},tu(n),x=a.contextType,m.context=typeof x=="object"&&x!==null?Ut(x):_i,m.state=n.memoizedState,x=a.getDerivedStateFromProps,typeof x=="function"&&(Ru(n,a,x,l),m.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof m.getSnapshotBeforeUpdate=="function"||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(x=m.state,typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount(),x!==m.state&&ju.enqueueReplaceState(m,m.state,null),La(n,l,m,f),_a(),m.state=n.memoizedState),typeof m.componentDidMount=="function"&&(n.flags|=4194308),l=!0}else if(t===null){m=n.stateNode;var j=n.memoizedProps,L=ui(a,j);m.props=L;var J=m.context,oe=a.contextType;x=_i,typeof oe=="object"&&oe!==null&&(x=Ut(oe));var de=a.getDerivedStateFromProps;oe=typeof de=="function"||typeof m.getSnapshotBeforeUpdate=="function",j=n.pendingProps!==j,oe||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(j||J!==x)&&Vh(n,m,l,x),jr=!1;var ee=n.memoizedState;m.state=ee,La(n,l,m,f),_a(),J=n.memoizedState,j||ee!==J||jr?(typeof de=="function"&&(Ru(n,a,de,l),J=n.memoizedState),(L=jr||Ph(n,a,L,l,ee,J,x))?(oe||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount()),typeof m.componentDidMount=="function"&&(n.flags|=4194308)):(typeof m.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=l,n.memoizedState=J),m.props=l,m.state=J,m.context=x,l=L):(typeof m.componentDidMount=="function"&&(n.flags|=4194308),l=!1)}else{m=n.stateNode,nu(t,n),x=n.memoizedProps,oe=ui(a,x),m.props=oe,de=n.pendingProps,ee=m.context,J=a.contextType,L=_i,typeof J=="object"&&J!==null&&(L=Ut(J)),j=a.getDerivedStateFromProps,(J=typeof j=="function"||typeof m.getSnapshotBeforeUpdate=="function")||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(x!==de||ee!==L)&&Vh(n,m,l,L),jr=!1,ee=n.memoizedState,m.state=ee,La(n,l,m,f),_a();var ie=n.memoizedState;x!==de||ee!==ie||jr||t!==null&&t.dependencies!==null&&Bs(t.dependencies)?(typeof j=="function"&&(Ru(n,a,j,l),ie=n.memoizedState),(oe=jr||Ph(n,a,oe,l,ee,ie,L)||t!==null&&t.dependencies!==null&&Bs(t.dependencies))?(J||typeof m.UNSAFE_componentWillUpdate!="function"&&typeof m.componentWillUpdate!="function"||(typeof m.componentWillUpdate=="function"&&m.componentWillUpdate(l,ie,L),typeof m.UNSAFE_componentWillUpdate=="function"&&m.UNSAFE_componentWillUpdate(l,ie,L)),typeof m.componentDidUpdate=="function"&&(n.flags|=4),typeof m.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof m.componentDidUpdate!="function"||x===t.memoizedProps&&ee===t.memoizedState||(n.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||x===t.memoizedProps&&ee===t.memoizedState||(n.flags|=1024),n.memoizedProps=l,n.memoizedState=ie),m.props=l,m.state=ie,m.context=L,l=oe):(typeof m.componentDidUpdate!="function"||x===t.memoizedProps&&ee===t.memoizedState||(n.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||x===t.memoizedProps&&ee===t.memoizedState||(n.flags|=1024),l=!1)}return m=l,rl(t,n),l=(n.flags&128)!==0,m||l?(m=n.stateNode,a=l&&typeof a.getDerivedStateFromError!="function"?null:m.render(),n.flags|=1,t!==null&&l?(n.child=li(n,t.child,null,f),n.child=li(n,null,a,f)):qt(t,n,a,f),n.memoizedState=m.state,t=n.child):t=ar(t,n,f),t}function lm(t,n,a,l){return ti(),n.flags|=256,qt(t,n,a,l),n.child}var Iu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Au(t){return{baseLanes:t,cachePool:Qf()}}function Du(t,n,a){return t=t!==null?t.childLanes&~a:0,n&&(t|=bn),t}function om(t,n,a){var l=n.pendingProps,f=!1,m=(n.flags&128)!==0,x;if((x=m)||(x=t!==null&&t.memoizedState===null?!1:(xt.current&2)!==0),x&&(f=!0,n.flags&=-129),x=(n.flags&32)!==0,n.flags&=-33,t===null){if(Pe){if(f?Nr(n):Ir(),(t=dt)?(t=gp(t,In),t=t!==null&&t.data!=="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:kr!==null?{id:qn,overflow:$n}:null,retryLane:536870912,hydrationErrors:null},a=qf(t),a.return=n,n.child=a,Ht=n,dt=null)):t=null,t===null)throw Cr(n);return mc(t)?n.lanes=32:n.lanes=536870912,null}var j=l.children;return l=l.fallback,f?(Ir(),f=n.mode,j=il({mode:"hidden",children:j},f),l=ei(l,f,a,null),j.return=n,l.return=n,j.sibling=l,n.child=j,l=n.child,l.memoizedState=Au(a),l.childLanes=Du(t,x,a),n.memoizedState=Iu,qa(null,l)):(Nr(n),Ou(n,j))}var L=t.memoizedState;if(L!==null&&(j=L.dehydrated,j!==null)){if(m)n.flags&256?(Nr(n),n.flags&=-257,n=Mu(t,n,a)):n.memoizedState!==null?(Ir(),n.child=t.child,n.flags|=128,n=null):(Ir(),j=l.fallback,f=n.mode,l=il({mode:"visible",children:l.children},f),j=ei(j,f,a,null),j.flags|=2,l.return=n,j.return=n,l.sibling=j,n.child=l,li(n,t.child,null,a),l=n.child,l.memoizedState=Au(a),l.childLanes=Du(t,x,a),n.memoizedState=Iu,n=qa(null,l));else if(Nr(n),mc(j)){if(x=j.nextSibling&&j.nextSibling.dataset,x)var J=x.dgst;x=J,l=Error(s(419)),l.stack="",l.digest=x,Na({value:l,source:null,stack:null}),n=Mu(t,n,a)}else if(jt||Hi(t,n,a,!1),x=(a&t.childLanes)!==0,jt||x){if(x=st,x!==null&&(l=Un(x,a),l!==0&&l!==L.retryLane))throw L.retryLane=l,Wr(t,l),ln(x,t,l),Eu;hc(j)||hl(),n=Mu(t,n,a)}else hc(j)?(n.flags|=192,n.child=t.child,n=null):(t=L.treeContext,dt=Dn(j.nextSibling),Ht=n,Pe=!0,wr=null,In=!1,t!==null&&Ff(n,t),n=Ou(n,l.children),n.flags|=4096);return n}return f?(Ir(),j=l.fallback,f=n.mode,L=t.child,J=L.sibling,l=Wn(L,{mode:"hidden",children:l.children}),l.subtreeFlags=L.subtreeFlags&65011712,J!==null?j=Wn(J,j):(j=ei(j,f,a,null),j.flags|=2),j.return=n,l.return=n,l.sibling=j,n.child=l,qa(null,l),l=n.child,j=t.child.memoizedState,j===null?j=Au(a):(f=j.cachePool,f!==null?(L=Ct._currentValue,f=f.parent!==L?{parent:L,pool:L}:f):f=Qf(),j={baseLanes:j.baseLanes|a,cachePool:f}),l.memoizedState=j,l.childLanes=Du(t,x,a),n.memoizedState=Iu,qa(t.child,l)):(Nr(n),a=t.child,t=a.sibling,a=Wn(a,{mode:"visible",children:l.children}),a.return=n,a.sibling=null,t!==null&&(x=n.deletions,x===null?(n.deletions=[t],n.flags|=16):x.push(t)),n.child=a,n.memoizedState=null,a)}function Ou(t,n){return n=il({mode:"visible",children:n},t.mode),n.return=t,t.child=n}function il(t,n){return t=pn(22,t,null,n),t.lanes=0,t}function Mu(t,n,a){return li(n,t.child,null,a),t=Ou(n,n.pendingProps.children),t.flags|=2,n.memoizedState=null,t}function um(t,n,a){t.lanes|=n;var l=t.alternate;l!==null&&(l.lanes|=n),Xo(t.return,n,a)}function _u(t,n,a,l,f,m){var x=t.memoizedState;x===null?t.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:l,tail:a,tailMode:f,treeForkCount:m}:(x.isBackwards=n,x.rendering=null,x.renderingStartTime=0,x.last=l,x.tail=a,x.tailMode=f,x.treeForkCount=m)}function cm(t,n,a){var l=n.pendingProps,f=l.revealOrder,m=l.tail;l=l.children;var x=xt.current,j=(x&2)!==0;if(j?(x=x&1|2,n.flags|=128):x&=1,C(xt,x),qt(t,n,l,a),l=Pe?Ea:0,!j&&t!==null&&(t.flags&128)!==0)e:for(t=n.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&um(t,a,n);else if(t.tag===19)um(t,a,n);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===n)break e;for(;t.sibling===null;){if(t.return===null||t.return===n)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(f){case"forwards":for(a=n.child,f=null;a!==null;)t=a.alternate,t!==null&&Vs(t)===null&&(f=a),a=a.sibling;a=f,a===null?(f=n.child,n.child=null):(f=a.sibling,a.sibling=null),_u(n,!1,f,a,m,l);break;case"backwards":case"unstable_legacy-backwards":for(a=null,f=n.child,n.child=null;f!==null;){if(t=f.alternate,t!==null&&Vs(t)===null){n.child=f;break}t=f.sibling,f.sibling=a,a=f,f=t}_u(n,!0,a,null,m,l);break;case"together":_u(n,!1,null,null,void 0,l);break;default:n.memoizedState=null}return n.child}function ar(t,n,a){if(t!==null&&(n.dependencies=t.dependencies),Or|=n.lanes,(a&n.childLanes)===0)if(t!==null){if(Hi(t,n,a,!1),(a&n.childLanes)===0)return null}else return null;if(t!==null&&n.child!==t.child)throw Error(s(153));if(n.child!==null){for(t=n.child,a=Wn(t,t.pendingProps),n.child=a,a.return=n;t.sibling!==null;)t=t.sibling,a=a.sibling=Wn(t,t.pendingProps),a.return=n;a.sibling=null}return n.child}function Lu(t,n){return(t.lanes&n)!==0?!0:(t=t.dependencies,!!(t!==null&&Bs(t)))}function Lx(t,n,a){switch(n.tag){case 3:me(n,n.stateNode.containerInfo),Rr(n,Ct,t.memoizedState.cache),ti();break;case 27:case 5:fe(n);break;case 4:me(n,n.stateNode.containerInfo);break;case 10:Rr(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,lu(n),null;break;case 13:var l=n.memoizedState;if(l!==null)return l.dehydrated!==null?(Nr(n),n.flags|=128,null):(a&n.child.childLanes)!==0?om(t,n,a):(Nr(n),t=ar(t,n,a),t!==null?t.sibling:null);Nr(n);break;case 19:var f=(t.flags&128)!==0;if(l=(a&n.childLanes)!==0,l||(Hi(t,n,a,!1),l=(a&n.childLanes)!==0),f){if(l)return cm(t,n,a);n.flags|=128}if(f=n.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),C(xt,xt.current),l)break;return null;case 22:return n.lanes=0,nm(t,n,a,n.pendingProps);case 24:Rr(n,Ct,t.memoizedState.cache)}return ar(t,n,a)}function dm(t,n,a){if(t!==null)if(t.memoizedProps!==n.pendingProps)jt=!0;else{if(!Lu(t,a)&&(n.flags&128)===0)return jt=!1,Lx(t,n,a);jt=(t.flags&131072)!==0}else jt=!1,Pe&&(n.flags&1048576)!==0&&Gf(n,Ea,n.index);switch(n.lanes=0,n.tag){case 16:e:{var l=n.pendingProps;if(t=ai(n.elementType),n.type=t,typeof t=="function")qo(t)?(l=ui(t,l),n.tag=1,n=sm(null,n,t,l,a)):(n.tag=0,n=Nu(null,n,t,l,a));else{if(t!=null){var f=t.$$typeof;if(f===F){n.tag=11,n=Wh(null,n,t,l,a);break e}else if(f===P){n.tag=14,n=em(null,n,t,l,a);break e}}throw n=q(t)||t,Error(s(306,n,""))}}return n;case 0:return Nu(t,n,n.type,n.pendingProps,a);case 1:return l=n.type,f=ui(l,n.pendingProps),sm(t,n,l,f,a);case 3:e:{if(me(n,n.stateNode.containerInfo),t===null)throw Error(s(387));l=n.pendingProps;var m=n.memoizedState;f=m.element,nu(t,n),La(n,l,null,a);var x=n.memoizedState;if(l=x.cache,Rr(n,Ct,l),l!==m.cache&&Qo(n,[Ct],a,!0),_a(),l=x.element,m.isDehydrated)if(m={element:l,isDehydrated:!1,cache:x.cache},n.updateQueue.baseState=m,n.memoizedState=m,n.flags&256){n=lm(t,n,l,a);break e}else if(l!==f){f=Tn(Error(s(424)),n),Na(f),n=lm(t,n,l,a);break e}else for(t=n.stateNode.containerInfo,t.nodeType===9?t=t.body:t=t.nodeName==="HTML"?t.ownerDocument.body:t,dt=Dn(t.firstChild),Ht=n,Pe=!0,wr=null,In=!0,a=nh(n,null,l,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(ti(),l===f){n=ar(t,n,a);break e}qt(t,n,l,a)}n=n.child}return n;case 26:return rl(t,n),t===null?(a=kp(n.type,null,n.pendingProps,null))?n.memoizedState=a:Pe||(a=n.type,t=n.pendingProps,l=xl(Q.current).createElement(a),l[Bt]=n,l[en]=t,$t(l,a,t),Lt(l),n.stateNode=l):n.memoizedState=kp(n.type,t.memoizedProps,n.pendingProps,t.memoizedState),null;case 27:return fe(n),t===null&&Pe&&(l=n.stateNode=bp(n.type,n.pendingProps,Q.current),Ht=n,In=!0,f=dt,Br(n.type)?(pc=f,dt=Dn(l.firstChild)):dt=f),qt(t,n,n.pendingProps.children,a),rl(t,n),t===null&&(n.flags|=4194304),n.child;case 5:return t===null&&Pe&&((f=l=dt)&&(l=fS(l,n.type,n.pendingProps,In),l!==null?(n.stateNode=l,Ht=n,dt=Dn(l.firstChild),In=!1,f=!0):f=!1),f||Cr(n)),fe(n),f=n.type,m=n.pendingProps,x=t!==null?t.memoizedProps:null,l=m.children,cc(f,m)?l=null:x!==null&&cc(f,x)&&(n.flags|=32),n.memoizedState!==null&&(f=uu(t,n,Tx,null,null,a),ns._currentValue=f),rl(t,n),qt(t,n,l,a),n.child;case 6:return t===null&&Pe&&((t=a=dt)&&(a=hS(a,n.pendingProps,In),a!==null?(n.stateNode=a,Ht=n,dt=null,t=!0):t=!1),t||Cr(n)),null;case 13:return om(t,n,a);case 4:return me(n,n.stateNode.containerInfo),l=n.pendingProps,t===null?n.child=li(n,null,l,a):qt(t,n,l,a),n.child;case 11:return Wh(t,n,n.type,n.pendingProps,a);case 7:return qt(t,n,n.pendingProps,a),n.child;case 8:return qt(t,n,n.pendingProps.children,a),n.child;case 12:return qt(t,n,n.pendingProps.children,a),n.child;case 10:return l=n.pendingProps,Rr(n,n.type,l.value),qt(t,n,l.children,a),n.child;case 9:return f=n.type._context,l=n.pendingProps.children,ri(n),f=Ut(f),l=l(f),n.flags|=1,qt(t,n,l,a),n.child;case 14:return em(t,n,n.type,n.pendingProps,a);case 15:return tm(t,n,n.type,n.pendingProps,a);case 19:return cm(t,n,a);case 31:return _x(t,n,a);case 22:return nm(t,n,a,n.pendingProps);case 24:return ri(n),l=Ut(Ct),t===null?(f=Wo(),f===null&&(f=st,m=Zo(),f.pooledCache=m,m.refCount++,m!==null&&(f.pooledCacheLanes|=a),f=m),n.memoizedState={parent:l,cache:f},tu(n),Rr(n,Ct,f)):((t.lanes&a)!==0&&(nu(t,n),La(n,null,null,a),_a()),f=t.memoizedState,m=n.memoizedState,f.parent!==l?(f={parent:l,cache:l},n.memoizedState=f,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=f),Rr(n,Ct,l)):(l=m.cache,Rr(n,Ct,l),l!==f.cache&&Qo(n,[Ct],a,!0))),qt(t,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(s(156,n.tag))}function sr(t){t.flags|=4}function zu(t,n,a,l,f){if((n=(t.mode&32)!==0)&&(n=!1),n){if(t.flags|=16777216,(f&335544128)===f)if(t.stateNode.complete)t.flags|=8192;else if(Bm())t.flags|=8192;else throw si=$s,eu}else t.flags&=-16777217}function fm(t,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!Tp(n))if(Bm())t.flags|=8192;else throw si=$s,eu}function al(t,n){n!==null&&(t.flags|=4),t.flags&16384&&(n=t.tag!==22?gt():536870912,t.lanes|=n,Zi|=n)}function $a(t,n){if(!Pe)switch(t.tailMode){case"hidden":n=t.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?t.tail=null:a.sibling=null;break;case"collapsed":a=t.tail;for(var l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?n||t.tail===null?t.tail=null:t.tail.sibling=null:l.sibling=null}}function ft(t){var n=t.alternate!==null&&t.alternate.child===t.child,a=0,l=0;if(n)for(var f=t.child;f!==null;)a|=f.lanes|f.childLanes,l|=f.subtreeFlags&65011712,l|=f.flags&65011712,f.return=t,f=f.sibling;else for(f=t.child;f!==null;)a|=f.lanes|f.childLanes,l|=f.subtreeFlags,l|=f.flags,f.return=t,f=f.sibling;return t.subtreeFlags|=l,t.childLanes=a,n}function zx(t,n,a){var l=n.pendingProps;switch(Po(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ft(n),null;case 1:return ft(n),null;case 3:return a=n.stateNode,l=null,t!==null&&(l=t.memoizedState.cache),n.memoizedState.cache!==l&&(n.flags|=2048),nr(Ct),ge(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(t===null||t.child===null)&&(Bi(n)?sr(n):t===null||t.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Yo())),ft(n),null;case 26:var f=n.type,m=n.memoizedState;return t===null?(sr(n),m!==null?(ft(n),fm(n,m)):(ft(n),zu(n,f,null,l,a))):m?m!==t.memoizedState?(sr(n),ft(n),fm(n,m)):(ft(n),n.flags&=-16777217):(t=t.memoizedProps,t!==l&&sr(n),ft(n),zu(n,f,t,l,a)),null;case 27:if(Se(n),a=Q.current,f=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==l&&sr(n);else{if(!l){if(n.stateNode===null)throw Error(s(166));return ft(n),null}t=ae.current,Bi(n)?Pf(n):(t=bp(f,l,a),n.stateNode=t,sr(n))}return ft(n),null;case 5:if(Se(n),f=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==l&&sr(n);else{if(!l){if(n.stateNode===null)throw Error(s(166));return ft(n),null}if(m=ae.current,Bi(n))Pf(n);else{var x=xl(Q.current);switch(m){case 1:m=x.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:m=x.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":m=x.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":m=x.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":m=x.createElement("div"),m.innerHTML="<script><\/script>",m=m.removeChild(m.firstChild);break;case"select":m=typeof l.is=="string"?x.createElement("select",{is:l.is}):x.createElement("select"),l.multiple?m.multiple=!0:l.size&&(m.size=l.size);break;default:m=typeof l.is=="string"?x.createElement(f,{is:l.is}):x.createElement(f)}}m[Bt]=n,m[en]=l;e:for(x=n.child;x!==null;){if(x.tag===5||x.tag===6)m.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===n)break e;for(;x.sibling===null;){if(x.return===null||x.return===n)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}n.stateNode=m;e:switch($t(m,f,l),f){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&sr(n)}}return ft(n),zu(n,n.type,t===null?null:t.memoizedProps,n.pendingProps,a),null;case 6:if(t&&n.stateNode!=null)t.memoizedProps!==l&&sr(n);else{if(typeof l!="string"&&n.stateNode===null)throw Error(s(166));if(t=Q.current,Bi(n)){if(t=n.stateNode,a=n.memoizedProps,l=null,f=Ht,f!==null)switch(f.tag){case 27:case 5:l=f.memoizedProps}t[Bt]=n,t=!!(t.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||op(t.nodeValue,a)),t||Cr(n,!0)}else t=xl(t).createTextNode(l),t[Bt]=n,n.stateNode=t}return ft(n),null;case 31:if(a=n.memoizedState,t===null||t.memoizedState!==null){if(l=Bi(n),a!==null){if(t===null){if(!l)throw Error(s(318));if(t=n.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(557));t[Bt]=n}else ti(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;ft(n),t=!1}else a=Yo(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=a),t=!0;if(!t)return n.flags&256?(yn(n),n):(yn(n),null);if((n.flags&128)!==0)throw Error(s(558))}return ft(n),null;case 13:if(l=n.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(f=Bi(n),l!==null&&l.dehydrated!==null){if(t===null){if(!f)throw Error(s(318));if(f=n.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(s(317));f[Bt]=n}else ti(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;ft(n),f=!1}else f=Yo(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=f),f=!0;if(!f)return n.flags&256?(yn(n),n):(yn(n),null)}return yn(n),(n.flags&128)!==0?(n.lanes=a,n):(a=l!==null,t=t!==null&&t.memoizedState!==null,a&&(l=n.child,f=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(f=l.alternate.memoizedState.cachePool.pool),m=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(m=l.memoizedState.cachePool.pool),m!==f&&(l.flags|=2048)),a!==t&&a&&(n.child.flags|=8192),al(n,n.updateQueue),ft(n),null);case 4:return ge(),t===null&&ac(n.stateNode.containerInfo),ft(n),null;case 10:return nr(n.type),ft(n),null;case 19:if(U(xt),l=n.memoizedState,l===null)return ft(n),null;if(f=(n.flags&128)!==0,m=l.rendering,m===null)if(f)$a(l,!1);else{if(vt!==0||t!==null&&(t.flags&128)!==0)for(t=n.child;t!==null;){if(m=Vs(t),m!==null){for(n.flags|=128,$a(l,!1),t=m.updateQueue,n.updateQueue=t,al(n,t),n.subtreeFlags=0,t=a,a=n.child;a!==null;)Uf(a,t),a=a.sibling;return C(xt,xt.current&1|2),Pe&&er(n,l.treeForkCount),n.child}t=t.sibling}l.tail!==null&&qe()>cl&&(n.flags|=128,f=!0,$a(l,!1),n.lanes=4194304)}else{if(!f)if(t=Vs(m),t!==null){if(n.flags|=128,f=!0,t=t.updateQueue,n.updateQueue=t,al(n,t),$a(l,!0),l.tail===null&&l.tailMode==="hidden"&&!m.alternate&&!Pe)return ft(n),null}else 2*qe()-l.renderingStartTime>cl&&a!==536870912&&(n.flags|=128,f=!0,$a(l,!1),n.lanes=4194304);l.isBackwards?(m.sibling=n.child,n.child=m):(t=l.last,t!==null?t.sibling=m:n.child=m,l.last=m)}return l.tail!==null?(t=l.tail,l.rendering=t,l.tail=t.sibling,l.renderingStartTime=qe(),t.sibling=null,a=xt.current,C(xt,f?a&1|2:a&1),Pe&&er(n,l.treeForkCount),t):(ft(n),null);case 22:case 23:return yn(n),su(),l=n.memoizedState!==null,t!==null?t.memoizedState!==null!==l&&(n.flags|=8192):l&&(n.flags|=8192),l?(a&536870912)!==0&&(n.flags&128)===0&&(ft(n),n.subtreeFlags&6&&(n.flags|=8192)):ft(n),a=n.updateQueue,a!==null&&al(n,a.retryQueue),a=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),l=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(l=n.memoizedState.cachePool.pool),l!==a&&(n.flags|=2048),t!==null&&U(ii),null;case 24:return a=null,t!==null&&(a=t.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),nr(Ct),ft(n),null;case 25:return null;case 30:return null}throw Error(s(156,n.tag))}function Bx(t,n){switch(Po(n),n.tag){case 1:return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return nr(Ct),ge(),t=n.flags,(t&65536)!==0&&(t&128)===0?(n.flags=t&-65537|128,n):null;case 26:case 27:case 5:return Se(n),null;case 31:if(n.memoizedState!==null){if(yn(n),n.alternate===null)throw Error(s(340));ti()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 13:if(yn(n),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(s(340));ti()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return U(xt),null;case 4:return ge(),null;case 10:return nr(n.type),null;case 22:case 23:return yn(n),su(),t!==null&&U(ii),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 24:return nr(Ct),null;case 25:return null;default:return null}}function hm(t,n){switch(Po(n),n.tag){case 3:nr(Ct),ge();break;case 26:case 27:case 5:Se(n);break;case 4:ge();break;case 31:n.memoizedState!==null&&yn(n);break;case 13:yn(n);break;case 19:U(xt);break;case 10:nr(n.type);break;case 22:case 23:yn(n),su(),t!==null&&U(ii);break;case 24:nr(Ct)}}function Ga(t,n){try{var a=n.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var f=l.next;a=f;do{if((a.tag&t)===t){l=void 0;var m=a.create,x=a.inst;l=m(),x.destroy=l}a=a.next}while(a!==f)}}catch(j){nt(n,n.return,j)}}function Ar(t,n,a){try{var l=n.updateQueue,f=l!==null?l.lastEffect:null;if(f!==null){var m=f.next;l=m;do{if((l.tag&t)===t){var x=l.inst,j=x.destroy;if(j!==void 0){x.destroy=void 0,f=n;var L=a,J=j;try{J()}catch(oe){nt(f,L,oe)}}}l=l.next}while(l!==m)}}catch(oe){nt(n,n.return,oe)}}function mm(t){var n=t.updateQueue;if(n!==null){var a=t.stateNode;try{ih(n,a)}catch(l){nt(t,t.return,l)}}}function pm(t,n,a){a.props=ui(t.type,t.memoizedProps),a.state=t.memoizedState;try{a.componentWillUnmount()}catch(l){nt(t,n,l)}}function Fa(t,n){try{var a=t.ref;if(a!==null){switch(t.tag){case 26:case 27:case 5:var l=t.stateNode;break;case 30:l=t.stateNode;break;default:l=t.stateNode}typeof a=="function"?t.refCleanup=a(l):a.current=l}}catch(f){nt(t,n,f)}}function Gn(t,n){var a=t.ref,l=t.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(f){nt(t,n,f)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(f){nt(t,n,f)}else a.current=null}function gm(t){var n=t.type,a=t.memoizedProps,l=t.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&l.focus();break e;case"img":a.src?l.src=a.src:a.srcSet&&(l.srcset=a.srcSet)}}catch(f){nt(t,t.return,f)}}function Bu(t,n,a){try{var l=t.stateNode;sS(l,t.type,a,n),l[en]=n}catch(f){nt(t,t.return,f)}}function ym(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Br(t.type)||t.tag===4}function Hu(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||ym(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&Br(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Uu(t,n,a){var l=t.tag;if(l===5||l===6)t=t.stateNode,n?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(t,n):(n=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,n.appendChild(t),a=a._reactRootContainer,a!=null||n.onclick!==null||(n.onclick=Zn));else if(l!==4&&(l===27&&Br(t.type)&&(a=t.stateNode,n=null),t=t.child,t!==null))for(Uu(t,n,a),t=t.sibling;t!==null;)Uu(t,n,a),t=t.sibling}function sl(t,n,a){var l=t.tag;if(l===5||l===6)t=t.stateNode,n?a.insertBefore(t,n):a.appendChild(t);else if(l!==4&&(l===27&&Br(t.type)&&(a=t.stateNode),t=t.child,t!==null))for(sl(t,n,a),t=t.sibling;t!==null;)sl(t,n,a),t=t.sibling}function vm(t){var n=t.stateNode,a=t.memoizedProps;try{for(var l=t.type,f=n.attributes;f.length;)n.removeAttributeNode(f[0]);$t(n,l,a),n[Bt]=t,n[en]=a}catch(m){nt(t,t.return,m)}}var lr=!1,Tt=!1,qu=!1,bm=typeof WeakSet=="function"?WeakSet:Set,zt=null;function Hx(t,n){if(t=t.containerInfo,oc=Tl,t=Af(t),Mo(t)){if("selectionStart"in t)var a={start:t.selectionStart,end:t.selectionEnd};else e:{a=(a=t.ownerDocument)&&a.defaultView||window;var l=a.getSelection&&a.getSelection();if(l&&l.rangeCount!==0){a=l.anchorNode;var f=l.anchorOffset,m=l.focusNode;l=l.focusOffset;try{a.nodeType,m.nodeType}catch{a=null;break e}var x=0,j=-1,L=-1,J=0,oe=0,de=t,ee=null;t:for(;;){for(var ie;de!==a||f!==0&&de.nodeType!==3||(j=x+f),de!==m||l!==0&&de.nodeType!==3||(L=x+l),de.nodeType===3&&(x+=de.nodeValue.length),(ie=de.firstChild)!==null;)ee=de,de=ie;for(;;){if(de===t)break t;if(ee===a&&++J===f&&(j=x),ee===m&&++oe===l&&(L=x),(ie=de.nextSibling)!==null)break;de=ee,ee=de.parentNode}de=ie}a=j===-1||L===-1?null:{start:j,end:L}}else a=null}a=a||{start:0,end:0}}else a=null;for(uc={focusedElem:t,selectionRange:a},Tl=!1,zt=n;zt!==null;)if(n=zt,t=n.child,(n.subtreeFlags&1028)!==0&&t!==null)t.return=n,zt=t;else for(;zt!==null;){switch(n=zt,m=n.alternate,t=n.flags,n.tag){case 0:if((t&4)!==0&&(t=n.updateQueue,t=t!==null?t.events:null,t!==null))for(a=0;a<t.length;a++)f=t[a],f.ref.impl=f.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&m!==null){t=void 0,a=n,f=m.memoizedProps,m=m.memoizedState,l=a.stateNode;try{var ye=ui(a.type,f);t=l.getSnapshotBeforeUpdate(ye,m),l.__reactInternalSnapshotBeforeUpdate=t}catch(Re){nt(a,a.return,Re)}}break;case 3:if((t&1024)!==0){if(t=n.stateNode.containerInfo,a=t.nodeType,a===9)fc(t);else if(a===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":fc(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(s(163))}if(t=n.sibling,t!==null){t.return=n.return,zt=t;break}zt=n.return}}function xm(t,n,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:ur(t,a),l&4&&Ga(5,a);break;case 1:if(ur(t,a),l&4)if(t=a.stateNode,n===null)try{t.componentDidMount()}catch(x){nt(a,a.return,x)}else{var f=ui(a.type,n.memoizedProps);n=n.memoizedState;try{t.componentDidUpdate(f,n,t.__reactInternalSnapshotBeforeUpdate)}catch(x){nt(a,a.return,x)}}l&64&&mm(a),l&512&&Fa(a,a.return);break;case 3:if(ur(t,a),l&64&&(t=a.updateQueue,t!==null)){if(n=null,a.child!==null)switch(a.child.tag){case 27:case 5:n=a.child.stateNode;break;case 1:n=a.child.stateNode}try{ih(t,n)}catch(x){nt(a,a.return,x)}}break;case 27:n===null&&l&4&&vm(a);case 26:case 5:ur(t,a),n===null&&l&4&&gm(a),l&512&&Fa(a,a.return);break;case 12:ur(t,a);break;case 31:ur(t,a),l&4&&wm(t,a);break;case 13:ur(t,a),l&4&&Cm(t,a),l&64&&(t=a.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(a=Kx.bind(null,a),mS(t,a))));break;case 22:if(l=a.memoizedState!==null||lr,!l){n=n!==null&&n.memoizedState!==null||Tt,f=lr;var m=Tt;lr=l,(Tt=n)&&!m?cr(t,a,(a.subtreeFlags&8772)!==0):ur(t,a),lr=f,Tt=m}break;case 30:break;default:ur(t,a)}}function Sm(t){var n=t.alternate;n!==null&&(t.alternate=null,Sm(n)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(n=t.stateNode,n!==null&&yo(n)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var ht=null,nn=!1;function or(t,n,a){for(a=a.child;a!==null;)km(t,n,a),a=a.sibling}function km(t,n,a){if(Le&&typeof Le.onCommitFiberUnmount=="function")try{Le.onCommitFiberUnmount(mt,a)}catch{}switch(a.tag){case 26:Tt||Gn(a,n),or(t,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Tt||Gn(a,n);var l=ht,f=nn;Br(a.type)&&(ht=a.stateNode,nn=!1),or(t,n,a),Wa(a.stateNode),ht=l,nn=f;break;case 5:Tt||Gn(a,n);case 6:if(l=ht,f=nn,ht=null,or(t,n,a),ht=l,nn=f,ht!==null)if(nn)try{(ht.nodeType===9?ht.body:ht.nodeName==="HTML"?ht.ownerDocument.body:ht).removeChild(a.stateNode)}catch(m){nt(a,n,m)}else try{ht.removeChild(a.stateNode)}catch(m){nt(a,n,m)}break;case 18:ht!==null&&(nn?(t=ht,mp(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,a.stateNode),aa(t)):mp(ht,a.stateNode));break;case 4:l=ht,f=nn,ht=a.stateNode.containerInfo,nn=!0,or(t,n,a),ht=l,nn=f;break;case 0:case 11:case 14:case 15:Ar(2,a,n),Tt||Ar(4,a,n),or(t,n,a);break;case 1:Tt||(Gn(a,n),l=a.stateNode,typeof l.componentWillUnmount=="function"&&pm(a,n,l)),or(t,n,a);break;case 21:or(t,n,a);break;case 22:Tt=(l=Tt)||a.memoizedState!==null,or(t,n,a),Tt=l;break;default:or(t,n,a)}}function wm(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{aa(t)}catch(a){nt(n,n.return,a)}}}function Cm(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{aa(t)}catch(a){nt(n,n.return,a)}}function Ux(t){switch(t.tag){case 31:case 13:case 19:var n=t.stateNode;return n===null&&(n=t.stateNode=new bm),n;case 22:return t=t.stateNode,n=t._retryCache,n===null&&(n=t._retryCache=new bm),n;default:throw Error(s(435,t.tag))}}function ll(t,n){var a=Ux(t);n.forEach(function(l){if(!a.has(l)){a.add(l);var f=Xx.bind(null,t,l);l.then(f,f)}})}function rn(t,n){var a=n.deletions;if(a!==null)for(var l=0;l<a.length;l++){var f=a[l],m=t,x=n,j=x;e:for(;j!==null;){switch(j.tag){case 27:if(Br(j.type)){ht=j.stateNode,nn=!1;break e}break;case 5:ht=j.stateNode,nn=!1;break e;case 3:case 4:ht=j.stateNode.containerInfo,nn=!0;break e}j=j.return}if(ht===null)throw Error(s(160));km(m,x,f),ht=null,nn=!1,m=f.alternate,m!==null&&(m.return=null),f.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Rm(n,t),n=n.sibling}var Ln=null;function Rm(t,n){var a=t.alternate,l=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:rn(n,t),an(t),l&4&&(Ar(3,t,t.return),Ga(3,t),Ar(5,t,t.return));break;case 1:rn(n,t),an(t),l&512&&(Tt||a===null||Gn(a,a.return)),l&64&&lr&&(t=t.updateQueue,t!==null&&(l=t.callbacks,l!==null&&(a=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=a===null?l:a.concat(l))));break;case 26:var f=Ln;if(rn(n,t),an(t),l&512&&(Tt||a===null||Gn(a,a.return)),l&4){var m=a!==null?a.memoizedState:null;if(l=t.memoizedState,a===null)if(l===null)if(t.stateNode===null){e:{l=t.type,a=t.memoizedProps,f=f.ownerDocument||f;t:switch(l){case"title":m=f.getElementsByTagName("title")[0],(!m||m[ya]||m[Bt]||m.namespaceURI==="http://www.w3.org/2000/svg"||m.hasAttribute("itemprop"))&&(m=f.createElement(l),f.head.insertBefore(m,f.querySelector("head > title"))),$t(m,l,a),m[Bt]=t,Lt(m),l=m;break e;case"link":var x=Rp("link","href",f).get(l+(a.href||""));if(x){for(var j=0;j<x.length;j++)if(m=x[j],m.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&m.getAttribute("rel")===(a.rel==null?null:a.rel)&&m.getAttribute("title")===(a.title==null?null:a.title)&&m.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){x.splice(j,1);break t}}m=f.createElement(l),$t(m,l,a),f.head.appendChild(m);break;case"meta":if(x=Rp("meta","content",f).get(l+(a.content||""))){for(j=0;j<x.length;j++)if(m=x[j],m.getAttribute("content")===(a.content==null?null:""+a.content)&&m.getAttribute("name")===(a.name==null?null:a.name)&&m.getAttribute("property")===(a.property==null?null:a.property)&&m.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&m.getAttribute("charset")===(a.charSet==null?null:a.charSet)){x.splice(j,1);break t}}m=f.createElement(l),$t(m,l,a),f.head.appendChild(m);break;default:throw Error(s(468,l))}m[Bt]=t,Lt(m),l=m}t.stateNode=l}else jp(f,t.type,t.stateNode);else t.stateNode=Cp(f,l,t.memoizedProps);else m!==l?(m===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):m.count--,l===null?jp(f,t.type,t.stateNode):Cp(f,l,t.memoizedProps)):l===null&&t.stateNode!==null&&Bu(t,t.memoizedProps,a.memoizedProps)}break;case 27:rn(n,t),an(t),l&512&&(Tt||a===null||Gn(a,a.return)),a!==null&&l&4&&Bu(t,t.memoizedProps,a.memoizedProps);break;case 5:if(rn(n,t),an(t),l&512&&(Tt||a===null||Gn(a,a.return)),t.flags&32){f=t.stateNode;try{Ei(f,"")}catch(ye){nt(t,t.return,ye)}}l&4&&t.stateNode!=null&&(f=t.memoizedProps,Bu(t,f,a!==null?a.memoizedProps:f)),l&1024&&(qu=!0);break;case 6:if(rn(n,t),an(t),l&4){if(t.stateNode===null)throw Error(s(162));l=t.memoizedProps,a=t.stateNode;try{a.nodeValue=l}catch(ye){nt(t,t.return,ye)}}break;case 3:if(wl=null,f=Ln,Ln=Sl(n.containerInfo),rn(n,t),Ln=f,an(t),l&4&&a!==null&&a.memoizedState.isDehydrated)try{aa(n.containerInfo)}catch(ye){nt(t,t.return,ye)}qu&&(qu=!1,jm(t));break;case 4:l=Ln,Ln=Sl(t.stateNode.containerInfo),rn(n,t),an(t),Ln=l;break;case 12:rn(n,t),an(t);break;case 31:rn(n,t),an(t),l&4&&(l=t.updateQueue,l!==null&&(t.updateQueue=null,ll(t,l)));break;case 13:rn(n,t),an(t),t.child.flags&8192&&t.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(ul=qe()),l&4&&(l=t.updateQueue,l!==null&&(t.updateQueue=null,ll(t,l)));break;case 22:f=t.memoizedState!==null;var L=a!==null&&a.memoizedState!==null,J=lr,oe=Tt;if(lr=J||f,Tt=oe||L,rn(n,t),Tt=oe,lr=J,an(t),l&8192)e:for(n=t.stateNode,n._visibility=f?n._visibility&-2:n._visibility|1,f&&(a===null||L||lr||Tt||ci(t)),a=null,n=t;;){if(n.tag===5||n.tag===26){if(a===null){L=a=n;try{if(m=L.stateNode,f)x=m.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{j=L.stateNode;var de=L.memoizedProps.style,ee=de!=null&&de.hasOwnProperty("display")?de.display:null;j.style.display=ee==null||typeof ee=="boolean"?"":(""+ee).trim()}}catch(ye){nt(L,L.return,ye)}}}else if(n.tag===6){if(a===null){L=n;try{L.stateNode.nodeValue=f?"":L.memoizedProps}catch(ye){nt(L,L.return,ye)}}}else if(n.tag===18){if(a===null){L=n;try{var ie=L.stateNode;f?pp(ie,!0):pp(L.stateNode,!1)}catch(ye){nt(L,L.return,ye)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===t)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break e;for(;n.sibling===null;){if(n.return===null||n.return===t)break e;a===n&&(a=null),n=n.return}a===n&&(a=null),n.sibling.return=n.return,n=n.sibling}l&4&&(l=t.updateQueue,l!==null&&(a=l.retryQueue,a!==null&&(l.retryQueue=null,ll(t,a))));break;case 19:rn(n,t),an(t),l&4&&(l=t.updateQueue,l!==null&&(t.updateQueue=null,ll(t,l)));break;case 30:break;case 21:break;default:rn(n,t),an(t)}}function an(t){var n=t.flags;if(n&2){try{for(var a,l=t.return;l!==null;){if(ym(l)){a=l;break}l=l.return}if(a==null)throw Error(s(160));switch(a.tag){case 27:var f=a.stateNode,m=Hu(t);sl(t,m,f);break;case 5:var x=a.stateNode;a.flags&32&&(Ei(x,""),a.flags&=-33);var j=Hu(t);sl(t,j,x);break;case 3:case 4:var L=a.stateNode.containerInfo,J=Hu(t);Uu(t,J,L);break;default:throw Error(s(161))}}catch(oe){nt(t,t.return,oe)}t.flags&=-3}n&4096&&(t.flags&=-4097)}function jm(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var n=t;jm(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),t=t.sibling}}function ur(t,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)xm(t,n.alternate,n),n=n.sibling}function ci(t){for(t=t.child;t!==null;){var n=t;switch(n.tag){case 0:case 11:case 14:case 15:Ar(4,n,n.return),ci(n);break;case 1:Gn(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&pm(n,n.return,a),ci(n);break;case 27:Wa(n.stateNode);case 26:case 5:Gn(n,n.return),ci(n);break;case 22:n.memoizedState===null&&ci(n);break;case 30:ci(n);break;default:ci(n)}t=t.sibling}}function cr(t,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var l=n.alternate,f=t,m=n,x=m.flags;switch(m.tag){case 0:case 11:case 15:cr(f,m,a),Ga(4,m);break;case 1:if(cr(f,m,a),l=m,f=l.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(J){nt(l,l.return,J)}if(l=m,f=l.updateQueue,f!==null){var j=l.stateNode;try{var L=f.shared.hiddenCallbacks;if(L!==null)for(f.shared.hiddenCallbacks=null,f=0;f<L.length;f++)rh(L[f],j)}catch(J){nt(l,l.return,J)}}a&&x&64&&mm(m),Fa(m,m.return);break;case 27:vm(m);case 26:case 5:cr(f,m,a),a&&l===null&&x&4&&gm(m),Fa(m,m.return);break;case 12:cr(f,m,a);break;case 31:cr(f,m,a),a&&x&4&&wm(f,m);break;case 13:cr(f,m,a),a&&x&4&&Cm(f,m);break;case 22:m.memoizedState===null&&cr(f,m,a),Fa(m,m.return);break;case 30:break;default:cr(f,m,a)}n=n.sibling}}function $u(t,n){var a=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),t=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(t=n.memoizedState.cachePool.pool),t!==a&&(t!=null&&t.refCount++,a!=null&&Ia(a))}function Gu(t,n){t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&Ia(t))}function zn(t,n,a,l){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Tm(t,n,a,l),n=n.sibling}function Tm(t,n,a,l){var f=n.flags;switch(n.tag){case 0:case 11:case 15:zn(t,n,a,l),f&2048&&Ga(9,n);break;case 1:zn(t,n,a,l);break;case 3:zn(t,n,a,l),f&2048&&(t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&Ia(t)));break;case 12:if(f&2048){zn(t,n,a,l),t=n.stateNode;try{var m=n.memoizedProps,x=m.id,j=m.onPostCommit;typeof j=="function"&&j(x,n.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(L){nt(n,n.return,L)}}else zn(t,n,a,l);break;case 31:zn(t,n,a,l);break;case 13:zn(t,n,a,l);break;case 23:break;case 22:m=n.stateNode,x=n.alternate,n.memoizedState!==null?m._visibility&2?zn(t,n,a,l):Pa(t,n):m._visibility&2?zn(t,n,a,l):(m._visibility|=2,Ki(t,n,a,l,(n.subtreeFlags&10256)!==0||!1)),f&2048&&$u(x,n);break;case 24:zn(t,n,a,l),f&2048&&Gu(n.alternate,n);break;default:zn(t,n,a,l)}}function Ki(t,n,a,l,f){for(f=f&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var m=t,x=n,j=a,L=l,J=x.flags;switch(x.tag){case 0:case 11:case 15:Ki(m,x,j,L,f),Ga(8,x);break;case 23:break;case 22:var oe=x.stateNode;x.memoizedState!==null?oe._visibility&2?Ki(m,x,j,L,f):Pa(m,x):(oe._visibility|=2,Ki(m,x,j,L,f)),f&&J&2048&&$u(x.alternate,x);break;case 24:Ki(m,x,j,L,f),f&&J&2048&&Gu(x.alternate,x);break;default:Ki(m,x,j,L,f)}n=n.sibling}}function Pa(t,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=t,l=n,f=l.flags;switch(l.tag){case 22:Pa(a,l),f&2048&&$u(l.alternate,l);break;case 24:Pa(a,l),f&2048&&Gu(l.alternate,l);break;default:Pa(a,l)}n=n.sibling}}var Va=8192;function Xi(t,n,a){if(t.subtreeFlags&Va)for(t=t.child;t!==null;)Em(t,n,a),t=t.sibling}function Em(t,n,a){switch(t.tag){case 26:Xi(t,n,a),t.flags&Va&&t.memoizedState!==null&&jS(a,Ln,t.memoizedState,t.memoizedProps);break;case 5:Xi(t,n,a);break;case 3:case 4:var l=Ln;Ln=Sl(t.stateNode.containerInfo),Xi(t,n,a),Ln=l;break;case 22:t.memoizedState===null&&(l=t.alternate,l!==null&&l.memoizedState!==null?(l=Va,Va=16777216,Xi(t,n,a),Va=l):Xi(t,n,a));break;default:Xi(t,n,a)}}function Nm(t){var n=t.alternate;if(n!==null&&(t=n.child,t!==null)){n.child=null;do n=t.sibling,t.sibling=null,t=n;while(t!==null)}}function Ya(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var l=n[a];zt=l,Am(l,t)}Nm(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Im(t),t=t.sibling}function Im(t){switch(t.tag){case 0:case 11:case 15:Ya(t),t.flags&2048&&Ar(9,t,t.return);break;case 3:Ya(t);break;case 12:Ya(t);break;case 22:var n=t.stateNode;t.memoizedState!==null&&n._visibility&2&&(t.return===null||t.return.tag!==13)?(n._visibility&=-3,ol(t)):Ya(t);break;default:Ya(t)}}function ol(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var l=n[a];zt=l,Am(l,t)}Nm(t)}for(t=t.child;t!==null;){switch(n=t,n.tag){case 0:case 11:case 15:Ar(8,n,n.return),ol(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,ol(n));break;default:ol(n)}t=t.sibling}}function Am(t,n){for(;zt!==null;){var a=zt;switch(a.tag){case 0:case 11:case 15:Ar(8,a,n);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var l=a.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:Ia(a.memoizedState.cache)}if(l=a.child,l!==null)l.return=a,zt=l;else e:for(a=t;zt!==null;){l=zt;var f=l.sibling,m=l.return;if(Sm(l),l===a){zt=null;break e}if(f!==null){f.return=m,zt=f;break e}zt=m}}}var qx={getCacheForType:function(t){var n=Ut(Ct),a=n.data.get(t);return a===void 0&&(a=t(),n.data.set(t,a)),a},cacheSignal:function(){return Ut(Ct).controller.signal}},$x=typeof WeakMap=="function"?WeakMap:Map,We=0,st=null,ze=null,Ge=0,tt=0,vn=null,Dr=!1,Qi=!1,Fu=!1,dr=0,vt=0,Or=0,di=0,Pu=0,bn=0,Zi=0,Ka=null,sn=null,Vu=!1,ul=0,Dm=0,cl=1/0,dl=null,Mr=null,Dt=0,_r=null,Ji=null,fr=0,Yu=0,Ku=null,Om=null,Xa=0,Xu=null;function xn(){return(We&2)!==0&&Ge!==0?Ge&-Ge:D.T!==null?tc():Kd()}function Mm(){if(bn===0)if((Ge&536870912)===0||Pe){var t=Ke;Ke<<=1,(Ke&3932160)===0&&(Ke=262144),bn=t}else bn=536870912;return t=gn.current,t!==null&&(t.flags|=32),bn}function ln(t,n,a){(t===st&&(tt===2||tt===9)||t.cancelPendingCommit!==null)&&(Wi(t,0),Lr(t,Ge,bn,!1)),_t(t,a),((We&2)===0||t!==st)&&(t===st&&((We&2)===0&&(di|=a),vt===4&&Lr(t,Ge,bn,!1)),Fn(t))}function _m(t,n,a){if((We&6)!==0)throw Error(s(327));var l=!a&&(n&127)===0&&(n&t.expiredLanes)===0||re(t,n),f=l?Px(t,n):Zu(t,n,!0),m=l;do{if(f===0){Qi&&!l&&Lr(t,n,0,!1);break}else{if(a=t.current.alternate,m&&!Gx(a)){f=Zu(t,n,!1),m=!1;continue}if(f===2){if(m=n,t.errorRecoveryDisabledLanes&m)var x=0;else x=t.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){n=x;e:{var j=t;f=Ka;var L=j.current.memoizedState.isDehydrated;if(L&&(Wi(j,x).flags|=256),x=Zu(j,x,!1),x!==2){if(Fu&&!L){j.errorRecoveryDisabledLanes|=m,di|=m,f=4;break e}m=sn,sn=f,m!==null&&(sn===null?sn=m:sn.push.apply(sn,m))}f=x}if(m=!1,f!==2)continue}}if(f===1){Wi(t,0),Lr(t,n,0,!0);break}e:{switch(l=t,m=f,m){case 0:case 1:throw Error(s(345));case 4:if((n&4194048)!==n)break;case 6:Lr(l,n,bn,!Dr);break e;case 2:sn=null;break;case 3:case 5:break;default:throw Error(s(329))}if((n&62914560)===n&&(f=ul+300-qe(),10<f)){if(Lr(l,n,bn,!Dr),Mt(l,0,!0)!==0)break e;fr=n,l.timeoutHandle=fp(Lm.bind(null,l,a,sn,dl,Vu,n,bn,di,Zi,Dr,m,"Throttled",-0,0),f);break e}Lm(l,a,sn,dl,Vu,n,bn,di,Zi,Dr,m,null,-0,0)}}break}while(!0);Fn(t)}function Lm(t,n,a,l,f,m,x,j,L,J,oe,de,ee,ie){if(t.timeoutHandle=-1,de=n.subtreeFlags,de&8192||(de&16785408)===16785408){de={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Zn},Em(n,m,de);var ye=(m&62914560)===m?ul-qe():(m&4194048)===m?Dm-qe():0;if(ye=TS(de,ye),ye!==null){fr=m,t.cancelPendingCommit=ye(Fm.bind(null,t,n,m,a,l,f,x,j,L,oe,de,null,ee,ie)),Lr(t,m,x,!J);return}}Fm(t,n,m,a,l,f,x,j,L)}function Gx(t){for(var n=t;;){var a=n.tag;if((a===0||a===11||a===15)&&n.flags&16384&&(a=n.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var l=0;l<a.length;l++){var f=a[l],m=f.getSnapshot;f=f.value;try{if(!mn(m(),f))return!1}catch{return!1}}if(a=n.child,n.subtreeFlags&16384&&a!==null)a.return=n,n=a;else{if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Lr(t,n,a,l){n&=~Pu,n&=~di,t.suspendedLanes|=n,t.pingedLanes&=~n,l&&(t.warmLanes|=n),l=t.expirationTimes;for(var f=n;0<f;){var m=31-$e(f),x=1<<m;l[m]=-1,f&=~x}a!==0&&Xt(t,a,n)}function fl(){return(We&6)===0?(Qa(0),!1):!0}function Qu(){if(ze!==null){if(tt===0)var t=ze.return;else t=ze,tr=ni=null,fu(t),Gi=null,Da=0,t=ze;for(;t!==null;)hm(t.alternate,t),t=t.return;ze=null}}function Wi(t,n){var a=t.timeoutHandle;a!==-1&&(t.timeoutHandle=-1,uS(a)),a=t.cancelPendingCommit,a!==null&&(t.cancelPendingCommit=null,a()),fr=0,Qu(),st=t,ze=a=Wn(t.current,null),Ge=n,tt=0,vn=null,Dr=!1,Qi=re(t,n),Fu=!1,Zi=bn=Pu=di=Or=vt=0,sn=Ka=null,Vu=!1,(n&8)!==0&&(n|=n&32);var l=t.entangledLanes;if(l!==0)for(t=t.entanglements,l&=n;0<l;){var f=31-$e(l),m=1<<f;n|=t[f],l&=~m}return dr=n,Os(),a}function zm(t,n){De=null,D.H=Ua,n===$i||n===qs?(n=Wf(),tt=3):n===eu?(n=Wf(),tt=4):tt=n===Eu?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,vn=n,ze===null&&(vt=1,tl(t,Tn(n,t.current)))}function Bm(){var t=gn.current;return t===null?!0:(Ge&4194048)===Ge?An===null:(Ge&62914560)===Ge||(Ge&536870912)!==0?t===An:!1}function Hm(){var t=D.H;return D.H=Ua,t===null?Ua:t}function Um(){var t=D.A;return D.A=qx,t}function hl(){vt=4,Dr||(Ge&4194048)!==Ge&&gn.current!==null||(Qi=!0),(Or&134217727)===0&&(di&134217727)===0||st===null||Lr(st,Ge,bn,!1)}function Zu(t,n,a){var l=We;We|=2;var f=Hm(),m=Um();(st!==t||Ge!==n)&&(dl=null,Wi(t,n)),n=!1;var x=vt;e:do try{if(tt!==0&&ze!==null){var j=ze,L=vn;switch(tt){case 8:Qu(),x=6;break e;case 3:case 2:case 9:case 6:gn.current===null&&(n=!0);var J=tt;if(tt=0,vn=null,ea(t,j,L,J),a&&Qi){x=0;break e}break;default:J=tt,tt=0,vn=null,ea(t,j,L,J)}}Fx(),x=vt;break}catch(oe){zm(t,oe)}while(!0);return n&&t.shellSuspendCounter++,tr=ni=null,We=l,D.H=f,D.A=m,ze===null&&(st=null,Ge=0,Os()),x}function Fx(){for(;ze!==null;)qm(ze)}function Px(t,n){var a=We;We|=2;var l=Hm(),f=Um();st!==t||Ge!==n?(dl=null,cl=qe()+500,Wi(t,n)):Qi=re(t,n);e:do try{if(tt!==0&&ze!==null){n=ze;var m=vn;t:switch(tt){case 1:tt=0,vn=null,ea(t,n,m,1);break;case 2:case 9:if(Zf(m)){tt=0,vn=null,$m(n);break}n=function(){tt!==2&&tt!==9||st!==t||(tt=7),Fn(t)},m.then(n,n);break e;case 3:tt=7;break e;case 4:tt=5;break e;case 7:Zf(m)?(tt=0,vn=null,$m(n)):(tt=0,vn=null,ea(t,n,m,7));break;case 5:var x=null;switch(ze.tag){case 26:x=ze.memoizedState;case 5:case 27:var j=ze;if(x?Tp(x):j.stateNode.complete){tt=0,vn=null;var L=j.sibling;if(L!==null)ze=L;else{var J=j.return;J!==null?(ze=J,ml(J)):ze=null}break t}}tt=0,vn=null,ea(t,n,m,5);break;case 6:tt=0,vn=null,ea(t,n,m,6);break;case 8:Qu(),vt=6;break e;default:throw Error(s(462))}}Vx();break}catch(oe){zm(t,oe)}while(!0);return tr=ni=null,D.H=l,D.A=f,We=a,ze!==null?0:(st=null,Ge=0,Os(),vt)}function Vx(){for(;ze!==null&&!Te();)qm(ze)}function qm(t){var n=dm(t.alternate,t,dr);t.memoizedProps=t.pendingProps,n===null?ml(t):ze=n}function $m(t){var n=t,a=n.alternate;switch(n.tag){case 15:case 0:n=am(a,n,n.pendingProps,n.type,void 0,Ge);break;case 11:n=am(a,n,n.pendingProps,n.type.render,n.ref,Ge);break;case 5:fu(n);default:hm(a,n),n=ze=Uf(n,dr),n=dm(a,n,dr)}t.memoizedProps=t.pendingProps,n===null?ml(t):ze=n}function ea(t,n,a,l){tr=ni=null,fu(n),Gi=null,Da=0;var f=n.return;try{if(Mx(t,f,n,a,Ge)){vt=1,tl(t,Tn(a,t.current)),ze=null;return}}catch(m){if(f!==null)throw ze=f,m;vt=1,tl(t,Tn(a,t.current)),ze=null;return}n.flags&32768?(Pe||l===1?t=!0:Qi||(Ge&536870912)!==0?t=!1:(Dr=t=!0,(l===2||l===9||l===3||l===6)&&(l=gn.current,l!==null&&l.tag===13&&(l.flags|=16384))),Gm(n,t)):ml(n)}function ml(t){var n=t;do{if((n.flags&32768)!==0){Gm(n,Dr);return}t=n.return;var a=zx(n.alternate,n,dr);if(a!==null){ze=a;return}if(n=n.sibling,n!==null){ze=n;return}ze=n=t}while(n!==null);vt===0&&(vt=5)}function Gm(t,n){do{var a=Bx(t.alternate,t);if(a!==null){a.flags&=32767,ze=a;return}if(a=t.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(t=t.sibling,t!==null)){ze=t;return}ze=t=a}while(t!==null);vt=6,ze=null}function Fm(t,n,a,l,f,m,x,j,L){t.cancelPendingCommit=null;do pl();while(Dt!==0);if((We&6)!==0)throw Error(s(327));if(n!==null){if(n===t.current)throw Error(s(177));if(m=n.lanes|n.childLanes,m|=Ho,fn(t,a,m,x,j,L),t===st&&(ze=st=null,Ge=0),Ji=n,_r=t,fr=a,Yu=m,Ku=f,Om=l,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,Qx(be,function(){return Xm(),null})):(t.callbackNode=null,t.callbackPriority=0),l=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||l){l=D.T,D.T=null,f=H.p,H.p=2,x=We,We|=4;try{Hx(t,n,a)}finally{We=x,H.p=f,D.T=l}}Dt=1,Pm(),Vm(),Ym()}}function Pm(){if(Dt===1){Dt=0;var t=_r,n=Ji,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=D.T,D.T=null;var l=H.p;H.p=2;var f=We;We|=4;try{Rm(n,t);var m=uc,x=Af(t.containerInfo),j=m.focusedElem,L=m.selectionRange;if(x!==j&&j&&j.ownerDocument&&If(j.ownerDocument.documentElement,j)){if(L!==null&&Mo(j)){var J=L.start,oe=L.end;if(oe===void 0&&(oe=J),"selectionStart"in j)j.selectionStart=J,j.selectionEnd=Math.min(oe,j.value.length);else{var de=j.ownerDocument||document,ee=de&&de.defaultView||window;if(ee.getSelection){var ie=ee.getSelection(),ye=j.textContent.length,Re=Math.min(L.start,ye),at=L.end===void 0?Re:Math.min(L.end,ye);!ie.extend&&Re>at&&(x=at,at=Re,Re=x);var X=Nf(j,Re),$=Nf(j,at);if(X&&$&&(ie.rangeCount!==1||ie.anchorNode!==X.node||ie.anchorOffset!==X.offset||ie.focusNode!==$.node||ie.focusOffset!==$.offset)){var Z=de.createRange();Z.setStart(X.node,X.offset),ie.removeAllRanges(),Re>at?(ie.addRange(Z),ie.extend($.node,$.offset)):(Z.setEnd($.node,$.offset),ie.addRange(Z))}}}}for(de=[],ie=j;ie=ie.parentNode;)ie.nodeType===1&&de.push({element:ie,left:ie.scrollLeft,top:ie.scrollTop});for(typeof j.focus=="function"&&j.focus(),j=0;j<de.length;j++){var ce=de[j];ce.element.scrollLeft=ce.left,ce.element.scrollTop=ce.top}}Tl=!!oc,uc=oc=null}finally{We=f,H.p=l,D.T=a}}t.current=n,Dt=2}}function Vm(){if(Dt===2){Dt=0;var t=_r,n=Ji,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=D.T,D.T=null;var l=H.p;H.p=2;var f=We;We|=4;try{xm(t,n.alternate,n)}finally{We=f,H.p=l,D.T=a}}Dt=3}}function Ym(){if(Dt===4||Dt===3){Dt=0,pt();var t=_r,n=Ji,a=fr,l=Om;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Dt=5:(Dt=0,Ji=_r=null,Km(t,t.pendingLanes));var f=t.pendingLanes;if(f===0&&(Mr=null),br(a),n=n.stateNode,Le&&typeof Le.onCommitFiberRoot=="function")try{Le.onCommitFiberRoot(mt,n,void 0,(n.current.flags&128)===128)}catch{}if(l!==null){n=D.T,f=H.p,H.p=2,D.T=null;try{for(var m=t.onRecoverableError,x=0;x<l.length;x++){var j=l[x];m(j.value,{componentStack:j.stack})}}finally{D.T=n,H.p=f}}(fr&3)!==0&&pl(),Fn(t),f=t.pendingLanes,(a&261930)!==0&&(f&42)!==0?t===Xu?Xa++:(Xa=0,Xu=t):Xa=0,Qa(0)}}function Km(t,n){(t.pooledCacheLanes&=n)===0&&(n=t.pooledCache,n!=null&&(t.pooledCache=null,Ia(n)))}function pl(){return Pm(),Vm(),Ym(),Xm()}function Xm(){if(Dt!==5)return!1;var t=_r,n=Yu;Yu=0;var a=br(fr),l=D.T,f=H.p;try{H.p=32>a?32:a,D.T=null,a=Ku,Ku=null;var m=_r,x=fr;if(Dt=0,Ji=_r=null,fr=0,(We&6)!==0)throw Error(s(331));var j=We;if(We|=4,Im(m.current),Tm(m,m.current,x,a),We=j,Qa(0,!1),Le&&typeof Le.onPostCommitFiberRoot=="function")try{Le.onPostCommitFiberRoot(mt,m)}catch{}return!0}finally{H.p=f,D.T=l,Km(t,n)}}function Qm(t,n,a){n=Tn(a,n),n=Tu(t.stateNode,n,2),t=Er(t,n,2),t!==null&&(_t(t,2),Fn(t))}function nt(t,n,a){if(t.tag===3)Qm(t,t,a);else for(;n!==null;){if(n.tag===3){Qm(n,t,a);break}else if(n.tag===1){var l=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Mr===null||!Mr.has(l))){t=Tn(a,t),a=Zh(2),l=Er(n,a,2),l!==null&&(Jh(a,l,n,t),_t(l,2),Fn(l));break}}n=n.return}}function Ju(t,n,a){var l=t.pingCache;if(l===null){l=t.pingCache=new $x;var f=new Set;l.set(n,f)}else f=l.get(n),f===void 0&&(f=new Set,l.set(n,f));f.has(a)||(Fu=!0,f.add(a),t=Yx.bind(null,t,n,a),n.then(t,t))}function Yx(t,n,a){var l=t.pingCache;l!==null&&l.delete(n),t.pingedLanes|=t.suspendedLanes&a,t.warmLanes&=~a,st===t&&(Ge&a)===a&&(vt===4||vt===3&&(Ge&62914560)===Ge&&300>qe()-ul?(We&2)===0&&Wi(t,0):Pu|=a,Zi===Ge&&(Zi=0)),Fn(t)}function Zm(t,n){n===0&&(n=gt()),t=Wr(t,n),t!==null&&(_t(t,n),Fn(t))}function Kx(t){var n=t.memoizedState,a=0;n!==null&&(a=n.retryLane),Zm(t,a)}function Xx(t,n){var a=0;switch(t.tag){case 31:case 13:var l=t.stateNode,f=t.memoizedState;f!==null&&(a=f.retryLane);break;case 19:l=t.stateNode;break;case 22:l=t.stateNode._retryCache;break;default:throw Error(s(314))}l!==null&&l.delete(n),Zm(t,a)}function Qx(t,n){return Gt(t,n)}var gl=null,ta=null,Wu=!1,yl=!1,ec=!1,zr=0;function Fn(t){t!==ta&&t.next===null&&(ta===null?gl=ta=t:ta=ta.next=t),yl=!0,Wu||(Wu=!0,Jx())}function Qa(t,n){if(!ec&&yl){ec=!0;do for(var a=!1,l=gl;l!==null;){if(t!==0){var f=l.pendingLanes;if(f===0)var m=0;else{var x=l.suspendedLanes,j=l.pingedLanes;m=(1<<31-$e(42|t)+1)-1,m&=f&~(x&~j),m=m&201326741?m&201326741|1:m?m|2:0}m!==0&&(a=!0,tp(l,m))}else m=Ge,m=Mt(l,l===st?m:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(m&3)===0||re(l,m)||(a=!0,tp(l,m));l=l.next}while(a);ec=!1}}function Zx(){Jm()}function Jm(){yl=Wu=!1;var t=0;zr!==0&&oS()&&(t=zr);for(var n=qe(),a=null,l=gl;l!==null;){var f=l.next,m=Wm(l,n);m===0?(l.next=null,a===null?gl=f:a.next=f,f===null&&(ta=a)):(a=l,(t!==0||(m&3)!==0)&&(yl=!0)),l=f}Dt!==0&&Dt!==5||Qa(t),zr!==0&&(zr=0)}function Wm(t,n){for(var a=t.suspendedLanes,l=t.pingedLanes,f=t.expirationTimes,m=t.pendingLanes&-62914561;0<m;){var x=31-$e(m),j=1<<x,L=f[x];L===-1?((j&a)===0||(j&l)!==0)&&(f[x]=ke(j,n)):L<=n&&(t.expiredLanes|=j),m&=~j}if(n=st,a=Ge,a=Mt(t,t===n?a:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),l=t.callbackNode,a===0||t===n&&(tt===2||tt===9)||t.cancelPendingCommit!==null)return l!==null&&l!==null&&Ee(l),t.callbackNode=null,t.callbackPriority=0;if((a&3)===0||re(t,a)){if(n=a&-a,n===t.callbackPriority)return n;switch(l!==null&&Ee(l),br(a)){case 2:case 8:a=he;break;case 32:a=be;break;case 268435456:a=je;break;default:a=be}return l=ep.bind(null,t),a=Gt(a,l),t.callbackPriority=n,t.callbackNode=a,n}return l!==null&&l!==null&&Ee(l),t.callbackPriority=2,t.callbackNode=null,2}function ep(t,n){if(Dt!==0&&Dt!==5)return t.callbackNode=null,t.callbackPriority=0,null;var a=t.callbackNode;if(pl()&&t.callbackNode!==a)return null;var l=Ge;return l=Mt(t,t===st?l:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),l===0?null:(_m(t,l,n),Wm(t,qe()),t.callbackNode!=null&&t.callbackNode===a?ep.bind(null,t):null)}function tp(t,n){if(pl())return null;_m(t,n,!0)}function Jx(){cS(function(){(We&6)!==0?Gt(se,Zx):Jm()})}function tc(){if(zr===0){var t=Ui;t===0&&(t=Ye,Ye<<=1,(Ye&261888)===0&&(Ye=256)),zr=t}return zr}function np(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Rs(""+t)}function rp(t,n){var a=n.ownerDocument.createElement("input");return a.name=n.name,a.value=n.value,t.id&&a.setAttribute("form",t.id),n.parentNode.insertBefore(a,n),t=new FormData(t),a.parentNode.removeChild(a),t}function Wx(t,n,a,l,f){if(n==="submit"&&a&&a.stateNode===f){var m=np((f[en]||null).action),x=l.submitter;x&&(n=(n=x[en]||null)?np(n.formAction):x.getAttribute("formAction"),n!==null&&(m=n,x=null));var j=new Ns("action","action",null,l,f);t.push({event:j,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(zr!==0){var L=x?rp(f,x):new FormData(f);Su(a,{pending:!0,data:L,method:f.method,action:m},null,L)}}else typeof m=="function"&&(j.preventDefault(),L=x?rp(f,x):new FormData(f),Su(a,{pending:!0,data:L,method:f.method,action:m},m,L))},currentTarget:f}]})}}for(var nc=0;nc<Bo.length;nc++){var rc=Bo[nc],eS=rc.toLowerCase(),tS=rc[0].toUpperCase()+rc.slice(1);_n(eS,"on"+tS)}_n(Mf,"onAnimationEnd"),_n(_f,"onAnimationIteration"),_n(Lf,"onAnimationStart"),_n("dblclick","onDoubleClick"),_n("focusin","onFocus"),_n("focusout","onBlur"),_n(yx,"onTransitionRun"),_n(vx,"onTransitionStart"),_n(bx,"onTransitionCancel"),_n(zf,"onTransitionEnd"),ji("onMouseEnter",["mouseout","mouseover"]),ji("onMouseLeave",["mouseout","mouseover"]),ji("onPointerEnter",["pointerout","pointerover"]),ji("onPointerLeave",["pointerout","pointerover"]),Xr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Xr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Xr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Xr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Xr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Xr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Za="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(" "),nS=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Za));function ip(t,n){n=(n&4)!==0;for(var a=0;a<t.length;a++){var l=t[a],f=l.event;l=l.listeners;e:{var m=void 0;if(n)for(var x=l.length-1;0<=x;x--){var j=l[x],L=j.instance,J=j.currentTarget;if(j=j.listener,L!==m&&f.isPropagationStopped())break e;m=j,f.currentTarget=J;try{m(f)}catch(oe){Ds(oe)}f.currentTarget=null,m=L}else for(x=0;x<l.length;x++){if(j=l[x],L=j.instance,J=j.currentTarget,j=j.listener,L!==m&&f.isPropagationStopped())break e;m=j,f.currentTarget=J;try{m(f)}catch(oe){Ds(oe)}f.currentTarget=null,m=L}}}}function Be(t,n){var a=n[go];a===void 0&&(a=n[go]=new Set);var l=t+"__bubble";a.has(l)||(ap(n,t,2,!1),a.add(l))}function ic(t,n,a){var l=0;n&&(l|=4),ap(a,t,l,n)}var vl="_reactListening"+Math.random().toString(36).slice(2);function ac(t){if(!t[vl]){t[vl]=!0,Zd.forEach(function(a){a!=="selectionchange"&&(nS.has(a)||ic(a,!1,t),ic(a,!0,t))});var n=t.nodeType===9?t:t.ownerDocument;n===null||n[vl]||(n[vl]=!0,ic("selectionchange",!1,n))}}function ap(t,n,a,l){switch(Mp(n)){case 2:var f=IS;break;case 8:f=AS;break;default:f=xc}a=f.bind(null,n,a,t),f=void 0,!Ro||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(f=!0),l?f!==void 0?t.addEventListener(n,a,{capture:!0,passive:f}):t.addEventListener(n,a,!0):f!==void 0?t.addEventListener(n,a,{passive:f}):t.addEventListener(n,a,!1)}function sc(t,n,a,l,f){var m=l;if((n&1)===0&&(n&2)===0&&l!==null)e:for(;;){if(l===null)return;var x=l.tag;if(x===3||x===4){var j=l.stateNode.containerInfo;if(j===f)break;if(x===4)for(x=l.return;x!==null;){var L=x.tag;if((L===3||L===4)&&x.stateNode.containerInfo===f)return;x=x.return}for(;j!==null;){if(x=wi(j),x===null)return;if(L=x.tag,L===5||L===6||L===26||L===27){l=m=x;continue e}j=j.parentNode}}l=l.return}cf(function(){var J=m,oe=wo(a),de=[];e:{var ee=Bf.get(t);if(ee!==void 0){var ie=Ns,ye=t;switch(t){case"keypress":if(Ts(a)===0)break e;case"keydown":case"keyup":ie=Xb;break;case"focusin":ye="focus",ie=No;break;case"focusout":ye="blur",ie=No;break;case"beforeblur":case"afterblur":ie=No;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ie=hf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ie=zb;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ie=Jb;break;case Mf:case _f:case Lf:ie=Ub;break;case zf:ie=ex;break;case"scroll":case"scrollend":ie=_b;break;case"wheel":ie=nx;break;case"copy":case"cut":case"paste":ie=$b;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ie=pf;break;case"toggle":case"beforetoggle":ie=ix}var Re=(n&4)!==0,at=!Re&&(t==="scroll"||t==="scrollend"),X=Re?ee!==null?ee+"Capture":null:ee;Re=[];for(var $=J,Z;$!==null;){var ce=$;if(Z=ce.stateNode,ce=ce.tag,ce!==5&&ce!==26&&ce!==27||Z===null||X===null||(ce=ba($,X),ce!=null&&Re.push(Ja($,ce,Z))),at)break;$=$.return}0<Re.length&&(ee=new ie(ee,ye,null,a,oe),de.push({event:ee,listeners:Re}))}}if((n&7)===0){e:{if(ee=t==="mouseover"||t==="pointerover",ie=t==="mouseout"||t==="pointerout",ee&&a!==ko&&(ye=a.relatedTarget||a.fromElement)&&(wi(ye)||ye[ki]))break e;if((ie||ee)&&(ee=oe.window===oe?oe:(ee=oe.ownerDocument)?ee.defaultView||ee.parentWindow:window,ie?(ye=a.relatedTarget||a.toElement,ie=J,ye=ye?wi(ye):null,ye!==null&&(at=c(ye),Re=ye.tag,ye!==at||Re!==5&&Re!==27&&Re!==6)&&(ye=null)):(ie=null,ye=J),ie!==ye)){if(Re=hf,ce="onMouseLeave",X="onMouseEnter",$="mouse",(t==="pointerout"||t==="pointerover")&&(Re=pf,ce="onPointerLeave",X="onPointerEnter",$="pointer"),at=ie==null?ee:va(ie),Z=ye==null?ee:va(ye),ee=new Re(ce,$+"leave",ie,a,oe),ee.target=at,ee.relatedTarget=Z,ce=null,wi(oe)===J&&(Re=new Re(X,$+"enter",ye,a,oe),Re.target=Z,Re.relatedTarget=at,ce=Re),at=ce,ie&&ye)t:{for(Re=rS,X=ie,$=ye,Z=0,ce=X;ce;ce=Re(ce))Z++;ce=0;for(var xe=$;xe;xe=Re(xe))ce++;for(;0<Z-ce;)X=Re(X),Z--;for(;0<ce-Z;)$=Re($),ce--;for(;Z--;){if(X===$||$!==null&&X===$.alternate){Re=X;break t}X=Re(X),$=Re($)}Re=null}else Re=null;ie!==null&&sp(de,ee,ie,Re,!1),ye!==null&&at!==null&&sp(de,at,ye,Re,!0)}}e:{if(ee=J?va(J):window,ie=ee.nodeName&&ee.nodeName.toLowerCase(),ie==="select"||ie==="input"&&ee.type==="file")var Qe=wf;else if(Sf(ee))if(Cf)Qe=mx;else{Qe=fx;var ve=dx}else ie=ee.nodeName,!ie||ie.toLowerCase()!=="input"||ee.type!=="checkbox"&&ee.type!=="radio"?J&&So(J.elementType)&&(Qe=wf):Qe=hx;if(Qe&&(Qe=Qe(t,J))){kf(de,Qe,a,oe);break e}ve&&ve(t,ee,J),t==="focusout"&&J&&ee.type==="number"&&J.memoizedProps.value!=null&&xo(ee,"number",ee.value)}switch(ve=J?va(J):window,t){case"focusin":(Sf(ve)||ve.contentEditable==="true")&&(Di=ve,_o=J,Ta=null);break;case"focusout":Ta=_o=Di=null;break;case"mousedown":Lo=!0;break;case"contextmenu":case"mouseup":case"dragend":Lo=!1,Df(de,a,oe);break;case"selectionchange":if(gx)break;case"keydown":case"keyup":Df(de,a,oe)}var Oe;if(Ao)e:{switch(t){case"compositionstart":var Fe="onCompositionStart";break e;case"compositionend":Fe="onCompositionEnd";break e;case"compositionupdate":Fe="onCompositionUpdate";break e}Fe=void 0}else Ai?bf(t,a)&&(Fe="onCompositionEnd"):t==="keydown"&&a.keyCode===229&&(Fe="onCompositionStart");Fe&&(gf&&a.locale!=="ko"&&(Ai||Fe!=="onCompositionStart"?Fe==="onCompositionEnd"&&Ai&&(Oe=df()):(Sr=oe,jo="value"in Sr?Sr.value:Sr.textContent,Ai=!0)),ve=bl(J,Fe),0<ve.length&&(Fe=new mf(Fe,t,null,a,oe),de.push({event:Fe,listeners:ve}),Oe?Fe.data=Oe:(Oe=xf(a),Oe!==null&&(Fe.data=Oe)))),(Oe=sx?lx(t,a):ox(t,a))&&(Fe=bl(J,"onBeforeInput"),0<Fe.length&&(ve=new mf("onBeforeInput","beforeinput",null,a,oe),de.push({event:ve,listeners:Fe}),ve.data=Oe)),Wx(de,t,J,a,oe)}ip(de,n)})}function Ja(t,n,a){return{instance:t,listener:n,currentTarget:a}}function bl(t,n){for(var a=n+"Capture",l=[];t!==null;){var f=t,m=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||m===null||(f=ba(t,a),f!=null&&l.unshift(Ja(t,f,m)),f=ba(t,n),f!=null&&l.push(Ja(t,f,m))),t.tag===3)return l;t=t.return}return[]}function rS(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function sp(t,n,a,l,f){for(var m=n._reactName,x=[];a!==null&&a!==l;){var j=a,L=j.alternate,J=j.stateNode;if(j=j.tag,L!==null&&L===l)break;j!==5&&j!==26&&j!==27||J===null||(L=J,f?(J=ba(a,m),J!=null&&x.unshift(Ja(a,J,L))):f||(J=ba(a,m),J!=null&&x.push(Ja(a,J,L)))),a=a.return}x.length!==0&&t.push({event:n,listeners:x})}var iS=/\r\n?/g,aS=/\u0000|\uFFFD/g;function lp(t){return(typeof t=="string"?t:""+t).replace(iS,`
|
|
9
|
+
`).replace(aS,"")}function op(t,n){return n=lp(n),lp(t)===n}function it(t,n,a,l,f,m){switch(a){case"children":typeof l=="string"?n==="body"||n==="textarea"&&l===""||Ei(t,l):(typeof l=="number"||typeof l=="bigint")&&n!=="body"&&Ei(t,""+l);break;case"className":ws(t,"class",l);break;case"tabIndex":ws(t,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":ws(t,a,l);break;case"style":of(t,l,m);break;case"data":if(n!=="object"){ws(t,"data",l);break}case"src":case"href":if(l===""&&(n!=="a"||a!=="href")){t.removeAttribute(a);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){t.removeAttribute(a);break}l=Rs(""+l),t.setAttribute(a,l);break;case"action":case"formAction":if(typeof l=="function"){t.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof m=="function"&&(a==="formAction"?(n!=="input"&&it(t,n,"name",f.name,f,null),it(t,n,"formEncType",f.formEncType,f,null),it(t,n,"formMethod",f.formMethod,f,null),it(t,n,"formTarget",f.formTarget,f,null)):(it(t,n,"encType",f.encType,f,null),it(t,n,"method",f.method,f,null),it(t,n,"target",f.target,f,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){t.removeAttribute(a);break}l=Rs(""+l),t.setAttribute(a,l);break;case"onClick":l!=null&&(t.onclick=Zn);break;case"onScroll":l!=null&&Be("scroll",t);break;case"onScrollEnd":l!=null&&Be("scrollend",t);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(s(61));if(a=l.__html,a!=null){if(f.children!=null)throw Error(s(60));t.innerHTML=a}}break;case"multiple":t.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":t.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){t.removeAttribute("xlink:href");break}a=Rs(""+l),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?t.setAttribute(a,""+l):t.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?t.setAttribute(a,""):t.removeAttribute(a);break;case"capture":case"download":l===!0?t.setAttribute(a,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?t.setAttribute(a,l):t.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?t.setAttribute(a,l):t.removeAttribute(a);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?t.removeAttribute(a):t.setAttribute(a,l);break;case"popover":Be("beforetoggle",t),Be("toggle",t),ks(t,"popover",l);break;case"xlinkActuate":Qn(t,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Qn(t,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Qn(t,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Qn(t,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Qn(t,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Qn(t,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Qn(t,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Qn(t,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Qn(t,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":ks(t,"is",l);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=Ob.get(a)||a,ks(t,a,l))}}function lc(t,n,a,l,f,m){switch(a){case"style":of(t,l,m);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(s(61));if(a=l.__html,a!=null){if(f.children!=null)throw Error(s(60));t.innerHTML=a}}break;case"children":typeof l=="string"?Ei(t,l):(typeof l=="number"||typeof l=="bigint")&&Ei(t,""+l);break;case"onScroll":l!=null&&Be("scroll",t);break;case"onScrollEnd":l!=null&&Be("scrollend",t);break;case"onClick":l!=null&&(t.onclick=Zn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Jd.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(f=a.endsWith("Capture"),n=a.slice(2,f?a.length-7:void 0),m=t[en]||null,m=m!=null?m[a]:null,typeof m=="function"&&t.removeEventListener(n,m,f),typeof l=="function")){typeof m!="function"&&m!==null&&(a in t?t[a]=null:t.hasAttribute(a)&&t.removeAttribute(a)),t.addEventListener(n,l,f);break e}a in t?t[a]=l:l===!0?t.setAttribute(a,""):ks(t,a,l)}}}function $t(t,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Be("error",t),Be("load",t);var l=!1,f=!1,m;for(m in a)if(a.hasOwnProperty(m)){var x=a[m];if(x!=null)switch(m){case"src":l=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,n));default:it(t,n,m,x,a,null)}}f&&it(t,n,"srcSet",a.srcSet,a,null),l&&it(t,n,"src",a.src,a,null);return;case"input":Be("invalid",t);var j=m=x=f=null,L=null,J=null;for(l in a)if(a.hasOwnProperty(l)){var oe=a[l];if(oe!=null)switch(l){case"name":f=oe;break;case"type":x=oe;break;case"checked":L=oe;break;case"defaultChecked":J=oe;break;case"value":m=oe;break;case"defaultValue":j=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(s(137,n));break;default:it(t,n,l,oe,a,null)}}rf(t,m,j,L,J,x,f,!1);return;case"select":Be("invalid",t),l=x=m=null;for(f in a)if(a.hasOwnProperty(f)&&(j=a[f],j!=null))switch(f){case"value":m=j;break;case"defaultValue":x=j;break;case"multiple":l=j;default:it(t,n,f,j,a,null)}n=m,a=x,t.multiple=!!l,n!=null?Ti(t,!!l,n,!1):a!=null&&Ti(t,!!l,a,!0);return;case"textarea":Be("invalid",t),m=f=l=null;for(x in a)if(a.hasOwnProperty(x)&&(j=a[x],j!=null))switch(x){case"value":l=j;break;case"defaultValue":f=j;break;case"children":m=j;break;case"dangerouslySetInnerHTML":if(j!=null)throw Error(s(91));break;default:it(t,n,x,j,a,null)}sf(t,l,f,m);return;case"option":for(L in a)a.hasOwnProperty(L)&&(l=a[L],l!=null)&&(L==="selected"?t.selected=l&&typeof l!="function"&&typeof l!="symbol":it(t,n,L,l,a,null));return;case"dialog":Be("beforetoggle",t),Be("toggle",t),Be("cancel",t),Be("close",t);break;case"iframe":case"object":Be("load",t);break;case"video":case"audio":for(l=0;l<Za.length;l++)Be(Za[l],t);break;case"image":Be("error",t),Be("load",t);break;case"details":Be("toggle",t);break;case"embed":case"source":case"link":Be("error",t),Be("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(J in a)if(a.hasOwnProperty(J)&&(l=a[J],l!=null))switch(J){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,n));default:it(t,n,J,l,a,null)}return;default:if(So(n)){for(oe in a)a.hasOwnProperty(oe)&&(l=a[oe],l!==void 0&&lc(t,n,oe,l,a,void 0));return}}for(j in a)a.hasOwnProperty(j)&&(l=a[j],l!=null&&it(t,n,j,l,a,null))}function sS(t,n,a,l){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,m=null,x=null,j=null,L=null,J=null,oe=null;for(ie in a){var de=a[ie];if(a.hasOwnProperty(ie)&&de!=null)switch(ie){case"checked":break;case"value":break;case"defaultValue":L=de;default:l.hasOwnProperty(ie)||it(t,n,ie,null,l,de)}}for(var ee in l){var ie=l[ee];if(de=a[ee],l.hasOwnProperty(ee)&&(ie!=null||de!=null))switch(ee){case"type":m=ie;break;case"name":f=ie;break;case"checked":J=ie;break;case"defaultChecked":oe=ie;break;case"value":x=ie;break;case"defaultValue":j=ie;break;case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(s(137,n));break;default:ie!==de&&it(t,n,ee,ie,l,de)}}bo(t,x,j,L,J,oe,m,f);return;case"select":ie=x=j=ee=null;for(m in a)if(L=a[m],a.hasOwnProperty(m)&&L!=null)switch(m){case"value":break;case"multiple":ie=L;default:l.hasOwnProperty(m)||it(t,n,m,null,l,L)}for(f in l)if(m=l[f],L=a[f],l.hasOwnProperty(f)&&(m!=null||L!=null))switch(f){case"value":ee=m;break;case"defaultValue":j=m;break;case"multiple":x=m;default:m!==L&&it(t,n,f,m,l,L)}n=j,a=x,l=ie,ee!=null?Ti(t,!!a,ee,!1):!!l!=!!a&&(n!=null?Ti(t,!!a,n,!0):Ti(t,!!a,a?[]:"",!1));return;case"textarea":ie=ee=null;for(j in a)if(f=a[j],a.hasOwnProperty(j)&&f!=null&&!l.hasOwnProperty(j))switch(j){case"value":break;case"children":break;default:it(t,n,j,null,l,f)}for(x in l)if(f=l[x],m=a[x],l.hasOwnProperty(x)&&(f!=null||m!=null))switch(x){case"value":ee=f;break;case"defaultValue":ie=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(s(91));break;default:f!==m&&it(t,n,x,f,l,m)}af(t,ee,ie);return;case"option":for(var ye in a)ee=a[ye],a.hasOwnProperty(ye)&&ee!=null&&!l.hasOwnProperty(ye)&&(ye==="selected"?t.selected=!1:it(t,n,ye,null,l,ee));for(L in l)ee=l[L],ie=a[L],l.hasOwnProperty(L)&&ee!==ie&&(ee!=null||ie!=null)&&(L==="selected"?t.selected=ee&&typeof ee!="function"&&typeof ee!="symbol":it(t,n,L,ee,l,ie));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Re in a)ee=a[Re],a.hasOwnProperty(Re)&&ee!=null&&!l.hasOwnProperty(Re)&&it(t,n,Re,null,l,ee);for(J in l)if(ee=l[J],ie=a[J],l.hasOwnProperty(J)&&ee!==ie&&(ee!=null||ie!=null))switch(J){case"children":case"dangerouslySetInnerHTML":if(ee!=null)throw Error(s(137,n));break;default:it(t,n,J,ee,l,ie)}return;default:if(So(n)){for(var at in a)ee=a[at],a.hasOwnProperty(at)&&ee!==void 0&&!l.hasOwnProperty(at)&&lc(t,n,at,void 0,l,ee);for(oe in l)ee=l[oe],ie=a[oe],!l.hasOwnProperty(oe)||ee===ie||ee===void 0&&ie===void 0||lc(t,n,oe,ee,l,ie);return}}for(var X in a)ee=a[X],a.hasOwnProperty(X)&&ee!=null&&!l.hasOwnProperty(X)&&it(t,n,X,null,l,ee);for(de in l)ee=l[de],ie=a[de],!l.hasOwnProperty(de)||ee===ie||ee==null&&ie==null||it(t,n,de,ee,l,ie)}function up(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function lS(){if(typeof performance.getEntriesByType=="function"){for(var t=0,n=0,a=performance.getEntriesByType("resource"),l=0;l<a.length;l++){var f=a[l],m=f.transferSize,x=f.initiatorType,j=f.duration;if(m&&j&&up(x)){for(x=0,j=f.responseEnd,l+=1;l<a.length;l++){var L=a[l],J=L.startTime;if(J>j)break;var oe=L.transferSize,de=L.initiatorType;oe&&up(de)&&(L=L.responseEnd,x+=oe*(L<j?1:(j-J)/(L-J)))}if(--l,n+=8*(m+x)/(f.duration/1e3),t++,10<t)break}}if(0<t)return n/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var oc=null,uc=null;function xl(t){return t.nodeType===9?t:t.ownerDocument}function cp(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function dp(t,n){if(t===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&n==="foreignObject"?0:t}function cc(t,n){return t==="textarea"||t==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var dc=null;function oS(){var t=window.event;return t&&t.type==="popstate"?t===dc?!1:(dc=t,!0):(dc=null,!1)}var fp=typeof setTimeout=="function"?setTimeout:void 0,uS=typeof clearTimeout=="function"?clearTimeout:void 0,hp=typeof Promise=="function"?Promise:void 0,cS=typeof queueMicrotask=="function"?queueMicrotask:typeof hp<"u"?function(t){return hp.resolve(null).then(t).catch(dS)}:fp;function dS(t){setTimeout(function(){throw t})}function Br(t){return t==="head"}function mp(t,n){var a=n,l=0;do{var f=a.nextSibling;if(t.removeChild(a),f&&f.nodeType===8)if(a=f.data,a==="/$"||a==="/&"){if(l===0){t.removeChild(f),aa(n);return}l--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")l++;else if(a==="html")Wa(t.ownerDocument.documentElement);else if(a==="head"){a=t.ownerDocument.head,Wa(a);for(var m=a.firstChild;m;){var x=m.nextSibling,j=m.nodeName;m[ya]||j==="SCRIPT"||j==="STYLE"||j==="LINK"&&m.rel.toLowerCase()==="stylesheet"||a.removeChild(m),m=x}}else a==="body"&&Wa(t.ownerDocument.body);a=f}while(a);aa(n)}function pp(t,n){var a=t;t=0;do{var l=a.nextSibling;if(a.nodeType===1?n?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(n?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),l&&l.nodeType===8)if(a=l.data,a==="/$"){if(t===0)break;t--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||t++;a=l}while(a)}function fc(t){var n=t.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var a=n;switch(n=n.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":fc(a),yo(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}t.removeChild(a)}}function fS(t,n,a,l){for(;t.nodeType===1;){var f=a;if(t.nodeName.toLowerCase()!==n.toLowerCase()){if(!l&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(l){if(!t[ya])switch(n){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(m=t.getAttribute("rel"),m==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(m!==f.rel||t.getAttribute("href")!==(f.href==null||f.href===""?null:f.href)||t.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin)||t.getAttribute("title")!==(f.title==null?null:f.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(m=t.getAttribute("src"),(m!==(f.src==null?null:f.src)||t.getAttribute("type")!==(f.type==null?null:f.type)||t.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&m&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(n==="input"&&t.type==="hidden"){var m=f.name==null?null:""+f.name;if(f.type==="hidden"&&t.getAttribute("name")===m)return t}else return t;if(t=Dn(t.nextSibling),t===null)break}return null}function hS(t,n,a){if(n==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=Dn(t.nextSibling),t===null))return null;return t}function gp(t,n){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!n||(t=Dn(t.nextSibling),t===null))return null;return t}function hc(t){return t.data==="$?"||t.data==="$~"}function mc(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function mS(t,n){var a=t.ownerDocument;if(t.data==="$~")t._reactRetry=n;else if(t.data!=="$?"||a.readyState!=="loading")n();else{var l=function(){n(),a.removeEventListener("DOMContentLoaded",l)};a.addEventListener("DOMContentLoaded",l),t._reactRetry=l}}function Dn(t){for(;t!=null;t=t.nextSibling){var n=t.nodeType;if(n===1||n===3)break;if(n===8){if(n=t.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return t}var pc=null;function yp(t){t=t.nextSibling;for(var n=0;t;){if(t.nodeType===8){var a=t.data;if(a==="/$"||a==="/&"){if(n===0)return Dn(t.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}t=t.nextSibling}return null}function vp(t){t=t.previousSibling;for(var n=0;t;){if(t.nodeType===8){var a=t.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(n===0)return t;n--}else a!=="/$"&&a!=="/&"||n++}t=t.previousSibling}return null}function bp(t,n,a){switch(n=xl(a),t){case"html":if(t=n.documentElement,!t)throw Error(s(452));return t;case"head":if(t=n.head,!t)throw Error(s(453));return t;case"body":if(t=n.body,!t)throw Error(s(454));return t;default:throw Error(s(451))}}function Wa(t){for(var n=t.attributes;n.length;)t.removeAttributeNode(n[0]);yo(t)}var On=new Map,xp=new Set;function Sl(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var hr=H.d;H.d={f:pS,r:gS,D:yS,C:vS,L:bS,m:xS,X:kS,S:SS,M:wS};function pS(){var t=hr.f(),n=fl();return t||n}function gS(t){var n=Ci(t);n!==null&&n.tag===5&&n.type==="form"?zh(n):hr.r(t)}var na=typeof document>"u"?null:document;function Sp(t,n,a){var l=na;if(l&&typeof n=="string"&&n){var f=Rn(n);f='link[rel="'+t+'"][href="'+f+'"]',typeof a=="string"&&(f+='[crossorigin="'+a+'"]'),xp.has(f)||(xp.add(f),t={rel:t,crossOrigin:a,href:n},l.querySelector(f)===null&&(n=l.createElement("link"),$t(n,"link",t),Lt(n),l.head.appendChild(n)))}}function yS(t){hr.D(t),Sp("dns-prefetch",t,null)}function vS(t,n){hr.C(t,n),Sp("preconnect",t,n)}function bS(t,n,a){hr.L(t,n,a);var l=na;if(l&&t&&n){var f='link[rel="preload"][as="'+Rn(n)+'"]';n==="image"&&a&&a.imageSrcSet?(f+='[imagesrcset="'+Rn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(f+='[imagesizes="'+Rn(a.imageSizes)+'"]')):f+='[href="'+Rn(t)+'"]';var m=f;switch(n){case"style":m=ra(t);break;case"script":m=ia(t)}On.has(m)||(t=y({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:t,as:n},a),On.set(m,t),l.querySelector(f)!==null||n==="style"&&l.querySelector(es(m))||n==="script"&&l.querySelector(ts(m))||(n=l.createElement("link"),$t(n,"link",t),Lt(n),l.head.appendChild(n)))}}function xS(t,n){hr.m(t,n);var a=na;if(a&&t){var l=n&&typeof n.as=="string"?n.as:"script",f='link[rel="modulepreload"][as="'+Rn(l)+'"][href="'+Rn(t)+'"]',m=f;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":m=ia(t)}if(!On.has(m)&&(t=y({rel:"modulepreload",href:t},n),On.set(m,t),a.querySelector(f)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(ts(m)))return}l=a.createElement("link"),$t(l,"link",t),Lt(l),a.head.appendChild(l)}}}function SS(t,n,a){hr.S(t,n,a);var l=na;if(l&&t){var f=Ri(l).hoistableStyles,m=ra(t);n=n||"default";var x=f.get(m);if(!x){var j={loading:0,preload:null};if(x=l.querySelector(es(m)))j.loading=5;else{t=y({rel:"stylesheet",href:t,"data-precedence":n},a),(a=On.get(m))&&gc(t,a);var L=x=l.createElement("link");Lt(L),$t(L,"link",t),L._p=new Promise(function(J,oe){L.onload=J,L.onerror=oe}),L.addEventListener("load",function(){j.loading|=1}),L.addEventListener("error",function(){j.loading|=2}),j.loading|=4,kl(x,n,l)}x={type:"stylesheet",instance:x,count:1,state:j},f.set(m,x)}}}function kS(t,n){hr.X(t,n);var a=na;if(a&&t){var l=Ri(a).hoistableScripts,f=ia(t),m=l.get(f);m||(m=a.querySelector(ts(f)),m||(t=y({src:t,async:!0},n),(n=On.get(f))&&yc(t,n),m=a.createElement("script"),Lt(m),$t(m,"link",t),a.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},l.set(f,m))}}function wS(t,n){hr.M(t,n);var a=na;if(a&&t){var l=Ri(a).hoistableScripts,f=ia(t),m=l.get(f);m||(m=a.querySelector(ts(f)),m||(t=y({src:t,async:!0,type:"module"},n),(n=On.get(f))&&yc(t,n),m=a.createElement("script"),Lt(m),$t(m,"link",t),a.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},l.set(f,m))}}function kp(t,n,a,l){var f=(f=Q.current)?Sl(f):null;if(!f)throw Error(s(446));switch(t){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(n=ra(a.href),a=Ri(f).hoistableStyles,l=a.get(n),l||(l={type:"style",instance:null,count:0,state:null},a.set(n,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){t=ra(a.href);var m=Ri(f).hoistableStyles,x=m.get(t);if(x||(f=f.ownerDocument||f,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},m.set(t,x),(m=f.querySelector(es(t)))&&!m._p&&(x.instance=m,x.state.loading=5),On.has(t)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},On.set(t,a),m||CS(f,t,a,x.state))),n&&l===null)throw Error(s(528,""));return x}if(n&&l!==null)throw Error(s(529,""));return null;case"script":return n=a.async,a=a.src,typeof a=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=ia(a),a=Ri(f).hoistableScripts,l=a.get(n),l||(l={type:"script",instance:null,count:0,state:null},a.set(n,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,t))}}function ra(t){return'href="'+Rn(t)+'"'}function es(t){return'link[rel="stylesheet"]['+t+"]"}function wp(t){return y({},t,{"data-precedence":t.precedence,precedence:null})}function CS(t,n,a,l){t.querySelector('link[rel="preload"][as="style"]['+n+"]")?l.loading=1:(n=t.createElement("link"),l.preload=n,n.addEventListener("load",function(){return l.loading|=1}),n.addEventListener("error",function(){return l.loading|=2}),$t(n,"link",a),Lt(n),t.head.appendChild(n))}function ia(t){return'[src="'+Rn(t)+'"]'}function ts(t){return"script[async]"+t}function Cp(t,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var l=t.querySelector('style[data-href~="'+Rn(a.href)+'"]');if(l)return n.instance=l,Lt(l),l;var f=y({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(t.ownerDocument||t).createElement("style"),Lt(l),$t(l,"style",f),kl(l,a.precedence,t),n.instance=l;case"stylesheet":f=ra(a.href);var m=t.querySelector(es(f));if(m)return n.state.loading|=4,n.instance=m,Lt(m),m;l=wp(a),(f=On.get(f))&&gc(l,f),m=(t.ownerDocument||t).createElement("link"),Lt(m);var x=m;return x._p=new Promise(function(j,L){x.onload=j,x.onerror=L}),$t(m,"link",l),n.state.loading|=4,kl(m,a.precedence,t),n.instance=m;case"script":return m=ia(a.src),(f=t.querySelector(ts(m)))?(n.instance=f,Lt(f),f):(l=a,(f=On.get(m))&&(l=y({},a),yc(l,f)),t=t.ownerDocument||t,f=t.createElement("script"),Lt(f),$t(f,"link",l),t.head.appendChild(f),n.instance=f);case"void":return null;default:throw Error(s(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(l=n.instance,n.state.loading|=4,kl(l,a.precedence,t));return n.instance}function kl(t,n,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=l.length?l[l.length-1]:null,m=f,x=0;x<l.length;x++){var j=l[x];if(j.dataset.precedence===n)m=j;else if(m!==f)break}m?m.parentNode.insertBefore(t,m.nextSibling):(n=a.nodeType===9?a.head:a,n.insertBefore(t,n.firstChild))}function gc(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.title==null&&(t.title=n.title)}function yc(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.integrity==null&&(t.integrity=n.integrity)}var wl=null;function Rp(t,n,a){if(wl===null){var l=new Map,f=wl=new Map;f.set(a,l)}else f=wl,l=f.get(a),l||(l=new Map,f.set(a,l));if(l.has(t))return l;for(l.set(t,null),a=a.getElementsByTagName(t),f=0;f<a.length;f++){var m=a[f];if(!(m[ya]||m[Bt]||t==="link"&&m.getAttribute("rel")==="stylesheet")&&m.namespaceURI!=="http://www.w3.org/2000/svg"){var x=m.getAttribute(n)||"";x=t+x;var j=l.get(x);j?j.push(m):l.set(x,[m])}}return l}function jp(t,n,a){t=t.ownerDocument||t,t.head.insertBefore(a,n==="title"?t.querySelector("head > title"):null)}function RS(t,n,a){if(a===1||n.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;return n.rel==="stylesheet"?(t=n.disabled,typeof n.precedence=="string"&&t==null):!0;case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function Tp(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function jS(t,n,a,l){if(a.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var f=ra(l.href),m=n.querySelector(es(f));if(m){n=m._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(t.count++,t=Cl.bind(t),n.then(t,t)),a.state.loading|=4,a.instance=m,Lt(m);return}m=n.ownerDocument||n,l=wp(l),(f=On.get(f))&&gc(l,f),m=m.createElement("link"),Lt(m);var x=m;x._p=new Promise(function(j,L){x.onload=j,x.onerror=L}),$t(m,"link",l),a.instance=m}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(t.count++,a=Cl.bind(t),n.addEventListener("load",a),n.addEventListener("error",a))}}var vc=0;function TS(t,n){return t.stylesheets&&t.count===0&&jl(t,t.stylesheets),0<t.count||0<t.imgCount?function(a){var l=setTimeout(function(){if(t.stylesheets&&jl(t,t.stylesheets),t.unsuspend){var m=t.unsuspend;t.unsuspend=null,m()}},6e4+n);0<t.imgBytes&&vc===0&&(vc=62500*lS());var f=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&jl(t,t.stylesheets),t.unsuspend)){var m=t.unsuspend;t.unsuspend=null,m()}},(t.imgBytes>vc?50:800)+n);return t.unsuspend=a,function(){t.unsuspend=null,clearTimeout(l),clearTimeout(f)}}:null}function Cl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)jl(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Rl=null;function jl(t,n){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Rl=new Map,n.forEach(ES,t),Rl=null,Cl.call(t))}function ES(t,n){if(!(n.state.loading&4)){var a=Rl.get(t);if(a)var l=a.get(null);else{a=new Map,Rl.set(t,a);for(var f=t.querySelectorAll("link[data-precedence],style[data-precedence]"),m=0;m<f.length;m++){var x=f[m];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(a.set(x.dataset.precedence,x),l=x)}l&&a.set(null,l)}f=n.instance,x=f.getAttribute("data-precedence"),m=a.get(x)||l,m===l&&a.set(null,f),a.set(x,f),this.count++,l=Cl.bind(this),f.addEventListener("load",l),f.addEventListener("error",l),m?m.parentNode.insertBefore(f,m.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(f,t.firstChild)),n.state.loading|=4}}var ns={$$typeof:E,Provider:null,Consumer:null,_currentValue:B,_currentValue2:B,_threadCount:0};function NS(t,n,a,l,f,m,x,j,L){this.tag=1,this.containerInfo=t,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Xe(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Xe(0),this.hiddenUpdates=Xe(null),this.identifierPrefix=l,this.onUncaughtError=f,this.onCaughtError=m,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=L,this.incompleteTransitions=new Map}function Ep(t,n,a,l,f,m,x,j,L,J,oe,de){return t=new NS(t,n,a,x,L,J,oe,de,j),n=1,m===!0&&(n|=24),m=pn(3,null,null,n),t.current=m,m.stateNode=t,n=Zo(),n.refCount++,t.pooledCache=n,n.refCount++,m.memoizedState={element:l,isDehydrated:a,cache:n},tu(m),t}function Np(t){return t?(t=_i,t):_i}function Ip(t,n,a,l,f,m){f=Np(f),l.context===null?l.context=f:l.pendingContext=f,l=Tr(n),l.payload={element:a},m=m===void 0?null:m,m!==null&&(l.callback=m),a=Er(t,l,n),a!==null&&(ln(a,t,n),Ma(a,t,n))}function Ap(t,n){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var a=t.retryLane;t.retryLane=a!==0&&a<n?a:n}}function bc(t,n){Ap(t,n),(t=t.alternate)&&Ap(t,n)}function Dp(t){if(t.tag===13||t.tag===31){var n=Wr(t,67108864);n!==null&&ln(n,t,67108864),bc(t,67108864)}}function Op(t){if(t.tag===13||t.tag===31){var n=xn();n=hn(n);var a=Wr(t,n);a!==null&&ln(a,t,n),bc(t,n)}}var Tl=!0;function IS(t,n,a,l){var f=D.T;D.T=null;var m=H.p;try{H.p=2,xc(t,n,a,l)}finally{H.p=m,D.T=f}}function AS(t,n,a,l){var f=D.T;D.T=null;var m=H.p;try{H.p=8,xc(t,n,a,l)}finally{H.p=m,D.T=f}}function xc(t,n,a,l){if(Tl){var f=Sc(l);if(f===null)sc(t,n,l,El,a),_p(t,l);else if(OS(f,t,n,a,l))l.stopPropagation();else if(_p(t,l),n&4&&-1<DS.indexOf(t)){for(;f!==null;){var m=Ci(f);if(m!==null)switch(m.tag){case 3:if(m=m.stateNode,m.current.memoizedState.isDehydrated){var x=wt(m.pendingLanes);if(x!==0){var j=m;for(j.pendingLanes|=2,j.entangledLanes|=2;x;){var L=1<<31-$e(x);j.entanglements[1]|=L,x&=~L}Fn(m),(We&6)===0&&(cl=qe()+500,Qa(0))}}break;case 31:case 13:j=Wr(m,2),j!==null&&ln(j,m,2),fl(),bc(m,2)}if(m=Sc(l),m===null&&sc(t,n,l,El,a),m===f)break;f=m}f!==null&&l.stopPropagation()}else sc(t,n,l,null,a)}}function Sc(t){return t=wo(t),kc(t)}var El=null;function kc(t){if(El=null,t=wi(t),t!==null){var n=c(t);if(n===null)t=null;else{var a=n.tag;if(a===13){if(t=d(n),t!==null)return t;t=null}else if(a===31){if(t=h(n),t!==null)return t;t=null}else if(a===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;t=null}else n!==t&&(t=null)}}return El=t,null}function Mp(t){switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(_e()){case se:return 2;case he:return 8;case be:case we:return 32;case je:return 268435456;default:return 32}default:return 32}}var wc=!1,Hr=null,Ur=null,qr=null,rs=new Map,is=new Map,$r=[],DS="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function _p(t,n){switch(t){case"focusin":case"focusout":Hr=null;break;case"dragenter":case"dragleave":Ur=null;break;case"mouseover":case"mouseout":qr=null;break;case"pointerover":case"pointerout":rs.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":is.delete(n.pointerId)}}function as(t,n,a,l,f,m){return t===null||t.nativeEvent!==m?(t={blockedOn:n,domEventName:a,eventSystemFlags:l,nativeEvent:m,targetContainers:[f]},n!==null&&(n=Ci(n),n!==null&&Dp(n)),t):(t.eventSystemFlags|=l,n=t.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),t)}function OS(t,n,a,l,f){switch(n){case"focusin":return Hr=as(Hr,t,n,a,l,f),!0;case"dragenter":return Ur=as(Ur,t,n,a,l,f),!0;case"mouseover":return qr=as(qr,t,n,a,l,f),!0;case"pointerover":var m=f.pointerId;return rs.set(m,as(rs.get(m)||null,t,n,a,l,f)),!0;case"gotpointercapture":return m=f.pointerId,is.set(m,as(is.get(m)||null,t,n,a,l,f)),!0}return!1}function Lp(t){var n=wi(t.target);if(n!==null){var a=c(n);if(a!==null){if(n=a.tag,n===13){if(n=d(a),n!==null){t.blockedOn=n,Xd(t.priority,function(){Op(a)});return}}else if(n===31){if(n=h(a),n!==null){t.blockedOn=n,Xd(t.priority,function(){Op(a)});return}}else if(n===3&&a.stateNode.current.memoizedState.isDehydrated){t.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Nl(t){if(t.blockedOn!==null)return!1;for(var n=t.targetContainers;0<n.length;){var a=Sc(t.nativeEvent);if(a===null){a=t.nativeEvent;var l=new a.constructor(a.type,a);ko=l,a.target.dispatchEvent(l),ko=null}else return n=Ci(a),n!==null&&Dp(n),t.blockedOn=a,!1;n.shift()}return!0}function zp(t,n,a){Nl(t)&&a.delete(n)}function MS(){wc=!1,Hr!==null&&Nl(Hr)&&(Hr=null),Ur!==null&&Nl(Ur)&&(Ur=null),qr!==null&&Nl(qr)&&(qr=null),rs.forEach(zp),is.forEach(zp)}function Il(t,n){t.blockedOn===n&&(t.blockedOn=null,wc||(wc=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,MS)))}var Al=null;function Bp(t){Al!==t&&(Al=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Al===t&&(Al=null);for(var n=0;n<t.length;n+=3){var a=t[n],l=t[n+1],f=t[n+2];if(typeof l!="function"){if(kc(l||a)===null)continue;break}var m=Ci(a);m!==null&&(t.splice(n,3),n-=3,Su(m,{pending:!0,data:f,method:a.method,action:l},l,f))}}))}function aa(t){function n(L){return Il(L,t)}Hr!==null&&Il(Hr,t),Ur!==null&&Il(Ur,t),qr!==null&&Il(qr,t),rs.forEach(n),is.forEach(n);for(var a=0;a<$r.length;a++){var l=$r[a];l.blockedOn===t&&(l.blockedOn=null)}for(;0<$r.length&&(a=$r[0],a.blockedOn===null);)Lp(a),a.blockedOn===null&&$r.shift();if(a=(t.ownerDocument||t).$$reactFormReplay,a!=null)for(l=0;l<a.length;l+=3){var f=a[l],m=a[l+1],x=f[en]||null;if(typeof m=="function")x||Bp(a);else if(x){var j=null;if(m&&m.hasAttribute("formAction")){if(f=m,x=m[en]||null)j=x.formAction;else if(kc(f)!==null)continue}else j=x.action;typeof j=="function"?a[l+1]=j:(a.splice(l,3),l-=3),Bp(a)}}}function Hp(){function t(m){m.canIntercept&&m.info==="react-transition"&&m.intercept({handler:function(){return new Promise(function(x){return f=x})},focusReset:"manual",scroll:"manual"})}function n(){f!==null&&(f(),f=null),l||setTimeout(a,20)}function a(){if(!l&&!navigation.transition){var m=navigation.currentEntry;m&&m.url!=null&&navigation.navigate(m.url,{state:m.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,f=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){l=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),f!==null&&(f(),f=null)}}}function Cc(t){this._internalRoot=t}Dl.prototype.render=Cc.prototype.render=function(t){var n=this._internalRoot;if(n===null)throw Error(s(409));var a=n.current,l=xn();Ip(a,l,t,n,null,null)},Dl.prototype.unmount=Cc.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var n=t.containerInfo;Ip(t.current,2,null,t,null,null),fl(),n[ki]=null}};function Dl(t){this._internalRoot=t}Dl.prototype.unstable_scheduleHydration=function(t){if(t){var n=Kd();t={blockedOn:null,target:t,priority:n};for(var a=0;a<$r.length&&n!==0&&n<$r[a].priority;a++);$r.splice(a,0,t),a===0&&Lp(t)}};var Up=r.version;if(Up!=="19.2.8")throw Error(s(527,Up,"19.2.8"));H.findDOMNode=function(t){var n=t._reactInternals;if(n===void 0)throw typeof t.render=="function"?Error(s(188)):(t=Object.keys(t).join(","),Error(s(268,t)));return t=g(n),t=t!==null?v(t):null,t=t===null?null:t.stateNode,t};var _S={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:D,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ol=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ol.isDisabled&&Ol.supportsFiber)try{mt=Ol.inject(_S),Le=Ol}catch{}}return ls.createRoot=function(t,n){if(!o(t))throw Error(s(299));var a=!1,l="",f=Yh,m=Kh,x=Xh;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(l=n.identifierPrefix),n.onUncaughtError!==void 0&&(f=n.onUncaughtError),n.onCaughtError!==void 0&&(m=n.onCaughtError),n.onRecoverableError!==void 0&&(x=n.onRecoverableError)),n=Ep(t,1,!1,null,null,a,l,null,f,m,x,Hp),t[ki]=n.current,ac(t),new Cc(n)},ls.hydrateRoot=function(t,n,a){if(!o(t))throw Error(s(299));var l=!1,f="",m=Yh,x=Kh,j=Xh,L=null;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(m=a.onUncaughtError),a.onCaughtError!==void 0&&(x=a.onCaughtError),a.onRecoverableError!==void 0&&(j=a.onRecoverableError),a.formState!==void 0&&(L=a.formState)),n=Ep(t,1,!0,n,a??null,l,f,L,m,x,j,Hp),n.context=Np(null),a=n.current,l=xn(),l=hn(l),f=Tr(l),f.callback=null,Er(a,f,l),a=l,n.current.lanes=a,_t(n,a),Fn(n),t[ki]=n.current,ac(t),new Dl(n)},ls.version="19.2.8",ls}var Qp;function FS(){if(Qp)return Tc.exports;Qp=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(r){console.error(r)}}return e(),Tc.exports=GS(),Tc.exports}var PS=FS();function fi(e){if(e==null)return null;if(typeof e=="string")return e.trim()||null;if(typeof e=="number"||typeof e=="boolean")return String(e);if(typeof e=="object"){const r=e;if(typeof r.text=="string"&&r.text.trim())return r.text.trim();if(typeof r.errorMessage=="string"&&r.errorMessage.trim())return r.errorMessage.trim();if(Array.isArray(r.content)){const i=r.content.map(s=>{if(typeof s=="string")return s;if(s&&typeof s=="object"){const o=s;if(typeof o.text=="string")return o.text}return""}).filter(Boolean);if(i.length)return i.join(`
|
|
10
|
+
`).slice(0,240)}if(typeof r.role=="string")return`${r.role} 消息`}return null}function VS(e){const r=fi(e.at)??fi(e.timestamp)??fi(e.recordedAt)??"",i=fi(e.errorMessage)??fi(e.label)??fi(e.type)??fi(e.message)??"运行事件";return r?`${r} · ${i}`:i}function fs(e){return String(e.nodeId??e.id??"").trim()}function Ac(e){const r=fs(e);return String(e.label??e.name??(r||"未命名节点"))}function Zp(e,r){if(e.length===0)return;const i=r?.trim();if(i){const c=e.find(d=>fs(d)===i);if(c)return c}const s=e.find(c=>{const d=String(c.status??"").toLowerCase();return d.includes("fail")||d.includes("error")||d==="blocked"});return s||(e.find(c=>{const d=String(c.status??"").toLowerCase();return d==="running"||d==="in_progress"||d==="active"})??e[0])}function YS({dagRunId:e,nodeId:r,onClose:i,onOpenFull:s}){const o=S.useRef(null),[c,d]=S.useState(null),[h,p]=S.useState([]),[g,v]=S.useState(null),[y,k]=S.useState(!0);S.useEffect(()=>{o.current?.focus();const R=A=>{A.key==="Escape"&&i()};return document.addEventListener("keydown",R),document.title=`检视 · DAG ${e} · Loop Operator`,()=>document.removeEventListener("keydown",R)},[e,i]),S.useEffect(()=>{const R=new AbortController;return k(!0),v(null),p([]),(async()=>{try{const A=await fetch(`/api/dag-runs/${encodeURIComponent(e)}`,{signal:R.signal,credentials:"same-origin"});if(!A.ok)throw new Error(`DAG 查询失败(HTTP ${A.status})`);const E=await A.json();if(R.signal.aborted)return;d(E);const F=Array.isArray(E.nodes)?E.nodes:[],K=Zp(F,r),O=K?fs(K):r?.trim();if(O){const P=await fetch(`/api/dag-runs/${encodeURIComponent(e)}/nodes/${encodeURIComponent(O)}/session-events`,{signal:R.signal,credentials:"same-origin"});if(P.ok){const Y=await P.json();R.signal.aborted||p((Y.events??[]).slice(-20))}}}catch(A){R.signal.aborted||v(A instanceof Error?A.message:String(A))}finally{R.signal.aborted||k(!1)}})(),()=>R.abort()},[e,r]);const b=S.useMemo(()=>Array.isArray(c?.nodes)?c.nodes:[],[c]),w=Zp(b,r),N=w?fs(w):"",z=String(c?.effectiveStatus??c?.status??(y?"加载中…":"未知"));return u.jsxs("aside",{className:"inspect-split-panel","aria-label":"DAG 紧凑检视",children:[u.jsxs("div",{className:"inspect-split-header",children:[u.jsxs("div",{children:[u.jsx("p",{className:"inspect-split-kicker",children:"Inspect"}),u.jsx("h2",{children:"检视 DAG"})]}),u.jsx("button",{ref:o,type:"button","aria-label":"关闭检视面板",onClick:i,children:"关闭"})]}),u.jsx("p",{className:"inspect-split-id",children:u.jsx("code",{children:e})}),g?u.jsx("p",{className:"error",children:g}):null,y&&!c?u.jsx("p",{className:"muted",children:"正在加载 DAG…"}):null,u.jsxs("dl",{className:"inspect-split-facts",children:[u.jsxs("div",{children:[u.jsx("dt",{children:"状态"}),u.jsx("dd",{children:z})]}),u.jsxs("div",{children:[u.jsx("dt",{children:"当前节点"}),u.jsx("dd",{children:w?Ac(w):"暂无节点"})]}),u.jsxs("div",{children:[u.jsx("dt",{children:"节点状态"}),u.jsx("dd",{children:w?.status??"—"})]}),w?.errorPreview?u.jsxs("div",{children:[u.jsx("dt",{children:"错误摘要"}),u.jsx("dd",{children:w.errorPreview})]}):null]}),u.jsxs("section",{children:[u.jsxs("h3",{children:["节点(",b.length,")"]}),b.length?u.jsx("ul",{className:"inspect-split-nodes",children:b.slice(0,24).map(R=>{const A=fs(R)||Ac(R),E=A===N;return u.jsxs("li",{"data-active":E?"true":void 0,className:E?"is-active":void 0,children:[u.jsx("span",{children:Ac(R)}),u.jsx("code",{children:R.status??"—"})]},A)})}):u.jsx("p",{className:"muted",children:y?"加载节点中…":"该运行暂无节点。"})]}),u.jsxs("section",{children:[u.jsxs("h3",{children:["最近事件",N?` · ${N}`:""]}),h.length?u.jsx("ul",{className:"inspect-split-events",children:h.map((R,A)=>u.jsx("li",{children:VS(R)},`${R.at??A}-${A}`))}):u.jsx("p",{className:"muted",children:y?"加载事件中…":"节点事件将在可用时显示。"})]}),u.jsx("button",{type:"button",className:"btn btn-secondary",onClick:s,children:"全屏观测"}),u.jsx("p",{className:"muted",children:"全屏后点顶栏「返回操作台」可回来。"})]})}function KS(e){const{board:r,busy:i}=e;return u.jsxs("details",{className:"night-advanced","data-testid":"night-advanced",open:r.advancedOpen,onToggle:s=>r.setAdvancedOpen(s.target.open),children:[u.jsx("summary",{children:"高级 / Inspect"}),u.jsxs("p",{className:"muted",children:["只读深链:"," ",u.jsx("a",{className:"external-link",href:"/inspect/#/night",children:"/inspect/#/night"})]}),u.jsx("div",{className:"cta-row",children:u.jsx("button",{type:"button",className:"btn btn-secondary",disabled:i,"data-testid":"night-morning-btn",onClick:()=>{r.onMorningReport()},children:"早晨 night 报告"})}),r.morningPreview?u.jsx("pre",{className:"cmd","data-testid":"night-morning-preview",children:r.morningPreview}):null]})}function Ml(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function kt(e,r){const i=e[r];return typeof i=="string"&&i.trim()?i.trim():void 0}function Jp(e,r){const i=e[r];if(!Array.isArray(i))return;const s=i.filter(o=>typeof o=="string");return s.length>0?s:void 0}function XS(e){const r=Ml(e);if(!r)return null;const i=Ml(r.result),s=[Ml(r.reviewPacket),i?Ml(i.reviewPacket):null,i,r].filter(Boolean);for(const o of s){const c=kt(o,"scheduleId")??kt(o,"id"),d=kt(o,"gateToken")??kt(o,"approveGate")??kt(o,"writeSetGateToken");if(!(!c||!d))return{scheduleId:c,gateToken:d,...kt(o,"featureId")?{featureId:kt(o,"featureId")}:{},...kt(o,"taskId")?{taskId:kt(o,"taskId")}:{},...Jp(o,"writeSet")?{writeSet:Jp(o,"writeSet")}:{},...kt(o,"worktreePath")?{worktreePath:kt(o,"worktreePath")}:{},...kt(o,"branch")?{branch:kt(o,"branch")}:{},...kt(o,"baseBranch")?{baseBranch:kt(o,"baseBranch")}:{},...kt(o,"baseCommit")?{baseCommit:kt(o,"baseCommit")}:{},...kt(o,"executeAtUtc")?{executeAtUtc:kt(o,"executeAtUtc")}:{},...kt(o,"taskCard")?{taskCard:kt(o,"taskCard")}:{}}}return null}function Wp(e){return`docs/features/${e.trim().replace(/^\/+|\/+$/g,"")}`}function QS(e){const r=e.trim(),i=/^(\d{4}-\d{2}-\d{2})[T ](\d{2}:\d{2})/.exec(r);return i?`${i[1]} ${i[2]}`:null}function eg(){const e=new Date;e.setHours(20,0,0,0);const r=i=>String(i).padStart(2,"0");return`${e.getFullYear()}-${r(e.getMonth()+1)}-${r(e.getDate())}T${r(e.getHours())}:${r(e.getMinutes())}`}function jy(e){if(!e)return"—";const r=Date.parse(e);if(Number.isNaN(r))return e;try{return new Intl.DateTimeFormat("zh-CN",{dateStyle:"short",timeStyle:"short",timeZone:"Asia/Shanghai"}).format(new Date(r))}catch{return e}}function ZS(e){return e.mergeState==="pending-harvest"||/\bscheduler harvest\b/i.test(e.nextAction)}function JS(e){return e.status==="failed"||e.status==="human_required"||e.status==="cancelled"||/\bscheduler discard\b/i.test(e.nextAction)}function Gl(e){return e==="failed"||e==="human_required"}function WS(e){return`${e}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function Ty(e){return{submitted:"已提交",validating:"校验中",validated:"待预约确认",scheduled:"已预约",waiting:"等待触发",dispatching:"派发中",running:"执行中",succeeded:"成功",failed:"失败",human_required:"需人工",cancelled:"已取消",rejected:"已拒绝",cancel_requested:"取消中"}[e]??e}function e0(e){const{target:r,reason:i,onReasonChange:s,force:o,onForceChange:c,busy:d}=e;return u.jsxs("div",{className:"night-discard-card","data-testid":"night-discard-card",children:[u.jsx("h3",{children:"确认 Discard"}),u.jsxs("p",{className:"muted",children:[r.featureId,"/",r.taskId,"(",Ty(r.status),")"]}),u.jsxs("label",{className:"field",children:[u.jsx("span",{className:"muted",children:"原因"}),u.jsx("input",{"data-testid":"night-discard-reason",value:i,disabled:d,placeholder:"human discard reason",onChange:h=>s(h.target.value)})]}),Gl(r.status)?u.jsxs("label",{className:"field checkbox-field",children:[u.jsx("input",{type:"checkbox","data-testid":"night-discard-force",checked:o,disabled:d,onChange:h=>c(h.target.checked)}),u.jsx("span",{className:"muted",children:"强制 Discard(failed / human_required)"})]}):null,u.jsxs("div",{className:"cta-row",children:[u.jsx("button",{type:"button",className:"btn btn-primary",disabled:d||Gl(r.status)&&!o,"data-testid":"night-discard-confirm",onClick:e.onConfirm,children:"确认 Discard"}),u.jsx("button",{type:"button",className:"btn btn-secondary",disabled:d,onClick:e.onCancel,children:"返回"})]})]})}function t0(e){const{board:r}=e,{doctor:i,list:s,clockHint:o,doctorIssues:c,auxTicker:d}=r;return u.jsxs("div",{className:"night-health","data-testid":"night-health-bar",children:[u.jsxs("div",{className:"night-health-main",children:[u.jsx("span",{className:`night-health-pill${i?.ok===!1?" is-bad":""}`,children:i?.ok===!1?"Scheduler 异常":"Scheduler 健康"}),u.jsxs("span",{className:"muted",children:["计划 ",i?.scheduleCount??s?.summary.total??"—"," · 活动"," ",i?.activeCount??s?.summary.active??"—"]})]}),o?u.jsxs("p",{className:"muted night-health-hint","data-testid":"night-clock-hint",children:["时钟:",o.message,"(安装/启停请用 CLI:",u.jsx("code",{children:"agent-worker scheduler clock status --repo ."}),")"]}):u.jsxs("p",{className:"muted night-health-hint",children:["到点执行依赖本机 clock / tick,不在此面板安装。详见"," ",u.jsx("a",{className:"external-link",href:"/inspect/#/night",children:"/inspect/#/night"})]}),u.jsxs("div",{className:"night-aux-ticker","data-testid":"night-aux-ticker",children:[u.jsxs("p",{className:"night-aux-ticker-label",children:["开着 Console 时辅助 tick(每 ",d?.intervalSec??60,"s)"]}),u.jsx("p",{className:"muted night-health-hint","data-testid":"night-aux-ticker-disclaimer",children:d?.disclaimer??"仅在本 Console 进程开着时有效;过夜无人值守仍需 OS clock。"}),d?.lastOutcome?u.jsxs("p",{className:"muted","data-testid":"night-aux-ticker-last",children:["上次:",d.lastOutcome,d.running?"(进行中)":"",d.lastSummary?` · ${d.lastSummary}`:"",d.lastError?` · ${d.lastError}`:""]}):null]}),c.length>0?u.jsx("ul",{className:"night-doctor-list","data-testid":"night-doctor-findings",children:c.slice(0,4).map(h=>u.jsxs("li",{children:[u.jsx("strong",{children:h.severity})," ",h.message]},`${h.code}-${h.scheduleId??""}-${h.message}`))}):null]})}function n0(e){const{board:r,busy:i,onHarvest:s,onOpenDiscard:o}=e,{list:c}=r;return u.jsxs(u.Fragment,{children:[c?u.jsxs("div",{className:"night-kpi","data-testid":"night-kpi",children:[u.jsxs("span",{children:["合计 ",c.summary.total]}),u.jsxs("span",{children:["活动 ",c.summary.active]}),u.jsxs("span",{children:["待收成 ",c.summary.pendingHarvest]}),u.jsxs("span",{children:["需人工 ",c.summary.humanRequired]}),u.jsxs("span",{children:["失败 ",c.summary.failed]})]}):null,u.jsxs("div",{className:"night-board","data-testid":"night-board",children:[u.jsx("h3",{children:"计划列表"}),!c||c.schedules.length===0?u.jsxs("div",{className:"empty-state","data-testid":"night-board-empty",children:[u.jsx("p",{className:"empty-title",children:"暂无夜间计划"}),u.jsx("p",{className:"muted",children:"用下方向导预约第一个任务。"})]}):u.jsx("ul",{className:"night-schedule-list",children:c.schedules.map(d=>u.jsxs("li",{className:"night-schedule-row","data-testid":"night-schedule-row","data-status":d.status,children:[u.jsxs("div",{className:"night-schedule-head",children:[u.jsxs("strong",{children:[d.featureId,"/",d.taskId]}),u.jsx("span",{className:"night-status-chip",children:Ty(d.status)})]}),u.jsxs("p",{className:"muted",children:["执行 ",jy(d.executeAtUtc),d.mergeState?` · merge ${d.mergeState}`:"",d.taskCard?` · ${d.taskCard}`:""]}),d.waitingReason?u.jsxs("p",{className:"muted",children:["等待原因:",d.waitingReason]}):null,u.jsxs("p",{className:"muted night-next-action",children:["下一步:",d.nextAction]}),u.jsxs("div",{className:"cta-row",children:[ZS(d)?u.jsx("button",{type:"button",className:"btn btn-primary",disabled:i,"data-testid":"night-row-harvest",onClick:()=>s(d),children:"Harvest"}):null,JS(d)?u.jsx("button",{type:"button",className:"btn btn-secondary",disabled:i,"data-testid":"night-row-discard",onClick:()=>o(d),children:"Discard"}):null,u.jsx("a",{className:"external-link",href:`/inspect/#/night/${encodeURIComponent(d.scheduleId)}`,children:"Inspect"})]})]},d.scheduleId))})]})]})}function r0(e){const{wizard:r,busy:i}=e;return u.jsxs("div",{className:"night-wizard","data-testid":"night-wizard",children:[u.jsx("h3",{children:"预约夜间任务"}),r.phase==="pick"?u.jsxs(u.Fragment,{children:[r.selectableTasks.length===0?u.jsxs("div",{className:"empty-state","data-testid":"night-task-empty",children:[u.jsx("p",{className:"empty-title",children:"没有可选任务"}),u.jsx("p",{className:"muted",children:"请先在 Feature Packet / Task Pool 中创建任务,再回到此处刷新。"})]}):u.jsxs("label",{className:"field",children:[u.jsx("span",{className:"muted",children:"Feature / Task"}),u.jsxs("select",{"data-testid":"night-task-select",value:r.selectedKey,disabled:i,onChange:s=>r.setSelectedKey(s.target.value),children:[u.jsx("option",{value:"",children:"选择任务…"}),r.selectableTasks.map(s=>{const o=`${s.featureId}::${s.taskId}`;return u.jsxs("option",{value:o,children:[s.featureId,"/",s.taskId,s.status?` · ${s.status}`:""]},o)})]})]}),r.derivedFeatureDir?u.jsxs("p",{className:"muted","data-testid":"night-feature-dir",children:["Feature 目录:",u.jsx("code",{children:r.derivedFeatureDir})]}):null,u.jsxs("label",{className:"field",children:[u.jsx("span",{className:"muted",children:"本地执行时间"}),u.jsx("input",{type:"datetime-local","data-testid":"night-at",value:r.nightAt,disabled:i,onChange:s=>r.setNightAt(s.target.value)})]}),u.jsxs("label",{className:"field",children:[u.jsx("span",{className:"muted",children:"任务卡片(可选)"}),u.jsx("input",{"data-testid":"night-task-card",value:r.taskCard,disabled:i,placeholder:"UCP-LOOP#11",onChange:s=>r.setTaskCard(s.target.value)})]}),u.jsx("div",{className:"cta-row",children:u.jsx("button",{type:"button",className:"btn btn-primary",disabled:i||!r.selectedKey||!r.nightAt,"data-testid":"night-prepare-btn",onClick:()=>{r.onPrepare()},children:"准备并审阅"})})]}):u.jsxs("div",{className:"night-review-card","data-testid":"night-review-card",children:[u.jsx("p",{className:"muted",children:"请确认 writeSet 与执行环境后预约。Token 已隐藏。"}),u.jsxs("dl",{className:"kv",children:[u.jsxs("div",{children:[u.jsx("dt",{children:"Schedule"}),u.jsx("dd",{children:u.jsx("code",{children:r.review?.scheduleId})})]}),u.jsxs("div",{children:[u.jsx("dt",{children:"任务"}),u.jsxs("dd",{children:[r.review?.featureId,"/",r.review?.taskId]})]}),u.jsxs("div",{children:[u.jsx("dt",{children:"执行时间 (UTC)"}),u.jsx("dd",{children:jy(r.review?.executeAtUtc)})]}),u.jsxs("div",{children:[u.jsx("dt",{children:"Worktree"}),u.jsx("dd",{children:u.jsx("code",{children:r.review?.worktreePath??"—"})})]}),u.jsxs("div",{children:[u.jsx("dt",{children:"分支"}),u.jsx("dd",{children:u.jsx("code",{children:r.review?.branch??"—"})})]}),u.jsxs("div",{children:[u.jsx("dt",{children:"Base"}),u.jsx("dd",{children:u.jsxs("code",{children:[r.review?.baseBranch??"—","@",(r.review?.baseCommit??"").slice(0,12)||"—"]})})]}),u.jsxs("div",{children:[u.jsx("dt",{children:"WriteSet"}),u.jsx("dd",{children:r.review?.writeSet&&r.review.writeSet.length>0?u.jsx("ul",{className:"night-writeset",children:r.review.writeSet.map(s=>u.jsx("li",{children:u.jsx("code",{children:s})},s))}):u.jsx("span",{className:"muted",children:"(未返回显式 writeSet)"})})]})]}),u.jsxs("div",{className:"cta-row",children:[u.jsx("button",{type:"button",className:"btn btn-primary",disabled:i||!r.review,"data-testid":"night-confirm-add-btn",onClick:()=>{r.onConfirmAdd()},children:"确认预约"}),u.jsx("button",{type:"button",className:"btn btn-secondary",disabled:i,"data-testid":"night-review-back-btn",onClick:r.onCancelWizard,children:"返回修改"})]})]})]})}function i0(e){const{setOpError:r}=e,[i,s]=S.useState(null),[o,c]=S.useState(null),[d,h]=S.useState([]),[p,g]=S.useState(null),[v,y]=S.useState(!1),[k,b]=S.useState(!1),[w,N]=S.useState(null),[z,R]=S.useState(null),A=S.useCallback(async()=>{y(!0),g(null);try{const[O,P,Y,le]=await Promise.all([fetch("/api/night-jobs",{credentials:"same-origin"}),fetch("/api/night-jobs/doctor",{credentials:"same-origin"}),fetch("/api/tasks",{credentials:"same-origin"}),fetch("/api/operator/v1/night-aux-ticker",{credentials:"same-origin"})]);if(!O.ok)throw new Error(`加载计划列表失败(HTTP ${O.status})`);const _=await O.json();if(s(_),P.ok?c(await P.json()):c(null),Y.ok){const V=await Y.json();h(Array.isArray(V)?V:[])}else h([]);if(le.ok){const V=await le.json();V.ticker&&R(V.ticker)}}catch(O){g(O instanceof Error?O.message:String(O))}finally{y(!1)}},[]);S.useEffect(()=>{A()},[A]);const E=S.useCallback(async()=>{try{const O=await fetch("/api/night-jobs/morning",{credentials:"same-origin"});if(!O.ok){r(`早晨报告加载失败(HTTP ${O.status})`);return}const P=await O.json();N(JSON.stringify(P,null,2).slice(0,4e3)),b(!0)}catch(O){r(O instanceof Error?O.message:String(O))}},[r]),F=(o?.findings??[]).filter(O=>O.severity==="error"||O.severity==="warning"),K=(o?.findings??[]).find(O=>/clock/i.test(O.code)||/clock/i.test(O.message));return{list:i,doctor:o,tasks:d,loadError:p,loadingBoard:v,advancedOpen:k,setAdvancedOpen:b,morningPreview:w,auxTicker:z,refreshBoard:A,onMorningReport:E,doctorIssues:F,clockHint:K}}function a0(e){const{board:r,runAction:i,isActionSuccess:s,setOpError:o}=e,{tasks:c,refreshBoard:d}=r,[h,p]=S.useState("pick"),[g,v]=S.useState(""),[y,k]=S.useState(eg),[b,w]=S.useState(""),[N,z]=S.useState(null),[R,A]=S.useState(""),[E,F]=S.useState(null),[K,O]=S.useState(!1),P=S.useMemo(()=>{const H=c.filter(B=>typeof B.featureId=="string"&&B.featureId.trim()&&B.taskId);return H.sort((B,te)=>{const T=B.featureId??"",I=te.featureId??"";return T!==I?T.localeCompare(I):B.taskId.localeCompare(te.taskId)}),H},[c]),Y=S.useMemo(()=>g?P.find(H=>`${H.featureId}::${H.taskId}`===g)??null:null,[P,g]),le=Y?.featureId?Wp(Y.featureId):"",_=S.useCallback(async(H,B,te)=>{const T=await i("prepareMutationGate",{action:H,actionParams:B});if(!s(T))return;const I=T?.result??T,U=I.receiptId?I:I.result??I;if(!U.receiptId||!U.humanGateToken){o("prepareMutationGate 未返回可消费的 Human Gate receipt");return}return i(H,{...B,confirmationId:U.receiptId,humanGateToken:U.humanGateToken},{clientRequestId:WS(te)})},[s,i,o]),V=S.useCallback(async()=>{if(!Y?.featureId){o("请先点选 Feature / Task");return}const H=QS(y);if(!H){o("执行时间格式无效,请使用日期时间选择器");return}const B={featureDir:Wp(Y.featureId),taskId:Y.taskId,at:H,tz:"Asia/Shanghai",...b.trim()?{taskCard:b.trim()}:{}},te=await _("workerAdmissionPrepare",B,"night-prepare");if(!s(te))return;const T=XS(te?.result??te);if(!T){o("准备成功但未解析到 scheduleId / gateToken。请刷新后重试,或查看 Inspect。");return}z(T),p("review")},[s,y,_,Y,o,b]),G=S.useCallback(async()=>{if(!N)return;const H=await _("workerSchedulerAdd",{scheduleId:N.scheduleId,approveGate:N.gateToken},"night-add");s(H)&&(z(null),p("pick"),v(""),w(""),k(eg()),await d())},[s,d,N,_]),ne=S.useCallback(()=>{p("pick"),z(null)},[]),q=S.useCallback(async H=>{const B=await _("workerSchedulerHarvest",{scheduleId:H.scheduleId},"night-harvest");s(B)&&await d()},[s,d,_]),M=S.useCallback(async()=>{if(!E)return;const H=R.trim()||"discard from console night workbench",B=Gl(E.status),te=await _("workerSchedulerDiscard",{scheduleId:E.scheduleId,reason:H,...B||K?{force:!0}:{}},"night-discard");s(te)&&(F(null),A(""),O(!1),await d())},[R,E,K,s,d,_]),D=S.useCallback(H=>{F(H),O(Gl(H.status)),A("")},[]);return{phase:h,selectedKey:g,setSelectedKey:v,nightAt:y,setNightAt:k,taskCard:b,setTaskCard:w,review:N,discardReason:R,setDiscardReason:A,discardTarget:E,setDiscardTarget:F,forceDiscard:K,setForceDiscard:O,selectableTasks:P,derivedFeatureDir:le,onPrepare:V,onConfirmAdd:G,onCancelWizard:ne,onHarvest:q,onDiscard:M,openDiscard:D}}function s0({busy:e,runAction:r,isActionSuccess:i,setOpError:s}){const o=i0({setOpError:s}),c=a0({board:o,runAction:r,isActionSuccess:i,setOpError:s});return u.jsxs("section",{className:"panel night-workbench","aria-labelledby":"night-title","data-testid":"night-jobs-panel",children:[u.jsx("h2",{id:"night-title",children:"夜间任务"}),u.jsx("p",{className:"panel-lead",children:"白天点选任务并预约;列表查看状态;早晨在行内收成或丢弃。写操作仍经 Human Gate,列表复用 Inspect 投影。"}),u.jsx(t0,{board:o,busy:e}),u.jsx("div",{className:"cta-row",children:u.jsx("button",{type:"button",className:"btn btn-secondary",disabled:e||o.loadingBoard,"data-testid":"night-refresh-btn",onClick:()=>{o.refreshBoard()},children:"刷新看板"})}),o.loadError?u.jsx("p",{className:"error","data-testid":"night-load-error",children:o.loadError}):null,u.jsx(n0,{board:o,busy:e,onHarvest:d=>{c.onHarvest(d)},onOpenDiscard:c.openDiscard}),c.discardTarget?u.jsx(e0,{target:c.discardTarget,reason:c.discardReason,onReasonChange:c.setDiscardReason,force:c.forceDiscard,onForceChange:c.setForceDiscard,busy:e,onConfirm:()=>{c.onDiscard()},onCancel:()=>c.setDiscardTarget(null)}):null,u.jsx(r0,{wizard:c,busy:e}),u.jsx(KS,{board:o,busy:e})]})}var Ey=Ry();const l0=({color:e="currentColor",size:r=24,className:i,...s})=>Yr.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:e,...s,className:"remixicon "+(i||"")},Yr.createElement("path",{d:"M3 10H2V4.00293C2 3.44903 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.43788 22 4.00293V10H21V20.0015C21 20.553 20.5551 21 20.0066 21H3.9934C3.44476 21 3 20.5525 3 20.0015V10ZM19 10H5V19H19V10ZM4 5V8H20V5H4ZM9 12H15V14H9V12Z"})),o0=({color:e="currentColor",size:r=24,className:i,...s})=>Yr.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:e,...s,className:"remixicon "+(i||"")},Yr.createElement("path",{d:"M17 6H22V8H20V21C20 21.5523 19.5523 22 19 22H5C4.44772 22 4 21.5523 4 21V8H2V6H7V3C7 2.44772 7.44772 2 8 2H16C16.5523 2 17 2.44772 17 3V6ZM18 8H6V20H18V8ZM9 11H11V17H9V11ZM13 11H15V17H13V11ZM9 4V6H15V4H9Z"})),u0=({color:e="currentColor",size:r=24,className:i,...s})=>Yr.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:e,...s,className:"remixicon "+(i||"")},Yr.createElement("path",{d:"M6.41421 15.89L16.5563 5.74785L15.1421 4.33363L5 14.4758V15.89H6.41421ZM7.24264 17.89H3V13.6473L14.435 2.21231C14.8256 1.82179 15.4587 1.82179 15.8492 2.21231L18.6777 5.04074C19.0682 5.43126 19.0682 6.06443 18.6777 6.45495L7.24264 17.89ZM3 19.89H21V21.89H3V19.89Z"})),c0=({color:e="currentColor",size:r=24,className:i,...s})=>Yr.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:e,...s,className:"remixicon "+(i||"")},Yr.createElement("path",{d:"M12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12H4C4 16.4183 7.58172 20 12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C9.25022 4 6.82447 5.38734 5.38451 7.50024L8 7.5V9.5H2V3.5H4L3.99989 5.99918C5.82434 3.57075 8.72873 2 12 2ZM13 7L12.9998 11.585L16.2426 14.8284L14.8284 16.2426L10.9998 12.413L11 7H13Z"})),d0=["command","query","operation","tool","server","symbol","path","file_path","filePath","pattern","glob","url"],f0=120,h0=800;function Fl(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function m0(e){if(e!=null){if(typeof e=="string"){const r=e.trim();if(!r)return;try{return Fl(JSON.parse(r))}catch{return}}return Fl(e)}}function pr(e,r){const i=e.replace(/\s+/g," ").trim();return i?i.length>r?`${i.slice(0,r)}…`:i:""}function Ot(e,r){const i=e[r];if(typeof i=="string"&&i.trim())return i.trim();if(typeof i=="number"&&Number.isFinite(i))return String(i)}function p0(e,r,i){const s=(e??"").toLowerCase();if(s==="bash"||s==="shell"){const o=Ot(r,"command");return o?pr(o,i):void 0}if(s==="mcp"||s.startsWith("mcp_")){const o=Ot(r,"server"),c=Ot(r,"tool")??Ot(r,"name"),d=Ot(r,"query");return o&&c?pr(`${o} · ${c}`,i):c?pr(c,i):d?pr(d,i):o?pr(o,i):void 0}if(s==="lsp_navigation"||s.includes("lsp")){const o=[Ot(r,"operation"),Ot(r,"symbol"),Ot(r,"path")??Ot(r,"file_path")??Ot(r,"filePath")].filter(Boolean),c=Ot(r,"line")??Ot(r,"position");if(o.length===0&&!c)return;const d=o.join(" · ");return pr(c?`${d}${d?":":""}${c}`:d,i)}if(s==="symbol_search"||s.includes("symbol_search")){const o=Ot(r,"query")??Ot(r,"symbol");return o?pr(o,i):void 0}if(s==="read"||s==="read_symbol"||s==="read_enclosing"||s.startsWith("read_")){const o=Ot(r,"path")??Ot(r,"file_path")??Ot(r,"filePath"),c=Ot(r,"symbol"),d=Ot(r,"line");if(!o&&!c)return;const h=[o,c,d].filter(Boolean);return pr(h.join(" · "),i)}}function g0(e,r){const i=r?.maxLen??f0,s=m0(e);if(!s){if(typeof e=="string"){const p=e.replace(/\s+/g," ").trim();return!p||p==="{}"?"":p.length>i?`${p.slice(0,i)}…`:p}return""}const o=p0(r?.toolName,s,i);if(o)return o;for(const p of d0){const g=s[p];if(typeof g=="string"&&g.trim())return pr(g,i)}const c=Object.keys(s);if(c.length===0)return"";const d=s[c[0]],h=String(d??"").replace(/\s+/g," ").trim();return h?h.length>i?`${h.slice(0,i)}…`:h:""}function y0(e){const r=(e??"").toLowerCase();return r==="bash"||r==="shell"?{argsLabel:"命令",resultLabel:"输出"}:r==="mcp"||r.startsWith("mcp_")?{argsLabel:"参数",resultLabel:"结果"}:{argsLabel:"入参",resultLabel:"结果"}}function Ny(e){if(e==null)return"";if(typeof e=="string"){const s=e.trim();if(!s)return"";if(s.startsWith("{")&&s.endsWith("}")||s.startsWith("[")&&s.endsWith("]"))try{return Ny(JSON.parse(s))}catch{return e}return e}if(typeof e=="number"||typeof e=="boolean")return String(e);const r=Fl(e);if(!r)try{return JSON.stringify(e,null,2)}catch{return String(e)}const i=r.content;if(Array.isArray(i)){const s=[];for(const o of i){const c=Fl(o);c&&(c.type==="text"&&typeof c.text=="string"||typeof c.text=="string")&&s.push(c.text)}if(s.length>0)return s.join(`
|
|
11
|
+
`)}if(typeof r.text=="string")return r.text;if(typeof r.output=="string")return r.output;if(typeof r.message=="string")return r.message;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function v0(e){if(e==null)return"";try{return typeof e=="string"?e:JSON.stringify(e,null,2)}catch{return String(e)}}function b0(e,r){if(e===void 0)return{text:"",truncated:!1};const i=r?.maxLen??h0;return e.length<=i?{text:e,truncated:!1}:{text:`${e.slice(0,i)}…`,truncated:!0}}function x0(e,r){if(r===void 0||!Number.isFinite(e)||!Number.isFinite(r))return;const i=Math.round((r-e)/1e3);return i>0?i:void 0}function un(){return window.__CONSOLE_CONFIRMATION_TOKEN__??""}function pi(e){return`${e}-${Math.random().toString(36).slice(2,10)}`}function Dc(e,r){return new Promise((i,s)=>{if(r?.aborted){s(new DOMException("Aborted","AbortError"));return}const o=setTimeout(()=>{r?.removeEventListener("abort",c),i()},e),c=()=>{clearTimeout(o),s(new DOMException("Aborted","AbortError"))};r?.addEventListener("abort",c)})}function Iy(e){return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function Oc(e){const r=new Date(e),i=new Date;return r.getFullYear()===i.getFullYear()&&r.getMonth()===i.getMonth()&&r.getDate()===i.getDate()?"今天":r.toLocaleDateString([],{month:"long",day:"numeric"})}function S0(e,r){return e?e.taskId===r.taskId&&e.updatedAt===r.updatedAt&&e.lastEventId===r.lastEventId&&e.operations.length===r.operations.length:!1}const Ay={status:"idle",snapshot:null,error:null,reloading:!1,reloadError:null,mutationBusy:!1,mutationToken:null};function wd(e){if(!e||typeof e!="object")return{message:"runtime snapshot request failed"};const r=e,i=r.error;if(i&&typeof i=="object"){const s=i;return{...typeof s.code=="string"&&s.code?{code:s.code}:{},...typeof r.status=="number"?{status:r.status}:{},message:typeof s.message=="string"&&s.message?s.message:"runtime snapshot request failed"}}return{...typeof r.status=="number"?{status:r.status}:{},message:typeof r=="object"&&"message"in r&&typeof r.message=="string"&&r.message?r.message:"runtime snapshot request failed"}}function k0(e,r){switch(r.type){case"load-start":return{...e,sessionId:r.sessionId,status:"loading",error:null};case"load-success":return e.snapshot&&e.sessionId===r.sessionId&&r.snapshot.revision<e.snapshot.revision?e:{...e,sessionId:r.sessionId,status:"ready",snapshot:r.snapshot,error:null,reloadError:null,reloading:!1};case"load-failure":return{...e,sessionId:r.sessionId,status:"error",error:r.error,snapshot:null};case"reload-start":return e.reloading?e:{...e,reloading:!0,reloadError:null,...e.status==="error"?{error:null}:{}};case"reload-success":return{...e,status:"ready",snapshot:r.snapshot,reloading:!1,reloadError:null,error:null,sessionId:r.snapshot.sessionId||e.sessionId};case"reload-failure":return{...e,reloading:!1,reloadError:r.error};case"mutation-start":return{...e,mutationBusy:!0,mutationToken:r.token};case"mutation-adopt":return e.mutationToken!==r.token||e.sessionId!==void 0&&e.sessionId!==r.sessionId||e.snapshot&&r.snapshot.revision<e.snapshot.revision?e:{...e,sessionId:r.sessionId,status:"ready",snapshot:r.snapshot,error:null,reloadError:null,reloading:!1};case"mutation-settle":return e.mutationToken!==r.token?e:{...e,mutationBusy:!1,mutationToken:null};case"mutation-reset":return{...e,mutationBusy:!1,mutationToken:null};case"reset":return{...Ay};default:return e}}function Dy(e){const r=e.selection;return{...r.model?{model:{provider:r.model.provider,modelId:r.model.id}}:{},...r.thinkingSelection==="auto"?r.effectiveThinkingLevel?{thinkingLevel:r.effectiveThinkingLevel}:{}:{thinkingLevel:r.thinkingSelection}}}function w0(e,r,i,s){const o=i&&i.sessionId===s?Dy(i):{},c=o.model??e?.model,d=o.thinkingLevel??e?.thinkingLevel;return{readOnly:r.readOnly,systemPrompt:r.systemPrompt,resources:r.resources,suffix:r.suffix,...c?{model:c}:{},...d?{thinkingLevel:d}:{}}}function C0(e=Ay){let r=e;const i=new Set;return{getState:()=>r,dispatch:s=>{r=k0(r,s);for(const o of i)o();return r},subscribe:s=>(i.add(s),()=>i.delete(s))}}const bt=C0();let Vr;function Oy(e){return`/api/operator/v1/chat/sessions/${encodeURIComponent(e)}`}function R0(e){const r=Vr;if(Vr=e,!(r&&r.sessionId===e.sessionId&&r.origin===e.origin)){if((!r||r.sessionId!==e.sessionId)&&bt.dispatch({type:"mutation-reset"}),!e.sessionId){bt.dispatch({type:"reset"});return}bt.dispatch({type:"load-start",sessionId:e.sessionId}),My(e.sessionId,e.origin)}}async function My(e,r){try{const i=await fetch(`${r}${Oy(e)}/runtime-snapshot`,{credentials:"include"}),s=await i.json().catch(()=>({}));if(Vr?.sessionId!==e)return;if(!i.ok){bt.dispatch({type:"load-failure",sessionId:e,error:{...wd(s),status:i.status}});return}if(!s.snapshot){bt.dispatch({type:"load-failure",sessionId:e,error:{status:i.status,message:"runtime snapshot missing in response"}});return}bt.dispatch({type:"load-success",sessionId:e,snapshot:s.snapshot})}catch(i){if(Vr?.sessionId!==e)return;bt.dispatch({type:"load-failure",sessionId:e,error:{message:i instanceof Error?i.message:String(i)}})}}async function ca(){const e=Vr;if(!e?.sessionId||bt.getState().reloading)return!1;const r=e.sessionId;bt.dispatch({type:"reload-start"});try{const i=await fetch(`${e.origin}${Oy(r)}/reload`,{method:"POST",credentials:"include",headers:{"content-type":"application/json","x-loop-console-confirmation":un()},body:"{}"}),s=await i.json().catch(()=>({}));return Vr?.sessionId!==r?!1:i.ok?s.snapshot?(bt.dispatch({type:"reload-success",snapshot:s.snapshot}),!0):(bt.dispatch({type:"reload-failure",error:{status:i.status,message:"reload succeeded but snapshot missing"}}),!1):(bt.dispatch({type:"reload-failure",error:{...wd(s),status:i.status}}),!1)}catch(i){return Vr?.sessionId!==r||bt.dispatch({type:"reload-failure",error:{message:i instanceof Error?i.message:String(i)}}),!1}}async function da(){const e=Vr;if(!e?.sessionId)return!1;const r=e.sessionId;return bt.dispatch({type:"load-start",sessionId:r}),My(r,e.origin),!0}function j0(e,r,i){return i?(bt.dispatch({type:"mutation-adopt",token:e,sessionId:r,snapshot:i}),bt.getState().snapshot===i):!1}function T0(e,r,i){return i.sessionRef.current?.sessionId!==r||bt.getState().mutationToken!==e?!1:(bt.dispatch({type:"mutation-settle",token:e}),!0)}function ha(){return S.useSyncExternalStore(bt.subscribe,bt.getState)}function _y(e){bt.dispatch(e)}function E0(){return bt.getState()}function N0(e,r,i){return`${e}/api/operator/v1/chat/sessions/${encodeURIComponent(r)}/skills/${encodeURIComponent(i)}/auto-invocation`}async function I0(e){const r=e.fetchImpl??fetch;try{const i=await r(N0(e.origin,e.sessionId,e.resourceId),{method:"PATCH",credentials:"include",headers:{"content-type":"application/json","x-loop-console-confirmation":e.confirmationToken},body:JSON.stringify({autoInvocationEnabled:e.autoInvocationEnabled})}),s=await i.json().catch(()=>({}));if(!i.ok||s.ok===!1)return{ok:!1,error:{...wd(s),status:i.status}};const o=s.preferenceSaved===!0,c=s.reloadApplied===!0;if(!o)return{ok:!1,error:{status:i.status,code:"PI_RESOURCE_PREFERENCES_WRITE_FAILED",message:"preference was not saved"}};if(!c){const d=s.error?.code??"PI_SESSION_BUSY",h=s.error?.message??"preference saved; current session is busy and was not reloaded";return{ok:!0,preferenceSaved:!0,reloadApplied:!1,...s.snapshot?{snapshot:s.snapshot}:{},partialBusy:{code:d,message:h}}}return{ok:!0,preferenceSaved:!0,reloadApplied:!0,...s.snapshot?{snapshot:s.snapshot}:{}}}catch(i){return{ok:!1,error:{message:i instanceof Error?i.message:String(i)}}}}function A0(e){return e.autoInvocationEnabled?{badge:"允许自动使用",help:"模型可自动选择该技能,也可通过 /skill:<name> 手动调用。"}:{badge:"已隐藏自动使用",help:`已从模型自动技能列表隐藏,仍可通过 /skill:${e.name} 手动调用。`}}const id=()=>window.__CONSOLE_CONFIRMATION_TOKEN__??"";function D0({origin:e}){const[r,i]=S.useState(null),[s,o]=S.useState(null),[c,d]=S.useState(null),[h,p]=S.useState(!1),g=ha(),v=g.snapshot,y=g.reloading,k=g.reloadError,b=v?.diagnostics??[],w=async A=>{i(A),d(null);{o(null);try{const E=await fetch(`${e}/api/operator/v1/pi/models-config`,{credentials:"include"}),F=await E.json();if(!E.ok)throw new Error(F.error?.message??"读取失败");o(F.data)}catch(E){d(E instanceof Error?E.message:String(E))}}},N=async A=>{p(!0),d(null);try{const E=await fetch(`${e}/api/operator/v1/pi/models-config`,{method:"PATCH",credentials:"include",headers:{"content-type":"application/json","x-loop-console-confirmation":id()},body:JSON.stringify(A)}),F=await E.json();if(!E.ok)throw new Error(F.error?.message??"模型配置保存失败");o(F.data)}catch(E){d(E instanceof Error?E.message:String(E))}finally{p(!1)}},z=async(A,E)=>{p(!0),d(null);try{const F=await fetch(`${e}/api/operator/v1/pi/models-config/test`,{method:"POST",credentials:"include",headers:{"content-type":"application/json","x-loop-console-confirmation":id()},body:JSON.stringify({provider:A,modelId:E})}),K=await F.json();if(!F.ok)throw new Error(K.error?.message??"模型测试失败");return K.data?.available===!0}catch(F){return d(F instanceof Error?F.message:String(F)),!1}finally{p(!1)}},R=r==="models"?"Models":r==="skills"?"Skills":"Packages";return u.jsxs("div",{className:"oc-governance",children:[u.jsxs("div",{className:"oc-governance-links",children:[u.jsx("button",{type:"button",onClick:()=>{w("models")},children:"Models"}),u.jsx("button",{type:"button",className:r==="skills"?"is-active":"",onClick:()=>i("skills"),children:"Skills"}),u.jsx("button",{type:"button",className:r==="packages"?"is-active":"",onClick:()=>i("packages"),children:"Packages"})]}),r&&u.jsx("div",{className:"oc-resource-backdrop",onMouseDown:A=>{A.target===A.currentTarget&&i(null)},children:u.jsxs("section",{className:"oc-resource-panel",role:"dialog","aria-modal":"true","aria-label":R,children:[u.jsxs("header",{className:"oc-resource-panel-head",children:[u.jsxs("div",{className:"oc-resource-panel-head-copy",children:[u.jsx("strong",{children:R}),u.jsx("span",{className:"oc-resource-panel-meta",children:r==="models"?"models.json 管理(读写,经 mutation gate)":r==="skills"?"自动使用开关 · 当前 Pi session 实际加载的 Skills":"只读 · 当前 Pi session 实际解析的 Packages"})]}),u.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>i(null),children:"关闭"})]}),u.jsxs("div",{className:"oc-resource-panel-body",children:[b.length>0&&u.jsxs("div",{className:"oc-resource-diagnostics",children:[b.map((A,E)=>u.jsx("div",{className:`oc-resource-diagnostic${A.type==="error"?" is-error":""}`,role:A.type==="error"?"alert":void 0,children:u.jsxs("span",{children:[A.type,A.code?` ${A.code}`:"",":",A.message,A.path?`(${A.path})`:"",A.retryable?" · 可重试":""]})},E)),u.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>{da()},children:"重试"})]}),c&&u.jsx("p",{className:"oc-resource-error",children:c}),r==="models"&&u.jsx(O0,{busy:h,data:s,onMutate:N,onTest:z}),r==="skills"&&u.jsx(M0,{origin:e,sessionId:v?.sessionId,status:g.status,loadError:g.error,skills:v?.skills,hasSession:!!v?.sessionId,hasDiagnostics:b.length>0}),r==="packages"&&u.jsx(z0,{status:g.status,loadError:g.error,packages:v?.packages,hasSession:!!v?.sessionId,hasDiagnostics:b.length>0})]}),u.jsxs("footer",{className:"oc-resource-panel-foot",children:[u.jsx("span",{className:"oc-resource-panel-meta",children:y?"正在重新加载会话…":k?`${k.code??"ERROR"}:${k.message}`:v?`revision ${v.revision} · ${v.loadedAt}`:"等待会话快照…"}),u.jsxs("div",{className:"oc-resource-panel-actions",children:[k&&u.jsx("button",{type:"button",className:"btn btn-ghost",disabled:y,onClick:()=>{ca()},children:"重试"}),g.status==="error"&&u.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>{da()},children:"重新读取快照"}),u.jsx("button",{type:"button",className:"btn btn-ghost",disabled:y,onClick:()=>{ca()},children:"重新加载会话"})]})]})]})})]})}function O0({busy:e,data:r,onMutate:i,onTest:s}){const[o,c]=S.useState(""),[d,h]=S.useState(""),[p,g]=S.useState(""),[v,y]=S.useState(null),k=async b=>{b.preventDefault(),!(!r||!o.trim()||!d.trim())&&(await i({expectedRevision:r.revision,action:"upsert-model",provider:o.trim(),model:{id:d.trim(),...p.trim()?{name:p.trim()}:{}}}),h(""),g(""))};return r?u.jsxs("div",{className:"oc-models-config",children:[u.jsx("p",{className:"oc-resource-panel-meta",children:"Console 不读取或写入 API key;credential 请通过 Pi CLI 配置。"}),r.providers.length===0?u.jsx("p",{className:"oc-resource-empty",children:"models.json 中暂无 Provider(真实空态;用 Pi CLI 配置)。"}):null,r.providers.map(b=>u.jsxs("article",{className:"oc-model-provider",children:[u.jsxs("div",{className:"oc-model-provider-head",children:[u.jsx("strong",{children:b.name}),u.jsx("span",{children:b.credential.configured?"credential configured":"credential 未配置"})]}),b.models.map(w=>u.jsxs("div",{className:"oc-model-row",children:[u.jsx("span",{children:w.name?`${w.name} (${w.id})`:w.id}),u.jsxs("div",{className:"oc-model-row-actions",children:[u.jsx("button",{type:"button",disabled:e,onClick:()=>{s(b.name,w.id).then(N=>y(`${b.name}/${w.id}: ${N?"可用":"不可用"}`))},children:"测试"}),u.jsx("button",{type:"button",disabled:e,onClick:()=>{window.confirm(`确认删除模型 ${b.name}/${w.id}?`)&&i({expectedRevision:r.revision,action:"remove-model",provider:b.name,model:{id:w.id}})},children:"删除"})]})]},w.id)),u.jsx("button",{type:"button",className:"oc-model-provider-remove",disabled:e,onClick:()=>{window.confirm(`确认删除 Provider ${b.name}?`)&&i({expectedRevision:r.revision,action:"remove-provider",provider:b.name})},children:"删除 Provider"})]},b.name)),v&&u.jsx("p",{className:"oc-model-test-result",children:v}),u.jsxs("form",{className:"oc-model-form",onSubmit:b=>{k(b)},children:[u.jsx("strong",{children:"新增或更新模型"}),u.jsx("input",{required:!0,placeholder:"Provider",value:o,onChange:b=>c(b.target.value)}),u.jsx("input",{required:!0,placeholder:"Model ID",value:d,onChange:b=>h(b.target.value)}),u.jsx("input",{placeholder:"显示名称(可选)",value:p,onChange:b=>g(b.target.value)}),u.jsx("button",{type:"submit",disabled:e,children:e?"保存中…":"保存模型"})]})]}):u.jsx("p",{className:"oc-resource-empty",children:"正在读取模型配置…"})}function Ly(e){return e.status==="loading"?u.jsx("p",{className:"oc-resource-empty",children:"会话快照加载中…"}):e.status==="error"?u.jsxs("div",{className:"oc-resource-error",role:"alert",children:[u.jsxs("span",{children:[e.loadError?.code?`${e.loadError.code}:`:"",e.loadError?.message??"会话快照读取失败"]}),u.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>{da()},children:"重试"})]}):e.hasSession?u.jsx("p",{className:"oc-resource-empty",children:e.emptyText}):u.jsx("p",{className:"oc-resource-empty",children:"当前没有活动会话;打开会话后显示真实资源清单(真实空态)。"})}function M0(e){const r=e.skills??[],[i,s]=S.useState(null),[o,c]=S.useState(null),[d,h]=S.useState(null),[p,g]=S.useState({});if(e.status!=="ready"||!e.hasSession)return u.jsx(Ly,{status:e.status,loadError:e.loadError,hasSession:e.hasSession,emptyText:"当前 session 未加载任何 Skills(真实空态)"});if(r.length===0&&!e.hasDiagnostics)return u.jsx("p",{className:"oc-resource-empty",children:"当前 session 未加载任何 Skills(真实空态,未伪造列表)。"});const v=new Map;for(const b of r){const w=b.scope||"unknown",N=v.get(w)??[];N.push(b),v.set(w,N)}const y=b=>Object.prototype.hasOwnProperty.call(p,b.resourceId)?p[b.resourceId]:b.autoInvocationEnabled,k=async(b,w)=>{if(!e.sessionId||!b.resourceId||i)return;y(b),c(null),h(null),s(b.resourceId),g(z=>({...z,[b.resourceId]:w}));const N=await I0({origin:e.origin,sessionId:e.sessionId,resourceId:b.resourceId,autoInvocationEnabled:w,confirmationToken:id()});if(s(null),!N.ok){g(z=>{const R={...z};return delete R[b.resourceId],R}),c(`${N.error.code?`${N.error.code}:`:""}${N.error.message}`);return}if(N.reloadApplied&&N.snapshot){_y({type:"load-success",sessionId:e.sessionId,snapshot:N.snapshot}),g(z=>{const R={...z};return delete R[b.resourceId],R}),h(null);return}!N.reloadApplied&&N.partialBusy&&h(`设置已保存;当前会话正忙(${N.partialBusy.code}),请在本轮结束后点击「重新加载会话」。${N.partialBusy.message}`)};return u.jsxs("div",{className:"oc-resource-lists",children:[o?u.jsx("p",{className:"oc-resource-error",role:"alert",children:o}):null,d?u.jsx("p",{className:"oc-skill-partial-notice",role:"status",children:d}):null,[...v.entries()].map(([b,w])=>u.jsxs("section",{className:"oc-resource-group",children:[u.jsxs("header",{className:"oc-resource-group-head",children:[u.jsx("strong",{children:b}),u.jsxs("span",{children:[w.length," 项"]})]}),u.jsx("ul",{className:"oc-resource-list",children:w.map(N=>{const z=y(N),R=A0({name:N.name,autoInvocationEnabled:z}),A=i===N.resourceId;return u.jsxs("li",{className:`oc-resource-item${z?"":" is-auto-off"}`,children:[u.jsxs("div",{className:"oc-resource-item-head",children:[u.jsx("strong",{children:N.name}),u.jsx("span",{children:R.badge})]}),u.jsxs("label",{className:"oc-skill-auto-toggle",children:[u.jsx("input",{type:"checkbox",checked:z,disabled:A||!N.resourceId,"aria-label":`允许自动使用 ${N.name}`,onChange:E=>{k(N,E.target.checked)}}),u.jsx("span",{children:A?"保存中…":"允许自动使用"})]}),u.jsx("p",{className:"oc-skill-auto-help",children:R.help}),N.description?u.jsx("p",{children:N.description}):null,u.jsx("code",{children:N.path}),N.source?u.jsxs("span",{className:"oc-resource-panel-meta",children:["source: ",N.source]}):null,Array.isArray(N.diagnostics)&&N.diagnostics.length>0?u.jsx("span",{className:"oc-resource-diagnostic",children:N.diagnostics.join(";")}):null]},`${b}:${N.resourceId||N.path}`)})})]},b))]})}const _0={extension:"Extensions",skill:"Skills",prompt:"Prompts",theme:"Themes"};function L0(e){return Array.isArray(e.diagnostics)&&e.diagnostics.length>0?"error":e.enabled?e.version?"installed":"loaded":"disabled"}function z0(e){const r=e.packages??[];return e.status!=="ready"||!e.hasSession?u.jsx(Ly,{status:e.status,loadError:e.loadError,hasSession:e.hasSession,emptyText:"当前 session 未配置 Packages(真实空态)"}):r.length===0&&!e.hasDiagnostics?u.jsx("p",{className:"oc-resource-empty",children:"当前 session 未配置 Packages(真实空态,未伪造列表)。"}):u.jsx("div",{className:"oc-resource-lists",children:r.map(i=>{const s=L0(i),o=new Map;for(const c of i.resolved??[]){const d=_0[c.type]??c.type,h=o.get(d)??[];h.push(c),o.set(d,h)}return u.jsxs("article",{className:"oc-resource-item oc-package",children:[u.jsxs("div",{className:"oc-resource-item-head",children:[u.jsx("strong",{children:i.spec}),u.jsx("span",{className:`oc-package-status is-${s}`,children:s})]}),u.jsxs("p",{className:"oc-resource-panel-meta",children:[i.scope," · ",i.enabled?"loaded":"disabled"]}),i.packageName?u.jsxs("p",{className:"oc-package-meta",children:[u.jsx("span",{children:"package"}),u.jsx("code",{children:i.packageName})]}):null,i.version?u.jsxs("p",{className:"oc-package-meta",children:[u.jsx("span",{children:"installed"}),u.jsxs("code",{children:["v",i.version]})]}):null,i.configuredVersion?u.jsxs("p",{className:"oc-package-meta",children:[u.jsx("span",{children:"configured"}),u.jsx("code",{children:i.configuredVersion})]}):null,i.installedPath?u.jsxs("p",{className:"oc-package-meta",children:[u.jsx("span",{children:"installed path"}),u.jsx("code",{children:i.installedPath})]}):null,i.cwd?u.jsxs("p",{className:"oc-package-meta",children:[u.jsx("span",{children:"cwd"}),u.jsx("code",{children:i.cwd})]}):null,o.size>0?u.jsx("div",{className:"oc-package-resources",children:[...o.entries()].map(([c,d])=>u.jsxs("section",{className:"oc-package-group",children:[u.jsxs("header",{className:"oc-resource-group-head",children:[u.jsx("strong",{children:c}),u.jsxs("span",{children:[d.length," 项"]})]}),u.jsx("ul",{className:"oc-resource-sub-list",children:d.map((h,p)=>u.jsxs("li",{children:[u.jsx("span",{children:h.name||h.path}),u.jsxs("span",{className:"oc-resource-panel-meta",children:[h.scope,h.source?` · ${h.source}`:""]}),u.jsx("code",{children:h.path})]},`${c}:${p}`))})]},c))}):u.jsx("p",{className:"oc-resource-panel-meta",children:"未解析出扩展/技能/提示词/主题(真实空态)"}),Array.isArray(i.diagnostics)&&i.diagnostics.length>0?u.jsx("div",{className:"oc-package-diagnostics",children:i.diagnostics.map((c,d)=>u.jsx("span",{children:c},d))}):null]},`${i.scope}:${i.spec}`)})})}const Pl=10,zy="loop-console.operator-chat.sidebar-split.v1",vi=45,ao=28,so=70,tg=5,ng=10;function ua(e){return Number.isFinite(e)?Math.min(so,Math.max(ao,Math.round(e))):vi}function B0(e){if(e==null||e==="")return null;const r=Number(e);if(!Number.isFinite(r))return null;const i=Math.round(r);return i<ao||i>so?null:i}function H0(e=By()){if(!e)return vi;try{return B0(e.getItem(zy))??vi}catch{return vi}}function rg(e,r=By()){const i=ua(e);if(!r)return i;try{r.setItem(zy,String(i))}catch{}return i}function U0(e,r,i=!1){const s=ua(e);switch(r){case"ArrowUp":return ua(s-(i?ng:tg));case"ArrowDown":return ua(s+(i?ng:tg));case"Home":return ao;case"End":return so;case"Enter":return vi;default:return null}}function ig(e,r,i){if(!Number.isFinite(i)||i<=0)return vi;const s=(e-r)/i;return ua(s*100)}function By(){try{return typeof globalThis>"u"?null:globalThis.localStorage??null}catch{return null}}const ag='a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]),select:not([disabled]),[tabindex]:not([tabindex="-1"])';function lo(e){const{open:r,containerRef:i,triggerRef:s,onEscape:o}=e,c=S.useRef(null),d=S.useRef(!1);S.useEffect(()=>{if(r){if(!d.current){const h=document.activeElement;c.current=s?.current??(h instanceof HTMLElement?h:null);const p=i.current;p&&(p.querySelector(ag)??p).focus?.(),d.current=!0}return()=>{if(!d.current)return;const h=s?.current??c.current;h&&document.contains(h)&&h.focus(),c.current=null,d.current=!1}}d.current=!1},[r,i,s]),S.useEffect(()=>{if(!r)return;const h=i.current;if(!h)return;const p=g=>{if(g.key==="Escape"){g.preventDefault(),o?.();return}if(g.key!=="Tab")return;const v=Array.from(h.querySelectorAll(ag)).filter(w=>!w.hasAttribute("disabled")&&w.tabIndex!==-1);if(v.length===0){g.preventDefault(),h.focus?.();return}const y=v[0],k=v[v.length-1],b=document.activeElement;g.shiftKey?(b===y||!h.contains(b))&&(g.preventDefault(),k.focus()):(b===k||!h.contains(b))&&(g.preventDefault(),y.focus())};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[r,i,o])}function q0(e){const{item:r,active:i,state:s,deleteConfirming:o,deleting:c}=e,d=r.title||r.displayTitle||"未命名对话",h=S.useRef(null),p=S.useRef(null),[g,v]=S.useState(null),y=S.useRef(null),k=()=>{y.current!==null&&(window.clearTimeout(y.current),y.current=null)},b=()=>{k(),v(null)},w=R=>{if(!(R.scrollWidth>R.clientWidth+1)){b();return}const E=R.getBoundingClientRect(),F=12,K=Math.min(360,window.innerWidth-F*2),O=E.left,P=Math.max(F,Math.min(O,window.innerWidth-F-K));v({x:P,y:E.top+E.height/2})},N=R=>{R&&(k(),y.current=window.setTimeout(()=>w(R),350))};S.useEffect(()=>{const R=()=>b(),A=E=>{E.key==="Escape"&&b()};return window.addEventListener("scroll",R,!0),window.addEventListener("keydown",A),()=>{window.removeEventListener("scroll",R,!0),window.removeEventListener("keydown",A),k()}},[]),S.useEffect(()=>{o&&p.current?.focus()},[o]);const z=`oc-session-tip-${r.sessionId}`;return u.jsxs("div",{className:`oc-session-item${i?" is-active":""}${o?" is-delete-confirming":""}`,"data-session-id":r.sessionId,children:[u.jsxs("button",{type:"button",className:"oc-session-main",disabled:c,onClick:e.onActivate,onMouseEnter:R=>{const A=R.currentTarget.querySelector("strong");A instanceof HTMLElement&&N(A)},onMouseLeave:b,onFocus:R=>{const A=R.currentTarget.querySelector("strong");A instanceof HTMLElement&&N(A)},onBlur:b,"aria-describedby":g?z:void 0,children:[u.jsxs("strong",{ref:h,children:[d,r.activeTurnId?" · 运行中":""]}),u.jsx("span",{children:new Date(r.updatedAt).toLocaleString()})]}),u.jsx("div",{className:`oc-session-actions${o?" is-delete-confirm":""}`,children:o?u.jsxs(u.Fragment,{children:[u.jsx("button",{type:"button",ref:p,className:"oc-session-delete-confirm",disabled:c,"aria-busy":c||void 0,"aria-label":`确认删除会话:${d}`,onClick:R=>{R.stopPropagation(),e.onConfirmDelete()},children:c?"删除中…":"删除"}),u.jsx("button",{type:"button",className:"oc-session-delete-cancel",disabled:c,"aria-label":"取消删除会话",onClick:R=>{R.stopPropagation(),e.onCancelDelete()},children:"取消"})]}):u.jsxs(u.Fragment,{children:[u.jsx("button",{type:"button",className:"oc-session-menu",title:"重命名会话","aria-label":"重命名会话",onClick:R=>{R.stopPropagation();const A=window.prompt("会话名称",r.title??"");A!==null&&e.onRename(A)},children:u.jsx(u0,{size:16,"aria-hidden":"true"})}),u.jsx("button",{type:"button",className:"oc-session-menu",title:s==="active"?"归档会话":"恢复会话","aria-label":s==="active"?"归档会话":"恢复会话",onClick:R=>{R.stopPropagation(),e.onSetState(s==="active"?"archived":"active")},children:s==="active"?u.jsx(l0,{size:16,"aria-hidden":"true"}):u.jsx(c0,{size:16,"aria-hidden":"true"})}),u.jsx("button",{type:"button",className:"oc-session-menu oc-session-delete","data-session-delete-id":r.sessionId,title:"删除会话","aria-label":"删除会话",onClick:R=>{R.stopPropagation(),e.onRequestDelete()},children:u.jsx(o0,{size:16,"aria-hidden":"true"})})]})}),g?Ey.createPortal(u.jsx("div",{id:z,role:"tooltip",className:"oc-session-title-tooltip",style:{position:"fixed",left:g.x,top:g.y,transform:"translateY(-50%)"},children:d}),document.body):null]})}function $0(e){return[...e].sort((r,i)=>r.kind!==i.kind?r.kind==="directory"?-1:1:r.name.localeCompare(i.name,void 0,{sensitivity:"base"}))}function G0({open:e}){return u.jsx("svg",{className:`oc-tree-chevron${e?" is-open":""}`,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:u.jsx("path",{d:"M4.2 2.4 7.8 6 4.2 9.6",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function F0({open:e}){return e?u.jsxs("svg",{className:"oc-tree-glyph is-folder-open",width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":"true",children:[u.jsx("path",{d:"M1.5 4.2h3.1l1.1 1.2H12a.8.8 0 0 1 .8.8v5a.8.8 0 0 1-.8.8H2a.8.8 0 0 1-.8-.8V5a.8.8 0 0 1 .8-.8Z",fill:"currentColor",opacity:"0.88"}),u.jsx("path",{d:"M1.8 5.8h10.4l-.7 5.2H2.5L1.8 5.8Z",fill:"currentColor",opacity:"0.55"})]}):u.jsx("svg",{className:"oc-tree-glyph is-folder",width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":"true",children:u.jsx("path",{d:"M1.5 3.8h3.2l1 1.1H12a.8.8 0 0 1 .8.8v5.5a.8.8 0 0 1-.8.8H2a.8.8 0 0 1-.8-.8V4.6a.8.8 0 0 1 .8-.8Z",fill:"currentColor",opacity:"0.78"})})}function P0(){return u.jsxs("svg",{className:"oc-tree-glyph is-file",width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":"true",children:[u.jsx("path",{d:"M3.2 1.6h5.1L10.8 4v8.4a.8.8 0 0 1-.8.8H3.2a.8.8 0 0 1-.8-.8V2.4a.8.8 0 0 1 .8-.8Z",fill:"currentColor",opacity:"0.55"}),u.jsx("path",{d:"M8.3 1.7v2.5h2.4",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round",opacity:"0.75"})]})}function V0(){return u.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M3 3.5h10v2H3v-2Zm0 3.5h10v2H3V7Zm0 3.5h7V13H3v-2Z",fill:"currentColor"})})}function Y0(){return u.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M8 3v10M3 8h10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})})}function K0(){return u.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M8 2.2 13 4.5v3.2c0 3.1-2.1 5.5-5 6.3-2.9-.8-5-3.2-5-6.3V4.5L8 2.2Z",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"})})}function X0(e){const r=e.sessions.slice(0,Pl),[i,s]=S.useState(()=>H0()),[o,c]=S.useState(!1),[d,h]=S.useState(null),[p,g]=S.useState(null),v=S.useRef(null),y=S.useRef(null),k=S.useRef(!1),b=e.layoutMode==="comfortable"&&e.open,w=e.layoutMode==="compact",N=e.drawerOpen&&(e.layoutMode==="compact"||e.layoutMode==="narrow"),z=S.useCallback((ne=!0)=>{if(p)return;const q=d;h(null),!(!ne||!q)&&window.requestAnimationFrame(()=>{const M=typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(q):q.replace(/["\\]/g,"\\$&");document.querySelector(`[data-session-delete-id="${M}"]`)?.focus()})},[p,d]),R=S.useCallback(()=>{p||(h(null),e.onCloseDrawer())},[p,e.onCloseDrawer]),A=S.useCallback(()=>{if(d){z();return}R()},[z,R,d]);lo({open:N,containerRef:y,triggerRef:e.drawerTriggerRef,onEscape:A}),S.useEffect(()=>{k.current&&!N&&!p&&h(null),k.current=N},[p,N]),S.useEffect(()=>{if(N||!d)return;const ne=q=>{q.key==="Escape"&&(q.preventDefault(),z())};return document.addEventListener("keydown",ne),()=>document.removeEventListener("keydown",ne)},[z,d,N]),S.useEffect(()=>{d&&!r.some(ne=>ne.sessionId===d)&&h(null),p&&!r.some(ne=>ne.sessionId===p)&&g(null)},[p,d,r]);const E=S.useCallback(async ne=>{if(!(p||d!==ne)){g(ne);try{await e.onDelete(ne)}finally{g(null),h(null)}}},[p,d,e.onDelete]),F=S.useCallback(()=>{p||(z(!1),e.onCreate())},[z,p,e.onCreate]),K=S.useCallback(()=>{p||(z(!1),e.onToggleOpen())},[z,p,e.onToggleOpen]),O=S.useCallback((ne,q)=>{const M=ua(ne);s(M),q&&rg(M)},[]),P=S.useCallback(ne=>{const q=U0(i,ne.key,ne.shiftKey);q!=null&&(ne.preventDefault(),O(q,!0))},[O,i]),Y=S.useCallback(ne=>{ne.preventDefault(),ne.currentTarget.setPointerCapture(ne.pointerId),c(!0);const M=v.current;if(!M)return;const D=M.getBoundingClientRect();O(ig(ne.clientY,D.top,D.height),!1)},[O]),le=S.useCallback(ne=>{if(!ne.currentTarget.hasPointerCapture(ne.pointerId))return;const q=v.current;if(!q)return;const M=q.getBoundingClientRect();O(ig(ne.clientY,M.top,M.height),!1)},[O]),_=S.useCallback(ne=>{ne.currentTarget.hasPointerCapture(ne.pointerId)&&ne.currentTarget.releasePointerCapture(ne.pointerId),c(!1),rg(i)},[i]),V=S.useCallback(()=>{O(vi,!0)},[O]),G=u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"oc-sidebar-split",ref:v,style:{"--oc-session-share":`${i}%`,"--oc-repo-share":`${100-i}%`},"data-dragging":o?"true":"false",children:[u.jsxs("section",{className:"oc-sidebar-section oc-sessions",children:[u.jsxs("header",{children:[u.jsx("strong",{children:"会话"}),u.jsxs("div",{className:"oc-sidebar-header-actions",children:[u.jsx("button",{type:"button",className:"btn btn-ghost",onClick:F,disabled:e.creatingSession,"aria-busy":e.creatingSession||void 0,children:e.creatingSession?"创建中…":"新建"}),e.layoutMode==="comfortable"?u.jsx("button",{type:"button",className:"oc-sidebar-toggle",onClick:K,"aria-expanded":!0,"aria-label":"收起侧栏",title:"收起侧栏",children:u.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":"true",children:u.jsx("path",{d:"M8.8 2.6 5.2 7l3.6 4.4",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}):u.jsx("button",{type:"button",className:"oc-sidebar-toggle",onClick:R,"aria-label":"关闭侧栏抽屉",title:"关闭",children:u.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":"true",children:u.jsx("path",{d:"M3.5 3.5 10.5 10.5M10.5 3.5 3.5 10.5",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})})})]})]}),u.jsxs("div",{className:"oc-session-scroll",children:[["active","archived"].map(ne=>{const q=r.filter(M=>M.state===ne);return q.length?u.jsxs("div",{className:"oc-session-group",children:[u.jsx("small",{children:ne==="active"?"进行中":"已归档"}),q.map(M=>u.jsx(q0,{item:M,active:e.activeSessionId===M.sessionId,state:ne,deleteConfirming:d===M.sessionId,deleting:p===M.sessionId,onActivate:()=>{p||(z(!1),e.onActivate(M.sessionId))},onRename:D=>e.onRename(M.sessionId,D),onSetState:D=>e.onSetState(M.sessionId,D),onRequestDelete:()=>{p||h(M.sessionId)},onConfirmDelete:()=>{E(M.sessionId)},onCancelDelete:()=>z()},M.sessionId))]},ne):null}),r.length===0?u.jsx("p",{className:"oc-tree-empty",children:"暂无会话,点击上方新建。"}):null]})]}),u.jsx("div",{className:"oc-sidebar-separator",role:"separator","aria-orientation":"horizontal","aria-valuemin":ao,"aria-valuemax":so,"aria-valuenow":i,"aria-label":"调整会话与仓库高度比例",tabIndex:0,onKeyDown:P,onPointerDown:Y,onPointerMove:le,onPointerUp:_,onPointerCancel:_,onDoubleClick:V}),u.jsxs("section",{className:"oc-sidebar-section oc-explorer",children:[u.jsxs("header",{children:[u.jsx("strong",{children:"仓库"}),u.jsx("button",{type:"button",className:"btn btn-ghost",onClick:e.onRefreshTree,children:"刷新"})]}),u.jsx("p",{className:"oc-explorer-hint",children:"单击插入 @路径 · 双击预览"}),e.treeError&&u.jsx("p",{className:"oc-sidebar-error",children:e.treeError}),u.jsx("div",{className:"oc-tree-scroll",children:u.jsx(Hy,{entries:e.tree[""]??[],tree:e.tree,expanded:e.expanded,depth:0,onToggle:e.onToggleDir,onInsert:e.onInsert,onPreview:e.onPreview})})]})]}),u.jsx(D0,{origin:e.origin})]});return u.jsxs(u.Fragment,{children:[w?u.jsxs("nav",{className:"oc-sidebar-rail","aria-label":"紧凑侧栏",children:[u.jsx("button",{type:"button",className:"oc-sidebar-rail-btn","aria-label":"打开会话与仓库",title:"会话与仓库","aria-expanded":N,onClick:()=>N?R():e.onOpenDrawer(),children:u.jsx(V0,{})}),u.jsx("button",{type:"button",className:"oc-sidebar-rail-btn","aria-label":e.creatingSession?"创建会话中":"新建会话",title:e.creatingSession?"创建中…":"新建会话",onClick:F,disabled:e.creatingSession,"aria-busy":e.creatingSession||void 0,children:u.jsx(Y0,{})}),u.jsx("button",{type:"button",className:"oc-sidebar-rail-btn","aria-label":"治理入口",title:"治理",onClick:()=>N?R():e.onOpenDrawer(),children:u.jsx(K0,{})})]}):null,e.layoutMode==="comfortable"?u.jsx("aside",{className:`oc-sidebar${b?"":" is-collapsed"}`,"aria-label":"会话与仓库",children:b?G:u.jsx("button",{type:"button",className:"oc-sidebar-toggle is-collapsed",onClick:K,"aria-expanded":!1,"aria-label":"展开侧栏",title:"展开侧栏",children:u.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":"true",children:u.jsx("path",{d:"M5.2 2.6 8.8 7 5.2 11.4",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})})}):null,N?u.jsxs(u.Fragment,{children:[u.jsx("button",{type:"button",className:"oc-overlay-backdrop","aria-label":"关闭侧栏遮罩",onClick:R}),u.jsx("aside",{ref:y,className:"oc-sidebar oc-sidebar-drawer","aria-label":"会话与仓库抽屉",role:"dialog","aria-modal":"true",tabIndex:-1,children:G})]}):null]})}function Hy(e){const r=S.useMemo(()=>$0(e.entries),[e.entries]);return r.length?u.jsx("ul",{className:"oc-tree",role:e.depth===0?"tree":"group",children:r.map(i=>{const s=i.name.startsWith(".");if(i.kind==="directory"){const o=e.expanded.has(i.path);return u.jsxs("li",{className:`oc-tree-node is-dir${o?" is-open":""}${s?" is-dot":""}`,role:"treeitem","aria-expanded":o,children:[u.jsxs("button",{type:"button",className:"oc-tree-row oc-tree-dir",onClick:()=>e.onToggle(i.path),style:{paddingLeft:`${8+e.depth*12}px`},children:[u.jsx(G0,{open:o}),u.jsx(F0,{open:o}),u.jsx("span",{className:"oc-tree-label",children:i.name})]}),o?u.jsx("div",{className:"oc-tree-children",style:{"--oc-tree-guide":`${14+e.depth*12}px`},children:u.jsx(Hy,{entries:e.tree[i.path]??[],tree:e.tree,expanded:e.expanded,depth:e.depth+1,onToggle:e.onToggle,onInsert:e.onInsert,onPreview:e.onPreview})}):null]},i.path)}return u.jsx("li",{className:`oc-tree-node is-file${s?" is-dot":""}`,role:"treeitem",children:u.jsx(Q0,{entry:i,depth:e.depth,onInsert:e.onInsert,onPreview:e.onPreview})},i.path)})}):u.jsx("p",{className:"oc-tree-empty",children:"此目录为空或没有可安全浏览的文件。"})}function Q0(e){const r=S.useRef(null);return S.useEffect(()=>()=>{r.current!==null&&window.clearTimeout(r.current)},[]),u.jsxs("button",{type:"button",className:"oc-tree-row oc-tree-file",style:{paddingLeft:`${8+e.depth*12}px`},title:"单击插入引用;双击预览",onClick:()=>{r.current!==null&&window.clearTimeout(r.current),r.current=window.setTimeout(()=>{e.onInsert(e.entry.path),r.current=null},220)},onDoubleClick:()=>{r.current!==null&&window.clearTimeout(r.current),r.current=null,e.onPreview(e.entry.path)},children:[u.jsx("span",{className:"oc-tree-chevron-spacer","aria-hidden":"true"}),u.jsx(P0,{}),u.jsx("span",{className:"oc-tree-label",children:e.entry.name})]})}function Z0(e){const r=e.previews.find(i=>i.path===e.activePath);return!r&&!e.loading?null:u.jsxs(u.Fragment,{children:[r&&u.jsxs("section",{className:"oc-file-preview","aria-label":`文件预览 ${r.path}`,children:[u.jsxs("header",{children:[u.jsx("div",{className:"oc-file-tabs",role:"tablist","aria-label":"文件预览 Tabs",children:e.previews.map(i=>u.jsx("button",{type:"button",role:"tab","aria-selected":i.path===r.path,className:i.path===r.path?"is-active":"",onClick:()=>e.onActivate(i.path),children:i.path},i.path))}),u.jsxs("span",{children:[r.bytes," bytes",r.truncated?" · 已截断":""]}),u.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>e.onClose(r.path),children:"关闭预览"})]}),u.jsx("pre",{children:u.jsx("code",{children:r.content})})]}),e.loading&&u.jsx("div",{className:"oc-file-preview-loading",children:"正在读取文件…"})]})}const Uy=[{command:"/task",label:"Task context",description:"查看当前任务、Draft 与 assessment",action:"focus-panel:task",source:"operator"},{command:"/contract",label:"Contract",description:"查看 contract diff 与 apply gate",action:"focus-panel:contract",source:"operator"},{command:"/dag",label:"DAG",description:"查看 DAG spine、确认与运行状态",action:"focus-panel:dag",source:"operator"},{command:"/interview",label:"Interview",description:"打开 Requirement Interview",action:"focus:interview",source:"operator"},{command:"/reload",label:"Reload session",description:"重新加载当前 Pi 会话的设置、扩展、技能、提示词、主题与上下文文件(不产生消息)",action:"reload",source:"operator"}],qy=[{command:"/compact",label:"压缩上下文",description:"压缩当前会话上下文,释放 token",action:"compact",source:"web"},{command:"/name",label:"重命名会话",description:"设置当前会话标题",action:"name",source:"web"},{command:"/session",label:"会话信息",description:"显示当前会话元信息",action:"session",source:"web"},{command:"/copy",label:"复制回复",description:"复制最后一条助手消息原文",action:"copy",source:"web"}],gi={operator:0,web:1,extension:2,skill:3,prompt:4};function sg(e){const r=e.trim().split(/\s+/,1)[0]??"";return r?r.startsWith("/")?r.toLowerCase():`/${r.toLowerCase()}`:""}function lg(e){const r=e.trim().split(/\s+/,1)[0]?.toLowerCase();if(!r?.startsWith("/"))return;const i=[...Uy,...qy].find(s=>s.command===r);return i?{command:i.command,action:i.action}:{command:r,action:"unknown"}}function J0(e){if(e==="focus-panel:task"||e==="focus-panel:contract")return"tasks";if(e==="focus-panel:dag")return"recovery"}function W0(e=[]){const r=new Map,i=s=>{const o=sg(s.command);if(!o)return;const c=r.get(o);if(!c){r.set(o,{...s,command:o});return}gi[s.source]<gi[c.source]&&r.set(o,{...s,command:o})};for(const s of Uy)i({command:s.command,label:s.label,description:s.description,source:s.source,action:s.action});for(const s of qy)i({command:s.command,label:s.label,description:s.description,source:s.source,action:s.action});for(const s of e){const o=sg(s.command);o&&i({command:o,label:s.label||o,description:s.description||"",source:s.source,action:"pi-prompt"})}return[...r.values()].sort((s,o)=>{const c=gi[s.source]-gi[o.source];return c!==0?c:s.command.localeCompare(o.command)})}function ek(e,r){const i=(r.trim().split(/\s+/,1)[0]??"").toLowerCase();if((/\s/.test(r.trimStart().slice(1))||r.includes(" "))&&r.trimStart().includes(" "))return[];const s=i.startsWith("/")?i:i?`/${i}`:"/",o=s==="/"?"":s.slice(1),c=[];for(const d of e){const h=d.command.toLowerCase(),p=h.startsWith("/")?h.slice(1):h,g=d.description.toLowerCase();let v=100;if(!o)v=10+gi[d.source];else if(h===s||p===o)v=0;else if(h.startsWith(s)||p.startsWith(o))v=1;else if(p.includes(o)||h.includes(o))v=2;else if(g.includes(o))v=3;else continue;c.push({...d,score:v})}return c.sort((d,h)=>{if(d.score!==h.score)return d.score-h.score;const p=gi[d.source]-gi[h.source];return p!==0?p:d.command.localeCompare(h.command)})}const tk={operator:"Operator",web:"Pi Web",extension:"Extensions",prompt:"Prompts",skill:"Skills"},nk=new Set(["operatorCapabilities","operationList","operationGet","operationEventSummary","statsContext","sourceInstructions","spineCheck","inspect","observeLink"]);function rk(e){return nk.has(e)?"technical-only":e==="doctor"?"inline-detail":"activity-detail"}const ik={newTask:"创建任务",importPrd:"任务需求",contractShow:"任务边界",contractApply:"更新任务契约",contractDiff:"任务契约差异",contractDraftSave:"任务契约草稿",contractValidate:"检查任务契约",taskAdvance:"推进任务准备",dagRunTask:"执行流程",dagValidate:"校验执行流程",prepareDagConfirmation:"执行确认",confirmDagConfirmation:"确认执行边界",prepareDagExecution:"执行边界",runDag:"任务执行",operationWait:"执行监督",operationGet:"任务活动详情",operationList:"会话活动",operationEventSummary:"执行进展摘要",dagStatus:"执行状态",dagDoctor:"执行诊断",dagReport:"执行结果",dagRerunPlan:"恢复评估",dagInterruptEligibility:"中止资格",standaloneTaskRerun:"恢复执行",workerTaskRetry:"重试任务",promoteRun:"任务推进",status:"任务状态"},ak={newTask:{running:"正在创建任务",success:"任务已经创建",error:"创建任务时遇到问题"},importPrd:{running:"正在整理并导入任务需求",success:"任务需求已经导入",error:"导入任务需求时遇到问题"},contractShow:{running:"正在读取任务目标和执行边界",success:"任务目标与执行边界已经读取",error:"读取任务边界时遇到问题"},taskAdvance:{running:"正在推进任务契约并准备执行流程",success:"任务已经推进到下一安全阶段",error:"任务推进被契约或执行边界阻塞"},dagRunTask:{running:"正在生成并校验执行流程",success:"执行流程已经准备好",error:"准备执行流程时遇到问题"},prepareDagExecution:{running:"正在确认任务可以安全执行",success:"执行边界已经确认",error:"执行边界尚未通过确认"},runDag:{running:"正在启动任务执行",success:"任务执行已经启动",error:"启动任务执行时遇到问题"},dagReport:{running:"正在读取本次执行结果",success:"本次执行结果已经读取",error:"读取执行结果时遇到问题"},dagRerunPlan:{running:"正在评估能否从失败位置继续",success:"恢复条件评估已经完成",error:"暂时无法确定安全的恢复方式"},dagInterruptEligibility:{running:"正在检查能否协作中止此运行",success:"中止资格已经确认",error:"当前运行不能协作中止"},standaloneTaskRerun:{running:"正在从失败位置恢复执行",success:"已经从失败位置继续执行",error:"从失败位置恢复执行时遇到问题"},promoteRun:{running:"正在推进任务状态",success:"任务状态已经更新",error:"推进任务状态时遇到问题"},status:{running:"正在读取任务状态",success:"任务状态已经更新",error:"读取任务状态时遇到问题"},contractApply:{running:"正在应用任务契约变更",success:"任务契约已经更新",error:"应用任务契约变更时遇到问题"},contractDiff:{running:"正在比较任务契约版本",success:"任务契约差异已经读取",error:"比较任务契约时遇到问题"},contractDraftSave:{running:"正在保存任务契约草稿",success:"任务契约草稿已经保存",error:"保存任务契约草稿时遇到问题"},contractValidate:{running:"正在检查任务契约",success:"任务契约检查已经完成",error:"任务契约检查没有通过"},dagValidate:{running:"正在校验执行流程",success:"执行流程校验已经通过",error:"执行流程校验没有通过"},prepareDagConfirmation:{running:"正在准备执行确认",success:"执行确认已经准备好",error:"准备执行确认时遇到问题"},confirmDagConfirmation:{running:"正在确认执行边界",success:"执行边界已经确认",error:"执行边界尚未通过确认"},operationGet:{running:"正在读取任务活动详情",success:"任务活动详情已经读取",error:"读取任务活动详情时遇到问题"},operationList:{running:"正在读取本次对话的活动",success:"本次对话的活动已经读取",error:"读取对话活动时遇到问题"},operationEventSummary:{running:"正在汇总执行进展",success:"执行进展已经汇总",error:"汇总执行进展时遇到问题"},dagStatus:{running:"正在读取执行状态",success:"执行状态已经更新",error:"读取执行状态时遇到问题"},dagDoctor:{running:"正在诊断本次任务执行",success:"任务执行诊断已经完成",error:"诊断任务执行时遇到问题"},workerTaskRetry:{running:"正在重试失败的任务",success:"失败任务已经重新开始",error:"重试失败任务时遇到问题"},doctor:{running:"正在检查运行环境",success:"运行环境检查已经完成",error:"运行环境检查发现问题"},inspect:{running:"正在读取详细运行信息",success:"详细运行信息已经读取",error:"读取详细运行信息时遇到问题"},observeLink:{running:"正在准备运行看板入口",success:"运行看板入口已经准备好",error:"准备运行看板入口时遇到问题"},operatorCapabilities:{running:"正在读取可用操作能力",success:"可用操作能力已经读取",error:"读取可用操作能力时遇到问题"},sourceInstructions:{running:"正在读取任务来源说明",success:"任务来源说明已经读取",error:"读取任务来源说明时遇到问题"},spineCheck:{running:"正在检查计划执行步骤",success:"计划执行步骤检查已经完成",error:"计划执行步骤检查发现问题"},statsContext:{running:"正在统计上下文使用情况",success:"上下文使用情况已经统计完成",error:"统计上下文使用情况时遇到问题"}},sk=[{pattern:/(?:^|-)contract(?:-pi)?$/i,running:"正在核对任务目标和执行边界",finished:"任务目标与执行边界已确认",error:"任务边界存在冲突,需要先处理"},{pattern:/scout-src/i,running:"正在梳理与任务相关的代码",finished:"相关代码范围已梳理",error:"梳理相关代码时遇到问题"},{pattern:/scout-tests/i,running:"正在检查现有测试和验证方式",finished:"现有测试与验证方式已确认",error:"检查现有测试时遇到问题"},{pattern:/plan/i,running:"正在整理具体实施步骤",finished:"实施步骤已经准备好",error:"实施方案还需要进一步完善"},{pattern:/implement|writer/i,running:"正在修改并保存相关文件",finished:"文件修改已经完成",error:"修改文件时遇到问题"},{pattern:/verify|reverify/i,running:"正在验证本次修改",finished:"本次修改已通过验证",error:"验证没有通过,正在检查原因"},{pattern:/review/i,running:"正在检查改动是否完整",finished:"改动完整性检查已通过",error:"发现需要补充或修正的内容"},{pattern:/closeout/i,running:"正在整理交付结果",finished:"任务已经完成并形成交付记录",error:"交付结果尚未整理完整"}];function $y(e){if(!(!e||typeof e!="object"))return e}function Cd(e){if(e&&typeof e=="object")return e;if(typeof e=="string")try{return $y(JSON.parse(e))}catch{return}}function lk(e){const i=Cd(e)?.operationId;return typeof i=="string"&&i?i:void 0}function ok(e){const i=Cd(e)?.maxWaitMs;if(!(typeof i!="number"||!Number.isFinite(i)||i<=0))return Math.max(1,Math.round(i/1e3))}function Gy(e){const r=lk(e.args);return r?`operation:${r}`:`tool:${e.id}`}function uk(e){return e==="running"?"progress":e==="error"?"error":"success"}function ck(e){return Cd(e.resultText??e.result)}function dk(e){return Array.isArray(e.events)?e.events.flatMap(r=>{const i=$y(r);if(!i)return[];const s=i.messagePreview??i.message;return typeof s=="string"?[s]:[]}):[]}function fk(e,r,i){const s=[];for(const p of e)for(const g of p.matchAll(/node-(started|finished)[^\n]*?node=([^\s,]+)/gi)){const v=g[1]?.toLowerCase(),y=g[2]??"",k=p.match(/status=([^\s,]+)/i)?.[1]?.toUpperCase();let b="finished";k==="ERROR"||k==="FAILED"?b="error":v==="started"&&(b="running"),s.push({node:y,status:b})}const o=s.at(-1);if(!o)return;const c=s.some(p=>/scout-src/i.test(p.node)&&p.status==="finished"),d=s.some(p=>/scout-tests/i.test(p.node)&&p.status==="finished");if(c&&d)return{id:r,kind:"success",title:"代码与测试的影响范围已确认",activityRef:i};const h=sk.find(p=>p.pattern.test(o.node));return h?o.status==="running"?{id:r,kind:"progress",title:h.running,activityRef:i}:o.status==="error"?{id:r,kind:"error",title:h.error,activityRef:i}:{id:r,kind:"success",title:h.finished,activityRef:i}:{id:r,kind:"success",title:"执行状态已经更新",activityRef:i}}function hk(e){const r=Gy(e),i=`activity:${e.id}`,s=ok(e.args);if(e.status==="running")return{id:i,kind:"progress",title:s?`正在等待新的执行进展,最长等待时间 ${s} 秒`:"正在等待新的执行进展",activityRef:r};if(e.status==="error")return{id:i,kind:"error",title:"等待执行进展时遇到问题",activityRef:r};let o="";typeof e.resultText=="string"?o=e.resultText:typeof e.result=="string"&&(o=e.result);const c=ck(e),d=fk([o,...c?dk(c):[]],i,r);if(d)return d;if(c){if(c.timedOut===!0||c.changed===!1)return{id:i,kind:"warning",title:"等待期间没有新的执行进展",activityRef:r};if(c.changed===!0)return{id:i,kind:"success",title:"已经收到新的执行进展",activityRef:r}}return{id:i,kind:"success",title:"执行状态已经更新",activityRef:r}}function mk(e){const r=rk(e.toolName);if(r==="technical-only"||r==="inline-detail")return;if(e.toolName==="operationWait")return hk(e);const i=ak[e.toolName];if(!i)return;let s=i.success;return e.status==="running"?s=i.running:e.status==="error"&&(s=i.error),{id:`activity:${e.id}`,kind:uk(e.status),title:s,activityRef:Gy(e)}}function Fy(e){return ik[e]??"任务活动"}function Rd(e){switch(e){case"starting":return{label:"正在启动",kind:"progress"};case"running":return{label:"运行中",kind:"progress"};case"succeeded":case"finished":case"FINISHED":case"pass":return{label:"已完成",kind:"success"};case"failed":case"partial_failed":case"ERROR":case"FAILED":case"timed-out":return{label:"未完成",kind:"error"};case"needs-reconcile":return{label:"需要同步",kind:"warning"};case"cancelled":case"abandoned":case"superseded":return{label:"已停止",kind:"warning"};default:return{label:"状态已更新",kind:"success"}}}function Py(e){return[e.activityRef??`operation:${e.operationId}`,`operation:${e.operationId}`,...e.toolCallId?[`tool:${e.toolCallId}`]:[]]}function Vy(e){return[e.activityRef??`gate:${e.cardId}`]}function Yy(e){return[e.activityRef??`artifact:${e.artifactId}`]}function pk(e){return new Set([...e.operations.flatMap(Py),...e.gates.flatMap(Vy),...e.artifacts.flatMap(Yy)])}function og(e){return e.updatedSeq??e.eventSeq}function ug(e){const r=Date.parse(e.updatedAt);return Number.isFinite(r)?r:0}function jd(e,r){const i=og(e),s=og(r);return i!==void 0&&s!==void 0?i-s:ug(e)-ug(r)}function gk(e){return e.taskId?`task:${e.taskId}`:e.dagRunId?`run:${e.dagRunId}`:`operation:${e.operationId}`}function yk(e){return e.taskId?e.taskId.replace(/^\d{4}-\d{2}-\d{2}-/,"").replace(/[-_]+/g," ").trim()||e.taskId:Fy(e.action)}function vk(e){return[...new Set(e)]}function bk(e){const r=new Map;for(const i of e)r.set(i.action,i);return[...r.values()].sort(jd).map(i=>{const s=Rd(i.state);return{id:i.operationId,label:Fy(i.action),stateLabel:s.label,kind:s.kind,at:i.updatedAt}})}function xk(e){const r=new Map;for(const i of e){const s=i.dagRunId??i.runSummary?.runId;if(!s)continue;const o=r.get(s)??[];o.push(i),r.set(s,o)}return[...r.entries()].flatMap(([i,s])=>{const o=[...s].sort((g,v)=>jd(v,g)),c=o[0];if(!c)return[];const d=o.find(g=>g.runSummary)?.runSummary,h=d?.status??c.state,p=Rd(h);return[{runId:i,state:h,stateLabel:p.label,kind:p.kind,updatedAt:c.updatedAt,operationCount:s.length,firstFailedNode:d?.nodes.find(g=>g.status==="ERROR")?.id,failureCategory:d?.failureCategory,inspectHref:c.inspectHref}]}).sort((i,s)=>Date.parse(s.updatedAt)-Date.parse(i.updatedAt))}function Ky(e){const r=new Map;for(const i of e){const s=gk(i),o=r.get(s)??[];o.push(i),r.set(s,o)}return[...r.entries()].flatMap(([i,s])=>{const o=[...s].sort(jd),c=o.at(-1);if(!c)return[];const d=Rd(c.state);return[{key:i,taskId:c.taskId,displayTitle:yk(c),state:c.state,stateLabel:d.label,kind:d.kind,updatedAt:c.updatedAt,latestOperation:c,operations:o,steps:bk(o),runs:xk(o),activityRefs:vk(o.flatMap(Py)),compactEligible:d.kind==="success"}]}).sort((i,s)=>{const o=i.kind==="progress"||i.kind==="error"?0:1,c=s.kind==="progress"||s.kind==="error"?0:1;return o!==c?o-c:Date.parse(s.updatedAt)-Date.parse(i.updatedAt)})}const Sk={operation:"执行记录",contract:"任务契约",dag:"执行流程",report:"报告",html:"HTML 预览"};function kk(e){const{artifact:r}=e,i=!!(r.reportText||r.htmlPreview);return u.jsxs("section",{className:"oc-artifact-card","aria-label":`任务产物:${r.title??r.artifactId}`,"data-activity-ref":r.activityRef??`artifact:${r.artifactId}`,children:[u.jsxs("header",{children:[u.jsxs("div",{children:[u.jsx("small",{children:"任务产物"}),u.jsx("strong",{children:r.title??r.artifactId}),u.jsx("code",{children:r.artifactId})]}),u.jsx("span",{children:Sk[r.kind]})]}),r.summary?u.jsx("p",{children:r.summary}):null,i?u.jsxs("details",{className:"oc-artifact-details",children:[u.jsx("summary",{children:"预览与技术详情"}),r.reportText?u.jsx("pre",{children:r.reportText}):null,r.htmlPreview?u.jsx("iframe",{title:`${r.title??r.artifactId} preview`,sandbox:"",srcDoc:r.htmlPreview}):null]}):null,r.inspectHref?u.jsx("footer",{children:u.jsx("button",{className:"btn btn-ghost",type:"button",onClick:()=>window.open(r.inspectHref,"_blank","noopener,noreferrer"),children:"打开产物"})}):null]})}const cg={prepared:"等待确认",confirmed:"已经确认",dispatched:"正在执行",consumed:"已经完成",stale:"已经失效",expired:"已经过期",error:"处理失败"};function dg(e){return e.gateType==="contract-apply"?"确认任务契约变更":e.gateType==="mutation"?"确认执行工作区修改":"确认启动任务执行"}function wk({card:e,origin:r,sessionId:i}){const[s,o]=S.useState(!1),[c,d]=S.useState(),h=async()=>{o(!0),d(void 0);try{let y="contract-apply";e.gateType==="dag-run"?y=e.state==="prepared"?"dag-confirm":"dag-run":e.gateType==="mutation"&&(y="mutation-apply");const k=e.gateType==="dag-run"?{confirmationId:e.confirmationId,...e.state==="prepared"?{humanGateToken:e.humanGateToken}:{}}:{receiptId:e.receiptId,humanGateToken:e.humanGateToken},b=await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(i)}/human-gate/${y}`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json","x-loop-console-confirmation":un()},body:JSON.stringify(k)}),w=await b.json();if(!b.ok)throw new Error(w.error?.message??`HTTP ${b.status}`)}catch(y){d(y instanceof Error?y.message:String(y))}finally{o(!1)}},p=e.state==="prepared"||e.gateType==="dag-run"&&e.state==="confirmed";let g="确认接受";e.gateType==="mutation"?g="确认执行":e.gateType==="dag-run"&&(g=e.state==="prepared"?"确认边界":"启动执行");const v=(e.displayOnlyChallenges?.length??0)+(e.dagSpine?.length??0);return u.jsxs("section",{className:`oc-human-gate-card is-${e.state}`,"aria-label":`${dg(e)}:${cg[e.state]}`,"data-activity-ref":e.activityRef??`gate:${e.cardId}`,children:[u.jsxs("header",{children:[u.jsxs("div",{children:[u.jsx("small",{children:"人工门禁"}),u.jsx("strong",{children:dg(e)}),u.jsx("code",{children:e.taskId})]}),u.jsx("span",{children:cg[e.state]})]}),e.contractDiffSummary?u.jsx("p",{className:"oc-human-gate-summary",children:e.contractDiffSummary}):null,v>0||e.errorMessage?u.jsxs("details",{className:"oc-human-gate-details",children:[u.jsxs("summary",{children:["门禁详情 · ",v," 项"]}),e.displayOnlyChallenges?.length?u.jsxs("div",{className:"oc-human-gate-challenges",children:[u.jsx("b",{children:"确认前请检查"}),u.jsx("ul",{children:e.displayOnlyChallenges.map(y=>u.jsx("li",{children:y},y))})]}):null,e.dagSpine?.length?u.jsxs("div",{children:[u.jsx("b",{children:"计划执行步骤"}),u.jsx("ol",{children:e.dagSpine.map(y=>u.jsx("li",{children:u.jsx("code",{children:y})},y))})]}):null,e.errorMessage?u.jsx("p",{className:"oc-human-gate-error",children:e.errorMessage}):null]}):null,u.jsxs("footer",{children:[u.jsx("button",{className:"btn btn-ghost",type:"button",onClick:()=>window.open(e.inspectHref,"_blank","noopener,noreferrer"),children:"查看记录"}),u.jsx("button",{className:"btn btn-primary",type:"button",disabled:!p||s,onClick:()=>{h()},children:s?"提交中…":g})]}),c?u.jsx("div",{className:"oc-human-gate-error",children:c}):null]})}const Bn="loop-console.operator-chat.active-session.v1",Ck="loop-console.operator-chat.default-landing.v1";function Vl(e){const r=e?.trim().toLowerCase();if(r==="chat")return"chat";if(r==="tasks")return"tasks"}function Xy(e){const r=e?.trim().toLowerCase();if(r==="chat"||r==="tasks"||r==="recovery"||r==="night"||r==="models"||r==="settings")return r}function Qy(e){const r=i=>e.get(i)?.trim()||void 0;return{...r("taskId")?{taskId:r("taskId")}:{},...r("dagRunId")?{dagRunId:r("dagRunId")}:{},...r("fromNodeId")?{fromNodeId:r("fromNodeId")}:{},...r("featureId")?{featureId:r("featureId")}:{},...r("intent")?{intent:r("intent")}:{}}}function Zy(e){const r=String(e??"").replace(/^#/,"");if(!r)return null;const i=r.indexOf("?"),s=i>=0?r.slice(0,i):r,o=i>=0?r.slice(i+1):"",c=(s||"/").split("?")[0]||"/";if(c==="/"||c==="")return null;const d=c.replace(/^\//,"").split("/")[0],h=Xy(d);return h?{workspace:h,...Qy(new URLSearchParams(o))}:null}function Rk(e){const r=new URLSearchParams(e.search),i=e.hash.startsWith("#")?e.hash.slice(1):e.hash,s=new URLSearchParams(i),o=Xy(r.get("workspace")??r.get("landing")??s.get("workspace"));return o?{workspace:o,...Qy(r)}:null}function jk(e){if(!e)return;const r=Zy(e.hash);if(r)return r.workspace;const i=new URLSearchParams(e.search),s=Vl(i.get("landing")??i.get("workspace"));if(s)return s;const o=e.hash.startsWith("#")?e.hash.slice(1):e.hash;return Vl(new URLSearchParams(o).get("workspace"))}function Jy(e){return jk(e.location)??Vl(e.storage?.getItem(Ck))??Vl(e.env)??"chat"}function Wy(e,r={}){const i=new URLSearchParams;for(const[c,d]of Object.entries(r))d?.trim()&&i.set(c,d.trim());const s=i.toString(),o=`/${e}`;return s?`${o}?${s}`:o}function Tk(e,r={}){return`#${Wy(e,r)}`}function Ek(e){return Zy(e.hash)??Rk(e)}function fg(e,r=900){if(e)return e.length>r?`${e.slice(0,r)}…`:e}function Mc(e){return new Date(e).toLocaleString()}function hg(e){if(!e)return;const r=e.trim();if(/taskId[^\n]*(?:placeholder|占位)|["']?<id>["']?/i.test(r))return"任务编号仍是占位符;请提供实际的 YYYY-MM-DD-<slug> 任务编号后重试。";if(/ENOENT|no such file or directory/i.test(r))return"任务活动缺少所需文件或目录,请查看最新诊断。";if(/command failed|exited with code/i.test(r))return"相关命令没有成功完成,请查看最新诊断。";if(!(r.length>220||r.startsWith("{")||r.startsWith("[")||r.includes("[dag execute]")||r.includes("schemaVersion")||/[A-Za-z]:\\/.test(r)))return r}function Nk(e){const r=e.latestOperation,i=r.runSummary;if(i?.next?.description)return i.next.description;const s=i?.nodes.find(c=>c.status==="ERROR")?.id;if(s){const c=i?.failureCategory?`,原因分类为 ${i.failureCategory}`:"";return`执行在 ${s} 阶段未完成${c}。`}const o=hg(r.stderrPreview)??hg(r.summaryPreview);if(o)return o;if(e.kind==="error")return"本次任务活动没有完成,请查看最新诊断或恢复选项。";if(e.kind==="warning")return"本次任务活动需要进一步确认,请查看相关记录。"}function Ik(e){const{journey:r}=e,i=r.latestOperation,s=r.runs[0],o=r.runs.slice(1),c=i.inspectHref.startsWith("/")?`${e.origin}${i.inspectHref}`:i.inspectHref,d=Nk(r),h=r.kind==="error"||r.kind==="warning",p=(g,v)=>{e.onNavigateWorkspace?e.onNavigateWorkspace(g,v):window.location.assign(Tk(g,v))};return e.compact?u.jsxs("details",{className:"oc-journey-compact",children:[u.jsxs("summary",{children:[u.jsx("span",{className:`oc-journey-dot is-${r.kind}`,"aria-hidden":"true"}),u.jsxs("span",{children:[u.jsx("strong",{children:r.displayTitle}),u.jsxs("small",{children:[r.stateLabel," · ",Mc(r.updatedAt)]})]}),u.jsx("span",{"aria-hidden":"true",children:"›"})]}),u.jsxs("div",{className:"oc-journey-compact-body",children:[r.taskId?u.jsx("code",{children:r.taskId}):null,u.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>window.open(c,"_blank","noopener,noreferrer"),children:"查看记录"})]})]}):u.jsxs("section",{className:`oc-task-journey-card is-${r.kind}`,"aria-label":`${r.displayTitle}:${r.stateLabel}`,children:[u.jsxs("header",{className:"oc-journey-head",children:[u.jsxs("div",{children:[u.jsxs("div",{className:"oc-journey-state-line",children:[u.jsx("span",{className:`oc-journey-dot is-${r.kind}`,"aria-hidden":"true"}),u.jsx("span",{children:r.stateLabel})]}),u.jsx("strong",{children:r.displayTitle}),r.taskId?u.jsxs("small",{children:["Task · ",u.jsx("code",{children:r.taskId})]}):null]}),u.jsx("time",{dateTime:r.updatedAt,children:Mc(r.updatedAt)})]}),u.jsx("div",{className:"oc-journey-steps","aria-label":"任务旅程",children:r.steps.slice(-6).map(g=>u.jsxs("div",{className:"oc-journey-step",children:[u.jsx("span",{className:`oc-journey-step-icon is-${g.kind}`,"aria-hidden":"true",children:g.kind==="success"?"✓":g.kind==="error"?"!":"•"}),u.jsx("span",{children:g.label}),u.jsx("small",{children:g.stateLabel})]},g.id))}),d?u.jsxs("div",{className:`oc-journey-outcome is-${r.kind}`,children:[u.jsx("strong",{children:h?"当前问题":"最新结果"}),u.jsx("p",{children:d})]}):null,s?u.jsxs("div",{className:"oc-journey-latest-run",children:[u.jsx("span",{children:"最新执行"}),u.jsx("code",{children:s.runId}),u.jsx("b",{className:`is-${s.kind}`,children:s.stateLabel}),s.firstFailedNode?u.jsxs("small",{children:["失败阶段 · ",s.firstFailedNode]}):null]}):null,o.length>0?u.jsxs("details",{className:"oc-journey-history",children:[u.jsxs("summary",{children:["执行历史 ",r.runs.length," 次"]}),u.jsx("div",{children:r.runs.map(g=>u.jsxs("div",{className:"oc-journey-run-row",children:[u.jsx("code",{children:g.runId}),u.jsx("span",{className:`is-${g.kind}`,children:g.stateLabel}),g.firstFailedNode?u.jsx("small",{children:g.firstFailedNode}):null,u.jsx("time",{dateTime:g.updatedAt,children:Mc(g.updatedAt)})]},g.runId))})]}):null,u.jsxs("footer",{className:"oc-journey-actions",children:[u.jsx("button",{className:"btn btn-ghost",type:"button",onClick:()=>window.open(c,"_blank","noopener,noreferrer"),children:"查看最新诊断"}),r.taskId?u.jsx("button",{className:"btn btn-ghost",type:"button",onClick:()=>p("tasks",{taskId:r.taskId}),children:"打开 Task"}):null,h&&(r.taskId||i.dagRunId)?u.jsx("button",{className:"btn btn-primary",type:"button",onClick:()=>p("recovery",{taskId:r.taskId,dagRunId:i.dagRunId}),children:"恢复选项"}):null]}),u.jsxs("details",{className:"oc-journey-technical",children:[u.jsxs("summary",{children:["技术详情 · ",r.operations.length," 项活动"]}),u.jsx("div",{className:"oc-journey-technical-body",children:r.operations.map(g=>u.jsxs("div",{className:"oc-journey-operation-row",children:[u.jsxs("div",{children:[u.jsx("code",{children:g.operationId}),u.jsx("span",{children:g.action})]}),g.dagRunId?u.jsxs("small",{children:["run · ",g.dagRunId]}):null,g.controller?u.jsxs("small",{children:["controller · ",g.controller]}):null,g.stderrPreview?u.jsx("pre",{className:"is-error",children:fg(g.stderrPreview)}):null,g.summaryPreview?u.jsx("pre",{children:fg(g.summaryPreview)}):null]},g.operationId))})]})]})}function mg(e){return e.state==="prepared"||e.state==="confirmed"?0:e.state==="dispatched"?1:e.state==="error"?2:3}function _c(e,r){return e!==null&&r.includes(e)}function Ak(e){return e.operations>0?"operations":e.gates>0?"gates":"artifacts"}function Dk(e){const r=e.presentation==="sidecar",i=r||e.open,s=S.useRef(null),[o,c]=S.useState("operations"),d=S.useMemo(()=>Ky(e.operationCards),[e.operationCards]),h=d.length+e.humanGateCards.length+e.artifactCards.length,p=S.useMemo(()=>[...e.humanGateCards].sort((b,w)=>{const N=mg(b)-mg(w);return N!==0?N:(w.eventSeq??0)-(b.eventSeq??0)}),[e.humanGateCards]),g=S.useMemo(()=>[...e.artifactCards].sort((b,w)=>(w.eventSeq??0)-(b.eventSeq??0)),[e.artifactCards]);if(lo({open:i&&!r,containerRef:s,triggerRef:e.triggerRef,onEscape:e.onClose}),S.useEffect(()=>{c(Ak({operations:d.length,gates:e.humanGateCards.length,artifacts:e.artifactCards.length}))},[e.sessionId]),S.useEffect(()=>{e.focusRef&&(e.focusRef.startsWith("gate:")?c("gates"):e.focusRef.startsWith("artifact:")?c("artifacts"):c("operations"))},[e.focusRef]),S.useEffect(()=>{if(!i||!e.focusRef)return;const b=window.requestAnimationFrame(()=>{const w=s.current;if(!w)return;Array.from(w.querySelectorAll("[data-activity-ref], [data-tool-call-id], [data-activity-refs]")).find(R=>{const A=R.dataset.activityRefs?.split(" ")??[];return R.dataset.activityRef===e.focusRef||A.includes(e.focusRef??"")||R.dataset.toolCallId&&`tool:${R.dataset.toolCallId}`===e.focusRef})?.scrollIntoView({block:"nearest",behavior:"smooth"})});return()=>window.cancelAnimationFrame(b)},[i,o,e.focusRef]),!i||h===0)return null;let v="is-drawer";r?v="is-sidecar":e.presentation==="sheet"&&(v="is-sheet");const y=r&&e.sidecarRect?{top:e.sidecarRect.top,left:e.sidecarRect.left,height:e.sidecarRect.height,width:e.sidecarRect.width}:void 0,k=u.jsxs("aside",{ref:s,id:"oc-activity-rail",className:`oc-activity-rail ${v} is-${e.phase}`,style:y,"aria-label":"本次对话的活动","aria-busy":e.phase==="switching",tabIndex:-1,children:[u.jsxs("header",{className:"oc-activity-rail-head",children:[u.jsxs("div",{children:[u.jsx("strong",{children:"本次对话的活动"}),u.jsx("small",{children:"运行、门禁与任务产物"})]}),u.jsx("span",{className:"oc-activity-count",children:h}),r?null:u.jsx("button",{type:"button",className:"oc-activity-close","aria-label":"关闭运行活动",onClick:e.onClose,children:"×"})]}),u.jsxs("div",{className:"oc-activity-content",children:[u.jsxs("div",{className:"oc-activity-tabs",role:"tablist","aria-label":"活动类型",children:[u.jsxs("button",{type:"button",role:"tab","aria-selected":o==="operations",className:o==="operations"?"is-active":"",onClick:()=>c("operations"),children:["运行 ",u.jsx("span",{children:d.length})]}),u.jsxs("button",{type:"button",role:"tab","aria-selected":o==="gates",className:o==="gates"?"is-active":"",onClick:()=>c("gates"),children:["门禁 ",u.jsx("span",{children:p.length})]}),u.jsxs("button",{type:"button",role:"tab","aria-selected":o==="artifacts",className:o==="artifacts"?"is-active":"",onClick:()=>c("artifacts"),children:["产物 ",u.jsx("span",{children:g.length})]})]}),u.jsxs("div",{className:"oc-activity-list",children:[o==="operations"&&d.length===0?u.jsx("div",{className:"oc-activity-empty",children:"本次对话还没有任务执行记录。"}):null,o==="operations"?d.map((b,w)=>{const N=b.activityRefs;return u.jsxs("div",{"data-activity-refs":N.join(" "),className:`oc-activity-card-wrap${_c(e.focusRef,N)?" is-focused":""}`,children:[u.jsx(Ik,{journey:b,compact:w>0&&b.compactEligible,origin:e.origin,onNavigateWorkspace:e.onNavigateWorkspace}),u.jsx("button",{type:"button",className:"oc-activity-locate",onClick:()=>e.onLocateConversation(N),children:"查看对话位置"})]},b.key)}):null,o==="gates"&&p.length===0?u.jsx("div",{className:"oc-activity-empty",children:"本次对话还没有需要展示的门禁。"}):null,o==="gates"?p.map(b=>{const w=Vy(b);return u.jsx("div",{className:`oc-activity-card-wrap${_c(e.focusRef,w)?" is-focused":""}`,children:u.jsx(wk,{card:b,origin:e.origin,sessionId:e.sessionId})},b.cardId)}):null,o==="artifacts"&&g.length===0?u.jsx("div",{className:"oc-activity-empty",children:"本次对话还没有任务产物。"}):null,o==="artifacts"?g.map(b=>{const w=Yy(b);return u.jsx("div",{className:`oc-activity-card-wrap${_c(e.focusRef,w)?" is-focused":""}`,children:u.jsx(kk,{artifact:b})},b.artifactId)}):null]})]},e.sessionId)]});return r?Ey.createPortal(k,document.body):k}const ev=420,tv=12;function Ok(e){if(e.layoutMode==="narrow")return"sheet";const r=e.railWidth??ev,i=e.gap??tv;return e.viewportWidth-e.mainRight>=r+i?"sidecar":"drawer"}const Mk={presentation:"drawer",sidecarRect:null};function _k(e,r,i){const[s,o]=S.useState(Mk);return S.useLayoutEffect(()=>{const c=e.current;if(!c)return;const d=c.closest(".panel--chat")??c;let h=0;const p=()=>{window.cancelAnimationFrame(h),h=window.requestAnimationFrame(()=>{const v=c.getBoundingClientRect(),y=d.getBoundingClientRect(),k=Ok({layoutMode:r,viewportWidth:window.innerWidth,mainRight:v.right}),b=k==="sidecar"?{top:y.top,left:v.right+tv,height:y.height,width:ev}:null;o(w=>w.presentation===k&&w.sidecarRect?.top===b?.top&&w.sidecarRect?.left===b?.left&&w.sidecarRect?.height===b?.height&&w.sidecarRect?.width===b?.width?w:{presentation:k,sidecarRect:b})})};p();const g=new ResizeObserver(p);return g.observe(c),d!==c&&g.observe(d),window.addEventListener("resize",p),()=>{window.cancelAnimationFrame(h),g.disconnect(),window.removeEventListener("resize",p)}},[r,e,i]),s}const pg={comfortableMin:620,compactMin:480};function Lk(e){return!Number.isFinite(e)||e<0?"extra-compact":e>=pg.comfortableMin?"comfortable":e>=pg.compactMin?"compact":"extra-compact"}function zk(e){return`is-landing-${e}`}const Bk=[{label:"新建任务",hint:"先走需求分析 skills,再导入创建任务",prompt:["我要新建任务。请先做需求分析,不要用一句话直接 bootstrapFromPrd。","1. 先问我需求内容和范围(frontend / backend / both,默认 both)。","2. 读取并严格执行 `.agents/skills/analyze-product-requirements/SKILL.md`(`loop-agent init --profile full` 会投影该 skill):按规程澄清访谈、校验,并把产物写到 `docs/product-analysis/<requirement-id>/`(product-analysis.md、requirement-clarification.md、product-requirement.md)。","3. product-requirement 为 complete 且校验通过后,再严格执行 `.agents/skills/analyze-product-dependencies/SKILL.md`,生成 dependency-analysis.md 和按需的 api-documentation.md。","4. 两套产物都校验通过后,再用这些文件 bootstrapFromPrd 创建任务,并建议 taskKind。","若上述 skill 不存在,先说明缺失,并提示运行 `loop-agent init --repo-root . --profile full --merge`。"].join(`
|
|
12
|
+
`)},{label:"查看任务状态",hint:"列出任务与就绪/阻塞状态",prompt:"列出当前所有 task 及其状态,重点说明哪些是 Ready 可以推进、哪些 Blocked 及阻塞原因。"},{label:"诊断 DAG 运行",hint:"对失败运行跑 Doctor",prompt:"帮我诊断最近失败或异常的 DAG 运行:先列出最近的 DAG 运行,对有问题的运行执行 doctor,总结根因和可执行的恢复方案。"},{label:"恢复或重跑任务",hint:"默认从节点续跑,勿无故新开 task",prompt:"我要恢复失败或卡住的 DAG。请先 dagReport/doctor 看 primaryFailure.nodeId 与 primaryRecovery;默认用 dagRerunPlan→dagRerun 从失败/安全上游节点续跑(plan 合格后直接 dagRerun,不要 prepareMutationGate)。不要新建 task-id。plan 不合格时:Worker-owned 用 workerTaskRetry;独立 run 用 standaloneTaskRerun。paused 走 approve/resume。确定后直接帮我发起。"}];function nv(e){const r=e.readiness==="setup-required",i=!!e.disabled||r,s=e.density??"comfortable",o=e.mode==="no-session"?"开始一段新的对话":"今天想推进什么?",c=e.mode==="no-session"?"用自然语言编排 loop-agent:查询状态、诊断问题、创建与恢复任务。可先点选下方建议,或新建空白对话。":"会话已就绪。点选建议快速开场,或在下方输入框直接描述目标。业务写入仍经受治理 DAG。";return u.jsxs("div",{className:`oc-empty ${zk(s)}`,role:"status","data-landing-density":s,children:[u.jsxs("div",{className:"oc-empty-hero",children:[u.jsx("img",{className:"oc-empty-icon oc-empty-brand",src:"/favicon.svg",alt:"","aria-hidden":"true",draggable:!1}),u.jsxs("div",{className:"oc-empty-copy",children:[u.jsx("h3",{children:o}),u.jsx("p",{children:c})]})]}),u.jsx("div",{className:"oc-suggestions","aria-label":"开场建议",children:Bk.map(d=>u.jsxs("button",{type:"button",className:"oc-suggestion",onClick:()=>e.onSuggest(d.prompt),disabled:i,children:[u.jsx("strong",{children:d.label}),u.jsx("span",{children:s==="extra-compact"?d.hint.replace(/[,,].*$/,""):d.hint})]},d.label))}),u.jsxs("ul",{className:"oc-empty-tips",children:[u.jsxs("li",{children:[u.jsx("kbd",{children:"@"}),u.jsx("span",{children:"引用仓库文件"})]}),u.jsxs("li",{children:[u.jsx("kbd",{children:"/"}),u.jsx("span",{children:"快捷命令"})]}),u.jsxs("li",{children:[u.jsx("kbd",{children:"Enter"}),u.jsx("span",{children:"发送 · Shift+Enter 换行"})]})]}),e.mode==="no-session"&&e.onCreateSession?u.jsx("button",{type:"button",className:"btn btn-primary oc-empty-cta",onClick:e.onCreateSession,disabled:i,"aria-busy":e.disabled||void 0,children:r?"需先完成 Pi setup":e.disabled?"创建中…":"新建空白对话"}):null]})}function Hk(e){const{interview:r,interviewAnswer:i,onAnswerChange:s,onAnswer:o}=e;return u.jsxs("section",{className:"oc-draft-card","aria-label":"Requirement Interview",children:[u.jsxs("header",{children:[u.jsx("strong",{children:"Requirement Interview"}),u.jsx("span",{children:r.state})]}),r.question&&u.jsxs("div",{className:"oc-interview-bubble",children:[u.jsx("strong",{children:r.question.text}),u.jsxs("p",{children:["建议:",r.question.recommendation]}),u.jsx("textarea",{value:i,onChange:c=>s(c.target.value),placeholder:"输入答案"}),u.jsxs("div",{children:[u.jsx("button",{className:"btn btn-primary",type:"button",onClick:()=>o("override"),disabled:!i.trim(),children:"提交答案"}),u.jsx("button",{className:"btn btn-ghost",type:"button",onClick:()=>o("accept-recommendation"),children:"接受建议"})]})]}),r.draft&&u.jsxs("details",{open:!0,children:[u.jsxs("summary",{children:["TaskContractDraftV1 · ",r.draftSha256?.slice(0,12)]}),u.jsx("pre",{children:JSON.stringify(r.draft,null,2)})]}),r.assessment&&u.jsxs("div",{className:`oc-assessment${r.assessment.fresh?" is-fresh":""}`,children:[u.jsxs("strong",{children:["完整性:",r.assessment.outcome]}),(r.assessment.missingFields??[]).length>0&&u.jsxs("p",{children:["缺失:",r.assessment.missingFields?.join("、")]})]}),r.taskKindRecommendation&&u.jsxs("div",{className:"oc-task-kind-card",children:[u.jsx("span",{children:"taskKind 建议"}),u.jsx("strong",{children:r.taskKindRecommendation}),u.jsx("button",{className:"btn btn-primary",type:"button",onClick:()=>e.onConfirmTaskKind(),children:"由我确认"}),u.jsx("small",{children:"模型不能代替人类确认。"})]}),r.confirmedTaskKind&&u.jsxs("div",{className:"oc-task-kind-card is-confirmed",children:["已由人类确认:",u.jsx("strong",{children:r.confirmedTaskKind})]})]})}function Uk(e,r){const i={};return(e[e.length-1]===""?[...e,""]:e).join((i.padRight?" ":"")+","+(i.padLeft===!1?"":" ")).trim()}const qk=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,$k=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Gk={};function gg(e,r){return(Gk.jsx?$k:qk).test(e)}const Fk=/[ \t\n\f\r]/g;function Pk(e){return typeof e=="object"?e.type==="text"?yg(e.value):!1:yg(e)}function yg(e){return e.replace(Fk,"")===""}class bs{constructor(r,i,s){this.normal=i,this.property=r,s&&(this.space=s)}}bs.prototype.normal={};bs.prototype.property={};bs.prototype.space=void 0;function rv(e,r){const i={},s={};for(const o of e)Object.assign(i,o.property),Object.assign(s,o.normal);return new bs(i,s,r)}function ad(e){return e.toLowerCase()}class cn{constructor(r,i){this.attribute=i,this.property=r}}cn.prototype.attribute="";cn.prototype.booleanish=!1;cn.prototype.boolean=!1;cn.prototype.commaOrSpaceSeparated=!1;cn.prototype.commaSeparated=!1;cn.prototype.defined=!1;cn.prototype.mustUseProperty=!1;cn.prototype.number=!1;cn.prototype.overloadedBoolean=!1;cn.prototype.property="";cn.prototype.spaceSeparated=!1;cn.prototype.space=void 0;let Vk=0;const Ne=Si(),Et=Si(),sd=Si(),pe=Si(),lt=Si(),bi=Si(),Sn=Si();function Si(){return 2**++Vk}const ld=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ne,booleanish:Et,commaOrSpaceSeparated:Sn,commaSeparated:bi,number:pe,overloadedBoolean:sd,spaceSeparated:lt},Symbol.toStringTag,{value:"Module"})),Lc=Object.keys(ld);class Td extends cn{constructor(r,i,s,o){let c=-1;if(super(r,i),vg(this,"space",o),typeof s=="number")for(;++c<Lc.length;){const d=Lc[c];vg(this,Lc[c],(s&ld[d])===ld[d])}}}Td.prototype.defined=!0;function vg(e,r,i){i&&(e[r]=i)}function ma(e){const r={},i={};for(const[s,o]of Object.entries(e.properties)){const c=new Td(s,e.transform(e.attributes||{},s),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(c.mustUseProperty=!0),r[s]=c,i[ad(s)]=s,i[ad(c.attribute)]=s}return new bs(r,i,e.space)}const iv=ma({properties:{ariaActiveDescendant:null,ariaAtomic:Et,ariaAutoComplete:null,ariaBusy:Et,ariaChecked:Et,ariaColCount:pe,ariaColIndex:pe,ariaColSpan:pe,ariaControls:lt,ariaCurrent:null,ariaDescribedBy:lt,ariaDetails:null,ariaDisabled:Et,ariaDropEffect:lt,ariaErrorMessage:null,ariaExpanded:Et,ariaFlowTo:lt,ariaGrabbed:Et,ariaHasPopup:null,ariaHidden:Et,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:lt,ariaLevel:pe,ariaLive:null,ariaModal:Et,ariaMultiLine:Et,ariaMultiSelectable:Et,ariaOrientation:null,ariaOwns:lt,ariaPlaceholder:null,ariaPosInSet:pe,ariaPressed:Et,ariaReadOnly:Et,ariaRelevant:null,ariaRequired:Et,ariaRoleDescription:lt,ariaRowCount:pe,ariaRowIndex:pe,ariaRowSpan:pe,ariaSelected:Et,ariaSetSize:pe,ariaSort:null,ariaValueMax:pe,ariaValueMin:pe,ariaValueNow:pe,ariaValueText:null,role:null},transform(e,r){return r==="role"?r:"aria-"+r.slice(4).toLowerCase()}});function av(e,r){return r in e?e[r]:r}function sv(e,r){return av(e,r.toLowerCase())}const Yk=ma({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:bi,acceptCharset:lt,accessKey:lt,action:null,allow:null,allowFullScreen:Ne,allowPaymentRequest:Ne,allowUserMedia:Ne,alpha:Ne,alt:null,as:null,async:Ne,autoCapitalize:null,autoComplete:lt,autoFocus:Ne,autoPlay:Ne,blocking:lt,capture:null,charSet:null,checked:Ne,cite:null,className:lt,closedBy:null,colorSpace:null,cols:pe,colSpan:pe,command:null,commandFor:null,content:null,contentEditable:Et,controls:Ne,controlsList:lt,coords:pe|bi,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ne,defer:Ne,dir:null,dirName:null,disabled:Ne,download:sd,draggable:Et,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ne,formTarget:null,headers:lt,height:pe,hidden:sd,high:pe,href:null,hrefLang:null,htmlFor:lt,httpEquiv:lt,id:null,imageSizes:null,imageSrcSet:null,inert:Ne,inputMode:null,integrity:null,is:null,isMap:Ne,itemId:null,itemProp:lt,itemRef:lt,itemScope:Ne,itemType:lt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ne,low:pe,manifest:null,max:null,maxLength:pe,media:null,method:null,min:null,minLength:pe,multiple:Ne,muted:Ne,name:null,nonce:null,noModule:Ne,noValidate:Ne,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ne,optimum:pe,pattern:null,ping:lt,placeholder:null,playsInline:Ne,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ne,referrerPolicy:null,rel:lt,required:Ne,reversed:Ne,rows:pe,rowSpan:pe,sandbox:lt,scope:null,scoped:Ne,seamless:Ne,selected:Ne,shadowRootClonable:Ne,shadowRootCustomElementRegistry:Ne,shadowRootDelegatesFocus:Ne,shadowRootMode:null,shadowRootSerializable:Ne,shape:null,size:pe,sizes:null,slot:null,span:pe,spellCheck:Et,src:null,srcDoc:null,srcLang:null,srcSet:null,start:pe,step:null,style:null,tabIndex:pe,target:null,title:null,translate:null,type:null,typeMustMatch:Ne,useMap:null,value:Et,width:pe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:lt,axis:null,background:null,bgColor:null,border:pe,borderColor:null,bottomMargin:pe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ne,declare:Ne,event:null,face:null,frame:null,frameBorder:null,hSpace:pe,leftMargin:pe,link:null,longDesc:null,lowSrc:null,marginHeight:pe,marginWidth:pe,noResize:Ne,noHref:Ne,noShade:Ne,noWrap:Ne,object:null,profile:null,prompt:null,rev:null,rightMargin:pe,rules:null,scheme:null,scrolling:Et,standby:null,summary:null,text:null,topMargin:pe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:pe,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Ne,disablePictureInPicture:Ne,disableRemotePlayback:Ne,exportParts:bi,part:lt,prefix:null,property:null,results:pe,security:null,unselectable:null},space:"html",transform:sv}),Kk=ma({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Sn,accentHeight:pe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:pe,amplitude:pe,arabicForm:null,ascent:pe,attributeName:null,attributeType:null,azimuth:pe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:pe,by:null,calcMode:null,capHeight:pe,className:lt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:pe,diffuseConstant:pe,direction:null,display:null,dur:null,divisor:pe,dominantBaseline:null,download:Ne,dx:null,dy:null,edgeMode:null,editable:null,elevation:pe,enableBackground:null,end:null,event:null,exponent:pe,externalResourcesRequired:null,fill:null,fillOpacity:pe,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:bi,g2:bi,glyphName:bi,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:pe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:pe,horizOriginX:pe,horizOriginY:pe,id:null,ideographic:pe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:pe,k:pe,k1:pe,k2:pe,k3:pe,k4:pe,kernelMatrix:Sn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:pe,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:pe,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:pe,overlineThickness:pe,paintOrder:null,panose1:null,path:null,pathLength:pe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:lt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:pe,pointsAtY:pe,pointsAtZ:pe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Sn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Sn,rev:Sn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Sn,requiredFeatures:Sn,requiredFonts:Sn,requiredFormats:Sn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:pe,specularExponent:pe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:pe,strikethroughThickness:pe,string:null,stroke:null,strokeDashArray:Sn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:pe,strokeOpacity:pe,strokeWidth:null,style:null,surfaceScale:pe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Sn,tabIndex:pe,tableValues:null,target:null,targetX:pe,targetY:pe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Sn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:pe,underlineThickness:pe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:pe,values:null,vAlphabetic:pe,vMathematical:pe,vectorEffect:null,vHanging:pe,vIdeographic:pe,version:null,vertAdvY:pe,vertOriginX:pe,vertOriginY:pe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:pe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:av}),lv=ma({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,r){return"xlink:"+r.slice(5).toLowerCase()}}),ov=ma({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:sv}),uv=ma({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,r){return"xml:"+r.slice(3).toLowerCase()}}),Xk={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Qk=/[A-Z]/g,bg=/-[a-z]/g,Zk=/^data[-\w.:]+$/i;function Jk(e,r){const i=ad(r);let s=r,o=cn;if(i in e.normal)return e.property[e.normal[i]];if(i.length>4&&i.slice(0,4)==="data"&&Zk.test(r)){if(r.charAt(4)==="-"){const c=r.slice(5).replace(bg,e1);s="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=r.slice(4);if(!bg.test(c)){let d=c.replace(Qk,Wk);d.charAt(0)!=="-"&&(d="-"+d),r="data"+d}}o=Td}return new o(s,r)}function Wk(e){return"-"+e.toLowerCase()}function e1(e){return e.charAt(1).toUpperCase()}const t1=rv([iv,Yk,lv,ov,uv],"html"),Ed=rv([iv,Kk,lv,ov,uv],"svg");function n1(e){return e.join(" ").trim()}var sa={},zc,xg;function r1(){if(xg)return zc;xg=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,c=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,d=/^[;\s]*/,h=/^\s+|\s+$/g,p=`
|
|
13
|
+
`,g="/",v="*",y="",k="comment",b="declaration";function w(z,R){if(typeof z!="string")throw new TypeError("First argument must be a string");if(!z)return[];R=R||{};var A=1,E=1;function F(q){var M=q.match(r);M&&(A+=M.length);var D=q.lastIndexOf(p);E=~D?q.length-D:E+q.length}function K(){var q={line:A,column:E};return function(M){return M.position=new O(q),le(),M}}function O(q){this.start=q,this.end={line:A,column:E},this.source=R.source}O.prototype.content=z;function P(q){var M=new Error(R.source+":"+A+":"+E+": "+q);if(M.reason=q,M.filename=R.source,M.line=A,M.column=E,M.source=z,!R.silent)throw M}function Y(q){var M=q.exec(z);if(M){var D=M[0];return F(D),z=z.slice(D.length),M}}function le(){Y(i)}function _(q){var M;for(q=q||[];M=V();)M!==!1&&q.push(M);return q}function V(){var q=K();if(!(g!=z.charAt(0)||v!=z.charAt(1))){for(var M=2;y!=z.charAt(M)&&(v!=z.charAt(M)||g!=z.charAt(M+1));)++M;if(M+=2,y===z.charAt(M-1))return P("End of comment missing");var D=z.slice(2,M-2);return E+=2,F(D),z=z.slice(M),E+=2,q({type:k,comment:D})}}function G(){var q=K(),M=Y(s);if(M){if(V(),!Y(o))return P("property missing ':'");var D=Y(c),H=q({type:b,property:N(M[0].replace(e,y)),value:D?N(D[0].replace(e,y)):y});return Y(d),H}}function ne(){var q=[];_(q);for(var M;M=G();)M!==!1&&(q.push(M),_(q));return q}return le(),ne()}function N(z){return z?z.replace(h,y):y}return zc=w,zc}var Sg;function i1(){if(Sg)return sa;Sg=1;var e=sa&&sa.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(sa,"__esModule",{value:!0}),sa.default=i;const r=e(r1());function i(s,o){let c=null;if(!s||typeof s!="string")return c;const d=(0,r.default)(s),h=typeof o=="function";return d.forEach(p=>{if(p.type!=="declaration")return;const{property:g,value:v}=p;h?o(g,v,p):v&&(c=c||{},c[g]=v)}),c}return sa}var os={},kg;function a1(){if(kg)return os;kg=1,Object.defineProperty(os,"__esModule",{value:!0}),os.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,r=/-([a-z])/g,i=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,c=function(g){return!g||i.test(g)||e.test(g)},d=function(g,v){return v.toUpperCase()},h=function(g,v){return"".concat(v,"-")},p=function(g,v){return v===void 0&&(v={}),c(g)?g:(g=g.toLowerCase(),v.reactCompat?g=g.replace(o,h):g=g.replace(s,h),g.replace(r,d))};return os.camelCase=p,os}var us,wg;function s1(){if(wg)return us;wg=1;var e=us&&us.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},r=e(i1()),i=a1();function s(o,c){var d={};return!o||typeof o!="string"||(0,r.default)(o,function(h,p){h&&p&&(d[(0,i.camelCase)(h,c)]=p)}),d}return s.default=s,us=s,us}var l1=s1();const o1=Sd(l1),cv=dv("end"),Nd=dv("start");function dv(e){return r;function r(i){const s=i&&i.position&&i.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function u1(e){const r=Nd(e),i=cv(e);if(r&&i)return{start:r,end:i}}function hs(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Cg(e.position):"start"in e||"end"in e?Cg(e):"line"in e||"column"in e?od(e):""}function od(e){return Rg(e&&e.line)+":"+Rg(e&&e.column)}function Cg(e){return od(e&&e.start)+"-"+od(e&&e.end)}function Rg(e){return e&&typeof e=="number"?e:1}class Yt extends Error{constructor(r,i,s){super(),typeof i=="string"&&(s=i,i=void 0);let o="",c={},d=!1;if(i&&("line"in i&&"column"in i?c={place:i}:"start"in i&&"end"in i?c={place:i}:"type"in i?c={ancestors:[i],place:i.position}:c={...i}),typeof r=="string"?o=r:!c.cause&&r&&(d=!0,o=r.message,c.cause=r),!c.ruleId&&!c.source&&typeof s=="string"){const p=s.indexOf(":");p===-1?c.ruleId=s:(c.source=s.slice(0,p),c.ruleId=s.slice(p+1))}if(!c.place&&c.ancestors&&c.ancestors){const p=c.ancestors[c.ancestors.length-1];p&&(c.place=p.position)}const h=c.place&&"start"in c.place?c.place.start:c.place;this.ancestors=c.ancestors||void 0,this.cause=c.cause||void 0,this.column=h?h.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=h?h.line:void 0,this.name=hs(c.place)||"1:1",this.place=c.place||void 0,this.reason=this.message,this.ruleId=c.ruleId||void 0,this.source=c.source||void 0,this.stack=d&&c.cause&&typeof c.cause.stack=="string"?c.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Yt.prototype.file="";Yt.prototype.name="";Yt.prototype.reason="";Yt.prototype.message="";Yt.prototype.stack="";Yt.prototype.column=void 0;Yt.prototype.line=void 0;Yt.prototype.ancestors=void 0;Yt.prototype.cause=void 0;Yt.prototype.fatal=void 0;Yt.prototype.place=void 0;Yt.prototype.ruleId=void 0;Yt.prototype.source=void 0;const Id={}.hasOwnProperty,c1=new Map,d1=/[A-Z]/g,f1=new Set(["table","tbody","thead","tfoot","tr"]),h1=new Set(["td","th"]),fv="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function m1(e,r){if(!r||r.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const i=r.filePath||void 0;let s;if(r.development){if(typeof r.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=k1(i,r.jsxDEV)}else{if(typeof r.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof r.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=S1(i,r.jsx,r.jsxs)}const o={Fragment:r.Fragment,ancestors:[],components:r.components||{},create:s,elementAttributeNameCase:r.elementAttributeNameCase||"react",evaluater:r.createEvaluater?r.createEvaluater():void 0,filePath:i,ignoreInvalidStyle:r.ignoreInvalidStyle||!1,passKeys:r.passKeys!==!1,passNode:r.passNode||!1,schema:r.space==="svg"?Ed:t1,stylePropertyNameCase:r.stylePropertyNameCase||"dom",tableCellAlignToStyle:r.tableCellAlignToStyle!==!1},c=hv(o,e,void 0);return c&&typeof c!="string"?c:o.create(e,o.Fragment,{children:c||void 0},void 0)}function hv(e,r,i){if(r.type==="element")return p1(e,r,i);if(r.type==="mdxFlowExpression"||r.type==="mdxTextExpression")return g1(e,r);if(r.type==="mdxJsxFlowElement"||r.type==="mdxJsxTextElement")return v1(e,r,i);if(r.type==="mdxjsEsm")return y1(e,r);if(r.type==="root")return b1(e,r,i);if(r.type==="text")return x1(e,r)}function p1(e,r,i){const s=e.schema;let o=s;r.tagName.toLowerCase()==="svg"&&s.space==="html"&&(o=Ed,e.schema=o),e.ancestors.push(r);const c=pv(e,r.tagName,!1),d=w1(e,r);let h=Dd(e,r);return f1.has(r.tagName)&&(h=h.filter(function(p){return typeof p=="string"?!Pk(p):!0})),mv(e,d,c,r),Ad(d,h),e.ancestors.pop(),e.schema=s,e.create(r,c,d,i)}function g1(e,r){if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}ys(e,r.position)}function y1(e,r){if(r.data&&r.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(r.data.estree);ys(e,r.position)}function v1(e,r,i){const s=e.schema;let o=s;r.name==="svg"&&s.space==="html"&&(o=Ed,e.schema=o),e.ancestors.push(r);const c=r.name===null?e.Fragment:pv(e,r.name,!0),d=C1(e,r),h=Dd(e,r);return mv(e,d,c,r),Ad(d,h),e.ancestors.pop(),e.schema=s,e.create(r,c,d,i)}function b1(e,r,i){const s={};return Ad(s,Dd(e,r)),e.create(r,e.Fragment,s,i)}function x1(e,r){return r.value}function mv(e,r,i,s){typeof i!="string"&&i!==e.Fragment&&e.passNode&&(r.node=s)}function Ad(e,r){if(r.length>0){const i=r.length>1?r:r[0];i&&(e.children=i)}}function S1(e,r,i){return s;function s(o,c,d,h){const g=Array.isArray(d.children)?i:r;return h?g(c,d,h):g(c,d)}}function k1(e,r){return i;function i(s,o,c,d){const h=Array.isArray(c.children),p=Nd(s);return r(o,c,d,h,{columnNumber:p?p.column-1:void 0,fileName:e,lineNumber:p?p.line:void 0},void 0)}}function w1(e,r){const i={};let s,o;for(o in r.properties)if(o!=="children"&&Id.call(r.properties,o)){const c=R1(e,o,r.properties[o]);if(c){const[d,h]=c;e.tableCellAlignToStyle&&d==="align"&&typeof h=="string"&&h1.has(r.tagName)?s=h:i[d]=h}}if(s){const c=i.style||(i.style={});c[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return i}function C1(e,r){const i={};for(const s of r.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const c=s.data.estree.body[0];c.type;const d=c.expression;d.type;const h=d.properties[0];h.type,Object.assign(i,e.evaluater.evaluateExpression(h.argument))}else ys(e,r.position);else{const o=s.name;let c;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const h=s.value.data.estree.body[0];h.type,c=e.evaluater.evaluateExpression(h.expression)}else ys(e,r.position);else c=s.value===null?!0:s.value;i[o]=c}return i}function Dd(e,r){const i=[];let s=-1;const o=e.passKeys?new Map:c1;for(;++s<r.children.length;){const c=r.children[s];let d;if(e.passKeys){const p=c.type==="element"?c.tagName:c.type==="mdxJsxFlowElement"||c.type==="mdxJsxTextElement"?c.name:void 0;if(p){const g=o.get(p)||0;d=p+"-"+g,o.set(p,g+1)}}const h=hv(e,c,d);h!==void 0&&i.push(h)}return i}function R1(e,r,i){const s=Jk(e.schema,r);if(!(i==null||typeof i=="number"&&Number.isNaN(i))){if(Array.isArray(i)&&(i=s.commaSeparated?Uk(i):n1(i)),s.property==="style"){let o=typeof i=="object"?i:j1(e,String(i));return e.stylePropertyNameCase==="css"&&(o=T1(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&s.space?Xk[s.property]||s.property:s.attribute,i]}}function j1(e,r){try{return o1(r,{reactCompat:!0})}catch(i){if(e.ignoreInvalidStyle)return{};const s=i,o=new Yt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=fv+"#cannot-parse-style-attribute",o}}function pv(e,r,i){let s;if(!i)s={type:"Literal",value:r};else if(r.includes(".")){const o=r.split(".");let c=-1,d;for(;++c<o.length;){const h=gg(o[c])?{type:"Identifier",name:o[c]}:{type:"Literal",value:o[c]};d=d?{type:"MemberExpression",object:d,property:h,computed:!!(c&&h.type==="Literal"),optional:!1}:h}s=d}else s=gg(r)&&!/^[a-z]/.test(r)?{type:"Identifier",name:r}:{type:"Literal",value:r};if(s.type==="Literal"){const o=s.value;return Id.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(s);ys(e)}function ys(e,r){const i=new Yt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:r,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=fv+"#cannot-handle-mdx-estrees-without-createevaluater",i}function T1(e){const r={};let i;for(i in e)Id.call(e,i)&&(r[E1(i)]=e[i]);return r}function E1(e){let r=e.replace(d1,N1);return r.slice(0,3)==="ms-"&&(r="-"+r),r}function N1(e){return"-"+e.toLowerCase()}const Bc={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},I1={};function Od(e,r){const i=I1,s=typeof i.includeImageAlt=="boolean"?i.includeImageAlt:!0,o=typeof i.includeHtml=="boolean"?i.includeHtml:!0;return gv(e,s,o)}function gv(e,r,i){if(A1(e)){if("value"in e)return e.type==="html"&&!i?"":e.value;if(r&&"alt"in e&&e.alt)return e.alt;if("children"in e)return jg(e.children,r,i)}return Array.isArray(e)?jg(e,r,i):""}function jg(e,r,i){const s=[];let o=-1;for(;++o<e.length;)s[o]=gv(e[o],r,i);return s.join("")}function A1(e){return!!(e&&typeof e=="object")}const Tg=document.createElement("i");function Md(e){const r="&"+e+";";Tg.innerHTML=r;const i=Tg.textContent;return i.charCodeAt(i.length-1)===59&&e!=="semi"||i===r?!1:i}function kn(e,r,i,s){const o=e.length;let c=0,d;if(r<0?r=-r>o?0:o+r:r=r>o?o:r,i=i>0?i:0,s.length<1e4)d=Array.from(s),d.unshift(r,i),e.splice(...d);else for(i&&e.splice(r,i);c<s.length;)d=s.slice(c,c+1e4),d.unshift(r,0),e.splice(...d),c+=1e4,r+=1e4}function Mn(e,r){return e.length>0?(kn(e,e.length,0,r),e):r}const Eg={}.hasOwnProperty;function yv(e){const r={};let i=-1;for(;++i<e.length;)D1(r,e[i]);return r}function D1(e,r){let i;for(i in r){const o=(Eg.call(e,i)?e[i]:void 0)||(e[i]={}),c=r[i];let d;if(c)for(d in c){Eg.call(o,d)||(o[d]=[]);const h=c[d];O1(o[d],Array.isArray(h)?h:h?[h]:[])}}}function O1(e,r){let i=-1;const s=[];for(;++i<r.length;)(r[i].add==="after"?e:s).push(r[i]);kn(e,0,0,s)}function vv(e,r){const i=Number.parseInt(e,r);return i<9||i===11||i>13&&i<32||i>126&&i<160||i>55295&&i<57344||i>64975&&i<65008||(i&65535)===65535||(i&65535)===65534||i>1114111?"�":String.fromCodePoint(i)}function Hn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Zt=Kr(/[A-Za-z]/),Vt=Kr(/[\dA-Za-z]/),M1=Kr(/[#-'*+\--9=?A-Z^-~]/);function Yl(e){return e!==null&&(e<32||e===127)}const ud=Kr(/\d/),_1=Kr(/[\dA-Fa-f]/),L1=Kr(/[!-/:-@[-`{-~]/);function Ce(e){return e!==null&&e<-2}function ot(e){return e!==null&&(e<0||e===32)}function He(e){return e===-2||e===-1||e===32}const oo=Kr(new RegExp("\\p{P}|\\p{S}","u")),xi=Kr(/\s/);function Kr(e){return r;function r(i){return i!==null&&i>-1&&e.test(String.fromCharCode(i))}}function pa(e){const r=[];let i=-1,s=0,o=0;for(;++i<e.length;){const c=e.charCodeAt(i);let d="";if(c===37&&Vt(e.charCodeAt(i+1))&&Vt(e.charCodeAt(i+2)))o=2;else if(c<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(c))||(d=String.fromCharCode(c));else if(c>55295&&c<57344){const h=e.charCodeAt(i+1);c<56320&&h>56319&&h<57344?(d=String.fromCharCode(c,h),o=1):d="�"}else d=String.fromCharCode(c);d&&(r.push(e.slice(s,i),encodeURIComponent(d)),s=i+o+1,d=""),o&&(i+=o,o=0)}return r.join("")+e.slice(s)}function Ve(e,r,i,s){const o=s?s-1:Number.POSITIVE_INFINITY;let c=0;return d;function d(p){return He(p)?(e.enter(i),h(p)):r(p)}function h(p){return He(p)&&c++<o?(e.consume(p),h):(e.exit(i),r(p))}}const z1={tokenize:B1};function B1(e){const r=e.attempt(this.parser.constructs.contentInitial,s,o);let i;return r;function s(h){if(h===null){e.consume(h);return}return e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),Ve(e,r,"linePrefix")}function o(h){return e.enter("paragraph"),c(h)}function c(h){const p=e.enter("chunkText",{contentType:"text",previous:i});return i&&(i.next=p),i=p,d(h)}function d(h){if(h===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(h);return}return Ce(h)?(e.consume(h),e.exit("chunkText"),c):(e.consume(h),d)}}const H1={tokenize:U1},Ng={tokenize:q1};function U1(e){const r=this,i=[];let s=0,o,c,d;return h;function h(E){if(s<i.length){const F=i[s];return r.containerState=F[1],e.attempt(F[0].continuation,p,g)(E)}return g(E)}function p(E){if(s++,r.containerState._closeFlow){r.containerState._closeFlow=void 0,o&&A();const F=r.events.length;let K=F,O;for(;K--;)if(r.events[K][0]==="exit"&&r.events[K][1].type==="chunkFlow"){O=r.events[K][1].end;break}R(s);let P=F;for(;P<r.events.length;)r.events[P][1].end={...O},P++;return kn(r.events,K+1,0,r.events.slice(F)),r.events.length=P,g(E)}return h(E)}function g(E){if(s===i.length){if(!o)return k(E);if(o.currentConstruct&&o.currentConstruct.concrete)return w(E);r.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return r.containerState={},e.check(Ng,v,y)(E)}function v(E){return o&&A(),R(s),k(E)}function y(E){return r.parser.lazy[r.now().line]=s!==i.length,d=r.now().offset,w(E)}function k(E){return r.containerState={},e.attempt(Ng,b,w)(E)}function b(E){return s++,i.push([r.currentConstruct,r.containerState]),k(E)}function w(E){if(E===null){o&&A(),R(0),e.consume(E);return}return o=o||r.parser.flow(r.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:c}),N(E)}function N(E){if(E===null){z(e.exit("chunkFlow"),!0),R(0),e.consume(E);return}return Ce(E)?(e.consume(E),z(e.exit("chunkFlow")),s=0,r.interrupt=void 0,h):(e.consume(E),N)}function z(E,F){const K=r.sliceStream(E);if(F&&K.push(null),E.previous=c,c&&(c.next=E),c=E,o.defineSkip(E.start),o.write(K),r.parser.lazy[E.start.line]){let O=o.events.length;for(;O--;)if(o.events[O][1].start.offset<d&&(!o.events[O][1].end||o.events[O][1].end.offset>d))return;const P=r.events.length;let Y=P,le,_;for(;Y--;)if(r.events[Y][0]==="exit"&&r.events[Y][1].type==="chunkFlow"){if(le){_=r.events[Y][1].end;break}le=!0}for(R(s),O=P;O<r.events.length;)r.events[O][1].end={..._},O++;kn(r.events,Y+1,0,r.events.slice(P)),r.events.length=O}}function R(E){let F=i.length;for(;F-- >E;){const K=i[F];r.containerState=K[1],K[0].exit.call(r,e)}i.length=E}function A(){o.write([null]),c=void 0,o=void 0,r.containerState._closeFlow=void 0}}function q1(e,r,i){return Ve(e,e.attempt(this.parser.constructs.document,r,i),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function fa(e){if(e===null||ot(e)||xi(e))return 1;if(oo(e))return 2}function uo(e,r,i){const s=[];let o=-1;for(;++o<e.length;){const c=e[o].resolveAll;c&&!s.includes(c)&&(r=c(r,i),s.push(c))}return r}const cd={name:"attention",resolveAll:$1,tokenize:G1};function $1(e,r){let i=-1,s,o,c,d,h,p,g,v;for(;++i<e.length;)if(e[i][0]==="enter"&&e[i][1].type==="attentionSequence"&&e[i][1]._close){for(s=i;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&r.sliceSerialize(e[s][1]).charCodeAt(0)===r.sliceSerialize(e[i][1]).charCodeAt(0)){if((e[s][1]._close||e[i][1]._open)&&(e[i][1].end.offset-e[i][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[i][1].end.offset-e[i][1].start.offset)%3))continue;p=e[s][1].end.offset-e[s][1].start.offset>1&&e[i][1].end.offset-e[i][1].start.offset>1?2:1;const y={...e[s][1].end},k={...e[i][1].start};Ig(y,-p),Ig(k,p),d={type:p>1?"strongSequence":"emphasisSequence",start:y,end:{...e[s][1].end}},h={type:p>1?"strongSequence":"emphasisSequence",start:{...e[i][1].start},end:k},c={type:p>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[i][1].start}},o={type:p>1?"strong":"emphasis",start:{...d.start},end:{...h.end}},e[s][1].end={...d.start},e[i][1].start={...h.end},g=[],e[s][1].end.offset-e[s][1].start.offset&&(g=Mn(g,[["enter",e[s][1],r],["exit",e[s][1],r]])),g=Mn(g,[["enter",o,r],["enter",d,r],["exit",d,r],["enter",c,r]]),g=Mn(g,uo(r.parser.constructs.insideSpan.null,e.slice(s+1,i),r)),g=Mn(g,[["exit",c,r],["enter",h,r],["exit",h,r],["exit",o,r]]),e[i][1].end.offset-e[i][1].start.offset?(v=2,g=Mn(g,[["enter",e[i][1],r],["exit",e[i][1],r]])):v=0,kn(e,s-1,i-s+3,g),i=s+g.length-v-2;break}}for(i=-1;++i<e.length;)e[i][1].type==="attentionSequence"&&(e[i][1].type="data");return e}function G1(e,r){const i=this.parser.constructs.attentionMarkers.null,s=this.previous,o=fa(s);let c;return d;function d(p){return c=p,e.enter("attentionSequence"),h(p)}function h(p){if(p===c)return e.consume(p),h;const g=e.exit("attentionSequence"),v=fa(p),y=!v||v===2&&o||i.includes(p),k=!o||o===2&&v||i.includes(s);return g._open=!!(c===42?y:y&&(o||!k)),g._close=!!(c===42?k:k&&(v||!y)),r(p)}}function Ig(e,r){e.column+=r,e.offset+=r,e._bufferIndex+=r}const F1={name:"autolink",tokenize:P1};function P1(e,r,i){let s=0;return o;function o(b){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),c}function c(b){return Zt(b)?(e.consume(b),d):b===64?i(b):g(b)}function d(b){return b===43||b===45||b===46||Vt(b)?(s=1,h(b)):g(b)}function h(b){return b===58?(e.consume(b),s=0,p):(b===43||b===45||b===46||Vt(b))&&s++<32?(e.consume(b),h):(s=0,g(b))}function p(b){return b===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),r):b===null||b===32||b===60||Yl(b)?i(b):(e.consume(b),p)}function g(b){return b===64?(e.consume(b),v):M1(b)?(e.consume(b),g):i(b)}function v(b){return Vt(b)?y(b):i(b)}function y(b){return b===46?(e.consume(b),s=0,v):b===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),r):k(b)}function k(b){if((b===45||Vt(b))&&s++<63){const w=b===45?k:y;return e.consume(b),w}return i(b)}}const xs={partial:!0,tokenize:V1};function V1(e,r,i){return s;function s(c){return He(c)?Ve(e,o,"linePrefix")(c):o(c)}function o(c){return c===null||Ce(c)?r(c):i(c)}}const bv={continuation:{tokenize:K1},exit:X1,name:"blockQuote",tokenize:Y1};function Y1(e,r,i){const s=this;return o;function o(d){if(d===62){const h=s.containerState;return h.open||(e.enter("blockQuote",{_container:!0}),h.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(d),e.exit("blockQuoteMarker"),c}return i(d)}function c(d){return He(d)?(e.enter("blockQuotePrefixWhitespace"),e.consume(d),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),r):(e.exit("blockQuotePrefix"),r(d))}}function K1(e,r,i){const s=this;return o;function o(d){return He(d)?Ve(e,c,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d):c(d)}function c(d){return e.attempt(bv,r,i)(d)}}function X1(e){e.exit("blockQuote")}const xv={name:"characterEscape",tokenize:Q1};function Q1(e,r,i){return s;function s(c){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(c),e.exit("escapeMarker"),o}function o(c){return L1(c)?(e.enter("characterEscapeValue"),e.consume(c),e.exit("characterEscapeValue"),e.exit("characterEscape"),r):i(c)}}const Sv={name:"characterReference",tokenize:Z1};function Z1(e,r,i){const s=this;let o=0,c,d;return h;function h(y){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(y),e.exit("characterReferenceMarker"),p}function p(y){return y===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(y),e.exit("characterReferenceMarkerNumeric"),g):(e.enter("characterReferenceValue"),c=31,d=Vt,v(y))}function g(y){return y===88||y===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(y),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),c=6,d=_1,v):(e.enter("characterReferenceValue"),c=7,d=ud,v(y))}function v(y){if(y===59&&o){const k=e.exit("characterReferenceValue");return d===Vt&&!Md(s.sliceSerialize(k))?i(y):(e.enter("characterReferenceMarker"),e.consume(y),e.exit("characterReferenceMarker"),e.exit("characterReference"),r)}return d(y)&&o++<c?(e.consume(y),v):i(y)}}const Ag={partial:!0,tokenize:W1},Dg={concrete:!0,name:"codeFenced",tokenize:J1};function J1(e,r,i){const s=this,o={partial:!0,tokenize:K};let c=0,d=0,h;return p;function p(O){return g(O)}function g(O){const P=s.events[s.events.length-1];return c=P&&P[1].type==="linePrefix"?P[2].sliceSerialize(P[1],!0).length:0,h=O,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),v(O)}function v(O){return O===h?(d++,e.consume(O),v):d<3?i(O):(e.exit("codeFencedFenceSequence"),He(O)?Ve(e,y,"whitespace")(O):y(O))}function y(O){return O===null||Ce(O)?(e.exit("codeFencedFence"),s.interrupt?r(O):e.check(Ag,N,F)(O)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),k(O))}function k(O){return O===null||Ce(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),y(O)):He(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ve(e,b,"whitespace")(O)):O===96&&O===h?i(O):(e.consume(O),k)}function b(O){return O===null||Ce(O)?y(O):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),w(O))}function w(O){return O===null||Ce(O)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),y(O)):O===96&&O===h?i(O):(e.consume(O),w)}function N(O){return e.attempt(o,F,z)(O)}function z(O){return e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),R}function R(O){return c>0&&He(O)?Ve(e,A,"linePrefix",c+1)(O):A(O)}function A(O){return O===null||Ce(O)?e.check(Ag,N,F)(O):(e.enter("codeFlowValue"),E(O))}function E(O){return O===null||Ce(O)?(e.exit("codeFlowValue"),A(O)):(e.consume(O),E)}function F(O){return e.exit("codeFenced"),r(O)}function K(O,P,Y){let le=0;return _;function _(M){return O.enter("lineEnding"),O.consume(M),O.exit("lineEnding"),V}function V(M){return O.enter("codeFencedFence"),He(M)?Ve(O,G,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):G(M)}function G(M){return M===h?(O.enter("codeFencedFenceSequence"),ne(M)):Y(M)}function ne(M){return M===h?(le++,O.consume(M),ne):le>=d?(O.exit("codeFencedFenceSequence"),He(M)?Ve(O,q,"whitespace")(M):q(M)):Y(M)}function q(M){return M===null||Ce(M)?(O.exit("codeFencedFence"),P(M)):Y(M)}}}function W1(e,r,i){const s=this;return o;function o(d){return d===null?i(d):(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c)}function c(d){return s.parser.lazy[s.now().line]?i(d):r(d)}}const Hc={name:"codeIndented",tokenize:tw},ew={partial:!0,tokenize:nw};function tw(e,r,i){const s=this;return o;function o(g){return e.enter("codeIndented"),Ve(e,c,"linePrefix",5)(g)}function c(g){const v=s.events[s.events.length-1];return v&&v[1].type==="linePrefix"&&v[2].sliceSerialize(v[1],!0).length>=4?d(g):i(g)}function d(g){return g===null?p(g):Ce(g)?e.attempt(ew,d,p)(g):(e.enter("codeFlowValue"),h(g))}function h(g){return g===null||Ce(g)?(e.exit("codeFlowValue"),d(g)):(e.consume(g),h)}function p(g){return e.exit("codeIndented"),r(g)}}function nw(e,r,i){const s=this;return o;function o(d){return s.parser.lazy[s.now().line]?i(d):Ce(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),o):Ve(e,c,"linePrefix",5)(d)}function c(d){const h=s.events[s.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?r(d):Ce(d)?o(d):i(d)}}const rw={name:"codeText",previous:aw,resolve:iw,tokenize:sw};function iw(e){let r=e.length-4,i=3,s,o;if((e[i][1].type==="lineEnding"||e[i][1].type==="space")&&(e[r][1].type==="lineEnding"||e[r][1].type==="space")){for(s=i;++s<r;)if(e[s][1].type==="codeTextData"){e[i][1].type="codeTextPadding",e[r][1].type="codeTextPadding",i+=2,r-=2;break}}for(s=i-1,r++;++s<=r;)o===void 0?s!==r&&e[s][1].type!=="lineEnding"&&(o=s):(s===r||e[s][1].type==="lineEnding")&&(e[o][1].type="codeTextData",s!==o+2&&(e[o][1].end=e[s-1][1].end,e.splice(o+2,s-o-2),r-=s-o-2,s=o+2),o=void 0);return e}function aw(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function sw(e,r,i){let s=0,o,c;return d;function d(y){return e.enter("codeText"),e.enter("codeTextSequence"),h(y)}function h(y){return y===96?(e.consume(y),s++,h):(e.exit("codeTextSequence"),p(y))}function p(y){return y===null?i(y):y===32?(e.enter("space"),e.consume(y),e.exit("space"),p):y===96?(c=e.enter("codeTextSequence"),o=0,v(y)):Ce(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),p):(e.enter("codeTextData"),g(y))}function g(y){return y===null||y===32||y===96||Ce(y)?(e.exit("codeTextData"),p(y)):(e.consume(y),g)}function v(y){return y===96?(e.consume(y),o++,v):o===s?(e.exit("codeTextSequence"),e.exit("codeText"),r(y)):(c.type="codeTextData",g(y))}}class lw{constructor(r){this.left=r?[...r]:[],this.right=[]}get(r){if(r<0||r>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+r+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return r<this.left.length?this.left[r]:this.right[this.right.length-r+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(r,i){const s=i??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(r,s):r>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-r+this.left.length).reverse():this.left.slice(r).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(r,i,s){const o=i||0;this.setCursor(Math.trunc(r));const c=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return s&&cs(this.left,s),c.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(r){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(r)}pushMany(r){this.setCursor(Number.POSITIVE_INFINITY),cs(this.left,r)}unshift(r){this.setCursor(0),this.right.push(r)}unshiftMany(r){this.setCursor(0),cs(this.right,r.reverse())}setCursor(r){if(!(r===this.left.length||r>this.left.length&&this.right.length===0||r<0&&this.left.length===0))if(r<this.left.length){const i=this.left.splice(r,Number.POSITIVE_INFINITY);cs(this.right,i.reverse())}else{const i=this.right.splice(this.left.length+this.right.length-r,Number.POSITIVE_INFINITY);cs(this.left,i.reverse())}}}function cs(e,r){let i=0;if(r.length<1e4)e.push(...r);else for(;i<r.length;)e.push(...r.slice(i,i+1e4)),i+=1e4}function kv(e){const r={};let i=-1,s,o,c,d,h,p,g;const v=new lw(e);for(;++i<v.length;){for(;i in r;)i=r[i];if(s=v.get(i),i&&s[1].type==="chunkFlow"&&v.get(i-1)[1].type==="listItemPrefix"&&(p=s[1]._tokenizer.events,c=0,c<p.length&&p[c][1].type==="lineEndingBlank"&&(c+=2),c<p.length&&p[c][1].type==="content"))for(;++c<p.length&&p[c][1].type!=="content";)p[c][1].type==="chunkText"&&(p[c][1]._isInFirstContentOfListItem=!0,c++);if(s[0]==="enter")s[1].contentType&&(Object.assign(r,ow(v,i)),i=r[i],g=!0);else if(s[1]._container){for(c=i,o=void 0;c--;)if(d=v.get(c),d[1].type==="lineEnding"||d[1].type==="lineEndingBlank")d[0]==="enter"&&(o&&(v.get(o)[1].type="lineEndingBlank"),d[1].type="lineEnding",o=c);else if(!(d[1].type==="linePrefix"||d[1].type==="listItemIndent"))break;o&&(s[1].end={...v.get(o)[1].start},h=v.slice(o,i),h.unshift(s),v.splice(o,i-o+1,h))}}return kn(e,0,Number.POSITIVE_INFINITY,v.slice(0)),!g}function ow(e,r){const i=e.get(r)[1],s=e.get(r)[2];let o=r-1;const c=[];let d=i._tokenizer;d||(d=s.parser[i.contentType](i.start),i._contentTypeTextTrailing&&(d._contentTypeTextTrailing=!0));const h=d.events,p=[],g={};let v,y,k=-1,b=i,w=0,N=0;const z=[N];for(;b;){for(;e.get(++o)[1]!==b;);c.push(o),b._tokenizer||(v=s.sliceStream(b),b.next||v.push(null),y&&d.defineSkip(b.start),b._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=!0),d.write(v),b._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=void 0)),y=b,b=b.next}for(b=i;++k<h.length;)h[k][0]==="exit"&&h[k-1][0]==="enter"&&h[k][1].type===h[k-1][1].type&&h[k][1].start.line!==h[k][1].end.line&&(N=k+1,z.push(N),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(d.events=[],b?(b._tokenizer=void 0,b.previous=void 0):z.pop(),k=z.length;k--;){const R=h.slice(z[k],z[k+1]),A=c.pop();p.push([A,A+R.length-1]),e.splice(A,2,R)}for(p.reverse(),k=-1;++k<p.length;)g[w+p[k][0]]=w+p[k][1],w+=p[k][1]-p[k][0]-1;return g}const uw={resolve:dw,tokenize:fw},cw={partial:!0,tokenize:hw};function dw(e){return kv(e),e}function fw(e,r){let i;return s;function s(h){return e.enter("content"),i=e.enter("chunkContent",{contentType:"content"}),o(h)}function o(h){return h===null?c(h):Ce(h)?e.check(cw,d,c)(h):(e.consume(h),o)}function c(h){return e.exit("chunkContent"),e.exit("content"),r(h)}function d(h){return e.consume(h),e.exit("chunkContent"),i.next=e.enter("chunkContent",{contentType:"content",previous:i}),i=i.next,o}}function hw(e,r,i){const s=this;return o;function o(d){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),Ve(e,c,"linePrefix")}function c(d){if(d===null||Ce(d))return i(d);const h=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?r(d):e.interrupt(s.parser.constructs.flow,i,r)(d)}}function wv(e,r,i,s,o,c,d,h,p){const g=p||Number.POSITIVE_INFINITY;let v=0;return y;function y(R){return R===60?(e.enter(s),e.enter(o),e.enter(c),e.consume(R),e.exit(c),k):R===null||R===32||R===41||Yl(R)?i(R):(e.enter(s),e.enter(d),e.enter(h),e.enter("chunkString",{contentType:"string"}),N(R))}function k(R){return R===62?(e.enter(c),e.consume(R),e.exit(c),e.exit(o),e.exit(s),r):(e.enter(h),e.enter("chunkString",{contentType:"string"}),b(R))}function b(R){return R===62?(e.exit("chunkString"),e.exit(h),k(R)):R===null||R===60||Ce(R)?i(R):(e.consume(R),R===92?w:b)}function w(R){return R===60||R===62||R===92?(e.consume(R),b):b(R)}function N(R){return!v&&(R===null||R===41||ot(R))?(e.exit("chunkString"),e.exit(h),e.exit(d),e.exit(s),r(R)):v<g&&R===40?(e.consume(R),v++,N):R===41?(e.consume(R),v--,N):R===null||R===32||R===40||Yl(R)?i(R):(e.consume(R),R===92?z:N)}function z(R){return R===40||R===41||R===92?(e.consume(R),N):N(R)}}function Cv(e,r,i,s,o,c){const d=this;let h=0,p;return g;function g(b){return e.enter(s),e.enter(o),e.consume(b),e.exit(o),e.enter(c),v}function v(b){return h>999||b===null||b===91||b===93&&!p||b===94&&!h&&"_hiddenFootnoteSupport"in d.parser.constructs?i(b):b===93?(e.exit(c),e.enter(o),e.consume(b),e.exit(o),e.exit(s),r):Ce(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),v):(e.enter("chunkString",{contentType:"string"}),y(b))}function y(b){return b===null||b===91||b===93||Ce(b)||h++>999?(e.exit("chunkString"),v(b)):(e.consume(b),p||(p=!He(b)),b===92?k:y)}function k(b){return b===91||b===92||b===93?(e.consume(b),h++,y):y(b)}}function Rv(e,r,i,s,o,c){let d;return h;function h(k){return k===34||k===39||k===40?(e.enter(s),e.enter(o),e.consume(k),e.exit(o),d=k===40?41:k,p):i(k)}function p(k){return k===d?(e.enter(o),e.consume(k),e.exit(o),e.exit(s),r):(e.enter(c),g(k))}function g(k){return k===d?(e.exit(c),p(d)):k===null?i(k):Ce(k)?(e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),Ve(e,g,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),v(k))}function v(k){return k===d||k===null||Ce(k)?(e.exit("chunkString"),g(k)):(e.consume(k),k===92?y:v)}function y(k){return k===d||k===92?(e.consume(k),v):v(k)}}function ms(e,r){let i;return s;function s(o){return Ce(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i=!0,s):He(o)?Ve(e,s,i?"linePrefix":"lineSuffix")(o):r(o)}}const mw={name:"definition",tokenize:gw},pw={partial:!0,tokenize:yw};function gw(e,r,i){const s=this;let o;return c;function c(b){return e.enter("definition"),d(b)}function d(b){return Cv.call(s,e,h,i,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function h(b){return o=Hn(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),p):i(b)}function p(b){return ot(b)?ms(e,g)(b):g(b)}function g(b){return wv(e,v,i,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function v(b){return e.attempt(pw,y,y)(b)}function y(b){return He(b)?Ve(e,k,"whitespace")(b):k(b)}function k(b){return b===null||Ce(b)?(e.exit("definition"),s.parser.defined.push(o),r(b)):i(b)}}function yw(e,r,i){return s;function s(h){return ot(h)?ms(e,o)(h):i(h)}function o(h){return Rv(e,c,i,"definitionTitle","definitionTitleMarker","definitionTitleString")(h)}function c(h){return He(h)?Ve(e,d,"whitespace")(h):d(h)}function d(h){return h===null||Ce(h)?r(h):i(h)}}const vw={name:"hardBreakEscape",tokenize:bw};function bw(e,r,i){return s;function s(c){return e.enter("hardBreakEscape"),e.consume(c),o}function o(c){return Ce(c)?(e.exit("hardBreakEscape"),r(c)):i(c)}}const xw={name:"headingAtx",resolve:Sw,tokenize:kw};function Sw(e,r){let i=e.length-2,s=3,o,c;return e[s][1].type==="whitespace"&&(s+=2),i-2>s&&e[i][1].type==="whitespace"&&(i-=2),e[i][1].type==="atxHeadingSequence"&&(s===i-1||i-4>s&&e[i-2][1].type==="whitespace")&&(i-=s+1===i?2:4),i>s&&(o={type:"atxHeadingText",start:e[s][1].start,end:e[i][1].end},c={type:"chunkText",start:e[s][1].start,end:e[i][1].end,contentType:"text"},kn(e,s,i-s+1,[["enter",o,r],["enter",c,r],["exit",c,r],["exit",o,r]])),e}function kw(e,r,i){let s=0;return o;function o(v){return e.enter("atxHeading"),c(v)}function c(v){return e.enter("atxHeadingSequence"),d(v)}function d(v){return v===35&&s++<6?(e.consume(v),d):v===null||ot(v)?(e.exit("atxHeadingSequence"),h(v)):i(v)}function h(v){return v===35?(e.enter("atxHeadingSequence"),p(v)):v===null||Ce(v)?(e.exit("atxHeading"),r(v)):He(v)?Ve(e,h,"whitespace")(v):(e.enter("atxHeadingText"),g(v))}function p(v){return v===35?(e.consume(v),p):(e.exit("atxHeadingSequence"),h(v))}function g(v){return v===null||v===35||ot(v)?(e.exit("atxHeadingText"),h(v)):(e.consume(v),g)}}const ww=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Og=["pre","script","style","textarea"],Cw={concrete:!0,name:"htmlFlow",resolveTo:Tw,tokenize:Ew},Rw={partial:!0,tokenize:Iw},jw={partial:!0,tokenize:Nw};function Tw(e){let r=e.length;for(;r--&&!(e[r][0]==="enter"&&e[r][1].type==="htmlFlow"););return r>1&&e[r-2][1].type==="linePrefix"&&(e[r][1].start=e[r-2][1].start,e[r+1][1].start=e[r-2][1].start,e.splice(r-2,2)),e}function Ew(e,r,i){const s=this;let o,c,d,h,p;return g;function g(C){return v(C)}function v(C){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(C),y}function y(C){return C===33?(e.consume(C),k):C===47?(e.consume(C),c=!0,N):C===63?(e.consume(C),o=3,s.interrupt?r:T):Zt(C)?(e.consume(C),d=String.fromCharCode(C),z):i(C)}function k(C){return C===45?(e.consume(C),o=2,b):C===91?(e.consume(C),o=5,h=0,w):Zt(C)?(e.consume(C),o=4,s.interrupt?r:T):i(C)}function b(C){return C===45?(e.consume(C),s.interrupt?r:T):i(C)}function w(C){const ae="CDATA[";return C===ae.charCodeAt(h++)?(e.consume(C),h===ae.length?s.interrupt?r:G:w):i(C)}function N(C){return Zt(C)?(e.consume(C),d=String.fromCharCode(C),z):i(C)}function z(C){if(C===null||C===47||C===62||ot(C)){const ae=C===47,W=d.toLowerCase();return!ae&&!c&&Og.includes(W)?(o=1,s.interrupt?r(C):G(C)):ww.includes(d.toLowerCase())?(o=6,ae?(e.consume(C),R):s.interrupt?r(C):G(C)):(o=7,s.interrupt&&!s.parser.lazy[s.now().line]?i(C):c?A(C):E(C))}return C===45||Vt(C)?(e.consume(C),d+=String.fromCharCode(C),z):i(C)}function R(C){return C===62?(e.consume(C),s.interrupt?r:G):i(C)}function A(C){return He(C)?(e.consume(C),A):_(C)}function E(C){return C===47?(e.consume(C),_):C===58||C===95||Zt(C)?(e.consume(C),F):He(C)?(e.consume(C),E):_(C)}function F(C){return C===45||C===46||C===58||C===95||Vt(C)?(e.consume(C),F):K(C)}function K(C){return C===61?(e.consume(C),O):He(C)?(e.consume(C),K):E(C)}function O(C){return C===null||C===60||C===61||C===62||C===96?i(C):C===34||C===39?(e.consume(C),p=C,P):He(C)?(e.consume(C),O):Y(C)}function P(C){return C===p?(e.consume(C),p=null,le):C===null||Ce(C)?i(C):(e.consume(C),P)}function Y(C){return C===null||C===34||C===39||C===47||C===60||C===61||C===62||C===96||ot(C)?K(C):(e.consume(C),Y)}function le(C){return C===47||C===62||He(C)?E(C):i(C)}function _(C){return C===62?(e.consume(C),V):i(C)}function V(C){return C===null||Ce(C)?G(C):He(C)?(e.consume(C),V):i(C)}function G(C){return C===45&&o===2?(e.consume(C),D):C===60&&o===1?(e.consume(C),H):C===62&&o===4?(e.consume(C),I):C===63&&o===3?(e.consume(C),T):C===93&&o===5?(e.consume(C),te):Ce(C)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(Rw,U,ne)(C)):C===null||Ce(C)?(e.exit("htmlFlowData"),ne(C)):(e.consume(C),G)}function ne(C){return e.check(jw,q,U)(C)}function q(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),M}function M(C){return C===null||Ce(C)?ne(C):(e.enter("htmlFlowData"),G(C))}function D(C){return C===45?(e.consume(C),T):G(C)}function H(C){return C===47?(e.consume(C),d="",B):G(C)}function B(C){if(C===62){const ae=d.toLowerCase();return Og.includes(ae)?(e.consume(C),I):G(C)}return Zt(C)&&d.length<8?(e.consume(C),d+=String.fromCharCode(C),B):G(C)}function te(C){return C===93?(e.consume(C),T):G(C)}function T(C){return C===62?(e.consume(C),I):C===45&&o===2?(e.consume(C),T):G(C)}function I(C){return C===null||Ce(C)?(e.exit("htmlFlowData"),U(C)):(e.consume(C),I)}function U(C){return e.exit("htmlFlow"),r(C)}}function Nw(e,r,i){const s=this;return o;function o(d){return Ce(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c):i(d)}function c(d){return s.parser.lazy[s.now().line]?i(d):r(d)}}function Iw(e,r,i){return s;function s(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(xs,r,i)}}const Aw={name:"htmlText",tokenize:Dw};function Dw(e,r,i){const s=this;let o,c,d;return h;function h(T){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(T),p}function p(T){return T===33?(e.consume(T),g):T===47?(e.consume(T),K):T===63?(e.consume(T),E):Zt(T)?(e.consume(T),Y):i(T)}function g(T){return T===45?(e.consume(T),v):T===91?(e.consume(T),c=0,w):Zt(T)?(e.consume(T),A):i(T)}function v(T){return T===45?(e.consume(T),b):i(T)}function y(T){return T===null?i(T):T===45?(e.consume(T),k):Ce(T)?(d=y,H(T)):(e.consume(T),y)}function k(T){return T===45?(e.consume(T),b):y(T)}function b(T){return T===62?D(T):T===45?k(T):y(T)}function w(T){const I="CDATA[";return T===I.charCodeAt(c++)?(e.consume(T),c===I.length?N:w):i(T)}function N(T){return T===null?i(T):T===93?(e.consume(T),z):Ce(T)?(d=N,H(T)):(e.consume(T),N)}function z(T){return T===93?(e.consume(T),R):N(T)}function R(T){return T===62?D(T):T===93?(e.consume(T),R):N(T)}function A(T){return T===null||T===62?D(T):Ce(T)?(d=A,H(T)):(e.consume(T),A)}function E(T){return T===null?i(T):T===63?(e.consume(T),F):Ce(T)?(d=E,H(T)):(e.consume(T),E)}function F(T){return T===62?D(T):E(T)}function K(T){return Zt(T)?(e.consume(T),O):i(T)}function O(T){return T===45||Vt(T)?(e.consume(T),O):P(T)}function P(T){return Ce(T)?(d=P,H(T)):He(T)?(e.consume(T),P):D(T)}function Y(T){return T===45||Vt(T)?(e.consume(T),Y):T===47||T===62||ot(T)?le(T):i(T)}function le(T){return T===47?(e.consume(T),D):T===58||T===95||Zt(T)?(e.consume(T),_):Ce(T)?(d=le,H(T)):He(T)?(e.consume(T),le):D(T)}function _(T){return T===45||T===46||T===58||T===95||Vt(T)?(e.consume(T),_):V(T)}function V(T){return T===61?(e.consume(T),G):Ce(T)?(d=V,H(T)):He(T)?(e.consume(T),V):le(T)}function G(T){return T===null||T===60||T===61||T===62||T===96?i(T):T===34||T===39?(e.consume(T),o=T,ne):Ce(T)?(d=G,H(T)):He(T)?(e.consume(T),G):(e.consume(T),q)}function ne(T){return T===o?(e.consume(T),o=void 0,M):T===null?i(T):Ce(T)?(d=ne,H(T)):(e.consume(T),ne)}function q(T){return T===null||T===34||T===39||T===60||T===61||T===96?i(T):T===47||T===62||ot(T)?le(T):(e.consume(T),q)}function M(T){return T===47||T===62||ot(T)?le(T):i(T)}function D(T){return T===62?(e.consume(T),e.exit("htmlTextData"),e.exit("htmlText"),r):i(T)}function H(T){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),B}function B(T){return He(T)?Ve(e,te,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):te(T)}function te(T){return e.enter("htmlTextData"),d(T)}}const _d={name:"labelEnd",resolveAll:Lw,resolveTo:zw,tokenize:Bw},Ow={tokenize:Hw},Mw={tokenize:Uw},_w={tokenize:qw};function Lw(e){let r=-1;const i=[];for(;++r<e.length;){const s=e[r][1];if(i.push(e[r]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const o=s.type==="labelImage"?4:2;s.type="data",r+=o}}return e.length!==i.length&&kn(e,0,e.length,i),e}function zw(e,r){let i=e.length,s=0,o,c,d,h;for(;i--;)if(o=e[i][1],c){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[i][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(d){if(e[i][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(c=i,o.type!=="labelLink")){s=2;break}}else o.type==="labelEnd"&&(d=i);const p={type:e[c][1].type==="labelLink"?"link":"image",start:{...e[c][1].start},end:{...e[e.length-1][1].end}},g={type:"label",start:{...e[c][1].start},end:{...e[d][1].end}},v={type:"labelText",start:{...e[c+s+2][1].end},end:{...e[d-2][1].start}};return h=[["enter",p,r],["enter",g,r]],h=Mn(h,e.slice(c+1,c+s+3)),h=Mn(h,[["enter",v,r]]),h=Mn(h,uo(r.parser.constructs.insideSpan.null,e.slice(c+s+4,d-3),r)),h=Mn(h,[["exit",v,r],e[d-2],e[d-1],["exit",g,r]]),h=Mn(h,e.slice(d+1)),h=Mn(h,[["exit",p,r]]),kn(e,c,e.length,h),e}function Bw(e,r,i){const s=this;let o=s.events.length,c,d;for(;o--;)if((s.events[o][1].type==="labelImage"||s.events[o][1].type==="labelLink")&&!s.events[o][1]._balanced){c=s.events[o][1];break}return h;function h(k){return c?c._inactive?y(k):(d=s.parser.defined.includes(Hn(s.sliceSerialize({start:c.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(k),e.exit("labelMarker"),e.exit("labelEnd"),p):i(k)}function p(k){return k===40?e.attempt(Ow,v,d?v:y)(k):k===91?e.attempt(Mw,v,d?g:y)(k):d?v(k):y(k)}function g(k){return e.attempt(_w,v,y)(k)}function v(k){return r(k)}function y(k){return c._balanced=!0,i(k)}}function Hw(e,r,i){return s;function s(y){return e.enter("resource"),e.enter("resourceMarker"),e.consume(y),e.exit("resourceMarker"),o}function o(y){return ot(y)?ms(e,c)(y):c(y)}function c(y){return y===41?v(y):wv(e,d,h,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(y)}function d(y){return ot(y)?ms(e,p)(y):v(y)}function h(y){return i(y)}function p(y){return y===34||y===39||y===40?Rv(e,g,i,"resourceTitle","resourceTitleMarker","resourceTitleString")(y):v(y)}function g(y){return ot(y)?ms(e,v)(y):v(y)}function v(y){return y===41?(e.enter("resourceMarker"),e.consume(y),e.exit("resourceMarker"),e.exit("resource"),r):i(y)}}function Uw(e,r,i){const s=this;return o;function o(h){return Cv.call(s,e,c,d,"reference","referenceMarker","referenceString")(h)}function c(h){return s.parser.defined.includes(Hn(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?r(h):i(h)}function d(h){return i(h)}}function qw(e,r,i){return s;function s(c){return e.enter("reference"),e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),o}function o(c){return c===93?(e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),e.exit("reference"),r):i(c)}}const $w={name:"labelStartImage",resolveAll:_d.resolveAll,tokenize:Gw};function Gw(e,r,i){const s=this;return o;function o(h){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(h),e.exit("labelImageMarker"),c}function c(h){return h===91?(e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelImage"),d):i(h)}function d(h){return h===94&&"_hiddenFootnoteSupport"in s.parser.constructs?i(h):r(h)}}const Fw={name:"labelStartLink",resolveAll:_d.resolveAll,tokenize:Pw};function Pw(e,r,i){const s=this;return o;function o(d){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelLink"),c}function c(d){return d===94&&"_hiddenFootnoteSupport"in s.parser.constructs?i(d):r(d)}}const Uc={name:"lineEnding",tokenize:Vw};function Vw(e,r){return i;function i(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Ve(e,r,"linePrefix")}}const ql={name:"thematicBreak",tokenize:Yw};function Yw(e,r,i){let s=0,o;return c;function c(g){return e.enter("thematicBreak"),d(g)}function d(g){return o=g,h(g)}function h(g){return g===o?(e.enter("thematicBreakSequence"),p(g)):s>=3&&(g===null||Ce(g))?(e.exit("thematicBreak"),r(g)):i(g)}function p(g){return g===o?(e.consume(g),s++,p):(e.exit("thematicBreakSequence"),He(g)?Ve(e,h,"whitespace")(g):h(g))}}const on={continuation:{tokenize:Zw},exit:Ww,name:"list",tokenize:Qw},Kw={partial:!0,tokenize:eC},Xw={partial:!0,tokenize:Jw};function Qw(e,r,i){const s=this,o=s.events[s.events.length-1];let c=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,d=0;return h;function h(b){const w=s.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!s.containerState.marker||b===s.containerState.marker:ud(b)){if(s.containerState.type||(s.containerState.type=w,e.enter(w,{_container:!0})),w==="listUnordered")return e.enter("listItemPrefix"),b===42||b===45?e.check(ql,i,g)(b):g(b);if(!s.interrupt||b===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),p(b)}return i(b)}function p(b){return ud(b)&&++d<10?(e.consume(b),p):(!s.interrupt||d<2)&&(s.containerState.marker?b===s.containerState.marker:b===41||b===46)?(e.exit("listItemValue"),g(b)):i(b)}function g(b){return e.enter("listItemMarker"),e.consume(b),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||b,e.check(xs,s.interrupt?i:v,e.attempt(Kw,k,y))}function v(b){return s.containerState.initialBlankLine=!0,c++,k(b)}function y(b){return He(b)?(e.enter("listItemPrefixWhitespace"),e.consume(b),e.exit("listItemPrefixWhitespace"),k):i(b)}function k(b){return s.containerState.size=c+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,r(b)}}function Zw(e,r,i){const s=this;return s.containerState._closeFlow=void 0,e.check(xs,o,c);function o(h){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,Ve(e,r,"listItemIndent",s.containerState.size+1)(h)}function c(h){return s.containerState.furtherBlankLines||!He(h)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,d(h)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(Xw,r,d)(h))}function d(h){return s.containerState._closeFlow=!0,s.interrupt=void 0,Ve(e,e.attempt(on,r,i),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(h)}}function Jw(e,r,i){const s=this;return Ve(e,o,"listItemIndent",s.containerState.size+1);function o(c){const d=s.events[s.events.length-1];return d&&d[1].type==="listItemIndent"&&d[2].sliceSerialize(d[1],!0).length===s.containerState.size?r(c):i(c)}}function Ww(e){e.exit(this.containerState.type)}function eC(e,r,i){const s=this;return Ve(e,o,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(c){const d=s.events[s.events.length-1];return!He(c)&&d&&d[1].type==="listItemPrefixWhitespace"?r(c):i(c)}}const Mg={name:"setextUnderline",resolveTo:tC,tokenize:nC};function tC(e,r){let i=e.length,s,o,c;for(;i--;)if(e[i][0]==="enter"){if(e[i][1].type==="content"){s=i;break}e[i][1].type==="paragraph"&&(o=i)}else e[i][1].type==="content"&&e.splice(i,1),!c&&e[i][1].type==="definition"&&(c=i);const d={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",c?(e.splice(o,0,["enter",d,r]),e.splice(c+1,0,["exit",e[s][1],r]),e[s][1].end={...e[c][1].end}):e[s][1]=d,e.push(["exit",d,r]),e}function nC(e,r,i){const s=this;let o;return c;function c(g){let v=s.events.length,y;for(;v--;)if(s.events[v][1].type!=="lineEnding"&&s.events[v][1].type!=="linePrefix"&&s.events[v][1].type!=="content"){y=s.events[v][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||y)?(e.enter("setextHeadingLine"),o=g,d(g)):i(g)}function d(g){return e.enter("setextHeadingLineSequence"),h(g)}function h(g){return g===o?(e.consume(g),h):(e.exit("setextHeadingLineSequence"),He(g)?Ve(e,p,"lineSuffix")(g):p(g))}function p(g){return g===null||Ce(g)?(e.exit("setextHeadingLine"),r(g)):i(g)}}const rC={tokenize:iC};function iC(e){const r=this,i=e.attempt(xs,s,e.attempt(this.parser.constructs.flowInitial,o,Ve(e,e.attempt(this.parser.constructs.flow,o,e.attempt(uw,o)),"linePrefix")));return i;function s(c){if(c===null){e.consume(c);return}return e.enter("lineEndingBlank"),e.consume(c),e.exit("lineEndingBlank"),r.currentConstruct=void 0,i}function o(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),r.currentConstruct=void 0,i}}const aC={resolveAll:Tv()},sC=jv("string"),lC=jv("text");function jv(e){return{resolveAll:Tv(e==="text"?oC:void 0),tokenize:r};function r(i){const s=this,o=this.parser.constructs[e],c=i.attempt(o,d,h);return d;function d(v){return g(v)?c(v):h(v)}function h(v){if(v===null){i.consume(v);return}return i.enter("data"),i.consume(v),p}function p(v){return g(v)?(i.exit("data"),c(v)):(i.consume(v),p)}function g(v){if(v===null)return!0;const y=o[v];let k=-1;if(y)for(;++k<y.length;){const b=y[k];if(!b.previous||b.previous.call(s,s.previous))return!0}return!1}}}function Tv(e){return r;function r(i,s){let o=-1,c;for(;++o<=i.length;)c===void 0?i[o]&&i[o][1].type==="data"&&(c=o,o++):(!i[o]||i[o][1].type!=="data")&&(o!==c+2&&(i[c][1].end=i[o-1][1].end,i.splice(c+2,o-c-2),o=c+2),c=void 0);return e?e(i,s):i}}function oC(e,r){let i=0;for(;++i<=e.length;)if((i===e.length||e[i][1].type==="lineEnding")&&e[i-1][1].type==="data"){const s=e[i-1][1],o=r.sliceStream(s);let c=o.length,d=-1,h=0,p;for(;c--;){const g=o[c];if(typeof g=="string"){for(d=g.length;g.charCodeAt(d-1)===32;)h++,d--;if(d)break;d=-1}else if(g===-2)p=!0,h++;else if(g!==-1){c++;break}}if(r._contentTypeTextTrailing&&i===e.length&&(h=0),h){const g={type:i===e.length||p||h<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:c?d:s.start._bufferIndex+d,_index:s.start._index+c,line:s.end.line,column:s.end.column-h,offset:s.end.offset-h},end:{...s.end}};s.end={...g.start},s.start.offset===s.end.offset?Object.assign(s,g):(e.splice(i,0,["enter",g,r],["exit",g,r]),i+=2)}i++}return e}const uC={42:on,43:on,45:on,48:on,49:on,50:on,51:on,52:on,53:on,54:on,55:on,56:on,57:on,62:bv},cC={91:mw},dC={[-2]:Hc,[-1]:Hc,32:Hc},fC={35:xw,42:ql,45:[Mg,ql],60:Cw,61:Mg,95:ql,96:Dg,126:Dg},hC={38:Sv,92:xv},mC={[-5]:Uc,[-4]:Uc,[-3]:Uc,33:$w,38:Sv,42:cd,60:[F1,Aw],91:Fw,92:[vw,xv],93:_d,95:cd,96:rw},pC={null:[cd,aC]},gC={null:[42,95]},yC={null:[]},vC=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:gC,contentInitial:cC,disable:yC,document:uC,flow:fC,flowInitial:dC,insideSpan:pC,string:hC,text:mC},Symbol.toStringTag,{value:"Module"}));function bC(e,r,i){let s={_bufferIndex:-1,_index:0,line:i&&i.line||1,column:i&&i.column||1,offset:i&&i.offset||0};const o={},c=[];let d=[],h=[];const p={attempt:P(K),check:P(O),consume:A,enter:E,exit:F,interrupt:P(O,{interrupt:!0})},g={code:null,containerState:{},defineSkip:N,events:[],now:w,parser:e,previous:null,sliceSerialize:k,sliceStream:b,write:y};let v=r.tokenize.call(g,p);return r.resolveAll&&c.push(r),g;function y(V){return d=Mn(d,V),z(),d[d.length-1]!==null?[]:(Y(r,0),g.events=uo(c,g.events,g),g.events)}function k(V,G){return SC(b(V),G)}function b(V){return xC(d,V)}function w(){const{_bufferIndex:V,_index:G,line:ne,column:q,offset:M}=s;return{_bufferIndex:V,_index:G,line:ne,column:q,offset:M}}function N(V){o[V.line]=V.column,_()}function z(){let V;for(;s._index<d.length;){const G=d[s._index];if(typeof G=="string")for(V=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===V&&s._bufferIndex<G.length;)R(G.charCodeAt(s._bufferIndex));else R(G)}}function R(V){v=v(V)}function A(V){Ce(V)?(s.line++,s.column=1,s.offset+=V===-3?2:1,_()):V!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===d[s._index].length&&(s._bufferIndex=-1,s._index++)),g.previous=V}function E(V,G){const ne=G||{};return ne.type=V,ne.start=w(),g.events.push(["enter",ne,g]),h.push(ne),ne}function F(V){const G=h.pop();return G.end=w(),g.events.push(["exit",G,g]),G}function K(V,G){Y(V,G.from)}function O(V,G){G.restore()}function P(V,G){return ne;function ne(q,M,D){let H,B,te,T;return Array.isArray(q)?U(q):"tokenize"in q?U([q]):I(q);function I(Q){return ue;function ue(me){const ge=me!==null&&Q[me],fe=me!==null&&Q.null,Se=[...Array.isArray(ge)?ge:ge?[ge]:[],...Array.isArray(fe)?fe:fe?[fe]:[]];return U(Se)(me)}}function U(Q){return H=Q,B=0,Q.length===0?D:C(Q[B])}function C(Q){return ue;function ue(me){return T=le(),te=Q,Q.partial||(g.currentConstruct=Q),Q.name&&g.parser.constructs.disable.null.includes(Q.name)?W():Q.tokenize.call(G?Object.assign(Object.create(g),G):g,p,ae,W)(me)}}function ae(Q){return V(te,T),M}function W(Q){return T.restore(),++B<H.length?C(H[B]):D}}}function Y(V,G){V.resolveAll&&!c.includes(V)&&c.push(V),V.resolve&&kn(g.events,G,g.events.length-G,V.resolve(g.events.slice(G),g)),V.resolveTo&&(g.events=V.resolveTo(g.events,g))}function le(){const V=w(),G=g.previous,ne=g.currentConstruct,q=g.events.length,M=Array.from(h);return{from:q,restore:D};function D(){s=V,g.previous=G,g.currentConstruct=ne,g.events.length=q,h=M,_()}}function _(){s.line in o&&s.column<2&&(s.column=o[s.line],s.offset+=o[s.line]-1)}}function xC(e,r){const i=r.start._index,s=r.start._bufferIndex,o=r.end._index,c=r.end._bufferIndex;let d;if(i===o)d=[e[i].slice(s,c)];else{if(d=e.slice(i,o),s>-1){const h=d[0];typeof h=="string"?d[0]=h.slice(s):d.shift()}c>0&&d.push(e[o].slice(0,c))}return d}function SC(e,r){let i=-1;const s=[];let o;for(;++i<e.length;){const c=e[i];let d;if(typeof c=="string")d=c;else switch(c){case-5:{d="\r";break}case-4:{d=`
|
|
14
|
+
`;break}case-3:{d=`\r
|
|
15
|
+
`;break}case-2:{d=r?" ":" ";break}case-1:{if(!r&&o)continue;d=" ";break}default:d=String.fromCharCode(c)}o=c===-2,s.push(d)}return s.join("")}function kC(e){const s={constructs:yv([vC,...(e||{}).extensions||[]]),content:o(z1),defined:[],document:o(H1),flow:o(rC),lazy:{},string:o(sC),text:o(lC)};return s;function o(c){return d;function d(h){return bC(s,c,h)}}}function wC(e){for(;!kv(e););return e}const _g=/[\0\t\n\r]/g;function CC(){let e=1,r="",i=!0,s;return o;function o(c,d,h){const p=[];let g,v,y,k,b;for(c=r+(typeof c=="string"?c.toString():new TextDecoder(d||void 0).decode(c)),y=0,r="",i&&(c.charCodeAt(0)===65279&&y++,i=void 0);y<c.length;){if(_g.lastIndex=y,g=_g.exec(c),k=g&&g.index!==void 0?g.index:c.length,b=c.charCodeAt(k),!g){r=c.slice(y);break}if(b===10&&y===k&&s)p.push(-3),s=void 0;else switch(s&&(p.push(-5),s=void 0),y<k&&(p.push(c.slice(y,k)),e+=k-y),b){case 0:{p.push(65533),e++;break}case 9:{for(v=Math.ceil(e/4)*4,p.push(-2);e++<v;)p.push(-1);break}case 10:{p.push(-4),e=1;break}default:s=!0,e=1}y=k+1}return h&&(s&&p.push(-5),r&&p.push(r),p.push(null)),p}}const RC=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function jC(e){return e.replace(RC,TC)}function TC(e,r,i){if(r)return r;if(i.charCodeAt(0)===35){const o=i.charCodeAt(1),c=o===120||o===88;return vv(i.slice(c?2:1),c?16:10)}return Md(i)||e}const Ev={}.hasOwnProperty;function EC(e,r,i){return r&&typeof r=="object"&&(i=r,r=void 0),NC(i)(wC(kC(i).document().write(CC()(e,r,!0))))}function NC(e){const r={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:c(Wt),autolinkProtocol:le,autolinkEmail:le,atxHeading:c(ct),blockQuote:c(fe),characterEscape:le,characterReference:le,codeFenced:c(Se),codeFencedFenceInfo:d,codeFencedFenceMeta:d,codeIndented:c(Se,d),codeText:c(Me,d),codeTextData:le,data:le,codeFlowValue:le,definition:c(et),definitionDestinationString:d,definitionLabelString:d,definitionTitleString:d,emphasis:c(Ue),hardBreakEscape:c(Jt),hardBreakTrailing:c(Jt),htmlFlow:c(Kt,d),htmlFlowData:le,htmlText:c(Kt,d),htmlTextData:le,image:c(Nt),label:d,link:c(Wt),listItem:c(Ee),listItemValue:k,listOrdered:c(Gt,y),listUnordered:c(Gt),paragraph:c(Te),reference:C,referenceString:d,resourceDestinationString:d,resourceTitleString:d,setextHeading:c(ct),strong:c(pt),thematicBreak:c(_e)},exit:{atxHeading:p(),atxHeadingSequence:K,autolink:p(),autolinkEmail:ge,autolinkProtocol:me,blockQuote:p(),characterEscapeValue:_,characterReferenceMarkerHexadecimal:W,characterReferenceMarkerNumeric:W,characterReferenceValue:Q,characterReference:ue,codeFenced:p(z),codeFencedFence:N,codeFencedFenceInfo:b,codeFencedFenceMeta:w,codeFlowValue:_,codeIndented:p(R),codeText:p(M),codeTextData:_,data:_,definition:p(),definitionDestinationString:F,definitionLabelString:A,definitionTitleString:E,emphasis:p(),hardBreakEscape:p(G),hardBreakTrailing:p(G),htmlFlow:p(ne),htmlFlowData:_,htmlText:p(q),htmlTextData:_,image:p(H),label:te,labelText:B,lineEnding:V,link:p(D),listItem:p(),listOrdered:p(),listUnordered:p(),paragraph:p(),referenceString:ae,resourceDestinationString:T,resourceTitleString:I,resource:U,setextHeading:p(Y),setextHeadingLineSequence:P,setextHeadingText:O,strong:p(),thematicBreak:p()}};Nv(r,(e||{}).mdastExtensions||[]);const i={};return s;function s(se){let he={type:"root",children:[]};const be={stack:[he],tokenStack:[],config:r,enter:h,exit:g,buffer:d,resume:v,data:i},we=[];let je=-1;for(;++je<se.length;)if(se[je][1].type==="listOrdered"||se[je][1].type==="listUnordered")if(se[je][0]==="enter")we.push(je);else{const Je=we.pop();je=o(se,Je,je)}for(je=-1;++je<se.length;){const Je=r[se[je][0]];Ev.call(Je,se[je][1].type)&&Je[se[je][1].type].call(Object.assign({sliceSerialize:se[je][2].sliceSerialize},be),se[je][1])}if(be.tokenStack.length>0){const Je=be.tokenStack[be.tokenStack.length-1];(Je[1]||Lg).call(be,void 0,Je[0])}for(he.position={start:Fr(se.length>0?se[0][1].start:{line:1,column:1,offset:0}),end:Fr(se.length>0?se[se.length-2][1].end:{line:1,column:1,offset:0})},je=-1;++je<r.transforms.length;)he=r.transforms[je](he)||he;return he}function o(se,he,be){let we=he-1,je=-1,Je=!1,It,mt,Le,At;for(;++we<=be;){const $e=se[we];switch($e[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{$e[0]==="enter"?je++:je--,At=void 0;break}case"lineEndingBlank":{$e[0]==="enter"&&(It&&!At&&!je&&!Le&&(Le=we),At=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:At=void 0}if(!je&&$e[0]==="enter"&&$e[1].type==="listItemPrefix"||je===-1&&$e[0]==="exit"&&($e[1].type==="listUnordered"||$e[1].type==="listOrdered")){if(It){let dn=we;for(mt=void 0;dn--;){const Ft=se[dn];if(Ft[1].type==="lineEnding"||Ft[1].type==="lineEndingBlank"){if(Ft[0]==="exit")continue;mt&&(se[mt][1].type="lineEndingBlank",Je=!0),Ft[1].type="lineEnding",mt=dn}else if(!(Ft[1].type==="linePrefix"||Ft[1].type==="blockQuotePrefix"||Ft[1].type==="blockQuotePrefixWhitespace"||Ft[1].type==="blockQuoteMarker"||Ft[1].type==="listItemIndent"))break}Le&&(!mt||Le<mt)&&(It._spread=!0),It.end=Object.assign({},mt?se[mt][1].start:$e[1].end),se.splice(mt||we,0,["exit",It,$e[2]]),we++,be++}if($e[1].type==="listItemPrefix"){const dn={type:"listItem",_spread:!1,start:Object.assign({},$e[1].start),end:void 0};It=dn,se.splice(we,0,["enter",dn,$e[2]]),we++,be++,Le=void 0,At=!0}}}return se[he][1]._spread=Je,be}function c(se,he){return be;function be(we){h.call(this,se(we),we),he&&he.call(this,we)}}function d(){this.stack.push({type:"fragment",children:[]})}function h(se,he,be){this.stack[this.stack.length-1].children.push(se),this.stack.push(se),this.tokenStack.push([he,be||void 0]),se.position={start:Fr(he.start),end:void 0}}function p(se){return he;function he(be){se&&se.call(this,be),g.call(this,be)}}function g(se,he){const be=this.stack.pop(),we=this.tokenStack.pop();if(we)we[0].type!==se.type&&(he?he.call(this,se,we[0]):(we[1]||Lg).call(this,se,we[0]));else throw new Error("Cannot close `"+se.type+"` ("+hs({start:se.start,end:se.end})+"): it’s not open");be.position.end=Fr(se.end)}function v(){return Od(this.stack.pop())}function y(){this.data.expectingFirstListItemValue=!0}function k(se){if(this.data.expectingFirstListItemValue){const he=this.stack[this.stack.length-2];he.start=Number.parseInt(this.sliceSerialize(se),10),this.data.expectingFirstListItemValue=void 0}}function b(){const se=this.resume(),he=this.stack[this.stack.length-1];he.lang=se}function w(){const se=this.resume(),he=this.stack[this.stack.length-1];he.meta=se}function N(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function z(){const se=this.resume(),he=this.stack[this.stack.length-1];he.value=se.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function R(){const se=this.resume(),he=this.stack[this.stack.length-1];he.value=se.replace(/(\r?\n|\r)$/g,"")}function A(se){const he=this.resume(),be=this.stack[this.stack.length-1];be.label=he,be.identifier=Hn(this.sliceSerialize(se)).toLowerCase()}function E(){const se=this.resume(),he=this.stack[this.stack.length-1];he.title=se}function F(){const se=this.resume(),he=this.stack[this.stack.length-1];he.url=se}function K(se){const he=this.stack[this.stack.length-1];if(!he.depth){const be=this.sliceSerialize(se).length;he.depth=be}}function O(){this.data.setextHeadingSlurpLineEnding=!0}function P(se){const he=this.stack[this.stack.length-1];he.depth=this.sliceSerialize(se).codePointAt(0)===61?1:2}function Y(){this.data.setextHeadingSlurpLineEnding=void 0}function le(se){const be=this.stack[this.stack.length-1].children;let we=be[be.length-1];(!we||we.type!=="text")&&(we=qe(),we.position={start:Fr(se.start),end:void 0},be.push(we)),this.stack.push(we)}function _(se){const he=this.stack.pop();he.value+=this.sliceSerialize(se),he.position.end=Fr(se.end)}function V(se){const he=this.stack[this.stack.length-1];if(this.data.atHardBreak){const be=he.children[he.children.length-1];be.position.end=Fr(se.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&r.canContainEols.includes(he.type)&&(le.call(this,se),_.call(this,se))}function G(){this.data.atHardBreak=!0}function ne(){const se=this.resume(),he=this.stack[this.stack.length-1];he.value=se}function q(){const se=this.resume(),he=this.stack[this.stack.length-1];he.value=se}function M(){const se=this.resume(),he=this.stack[this.stack.length-1];he.value=se}function D(){const se=this.stack[this.stack.length-1];if(this.data.inReference){const he=this.data.referenceType||"shortcut";se.type+="Reference",se.referenceType=he,delete se.url,delete se.title}else delete se.identifier,delete se.label;this.data.referenceType=void 0}function H(){const se=this.stack[this.stack.length-1];if(this.data.inReference){const he=this.data.referenceType||"shortcut";se.type+="Reference",se.referenceType=he,delete se.url,delete se.title}else delete se.identifier,delete se.label;this.data.referenceType=void 0}function B(se){const he=this.sliceSerialize(se),be=this.stack[this.stack.length-2];be.label=jC(he),be.identifier=Hn(he).toLowerCase()}function te(){const se=this.stack[this.stack.length-1],he=this.resume(),be=this.stack[this.stack.length-1];if(this.data.inReference=!0,be.type==="link"){const we=se.children;be.children=we}else be.alt=he}function T(){const se=this.resume(),he=this.stack[this.stack.length-1];he.url=se}function I(){const se=this.resume(),he=this.stack[this.stack.length-1];he.title=se}function U(){this.data.inReference=void 0}function C(){this.data.referenceType="collapsed"}function ae(se){const he=this.resume(),be=this.stack[this.stack.length-1];be.label=he,be.identifier=Hn(this.sliceSerialize(se)).toLowerCase(),this.data.referenceType="full"}function W(se){this.data.characterReferenceType=se.type}function Q(se){const he=this.sliceSerialize(se),be=this.data.characterReferenceType;let we;be?(we=vv(he,be==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):we=Md(he);const je=this.stack[this.stack.length-1];je.value+=we}function ue(se){const he=this.stack.pop();he.position.end=Fr(se.end)}function me(se){_.call(this,se);const he=this.stack[this.stack.length-1];he.url=this.sliceSerialize(se)}function ge(se){_.call(this,se);const he=this.stack[this.stack.length-1];he.url="mailto:"+this.sliceSerialize(se)}function fe(){return{type:"blockquote",children:[]}}function Se(){return{type:"code",lang:null,meta:null,value:""}}function Me(){return{type:"inlineCode",value:""}}function et(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ue(){return{type:"emphasis",children:[]}}function ct(){return{type:"heading",depth:0,children:[]}}function Jt(){return{type:"break"}}function Kt(){return{type:"html",value:""}}function Nt(){return{type:"image",title:null,url:"",alt:null}}function Wt(){return{type:"link",title:null,url:"",children:[]}}function Gt(se){return{type:"list",ordered:se.type==="listOrdered",start:null,spread:se._spread,children:[]}}function Ee(se){return{type:"listItem",spread:se._spread,checked:null,children:[]}}function Te(){return{type:"paragraph",children:[]}}function pt(){return{type:"strong",children:[]}}function qe(){return{type:"text",value:""}}function _e(){return{type:"thematicBreak"}}}function Fr(e){return{line:e.line,column:e.column,offset:e.offset}}function Nv(e,r){let i=-1;for(;++i<r.length;){const s=r[i];Array.isArray(s)?Nv(e,s):IC(e,s)}}function IC(e,r){let i;for(i in r)if(Ev.call(r,i))switch(i){case"canContainEols":{const s=r[i];s&&e[i].push(...s);break}case"transforms":{const s=r[i];s&&e[i].push(...s);break}case"enter":case"exit":{const s=r[i];s&&Object.assign(e[i],s);break}}}function Lg(e,r){throw e?new Error("Cannot close `"+e.type+"` ("+hs({start:e.start,end:e.end})+"): a different token (`"+r.type+"`, "+hs({start:r.start,end:r.end})+") is open"):new Error("Cannot close document, a token (`"+r.type+"`, "+hs({start:r.start,end:r.end})+") is still open")}function AC(e){const r=this;r.parser=i;function i(s){return EC(s,{...r.data("settings"),...e,extensions:r.data("micromarkExtensions")||[],mdastExtensions:r.data("fromMarkdownExtensions")||[]})}}function DC(e,r){const i={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(r),!0)};return e.patch(r,i),e.applyData(r,i)}function OC(e,r){const i={type:"element",tagName:"br",properties:{},children:[]};return e.patch(r,i),[e.applyData(r,i),{type:"text",value:`
|
|
16
|
+
`}]}function MC(e,r){const i=r.value?r.value+`
|
|
17
|
+
`:"",s={},o=r.lang?r.lang.split(/\s+/):[];o.length>0&&(s.className=["language-"+o[0]]);let c={type:"element",tagName:"code",properties:s,children:[{type:"text",value:i}]};return r.meta&&(c.data={meta:r.meta}),e.patch(r,c),c=e.applyData(r,c),c={type:"element",tagName:"pre",properties:{},children:[c]},e.patch(r,c),c}function _C(e,r){const i={type:"element",tagName:"del",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function LC(e,r){const i={type:"element",tagName:"em",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function zC(e,r){const i=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(r.identifier).toUpperCase(),o=pa(s.toLowerCase()),c=e.footnoteOrder.indexOf(s);let d,h=e.footnoteCounts.get(s);h===void 0?(h=0,e.footnoteOrder.push(s),d=e.footnoteOrder.length):d=c+1,h+=1,e.footnoteCounts.set(s,h);const p={type:"element",tagName:"a",properties:{href:"#"+i+"fn-"+o,id:i+"fnref-"+o+(h>1?"-"+h:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(d)}]};e.patch(r,p);const g={type:"element",tagName:"sup",properties:{},children:[p]};return e.patch(r,g),e.applyData(r,g)}function BC(e,r){const i={type:"element",tagName:"h"+r.depth,properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function HC(e,r){if(e.options.allowDangerousHtml){const i={type:"raw",value:r.value};return e.patch(r,i),e.applyData(r,i)}}function Iv(e,r){const i=r.referenceType;let s="]";if(i==="collapsed"?s+="[]":i==="full"&&(s+="["+(r.label||r.identifier)+"]"),r.type==="imageReference")return[{type:"text",value:"!["+r.alt+s}];const o=e.all(r),c=o[0];c&&c.type==="text"?c.value="["+c.value:o.unshift({type:"text",value:"["});const d=o[o.length-1];return d&&d.type==="text"?d.value+=s:o.push({type:"text",value:s}),o}function UC(e,r){const i=String(r.identifier).toUpperCase(),s=e.definitionById.get(i);if(!s)return Iv(e,r);const o={src:pa(s.url||""),alt:r.alt};s.title!==null&&s.title!==void 0&&(o.title=s.title);const c={type:"element",tagName:"img",properties:o,children:[]};return e.patch(r,c),e.applyData(r,c)}function qC(e,r){const i={src:pa(r.url)};r.alt!==null&&r.alt!==void 0&&(i.alt=r.alt),r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(r,s),e.applyData(r,s)}function $C(e,r){const i={type:"text",value:r.value.replace(/\r?\n|\r/g," ")};e.patch(r,i);const s={type:"element",tagName:"code",properties:{},children:[i]};return e.patch(r,s),e.applyData(r,s)}function GC(e,r){const i=String(r.identifier).toUpperCase(),s=e.definitionById.get(i);if(!s)return Iv(e,r);const o={href:pa(s.url||"")};s.title!==null&&s.title!==void 0&&(o.title=s.title);const c={type:"element",tagName:"a",properties:o,children:e.all(r)};return e.patch(r,c),e.applyData(r,c)}function FC(e,r){const i={href:pa(r.url)};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:e.all(r)};return e.patch(r,s),e.applyData(r,s)}function PC(e,r,i){const s=e.all(r),o=i?VC(i):Av(r),c={},d=[];if(typeof r.checked=="boolean"){const v=s[0];let y;v&&v.type==="element"&&v.tagName==="p"?y=v:(y={type:"element",tagName:"p",properties:{},children:[]},s.unshift(y)),y.children.length>0&&y.children.unshift({type:"text",value:" "}),y.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:r.checked,disabled:!0},children:[]}),c.className=["task-list-item"]}let h=-1;for(;++h<s.length;){const v=s[h];(o||h!==0||v.type!=="element"||v.tagName!=="p")&&d.push({type:"text",value:`
|
|
18
|
+
`}),v.type==="element"&&v.tagName==="p"&&!o?d.push(...v.children):d.push(v)}const p=s[s.length-1];p&&(o||p.type!=="element"||p.tagName!=="p")&&d.push({type:"text",value:`
|
|
19
|
+
`});const g={type:"element",tagName:"li",properties:c,children:d};return e.patch(r,g),e.applyData(r,g)}function VC(e){let r=!1;if(e.type==="list"){r=e.spread||!1;const i=e.children;let s=-1;for(;!r&&++s<i.length;)r=Av(i[s])}return r}function Av(e){const r=e.spread;return r??e.children.length>1}function YC(e,r){const i={},s=e.all(r);let o=-1;for(typeof r.start=="number"&&r.start!==1&&(i.start=r.start);++o<s.length;){const d=s[o];if(d.type==="element"&&d.tagName==="li"&&d.properties&&Array.isArray(d.properties.className)&&d.properties.className.includes("task-list-item")){i.className=["contains-task-list"];break}}const c={type:"element",tagName:r.ordered?"ol":"ul",properties:i,children:e.wrap(s,!0)};return e.patch(r,c),e.applyData(r,c)}function KC(e,r){const i={type:"element",tagName:"p",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function XC(e,r){const i={type:"root",children:e.wrap(e.all(r))};return e.patch(r,i),e.applyData(r,i)}function QC(e,r){const i={type:"element",tagName:"strong",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function ZC(e,r){const i=e.all(r),s=i.shift(),o=[];if(s){const d={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(r.children[0],d),o.push(d)}if(i.length>0){const d={type:"element",tagName:"tbody",properties:{},children:e.wrap(i,!0)},h=Nd(r.children[1]),p=cv(r.children[r.children.length-1]);h&&p&&(d.position={start:h,end:p}),o.push(d)}const c={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(r,c),e.applyData(r,c)}function JC(e,r,i){const s=i?i.children:void 0,c=(s?s.indexOf(r):1)===0?"th":"td",d=i&&i.type==="table"?i.align:void 0,h=d?d.length:r.children.length;let p=-1;const g=[];for(;++p<h;){const y=r.children[p],k={},b=d?d[p]:void 0;b&&(k.align=b);let w={type:"element",tagName:c,properties:k,children:[]};y&&(w.children=e.all(y),e.patch(y,w),w=e.applyData(y,w)),g.push(w)}const v={type:"element",tagName:"tr",properties:{},children:e.wrap(g,!0)};return e.patch(r,v),e.applyData(r,v)}function WC(e,r){const i={type:"element",tagName:"td",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}const zg=9,Bg=32;function eR(e){const r=String(e),i=/\r?\n|\r/g;let s=i.exec(r),o=0;const c=[];for(;s;)c.push(Hg(r.slice(o,s.index),o>0,!0),s[0]),o=s.index+s[0].length,s=i.exec(r);return c.push(Hg(r.slice(o),o>0,!1)),c.join("")}function Hg(e,r,i){let s=0,o=e.length;if(r){let c=e.codePointAt(s);for(;c===zg||c===Bg;)s++,c=e.codePointAt(s)}if(i){let c=e.codePointAt(o-1);for(;c===zg||c===Bg;)o--,c=e.codePointAt(o-1)}return o>s?e.slice(s,o):""}function tR(e,r){const i={type:"text",value:eR(String(r.value))};return e.patch(r,i),e.applyData(r,i)}function nR(e,r){const i={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(r,i),e.applyData(r,i)}const rR={blockquote:DC,break:OC,code:MC,delete:_C,emphasis:LC,footnoteReference:zC,heading:BC,html:HC,imageReference:UC,image:qC,inlineCode:$C,linkReference:GC,link:FC,listItem:PC,list:YC,paragraph:KC,root:XC,strong:QC,table:ZC,tableCell:WC,tableRow:JC,text:tR,thematicBreak:nR,toml:_l,yaml:_l,definition:_l,footnoteDefinition:_l};function _l(){}const Dv=-1,co=0,ps=1,Kl=2,Ld=3,zd=4,Bd=5,Hd=6,Ov=7,Mv=8,_v=typeof self=="object"?self:globalThis,Ug=(e,r)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new _v[e](r)},iR=(e,r)=>{const i=(o,c)=>(e.set(c,o),o),s=o=>{if(e.has(o))return e.get(o);const[c,d]=r[o];switch(c){case co:case Dv:return i(d,o);case ps:{const h=i([],o);for(const p of d)h.push(s(p));return h}case Kl:{const h=i({},o);for(const[p,g]of d)h[s(p)]=s(g);return h}case Ld:return i(new Date(d),o);case zd:{const{source:h,flags:p}=d;return i(new RegExp(h,p),o)}case Bd:{const h=i(new Map,o);for(const[p,g]of d)h.set(s(p),s(g));return h}case Hd:{const h=i(new Set,o);for(const p of d)h.add(s(p));return h}case Ov:{const{name:h,message:p}=d;return i(typeof _v[h]=="function"?Ug(h,p):new Error(p),o)}case Mv:return i(BigInt(d),o);case"BigInt":return i(Object(BigInt(d)),o);case"ArrayBuffer":return i(new Uint8Array(d).buffer,d);case"DataView":{const{buffer:h}=new Uint8Array(d);return i(new DataView(h),d)}}return i(Ug(c,d),o)};return s},qg=e=>iR(new Map,e)(0),mi="",{toString:aR}={},{keys:sR}=Object,ds=e=>{const r=typeof e;if(r!=="object"||!e)return[co,r];const i=aR.call(e).slice(8,-1);switch(i){case"Array":return[ps,mi];case"Object":return[Kl,mi];case"Date":return[Ld,mi];case"RegExp":return[zd,mi];case"Map":return[Bd,mi];case"Set":return[Hd,mi];case"DataView":return[ps,i]}return i.includes("Array")?[ps,i]:e instanceof Error?[Ov,e.name||"Error"]:[Kl,i]},Ll=([e,r])=>e===co&&(r==="function"||r==="symbol"),lR=(e,r,i,s)=>{const o=(d,h)=>{const p=s.push(d)-1;return i.set(h,p),p},c=d=>{if(i.has(d))return i.get(d);let[h,p]=ds(d);switch(h){case co:{let v=d;switch(p){case"bigint":h=Mv,v=d.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+p);v=null;break;case"undefined":return o([Dv],d)}return o([h,v],d)}case ps:{if(p){let k=d;return p==="DataView"?k=new Uint8Array(d.buffer):p==="ArrayBuffer"&&(k=new Uint8Array(d)),o([p,[...k]],d)}const v=[],y=o([h,v],d);for(const k of d)v.push(c(k));return y}case Kl:{if(p)switch(p){case"BigInt":return o([p,d.toString()],d);case"Boolean":case"Number":case"String":return o([p,d.valueOf()],d)}if(r&&"toJSON"in d)return c(d.toJSON());const v=[],y=o([h,v],d);for(const k of sR(d))(e||!Ll(ds(d[k])))&&v.push([c(k),c(d[k])]);return y}case Ld:return o([h,isNaN(d.getTime())?mi:d.toISOString()],d);case zd:{const{source:v,flags:y}=d;return o([h,{source:v,flags:y}],d)}case Bd:{const v=[],y=o([h,v],d);for(const[k,b]of d)(e||!(Ll(ds(k))||Ll(ds(b))))&&v.push([c(k),c(b)]);return y}case Hd:{const v=[],y=o([h,v],d);for(const k of d)(e||!Ll(ds(k)))&&v.push(c(k));return y}}const{message:g}=d;return o([h,{name:p,message:g}],d)};return c},$g=(e,{json:r,lossy:i}={})=>{const s=[];return lR(!(r||i),!!r,new Map,s)(e),s},Xl=typeof structuredClone=="function"?(e,r)=>r&&("json"in r||"lossy"in r)?qg($g(e,r)):structuredClone(e):(e,r)=>qg($g(e,r));function oR(e,r){const i=[{type:"text",value:"↩"}];return r>1&&i.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(r)}]}),i}function uR(e,r){return"Back to reference "+(e+1)+(r>1?"-"+r:"")}function cR(e){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=e.options.footnoteBackContent||oR,s=e.options.footnoteBackLabel||uR,o=e.options.footnoteLabel||"Footnotes",c=e.options.footnoteLabelTagName||"h2",d=e.options.footnoteLabelProperties||{className:["sr-only"]},h=[];let p=-1;for(;++p<e.footnoteOrder.length;){const g=e.footnoteById.get(e.footnoteOrder[p]);if(!g)continue;const v=e.all(g),y=String(g.identifier).toUpperCase(),k=pa(y.toLowerCase());let b=0;const w=[],N=e.footnoteCounts.get(y);for(;N!==void 0&&++b<=N;){w.length>0&&w.push({type:"text",value:" "});let A=typeof i=="string"?i:i(p,b);typeof A=="string"&&(A={type:"text",value:A}),w.push({type:"element",tagName:"a",properties:{href:"#"+r+"fnref-"+k+(b>1?"-"+b:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(p,b),className:["data-footnote-backref"]},children:Array.isArray(A)?A:[A]})}const z=v[v.length-1];if(z&&z.type==="element"&&z.tagName==="p"){const A=z.children[z.children.length-1];A&&A.type==="text"?A.value+=" ":z.children.push({type:"text",value:" "}),z.children.push(...w)}else v.push(...w);const R={type:"element",tagName:"li",properties:{id:r+"fn-"+k},children:e.wrap(v,!0)};e.patch(g,R),h.push(R)}if(h.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:c,properties:{...Xl(d),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
|
|
20
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(h,!0)},{type:"text",value:`
|
|
21
|
+
`}]}}const fo=(function(e){if(e==null)return mR;if(typeof e=="function")return ho(e);if(typeof e=="object")return Array.isArray(e)?dR(e):fR(e);if(typeof e=="string")return hR(e);throw new Error("Expected function, string, or object as test")});function dR(e){const r=[];let i=-1;for(;++i<e.length;)r[i]=fo(e[i]);return ho(s);function s(...o){let c=-1;for(;++c<r.length;)if(r[c].apply(this,o))return!0;return!1}}function fR(e){const r=e;return ho(i);function i(s){const o=s;let c;for(c in e)if(o[c]!==r[c])return!1;return!0}}function hR(e){return ho(r);function r(i){return i&&i.type===e}}function ho(e){return r;function r(i,s,o){return!!(pR(i)&&e.call(this,i,typeof s=="number"?s:void 0,o||void 0))}}function mR(){return!0}function pR(e){return e!==null&&typeof e=="object"&&"type"in e}const Lv=[],gR=!0,dd=!1,yR="skip";function zv(e,r,i,s){let o;typeof r=="function"&&typeof i!="function"?(s=i,i=r):o=r;const c=fo(o),d=s?-1:1;h(e,void 0,[])();function h(p,g,v){const y=p&&typeof p=="object"?p:{};if(typeof y.type=="string"){const b=typeof y.tagName=="string"?y.tagName:typeof y.name=="string"?y.name:void 0;Object.defineProperty(k,"name",{value:"node ("+(p.type+(b?"<"+b+">":""))+")"})}return k;function k(){let b=Lv,w,N,z;if((!r||c(p,g,v[v.length-1]||void 0))&&(b=vR(i(p,v)),b[0]===dd))return b;if("children"in p&&p.children){const R=p;if(R.children&&b[0]!==yR)for(N=(s?R.children.length:-1)+d,z=v.concat(R);N>-1&&N<R.children.length;){const A=R.children[N];if(w=h(A,N,z)(),w[0]===dd)return w;N=typeof w[1]=="number"?w[1]:N+d}}return b}}}function vR(e){return Array.isArray(e)?e:typeof e=="number"?[gR,e]:e==null?Lv:[e]}function Ud(e,r,i,s){let o,c,d;typeof r=="function"&&typeof i!="function"?(c=void 0,d=r,o=i):(c=r,d=i,o=s),zv(e,c,h,o);function h(p,g){const v=g[g.length-1],y=v?v.children.indexOf(p):void 0;return d(p,y,v)}}const fd={}.hasOwnProperty,bR={};function xR(e,r){const i=r||bR,s=new Map,o=new Map,c=new Map,d={...rR,...i.handlers},h={all:g,applyData:kR,definitionById:s,footnoteById:o,footnoteCounts:c,footnoteOrder:[],handlers:d,one:p,options:i,patch:SR,wrap:CR};return Ud(e,function(v){if(v.type==="definition"||v.type==="footnoteDefinition"){const y=v.type==="definition"?s:o,k=String(v.identifier).toUpperCase();y.has(k)||y.set(k,v)}}),h;function p(v,y){const k=v.type,b=h.handlers[k];if(fd.call(h.handlers,k)&&b)return b(h,v,y);if(h.options.passThrough&&h.options.passThrough.includes(k)){if("children"in v){const{children:N,...z}=v,R=Xl(z);return R.children=h.all(v),R}return Xl(v)}return(h.options.unknownHandler||wR)(h,v,y)}function g(v){const y=[];if("children"in v){const k=v.children;let b=-1;for(;++b<k.length;){const w=h.one(k[b],v);if(w){if(b&&k[b-1].type==="break"&&(!Array.isArray(w)&&w.type==="text"&&(w.value=Gg(w.value)),!Array.isArray(w)&&w.type==="element")){const N=w.children[0];N&&N.type==="text"&&(N.value=Gg(N.value))}Array.isArray(w)?y.push(...w):y.push(w)}}}return y}}function SR(e,r){e.position&&(r.position=u1(e))}function kR(e,r){let i=r;if(e&&e.data){const s=e.data.hName,o=e.data.hChildren,c=e.data.hProperties;if(typeof s=="string")if(i.type==="element")i.tagName=s;else{const d="children"in i?i.children:[i];i={type:"element",tagName:s,properties:{},children:d}}i.type==="element"&&c&&Object.assign(i.properties,Xl(c)),"children"in i&&i.children&&o!==null&&o!==void 0&&(i.children=o)}return i}function wR(e,r){const i=r.data||{},s="value"in r&&!(fd.call(i,"hProperties")||fd.call(i,"hChildren"))?{type:"text",value:r.value}:{type:"element",tagName:"div",properties:{},children:e.all(r)};return e.patch(r,s),e.applyData(r,s)}function CR(e,r){const i=[];let s=-1;for(r&&i.push({type:"text",value:`
|
|
22
|
+
`});++s<e.length;)s&&i.push({type:"text",value:`
|
|
23
|
+
`}),i.push(e[s]);return r&&e.length>0&&i.push({type:"text",value:`
|
|
24
|
+
`}),i}function Gg(e){let r=0,i=e.charCodeAt(r);for(;i===9||i===32;)r++,i=e.charCodeAt(r);return e.slice(r)}function Fg(e,r){const i=xR(e,r),s=i.one(e,void 0),o=cR(i),c=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return o&&c.children.push({type:"text",value:`
|
|
25
|
+
`},o),c}function RR(e,r){return e&&"run"in e?async function(i,s){const o=Fg(i,{file:s,...r});await e.run(o,s)}:function(i,s){return Fg(i,{file:s,...e||r})}}function Pg(e){if(e)throw e}var qc,Vg;function jR(){if(Vg)return qc;Vg=1;var e=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,s=Object.getOwnPropertyDescriptor,o=function(g){return typeof Array.isArray=="function"?Array.isArray(g):r.call(g)==="[object Array]"},c=function(g){if(!g||r.call(g)!=="[object Object]")return!1;var v=e.call(g,"constructor"),y=g.constructor&&g.constructor.prototype&&e.call(g.constructor.prototype,"isPrototypeOf");if(g.constructor&&!v&&!y)return!1;var k;for(k in g);return typeof k>"u"||e.call(g,k)},d=function(g,v){i&&v.name==="__proto__"?i(g,v.name,{enumerable:!0,configurable:!0,value:v.newValue,writable:!0}):g[v.name]=v.newValue},h=function(g,v){if(v==="__proto__")if(e.call(g,v)){if(s)return s(g,v).value}else return;return g[v]};return qc=function p(){var g,v,y,k,b,w,N=arguments[0],z=1,R=arguments.length,A=!1;for(typeof N=="boolean"&&(A=N,N=arguments[1]||{},z=2),(N==null||typeof N!="object"&&typeof N!="function")&&(N={});z<R;++z)if(g=arguments[z],g!=null)for(v in g)y=h(N,v),k=h(g,v),N!==k&&(A&&k&&(c(k)||(b=o(k)))?(b?(b=!1,w=y&&o(y)?y:[]):w=y&&c(y)?y:{},d(N,{name:v,newValue:p(A,w,k)})):typeof k<"u"&&d(N,{name:v,newValue:k}));return N},qc}var TR=jR();const $c=Sd(TR);function hd(e){if(typeof e!="object"||e===null)return!1;const r=Object.getPrototypeOf(e);return(r===null||r===Object.prototype||Object.getPrototypeOf(r)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function ER(){const e=[],r={run:i,use:s};return r;function i(...o){let c=-1;const d=o.pop();if(typeof d!="function")throw new TypeError("Expected function as last argument, not "+d);h(null,...o);function h(p,...g){const v=e[++c];let y=-1;if(p){d(p);return}for(;++y<o.length;)(g[y]===null||g[y]===void 0)&&(g[y]=o[y]);o=g,v?NR(v,h)(...g):d(null,...g)}}function s(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),r}}function NR(e,r){let i;return s;function s(...d){const h=e.length>d.length;let p;h&&d.push(o);try{p=e.apply(this,d)}catch(g){const v=g;if(h&&i)throw v;return o(v)}h||(p&&p.then&&typeof p.then=="function"?p.then(c,o):p instanceof Error?o(p):c(p))}function o(d,...h){i||(i=!0,r(d,...h))}function c(d){o(null,d)}}const Yn={basename:IR,dirname:AR,extname:DR,join:OR,sep:"/"};function IR(e,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');Ss(e);let i=0,s=-1,o=e.length,c;if(r===void 0||r.length===0||r.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(c){i=o+1;break}}else s<0&&(c=!0,s=o+1);return s<0?"":e.slice(i,s)}if(r===e)return"";let d=-1,h=r.length-1;for(;o--;)if(e.codePointAt(o)===47){if(c){i=o+1;break}}else d<0&&(c=!0,d=o+1),h>-1&&(e.codePointAt(o)===r.codePointAt(h--)?h<0&&(s=o):(h=-1,s=d));return i===s?s=d:s<0&&(s=e.length),e.slice(i,s)}function AR(e){if(Ss(e),e.length===0)return".";let r=-1,i=e.length,s;for(;--i;)if(e.codePointAt(i)===47){if(s){r=i;break}}else s||(s=!0);return r<0?e.codePointAt(0)===47?"/":".":r===1&&e.codePointAt(0)===47?"//":e.slice(0,r)}function DR(e){Ss(e);let r=e.length,i=-1,s=0,o=-1,c=0,d;for(;r--;){const h=e.codePointAt(r);if(h===47){if(d){s=r+1;break}continue}i<0&&(d=!0,i=r+1),h===46?o<0?o=r:c!==1&&(c=1):o>-1&&(c=-1)}return o<0||i<0||c===0||c===1&&o===i-1&&o===s+1?"":e.slice(o,i)}function OR(...e){let r=-1,i;for(;++r<e.length;)Ss(e[r]),e[r]&&(i=i===void 0?e[r]:i+"/"+e[r]);return i===void 0?".":MR(i)}function MR(e){Ss(e);const r=e.codePointAt(0)===47;let i=_R(e,!r);return i.length===0&&!r&&(i="."),i.length>0&&e.codePointAt(e.length-1)===47&&(i+="/"),r?"/"+i:i}function _R(e,r){let i="",s=0,o=-1,c=0,d=-1,h,p;for(;++d<=e.length;){if(d<e.length)h=e.codePointAt(d);else{if(h===47)break;h=47}if(h===47){if(!(o===d-1||c===1))if(o!==d-1&&c===2){if(i.length<2||s!==2||i.codePointAt(i.length-1)!==46||i.codePointAt(i.length-2)!==46){if(i.length>2){if(p=i.lastIndexOf("/"),p!==i.length-1){p<0?(i="",s=0):(i=i.slice(0,p),s=i.length-1-i.lastIndexOf("/")),o=d,c=0;continue}}else if(i.length>0){i="",s=0,o=d,c=0;continue}}r&&(i=i.length>0?i+"/..":"..",s=2)}else i.length>0?i+="/"+e.slice(o+1,d):i=e.slice(o+1,d),s=d-o-1;o=d,c=0}else h===46&&c>-1?c++:c=-1}return i}function Ss(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const LR={cwd:zR};function zR(){return"/"}function md(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function BR(e){if(typeof e=="string")e=new URL(e);else if(!md(e)){const r=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw r.code="ERR_INVALID_ARG_TYPE",r}if(e.protocol!=="file:"){const r=new TypeError("The URL must be of scheme file");throw r.code="ERR_INVALID_URL_SCHEME",r}return HR(e)}function HR(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const r=e.pathname;let i=-1;for(;++i<r.length;)if(r.codePointAt(i)===37&&r.codePointAt(i+1)===50){const s=r.codePointAt(i+2);if(s===70||s===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(r)}const Gc=["history","path","basename","stem","extname","dirname"];class Bv{constructor(r){let i;r?md(r)?i={path:r}:typeof r=="string"||UR(r)?i={value:r}:i=r:i={},this.cwd="cwd"in i?"":LR.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Gc.length;){const c=Gc[s];c in i&&i[c]!==void 0&&i[c]!==null&&(this[c]=c==="history"?[...i[c]]:i[c])}let o;for(o in i)Gc.includes(o)||(this[o]=i[o])}get basename(){return typeof this.path=="string"?Yn.basename(this.path):void 0}set basename(r){Pc(r,"basename"),Fc(r,"basename"),this.path=Yn.join(this.dirname||"",r)}get dirname(){return typeof this.path=="string"?Yn.dirname(this.path):void 0}set dirname(r){Yg(this.basename,"dirname"),this.path=Yn.join(r||"",this.basename)}get extname(){return typeof this.path=="string"?Yn.extname(this.path):void 0}set extname(r){if(Fc(r,"extname"),Yg(this.dirname,"extname"),r){if(r.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(r.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Yn.join(this.dirname,this.stem+(r||""))}get path(){return this.history[this.history.length-1]}set path(r){md(r)&&(r=BR(r)),Pc(r,"path"),this.path!==r&&this.history.push(r)}get stem(){return typeof this.path=="string"?Yn.basename(this.path,this.extname):void 0}set stem(r){Pc(r,"stem"),Fc(r,"stem"),this.path=Yn.join(this.dirname||"",r+(this.extname||""))}fail(r,i,s){const o=this.message(r,i,s);throw o.fatal=!0,o}info(r,i,s){const o=this.message(r,i,s);return o.fatal=void 0,o}message(r,i,s){const o=new Yt(r,i,s);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(r){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(r||void 0).decode(this.value)}}function Fc(e,r){if(e&&e.includes(Yn.sep))throw new Error("`"+r+"` cannot be a path: did not expect `"+Yn.sep+"`")}function Pc(e,r){if(!e)throw new Error("`"+r+"` cannot be empty")}function Yg(e,r){if(!e)throw new Error("Setting `"+r+"` requires `path` to be set too")}function UR(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const qR=(function(e){const s=this.constructor.prototype,o=s[e],c=function(){return o.apply(c,arguments)};return Object.setPrototypeOf(c,s),c}),$R={}.hasOwnProperty;class qd extends qR{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=ER()}copy(){const r=new qd;let i=-1;for(;++i<this.attachers.length;){const s=this.attachers[i];r.use(...s)}return r.data($c(!0,{},this.namespace)),r}data(r,i){return typeof r=="string"?arguments.length===2?(Kc("data",this.frozen),this.namespace[r]=i,this):$R.call(this.namespace,r)&&this.namespace[r]||void 0:r?(Kc("data",this.frozen),this.namespace=r,this):this.namespace}freeze(){if(this.frozen)return this;const r=this;for(;++this.freezeIndex<this.attachers.length;){const[i,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const o=i.call(r,...s);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(r){this.freeze();const i=zl(r),s=this.parser||this.Parser;return Vc("parse",s),s(String(i),i)}process(r,i){const s=this;return this.freeze(),Vc("process",this.parser||this.Parser),Yc("process",this.compiler||this.Compiler),i?o(void 0,i):new Promise(o);function o(c,d){const h=zl(r),p=s.parse(h);s.run(p,h,function(v,y,k){if(v||!y||!k)return g(v);const b=y,w=s.stringify(b,k);PR(w)?k.value=w:k.result=w,g(v,k)});function g(v,y){v||!y?d(v):c?c(y):i(void 0,y)}}}processSync(r){let i=!1,s;return this.freeze(),Vc("processSync",this.parser||this.Parser),Yc("processSync",this.compiler||this.Compiler),this.process(r,o),Xg("processSync","process",i),s;function o(c,d){i=!0,Pg(c),s=d}}run(r,i,s){Kg(r),this.freeze();const o=this.transformers;return!s&&typeof i=="function"&&(s=i,i=void 0),s?c(void 0,s):new Promise(c);function c(d,h){const p=zl(i);o.run(r,p,g);function g(v,y,k){const b=y||r;v?h(v):d?d(b):s(void 0,b,k)}}}runSync(r,i){let s=!1,o;return this.run(r,i,c),Xg("runSync","run",s),o;function c(d,h){Pg(d),o=h,s=!0}}stringify(r,i){this.freeze();const s=zl(i),o=this.compiler||this.Compiler;return Yc("stringify",o),Kg(r),o(r,s)}use(r,...i){const s=this.attachers,o=this.namespace;if(Kc("use",this.frozen),r!=null)if(typeof r=="function")p(r,i);else if(typeof r=="object")Array.isArray(r)?h(r):d(r);else throw new TypeError("Expected usable value, not `"+r+"`");return this;function c(g){if(typeof g=="function")p(g,[]);else if(typeof g=="object")if(Array.isArray(g)){const[v,...y]=g;p(v,y)}else d(g);else throw new TypeError("Expected usable value, not `"+g+"`")}function d(g){if(!("plugins"in g)&&!("settings"in g))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");h(g.plugins),g.settings&&(o.settings=$c(!0,o.settings,g.settings))}function h(g){let v=-1;if(g!=null)if(Array.isArray(g))for(;++v<g.length;){const y=g[v];c(y)}else throw new TypeError("Expected a list of plugins, not `"+g+"`")}function p(g,v){let y=-1,k=-1;for(;++y<s.length;)if(s[y][0]===g){k=y;break}if(k===-1)s.push([g,...v]);else if(v.length>0){let[b,...w]=v;const N=s[k][1];hd(N)&&hd(b)&&(b=$c(!0,N,b)),s[k]=[g,b,...w]}}}}const GR=new qd().freeze();function Vc(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Yc(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Kc(e,r){if(r)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Kg(e){if(!hd(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Xg(e,r,i){if(!i)throw new Error("`"+e+"` finished async. Use `"+r+"` instead")}function zl(e){return FR(e)?e:new Bv(e)}function FR(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function PR(e){return typeof e=="string"||VR(e)}function VR(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const YR="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Qg=[],Zg={allowDangerousHtml:!0},KR=/^(https?|ircs?|mailto|xmpp)$/i,XR=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function QR(e){const r=ZR(e),i=JR(e);return WR(r.runSync(r.parse(i),i),e)}function ZR(e){const r=e.rehypePlugins||Qg,i=e.remarkPlugins||Qg,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Zg}:Zg;return GR().use(AC).use(i).use(RR,s).use(r)}function JR(e){const r=e.children||"",i=new Bv;return typeof r=="string"&&(i.value=r),i}function WR(e,r){const i=r.allowedElements,s=r.allowElement,o=r.components,c=r.disallowedElements,d=r.skipHtml,h=r.unwrapDisallowed,p=r.urlTransform||ej;for(const v of XR)Object.hasOwn(r,v.from)&&(""+v.from+(v.to?"use `"+v.to+"` instead":"remove it")+YR+v.id,void 0);return Ud(e,g),m1(e,{Fragment:u.Fragment,components:o,ignoreInvalidStyle:!0,jsx:u.jsx,jsxs:u.jsxs,passKeys:!0,passNode:!0});function g(v,y,k){if(v.type==="raw"&&k&&typeof y=="number")return d?k.children.splice(y,1):k.children[y]={type:"text",value:v.value},y;if(v.type==="element"){let b;for(b in Bc)if(Object.hasOwn(Bc,b)&&Object.hasOwn(v.properties,b)){const w=v.properties[b],N=Bc[b];(N===null||N.includes(v.tagName))&&(v.properties[b]=p(String(w||""),b,v))}}if(v.type==="element"){let b=i?!i.includes(v.tagName):c?c.includes(v.tagName):!1;if(!b&&s&&typeof y=="number"&&(b=!s(v,y,k)),b&&k&&typeof y=="number")return h&&v.children?k.children.splice(y,1,...v.children):k.children.splice(y,1),y}}}function ej(e){const r=e.indexOf(":"),i=e.indexOf("?"),s=e.indexOf("#"),o=e.indexOf("/");return r===-1||o!==-1&&r>o||i!==-1&&r>i||s!==-1&&r>s||KR.test(e.slice(0,r))?e:""}function Jg(e,r){const i=String(e);if(typeof r!="string")throw new TypeError("Expected character");let s=0,o=i.indexOf(r);for(;o!==-1;)s++,o=i.indexOf(r,o+r.length);return s}function tj(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function nj(e,r,i){const o=fo((i||{}).ignore||[]),c=rj(r);let d=-1;for(;++d<c.length;)zv(e,"text",h);function h(g,v){let y=-1,k;for(;++y<v.length;){const b=v[y],w=k?k.children:void 0;if(o(b,w?w.indexOf(b):void 0,k))return;k=b}if(k)return p(g,v)}function p(g,v){const y=v[v.length-1],k=c[d][0],b=c[d][1];let w=0;const z=y.children.indexOf(g);let R=!1,A=[];k.lastIndex=0;let E=k.exec(g.value);for(;E;){const F=E.index,K={index:E.index,input:E.input,stack:[...v,g]};let O=b(...E,K);if(typeof O=="string"&&(O=O.length>0?{type:"text",value:O}:void 0),O===!1?k.lastIndex=F+1:(w!==F&&A.push({type:"text",value:g.value.slice(w,F)}),Array.isArray(O)?A.push(...O):O&&A.push(O),w=F+E[0].length,R=!0),!k.global)break;E=k.exec(g.value)}return R?(w<g.value.length&&A.push({type:"text",value:g.value.slice(w)}),y.children.splice(z,1,...A)):A=[g],z+A.length}}function rj(e){const r=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const i=!e[0]||Array.isArray(e[0])?e:[e];let s=-1;for(;++s<i.length;){const o=i[s];r.push([ij(o[0]),aj(o[1])])}return r}function ij(e){return typeof e=="string"?new RegExp(tj(e),"g"):e}function aj(e){return typeof e=="function"?e:function(){return e}}const Xc="phrasing",Qc=["autolink","link","image","label"];function sj(){return{transforms:[hj],enter:{literalAutolink:oj,literalAutolinkEmail:Zc,literalAutolinkHttp:Zc,literalAutolinkWww:Zc},exit:{literalAutolink:fj,literalAutolinkEmail:dj,literalAutolinkHttp:uj,literalAutolinkWww:cj}}}function lj(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Xc,notInConstruct:Qc},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Xc,notInConstruct:Qc},{character:":",before:"[ps]",after:"\\/",inConstruct:Xc,notInConstruct:Qc}]}}function oj(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Zc(e){this.config.enter.autolinkProtocol.call(this,e)}function uj(e){this.config.exit.autolinkProtocol.call(this,e)}function cj(e){this.config.exit.data.call(this,e);const r=this.stack[this.stack.length-1];r.type,r.url="http://"+this.sliceSerialize(e)}function dj(e){this.config.exit.autolinkEmail.call(this,e)}function fj(e){this.exit(e)}function hj(e){nj(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,mj],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),pj]],{ignore:["link","linkReference"]})}function mj(e,r,i,s,o){let c="";if(!Hv(o)||(/^w/i.test(r)&&(i=r+i,r="",c="http://"),!gj(i)))return!1;const d=yj(i+s);if(!d[0])return!1;const h={type:"link",title:null,url:c+r+d[0],children:[{type:"text",value:r+d[0]}]};return d[1]?[h,{type:"text",value:d[1]}]:h}function pj(e,r,i,s){return!Hv(s,!0)||/[-\d_]$/.test(i)?!1:{type:"link",title:null,url:"mailto:"+r+"@"+i,children:[{type:"text",value:r+"@"+i}]}}function gj(e){const r=e.split(".");return!(r.length<2||r[r.length-1]&&(/_/.test(r[r.length-1])||!/[a-zA-Z\d]/.test(r[r.length-1]))||r[r.length-2]&&(/_/.test(r[r.length-2])||!/[a-zA-Z\d]/.test(r[r.length-2])))}function yj(e){const r=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!r)return[e,void 0];e=e.slice(0,r.index);let i=r[0],s=i.indexOf(")");const o=Jg(e,"(");let c=Jg(e,")");for(;s!==-1&&o>c;)e+=i.slice(0,s+1),i=i.slice(s+1),s=i.indexOf(")"),c++;return[e,i]}function Hv(e,r){const i=e.input.charCodeAt(e.index-1);return(e.index===0||xi(i)||oo(i))&&(!r||i!==47)}Uv.peek=jj;function vj(){this.buffer()}function bj(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function xj(){this.buffer()}function Sj(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function kj(e){const r=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=Hn(this.sliceSerialize(e)).toLowerCase(),i.label=r}function wj(e){this.exit(e)}function Cj(e){const r=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=Hn(this.sliceSerialize(e)).toLowerCase(),i.label=r}function Rj(e){this.exit(e)}function jj(){return"["}function Uv(e,r,i,s){const o=i.createTracker(s);let c=o.move("[^");const d=i.enter("footnoteReference"),h=i.enter("reference");return c+=o.move(i.safe(i.associationId(e),{after:"]",before:c})),h(),d(),c+=o.move("]"),c}function Tj(){return{enter:{gfmFootnoteCallString:vj,gfmFootnoteCall:bj,gfmFootnoteDefinitionLabelString:xj,gfmFootnoteDefinition:Sj},exit:{gfmFootnoteCallString:kj,gfmFootnoteCall:wj,gfmFootnoteDefinitionLabelString:Cj,gfmFootnoteDefinition:Rj}}}function Ej(e){let r=!1;return e&&e.firstLineBlank&&(r=!0),{handlers:{footnoteDefinition:i,footnoteReference:Uv},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function i(s,o,c,d){const h=c.createTracker(d);let p=h.move("[^");const g=c.enter("footnoteDefinition"),v=c.enter("label");return p+=h.move(c.safe(c.associationId(s),{before:p,after:"]"})),v(),p+=h.move("]:"),s.children&&s.children.length>0&&(h.shift(4),p+=h.move((r?`
|
|
26
|
+
`:" ")+c.indentLines(c.containerFlow(s,h.current()),r?qv:Nj))),g(),p}}function Nj(e,r,i){return r===0?e:qv(e,r,i)}function qv(e,r,i){return(i?"":" ")+e}const Ij=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];$v.peek=_j;function Aj(){return{canContainEols:["delete"],enter:{strikethrough:Oj},exit:{strikethrough:Mj}}}function Dj(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Ij}],handlers:{delete:$v}}}function Oj(e){this.enter({type:"delete",children:[]},e)}function Mj(e){this.exit(e)}function $v(e,r,i,s){const o=i.createTracker(s),c=i.enter("strikethrough");let d=o.move("~~");return d+=i.containerPhrasing(e,{...o.current(),before:d,after:"~"}),d+=o.move("~~"),c(),d}function _j(){return"~"}function Lj(e){return e.length}function zj(e,r){const i=r||{},s=(i.align||[]).concat(),o=i.stringLength||Lj,c=[],d=[],h=[],p=[];let g=0,v=-1;for(;++v<e.length;){const N=[],z=[];let R=-1;for(e[v].length>g&&(g=e[v].length);++R<e[v].length;){const A=Bj(e[v][R]);if(i.alignDelimiters!==!1){const E=o(A);z[R]=E,(p[R]===void 0||E>p[R])&&(p[R]=E)}N.push(A)}d[v]=N,h[v]=z}let y=-1;if(typeof s=="object"&&"length"in s)for(;++y<g;)c[y]=Wg(s[y]);else{const N=Wg(s);for(;++y<g;)c[y]=N}y=-1;const k=[],b=[];for(;++y<g;){const N=c[y];let z="",R="";N===99?(z=":",R=":"):N===108?z=":":N===114&&(R=":");let A=i.alignDelimiters===!1?1:Math.max(1,p[y]-z.length-R.length);const E=z+"-".repeat(A)+R;i.alignDelimiters!==!1&&(A=z.length+A+R.length,A>p[y]&&(p[y]=A),b[y]=A),k[y]=E}d.splice(1,0,k),h.splice(1,0,b),v=-1;const w=[];for(;++v<d.length;){const N=d[v],z=h[v];y=-1;const R=[];for(;++y<g;){const A=N[y]||"";let E="",F="";if(i.alignDelimiters!==!1){const K=p[y]-(z[y]||0),O=c[y];O===114?E=" ".repeat(K):O===99?K%2?(E=" ".repeat(K/2+.5),F=" ".repeat(K/2-.5)):(E=" ".repeat(K/2),F=E):F=" ".repeat(K)}i.delimiterStart!==!1&&!y&&R.push("|"),i.padding!==!1&&!(i.alignDelimiters===!1&&A==="")&&(i.delimiterStart!==!1||y)&&R.push(" "),i.alignDelimiters!==!1&&R.push(E),R.push(A),i.alignDelimiters!==!1&&R.push(F),i.padding!==!1&&R.push(" "),(i.delimiterEnd!==!1||y!==g-1)&&R.push("|")}w.push(i.delimiterEnd===!1?R.join("").replace(/ +$/,""):R.join(""))}return w.join(`
|
|
27
|
+
`)}function Bj(e){return e==null?"":String(e)}function Wg(e){const r=typeof e=="string"?e.codePointAt(0):0;return r===67||r===99?99:r===76||r===108?108:r===82||r===114?114:0}function Hj(e,r,i,s){const o=i.enter("blockquote"),c=i.createTracker(s);c.move("> "),c.shift(2);const d=i.indentLines(i.containerFlow(e,c.current()),Uj);return o(),d}function Uj(e,r,i){return">"+(i?"":" ")+e}function qj(e,r){return ey(e,r.inConstruct,!0)&&!ey(e,r.notInConstruct,!1)}function ey(e,r,i){if(typeof r=="string"&&(r=[r]),!r||r.length===0)return i;let s=-1;for(;++s<r.length;)if(e.includes(r[s]))return!0;return!1}function ty(e,r,i,s){let o=-1;for(;++o<i.unsafe.length;)if(i.unsafe[o].character===`
|
|
28
|
+
`&&qj(i.stack,i.unsafe[o]))return/[ \t]/.test(s.before)?"":" ";return`\\
|
|
29
|
+
`}function $j(e,r){const i=String(e);let s=i.indexOf(r),o=s,c=0,d=0;if(typeof r!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===o?++c>d&&(d=c):c=1,o=s+r.length,s=i.indexOf(r,o);return d}function Gj(e,r){return!!(r.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function Fj(e){const r=e.options.fence||"`";if(r!=="`"&&r!=="~")throw new Error("Cannot serialize code with `"+r+"` for `options.fence`, expected `` ` `` or `~`");return r}function Pj(e,r,i,s){const o=Fj(i),c=e.value||"",d=o==="`"?"GraveAccent":"Tilde";if(Gj(e,i)){const y=i.enter("codeIndented"),k=i.indentLines(c,Vj);return y(),k}const h=i.createTracker(s),p=o.repeat(Math.max($j(c,o)+1,3)),g=i.enter("codeFenced");let v=h.move(p);if(e.lang){const y=i.enter(`codeFencedLang${d}`);v+=h.move(i.safe(e.lang,{before:v,after:" ",encode:["`"],...h.current()})),y()}if(e.lang&&e.meta){const y=i.enter(`codeFencedMeta${d}`);v+=h.move(" "),v+=h.move(i.safe(e.meta,{before:v,after:`
|
|
30
|
+
`,encode:["`"],...h.current()})),y()}return v+=h.move(`
|
|
31
|
+
`),c&&(v+=h.move(c+`
|
|
32
|
+
`)),v+=h.move(p),g(),v}function Vj(e,r,i){return(i?"":" ")+e}function $d(e){const r=e.options.quote||'"';if(r!=='"'&&r!=="'")throw new Error("Cannot serialize title with `"+r+"` for `options.quote`, expected `\"`, or `'`");return r}function Yj(e,r,i,s){const o=$d(i),c=o==='"'?"Quote":"Apostrophe",d=i.enter("definition");let h=i.enter("label");const p=i.createTracker(s);let g=p.move("[");return g+=p.move(i.safe(i.associationId(e),{before:g,after:"]",...p.current()})),g+=p.move("]: "),h(),!e.url||/[\0- \u007F]/.test(e.url)?(h=i.enter("destinationLiteral"),g+=p.move("<"),g+=p.move(i.safe(e.url,{before:g,after:">",...p.current()})),g+=p.move(">")):(h=i.enter("destinationRaw"),g+=p.move(i.safe(e.url,{before:g,after:e.title?" ":`
|
|
33
|
+
`,...p.current()}))),h(),e.title&&(h=i.enter(`title${c}`),g+=p.move(" "+o),g+=p.move(i.safe(e.title,{before:g,after:o,...p.current()})),g+=p.move(o),h()),d(),g}function Kj(e){const r=e.options.emphasis||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize emphasis with `"+r+"` for `options.emphasis`, expected `*`, or `_`");return r}function vs(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Ql(e,r,i){const s=fa(e),o=fa(r);return s===void 0?o===void 0?i==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===1?o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Gv.peek=Xj;function Gv(e,r,i,s){const o=Kj(i),c=i.enter("emphasis"),d=i.createTracker(s),h=d.move(o);let p=d.move(i.containerPhrasing(e,{after:o,before:h,...d.current()}));const g=p.charCodeAt(0),v=Ql(s.before.charCodeAt(s.before.length-1),g,o);v.inside&&(p=vs(g)+p.slice(1));const y=p.charCodeAt(p.length-1),k=Ql(s.after.charCodeAt(0),y,o);k.inside&&(p=p.slice(0,-1)+vs(y));const b=d.move(o);return c(),i.attentionEncodeSurroundingInfo={after:k.outside,before:v.outside},h+p+b}function Xj(e,r,i){return i.options.emphasis||"*"}function Qj(e,r){let i=!1;return Ud(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return i=!0,dd}),!!((!e.depth||e.depth<3)&&Od(e)&&(r.options.setext||i))}function Zj(e,r,i,s){const o=Math.max(Math.min(6,e.depth||1),1),c=i.createTracker(s);if(Qj(e,i)){const v=i.enter("headingSetext"),y=i.enter("phrasing"),k=i.containerPhrasing(e,{...c.current(),before:`
|
|
34
|
+
`,after:`
|
|
35
|
+
`});return y(),v(),k+`
|
|
36
|
+
`+(o===1?"=":"-").repeat(k.length-(Math.max(k.lastIndexOf("\r"),k.lastIndexOf(`
|
|
37
|
+
`))+1))}const d="#".repeat(o),h=i.enter("headingAtx"),p=i.enter("phrasing");c.move(d+" ");let g=i.containerPhrasing(e,{before:"# ",after:`
|
|
38
|
+
`,...c.current()});return/^[\t ]/.test(g)&&(g=vs(g.charCodeAt(0))+g.slice(1)),g=g?d+" "+g:d,i.options.closeAtx&&(g+=" "+d),p(),h(),g}Fv.peek=Jj;function Fv(e){return e.value||""}function Jj(){return"<"}Pv.peek=Wj;function Pv(e,r,i,s){const o=$d(i),c=o==='"'?"Quote":"Apostrophe",d=i.enter("image");let h=i.enter("label");const p=i.createTracker(s);let g=p.move("![");return g+=p.move(i.safe(e.alt,{before:g,after:"]",...p.current()})),g+=p.move("]("),h(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(h=i.enter("destinationLiteral"),g+=p.move("<"),g+=p.move(i.safe(e.url,{before:g,after:">",...p.current()})),g+=p.move(">")):(h=i.enter("destinationRaw"),g+=p.move(i.safe(e.url,{before:g,after:e.title?" ":")",...p.current()}))),h(),e.title&&(h=i.enter(`title${c}`),g+=p.move(" "+o),g+=p.move(i.safe(e.title,{before:g,after:o,...p.current()})),g+=p.move(o),h()),g+=p.move(")"),d(),g}function Wj(){return"!"}Vv.peek=eT;function Vv(e,r,i,s){const o=e.referenceType,c=i.enter("imageReference");let d=i.enter("label");const h=i.createTracker(s);let p=h.move("![");const g=i.safe(e.alt,{before:p,after:"]",...h.current()});p+=h.move(g+"]["),d();const v=i.stack;i.stack=[],d=i.enter("reference");const y=i.safe(i.associationId(e),{before:p,after:"]",...h.current()});return d(),i.stack=v,c(),o==="full"||!g||g!==y?p+=h.move(y+"]"):o==="shortcut"?p=p.slice(0,-1):p+=h.move("]"),p}function eT(){return"!"}Yv.peek=tT;function Yv(e,r,i){let s=e.value||"",o="`",c=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(s);)o+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++c<i.unsafe.length;){const d=i.unsafe[c],h=i.compilePattern(d);let p;if(d.atBreak)for(;p=h.exec(s);){let g=p.index;s.charCodeAt(g)===10&&s.charCodeAt(g-1)===13&&g--,s=s.slice(0,g)+" "+s.slice(p.index+1)}}return o+s+o}function tT(){return"`"}function Kv(e,r){const i=Od(e);return!!(!r.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(i===e.url||"mailto:"+i===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Xv.peek=nT;function Xv(e,r,i,s){const o=$d(i),c=o==='"'?"Quote":"Apostrophe",d=i.createTracker(s);let h,p;if(Kv(e,i)){const v=i.stack;i.stack=[],h=i.enter("autolink");let y=d.move("<");return y+=d.move(i.containerPhrasing(e,{before:y,after:">",...d.current()})),y+=d.move(">"),h(),i.stack=v,y}h=i.enter("link"),p=i.enter("label");let g=d.move("[");return g+=d.move(i.containerPhrasing(e,{before:g,after:"](",...d.current()})),g+=d.move("]("),p(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(p=i.enter("destinationLiteral"),g+=d.move("<"),g+=d.move(i.safe(e.url,{before:g,after:">",...d.current()})),g+=d.move(">")):(p=i.enter("destinationRaw"),g+=d.move(i.safe(e.url,{before:g,after:e.title?" ":")",...d.current()}))),p(),e.title&&(p=i.enter(`title${c}`),g+=d.move(" "+o),g+=d.move(i.safe(e.title,{before:g,after:o,...d.current()})),g+=d.move(o),p()),g+=d.move(")"),h(),g}function nT(e,r,i){return Kv(e,i)?"<":"["}Qv.peek=rT;function Qv(e,r,i,s){const o=e.referenceType,c=i.enter("linkReference");let d=i.enter("label");const h=i.createTracker(s);let p=h.move("[");const g=i.containerPhrasing(e,{before:p,after:"]",...h.current()});p+=h.move(g+"]["),d();const v=i.stack;i.stack=[],d=i.enter("reference");const y=i.safe(i.associationId(e),{before:p,after:"]",...h.current()});return d(),i.stack=v,c(),o==="full"||!g||g!==y?p+=h.move(y+"]"):o==="shortcut"?p=p.slice(0,-1):p+=h.move("]"),p}function rT(){return"["}function Gd(e){const r=e.options.bullet||"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bullet`, expected `*`, `+`, or `-`");return r}function iT(e){const r=Gd(e),i=e.options.bulletOther;if(!i)return r==="*"?"-":"*";if(i!=="*"&&i!=="+"&&i!=="-")throw new Error("Cannot serialize items with `"+i+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(i===r)throw new Error("Expected `bullet` (`"+r+"`) and `bulletOther` (`"+i+"`) to be different");return i}function aT(e){const r=e.options.bulletOrdered||".";if(r!=="."&&r!==")")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOrdered`, expected `.` or `)`");return r}function Zv(e){const r=e.options.rule||"*";if(r!=="*"&&r!=="-"&&r!=="_")throw new Error("Cannot serialize rules with `"+r+"` for `options.rule`, expected `*`, `-`, or `_`");return r}function sT(e,r,i,s){const o=i.enter("list"),c=i.bulletCurrent;let d=e.ordered?aT(i):Gd(i);const h=e.ordered?d==="."?")":".":iT(i);let p=r&&i.bulletLastUsed?d===i.bulletLastUsed:!1;if(!e.ordered){const v=e.children?e.children[0]:void 0;if((d==="*"||d==="-")&&v&&(!v.children||!v.children[0])&&i.stack[i.stack.length-1]==="list"&&i.stack[i.stack.length-2]==="listItem"&&i.stack[i.stack.length-3]==="list"&&i.stack[i.stack.length-4]==="listItem"&&i.indexStack[i.indexStack.length-1]===0&&i.indexStack[i.indexStack.length-2]===0&&i.indexStack[i.indexStack.length-3]===0&&(p=!0),Zv(i)===d&&v){let y=-1;for(;++y<e.children.length;){const k=e.children[y];if(k&&k.type==="listItem"&&k.children&&k.children[0]&&k.children[0].type==="thematicBreak"){p=!0;break}}}}p&&(d=h),i.bulletCurrent=d;const g=i.containerFlow(e,s);return i.bulletLastUsed=d,i.bulletCurrent=c,o(),g}function lT(e){const r=e.options.listItemIndent||"one";if(r!=="tab"&&r!=="one"&&r!=="mixed")throw new Error("Cannot serialize items with `"+r+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return r}function oT(e,r,i,s){const o=lT(i);let c=i.bulletCurrent||Gd(i);r&&r.type==="list"&&r.ordered&&(c=(typeof r.start=="number"&&r.start>-1?r.start:1)+(i.options.incrementListMarker===!1?0:r.children.indexOf(e))+c);let d=c.length+1;(o==="tab"||o==="mixed"&&(r&&r.type==="list"&&r.spread||e.spread))&&(d=Math.ceil(d/4)*4);const h=i.createTracker(s);h.move(c+" ".repeat(d-c.length)),h.shift(d);const p=i.enter("listItem"),g=i.indentLines(i.containerFlow(e,h.current()),v);return p(),g;function v(y,k,b){return k?(b?"":" ".repeat(d))+y:(b?c:c+" ".repeat(d-c.length))+y}}function uT(e,r,i,s){const o=i.enter("paragraph"),c=i.enter("phrasing"),d=i.containerPhrasing(e,s);return c(),o(),d}const cT=fo(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function dT(e,r,i,s){return(e.children.some(function(d){return cT(d)})?i.containerPhrasing:i.containerFlow).call(i,e,s)}function fT(e){const r=e.options.strong||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize strong with `"+r+"` for `options.strong`, expected `*`, or `_`");return r}Jv.peek=hT;function Jv(e,r,i,s){const o=fT(i),c=i.enter("strong"),d=i.createTracker(s),h=d.move(o+o);let p=d.move(i.containerPhrasing(e,{after:o,before:h,...d.current()}));const g=p.charCodeAt(0),v=Ql(s.before.charCodeAt(s.before.length-1),g,o);v.inside&&(p=vs(g)+p.slice(1));const y=p.charCodeAt(p.length-1),k=Ql(s.after.charCodeAt(0),y,o);k.inside&&(p=p.slice(0,-1)+vs(y));const b=d.move(o+o);return c(),i.attentionEncodeSurroundingInfo={after:k.outside,before:v.outside},h+p+b}function hT(e,r,i){return i.options.strong||"*"}function mT(e,r,i,s){return i.safe(e.value,s)}function pT(e){const r=e.options.ruleRepetition||3;if(r<3)throw new Error("Cannot serialize rules with repetition `"+r+"` for `options.ruleRepetition`, expected `3` or more");return r}function gT(e,r,i){const s=(Zv(i)+(i.options.ruleSpaces?" ":"")).repeat(pT(i));return i.options.ruleSpaces?s.slice(0,-1):s}const Wv={blockquote:Hj,break:ty,code:Pj,definition:Yj,emphasis:Gv,hardBreak:ty,heading:Zj,html:Fv,image:Pv,imageReference:Vv,inlineCode:Yv,link:Xv,linkReference:Qv,list:sT,listItem:oT,paragraph:uT,root:dT,strong:Jv,text:mT,thematicBreak:gT};function yT(){return{enter:{table:vT,tableData:ny,tableHeader:ny,tableRow:xT},exit:{codeText:ST,table:bT,tableData:Jc,tableHeader:Jc,tableRow:Jc}}}function vT(e){const r=e._align;this.enter({type:"table",align:r.map(function(i){return i==="none"?null:i}),children:[]},e),this.data.inTable=!0}function bT(e){this.exit(e),this.data.inTable=void 0}function xT(e){this.enter({type:"tableRow",children:[]},e)}function Jc(e){this.exit(e)}function ny(e){this.enter({type:"tableCell",children:[]},e)}function ST(e){let r=this.resume();this.data.inTable&&(r=r.replace(/\\([\\|])/g,kT));const i=this.stack[this.stack.length-1];i.type,i.value=r,this.exit(e)}function kT(e,r){return r==="|"?r:e}function wT(e){const r=e||{},i=r.tableCellPadding,s=r.tablePipeAlign,o=r.stringLength,c=i?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
39
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:k,table:d,tableCell:p,tableRow:h}};function d(b,w,N,z){return g(v(b,N,z),b.align)}function h(b,w,N,z){const R=y(b,N,z),A=g([R]);return A.slice(0,A.indexOf(`
|
|
40
|
+
`))}function p(b,w,N,z){const R=N.enter("tableCell"),A=N.enter("phrasing"),E=N.containerPhrasing(b,{...z,before:c,after:c});return A(),R(),E}function g(b,w){return zj(b,{align:w,alignDelimiters:s,padding:i,stringLength:o})}function v(b,w,N){const z=b.children;let R=-1;const A=[],E=w.enter("table");for(;++R<z.length;)A[R]=y(z[R],w,N);return E(),A}function y(b,w,N){const z=b.children;let R=-1;const A=[],E=w.enter("tableRow");for(;++R<z.length;)A[R]=p(z[R],b,w,N);return E(),A}function k(b,w,N){let z=Wv.inlineCode(b,w,N);return N.stack.includes("tableCell")&&(z=z.replace(/\|/g,"\\$&")),z}}function CT(){return{exit:{taskListCheckValueChecked:ry,taskListCheckValueUnchecked:ry,paragraph:jT}}}function RT(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:TT}}}function ry(e){const r=this.stack[this.stack.length-2];r.type,r.checked=e.type==="taskListCheckValueChecked"}function jT(e){const r=this.stack[this.stack.length-2];if(r&&r.type==="listItem"&&typeof r.checked=="boolean"){const i=this.stack[this.stack.length-1];i.type;const s=i.children[0];if(s&&s.type==="text"){const o=r.children;let c=-1,d;for(;++c<o.length;){const h=o[c];if(h.type==="paragraph"){d=h;break}}d===i&&(s.value=s.value.slice(1),s.value.length===0?i.children.shift():i.position&&s.position&&typeof s.position.start.offset=="number"&&(s.position.start.column++,s.position.start.offset++,i.position.start=Object.assign({},s.position.start)))}}this.exit(e)}function TT(e,r,i,s){const o=e.children[0],c=typeof e.checked=="boolean"&&o&&o.type==="paragraph",d="["+(e.checked?"x":" ")+"] ",h=i.createTracker(s);c&&h.move(d);let p=Wv.listItem(e,r,i,{...s,...h.current()});return c&&(p=p.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,g)),p;function g(v){return v+d}}function ET(){return[sj(),Tj(),Aj(),yT(),CT()]}function NT(e){return{extensions:[lj(),Ej(e),Dj(),wT(e),RT()]}}const IT={tokenize:LT,partial:!0},eb={tokenize:zT,partial:!0},tb={tokenize:BT,partial:!0},nb={tokenize:HT,partial:!0},AT={tokenize:UT,partial:!0},rb={name:"wwwAutolink",tokenize:MT,previous:ab},ib={name:"protocolAutolink",tokenize:_T,previous:sb},vr={name:"emailAutolink",tokenize:OT,previous:lb},Xn={};function DT(){return{text:Xn}}let hi=48;for(;hi<123;)Xn[hi]=vr,hi++,hi===58?hi=65:hi===91&&(hi=97);Xn[43]=vr;Xn[45]=vr;Xn[46]=vr;Xn[95]=vr;Xn[72]=[vr,ib];Xn[104]=[vr,ib];Xn[87]=[vr,rb];Xn[119]=[vr,rb];function OT(e,r,i){const s=this;let o,c;return d;function d(y){return!pd(y)||!lb.call(s,s.previous)||Fd(s.events)?i(y):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),h(y))}function h(y){return pd(y)?(e.consume(y),h):y===64?(e.consume(y),p):i(y)}function p(y){return y===46?e.check(AT,v,g)(y):y===45||y===95||Vt(y)?(c=!0,e.consume(y),p):v(y)}function g(y){return e.consume(y),o=!0,p}function v(y){return c&&o&&Zt(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),r(y)):i(y)}}function MT(e,r,i){const s=this;return o;function o(d){return d!==87&&d!==119||!ab.call(s,s.previous)||Fd(s.events)?i(d):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(IT,e.attempt(eb,e.attempt(tb,c),i),i)(d))}function c(d){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),r(d)}}function _T(e,r,i){const s=this;let o="",c=!1;return d;function d(y){return(y===72||y===104)&&sb.call(s,s.previous)&&!Fd(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(y),e.consume(y),h):i(y)}function h(y){if(Zt(y)&&o.length<5)return o+=String.fromCodePoint(y),e.consume(y),h;if(y===58){const k=o.toLowerCase();if(k==="http"||k==="https")return e.consume(y),p}return i(y)}function p(y){return y===47?(e.consume(y),c?g:(c=!0,p)):i(y)}function g(y){return y===null||Yl(y)||ot(y)||xi(y)||oo(y)?i(y):e.attempt(eb,e.attempt(tb,v),i)(y)}function v(y){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),r(y)}}function LT(e,r,i){let s=0;return o;function o(d){return(d===87||d===119)&&s<3?(s++,e.consume(d),o):d===46&&s===3?(e.consume(d),c):i(d)}function c(d){return d===null?i(d):r(d)}}function zT(e,r,i){let s,o,c;return d;function d(g){return g===46||g===95?e.check(nb,p,h)(g):g===null||ot(g)||xi(g)||g!==45&&oo(g)?p(g):(c=!0,e.consume(g),d)}function h(g){return g===95?s=!0:(o=s,s=void 0),e.consume(g),d}function p(g){return o||s||!c?i(g):r(g)}}function BT(e,r){let i=0,s=0;return o;function o(d){return d===40?(i++,e.consume(d),o):d===41&&s<i?c(d):d===33||d===34||d===38||d===39||d===41||d===42||d===44||d===46||d===58||d===59||d===60||d===63||d===93||d===95||d===126?e.check(nb,r,c)(d):d===null||ot(d)||xi(d)?r(d):(e.consume(d),o)}function c(d){return d===41&&s++,e.consume(d),o}}function HT(e,r,i){return s;function s(h){return h===33||h===34||h===39||h===41||h===42||h===44||h===46||h===58||h===59||h===63||h===95||h===126?(e.consume(h),s):h===38?(e.consume(h),c):h===93?(e.consume(h),o):h===60||h===null||ot(h)||xi(h)?r(h):i(h)}function o(h){return h===null||h===40||h===91||ot(h)||xi(h)?r(h):s(h)}function c(h){return Zt(h)?d(h):i(h)}function d(h){return h===59?(e.consume(h),s):Zt(h)?(e.consume(h),d):i(h)}}function UT(e,r,i){return s;function s(c){return e.consume(c),o}function o(c){return Vt(c)?i(c):r(c)}}function ab(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||ot(e)}function sb(e){return!Zt(e)}function lb(e){return!(e===47||pd(e))}function pd(e){return e===43||e===45||e===46||e===95||Vt(e)}function Fd(e){let r=e.length,i=!1;for(;r--;){const s=e[r][1];if((s.type==="labelLink"||s.type==="labelImage")&&!s._balanced){i=!0;break}if(s._gfmAutolinkLiteralWalkedInto){i=!1;break}}return e.length>0&&!i&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),i}const qT={tokenize:XT,partial:!0};function $T(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:VT,continuation:{tokenize:YT},exit:KT}},text:{91:{name:"gfmFootnoteCall",tokenize:PT},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:GT,resolveTo:FT}}}}function GT(e,r,i){const s=this;let o=s.events.length;const c=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let d;for(;o--;){const p=s.events[o][1];if(p.type==="labelImage"){d=p;break}if(p.type==="gfmFootnoteCall"||p.type==="labelLink"||p.type==="label"||p.type==="image"||p.type==="link")break}return h;function h(p){if(!d||!d._balanced)return i(p);const g=Hn(s.sliceSerialize({start:d.end,end:s.now()}));return g.codePointAt(0)!==94||!c.includes(g.slice(1))?i(p):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),r(p))}}function FT(e,r){let i=e.length;for(;i--;)if(e[i][1].type==="labelImage"&&e[i][0]==="enter"){e[i][1];break}e[i+1][1].type="data",e[i+3][1].type="gfmFootnoteCallLabelMarker";const s={type:"gfmFootnoteCall",start:Object.assign({},e[i+3][1].start),end:Object.assign({},e[e.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[i+3][1].end),end:Object.assign({},e[i+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const c={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},d={type:"chunkString",contentType:"string",start:Object.assign({},c.start),end:Object.assign({},c.end)},h=[e[i+1],e[i+2],["enter",s,r],e[i+3],e[i+4],["enter",o,r],["exit",o,r],["enter",c,r],["enter",d,r],["exit",d,r],["exit",c,r],e[e.length-2],e[e.length-1],["exit",s,r]];return e.splice(i,e.length-i+1,...h),e}function PT(e,r,i){const s=this,o=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let c=0,d;return h;function h(y){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(y),e.exit("gfmFootnoteCallLabelMarker"),p}function p(y){return y!==94?i(y):(e.enter("gfmFootnoteCallMarker"),e.consume(y),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",g)}function g(y){if(c>999||y===93&&!d||y===null||y===91||ot(y))return i(y);if(y===93){e.exit("chunkString");const k=e.exit("gfmFootnoteCallString");return o.includes(Hn(s.sliceSerialize(k)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(y),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),r):i(y)}return ot(y)||(d=!0),c++,e.consume(y),y===92?v:g}function v(y){return y===91||y===92||y===93?(e.consume(y),c++,g):g(y)}}function VT(e,r,i){const s=this,o=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let c,d=0,h;return p;function p(w){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),g}function g(w){return w===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",v):i(w)}function v(w){if(d>999||w===93&&!h||w===null||w===91||ot(w))return i(w);if(w===93){e.exit("chunkString");const N=e.exit("gfmFootnoteDefinitionLabelString");return c=Hn(s.sliceSerialize(N)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),k}return ot(w)||(h=!0),d++,e.consume(w),w===92?y:v}function y(w){return w===91||w===92||w===93?(e.consume(w),d++,v):v(w)}function k(w){return w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),o.includes(c)||o.push(c),Ve(e,b,"gfmFootnoteDefinitionWhitespace")):i(w)}function b(w){return r(w)}}function YT(e,r,i){return e.check(xs,r,e.attempt(qT,r,i))}function KT(e){e.exit("gfmFootnoteDefinition")}function XT(e,r,i){const s=this;return Ve(e,o,"gfmFootnoteDefinitionIndent",5);function o(c){const d=s.events[s.events.length-1];return d&&d[1].type==="gfmFootnoteDefinitionIndent"&&d[2].sliceSerialize(d[1],!0).length===4?r(c):i(c)}}function QT(e){let i=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:c,resolveAll:o};return i==null&&(i=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function o(d,h){let p=-1;for(;++p<d.length;)if(d[p][0]==="enter"&&d[p][1].type==="strikethroughSequenceTemporary"&&d[p][1]._close){let g=p;for(;g--;)if(d[g][0]==="exit"&&d[g][1].type==="strikethroughSequenceTemporary"&&d[g][1]._open&&d[p][1].end.offset-d[p][1].start.offset===d[g][1].end.offset-d[g][1].start.offset){d[p][1].type="strikethroughSequence",d[g][1].type="strikethroughSequence";const v={type:"strikethrough",start:Object.assign({},d[g][1].start),end:Object.assign({},d[p][1].end)},y={type:"strikethroughText",start:Object.assign({},d[g][1].end),end:Object.assign({},d[p][1].start)},k=[["enter",v,h],["enter",d[g][1],h],["exit",d[g][1],h],["enter",y,h]],b=h.parser.constructs.insideSpan.null;b&&kn(k,k.length,0,uo(b,d.slice(g+1,p),h)),kn(k,k.length,0,[["exit",y,h],["enter",d[p][1],h],["exit",d[p][1],h],["exit",v,h]]),kn(d,g-1,p-g+3,k),p=g+k.length-2;break}}for(p=-1;++p<d.length;)d[p][1].type==="strikethroughSequenceTemporary"&&(d[p][1].type="data");return d}function c(d,h,p){const g=this.previous,v=this.events;let y=0;return k;function k(w){return g===126&&v[v.length-1][1].type!=="characterEscape"?p(w):(d.enter("strikethroughSequenceTemporary"),b(w))}function b(w){const N=fa(g);if(w===126)return y>1?p(w):(d.consume(w),y++,b);if(y<2&&!i)return p(w);const z=d.exit("strikethroughSequenceTemporary"),R=fa(w);return z._open=!R||R===2&&!!N,z._close=!N||N===2&&!!R,h(w)}}}class ZT{constructor(){this.map=[]}add(r,i,s){JT(this,r,i,s)}consume(r){if(this.map.sort(function(c,d){return c[0]-d[0]}),this.map.length===0)return;let i=this.map.length;const s=[];for(;i>0;)i-=1,s.push(r.slice(this.map[i][0]+this.map[i][1]),this.map[i][2]),r.length=this.map[i][0];s.push(r.slice()),r.length=0;let o=s.pop();for(;o;){for(const c of o)r.push(c);o=s.pop()}this.map.length=0}}function JT(e,r,i,s){let o=0;if(!(i===0&&s.length===0)){for(;o<e.map.length;){if(e.map[o][0]===r){e.map[o][1]+=i,e.map[o][2].push(...s);return}o+=1}e.map.push([r,i,s])}}function WT(e,r){let i=!1;const s=[];for(;r<e.length;){const o=e[r];if(i){if(o[0]==="enter")o[1].type==="tableContent"&&s.push(e[r+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(e[r-1][1].type==="tableDelimiterMarker"){const c=s.length-1;s[c]=s[c]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(i=!0);r+=1}return s}function eE(){return{flow:{null:{name:"table",tokenize:tE,resolveAll:nE}}}}function tE(e,r,i){const s=this;let o=0,c=0,d;return h;function h(_){let V=s.events.length-1;for(;V>-1;){const q=s.events[V][1].type;if(q==="lineEnding"||q==="linePrefix")V--;else break}const G=V>-1?s.events[V][1].type:null,ne=G==="tableHead"||G==="tableRow"?O:p;return ne===O&&s.parser.lazy[s.now().line]?i(_):ne(_)}function p(_){return e.enter("tableHead"),e.enter("tableRow"),g(_)}function g(_){return _===124||(d=!0,c+=1),v(_)}function v(_){return _===null?i(_):Ce(_)?c>1?(c=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),b):i(_):He(_)?Ve(e,v,"whitespace")(_):(c+=1,d&&(d=!1,o+=1),_===124?(e.enter("tableCellDivider"),e.consume(_),e.exit("tableCellDivider"),d=!0,v):(e.enter("data"),y(_)))}function y(_){return _===null||_===124||ot(_)?(e.exit("data"),v(_)):(e.consume(_),_===92?k:y)}function k(_){return _===92||_===124?(e.consume(_),y):y(_)}function b(_){return s.interrupt=!1,s.parser.lazy[s.now().line]?i(_):(e.enter("tableDelimiterRow"),d=!1,He(_)?Ve(e,w,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):w(_))}function w(_){return _===45||_===58?z(_):_===124?(d=!0,e.enter("tableCellDivider"),e.consume(_),e.exit("tableCellDivider"),N):K(_)}function N(_){return He(_)?Ve(e,z,"whitespace")(_):z(_)}function z(_){return _===58?(c+=1,d=!0,e.enter("tableDelimiterMarker"),e.consume(_),e.exit("tableDelimiterMarker"),R):_===45?(c+=1,R(_)):_===null||Ce(_)?F(_):K(_)}function R(_){return _===45?(e.enter("tableDelimiterFiller"),A(_)):K(_)}function A(_){return _===45?(e.consume(_),A):_===58?(d=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(_),e.exit("tableDelimiterMarker"),E):(e.exit("tableDelimiterFiller"),E(_))}function E(_){return He(_)?Ve(e,F,"whitespace")(_):F(_)}function F(_){return _===124?w(_):_===null||Ce(_)?!d||o!==c?K(_):(e.exit("tableDelimiterRow"),e.exit("tableHead"),r(_)):K(_)}function K(_){return i(_)}function O(_){return e.enter("tableRow"),P(_)}function P(_){return _===124?(e.enter("tableCellDivider"),e.consume(_),e.exit("tableCellDivider"),P):_===null||Ce(_)?(e.exit("tableRow"),r(_)):He(_)?Ve(e,P,"whitespace")(_):(e.enter("data"),Y(_))}function Y(_){return _===null||_===124||ot(_)?(e.exit("data"),P(_)):(e.consume(_),_===92?le:Y)}function le(_){return _===92||_===124?(e.consume(_),Y):Y(_)}}function nE(e,r){let i=-1,s=!0,o=0,c=[0,0,0,0],d=[0,0,0,0],h=!1,p=0,g,v,y;const k=new ZT;for(;++i<e.length;){const b=e[i],w=b[1];b[0]==="enter"?w.type==="tableHead"?(h=!1,p!==0&&(iy(k,r,p,g,v),v=void 0,p=0),g={type:"table",start:Object.assign({},w.start),end:Object.assign({},w.end)},k.add(i,0,[["enter",g,r]])):w.type==="tableRow"||w.type==="tableDelimiterRow"?(s=!0,y=void 0,c=[0,0,0,0],d=[0,i+1,0,0],h&&(h=!1,v={type:"tableBody",start:Object.assign({},w.start),end:Object.assign({},w.end)},k.add(i,0,[["enter",v,r]])),o=w.type==="tableDelimiterRow"?2:v?3:1):o&&(w.type==="data"||w.type==="tableDelimiterMarker"||w.type==="tableDelimiterFiller")?(s=!1,d[2]===0&&(c[1]!==0&&(d[0]=d[1],y=Bl(k,r,c,o,void 0,y),c=[0,0,0,0]),d[2]=i)):w.type==="tableCellDivider"&&(s?s=!1:(c[1]!==0&&(d[0]=d[1],y=Bl(k,r,c,o,void 0,y)),c=d,d=[c[1],i,0,0])):w.type==="tableHead"?(h=!0,p=i):w.type==="tableRow"||w.type==="tableDelimiterRow"?(p=i,c[1]!==0?(d[0]=d[1],y=Bl(k,r,c,o,i,y)):d[1]!==0&&(y=Bl(k,r,d,o,i,y)),o=0):o&&(w.type==="data"||w.type==="tableDelimiterMarker"||w.type==="tableDelimiterFiller")&&(d[3]=i)}for(p!==0&&iy(k,r,p,g,v),k.consume(r.events),i=-1;++i<r.events.length;){const b=r.events[i];b[0]==="enter"&&b[1].type==="table"&&(b[1]._align=WT(r.events,i))}return e}function Bl(e,r,i,s,o,c){const d=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",h="tableContent";i[0]!==0&&(c.end=Object.assign({},oa(r.events,i[0])),e.add(i[0],0,[["exit",c,r]]));const p=oa(r.events,i[1]);if(c={type:d,start:Object.assign({},p),end:Object.assign({},p)},e.add(i[1],0,[["enter",c,r]]),i[2]!==0){const g=oa(r.events,i[2]),v=oa(r.events,i[3]),y={type:h,start:Object.assign({},g),end:Object.assign({},v)};if(e.add(i[2],0,[["enter",y,r]]),s!==2){const k=r.events[i[2]],b=r.events[i[3]];if(k[1].end=Object.assign({},b[1].end),k[1].type="chunkText",k[1].contentType="text",i[3]>i[2]+1){const w=i[2]+1,N=i[3]-i[2]-1;e.add(w,N,[])}}e.add(i[3]+1,0,[["exit",y,r]])}return o!==void 0&&(c.end=Object.assign({},oa(r.events,o)),e.add(o,0,[["exit",c,r]]),c=void 0),c}function iy(e,r,i,s,o){const c=[],d=oa(r.events,i);o&&(o.end=Object.assign({},d),c.push(["exit",o,r])),s.end=Object.assign({},d),c.push(["exit",s,r]),e.add(i+1,0,c)}function oa(e,r){const i=e[r],s=i[0]==="enter"?"start":"end";return i[1][s]}const rE={name:"tasklistCheck",tokenize:aE};function iE(){return{text:{91:rE}}}function aE(e,r,i){const s=this;return o;function o(p){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?i(p):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(p),e.exit("taskListCheckMarker"),c)}function c(p){return ot(p)?(e.enter("taskListCheckValueUnchecked"),e.consume(p),e.exit("taskListCheckValueUnchecked"),d):p===88||p===120?(e.enter("taskListCheckValueChecked"),e.consume(p),e.exit("taskListCheckValueChecked"),d):i(p)}function d(p){return p===93?(e.enter("taskListCheckMarker"),e.consume(p),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),h):i(p)}function h(p){return Ce(p)?r(p):He(p)?e.check({tokenize:sE},r,i)(p):i(p)}}function sE(e,r,i){return Ve(e,s,"whitespace");function s(o){return o===null?i(o):r(o)}}function lE(e){return yv([DT(),$T(),QT(e),eE(),iE()])}const oE={};function uE(e){const r=this,i=e||oE,s=r.data(),o=s.micromarkExtensions||(s.micromarkExtensions=[]),c=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),d=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);o.push(lE(i)),c.push(ET()),d.push(NT(i))}const ob=/^(javascript|vbscript|data):/i;function cE(e){if(!e)return!1;const r=e.trim();return!(!r||ob.test(r))}function dE(e){if(!e)return!1;const r=e.trim();return!r||ob.test(r)||r.startsWith("blob:")||r.startsWith("data:image/")||/^https?:\/\//i.test(r)?!1:!!(r.startsWith("/")||r.startsWith("./")||r.startsWith("../")||!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(r))}const fE=[[uE,{singleTilde:!1}]];function ay({lang:e,text:r}){const[i,s]=S.useState(!1),o=()=>{navigator.clipboard?.writeText(r).then(()=>{s(!0),window.setTimeout(()=>s(!1),1600)},()=>{})};return u.jsxs("div",{className:"oc-codeblock",children:[u.jsxs("div",{className:"oc-codeblock-head",children:[u.jsx("span",{className:"oc-codeblock-lang",children:e||"text"}),u.jsx("button",{type:"button",className:"oc-codeblock-copy",onClick:o,children:i?"已复制":"复制"})]}),u.jsx("pre",{children:u.jsx("code",{children:r})})]})}const hE={pre({children:e}){return u.jsx(u.Fragment,{children:e})},code({className:e,children:r,...i}){const s=String(r??"").replace(/\n$/,""),o=/language-([\w-]+)/.exec(e??"");return o||e&&s.includes(`
|
|
41
|
+
`)?u.jsx(ay,{lang:o?.[1]??"",text:s}):s.includes(`
|
|
42
|
+
`)?u.jsx(ay,{lang:"",text:s}):u.jsx("code",{className:e,...i,children:r})},a({href:e,children:r,...i}){if(!cE(e))return u.jsx("span",{...i,children:r});const s=/^https?:\/\//i.test(e??"");return u.jsx("a",{href:e,...s?{target:"_blank",rel:"noopener noreferrer"}:{},...i,children:r})},img({src:e,alt:r}){return dE(e)?u.jsxs(u.Fragment,{children:[u.jsx("img",{src:e,alt:r??"",loading:"lazy",onError:i=>{const s=i.currentTarget;s.hidden=!0,s.nextElementSibling?.removeAttribute("hidden")}}),u.jsx("span",{className:"oc-md-img-fallback",hidden:!0,title:e??void 0,children:r?`[图片加载失败: ${r}]`:"[图片加载失败]"})]}):u.jsx("span",{className:"oc-md-img-fallback",title:e??void 0,children:r?`[图片: ${r}]`:"[图片已屏蔽]"})},table({children:e}){return u.jsx("div",{className:"oc-md-table-wrap",children:u.jsx("table",{children:e})})},input(e){return e.type==="checkbox"?u.jsx("input",{type:"checkbox",checked:!!e.checked,disabled:!0,readOnly:!0}):u.jsx("input",{...e,disabled:!0,readOnly:!0})}};class mE extends S.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(r,i){}componentDidUpdate(r){r.text!==this.props.text&&this.state.hasError&&this.setState({hasError:!1})}render(){return this.state.hasError?u.jsx("div",{className:"oc-md",children:u.jsx("pre",{className:"oc-md-fallback",children:this.props.text})}):this.props.children}}function pE({text:e}){try{return u.jsx(mE,{text:e,children:u.jsx("div",{className:"oc-md",children:u.jsx(QR,{remarkPlugins:fE,components:hE,children:e})})})}catch{return u.jsx("div",{className:"oc-md",children:u.jsx("pre",{className:"oc-md-fallback",children:e})})}}function gE(){return u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[u.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),u.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})}function yE(){return u.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:u.jsx("polyline",{points:"20 6 9 17 4 12"})})}function vE(){return u.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[u.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),u.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})}function bE(){return u.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:u.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})}function Pd(){return u.jsx("svg",{className:"oc-tool-chevron",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:u.jsx("polyline",{points:"4 2.5 7.5 6 4 9.5"})})}function xE(){return u.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:u.jsx("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"})})}function gd(e){const[r,i]=S.useState(!1),s=()=>{navigator.clipboard?.writeText(e.text).then(()=>{i(!0),window.setTimeout(()=>i(!1),1600)},()=>{})};return u.jsx("button",{type:"button",className:`oc-message-copy${r?" is-copied":""}`,"aria-label":r?"已复制":"复制消息",title:r?"已复制":"复制",onClick:s,children:r?u.jsx(yE,{}):u.jsx(gE,{})})}function sy(e){const{message:r,streaming:i,activeAssistantId:s}=e,o=r.role==="user",c=o?"你":"π",d=o?"你":"助手",h=!o&&i&&s!==null&&r.id===s,p=h&&r.text.length===0,g=r.text.trim().length>0;return u.jsxs("div",{className:`oc-row ${o?"is-user":"is-assistant"}`,children:[u.jsxs("div",{className:"oc-meta",children:[u.jsx("span",{className:`oc-avatar ${o?"oc-avatar-user":"oc-avatar-assistant"}`,"aria-hidden":"true",children:c}),u.jsx("span",{className:"oc-role",children:d}),u.jsx("span",{className:"oc-time",children:Iy(r.createdAt)}),g&&u.jsx(gd,{text:r.text})]}),u.jsxs("div",{className:`oc-bubble ${o?"oc-bubble-user":"oc-bubble-assistant"}`,children:[g?o?u.jsx("div",{style:{whiteSpace:"pre-wrap"},children:r.text}):u.jsx(pE,{text:r.text}):p?u.jsx("span",{className:"oc-cursor","aria-hidden":"true"}):null,h&&g&&u.jsx("span",{className:"oc-cursor","aria-hidden":"true"})]})]})}function SE(e){if(!(!e||typeof e!="object"))return e}function Pr(e){return typeof e=="string"?e:void 0}function mo(e){if(!Array.isArray(e))return;const r=[];for(const i of e){const s=SE(i);if(!s)continue;const o=Pr(s.type)??"";if(o==="thinking"||o==="reasoning"){const c=Pr(s.thinking)??Pr(s.text)??"";r.push({type:"thinking",thinking:c});continue}if(o==="toolCall"||o==="tool_call"||o==="toolUse"||o==="tool_use"){const c=Pr(s.toolCallId)??Pr(s.id)??"";if(!c)continue;const d=Pr(s.toolName)??Pr(s.name);r.push({type:"toolCall",toolCallId:c,...d?{toolName:d}:{}});continue}if(o==="text"||o==="output_text"||o===""){const c=Pr(s.text);c!==void 0&&r.push({type:"text",text:c})}}return r}function kE(e,r={}){return e.type==="thinking"&&!r.isStreaming&&e.thinking.trim()===""}function ub(e,r={}){return e.filter(i=>!kE(i,r))}function wE(e){return e.type==="text"}function CE(e,r={}){const i=ub(e,r);let s=-1;for(let o=i.length-1;o>=0;o--)if(!wE(i[o])){s=o;break}return s===-1?{answerBlocks:i,processBlocks:[]}:{answerBlocks:i.slice(s+1),processBlocks:i.slice(0,s+1)}}function RE(e){return e.filter(r=>r.type==="text").map(r=>r.text).join("")}function ly(e){return{key:e,assistants:[],tools:[],processItems:[],live:!1}}function jE(e){const r=[],i=[];let s,o=[];const c=d=>{for(const h of o)h.assistantMessageId||(h.assistantMessageId=d),h.turnId||(h.turnId=s);o=[]};for(const d of e){const h=Date.parse(d.at)||Date.now();if(d.role==="user"){s=`restored-${d.id}`,o=[],r.push({id:d.id,role:"user",text:d.text,createdAt:h});continue}if(d.role==="assistant"){s||(s=`restored-${d.id}`);const p=mo(d.content);r.push({id:d.id,role:"assistant",text:d.text,createdAt:h,...p&&p.length>0?{content:p}:{}}),c(d.id);continue}if(d.role==="tool"){s||(s=`restored-tool-${d.id}`);const p={id:d.toolCallId||d.id,toolName:d.toolName||"tool",status:d.isError===!0?"error":"ok",resultText:d.text,result:d.text,createdAt:h,finishedAt:h,turnId:s};i.push(p),o.push(p)}}return{messages:r,toolCalls:i}}function cb(e,r){const i=mk(r);i?e.push({kind:"activity",activity:i}):e.push({kind:"tool",tool:r})}function oy(e,r,i,s){for(const o of e){if(o.type==="thinking"){i.push({kind:"thinking",thinking:o.thinking});continue}if(o.type==="text"){o.text.trim()&&i.push({kind:"text",text:o.text});continue}const c=r.tools.find(d=>d.id===o.toolCallId);c&&(cb(i,c),s.add(c.id))}}function TE(e){const r=new Set,i=[],s=e.assistants.slice(0,-1),o=e.assistants.at(-1);for(const p of s)oy(ub(p.content??[]),e,i,r);const c=o?.content??[],d=CE(c,{isStreaming:e.live});oy(d.processBlocks,e,i,r);for(const p of e.tools)r.has(p.id)||cb(i,p);if(e.processItems=i,!o)return;if(c.length===0){e.answer=o;return}const h=RE(d.answerBlocks);e.answer={...o,text:h,content:d.answerBlocks}}function EE(e){const r=e.messages.filter(h=>h.role==="user"||h.role==="assistant"),i=[];let s=null;const o=h=>{const p=ly(h);return i.push(p),p};for(const h of r){if(h.role==="user"){s=o(`user-${h.id}`),s.user=h;continue}s||(s=o(`assistant-${h.id}`)),s.assistants.push(h)}i.length===0&&e.toolCalls.length>0&&i.push(ly("orphan-tools"));const c=new Set,d=new Map;for(const h of i)for(const p of h.assistants)d.set(p.id,h);for(const h of e.toolCalls)if(h.assistantMessageId){const p=d.get(h.assistantMessageId);p&&(p.tools.push(h),c.add(h.id))}for(const h of e.toolCalls)if(!c.has(h.id)&&h.turnId){const p=i.find(v=>v.tools.some(y=>y.turnId===h.turnId)||v.key===`turn-${h.turnId}`||v.user&&`restored-${v.user.id}`===h.turnId);if(p){p.tools.push(h),c.add(h.id);continue}const g=i.find(v=>h.turnId===`restored-${v.user?.id}`||v.assistants.some(y=>h.turnId===`restored-${y.id}`));g&&(g.tools.push(h),c.add(h.id))}for(const h of e.toolCalls){if(c.has(h.id))continue;const p=i.find((g,v)=>{const y=g.user?.createdAt??g.assistants[0]?.createdAt??0,b=i[v+1]?.user?.createdAt??Number.POSITIVE_INFINITY;return h.createdAt>=y&&h.createdAt<b});if(p)p.tools.push(h),c.add(h.id);else{const g=i.at(-1);g&&(g.tools.push(h),c.add(h.id))}}for(const h of i)h.tools.sort((p,g)=>p.eventSeq!==void 0&&g.eventSeq!==void 0?p.eventSeq-g.eventSeq:p.createdAt-g.createdAt),h.live=e.streaming&&e.activeAssistantId!==null&&h.assistants.some(p=>p.id===e.activeAssistantId),TE(h);return i}function NE(e,r){const i=e.length,s=r?.thinkingCount??0,o=r?.textCount??0,c=r?.activityCount??0,d=s+o+c+i,h=e.filter(v=>v.status==="error").length+(r?.activityErrorCount??0),p=e.filter(v=>v.status==="running").length+(r?.activityRunningCount??0),g=[`处理详情 · ${d} 步`];return i>0&&g.push(`${i} 工具`),c>0&&g.push(`${c} 进展`),h>0?g.push(`${h} 出错`):p>0&&g.push("运行中"),{count:i,errorCount:h,runningCount:p,stepCount:d,label:g.join(" · ")}}function db(e){const{entry:r}=e,[i,s]=S.useState(r.status==="error"),[o,c]=S.useState(!1),d=r.status==="running"?"运行中":r.status==="error"?"出错":"完成",h=`is-${r.status}`,p=g0(r.args,{toolName:r.toolName}),g=x0(r.createdAt,r.finishedAt),v=y0(r.toolName),y=Ny(r.resultText??r.result),k=b0(y,o?{maxLen:Number.MAX_SAFE_INTEGER}:void 0);return u.jsxs("div",{className:`oc-tool ${r.status==="error"?"is-error":""} ${r.status==="running"?"is-running":""}`,children:[u.jsxs("button",{type:"button",className:"oc-tool-head","aria-expanded":i,onClick:()=>s(b=>!b),children:[u.jsx(Pd,{}),u.jsx("span",{className:"oc-tool-icon","aria-hidden":"true",children:u.jsx(xE,{})}),u.jsx("span",{className:"oc-tool-name",children:r.toolName}),p&&u.jsx("span",{className:"oc-tool-args",children:p}),g!==void 0&&u.jsxs("span",{className:"oc-tool-duration",children:[g,"s"]}),u.jsx("span",{className:`oc-tool-status ${h}`,children:d})]}),i&&u.jsxs("div",{className:"oc-tool-body",children:[r.args!==void 0&&u.jsxs("div",{className:"oc-tool-section",children:[u.jsx("div",{className:"oc-tool-label",children:v.argsLabel}),u.jsx("pre",{className:"oc-tool-code",children:v0(r.args)})]}),(r.resultText!==void 0||r.result!==void 0)&&u.jsxs("div",{className:"oc-tool-section",children:[u.jsx("div",{className:"oc-tool-label",children:r.status==="error"?"错误":v.resultLabel}),u.jsx("pre",{className:"oc-tool-code",children:k.text}),k.truncated&&!o&&u.jsx("button",{type:"button",className:"btn btn-ghost oc-tool-expand-result",onClick:()=>c(!0),children:"展开全部"})]}),r.status==="running"&&r.resultText===void 0&&r.result===void 0&&r.args===void 0&&u.jsx("div",{className:"oc-tool-section",children:u.jsx("div",{className:"oc-tool-waiting",children:"等待结果…"})})]})]})}function IE(e){const{thinking:r,defaultOpen:i}=e,[s,o]=S.useState(i);return S.useEffect(()=>{o(i)},[i]),u.jsxs("div",{className:"oc-thinking",children:[u.jsxs("button",{type:"button",className:`oc-thinking-summary${s?" is-open":""}`,"aria-expanded":s,onClick:()=>o(c=>!c),children:[u.jsx(Pd,{}),u.jsx("span",{children:"思考"})]}),s?u.jsx("pre",{className:"oc-thinking-body",children:r||"…"}):null]})}function AE(e){return e.kind==="progress"?"••":e.kind==="success"?"✓":e.kind==="warning"?"!":"×"}function DE(e){const{activity:r,onActivate:i}=e,s=!!(r.activityRef&&i&&(e.canActivate?.(r.activityRef)??!0)),o=u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"oc-semantic-activity-icon","aria-hidden":"true",children:AE(r)}),u.jsxs("span",{className:"oc-semantic-activity-copy",children:[u.jsx("strong",{children:r.title}),r.detail?u.jsx("small",{children:r.detail}):null]}),s?u.jsx("span",{className:"oc-semantic-activity-link",children:"查看详情"}):null]});if(s&&r.activityRef&&i){const c=r.activityRef;return u.jsx("button",{type:"button",className:`oc-semantic-activity is-${r.kind}`,"data-activity-ref":c,onClick:()=>i(c),children:o})}return u.jsx("div",{className:`oc-semantic-activity is-${r.kind}`,"data-activity-ref":r.activityRef,children:o})}function OE(e){const{items:r,defaultOpen:i}=e,[s,o]=S.useState(i),c=r.filter(p=>p.kind==="tool").map(p=>p.tool),d=r.filter(p=>p.kind==="activity"),h=NE(c,{thinkingCount:r.filter(p=>p.kind==="thinking").length,textCount:r.filter(p=>p.kind==="text").length,activityCount:d.length,activityErrorCount:d.filter(p=>p.activity.kind==="error").length,activityRunningCount:d.filter(p=>p.activity.kind==="progress").length});return S.useEffect(()=>{o(i)},[i]),u.jsxs("div",{className:"oc-process-inline",children:[u.jsxs("button",{type:"button",className:`oc-process-inline-summary${s?" is-open":""}${h.errorCount>0?" is-error":h.runningCount>0?" is-running":""}`,"aria-expanded":s,onClick:()=>o(p=>!p),children:[u.jsx(Pd,{}),u.jsx("span",{children:h.label})]}),s?u.jsx("div",{className:"oc-process-inline-body",children:r.map((p,g)=>p.kind==="thinking"?u.jsx(IE,{thinking:p.thinking,defaultOpen:i},`thinking-${g}`):p.kind==="text"?u.jsx("div",{className:"oc-process-text",children:p.text},`text-${g}`):p.kind==="activity"?u.jsx(DE,{activity:p.activity,onActivate:e.onActivateActivity,canActivate:e.canActivateActivity},p.activity.id):u.jsx(db,{entry:p.tool},p.tool.id))}):null]})}function ME(e){const{scrollContainerRef:r,messagesEndRef:i,onScroll:s,hasThread:o,readiness:c,streaming:d,streamingAssistantId:h,messagesCount:p,visibleCount:g,onLoadMore:v,turnGroups:y,interview:k}=e;return u.jsxs("div",{ref:r,className:`oc-messages${o?" has-thread":" is-empty"}`,onScroll:s,children:[o?null:u.jsx(nv,{mode:"empty-session",readiness:c,disabled:d,onSuggest:e.onSuggest}),o&&p>g&&u.jsx("button",{type:"button",className:"btn btn-ghost oc-load-history",onClick:v,children:"加载更早消息"}),o&&y.map((b,w)=>{const N=b.user??b.assistants[0],z=w>0?y[w-1].user??y[w-1].assistants[0]:void 0,R=!!N&&(!z||Oc(z.createdAt)!==Oc(N.createdAt)),A=b.answer,E=!!A?.text.trim(),F=b.live&&b.processItems.length===0;return u.jsxs("div",{className:"oc-turn-group",children:[R&&N&&u.jsx("div",{className:"oc-day-sep",children:Oc(N.createdAt)}),b.user&&u.jsx(sy,{message:b.user,streaming:d,activeAssistantId:h}),b.processItems.length>0&&u.jsx(OE,{items:b.processItems,defaultOpen:b.live,onActivateActivity:e.onActivateActivity,canActivateActivity:e.canActivateActivity}),A&&(E||F)?u.jsx(sy,{message:A,streaming:d,activeAssistantId:h}):null]},b.key)}),k&&u.jsx(Hk,{interview:k,interviewAnswer:e.interviewAnswer,onAnswerChange:e.onInterviewAnswerChange,onAnswer:e.onAnswerInterview,onConfirmTaskKind:e.onConfirmTaskKind}),u.jsx("div",{ref:i})]})}function Kn(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toLocaleString()}function _E(e){const r=[],i=e.inputTokens??0,s=e.outputTokens??0,o=e.cacheReadTokens??0,c=e.cacheWriteTokens??0,d=e.cost??0;if(i>0&&r.push(`${Kn(i)} in`),s>0&&r.push(`${Kn(s)} out`),o>0&&r.push(`${Kn(o)} cache R`),c>0&&r.push(`${Kn(c)} cache W`),d>0&&r.push(d>=.01?`$${d.toFixed(2)}`:"<$0.01"),r.length===0){const h=e.totalTokens??0;return h>0?`${Kn(h)} tokens`:"—"}return r.join(" · ")}const LE={auto:"auto(跟随 Pi 默认等级)",off:"off · 关闭",minimal:"minimal · 极简",low:"low · 低",medium:"medium · 中",high:"high · 高",xhigh:"xhigh · 极高",max:"max · 最高"};function zE(e,r){const i=r.trim().toLowerCase(),s=new Map;for(const o of e){if(i&&!o.provider.toLowerCase().includes(i)&&!o.id.toLowerCase().includes(i)&&!(o.name??"").toLowerCase().includes(i))continue;const c=s.get(o.provider)??[];c.push(o),s.set(o.provider,c)}return[...s.entries()].map(([o,c])=>({provider:o,models:c}))}function BE(e,r){const i=new Set,s=[],o=c=>{i.has(c)||(i.add(c),s.push({value:c,label:LE[c]??c,...c==="auto"&&r?{effective:r}:{}}))};o("auto");for(const c of e)o(c);return s}function Zl(e,r){return`${e}/${r}`}function yd(e){return{...e.modelProvider&&e.modelId?{model:{provider:e.modelProvider,modelId:e.modelId}}:{},...e.thinkingLevel?{thinkingLevel:e.thinkingLevel}:{}}}function fb(e,r){return{...e,model:r.model??e.model,thinkingLevel:r.thinkingLevel??e.thinkingLevel}}function HE(e,r){const i=fb(e,r);return i.model?.provider===e.model?.provider&&i.model?.modelId===e.model?.modelId&&i.thinkingLevel===e.thinkingLevel}function UE(){return u.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:u.jsx("path",{d:"M2.6 4.2 6 7.6l3.4-3.4",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function qE(e){const r=ha(),[i,s]=S.useState(!1),[o,c]=S.useState(""),[d,h]=S.useState(0),p=S.useRef(null),g=S.useRef(null),v=r.snapshot,y=r.status==="loading",k=r.status==="error"?r.error:null,b=v?(v.models??[]).map(A=>({provider:A.provider,id:A.id,...A.name?{name:A.name}:{},...A.hasCredentials!==void 0?{hasCredentials:A.hasCredentials}:{}})):e.models,w=S.useMemo(()=>zE(b,o),[b,o]),N=S.useMemo(()=>w.flatMap(A=>A.models),[w]);S.useEffect(()=>{i&&(c(""),h(0),window.setTimeout(()=>g.current?.focus(),0))},[i]),S.useEffect(()=>{if(!i)return;const A=F=>{const K=p.current;K&&F.target instanceof Node&&!K.contains(F.target)&&s(!1)},E=F=>{F.key==="Escape"&&s(!1)};return document.addEventListener("mousedown",A),document.addEventListener("keydown",E),()=>{document.removeEventListener("mousedown",A),document.removeEventListener("keydown",E)}},[i]);const z=A=>{if(e.disabled)return;const E=N[A];E&&(s(!1),e.onSelect(E.provider,E.id))},R=A=>{if(A.key==="ArrowDown"){A.preventDefault(),h(E=>N.length?(E+1)%N.length:0);return}if(A.key==="ArrowUp"){A.preventDefault(),h(E=>N.length?(E-1+N.length)%N.length:0);return}if(A.key==="Enter"){A.preventDefault(),z(d);return}if(A.key==="Escape"){A.preventDefault(),s(!1);return}};return u.jsxs("div",{className:"oc-select-menu oc-model-menu",ref:p,children:[u.jsxs("button",{type:"button",className:"oc-select-trigger","aria-haspopup":"listbox","aria-expanded":i,title:"选择模型",disabled:e.disabled,onClick:()=>s(A=>!A),children:[u.jsx("span",{className:"oc-select-trigger-label",children:e.triggerLabel}),u.jsx(UE,{})]}),i&&u.jsxs("div",{className:"oc-select-panel oc-model-panel",role:"listbox","aria-label":"选择模型",children:[u.jsx("input",{ref:g,className:"oc-select-search",placeholder:"搜索模型或 Provider…",value:o,onChange:A=>{c(A.target.value),h(0)},onKeyDown:R}),y&&u.jsx("div",{className:"oc-select-status",children:"模型列表加载中…"}),k&&u.jsxs("div",{className:"oc-select-status is-error",children:[u.jsxs("span",{children:[k.code?`${k.code}:`:"",k.message]}),u.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>{da()},children:"重试"})]}),!y&&!k&&w.length===0&&u.jsx("div",{className:"oc-select-status",children:"当前没有可用模型(真实空态,未伪造列表)"}),w.map(A=>u.jsxs("div",{className:"oc-model-group",children:[u.jsx("div",{className:"oc-model-group-head",children:A.provider}),A.models.map(E=>{const F=Zl(E.provider,E.id),K=F===e.activeModelRef,O=N[d]===E;return u.jsxs("button",{type:"button",role:"option","aria-selected":K,disabled:e.disabled,className:`oc-select-option oc-model-option${O?" is-highlighted":""}${K?" is-active":""}`,onMouseDown:P=>P.preventDefault(),onClick:()=>{e.disabled||(s(!1),e.onSelect(E.provider,E.id))},children:[u.jsxs("span",{className:"oc-model-option-name",children:[E.name?`${E.name} · `:"",E.id]}),K&&u.jsx("span",{className:"oc-model-option-check",children:"✓"})]},F)})]},A.provider))]})]})}function $E(){return u.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:u.jsx("path",{d:"M2.6 4.2 6 7.6l3.4-3.4",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function GE(e){const r=ha(),[i,s]=S.useState(!1),[o,c]=S.useState(0),d=S.useRef(null),h=e.effectiveLevel??r.snapshot?.selection?.effectiveThinkingLevel,p=r.snapshot?.thinkingLevels?.length?r.snapshot.thinkingLevels.map(k=>k.value):void 0,g=S.useMemo(()=>BE(p??e.levels,h),[p,e.levels,h]);S.useEffect(()=>{i&&c(0)},[i]),S.useEffect(()=>{if(!i)return;const k=w=>{const N=d.current;N&&w.target instanceof Node&&!N.contains(w.target)&&s(!1)},b=w=>{w.key==="Escape"&&s(!1)};return document.addEventListener("mousedown",k),document.addEventListener("keydown",b),()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",b)}},[i]);const v=k=>{if(e.disabled)return;const b=g[k];b&&(s(!1),e.onSelect(b.value))},y=k=>{if(k.key==="ArrowDown"){k.preventDefault(),c(b=>g.length?(b+1)%g.length:0);return}if(k.key==="ArrowUp"){k.preventDefault(),c(b=>g.length?(b-1+g.length)%g.length:0);return}if(k.key==="Enter"){k.preventDefault(),v(o);return}if(k.key==="Escape"){k.preventDefault(),s(!1);return}};return u.jsxs("div",{className:"oc-select-menu oc-thinking-menu",ref:d,children:[u.jsxs("button",{type:"button",className:"oc-select-trigger","aria-haspopup":"listbox","aria-expanded":i,title:"思考等级",disabled:e.disabled,onClick:()=>s(k=>!k),children:[u.jsx("span",{className:"oc-select-trigger-label",children:e.triggerLabel}),u.jsx($E,{})]}),i&&u.jsx("div",{className:"oc-select-panel oc-thinking-panel",role:"listbox","aria-label":"思考等级",onKeyDown:y,children:g.map((k,b)=>{const w=k.value===e.activeValue,N=b===o;return u.jsxs("button",{type:"button",role:"option","aria-selected":w,disabled:e.disabled,className:`oc-select-option oc-thinking-option${N?" is-highlighted":""}${w?" is-active":""}`,onMouseDown:z=>z.preventDefault(),onClick:()=>{e.disabled||(s(!1),e.onSelect(k.value))},children:[u.jsx("span",{className:"oc-thinking-option-label",children:k.label}),k.value==="auto"&&k.effective?u.jsxs("span",{className:"oc-thinking-badge",children:["Pi 实际:",k.effective]}):null,w&&u.jsx("span",{className:"oc-model-option-check",children:"✓"})]},k.value)})})]})}const Wc="--oc-shortcut-palette-available-height",FE=8,PE=8;function VE(e){const r=e.viewportTop??0,i=e.topInset??FE,s=e.anchorGap??PE;if([e.boundaryTop,e.anchorTop,r,i,s].some(d=>!Number.isFinite(d)))return null;const c=Math.max(e.boundaryTop,r);return Math.max(0,Math.floor(e.anchorTop-c-i-s))}function YE(){return u.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[u.jsx("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"}),u.jsx("circle",{cx:"8.5",cy:"10",r:"1.5"}),u.jsx("path",{d:"m21 16-5.5-5.5L9 17"})]})}function KE(e){const{composer:r,streaming:i,hasThread:s}=e,o=S.useRef(null),c=ha(),d=c.reloading,h=c.reloadError,g=c.mutationBusy||d||i,v=S.useCallback(()=>{r.setInput(""),r.setShortcutOpen(!1),ca()},[r.setInput,r.setShortcutOpen]),y=S.useCallback(R=>{const A=r.isComposingNow()||R.nativeEvent.isComposing,E=r.recentlyComposedNow();if(R.key==="Enter"&&!R.shiftKey&&!A&&!E){if(r.shortcutOpen&&r.filteredShortcuts.length>0){if((r.filteredShortcuts[r.shortcutIndex]??r.filteredShortcuts[0])?.command==="/reload"){R.preventDefault(),v();return}}else if(r.input.trim()==="/reload"){R.preventDefault(),v();return}}e.onKeyDown(R)},[r.isComposingNow,r.recentlyComposedNow,r.shortcutOpen,r.filteredShortcuts,r.shortcutIndex,r.input,v,e.onKeyDown]),k=S.useCallback((R,A)=>{if(A==="pi-prompt"||R==="/name"||R==="/compact"){r.setInput(`${R} `),r.setShortcutOpen(!1),r.textareaRef.current?.focus();return}if(R==="/reload"){v();return}e.onRunShortcut(R)},[v,e.onRunShortcut,r]),b=S.useCallback(()=>{if(r.input.trim()==="/reload"){v();return}e.onSend(r.input)},[r.input,v,e.onSend]);S.useEffect(()=>{if(!r.shortcutOpen||r.filteredShortcuts.length===0||!e.paletteKeyboardNavRef.current)return;const R=e.shortcutPaletteRef.current;if(!R)return;R.querySelector(`[data-shortcut-index="${r.shortcutIndex}"]`)?.scrollIntoView({block:"nearest",inline:"nearest"}),e.paletteKeyboardNavRef.current=!1},[r.shortcutOpen,r.filteredShortcuts,r.shortcutIndex,e.shortcutPaletteRef,e.paletteKeyboardNavRef]),S.useEffect(()=>{if(!r.shortcutOpen||r.filteredShortcuts.length===0)return;const R=o.current,A=e.shortcutPaletteRef.current,E=R?.closest(".oc-main")??null;if(!R||!A||!E)return;let F=0;const K=()=>{F=0;const Y=E.getBoundingClientRect(),le=R.getBoundingClientRect(),_=VE({boundaryTop:Y.top,anchorTop:le.top,viewportTop:window.visualViewport?.offsetTop??0});if(_===null){A.style.removeProperty(Wc);return}A.style.setProperty(Wc,`${_}px`)},O=()=>{F!==0&&window.cancelAnimationFrame(F),F=window.requestAnimationFrame(K)};K();const P=typeof ResizeObserver>"u"?null:new ResizeObserver(O);return P?.observe(E),P?.observe(R),window.addEventListener("resize",O),window.visualViewport?.addEventListener("resize",O),window.visualViewport?.addEventListener("scroll",O),()=>{F!==0&&window.cancelAnimationFrame(F),P?.disconnect(),window.removeEventListener("resize",O),window.visualViewport?.removeEventListener("resize",O),window.visualViewport?.removeEventListener("scroll",O),A.style.removeProperty(Wc)}},[r.shortcutOpen,r.filteredShortcuts.length,e.layoutMode,e.shortcutPaletteRef]);const w=(()=>{const R=e.processSummary;return R?R.statusKind==="error"?`查看工具调用记录,共 ${R.count} 次,其中 ${R.statusLabel}`:R.statusKind==="running"?`查看工具调用记录,共 ${R.count} 次,${R.statusLabel||"正在运行"}`:`查看工具调用记录,共 ${R.count} 次,全部已完成`:"查看工具调用记录"})(),N=(()=>{const R=e.usage.inputTokens,A=e.usage.outputTokens,E=e.usage.cacheReadTokens,F=e.usage.cacheWriteTokens,K=e.usage.cost??0,O=[];if(R>0&&O.push(u.jsxs("span",{className:"oc-usage-part is-in",title:"输入 tokens",children:["↑ ",Kn(R)]},"in")),A>0&&O.push(u.jsxs("span",{className:"oc-usage-part is-out",title:"输出 tokens",children:["↓ ",Kn(A)]},"out")),E>0&&O.push(u.jsxs("span",{className:"oc-usage-part",children:[Kn(E)," cache R"]},"cache-read")),F>0&&O.push(u.jsxs("span",{className:"oc-usage-part",children:[Kn(F)," cache W"]},"cache-write")),K>0&&O.push(u.jsx("span",{className:"oc-usage-part",children:K>=.01?`$${K.toFixed(2)}`:"<$0.01"},"cost")),O.length===0){const P=e.usage.totalTokens;P>0&&O.push(u.jsxs("span",{className:"oc-usage-part",children:[Kn(P)," tokens"]},"total"))}return O})(),z=u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"oc-runtime-controls-group",children:[u.jsx(qE,{models:e.models,activeModelRef:e.activeModelRef,triggerLabel:e.activeModelRef||"选择模型",disabled:g,onSelect:(R,A)=>e.onSwitchRuntime({provider:R,modelId:A})}),u.jsx(GE,{levels:e.thinkingLevels,activeValue:e.activeThinkingLevel||"auto",triggerLabel:e.activeThinkingLevel||"auto",disabled:g,onSelect:R=>e.onSwitchRuntime({thinkingLevel:R})}),u.jsxs("span",{className:"oc-usage",title:_E(e.usage),children:[u.jsx("span",{className:"oc-usage-state",children:i?"运行中":"空闲"}),e.unread>0?u.jsxs("span",{className:"oc-usage-unread",children:[e.unread," 未读"]}):null,N]}),e.processSummary&&u.jsxs("button",{type:"button",ref:e.processTriggerRef,className:`oc-process-summary is-${e.processSummary.statusKind}${e.processOpen?" is-open":""}`,"aria-expanded":e.processOpen,"aria-controls":"oc-process-panel","aria-label":w,title:w,onClick:e.onToggleProcess,children:[u.jsx("span",{className:"oc-process-summary-label",children:"调用记录"}),u.jsx("span",{className:"oc-process-summary-badge",children:e.processSummary.count}),e.processSummary.statusKind!=="ok"&&e.processSummary.statusLabel?u.jsx("span",{className:"oc-process-summary-status",children:e.processSummary.statusLabel}):null]})]}),u.jsxs("div",{className:"oc-runtime-controls-group is-right",children:[u.jsx("button",{type:"button",className:"btn btn-ghost",onClick:e.onCompact,disabled:i||!s,title:s?i?"生成中,暂不可压缩":"压缩上下文,释放 token":"先进行对话后再压缩上下文","aria-label":s?i?"生成中,暂不可压缩":"压缩上下文,释放 token":"先进行对话后再压缩上下文",children:"压缩"}),e.runtimeContext?u.jsx("button",{type:"button",ref:e.runtimeContextTriggerRef,className:`btn btn-ghost oc-runtime-context-toggle${e.runtimeContextOpen?" is-active":""}`,"aria-expanded":e.runtimeContextOpen,"aria-controls":"oc-runtime-context-panel",onClick:e.onToggleRuntimeContext,children:"注入上下文"}):null]})]});return u.jsx("div",{className:"oc-composer",children:u.jsxs("div",{className:"oc-composer-inner",ref:o,children:[r.fileOptions.length>0&&u.jsx("div",{className:"oc-file-palette",role:"listbox","aria-label":"Repository files",children:r.fileOptions.map(R=>u.jsx("button",{type:"button",role:"option",onMouseDown:A=>A.preventDefault(),onClick:()=>r.insertFileReference(R),children:u.jsxs("code",{children:["@",R]})},R))}),r.pendingImages.length>0&&u.jsx("div",{className:"oc-attachment-list",children:r.pendingImages.map(R=>u.jsxs("span",{children:[R.name,u.jsx("button",{type:"button","aria-label":`移除 ${R.name}`,onClick:()=>r.removeImage(R),children:"×"})]},R.name))}),u.jsxs("div",{className:"oc-composer-toolbar",children:[u.jsxs("label",{className:"oc-attach-button oc-attach-icon",title:"添加图片","aria-label":"添加图片",children:[u.jsx(YE,{}),u.jsx("span",{className:"sr-only",children:"添加图片"}),u.jsx("input",{type:"file",accept:"image/png,image/jpeg,image/gif,image/webp",multiple:!0,hidden:!0,onChange:R=>{r.addImagesFromFiles(Array.from(R.target.files??[]).slice(0,4)),R.target.value=""}})]}),u.jsxs("span",{className:"oc-composer-hint",children:[u.jsx("span",{className:"oc-kbd",children:"Enter"})," 发送"]}),u.jsxs("span",{className:"oc-composer-hint",children:[u.jsx("span",{className:"oc-kbd",children:"Shift"}),"+",u.jsx("span",{className:"oc-kbd",children:"Enter"})," 换行"]}),d&&u.jsx("span",{className:"oc-reload-status",children:"正在重新加载会话…"})]}),r.shortcutOpen&&r.filteredShortcuts.length>0&&u.jsxs("div",{className:"oc-shortcut-palette",id:"oc-shortcut-palette",ref:e.shortcutPaletteRef,role:"listbox","aria-label":"命令","aria-busy":r.dynamicCommandsLoading||void 0,"data-layout-mode":e.layoutMode,children:[u.jsxs("div",{className:"oc-shortcut-palette-head",children:[u.jsxs("strong",{children:["命令 · ",r.filteredShortcuts.length]}),r.dynamicCommandsLoading?u.jsx("span",{className:"oc-shortcut-palette-meta",children:"正在加载扩展、提示词与技能…"}):null,r.dynamicCommandsError?u.jsxs("span",{className:"oc-shortcut-palette-meta is-error",children:[r.dynamicCommandsError,u.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>r.retryDynamicCommands(),children:"重试"})]}):null]}),u.jsx("div",{className:"oc-shortcut-palette-body",children:e.paletteModel.map(R=>u.jsxs("div",{className:"oc-shortcut-group",children:[u.jsxs("small",{children:[R.label," · ",R.items.length]}),R.items.map(({entry:A,globalIndex:E})=>u.jsxs("button",{type:"button",role:"option",id:`oc-shortcut-option-${E}`,"aria-label":A.command,"aria-describedby":`oc-shortcut-option-desc-${E}`,"aria-selected":E===r.shortcutIndex,className:E===r.shortcutIndex?"is-active":"","data-shortcut-index":E,title:A.command,onMouseEnter:()=>r.setShortcutIndex(E),onMouseDown:F=>F.preventDefault(),onClick:F=>{F.currentTarget.scrollIntoView({block:"nearest"}),k(A.command,A.action)},children:[u.jsx("code",{children:A.command}),u.jsx("small",{id:`oc-shortcut-option-desc-${E}`,children:A.description})]},`${A.source}:${A.command}`))]},R.source))})," "]}),u.jsxs("div",{className:`oc-composer-shell${i?" is-busy":""}`,children:[u.jsx("textarea",{ref:r.textareaRef,className:"oc-textarea",value:r.input,rows:3,placeholder:i?"正在生成回复…(停止后可发送下一轮)":s?"输入消息… Enter 发送 · Shift+Enter 换行":"描述目标,或点选上方建议开始…",onChange:R=>r.handleInputChange(R.target.value),onKeyDown:y,onCompositionStart:r.onCompositionStart,onCompositionEnd:r.onCompositionEnd,disabled:i,"aria-expanded":r.shortcutOpen,"aria-controls":r.shortcutOpen?"oc-shortcut-palette":void 0,"aria-activedescendant":r.shortcutOpen&&r.filteredShortcuts.length>0?`oc-shortcut-option-${r.shortcutIndex}`:void 0}),i?u.jsx("button",{type:"button",className:"oc-stop",title:"停止生成","aria-label":"停止生成",onClick:e.onStop,children:u.jsx(bE,{})}):u.jsx("button",{type:"button",className:"oc-send",title:"发送","aria-label":"发送",onClick:b,disabled:!r.input.trim()&&r.pendingImages.length===0||d,children:u.jsx(vE,{})})]}),h&&u.jsxs("div",{className:"oc-reload-banner is-error",role:"alert",children:[u.jsxs("span",{children:[h.code?`${h.code}:`:"",h.message]}),u.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>{ca()},children:"重试"})]}),u.jsx("div",{className:"oc-runtime-controls",children:z})]})})}function XE(e){const{toolCalls:r,onClose:i,overlay:s=!1}=e,o=S.useRef(null);return lo({open:s,containerRef:o,triggerRef:e.triggerRef,onEscape:i}),u.jsxs("aside",{ref:o,id:"oc-process-panel",className:`oc-process${s?" is-process-overlay":""}`,"aria-label":"工具调用记录",role:s?"dialog":void 0,"aria-modal":s?!0:void 0,tabIndex:-1,children:[u.jsxs("header",{className:"oc-process-head",children:[u.jsxs("div",{className:"oc-process-title",children:[u.jsx("span",{className:"oc-process-title-mark","aria-hidden":"true"}),"工具调用记录",u.jsxs("span",{className:"oc-process-count",children:[r.length," 次"]})]}),u.jsx("button",{type:"button",className:"btn btn-ghost oc-process-close","aria-label":"关闭工具调用记录",onClick:i,children:"关闭"})]}),u.jsx("div",{className:"oc-process-timeline",children:r.length===0?u.jsx("div",{className:"oc-process-empty",children:"本轮对话尚无工具调用。诊断细节会在这里按时间线展示。"}):r.map((c,d)=>u.jsxs("div",{className:`oc-process-item${d===0?" is-first":""}${d===r.length-1?" is-last":""}${c.status==="error"?" is-error":""}${c.status==="running"?" is-running":""}`,children:[u.jsx("div",{className:"oc-process-rail","aria-hidden":"true",children:u.jsx("span",{className:"oc-process-dot"})}),u.jsx("div",{className:"oc-process-time",children:Iy(c.createdAt)}),u.jsx("div",{className:"oc-process-body",children:u.jsx(db,{entry:c})})]},c.id))})]})}const uy=[{id:"overview",label:"概览"},{id:"system",label:"System prompt"},{id:"files",label:"Context files"},{id:"skills",label:"Skills"},{id:"extensions",label:"Extensions"},{id:"packages",label:"Packages"},{id:"tools",label:"Active tools"},{id:"raw",label:"原始 JSON"}];function Hl(e){const r=Array.isArray(e.items)?e.items:void 0;return u.jsxs("section",{className:"oc-runtime-context-section",children:[u.jsxs("header",{className:"oc-runtime-context-section-head",children:[u.jsx("strong",{children:e.title}),u.jsx("span",{className:"oc-runtime-context-meta",children:r?`${r.length} 项`:"未投影"})]}),r===void 0?u.jsx("p",{className:"oc-runtime-context-empty",children:"该 session 未提供资源投影"}):r.length===0?u.jsx("p",{className:"oc-runtime-context-empty",children:e.emptyText}):u.jsx("ul",{className:"oc-runtime-context-resources",children:r.map((i,s)=>u.jsx(QE,{item:i},`${i.name??i.path??s}:${s}`))})]})}function QE(e){const r=e.item,s=[r.scope?`scope ${r.scope}`:"",r.source??"",r.version?`v${r.version}`:"",r.cwd?`cwd ${r.cwd}`:""].filter(Boolean).join(" · "),o=r.path?`${r.path}${r.baseDir?`(base: ${r.baseDir})`:""}`:"";return u.jsxs("li",{children:[u.jsxs("div",{className:"oc-runtime-context-resource-head",children:[u.jsx("strong",{className:"oc-runtime-context-resource-name",title:r.path??r.name,children:r.name||r.path||"未命名资源"}),r.enabled===!1?u.jsx("span",{className:"oc-runtime-context-resource-flag",children:"未启用"}):null,s?u.jsx("span",{className:"oc-runtime-context-meta",title:s,children:s}):null]}),r.description?u.jsx("span",{className:"oc-runtime-context-resource-desc",children:r.description}):null,r.path?u.jsx("code",{className:"oc-runtime-context-resource-path",title:o,children:o}):null,r.error?u.jsxs("span",{className:"oc-runtime-context-diag is-error",children:[u.jsx("span",{className:"oc-runtime-context-diag-icon","aria-hidden":"true",children:"✕"}),r.error]}):null,Array.isArray(r.diagnostics)&&r.diagnostics.length>0?u.jsxs("span",{className:"oc-runtime-context-diag",children:[u.jsx("span",{className:"oc-runtime-context-diag-icon","aria-hidden":"true",children:"⚠"}),r.diagnostics.join(";")]}):null,Array.isArray(r.resolved)&&r.resolved.length>0?u.jsxs("details",{className:"oc-runtime-context-resolved",children:[u.jsxs("summary",{children:["已解析 ",r.resolved.length," 项"]}),u.jsx("ul",{className:"oc-runtime-context-resolved-list",children:r.resolved.map((c,d)=>{const h=`${c.type??"?"}:${c.name??c.path??"?"}`;return u.jsx("li",{children:u.jsx("code",{title:h,children:h})},d)})})]}):null]})}const ZE=S.forwardRef(function({open:r,onToggle:i,onClose:s,context:o,panelOnly:c=!1,triggerOnly:d=!1,triggerRef:h},p){const g=ha(),v=g.reloading,y=g.reloadError,[k,b]=S.useState("overview"),w=S.useRef(null);lo({open:r&&!d,containerRef:w,triggerRef:h,onEscape:s}),S.useEffect(()=>{r||b("overview")},[r]);const N=Array.isArray(o.resources.activeTools)?o.resources.activeTools:[],z=typeof o.resources.activeToolCount=="number"?o.resources.activeToolCount:N.length,R=o.systemPrompt.text??o.systemPrompt.summary??"",A=o.systemPrompt.charCount??R.length,E=o.suffix.present?o.suffix.text??o.suffix.summary??"":"",F=o.model?Zl(o.model.provider,o.model.modelId):"",K=o.resources,O=String(o.resources.mode??"closed"),P=O.includes("open")?"open":"closed",Y={files:K.contextFiles?.length??0,skills:K.skills?.length??0,extensions:K.extensions?.length??0,packages:K.packages?.length??0},le=["files","skills","extensions","packages"].map(G=>({id:G,label:uy.find(ne=>ne.id===G)?.label??G,count:Y[G]??0})),_=u.jsx("button",{type:"button",ref:G=>{typeof p=="function"?p(G):p&&(p.current=G)},className:`btn btn-ghost oc-runtime-context-toggle${r?" is-active":""}`,"aria-expanded":r,"aria-controls":"oc-runtime-context-panel",onClick:i,children:"注入上下文"});if(d)return _;const V=r?u.jsxs("div",{ref:w,id:"oc-runtime-context-panel",className:"oc-runtime-context-sidepanel",role:"dialog","aria-modal":"true","aria-label":"注入上下文",tabIndex:-1,children:[u.jsxs("header",{className:"oc-runtime-context-head",children:[u.jsxs("div",{className:"oc-runtime-context-head-copy",children:[u.jsx("strong",{children:"注入上下文"}),u.jsx("span",{className:"oc-runtime-context-meta",children:"只读 · 本轮实际注入的 system prompt / 资源(已脱敏)"})]}),u.jsx("button",{type:"button",className:"btn btn-ghost oc-runtime-context-close","aria-label":"关闭注入上下文",onClick:s,children:"关闭"})]}),u.jsxs("div",{className:"oc-runtime-context-layout",children:[u.jsx("nav",{className:"oc-runtime-context-nav","aria-label":"上下文分类",children:uy.map(G=>{const ne=Y[G.id];return u.jsxs("button",{type:"button",className:`oc-runtime-context-nav-item${k===G.id?" is-active":""}`,"aria-current":k===G.id?"page":void 0,onClick:()=>b(G.id),children:[u.jsx("span",{className:"oc-runtime-context-nav-label",title:G.label,children:G.label}),typeof ne=="number"?u.jsx("span",{className:"oc-runtime-context-nav-count",children:ne}):null]},G.id)})}),u.jsxs("div",{className:"oc-runtime-context-body",children:[k==="overview"?u.jsxs("div",{className:"oc-runtime-context-overview",children:[o.model?u.jsxs("section",{className:"oc-runtime-context-model-card",children:[u.jsx("span",{className:"oc-runtime-context-model-label",children:"模型"}),u.jsx("code",{className:"oc-runtime-context-model-ref",title:F,children:F})]}):null,u.jsxs("div",{className:"oc-runtime-context-stat-grid",children:[u.jsxs("div",{className:"oc-runtime-context-stat",children:[u.jsx("span",{className:"oc-runtime-context-stat-label",children:"Prompt 字数"}),u.jsxs("strong",{className:"oc-runtime-context-stat-value",children:[A.toLocaleString()," 字"]})]}),u.jsxs("div",{className:"oc-runtime-context-stat",children:[u.jsx("span",{className:"oc-runtime-context-stat-label",children:"工具"}),u.jsx("strong",{className:"oc-runtime-context-stat-value",children:z})]}),u.jsxs("div",{className:"oc-runtime-context-stat",children:[u.jsx("span",{className:"oc-runtime-context-stat-label",children:"思考"}),u.jsx("strong",{className:"oc-runtime-context-stat-value",children:o.thinkingLevel??"—"})]}),u.jsxs("div",{className:"oc-runtime-context-stat",children:[u.jsx("span",{className:"oc-runtime-context-stat-label",children:"资源面"}),u.jsxs("strong",{className:`oc-runtime-context-stat-value oc-runtime-context-mode is-${P}`,title:O,children:[u.jsx("span",{className:"oc-runtime-context-mode-dot","aria-hidden":"true"}),O]})]})]}),u.jsxs("section",{className:"oc-runtime-context-section",children:[u.jsx("header",{className:"oc-runtime-context-section-head",children:u.jsx("strong",{children:"已加载资源"})}),u.jsx("div",{className:"oc-runtime-context-resource-links",children:le.map(G=>u.jsxs("button",{type:"button",className:"oc-runtime-context-resource-link",onClick:()=>b(G.id),children:[u.jsx("span",{className:"oc-runtime-context-resource-label",children:G.label}),u.jsx("span",{className:`oc-runtime-context-resource-count${G.count===0?" is-zero":""}`,children:G.count}),u.jsx("span",{className:"oc-runtime-context-resource-chevron","aria-hidden":"true",children:"›"})]},G.id))})]})]}):null,k==="system"?u.jsxs(u.Fragment,{children:[u.jsxs("section",{className:"oc-runtime-context-section",children:[u.jsxs("header",{className:"oc-runtime-context-section-head",children:[u.jsxs("div",{children:[u.jsx("strong",{children:"System prompt"}),u.jsxs("code",{className:"oc-runtime-context-hash",children:[o.systemPrompt.hash.slice(0,12),"…"]})]}),R?u.jsx(gd,{text:R}):null]}),u.jsx("pre",{className:"oc-runtime-context-text",children:R||"(空)"})]}),u.jsxs("section",{className:"oc-runtime-context-section",children:[u.jsxs("header",{className:"oc-runtime-context-section-head",children:[u.jsxs("div",{className:"oc-runtime-context-section-title",children:[u.jsx("strong",{children:"Session suffix"}),u.jsx("span",{className:"oc-runtime-context-meta",children:o.suffix.present?`${(o.suffix.charCount??0).toLocaleString()} 字`:"未注入"})]}),E?u.jsx(gd,{text:E}):null]}),o.suffix.present?u.jsx("pre",{className:"oc-runtime-context-text",children:E||"已注入"}):u.jsx("p",{className:"oc-runtime-context-empty",children:"本会话无额外 suffix"})]})]}):null,k==="files"?u.jsx(Hl,{title:"Context files",items:K.contextFiles?.map(G=>({name:G.path,description:`${G.characters.toLocaleString()} 字符`})),emptyText:"该 session 未加载任何上下文文件"}):null,k==="skills"?u.jsx(Hl,{title:"Skills",items:K.skills,emptyText:"该 session 未加载任何 Skills"}):null,k==="extensions"?u.jsx(Hl,{title:"Extensions",items:K.extensions,emptyText:"该 session 未加载任何 Extensions"}):null,k==="packages"?u.jsx(Hl,{title:"Packages",items:K.packages,emptyText:"该 session 未配置 Packages"}):null,k==="tools"?u.jsxs("section",{className:"oc-runtime-context-section",children:[u.jsxs("header",{className:"oc-runtime-context-section-head",children:[u.jsx("strong",{children:"Active tools"}),u.jsxs("span",{className:"oc-runtime-context-meta",children:[z," 项"]})]}),N.length===0?u.jsx("p",{className:"oc-runtime-context-empty",children:"无激活工具"}):u.jsx("ul",{className:"oc-runtime-context-tools",children:N.map(G=>u.jsx("li",{children:u.jsx("code",{children:G})},G))}),Array.isArray(K.diagnostics)&&K.diagnostics.length>0?u.jsx("ul",{className:"oc-runtime-context-resources",children:K.diagnostics.map((G,ne)=>u.jsxs("li",{children:[u.jsxs("span",{className:`oc-runtime-context-diag is-${G.type??"warning"}`,children:[G.type,": ",G.message]}),G.path?u.jsx("code",{children:G.path}):null]},ne))}):null]}):null,k==="raw"?u.jsxs("details",{className:"oc-runtime-context-raw",open:!0,children:[u.jsx("summary",{children:"原始投影 JSON"}),u.jsx("pre",{children:JSON.stringify(o,null,2)})]}):null]},k)]}),u.jsxs("footer",{className:"oc-runtime-context-foot",children:[u.jsx("span",{className:"oc-runtime-context-meta",children:v?"正在重新加载会话…":"重新加载 Pi 会话设置、扩展、技能、提示词与上下文文件"}),u.jsx("button",{type:"button",className:"btn btn-ghost",disabled:v,onClick:()=>{ca()},children:"重新加载会话"}),y&&u.jsxs("span",{className:"oc-runtime-context-diag is-error",role:"alert",children:[y.code?`${y.code}:`:"",y.message,u.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>{ca()},children:"重试"})]})]})]}):null;return c?V:u.jsxs("div",{className:"oc-runtime-context-menu",children:[_,V]})});function JE(){const e=S.useRef(null),r=S.useRef(!1),i=S.useRef(null),s=S.useRef(new Map),o=S.useRef(new Set),c=S.useRef(null),d=S.useRef(null),h=S.useRef(0),p=S.useRef(null),g=S.useRef(new Set),v=S.useRef(new Set),y=S.useRef(new Map),k=S.useRef(new Set),b=S.useRef(null),w=S.useRef(null),N=S.useRef(!1),z=S.useRef(0),R=S.useRef(null),A=S.useRef(!1),E=S.useRef(!1),F=S.useRef(null),K=S.useRef(new Set),O=S.useRef(new Set),P=S.useRef(new Set),Y=S.useRef(!1),le=S.useRef(0);return S.useMemo(()=>({sessionRef:e,streamingRef:r,abortRef:i,sessionAbortControllersRef:s,inlineStreamSessionIdsRef:o,assistantIdRef:c,lastEventIdRef:d,sessionGenerationRef:h,eventsStreamStateRef:p,settledTurnIdsRef:g,seenEventIdsRef:v,turnAssistantIdsRef:y,sealedAssistantIdsRef:k,reconnectAbortRef:b,activeTurnIdRef:w,submitInFlightRef:N,submitGenerationRef:z,pendingSubmissionRef:R,stopInFlightRef:A,stopRequestedRef:E,stoppingTurnIdRef:F,abortPostedTurnIdsRef:K,releasedClientRequestIdsRef:O,usageResponseKeysRef:P,isComposingRef:Y,compositionEndedAtRef:le}),[e,r,i,s,o,c,d,h,p,g,v,y,k,b,w,N,z,R,A,E,F,K,O,P,Y,le])}const WE=["operation","contract","dag","report","html"];function eN(e){const r=e.artifact;if(!r||typeof r!="object")return;const i=r;if(!(i.schemaVersion!==1||typeof i.artifactId!="string"||!i.artifactId||typeof i.kind!="string"||!WE.includes(i.kind)||typeof i.previewHash!="string")){for(const s of["title","summary","htmlPreview","reportText","inspectHref"])if(i[s]!==void 0&&typeof i[s]!="string")return;return i}}function tN(e,r){const i=e.findIndex(s=>s.artifactId===r.artifactId);return i<0?[...e,r]:e.map((s,o)=>o===i?{...s,...r,eventSeq:s.eventSeq??r.eventSeq,activityRef:s.activityRef??r.activityRef}:s)}function nN(e){if(!e||typeof e!="object")return;const r=e;if(!(r.schemaVersion!==1||typeof r.cardId!="string"||r.gateType!=="contract-apply"&&r.gateType!=="dag-run"||typeof r.taskId!="string"||typeof r.state!="string"||typeof r.expiresAt!="string"||typeof r.inspectHref!="string"||typeof r.previewHash!="string"))return r}function rN(e,r){const i=e.findIndex(c=>c.cardId===r.cardId);if(i<0)return[...e,r];const s=[...e],o=s[i];return o?(s[i]={...o,...r,eventSeq:o.eventSeq??r.eventSeq,activityRef:o.activityRef??r.activityRef},s):[...e,r]}function iN(e,r){const i=e.findIndex(s=>s.operationId===r.operationId);return i<0?[...e,r]:e.map((s,o)=>{if(o!==i)return s;let c=s.eventSeq;return c===void 0?c=r.eventSeq:r.eventSeq!==void 0&&(c=Math.min(c,r.eventSeq)),{...s,...r,...c===void 0?{}:{eventSeq:c},updatedSeq:Math.max(s.updatedSeq??s.eventSeq??0,r.updatedSeq??r.eventSeq??0),toolCallId:s.toolCallId??r.toolCallId,activityRef:s.activityRef??r.activityRef}})}function aN(e){const r=e.operation;if(!r||typeof r!="object")return;const i=r;if(i.schemaVersion!==1||typeof i.operationId!="string"||typeof i.action!="string"||typeof i.state!="string"||typeof i.inspectHref!="string"||typeof i.createdAt!="string"||typeof i.updatedAt!="string"||typeof i.previewHash!="string")return;const s=sN(i.runSummary),{runSummary:o,...c}=i;return{...c,...s?{runSummary:s}:{}}}function sN(e){if(!e||typeof e!="object"||Array.isArray(e))return;const r=e;if(typeof r.runId!="string"||!r.runId||typeof r.status!="string"||!r.status)return;let i=[];Array.isArray(r.nodes)&&(i=r.nodes.flatMap(c=>{if(!c||typeof c!="object")return[];const d=String(c.id??""),h=String(c.status??"");return!d||!h?[]:[{id:d,status:h}]}).slice(0,20));let s;if(r.next&&typeof r.next=="object"){const c=r.next;s={kind:String(c.kind??""),...typeof c.description=="string"?{description:c.description}:{}}}return{runId:r.runId,status:r.status,nodes:i,...typeof r.verdict=="string"?{verdict:r.verdict}:{},...typeof r.failureCategory=="string"?{failureCategory:r.failureCategory}:{},...s&&s.kind?{next:s}:{}}}function lN(e){const{refs:r,onReconcile:i,setError:s,setInterview:o,setHumanGateCards:c,setArtifactCards:d,setStreaming:h,setStreamingAssistantId:p,setUnread:g,setOperationCards:v,setUsage:y,setMessages:k,setToolCalls:b}=e;return(w,N,z,R)=>{if(R?.generation!==void 0&&r.sessionGenerationRef.current!==R.generation)return;const A=R?.replay===!0;if(w==="stream_ready")return;if(w==="reconcile"){const le={reason:typeof N.reason=="string"?N.reason:"cursor_expired",...typeof N.minSeq=="number"?{minSeq:N.minSeq}:{},...typeof N.epoch=="string"?{epoch:N.epoch}:{},...typeof N.latestTurnId=="string"?{latestTurnId:N.latestTurnId}:{}};(typeof N.latestEventId=="string"||N.latestEventId===null)&&(le.latestEventId=N.latestEventId),i?.(le);return}const E=N.data&&typeof N.data=="object"?N.data:N,F=typeof N.turnId=="string"?N.turnId:void 0,K=typeof N.seq=="number"&&Number.isFinite(N.seq)?N.seq:void 0,O=typeof N.at=="string"&&Number.isFinite(Date.parse(N.at))?Date.parse(N.at):Date.now();if(F&&(w==="agent_start"||w==="message_update")&&r.settledTurnIdsRef.current.has(F))return;let P=z;if(F){const Y=r.turnAssistantIdsRef.current.get(F);Y?P=Y:r.turnAssistantIdsRef.current.set(F,z)}if(w==="interview-turn"){o(Y=>({...Y??{},interviewSessionId:typeof E.interviewSessionId=="string"?E.interviewSessionId:Y?.interviewSessionId,taskId:typeof E.taskId=="string"?E.taskId:Y?.taskId,state:typeof E.state=="string"?E.state:Y?.state,question:E.question&&typeof E.question=="object"?E.question:void 0}));return}if(w==="draft"){o(Y=>({...Y??{},taskId:typeof E.taskId=="string"?E.taskId:Y?.taskId,draft:E.draft&&typeof E.draft=="object"?E.draft:Y?.draft,draftSha256:typeof E.draftSha256=="string"?E.draftSha256:Y?.draftSha256,taskKindRecommendation:typeof E.taskKindRecommendation=="string"?E.taskKindRecommendation:Y?.taskKindRecommendation}));return}if(w==="assessment"){o(Y=>({...Y??{},assessment:E}));return}if(w==="taskKind-confirmed"){o(Y=>({...Y??{},confirmedTaskKind:typeof E.taskKind=="string"?E.taskKind:Y?.confirmedTaskKind,taskKindRecommendation:void 0}));return}if(w==="human-gate-card"){const Y=nN(E);Y&&c(le=>rN(le,{...Y,...K===void 0?{}:{eventSeq:K},...F?{turnId:F}:{},activityRef:`gate:${Y.cardId}`}));return}if(w==="artifact-ref"){const Y=eN(E);Y&&d(le=>tN(le,{...Y,...K===void 0?{}:{eventSeq:K},...F?{turnId:F}:{},activityRef:`artifact:${Y.artifactId}`}));return}if(w==="agent_start"){if(A&&F!==void 0&&F!==r.activeTurnIdRef.current)return;F&&(r.settledTurnIdsRef.current.delete(F),r.activeTurnIdRef.current=F),r.streamingRef.current=!0,h(!0),p(P);return}if(w==="agent_settled"||w==="agent_end"){if(F&&r.settledTurnIdsRef.current.add(F),w==="agent_end")return;F===r.activeTurnIdRef.current&&(r.activeTurnIdRef.current=null),r.streamingRef.current=!1,h(!1),p(null),w==="agent_settled"&&!A&&typeof document<"u"&&document.hidden&&g(Y=>Y+1),k(Y=>Y.filter(le=>!(le.id===P&&le.role==="assistant"&&!le.text.trim()))),b(Y=>Y.map(le=>le.status==="running"&&le.assistantMessageId===P?{...le,status:"error",finishedAt:Date.now()}:le));return}if(w==="operation-ref"||w==="operation-status"){const Y=aN(E);if(Y){const le=typeof E.toolCallId=="string"?E.toolCallId:void 0;v(_=>iN(_,{...Y,...K===void 0?{}:{eventSeq:K,updatedSeq:K},...F?{turnId:F}:{},...le?{toolCallId:le}:{},activityRef:`operation:${Y.operationId}`}))}return}if(w==="usage"){if(A)return;const Y=E,le=typeof Y.responseKey=="string"&&Y.responseKey?Y.responseKey:void 0;if(le&&r.usageResponseKeysRef.current.has(le))return;le&&r.usageResponseKeysRef.current.add(le),y(_=>{const V=Y.inputTokens??0,G=Y.outputTokens??0,ne=Y.cacheReadTokens??0,q=Y.cacheWriteTokens??0,M=Y.totalTokens??V+G+ne+q;return{inputTokens:_.inputTokens+V,outputTokens:_.outputTokens+G,cacheReadTokens:_.cacheReadTokens+ne,cacheWriteTokens:_.cacheWriteTokens+q,totalTokens:_.totalTokens+M,cost:Y.cost===void 0?_.cost:(_.cost??0)+Y.cost}});return}if(w==="message_update"||w==="message_end"){if(A)return;const Y=r.sealedAssistantIdsRef.current;if(w==="message_update"&&Y.has(P)){const G=pi("a");F&&r.turnAssistantIdsRef.current.set(F,G),P=G,p(G)}const le=typeof E.text=="string"?E.text:"",_=mo(E.content),V=P;k(G=>G.some(q=>q.id===V)?G.map(q=>q.id!==V?q:{...q,text:le,..._?{content:_}:{}}):[...G,{id:V,role:"assistant",text:le,createdAt:O,..._?{content:_}:{}}]),w==="message_end"&&Y.add(V)}else if(w==="tool_call"){const Y=typeof E.toolCallId=="string"?E.toolCallId:pi("t"),le=typeof E.toolName=="string"?E.toolName:"tool",_=typeof E.argsPreview=="string"?E.argsPreview:"{}";b(V=>V.some(G=>G.id===Y)?V.map(G=>G.id!==Y?G:{...G,args:_,status:"running",turnId:F??G.turnId,assistantMessageId:P,...K===void 0?{}:{eventSeq:K}}):[...V,{id:Y,toolName:le,args:_,status:"running",createdAt:O,...K===void 0?{}:{eventSeq:K},turnId:F,assistantMessageId:P}])}else if(w==="tool_result"){const Y=typeof E.toolCallId=="string"?E.toolCallId:pi("r"),le=typeof E.toolName=="string"?E.toolName:"tool",_=E.isError===!0,V=typeof E.resultPreview=="string"?E.resultPreview:"{}";b(G=>G.find(q=>q.id===Y)?G.map(q=>q.id!==Y?q:{...q,result:V,resultText:V,status:_?"error":"ok",finishedAt:O,...K===void 0?{}:{finishedSeq:K},turnId:F??q.turnId,assistantMessageId:q.assistantMessageId??P}):[...G,{id:Y,toolName:le,result:V,resultText:V,status:_?"error":"ok",createdAt:O,finishedAt:O,...K===void 0?{}:{eventSeq:K,finishedSeq:K},turnId:F,assistantMessageId:P}])}else w==="error"&&s(typeof E.message=="string"?E.message:"chat error")}}const ed={inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheWriteTokens:0,totalTokens:0};function oN(e){const{origin:r,refs:i,sessionId:s,setError:o,onReconcile:c}=e,[d,h]=S.useState([]),[p,g]=S.useState([]),[v,y]=S.useState([]),[k,b]=S.useState([]),[w,N]=S.useState(50),[z,R]=S.useState(0),[A,E]=S.useState([]),[F,K]=S.useState(null),[O,P]=S.useState(null),[Y,le]=S.useState(!1),[_,V]=S.useState(ed),[G,ne]=S.useState(!1),[q,M]=S.useState(null),[D]=S.useState(!1),H=S.useMemo(()=>lN({refs:i,onReconcile:c,setError:o,setInterview:K,setHumanGateCards:E,setArtifactCards:b,setStreaming:ne,setStreamingAssistantId:M,setUnread:R,setOperationCards:y,setUsage:V,setMessages:h,setToolCalls:g}),[i,c,o]),B=S.useCallback((Q,ue,me)=>{if(me?.targetSessionId&&i.sessionRef.current?.sessionId!==me.targetSessionId||me?.generation!==void 0&&i.sessionGenerationRef.current!==me.generation)return null;const ge=Q.split(`
|
|
43
|
+
`);let fe="message",Se="",Me=null;for(const ct of ge)ct.startsWith("event: ")?fe=ct.slice(7).trim():ct.startsWith("data: ")?Se+=ct.slice(6):ct.startsWith("id: ")&&(Me=ct.slice(4).trim());if(!Se)return Me;let et;try{et=JSON.parse(Se)}catch{return Me}const Ue=Me??(typeof et.eventId=="string"?et.eventId:null);if(Ue){if(i.seenEventIdsRef.current.has(Ue))return Ue;i.seenEventIdsRef.current.add(Ue)}return H(fe,et,ue,me),Me??Ue},[H,i]),te=S.useCallback(async(Q,ue)=>{const me=ue?.background===!0;me||le(!0);try{const ge=await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(Q)}/context`,{credentials:"include"});if(!ge.ok)return;const fe=await ge.json();fe.context&&i.sessionRef.current?.sessionId===Q&&P(Se=>S0(Se,fe.context)?Se:fe.context)}finally{me||le(!1)}},[r,i]);S.useEffect(()=>{s&&te(s)},[s,te]),S.useEffect(()=>{if(!s)return;const Q=window.setTimeout(()=>{te(s,{background:!0})},350);return()=>window.clearTimeout(Q)},[s,v,A,F,te]);const T=S.useMemo(()=>d.filter(Q=>Q.role!=="system"||D).slice(-w),[d,D,w]);S.useEffect(()=>{const Q=()=>{document.hidden||R(0)};return document.addEventListener("visibilitychange",Q),()=>document.removeEventListener("visibilitychange",Q)},[]);const I=S.useMemo(()=>{if(p.length===0)return null;const Q=p.filter(Se=>Se.status==="running"),ue=p.filter(Se=>Se.status==="error"),me=Q[Q.length-1];let ge="完成",fe="ok";return ue.length>0?(ge=`${ue.length} 次出错`,fe="error"):Q.length>0?(ge=me?`${me.toolName} 运行中`:"运行中",fe="running"):ge="",{count:p.length,statusLabel:ge,statusKind:fe}},[p]),U=S.useMemo(()=>EE({messages:T,toolCalls:p,streaming:G,activeAssistantId:q}),[T,p,G,q]),C=S.useCallback(()=>{h([]),g([]),y([]),E([]),b([]),K(null),P(null),V(ed),ne(!1),M(null),R(0),N(50),i.usageResponseKeysRef.current=new Set},[i]),ae=S.useCallback(Q=>{h(Q.messages),g(Q.toolCalls),y([]),E([]),b([]),P(null),K(null),V(ed),i.usageResponseKeysRef.current=new Set,ne(Q.streaming),M(null),R(0),N(50)},[i]),W=S.useCallback(async Q=>{try{const ue=await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(Q)}`,{credentials:"include"});if(!ue.ok)return!1;const me=await ue.json();if(!me.session||i.sessionRef.current?.sessionId!==Q)return!1;const ge=me.session.activeTurnId??null;return i.activeTurnIdRef.current=ge,i.streamingRef.current=!!ge,i.lastEventIdRef.current=me.lastEventId??null,i.seenEventIdsRef.current=new Set,i.turnAssistantIdsRef.current=new Map,i.sealedAssistantIdsRef.current=new Set,h((me.session.messages??[]).filter(fe=>fe.role==="user"||fe.role==="assistant").map(fe=>{const Se=mo(fe.content);return{id:fe.id,role:fe.role,text:fe.text,createdAt:Date.parse(fe.at)||Date.now(),...Se&&Se.length>0?{content:Se}:{}}})),M(null),!0}catch{return!1}},[r,i,h,M]);return{messages:d,setMessages:h,toolCalls:p,setToolCalls:g,operationCards:v,artifactCards:k,historyLimit:w,setHistoryLimit:N,unread:z,humanGateCards:A,interview:F,setInterview:K,taskContext:O,contextLoading:Y,usage:_,streaming:G,setStreaming:ne,streamingAssistantId:q,setStreamingAssistantId:M,visibleMessages:T,turnGroups:U,processSummary:I,applyChatSseEvent:H,applySseBlock:B,loadTaskContext:te,resetForNewSession:C,applyActivatedSession:ae,recoverSession:W}}class uN{constructor(r){this.options=r,this.fetchFn=r.fetchFn??fetch,this.backoffMs=r.backoffMs??1e3,this.deadlineMs=r.deadlineMs??3e4}options;eligible=new Set;controllers=new Map;fetchFn;backoffMs;deadlineMs;markEligible(r){this.eligible.add(r)}startIfEligible(r){if(!this.eligible.delete(r)||this.controllers.has(r))return;const i=new AbortController;this.controllers.set(r,i),this.run(r,i)}cancel(r){this.eligible.delete(r),this.controllers.get(r)?.abort(),this.controllers.delete(r)}reconcile(r){const i=new Set(r);for(const s of this.controllers.keys())i.has(s)||this.cancel(s)}dispose(){for(const r of this.controllers.values())r.abort();this.controllers.clear(),this.eligible.clear()}async run(r,i){let s;const o=new Set;let c=!1;const d=window.setTimeout(()=>{c=!0,i.abort()},this.deadlineMs);try{for(;!i.signal.aborted;){try{const h={Accept:"text/event-stream"};s&&(h["Last-Event-ID"]=s);const p=await this.fetchFn(`${this.options.origin}/api/operator/v1/chat/sessions/${encodeURIComponent(r)}/events`,{headers:h,credentials:"include",signal:i.signal});if(p.status===404||!p.body)return;if(!p.ok)throw new Error(`HTTP ${p.status}`);const g=p.body.getReader(),v=new TextDecoder;let y="";for(;;){const{done:k,value:b}=await g.read();if(k||i.signal.aborted)break;y+=v.decode(b,{stream:!0});const w=y.split(`
|
|
44
|
+
|
|
45
|
+
`);y=w.pop()??"";for(const N of w){const z=N.split(`
|
|
46
|
+
`).find(A=>A.startsWith("id: "))?.slice(4);if(z&&(s=z),!z||o.has(z)||!N.includes("event: session_title"))continue;const R=N.split(`
|
|
47
|
+
`).find(A=>A.startsWith("data: "))?.slice(6);if(R)try{const A=JSON.parse(R),E=A.data?.title?.trim();if(!E)continue;if(o.add(z),!this.options.hasSession(r)||(this.options.onTitle(r,{title:E,automatic:!!A.data?.automatic}),A.data?.automatic))return}catch{}}}}catch{if(i.signal.aborted)return}i.signal.aborted||await cN(this.backoffMs,i.signal)}}finally{window.clearTimeout(d),this.controllers.get(r)===i&&this.controllers.delete(r),(c||!this.options.hasSession(r))&&this.options.refresh()}}}function cN(e,r){return new Promise(i=>{const s=window.setTimeout(c,e),o=()=>c();function c(){window.clearTimeout(s),r.removeEventListener("abort",o),i()}r.addEventListener("abort",o,{once:!0})})}async function dN(e){if(e.creatingRef?.current)throw new Error("CREATE_SESSION_IN_FLIGHT");e.creatingRef&&(e.creatingRef.current=!0),e.setCreatingSession?.(!0);try{const r=await(e.fetchFn??fetch)(`${e.origin}/api/operator/v1/chat/sessions`,{method:"POST",headers:{"Content-Type":"application/json","x-loop-console-confirmation":un()},credentials:"include",body:JSON.stringify(e.options??{})});if(!r.ok){const d=await r.json().catch(()=>({}));throw new Error(d.error?.message??`HTTP ${r.status}`)}const i=await r.json();if(!i.session)throw new Error("创建会话响应缺少 durable session");const s=i.session,o={sessionId:s.sessionId,...yd(s)},c=[s,...e.sessionListRef.current.filter(d=>d.sessionId!==s.sessionId)].slice(0,Pl);return e.sessionListRef.current=c,e.setSessionList(c),e.titleWatcher?.markEligible(s.sessionId),e.refreshSessionList(),o}finally{e.creatingRef&&(e.creatingRef.current=!1),e.setCreatingSession?.(!1)}}function fN(e){const{origin:r,refs:i,setSession:s,thread:o,composer:c,browser:d,setError:h,setProcessOpen:p,setAutoScroll:g}=e,{applyActivatedSession:v,resetForNewSession:y,setMessages:k}=o,{setInput:b,setPendingImages:w}=c,{setPreviews:N,setActivePreviewPath:z}=d,[R,A]=S.useState([]),E=S.useRef([]);E.current=R;const F=S.useRef(null),[K,O]=S.useState(!1),P=S.useRef(!1),Y=S.useRef(0),le=S.useCallback(()=>{i.sessionGenerationRef.current+=1,i.abortRef.current?.abort(),i.reconnectAbortRef.current?.abort();for(const B of i.sessionAbortControllersRef.current.values())B.abort();i.sessionAbortControllersRef.current.clear(),i.reconnectAbortRef.current=null,i.eventsStreamStateRef.current=null,i.streamingRef.current=!1,i.abortRef.current=null,i.assistantIdRef.current=null,i.lastEventIdRef.current=null,i.seenEventIdsRef.current=new Set,i.turnAssistantIdsRef.current=new Map,i.sealedAssistantIdsRef.current=new Set,i.settledTurnIdsRef.current=new Set,i.activeTurnIdRef.current=null,y(),b(""),w([]),N([]),z(null),p(!1),g(!0)},[i,y,b,w,N,z,p,g]),_=S.useCallback(async()=>{try{const B=await fetch(`${r}/api/operator/v1/chat/sessions`,{credentials:"include"});if(!B.ok)return;const te=(await B.json()).sessions??[],T=te.slice(0,Pl),I=te.slice(Pl);if(A(T),I.length===0)return;await Promise.all(I.map(C=>fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(C.sessionId)}`,{method:"DELETE",credentials:"include",headers:{"x-loop-console-confirmation":un()}}).catch(()=>{})));const U=i.sessionRef.current?.sessionId;U&&I.some(C=>C.sessionId===U)&&(Y.current+=1,i.sessionRef.current=null,le(),s(null),window.localStorage.removeItem(Bn))}catch{}},[r,i,le,s]),V=S.useCallback(async B=>{try{return(await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(B)}`,{method:"DELETE",credentials:"include",headers:{"x-loop-console-confirmation":un()}})).ok?(F.current?.cancel(B),i.sessionRef.current?.sessionId===B&&(Y.current+=1,i.sessionRef.current=null,le(),s(null),window.localStorage.removeItem(Bn)),await _(),!0):(h("删除会话失败"),!1)}catch(te){return h(te instanceof Error?te.message:String(te)),!1}},[r,i,s,le,_,h]),G=S.useCallback(async B=>{const te=++Y.current;try{const T=await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(B)}`,{credentials:"include"}),I=await T.json();if(!T.ok||!I.session)throw new Error(I.error?.message??"会话不可用");if(te!==Y.current)return;const U={sessionId:I.session.sessionId,...yd(I.session)};le(),i.sessionRef.current=U,i.streamingRef.current=!!I.session.activeTurnId,i.activeTurnIdRef.current=I.session.activeTurnId??null,i.seenEventIdsRef.current=new Set,i.turnAssistantIdsRef.current=new Map,i.sealedAssistantIdsRef.current=new Set,i.settledTurnIdsRef.current=new Set,i.lastEventIdRef.current=null,s(U),i.assistantIdRef.current=null,i.abortRef.current=i.sessionAbortControllersRef.current.get(B)??null,w([]),N([]),b(I.session.composerDraft??"");const C=jE(I.session.messages??[]);v({messages:C.messages,toolCalls:C.toolCalls,streaming:!!I.session.activeTurnId}),window.localStorage.setItem(Bn,B),z(null)}catch(T){if(te!==Y.current)return;h(T instanceof Error?T.message:String(T))}},[r,i,s,w,N,b,v,le,z,h]);S.useEffect(()=>{_()},[_]),F.current||(F.current=new uN({origin:r,hasSession:B=>E.current.some(te=>te.sessionId===B),onTitle:(B,te)=>{A(T=>T.map(I=>I.sessionId!==B||te.automatic&&I.title?I:te.automatic?{...I,title:te.title}:{...I,displayTitle:te.title}))},refresh:_}));const ne=S.useCallback(B=>F.current?.startIfEligible(B),[]);S.useEffect(()=>{F.current?.reconcile(R.filter(B=>B.state!=="archived"&&!B.title).map(B=>B.sessionId))},[R]),S.useEffect(()=>()=>F.current?.dispose(),[]),S.useEffect(()=>{let B=!1;const te=window.localStorage.getItem(Bn);if(!te)return;const T=++Y.current;return(async()=>{try{const I=await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(te)}`,{credentials:"include"});if(!I.ok){window.localStorage.removeItem(Bn);return}const U=await I.json();if(B||T!==Y.current||!U.session)return;const C={sessionId:U.session.sessionId,...yd(U.session)};i.sessionGenerationRef.current+=1,i.sessionRef.current=C,i.activeTurnIdRef.current=U.session.activeTurnId??null,i.seenEventIdsRef.current=new Set,i.turnAssistantIdsRef.current=new Map,i.sealedAssistantIdsRef.current=new Set,i.settledTurnIdsRef.current=new Set,i.lastEventIdRef.current=null,s(C),b(U.session.composerDraft??""),k((U.session.messages??[]).filter(ae=>ae.role==="user"||ae.role==="assistant").map(ae=>{const W=mo(ae.content);return{id:ae.id,role:ae.role,text:ae.text,createdAt:Date.parse(ae.at)||Date.now(),...W&&W.length>0?{content:W}:{}}}))}catch{}})(),()=>{B=!0}},[r,i,s,b,k]);const q=S.useCallback(B=>dN({origin:r,sessionListRef:E,setSessionList:A,titleWatcher:F.current,refreshSessionList:_,options:B,setCreatingSession:O,creatingRef:P}),[r,_]),M=S.useCallback(async B=>{if(P.current)return null;const te=++Y.current;h(null);try{const T=await q(B);return te!==Y.current?null:(le(),i.sessionRef.current=T,window.localStorage.setItem(Bn,T.sessionId),s(T),T)}catch(T){if(te!==Y.current)return null;const I=T instanceof Error?T.message:String(T);return I!=="CREATE_SESSION_IN_FLIGHT"&&h(I),null}},[i,s,h,le,q]),D=S.useCallback(async B=>{const te=i.sessionRef.current;if(!te||i.streamingRef.current)return;const T=typeof B=="string"?B.trim():"";try{const I={"x-loop-console-confirmation":un()};T&&(I["content-type"]="application/json");const U=await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(te.sessionId)}/compact`,{method:"POST",credentials:"include",headers:I,...T?{body:JSON.stringify({instructions:T})}:{}}),C=await U.json().catch(()=>({}));if(!U.ok){h(C.error?.message??"上下文压缩失败");return}h(null)}catch(I){h(I instanceof Error?I.message:"上下文压缩失败")}},[r,i,h]);return{sessionList:R,creatingSession:K,activateSession:G,refreshSessionList:_,deleteSession:V,createSession:M,updateSession:async(B,te)=>{if(!(await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(B)}`,{method:"PATCH",credentials:"include",headers:{"content-type":"application/json","x-loop-console-confirmation":un()},body:JSON.stringify(te)})).ok){h("会话更新失败");return}await _(),te.state==="archived"&&F.current?.cancel(B),te.state==="archived"&&i.sessionRef.current?.sessionId===B&&(Y.current+=1,i.sessionRef.current=null,le(),s(null),window.localStorage.removeItem(Bn))},watchSessionTitle:ne,compactSession:D}}const gs={"worker-managed-rerun-unsupported":"这次运行由 Console/Worker 启动,不能只从某个节点续跑","workspace-drift":"工作区在上次运行后又改过文件,旧结果不能接着用","controller-drift":"控制器版本已变化,不能接到上次运行上继续","binding-drift":"任务契约或源文件已变化,不能只续跑旧计划","restart-subgraph-contains-unsafe-shell":"下游包含会执行命令的验证步骤,不能只重跑这一段","restart-subgraph-contains-writer":"下游包含会改代码的写入步骤,不能只重跑这一段","restart-subgraph-contains-decision-gate":"下游包含需要人工决策的门禁,不能只重跑这一段","dynamic-rerun-unsupported":"这次运行含动态展开节点,不支持从节点续跑","parent-lifecycle-ineligible":"当前运行状态不允许从节点续跑","convergence-rerun-unsupported":"收敛型运行不支持从节点续跑","evaluation-rerun-unsupported":"带评估的运行不支持从节点续跑","budget-rerun-unsupported":"硬预算运行不支持从节点续跑","workspace-checkpoint-missing":"缺少工作区快照,无法安全地只续跑一段","skill-snapshot-invalid":"技能快照缺失或损坏,不能接到上次运行上继续","unresolved-errors-outside-reset-closure":"选中节点之外还有未解决的失败,只重跑这一段不够","selected-node-missing":"找不到要续跑的起始节点","ambiguous-skipped-rewrite":"跳过的节点有多个上游失败,无法自动选定起点","skipped-without-upstream-error":"该节点被跳过且没有明确的上游失败","parent-facts-invalid":"上次运行的证据不完整或已损坏,不能只续跑一段",RUN_NOT_ACTIVE:"这次运行不在活动状态,不能协作中止",RUN_NOT_CONSOLE_OWNED:"此运行不由当前 Console 持有,暂不支持协作中止",RUNNER_IDENTITY_MISMATCH:"运行身份已变化,不能中止这份过期请求",INTERRUPT_ALREADY_PENDING:"已有一条中止请求等待结算",RUN_ALREADY_TERMINAL:"运行已经结束,没有可中止的活 runner",INTERRUPT_NEEDS_RECONCILE:"中止请求已登记但无法确认 runner 已处理,需要对账"};function hN(){return Object.keys(gs)}function $l(e){const r=e.trim().replace(/[.…]+$/,"");if(!r)return null;if(gs[r])return{code:r};const i=r.lastIndexOf(":");if(i>0){const s=r.slice(i+1),o=r.slice(0,i);if(gs[s])return{code:s,nodeId:o};const c=hN().find(d=>s.length>=3&&d.startsWith(s));if(c)return{code:c,nodeId:o}}return gs[r]?{code:r}:null}function mN(e){const r=[];for(const i of e.blockedReasons??[]){const s=$l(String(i));s&&r.push(s)}for(const i of e.blockingNodes??[]){const s=i.reasonCode?.trim();if(!s)continue;const o=$l(i.nodeId?`${i.nodeId}:${s}`:s);o&&r.push(o)}if(r.length===0&&e.fallbackMessage?.trim()){const i=e.fallbackMessage.trim().replace(/^从节点重跑不具备安全资格[::]?\s*/,"").replace(/[。..]+$/,"");for(const s of i.split(/[;;]/)){const o=$l(s);o&&r.push(o)}}return r}function pN(e){const r=new Map;for(const s of e){const o=r.get(s.code)??[];s.nodeId&&!o.includes(s.nodeId)&&o.push(s.nodeId),r.set(s.code,o)}const i=[];for(const[s,o]of r){const c=gs[s];c&&(o.length>0&&s.startsWith("restart-subgraph-contains-")?i.push(`${c}(${o.join("、")})`):i.push(c))}return i}function gN(e){return e.join("; ").includes("worker-managed-rerun-unsupported")||e.some(i=>$l(i)?.code==="worker-managed-rerun-unsupported")?"下一步:请点下方「重新排队 Worker Task」,从头完整执行。":"下一步:请改用「完整重跑任务」,从头完整执行。"}function hb(e){const r=e.fallbackMessage?.trim();if(r?.startsWith("无法从该节点续跑"))return r;const i=mN(e),s=pN(i),o=i.map(d=>d.code),c=gN(o.length>0?o:[r??""]);return s.length===0?["无法从该节点续跑。这次续跑不够安全(工作区、控制器或下游步骤不允许只重跑一段)。",c].join(`
|
|
48
|
+
`):["无法从该节点续跑,因为:",...s.map(d=>`• ${d}`),"",c].join(`
|
|
49
|
+
`)}function yN(e){const r=e.trim();if(!r)return null;if(r.startsWith("无法从该节点续跑"))return r;if(/从节点重跑不具备安全资格|worker-managed-rerun-unsupported|restart-subgraph-contains-|workspace-drift|controller-drift|binding-drift/.test(r))return hb({fallbackMessage:r});if(/action must be a mutation-gate target/i.test(r))return"这个操作不能再走确认门。Worker 启动的任务请直接点「重新排队 Worker Task」;独立运行请点「完整重跑任务」。";if(/cannot read dagReport run facts/i.test(r))return"读不到这次运行的失败报告,不能完整重跑。请先点「查看报告」或「Doctor 诊断」。";if(/dagRerunPlan run facts unavailable/i.test(r))return"读不到从节点续跑的资格结果,不能改走完整重跑。请先点「从节点重跑」查看资格,或先「查看报告」。";if(/node rerun plan is eligible/i.test(r))return"从节点续跑是安全的,请改用「从节点重跑」,不必完整重跑整单。";if(/does not support autonomous standaloneTaskRerun/i.test(r))return"当前失败不适合自动完整重跑。请先点「查看报告」,按建议操作。";if(/primaryRecovery requires a human decision/i.test(r))return"这次失败需要人工决策,不能自动重跑。请先点「查看报告」。";if(/is not bound to run/i.test(r))return"填写的任务 ID 与这次运行不匹配。请使用该运行绑定的原任务 ID。";if(/cannot read pool doctor/i.test(r))return"读不到任务队列状态,暂时不能重新排队。请稍后重试,或先跑 Doctor 诊断。";if(/not found in the pool doctor inventory/i.test(r))return"任务队列里找不到这个任务,不能重新排队。请确认 Task ID 来自 Worker 队列,而不是只填了 DAG 运行 ID。";if(/only Failed tasks are retry-eligible/i.test(r)){const i=r.match(/is ([A-Za-z_]+); only Failed/)?.[1];return i?`该任务当前是「${i}」,只有失败(Failed)的任务才能重新排队。`:"只有失败(Failed)的任务才能重新排队。请先确认任务已失败。"}return/featureId .+ does not match the pool task/i.test(r)?"Feature ID 与队列中的任务不一致。请改用队列里记录的 Feature ID,或留空后重试。":/RUN_NOT_CONSOLE_OWNED|不由当前 Console 持有/.test(r)?"此运行不由当前 Console 持有,暂不支持协作中止。请用 Doctor / 报告查看。":/RUNNER_IDENTITY_MISMATCH|运行身份已变化/.test(r)?"运行身份已变化,不能中止这份过期请求。请刷新后再试。":/INTERRUPT_ALREADY_PENDING|已有一条中止请求/.test(r)?"已有一条中止请求等待当前节点安全收敛。请稍候刷新,不要重复提交。":/RUN_ALREADY_TERMINAL|运行已经结束/.test(r)?"运行已经结束,没有可中止的活 runner。请改用报告或对账。":/INTERRUPT_NEEDS_RECONCILE|无法确认 runner 已处理/.test(r)?"中止请求已登记,但无法确认 runner 已处理。请用 Doctor 对账,不要当成已经中止。":/RUN_NOT_ACTIVE/.test(r)?"这次运行不在本机活动目录,或已经不是 running,不能协作中止。":null}function yr(e){const r=(e??"").trim();if(!r)return"操作失败";const i=yN(r);return i||(/controller identity changed|package fingerprint changed|entry binary sha256 changed/i.test(r)?"控制器版本已变更(Console 启动后代码被重新编译)。请重启 Console 后再试,一次会话中途不要升级/重建控制器。":/Pi session file missing or not openable|cannot reopen chat session .* no persisted Pi session file/i.test(r)?"该对话的 Pi 会话文件已丢失,无法恢复上下文。请新建对话继续(历史记录无法重开)。":/reopened Pi sessionId mismatch/i.test(r)?"重开对话失败:Pi 会话身份与记录不一致(常见于会话文件丢失后被误建)。请新建对话继续。":/base HEAD .+ != frozen baseCommit|exact-base|not a descendant of frozen baseCommit/i.test(r)?"主分支已相对夜间冻结的 baseCommit 前进,无法安全 fast-forward harvest。请人工核对后使用 Discard(必要时勾选强制),或改走日间合并流程。":/force-required|requires --force/i.test(r)?"该终态需要强制 Discard。请确认后勾选强制再试。":r)}function vN(e){let r;const i=new Promise(s=>{r=s});return{...e,outcomePromise:i,resolveOutcome:r}}function cy(e="network error while creating turn"){return{kind:"ambiguous",message:e}}function bN(e="无法确认 Turn 是否已创建,正在与服务端对账(不会重复提交新的请求 ID)"){return{kind:"ambiguous",message:e}}function dy(e){const{body:r,clientRequestId:i}=e,s=r.error?.code,o=r.error?.message??(e.httpOk?"turn was not accepted":`HTTP ${e.status}`);if(s==="TURN_ACTIVE"&&r.activeTurn?.turnId)return{kind:"adopt-active",activeTurn:r.activeTurn,message:"上一轮仍在运行,已重新连接;当前消息已保留。"};if(r.accepted===!0||e.httpOk&&r.turnId){const c=r.turn?.turnId??r.turnId;return c?{kind:"accepted",turnId:c,idempotent:r.idempotent===!0,turn:r.turn??{turnId:c,clientRequestId:i,state:r.state}}:{kind:"ambiguous",message:o}}return r.accepted===!1||s?{kind:"rejected",code:s,message:o}:{kind:"ambiguous",message:o}}function xN(e){const r=e.clientRequestId,i=e.state?.activeTurn,s=e.state?.latestTurn;return i?.clientRequestId===r&&i.turnId?{kind:"accepted",turnId:i.turnId,idempotent:!0,turn:i}:s?.clientRequestId===r&&s.turnId?{kind:"accepted",turnId:s.turnId,idempotent:!0,turn:s}:i?.turnId?{kind:"adopt-active",activeTurn:i,message:"上一轮仍在运行,已重新连接;当前消息已保留。"}:null}function SN(e){const r=e.clientRequestId,i=e.state?.activeTurn,s=e.state?.latestTurn,o=i?.state??e.state?.activeTurnState??void 0,c=s?.state??e.state?.latestTurnState??void 0;if(i?.clientRequestId===r&&i.turnId)return yi(o)?{action:"release-terminal",turnId:i.turnId,state:String(o)}:{action:"bind-active",turnId:i.turnId};if(s?.clientRequestId===r&&s.turnId){if(yi(c))return{action:"release-terminal",turnId:s.turnId,state:String(c)};if(!i?.turnId||i.clientRequestId===r)return{action:"bind-active",turnId:s.turnId}}return!Jl(e.state)&&!(!!i?.turnId&&i?.clientRequestId!==r)?{action:"release-not-accepted"}:{action:"hold"}}function Jl(e){if(e?.activeTurnId||e?.activeTurn?.turnId)return!0;const r=e?.runtime;return r?r.isStreaming===!0||r.isPromptRunning===!0||r.isCompacting===!0||r.isBashRunning===!0:!1}function yi(e){return e==="settled"||e==="aborted"||e==="failed"}function Wl(e){return e.pending.sessionId===e.sessionId&&e.pending.sessionGeneration===e.sessionGeneration&&e.pending.submitGeneration===e.submitGeneration}function kN(e,r){return`${e}/api/operator/v1/chat/sessions/${encodeURIComponent(r)}/turns`}function fy(e,r){return`${e}/api/operator/v1/chat/sessions/${encodeURIComponent(r)}/state`}function wN(e,r){return`${e}/api/operator/v1/chat/sessions/${encodeURIComponent(r)}/events`}function CN(e,r,i){return`${e}/api/operator/v1/chat/sessions/${encodeURIComponent(r)}/turns/${encodeURIComponent(i)}/abort`}function ga(e,r){const i=e.pendingSubmission;r&&i&&i.clientRequestId!==r||(e.submitInFlight=!1,(!r||i?.clientRequestId===r)&&(i?.clientRequestId?e.releasedClientRequestIds.add(i.clientRequestId):r&&e.releasedClientRequestIds.add(r),e.pendingSubmission=null),e.pendingSubmission||(e.stopRequested=!1))}function mb(e){e.stopRequested=!0}function eo(e){e.stopRequested=!1}function RN(e,r){return!(!r||e.abortPostedTurnIds.has(r))}function jN(e,r){r&&e.abortPostedTurnIds.add(r)}function to(e,r){return!e.stopRequested||!RN(e,r)?null:(jN(e,r),e.stoppingTurnId=r,e.activeTurnId=r,r)}function hy(e,r){const i=e.pendingSubmission;return i&&i.clientRequestId!==r.clientRequestId?!1:(r.turnId&&e.settledTurnIds.add(r.turnId),ga(e,r.clientRequestId),eo(e),r.markIdle!==!1&&(e.streaming=!1,e.activeTurnId=null,e.assistantId=null,e.stoppingTurnId=null),!0)}function TN(e,r){return Wl({pending:r.pending,sessionId:e.sessionId,sessionGeneration:e.sessionGeneration,submitGeneration:e.submitGeneration})?(r.pending.acceptedTurnId=r.turnId,e.activeTurnId=r.turnId,e.turnAssistantIds.set(r.turnId,r.assistantId),e.streaming=!0,e.submitInFlight=!1,r.pending.resolveOutcome({kind:"accepted",turnId:r.turnId}),r.ui?.setStreaming(!0),r.ui?.setStreamingAssistantId(r.assistantId),r.ui?.setPendingImages([]),r.ui?.watchSessionTitle?.(r.sessionId),!0):(r.pending.resolveOutcome({kind:"stale"}),!1)}function EN(e,r){r.pending.resolveOutcome({kind:"adopt-active",activeTurn:{turnId:r.activeTurnId},message:r.message}),ga(e,r.pending.clientRequestId),r.current&&(r.ui?.clearEmptyAssistant(r.assistantId),r.ui?.setInput(r.text),r.ui?.setPendingImages(r.images),e.activeTurnId=r.activeTurnId,e.assistantId=null,e.streaming=!0,r.ui?.setStreaming(!0),r.ui?.setStreamingAssistantId(null),r.notice.setError(null),r.notice.showNotice(r.message))}function NN(e,r){if(r.pending.resolveOutcome({kind:"rejected",message:r.message}),ga(e,r.pending.clientRequestId),!r.current)return;const i=r.ui?.formatError?r.ui.formatError(r.message):r.message;r.ui?.setError(i),e.streaming=!1,e.assistantId=null,r.ui?.setStreaming(!1),r.ui?.setStreamingAssistantId(null),r.ui?.clearEmptyAssistant(r.assistantId),r.ui?.setInput(r.text),r.ui?.setPendingImages(r.images)}function IN(e,r,i){const s=Wl({pending:i.pending,sessionId:e.sessionId,sessionGeneration:e.sessionGeneration,submitGeneration:e.submitGeneration});if(r.kind==="accepted"){if(TN(e,{turnId:r.turnId,assistantId:i.assistantId,pending:i.pending,sessionId:i.sessionId,ui:i.acceptedUi})){const c=to(e,r.turnId);c&&i.onAutoAbort?.(c)}return}if(r.kind==="adopt-active"){const o=s?to(e,r.activeTurn.turnId):null;EN(e,{activeTurnId:r.activeTurn.turnId,message:r.message,assistantId:i.assistantId,text:i.text,images:i.images,pending:i.pending,current:s,notice:i.notice,ui:i.adoptUi}),o&&i.onAutoAbort?.(o);return}if(r.kind==="rejected"){NN(e,{message:r.message,assistantId:i.assistantId,text:i.text,images:i.images,pending:i.pending,current:s,ui:i.rejectedUi}),eo(e);return}if(r.kind==="stale"){i.pending.resolveOutcome(r),ga(e,i.pending.clientRequestId),eo(e);return}i.pending.resolveOutcome(r)}function AN(e,r,i,s){const o=e.pendingSubmission;if(!o)return"held";if(r.action==="bind-active"){const d=!!o.acceptedTurnId;d||(o.acceptedTurnId=r.turnId,e.activeTurnId=r.turnId,e.turnAssistantIds.set(r.turnId,o.assistantId),e.streaming=!0,e.submitInFlight=!1);const h=to(e,r.turnId);return h&&s?.onAutoAbort?.(h),d?"held":"bound"}if(r.action==="release-terminal"||r.action==="release-not-accepted")return r.action==="release-terminal"&&e.settledTurnIds.add(r.turnId),ga(e,o.clientRequestId),eo(e),Jl(i)||(e.streaming=!1,e.activeTurnId=null,e.assistantId=null,e.stoppingTurnId=null,s?.markIdle?.()),"released";const c=i?.activeTurn?.turnId??i?.activeTurnId??null;return c&&(e.activeTurnId=c),"held"}const DN="正在停止…",ON="正在停止…",MN="停止请求未完成,正在与服务端对账…",_N="停止请求失败,正在与服务端对账…";function my(e){e.showNotice(DN)}function py(e){if(e.networkError)return{action:"keep-busy-notice",message:_N};const r=e.body.turn?.state;return e.body.accepted===!0&&yi(r)?{action:"terminal-idle",turnId:e.turnId}:e.body.error?.code==="TURN_ABORT_PENDING"?{action:"abort-pending-notice"}:e.body.error?.code==="CHAT_TURN_OWNER_LOST"||e.body.error?.code==="OWNER_LOST"?{action:"owner-lost-reconcile"}:e.httpOk?{action:"noop"}:{action:"keep-busy-notice",message:MN}}function td(e,r,i,s){const o=s?.sessionStillCurrent!==!1;if(r.action==="terminal-idle"){if(!o)return;e.settledTurnIds.add(r.turnId),e.streaming=!1,e.activeTurnId=null,e.assistantId=null,e.stoppingTurnId=null,s?.markIdle?.();return}if(r.action==="abort-pending-notice"){i.showNotice(ON);return}if(r.action==="owner-lost-reconcile"){if(!o)return;s?.runtimeBusy||(e.stoppingTurnId&&e.settledTurnIds.add(e.stoppingTurnId),e.streaming=!1,e.activeTurnId=null,e.assistantId=null,e.stoppingTurnId=null,s?.markIdle?.());return}if(r.action==="keep-busy-notice"){i.showNotice(r.message);return}}function gy(e,r){mb(e);const i=e.activeTurnId??e.pendingSubmission?.acceptedTurnId??null;if(i){const s=to(e,i);return s?(r.notice&&my(r.notice),r.postAbort(s),{abortedTurnId:s,stopRequested:!0}):{abortedTurnId:null,stopRequested:!0}}return r.notice&&my(r.notice),{abortedTurnId:null,stopRequested:!0}}function mr(e){return{submitInFlight:e.submitInFlightRef.current,pendingSubmission:e.pendingSubmissionRef.current,activeTurnId:e.activeTurnIdRef.current,streaming:e.streamingRef.current,assistantId:e.assistantIdRef.current,stoppingTurnId:e.stoppingTurnIdRef.current,settledTurnIds:e.settledTurnIdsRef.current,turnAssistantIds:e.turnAssistantIdsRef.current,sessionId:e.sessionRef.current?.sessionId??null,sessionGeneration:e.sessionGenerationRef.current,submitGeneration:e.submitGenerationRef.current,stopInFlight:e.stopInFlightRef.current,stopRequested:e.stopRequestedRef.current,abortPostedTurnIds:e.abortPostedTurnIdsRef.current,releasedClientRequestIds:e.releasedClientRequestIdsRef.current}}function Pn(e,r){e.submitInFlightRef.current=r.submitInFlight,e.pendingSubmissionRef.current=r.pendingSubmission,e.activeTurnIdRef.current=r.activeTurnId,e.streamingRef.current=r.streaming,e.assistantIdRef.current=r.assistantId,e.stoppingTurnIdRef.current=r.stoppingTurnId,e.submitGenerationRef.current=r.submitGeneration,e.stopInFlightRef.current=r.stopInFlight,e.stopRequestedRef.current=r.stopRequested}function LN(e){return e.split(`
|
|
50
|
+
`).find(r=>r.startsWith("event: "))?.slice(7).trim()??"message"}function zN(){return new Promise(e=>window.setTimeout(e,25))}function nd(e,r){r&&e(i=>i.filter(s=>!(s.id===r&&s.role==="assistant"&&!s.text.trim())))}function BN(e){const{origin:r,refs:i,session:s,thread:o,composer:c,setError:d,setAutoScroll:h,setNotice:p,recoveryVersion:g=0,watchSessionTitle:v}=e,{applySseBlock:y,setMessages:k,setStreaming:b,setStreamingAssistantId:w,streaming:N}=o,{setInput:z,setPendingImages:R}=c,A=S.useCallback(M=>{p&&p({id:Date.now(),message:M})},[p]),E=S.useCallback(M=>{const D=mr(i);ga(D,M),Pn(i,D)},[i]),F=S.useCallback((M,D,H)=>{i.sessionRef.current?.sessionId!==M||i.sessionGenerationRef.current!==D||(i.streamingRef.current=!1,i.activeTurnIdRef.current=null,i.assistantIdRef.current=null,i.stoppingTurnIdRef.current=null,b(!1),w(null),nd(k,H))},[i,b,w,k]),K=S.useCallback(async(M,D,H)=>{for(;!H.aborted;){const B=i.eventsStreamStateRef.current;if(!B||B.sessionId!==M||B.generation!==D)return;B.ready=!1;try{const te={Accept:"text/event-stream"},T=i.lastEventIdRef.current;T&&(te["Last-Event-ID"]=T);const I=await fetch(wN(r,M),{headers:te,credentials:"include",signal:H});if(!I.ok||!I.body){if(I.status===404)return;await Dc(2e3,H);continue}const U=I.body.getReader(),C=new TextDecoder;let ae="",W=!0;const Q=pi("a");for(;;){const{done:me,value:ge}=await U.read();if(me)break;ae+=C.decode(ge,{stream:!0});const fe=ae.split(`
|
|
51
|
+
|
|
52
|
+
`);ae=fe.pop()??"";for(const Se of fe){if(LN(Se)==="stream_ready"){const Ue=i.eventsStreamStateRef.current;Ue?.sessionId===M&&Ue.generation===D&&(Ue.ready=!0),W=!1;continue}const Me=i.assistantIdRef.current??Q,et=y(Se,Me,{replay:W,targetSessionId:M,generation:D});et&&(i.lastEventIdRef.current=et)}}const ue=i.eventsStreamStateRef.current;ue?.sessionId===M&&ue.generation===D&&(ue.ready=!1),await Dc(1e3,H)}catch{if(H.aborted)return;await Dc(2e3,H)}}},[r,i,y]),O=S.useCallback((M,D)=>{const H=i.eventsStreamStateRef.current;if(H?.sessionId===M&&H.generation===D&&i.reconnectAbortRef.current)return;i.reconnectAbortRef.current?.abort();const B=new AbortController;i.reconnectAbortRef.current=B,i.eventsStreamStateRef.current={sessionId:M,generation:D,ready:!1},K(M,D,B.signal)},[i,K]),P=S.useCallback(async(M,D)=>{O(M,D);const H=Date.now()+5e3;for(;Date.now()<H;){const B=i.eventsStreamStateRef.current;if(B?.sessionId===M&&B.generation===D&&B.ready)return;if(i.sessionRef.current?.sessionId!==M||i.sessionGenerationRef.current!==D)throw new Error("会话已切换");await zN()}throw new Error("事件连接未就绪,请检查 Console 连接后重试")},[i,O]),Y=S.useCallback(async M=>{try{const D=await fetch(fy(r,M),{credentials:"include"}),H=await D.json().catch(()=>({}));return D.ok?H.state??null:null}catch{return null}},[r]),le=S.useCallback(async M=>{try{const D=await fetch(kN(r,M.sessionId),{method:"POST",headers:{"Content-Type":"application/json","x-loop-console-confirmation":un()},credentials:"include",body:JSON.stringify({clientRequestId:M.clientRequestId,text:M.text.trim()||"请查看附件图片。",images:M.images.map(({type:B,mimeType:te,data:T})=>({type:B,mimeType:te,data:T}))})}),H=await D.json().catch(()=>({}));return{httpOk:D.ok,status:D.status,body:H}}catch{return{httpOk:!1,status:0,body:{},networkError:!0}}},[r]),_=S.useCallback(()=>({showNotice:A,setError:M=>d(M)}),[A,d]),V=S.useCallback(async(M,D,H)=>{i.stoppingTurnIdRef.current=H,i.streamingRef.current=!0,b(!0);try{const B=await fetch(CN(r,M,H),{method:"POST",headers:{"Content-Type":"application/json","x-loop-console-confirmation":un()},credentials:"include",body:"{}"}),te=await B.json().catch(()=>({}));if(i.sessionRef.current?.sessionId!==M||i.sessionGenerationRef.current!==D||i.stoppingTurnIdRef.current!==H)return;const T=py({httpOk:B.ok,turnId:H,body:te}),I=mr(i);if(I.stoppingTurnId=H,T.action==="owner-lost-reconcile"){const U=await Y(M),C=i.sessionRef.current?.sessionId===M&&i.sessionGenerationRef.current===D;td(I,T,_(),{sessionStillCurrent:C,runtimeBusy:Jl(U??void 0),markIdle:()=>F(M,D,i.assistantIdRef.current)}),Pn(i,I);return}td(I,T,_(),{sessionStillCurrent:!0,markIdle:()=>F(M,D,i.assistantIdRef.current)}),Pn(i,I)}catch{const B=mr(i);td(B,py({httpOk:!1,turnId:H,body:{},networkError:!0}),_()),Pn(i,B)}},[r,i,b,F,Y,_]),G=S.useCallback((M,D)=>{const H=mr(i);H.sessionId=i.sessionRef.current?.sessionId??null,H.sessionGeneration=i.sessionGenerationRef.current,H.submitGeneration=i.submitGenerationRef.current;const B=te=>{R(te)};IN(H,M,{assistantId:D.assistantId,text:D.text,images:D.images,pending:D.pending,sessionId:D.sessionId,notice:_(),acceptedUi:{setStreaming:b,setStreamingAssistantId:w,setPendingImages:B,watchSessionTitle:v},adoptUi:{clearEmptyAssistant:te=>nd(k,te),setInput:z,setPendingImages:B,setStreaming:b,setStreamingAssistantId:w},rejectedUi:{setError:d,setStreaming:b,setStreamingAssistantId:w,clearEmptyAssistant:te=>nd(k,te),setInput:z,setPendingImages:B,formatError:yr},onAutoAbort:te=>{V(D.sessionId,D.generation,te)}}),Pn(i,H)},[i,_,b,w,R,v,k,z,d,V]),ne=S.useCallback(async(M,D)=>{const H=i.sessionRef.current,B=i.sessionGenerationRef.current;if(!H||!M.trim()&&D.length===0||i.streamingRef.current||i.submitInFlightRef.current||i.pendingSubmissionRef.current)return;i.submitInFlightRef.current=!0;const te=++i.submitGenerationRef.current,T=pi("chat-submit"),I=pi("u"),U=pi("a"),C=M.trim(),ae=D.slice(),W=vN({clientRequestId:T,submitGeneration:te,sessionId:H.sessionId,sessionGeneration:B,text:C,images:ae,assistantId:U,userMessageId:I});i.pendingSubmissionRef.current=W;try{await P(H.sessionId,B)}catch(fe){i.sessionRef.current?.sessionId===H.sessionId&&i.sessionGenerationRef.current===B&&d(yr(fe instanceof Error?fe.message:String(fe))),E(T);return}if(i.sessionRef.current?.sessionId!==H.sessionId||i.sessionGenerationRef.current!==B){E(T);return}const Q={id:I,role:"user",text:C,createdAt:Date.now()};k(fe=>[...fe,Q,{id:U,role:"assistant",text:"",createdAt:Date.now()}]),z(""),h(!0),d(null),i.streamingRef.current=!0,i.assistantIdRef.current=U,b(!0),w(U);const ue={sessionId:H.sessionId,generation:B,submitGeneration:te,assistantId:U,text:C,images:ae,pending:W},me=await le({sessionId:H.sessionId,clientRequestId:T,text:C,images:ae});if(!Wl({pending:W,sessionId:i.sessionRef.current?.sessionId,sessionGeneration:i.sessionGenerationRef.current,submitGeneration:i.submitGenerationRef.current})){W.resolveOutcome({kind:"stale"}),E(T);return}let ge=me.networkError?cy():dy({httpOk:me.httpOk,status:me.status,body:me.body,clientRequestId:T});if(ge.kind==="ambiguous"){const fe=await Y(H.sessionId),Se=fe?xN({clientRequestId:T,state:fe}):null;if(Se)ge=Se;else{const Me=await le({sessionId:H.sessionId,clientRequestId:T,text:C,images:ae});if(!Wl({pending:W,sessionId:i.sessionRef.current?.sessionId,sessionGeneration:i.sessionGenerationRef.current,submitGeneration:i.submitGenerationRef.current})){W.resolveOutcome({kind:"stale"}),E(T);return}if(ge=Me.networkError?cy("无法确认 Turn 是否已创建,正在与服务端对账(不会重复提交新的请求 ID)"):dy({httpOk:Me.httpOk,status:Me.status,body:Me.body,clientRequestId:T}),ge.kind==="ambiguous"){const et=ge.message||"无法确认 Turn 是否已创建,正在与服务端对账(不会重复提交新的请求 ID)";ge=bN(et),A(et)}}}G(ge,ue)},[r,i,P,le,Y,G,E,A,k,z,h,d,b,w]),q=S.useCallback(async()=>{const M=i.sessionRef.current?.sessionId,D=i.sessionGenerationRef.current;if(!M)return;const H=mr(i),B=gy(H,{postAbort:()=>{},notice:_()});if(Pn(i,H),B.abortedTurnId){if(i.stopInFlightRef.current)return;i.stopInFlightRef.current=!0;try{await V(M,D,B.abortedTurnId)}finally{i.stopInFlightRef.current=!1}return}const te=i.pendingSubmissionRef.current;if(te&&!i.stopInFlightRef.current){i.stopInFlightRef.current=!0;try{const T=await te.outcomePromise;if(i.sessionRef.current?.sessionId!==M||i.sessionGenerationRef.current!==D)return;let I=null;if(T.kind==="accepted")I=T.turnId;else if(T.kind==="adopt-active")I=T.activeTurn.turnId;else{if(T.kind==="ambiguous")return;i.stopRequestedRef.current=!1;return}if(!I)return;const U=mr(i);mb(U);const C=gy(U,{postAbort:()=>{},notice:_()});Pn(i,U),C.abortedTurnId&&await V(M,D,C.abortedTurnId)}finally{i.stopInFlightRef.current=!1}}},[i,_,V]);return S.useEffect(()=>{const M=!!i.pendingSubmissionRef.current||i.submitInFlightRef.current||i.stopRequestedRef.current||!!i.activeTurnIdRef.current;if(!s||!N&&!M)return;const D=s.sessionId,H=i.sessionGenerationRef.current;let B=!1;const te=async()=>{try{const C=await fetch(fy(r,D),{credentials:"include"}),ae=await C.json().catch(()=>({}));if(B||!C.ok||i.sessionRef.current?.sessionId!==D||i.sessionGenerationRef.current!==H)return;const W=ae.state,Q=i.pendingSubmissionRef.current;if(Q){const Me=SN({clientRequestId:Q.clientRequestId,state:W}),et=mr(i),Ue=AN(et,Me,W,{markIdle:()=>F(D,H,i.assistantIdRef.current),onAutoAbort:ct=>{V(D,H,ct)}});if(Pn(i,et),Ue==="bound"){b(!0);return}if(Ue==="released"||!Q.acceptedTurnId&&!et.pendingSubmission?.acceptedTurnId)return}const ue=W?.activeTurn?.turnId??W?.activeTurnId??null;i.activeTurnIdRef.current=ue;const me=Jl(W),ge=i.pendingSubmissionRef.current;if(ge){const Me=W?.latestTurn?.clientRequestId===ge.clientRequestId&&yi(W?.latestTurn?.state),et=W?.activeTurn?.clientRequestId===ge.clientRequestId&&yi(W?.activeTurn?.state);if(Me||et){const Ue=et?W?.activeTurn?.turnId??null:W?.latestTurn?.turnId??ge.acceptedTurnId??null,ct=mr(i);hy(ct,{clientRequestId:ge.clientRequestId,turnId:Ue,markIdle:!me}),Pn(i,ct),me||F(D,H,i.assistantIdRef.current);return}}if(me)return;const fe=i.assistantIdRef.current;if(ue&&!(yi(W?.activeTurn?.state)||yi(W?.activeTurnState)))return;ue&&i.settledTurnIdsRef.current.add(ue);const Se=ge?.clientRequestId;if(Se){const Me=mr(i);hy(Me,{clientRequestId:Se,turnId:ue,markIdle:!0}),Pn(i,Me)}else E();F(D,H,fe)}catch{}},T=()=>{document.visibilityState==="visible"&&te()},I=()=>{te()},U=window.setInterval(()=>{te()},15e3);return document.addEventListener("visibilitychange",T),window.addEventListener("online",I),te(),()=>{B=!0,window.clearInterval(U),document.removeEventListener("visibilitychange",T),window.removeEventListener("online",I)}},[r,i,s,N,F,E,V]),S.useEffect(()=>{if(!s)return;const M=i.sessionGenerationRef.current;return O(s.sessionId,M),()=>{const D=i.eventsStreamStateRef.current;D?.sessionId===s.sessionId&&D.generation===M&&(i.reconnectAbortRef.current?.abort(),i.reconnectAbortRef.current=null,i.eventsStreamStateRef.current=null)}},[s,g,i,O]),{sendPrompt:ne,handleStop:q,openEventsStream:K}}function HN(e){const{origin:r,refs:i,thread:s,setError:o}=e,{interview:c,setInterview:d}=s,[h,p]=S.useState(""),g=S.useCallback(async()=>{const k=i.sessionRef.current;if(!k)return;const b=window.prompt("Task ID(例如 2026-07-26-my-task)")?.trim();if(!b)return;const w=await fetch(`${r}/api/operator/v1/chat/sessions/${k.sessionId}/interviews`,{method:"POST",headers:{"Content-Type":"application/json","x-loop-console-confirmation":un()},credentials:"include",body:JSON.stringify({taskId:b})}),N=await w.json();if(!w.ok){o(N.error?.message??`HTTP ${w.status}`);return}d({interviewSessionId:N.interview?.sessionId,taskId:b,state:N.interview?.state,question:N.question,draft:N.draft?.draft,draftSha256:N.draft?.draftSha256,assessment:N.assessment})},[r,i,d,o]),v=S.useCallback(async k=>{const b=i.sessionRef.current;if(!b||!c?.interviewSessionId||!c.question)return;const w=await fetch(`${r}/api/operator/v1/chat/sessions/${b.sessionId}/interviews/${c.interviewSessionId}/answers`,{method:"POST",headers:{"Content-Type":"application/json","x-loop-console-confirmation":un()},credentials:"include",body:JSON.stringify({questionId:c.question.id,response:k,...k==="override"?{text:h}:{}})}),N=await w.json();if(!w.ok){o(N.error?.message??`HTTP ${w.status}`);return}d(z=>({...z??{},state:N.interview?.state,question:N.question,draft:N.draft?.draft,draftSha256:N.draft?.draftSha256,assessment:N.assessment,taskKindRecommendation:N.taskKindRecommendation??z?.taskKindRecommendation})),p("")},[r,i,c,h,d,o]),y=S.useCallback(async()=>{const k=i.sessionRef.current;if(!k||!c?.interviewSessionId||!c.taskKindRecommendation)return;const b=await fetch(`${r}/api/operator/v1/chat/sessions/${k.sessionId}/interviews/${c.interviewSessionId}/task-kind/confirm`,{method:"POST",headers:{"Content-Type":"application/json","x-loop-console-confirmation":un()},credentials:"include",body:JSON.stringify({taskKind:c.taskKindRecommendation})}),w=await b.json();if(!b.ok){o(w.error?.message??`HTTP ${b.status}`);return}d(N=>({...N??{},confirmedTaskKind:N?.taskKindRecommendation,taskKindRecommendation:void 0,draft:w.draft?.draft,draftSha256:w.draft?.draftSha256,assessment:w.assessment}))},[r,i,c,d,o]);return{interviewAnswer:h,setInterviewAnswer:p,startInterview:g,answerInterview:v,confirmTaskKind:y}}function UN(e){const{origin:r,refs:i,sessionId:s,setError:o}=e,[c,d]=S.useState({}),[h,p]=S.useState(new Set),[g,v]=S.useState(null),[y,k]=S.useState([]),[b,w]=S.useState(null),[N,z]=S.useState(!1),R=S.useCallback(async(K="")=>{try{v(null);const O=await fetch(`${r}/api/operator/v1/chat/repo/tree?path=${encodeURIComponent(K)}`,{credentials:"include"}),P=await O.json();if(!O.ok)throw new Error(P.error?.message??"无法读取仓库目录");d(Y=>({...Y,[K]:P.data?.entries??[]}))}catch(O){v(O instanceof Error?O.message:String(O))}},[r]);S.useEffect(()=>{R()},[R]);const A=S.useCallback(async K=>{z(!0);try{const O=await fetch(`${r}/api/operator/v1/chat/repo/file?path=${encodeURIComponent(K)}`,{credentials:"include"}),P=await O.json();if(!O.ok||!P.data)throw new Error(P.error?.message??"无法预览文件");k(Y=>{const le=[...Y.filter(V=>V.path!==P.data.path),P.data],_=i.sessionRef.current?.sessionId;return _&&window.localStorage.setItem(`${Bn}.previews.${_}`,JSON.stringify(le.map(V=>V.path))),le}),w(P.data.path)}catch(O){o(O instanceof Error?O.message:String(O))}finally{z(!1)}},[r,i,o]);S.useEffect(()=>{if(!s)return;let K=[];try{const O=JSON.parse(window.localStorage.getItem(`${Bn}.previews.${s}`)??"[]");Array.isArray(O)&&(K=O.filter(P=>typeof P=="string").slice(0,10))}catch{}K.length&&Promise.all(K.map(async O=>{const P=await fetch(`${r}/api/operator/v1/chat/repo/file?path=${encodeURIComponent(O)}`,{credentials:"include"});if(P.ok)return(await P.json()).data})).then(O=>{if(i.sessionRef.current?.sessionId!==s)return;const P=O.filter(Y=>!!Y);k(P),w(P.at(-1)?.path??null)})},[r,s,i]);const E=S.useCallback(K=>{p(O=>{const P=new Set(O);return P.has(K)?P.delete(K):P.add(K),P}),c[K]||R(K)},[c,R]),F=S.useCallback(K=>{k(O=>{const P=O.filter(Y=>Y.path!==K);return s&&window.localStorage.setItem(`${Bn}.previews.${s}`,JSON.stringify(P.map(Y=>Y.path))),P}),w(O=>O===K?y.find(P=>P.path!==K)?.path??null:O)},[y,s]);return{tree:c,expandedDirs:h,treeError:g,previews:y,activePreviewPath:b,setActivePreviewPath:w,previewLoading:N,setPreviews:k,loadTree:R,openPreview:A,closePreview:F,toggleDir:E}}const qN=["operator","web","extension","prompt","skill"];function $N(e){const r=[];for(const i of qN){const s=[];for(let o=0;o<e.length;o+=1)e[o].source===i&&s.push({entry:e[o],globalIndex:o});s.length!==0&&r.push({source:i,label:tk[i],items:s})}return r}function GN(e,r){return!Number.isFinite(r)||r<=0||!Number.isFinite(e)||e<0?0:e>=r?r-1:e}function FN(e){return e==="comfortable"?3:e==="compact"?2:1}function yy(e,r,i,s){const o=r.findIndex(y=>y.items.some(k=>k.globalIndex===e));if(o<0)return e;const c=r[o],d=c.items.findIndex(y=>y.globalIndex===e);if(d<0)return e;const h=Math.floor(d/i),p=d%i;if(s==="left"||s==="right"){if(i<=1)return e;const k=d+(s==="left"?-1:1);return k<0||k>=c.items.length||Math.floor(k/i)!==h?e:c.items[k].globalIndex}const g=s==="up"?-1:1,v=d+g*i;if(v>=0&&v<c.items.length)return c.items[v].globalIndex;for(let y=o+g;y>=0&&y<r.length;y+=g){const k=r[y];if(k.items.length===0)continue;const b=Math.floor((k.items.length-1)/i)*i,w=s==="up"?b+p:p;return w>=k.items.length?e:k.items[w].globalIndex}return e}function PN(e,r,i){const s=(e.left+e.right)/2;let o=null;for(const c of r){if(c.globalIndex===e.globalIndex)continue;const d=i==="up"?e.top-c.bottom:c.top-e.bottom;if(d<0)continue;const h=(c.left+c.right)/2,p=Math.abs(h-s);(o===null||d<o.gap||d===o.gap&&p<o.dist||d===o.gap&&p===o.dist&&c.globalIndex<o.index)&&(o={gap:d,dist:p,index:c.globalIndex})}return o?.index??null}function VN(e){const{origin:r,sessionId:i,refs:s,setError:o}=e,[c,d]=S.useState(""),[h,p]=S.useState([]),[g,v]=S.useState([]),[y,k]=S.useState(!1),b=S.useCallback(C=>{if(typeof C=="function"){d(ae=>{const W=C(ae);return k(W.startsWith("/")),W});return}d(C),k(C.startsWith("/"))},[]),[w,N]=S.useState(0),[z,R]=S.useState([]),[A,E]=S.useState(!1),[F,K]=S.useState(null),[O,P]=S.useState(0),Y=S.useRef(null),le=S.useRef(i),_=S.useRef(0),V=S.useCallback(C=>{b(C),k(C.startsWith("/")),N(0)},[]);S.useLayoutEffect(()=>{le.current=i,_.current+=1,R([]),K(null),E(!1)},[i]);const G=S.useCallback(async()=>{if(!i){R([]),K(null),E(!1);return}const C=i,ae=_.current;le.current=C,E(!0),K(null);const W=()=>le.current===C&&_.current===ae;try{const Q=await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(C)}/commands`,{credentials:"include"});if(!W())return;if(!Q.ok){K("动态命令加载失败"),R([]);return}const ue=await Q.json().catch(()=>null),me=[];for(const fe of ue?.commands??[]){const Se=fe.source;if(Se!=="extension"&&Se!=="prompt"&&Se!=="skill")continue;const Me=String(fe.command??fe.name??"").trim();Me&&me.push({command:Me.startsWith("/")?Me:`/${Me}`,label:String(fe.label??fe.name??Me),description:String(fe.description??""),source:Se})}if(!W())return;R(me);const ge=typeof ue?.warning=="string"?ue.warning.trim():"";K(ge?ge.slice(0,160):null)}catch{if(!W())return;K("动态命令加载失败"),R([])}finally{W()&&E(!1)}},[r,i]);S.useEffect(()=>{i&&(!y&&O===0||G())},[i,y,O,G]);const ne=S.useCallback(()=>{P(C=>C+1),G()},[G]);S.useEffect(()=>{if(!i)return;const C=c.slice(0,Y.current?.selectionStart??c.length).match(/(?:^|\s)@([^\s@]*)$/);if(!C){p([]);return}const ae=window.setTimeout(()=>{fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(i)}/files?q=${encodeURIComponent(C[1]??"")}`).then(W=>W.ok?W.json():null).then(W=>p((W?.files??[]).map(Q=>Q.path)))},150);return()=>window.clearTimeout(ae)},[r,i,c]);const q=S.useCallback(C=>{const ae=Y.current?.selectionStart??c.length,Q=c.slice(0,ae).search(/@[^\s@]*$/);Q<0||(b(`${c.slice(0,Q)}@${C} ${c.slice(ae)}`),p([]))},[c]),M=S.useCallback(C=>{for(const ae of Array.from(C).slice(0,4)){if(!ae.type.startsWith("image/")||ae.size>5*1024*1024){o("图片仅支持 PNG/JPEG/GIF/WebP,单张不超过 5 MiB");continue}const W=new FileReader;W.onload=()=>{const Q=String(W.result??""),ue=Q.slice(Q.indexOf(",")+1);v(me=>[...me,{name:ae.name,type:"image",mimeType:ae.type,data:ue}].slice(0,4))},W.readAsDataURL(ae)}},[o]),D=S.useCallback(C=>{v(ae=>ae.filter(W=>W!==C))},[]);S.useLayoutEffect(()=>{const C=Y.current;C&&(C.style.height="auto",C.style.height=`${Math.min(C.scrollHeight,280)}px`)},[c]),S.useEffect(()=>{if(!i)return;const C=window.setTimeout(()=>{fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(i)}/draft`,{method:"PUT",credentials:"include",headers:{"content-type":"application/json","x-loop-console-confirmation":un()},body:JSON.stringify({text:c})})},400);return()=>window.clearTimeout(C)},[r,i,c]);const H=S.useMemo(()=>W0(z),[z]),B=S.useMemo(()=>c.startsWith("/")?ek(H,c):[],[c,H]);S.useEffect(()=>{N(C=>GN(C,B.length))},[B.length]);const te=S.useCallback(()=>{s.isComposingRef.current=!0},[s]),T=S.useCallback(()=>{s.isComposingRef.current=!1,s.compositionEndedAtRef.current=Date.now()},[s]),I=S.useCallback(()=>s.isComposingRef.current,[s]),U=S.useCallback(()=>Date.now()-s.compositionEndedAtRef.current<100,[s]);return S.useEffect(()=>{R0({origin:r,sessionId:i,refs:s})},[r,i,s]),{input:c,setInput:b,handleInputChange:V,fileOptions:h,pendingImages:g,setPendingImages:v,addImagesFromFiles:M,removeImage:D,shortcutOpen:y,setShortcutOpen:k,shortcutIndex:w,setShortcutIndex:N,filteredShortcuts:B,dynamicCommandsLoading:A,dynamicCommandsError:F,retryDynamicCommands:ne,insertFileReference:q,textareaRef:Y,onCompositionStart:te,onCompositionEnd:T,isComposingNow:I,recentlyComposedNow:U}}const YN=[{toolId:"read",kind:"explore",description:"Pi 内置读取文件。"},{toolId:"write",kind:"explore",description:"Pi 内置写入文件(软约束:大改优先走 DAG)。"},{toolId:"edit",kind:"explore",description:"Pi 内置编辑文件(软约束:大改优先走 DAG)。"},{toolId:"bash",kind:"explore",description:"Pi 内置 shell 执行(软约束:优先受治路径)。"},{toolId:"grep",kind:"explore",description:"Pi 内置内容搜索。"},{toolId:"find",kind:"explore",description:"按名称查找文件路径。"},{toolId:"ls",kind:"explore",description:"列出目录内容。"},{toolId:"safe-read",kind:"explore",description:"安全读取仓库相对路径文件;拒绝敏感文件并自动脱敏 secret。"},{toolId:"safe-grep",kind:"explore",description:"安全搜索仓库内容;跳过敏感文件并自动脱敏搜索结果。"},{toolId:"git-status",kind:"explore",description:"固定参数执行 git status --porcelain(无 shell)。"},{toolId:"git-diff",kind:"explore",description:"固定参数查看 git diff;敏感路径不可查看且结果自动脱敏。"}];function KN(e){if(!e)return null;const r=(e.tools??[]).map(s=>({toolId:s.toolId,action:s.action,description:s.description,kind:s.kind??"read",cli:s.cli})),i=[...YN];return{explore:i,operator:r,total:i.length+r.length}}let XN=0;function QN(e){const{origin:r,session:i,setSession:s,refs:o,setError:c}=e,[d,h]=S.useState(null),[p,g]=S.useState([]),[v,y]=S.useState("idle"),[k,b]=S.useState(null),[w,N]=S.useState([]),[z,R]=S.useState(null),[A,E]=S.useState(null),[F,K]=S.useState(!1),[O,P]=S.useState(!1),[Y,le]=S.useState(!1),_=S.useRef(null),V=S.useRef(null),G=S.useRef(0);S.useEffect(()=>{G.current=-1,K(!1)},[i?.sessionId,K]);const q=ha().snapshot,M=S.useCallback(async()=>{try{const Q=await fetch(`${r}/api/operator/v1/chat/capabilities`);if(!Q.ok)return;const ue=await Q.json();h(ue)}catch{}},[r]);S.useEffect(()=>{M()},[M]);const D=S.useCallback(async()=>{if(!i){g([]),y("idle");return}const Q=i.sessionId;y("loading"),b(null);try{const ue=await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(Q)}/models`,{credentials:"include"}),me=await ue.json().catch(()=>null);if(o.sessionRef.current?.sessionId!==Q)return;if(!ue.ok||!me){y("error"),b(me?.error?.message??`模型列表读取失败(HTTP ${ue.status})`);return}g(me.models??[]),N(me.thinkingLevels??[]),y("ready")}catch(ue){if(o.sessionRef.current?.sessionId!==Q)return;y("error"),b(ue instanceof Error?ue.message:String(ue))}},[r,i,o]);S.useEffect(()=>{D()},[D]),S.useEffect(()=>{if(!i){R(null),E(null);return}const Q=i.sessionId,ue=`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(Q)}`;E(null),fetch(`${ue}/runtime-context`,{credentials:"include"}).then(async me=>{const ge=await me.json().catch(()=>null);if(!ge?.context||o.sessionRef.current?.sessionId!==Q)return;const fe=ge.context,Se=E0().snapshot;R(Me=>w0(Me,fe,Se,Q))}).catch(()=>{o.sessionRef.current?.sessionId===Q&&E("注入上下文读取失败,请重试")})},[r,i?.sessionId,o]),S.useEffect(()=>{if(!q||!i||q.sessionId!==i.sessionId)return;const Q=Dy(q);s(ue=>{if(!ue||ue.sessionId!==q.sessionId||HE(ue,Q))return ue;const me=fb(ue,Q);return o.sessionRef.current=me,me}),R(ue=>{if(!ue)return ue;const me={...ue,...Q.model?{model:Q.model}:{},...Q.thinkingLevel?{thinkingLevel:Q.thinkingLevel}:{}};return me.model?.provider===ue.model?.provider&&me.model?.modelId===ue.model?.modelId&&me.thinkingLevel===ue.thinkingLevel?ue:me})},[q,i?.sessionId,o,s,R]);const H=S.useCallback(async Q=>{if(!i)return!1;const ue=i.sessionId,me=++XN;G.current=me,_y({type:"mutation-start",token:me}),K(!0);try{const ge=await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(i.sessionId)}/model`,{method:"POST",credentials:"include",headers:{"content-type":"application/json","x-loop-console-confirmation":un()},body:JSON.stringify(Q)}),fe=await ge.json().catch(()=>({}));return G.current!==me?!1:ge.ok?!fe.session||o.sessionRef.current?.sessionId!==ue?!1:j0(me,ue,fe.snapshot):(o.sessionRef.current?.sessionId===ue&&(c(fe.error?.message??`模型或思考等级切换失败(HTTP ${ge.status})`),da()),!1)}catch(ge){return G.current!==me||o.sessionRef.current?.sessionId===ue&&c(ge instanceof Error?ge.message:String(ge)),!1}finally{T0(me,ue,o)&&G.current===me&&K(!1)}},[r,i,o,s,c]);S.useEffect(()=>{if(!O)return;const Q=me=>{const ge=_.current;ge&&me.target instanceof Node&&!ge.contains(me.target)&&P(!1)},ue=me=>{me.key==="Escape"&&P(!1)};return document.addEventListener("mousedown",Q),document.addEventListener("keydown",ue),()=>{document.removeEventListener("mousedown",Q),document.removeEventListener("keydown",ue)}},[O]),S.useEffect(()=>{if(!Y)return;const Q=me=>{const ge=V.current;ge&&me.target instanceof Node&&!ge.contains(me.target)&&le(!1)},ue=me=>{me.key==="Escape"&&le(!1)};return document.addEventListener("mousedown",Q),document.addEventListener("keydown",ue),()=>{document.removeEventListener("mousedown",Q),document.removeEventListener("keydown",ue)}},[Y]);const B=S.useMemo(()=>KN(d),[d]),te=q?(q.models??[]).map(Q=>({provider:Q.provider,id:Q.id,...Q.name?{name:Q.name}:{},...Q.hasCredentials!==void 0?{hasCredentials:Q.hasCredentials}:{}})):p,T=q?.thinkingLevels?.length?q.thinkingLevels.map(Q=>Q.value):w,I=i?.model??z?.model,U=I?Zl(I.provider,I.modelId):"",C=q?.selection?.thinkingSelection??i?.thinkingLevel??"",ae=q?.selection?.effectiveThinkingLevel??i?.thinkingLevel??void 0,W=!U||te.some(Q=>Zl(Q.provider,Q.id)===U);return{capabilities:d,models:te,modelsStatus:v,modelsError:k,onRetryModels:()=>{D()},thinkingLevels:T,runtimeContext:z,runtimeContextError:A,onRetryRuntimeContext:()=>{E(null),da()},toolsOpen:O,setToolsOpen:P,runtimeContextOpen:Y,setRuntimeContextOpen:le,toolsMenuRef:_,runtimeContextMenuRef:V,switchRuntime:H,switching:F,toolCatalog:B,activeModel:I,activeModelRef:U,activeThinkingLevel:C,effectiveThinkingLevel:ae,activeModelListed:W}}const vy={comfortableMin:1450,compactMin:1100};function ZN(e){return!Number.isFinite(e)||e<0?"narrow":e>=vy.comfortableMin?"comfortable":e>=vy.compactMin?"compact":"narrow"}const JN={mode:"comfortable",width:1600,landingDensity:"comfortable",emptyHeight:720};function WN(e,r){const[i,s]=S.useState(JN);return S.useEffect(()=>{const o=e.current;if(!o||typeof ResizeObserver>"u")return;const c=()=>{const v=o.getBoundingClientRect().width,y=r?.current??null,k=y?y.getBoundingClientRect().height:720;s({mode:ZN(v),width:v,landingDensity:Lk(k),emptyHeight:k})};c();const d=new ResizeObserver(()=>c());d.observe(o);let h=null;const p=()=>{const v=r?.current??null;v&&v!==h&&(h&&d.unobserve(h),d.observe(v),h=v,c())};p();const g=window.setInterval(p,250);return()=>{window.clearInterval(g),d.disconnect()}},[e,r]),i}function eI(e="none"){return{active:e}}function la(e,r){return{active:r}}function Vn(e={active:"none"}){return{active:"none"}}function tI(e){return{sidebarDrawerOpen:e.active==="sidebar-drawer",processOpen:e.active==="process",runtimeContextOpen:e.active==="runtime-context",toolsOpen:e.active==="tools",activityOpen:e.active==="activity"}}const nI=160,rI=120,iI=120;function aI(e){return e?e.operationCards.length+e.humanGateCards.length+e.artifactCards.length:0}function sI(e){const r=aI(e),[i,s]=S.useState(()=>r>0?{phase:"visible",snapshot:e}:{phase:"hidden",snapshot:null}),o=S.useRef(i);o.current=i;const c=S.useMemo(()=>`${e?.sessionId??"none"}:${r}`,[e?.sessionId,r]);return S.useEffect(()=>{const d=[],h=o.current.snapshot;if(!e||r===0){if(!h){s({phase:"hidden",snapshot:null});return}s({phase:"leaving",snapshot:h}),d.push(window.setTimeout(()=>{s({phase:"hidden",snapshot:null})},rI))}else h?h.sessionId!==e.sessionId?(s({phase:"switching",snapshot:e}),d.push(window.setTimeout(()=>{s({phase:"visible",snapshot:e})},iI))):s({phase:"visible",snapshot:e}):(s({phase:"entering",snapshot:e}),d.push(window.setTimeout(()=>{s({phase:"visible",snapshot:e})},nI)));return()=>{for(const p of d)window.clearTimeout(p)}},[e,c,r]),i}function lI(e){const{origin:r,surface:i="standalone"}=e,s=i==="workspace",o=JE(),[c,d]=S.useState(null),[h,p]=S.useState(null),[g,v]=S.useState(!0),[y,k]=S.useState(!0),[b,w]=S.useState(()=>eI()),[N,z]=S.useState(null),[R,A]=S.useState(null),[E,F]=S.useState(0),K=S.useRef(null),O=S.useRef(null),P=S.useRef(null),Y=S.useRef(null),le=S.useRef(null),_=S.useRef(null),V=S.useRef(null),G=S.useRef(null),ne=S.useRef(null),q=S.useRef(()=>{}),M=S.useRef(null),D=S.useRef(!1),H=WN(P,le),B=H.mode,te=tI(b),T=te.processOpen,I=T,U=te.runtimeContextOpen,C=te.activityOpen,ae=S.useCallback(re=>{w(ke=>{const gt=ke.active==="process";return(typeof re=="function"?re(gt):re)?la(ke,"process"):ke.active==="process"?Vn(ke):ke})},[]),W=VN({origin:r,sessionId:h?.sessionId,refs:o,setError:d}),Q=S.useMemo(()=>$N(W.filteredShortcuts),[W.filteredShortcuts]),ue=UN({origin:r,refs:o,sessionId:h?.sessionId,setError:d}),me=S.useRef(()=>{}),ge=S.useCallback(re=>{me.current(re)},[]),fe=oN({origin:r,refs:o,sessionId:h?.sessionId,setError:d,onReconcile:ge});me.current=re=>{const ke=o.sessionRef.current?.sessionId;ke&&(async()=>await fe.recoverSession(ke)?(A({id:Date.now(),message:"已自动恢复:会话事件已重新同步,可继续对话。"}),F(Xe=>Xe+1)):A({id:Date.now(),message:"自动恢复未完成,将在重连时重试。"}))()};const Se=fe.operationCards.length+fe.humanGateCards.length+fe.artifactCards.length,Me=S.useMemo(()=>Ky(fe.operationCards).length+fe.humanGateCards.length+fe.artifactCards.length,[fe.operationCards,fe.humanGateCards.length,fe.artifactCards.length]),et=S.useMemo(()=>h?{sessionId:h.sessionId,operationCards:fe.operationCards,humanGateCards:fe.humanGateCards,artifactCards:fe.artifactCards}:null,[h,fe.operationCards,fe.humanGateCards,fe.artifactCards]),Ue=sI(et),ct=S.useMemo(()=>pk({operations:fe.operationCards,gates:fe.humanGateCards,artifacts:fe.artifactCards}),[fe.operationCards,fe.humanGateCards,fe.artifactCards]),Jt=S.useCallback(re=>ct.has(re),[ct]),Kt=_k(Y,B,h?.sessionId??"no-session"),Nt=Kt.presentation==="sidecar";S.useEffect(()=>{const re=B==="comfortable"&&b.active==="sidebar-drawer",ke=Nt&&b.active==="activity";(re||ke)&&w(gt=>gt.active===b.active?Vn(gt):gt)},[Nt,B,b.active]),S.useEffect(()=>{z(null)},[h?.sessionId]),S.useEffect(()=>{Se>0||b.active!=="activity"||w(re=>re.active==="activity"?Vn(re):re)},[Se,b.active]);const Wt=S.useCallback(re=>{re&&z(re),Nt||w(ke=>la(ke,"activity"))},[Nt]),Gt=S.useCallback(()=>{w(re=>re.active==="activity"?Vn(re):re)},[]),Ee=S.useCallback(re=>{const ke=O.current;if(!ke)return;const Xe=Array.from(ke.querySelectorAll("[data-activity-ref]")).find(_t=>re.includes(_t.dataset.activityRef??""));if(!Xe){A({id:Date.now(),message:"详细运行记录暂时没有对应的对话位置。"});return}Xe.scrollIntoView({block:"center",behavior:"smooth"}),Xe.classList.add("is-located"),window.setTimeout(()=>Xe.classList.remove("is-located"),1400),Nt||Gt()},[Nt,Gt]),Te=fN({origin:r,refs:o,setSession:p,thread:fe,composer:{setInput:W.setInput,setPendingImages:W.setPendingImages},browser:{setPreviews:ue.setPreviews,setActivePreviewPath:ue.setActivePreviewPath},setError:d,setProcessOpen:ae,setAutoScroll:k}),pt=BN({origin:r,refs:o,session:h,thread:fe,composer:{setInput:W.setInput,setPendingImages:W.setPendingImages},setError:d,setNotice:A,setAutoScroll:k,recoveryVersion:E,watchSessionTitle:Te.watchSessionTitle}),qe=HN({origin:r,refs:o,thread:fe,setError:d}),_e=QN({origin:r,session:h,setSession:p,refs:o,setError:d});S.useEffect(()=>{_e.runtimeContextOpen&&b.active!=="runtime-context"?w(re=>la(re,"runtime-context")):!_e.runtimeContextOpen&&b.active==="runtime-context"&&w(re=>Vn(re))},[_e.runtimeContextOpen,b.active]),S.useEffect(()=>{b.active!=="runtime-context"&&_e.runtimeContextOpen&&_e.setRuntimeContextOpen(!1)},[b.active]);const{sendPrompt:se,handleStop:he}=pt,be=S.useRef(()=>{}),we=S.useCallback(async re=>{const ke=lg(re);if(ke&&ke.action!=="unknown"&&ke.action!=="pi-prompt"){be.current(re);return}await se(re,W.pendingImages)},[se,W.pendingImages]);q.current=re=>{we(re)};const je=S.useCallback(()=>{W.textareaRef.current?.focus()},[W.textareaRef]),Je=S.useCallback(()=>{w(re=>re.active==="sidebar-drawer"?Vn(re):re)},[]),It=S.useCallback(()=>{_e.setRuntimeContextOpen(!1),w(re=>la(re,"sidebar-drawer"))},[_e.setRuntimeContextOpen]),mt=S.useCallback(re=>{Te.activateSession(re),Je(),queueMicrotask(()=>{O.current?.focus?.(),je()})},[Te,Je,je]),Le=S.useCallback(re=>{W.setInput(ke=>`${ke}${ke&&!ke.endsWith(" ")?" ":""}@${re} `),Je(),queueMicrotask(()=>je())},[W,Je,je]),At=S.useCallback(re=>{ue.openPreview(re),Je()},[ue,Je]),$e=S.useCallback(()=>{const re=O.current;if(!re)return;const ke=re.scrollHeight-re.scrollTop-re.clientHeight<80;k(ke)},[]);S.useEffect(()=>{y&&K.current?.scrollIntoView({behavior:"smooth",block:"end"})},[fe.messages,y,fe.streaming]),S.useEffect(()=>{if(!R)return;const re=window.setTimeout(()=>A(null),6e3);return()=>window.clearTimeout(re)},[R]);const dn=S.useCallback(re=>{if(re.action==="pi-prompt"||re.command==="/name"||re.command==="/compact"){W.setInput(`${re.command} `),W.setShortcutOpen(!1),W.textareaRef.current?.focus();return}be.current(re.command)},[W]),Ft=S.useCallback(re=>{const ke=lg(re),gt=re.trim(),Xe=gt.split(/\s+/,1)[0]?.toLowerCase()??"";if(W.setInput(""),W.setShortcutOpen(!1),!ke)return;if(ke.action==="focus:interview"){if(!h){A({id:Date.now(),message:"请先创建或打开一个会话,再开始 Interview"});return}qe.startInterview();return}const _t=J0(ke.action);if(_t){e.onNavigateWorkspace?.(_t,{});return}if(ke.action==="compact"){const fn=gt.slice(Xe.length).trim();Te.compactSession(fn||void 0);return}if(ke.action==="name"){const fn=gt.slice(Xe.length).trim(),Xt=h?.sessionId;if(!Xt){d("当前没有可重命名的会话");return}const wn=Te.sessionList.find(hn=>hn.sessionId===Xt),Un=fn||window.prompt("会话名称",wn?.title??wn?.displayTitle??"")||"";Un.trim()&&Te.updateSession(Xt,{title:Un.trim()});return}if(ke.action==="session"){const fn=h?.sessionId??"(none)",Xt=Te.sessionList.find(Un=>Un.sessionId===fn),wn=Xt?.title||Xt?.displayTitle||"未命名对话";A({id:Date.now(),message:`当前会话:${wn}(${fn})`});return}if(ke.action==="copy"){const Xt=[...fe.visibleMessages??[]].reverse().find(wn=>wn.role==="assistant");if(!Xt?.text){d("没有可复制的助手消息");return}navigator.clipboard?.writeText(Xt.text).then(()=>A({id:Date.now(),message:"已复制最后一条助手消息"}),()=>d("复制失败"));return}if(ke.action==="unknown"){se(gt,W.pendingImages);return}d(`未知 shortcut:${ke.command}`)},[W.setInput,W.setShortcutOpen,W.pendingImages,qe.startInterview,e.onNavigateWorkspace,Te,h,fe.visibleMessages,se]);be.current=Ft;const Ie=S.useCallback(re=>{const ke=o.isComposingRef.current||re.nativeEvent.isComposing,gt=Date.now()-o.compositionEndedAtRef.current<100;if(W.shortcutOpen&&W.filteredShortcuts.length>0&&!ke&&!gt){if(re.key==="ArrowLeft"||re.key==="ArrowRight"||re.key==="ArrowUp"||re.key==="ArrowDown"){re.preventDefault();const Xe=FN(B);let _t=W.shortcutIndex;if(re.key==="ArrowLeft"||re.key==="ArrowRight")_t=yy(W.shortcutIndex,Q,Xe,re.key==="ArrowLeft"?"left":"right");else{const fn=M.current;let Xt=null;if(fn){const wn=Array.from(fn.querySelectorAll("[data-shortcut-index]")).map(hn=>{const br=hn.getBoundingClientRect();return{globalIndex:Number(hn.dataset.shortcutIndex??-1),top:br.top,bottom:br.bottom,left:br.left,right:br.right}}).filter(hn=>Number.isFinite(hn.globalIndex)&&hn.globalIndex>=0),Un=wn.find(hn=>hn.globalIndex===W.shortcutIndex)??null;Un&&(Xt=PN(Un,wn,re.key==="ArrowUp"?"up":"down"))}_t=Xt??yy(W.shortcutIndex,Q,Xe,re.key==="ArrowUp"?"up":"down")}_t!==W.shortcutIndex&&(D.current=!0,W.setShortcutIndex(_t));return}if(re.key==="Escape"){re.preventDefault(),W.setShortcutOpen(!1);return}if(re.key==="Enter"||re.key==="Tab"){re.preventDefault();const Xe=W.filteredShortcuts[W.shortcutIndex]??W.filteredShortcuts[0];dn(Xe);return}}if(re.key==="Enter"&&!re.shiftKey&&(ke||gt)){gt&&re.preventDefault();return}if(re.key==="Enter"&&!re.shiftKey){re.preventDefault(),we(W.input);return}},[W.input,W.shortcutOpen,W.filteredShortcuts,W.shortcutIndex,W.setShortcutIndex,W.setShortcutOpen,o,we,dn,B,Q,M,D]),Ye=fe.visibleMessages.length>0||fe.operationCards.length>0||fe.humanGateCards.length>0||fe.artifactCards.length>0||!!fe.interview,Ke=e.readiness==="setup-required"?"⚠ Pi 未就绪(setup-required):Chat 需要先完成 Pi 认证 / 模型配置。":e.readiness==="degraded"?"⚠ Pi 降级(degraded):可继续对话,但部分能力不可用。":null,ut=u.jsx(X0,{origin:r,open:g,layoutMode:B,drawerOpen:te.sidebarDrawerOpen,activeSessionId:h?.sessionId,sessions:Te.sessionList,tree:ue.tree,expanded:ue.expandedDirs,treeError:ue.treeError,onToggleOpen:()=>v(re=>!re),onOpenDrawer:It,onCloseDrawer:Je,onCreate:()=>{Te.createSession()},creatingSession:Te.creatingSession,onActivate:re=>{te.sidebarDrawerOpen?mt(re):Te.activateSession(re)},onRename:(re,ke)=>{Te.updateSession(re,{title:ke})},onSetState:(re,ke)=>{Te.updateSession(re,{state:ke})},onDelete:re=>Te.deleteSession(re),onRefreshTree:()=>{ue.loadTree()},onToggleDir:ue.toggleDir,onInsert:re=>{te.sidebarDrawerOpen?Le(re):W.setInput(ke=>`${ke}${ke&&!ke.endsWith(" ")?" ":""}@${re} `)},onPreview:re=>{te.sidebarDrawerOpen?At(re):ue.openPreview(re)},drawerTriggerRef:_}),wt=["oc-workspace",T&&!I?"has-process":"",I?"has-process-overlay":""].filter(Boolean).join(" "),Mt=re=>u.jsx("div",{className:"oc-messages is-empty",ref:le,"data-landing-density":H.landingDensity,children:u.jsx(nv,{mode:re,readiness:e.readiness,density:H.landingDensity,onSuggest:async ke=>{Te.creatingSession||(re==="no-session"?await Te.createSession()&&await we(ke):await we(ke))},disabled:Te.creatingSession,onCreateSession:re==="no-session"?()=>{Te.createSession()}:void 0})});return u.jsxs("div",{className:"oc-shell",children:[s?null:u.jsxs("div",{className:"oc-banner",children:[u.jsxs("span",{className:"oc-banner-title",children:[u.jsx("span",{className:"oc-banner-dot","aria-hidden":"true"}),"对话"]}),u.jsxs("span",{className:"oc-banner-body",children:["用自然语言编排 loop-agent / agent-worker 的",u.jsx("strong",{children:"全部能力"}),"。这是 ",u.jsx("strong",{children:"Operator"})," 面:默认具备完整 Pi 工具(read/write/edit/bash/grep/find/ls)与 safe-* 探查、以及受策略约束的 operator action(ADR 0011)。",u.jsx("strong",{children:"软约束"}),":大改与高风险变更优先走受治 DAG 的 implement-pi / repair-pi 与 Human Gate,而非把 Chat 当作第二套 DAG kernel。"]})]}),Ke&&u.jsx("div",{className:"oc-alert oc-alert-warning",children:Ke}),c&&u.jsxs("div",{className:"oc-alert oc-alert-error",children:[u.jsx("strong",{children:"出错了:"}),c]}),R&&u.jsx("div",{className:"oc-alert oc-alert-warning",role:"status",children:R.message}),h?u.jsxs("div",{className:wt,ref:P,"data-layout-mode":B,children:[ut,u.jsxs("div",{ref:Y,className:`oc-main${Ye?"":" is-landing"}`,children:[!Nt&&(B==="narrow"||Se>0)?u.jsxs("div",{className:"oc-main-topbar",children:[B==="narrow"?u.jsx("button",{type:"button",className:"oc-main-topbar-btn",ref:_,"aria-label":"打开会话与仓库","aria-expanded":te.sidebarDrawerOpen,onClick:()=>te.sidebarDrawerOpen?Je():It(),children:"会话与仓库"}):null,Se>0?u.jsxs("button",{type:"button",className:"oc-main-topbar-btn oc-activity-trigger",ref:ne,"aria-controls":"oc-activity-rail","aria-expanded":C,onClick:()=>C?Gt():Wt(),children:["运行活动 ",u.jsx("span",{children:Me})]}):null]}):null,u.jsx(Z0,{previews:ue.previews,activePath:ue.activePreviewPath,loading:ue.previewLoading,onActivate:ue.setActivePreviewPath,onClose:ue.closePreview}),Ye?u.jsx(ME,{scrollContainerRef:O,messagesEndRef:K,onScroll:$e,hasThread:Ye,readiness:e.readiness,streaming:fe.streaming,streamingAssistantId:fe.streamingAssistantId,messagesCount:fe.messages.length,visibleCount:fe.visibleMessages.length,onLoadMore:()=>fe.setHistoryLimit(re=>re+50),turnGroups:fe.turnGroups,interview:fe.interview,interviewAnswer:qe.interviewAnswer,onInterviewAnswerChange:qe.setInterviewAnswer,onAnswerInterview:re=>{qe.answerInterview(re)},onConfirmTaskKind:()=>{qe.confirmTaskKind()},onActivateActivity:Wt,canActivateActivity:Jt,onSuggest:re=>{we(re)}}):Mt("empty-session"),u.jsx(KE,{composer:W,streaming:fe.streaming,hasThread:Ye,layoutMode:B,paletteModel:Q,shortcutPaletteRef:M,paletteKeyboardNavRef:D,onSend:re=>{we(re)},onStop:he,onKeyDown:Ie,onRunShortcut:Ft,models:_e.models,activeModel:_e.activeModel,activeModelRef:_e.activeModelRef,activeModelListed:_e.activeModelListed,activeThinkingLevel:_e.activeThinkingLevel,thinkingLevels:_e.thinkingLevels,onSwitchRuntime:re=>{_e.switchRuntime(re)},usage:fe.usage,unread:fe.unread,onCompact:()=>{Te.compactSession()},processSummary:fe.processSummary,processOpen:T,onToggleProcess:()=>{w(re=>re.active==="process"?Vn(re):la(re,"process")),T||_e.setRuntimeContextOpen(!1)},processTriggerRef:V,runtimeContext:_e.runtimeContext,runtimeContextOpen:U,onToggleRuntimeContext:()=>{U?(_e.setRuntimeContextOpen(!1),w(re=>re.active==="runtime-context"?Vn(re):re)):(_e.setRuntimeContextOpen(!0),w(re=>la(re,"runtime-context")))},runtimeContextTriggerRef:G})]}),Se>0&&!Nt&&C?u.jsx("button",{type:"button",className:"oc-overlay-backdrop is-activity","aria-label":"关闭运行活动遮罩",onClick:Gt}):null,Ue.snapshot?u.jsx(Dk,{origin:r,sessionId:Ue.snapshot.sessionId,presentation:Kt.presentation,sidecarRect:Kt.sidecarRect,phase:Ue.phase,open:C,focusRef:N,triggerRef:ne,operationCards:Ue.snapshot.operationCards,humanGateCards:Ue.snapshot.humanGateCards,artifactCards:Ue.snapshot.artifactCards,onClose:Gt,onLocateConversation:Ee,onNavigateWorkspace:e.onNavigateWorkspace}):null,U&&_e.runtimeContext?u.jsxs(u.Fragment,{children:[u.jsx("button",{type:"button",className:"oc-overlay-backdrop is-runtime-context","aria-label":"关闭注入上下文遮罩",onClick:()=>{_e.setRuntimeContextOpen(!1),w(re=>re.active==="runtime-context"?Vn(re):re)}}),u.jsx(ZE,{panelOnly:!0,open:U,onToggle:()=>{},onClose:()=>{_e.setRuntimeContextOpen(!1),w(re=>re.active==="runtime-context"?Vn(re):re)},context:_e.runtimeContext,triggerRef:G})]}):null,T&&u.jsxs(u.Fragment,{children:[I?u.jsx("button",{type:"button",className:"oc-overlay-backdrop is-process","aria-label":"关闭工具调用记录遮罩",onClick:()=>ae(!1)}):null,u.jsx(XE,{toolCalls:fe.toolCalls,overlay:I,onClose:()=>ae(!1),triggerRef:V})]})]}):u.jsxs("div",{className:wt,ref:P,"data-layout-mode":B,children:[ut,u.jsxs("div",{className:"oc-main is-landing",children:[B==="narrow"?u.jsx("div",{className:"oc-main-topbar",children:u.jsx("button",{type:"button",className:"oc-main-topbar-btn",ref:_,"aria-label":"打开会话与仓库","aria-expanded":te.sidebarDrawerOpen,onClick:()=>te.sidebarDrawerOpen?Je():It(),children:"会话与仓库"})}):null,Mt("no-session")]})]})]})}function oI(e){return e==="validate"||e==="apply"||e==="spine"?"contract":e}const pb="X-Loop-Console-Confirmation",gb="agent-worker console doctor --repo .",vd=[{kind:"standard",label:"后端研发(默认 DAG)",hint:"生成标准 hybrid DAG(contract → implement → verify)"},{kind:"frontend-implementation",label:"前端研发",hint:"生成 frontend-implementation 专用节点链"},{kind:"backend-test",label:"后端测试",hint:"生成 backend-test-dag(分析 / 用例 / pytest)"},{kind:"frontend-test",label:"前端测试",hint:"生成 frontend-test-dag(RAG 用例 + Playwright CLI)"}],yb={"setup-required":"需要设置",ready:"已就绪",degraded:"降级可用",unknown:"未知"},uI={idle:"未探测",match:"匹配",mismatch:"仓库不匹配",unavailable:"不可用"},vb={low:"低",medium:"中",high:"高"},bb={"validation-failed":"校验失败","contract-drift":"契约漂移","runtime-mismatch":"运行时不匹配","pause-on-human":"等待人工","verification-failed":"验证失败","orphan-unknown":"孤立/未知","terminal-failed":"已终止(失败)","terminal-succeeded":"已终止(成功)","needs-reconcile":"需要对账","running-active":"正在运行"},cI={idle:"空闲","not-started":"未开始","not-run":"未运行","n/a (MVP)":"不适用(MVP)",accepted:"已接受",succeeded:"已成功",running:"运行中",ran:"已执行"};function Ul(e){return cI[e]??e}function xb(){return window.__CONSOLE_CONFIRMATION_TOKEN__??""}function no(e){return`${e}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}async function ro(e,r={},i){const s={"Content-Type":"application/json",[pb]:xb()},o=await fetch("/api/operator/v1/operations",{method:"POST",credentials:"same-origin",headers:s,body:JSON.stringify({action:e,actionParams:r,...i?{clientRequestId:i}:{}})});let c={};try{c=await o.json()}catch{c={ok:!1,error:{code:"INVALID_INPUT",message:"操作响应不是合法 JSON"}}}return{status:o.status,body:c}}const dI=new Set(["runDag","dagRerun","dagReconcileRun","dagRequestInterrupt","standaloneTaskRerun"]);function rd(e,r){return hb({blockedReasons:e.blockedReasons,blockingNodes:e.blockingNodes,fallbackMessage:r})}async function by(e,r=3e5){const i=Date.now();for(;Date.now()-i<r;){const s=await fetch(`/api/operator/v1/operations/${encodeURIComponent(e)}`,{credentials:"same-origin"});if(!s.ok)return null;const o=await s.json(),c=o.operation??o,d=c.state??"";if(d==="succeeded"||d==="failed"||d==="needs-reconcile"||d==="timed-out")return c;await new Promise(h=>setTimeout(h,250))}return{state:"needs-reconcile",errorMessage:"等待操作结果超时"}}const fI={};function hI(){const[e,r]=S.useState(()=>Jy({env:fI?.VITE_OPERATOR_CHAT_DEFAULT_LANDING,storage:window.localStorage,location:window.location})),[i,s]=S.useState(null),[o,c]=S.useState("setup-required"),[d,h]=S.useState(null),[p,g]=S.useState(null),[v,y]=S.useState(!1),[k,b]=S.useState(!1),[w,N]=S.useState(null),[z,R]=S.useState(null),[A,E]=S.useState(null),[F,K]=S.useState(null),[O,P]=S.useState({command:"idle",dag:"not-started",verification:"not-run",promote:"n/a (MVP)"}),[Y,le]=S.useState("setup"),_=S.useCallback(M=>{le(D=>oI(typeof M=="function"?M(D):M))},[]),V=o==="setup-required",G=o==="degraded",ne=S.useCallback(M=>{M!==e&&(N(null),E(null),R(null)),r(M)},[e]),q=S.useCallback(async()=>{try{const D=await(await fetch("/api/health")).json();s(D);const H=D.piReadiness??"setup-required";c(H),g(null),_(H==="ready"||H==="degraded"?B=>B==="setup"?"import-prd":B:"setup")}catch(M){g(M instanceof Error?M.message:String(M))}try{const D=await(await fetch("/api/operator/v1/readiness")).json();h(D),D.state&&c(D.state)}catch{}},[_]);return{nav:e,setNav:r,selectNav:ne,health:i,readiness:o,setReadiness:c,readinessReport:d,healthError:p,loadHealth:q,busy:v,setBusy:y,observeBusy:k,setObserveBusy:b,opError:w,setOpError:N,opMessage:z,setOpMessage:R,opErrorCode:A,setOpErrorCode:E,lastOpState:F,setLastOpState:K,layers:O,setLayers:P,step:Y,setStep:_,setupBlocked:V,degraded:G}}const mI={bootstrapFromPrd:"正在导入 PRD 并创建任务:归档文档 → 确定性解析 → 语义结构化(MED→HIGH→LOW,每档最多 300 秒,请勿关闭页面)",importPrd:"正在导入 PRD:归档文档 → 确定性解析 → 语义结构化(MED→HIGH→LOW,每档最多 300 秒,请勿关闭页面)",interviewStart:"正在启动需求访谈…",interviewTurn:"正在提交访谈回答…",interviewSkip:"正在跳过访谈并生成评估…",contractValidate:"正在校验契约草稿…",contractDiff:"正在计算契约差异…",contractApply:"正在应用契约(写入需求与执行约束)…",spineCheck:"正在运行 Spine 审计…",dagGenerate:"正在生成 DAG…",standaloneTaskRerun:"正在完整重跑任务:服务端校验资格后启动新 run…",workerTaskRetry:"正在重新排队 Worker Task…"};function pI(e){const{shell:r,applyInterviewPayload:i}=e,{setBusy:s,setOpError:o,setOpErrorCode:c,setOpMessage:d,setReadiness:h,setStep:p,setNav:g,setLastOpState:v,setLayers:y,step:k,nav:b}=r,[w,N]=S.useState(null),[z,R]=S.useState([]),[A,E]=S.useState(!0),F=S.useRef(null),[K,O]=S.useState(null),[P,Y]=S.useState(null),le=S.useCallback(async(q,M={},D)=>{s(!0),o(null),c(null),d(mI[q]??null);try{const{status:H,body:B}=await ro(q,M,D?.clientRequestId);if(H===412||B.error?.code==="PI_SETUP_REQUIRED")return o(yr(B.error?.message??"Pi 未就绪或已降级:该操作暂不可用")),c(B.error?.code??"PI_SETUP_REQUIRED"),h("setup-required"),p("setup"),g("models"),B;if(H>=400||B.ok===!1)return o(yr(B.error?.message??B.message??`操作失败(HTTP ${H})`)),c(B.error?.code??String(H)),v(B.state??`failed:${H}`),y(I=>({...I,command:B.error?.message??`failed:${B.error?.code??H}`})),B;if(B.operationId){const I=window.localStorage.getItem(Bn)?.trim();if(I&&fetch(`/api/operator/v1/chat/sessions/${encodeURIComponent(I)}/operation-links`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json",[pb]:xb()},body:JSON.stringify({operationId:B.operationId})}).then(U=>{U.ok||console.warn("Operator Chat operation link failed",U.status)}).catch(U=>console.warn("Operator Chat operation link failed",U)),N(B.operationId),v(B.state??"accepted"),y(U=>({...U,command:B.state??"accepted",dag:q==="runDag"?"running":U.dag})),dI.has(q)){E(!0),d(`操作已接受,后台运行中:${B.operationId}(请看事件流;可同时打开 Observe)`);const U=B.operationId;by(U,30*6e4).then(C=>{if(C){if(v(C.state??null),C.state==="failed"||C.state==="needs-reconcile"||C.state==="timed-out"){o(yr(C.errorMessage??C.stderrPreview??`操作失败:${C.state}`)),c(C.errorCode??C.state??null),y(ae=>({...ae,command:`failed:${C.errorCode??C.state}`}));return}C.state==="succeeded"&&(d(`${q} 已成功`),y(ae=>({...ae,command:"succeeded"})))}})}else{d(`操作已接受:${B.operationId}`);const U=await by(B.operationId);if(U){if(v(U.state??null),U.state==="failed"||U.state==="needs-reconcile"||U.state==="timed-out")return o(yr(U.errorMessage??U.stderrPreview??`操作失败:${U.state}`)),c(U.errorCode??U.state??null),y(Q=>({...Q,command:`failed:${U.errorCode??U.state}`})),{ok:!1,operationId:B.operationId,state:U.state,error:{code:U.errorCode??U.state??"INTERNAL_ERROR",message:U.errorMessage??U.stderrPreview??`操作失败:${U.state}`}};d(U.errorMessage?`${q}:${U.errorMessage}`:`${q} 已成功`),y(Q=>({...Q,command:U.state??"succeeded"}));const C=U.result??{},ae={ok:!0,operationId:B.operationId,state:U.state??"succeeded",result:C};(q==="interviewStart"||q==="interviewTurn"||q==="interviewSkip")&&i(C);const W=C.confirmation;return W?.confirmationId&&(O(W.confirmationId),Y(C)),D?.advanceTo&&p(D.advanceTo),ae}}}else d(`${q} 已完成`),v(B.state??"succeeded"),y(I=>({...I,command:"succeeded",verification:q==="contractValidate"||q==="spineCheck"?"ran":I.verification}));const te=B.result??{};(q==="interviewStart"||q==="interviewTurn"||q==="interviewSkip")&&i(te);const T=te.confirmation;return T?.confirmationId&&(O(T.confirmationId),Y(te)),D?.advanceTo&&p(D.advanceTo),B}catch(H){o(H instanceof Error?H.message:String(H));return}finally{s(!1)}},[i,s,o,c,d,h,p,g,v,y]),_=S.useCallback(q=>{if(!q)return"无响应";if(q.error?.message)return q.error.message;if(q.message)return q.message;const M=q.result;if(M&&typeof M=="object")try{return JSON.stringify(M).slice(0,1200)}catch{return"已返回结果"}return q.ok===!1?"失败":"成功"},[]),V=S.useCallback(q=>{if(!q||q.ok===!1||q.error)return!1;const M=q.result;if(!M)return!0;if(typeof M.valid=="boolean")return M.valid;const D=M.result;return D&&typeof D.valid=="boolean"?D.valid:!0},[]),G=S.useCallback(async q=>{F.current?.abort();const M=new AbortController;F.current=M,R(D=>[...D,`开始跟随事件流 ${q}`]);try{const D=await fetch(`/api/operator/v1/operations/${encodeURIComponent(q)}/events`,{credentials:"same-origin",signal:M.signal});if(!D.ok||!D.body){R(T=>[...T,`事件流 HTTP ${D.status}`]);return}const H=D.body.getReader(),B=new TextDecoder;let te="";for(;A;){const{done:T,value:I}=await H.read();if(T)break;te+=B.decode(I,{stream:!0});const U=te.split(`
|
|
53
|
+
|
|
54
|
+
`);te=U.pop()??"";for(const C of U){const ae=C.split(`
|
|
55
|
+
`).find(Q=>Q.startsWith("data:"));if(!ae)continue;const W=ae.slice(5).trim();R(Q=>[...Q.slice(-80),W.slice(0,240)])}}}catch(D){D.name!=="AbortError"&&R(H=>[...H,`事件流错误:${D instanceof Error?D.message:String(D)}`])}},[A]);S.useEffect(()=>(w&&A&&(k==="run"||b==="recovery")&&G(w),()=>F.current?.abort()),[w,A,k,b,G]);const ne=S.useCallback(()=>{E(!1),F.current?.abort(),d("已停止跟随日志(未取消子进程)")},[d]);return{runAction:le,summarizeEnvelope:_,isActionSuccess:V,operationId:w,setOperationId:N,sseLog:z,followSse:A,setFollowSse:E,stopFollowSse:ne,confirmationId:K,setConfirmationId:O,confirmationDetails:P,setConfirmationDetails:Y}}const bd=8*1024*1024,gI=10*1024*1024,io=8,yI=".md,.markdown,.txt,text/markdown,text/plain",vI=[".md",".markdown",".txt"],Vd=/\.[^.]+$/;function bI(e){const r=Vd.exec(e.trim());return r?r[0].toLowerCase():""}function xI(e){const r=bI(e);return vI.includes(r)}function xd(e){if(!Number.isFinite(e)||e<0)return"0 B";if(e<1024)return`${e} B`;if(e<1024*1024){const i=e/1024;return`${i>=10?i.toFixed(0):i.toFixed(1)} KiB`}const r=e/(1024*1024);return`${r>=10?r.toFixed(1):r.toFixed(2)} MiB`}function gr(e,r){return{ok:!1,code:e,message:r}}function SI(e,r){const i=e?Array.from(e):[],s=r?.maxFiles??io,o=r?.existingCount??0;return i.length===0?gr("file-count","请选择至少一个 .md / .markdown / .txt 文件"):o+i.length>s?gr("file-count",`最多支持 ${s} 个文件(当前已有 ${o} 个)`):null}async function kI(e){const r=e.name?.trim()||"untitled.md";if(!xI(r))return gr("unsupported-extension","仅支持 .md、.markdown、.txt 文件");if(e.size>bd)return gr("file-too-large",`文件不能超过 ${xd(bd)}`);let i;try{i=await e.arrayBuffer()}catch{return gr("read-failed","文件读取失败,请重试或直接粘贴")}let s;try{s=new TextDecoder("utf-8",{fatal:!0}).decode(i)}catch{return gr("invalid-utf8","文件不是有效 UTF-8,请另存为 UTF-8")}if(s.trim().length===0)return gr("empty-content","文件内容不能为空或只有空白");const o=new TextEncoder().encode(s).byteLength;return{ok:!0,text:s,fileName:r,sourceBytes:e.size,textBytes:o}}async function wI(e){if(e.length===0)return gr("file-count","请选择至少一个 .md / .markdown / .txt 文件");if(e.length>io)return gr("file-count",`最多支持 ${io} 个文件`);const r=[];for(const i of e){const s=await kI(i);if(!s.ok)return s;r.push({fileName:s.fileName,text:s.text,sourceBytes:s.sourceBytes,textBytes:s.textBytes})}return{ok:!0,documents:r}}function CI(e,r){const i=e.split(/\r?\n/);for(const o of i){const c=/^(#{1,6})\s+(.+)$/.exec(o.trim());if(c?.[2])return c[2].trim()}for(const o of i){const c=o.trim();if(c&&!/^---+$/.test(c)&&!/^```/.test(c)&&!/^<!--/.test(c))return c.replace(/^>\s+/,"").slice(0,120)}return r.replace(Vd,"").trim()||"需求"}function RI(e){return e.trim().toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"").replace(/-{2,}/g,"-")||"requirement"}function jI(e,r){const i=e.replace(Vd,"").trim(),s=RI(i);return s==="requirement"&&/[^\u0000-\u007f]/.test(i)?`part-${r+1}`:s==="requirement"?i?`part-${r+1}`:`part-${r+1}`:s}function TI(e){const r=new Set;return e.map((i,s)=>{let o=jI(i.fileName,s);if(r.has(o)){let c=2;for(;r.has(`${o}-${c}`);)c+=1;o=`${o}-${c}`}return r.add(o),{name:o,content:i.text,fileName:i.fileName}})}function EI(e,r){if(e.length===0)return"";if(e.length===1)return e[0].text;const i=Math.min(Math.max(0,r?.primaryIndex??0),e.length-1),s=e[i],o=CI(s.text,s.fileName),d=[`<!-- composed-from: ${e.map(h=>h.fileName).join(", ")} -->`,"",`# ${o}`,""];for(const h of e)d.push(`## 来源:${h.fileName}`,"",h.text.trim(),"");return`${d.join(`
|
|
56
|
+
`).trimEnd()}
|
|
57
|
+
`}function NI(e,r,i){const s={action:e,actionParams:r};return new TextEncoder().encode(JSON.stringify(s)).byteLength<=gI}function II(){return"最终内容导致请求体超过服务端限制,请缩小文档或减少文件数量"}function AI(){const[e,r]=S.useState(""),[i,s]=S.useState([]),[o,c]=S.useState(0),[d,h]=S.useState(!1),[p,g]=S.useState(null),[v,y]=S.useState(!1),[k,b]=S.useState(!1),w=S.useRef(0),N=S.useRef(0),z=S.useCallback((V,G)=>{const ne=V.length===0?0:Math.min(Math.max(0,G),V.length-1);c(ne),r(EI(V,{primaryIndex:ne})),h(!1)},[]),R=S.useCallback(async V=>{const G=SI(V,{existingCount:i.length});if(G){g(G.message);return}const ne=Array.from(V),q=++N.current;y(!0),g(null);try{const M=await wI(ne);if(q!==N.current)return;if(!M.ok){g(M.message);return}const D=[...i,...M.documents],H=i.length===0?0:o;s(D),i.length===0||!d?(z(D,H),g(null)):g("已追加文件,未改正文(正文已手动编辑);可点「按文件重新合成」覆盖。")}catch{if(q!==N.current)return;g("文件读取失败,请重试或直接粘贴")}finally{q===N.current&&y(!1)}},[z,d,i,o]),A=S.useCallback(V=>{r(V),i.length>0&&h(!0)},[i.length]),E=S.useCallback(V=>{c(V),d||z(i,V)},[z,d,i]),F=S.useCallback((V,G)=>{const ne=V+G,q=[...i],M=q[ne];q[ne]=q[V],q[V]=M;const D=o===V?ne:o===ne?V:o;s(q),c(D),d||z(q,D)},[z,d,i,o]),K=S.useCallback(V=>{const G=i.filter((q,M)=>M!==V),ne=G.length===0?0:Math.min(o>=V?Math.max(0,o-1):o,Math.max(0,G.length-1));s(G),c(ne),G.length===0?h(!1):d||z(G,ne)},[z,d,i,o]),O=S.useCallback(()=>{s([]),c(0),h(!1),g(null)},[]),P=S.useCallback(()=>{d&&!window.confirm("将用当前文件列表重新合成正文,覆盖你在编辑区的修改。继续?")||(z(i,o),g(null))},[z,d,i,o]),Y=S.useCallback((V,G)=>{V.preventDefault(),V.stopPropagation(),!G&&(w.current+=1,b(!0))},[]),le=S.useCallback(V=>{V.preventDefault(),V.stopPropagation(),w.current=Math.max(0,w.current-1),w.current===0&&b(!1)},[]),_=S.useCallback((V,G)=>{V.preventDefault(),V.stopPropagation(),w.current=0,b(!1),!G&&R(V.dataTransfer.files)},[R]);return{prdText:e,setPrdText:r,onPrdTextChange:A,prdDocuments:i,prdPrimaryIndex:o,prdComposedDirty:d,prdFileError:p,setPrdFileError:g,prdFileReading:v,prdDragOver:k,loadPrdFromFiles:R,applyPrdComposition:z,setPrimaryDocument:E,moveDocument:F,removeDocument:K,clearDocuments:O,recomposeDocuments:P,onDragEnter:Y,onDragLeave:le,onDrop:_}}const DI={report:{id:"report",label:"查看报告",action:"dagReport",lane:"dag",guide:"看失败分类与建议动作(交接报告摘要)",commandHint:"loop-agent dag report --run-id <run-id> --json"},doctor:{id:"doctor",label:"Doctor 诊断",action:"doctor",lane:"dag",guide:"只读诊断:检查 Console / Pi / 仓库就绪,不是重跑前置",commandHint:"agent-worker console doctor --repo ."},decision:{id:"decision",label:"人工决策",lane:"dag",guide:"暂停等人时:先看 doctor 输出再做决策(经 CLI)",commandHint:"loop-agent dag doctor --run-id <run-id> --markdown"},resume:{id:"resume",label:"恢复运行",lane:"dag",guide:"仅当运行可安全 resume 时使用(经 CLI)",commandHint:"loop-agent task advance <task-id> --json"},reconcile:{id:"reconcile",label:"对账 / reconcile",requiresReason:!0,action:"dagReconcileRun",lane:"dag",guide:"Orphan/中断时先对账归档(默认 supersede);runner 仍存活时勿盲 supersede",commandHint:"loop-agent dag reconcile-run --run-id <run-id> --action supersede --reason <structured-reason>"},regenerate:{id:"regenerate",label:"重新生成契约/计划",lane:"dag",guide:"契约/计划过期时:回任务页或经 CLI 重新 task advance(本页仅提示)",commandHint:"loop-agent task advance <task-id> --json"},observeLink:{id:"observeLink",label:"全屏观测",action:"observeLink",lane:"dag",guide:"打开完整 Inspect 画布;顶栏可返回操作台",commandHint:"agent-worker console --repo . --port 8790"},dagRerun:{id:"dagRerun",label:"从节点重跑",requiresReason:!0,action:"dagRerun",lane:"dag",guide:"终端失败默认首选:先 dagRerunPlan,plan 合格后直接执行(无需 Human Gate)。Worker 持有的 run、workspace/controller 漂移或含 unsafe shell 时不要强跑子图",commandHint:"loop-agent dag rerun --run-id <run-id> --from-node <node-id> --plan"},standaloneTaskRerun:{id:"standaloneTaskRerun",label:"完整重跑任务",requiresReason:!0,action:"standaloneTaskRerun",lane:"dag",guide:"独立 DAG run 整单重跑:仅当 from-node plan 不合格时直调执行,服务端校验 run facts,无需 Human Gate。Worker 持有的 run 请用下方「重新排队 Worker Task」",commandHint:"loop-agent dag rerun-task --run-id <run-id> --reason <text> --json"},workerTaskRetry:{id:"workerTaskRetry",label:"重新排队 Worker Task",requiresReason:!0,action:"workerTaskRetry",lane:"worker",guide:"仅 Worker 队列任务失败时直调执行,服务端校验 Failed 状态,无需 Human Gate;不要与 DAG 完整重跑混用",commandHint:"agent-worker task retry <task-id> --feature-id <feature-id> --repo . --reason <reason>"},interrupt:{id:"interrupt",label:"中止运行",requiresReason:!0,action:"dagRequestInterrupt",lane:"dag",guide:"仅本机 Console 持有的正在运行 DAG:经 Human Gate 登记协作中止,等待当前节点安全收敛。不会立即强杀进程",commandHint:"loop-agent dag request-interrupt --run-id <run-id> --reason-code operator-request --reason <structured-reason>"}},xy={"validation-failed":["report","doctor","regenerate"],"contract-drift":["report","doctor","decision","reconcile","regenerate"],"runtime-mismatch":["report","doctor","reconcile","regenerate"],"pause-on-human":["decision","resume","report","doctor"],"verification-failed":["report","doctor","dagRerun","standaloneTaskRerun","resume","regenerate"],"orphan-unknown":["report","doctor"],"terminal-failed":["report","doctor","dagRerun","standaloneTaskRerun","workerTaskRetry","regenerate"],"terminal-succeeded":["report","observeLink"],"needs-reconcile":["report","doctor","reconcile","regenerate"],"running-active":["interrupt","report","doctor","observeLink"]},OI=new Set(["succeeded","failed","timed-out"]);function MI(e){const r=(e.interruptStatus??"").trim();if(!r||r==="none")return null;if(r==="requested")return"请求已登记,等待 runner 确认。";if(r==="acknowledged")return"等待当前节点安全收敛(不会立即强杀)。";if(r==="needs-reconcile")return"需要对账:中止请求未能确认。";if(r==="settled"){const i=e.dagStatus==="failed"||e.dagStatus==="partial_failed",s=(e.failureCategory??"").includes("controller-interrupted"),o=OI.has(e.targetOperationState??"");return i&&s&&o?"已中止。":"正在对账,尚未确认退出。"}return null}function _I(e){return(xy[e]??xy["orphan-unknown"]).map(i=>DI[i])}function LI(e){const r=[],i=[];for(const s of e)s.lane==="worker"?i.push(s):r.push(s);return{dag:r,worker:i}}function zI(e){return typeof e.action=="string"&&e.action.trim().length>0}function Sb(e){return _I(e).filter(zI)}function BI(e){const r=new Set(Sb(e).map(s=>s.id)),i=(...s)=>{for(const o of s)if(r.has(o))return o;return null};switch(e){case"terminal-failed":case"verification-failed":return i("dagRerun","standaloneTaskRerun","doctor","report");case"pause-on-human":return i("doctor","report");case"needs-reconcile":return i("doctor","reconcile","report");case"running-active":return i("interrupt","doctor","report");case"runtime-mismatch":case"contract-drift":return i("doctor","report");case"validation-failed":return i("doctor","report");case"terminal-succeeded":return i("observeLink","report");default:return i("doctor","report")}}function HI(e){if(e.needsReconcile)return"needs-reconcile";const r=(e.errorCode??"").toLowerCase(),i=(e.operationState??"").toLowerCase(),s=(e.dagStatus??"").toLowerCase(),o=(e.failureCategory??"").toLowerCase();return r.includes("validation")||r.includes("invalid")||i.includes("validation")?"validation-failed":r.includes("contract")||r.includes("drift")||r.includes("binding")?"contract-drift":r.includes("runtime")||r.includes("mismatch")||r.includes("fingerprint")?"runtime-mismatch":r.includes("human")||i.includes("paused")||s.includes("paused")||i.includes("awaiting")?"pause-on-human":r.includes("verif")||i.includes("verif")?"verification-failed":o==="controller-interrupted"||r.includes("controller-interrupted")||r.includes("interrupted")||s==="interrupted"||s==="orphaned"||i.includes("controller-interrupted")||i.includes("interrupted")?"needs-reconcile":s==="running-suspected-stall"||s==="running-quiet"||s==="suspected-stall"||s.includes("suspected-stall")||i.includes("suspected-stall")?"orphan-unknown":s==="running"||s==="active"?"running-active":i==="succeeded"||i==="completed"||i==="finished"||s==="succeeded"||s==="completed"||s==="finished"?"terminal-succeeded":i==="failed"||i.includes("fail")||s==="failed"||s==="partial_failed"||r.includes("fail")?"terminal-failed":r.includes("reconcil")||i.includes("reconcil")?"needs-reconcile":"orphan-unknown"}const Yd=new Set(["failed","error","partial_failed"]),kb=new Set(["blocked","paused","awaiting_human"]);function po(e){return(e??"").trim().toLowerCase()}function UI(e){return Yd.has(po(e))}function Sy(e){const r=po(e.status);return Yd.has(r)||r.includes("fail")?0:e.lifecycle==="paused"||r==="paused"?1:e.lifecycle==="active"?2:3}function qI(e){return[...e].sort((r,i)=>{const s=Sy(r)-Sy(i);return s!==0?s:i.mtimeMs-r.mtimeMs})}function $I(e){return qI(e)[0]?.dagRunId}function ky(e){const r=po(e.status);return Yd.has(r)?0:kb.has(r)?1:2}function wb(e){return[...e].sort((r,i)=>{const s=ky(r)-ky(i);return s!==0?s:r.nodeId.localeCompare(i.nodeId)})}function GI(e){const r=wb(e);return r.find(s=>UI(s.status)||kb.has(po(s.status)))?.nodeId??r[0]?.nodeId}function FI(e){const r=e.status?.trim()||e.lifecycle;return`${e.dagRunId.length>36?`${e.dagRunId.slice(0,18)}…${e.dagRunId.slice(-8)}`:e.dagRunId} · ${r}`}function PI(e){const r=e.status?.trim()||"unknown",i=e.label?.trim();return i&&i!==e.nodeId?`${e.nodeId} · ${r} · ${i}`:`${e.nodeId} · ${r}`}function VI(e){const i=[`operator-recovery: ${e.actionLabel?.trim()||"恢复"}`],s=e.dagRunId?.trim();if(s){const h=e.runStatus?.trim();i.push(h?`run=${s} (${h})`:`run=${s}`)}const o=e.fromNodeId?.trim();if(o){const h=e.nodeStatus?.trim();i.push(h?`from-node=${o} (${h})`:`from-node=${o}`)}const c=e.factClassLabel?.trim();c&&i.push(`fact=${c}`);const d=e.nodeError?.trim()||e.errorMessage?.trim()||(e.errorCode?.trim()?`code=${e.errorCode.trim()}`:"");return d&&i.push(`detail=${d.replace(/\s+/g," ").slice(0,280)}`),i.join(`
|
|
58
|
+
`).slice(0,500)}function Cb(e){const r=e.trim();return r?r==="operator-recovery"||r.startsWith("operator-recovery:")||r.startsWith("recovery:"):!0}async function wy(e){const r=await e.runAction("prepareMutationGate",{action:e.action,actionParams:e.actionParams});if(!e.isActionSuccess(r))return;const i=r?.result??r,s=i.receiptId?i:i.result??i;if(!s.receiptId||!s.humanGateToken){e.setOpError("prepareMutationGate 未返回可消费的 Human Gate receipt");return}await e.runAction(e.action,{...e.actionParams,confirmationId:s.receiptId,humanGateToken:s.humanGateToken},{clientRequestId:e.clientRequestId})}function YI(e){const{shell:r,actions:i,taskId:s,dagRunId:o,fromNodeId:c,featureId:d,recoveryReason:h,recoveryReasonTouched:p,recoveryConfirm:g,recoveryPlanSummary:v,interruptReasonCode:y,setRecoveryConfirm:k,setRecoveryPlanSummary:b,setRecoveryReport:w,setRecoveryReason:N,setRecoveryReasonTouched:z,buildCurrentRecoveryReason:R,openFullCanvas:A}=e,{setOpError:E,setOpErrorCode:F,setOpMessage:K,setBusy:O}=r,{runAction:P,isActionSuccess:Y}=i,le=S.useCallback(async V=>{if(V.requiresReason||(k(null),b(null)),V.action==="doctor"){w(null),P("doctor",{});return}if(V.action==="dagReport"||V.id==="report"){const G=o.trim();if(G){k(null),b(null);const ne=await P("dagReport",{runId:G}),q=ne?.result??{},M=(q.raw?.runs??q.runs)?.[0];ne&&ne.ok!==!1&&!ne.error&&M&&(w({runId:M.runId??G,title:M.title,status:M.status,category:M.productLineFailureCategory,recommendation:M.recoveryRecommendation?.summary??M.recommendedFollowUp??void 0}),K(null));return}if(s.trim()){w(null),P("status",{taskId:s});return}E("查看报告需要先选择 DAG 运行 ID(或填写任务 ID)");return}if(V.action==="observeLink"){w(null),A();return}if(V.requiresReason){if(w(null),k(V),b(null),V.id!=="dagRerun"&&(E(null),F(null)),(!p||Cb(h))&&(N(R(V.label)),z(!1)),V.id==="dagRerun"&&o.trim()&&c.trim()){O(!0);try{const{status:G,body:ne}=await ro("dagRerunPlan",{runId:o.trim(),fromNode:c.trim()}),q=ne.result??{};q&&typeof q=="object"&&("eligible"in q||q.planHash)&&b(q),G<400&&ne.ok!==!1&&q.eligible!==!1?K(null):q.eligible===!1?E(yr(rd(q,ne.error?.message))):K(ne.error?.message??"无法预检重跑计划;确认后仍将尝试提交(CLI 可能尚未就绪)")}finally{O(!1)}}return}E(null),F(null),K(`${V.label}:请经 CLI — ${V.commandHint??""}`)},[R,o,c,A,h,p,P,O,E,F,K,k,b,w,N,z,s]),_=S.useCallback(async()=>{const V=g;if(!V)return;const G=h.trim();if(!G){E("恢复操作需要结构化原因");return}const ne=no(`recovery-${V.id}`);if(k(null),V.id==="dagRerun"){const q=o.trim(),M=c.trim();if(!q||!M){E("从节点重跑需要 DAG 运行 ID 与起始节点 ID");return}let D=v?.planHash?.trim(),H=v?.eligible;if(!D||H===void 0){const B=await P("dagRerunPlan",{runId:q,fromNode:M}),te=B?.result??{};if((te.planHash||te.eligible!==void 0)&&b(te),D=te.planHash?.trim()||D,H=te.eligible,te.eligible===!1){E(yr(rd(te,B?.error?.message)));return}if(B&&B.ok===!1&&!D){E(B.error?.message??"无法获取 planHash;请确认 loop-agent dag rerun --plan 可用");return}}if(H===!1){E(yr(rd(v??{})));return}if(!D){E("无法获取 planHash;请确认 loop-agent dag rerun --plan 可用");return}await P("dagRerun",{runId:q,fromNode:M,planHash:D,reason:G},{clientRequestId:ne});return}if(V.id==="standaloneTaskRerun"){const q=o.trim();if(!q){E("完整重跑任务需要 DAG 运行 ID");return}await P("standaloneTaskRerun",{runId:q,reason:G,...s.trim()?{taskId:s.trim()}:{}},{clientRequestId:ne});return}if(V.id==="workerTaskRetry"){const q=s.trim();if(!q){E("重新排队 Worker Task 需要任务 ID");return}await P("workerTaskRetry",{taskId:q,reason:G,...d.trim()?{featureId:d.trim()}:{}},{clientRequestId:ne});return}if(V.id==="interrupt"){const q=o.trim();if(!q){E("中止运行需要 DAG 运行 ID");return}if(G.trim().length<10||G.trim().length>500){E("中止原因去首尾空白后必须是 10–500 个字符,请手写说明,不要用占位句。");return}await wy({runAction:P,isActionSuccess:Y,setOpError:E,action:"dagRequestInterrupt",actionParams:{runId:q,reasonCode:y.trim()||"operator-request",reasonDetail:G},clientRequestId:ne});return}if(V.id==="reconcile"){const q=o.trim();if(!q){E("对账恢复需要 DAG 运行 ID");return}await wy({runAction:P,isActionSuccess:Y,setOpError:E,action:"dagReconcileRun",actionParams:{runId:q,reason:G,reconcileAction:"supersede"},clientRequestId:ne});return}K(`${V.label}:请经 CLI — ${V.commandHint??""}`)},[o,d,c,g,v?.planHash,h,y,P,Y,E,K,k,b,s]);return{handleRecoveryCta:le,submitRecoveryConfirm:_}}function KI(e){const{shell:r,actions:i,wizard:s}=e,{nav:o,opError:c,opErrorCode:d,lastOpState:h,setOpError:p,setObserveBusy:g}=r,{taskId:v}=s,[y,k]=S.useState(""),[b,w]=S.useState(""),[N,z]=S.useState(""),[R,A]=S.useState(""),[E,F]=S.useState(!1),[K,O]=S.useState(null),[P,Y]=S.useState(null),[le,_]=S.useState(!1),[V,G]=S.useState("operator-request"),[ne,q]=S.useState(null),[M,D]=S.useState([]),[H,B]=S.useState([]),[te,T]=S.useState(!1),[I,U]=S.useState(!1),[C,ae]=S.useState(null),[W,Q]=S.useState(null),[ue,me]=S.useState(null),[ge,fe]=S.useState(!1),[Se,Me]=S.useState(!1),[et,Ue]=S.useState(null),[ct,Jt]=S.useState("idle"),[Kt,Nt]=S.useState(null),[Wt,Gt]=S.useState(null),[Ee,Te]=S.useState(!1),pt=S.useCallback(()=>y.trim()?`/inspect/#/dag/${encodeURIComponent(y.trim())}?from=recovery`:"/inspect/#/",[y]),qe=S.useCallback(()=>{window.location.assign(pt())},[pt]),_e=S.useCallback(async()=>{if(y.trim())return y.trim();const Ie=v.trim();if(!Ie)return p("打开 DAG 检视需要任务 ID 或 DAG 运行 ID"),null;g(!0),p(null);try{const{status:Ye,body:Ke}=await ro("observeLink",{taskId:Ie}),ut=Ke.result??{};if(Ye>=400||Ke.ok===!1)return p(Ke.error?.message??"无法解析 DAG 画布地址"),Jt("unavailable"),Nt(Ke.error?.message??null),null;const wt=typeof ut.dagRunId=="string"?ut.dagRunId.trim():"";return wt?(k(wt),Jt("match"),Nt(null),Gt(`/inspect/#/dag/${encodeURIComponent(wt)}`),wt):(p("尚未找到该任务的 DAG 运行,请稍后再打开检视"),Jt("unavailable"),Nt(ut.message??"未解析到 DAG run"),null)}catch(Ye){return p(Ye instanceof Error?Ye.message:String(Ye)),null}finally{g(!1)}},[y,v,p,g]),se=S.useCallback(async()=>{await _e()&&Te(!0)},[_e]),he=S.useCallback(async()=>{const Ie=await _e();Ie&&window.location.assign(`/inspect/#/dag/${encodeURIComponent(Ie)}?from=recovery`)},[_e]),be=S.useCallback(async()=>{T(!0);try{const Ie=v.trim(),Ye=new URLSearchParams;Ie&&Ye.set("taskId",Ie),Ye.set("limit","40");const Ke=await fetch(`/api/operator/v1/recovery/candidates?${Ye.toString()}`,{credentials:"same-origin"});if(!Ke.ok){D([]);return}const ut=await Ke.json();D(Array.isArray(ut.runs)?ut.runs:[])}catch{D([])}finally{T(!1)}},[v]),we=S.useCallback(async Ie=>{const Ye=Ie.trim();if(!Ye){B([]),ae(null),Q(null),me(null);return}U(!0);try{const Ke=await fetch(`/api/dag-runs/${encodeURIComponent(Ye)}`,{credentials:"same-origin"});if(!Ke.ok){B([]),ae(null),Q(null);return}const ut=await Ke.json(),wt=typeof ut.effectiveStatus=="string"&&ut.effectiveStatus||typeof ut.status=="string"&&ut.status||null;ae(wt);const Mt=Array.isArray(ut.nodes)?ut.nodes:[],re=wb(Mt.map(Xe=>{const _t=(Xe.nodeId??Xe.id??"").trim();return _t?{nodeId:_t,status:Xe.status,label:Xe.label??Xe.name,errorPreview:Xe.errorPreview}:null}).filter(Xe=>Xe!==null));B(re);const ke=typeof ut.failureCategory=="string"&&ut.failureCategory||void 0,gt=Mt.find(Xe=>typeof Xe.failureCategory=="string"&&Xe.failureCategory&&Xe.failureCategory!=="success")?.failureCategory;Q(ke??gt??null),me(ut.frontendRecovery??null)}catch{B([]),ae(null),Q(null),me(null)}finally{U(!1)}},[]);S.useEffect(()=>{o==="recovery"&&be()},[o,v,be]),S.useEffect(()=>{if(o!=="recovery"||ge||M.length===0)return;const Ie=y.trim(),Ye=Ie?M.some(Ke=>Ke.dagRunId===Ie):!1;if(!Ie||!Ye){const Ke=$I(M);Ke&&Ke!==Ie&&k(Ke)}},[o,M,y,ge]),S.useEffect(()=>{o==="recovery"&&we(y)},[o,y,we]),S.useEffect(()=>{if(o!=="recovery")return;const Ie=y.trim();if(!Ie){q(null);return}let Ye=!1;const Ke=async()=>{const{body:wt}=await ro("dagInterruptEligibility",{runId:Ie});if(Ye)return;const Mt=wt.result??wt;q({eligible:Mt.eligible===!0,ownerKind:Mt.ownerKind,message:Mt.message,interruptStatus:Mt.interruptStatus,reasonCodes:Mt.reasonCodes,targetOperationId:Mt.targetOperationId,targetOperationState:Mt.targetOperationState})};Ke();const ut=window.setInterval(()=>{Ke()},4e3);return()=>{Ye=!0,window.clearInterval(ut)}},[o,y]),S.useEffect(()=>{if(o!=="recovery"||Se||H.length===0)return;const Ie=b.trim(),Ye=Ie?H.some(Ke=>Ke.nodeId===Ie):!1;if(!Ie||!Ye){const Ke=GI(H);Ke&&Ke!==Ie&&w(Ke)}},[o,H,b,Se]);const je=HI({operationState:C?null:h,errorCode:C?null:d,dagStatus:C,failureCategory:W}),Je=S.useMemo(()=>{const Ie=Sb(je);return je!=="running-active"||ne?.eligible?Ie:Ie.filter(Ye=>Ye.id!=="interrupt")},[je,ne?.eligible]),It=S.useMemo(()=>LI(Je),[Je]),mt=S.useMemo(()=>BI(je),[je]),Le=S.useMemo(()=>H.find(Ie=>Ie.nodeId===b.trim()),[H,b]),At=S.useRef(null);S.useEffect(()=>{P&&At.current?.scrollIntoView({behavior:"smooth",block:"nearest"})},[P?.id]);const $e=S.useCallback(Ie=>VI({actionLabel:Ie,dagRunId:y.trim()||void 0,fromNodeId:b.trim()||void 0,runStatus:C,nodeStatus:Le?.status,nodeError:Le?.errorPreview,factClassLabel:bb[je],errorMessage:c,errorCode:d}),[y,b,c,d,je,C,Le?.errorPreview,Le?.status]);S.useEffect(()=>{if(o!=="recovery"||E&&!Cb(R))return;const Ie=$e(P?.label);Ie&&Ie!==R&&A(Ie)},[o,y,b,C,Le,je,c,d,P?.label,E,R,$e]);const{handleRecoveryCta:dn,submitRecoveryConfirm:Ft}=YI({shell:r,actions:i,taskId:v,dagRunId:y,fromNodeId:b,featureId:N,recoveryReason:R,recoveryReasonTouched:E,recoveryConfirm:P,recoveryPlanSummary:K,interruptReasonCode:V,setRecoveryConfirm:Y,setRecoveryPlanSummary:O,setRecoveryReport:Ue,setRecoveryReason:A,setRecoveryReasonTouched:F,buildCurrentRecoveryReason:$e,openFullCanvas:he});return S.useEffect(()=>{if(o!=="recovery"||!le||!ne?.eligible)return;const Ie=Je.find(Ye=>Ye.id==="interrupt");Ie&&(Y(Ie),A($e(Ie.label)),F(!1),_(!1))},[o,le,ne?.eligible,Je,$e]),{dagRunId:y,setDagRunId:k,fromNodeId:b,setFromNodeId:w,featureId:N,setFeatureId:z,recoveryReason:R,setRecoveryReason:A,recoveryReasonTouched:E,setRecoveryReasonTouched:F,recoveryPlanSummary:K,recoveryConfirm:P,setRecoveryConfirm:Y,setRecoveryPlanSummary:O,recoveryRuns:M,recoveryNodes:H,recoveryRunsLoading:te,recoveryNodesLoading:I,recoveryRunStatus:C,recoveryFailureCategory:W,frontendRecovery:ue,manualRunId:ge,setManualRunId:fe,manualNodeId:Se,setManualNodeId:Me,recoveryReport:et,setRecoveryReport:Ue,observeLinkStatus:ct,observeLinkMessage:Kt,observeUrl:Wt,inspectSplitOpen:Ee,setInspectSplitOpen:Te,inspectPath:pt,openFullInspect:qe,resolveDagRunForInspect:_e,openInspectSplit:se,openFullCanvas:he,loadRecoveryRuns:be,loadRecoveryNodes:we,recoveryFact:je,recoveryCtas:Je,recoveryLanes:It,recommendedCtaId:mt,interruptIntent:le,setInterruptIntent:_,interruptReasonCode:V,setInterruptReasonCode:G,interruptEligibility:ne,recoveryConfirmRef:At,buildCurrentRecoveryReason:$e,handleRecoveryCta:dn,submitRecoveryConfirm:Ft}}function XI(e){const{shell:r,actions:i,prd:s}=e,{step:o,setStep:c,setOpMessage:d}=r,{runAction:h,isActionSuccess:p,summarizeEnvelope:g}=i,[v,y]=S.useState(""),[k,b]=S.useState(""),[w,N]=S.useState("standard"),[z,R]=S.useState(""),[A,E]=S.useState(""),[F,K]=S.useState(""),O=vd.find(Ee=>Ee.kind===w)??vd[0],[P,Y]=S.useState(null),[le,_]=S.useState(null),[V,G]=S.useState(""),[ne,q]=S.useState(null),[M,D]=S.useState(null),[H,B]=S.useState(null),[te,T]=S.useState(null),[I,U]=S.useState(null),[C,ae]=S.useState(!1),[W,Q]=S.useState(null),[ue,me]=S.useState(null),ge=S.useRef(!1),fe=S.useCallback(()=>{B(null),T(null),U(null),ae(!1),Q(null),me(null),ge.current=!1},[]),Se=S.useCallback(()=>{fe(),c("contract")},[fe,c]),Me=S.useCallback(Ee=>{const Te=Ee.session;Te?.sessionId&&Y(Te.sessionId);const pt=Ee.question;_(pt),q(Ee.summary??null);const qe=Ee.assessmentId;typeof qe=="string"&&qe&&D(qe),(Ee.complete===!0||typeof qe=="string"&&qe)&&(Se(),d(Ee.skipped===!0?"已跳过访谈:已按推荐补齐草稿并签发评估":"访谈已完成:草稿已绑定完整评估结果"))},[Se,d]),et=S.useCallback(async(Ee=!1)=>{const Te=v.trim();if(!Te)return;const pt=`${Te}:${M??""}`;if(!(!Ee&&ue===pt&&H!==null)&&!ge.current){ge.current=!0,B(null),T(null),U(null),Q(null),ae(!1);try{const qe=await h("contractValidate",{taskId:Te}),_e=p(qe);if(B(_e),T(g(qe)),!_e){me(pt),d("契约校验未通过:请先修正草稿后再应用");return}const se=await h("contractDiff",{taskId:Te});U(g(se)),me(pt),d(p(se)?"校验与差异已就绪:确认后可应用契约":"校验通过,但差异查询失败(仍可查看下方摘要)")}finally{ge.current=!1}}},[M,ue,H,p,h,d,g,v]),Ue=S.useCallback(async()=>{const Ee=v.trim();if(!Ee||!M)return;const Te=await h("contractApply",{taskId:Ee,assessmentId:M},{clientRequestId:no("apply")});if(!p(Te)){ae(!1);return}ae(!0);const pt=await h("spineCheck",{taskId:Ee});if(p(pt)){Q(!0),c("dag-confirm"),d("契约已应用并通过 Spine 审计,可生成并运行 DAG");return}Q(!1),d("契约已应用,但 Spine 审计未通过:可重试 Spine")},[M,p,h,d,c,v]),ct=S.useCallback(async()=>{const Ee=v.trim();if(!Ee)return;const Te=await h("spineCheck",{taskId:Ee});if(p(Te)){Q(!0),c("dag-confirm"),d("Spine 审计已通过,可生成并运行 DAG");return}Q(!1)},[p,h,d,c,v]),Jt=S.useCallback(async()=>{const Ee=i.confirmationId?.trim();if(!Ee)return;const Te=i.confirmationDetails?.confirmation?.humanGateToken,pt=await h("confirmDagConfirmation",{confirmationId:Ee,humanGateToken:Te});p(pt)&&(c("run"),await h("runDag",{confirmationId:Ee},{clientRequestId:no("run")}))},[i.confirmationId,i.confirmationDetails,p,h,c]);S.useEffect(()=>{o==="contract"&&v.trim()&&et(!1)},[o,v,M,et]);const Kt=S.useCallback(Ee=>Ee.split(/[\n,;,;]+/).map(Te=>Te.trim()).filter(Boolean),[]),Nt=S.useCallback(async()=>{const Ee=s.prdDocuments.length>0?TI(s.prdDocuments):void 0,Te=Kt(z),pt=Kt(A),qe=Kt(F),_e={content:s.prdText,taskKind:w,...Ee?{documents:Ee}:{},...Te.length>0?{allowedPaths:Te}:{},...pt.length>0?{forbiddenPaths:pt}:{},...qe.length>0?{verifyCommands:qe}:{}};if(!NI("bootstrapFromPrd",_e)){s.setPrdFileError(II());return}const se=await h("bootstrapFromPrd",_e);if(!se||se.ok===!1)return;const he=se.result??{};he.taskId&&y(he.taskId),he.title&&b(he.title);const be=he.parseStatus??"pending",we=he.draftPreview?.objective?.trim(),je=Array.isArray(he.gaps)?he.gaps.length:0,Je=he.semanticIntake?.applied?"semantic":he.semanticIntake?.code??"no-semantic",It=(he.autoImportedReferences??[]).filter(Le=>Le.repoRelative),mt=(he.unresolvedReferences??[]).filter(Le=>Le.token);d([`已创建任务「${he.title??""}」(${he.taskId??""})`,`来源:${he.identitySource??"prd"}`,`解析:${be}(${Je})`,we?`目标:${we.slice(0,120)}`:null,je>0?`缺口 ${je} 项待确认`:null,It.length>0?`已自动导入 ${It.length} 个引用文档(${It.map(Le=>`${Le.repoRelative}${Le.role?`:${Le.role}`:""}`).join("、")})`:null,mt.length>0?`有 ${mt.length} 个引用未能解析:${mt.map(Le=>`${Le.token}(${Le.reason??"未知原因"})`).join("、")}`:null].filter(Boolean).join(" · ")),c("interview")},[z,A,s,h,d,c,Kt,w,F]),Wt=[{id:"setup",label:"就绪检查"},{id:"import-prd",label:"导入需求"},{id:"interview",label:"需求访谈(可跳过)"},{id:"contract",label:"契约落地"},{id:"dag-confirm",label:"确认 DAG"},{id:"run",label:"运行"}],Gt=Wt.findIndex(Ee=>Ee.id===o);return{taskId:v,setTaskId:y,taskTitle:k,taskKind:w,setTaskKind:N,engineering:{allowedPathsText:z,forbiddenPathsText:A,verifyCommandsText:F},setEngineering:Ee=>{Ee.allowedPathsText!==void 0&&R(Ee.allowedPathsText),Ee.forbiddenPathsText!==void 0&&E(Ee.forbiddenPathsText),Ee.verifyCommandsText!==void 0&&K(Ee.verifyCommandsText)},workflowMeta:O,sessionId:P,question:le,answerText:V,setAnswerText:G,draftSummary:ne,assessmentId:M,contractValidateOk:H,contractValidateSummary:te,contractDiffSummary:I,contractApplied:C,spineOk:W,applyInterviewPayload:Me,runContractPreflight:et,applyContractThenSpine:Ue,retrySpineOnly:ct,confirmAndRunDag:Jt,importPrdAndCreate:Nt,wizardSteps:Wt,stepIndex:Gt}}const QI={chat:"对话",tasks:"任务",recovery:"恢复",night:"夜间",models:"模型与认证",settings:"设置"};async function ZI(e){return await import(e)}function JI(e){const r=e.repoName?.trim();if(r)return r;const i=(e.repoRoot??"").split(/[\\/]/).filter(Boolean);return i.length?i[i.length-1]:"repository"}function WI(e){const{nav:r,readiness:i,setupBlocked:s,degraded:o,health:c,inspectHref:d}=e,h=s||o?"models":"settings",p=s?"Pi SDK / 认证 / 模型未就绪。不提供纯表单兜底。点击前往模型与认证。":o?"Pi 暂时降级:仍可恢复草稿与需求访谈。点击查看详情。":"Pi 已就绪。点击打开设置查看详情。";return{mode:"operate",activeTabHref:`#/${r}`,operateHref:"/#/",inspectHref:d,freshness:!1,readinessState:i,readinessHref:`#/${h}`,readinessTitle:p,repo:c?{name:JI(c),fingerprint:c.repoFingerprint??"",version:c.packageVersion??"",product:c.productName??c.product??"",inspectReady:c.inspect?.ready}:null}}function eA(e){const r=S.useRef(null),i=S.useRef(null),[s,o]=S.useState(!1),c=S.useMemo(()=>WI(e),[e.nav,e.readiness,e.setupBlocked,e.degraded,e.health,e.inspectHref]),d=S.useRef(c);return d.current=c,S.useEffect(()=>{let h=!1;return ZI("/inspect/operator-chrome.js").then(p=>{h||!r.current||(i.current=p.mountOperatorChrome(r.current,d.current))}).catch(()=>{h||o(!0)}),()=>{h=!0,i.current?.destroy(),i.current=null}},[]),S.useEffect(()=>{i.current?.update(c)},[c]),u.jsxs(u.Fragment,{children:[u.jsx("div",{ref:r,"data-testid":"operator-chrome"}),s?u.jsxs("nav",{className:"operator-chrome-fallback","aria-label":"操作工作区",children:[u.jsx("button",{type:"button",onClick:()=>window.location.assign("/#/"),children:"Loop Agent"}),u.jsx("button",{type:"button",onClick:()=>window.location.assign(`#/${e.nav}`),children:QI[e.nav]}),u.jsx("button",{type:"button",onClick:()=>window.location.assign(e.inspectHref),children:"观测"}),u.jsx("span",{role:"status",children:"共享导航加载失败,请刷新页面"})]}):null]})}function tA(e){return u.jsxs(u.Fragment,{children:[e.opError?u.jsxs("div",{className:"flash flash-error","data-testid":"op-error",children:[u.jsx("span",{className:"flash-label",children:"错误"}),u.jsx("p",{className:"flash-body",children:e.opError})]}):null,e.opMessage?u.jsxs("div",{className:"flash flash-info","data-testid":"op-message",children:[u.jsx("span",{className:"flash-label",children:"状态"}),u.jsx("p",{className:"flash-body",children:e.opMessage})]}):null]})}const nA=[{key:"sdkAvailable",detailKey:"sdkMessage",label:"Pi SDK",hint:"Node 侧 Pi SDK 可加载"},{key:"authReady",detailKey:"authMessage",label:"认证凭据",hint:"Pi auth / provider 密钥已配置"},{key:"modelsAvailable",detailKey:"modelsMessage",label:"可用模型",hint:"harness.json executors.pi(LOW/MED/HIGH)可在 Pi 凭据面解析"},{key:"interviewSessionOk",detailKey:"sessionMessage",label:"访谈会话",hint:"Interview 会话预检通过"}];function rA(e){if(!e)return null;const r=Date.parse(e);return Number.isNaN(r)?e:new Date(r).toLocaleString()}function iA(e){const r=e.readinessReport?.state??e.readiness,i=e.readinessReport?.probe,s=i?.details??{},o=e.readinessReport?.blockedActions??[],c=rA(e.readinessReport?.generatedAt),d=e.readinessReport??{state:e.readiness,health:e.health};return u.jsxs("section",{className:"panel models-page","aria-labelledby":"models-title",children:[u.jsxs("div",{className:"models-header",children:[u.jsx("h2",{id:"models-title",children:"模型与认证"}),u.jsx("span",{className:"models-status-pill","data-state":r,"data-testid":"models-readiness-pill",children:yb[r]??r})]}),u.jsxs("p",{className:"panel-lead",children:["复用 Pi ModelRuntime 凭据平面;密钥不会回传到页面。请用"," ",u.jsx("code",{children:"pi"})," 或 Pi 认证存储完成配置,然后刷新就绪探测。"]}),u.jsxs("section",{className:"models-probe-card","aria-labelledby":"models-probe-title","data-testid":"readiness-details",children:[u.jsx("h3",{id:"models-probe-title",className:"models-subtitle",children:"就绪检查"}),u.jsx("ul",{className:"models-probe-list",children:nA.map(h=>{const p=i?.[h.key],g=s[h.detailKey],v=p===void 0;return u.jsxs("li",{className:`models-probe-item${v?" is-pending":p?" is-ok":" is-bad"}`,children:[u.jsx("span",{className:"models-probe-badge","aria-label":v?"未探测":p?"通过":"未通过",children:v?"—":p?"✓":"✕"}),u.jsxs("div",{className:"models-probe-body",children:[u.jsx("strong",{children:h.label}),u.jsx("span",{className:"muted",children:h.hint}),g?u.jsx("p",{className:"models-probe-detail",children:g}):null]})]},h.key)})})]}),r==="setup-required"?u.jsxs("div",{className:"models-setup-card","data-testid":"models-setup-hint",children:[u.jsx("h3",{className:"models-subtitle",children:"如何完成配置"}),u.jsxs("ol",{className:"models-setup-steps",children:[u.jsxs("li",{children:["在终端配置 Pi 认证(例如 ",u.jsx("code",{children:"pi auth login"}),")或写入 provider API key。"]}),u.jsxs("li",{children:["确认 agent 目录下 ",u.jsx("code",{children:"models.json"})," / 认证文件可读。"]}),u.jsx("li",{children:"点击下方「刷新就绪探测」,或运行诊断命令查看详情。"})]}),u.jsx("pre",{className:"cmd",children:gb})]}):null,r==="degraded"?u.jsx("p",{className:"models-degraded-note","data-testid":"models-degraded-note",children:"Pi 暂时降级:仍可恢复草稿与需求访谈;部分写入/运行类操作会被拦截。"}):null,o.length>0?u.jsxs("div",{className:"models-blocked-card",children:[u.jsx("h3",{className:"models-subtitle",children:"当前受限操作"}),u.jsx("ul",{className:"models-blocked-list",children:o.map(h=>u.jsx("li",{children:u.jsx("code",{children:h})},h))})]}):null,u.jsxs("div",{className:"models-actions",children:[u.jsx("button",{type:"button",className:"btn btn-primary",disabled:e.busy,onClick:e.onRefreshReadiness,children:"刷新就绪探测"}),c?u.jsxs("span",{className:"muted models-generated-at",children:["上次探测:",c]}):null]}),u.jsxs("details",{className:"models-raw-details",children:[u.jsx("summary",{children:"查看原始探测数据(调试)"}),u.jsx("pre",{className:"cmd models-raw-json",children:JSON.stringify(d,null,2)})]})]})}const aA=[{value:"requirements-changed",label:"需求已变更"},{value:"suspected-runaway",label:"疑似失控"},{value:"resource-protection",label:"保护资源"},{value:"operator-request",label:"操作者请求"},{value:"other",label:"其他"}];function Cy(e){const{lane:r,cta:i,planSummary:s,reason:o,busy:c,confirmRef:d}=e;return!i||i.lane!==r?null:u.jsxs("div",{ref:d,className:"recovery-confirm","data-testid":"recovery-confirm",children:[u.jsxs("h3",{children:["待确认:",i.label]}),u.jsx("p",{className:"muted",children:i.id==="reconcile"?"破坏性对账需经浏览器 Human Gate 确认。请核对运行与原因后再点「确定」。":i.id==="interrupt"?"协作中止需经浏览器 Human Gate。原因已按当前运行预填,可改分类或编辑后再确定。提交只表示请求已登记,当前节点仍会跑完。":"核对上方运行 / 节点与恢复原因后直接执行;服务端会校验资格,不再走 Human Gate。"}),i.id==="interrupt"?u.jsxs("fieldset",{className:"recovery-reason-code","data-testid":"recovery-interrupt-reason-code",disabled:c,children:[u.jsx("legend",{children:"原因分类"}),u.jsx("div",{className:"recovery-reason-code-group",children:aA.map(h=>{const p=(e.reasonCode??"operator-request")===h.value;return u.jsxs("label",{className:p?"recovery-reason-code-option is-active":"recovery-reason-code-option",children:[u.jsx("input",{type:"radio",name:"recovery-interrupt-reason-code",value:h.value,checked:p,onChange:()=>e.onReasonCodeChange?.(h.value)}),h.label]},h.value)})})]}):null,s?u.jsxs("div",{className:"recovery-plan-summary",children:[u.jsxs("p",{className:"muted",children:["计划 eligible=",String(s.eligible??"—")," · 风险=",vb[s.risk??""]??s.risk??"—"]}),s.effectiveFromNodeId?u.jsxs("p",{className:"muted",children:["有效起点:",s.effectiveFromNodeId]}):null,s.estimatedExecution?u.jsxs("p",{className:"muted",children:["将执行 ",s.estimatedExecution.nodeCount??"?"," 个节点 / ",s.estimatedExecution.piCallCount??"?"," 次 Pi;预计避免"," ",s.estimatedExecution.avoidedNodeCount??"?"," 个节点"]}):null,s.planHash?u.jsxs("p",{className:"muted",children:["planHash: ",u.jsxs("code",{children:[s.planHash.slice(0,16),"…"]})]}):null]}):i.id==="dagRerun"?u.jsx("p",{className:"muted",children:"未加载计划摘要;点「确定」前将再次尝试资格检查。"}):null,u.jsxs("div",{className:"cta-row",children:[u.jsx("button",{type:"button",className:"btn btn-primary",disabled:c||!o.trim(),"data-testid":"recovery-confirm-submit",onClick:e.onSubmit,children:"确定"}),u.jsx("button",{type:"button",className:"btn btn-secondary",disabled:c,"data-testid":"recovery-confirm-cancel",onClick:e.onCancel,children:"取消"})]})]})}function sA(e){const{shell:r,recovery:i,wizard:s}=e,{busy:o}=r,c=MI({interruptStatus:i.interruptEligibility?.interruptStatus,dagStatus:i.recoveryRunStatus,failureCategory:i.recoveryFailureCategory,targetOperationState:i.interruptEligibility?.targetOperationState}),d={planSummary:i.recoveryPlanSummary,reason:i.recoveryReason,reasonCode:i.interruptReasonCode,onReasonCodeChange:i.setInterruptReasonCode,busy:o,confirmRef:i.recoveryConfirmRef,onSubmit:()=>{i.submitRecoveryConfirm()},onCancel:()=>{i.setRecoveryConfirm(null),i.setRecoveryPlanSummary(null)}};return u.jsxs("section",{className:"panel","aria-labelledby":"recovery-title",children:[u.jsx("h2",{id:"recovery-title",children:"恢复"}),u.jsxs("p",{className:"muted",children:["事实分类:",bb[i.recoveryFact]," · 无 Cancel · 无「直接改代码」"]}),i.frontendRecovery?u.jsxs("div",{className:"muted","data-testid":"frontend-recovery-lineage",style:{marginBottom:"0.75rem"},children:[u.jsxs("div",{children:["前端恢复:outcome=",u.jsx("code",{children:i.frontendRecovery.outcome??"—"})," phase=",u.jsx("code",{children:i.frontendRecovery.phase??"—"})]}),u.jsxs("div",{children:["root ",u.jsx("code",{children:i.frontendRecovery.recoveryRootRunId??"—"}),i.frontendRecovery.parentRunId?` · parent ${i.frontendRecovery.parentRunId}`:"",i.frontendRecovery.childRunId?` · child ${i.frontendRecovery.childRunId}`:"",i.frontendRecovery.attemptIndex!==void 0?` · attempt ${i.frontendRecovery.attemptIndex}`:""]})]}):null,u.jsxs("ol",{className:"muted recovery-steps",children:[u.jsx("li",{children:"上方选 DAG 运行 / 节点,用「DAG 运行恢复」动作"}),u.jsx("li",{children:"Worker 持有的失败 run 用下方「Worker Task 重排队」;独立 DAG run 才用「完整重跑任务」"}),u.jsx("li",{children:"带 * 的动作:核对预填原因后点「确定」。重跑/重试直接执行;对账与中止运行走 Human Gate"})]}),c?u.jsxs("p",{className:"muted","data-testid":"recovery-interrupt-status",children:["中止进度:",c]}):null,i.recoveryFact==="running-active"&&i.interruptEligibility&&!i.interruptEligibility.eligible&&(!i.interruptEligibility.interruptStatus||i.interruptEligibility.interruptStatus==="none")?u.jsx("p",{className:"muted","data-testid":"recovery-interrupt-unavailable",children:i.interruptEligibility.ownerKind==="worker-managed"?"此运行不由当前 Console 持有,暂不支持协作中止。请用 Doctor / 报告查看。":i.interruptEligibility.message??"当前运行不具备协作中止资格。"}):null,u.jsxs("p",{className:"muted",children:[s.taskId.trim()?`按任务 ${s.taskId.trim()} 拉取候选。`:"未填任务 ID 时列出最近 DAG 运行。","Doctor 诊断可选,不是重跑前置。"," ",u.jsx("button",{type:"button",className:"btn btn-secondary",disabled:o||i.recoveryRunsLoading,"data-testid":"recovery-refresh-candidates",onClick:()=>{i.loadRecoveryRuns()},children:i.recoveryRunsLoading?"刷新中…":"刷新候选"})]}),u.jsxs("label",{className:"field",children:[u.jsx("span",{className:"muted",children:"DAG 运行 ID"}),!i.manualRunId&&i.recoveryRuns.length>0?u.jsxs("select",{"data-testid":"recovery-run-select",value:i.dagRunId,disabled:o||i.recoveryRunsLoading,onChange:h=>{i.setManualRunId(!1),i.setManualNodeId(!1),i.setFromNodeId(""),i.setDagRunId(h.target.value),i.recoveryReasonTouched||i.setRecoveryReasonTouched(!1)},children:[i.recoveryRuns.some(h=>h.dagRunId===i.dagRunId)?null:u.jsx("option",{value:i.dagRunId||"",children:i.dagRunId?`${i.dagRunId}(当前)`:"— 请选择 —"}),i.recoveryRuns.map(h=>u.jsx("option",{value:h.dagRunId,children:FI(h)},h.dagRunId))]}):u.jsx("input",{"data-testid":"recovery-run-input",value:i.dagRunId,disabled:o,onChange:h=>{i.setManualRunId(!0),i.setDagRunId(h.target.value.trim())},placeholder:"dag-run-id(子图/完整重跑)"}),u.jsx("button",{type:"button",className:"btn btn-secondary",disabled:o,"data-testid":"recovery-run-manual-toggle",onClick:()=>{if(!i.manualRunId&&i.recoveryRuns.length>0){i.setManualRunId(!0);return}i.setManualRunId(!1),i.loadRecoveryRuns()},children:!i.manualRunId&&i.recoveryRuns.length>0?"手动输入运行 ID":"刷新并改用下拉"})]}),u.jsxs("label",{className:"field",children:[u.jsxs("span",{className:"muted",children:["起始节点 ID(从节点重跑)",i.recoveryNodesLoading?" · 加载节点…":""]}),!i.manualNodeId&&i.recoveryNodes.length>0?u.jsxs("select",{"data-testid":"recovery-node-select",value:i.fromNodeId,disabled:o||i.recoveryNodesLoading,onChange:h=>{i.setManualNodeId(!1),i.setFromNodeId(h.target.value)},children:[i.recoveryNodes.some(h=>h.nodeId===i.fromNodeId)?null:u.jsx("option",{value:i.fromNodeId||"",children:i.fromNodeId?`${i.fromNodeId}(当前)`:"— 请选择 —"}),i.recoveryNodes.map(h=>u.jsx("option",{value:h.nodeId,children:PI(h)},h.nodeId))]}):u.jsx("input",{"data-testid":"recovery-node-input",value:i.fromNodeId,disabled:o,onChange:h=>{i.setManualNodeId(!0),i.setFromNodeId(h.target.value.trim())},placeholder:"例如 review-verdict-recovery-pi"}),u.jsx("button",{type:"button",className:"btn btn-secondary",disabled:o,"data-testid":"recovery-node-manual-toggle",onClick:()=>{if(!i.manualNodeId&&i.recoveryNodes.length>0){i.setManualNodeId(!0);return}i.setManualNodeId(!1),i.loadRecoveryNodes(i.dagRunId)},children:!i.manualNodeId&&i.recoveryNodes.length>0?"手动输入节点 ID":"刷新并改用下拉"})]}),u.jsxs("label",{className:"field",children:[u.jsx("span",{className:"muted",children:"恢复原因(已按 run/节点失败事实自动预填,可编辑)"}),u.jsx("textarea",{"data-testid":"recovery-reason",value:i.recoveryReason,disabled:o,rows:4,onChange:h=>{i.setRecoveryReasonTouched(!0),i.setRecoveryReason(h.target.value)},placeholder:"将自动预填 operator-recovery / run / from-node / detail"}),u.jsx("button",{type:"button",className:"btn btn-secondary",disabled:o,"data-testid":"recovery-reason-refresh",onClick:()=>{i.setRecoveryReasonTouched(!1),i.setRecoveryReason(i.buildCurrentRecoveryReason(i.recoveryConfirm?.label))},children:"重新预填原因"})]}),u.jsxs("div",{className:"recovery-lane","data-testid":"recovery-lane-dag",children:[u.jsx("h3",{children:"DAG 运行恢复"}),u.jsx("p",{className:"muted",children:"针对 `.harness/dag-runs` 的 Agent DAG 运行。橙色为当前建议;带 * 需确认原因。"}),u.jsxs("div",{className:"recovery-cta-row","data-testid":"recovery-cta-row-dag",children:[i.recoveryLanes.dag.map(h=>{const p=h.id===i.recommendedCtaId;return u.jsxs("button",{type:"button",className:p?"btn btn-primary":"btn btn-secondary",disabled:o,title:h.guide,"aria-pressed":i.recoveryConfirm?.id===h.id?!0:void 0,"data-testid":`recovery-cta-${h.id}`,"data-recommended":p?"true":void 0,onClick:()=>{i.handleRecoveryCta(h)},children:[h.label,h.requiresReason?" *":""]},h.id)}),u.jsx("button",{type:"button",className:"btn btn-secondary",disabled:!i.dagRunId.trim(),"data-testid":"recovery-dag-preview",title:"在本页侧栏预览,可关闭返回",onClick:()=>{if(!i.dagRunId.trim()){r.setOpError("侧栏预览需要先选择 DAG 运行 ID");return}i.setInspectSplitOpen(!0)},children:"侧栏预览"})]}),i.recoveryReport?u.jsxs("div",{className:"recovery-report","data-testid":"recovery-report",children:[u.jsxs("div",{className:"recovery-report-header",children:[u.jsx("h3",{children:"交接报告摘要"}),u.jsx("button",{type:"button",className:"btn btn-ghost","data-testid":"recovery-report-close",onClick:()=>i.setRecoveryReport(null),children:"关闭"})]}),u.jsxs("dl",{className:"recovery-report-facts",children:[u.jsxs("div",{children:[u.jsx("dt",{children:"运行"}),u.jsx("dd",{children:u.jsx("code",{children:i.recoveryReport.runId})})]}),i.recoveryReport.title?u.jsxs("div",{children:[u.jsx("dt",{children:"标题"}),u.jsx("dd",{children:i.recoveryReport.title})]}):null,u.jsxs("div",{children:[u.jsx("dt",{children:"状态"}),u.jsx("dd",{children:i.recoveryReport.status??"—"})]}),u.jsxs("div",{children:[u.jsx("dt",{children:"失败分类"}),u.jsx("dd",{children:i.recoveryReport.category??"—"})]}),u.jsxs("div",{children:[u.jsx("dt",{children:"建议"}),u.jsx("dd",{children:i.recoveryReport.recommendation??"暂无结构化建议"})]})]}),u.jsxs("p",{className:"muted",children:["完整 Markdown 可用 CLI:",u.jsxs("code",{children:["loop-agent dag report --run-id"," ",i.recoveryReport.runId," --markdown"]})]})]}):null,u.jsx(Cy,{lane:"dag",cta:i.recoveryConfirm,...d})]}),u.jsxs("div",{className:"recovery-lane","data-testid":"recovery-lane-worker",children:[u.jsx("h3",{children:"Worker Task 重排队"}),u.jsx("p",{className:"muted",children:"针对 agent-worker Task Pool,不是 DAG run。需要 Task ID;Feature ID 可选。"}),u.jsxs("label",{className:"field",children:[u.jsx("span",{className:"muted",children:"Task ID(Worker 重排队必填)"}),u.jsx("input",{"data-testid":"recovery-worker-task-id",value:s.taskId,disabled:o,onChange:h=>s.setTaskId(h.target.value.trim()),placeholder:"harness / worker task-id"})]}),u.jsxs("label",{className:"field",children:[u.jsx("span",{className:"muted",children:"Feature ID(可选)"}),u.jsx("input",{"data-testid":"recovery-feature-id",value:i.featureId,disabled:o,onChange:h=>i.setFeatureId(h.target.value.trim()),placeholder:"feature-id"})]}),u.jsx("div",{className:"recovery-cta-row","data-testid":"recovery-cta-row-worker",children:i.recoveryLanes.worker.length>0?i.recoveryLanes.worker.map(h=>u.jsxs("button",{type:"button",className:h.id===i.recommendedCtaId?"btn btn-primary":"btn btn-secondary",disabled:o,title:h.guide,"data-testid":`recovery-cta-${h.id}`,"data-recommended":h.id===i.recommendedCtaId?"true":void 0,onClick:()=>{i.handleRecoveryCta(h)},children:[h.label,h.requiresReason?" *":""]},h.id)):u.jsx("p",{className:"muted","data-testid":"recovery-worker-unavailable",children:"当前事实分类下不提供 Worker 重排队。"})}),u.jsx(Cy,{lane:"worker",cta:i.recoveryConfirm,...d})]}),u.jsx("div",{className:"recovery-cta-row","data-testid":"recovery-cta-row",hidden:!0,children:i.recoveryCtas.map(h=>u.jsx("span",{children:h.id},h.id))}),i.observeLinkMessage?u.jsxs("p",{className:"muted",children:["[",uI[i.observeLinkStatus],"]"," ",i.observeLinkMessage]}):null,i.observeUrl?u.jsx("p",{className:"muted",children:u.jsx("a",{className:"external-link",href:i.observeUrl,children:i.observeUrl})}):null]})}function lA(e){const{health:r,readiness:i,healthError:s,layers:o,setupBlocked:c,degraded:d}=e;return u.jsxs(u.Fragment,{children:[u.jsxs("section",{className:"panel","aria-labelledby":"settings-title",children:[u.jsx("h2",{id:"settings-title",children:"设置"}),u.jsxs("dl",{className:"kv",children:[u.jsxs("div",{children:[u.jsx("dt",{children:"产品"}),u.jsx("dd",{children:r?.productName??"Loop Operator Console"})]}),u.jsxs("div",{children:[u.jsx("dt",{children:"仓库根目录"}),u.jsx("dd",{children:u.jsx("code",{children:r?.repoRoot??"—"})})]}),u.jsxs("div",{children:[u.jsx("dt",{children:"仓库指纹"}),u.jsx("dd",{children:u.jsx("code",{title:r?.repoFingerprint??void 0,children:r?.repoFingerprint?`${r.repoFingerprint.slice(0,12)}…`:"—"})})]}),u.jsxs("div",{children:[u.jsx("dt",{children:"Pi 就绪"}),u.jsxs("dd",{children:[u.jsxs("code",{children:[yb[i]??i,"(",i,")"]}),c?u.jsx("p",{className:"muted",children:"Pi SDK / 认证 / 模型未就绪。不提供纯表单兜底。请前往「模型与认证」。"}):d?u.jsx("p",{className:"muted",children:"Pi 暂时降级:仍可恢复草稿与需求访谈。"}):null]})]}),u.jsxs("div",{children:[u.jsx("dt",{children:"Inspect"}),u.jsxs("dd",{children:[u.jsx("code",{children:"/inspect/"}),"(同一 Console 进程)"]})]})]}),s?u.jsx("p",{className:"error",children:s}):null]}),u.jsxs("section",{className:"panel","aria-labelledby":"layers-title",children:[u.jsx("h2",{id:"layers-title",children:"完成语义分层"}),u.jsx("p",{className:"muted",children:"MVP 不执行收尾提交;不显示「任务已关闭/已交付」。"}),u.jsxs("dl",{className:"kv","data-testid":"completion-layers",children:[u.jsxs("div",{children:[u.jsx("dt",{children:"命令"}),u.jsx("dd",{children:Ul(o.command)})]}),u.jsxs("div",{children:[u.jsx("dt",{children:"DAG 生命周期"}),u.jsx("dd",{children:Ul(o.dag)})]}),u.jsxs("div",{children:[u.jsx("dt",{children:"最终验证"}),u.jsx("dd",{children:Ul(o.verification)})]}),u.jsxs("div",{children:[u.jsx("dt",{children:"晋升"}),u.jsx("dd",{children:Ul(o.promote)})]}),u.jsxs("div",{children:[u.jsx("dt",{children:"任务关闭"}),u.jsx("dd",{children:"不可用(MVP)"})]})]})]})]})}function oA(e){const{busy:r,degraded:i,taskId:s,assessmentId:o,contractValidateOk:c,contractValidateSummary:d,contractDiffSummary:h,contractApplied:p,spineOk:g,onRerunPreflight:v,onApplyContract:y,onRetrySpine:k}=e;return u.jsxs("div",{"data-testid":"panel-contract",children:[u.jsx("h3",{children:"契约落地"}),u.jsx("p",{className:"muted",children:"进入本步后自动跑确定性校验与差异(非 AI 代判)。写入仓库仍需你人工确认一次;应用成功后会自动跑 Spine 审计。"}),u.jsxs("p",{className:"muted",children:["评估 ID: ",u.jsx("code",{children:o??"—"})]}),u.jsxs("div",{className:"contract-checks",children:[u.jsxs("p",{children:[u.jsx("strong",{children:"校验"}),":"," ",c===null?r?"进行中…":"等待开始":c?"通过":"未通过"]}),d?u.jsx("pre",{className:"cmd","data-testid":"contract-validate-summary",children:d}):null,u.jsxs("p",{children:[u.jsx("strong",{children:"差异"}),h?"":":尚未拉取"]}),h?u.jsx("pre",{className:"cmd","data-testid":"contract-diff-summary",children:h}):null,p?u.jsxs("p",{children:[u.jsx("strong",{children:"Spine"}),":"," ",g===null?"待检查":g?"通过":"未通过"]}):null]}),u.jsxs("div",{className:"cta-row",children:[u.jsx("button",{type:"button",className:"btn btn-secondary",disabled:r||!s.trim(),onClick:v,children:"重新校验"}),u.jsx("button",{type:"button",className:"btn btn-primary","data-testid":"contract-apply",disabled:r||i||!o||c!==!0||p,onClick:y,children:"确认并应用契约"}),p&&g===!1?u.jsx("button",{type:"button",className:"btn btn-primary",disabled:r,onClick:k,children:"重试 Spine"}):null]})]})}function uA(e){const{busy:r,taskId:i,confirmationId:s,confirmationDetails:o,runAction:c,onConfirmAndRun:d}=e;return u.jsxs("div",{"data-testid":"panel-dag-confirm",children:[u.jsx("h3",{children:"DAG 确认(§5.5)"}),u.jsxs("ul",{className:"checklist",children:[u.jsx("li",{children:"源绑定(source)"}),u.jsx("li",{children:"Writer 写集范围(writer-scope)"}),u.jsx("li",{children:"验证命令(verification)"}),u.jsx("li",{children:"人工门禁(human-gates)"})]}),o?u.jsx("pre",{className:"cmd",children:JSON.stringify(o,null,2).slice(0,4e3)}):null,u.jsxs("div",{className:"cta-row",children:[u.jsx("button",{type:"button",className:"btn btn-primary",disabled:r,onClick:()=>{c("prepareDagConfirmation",{taskId:i,dagHandle:`${i}.dag.json`,profile:"auto"})},children:"生成 DAG 并准备确认"}),u.jsx("button",{type:"button",className:"btn btn-primary",disabled:r||!s,onClick:d,children:"开始运行"})]}),s?u.jsxs("p",{className:"muted",children:["确认 ID: ",u.jsx("code",{children:s})]}):null]})}function cA(e){const{busy:r,taskKind:i,onTaskKindChange:s,workflowHint:o,prd:c,engineering:d,onEngineeringChange:h,onImport:p}=e,g=r||c.prdFileReading;return u.jsxs("div",{"data-testid":"panel-import-prd",children:[u.jsx("h3",{children:"导入需求"}),u.jsx("p",{className:"muted",children:"粘贴、选择或拖入一份或多份 PRD / 需求 Markdown。多文件会分别归档到 source/references,并合成一份可编辑正文。创建前可继续编辑。 系统会对 PRD 做确定性/语义结构化;工程边界(路径与验证)须人类确认,不会由模型编造。"}),u.jsxs("label",{className:"field",children:[u.jsx("span",{className:"muted",children:"流程类型"}),u.jsx("select",{"data-testid":"workflow-kind-select",value:i,disabled:r||c.prdFileReading,onChange:v=>s(v.target.value),children:vd.map(v=>u.jsx("option",{value:v.kind,children:v.label},v.kind))})]}),u.jsxs("p",{className:"workflow-hint","data-testid":"workflow-kind-hint",children:[o," · taskKind=",u.jsx("code",{children:i})]}),u.jsxs("div",{className:`prd-drop-zone${c.prdDragOver?" is-dragover":""}`,"data-testid":"prd-drop-zone","data-dragover":c.prdDragOver?"true":"false",onDragEnter:v=>c.onDragEnter(v,g),onDragOver:v=>{v.preventDefault(),v.stopPropagation()},onDragLeave:c.onDragLeave,onDrop:v=>c.onDrop(v,g),children:[u.jsxs("div",{className:"prd-upload-toolbar",children:[u.jsxs("label",{className:`btn btn-ghost prd-upload-btn${g?" is-disabled":""}`,children:["选择需求文档",u.jsx("input",{type:"file",accept:yI,multiple:!0,hidden:!0,disabled:g,"data-testid":"prd-file-input",onChange:v=>{const y=v.currentTarget;c.loadPrdFromFiles(y.files).finally(()=>{y.value=""})}})]}),u.jsxs("span",{className:"muted prd-upload-hint",children:["支持多文件 .md / .markdown / .txt,单文件最大"," ",xd(bd),",最多 ",io," 个"]}),c.prdDocuments.length>0?u.jsx("button",{type:"button",className:"btn btn-ghost","data-testid":"prd-recompose",disabled:g,onClick:c.recomposeDocuments,children:"按文件重新合成"}):null]}),c.prdDocuments.length>0?u.jsx("ul",{className:"prd-file-list","data-testid":"prd-file-list",children:c.prdDocuments.map((v,y)=>u.jsxs("li",{className:y===c.prdPrimaryIndex?"is-primary":void 0,"data-testid":`prd-file-item-${y}`,children:[u.jsxs("span",{className:"prd-file-item-name",children:[v.fileName,y===c.prdPrimaryIndex?u.jsx("span",{className:"prd-file-primary-tag",children:"主"}):null,u.jsxs("span",{className:"muted",children:[" ","· ",xd(v.sourceBytes)]})]}),u.jsxs("span",{className:"prd-file-item-actions",children:[u.jsx("button",{type:"button",className:"btn btn-ghost",disabled:g||y===c.prdPrimaryIndex,onClick:()=>c.setPrimaryDocument(y),children:"设为主"}),u.jsx("button",{type:"button",className:"btn btn-ghost",disabled:g||y===0,onClick:()=>c.moveDocument(y,-1),children:"上移"}),u.jsx("button",{type:"button",className:"btn btn-ghost",disabled:g||y===c.prdDocuments.length-1,onClick:()=>c.moveDocument(y,1),children:"下移"}),u.jsx("button",{type:"button",className:"btn btn-ghost",disabled:g,onClick:()=>c.removeDocument(y),children:"移除"})]})]},`${v.fileName}-${y}`))}):null,c.prdDocuments.length>0?u.jsxs("div",{className:"prd-file-meta",children:[u.jsxs("span",{children:["分卷=上传原件(将分别归档);正文=本会话采用稿",c.prdComposedDirty?"(已手动编辑)":""]}),u.jsx("button",{type:"button",className:"btn btn-ghost prd-file-clear","data-testid":"prd-file-clear",disabled:g,onClick:c.clearDocuments,children:"清除来源列表"})]}):null,c.prdDragOver?u.jsx("p",{className:"prd-drop-hint","data-testid":"prd-drop-hint",children:"释放以载入"}):null,u.jsxs("label",{className:"field prd-text-field",children:[u.jsx("span",{className:"muted",children:"PRD Markdown"}),u.jsx("textarea",{rows:10,value:c.prdText,disabled:g,"data-testid":"prd-textarea",onChange:v=>c.onPrdTextChange(v.target.value)})]})]}),c.prdFileError?u.jsx("p",{className:"prd-file-error",role:"alert","aria-live":"polite","data-testid":"prd-file-error",children:c.prdFileError}):null,u.jsxs("details",{className:"engineering-boundary","data-testid":"engineering-boundary",children:[u.jsx("summary",{children:"工程边界(可选,人类确认)"}),u.jsxs("p",{className:"muted",children:["逗号或换行分隔。留空则 intake 后进入访谈补齐;不会自动填",u.jsx("code",{children:"src/worker/console/**"})," 模板。"]}),u.jsxs("label",{className:"field",children:[u.jsx("span",{className:"muted",children:"allowedPaths"}),u.jsx("textarea",{rows:2,value:d.allowedPathsText,disabled:g,"data-testid":"prd-allowed-paths",placeholder:"src/**, test/**",onChange:v=>h({allowedPathsText:v.target.value})})]}),u.jsxs("label",{className:"field",children:[u.jsx("span",{className:"muted",children:"forbiddenPaths"}),u.jsx("textarea",{rows:2,value:d.forbiddenPathsText,disabled:g,"data-testid":"prd-forbidden-paths",placeholder:".harness/**, node_modules/**",onChange:v=>h({forbiddenPathsText:v.target.value})})]}),u.jsxs("label",{className:"field",children:[u.jsx("span",{className:"muted",children:"verifyCommands(label:command 或纯命令)"}),u.jsx("textarea",{rows:2,value:d.verifyCommandsText,disabled:g,"data-testid":"prd-verify-commands",placeholder:"typecheck:npm run typecheck",onChange:v=>h({verifyCommandsText:v.target.value})})]})]}),u.jsx("div",{className:"cta-row",children:u.jsxs("button",{type:"button",className:`btn btn-primary${r?" is-loading":""}`,disabled:r||c.prdFileReading||!c.prdText.trim(),"aria-busy":r||void 0,onClick:p,children:[r?u.jsx("span",{className:"spinner","aria-hidden":"true"}):null,r?"导入中…":"导入并创建任务"]})})]})}function dA(e){const{busy:r,taskId:i,taskTitle:s,taskKind:o,sessionId:c,question:d,answerText:h,onAnswerTextChange:p,draftSummary:g,assessmentId:v,runAction:y}=e;return u.jsxs("div",{"data-testid":"panel-interview",children:[u.jsx("h3",{children:"需求访谈(grill-me)"}),u.jsx("p",{className:"muted",children:"一次一问;也可跳过:系统会按推荐补齐草稿并签发评估,随后进入校验。 访谈中不可应用契约 / 运行 DAG / 对账。"}),g?u.jsx("pre",{className:"cmd","data-testid":"draft-summary",children:JSON.stringify(g,null,2)}):null,u.jsxs("div",{className:"cta-row",style:{marginBottom:"0.75rem"},children:[!c||!d?u.jsx("button",{type:"button",className:"btn btn-primary",disabled:r||!i.trim(),onClick:()=>{y("interviewStart",{taskId:i,title:s,taskKind:o})},children:"开始 / 继续访谈"}):null,u.jsx("button",{type:"button",className:"btn btn-ghost","data-testid":"interview-skip",disabled:r||!i.trim(),onClick:()=>{y("interviewSkip",{taskId:i,title:s,taskKind:o})},children:"跳过访谈"})]}),c&&d?u.jsxs("div",{className:"interview-card",children:[u.jsxs("p",{className:"interview-q",children:[u.jsx("strong",{children:d.id})," · 风险=",vb[d.risk??""]??d.risk??"—"]}),u.jsx("p",{children:d.text}),d.recommendation?u.jsxs("p",{className:"muted",children:["推荐:",d.recommendation]}):null,u.jsxs("label",{className:"field",children:[u.jsx("span",{className:"muted",children:"你的回答(覆盖推荐)"}),u.jsx("textarea",{rows:3,value:h,disabled:r,onChange:k=>p(k.target.value)})]}),u.jsxs("div",{className:"cta-row",children:[u.jsx("button",{type:"button",className:"btn btn-primary",disabled:r,onClick:()=>{y("interviewTurn",{sessionId:c,questionId:d.id,response:"accept-recommendation"}).then(()=>p(""))},children:"接受推荐"}),u.jsx("button",{type:"button",className:"btn btn-primary",disabled:r||!h.trim(),onClick:()=>{y("interviewTurn",{sessionId:c,questionId:d.id,response:"override",text:h}).then(()=>p(""))},children:"提交自定义回答"}),u.jsx("button",{type:"button",className:"btn btn-secondary",disabled:r||d.risk==="high",onClick:()=>{y("interviewTurn",{sessionId:c,questionId:d.id,response:"defer",text:h||d.recommendation}).then(()=>p(""))},children:"暂缓(非高风险)"})]})]}):null,v?u.jsxs("p",{className:"muted",children:["评估 ID: ",u.jsx("code",{children:v})]}):null]})}function fA(e){const{busy:r,confirmationId:i,operationId:s,dagRunId:o,taskId:c,observeBusy:d,sseLog:h,runAction:p,onStopFollow:g,onShowInspectSplit:v,onOpenInspectSplit:y}=e;return u.jsxs("div",{"data-testid":"panel-run",children:[u.jsx("h3",{children:"运行详情"}),u.jsxs("div",{className:"meta-row",children:[u.jsxs("div",{children:["操作 ID: ",u.jsx("code",{children:s??"—"})]}),u.jsxs("div",{children:["确认 ID: ",u.jsx("code",{children:i??"—"})]})]}),u.jsxs("div",{className:"cta-row",children:[u.jsx("button",{type:"button",className:"btn btn-primary",disabled:r||!i,onClick:()=>{p("runDag",{confirmationId:i},{clientRequestId:no("run")})},children:"重新运行"}),u.jsx("button",{type:"button",className:"btn btn-secondary",onClick:g,children:"停止跟随日志"}),u.jsx("button",{type:"button",className:"btn btn-secondary",disabled:!o.trim(),onClick:v,children:"打开检视"}),u.jsx("button",{type:"button",className:"btn btn-ghost",disabled:d||!o.trim()&&!c.trim(),title:"在本页侧栏预览,可关闭返回",onClick:y,children:"侧栏预览"})]}),u.jsx("pre",{className:"cmd","data-testid":"sse-log",children:h.join(`
|
|
59
|
+
`)||"(尚无事件)"})]})}function hA(e){const{shell:r,actions:i,wizard:s,prd:o,recovery:c}=e,{busy:d,step:h,setupBlocked:p,degraded:g}=r;return u.jsxs("section",{className:"panel task-ops","aria-labelledby":"task-ops-title",children:[u.jsx("h2",{id:"task-ops-title",children:"任务操作"}),u.jsx("p",{className:"panel-lead",children:"按 Happy Path 推进;契约落地一步内自动校验,人工确认写入。"}),u.jsx("ol",{className:"wizard-steps","data-testid":"wizard-steps",children:s.wizardSteps.map((v,y)=>u.jsxs("li",{"data-active":h===v.id,"data-done":y<s.stepIndex,children:[u.jsx("span",{className:"step-index",children:String(y+1).padStart(2,"0")}),u.jsx("span",{className:"step-label",children:v.label})]},v.id))}),u.jsxs("label",{className:"field",children:[u.jsx("span",{className:"muted",children:"任务 ID"}),u.jsx("input",{"data-testid":"task-id-input",value:s.taskId,disabled:d||p||h==="import-prd",placeholder:h==="import-prd"?"导入需求后自动生成":"task-id",onChange:v=>s.setTaskId(v.target.value.trim())})]}),s.taskTitle?u.jsxs("p",{className:"workflow-hint","data-testid":"task-title-chip",children:["任务名称:",s.taskTitle]}):null,h!=="import-prd"&&!p?u.jsxs("p",{className:"workflow-hint","data-testid":"workflow-kind-chip",children:["当前流程:",s.workflowMeta.label," ·"," ",u.jsx("code",{children:s.taskKind})]}):null,p||h==="setup"?u.jsxs("div",{className:"empty-state","data-testid":"setup-gate",children:[u.jsx("p",{className:"empty-title",children:"需要先完成设置"}),u.jsx("p",{className:"muted",children:"请先在「模型与认证」完成 Pi 就绪,再导入需求与访谈。"}),u.jsxs("div",{className:"cta-row",children:[u.jsx("button",{type:"button",className:"btn btn-primary",disabled:d,onClick:()=>{r.selectNav("models"),i.runAction("refreshReadiness",{}).then(()=>r.loadHealth())},children:"刷新就绪状态"}),u.jsx("button",{type:"button",className:"btn btn-primary",disabled:d,onClick:()=>{i.runAction("doctor",{})},children:"运行诊断"}),u.jsx("pre",{className:"cmd",children:gb})]})]}):u.jsxs("div",{className:"wizard-body","data-testid":"wizard-body",children:[h==="import-prd"&&u.jsx(cA,{busy:d,taskKind:s.taskKind,onTaskKindChange:s.setTaskKind,workflowHint:s.workflowMeta.hint,prd:o,engineering:s.engineering,onEngineeringChange:s.setEngineering,onImport:()=>{s.importPrdAndCreate()}}),h==="interview"&&u.jsx(dA,{busy:d,taskId:s.taskId,taskTitle:s.taskTitle,taskKind:s.taskKind,sessionId:s.sessionId,question:s.question,answerText:s.answerText,onAnswerTextChange:s.setAnswerText,draftSummary:s.draftSummary,assessmentId:s.assessmentId,runAction:i.runAction}),h==="contract"&&u.jsx(oA,{busy:d,degraded:g,taskId:s.taskId,assessmentId:s.assessmentId,contractValidateOk:s.contractValidateOk,contractValidateSummary:s.contractValidateSummary,contractDiffSummary:s.contractDiffSummary,contractApplied:s.contractApplied,spineOk:s.spineOk,onRerunPreflight:()=>{s.runContractPreflight(!0)},onApplyContract:()=>{s.applyContractThenSpine()},onRetrySpine:()=>{s.retrySpineOnly()}}),h==="dag-confirm"&&u.jsx(uA,{busy:d,taskId:s.taskId,confirmationId:i.confirmationId,confirmationDetails:i.confirmationDetails,runAction:i.runAction,onConfirmAndRun:()=>{s.confirmAndRunDag()}}),h==="run"&&u.jsx(fA,{busy:d,confirmationId:i.confirmationId,operationId:i.operationId,dagRunId:c.dagRunId,taskId:s.taskId,observeBusy:r.observeBusy,sseLog:i.sseLog,runAction:i.runAction,onStopFollow:i.stopFollowSse,onShowInspectSplit:()=>c.setInspectSplitOpen(!0),onOpenInspectSplit:()=>{c.openInspectSplit()}})]})]})}const mA={};function pA(){const e=hI(),r=S.useRef(()=>{}),i=S.useCallback(v=>r.current(v),[]),s=pI({shell:e,applyInterviewPayload:i}),o=AI(),c=XI({shell:e,actions:s,prd:o}),d=KI({shell:e,actions:s,wizard:c});S.useEffect(()=>{r.current=c.applyInterviewPayload}),S.useEffect(()=>{e.loadHealth()},[e.loadHealth]);const h=S.useCallback((v,y={})=>{e.selectNav(v),y.taskId&&c.setTaskId(y.taskId),y.dagRunId&&d.setDagRunId(y.dagRunId),y.fromNodeId&&d.setFromNodeId(y.fromNodeId),y.featureId&&d.setFeatureId(y.featureId),d.setInterruptIntent(y.intent==="interrupt");const k=Wy(v,y);window.location.hash.replace(/^#/,"")!==k&&(window.location.hash=k)},[e.selectNav,c.setTaskId,d.setDagRunId,d.setFromNodeId,d.setFeatureId,d.setInterruptIntent]),p=S.useCallback(()=>{const v=Ek(window.location);if(v){h(v.workspace,v);return}const y=Jy({env:mA?.VITE_OPERATOR_CHAT_DEFAULT_LANDING,storage:window.localStorage,location:window.location});h(y,{})},[h]);S.useEffect(()=>(p(),window.addEventListener("hashchange",p),()=>window.removeEventListener("hashchange",p)),[p]);const g=e.nav==="recovery"&&d.dagRunId.trim()?`/inspect/#/dag/${encodeURIComponent(d.dagRunId.trim())}?from=recovery`:"/inspect/#/";return u.jsx(u.Fragment,{children:u.jsxs("div",{className:`console-app${e.nav==="chat"?" is-chat-focus":""}`,children:[u.jsx(eA,{nav:e.nav,readiness:e.readiness,setupBlocked:e.setupBlocked,degraded:e.degraded,health:e.health,inspectHref:g}),u.jsxs("div",{className:`console-shell${e.nav==="chat"?" is-chat-focus":""}`,children:[u.jsx(tA,{opError:e.opError,opMessage:e.opMessage}),u.jsxs("main",{className:`console-main${e.nav==="chat"?" console-main--fill":""}`,children:[e.nav==="tasks"?u.jsx(hA,{shell:e,actions:s,wizard:c,prd:o,recovery:d}):null,e.nav==="recovery"?u.jsx(sA,{shell:e,recovery:d,wizard:c}):null,e.nav==="night"?u.jsx(s0,{busy:e.busy,runAction:s.runAction,isActionSuccess:s.isActionSuccess,setOpError:e.setOpError}):null,e.nav==="models"?u.jsx(iA,{busy:e.busy,readiness:e.readiness,readinessReport:e.readinessReport,health:e.health,onRefreshReadiness:()=>{s.runAction("refreshReadiness",{}).then(()=>e.loadHealth())}}):null,e.nav==="chat"?u.jsxs("section",{className:"panel panel--chat","aria-labelledby":"chat-title",children:[u.jsx("h2",{id:"chat-title",className:"sr-only",children:"对话"}),u.jsx(lI,{origin:"",readiness:e.readiness,surface:"workspace",onNavigateWorkspace:h})]}):null,e.nav==="settings"?u.jsx(lA,{health:e.health,readiness:e.readiness,healthError:e.healthError,layers:e.layers,setupBlocked:e.setupBlocked,degraded:e.degraded}):null]}),d.inspectSplitOpen&&d.dagRunId.trim()?u.jsx(YS,{dagRunId:d.dagRunId.trim(),nodeId:d.fromNodeId.trim()||void 0,onClose:()=>d.setInspectSplitOpen(!1),onOpenFull:d.openFullInspect}):null]})]})})}const Rb=document.getElementById("root");if(!Rb)throw new Error("Loop Operator Console: #root missing");PS.createRoot(Rb).render(u.jsx(S.StrictMode,{children:u.jsx(pA,{})}));
|