@tea-agent/loop-agent 0.35.4-beta.0 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +4 -2
- package/CHANGELOG.md +55 -7
- package/dist/application/task-lifecycle/advance.js +1 -0
- package/dist/application/task-lifecycle/observe.js +15 -0
- package/dist/application/task-lifecycle/plan-transitions.js +15 -0
- package/dist/build-stamp.json +3 -3
- package/dist/commands/init-upgrade.js +351 -19
- package/dist/commands/init.js +14 -67
- package/dist/commands/run-dag-progress.js +14 -0
- package/dist/commands/task-advance.js +33 -3
- package/dist/executors/dag-pi-executor.js +3 -1
- package/dist/shared/operator/capabilities.js +125 -11
- package/dist/task/source-prepare/completeness.js +17 -0
- package/dist/task/source-prepare/parse-intent.js +15 -1
- package/dist/worker/console/chat/artifact-card.js +8 -1
- package/dist/worker/console/chat/chat-event-store.js +61 -0
- package/dist/worker/console/chat/human-gate-card.js +9 -1
- package/dist/worker/console/chat/operation-card.js +71 -2
- package/dist/worker/console/chat/pi-runtime.js +69 -30
- package/dist/worker/console/chat/routes.js +27 -4
- package/dist/worker/console/chat/semantic-activity.js +465 -0
- package/dist/worker/console/chat/turn-process.js +31 -12
- package/dist/worker/console/operation-run-facts.js +190 -0
- package/dist/worker/console/operation-runner.js +107 -6
- package/dist/worker/console/operation-wait.js +314 -0
- package/dist/worker/console/operator-actions.js +153 -2
- package/dist/worker/console/static/assets/index-2OeZODxk.js +57 -0
- package/dist/worker/console/static/assets/index-DVJlUL8X.css +1 -0
- package/dist/worker/console/static/index.html +2 -2
- package/dist/worker/console/static-src/operator-chat/activity-journey.js +125 -0
- package/dist/worker/console/static-src/operator-chat/activity-rail-presentation.js +73 -0
- package/dist/worker/console/static-src/operator-chat/activity-references.js +20 -0
- package/dist/worker/console/static-src/operator-chat/chat-sse-events.js +69 -31
- package/dist/worker/console/static-src/operator-chat/slash-palette-layout.js +24 -0
- package/dist/worker/console/static-src/operator-chat/slash-palette-nav.js +141 -0
- package/dist/worker/console/static-src/operator-chat/spatial-overlay.js +2 -1
- package/dist/worker/console/static-src/operator-chat/useActivityRailTransition.js +59 -0
- package/dist/worker/console/static-src/operator-chat/useChatSessions.js +16 -5
- package/dist/worker/console/static-src/operator-chat/useComposer.js +30 -7
- package/dist/worker/console/static-src/operator-chat/workspace-layout-mode.js +7 -3
- package/dist/worker/observe/static/operator-chrome.js +1 -1
- package/dist/workflows/dag/failure-routing.js +4 -9
- package/dist/workflows/dag/init-hybrid.js +74 -2
- package/dist/workflows/dag/lifecycle.js +0 -4
- package/dist/workflows/dag/report.js +0 -6
- package/docs/README.md +3 -3
- package/docs/architecture/evolution.md +102 -67
- package/docs/templates/frontend-task-constraints.md +7 -13
- package/docs/templates/init-managed-agents.md +5 -2
- package/harness.json +2 -2
- package/package.json +1 -1
- package/skills/loop-agent/SKILL.md +1 -0
- package/skills/loop-agent/references/command-reference.md +2 -0
- package/dist/worker/console/static/assets/index-DRqZiQ7J.css +0 -1
- package/dist/worker/console/static/assets/index-DuVLjCIT.js +0 -57
|
@@ -0,0 +1,57 @@
|
|
|
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 vd(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var kc={exports:{}},ss={};var Hp;function OS(){if(Hp)return ss;Hp=1;var t=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:t,type:s,key:d,ref:o!==void 0?o:null,props:c}}return ss.Fragment=r,ss.jsx=i,ss.jsxs=i,ss}var Up;function MS(){return Up||(Up=1,kc.exports=OS()),kc.exports}var u=MS(),wc={exports:{}},De={};var qp;function _S(){if(qp)return De;qp=1;var t=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(A){return A===null||typeof A!="object"?null:(A=k&&A[k]||A["@@iterator"],typeof A=="function"?A:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,B={};function j(A,U,C){this.props=A,this.context=U,this.refs=B,this.updater=C||w}j.prototype.isReactComponent={},j.prototype.setState=function(A,U){if(typeof A!="object"&&typeof A!="function"&&A!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,A,U,"setState")},j.prototype.forceUpdate=function(A){this.updater.enqueueForceUpdate(this,A,"forceUpdate")};function I(){}I.prototype=j.prototype;function N(A,U,C){this.props=A,this.context=U,this.refs=B,this.updater=C||w}var F=N.prototype=new I;F.constructor=N,E(F,j.prototype),F.isPureReactComponent=!0;var X=Array.isArray;function O(){}var Y={H:null,A:null,T:null,S:null},V=Object.prototype.hasOwnProperty;function ae(A,U,C){var se=C.ref;return{$$typeof:t,type:A,key:U,ref:se!==void 0?se:null,props:C}}function M(A,U){return ae(A.type,U,A.props)}function P(A){return typeof A=="object"&&A!==null&&A.$$typeof===t}function $(A){var U={"=":"=0",":":"=2"};return"$"+A.replace(/[=:]/g,function(C){return U[C]})}var te=/\/+/g;function G(A,U){return typeof A=="object"&&A!==null&&A.key!=null?$(""+A.key):U.toString(36)}function _(A){switch(A.status){case"fulfilled":return A.value;case"rejected":throw A.reason;default:switch(typeof A.status=="string"?A.then(O,O):(A.status="pending",A.then(function(U){A.status==="pending"&&(A.status="fulfilled",A.value=U)},function(U){A.status==="pending"&&(A.status="rejected",A.reason=U)})),A.status){case"fulfilled":return A.value;case"rejected":throw A.reason}}throw A}function D(A,U,C,se,W){var Z=typeof A;(Z==="undefined"||Z==="boolean")&&(A=null);var ue=!1;if(A===null)ue=!0;else switch(Z){case"bigint":case"string":case"number":ue=!0;break;case"object":switch(A.$$typeof){case t:case r:ue=!0;break;case v:return ue=A._init,D(ue(A._payload),U,C,se,W)}}if(ue)return W=W(A),ue=se===""?"."+G(A,0):se,X(W)?(C="",ue!=null&&(C=ue.replace(te,"$&/")+"/"),D(W,U,C,"",function(fe){return fe})):W!=null&&(P(W)&&(W=M(W,C+(W.key==null||A&&A.key===W.key?"":(""+W.key).replace(te,"$&/")+"/")+ue)),U.push(W)),1;ue=0;var me=se===""?".":se+":";if(X(A))for(var ge=0;ge<A.length;ge++)se=A[ge],Z=me+G(se,ge),ue+=D(se,U,C,Z,W);else if(ge=b(A),typeof ge=="function")for(A=ge.call(A),ge=0;!(se=A.next()).done;)se=se.value,Z=me+G(se,ge++),ue+=D(se,U,C,Z,W);else if(Z==="object"){if(typeof A.then=="function")return D(_(A),U,C,se,W);throw U=String(A),Error("Objects are not valid as a React child (found: "+(U==="[object Object]"?"object with keys {"+Object.keys(A).join(", ")+"}":U)+"). If you meant to render a collection of children, use an array instead.")}return ue}function H(A,U,C){if(A==null)return A;var se=[],W=0;return D(A,se,"","",function(Z){return U.call(C,Z,W++)}),se}function z(A){if(A._status===-1){var U=A._result;U=U(),U.then(function(C){(A._status===0||A._status===-1)&&(A._status=1,A._result=C)},function(C){(A._status===0||A._status===-1)&&(A._status=2,A._result=C)}),A._status===-1&&(A._status=0,A._result=U)}if(A._status===1)return A._result.default;throw A._result}var ne=typeof reportError=="function"?reportError:function(A){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var U=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof A=="object"&&A!==null&&typeof A.message=="string"?String(A.message):String(A),error:A});if(!window.dispatchEvent(U))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",A);return}console.error(A)},T={map:H,forEach:function(A,U,C){H(A,function(){U.apply(this,arguments)},C)},count:function(A){var U=0;return H(A,function(){U++}),U},toArray:function(A){return H(A,function(U){return U})||[]},only:function(A){if(!P(A))throw Error("React.Children.only expected to receive a single React element child.");return A}};return De.Activity=y,De.Children=T,De.Component=j,De.Fragment=i,De.Profiler=o,De.PureComponent=N,De.StrictMode=s,De.Suspense=p,De.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Y,De.__COMPILER_RUNTIME={__proto__:null,c:function(A){return Y.H.useMemoCache(A)}},De.cache=function(A){return function(){return A.apply(null,arguments)}},De.cacheSignal=function(){return null},De.cloneElement=function(A,U,C){if(A==null)throw Error("The argument must be a React element, but you passed "+A+".");var se=E({},A.props),W=A.key;if(U!=null)for(Z in U.key!==void 0&&(W=""+U.key),U)!V.call(U,Z)||Z==="key"||Z==="__self"||Z==="__source"||Z==="ref"&&U.ref===void 0||(se[Z]=U[Z]);var Z=arguments.length-2;if(Z===1)se.children=C;else if(1<Z){for(var ue=Array(Z),me=0;me<Z;me++)ue[me]=arguments[me+2];se.children=ue}return ae(A.type,W,se)},De.createContext=function(A){return A={$$typeof:d,_currentValue:A,_currentValue2:A,_threadCount:0,Provider:null,Consumer:null},A.Provider=A,A.Consumer={$$typeof:c,_context:A},A},De.createElement=function(A,U,C){var se,W={},Z=null;if(U!=null)for(se in U.key!==void 0&&(Z=""+U.key),U)V.call(U,se)&&se!=="key"&&se!=="__self"&&se!=="__source"&&(W[se]=U[se]);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(A&&A.defaultProps)for(se in ue=A.defaultProps,ue)W[se]===void 0&&(W[se]=ue[se]);return ae(A,Z,W)},De.createRef=function(){return{current:null}},De.forwardRef=function(A){return{$$typeof:h,render:A}},De.isValidElement=P,De.lazy=function(A){return{$$typeof:v,_payload:{_status:-1,_result:A},_init:z}},De.memo=function(A,U){return{$$typeof:g,type:A,compare:U===void 0?null:U}},De.startTransition=function(A){var U=Y.T,C={};Y.T=C;try{var se=A(),W=Y.S;W!==null&&W(C,se),typeof se=="object"&&se!==null&&typeof se.then=="function"&&se.then(O,ne)}catch(Z){ne(Z)}finally{U!==null&&C.types!==null&&(U.types=C.types),Y.T=U}},De.unstable_useCacheRefresh=function(){return Y.H.useCacheRefresh()},De.use=function(A){return Y.H.use(A)},De.useActionState=function(A,U,C){return Y.H.useActionState(A,U,C)},De.useCallback=function(A,U){return Y.H.useCallback(A,U)},De.useContext=function(A){return Y.H.useContext(A)},De.useDebugValue=function(){},De.useDeferredValue=function(A,U){return Y.H.useDeferredValue(A,U)},De.useEffect=function(A,U){return Y.H.useEffect(A,U)},De.useEffectEvent=function(A){return Y.H.useEffectEvent(A)},De.useId=function(){return Y.H.useId()},De.useImperativeHandle=function(A,U,C){return Y.H.useImperativeHandle(A,U,C)},De.useInsertionEffect=function(A,U){return Y.H.useInsertionEffect(A,U)},De.useLayoutEffect=function(A,U){return Y.H.useLayoutEffect(A,U)},De.useMemo=function(A,U){return Y.H.useMemo(A,U)},De.useOptimistic=function(A,U){return Y.H.useOptimistic(A,U)},De.useReducer=function(A,U,C){return Y.H.useReducer(A,U,C)},De.useRef=function(A){return Y.H.useRef(A)},De.useState=function(A){return Y.H.useState(A)},De.useSyncExternalStore=function(A,U,C){return Y.H.useSyncExternalStore(A,U,C)},De.useTransition=function(){return Y.H.useTransition()},De.version="19.2.8",De}var $p;function bd(){return $p||($p=1,wc.exports=_S()),wc.exports}var S=bd();const Fr=vd(S);var Cc={exports:{}},ls={},jc={exports:{}},Rc={};var Gp;function LS(){return Gp||(Gp=1,(function(t){function r(D,H){var z=D.length;D.push(H);e:for(;0<z;){var ne=z-1>>>1,T=D[ne];if(0<o(T,H))D[ne]=H,D[z]=T,z=ne;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],z=D.pop();if(z!==H){D[0]=z;e:for(var ne=0,T=D.length,A=T>>>1;ne<A;){var U=2*(ne+1)-1,C=D[U],se=U+1,W=D[se];if(0>o(C,z))se<T&&0>o(W,C)?(D[ne]=W,D[se]=z,ne=se):(D[ne]=C,D[U]=z,ne=U);else if(se<T&&0>o(W,z))D[ne]=W,D[se]=z,ne=se;else break e}}return H}function o(D,H){var z=D.sortIndex-H.sortIndex;return z!==0?z:D.id-H.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;t.unstable_now=function(){return c.now()}}else{var d=Date,h=d.now();t.unstable_now=function(){return d.now()-h}}var p=[],g=[],v=1,y=null,k=3,b=!1,w=!1,E=!1,B=!1,j=typeof setTimeout=="function"?setTimeout:null,I=typeof clearTimeout=="function"?clearTimeout:null,N=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 X(D){if(E=!1,F(D),!w)if(i(p)!==null)w=!0,O||(O=!0,$());else{var H=i(g);H!==null&&_(X,H.startTime-D)}}var O=!1,Y=-1,V=5,ae=-1;function M(){return B?!0:!(t.unstable_now()-ae<V)}function P(){if(B=!1,O){var D=t.unstable_now();ae=D;var H=!0;try{e:{w=!1,E&&(E=!1,I(Y),Y=-1),b=!0;var z=k;try{t:{for(F(D),y=i(p);y!==null&&!(y.expirationTime>D&&M());){var ne=y.callback;if(typeof ne=="function"){y.callback=null,k=y.priorityLevel;var T=ne(y.expirationTime<=D);if(D=t.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 A=i(g);A!==null&&_(X,A.startTime-D),H=!1}}break e}finally{y=null,k=z,b=!1}H=void 0}}finally{H?$():O=!1}}}var $;if(typeof N=="function")$=function(){N(P)};else if(typeof MessageChannel<"u"){var te=new MessageChannel,G=te.port2;te.port1.onmessage=P,$=function(){G.postMessage(null)}}else $=function(){j(P,0)};function _(D,H){Y=j(function(){D(t.unstable_now())},H)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(D){D.callback=null},t.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"):V=0<D?Math.floor(1e3/D):5},t.unstable_getCurrentPriorityLevel=function(){return k},t.unstable_next=function(D){switch(k){case 1:case 2:case 3:var H=3;break;default:H=k}var z=k;k=H;try{return D()}finally{k=z}},t.unstable_requestPaint=function(){B=!0},t.unstable_runWithPriority=function(D,H){switch(D){case 1:case 2:case 3:case 4:case 5:break;default:D=3}var z=k;k=D;try{return H()}finally{k=z}},t.unstable_scheduleCallback=function(D,H,z){var ne=t.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?ne+z:ne):z=ne,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=z+T,D={id:v++,callback:H,priorityLevel:D,startTime:z,expirationTime:T,sortIndex:-1},z>ne?(D.sortIndex=z,r(g,D),i(p)===null&&D===i(g)&&(E?(I(Y),Y=-1):E=!0,_(X,z-ne))):(D.sortIndex=T,r(p,D),w||b||(w=!0,O||(O=!0,$()))),D},t.unstable_shouldYield=M,t.unstable_wrapCallback=function(D){var H=k;return function(){var z=k;k=H;try{return D.apply(this,arguments)}finally{k=z}}}})(Rc)),Rc}var Fp;function zS(){return Fp||(Fp=1,jc.exports=LS()),jc.exports}var Tc={exports:{}},$t={};var Vp;function BS(){if(Vp)return $t;Vp=1;var t=bd();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=t.__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 $t.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,$t.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)},$t.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()}},$t.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))},$t.prefetchDNS=function(p){typeof p=="string"&&s.d.D(p)},$t.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})}},$t.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)},$t.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})}},$t.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)},$t.requestFormReset=function(p){s.d.r(p)},$t.unstable_batchedUpdates=function(p,g){return p(g)},$t.useFormState=function(p,g,v){return d.H.useFormState(p,g,v)},$t.useFormStatus=function(){return d.H.useHostTransitionStatus()},$t.version="19.2.8",$t}var Pp;function ky(){if(Pp)return Tc.exports;Pp=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(r){console.error(r)}}return t(),Tc.exports=BS(),Tc.exports}var Yp;function HS(){if(Yp)return ls;Yp=1;var t=zS(),r=bd(),i=ky();function s(e){var n="https://react.dev/errors/"+e;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 #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function c(e){var n=e,a=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(a=n.return),e=n.return;while(e)}return n.tag===3?a:null}function d(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function h(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function p(e){if(c(e)!==e)throw Error(s(188))}function g(e){var n=e.alternate;if(!n){if(n=c(e),n===null)throw Error(s(188));return n!==e?null:e}for(var a=e,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),e;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,R=f.child;R;){if(R===a){x=!0,a=f,l=m;break}if(R===l){x=!0,l=f,a=m;break}R=R.sibling}if(!x){for(R=m.child;R;){if(R===a){x=!0,a=m,l=f;break}if(R===l){x=!0,l=m,a=f;break}R=R.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?e:n}function v(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=v(e),n!==null)return n;e=e.sibling}return null}var y=Object.assign,k=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),j=Symbol.for("react.profiler"),I=Symbol.for("react.consumer"),N=Symbol.for("react.context"),F=Symbol.for("react.forward_ref"),X=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),Y=Symbol.for("react.memo"),V=Symbol.for("react.lazy"),ae=Symbol.for("react.activity"),M=Symbol.for("react.memo_cache_sentinel"),P=Symbol.iterator;function $(e){return e===null||typeof e!="object"?null:(e=P&&e[P]||e["@@iterator"],typeof e=="function"?e:null)}var te=Symbol.for("react.client.reference");function G(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===te?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case E:return"Fragment";case j:return"Profiler";case B:return"StrictMode";case X:return"Suspense";case O:return"SuspenseList";case ae:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case w:return"Portal";case N:return e.displayName||"Context";case I:return(e._context.displayName||"Context")+".Consumer";case F:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Y:return n=e.displayName||null,n!==null?n:G(e.type)||"Memo";case V:n=e._payload,e=e._init;try{return G(e(n))}catch{}}return null}var _=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,z={pending:!1,data:null,method:null,action:null},ne=[],T=-1;function A(e){return{current:e}}function U(e){0>T||(e.current=ne[T],ne[T]=null,T--)}function C(e,n){T++,ne[T]=e.current,e.current=n}var se=A(null),W=A(null),Z=A(null),ue=A(null);function me(e,n){switch(C(Z,n),C(W,e),C(se,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?op(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=op(n),e=up(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}U(se),C(se,e)}function ge(){U(se),U(W),U(Z)}function fe(e){e.memoizedState!==null&&C(ue,e);var n=se.current,a=up(n,e.type);n!==a&&(C(W,e),C(se,a))}function ke(e){W.current===e&&(U(se),U(W)),ue.current===e&&(U(ue),ns._currentValue=z)}var _e,Ze;function Ve(e){if(_e===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);_e=n&&n[1]||"",Ze=-1<a.stack.indexOf(`
|
|
2
|
+
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
+
`+_e+e+Ze}var lt=!1;function sn(e,n){if(!e||lt)return"";lt=!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(re){var ee=re}Reflect.construct(e,[],de)}else{try{de.call()}catch(re){ee=re}e.call(de.prototype)}}else{try{throw Error()}catch(re){ee=re}(de=e())&&typeof de.catch=="function"&&de.catch(function(){})}}catch(re){if(re&&ee&&typeof re.stack=="string")return[re.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],R=m[1];if(x&&R){var L=x.split(`
|
|
4
|
+
`),J=R.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 e.displayName&&oe.includes("<anonymous>")&&(oe=oe.replace("<anonymous>",e.displayName)),oe}while(1<=l&&0<=f);break}}}finally{lt=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?Ve(a):""}function Ot(e,n){switch(e.tag){case 26:case 27:case 5:return Ve(e.type);case 16:return Ve("Lazy");case 13:return e.child!==n&&n!==null?Ve("Suspense Fallback"):Ve("Suspense");case 19:return Ve("SuspenseList");case 0:case 15:return sn(e.type,!1);case 11:return sn(e.type.render,!1);case 1:return sn(e.type,!0);case 31:return Ve("Activity");default:return""}}function Mt(e){try{var n="",a=null;do n+=Ot(e,a),a=e,e=e.return;while(e);return n}catch(l){return`
|
|
7
|
+
Error generating stack: `+l.message+`
|
|
8
|
+
`+l.stack}}var Nt=Object.prototype.hasOwnProperty,qt=t.unstable_scheduleCallback,Ne=t.unstable_cancelCallback,Ee=t.unstable_shouldYield,dt=t.unstable_requestPaint,Oe=t.unstable_now,$e=t.unstable_getCurrentPriorityLevel,le=t.unstable_ImmediatePriority,he=t.unstable_UserBlockingPriority,be=t.unstable_NormalPriority,we=t.unstable_LowPriority,Me=t.unstable_IdlePriority,rt=t.log,jt=t.unstable_setDisableYieldValue,Ce=null,Te=null;function Be(e){if(typeof rt=="function"&&jt(e),Te&&typeof Te.setStrictMode=="function")try{Te.setStrictMode(Ce,e)}catch{}}var Ae=Math.clz32?Math.clz32:ga,At=Math.log,_t=Math.LN2;function ga(e){return e>>>=0,e===0?32:31-(At(e)/_t|0)|0}var In=256,Yn=262144,vt=4194304;function ln(e){var n=e&42;if(n!==0)return n;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Pr(e,n,a){var l=e.pendingLanes;if(l===0)return 0;var f=0,m=e.suspendedLanes,x=e.pingedLanes;e=e.warmLanes;var R=l&134217727;return R!==0?(l=R&~m,l!==0?f=ln(l):(x&=R,x!==0?f=ln(x):a||(a=R&~e,a!==0&&(f=ln(a))))):(R=l&~m,R!==0?f=ln(R):x!==0?f=ln(x):a||(a=l&~e,a!==0&&(f=ln(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 ie(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function je(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function bt(){var e=vt;return vt<<=1,(vt&62914560)===0&&(vt=4194304),e}function Rt(e){for(var n=[],a=0;31>a;a++)n.push(e);return n}function Vt(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function on(e,n,a,l,f,m){var x=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var R=e.entanglements,L=e.expirationTimes,J=e.hiddenUpdates;for(a=x&~a;0<a;){var oe=31-Ae(a),de=1<<oe;R[oe]=0,L[oe]=-1;var ee=J[oe];if(ee!==null)for(J[oe]=null,oe=0;oe<ee.length;oe++){var re=ee[oe];re!==null&&(re.lane&=-536870913)}a&=~de}l!==0&&Pt(e,l,0),m!==0&&f===0&&e.tag!==0&&(e.suspendedLanes|=m&~(x&~n))}function Pt(e,n,a){e.pendingLanes|=n,e.suspendedLanes&=~n;var l=31-Ae(n);e.entangledLanes|=n,e.entanglements[l]=e.entanglements[l]|1073741824|a&261930}function bn(e,n){var a=e.entangledLanes|=n;for(e=e.entanglements;a;){var l=31-Ae(a),f=1<<l;f&n|e[l]&n&&(e[l]|=n),a&=~f}}function zn(e,n){var a=n&-n;return a=(a&42)!==0?1:un(a),(a&(e.suspendedLanes|n))!==0?0:a}function un(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function gr(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Pd(){var e=H.p;return e!==0?e:(e=window.event,e===void 0?32:Dp(e.type))}function Yd(e,n){var a=H.p;try{return H.p=e,n()}finally{H.p=a}}var yr=Math.random().toString(36).slice(2),Lt="__reactFiber$"+yr,Xt="__reactProps$"+yr,xi="__reactContainer$"+yr,ho="__reactEvents$"+yr,kb="__reactListeners$"+yr,wb="__reactHandles$"+yr,Kd="__reactResources$"+yr,ya="__reactMarker$"+yr;function mo(e){delete e[Lt],delete e[Xt],delete e[ho],delete e[kb],delete e[wb]}function Si(e){var n=e[Lt];if(n)return n;for(var a=e.parentNode;a;){if(n=a[xi]||a[Lt]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(e=gp(e);e!==null;){if(a=e[Lt])return a;e=gp(e)}return n}e=a,a=e.parentNode}return null}function ki(e){if(e=e[Lt]||e[xi]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function va(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(s(33))}function wi(e){var n=e[Kd];return n||(n=e[Kd]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function It(e){e[ya]=!0}var Xd=new Set,Qd={};function Yr(e,n){Ci(e,n),Ci(e+"Capture",n)}function Ci(e,n){for(Qd[e]=n,e=0;e<n.length;e++)Xd.add(n[e])}var Cb=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]*$"),Zd={},Jd={};function jb(e){return Nt.call(Jd,e)?!0:Nt.call(Zd,e)?!1:Cb.test(e)?Jd[e]=!0:(Zd[e]=!0,!1)}function Ss(e,n,a){if(jb(n))if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var l=n.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,""+a)}}function ks(e,n,a){if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+a)}}function Kn(e,n,a,l){if(l===null)e.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(n,a,""+l)}}function xn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Wd(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Rb(e,n,a){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var f=l.get,m=l.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return f.call(this)},set:function(x){a=""+x,m.call(this,x)}}),Object.defineProperty(e,n,{enumerable:l.enumerable}),{getValue:function(){return a},setValue:function(x){a=""+x},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function po(e){if(!e._valueTracker){var n=Wd(e)?"checked":"value";e._valueTracker=Rb(e,n,""+e[n])}}function ef(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var a=n.getValue(),l="";return e&&(l=Wd(e)?e.checked?"true":"false":e.value),e=l,e!==a?(n.setValue(e),!0):!1}function ws(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Tb=/[\n"\\]/g;function Sn(e){return e.replace(Tb,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function go(e,n,a,l,f,m,x,R){e.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?e.type=x:e.removeAttribute("type"),n!=null?x==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+xn(n)):e.value!==""+xn(n)&&(e.value=""+xn(n)):x!=="submit"&&x!=="reset"||e.removeAttribute("value"),n!=null?yo(e,x,xn(n)):a!=null?yo(e,x,xn(a)):l!=null&&e.removeAttribute("value"),f==null&&m!=null&&(e.defaultChecked=!!m),f!=null&&(e.checked=f&&typeof f!="function"&&typeof f!="symbol"),R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"?e.name=""+xn(R):e.removeAttribute("name")}function tf(e,n,a,l,f,m,x,R){if(m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(e.type=m),n!=null||a!=null){if(!(m!=="submit"&&m!=="reset"||n!=null)){po(e);return}a=a!=null?""+xn(a):"",n=n!=null?""+xn(n):a,R||n===e.value||(e.value=n),e.defaultValue=n}l=l??f,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=R?e.checked:!!l,e.defaultChecked=!!l,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(e.name=x),po(e)}function yo(e,n,a){n==="number"&&ws(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function ji(e,n,a,l){if(e=e.options,n){n={};for(var f=0;f<a.length;f++)n["$"+a[f]]=!0;for(a=0;a<e.length;a++)f=n.hasOwnProperty("$"+e[a].value),e[a].selected!==f&&(e[a].selected=f),f&&l&&(e[a].defaultSelected=!0)}else{for(a=""+xn(a),n=null,f=0;f<e.length;f++){if(e[f].value===a){e[f].selected=!0,l&&(e[f].defaultSelected=!0);return}n!==null||e[f].disabled||(n=e[f])}n!==null&&(n.selected=!0)}}function nf(e,n,a){if(n!=null&&(n=""+xn(n),n!==e.value&&(e.value=n),a==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=a!=null?""+xn(a):""}function rf(e,n,a,l){if(n==null){if(l!=null){if(a!=null)throw Error(s(92));if(_(l)){if(1<l.length)throw Error(s(93));l=l[0]}a=l}a==null&&(a=""),n=a}a=xn(n),e.defaultValue=a,l=e.textContent,l===a&&l!==""&&l!==null&&(e.value=l),po(e)}function Ri(e,n){if(n){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=n;return}}e.textContent=n}var Eb=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 af(e,n,a){var l=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?l?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":l?e.setProperty(n,a):typeof a!="number"||a===0||Eb.has(n)?n==="float"?e.cssFloat=a:e[n]=(""+a).trim():e[n]=a+"px"}function sf(e,n,a){if(n!=null&&typeof n!="object")throw Error(s(62));if(e=e.style,a!=null){for(var l in a)!a.hasOwnProperty(l)||n!=null&&n.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var f in n)l=n[f],n.hasOwnProperty(f)&&a[f]!==l&&af(e,f,l)}else for(var m in n)n.hasOwnProperty(m)&&af(e,m,n[m])}function vo(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Nb=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"]]),Ab=/^[\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 Cs(e){return Ab.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Xn(){}var bo=null;function xo(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ti=null,Ei=null;function lf(e){var n=ki(e);if(n&&(e=n.stateNode)){var a=e[Xt]||null;e:switch(e=n.stateNode,n.type){case"input":if(go(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),n=a.name,a.type==="radio"&&n!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Sn(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var l=a[n];if(l!==e&&l.form===e.form){var f=l[Xt]||null;if(!f)throw Error(s(90));go(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===e.form&&ef(l)}break e;case"textarea":nf(e,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&ji(e,!!a.multiple,n,!1)}}}var So=!1;function of(e,n,a){if(So)return e(n,a);So=!0;try{var l=e(n);return l}finally{if(So=!1,(Ti!==null||Ei!==null)&&(dl(),Ti&&(n=Ti,e=Ei,Ei=Ti=null,lf(n),e)))for(n=0;n<e.length;n++)lf(e[n])}}function ba(e,n){var a=e.stateNode;if(a===null)return null;var l=a[Xt]||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)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(s(231,n,typeof a));return a}var Qn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ko=!1;if(Qn)try{var xa={};Object.defineProperty(xa,"passive",{get:function(){ko=!0}}),window.addEventListener("test",xa,xa),window.removeEventListener("test",xa,xa)}catch{ko=!1}var vr=null,wo=null,js=null;function uf(){if(js)return js;var e,n=wo,a=n.length,l,f="value"in vr?vr.value:vr.textContent,m=f.length;for(e=0;e<a&&n[e]===f[e];e++);var x=a-e;for(l=1;l<=x&&n[a-l]===f[m-l];l++);return js=f.slice(e,1<l?1-l:void 0)}function Rs(e){var n=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&n===13&&(e=13)):e=n,e===10&&(e=13),32<=e||e===13?e:0}function Ts(){return!0}function cf(){return!1}function Qt(e){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 R in e)e.hasOwnProperty(R)&&(a=e[R],this[R]=a?a(m):m[R]);return this.isDefaultPrevented=(m.defaultPrevented!=null?m.defaultPrevented:m.returnValue===!1)?Ts:cf,this.isPropagationStopped=cf,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=Ts)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Ts)},persist:function(){},isPersistent:Ts}),n}var Kr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Es=Qt(Kr),Sa=y({},Kr,{view:0,detail:0}),Ib=Qt(Sa),Co,jo,ka,Ns=y({},Sa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:To,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==ka&&(ka&&e.type==="mousemove"?(Co=e.screenX-ka.screenX,jo=e.screenY-ka.screenY):jo=Co=0,ka=e),Co)},movementY:function(e){return"movementY"in e?e.movementY:jo}}),df=Qt(Ns),Db=y({},Ns,{dataTransfer:0}),Ob=Qt(Db),Mb=y({},Sa,{relatedTarget:0}),Ro=Qt(Mb),_b=y({},Kr,{animationName:0,elapsedTime:0,pseudoElement:0}),Lb=Qt(_b),zb=y({},Kr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Bb=Qt(zb),Hb=y({},Kr,{data:0}),ff=Qt(Hb),Ub={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},qb={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"},$b={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Gb(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=$b[e])?!!n[e]:!1}function To(){return Gb}var Fb=y({},Sa,{key:function(e){if(e.key){var n=Ub[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=Rs(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?qb[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:To,charCode:function(e){return e.type==="keypress"?Rs(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Rs(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Vb=Qt(Fb),Pb=y({},Ns,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),hf=Qt(Pb),Yb=y({},Sa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:To}),Kb=Qt(Yb),Xb=y({},Kr,{propertyName:0,elapsedTime:0,pseudoElement:0}),Qb=Qt(Xb),Zb=y({},Ns,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Jb=Qt(Zb),Wb=y({},Kr,{newState:0,oldState:0}),ex=Qt(Wb),tx=[9,13,27,32],Eo=Qn&&"CompositionEvent"in window,wa=null;Qn&&"documentMode"in document&&(wa=document.documentMode);var nx=Qn&&"TextEvent"in window&&!wa,mf=Qn&&(!Eo||wa&&8<wa&&11>=wa),pf=" ",gf=!1;function yf(e,n){switch(e){case"keyup":return tx.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function vf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ni=!1;function rx(e,n){switch(e){case"compositionend":return vf(n);case"keypress":return n.which!==32?null:(gf=!0,pf);case"textInput":return e=n.data,e===pf&&gf?null:e;default:return null}}function ix(e,n){if(Ni)return e==="compositionend"||!Eo&&yf(e,n)?(e=uf(),js=wo=vr=null,Ni=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return mf&&n.locale!=="ko"?null:n.data;default:return null}}var ax={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 bf(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!ax[e.type]:n==="textarea"}function xf(e,n,a,l){Ti?Ei?Ei.push(l):Ei=[l]:Ti=l,n=vl(n,"onChange"),0<n.length&&(a=new Es("onChange","change",null,a,l),e.push({event:a,listeners:n}))}var Ca=null,ja=null;function sx(e){np(e,0)}function As(e){var n=va(e);if(ef(n))return e}function Sf(e,n){if(e==="change")return n}var kf=!1;if(Qn){var No;if(Qn){var Ao="oninput"in document;if(!Ao){var wf=document.createElement("div");wf.setAttribute("oninput","return;"),Ao=typeof wf.oninput=="function"}No=Ao}else No=!1;kf=No&&(!document.documentMode||9<document.documentMode)}function Cf(){Ca&&(Ca.detachEvent("onpropertychange",jf),ja=Ca=null)}function jf(e){if(e.propertyName==="value"&&As(ja)){var n=[];xf(n,ja,e,xo(e)),of(sx,n)}}function lx(e,n,a){e==="focusin"?(Cf(),Ca=n,ja=a,Ca.attachEvent("onpropertychange",jf)):e==="focusout"&&Cf()}function ox(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return As(ja)}function ux(e,n){if(e==="click")return As(n)}function cx(e,n){if(e==="input"||e==="change")return As(n)}function dx(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var cn=typeof Object.is=="function"?Object.is:dx;function Ra(e,n){if(cn(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var a=Object.keys(e),l=Object.keys(n);if(a.length!==l.length)return!1;for(l=0;l<a.length;l++){var f=a[l];if(!Nt.call(n,f)||!cn(e[f],n[f]))return!1}return!0}function Rf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Tf(e,n){var a=Rf(e);e=0;for(var l;a;){if(a.nodeType===3){if(l=e+a.textContent.length,e<=n&&l>=n)return{node:a,offset:n-e};e=l}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Rf(a)}}function Ef(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Ef(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Nf(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=ws(e.document);n instanceof e.HTMLIFrameElement;){try{var a=typeof n.contentWindow.location.href=="string"}catch{a=!1}if(a)e=n.contentWindow;else break;n=ws(e.document)}return n}function Io(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var fx=Qn&&"documentMode"in document&&11>=document.documentMode,Ai=null,Do=null,Ta=null,Oo=!1;function Af(e,n,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Oo||Ai==null||Ai!==ws(l)||(l=Ai,"selectionStart"in l&&Io(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&&Ra(Ta,l)||(Ta=l,l=vl(Do,"onSelect"),0<l.length&&(n=new Es("onSelect","select",null,n,a),e.push({event:n,listeners:l}),n.target=Ai)))}function Xr(e,n){var a={};return a[e.toLowerCase()]=n.toLowerCase(),a["Webkit"+e]="webkit"+n,a["Moz"+e]="moz"+n,a}var Ii={animationend:Xr("Animation","AnimationEnd"),animationiteration:Xr("Animation","AnimationIteration"),animationstart:Xr("Animation","AnimationStart"),transitionrun:Xr("Transition","TransitionRun"),transitionstart:Xr("Transition","TransitionStart"),transitioncancel:Xr("Transition","TransitionCancel"),transitionend:Xr("Transition","TransitionEnd")},Mo={},If={};Qn&&(If=document.createElement("div").style,"AnimationEvent"in window||(delete Ii.animationend.animation,delete Ii.animationiteration.animation,delete Ii.animationstart.animation),"TransitionEvent"in window||delete Ii.transitionend.transition);function Qr(e){if(Mo[e])return Mo[e];if(!Ii[e])return e;var n=Ii[e],a;for(a in n)if(n.hasOwnProperty(a)&&a in If)return Mo[e]=n[a];return e}var Df=Qr("animationend"),Of=Qr("animationiteration"),Mf=Qr("animationstart"),hx=Qr("transitionrun"),mx=Qr("transitionstart"),px=Qr("transitioncancel"),_f=Qr("transitionend"),Lf=new Map,_o="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(" ");_o.push("scrollEnd");function Dn(e,n){Lf.set(e,n),Yr(n,[e])}var Is=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},kn=[],Di=0,Lo=0;function Ds(){for(var e=Di,n=Lo=Di=0;n<e;){var a=kn[n];kn[n++]=null;var l=kn[n];kn[n++]=null;var f=kn[n];kn[n++]=null;var m=kn[n];if(kn[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&&zf(a,f,m)}}function Os(e,n,a,l){kn[Di++]=e,kn[Di++]=n,kn[Di++]=a,kn[Di++]=l,Lo|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function zo(e,n,a,l){return Os(e,n,a,l),Ms(e)}function Zr(e,n){return Os(e,null,null,n),Ms(e)}function zf(e,n,a){e.lanes|=a;var l=e.alternate;l!==null&&(l.lanes|=a);for(var f=!1,m=e.return;m!==null;)m.childLanes|=a,l=m.alternate,l!==null&&(l.childLanes|=a),m.tag===22&&(e=m.stateNode,e===null||e._visibility&1||(f=!0)),e=m,m=m.return;return e.tag===3?(m=e.stateNode,f&&n!==null&&(f=31-Ae(a),e=m.hiddenUpdates,l=e[f],l===null?e[f]=[n]:l.push(n),n.lane=a|536870912),m):null}function Ms(e){if(50<Xa)throw Xa=0,Pu=null,Error(s(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var Oi={};function gx(e,n,a,l){this.tag=e,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 dn(e,n,a,l){return new gx(e,n,a,l)}function Bo(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Zn(e,n){var a=e.alternate;return a===null?(a=dn(e.tag,n,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=n,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,n=e.dependencies,a.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function Bf(e,n){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=n,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,n=a.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function _s(e,n,a,l,f,m){var x=0;if(l=e,typeof e=="function")Bo(e)&&(x=1);else if(typeof e=="string")x=SS(e,a,se.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case ae:return e=dn(31,a,n,f),e.elementType=ae,e.lanes=m,e;case E:return Jr(a.children,f,m,n);case B:x=8,f|=24;break;case j:return e=dn(12,a,n,f|2),e.elementType=j,e.lanes=m,e;case X:return e=dn(13,a,n,f),e.elementType=X,e.lanes=m,e;case O:return e=dn(19,a,n,f),e.elementType=O,e.lanes=m,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case N:x=10;break e;case I:x=9;break e;case F:x=11;break e;case Y:x=14;break e;case V:x=16,l=null;break e}x=29,a=Error(s(130,e===null?"null":typeof e,"")),l=null}return n=dn(x,a,n,f),n.elementType=e,n.type=l,n.lanes=m,n}function Jr(e,n,a,l){return e=dn(7,e,l,n),e.lanes=a,e}function Ho(e,n,a){return e=dn(6,e,null,n),e.lanes=a,e}function Hf(e){var n=dn(18,null,null,0);return n.stateNode=e,n}function Uo(e,n,a){return n=dn(4,e.children!==null?e.children:[],e.key,n),n.lanes=a,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var Uf=new WeakMap;function wn(e,n){if(typeof e=="object"&&e!==null){var a=Uf.get(e);return a!==void 0?a:(n={value:e,source:n,stack:Mt(n)},Uf.set(e,n),n)}return{value:e,source:n,stack:Mt(n)}}var Mi=[],_i=0,Ls=null,Ea=0,Cn=[],jn=0,br=null,Bn=1,Hn="";function Jn(e,n){Mi[_i++]=Ea,Mi[_i++]=Ls,Ls=e,Ea=n}function qf(e,n,a){Cn[jn++]=Bn,Cn[jn++]=Hn,Cn[jn++]=br,br=e;var l=Bn;e=Hn;var f=32-Ae(l)-1;l&=~(1<<f),a+=1;var m=32-Ae(n)+f;if(30<m){var x=f-f%5;m=(l&(1<<x)-1).toString(32),l>>=x,f-=x,Bn=1<<32-Ae(n)+f|a<<f|l,Hn=m+e}else Bn=1<<m|a<<f|l,Hn=e}function qo(e){e.return!==null&&(Jn(e,1),qf(e,1,0))}function $o(e){for(;e===Ls;)Ls=Mi[--_i],Mi[_i]=null,Ea=Mi[--_i],Mi[_i]=null;for(;e===br;)br=Cn[--jn],Cn[jn]=null,Hn=Cn[--jn],Cn[jn]=null,Bn=Cn[--jn],Cn[jn]=null}function $f(e,n){Cn[jn++]=Bn,Cn[jn++]=Hn,Cn[jn++]=br,Bn=n.id,Hn=n.overflow,br=e}var zt=null,ot=null,Pe=!1,xr=null,Rn=!1,Go=Error(s(519));function Sr(e){var n=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Na(wn(n,e)),Go}function Gf(e){var n=e.stateNode,a=e.type,l=e.memoizedProps;switch(n[Lt]=e,n[Xt]=l,a){case"dialog":Ue("cancel",n),Ue("close",n);break;case"iframe":case"object":case"embed":Ue("load",n);break;case"video":case"audio":for(a=0;a<Za.length;a++)Ue(Za[a],n);break;case"source":Ue("error",n);break;case"img":case"image":case"link":Ue("error",n),Ue("load",n);break;case"details":Ue("toggle",n);break;case"input":Ue("invalid",n),tf(n,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Ue("invalid",n);break;case"textarea":Ue("invalid",n),rf(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||sp(n.textContent,a)?(l.popover!=null&&(Ue("beforetoggle",n),Ue("toggle",n)),l.onScroll!=null&&Ue("scroll",n),l.onScrollEnd!=null&&Ue("scrollend",n),l.onClick!=null&&(n.onclick=Xn),n=!0):n=!1,n||Sr(e,!0)}function Ff(e){for(zt=e.return;zt;)switch(zt.tag){case 5:case 31:case 13:Rn=!1;return;case 27:case 3:Rn=!0;return;default:zt=zt.return}}function Li(e){if(e!==zt)return!1;if(!Pe)return Ff(e),Pe=!0,!1;var n=e.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||lc(e.type,e.memoizedProps)),a=!a),a&&ot&&Sr(e),Ff(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(317));ot=pp(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(317));ot=pp(e)}else n===27?(n=ot,_r(e.type)?(e=fc,fc=null,ot=e):ot=n):ot=zt?En(e.stateNode.nextSibling):null;return!0}function Wr(){ot=zt=null,Pe=!1}function Fo(){var e=xr;return e!==null&&(en===null?en=e:en.push.apply(en,e),xr=null),e}function Na(e){xr===null?xr=[e]:xr.push(e)}var Vo=A(null),ei=null,Wn=null;function kr(e,n,a){C(Vo,n._currentValue),n._currentValue=a}function er(e){e._currentValue=Vo.current,U(Vo)}function Po(e,n,a){for(;e!==null;){var l=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,l!==null&&(l.childLanes|=n)):l!==null&&(l.childLanes&n)!==n&&(l.childLanes|=n),e===a)break;e=e.return}}function Yo(e,n,a,l){var f=e.child;for(f!==null&&(f.return=e);f!==null;){var m=f.dependencies;if(m!==null){var x=f.child;m=m.firstContext;e:for(;m!==null;){var R=m;m=f;for(var L=0;L<n.length;L++)if(R.context===n[L]){m.lanes|=a,R=m.alternate,R!==null&&(R.lanes|=a),Po(m.return,a,e),l||(x=null);break e}m=R.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),Po(x,a,e),x=null}else x=f.child;if(x!==null)x.return=f;else for(x=f;x!==null;){if(x===e){x=null;break}if(f=x.sibling,f!==null){f.return=x.return,x=f;break}x=x.return}f=x}}function zi(e,n,a,l){e=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 R=f.type;cn(f.pendingProps.value,x.value)||(e!==null?e.push(R):e=[R])}}else if(f===ue.current){if(x=f.alternate,x===null)throw Error(s(387));x.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(e!==null?e.push(ns):e=[ns])}f=f.return}e!==null&&Yo(n,e,a,l),n.flags|=262144}function zs(e){for(e=e.firstContext;e!==null;){if(!cn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ti(e){ei=e,Wn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Bt(e){return Vf(ei,e)}function Bs(e,n){return ei===null&&ti(e),Vf(e,n)}function Vf(e,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},Wn===null){if(e===null)throw Error(s(308));Wn=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else Wn=Wn.next=n;return a}var yx=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(a,l){e.push(l)}};this.abort=function(){n.aborted=!0,e.forEach(function(a){return a()})}},vx=t.unstable_scheduleCallback,bx=t.unstable_NormalPriority,xt={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ko(){return{controller:new yx,data:new Map,refCount:0}}function Aa(e){e.refCount--,e.refCount===0&&vx(bx,function(){e.controller.abort()})}var Ia=null,Xo=0,Bi=0,Hi=null;function xx(e,n){if(Ia===null){var a=Ia=[];Xo=0,Bi=Ju(),Hi={status:"pending",value:void 0,then:function(l){a.push(l)}}}return Xo++,n.then(Pf,Pf),n}function Pf(){if(--Xo===0&&Ia!==null){Hi!==null&&(Hi.status="fulfilled");var e=Ia;Ia=null,Bi=0,Hi=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function Sx(e,n){var a=[],l={status:"pending",value:null,reason:null,then:function(f){a.push(f)}};return e.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 Yf=D.S;D.S=function(e,n){Am=Oe(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&xx(e,n),Yf!==null&&Yf(e,n)};var ni=A(null);function Qo(){var e=ni.current;return e!==null?e:it.pooledCache}function Hs(e,n){n===null?C(ni,ni.current):C(ni,n.pool)}function Kf(){var e=Qo();return e===null?null:{parent:xt._currentValue,pool:e}}var Ui=Error(s(460)),Zo=Error(s(474)),Us=Error(s(542)),qs={then:function(){}};function Xf(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Qf(e,n,a){switch(a=e[a],a===void 0?e.push(n):a!==n&&(n.then(Xn,Xn),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,Jf(e),e;default:if(typeof n.status=="string")n.then(Xn,Xn);else{if(e=it,e!==null&&100<e.shellSuspendCounter)throw Error(s(482));e=n,e.status="pending",e.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 e=n.reason,Jf(e),e}throw ii=n,Ui}}function ri(e){try{var n=e._init;return n(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(ii=a,Ui):a}}var ii=null;function Zf(){if(ii===null)throw Error(s(459));var e=ii;return ii=null,e}function Jf(e){if(e===Ui||e===Us)throw Error(s(483))}var qi=null,Da=0;function $s(e){var n=Da;return Da+=1,qi===null&&(qi=[]),Qf(qi,e,n)}function Oa(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function Gs(e,n){throw n.$$typeof===k?Error(s(525)):(e=Object.prototype.toString.call(n),Error(s(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function Wf(e){function n(K,q){if(e){var Q=K.deletions;Q===null?(K.deletions=[q],K.flags|=16):Q.push(q)}}function a(K,q){if(!e)return null;for(;q!==null;)n(K,q),q=q.sibling;return null}function l(K){for(var q=new Map;K!==null;)K.key!==null?q.set(K.key,K):q.set(K.index,K),K=K.sibling;return q}function f(K,q){return K=Zn(K,q),K.index=0,K.sibling=null,K}function m(K,q,Q){return K.index=Q,e?(Q=K.alternate,Q!==null?(Q=Q.index,Q<q?(K.flags|=67108866,q):Q):(K.flags|=67108866,q)):(K.flags|=1048576,q)}function x(K){return e&&K.alternate===null&&(K.flags|=67108866),K}function R(K,q,Q,ce){return q===null||q.tag!==6?(q=Ho(Q,K.mode,ce),q.return=K,q):(q=f(q,Q),q.return=K,q)}function L(K,q,Q,ce){var xe=Q.type;return xe===E?oe(K,q,Q.props.children,ce,Q.key):q!==null&&(q.elementType===xe||typeof xe=="object"&&xe!==null&&xe.$$typeof===V&&ri(xe)===q.type)?(q=f(q,Q.props),Oa(q,Q),q.return=K,q):(q=_s(Q.type,Q.key,Q.props,null,K.mode,ce),Oa(q,Q),q.return=K,q)}function J(K,q,Q,ce){return q===null||q.tag!==4||q.stateNode.containerInfo!==Q.containerInfo||q.stateNode.implementation!==Q.implementation?(q=Uo(Q,K.mode,ce),q.return=K,q):(q=f(q,Q.children||[]),q.return=K,q)}function oe(K,q,Q,ce,xe){return q===null||q.tag!==7?(q=Jr(Q,K.mode,ce,xe),q.return=K,q):(q=f(q,Q),q.return=K,q)}function de(K,q,Q){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return q=Ho(""+q,K.mode,Q),q.return=K,q;if(typeof q=="object"&&q!==null){switch(q.$$typeof){case b:return Q=_s(q.type,q.key,q.props,null,K.mode,Q),Oa(Q,q),Q.return=K,Q;case w:return q=Uo(q,K.mode,Q),q.return=K,q;case V:return q=ri(q),de(K,q,Q)}if(_(q)||$(q))return q=Jr(q,K.mode,Q,null),q.return=K,q;if(typeof q.then=="function")return de(K,$s(q),Q);if(q.$$typeof===N)return de(K,Bs(K,q),Q);Gs(K,q)}return null}function ee(K,q,Q,ce){var xe=q!==null?q.key:null;if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return xe!==null?null:R(K,q,""+Q,ce);if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case b:return Q.key===xe?L(K,q,Q,ce):null;case w:return Q.key===xe?J(K,q,Q,ce):null;case V:return Q=ri(Q),ee(K,q,Q,ce)}if(_(Q)||$(Q))return xe!==null?null:oe(K,q,Q,ce,null);if(typeof Q.then=="function")return ee(K,q,$s(Q),ce);if(Q.$$typeof===N)return ee(K,q,Bs(K,Q),ce);Gs(K,Q)}return null}function re(K,q,Q,ce,xe){if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return K=K.get(Q)||null,R(q,K,""+ce,xe);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case b:return K=K.get(ce.key===null?Q:ce.key)||null,L(q,K,ce,xe);case w:return K=K.get(ce.key===null?Q:ce.key)||null,J(q,K,ce,xe);case V:return ce=ri(ce),re(K,q,Q,ce,xe)}if(_(ce)||$(ce))return K=K.get(Q)||null,oe(q,K,ce,xe,null);if(typeof ce.then=="function")return re(K,q,Q,$s(ce),xe);if(ce.$$typeof===N)return re(K,q,Q,Bs(q,ce),xe);Gs(q,ce)}return null}function ye(K,q,Q,ce){for(var xe=null,Ke=null,ve=q,ze=q=0,Fe=null;ve!==null&&ze<Q.length;ze++){ve.index>ze?(Fe=ve,ve=null):Fe=ve.sibling;var Xe=ee(K,ve,Q[ze],ce);if(Xe===null){ve===null&&(ve=Fe);break}e&&ve&&Xe.alternate===null&&n(K,ve),q=m(Xe,q,ze),Ke===null?xe=Xe:Ke.sibling=Xe,Ke=Xe,ve=Fe}if(ze===Q.length)return a(K,ve),Pe&&Jn(K,ze),xe;if(ve===null){for(;ze<Q.length;ze++)ve=de(K,Q[ze],ce),ve!==null&&(q=m(ve,q,ze),Ke===null?xe=ve:Ke.sibling=ve,Ke=ve);return Pe&&Jn(K,ze),xe}for(ve=l(ve);ze<Q.length;ze++)Fe=re(ve,K,ze,Q[ze],ce),Fe!==null&&(e&&Fe.alternate!==null&&ve.delete(Fe.key===null?ze:Fe.key),q=m(Fe,q,ze),Ke===null?xe=Fe:Ke.sibling=Fe,Ke=Fe);return e&&ve.forEach(function(Ur){return n(K,Ur)}),Pe&&Jn(K,ze),xe}function Re(K,q,Q,ce){if(Q==null)throw Error(s(151));for(var xe=null,Ke=null,ve=q,ze=q=0,Fe=null,Xe=Q.next();ve!==null&&!Xe.done;ze++,Xe=Q.next()){ve.index>ze?(Fe=ve,ve=null):Fe=ve.sibling;var Ur=ee(K,ve,Xe.value,ce);if(Ur===null){ve===null&&(ve=Fe);break}e&&ve&&Ur.alternate===null&&n(K,ve),q=m(Ur,q,ze),Ke===null?xe=Ur:Ke.sibling=Ur,Ke=Ur,ve=Fe}if(Xe.done)return a(K,ve),Pe&&Jn(K,ze),xe;if(ve===null){for(;!Xe.done;ze++,Xe=Q.next())Xe=de(K,Xe.value,ce),Xe!==null&&(q=m(Xe,q,ze),Ke===null?xe=Xe:Ke.sibling=Xe,Ke=Xe);return Pe&&Jn(K,ze),xe}for(ve=l(ve);!Xe.done;ze++,Xe=Q.next())Xe=re(ve,K,ze,Xe.value,ce),Xe!==null&&(e&&Xe.alternate!==null&&ve.delete(Xe.key===null?ze:Xe.key),q=m(Xe,q,ze),Ke===null?xe=Xe:Ke.sibling=Xe,Ke=Xe);return e&&ve.forEach(function(DS){return n(K,DS)}),Pe&&Jn(K,ze),xe}function nt(K,q,Q,ce){if(typeof Q=="object"&&Q!==null&&Q.type===E&&Q.key===null&&(Q=Q.props.children),typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case b:e:{for(var xe=Q.key;q!==null;){if(q.key===xe){if(xe=Q.type,xe===E){if(q.tag===7){a(K,q.sibling),ce=f(q,Q.props.children),ce.return=K,K=ce;break e}}else if(q.elementType===xe||typeof xe=="object"&&xe!==null&&xe.$$typeof===V&&ri(xe)===q.type){a(K,q.sibling),ce=f(q,Q.props),Oa(ce,Q),ce.return=K,K=ce;break e}a(K,q);break}else n(K,q);q=q.sibling}Q.type===E?(ce=Jr(Q.props.children,K.mode,ce,Q.key),ce.return=K,K=ce):(ce=_s(Q.type,Q.key,Q.props,null,K.mode,ce),Oa(ce,Q),ce.return=K,K=ce)}return x(K);case w:e:{for(xe=Q.key;q!==null;){if(q.key===xe)if(q.tag===4&&q.stateNode.containerInfo===Q.containerInfo&&q.stateNode.implementation===Q.implementation){a(K,q.sibling),ce=f(q,Q.children||[]),ce.return=K,K=ce;break e}else{a(K,q);break}else n(K,q);q=q.sibling}ce=Uo(Q,K.mode,ce),ce.return=K,K=ce}return x(K);case V:return Q=ri(Q),nt(K,q,Q,ce)}if(_(Q))return ye(K,q,Q,ce);if($(Q)){if(xe=$(Q),typeof xe!="function")throw Error(s(150));return Q=xe.call(Q),Re(K,q,Q,ce)}if(typeof Q.then=="function")return nt(K,q,$s(Q),ce);if(Q.$$typeof===N)return nt(K,q,Bs(K,Q),ce);Gs(K,Q)}return typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint"?(Q=""+Q,q!==null&&q.tag===6?(a(K,q.sibling),ce=f(q,Q),ce.return=K,K=ce):(a(K,q),ce=Ho(Q,K.mode,ce),ce.return=K,K=ce),x(K)):a(K,q)}return function(K,q,Q,ce){try{Da=0;var xe=nt(K,q,Q,ce);return qi=null,xe}catch(ve){if(ve===Ui||ve===Us)throw ve;var Ke=dn(29,ve,null,K.mode);return Ke.lanes=ce,Ke.return=K,Ke}}}var ai=Wf(!0),eh=Wf(!1),wr=!1;function Jo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Wo(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Cr(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function jr(e,n,a){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Qe&2)!==0){var f=l.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),l.pending=n,n=Ms(e),zf(e,null,a),n}return Os(e,l,n,a),Ms(e)}function Ma(e,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var l=n.lanes;l&=e.pendingLanes,a|=l,n.lanes=a,bn(e,a)}}function eu(e,n){var a=e.updateQueue,l=e.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},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=n:e.next=n,a.lastBaseUpdate=n}var tu=!1;function _a(){if(tu){var e=Hi;if(e!==null)throw e}}function La(e,n,a,l){tu=!1;var f=e.updateQueue;wr=!1;var m=f.firstBaseUpdate,x=f.lastBaseUpdate,R=f.shared.pending;if(R!==null){f.shared.pending=null;var L=R,J=L.next;L.next=null,x===null?m=J:x.next=J,x=L;var oe=e.alternate;oe!==null&&(oe=oe.updateQueue,R=oe.lastBaseUpdate,R!==x&&(R===null?oe.firstBaseUpdate=J:R.next=J,oe.lastBaseUpdate=L))}if(m!==null){var de=f.baseState;x=0,oe=J=L=null,R=m;do{var ee=R.lane&-536870913,re=ee!==R.lane;if(re?(Ge&ee)===ee:(l&ee)===ee){ee!==0&&ee===Bi&&(tu=!0),oe!==null&&(oe=oe.next={lane:0,tag:R.tag,payload:R.payload,callback:null,next:null});e:{var ye=e,Re=R;ee=n;var nt=a;switch(Re.tag){case 1:if(ye=Re.payload,typeof ye=="function"){de=ye.call(nt,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(nt,de,ee):ye,ee==null)break e;de=y({},de,ee);break e;case 2:wr=!0}}ee=R.callback,ee!==null&&(e.flags|=64,re&&(e.flags|=8192),re=f.callbacks,re===null?f.callbacks=[ee]:re.push(ee))}else re={lane:ee,tag:R.tag,payload:R.payload,callback:R.callback,next:null},oe===null?(J=oe=re,L=de):oe=oe.next=re,x|=ee;if(R=R.next,R===null){if(R=f.shared.pending,R===null)break;re=R,R=re.next,re.next=null,f.lastBaseUpdate=re,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),Ar|=x,e.lanes=x,e.memoizedState=de}}function th(e,n){if(typeof e!="function")throw Error(s(191,e));e.call(n)}function nh(e,n){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)th(a[e],n)}var $i=A(null),Fs=A(0);function rh(e,n){e=ur,C(Fs,e),C($i,n),ur=e|n.baseLanes}function nu(){C(Fs,ur),C($i,$i.current)}function ru(){ur=Fs.current,U($i),U(Fs)}var fn=A(null),Tn=null;function Rr(e){var n=e.alternate;C(pt,pt.current&1),C(fn,e),Tn===null&&(n===null||$i.current!==null||n.memoizedState!==null)&&(Tn=e)}function iu(e){C(pt,pt.current),C(fn,e),Tn===null&&(Tn=e)}function ih(e){e.tag===22?(C(pt,pt.current),C(fn,e),Tn===null&&(Tn=e)):Tr()}function Tr(){C(pt,pt.current),C(fn,fn.current)}function hn(e){U(fn),Tn===e&&(Tn=null),U(pt)}var pt=A(0);function Vs(e){for(var n=e;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||cc(a)||dc(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===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var tr=0,Le=null,et=null,St=null,Ps=!1,Gi=!1,si=!1,Ys=0,za=0,Fi=null,kx=0;function ft(){throw Error(s(321))}function au(e,n){if(n===null)return!1;for(var a=0;a<n.length&&a<e.length;a++)if(!cn(e[a],n[a]))return!1;return!0}function su(e,n,a,l,f,m){return tr=m,Le=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,D.H=e===null||e.memoizedState===null?qh:Su,si=!1,m=a(l,f),si=!1,Gi&&(m=sh(n,a,l,f)),ah(e),m}function ah(e){D.H=Ua;var n=et!==null&&et.next!==null;if(tr=0,St=et=Le=null,Ps=!1,za=0,Fi=null,n)throw Error(s(300));e===null||kt||(e=e.dependencies,e!==null&&zs(e)&&(kt=!0))}function sh(e,n,a,l){Le=e;var f=0;do{if(Gi&&(Fi=null),za=0,Gi=!1,25<=f)throw Error(s(301));if(f+=1,St=et=null,e.updateQueue!=null){var m=e.updateQueue;m.lastEffect=null,m.events=null,m.stores=null,m.memoCache!=null&&(m.memoCache.index=0)}D.H=$h,m=n(a,l)}while(Gi);return m}function wx(){var e=D.H,n=e.useState()[0];return n=typeof n.then=="function"?Ba(n):n,e=e.useState()[0],(et!==null?et.memoizedState:null)!==e&&(Le.flags|=1024),n}function lu(){var e=Ys!==0;return Ys=0,e}function ou(e,n,a){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~a}function uu(e){if(Ps){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}Ps=!1}tr=0,St=et=Le=null,Gi=!1,za=Ys=0,Fi=null}function Yt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return St===null?Le.memoizedState=St=e:St=St.next=e,St}function gt(){if(et===null){var e=Le.alternate;e=e!==null?e.memoizedState:null}else e=et.next;var n=St===null?Le.memoizedState:St.next;if(n!==null)St=n,et=e;else{if(e===null)throw Le.alternate===null?Error(s(467)):Error(s(310));et=e,e={memoizedState:et.memoizedState,baseState:et.baseState,baseQueue:et.baseQueue,queue:et.queue,next:null},St===null?Le.memoizedState=St=e:St=St.next=e}return St}function Ks(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ba(e){var n=za;return za+=1,Fi===null&&(Fi=[]),e=Qf(Fi,e,n),n=Le,(St===null?n.memoizedState:St.next)===null&&(n=n.alternate,D.H=n===null||n.memoizedState===null?qh:Su),e}function Xs(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Ba(e);if(e.$$typeof===N)return Bt(e)}throw Error(s(438,String(e)))}function cu(e){var n=null,a=Le.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var l=Le.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=Ks(),Le.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(e),l=0;l<e;l++)a[l]=M;return n.index++,a}function nr(e,n){return typeof n=="function"?n(e):n}function Qs(e){var n=gt();return du(n,et,e)}function du(e,n,a){var l=e.queue;if(l===null)throw Error(s(311));l.lastRenderedReducer=a;var f=e.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=e.baseState,f===null)e.memoizedState=m;else{n=f.next;var R=x=null,L=null,J=n,oe=!1;do{var de=J.lane&-536870913;if(de!==J.lane?(Ge&de)===de:(tr&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===Bi&&(oe=!0);else if((tr&ee)===ee){J=J.next,ee===Bi&&(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?(R=L=de,x=m):L=L.next=de,Le.lanes|=ee,Ar|=ee;de=J.action,si&&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?(R=L=ee,x=m):L=L.next=ee,Le.lanes|=de,Ar|=de;J=J.next}while(J!==null&&J!==n);if(L===null?x=m:L.next=R,!cn(m,e.memoizedState)&&(kt=!0,oe&&(a=Hi,a!==null)))throw a;e.memoizedState=m,e.baseState=x,e.baseQueue=L,l.lastRenderedState=m}return f===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function fu(e){var n=gt(),a=n.queue;if(a===null)throw Error(s(311));a.lastRenderedReducer=e;var l=a.dispatch,f=a.pending,m=n.memoizedState;if(f!==null){a.pending=null;var x=f=f.next;do m=e(m,x.action),x=x.next;while(x!==f);cn(m,n.memoizedState)||(kt=!0),n.memoizedState=m,n.baseQueue===null&&(n.baseState=m),a.lastRenderedState=m}return[m,l]}function lh(e,n,a){var l=Le,f=gt(),m=Pe;if(m){if(a===void 0)throw Error(s(407));a=a()}else a=n();var x=!cn((et||f).memoizedState,a);if(x&&(f.memoizedState=a,kt=!0),f=f.queue,pu(ch.bind(null,l,f,e),[e]),f.getSnapshot!==n||x||St!==null&&St.memoizedState.tag&1){if(l.flags|=2048,Vi(9,{destroy:void 0},uh.bind(null,l,f,a,n),null),it===null)throw Error(s(349));m||(tr&127)!==0||oh(l,n,a)}return a}function oh(e,n,a){e.flags|=16384,e={getSnapshot:n,value:a},n=Le.updateQueue,n===null?(n=Ks(),Le.updateQueue=n,n.stores=[e]):(a=n.stores,a===null?n.stores=[e]:a.push(e))}function uh(e,n,a,l){n.value=a,n.getSnapshot=l,dh(n)&&fh(e)}function ch(e,n,a){return a(function(){dh(n)&&fh(e)})}function dh(e){var n=e.getSnapshot;e=e.value;try{var a=n();return!cn(e,a)}catch{return!0}}function fh(e){var n=Zr(e,2);n!==null&&tn(n,e,2)}function hu(e){var n=Yt();if(typeof e=="function"){var a=e;if(e=a(),si){Be(!0);try{a()}finally{Be(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:nr,lastRenderedState:e},n}function hh(e,n,a,l){return e.baseState=a,du(e,et,typeof l=="function"?l:nr)}function Cx(e,n,a,l,f){if(Ws(e))throw Error(s(485));if(e=n.action,e!==null){var m={payload:f,action:e,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,mh(n,m)):(m.next=a.next,n.pending=a.next=m)}}function mh(e,n){var a=n.action,l=n.payload,f=e.state;if(n.isTransition){var m=D.T,x={};D.T=x;try{var R=a(f,l),L=D.S;L!==null&&L(x,R),ph(e,n,R)}catch(J){mu(e,n,J)}finally{m!==null&&x.types!==null&&(m.types=x.types),D.T=m}}else try{m=a(f,l),ph(e,n,m)}catch(J){mu(e,n,J)}}function ph(e,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){gh(e,n,l)},function(l){return mu(e,n,l)}):gh(e,n,a)}function gh(e,n,a){n.status="fulfilled",n.value=a,yh(n),e.state=a,n=e.pending,n!==null&&(a=n.next,a===n?e.pending=null:(a=a.next,n.next=a,mh(e,a)))}function mu(e,n,a){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do n.status="rejected",n.reason=a,yh(n),n=n.next;while(n!==l)}e.action=null}function yh(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function vh(e,n){return n}function bh(e,n){if(Pe){var a=it.formState;if(a!==null){e:{var l=Le;if(Pe){if(ot){t:{for(var f=ot,m=Rn;f.nodeType!==8;){if(!m){f=null;break t}if(f=En(f.nextSibling),f===null){f=null;break t}}m=f.data,f=m==="F!"||m==="F"?f:null}if(f){ot=En(f.nextSibling),l=f.data==="F!";break e}}Sr(l)}l=!1}l&&(n=a[0])}}return a=Yt(),a.memoizedState=a.baseState=n,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:vh,lastRenderedState:n},a.queue=l,a=Bh.bind(null,Le,l),l.dispatch=a,l=hu(!1),m=xu.bind(null,Le,!1,l.queue),l=Yt(),f={state:n,dispatch:null,action:e,pending:null},l.queue=f,a=Cx.bind(null,Le,f,m,a),f.dispatch=a,l.memoizedState=e,[n,a,!1]}function xh(e){var n=gt();return Sh(n,et,e)}function Sh(e,n,a){if(n=du(e,n,vh)[0],e=Qs(nr)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var l=Ba(n)}catch(x){throw x===Ui?Us:x}else l=n;n=gt();var f=n.queue,m=f.dispatch;return a!==n.memoizedState&&(Le.flags|=2048,Vi(9,{destroy:void 0},jx.bind(null,f,a),null)),[l,m,e]}function jx(e,n){e.action=n}function kh(e){var n=gt(),a=et;if(a!==null)return Sh(n,a,e);gt(),n=n.memoizedState,a=gt();var l=a.queue.dispatch;return a.memoizedState=e,[n,l,!1]}function Vi(e,n,a,l){return e={tag:e,create:a,deps:l,inst:n,next:null},n=Le.updateQueue,n===null&&(n=Ks(),Le.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=e.next=e:(l=a.next,a.next=e,e.next=l,n.lastEffect=e),e}function wh(){return gt().memoizedState}function Zs(e,n,a,l){var f=Yt();Le.flags|=e,f.memoizedState=Vi(1|n,{destroy:void 0},a,l===void 0?null:l)}function Js(e,n,a,l){var f=gt();l=l===void 0?null:l;var m=f.memoizedState.inst;et!==null&&l!==null&&au(l,et.memoizedState.deps)?f.memoizedState=Vi(n,m,a,l):(Le.flags|=e,f.memoizedState=Vi(1|n,m,a,l))}function Ch(e,n){Zs(8390656,8,e,n)}function pu(e,n){Js(2048,8,e,n)}function Rx(e){Le.flags|=4;var n=Le.updateQueue;if(n===null)n=Ks(),Le.updateQueue=n,n.events=[e];else{var a=n.events;a===null?n.events=[e]:a.push(e)}}function jh(e){var n=gt().memoizedState;return Rx({ref:n,nextImpl:e}),function(){if((Qe&2)!==0)throw Error(s(440));return n.impl.apply(void 0,arguments)}}function Rh(e,n){return Js(4,2,e,n)}function Th(e,n){return Js(4,4,e,n)}function Eh(e,n){if(typeof n=="function"){e=e();var a=n(e);return function(){typeof a=="function"?a():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function Nh(e,n,a){a=a!=null?a.concat([e]):null,Js(4,4,Eh.bind(null,n,e),a)}function gu(){}function Ah(e,n){var a=gt();n=n===void 0?null:n;var l=a.memoizedState;return n!==null&&au(n,l[1])?l[0]:(a.memoizedState=[e,n],e)}function Ih(e,n){var a=gt();n=n===void 0?null:n;var l=a.memoizedState;if(n!==null&&au(n,l[1]))return l[0];if(l=e(),si){Be(!0);try{e()}finally{Be(!1)}}return a.memoizedState=[l,n],l}function yu(e,n,a){return a===void 0||(tr&1073741824)!==0&&(Ge&261930)===0?e.memoizedState=n:(e.memoizedState=a,e=Dm(),Le.lanes|=e,Ar|=e,a)}function Dh(e,n,a,l){return cn(a,n)?a:$i.current!==null?(e=yu(e,a,l),cn(e,n)||(kt=!0),e):(tr&42)===0||(tr&1073741824)!==0&&(Ge&261930)===0?(kt=!0,e.memoizedState=a):(e=Dm(),Le.lanes|=e,Ar|=e,n)}function Oh(e,n,a,l,f){var m=H.p;H.p=m!==0&&8>m?m:8;var x=D.T,R={};D.T=R,xu(e,!1,n,a);try{var L=f(),J=D.S;if(J!==null&&J(R,L),L!==null&&typeof L=="object"&&typeof L.then=="function"){var oe=Sx(L,l);Ha(e,n,oe,gn(e))}else Ha(e,n,l,gn(e))}catch(de){Ha(e,n,{then:function(){},status:"rejected",reason:de},gn())}finally{H.p=m,x!==null&&R.types!==null&&(x.types=R.types),D.T=x}}function Tx(){}function vu(e,n,a,l){if(e.tag!==5)throw Error(s(476));var f=Mh(e).queue;Oh(e,f,n,z,a===null?Tx:function(){return _h(e),a(l)})}function Mh(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:z,baseState:z,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:nr,lastRenderedState:z},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:nr,lastRenderedState:a},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function _h(e){var n=Mh(e);n.next===null&&(n=e.alternate.memoizedState),Ha(e,n.next.queue,{},gn())}function bu(){return Bt(ns)}function Lh(){return gt().memoizedState}function zh(){return gt().memoizedState}function Ex(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var a=gn();e=Cr(a);var l=jr(n,e,a);l!==null&&(tn(l,n,a),Ma(l,n,a)),n={cache:Ko()},e.payload=n;return}n=n.return}}function Nx(e,n,a){var l=gn();a={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Ws(e)?Hh(n,a):(a=zo(e,n,a,l),a!==null&&(tn(a,e,l),Uh(a,n,l)))}function Bh(e,n,a){var l=gn();Ha(e,n,a,l)}function Ha(e,n,a,l){var f={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Ws(e))Hh(n,f);else{var m=e.alternate;if(e.lanes===0&&(m===null||m.lanes===0)&&(m=n.lastRenderedReducer,m!==null))try{var x=n.lastRenderedState,R=m(x,a);if(f.hasEagerState=!0,f.eagerState=R,cn(R,x))return Os(e,n,f,0),it===null&&Ds(),!1}catch{}if(a=zo(e,n,f,l),a!==null)return tn(a,e,l),Uh(a,n,l),!0}return!1}function xu(e,n,a,l){if(l={lane:2,revertLane:Ju(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Ws(e)){if(n)throw Error(s(479))}else n=zo(e,a,l,2),n!==null&&tn(n,e,2)}function Ws(e){var n=e.alternate;return e===Le||n!==null&&n===Le}function Hh(e,n){Gi=Ps=!0;var a=e.pending;a===null?n.next=n:(n.next=a.next,a.next=n),e.pending=n}function Uh(e,n,a){if((a&4194048)!==0){var l=n.lanes;l&=e.pendingLanes,a|=l,n.lanes=a,bn(e,a)}}var Ua={readContext:Bt,use:Xs,useCallback:ft,useContext:ft,useEffect:ft,useImperativeHandle:ft,useLayoutEffect:ft,useInsertionEffect:ft,useMemo:ft,useReducer:ft,useRef:ft,useState:ft,useDebugValue:ft,useDeferredValue:ft,useTransition:ft,useSyncExternalStore:ft,useId:ft,useHostTransitionStatus:ft,useFormState:ft,useActionState:ft,useOptimistic:ft,useMemoCache:ft,useCacheRefresh:ft};Ua.useEffectEvent=ft;var qh={readContext:Bt,use:Xs,useCallback:function(e,n){return Yt().memoizedState=[e,n===void 0?null:n],e},useContext:Bt,useEffect:Ch,useImperativeHandle:function(e,n,a){a=a!=null?a.concat([e]):null,Zs(4194308,4,Eh.bind(null,n,e),a)},useLayoutEffect:function(e,n){return Zs(4194308,4,e,n)},useInsertionEffect:function(e,n){Zs(4,2,e,n)},useMemo:function(e,n){var a=Yt();n=n===void 0?null:n;var l=e();if(si){Be(!0);try{e()}finally{Be(!1)}}return a.memoizedState=[l,n],l},useReducer:function(e,n,a){var l=Yt();if(a!==void 0){var f=a(n);if(si){Be(!0);try{a(n)}finally{Be(!1)}}}else f=n;return l.memoizedState=l.baseState=f,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:f},l.queue=e,e=e.dispatch=Nx.bind(null,Le,e),[l.memoizedState,e]},useRef:function(e){var n=Yt();return e={current:e},n.memoizedState=e},useState:function(e){e=hu(e);var n=e.queue,a=Bh.bind(null,Le,n);return n.dispatch=a,[e.memoizedState,a]},useDebugValue:gu,useDeferredValue:function(e,n){var a=Yt();return yu(a,e,n)},useTransition:function(){var e=hu(!1);return e=Oh.bind(null,Le,e.queue,!0,!1),Yt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,a){var l=Le,f=Yt();if(Pe){if(a===void 0)throw Error(s(407));a=a()}else{if(a=n(),it===null)throw Error(s(349));(Ge&127)!==0||oh(l,n,a)}f.memoizedState=a;var m={value:a,getSnapshot:n};return f.queue=m,Ch(ch.bind(null,l,m,e),[e]),l.flags|=2048,Vi(9,{destroy:void 0},uh.bind(null,l,m,a,n),null),a},useId:function(){var e=Yt(),n=it.identifierPrefix;if(Pe){var a=Hn,l=Bn;a=(l&~(1<<32-Ae(l)-1)).toString(32)+a,n="_"+n+"R_"+a,a=Ys++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=kx++,n="_"+n+"r_"+a.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:bu,useFormState:bh,useActionState:bh,useOptimistic:function(e){var n=Yt();n.memoizedState=n.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=xu.bind(null,Le,!0,a),a.dispatch=n,[e,n]},useMemoCache:cu,useCacheRefresh:function(){return Yt().memoizedState=Ex.bind(null,Le)},useEffectEvent:function(e){var n=Yt(),a={impl:e};return n.memoizedState=a,function(){if((Qe&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}},Su={readContext:Bt,use:Xs,useCallback:Ah,useContext:Bt,useEffect:pu,useImperativeHandle:Nh,useInsertionEffect:Rh,useLayoutEffect:Th,useMemo:Ih,useReducer:Qs,useRef:wh,useState:function(){return Qs(nr)},useDebugValue:gu,useDeferredValue:function(e,n){var a=gt();return Dh(a,et.memoizedState,e,n)},useTransition:function(){var e=Qs(nr)[0],n=gt().memoizedState;return[typeof e=="boolean"?e:Ba(e),n]},useSyncExternalStore:lh,useId:Lh,useHostTransitionStatus:bu,useFormState:xh,useActionState:xh,useOptimistic:function(e,n){var a=gt();return hh(a,et,e,n)},useMemoCache:cu,useCacheRefresh:zh};Su.useEffectEvent=jh;var $h={readContext:Bt,use:Xs,useCallback:Ah,useContext:Bt,useEffect:pu,useImperativeHandle:Nh,useInsertionEffect:Rh,useLayoutEffect:Th,useMemo:Ih,useReducer:fu,useRef:wh,useState:function(){return fu(nr)},useDebugValue:gu,useDeferredValue:function(e,n){var a=gt();return et===null?yu(a,e,n):Dh(a,et.memoizedState,e,n)},useTransition:function(){var e=fu(nr)[0],n=gt().memoizedState;return[typeof e=="boolean"?e:Ba(e),n]},useSyncExternalStore:lh,useId:Lh,useHostTransitionStatus:bu,useFormState:kh,useActionState:kh,useOptimistic:function(e,n){var a=gt();return et!==null?hh(a,et,e,n):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:cu,useCacheRefresh:zh};$h.useEffectEvent=jh;function ku(e,n,a,l){n=e.memoizedState,a=a(l,n),a=a==null?n:y({},n,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var wu={enqueueSetState:function(e,n,a){e=e._reactInternals;var l=gn(),f=Cr(l);f.payload=n,a!=null&&(f.callback=a),n=jr(e,f,l),n!==null&&(tn(n,e,l),Ma(n,e,l))},enqueueReplaceState:function(e,n,a){e=e._reactInternals;var l=gn(),f=Cr(l);f.tag=1,f.payload=n,a!=null&&(f.callback=a),n=jr(e,f,l),n!==null&&(tn(n,e,l),Ma(n,e,l))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var a=gn(),l=Cr(a);l.tag=2,n!=null&&(l.callback=n),n=jr(e,l,a),n!==null&&(tn(n,e,a),Ma(n,e,a))}};function Gh(e,n,a,l,f,m,x){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,m,x):n.prototype&&n.prototype.isPureReactComponent?!Ra(a,l)||!Ra(f,m):!0}function Fh(e,n,a,l){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,l),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,l),n.state!==e&&wu.enqueueReplaceState(n,n.state,null)}function li(e,n){var a=n;if("ref"in n){a={};for(var l in n)l!=="ref"&&(a[l]=n[l])}if(e=e.defaultProps){a===n&&(a=y({},a));for(var f in e)a[f]===void 0&&(a[f]=e[f])}return a}function Vh(e){Is(e)}function Ph(e){console.error(e)}function Yh(e){Is(e)}function el(e,n){try{var a=e.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(l){setTimeout(function(){throw l})}}function Kh(e,n,a){try{var l=e.onCaughtError;l(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function Cu(e,n,a){return a=Cr(a),a.tag=3,a.payload={element:null},a.callback=function(){el(e,n)},a}function Xh(e){return e=Cr(e),e.tag=3,e}function Qh(e,n,a,l){var f=a.type.getDerivedStateFromError;if(typeof f=="function"){var m=l.value;e.payload=function(){return f(m)},e.callback=function(){Kh(n,a,l)}}var x=a.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(e.callback=function(){Kh(n,a,l),typeof f!="function"&&(Ir===null?Ir=new Set([this]):Ir.add(this));var R=l.stack;this.componentDidCatch(l.value,{componentStack:R!==null?R:""})})}function Ax(e,n,a,l,f){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(n=a.alternate,n!==null&&zi(n,a,f,!0),a=fn.current,a!==null){switch(a.tag){case 31:case 13:return Tn===null?fl():a.alternate===null&&ht===0&&(ht=3),a.flags&=-257,a.flags|=65536,a.lanes=f,l===qs?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([l]):n.add(l),Xu(e,l,f)),!1;case 22:return a.flags|=65536,l===qs?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)),Xu(e,l,f)),!1}throw Error(s(435,a.tag))}return Xu(e,l,f),fl(),!1}if(Pe)return n=fn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=f,l!==Go&&(e=Error(s(422),{cause:l}),Na(wn(e,a)))):(l!==Go&&(n=Error(s(423),{cause:l}),Na(wn(n,a))),e=e.current.alternate,e.flags|=65536,f&=-f,e.lanes|=f,l=wn(l,a),f=Cu(e.stateNode,l,f),eu(e,f),ht!==4&&(ht=2)),!1;var m=Error(s(520),{cause:l});if(m=wn(m,a),Ka===null?Ka=[m]:Ka.push(m),ht!==4&&(ht=2),n===null)return!0;l=wn(l,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,e=f&-f,a.lanes|=e,e=Cu(a.stateNode,l,e),eu(a,e),!1;case 1:if(n=a.type,m=a.stateNode,(a.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||m!==null&&typeof m.componentDidCatch=="function"&&(Ir===null||!Ir.has(m))))return a.flags|=65536,f&=-f,a.lanes|=f,f=Xh(f),Qh(f,e,a,l),eu(a,f),!1}a=a.return}while(a!==null);return!1}var ju=Error(s(461)),kt=!1;function Ht(e,n,a,l){n.child=e===null?eh(n,null,a,l):ai(n,e.child,a,l)}function Zh(e,n,a,l,f){a=a.render;var m=n.ref;if("ref"in l){var x={};for(var R in l)R!=="ref"&&(x[R]=l[R])}else x=l;return ti(n),l=su(e,n,a,x,m,f),R=lu(),e!==null&&!kt?(ou(e,n,f),rr(e,n,f)):(Pe&&R&&qo(n),n.flags|=1,Ht(e,n,l,f),n.child)}function Jh(e,n,a,l,f){if(e===null){var m=a.type;return typeof m=="function"&&!Bo(m)&&m.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=m,Wh(e,n,m,l,f)):(e=_s(a.type,null,l,n,n.mode,f),e.ref=n.ref,e.return=n,n.child=e)}if(m=e.child,!Ou(e,f)){var x=m.memoizedProps;if(a=a.compare,a=a!==null?a:Ra,a(x,l)&&e.ref===n.ref)return rr(e,n,f)}return n.flags|=1,e=Zn(m,l),e.ref=n.ref,e.return=n,n.child=e}function Wh(e,n,a,l,f){if(e!==null){var m=e.memoizedProps;if(Ra(m,l)&&e.ref===n.ref)if(kt=!1,n.pendingProps=l=m,Ou(e,f))(e.flags&131072)!==0&&(kt=!0);else return n.lanes=e.lanes,rr(e,n,f)}return Ru(e,n,a,l,f)}function em(e,n,a,l){var f=l.children,m=e!==null?e.memoizedState:null;if(e===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,e!==null){for(l=n.child=e.child,f=0;l!==null;)f=f|l.lanes|l.childLanes,l=l.sibling;l=f&~m}else l=0,n.child=null;return tm(e,n,m,a,l)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&Hs(n,m!==null?m.cachePool:null),m!==null?rh(n,m):nu(),ih(n);else return l=n.lanes=536870912,tm(e,n,m!==null?m.baseLanes|a:a,a,l)}else m!==null?(Hs(n,m.cachePool),rh(n,m),Tr(),n.memoizedState=null):(e!==null&&Hs(n,null),nu(),Tr());return Ht(e,n,f,a),n.child}function qa(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function tm(e,n,a,l,f){var m=Qo();return m=m===null?null:{parent:xt._currentValue,pool:m},n.memoizedState={baseLanes:a,cachePool:m},e!==null&&Hs(n,null),nu(),ih(n),e!==null&&zi(e,n,l,!0),n.childLanes=f,null}function tl(e,n){return n=rl({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function nm(e,n,a){return ai(n,e.child,null,a),e=tl(n,n.pendingProps),e.flags|=2,hn(n),n.memoizedState=null,e}function Ix(e,n,a){var l=n.pendingProps,f=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(Pe){if(l.mode==="hidden")return e=tl(n,l),n.lanes=536870912,qa(null,e);if(iu(n),(e=ot)?(e=mp(e,Rn),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:br!==null?{id:Bn,overflow:Hn}:null,retryLane:536870912,hydrationErrors:null},a=Hf(e),a.return=n,n.child=a,zt=n,ot=null)):e=null,e===null)throw Sr(n);return n.lanes=536870912,null}return tl(n,l)}var m=e.memoizedState;if(m!==null){var x=m.dehydrated;if(iu(n),f)if(n.flags&256)n.flags&=-257,n=nm(e,n,a);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(s(558));else if(kt||zi(e,n,a,!1),f=(a&e.childLanes)!==0,kt||f){if(l=it,l!==null&&(x=zn(l,a),x!==0&&x!==m.retryLane))throw m.retryLane=x,Zr(e,x),tn(l,e,x),ju;fl(),n=nm(e,n,a)}else e=m.treeContext,ot=En(x.nextSibling),zt=n,Pe=!0,xr=null,Rn=!1,e!==null&&$f(n,e),n=tl(n,l),n.flags|=4096;return n}return e=Zn(e.child,{mode:l.mode,children:l.children}),e.ref=n.ref,n.child=e,e.return=n,e}function nl(e,n){var a=n.ref;if(a===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(s(284));(e===null||e.ref!==a)&&(n.flags|=4194816)}}function Ru(e,n,a,l,f){return ti(n),a=su(e,n,a,l,void 0,f),l=lu(),e!==null&&!kt?(ou(e,n,f),rr(e,n,f)):(Pe&&l&&qo(n),n.flags|=1,Ht(e,n,a,f),n.child)}function rm(e,n,a,l,f,m){return ti(n),n.updateQueue=null,a=sh(n,l,a,f),ah(e),l=lu(),e!==null&&!kt?(ou(e,n,m),rr(e,n,m)):(Pe&&l&&qo(n),n.flags|=1,Ht(e,n,a,m),n.child)}function im(e,n,a,l,f){if(ti(n),n.stateNode===null){var m=Oi,x=a.contextType;typeof x=="object"&&x!==null&&(m=Bt(x)),m=new a(l,m),n.memoizedState=m.state!==null&&m.state!==void 0?m.state:null,m.updater=wu,n.stateNode=m,m._reactInternals=n,m=n.stateNode,m.props=l,m.state=n.memoizedState,m.refs={},Jo(n),x=a.contextType,m.context=typeof x=="object"&&x!==null?Bt(x):Oi,m.state=n.memoizedState,x=a.getDerivedStateFromProps,typeof x=="function"&&(ku(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&&wu.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(e===null){m=n.stateNode;var R=n.memoizedProps,L=li(a,R);m.props=L;var J=m.context,oe=a.contextType;x=Oi,typeof oe=="object"&&oe!==null&&(x=Bt(oe));var de=a.getDerivedStateFromProps;oe=typeof de=="function"||typeof m.getSnapshotBeforeUpdate=="function",R=n.pendingProps!==R,oe||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(R||J!==x)&&Fh(n,m,l,x),wr=!1;var ee=n.memoizedState;m.state=ee,La(n,l,m,f),_a(),J=n.memoizedState,R||ee!==J||wr?(typeof de=="function"&&(ku(n,a,de,l),J=n.memoizedState),(L=wr||Gh(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,Wo(e,n),x=n.memoizedProps,oe=li(a,x),m.props=oe,de=n.pendingProps,ee=m.context,J=a.contextType,L=Oi,typeof J=="object"&&J!==null&&(L=Bt(J)),R=a.getDerivedStateFromProps,(J=typeof R=="function"||typeof m.getSnapshotBeforeUpdate=="function")||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(x!==de||ee!==L)&&Fh(n,m,l,L),wr=!1,ee=n.memoizedState,m.state=ee,La(n,l,m,f),_a();var re=n.memoizedState;x!==de||ee!==re||wr||e!==null&&e.dependencies!==null&&zs(e.dependencies)?(typeof R=="function"&&(ku(n,a,R,l),re=n.memoizedState),(oe=wr||Gh(n,a,oe,l,ee,re,L)||e!==null&&e.dependencies!==null&&zs(e.dependencies))?(J||typeof m.UNSAFE_componentWillUpdate!="function"&&typeof m.componentWillUpdate!="function"||(typeof m.componentWillUpdate=="function"&&m.componentWillUpdate(l,re,L),typeof m.UNSAFE_componentWillUpdate=="function"&&m.UNSAFE_componentWillUpdate(l,re,L)),typeof m.componentDidUpdate=="function"&&(n.flags|=4),typeof m.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof m.componentDidUpdate!="function"||x===e.memoizedProps&&ee===e.memoizedState||(n.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&ee===e.memoizedState||(n.flags|=1024),n.memoizedProps=l,n.memoizedState=re),m.props=l,m.state=re,m.context=L,l=oe):(typeof m.componentDidUpdate!="function"||x===e.memoizedProps&&ee===e.memoizedState||(n.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&ee===e.memoizedState||(n.flags|=1024),l=!1)}return m=l,nl(e,n),l=(n.flags&128)!==0,m||l?(m=n.stateNode,a=l&&typeof a.getDerivedStateFromError!="function"?null:m.render(),n.flags|=1,e!==null&&l?(n.child=ai(n,e.child,null,f),n.child=ai(n,null,a,f)):Ht(e,n,a,f),n.memoizedState=m.state,e=n.child):e=rr(e,n,f),e}function am(e,n,a,l){return Wr(),n.flags|=256,Ht(e,n,a,l),n.child}var Tu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Eu(e){return{baseLanes:e,cachePool:Kf()}}function Nu(e,n,a){return e=e!==null?e.childLanes&~a:0,n&&(e|=pn),e}function sm(e,n,a){var l=n.pendingProps,f=!1,m=(n.flags&128)!==0,x;if((x=m)||(x=e!==null&&e.memoizedState===null?!1:(pt.current&2)!==0),x&&(f=!0,n.flags&=-129),x=(n.flags&32)!==0,n.flags&=-33,e===null){if(Pe){if(f?Rr(n):Tr(),(e=ot)?(e=mp(e,Rn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:br!==null?{id:Bn,overflow:Hn}:null,retryLane:536870912,hydrationErrors:null},a=Hf(e),a.return=n,n.child=a,zt=n,ot=null)):e=null,e===null)throw Sr(n);return dc(e)?n.lanes=32:n.lanes=536870912,null}var R=l.children;return l=l.fallback,f?(Tr(),f=n.mode,R=rl({mode:"hidden",children:R},f),l=Jr(l,f,a,null),R.return=n,l.return=n,R.sibling=l,n.child=R,l=n.child,l.memoizedState=Eu(a),l.childLanes=Nu(e,x,a),n.memoizedState=Tu,qa(null,l)):(Rr(n),Au(n,R))}var L=e.memoizedState;if(L!==null&&(R=L.dehydrated,R!==null)){if(m)n.flags&256?(Rr(n),n.flags&=-257,n=Iu(e,n,a)):n.memoizedState!==null?(Tr(),n.child=e.child,n.flags|=128,n=null):(Tr(),R=l.fallback,f=n.mode,l=rl({mode:"visible",children:l.children},f),R=Jr(R,f,a,null),R.flags|=2,l.return=n,R.return=n,l.sibling=R,n.child=l,ai(n,e.child,null,a),l=n.child,l.memoizedState=Eu(a),l.childLanes=Nu(e,x,a),n.memoizedState=Tu,n=qa(null,l));else if(Rr(n),dc(R)){if(x=R.nextSibling&&R.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=Iu(e,n,a)}else if(kt||zi(e,n,a,!1),x=(a&e.childLanes)!==0,kt||x){if(x=it,x!==null&&(l=zn(x,a),l!==0&&l!==L.retryLane))throw L.retryLane=l,Zr(e,l),tn(x,e,l),ju;cc(R)||fl(),n=Iu(e,n,a)}else cc(R)?(n.flags|=192,n.child=e.child,n=null):(e=L.treeContext,ot=En(R.nextSibling),zt=n,Pe=!0,xr=null,Rn=!1,e!==null&&$f(n,e),n=Au(n,l.children),n.flags|=4096);return n}return f?(Tr(),R=l.fallback,f=n.mode,L=e.child,J=L.sibling,l=Zn(L,{mode:"hidden",children:l.children}),l.subtreeFlags=L.subtreeFlags&65011712,J!==null?R=Zn(J,R):(R=Jr(R,f,a,null),R.flags|=2),R.return=n,l.return=n,l.sibling=R,n.child=l,qa(null,l),l=n.child,R=e.child.memoizedState,R===null?R=Eu(a):(f=R.cachePool,f!==null?(L=xt._currentValue,f=f.parent!==L?{parent:L,pool:L}:f):f=Kf(),R={baseLanes:R.baseLanes|a,cachePool:f}),l.memoizedState=R,l.childLanes=Nu(e,x,a),n.memoizedState=Tu,qa(e.child,l)):(Rr(n),a=e.child,e=a.sibling,a=Zn(a,{mode:"visible",children:l.children}),a.return=n,a.sibling=null,e!==null&&(x=n.deletions,x===null?(n.deletions=[e],n.flags|=16):x.push(e)),n.child=a,n.memoizedState=null,a)}function Au(e,n){return n=rl({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function rl(e,n){return e=dn(22,e,null,n),e.lanes=0,e}function Iu(e,n,a){return ai(n,e.child,null,a),e=Au(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function lm(e,n,a){e.lanes|=n;var l=e.alternate;l!==null&&(l.lanes|=n),Po(e.return,n,a)}function Du(e,n,a,l,f,m){var x=e.memoizedState;x===null?e.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 om(e,n,a){var l=n.pendingProps,f=l.revealOrder,m=l.tail;l=l.children;var x=pt.current,R=(x&2)!==0;if(R?(x=x&1|2,n.flags|=128):x&=1,C(pt,x),Ht(e,n,l,a),l=Pe?Ea:0,!R&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&lm(e,a,n);else if(e.tag===19)lm(e,a,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(f){case"forwards":for(a=n.child,f=null;a!==null;)e=a.alternate,e!==null&&Vs(e)===null&&(f=a),a=a.sibling;a=f,a===null?(f=n.child,n.child=null):(f=a.sibling,a.sibling=null),Du(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(e=f.alternate,e!==null&&Vs(e)===null){n.child=f;break}e=f.sibling,f.sibling=a,a=f,f=e}Du(n,!0,a,null,m,l);break;case"together":Du(n,!1,null,null,void 0,l);break;default:n.memoizedState=null}return n.child}function rr(e,n,a){if(e!==null&&(n.dependencies=e.dependencies),Ar|=n.lanes,(a&n.childLanes)===0)if(e!==null){if(zi(e,n,a,!1),(a&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(s(153));if(n.child!==null){for(e=n.child,a=Zn(e,e.pendingProps),n.child=a,a.return=n;e.sibling!==null;)e=e.sibling,a=a.sibling=Zn(e,e.pendingProps),a.return=n;a.sibling=null}return n.child}function Ou(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&zs(e)))}function Dx(e,n,a){switch(n.tag){case 3:me(n,n.stateNode.containerInfo),kr(n,xt,e.memoizedState.cache),Wr();break;case 27:case 5:fe(n);break;case 4:me(n,n.stateNode.containerInfo);break;case 10:kr(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,iu(n),null;break;case 13:var l=n.memoizedState;if(l!==null)return l.dehydrated!==null?(Rr(n),n.flags|=128,null):(a&n.child.childLanes)!==0?sm(e,n,a):(Rr(n),e=rr(e,n,a),e!==null?e.sibling:null);Rr(n);break;case 19:var f=(e.flags&128)!==0;if(l=(a&n.childLanes)!==0,l||(zi(e,n,a,!1),l=(a&n.childLanes)!==0),f){if(l)return om(e,n,a);n.flags|=128}if(f=n.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),C(pt,pt.current),l)break;return null;case 22:return n.lanes=0,em(e,n,a,n.pendingProps);case 24:kr(n,xt,e.memoizedState.cache)}return rr(e,n,a)}function um(e,n,a){if(e!==null)if(e.memoizedProps!==n.pendingProps)kt=!0;else{if(!Ou(e,a)&&(n.flags&128)===0)return kt=!1,Dx(e,n,a);kt=(e.flags&131072)!==0}else kt=!1,Pe&&(n.flags&1048576)!==0&&qf(n,Ea,n.index);switch(n.lanes=0,n.tag){case 16:e:{var l=n.pendingProps;if(e=ri(n.elementType),n.type=e,typeof e=="function")Bo(e)?(l=li(e,l),n.tag=1,n=im(null,n,e,l,a)):(n.tag=0,n=Ru(null,n,e,l,a));else{if(e!=null){var f=e.$$typeof;if(f===F){n.tag=11,n=Zh(null,n,e,l,a);break e}else if(f===Y){n.tag=14,n=Jh(null,n,e,l,a);break e}}throw n=G(e)||e,Error(s(306,n,""))}}return n;case 0:return Ru(e,n,n.type,n.pendingProps,a);case 1:return l=n.type,f=li(l,n.pendingProps),im(e,n,l,f,a);case 3:e:{if(me(n,n.stateNode.containerInfo),e===null)throw Error(s(387));l=n.pendingProps;var m=n.memoizedState;f=m.element,Wo(e,n),La(n,l,null,a);var x=n.memoizedState;if(l=x.cache,kr(n,xt,l),l!==m.cache&&Yo(n,[xt],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=am(e,n,l,a);break e}else if(l!==f){f=wn(Error(s(424)),n),Na(f),n=am(e,n,l,a);break e}else for(e=n.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,ot=En(e.firstChild),zt=n,Pe=!0,xr=null,Rn=!0,a=eh(n,null,l,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(Wr(),l===f){n=rr(e,n,a);break e}Ht(e,n,l,a)}n=n.child}return n;case 26:return nl(e,n),e===null?(a=xp(n.type,null,n.pendingProps,null))?n.memoizedState=a:Pe||(a=n.type,e=n.pendingProps,l=bl(Z.current).createElement(a),l[Lt]=n,l[Xt]=e,Ut(l,a,e),It(l),n.stateNode=l):n.memoizedState=xp(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return fe(n),e===null&&Pe&&(l=n.stateNode=yp(n.type,n.pendingProps,Z.current),zt=n,Rn=!0,f=ot,_r(n.type)?(fc=f,ot=En(l.firstChild)):ot=f),Ht(e,n,n.pendingProps.children,a),nl(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&Pe&&((f=l=ot)&&(l=oS(l,n.type,n.pendingProps,Rn),l!==null?(n.stateNode=l,zt=n,ot=En(l.firstChild),Rn=!1,f=!0):f=!1),f||Sr(n)),fe(n),f=n.type,m=n.pendingProps,x=e!==null?e.memoizedProps:null,l=m.children,lc(f,m)?l=null:x!==null&&lc(f,x)&&(n.flags|=32),n.memoizedState!==null&&(f=su(e,n,wx,null,null,a),ns._currentValue=f),nl(e,n),Ht(e,n,l,a),n.child;case 6:return e===null&&Pe&&((e=a=ot)&&(a=uS(a,n.pendingProps,Rn),a!==null?(n.stateNode=a,zt=n,ot=null,e=!0):e=!1),e||Sr(n)),null;case 13:return sm(e,n,a);case 4:return me(n,n.stateNode.containerInfo),l=n.pendingProps,e===null?n.child=ai(n,null,l,a):Ht(e,n,l,a),n.child;case 11:return Zh(e,n,n.type,n.pendingProps,a);case 7:return Ht(e,n,n.pendingProps,a),n.child;case 8:return Ht(e,n,n.pendingProps.children,a),n.child;case 12:return Ht(e,n,n.pendingProps.children,a),n.child;case 10:return l=n.pendingProps,kr(n,n.type,l.value),Ht(e,n,l.children,a),n.child;case 9:return f=n.type._context,l=n.pendingProps.children,ti(n),f=Bt(f),l=l(f),n.flags|=1,Ht(e,n,l,a),n.child;case 14:return Jh(e,n,n.type,n.pendingProps,a);case 15:return Wh(e,n,n.type,n.pendingProps,a);case 19:return om(e,n,a);case 31:return Ix(e,n,a);case 22:return em(e,n,a,n.pendingProps);case 24:return ti(n),l=Bt(xt),e===null?(f=Qo(),f===null&&(f=it,m=Ko(),f.pooledCache=m,m.refCount++,m!==null&&(f.pooledCacheLanes|=a),f=m),n.memoizedState={parent:l,cache:f},Jo(n),kr(n,xt,f)):((e.lanes&a)!==0&&(Wo(e,n),La(n,null,null,a),_a()),f=e.memoizedState,m=n.memoizedState,f.parent!==l?(f={parent:l,cache:l},n.memoizedState=f,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=f),kr(n,xt,l)):(l=m.cache,kr(n,xt,l),l!==f.cache&&Yo(n,[xt],a,!0))),Ht(e,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(s(156,n.tag))}function ir(e){e.flags|=4}function Mu(e,n,a,l,f){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(f&335544128)===f)if(e.stateNode.complete)e.flags|=8192;else if(Lm())e.flags|=8192;else throw ii=qs,Zo}else e.flags&=-16777217}function cm(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!jp(n))if(Lm())e.flags|=8192;else throw ii=qs,Zo}function il(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?bt():536870912,e.lanes|=n,Xi|=n)}function $a(e,n){if(!Pe)switch(e.tailMode){case"hidden":n=e.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function ut(e){var n=e.alternate!==null&&e.alternate.child===e.child,a=0,l=0;if(n)for(var f=e.child;f!==null;)a|=f.lanes|f.childLanes,l|=f.subtreeFlags&65011712,l|=f.flags&65011712,f.return=e,f=f.sibling;else for(f=e.child;f!==null;)a|=f.lanes|f.childLanes,l|=f.subtreeFlags,l|=f.flags,f.return=e,f=f.sibling;return e.subtreeFlags|=l,e.childLanes=a,n}function Ox(e,n,a){var l=n.pendingProps;switch($o(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ut(n),null;case 1:return ut(n),null;case 3:return a=n.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),n.memoizedState.cache!==l&&(n.flags|=2048),er(xt),ge(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Li(n)?ir(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Fo())),ut(n),null;case 26:var f=n.type,m=n.memoizedState;return e===null?(ir(n),m!==null?(ut(n),cm(n,m)):(ut(n),Mu(n,f,null,l,a))):m?m!==e.memoizedState?(ir(n),ut(n),cm(n,m)):(ut(n),n.flags&=-16777217):(e=e.memoizedProps,e!==l&&ir(n),ut(n),Mu(n,f,e,l,a)),null;case 27:if(ke(n),a=Z.current,f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==l&&ir(n);else{if(!l){if(n.stateNode===null)throw Error(s(166));return ut(n),null}e=se.current,Li(n)?Gf(n):(e=yp(f,l,a),n.stateNode=e,ir(n))}return ut(n),null;case 5:if(ke(n),f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==l&&ir(n);else{if(!l){if(n.stateNode===null)throw Error(s(166));return ut(n),null}if(m=se.current,Li(n))Gf(n);else{var x=bl(Z.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[Lt]=n,m[Xt]=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(Ut(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&&ir(n)}}return ut(n),Mu(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,a),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==l&&ir(n);else{if(typeof l!="string"&&n.stateNode===null)throw Error(s(166));if(e=Z.current,Li(n)){if(e=n.stateNode,a=n.memoizedProps,l=null,f=zt,f!==null)switch(f.tag){case 27:case 5:l=f.memoizedProps}e[Lt]=n,e=!!(e.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||sp(e.nodeValue,a)),e||Sr(n,!0)}else e=bl(e).createTextNode(l),e[Lt]=n,n.stateNode=e}return ut(n),null;case 31:if(a=n.memoizedState,e===null||e.memoizedState!==null){if(l=Li(n),a!==null){if(e===null){if(!l)throw Error(s(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(557));e[Lt]=n}else Wr(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;ut(n),e=!1}else a=Fo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return n.flags&256?(hn(n),n):(hn(n),null);if((n.flags&128)!==0)throw Error(s(558))}return ut(n),null;case 13:if(l=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(f=Li(n),l!==null&&l.dehydrated!==null){if(e===null){if(!f)throw Error(s(318));if(f=n.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(s(317));f[Lt]=n}else Wr(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;ut(n),f=!1}else f=Fo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=f),f=!0;if(!f)return n.flags&256?(hn(n),n):(hn(n),null)}return hn(n),(n.flags&128)!==0?(n.lanes=a,n):(a=l!==null,e=e!==null&&e.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!==e&&a&&(n.child.flags|=8192),il(n,n.updateQueue),ut(n),null);case 4:return ge(),e===null&&nc(n.stateNode.containerInfo),ut(n),null;case 10:return er(n.type),ut(n),null;case 19:if(U(pt),l=n.memoizedState,l===null)return ut(n),null;if(f=(n.flags&128)!==0,m=l.rendering,m===null)if(f)$a(l,!1);else{if(ht!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(m=Vs(e),m!==null){for(n.flags|=128,$a(l,!1),e=m.updateQueue,n.updateQueue=e,il(n,e),n.subtreeFlags=0,e=a,a=n.child;a!==null;)Bf(a,e),a=a.sibling;return C(pt,pt.current&1|2),Pe&&Jn(n,l.treeForkCount),n.child}e=e.sibling}l.tail!==null&&Oe()>ul&&(n.flags|=128,f=!0,$a(l,!1),n.lanes=4194304)}else{if(!f)if(e=Vs(m),e!==null){if(n.flags|=128,f=!0,e=e.updateQueue,n.updateQueue=e,il(n,e),$a(l,!0),l.tail===null&&l.tailMode==="hidden"&&!m.alternate&&!Pe)return ut(n),null}else 2*Oe()-l.renderingStartTime>ul&&a!==536870912&&(n.flags|=128,f=!0,$a(l,!1),n.lanes=4194304);l.isBackwards?(m.sibling=n.child,n.child=m):(e=l.last,e!==null?e.sibling=m:n.child=m,l.last=m)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=Oe(),e.sibling=null,a=pt.current,C(pt,f?a&1|2:a&1),Pe&&Jn(n,l.treeForkCount),e):(ut(n),null);case 22:case 23:return hn(n),ru(),l=n.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(n.flags|=8192):l&&(n.flags|=8192),l?(a&536870912)!==0&&(n.flags&128)===0&&(ut(n),n.subtreeFlags&6&&(n.flags|=8192)):ut(n),a=n.updateQueue,a!==null&&il(n,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),l=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(l=n.memoizedState.cachePool.pool),l!==a&&(n.flags|=2048),e!==null&&U(ni),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),er(xt),ut(n),null;case 25:return null;case 30:return null}throw Error(s(156,n.tag))}function Mx(e,n){switch($o(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return er(xt),ge(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return ke(n),null;case 31:if(n.memoizedState!==null){if(hn(n),n.alternate===null)throw Error(s(340));Wr()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(hn(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(s(340));Wr()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return U(pt),null;case 4:return ge(),null;case 10:return er(n.type),null;case 22:case 23:return hn(n),ru(),e!==null&&U(ni),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return er(xt),null;case 25:return null;default:return null}}function dm(e,n){switch($o(n),n.tag){case 3:er(xt),ge();break;case 26:case 27:case 5:ke(n);break;case 4:ge();break;case 31:n.memoizedState!==null&&hn(n);break;case 13:hn(n);break;case 19:U(pt);break;case 10:er(n.type);break;case 22:case 23:hn(n),ru(),e!==null&&U(ni);break;case 24:er(xt)}}function Ga(e,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&e)===e){l=void 0;var m=a.create,x=a.inst;l=m(),x.destroy=l}a=a.next}while(a!==f)}}catch(R){We(n,n.return,R)}}function Er(e,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&e)===e){var x=l.inst,R=x.destroy;if(R!==void 0){x.destroy=void 0,f=n;var L=a,J=R;try{J()}catch(oe){We(f,L,oe)}}}l=l.next}while(l!==m)}}catch(oe){We(n,n.return,oe)}}function fm(e){var n=e.updateQueue;if(n!==null){var a=e.stateNode;try{nh(n,a)}catch(l){We(e,e.return,l)}}}function hm(e,n,a){a.props=li(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(l){We(e,n,l)}}function Fa(e,n){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof a=="function"?e.refCleanup=a(l):a.current=l}}catch(f){We(e,n,f)}}function Un(e,n){var a=e.ref,l=e.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(f){We(e,n,f)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(f){We(e,n,f)}else a.current=null}function mm(e){var n=e.type,a=e.memoizedProps,l=e.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){We(e,e.return,f)}}function _u(e,n,a){try{var l=e.stateNode;nS(l,e.type,a,n),l[Xt]=n}catch(f){We(e,e.return,f)}}function pm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&_r(e.type)||e.tag===4}function Lu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||pm(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&_r(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function zu(e,n,a){var l=e.tag;if(l===5||l===6)e=e.stateNode,n?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,n):(n=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,n.appendChild(e),a=a._reactRootContainer,a!=null||n.onclick!==null||(n.onclick=Xn));else if(l!==4&&(l===27&&_r(e.type)&&(a=e.stateNode,n=null),e=e.child,e!==null))for(zu(e,n,a),e=e.sibling;e!==null;)zu(e,n,a),e=e.sibling}function al(e,n,a){var l=e.tag;if(l===5||l===6)e=e.stateNode,n?a.insertBefore(e,n):a.appendChild(e);else if(l!==4&&(l===27&&_r(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(al(e,n,a),e=e.sibling;e!==null;)al(e,n,a),e=e.sibling}function gm(e){var n=e.stateNode,a=e.memoizedProps;try{for(var l=e.type,f=n.attributes;f.length;)n.removeAttributeNode(f[0]);Ut(n,l,a),n[Lt]=e,n[Xt]=a}catch(m){We(e,e.return,m)}}var ar=!1,wt=!1,Bu=!1,ym=typeof WeakSet=="function"?WeakSet:Set,Dt=null;function _x(e,n){if(e=e.containerInfo,ac=Rl,e=Nf(e),Io(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.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,R=-1,L=-1,J=0,oe=0,de=e,ee=null;t:for(;;){for(var re;de!==a||f!==0&&de.nodeType!==3||(R=x+f),de!==m||l!==0&&de.nodeType!==3||(L=x+l),de.nodeType===3&&(x+=de.nodeValue.length),(re=de.firstChild)!==null;)ee=de,de=re;for(;;){if(de===e)break t;if(ee===a&&++J===f&&(R=x),ee===m&&++oe===l&&(L=x),(re=de.nextSibling)!==null)break;de=ee,ee=de.parentNode}de=re}a=R===-1||L===-1?null:{start:R,end:L}}else a=null}a=a||{start:0,end:0}}else a=null;for(sc={focusedElem:e,selectionRange:a},Rl=!1,Dt=n;Dt!==null;)if(n=Dt,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,Dt=e;else for(;Dt!==null;){switch(n=Dt,m=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)f=e[a],f.ref.impl=f.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&m!==null){e=void 0,a=n,f=m.memoizedProps,m=m.memoizedState,l=a.stateNode;try{var ye=li(a.type,f);e=l.getSnapshotBeforeUpdate(ye,m),l.__reactInternalSnapshotBeforeUpdate=e}catch(Re){We(a,a.return,Re)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,a=e.nodeType,a===9)uc(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":uc(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(s(163))}if(e=n.sibling,e!==null){e.return=n.return,Dt=e;break}Dt=n.return}}function vm(e,n,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:lr(e,a),l&4&&Ga(5,a);break;case 1:if(lr(e,a),l&4)if(e=a.stateNode,n===null)try{e.componentDidMount()}catch(x){We(a,a.return,x)}else{var f=li(a.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(f,n,e.__reactInternalSnapshotBeforeUpdate)}catch(x){We(a,a.return,x)}}l&64&&fm(a),l&512&&Fa(a,a.return);break;case 3:if(lr(e,a),l&64&&(e=a.updateQueue,e!==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{nh(e,n)}catch(x){We(a,a.return,x)}}break;case 27:n===null&&l&4&&gm(a);case 26:case 5:lr(e,a),n===null&&l&4&&mm(a),l&512&&Fa(a,a.return);break;case 12:lr(e,a);break;case 31:lr(e,a),l&4&&Sm(e,a);break;case 13:lr(e,a),l&4&&km(e,a),l&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=Fx.bind(null,a),cS(e,a))));break;case 22:if(l=a.memoizedState!==null||ar,!l){n=n!==null&&n.memoizedState!==null||wt,f=ar;var m=wt;ar=l,(wt=n)&&!m?or(e,a,(a.subtreeFlags&8772)!==0):lr(e,a),ar=f,wt=m}break;case 30:break;default:lr(e,a)}}function bm(e){var n=e.alternate;n!==null&&(e.alternate=null,bm(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&mo(n)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var ct=null,Zt=!1;function sr(e,n,a){for(a=a.child;a!==null;)xm(e,n,a),a=a.sibling}function xm(e,n,a){if(Te&&typeof Te.onCommitFiberUnmount=="function")try{Te.onCommitFiberUnmount(Ce,a)}catch{}switch(a.tag){case 26:wt||Un(a,n),sr(e,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:wt||Un(a,n);var l=ct,f=Zt;_r(a.type)&&(ct=a.stateNode,Zt=!1),sr(e,n,a),Wa(a.stateNode),ct=l,Zt=f;break;case 5:wt||Un(a,n);case 6:if(l=ct,f=Zt,ct=null,sr(e,n,a),ct=l,Zt=f,ct!==null)if(Zt)try{(ct.nodeType===9?ct.body:ct.nodeName==="HTML"?ct.ownerDocument.body:ct).removeChild(a.stateNode)}catch(m){We(a,n,m)}else try{ct.removeChild(a.stateNode)}catch(m){We(a,n,m)}break;case 18:ct!==null&&(Zt?(e=ct,fp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),ra(e)):fp(ct,a.stateNode));break;case 4:l=ct,f=Zt,ct=a.stateNode.containerInfo,Zt=!0,sr(e,n,a),ct=l,Zt=f;break;case 0:case 11:case 14:case 15:Er(2,a,n),wt||Er(4,a,n),sr(e,n,a);break;case 1:wt||(Un(a,n),l=a.stateNode,typeof l.componentWillUnmount=="function"&&hm(a,n,l)),sr(e,n,a);break;case 21:sr(e,n,a);break;case 22:wt=(l=wt)||a.memoizedState!==null,sr(e,n,a),wt=l;break;default:sr(e,n,a)}}function Sm(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{ra(e)}catch(a){We(n,n.return,a)}}}function km(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{ra(e)}catch(a){We(n,n.return,a)}}function Lx(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new ym),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new ym),n;default:throw Error(s(435,e.tag))}}function sl(e,n){var a=Lx(e);n.forEach(function(l){if(!a.has(l)){a.add(l);var f=Vx.bind(null,e,l);l.then(f,f)}})}function Jt(e,n){var a=n.deletions;if(a!==null)for(var l=0;l<a.length;l++){var f=a[l],m=e,x=n,R=x;e:for(;R!==null;){switch(R.tag){case 27:if(_r(R.type)){ct=R.stateNode,Zt=!1;break e}break;case 5:ct=R.stateNode,Zt=!1;break e;case 3:case 4:ct=R.stateNode.containerInfo,Zt=!0;break e}R=R.return}if(ct===null)throw Error(s(160));xm(m,x,f),ct=null,Zt=!1,m=f.alternate,m!==null&&(m.return=null),f.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)wm(n,e),n=n.sibling}var On=null;function wm(e,n){var a=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Jt(n,e),Wt(e),l&4&&(Er(3,e,e.return),Ga(3,e),Er(5,e,e.return));break;case 1:Jt(n,e),Wt(e),l&512&&(wt||a===null||Un(a,a.return)),l&64&&ar&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?l:a.concat(l))));break;case 26:var f=On;if(Jt(n,e),Wt(e),l&512&&(wt||a===null||Un(a,a.return)),l&4){var m=a!==null?a.memoizedState:null;if(l=e.memoizedState,a===null)if(l===null)if(e.stateNode===null){e:{l=e.type,a=e.memoizedProps,f=f.ownerDocument||f;t:switch(l){case"title":m=f.getElementsByTagName("title")[0],(!m||m[ya]||m[Lt]||m.namespaceURI==="http://www.w3.org/2000/svg"||m.hasAttribute("itemprop"))&&(m=f.createElement(l),f.head.insertBefore(m,f.querySelector("head > title"))),Ut(m,l,a),m[Lt]=e,It(m),l=m;break e;case"link":var x=wp("link","href",f).get(l+(a.href||""));if(x){for(var R=0;R<x.length;R++)if(m=x[R],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(R,1);break t}}m=f.createElement(l),Ut(m,l,a),f.head.appendChild(m);break;case"meta":if(x=wp("meta","content",f).get(l+(a.content||""))){for(R=0;R<x.length;R++)if(m=x[R],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(R,1);break t}}m=f.createElement(l),Ut(m,l,a),f.head.appendChild(m);break;default:throw Error(s(468,l))}m[Lt]=e,It(m),l=m}e.stateNode=l}else Cp(f,e.type,e.stateNode);else e.stateNode=kp(f,l,e.memoizedProps);else m!==l?(m===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):m.count--,l===null?Cp(f,e.type,e.stateNode):kp(f,l,e.memoizedProps)):l===null&&e.stateNode!==null&&_u(e,e.memoizedProps,a.memoizedProps)}break;case 27:Jt(n,e),Wt(e),l&512&&(wt||a===null||Un(a,a.return)),a!==null&&l&4&&_u(e,e.memoizedProps,a.memoizedProps);break;case 5:if(Jt(n,e),Wt(e),l&512&&(wt||a===null||Un(a,a.return)),e.flags&32){f=e.stateNode;try{Ri(f,"")}catch(ye){We(e,e.return,ye)}}l&4&&e.stateNode!=null&&(f=e.memoizedProps,_u(e,f,a!==null?a.memoizedProps:f)),l&1024&&(Bu=!0);break;case 6:if(Jt(n,e),Wt(e),l&4){if(e.stateNode===null)throw Error(s(162));l=e.memoizedProps,a=e.stateNode;try{a.nodeValue=l}catch(ye){We(e,e.return,ye)}}break;case 3:if(kl=null,f=On,On=xl(n.containerInfo),Jt(n,e),On=f,Wt(e),l&4&&a!==null&&a.memoizedState.isDehydrated)try{ra(n.containerInfo)}catch(ye){We(e,e.return,ye)}Bu&&(Bu=!1,Cm(e));break;case 4:l=On,On=xl(e.stateNode.containerInfo),Jt(n,e),Wt(e),On=l;break;case 12:Jt(n,e),Wt(e);break;case 31:Jt(n,e),Wt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,sl(e,l)));break;case 13:Jt(n,e),Wt(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(ol=Oe()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,sl(e,l)));break;case 22:f=e.memoizedState!==null;var L=a!==null&&a.memoizedState!==null,J=ar,oe=wt;if(ar=J||f,wt=oe||L,Jt(n,e),wt=oe,ar=J,Wt(e),l&8192)e:for(n=e.stateNode,n._visibility=f?n._visibility&-2:n._visibility|1,f&&(a===null||L||ar||wt||oi(e)),a=null,n=e;;){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{R=L.stateNode;var de=L.memoizedProps.style,ee=de!=null&&de.hasOwnProperty("display")?de.display:null;R.style.display=ee==null||typeof ee=="boolean"?"":(""+ee).trim()}}catch(ye){We(L,L.return,ye)}}}else if(n.tag===6){if(a===null){L=n;try{L.stateNode.nodeValue=f?"":L.memoizedProps}catch(ye){We(L,L.return,ye)}}}else if(n.tag===18){if(a===null){L=n;try{var re=L.stateNode;f?hp(re,!0):hp(L.stateNode,!1)}catch(ye){We(L,L.return,ye)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===e)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;a===n&&(a=null),n=n.return}a===n&&(a=null),n.sibling.return=n.return,n=n.sibling}l&4&&(l=e.updateQueue,l!==null&&(a=l.retryQueue,a!==null&&(l.retryQueue=null,sl(e,a))));break;case 19:Jt(n,e),Wt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,sl(e,l)));break;case 30:break;case 21:break;default:Jt(n,e),Wt(e)}}function Wt(e){var n=e.flags;if(n&2){try{for(var a,l=e.return;l!==null;){if(pm(l)){a=l;break}l=l.return}if(a==null)throw Error(s(160));switch(a.tag){case 27:var f=a.stateNode,m=Lu(e);al(e,m,f);break;case 5:var x=a.stateNode;a.flags&32&&(Ri(x,""),a.flags&=-33);var R=Lu(e);al(e,R,x);break;case 3:case 4:var L=a.stateNode.containerInfo,J=Lu(e);zu(e,J,L);break;default:throw Error(s(161))}}catch(oe){We(e,e.return,oe)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function Cm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;Cm(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function lr(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)vm(e,n.alternate,n),n=n.sibling}function oi(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:Er(4,n,n.return),oi(n);break;case 1:Un(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&hm(n,n.return,a),oi(n);break;case 27:Wa(n.stateNode);case 26:case 5:Un(n,n.return),oi(n);break;case 22:n.memoizedState===null&&oi(n);break;case 30:oi(n);break;default:oi(n)}e=e.sibling}}function or(e,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var l=n.alternate,f=e,m=n,x=m.flags;switch(m.tag){case 0:case 11:case 15:or(f,m,a),Ga(4,m);break;case 1:if(or(f,m,a),l=m,f=l.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(J){We(l,l.return,J)}if(l=m,f=l.updateQueue,f!==null){var R=l.stateNode;try{var L=f.shared.hiddenCallbacks;if(L!==null)for(f.shared.hiddenCallbacks=null,f=0;f<L.length;f++)th(L[f],R)}catch(J){We(l,l.return,J)}}a&&x&64&&fm(m),Fa(m,m.return);break;case 27:gm(m);case 26:case 5:or(f,m,a),a&&l===null&&x&4&&mm(m),Fa(m,m.return);break;case 12:or(f,m,a);break;case 31:or(f,m,a),a&&x&4&&Sm(f,m);break;case 13:or(f,m,a),a&&x&4&&km(f,m);break;case 22:m.memoizedState===null&&or(f,m,a),Fa(m,m.return);break;case 30:break;default:or(f,m,a)}n=n.sibling}}function Hu(e,n){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&Aa(a))}function Uu(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&Aa(e))}function Mn(e,n,a,l){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)jm(e,n,a,l),n=n.sibling}function jm(e,n,a,l){var f=n.flags;switch(n.tag){case 0:case 11:case 15:Mn(e,n,a,l),f&2048&&Ga(9,n);break;case 1:Mn(e,n,a,l);break;case 3:Mn(e,n,a,l),f&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&Aa(e)));break;case 12:if(f&2048){Mn(e,n,a,l),e=n.stateNode;try{var m=n.memoizedProps,x=m.id,R=m.onPostCommit;typeof R=="function"&&R(x,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(L){We(n,n.return,L)}}else Mn(e,n,a,l);break;case 31:Mn(e,n,a,l);break;case 13:Mn(e,n,a,l);break;case 23:break;case 22:m=n.stateNode,x=n.alternate,n.memoizedState!==null?m._visibility&2?Mn(e,n,a,l):Va(e,n):m._visibility&2?Mn(e,n,a,l):(m._visibility|=2,Pi(e,n,a,l,(n.subtreeFlags&10256)!==0||!1)),f&2048&&Hu(x,n);break;case 24:Mn(e,n,a,l),f&2048&&Uu(n.alternate,n);break;default:Mn(e,n,a,l)}}function Pi(e,n,a,l,f){for(f=f&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var m=e,x=n,R=a,L=l,J=x.flags;switch(x.tag){case 0:case 11:case 15:Pi(m,x,R,L,f),Ga(8,x);break;case 23:break;case 22:var oe=x.stateNode;x.memoizedState!==null?oe._visibility&2?Pi(m,x,R,L,f):Va(m,x):(oe._visibility|=2,Pi(m,x,R,L,f)),f&&J&2048&&Hu(x.alternate,x);break;case 24:Pi(m,x,R,L,f),f&&J&2048&&Uu(x.alternate,x);break;default:Pi(m,x,R,L,f)}n=n.sibling}}function Va(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=e,l=n,f=l.flags;switch(l.tag){case 22:Va(a,l),f&2048&&Hu(l.alternate,l);break;case 24:Va(a,l),f&2048&&Uu(l.alternate,l);break;default:Va(a,l)}n=n.sibling}}var Pa=8192;function Yi(e,n,a){if(e.subtreeFlags&Pa)for(e=e.child;e!==null;)Rm(e,n,a),e=e.sibling}function Rm(e,n,a){switch(e.tag){case 26:Yi(e,n,a),e.flags&Pa&&e.memoizedState!==null&&kS(a,On,e.memoizedState,e.memoizedProps);break;case 5:Yi(e,n,a);break;case 3:case 4:var l=On;On=xl(e.stateNode.containerInfo),Yi(e,n,a),On=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=Pa,Pa=16777216,Yi(e,n,a),Pa=l):Yi(e,n,a));break;default:Yi(e,n,a)}}function Tm(e){var n=e.alternate;if(n!==null&&(e=n.child,e!==null)){n.child=null;do n=e.sibling,e.sibling=null,e=n;while(e!==null)}}function Ya(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var l=n[a];Dt=l,Nm(l,e)}Tm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Em(e),e=e.sibling}function Em(e){switch(e.tag){case 0:case 11:case 15:Ya(e),e.flags&2048&&Er(9,e,e.return);break;case 3:Ya(e);break;case 12:Ya(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,ll(e)):Ya(e);break;default:Ya(e)}}function ll(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var l=n[a];Dt=l,Nm(l,e)}Tm(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:Er(8,n,n.return),ll(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,ll(n));break;default:ll(n)}e=e.sibling}}function Nm(e,n){for(;Dt!==null;){var a=Dt;switch(a.tag){case 0:case 11:case 15:Er(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:Aa(a.memoizedState.cache)}if(l=a.child,l!==null)l.return=a,Dt=l;else e:for(a=e;Dt!==null;){l=Dt;var f=l.sibling,m=l.return;if(bm(l),l===a){Dt=null;break e}if(f!==null){f.return=m,Dt=f;break e}Dt=m}}}var zx={getCacheForType:function(e){var n=Bt(xt),a=n.data.get(e);return a===void 0&&(a=e(),n.data.set(e,a)),a},cacheSignal:function(){return Bt(xt).controller.signal}},Bx=typeof WeakMap=="function"?WeakMap:Map,Qe=0,it=null,He=null,Ge=0,Je=0,mn=null,Nr=!1,Ki=!1,qu=!1,ur=0,ht=0,Ar=0,ui=0,$u=0,pn=0,Xi=0,Ka=null,en=null,Gu=!1,ol=0,Am=0,ul=1/0,cl=null,Ir=null,Tt=0,Dr=null,Qi=null,cr=0,Fu=0,Vu=null,Im=null,Xa=0,Pu=null;function gn(){return(Qe&2)!==0&&Ge!==0?Ge&-Ge:D.T!==null?Ju():Pd()}function Dm(){if(pn===0)if((Ge&536870912)===0||Pe){var e=Yn;Yn<<=1,(Yn&3932160)===0&&(Yn=262144),pn=e}else pn=536870912;return e=fn.current,e!==null&&(e.flags|=32),pn}function tn(e,n,a){(e===it&&(Je===2||Je===9)||e.cancelPendingCommit!==null)&&(Zi(e,0),Or(e,Ge,pn,!1)),Vt(e,a),((Qe&2)===0||e!==it)&&(e===it&&((Qe&2)===0&&(ui|=a),ht===4&&Or(e,Ge,pn,!1)),qn(e))}function Om(e,n,a){if((Qe&6)!==0)throw Error(s(327));var l=!a&&(n&127)===0&&(n&e.expiredLanes)===0||ie(e,n),f=l?qx(e,n):Ku(e,n,!0),m=l;do{if(f===0){Ki&&!l&&Or(e,n,0,!1);break}else{if(a=e.current.alternate,m&&!Hx(a)){f=Ku(e,n,!1),m=!1;continue}if(f===2){if(m=n,e.errorRecoveryDisabledLanes&m)var x=0;else x=e.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){n=x;e:{var R=e;f=Ka;var L=R.current.memoizedState.isDehydrated;if(L&&(Zi(R,x).flags|=256),x=Ku(R,x,!1),x!==2){if(qu&&!L){R.errorRecoveryDisabledLanes|=m,ui|=m,f=4;break e}m=en,en=f,m!==null&&(en===null?en=m:en.push.apply(en,m))}f=x}if(m=!1,f!==2)continue}}if(f===1){Zi(e,0),Or(e,n,0,!0);break}e:{switch(l=e,m=f,m){case 0:case 1:throw Error(s(345));case 4:if((n&4194048)!==n)break;case 6:Or(l,n,pn,!Nr);break e;case 2:en=null;break;case 3:case 5:break;default:throw Error(s(329))}if((n&62914560)===n&&(f=ol+300-Oe(),10<f)){if(Or(l,n,pn,!Nr),Pr(l,0,!0)!==0)break e;cr=n,l.timeoutHandle=cp(Mm.bind(null,l,a,en,cl,Gu,n,pn,ui,Xi,Nr,m,"Throttled",-0,0),f);break e}Mm(l,a,en,cl,Gu,n,pn,ui,Xi,Nr,m,null,-0,0)}}break}while(!0);qn(e)}function Mm(e,n,a,l,f,m,x,R,L,J,oe,de,ee,re){if(e.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:Xn},Rm(n,m,de);var ye=(m&62914560)===m?ol-Oe():(m&4194048)===m?Am-Oe():0;if(ye=wS(de,ye),ye!==null){cr=m,e.cancelPendingCommit=ye($m.bind(null,e,n,m,a,l,f,x,R,L,oe,de,null,ee,re)),Or(e,m,x,!J);return}}$m(e,n,m,a,l,f,x,R,L)}function Hx(e){for(var n=e;;){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(!cn(m(),f))return!1}catch{return!1}}if(a=n.child,n.subtreeFlags&16384&&a!==null)a.return=n,n=a;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Or(e,n,a,l){n&=~$u,n&=~ui,e.suspendedLanes|=n,e.pingedLanes&=~n,l&&(e.warmLanes|=n),l=e.expirationTimes;for(var f=n;0<f;){var m=31-Ae(f),x=1<<m;l[m]=-1,f&=~x}a!==0&&Pt(e,a,n)}function dl(){return(Qe&6)===0?(Qa(0),!1):!0}function Yu(){if(He!==null){if(Je===0)var e=He.return;else e=He,Wn=ei=null,uu(e),qi=null,Da=0,e=He;for(;e!==null;)dm(e.alternate,e),e=e.return;He=null}}function Zi(e,n){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,aS(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),cr=0,Yu(),it=e,He=a=Zn(e.current,null),Ge=n,Je=0,mn=null,Nr=!1,Ki=ie(e,n),qu=!1,Xi=pn=$u=ui=Ar=ht=0,en=Ka=null,Gu=!1,(n&8)!==0&&(n|=n&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=n;0<l;){var f=31-Ae(l),m=1<<f;n|=e[f],l&=~m}return ur=n,Ds(),a}function _m(e,n){Le=null,D.H=Ua,n===Ui||n===Us?(n=Zf(),Je=3):n===Zo?(n=Zf(),Je=4):Je=n===ju?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,mn=n,He===null&&(ht=1,el(e,wn(n,e.current)))}function Lm(){var e=fn.current;return e===null?!0:(Ge&4194048)===Ge?Tn===null:(Ge&62914560)===Ge||(Ge&536870912)!==0?e===Tn:!1}function zm(){var e=D.H;return D.H=Ua,e===null?Ua:e}function Bm(){var e=D.A;return D.A=zx,e}function fl(){ht=4,Nr||(Ge&4194048)!==Ge&&fn.current!==null||(Ki=!0),(Ar&134217727)===0&&(ui&134217727)===0||it===null||Or(it,Ge,pn,!1)}function Ku(e,n,a){var l=Qe;Qe|=2;var f=zm(),m=Bm();(it!==e||Ge!==n)&&(cl=null,Zi(e,n)),n=!1;var x=ht;e:do try{if(Je!==0&&He!==null){var R=He,L=mn;switch(Je){case 8:Yu(),x=6;break e;case 3:case 2:case 9:case 6:fn.current===null&&(n=!0);var J=Je;if(Je=0,mn=null,Ji(e,R,L,J),a&&Ki){x=0;break e}break;default:J=Je,Je=0,mn=null,Ji(e,R,L,J)}}Ux(),x=ht;break}catch(oe){_m(e,oe)}while(!0);return n&&e.shellSuspendCounter++,Wn=ei=null,Qe=l,D.H=f,D.A=m,He===null&&(it=null,Ge=0,Ds()),x}function Ux(){for(;He!==null;)Hm(He)}function qx(e,n){var a=Qe;Qe|=2;var l=zm(),f=Bm();it!==e||Ge!==n?(cl=null,ul=Oe()+500,Zi(e,n)):Ki=ie(e,n);e:do try{if(Je!==0&&He!==null){n=He;var m=mn;t:switch(Je){case 1:Je=0,mn=null,Ji(e,n,m,1);break;case 2:case 9:if(Xf(m)){Je=0,mn=null,Um(n);break}n=function(){Je!==2&&Je!==9||it!==e||(Je=7),qn(e)},m.then(n,n);break e;case 3:Je=7;break e;case 4:Je=5;break e;case 7:Xf(m)?(Je=0,mn=null,Um(n)):(Je=0,mn=null,Ji(e,n,m,7));break;case 5:var x=null;switch(He.tag){case 26:x=He.memoizedState;case 5:case 27:var R=He;if(x?jp(x):R.stateNode.complete){Je=0,mn=null;var L=R.sibling;if(L!==null)He=L;else{var J=R.return;J!==null?(He=J,hl(J)):He=null}break t}}Je=0,mn=null,Ji(e,n,m,5);break;case 6:Je=0,mn=null,Ji(e,n,m,6);break;case 8:Yu(),ht=6;break e;default:throw Error(s(462))}}$x();break}catch(oe){_m(e,oe)}while(!0);return Wn=ei=null,D.H=l,D.A=f,Qe=a,He!==null?0:(it=null,Ge=0,Ds(),ht)}function $x(){for(;He!==null&&!Ee();)Hm(He)}function Hm(e){var n=um(e.alternate,e,ur);e.memoizedProps=e.pendingProps,n===null?hl(e):He=n}function Um(e){var n=e,a=n.alternate;switch(n.tag){case 15:case 0:n=rm(a,n,n.pendingProps,n.type,void 0,Ge);break;case 11:n=rm(a,n,n.pendingProps,n.type.render,n.ref,Ge);break;case 5:uu(n);default:dm(a,n),n=He=Bf(n,ur),n=um(a,n,ur)}e.memoizedProps=e.pendingProps,n===null?hl(e):He=n}function Ji(e,n,a,l){Wn=ei=null,uu(n),qi=null,Da=0;var f=n.return;try{if(Ax(e,f,n,a,Ge)){ht=1,el(e,wn(a,e.current)),He=null;return}}catch(m){if(f!==null)throw He=f,m;ht=1,el(e,wn(a,e.current)),He=null;return}n.flags&32768?(Pe||l===1?e=!0:Ki||(Ge&536870912)!==0?e=!1:(Nr=e=!0,(l===2||l===9||l===3||l===6)&&(l=fn.current,l!==null&&l.tag===13&&(l.flags|=16384))),qm(n,e)):hl(n)}function hl(e){var n=e;do{if((n.flags&32768)!==0){qm(n,Nr);return}e=n.return;var a=Ox(n.alternate,n,ur);if(a!==null){He=a;return}if(n=n.sibling,n!==null){He=n;return}He=n=e}while(n!==null);ht===0&&(ht=5)}function qm(e,n){do{var a=Mx(e.alternate,e);if(a!==null){a.flags&=32767,He=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(e=e.sibling,e!==null)){He=e;return}He=e=a}while(e!==null);ht=6,He=null}function $m(e,n,a,l,f,m,x,R,L){e.cancelPendingCommit=null;do ml();while(Tt!==0);if((Qe&6)!==0)throw Error(s(327));if(n!==null){if(n===e.current)throw Error(s(177));if(m=n.lanes|n.childLanes,m|=Lo,on(e,a,m,x,R,L),e===it&&(He=it=null,Ge=0),Qi=n,Dr=e,cr=a,Fu=m,Vu=f,Im=l,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Px(be,function(){return Ym(),null})):(e.callbackNode=null,e.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=Qe,Qe|=4;try{_x(e,n,a)}finally{Qe=x,H.p=f,D.T=l}}Tt=1,Gm(),Fm(),Vm()}}function Gm(){if(Tt===1){Tt=0;var e=Dr,n=Qi,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=Qe;Qe|=4;try{wm(n,e);var m=sc,x=Nf(e.containerInfo),R=m.focusedElem,L=m.selectionRange;if(x!==R&&R&&R.ownerDocument&&Ef(R.ownerDocument.documentElement,R)){if(L!==null&&Io(R)){var J=L.start,oe=L.end;if(oe===void 0&&(oe=J),"selectionStart"in R)R.selectionStart=J,R.selectionEnd=Math.min(oe,R.value.length);else{var de=R.ownerDocument||document,ee=de&&de.defaultView||window;if(ee.getSelection){var re=ee.getSelection(),ye=R.textContent.length,Re=Math.min(L.start,ye),nt=L.end===void 0?Re:Math.min(L.end,ye);!re.extend&&Re>nt&&(x=nt,nt=Re,Re=x);var K=Tf(R,Re),q=Tf(R,nt);if(K&&q&&(re.rangeCount!==1||re.anchorNode!==K.node||re.anchorOffset!==K.offset||re.focusNode!==q.node||re.focusOffset!==q.offset)){var Q=de.createRange();Q.setStart(K.node,K.offset),re.removeAllRanges(),Re>nt?(re.addRange(Q),re.extend(q.node,q.offset)):(Q.setEnd(q.node,q.offset),re.addRange(Q))}}}}for(de=[],re=R;re=re.parentNode;)re.nodeType===1&&de.push({element:re,left:re.scrollLeft,top:re.scrollTop});for(typeof R.focus=="function"&&R.focus(),R=0;R<de.length;R++){var ce=de[R];ce.element.scrollLeft=ce.left,ce.element.scrollTop=ce.top}}Rl=!!ac,sc=ac=null}finally{Qe=f,H.p=l,D.T=a}}e.current=n,Tt=2}}function Fm(){if(Tt===2){Tt=0;var e=Dr,n=Qi,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=Qe;Qe|=4;try{vm(e,n.alternate,n)}finally{Qe=f,H.p=l,D.T=a}}Tt=3}}function Vm(){if(Tt===4||Tt===3){Tt=0,dt();var e=Dr,n=Qi,a=cr,l=Im;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Tt=5:(Tt=0,Qi=Dr=null,Pm(e,e.pendingLanes));var f=e.pendingLanes;if(f===0&&(Ir=null),gr(a),n=n.stateNode,Te&&typeof Te.onCommitFiberRoot=="function")try{Te.onCommitFiberRoot(Ce,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=e.onRecoverableError,x=0;x<l.length;x++){var R=l[x];m(R.value,{componentStack:R.stack})}}finally{D.T=n,H.p=f}}(cr&3)!==0&&ml(),qn(e),f=e.pendingLanes,(a&261930)!==0&&(f&42)!==0?e===Pu?Xa++:(Xa=0,Pu=e):Xa=0,Qa(0)}}function Pm(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,Aa(n)))}function ml(){return Gm(),Fm(),Vm(),Ym()}function Ym(){if(Tt!==5)return!1;var e=Dr,n=Fu;Fu=0;var a=gr(cr),l=D.T,f=H.p;try{H.p=32>a?32:a,D.T=null,a=Vu,Vu=null;var m=Dr,x=cr;if(Tt=0,Qi=Dr=null,cr=0,(Qe&6)!==0)throw Error(s(331));var R=Qe;if(Qe|=4,Em(m.current),jm(m,m.current,x,a),Qe=R,Qa(0,!1),Te&&typeof Te.onPostCommitFiberRoot=="function")try{Te.onPostCommitFiberRoot(Ce,m)}catch{}return!0}finally{H.p=f,D.T=l,Pm(e,n)}}function Km(e,n,a){n=wn(a,n),n=Cu(e.stateNode,n,2),e=jr(e,n,2),e!==null&&(Vt(e,2),qn(e))}function We(e,n,a){if(e.tag===3)Km(e,e,a);else for(;n!==null;){if(n.tag===3){Km(n,e,a);break}else if(n.tag===1){var l=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Ir===null||!Ir.has(l))){e=wn(a,e),a=Xh(2),l=jr(n,a,2),l!==null&&(Qh(a,l,n,e),Vt(l,2),qn(l));break}}n=n.return}}function Xu(e,n,a){var l=e.pingCache;if(l===null){l=e.pingCache=new Bx;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)||(qu=!0,f.add(a),e=Gx.bind(null,e,n,a),n.then(e,e))}function Gx(e,n,a){var l=e.pingCache;l!==null&&l.delete(n),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,it===e&&(Ge&a)===a&&(ht===4||ht===3&&(Ge&62914560)===Ge&&300>Oe()-ol?(Qe&2)===0&&Zi(e,0):$u|=a,Xi===Ge&&(Xi=0)),qn(e)}function Xm(e,n){n===0&&(n=bt()),e=Zr(e,n),e!==null&&(Vt(e,n),qn(e))}function Fx(e){var n=e.memoizedState,a=0;n!==null&&(a=n.retryLane),Xm(e,a)}function Vx(e,n){var a=0;switch(e.tag){case 31:case 13:var l=e.stateNode,f=e.memoizedState;f!==null&&(a=f.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(s(314))}l!==null&&l.delete(n),Xm(e,a)}function Px(e,n){return qt(e,n)}var pl=null,Wi=null,Qu=!1,gl=!1,Zu=!1,Mr=0;function qn(e){e!==Wi&&e.next===null&&(Wi===null?pl=Wi=e:Wi=Wi.next=e),gl=!0,Qu||(Qu=!0,Kx())}function Qa(e,n){if(!Zu&&gl){Zu=!0;do for(var a=!1,l=pl;l!==null;){if(e!==0){var f=l.pendingLanes;if(f===0)var m=0;else{var x=l.suspendedLanes,R=l.pingedLanes;m=(1<<31-Ae(42|e)+1)-1,m&=f&~(x&~R),m=m&201326741?m&201326741|1:m?m|2:0}m!==0&&(a=!0,Wm(l,m))}else m=Ge,m=Pr(l,l===it?m:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(m&3)===0||ie(l,m)||(a=!0,Wm(l,m));l=l.next}while(a);Zu=!1}}function Yx(){Qm()}function Qm(){gl=Qu=!1;var e=0;Mr!==0&&iS()&&(e=Mr);for(var n=Oe(),a=null,l=pl;l!==null;){var f=l.next,m=Zm(l,n);m===0?(l.next=null,a===null?pl=f:a.next=f,f===null&&(Wi=a)):(a=l,(e!==0||(m&3)!==0)&&(gl=!0)),l=f}Tt!==0&&Tt!==5||Qa(e),Mr!==0&&(Mr=0)}function Zm(e,n){for(var a=e.suspendedLanes,l=e.pingedLanes,f=e.expirationTimes,m=e.pendingLanes&-62914561;0<m;){var x=31-Ae(m),R=1<<x,L=f[x];L===-1?((R&a)===0||(R&l)!==0)&&(f[x]=je(R,n)):L<=n&&(e.expiredLanes|=R),m&=~R}if(n=it,a=Ge,a=Pr(e,e===n?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,a===0||e===n&&(Je===2||Je===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&Ne(l),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||ie(e,a)){if(n=a&-a,n===e.callbackPriority)return n;switch(l!==null&&Ne(l),gr(a)){case 2:case 8:a=he;break;case 32:a=be;break;case 268435456:a=Me;break;default:a=be}return l=Jm.bind(null,e),a=qt(a,l),e.callbackPriority=n,e.callbackNode=a,n}return l!==null&&l!==null&&Ne(l),e.callbackPriority=2,e.callbackNode=null,2}function Jm(e,n){if(Tt!==0&&Tt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(ml()&&e.callbackNode!==a)return null;var l=Ge;return l=Pr(e,e===it?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(Om(e,l,n),Zm(e,Oe()),e.callbackNode!=null&&e.callbackNode===a?Jm.bind(null,e):null)}function Wm(e,n){if(ml())return null;Om(e,n,!0)}function Kx(){sS(function(){(Qe&6)!==0?qt(le,Yx):Qm()})}function Ju(){if(Mr===0){var e=Bi;e===0&&(e=In,In<<=1,(In&261888)===0&&(In=256)),Mr=e}return Mr}function ep(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Cs(""+e)}function tp(e,n){var a=n.ownerDocument.createElement("input");return a.name=n.name,a.value=n.value,e.id&&a.setAttribute("form",e.id),n.parentNode.insertBefore(a,n),e=new FormData(e),a.parentNode.removeChild(a),e}function Xx(e,n,a,l,f){if(n==="submit"&&a&&a.stateNode===f){var m=ep((f[Xt]||null).action),x=l.submitter;x&&(n=(n=x[Xt]||null)?ep(n.formAction):x.getAttribute("formAction"),n!==null&&(m=n,x=null));var R=new Es("action","action",null,l,f);e.push({event:R,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Mr!==0){var L=x?tp(f,x):new FormData(f);vu(a,{pending:!0,data:L,method:f.method,action:m},null,L)}}else typeof m=="function"&&(R.preventDefault(),L=x?tp(f,x):new FormData(f),vu(a,{pending:!0,data:L,method:f.method,action:m},m,L))},currentTarget:f}]})}}for(var Wu=0;Wu<_o.length;Wu++){var ec=_o[Wu],Qx=ec.toLowerCase(),Zx=ec[0].toUpperCase()+ec.slice(1);Dn(Qx,"on"+Zx)}Dn(Df,"onAnimationEnd"),Dn(Of,"onAnimationIteration"),Dn(Mf,"onAnimationStart"),Dn("dblclick","onDoubleClick"),Dn("focusin","onFocus"),Dn("focusout","onBlur"),Dn(hx,"onTransitionRun"),Dn(mx,"onTransitionStart"),Dn(px,"onTransitionCancel"),Dn(_f,"onTransitionEnd"),Ci("onMouseEnter",["mouseout","mouseover"]),Ci("onMouseLeave",["mouseout","mouseover"]),Ci("onPointerEnter",["pointerout","pointerover"]),Ci("onPointerLeave",["pointerout","pointerover"]),Yr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Yr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Yr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Yr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Yr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Yr("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(" "),Jx=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Za));function np(e,n){n=(n&4)!==0;for(var a=0;a<e.length;a++){var l=e[a],f=l.event;l=l.listeners;e:{var m=void 0;if(n)for(var x=l.length-1;0<=x;x--){var R=l[x],L=R.instance,J=R.currentTarget;if(R=R.listener,L!==m&&f.isPropagationStopped())break e;m=R,f.currentTarget=J;try{m(f)}catch(oe){Is(oe)}f.currentTarget=null,m=L}else for(x=0;x<l.length;x++){if(R=l[x],L=R.instance,J=R.currentTarget,R=R.listener,L!==m&&f.isPropagationStopped())break e;m=R,f.currentTarget=J;try{m(f)}catch(oe){Is(oe)}f.currentTarget=null,m=L}}}}function Ue(e,n){var a=n[ho];a===void 0&&(a=n[ho]=new Set);var l=e+"__bubble";a.has(l)||(rp(n,e,2,!1),a.add(l))}function tc(e,n,a){var l=0;n&&(l|=4),rp(a,e,l,n)}var yl="_reactListening"+Math.random().toString(36).slice(2);function nc(e){if(!e[yl]){e[yl]=!0,Xd.forEach(function(a){a!=="selectionchange"&&(Jx.has(a)||tc(a,!1,e),tc(a,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[yl]||(n[yl]=!0,tc("selectionchange",!1,n))}}function rp(e,n,a,l){switch(Dp(n)){case 2:var f=RS;break;case 8:f=TS;break;default:f=yc}a=f.bind(null,n,a,e),f=void 0,!ko||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(f=!0),l?f!==void 0?e.addEventListener(n,a,{capture:!0,passive:f}):e.addEventListener(n,a,!0):f!==void 0?e.addEventListener(n,a,{passive:f}):e.addEventListener(n,a,!1)}function rc(e,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 R=l.stateNode.containerInfo;if(R===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(;R!==null;){if(x=Si(R),x===null)return;if(L=x.tag,L===5||L===6||L===26||L===27){l=m=x;continue e}R=R.parentNode}}l=l.return}of(function(){var J=m,oe=xo(a),de=[];e:{var ee=Lf.get(e);if(ee!==void 0){var re=Es,ye=e;switch(e){case"keypress":if(Rs(a)===0)break e;case"keydown":case"keyup":re=Vb;break;case"focusin":ye="focus",re=Ro;break;case"focusout":ye="blur",re=Ro;break;case"beforeblur":case"afterblur":re=Ro;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":re=df;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":re=Ob;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":re=Kb;break;case Df:case Of:case Mf:re=Lb;break;case _f:re=Qb;break;case"scroll":case"scrollend":re=Ib;break;case"wheel":re=Jb;break;case"copy":case"cut":case"paste":re=Bb;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":re=hf;break;case"toggle":case"beforetoggle":re=ex}var Re=(n&4)!==0,nt=!Re&&(e==="scroll"||e==="scrollend"),K=Re?ee!==null?ee+"Capture":null:ee;Re=[];for(var q=J,Q;q!==null;){var ce=q;if(Q=ce.stateNode,ce=ce.tag,ce!==5&&ce!==26&&ce!==27||Q===null||K===null||(ce=ba(q,K),ce!=null&&Re.push(Ja(q,ce,Q))),nt)break;q=q.return}0<Re.length&&(ee=new re(ee,ye,null,a,oe),de.push({event:ee,listeners:Re}))}}if((n&7)===0){e:{if(ee=e==="mouseover"||e==="pointerover",re=e==="mouseout"||e==="pointerout",ee&&a!==bo&&(ye=a.relatedTarget||a.fromElement)&&(Si(ye)||ye[xi]))break e;if((re||ee)&&(ee=oe.window===oe?oe:(ee=oe.ownerDocument)?ee.defaultView||ee.parentWindow:window,re?(ye=a.relatedTarget||a.toElement,re=J,ye=ye?Si(ye):null,ye!==null&&(nt=c(ye),Re=ye.tag,ye!==nt||Re!==5&&Re!==27&&Re!==6)&&(ye=null)):(re=null,ye=J),re!==ye)){if(Re=df,ce="onMouseLeave",K="onMouseEnter",q="mouse",(e==="pointerout"||e==="pointerover")&&(Re=hf,ce="onPointerLeave",K="onPointerEnter",q="pointer"),nt=re==null?ee:va(re),Q=ye==null?ee:va(ye),ee=new Re(ce,q+"leave",re,a,oe),ee.target=nt,ee.relatedTarget=Q,ce=null,Si(oe)===J&&(Re=new Re(K,q+"enter",ye,a,oe),Re.target=Q,Re.relatedTarget=nt,ce=Re),nt=ce,re&&ye)t:{for(Re=Wx,K=re,q=ye,Q=0,ce=K;ce;ce=Re(ce))Q++;ce=0;for(var xe=q;xe;xe=Re(xe))ce++;for(;0<Q-ce;)K=Re(K),Q--;for(;0<ce-Q;)q=Re(q),ce--;for(;Q--;){if(K===q||q!==null&&K===q.alternate){Re=K;break t}K=Re(K),q=Re(q)}Re=null}else Re=null;re!==null&&ip(de,ee,re,Re,!1),ye!==null&&nt!==null&&ip(de,nt,ye,Re,!0)}}e:{if(ee=J?va(J):window,re=ee.nodeName&&ee.nodeName.toLowerCase(),re==="select"||re==="input"&&ee.type==="file")var Ke=Sf;else if(bf(ee))if(kf)Ke=cx;else{Ke=ox;var ve=lx}else re=ee.nodeName,!re||re.toLowerCase()!=="input"||ee.type!=="checkbox"&&ee.type!=="radio"?J&&vo(J.elementType)&&(Ke=Sf):Ke=ux;if(Ke&&(Ke=Ke(e,J))){xf(de,Ke,a,oe);break e}ve&&ve(e,ee,J),e==="focusout"&&J&&ee.type==="number"&&J.memoizedProps.value!=null&&yo(ee,"number",ee.value)}switch(ve=J?va(J):window,e){case"focusin":(bf(ve)||ve.contentEditable==="true")&&(Ai=ve,Do=J,Ta=null);break;case"focusout":Ta=Do=Ai=null;break;case"mousedown":Oo=!0;break;case"contextmenu":case"mouseup":case"dragend":Oo=!1,Af(de,a,oe);break;case"selectionchange":if(fx)break;case"keydown":case"keyup":Af(de,a,oe)}var ze;if(Eo)e:{switch(e){case"compositionstart":var Fe="onCompositionStart";break e;case"compositionend":Fe="onCompositionEnd";break e;case"compositionupdate":Fe="onCompositionUpdate";break e}Fe=void 0}else Ni?yf(e,a)&&(Fe="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Fe="onCompositionStart");Fe&&(mf&&a.locale!=="ko"&&(Ni||Fe!=="onCompositionStart"?Fe==="onCompositionEnd"&&Ni&&(ze=uf()):(vr=oe,wo="value"in vr?vr.value:vr.textContent,Ni=!0)),ve=vl(J,Fe),0<ve.length&&(Fe=new ff(Fe,e,null,a,oe),de.push({event:Fe,listeners:ve}),ze?Fe.data=ze:(ze=vf(a),ze!==null&&(Fe.data=ze)))),(ze=nx?rx(e,a):ix(e,a))&&(Fe=vl(J,"onBeforeInput"),0<Fe.length&&(ve=new ff("onBeforeInput","beforeinput",null,a,oe),de.push({event:ve,listeners:Fe}),ve.data=ze)),Xx(de,e,J,a,oe)}np(de,n)})}function Ja(e,n,a){return{instance:e,listener:n,currentTarget:a}}function vl(e,n){for(var a=n+"Capture",l=[];e!==null;){var f=e,m=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||m===null||(f=ba(e,a),f!=null&&l.unshift(Ja(e,f,m)),f=ba(e,n),f!=null&&l.push(Ja(e,f,m))),e.tag===3)return l;e=e.return}return[]}function Wx(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function ip(e,n,a,l,f){for(var m=n._reactName,x=[];a!==null&&a!==l;){var R=a,L=R.alternate,J=R.stateNode;if(R=R.tag,L!==null&&L===l)break;R!==5&&R!==26&&R!==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&&e.push({event:n,listeners:x})}var eS=/\r\n?/g,tS=/\u0000|\uFFFD/g;function ap(e){return(typeof e=="string"?e:""+e).replace(eS,`
|
|
9
|
+
`).replace(tS,"")}function sp(e,n){return n=ap(n),ap(e)===n}function tt(e,n,a,l,f,m){switch(a){case"children":typeof l=="string"?n==="body"||n==="textarea"&&l===""||Ri(e,l):(typeof l=="number"||typeof l=="bigint")&&n!=="body"&&Ri(e,""+l);break;case"className":ks(e,"class",l);break;case"tabIndex":ks(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":ks(e,a,l);break;case"style":sf(e,l,m);break;case"data":if(n!=="object"){ks(e,"data",l);break}case"src":case"href":if(l===""&&(n!=="a"||a!=="href")){e.removeAttribute(a);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=Cs(""+l),e.setAttribute(a,l);break;case"action":case"formAction":if(typeof l=="function"){e.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"&&tt(e,n,"name",f.name,f,null),tt(e,n,"formEncType",f.formEncType,f,null),tt(e,n,"formMethod",f.formMethod,f,null),tt(e,n,"formTarget",f.formTarget,f,null)):(tt(e,n,"encType",f.encType,f,null),tt(e,n,"method",f.method,f,null),tt(e,n,"target",f.target,f,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=Cs(""+l),e.setAttribute(a,l);break;case"onClick":l!=null&&(e.onclick=Xn);break;case"onScroll":l!=null&&Ue("scroll",e);break;case"onScrollEnd":l!=null&&Ue("scrollend",e);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));e.innerHTML=a}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.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"){e.removeAttribute("xlink:href");break}a=Cs(""+l),e.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"?e.setAttribute(a,""+l):e.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"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":l===!0?e.setAttribute(a,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,l):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(a,l):e.removeAttribute(a);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(a):e.setAttribute(a,l);break;case"popover":Ue("beforetoggle",e),Ue("toggle",e),Ss(e,"popover",l);break;case"xlinkActuate":Kn(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Kn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Kn(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Kn(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Kn(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Kn(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Kn(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Kn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Kn(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Ss(e,"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=Nb.get(a)||a,Ss(e,a,l))}}function ic(e,n,a,l,f,m){switch(a){case"style":sf(e,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));e.innerHTML=a}}break;case"children":typeof l=="string"?Ri(e,l):(typeof l=="number"||typeof l=="bigint")&&Ri(e,""+l);break;case"onScroll":l!=null&&Ue("scroll",e);break;case"onScrollEnd":l!=null&&Ue("scrollend",e);break;case"onClick":l!=null&&(e.onclick=Xn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Qd.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=e[Xt]||null,m=m!=null?m[a]:null,typeof m=="function"&&e.removeEventListener(n,m,f),typeof l=="function")){typeof m!="function"&&m!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(n,l,f);break e}a in e?e[a]=l:l===!0?e.setAttribute(a,""):Ss(e,a,l)}}}function Ut(e,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ue("error",e),Ue("load",e);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:tt(e,n,m,x,a,null)}}f&&tt(e,n,"srcSet",a.srcSet,a,null),l&&tt(e,n,"src",a.src,a,null);return;case"input":Ue("invalid",e);var R=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":R=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(s(137,n));break;default:tt(e,n,l,oe,a,null)}}tf(e,m,R,L,J,x,f,!1);return;case"select":Ue("invalid",e),l=x=m=null;for(f in a)if(a.hasOwnProperty(f)&&(R=a[f],R!=null))switch(f){case"value":m=R;break;case"defaultValue":x=R;break;case"multiple":l=R;default:tt(e,n,f,R,a,null)}n=m,a=x,e.multiple=!!l,n!=null?ji(e,!!l,n,!1):a!=null&&ji(e,!!l,a,!0);return;case"textarea":Ue("invalid",e),m=f=l=null;for(x in a)if(a.hasOwnProperty(x)&&(R=a[x],R!=null))switch(x){case"value":l=R;break;case"defaultValue":f=R;break;case"children":m=R;break;case"dangerouslySetInnerHTML":if(R!=null)throw Error(s(91));break;default:tt(e,n,x,R,a,null)}rf(e,l,f,m);return;case"option":for(L in a)a.hasOwnProperty(L)&&(l=a[L],l!=null)&&(L==="selected"?e.selected=l&&typeof l!="function"&&typeof l!="symbol":tt(e,n,L,l,a,null));return;case"dialog":Ue("beforetoggle",e),Ue("toggle",e),Ue("cancel",e),Ue("close",e);break;case"iframe":case"object":Ue("load",e);break;case"video":case"audio":for(l=0;l<Za.length;l++)Ue(Za[l],e);break;case"image":Ue("error",e),Ue("load",e);break;case"details":Ue("toggle",e);break;case"embed":case"source":case"link":Ue("error",e),Ue("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(J in a)if(a.hasOwnProperty(J)&&(l=a[J],l!=null))switch(J){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,n));default:tt(e,n,J,l,a,null)}return;default:if(vo(n)){for(oe in a)a.hasOwnProperty(oe)&&(l=a[oe],l!==void 0&&ic(e,n,oe,l,a,void 0));return}}for(R in a)a.hasOwnProperty(R)&&(l=a[R],l!=null&&tt(e,n,R,l,a,null))}function nS(e,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,R=null,L=null,J=null,oe=null;for(re in a){var de=a[re];if(a.hasOwnProperty(re)&&de!=null)switch(re){case"checked":break;case"value":break;case"defaultValue":L=de;default:l.hasOwnProperty(re)||tt(e,n,re,null,l,de)}}for(var ee in l){var re=l[ee];if(de=a[ee],l.hasOwnProperty(ee)&&(re!=null||de!=null))switch(ee){case"type":m=re;break;case"name":f=re;break;case"checked":J=re;break;case"defaultChecked":oe=re;break;case"value":x=re;break;case"defaultValue":R=re;break;case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(s(137,n));break;default:re!==de&&tt(e,n,ee,re,l,de)}}go(e,x,R,L,J,oe,m,f);return;case"select":re=x=R=ee=null;for(m in a)if(L=a[m],a.hasOwnProperty(m)&&L!=null)switch(m){case"value":break;case"multiple":re=L;default:l.hasOwnProperty(m)||tt(e,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":R=m;break;case"multiple":x=m;default:m!==L&&tt(e,n,f,m,l,L)}n=R,a=x,l=re,ee!=null?ji(e,!!a,ee,!1):!!l!=!!a&&(n!=null?ji(e,!!a,n,!0):ji(e,!!a,a?[]:"",!1));return;case"textarea":re=ee=null;for(R in a)if(f=a[R],a.hasOwnProperty(R)&&f!=null&&!l.hasOwnProperty(R))switch(R){case"value":break;case"children":break;default:tt(e,n,R,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":re=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(s(91));break;default:f!==m&&tt(e,n,x,f,l,m)}nf(e,ee,re);return;case"option":for(var ye in a)ee=a[ye],a.hasOwnProperty(ye)&&ee!=null&&!l.hasOwnProperty(ye)&&(ye==="selected"?e.selected=!1:tt(e,n,ye,null,l,ee));for(L in l)ee=l[L],re=a[L],l.hasOwnProperty(L)&&ee!==re&&(ee!=null||re!=null)&&(L==="selected"?e.selected=ee&&typeof ee!="function"&&typeof ee!="symbol":tt(e,n,L,ee,l,re));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Re in a)ee=a[Re],a.hasOwnProperty(Re)&&ee!=null&&!l.hasOwnProperty(Re)&&tt(e,n,Re,null,l,ee);for(J in l)if(ee=l[J],re=a[J],l.hasOwnProperty(J)&&ee!==re&&(ee!=null||re!=null))switch(J){case"children":case"dangerouslySetInnerHTML":if(ee!=null)throw Error(s(137,n));break;default:tt(e,n,J,ee,l,re)}return;default:if(vo(n)){for(var nt in a)ee=a[nt],a.hasOwnProperty(nt)&&ee!==void 0&&!l.hasOwnProperty(nt)&&ic(e,n,nt,void 0,l,ee);for(oe in l)ee=l[oe],re=a[oe],!l.hasOwnProperty(oe)||ee===re||ee===void 0&&re===void 0||ic(e,n,oe,ee,l,re);return}}for(var K in a)ee=a[K],a.hasOwnProperty(K)&&ee!=null&&!l.hasOwnProperty(K)&&tt(e,n,K,null,l,ee);for(de in l)ee=l[de],re=a[de],!l.hasOwnProperty(de)||ee===re||ee==null&&re==null||tt(e,n,de,ee,l,re)}function lp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function rS(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,a=performance.getEntriesByType("resource"),l=0;l<a.length;l++){var f=a[l],m=f.transferSize,x=f.initiatorType,R=f.duration;if(m&&R&&lp(x)){for(x=0,R=f.responseEnd,l+=1;l<a.length;l++){var L=a[l],J=L.startTime;if(J>R)break;var oe=L.transferSize,de=L.initiatorType;oe&&lp(de)&&(L=L.responseEnd,x+=oe*(L<R?1:(R-J)/(L-J)))}if(--l,n+=8*(m+x)/(f.duration/1e3),e++,10<e)break}}if(0<e)return n/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var ac=null,sc=null;function bl(e){return e.nodeType===9?e:e.ownerDocument}function op(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function up(e,n){if(e===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&n==="foreignObject"?0:e}function lc(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var oc=null;function iS(){var e=window.event;return e&&e.type==="popstate"?e===oc?!1:(oc=e,!0):(oc=null,!1)}var cp=typeof setTimeout=="function"?setTimeout:void 0,aS=typeof clearTimeout=="function"?clearTimeout:void 0,dp=typeof Promise=="function"?Promise:void 0,sS=typeof queueMicrotask=="function"?queueMicrotask:typeof dp<"u"?function(e){return dp.resolve(null).then(e).catch(lS)}:cp;function lS(e){setTimeout(function(){throw e})}function _r(e){return e==="head"}function fp(e,n){var a=n,l=0;do{var f=a.nextSibling;if(e.removeChild(a),f&&f.nodeType===8)if(a=f.data,a==="/$"||a==="/&"){if(l===0){e.removeChild(f),ra(n);return}l--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")l++;else if(a==="html")Wa(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,Wa(a);for(var m=a.firstChild;m;){var x=m.nextSibling,R=m.nodeName;m[ya]||R==="SCRIPT"||R==="STYLE"||R==="LINK"&&m.rel.toLowerCase()==="stylesheet"||a.removeChild(m),m=x}}else a==="body"&&Wa(e.ownerDocument.body);a=f}while(a);ra(n)}function hp(e,n){var a=e;e=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(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=l}while(a)}function uc(e){var n=e.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":uc(a),mo(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function oS(e,n,a,l){for(;e.nodeType===1;){var f=a;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[ya])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(m=e.getAttribute("rel"),m==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(m!==f.rel||e.getAttribute("href")!==(f.href==null||f.href===""?null:f.href)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin)||e.getAttribute("title")!==(f.title==null?null:f.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(m=e.getAttribute("src"),(m!==(f.src==null?null:f.src)||e.getAttribute("type")!==(f.type==null?null:f.type)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&m&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var m=f.name==null?null:""+f.name;if(f.type==="hidden"&&e.getAttribute("name")===m)return e}else return e;if(e=En(e.nextSibling),e===null)break}return null}function uS(e,n,a){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=En(e.nextSibling),e===null))return null;return e}function mp(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=En(e.nextSibling),e===null))return null;return e}function cc(e){return e.data==="$?"||e.data==="$~"}function dc(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function cS(e,n){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||a.readyState!=="loading")n();else{var l=function(){n(),a.removeEventListener("DOMContentLoaded",l)};a.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function En(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return e}var fc=null;function pp(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(n===0)return En(e.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}e=e.nextSibling}return null}function gp(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(n===0)return e;n--}else a!=="/$"&&a!=="/&"||n++}e=e.previousSibling}return null}function yp(e,n,a){switch(n=bl(a),e){case"html":if(e=n.documentElement,!e)throw Error(s(452));return e;case"head":if(e=n.head,!e)throw Error(s(453));return e;case"body":if(e=n.body,!e)throw Error(s(454));return e;default:throw Error(s(451))}}function Wa(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);mo(e)}var Nn=new Map,vp=new Set;function xl(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var dr=H.d;H.d={f:dS,r:fS,D:hS,C:mS,L:pS,m:gS,X:vS,S:yS,M:bS};function dS(){var e=dr.f(),n=dl();return e||n}function fS(e){var n=ki(e);n!==null&&n.tag===5&&n.type==="form"?_h(n):dr.r(e)}var ea=typeof document>"u"?null:document;function bp(e,n,a){var l=ea;if(l&&typeof n=="string"&&n){var f=Sn(n);f='link[rel="'+e+'"][href="'+f+'"]',typeof a=="string"&&(f+='[crossorigin="'+a+'"]'),vp.has(f)||(vp.add(f),e={rel:e,crossOrigin:a,href:n},l.querySelector(f)===null&&(n=l.createElement("link"),Ut(n,"link",e),It(n),l.head.appendChild(n)))}}function hS(e){dr.D(e),bp("dns-prefetch",e,null)}function mS(e,n){dr.C(e,n),bp("preconnect",e,n)}function pS(e,n,a){dr.L(e,n,a);var l=ea;if(l&&e&&n){var f='link[rel="preload"][as="'+Sn(n)+'"]';n==="image"&&a&&a.imageSrcSet?(f+='[imagesrcset="'+Sn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(f+='[imagesizes="'+Sn(a.imageSizes)+'"]')):f+='[href="'+Sn(e)+'"]';var m=f;switch(n){case"style":m=ta(e);break;case"script":m=na(e)}Nn.has(m)||(e=y({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:e,as:n},a),Nn.set(m,e),l.querySelector(f)!==null||n==="style"&&l.querySelector(es(m))||n==="script"&&l.querySelector(ts(m))||(n=l.createElement("link"),Ut(n,"link",e),It(n),l.head.appendChild(n)))}}function gS(e,n){dr.m(e,n);var a=ea;if(a&&e){var l=n&&typeof n.as=="string"?n.as:"script",f='link[rel="modulepreload"][as="'+Sn(l)+'"][href="'+Sn(e)+'"]',m=f;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":m=na(e)}if(!Nn.has(m)&&(e=y({rel:"modulepreload",href:e},n),Nn.set(m,e),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"),Ut(l,"link",e),It(l),a.head.appendChild(l)}}}function yS(e,n,a){dr.S(e,n,a);var l=ea;if(l&&e){var f=wi(l).hoistableStyles,m=ta(e);n=n||"default";var x=f.get(m);if(!x){var R={loading:0,preload:null};if(x=l.querySelector(es(m)))R.loading=5;else{e=y({rel:"stylesheet",href:e,"data-precedence":n},a),(a=Nn.get(m))&&hc(e,a);var L=x=l.createElement("link");It(L),Ut(L,"link",e),L._p=new Promise(function(J,oe){L.onload=J,L.onerror=oe}),L.addEventListener("load",function(){R.loading|=1}),L.addEventListener("error",function(){R.loading|=2}),R.loading|=4,Sl(x,n,l)}x={type:"stylesheet",instance:x,count:1,state:R},f.set(m,x)}}}function vS(e,n){dr.X(e,n);var a=ea;if(a&&e){var l=wi(a).hoistableScripts,f=na(e),m=l.get(f);m||(m=a.querySelector(ts(f)),m||(e=y({src:e,async:!0},n),(n=Nn.get(f))&&mc(e,n),m=a.createElement("script"),It(m),Ut(m,"link",e),a.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},l.set(f,m))}}function bS(e,n){dr.M(e,n);var a=ea;if(a&&e){var l=wi(a).hoistableScripts,f=na(e),m=l.get(f);m||(m=a.querySelector(ts(f)),m||(e=y({src:e,async:!0,type:"module"},n),(n=Nn.get(f))&&mc(e,n),m=a.createElement("script"),It(m),Ut(m,"link",e),a.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},l.set(f,m))}}function xp(e,n,a,l){var f=(f=Z.current)?xl(f):null;if(!f)throw Error(s(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(n=ta(a.href),a=wi(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"){e=ta(a.href);var m=wi(f).hoistableStyles,x=m.get(e);if(x||(f=f.ownerDocument||f,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},m.set(e,x),(m=f.querySelector(es(e)))&&!m._p&&(x.instance=m,x.state.loading=5),Nn.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Nn.set(e,a),m||xS(f,e,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=na(a),a=wi(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,e))}}function ta(e){return'href="'+Sn(e)+'"'}function es(e){return'link[rel="stylesheet"]['+e+"]"}function Sp(e){return y({},e,{"data-precedence":e.precedence,precedence:null})}function xS(e,n,a,l){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?l.loading=1:(n=e.createElement("link"),l.preload=n,n.addEventListener("load",function(){return l.loading|=1}),n.addEventListener("error",function(){return l.loading|=2}),Ut(n,"link",a),It(n),e.head.appendChild(n))}function na(e){return'[src="'+Sn(e)+'"]'}function ts(e){return"script[async]"+e}function kp(e,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var l=e.querySelector('style[data-href~="'+Sn(a.href)+'"]');if(l)return n.instance=l,It(l),l;var f=y({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),It(l),Ut(l,"style",f),Sl(l,a.precedence,e),n.instance=l;case"stylesheet":f=ta(a.href);var m=e.querySelector(es(f));if(m)return n.state.loading|=4,n.instance=m,It(m),m;l=Sp(a),(f=Nn.get(f))&&hc(l,f),m=(e.ownerDocument||e).createElement("link"),It(m);var x=m;return x._p=new Promise(function(R,L){x.onload=R,x.onerror=L}),Ut(m,"link",l),n.state.loading|=4,Sl(m,a.precedence,e),n.instance=m;case"script":return m=na(a.src),(f=e.querySelector(ts(m)))?(n.instance=f,It(f),f):(l=a,(f=Nn.get(m))&&(l=y({},a),mc(l,f)),e=e.ownerDocument||e,f=e.createElement("script"),It(f),Ut(f,"link",l),e.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,Sl(l,a.precedence,e));return n.instance}function Sl(e,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 R=l[x];if(R.dataset.precedence===n)m=R;else if(m!==f)break}m?m.parentNode.insertBefore(e,m.nextSibling):(n=a.nodeType===9?a.head:a,n.insertBefore(e,n.firstChild))}function hc(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function mc(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var kl=null;function wp(e,n,a){if(kl===null){var l=new Map,f=kl=new Map;f.set(a,l)}else f=kl,l=f.get(a),l||(l=new Map,f.set(a,l));if(l.has(e))return l;for(l.set(e,null),a=a.getElementsByTagName(e),f=0;f<a.length;f++){var m=a[f];if(!(m[ya]||m[Lt]||e==="link"&&m.getAttribute("rel")==="stylesheet")&&m.namespaceURI!=="http://www.w3.org/2000/svg"){var x=m.getAttribute(n)||"";x=e+x;var R=l.get(x);R?R.push(m):l.set(x,[m])}}return l}function Cp(e,n,a){e=e.ownerDocument||e,e.head.insertBefore(a,n==="title"?e.querySelector("head > title"):null)}function SS(e,n,a){if(a===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;return n.rel==="stylesheet"?(e=n.disabled,typeof n.precedence=="string"&&e==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 jp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function kS(e,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=ta(l.href),m=n.querySelector(es(f));if(m){n=m._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=wl.bind(e),n.then(e,e)),a.state.loading|=4,a.instance=m,It(m);return}m=n.ownerDocument||n,l=Sp(l),(f=Nn.get(f))&&hc(l,f),m=m.createElement("link"),It(m);var x=m;x._p=new Promise(function(R,L){x.onload=R,x.onerror=L}),Ut(m,"link",l),a.instance=m}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=wl.bind(e),n.addEventListener("load",a),n.addEventListener("error",a))}}var pc=0;function wS(e,n){return e.stylesheets&&e.count===0&&jl(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var l=setTimeout(function(){if(e.stylesheets&&jl(e,e.stylesheets),e.unsuspend){var m=e.unsuspend;e.unsuspend=null,m()}},6e4+n);0<e.imgBytes&&pc===0&&(pc=62500*rS());var f=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&jl(e,e.stylesheets),e.unsuspend)){var m=e.unsuspend;e.unsuspend=null,m()}},(e.imgBytes>pc?50:800)+n);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(f)}}:null}function wl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)jl(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Cl=null;function jl(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Cl=new Map,n.forEach(CS,e),Cl=null,wl.call(e))}function CS(e,n){if(!(n.state.loading&4)){var a=Cl.get(e);if(a)var l=a.get(null);else{a=new Map,Cl.set(e,a);for(var f=e.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=wl.bind(this),f.addEventListener("load",l),f.addEventListener("error",l),m?m.parentNode.insertBefore(f,m.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(f,e.firstChild)),n.state.loading|=4}}var ns={$$typeof:N,Provider:null,Consumer:null,_currentValue:z,_currentValue2:z,_threadCount:0};function jS(e,n,a,l,f,m,x,R,L){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Rt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Rt(0),this.hiddenUpdates=Rt(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 Rp(e,n,a,l,f,m,x,R,L,J,oe,de){return e=new jS(e,n,a,x,L,J,oe,de,R),n=1,m===!0&&(n|=24),m=dn(3,null,null,n),e.current=m,m.stateNode=e,n=Ko(),n.refCount++,e.pooledCache=n,n.refCount++,m.memoizedState={element:l,isDehydrated:a,cache:n},Jo(m),e}function Tp(e){return e?(e=Oi,e):Oi}function Ep(e,n,a,l,f,m){f=Tp(f),l.context===null?l.context=f:l.pendingContext=f,l=Cr(n),l.payload={element:a},m=m===void 0?null:m,m!==null&&(l.callback=m),a=jr(e,l,n),a!==null&&(tn(a,e,n),Ma(a,e,n))}function Np(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<n?a:n}}function gc(e,n){Np(e,n),(e=e.alternate)&&Np(e,n)}function Ap(e){if(e.tag===13||e.tag===31){var n=Zr(e,67108864);n!==null&&tn(n,e,67108864),gc(e,67108864)}}function Ip(e){if(e.tag===13||e.tag===31){var n=gn();n=un(n);var a=Zr(e,n);a!==null&&tn(a,e,n),gc(e,n)}}var Rl=!0;function RS(e,n,a,l){var f=D.T;D.T=null;var m=H.p;try{H.p=2,yc(e,n,a,l)}finally{H.p=m,D.T=f}}function TS(e,n,a,l){var f=D.T;D.T=null;var m=H.p;try{H.p=8,yc(e,n,a,l)}finally{H.p=m,D.T=f}}function yc(e,n,a,l){if(Rl){var f=vc(l);if(f===null)rc(e,n,l,Tl,a),Op(e,l);else if(NS(f,e,n,a,l))l.stopPropagation();else if(Op(e,l),n&4&&-1<ES.indexOf(e)){for(;f!==null;){var m=ki(f);if(m!==null)switch(m.tag){case 3:if(m=m.stateNode,m.current.memoizedState.isDehydrated){var x=ln(m.pendingLanes);if(x!==0){var R=m;for(R.pendingLanes|=2,R.entangledLanes|=2;x;){var L=1<<31-Ae(x);R.entanglements[1]|=L,x&=~L}qn(m),(Qe&6)===0&&(ul=Oe()+500,Qa(0))}}break;case 31:case 13:R=Zr(m,2),R!==null&&tn(R,m,2),dl(),gc(m,2)}if(m=vc(l),m===null&&rc(e,n,l,Tl,a),m===f)break;f=m}f!==null&&l.stopPropagation()}else rc(e,n,l,null,a)}}function vc(e){return e=xo(e),bc(e)}var Tl=null;function bc(e){if(Tl=null,e=Si(e),e!==null){var n=c(e);if(n===null)e=null;else{var a=n.tag;if(a===13){if(e=d(n),e!==null)return e;e=null}else if(a===31){if(e=h(n),e!==null)return e;e=null}else if(a===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return Tl=e,null}function Dp(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch($e()){case le:return 2;case he:return 8;case be:case we:return 32;case Me:return 268435456;default:return 32}default:return 32}}var xc=!1,Lr=null,zr=null,Br=null,rs=new Map,is=new Map,Hr=[],ES="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 Op(e,n){switch(e){case"focusin":case"focusout":Lr=null;break;case"dragenter":case"dragleave":zr=null;break;case"mouseover":case"mouseout":Br=null;break;case"pointerover":case"pointerout":rs.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":is.delete(n.pointerId)}}function as(e,n,a,l,f,m){return e===null||e.nativeEvent!==m?(e={blockedOn:n,domEventName:a,eventSystemFlags:l,nativeEvent:m,targetContainers:[f]},n!==null&&(n=ki(n),n!==null&&Ap(n)),e):(e.eventSystemFlags|=l,n=e.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),e)}function NS(e,n,a,l,f){switch(n){case"focusin":return Lr=as(Lr,e,n,a,l,f),!0;case"dragenter":return zr=as(zr,e,n,a,l,f),!0;case"mouseover":return Br=as(Br,e,n,a,l,f),!0;case"pointerover":var m=f.pointerId;return rs.set(m,as(rs.get(m)||null,e,n,a,l,f)),!0;case"gotpointercapture":return m=f.pointerId,is.set(m,as(is.get(m)||null,e,n,a,l,f)),!0}return!1}function Mp(e){var n=Si(e.target);if(n!==null){var a=c(n);if(a!==null){if(n=a.tag,n===13){if(n=d(a),n!==null){e.blockedOn=n,Yd(e.priority,function(){Ip(a)});return}}else if(n===31){if(n=h(a),n!==null){e.blockedOn=n,Yd(e.priority,function(){Ip(a)});return}}else if(n===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function El(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var a=vc(e.nativeEvent);if(a===null){a=e.nativeEvent;var l=new a.constructor(a.type,a);bo=l,a.target.dispatchEvent(l),bo=null}else return n=ki(a),n!==null&&Ap(n),e.blockedOn=a,!1;n.shift()}return!0}function _p(e,n,a){El(e)&&a.delete(n)}function AS(){xc=!1,Lr!==null&&El(Lr)&&(Lr=null),zr!==null&&El(zr)&&(zr=null),Br!==null&&El(Br)&&(Br=null),rs.forEach(_p),is.forEach(_p)}function Nl(e,n){e.blockedOn===n&&(e.blockedOn=null,xc||(xc=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,AS)))}var Al=null;function Lp(e){Al!==e&&(Al=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Al===e&&(Al=null);for(var n=0;n<e.length;n+=3){var a=e[n],l=e[n+1],f=e[n+2];if(typeof l!="function"){if(bc(l||a)===null)continue;break}var m=ki(a);m!==null&&(e.splice(n,3),n-=3,vu(m,{pending:!0,data:f,method:a.method,action:l},l,f))}}))}function ra(e){function n(L){return Nl(L,e)}Lr!==null&&Nl(Lr,e),zr!==null&&Nl(zr,e),Br!==null&&Nl(Br,e),rs.forEach(n),is.forEach(n);for(var a=0;a<Hr.length;a++){var l=Hr[a];l.blockedOn===e&&(l.blockedOn=null)}for(;0<Hr.length&&(a=Hr[0],a.blockedOn===null);)Mp(a),a.blockedOn===null&&Hr.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(l=0;l<a.length;l+=3){var f=a[l],m=a[l+1],x=f[Xt]||null;if(typeof m=="function")x||Lp(a);else if(x){var R=null;if(m&&m.hasAttribute("formAction")){if(f=m,x=m[Xt]||null)R=x.formAction;else if(bc(f)!==null)continue}else R=x.action;typeof R=="function"?a[l+1]=R:(a.splice(l,3),l-=3),Lp(a)}}}function zp(){function e(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",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),f!==null&&(f(),f=null)}}}function Sc(e){this._internalRoot=e}Il.prototype.render=Sc.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(s(409));var a=n.current,l=gn();Ep(a,l,e,n,null,null)},Il.prototype.unmount=Sc.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;Ep(e.current,2,null,e,null,null),dl(),n[xi]=null}};function Il(e){this._internalRoot=e}Il.prototype.unstable_scheduleHydration=function(e){if(e){var n=Pd();e={blockedOn:null,target:e,priority:n};for(var a=0;a<Hr.length&&n!==0&&n<Hr[a].priority;a++);Hr.splice(a,0,e),a===0&&Mp(e)}};var Bp=r.version;if(Bp!=="19.2.8")throw Error(s(527,Bp,"19.2.8"));H.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(s(188)):(e=Object.keys(e).join(","),Error(s(268,e)));return e=g(n),e=e!==null?v(e):null,e=e===null?null:e.stateNode,e};var IS={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:D,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Dl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Dl.isDisabled&&Dl.supportsFiber)try{Ce=Dl.inject(IS),Te=Dl}catch{}}return ls.createRoot=function(e,n){if(!o(e))throw Error(s(299));var a=!1,l="",f=Vh,m=Ph,x=Yh;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=Rp(e,1,!1,null,null,a,l,null,f,m,x,zp),e[xi]=n.current,nc(e),new Sc(n)},ls.hydrateRoot=function(e,n,a){if(!o(e))throw Error(s(299));var l=!1,f="",m=Vh,x=Ph,R=Yh,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&&(R=a.onRecoverableError),a.formState!==void 0&&(L=a.formState)),n=Rp(e,1,!0,n,a??null,l,f,L,m,x,R,zp),n.context=Tp(null),a=n.current,l=gn(),l=un(l),f=Cr(l),f.callback=null,jr(a,f,l),a=l,n.current.lanes=a,Vt(n,a),qn(n),e[xi]=n.current,nc(e),new Il(n)},ls.version="19.2.8",ls}var Kp;function US(){if(Kp)return Cc.exports;Kp=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(r){console.error(r)}}return t(),Cc.exports=HS(),Cc.exports}var qS=US();function ci(t){if(t==null)return null;if(typeof t=="string")return t.trim()||null;if(typeof t=="number"||typeof t=="boolean")return String(t);if(typeof t=="object"){const r=t;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 $S(t){const r=ci(t.at)??ci(t.timestamp)??ci(t.recordedAt)??"",i=ci(t.errorMessage)??ci(t.label)??ci(t.type)??ci(t.message)??"运行事件";return r?`${r} · ${i}`:i}function fs(t){return String(t.nodeId??t.id??"").trim()}function Ec(t){const r=fs(t);return String(t.label??t.name??(r||"未命名节点"))}function Xp(t,r){if(t.length===0)return;const i=r?.trim();if(i){const c=t.find(d=>fs(d)===i);if(c)return c}const s=t.find(c=>{const d=String(c.status??"").toLowerCase();return d.includes("fail")||d.includes("error")||d==="blocked"});return s||(t.find(c=>{const d=String(c.status??"").toLowerCase();return d==="running"||d==="in_progress"||d==="active"})??t[0])}function GS({dagRunId:t,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 j=I=>{I.key==="Escape"&&i()};return document.addEventListener("keydown",j),document.title=`检视 · DAG ${t} · Loop Operator`,()=>document.removeEventListener("keydown",j)},[t,i]),S.useEffect(()=>{const j=new AbortController;return k(!0),v(null),p([]),(async()=>{try{const I=await fetch(`/api/dag-runs/${encodeURIComponent(t)}`,{signal:j.signal,credentials:"same-origin"});if(!I.ok)throw new Error(`DAG 查询失败(HTTP ${I.status})`);const N=await I.json();if(j.signal.aborted)return;d(N);const F=Array.isArray(N.nodes)?N.nodes:[],X=Xp(F,r),O=X?fs(X):r?.trim();if(O){const Y=await fetch(`/api/dag-runs/${encodeURIComponent(t)}/nodes/${encodeURIComponent(O)}/session-events`,{signal:j.signal,credentials:"same-origin"});if(Y.ok){const V=await Y.json();j.signal.aborted||p((V.events??[]).slice(-20))}}}catch(I){j.signal.aborted||v(I instanceof Error?I.message:String(I))}finally{j.signal.aborted||k(!1)}})(),()=>j.abort()},[t,r]);const b=S.useMemo(()=>Array.isArray(c?.nodes)?c.nodes:[],[c]),w=Xp(b,r),E=w?fs(w):"",B=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:t})}),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:B})]}),u.jsxs("div",{children:[u.jsx("dt",{children:"当前节点"}),u.jsx("dd",{children:w?Ec(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(j=>{const I=fs(j)||Ec(j),N=I===E;return u.jsxs("li",{"data-active":N?"true":void 0,className:N?"is-active":void 0,children:[u.jsx("span",{children:Ec(j)}),u.jsx("code",{children:j.status??"—"})]},I)})}):u.jsx("p",{className:"muted",children:y?"加载节点中…":"该运行暂无节点。"})]}),u.jsxs("section",{children:[u.jsxs("h3",{children:["最近事件",E?` · ${E}`:""]}),h.length?u.jsx("ul",{className:"inspect-split-events",children:h.map((j,I)=>u.jsx("li",{children:$S(j)},`${j.at??I}-${I}`))}):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 FS(t){const{board:r,busy:i}=t;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 Ol(t){return!t||typeof t!="object"||Array.isArray(t)?null:t}function yt(t,r){const i=t[r];return typeof i=="string"&&i.trim()?i.trim():void 0}function Qp(t,r){const i=t[r];if(!Array.isArray(i))return;const s=i.filter(o=>typeof o=="string");return s.length>0?s:void 0}function VS(t){const r=Ol(t);if(!r)return null;const i=Ol(r.result),s=[Ol(r.reviewPacket),i?Ol(i.reviewPacket):null,i,r].filter(Boolean);for(const o of s){const c=yt(o,"scheduleId")??yt(o,"id"),d=yt(o,"gateToken")??yt(o,"approveGate")??yt(o,"writeSetGateToken");if(!(!c||!d))return{scheduleId:c,gateToken:d,...yt(o,"featureId")?{featureId:yt(o,"featureId")}:{},...yt(o,"taskId")?{taskId:yt(o,"taskId")}:{},...Qp(o,"writeSet")?{writeSet:Qp(o,"writeSet")}:{},...yt(o,"worktreePath")?{worktreePath:yt(o,"worktreePath")}:{},...yt(o,"branch")?{branch:yt(o,"branch")}:{},...yt(o,"baseBranch")?{baseBranch:yt(o,"baseBranch")}:{},...yt(o,"baseCommit")?{baseCommit:yt(o,"baseCommit")}:{},...yt(o,"executeAtUtc")?{executeAtUtc:yt(o,"executeAtUtc")}:{},...yt(o,"taskCard")?{taskCard:yt(o,"taskCard")}:{}}}return null}function Zp(t){return`docs/features/${t.trim().replace(/^\/+|\/+$/g,"")}`}function PS(t){const r=t.trim(),i=/^(\d{4}-\d{2}-\d{2})[T ](\d{2}:\d{2})/.exec(r);return i?`${i[1]} ${i[2]}`:null}function Jp(){const t=new Date;t.setHours(20,0,0,0);const r=i=>String(i).padStart(2,"0");return`${t.getFullYear()}-${r(t.getMonth()+1)}-${r(t.getDate())}T${r(t.getHours())}:${r(t.getMinutes())}`}function wy(t){if(!t)return"—";const r=Date.parse(t);if(Number.isNaN(r))return t;try{return new Intl.DateTimeFormat("zh-CN",{dateStyle:"short",timeStyle:"short",timeZone:"Asia/Shanghai"}).format(new Date(r))}catch{return t}}function YS(t){return t.mergeState==="pending-harvest"||/\bscheduler harvest\b/i.test(t.nextAction)}function KS(t){return t.status==="failed"||t.status==="human_required"||t.status==="cancelled"||/\bscheduler discard\b/i.test(t.nextAction)}function ql(t){return t==="failed"||t==="human_required"}function XS(t){return`${t}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function Cy(t){return{submitted:"已提交",validating:"校验中",validated:"待预约确认",scheduled:"已预约",waiting:"等待触发",dispatching:"派发中",running:"执行中",succeeded:"成功",failed:"失败",human_required:"需人工",cancelled:"已取消",rejected:"已拒绝",cancel_requested:"取消中"}[t]??t}function QS(t){const{target:r,reason:i,onReasonChange:s,force:o,onForceChange:c,busy:d}=t;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,"(",Cy(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)})]}),ql(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||ql(r.status)&&!o,"data-testid":"night-discard-confirm",onClick:t.onConfirm,children:"确认 Discard"}),u.jsx("button",{type:"button",className:"btn btn-secondary",disabled:d,onClick:t.onCancel,children:"返回"})]})]})}function ZS(t){const{board:r}=t,{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 JS(t){const{board:r,busy:i,onHarvest:s,onOpenDiscard:o}=t,{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:Cy(d.status)})]}),u.jsxs("p",{className:"muted",children:["执行 ",wy(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:[YS(d)?u.jsx("button",{type:"button",className:"btn btn-primary",disabled:i,"data-testid":"night-row-harvest",onClick:()=>s(d),children:"Harvest"}):null,KS(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 WS(t){const{wizard:r,busy:i}=t;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:wy(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 e0(t){const{setOpError:r}=t,[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,E]=S.useState(null),[B,j]=S.useState(null),I=S.useCallback(async()=>{y(!0),g(null);try{const[O,Y,V,ae]=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 M=await O.json();if(s(M),Y.ok?c(await Y.json()):c(null),V.ok){const P=await V.json();h(Array.isArray(P)?P:[])}else h([]);if(ae.ok){const P=await ae.json();P.ticker&&j(P.ticker)}}catch(O){g(O instanceof Error?O.message:String(O))}finally{y(!1)}},[]);S.useEffect(()=>{I()},[I]);const N=S.useCallback(async()=>{try{const O=await fetch("/api/night-jobs/morning",{credentials:"same-origin"});if(!O.ok){r(`早晨报告加载失败(HTTP ${O.status})`);return}const Y=await O.json();E(JSON.stringify(Y,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"),X=(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:B,refreshBoard:I,onMorningReport:N,doctorIssues:F,clockHint:X}}function t0(t){const{board:r,runAction:i,isActionSuccess:s,setOpError:o}=t,{tasks:c,refreshBoard:d}=r,[h,p]=S.useState("pick"),[g,v]=S.useState(""),[y,k]=S.useState(Jp),[b,w]=S.useState(""),[E,B]=S.useState(null),[j,I]=S.useState(""),[N,F]=S.useState(null),[X,O]=S.useState(!1),Y=S.useMemo(()=>{const H=c.filter(z=>typeof z.featureId=="string"&&z.featureId.trim()&&z.taskId);return H.sort((z,ne)=>{const T=z.featureId??"",A=ne.featureId??"";return T!==A?T.localeCompare(A):z.taskId.localeCompare(ne.taskId)}),H},[c]),V=S.useMemo(()=>g?Y.find(H=>`${H.featureId}::${H.taskId}`===g)??null:null,[Y,g]),ae=V?.featureId?Zp(V.featureId):"",M=S.useCallback(async(H,z,ne)=>{const T=await i("prepareMutationGate",{action:H,actionParams:z});if(!s(T))return;const A=T?.result??T,U=A.receiptId?A:A.result??A;if(!U.receiptId||!U.humanGateToken){o("prepareMutationGate 未返回可消费的 Human Gate receipt");return}return i(H,{...z,confirmationId:U.receiptId,humanGateToken:U.humanGateToken},{clientRequestId:XS(ne)})},[s,i,o]),P=S.useCallback(async()=>{if(!V?.featureId){o("请先点选 Feature / Task");return}const H=PS(y);if(!H){o("执行时间格式无效,请使用日期时间选择器");return}const z={featureDir:Zp(V.featureId),taskId:V.taskId,at:H,tz:"Asia/Shanghai",...b.trim()?{taskCard:b.trim()}:{}},ne=await M("workerAdmissionPrepare",z,"night-prepare");if(!s(ne))return;const T=VS(ne?.result??ne);if(!T){o("准备成功但未解析到 scheduleId / gateToken。请刷新后重试,或查看 Inspect。");return}B(T),p("review")},[s,y,M,V,o,b]),$=S.useCallback(async()=>{if(!E)return;const H=await M("workerSchedulerAdd",{scheduleId:E.scheduleId,approveGate:E.gateToken},"night-add");s(H)&&(B(null),p("pick"),v(""),w(""),k(Jp()),await d())},[s,d,E,M]),te=S.useCallback(()=>{p("pick"),B(null)},[]),G=S.useCallback(async H=>{const z=await M("workerSchedulerHarvest",{scheduleId:H.scheduleId},"night-harvest");s(z)&&await d()},[s,d,M]),_=S.useCallback(async()=>{if(!N)return;const H=j.trim()||"discard from console night workbench",z=ql(N.status),ne=await M("workerSchedulerDiscard",{scheduleId:N.scheduleId,reason:H,...z||X?{force:!0}:{}},"night-discard");s(ne)&&(F(null),I(""),O(!1),await d())},[j,N,X,s,d,M]),D=S.useCallback(H=>{F(H),O(ql(H.status)),I("")},[]);return{phase:h,selectedKey:g,setSelectedKey:v,nightAt:y,setNightAt:k,taskCard:b,setTaskCard:w,review:E,discardReason:j,setDiscardReason:I,discardTarget:N,setDiscardTarget:F,forceDiscard:X,setForceDiscard:O,selectableTasks:Y,derivedFeatureDir:ae,onPrepare:P,onConfirmAdd:$,onCancelWizard:te,onHarvest:G,onDiscard:_,openDiscard:D}}function n0({busy:t,runAction:r,isActionSuccess:i,setOpError:s}){const o=e0({setOpError:s}),c=t0({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(ZS,{board:o,busy:t}),u.jsx("div",{className:"cta-row",children:u.jsx("button",{type:"button",className:"btn btn-secondary",disabled:t||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(JS,{board:o,busy:t,onHarvest:d=>{c.onHarvest(d)},onOpenDiscard:c.openDiscard}),c.discardTarget?u.jsx(QS,{target:c.discardTarget,reason:c.discardReason,onReasonChange:c.setDiscardReason,force:c.forceDiscard,onForceChange:c.setForceDiscard,busy:t,onConfirm:()=>{c.onDiscard()},onCancel:()=>c.setDiscardTarget(null)}):null,u.jsx(WS,{wizard:c,busy:t}),u.jsx(FS,{board:o,busy:t})]})}var jy=ky();const r0=({color:t="currentColor",size:r=24,className:i,...s})=>Fr.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:t,...s,className:"remixicon "+(i||"")},Fr.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"})),i0=({color:t="currentColor",size:r=24,className:i,...s})=>Fr.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:t,...s,className:"remixicon "+(i||"")},Fr.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"})),a0=({color:t="currentColor",size:r=24,className:i,...s})=>Fr.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:t,...s,className:"remixicon "+(i||"")},Fr.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"})),s0=({color:t="currentColor",size:r=24,className:i,...s})=>Fr.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:t,...s,className:"remixicon "+(i||"")},Fr.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"})),l0=["command","query","operation","tool","server","symbol","path","file_path","filePath","pattern","glob","url"],o0=120,u0=800;function $l(t){if(!(!t||typeof t!="object"||Array.isArray(t)))return t}function c0(t){if(t!=null){if(typeof t=="string"){const r=t.trim();if(!r)return;try{return $l(JSON.parse(r))}catch{return}}return $l(t)}}function hr(t,r){const i=t.replace(/\s+/g," ").trim();return i?i.length>r?`${i.slice(0,r)}…`:i:""}function Et(t,r){const i=t[r];if(typeof i=="string"&&i.trim())return i.trim();if(typeof i=="number"&&Number.isFinite(i))return String(i)}function d0(t,r,i){const s=(t??"").toLowerCase();if(s==="bash"||s==="shell"){const o=Et(r,"command");return o?hr(o,i):void 0}if(s==="mcp"||s.startsWith("mcp_")){const o=Et(r,"server"),c=Et(r,"tool")??Et(r,"name"),d=Et(r,"query");return o&&c?hr(`${o} · ${c}`,i):c?hr(c,i):d?hr(d,i):o?hr(o,i):void 0}if(s==="lsp_navigation"||s.includes("lsp")){const o=[Et(r,"operation"),Et(r,"symbol"),Et(r,"path")??Et(r,"file_path")??Et(r,"filePath")].filter(Boolean),c=Et(r,"line")??Et(r,"position");if(o.length===0&&!c)return;const d=o.join(" · ");return hr(c?`${d}${d?":":""}${c}`:d,i)}if(s==="symbol_search"||s.includes("symbol_search")){const o=Et(r,"query")??Et(r,"symbol");return o?hr(o,i):void 0}if(s==="read"||s==="read_symbol"||s==="read_enclosing"||s.startsWith("read_")){const o=Et(r,"path")??Et(r,"file_path")??Et(r,"filePath"),c=Et(r,"symbol"),d=Et(r,"line");if(!o&&!c)return;const h=[o,c,d].filter(Boolean);return hr(h.join(" · "),i)}}function f0(t,r){const i=r?.maxLen??o0,s=c0(t);if(!s){if(typeof t=="string"){const p=t.replace(/\s+/g," ").trim();return!p||p==="{}"?"":p.length>i?`${p.slice(0,i)}…`:p}return""}const o=d0(r?.toolName,s,i);if(o)return o;for(const p of l0){const g=s[p];if(typeof g=="string"&&g.trim())return hr(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 h0(t){const r=(t??"").toLowerCase();return r==="bash"||r==="shell"?{argsLabel:"命令",resultLabel:"输出"}:r==="mcp"||r.startsWith("mcp_")?{argsLabel:"参数",resultLabel:"结果"}:{argsLabel:"入参",resultLabel:"结果"}}function Ry(t){if(t==null)return"";if(typeof t=="string"){const s=t.trim();if(!s)return"";if(s.startsWith("{")&&s.endsWith("}")||s.startsWith("[")&&s.endsWith("]"))try{return Ry(JSON.parse(s))}catch{return t}return t}if(typeof t=="number"||typeof t=="boolean")return String(t);const r=$l(t);if(!r)try{return JSON.stringify(t,null,2)}catch{return String(t)}const i=r.content;if(Array.isArray(i)){const s=[];for(const o of i){const c=$l(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(t,null,2)}catch{return String(t)}}function m0(t){if(t==null)return"";try{return typeof t=="string"?t:JSON.stringify(t,null,2)}catch{return String(t)}}function p0(t,r){if(t===void 0)return{text:"",truncated:!1};const i=r?.maxLen??u0;return t.length<=i?{text:t,truncated:!1}:{text:`${t.slice(0,i)}…`,truncated:!0}}function g0(t,r){if(r===void 0||!Number.isFinite(t)||!Number.isFinite(r))return;const i=Math.round((r-t)/1e3);return i>0?i:void 0}function rn(){return window.__CONSOLE_CONFIRMATION_TOKEN__??""}function hi(t){return`${t}-${Math.random().toString(36).slice(2,10)}`}function Nc(t,r){return new Promise((i,s)=>{if(r?.aborted){s(new DOMException("Aborted","AbortError"));return}const o=setTimeout(()=>{r?.removeEventListener("abort",c),i()},t),c=()=>{clearTimeout(o),s(new DOMException("Aborted","AbortError"))};r?.addEventListener("abort",c)})}function Ty(t){return new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function Ac(t){const r=new Date(t),i=new Date;return r.getFullYear()===i.getFullYear()&&r.getMonth()===i.getMonth()&&r.getDate()===i.getDate()?"今天":r.toLocaleDateString([],{month:"long",day:"numeric"})}function y0(t,r){return t?t.taskId===r.taskId&&t.updatedAt===r.updatedAt&&t.lastEventId===r.lastEventId&&t.operations.length===r.operations.length:!1}const Ey={status:"idle",snapshot:null,error:null,reloading:!1,reloadError:null,mutationBusy:!1,mutationToken:null};function xd(t){if(!t||typeof t!="object")return{message:"runtime snapshot request failed"};const r=t,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 v0(t,r){switch(r.type){case"load-start":return{...t,sessionId:r.sessionId,status:"loading",error:null};case"load-success":return t.snapshot&&t.sessionId===r.sessionId&&r.snapshot.revision<t.snapshot.revision?t:{...t,sessionId:r.sessionId,status:"ready",snapshot:r.snapshot,error:null,reloadError:null,reloading:!1};case"load-failure":return{...t,sessionId:r.sessionId,status:"error",error:r.error,snapshot:null};case"reload-start":return t.reloading?t:{...t,reloading:!0,reloadError:null,...t.status==="error"?{error:null}:{}};case"reload-success":return{...t,status:"ready",snapshot:r.snapshot,reloading:!1,reloadError:null,error:null,sessionId:r.snapshot.sessionId||t.sessionId};case"reload-failure":return{...t,reloading:!1,reloadError:r.error};case"mutation-start":return{...t,mutationBusy:!0,mutationToken:r.token};case"mutation-adopt":return t.mutationToken!==r.token||t.sessionId!==void 0&&t.sessionId!==r.sessionId||t.snapshot&&r.snapshot.revision<t.snapshot.revision?t:{...t,sessionId:r.sessionId,status:"ready",snapshot:r.snapshot,error:null,reloadError:null,reloading:!1};case"mutation-settle":return t.mutationToken!==r.token?t:{...t,mutationBusy:!1,mutationToken:null};case"mutation-reset":return{...t,mutationBusy:!1,mutationToken:null};case"reset":return{...Ey};default:return t}}function Ny(t){const r=t.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 b0(t,r,i,s){const o=i&&i.sessionId===s?Ny(i):{},c=o.model??t?.model,d=o.thinkingLevel??t?.thinkingLevel;return{readOnly:r.readOnly,systemPrompt:r.systemPrompt,resources:r.resources,suffix:r.suffix,...c?{model:c}:{},...d?{thinkingLevel:d}:{}}}function x0(t=Ey){let r=t;const i=new Set;return{getState:()=>r,dispatch:s=>{r=v0(r,s);for(const o of i)o();return r},subscribe:s=>(i.add(s),()=>i.delete(s))}}const mt=x0();let Gr;function Ay(t){return`/api/operator/v1/chat/sessions/${encodeURIComponent(t)}`}function S0(t){const r=Gr;if(Gr=t,!(r&&r.sessionId===t.sessionId&&r.origin===t.origin)){if((!r||r.sessionId!==t.sessionId)&&mt.dispatch({type:"mutation-reset"}),!t.sessionId){mt.dispatch({type:"reset"});return}mt.dispatch({type:"load-start",sessionId:t.sessionId}),Iy(t.sessionId,t.origin)}}async function Iy(t,r){try{const i=await fetch(`${r}${Ay(t)}/runtime-snapshot`,{credentials:"include"}),s=await i.json().catch(()=>({}));if(Gr?.sessionId!==t)return;if(!i.ok){mt.dispatch({type:"load-failure",sessionId:t,error:{...xd(s),status:i.status}});return}if(!s.snapshot){mt.dispatch({type:"load-failure",sessionId:t,error:{status:i.status,message:"runtime snapshot missing in response"}});return}mt.dispatch({type:"load-success",sessionId:t,snapshot:s.snapshot})}catch(i){if(Gr?.sessionId!==t)return;mt.dispatch({type:"load-failure",sessionId:t,error:{message:i instanceof Error?i.message:String(i)}})}}async function ua(){const t=Gr;if(!t?.sessionId||mt.getState().reloading)return!1;const r=t.sessionId;mt.dispatch({type:"reload-start"});try{const i=await fetch(`${t.origin}${Ay(r)}/reload`,{method:"POST",credentials:"include",headers:{"content-type":"application/json","x-loop-console-confirmation":rn()},body:"{}"}),s=await i.json().catch(()=>({}));return Gr?.sessionId!==r?!1:i.ok?s.snapshot?(mt.dispatch({type:"reload-success",snapshot:s.snapshot}),!0):(mt.dispatch({type:"reload-failure",error:{status:i.status,message:"reload succeeded but snapshot missing"}}),!1):(mt.dispatch({type:"reload-failure",error:{...xd(s),status:i.status}}),!1)}catch(i){return Gr?.sessionId!==r||mt.dispatch({type:"reload-failure",error:{message:i instanceof Error?i.message:String(i)}}),!1}}async function ca(){const t=Gr;if(!t?.sessionId)return!1;const r=t.sessionId;return mt.dispatch({type:"load-start",sessionId:r}),Iy(r,t.origin),!0}function k0(t,r,i){return i?(mt.dispatch({type:"mutation-adopt",token:t,sessionId:r,snapshot:i}),mt.getState().snapshot===i):!1}function w0(t,r,i){return i.sessionRef.current?.sessionId!==r||mt.getState().mutationToken!==t?!1:(mt.dispatch({type:"mutation-settle",token:t}),!0)}function fa(){return S.useSyncExternalStore(mt.subscribe,mt.getState)}function Dy(t){mt.dispatch(t)}function C0(){return mt.getState()}function j0(t,r,i){return`${t}/api/operator/v1/chat/sessions/${encodeURIComponent(r)}/skills/${encodeURIComponent(i)}/auto-invocation`}async function R0(t){const r=t.fetchImpl??fetch;try{const i=await r(j0(t.origin,t.sessionId,t.resourceId),{method:"PATCH",credentials:"include",headers:{"content-type":"application/json","x-loop-console-confirmation":t.confirmationToken},body:JSON.stringify({autoInvocationEnabled:t.autoInvocationEnabled})}),s=await i.json().catch(()=>({}));if(!i.ok||s.ok===!1)return{ok:!1,error:{...xd(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 T0(t){return t.autoInvocationEnabled?{badge:"允许自动使用",help:"模型可自动选择该技能,也可通过 /skill:<name> 手动调用。"}:{badge:"已隐藏自动使用",help:`已从模型自动技能列表隐藏,仍可通过 /skill:${t.name} 手动调用。`}}const td=()=>window.__CONSOLE_CONFIRMATION_TOKEN__??"";function E0({origin:t}){const[r,i]=S.useState(null),[s,o]=S.useState(null),[c,d]=S.useState(null),[h,p]=S.useState(!1),g=fa(),v=g.snapshot,y=g.reloading,k=g.reloadError,b=v?.diagnostics??[],w=async I=>{i(I),d(null);{o(null);try{const N=await fetch(`${t}/api/operator/v1/pi/models-config`,{credentials:"include"}),F=await N.json();if(!N.ok)throw new Error(F.error?.message??"读取失败");o(F.data)}catch(N){d(N instanceof Error?N.message:String(N))}}},E=async I=>{p(!0),d(null);try{const N=await fetch(`${t}/api/operator/v1/pi/models-config`,{method:"PATCH",credentials:"include",headers:{"content-type":"application/json","x-loop-console-confirmation":td()},body:JSON.stringify(I)}),F=await N.json();if(!N.ok)throw new Error(F.error?.message??"模型配置保存失败");o(F.data)}catch(N){d(N instanceof Error?N.message:String(N))}finally{p(!1)}},B=async(I,N)=>{p(!0),d(null);try{const F=await fetch(`${t}/api/operator/v1/pi/models-config/test`,{method:"POST",credentials:"include",headers:{"content-type":"application/json","x-loop-console-confirmation":td()},body:JSON.stringify({provider:I,modelId:N})}),X=await F.json();if(!F.ok)throw new Error(X.error?.message??"模型测试失败");return X.data?.available===!0}catch(F){return d(F instanceof Error?F.message:String(F)),!1}finally{p(!1)}},j=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:I=>{I.target===I.currentTarget&&i(null)},children:u.jsxs("section",{className:"oc-resource-panel",role:"dialog","aria-modal":"true","aria-label":j,children:[u.jsxs("header",{className:"oc-resource-panel-head",children:[u.jsxs("div",{className:"oc-resource-panel-head-copy",children:[u.jsx("strong",{children:j}),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((I,N)=>u.jsx("div",{className:`oc-resource-diagnostic${I.type==="error"?" is-error":""}`,role:I.type==="error"?"alert":void 0,children:u.jsxs("span",{children:[I.type,I.code?` ${I.code}`:"",":",I.message,I.path?`(${I.path})`:"",I.retryable?" · 可重试":""]})},N)),u.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>{ca()},children:"重试"})]}),c&&u.jsx("p",{className:"oc-resource-error",children:c}),r==="models"&&u.jsx(N0,{busy:h,data:s,onMutate:E,onTest:B}),r==="skills"&&u.jsx(A0,{origin:t,sessionId:v?.sessionId,status:g.status,loadError:g.error,skills:v?.skills,hasSession:!!v?.sessionId,hasDiagnostics:b.length>0}),r==="packages"&&u.jsx(O0,{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:()=>{ua()},children:"重试"}),g.status==="error"&&u.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>{ca()},children:"重新读取快照"}),u.jsx("button",{type:"button",className:"btn btn-ghost",disabled:y,onClick:()=>{ua()},children:"重新加载会话"})]})]})]})})]})}function N0({busy:t,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:t,onClick:()=>{s(b.name,w.id).then(E=>y(`${b.name}/${w.id}: ${E?"可用":"不可用"}`))},children:"测试"}),u.jsx("button",{type:"button",disabled:t,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:t,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:t,children:t?"保存中…":"保存模型"})]})]}):u.jsx("p",{className:"oc-resource-empty",children:"正在读取模型配置…"})}function Oy(t){return t.status==="loading"?u.jsx("p",{className:"oc-resource-empty",children:"会话快照加载中…"}):t.status==="error"?u.jsxs("div",{className:"oc-resource-error",role:"alert",children:[u.jsxs("span",{children:[t.loadError?.code?`${t.loadError.code}:`:"",t.loadError?.message??"会话快照读取失败"]}),u.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>{ca()},children:"重试"})]}):t.hasSession?u.jsx("p",{className:"oc-resource-empty",children:t.emptyText}):u.jsx("p",{className:"oc-resource-empty",children:"当前没有活动会话;打开会话后显示真实资源清单(真实空态)。"})}function A0(t){const r=t.skills??[],[i,s]=S.useState(null),[o,c]=S.useState(null),[d,h]=S.useState(null),[p,g]=S.useState({});if(t.status!=="ready"||!t.hasSession)return u.jsx(Oy,{status:t.status,loadError:t.loadError,hasSession:t.hasSession,emptyText:"当前 session 未加载任何 Skills(真实空态)"});if(r.length===0&&!t.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",E=v.get(w)??[];E.push(b),v.set(w,E)}const y=b=>Object.prototype.hasOwnProperty.call(p,b.resourceId)?p[b.resourceId]:b.autoInvocationEnabled,k=async(b,w)=>{if(!t.sessionId||!b.resourceId||i)return;y(b),c(null),h(null),s(b.resourceId),g(B=>({...B,[b.resourceId]:w}));const E=await R0({origin:t.origin,sessionId:t.sessionId,resourceId:b.resourceId,autoInvocationEnabled:w,confirmationToken:td()});if(s(null),!E.ok){g(B=>{const j={...B};return delete j[b.resourceId],j}),c(`${E.error.code?`${E.error.code}:`:""}${E.error.message}`);return}if(E.reloadApplied&&E.snapshot){Dy({type:"load-success",sessionId:t.sessionId,snapshot:E.snapshot}),g(B=>{const j={...B};return delete j[b.resourceId],j}),h(null);return}!E.reloadApplied&&E.partialBusy&&h(`设置已保存;当前会话正忙(${E.partialBusy.code}),请在本轮结束后点击「重新加载会话」。${E.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(E=>{const B=y(E),j=T0({name:E.name,autoInvocationEnabled:B}),I=i===E.resourceId;return u.jsxs("li",{className:`oc-resource-item${B?"":" is-auto-off"}`,children:[u.jsxs("div",{className:"oc-resource-item-head",children:[u.jsx("strong",{children:E.name}),u.jsx("span",{children:j.badge})]}),u.jsxs("label",{className:"oc-skill-auto-toggle",children:[u.jsx("input",{type:"checkbox",checked:B,disabled:I||!E.resourceId,"aria-label":`允许自动使用 ${E.name}`,onChange:N=>{k(E,N.target.checked)}}),u.jsx("span",{children:I?"保存中…":"允许自动使用"})]}),u.jsx("p",{className:"oc-skill-auto-help",children:j.help}),E.description?u.jsx("p",{children:E.description}):null,u.jsx("code",{children:E.path}),E.source?u.jsxs("span",{className:"oc-resource-panel-meta",children:["source: ",E.source]}):null,Array.isArray(E.diagnostics)&&E.diagnostics.length>0?u.jsx("span",{className:"oc-resource-diagnostic",children:E.diagnostics.join(";")}):null]},`${b}:${E.resourceId||E.path}`)})})]},b))]})}const I0={extension:"Extensions",skill:"Skills",prompt:"Prompts",theme:"Themes"};function D0(t){return Array.isArray(t.diagnostics)&&t.diagnostics.length>0?"error":t.enabled?t.version?"installed":"loaded":"disabled"}function O0(t){const r=t.packages??[];return t.status!=="ready"||!t.hasSession?u.jsx(Oy,{status:t.status,loadError:t.loadError,hasSession:t.hasSession,emptyText:"当前 session 未配置 Packages(真实空态)"}):r.length===0&&!t.hasDiagnostics?u.jsx("p",{className:"oc-resource-empty",children:"当前 session 未配置 Packages(真实空态,未伪造列表)。"}):u.jsx("div",{className:"oc-resource-lists",children:r.map(i=>{const s=D0(i),o=new Map;for(const c of i.resolved??[]){const d=I0[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 Gl=10,My="loop-console.operator-chat.sidebar-split.v1",gi=45,no=28,ro=70,Wp=5,eg=10;function oa(t){return Number.isFinite(t)?Math.min(ro,Math.max(no,Math.round(t))):gi}function M0(t){if(t==null||t==="")return null;const r=Number(t);if(!Number.isFinite(r))return null;const i=Math.round(r);return i<no||i>ro?null:i}function _0(t=_y()){if(!t)return gi;try{return M0(t.getItem(My))??gi}catch{return gi}}function tg(t,r=_y()){const i=oa(t);if(!r)return i;try{r.setItem(My,String(i))}catch{}return i}function L0(t,r,i=!1){const s=oa(t);switch(r){case"ArrowUp":return oa(s-(i?eg:Wp));case"ArrowDown":return oa(s+(i?eg:Wp));case"Home":return no;case"End":return ro;case"Enter":return gi;default:return null}}function ng(t,r,i){if(!Number.isFinite(i)||i<=0)return gi;const s=(t-r)/i;return oa(s*100)}function _y(){try{return typeof globalThis>"u"?null:globalThis.localStorage??null}catch{return null}}const rg='a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]),select:not([disabled]),[tabindex]:not([tabindex="-1"])';function io(t){const{open:r,containerRef:i,triggerRef:s,onEscape:o}=t,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(rg)??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(rg)).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 z0(t){const{item:r,active:i,state:s,deleteConfirming:o,deleting:c}=t,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=j=>{if(!(j.scrollWidth>j.clientWidth+1)){b();return}const N=j.getBoundingClientRect(),F=12,X=Math.min(360,window.innerWidth-F*2),O=N.left,Y=Math.max(F,Math.min(O,window.innerWidth-F-X));v({x:Y,y:N.top+N.height/2})},E=j=>{j&&(k(),y.current=window.setTimeout(()=>w(j),350))};S.useEffect(()=>{const j=()=>b(),I=N=>{N.key==="Escape"&&b()};return window.addEventListener("scroll",j,!0),window.addEventListener("keydown",I),()=>{window.removeEventListener("scroll",j,!0),window.removeEventListener("keydown",I),k()}},[]),S.useEffect(()=>{o&&p.current?.focus()},[o]);const B=`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:t.onActivate,onMouseEnter:j=>{const I=j.currentTarget.querySelector("strong");I instanceof HTMLElement&&E(I)},onMouseLeave:b,onFocus:j=>{const I=j.currentTarget.querySelector("strong");I instanceof HTMLElement&&E(I)},onBlur:b,"aria-describedby":g?B: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:j=>{j.stopPropagation(),t.onConfirmDelete()},children:c?"删除中…":"删除"}),u.jsx("button",{type:"button",className:"oc-session-delete-cancel",disabled:c,"aria-label":"取消删除会话",onClick:j=>{j.stopPropagation(),t.onCancelDelete()},children:"取消"})]}):u.jsxs(u.Fragment,{children:[u.jsx("button",{type:"button",className:"oc-session-menu",title:"重命名会话","aria-label":"重命名会话",onClick:j=>{j.stopPropagation();const I=window.prompt("会话名称",r.title??"");I!==null&&t.onRename(I)},children:u.jsx(a0,{size:16,"aria-hidden":"true"})}),u.jsx("button",{type:"button",className:"oc-session-menu",title:s==="active"?"归档会话":"恢复会话","aria-label":s==="active"?"归档会话":"恢复会话",onClick:j=>{j.stopPropagation(),t.onSetState(s==="active"?"archived":"active")},children:s==="active"?u.jsx(r0,{size:16,"aria-hidden":"true"}):u.jsx(s0,{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:j=>{j.stopPropagation(),t.onRequestDelete()},children:u.jsx(i0,{size:16,"aria-hidden":"true"})})]})}),g?jy.createPortal(u.jsx("div",{id:B,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 B0(t){return[...t].sort((r,i)=>r.kind!==i.kind?r.kind==="directory"?-1:1:r.name.localeCompare(i.name,void 0,{sensitivity:"base"}))}function H0({open:t}){return u.jsx("svg",{className:`oc-tree-chevron${t?" 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 U0({open:t}){return t?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 q0(){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 $0(){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 G0(){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 F0(){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 V0(t){const r=t.sessions.slice(0,Gl),[i,s]=S.useState(()=>_0()),[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=t.layoutMode==="comfortable"&&t.open,w=t.layoutMode==="compact",E=t.drawerOpen&&(t.layoutMode==="compact"||t.layoutMode==="narrow"),B=S.useCallback((te=!0)=>{if(p)return;const G=d;h(null),!(!te||!G)&&window.requestAnimationFrame(()=>{const _=typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(G):G.replace(/["\\]/g,"\\$&");document.querySelector(`[data-session-delete-id="${_}"]`)?.focus()})},[p,d]),j=S.useCallback(()=>{p||(h(null),t.onCloseDrawer())},[p,t.onCloseDrawer]),I=S.useCallback(()=>{if(d){B();return}j()},[B,j,d]);io({open:E,containerRef:y,triggerRef:t.drawerTriggerRef,onEscape:I}),S.useEffect(()=>{k.current&&!E&&!p&&h(null),k.current=E},[p,E]),S.useEffect(()=>{if(E||!d)return;const te=G=>{G.key==="Escape"&&(G.preventDefault(),B())};return document.addEventListener("keydown",te),()=>document.removeEventListener("keydown",te)},[B,d,E]),S.useEffect(()=>{d&&!r.some(te=>te.sessionId===d)&&h(null),p&&!r.some(te=>te.sessionId===p)&&g(null)},[p,d,r]);const N=S.useCallback(async te=>{if(!(p||d!==te)){g(te);try{await t.onDelete(te)}finally{g(null),h(null)}}},[p,d,t.onDelete]),F=S.useCallback(()=>{p||(B(!1),t.onCreate())},[B,p,t.onCreate]),X=S.useCallback(()=>{p||(B(!1),t.onToggleOpen())},[B,p,t.onToggleOpen]),O=S.useCallback((te,G)=>{const _=oa(te);s(_),G&&tg(_)},[]),Y=S.useCallback(te=>{const G=L0(i,te.key,te.shiftKey);G!=null&&(te.preventDefault(),O(G,!0))},[O,i]),V=S.useCallback(te=>{te.preventDefault(),te.currentTarget.setPointerCapture(te.pointerId),c(!0);const _=v.current;if(!_)return;const D=_.getBoundingClientRect();O(ng(te.clientY,D.top,D.height),!1)},[O]),ae=S.useCallback(te=>{if(!te.currentTarget.hasPointerCapture(te.pointerId))return;const G=v.current;if(!G)return;const _=G.getBoundingClientRect();O(ng(te.clientY,_.top,_.height),!1)},[O]),M=S.useCallback(te=>{te.currentTarget.hasPointerCapture(te.pointerId)&&te.currentTarget.releasePointerCapture(te.pointerId),c(!1),tg(i)},[i]),P=S.useCallback(()=>{O(gi,!0)},[O]),$=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:t.creatingSession,"aria-busy":t.creatingSession||void 0,children:t.creatingSession?"创建中…":"新建"}),t.layoutMode==="comfortable"?u.jsx("button",{type:"button",className:"oc-sidebar-toggle",onClick:X,"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:j,"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(te=>{const G=r.filter(_=>_.state===te);return G.length?u.jsxs("div",{className:"oc-session-group",children:[u.jsx("small",{children:te==="active"?"进行中":"已归档"}),G.map(_=>u.jsx(z0,{item:_,active:t.activeSessionId===_.sessionId,state:te,deleteConfirming:d===_.sessionId,deleting:p===_.sessionId,onActivate:()=>{p||(B(!1),t.onActivate(_.sessionId))},onRename:D=>t.onRename(_.sessionId,D),onSetState:D=>t.onSetState(_.sessionId,D),onRequestDelete:()=>{p||h(_.sessionId)},onConfirmDelete:()=>{N(_.sessionId)},onCancelDelete:()=>B()},_.sessionId))]},te):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":no,"aria-valuemax":ro,"aria-valuenow":i,"aria-label":"调整会话与仓库高度比例",tabIndex:0,onKeyDown:Y,onPointerDown:V,onPointerMove:ae,onPointerUp:M,onPointerCancel:M,onDoubleClick:P}),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:t.onRefreshTree,children:"刷新"})]}),u.jsx("p",{className:"oc-explorer-hint",children:"单击插入 @路径 · 双击预览"}),t.treeError&&u.jsx("p",{className:"oc-sidebar-error",children:t.treeError}),u.jsx("div",{className:"oc-tree-scroll",children:u.jsx(Ly,{entries:t.tree[""]??[],tree:t.tree,expanded:t.expanded,depth:0,onToggle:t.onToggleDir,onInsert:t.onInsert,onPreview:t.onPreview})})]})]}),u.jsx(E0,{origin:t.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":E,onClick:()=>E?j():t.onOpenDrawer(),children:u.jsx($0,{})}),u.jsx("button",{type:"button",className:"oc-sidebar-rail-btn","aria-label":t.creatingSession?"创建会话中":"新建会话",title:t.creatingSession?"创建中…":"新建会话",onClick:F,disabled:t.creatingSession,"aria-busy":t.creatingSession||void 0,children:u.jsx(G0,{})}),u.jsx("button",{type:"button",className:"oc-sidebar-rail-btn","aria-label":"治理入口",title:"治理",onClick:()=>E?j():t.onOpenDrawer(),children:u.jsx(F0,{})})]}):null,t.layoutMode==="comfortable"?u.jsx("aside",{className:`oc-sidebar${b?"":" is-collapsed"}`,"aria-label":"会话与仓库",children:b?$:u.jsx("button",{type:"button",className:"oc-sidebar-toggle is-collapsed",onClick:X,"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,E?u.jsxs(u.Fragment,{children:[u.jsx("button",{type:"button",className:"oc-overlay-backdrop","aria-label":"关闭侧栏遮罩",onClick:j}),u.jsx("aside",{ref:y,className:"oc-sidebar oc-sidebar-drawer","aria-label":"会话与仓库抽屉",role:"dialog","aria-modal":"true",tabIndex:-1,children:$})]}):null]})}function Ly(t){const r=S.useMemo(()=>B0(t.entries),[t.entries]);return r.length?u.jsx("ul",{className:"oc-tree",role:t.depth===0?"tree":"group",children:r.map(i=>{const s=i.name.startsWith(".");if(i.kind==="directory"){const o=t.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:()=>t.onToggle(i.path),style:{paddingLeft:`${8+t.depth*12}px`},children:[u.jsx(H0,{open:o}),u.jsx(U0,{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+t.depth*12}px`},children:u.jsx(Ly,{entries:t.tree[i.path]??[],tree:t.tree,expanded:t.expanded,depth:t.depth+1,onToggle:t.onToggle,onInsert:t.onInsert,onPreview:t.onPreview})}):null]},i.path)}return u.jsx("li",{className:`oc-tree-node is-file${s?" is-dot":""}`,role:"treeitem",children:u.jsx(P0,{entry:i,depth:t.depth,onInsert:t.onInsert,onPreview:t.onPreview})},i.path)})}):u.jsx("p",{className:"oc-tree-empty",children:"此目录为空或没有可安全浏览的文件。"})}function P0(t){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+t.depth*12}px`},title:"单击插入引用;双击预览",onClick:()=>{r.current!==null&&window.clearTimeout(r.current),r.current=window.setTimeout(()=>{t.onInsert(t.entry.path),r.current=null},220)},onDoubleClick:()=>{r.current!==null&&window.clearTimeout(r.current),r.current=null,t.onPreview(t.entry.path)},children:[u.jsx("span",{className:"oc-tree-chevron-spacer","aria-hidden":"true"}),u.jsx(q0,{}),u.jsx("span",{className:"oc-tree-label",children:t.entry.name})]})}function Y0(t){const r=t.previews.find(i=>i.path===t.activePath);return!r&&!t.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:t.previews.map(i=>u.jsx("button",{type:"button",role:"tab","aria-selected":i.path===r.path,className:i.path===r.path?"is-active":"",onClick:()=>t.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:()=>t.onClose(r.path),children:"关闭预览"})]}),u.jsx("pre",{children:u.jsx("code",{children:r.content})})]}),t.loading&&u.jsx("div",{className:"oc-file-preview-loading",children:"正在读取文件…"})]})}const zy=[{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"}],By=[{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"}],mi={operator:0,web:1,extension:2,skill:3,prompt:4};function ig(t){const r=t.trim().split(/\s+/,1)[0]??"";return r?r.startsWith("/")?r.toLowerCase():`/${r.toLowerCase()}`:""}function ag(t){const r=t.trim().split(/\s+/,1)[0]?.toLowerCase();if(!r?.startsWith("/"))return;const i=[...zy,...By].find(s=>s.command===r);return i?{command:i.command,action:i.action}:{command:r,action:"unknown"}}function K0(t){if(t==="focus-panel:task"||t==="focus-panel:contract")return"tasks";if(t==="focus-panel:dag")return"recovery"}function X0(t=[]){const r=new Map,i=s=>{const o=ig(s.command);if(!o)return;const c=r.get(o);if(!c){r.set(o,{...s,command:o});return}mi[s.source]<mi[c.source]&&r.set(o,{...s,command:o})};for(const s of zy)i({command:s.command,label:s.label,description:s.description,source:s.source,action:s.action});for(const s of By)i({command:s.command,label:s.label,description:s.description,source:s.source,action:s.action});for(const s of t){const o=ig(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=mi[s.source]-mi[o.source];return c!==0?c:s.command.localeCompare(o.command)})}function Q0(t,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 t){const h=d.command.toLowerCase(),p=h.startsWith("/")?h.slice(1):h,g=d.description.toLowerCase();let v=100;if(!o)v=10+mi[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=mi[d.source]-mi[h.source];return p!==0?p:d.command.localeCompare(h.command)})}const Z0={operator:"Operator",web:"Pi Web",extension:"Extensions",prompt:"Prompts",skill:"Skills"},J0=new Set(["operatorCapabilities","operationList","operationGet","operationEventSummary","statsContext","sourceInstructions","spineCheck","inspect","observeLink"]);function W0(t){return J0.has(t)?"technical-only":t==="doctor"?"inline-detail":"activity-detail"}const e1={newTask:"创建任务",importPrd:"任务需求",contractShow:"任务边界",contractApply:"更新任务契约",contractDiff:"任务契约差异",contractDraftSave:"任务契约草稿",contractValidate:"检查任务契约",taskAdvance:"推进任务准备",dagRunTask:"执行流程",dagValidate:"校验执行流程",prepareDagConfirmation:"执行确认",confirmDagConfirmation:"确认执行边界",prepareDagExecution:"执行边界",runDag:"任务执行",operationWait:"执行监督",operationGet:"任务活动详情",operationList:"会话活动",operationEventSummary:"执行进展摘要",dagStatus:"执行状态",dagDoctor:"执行诊断",dagReport:"执行结果",dagRerunPlan:"恢复评估",standaloneTaskRerun:"恢复执行",workerTaskRetry:"重试任务",promoteRun:"任务推进",status:"任务状态"},t1={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:"暂时无法确定安全的恢复方式"},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:"统计上下文使用情况时遇到问题"}},n1=[{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 Hy(t){if(!(!t||typeof t!="object"))return t}function Sd(t){if(t&&typeof t=="object")return t;if(typeof t=="string")try{return Hy(JSON.parse(t))}catch{return}}function r1(t){const i=Sd(t)?.operationId;return typeof i=="string"&&i?i:void 0}function i1(t){const i=Sd(t)?.maxWaitMs;if(!(typeof i!="number"||!Number.isFinite(i)||i<=0))return Math.max(1,Math.round(i/1e3))}function Uy(t){const r=r1(t.args);return r?`operation:${r}`:`tool:${t.id}`}function a1(t){return t==="running"?"progress":t==="error"?"error":"success"}function s1(t){return Sd(t.resultText??t.result)}function l1(t){return Array.isArray(t.events)?t.events.flatMap(r=>{const i=Hy(r);if(!i)return[];const s=i.messagePreview??i.message;return typeof s=="string"?[s]:[]}):[]}function o1(t,r,i){const s=[];for(const p of t)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=n1.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 u1(t){const r=Uy(t),i=`activity:${t.id}`,s=i1(t.args);if(t.status==="running")return{id:i,kind:"progress",title:s?`正在等待新的执行进展,最长等待时间 ${s} 秒`:"正在等待新的执行进展",activityRef:r};if(t.status==="error")return{id:i,kind:"error",title:"等待执行进展时遇到问题",activityRef:r};let o="";typeof t.resultText=="string"?o=t.resultText:typeof t.result=="string"&&(o=t.result);const c=s1(t),d=o1([o,...c?l1(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 c1(t){const r=W0(t.toolName);if(r==="technical-only"||r==="inline-detail")return;if(t.toolName==="operationWait")return u1(t);const i=t1[t.toolName];if(!i)return;let s=i.success;return t.status==="running"?s=i.running:t.status==="error"&&(s=i.error),{id:`activity:${t.id}`,kind:a1(t.status),title:s,activityRef:Uy(t)}}function qy(t){return e1[t]??"任务活动"}function kd(t){switch(t){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 $y(t){return[t.activityRef??`operation:${t.operationId}`,`operation:${t.operationId}`,...t.toolCallId?[`tool:${t.toolCallId}`]:[]]}function Gy(t){return[t.activityRef??`gate:${t.cardId}`]}function Fy(t){return[t.activityRef??`artifact:${t.artifactId}`]}function d1(t){return new Set([...t.operations.flatMap($y),...t.gates.flatMap(Gy),...t.artifacts.flatMap(Fy)])}function sg(t){return t.updatedSeq??t.eventSeq}function lg(t){const r=Date.parse(t.updatedAt);return Number.isFinite(r)?r:0}function wd(t,r){const i=sg(t),s=sg(r);return i!==void 0&&s!==void 0?i-s:lg(t)-lg(r)}function f1(t){return t.taskId?`task:${t.taskId}`:t.dagRunId?`run:${t.dagRunId}`:`operation:${t.operationId}`}function h1(t){return t.taskId?t.taskId.replace(/^\d{4}-\d{2}-\d{2}-/,"").replace(/[-_]+/g," ").trim()||t.taskId:qy(t.action)}function m1(t){return[...new Set(t)]}function p1(t){const r=new Map;for(const i of t)r.set(i.action,i);return[...r.values()].sort(wd).map(i=>{const s=kd(i.state);return{id:i.operationId,label:qy(i.action),stateLabel:s.label,kind:s.kind,at:i.updatedAt}})}function g1(t){const r=new Map;for(const i of t){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)=>wd(v,g)),c=o[0];if(!c)return[];const d=o.find(g=>g.runSummary)?.runSummary,h=d?.status??c.state,p=kd(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 Vy(t){const r=new Map;for(const i of t){const s=f1(i),o=r.get(s)??[];o.push(i),r.set(s,o)}return[...r.entries()].flatMap(([i,s])=>{const o=[...s].sort(wd),c=o.at(-1);if(!c)return[];const d=kd(c.state);return[{key:i,taskId:c.taskId,displayTitle:h1(c),state:c.state,stateLabel:d.label,kind:d.kind,updatedAt:c.updatedAt,latestOperation:c,operations:o,steps:p1(o),runs:g1(o),activityRefs:m1(o.flatMap($y)),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 y1={operation:"执行记录",contract:"任务契约",dag:"执行流程",report:"报告",html:"HTML 预览"};function v1(t){const{artifact:r}=t,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:y1[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 og={prepared:"等待确认",confirmed:"已经确认",dispatched:"正在执行",consumed:"已经完成",stale:"已经失效",expired:"已经过期",error:"处理失败"};function ug(t){return t.gateType==="contract-apply"?"确认任务契约变更":t.gateType==="mutation"?"确认执行工作区修改":"确认启动任务执行"}function b1({card:t,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";t.gateType==="dag-run"?y=t.state==="prepared"?"dag-confirm":"dag-run":t.gateType==="mutation"&&(y="mutation-apply");const k=t.gateType==="dag-run"?{confirmationId:t.confirmationId,...t.state==="prepared"?{humanGateToken:t.humanGateToken}:{}}:{receiptId:t.receiptId,humanGateToken:t.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":rn()},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=t.state==="prepared"||t.gateType==="dag-run"&&t.state==="confirmed";let g="确认接受";t.gateType==="mutation"?g="确认执行":t.gateType==="dag-run"&&(g=t.state==="prepared"?"确认边界":"启动执行");const v=(t.displayOnlyChallenges?.length??0)+(t.dagSpine?.length??0);return u.jsxs("section",{className:`oc-human-gate-card is-${t.state}`,"aria-label":`${ug(t)}:${og[t.state]}`,"data-activity-ref":t.activityRef??`gate:${t.cardId}`,children:[u.jsxs("header",{children:[u.jsxs("div",{children:[u.jsx("small",{children:"人工门禁"}),u.jsx("strong",{children:ug(t)}),u.jsx("code",{children:t.taskId})]}),u.jsx("span",{children:og[t.state]})]}),t.contractDiffSummary?u.jsx("p",{className:"oc-human-gate-summary",children:t.contractDiffSummary}):null,v>0||t.errorMessage?u.jsxs("details",{className:"oc-human-gate-details",children:[u.jsxs("summary",{children:["门禁详情 · ",v," 项"]}),t.displayOnlyChallenges?.length?u.jsxs("div",{className:"oc-human-gate-challenges",children:[u.jsx("b",{children:"确认前请检查"}),u.jsx("ul",{children:t.displayOnlyChallenges.map(y=>u.jsx("li",{children:y},y))})]}):null,t.dagSpine?.length?u.jsxs("div",{children:[u.jsx("b",{children:"计划执行步骤"}),u.jsx("ol",{children:t.dagSpine.map(y=>u.jsx("li",{children:u.jsx("code",{children:y})},y))})]}):null,t.errorMessage?u.jsx("p",{className:"oc-human-gate-error",children:t.errorMessage}):null]}):null,u.jsxs("footer",{children:[u.jsx("button",{className:"btn btn-ghost",type:"button",onClick:()=>window.open(t.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 _n="loop-console.operator-chat.active-session.v1",x1="loop-console.operator-chat.default-landing.v1";function Fl(t){const r=t?.trim().toLowerCase();if(r==="chat")return"chat";if(r==="tasks")return"tasks"}function Py(t){const r=t?.trim().toLowerCase();if(r==="chat"||r==="tasks"||r==="recovery"||r==="night"||r==="models"||r==="settings")return r}function Yy(t){const r=i=>t.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")}:{}}}function Ky(t){const r=String(t??"").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=Py(d);return h?{workspace:h,...Yy(new URLSearchParams(o))}:null}function S1(t){const r=new URLSearchParams(t.search),i=t.hash.startsWith("#")?t.hash.slice(1):t.hash,s=new URLSearchParams(i),o=Py(r.get("workspace")??r.get("landing")??s.get("workspace"));return o?{workspace:o,...Yy(r)}:null}function k1(t){if(!t)return;const r=Ky(t.hash);if(r)return r.workspace;const i=new URLSearchParams(t.search),s=Fl(i.get("landing")??i.get("workspace"));if(s)return s;const o=t.hash.startsWith("#")?t.hash.slice(1):t.hash;return Fl(new URLSearchParams(o).get("workspace"))}function Xy(t){return k1(t.location)??Fl(t.storage?.getItem(x1))??Fl(t.env)??"chat"}function Qy(t,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=`/${t}`;return s?`${o}?${s}`:o}function w1(t,r={}){return`#${Qy(t,r)}`}function C1(t){return Ky(t.hash)??S1(t)}function cg(t,r=900){if(t)return t.length>r?`${t.slice(0,r)}…`:t}function Ic(t){return new Date(t).toLocaleString()}function dg(t){if(!t)return;const r=t.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 j1(t){const r=t.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=dg(r.stderrPreview)??dg(r.summaryPreview);if(o)return o;if(t.kind==="error")return"本次任务活动没有完成,请查看最新诊断或恢复选项。";if(t.kind==="warning")return"本次任务活动需要进一步确认,请查看相关记录。"}function R1(t){const{journey:r}=t,i=r.latestOperation,s=r.runs[0],o=r.runs.slice(1),c=i.inspectHref.startsWith("/")?`${t.origin}${i.inspectHref}`:i.inspectHref,d=j1(r),h=r.kind==="error"||r.kind==="warning",p=(g,v)=>{t.onNavigateWorkspace?t.onNavigateWorkspace(g,v):window.location.assign(w1(g,v))};return t.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," · ",Ic(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:Ic(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:Ic(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:cg(g.stderrPreview)}):null,g.summaryPreview?u.jsx("pre",{children:cg(g.summaryPreview)}):null]},g.operationId))})]})]})}function fg(t){return t.state==="prepared"||t.state==="confirmed"?0:t.state==="dispatched"?1:t.state==="error"?2:3}function Dc(t,r){return t!==null&&r.includes(t)}function T1(t){return t.operations>0?"operations":t.gates>0?"gates":"artifacts"}function E1(t){const r=t.presentation==="sidecar",i=r||t.open,s=S.useRef(null),[o,c]=S.useState("operations"),d=S.useMemo(()=>Vy(t.operationCards),[t.operationCards]),h=d.length+t.humanGateCards.length+t.artifactCards.length,p=S.useMemo(()=>[...t.humanGateCards].sort((b,w)=>{const E=fg(b)-fg(w);return E!==0?E:(w.eventSeq??0)-(b.eventSeq??0)}),[t.humanGateCards]),g=S.useMemo(()=>[...t.artifactCards].sort((b,w)=>(w.eventSeq??0)-(b.eventSeq??0)),[t.artifactCards]);if(io({open:i&&!r,containerRef:s,triggerRef:t.triggerRef,onEscape:t.onClose}),S.useEffect(()=>{c(T1({operations:d.length,gates:t.humanGateCards.length,artifacts:t.artifactCards.length}))},[t.sessionId]),S.useEffect(()=>{t.focusRef&&(t.focusRef.startsWith("gate:")?c("gates"):t.focusRef.startsWith("artifact:")?c("artifacts"):c("operations"))},[t.focusRef]),S.useEffect(()=>{if(!i||!t.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(j=>{const I=j.dataset.activityRefs?.split(" ")??[];return j.dataset.activityRef===t.focusRef||I.includes(t.focusRef??"")||j.dataset.toolCallId&&`tool:${j.dataset.toolCallId}`===t.focusRef})?.scrollIntoView({block:"nearest",behavior:"smooth"})});return()=>window.cancelAnimationFrame(b)},[i,o,t.focusRef]),!i||h===0)return null;let v="is-drawer";r?v="is-sidecar":t.presentation==="sheet"&&(v="is-sheet");const y=r&&t.sidecarRect?{top:t.sidecarRect.top,left:t.sidecarRect.left,height:t.sidecarRect.height,width:t.sidecarRect.width}:void 0,k=u.jsxs("aside",{ref:s,id:"oc-activity-rail",className:`oc-activity-rail ${v} is-${t.phase}`,style:y,"aria-label":"本次对话的活动","aria-busy":t.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:t.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 E=b.activityRefs;return u.jsxs("div",{"data-activity-refs":E.join(" "),className:`oc-activity-card-wrap${Dc(t.focusRef,E)?" is-focused":""}`,children:[u.jsx(R1,{journey:b,compact:w>0&&b.compactEligible,origin:t.origin,onNavigateWorkspace:t.onNavigateWorkspace}),u.jsx("button",{type:"button",className:"oc-activity-locate",onClick:()=>t.onLocateConversation(E),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=Gy(b);return u.jsx("div",{className:`oc-activity-card-wrap${Dc(t.focusRef,w)?" is-focused":""}`,children:u.jsx(b1,{card:b,origin:t.origin,sessionId:t.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=Fy(b);return u.jsx("div",{className:`oc-activity-card-wrap${Dc(t.focusRef,w)?" is-focused":""}`,children:u.jsx(v1,{artifact:b})},b.artifactId)}):null]})]},t.sessionId)]});return r?jy.createPortal(k,document.body):k}const Zy=420,Jy=12;function N1(t){if(t.layoutMode==="narrow")return"sheet";const r=t.railWidth??Zy,i=t.gap??Jy;return t.viewportWidth-t.mainRight>=r+i?"sidecar":"drawer"}const A1={presentation:"drawer",sidecarRect:null};function I1(t,r,i){const[s,o]=S.useState(A1);return S.useLayoutEffect(()=>{const c=t.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=N1({layoutMode:r,viewportWidth:window.innerWidth,mainRight:v.right}),b=k==="sidecar"?{top:y.top,left:v.right+Jy,height:y.height,width:Zy}: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,t,i]),s}const hg={comfortableMin:620,compactMin:480};function D1(t){return!Number.isFinite(t)||t<0?"extra-compact":t>=hg.comfortableMin?"comfortable":t>=hg.compactMin?"compact":"extra-compact"}function O1(t){return`is-landing-${t}`}const M1=[{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 再 Human Gate),不要新建 task-id。仅当 plan 不合格(writer/decision/fingerprint)或契约/源真变时才 standaloneTaskRerun;paused 走 approve/resume;Worker-owned 用 workerTaskRetry。确定后直接帮我发起。"}];function Wy(t){const r=t.readiness==="setup-required",i=!!t.disabled||r,s=t.density??"comfortable",o=t.mode==="no-session"?"开始一段新的对话":"今天想推进什么?",c=t.mode==="no-session"?"用自然语言编排 loop-agent:查询状态、诊断问题、创建与恢复任务。可先点选下方建议,或新建空白对话。":"会话已就绪。点选建议快速开场,或在下方输入框直接描述目标。业务写入仍经受治理 DAG。";return u.jsxs("div",{className:`oc-empty ${O1(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:M1.map(d=>u.jsxs("button",{type:"button",className:"oc-suggestion",onClick:()=>t.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 换行"})]})]}),t.mode==="no-session"&&t.onCreateSession?u.jsx("button",{type:"button",className:"btn btn-primary oc-empty-cta",onClick:t.onCreateSession,disabled:i,"aria-busy":t.disabled||void 0,children:r?"需先完成 Pi setup":t.disabled?"创建中…":"新建空白对话"}):null]})}function _1(t){const{interview:r,interviewAnswer:i,onAnswerChange:s,onAnswer:o}=t;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:()=>t.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 L1(t,r){const i={};return(t[t.length-1]===""?[...t,""]:t).join((i.padRight?" ":"")+","+(i.padLeft===!1?"":" ")).trim()}const z1=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,B1=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,H1={};function mg(t,r){return(H1.jsx?B1:z1).test(t)}const U1=/[ \t\n\f\r]/g;function q1(t){return typeof t=="object"?t.type==="text"?pg(t.value):!1:pg(t)}function pg(t){return t.replace(U1,"")===""}class vs{constructor(r,i,s){this.normal=i,this.property=r,s&&(this.space=s)}}vs.prototype.normal={};vs.prototype.property={};vs.prototype.space=void 0;function ev(t,r){const i={},s={};for(const o of t)Object.assign(i,o.property),Object.assign(s,o.normal);return new vs(i,s,r)}function nd(t){return t.toLowerCase()}class an{constructor(r,i){this.attribute=i,this.property=r}}an.prototype.attribute="";an.prototype.booleanish=!1;an.prototype.boolean=!1;an.prototype.commaOrSpaceSeparated=!1;an.prototype.commaSeparated=!1;an.prototype.defined=!1;an.prototype.mustUseProperty=!1;an.prototype.number=!1;an.prototype.overloadedBoolean=!1;an.prototype.property="";an.prototype.spaceSeparated=!1;an.prototype.space=void 0;let $1=0;const Ie=bi(),Ct=bi(),rd=bi(),pe=bi(),at=bi(),yi=bi(),yn=bi();function bi(){return 2**++$1}const id=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ie,booleanish:Ct,commaOrSpaceSeparated:yn,commaSeparated:yi,number:pe,overloadedBoolean:rd,spaceSeparated:at},Symbol.toStringTag,{value:"Module"})),Oc=Object.keys(id);class Cd extends an{constructor(r,i,s,o){let c=-1;if(super(r,i),gg(this,"space",o),typeof s=="number")for(;++c<Oc.length;){const d=Oc[c];gg(this,Oc[c],(s&id[d])===id[d])}}}Cd.prototype.defined=!0;function gg(t,r,i){i&&(t[r]=i)}function ha(t){const r={},i={};for(const[s,o]of Object.entries(t.properties)){const c=new Cd(s,t.transform(t.attributes||{},s),o,t.space);t.mustUseProperty&&t.mustUseProperty.includes(s)&&(c.mustUseProperty=!0),r[s]=c,i[nd(s)]=s,i[nd(c.attribute)]=s}return new vs(r,i,t.space)}const tv=ha({properties:{ariaActiveDescendant:null,ariaAtomic:Ct,ariaAutoComplete:null,ariaBusy:Ct,ariaChecked:Ct,ariaColCount:pe,ariaColIndex:pe,ariaColSpan:pe,ariaControls:at,ariaCurrent:null,ariaDescribedBy:at,ariaDetails:null,ariaDisabled:Ct,ariaDropEffect:at,ariaErrorMessage:null,ariaExpanded:Ct,ariaFlowTo:at,ariaGrabbed:Ct,ariaHasPopup:null,ariaHidden:Ct,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:at,ariaLevel:pe,ariaLive:null,ariaModal:Ct,ariaMultiLine:Ct,ariaMultiSelectable:Ct,ariaOrientation:null,ariaOwns:at,ariaPlaceholder:null,ariaPosInSet:pe,ariaPressed:Ct,ariaReadOnly:Ct,ariaRelevant:null,ariaRequired:Ct,ariaRoleDescription:at,ariaRowCount:pe,ariaRowIndex:pe,ariaRowSpan:pe,ariaSelected:Ct,ariaSetSize:pe,ariaSort:null,ariaValueMax:pe,ariaValueMin:pe,ariaValueNow:pe,ariaValueText:null,role:null},transform(t,r){return r==="role"?r:"aria-"+r.slice(4).toLowerCase()}});function nv(t,r){return r in t?t[r]:r}function rv(t,r){return nv(t,r.toLowerCase())}const G1=ha({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:yi,acceptCharset:at,accessKey:at,action:null,allow:null,allowFullScreen:Ie,allowPaymentRequest:Ie,allowUserMedia:Ie,alpha:Ie,alt:null,as:null,async:Ie,autoCapitalize:null,autoComplete:at,autoFocus:Ie,autoPlay:Ie,blocking:at,capture:null,charSet:null,checked:Ie,cite:null,className:at,closedBy:null,colorSpace:null,cols:pe,colSpan:pe,command:null,commandFor:null,content:null,contentEditable:Ct,controls:Ie,controlsList:at,coords:pe|yi,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ie,defer:Ie,dir:null,dirName:null,disabled:Ie,download:rd,draggable:Ct,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ie,formTarget:null,headers:at,height:pe,hidden:rd,high:pe,href:null,hrefLang:null,htmlFor:at,httpEquiv:at,id:null,imageSizes:null,imageSrcSet:null,inert:Ie,inputMode:null,integrity:null,is:null,isMap:Ie,itemId:null,itemProp:at,itemRef:at,itemScope:Ie,itemType:at,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ie,low:pe,manifest:null,max:null,maxLength:pe,media:null,method:null,min:null,minLength:pe,multiple:Ie,muted:Ie,name:null,nonce:null,noModule:Ie,noValidate:Ie,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:Ie,optimum:pe,pattern:null,ping:at,placeholder:null,playsInline:Ie,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ie,referrerPolicy:null,rel:at,required:Ie,reversed:Ie,rows:pe,rowSpan:pe,sandbox:at,scope:null,scoped:Ie,seamless:Ie,selected:Ie,shadowRootClonable:Ie,shadowRootCustomElementRegistry:Ie,shadowRootDelegatesFocus:Ie,shadowRootMode:null,shadowRootSerializable:Ie,shape:null,size:pe,sizes:null,slot:null,span:pe,spellCheck:Ct,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:Ie,useMap:null,value:Ct,width:pe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:at,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:Ie,declare:Ie,event:null,face:null,frame:null,frameBorder:null,hSpace:pe,leftMargin:pe,link:null,longDesc:null,lowSrc:null,marginHeight:pe,marginWidth:pe,noResize:Ie,noHref:Ie,noShade:Ie,noWrap:Ie,object:null,profile:null,prompt:null,rev:null,rightMargin:pe,rules:null,scheme:null,scrolling:Ct,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:Ie,disablePictureInPicture:Ie,disableRemotePlayback:Ie,exportParts:yi,part:at,prefix:null,property:null,results:pe,security:null,unselectable:null},space:"html",transform:rv}),F1=ha({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:yn,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:at,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:Ie,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:yi,g2:yi,glyphName:yi,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:yn,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:at,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:pe,pointsAtY:pe,pointsAtZ:pe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:yn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:yn,rev:yn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:yn,requiredFeatures:yn,requiredFonts:yn,requiredFormats:yn,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:yn,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:yn,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:yn,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:nv}),iv=ha({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,r){return"xlink:"+r.slice(5).toLowerCase()}}),av=ha({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:rv}),sv=ha({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,r){return"xml:"+r.slice(3).toLowerCase()}}),V1={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"},P1=/[A-Z]/g,yg=/-[a-z]/g,Y1=/^data[-\w.:]+$/i;function K1(t,r){const i=nd(r);let s=r,o=an;if(i in t.normal)return t.property[t.normal[i]];if(i.length>4&&i.slice(0,4)==="data"&&Y1.test(r)){if(r.charAt(4)==="-"){const c=r.slice(5).replace(yg,Q1);s="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=r.slice(4);if(!yg.test(c)){let d=c.replace(P1,X1);d.charAt(0)!=="-"&&(d="-"+d),r="data"+d}}o=Cd}return new o(s,r)}function X1(t){return"-"+t.toLowerCase()}function Q1(t){return t.charAt(1).toUpperCase()}const Z1=ev([tv,G1,iv,av,sv],"html"),jd=ev([tv,F1,iv,av,sv],"svg");function J1(t){return t.join(" ").trim()}var ia={},Mc,vg;function W1(){if(vg)return Mc;vg=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//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(B,j){if(typeof B!="string")throw new TypeError("First argument must be a string");if(!B)return[];j=j||{};var I=1,N=1;function F(G){var _=G.match(r);_&&(I+=_.length);var D=G.lastIndexOf(p);N=~D?G.length-D:N+G.length}function X(){var G={line:I,column:N};return function(_){return _.position=new O(G),ae(),_}}function O(G){this.start=G,this.end={line:I,column:N},this.source=j.source}O.prototype.content=B;function Y(G){var _=new Error(j.source+":"+I+":"+N+": "+G);if(_.reason=G,_.filename=j.source,_.line=I,_.column=N,_.source=B,!j.silent)throw _}function V(G){var _=G.exec(B);if(_){var D=_[0];return F(D),B=B.slice(D.length),_}}function ae(){V(i)}function M(G){var _;for(G=G||[];_=P();)_!==!1&&G.push(_);return G}function P(){var G=X();if(!(g!=B.charAt(0)||v!=B.charAt(1))){for(var _=2;y!=B.charAt(_)&&(v!=B.charAt(_)||g!=B.charAt(_+1));)++_;if(_+=2,y===B.charAt(_-1))return Y("End of comment missing");var D=B.slice(2,_-2);return N+=2,F(D),B=B.slice(_),N+=2,G({type:k,comment:D})}}function $(){var G=X(),_=V(s);if(_){if(P(),!V(o))return Y("property missing ':'");var D=V(c),H=G({type:b,property:E(_[0].replace(t,y)),value:D?E(D[0].replace(t,y)):y});return V(d),H}}function te(){var G=[];M(G);for(var _;_=$();)_!==!1&&(G.push(_),M(G));return G}return ae(),te()}function E(B){return B?B.replace(h,y):y}return Mc=w,Mc}var bg;function ek(){if(bg)return ia;bg=1;var t=ia&&ia.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(ia,"__esModule",{value:!0}),ia.default=i;const r=t(W1());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 ia}var os={},xg;function tk(){if(xg)return os;xg=1,Object.defineProperty(os,"__esModule",{value:!0}),os.camelCase=void 0;var t=/^--[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)||t.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,Sg;function nk(){if(Sg)return us;Sg=1;var t=us&&us.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},r=t(ek()),i=tk();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 rk=nk();const ik=vd(rk),lv=ov("end"),Rd=ov("start");function ov(t){return r;function r(i){const s=i&&i.position&&i.position[t]||{};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 ak(t){const r=Rd(t),i=lv(t);if(r&&i)return{start:r,end:i}}function hs(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?kg(t.position):"start"in t||"end"in t?kg(t):"line"in t||"column"in t?ad(t):""}function ad(t){return wg(t&&t.line)+":"+wg(t&&t.column)}function kg(t){return ad(t&&t.start)+"-"+ad(t&&t.end)}function wg(t){return t&&typeof t=="number"?t:1}class Ft 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}}Ft.prototype.file="";Ft.prototype.name="";Ft.prototype.reason="";Ft.prototype.message="";Ft.prototype.stack="";Ft.prototype.column=void 0;Ft.prototype.line=void 0;Ft.prototype.ancestors=void 0;Ft.prototype.cause=void 0;Ft.prototype.fatal=void 0;Ft.prototype.place=void 0;Ft.prototype.ruleId=void 0;Ft.prototype.source=void 0;const Td={}.hasOwnProperty,sk=new Map,lk=/[A-Z]/g,ok=new Set(["table","tbody","thead","tfoot","tr"]),uk=new Set(["td","th"]),uv="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function ck(t,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=vk(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=yk(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"?jd:Z1,stylePropertyNameCase:r.stylePropertyNameCase||"dom",tableCellAlignToStyle:r.tableCellAlignToStyle!==!1},c=cv(o,t,void 0);return c&&typeof c!="string"?c:o.create(t,o.Fragment,{children:c||void 0},void 0)}function cv(t,r,i){if(r.type==="element")return dk(t,r,i);if(r.type==="mdxFlowExpression"||r.type==="mdxTextExpression")return fk(t,r);if(r.type==="mdxJsxFlowElement"||r.type==="mdxJsxTextElement")return mk(t,r,i);if(r.type==="mdxjsEsm")return hk(t,r);if(r.type==="root")return pk(t,r,i);if(r.type==="text")return gk(t,r)}function dk(t,r,i){const s=t.schema;let o=s;r.tagName.toLowerCase()==="svg"&&s.space==="html"&&(o=jd,t.schema=o),t.ancestors.push(r);const c=fv(t,r.tagName,!1),d=bk(t,r);let h=Nd(t,r);return ok.has(r.tagName)&&(h=h.filter(function(p){return typeof p=="string"?!q1(p):!0})),dv(t,d,c,r),Ed(d,h),t.ancestors.pop(),t.schema=s,t.create(r,c,d,i)}function fk(t,r){if(r.data&&r.data.estree&&t.evaluater){const s=r.data.estree.body[0];return s.type,t.evaluater.evaluateExpression(s.expression)}gs(t,r.position)}function hk(t,r){if(r.data&&r.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(r.data.estree);gs(t,r.position)}function mk(t,r,i){const s=t.schema;let o=s;r.name==="svg"&&s.space==="html"&&(o=jd,t.schema=o),t.ancestors.push(r);const c=r.name===null?t.Fragment:fv(t,r.name,!0),d=xk(t,r),h=Nd(t,r);return dv(t,d,c,r),Ed(d,h),t.ancestors.pop(),t.schema=s,t.create(r,c,d,i)}function pk(t,r,i){const s={};return Ed(s,Nd(t,r)),t.create(r,t.Fragment,s,i)}function gk(t,r){return r.value}function dv(t,r,i,s){typeof i!="string"&&i!==t.Fragment&&t.passNode&&(r.node=s)}function Ed(t,r){if(r.length>0){const i=r.length>1?r:r[0];i&&(t.children=i)}}function yk(t,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 vk(t,r){return i;function i(s,o,c,d){const h=Array.isArray(c.children),p=Rd(s);return r(o,c,d,h,{columnNumber:p?p.column-1:void 0,fileName:t,lineNumber:p?p.line:void 0},void 0)}}function bk(t,r){const i={};let s,o;for(o in r.properties)if(o!=="children"&&Td.call(r.properties,o)){const c=Sk(t,o,r.properties[o]);if(c){const[d,h]=c;t.tableCellAlignToStyle&&d==="align"&&typeof h=="string"&&uk.has(r.tagName)?s=h:i[d]=h}}if(s){const c=i.style||(i.style={});c[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return i}function xk(t,r){const i={};for(const s of r.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&t.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,t.evaluater.evaluateExpression(h.argument))}else gs(t,r.position);else{const o=s.name;let c;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&t.evaluater){const h=s.value.data.estree.body[0];h.type,c=t.evaluater.evaluateExpression(h.expression)}else gs(t,r.position);else c=s.value===null?!0:s.value;i[o]=c}return i}function Nd(t,r){const i=[];let s=-1;const o=t.passKeys?new Map:sk;for(;++s<r.children.length;){const c=r.children[s];let d;if(t.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=cv(t,c,d);h!==void 0&&i.push(h)}return i}function Sk(t,r,i){const s=K1(t.schema,r);if(!(i==null||typeof i=="number"&&Number.isNaN(i))){if(Array.isArray(i)&&(i=s.commaSeparated?L1(i):J1(i)),s.property==="style"){let o=typeof i=="object"?i:kk(t,String(i));return t.stylePropertyNameCase==="css"&&(o=wk(o)),["style",o]}return[t.elementAttributeNameCase==="react"&&s.space?V1[s.property]||s.property:s.attribute,i]}}function kk(t,r){try{return ik(r,{reactCompat:!0})}catch(i){if(t.ignoreInvalidStyle)return{};const s=i,o=new Ft("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=t.filePath||void 0,o.url=uv+"#cannot-parse-style-attribute",o}}function fv(t,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=mg(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=mg(r)&&!/^[a-z]/.test(r)?{type:"Identifier",name:r}:{type:"Literal",value:r};if(s.type==="Literal"){const o=s.value;return Td.call(t.components,o)?t.components[o]:o}if(t.evaluater)return t.evaluater.evaluateExpression(s);gs(t)}function gs(t,r){const i=new Ft("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:r,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw i.file=t.filePath||void 0,i.url=uv+"#cannot-handle-mdx-estrees-without-createevaluater",i}function wk(t){const r={};let i;for(i in t)Td.call(t,i)&&(r[Ck(i)]=t[i]);return r}function Ck(t){let r=t.replace(lk,jk);return r.slice(0,3)==="ms-"&&(r="-"+r),r}function jk(t){return"-"+t.toLowerCase()}const _c={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"]},Rk={};function Ad(t,r){const i=Rk,s=typeof i.includeImageAlt=="boolean"?i.includeImageAlt:!0,o=typeof i.includeHtml=="boolean"?i.includeHtml:!0;return hv(t,s,o)}function hv(t,r,i){if(Tk(t)){if("value"in t)return t.type==="html"&&!i?"":t.value;if(r&&"alt"in t&&t.alt)return t.alt;if("children"in t)return Cg(t.children,r,i)}return Array.isArray(t)?Cg(t,r,i):""}function Cg(t,r,i){const s=[];let o=-1;for(;++o<t.length;)s[o]=hv(t[o],r,i);return s.join("")}function Tk(t){return!!(t&&typeof t=="object")}const jg=document.createElement("i");function Id(t){const r="&"+t+";";jg.innerHTML=r;const i=jg.textContent;return i.charCodeAt(i.length-1)===59&&t!=="semi"||i===r?!1:i}function vn(t,r,i,s){const o=t.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),t.splice(...d);else for(i&&t.splice(r,i);c<s.length;)d=s.slice(c,c+1e4),d.unshift(r,0),t.splice(...d),c+=1e4,r+=1e4}function An(t,r){return t.length>0?(vn(t,t.length,0,r),t):r}const Rg={}.hasOwnProperty;function mv(t){const r={};let i=-1;for(;++i<t.length;)Ek(r,t[i]);return r}function Ek(t,r){let i;for(i in r){const o=(Rg.call(t,i)?t[i]:void 0)||(t[i]={}),c=r[i];let d;if(c)for(d in c){Rg.call(o,d)||(o[d]=[]);const h=c[d];Nk(o[d],Array.isArray(h)?h:h?[h]:[])}}}function Nk(t,r){let i=-1;const s=[];for(;++i<r.length;)(r[i].add==="after"?t:s).push(r[i]);vn(t,0,0,s)}function pv(t,r){const i=Number.parseInt(t,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 Ln(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Kt=Vr(/[A-Za-z]/),Gt=Vr(/[\dA-Za-z]/),Ak=Vr(/[#-'*+\--9=?A-Z^-~]/);function Vl(t){return t!==null&&(t<32||t===127)}const sd=Vr(/\d/),Ik=Vr(/[\dA-Fa-f]/),Dk=Vr(/[!-/:-@[-`{-~]/);function Se(t){return t!==null&&t<-2}function st(t){return t!==null&&(t<0||t===32)}function qe(t){return t===-2||t===-1||t===32}const ao=Vr(new RegExp("\\p{P}|\\p{S}","u")),vi=Vr(/\s/);function Vr(t){return r;function r(i){return i!==null&&i>-1&&t.test(String.fromCharCode(i))}}function ma(t){const r=[];let i=-1,s=0,o=0;for(;++i<t.length;){const c=t.charCodeAt(i);let d="";if(c===37&&Gt(t.charCodeAt(i+1))&&Gt(t.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=t.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(t.slice(s,i),encodeURIComponent(d)),s=i+o+1,d=""),o&&(i+=o,o=0)}return r.join("")+t.slice(s)}function Ye(t,r,i,s){const o=s?s-1:Number.POSITIVE_INFINITY;let c=0;return d;function d(p){return qe(p)?(t.enter(i),h(p)):r(p)}function h(p){return qe(p)&&c++<o?(t.consume(p),h):(t.exit(i),r(p))}}const Ok={tokenize:Mk};function Mk(t){const r=t.attempt(this.parser.constructs.contentInitial,s,o);let i;return r;function s(h){if(h===null){t.consume(h);return}return t.enter("lineEnding"),t.consume(h),t.exit("lineEnding"),Ye(t,r,"linePrefix")}function o(h){return t.enter("paragraph"),c(h)}function c(h){const p=t.enter("chunkText",{contentType:"text",previous:i});return i&&(i.next=p),i=p,d(h)}function d(h){if(h===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(h);return}return Se(h)?(t.consume(h),t.exit("chunkText"),c):(t.consume(h),d)}}const _k={tokenize:Lk},Tg={tokenize:zk};function Lk(t){const r=this,i=[];let s=0,o,c,d;return h;function h(N){if(s<i.length){const F=i[s];return r.containerState=F[1],t.attempt(F[0].continuation,p,g)(N)}return g(N)}function p(N){if(s++,r.containerState._closeFlow){r.containerState._closeFlow=void 0,o&&I();const F=r.events.length;let X=F,O;for(;X--;)if(r.events[X][0]==="exit"&&r.events[X][1].type==="chunkFlow"){O=r.events[X][1].end;break}j(s);let Y=F;for(;Y<r.events.length;)r.events[Y][1].end={...O},Y++;return vn(r.events,X+1,0,r.events.slice(F)),r.events.length=Y,g(N)}return h(N)}function g(N){if(s===i.length){if(!o)return k(N);if(o.currentConstruct&&o.currentConstruct.concrete)return w(N);r.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return r.containerState={},t.check(Tg,v,y)(N)}function v(N){return o&&I(),j(s),k(N)}function y(N){return r.parser.lazy[r.now().line]=s!==i.length,d=r.now().offset,w(N)}function k(N){return r.containerState={},t.attempt(Tg,b,w)(N)}function b(N){return s++,i.push([r.currentConstruct,r.containerState]),k(N)}function w(N){if(N===null){o&&I(),j(0),t.consume(N);return}return o=o||r.parser.flow(r.now()),t.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:c}),E(N)}function E(N){if(N===null){B(t.exit("chunkFlow"),!0),j(0),t.consume(N);return}return Se(N)?(t.consume(N),B(t.exit("chunkFlow")),s=0,r.interrupt=void 0,h):(t.consume(N),E)}function B(N,F){const X=r.sliceStream(N);if(F&&X.push(null),N.previous=c,c&&(c.next=N),c=N,o.defineSkip(N.start),o.write(X),r.parser.lazy[N.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 Y=r.events.length;let V=Y,ae,M;for(;V--;)if(r.events[V][0]==="exit"&&r.events[V][1].type==="chunkFlow"){if(ae){M=r.events[V][1].end;break}ae=!0}for(j(s),O=Y;O<r.events.length;)r.events[O][1].end={...M},O++;vn(r.events,V+1,0,r.events.slice(Y)),r.events.length=O}}function j(N){let F=i.length;for(;F-- >N;){const X=i[F];r.containerState=X[1],X[0].exit.call(r,t)}i.length=N}function I(){o.write([null]),c=void 0,o=void 0,r.containerState._closeFlow=void 0}}function zk(t,r,i){return Ye(t,t.attempt(this.parser.constructs.document,r,i),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function da(t){if(t===null||st(t)||vi(t))return 1;if(ao(t))return 2}function so(t,r,i){const s=[];let o=-1;for(;++o<t.length;){const c=t[o].resolveAll;c&&!s.includes(c)&&(r=c(r,i),s.push(c))}return r}const ld={name:"attention",resolveAll:Bk,tokenize:Hk};function Bk(t,r){let i=-1,s,o,c,d,h,p,g,v;for(;++i<t.length;)if(t[i][0]==="enter"&&t[i][1].type==="attentionSequence"&&t[i][1]._close){for(s=i;s--;)if(t[s][0]==="exit"&&t[s][1].type==="attentionSequence"&&t[s][1]._open&&r.sliceSerialize(t[s][1]).charCodeAt(0)===r.sliceSerialize(t[i][1]).charCodeAt(0)){if((t[s][1]._close||t[i][1]._open)&&(t[i][1].end.offset-t[i][1].start.offset)%3&&!((t[s][1].end.offset-t[s][1].start.offset+t[i][1].end.offset-t[i][1].start.offset)%3))continue;p=t[s][1].end.offset-t[s][1].start.offset>1&&t[i][1].end.offset-t[i][1].start.offset>1?2:1;const y={...t[s][1].end},k={...t[i][1].start};Eg(y,-p),Eg(k,p),d={type:p>1?"strongSequence":"emphasisSequence",start:y,end:{...t[s][1].end}},h={type:p>1?"strongSequence":"emphasisSequence",start:{...t[i][1].start},end:k},c={type:p>1?"strongText":"emphasisText",start:{...t[s][1].end},end:{...t[i][1].start}},o={type:p>1?"strong":"emphasis",start:{...d.start},end:{...h.end}},t[s][1].end={...d.start},t[i][1].start={...h.end},g=[],t[s][1].end.offset-t[s][1].start.offset&&(g=An(g,[["enter",t[s][1],r],["exit",t[s][1],r]])),g=An(g,[["enter",o,r],["enter",d,r],["exit",d,r],["enter",c,r]]),g=An(g,so(r.parser.constructs.insideSpan.null,t.slice(s+1,i),r)),g=An(g,[["exit",c,r],["enter",h,r],["exit",h,r],["exit",o,r]]),t[i][1].end.offset-t[i][1].start.offset?(v=2,g=An(g,[["enter",t[i][1],r],["exit",t[i][1],r]])):v=0,vn(t,s-1,i-s+3,g),i=s+g.length-v-2;break}}for(i=-1;++i<t.length;)t[i][1].type==="attentionSequence"&&(t[i][1].type="data");return t}function Hk(t,r){const i=this.parser.constructs.attentionMarkers.null,s=this.previous,o=da(s);let c;return d;function d(p){return c=p,t.enter("attentionSequence"),h(p)}function h(p){if(p===c)return t.consume(p),h;const g=t.exit("attentionSequence"),v=da(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 Eg(t,r){t.column+=r,t.offset+=r,t._bufferIndex+=r}const Uk={name:"autolink",tokenize:qk};function qk(t,r,i){let s=0;return o;function o(b){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(b),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),c}function c(b){return Kt(b)?(t.consume(b),d):b===64?i(b):g(b)}function d(b){return b===43||b===45||b===46||Gt(b)?(s=1,h(b)):g(b)}function h(b){return b===58?(t.consume(b),s=0,p):(b===43||b===45||b===46||Gt(b))&&s++<32?(t.consume(b),h):(s=0,g(b))}function p(b){return b===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(b),t.exit("autolinkMarker"),t.exit("autolink"),r):b===null||b===32||b===60||Vl(b)?i(b):(t.consume(b),p)}function g(b){return b===64?(t.consume(b),v):Ak(b)?(t.consume(b),g):i(b)}function v(b){return Gt(b)?y(b):i(b)}function y(b){return b===46?(t.consume(b),s=0,v):b===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(b),t.exit("autolinkMarker"),t.exit("autolink"),r):k(b)}function k(b){if((b===45||Gt(b))&&s++<63){const w=b===45?k:y;return t.consume(b),w}return i(b)}}const bs={partial:!0,tokenize:$k};function $k(t,r,i){return s;function s(c){return qe(c)?Ye(t,o,"linePrefix")(c):o(c)}function o(c){return c===null||Se(c)?r(c):i(c)}}const gv={continuation:{tokenize:Fk},exit:Vk,name:"blockQuote",tokenize:Gk};function Gk(t,r,i){const s=this;return o;function o(d){if(d===62){const h=s.containerState;return h.open||(t.enter("blockQuote",{_container:!0}),h.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(d),t.exit("blockQuoteMarker"),c}return i(d)}function c(d){return qe(d)?(t.enter("blockQuotePrefixWhitespace"),t.consume(d),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),r):(t.exit("blockQuotePrefix"),r(d))}}function Fk(t,r,i){const s=this;return o;function o(d){return qe(d)?Ye(t,c,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d):c(d)}function c(d){return t.attempt(gv,r,i)(d)}}function Vk(t){t.exit("blockQuote")}const yv={name:"characterEscape",tokenize:Pk};function Pk(t,r,i){return s;function s(c){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(c),t.exit("escapeMarker"),o}function o(c){return Dk(c)?(t.enter("characterEscapeValue"),t.consume(c),t.exit("characterEscapeValue"),t.exit("characterEscape"),r):i(c)}}const vv={name:"characterReference",tokenize:Yk};function Yk(t,r,i){const s=this;let o=0,c,d;return h;function h(y){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(y),t.exit("characterReferenceMarker"),p}function p(y){return y===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(y),t.exit("characterReferenceMarkerNumeric"),g):(t.enter("characterReferenceValue"),c=31,d=Gt,v(y))}function g(y){return y===88||y===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(y),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),c=6,d=Ik,v):(t.enter("characterReferenceValue"),c=7,d=sd,v(y))}function v(y){if(y===59&&o){const k=t.exit("characterReferenceValue");return d===Gt&&!Id(s.sliceSerialize(k))?i(y):(t.enter("characterReferenceMarker"),t.consume(y),t.exit("characterReferenceMarker"),t.exit("characterReference"),r)}return d(y)&&o++<c?(t.consume(y),v):i(y)}}const Ng={partial:!0,tokenize:Xk},Ag={concrete:!0,name:"codeFenced",tokenize:Kk};function Kk(t,r,i){const s=this,o={partial:!0,tokenize:X};let c=0,d=0,h;return p;function p(O){return g(O)}function g(O){const Y=s.events[s.events.length-1];return c=Y&&Y[1].type==="linePrefix"?Y[2].sliceSerialize(Y[1],!0).length:0,h=O,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),v(O)}function v(O){return O===h?(d++,t.consume(O),v):d<3?i(O):(t.exit("codeFencedFenceSequence"),qe(O)?Ye(t,y,"whitespace")(O):y(O))}function y(O){return O===null||Se(O)?(t.exit("codeFencedFence"),s.interrupt?r(O):t.check(Ng,E,F)(O)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),k(O))}function k(O){return O===null||Se(O)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),y(O)):qe(O)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Ye(t,b,"whitespace")(O)):O===96&&O===h?i(O):(t.consume(O),k)}function b(O){return O===null||Se(O)?y(O):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),w(O))}function w(O){return O===null||Se(O)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),y(O)):O===96&&O===h?i(O):(t.consume(O),w)}function E(O){return t.attempt(o,F,B)(O)}function B(O){return t.enter("lineEnding"),t.consume(O),t.exit("lineEnding"),j}function j(O){return c>0&&qe(O)?Ye(t,I,"linePrefix",c+1)(O):I(O)}function I(O){return O===null||Se(O)?t.check(Ng,E,F)(O):(t.enter("codeFlowValue"),N(O))}function N(O){return O===null||Se(O)?(t.exit("codeFlowValue"),I(O)):(t.consume(O),N)}function F(O){return t.exit("codeFenced"),r(O)}function X(O,Y,V){let ae=0;return M;function M(_){return O.enter("lineEnding"),O.consume(_),O.exit("lineEnding"),P}function P(_){return O.enter("codeFencedFence"),qe(_)?Ye(O,$,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):$(_)}function $(_){return _===h?(O.enter("codeFencedFenceSequence"),te(_)):V(_)}function te(_){return _===h?(ae++,O.consume(_),te):ae>=d?(O.exit("codeFencedFenceSequence"),qe(_)?Ye(O,G,"whitespace")(_):G(_)):V(_)}function G(_){return _===null||Se(_)?(O.exit("codeFencedFence"),Y(_)):V(_)}}}function Xk(t,r,i){const s=this;return o;function o(d){return d===null?i(d):(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),c)}function c(d){return s.parser.lazy[s.now().line]?i(d):r(d)}}const Lc={name:"codeIndented",tokenize:Zk},Qk={partial:!0,tokenize:Jk};function Zk(t,r,i){const s=this;return o;function o(g){return t.enter("codeIndented"),Ye(t,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):Se(g)?t.attempt(Qk,d,p)(g):(t.enter("codeFlowValue"),h(g))}function h(g){return g===null||Se(g)?(t.exit("codeFlowValue"),d(g)):(t.consume(g),h)}function p(g){return t.exit("codeIndented"),r(g)}}function Jk(t,r,i){const s=this;return o;function o(d){return s.parser.lazy[s.now().line]?i(d):Se(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),o):Ye(t,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):Se(d)?o(d):i(d)}}const Wk={name:"codeText",previous:tw,resolve:ew,tokenize:nw};function ew(t){let r=t.length-4,i=3,s,o;if((t[i][1].type==="lineEnding"||t[i][1].type==="space")&&(t[r][1].type==="lineEnding"||t[r][1].type==="space")){for(s=i;++s<r;)if(t[s][1].type==="codeTextData"){t[i][1].type="codeTextPadding",t[r][1].type="codeTextPadding",i+=2,r-=2;break}}for(s=i-1,r++;++s<=r;)o===void 0?s!==r&&t[s][1].type!=="lineEnding"&&(o=s):(s===r||t[s][1].type==="lineEnding")&&(t[o][1].type="codeTextData",s!==o+2&&(t[o][1].end=t[s-1][1].end,t.splice(o+2,s-o-2),r-=s-o-2,s=o+2),o=void 0);return t}function tw(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function nw(t,r,i){let s=0,o,c;return d;function d(y){return t.enter("codeText"),t.enter("codeTextSequence"),h(y)}function h(y){return y===96?(t.consume(y),s++,h):(t.exit("codeTextSequence"),p(y))}function p(y){return y===null?i(y):y===32?(t.enter("space"),t.consume(y),t.exit("space"),p):y===96?(c=t.enter("codeTextSequence"),o=0,v(y)):Se(y)?(t.enter("lineEnding"),t.consume(y),t.exit("lineEnding"),p):(t.enter("codeTextData"),g(y))}function g(y){return y===null||y===32||y===96||Se(y)?(t.exit("codeTextData"),p(y)):(t.consume(y),g)}function v(y){return y===96?(t.consume(y),o++,v):o===s?(t.exit("codeTextSequence"),t.exit("codeText"),r(y)):(c.type="codeTextData",g(y))}}class rw{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(t,r){let i=0;if(r.length<1e4)t.push(...r);else for(;i<r.length;)t.push(...r.slice(i,i+1e4)),i+=1e4}function bv(t){const r={};let i=-1,s,o,c,d,h,p,g;const v=new rw(t);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,iw(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 vn(t,0,Number.POSITIVE_INFINITY,v.slice(0)),!g}function iw(t,r){const i=t.get(r)[1],s=t.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,E=0;const B=[E];for(;b;){for(;t.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&&(E=k+1,B.push(E),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(d.events=[],b?(b._tokenizer=void 0,b.previous=void 0):B.pop(),k=B.length;k--;){const j=h.slice(B[k],B[k+1]),I=c.pop();p.push([I,I+j.length-1]),t.splice(I,2,j)}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 aw={resolve:lw,tokenize:ow},sw={partial:!0,tokenize:uw};function lw(t){return bv(t),t}function ow(t,r){let i;return s;function s(h){return t.enter("content"),i=t.enter("chunkContent",{contentType:"content"}),o(h)}function o(h){return h===null?c(h):Se(h)?t.check(sw,d,c)(h):(t.consume(h),o)}function c(h){return t.exit("chunkContent"),t.exit("content"),r(h)}function d(h){return t.consume(h),t.exit("chunkContent"),i.next=t.enter("chunkContent",{contentType:"content",previous:i}),i=i.next,o}}function uw(t,r,i){const s=this;return o;function o(d){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),Ye(t,c,"linePrefix")}function c(d){if(d===null||Se(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):t.interrupt(s.parser.constructs.flow,i,r)(d)}}function xv(t,r,i,s,o,c,d,h,p){const g=p||Number.POSITIVE_INFINITY;let v=0;return y;function y(j){return j===60?(t.enter(s),t.enter(o),t.enter(c),t.consume(j),t.exit(c),k):j===null||j===32||j===41||Vl(j)?i(j):(t.enter(s),t.enter(d),t.enter(h),t.enter("chunkString",{contentType:"string"}),E(j))}function k(j){return j===62?(t.enter(c),t.consume(j),t.exit(c),t.exit(o),t.exit(s),r):(t.enter(h),t.enter("chunkString",{contentType:"string"}),b(j))}function b(j){return j===62?(t.exit("chunkString"),t.exit(h),k(j)):j===null||j===60||Se(j)?i(j):(t.consume(j),j===92?w:b)}function w(j){return j===60||j===62||j===92?(t.consume(j),b):b(j)}function E(j){return!v&&(j===null||j===41||st(j))?(t.exit("chunkString"),t.exit(h),t.exit(d),t.exit(s),r(j)):v<g&&j===40?(t.consume(j),v++,E):j===41?(t.consume(j),v--,E):j===null||j===32||j===40||Vl(j)?i(j):(t.consume(j),j===92?B:E)}function B(j){return j===40||j===41||j===92?(t.consume(j),E):E(j)}}function Sv(t,r,i,s,o,c){const d=this;let h=0,p;return g;function g(b){return t.enter(s),t.enter(o),t.consume(b),t.exit(o),t.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?(t.exit(c),t.enter(o),t.consume(b),t.exit(o),t.exit(s),r):Se(b)?(t.enter("lineEnding"),t.consume(b),t.exit("lineEnding"),v):(t.enter("chunkString",{contentType:"string"}),y(b))}function y(b){return b===null||b===91||b===93||Se(b)||h++>999?(t.exit("chunkString"),v(b)):(t.consume(b),p||(p=!qe(b)),b===92?k:y)}function k(b){return b===91||b===92||b===93?(t.consume(b),h++,y):y(b)}}function kv(t,r,i,s,o,c){let d;return h;function h(k){return k===34||k===39||k===40?(t.enter(s),t.enter(o),t.consume(k),t.exit(o),d=k===40?41:k,p):i(k)}function p(k){return k===d?(t.enter(o),t.consume(k),t.exit(o),t.exit(s),r):(t.enter(c),g(k))}function g(k){return k===d?(t.exit(c),p(d)):k===null?i(k):Se(k)?(t.enter("lineEnding"),t.consume(k),t.exit("lineEnding"),Ye(t,g,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),v(k))}function v(k){return k===d||k===null||Se(k)?(t.exit("chunkString"),g(k)):(t.consume(k),k===92?y:v)}function y(k){return k===d||k===92?(t.consume(k),v):v(k)}}function ms(t,r){let i;return s;function s(o){return Se(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i=!0,s):qe(o)?Ye(t,s,i?"linePrefix":"lineSuffix")(o):r(o)}}const cw={name:"definition",tokenize:fw},dw={partial:!0,tokenize:hw};function fw(t,r,i){const s=this;let o;return c;function c(b){return t.enter("definition"),d(b)}function d(b){return Sv.call(s,t,h,i,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function h(b){return o=Ln(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),b===58?(t.enter("definitionMarker"),t.consume(b),t.exit("definitionMarker"),p):i(b)}function p(b){return st(b)?ms(t,g)(b):g(b)}function g(b){return xv(t,v,i,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function v(b){return t.attempt(dw,y,y)(b)}function y(b){return qe(b)?Ye(t,k,"whitespace")(b):k(b)}function k(b){return b===null||Se(b)?(t.exit("definition"),s.parser.defined.push(o),r(b)):i(b)}}function hw(t,r,i){return s;function s(h){return st(h)?ms(t,o)(h):i(h)}function o(h){return kv(t,c,i,"definitionTitle","definitionTitleMarker","definitionTitleString")(h)}function c(h){return qe(h)?Ye(t,d,"whitespace")(h):d(h)}function d(h){return h===null||Se(h)?r(h):i(h)}}const mw={name:"hardBreakEscape",tokenize:pw};function pw(t,r,i){return s;function s(c){return t.enter("hardBreakEscape"),t.consume(c),o}function o(c){return Se(c)?(t.exit("hardBreakEscape"),r(c)):i(c)}}const gw={name:"headingAtx",resolve:yw,tokenize:vw};function yw(t,r){let i=t.length-2,s=3,o,c;return t[s][1].type==="whitespace"&&(s+=2),i-2>s&&t[i][1].type==="whitespace"&&(i-=2),t[i][1].type==="atxHeadingSequence"&&(s===i-1||i-4>s&&t[i-2][1].type==="whitespace")&&(i-=s+1===i?2:4),i>s&&(o={type:"atxHeadingText",start:t[s][1].start,end:t[i][1].end},c={type:"chunkText",start:t[s][1].start,end:t[i][1].end,contentType:"text"},vn(t,s,i-s+1,[["enter",o,r],["enter",c,r],["exit",c,r],["exit",o,r]])),t}function vw(t,r,i){let s=0;return o;function o(v){return t.enter("atxHeading"),c(v)}function c(v){return t.enter("atxHeadingSequence"),d(v)}function d(v){return v===35&&s++<6?(t.consume(v),d):v===null||st(v)?(t.exit("atxHeadingSequence"),h(v)):i(v)}function h(v){return v===35?(t.enter("atxHeadingSequence"),p(v)):v===null||Se(v)?(t.exit("atxHeading"),r(v)):qe(v)?Ye(t,h,"whitespace")(v):(t.enter("atxHeadingText"),g(v))}function p(v){return v===35?(t.consume(v),p):(t.exit("atxHeadingSequence"),h(v))}function g(v){return v===null||v===35||st(v)?(t.exit("atxHeadingText"),h(v)):(t.consume(v),g)}}const bw=["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"],Ig=["pre","script","style","textarea"],xw={concrete:!0,name:"htmlFlow",resolveTo:ww,tokenize:Cw},Sw={partial:!0,tokenize:Rw},kw={partial:!0,tokenize:jw};function ww(t){let r=t.length;for(;r--&&!(t[r][0]==="enter"&&t[r][1].type==="htmlFlow"););return r>1&&t[r-2][1].type==="linePrefix"&&(t[r][1].start=t[r-2][1].start,t[r+1][1].start=t[r-2][1].start,t.splice(r-2,2)),t}function Cw(t,r,i){const s=this;let o,c,d,h,p;return g;function g(C){return v(C)}function v(C){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(C),y}function y(C){return C===33?(t.consume(C),k):C===47?(t.consume(C),c=!0,E):C===63?(t.consume(C),o=3,s.interrupt?r:T):Kt(C)?(t.consume(C),d=String.fromCharCode(C),B):i(C)}function k(C){return C===45?(t.consume(C),o=2,b):C===91?(t.consume(C),o=5,h=0,w):Kt(C)?(t.consume(C),o=4,s.interrupt?r:T):i(C)}function b(C){return C===45?(t.consume(C),s.interrupt?r:T):i(C)}function w(C){const se="CDATA[";return C===se.charCodeAt(h++)?(t.consume(C),h===se.length?s.interrupt?r:$:w):i(C)}function E(C){return Kt(C)?(t.consume(C),d=String.fromCharCode(C),B):i(C)}function B(C){if(C===null||C===47||C===62||st(C)){const se=C===47,W=d.toLowerCase();return!se&&!c&&Ig.includes(W)?(o=1,s.interrupt?r(C):$(C)):bw.includes(d.toLowerCase())?(o=6,se?(t.consume(C),j):s.interrupt?r(C):$(C)):(o=7,s.interrupt&&!s.parser.lazy[s.now().line]?i(C):c?I(C):N(C))}return C===45||Gt(C)?(t.consume(C),d+=String.fromCharCode(C),B):i(C)}function j(C){return C===62?(t.consume(C),s.interrupt?r:$):i(C)}function I(C){return qe(C)?(t.consume(C),I):M(C)}function N(C){return C===47?(t.consume(C),M):C===58||C===95||Kt(C)?(t.consume(C),F):qe(C)?(t.consume(C),N):M(C)}function F(C){return C===45||C===46||C===58||C===95||Gt(C)?(t.consume(C),F):X(C)}function X(C){return C===61?(t.consume(C),O):qe(C)?(t.consume(C),X):N(C)}function O(C){return C===null||C===60||C===61||C===62||C===96?i(C):C===34||C===39?(t.consume(C),p=C,Y):qe(C)?(t.consume(C),O):V(C)}function Y(C){return C===p?(t.consume(C),p=null,ae):C===null||Se(C)?i(C):(t.consume(C),Y)}function V(C){return C===null||C===34||C===39||C===47||C===60||C===61||C===62||C===96||st(C)?X(C):(t.consume(C),V)}function ae(C){return C===47||C===62||qe(C)?N(C):i(C)}function M(C){return C===62?(t.consume(C),P):i(C)}function P(C){return C===null||Se(C)?$(C):qe(C)?(t.consume(C),P):i(C)}function $(C){return C===45&&o===2?(t.consume(C),D):C===60&&o===1?(t.consume(C),H):C===62&&o===4?(t.consume(C),A):C===63&&o===3?(t.consume(C),T):C===93&&o===5?(t.consume(C),ne):Se(C)&&(o===6||o===7)?(t.exit("htmlFlowData"),t.check(Sw,U,te)(C)):C===null||Se(C)?(t.exit("htmlFlowData"),te(C)):(t.consume(C),$)}function te(C){return t.check(kw,G,U)(C)}function G(C){return t.enter("lineEnding"),t.consume(C),t.exit("lineEnding"),_}function _(C){return C===null||Se(C)?te(C):(t.enter("htmlFlowData"),$(C))}function D(C){return C===45?(t.consume(C),T):$(C)}function H(C){return C===47?(t.consume(C),d="",z):$(C)}function z(C){if(C===62){const se=d.toLowerCase();return Ig.includes(se)?(t.consume(C),A):$(C)}return Kt(C)&&d.length<8?(t.consume(C),d+=String.fromCharCode(C),z):$(C)}function ne(C){return C===93?(t.consume(C),T):$(C)}function T(C){return C===62?(t.consume(C),A):C===45&&o===2?(t.consume(C),T):$(C)}function A(C){return C===null||Se(C)?(t.exit("htmlFlowData"),U(C)):(t.consume(C),A)}function U(C){return t.exit("htmlFlow"),r(C)}}function jw(t,r,i){const s=this;return o;function o(d){return Se(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),c):i(d)}function c(d){return s.parser.lazy[s.now().line]?i(d):r(d)}}function Rw(t,r,i){return s;function s(o){return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),t.attempt(bs,r,i)}}const Tw={name:"htmlText",tokenize:Ew};function Ew(t,r,i){const s=this;let o,c,d;return h;function h(T){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(T),p}function p(T){return T===33?(t.consume(T),g):T===47?(t.consume(T),X):T===63?(t.consume(T),N):Kt(T)?(t.consume(T),V):i(T)}function g(T){return T===45?(t.consume(T),v):T===91?(t.consume(T),c=0,w):Kt(T)?(t.consume(T),I):i(T)}function v(T){return T===45?(t.consume(T),b):i(T)}function y(T){return T===null?i(T):T===45?(t.consume(T),k):Se(T)?(d=y,H(T)):(t.consume(T),y)}function k(T){return T===45?(t.consume(T),b):y(T)}function b(T){return T===62?D(T):T===45?k(T):y(T)}function w(T){const A="CDATA[";return T===A.charCodeAt(c++)?(t.consume(T),c===A.length?E:w):i(T)}function E(T){return T===null?i(T):T===93?(t.consume(T),B):Se(T)?(d=E,H(T)):(t.consume(T),E)}function B(T){return T===93?(t.consume(T),j):E(T)}function j(T){return T===62?D(T):T===93?(t.consume(T),j):E(T)}function I(T){return T===null||T===62?D(T):Se(T)?(d=I,H(T)):(t.consume(T),I)}function N(T){return T===null?i(T):T===63?(t.consume(T),F):Se(T)?(d=N,H(T)):(t.consume(T),N)}function F(T){return T===62?D(T):N(T)}function X(T){return Kt(T)?(t.consume(T),O):i(T)}function O(T){return T===45||Gt(T)?(t.consume(T),O):Y(T)}function Y(T){return Se(T)?(d=Y,H(T)):qe(T)?(t.consume(T),Y):D(T)}function V(T){return T===45||Gt(T)?(t.consume(T),V):T===47||T===62||st(T)?ae(T):i(T)}function ae(T){return T===47?(t.consume(T),D):T===58||T===95||Kt(T)?(t.consume(T),M):Se(T)?(d=ae,H(T)):qe(T)?(t.consume(T),ae):D(T)}function M(T){return T===45||T===46||T===58||T===95||Gt(T)?(t.consume(T),M):P(T)}function P(T){return T===61?(t.consume(T),$):Se(T)?(d=P,H(T)):qe(T)?(t.consume(T),P):ae(T)}function $(T){return T===null||T===60||T===61||T===62||T===96?i(T):T===34||T===39?(t.consume(T),o=T,te):Se(T)?(d=$,H(T)):qe(T)?(t.consume(T),$):(t.consume(T),G)}function te(T){return T===o?(t.consume(T),o=void 0,_):T===null?i(T):Se(T)?(d=te,H(T)):(t.consume(T),te)}function G(T){return T===null||T===34||T===39||T===60||T===61||T===96?i(T):T===47||T===62||st(T)?ae(T):(t.consume(T),G)}function _(T){return T===47||T===62||st(T)?ae(T):i(T)}function D(T){return T===62?(t.consume(T),t.exit("htmlTextData"),t.exit("htmlText"),r):i(T)}function H(T){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(T),t.exit("lineEnding"),z}function z(T){return qe(T)?Ye(t,ne,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):ne(T)}function ne(T){return t.enter("htmlTextData"),d(T)}}const Dd={name:"labelEnd",resolveAll:Dw,resolveTo:Ow,tokenize:Mw},Nw={tokenize:_w},Aw={tokenize:Lw},Iw={tokenize:zw};function Dw(t){let r=-1;const i=[];for(;++r<t.length;){const s=t[r][1];if(i.push(t[r]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const o=s.type==="labelImage"?4:2;s.type="data",r+=o}}return t.length!==i.length&&vn(t,0,t.length,i),t}function Ow(t,r){let i=t.length,s=0,o,c,d,h;for(;i--;)if(o=t[i][1],c){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;t[i][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(d){if(t[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:t[c][1].type==="labelLink"?"link":"image",start:{...t[c][1].start},end:{...t[t.length-1][1].end}},g={type:"label",start:{...t[c][1].start},end:{...t[d][1].end}},v={type:"labelText",start:{...t[c+s+2][1].end},end:{...t[d-2][1].start}};return h=[["enter",p,r],["enter",g,r]],h=An(h,t.slice(c+1,c+s+3)),h=An(h,[["enter",v,r]]),h=An(h,so(r.parser.constructs.insideSpan.null,t.slice(c+s+4,d-3),r)),h=An(h,[["exit",v,r],t[d-2],t[d-1],["exit",g,r]]),h=An(h,t.slice(d+1)),h=An(h,[["exit",p,r]]),vn(t,c,t.length,h),t}function Mw(t,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(Ln(s.sliceSerialize({start:c.end,end:s.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(k),t.exit("labelMarker"),t.exit("labelEnd"),p):i(k)}function p(k){return k===40?t.attempt(Nw,v,d?v:y)(k):k===91?t.attempt(Aw,v,d?g:y)(k):d?v(k):y(k)}function g(k){return t.attempt(Iw,v,y)(k)}function v(k){return r(k)}function y(k){return c._balanced=!0,i(k)}}function _w(t,r,i){return s;function s(y){return t.enter("resource"),t.enter("resourceMarker"),t.consume(y),t.exit("resourceMarker"),o}function o(y){return st(y)?ms(t,c)(y):c(y)}function c(y){return y===41?v(y):xv(t,d,h,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(y)}function d(y){return st(y)?ms(t,p)(y):v(y)}function h(y){return i(y)}function p(y){return y===34||y===39||y===40?kv(t,g,i,"resourceTitle","resourceTitleMarker","resourceTitleString")(y):v(y)}function g(y){return st(y)?ms(t,v)(y):v(y)}function v(y){return y===41?(t.enter("resourceMarker"),t.consume(y),t.exit("resourceMarker"),t.exit("resource"),r):i(y)}}function Lw(t,r,i){const s=this;return o;function o(h){return Sv.call(s,t,c,d,"reference","referenceMarker","referenceString")(h)}function c(h){return s.parser.defined.includes(Ln(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?r(h):i(h)}function d(h){return i(h)}}function zw(t,r,i){return s;function s(c){return t.enter("reference"),t.enter("referenceMarker"),t.consume(c),t.exit("referenceMarker"),o}function o(c){return c===93?(t.enter("referenceMarker"),t.consume(c),t.exit("referenceMarker"),t.exit("reference"),r):i(c)}}const Bw={name:"labelStartImage",resolveAll:Dd.resolveAll,tokenize:Hw};function Hw(t,r,i){const s=this;return o;function o(h){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(h),t.exit("labelImageMarker"),c}function c(h){return h===91?(t.enter("labelMarker"),t.consume(h),t.exit("labelMarker"),t.exit("labelImage"),d):i(h)}function d(h){return h===94&&"_hiddenFootnoteSupport"in s.parser.constructs?i(h):r(h)}}const Uw={name:"labelStartLink",resolveAll:Dd.resolveAll,tokenize:qw};function qw(t,r,i){const s=this;return o;function o(d){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(d),t.exit("labelMarker"),t.exit("labelLink"),c}function c(d){return d===94&&"_hiddenFootnoteSupport"in s.parser.constructs?i(d):r(d)}}const zc={name:"lineEnding",tokenize:$w};function $w(t,r){return i;function i(s){return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),Ye(t,r,"linePrefix")}}const Ul={name:"thematicBreak",tokenize:Gw};function Gw(t,r,i){let s=0,o;return c;function c(g){return t.enter("thematicBreak"),d(g)}function d(g){return o=g,h(g)}function h(g){return g===o?(t.enter("thematicBreakSequence"),p(g)):s>=3&&(g===null||Se(g))?(t.exit("thematicBreak"),r(g)):i(g)}function p(g){return g===o?(t.consume(g),s++,p):(t.exit("thematicBreakSequence"),qe(g)?Ye(t,h,"whitespace")(g):h(g))}}const nn={continuation:{tokenize:Yw},exit:Xw,name:"list",tokenize:Pw},Fw={partial:!0,tokenize:Qw},Vw={partial:!0,tokenize:Kw};function Pw(t,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:sd(b)){if(s.containerState.type||(s.containerState.type=w,t.enter(w,{_container:!0})),w==="listUnordered")return t.enter("listItemPrefix"),b===42||b===45?t.check(Ul,i,g)(b):g(b);if(!s.interrupt||b===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),p(b)}return i(b)}function p(b){return sd(b)&&++d<10?(t.consume(b),p):(!s.interrupt||d<2)&&(s.containerState.marker?b===s.containerState.marker:b===41||b===46)?(t.exit("listItemValue"),g(b)):i(b)}function g(b){return t.enter("listItemMarker"),t.consume(b),t.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||b,t.check(bs,s.interrupt?i:v,t.attempt(Fw,k,y))}function v(b){return s.containerState.initialBlankLine=!0,c++,k(b)}function y(b){return qe(b)?(t.enter("listItemPrefixWhitespace"),t.consume(b),t.exit("listItemPrefixWhitespace"),k):i(b)}function k(b){return s.containerState.size=c+s.sliceSerialize(t.exit("listItemPrefix"),!0).length,r(b)}}function Yw(t,r,i){const s=this;return s.containerState._closeFlow=void 0,t.check(bs,o,c);function o(h){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,Ye(t,r,"listItemIndent",s.containerState.size+1)(h)}function c(h){return s.containerState.furtherBlankLines||!qe(h)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,d(h)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,t.attempt(Vw,r,d)(h))}function d(h){return s.containerState._closeFlow=!0,s.interrupt=void 0,Ye(t,t.attempt(nn,r,i),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(h)}}function Kw(t,r,i){const s=this;return Ye(t,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 Xw(t){t.exit(this.containerState.type)}function Qw(t,r,i){const s=this;return Ye(t,o,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(c){const d=s.events[s.events.length-1];return!qe(c)&&d&&d[1].type==="listItemPrefixWhitespace"?r(c):i(c)}}const Dg={name:"setextUnderline",resolveTo:Zw,tokenize:Jw};function Zw(t,r){let i=t.length,s,o,c;for(;i--;)if(t[i][0]==="enter"){if(t[i][1].type==="content"){s=i;break}t[i][1].type==="paragraph"&&(o=i)}else t[i][1].type==="content"&&t.splice(i,1),!c&&t[i][1].type==="definition"&&(c=i);const d={type:"setextHeading",start:{...t[s][1].start},end:{...t[t.length-1][1].end}};return t[o][1].type="setextHeadingText",c?(t.splice(o,0,["enter",d,r]),t.splice(c+1,0,["exit",t[s][1],r]),t[s][1].end={...t[c][1].end}):t[s][1]=d,t.push(["exit",d,r]),t}function Jw(t,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)?(t.enter("setextHeadingLine"),o=g,d(g)):i(g)}function d(g){return t.enter("setextHeadingLineSequence"),h(g)}function h(g){return g===o?(t.consume(g),h):(t.exit("setextHeadingLineSequence"),qe(g)?Ye(t,p,"lineSuffix")(g):p(g))}function p(g){return g===null||Se(g)?(t.exit("setextHeadingLine"),r(g)):i(g)}}const Ww={tokenize:eC};function eC(t){const r=this,i=t.attempt(bs,s,t.attempt(this.parser.constructs.flowInitial,o,Ye(t,t.attempt(this.parser.constructs.flow,o,t.attempt(aw,o)),"linePrefix")));return i;function s(c){if(c===null){t.consume(c);return}return t.enter("lineEndingBlank"),t.consume(c),t.exit("lineEndingBlank"),r.currentConstruct=void 0,i}function o(c){if(c===null){t.consume(c);return}return t.enter("lineEnding"),t.consume(c),t.exit("lineEnding"),r.currentConstruct=void 0,i}}const tC={resolveAll:Cv()},nC=wv("string"),rC=wv("text");function wv(t){return{resolveAll:Cv(t==="text"?iC:void 0),tokenize:r};function r(i){const s=this,o=this.parser.constructs[t],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 Cv(t){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 t?t(i,s):i}}function iC(t,r){let i=0;for(;++i<=t.length;)if((i===t.length||t[i][1].type==="lineEnding")&&t[i-1][1].type==="data"){const s=t[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===t.length&&(h=0),h){const g={type:i===t.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):(t.splice(i,0,["enter",g,r],["exit",g,r]),i+=2)}i++}return t}const aC={42:nn,43:nn,45:nn,48:nn,49:nn,50:nn,51:nn,52:nn,53:nn,54:nn,55:nn,56:nn,57:nn,62:gv},sC={91:cw},lC={[-2]:Lc,[-1]:Lc,32:Lc},oC={35:gw,42:Ul,45:[Dg,Ul],60:xw,61:Dg,95:Ul,96:Ag,126:Ag},uC={38:vv,92:yv},cC={[-5]:zc,[-4]:zc,[-3]:zc,33:Bw,38:vv,42:ld,60:[Uk,Tw],91:Uw,92:[mw,yv],93:Dd,95:ld,96:Wk},dC={null:[ld,tC]},fC={null:[42,95]},hC={null:[]},mC=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:fC,contentInitial:sC,disable:hC,document:aC,flow:oC,flowInitial:lC,insideSpan:dC,string:uC,text:cC},Symbol.toStringTag,{value:"Module"}));function pC(t,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:Y(X),check:Y(O),consume:I,enter:N,exit:F,interrupt:Y(O,{interrupt:!0})},g={code:null,containerState:{},defineSkip:E,events:[],now:w,parser:t,previous:null,sliceSerialize:k,sliceStream:b,write:y};let v=r.tokenize.call(g,p);return r.resolveAll&&c.push(r),g;function y(P){return d=An(d,P),B(),d[d.length-1]!==null?[]:(V(r,0),g.events=so(c,g.events,g),g.events)}function k(P,$){return yC(b(P),$)}function b(P){return gC(d,P)}function w(){const{_bufferIndex:P,_index:$,line:te,column:G,offset:_}=s;return{_bufferIndex:P,_index:$,line:te,column:G,offset:_}}function E(P){o[P.line]=P.column,M()}function B(){let P;for(;s._index<d.length;){const $=d[s._index];if(typeof $=="string")for(P=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===P&&s._bufferIndex<$.length;)j($.charCodeAt(s._bufferIndex));else j($)}}function j(P){v=v(P)}function I(P){Se(P)?(s.line++,s.column=1,s.offset+=P===-3?2:1,M()):P!==-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=P}function N(P,$){const te=$||{};return te.type=P,te.start=w(),g.events.push(["enter",te,g]),h.push(te),te}function F(P){const $=h.pop();return $.end=w(),g.events.push(["exit",$,g]),$}function X(P,$){V(P,$.from)}function O(P,$){$.restore()}function Y(P,$){return te;function te(G,_,D){let H,z,ne,T;return Array.isArray(G)?U(G):"tokenize"in G?U([G]):A(G);function A(Z){return ue;function ue(me){const ge=me!==null&&Z[me],fe=me!==null&&Z.null,ke=[...Array.isArray(ge)?ge:ge?[ge]:[],...Array.isArray(fe)?fe:fe?[fe]:[]];return U(ke)(me)}}function U(Z){return H=Z,z=0,Z.length===0?D:C(Z[z])}function C(Z){return ue;function ue(me){return T=ae(),ne=Z,Z.partial||(g.currentConstruct=Z),Z.name&&g.parser.constructs.disable.null.includes(Z.name)?W():Z.tokenize.call($?Object.assign(Object.create(g),$):g,p,se,W)(me)}}function se(Z){return P(ne,T),_}function W(Z){return T.restore(),++z<H.length?C(H[z]):D}}}function V(P,$){P.resolveAll&&!c.includes(P)&&c.push(P),P.resolve&&vn(g.events,$,g.events.length-$,P.resolve(g.events.slice($),g)),P.resolveTo&&(g.events=P.resolveTo(g.events,g))}function ae(){const P=w(),$=g.previous,te=g.currentConstruct,G=g.events.length,_=Array.from(h);return{from:G,restore:D};function D(){s=P,g.previous=$,g.currentConstruct=te,g.events.length=G,h=_,M()}}function M(){s.line in o&&s.column<2&&(s.column=o[s.line],s.offset+=o[s.line]-1)}}function gC(t,r){const i=r.start._index,s=r.start._bufferIndex,o=r.end._index,c=r.end._bufferIndex;let d;if(i===o)d=[t[i].slice(s,c)];else{if(d=t.slice(i,o),s>-1){const h=d[0];typeof h=="string"?d[0]=h.slice(s):d.shift()}c>0&&d.push(t[o].slice(0,c))}return d}function yC(t,r){let i=-1;const s=[];let o;for(;++i<t.length;){const c=t[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 vC(t){const s={constructs:mv([mC,...(t||{}).extensions||[]]),content:o(Ok),defined:[],document:o(_k),flow:o(Ww),lazy:{},string:o(nC),text:o(rC)};return s;function o(c){return d;function d(h){return pC(s,c,h)}}}function bC(t){for(;!bv(t););return t}const Og=/[\0\t\n\r]/g;function xC(){let t=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(Og.lastIndex=y,g=Og.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)),t+=k-y),b){case 0:{p.push(65533),t++;break}case 9:{for(v=Math.ceil(t/4)*4,p.push(-2);t++<v;)p.push(-1);break}case 10:{p.push(-4),t=1;break}default:s=!0,t=1}y=k+1}return h&&(s&&p.push(-5),r&&p.push(r),p.push(null)),p}}const SC=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function kC(t){return t.replace(SC,wC)}function wC(t,r,i){if(r)return r;if(i.charCodeAt(0)===35){const o=i.charCodeAt(1),c=o===120||o===88;return pv(i.slice(c?2:1),c?16:10)}return Id(i)||t}const jv={}.hasOwnProperty;function CC(t,r,i){return r&&typeof r=="object"&&(i=r,r=void 0),jC(i)(bC(vC(i).document().write(xC()(t,r,!0))))}function jC(t){const r={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:c(Nt),autolinkProtocol:ae,autolinkEmail:ae,atxHeading:c(lt),blockQuote:c(fe),characterEscape:ae,characterReference:ae,codeFenced:c(ke),codeFencedFenceInfo:d,codeFencedFenceMeta:d,codeIndented:c(ke,d),codeText:c(_e,d),codeTextData:ae,data:ae,codeFlowValue:ae,definition:c(Ze),definitionDestinationString:d,definitionLabelString:d,definitionTitleString:d,emphasis:c(Ve),hardBreakEscape:c(sn),hardBreakTrailing:c(sn),htmlFlow:c(Ot,d),htmlFlowData:ae,htmlText:c(Ot,d),htmlTextData:ae,image:c(Mt),label:d,link:c(Nt),listItem:c(Ne),listItemValue:k,listOrdered:c(qt,y),listUnordered:c(qt),paragraph:c(Ee),reference:C,referenceString:d,resourceDestinationString:d,resourceTitleString:d,setextHeading:c(lt),strong:c(dt),thematicBreak:c($e)},exit:{atxHeading:p(),atxHeadingSequence:X,autolink:p(),autolinkEmail:ge,autolinkProtocol:me,blockQuote:p(),characterEscapeValue:M,characterReferenceMarkerHexadecimal:W,characterReferenceMarkerNumeric:W,characterReferenceValue:Z,characterReference:ue,codeFenced:p(B),codeFencedFence:E,codeFencedFenceInfo:b,codeFencedFenceMeta:w,codeFlowValue:M,codeIndented:p(j),codeText:p(_),codeTextData:M,data:M,definition:p(),definitionDestinationString:F,definitionLabelString:I,definitionTitleString:N,emphasis:p(),hardBreakEscape:p($),hardBreakTrailing:p($),htmlFlow:p(te),htmlFlowData:M,htmlText:p(G),htmlTextData:M,image:p(H),label:ne,labelText:z,lineEnding:P,link:p(D),listItem:p(),listOrdered:p(),listUnordered:p(),paragraph:p(),referenceString:se,resourceDestinationString:T,resourceTitleString:A,resource:U,setextHeading:p(V),setextHeadingLineSequence:Y,setextHeadingText:O,strong:p(),thematicBreak:p()}};Rv(r,(t||{}).mdastExtensions||[]);const i={};return s;function s(le){let he={type:"root",children:[]};const be={stack:[he],tokenStack:[],config:r,enter:h,exit:g,buffer:d,resume:v,data:i},we=[];let Me=-1;for(;++Me<le.length;)if(le[Me][1].type==="listOrdered"||le[Me][1].type==="listUnordered")if(le[Me][0]==="enter")we.push(Me);else{const rt=we.pop();Me=o(le,rt,Me)}for(Me=-1;++Me<le.length;){const rt=r[le[Me][0]];jv.call(rt,le[Me][1].type)&&rt[le[Me][1].type].call(Object.assign({sliceSerialize:le[Me][2].sliceSerialize},be),le[Me][1])}if(be.tokenStack.length>0){const rt=be.tokenStack[be.tokenStack.length-1];(rt[1]||Mg).call(be,void 0,rt[0])}for(he.position={start:qr(le.length>0?le[0][1].start:{line:1,column:1,offset:0}),end:qr(le.length>0?le[le.length-2][1].end:{line:1,column:1,offset:0})},Me=-1;++Me<r.transforms.length;)he=r.transforms[Me](he)||he;return he}function o(le,he,be){let we=he-1,Me=-1,rt=!1,jt,Ce,Te,Be;for(;++we<=be;){const Ae=le[we];switch(Ae[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ae[0]==="enter"?Me++:Me--,Be=void 0;break}case"lineEndingBlank":{Ae[0]==="enter"&&(jt&&!Be&&!Me&&!Te&&(Te=we),Be=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Be=void 0}if(!Me&&Ae[0]==="enter"&&Ae[1].type==="listItemPrefix"||Me===-1&&Ae[0]==="exit"&&(Ae[1].type==="listUnordered"||Ae[1].type==="listOrdered")){if(jt){let At=we;for(Ce=void 0;At--;){const _t=le[At];if(_t[1].type==="lineEnding"||_t[1].type==="lineEndingBlank"){if(_t[0]==="exit")continue;Ce&&(le[Ce][1].type="lineEndingBlank",rt=!0),_t[1].type="lineEnding",Ce=At}else if(!(_t[1].type==="linePrefix"||_t[1].type==="blockQuotePrefix"||_t[1].type==="blockQuotePrefixWhitespace"||_t[1].type==="blockQuoteMarker"||_t[1].type==="listItemIndent"))break}Te&&(!Ce||Te<Ce)&&(jt._spread=!0),jt.end=Object.assign({},Ce?le[Ce][1].start:Ae[1].end),le.splice(Ce||we,0,["exit",jt,Ae[2]]),we++,be++}if(Ae[1].type==="listItemPrefix"){const At={type:"listItem",_spread:!1,start:Object.assign({},Ae[1].start),end:void 0};jt=At,le.splice(we,0,["enter",At,Ae[2]]),we++,be++,Te=void 0,Be=!0}}}return le[he][1]._spread=rt,be}function c(le,he){return be;function be(we){h.call(this,le(we),we),he&&he.call(this,we)}}function d(){this.stack.push({type:"fragment",children:[]})}function h(le,he,be){this.stack[this.stack.length-1].children.push(le),this.stack.push(le),this.tokenStack.push([he,be||void 0]),le.position={start:qr(he.start),end:void 0}}function p(le){return he;function he(be){le&&le.call(this,be),g.call(this,be)}}function g(le,he){const be=this.stack.pop(),we=this.tokenStack.pop();if(we)we[0].type!==le.type&&(he?he.call(this,le,we[0]):(we[1]||Mg).call(this,le,we[0]));else throw new Error("Cannot close `"+le.type+"` ("+hs({start:le.start,end:le.end})+"): it’s not open");be.position.end=qr(le.end)}function v(){return Ad(this.stack.pop())}function y(){this.data.expectingFirstListItemValue=!0}function k(le){if(this.data.expectingFirstListItemValue){const he=this.stack[this.stack.length-2];he.start=Number.parseInt(this.sliceSerialize(le),10),this.data.expectingFirstListItemValue=void 0}}function b(){const le=this.resume(),he=this.stack[this.stack.length-1];he.lang=le}function w(){const le=this.resume(),he=this.stack[this.stack.length-1];he.meta=le}function E(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function B(){const le=this.resume(),he=this.stack[this.stack.length-1];he.value=le.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function j(){const le=this.resume(),he=this.stack[this.stack.length-1];he.value=le.replace(/(\r?\n|\r)$/g,"")}function I(le){const he=this.resume(),be=this.stack[this.stack.length-1];be.label=he,be.identifier=Ln(this.sliceSerialize(le)).toLowerCase()}function N(){const le=this.resume(),he=this.stack[this.stack.length-1];he.title=le}function F(){const le=this.resume(),he=this.stack[this.stack.length-1];he.url=le}function X(le){const he=this.stack[this.stack.length-1];if(!he.depth){const be=this.sliceSerialize(le).length;he.depth=be}}function O(){this.data.setextHeadingSlurpLineEnding=!0}function Y(le){const he=this.stack[this.stack.length-1];he.depth=this.sliceSerialize(le).codePointAt(0)===61?1:2}function V(){this.data.setextHeadingSlurpLineEnding=void 0}function ae(le){const be=this.stack[this.stack.length-1].children;let we=be[be.length-1];(!we||we.type!=="text")&&(we=Oe(),we.position={start:qr(le.start),end:void 0},be.push(we)),this.stack.push(we)}function M(le){const he=this.stack.pop();he.value+=this.sliceSerialize(le),he.position.end=qr(le.end)}function P(le){const he=this.stack[this.stack.length-1];if(this.data.atHardBreak){const be=he.children[he.children.length-1];be.position.end=qr(le.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&r.canContainEols.includes(he.type)&&(ae.call(this,le),M.call(this,le))}function $(){this.data.atHardBreak=!0}function te(){const le=this.resume(),he=this.stack[this.stack.length-1];he.value=le}function G(){const le=this.resume(),he=this.stack[this.stack.length-1];he.value=le}function _(){const le=this.resume(),he=this.stack[this.stack.length-1];he.value=le}function D(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const he=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=he,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function H(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const he=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=he,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function z(le){const he=this.sliceSerialize(le),be=this.stack[this.stack.length-2];be.label=kC(he),be.identifier=Ln(he).toLowerCase()}function ne(){const le=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=le.children;be.children=we}else be.alt=he}function T(){const le=this.resume(),he=this.stack[this.stack.length-1];he.url=le}function A(){const le=this.resume(),he=this.stack[this.stack.length-1];he.title=le}function U(){this.data.inReference=void 0}function C(){this.data.referenceType="collapsed"}function se(le){const he=this.resume(),be=this.stack[this.stack.length-1];be.label=he,be.identifier=Ln(this.sliceSerialize(le)).toLowerCase(),this.data.referenceType="full"}function W(le){this.data.characterReferenceType=le.type}function Z(le){const he=this.sliceSerialize(le),be=this.data.characterReferenceType;let we;be?(we=pv(he,be==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):we=Id(he);const Me=this.stack[this.stack.length-1];Me.value+=we}function ue(le){const he=this.stack.pop();he.position.end=qr(le.end)}function me(le){M.call(this,le);const he=this.stack[this.stack.length-1];he.url=this.sliceSerialize(le)}function ge(le){M.call(this,le);const he=this.stack[this.stack.length-1];he.url="mailto:"+this.sliceSerialize(le)}function fe(){return{type:"blockquote",children:[]}}function ke(){return{type:"code",lang:null,meta:null,value:""}}function _e(){return{type:"inlineCode",value:""}}function Ze(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ve(){return{type:"emphasis",children:[]}}function lt(){return{type:"heading",depth:0,children:[]}}function sn(){return{type:"break"}}function Ot(){return{type:"html",value:""}}function Mt(){return{type:"image",title:null,url:"",alt:null}}function Nt(){return{type:"link",title:null,url:"",children:[]}}function qt(le){return{type:"list",ordered:le.type==="listOrdered",start:null,spread:le._spread,children:[]}}function Ne(le){return{type:"listItem",spread:le._spread,checked:null,children:[]}}function Ee(){return{type:"paragraph",children:[]}}function dt(){return{type:"strong",children:[]}}function Oe(){return{type:"text",value:""}}function $e(){return{type:"thematicBreak"}}}function qr(t){return{line:t.line,column:t.column,offset:t.offset}}function Rv(t,r){let i=-1;for(;++i<r.length;){const s=r[i];Array.isArray(s)?Rv(t,s):RC(t,s)}}function RC(t,r){let i;for(i in r)if(jv.call(r,i))switch(i){case"canContainEols":{const s=r[i];s&&t[i].push(...s);break}case"transforms":{const s=r[i];s&&t[i].push(...s);break}case"enter":case"exit":{const s=r[i];s&&Object.assign(t[i],s);break}}}function Mg(t,r){throw t?new Error("Cannot close `"+t.type+"` ("+hs({start:t.start,end:t.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 TC(t){const r=this;r.parser=i;function i(s){return CC(s,{...r.data("settings"),...t,extensions:r.data("micromarkExtensions")||[],mdastExtensions:r.data("fromMarkdownExtensions")||[]})}}function EC(t,r){const i={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(r),!0)};return t.patch(r,i),t.applyData(r,i)}function NC(t,r){const i={type:"element",tagName:"br",properties:{},children:[]};return t.patch(r,i),[t.applyData(r,i),{type:"text",value:`
|
|
16
|
+
`}]}function AC(t,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}),t.patch(r,c),c=t.applyData(r,c),c={type:"element",tagName:"pre",properties:{},children:[c]},t.patch(r,c),c}function IC(t,r){const i={type:"element",tagName:"del",properties:{},children:t.all(r)};return t.patch(r,i),t.applyData(r,i)}function DC(t,r){const i={type:"element",tagName:"em",properties:{},children:t.all(r)};return t.patch(r,i),t.applyData(r,i)}function OC(t,r){const i=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",s=String(r.identifier).toUpperCase(),o=ma(s.toLowerCase()),c=t.footnoteOrder.indexOf(s);let d,h=t.footnoteCounts.get(s);h===void 0?(h=0,t.footnoteOrder.push(s),d=t.footnoteOrder.length):d=c+1,h+=1,t.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)}]};t.patch(r,p);const g={type:"element",tagName:"sup",properties:{},children:[p]};return t.patch(r,g),t.applyData(r,g)}function MC(t,r){const i={type:"element",tagName:"h"+r.depth,properties:{},children:t.all(r)};return t.patch(r,i),t.applyData(r,i)}function _C(t,r){if(t.options.allowDangerousHtml){const i={type:"raw",value:r.value};return t.patch(r,i),t.applyData(r,i)}}function Tv(t,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=t.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 LC(t,r){const i=String(r.identifier).toUpperCase(),s=t.definitionById.get(i);if(!s)return Tv(t,r);const o={src:ma(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 t.patch(r,c),t.applyData(r,c)}function zC(t,r){const i={src:ma(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 t.patch(r,s),t.applyData(r,s)}function BC(t,r){const i={type:"text",value:r.value.replace(/\r?\n|\r/g," ")};t.patch(r,i);const s={type:"element",tagName:"code",properties:{},children:[i]};return t.patch(r,s),t.applyData(r,s)}function HC(t,r){const i=String(r.identifier).toUpperCase(),s=t.definitionById.get(i);if(!s)return Tv(t,r);const o={href:ma(s.url||"")};s.title!==null&&s.title!==void 0&&(o.title=s.title);const c={type:"element",tagName:"a",properties:o,children:t.all(r)};return t.patch(r,c),t.applyData(r,c)}function UC(t,r){const i={href:ma(r.url)};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:t.all(r)};return t.patch(r,s),t.applyData(r,s)}function qC(t,r,i){const s=t.all(r),o=i?$C(i):Ev(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 t.patch(r,g),t.applyData(r,g)}function $C(t){let r=!1;if(t.type==="list"){r=t.spread||!1;const i=t.children;let s=-1;for(;!r&&++s<i.length;)r=Ev(i[s])}return r}function Ev(t){const r=t.spread;return r??t.children.length>1}function GC(t,r){const i={},s=t.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:t.wrap(s,!0)};return t.patch(r,c),t.applyData(r,c)}function FC(t,r){const i={type:"element",tagName:"p",properties:{},children:t.all(r)};return t.patch(r,i),t.applyData(r,i)}function VC(t,r){const i={type:"root",children:t.wrap(t.all(r))};return t.patch(r,i),t.applyData(r,i)}function PC(t,r){const i={type:"element",tagName:"strong",properties:{},children:t.all(r)};return t.patch(r,i),t.applyData(r,i)}function YC(t,r){const i=t.all(r),s=i.shift(),o=[];if(s){const d={type:"element",tagName:"thead",properties:{},children:t.wrap([s],!0)};t.patch(r.children[0],d),o.push(d)}if(i.length>0){const d={type:"element",tagName:"tbody",properties:{},children:t.wrap(i,!0)},h=Rd(r.children[1]),p=lv(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:t.wrap(o,!0)};return t.patch(r,c),t.applyData(r,c)}function KC(t,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=t.all(y),t.patch(y,w),w=t.applyData(y,w)),g.push(w)}const v={type:"element",tagName:"tr",properties:{},children:t.wrap(g,!0)};return t.patch(r,v),t.applyData(r,v)}function XC(t,r){const i={type:"element",tagName:"td",properties:{},children:t.all(r)};return t.patch(r,i),t.applyData(r,i)}const _g=9,Lg=32;function QC(t){const r=String(t),i=/\r?\n|\r/g;let s=i.exec(r),o=0;const c=[];for(;s;)c.push(zg(r.slice(o,s.index),o>0,!0),s[0]),o=s.index+s[0].length,s=i.exec(r);return c.push(zg(r.slice(o),o>0,!1)),c.join("")}function zg(t,r,i){let s=0,o=t.length;if(r){let c=t.codePointAt(s);for(;c===_g||c===Lg;)s++,c=t.codePointAt(s)}if(i){let c=t.codePointAt(o-1);for(;c===_g||c===Lg;)o--,c=t.codePointAt(o-1)}return o>s?t.slice(s,o):""}function ZC(t,r){const i={type:"text",value:QC(String(r.value))};return t.patch(r,i),t.applyData(r,i)}function JC(t,r){const i={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(r,i),t.applyData(r,i)}const WC={blockquote:EC,break:NC,code:AC,delete:IC,emphasis:DC,footnoteReference:OC,heading:MC,html:_C,imageReference:LC,image:zC,inlineCode:BC,linkReference:HC,link:UC,listItem:qC,list:GC,paragraph:FC,root:VC,strong:PC,table:YC,tableCell:XC,tableRow:KC,text:ZC,thematicBreak:JC,toml:Ml,yaml:Ml,definition:Ml,footnoteDefinition:Ml};function Ml(){}const Nv=-1,lo=0,ps=1,Pl=2,Od=3,Md=4,_d=5,Ld=6,Av=7,Iv=8,Dv=typeof self=="object"?self:globalThis,Bg=(t,r)=>{switch(t){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+t)}return new Dv[t](r)},ej=(t,r)=>{const i=(o,c)=>(t.set(c,o),o),s=o=>{if(t.has(o))return t.get(o);const[c,d]=r[o];switch(c){case lo:case Nv:return i(d,o);case ps:{const h=i([],o);for(const p of d)h.push(s(p));return h}case Pl:{const h=i({},o);for(const[p,g]of d)h[s(p)]=s(g);return h}case Od:return i(new Date(d),o);case Md:{const{source:h,flags:p}=d;return i(new RegExp(h,p),o)}case _d:{const h=i(new Map,o);for(const[p,g]of d)h.set(s(p),s(g));return h}case Ld:{const h=i(new Set,o);for(const p of d)h.add(s(p));return h}case Av:{const{name:h,message:p}=d;return i(typeof Dv[h]=="function"?Bg(h,p):new Error(p),o)}case Iv: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(Bg(c,d),o)};return s},Hg=t=>ej(new Map,t)(0),fi="",{toString:tj}={},{keys:nj}=Object,ds=t=>{const r=typeof t;if(r!=="object"||!t)return[lo,r];const i=tj.call(t).slice(8,-1);switch(i){case"Array":return[ps,fi];case"Object":return[Pl,fi];case"Date":return[Od,fi];case"RegExp":return[Md,fi];case"Map":return[_d,fi];case"Set":return[Ld,fi];case"DataView":return[ps,i]}return i.includes("Array")?[ps,i]:t instanceof Error?[Av,t.name||"Error"]:[Pl,i]},_l=([t,r])=>t===lo&&(r==="function"||r==="symbol"),rj=(t,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 lo:{let v=d;switch(p){case"bigint":h=Iv,v=d.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+p);v=null;break;case"undefined":return o([Nv],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 Pl:{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 nj(d))(t||!_l(ds(d[k])))&&v.push([c(k),c(d[k])]);return y}case Od:return o([h,isNaN(d.getTime())?fi:d.toISOString()],d);case Md:{const{source:v,flags:y}=d;return o([h,{source:v,flags:y}],d)}case _d:{const v=[],y=o([h,v],d);for(const[k,b]of d)(t||!(_l(ds(k))||_l(ds(b))))&&v.push([c(k),c(b)]);return y}case Ld:{const v=[],y=o([h,v],d);for(const k of d)(t||!_l(ds(k)))&&v.push(c(k));return y}}const{message:g}=d;return o([h,{name:p,message:g}],d)};return c},Ug=(t,{json:r,lossy:i}={})=>{const s=[];return rj(!(r||i),!!r,new Map,s)(t),s},Yl=typeof structuredClone=="function"?(t,r)=>r&&("json"in r||"lossy"in r)?Hg(Ug(t,r)):structuredClone(t):(t,r)=>Hg(Ug(t,r));function ij(t,r){const i=[{type:"text",value:"↩"}];return r>1&&i.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(r)}]}),i}function aj(t,r){return"Back to reference "+(t+1)+(r>1?"-"+r:"")}function sj(t){const r=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",i=t.options.footnoteBackContent||ij,s=t.options.footnoteBackLabel||aj,o=t.options.footnoteLabel||"Footnotes",c=t.options.footnoteLabelTagName||"h2",d=t.options.footnoteLabelProperties||{className:["sr-only"]},h=[];let p=-1;for(;++p<t.footnoteOrder.length;){const g=t.footnoteById.get(t.footnoteOrder[p]);if(!g)continue;const v=t.all(g),y=String(g.identifier).toUpperCase(),k=ma(y.toLowerCase());let b=0;const w=[],E=t.footnoteCounts.get(y);for(;E!==void 0&&++b<=E;){w.length>0&&w.push({type:"text",value:" "});let I=typeof i=="string"?i:i(p,b);typeof I=="string"&&(I={type:"text",value:I}),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(I)?I:[I]})}const B=v[v.length-1];if(B&&B.type==="element"&&B.tagName==="p"){const I=B.children[B.children.length-1];I&&I.type==="text"?I.value+=" ":B.children.push({type:"text",value:" "}),B.children.push(...w)}else v.push(...w);const j={type:"element",tagName:"li",properties:{id:r+"fn-"+k},children:t.wrap(v,!0)};t.patch(g,j),h.push(j)}if(h.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:c,properties:{...Yl(d),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
|
|
20
|
+
`},{type:"element",tagName:"ol",properties:{},children:t.wrap(h,!0)},{type:"text",value:`
|
|
21
|
+
`}]}}const oo=(function(t){if(t==null)return cj;if(typeof t=="function")return uo(t);if(typeof t=="object")return Array.isArray(t)?lj(t):oj(t);if(typeof t=="string")return uj(t);throw new Error("Expected function, string, or object as test")});function lj(t){const r=[];let i=-1;for(;++i<t.length;)r[i]=oo(t[i]);return uo(s);function s(...o){let c=-1;for(;++c<r.length;)if(r[c].apply(this,o))return!0;return!1}}function oj(t){const r=t;return uo(i);function i(s){const o=s;let c;for(c in t)if(o[c]!==r[c])return!1;return!0}}function uj(t){return uo(r);function r(i){return i&&i.type===t}}function uo(t){return r;function r(i,s,o){return!!(dj(i)&&t.call(this,i,typeof s=="number"?s:void 0,o||void 0))}}function cj(){return!0}function dj(t){return t!==null&&typeof t=="object"&&"type"in t}const Ov=[],fj=!0,od=!1,hj="skip";function Mv(t,r,i,s){let o;typeof r=="function"&&typeof i!="function"?(s=i,i=r):o=r;const c=oo(o),d=s?-1:1;h(t,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=Ov,w,E,B;if((!r||c(p,g,v[v.length-1]||void 0))&&(b=mj(i(p,v)),b[0]===od))return b;if("children"in p&&p.children){const j=p;if(j.children&&b[0]!==hj)for(E=(s?j.children.length:-1)+d,B=v.concat(j);E>-1&&E<j.children.length;){const I=j.children[E];if(w=h(I,E,B)(),w[0]===od)return w;E=typeof w[1]=="number"?w[1]:E+d}}return b}}}function mj(t){return Array.isArray(t)?t:typeof t=="number"?[fj,t]:t==null?Ov:[t]}function zd(t,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),Mv(t,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 ud={}.hasOwnProperty,pj={};function gj(t,r){const i=r||pj,s=new Map,o=new Map,c=new Map,d={...WC,...i.handlers},h={all:g,applyData:vj,definitionById:s,footnoteById:o,footnoteCounts:c,footnoteOrder:[],handlers:d,one:p,options:i,patch:yj,wrap:xj};return zd(t,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(ud.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:E,...B}=v,j=Yl(B);return j.children=h.all(v),j}return Yl(v)}return(h.options.unknownHandler||bj)(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=qg(w.value)),!Array.isArray(w)&&w.type==="element")){const E=w.children[0];E&&E.type==="text"&&(E.value=qg(E.value))}Array.isArray(w)?y.push(...w):y.push(w)}}}return y}}function yj(t,r){t.position&&(r.position=ak(t))}function vj(t,r){let i=r;if(t&&t.data){const s=t.data.hName,o=t.data.hChildren,c=t.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,Yl(c)),"children"in i&&i.children&&o!==null&&o!==void 0&&(i.children=o)}return i}function bj(t,r){const i=r.data||{},s="value"in r&&!(ud.call(i,"hProperties")||ud.call(i,"hChildren"))?{type:"text",value:r.value}:{type:"element",tagName:"div",properties:{},children:t.all(r)};return t.patch(r,s),t.applyData(r,s)}function xj(t,r){const i=[];let s=-1;for(r&&i.push({type:"text",value:`
|
|
22
|
+
`});++s<t.length;)s&&i.push({type:"text",value:`
|
|
23
|
+
`}),i.push(t[s]);return r&&t.length>0&&i.push({type:"text",value:`
|
|
24
|
+
`}),i}function qg(t){let r=0,i=t.charCodeAt(r);for(;i===9||i===32;)r++,i=t.charCodeAt(r);return t.slice(r)}function $g(t,r){const i=gj(t,r),s=i.one(t,void 0),o=sj(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 Sj(t,r){return t&&"run"in t?async function(i,s){const o=$g(i,{file:s,...r});await t.run(o,s)}:function(i,s){return $g(i,{file:s,...t||r})}}function Gg(t){if(t)throw t}var Bc,Fg;function kj(){if(Fg)return Bc;Fg=1;var t=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=t.call(g,"constructor"),y=g.constructor&&g.constructor.prototype&&t.call(g.constructor.prototype,"isPrototypeOf");if(g.constructor&&!v&&!y)return!1;var k;for(k in g);return typeof k>"u"||t.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(t.call(g,v)){if(s)return s(g,v).value}else return;return g[v]};return Bc=function p(){var g,v,y,k,b,w,E=arguments[0],B=1,j=arguments.length,I=!1;for(typeof E=="boolean"&&(I=E,E=arguments[1]||{},B=2),(E==null||typeof E!="object"&&typeof E!="function")&&(E={});B<j;++B)if(g=arguments[B],g!=null)for(v in g)y=h(E,v),k=h(g,v),E!==k&&(I&&k&&(c(k)||(b=o(k)))?(b?(b=!1,w=y&&o(y)?y:[]):w=y&&c(y)?y:{},d(E,{name:v,newValue:p(I,w,k)})):typeof k<"u"&&d(E,{name:v,newValue:k}));return E},Bc}var wj=kj();const Hc=vd(wj);function cd(t){if(typeof t!="object"||t===null)return!1;const r=Object.getPrototypeOf(t);return(r===null||r===Object.prototype||Object.getPrototypeOf(r)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function Cj(){const t=[],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=t[++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?jj(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 t.push(o),r}}function jj(t,r){let i;return s;function s(...d){const h=t.length>d.length;let p;h&&d.push(o);try{p=t.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 Fn={basename:Rj,dirname:Tj,extname:Ej,join:Nj,sep:"/"};function Rj(t,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');xs(t);let i=0,s=-1,o=t.length,c;if(r===void 0||r.length===0||r.length>t.length){for(;o--;)if(t.codePointAt(o)===47){if(c){i=o+1;break}}else s<0&&(c=!0,s=o+1);return s<0?"":t.slice(i,s)}if(r===t)return"";let d=-1,h=r.length-1;for(;o--;)if(t.codePointAt(o)===47){if(c){i=o+1;break}}else d<0&&(c=!0,d=o+1),h>-1&&(t.codePointAt(o)===r.codePointAt(h--)?h<0&&(s=o):(h=-1,s=d));return i===s?s=d:s<0&&(s=t.length),t.slice(i,s)}function Tj(t){if(xs(t),t.length===0)return".";let r=-1,i=t.length,s;for(;--i;)if(t.codePointAt(i)===47){if(s){r=i;break}}else s||(s=!0);return r<0?t.codePointAt(0)===47?"/":".":r===1&&t.codePointAt(0)===47?"//":t.slice(0,r)}function Ej(t){xs(t);let r=t.length,i=-1,s=0,o=-1,c=0,d;for(;r--;){const h=t.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?"":t.slice(o,i)}function Nj(...t){let r=-1,i;for(;++r<t.length;)xs(t[r]),t[r]&&(i=i===void 0?t[r]:i+"/"+t[r]);return i===void 0?".":Aj(i)}function Aj(t){xs(t);const r=t.codePointAt(0)===47;let i=Ij(t,!r);return i.length===0&&!r&&(i="."),i.length>0&&t.codePointAt(t.length-1)===47&&(i+="/"),r?"/"+i:i}function Ij(t,r){let i="",s=0,o=-1,c=0,d=-1,h,p;for(;++d<=t.length;){if(d<t.length)h=t.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+="/"+t.slice(o+1,d):i=t.slice(o+1,d),s=d-o-1;o=d,c=0}else h===46&&c>-1?c++:c=-1}return i}function xs(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const Dj={cwd:Oj};function Oj(){return"/"}function dd(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function Mj(t){if(typeof t=="string")t=new URL(t);else if(!dd(t)){const r=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw r.code="ERR_INVALID_ARG_TYPE",r}if(t.protocol!=="file:"){const r=new TypeError("The URL must be of scheme file");throw r.code="ERR_INVALID_URL_SCHEME",r}return _j(t)}function _j(t){if(t.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=t.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 Uc=["history","path","basename","stem","extname","dirname"];class _v{constructor(r){let i;r?dd(r)?i={path:r}:typeof r=="string"||Lj(r)?i={value:r}:i=r:i={},this.cwd="cwd"in i?"":Dj.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Uc.length;){const c=Uc[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)Uc.includes(o)||(this[o]=i[o])}get basename(){return typeof this.path=="string"?Fn.basename(this.path):void 0}set basename(r){$c(r,"basename"),qc(r,"basename"),this.path=Fn.join(this.dirname||"",r)}get dirname(){return typeof this.path=="string"?Fn.dirname(this.path):void 0}set dirname(r){Vg(this.basename,"dirname"),this.path=Fn.join(r||"",this.basename)}get extname(){return typeof this.path=="string"?Fn.extname(this.path):void 0}set extname(r){if(qc(r,"extname"),Vg(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=Fn.join(this.dirname,this.stem+(r||""))}get path(){return this.history[this.history.length-1]}set path(r){dd(r)&&(r=Mj(r)),$c(r,"path"),this.path!==r&&this.history.push(r)}get stem(){return typeof this.path=="string"?Fn.basename(this.path,this.extname):void 0}set stem(r){$c(r,"stem"),qc(r,"stem"),this.path=Fn.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 Ft(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 qc(t,r){if(t&&t.includes(Fn.sep))throw new Error("`"+r+"` cannot be a path: did not expect `"+Fn.sep+"`")}function $c(t,r){if(!t)throw new Error("`"+r+"` cannot be empty")}function Vg(t,r){if(!t)throw new Error("Setting `"+r+"` requires `path` to be set too")}function Lj(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const zj=(function(t){const s=this.constructor.prototype,o=s[t],c=function(){return o.apply(c,arguments)};return Object.setPrototypeOf(c,s),c}),Bj={}.hasOwnProperty;class Bd extends zj{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=Cj()}copy(){const r=new Bd;let i=-1;for(;++i<this.attachers.length;){const s=this.attachers[i];r.use(...s)}return r.data(Hc(!0,{},this.namespace)),r}data(r,i){return typeof r=="string"?arguments.length===2?(Vc("data",this.frozen),this.namespace[r]=i,this):Bj.call(this.namespace,r)&&this.namespace[r]||void 0:r?(Vc("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=Ll(r),s=this.parser||this.Parser;return Gc("parse",s),s(String(i),i)}process(r,i){const s=this;return this.freeze(),Gc("process",this.parser||this.Parser),Fc("process",this.compiler||this.Compiler),i?o(void 0,i):new Promise(o);function o(c,d){const h=Ll(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);qj(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(),Gc("processSync",this.parser||this.Parser),Fc("processSync",this.compiler||this.Compiler),this.process(r,o),Yg("processSync","process",i),s;function o(c,d){i=!0,Gg(c),s=d}}run(r,i,s){Pg(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=Ll(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),Yg("runSync","run",s),o;function c(d,h){Gg(d),o=h,s=!0}}stringify(r,i){this.freeze();const s=Ll(i),o=this.compiler||this.Compiler;return Fc("stringify",o),Pg(r),o(r,s)}use(r,...i){const s=this.attachers,o=this.namespace;if(Vc("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=Hc(!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 E=s[k][1];cd(E)&&cd(b)&&(b=Hc(!0,E,b)),s[k]=[g,b,...w]}}}}const Hj=new Bd().freeze();function Gc(t,r){if(typeof r!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Fc(t,r){if(typeof r!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Vc(t,r){if(r)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Pg(t){if(!cd(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function Yg(t,r,i){if(!i)throw new Error("`"+t+"` finished async. Use `"+r+"` instead")}function Ll(t){return Uj(t)?t:new _v(t)}function Uj(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function qj(t){return typeof t=="string"||$j(t)}function $j(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const Gj="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Kg=[],Xg={allowDangerousHtml:!0},Fj=/^(https?|ircs?|mailto|xmpp)$/i,Vj=[{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 Pj(t){const r=Yj(t),i=Kj(t);return Xj(r.runSync(r.parse(i),i),t)}function Yj(t){const r=t.rehypePlugins||Kg,i=t.remarkPlugins||Kg,s=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...Xg}:Xg;return Hj().use(TC).use(i).use(Sj,s).use(r)}function Kj(t){const r=t.children||"",i=new _v;return typeof r=="string"&&(i.value=r),i}function Xj(t,r){const i=r.allowedElements,s=r.allowElement,o=r.components,c=r.disallowedElements,d=r.skipHtml,h=r.unwrapDisallowed,p=r.urlTransform||Qj;for(const v of Vj)Object.hasOwn(r,v.from)&&(""+v.from+(v.to?"use `"+v.to+"` instead":"remove it")+Gj+v.id,void 0);return zd(t,g),ck(t,{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 _c)if(Object.hasOwn(_c,b)&&Object.hasOwn(v.properties,b)){const w=v.properties[b],E=_c[b];(E===null||E.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 Qj(t){const r=t.indexOf(":"),i=t.indexOf("?"),s=t.indexOf("#"),o=t.indexOf("/");return r===-1||o!==-1&&r>o||i!==-1&&r>i||s!==-1&&r>s||Fj.test(t.slice(0,r))?t:""}function Qg(t,r){const i=String(t);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 Zj(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Jj(t,r,i){const o=oo((i||{}).ignore||[]),c=Wj(r);let d=-1;for(;++d<c.length;)Mv(t,"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 B=y.children.indexOf(g);let j=!1,I=[];k.lastIndex=0;let N=k.exec(g.value);for(;N;){const F=N.index,X={index:N.index,input:N.input,stack:[...v,g]};let O=b(...N,X);if(typeof O=="string"&&(O=O.length>0?{type:"text",value:O}:void 0),O===!1?k.lastIndex=F+1:(w!==F&&I.push({type:"text",value:g.value.slice(w,F)}),Array.isArray(O)?I.push(...O):O&&I.push(O),w=F+N[0].length,j=!0),!k.global)break;N=k.exec(g.value)}return j?(w<g.value.length&&I.push({type:"text",value:g.value.slice(w)}),y.children.splice(B,1,...I)):I=[g],B+I.length}}function Wj(t){const r=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");const i=!t[0]||Array.isArray(t[0])?t:[t];let s=-1;for(;++s<i.length;){const o=i[s];r.push([eR(o[0]),tR(o[1])])}return r}function eR(t){return typeof t=="string"?new RegExp(Zj(t),"g"):t}function tR(t){return typeof t=="function"?t:function(){return t}}const Pc="phrasing",Yc=["autolink","link","image","label"];function nR(){return{transforms:[uR],enter:{literalAutolink:iR,literalAutolinkEmail:Kc,literalAutolinkHttp:Kc,literalAutolinkWww:Kc},exit:{literalAutolink:oR,literalAutolinkEmail:lR,literalAutolinkHttp:aR,literalAutolinkWww:sR}}}function rR(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Pc,notInConstruct:Yc},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Pc,notInConstruct:Yc},{character:":",before:"[ps]",after:"\\/",inConstruct:Pc,notInConstruct:Yc}]}}function iR(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function Kc(t){this.config.enter.autolinkProtocol.call(this,t)}function aR(t){this.config.exit.autolinkProtocol.call(this,t)}function sR(t){this.config.exit.data.call(this,t);const r=this.stack[this.stack.length-1];r.type,r.url="http://"+this.sliceSerialize(t)}function lR(t){this.config.exit.autolinkEmail.call(this,t)}function oR(t){this.exit(t)}function uR(t){Jj(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,cR],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),dR]],{ignore:["link","linkReference"]})}function cR(t,r,i,s,o){let c="";if(!Lv(o)||(/^w/i.test(r)&&(i=r+i,r="",c="http://"),!fR(i)))return!1;const d=hR(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 dR(t,r,i,s){return!Lv(s,!0)||/[-\d_]$/.test(i)?!1:{type:"link",title:null,url:"mailto:"+r+"@"+i,children:[{type:"text",value:r+"@"+i}]}}function fR(t){const r=t.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 hR(t){const r=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!r)return[t,void 0];t=t.slice(0,r.index);let i=r[0],s=i.indexOf(")");const o=Qg(t,"(");let c=Qg(t,")");for(;s!==-1&&o>c;)t+=i.slice(0,s+1),i=i.slice(s+1),s=i.indexOf(")"),c++;return[t,i]}function Lv(t,r){const i=t.input.charCodeAt(t.index-1);return(t.index===0||vi(i)||ao(i))&&(!r||i!==47)}zv.peek=kR;function mR(){this.buffer()}function pR(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function gR(){this.buffer()}function yR(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function vR(t){const r=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=Ln(this.sliceSerialize(t)).toLowerCase(),i.label=r}function bR(t){this.exit(t)}function xR(t){const r=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=Ln(this.sliceSerialize(t)).toLowerCase(),i.label=r}function SR(t){this.exit(t)}function kR(){return"["}function zv(t,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(t),{after:"]",before:c})),h(),d(),c+=o.move("]"),c}function wR(){return{enter:{gfmFootnoteCallString:mR,gfmFootnoteCall:pR,gfmFootnoteDefinitionLabelString:gR,gfmFootnoteDefinition:yR},exit:{gfmFootnoteCallString:vR,gfmFootnoteCall:bR,gfmFootnoteDefinitionLabelString:xR,gfmFootnoteDefinition:SR}}}function CR(t){let r=!1;return t&&t.firstLineBlank&&(r=!0),{handlers:{footnoteDefinition:i,footnoteReference:zv},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?Bv:jR))),g(),p}}function jR(t,r,i){return r===0?t:Bv(t,r,i)}function Bv(t,r,i){return(i?"":" ")+t}const RR=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Hv.peek=IR;function TR(){return{canContainEols:["delete"],enter:{strikethrough:NR},exit:{strikethrough:AR}}}function ER(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:RR}],handlers:{delete:Hv}}}function NR(t){this.enter({type:"delete",children:[]},t)}function AR(t){this.exit(t)}function Hv(t,r,i,s){const o=i.createTracker(s),c=i.enter("strikethrough");let d=o.move("~~");return d+=i.containerPhrasing(t,{...o.current(),before:d,after:"~"}),d+=o.move("~~"),c(),d}function IR(){return"~"}function DR(t){return t.length}function OR(t,r){const i=r||{},s=(i.align||[]).concat(),o=i.stringLength||DR,c=[],d=[],h=[],p=[];let g=0,v=-1;for(;++v<t.length;){const E=[],B=[];let j=-1;for(t[v].length>g&&(g=t[v].length);++j<t[v].length;){const I=MR(t[v][j]);if(i.alignDelimiters!==!1){const N=o(I);B[j]=N,(p[j]===void 0||N>p[j])&&(p[j]=N)}E.push(I)}d[v]=E,h[v]=B}let y=-1;if(typeof s=="object"&&"length"in s)for(;++y<g;)c[y]=Zg(s[y]);else{const E=Zg(s);for(;++y<g;)c[y]=E}y=-1;const k=[],b=[];for(;++y<g;){const E=c[y];let B="",j="";E===99?(B=":",j=":"):E===108?B=":":E===114&&(j=":");let I=i.alignDelimiters===!1?1:Math.max(1,p[y]-B.length-j.length);const N=B+"-".repeat(I)+j;i.alignDelimiters!==!1&&(I=B.length+I+j.length,I>p[y]&&(p[y]=I),b[y]=I),k[y]=N}d.splice(1,0,k),h.splice(1,0,b),v=-1;const w=[];for(;++v<d.length;){const E=d[v],B=h[v];y=-1;const j=[];for(;++y<g;){const I=E[y]||"";let N="",F="";if(i.alignDelimiters!==!1){const X=p[y]-(B[y]||0),O=c[y];O===114?N=" ".repeat(X):O===99?X%2?(N=" ".repeat(X/2+.5),F=" ".repeat(X/2-.5)):(N=" ".repeat(X/2),F=N):F=" ".repeat(X)}i.delimiterStart!==!1&&!y&&j.push("|"),i.padding!==!1&&!(i.alignDelimiters===!1&&I==="")&&(i.delimiterStart!==!1||y)&&j.push(" "),i.alignDelimiters!==!1&&j.push(N),j.push(I),i.alignDelimiters!==!1&&j.push(F),i.padding!==!1&&j.push(" "),(i.delimiterEnd!==!1||y!==g-1)&&j.push("|")}w.push(i.delimiterEnd===!1?j.join("").replace(/ +$/,""):j.join(""))}return w.join(`
|
|
27
|
+
`)}function MR(t){return t==null?"":String(t)}function Zg(t){const r=typeof t=="string"?t.codePointAt(0):0;return r===67||r===99?99:r===76||r===108?108:r===82||r===114?114:0}function _R(t,r,i,s){const o=i.enter("blockquote"),c=i.createTracker(s);c.move("> "),c.shift(2);const d=i.indentLines(i.containerFlow(t,c.current()),LR);return o(),d}function LR(t,r,i){return">"+(i?"":" ")+t}function zR(t,r){return Jg(t,r.inConstruct,!0)&&!Jg(t,r.notInConstruct,!1)}function Jg(t,r,i){if(typeof r=="string"&&(r=[r]),!r||r.length===0)return i;let s=-1;for(;++s<r.length;)if(t.includes(r[s]))return!0;return!1}function Wg(t,r,i,s){let o=-1;for(;++o<i.unsafe.length;)if(i.unsafe[o].character===`
|
|
28
|
+
`&&zR(i.stack,i.unsafe[o]))return/[ \t]/.test(s.before)?"":" ";return`\\
|
|
29
|
+
`}function BR(t,r){const i=String(t);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 HR(t,r){return!!(r.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function UR(t){const r=t.options.fence||"`";if(r!=="`"&&r!=="~")throw new Error("Cannot serialize code with `"+r+"` for `options.fence`, expected `` ` `` or `~`");return r}function qR(t,r,i,s){const o=UR(i),c=t.value||"",d=o==="`"?"GraveAccent":"Tilde";if(HR(t,i)){const y=i.enter("codeIndented"),k=i.indentLines(c,$R);return y(),k}const h=i.createTracker(s),p=o.repeat(Math.max(BR(c,o)+1,3)),g=i.enter("codeFenced");let v=h.move(p);if(t.lang){const y=i.enter(`codeFencedLang${d}`);v+=h.move(i.safe(t.lang,{before:v,after:" ",encode:["`"],...h.current()})),y()}if(t.lang&&t.meta){const y=i.enter(`codeFencedMeta${d}`);v+=h.move(" "),v+=h.move(i.safe(t.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 $R(t,r,i){return(i?"":" ")+t}function Hd(t){const r=t.options.quote||'"';if(r!=='"'&&r!=="'")throw new Error("Cannot serialize title with `"+r+"` for `options.quote`, expected `\"`, or `'`");return r}function GR(t,r,i,s){const o=Hd(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(t),{before:g,after:"]",...p.current()})),g+=p.move("]: "),h(),!t.url||/[\0- \u007F]/.test(t.url)?(h=i.enter("destinationLiteral"),g+=p.move("<"),g+=p.move(i.safe(t.url,{before:g,after:">",...p.current()})),g+=p.move(">")):(h=i.enter("destinationRaw"),g+=p.move(i.safe(t.url,{before:g,after:t.title?" ":`
|
|
33
|
+
`,...p.current()}))),h(),t.title&&(h=i.enter(`title${c}`),g+=p.move(" "+o),g+=p.move(i.safe(t.title,{before:g,after:o,...p.current()})),g+=p.move(o),h()),d(),g}function FR(t){const r=t.options.emphasis||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize emphasis with `"+r+"` for `options.emphasis`, expected `*`, or `_`");return r}function ys(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Kl(t,r,i){const s=da(t),o=da(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}}Uv.peek=VR;function Uv(t,r,i,s){const o=FR(i),c=i.enter("emphasis"),d=i.createTracker(s),h=d.move(o);let p=d.move(i.containerPhrasing(t,{after:o,before:h,...d.current()}));const g=p.charCodeAt(0),v=Kl(s.before.charCodeAt(s.before.length-1),g,o);v.inside&&(p=ys(g)+p.slice(1));const y=p.charCodeAt(p.length-1),k=Kl(s.after.charCodeAt(0),y,o);k.inside&&(p=p.slice(0,-1)+ys(y));const b=d.move(o);return c(),i.attentionEncodeSurroundingInfo={after:k.outside,before:v.outside},h+p+b}function VR(t,r,i){return i.options.emphasis||"*"}function PR(t,r){let i=!1;return zd(t,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return i=!0,od}),!!((!t.depth||t.depth<3)&&Ad(t)&&(r.options.setext||i))}function YR(t,r,i,s){const o=Math.max(Math.min(6,t.depth||1),1),c=i.createTracker(s);if(PR(t,i)){const v=i.enter("headingSetext"),y=i.enter("phrasing"),k=i.containerPhrasing(t,{...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(t,{before:"# ",after:`
|
|
38
|
+
`,...c.current()});return/^[\t ]/.test(g)&&(g=ys(g.charCodeAt(0))+g.slice(1)),g=g?d+" "+g:d,i.options.closeAtx&&(g+=" "+d),p(),h(),g}qv.peek=KR;function qv(t){return t.value||""}function KR(){return"<"}$v.peek=XR;function $v(t,r,i,s){const o=Hd(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(t.alt,{before:g,after:"]",...p.current()})),g+=p.move("]("),h(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(h=i.enter("destinationLiteral"),g+=p.move("<"),g+=p.move(i.safe(t.url,{before:g,after:">",...p.current()})),g+=p.move(">")):(h=i.enter("destinationRaw"),g+=p.move(i.safe(t.url,{before:g,after:t.title?" ":")",...p.current()}))),h(),t.title&&(h=i.enter(`title${c}`),g+=p.move(" "+o),g+=p.move(i.safe(t.title,{before:g,after:o,...p.current()})),g+=p.move(o),h()),g+=p.move(")"),d(),g}function XR(){return"!"}Gv.peek=QR;function Gv(t,r,i,s){const o=t.referenceType,c=i.enter("imageReference");let d=i.enter("label");const h=i.createTracker(s);let p=h.move("![");const g=i.safe(t.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(t),{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 QR(){return"!"}Fv.peek=ZR;function Fv(t,r,i){let s=t.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 ZR(){return"`"}function Vv(t,r){const i=Ad(t);return!!(!r.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(i===t.url||"mailto:"+i===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}Pv.peek=JR;function Pv(t,r,i,s){const o=Hd(i),c=o==='"'?"Quote":"Apostrophe",d=i.createTracker(s);let h,p;if(Vv(t,i)){const v=i.stack;i.stack=[],h=i.enter("autolink");let y=d.move("<");return y+=d.move(i.containerPhrasing(t,{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(t,{before:g,after:"](",...d.current()})),g+=d.move("]("),p(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(p=i.enter("destinationLiteral"),g+=d.move("<"),g+=d.move(i.safe(t.url,{before:g,after:">",...d.current()})),g+=d.move(">")):(p=i.enter("destinationRaw"),g+=d.move(i.safe(t.url,{before:g,after:t.title?" ":")",...d.current()}))),p(),t.title&&(p=i.enter(`title${c}`),g+=d.move(" "+o),g+=d.move(i.safe(t.title,{before:g,after:o,...d.current()})),g+=d.move(o),p()),g+=d.move(")"),h(),g}function JR(t,r,i){return Vv(t,i)?"<":"["}Yv.peek=WR;function Yv(t,r,i,s){const o=t.referenceType,c=i.enter("linkReference");let d=i.enter("label");const h=i.createTracker(s);let p=h.move("[");const g=i.containerPhrasing(t,{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(t),{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 WR(){return"["}function Ud(t){const r=t.options.bullet||"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bullet`, expected `*`, `+`, or `-`");return r}function eT(t){const r=Ud(t),i=t.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 tT(t){const r=t.options.bulletOrdered||".";if(r!=="."&&r!==")")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOrdered`, expected `.` or `)`");return r}function Kv(t){const r=t.options.rule||"*";if(r!=="*"&&r!=="-"&&r!=="_")throw new Error("Cannot serialize rules with `"+r+"` for `options.rule`, expected `*`, `-`, or `_`");return r}function nT(t,r,i,s){const o=i.enter("list"),c=i.bulletCurrent;let d=t.ordered?tT(i):Ud(i);const h=t.ordered?d==="."?")":".":eT(i);let p=r&&i.bulletLastUsed?d===i.bulletLastUsed:!1;if(!t.ordered){const v=t.children?t.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),Kv(i)===d&&v){let y=-1;for(;++y<t.children.length;){const k=t.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(t,s);return i.bulletLastUsed=d,i.bulletCurrent=c,o(),g}function rT(t){const r=t.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 iT(t,r,i,s){const o=rT(i);let c=i.bulletCurrent||Ud(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(t))+c);let d=c.length+1;(o==="tab"||o==="mixed"&&(r&&r.type==="list"&&r.spread||t.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(t,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 aT(t,r,i,s){const o=i.enter("paragraph"),c=i.enter("phrasing"),d=i.containerPhrasing(t,s);return c(),o(),d}const sT=oo(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function lT(t,r,i,s){return(t.children.some(function(d){return sT(d)})?i.containerPhrasing:i.containerFlow).call(i,t,s)}function oT(t){const r=t.options.strong||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize strong with `"+r+"` for `options.strong`, expected `*`, or `_`");return r}Xv.peek=uT;function Xv(t,r,i,s){const o=oT(i),c=i.enter("strong"),d=i.createTracker(s),h=d.move(o+o);let p=d.move(i.containerPhrasing(t,{after:o,before:h,...d.current()}));const g=p.charCodeAt(0),v=Kl(s.before.charCodeAt(s.before.length-1),g,o);v.inside&&(p=ys(g)+p.slice(1));const y=p.charCodeAt(p.length-1),k=Kl(s.after.charCodeAt(0),y,o);k.inside&&(p=p.slice(0,-1)+ys(y));const b=d.move(o+o);return c(),i.attentionEncodeSurroundingInfo={after:k.outside,before:v.outside},h+p+b}function uT(t,r,i){return i.options.strong||"*"}function cT(t,r,i,s){return i.safe(t.value,s)}function dT(t){const r=t.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 fT(t,r,i){const s=(Kv(i)+(i.options.ruleSpaces?" ":"")).repeat(dT(i));return i.options.ruleSpaces?s.slice(0,-1):s}const Qv={blockquote:_R,break:Wg,code:qR,definition:GR,emphasis:Uv,hardBreak:Wg,heading:YR,html:qv,image:$v,imageReference:Gv,inlineCode:Fv,link:Pv,linkReference:Yv,list:nT,listItem:iT,paragraph:aT,root:lT,strong:Xv,text:cT,thematicBreak:fT};function hT(){return{enter:{table:mT,tableData:ey,tableHeader:ey,tableRow:gT},exit:{codeText:yT,table:pT,tableData:Xc,tableHeader:Xc,tableRow:Xc}}}function mT(t){const r=t._align;this.enter({type:"table",align:r.map(function(i){return i==="none"?null:i}),children:[]},t),this.data.inTable=!0}function pT(t){this.exit(t),this.data.inTable=void 0}function gT(t){this.enter({type:"tableRow",children:[]},t)}function Xc(t){this.exit(t)}function ey(t){this.enter({type:"tableCell",children:[]},t)}function yT(t){let r=this.resume();this.data.inTable&&(r=r.replace(/\\([\\|])/g,vT));const i=this.stack[this.stack.length-1];i.type,i.value=r,this.exit(t)}function vT(t,r){return r==="|"?r:t}function bT(t){const r=t||{},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,E,B){return g(v(b,E,B),b.align)}function h(b,w,E,B){const j=y(b,E,B),I=g([j]);return I.slice(0,I.indexOf(`
|
|
40
|
+
`))}function p(b,w,E,B){const j=E.enter("tableCell"),I=E.enter("phrasing"),N=E.containerPhrasing(b,{...B,before:c,after:c});return I(),j(),N}function g(b,w){return OR(b,{align:w,alignDelimiters:s,padding:i,stringLength:o})}function v(b,w,E){const B=b.children;let j=-1;const I=[],N=w.enter("table");for(;++j<B.length;)I[j]=y(B[j],w,E);return N(),I}function y(b,w,E){const B=b.children;let j=-1;const I=[],N=w.enter("tableRow");for(;++j<B.length;)I[j]=p(B[j],b,w,E);return N(),I}function k(b,w,E){let B=Qv.inlineCode(b,w,E);return E.stack.includes("tableCell")&&(B=B.replace(/\|/g,"\\$&")),B}}function xT(){return{exit:{taskListCheckValueChecked:ty,taskListCheckValueUnchecked:ty,paragraph:kT}}}function ST(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:wT}}}function ty(t){const r=this.stack[this.stack.length-2];r.type,r.checked=t.type==="taskListCheckValueChecked"}function kT(t){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(t)}function wT(t,r,i,s){const o=t.children[0],c=typeof t.checked=="boolean"&&o&&o.type==="paragraph",d="["+(t.checked?"x":" ")+"] ",h=i.createTracker(s);c&&h.move(d);let p=Qv.listItem(t,r,i,{...s,...h.current()});return c&&(p=p.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,g)),p;function g(v){return v+d}}function CT(){return[nR(),wR(),TR(),hT(),xT()]}function jT(t){return{extensions:[rR(),CR(t),ER(),bT(t),ST()]}}const RT={tokenize:DT,partial:!0},Zv={tokenize:OT,partial:!0},Jv={tokenize:MT,partial:!0},Wv={tokenize:_T,partial:!0},TT={tokenize:LT,partial:!0},eb={name:"wwwAutolink",tokenize:AT,previous:nb},tb={name:"protocolAutolink",tokenize:IT,previous:rb},pr={name:"emailAutolink",tokenize:NT,previous:ib},Pn={};function ET(){return{text:Pn}}let di=48;for(;di<123;)Pn[di]=pr,di++,di===58?di=65:di===91&&(di=97);Pn[43]=pr;Pn[45]=pr;Pn[46]=pr;Pn[95]=pr;Pn[72]=[pr,tb];Pn[104]=[pr,tb];Pn[87]=[pr,eb];Pn[119]=[pr,eb];function NT(t,r,i){const s=this;let o,c;return d;function d(y){return!fd(y)||!ib.call(s,s.previous)||qd(s.events)?i(y):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),h(y))}function h(y){return fd(y)?(t.consume(y),h):y===64?(t.consume(y),p):i(y)}function p(y){return y===46?t.check(TT,v,g)(y):y===45||y===95||Gt(y)?(c=!0,t.consume(y),p):v(y)}function g(y){return t.consume(y),o=!0,p}function v(y){return c&&o&&Kt(s.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),r(y)):i(y)}}function AT(t,r,i){const s=this;return o;function o(d){return d!==87&&d!==119||!nb.call(s,s.previous)||qd(s.events)?i(d):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(RT,t.attempt(Zv,t.attempt(Jv,c),i),i)(d))}function c(d){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),r(d)}}function IT(t,r,i){const s=this;let o="",c=!1;return d;function d(y){return(y===72||y===104)&&rb.call(s,s.previous)&&!qd(s.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),o+=String.fromCodePoint(y),t.consume(y),h):i(y)}function h(y){if(Kt(y)&&o.length<5)return o+=String.fromCodePoint(y),t.consume(y),h;if(y===58){const k=o.toLowerCase();if(k==="http"||k==="https")return t.consume(y),p}return i(y)}function p(y){return y===47?(t.consume(y),c?g:(c=!0,p)):i(y)}function g(y){return y===null||Vl(y)||st(y)||vi(y)||ao(y)?i(y):t.attempt(Zv,t.attempt(Jv,v),i)(y)}function v(y){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),r(y)}}function DT(t,r,i){let s=0;return o;function o(d){return(d===87||d===119)&&s<3?(s++,t.consume(d),o):d===46&&s===3?(t.consume(d),c):i(d)}function c(d){return d===null?i(d):r(d)}}function OT(t,r,i){let s,o,c;return d;function d(g){return g===46||g===95?t.check(Wv,p,h)(g):g===null||st(g)||vi(g)||g!==45&&ao(g)?p(g):(c=!0,t.consume(g),d)}function h(g){return g===95?s=!0:(o=s,s=void 0),t.consume(g),d}function p(g){return o||s||!c?i(g):r(g)}}function MT(t,r){let i=0,s=0;return o;function o(d){return d===40?(i++,t.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?t.check(Wv,r,c)(d):d===null||st(d)||vi(d)?r(d):(t.consume(d),o)}function c(d){return d===41&&s++,t.consume(d),o}}function _T(t,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?(t.consume(h),s):h===38?(t.consume(h),c):h===93?(t.consume(h),o):h===60||h===null||st(h)||vi(h)?r(h):i(h)}function o(h){return h===null||h===40||h===91||st(h)||vi(h)?r(h):s(h)}function c(h){return Kt(h)?d(h):i(h)}function d(h){return h===59?(t.consume(h),s):Kt(h)?(t.consume(h),d):i(h)}}function LT(t,r,i){return s;function s(c){return t.consume(c),o}function o(c){return Gt(c)?i(c):r(c)}}function nb(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||st(t)}function rb(t){return!Kt(t)}function ib(t){return!(t===47||fd(t))}function fd(t){return t===43||t===45||t===46||t===95||Gt(t)}function qd(t){let r=t.length,i=!1;for(;r--;){const s=t[r][1];if((s.type==="labelLink"||s.type==="labelImage")&&!s._balanced){i=!0;break}if(s._gfmAutolinkLiteralWalkedInto){i=!1;break}}return t.length>0&&!i&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),i}const zT={tokenize:VT,partial:!0};function BT(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:$T,continuation:{tokenize:GT},exit:FT}},text:{91:{name:"gfmFootnoteCall",tokenize:qT},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:HT,resolveTo:UT}}}}function HT(t,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=Ln(s.sliceSerialize({start:d.end,end:s.now()}));return g.codePointAt(0)!==94||!c.includes(g.slice(1))?i(p):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(p),t.exit("gfmFootnoteCallLabelMarker"),r(p))}}function UT(t,r){let i=t.length;for(;i--;)if(t[i][1].type==="labelImage"&&t[i][0]==="enter"){t[i][1];break}t[i+1][1].type="data",t[i+3][1].type="gfmFootnoteCallLabelMarker";const s={type:"gfmFootnoteCall",start:Object.assign({},t[i+3][1].start),end:Object.assign({},t[t.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},t[i+3][1].end),end:Object.assign({},t[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({},t[t.length-1][1].start)},d={type:"chunkString",contentType:"string",start:Object.assign({},c.start),end:Object.assign({},c.end)},h=[t[i+1],t[i+2],["enter",s,r],t[i+3],t[i+4],["enter",o,r],["exit",o,r],["enter",c,r],["enter",d,r],["exit",d,r],["exit",c,r],t[t.length-2],t[t.length-1],["exit",s,r]];return t.splice(i,t.length-i+1,...h),t}function qT(t,r,i){const s=this,o=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let c=0,d;return h;function h(y){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(y),t.exit("gfmFootnoteCallLabelMarker"),p}function p(y){return y!==94?i(y):(t.enter("gfmFootnoteCallMarker"),t.consume(y),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",g)}function g(y){if(c>999||y===93&&!d||y===null||y===91||st(y))return i(y);if(y===93){t.exit("chunkString");const k=t.exit("gfmFootnoteCallString");return o.includes(Ln(s.sliceSerialize(k)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(y),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),r):i(y)}return st(y)||(d=!0),c++,t.consume(y),y===92?v:g}function v(y){return y===91||y===92||y===93?(t.consume(y),c++,g):g(y)}}function $T(t,r,i){const s=this,o=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let c,d=0,h;return p;function p(w){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(w),t.exit("gfmFootnoteDefinitionLabelMarker"),g}function g(w){return w===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(w),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",v):i(w)}function v(w){if(d>999||w===93&&!h||w===null||w===91||st(w))return i(w);if(w===93){t.exit("chunkString");const E=t.exit("gfmFootnoteDefinitionLabelString");return c=Ln(s.sliceSerialize(E)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(w),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),k}return st(w)||(h=!0),d++,t.consume(w),w===92?y:v}function y(w){return w===91||w===92||w===93?(t.consume(w),d++,v):v(w)}function k(w){return w===58?(t.enter("definitionMarker"),t.consume(w),t.exit("definitionMarker"),o.includes(c)||o.push(c),Ye(t,b,"gfmFootnoteDefinitionWhitespace")):i(w)}function b(w){return r(w)}}function GT(t,r,i){return t.check(bs,r,t.attempt(zT,r,i))}function FT(t){t.exit("gfmFootnoteDefinition")}function VT(t,r,i){const s=this;return Ye(t,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 PT(t){let i=(t||{}).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&&vn(k,k.length,0,so(b,d.slice(g+1,p),h)),vn(k,k.length,0,[["exit",y,h],["enter",d[p][1],h],["exit",d[p][1],h],["exit",v,h]]),vn(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 E=da(g);if(w===126)return y>1?p(w):(d.consume(w),y++,b);if(y<2&&!i)return p(w);const B=d.exit("strikethroughSequenceTemporary"),j=da(w);return B._open=!j||j===2&&!!E,B._close=!E||E===2&&!!j,h(w)}}}class YT{constructor(){this.map=[]}add(r,i,s){KT(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 KT(t,r,i,s){let o=0;if(!(i===0&&s.length===0)){for(;o<t.map.length;){if(t.map[o][0]===r){t.map[o][1]+=i,t.map[o][2].push(...s);return}o+=1}t.map.push([r,i,s])}}function XT(t,r){let i=!1;const s=[];for(;r<t.length;){const o=t[r];if(i){if(o[0]==="enter")o[1].type==="tableContent"&&s.push(t[r+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(t[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 QT(){return{flow:{null:{name:"table",tokenize:ZT,resolveAll:JT}}}}function ZT(t,r,i){const s=this;let o=0,c=0,d;return h;function h(M){let P=s.events.length-1;for(;P>-1;){const G=s.events[P][1].type;if(G==="lineEnding"||G==="linePrefix")P--;else break}const $=P>-1?s.events[P][1].type:null,te=$==="tableHead"||$==="tableRow"?O:p;return te===O&&s.parser.lazy[s.now().line]?i(M):te(M)}function p(M){return t.enter("tableHead"),t.enter("tableRow"),g(M)}function g(M){return M===124||(d=!0,c+=1),v(M)}function v(M){return M===null?i(M):Se(M)?c>1?(c=0,s.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(M),t.exit("lineEnding"),b):i(M):qe(M)?Ye(t,v,"whitespace")(M):(c+=1,d&&(d=!1,o+=1),M===124?(t.enter("tableCellDivider"),t.consume(M),t.exit("tableCellDivider"),d=!0,v):(t.enter("data"),y(M)))}function y(M){return M===null||M===124||st(M)?(t.exit("data"),v(M)):(t.consume(M),M===92?k:y)}function k(M){return M===92||M===124?(t.consume(M),y):y(M)}function b(M){return s.interrupt=!1,s.parser.lazy[s.now().line]?i(M):(t.enter("tableDelimiterRow"),d=!1,qe(M)?Ye(t,w,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):w(M))}function w(M){return M===45||M===58?B(M):M===124?(d=!0,t.enter("tableCellDivider"),t.consume(M),t.exit("tableCellDivider"),E):X(M)}function E(M){return qe(M)?Ye(t,B,"whitespace")(M):B(M)}function B(M){return M===58?(c+=1,d=!0,t.enter("tableDelimiterMarker"),t.consume(M),t.exit("tableDelimiterMarker"),j):M===45?(c+=1,j(M)):M===null||Se(M)?F(M):X(M)}function j(M){return M===45?(t.enter("tableDelimiterFiller"),I(M)):X(M)}function I(M){return M===45?(t.consume(M),I):M===58?(d=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(M),t.exit("tableDelimiterMarker"),N):(t.exit("tableDelimiterFiller"),N(M))}function N(M){return qe(M)?Ye(t,F,"whitespace")(M):F(M)}function F(M){return M===124?w(M):M===null||Se(M)?!d||o!==c?X(M):(t.exit("tableDelimiterRow"),t.exit("tableHead"),r(M)):X(M)}function X(M){return i(M)}function O(M){return t.enter("tableRow"),Y(M)}function Y(M){return M===124?(t.enter("tableCellDivider"),t.consume(M),t.exit("tableCellDivider"),Y):M===null||Se(M)?(t.exit("tableRow"),r(M)):qe(M)?Ye(t,Y,"whitespace")(M):(t.enter("data"),V(M))}function V(M){return M===null||M===124||st(M)?(t.exit("data"),Y(M)):(t.consume(M),M===92?ae:V)}function ae(M){return M===92||M===124?(t.consume(M),V):V(M)}}function JT(t,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 YT;for(;++i<t.length;){const b=t[i],w=b[1];b[0]==="enter"?w.type==="tableHead"?(h=!1,p!==0&&(ny(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=zl(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=zl(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=zl(k,r,c,o,i,y)):d[1]!==0&&(y=zl(k,r,d,o,i,y)),o=0):o&&(w.type==="data"||w.type==="tableDelimiterMarker"||w.type==="tableDelimiterFiller")&&(d[3]=i)}for(p!==0&&ny(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=XT(r.events,i))}return t}function zl(t,r,i,s,o,c){const d=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",h="tableContent";i[0]!==0&&(c.end=Object.assign({},sa(r.events,i[0])),t.add(i[0],0,[["exit",c,r]]));const p=sa(r.events,i[1]);if(c={type:d,start:Object.assign({},p),end:Object.assign({},p)},t.add(i[1],0,[["enter",c,r]]),i[2]!==0){const g=sa(r.events,i[2]),v=sa(r.events,i[3]),y={type:h,start:Object.assign({},g),end:Object.assign({},v)};if(t.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,E=i[3]-i[2]-1;t.add(w,E,[])}}t.add(i[3]+1,0,[["exit",y,r]])}return o!==void 0&&(c.end=Object.assign({},sa(r.events,o)),t.add(o,0,[["exit",c,r]]),c=void 0),c}function ny(t,r,i,s,o){const c=[],d=sa(r.events,i);o&&(o.end=Object.assign({},d),c.push(["exit",o,r])),s.end=Object.assign({},d),c.push(["exit",s,r]),t.add(i+1,0,c)}function sa(t,r){const i=t[r],s=i[0]==="enter"?"start":"end";return i[1][s]}const WT={name:"tasklistCheck",tokenize:tE};function eE(){return{text:{91:WT}}}function tE(t,r,i){const s=this;return o;function o(p){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?i(p):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(p),t.exit("taskListCheckMarker"),c)}function c(p){return st(p)?(t.enter("taskListCheckValueUnchecked"),t.consume(p),t.exit("taskListCheckValueUnchecked"),d):p===88||p===120?(t.enter("taskListCheckValueChecked"),t.consume(p),t.exit("taskListCheckValueChecked"),d):i(p)}function d(p){return p===93?(t.enter("taskListCheckMarker"),t.consume(p),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),h):i(p)}function h(p){return Se(p)?r(p):qe(p)?t.check({tokenize:nE},r,i)(p):i(p)}}function nE(t,r,i){return Ye(t,s,"whitespace");function s(o){return o===null?i(o):r(o)}}function rE(t){return mv([ET(),BT(),PT(t),QT(),eE()])}const iE={};function aE(t){const r=this,i=t||iE,s=r.data(),o=s.micromarkExtensions||(s.micromarkExtensions=[]),c=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),d=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);o.push(rE(i)),c.push(CT()),d.push(jT(i))}const ab=/^(javascript|vbscript|data):/i;function sE(t){if(!t)return!1;const r=t.trim();return!(!r||ab.test(r))}function lE(t){if(!t)return!1;const r=t.trim();return!r||ab.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 oE=[[aE,{singleTilde:!1}]];function ry({lang:t,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:t||"text"}),u.jsx("button",{type:"button",className:"oc-codeblock-copy",onClick:o,children:i?"已复制":"复制"})]}),u.jsx("pre",{children:u.jsx("code",{children:r})})]})}const uE={pre({children:t}){return u.jsx(u.Fragment,{children:t})},code({className:t,children:r,...i}){const s=String(r??"").replace(/\n$/,""),o=/language-([\w-]+)/.exec(t??"");return o||t&&s.includes(`
|
|
41
|
+
`)?u.jsx(ry,{lang:o?.[1]??"",text:s}):s.includes(`
|
|
42
|
+
`)?u.jsx(ry,{lang:"",text:s}):u.jsx("code",{className:t,...i,children:r})},a({href:t,children:r,...i}){if(!sE(t))return u.jsx("span",{...i,children:r});const s=/^https?:\/\//i.test(t??"");return u.jsx("a",{href:t,...s?{target:"_blank",rel:"noopener noreferrer"}:{},...i,children:r})},img({src:t,alt:r}){return lE(t)?u.jsxs(u.Fragment,{children:[u.jsx("img",{src:t,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:t??void 0,children:r?`[图片加载失败: ${r}]`:"[图片加载失败]"})]}):u.jsx("span",{className:"oc-md-img-fallback",title:t??void 0,children:r?`[图片: ${r}]`:"[图片已屏蔽]"})},table({children:t}){return u.jsx("div",{className:"oc-md-table-wrap",children:u.jsx("table",{children:t})})},input(t){return t.type==="checkbox"?u.jsx("input",{type:"checkbox",checked:!!t.checked,disabled:!0,readOnly:!0}):u.jsx("input",{...t,disabled:!0,readOnly:!0})}};class cE 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 dE({text:t}){try{return u.jsx(cE,{text:t,children:u.jsx("div",{className:"oc-md",children:u.jsx(Pj,{remarkPlugins:oE,components:uE,children:t})})})}catch{return u.jsx("div",{className:"oc-md",children:u.jsx("pre",{className:"oc-md-fallback",children:t})})}}function fE(){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 hE(){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 mE(){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 pE(){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 $d(){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 gE(){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 hd(t){const[r,i]=S.useState(!1),s=()=>{navigator.clipboard?.writeText(t.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(hE,{}):u.jsx(fE,{})})}function iy(t){const{message:r,streaming:i,activeAssistantId:s}=t,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:Ty(r.createdAt)}),g&&u.jsx(hd,{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(dE,{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 yE(t){if(!(!t||typeof t!="object"))return t}function $r(t){return typeof t=="string"?t:void 0}function co(t){if(!Array.isArray(t))return;const r=[];for(const i of t){const s=yE(i);if(!s)continue;const o=$r(s.type)??"";if(o==="thinking"||o==="reasoning"){const c=$r(s.thinking)??$r(s.text)??"";r.push({type:"thinking",thinking:c});continue}if(o==="toolCall"||o==="tool_call"||o==="toolUse"||o==="tool_use"){const c=$r(s.toolCallId)??$r(s.id)??"";if(!c)continue;const d=$r(s.toolName)??$r(s.name);r.push({type:"toolCall",toolCallId:c,...d?{toolName:d}:{}});continue}if(o==="text"||o==="output_text"||o===""){const c=$r(s.text);c!==void 0&&r.push({type:"text",text:c})}}return r}function vE(t,r={}){return t.type==="thinking"&&!r.isStreaming&&t.thinking.trim()===""}function sb(t,r={}){return t.filter(i=>!vE(i,r))}function bE(t){return t.type==="text"}function xE(t,r={}){const i=sb(t,r);let s=-1;for(let o=i.length-1;o>=0;o--)if(!bE(i[o])){s=o;break}return s===-1?{answerBlocks:i,processBlocks:[]}:{answerBlocks:i.slice(s+1),processBlocks:i.slice(0,s+1)}}function SE(t){return t.filter(r=>r.type==="text").map(r=>r.text).join("")}function ay(t){return{key:t,assistants:[],tools:[],processItems:[],live:!1}}function kE(t){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 t){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=co(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 lb(t,r){const i=c1(r);i?t.push({kind:"activity",activity:i}):t.push({kind:"tool",tool:r})}function sy(t,r,i,s){for(const o of t){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&&(lb(i,c),s.add(c.id))}}function wE(t){const r=new Set,i=[],s=t.assistants.slice(0,-1),o=t.assistants.at(-1);for(const p of s)sy(sb(p.content??[]),t,i,r);const c=o?.content??[],d=xE(c,{isStreaming:t.live});sy(d.processBlocks,t,i,r);for(const p of t.tools)r.has(p.id)||lb(i,p);if(t.processItems=i,!o)return;if(c.length===0){t.answer=o;return}const h=SE(d.answerBlocks);t.answer={...o,text:h,content:d.answerBlocks}}function CE(t){const r=t.messages.filter(h=>h.role==="user"||h.role==="assistant"),i=[];let s=null;const o=h=>{const p=ay(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&&t.toolCalls.length>0&&i.push(ay("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 t.toolCalls)if(h.assistantMessageId){const p=d.get(h.assistantMessageId);p&&(p.tools.push(h),c.add(h.id))}for(const h of t.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 t.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=t.streaming&&t.activeAssistantId!==null&&h.assistants.some(p=>p.id===t.activeAssistantId),wE(h);return i}function jE(t,r){const i=t.length,s=r?.thinkingCount??0,o=r?.textCount??0,c=r?.activityCount??0,d=s+o+c+i,h=t.filter(v=>v.status==="error").length+(r?.activityErrorCount??0),p=t.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 ob(t){const{entry:r}=t,[i,s]=S.useState(r.status==="error"),[o,c]=S.useState(!1),d=r.status==="running"?"运行中":r.status==="error"?"出错":"完成",h=`is-${r.status}`,p=f0(r.args,{toolName:r.toolName}),g=g0(r.createdAt,r.finishedAt),v=h0(r.toolName),y=Ry(r.resultText??r.result),k=p0(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($d,{}),u.jsx("span",{className:"oc-tool-icon","aria-hidden":"true",children:u.jsx(gE,{})}),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:m0(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 RE(t){const{thinking:r,defaultOpen:i}=t,[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($d,{}),u.jsx("span",{children:"思考"})]}),s?u.jsx("pre",{className:"oc-thinking-body",children:r||"…"}):null]})}function TE(t){return t.kind==="progress"?"••":t.kind==="success"?"✓":t.kind==="warning"?"!":"×"}function EE(t){const{activity:r,onActivate:i}=t,s=!!(r.activityRef&&i&&(t.canActivate?.(r.activityRef)??!0)),o=u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"oc-semantic-activity-icon","aria-hidden":"true",children:TE(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 NE(t){const{items:r,defaultOpen:i}=t,[s,o]=S.useState(i),c=r.filter(p=>p.kind==="tool").map(p=>p.tool),d=r.filter(p=>p.kind==="activity"),h=jE(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($d,{}),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(RE,{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(EE,{activity:p.activity,onActivate:t.onActivateActivity,canActivate:t.canActivateActivity},p.activity.id):u.jsx(ob,{entry:p.tool},p.tool.id))}):null]})}function AE(t){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}=t;return u.jsxs("div",{ref:r,className:`oc-messages${o?" has-thread":" is-empty"}`,onScroll:s,children:[o?null:u.jsx(Wy,{mode:"empty-session",readiness:c,disabled:d,onSuggest:t.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 E=b.user??b.assistants[0],B=w>0?y[w-1].user??y[w-1].assistants[0]:void 0,j=!!E&&(!B||Ac(B.createdAt)!==Ac(E.createdAt)),I=b.answer,N=!!I?.text.trim(),F=b.live&&b.processItems.length===0;return u.jsxs("div",{className:"oc-turn-group",children:[j&&E&&u.jsx("div",{className:"oc-day-sep",children:Ac(E.createdAt)}),b.user&&u.jsx(iy,{message:b.user,streaming:d,activeAssistantId:h}),b.processItems.length>0&&u.jsx(NE,{items:b.processItems,defaultOpen:b.live,onActivateActivity:t.onActivateActivity,canActivateActivity:t.canActivateActivity}),I&&(N||F)?u.jsx(iy,{message:I,streaming:d,activeAssistantId:h}):null]},b.key)}),k&&u.jsx(_1,{interview:k,interviewAnswer:t.interviewAnswer,onAnswerChange:t.onInterviewAnswerChange,onAnswer:t.onAnswerInterview,onConfirmTaskKind:t.onConfirmTaskKind}),u.jsx("div",{ref:i})]})}function Vn(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:t.toLocaleString()}function IE(t){const r=[],i=t.inputTokens??0,s=t.outputTokens??0,o=t.cacheReadTokens??0,c=t.cacheWriteTokens??0,d=t.cost??0;if(i>0&&r.push(`${Vn(i)} in`),s>0&&r.push(`${Vn(s)} out`),o>0&&r.push(`${Vn(o)} cache R`),c>0&&r.push(`${Vn(c)} cache W`),d>0&&r.push(d>=.01?`$${d.toFixed(2)}`:"<$0.01"),r.length===0){const h=t.totalTokens??0;return h>0?`${Vn(h)} tokens`:"—"}return r.join(" · ")}const DE={auto:"auto(跟随 Pi 默认等级)",off:"off · 关闭",minimal:"minimal · 极简",low:"low · 低",medium:"medium · 中",high:"high · 高",xhigh:"xhigh · 极高",max:"max · 最高"};function OE(t,r){const i=r.trim().toLowerCase(),s=new Map;for(const o of t){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 ME(t,r){const i=new Set,s=[],o=c=>{i.has(c)||(i.add(c),s.push({value:c,label:DE[c]??c,...c==="auto"&&r?{effective:r}:{}}))};o("auto");for(const c of t)o(c);return s}function Xl(t,r){return`${t}/${r}`}function md(t){return{...t.modelProvider&&t.modelId?{model:{provider:t.modelProvider,modelId:t.modelId}}:{},...t.thinkingLevel?{thinkingLevel:t.thinkingLevel}:{}}}function ub(t,r){return{...t,model:r.model??t.model,thinkingLevel:r.thinkingLevel??t.thinkingLevel}}function _E(t,r){const i=ub(t,r);return i.model?.provider===t.model?.provider&&i.model?.modelId===t.model?.modelId&&i.thinkingLevel===t.thinkingLevel}function LE(){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 zE(t){const r=fa(),[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(I=>({provider:I.provider,id:I.id,...I.name?{name:I.name}:{},...I.hasCredentials!==void 0?{hasCredentials:I.hasCredentials}:{}})):t.models,w=S.useMemo(()=>OE(b,o),[b,o]),E=S.useMemo(()=>w.flatMap(I=>I.models),[w]);S.useEffect(()=>{i&&(c(""),h(0),window.setTimeout(()=>g.current?.focus(),0))},[i]),S.useEffect(()=>{if(!i)return;const I=F=>{const X=p.current;X&&F.target instanceof Node&&!X.contains(F.target)&&s(!1)},N=F=>{F.key==="Escape"&&s(!1)};return document.addEventListener("mousedown",I),document.addEventListener("keydown",N),()=>{document.removeEventListener("mousedown",I),document.removeEventListener("keydown",N)}},[i]);const B=I=>{if(t.disabled)return;const N=E[I];N&&(s(!1),t.onSelect(N.provider,N.id))},j=I=>{if(I.key==="ArrowDown"){I.preventDefault(),h(N=>E.length?(N+1)%E.length:0);return}if(I.key==="ArrowUp"){I.preventDefault(),h(N=>E.length?(N-1+E.length)%E.length:0);return}if(I.key==="Enter"){I.preventDefault(),B(d);return}if(I.key==="Escape"){I.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:t.disabled,onClick:()=>s(I=>!I),children:[u.jsx("span",{className:"oc-select-trigger-label",children:t.triggerLabel}),u.jsx(LE,{})]}),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:I=>{c(I.target.value),h(0)},onKeyDown:j}),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:()=>{ca()},children:"重试"})]}),!y&&!k&&w.length===0&&u.jsx("div",{className:"oc-select-status",children:"当前没有可用模型(真实空态,未伪造列表)"}),w.map(I=>u.jsxs("div",{className:"oc-model-group",children:[u.jsx("div",{className:"oc-model-group-head",children:I.provider}),I.models.map(N=>{const F=Xl(N.provider,N.id),X=F===t.activeModelRef,O=E[d]===N;return u.jsxs("button",{type:"button",role:"option","aria-selected":X,disabled:t.disabled,className:`oc-select-option oc-model-option${O?" is-highlighted":""}${X?" is-active":""}`,onMouseDown:Y=>Y.preventDefault(),onClick:()=>{t.disabled||(s(!1),t.onSelect(N.provider,N.id))},children:[u.jsxs("span",{className:"oc-model-option-name",children:[N.name?`${N.name} · `:"",N.id]}),X&&u.jsx("span",{className:"oc-model-option-check",children:"✓"})]},F)})]},I.provider))]})]})}function BE(){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 HE(t){const r=fa(),[i,s]=S.useState(!1),[o,c]=S.useState(0),d=S.useRef(null),h=t.effectiveLevel??r.snapshot?.selection?.effectiveThinkingLevel,p=r.snapshot?.thinkingLevels?.length?r.snapshot.thinkingLevels.map(k=>k.value):void 0,g=S.useMemo(()=>ME(p??t.levels,h),[p,t.levels,h]);S.useEffect(()=>{i&&c(0)},[i]),S.useEffect(()=>{if(!i)return;const k=w=>{const E=d.current;E&&w.target instanceof Node&&!E.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(t.disabled)return;const b=g[k];b&&(s(!1),t.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:t.disabled,onClick:()=>s(k=>!k),children:[u.jsx("span",{className:"oc-select-trigger-label",children:t.triggerLabel}),u.jsx(BE,{})]}),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===t.activeValue,E=b===o;return u.jsxs("button",{type:"button",role:"option","aria-selected":w,disabled:t.disabled,className:`oc-select-option oc-thinking-option${E?" is-highlighted":""}${w?" is-active":""}`,onMouseDown:B=>B.preventDefault(),onClick:()=>{t.disabled||(s(!1),t.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 Qc="--oc-shortcut-palette-available-height",UE=8,qE=8;function $E(t){const r=t.viewportTop??0,i=t.topInset??UE,s=t.anchorGap??qE;if([t.boundaryTop,t.anchorTop,r,i,s].some(d=>!Number.isFinite(d)))return null;const c=Math.max(t.boundaryTop,r);return Math.max(0,Math.floor(t.anchorTop-c-i-s))}function GE(){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 FE(t){const{composer:r,streaming:i,hasThread:s}=t,o=S.useRef(null),c=fa(),d=c.reloading,h=c.reloadError,g=c.mutationBusy||d||i,v=S.useCallback(()=>{r.setInput(""),r.setShortcutOpen(!1),ua()},[r.setInput,r.setShortcutOpen]),y=S.useCallback(j=>{const I=r.isComposingNow()||j.nativeEvent.isComposing,N=r.recentlyComposedNow();if(j.key==="Enter"&&!j.shiftKey&&!I&&!N){if(r.shortcutOpen&&r.filteredShortcuts.length>0){if((r.filteredShortcuts[r.shortcutIndex]??r.filteredShortcuts[0])?.command==="/reload"){j.preventDefault(),v();return}}else if(r.input.trim()==="/reload"){j.preventDefault(),v();return}}t.onKeyDown(j)},[r.isComposingNow,r.recentlyComposedNow,r.shortcutOpen,r.filteredShortcuts,r.shortcutIndex,r.input,v,t.onKeyDown]),k=S.useCallback((j,I)=>{if(I==="pi-prompt"||j==="/name"||j==="/compact"){r.setInput(`${j} `),r.setShortcutOpen(!1),r.textareaRef.current?.focus();return}if(j==="/reload"){v();return}t.onRunShortcut(j)},[v,t.onRunShortcut,r]),b=S.useCallback(()=>{if(r.input.trim()==="/reload"){v();return}t.onSend(r.input)},[r.input,v,t.onSend]);S.useEffect(()=>{if(!r.shortcutOpen||r.filteredShortcuts.length===0||!t.paletteKeyboardNavRef.current)return;const j=t.shortcutPaletteRef.current;if(!j)return;j.querySelector(`[data-shortcut-index="${r.shortcutIndex}"]`)?.scrollIntoView({block:"nearest",inline:"nearest"}),t.paletteKeyboardNavRef.current=!1},[r.shortcutOpen,r.filteredShortcuts,r.shortcutIndex,t.shortcutPaletteRef,t.paletteKeyboardNavRef]),S.useEffect(()=>{if(!r.shortcutOpen||r.filteredShortcuts.length===0)return;const j=o.current,I=t.shortcutPaletteRef.current,N=j?.closest(".oc-main")??null;if(!j||!I||!N)return;let F=0;const X=()=>{F=0;const V=N.getBoundingClientRect(),ae=j.getBoundingClientRect(),M=$E({boundaryTop:V.top,anchorTop:ae.top,viewportTop:window.visualViewport?.offsetTop??0});if(M===null){I.style.removeProperty(Qc);return}I.style.setProperty(Qc,`${M}px`)},O=()=>{F!==0&&window.cancelAnimationFrame(F),F=window.requestAnimationFrame(X)};X();const Y=typeof ResizeObserver>"u"?null:new ResizeObserver(O);return Y?.observe(N),Y?.observe(j),window.addEventListener("resize",O),window.visualViewport?.addEventListener("resize",O),window.visualViewport?.addEventListener("scroll",O),()=>{F!==0&&window.cancelAnimationFrame(F),Y?.disconnect(),window.removeEventListener("resize",O),window.visualViewport?.removeEventListener("resize",O),window.visualViewport?.removeEventListener("scroll",O),I.style.removeProperty(Qc)}},[r.shortcutOpen,r.filteredShortcuts.length,t.layoutMode,t.shortcutPaletteRef]);const w=(()=>{const j=t.processSummary;return j?j.statusKind==="error"?`查看工具调用记录,共 ${j.count} 次,其中 ${j.statusLabel}`:j.statusKind==="running"?`查看工具调用记录,共 ${j.count} 次,${j.statusLabel||"正在运行"}`:`查看工具调用记录,共 ${j.count} 次,全部已完成`:"查看工具调用记录"})(),E=(()=>{const j=t.usage.inputTokens,I=t.usage.outputTokens,N=t.usage.cacheReadTokens,F=t.usage.cacheWriteTokens,X=t.usage.cost??0,O=[];if(j>0&&O.push(u.jsxs("span",{className:"oc-usage-part is-in",title:"输入 tokens",children:["↑ ",Vn(j)]},"in")),I>0&&O.push(u.jsxs("span",{className:"oc-usage-part is-out",title:"输出 tokens",children:["↓ ",Vn(I)]},"out")),N>0&&O.push(u.jsxs("span",{className:"oc-usage-part",children:[Vn(N)," cache R"]},"cache-read")),F>0&&O.push(u.jsxs("span",{className:"oc-usage-part",children:[Vn(F)," cache W"]},"cache-write")),X>0&&O.push(u.jsx("span",{className:"oc-usage-part",children:X>=.01?`$${X.toFixed(2)}`:"<$0.01"},"cost")),O.length===0){const Y=t.usage.totalTokens;Y>0&&O.push(u.jsxs("span",{className:"oc-usage-part",children:[Vn(Y)," tokens"]},"total"))}return O})(),B=u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"oc-runtime-controls-group",children:[u.jsx(zE,{models:t.models,activeModelRef:t.activeModelRef,triggerLabel:t.activeModelRef||"选择模型",disabled:g,onSelect:(j,I)=>t.onSwitchRuntime({provider:j,modelId:I})}),u.jsx(HE,{levels:t.thinkingLevels,activeValue:t.activeThinkingLevel||"auto",triggerLabel:t.activeThinkingLevel||"auto",disabled:g,onSelect:j=>t.onSwitchRuntime({thinkingLevel:j})}),u.jsxs("span",{className:"oc-usage",title:IE(t.usage),children:[u.jsx("span",{className:"oc-usage-state",children:i?"运行中":"空闲"}),t.unread>0?u.jsxs("span",{className:"oc-usage-unread",children:[t.unread," 未读"]}):null,E]}),t.processSummary&&u.jsxs("button",{type:"button",ref:t.processTriggerRef,className:`oc-process-summary is-${t.processSummary.statusKind}${t.processOpen?" is-open":""}`,"aria-expanded":t.processOpen,"aria-controls":"oc-process-panel","aria-label":w,title:w,onClick:t.onToggleProcess,children:[u.jsx("span",{className:"oc-process-summary-label",children:"调用记录"}),u.jsx("span",{className:"oc-process-summary-badge",children:t.processSummary.count}),t.processSummary.statusKind!=="ok"&&t.processSummary.statusLabel?u.jsx("span",{className:"oc-process-summary-status",children:t.processSummary.statusLabel}):null]})]}),u.jsxs("div",{className:"oc-runtime-controls-group is-right",children:[u.jsx("button",{type:"button",className:"btn btn-ghost",onClick:t.onCompact,disabled:i||!s,title:s?i?"生成中,暂不可压缩":"压缩上下文,释放 token":"先进行对话后再压缩上下文","aria-label":s?i?"生成中,暂不可压缩":"压缩上下文,释放 token":"先进行对话后再压缩上下文",children:"压缩"}),t.runtimeContext?u.jsx("button",{type:"button",ref:t.runtimeContextTriggerRef,className:`btn btn-ghost oc-runtime-context-toggle${t.runtimeContextOpen?" is-active":""}`,"aria-expanded":t.runtimeContextOpen,"aria-controls":"oc-runtime-context-panel",onClick:t.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(j=>u.jsx("button",{type:"button",role:"option",onMouseDown:I=>I.preventDefault(),onClick:()=>r.insertFileReference(j),children:u.jsxs("code",{children:["@",j]})},j))}),r.pendingImages.length>0&&u.jsx("div",{className:"oc-attachment-list",children:r.pendingImages.map(j=>u.jsxs("span",{children:[j.name,u.jsx("button",{type:"button","aria-label":`移除 ${j.name}`,onClick:()=>r.removeImage(j),children:"×"})]},j.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(GE,{}),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:j=>{r.addImagesFromFiles(Array.from(j.target.files??[]).slice(0,4)),j.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:t.shortcutPaletteRef,role:"listbox","aria-label":"命令","aria-busy":r.dynamicCommandsLoading||void 0,"data-layout-mode":t.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:t.paletteModel.map(j=>u.jsxs("div",{className:"oc-shortcut-group",children:[u.jsxs("small",{children:[j.label," · ",j.items.length]}),j.items.map(({entry:I,globalIndex:N})=>u.jsxs("button",{type:"button",role:"option",id:`oc-shortcut-option-${N}`,"aria-label":I.command,"aria-describedby":`oc-shortcut-option-desc-${N}`,"aria-selected":N===r.shortcutIndex,className:N===r.shortcutIndex?"is-active":"","data-shortcut-index":N,title:I.command,onMouseEnter:()=>r.setShortcutIndex(N),onMouseDown:F=>F.preventDefault(),onClick:F=>{F.currentTarget.scrollIntoView({block:"nearest"}),k(I.command,I.action)},children:[u.jsx("code",{children:I.command}),u.jsx("small",{id:`oc-shortcut-option-desc-${N}`,children:I.description})]},`${I.source}:${I.command}`))]},j.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:j=>r.handleInputChange(j.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:t.onStop,children:u.jsx(pE,{})}):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(mE,{})})]}),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:()=>{ua()},children:"重试"})]}),u.jsx("div",{className:"oc-runtime-controls",children:B})]})})}function VE(t){const{toolCalls:r,onClose:i,overlay:s=!1}=t,o=S.useRef(null);return io({open:s,containerRef:o,triggerRef:t.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:Ty(c.createdAt)}),u.jsx("div",{className:"oc-process-body",children:u.jsx(ob,{entry:c})})]},c.id))})]})}const ly=[{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 Bl(t){const r=Array.isArray(t.items)?t.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:t.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:t.emptyText}):u.jsx("ul",{className:"oc-runtime-context-resources",children:r.map((i,s)=>u.jsx(PE,{item:i},`${i.name??i.path??s}:${s}`))})]})}function PE(t){const r=t.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 YE=S.forwardRef(function({open:r,onToggle:i,onClose:s,context:o,panelOnly:c=!1,triggerOnly:d=!1,triggerRef:h},p){const g=fa(),v=g.reloading,y=g.reloadError,[k,b]=S.useState("overview"),w=S.useRef(null);io({open:r&&!d,containerRef:w,triggerRef:h,onEscape:s}),S.useEffect(()=>{r||b("overview")},[r]);const E=Array.isArray(o.resources.activeTools)?o.resources.activeTools:[],B=typeof o.resources.activeToolCount=="number"?o.resources.activeToolCount:E.length,j=o.systemPrompt.text??o.systemPrompt.summary??"",I=o.systemPrompt.charCount??j.length,N=o.suffix.present?o.suffix.text??o.suffix.summary??"":"",F=o.model?Xl(o.model.provider,o.model.modelId):"",X=o.resources,O=String(o.resources.mode??"closed"),Y=O.includes("open")?"open":"closed",V={files:X.contextFiles?.length??0,skills:X.skills?.length??0,extensions:X.extensions?.length??0,packages:X.packages?.length??0},ae=["files","skills","extensions","packages"].map($=>({id:$,label:ly.find(te=>te.id===$)?.label??$,count:V[$]??0})),M=u.jsx("button",{type:"button",ref:$=>{typeof p=="function"?p($):p&&(p.current=$)},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 M;const P=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:ly.map($=>{const te=V[$.id];return u.jsxs("button",{type:"button",className:`oc-runtime-context-nav-item${k===$.id?" is-active":""}`,"aria-current":k===$.id?"page":void 0,onClick:()=>b($.id),children:[u.jsx("span",{className:"oc-runtime-context-nav-label",title:$.label,children:$.label}),typeof te=="number"?u.jsx("span",{className:"oc-runtime-context-nav-count",children:te}):null]},$.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:[I.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:B})]}),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-${Y}`,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:ae.map($=>u.jsxs("button",{type:"button",className:"oc-runtime-context-resource-link",onClick:()=>b($.id),children:[u.jsx("span",{className:"oc-runtime-context-resource-label",children:$.label}),u.jsx("span",{className:`oc-runtime-context-resource-count${$.count===0?" is-zero":""}`,children:$.count}),u.jsx("span",{className:"oc-runtime-context-resource-chevron","aria-hidden":"true",children:"›"})]},$.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),"…"]})]}),j?u.jsx(hd,{text:j}):null]}),u.jsx("pre",{className:"oc-runtime-context-text",children:j||"(空)"})]}),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()} 字`:"未注入"})]}),N?u.jsx(hd,{text:N}):null]}),o.suffix.present?u.jsx("pre",{className:"oc-runtime-context-text",children:N||"已注入"}):u.jsx("p",{className:"oc-runtime-context-empty",children:"本会话无额外 suffix"})]})]}):null,k==="files"?u.jsx(Bl,{title:"Context files",items:X.contextFiles?.map($=>({name:$.path,description:`${$.characters.toLocaleString()} 字符`})),emptyText:"该 session 未加载任何上下文文件"}):null,k==="skills"?u.jsx(Bl,{title:"Skills",items:X.skills,emptyText:"该 session 未加载任何 Skills"}):null,k==="extensions"?u.jsx(Bl,{title:"Extensions",items:X.extensions,emptyText:"该 session 未加载任何 Extensions"}):null,k==="packages"?u.jsx(Bl,{title:"Packages",items:X.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:[B," 项"]})]}),E.length===0?u.jsx("p",{className:"oc-runtime-context-empty",children:"无激活工具"}):u.jsx("ul",{className:"oc-runtime-context-tools",children:E.map($=>u.jsx("li",{children:u.jsx("code",{children:$})},$))}),Array.isArray(X.diagnostics)&&X.diagnostics.length>0?u.jsx("ul",{className:"oc-runtime-context-resources",children:X.diagnostics.map(($,te)=>u.jsxs("li",{children:[u.jsxs("span",{className:`oc-runtime-context-diag is-${$.type??"warning"}`,children:[$.type,": ",$.message]}),$.path?u.jsx("code",{children:$.path}):null]},te))}):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:()=>{ua()},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:()=>{ua()},children:"重试"})]})]})]}):null;return c?P:u.jsxs("div",{className:"oc-runtime-context-menu",children:[M,P]})});function KE(){const t=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),E=S.useRef(!1),B=S.useRef(0),j=S.useRef(null),I=S.useRef(!1),N=S.useRef(!1),F=S.useRef(null),X=S.useRef(new Set),O=S.useRef(new Set),Y=S.useRef(new Set),V=S.useRef(!1),ae=S.useRef(0);return S.useMemo(()=>({sessionRef:t,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:E,submitGenerationRef:B,pendingSubmissionRef:j,stopInFlightRef:I,stopRequestedRef:N,stoppingTurnIdRef:F,abortPostedTurnIdsRef:X,releasedClientRequestIdsRef:O,usageResponseKeysRef:Y,isComposingRef:V,compositionEndedAtRef:ae}),[t,r,i,s,o,c,d,h,p,g,v,y,k,b,w,E,B,j,I,N,F,X,O,Y,V,ae])}const XE=["operation","contract","dag","report","html"];function QE(t){const r=t.artifact;if(!r||typeof r!="object")return;const i=r;if(!(i.schemaVersion!==1||typeof i.artifactId!="string"||!i.artifactId||typeof i.kind!="string"||!XE.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 ZE(t,r){const i=t.findIndex(s=>s.artifactId===r.artifactId);return i<0?[...t,r]:t.map((s,o)=>o===i?{...s,...r,eventSeq:s.eventSeq??r.eventSeq,activityRef:s.activityRef??r.activityRef}:s)}function JE(t){if(!t||typeof t!="object")return;const r=t;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 WE(t,r){const i=t.findIndex(c=>c.cardId===r.cardId);if(i<0)return[...t,r];const s=[...t],o=s[i];return o?(s[i]={...o,...r,eventSeq:o.eventSeq??r.eventSeq,activityRef:o.activityRef??r.activityRef},s):[...t,r]}function eN(t,r){const i=t.findIndex(s=>s.operationId===r.operationId);return i<0?[...t,r]:t.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 tN(t){const r=t.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=nN(i.runSummary),{runSummary:o,...c}=i;return{...c,...s?{runSummary:s}:{}}}function nN(t){if(!t||typeof t!="object"||Array.isArray(t))return;const r=t;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 rN(t){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}=t;return(w,E,B,j)=>{if(j?.generation!==void 0&&r.sessionGenerationRef.current!==j.generation)return;const I=j?.replay===!0;if(w==="stream_ready")return;if(w==="reconcile"){const ae={reason:typeof E.reason=="string"?E.reason:"cursor_expired",...typeof E.minSeq=="number"?{minSeq:E.minSeq}:{},...typeof E.epoch=="string"?{epoch:E.epoch}:{},...typeof E.latestTurnId=="string"?{latestTurnId:E.latestTurnId}:{}};(typeof E.latestEventId=="string"||E.latestEventId===null)&&(ae.latestEventId=E.latestEventId),i?.(ae);return}const N=E.data&&typeof E.data=="object"?E.data:E,F=typeof E.turnId=="string"?E.turnId:void 0,X=typeof E.seq=="number"&&Number.isFinite(E.seq)?E.seq:void 0,O=typeof E.at=="string"&&Number.isFinite(Date.parse(E.at))?Date.parse(E.at):Date.now();if(F&&(w==="agent_start"||w==="message_update")&&r.settledTurnIdsRef.current.has(F))return;let Y=B;if(F){const V=r.turnAssistantIdsRef.current.get(F);V?Y=V:r.turnAssistantIdsRef.current.set(F,B)}if(w==="interview-turn"){o(V=>({...V??{},interviewSessionId:typeof N.interviewSessionId=="string"?N.interviewSessionId:V?.interviewSessionId,taskId:typeof N.taskId=="string"?N.taskId:V?.taskId,state:typeof N.state=="string"?N.state:V?.state,question:N.question&&typeof N.question=="object"?N.question:void 0}));return}if(w==="draft"){o(V=>({...V??{},taskId:typeof N.taskId=="string"?N.taskId:V?.taskId,draft:N.draft&&typeof N.draft=="object"?N.draft:V?.draft,draftSha256:typeof N.draftSha256=="string"?N.draftSha256:V?.draftSha256,taskKindRecommendation:typeof N.taskKindRecommendation=="string"?N.taskKindRecommendation:V?.taskKindRecommendation}));return}if(w==="assessment"){o(V=>({...V??{},assessment:N}));return}if(w==="taskKind-confirmed"){o(V=>({...V??{},confirmedTaskKind:typeof N.taskKind=="string"?N.taskKind:V?.confirmedTaskKind,taskKindRecommendation:void 0}));return}if(w==="human-gate-card"){const V=JE(N);V&&c(ae=>WE(ae,{...V,...X===void 0?{}:{eventSeq:X},...F?{turnId:F}:{},activityRef:`gate:${V.cardId}`}));return}if(w==="artifact-ref"){const V=QE(N);V&&d(ae=>ZE(ae,{...V,...X===void 0?{}:{eventSeq:X},...F?{turnId:F}:{},activityRef:`artifact:${V.artifactId}`}));return}if(w==="agent_start"){if(I&&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(Y);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"&&!I&&typeof document<"u"&&document.hidden&&g(V=>V+1),k(V=>V.filter(ae=>!(ae.id===Y&&ae.role==="assistant"&&!ae.text.trim()))),b(V=>V.map(ae=>ae.status==="running"&&ae.assistantMessageId===Y?{...ae,status:"error",finishedAt:Date.now()}:ae));return}if(w==="operation-ref"||w==="operation-status"){const V=tN(N);if(V){const ae=typeof N.toolCallId=="string"?N.toolCallId:void 0;v(M=>eN(M,{...V,...X===void 0?{}:{eventSeq:X,updatedSeq:X},...F?{turnId:F}:{},...ae?{toolCallId:ae}:{},activityRef:`operation:${V.operationId}`}))}return}if(w==="usage"){if(I)return;const V=N,ae=typeof V.responseKey=="string"&&V.responseKey?V.responseKey:void 0;if(ae&&r.usageResponseKeysRef.current.has(ae))return;ae&&r.usageResponseKeysRef.current.add(ae),y(M=>{const P=V.inputTokens??0,$=V.outputTokens??0,te=V.cacheReadTokens??0,G=V.cacheWriteTokens??0,_=V.totalTokens??P+$+te+G;return{inputTokens:M.inputTokens+P,outputTokens:M.outputTokens+$,cacheReadTokens:M.cacheReadTokens+te,cacheWriteTokens:M.cacheWriteTokens+G,totalTokens:M.totalTokens+_,cost:V.cost===void 0?M.cost:(M.cost??0)+V.cost}});return}if(w==="message_update"||w==="message_end"){if(I)return;const V=r.sealedAssistantIdsRef.current;if(w==="message_update"&&V.has(Y)){const $=hi("a");F&&r.turnAssistantIdsRef.current.set(F,$),Y=$,p($)}const ae=typeof N.text=="string"?N.text:"",M=co(N.content),P=Y;k($=>$.some(G=>G.id===P)?$.map(G=>G.id!==P?G:{...G,text:ae,...M?{content:M}:{}}):[...$,{id:P,role:"assistant",text:ae,createdAt:O,...M?{content:M}:{}}]),w==="message_end"&&V.add(P)}else if(w==="tool_call"){const V=typeof N.toolCallId=="string"?N.toolCallId:hi("t"),ae=typeof N.toolName=="string"?N.toolName:"tool",M=typeof N.argsPreview=="string"?N.argsPreview:"{}";b(P=>P.some($=>$.id===V)?P.map($=>$.id!==V?$:{...$,args:M,status:"running",turnId:F??$.turnId,assistantMessageId:Y,...X===void 0?{}:{eventSeq:X}}):[...P,{id:V,toolName:ae,args:M,status:"running",createdAt:O,...X===void 0?{}:{eventSeq:X},turnId:F,assistantMessageId:Y}])}else if(w==="tool_result"){const V=typeof N.toolCallId=="string"?N.toolCallId:hi("r"),ae=typeof N.toolName=="string"?N.toolName:"tool",M=N.isError===!0,P=typeof N.resultPreview=="string"?N.resultPreview:"{}";b($=>$.find(G=>G.id===V)?$.map(G=>G.id!==V?G:{...G,result:P,resultText:P,status:M?"error":"ok",finishedAt:O,...X===void 0?{}:{finishedSeq:X},turnId:F??G.turnId,assistantMessageId:G.assistantMessageId??Y}):[...$,{id:V,toolName:ae,result:P,resultText:P,status:M?"error":"ok",createdAt:O,finishedAt:O,...X===void 0?{}:{eventSeq:X,finishedSeq:X},turnId:F,assistantMessageId:Y}])}else w==="error"&&s(typeof N.message=="string"?N.message:"chat error")}}const Zc={inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheWriteTokens:0,totalTokens:0};function iN(t){const{origin:r,refs:i,sessionId:s,setError:o,onReconcile:c}=t,[d,h]=S.useState([]),[p,g]=S.useState([]),[v,y]=S.useState([]),[k,b]=S.useState([]),[w,E]=S.useState(50),[B,j]=S.useState(0),[I,N]=S.useState([]),[F,X]=S.useState(null),[O,Y]=S.useState(null),[V,ae]=S.useState(!1),[M,P]=S.useState(Zc),[$,te]=S.useState(!1),[G,_]=S.useState(null),[D]=S.useState(!1),H=S.useMemo(()=>rN({refs:i,onReconcile:c,setError:o,setInterview:X,setHumanGateCards:N,setArtifactCards:b,setStreaming:te,setStreamingAssistantId:_,setUnread:j,setOperationCards:y,setUsage:P,setMessages:h,setToolCalls:g}),[i,c,o]),z=S.useCallback((Z,ue,me)=>{if(me?.targetSessionId&&i.sessionRef.current?.sessionId!==me.targetSessionId||me?.generation!==void 0&&i.sessionGenerationRef.current!==me.generation)return null;const ge=Z.split(`
|
|
43
|
+
`);let fe="message",ke="",_e=null;for(const lt of ge)lt.startsWith("event: ")?fe=lt.slice(7).trim():lt.startsWith("data: ")?ke+=lt.slice(6):lt.startsWith("id: ")&&(_e=lt.slice(4).trim());if(!ke)return _e;let Ze;try{Ze=JSON.parse(ke)}catch{return _e}const Ve=_e??(typeof Ze.eventId=="string"?Ze.eventId:null);if(Ve){if(i.seenEventIdsRef.current.has(Ve))return Ve;i.seenEventIdsRef.current.add(Ve)}return H(fe,Ze,ue,me),_e??Ve},[H,i]),ne=S.useCallback(async(Z,ue)=>{const me=ue?.background===!0;me||ae(!0);try{const ge=await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(Z)}/context`,{credentials:"include"});if(!ge.ok)return;const fe=await ge.json();fe.context&&i.sessionRef.current?.sessionId===Z&&Y(ke=>y0(ke,fe.context)?ke:fe.context)}finally{me||ae(!1)}},[r,i]);S.useEffect(()=>{s&&ne(s)},[s,ne]),S.useEffect(()=>{if(!s)return;const Z=window.setTimeout(()=>{ne(s,{background:!0})},350);return()=>window.clearTimeout(Z)},[s,v,I,F,ne]);const T=S.useMemo(()=>d.filter(Z=>Z.role!=="system"||D).slice(-w),[d,D,w]);S.useEffect(()=>{const Z=()=>{document.hidden||j(0)};return document.addEventListener("visibilitychange",Z),()=>document.removeEventListener("visibilitychange",Z)},[]);const A=S.useMemo(()=>{if(p.length===0)return null;const Z=p.filter(ke=>ke.status==="running"),ue=p.filter(ke=>ke.status==="error"),me=Z[Z.length-1];let ge="完成",fe="ok";return ue.length>0?(ge=`${ue.length} 次出错`,fe="error"):Z.length>0?(ge=me?`${me.toolName} 运行中`:"运行中",fe="running"):ge="",{count:p.length,statusLabel:ge,statusKind:fe}},[p]),U=S.useMemo(()=>CE({messages:T,toolCalls:p,streaming:$,activeAssistantId:G}),[T,p,$,G]),C=S.useCallback(()=>{h([]),g([]),y([]),N([]),b([]),X(null),Y(null),P(Zc),te(!1),_(null),j(0),E(50),i.usageResponseKeysRef.current=new Set},[i]),se=S.useCallback(Z=>{h(Z.messages),g(Z.toolCalls),y([]),N([]),b([]),Y(null),X(null),P(Zc),i.usageResponseKeysRef.current=new Set,te(Z.streaming),_(null),j(0),E(50)},[i]),W=S.useCallback(async Z=>{try{const ue=await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(Z)}`,{credentials:"include"});if(!ue.ok)return!1;const me=await ue.json();if(!me.session||i.sessionRef.current?.sessionId!==Z)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 ke=co(fe.content);return{id:fe.id,role:fe.role,text:fe.text,createdAt:Date.parse(fe.at)||Date.now(),...ke&&ke.length>0?{content:ke}:{}}})),_(null),!0}catch{return!1}},[r,i,h,_]);return{messages:d,setMessages:h,toolCalls:p,setToolCalls:g,operationCards:v,artifactCards:k,historyLimit:w,setHistoryLimit:E,unread:B,humanGateCards:I,interview:F,setInterview:X,taskContext:O,contextLoading:V,usage:M,streaming:$,setStreaming:te,streamingAssistantId:G,setStreamingAssistantId:_,visibleMessages:T,turnGroups:U,processSummary:A,applyChatSseEvent:H,applySseBlock:z,loadTaskContext:ne,resetForNewSession:C,applyActivatedSession:se,recoverSession:W}}class aN{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 E of w){const B=E.split(`
|
|
46
|
+
`).find(I=>I.startsWith("id: "))?.slice(4);if(B&&(s=B),!B||o.has(B)||!E.includes("event: session_title"))continue;const j=E.split(`
|
|
47
|
+
`).find(I=>I.startsWith("data: "))?.slice(6);if(j)try{const I=JSON.parse(j),N=I.data?.title?.trim();if(!N)continue;if(o.add(B),!this.options.hasSession(r)||(this.options.onTitle(r,{title:N,automatic:!!I.data?.automatic}),I.data?.automatic))return}catch{}}}}catch{if(i.signal.aborted)return}i.signal.aborted||await sN(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 sN(t,r){return new Promise(i=>{const s=window.setTimeout(c,t),o=()=>c();function c(){window.clearTimeout(s),r.removeEventListener("abort",o),i()}r.addEventListener("abort",o,{once:!0})})}async function lN(t){if(t.creatingRef?.current)throw new Error("CREATE_SESSION_IN_FLIGHT");t.creatingRef&&(t.creatingRef.current=!0),t.setCreatingSession?.(!0);try{const r=await(t.fetchFn??fetch)(`${t.origin}/api/operator/v1/chat/sessions`,{method:"POST",headers:{"Content-Type":"application/json","x-loop-console-confirmation":rn()},credentials:"include",body:JSON.stringify(t.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,...md(s)},c=[s,...t.sessionListRef.current.filter(d=>d.sessionId!==s.sessionId)].slice(0,Gl);return t.sessionListRef.current=c,t.setSessionList(c),t.titleWatcher?.markEligible(s.sessionId),t.refreshSessionList(),o}finally{t.creatingRef&&(t.creatingRef.current=!1),t.setCreatingSession?.(!1)}}function oN(t){const{origin:r,refs:i,setSession:s,thread:o,composer:c,browser:d,setError:h,setProcessOpen:p,setAutoScroll:g}=t,{applyActivatedSession:v,resetForNewSession:y,setMessages:k}=o,{setInput:b,setPendingImages:w}=c,{setPreviews:E,setActivePreviewPath:B}=d,[j,I]=S.useState([]),N=S.useRef([]);N.current=j;const F=S.useRef(null),[X,O]=S.useState(!1),Y=S.useRef(!1),V=S.useRef(0),ae=S.useCallback(()=>{i.sessionGenerationRef.current+=1,i.abortRef.current?.abort(),i.reconnectAbortRef.current?.abort();for(const z of i.sessionAbortControllersRef.current.values())z.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([]),E([]),B(null),p(!1),g(!0)},[i,y,b,w,E,B,p,g]),M=S.useCallback(async()=>{try{const z=await fetch(`${r}/api/operator/v1/chat/sessions`,{credentials:"include"});if(!z.ok)return;const ne=(await z.json()).sessions??[],T=ne.slice(0,Gl),A=ne.slice(Gl);if(I(T),A.length===0)return;await Promise.all(A.map(C=>fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(C.sessionId)}`,{method:"DELETE",credentials:"include",headers:{"x-loop-console-confirmation":rn()}}).catch(()=>{})));const U=i.sessionRef.current?.sessionId;U&&A.some(C=>C.sessionId===U)&&(V.current+=1,i.sessionRef.current=null,ae(),s(null),window.localStorage.removeItem(_n))}catch{}},[r,i,ae,s]),P=S.useCallback(async z=>{try{return(await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(z)}`,{method:"DELETE",credentials:"include",headers:{"x-loop-console-confirmation":rn()}})).ok?(F.current?.cancel(z),i.sessionRef.current?.sessionId===z&&(V.current+=1,i.sessionRef.current=null,ae(),s(null),window.localStorage.removeItem(_n)),await M(),!0):(h("删除会话失败"),!1)}catch(ne){return h(ne instanceof Error?ne.message:String(ne)),!1}},[r,i,s,ae,M,h]),$=S.useCallback(async z=>{const ne=++V.current;try{const T=await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(z)}`,{credentials:"include"}),A=await T.json();if(!T.ok||!A.session)throw new Error(A.error?.message??"会话不可用");if(ne!==V.current)return;const U={sessionId:A.session.sessionId,...md(A.session)};ae(),i.sessionRef.current=U,i.streamingRef.current=!!A.session.activeTurnId,i.activeTurnIdRef.current=A.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(z)??null,w([]),E([]),b(A.session.composerDraft??"");const C=kE(A.session.messages??[]);v({messages:C.messages,toolCalls:C.toolCalls,streaming:!!A.session.activeTurnId}),window.localStorage.setItem(_n,z),B(null)}catch(T){if(ne!==V.current)return;h(T instanceof Error?T.message:String(T))}},[r,i,s,w,E,b,v,ae,B,h]);S.useEffect(()=>{M()},[M]),F.current||(F.current=new aN({origin:r,hasSession:z=>N.current.some(ne=>ne.sessionId===z),onTitle:(z,ne)=>{I(T=>T.map(A=>A.sessionId!==z||ne.automatic&&A.title?A:ne.automatic?{...A,title:ne.title}:{...A,displayTitle:ne.title}))},refresh:M}));const te=S.useCallback(z=>F.current?.startIfEligible(z),[]);S.useEffect(()=>{F.current?.reconcile(j.filter(z=>z.state!=="archived"&&!z.title).map(z=>z.sessionId))},[j]),S.useEffect(()=>()=>F.current?.dispose(),[]),S.useEffect(()=>{let z=!1;const ne=window.localStorage.getItem(_n);if(!ne)return;const T=++V.current;return(async()=>{try{const A=await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(ne)}`,{credentials:"include"});if(!A.ok){window.localStorage.removeItem(_n);return}const U=await A.json();if(z||T!==V.current||!U.session)return;const C={sessionId:U.session.sessionId,...md(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(se=>se.role==="user"||se.role==="assistant").map(se=>{const W=co(se.content);return{id:se.id,role:se.role,text:se.text,createdAt:Date.parse(se.at)||Date.now(),...W&&W.length>0?{content:W}:{}}}))}catch{}})(),()=>{z=!0}},[r,i,s,b,k]);const G=S.useCallback(z=>lN({origin:r,sessionListRef:N,setSessionList:I,titleWatcher:F.current,refreshSessionList:M,options:z,setCreatingSession:O,creatingRef:Y}),[r,M]),_=S.useCallback(async z=>{if(Y.current)return null;const ne=++V.current;h(null);try{const T=await G(z);return ne!==V.current?null:(ae(),i.sessionRef.current=T,window.localStorage.setItem(_n,T.sessionId),s(T),T)}catch(T){if(ne!==V.current)return null;const A=T instanceof Error?T.message:String(T);return A!=="CREATE_SESSION_IN_FLIGHT"&&h(A),null}},[i,s,h,ae,G]),D=S.useCallback(async z=>{const ne=i.sessionRef.current;if(!ne||i.streamingRef.current)return;const T=typeof z=="string"?z.trim():"";try{const A={"x-loop-console-confirmation":rn()};T&&(A["content-type"]="application/json");const U=await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(ne.sessionId)}/compact`,{method:"POST",credentials:"include",headers:A,...T?{body:JSON.stringify({instructions:T})}:{}}),C=await U.json().catch(()=>({}));if(!U.ok){h(C.error?.message??"上下文压缩失败");return}h(null)}catch(A){h(A instanceof Error?A.message:"上下文压缩失败")}},[r,i,h]);return{sessionList:j,creatingSession:X,activateSession:$,refreshSessionList:M,deleteSession:P,createSession:_,updateSession:async(z,ne)=>{if(!(await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(z)}`,{method:"PATCH",credentials:"include",headers:{"content-type":"application/json","x-loop-console-confirmation":rn()},body:JSON.stringify(ne)})).ok){h("会话更新失败");return}await M(),ne.state==="archived"&&F.current?.cancel(z),ne.state==="archived"&&i.sessionRef.current?.sessionId===z&&(V.current+=1,i.sessionRef.current=null,ae(),s(null),window.localStorage.removeItem(_n))},watchSessionTitle:te,compactSession:D}}function la(t){const r=(t??"").trim();return r?/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 uN(t){let r;const i=new Promise(s=>{r=s});return{...t,outcomePromise:i,resolveOutcome:r}}function oy(t="network error while creating turn"){return{kind:"ambiguous",message:t}}function cN(t="无法确认 Turn 是否已创建,正在与服务端对账(不会重复提交新的请求 ID)"){return{kind:"ambiguous",message:t}}function uy(t){const{body:r,clientRequestId:i}=t,s=r.error?.code,o=r.error?.message??(t.httpOk?"turn was not accepted":`HTTP ${t.status}`);if(s==="TURN_ACTIVE"&&r.activeTurn?.turnId)return{kind:"adopt-active",activeTurn:r.activeTurn,message:"上一轮仍在运行,已重新连接;当前消息已保留。"};if(r.accepted===!0||t.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 dN(t){const r=t.clientRequestId,i=t.state?.activeTurn,s=t.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 fN(t){const r=t.clientRequestId,i=t.state?.activeTurn,s=t.state?.latestTurn,o=i?.state??t.state?.activeTurnState??void 0,c=s?.state??t.state?.latestTurnState??void 0;if(i?.clientRequestId===r&&i.turnId)return pi(o)?{action:"release-terminal",turnId:i.turnId,state:String(o)}:{action:"bind-active",turnId:i.turnId};if(s?.clientRequestId===r&&s.turnId){if(pi(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!Ql(t.state)&&!(!!i?.turnId&&i?.clientRequestId!==r)?{action:"release-not-accepted"}:{action:"hold"}}function Ql(t){if(t?.activeTurnId||t?.activeTurn?.turnId)return!0;const r=t?.runtime;return r?r.isStreaming===!0||r.isPromptRunning===!0||r.isCompacting===!0||r.isBashRunning===!0:!1}function pi(t){return t==="settled"||t==="aborted"||t==="failed"}function Zl(t){return t.pending.sessionId===t.sessionId&&t.pending.sessionGeneration===t.sessionGeneration&&t.pending.submitGeneration===t.submitGeneration}function hN(t,r){return`${t}/api/operator/v1/chat/sessions/${encodeURIComponent(r)}/turns`}function cy(t,r){return`${t}/api/operator/v1/chat/sessions/${encodeURIComponent(r)}/state`}function mN(t,r){return`${t}/api/operator/v1/chat/sessions/${encodeURIComponent(r)}/events`}function pN(t,r,i){return`${t}/api/operator/v1/chat/sessions/${encodeURIComponent(r)}/turns/${encodeURIComponent(i)}/abort`}function pa(t,r){const i=t.pendingSubmission;r&&i&&i.clientRequestId!==r||(t.submitInFlight=!1,(!r||i?.clientRequestId===r)&&(i?.clientRequestId?t.releasedClientRequestIds.add(i.clientRequestId):r&&t.releasedClientRequestIds.add(r),t.pendingSubmission=null),t.pendingSubmission||(t.stopRequested=!1))}function cb(t){t.stopRequested=!0}function Jl(t){t.stopRequested=!1}function gN(t,r){return!(!r||t.abortPostedTurnIds.has(r))}function yN(t,r){r&&t.abortPostedTurnIds.add(r)}function Wl(t,r){return!t.stopRequested||!gN(t,r)?null:(yN(t,r),t.stoppingTurnId=r,t.activeTurnId=r,r)}function dy(t,r){const i=t.pendingSubmission;return i&&i.clientRequestId!==r.clientRequestId?!1:(r.turnId&&t.settledTurnIds.add(r.turnId),pa(t,r.clientRequestId),Jl(t),r.markIdle!==!1&&(t.streaming=!1,t.activeTurnId=null,t.assistantId=null,t.stoppingTurnId=null),!0)}function vN(t,r){return Zl({pending:r.pending,sessionId:t.sessionId,sessionGeneration:t.sessionGeneration,submitGeneration:t.submitGeneration})?(r.pending.acceptedTurnId=r.turnId,t.activeTurnId=r.turnId,t.turnAssistantIds.set(r.turnId,r.assistantId),t.streaming=!0,t.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 bN(t,r){r.pending.resolveOutcome({kind:"adopt-active",activeTurn:{turnId:r.activeTurnId},message:r.message}),pa(t,r.pending.clientRequestId),r.current&&(r.ui?.clearEmptyAssistant(r.assistantId),r.ui?.setInput(r.text),r.ui?.setPendingImages(r.images),t.activeTurnId=r.activeTurnId,t.assistantId=null,t.streaming=!0,r.ui?.setStreaming(!0),r.ui?.setStreamingAssistantId(null),r.notice.setError(null),r.notice.showNotice(r.message))}function xN(t,r){if(r.pending.resolveOutcome({kind:"rejected",message:r.message}),pa(t,r.pending.clientRequestId),!r.current)return;const i=r.ui?.formatError?r.ui.formatError(r.message):r.message;r.ui?.setError(i),t.streaming=!1,t.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 SN(t,r,i){const s=Zl({pending:i.pending,sessionId:t.sessionId,sessionGeneration:t.sessionGeneration,submitGeneration:t.submitGeneration});if(r.kind==="accepted"){if(vN(t,{turnId:r.turnId,assistantId:i.assistantId,pending:i.pending,sessionId:i.sessionId,ui:i.acceptedUi})){const c=Wl(t,r.turnId);c&&i.onAutoAbort?.(c)}return}if(r.kind==="adopt-active"){const o=s?Wl(t,r.activeTurn.turnId):null;bN(t,{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"){xN(t,{message:r.message,assistantId:i.assistantId,text:i.text,images:i.images,pending:i.pending,current:s,ui:i.rejectedUi}),Jl(t);return}if(r.kind==="stale"){i.pending.resolveOutcome(r),pa(t,i.pending.clientRequestId),Jl(t);return}i.pending.resolveOutcome(r)}function kN(t,r,i,s){const o=t.pendingSubmission;if(!o)return"held";if(r.action==="bind-active"){const d=!!o.acceptedTurnId;d||(o.acceptedTurnId=r.turnId,t.activeTurnId=r.turnId,t.turnAssistantIds.set(r.turnId,o.assistantId),t.streaming=!0,t.submitInFlight=!1);const h=Wl(t,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"&&t.settledTurnIds.add(r.turnId),pa(t,o.clientRequestId),Jl(t),Ql(i)||(t.streaming=!1,t.activeTurnId=null,t.assistantId=null,t.stoppingTurnId=null,s?.markIdle?.()),"released";const c=i?.activeTurn?.turnId??i?.activeTurnId??null;return c&&(t.activeTurnId=c),"held"}const wN="正在停止…",CN="正在停止…",jN="停止请求未完成,正在与服务端对账…",RN="停止请求失败,正在与服务端对账…";function fy(t){t.showNotice(wN)}function hy(t){if(t.networkError)return{action:"keep-busy-notice",message:RN};const r=t.body.turn?.state;return t.body.accepted===!0&&pi(r)?{action:"terminal-idle",turnId:t.turnId}:t.body.error?.code==="TURN_ABORT_PENDING"?{action:"abort-pending-notice"}:t.body.error?.code==="CHAT_TURN_OWNER_LOST"||t.body.error?.code==="OWNER_LOST"?{action:"owner-lost-reconcile"}:t.httpOk?{action:"noop"}:{action:"keep-busy-notice",message:jN}}function Jc(t,r,i,s){const o=s?.sessionStillCurrent!==!1;if(r.action==="terminal-idle"){if(!o)return;t.settledTurnIds.add(r.turnId),t.streaming=!1,t.activeTurnId=null,t.assistantId=null,t.stoppingTurnId=null,s?.markIdle?.();return}if(r.action==="abort-pending-notice"){i.showNotice(CN);return}if(r.action==="owner-lost-reconcile"){if(!o)return;s?.runtimeBusy||(t.stoppingTurnId&&t.settledTurnIds.add(t.stoppingTurnId),t.streaming=!1,t.activeTurnId=null,t.assistantId=null,t.stoppingTurnId=null,s?.markIdle?.());return}if(r.action==="keep-busy-notice"){i.showNotice(r.message);return}}function my(t,r){cb(t);const i=t.activeTurnId??t.pendingSubmission?.acceptedTurnId??null;if(i){const s=Wl(t,i);return s?(r.notice&&fy(r.notice),r.postAbort(s),{abortedTurnId:s,stopRequested:!0}):{abortedTurnId:null,stopRequested:!0}}return r.notice&&fy(r.notice),{abortedTurnId:null,stopRequested:!0}}function fr(t){return{submitInFlight:t.submitInFlightRef.current,pendingSubmission:t.pendingSubmissionRef.current,activeTurnId:t.activeTurnIdRef.current,streaming:t.streamingRef.current,assistantId:t.assistantIdRef.current,stoppingTurnId:t.stoppingTurnIdRef.current,settledTurnIds:t.settledTurnIdsRef.current,turnAssistantIds:t.turnAssistantIdsRef.current,sessionId:t.sessionRef.current?.sessionId??null,sessionGeneration:t.sessionGenerationRef.current,submitGeneration:t.submitGenerationRef.current,stopInFlight:t.stopInFlightRef.current,stopRequested:t.stopRequestedRef.current,abortPostedTurnIds:t.abortPostedTurnIdsRef.current,releasedClientRequestIds:t.releasedClientRequestIdsRef.current}}function $n(t,r){t.submitInFlightRef.current=r.submitInFlight,t.pendingSubmissionRef.current=r.pendingSubmission,t.activeTurnIdRef.current=r.activeTurnId,t.streamingRef.current=r.streaming,t.assistantIdRef.current=r.assistantId,t.stoppingTurnIdRef.current=r.stoppingTurnId,t.submitGenerationRef.current=r.submitGeneration,t.stopInFlightRef.current=r.stopInFlight,t.stopRequestedRef.current=r.stopRequested}function TN(t){return t.split(`
|
|
48
|
+
`).find(r=>r.startsWith("event: "))?.slice(7).trim()??"message"}function EN(){return new Promise(t=>window.setTimeout(t,25))}function Wc(t,r){r&&t(i=>i.filter(s=>!(s.id===r&&s.role==="assistant"&&!s.text.trim())))}function NN(t){const{origin:r,refs:i,session:s,thread:o,composer:c,setError:d,setAutoScroll:h,setNotice:p,recoveryVersion:g=0,watchSessionTitle:v}=t,{applySseBlock:y,setMessages:k,setStreaming:b,setStreamingAssistantId:w,streaming:E}=o,{setInput:B,setPendingImages:j}=c,I=S.useCallback(_=>{p&&p({id:Date.now(),message:_})},[p]),N=S.useCallback(_=>{const D=fr(i);pa(D,_),$n(i,D)},[i]),F=S.useCallback((_,D,H)=>{i.sessionRef.current?.sessionId!==_||i.sessionGenerationRef.current!==D||(i.streamingRef.current=!1,i.activeTurnIdRef.current=null,i.assistantIdRef.current=null,i.stoppingTurnIdRef.current=null,b(!1),w(null),Wc(k,H))},[i,b,w,k]),X=S.useCallback(async(_,D,H)=>{for(;!H.aborted;){const z=i.eventsStreamStateRef.current;if(!z||z.sessionId!==_||z.generation!==D)return;z.ready=!1;try{const ne={Accept:"text/event-stream"},T=i.lastEventIdRef.current;T&&(ne["Last-Event-ID"]=T);const A=await fetch(mN(r,_),{headers:ne,credentials:"include",signal:H});if(!A.ok||!A.body){if(A.status===404)return;await Nc(2e3,H);continue}const U=A.body.getReader(),C=new TextDecoder;let se="",W=!0;const Z=hi("a");for(;;){const{done:me,value:ge}=await U.read();if(me)break;se+=C.decode(ge,{stream:!0});const fe=se.split(`
|
|
49
|
+
|
|
50
|
+
`);se=fe.pop()??"";for(const ke of fe){if(TN(ke)==="stream_ready"){const Ve=i.eventsStreamStateRef.current;Ve?.sessionId===_&&Ve.generation===D&&(Ve.ready=!0),W=!1;continue}const _e=i.assistantIdRef.current??Z,Ze=y(ke,_e,{replay:W,targetSessionId:_,generation:D});Ze&&(i.lastEventIdRef.current=Ze)}}const ue=i.eventsStreamStateRef.current;ue?.sessionId===_&&ue.generation===D&&(ue.ready=!1),await Nc(1e3,H)}catch{if(H.aborted)return;await Nc(2e3,H)}}},[r,i,y]),O=S.useCallback((_,D)=>{const H=i.eventsStreamStateRef.current;if(H?.sessionId===_&&H.generation===D&&i.reconnectAbortRef.current)return;i.reconnectAbortRef.current?.abort();const z=new AbortController;i.reconnectAbortRef.current=z,i.eventsStreamStateRef.current={sessionId:_,generation:D,ready:!1},X(_,D,z.signal)},[i,X]),Y=S.useCallback(async(_,D)=>{O(_,D);const H=Date.now()+5e3;for(;Date.now()<H;){const z=i.eventsStreamStateRef.current;if(z?.sessionId===_&&z.generation===D&&z.ready)return;if(i.sessionRef.current?.sessionId!==_||i.sessionGenerationRef.current!==D)throw new Error("会话已切换");await EN()}throw new Error("事件连接未就绪,请检查 Console 连接后重试")},[i,O]),V=S.useCallback(async _=>{try{const D=await fetch(cy(r,_),{credentials:"include"}),H=await D.json().catch(()=>({}));return D.ok?H.state??null:null}catch{return null}},[r]),ae=S.useCallback(async _=>{try{const D=await fetch(hN(r,_.sessionId),{method:"POST",headers:{"Content-Type":"application/json","x-loop-console-confirmation":rn()},credentials:"include",body:JSON.stringify({clientRequestId:_.clientRequestId,text:_.text.trim()||"请查看附件图片。",images:_.images.map(({type:z,mimeType:ne,data:T})=>({type:z,mimeType:ne,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]),M=S.useCallback(()=>({showNotice:I,setError:_=>d(_)}),[I,d]),P=S.useCallback(async(_,D,H)=>{i.stoppingTurnIdRef.current=H,i.streamingRef.current=!0,b(!0);try{const z=await fetch(pN(r,_,H),{method:"POST",headers:{"Content-Type":"application/json","x-loop-console-confirmation":rn()},credentials:"include",body:"{}"}),ne=await z.json().catch(()=>({}));if(i.sessionRef.current?.sessionId!==_||i.sessionGenerationRef.current!==D||i.stoppingTurnIdRef.current!==H)return;const T=hy({httpOk:z.ok,turnId:H,body:ne}),A=fr(i);if(A.stoppingTurnId=H,T.action==="owner-lost-reconcile"){const U=await V(_),C=i.sessionRef.current?.sessionId===_&&i.sessionGenerationRef.current===D;Jc(A,T,M(),{sessionStillCurrent:C,runtimeBusy:Ql(U??void 0),markIdle:()=>F(_,D,i.assistantIdRef.current)}),$n(i,A);return}Jc(A,T,M(),{sessionStillCurrent:!0,markIdle:()=>F(_,D,i.assistantIdRef.current)}),$n(i,A)}catch{const z=fr(i);Jc(z,hy({httpOk:!1,turnId:H,body:{},networkError:!0}),M()),$n(i,z)}},[r,i,b,F,V,M]),$=S.useCallback((_,D)=>{const H=fr(i);H.sessionId=i.sessionRef.current?.sessionId??null,H.sessionGeneration=i.sessionGenerationRef.current,H.submitGeneration=i.submitGenerationRef.current;const z=ne=>{j(ne)};SN(H,_,{assistantId:D.assistantId,text:D.text,images:D.images,pending:D.pending,sessionId:D.sessionId,notice:M(),acceptedUi:{setStreaming:b,setStreamingAssistantId:w,setPendingImages:z,watchSessionTitle:v},adoptUi:{clearEmptyAssistant:ne=>Wc(k,ne),setInput:B,setPendingImages:z,setStreaming:b,setStreamingAssistantId:w},rejectedUi:{setError:d,setStreaming:b,setStreamingAssistantId:w,clearEmptyAssistant:ne=>Wc(k,ne),setInput:B,setPendingImages:z,formatError:la},onAutoAbort:ne=>{P(D.sessionId,D.generation,ne)}}),$n(i,H)},[i,M,b,w,j,v,k,B,d,P]),te=S.useCallback(async(_,D)=>{const H=i.sessionRef.current,z=i.sessionGenerationRef.current;if(!H||!_.trim()&&D.length===0||i.streamingRef.current||i.submitInFlightRef.current||i.pendingSubmissionRef.current)return;i.submitInFlightRef.current=!0;const ne=++i.submitGenerationRef.current,T=hi("chat-submit"),A=hi("u"),U=hi("a"),C=_.trim(),se=D.slice(),W=uN({clientRequestId:T,submitGeneration:ne,sessionId:H.sessionId,sessionGeneration:z,text:C,images:se,assistantId:U,userMessageId:A});i.pendingSubmissionRef.current=W;try{await Y(H.sessionId,z)}catch(fe){i.sessionRef.current?.sessionId===H.sessionId&&i.sessionGenerationRef.current===z&&d(la(fe instanceof Error?fe.message:String(fe))),N(T);return}if(i.sessionRef.current?.sessionId!==H.sessionId||i.sessionGenerationRef.current!==z){N(T);return}const Z={id:A,role:"user",text:C,createdAt:Date.now()};k(fe=>[...fe,Z,{id:U,role:"assistant",text:"",createdAt:Date.now()}]),B(""),h(!0),d(null),i.streamingRef.current=!0,i.assistantIdRef.current=U,b(!0),w(U);const ue={sessionId:H.sessionId,generation:z,submitGeneration:ne,assistantId:U,text:C,images:se,pending:W},me=await ae({sessionId:H.sessionId,clientRequestId:T,text:C,images:se});if(!Zl({pending:W,sessionId:i.sessionRef.current?.sessionId,sessionGeneration:i.sessionGenerationRef.current,submitGeneration:i.submitGenerationRef.current})){W.resolveOutcome({kind:"stale"}),N(T);return}let ge=me.networkError?oy():uy({httpOk:me.httpOk,status:me.status,body:me.body,clientRequestId:T});if(ge.kind==="ambiguous"){const fe=await V(H.sessionId),ke=fe?dN({clientRequestId:T,state:fe}):null;if(ke)ge=ke;else{const _e=await ae({sessionId:H.sessionId,clientRequestId:T,text:C,images:se});if(!Zl({pending:W,sessionId:i.sessionRef.current?.sessionId,sessionGeneration:i.sessionGenerationRef.current,submitGeneration:i.submitGenerationRef.current})){W.resolveOutcome({kind:"stale"}),N(T);return}if(ge=_e.networkError?oy("无法确认 Turn 是否已创建,正在与服务端对账(不会重复提交新的请求 ID)"):uy({httpOk:_e.httpOk,status:_e.status,body:_e.body,clientRequestId:T}),ge.kind==="ambiguous"){const Ze=ge.message||"无法确认 Turn 是否已创建,正在与服务端对账(不会重复提交新的请求 ID)";ge=cN(Ze),I(Ze)}}}$(ge,ue)},[r,i,Y,ae,V,$,N,I,k,B,h,d,b,w]),G=S.useCallback(async()=>{const _=i.sessionRef.current?.sessionId,D=i.sessionGenerationRef.current;if(!_)return;const H=fr(i),z=my(H,{postAbort:()=>{},notice:M()});if($n(i,H),z.abortedTurnId){if(i.stopInFlightRef.current)return;i.stopInFlightRef.current=!0;try{await P(_,D,z.abortedTurnId)}finally{i.stopInFlightRef.current=!1}return}const ne=i.pendingSubmissionRef.current;if(ne&&!i.stopInFlightRef.current){i.stopInFlightRef.current=!0;try{const T=await ne.outcomePromise;if(i.sessionRef.current?.sessionId!==_||i.sessionGenerationRef.current!==D)return;let A=null;if(T.kind==="accepted")A=T.turnId;else if(T.kind==="adopt-active")A=T.activeTurn.turnId;else{if(T.kind==="ambiguous")return;i.stopRequestedRef.current=!1;return}if(!A)return;const U=fr(i);cb(U);const C=my(U,{postAbort:()=>{},notice:M()});$n(i,U),C.abortedTurnId&&await P(_,D,C.abortedTurnId)}finally{i.stopInFlightRef.current=!1}}},[i,M,P]);return S.useEffect(()=>{const _=!!i.pendingSubmissionRef.current||i.submitInFlightRef.current||i.stopRequestedRef.current||!!i.activeTurnIdRef.current;if(!s||!E&&!_)return;const D=s.sessionId,H=i.sessionGenerationRef.current;let z=!1;const ne=async()=>{try{const C=await fetch(cy(r,D),{credentials:"include"}),se=await C.json().catch(()=>({}));if(z||!C.ok||i.sessionRef.current?.sessionId!==D||i.sessionGenerationRef.current!==H)return;const W=se.state,Z=i.pendingSubmissionRef.current;if(Z){const _e=fN({clientRequestId:Z.clientRequestId,state:W}),Ze=fr(i),Ve=kN(Ze,_e,W,{markIdle:()=>F(D,H,i.assistantIdRef.current),onAutoAbort:lt=>{P(D,H,lt)}});if($n(i,Ze),Ve==="bound"){b(!0);return}if(Ve==="released"||!Z.acceptedTurnId&&!Ze.pendingSubmission?.acceptedTurnId)return}const ue=W?.activeTurn?.turnId??W?.activeTurnId??null;i.activeTurnIdRef.current=ue;const me=Ql(W),ge=i.pendingSubmissionRef.current;if(ge){const _e=W?.latestTurn?.clientRequestId===ge.clientRequestId&&pi(W?.latestTurn?.state),Ze=W?.activeTurn?.clientRequestId===ge.clientRequestId&&pi(W?.activeTurn?.state);if(_e||Ze){const Ve=Ze?W?.activeTurn?.turnId??null:W?.latestTurn?.turnId??ge.acceptedTurnId??null,lt=fr(i);dy(lt,{clientRequestId:ge.clientRequestId,turnId:Ve,markIdle:!me}),$n(i,lt),me||F(D,H,i.assistantIdRef.current);return}}if(me)return;const fe=i.assistantIdRef.current;if(ue&&!(pi(W?.activeTurn?.state)||pi(W?.activeTurnState)))return;ue&&i.settledTurnIdsRef.current.add(ue);const ke=ge?.clientRequestId;if(ke){const _e=fr(i);dy(_e,{clientRequestId:ke,turnId:ue,markIdle:!0}),$n(i,_e)}else N();F(D,H,fe)}catch{}},T=()=>{document.visibilityState==="visible"&&ne()},A=()=>{ne()},U=window.setInterval(()=>{ne()},15e3);return document.addEventListener("visibilitychange",T),window.addEventListener("online",A),ne(),()=>{z=!0,window.clearInterval(U),document.removeEventListener("visibilitychange",T),window.removeEventListener("online",A)}},[r,i,s,E,F,N,P]),S.useEffect(()=>{if(!s)return;const _=i.sessionGenerationRef.current;return O(s.sessionId,_),()=>{const D=i.eventsStreamStateRef.current;D?.sessionId===s.sessionId&&D.generation===_&&(i.reconnectAbortRef.current?.abort(),i.reconnectAbortRef.current=null,i.eventsStreamStateRef.current=null)}},[s,g,i,O]),{sendPrompt:te,handleStop:G,openEventsStream:X}}function AN(t){const{origin:r,refs:i,thread:s,setError:o}=t,{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":rn()},credentials:"include",body:JSON.stringify({taskId:b})}),E=await w.json();if(!w.ok){o(E.error?.message??`HTTP ${w.status}`);return}d({interviewSessionId:E.interview?.sessionId,taskId:b,state:E.interview?.state,question:E.question,draft:E.draft?.draft,draftSha256:E.draft?.draftSha256,assessment:E.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":rn()},credentials:"include",body:JSON.stringify({questionId:c.question.id,response:k,...k==="override"?{text:h}:{}})}),E=await w.json();if(!w.ok){o(E.error?.message??`HTTP ${w.status}`);return}d(B=>({...B??{},state:E.interview?.state,question:E.question,draft:E.draft?.draft,draftSha256:E.draft?.draftSha256,assessment:E.assessment,taskKindRecommendation:E.taskKindRecommendation??B?.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":rn()},credentials:"include",body:JSON.stringify({taskKind:c.taskKindRecommendation})}),w=await b.json();if(!b.ok){o(w.error?.message??`HTTP ${b.status}`);return}d(E=>({...E??{},confirmedTaskKind:E?.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 IN(t){const{origin:r,refs:i,sessionId:s,setError:o}=t,[c,d]=S.useState({}),[h,p]=S.useState(new Set),[g,v]=S.useState(null),[y,k]=S.useState([]),[b,w]=S.useState(null),[E,B]=S.useState(!1),j=S.useCallback(async(X="")=>{try{v(null);const O=await fetch(`${r}/api/operator/v1/chat/repo/tree?path=${encodeURIComponent(X)}`,{credentials:"include"}),Y=await O.json();if(!O.ok)throw new Error(Y.error?.message??"无法读取仓库目录");d(V=>({...V,[X]:Y.data?.entries??[]}))}catch(O){v(O instanceof Error?O.message:String(O))}},[r]);S.useEffect(()=>{j()},[j]);const I=S.useCallback(async X=>{B(!0);try{const O=await fetch(`${r}/api/operator/v1/chat/repo/file?path=${encodeURIComponent(X)}`,{credentials:"include"}),Y=await O.json();if(!O.ok||!Y.data)throw new Error(Y.error?.message??"无法预览文件");k(V=>{const ae=[...V.filter(P=>P.path!==Y.data.path),Y.data],M=i.sessionRef.current?.sessionId;return M&&window.localStorage.setItem(`${_n}.previews.${M}`,JSON.stringify(ae.map(P=>P.path))),ae}),w(Y.data.path)}catch(O){o(O instanceof Error?O.message:String(O))}finally{B(!1)}},[r,i,o]);S.useEffect(()=>{if(!s)return;let X=[];try{const O=JSON.parse(window.localStorage.getItem(`${_n}.previews.${s}`)??"[]");Array.isArray(O)&&(X=O.filter(Y=>typeof Y=="string").slice(0,10))}catch{}X.length&&Promise.all(X.map(async O=>{const Y=await fetch(`${r}/api/operator/v1/chat/repo/file?path=${encodeURIComponent(O)}`,{credentials:"include"});if(Y.ok)return(await Y.json()).data})).then(O=>{if(i.sessionRef.current?.sessionId!==s)return;const Y=O.filter(V=>!!V);k(Y),w(Y.at(-1)?.path??null)})},[r,s,i]);const N=S.useCallback(X=>{p(O=>{const Y=new Set(O);return Y.has(X)?Y.delete(X):Y.add(X),Y}),c[X]||j(X)},[c,j]),F=S.useCallback(X=>{k(O=>{const Y=O.filter(V=>V.path!==X);return s&&window.localStorage.setItem(`${_n}.previews.${s}`,JSON.stringify(Y.map(V=>V.path))),Y}),w(O=>O===X?y.find(Y=>Y.path!==X)?.path??null:O)},[y,s]);return{tree:c,expandedDirs:h,treeError:g,previews:y,activePreviewPath:b,setActivePreviewPath:w,previewLoading:E,setPreviews:k,loadTree:j,openPreview:I,closePreview:F,toggleDir:N}}const DN=["operator","web","extension","prompt","skill"];function ON(t){const r=[];for(const i of DN){const s=[];for(let o=0;o<t.length;o+=1)t[o].source===i&&s.push({entry:t[o],globalIndex:o});s.length!==0&&r.push({source:i,label:Z0[i],items:s})}return r}function MN(t,r){return!Number.isFinite(r)||r<=0||!Number.isFinite(t)||t<0?0:t>=r?r-1:t}function _N(t){return t==="comfortable"?3:t==="compact"?2:1}function py(t,r,i,s){const o=r.findIndex(y=>y.items.some(k=>k.globalIndex===t));if(o<0)return t;const c=r[o],d=c.items.findIndex(y=>y.globalIndex===t);if(d<0)return t;const h=Math.floor(d/i),p=d%i;if(s==="left"||s==="right"){if(i<=1)return t;const k=d+(s==="left"?-1:1);return k<0||k>=c.items.length||Math.floor(k/i)!==h?t: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?t:k.items[w].globalIndex}return t}function LN(t,r,i){const s=(t.left+t.right)/2;let o=null;for(const c of r){if(c.globalIndex===t.globalIndex)continue;const d=i==="up"?t.top-c.bottom:c.top-t.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 zN(t){const{origin:r,sessionId:i,refs:s,setError:o}=t,[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(se=>{const W=C(se);return k(W.startsWith("/")),W});return}d(C),k(C.startsWith("/"))},[]),[w,E]=S.useState(0),[B,j]=S.useState([]),[I,N]=S.useState(!1),[F,X]=S.useState(null),[O,Y]=S.useState(0),V=S.useRef(null),ae=S.useRef(i),M=S.useRef(0),P=S.useCallback(C=>{b(C),k(C.startsWith("/")),E(0)},[]);S.useLayoutEffect(()=>{ae.current=i,M.current+=1,j([]),X(null),N(!1)},[i]);const $=S.useCallback(async()=>{if(!i){j([]),X(null),N(!1);return}const C=i,se=M.current;ae.current=C,N(!0),X(null);const W=()=>ae.current===C&&M.current===se;try{const Z=await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(C)}/commands`,{credentials:"include"});if(!W())return;if(!Z.ok){X("动态命令加载失败"),j([]);return}const ue=await Z.json().catch(()=>null),me=[];for(const fe of ue?.commands??[]){const ke=fe.source;if(ke!=="extension"&&ke!=="prompt"&&ke!=="skill")continue;const _e=String(fe.command??fe.name??"").trim();_e&&me.push({command:_e.startsWith("/")?_e:`/${_e}`,label:String(fe.label??fe.name??_e),description:String(fe.description??""),source:ke})}if(!W())return;j(me);const ge=typeof ue?.warning=="string"?ue.warning.trim():"";X(ge?ge.slice(0,160):null)}catch{if(!W())return;X("动态命令加载失败"),j([])}finally{W()&&N(!1)}},[r,i]);S.useEffect(()=>{i&&(!y&&O===0||$())},[i,y,O,$]);const te=S.useCallback(()=>{Y(C=>C+1),$()},[$]);S.useEffect(()=>{if(!i)return;const C=c.slice(0,V.current?.selectionStart??c.length).match(/(?:^|\s)@([^\s@]*)$/);if(!C){p([]);return}const se=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(Z=>Z.path)))},150);return()=>window.clearTimeout(se)},[r,i,c]);const G=S.useCallback(C=>{const se=V.current?.selectionStart??c.length,Z=c.slice(0,se).search(/@[^\s@]*$/);Z<0||(b(`${c.slice(0,Z)}@${C} ${c.slice(se)}`),p([]))},[c]),_=S.useCallback(C=>{for(const se of Array.from(C).slice(0,4)){if(!se.type.startsWith("image/")||se.size>5*1024*1024){o("图片仅支持 PNG/JPEG/GIF/WebP,单张不超过 5 MiB");continue}const W=new FileReader;W.onload=()=>{const Z=String(W.result??""),ue=Z.slice(Z.indexOf(",")+1);v(me=>[...me,{name:se.name,type:"image",mimeType:se.type,data:ue}].slice(0,4))},W.readAsDataURL(se)}},[o]),D=S.useCallback(C=>{v(se=>se.filter(W=>W!==C))},[]);S.useLayoutEffect(()=>{const C=V.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":rn()},body:JSON.stringify({text:c})})},400);return()=>window.clearTimeout(C)},[r,i,c]);const H=S.useMemo(()=>X0(B),[B]),z=S.useMemo(()=>c.startsWith("/")?Q0(H,c):[],[c,H]);S.useEffect(()=>{E(C=>MN(C,z.length))},[z.length]);const ne=S.useCallback(()=>{s.isComposingRef.current=!0},[s]),T=S.useCallback(()=>{s.isComposingRef.current=!1,s.compositionEndedAtRef.current=Date.now()},[s]),A=S.useCallback(()=>s.isComposingRef.current,[s]),U=S.useCallback(()=>Date.now()-s.compositionEndedAtRef.current<100,[s]);return S.useEffect(()=>{S0({origin:r,sessionId:i,refs:s})},[r,i,s]),{input:c,setInput:b,handleInputChange:P,fileOptions:h,pendingImages:g,setPendingImages:v,addImagesFromFiles:_,removeImage:D,shortcutOpen:y,setShortcutOpen:k,shortcutIndex:w,setShortcutIndex:E,filteredShortcuts:z,dynamicCommandsLoading:I,dynamicCommandsError:F,retryDynamicCommands:te,insertFileReference:G,textareaRef:V,onCompositionStart:ne,onCompositionEnd:T,isComposingNow:A,recentlyComposedNow:U}}const BN=[{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 HN(t){if(!t)return null;const r=(t.tools??[]).map(s=>({toolId:s.toolId,action:s.action,description:s.description,kind:s.kind??"read",cli:s.cli})),i=[...BN];return{explore:i,operator:r,total:i.length+r.length}}let UN=0;function qN(t){const{origin:r,session:i,setSession:s,refs:o,setError:c}=t,[d,h]=S.useState(null),[p,g]=S.useState([]),[v,y]=S.useState("idle"),[k,b]=S.useState(null),[w,E]=S.useState([]),[B,j]=S.useState(null),[I,N]=S.useState(null),[F,X]=S.useState(!1),[O,Y]=S.useState(!1),[V,ae]=S.useState(!1),M=S.useRef(null),P=S.useRef(null),$=S.useRef(0);S.useEffect(()=>{$.current=-1,X(!1)},[i?.sessionId,X]);const G=fa().snapshot,_=S.useCallback(async()=>{try{const Z=await fetch(`${r}/api/operator/v1/chat/capabilities`);if(!Z.ok)return;const ue=await Z.json();h(ue)}catch{}},[r]);S.useEffect(()=>{_()},[_]);const D=S.useCallback(async()=>{if(!i){g([]),y("idle");return}const Z=i.sessionId;y("loading"),b(null);try{const ue=await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(Z)}/models`,{credentials:"include"}),me=await ue.json().catch(()=>null);if(o.sessionRef.current?.sessionId!==Z)return;if(!ue.ok||!me){y("error"),b(me?.error?.message??`模型列表读取失败(HTTP ${ue.status})`);return}g(me.models??[]),E(me.thinkingLevels??[]),y("ready")}catch(ue){if(o.sessionRef.current?.sessionId!==Z)return;y("error"),b(ue instanceof Error?ue.message:String(ue))}},[r,i,o]);S.useEffect(()=>{D()},[D]),S.useEffect(()=>{if(!i){j(null),N(null);return}const Z=i.sessionId,ue=`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(Z)}`;N(null),fetch(`${ue}/runtime-context`,{credentials:"include"}).then(async me=>{const ge=await me.json().catch(()=>null);if(!ge?.context||o.sessionRef.current?.sessionId!==Z)return;const fe=ge.context,ke=C0().snapshot;j(_e=>b0(_e,fe,ke,Z))}).catch(()=>{o.sessionRef.current?.sessionId===Z&&N("注入上下文读取失败,请重试")})},[r,i?.sessionId,o]),S.useEffect(()=>{if(!G||!i||G.sessionId!==i.sessionId)return;const Z=Ny(G);s(ue=>{if(!ue||ue.sessionId!==G.sessionId||_E(ue,Z))return ue;const me=ub(ue,Z);return o.sessionRef.current=me,me}),j(ue=>{if(!ue)return ue;const me={...ue,...Z.model?{model:Z.model}:{},...Z.thinkingLevel?{thinkingLevel:Z.thinkingLevel}:{}};return me.model?.provider===ue.model?.provider&&me.model?.modelId===ue.model?.modelId&&me.thinkingLevel===ue.thinkingLevel?ue:me})},[G,i?.sessionId,o,s,j]);const H=S.useCallback(async Z=>{if(!i)return!1;const ue=i.sessionId,me=++UN;$.current=me,Dy({type:"mutation-start",token:me}),X(!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":rn()},body:JSON.stringify(Z)}),fe=await ge.json().catch(()=>({}));return $.current!==me?!1:ge.ok?!fe.session||o.sessionRef.current?.sessionId!==ue?!1:k0(me,ue,fe.snapshot):(o.sessionRef.current?.sessionId===ue&&(c(fe.error?.message??`模型或思考等级切换失败(HTTP ${ge.status})`),ca()),!1)}catch(ge){return $.current!==me||o.sessionRef.current?.sessionId===ue&&c(ge instanceof Error?ge.message:String(ge)),!1}finally{w0(me,ue,o)&&$.current===me&&X(!1)}},[r,i,o,s,c]);S.useEffect(()=>{if(!O)return;const Z=me=>{const ge=M.current;ge&&me.target instanceof Node&&!ge.contains(me.target)&&Y(!1)},ue=me=>{me.key==="Escape"&&Y(!1)};return document.addEventListener("mousedown",Z),document.addEventListener("keydown",ue),()=>{document.removeEventListener("mousedown",Z),document.removeEventListener("keydown",ue)}},[O]),S.useEffect(()=>{if(!V)return;const Z=me=>{const ge=P.current;ge&&me.target instanceof Node&&!ge.contains(me.target)&&ae(!1)},ue=me=>{me.key==="Escape"&&ae(!1)};return document.addEventListener("mousedown",Z),document.addEventListener("keydown",ue),()=>{document.removeEventListener("mousedown",Z),document.removeEventListener("keydown",ue)}},[V]);const z=S.useMemo(()=>HN(d),[d]),ne=G?(G.models??[]).map(Z=>({provider:Z.provider,id:Z.id,...Z.name?{name:Z.name}:{},...Z.hasCredentials!==void 0?{hasCredentials:Z.hasCredentials}:{}})):p,T=G?.thinkingLevels?.length?G.thinkingLevels.map(Z=>Z.value):w,A=i?.model??B?.model,U=A?Xl(A.provider,A.modelId):"",C=G?.selection?.thinkingSelection??i?.thinkingLevel??"",se=G?.selection?.effectiveThinkingLevel??i?.thinkingLevel??void 0,W=!U||ne.some(Z=>Xl(Z.provider,Z.id)===U);return{capabilities:d,models:ne,modelsStatus:v,modelsError:k,onRetryModels:()=>{D()},thinkingLevels:T,runtimeContext:B,runtimeContextError:I,onRetryRuntimeContext:()=>{N(null),ca()},toolsOpen:O,setToolsOpen:Y,runtimeContextOpen:V,setRuntimeContextOpen:ae,toolsMenuRef:M,runtimeContextMenuRef:P,switchRuntime:H,switching:F,toolCatalog:z,activeModel:A,activeModelRef:U,activeThinkingLevel:C,effectiveThinkingLevel:se,activeModelListed:W}}const gy={comfortableMin:1450,compactMin:1100};function $N(t){return!Number.isFinite(t)||t<0?"narrow":t>=gy.comfortableMin?"comfortable":t>=gy.compactMin?"compact":"narrow"}const GN={mode:"comfortable",width:1600,landingDensity:"comfortable",emptyHeight:720};function FN(t,r){const[i,s]=S.useState(GN);return S.useEffect(()=>{const o=t.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:$N(v),width:v,landingDensity:D1(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()}},[t,r]),i}function VN(t="none"){return{active:t}}function aa(t,r){return{active:r}}function Gn(t={active:"none"}){return{active:"none"}}function PN(t){return{sidebarDrawerOpen:t.active==="sidebar-drawer",processOpen:t.active==="process",runtimeContextOpen:t.active==="runtime-context",toolsOpen:t.active==="tools",activityOpen:t.active==="activity"}}const YN=160,KN=120,XN=120;function QN(t){return t?t.operationCards.length+t.humanGateCards.length+t.artifactCards.length:0}function ZN(t){const r=QN(t),[i,s]=S.useState(()=>r>0?{phase:"visible",snapshot:t}:{phase:"hidden",snapshot:null}),o=S.useRef(i);o.current=i;const c=S.useMemo(()=>`${t?.sessionId??"none"}:${r}`,[t?.sessionId,r]);return S.useEffect(()=>{const d=[],h=o.current.snapshot;if(!t||r===0){if(!h){s({phase:"hidden",snapshot:null});return}s({phase:"leaving",snapshot:h}),d.push(window.setTimeout(()=>{s({phase:"hidden",snapshot:null})},KN))}else h?h.sessionId!==t.sessionId?(s({phase:"switching",snapshot:t}),d.push(window.setTimeout(()=>{s({phase:"visible",snapshot:t})},XN))):s({phase:"visible",snapshot:t}):(s({phase:"entering",snapshot:t}),d.push(window.setTimeout(()=>{s({phase:"visible",snapshot:t})},YN)));return()=>{for(const p of d)window.clearTimeout(p)}},[t,c,r]),i}function JN(t){const{origin:r,surface:i="standalone"}=t,s=i==="workspace",o=KE(),[c,d]=S.useState(null),[h,p]=S.useState(null),[g,v]=S.useState(!0),[y,k]=S.useState(!0),[b,w]=S.useState(()=>VN()),[E,B]=S.useState(null),[j,I]=S.useState(null),[N,F]=S.useState(0),X=S.useRef(null),O=S.useRef(null),Y=S.useRef(null),V=S.useRef(null),ae=S.useRef(null),M=S.useRef(null),P=S.useRef(null),$=S.useRef(null),te=S.useRef(null),G=S.useRef(()=>{}),_=S.useRef(null),D=S.useRef(!1),H=FN(Y,ae),z=H.mode,ne=PN(b),T=ne.processOpen,A=T,U=ne.runtimeContextOpen,C=ne.activityOpen,se=S.useCallback(ie=>{w(je=>{const bt=je.active==="process";return(typeof ie=="function"?ie(bt):ie)?aa(je,"process"):je.active==="process"?Gn(je):je})},[]),W=zN({origin:r,sessionId:h?.sessionId,refs:o,setError:d}),Z=S.useMemo(()=>ON(W.filteredShortcuts),[W.filteredShortcuts]),ue=IN({origin:r,refs:o,sessionId:h?.sessionId,setError:d}),me=S.useRef(()=>{}),ge=S.useCallback(ie=>{me.current(ie)},[]),fe=iN({origin:r,refs:o,sessionId:h?.sessionId,setError:d,onReconcile:ge});me.current=ie=>{const je=o.sessionRef.current?.sessionId;je&&(async()=>await fe.recoverSession(je)?(I({id:Date.now(),message:"已自动恢复:会话事件已重新同步,可继续对话。"}),F(Rt=>Rt+1)):I({id:Date.now(),message:"自动恢复未完成,将在重连时重试。"}))()};const ke=fe.operationCards.length+fe.humanGateCards.length+fe.artifactCards.length,_e=S.useMemo(()=>Vy(fe.operationCards).length+fe.humanGateCards.length+fe.artifactCards.length,[fe.operationCards,fe.humanGateCards.length,fe.artifactCards.length]),Ze=S.useMemo(()=>h?{sessionId:h.sessionId,operationCards:fe.operationCards,humanGateCards:fe.humanGateCards,artifactCards:fe.artifactCards}:null,[h,fe.operationCards,fe.humanGateCards,fe.artifactCards]),Ve=ZN(Ze),lt=S.useMemo(()=>d1({operations:fe.operationCards,gates:fe.humanGateCards,artifacts:fe.artifactCards}),[fe.operationCards,fe.humanGateCards,fe.artifactCards]),sn=S.useCallback(ie=>lt.has(ie),[lt]),Ot=I1(V,z,h?.sessionId??"no-session"),Mt=Ot.presentation==="sidecar";S.useEffect(()=>{const ie=z==="comfortable"&&b.active==="sidebar-drawer",je=Mt&&b.active==="activity";(ie||je)&&w(bt=>bt.active===b.active?Gn(bt):bt)},[Mt,z,b.active]),S.useEffect(()=>{B(null)},[h?.sessionId]),S.useEffect(()=>{ke>0||b.active!=="activity"||w(ie=>ie.active==="activity"?Gn(ie):ie)},[ke,b.active]);const Nt=S.useCallback(ie=>{ie&&B(ie),Mt||w(je=>aa(je,"activity"))},[Mt]),qt=S.useCallback(()=>{w(ie=>ie.active==="activity"?Gn(ie):ie)},[]),Ne=S.useCallback(ie=>{const je=O.current;if(!je)return;const Rt=Array.from(je.querySelectorAll("[data-activity-ref]")).find(Vt=>ie.includes(Vt.dataset.activityRef??""));if(!Rt){I({id:Date.now(),message:"详细运行记录暂时没有对应的对话位置。"});return}Rt.scrollIntoView({block:"center",behavior:"smooth"}),Rt.classList.add("is-located"),window.setTimeout(()=>Rt.classList.remove("is-located"),1400),Mt||qt()},[Mt,qt]),Ee=oN({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:se,setAutoScroll:k}),dt=NN({origin:r,refs:o,session:h,thread:fe,composer:{setInput:W.setInput,setPendingImages:W.setPendingImages},setError:d,setNotice:I,setAutoScroll:k,recoveryVersion:N,watchSessionTitle:Ee.watchSessionTitle}),Oe=AN({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(ie=>aa(ie,"runtime-context")):!$e.runtimeContextOpen&&b.active==="runtime-context"&&w(ie=>Gn(ie))},[$e.runtimeContextOpen,b.active]),S.useEffect(()=>{b.active!=="runtime-context"&&$e.runtimeContextOpen&&$e.setRuntimeContextOpen(!1)},[b.active]);const{sendPrompt:le,handleStop:he}=dt,be=S.useRef(()=>{}),we=S.useCallback(async ie=>{const je=ag(ie);if(je&&je.action!=="unknown"&&je.action!=="pi-prompt"){be.current(ie);return}await le(ie,W.pendingImages)},[le,W.pendingImages]);G.current=ie=>{we(ie)};const Me=S.useCallback(()=>{W.textareaRef.current?.focus()},[W.textareaRef]),rt=S.useCallback(()=>{w(ie=>ie.active==="sidebar-drawer"?Gn(ie):ie)},[]),jt=S.useCallback(()=>{$e.setRuntimeContextOpen(!1),w(ie=>aa(ie,"sidebar-drawer"))},[$e.setRuntimeContextOpen]),Ce=S.useCallback(ie=>{Ee.activateSession(ie),rt(),queueMicrotask(()=>{O.current?.focus?.(),Me()})},[Ee,rt,Me]),Te=S.useCallback(ie=>{W.setInput(je=>`${je}${je&&!je.endsWith(" ")?" ":""}@${ie} `),rt(),queueMicrotask(()=>Me())},[W,rt,Me]),Be=S.useCallback(ie=>{ue.openPreview(ie),rt()},[ue,rt]),Ae=S.useCallback(()=>{const ie=O.current;if(!ie)return;const je=ie.scrollHeight-ie.scrollTop-ie.clientHeight<80;k(je)},[]);S.useEffect(()=>{y&&X.current?.scrollIntoView({behavior:"smooth",block:"end"})},[fe.messages,y,fe.streaming]),S.useEffect(()=>{if(!j)return;const ie=window.setTimeout(()=>I(null),6e3);return()=>window.clearTimeout(ie)},[j]);const At=S.useCallback(ie=>{if(ie.action==="pi-prompt"||ie.command==="/name"||ie.command==="/compact"){W.setInput(`${ie.command} `),W.setShortcutOpen(!1),W.textareaRef.current?.focus();return}be.current(ie.command)},[W]),_t=S.useCallback(ie=>{const je=ag(ie),bt=ie.trim(),Rt=bt.split(/\s+/,1)[0]?.toLowerCase()??"";if(W.setInput(""),W.setShortcutOpen(!1),!je)return;if(je.action==="focus:interview"){if(!h){I({id:Date.now(),message:"请先创建或打开一个会话,再开始 Interview"});return}Oe.startInterview();return}const Vt=K0(je.action);if(Vt){t.onNavigateWorkspace?.(Vt,{});return}if(je.action==="compact"){const on=bt.slice(Rt.length).trim();Ee.compactSession(on||void 0);return}if(je.action==="name"){const on=bt.slice(Rt.length).trim(),Pt=h?.sessionId;if(!Pt){d("当前没有可重命名的会话");return}const bn=Ee.sessionList.find(un=>un.sessionId===Pt),zn=on||window.prompt("会话名称",bn?.title??bn?.displayTitle??"")||"";zn.trim()&&Ee.updateSession(Pt,{title:zn.trim()});return}if(je.action==="session"){const on=h?.sessionId??"(none)",Pt=Ee.sessionList.find(zn=>zn.sessionId===on),bn=Pt?.title||Pt?.displayTitle||"未命名对话";I({id:Date.now(),message:`当前会话:${bn}(${on})`});return}if(je.action==="copy"){const Pt=[...fe.visibleMessages??[]].reverse().find(bn=>bn.role==="assistant");if(!Pt?.text){d("没有可复制的助手消息");return}navigator.clipboard?.writeText(Pt.text).then(()=>I({id:Date.now(),message:"已复制最后一条助手消息"}),()=>d("复制失败"));return}if(je.action==="unknown"){le(bt,W.pendingImages);return}d(`未知 shortcut:${je.command}`)},[W.setInput,W.setShortcutOpen,W.pendingImages,Oe.startInterview,t.onNavigateWorkspace,Ee,h,fe.visibleMessages,le]);be.current=_t;const ga=S.useCallback(ie=>{const je=o.isComposingRef.current||ie.nativeEvent.isComposing,bt=Date.now()-o.compositionEndedAtRef.current<100;if(W.shortcutOpen&&W.filteredShortcuts.length>0&&!je&&!bt){if(ie.key==="ArrowLeft"||ie.key==="ArrowRight"||ie.key==="ArrowUp"||ie.key==="ArrowDown"){ie.preventDefault();const Rt=_N(z);let Vt=W.shortcutIndex;if(ie.key==="ArrowLeft"||ie.key==="ArrowRight")Vt=py(W.shortcutIndex,Z,Rt,ie.key==="ArrowLeft"?"left":"right");else{const on=_.current;let Pt=null;if(on){const bn=Array.from(on.querySelectorAll("[data-shortcut-index]")).map(un=>{const gr=un.getBoundingClientRect();return{globalIndex:Number(un.dataset.shortcutIndex??-1),top:gr.top,bottom:gr.bottom,left:gr.left,right:gr.right}}).filter(un=>Number.isFinite(un.globalIndex)&&un.globalIndex>=0),zn=bn.find(un=>un.globalIndex===W.shortcutIndex)??null;zn&&(Pt=LN(zn,bn,ie.key==="ArrowUp"?"up":"down"))}Vt=Pt??py(W.shortcutIndex,Z,Rt,ie.key==="ArrowUp"?"up":"down")}Vt!==W.shortcutIndex&&(D.current=!0,W.setShortcutIndex(Vt));return}if(ie.key==="Escape"){ie.preventDefault(),W.setShortcutOpen(!1);return}if(ie.key==="Enter"||ie.key==="Tab"){ie.preventDefault();const Rt=W.filteredShortcuts[W.shortcutIndex]??W.filteredShortcuts[0];At(Rt);return}}if(ie.key==="Enter"&&!ie.shiftKey&&(je||bt)){bt&&ie.preventDefault();return}if(ie.key==="Enter"&&!ie.shiftKey){ie.preventDefault(),we(W.input);return}},[W.input,W.shortcutOpen,W.filteredShortcuts,W.shortcutIndex,W.setShortcutIndex,W.setShortcutOpen,o,we,At,z,Z,_,D]),In=fe.visibleMessages.length>0||fe.operationCards.length>0||fe.humanGateCards.length>0||fe.artifactCards.length>0||!!fe.interview,Yn=t.readiness==="setup-required"?"⚠ Pi 未就绪(setup-required):Chat 需要先完成 Pi 认证 / 模型配置。":t.readiness==="degraded"?"⚠ Pi 降级(degraded):可继续对话,但部分能力不可用。":null,vt=u.jsx(V0,{origin:r,open:g,layoutMode:z,drawerOpen:ne.sidebarDrawerOpen,activeSessionId:h?.sessionId,sessions:Ee.sessionList,tree:ue.tree,expanded:ue.expandedDirs,treeError:ue.treeError,onToggleOpen:()=>v(ie=>!ie),onOpenDrawer:jt,onCloseDrawer:rt,onCreate:()=>{Ee.createSession()},creatingSession:Ee.creatingSession,onActivate:ie=>{ne.sidebarDrawerOpen?Ce(ie):Ee.activateSession(ie)},onRename:(ie,je)=>{Ee.updateSession(ie,{title:je})},onSetState:(ie,je)=>{Ee.updateSession(ie,{state:je})},onDelete:ie=>Ee.deleteSession(ie),onRefreshTree:()=>{ue.loadTree()},onToggleDir:ue.toggleDir,onInsert:ie=>{ne.sidebarDrawerOpen?Te(ie):W.setInput(je=>`${je}${je&&!je.endsWith(" ")?" ":""}@${ie} `)},onPreview:ie=>{ne.sidebarDrawerOpen?Be(ie):ue.openPreview(ie)},drawerTriggerRef:M}),ln=["oc-workspace",T&&!A?"has-process":"",A?"has-process-overlay":""].filter(Boolean).join(" "),Pr=ie=>u.jsx("div",{className:"oc-messages is-empty",ref:ae,"data-landing-density":H.landingDensity,children:u.jsx(Wy,{mode:ie,readiness:t.readiness,density:H.landingDensity,onSuggest:async je=>{Ee.creatingSession||(ie==="no-session"?await Ee.createSession()&&await we(je):await we(je))},disabled:Ee.creatingSession,onCreateSession:ie==="no-session"?()=>{Ee.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。"]})]}),Yn&&u.jsx("div",{className:"oc-alert oc-alert-warning",children:Yn}),c&&u.jsxs("div",{className:"oc-alert oc-alert-error",children:[u.jsx("strong",{children:"出错了:"}),c]}),j&&u.jsx("div",{className:"oc-alert oc-alert-warning",role:"status",children:j.message}),h?u.jsxs("div",{className:ln,ref:Y,"data-layout-mode":z,children:[vt,u.jsxs("div",{ref:V,className:`oc-main${In?"":" is-landing"}`,children:[!Mt&&(z==="narrow"||ke>0)?u.jsxs("div",{className:"oc-main-topbar",children:[z==="narrow"?u.jsx("button",{type:"button",className:"oc-main-topbar-btn",ref:M,"aria-label":"打开会话与仓库","aria-expanded":ne.sidebarDrawerOpen,onClick:()=>ne.sidebarDrawerOpen?rt():jt(),children:"会话与仓库"}):null,ke>0?u.jsxs("button",{type:"button",className:"oc-main-topbar-btn oc-activity-trigger",ref:te,"aria-controls":"oc-activity-rail","aria-expanded":C,onClick:()=>C?qt():Nt(),children:["运行活动 ",u.jsx("span",{children:_e})]}):null]}):null,u.jsx(Y0,{previews:ue.previews,activePath:ue.activePreviewPath,loading:ue.previewLoading,onActivate:ue.setActivePreviewPath,onClose:ue.closePreview}),In?u.jsx(AE,{scrollContainerRef:O,messagesEndRef:X,onScroll:Ae,hasThread:In,readiness:t.readiness,streaming:fe.streaming,streamingAssistantId:fe.streamingAssistantId,messagesCount:fe.messages.length,visibleCount:fe.visibleMessages.length,onLoadMore:()=>fe.setHistoryLimit(ie=>ie+50),turnGroups:fe.turnGroups,interview:fe.interview,interviewAnswer:Oe.interviewAnswer,onInterviewAnswerChange:Oe.setInterviewAnswer,onAnswerInterview:ie=>{Oe.answerInterview(ie)},onConfirmTaskKind:()=>{Oe.confirmTaskKind()},onActivateActivity:Nt,canActivateActivity:sn,onSuggest:ie=>{we(ie)}}):Pr("empty-session"),u.jsx(FE,{composer:W,streaming:fe.streaming,hasThread:In,layoutMode:z,paletteModel:Z,shortcutPaletteRef:_,paletteKeyboardNavRef:D,onSend:ie=>{we(ie)},onStop:he,onKeyDown:ga,onRunShortcut:_t,models:$e.models,activeModel:$e.activeModel,activeModelRef:$e.activeModelRef,activeModelListed:$e.activeModelListed,activeThinkingLevel:$e.activeThinkingLevel,thinkingLevels:$e.thinkingLevels,onSwitchRuntime:ie=>{$e.switchRuntime(ie)},usage:fe.usage,unread:fe.unread,onCompact:()=>{Ee.compactSession()},processSummary:fe.processSummary,processOpen:T,onToggleProcess:()=>{w(ie=>ie.active==="process"?Gn(ie):aa(ie,"process")),T||$e.setRuntimeContextOpen(!1)},processTriggerRef:P,runtimeContext:$e.runtimeContext,runtimeContextOpen:U,onToggleRuntimeContext:()=>{U?($e.setRuntimeContextOpen(!1),w(ie=>ie.active==="runtime-context"?Gn(ie):ie)):($e.setRuntimeContextOpen(!0),w(ie=>aa(ie,"runtime-context")))},runtimeContextTriggerRef:$})]}),ke>0&&!Mt&&C?u.jsx("button",{type:"button",className:"oc-overlay-backdrop is-activity","aria-label":"关闭运行活动遮罩",onClick:qt}):null,Ve.snapshot?u.jsx(E1,{origin:r,sessionId:Ve.snapshot.sessionId,presentation:Ot.presentation,sidecarRect:Ot.sidecarRect,phase:Ve.phase,open:C,focusRef:E,triggerRef:te,operationCards:Ve.snapshot.operationCards,humanGateCards:Ve.snapshot.humanGateCards,artifactCards:Ve.snapshot.artifactCards,onClose:qt,onLocateConversation:Ne,onNavigateWorkspace:t.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(ie=>ie.active==="runtime-context"?Gn(ie):ie)}}),u.jsx(YE,{panelOnly:!0,open:U,onToggle:()=>{},onClose:()=>{$e.setRuntimeContextOpen(!1),w(ie=>ie.active==="runtime-context"?Gn(ie):ie)},context:$e.runtimeContext,triggerRef:$})]}):null,T&&u.jsxs(u.Fragment,{children:[A?u.jsx("button",{type:"button",className:"oc-overlay-backdrop is-process","aria-label":"关闭工具调用记录遮罩",onClick:()=>se(!1)}):null,u.jsx(VE,{toolCalls:fe.toolCalls,overlay:A,onClose:()=>se(!1),triggerRef:P})]})]}):u.jsxs("div",{className:ln,ref:Y,"data-layout-mode":z,children:[vt,u.jsxs("div",{className:"oc-main is-landing",children:[z==="narrow"?u.jsx("div",{className:"oc-main-topbar",children:u.jsx("button",{type:"button",className:"oc-main-topbar-btn",ref:M,"aria-label":"打开会话与仓库","aria-expanded":ne.sidebarDrawerOpen,onClick:()=>ne.sidebarDrawerOpen?rt():jt(),children:"会话与仓库"})}):null,Pr("no-session")]})]})]})}function WN(t){return t==="validate"||t==="apply"||t==="spine"?"contract":t}const db="X-Loop-Console-Confirmation",fb="agent-worker console doctor --repo .",pd=[{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)"}],hb={"setup-required":"需要设置",ready:"已就绪",degraded:"降级可用",unknown:"未知"},eA={idle:"未探测",match:"匹配",mismatch:"仓库不匹配",unavailable:"不可用"},mb={low:"低",medium:"中",high:"高"},pb={"validation-failed":"校验失败","contract-drift":"契约漂移","runtime-mismatch":"运行时不匹配","pause-on-human":"等待人工","verification-failed":"验证失败","orphan-unknown":"孤立/未知","terminal-failed":"已终止(失败)","terminal-succeeded":"已终止(成功)","needs-reconcile":"需要对账"},tA={idle:"空闲","not-started":"未开始","not-run":"未运行","n/a (MVP)":"不适用(MVP)",accepted:"已接受",succeeded:"已成功",running:"运行中",ran:"已执行"};function Hl(t){return tA[t]??t}function gb(){return window.__CONSOLE_CONFIRMATION_TOKEN__??""}function eo(t){return`${t}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}async function Gd(t,r={},i){const s={"Content-Type":"application/json",[db]:gb()},o=await fetch("/api/operator/v1/operations",{method:"POST",credentials:"same-origin",headers:s,body:JSON.stringify({action:t,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 nA=new Set(["runDag","dagRerun","dagReconcileRun","standaloneTaskRerun"]);function ed(t){const r=(t.blockedReasons??[]).map(String),i=(t.blockingNodes??[]).map(o=>[o.nodeId,o.reasonCode].filter(Boolean).join(":")),s=[...r,...i].filter(Boolean);return s.length===0?"从节点重跑不具备安全资格(子图含 writer / unsafe shell / decision-gate 等)。可改用「完整重跑任务」,或另选只读安全子图的起始节点。":`从节点重跑不具备安全资格:${s.slice(0,6).join("; ")}${s.length>6?"…":""}。可改用「完整重跑任务」。`}async function yy(t,r=9e4){const i=Date.now();for(;Date.now()-i<r;){const s=await fetch(`/api/operator/v1/operations/${encodeURIComponent(t)}`,{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 rA={};function iA(){const[t,r]=S.useState(()=>Xy({env:rA?.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,E]=S.useState(null),[B,j]=S.useState(null),[I,N]=S.useState(null),[F,X]=S.useState(null),[O,Y]=S.useState({command:"idle",dag:"not-started",verification:"not-run",promote:"n/a (MVP)"}),[V,ae]=S.useState("setup"),M=S.useCallback(_=>{ae(D=>WN(typeof _=="function"?_(D):_))},[]),P=o==="setup-required",$=o==="degraded",te=S.useCallback(_=>{_!==t&&(E(null),N(null),j(null)),r(_)},[t]),G=S.useCallback(async()=>{try{const D=await(await fetch("/api/health")).json();s(D);const H=D.piReadiness??"setup-required";c(H),g(null),M(H==="ready"||H==="degraded"?z=>z==="setup"?"import-prd":z:"setup")}catch(_){g(_ instanceof Error?_.message:String(_))}try{const D=await(await fetch("/api/operator/v1/readiness")).json();h(D),D.state&&c(D.state)}catch{}},[M]);return{nav:t,setNav:r,selectNav:te,health:i,readiness:o,setReadiness:c,readinessReport:d,healthError:p,loadHealth:G,busy:v,setBusy:y,observeBusy:k,setObserveBusy:b,opError:w,setOpError:E,opMessage:B,setOpMessage:j,opErrorCode:I,setOpErrorCode:N,lastOpState:F,setLastOpState:X,layers:O,setLayers:Y,step:V,setStep:M,setupBlocked:P,degraded:$}}const aA={bootstrapFromPrd:"正在导入 PRD 并创建任务:归档文档 → 确定性解析 → 语义结构化(约 10–60 秒,请勿关闭页面)",importPrd:"正在导入 PRD:归档文档 → 确定性解析 → 语义结构化(约 10–60 秒,请勿关闭页面)",interviewStart:"正在启动需求访谈…",interviewTurn:"正在提交访谈回答…",interviewSkip:"正在跳过访谈并生成评估…",contractValidate:"正在校验契约草稿…",contractDiff:"正在计算契约差异…",contractApply:"正在应用契约(写入需求与执行约束)…",spineCheck:"正在运行 Spine 审计…",dagGenerate:"正在生成 DAG…"};function sA(t){const{shell:r,applyInterviewPayload:i}=t,{setBusy:s,setOpError:o,setOpErrorCode:c,setOpMessage:d,setReadiness:h,setStep:p,setNav:g,setLastOpState:v,setLayers:y,step:k,nav:b}=r,[w,E]=S.useState(null),[B,j]=S.useState([]),[I,N]=S.useState(!0),F=S.useRef(null),[X,O]=S.useState(null),[Y,V]=S.useState(null),ae=S.useCallback(async(G,_={},D)=>{s(!0),o(null),c(null),d(aA[G]??null);try{const{status:H,body:z}=await Gd(G,_,D?.clientRequestId);if(H===412||z.error?.code==="PI_SETUP_REQUIRED")return o(la(z.error?.message??"Pi 未就绪或已降级:该操作暂不可用")),c(z.error?.code??"PI_SETUP_REQUIRED"),h("setup-required"),p("setup"),g("models"),z;if(H>=400||z.ok===!1)return o(la(z.error?.message??z.message??`操作失败(HTTP ${H})`)),c(z.error?.code??String(H)),v(z.state??`failed:${H}`),y(A=>({...A,command:z.error?.message??`failed:${z.error?.code??H}`})),z;if(z.operationId){const A=window.localStorage.getItem(_n)?.trim();if(A&&fetch(`/api/operator/v1/chat/sessions/${encodeURIComponent(A)}/operation-links`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json",[db]:gb()},body:JSON.stringify({operationId:z.operationId})}).then(U=>{U.ok||console.warn("Operator Chat operation link failed",U.status)}).catch(U=>console.warn("Operator Chat operation link failed",U)),E(z.operationId),v(z.state??"accepted"),y(U=>({...U,command:z.state??"accepted",dag:G==="runDag"?"running":U.dag})),nA.has(G)){N(!0),d(`操作已接受,后台运行中:${z.operationId}(请看事件流;可同时打开 Observe)`);const U=z.operationId;yy(U,30*6e4).then(C=>{if(C){if(v(C.state??null),C.state==="failed"||C.state==="needs-reconcile"||C.state==="timed-out"){o(la(C.errorMessage??C.stderrPreview??`操作失败:${C.state}`)),c(C.errorCode??C.state??null),y(se=>({...se,command:`failed:${C.errorCode??C.state}`}));return}C.state==="succeeded"&&(d(`${G} 已成功`),y(se=>({...se,command:"succeeded"})))}})}else{d(`操作已接受:${z.operationId}`);const U=await yy(z.operationId);if(U){if(v(U.state??null),U.state==="failed"||U.state==="needs-reconcile"||U.state==="timed-out")return o(la(U.errorMessage??U.stderrPreview??`操作失败:${U.state}`)),c(U.errorCode??U.state??null),y(Z=>({...Z,command:`failed:${U.errorCode??U.state}`})),{ok:!1,operationId:z.operationId,state:U.state,error:{code:U.errorCode??U.state??"INTERNAL_ERROR",message:U.errorMessage??U.stderrPreview??`操作失败:${U.state}`}};d(U.errorMessage?`${G}:${U.errorMessage}`:`${G} 已成功`),y(Z=>({...Z,command:U.state??"succeeded"}));const C=U.result??{},se={ok:!0,operationId:z.operationId,state:U.state??"succeeded",result:C};(G==="interviewStart"||G==="interviewTurn"||G==="interviewSkip")&&i(C);const W=C.confirmation;return W?.confirmationId&&(O(W.confirmationId),V(C)),D?.advanceTo&&p(D.advanceTo),se}}}else d(`${G} 已完成`),v(z.state??"succeeded"),y(A=>({...A,command:"succeeded",verification:G==="contractValidate"||G==="spineCheck"?"ran":A.verification}));const ne=z.result??{};(G==="interviewStart"||G==="interviewTurn"||G==="interviewSkip")&&i(ne);const T=ne.confirmation;return T?.confirmationId&&(O(T.confirmationId),V(ne)),D?.advanceTo&&p(D.advanceTo),z}catch(H){o(H instanceof Error?H.message:String(H));return}finally{s(!1)}},[i,s,o,c,d,h,p,g,v,y]),M=S.useCallback(G=>{if(!G)return"无响应";if(G.error?.message)return G.error.message;if(G.message)return G.message;const _=G.result;if(_&&typeof _=="object")try{return JSON.stringify(_).slice(0,1200)}catch{return"已返回结果"}return G.ok===!1?"失败":"成功"},[]),P=S.useCallback(G=>{if(!G||G.ok===!1||G.error)return!1;const _=G.result;if(!_)return!0;if(typeof _.valid=="boolean")return _.valid;const D=_.result;return D&&typeof D.valid=="boolean"?D.valid:!0},[]),$=S.useCallback(async G=>{F.current?.abort();const _=new AbortController;F.current=_,j(D=>[...D,`开始跟随事件流 ${G}`]);try{const D=await fetch(`/api/operator/v1/operations/${encodeURIComponent(G)}/events`,{credentials:"same-origin",signal:_.signal});if(!D.ok||!D.body){j(T=>[...T,`事件流 HTTP ${D.status}`]);return}const H=D.body.getReader(),z=new TextDecoder;let ne="";for(;I;){const{done:T,value:A}=await H.read();if(T)break;ne+=z.decode(A,{stream:!0});const U=ne.split(`
|
|
51
|
+
|
|
52
|
+
`);ne=U.pop()??"";for(const C of U){const se=C.split(`
|
|
53
|
+
`).find(Z=>Z.startsWith("data:"));if(!se)continue;const W=se.slice(5).trim();j(Z=>[...Z.slice(-80),W.slice(0,240)])}}}catch(D){D.name!=="AbortError"&&j(H=>[...H,`事件流错误:${D instanceof Error?D.message:String(D)}`])}},[I]);S.useEffect(()=>(w&&I&&(k==="run"||b==="recovery")&&$(w),()=>F.current?.abort()),[w,I,k,b,$]);const te=S.useCallback(()=>{N(!1),F.current?.abort(),d("已停止跟随日志(未取消子进程)")},[d]);return{runAction:ae,summarizeEnvelope:M,isActionSuccess:P,operationId:w,setOperationId:E,sseLog:B,followSse:I,setFollowSse:N,stopFollowSse:te,confirmationId:X,setConfirmationId:O,confirmationDetails:Y,setConfirmationDetails:V}}const gd=8*1024*1024,lA=10*1024*1024,to=8,oA=".md,.markdown,.txt,text/markdown,text/plain",uA=[".md",".markdown",".txt"],Fd=/\.[^.]+$/;function cA(t){const r=Fd.exec(t.trim());return r?r[0].toLowerCase():""}function dA(t){const r=cA(t);return uA.includes(r)}function yd(t){if(!Number.isFinite(t)||t<0)return"0 B";if(t<1024)return`${t} B`;if(t<1024*1024){const i=t/1024;return`${i>=10?i.toFixed(0):i.toFixed(1)} KiB`}const r=t/(1024*1024);return`${r>=10?r.toFixed(1):r.toFixed(2)} MiB`}function mr(t,r){return{ok:!1,code:t,message:r}}function fA(t,r){const i=t?Array.from(t):[],s=r?.maxFiles??to,o=r?.existingCount??0;return i.length===0?mr("file-count","请选择至少一个 .md / .markdown / .txt 文件"):o+i.length>s?mr("file-count",`最多支持 ${s} 个文件(当前已有 ${o} 个)`):null}async function hA(t){const r=t.name?.trim()||"untitled.md";if(!dA(r))return mr("unsupported-extension","仅支持 .md、.markdown、.txt 文件");if(t.size>gd)return mr("file-too-large",`文件不能超过 ${yd(gd)}`);let i;try{i=await t.arrayBuffer()}catch{return mr("read-failed","文件读取失败,请重试或直接粘贴")}let s;try{s=new TextDecoder("utf-8",{fatal:!0}).decode(i)}catch{return mr("invalid-utf8","文件不是有效 UTF-8,请另存为 UTF-8")}if(s.trim().length===0)return mr("empty-content","文件内容不能为空或只有空白");const o=new TextEncoder().encode(s).byteLength;return{ok:!0,text:s,fileName:r,sourceBytes:t.size,textBytes:o}}async function mA(t){if(t.length===0)return mr("file-count","请选择至少一个 .md / .markdown / .txt 文件");if(t.length>to)return mr("file-count",`最多支持 ${to} 个文件`);const r=[];for(const i of t){const s=await hA(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 pA(t,r){const i=t.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(Fd,"").trim()||"需求"}function gA(t){return t.trim().toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"").replace(/-{2,}/g,"-")||"requirement"}function yA(t,r){const i=t.replace(Fd,"").trim(),s=gA(i);return s==="requirement"&&/[^\u0000-\u007f]/.test(i)?`part-${r+1}`:s==="requirement"?i?`part-${r+1}`:`part-${r+1}`:s}function vA(t){const r=new Set;return t.map((i,s)=>{let o=yA(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 bA(t,r){if(t.length===0)return"";if(t.length===1)return t[0].text;const i=Math.min(Math.max(0,r?.primaryIndex??0),t.length-1),s=t[i],o=pA(s.text,s.fileName),d=[`<!-- composed-from: ${t.map(h=>h.fileName).join(", ")} -->`,"",`# ${o}`,""];for(const h of t)d.push(`## 来源:${h.fileName}`,"",h.text.trim(),"");return`${d.join(`
|
|
54
|
+
`).trimEnd()}
|
|
55
|
+
`}function xA(t,r,i){const s={action:t,actionParams:r};return new TextEncoder().encode(JSON.stringify(s)).byteLength<=lA}function SA(){return"最终内容导致请求体超过服务端限制,请缩小文档或减少文件数量"}function kA(){const[t,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),E=S.useRef(0),B=S.useCallback((P,$)=>{const te=P.length===0?0:Math.min(Math.max(0,$),P.length-1);c(te),r(bA(P,{primaryIndex:te})),h(!1)},[]),j=S.useCallback(async P=>{const $=fA(P,{existingCount:i.length});if($){g($.message);return}const te=Array.from(P),G=++E.current;y(!0),g(null);try{const _=await mA(te);if(G!==E.current)return;if(!_.ok){g(_.message);return}const D=[...i,..._.documents],H=i.length===0?0:o;s(D),i.length===0||!d?(B(D,H),g(null)):g("已追加文件,未改正文(正文已手动编辑);可点「按文件重新合成」覆盖。")}catch{if(G!==E.current)return;g("文件读取失败,请重试或直接粘贴")}finally{G===E.current&&y(!1)}},[B,d,i,o]),I=S.useCallback(P=>{r(P),i.length>0&&h(!0)},[i.length]),N=S.useCallback(P=>{c(P),d||B(i,P)},[B,d,i]),F=S.useCallback((P,$)=>{const te=P+$,G=[...i],_=G[te];G[te]=G[P],G[P]=_;const D=o===P?te:o===te?P:o;s(G),c(D),d||B(G,D)},[B,d,i,o]),X=S.useCallback(P=>{const $=i.filter((G,_)=>_!==P),te=$.length===0?0:Math.min(o>=P?Math.max(0,o-1):o,Math.max(0,$.length-1));s($),c(te),$.length===0?h(!1):d||B($,te)},[B,d,i,o]),O=S.useCallback(()=>{s([]),c(0),h(!1),g(null)},[]),Y=S.useCallback(()=>{d&&!window.confirm("将用当前文件列表重新合成正文,覆盖你在编辑区的修改。继续?")||(B(i,o),g(null))},[B,d,i,o]),V=S.useCallback((P,$)=>{P.preventDefault(),P.stopPropagation(),!$&&(w.current+=1,b(!0))},[]),ae=S.useCallback(P=>{P.preventDefault(),P.stopPropagation(),w.current=Math.max(0,w.current-1),w.current===0&&b(!1)},[]),M=S.useCallback((P,$)=>{P.preventDefault(),P.stopPropagation(),w.current=0,b(!1),!$&&j(P.dataTransfer.files)},[j]);return{prdText:t,setPrdText:r,onPrdTextChange:I,prdDocuments:i,prdPrimaryIndex:o,prdComposedDirty:d,prdFileError:p,setPrdFileError:g,prdFileReading:v,prdDragOver:k,loadPrdFromFiles:j,applyPrdComposition:B,setPrimaryDocument:N,moveDocument:F,removeDocument:X,clearDocuments:O,recomposeDocuments:Y,onDragEnter:V,onDragLeave:ae,onDrop:M}}const wA={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 执行;provider 抖动/只读下游优先,勿无理由新开 task",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:"整单重跑:仅当 from-node plan 不合格(writer/decision/fingerprint)或契约/源真变时;需确认原因",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 队列任务失败时使用,不要与 DAG 重跑混用",commandHint:"agent-worker task retry <task-id> --feature-id <feature-id> --repo . --reason <reason>"}},vy={"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"]};function CA(t){return(vy[t]??vy["orphan-unknown"]).map(i=>wA[i])}function jA(t){const r=[],i=[];for(const s of t)s.lane==="worker"?i.push(s):r.push(s);return{dag:r,worker:i}}function RA(t){return typeof t.action=="string"&&t.action.trim().length>0}function yb(t){return CA(t).filter(RA)}function TA(t){const r=new Set(yb(t).map(s=>s.id)),i=(...s)=>{for(const o of s)if(r.has(o))return o;return null};switch(t){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"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 EA(t){if(t.needsReconcile)return"needs-reconcile";const r=(t.errorCode??"").toLowerCase(),i=(t.operationState??"").toLowerCase(),s=(t.dagStatus??"").toLowerCase(),o=(t.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":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 Vd=new Set(["failed","error","partial_failed"]),vb=new Set(["blocked","paused","awaiting_human"]);function fo(t){return(t??"").trim().toLowerCase()}function NA(t){return Vd.has(fo(t))}function by(t){const r=fo(t.status);return Vd.has(r)||r.includes("fail")?0:t.lifecycle==="paused"||r==="paused"?1:t.lifecycle==="active"?2:3}function AA(t){return[...t].sort((r,i)=>{const s=by(r)-by(i);return s!==0?s:i.mtimeMs-r.mtimeMs})}function IA(t){return AA(t)[0]?.dagRunId}function xy(t){const r=fo(t.status);return Vd.has(r)?0:vb.has(r)?1:2}function bb(t){return[...t].sort((r,i)=>{const s=xy(r)-xy(i);return s!==0?s:r.nodeId.localeCompare(i.nodeId)})}function DA(t){const r=bb(t);return r.find(s=>NA(s.status)||vb.has(fo(s.status)))?.nodeId??r[0]?.nodeId}function OA(t){const r=t.status?.trim()||t.lifecycle;return`${t.dagRunId.length>36?`${t.dagRunId.slice(0,18)}…${t.dagRunId.slice(-8)}`:t.dagRunId} · ${r}`}function MA(t){const r=t.status?.trim()||"unknown",i=t.label?.trim();return i&&i!==t.nodeId?`${t.nodeId} · ${r} · ${i}`:`${t.nodeId} · ${r}`}function _A(t){const i=[`operator-recovery: ${t.actionLabel?.trim()||"恢复"}`],s=t.dagRunId?.trim();if(s){const h=t.runStatus?.trim();i.push(h?`run=${s} (${h})`:`run=${s}`)}const o=t.fromNodeId?.trim();if(o){const h=t.nodeStatus?.trim();i.push(h?`from-node=${o} (${h})`:`from-node=${o}`)}const c=t.factClassLabel?.trim();c&&i.push(`fact=${c}`);const d=t.nodeError?.trim()||t.errorMessage?.trim()||(t.errorCode?.trim()?`code=${t.errorCode.trim()}`:"");return d&&i.push(`detail=${d.replace(/\s+/g," ").slice(0,280)}`),i.join(`
|
|
56
|
+
`).slice(0,500)}function xb(t){const r=t.trim();return r?r==="operator-recovery"||r.startsWith("operator-recovery:")||r.startsWith("recovery:"):!0}function LA(t){const{shell:r,actions:i,taskId:s,dagRunId:o,fromNodeId:c,featureId:d,recoveryReason:h,recoveryReasonTouched:p,recoveryConfirm:g,recoveryPlanSummary:v,setRecoveryConfirm:y,setRecoveryPlanSummary:k,setRecoveryReport:b,setRecoveryReason:w,setRecoveryReasonTouched:E,buildCurrentRecoveryReason:B,openFullCanvas:j}=t,{setOpError:I,setOpErrorCode:N,setOpMessage:F,setBusy:X}=r,{runAction:O,isActionSuccess:Y}=i,V=S.useCallback(async M=>{if(M.requiresReason||(y(null),k(null)),M.action==="doctor"){b(null),O("doctor",{});return}if(M.action==="dagReport"||M.id==="report"){const P=o.trim();if(P){y(null),k(null);const $=await O("dagReport",{runId:P}),te=$?.result??{},G=(te.raw?.runs??te.runs)?.[0];$&&$.ok!==!1&&!$.error&&G&&(b({runId:G.runId??P,title:G.title,status:G.status,category:G.productLineFailureCategory,recommendation:G.recoveryRecommendation?.summary??G.recommendedFollowUp??void 0}),F(null));return}if(s.trim()){b(null),O("status",{taskId:s});return}I("查看报告需要先选择 DAG 运行 ID(或填写任务 ID)");return}if(M.action==="observeLink"){b(null),j();return}if(M.requiresReason){if(b(null),y(M),k(null),M.id!=="dagRerun"&&(I(null),N(null)),(!p||xb(h))&&(w(B(M.label)),E(!1)),M.id==="dagRerun"&&o.trim()&&c.trim()){X(!0);try{const{status:P,body:$}=await Gd("dagRerunPlan",{runId:o.trim(),fromNode:c.trim()}),te=$.result??{};te&&typeof te=="object"&&("eligible"in te||te.planHash)&&k(te),P<400&&$.ok!==!1&&te.eligible!==!1?F(null):te.eligible===!1?I($.error?.message??ed(te)):F($.error?.message??"无法预检重跑计划;确认后仍将尝试提交(CLI 可能尚未就绪)")}finally{X(!1)}}return}I(null),N(null),F(`${M.label}:请经 CLI — ${M.commandHint??""}`)},[B,o,c,j,h,p,O,X,I,N,F,y,k,b,w,E,s]),ae=S.useCallback(async()=>{const M=g;if(!M)return;const P=h.trim();if(!P){I("恢复操作需要结构化原因");return}const $=eo(`recovery-${M.id}`);if(y(null),M.id==="dagRerun"){const te=o.trim(),G=c.trim();if(!te||!G){I("从节点重跑需要 DAG 运行 ID 与起始节点 ID");return}let _=v?.planHash?.trim(),D=v?.eligible;if(!_||D===void 0){const H=await O("dagRerunPlan",{runId:te,fromNode:G}),z=H?.result??{};if((z.planHash||z.eligible!==void 0)&&k(z),_=z.planHash?.trim()||_,D=z.eligible,z.eligible===!1){I(H?.error?.message??ed(z));return}if(H&&H.ok===!1&&!_){I(H.error?.message??"无法获取 planHash;请确认 loop-agent dag rerun --plan 可用");return}}if(D===!1){I(ed(v??{}));return}if(!_){I("无法获取 planHash;请确认 loop-agent dag rerun --plan 可用");return}await O("dagRerun",{runId:te,fromNode:G,planHash:_,reason:P},{clientRequestId:$});return}if(M.id==="standaloneTaskRerun"){const te=o.trim();if(!te){I("完整重跑任务需要 DAG 运行 ID");return}const G={runId:te,reason:P,...s.trim()?{taskId:s.trim()}:{}},_=await O("prepareMutationGate",{action:"standaloneTaskRerun",actionParams:G});if(!Y(_))return;const D=_?.result??_;if(!D.receiptId||!D.humanGateToken){I("prepareMutationGate 未返回可消费的 Human Gate receipt");return}await O("standaloneTaskRerun",{...G,confirmationId:D.receiptId,humanGateToken:D.humanGateToken},{clientRequestId:$});return}if(M.id==="workerTaskRetry"){const te=s.trim();if(!te){I("重新排队 Worker Task 需要任务 ID");return}const G={taskId:te,reason:P,...d.trim()?{featureId:d.trim()}:{}},_=await O("prepareMutationGate",{action:"workerTaskRetry",actionParams:G});if(!Y(_))return;const D=_?.result??_;if(!D.receiptId||!D.humanGateToken){I("prepareMutationGate 未返回可消费的 Human Gate receipt");return}await O("workerTaskRetry",{...G,confirmationId:D.receiptId,humanGateToken:D.humanGateToken},{clientRequestId:$});return}if(M.id==="reconcile"){const te=o.trim();if(!te){I("对账恢复需要 DAG 运行 ID");return}const G={runId:te,reason:P,reconcileAction:"supersede"},_=await O("prepareMutationGate",{action:"dagReconcileRun",actionParams:G});if(!Y(_))return;const D=_?.result??_;if(!D.receiptId||!D.humanGateToken){I("prepareMutationGate 未返回可消费的 Human Gate receipt");return}await O("dagReconcileRun",{...G,confirmationId:D.receiptId,humanGateToken:D.humanGateToken},{clientRequestId:$});return}F(`${M.label}:请经 CLI — ${M.commandHint??""}`)},[o,d,c,g,v?.planHash,h,O,Y,I,F,y,k,s]);return{handleRecoveryCta:V,submitRecoveryConfirm:ae}}function zA(t){const{shell:r,actions:i,wizard:s}=t,{nav:o,opError:c,opErrorCode:d,lastOpState:h,setOpError:p,setObserveBusy:g}=r,{taskId:v}=s,[y,k]=S.useState(""),[b,w]=S.useState(""),[E,B]=S.useState(""),[j,I]=S.useState(""),[N,F]=S.useState(!1),[X,O]=S.useState(null),[Y,V]=S.useState(null),[ae,M]=S.useState([]),[P,$]=S.useState([]),[te,G]=S.useState(!1),[_,D]=S.useState(!1),[H,z]=S.useState(null),[ne,T]=S.useState(null),[A,U]=S.useState(null),[C,se]=S.useState(!1),[W,Z]=S.useState(!1),[ue,me]=S.useState(null),[ge,fe]=S.useState("idle"),[ke,_e]=S.useState(null),[Ze,Ve]=S.useState(null),[lt,sn]=S.useState(!1),Ot=S.useCallback(()=>y.trim()?`/inspect/#/dag/${encodeURIComponent(y.trim())}?from=recovery`:"/inspect/#/",[y]),Mt=S.useCallback(()=>{window.location.assign(Ot())},[Ot]),Nt=S.useCallback(async()=>{if(y.trim())return y.trim();const Ce=v.trim();if(!Ce)return p("打开 DAG 检视需要任务 ID 或 DAG 运行 ID"),null;g(!0),p(null);try{const{status:Te,body:Be}=await Gd("observeLink",{taskId:Ce}),Ae=Be.result??{};if(Te>=400||Be.ok===!1)return p(Be.error?.message??"无法解析 DAG 画布地址"),fe("unavailable"),_e(Be.error?.message??null),null;const At=typeof Ae.dagRunId=="string"?Ae.dagRunId.trim():"";return At?(k(At),fe("match"),_e(null),Ve(`/inspect/#/dag/${encodeURIComponent(At)}`),At):(p("尚未找到该任务的 DAG 运行,请稍后再打开检视"),fe("unavailable"),_e(Ae.message??"未解析到 DAG run"),null)}catch(Te){return p(Te instanceof Error?Te.message:String(Te)),null}finally{g(!1)}},[y,v,p,g]),qt=S.useCallback(async()=>{await Nt()&&sn(!0)},[Nt]),Ne=S.useCallback(async()=>{const Ce=await Nt();Ce&&window.location.assign(`/inspect/#/dag/${encodeURIComponent(Ce)}?from=recovery`)},[Nt]),Ee=S.useCallback(async()=>{G(!0);try{const Ce=v.trim(),Te=new URLSearchParams;Ce&&Te.set("taskId",Ce),Te.set("limit","40");const Be=await fetch(`/api/operator/v1/recovery/candidates?${Te.toString()}`,{credentials:"same-origin"});if(!Be.ok){M([]);return}const Ae=await Be.json();M(Array.isArray(Ae.runs)?Ae.runs:[])}catch{M([])}finally{G(!1)}},[v]),dt=S.useCallback(async Ce=>{const Te=Ce.trim();if(!Te){$([]),z(null),T(null),U(null);return}D(!0);try{const Be=await fetch(`/api/dag-runs/${encodeURIComponent(Te)}`,{credentials:"same-origin"});if(!Be.ok){$([]),z(null),T(null);return}const Ae=await Be.json(),At=typeof Ae.effectiveStatus=="string"&&Ae.effectiveStatus||typeof Ae.status=="string"&&Ae.status||null;z(At);const _t=Array.isArray(Ae.nodes)?Ae.nodes:[],ga=bb(_t.map(vt=>{const ln=(vt.nodeId??vt.id??"").trim();return ln?{nodeId:ln,status:vt.status,label:vt.label??vt.name,errorPreview:vt.errorPreview}:null}).filter(vt=>vt!==null));$(ga);const In=typeof Ae.failureCategory=="string"&&Ae.failureCategory||void 0,Yn=_t.find(vt=>typeof vt.failureCategory=="string"&&vt.failureCategory&&vt.failureCategory!=="success")?.failureCategory;T(In??Yn??null),U(Ae.frontendRecovery??null)}catch{$([]),z(null),T(null),U(null)}finally{D(!1)}},[]);S.useEffect(()=>{o==="recovery"&&Ee()},[o,v,Ee]),S.useEffect(()=>{if(o!=="recovery"||C||ae.length===0)return;const Ce=y.trim(),Te=Ce?ae.some(Be=>Be.dagRunId===Ce):!1;if(!Ce||!Te){const Be=IA(ae);Be&&Be!==Ce&&k(Be)}},[o,ae,y,C]),S.useEffect(()=>{o==="recovery"&&dt(y)},[o,y,dt]),S.useEffect(()=>{if(o!=="recovery"||W||P.length===0)return;const Ce=b.trim(),Te=Ce?P.some(Be=>Be.nodeId===Ce):!1;if(!Ce||!Te){const Be=DA(P);Be&&Be!==Ce&&w(Be)}},[o,P,b,W]);const Oe=EA({operationState:H?null:h,errorCode:H?null:d,dagStatus:H,failureCategory:ne}),$e=S.useMemo(()=>yb(Oe),[Oe]),le=S.useMemo(()=>jA($e),[$e]),he=S.useMemo(()=>TA(Oe),[Oe]),be=S.useMemo(()=>P.find(Ce=>Ce.nodeId===b.trim()),[P,b]),we=S.useRef(null);S.useEffect(()=>{Y&&we.current?.scrollIntoView({behavior:"smooth",block:"nearest"})},[Y?.id]);const Me=S.useCallback(Ce=>_A({actionLabel:Ce,dagRunId:y.trim()||void 0,fromNodeId:b.trim()||void 0,runStatus:H,nodeStatus:be?.status,nodeError:be?.errorPreview,factClassLabel:pb[Oe],errorMessage:c,errorCode:d}),[y,b,c,d,Oe,H,be?.errorPreview,be?.status]);S.useEffect(()=>{if(o!=="recovery"||N&&!xb(j))return;const Ce=Me(Y?.label);Ce&&Ce!==j&&I(Ce)},[o,y,b,H,be,Oe,c,d,Y?.label,N,j,Me]);const{handleRecoveryCta:rt,submitRecoveryConfirm:jt}=LA({shell:r,actions:i,taskId:v,dagRunId:y,fromNodeId:b,featureId:E,recoveryReason:j,recoveryReasonTouched:N,recoveryConfirm:Y,recoveryPlanSummary:X,setRecoveryConfirm:V,setRecoveryPlanSummary:O,setRecoveryReport:me,setRecoveryReason:I,setRecoveryReasonTouched:F,buildCurrentRecoveryReason:Me,openFullCanvas:Ne});return{dagRunId:y,setDagRunId:k,fromNodeId:b,setFromNodeId:w,featureId:E,setFeatureId:B,recoveryReason:j,setRecoveryReason:I,recoveryReasonTouched:N,setRecoveryReasonTouched:F,recoveryPlanSummary:X,recoveryConfirm:Y,setRecoveryConfirm:V,setRecoveryPlanSummary:O,recoveryRuns:ae,recoveryNodes:P,recoveryRunsLoading:te,recoveryNodesLoading:_,recoveryRunStatus:H,frontendRecovery:A,manualRunId:C,setManualRunId:se,manualNodeId:W,setManualNodeId:Z,recoveryReport:ue,setRecoveryReport:me,observeLinkStatus:ge,observeLinkMessage:ke,observeUrl:Ze,inspectSplitOpen:lt,setInspectSplitOpen:sn,inspectPath:Ot,openFullInspect:Mt,resolveDagRunForInspect:Nt,openInspectSplit:qt,openFullCanvas:Ne,loadRecoveryRuns:Ee,loadRecoveryNodes:dt,recoveryFact:Oe,recoveryCtas:$e,recoveryLanes:le,recommendedCtaId:he,recoveryConfirmRef:we,buildCurrentRecoveryReason:Me,handleRecoveryCta:rt,submitRecoveryConfirm:jt}}function BA(t){const{shell:r,actions:i,prd:s}=t,{step:o,setStep:c,setOpMessage:d}=r,{runAction:h,isActionSuccess:p,summarizeEnvelope:g}=i,[v,y]=S.useState(""),[k,b]=S.useState(""),[w,E]=S.useState("standard"),[B,j]=S.useState(""),[I,N]=S.useState(""),[F,X]=S.useState(""),O=pd.find(Ne=>Ne.kind===w)??pd[0],[Y,V]=S.useState(null),[ae,M]=S.useState(null),[P,$]=S.useState(""),[te,G]=S.useState(null),[_,D]=S.useState(null),[H,z]=S.useState(null),[ne,T]=S.useState(null),[A,U]=S.useState(null),[C,se]=S.useState(!1),[W,Z]=S.useState(null),[ue,me]=S.useState(null),ge=S.useRef(!1),fe=S.useCallback(()=>{z(null),T(null),U(null),se(!1),Z(null),me(null),ge.current=!1},[]),ke=S.useCallback(()=>{fe(),c("contract")},[fe,c]),_e=S.useCallback(Ne=>{const Ee=Ne.session;Ee?.sessionId&&V(Ee.sessionId);const dt=Ne.question;M(dt),G(Ne.summary??null);const Oe=Ne.assessmentId;typeof Oe=="string"&&Oe&&D(Oe),(Ne.complete===!0||typeof Oe=="string"&&Oe)&&(ke(),d(Ne.skipped===!0?"已跳过访谈:已按推荐补齐草稿并签发评估":"访谈已完成:草稿已绑定完整评估结果"))},[ke,d]),Ze=S.useCallback(async(Ne=!1)=>{const Ee=v.trim();if(!Ee)return;const dt=`${Ee}:${_??""}`;if(!(!Ne&&ue===dt&&H!==null)&&!ge.current){ge.current=!0,z(null),T(null),U(null),Z(null),se(!1);try{const Oe=await h("contractValidate",{taskId:Ee}),$e=p(Oe);if(z($e),T(g(Oe)),!$e){me(dt),d("契约校验未通过:请先修正草稿后再应用");return}const le=await h("contractDiff",{taskId:Ee});U(g(le)),me(dt),d(p(le)?"校验与差异已就绪:确认后可应用契约":"校验通过,但差异查询失败(仍可查看下方摘要)")}finally{ge.current=!1}}},[_,ue,H,p,h,d,g,v]),Ve=S.useCallback(async()=>{const Ne=v.trim();if(!Ne||!_)return;const Ee=await h("contractApply",{taskId:Ne,assessmentId:_},{clientRequestId:eo("apply")});if(!p(Ee)){se(!1);return}se(!0);const dt=await h("spineCheck",{taskId:Ne});if(p(dt)){Z(!0),c("dag-confirm"),d("契约已应用并通过 Spine 审计,可生成并运行 DAG");return}Z(!1),d("契约已应用,但 Spine 审计未通过:可重试 Spine")},[_,p,h,d,c,v]),lt=S.useCallback(async()=>{const Ne=v.trim();if(!Ne)return;const Ee=await h("spineCheck",{taskId:Ne});if(p(Ee)){Z(!0),c("dag-confirm"),d("Spine 审计已通过,可生成并运行 DAG");return}Z(!1)},[p,h,d,c,v]),sn=S.useCallback(async()=>{const Ne=i.confirmationId?.trim();if(!Ne)return;const Ee=i.confirmationDetails?.confirmation?.humanGateToken,dt=await h("confirmDagConfirmation",{confirmationId:Ne,humanGateToken:Ee});p(dt)&&(c("run"),await h("runDag",{confirmationId:Ne},{clientRequestId:eo("run")}))},[i.confirmationId,i.confirmationDetails,p,h,c]);S.useEffect(()=>{o==="contract"&&v.trim()&&Ze(!1)},[o,v,_,Ze]);const Ot=S.useCallback(Ne=>Ne.split(/[\n,;,;]+/).map(Ee=>Ee.trim()).filter(Boolean),[]),Mt=S.useCallback(async()=>{const Ne=s.prdDocuments.length>0?vA(s.prdDocuments):void 0,Ee=Ot(B),dt=Ot(I),Oe=Ot(F),$e={content:s.prdText,taskKind:w,...Ne?{documents:Ne}:{},...Ee.length>0?{allowedPaths:Ee}:{},...dt.length>0?{forbiddenPaths:dt}:{},...Oe.length>0?{verifyCommands:Oe}:{}};if(!xA("bootstrapFromPrd",$e)){s.setPrdFileError(SA());return}const le=await h("bootstrapFromPrd",$e);if(!le||le.ok===!1)return;const he=le.result??{};he.taskId&&y(he.taskId),he.title&&b(he.title);const be=he.parseStatus??"pending",we=he.draftPreview?.objective?.trim(),Me=Array.isArray(he.gaps)?he.gaps.length:0,rt=he.semanticIntake?.applied?"semantic":he.semanticIntake?.code??"no-semantic",jt=(he.autoImportedReferences??[]).filter(Te=>Te.repoRelative),Ce=(he.unresolvedReferences??[]).filter(Te=>Te.token);d([`已创建任务「${he.title??""}」(${he.taskId??""})`,`来源:${he.identitySource??"prd"}`,`解析:${be}(${rt})`,we?`目标:${we.slice(0,120)}`:null,Me>0?`缺口 ${Me} 项待确认`:null,jt.length>0?`已自动导入 ${jt.length} 个引用文档(${jt.map(Te=>`${Te.repoRelative}${Te.role?`:${Te.role}`:""}`).join("、")})`:null,Ce.length>0?`有 ${Ce.length} 个引用未能解析:${Ce.map(Te=>`${Te.token}(${Te.reason??"未知原因"})`).join("、")}`:null].filter(Boolean).join(" · ")),c("interview")},[B,I,s,h,d,c,Ot,w,F]),Nt=[{id:"setup",label:"就绪检查"},{id:"import-prd",label:"导入需求"},{id:"interview",label:"需求访谈(可跳过)"},{id:"contract",label:"契约落地"},{id:"dag-confirm",label:"确认 DAG"},{id:"run",label:"运行"}],qt=Nt.findIndex(Ne=>Ne.id===o);return{taskId:v,setTaskId:y,taskTitle:k,taskKind:w,setTaskKind:E,engineering:{allowedPathsText:B,forbiddenPathsText:I,verifyCommandsText:F},setEngineering:Ne=>{Ne.allowedPathsText!==void 0&&j(Ne.allowedPathsText),Ne.forbiddenPathsText!==void 0&&N(Ne.forbiddenPathsText),Ne.verifyCommandsText!==void 0&&X(Ne.verifyCommandsText)},workflowMeta:O,sessionId:Y,question:ae,answerText:P,setAnswerText:$,draftSummary:te,assessmentId:_,contractValidateOk:H,contractValidateSummary:ne,contractDiffSummary:A,contractApplied:C,spineOk:W,applyInterviewPayload:_e,runContractPreflight:Ze,applyContractThenSpine:Ve,retrySpineOnly:lt,confirmAndRunDag:sn,importPrdAndCreate:Mt,wizardSteps:Nt,stepIndex:qt}}const HA={chat:"对话",tasks:"任务",recovery:"恢复",night:"夜间",models:"模型与认证",settings:"设置"};async function UA(t){return await import(t)}function qA(t){const r=t.repoName?.trim();if(r)return r;const i=(t.repoRoot??"").split(/[\\/]/).filter(Boolean);return i.length?i[i.length-1]:"repository"}function $A(t){const{nav:r,readiness:i,setupBlocked:s,degraded:o,health:c,inspectHref:d}=t,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:qA(c),fingerprint:c.repoFingerprint??"",version:c.packageVersion??"",product:c.productName??c.product??"",inspectReady:c.inspect?.ready}:null}}function GA(t){const r=S.useRef(null),i=S.useRef(null),[s,o]=S.useState(!1),c=S.useMemo(()=>$A(t),[t.nav,t.readiness,t.setupBlocked,t.degraded,t.health,t.inspectHref]),d=S.useRef(c);return d.current=c,S.useEffect(()=>{let h=!1;return UA("/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(`#/${t.nav}`),children:HA[t.nav]}),u.jsx("button",{type:"button",onClick:()=>window.location.assign(t.inspectHref),children:"观测"}),u.jsx("span",{role:"status",children:"共享导航加载失败,请刷新页面"})]}):null]})}function FA(t){return u.jsxs(u.Fragment,{children:[t.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:t.opError})]}):null,t.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:t.opMessage})]}):null]})}const VA=[{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 PA(t){if(!t)return null;const r=Date.parse(t);return Number.isNaN(r)?t:new Date(r).toLocaleString()}function YA(t){const r=t.readinessReport?.state??t.readiness,i=t.readinessReport?.probe,s=i?.details??{},o=t.readinessReport?.blockedActions??[],c=PA(t.readinessReport?.generatedAt),d=t.readinessReport??{state:t.readiness,health:t.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:hb[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:VA.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:fb})]}):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:t.busy,onClick:t.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)})]})]})}function Sy(t){const{lane:r,cta:i,planSummary:s,reason:o,busy:c,confirmRef:d}=t;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:"请核对上方运行 / 节点与恢复原因,再点「确定」执行。"}),s?u.jsxs("div",{className:"recovery-plan-summary",children:[u.jsxs("p",{className:"muted",children:["计划 eligible=",String(s.eligible??"—")," · 风险=",mb[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:t.onSubmit,children:"确定"}),u.jsx("button",{type:"button",className:"btn btn-secondary",disabled:c,"data-testid":"recovery-confirm-cancel",onClick:t.onCancel,children:"取消"})]})]})}function KA(t){const{shell:r,recovery:i,wizard:s}=t,{busy:o}=r,c={planSummary:i.recoveryPlanSummary,reason:i.recoveryReason,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:["事实分类:",pb[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 队列失败才用下方「Worker Task 重排队」(二者不要混用)"}),u.jsx("li",{children:"带 * 的动作:核对预填原因 → 点下方「确定」"})]}),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:d=>{i.setManualRunId(!1),i.setManualNodeId(!1),i.setFromNodeId(""),i.setDagRunId(d.target.value),i.recoveryReasonTouched||i.setRecoveryReasonTouched(!1)},children:[i.recoveryRuns.some(d=>d.dagRunId===i.dagRunId)?null:u.jsx("option",{value:i.dagRunId||"",children:i.dagRunId?`${i.dagRunId}(当前)`:"— 请选择 —"}),i.recoveryRuns.map(d=>u.jsx("option",{value:d.dagRunId,children:OA(d)},d.dagRunId))]}):u.jsx("input",{"data-testid":"recovery-run-input",value:i.dagRunId,disabled:o,onChange:d=>{i.setManualRunId(!0),i.setDagRunId(d.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:d=>{i.setManualNodeId(!1),i.setFromNodeId(d.target.value)},children:[i.recoveryNodes.some(d=>d.nodeId===i.fromNodeId)?null:u.jsx("option",{value:i.fromNodeId||"",children:i.fromNodeId?`${i.fromNodeId}(当前)`:"— 请选择 —"}),i.recoveryNodes.map(d=>u.jsx("option",{value:d.nodeId,children:MA(d)},d.nodeId))]}):u.jsx("input",{"data-testid":"recovery-node-input",value:i.fromNodeId,disabled:o,onChange:d=>{i.setManualNodeId(!0),i.setFromNodeId(d.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:d=>{i.setRecoveryReasonTouched(!0),i.setRecoveryReason(d.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(d=>{const h=d.id===i.recommendedCtaId;return u.jsxs("button",{type:"button",className:h?"btn btn-primary":"btn btn-secondary",disabled:o,title:d.guide,"aria-pressed":i.recoveryConfirm?.id===d.id?!0:void 0,"data-testid":`recovery-cta-${d.id}`,"data-recommended":h?"true":void 0,onClick:()=>{i.handleRecoveryCta(d)},children:[d.label,d.requiresReason?" *":""]},d.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(Sy,{lane:"dag",cta:i.recoveryConfirm,...c})]}),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:d=>s.setTaskId(d.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:d=>i.setFeatureId(d.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(d=>u.jsxs("button",{type:"button",className:d.id===i.recommendedCtaId?"btn btn-primary":"btn btn-secondary",disabled:o,title:d.guide,"data-testid":`recovery-cta-${d.id}`,"data-recommended":d.id===i.recommendedCtaId?"true":void 0,onClick:()=>{i.handleRecoveryCta(d)},children:[d.label,d.requiresReason?" *":""]},d.id)):u.jsx("p",{className:"muted","data-testid":"recovery-worker-unavailable",children:"当前事实分类下不提供 Worker 重排队。"})}),u.jsx(Sy,{lane:"worker",cta:i.recoveryConfirm,...c})]}),u.jsx("div",{className:"recovery-cta-row","data-testid":"recovery-cta-row",hidden:!0,children:i.recoveryCtas.map(d=>u.jsx("span",{children:d.id},d.id))}),i.observeLinkMessage?u.jsxs("p",{className:"muted",children:["[",eA[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 XA(t){const{health:r,readiness:i,healthError:s,layers:o,setupBlocked:c,degraded:d}=t;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:[hb[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:Hl(o.command)})]}),u.jsxs("div",{children:[u.jsx("dt",{children:"DAG 生命周期"}),u.jsx("dd",{children:Hl(o.dag)})]}),u.jsxs("div",{children:[u.jsx("dt",{children:"最终验证"}),u.jsx("dd",{children:Hl(o.verification)})]}),u.jsxs("div",{children:[u.jsx("dt",{children:"晋升"}),u.jsx("dd",{children:Hl(o.promote)})]}),u.jsxs("div",{children:[u.jsx("dt",{children:"任务关闭"}),u.jsx("dd",{children:"不可用(MVP)"})]})]})]})]})}function QA(t){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}=t;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 ZA(t){const{busy:r,taskId:i,confirmationId:s,confirmationDetails:o,runAction:c,onConfirmAndRun:d}=t;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 JA(t){const{busy:r,taskKind:i,onTaskKindChange:s,workflowHint:o,prd:c,engineering:d,onEngineeringChange:h,onImport:p}=t,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:pd.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:oA,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,单文件最大"," ",yd(gd),",最多 ",to," 个"]}),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:[" ","· ",yd(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 WA(t){const{busy:r,taskId:i,taskTitle:s,taskKind:o,sessionId:c,question:d,answerText:h,onAnswerTextChange:p,draftSummary:g,assessmentId:v,runAction:y}=t;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})," · 风险=",mb[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 eI(t){const{busy:r,confirmationId:i,operationId:s,dagRunId:o,taskId:c,observeBusy:d,sseLog:h,runAction:p,onStopFollow:g,onShowInspectSplit:v,onOpenInspectSplit:y}=t;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:eo("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(`
|
|
57
|
+
`)||"(尚无事件)"})]})}function tI(t){const{shell:r,actions:i,wizard:s,prd:o,recovery:c}=t,{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:fb})]})]}):u.jsxs("div",{className:"wizard-body","data-testid":"wizard-body",children:[h==="import-prd"&&u.jsx(JA,{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(WA,{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(QA,{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(ZA,{busy:d,taskId:s.taskId,confirmationId:i.confirmationId,confirmationDetails:i.confirmationDetails,runAction:i.runAction,onConfirmAndRun:()=>{s.confirmAndRunDag()}}),h==="run"&&u.jsx(eI,{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 nI={};function rI(){const t=iA(),r=S.useRef(()=>{}),i=S.useCallback(v=>r.current(v),[]),s=sA({shell:t,applyInterviewPayload:i}),o=kA(),c=BA({shell:t,actions:s,prd:o}),d=zA({shell:t,actions:s,wizard:c});S.useEffect(()=>{r.current=c.applyInterviewPayload}),S.useEffect(()=>{t.loadHealth()},[t.loadHealth]);const h=S.useCallback((v,y={})=>{t.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);const k=Qy(v,y);window.location.hash.replace(/^#/,"")!==k&&(window.location.hash=k)},[t.selectNav,c.setTaskId,d.setDagRunId,d.setFromNodeId,d.setFeatureId]),p=S.useCallback(()=>{const v=C1(window.location);if(v){h(v.workspace,v);return}const y=Xy({env:nI?.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=t.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${t.nav==="chat"?" is-chat-focus":""}`,children:[u.jsx(GA,{nav:t.nav,readiness:t.readiness,setupBlocked:t.setupBlocked,degraded:t.degraded,health:t.health,inspectHref:g}),u.jsxs("div",{className:`console-shell${t.nav==="chat"?" is-chat-focus":""}`,children:[u.jsx(FA,{opError:t.opError,opMessage:t.opMessage}),u.jsxs("main",{className:`console-main${t.nav==="chat"?" console-main--fill":""}`,children:[t.nav==="tasks"?u.jsx(tI,{shell:t,actions:s,wizard:c,prd:o,recovery:d}):null,t.nav==="recovery"?u.jsx(KA,{shell:t,recovery:d,wizard:c}):null,t.nav==="night"?u.jsx(n0,{busy:t.busy,runAction:s.runAction,isActionSuccess:s.isActionSuccess,setOpError:t.setOpError}):null,t.nav==="models"?u.jsx(YA,{busy:t.busy,readiness:t.readiness,readinessReport:t.readinessReport,health:t.health,onRefreshReadiness:()=>{s.runAction("refreshReadiness",{}).then(()=>t.loadHealth())}}):null,t.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(JN,{origin:"",readiness:t.readiness,surface:"workspace",onNavigateWorkspace:h})]}):null,t.nav==="settings"?u.jsx(XA,{health:t.health,readiness:t.readiness,healthError:t.healthError,layers:t.layers,setupBlocked:t.setupBlocked,degraded:t.degraded}):null]}),d.inspectSplitOpen&&d.dagRunId.trim()?u.jsx(GS,{dagRunId:d.dagRunId.trim(),nodeId:d.fromNodeId.trim()||void 0,onClose:()=>d.setInspectSplitOpen(!1),onOpenFull:d.openFullInspect}):null]})]})})}const Sb=document.getElementById("root");if(!Sb)throw new Error("Loop Operator Console: #root missing");qS.createRoot(Sb).render(u.jsx(S.StrictMode,{children:u.jsx(rI,{})}));
|