@tea-agent/loop-agent 0.35.3 → 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 +59 -0
- 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/init-hybrid.js +74 -2
- package/docs/README.md +3 -3
- package/docs/architecture/evolution.md +102 -67
- 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
|
@@ -1,57 +0,0 @@
|
|
|
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"]'))l(o);new MutationObserver(o=>{for(const d of o)if(d.type==="childList")for(const u of d.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&l(u)}).observe(document,{childList:!0,subtree:!0});function i(o){const d={};return o.integrity&&(d.integrity=o.integrity),o.referrerPolicy&&(d.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?d.credentials="include":o.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function l(o){if(o.ep)return;o.ep=!0;const d=i(o);fetch(o.href,d)}})();function od(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var pc={exports:{}},Ka={};var Ip;function s1(){if(Ip)return Ka;Ip=1;var t=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function i(l,o,d){var u=null;if(d!==void 0&&(u=""+d),o.key!==void 0&&(u=""+o.key),"key"in o){d={};for(var h in o)h!=="key"&&(d[h]=o[h])}else d=o;return o=d.ref,{$$typeof:t,type:l,key:u,ref:o!==void 0?o:null,props:d}}return Ka.Fragment=r,Ka.jsx=i,Ka.jsxs=i,Ka}var Dp;function o1(){return Dp||(Dp=1,pc.exports=s1()),pc.exports}var c=o1(),gc={exports:{}},De={};var Op;function u1(){if(Op)return De;Op=1;var t=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),u=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),S=Symbol.iterator;function x(D){return D===null||typeof D!="object"?null:(D=S&&D[S]||D["@@iterator"],typeof D=="function"?D:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},I=Object.assign,H={};function T(D,M,C){this.props=D,this.context=M,this.refs=H,this.updater=C||w}T.prototype.isReactComponent={},T.prototype.setState=function(D,M){if(typeof D!="object"&&typeof D!="function"&&D!=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,D,M,"setState")},T.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function N(){}N.prototype=T.prototype;function A(D,M,C){this.props=D,this.context=M,this.refs=H,this.updater=C||w}var G=A.prototype=new N;G.constructor=A,I(G,T.prototype),G.isPureReactComponent=!0;var K=Array.isArray;function E(){}var $={H:null,A:null,T:null,S:null},te=Object.prototype.hasOwnProperty;function se(D,M,C){var ie=C.ref;return{$$typeof:t,type:D,key:M,ref:ie!==void 0?ie:null,props:C}}function z(D,M){return se(D.type,M,D.props)}function V(D){return typeof D=="object"&&D!==null&&D.$$typeof===t}function F(D){var M={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(C){return M[C]})}var le=/\/+/g;function X(D,M){return typeof D=="object"&&D!==null&&D.key!=null?F(""+D.key):M.toString(36)}function B(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(E,E):(D.status="pending",D.then(function(M){D.status==="pending"&&(D.status="fulfilled",D.value=M)},function(M){D.status==="pending"&&(D.status="rejected",D.reason=M)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function O(D,M,C,ie,de){var Y=typeof D;(Y==="undefined"||Y==="boolean")&&(D=null);var ce=!1;if(D===null)ce=!0;else switch(Y){case"bigint":case"string":case"number":ce=!0;break;case"object":switch(D.$$typeof){case t:case r:ce=!0;break;case v:return ce=D._init,O(ce(D._payload),M,C,ie,de)}}if(ce)return de=de(D),ce=ie===""?"."+X(D,0):ie,K(de)?(C="",ce!=null&&(C=ce.replace(le,"$&/")+"/"),O(de,M,C,"",function(ye){return ye})):de!=null&&(V(de)&&(de=z(de,C+(de.key==null||D&&D.key===de.key?"":(""+de.key).replace(le,"$&/")+"/")+ce)),M.push(de)),1;ce=0;var he=ie===""?".":ie+":";if(K(D))for(var pe=0;pe<D.length;pe++)ie=D[pe],Y=he+X(ie,pe),ce+=O(ie,M,C,Y,de);else if(pe=x(D),typeof pe=="function")for(D=pe.call(D),pe=0;!(ie=D.next()).done;)ie=ie.value,Y=he+X(ie,pe++),ce+=O(ie,M,C,Y,de);else if(Y==="object"){if(typeof D.then=="function")return O(B(D),M,C,ie,de);throw M=String(D),Error("Objects are not valid as a React child (found: "+(M==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":M)+"). If you meant to render a collection of children, use an array instead.")}return ce}function U(D,M,C){if(D==null)return D;var ie=[],de=0;return O(D,ie,"","",function(Y){return M.call(C,Y,de++)}),ie}function _(D){if(D._status===-1){var M=D._result;M=M(),M.then(function(C){(D._status===0||D._status===-1)&&(D._status=1,D._result=C)},function(C){(D._status===0||D._status===-1)&&(D._status=2,D._result=C)}),D._status===-1&&(D._status=0,D._result=M)}if(D._status===1)return D._result.default;throw D._result}var W=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var M=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof D=="object"&&D!==null&&typeof D.message=="string"?String(D.message):String(D),error:D});if(!window.dispatchEvent(M))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)},R={map:U,forEach:function(D,M,C){U(D,function(){M.apply(this,arguments)},C)},count:function(D){var M=0;return U(D,function(){M++}),M},toArray:function(D){return U(D,function(M){return M})||[]},only:function(D){if(!V(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return De.Activity=y,De.Children=R,De.Component=T,De.Fragment=i,De.Profiler=o,De.PureComponent=A,De.StrictMode=l,De.Suspense=g,De.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=$,De.__COMPILER_RUNTIME={__proto__:null,c:function(D){return $.H.useMemoCache(D)}},De.cache=function(D){return function(){return D.apply(null,arguments)}},De.cacheSignal=function(){return null},De.cloneElement=function(D,M,C){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var ie=I({},D.props),de=D.key;if(M!=null)for(Y in M.key!==void 0&&(de=""+M.key),M)!te.call(M,Y)||Y==="key"||Y==="__self"||Y==="__source"||Y==="ref"&&M.ref===void 0||(ie[Y]=M[Y]);var Y=arguments.length-2;if(Y===1)ie.children=C;else if(1<Y){for(var ce=Array(Y),he=0;he<Y;he++)ce[he]=arguments[he+2];ie.children=ce}return se(D.type,de,ie)},De.createContext=function(D){return D={$$typeof:u,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:d,_context:D},D},De.createElement=function(D,M,C){var ie,de={},Y=null;if(M!=null)for(ie in M.key!==void 0&&(Y=""+M.key),M)te.call(M,ie)&&ie!=="key"&&ie!=="__self"&&ie!=="__source"&&(de[ie]=M[ie]);var ce=arguments.length-2;if(ce===1)de.children=C;else if(1<ce){for(var he=Array(ce),pe=0;pe<ce;pe++)he[pe]=arguments[pe+2];de.children=he}if(D&&D.defaultProps)for(ie in ce=D.defaultProps,ce)de[ie]===void 0&&(de[ie]=ce[ie]);return se(D,Y,de)},De.createRef=function(){return{current:null}},De.forwardRef=function(D){return{$$typeof:h,render:D}},De.isValidElement=V,De.lazy=function(D){return{$$typeof:v,_payload:{_status:-1,_result:D},_init:_}},De.memo=function(D,M){return{$$typeof:p,type:D,compare:M===void 0?null:M}},De.startTransition=function(D){var M=$.T,C={};$.T=C;try{var ie=D(),de=$.S;de!==null&&de(C,ie),typeof ie=="object"&&ie!==null&&typeof ie.then=="function"&&ie.then(E,W)}catch(Y){W(Y)}finally{M!==null&&C.types!==null&&(M.types=C.types),$.T=M}},De.unstable_useCacheRefresh=function(){return $.H.useCacheRefresh()},De.use=function(D){return $.H.use(D)},De.useActionState=function(D,M,C){return $.H.useActionState(D,M,C)},De.useCallback=function(D,M){return $.H.useCallback(D,M)},De.useContext=function(D){return $.H.useContext(D)},De.useDebugValue=function(){},De.useDeferredValue=function(D,M){return $.H.useDeferredValue(D,M)},De.useEffect=function(D,M){return $.H.useEffect(D,M)},De.useEffectEvent=function(D){return $.H.useEffectEvent(D)},De.useId=function(){return $.H.useId()},De.useImperativeHandle=function(D,M,C){return $.H.useImperativeHandle(D,M,C)},De.useInsertionEffect=function(D,M){return $.H.useInsertionEffect(D,M)},De.useLayoutEffect=function(D,M){return $.H.useLayoutEffect(D,M)},De.useMemo=function(D,M){return $.H.useMemo(D,M)},De.useOptimistic=function(D,M){return $.H.useOptimistic(D,M)},De.useReducer=function(D,M,C){return $.H.useReducer(D,M,C)},De.useRef=function(D){return $.H.useRef(D)},De.useState=function(D){return $.H.useState(D)},De.useSyncExternalStore=function(D,M,C){return $.H.useSyncExternalStore(D,M,C)},De.useTransition=function(){return $.H.useTransition()},De.version="19.2.8",De}var Mp;function ud(){return Mp||(Mp=1,gc.exports=u1()),gc.exports}var k=ud();const Ir=od(k);var yc={exports:{}},Xa={},vc={exports:{}},bc={};var zp;function c1(){return zp||(zp=1,(function(t){function r(O,U){var _=O.length;O.push(U);e:for(;0<_;){var W=_-1>>>1,R=O[W];if(0<o(R,U))O[W]=U,O[_]=R,_=W;else break e}}function i(O){return O.length===0?null:O[0]}function l(O){if(O.length===0)return null;var U=O[0],_=O.pop();if(_!==U){O[0]=_;e:for(var W=0,R=O.length,D=R>>>1;W<D;){var M=2*(W+1)-1,C=O[M],ie=M+1,de=O[ie];if(0>o(C,_))ie<R&&0>o(de,C)?(O[W]=de,O[ie]=_,W=ie):(O[W]=C,O[M]=_,W=M);else if(ie<R&&0>o(de,_))O[W]=de,O[ie]=_,W=ie;else break e}}return U}function o(O,U){var _=O.sortIndex-U.sortIndex;return _!==0?_:O.id-U.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;t.unstable_now=function(){return d.now()}}else{var u=Date,h=u.now();t.unstable_now=function(){return u.now()-h}}var g=[],p=[],v=1,y=null,S=3,x=!1,w=!1,I=!1,H=!1,T=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function G(O){for(var U=i(p);U!==null;){if(U.callback===null)l(p);else if(U.startTime<=O)l(p),U.sortIndex=U.expirationTime,r(g,U);else break;U=i(p)}}function K(O){if(I=!1,G(O),!w)if(i(g)!==null)w=!0,E||(E=!0,F());else{var U=i(p);U!==null&&B(K,U.startTime-O)}}var E=!1,$=-1,te=5,se=-1;function z(){return H?!0:!(t.unstable_now()-se<te)}function V(){if(H=!1,E){var O=t.unstable_now();se=O;var U=!0;try{e:{w=!1,I&&(I=!1,N($),$=-1),x=!0;var _=S;try{t:{for(G(O),y=i(g);y!==null&&!(y.expirationTime>O&&z());){var W=y.callback;if(typeof W=="function"){y.callback=null,S=y.priorityLevel;var R=W(y.expirationTime<=O);if(O=t.unstable_now(),typeof R=="function"){y.callback=R,G(O),U=!0;break t}y===i(g)&&l(g),G(O)}else l(g);y=i(g)}if(y!==null)U=!0;else{var D=i(p);D!==null&&B(K,D.startTime-O),U=!1}}break e}finally{y=null,S=_,x=!1}U=void 0}}finally{U?F():E=!1}}}var F;if(typeof A=="function")F=function(){A(V)};else if(typeof MessageChannel<"u"){var le=new MessageChannel,X=le.port2;le.port1.onmessage=V,F=function(){X.postMessage(null)}}else F=function(){T(V,0)};function B(O,U){$=T(function(){O(t.unstable_now())},U)}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(O){O.callback=null},t.unstable_forceFrameRate=function(O){0>O||125<O?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):te=0<O?Math.floor(1e3/O):5},t.unstable_getCurrentPriorityLevel=function(){return S},t.unstable_next=function(O){switch(S){case 1:case 2:case 3:var U=3;break;default:U=S}var _=S;S=U;try{return O()}finally{S=_}},t.unstable_requestPaint=function(){H=!0},t.unstable_runWithPriority=function(O,U){switch(O){case 1:case 2:case 3:case 4:case 5:break;default:O=3}var _=S;S=O;try{return U()}finally{S=_}},t.unstable_scheduleCallback=function(O,U,_){var W=t.unstable_now();switch(typeof _=="object"&&_!==null?(_=_.delay,_=typeof _=="number"&&0<_?W+_:W):_=W,O){case 1:var R=-1;break;case 2:R=250;break;case 5:R=1073741823;break;case 4:R=1e4;break;default:R=5e3}return R=_+R,O={id:v++,callback:U,priorityLevel:O,startTime:_,expirationTime:R,sortIndex:-1},_>W?(O.sortIndex=_,r(p,O),i(g)===null&&O===i(p)&&(I?(N($),$=-1):I=!0,B(K,_-W))):(O.sortIndex=R,r(g,O),w||x||(w=!0,E||(E=!0,F()))),O},t.unstable_shouldYield=z,t.unstable_wrapCallback=function(O){var U=S;return function(){var _=S;S=U;try{return O.apply(this,arguments)}finally{S=_}}}})(bc)),bc}var _p;function d1(){return _p||(_p=1,vc.exports=c1()),vc.exports}var xc={exports:{}},Mt={};var Lp;function f1(){if(Lp)return Mt;Lp=1;var t=ud();function r(g){var p="https://react.dev/errors/"+g;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)p+="&args[]="+encodeURIComponent(arguments[v])}return"Minified React error #"+g+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var l={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 d(g,p,v){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:y==null?null:""+y,children:g,containerInfo:p,implementation:v}}var u=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(g,p){if(g==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return Mt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=l,Mt.createPortal=function(g,p){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(r(299));return d(g,p,null,v)},Mt.flushSync=function(g){var p=u.T,v=l.p;try{if(u.T=null,l.p=2,g)return g()}finally{u.T=p,l.p=v,l.d.f()}},Mt.preconnect=function(g,p){typeof g=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,l.d.C(g,p))},Mt.prefetchDNS=function(g){typeof g=="string"&&l.d.D(g)},Mt.preinit=function(g,p){if(typeof g=="string"&&p&&typeof p.as=="string"){var v=p.as,y=h(v,p.crossOrigin),S=typeof p.integrity=="string"?p.integrity:void 0,x=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;v==="style"?l.d.S(g,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:y,integrity:S,fetchPriority:x}):v==="script"&&l.d.X(g,{crossOrigin:y,integrity:S,fetchPriority:x,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Mt.preinitModule=function(g,p){if(typeof g=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var v=h(p.as,p.crossOrigin);l.d.M(g,{crossOrigin:v,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&l.d.M(g)},Mt.preload=function(g,p){if(typeof g=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var v=p.as,y=h(v,p.crossOrigin);l.d.L(g,v,{crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},Mt.preloadModule=function(g,p){if(typeof g=="string")if(p){var v=h(p.as,p.crossOrigin);l.d.m(g,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:v,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else l.d.m(g)},Mt.requestFormReset=function(g){l.d.r(g)},Mt.unstable_batchedUpdates=function(g,p){return g(p)},Mt.useFormState=function(g,p,v){return u.H.useFormState(g,p,v)},Mt.useFormStatus=function(){return u.H.useHostTransitionStatus()},Mt.version="19.2.8",Mt}var Bp;function ay(){if(Bp)return xc.exports;Bp=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(),xc.exports=f1(),xc.exports}var Hp;function h1(){if(Hp)return Xa;Hp=1;var t=d1(),r=ud(),i=ay();function l(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 d(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 u(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 g(e){if(d(e)!==e)throw Error(l(188))}function p(e){var n=e.alternate;if(!n){if(n=d(e),n===null)throw Error(l(188));return n!==e?null:e}for(var a=e,s=n;;){var f=a.return;if(f===null)break;var m=f.alternate;if(m===null){if(s=f.return,s!==null){a=s;continue}break}if(f.child===m.child){for(m=f.child;m;){if(m===a)return g(f),e;if(m===s)return g(f),n;m=m.sibling}throw Error(l(188))}if(a.return!==s.return)a=f,s=m;else{for(var b=!1,j=f.child;j;){if(j===a){b=!0,a=f,s=m;break}if(j===s){b=!0,s=f,a=m;break}j=j.sibling}if(!b){for(j=m.child;j;){if(j===a){b=!0,a=m,s=f;break}if(j===s){b=!0,s=m,a=f;break}j=j.sibling}if(!b)throw Error(l(189))}}if(a.alternate!==s)throw Error(l(190))}if(a.tag!==3)throw Error(l(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,S=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),I=Symbol.for("react.fragment"),H=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),A=Symbol.for("react.context"),G=Symbol.for("react.forward_ref"),K=Symbol.for("react.suspense"),E=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),te=Symbol.for("react.lazy"),se=Symbol.for("react.activity"),z=Symbol.for("react.memo_cache_sentinel"),V=Symbol.iterator;function F(e){return e===null||typeof e!="object"?null:(e=V&&e[V]||e["@@iterator"],typeof e=="function"?e:null)}var le=Symbol.for("react.client.reference");function X(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===le?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case I:return"Fragment";case T:return"Profiler";case H:return"StrictMode";case K:return"Suspense";case E:return"SuspenseList";case se:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case w:return"Portal";case A:return e.displayName||"Context";case N:return(e._context.displayName||"Context")+".Consumer";case G:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case $:return n=e.displayName||null,n!==null?n:X(e.type)||"Memo";case te:n=e._payload,e=e._init;try{return X(e(n))}catch{}}return null}var B=Array.isArray,O=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,_={pending:!1,data:null,method:null,action:null},W=[],R=-1;function D(e){return{current:e}}function M(e){0>R||(e.current=W[R],W[R]=null,R--)}function C(e,n){R++,W[R]=e.current,e.current=n}var ie=D(null),de=D(null),Y=D(null),ce=D(null);function he(e,n){switch(C(Y,n),C(de,e),C(ie,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?ep(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=ep(n),e=tp(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}M(ie),C(ie,e)}function pe(){M(ie),M(de),M(Y)}function ye(e){e.memoizedState!==null&&C(ce,e);var n=ie.current,a=tp(n,e.type);n!==a&&(C(de,e),C(ie,a))}function je(e){de.current===e&&(M(ie),M(de)),ce.current===e&&(M(ce),Fa._currentValue=_)}var ze,Ye;function Ke(e){if(ze===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);ze=n&&n[1]||"",Ye=-1<a.stack.indexOf(`
|
|
2
|
-
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
-
`+ze+e+Ye}var lt=!1;function Zt(e,n){if(!e||lt)return"";lt=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(n){var ue=function(){throw Error()};if(Object.defineProperty(ue.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ue,[])}catch(ne){var J=ne}Reflect.construct(e,[],ue)}else{try{ue.call()}catch(ne){J=ne}e.call(ue.prototype)}}else{try{throw Error()}catch(ne){J=ne}(ue=e())&&typeof ue.catch=="function"&&ue.catch(function(){})}}catch(ne){if(ne&&J&&typeof ne.stack=="string")return[ne.stack,J.stack]}return[null,null]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var m=s.DetermineComponentFrameRoot(),b=m[0],j=m[1];if(b&&j){var L=b.split(`
|
|
4
|
-
`),Z=j.split(`
|
|
5
|
-
`);for(f=s=0;s<L.length&&!L[s].includes("DetermineComponentFrameRoot");)s++;for(;f<Z.length&&!Z[f].includes("DetermineComponentFrameRoot");)f++;if(s===L.length||f===Z.length)for(s=L.length-1,f=Z.length-1;1<=s&&0<=f&&L[s]!==Z[f];)f--;for(;1<=s&&0<=f;s--,f--)if(L[s]!==Z[f]){if(s!==1||f!==1)do if(s--,f--,0>f||L[s]!==Z[f]){var ae=`
|
|
6
|
-
`+L[s].replace(" at new "," at ");return e.displayName&&ae.includes("<anonymous>")&&(ae=ae.replace("<anonymous>",e.displayName)),ae}while(1<=s&&0<=f);break}}}finally{lt=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?Ke(a):""}function Tt(e,n){switch(e.tag){case 26:case 27:case 5:return Ke(e.type);case 16:return Ke("Lazy");case 13:return e.child!==n&&n!==null?Ke("Suspense Fallback"):Ke("Suspense");case 19:return Ke("SuspenseList");case 0:case 15:return Zt(e.type,!1);case 11:return Zt(e.type.render,!1);case 1:return Zt(e.type,!0);case 31:return Ke("Activity");default:return""}}function jn(e){try{var n="",a=null;do n+=Tt(e,a),a=e,e=e.return;while(e);return n}catch(s){return`
|
|
7
|
-
Error generating stack: `+s.message+`
|
|
8
|
-
`+s.stack}}var gt=Object.prototype.hasOwnProperty,Jt=t.unstable_scheduleCallback,Ee=t.unstable_cancelCallback,Xe=t.unstable_shouldYield,ut=t.unstable_requestPaint,ee=t.unstable_now,Se=t.unstable_getCurrentPriorityLevel,re=t.unstable_ImmediatePriority,fe=t.unstable_UserBlockingPriority,be=t.unstable_NormalPriority,Re=t.unstable_LowPriority,Te=t.unstable_IdlePriority,st=t.log,yt=t.unstable_setDisableYieldValue,we=null,Ne=null;function _e(e){if(typeof st=="function"&&yt(e),Ne&&typeof Ne.setStrictMode=="function")try{Ne.setStrictMode(we,e)}catch{}}var Ie=Math.clz32?Math.clz32:to,Lt=Math.log,Ut=Math.LN2;function to(e){return e>>>=0,e===0?32:31-(Lt(e)/Ut|0)|0}var li=256,si=262144,Et=4194304;function Rn(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 cl(e,n,a){var s=e.pendingLanes;if(s===0)return 0;var f=0,m=e.suspendedLanes,b=e.pingedLanes;e=e.warmLanes;var j=s&134217727;return j!==0?(s=j&~m,s!==0?f=Rn(s):(b&=j,b!==0?f=Rn(b):a||(a=j&~e,a!==0&&(f=Rn(a))))):(j=s&~m,j!==0?f=Rn(j):b!==0?f=Rn(b):a||(a=s&~e,a!==0&&(f=Rn(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 ra(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function Kv(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 Md(){var e=Et;return Et<<=1,(Et&62914560)===0&&(Et=4194304),e}function no(e){for(var n=[],a=0;31>a;a++)n.push(e);return n}function ia(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Xv(e,n,a,s,f,m){var b=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 j=e.entanglements,L=e.expirationTimes,Z=e.hiddenUpdates;for(a=b&~a;0<a;){var ae=31-Ie(a),ue=1<<ae;j[ae]=0,L[ae]=-1;var J=Z[ae];if(J!==null)for(Z[ae]=null,ae=0;ae<J.length;ae++){var ne=J[ae];ne!==null&&(ne.lane&=-536870913)}a&=~ue}s!==0&&zd(e,s,0),m!==0&&f===0&&e.tag!==0&&(e.suspendedLanes|=m&~(b&~n))}function zd(e,n,a){e.pendingLanes|=n,e.suspendedLanes&=~n;var s=31-Ie(n);e.entangledLanes|=n,e.entanglements[s]=e.entanglements[s]|1073741824|a&261930}function _d(e,n){var a=e.entangledLanes|=n;for(e=e.entanglements;a;){var s=31-Ie(a),f=1<<s;f&n|e[s]&n&&(e[s]|=n),a&=~f}}function Ld(e,n){var a=n&-n;return a=(a&42)!==0?1:ro(a),(a&(e.suspendedLanes|n))!==0?0:a}function ro(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 io(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Bd(){var e=U.p;return e!==0?e:(e=window.event,e===void 0?32:Cp(e.type))}function Hd(e,n){var a=U.p;try{return U.p=e,n()}finally{U.p=a}}var rr=Math.random().toString(36).slice(2),Nt="__reactFiber$"+rr,qt="__reactProps$"+rr,oi="__reactContainer$"+rr,ao="__reactEvents$"+rr,Qv="__reactListeners$"+rr,Zv="__reactHandles$"+rr,Ud="__reactResources$"+rr,aa="__reactMarker$"+rr;function lo(e){delete e[Nt],delete e[qt],delete e[ao],delete e[Qv],delete e[Zv]}function ui(e){var n=e[Nt];if(n)return n;for(var a=e.parentNode;a;){if(n=a[oi]||a[Nt]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(e=op(e);e!==null;){if(a=e[Nt])return a;e=op(e)}return n}e=a,a=e.parentNode}return null}function ci(e){if(e=e[Nt]||e[oi]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function la(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(l(33))}function di(e){var n=e[Ud];return n||(n=e[Ud]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function jt(e){e[aa]=!0}var qd=new Set,Gd={};function Or(e,n){fi(e,n),fi(e+"Capture",n)}function fi(e,n){for(Gd[e]=n,e=0;e<n.length;e++)qd.add(n[e])}var Jv=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]*$"),$d={},Fd={};function Wv(e){return gt.call(Fd,e)?!0:gt.call($d,e)?!1:Jv.test(e)?Fd[e]=!0:($d[e]=!0,!1)}function dl(e,n,a){if(Wv(n))if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var s=n.toLowerCase().slice(0,5);if(s!=="data-"&&s!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,""+a)}}function fl(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 zn(e,n,a,s){if(s===null)e.removeAttribute(a);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(n,a,""+s)}}function un(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Vd(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function eb(e,n,a){var s=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var f=s.get,m=s.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return f.call(this)},set:function(b){a=""+b,m.call(this,b)}}),Object.defineProperty(e,n,{enumerable:s.enumerable}),{getValue:function(){return a},setValue:function(b){a=""+b},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function so(e){if(!e._valueTracker){var n=Vd(e)?"checked":"value";e._valueTracker=eb(e,n,""+e[n])}}function Pd(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var a=n.getValue(),s="";return e&&(s=Vd(e)?e.checked?"true":"false":e.value),e=s,e!==a?(n.setValue(e),!0):!1}function hl(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 cn(e){return e.replace(tb,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function oo(e,n,a,s,f,m,b,j){e.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.type=b:e.removeAttribute("type"),n!=null?b==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+un(n)):e.value!==""+un(n)&&(e.value=""+un(n)):b!=="submit"&&b!=="reset"||e.removeAttribute("value"),n!=null?uo(e,b,un(n)):a!=null?uo(e,b,un(a)):s!=null&&e.removeAttribute("value"),f==null&&m!=null&&(e.defaultChecked=!!m),f!=null&&(e.checked=f&&typeof f!="function"&&typeof f!="symbol"),j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?e.name=""+un(j):e.removeAttribute("name")}function Yd(e,n,a,s,f,m,b,j){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)){so(e);return}a=a!=null?""+un(a):"",n=n!=null?""+un(n):a,j||n===e.value||(e.value=n),e.defaultValue=n}s=s??f,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=j?e.checked:!!s,e.defaultChecked=!!s,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(e.name=b),so(e)}function uo(e,n,a){n==="number"&&hl(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function hi(e,n,a,s){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&&s&&(e[a].defaultSelected=!0)}else{for(a=""+un(a),n=null,f=0;f<e.length;f++){if(e[f].value===a){e[f].selected=!0,s&&(e[f].defaultSelected=!0);return}n!==null||e[f].disabled||(n=e[f])}n!==null&&(n.selected=!0)}}function Kd(e,n,a){if(n!=null&&(n=""+un(n),n!==e.value&&(e.value=n),a==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=a!=null?""+un(a):""}function Xd(e,n,a,s){if(n==null){if(s!=null){if(a!=null)throw Error(l(92));if(B(s)){if(1<s.length)throw Error(l(93));s=s[0]}a=s}a==null&&(a=""),n=a}a=un(n),e.defaultValue=a,s=e.textContent,s===a&&s!==""&&s!==null&&(e.value=s),so(e)}function mi(e,n){if(n){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=n;return}}e.textContent=n}var nb=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 Qd(e,n,a){var s=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?s?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":s?e.setProperty(n,a):typeof a!="number"||a===0||nb.has(n)?n==="float"?e.cssFloat=a:e[n]=(""+a).trim():e[n]=a+"px"}function Zd(e,n,a){if(n!=null&&typeof n!="object")throw Error(l(62));if(e=e.style,a!=null){for(var s in a)!a.hasOwnProperty(s)||n!=null&&n.hasOwnProperty(s)||(s.indexOf("--")===0?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="");for(var f in n)s=n[f],n.hasOwnProperty(f)&&a[f]!==s&&Qd(e,f,s)}else for(var m in n)n.hasOwnProperty(m)&&Qd(e,m,n[m])}function co(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 rb=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"]]),ib=/^[\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 ml(e){return ib.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function _n(){}var fo=null;function ho(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var pi=null,gi=null;function Jd(e){var n=ci(e);if(n&&(e=n.stateNode)){var a=e[qt]||null;e:switch(e=n.stateNode,n.type){case"input":if(oo(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="'+cn(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var s=a[n];if(s!==e&&s.form===e.form){var f=s[qt]||null;if(!f)throw Error(l(90));oo(s,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(n=0;n<a.length;n++)s=a[n],s.form===e.form&&Pd(s)}break e;case"textarea":Kd(e,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&hi(e,!!a.multiple,n,!1)}}}var mo=!1;function Wd(e,n,a){if(mo)return e(n,a);mo=!0;try{var s=e(n);return s}finally{if(mo=!1,(pi!==null||gi!==null)&&(ts(),pi&&(n=pi,e=gi,gi=pi=null,Jd(n),e)))for(n=0;n<e.length;n++)Jd(e[n])}}function sa(e,n){var a=e.stateNode;if(a===null)return null;var s=a[qt]||null;if(s===null)return null;a=s[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":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(l(231,n,typeof a));return a}var Ln=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),po=!1;if(Ln)try{var oa={};Object.defineProperty(oa,"passive",{get:function(){po=!0}}),window.addEventListener("test",oa,oa),window.removeEventListener("test",oa,oa)}catch{po=!1}var ir=null,go=null,pl=null;function ef(){if(pl)return pl;var e,n=go,a=n.length,s,f="value"in ir?ir.value:ir.textContent,m=f.length;for(e=0;e<a&&n[e]===f[e];e++);var b=a-e;for(s=1;s<=b&&n[a-s]===f[m-s];s++);return pl=f.slice(e,1<s?1-s:void 0)}function gl(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 yl(){return!0}function tf(){return!1}function Gt(e){function n(a,s,f,m,b){this._reactName=a,this._targetInst=f,this.type=s,this.nativeEvent=m,this.target=b,this.currentTarget=null;for(var j in e)e.hasOwnProperty(j)&&(a=e[j],this[j]=a?a(m):m[j]);return this.isDefaultPrevented=(m.defaultPrevented!=null?m.defaultPrevented:m.returnValue===!1)?yl:tf,this.isPropagationStopped=tf,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=yl)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=yl)},persist:function(){},isPersistent:yl}),n}var Mr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},vl=Gt(Mr),ua=y({},Mr,{view:0,detail:0}),ab=Gt(ua),yo,vo,ca,bl=y({},ua,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:xo,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!==ca&&(ca&&e.type==="mousemove"?(yo=e.screenX-ca.screenX,vo=e.screenY-ca.screenY):vo=yo=0,ca=e),yo)},movementY:function(e){return"movementY"in e?e.movementY:vo}}),nf=Gt(bl),lb=y({},bl,{dataTransfer:0}),sb=Gt(lb),ob=y({},ua,{relatedTarget:0}),bo=Gt(ob),ub=y({},Mr,{animationName:0,elapsedTime:0,pseudoElement:0}),cb=Gt(ub),db=y({},Mr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),fb=Gt(db),hb=y({},Mr,{data:0}),rf=Gt(hb),mb={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},pb={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},gb={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function yb(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=gb[e])?!!n[e]:!1}function xo(){return yb}var vb=y({},ua,{key:function(e){if(e.key){var n=mb[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=gl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?pb[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:xo,charCode:function(e){return e.type==="keypress"?gl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?gl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),bb=Gt(vb),xb=y({},bl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),af=Gt(xb),Sb=y({},ua,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:xo}),kb=Gt(Sb),wb=y({},Mr,{propertyName:0,elapsedTime:0,pseudoElement:0}),Cb=Gt(wb),jb=y({},bl,{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}),Rb=Gt(jb),Tb=y({},Mr,{newState:0,oldState:0}),Eb=Gt(Tb),Nb=[9,13,27,32],So=Ln&&"CompositionEvent"in window,da=null;Ln&&"documentMode"in document&&(da=document.documentMode);var Ab=Ln&&"TextEvent"in window&&!da,lf=Ln&&(!So||da&&8<da&&11>=da),sf=" ",of=!1;function uf(e,n){switch(e){case"keyup":return Nb.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function cf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var yi=!1;function Ib(e,n){switch(e){case"compositionend":return cf(n);case"keypress":return n.which!==32?null:(of=!0,sf);case"textInput":return e=n.data,e===sf&&of?null:e;default:return null}}function Db(e,n){if(yi)return e==="compositionend"||!So&&uf(e,n)?(e=ef(),pl=go=ir=null,yi=!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 lf&&n.locale!=="ko"?null:n.data;default:return null}}var Ob={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 df(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!Ob[e.type]:n==="textarea"}function ff(e,n,a,s){pi?gi?gi.push(s):gi=[s]:pi=s,n=os(n,"onChange"),0<n.length&&(a=new vl("onChange","change",null,a,s),e.push({event:a,listeners:n}))}var fa=null,ha=null;function Mb(e){Km(e,0)}function xl(e){var n=la(e);if(Pd(n))return e}function hf(e,n){if(e==="change")return n}var mf=!1;if(Ln){var ko;if(Ln){var wo="oninput"in document;if(!wo){var pf=document.createElement("div");pf.setAttribute("oninput","return;"),wo=typeof pf.oninput=="function"}ko=wo}else ko=!1;mf=ko&&(!document.documentMode||9<document.documentMode)}function gf(){fa&&(fa.detachEvent("onpropertychange",yf),ha=fa=null)}function yf(e){if(e.propertyName==="value"&&xl(ha)){var n=[];ff(n,ha,e,ho(e)),Wd(Mb,n)}}function zb(e,n,a){e==="focusin"?(gf(),fa=n,ha=a,fa.attachEvent("onpropertychange",yf)):e==="focusout"&&gf()}function _b(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return xl(ha)}function Lb(e,n){if(e==="click")return xl(n)}function Bb(e,n){if(e==="input"||e==="change")return xl(n)}function Hb(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var Wt=typeof Object.is=="function"?Object.is:Hb;function ma(e,n){if(Wt(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var a=Object.keys(e),s=Object.keys(n);if(a.length!==s.length)return!1;for(s=0;s<a.length;s++){var f=a[s];if(!gt.call(n,f)||!Wt(e[f],n[f]))return!1}return!0}function vf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function bf(e,n){var a=vf(e);e=0;for(var s;a;){if(a.nodeType===3){if(s=e+a.textContent.length,e<=n&&s>=n)return{node:a,offset:n-e};e=s}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=vf(a)}}function xf(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?xf(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Sf(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=hl(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=hl(e.document)}return n}function Co(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 Ub=Ln&&"documentMode"in document&&11>=document.documentMode,vi=null,jo=null,pa=null,Ro=!1;function kf(e,n,a){var s=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Ro||vi==null||vi!==hl(s)||(s=vi,"selectionStart"in s&&Co(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),pa&&ma(pa,s)||(pa=s,s=os(jo,"onSelect"),0<s.length&&(n=new vl("onSelect","select",null,n,a),e.push({event:n,listeners:s}),n.target=vi)))}function zr(e,n){var a={};return a[e.toLowerCase()]=n.toLowerCase(),a["Webkit"+e]="webkit"+n,a["Moz"+e]="moz"+n,a}var bi={animationend:zr("Animation","AnimationEnd"),animationiteration:zr("Animation","AnimationIteration"),animationstart:zr("Animation","AnimationStart"),transitionrun:zr("Transition","TransitionRun"),transitionstart:zr("Transition","TransitionStart"),transitioncancel:zr("Transition","TransitionCancel"),transitionend:zr("Transition","TransitionEnd")},To={},wf={};Ln&&(wf=document.createElement("div").style,"AnimationEvent"in window||(delete bi.animationend.animation,delete bi.animationiteration.animation,delete bi.animationstart.animation),"TransitionEvent"in window||delete bi.transitionend.transition);function _r(e){if(To[e])return To[e];if(!bi[e])return e;var n=bi[e],a;for(a in n)if(n.hasOwnProperty(a)&&a in wf)return To[e]=n[a];return e}var Cf=_r("animationend"),jf=_r("animationiteration"),Rf=_r("animationstart"),qb=_r("transitionrun"),Gb=_r("transitionstart"),$b=_r("transitioncancel"),Tf=_r("transitionend"),Ef=new Map,Eo="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(" ");Eo.push("scrollEnd");function xn(e,n){Ef.set(e,n),Or(n,[e])}var Sl=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)},dn=[],xi=0,No=0;function kl(){for(var e=xi,n=No=xi=0;n<e;){var a=dn[n];dn[n++]=null;var s=dn[n];dn[n++]=null;var f=dn[n];dn[n++]=null;var m=dn[n];if(dn[n++]=null,s!==null&&f!==null){var b=s.pending;b===null?f.next=f:(f.next=b.next,b.next=f),s.pending=f}m!==0&&Nf(a,f,m)}}function wl(e,n,a,s){dn[xi++]=e,dn[xi++]=n,dn[xi++]=a,dn[xi++]=s,No|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function Ao(e,n,a,s){return wl(e,n,a,s),Cl(e)}function Lr(e,n){return wl(e,null,null,n),Cl(e)}function Nf(e,n,a){e.lanes|=a;var s=e.alternate;s!==null&&(s.lanes|=a);for(var f=!1,m=e.return;m!==null;)m.childLanes|=a,s=m.alternate,s!==null&&(s.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-Ie(a),e=m.hiddenUpdates,s=e[f],s===null?e[f]=[n]:s.push(n),n.lane=a|536870912),m):null}function Cl(e){if(50<La)throw La=0,Hu=null,Error(l(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var Si={};function Fb(e,n,a,s){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=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function en(e,n,a,s){return new Fb(e,n,a,s)}function Io(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Bn(e,n){var a=e.alternate;return a===null?(a=en(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 Af(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 jl(e,n,a,s,f,m){var b=0;if(s=e,typeof e=="function")Io(e)&&(b=1);else if(typeof e=="string")b=Xx(e,a,ie.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case se:return e=en(31,a,n,f),e.elementType=se,e.lanes=m,e;case I:return Br(a.children,f,m,n);case H:b=8,f|=24;break;case T:return e=en(12,a,n,f|2),e.elementType=T,e.lanes=m,e;case K:return e=en(13,a,n,f),e.elementType=K,e.lanes=m,e;case E:return e=en(19,a,n,f),e.elementType=E,e.lanes=m,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case A:b=10;break e;case N:b=9;break e;case G:b=11;break e;case $:b=14;break e;case te:b=16,s=null;break e}b=29,a=Error(l(130,e===null?"null":typeof e,"")),s=null}return n=en(b,a,n,f),n.elementType=e,n.type=s,n.lanes=m,n}function Br(e,n,a,s){return e=en(7,e,s,n),e.lanes=a,e}function Do(e,n,a){return e=en(6,e,null,n),e.lanes=a,e}function If(e){var n=en(18,null,null,0);return n.stateNode=e,n}function Oo(e,n,a){return n=en(4,e.children!==null?e.children:[],e.key,n),n.lanes=a,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var Df=new WeakMap;function fn(e,n){if(typeof e=="object"&&e!==null){var a=Df.get(e);return a!==void 0?a:(n={value:e,source:n,stack:jn(n)},Df.set(e,n),n)}return{value:e,source:n,stack:jn(n)}}var ki=[],wi=0,Rl=null,ga=0,hn=[],mn=0,ar=null,Tn=1,En="";function Hn(e,n){ki[wi++]=ga,ki[wi++]=Rl,Rl=e,ga=n}function Of(e,n,a){hn[mn++]=Tn,hn[mn++]=En,hn[mn++]=ar,ar=e;var s=Tn;e=En;var f=32-Ie(s)-1;s&=~(1<<f),a+=1;var m=32-Ie(n)+f;if(30<m){var b=f-f%5;m=(s&(1<<b)-1).toString(32),s>>=b,f-=b,Tn=1<<32-Ie(n)+f|a<<f|s,En=m+e}else Tn=1<<m|a<<f|s,En=e}function Mo(e){e.return!==null&&(Hn(e,1),Of(e,1,0))}function zo(e){for(;e===Rl;)Rl=ki[--wi],ki[wi]=null,ga=ki[--wi],ki[wi]=null;for(;e===ar;)ar=hn[--mn],hn[mn]=null,En=hn[--mn],hn[mn]=null,Tn=hn[--mn],hn[mn]=null}function Mf(e,n){hn[mn++]=Tn,hn[mn++]=En,hn[mn++]=ar,Tn=n.id,En=n.overflow,ar=e}var At=null,it=null,Ge=!1,lr=null,pn=!1,_o=Error(l(519));function sr(e){var n=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ya(fn(n,e)),_o}function zf(e){var n=e.stateNode,a=e.type,s=e.memoizedProps;switch(n[Nt]=e,n[qt]=s,a){case"dialog":Be("cancel",n),Be("close",n);break;case"iframe":case"object":case"embed":Be("load",n);break;case"video":case"audio":for(a=0;a<Ha.length;a++)Be(Ha[a],n);break;case"source":Be("error",n);break;case"img":case"image":case"link":Be("error",n),Be("load",n);break;case"details":Be("toggle",n);break;case"input":Be("invalid",n),Yd(n,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":Be("invalid",n);break;case"textarea":Be("invalid",n),Xd(n,s.value,s.defaultValue,s.children)}a=s.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||n.textContent===""+a||s.suppressHydrationWarning===!0||Jm(n.textContent,a)?(s.popover!=null&&(Be("beforetoggle",n),Be("toggle",n)),s.onScroll!=null&&Be("scroll",n),s.onScrollEnd!=null&&Be("scrollend",n),s.onClick!=null&&(n.onclick=_n),n=!0):n=!1,n||sr(e,!0)}function _f(e){for(At=e.return;At;)switch(At.tag){case 5:case 31:case 13:pn=!1;return;case 27:case 3:pn=!0;return;default:At=At.return}}function Ci(e){if(e!==At)return!1;if(!Ge)return _f(e),Ge=!0,!1;var n=e.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||ec(e.type,e.memoizedProps)),a=!a),a&&it&&sr(e),_f(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));it=sp(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));it=sp(e)}else n===27?(n=it,Sr(e.type)?(e=ac,ac=null,it=e):it=n):it=At?yn(e.stateNode.nextSibling):null;return!0}function Hr(){it=At=null,Ge=!1}function Lo(){var e=lr;return e!==null&&(Pt===null?Pt=e:Pt.push.apply(Pt,e),lr=null),e}function ya(e){lr===null?lr=[e]:lr.push(e)}var Bo=D(null),Ur=null,Un=null;function or(e,n,a){C(Bo,n._currentValue),n._currentValue=a}function qn(e){e._currentValue=Bo.current,M(Bo)}function Ho(e,n,a){for(;e!==null;){var s=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,s!==null&&(s.childLanes|=n)):s!==null&&(s.childLanes&n)!==n&&(s.childLanes|=n),e===a)break;e=e.return}}function Uo(e,n,a,s){var f=e.child;for(f!==null&&(f.return=e);f!==null;){var m=f.dependencies;if(m!==null){var b=f.child;m=m.firstContext;e:for(;m!==null;){var j=m;m=f;for(var L=0;L<n.length;L++)if(j.context===n[L]){m.lanes|=a,j=m.alternate,j!==null&&(j.lanes|=a),Ho(m.return,a,e),s||(b=null);break e}m=j.next}}else if(f.tag===18){if(b=f.return,b===null)throw Error(l(341));b.lanes|=a,m=b.alternate,m!==null&&(m.lanes|=a),Ho(b,a,e),b=null}else b=f.child;if(b!==null)b.return=f;else for(b=f;b!==null;){if(b===e){b=null;break}if(f=b.sibling,f!==null){f.return=b.return,b=f;break}b=b.return}f=b}}function ji(e,n,a,s){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 b=f.alternate;if(b===null)throw Error(l(387));if(b=b.memoizedProps,b!==null){var j=f.type;Wt(f.pendingProps.value,b.value)||(e!==null?e.push(j):e=[j])}}else if(f===ce.current){if(b=f.alternate,b===null)throw Error(l(387));b.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(e!==null?e.push(Fa):e=[Fa])}f=f.return}e!==null&&Uo(n,e,a,s),n.flags|=262144}function Tl(e){for(e=e.firstContext;e!==null;){if(!Wt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function qr(e){Ur=e,Un=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function It(e){return Lf(Ur,e)}function El(e,n){return Ur===null&&qr(e),Lf(e,n)}function Lf(e,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},Un===null){if(e===null)throw Error(l(308));Un=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else Un=Un.next=n;return a}var Vb=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(a,s){e.push(s)}};this.abort=function(){n.aborted=!0,e.forEach(function(a){return a()})}},Pb=t.unstable_scheduleCallback,Yb=t.unstable_NormalPriority,vt={$$typeof:A,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function qo(){return{controller:new Vb,data:new Map,refCount:0}}function va(e){e.refCount--,e.refCount===0&&Pb(Yb,function(){e.controller.abort()})}var ba=null,Go=0,Ri=0,Ti=null;function Kb(e,n){if(ba===null){var a=ba=[];Go=0,Ri=Vu(),Ti={status:"pending",value:void 0,then:function(s){a.push(s)}}}return Go++,n.then(Bf,Bf),n}function Bf(){if(--Go===0&&ba!==null){Ti!==null&&(Ti.status="fulfilled");var e=ba;ba=null,Ri=0,Ti=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function Xb(e,n){var a=[],s={status:"pending",value:null,reason:null,then:function(f){a.push(f)}};return e.then(function(){s.status="fulfilled",s.value=n;for(var f=0;f<a.length;f++)(0,a[f])(n)},function(f){for(s.status="rejected",s.reason=f,f=0;f<a.length;f++)(0,a[f])(void 0)}),s}var Hf=O.S;O.S=function(e,n){km=ee(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&Kb(e,n),Hf!==null&&Hf(e,n)};var Gr=D(null);function $o(){var e=Gr.current;return e!==null?e:tt.pooledCache}function Nl(e,n){n===null?C(Gr,Gr.current):C(Gr,n.pool)}function Uf(){var e=$o();return e===null?null:{parent:vt._currentValue,pool:e}}var Ei=Error(l(460)),Fo=Error(l(474)),Al=Error(l(542)),Il={then:function(){}};function qf(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Gf(e,n,a){switch(a=e[a],a===void 0?e.push(n):a!==n&&(n.then(_n,_n),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,Ff(e),e;default:if(typeof n.status=="string")n.then(_n,_n);else{if(e=tt,e!==null&&100<e.shellSuspendCounter)throw Error(l(482));e=n,e.status="pending",e.then(function(s){if(n.status==="pending"){var f=n;f.status="fulfilled",f.value=s}},function(s){if(n.status==="pending"){var f=n;f.status="rejected",f.reason=s}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,Ff(e),e}throw Fr=n,Ei}}function $r(e){try{var n=e._init;return n(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(Fr=a,Ei):a}}var Fr=null;function $f(){if(Fr===null)throw Error(l(459));var e=Fr;return Fr=null,e}function Ff(e){if(e===Ei||e===Al)throw Error(l(483))}var Ni=null,xa=0;function Dl(e){var n=xa;return xa+=1,Ni===null&&(Ni=[]),Gf(Ni,e,n)}function Sa(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function Ol(e,n){throw n.$$typeof===S?Error(l(525)):(e=Object.prototype.toString.call(n),Error(l(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function Vf(e){function n(P,q){if(e){var Q=P.deletions;Q===null?(P.deletions=[q],P.flags|=16):Q.push(q)}}function a(P,q){if(!e)return null;for(;q!==null;)n(P,q),q=q.sibling;return null}function s(P){for(var q=new Map;P!==null;)P.key!==null?q.set(P.key,P):q.set(P.index,P),P=P.sibling;return q}function f(P,q){return P=Bn(P,q),P.index=0,P.sibling=null,P}function m(P,q,Q){return P.index=Q,e?(Q=P.alternate,Q!==null?(Q=Q.index,Q<q?(P.flags|=67108866,q):Q):(P.flags|=67108866,q)):(P.flags|=1048576,q)}function b(P){return e&&P.alternate===null&&(P.flags|=67108866),P}function j(P,q,Q,oe){return q===null||q.tag!==6?(q=Do(Q,P.mode,oe),q.return=P,q):(q=f(q,Q),q.return=P,q)}function L(P,q,Q,oe){var xe=Q.type;return xe===I?ae(P,q,Q.props.children,oe,Q.key):q!==null&&(q.elementType===xe||typeof xe=="object"&&xe!==null&&xe.$$typeof===te&&$r(xe)===q.type)?(q=f(q,Q.props),Sa(q,Q),q.return=P,q):(q=jl(Q.type,Q.key,Q.props,null,P.mode,oe),Sa(q,Q),q.return=P,q)}function Z(P,q,Q,oe){return q===null||q.tag!==4||q.stateNode.containerInfo!==Q.containerInfo||q.stateNode.implementation!==Q.implementation?(q=Oo(Q,P.mode,oe),q.return=P,q):(q=f(q,Q.children||[]),q.return=P,q)}function ae(P,q,Q,oe,xe){return q===null||q.tag!==7?(q=Br(Q,P.mode,oe,xe),q.return=P,q):(q=f(q,Q),q.return=P,q)}function ue(P,q,Q){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return q=Do(""+q,P.mode,Q),q.return=P,q;if(typeof q=="object"&&q!==null){switch(q.$$typeof){case x:return Q=jl(q.type,q.key,q.props,null,P.mode,Q),Sa(Q,q),Q.return=P,Q;case w:return q=Oo(q,P.mode,Q),q.return=P,q;case te:return q=$r(q),ue(P,q,Q)}if(B(q)||F(q))return q=Br(q,P.mode,Q,null),q.return=P,q;if(typeof q.then=="function")return ue(P,Dl(q),Q);if(q.$$typeof===A)return ue(P,El(P,q),Q);Ol(P,q)}return null}function J(P,q,Q,oe){var xe=q!==null?q.key:null;if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return xe!==null?null:j(P,q,""+Q,oe);if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case x:return Q.key===xe?L(P,q,Q,oe):null;case w:return Q.key===xe?Z(P,q,Q,oe):null;case te:return Q=$r(Q),J(P,q,Q,oe)}if(B(Q)||F(Q))return xe!==null?null:ae(P,q,Q,oe,null);if(typeof Q.then=="function")return J(P,q,Dl(Q),oe);if(Q.$$typeof===A)return J(P,q,El(P,Q),oe);Ol(P,Q)}return null}function ne(P,q,Q,oe,xe){if(typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint")return P=P.get(Q)||null,j(q,P,""+oe,xe);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case x:return P=P.get(oe.key===null?Q:oe.key)||null,L(q,P,oe,xe);case w:return P=P.get(oe.key===null?Q:oe.key)||null,Z(q,P,oe,xe);case te:return oe=$r(oe),ne(P,q,Q,oe,xe)}if(B(oe)||F(oe))return P=P.get(Q)||null,ae(q,P,oe,xe,null);if(typeof oe.then=="function")return ne(P,q,Q,Dl(oe),xe);if(oe.$$typeof===A)return ne(P,q,Q,El(q,oe),xe);Ol(q,oe)}return null}function ge(P,q,Q,oe){for(var xe=null,Fe=null,ve=q,Me=q=0,qe=null;ve!==null&&Me<Q.length;Me++){ve.index>Me?(qe=ve,ve=null):qe=ve.sibling;var Ve=J(P,ve,Q[Me],oe);if(Ve===null){ve===null&&(ve=qe);break}e&&ve&&Ve.alternate===null&&n(P,ve),q=m(Ve,q,Me),Fe===null?xe=Ve:Fe.sibling=Ve,Fe=Ve,ve=qe}if(Me===Q.length)return a(P,ve),Ge&&Hn(P,Me),xe;if(ve===null){for(;Me<Q.length;Me++)ve=ue(P,Q[Me],oe),ve!==null&&(q=m(ve,q,Me),Fe===null?xe=ve:Fe.sibling=ve,Fe=ve);return Ge&&Hn(P,Me),xe}for(ve=s(ve);Me<Q.length;Me++)qe=ne(ve,P,Me,Q[Me],oe),qe!==null&&(e&&qe.alternate!==null&&ve.delete(qe.key===null?Me:qe.key),q=m(qe,q,Me),Fe===null?xe=qe:Fe.sibling=qe,Fe=qe);return e&&ve.forEach(function(Rr){return n(P,Rr)}),Ge&&Hn(P,Me),xe}function Ce(P,q,Q,oe){if(Q==null)throw Error(l(151));for(var xe=null,Fe=null,ve=q,Me=q=0,qe=null,Ve=Q.next();ve!==null&&!Ve.done;Me++,Ve=Q.next()){ve.index>Me?(qe=ve,ve=null):qe=ve.sibling;var Rr=J(P,ve,Ve.value,oe);if(Rr===null){ve===null&&(ve=qe);break}e&&ve&&Rr.alternate===null&&n(P,ve),q=m(Rr,q,Me),Fe===null?xe=Rr:Fe.sibling=Rr,Fe=Rr,ve=qe}if(Ve.done)return a(P,ve),Ge&&Hn(P,Me),xe;if(ve===null){for(;!Ve.done;Me++,Ve=Q.next())Ve=ue(P,Ve.value,oe),Ve!==null&&(q=m(Ve,q,Me),Fe===null?xe=Ve:Fe.sibling=Ve,Fe=Ve);return Ge&&Hn(P,Me),xe}for(ve=s(ve);!Ve.done;Me++,Ve=Q.next())Ve=ne(ve,P,Me,Ve.value,oe),Ve!==null&&(e&&Ve.alternate!==null&&ve.delete(Ve.key===null?Me:Ve.key),q=m(Ve,q,Me),Fe===null?xe=Ve:Fe.sibling=Ve,Fe=Ve);return e&&ve.forEach(function(l1){return n(P,l1)}),Ge&&Hn(P,Me),xe}function et(P,q,Q,oe){if(typeof Q=="object"&&Q!==null&&Q.type===I&&Q.key===null&&(Q=Q.props.children),typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case x:e:{for(var xe=Q.key;q!==null;){if(q.key===xe){if(xe=Q.type,xe===I){if(q.tag===7){a(P,q.sibling),oe=f(q,Q.props.children),oe.return=P,P=oe;break e}}else if(q.elementType===xe||typeof xe=="object"&&xe!==null&&xe.$$typeof===te&&$r(xe)===q.type){a(P,q.sibling),oe=f(q,Q.props),Sa(oe,Q),oe.return=P,P=oe;break e}a(P,q);break}else n(P,q);q=q.sibling}Q.type===I?(oe=Br(Q.props.children,P.mode,oe,Q.key),oe.return=P,P=oe):(oe=jl(Q.type,Q.key,Q.props,null,P.mode,oe),Sa(oe,Q),oe.return=P,P=oe)}return b(P);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(P,q.sibling),oe=f(q,Q.children||[]),oe.return=P,P=oe;break e}else{a(P,q);break}else n(P,q);q=q.sibling}oe=Oo(Q,P.mode,oe),oe.return=P,P=oe}return b(P);case te:return Q=$r(Q),et(P,q,Q,oe)}if(B(Q))return ge(P,q,Q,oe);if(F(Q)){if(xe=F(Q),typeof xe!="function")throw Error(l(150));return Q=xe.call(Q),Ce(P,q,Q,oe)}if(typeof Q.then=="function")return et(P,q,Dl(Q),oe);if(Q.$$typeof===A)return et(P,q,El(P,Q),oe);Ol(P,Q)}return typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint"?(Q=""+Q,q!==null&&q.tag===6?(a(P,q.sibling),oe=f(q,Q),oe.return=P,P=oe):(a(P,q),oe=Do(Q,P.mode,oe),oe.return=P,P=oe),b(P)):a(P,q)}return function(P,q,Q,oe){try{xa=0;var xe=et(P,q,Q,oe);return Ni=null,xe}catch(ve){if(ve===Ei||ve===Al)throw ve;var Fe=en(29,ve,null,P.mode);return Fe.lanes=oe,Fe.return=P,Fe}}}var Vr=Vf(!0),Pf=Vf(!1),ur=!1;function Vo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Po(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 dr(e,n,a){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(Pe&2)!==0){var f=s.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),s.pending=n,n=Cl(e),Nf(e,null,a),n}return wl(e,s,n,a),Cl(e)}function ka(e,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var s=n.lanes;s&=e.pendingLanes,a|=s,n.lanes=a,_d(e,a)}}function Yo(e,n){var a=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,a===s)){var f=null,m=null;if(a=a.firstBaseUpdate,a!==null){do{var b={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};m===null?f=m=b:m=m.next=b,a=a.next}while(a!==null);m===null?f=m=n:m=m.next=n}else f=m=n;a={baseState:s.baseState,firstBaseUpdate:f,lastBaseUpdate:m,shared:s.shared,callbacks:s.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=n:e.next=n,a.lastBaseUpdate=n}var Ko=!1;function wa(){if(Ko){var e=Ti;if(e!==null)throw e}}function Ca(e,n,a,s){Ko=!1;var f=e.updateQueue;ur=!1;var m=f.firstBaseUpdate,b=f.lastBaseUpdate,j=f.shared.pending;if(j!==null){f.shared.pending=null;var L=j,Z=L.next;L.next=null,b===null?m=Z:b.next=Z,b=L;var ae=e.alternate;ae!==null&&(ae=ae.updateQueue,j=ae.lastBaseUpdate,j!==b&&(j===null?ae.firstBaseUpdate=Z:j.next=Z,ae.lastBaseUpdate=L))}if(m!==null){var ue=f.baseState;b=0,ae=Z=L=null,j=m;do{var J=j.lane&-536870913,ne=J!==j.lane;if(ne?(Ue&J)===J:(s&J)===J){J!==0&&J===Ri&&(Ko=!0),ae!==null&&(ae=ae.next={lane:0,tag:j.tag,payload:j.payload,callback:null,next:null});e:{var ge=e,Ce=j;J=n;var et=a;switch(Ce.tag){case 1:if(ge=Ce.payload,typeof ge=="function"){ue=ge.call(et,ue,J);break e}ue=ge;break e;case 3:ge.flags=ge.flags&-65537|128;case 0:if(ge=Ce.payload,J=typeof ge=="function"?ge.call(et,ue,J):ge,J==null)break e;ue=y({},ue,J);break e;case 2:ur=!0}}J=j.callback,J!==null&&(e.flags|=64,ne&&(e.flags|=8192),ne=f.callbacks,ne===null?f.callbacks=[J]:ne.push(J))}else ne={lane:J,tag:j.tag,payload:j.payload,callback:j.callback,next:null},ae===null?(Z=ae=ne,L=ue):ae=ae.next=ne,b|=J;if(j=j.next,j===null){if(j=f.shared.pending,j===null)break;ne=j,j=ne.next,ne.next=null,f.lastBaseUpdate=ne,f.shared.pending=null}}while(!0);ae===null&&(L=ue),f.baseState=L,f.firstBaseUpdate=Z,f.lastBaseUpdate=ae,m===null&&(f.shared.lanes=0),gr|=b,e.lanes=b,e.memoizedState=ue}}function Yf(e,n){if(typeof e!="function")throw Error(l(191,e));e.call(n)}function Kf(e,n){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)Yf(a[e],n)}var Ai=D(null),Ml=D(0);function Xf(e,n){e=Qn,C(Ml,e),C(Ai,n),Qn=e|n.baseLanes}function Xo(){C(Ml,Qn),C(Ai,Ai.current)}function Qo(){Qn=Ml.current,M(Ai),M(Ml)}var tn=D(null),gn=null;function fr(e){var n=e.alternate;C(ht,ht.current&1),C(tn,e),gn===null&&(n===null||Ai.current!==null||n.memoizedState!==null)&&(gn=e)}function Zo(e){C(ht,ht.current),C(tn,e),gn===null&&(gn=e)}function Qf(e){e.tag===22?(C(ht,ht.current),C(tn,e),gn===null&&(gn=e)):hr()}function hr(){C(ht,ht.current),C(tn,tn.current)}function nn(e){M(tn),gn===e&&(gn=null),M(ht)}var ht=D(0);function zl(e){for(var n=e;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||rc(a)||ic(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 Gn=0,Oe=null,Je=null,bt=null,_l=!1,Ii=!1,Pr=!1,Ll=0,ja=0,Di=null,Qb=0;function ct(){throw Error(l(321))}function Jo(e,n){if(n===null)return!1;for(var a=0;a<n.length&&a<e.length;a++)if(!Wt(e[a],n[a]))return!1;return!0}function Wo(e,n,a,s,f,m){return Gn=m,Oe=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,O.H=e===null||e.memoizedState===null?Oh:mu,Pr=!1,m=a(s,f),Pr=!1,Ii&&(m=Jf(n,a,s,f)),Zf(e),m}function Zf(e){O.H=Ea;var n=Je!==null&&Je.next!==null;if(Gn=0,bt=Je=Oe=null,_l=!1,ja=0,Di=null,n)throw Error(l(300));e===null||xt||(e=e.dependencies,e!==null&&Tl(e)&&(xt=!0))}function Jf(e,n,a,s){Oe=e;var f=0;do{if(Ii&&(Di=null),ja=0,Ii=!1,25<=f)throw Error(l(301));if(f+=1,bt=Je=null,e.updateQueue!=null){var m=e.updateQueue;m.lastEffect=null,m.events=null,m.stores=null,m.memoCache!=null&&(m.memoCache.index=0)}O.H=Mh,m=n(a,s)}while(Ii);return m}function Zb(){var e=O.H,n=e.useState()[0];return n=typeof n.then=="function"?Ra(n):n,e=e.useState()[0],(Je!==null?Je.memoizedState:null)!==e&&(Oe.flags|=1024),n}function eu(){var e=Ll!==0;return Ll=0,e}function tu(e,n,a){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~a}function nu(e){if(_l){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}_l=!1}Gn=0,bt=Je=Oe=null,Ii=!1,ja=Ll=0,Di=null}function Bt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return bt===null?Oe.memoizedState=bt=e:bt=bt.next=e,bt}function mt(){if(Je===null){var e=Oe.alternate;e=e!==null?e.memoizedState:null}else e=Je.next;var n=bt===null?Oe.memoizedState:bt.next;if(n!==null)bt=n,Je=e;else{if(e===null)throw Oe.alternate===null?Error(l(467)):Error(l(310));Je=e,e={memoizedState:Je.memoizedState,baseState:Je.baseState,baseQueue:Je.baseQueue,queue:Je.queue,next:null},bt===null?Oe.memoizedState=bt=e:bt=bt.next=e}return bt}function Bl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ra(e){var n=ja;return ja+=1,Di===null&&(Di=[]),e=Gf(Di,e,n),n=Oe,(bt===null?n.memoizedState:bt.next)===null&&(n=n.alternate,O.H=n===null||n.memoizedState===null?Oh:mu),e}function Hl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Ra(e);if(e.$$typeof===A)return It(e)}throw Error(l(438,String(e)))}function ru(e){var n=null,a=Oe.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var s=Oe.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(n={data:s.data.map(function(f){return f.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),a===null&&(a=Bl(),Oe.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(e),s=0;s<e;s++)a[s]=z;return n.index++,a}function $n(e,n){return typeof n=="function"?n(e):n}function Ul(e){var n=mt();return iu(n,Je,e)}function iu(e,n,a){var s=e.queue;if(s===null)throw Error(l(311));s.lastRenderedReducer=a;var f=e.baseQueue,m=s.pending;if(m!==null){if(f!==null){var b=f.next;f.next=m.next,m.next=b}n.baseQueue=f=m,s.pending=null}if(m=e.baseState,f===null)e.memoizedState=m;else{n=f.next;var j=b=null,L=null,Z=n,ae=!1;do{var ue=Z.lane&-536870913;if(ue!==Z.lane?(Ue&ue)===ue:(Gn&ue)===ue){var J=Z.revertLane;if(J===0)L!==null&&(L=L.next={lane:0,revertLane:0,gesture:null,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null}),ue===Ri&&(ae=!0);else if((Gn&J)===J){Z=Z.next,J===Ri&&(ae=!0);continue}else ue={lane:0,revertLane:Z.revertLane,gesture:null,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null},L===null?(j=L=ue,b=m):L=L.next=ue,Oe.lanes|=J,gr|=J;ue=Z.action,Pr&&a(m,ue),m=Z.hasEagerState?Z.eagerState:a(m,ue)}else J={lane:ue,revertLane:Z.revertLane,gesture:Z.gesture,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null},L===null?(j=L=J,b=m):L=L.next=J,Oe.lanes|=ue,gr|=ue;Z=Z.next}while(Z!==null&&Z!==n);if(L===null?b=m:L.next=j,!Wt(m,e.memoizedState)&&(xt=!0,ae&&(a=Ti,a!==null)))throw a;e.memoizedState=m,e.baseState=b,e.baseQueue=L,s.lastRenderedState=m}return f===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function au(e){var n=mt(),a=n.queue;if(a===null)throw Error(l(311));a.lastRenderedReducer=e;var s=a.dispatch,f=a.pending,m=n.memoizedState;if(f!==null){a.pending=null;var b=f=f.next;do m=e(m,b.action),b=b.next;while(b!==f);Wt(m,n.memoizedState)||(xt=!0),n.memoizedState=m,n.baseQueue===null&&(n.baseState=m),a.lastRenderedState=m}return[m,s]}function Wf(e,n,a){var s=Oe,f=mt(),m=Ge;if(m){if(a===void 0)throw Error(l(407));a=a()}else a=n();var b=!Wt((Je||f).memoizedState,a);if(b&&(f.memoizedState=a,xt=!0),f=f.queue,ou(nh.bind(null,s,f,e),[e]),f.getSnapshot!==n||b||bt!==null&&bt.memoizedState.tag&1){if(s.flags|=2048,Oi(9,{destroy:void 0},th.bind(null,s,f,a,n),null),tt===null)throw Error(l(349));m||(Gn&127)!==0||eh(s,n,a)}return a}function eh(e,n,a){e.flags|=16384,e={getSnapshot:n,value:a},n=Oe.updateQueue,n===null?(n=Bl(),Oe.updateQueue=n,n.stores=[e]):(a=n.stores,a===null?n.stores=[e]:a.push(e))}function th(e,n,a,s){n.value=a,n.getSnapshot=s,rh(n)&&ih(e)}function nh(e,n,a){return a(function(){rh(n)&&ih(e)})}function rh(e){var n=e.getSnapshot;e=e.value;try{var a=n();return!Wt(e,a)}catch{return!0}}function ih(e){var n=Lr(e,2);n!==null&&Yt(n,e,2)}function lu(e){var n=Bt();if(typeof e=="function"){var a=e;if(e=a(),Pr){_e(!0);try{a()}finally{_e(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:$n,lastRenderedState:e},n}function ah(e,n,a,s){return e.baseState=a,iu(e,Je,typeof s=="function"?s:$n)}function Jb(e,n,a,s,f){if($l(e))throw Error(l(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(b){m.listeners.push(b)}};O.T!==null?a(!0):m.isTransition=!1,s(m),a=n.pending,a===null?(m.next=n.pending=m,lh(n,m)):(m.next=a.next,n.pending=a.next=m)}}function lh(e,n){var a=n.action,s=n.payload,f=e.state;if(n.isTransition){var m=O.T,b={};O.T=b;try{var j=a(f,s),L=O.S;L!==null&&L(b,j),sh(e,n,j)}catch(Z){su(e,n,Z)}finally{m!==null&&b.types!==null&&(m.types=b.types),O.T=m}}else try{m=a(f,s),sh(e,n,m)}catch(Z){su(e,n,Z)}}function sh(e,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(s){oh(e,n,s)},function(s){return su(e,n,s)}):oh(e,n,a)}function oh(e,n,a){n.status="fulfilled",n.value=a,uh(n),e.state=a,n=e.pending,n!==null&&(a=n.next,a===n?e.pending=null:(a=a.next,n.next=a,lh(e,a)))}function su(e,n,a){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do n.status="rejected",n.reason=a,uh(n),n=n.next;while(n!==s)}e.action=null}function uh(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function ch(e,n){return n}function dh(e,n){if(Ge){var a=tt.formState;if(a!==null){e:{var s=Oe;if(Ge){if(it){t:{for(var f=it,m=pn;f.nodeType!==8;){if(!m){f=null;break t}if(f=yn(f.nextSibling),f===null){f=null;break t}}m=f.data,f=m==="F!"||m==="F"?f:null}if(f){it=yn(f.nextSibling),s=f.data==="F!";break e}}sr(s)}s=!1}s&&(n=a[0])}}return a=Bt(),a.memoizedState=a.baseState=n,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ch,lastRenderedState:n},a.queue=s,a=Ah.bind(null,Oe,s),s.dispatch=a,s=lu(!1),m=hu.bind(null,Oe,!1,s.queue),s=Bt(),f={state:n,dispatch:null,action:e,pending:null},s.queue=f,a=Jb.bind(null,Oe,f,m,a),f.dispatch=a,s.memoizedState=e,[n,a,!1]}function fh(e){var n=mt();return hh(n,Je,e)}function hh(e,n,a){if(n=iu(e,n,ch)[0],e=Ul($n)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var s=Ra(n)}catch(b){throw b===Ei?Al:b}else s=n;n=mt();var f=n.queue,m=f.dispatch;return a!==n.memoizedState&&(Oe.flags|=2048,Oi(9,{destroy:void 0},Wb.bind(null,f,a),null)),[s,m,e]}function Wb(e,n){e.action=n}function mh(e){var n=mt(),a=Je;if(a!==null)return hh(n,a,e);mt(),n=n.memoizedState,a=mt();var s=a.queue.dispatch;return a.memoizedState=e,[n,s,!1]}function Oi(e,n,a,s){return e={tag:e,create:a,deps:s,inst:n,next:null},n=Oe.updateQueue,n===null&&(n=Bl(),Oe.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=e.next=e:(s=a.next,a.next=e,e.next=s,n.lastEffect=e),e}function ph(){return mt().memoizedState}function ql(e,n,a,s){var f=Bt();Oe.flags|=e,f.memoizedState=Oi(1|n,{destroy:void 0},a,s===void 0?null:s)}function Gl(e,n,a,s){var f=mt();s=s===void 0?null:s;var m=f.memoizedState.inst;Je!==null&&s!==null&&Jo(s,Je.memoizedState.deps)?f.memoizedState=Oi(n,m,a,s):(Oe.flags|=e,f.memoizedState=Oi(1|n,m,a,s))}function gh(e,n){ql(8390656,8,e,n)}function ou(e,n){Gl(2048,8,e,n)}function ex(e){Oe.flags|=4;var n=Oe.updateQueue;if(n===null)n=Bl(),Oe.updateQueue=n,n.events=[e];else{var a=n.events;a===null?n.events=[e]:a.push(e)}}function yh(e){var n=mt().memoizedState;return ex({ref:n,nextImpl:e}),function(){if((Pe&2)!==0)throw Error(l(440));return n.impl.apply(void 0,arguments)}}function vh(e,n){return Gl(4,2,e,n)}function bh(e,n){return Gl(4,4,e,n)}function xh(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 Sh(e,n,a){a=a!=null?a.concat([e]):null,Gl(4,4,xh.bind(null,n,e),a)}function uu(){}function kh(e,n){var a=mt();n=n===void 0?null:n;var s=a.memoizedState;return n!==null&&Jo(n,s[1])?s[0]:(a.memoizedState=[e,n],e)}function wh(e,n){var a=mt();n=n===void 0?null:n;var s=a.memoizedState;if(n!==null&&Jo(n,s[1]))return s[0];if(s=e(),Pr){_e(!0);try{e()}finally{_e(!1)}}return a.memoizedState=[s,n],s}function cu(e,n,a){return a===void 0||(Gn&1073741824)!==0&&(Ue&261930)===0?e.memoizedState=n:(e.memoizedState=a,e=Cm(),Oe.lanes|=e,gr|=e,a)}function Ch(e,n,a,s){return Wt(a,n)?a:Ai.current!==null?(e=cu(e,a,s),Wt(e,n)||(xt=!0),e):(Gn&42)===0||(Gn&1073741824)!==0&&(Ue&261930)===0?(xt=!0,e.memoizedState=a):(e=Cm(),Oe.lanes|=e,gr|=e,n)}function jh(e,n,a,s,f){var m=U.p;U.p=m!==0&&8>m?m:8;var b=O.T,j={};O.T=j,hu(e,!1,n,a);try{var L=f(),Z=O.S;if(Z!==null&&Z(j,L),L!==null&&typeof L=="object"&&typeof L.then=="function"){var ae=Xb(L,s);Ta(e,n,ae,ln(e))}else Ta(e,n,s,ln(e))}catch(ue){Ta(e,n,{then:function(){},status:"rejected",reason:ue},ln())}finally{U.p=m,b!==null&&j.types!==null&&(b.types=j.types),O.T=b}}function tx(){}function du(e,n,a,s){if(e.tag!==5)throw Error(l(476));var f=Rh(e).queue;jh(e,f,n,_,a===null?tx:function(){return Th(e),a(s)})}function Rh(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:_,baseState:_,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:$n,lastRenderedState:_},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:$n,lastRenderedState:a},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function Th(e){var n=Rh(e);n.next===null&&(n=e.alternate.memoizedState),Ta(e,n.next.queue,{},ln())}function fu(){return It(Fa)}function Eh(){return mt().memoizedState}function Nh(){return mt().memoizedState}function nx(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var a=ln();e=cr(a);var s=dr(n,e,a);s!==null&&(Yt(s,n,a),ka(s,n,a)),n={cache:qo()},e.payload=n;return}n=n.return}}function rx(e,n,a){var s=ln();a={lane:s,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},$l(e)?Ih(n,a):(a=Ao(e,n,a,s),a!==null&&(Yt(a,e,s),Dh(a,n,s)))}function Ah(e,n,a){var s=ln();Ta(e,n,a,s)}function Ta(e,n,a,s){var f={lane:s,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if($l(e))Ih(n,f);else{var m=e.alternate;if(e.lanes===0&&(m===null||m.lanes===0)&&(m=n.lastRenderedReducer,m!==null))try{var b=n.lastRenderedState,j=m(b,a);if(f.hasEagerState=!0,f.eagerState=j,Wt(j,b))return wl(e,n,f,0),tt===null&&kl(),!1}catch{}if(a=Ao(e,n,f,s),a!==null)return Yt(a,e,s),Dh(a,n,s),!0}return!1}function hu(e,n,a,s){if(s={lane:2,revertLane:Vu(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},$l(e)){if(n)throw Error(l(479))}else n=Ao(e,a,s,2),n!==null&&Yt(n,e,2)}function $l(e){var n=e.alternate;return e===Oe||n!==null&&n===Oe}function Ih(e,n){Ii=_l=!0;var a=e.pending;a===null?n.next=n:(n.next=a.next,a.next=n),e.pending=n}function Dh(e,n,a){if((a&4194048)!==0){var s=n.lanes;s&=e.pendingLanes,a|=s,n.lanes=a,_d(e,a)}}var Ea={readContext:It,use:Hl,useCallback:ct,useContext:ct,useEffect:ct,useImperativeHandle:ct,useLayoutEffect:ct,useInsertionEffect:ct,useMemo:ct,useReducer:ct,useRef:ct,useState:ct,useDebugValue:ct,useDeferredValue:ct,useTransition:ct,useSyncExternalStore:ct,useId:ct,useHostTransitionStatus:ct,useFormState:ct,useActionState:ct,useOptimistic:ct,useMemoCache:ct,useCacheRefresh:ct};Ea.useEffectEvent=ct;var Oh={readContext:It,use:Hl,useCallback:function(e,n){return Bt().memoizedState=[e,n===void 0?null:n],e},useContext:It,useEffect:gh,useImperativeHandle:function(e,n,a){a=a!=null?a.concat([e]):null,ql(4194308,4,xh.bind(null,n,e),a)},useLayoutEffect:function(e,n){return ql(4194308,4,e,n)},useInsertionEffect:function(e,n){ql(4,2,e,n)},useMemo:function(e,n){var a=Bt();n=n===void 0?null:n;var s=e();if(Pr){_e(!0);try{e()}finally{_e(!1)}}return a.memoizedState=[s,n],s},useReducer:function(e,n,a){var s=Bt();if(a!==void 0){var f=a(n);if(Pr){_e(!0);try{a(n)}finally{_e(!1)}}}else f=n;return s.memoizedState=s.baseState=f,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:f},s.queue=e,e=e.dispatch=rx.bind(null,Oe,e),[s.memoizedState,e]},useRef:function(e){var n=Bt();return e={current:e},n.memoizedState=e},useState:function(e){e=lu(e);var n=e.queue,a=Ah.bind(null,Oe,n);return n.dispatch=a,[e.memoizedState,a]},useDebugValue:uu,useDeferredValue:function(e,n){var a=Bt();return cu(a,e,n)},useTransition:function(){var e=lu(!1);return e=jh.bind(null,Oe,e.queue,!0,!1),Bt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,a){var s=Oe,f=Bt();if(Ge){if(a===void 0)throw Error(l(407));a=a()}else{if(a=n(),tt===null)throw Error(l(349));(Ue&127)!==0||eh(s,n,a)}f.memoizedState=a;var m={value:a,getSnapshot:n};return f.queue=m,gh(nh.bind(null,s,m,e),[e]),s.flags|=2048,Oi(9,{destroy:void 0},th.bind(null,s,m,a,n),null),a},useId:function(){var e=Bt(),n=tt.identifierPrefix;if(Ge){var a=En,s=Tn;a=(s&~(1<<32-Ie(s)-1)).toString(32)+a,n="_"+n+"R_"+a,a=Ll++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=Qb++,n="_"+n+"r_"+a.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:fu,useFormState:dh,useActionState:dh,useOptimistic:function(e){var n=Bt();n.memoizedState=n.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=hu.bind(null,Oe,!0,a),a.dispatch=n,[e,n]},useMemoCache:ru,useCacheRefresh:function(){return Bt().memoizedState=nx.bind(null,Oe)},useEffectEvent:function(e){var n=Bt(),a={impl:e};return n.memoizedState=a,function(){if((Pe&2)!==0)throw Error(l(440));return a.impl.apply(void 0,arguments)}}},mu={readContext:It,use:Hl,useCallback:kh,useContext:It,useEffect:ou,useImperativeHandle:Sh,useInsertionEffect:vh,useLayoutEffect:bh,useMemo:wh,useReducer:Ul,useRef:ph,useState:function(){return Ul($n)},useDebugValue:uu,useDeferredValue:function(e,n){var a=mt();return Ch(a,Je.memoizedState,e,n)},useTransition:function(){var e=Ul($n)[0],n=mt().memoizedState;return[typeof e=="boolean"?e:Ra(e),n]},useSyncExternalStore:Wf,useId:Eh,useHostTransitionStatus:fu,useFormState:fh,useActionState:fh,useOptimistic:function(e,n){var a=mt();return ah(a,Je,e,n)},useMemoCache:ru,useCacheRefresh:Nh};mu.useEffectEvent=yh;var Mh={readContext:It,use:Hl,useCallback:kh,useContext:It,useEffect:ou,useImperativeHandle:Sh,useInsertionEffect:vh,useLayoutEffect:bh,useMemo:wh,useReducer:au,useRef:ph,useState:function(){return au($n)},useDebugValue:uu,useDeferredValue:function(e,n){var a=mt();return Je===null?cu(a,e,n):Ch(a,Je.memoizedState,e,n)},useTransition:function(){var e=au($n)[0],n=mt().memoizedState;return[typeof e=="boolean"?e:Ra(e),n]},useSyncExternalStore:Wf,useId:Eh,useHostTransitionStatus:fu,useFormState:mh,useActionState:mh,useOptimistic:function(e,n){var a=mt();return Je!==null?ah(a,Je,e,n):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:ru,useCacheRefresh:Nh};Mh.useEffectEvent=yh;function pu(e,n,a,s){n=e.memoizedState,a=a(s,n),a=a==null?n:y({},n,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var gu={enqueueSetState:function(e,n,a){e=e._reactInternals;var s=ln(),f=cr(s);f.payload=n,a!=null&&(f.callback=a),n=dr(e,f,s),n!==null&&(Yt(n,e,s),ka(n,e,s))},enqueueReplaceState:function(e,n,a){e=e._reactInternals;var s=ln(),f=cr(s);f.tag=1,f.payload=n,a!=null&&(f.callback=a),n=dr(e,f,s),n!==null&&(Yt(n,e,s),ka(n,e,s))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var a=ln(),s=cr(a);s.tag=2,n!=null&&(s.callback=n),n=dr(e,s,a),n!==null&&(Yt(n,e,a),ka(n,e,a))}};function zh(e,n,a,s,f,m,b){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,m,b):n.prototype&&n.prototype.isPureReactComponent?!ma(a,s)||!ma(f,m):!0}function _h(e,n,a,s){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,s),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,s),n.state!==e&&gu.enqueueReplaceState(n,n.state,null)}function Yr(e,n){var a=n;if("ref"in n){a={};for(var s in n)s!=="ref"&&(a[s]=n[s])}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 Lh(e){Sl(e)}function Bh(e){console.error(e)}function Hh(e){Sl(e)}function Fl(e,n){try{var a=e.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(s){setTimeout(function(){throw s})}}function Uh(e,n,a){try{var s=e.onCaughtError;s(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function yu(e,n,a){return a=cr(a),a.tag=3,a.payload={element:null},a.callback=function(){Fl(e,n)},a}function qh(e){return e=cr(e),e.tag=3,e}function Gh(e,n,a,s){var f=a.type.getDerivedStateFromError;if(typeof f=="function"){var m=s.value;e.payload=function(){return f(m)},e.callback=function(){Uh(n,a,s)}}var b=a.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(e.callback=function(){Uh(n,a,s),typeof f!="function"&&(yr===null?yr=new Set([this]):yr.add(this));var j=s.stack;this.componentDidCatch(s.value,{componentStack:j!==null?j:""})})}function ix(e,n,a,s,f){if(a.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(n=a.alternate,n!==null&&ji(n,a,f,!0),a=tn.current,a!==null){switch(a.tag){case 31:case 13:return gn===null?ns():a.alternate===null&&dt===0&&(dt=3),a.flags&=-257,a.flags|=65536,a.lanes=f,s===Il?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([s]):n.add(s),Gu(e,s,f)),!1;case 22:return a.flags|=65536,s===Il?a.flags|=16384:(n=a.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([s])},a.updateQueue=n):(a=n.retryQueue,a===null?n.retryQueue=new Set([s]):a.add(s)),Gu(e,s,f)),!1}throw Error(l(435,a.tag))}return Gu(e,s,f),ns(),!1}if(Ge)return n=tn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=f,s!==_o&&(e=Error(l(422),{cause:s}),ya(fn(e,a)))):(s!==_o&&(n=Error(l(423),{cause:s}),ya(fn(n,a))),e=e.current.alternate,e.flags|=65536,f&=-f,e.lanes|=f,s=fn(s,a),f=yu(e.stateNode,s,f),Yo(e,f),dt!==4&&(dt=2)),!1;var m=Error(l(520),{cause:s});if(m=fn(m,a),_a===null?_a=[m]:_a.push(m),dt!==4&&(dt=2),n===null)return!0;s=fn(s,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,e=f&-f,a.lanes|=e,e=yu(a.stateNode,s,e),Yo(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"&&(yr===null||!yr.has(m))))return a.flags|=65536,f&=-f,a.lanes|=f,f=qh(f),Gh(f,e,a,s),Yo(a,f),!1}a=a.return}while(a!==null);return!1}var vu=Error(l(461)),xt=!1;function Dt(e,n,a,s){n.child=e===null?Pf(n,null,a,s):Vr(n,e.child,a,s)}function $h(e,n,a,s,f){a=a.render;var m=n.ref;if("ref"in s){var b={};for(var j in s)j!=="ref"&&(b[j]=s[j])}else b=s;return qr(n),s=Wo(e,n,a,b,m,f),j=eu(),e!==null&&!xt?(tu(e,n,f),Fn(e,n,f)):(Ge&&j&&Mo(n),n.flags|=1,Dt(e,n,s,f),n.child)}function Fh(e,n,a,s,f){if(e===null){var m=a.type;return typeof m=="function"&&!Io(m)&&m.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=m,Vh(e,n,m,s,f)):(e=jl(a.type,null,s,n,n.mode,f),e.ref=n.ref,e.return=n,n.child=e)}if(m=e.child,!Ru(e,f)){var b=m.memoizedProps;if(a=a.compare,a=a!==null?a:ma,a(b,s)&&e.ref===n.ref)return Fn(e,n,f)}return n.flags|=1,e=Bn(m,s),e.ref=n.ref,e.return=n,n.child=e}function Vh(e,n,a,s,f){if(e!==null){var m=e.memoizedProps;if(ma(m,s)&&e.ref===n.ref)if(xt=!1,n.pendingProps=s=m,Ru(e,f))(e.flags&131072)!==0&&(xt=!0);else return n.lanes=e.lanes,Fn(e,n,f)}return bu(e,n,a,s,f)}function Ph(e,n,a,s){var f=s.children,m=e!==null?e.memoizedState:null;if(e===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.mode==="hidden"){if((n.flags&128)!==0){if(m=m!==null?m.baseLanes|a:a,e!==null){for(s=n.child=e.child,f=0;s!==null;)f=f|s.lanes|s.childLanes,s=s.sibling;s=f&~m}else s=0,n.child=null;return Yh(e,n,m,a,s)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&Nl(n,m!==null?m.cachePool:null),m!==null?Xf(n,m):Xo(),Qf(n);else return s=n.lanes=536870912,Yh(e,n,m!==null?m.baseLanes|a:a,a,s)}else m!==null?(Nl(n,m.cachePool),Xf(n,m),hr(),n.memoizedState=null):(e!==null&&Nl(n,null),Xo(),hr());return Dt(e,n,f,a),n.child}function Na(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function Yh(e,n,a,s,f){var m=$o();return m=m===null?null:{parent:vt._currentValue,pool:m},n.memoizedState={baseLanes:a,cachePool:m},e!==null&&Nl(n,null),Xo(),Qf(n),e!==null&&ji(e,n,s,!0),n.childLanes=f,null}function Vl(e,n){return n=Yl({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function Kh(e,n,a){return Vr(n,e.child,null,a),e=Vl(n,n.pendingProps),e.flags|=2,nn(n),n.memoizedState=null,e}function ax(e,n,a){var s=n.pendingProps,f=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(Ge){if(s.mode==="hidden")return e=Vl(n,s),n.lanes=536870912,Na(null,e);if(Zo(n),(e=it)?(e=lp(e,pn),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:ar!==null?{id:Tn,overflow:En}:null,retryLane:536870912,hydrationErrors:null},a=If(e),a.return=n,n.child=a,At=n,it=null)):e=null,e===null)throw sr(n);return n.lanes=536870912,null}return Vl(n,s)}var m=e.memoizedState;if(m!==null){var b=m.dehydrated;if(Zo(n),f)if(n.flags&256)n.flags&=-257,n=Kh(e,n,a);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(l(558));else if(xt||ji(e,n,a,!1),f=(a&e.childLanes)!==0,xt||f){if(s=tt,s!==null&&(b=Ld(s,a),b!==0&&b!==m.retryLane))throw m.retryLane=b,Lr(e,b),Yt(s,e,b),vu;ns(),n=Kh(e,n,a)}else e=m.treeContext,it=yn(b.nextSibling),At=n,Ge=!0,lr=null,pn=!1,e!==null&&Mf(n,e),n=Vl(n,s),n.flags|=4096;return n}return e=Bn(e.child,{mode:s.mode,children:s.children}),e.ref=n.ref,n.child=e,e.return=n,e}function Pl(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(l(284));(e===null||e.ref!==a)&&(n.flags|=4194816)}}function bu(e,n,a,s,f){return qr(n),a=Wo(e,n,a,s,void 0,f),s=eu(),e!==null&&!xt?(tu(e,n,f),Fn(e,n,f)):(Ge&&s&&Mo(n),n.flags|=1,Dt(e,n,a,f),n.child)}function Xh(e,n,a,s,f,m){return qr(n),n.updateQueue=null,a=Jf(n,s,a,f),Zf(e),s=eu(),e!==null&&!xt?(tu(e,n,m),Fn(e,n,m)):(Ge&&s&&Mo(n),n.flags|=1,Dt(e,n,a,m),n.child)}function Qh(e,n,a,s,f){if(qr(n),n.stateNode===null){var m=Si,b=a.contextType;typeof b=="object"&&b!==null&&(m=It(b)),m=new a(s,m),n.memoizedState=m.state!==null&&m.state!==void 0?m.state:null,m.updater=gu,n.stateNode=m,m._reactInternals=n,m=n.stateNode,m.props=s,m.state=n.memoizedState,m.refs={},Vo(n),b=a.contextType,m.context=typeof b=="object"&&b!==null?It(b):Si,m.state=n.memoizedState,b=a.getDerivedStateFromProps,typeof b=="function"&&(pu(n,a,b,s),m.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof m.getSnapshotBeforeUpdate=="function"||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(b=m.state,typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount(),b!==m.state&&gu.enqueueReplaceState(m,m.state,null),Ca(n,s,m,f),wa(),m.state=n.memoizedState),typeof m.componentDidMount=="function"&&(n.flags|=4194308),s=!0}else if(e===null){m=n.stateNode;var j=n.memoizedProps,L=Yr(a,j);m.props=L;var Z=m.context,ae=a.contextType;b=Si,typeof ae=="object"&&ae!==null&&(b=It(ae));var ue=a.getDerivedStateFromProps;ae=typeof ue=="function"||typeof m.getSnapshotBeforeUpdate=="function",j=n.pendingProps!==j,ae||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(j||Z!==b)&&_h(n,m,s,b),ur=!1;var J=n.memoizedState;m.state=J,Ca(n,s,m,f),wa(),Z=n.memoizedState,j||J!==Z||ur?(typeof ue=="function"&&(pu(n,a,ue,s),Z=n.memoizedState),(L=ur||zh(n,a,L,s,J,Z,b))?(ae||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=s,n.memoizedState=Z),m.props=s,m.state=Z,m.context=b,s=L):(typeof m.componentDidMount=="function"&&(n.flags|=4194308),s=!1)}else{m=n.stateNode,Po(e,n),b=n.memoizedProps,ae=Yr(a,b),m.props=ae,ue=n.pendingProps,J=m.context,Z=a.contextType,L=Si,typeof Z=="object"&&Z!==null&&(L=It(Z)),j=a.getDerivedStateFromProps,(Z=typeof j=="function"||typeof m.getSnapshotBeforeUpdate=="function")||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(b!==ue||J!==L)&&_h(n,m,s,L),ur=!1,J=n.memoizedState,m.state=J,Ca(n,s,m,f),wa();var ne=n.memoizedState;b!==ue||J!==ne||ur||e!==null&&e.dependencies!==null&&Tl(e.dependencies)?(typeof j=="function"&&(pu(n,a,j,s),ne=n.memoizedState),(ae=ur||zh(n,a,ae,s,J,ne,L)||e!==null&&e.dependencies!==null&&Tl(e.dependencies))?(Z||typeof m.UNSAFE_componentWillUpdate!="function"&&typeof m.componentWillUpdate!="function"||(typeof m.componentWillUpdate=="function"&&m.componentWillUpdate(s,ne,L),typeof m.UNSAFE_componentWillUpdate=="function"&&m.UNSAFE_componentWillUpdate(s,ne,L)),typeof m.componentDidUpdate=="function"&&(n.flags|=4),typeof m.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof m.componentDidUpdate!="function"||b===e.memoizedProps&&J===e.memoizedState||(n.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&J===e.memoizedState||(n.flags|=1024),n.memoizedProps=s,n.memoizedState=ne),m.props=s,m.state=ne,m.context=L,s=ae):(typeof m.componentDidUpdate!="function"||b===e.memoizedProps&&J===e.memoizedState||(n.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&J===e.memoizedState||(n.flags|=1024),s=!1)}return m=s,Pl(e,n),s=(n.flags&128)!==0,m||s?(m=n.stateNode,a=s&&typeof a.getDerivedStateFromError!="function"?null:m.render(),n.flags|=1,e!==null&&s?(n.child=Vr(n,e.child,null,f),n.child=Vr(n,null,a,f)):Dt(e,n,a,f),n.memoizedState=m.state,e=n.child):e=Fn(e,n,f),e}function Zh(e,n,a,s){return Hr(),n.flags|=256,Dt(e,n,a,s),n.child}var xu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Su(e){return{baseLanes:e,cachePool:Uf()}}function ku(e,n,a){return e=e!==null?e.childLanes&~a:0,n&&(e|=an),e}function Jh(e,n,a){var s=n.pendingProps,f=!1,m=(n.flags&128)!==0,b;if((b=m)||(b=e!==null&&e.memoizedState===null?!1:(ht.current&2)!==0),b&&(f=!0,n.flags&=-129),b=(n.flags&32)!==0,n.flags&=-33,e===null){if(Ge){if(f?fr(n):hr(),(e=it)?(e=lp(e,pn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:ar!==null?{id:Tn,overflow:En}:null,retryLane:536870912,hydrationErrors:null},a=If(e),a.return=n,n.child=a,At=n,it=null)):e=null,e===null)throw sr(n);return ic(e)?n.lanes=32:n.lanes=536870912,null}var j=s.children;return s=s.fallback,f?(hr(),f=n.mode,j=Yl({mode:"hidden",children:j},f),s=Br(s,f,a,null),j.return=n,s.return=n,j.sibling=s,n.child=j,s=n.child,s.memoizedState=Su(a),s.childLanes=ku(e,b,a),n.memoizedState=xu,Na(null,s)):(fr(n),wu(n,j))}var L=e.memoizedState;if(L!==null&&(j=L.dehydrated,j!==null)){if(m)n.flags&256?(fr(n),n.flags&=-257,n=Cu(e,n,a)):n.memoizedState!==null?(hr(),n.child=e.child,n.flags|=128,n=null):(hr(),j=s.fallback,f=n.mode,s=Yl({mode:"visible",children:s.children},f),j=Br(j,f,a,null),j.flags|=2,s.return=n,j.return=n,s.sibling=j,n.child=s,Vr(n,e.child,null,a),s=n.child,s.memoizedState=Su(a),s.childLanes=ku(e,b,a),n.memoizedState=xu,n=Na(null,s));else if(fr(n),ic(j)){if(b=j.nextSibling&&j.nextSibling.dataset,b)var Z=b.dgst;b=Z,s=Error(l(419)),s.stack="",s.digest=b,ya({value:s,source:null,stack:null}),n=Cu(e,n,a)}else if(xt||ji(e,n,a,!1),b=(a&e.childLanes)!==0,xt||b){if(b=tt,b!==null&&(s=Ld(b,a),s!==0&&s!==L.retryLane))throw L.retryLane=s,Lr(e,s),Yt(b,e,s),vu;rc(j)||ns(),n=Cu(e,n,a)}else rc(j)?(n.flags|=192,n.child=e.child,n=null):(e=L.treeContext,it=yn(j.nextSibling),At=n,Ge=!0,lr=null,pn=!1,e!==null&&Mf(n,e),n=wu(n,s.children),n.flags|=4096);return n}return f?(hr(),j=s.fallback,f=n.mode,L=e.child,Z=L.sibling,s=Bn(L,{mode:"hidden",children:s.children}),s.subtreeFlags=L.subtreeFlags&65011712,Z!==null?j=Bn(Z,j):(j=Br(j,f,a,null),j.flags|=2),j.return=n,s.return=n,s.sibling=j,n.child=s,Na(null,s),s=n.child,j=e.child.memoizedState,j===null?j=Su(a):(f=j.cachePool,f!==null?(L=vt._currentValue,f=f.parent!==L?{parent:L,pool:L}:f):f=Uf(),j={baseLanes:j.baseLanes|a,cachePool:f}),s.memoizedState=j,s.childLanes=ku(e,b,a),n.memoizedState=xu,Na(e.child,s)):(fr(n),a=e.child,e=a.sibling,a=Bn(a,{mode:"visible",children:s.children}),a.return=n,a.sibling=null,e!==null&&(b=n.deletions,b===null?(n.deletions=[e],n.flags|=16):b.push(e)),n.child=a,n.memoizedState=null,a)}function wu(e,n){return n=Yl({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function Yl(e,n){return e=en(22,e,null,n),e.lanes=0,e}function Cu(e,n,a){return Vr(n,e.child,null,a),e=wu(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function Wh(e,n,a){e.lanes|=n;var s=e.alternate;s!==null&&(s.lanes|=n),Ho(e.return,n,a)}function ju(e,n,a,s,f,m){var b=e.memoizedState;b===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:s,tail:a,tailMode:f,treeForkCount:m}:(b.isBackwards=n,b.rendering=null,b.renderingStartTime=0,b.last=s,b.tail=a,b.tailMode=f,b.treeForkCount=m)}function em(e,n,a){var s=n.pendingProps,f=s.revealOrder,m=s.tail;s=s.children;var b=ht.current,j=(b&2)!==0;if(j?(b=b&1|2,n.flags|=128):b&=1,C(ht,b),Dt(e,n,s,a),s=Ge?ga:0,!j&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Wh(e,a,n);else if(e.tag===19)Wh(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&&zl(e)===null&&(f=a),a=a.sibling;a=f,a===null?(f=n.child,n.child=null):(f=a.sibling,a.sibling=null),ju(n,!1,f,a,m,s);break;case"backwards":case"unstable_legacy-backwards":for(a=null,f=n.child,n.child=null;f!==null;){if(e=f.alternate,e!==null&&zl(e)===null){n.child=f;break}e=f.sibling,f.sibling=a,a=f,f=e}ju(n,!0,a,null,m,s);break;case"together":ju(n,!1,null,null,void 0,s);break;default:n.memoizedState=null}return n.child}function Fn(e,n,a){if(e!==null&&(n.dependencies=e.dependencies),gr|=n.lanes,(a&n.childLanes)===0)if(e!==null){if(ji(e,n,a,!1),(a&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(l(153));if(n.child!==null){for(e=n.child,a=Bn(e,e.pendingProps),n.child=a,a.return=n;e.sibling!==null;)e=e.sibling,a=a.sibling=Bn(e,e.pendingProps),a.return=n;a.sibling=null}return n.child}function Ru(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&Tl(e)))}function lx(e,n,a){switch(n.tag){case 3:he(n,n.stateNode.containerInfo),or(n,vt,e.memoizedState.cache),Hr();break;case 27:case 5:ye(n);break;case 4:he(n,n.stateNode.containerInfo);break;case 10:or(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Zo(n),null;break;case 13:var s=n.memoizedState;if(s!==null)return s.dehydrated!==null?(fr(n),n.flags|=128,null):(a&n.child.childLanes)!==0?Jh(e,n,a):(fr(n),e=Fn(e,n,a),e!==null?e.sibling:null);fr(n);break;case 19:var f=(e.flags&128)!==0;if(s=(a&n.childLanes)!==0,s||(ji(e,n,a,!1),s=(a&n.childLanes)!==0),f){if(s)return em(e,n,a);n.flags|=128}if(f=n.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),C(ht,ht.current),s)break;return null;case 22:return n.lanes=0,Ph(e,n,a,n.pendingProps);case 24:or(n,vt,e.memoizedState.cache)}return Fn(e,n,a)}function tm(e,n,a){if(e!==null)if(e.memoizedProps!==n.pendingProps)xt=!0;else{if(!Ru(e,a)&&(n.flags&128)===0)return xt=!1,lx(e,n,a);xt=(e.flags&131072)!==0}else xt=!1,Ge&&(n.flags&1048576)!==0&&Of(n,ga,n.index);switch(n.lanes=0,n.tag){case 16:e:{var s=n.pendingProps;if(e=$r(n.elementType),n.type=e,typeof e=="function")Io(e)?(s=Yr(e,s),n.tag=1,n=Qh(null,n,e,s,a)):(n.tag=0,n=bu(null,n,e,s,a));else{if(e!=null){var f=e.$$typeof;if(f===G){n.tag=11,n=$h(null,n,e,s,a);break e}else if(f===$){n.tag=14,n=Fh(null,n,e,s,a);break e}}throw n=X(e)||e,Error(l(306,n,""))}}return n;case 0:return bu(e,n,n.type,n.pendingProps,a);case 1:return s=n.type,f=Yr(s,n.pendingProps),Qh(e,n,s,f,a);case 3:e:{if(he(n,n.stateNode.containerInfo),e===null)throw Error(l(387));s=n.pendingProps;var m=n.memoizedState;f=m.element,Po(e,n),Ca(n,s,null,a);var b=n.memoizedState;if(s=b.cache,or(n,vt,s),s!==m.cache&&Uo(n,[vt],a,!0),wa(),s=b.element,m.isDehydrated)if(m={element:s,isDehydrated:!1,cache:b.cache},n.updateQueue.baseState=m,n.memoizedState=m,n.flags&256){n=Zh(e,n,s,a);break e}else if(s!==f){f=fn(Error(l(424)),n),ya(f),n=Zh(e,n,s,a);break e}else for(e=n.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,it=yn(e.firstChild),At=n,Ge=!0,lr=null,pn=!0,a=Pf(n,null,s,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(Hr(),s===f){n=Fn(e,n,a);break e}Dt(e,n,s,a)}n=n.child}return n;case 26:return Pl(e,n),e===null?(a=fp(n.type,null,n.pendingProps,null))?n.memoizedState=a:Ge||(a=n.type,e=n.pendingProps,s=us(Y.current).createElement(a),s[Nt]=n,s[qt]=e,Ot(s,a,e),jt(s),n.stateNode=s):n.memoizedState=fp(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return ye(n),e===null&&Ge&&(s=n.stateNode=up(n.type,n.pendingProps,Y.current),At=n,pn=!0,f=it,Sr(n.type)?(ac=f,it=yn(s.firstChild)):it=f),Dt(e,n,n.pendingProps.children,a),Pl(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&Ge&&((f=s=it)&&(s=_x(s,n.type,n.pendingProps,pn),s!==null?(n.stateNode=s,At=n,it=yn(s.firstChild),pn=!1,f=!0):f=!1),f||sr(n)),ye(n),f=n.type,m=n.pendingProps,b=e!==null?e.memoizedProps:null,s=m.children,ec(f,m)?s=null:b!==null&&ec(f,b)&&(n.flags|=32),n.memoizedState!==null&&(f=Wo(e,n,Zb,null,null,a),Fa._currentValue=f),Pl(e,n),Dt(e,n,s,a),n.child;case 6:return e===null&&Ge&&((e=a=it)&&(a=Lx(a,n.pendingProps,pn),a!==null?(n.stateNode=a,At=n,it=null,e=!0):e=!1),e||sr(n)),null;case 13:return Jh(e,n,a);case 4:return he(n,n.stateNode.containerInfo),s=n.pendingProps,e===null?n.child=Vr(n,null,s,a):Dt(e,n,s,a),n.child;case 11:return $h(e,n,n.type,n.pendingProps,a);case 7:return Dt(e,n,n.pendingProps,a),n.child;case 8:return Dt(e,n,n.pendingProps.children,a),n.child;case 12:return Dt(e,n,n.pendingProps.children,a),n.child;case 10:return s=n.pendingProps,or(n,n.type,s.value),Dt(e,n,s.children,a),n.child;case 9:return f=n.type._context,s=n.pendingProps.children,qr(n),f=It(f),s=s(f),n.flags|=1,Dt(e,n,s,a),n.child;case 14:return Fh(e,n,n.type,n.pendingProps,a);case 15:return Vh(e,n,n.type,n.pendingProps,a);case 19:return em(e,n,a);case 31:return ax(e,n,a);case 22:return Ph(e,n,a,n.pendingProps);case 24:return qr(n),s=It(vt),e===null?(f=$o(),f===null&&(f=tt,m=qo(),f.pooledCache=m,m.refCount++,m!==null&&(f.pooledCacheLanes|=a),f=m),n.memoizedState={parent:s,cache:f},Vo(n),or(n,vt,f)):((e.lanes&a)!==0&&(Po(e,n),Ca(n,null,null,a),wa()),f=e.memoizedState,m=n.memoizedState,f.parent!==s?(f={parent:s,cache:s},n.memoizedState=f,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=f),or(n,vt,s)):(s=m.cache,or(n,vt,s),s!==f.cache&&Uo(n,[vt],a,!0))),Dt(e,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(l(156,n.tag))}function Vn(e){e.flags|=4}function Tu(e,n,a,s,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(Em())e.flags|=8192;else throw Fr=Il,Fo}else e.flags&=-16777217}function nm(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!yp(n))if(Em())e.flags|=8192;else throw Fr=Il,Fo}function Kl(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?Md():536870912,e.lanes|=n,Li|=n)}function Aa(e,n){if(!Ge)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 s=null;a!==null;)a.alternate!==null&&(s=a),a=a.sibling;s===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function at(e){var n=e.alternate!==null&&e.alternate.child===e.child,a=0,s=0;if(n)for(var f=e.child;f!==null;)a|=f.lanes|f.childLanes,s|=f.subtreeFlags&65011712,s|=f.flags&65011712,f.return=e,f=f.sibling;else for(f=e.child;f!==null;)a|=f.lanes|f.childLanes,s|=f.subtreeFlags,s|=f.flags,f.return=e,f=f.sibling;return e.subtreeFlags|=s,e.childLanes=a,n}function sx(e,n,a){var s=n.pendingProps;switch(zo(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return at(n),null;case 1:return at(n),null;case 3:return a=n.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),n.memoizedState.cache!==s&&(n.flags|=2048),qn(vt),pe(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Ci(n)?Vn(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Lo())),at(n),null;case 26:var f=n.type,m=n.memoizedState;return e===null?(Vn(n),m!==null?(at(n),nm(n,m)):(at(n),Tu(n,f,null,s,a))):m?m!==e.memoizedState?(Vn(n),at(n),nm(n,m)):(at(n),n.flags&=-16777217):(e=e.memoizedProps,e!==s&&Vn(n),at(n),Tu(n,f,e,s,a)),null;case 27:if(je(n),a=Y.current,f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==s&&Vn(n);else{if(!s){if(n.stateNode===null)throw Error(l(166));return at(n),null}e=ie.current,Ci(n)?zf(n):(e=up(f,s,a),n.stateNode=e,Vn(n))}return at(n),null;case 5:if(je(n),f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==s&&Vn(n);else{if(!s){if(n.stateNode===null)throw Error(l(166));return at(n),null}if(m=ie.current,Ci(n))zf(n);else{var b=us(Y.current);switch(m){case 1:m=b.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:m=b.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":m=b.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":m=b.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":m=b.createElement("div"),m.innerHTML="<script><\/script>",m=m.removeChild(m.firstChild);break;case"select":m=typeof s.is=="string"?b.createElement("select",{is:s.is}):b.createElement("select"),s.multiple?m.multiple=!0:s.size&&(m.size=s.size);break;default:m=typeof s.is=="string"?b.createElement(f,{is:s.is}):b.createElement(f)}}m[Nt]=n,m[qt]=s;e:for(b=n.child;b!==null;){if(b.tag===5||b.tag===6)m.appendChild(b.stateNode);else if(b.tag!==4&&b.tag!==27&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===n)break e;for(;b.sibling===null;){if(b.return===null||b.return===n)break e;b=b.return}b.sibling.return=b.return,b=b.sibling}n.stateNode=m;e:switch(Ot(m,f,s),f){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&Vn(n)}}return at(n),Tu(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,a),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==s&&Vn(n);else{if(typeof s!="string"&&n.stateNode===null)throw Error(l(166));if(e=Y.current,Ci(n)){if(e=n.stateNode,a=n.memoizedProps,s=null,f=At,f!==null)switch(f.tag){case 27:case 5:s=f.memoizedProps}e[Nt]=n,e=!!(e.nodeValue===a||s!==null&&s.suppressHydrationWarning===!0||Jm(e.nodeValue,a)),e||sr(n,!0)}else e=us(e).createTextNode(s),e[Nt]=n,n.stateNode=e}return at(n),null;case 31:if(a=n.memoizedState,e===null||e.memoizedState!==null){if(s=Ci(n),a!==null){if(e===null){if(!s)throw Error(l(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(557));e[Nt]=n}else Hr(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;at(n),e=!1}else a=Lo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return n.flags&256?(nn(n),n):(nn(n),null);if((n.flags&128)!==0)throw Error(l(558))}return at(n),null;case 13:if(s=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(f=Ci(n),s!==null&&s.dehydrated!==null){if(e===null){if(!f)throw Error(l(318));if(f=n.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(l(317));f[Nt]=n}else Hr(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;at(n),f=!1}else f=Lo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=f),f=!0;if(!f)return n.flags&256?(nn(n),n):(nn(n),null)}return nn(n),(n.flags&128)!==0?(n.lanes=a,n):(a=s!==null,e=e!==null&&e.memoizedState!==null,a&&(s=n.child,f=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(f=s.alternate.memoizedState.cachePool.pool),m=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(m=s.memoizedState.cachePool.pool),m!==f&&(s.flags|=2048)),a!==e&&a&&(n.child.flags|=8192),Kl(n,n.updateQueue),at(n),null);case 4:return pe(),e===null&&Xu(n.stateNode.containerInfo),at(n),null;case 10:return qn(n.type),at(n),null;case 19:if(M(ht),s=n.memoizedState,s===null)return at(n),null;if(f=(n.flags&128)!==0,m=s.rendering,m===null)if(f)Aa(s,!1);else{if(dt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(m=zl(e),m!==null){for(n.flags|=128,Aa(s,!1),e=m.updateQueue,n.updateQueue=e,Kl(n,e),n.subtreeFlags=0,e=a,a=n.child;a!==null;)Af(a,e),a=a.sibling;return C(ht,ht.current&1|2),Ge&&Hn(n,s.treeForkCount),n.child}e=e.sibling}s.tail!==null&&ee()>Wl&&(n.flags|=128,f=!0,Aa(s,!1),n.lanes=4194304)}else{if(!f)if(e=zl(m),e!==null){if(n.flags|=128,f=!0,e=e.updateQueue,n.updateQueue=e,Kl(n,e),Aa(s,!0),s.tail===null&&s.tailMode==="hidden"&&!m.alternate&&!Ge)return at(n),null}else 2*ee()-s.renderingStartTime>Wl&&a!==536870912&&(n.flags|=128,f=!0,Aa(s,!1),n.lanes=4194304);s.isBackwards?(m.sibling=n.child,n.child=m):(e=s.last,e!==null?e.sibling=m:n.child=m,s.last=m)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=ee(),e.sibling=null,a=ht.current,C(ht,f?a&1|2:a&1),Ge&&Hn(n,s.treeForkCount),e):(at(n),null);case 22:case 23:return nn(n),Qo(),s=n.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(n.flags|=8192):s&&(n.flags|=8192),s?(a&536870912)!==0&&(n.flags&128)===0&&(at(n),n.subtreeFlags&6&&(n.flags|=8192)):at(n),a=n.updateQueue,a!==null&&Kl(n,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),s=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(s=n.memoizedState.cachePool.pool),s!==a&&(n.flags|=2048),e!==null&&M(Gr),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),qn(vt),at(n),null;case 25:return null;case 30:return null}throw Error(l(156,n.tag))}function ox(e,n){switch(zo(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return qn(vt),pe(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return je(n),null;case 31:if(n.memoizedState!==null){if(nn(n),n.alternate===null)throw Error(l(340));Hr()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(nn(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(l(340));Hr()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return M(ht),null;case 4:return pe(),null;case 10:return qn(n.type),null;case 22:case 23:return nn(n),Qo(),e!==null&&M(Gr),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return qn(vt),null;case 25:return null;default:return null}}function rm(e,n){switch(zo(n),n.tag){case 3:qn(vt),pe();break;case 26:case 27:case 5:je(n);break;case 4:pe();break;case 31:n.memoizedState!==null&&nn(n);break;case 13:nn(n);break;case 19:M(ht);break;case 10:qn(n.type);break;case 22:case 23:nn(n),Qo(),e!==null&&M(Gr);break;case 24:qn(vt)}}function Ia(e,n){try{var a=n.updateQueue,s=a!==null?a.lastEffect:null;if(s!==null){var f=s.next;a=f;do{if((a.tag&e)===e){s=void 0;var m=a.create,b=a.inst;s=m(),b.destroy=s}a=a.next}while(a!==f)}}catch(j){Ze(n,n.return,j)}}function mr(e,n,a){try{var s=n.updateQueue,f=s!==null?s.lastEffect:null;if(f!==null){var m=f.next;s=m;do{if((s.tag&e)===e){var b=s.inst,j=b.destroy;if(j!==void 0){b.destroy=void 0,f=n;var L=a,Z=j;try{Z()}catch(ae){Ze(f,L,ae)}}}s=s.next}while(s!==m)}}catch(ae){Ze(n,n.return,ae)}}function im(e){var n=e.updateQueue;if(n!==null){var a=e.stateNode;try{Kf(n,a)}catch(s){Ze(e,e.return,s)}}}function am(e,n,a){a.props=Yr(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(s){Ze(e,n,s)}}function Da(e,n){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof a=="function"?e.refCleanup=a(s):a.current=s}}catch(f){Ze(e,n,f)}}function Nn(e,n){var a=e.ref,s=e.refCleanup;if(a!==null)if(typeof s=="function")try{s()}catch(f){Ze(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){Ze(e,n,f)}else a.current=null}function lm(e){var n=e.type,a=e.memoizedProps,s=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&s.focus();break e;case"img":a.src?s.src=a.src:a.srcSet&&(s.srcset=a.srcSet)}}catch(f){Ze(e,e.return,f)}}function Eu(e,n,a){try{var s=e.stateNode;Ax(s,e.type,a,n),s[qt]=n}catch(f){Ze(e,e.return,f)}}function sm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Sr(e.type)||e.tag===4}function Nu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||sm(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&&Sr(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 Au(e,n,a){var s=e.tag;if(s===5||s===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=_n));else if(s!==4&&(s===27&&Sr(e.type)&&(a=e.stateNode,n=null),e=e.child,e!==null))for(Au(e,n,a),e=e.sibling;e!==null;)Au(e,n,a),e=e.sibling}function Xl(e,n,a){var s=e.tag;if(s===5||s===6)e=e.stateNode,n?a.insertBefore(e,n):a.appendChild(e);else if(s!==4&&(s===27&&Sr(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Xl(e,n,a),e=e.sibling;e!==null;)Xl(e,n,a),e=e.sibling}function om(e){var n=e.stateNode,a=e.memoizedProps;try{for(var s=e.type,f=n.attributes;f.length;)n.removeAttributeNode(f[0]);Ot(n,s,a),n[Nt]=e,n[qt]=a}catch(m){Ze(e,e.return,m)}}var Pn=!1,St=!1,Iu=!1,um=typeof WeakSet=="function"?WeakSet:Set,Rt=null;function ux(e,n){if(e=e.containerInfo,Ju=gs,e=Sf(e),Co(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var s=a.getSelection&&a.getSelection();if(s&&s.rangeCount!==0){a=s.anchorNode;var f=s.anchorOffset,m=s.focusNode;s=s.focusOffset;try{a.nodeType,m.nodeType}catch{a=null;break e}var b=0,j=-1,L=-1,Z=0,ae=0,ue=e,J=null;t:for(;;){for(var ne;ue!==a||f!==0&&ue.nodeType!==3||(j=b+f),ue!==m||s!==0&&ue.nodeType!==3||(L=b+s),ue.nodeType===3&&(b+=ue.nodeValue.length),(ne=ue.firstChild)!==null;)J=ue,ue=ne;for(;;){if(ue===e)break t;if(J===a&&++Z===f&&(j=b),J===m&&++ae===s&&(L=b),(ne=ue.nextSibling)!==null)break;ue=J,J=ue.parentNode}ue=ne}a=j===-1||L===-1?null:{start:j,end:L}}else a=null}a=a||{start:0,end:0}}else a=null;for(Wu={focusedElem:e,selectionRange:a},gs=!1,Rt=n;Rt!==null;)if(n=Rt,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,Rt=e;else for(;Rt!==null;){switch(n=Rt,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,s=a.stateNode;try{var ge=Yr(a.type,f);e=s.getSnapshotBeforeUpdate(ge,m),s.__reactInternalSnapshotBeforeUpdate=e}catch(Ce){Ze(a,a.return,Ce)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,a=e.nodeType,a===9)nc(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":nc(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(l(163))}if(e=n.sibling,e!==null){e.return=n.return,Rt=e;break}Rt=n.return}}function cm(e,n,a){var s=a.flags;switch(a.tag){case 0:case 11:case 15:Kn(e,a),s&4&&Ia(5,a);break;case 1:if(Kn(e,a),s&4)if(e=a.stateNode,n===null)try{e.componentDidMount()}catch(b){Ze(a,a.return,b)}else{var f=Yr(a.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(f,n,e.__reactInternalSnapshotBeforeUpdate)}catch(b){Ze(a,a.return,b)}}s&64&&im(a),s&512&&Da(a,a.return);break;case 3:if(Kn(e,a),s&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{Kf(e,n)}catch(b){Ze(a,a.return,b)}}break;case 27:n===null&&s&4&&om(a);case 26:case 5:Kn(e,a),n===null&&s&4&&lm(a),s&512&&Da(a,a.return);break;case 12:Kn(e,a);break;case 31:Kn(e,a),s&4&&hm(e,a);break;case 13:Kn(e,a),s&4&&mm(e,a),s&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=vx.bind(null,a),Bx(e,a))));break;case 22:if(s=a.memoizedState!==null||Pn,!s){n=n!==null&&n.memoizedState!==null||St,f=Pn;var m=St;Pn=s,(St=n)&&!m?Xn(e,a,(a.subtreeFlags&8772)!==0):Kn(e,a),Pn=f,St=m}break;case 30:break;default:Kn(e,a)}}function dm(e){var n=e.alternate;n!==null&&(e.alternate=null,dm(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&lo(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 ot=null,$t=!1;function Yn(e,n,a){for(a=a.child;a!==null;)fm(e,n,a),a=a.sibling}function fm(e,n,a){if(Ne&&typeof Ne.onCommitFiberUnmount=="function")try{Ne.onCommitFiberUnmount(we,a)}catch{}switch(a.tag){case 26:St||Nn(a,n),Yn(e,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:St||Nn(a,n);var s=ot,f=$t;Sr(a.type)&&(ot=a.stateNode,$t=!1),Yn(e,n,a),qa(a.stateNode),ot=s,$t=f;break;case 5:St||Nn(a,n);case 6:if(s=ot,f=$t,ot=null,Yn(e,n,a),ot=s,$t=f,ot!==null)if($t)try{(ot.nodeType===9?ot.body:ot.nodeName==="HTML"?ot.ownerDocument.body:ot).removeChild(a.stateNode)}catch(m){Ze(a,n,m)}else try{ot.removeChild(a.stateNode)}catch(m){Ze(a,n,m)}break;case 18:ot!==null&&($t?(e=ot,ip(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),Vi(e)):ip(ot,a.stateNode));break;case 4:s=ot,f=$t,ot=a.stateNode.containerInfo,$t=!0,Yn(e,n,a),ot=s,$t=f;break;case 0:case 11:case 14:case 15:mr(2,a,n),St||mr(4,a,n),Yn(e,n,a);break;case 1:St||(Nn(a,n),s=a.stateNode,typeof s.componentWillUnmount=="function"&&am(a,n,s)),Yn(e,n,a);break;case 21:Yn(e,n,a);break;case 22:St=(s=St)||a.memoizedState!==null,Yn(e,n,a),St=s;break;default:Yn(e,n,a)}}function hm(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Vi(e)}catch(a){Ze(n,n.return,a)}}}function mm(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Vi(e)}catch(a){Ze(n,n.return,a)}}function cx(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new um),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new um),n;default:throw Error(l(435,e.tag))}}function Ql(e,n){var a=cx(e);n.forEach(function(s){if(!a.has(s)){a.add(s);var f=bx.bind(null,e,s);s.then(f,f)}})}function Ft(e,n){var a=n.deletions;if(a!==null)for(var s=0;s<a.length;s++){var f=a[s],m=e,b=n,j=b;e:for(;j!==null;){switch(j.tag){case 27:if(Sr(j.type)){ot=j.stateNode,$t=!1;break e}break;case 5:ot=j.stateNode,$t=!1;break e;case 3:case 4:ot=j.stateNode.containerInfo,$t=!0;break e}j=j.return}if(ot===null)throw Error(l(160));fm(m,b,f),ot=null,$t=!1,m=f.alternate,m!==null&&(m.return=null),f.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)pm(n,e),n=n.sibling}var Sn=null;function pm(e,n){var a=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ft(n,e),Vt(e),s&4&&(mr(3,e,e.return),Ia(3,e),mr(5,e,e.return));break;case 1:Ft(n,e),Vt(e),s&512&&(St||a===null||Nn(a,a.return)),s&64&&Pn&&(e=e.updateQueue,e!==null&&(s=e.callbacks,s!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?s:a.concat(s))));break;case 26:var f=Sn;if(Ft(n,e),Vt(e),s&512&&(St||a===null||Nn(a,a.return)),s&4){var m=a!==null?a.memoizedState:null;if(s=e.memoizedState,a===null)if(s===null)if(e.stateNode===null){e:{s=e.type,a=e.memoizedProps,f=f.ownerDocument||f;t:switch(s){case"title":m=f.getElementsByTagName("title")[0],(!m||m[aa]||m[Nt]||m.namespaceURI==="http://www.w3.org/2000/svg"||m.hasAttribute("itemprop"))&&(m=f.createElement(s),f.head.insertBefore(m,f.querySelector("head > title"))),Ot(m,s,a),m[Nt]=e,jt(m),s=m;break e;case"link":var b=pp("link","href",f).get(s+(a.href||""));if(b){for(var j=0;j<b.length;j++)if(m=b[j],m.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&m.getAttribute("rel")===(a.rel==null?null:a.rel)&&m.getAttribute("title")===(a.title==null?null:a.title)&&m.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){b.splice(j,1);break t}}m=f.createElement(s),Ot(m,s,a),f.head.appendChild(m);break;case"meta":if(b=pp("meta","content",f).get(s+(a.content||""))){for(j=0;j<b.length;j++)if(m=b[j],m.getAttribute("content")===(a.content==null?null:""+a.content)&&m.getAttribute("name")===(a.name==null?null:a.name)&&m.getAttribute("property")===(a.property==null?null:a.property)&&m.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&m.getAttribute("charset")===(a.charSet==null?null:a.charSet)){b.splice(j,1);break t}}m=f.createElement(s),Ot(m,s,a),f.head.appendChild(m);break;default:throw Error(l(468,s))}m[Nt]=e,jt(m),s=m}e.stateNode=s}else gp(f,e.type,e.stateNode);else e.stateNode=mp(f,s,e.memoizedProps);else m!==s?(m===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):m.count--,s===null?gp(f,e.type,e.stateNode):mp(f,s,e.memoizedProps)):s===null&&e.stateNode!==null&&Eu(e,e.memoizedProps,a.memoizedProps)}break;case 27:Ft(n,e),Vt(e),s&512&&(St||a===null||Nn(a,a.return)),a!==null&&s&4&&Eu(e,e.memoizedProps,a.memoizedProps);break;case 5:if(Ft(n,e),Vt(e),s&512&&(St||a===null||Nn(a,a.return)),e.flags&32){f=e.stateNode;try{mi(f,"")}catch(ge){Ze(e,e.return,ge)}}s&4&&e.stateNode!=null&&(f=e.memoizedProps,Eu(e,f,a!==null?a.memoizedProps:f)),s&1024&&(Iu=!0);break;case 6:if(Ft(n,e),Vt(e),s&4){if(e.stateNode===null)throw Error(l(162));s=e.memoizedProps,a=e.stateNode;try{a.nodeValue=s}catch(ge){Ze(e,e.return,ge)}}break;case 3:if(fs=null,f=Sn,Sn=cs(n.containerInfo),Ft(n,e),Sn=f,Vt(e),s&4&&a!==null&&a.memoizedState.isDehydrated)try{Vi(n.containerInfo)}catch(ge){Ze(e,e.return,ge)}Iu&&(Iu=!1,gm(e));break;case 4:s=Sn,Sn=cs(e.stateNode.containerInfo),Ft(n,e),Vt(e),Sn=s;break;case 12:Ft(n,e),Vt(e);break;case 31:Ft(n,e),Vt(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Ql(e,s)));break;case 13:Ft(n,e),Vt(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Jl=ee()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Ql(e,s)));break;case 22:f=e.memoizedState!==null;var L=a!==null&&a.memoizedState!==null,Z=Pn,ae=St;if(Pn=Z||f,St=ae||L,Ft(n,e),St=ae,Pn=Z,Vt(e),s&8192)e:for(n=e.stateNode,n._visibility=f?n._visibility&-2:n._visibility|1,f&&(a===null||L||Pn||St||Kr(e)),a=null,n=e;;){if(n.tag===5||n.tag===26){if(a===null){L=a=n;try{if(m=L.stateNode,f)b=m.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none";else{j=L.stateNode;var ue=L.memoizedProps.style,J=ue!=null&&ue.hasOwnProperty("display")?ue.display:null;j.style.display=J==null||typeof J=="boolean"?"":(""+J).trim()}}catch(ge){Ze(L,L.return,ge)}}}else if(n.tag===6){if(a===null){L=n;try{L.stateNode.nodeValue=f?"":L.memoizedProps}catch(ge){Ze(L,L.return,ge)}}}else if(n.tag===18){if(a===null){L=n;try{var ne=L.stateNode;f?ap(ne,!0):ap(L.stateNode,!1)}catch(ge){Ze(L,L.return,ge)}}}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}s&4&&(s=e.updateQueue,s!==null&&(a=s.retryQueue,a!==null&&(s.retryQueue=null,Ql(e,a))));break;case 19:Ft(n,e),Vt(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Ql(e,s)));break;case 30:break;case 21:break;default:Ft(n,e),Vt(e)}}function Vt(e){var n=e.flags;if(n&2){try{for(var a,s=e.return;s!==null;){if(sm(s)){a=s;break}s=s.return}if(a==null)throw Error(l(160));switch(a.tag){case 27:var f=a.stateNode,m=Nu(e);Xl(e,m,f);break;case 5:var b=a.stateNode;a.flags&32&&(mi(b,""),a.flags&=-33);var j=Nu(e);Xl(e,j,b);break;case 3:case 4:var L=a.stateNode.containerInfo,Z=Nu(e);Au(e,Z,L);break;default:throw Error(l(161))}}catch(ae){Ze(e,e.return,ae)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function gm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;gm(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function Kn(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)cm(e,n.alternate,n),n=n.sibling}function Kr(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:mr(4,n,n.return),Kr(n);break;case 1:Nn(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&am(n,n.return,a),Kr(n);break;case 27:qa(n.stateNode);case 26:case 5:Nn(n,n.return),Kr(n);break;case 22:n.memoizedState===null&&Kr(n);break;case 30:Kr(n);break;default:Kr(n)}e=e.sibling}}function Xn(e,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var s=n.alternate,f=e,m=n,b=m.flags;switch(m.tag){case 0:case 11:case 15:Xn(f,m,a),Ia(4,m);break;case 1:if(Xn(f,m,a),s=m,f=s.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(Z){Ze(s,s.return,Z)}if(s=m,f=s.updateQueue,f!==null){var j=s.stateNode;try{var L=f.shared.hiddenCallbacks;if(L!==null)for(f.shared.hiddenCallbacks=null,f=0;f<L.length;f++)Yf(L[f],j)}catch(Z){Ze(s,s.return,Z)}}a&&b&64&&im(m),Da(m,m.return);break;case 27:om(m);case 26:case 5:Xn(f,m,a),a&&s===null&&b&4&&lm(m),Da(m,m.return);break;case 12:Xn(f,m,a);break;case 31:Xn(f,m,a),a&&b&4&&hm(f,m);break;case 13:Xn(f,m,a),a&&b&4&&mm(f,m);break;case 22:m.memoizedState===null&&Xn(f,m,a),Da(m,m.return);break;case 30:break;default:Xn(f,m,a)}n=n.sibling}}function Du(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&&va(a))}function Ou(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&va(e))}function kn(e,n,a,s){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)ym(e,n,a,s),n=n.sibling}function ym(e,n,a,s){var f=n.flags;switch(n.tag){case 0:case 11:case 15:kn(e,n,a,s),f&2048&&Ia(9,n);break;case 1:kn(e,n,a,s);break;case 3:kn(e,n,a,s),f&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&va(e)));break;case 12:if(f&2048){kn(e,n,a,s),e=n.stateNode;try{var m=n.memoizedProps,b=m.id,j=m.onPostCommit;typeof j=="function"&&j(b,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(L){Ze(n,n.return,L)}}else kn(e,n,a,s);break;case 31:kn(e,n,a,s);break;case 13:kn(e,n,a,s);break;case 23:break;case 22:m=n.stateNode,b=n.alternate,n.memoizedState!==null?m._visibility&2?kn(e,n,a,s):Oa(e,n):m._visibility&2?kn(e,n,a,s):(m._visibility|=2,Mi(e,n,a,s,(n.subtreeFlags&10256)!==0||!1)),f&2048&&Du(b,n);break;case 24:kn(e,n,a,s),f&2048&&Ou(n.alternate,n);break;default:kn(e,n,a,s)}}function Mi(e,n,a,s,f){for(f=f&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var m=e,b=n,j=a,L=s,Z=b.flags;switch(b.tag){case 0:case 11:case 15:Mi(m,b,j,L,f),Ia(8,b);break;case 23:break;case 22:var ae=b.stateNode;b.memoizedState!==null?ae._visibility&2?Mi(m,b,j,L,f):Oa(m,b):(ae._visibility|=2,Mi(m,b,j,L,f)),f&&Z&2048&&Du(b.alternate,b);break;case 24:Mi(m,b,j,L,f),f&&Z&2048&&Ou(b.alternate,b);break;default:Mi(m,b,j,L,f)}n=n.sibling}}function Oa(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=e,s=n,f=s.flags;switch(s.tag){case 22:Oa(a,s),f&2048&&Du(s.alternate,s);break;case 24:Oa(a,s),f&2048&&Ou(s.alternate,s);break;default:Oa(a,s)}n=n.sibling}}var Ma=8192;function zi(e,n,a){if(e.subtreeFlags&Ma)for(e=e.child;e!==null;)vm(e,n,a),e=e.sibling}function vm(e,n,a){switch(e.tag){case 26:zi(e,n,a),e.flags&Ma&&e.memoizedState!==null&&Qx(a,Sn,e.memoizedState,e.memoizedProps);break;case 5:zi(e,n,a);break;case 3:case 4:var s=Sn;Sn=cs(e.stateNode.containerInfo),zi(e,n,a),Sn=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=Ma,Ma=16777216,zi(e,n,a),Ma=s):zi(e,n,a));break;default:zi(e,n,a)}}function bm(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 za(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var s=n[a];Rt=s,Sm(s,e)}bm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)xm(e),e=e.sibling}function xm(e){switch(e.tag){case 0:case 11:case 15:za(e),e.flags&2048&&mr(9,e,e.return);break;case 3:za(e);break;case 12:za(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,Zl(e)):za(e);break;default:za(e)}}function Zl(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var s=n[a];Rt=s,Sm(s,e)}bm(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:mr(8,n,n.return),Zl(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,Zl(n));break;default:Zl(n)}e=e.sibling}}function Sm(e,n){for(;Rt!==null;){var a=Rt;switch(a.tag){case 0:case 11:case 15:mr(8,a,n);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var s=a.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:va(a.memoizedState.cache)}if(s=a.child,s!==null)s.return=a,Rt=s;else e:for(a=e;Rt!==null;){s=Rt;var f=s.sibling,m=s.return;if(dm(s),s===a){Rt=null;break e}if(f!==null){f.return=m,Rt=f;break e}Rt=m}}}var dx={getCacheForType:function(e){var n=It(vt),a=n.data.get(e);return a===void 0&&(a=e(),n.data.set(e,a)),a},cacheSignal:function(){return It(vt).controller.signal}},fx=typeof WeakMap=="function"?WeakMap:Map,Pe=0,tt=null,Le=null,Ue=0,Qe=0,rn=null,pr=!1,_i=!1,Mu=!1,Qn=0,dt=0,gr=0,Xr=0,zu=0,an=0,Li=0,_a=null,Pt=null,_u=!1,Jl=0,km=0,Wl=1/0,es=null,yr=null,wt=0,vr=null,Bi=null,Zn=0,Lu=0,Bu=null,wm=null,La=0,Hu=null;function ln(){return(Pe&2)!==0&&Ue!==0?Ue&-Ue:O.T!==null?Vu():Bd()}function Cm(){if(an===0)if((Ue&536870912)===0||Ge){var e=si;si<<=1,(si&3932160)===0&&(si=262144),an=e}else an=536870912;return e=tn.current,e!==null&&(e.flags|=32),an}function Yt(e,n,a){(e===tt&&(Qe===2||Qe===9)||e.cancelPendingCommit!==null)&&(Hi(e,0),br(e,Ue,an,!1)),ia(e,a),((Pe&2)===0||e!==tt)&&(e===tt&&((Pe&2)===0&&(Xr|=a),dt===4&&br(e,Ue,an,!1)),An(e))}function jm(e,n,a){if((Pe&6)!==0)throw Error(l(327));var s=!a&&(n&127)===0&&(n&e.expiredLanes)===0||ra(e,n),f=s?px(e,n):qu(e,n,!0),m=s;do{if(f===0){_i&&!s&&br(e,n,0,!1);break}else{if(a=e.current.alternate,m&&!hx(a)){f=qu(e,n,!1),m=!1;continue}if(f===2){if(m=n,e.errorRecoveryDisabledLanes&m)var b=0;else b=e.pendingLanes&-536870913,b=b!==0?b:b&536870912?536870912:0;if(b!==0){n=b;e:{var j=e;f=_a;var L=j.current.memoizedState.isDehydrated;if(L&&(Hi(j,b).flags|=256),b=qu(j,b,!1),b!==2){if(Mu&&!L){j.errorRecoveryDisabledLanes|=m,Xr|=m,f=4;break e}m=Pt,Pt=f,m!==null&&(Pt===null?Pt=m:Pt.push.apply(Pt,m))}f=b}if(m=!1,f!==2)continue}}if(f===1){Hi(e,0),br(e,n,0,!0);break}e:{switch(s=e,m=f,m){case 0:case 1:throw Error(l(345));case 4:if((n&4194048)!==n)break;case 6:br(s,n,an,!pr);break e;case 2:Pt=null;break;case 3:case 5:break;default:throw Error(l(329))}if((n&62914560)===n&&(f=Jl+300-ee(),10<f)){if(br(s,n,an,!pr),cl(s,0,!0)!==0)break e;Zn=n,s.timeoutHandle=np(Rm.bind(null,s,a,Pt,es,_u,n,an,Xr,Li,pr,m,"Throttled",-0,0),f);break e}Rm(s,a,Pt,es,_u,n,an,Xr,Li,pr,m,null,-0,0)}}break}while(!0);An(e)}function Rm(e,n,a,s,f,m,b,j,L,Z,ae,ue,J,ne){if(e.timeoutHandle=-1,ue=n.subtreeFlags,ue&8192||(ue&16785408)===16785408){ue={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:_n},vm(n,m,ue);var ge=(m&62914560)===m?Jl-ee():(m&4194048)===m?km-ee():0;if(ge=Zx(ue,ge),ge!==null){Zn=m,e.cancelPendingCommit=ge(Mm.bind(null,e,n,m,a,s,f,b,j,L,ae,ue,null,J,ne)),br(e,m,b,!Z);return}}Mm(e,n,m,a,s,f,b,j,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 s=0;s<a.length;s++){var f=a[s],m=f.getSnapshot;f=f.value;try{if(!Wt(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 br(e,n,a,s){n&=~zu,n&=~Xr,e.suspendedLanes|=n,e.pingedLanes&=~n,s&&(e.warmLanes|=n),s=e.expirationTimes;for(var f=n;0<f;){var m=31-Ie(f),b=1<<m;s[m]=-1,f&=~b}a!==0&&zd(e,a,n)}function ts(){return(Pe&6)===0?(Ba(0),!1):!0}function Uu(){if(Le!==null){if(Qe===0)var e=Le.return;else e=Le,Un=Ur=null,nu(e),Ni=null,xa=0,e=Le;for(;e!==null;)rm(e.alternate,e),e=e.return;Le=null}}function Hi(e,n){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,Ox(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),Zn=0,Uu(),tt=e,Le=a=Bn(e.current,null),Ue=n,Qe=0,rn=null,pr=!1,_i=ra(e,n),Mu=!1,Li=an=zu=Xr=gr=dt=0,Pt=_a=null,_u=!1,(n&8)!==0&&(n|=n&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=n;0<s;){var f=31-Ie(s),m=1<<f;n|=e[f],s&=~m}return Qn=n,kl(),a}function Tm(e,n){Oe=null,O.H=Ea,n===Ei||n===Al?(n=$f(),Qe=3):n===Fo?(n=$f(),Qe=4):Qe=n===vu?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,rn=n,Le===null&&(dt=1,Fl(e,fn(n,e.current)))}function Em(){var e=tn.current;return e===null?!0:(Ue&4194048)===Ue?gn===null:(Ue&62914560)===Ue||(Ue&536870912)!==0?e===gn:!1}function Nm(){var e=O.H;return O.H=Ea,e===null?Ea:e}function Am(){var e=O.A;return O.A=dx,e}function ns(){dt=4,pr||(Ue&4194048)!==Ue&&tn.current!==null||(_i=!0),(gr&134217727)===0&&(Xr&134217727)===0||tt===null||br(tt,Ue,an,!1)}function qu(e,n,a){var s=Pe;Pe|=2;var f=Nm(),m=Am();(tt!==e||Ue!==n)&&(es=null,Hi(e,n)),n=!1;var b=dt;e:do try{if(Qe!==0&&Le!==null){var j=Le,L=rn;switch(Qe){case 8:Uu(),b=6;break e;case 3:case 2:case 9:case 6:tn.current===null&&(n=!0);var Z=Qe;if(Qe=0,rn=null,Ui(e,j,L,Z),a&&_i){b=0;break e}break;default:Z=Qe,Qe=0,rn=null,Ui(e,j,L,Z)}}mx(),b=dt;break}catch(ae){Tm(e,ae)}while(!0);return n&&e.shellSuspendCounter++,Un=Ur=null,Pe=s,O.H=f,O.A=m,Le===null&&(tt=null,Ue=0,kl()),b}function mx(){for(;Le!==null;)Im(Le)}function px(e,n){var a=Pe;Pe|=2;var s=Nm(),f=Am();tt!==e||Ue!==n?(es=null,Wl=ee()+500,Hi(e,n)):_i=ra(e,n);e:do try{if(Qe!==0&&Le!==null){n=Le;var m=rn;t:switch(Qe){case 1:Qe=0,rn=null,Ui(e,n,m,1);break;case 2:case 9:if(qf(m)){Qe=0,rn=null,Dm(n);break}n=function(){Qe!==2&&Qe!==9||tt!==e||(Qe=7),An(e)},m.then(n,n);break e;case 3:Qe=7;break e;case 4:Qe=5;break e;case 7:qf(m)?(Qe=0,rn=null,Dm(n)):(Qe=0,rn=null,Ui(e,n,m,7));break;case 5:var b=null;switch(Le.tag){case 26:b=Le.memoizedState;case 5:case 27:var j=Le;if(b?yp(b):j.stateNode.complete){Qe=0,rn=null;var L=j.sibling;if(L!==null)Le=L;else{var Z=j.return;Z!==null?(Le=Z,rs(Z)):Le=null}break t}}Qe=0,rn=null,Ui(e,n,m,5);break;case 6:Qe=0,rn=null,Ui(e,n,m,6);break;case 8:Uu(),dt=6;break e;default:throw Error(l(462))}}gx();break}catch(ae){Tm(e,ae)}while(!0);return Un=Ur=null,O.H=s,O.A=f,Pe=a,Le!==null?0:(tt=null,Ue=0,kl(),dt)}function gx(){for(;Le!==null&&!Xe();)Im(Le)}function Im(e){var n=tm(e.alternate,e,Qn);e.memoizedProps=e.pendingProps,n===null?rs(e):Le=n}function Dm(e){var n=e,a=n.alternate;switch(n.tag){case 15:case 0:n=Xh(a,n,n.pendingProps,n.type,void 0,Ue);break;case 11:n=Xh(a,n,n.pendingProps,n.type.render,n.ref,Ue);break;case 5:nu(n);default:rm(a,n),n=Le=Af(n,Qn),n=tm(a,n,Qn)}e.memoizedProps=e.pendingProps,n===null?rs(e):Le=n}function Ui(e,n,a,s){Un=Ur=null,nu(n),Ni=null,xa=0;var f=n.return;try{if(ix(e,f,n,a,Ue)){dt=1,Fl(e,fn(a,e.current)),Le=null;return}}catch(m){if(f!==null)throw Le=f,m;dt=1,Fl(e,fn(a,e.current)),Le=null;return}n.flags&32768?(Ge||s===1?e=!0:_i||(Ue&536870912)!==0?e=!1:(pr=e=!0,(s===2||s===9||s===3||s===6)&&(s=tn.current,s!==null&&s.tag===13&&(s.flags|=16384))),Om(n,e)):rs(n)}function rs(e){var n=e;do{if((n.flags&32768)!==0){Om(n,pr);return}e=n.return;var a=sx(n.alternate,n,Qn);if(a!==null){Le=a;return}if(n=n.sibling,n!==null){Le=n;return}Le=n=e}while(n!==null);dt===0&&(dt=5)}function Om(e,n){do{var a=ox(e.alternate,e);if(a!==null){a.flags&=32767,Le=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(e=e.sibling,e!==null)){Le=e;return}Le=e=a}while(e!==null);dt=6,Le=null}function Mm(e,n,a,s,f,m,b,j,L){e.cancelPendingCommit=null;do is();while(wt!==0);if((Pe&6)!==0)throw Error(l(327));if(n!==null){if(n===e.current)throw Error(l(177));if(m=n.lanes|n.childLanes,m|=No,Xv(e,a,m,b,j,L),e===tt&&(Le=tt=null,Ue=0),Bi=n,vr=e,Zn=a,Lu=m,Bu=f,wm=s,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,xx(be,function(){return Hm(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||s){s=O.T,O.T=null,f=U.p,U.p=2,b=Pe,Pe|=4;try{ux(e,n,a)}finally{Pe=b,U.p=f,O.T=s}}wt=1,zm(),_m(),Lm()}}function zm(){if(wt===1){wt=0;var e=vr,n=Bi,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=O.T,O.T=null;var s=U.p;U.p=2;var f=Pe;Pe|=4;try{pm(n,e);var m=Wu,b=Sf(e.containerInfo),j=m.focusedElem,L=m.selectionRange;if(b!==j&&j&&j.ownerDocument&&xf(j.ownerDocument.documentElement,j)){if(L!==null&&Co(j)){var Z=L.start,ae=L.end;if(ae===void 0&&(ae=Z),"selectionStart"in j)j.selectionStart=Z,j.selectionEnd=Math.min(ae,j.value.length);else{var ue=j.ownerDocument||document,J=ue&&ue.defaultView||window;if(J.getSelection){var ne=J.getSelection(),ge=j.textContent.length,Ce=Math.min(L.start,ge),et=L.end===void 0?Ce:Math.min(L.end,ge);!ne.extend&&Ce>et&&(b=et,et=Ce,Ce=b);var P=bf(j,Ce),q=bf(j,et);if(P&&q&&(ne.rangeCount!==1||ne.anchorNode!==P.node||ne.anchorOffset!==P.offset||ne.focusNode!==q.node||ne.focusOffset!==q.offset)){var Q=ue.createRange();Q.setStart(P.node,P.offset),ne.removeAllRanges(),Ce>et?(ne.addRange(Q),ne.extend(q.node,q.offset)):(Q.setEnd(q.node,q.offset),ne.addRange(Q))}}}}for(ue=[],ne=j;ne=ne.parentNode;)ne.nodeType===1&&ue.push({element:ne,left:ne.scrollLeft,top:ne.scrollTop});for(typeof j.focus=="function"&&j.focus(),j=0;j<ue.length;j++){var oe=ue[j];oe.element.scrollLeft=oe.left,oe.element.scrollTop=oe.top}}gs=!!Ju,Wu=Ju=null}finally{Pe=f,U.p=s,O.T=a}}e.current=n,wt=2}}function _m(){if(wt===2){wt=0;var e=vr,n=Bi,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=O.T,O.T=null;var s=U.p;U.p=2;var f=Pe;Pe|=4;try{cm(e,n.alternate,n)}finally{Pe=f,U.p=s,O.T=a}}wt=3}}function Lm(){if(wt===4||wt===3){wt=0,ut();var e=vr,n=Bi,a=Zn,s=wm;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?wt=5:(wt=0,Bi=vr=null,Bm(e,e.pendingLanes));var f=e.pendingLanes;if(f===0&&(yr=null),io(a),n=n.stateNode,Ne&&typeof Ne.onCommitFiberRoot=="function")try{Ne.onCommitFiberRoot(we,n,void 0,(n.current.flags&128)===128)}catch{}if(s!==null){n=O.T,f=U.p,U.p=2,O.T=null;try{for(var m=e.onRecoverableError,b=0;b<s.length;b++){var j=s[b];m(j.value,{componentStack:j.stack})}}finally{O.T=n,U.p=f}}(Zn&3)!==0&&is(),An(e),f=e.pendingLanes,(a&261930)!==0&&(f&42)!==0?e===Hu?La++:(La=0,Hu=e):La=0,Ba(0)}}function Bm(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,va(n)))}function is(){return zm(),_m(),Lm(),Hm()}function Hm(){if(wt!==5)return!1;var e=vr,n=Lu;Lu=0;var a=io(Zn),s=O.T,f=U.p;try{U.p=32>a?32:a,O.T=null,a=Bu,Bu=null;var m=vr,b=Zn;if(wt=0,Bi=vr=null,Zn=0,(Pe&6)!==0)throw Error(l(331));var j=Pe;if(Pe|=4,xm(m.current),ym(m,m.current,b,a),Pe=j,Ba(0,!1),Ne&&typeof Ne.onPostCommitFiberRoot=="function")try{Ne.onPostCommitFiberRoot(we,m)}catch{}return!0}finally{U.p=f,O.T=s,Bm(e,n)}}function Um(e,n,a){n=fn(a,n),n=yu(e.stateNode,n,2),e=dr(e,n,2),e!==null&&(ia(e,2),An(e))}function Ze(e,n,a){if(e.tag===3)Um(e,e,a);else for(;n!==null;){if(n.tag===3){Um(n,e,a);break}else if(n.tag===1){var s=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(yr===null||!yr.has(s))){e=fn(a,e),a=qh(2),s=dr(n,a,2),s!==null&&(Gh(a,s,n,e),ia(s,2),An(s));break}}n=n.return}}function Gu(e,n,a){var s=e.pingCache;if(s===null){s=e.pingCache=new fx;var f=new Set;s.set(n,f)}else f=s.get(n),f===void 0&&(f=new Set,s.set(n,f));f.has(a)||(Mu=!0,f.add(a),e=yx.bind(null,e,n,a),n.then(e,e))}function yx(e,n,a){var s=e.pingCache;s!==null&&s.delete(n),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,tt===e&&(Ue&a)===a&&(dt===4||dt===3&&(Ue&62914560)===Ue&&300>ee()-Jl?(Pe&2)===0&&Hi(e,0):zu|=a,Li===Ue&&(Li=0)),An(e)}function qm(e,n){n===0&&(n=Md()),e=Lr(e,n),e!==null&&(ia(e,n),An(e))}function vx(e){var n=e.memoizedState,a=0;n!==null&&(a=n.retryLane),qm(e,a)}function bx(e,n){var a=0;switch(e.tag){case 31:case 13:var s=e.stateNode,f=e.memoizedState;f!==null&&(a=f.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(l(314))}s!==null&&s.delete(n),qm(e,a)}function xx(e,n){return Jt(e,n)}var as=null,qi=null,$u=!1,ls=!1,Fu=!1,xr=0;function An(e){e!==qi&&e.next===null&&(qi===null?as=qi=e:qi=qi.next=e),ls=!0,$u||($u=!0,kx())}function Ba(e,n){if(!Fu&&ls){Fu=!0;do for(var a=!1,s=as;s!==null;){if(e!==0){var f=s.pendingLanes;if(f===0)var m=0;else{var b=s.suspendedLanes,j=s.pingedLanes;m=(1<<31-Ie(42|e)+1)-1,m&=f&~(b&~j),m=m&201326741?m&201326741|1:m?m|2:0}m!==0&&(a=!0,Vm(s,m))}else m=Ue,m=cl(s,s===tt?m:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(m&3)===0||ra(s,m)||(a=!0,Vm(s,m));s=s.next}while(a);Fu=!1}}function Sx(){Gm()}function Gm(){ls=$u=!1;var e=0;xr!==0&&Dx()&&(e=xr);for(var n=ee(),a=null,s=as;s!==null;){var f=s.next,m=$m(s,n);m===0?(s.next=null,a===null?as=f:a.next=f,f===null&&(qi=a)):(a=s,(e!==0||(m&3)!==0)&&(ls=!0)),s=f}wt!==0&&wt!==5||Ba(e),xr!==0&&(xr=0)}function $m(e,n){for(var a=e.suspendedLanes,s=e.pingedLanes,f=e.expirationTimes,m=e.pendingLanes&-62914561;0<m;){var b=31-Ie(m),j=1<<b,L=f[b];L===-1?((j&a)===0||(j&s)!==0)&&(f[b]=Kv(j,n)):L<=n&&(e.expiredLanes|=j),m&=~j}if(n=tt,a=Ue,a=cl(e,e===n?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,a===0||e===n&&(Qe===2||Qe===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&Ee(s),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||ra(e,a)){if(n=a&-a,n===e.callbackPriority)return n;switch(s!==null&&Ee(s),io(a)){case 2:case 8:a=fe;break;case 32:a=be;break;case 268435456:a=Te;break;default:a=be}return s=Fm.bind(null,e),a=Jt(a,s),e.callbackPriority=n,e.callbackNode=a,n}return s!==null&&s!==null&&Ee(s),e.callbackPriority=2,e.callbackNode=null,2}function Fm(e,n){if(wt!==0&&wt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(is()&&e.callbackNode!==a)return null;var s=Ue;return s=cl(e,e===tt?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(jm(e,s,n),$m(e,ee()),e.callbackNode!=null&&e.callbackNode===a?Fm.bind(null,e):null)}function Vm(e,n){if(is())return null;jm(e,n,!0)}function kx(){Mx(function(){(Pe&6)!==0?Jt(re,Sx):Gm()})}function Vu(){if(xr===0){var e=Ri;e===0&&(e=li,li<<=1,(li&261888)===0&&(li=256)),xr=e}return xr}function Pm(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:ml(""+e)}function Ym(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 wx(e,n,a,s,f){if(n==="submit"&&a&&a.stateNode===f){var m=Pm((f[qt]||null).action),b=s.submitter;b&&(n=(n=b[qt]||null)?Pm(n.formAction):b.getAttribute("formAction"),n!==null&&(m=n,b=null));var j=new vl("action","action",null,s,f);e.push({event:j,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(xr!==0){var L=b?Ym(f,b):new FormData(f);du(a,{pending:!0,data:L,method:f.method,action:m},null,L)}}else typeof m=="function"&&(j.preventDefault(),L=b?Ym(f,b):new FormData(f),du(a,{pending:!0,data:L,method:f.method,action:m},m,L))},currentTarget:f}]})}}for(var Pu=0;Pu<Eo.length;Pu++){var Yu=Eo[Pu],Cx=Yu.toLowerCase(),jx=Yu[0].toUpperCase()+Yu.slice(1);xn(Cx,"on"+jx)}xn(Cf,"onAnimationEnd"),xn(jf,"onAnimationIteration"),xn(Rf,"onAnimationStart"),xn("dblclick","onDoubleClick"),xn("focusin","onFocus"),xn("focusout","onBlur"),xn(qb,"onTransitionRun"),xn(Gb,"onTransitionStart"),xn($b,"onTransitionCancel"),xn(Tf,"onTransitionEnd"),fi("onMouseEnter",["mouseout","mouseover"]),fi("onMouseLeave",["mouseout","mouseover"]),fi("onPointerEnter",["pointerout","pointerover"]),fi("onPointerLeave",["pointerout","pointerover"]),Or("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Or("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Or("onBeforeInput",["compositionend","keypress","textInput","paste"]),Or("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Or("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Or("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ha="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(" "),Rx=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ha));function Km(e,n){n=(n&4)!==0;for(var a=0;a<e.length;a++){var s=e[a],f=s.event;s=s.listeners;e:{var m=void 0;if(n)for(var b=s.length-1;0<=b;b--){var j=s[b],L=j.instance,Z=j.currentTarget;if(j=j.listener,L!==m&&f.isPropagationStopped())break e;m=j,f.currentTarget=Z;try{m(f)}catch(ae){Sl(ae)}f.currentTarget=null,m=L}else for(b=0;b<s.length;b++){if(j=s[b],L=j.instance,Z=j.currentTarget,j=j.listener,L!==m&&f.isPropagationStopped())break e;m=j,f.currentTarget=Z;try{m(f)}catch(ae){Sl(ae)}f.currentTarget=null,m=L}}}}function Be(e,n){var a=n[ao];a===void 0&&(a=n[ao]=new Set);var s=e+"__bubble";a.has(s)||(Xm(n,e,2,!1),a.add(s))}function Ku(e,n,a){var s=0;n&&(s|=4),Xm(a,e,s,n)}var ss="_reactListening"+Math.random().toString(36).slice(2);function Xu(e){if(!e[ss]){e[ss]=!0,qd.forEach(function(a){a!=="selectionchange"&&(Rx.has(a)||Ku(a,!1,e),Ku(a,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[ss]||(n[ss]=!0,Ku("selectionchange",!1,n))}}function Xm(e,n,a,s){switch(Cp(n)){case 2:var f=e1;break;case 8:f=t1;break;default:f=cc}a=f.bind(null,n,a,e),f=void 0,!po||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(f=!0),s?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 Qu(e,n,a,s,f){var m=s;if((n&1)===0&&(n&2)===0&&s!==null)e:for(;;){if(s===null)return;var b=s.tag;if(b===3||b===4){var j=s.stateNode.containerInfo;if(j===f)break;if(b===4)for(b=s.return;b!==null;){var L=b.tag;if((L===3||L===4)&&b.stateNode.containerInfo===f)return;b=b.return}for(;j!==null;){if(b=ui(j),b===null)return;if(L=b.tag,L===5||L===6||L===26||L===27){s=m=b;continue e}j=j.parentNode}}s=s.return}Wd(function(){var Z=m,ae=ho(a),ue=[];e:{var J=Ef.get(e);if(J!==void 0){var ne=vl,ge=e;switch(e){case"keypress":if(gl(a)===0)break e;case"keydown":case"keyup":ne=bb;break;case"focusin":ge="focus",ne=bo;break;case"focusout":ge="blur",ne=bo;break;case"beforeblur":case"afterblur":ne=bo;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":ne=nf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ne=sb;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ne=kb;break;case Cf:case jf:case Rf:ne=cb;break;case Tf:ne=Cb;break;case"scroll":case"scrollend":ne=ab;break;case"wheel":ne=Rb;break;case"copy":case"cut":case"paste":ne=fb;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ne=af;break;case"toggle":case"beforetoggle":ne=Eb}var Ce=(n&4)!==0,et=!Ce&&(e==="scroll"||e==="scrollend"),P=Ce?J!==null?J+"Capture":null:J;Ce=[];for(var q=Z,Q;q!==null;){var oe=q;if(Q=oe.stateNode,oe=oe.tag,oe!==5&&oe!==26&&oe!==27||Q===null||P===null||(oe=sa(q,P),oe!=null&&Ce.push(Ua(q,oe,Q))),et)break;q=q.return}0<Ce.length&&(J=new ne(J,ge,null,a,ae),ue.push({event:J,listeners:Ce}))}}if((n&7)===0){e:{if(J=e==="mouseover"||e==="pointerover",ne=e==="mouseout"||e==="pointerout",J&&a!==fo&&(ge=a.relatedTarget||a.fromElement)&&(ui(ge)||ge[oi]))break e;if((ne||J)&&(J=ae.window===ae?ae:(J=ae.ownerDocument)?J.defaultView||J.parentWindow:window,ne?(ge=a.relatedTarget||a.toElement,ne=Z,ge=ge?ui(ge):null,ge!==null&&(et=d(ge),Ce=ge.tag,ge!==et||Ce!==5&&Ce!==27&&Ce!==6)&&(ge=null)):(ne=null,ge=Z),ne!==ge)){if(Ce=nf,oe="onMouseLeave",P="onMouseEnter",q="mouse",(e==="pointerout"||e==="pointerover")&&(Ce=af,oe="onPointerLeave",P="onPointerEnter",q="pointer"),et=ne==null?J:la(ne),Q=ge==null?J:la(ge),J=new Ce(oe,q+"leave",ne,a,ae),J.target=et,J.relatedTarget=Q,oe=null,ui(ae)===Z&&(Ce=new Ce(P,q+"enter",ge,a,ae),Ce.target=Q,Ce.relatedTarget=et,oe=Ce),et=oe,ne&&ge)t:{for(Ce=Tx,P=ne,q=ge,Q=0,oe=P;oe;oe=Ce(oe))Q++;oe=0;for(var xe=q;xe;xe=Ce(xe))oe++;for(;0<Q-oe;)P=Ce(P),Q--;for(;0<oe-Q;)q=Ce(q),oe--;for(;Q--;){if(P===q||q!==null&&P===q.alternate){Ce=P;break t}P=Ce(P),q=Ce(q)}Ce=null}else Ce=null;ne!==null&&Qm(ue,J,ne,Ce,!1),ge!==null&&et!==null&&Qm(ue,et,ge,Ce,!0)}}e:{if(J=Z?la(Z):window,ne=J.nodeName&&J.nodeName.toLowerCase(),ne==="select"||ne==="input"&&J.type==="file")var Fe=hf;else if(df(J))if(mf)Fe=Bb;else{Fe=_b;var ve=zb}else ne=J.nodeName,!ne||ne.toLowerCase()!=="input"||J.type!=="checkbox"&&J.type!=="radio"?Z&&co(Z.elementType)&&(Fe=hf):Fe=Lb;if(Fe&&(Fe=Fe(e,Z))){ff(ue,Fe,a,ae);break e}ve&&ve(e,J,Z),e==="focusout"&&Z&&J.type==="number"&&Z.memoizedProps.value!=null&&uo(J,"number",J.value)}switch(ve=Z?la(Z):window,e){case"focusin":(df(ve)||ve.contentEditable==="true")&&(vi=ve,jo=Z,pa=null);break;case"focusout":pa=jo=vi=null;break;case"mousedown":Ro=!0;break;case"contextmenu":case"mouseup":case"dragend":Ro=!1,kf(ue,a,ae);break;case"selectionchange":if(Ub)break;case"keydown":case"keyup":kf(ue,a,ae)}var Me;if(So)e:{switch(e){case"compositionstart":var qe="onCompositionStart";break e;case"compositionend":qe="onCompositionEnd";break e;case"compositionupdate":qe="onCompositionUpdate";break e}qe=void 0}else yi?uf(e,a)&&(qe="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(qe="onCompositionStart");qe&&(lf&&a.locale!=="ko"&&(yi||qe!=="onCompositionStart"?qe==="onCompositionEnd"&&yi&&(Me=ef()):(ir=ae,go="value"in ir?ir.value:ir.textContent,yi=!0)),ve=os(Z,qe),0<ve.length&&(qe=new rf(qe,e,null,a,ae),ue.push({event:qe,listeners:ve}),Me?qe.data=Me:(Me=cf(a),Me!==null&&(qe.data=Me)))),(Me=Ab?Ib(e,a):Db(e,a))&&(qe=os(Z,"onBeforeInput"),0<qe.length&&(ve=new rf("onBeforeInput","beforeinput",null,a,ae),ue.push({event:ve,listeners:qe}),ve.data=Me)),wx(ue,e,Z,a,ae)}Km(ue,n)})}function Ua(e,n,a){return{instance:e,listener:n,currentTarget:a}}function os(e,n){for(var a=n+"Capture",s=[];e!==null;){var f=e,m=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||m===null||(f=sa(e,a),f!=null&&s.unshift(Ua(e,f,m)),f=sa(e,n),f!=null&&s.push(Ua(e,f,m))),e.tag===3)return s;e=e.return}return[]}function Tx(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Qm(e,n,a,s,f){for(var m=n._reactName,b=[];a!==null&&a!==s;){var j=a,L=j.alternate,Z=j.stateNode;if(j=j.tag,L!==null&&L===s)break;j!==5&&j!==26&&j!==27||Z===null||(L=Z,f?(Z=sa(a,m),Z!=null&&b.unshift(Ua(a,Z,L))):f||(Z=sa(a,m),Z!=null&&b.push(Ua(a,Z,L)))),a=a.return}b.length!==0&&e.push({event:n,listeners:b})}var Ex=/\r\n?/g,Nx=/\u0000|\uFFFD/g;function Zm(e){return(typeof e=="string"?e:""+e).replace(Ex,`
|
|
9
|
-
`).replace(Nx,"")}function Jm(e,n){return n=Zm(n),Zm(e)===n}function We(e,n,a,s,f,m){switch(a){case"children":typeof s=="string"?n==="body"||n==="textarea"&&s===""||mi(e,s):(typeof s=="number"||typeof s=="bigint")&&n!=="body"&&mi(e,""+s);break;case"className":fl(e,"class",s);break;case"tabIndex":fl(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":fl(e,a,s);break;case"style":Zd(e,s,m);break;case"data":if(n!=="object"){fl(e,"data",s);break}case"src":case"href":if(s===""&&(n!=="a"||a!=="href")){e.removeAttribute(a);break}if(s==null||typeof s=="function"||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(a);break}s=ml(""+s),e.setAttribute(a,s);break;case"action":case"formAction":if(typeof s=="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"&&We(e,n,"name",f.name,f,null),We(e,n,"formEncType",f.formEncType,f,null),We(e,n,"formMethod",f.formMethod,f,null),We(e,n,"formTarget",f.formTarget,f,null)):(We(e,n,"encType",f.encType,f,null),We(e,n,"method",f.method,f,null),We(e,n,"target",f.target,f,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(a);break}s=ml(""+s),e.setAttribute(a,s);break;case"onClick":s!=null&&(e.onclick=_n);break;case"onScroll":s!=null&&Be("scroll",e);break;case"onScrollEnd":s!=null&&Be("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(l(61));if(a=s.__html,a!=null){if(f.children!=null)throw Error(l(60));e.innerHTML=a}}break;case"multiple":e.multiple=s&&typeof s!="function"&&typeof s!="symbol";break;case"muted":e.muted=s&&typeof s!="function"&&typeof s!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(s==null||typeof s=="function"||typeof s=="boolean"||typeof s=="symbol"){e.removeAttribute("xlink:href");break}a=ml(""+s),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":s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(a,""+s):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":s&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":s===!0?e.setAttribute(a,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(a,s):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?e.setAttribute(a,s):e.removeAttribute(a);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?e.removeAttribute(a):e.setAttribute(a,s);break;case"popover":Be("beforetoggle",e),Be("toggle",e),dl(e,"popover",s);break;case"xlinkActuate":zn(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":zn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":zn(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":zn(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":zn(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":zn(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":zn(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":zn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":zn(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":dl(e,"is",s);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=rb.get(a)||a,dl(e,a,s))}}function Zu(e,n,a,s,f,m){switch(a){case"style":Zd(e,s,m);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(l(61));if(a=s.__html,a!=null){if(f.children!=null)throw Error(l(60));e.innerHTML=a}}break;case"children":typeof s=="string"?mi(e,s):(typeof s=="number"||typeof s=="bigint")&&mi(e,""+s);break;case"onScroll":s!=null&&Be("scroll",e);break;case"onScrollEnd":s!=null&&Be("scrollend",e);break;case"onClick":s!=null&&(e.onclick=_n);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Gd.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[qt]||null,m=m!=null?m[a]:null,typeof m=="function"&&e.removeEventListener(n,m,f),typeof s=="function")){typeof m!="function"&&m!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(n,s,f);break e}a in e?e[a]=s:s===!0?e.setAttribute(a,""):dl(e,a,s)}}}function Ot(e,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Be("error",e),Be("load",e);var s=!1,f=!1,m;for(m in a)if(a.hasOwnProperty(m)){var b=a[m];if(b!=null)switch(m){case"src":s=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(l(137,n));default:We(e,n,m,b,a,null)}}f&&We(e,n,"srcSet",a.srcSet,a,null),s&&We(e,n,"src",a.src,a,null);return;case"input":Be("invalid",e);var j=m=b=f=null,L=null,Z=null;for(s in a)if(a.hasOwnProperty(s)){var ae=a[s];if(ae!=null)switch(s){case"name":f=ae;break;case"type":b=ae;break;case"checked":L=ae;break;case"defaultChecked":Z=ae;break;case"value":m=ae;break;case"defaultValue":j=ae;break;case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(l(137,n));break;default:We(e,n,s,ae,a,null)}}Yd(e,m,j,L,Z,b,f,!1);return;case"select":Be("invalid",e),s=b=m=null;for(f in a)if(a.hasOwnProperty(f)&&(j=a[f],j!=null))switch(f){case"value":m=j;break;case"defaultValue":b=j;break;case"multiple":s=j;default:We(e,n,f,j,a,null)}n=m,a=b,e.multiple=!!s,n!=null?hi(e,!!s,n,!1):a!=null&&hi(e,!!s,a,!0);return;case"textarea":Be("invalid",e),m=f=s=null;for(b in a)if(a.hasOwnProperty(b)&&(j=a[b],j!=null))switch(b){case"value":s=j;break;case"defaultValue":f=j;break;case"children":m=j;break;case"dangerouslySetInnerHTML":if(j!=null)throw Error(l(91));break;default:We(e,n,b,j,a,null)}Xd(e,s,f,m);return;case"option":for(L in a)a.hasOwnProperty(L)&&(s=a[L],s!=null)&&(L==="selected"?e.selected=s&&typeof s!="function"&&typeof s!="symbol":We(e,n,L,s,a,null));return;case"dialog":Be("beforetoggle",e),Be("toggle",e),Be("cancel",e),Be("close",e);break;case"iframe":case"object":Be("load",e);break;case"video":case"audio":for(s=0;s<Ha.length;s++)Be(Ha[s],e);break;case"image":Be("error",e),Be("load",e);break;case"details":Be("toggle",e);break;case"embed":case"source":case"link":Be("error",e),Be("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(Z in a)if(a.hasOwnProperty(Z)&&(s=a[Z],s!=null))switch(Z){case"children":case"dangerouslySetInnerHTML":throw Error(l(137,n));default:We(e,n,Z,s,a,null)}return;default:if(co(n)){for(ae in a)a.hasOwnProperty(ae)&&(s=a[ae],s!==void 0&&Zu(e,n,ae,s,a,void 0));return}}for(j in a)a.hasOwnProperty(j)&&(s=a[j],s!=null&&We(e,n,j,s,a,null))}function Ax(e,n,a,s){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,b=null,j=null,L=null,Z=null,ae=null;for(ne in a){var ue=a[ne];if(a.hasOwnProperty(ne)&&ue!=null)switch(ne){case"checked":break;case"value":break;case"defaultValue":L=ue;default:s.hasOwnProperty(ne)||We(e,n,ne,null,s,ue)}}for(var J in s){var ne=s[J];if(ue=a[J],s.hasOwnProperty(J)&&(ne!=null||ue!=null))switch(J){case"type":m=ne;break;case"name":f=ne;break;case"checked":Z=ne;break;case"defaultChecked":ae=ne;break;case"value":b=ne;break;case"defaultValue":j=ne;break;case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(l(137,n));break;default:ne!==ue&&We(e,n,J,ne,s,ue)}}oo(e,b,j,L,Z,ae,m,f);return;case"select":ne=b=j=J=null;for(m in a)if(L=a[m],a.hasOwnProperty(m)&&L!=null)switch(m){case"value":break;case"multiple":ne=L;default:s.hasOwnProperty(m)||We(e,n,m,null,s,L)}for(f in s)if(m=s[f],L=a[f],s.hasOwnProperty(f)&&(m!=null||L!=null))switch(f){case"value":J=m;break;case"defaultValue":j=m;break;case"multiple":b=m;default:m!==L&&We(e,n,f,m,s,L)}n=j,a=b,s=ne,J!=null?hi(e,!!a,J,!1):!!s!=!!a&&(n!=null?hi(e,!!a,n,!0):hi(e,!!a,a?[]:"",!1));return;case"textarea":ne=J=null;for(j in a)if(f=a[j],a.hasOwnProperty(j)&&f!=null&&!s.hasOwnProperty(j))switch(j){case"value":break;case"children":break;default:We(e,n,j,null,s,f)}for(b in s)if(f=s[b],m=a[b],s.hasOwnProperty(b)&&(f!=null||m!=null))switch(b){case"value":J=f;break;case"defaultValue":ne=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(l(91));break;default:f!==m&&We(e,n,b,f,s,m)}Kd(e,J,ne);return;case"option":for(var ge in a)J=a[ge],a.hasOwnProperty(ge)&&J!=null&&!s.hasOwnProperty(ge)&&(ge==="selected"?e.selected=!1:We(e,n,ge,null,s,J));for(L in s)J=s[L],ne=a[L],s.hasOwnProperty(L)&&J!==ne&&(J!=null||ne!=null)&&(L==="selected"?e.selected=J&&typeof J!="function"&&typeof J!="symbol":We(e,n,L,J,s,ne));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 Ce in a)J=a[Ce],a.hasOwnProperty(Ce)&&J!=null&&!s.hasOwnProperty(Ce)&&We(e,n,Ce,null,s,J);for(Z in s)if(J=s[Z],ne=a[Z],s.hasOwnProperty(Z)&&J!==ne&&(J!=null||ne!=null))switch(Z){case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(l(137,n));break;default:We(e,n,Z,J,s,ne)}return;default:if(co(n)){for(var et in a)J=a[et],a.hasOwnProperty(et)&&J!==void 0&&!s.hasOwnProperty(et)&&Zu(e,n,et,void 0,s,J);for(ae in s)J=s[ae],ne=a[ae],!s.hasOwnProperty(ae)||J===ne||J===void 0&&ne===void 0||Zu(e,n,ae,J,s,ne);return}}for(var P in a)J=a[P],a.hasOwnProperty(P)&&J!=null&&!s.hasOwnProperty(P)&&We(e,n,P,null,s,J);for(ue in s)J=s[ue],ne=a[ue],!s.hasOwnProperty(ue)||J===ne||J==null&&ne==null||We(e,n,ue,J,s,ne)}function Wm(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Ix(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,a=performance.getEntriesByType("resource"),s=0;s<a.length;s++){var f=a[s],m=f.transferSize,b=f.initiatorType,j=f.duration;if(m&&j&&Wm(b)){for(b=0,j=f.responseEnd,s+=1;s<a.length;s++){var L=a[s],Z=L.startTime;if(Z>j)break;var ae=L.transferSize,ue=L.initiatorType;ae&&Wm(ue)&&(L=L.responseEnd,b+=ae*(L<j?1:(j-Z)/(L-Z)))}if(--s,n+=8*(m+b)/(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 Ju=null,Wu=null;function us(e){return e.nodeType===9?e:e.ownerDocument}function ep(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 tp(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 ec(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 tc=null;function Dx(){var e=window.event;return e&&e.type==="popstate"?e===tc?!1:(tc=e,!0):(tc=null,!1)}var np=typeof setTimeout=="function"?setTimeout:void 0,Ox=typeof clearTimeout=="function"?clearTimeout:void 0,rp=typeof Promise=="function"?Promise:void 0,Mx=typeof queueMicrotask=="function"?queueMicrotask:typeof rp<"u"?function(e){return rp.resolve(null).then(e).catch(zx)}:np;function zx(e){setTimeout(function(){throw e})}function Sr(e){return e==="head"}function ip(e,n){var a=n,s=0;do{var f=a.nextSibling;if(e.removeChild(a),f&&f.nodeType===8)if(a=f.data,a==="/$"||a==="/&"){if(s===0){e.removeChild(f),Vi(n);return}s--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")s++;else if(a==="html")qa(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,qa(a);for(var m=a.firstChild;m;){var b=m.nextSibling,j=m.nodeName;m[aa]||j==="SCRIPT"||j==="STYLE"||j==="LINK"&&m.rel.toLowerCase()==="stylesheet"||a.removeChild(m),m=b}}else a==="body"&&qa(e.ownerDocument.body);a=f}while(a);Vi(n)}function ap(e,n){var a=e;e=0;do{var s=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||""),s&&s.nodeType===8)if(a=s.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=s}while(a)}function nc(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":nc(a),lo(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function _x(e,n,a,s){for(;e.nodeType===1;){var f=a;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[aa])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=yn(e.nextSibling),e===null)break}return null}function Lx(e,n,a){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=yn(e.nextSibling),e===null))return null;return e}function lp(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=yn(e.nextSibling),e===null))return null;return e}function rc(e){return e.data==="$?"||e.data==="$~"}function ic(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Bx(e,n){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||a.readyState!=="loading")n();else{var s=function(){n(),a.removeEventListener("DOMContentLoaded",s)};a.addEventListener("DOMContentLoaded",s),e._reactRetry=s}}function yn(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 ac=null;function sp(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(n===0)return yn(e.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}e=e.nextSibling}return null}function op(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 up(e,n,a){switch(n=us(a),e){case"html":if(e=n.documentElement,!e)throw Error(l(452));return e;case"head":if(e=n.head,!e)throw Error(l(453));return e;case"body":if(e=n.body,!e)throw Error(l(454));return e;default:throw Error(l(451))}}function qa(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);lo(e)}var vn=new Map,cp=new Set;function cs(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Jn=U.d;U.d={f:Hx,r:Ux,D:qx,C:Gx,L:$x,m:Fx,X:Px,S:Vx,M:Yx};function Hx(){var e=Jn.f(),n=ts();return e||n}function Ux(e){var n=ci(e);n!==null&&n.tag===5&&n.type==="form"?Th(n):Jn.r(e)}var Gi=typeof document>"u"?null:document;function dp(e,n,a){var s=Gi;if(s&&typeof n=="string"&&n){var f=cn(n);f='link[rel="'+e+'"][href="'+f+'"]',typeof a=="string"&&(f+='[crossorigin="'+a+'"]'),cp.has(f)||(cp.add(f),e={rel:e,crossOrigin:a,href:n},s.querySelector(f)===null&&(n=s.createElement("link"),Ot(n,"link",e),jt(n),s.head.appendChild(n)))}}function qx(e){Jn.D(e),dp("dns-prefetch",e,null)}function Gx(e,n){Jn.C(e,n),dp("preconnect",e,n)}function $x(e,n,a){Jn.L(e,n,a);var s=Gi;if(s&&e&&n){var f='link[rel="preload"][as="'+cn(n)+'"]';n==="image"&&a&&a.imageSrcSet?(f+='[imagesrcset="'+cn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(f+='[imagesizes="'+cn(a.imageSizes)+'"]')):f+='[href="'+cn(e)+'"]';var m=f;switch(n){case"style":m=$i(e);break;case"script":m=Fi(e)}vn.has(m)||(e=y({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:e,as:n},a),vn.set(m,e),s.querySelector(f)!==null||n==="style"&&s.querySelector(Ga(m))||n==="script"&&s.querySelector($a(m))||(n=s.createElement("link"),Ot(n,"link",e),jt(n),s.head.appendChild(n)))}}function Fx(e,n){Jn.m(e,n);var a=Gi;if(a&&e){var s=n&&typeof n.as=="string"?n.as:"script",f='link[rel="modulepreload"][as="'+cn(s)+'"][href="'+cn(e)+'"]',m=f;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":m=Fi(e)}if(!vn.has(m)&&(e=y({rel:"modulepreload",href:e},n),vn.set(m,e),a.querySelector(f)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector($a(m)))return}s=a.createElement("link"),Ot(s,"link",e),jt(s),a.head.appendChild(s)}}}function Vx(e,n,a){Jn.S(e,n,a);var s=Gi;if(s&&e){var f=di(s).hoistableStyles,m=$i(e);n=n||"default";var b=f.get(m);if(!b){var j={loading:0,preload:null};if(b=s.querySelector(Ga(m)))j.loading=5;else{e=y({rel:"stylesheet",href:e,"data-precedence":n},a),(a=vn.get(m))&&lc(e,a);var L=b=s.createElement("link");jt(L),Ot(L,"link",e),L._p=new Promise(function(Z,ae){L.onload=Z,L.onerror=ae}),L.addEventListener("load",function(){j.loading|=1}),L.addEventListener("error",function(){j.loading|=2}),j.loading|=4,ds(b,n,s)}b={type:"stylesheet",instance:b,count:1,state:j},f.set(m,b)}}}function Px(e,n){Jn.X(e,n);var a=Gi;if(a&&e){var s=di(a).hoistableScripts,f=Fi(e),m=s.get(f);m||(m=a.querySelector($a(f)),m||(e=y({src:e,async:!0},n),(n=vn.get(f))&&sc(e,n),m=a.createElement("script"),jt(m),Ot(m,"link",e),a.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},s.set(f,m))}}function Yx(e,n){Jn.M(e,n);var a=Gi;if(a&&e){var s=di(a).hoistableScripts,f=Fi(e),m=s.get(f);m||(m=a.querySelector($a(f)),m||(e=y({src:e,async:!0,type:"module"},n),(n=vn.get(f))&&sc(e,n),m=a.createElement("script"),jt(m),Ot(m,"link",e),a.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},s.set(f,m))}}function fp(e,n,a,s){var f=(f=Y.current)?cs(f):null;if(!f)throw Error(l(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(n=$i(a.href),a=di(f).hoistableStyles,s=a.get(n),s||(s={type:"style",instance:null,count:0,state:null},a.set(n,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=$i(a.href);var m=di(f).hoistableStyles,b=m.get(e);if(b||(f=f.ownerDocument||f,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},m.set(e,b),(m=f.querySelector(Ga(e)))&&!m._p&&(b.instance=m,b.state.loading=5),vn.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},vn.set(e,a),m||Kx(f,e,a,b.state))),n&&s===null)throw Error(l(528,""));return b}if(n&&s!==null)throw Error(l(529,""));return null;case"script":return n=a.async,a=a.src,typeof a=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=Fi(a),a=di(f).hoistableScripts,s=a.get(n),s||(s={type:"script",instance:null,count:0,state:null},a.set(n,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,e))}}function $i(e){return'href="'+cn(e)+'"'}function Ga(e){return'link[rel="stylesheet"]['+e+"]"}function hp(e){return y({},e,{"data-precedence":e.precedence,precedence:null})}function Kx(e,n,a,s){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?s.loading=1:(n=e.createElement("link"),s.preload=n,n.addEventListener("load",function(){return s.loading|=1}),n.addEventListener("error",function(){return s.loading|=2}),Ot(n,"link",a),jt(n),e.head.appendChild(n))}function Fi(e){return'[src="'+cn(e)+'"]'}function $a(e){return"script[async]"+e}function mp(e,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var s=e.querySelector('style[data-href~="'+cn(a.href)+'"]');if(s)return n.instance=s,jt(s),s;var f=y({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),jt(s),Ot(s,"style",f),ds(s,a.precedence,e),n.instance=s;case"stylesheet":f=$i(a.href);var m=e.querySelector(Ga(f));if(m)return n.state.loading|=4,n.instance=m,jt(m),m;s=hp(a),(f=vn.get(f))&&lc(s,f),m=(e.ownerDocument||e).createElement("link"),jt(m);var b=m;return b._p=new Promise(function(j,L){b.onload=j,b.onerror=L}),Ot(m,"link",s),n.state.loading|=4,ds(m,a.precedence,e),n.instance=m;case"script":return m=Fi(a.src),(f=e.querySelector($a(m)))?(n.instance=f,jt(f),f):(s=a,(f=vn.get(m))&&(s=y({},a),sc(s,f)),e=e.ownerDocument||e,f=e.createElement("script"),jt(f),Ot(f,"link",s),e.head.appendChild(f),n.instance=f);case"void":return null;default:throw Error(l(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(s=n.instance,n.state.loading|=4,ds(s,a.precedence,e));return n.instance}function ds(e,n,a){for(var s=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=s.length?s[s.length-1]:null,m=f,b=0;b<s.length;b++){var j=s[b];if(j.dataset.precedence===n)m=j;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 lc(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function sc(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var fs=null;function pp(e,n,a){if(fs===null){var s=new Map,f=fs=new Map;f.set(a,s)}else f=fs,s=f.get(a),s||(s=new Map,f.set(a,s));if(s.has(e))return s;for(s.set(e,null),a=a.getElementsByTagName(e),f=0;f<a.length;f++){var m=a[f];if(!(m[aa]||m[Nt]||e==="link"&&m.getAttribute("rel")==="stylesheet")&&m.namespaceURI!=="http://www.w3.org/2000/svg"){var b=m.getAttribute(n)||"";b=e+b;var j=s.get(b);j?j.push(m):s.set(b,[m])}}return s}function gp(e,n,a){e=e.ownerDocument||e,e.head.insertBefore(a,n==="title"?e.querySelector("head > title"):null)}function Xx(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 yp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Qx(e,n,a,s){if(a.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var f=$i(s.href),m=n.querySelector(Ga(f));if(m){n=m._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=hs.bind(e),n.then(e,e)),a.state.loading|=4,a.instance=m,jt(m);return}m=n.ownerDocument||n,s=hp(s),(f=vn.get(f))&&lc(s,f),m=m.createElement("link"),jt(m);var b=m;b._p=new Promise(function(j,L){b.onload=j,b.onerror=L}),Ot(m,"link",s),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=hs.bind(e),n.addEventListener("load",a),n.addEventListener("error",a))}}var oc=0;function Zx(e,n){return e.stylesheets&&e.count===0&&ps(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var s=setTimeout(function(){if(e.stylesheets&&ps(e,e.stylesheets),e.unsuspend){var m=e.unsuspend;e.unsuspend=null,m()}},6e4+n);0<e.imgBytes&&oc===0&&(oc=62500*Ix());var f=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ps(e,e.stylesheets),e.unsuspend)){var m=e.unsuspend;e.unsuspend=null,m()}},(e.imgBytes>oc?50:800)+n);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(f)}}:null}function hs(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ps(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var ms=null;function ps(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ms=new Map,n.forEach(Jx,e),ms=null,hs.call(e))}function Jx(e,n){if(!(n.state.loading&4)){var a=ms.get(e);if(a)var s=a.get(null);else{a=new Map,ms.set(e,a);for(var f=e.querySelectorAll("link[data-precedence],style[data-precedence]"),m=0;m<f.length;m++){var b=f[m];(b.nodeName==="LINK"||b.getAttribute("media")!=="not all")&&(a.set(b.dataset.precedence,b),s=b)}s&&a.set(null,s)}f=n.instance,b=f.getAttribute("data-precedence"),m=a.get(b)||s,m===s&&a.set(null,f),a.set(b,f),this.count++,s=hs.bind(this),f.addEventListener("load",s),f.addEventListener("error",s),m?m.parentNode.insertBefore(f,m.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(f,e.firstChild)),n.state.loading|=4}}var Fa={$$typeof:A,Provider:null,Consumer:null,_currentValue:_,_currentValue2:_,_threadCount:0};function Wx(e,n,a,s,f,m,b,j,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=no(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=no(0),this.hiddenUpdates=no(null),this.identifierPrefix=s,this.onUncaughtError=f,this.onCaughtError=m,this.onRecoverableError=b,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=L,this.incompleteTransitions=new Map}function vp(e,n,a,s,f,m,b,j,L,Z,ae,ue){return e=new Wx(e,n,a,b,L,Z,ae,ue,j),n=1,m===!0&&(n|=24),m=en(3,null,null,n),e.current=m,m.stateNode=e,n=qo(),n.refCount++,e.pooledCache=n,n.refCount++,m.memoizedState={element:s,isDehydrated:a,cache:n},Vo(m),e}function bp(e){return e?(e=Si,e):Si}function xp(e,n,a,s,f,m){f=bp(f),s.context===null?s.context=f:s.pendingContext=f,s=cr(n),s.payload={element:a},m=m===void 0?null:m,m!==null&&(s.callback=m),a=dr(e,s,n),a!==null&&(Yt(a,e,n),ka(a,e,n))}function Sp(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<n?a:n}}function uc(e,n){Sp(e,n),(e=e.alternate)&&Sp(e,n)}function kp(e){if(e.tag===13||e.tag===31){var n=Lr(e,67108864);n!==null&&Yt(n,e,67108864),uc(e,67108864)}}function wp(e){if(e.tag===13||e.tag===31){var n=ln();n=ro(n);var a=Lr(e,n);a!==null&&Yt(a,e,n),uc(e,n)}}var gs=!0;function e1(e,n,a,s){var f=O.T;O.T=null;var m=U.p;try{U.p=2,cc(e,n,a,s)}finally{U.p=m,O.T=f}}function t1(e,n,a,s){var f=O.T;O.T=null;var m=U.p;try{U.p=8,cc(e,n,a,s)}finally{U.p=m,O.T=f}}function cc(e,n,a,s){if(gs){var f=dc(s);if(f===null)Qu(e,n,s,ys,a),jp(e,s);else if(r1(f,e,n,a,s))s.stopPropagation();else if(jp(e,s),n&4&&-1<n1.indexOf(e)){for(;f!==null;){var m=ci(f);if(m!==null)switch(m.tag){case 3:if(m=m.stateNode,m.current.memoizedState.isDehydrated){var b=Rn(m.pendingLanes);if(b!==0){var j=m;for(j.pendingLanes|=2,j.entangledLanes|=2;b;){var L=1<<31-Ie(b);j.entanglements[1]|=L,b&=~L}An(m),(Pe&6)===0&&(Wl=ee()+500,Ba(0))}}break;case 31:case 13:j=Lr(m,2),j!==null&&Yt(j,m,2),ts(),uc(m,2)}if(m=dc(s),m===null&&Qu(e,n,s,ys,a),m===f)break;f=m}f!==null&&s.stopPropagation()}else Qu(e,n,s,null,a)}}function dc(e){return e=ho(e),fc(e)}var ys=null;function fc(e){if(ys=null,e=ui(e),e!==null){var n=d(e);if(n===null)e=null;else{var a=n.tag;if(a===13){if(e=u(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 ys=e,null}function Cp(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(Se()){case re:return 2;case fe:return 8;case be:case Re:return 32;case Te:return 268435456;default:return 32}default:return 32}}var hc=!1,kr=null,wr=null,Cr=null,Va=new Map,Pa=new Map,jr=[],n1="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 jp(e,n){switch(e){case"focusin":case"focusout":kr=null;break;case"dragenter":case"dragleave":wr=null;break;case"mouseover":case"mouseout":Cr=null;break;case"pointerover":case"pointerout":Va.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Pa.delete(n.pointerId)}}function Ya(e,n,a,s,f,m){return e===null||e.nativeEvent!==m?(e={blockedOn:n,domEventName:a,eventSystemFlags:s,nativeEvent:m,targetContainers:[f]},n!==null&&(n=ci(n),n!==null&&kp(n)),e):(e.eventSystemFlags|=s,n=e.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),e)}function r1(e,n,a,s,f){switch(n){case"focusin":return kr=Ya(kr,e,n,a,s,f),!0;case"dragenter":return wr=Ya(wr,e,n,a,s,f),!0;case"mouseover":return Cr=Ya(Cr,e,n,a,s,f),!0;case"pointerover":var m=f.pointerId;return Va.set(m,Ya(Va.get(m)||null,e,n,a,s,f)),!0;case"gotpointercapture":return m=f.pointerId,Pa.set(m,Ya(Pa.get(m)||null,e,n,a,s,f)),!0}return!1}function Rp(e){var n=ui(e.target);if(n!==null){var a=d(n);if(a!==null){if(n=a.tag,n===13){if(n=u(a),n!==null){e.blockedOn=n,Hd(e.priority,function(){wp(a)});return}}else if(n===31){if(n=h(a),n!==null){e.blockedOn=n,Hd(e.priority,function(){wp(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 vs(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var a=dc(e.nativeEvent);if(a===null){a=e.nativeEvent;var s=new a.constructor(a.type,a);fo=s,a.target.dispatchEvent(s),fo=null}else return n=ci(a),n!==null&&kp(n),e.blockedOn=a,!1;n.shift()}return!0}function Tp(e,n,a){vs(e)&&a.delete(n)}function i1(){hc=!1,kr!==null&&vs(kr)&&(kr=null),wr!==null&&vs(wr)&&(wr=null),Cr!==null&&vs(Cr)&&(Cr=null),Va.forEach(Tp),Pa.forEach(Tp)}function bs(e,n){e.blockedOn===n&&(e.blockedOn=null,hc||(hc=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,i1)))}var xs=null;function Ep(e){xs!==e&&(xs=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){xs===e&&(xs=null);for(var n=0;n<e.length;n+=3){var a=e[n],s=e[n+1],f=e[n+2];if(typeof s!="function"){if(fc(s||a)===null)continue;break}var m=ci(a);m!==null&&(e.splice(n,3),n-=3,du(m,{pending:!0,data:f,method:a.method,action:s},s,f))}}))}function Vi(e){function n(L){return bs(L,e)}kr!==null&&bs(kr,e),wr!==null&&bs(wr,e),Cr!==null&&bs(Cr,e),Va.forEach(n),Pa.forEach(n);for(var a=0;a<jr.length;a++){var s=jr[a];s.blockedOn===e&&(s.blockedOn=null)}for(;0<jr.length&&(a=jr[0],a.blockedOn===null);)Rp(a),a.blockedOn===null&&jr.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(s=0;s<a.length;s+=3){var f=a[s],m=a[s+1],b=f[qt]||null;if(typeof m=="function")b||Ep(a);else if(b){var j=null;if(m&&m.hasAttribute("formAction")){if(f=m,b=m[qt]||null)j=b.formAction;else if(fc(f)!==null)continue}else j=b.action;typeof j=="function"?a[s+1]=j:(a.splice(s,3),s-=3),Ep(a)}}}function Np(){function e(m){m.canIntercept&&m.info==="react-transition"&&m.intercept({handler:function(){return new Promise(function(b){return f=b})},focusReset:"manual",scroll:"manual"})}function n(){f!==null&&(f(),f=null),s||setTimeout(a,20)}function a(){if(!s&&!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 s=!1,f=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){s=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),f!==null&&(f(),f=null)}}}function mc(e){this._internalRoot=e}Ss.prototype.render=mc.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(l(409));var a=n.current,s=ln();xp(a,s,e,n,null,null)},Ss.prototype.unmount=mc.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;xp(e.current,2,null,e,null,null),ts(),n[oi]=null}};function Ss(e){this._internalRoot=e}Ss.prototype.unstable_scheduleHydration=function(e){if(e){var n=Bd();e={blockedOn:null,target:e,priority:n};for(var a=0;a<jr.length&&n!==0&&n<jr[a].priority;a++);jr.splice(a,0,e),a===0&&Rp(e)}};var Ap=r.version;if(Ap!=="19.2.8")throw Error(l(527,Ap,"19.2.8"));U.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(l(188)):(e=Object.keys(e).join(","),Error(l(268,e)));return e=p(n),e=e!==null?v(e):null,e=e===null?null:e.stateNode,e};var a1={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:O,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ks=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ks.isDisabled&&ks.supportsFiber)try{we=ks.inject(a1),Ne=ks}catch{}}return Xa.createRoot=function(e,n){if(!o(e))throw Error(l(299));var a=!1,s="",f=Lh,m=Bh,b=Hh;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onUncaughtError!==void 0&&(f=n.onUncaughtError),n.onCaughtError!==void 0&&(m=n.onCaughtError),n.onRecoverableError!==void 0&&(b=n.onRecoverableError)),n=vp(e,1,!1,null,null,a,s,null,f,m,b,Np),e[oi]=n.current,Xu(e),new mc(n)},Xa.hydrateRoot=function(e,n,a){if(!o(e))throw Error(l(299));var s=!1,f="",m=Lh,b=Bh,j=Hh,L=null;return a!=null&&(a.unstable_strictMode===!0&&(s=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(m=a.onUncaughtError),a.onCaughtError!==void 0&&(b=a.onCaughtError),a.onRecoverableError!==void 0&&(j=a.onRecoverableError),a.formState!==void 0&&(L=a.formState)),n=vp(e,1,!0,n,a??null,s,f,L,m,b,j,Np),n.context=bp(null),a=n.current,s=ln(),s=ro(s),f=cr(s),f.callback=null,dr(a,f,s),a=s,n.current.lanes=a,ia(n,a),An(n),e[oi]=n.current,Xu(e),new Ss(n)},Xa.version="19.2.8",Xa}var Up;function m1(){if(Up)return yc.exports;Up=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(),yc.exports=h1(),yc.exports}var p1=m1();function Qr(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(l=>{if(typeof l=="string")return l;if(l&&typeof l=="object"){const o=l;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 g1(t){const r=Qr(t.at)??Qr(t.timestamp)??Qr(t.recordedAt)??"",i=Qr(t.errorMessage)??Qr(t.label)??Qr(t.type)??Qr(t.message)??"运行事件";return r?`${r} · ${i}`:i}function tl(t){return String(t.nodeId??t.id??"").trim()}function Sc(t){const r=tl(t);return String(t.label??t.name??(r||"未命名节点"))}function qp(t,r){if(t.length===0)return;const i=r?.trim();if(i){const d=t.find(u=>tl(u)===i);if(d)return d}const l=t.find(d=>{const u=String(d.status??"").toLowerCase();return u.includes("fail")||u.includes("error")||u==="blocked"});return l||(t.find(d=>{const u=String(d.status??"").toLowerCase();return u==="running"||u==="in_progress"||u==="active"})??t[0])}function y1({dagRunId:t,nodeId:r,onClose:i,onOpenFull:l}){const o=k.useRef(null),[d,u]=k.useState(null),[h,g]=k.useState([]),[p,v]=k.useState(null),[y,S]=k.useState(!0);k.useEffect(()=>{o.current?.focus();const T=N=>{N.key==="Escape"&&i()};return document.addEventListener("keydown",T),document.title=`检视 · DAG ${t} · Loop Operator`,()=>document.removeEventListener("keydown",T)},[t,i]),k.useEffect(()=>{const T=new AbortController;return S(!0),v(null),g([]),(async()=>{try{const N=await fetch(`/api/dag-runs/${encodeURIComponent(t)}`,{signal:T.signal,credentials:"same-origin"});if(!N.ok)throw new Error(`DAG 查询失败(HTTP ${N.status})`);const A=await N.json();if(T.signal.aborted)return;u(A);const G=Array.isArray(A.nodes)?A.nodes:[],K=qp(G,r),E=K?tl(K):r?.trim();if(E){const $=await fetch(`/api/dag-runs/${encodeURIComponent(t)}/nodes/${encodeURIComponent(E)}/session-events`,{signal:T.signal,credentials:"same-origin"});if($.ok){const te=await $.json();T.signal.aborted||g((te.events??[]).slice(-20))}}}catch(N){T.signal.aborted||v(N instanceof Error?N.message:String(N))}finally{T.signal.aborted||S(!1)}})(),()=>T.abort()},[t,r]);const x=k.useMemo(()=>Array.isArray(d?.nodes)?d.nodes:[],[d]),w=qp(x,r),I=w?tl(w):"",H=String(d?.effectiveStatus??d?.status??(y?"加载中…":"未知"));return c.jsxs("aside",{className:"inspect-split-panel","aria-label":"DAG 紧凑检视",children:[c.jsxs("div",{className:"inspect-split-header",children:[c.jsxs("div",{children:[c.jsx("p",{className:"inspect-split-kicker",children:"Inspect"}),c.jsx("h2",{children:"检视 DAG"})]}),c.jsx("button",{ref:o,type:"button","aria-label":"关闭检视面板",onClick:i,children:"关闭"})]}),c.jsx("p",{className:"inspect-split-id",children:c.jsx("code",{children:t})}),p?c.jsx("p",{className:"error",children:p}):null,y&&!d?c.jsx("p",{className:"muted",children:"正在加载 DAG…"}):null,c.jsxs("dl",{className:"inspect-split-facts",children:[c.jsxs("div",{children:[c.jsx("dt",{children:"状态"}),c.jsx("dd",{children:H})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"当前节点"}),c.jsx("dd",{children:w?Sc(w):"暂无节点"})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"节点状态"}),c.jsx("dd",{children:w?.status??"—"})]}),w?.errorPreview?c.jsxs("div",{children:[c.jsx("dt",{children:"错误摘要"}),c.jsx("dd",{children:w.errorPreview})]}):null]}),c.jsxs("section",{children:[c.jsxs("h3",{children:["节点(",x.length,")"]}),x.length?c.jsx("ul",{className:"inspect-split-nodes",children:x.slice(0,24).map(T=>{const N=tl(T)||Sc(T),A=N===I;return c.jsxs("li",{"data-active":A?"true":void 0,className:A?"is-active":void 0,children:[c.jsx("span",{children:Sc(T)}),c.jsx("code",{children:T.status??"—"})]},N)})}):c.jsx("p",{className:"muted",children:y?"加载节点中…":"该运行暂无节点。"})]}),c.jsxs("section",{children:[c.jsxs("h3",{children:["最近事件",I?` · ${I}`:""]}),h.length?c.jsx("ul",{className:"inspect-split-events",children:h.map((T,N)=>c.jsx("li",{children:g1(T)},`${T.at??N}-${N}`))}):c.jsx("p",{className:"muted",children:y?"加载事件中…":"节点事件将在可用时显示。"})]}),c.jsx("button",{type:"button",className:"btn btn-secondary",onClick:l,children:"全屏观测"}),c.jsx("p",{className:"muted",children:"全屏后点顶栏「返回操作台」可回来。"})]})}function v1(t){const{board:r,busy:i}=t;return c.jsxs("details",{className:"night-advanced","data-testid":"night-advanced",open:r.advancedOpen,onToggle:l=>r.setAdvancedOpen(l.target.open),children:[c.jsx("summary",{children:"高级 / Inspect"}),c.jsxs("p",{className:"muted",children:["只读深链:"," ",c.jsx("a",{className:"external-link",href:"/inspect/#/night",children:"/inspect/#/night"})]}),c.jsx("div",{className:"cta-row",children:c.jsx("button",{type:"button",className:"btn btn-secondary",disabled:i,"data-testid":"night-morning-btn",onClick:()=>{r.onMorningReport()},children:"早晨 night 报告"})}),r.morningPreview?c.jsx("pre",{className:"cmd","data-testid":"night-morning-preview",children:r.morningPreview}):null]})}function ws(t){return!t||typeof t!="object"||Array.isArray(t)?null:t}function pt(t,r){const i=t[r];return typeof i=="string"&&i.trim()?i.trim():void 0}function Gp(t,r){const i=t[r];if(!Array.isArray(i))return;const l=i.filter(o=>typeof o=="string");return l.length>0?l:void 0}function b1(t){const r=ws(t);if(!r)return null;const i=ws(r.result),l=[ws(r.reviewPacket),i?ws(i.reviewPacket):null,i,r].filter(Boolean);for(const o of l){const d=pt(o,"scheduleId")??pt(o,"id"),u=pt(o,"gateToken")??pt(o,"approveGate")??pt(o,"writeSetGateToken");if(!(!d||!u))return{scheduleId:d,gateToken:u,...pt(o,"featureId")?{featureId:pt(o,"featureId")}:{},...pt(o,"taskId")?{taskId:pt(o,"taskId")}:{},...Gp(o,"writeSet")?{writeSet:Gp(o,"writeSet")}:{},...pt(o,"worktreePath")?{worktreePath:pt(o,"worktreePath")}:{},...pt(o,"branch")?{branch:pt(o,"branch")}:{},...pt(o,"baseBranch")?{baseBranch:pt(o,"baseBranch")}:{},...pt(o,"baseCommit")?{baseCommit:pt(o,"baseCommit")}:{},...pt(o,"executeAtUtc")?{executeAtUtc:pt(o,"executeAtUtc")}:{},...pt(o,"taskCard")?{taskCard:pt(o,"taskCard")}:{}}}return null}function $p(t){return`docs/features/${t.trim().replace(/^\/+|\/+$/g,"")}`}function x1(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 Fp(){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 ly(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 S1(t){return t.mergeState==="pending-harvest"||/\bscheduler harvest\b/i.test(t.nextAction)}function k1(t){return t.status==="failed"||t.status==="human_required"||t.status==="cancelled"||/\bscheduler discard\b/i.test(t.nextAction)}function Is(t){return t==="failed"||t==="human_required"}function w1(t){return`${t}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function sy(t){return{submitted:"已提交",validating:"校验中",validated:"待预约确认",scheduled:"已预约",waiting:"等待触发",dispatching:"派发中",running:"执行中",succeeded:"成功",failed:"失败",human_required:"需人工",cancelled:"已取消",rejected:"已拒绝",cancel_requested:"取消中"}[t]??t}function C1(t){const{target:r,reason:i,onReasonChange:l,force:o,onForceChange:d,busy:u}=t;return c.jsxs("div",{className:"night-discard-card","data-testid":"night-discard-card",children:[c.jsx("h3",{children:"确认 Discard"}),c.jsxs("p",{className:"muted",children:[r.featureId,"/",r.taskId,"(",sy(r.status),")"]}),c.jsxs("label",{className:"field",children:[c.jsx("span",{className:"muted",children:"原因"}),c.jsx("input",{"data-testid":"night-discard-reason",value:i,disabled:u,placeholder:"human discard reason",onChange:h=>l(h.target.value)})]}),Is(r.status)?c.jsxs("label",{className:"field checkbox-field",children:[c.jsx("input",{type:"checkbox","data-testid":"night-discard-force",checked:o,disabled:u,onChange:h=>d(h.target.checked)}),c.jsx("span",{className:"muted",children:"强制 Discard(failed / human_required)"})]}):null,c.jsxs("div",{className:"cta-row",children:[c.jsx("button",{type:"button",className:"btn btn-primary",disabled:u||Is(r.status)&&!o,"data-testid":"night-discard-confirm",onClick:t.onConfirm,children:"确认 Discard"}),c.jsx("button",{type:"button",className:"btn btn-secondary",disabled:u,onClick:t.onCancel,children:"返回"})]})]})}function j1(t){const{board:r}=t,{doctor:i,list:l,clockHint:o,doctorIssues:d,auxTicker:u}=r;return c.jsxs("div",{className:"night-health","data-testid":"night-health-bar",children:[c.jsxs("div",{className:"night-health-main",children:[c.jsx("span",{className:`night-health-pill${i?.ok===!1?" is-bad":""}`,children:i?.ok===!1?"Scheduler 异常":"Scheduler 健康"}),c.jsxs("span",{className:"muted",children:["计划 ",i?.scheduleCount??l?.summary.total??"—"," · 活动"," ",i?.activeCount??l?.summary.active??"—"]})]}),o?c.jsxs("p",{className:"muted night-health-hint","data-testid":"night-clock-hint",children:["时钟:",o.message,"(安装/启停请用 CLI:",c.jsx("code",{children:"agent-worker scheduler clock status --repo ."}),")"]}):c.jsxs("p",{className:"muted night-health-hint",children:["到点执行依赖本机 clock / tick,不在此面板安装。详见"," ",c.jsx("a",{className:"external-link",href:"/inspect/#/night",children:"/inspect/#/night"})]}),c.jsxs("div",{className:"night-aux-ticker","data-testid":"night-aux-ticker",children:[c.jsxs("p",{className:"night-aux-ticker-label",children:["开着 Console 时辅助 tick(每 ",u?.intervalSec??60,"s)"]}),c.jsx("p",{className:"muted night-health-hint","data-testid":"night-aux-ticker-disclaimer",children:u?.disclaimer??"仅在本 Console 进程开着时有效;过夜无人值守仍需 OS clock。"}),u?.lastOutcome?c.jsxs("p",{className:"muted","data-testid":"night-aux-ticker-last",children:["上次:",u.lastOutcome,u.running?"(进行中)":"",u.lastSummary?` · ${u.lastSummary}`:"",u.lastError?` · ${u.lastError}`:""]}):null]}),d.length>0?c.jsx("ul",{className:"night-doctor-list","data-testid":"night-doctor-findings",children:d.slice(0,4).map(h=>c.jsxs("li",{children:[c.jsx("strong",{children:h.severity})," ",h.message]},`${h.code}-${h.scheduleId??""}-${h.message}`))}):null]})}function R1(t){const{board:r,busy:i,onHarvest:l,onOpenDiscard:o}=t,{list:d}=r;return c.jsxs(c.Fragment,{children:[d?c.jsxs("div",{className:"night-kpi","data-testid":"night-kpi",children:[c.jsxs("span",{children:["合计 ",d.summary.total]}),c.jsxs("span",{children:["活动 ",d.summary.active]}),c.jsxs("span",{children:["待收成 ",d.summary.pendingHarvest]}),c.jsxs("span",{children:["需人工 ",d.summary.humanRequired]}),c.jsxs("span",{children:["失败 ",d.summary.failed]})]}):null,c.jsxs("div",{className:"night-board","data-testid":"night-board",children:[c.jsx("h3",{children:"计划列表"}),!d||d.schedules.length===0?c.jsxs("div",{className:"empty-state","data-testid":"night-board-empty",children:[c.jsx("p",{className:"empty-title",children:"暂无夜间计划"}),c.jsx("p",{className:"muted",children:"用下方向导预约第一个任务。"})]}):c.jsx("ul",{className:"night-schedule-list",children:d.schedules.map(u=>c.jsxs("li",{className:"night-schedule-row","data-testid":"night-schedule-row","data-status":u.status,children:[c.jsxs("div",{className:"night-schedule-head",children:[c.jsxs("strong",{children:[u.featureId,"/",u.taskId]}),c.jsx("span",{className:"night-status-chip",children:sy(u.status)})]}),c.jsxs("p",{className:"muted",children:["执行 ",ly(u.executeAtUtc),u.mergeState?` · merge ${u.mergeState}`:"",u.taskCard?` · ${u.taskCard}`:""]}),u.waitingReason?c.jsxs("p",{className:"muted",children:["等待原因:",u.waitingReason]}):null,c.jsxs("p",{className:"muted night-next-action",children:["下一步:",u.nextAction]}),c.jsxs("div",{className:"cta-row",children:[S1(u)?c.jsx("button",{type:"button",className:"btn btn-primary",disabled:i,"data-testid":"night-row-harvest",onClick:()=>l(u),children:"Harvest"}):null,k1(u)?c.jsx("button",{type:"button",className:"btn btn-secondary",disabled:i,"data-testid":"night-row-discard",onClick:()=>o(u),children:"Discard"}):null,c.jsx("a",{className:"external-link",href:`/inspect/#/night/${encodeURIComponent(u.scheduleId)}`,children:"Inspect"})]})]},u.scheduleId))})]})]})}function T1(t){const{wizard:r,busy:i}=t;return c.jsxs("div",{className:"night-wizard","data-testid":"night-wizard",children:[c.jsx("h3",{children:"预约夜间任务"}),r.phase==="pick"?c.jsxs(c.Fragment,{children:[r.selectableTasks.length===0?c.jsxs("div",{className:"empty-state","data-testid":"night-task-empty",children:[c.jsx("p",{className:"empty-title",children:"没有可选任务"}),c.jsx("p",{className:"muted",children:"请先在 Feature Packet / Task Pool 中创建任务,再回到此处刷新。"})]}):c.jsxs("label",{className:"field",children:[c.jsx("span",{className:"muted",children:"Feature / Task"}),c.jsxs("select",{"data-testid":"night-task-select",value:r.selectedKey,disabled:i,onChange:l=>r.setSelectedKey(l.target.value),children:[c.jsx("option",{value:"",children:"选择任务…"}),r.selectableTasks.map(l=>{const o=`${l.featureId}::${l.taskId}`;return c.jsxs("option",{value:o,children:[l.featureId,"/",l.taskId,l.status?` · ${l.status}`:""]},o)})]})]}),r.derivedFeatureDir?c.jsxs("p",{className:"muted","data-testid":"night-feature-dir",children:["Feature 目录:",c.jsx("code",{children:r.derivedFeatureDir})]}):null,c.jsxs("label",{className:"field",children:[c.jsx("span",{className:"muted",children:"本地执行时间"}),c.jsx("input",{type:"datetime-local","data-testid":"night-at",value:r.nightAt,disabled:i,onChange:l=>r.setNightAt(l.target.value)})]}),c.jsxs("label",{className:"field",children:[c.jsx("span",{className:"muted",children:"任务卡片(可选)"}),c.jsx("input",{"data-testid":"night-task-card",value:r.taskCard,disabled:i,placeholder:"UCP-LOOP#11",onChange:l=>r.setTaskCard(l.target.value)})]}),c.jsx("div",{className:"cta-row",children:c.jsx("button",{type:"button",className:"btn btn-primary",disabled:i||!r.selectedKey||!r.nightAt,"data-testid":"night-prepare-btn",onClick:()=>{r.onPrepare()},children:"准备并审阅"})})]}):c.jsxs("div",{className:"night-review-card","data-testid":"night-review-card",children:[c.jsx("p",{className:"muted",children:"请确认 writeSet 与执行环境后预约。Token 已隐藏。"}),c.jsxs("dl",{className:"kv",children:[c.jsxs("div",{children:[c.jsx("dt",{children:"Schedule"}),c.jsx("dd",{children:c.jsx("code",{children:r.review?.scheduleId})})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"任务"}),c.jsxs("dd",{children:[r.review?.featureId,"/",r.review?.taskId]})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"执行时间 (UTC)"}),c.jsx("dd",{children:ly(r.review?.executeAtUtc)})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"Worktree"}),c.jsx("dd",{children:c.jsx("code",{children:r.review?.worktreePath??"—"})})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"分支"}),c.jsx("dd",{children:c.jsx("code",{children:r.review?.branch??"—"})})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"Base"}),c.jsx("dd",{children:c.jsxs("code",{children:[r.review?.baseBranch??"—","@",(r.review?.baseCommit??"").slice(0,12)||"—"]})})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"WriteSet"}),c.jsx("dd",{children:r.review?.writeSet&&r.review.writeSet.length>0?c.jsx("ul",{className:"night-writeset",children:r.review.writeSet.map(l=>c.jsx("li",{children:c.jsx("code",{children:l})},l))}):c.jsx("span",{className:"muted",children:"(未返回显式 writeSet)"})})]})]}),c.jsxs("div",{className:"cta-row",children:[c.jsx("button",{type:"button",className:"btn btn-primary",disabled:i||!r.review,"data-testid":"night-confirm-add-btn",onClick:()=>{r.onConfirmAdd()},children:"确认预约"}),c.jsx("button",{type:"button",className:"btn btn-secondary",disabled:i,"data-testid":"night-review-back-btn",onClick:r.onCancelWizard,children:"返回修改"})]})]})]})}function E1(t){const{setOpError:r}=t,[i,l]=k.useState(null),[o,d]=k.useState(null),[u,h]=k.useState([]),[g,p]=k.useState(null),[v,y]=k.useState(!1),[S,x]=k.useState(!1),[w,I]=k.useState(null),[H,T]=k.useState(null),N=k.useCallback(async()=>{y(!0),p(null);try{const[E,$,te,se]=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(!E.ok)throw new Error(`加载计划列表失败(HTTP ${E.status})`);const z=await E.json();if(l(z),$.ok?d(await $.json()):d(null),te.ok){const V=await te.json();h(Array.isArray(V)?V:[])}else h([]);if(se.ok){const V=await se.json();V.ticker&&T(V.ticker)}}catch(E){p(E instanceof Error?E.message:String(E))}finally{y(!1)}},[]);k.useEffect(()=>{N()},[N]);const A=k.useCallback(async()=>{try{const E=await fetch("/api/night-jobs/morning",{credentials:"same-origin"});if(!E.ok){r(`早晨报告加载失败(HTTP ${E.status})`);return}const $=await E.json();I(JSON.stringify($,null,2).slice(0,4e3)),x(!0)}catch(E){r(E instanceof Error?E.message:String(E))}},[r]),G=(o?.findings??[]).filter(E=>E.severity==="error"||E.severity==="warning"),K=(o?.findings??[]).find(E=>/clock/i.test(E.code)||/clock/i.test(E.message));return{list:i,doctor:o,tasks:u,loadError:g,loadingBoard:v,advancedOpen:S,setAdvancedOpen:x,morningPreview:w,auxTicker:H,refreshBoard:N,onMorningReport:A,doctorIssues:G,clockHint:K}}function N1(t){const{board:r,runAction:i,isActionSuccess:l,setOpError:o}=t,{tasks:d,refreshBoard:u}=r,[h,g]=k.useState("pick"),[p,v]=k.useState(""),[y,S]=k.useState(Fp),[x,w]=k.useState(""),[I,H]=k.useState(null),[T,N]=k.useState(""),[A,G]=k.useState(null),[K,E]=k.useState(!1),$=k.useMemo(()=>{const U=d.filter(_=>typeof _.featureId=="string"&&_.featureId.trim()&&_.taskId);return U.sort((_,W)=>{const R=_.featureId??"",D=W.featureId??"";return R!==D?R.localeCompare(D):_.taskId.localeCompare(W.taskId)}),U},[d]),te=k.useMemo(()=>p?$.find(U=>`${U.featureId}::${U.taskId}`===p)??null:null,[$,p]),se=te?.featureId?$p(te.featureId):"",z=k.useCallback(async(U,_,W)=>{const R=await i("prepareMutationGate",{action:U,actionParams:_});if(!l(R))return;const D=R?.result??R,M=D.receiptId?D:D.result??D;if(!M.receiptId||!M.humanGateToken){o("prepareMutationGate 未返回可消费的 Human Gate receipt");return}return i(U,{..._,confirmationId:M.receiptId,humanGateToken:M.humanGateToken},{clientRequestId:w1(W)})},[l,i,o]),V=k.useCallback(async()=>{if(!te?.featureId){o("请先点选 Feature / Task");return}const U=x1(y);if(!U){o("执行时间格式无效,请使用日期时间选择器");return}const _={featureDir:$p(te.featureId),taskId:te.taskId,at:U,tz:"Asia/Shanghai",...x.trim()?{taskCard:x.trim()}:{}},W=await z("workerAdmissionPrepare",_,"night-prepare");if(!l(W))return;const R=b1(W?.result??W);if(!R){o("准备成功但未解析到 scheduleId / gateToken。请刷新后重试,或查看 Inspect。");return}H(R),g("review")},[l,y,z,te,o,x]),F=k.useCallback(async()=>{if(!I)return;const U=await z("workerSchedulerAdd",{scheduleId:I.scheduleId,approveGate:I.gateToken},"night-add");l(U)&&(H(null),g("pick"),v(""),w(""),S(Fp()),await u())},[l,u,I,z]),le=k.useCallback(()=>{g("pick"),H(null)},[]),X=k.useCallback(async U=>{const _=await z("workerSchedulerHarvest",{scheduleId:U.scheduleId},"night-harvest");l(_)&&await u()},[l,u,z]),B=k.useCallback(async()=>{if(!A)return;const U=T.trim()||"discard from console night workbench",_=Is(A.status),W=await z("workerSchedulerDiscard",{scheduleId:A.scheduleId,reason:U,..._||K?{force:!0}:{}},"night-discard");l(W)&&(G(null),N(""),E(!1),await u())},[T,A,K,l,u,z]),O=k.useCallback(U=>{G(U),E(Is(U.status)),N("")},[]);return{phase:h,selectedKey:p,setSelectedKey:v,nightAt:y,setNightAt:S,taskCard:x,setTaskCard:w,review:I,discardReason:T,setDiscardReason:N,discardTarget:A,setDiscardTarget:G,forceDiscard:K,setForceDiscard:E,selectableTasks:$,derivedFeatureDir:se,onPrepare:V,onConfirmAdd:F,onCancelWizard:le,onHarvest:X,onDiscard:B,openDiscard:O}}function A1({busy:t,runAction:r,isActionSuccess:i,setOpError:l}){const o=E1({setOpError:l}),d=N1({board:o,runAction:r,isActionSuccess:i,setOpError:l});return c.jsxs("section",{className:"panel night-workbench","aria-labelledby":"night-title","data-testid":"night-jobs-panel",children:[c.jsx("h2",{id:"night-title",children:"夜间任务"}),c.jsx("p",{className:"panel-lead",children:"白天点选任务并预约;列表查看状态;早晨在行内收成或丢弃。写操作仍经 Human Gate,列表复用 Inspect 投影。"}),c.jsx(j1,{board:o,busy:t}),c.jsx("div",{className:"cta-row",children:c.jsx("button",{type:"button",className:"btn btn-secondary",disabled:t||o.loadingBoard,"data-testid":"night-refresh-btn",onClick:()=>{o.refreshBoard()},children:"刷新看板"})}),o.loadError?c.jsx("p",{className:"error","data-testid":"night-load-error",children:o.loadError}):null,c.jsx(R1,{board:o,busy:t,onHarvest:u=>{d.onHarvest(u)},onOpenDiscard:d.openDiscard}),d.discardTarget?c.jsx(C1,{target:d.discardTarget,reason:d.discardReason,onReasonChange:d.setDiscardReason,force:d.forceDiscard,onForceChange:d.setForceDiscard,busy:t,onConfirm:()=>{d.onDiscard()},onCancel:()=>d.setDiscardTarget(null)}):null,c.jsx(T1,{wizard:d,busy:t}),c.jsx(v1,{board:o,busy:t})]})}var I1=ay();const D1=({color:t="currentColor",size:r=24,className:i,...l})=>Ir.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:t,...l,className:"remixicon "+(i||"")},Ir.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"})),O1=({color:t="currentColor",size:r=24,className:i,...l})=>Ir.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:t,...l,className:"remixicon "+(i||"")},Ir.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"})),M1=({color:t="currentColor",size:r=24,className:i,...l})=>Ir.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:t,...l,className:"remixicon "+(i||"")},Ir.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"})),z1=({color:t="currentColor",size:r=24,className:i,...l})=>Ir.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:t,...l,className:"remixicon "+(i||"")},Ir.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"})),_1=["command","query","operation","tool","server","symbol","path","file_path","filePath","pattern","glob","url"],L1=120,B1=800;function Ds(t){if(!(!t||typeof t!="object"||Array.isArray(t)))return t}function H1(t){if(t!=null){if(typeof t=="string"){const r=t.trim();if(!r)return;try{return Ds(JSON.parse(r))}catch{return}}return Ds(t)}}function er(t,r){const i=t.replace(/\s+/g," ").trim();return i?i.length>r?`${i.slice(0,r)}…`:i:""}function Ct(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 U1(t,r,i){const l=(t??"").toLowerCase();if(l==="bash"||l==="shell"){const o=Ct(r,"command");return o?er(o,i):void 0}if(l==="mcp"||l.startsWith("mcp_")){const o=Ct(r,"server"),d=Ct(r,"tool")??Ct(r,"name"),u=Ct(r,"query");return o&&d?er(`${o} · ${d}`,i):d?er(d,i):u?er(u,i):o?er(o,i):void 0}if(l==="lsp_navigation"||l.includes("lsp")){const o=[Ct(r,"operation"),Ct(r,"symbol"),Ct(r,"path")??Ct(r,"file_path")??Ct(r,"filePath")].filter(Boolean),d=Ct(r,"line")??Ct(r,"position");if(o.length===0&&!d)return;const u=o.join(" · ");return er(d?`${u}${u?":":""}${d}`:u,i)}if(l==="symbol_search"||l.includes("symbol_search")){const o=Ct(r,"query")??Ct(r,"symbol");return o?er(o,i):void 0}if(l==="read"||l==="read_symbol"||l==="read_enclosing"||l.startsWith("read_")){const o=Ct(r,"path")??Ct(r,"file_path")??Ct(r,"filePath"),d=Ct(r,"symbol"),u=Ct(r,"line");if(!o&&!d)return;const h=[o,d,u].filter(Boolean);return er(h.join(" · "),i)}}function q1(t,r){const i=r?.maxLen??L1,l=H1(t);if(!l){if(typeof t=="string"){const g=t.replace(/\s+/g," ").trim();return!g||g==="{}"?"":g.length>i?`${g.slice(0,i)}…`:g}return""}const o=U1(r?.toolName,l,i);if(o)return o;for(const g of _1){const p=l[g];if(typeof p=="string"&&p.trim())return er(p,i)}const d=Object.keys(l);if(d.length===0)return"";const u=l[d[0]],h=String(u??"").replace(/\s+/g," ").trim();return h?h.length>i?`${h.slice(0,i)}…`:h:""}function G1(t){const r=(t??"").toLowerCase();return r==="bash"||r==="shell"?{argsLabel:"命令",resultLabel:"输出"}:r==="mcp"||r.startsWith("mcp_")?{argsLabel:"参数",resultLabel:"结果"}:{argsLabel:"入参",resultLabel:"结果"}}function oy(t){if(t==null)return"";if(typeof t=="string"){const l=t.trim();if(!l)return"";if(l.startsWith("{")&&l.endsWith("}")||l.startsWith("[")&&l.endsWith("]"))try{return oy(JSON.parse(l))}catch{return t}return t}if(typeof t=="number"||typeof t=="boolean")return String(t);const r=Ds(t);if(!r)try{return JSON.stringify(t,null,2)}catch{return String(t)}const i=r.content;if(Array.isArray(i)){const l=[];for(const o of i){const d=Ds(o);d&&(d.type==="text"&&typeof d.text=="string"||typeof d.text=="string")&&l.push(d.text)}if(l.length>0)return l.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 $1(t){if(t==null)return"";try{return typeof t=="string"?t:JSON.stringify(t,null,2)}catch{return String(t)}}function F1(t,r){if(t===void 0)return{text:"",truncated:!1};const i=r?.maxLen??B1;return t.length<=i?{text:t,truncated:!1}:{text:`${t.slice(0,i)}…`,truncated:!0}}function V1(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 Xt(){return window.__CONSOLE_CONFIRMATION_TOKEN__??""}function Wr(t){return`${t}-${Math.random().toString(36).slice(2,10)}`}function kc(t,r){return new Promise((i,l)=>{if(r?.aborted){l(new DOMException("Aborted","AbortError"));return}const o=setTimeout(()=>{r?.removeEventListener("abort",d),i()},t),d=()=>{clearTimeout(o),l(new DOMException("Aborted","AbortError"))};r?.addEventListener("abort",d)})}function uy(t){return new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function wc(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 P1(t,r){return t?t.taskId===r.taskId&&t.updatedAt===r.updatedAt&&t.lastEventId===r.lastEventId&&t.operations.length===r.operations.length:!1}const cy={status:"idle",snapshot:null,error:null,reloading:!1,reloadError:null,mutationBusy:!1,mutationToken:null};function cd(t){if(!t||typeof t!="object")return{message:"runtime snapshot request failed"};const r=t,i=r.error;if(i&&typeof i=="object"){const l=i;return{...typeof l.code=="string"&&l.code?{code:l.code}:{},...typeof r.status=="number"?{status:r.status}:{},message:typeof l.message=="string"&&l.message?l.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 Y1(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{...cy};default:return t}}function dy(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 K1(t,r,i,l){const o=i&&i.sessionId===l?dy(i):{},d=o.model??t?.model,u=o.thinkingLevel??t?.thinkingLevel;return{readOnly:r.readOnly,systemPrompt:r.systemPrompt,resources:r.resources,suffix:r.suffix,...d?{model:d}:{},...u?{thinkingLevel:u}:{}}}function X1(t=cy){let r=t;const i=new Set;return{getState:()=>r,dispatch:l=>{r=Y1(r,l);for(const o of i)o();return r},subscribe:l=>(i.add(l),()=>i.delete(l))}}const ft=X1();let Ar;function fy(t){return`/api/operator/v1/chat/sessions/${encodeURIComponent(t)}`}function Q1(t){const r=Ar;if(Ar=t,!(r&&r.sessionId===t.sessionId&&r.origin===t.origin)){if((!r||r.sessionId!==t.sessionId)&&ft.dispatch({type:"mutation-reset"}),!t.sessionId){ft.dispatch({type:"reset"});return}ft.dispatch({type:"load-start",sessionId:t.sessionId}),hy(t.sessionId,t.origin)}}async function hy(t,r){try{const i=await fetch(`${r}${fy(t)}/runtime-snapshot`,{credentials:"include"}),l=await i.json().catch(()=>({}));if(Ar?.sessionId!==t)return;if(!i.ok){ft.dispatch({type:"load-failure",sessionId:t,error:{...cd(l),status:i.status}});return}if(!l.snapshot){ft.dispatch({type:"load-failure",sessionId:t,error:{status:i.status,message:"runtime snapshot missing in response"}});return}ft.dispatch({type:"load-success",sessionId:t,snapshot:l.snapshot})}catch(i){if(Ar?.sessionId!==t)return;ft.dispatch({type:"load-failure",sessionId:t,error:{message:i instanceof Error?i.message:String(i)}})}}async function Qi(){const t=Ar;if(!t?.sessionId||ft.getState().reloading)return!1;const r=t.sessionId;ft.dispatch({type:"reload-start"});try{const i=await fetch(`${t.origin}${fy(r)}/reload`,{method:"POST",credentials:"include",headers:{"content-type":"application/json","x-loop-console-confirmation":Xt()},body:"{}"}),l=await i.json().catch(()=>({}));return Ar?.sessionId!==r?!1:i.ok?l.snapshot?(ft.dispatch({type:"reload-success",snapshot:l.snapshot}),!0):(ft.dispatch({type:"reload-failure",error:{status:i.status,message:"reload succeeded but snapshot missing"}}),!1):(ft.dispatch({type:"reload-failure",error:{...cd(l),status:i.status}}),!1)}catch(i){return Ar?.sessionId!==r||ft.dispatch({type:"reload-failure",error:{message:i instanceof Error?i.message:String(i)}}),!1}}async function Zi(){const t=Ar;if(!t?.sessionId)return!1;const r=t.sessionId;return ft.dispatch({type:"load-start",sessionId:r}),hy(r,t.origin),!0}function Z1(t,r,i){return i?(ft.dispatch({type:"mutation-adopt",token:t,sessionId:r,snapshot:i}),ft.getState().snapshot===i):!1}function J1(t,r,i){return i.sessionRef.current?.sessionId!==r||ft.getState().mutationToken!==t?!1:(ft.dispatch({type:"mutation-settle",token:t}),!0)}function Wi(){return k.useSyncExternalStore(ft.subscribe,ft.getState)}function my(t){ft.dispatch(t)}function W1(){return ft.getState()}function eS(t,r,i){return`${t}/api/operator/v1/chat/sessions/${encodeURIComponent(r)}/skills/${encodeURIComponent(i)}/auto-invocation`}async function tS(t){const r=t.fetchImpl??fetch;try{const i=await r(eS(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})}),l=await i.json().catch(()=>({}));if(!i.ok||l.ok===!1)return{ok:!1,error:{...cd(l),status:i.status}};const o=l.preferenceSaved===!0,d=l.reloadApplied===!0;if(!o)return{ok:!1,error:{status:i.status,code:"PI_RESOURCE_PREFERENCES_WRITE_FAILED",message:"preference was not saved"}};if(!d){const u=l.error?.code??"PI_SESSION_BUSY",h=l.error?.message??"preference saved; current session is busy and was not reloaded";return{ok:!0,preferenceSaved:!0,reloadApplied:!1,...l.snapshot?{snapshot:l.snapshot}:{},partialBusy:{code:u,message:h}}}return{ok:!0,preferenceSaved:!0,reloadApplied:!0,...l.snapshot?{snapshot:l.snapshot}:{}}}catch(i){return{ok:!1,error:{message:i instanceof Error?i.message:String(i)}}}}function nS(t){return t.autoInvocationEnabled?{badge:"允许自动使用",help:"模型可自动选择该技能,也可通过 /skill:<name> 手动调用。"}:{badge:"已隐藏自动使用",help:`已从模型自动技能列表隐藏,仍可通过 /skill:${t.name} 手动调用。`}}const Vc=()=>window.__CONSOLE_CONFIRMATION_TOKEN__??"";function rS({origin:t}){const[r,i]=k.useState(null),[l,o]=k.useState(null),[d,u]=k.useState(null),[h,g]=k.useState(!1),p=Wi(),v=p.snapshot,y=p.reloading,S=p.reloadError,x=v?.diagnostics??[],w=async N=>{i(N),u(null);{o(null);try{const A=await fetch(`${t}/api/operator/v1/pi/models-config`,{credentials:"include"}),G=await A.json();if(!A.ok)throw new Error(G.error?.message??"读取失败");o(G.data)}catch(A){u(A instanceof Error?A.message:String(A))}}},I=async N=>{g(!0),u(null);try{const A=await fetch(`${t}/api/operator/v1/pi/models-config`,{method:"PATCH",credentials:"include",headers:{"content-type":"application/json","x-loop-console-confirmation":Vc()},body:JSON.stringify(N)}),G=await A.json();if(!A.ok)throw new Error(G.error?.message??"模型配置保存失败");o(G.data)}catch(A){u(A instanceof Error?A.message:String(A))}finally{g(!1)}},H=async(N,A)=>{g(!0),u(null);try{const G=await fetch(`${t}/api/operator/v1/pi/models-config/test`,{method:"POST",credentials:"include",headers:{"content-type":"application/json","x-loop-console-confirmation":Vc()},body:JSON.stringify({provider:N,modelId:A})}),K=await G.json();if(!G.ok)throw new Error(K.error?.message??"模型测试失败");return K.data?.available===!0}catch(G){return u(G instanceof Error?G.message:String(G)),!1}finally{g(!1)}},T=r==="models"?"Models":r==="skills"?"Skills":"Packages";return c.jsxs("div",{className:"oc-governance",children:[c.jsxs("div",{className:"oc-governance-links",children:[c.jsx("button",{type:"button",onClick:()=>{w("models")},children:"Models"}),c.jsx("button",{type:"button",className:r==="skills"?"is-active":"",onClick:()=>i("skills"),children:"Skills"}),c.jsx("button",{type:"button",className:r==="packages"?"is-active":"",onClick:()=>i("packages"),children:"Packages"})]}),r&&c.jsx("div",{className:"oc-resource-backdrop",onMouseDown:N=>{N.target===N.currentTarget&&i(null)},children:c.jsxs("section",{className:"oc-resource-panel",role:"dialog","aria-modal":"true","aria-label":T,children:[c.jsxs("header",{className:"oc-resource-panel-head",children:[c.jsxs("div",{className:"oc-resource-panel-head-copy",children:[c.jsx("strong",{children:T}),c.jsx("span",{className:"oc-resource-panel-meta",children:r==="models"?"models.json 管理(读写,经 mutation gate)":r==="skills"?"自动使用开关 · 当前 Pi session 实际加载的 Skills":"只读 · 当前 Pi session 实际解析的 Packages"})]}),c.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>i(null),children:"关闭"})]}),c.jsxs("div",{className:"oc-resource-panel-body",children:[x.length>0&&c.jsxs("div",{className:"oc-resource-diagnostics",children:[x.map((N,A)=>c.jsx("div",{className:`oc-resource-diagnostic${N.type==="error"?" is-error":""}`,role:N.type==="error"?"alert":void 0,children:c.jsxs("span",{children:[N.type,N.code?` ${N.code}`:"",":",N.message,N.path?`(${N.path})`:"",N.retryable?" · 可重试":""]})},A)),c.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>{Zi()},children:"重试"})]}),d&&c.jsx("p",{className:"oc-resource-error",children:d}),r==="models"&&c.jsx(iS,{busy:h,data:l,onMutate:I,onTest:H}),r==="skills"&&c.jsx(aS,{origin:t,sessionId:v?.sessionId,status:p.status,loadError:p.error,skills:v?.skills,hasSession:!!v?.sessionId,hasDiagnostics:x.length>0}),r==="packages"&&c.jsx(oS,{status:p.status,loadError:p.error,packages:v?.packages,hasSession:!!v?.sessionId,hasDiagnostics:x.length>0})]}),c.jsxs("footer",{className:"oc-resource-panel-foot",children:[c.jsx("span",{className:"oc-resource-panel-meta",children:y?"正在重新加载会话…":S?`${S.code??"ERROR"}:${S.message}`:v?`revision ${v.revision} · ${v.loadedAt}`:"等待会话快照…"}),c.jsxs("div",{className:"oc-resource-panel-actions",children:[S&&c.jsx("button",{type:"button",className:"btn btn-ghost",disabled:y,onClick:()=>{Qi()},children:"重试"}),p.status==="error"&&c.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>{Zi()},children:"重新读取快照"}),c.jsx("button",{type:"button",className:"btn btn-ghost",disabled:y,onClick:()=>{Qi()},children:"重新加载会话"})]})]})]})})]})}function iS({busy:t,data:r,onMutate:i,onTest:l}){const[o,d]=k.useState(""),[u,h]=k.useState(""),[g,p]=k.useState(""),[v,y]=k.useState(null),S=async x=>{x.preventDefault(),!(!r||!o.trim()||!u.trim())&&(await i({expectedRevision:r.revision,action:"upsert-model",provider:o.trim(),model:{id:u.trim(),...g.trim()?{name:g.trim()}:{}}}),h(""),p(""))};return r?c.jsxs("div",{className:"oc-models-config",children:[c.jsx("p",{className:"oc-resource-panel-meta",children:"Console 不读取或写入 API key;credential 请通过 Pi CLI 配置。"}),r.providers.length===0?c.jsx("p",{className:"oc-resource-empty",children:"models.json 中暂无 Provider(真实空态;用 Pi CLI 配置)。"}):null,r.providers.map(x=>c.jsxs("article",{className:"oc-model-provider",children:[c.jsxs("div",{className:"oc-model-provider-head",children:[c.jsx("strong",{children:x.name}),c.jsx("span",{children:x.credential.configured?"credential configured":"credential 未配置"})]}),x.models.map(w=>c.jsxs("div",{className:"oc-model-row",children:[c.jsx("span",{children:w.name?`${w.name} (${w.id})`:w.id}),c.jsxs("div",{className:"oc-model-row-actions",children:[c.jsx("button",{type:"button",disabled:t,onClick:()=>{l(x.name,w.id).then(I=>y(`${x.name}/${w.id}: ${I?"可用":"不可用"}`))},children:"测试"}),c.jsx("button",{type:"button",disabled:t,onClick:()=>{window.confirm(`确认删除模型 ${x.name}/${w.id}?`)&&i({expectedRevision:r.revision,action:"remove-model",provider:x.name,model:{id:w.id}})},children:"删除"})]})]},w.id)),c.jsx("button",{type:"button",className:"oc-model-provider-remove",disabled:t,onClick:()=>{window.confirm(`确认删除 Provider ${x.name}?`)&&i({expectedRevision:r.revision,action:"remove-provider",provider:x.name})},children:"删除 Provider"})]},x.name)),v&&c.jsx("p",{className:"oc-model-test-result",children:v}),c.jsxs("form",{className:"oc-model-form",onSubmit:x=>{S(x)},children:[c.jsx("strong",{children:"新增或更新模型"}),c.jsx("input",{required:!0,placeholder:"Provider",value:o,onChange:x=>d(x.target.value)}),c.jsx("input",{required:!0,placeholder:"Model ID",value:u,onChange:x=>h(x.target.value)}),c.jsx("input",{placeholder:"显示名称(可选)",value:g,onChange:x=>p(x.target.value)}),c.jsx("button",{type:"submit",disabled:t,children:t?"保存中…":"保存模型"})]})]}):c.jsx("p",{className:"oc-resource-empty",children:"正在读取模型配置…"})}function py(t){return t.status==="loading"?c.jsx("p",{className:"oc-resource-empty",children:"会话快照加载中…"}):t.status==="error"?c.jsxs("div",{className:"oc-resource-error",role:"alert",children:[c.jsxs("span",{children:[t.loadError?.code?`${t.loadError.code}:`:"",t.loadError?.message??"会话快照读取失败"]}),c.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>{Zi()},children:"重试"})]}):t.hasSession?c.jsx("p",{className:"oc-resource-empty",children:t.emptyText}):c.jsx("p",{className:"oc-resource-empty",children:"当前没有活动会话;打开会话后显示真实资源清单(真实空态)。"})}function aS(t){const r=t.skills??[],[i,l]=k.useState(null),[o,d]=k.useState(null),[u,h]=k.useState(null),[g,p]=k.useState({});if(t.status!=="ready"||!t.hasSession)return c.jsx(py,{status:t.status,loadError:t.loadError,hasSession:t.hasSession,emptyText:"当前 session 未加载任何 Skills(真实空态)"});if(r.length===0&&!t.hasDiagnostics)return c.jsx("p",{className:"oc-resource-empty",children:"当前 session 未加载任何 Skills(真实空态,未伪造列表)。"});const v=new Map;for(const x of r){const w=x.scope||"unknown",I=v.get(w)??[];I.push(x),v.set(w,I)}const y=x=>Object.prototype.hasOwnProperty.call(g,x.resourceId)?g[x.resourceId]:x.autoInvocationEnabled,S=async(x,w)=>{if(!t.sessionId||!x.resourceId||i)return;y(x),d(null),h(null),l(x.resourceId),p(H=>({...H,[x.resourceId]:w}));const I=await tS({origin:t.origin,sessionId:t.sessionId,resourceId:x.resourceId,autoInvocationEnabled:w,confirmationToken:Vc()});if(l(null),!I.ok){p(H=>{const T={...H};return delete T[x.resourceId],T}),d(`${I.error.code?`${I.error.code}:`:""}${I.error.message}`);return}if(I.reloadApplied&&I.snapshot){my({type:"load-success",sessionId:t.sessionId,snapshot:I.snapshot}),p(H=>{const T={...H};return delete T[x.resourceId],T}),h(null);return}!I.reloadApplied&&I.partialBusy&&h(`设置已保存;当前会话正忙(${I.partialBusy.code}),请在本轮结束后点击「重新加载会话」。${I.partialBusy.message}`)};return c.jsxs("div",{className:"oc-resource-lists",children:[o?c.jsx("p",{className:"oc-resource-error",role:"alert",children:o}):null,u?c.jsx("p",{className:"oc-skill-partial-notice",role:"status",children:u}):null,[...v.entries()].map(([x,w])=>c.jsxs("section",{className:"oc-resource-group",children:[c.jsxs("header",{className:"oc-resource-group-head",children:[c.jsx("strong",{children:x}),c.jsxs("span",{children:[w.length," 项"]})]}),c.jsx("ul",{className:"oc-resource-list",children:w.map(I=>{const H=y(I),T=nS({name:I.name,autoInvocationEnabled:H}),N=i===I.resourceId;return c.jsxs("li",{className:`oc-resource-item${H?"":" is-auto-off"}`,children:[c.jsxs("div",{className:"oc-resource-item-head",children:[c.jsx("strong",{children:I.name}),c.jsx("span",{children:T.badge})]}),c.jsxs("label",{className:"oc-skill-auto-toggle",children:[c.jsx("input",{type:"checkbox",checked:H,disabled:N||!I.resourceId,"aria-label":`允许自动使用 ${I.name}`,onChange:A=>{S(I,A.target.checked)}}),c.jsx("span",{children:N?"保存中…":"允许自动使用"})]}),c.jsx("p",{className:"oc-skill-auto-help",children:T.help}),I.description?c.jsx("p",{children:I.description}):null,c.jsx("code",{children:I.path}),I.source?c.jsxs("span",{className:"oc-resource-panel-meta",children:["source: ",I.source]}):null,Array.isArray(I.diagnostics)&&I.diagnostics.length>0?c.jsx("span",{className:"oc-resource-diagnostic",children:I.diagnostics.join(";")}):null]},`${x}:${I.resourceId||I.path}`)})})]},x))]})}const lS={extension:"Extensions",skill:"Skills",prompt:"Prompts",theme:"Themes"};function sS(t){return Array.isArray(t.diagnostics)&&t.diagnostics.length>0?"error":t.enabled?t.version?"installed":"loaded":"disabled"}function oS(t){const r=t.packages??[];return t.status!=="ready"||!t.hasSession?c.jsx(py,{status:t.status,loadError:t.loadError,hasSession:t.hasSession,emptyText:"当前 session 未配置 Packages(真实空态)"}):r.length===0&&!t.hasDiagnostics?c.jsx("p",{className:"oc-resource-empty",children:"当前 session 未配置 Packages(真实空态,未伪造列表)。"}):c.jsx("div",{className:"oc-resource-lists",children:r.map(i=>{const l=sS(i),o=new Map;for(const d of i.resolved??[]){const u=lS[d.type]??d.type,h=o.get(u)??[];h.push(d),o.set(u,h)}return c.jsxs("article",{className:"oc-resource-item oc-package",children:[c.jsxs("div",{className:"oc-resource-item-head",children:[c.jsx("strong",{children:i.spec}),c.jsx("span",{className:`oc-package-status is-${l}`,children:l})]}),c.jsxs("p",{className:"oc-resource-panel-meta",children:[i.scope," · ",i.enabled?"loaded":"disabled"]}),i.packageName?c.jsxs("p",{className:"oc-package-meta",children:[c.jsx("span",{children:"package"}),c.jsx("code",{children:i.packageName})]}):null,i.version?c.jsxs("p",{className:"oc-package-meta",children:[c.jsx("span",{children:"installed"}),c.jsxs("code",{children:["v",i.version]})]}):null,i.configuredVersion?c.jsxs("p",{className:"oc-package-meta",children:[c.jsx("span",{children:"configured"}),c.jsx("code",{children:i.configuredVersion})]}):null,i.installedPath?c.jsxs("p",{className:"oc-package-meta",children:[c.jsx("span",{children:"installed path"}),c.jsx("code",{children:i.installedPath})]}):null,i.cwd?c.jsxs("p",{className:"oc-package-meta",children:[c.jsx("span",{children:"cwd"}),c.jsx("code",{children:i.cwd})]}):null,o.size>0?c.jsx("div",{className:"oc-package-resources",children:[...o.entries()].map(([d,u])=>c.jsxs("section",{className:"oc-package-group",children:[c.jsxs("header",{className:"oc-resource-group-head",children:[c.jsx("strong",{children:d}),c.jsxs("span",{children:[u.length," 项"]})]}),c.jsx("ul",{className:"oc-resource-sub-list",children:u.map((h,g)=>c.jsxs("li",{children:[c.jsx("span",{children:h.name||h.path}),c.jsxs("span",{className:"oc-resource-panel-meta",children:[h.scope,h.source?` · ${h.source}`:""]}),c.jsx("code",{children:h.path})]},`${d}:${g}`))})]},d))}):c.jsx("p",{className:"oc-resource-panel-meta",children:"未解析出扩展/技能/提示词/主题(真实空态)"}),Array.isArray(i.diagnostics)&&i.diagnostics.length>0?c.jsx("div",{className:"oc-package-diagnostics",children:i.diagnostics.map((d,u)=>c.jsx("span",{children:d},u))}):null]},`${i.scope}:${i.spec}`)})})}const Os=10,gy="loop-console.operator-chat.sidebar-split.v1",ni=45,Ps=28,Ys=70,Vp=5,Pp=10;function Xi(t){return Number.isFinite(t)?Math.min(Ys,Math.max(Ps,Math.round(t))):ni}function uS(t){if(t==null||t==="")return null;const r=Number(t);if(!Number.isFinite(r))return null;const i=Math.round(r);return i<Ps||i>Ys?null:i}function cS(t=yy()){if(!t)return ni;try{return uS(t.getItem(gy))??ni}catch{return ni}}function Yp(t,r=yy()){const i=Xi(t);if(!r)return i;try{r.setItem(gy,String(i))}catch{}return i}function dS(t,r,i=!1){const l=Xi(t);switch(r){case"ArrowUp":return Xi(l-(i?Pp:Vp));case"ArrowDown":return Xi(l+(i?Pp:Vp));case"Home":return Ps;case"End":return Ys;case"Enter":return ni;default:return null}}function Kp(t,r,i){if(!Number.isFinite(i)||i<=0)return ni;const l=(t-r)/i;return Xi(l*100)}function yy(){try{return typeof globalThis>"u"?null:globalThis.localStorage??null}catch{return null}}const Xp='a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]),select:not([disabled]),[tabindex]:not([tabindex="-1"])';function dd(t){const{open:r,containerRef:i,triggerRef:l,onEscape:o}=t,d=k.useRef(null),u=k.useRef(!1);k.useEffect(()=>{if(r){if(!u.current){const h=document.activeElement;d.current=l?.current??(h instanceof HTMLElement?h:null);const g=i.current;g&&(g.querySelector(Xp)??g).focus?.(),u.current=!0}return()=>{if(!u.current)return;const h=l?.current??d.current;h&&document.contains(h)&&h.focus(),d.current=null,u.current=!1}}u.current=!1},[r,i,l]),k.useEffect(()=>{if(!r)return;const h=i.current;if(!h)return;const g=p=>{if(p.key==="Escape"){p.preventDefault(),o?.();return}if(p.key!=="Tab")return;const v=Array.from(h.querySelectorAll(Xp)).filter(w=>!w.hasAttribute("disabled")&&w.tabIndex!==-1);if(v.length===0){p.preventDefault(),h.focus?.();return}const y=v[0],S=v[v.length-1],x=document.activeElement;p.shiftKey?(x===y||!h.contains(x))&&(p.preventDefault(),S.focus()):(x===S||!h.contains(x))&&(p.preventDefault(),y.focus())};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r,i,o])}function fS(t){const{item:r,active:i,state:l}=t,o=r.title||r.displayTitle||"未命名对话",d=k.useRef(null),[u,h]=k.useState(null),g=k.useRef(null),p=()=>{g.current!==null&&(window.clearTimeout(g.current),g.current=null)},v=()=>{p(),h(null)},y=w=>{if(!(w.scrollWidth>w.clientWidth+1)){v();return}const H=w.getBoundingClientRect();h({x:Math.min(H.right+8,window.innerWidth-16),y:H.top+H.height/2})},S=w=>{w&&(p(),g.current=window.setTimeout(()=>y(w),350))};k.useEffect(()=>{const w=()=>v(),I=H=>{H.key==="Escape"&&v()};return window.addEventListener("scroll",w,!0),window.addEventListener("keydown",I),()=>{window.removeEventListener("scroll",w,!0),window.removeEventListener("keydown",I),p()}},[]);const x=`oc-session-tip-${r.sessionId}`;return c.jsxs("div",{className:`oc-session-item${i?" is-active":""}`,"data-session-id":r.sessionId,children:[c.jsxs("button",{type:"button",className:"oc-session-main",onClick:t.onActivate,onMouseEnter:w=>{const I=w.currentTarget.querySelector("strong");I instanceof HTMLElement&&S(I)},onMouseLeave:v,onFocus:w=>{const I=w.currentTarget.querySelector("strong");I instanceof HTMLElement&&S(I)},onBlur:v,"aria-describedby":u?x:void 0,children:[c.jsxs("strong",{ref:d,children:[o,r.activeTurnId?" · 运行中":""]}),c.jsx("span",{children:new Date(r.updatedAt).toLocaleString()})]}),c.jsxs("div",{className:"oc-session-actions",children:[c.jsx("button",{type:"button",className:"oc-session-menu",title:"重命名会话","aria-label":"重命名会话",onClick:w=>{w.stopPropagation();const I=window.prompt("会话名称",r.title??"");I!==null&&t.onRename(I)},children:c.jsx(M1,{size:16,"aria-hidden":"true"})}),c.jsx("button",{type:"button",className:"oc-session-menu",title:l==="active"?"归档会话":"恢复会话","aria-label":l==="active"?"归档会话":"恢复会话",onClick:w=>{w.stopPropagation(),t.onSetState(l==="active"?"archived":"active")},children:l==="active"?c.jsx(D1,{size:16,"aria-hidden":"true"}):c.jsx(z1,{size:16,"aria-hidden":"true"})}),c.jsx("button",{type:"button",className:"oc-session-menu oc-session-delete",title:"删除会话","aria-label":"删除会话",onClick:w=>{w.stopPropagation(),t.onDelete()},children:c.jsx(O1,{size:16,"aria-hidden":"true"})})]}),u?I1.createPortal(c.jsx("div",{id:x,role:"tooltip",className:"oc-session-title-tooltip",style:{position:"fixed",left:u.x,top:u.y,transform:"translateY(-50%)"},children:o}),document.body):null]})}function hS(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 mS({open:t}){return c.jsx("svg",{className:`oc-tree-chevron${t?" is-open":""}`,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:c.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 pS({open:t}){return t?c.jsxs("svg",{className:"oc-tree-glyph is-folder-open",width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":"true",children:[c.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"}),c.jsx("path",{d:"M1.8 5.8h10.4l-.7 5.2H2.5L1.8 5.8Z",fill:"currentColor",opacity:"0.55"})]}):c.jsx("svg",{className:"oc-tree-glyph is-folder",width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":"true",children:c.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 gS(){return c.jsxs("svg",{className:"oc-tree-glyph is-file",width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":"true",children:[c.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"}),c.jsx("path",{d:"M8.3 1.7v2.5h2.4",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round",opacity:"0.75"})]})}function yS(){return c.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M3 3.5h10v2H3v-2Zm0 3.5h10v2H3V7Zm0 3.5h7V13H3v-2Z",fill:"currentColor"})})}function vS(){return c.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M8 3v10M3 8h10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})})}function bS(){return c.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16","aria-hidden":"true",children:c.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 xS(t){const r=t.sessions.slice(0,Os),[i,l]=k.useState(()=>cS()),[o,d]=k.useState(!1),u=k.useRef(null),h=k.useRef(null),g=t.layoutMode==="comfortable"&&t.open,p=t.layoutMode==="compact",v=t.drawerOpen&&(t.layoutMode==="compact"||t.layoutMode==="narrow");dd({open:v,containerRef:h,triggerRef:t.drawerTriggerRef,onEscape:t.onCloseDrawer});const y=k.useCallback((N,A)=>{const G=Xi(N);l(G),A&&Yp(G)},[]),S=k.useCallback(N=>{const A=dS(i,N.key,N.shiftKey);A!=null&&(N.preventDefault(),y(A,!0))},[y,i]),x=k.useCallback(N=>{N.preventDefault(),N.currentTarget.setPointerCapture(N.pointerId),d(!0);const G=u.current;if(!G)return;const K=G.getBoundingClientRect();y(Kp(N.clientY,K.top,K.height),!1)},[y]),w=k.useCallback(N=>{if(!N.currentTarget.hasPointerCapture(N.pointerId))return;const A=u.current;if(!A)return;const G=A.getBoundingClientRect();y(Kp(N.clientY,G.top,G.height),!1)},[y]),I=k.useCallback(N=>{N.currentTarget.hasPointerCapture(N.pointerId)&&N.currentTarget.releasePointerCapture(N.pointerId),d(!1),Yp(i)},[i]),H=k.useCallback(()=>{y(ni,!0)},[y]),T=c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"oc-sidebar-split",ref:u,style:{"--oc-session-share":`${i}%`,"--oc-repo-share":`${100-i}%`},"data-dragging":o?"true":"false",children:[c.jsxs("section",{className:"oc-sidebar-section oc-sessions",children:[c.jsxs("header",{children:[c.jsx("strong",{children:"会话"}),c.jsxs("div",{className:"oc-sidebar-header-actions",children:[c.jsx("button",{type:"button",className:"btn btn-ghost",onClick:t.onCreate,disabled:t.creatingSession,"aria-busy":t.creatingSession||void 0,children:t.creatingSession?"创建中…":"新建"}),t.layoutMode==="comfortable"?c.jsx("button",{type:"button",className:"oc-sidebar-toggle",onClick:t.onToggleOpen,"aria-expanded":!0,"aria-label":"收起侧栏",title:"收起侧栏",children:c.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":"true",children:c.jsx("path",{d:"M8.8 2.6 5.2 7l3.6 4.4",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}):c.jsx("button",{type:"button",className:"oc-sidebar-toggle",onClick:t.onCloseDrawer,"aria-label":"关闭侧栏抽屉",title:"关闭",children:c.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":"true",children:c.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"})})})]})]}),c.jsxs("div",{className:"oc-session-scroll",children:[["active","archived"].map(N=>{const A=r.filter(G=>G.state===N);return A.length?c.jsxs("div",{className:"oc-session-group",children:[c.jsx("small",{children:N==="active"?"进行中":"已归档"}),A.map(G=>c.jsx(fS,{item:G,active:t.activeSessionId===G.sessionId,state:N,onActivate:()=>t.onActivate(G.sessionId),onRename:K=>t.onRename(G.sessionId,K),onSetState:K=>t.onSetState(G.sessionId,K),onDelete:()=>t.onDelete(G.sessionId)},G.sessionId))]},N):null}),r.length===0?c.jsx("p",{className:"oc-tree-empty",children:"暂无会话,点击上方新建。"}):null]})]}),c.jsx("div",{className:"oc-sidebar-separator",role:"separator","aria-orientation":"horizontal","aria-valuemin":Ps,"aria-valuemax":Ys,"aria-valuenow":i,"aria-label":"调整会话与仓库高度比例",tabIndex:0,onKeyDown:S,onPointerDown:x,onPointerMove:w,onPointerUp:I,onPointerCancel:I,onDoubleClick:H}),c.jsxs("section",{className:"oc-sidebar-section oc-explorer",children:[c.jsxs("header",{children:[c.jsx("strong",{children:"仓库"}),c.jsx("button",{type:"button",className:"btn btn-ghost",onClick:t.onRefreshTree,children:"刷新"})]}),c.jsx("p",{className:"oc-explorer-hint",children:"单击插入 @路径 · 双击预览"}),t.treeError&&c.jsx("p",{className:"oc-sidebar-error",children:t.treeError}),c.jsx("div",{className:"oc-tree-scroll",children:c.jsx(vy,{entries:t.tree[""]??[],tree:t.tree,expanded:t.expanded,depth:0,onToggle:t.onToggleDir,onInsert:t.onInsert,onPreview:t.onPreview})})]})]}),c.jsx(rS,{origin:t.origin})]});return c.jsxs(c.Fragment,{children:[p?c.jsxs("nav",{className:"oc-sidebar-rail","aria-label":"紧凑侧栏",children:[c.jsx("button",{type:"button",className:"oc-sidebar-rail-btn","aria-label":"打开会话与仓库",title:"会话与仓库","aria-expanded":v,onClick:()=>v?t.onCloseDrawer():t.onOpenDrawer(),children:c.jsx(yS,{})}),c.jsx("button",{type:"button",className:"oc-sidebar-rail-btn","aria-label":t.creatingSession?"创建会话中":"新建会话",title:t.creatingSession?"创建中…":"新建会话",onClick:t.onCreate,disabled:t.creatingSession,"aria-busy":t.creatingSession||void 0,children:c.jsx(vS,{})}),c.jsx("button",{type:"button",className:"oc-sidebar-rail-btn","aria-label":"治理入口",title:"治理",onClick:()=>v?t.onCloseDrawer():t.onOpenDrawer(),children:c.jsx(bS,{})})]}):null,t.layoutMode==="comfortable"?c.jsx("aside",{className:`oc-sidebar${g?"":" is-collapsed"}`,"aria-label":"会话与仓库",children:g?T:c.jsx("button",{type:"button",className:"oc-sidebar-toggle is-collapsed",onClick:t.onToggleOpen,"aria-expanded":!1,"aria-label":"展开侧栏",title:"展开侧栏",children:c.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":"true",children:c.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,v?c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:"oc-overlay-backdrop","aria-label":"关闭侧栏遮罩",onClick:t.onCloseDrawer}),c.jsx("aside",{ref:h,className:"oc-sidebar oc-sidebar-drawer","aria-label":"会话与仓库抽屉",role:"dialog","aria-modal":"true",tabIndex:-1,children:T})]}):null]})}function vy(t){const r=k.useMemo(()=>hS(t.entries),[t.entries]);return r.length?c.jsx("ul",{className:"oc-tree",role:t.depth===0?"tree":"group",children:r.map(i=>{const l=i.name.startsWith(".");if(i.kind==="directory"){const o=t.expanded.has(i.path);return c.jsxs("li",{className:`oc-tree-node is-dir${o?" is-open":""}${l?" is-dot":""}`,role:"treeitem","aria-expanded":o,children:[c.jsxs("button",{type:"button",className:"oc-tree-row oc-tree-dir",onClick:()=>t.onToggle(i.path),style:{paddingLeft:`${8+t.depth*12}px`},children:[c.jsx(mS,{open:o}),c.jsx(pS,{open:o}),c.jsx("span",{className:"oc-tree-label",children:i.name})]}),o?c.jsx("div",{className:"oc-tree-children",style:{"--oc-tree-guide":`${14+t.depth*12}px`},children:c.jsx(vy,{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 c.jsx("li",{className:`oc-tree-node is-file${l?" is-dot":""}`,role:"treeitem",children:c.jsx(SS,{entry:i,depth:t.depth,onInsert:t.onInsert,onPreview:t.onPreview})},i.path)})}):c.jsx("p",{className:"oc-tree-empty",children:"此目录为空或没有可安全浏览的文件。"})}function SS(t){const r=k.useRef(null);return k.useEffect(()=>()=>{r.current!==null&&window.clearTimeout(r.current)},[]),c.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:[c.jsx("span",{className:"oc-tree-chevron-spacer","aria-hidden":"true"}),c.jsx(gS,{}),c.jsx("span",{className:"oc-tree-label",children:t.entry.name})]})}function kS(t){const r=t.previews.find(i=>i.path===t.activePath);return!r&&!t.loading?null:c.jsxs(c.Fragment,{children:[r&&c.jsxs("section",{className:"oc-file-preview","aria-label":`文件预览 ${r.path}`,children:[c.jsxs("header",{children:[c.jsx("div",{className:"oc-file-tabs",role:"tablist","aria-label":"文件预览 Tabs",children:t.previews.map(i=>c.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))}),c.jsxs("span",{children:[r.bytes," bytes",r.truncated?" · 已截断":""]}),c.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>t.onClose(r.path),children:"关闭预览"})]}),c.jsx("pre",{children:c.jsx("code",{children:r.content})})]}),t.loading&&c.jsx("div",{className:"oc-file-preview-loading",children:"正在读取文件…"})]})}const by=[{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"}],xy=[{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"}],ei={operator:0,web:1,extension:2,skill:3,prompt:4};function Qp(t){const r=t.trim().split(/\s+/,1)[0]??"";return r?r.startsWith("/")?r.toLowerCase():`/${r.toLowerCase()}`:""}function wS(t){const r=t.trim().split(/\s+/,1)[0]?.toLowerCase();if(!r?.startsWith("/"))return;const i=[...by,...xy].find(l=>l.command===r);return i?{command:i.command,action:i.action}:{command:r,action:"unknown"}}function CS(t){if(t==="focus-panel:task"||t==="focus-panel:contract")return"tasks";if(t==="focus-panel:dag")return"recovery"}function jS(t=[]){const r=new Map,i=l=>{const o=Qp(l.command);if(!o)return;const d=r.get(o);if(!d){r.set(o,{...l,command:o});return}ei[l.source]<ei[d.source]&&r.set(o,{...l,command:o})};for(const l of by)i({command:l.command,label:l.label,description:l.description,source:l.source,action:l.action});for(const l of xy)i({command:l.command,label:l.label,description:l.description,source:l.source,action:l.action});for(const l of t){const o=Qp(l.command);o&&i({command:o,label:l.label||o,description:l.description||"",source:l.source,action:"pi-prompt"})}return[...r.values()].sort((l,o)=>{const d=ei[l.source]-ei[o.source];return d!==0?d:l.command.localeCompare(o.command)})}function RS(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 l=i.startsWith("/")?i:i?`/${i}`:"/",o=l==="/"?"":l.slice(1),d=[];for(const u of t){const h=u.command.toLowerCase(),g=h.startsWith("/")?h.slice(1):h,p=u.description.toLowerCase();let v=100;if(!o)v=10+ei[u.source];else if(h===l||g===o)v=0;else if(h.startsWith(l)||g.startsWith(o))v=1;else if(g.includes(o)||h.includes(o))v=2;else if(p.includes(o))v=3;else continue;d.push({...u,score:v})}return d.sort((u,h)=>{if(u.score!==h.score)return u.score-h.score;const g=ei[u.source]-ei[h.source];return g!==0?g:u.command.localeCompare(h.command)})}const TS={operator:"Operator",web:"Pi Web",extension:"Extensions",prompt:"Prompts",skill:"Skills"},Zp={comfortableMin:620,compactMin:480};function ES(t){return!Number.isFinite(t)||t<0?"extra-compact":t>=Zp.comfortableMin?"comfortable":t>=Zp.compactMin?"compact":"extra-compact"}function NS(t){return`is-landing-${t}`}const AS=[{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 Sy(t){const r=t.readiness==="setup-required",i=!!t.disabled||r,l=t.density??"comfortable",o=t.mode==="no-session"?"开始一段新的对话":"今天想推进什么?",d=t.mode==="no-session"?"用自然语言编排 loop-agent:查询状态、诊断问题、创建与恢复任务。可先点选下方建议,或新建空白对话。":"会话已就绪。点选建议快速开场,或在下方输入框直接描述目标。业务写入仍经受治理 DAG。";return c.jsxs("div",{className:`oc-empty ${NS(l)}`,role:"status","data-landing-density":l,children:[c.jsxs("div",{className:"oc-empty-hero",children:[c.jsx("img",{className:"oc-empty-icon oc-empty-brand",src:"/favicon.svg",alt:"","aria-hidden":"true",draggable:!1}),c.jsxs("div",{className:"oc-empty-copy",children:[c.jsx("h3",{children:o}),c.jsx("p",{children:d})]})]}),c.jsx("div",{className:"oc-suggestions","aria-label":"开场建议",children:AS.map(u=>c.jsxs("button",{type:"button",className:"oc-suggestion",onClick:()=>t.onSuggest(u.prompt),disabled:i,children:[c.jsx("strong",{children:u.label}),c.jsx("span",{children:l==="extra-compact"?u.hint.replace(/[,,].*$/,""):u.hint})]},u.label))}),c.jsxs("ul",{className:"oc-empty-tips",children:[c.jsxs("li",{children:[c.jsx("kbd",{children:"@"}),c.jsx("span",{children:"引用仓库文件"})]}),c.jsxs("li",{children:[c.jsx("kbd",{children:"/"}),c.jsx("span",{children:"快捷命令"})]}),c.jsxs("li",{children:[c.jsx("kbd",{children:"Enter"}),c.jsx("span",{children:"发送 · Shift+Enter 换行"})]})]}),t.mode==="no-session"&&t.onCreateSession?c.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 IS(t){const{artifact:r}=t;return c.jsxs("section",{className:"oc-artifact-card","aria-label":`${r.kind} artifact`,children:[c.jsxs("header",{children:[c.jsx("strong",{children:r.title??r.artifactId}),c.jsx("span",{children:r.kind})]}),r.summary&&c.jsx("p",{children:r.summary}),r.reportText&&c.jsx("pre",{children:r.reportText}),r.htmlPreview&&c.jsx("iframe",{title:`${r.title??r.artifactId} preview`,sandbox:"",srcDoc:r.htmlPreview}),r.inspectHref&&c.jsx("a",{href:r.inspectHref,children:"查看详情"})]})}function DS({card:t,origin:r,sessionId:i}){const[l,o]=k.useState(!1),[d,u]=k.useState(),h=async()=>{o(!0),u(void 0);try{const y=t.gateType==="dag-run"?t.state==="prepared"?"dag-confirm":"dag-run":t.gateType==="mutation"?"mutation-apply":"contract-apply",S=t.gateType==="dag-run"?{confirmationId:t.confirmationId,...t.state==="prepared"?{humanGateToken:t.humanGateToken}:{}}:{receiptId:t.receiptId,humanGateToken:t.humanGateToken},x=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":Xt()},body:JSON.stringify(S)}),w=await x.json();if(!x.ok)throw new Error(w.error?.message??`HTTP ${x.status}`)}catch(y){u(y instanceof Error?y.message:String(y))}finally{o(!1)}},g=t.state==="prepared"||t.gateType==="dag-run"&&t.state==="confirmed",p=t.gateType==="contract-apply"?"Contract apply":t.gateType==="mutation"?"Mutation":"DAG run",v=t.gateType==="contract-apply"?"Apply":t.gateType==="mutation"?"Execute":t.state==="prepared"?"Confirm":"Run";return c.jsxs("section",{className:`oc-human-gate-card is-${t.state}`,"aria-label":`Human gate ${t.cardId}`,children:[c.jsxs("header",{children:[c.jsxs("div",{children:[c.jsx("small",{children:"HumanGateCard · 仅人类可确认"}),c.jsx("strong",{children:p})]}),c.jsx("span",{children:t.state})]}),t.contractDiffSummary&&c.jsx("p",{children:t.contractDiffSummary}),t.displayOnlyChallenges&&c.jsxs("div",{className:"oc-human-gate-challenges",children:[c.jsx("b",{children:"Challenge(仅展示,不是确认信号)"}),c.jsx("ul",{children:t.displayOnlyChallenges.map(y=>c.jsx("li",{children:y},y))})]}),t.dagSpine&&t.dagSpine.length>0&&c.jsxs("div",{children:[c.jsx("b",{children:"DAG spine"}),c.jsx("ol",{children:t.dagSpine.map(y=>c.jsx("li",{children:c.jsx("code",{children:y})},y))})]}),c.jsxs("footer",{children:[c.jsx("a",{href:t.inspectHref,children:"Inspect"}),c.jsx("button",{className:"btn btn-primary",type:"button",disabled:!g||l,onClick:()=>{h()},children:l?"提交中…":v})]}),d&&c.jsx("div",{className:"oc-human-gate-error",children:d})]})}const wn="loop-console.operator-chat.active-session.v1",OS="loop-console.operator-chat.default-landing.v1";function Ms(t){const r=t?.trim().toLowerCase();if(r==="chat")return"chat";if(r==="tasks")return"tasks"}function ky(t){const r=t?.trim().toLowerCase();if(r==="chat"||r==="tasks"||r==="recovery"||r==="night"||r==="models"||r==="settings")return r}function wy(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 Cy(t){const r=String(t??"").replace(/^#/,"");if(!r)return null;const i=r.indexOf("?"),l=i>=0?r.slice(0,i):r,o=i>=0?r.slice(i+1):"",d=(l||"/").split("?")[0]||"/";if(d==="/"||d==="")return null;const u=d.replace(/^\//,"").split("/")[0],h=ky(u);return h?{workspace:h,...wy(new URLSearchParams(o))}:null}function MS(t){const r=new URLSearchParams(t.search),i=t.hash.startsWith("#")?t.hash.slice(1):t.hash,l=new URLSearchParams(i),o=ky(r.get("workspace")??r.get("landing")??l.get("workspace"));return o?{workspace:o,...wy(r)}:null}function zS(t){if(!t)return;const r=Cy(t.hash);if(r)return r.workspace;const i=new URLSearchParams(t.search),l=Ms(i.get("landing")??i.get("workspace"));if(l)return l;const o=t.hash.startsWith("#")?t.hash.slice(1):t.hash;return Ms(new URLSearchParams(o).get("workspace"))}function jy(t){return zS(t.location)??Ms(t.storage?.getItem(OS))??Ms(t.env)??"chat"}function Ry(t,r={}){const i=new URLSearchParams;for(const[d,u]of Object.entries(r))u?.trim()&&i.set(d,u.trim());const l=i.toString(),o=`/${t}`;return l?`${o}?${l}`:o}function _S(t,r={}){return`#${Ry(t,r)}`}function LS(t){return Cy(t.hash)??MS(t)}function BS(t){const{operation:r}=t,i=r.inspectHref.startsWith("/")?`${t.origin}${r.inspectHref}`:r.inspectHref,l=r.state==="failed"||r.state==="timed-out"||r.state==="needs-reconcile",o=(u,h)=>{t.onNavigateWorkspace?t.onNavigateWorkspace(u,h):window.location.assign(_S(u,h))},d=[r.taskId?["task",r.taskId]:void 0,r.dagRunId?["dag",r.dagRunId]:void 0,r.featureId?["feature",r.featureId]:void 0,r.workerRunId?["worker",r.workerRunId]:void 0].filter(u=>!!u);return c.jsxs("section",{className:`oc-operation-card is-${r.state}`,"aria-label":`Operation ${r.operationId}`,children:[c.jsxs("header",{className:"oc-operation-head",children:[c.jsxs("div",{children:[c.jsx("div",{className:"oc-operation-kicker",children:"Operation"}),c.jsx("strong",{children:r.action})]}),c.jsx("span",{className:`oc-operation-state is-${r.state}`,children:r.state})]}),c.jsx("div",{className:"oc-operation-id",children:c.jsx("code",{children:r.operationId})}),d.length>0&&c.jsx("div",{className:"oc-operation-identities",children:d.map(([u,h])=>c.jsxs("span",{children:[c.jsx("b",{children:u})," ",h]},`${u}:${h}`))}),r.controller&&c.jsxs("div",{className:"oc-operation-controller",children:["controller: ",r.controller]}),r.summaryPreview&&c.jsx("pre",{className:"oc-operation-preview",children:r.summaryPreview}),r.stderrPreview&&c.jsx("pre",{className:"oc-operation-preview is-error",children:r.stderrPreview}),r.stdoutPreview&&c.jsx("pre",{className:"oc-operation-preview",children:r.stdoutPreview}),c.jsxs("footer",{className:"oc-operation-actions",children:[c.jsx("a",{className:"btn btn-ghost",href:i,target:"_blank",rel:"noreferrer",children:"Inspect"}),r.taskId&&c.jsx("button",{className:"btn btn-ghost",type:"button",onClick:()=>o("tasks",{taskId:r.taskId}),children:"打开 Task Ops"}),r.dagRunId&&c.jsx("a",{className:"btn btn-ghost",href:`${t.origin}/inspect/#/dag/${encodeURIComponent(r.dagRunId)}`,target:"_blank",rel:"noreferrer",children:"打开 Run / Inspect"}),l&&(r.dagRunId||r.taskId)&&c.jsx("button",{className:"btn btn-primary",type:"button",onClick:()=>o("recovery",{taskId:r.taskId,dagRunId:r.dagRunId}),children:"打开 Recovery"}),c.jsx("time",{dateTime:r.updatedAt,children:new Date(r.updatedAt).toLocaleString()})]})]})}function HS(t){const{interview:r,interviewAnswer:i,onAnswerChange:l,onAnswer:o}=t;return c.jsxs("section",{className:"oc-draft-card","aria-label":"Requirement Interview",children:[c.jsxs("header",{children:[c.jsx("strong",{children:"Requirement Interview"}),c.jsx("span",{children:r.state})]}),r.question&&c.jsxs("div",{className:"oc-interview-bubble",children:[c.jsx("strong",{children:r.question.text}),c.jsxs("p",{children:["建议:",r.question.recommendation]}),c.jsx("textarea",{value:i,onChange:d=>l(d.target.value),placeholder:"输入答案"}),c.jsxs("div",{children:[c.jsx("button",{className:"btn btn-primary",type:"button",onClick:()=>o("override"),disabled:!i.trim(),children:"提交答案"}),c.jsx("button",{className:"btn btn-ghost",type:"button",onClick:()=>o("accept-recommendation"),children:"接受建议"})]})]}),r.draft&&c.jsxs("details",{open:!0,children:[c.jsxs("summary",{children:["TaskContractDraftV1 · ",r.draftSha256?.slice(0,12)]}),c.jsx("pre",{children:JSON.stringify(r.draft,null,2)})]}),r.assessment&&c.jsxs("div",{className:`oc-assessment${r.assessment.fresh?" is-fresh":""}`,children:[c.jsxs("strong",{children:["完整性:",r.assessment.outcome]}),(r.assessment.missingFields??[]).length>0&&c.jsxs("p",{children:["缺失:",r.assessment.missingFields?.join("、")]})]}),r.taskKindRecommendation&&c.jsxs("div",{className:"oc-task-kind-card",children:[c.jsx("span",{children:"taskKind 建议"}),c.jsx("strong",{children:r.taskKindRecommendation}),c.jsx("button",{className:"btn btn-primary",type:"button",onClick:()=>t.onConfirmTaskKind(),children:"由我确认"}),c.jsx("small",{children:"模型不能代替人类确认。"})]}),r.confirmedTaskKind&&c.jsxs("div",{className:"oc-task-kind-card is-confirmed",children:["已由人类确认:",c.jsx("strong",{children:r.confirmedTaskKind})]})]})}function US(t,r){const i={};return(t[t.length-1]===""?[...t,""]:t).join((i.padRight?" ":"")+","+(i.padLeft===!1?"":" ")).trim()}const qS=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,GS=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,$S={};function Jp(t,r){return($S.jsx?GS:qS).test(t)}const FS=/[ \t\n\f\r]/g;function VS(t){return typeof t=="object"?t.type==="text"?Wp(t.value):!1:Wp(t)}function Wp(t){return t.replace(FS,"")===""}class sl{constructor(r,i,l){this.normal=i,this.property=r,l&&(this.space=l)}}sl.prototype.normal={};sl.prototype.property={};sl.prototype.space=void 0;function Ty(t,r){const i={},l={};for(const o of t)Object.assign(i,o.property),Object.assign(l,o.normal);return new sl(i,l,r)}function Pc(t){return t.toLowerCase()}class Qt{constructor(r,i){this.attribute=i,this.property=r}}Qt.prototype.attribute="";Qt.prototype.booleanish=!1;Qt.prototype.boolean=!1;Qt.prototype.commaOrSpaceSeparated=!1;Qt.prototype.commaSeparated=!1;Qt.prototype.defined=!1;Qt.prototype.mustUseProperty=!1;Qt.prototype.number=!1;Qt.prototype.overloadedBoolean=!1;Qt.prototype.property="";Qt.prototype.spaceSeparated=!1;Qt.prototype.space=void 0;let PS=0;const Ae=ai(),kt=ai(),Yc=ai(),me=ai(),nt=ai(),ri=ai(),sn=ai();function ai(){return 2**++PS}const Kc=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ae,booleanish:kt,commaOrSpaceSeparated:sn,commaSeparated:ri,number:me,overloadedBoolean:Yc,spaceSeparated:nt},Symbol.toStringTag,{value:"Module"})),Cc=Object.keys(Kc);class fd extends Qt{constructor(r,i,l,o){let d=-1;if(super(r,i),eg(this,"space",o),typeof l=="number")for(;++d<Cc.length;){const u=Cc[d];eg(this,Cc[d],(l&Kc[u])===Kc[u])}}}fd.prototype.defined=!0;function eg(t,r,i){i&&(t[r]=i)}function ea(t){const r={},i={};for(const[l,o]of Object.entries(t.properties)){const d=new fd(l,t.transform(t.attributes||{},l),o,t.space);t.mustUseProperty&&t.mustUseProperty.includes(l)&&(d.mustUseProperty=!0),r[l]=d,i[Pc(l)]=l,i[Pc(d.attribute)]=l}return new sl(r,i,t.space)}const Ey=ea({properties:{ariaActiveDescendant:null,ariaAtomic:kt,ariaAutoComplete:null,ariaBusy:kt,ariaChecked:kt,ariaColCount:me,ariaColIndex:me,ariaColSpan:me,ariaControls:nt,ariaCurrent:null,ariaDescribedBy:nt,ariaDetails:null,ariaDisabled:kt,ariaDropEffect:nt,ariaErrorMessage:null,ariaExpanded:kt,ariaFlowTo:nt,ariaGrabbed:kt,ariaHasPopup:null,ariaHidden:kt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:nt,ariaLevel:me,ariaLive:null,ariaModal:kt,ariaMultiLine:kt,ariaMultiSelectable:kt,ariaOrientation:null,ariaOwns:nt,ariaPlaceholder:null,ariaPosInSet:me,ariaPressed:kt,ariaReadOnly:kt,ariaRelevant:null,ariaRequired:kt,ariaRoleDescription:nt,ariaRowCount:me,ariaRowIndex:me,ariaRowSpan:me,ariaSelected:kt,ariaSetSize:me,ariaSort:null,ariaValueMax:me,ariaValueMin:me,ariaValueNow:me,ariaValueText:null,role:null},transform(t,r){return r==="role"?r:"aria-"+r.slice(4).toLowerCase()}});function Ny(t,r){return r in t?t[r]:r}function Ay(t,r){return Ny(t,r.toLowerCase())}const YS=ea({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ri,acceptCharset:nt,accessKey:nt,action:null,allow:null,allowFullScreen:Ae,allowPaymentRequest:Ae,allowUserMedia:Ae,alpha:Ae,alt:null,as:null,async:Ae,autoCapitalize:null,autoComplete:nt,autoFocus:Ae,autoPlay:Ae,blocking:nt,capture:null,charSet:null,checked:Ae,cite:null,className:nt,closedBy:null,colorSpace:null,cols:me,colSpan:me,command:null,commandFor:null,content:null,contentEditable:kt,controls:Ae,controlsList:nt,coords:me|ri,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ae,defer:Ae,dir:null,dirName:null,disabled:Ae,download:Yc,draggable:kt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ae,formTarget:null,headers:nt,height:me,hidden:Yc,high:me,href:null,hrefLang:null,htmlFor:nt,httpEquiv:nt,id:null,imageSizes:null,imageSrcSet:null,inert:Ae,inputMode:null,integrity:null,is:null,isMap:Ae,itemId:null,itemProp:nt,itemRef:nt,itemScope:Ae,itemType:nt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ae,low:me,manifest:null,max:null,maxLength:me,media:null,method:null,min:null,minLength:me,multiple:Ae,muted:Ae,name:null,nonce:null,noModule:Ae,noValidate:Ae,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:Ae,optimum:me,pattern:null,ping:nt,placeholder:null,playsInline:Ae,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ae,referrerPolicy:null,rel:nt,required:Ae,reversed:Ae,rows:me,rowSpan:me,sandbox:nt,scope:null,scoped:Ae,seamless:Ae,selected:Ae,shadowRootClonable:Ae,shadowRootCustomElementRegistry:Ae,shadowRootDelegatesFocus:Ae,shadowRootMode:null,shadowRootSerializable:Ae,shape:null,size:me,sizes:null,slot:null,span:me,spellCheck:kt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:me,step:null,style:null,tabIndex:me,target:null,title:null,translate:null,type:null,typeMustMatch:Ae,useMap:null,value:kt,width:me,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:nt,axis:null,background:null,bgColor:null,border:me,borderColor:null,bottomMargin:me,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ae,declare:Ae,event:null,face:null,frame:null,frameBorder:null,hSpace:me,leftMargin:me,link:null,longDesc:null,lowSrc:null,marginHeight:me,marginWidth:me,noResize:Ae,noHref:Ae,noShade:Ae,noWrap:Ae,object:null,profile:null,prompt:null,rev:null,rightMargin:me,rules:null,scheme:null,scrolling:kt,standby:null,summary:null,text:null,topMargin:me,valueType:null,version:null,vAlign:null,vLink:null,vSpace:me,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Ae,disablePictureInPicture:Ae,disableRemotePlayback:Ae,exportParts:ri,part:nt,prefix:null,property:null,results:me,security:null,unselectable:null},space:"html",transform:Ay}),KS=ea({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:sn,accentHeight:me,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:me,amplitude:me,arabicForm:null,ascent:me,attributeName:null,attributeType:null,azimuth:me,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:me,by:null,calcMode:null,capHeight:me,className:nt,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:me,diffuseConstant:me,direction:null,display:null,dur:null,divisor:me,dominantBaseline:null,download:Ae,dx:null,dy:null,edgeMode:null,editable:null,elevation:me,enableBackground:null,end:null,event:null,exponent:me,externalResourcesRequired:null,fill:null,fillOpacity:me,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:ri,g2:ri,glyphName:ri,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:me,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:me,horizOriginX:me,horizOriginY:me,id:null,ideographic:me,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:me,k:me,k1:me,k2:me,k3:me,k4:me,kernelMatrix:sn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:me,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:me,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:me,overlineThickness:me,paintOrder:null,panose1:null,path:null,pathLength:me,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:nt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:me,pointsAtY:me,pointsAtZ:me,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:sn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:sn,rev:sn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:sn,requiredFeatures:sn,requiredFonts:sn,requiredFormats:sn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:me,specularExponent:me,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:me,strikethroughThickness:me,string:null,stroke:null,strokeDashArray:sn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:me,strokeOpacity:me,strokeWidth:null,style:null,surfaceScale:me,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:sn,tabIndex:me,tableValues:null,target:null,targetX:me,targetY:me,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:sn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:me,underlineThickness:me,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:me,values:null,vAlphabetic:me,vMathematical:me,vectorEffect:null,vHanging:me,vIdeographic:me,version:null,vertAdvY:me,vertOriginX:me,vertOriginY:me,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:me,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Ny}),Iy=ea({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()}}),Dy=ea({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Ay}),Oy=ea({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,r){return"xml:"+r.slice(3).toLowerCase()}}),XS={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"},QS=/[A-Z]/g,tg=/-[a-z]/g,ZS=/^data[-\w.:]+$/i;function JS(t,r){const i=Pc(r);let l=r,o=Qt;if(i in t.normal)return t.property[t.normal[i]];if(i.length>4&&i.slice(0,4)==="data"&&ZS.test(r)){if(r.charAt(4)==="-"){const d=r.slice(5).replace(tg,e0);l="data"+d.charAt(0).toUpperCase()+d.slice(1)}else{const d=r.slice(4);if(!tg.test(d)){let u=d.replace(QS,WS);u.charAt(0)!=="-"&&(u="-"+u),r="data"+u}}o=fd}return new o(l,r)}function WS(t){return"-"+t.toLowerCase()}function e0(t){return t.charAt(1).toUpperCase()}const t0=Ty([Ey,YS,Iy,Dy,Oy],"html"),hd=Ty([Ey,KS,Iy,Dy,Oy],"svg");function n0(t){return t.join(" ").trim()}var Pi={},jc,ng;function r0(){if(ng)return jc;ng=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,l=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,d=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,h=/^\s+|\s+$/g,g=`
|
|
13
|
-
`,p="/",v="*",y="",S="comment",x="declaration";function w(H,T){if(typeof H!="string")throw new TypeError("First argument must be a string");if(!H)return[];T=T||{};var N=1,A=1;function G(X){var B=X.match(r);B&&(N+=B.length);var O=X.lastIndexOf(g);A=~O?X.length-O:A+X.length}function K(){var X={line:N,column:A};return function(B){return B.position=new E(X),se(),B}}function E(X){this.start=X,this.end={line:N,column:A},this.source=T.source}E.prototype.content=H;function $(X){var B=new Error(T.source+":"+N+":"+A+": "+X);if(B.reason=X,B.filename=T.source,B.line=N,B.column=A,B.source=H,!T.silent)throw B}function te(X){var B=X.exec(H);if(B){var O=B[0];return G(O),H=H.slice(O.length),B}}function se(){te(i)}function z(X){var B;for(X=X||[];B=V();)B!==!1&&X.push(B);return X}function V(){var X=K();if(!(p!=H.charAt(0)||v!=H.charAt(1))){for(var B=2;y!=H.charAt(B)&&(v!=H.charAt(B)||p!=H.charAt(B+1));)++B;if(B+=2,y===H.charAt(B-1))return $("End of comment missing");var O=H.slice(2,B-2);return A+=2,G(O),H=H.slice(B),A+=2,X({type:S,comment:O})}}function F(){var X=K(),B=te(l);if(B){if(V(),!te(o))return $("property missing ':'");var O=te(d),U=X({type:x,property:I(B[0].replace(t,y)),value:O?I(O[0].replace(t,y)):y});return te(u),U}}function le(){var X=[];z(X);for(var B;B=F();)B!==!1&&(X.push(B),z(X));return X}return se(),le()}function I(H){return H?H.replace(h,y):y}return jc=w,jc}var rg;function i0(){if(rg)return Pi;rg=1;var t=Pi&&Pi.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(Pi,"__esModule",{value:!0}),Pi.default=i;const r=t(r0());function i(l,o){let d=null;if(!l||typeof l!="string")return d;const u=(0,r.default)(l),h=typeof o=="function";return u.forEach(g=>{if(g.type!=="declaration")return;const{property:p,value:v}=g;h?o(p,v,g):v&&(d=d||{},d[p]=v)}),d}return Pi}var Qa={},ig;function a0(){if(ig)return Qa;ig=1,Object.defineProperty(Qa,"__esModule",{value:!0}),Qa.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,r=/-([a-z])/g,i=/^[^-]+$/,l=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,d=function(p){return!p||i.test(p)||t.test(p)},u=function(p,v){return v.toUpperCase()},h=function(p,v){return"".concat(v,"-")},g=function(p,v){return v===void 0&&(v={}),d(p)?p:(p=p.toLowerCase(),v.reactCompat?p=p.replace(o,h):p=p.replace(l,h),p.replace(r,u))};return Qa.camelCase=g,Qa}var Za,ag;function l0(){if(ag)return Za;ag=1;var t=Za&&Za.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},r=t(i0()),i=a0();function l(o,d){var u={};return!o||typeof o!="string"||(0,r.default)(o,function(h,g){h&&g&&(u[(0,i.camelCase)(h,d)]=g)}),u}return l.default=l,Za=l,Za}var s0=l0();const o0=od(s0),My=zy("end"),md=zy("start");function zy(t){return r;function r(i){const l=i&&i.position&&i.position[t]||{};if(typeof l.line=="number"&&l.line>0&&typeof l.column=="number"&&l.column>0)return{line:l.line,column:l.column,offset:typeof l.offset=="number"&&l.offset>-1?l.offset:void 0}}}function u0(t){const r=md(t),i=My(t);if(r&&i)return{start:r,end:i}}function nl(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?lg(t.position):"start"in t||"end"in t?lg(t):"line"in t||"column"in t?Xc(t):""}function Xc(t){return sg(t&&t.line)+":"+sg(t&&t.column)}function lg(t){return Xc(t&&t.start)+"-"+Xc(t&&t.end)}function sg(t){return t&&typeof t=="number"?t:1}class _t extends Error{constructor(r,i,l){super(),typeof i=="string"&&(l=i,i=void 0);let o="",d={},u=!1;if(i&&("line"in i&&"column"in i?d={place:i}:"start"in i&&"end"in i?d={place:i}:"type"in i?d={ancestors:[i],place:i.position}:d={...i}),typeof r=="string"?o=r:!d.cause&&r&&(u=!0,o=r.message,d.cause=r),!d.ruleId&&!d.source&&typeof l=="string"){const g=l.indexOf(":");g===-1?d.ruleId=l:(d.source=l.slice(0,g),d.ruleId=l.slice(g+1))}if(!d.place&&d.ancestors&&d.ancestors){const g=d.ancestors[d.ancestors.length-1];g&&(d.place=g.position)}const h=d.place&&"start"in d.place?d.place.start:d.place;this.ancestors=d.ancestors||void 0,this.cause=d.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=nl(d.place)||"1:1",this.place=d.place||void 0,this.reason=this.message,this.ruleId=d.ruleId||void 0,this.source=d.source||void 0,this.stack=u&&d.cause&&typeof d.cause.stack=="string"?d.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}_t.prototype.file="";_t.prototype.name="";_t.prototype.reason="";_t.prototype.message="";_t.prototype.stack="";_t.prototype.column=void 0;_t.prototype.line=void 0;_t.prototype.ancestors=void 0;_t.prototype.cause=void 0;_t.prototype.fatal=void 0;_t.prototype.place=void 0;_t.prototype.ruleId=void 0;_t.prototype.source=void 0;const pd={}.hasOwnProperty,c0=new Map,d0=/[A-Z]/g,f0=new Set(["table","tbody","thead","tfoot","tr"]),h0=new Set(["td","th"]),_y="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function m0(t,r){if(!r||r.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const i=r.filePath||void 0;let l;if(r.development){if(typeof r.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");l=k0(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");l=S0(i,r.jsx,r.jsxs)}const o={Fragment:r.Fragment,ancestors:[],components:r.components||{},create:l,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"?hd:t0,stylePropertyNameCase:r.stylePropertyNameCase||"dom",tableCellAlignToStyle:r.tableCellAlignToStyle!==!1},d=Ly(o,t,void 0);return d&&typeof d!="string"?d:o.create(t,o.Fragment,{children:d||void 0},void 0)}function Ly(t,r,i){if(r.type==="element")return p0(t,r,i);if(r.type==="mdxFlowExpression"||r.type==="mdxTextExpression")return g0(t,r);if(r.type==="mdxJsxFlowElement"||r.type==="mdxJsxTextElement")return v0(t,r,i);if(r.type==="mdxjsEsm")return y0(t,r);if(r.type==="root")return b0(t,r,i);if(r.type==="text")return x0(t,r)}function p0(t,r,i){const l=t.schema;let o=l;r.tagName.toLowerCase()==="svg"&&l.space==="html"&&(o=hd,t.schema=o),t.ancestors.push(r);const d=Hy(t,r.tagName,!1),u=w0(t,r);let h=yd(t,r);return f0.has(r.tagName)&&(h=h.filter(function(g){return typeof g=="string"?!VS(g):!0})),By(t,u,d,r),gd(u,h),t.ancestors.pop(),t.schema=l,t.create(r,d,u,i)}function g0(t,r){if(r.data&&r.data.estree&&t.evaluater){const l=r.data.estree.body[0];return l.type,t.evaluater.evaluateExpression(l.expression)}al(t,r.position)}function y0(t,r){if(r.data&&r.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(r.data.estree);al(t,r.position)}function v0(t,r,i){const l=t.schema;let o=l;r.name==="svg"&&l.space==="html"&&(o=hd,t.schema=o),t.ancestors.push(r);const d=r.name===null?t.Fragment:Hy(t,r.name,!0),u=C0(t,r),h=yd(t,r);return By(t,u,d,r),gd(u,h),t.ancestors.pop(),t.schema=l,t.create(r,d,u,i)}function b0(t,r,i){const l={};return gd(l,yd(t,r)),t.create(r,t.Fragment,l,i)}function x0(t,r){return r.value}function By(t,r,i,l){typeof i!="string"&&i!==t.Fragment&&t.passNode&&(r.node=l)}function gd(t,r){if(r.length>0){const i=r.length>1?r:r[0];i&&(t.children=i)}}function S0(t,r,i){return l;function l(o,d,u,h){const p=Array.isArray(u.children)?i:r;return h?p(d,u,h):p(d,u)}}function k0(t,r){return i;function i(l,o,d,u){const h=Array.isArray(d.children),g=md(l);return r(o,d,u,h,{columnNumber:g?g.column-1:void 0,fileName:t,lineNumber:g?g.line:void 0},void 0)}}function w0(t,r){const i={};let l,o;for(o in r.properties)if(o!=="children"&&pd.call(r.properties,o)){const d=j0(t,o,r.properties[o]);if(d){const[u,h]=d;t.tableCellAlignToStyle&&u==="align"&&typeof h=="string"&&h0.has(r.tagName)?l=h:i[u]=h}}if(l){const d=i.style||(i.style={});d[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=l}return i}function C0(t,r){const i={};for(const l of r.attributes)if(l.type==="mdxJsxExpressionAttribute")if(l.data&&l.data.estree&&t.evaluater){const d=l.data.estree.body[0];d.type;const u=d.expression;u.type;const h=u.properties[0];h.type,Object.assign(i,t.evaluater.evaluateExpression(h.argument))}else al(t,r.position);else{const o=l.name;let d;if(l.value&&typeof l.value=="object")if(l.value.data&&l.value.data.estree&&t.evaluater){const h=l.value.data.estree.body[0];h.type,d=t.evaluater.evaluateExpression(h.expression)}else al(t,r.position);else d=l.value===null?!0:l.value;i[o]=d}return i}function yd(t,r){const i=[];let l=-1;const o=t.passKeys?new Map:c0;for(;++l<r.children.length;){const d=r.children[l];let u;if(t.passKeys){const g=d.type==="element"?d.tagName:d.type==="mdxJsxFlowElement"||d.type==="mdxJsxTextElement"?d.name:void 0;if(g){const p=o.get(g)||0;u=g+"-"+p,o.set(g,p+1)}}const h=Ly(t,d,u);h!==void 0&&i.push(h)}return i}function j0(t,r,i){const l=JS(t.schema,r);if(!(i==null||typeof i=="number"&&Number.isNaN(i))){if(Array.isArray(i)&&(i=l.commaSeparated?US(i):n0(i)),l.property==="style"){let o=typeof i=="object"?i:R0(t,String(i));return t.stylePropertyNameCase==="css"&&(o=T0(o)),["style",o]}return[t.elementAttributeNameCase==="react"&&l.space?XS[l.property]||l.property:l.attribute,i]}}function R0(t,r){try{return o0(r,{reactCompat:!0})}catch(i){if(t.ignoreInvalidStyle)return{};const l=i,o=new _t("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:l,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=t.filePath||void 0,o.url=_y+"#cannot-parse-style-attribute",o}}function Hy(t,r,i){let l;if(!i)l={type:"Literal",value:r};else if(r.includes(".")){const o=r.split(".");let d=-1,u;for(;++d<o.length;){const h=Jp(o[d])?{type:"Identifier",name:o[d]}:{type:"Literal",value:o[d]};u=u?{type:"MemberExpression",object:u,property:h,computed:!!(d&&h.type==="Literal"),optional:!1}:h}l=u}else l=Jp(r)&&!/^[a-z]/.test(r)?{type:"Identifier",name:r}:{type:"Literal",value:r};if(l.type==="Literal"){const o=l.value;return pd.call(t.components,o)?t.components[o]:o}if(t.evaluater)return t.evaluater.evaluateExpression(l);al(t)}function al(t,r){const i=new _t("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=_y+"#cannot-handle-mdx-estrees-without-createevaluater",i}function T0(t){const r={};let i;for(i in t)pd.call(t,i)&&(r[E0(i)]=t[i]);return r}function E0(t){let r=t.replace(d0,N0);return r.slice(0,3)==="ms-"&&(r="-"+r),r}function N0(t){return"-"+t.toLowerCase()}const Rc={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"]},A0={};function vd(t,r){const i=A0,l=typeof i.includeImageAlt=="boolean"?i.includeImageAlt:!0,o=typeof i.includeHtml=="boolean"?i.includeHtml:!0;return Uy(t,l,o)}function Uy(t,r,i){if(I0(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 og(t.children,r,i)}return Array.isArray(t)?og(t,r,i):""}function og(t,r,i){const l=[];let o=-1;for(;++o<t.length;)l[o]=Uy(t[o],r,i);return l.join("")}function I0(t){return!!(t&&typeof t=="object")}const ug=document.createElement("i");function bd(t){const r="&"+t+";";ug.innerHTML=r;const i=ug.textContent;return i.charCodeAt(i.length-1)===59&&t!=="semi"||i===r?!1:i}function on(t,r,i,l){const o=t.length;let d=0,u;if(r<0?r=-r>o?0:o+r:r=r>o?o:r,i=i>0?i:0,l.length<1e4)u=Array.from(l),u.unshift(r,i),t.splice(...u);else for(i&&t.splice(r,i);d<l.length;)u=l.slice(d,d+1e4),u.unshift(r,0),t.splice(...u),d+=1e4,r+=1e4}function bn(t,r){return t.length>0?(on(t,t.length,0,r),t):r}const cg={}.hasOwnProperty;function qy(t){const r={};let i=-1;for(;++i<t.length;)D0(r,t[i]);return r}function D0(t,r){let i;for(i in r){const o=(cg.call(t,i)?t[i]:void 0)||(t[i]={}),d=r[i];let u;if(d)for(u in d){cg.call(o,u)||(o[u]=[]);const h=d[u];O0(o[u],Array.isArray(h)?h:h?[h]:[])}}}function O0(t,r){let i=-1;const l=[];for(;++i<r.length;)(r[i].add==="after"?t:l).push(r[i]);on(t,0,0,l)}function Gy(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 Cn(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ht=Dr(/[A-Za-z]/),zt=Dr(/[\dA-Za-z]/),M0=Dr(/[#-'*+\--9=?A-Z^-~]/);function zs(t){return t!==null&&(t<32||t===127)}const Qc=Dr(/\d/),z0=Dr(/[\dA-Fa-f]/),_0=Dr(/[!-/:-@[-`{-~]/);function ke(t){return t!==null&&t<-2}function rt(t){return t!==null&&(t<0||t===32)}function He(t){return t===-2||t===-1||t===32}const Ks=Dr(new RegExp("\\p{P}|\\p{S}","u")),ii=Dr(/\s/);function Dr(t){return r;function r(i){return i!==null&&i>-1&&t.test(String.fromCharCode(i))}}function ta(t){const r=[];let i=-1,l=0,o=0;for(;++i<t.length;){const d=t.charCodeAt(i);let u="";if(d===37&&zt(t.charCodeAt(i+1))&&zt(t.charCodeAt(i+2)))o=2;else if(d<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(d))||(u=String.fromCharCode(d));else if(d>55295&&d<57344){const h=t.charCodeAt(i+1);d<56320&&h>56319&&h<57344?(u=String.fromCharCode(d,h),o=1):u="�"}else u=String.fromCharCode(d);u&&(r.push(t.slice(l,i),encodeURIComponent(u)),l=i+o+1,u=""),o&&(i+=o,o=0)}return r.join("")+t.slice(l)}function $e(t,r,i,l){const o=l?l-1:Number.POSITIVE_INFINITY;let d=0;return u;function u(g){return He(g)?(t.enter(i),h(g)):r(g)}function h(g){return He(g)&&d++<o?(t.consume(g),h):(t.exit(i),r(g))}}const L0={tokenize:B0};function B0(t){const r=t.attempt(this.parser.constructs.contentInitial,l,o);let i;return r;function l(h){if(h===null){t.consume(h);return}return t.enter("lineEnding"),t.consume(h),t.exit("lineEnding"),$e(t,r,"linePrefix")}function o(h){return t.enter("paragraph"),d(h)}function d(h){const g=t.enter("chunkText",{contentType:"text",previous:i});return i&&(i.next=g),i=g,u(h)}function u(h){if(h===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(h);return}return ke(h)?(t.consume(h),t.exit("chunkText"),d):(t.consume(h),u)}}const H0={tokenize:U0},dg={tokenize:q0};function U0(t){const r=this,i=[];let l=0,o,d,u;return h;function h(A){if(l<i.length){const G=i[l];return r.containerState=G[1],t.attempt(G[0].continuation,g,p)(A)}return p(A)}function g(A){if(l++,r.containerState._closeFlow){r.containerState._closeFlow=void 0,o&&N();const G=r.events.length;let K=G,E;for(;K--;)if(r.events[K][0]==="exit"&&r.events[K][1].type==="chunkFlow"){E=r.events[K][1].end;break}T(l);let $=G;for(;$<r.events.length;)r.events[$][1].end={...E},$++;return on(r.events,K+1,0,r.events.slice(G)),r.events.length=$,p(A)}return h(A)}function p(A){if(l===i.length){if(!o)return S(A);if(o.currentConstruct&&o.currentConstruct.concrete)return w(A);r.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return r.containerState={},t.check(dg,v,y)(A)}function v(A){return o&&N(),T(l),S(A)}function y(A){return r.parser.lazy[r.now().line]=l!==i.length,u=r.now().offset,w(A)}function S(A){return r.containerState={},t.attempt(dg,x,w)(A)}function x(A){return l++,i.push([r.currentConstruct,r.containerState]),S(A)}function w(A){if(A===null){o&&N(),T(0),t.consume(A);return}return o=o||r.parser.flow(r.now()),t.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:d}),I(A)}function I(A){if(A===null){H(t.exit("chunkFlow"),!0),T(0),t.consume(A);return}return ke(A)?(t.consume(A),H(t.exit("chunkFlow")),l=0,r.interrupt=void 0,h):(t.consume(A),I)}function H(A,G){const K=r.sliceStream(A);if(G&&K.push(null),A.previous=d,d&&(d.next=A),d=A,o.defineSkip(A.start),o.write(K),r.parser.lazy[A.start.line]){let E=o.events.length;for(;E--;)if(o.events[E][1].start.offset<u&&(!o.events[E][1].end||o.events[E][1].end.offset>u))return;const $=r.events.length;let te=$,se,z;for(;te--;)if(r.events[te][0]==="exit"&&r.events[te][1].type==="chunkFlow"){if(se){z=r.events[te][1].end;break}se=!0}for(T(l),E=$;E<r.events.length;)r.events[E][1].end={...z},E++;on(r.events,te+1,0,r.events.slice($)),r.events.length=E}}function T(A){let G=i.length;for(;G-- >A;){const K=i[G];r.containerState=K[1],K[0].exit.call(r,t)}i.length=A}function N(){o.write([null]),d=void 0,o=void 0,r.containerState._closeFlow=void 0}}function q0(t,r,i){return $e(t,t.attempt(this.parser.constructs.document,r,i),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ji(t){if(t===null||rt(t)||ii(t))return 1;if(Ks(t))return 2}function Xs(t,r,i){const l=[];let o=-1;for(;++o<t.length;){const d=t[o].resolveAll;d&&!l.includes(d)&&(r=d(r,i),l.push(d))}return r}const Zc={name:"attention",resolveAll:G0,tokenize:$0};function G0(t,r){let i=-1,l,o,d,u,h,g,p,v;for(;++i<t.length;)if(t[i][0]==="enter"&&t[i][1].type==="attentionSequence"&&t[i][1]._close){for(l=i;l--;)if(t[l][0]==="exit"&&t[l][1].type==="attentionSequence"&&t[l][1]._open&&r.sliceSerialize(t[l][1]).charCodeAt(0)===r.sliceSerialize(t[i][1]).charCodeAt(0)){if((t[l][1]._close||t[i][1]._open)&&(t[i][1].end.offset-t[i][1].start.offset)%3&&!((t[l][1].end.offset-t[l][1].start.offset+t[i][1].end.offset-t[i][1].start.offset)%3))continue;g=t[l][1].end.offset-t[l][1].start.offset>1&&t[i][1].end.offset-t[i][1].start.offset>1?2:1;const y={...t[l][1].end},S={...t[i][1].start};fg(y,-g),fg(S,g),u={type:g>1?"strongSequence":"emphasisSequence",start:y,end:{...t[l][1].end}},h={type:g>1?"strongSequence":"emphasisSequence",start:{...t[i][1].start},end:S},d={type:g>1?"strongText":"emphasisText",start:{...t[l][1].end},end:{...t[i][1].start}},o={type:g>1?"strong":"emphasis",start:{...u.start},end:{...h.end}},t[l][1].end={...u.start},t[i][1].start={...h.end},p=[],t[l][1].end.offset-t[l][1].start.offset&&(p=bn(p,[["enter",t[l][1],r],["exit",t[l][1],r]])),p=bn(p,[["enter",o,r],["enter",u,r],["exit",u,r],["enter",d,r]]),p=bn(p,Xs(r.parser.constructs.insideSpan.null,t.slice(l+1,i),r)),p=bn(p,[["exit",d,r],["enter",h,r],["exit",h,r],["exit",o,r]]),t[i][1].end.offset-t[i][1].start.offset?(v=2,p=bn(p,[["enter",t[i][1],r],["exit",t[i][1],r]])):v=0,on(t,l-1,i-l+3,p),i=l+p.length-v-2;break}}for(i=-1;++i<t.length;)t[i][1].type==="attentionSequence"&&(t[i][1].type="data");return t}function $0(t,r){const i=this.parser.constructs.attentionMarkers.null,l=this.previous,o=Ji(l);let d;return u;function u(g){return d=g,t.enter("attentionSequence"),h(g)}function h(g){if(g===d)return t.consume(g),h;const p=t.exit("attentionSequence"),v=Ji(g),y=!v||v===2&&o||i.includes(g),S=!o||o===2&&v||i.includes(l);return p._open=!!(d===42?y:y&&(o||!S)),p._close=!!(d===42?S:S&&(v||!y)),r(g)}}function fg(t,r){t.column+=r,t.offset+=r,t._bufferIndex+=r}const F0={name:"autolink",tokenize:V0};function V0(t,r,i){let l=0;return o;function o(x){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(x),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),d}function d(x){return Ht(x)?(t.consume(x),u):x===64?i(x):p(x)}function u(x){return x===43||x===45||x===46||zt(x)?(l=1,h(x)):p(x)}function h(x){return x===58?(t.consume(x),l=0,g):(x===43||x===45||x===46||zt(x))&&l++<32?(t.consume(x),h):(l=0,p(x))}function g(x){return x===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(x),t.exit("autolinkMarker"),t.exit("autolink"),r):x===null||x===32||x===60||zs(x)?i(x):(t.consume(x),g)}function p(x){return x===64?(t.consume(x),v):M0(x)?(t.consume(x),p):i(x)}function v(x){return zt(x)?y(x):i(x)}function y(x){return x===46?(t.consume(x),l=0,v):x===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(x),t.exit("autolinkMarker"),t.exit("autolink"),r):S(x)}function S(x){if((x===45||zt(x))&&l++<63){const w=x===45?S:y;return t.consume(x),w}return i(x)}}const ol={partial:!0,tokenize:P0};function P0(t,r,i){return l;function l(d){return He(d)?$e(t,o,"linePrefix")(d):o(d)}function o(d){return d===null||ke(d)?r(d):i(d)}}const $y={continuation:{tokenize:K0},exit:X0,name:"blockQuote",tokenize:Y0};function Y0(t,r,i){const l=this;return o;function o(u){if(u===62){const h=l.containerState;return h.open||(t.enter("blockQuote",{_container:!0}),h.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(u),t.exit("blockQuoteMarker"),d}return i(u)}function d(u){return He(u)?(t.enter("blockQuotePrefixWhitespace"),t.consume(u),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),r):(t.exit("blockQuotePrefix"),r(u))}}function K0(t,r,i){const l=this;return o;function o(u){return He(u)?$e(t,d,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u):d(u)}function d(u){return t.attempt($y,r,i)(u)}}function X0(t){t.exit("blockQuote")}const Fy={name:"characterEscape",tokenize:Q0};function Q0(t,r,i){return l;function l(d){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(d),t.exit("escapeMarker"),o}function o(d){return _0(d)?(t.enter("characterEscapeValue"),t.consume(d),t.exit("characterEscapeValue"),t.exit("characterEscape"),r):i(d)}}const Vy={name:"characterReference",tokenize:Z0};function Z0(t,r,i){const l=this;let o=0,d,u;return h;function h(y){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(y),t.exit("characterReferenceMarker"),g}function g(y){return y===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(y),t.exit("characterReferenceMarkerNumeric"),p):(t.enter("characterReferenceValue"),d=31,u=zt,v(y))}function p(y){return y===88||y===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(y),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),d=6,u=z0,v):(t.enter("characterReferenceValue"),d=7,u=Qc,v(y))}function v(y){if(y===59&&o){const S=t.exit("characterReferenceValue");return u===zt&&!bd(l.sliceSerialize(S))?i(y):(t.enter("characterReferenceMarker"),t.consume(y),t.exit("characterReferenceMarker"),t.exit("characterReference"),r)}return u(y)&&o++<d?(t.consume(y),v):i(y)}}const hg={partial:!0,tokenize:W0},mg={concrete:!0,name:"codeFenced",tokenize:J0};function J0(t,r,i){const l=this,o={partial:!0,tokenize:K};let d=0,u=0,h;return g;function g(E){return p(E)}function p(E){const $=l.events[l.events.length-1];return d=$&&$[1].type==="linePrefix"?$[2].sliceSerialize($[1],!0).length:0,h=E,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),v(E)}function v(E){return E===h?(u++,t.consume(E),v):u<3?i(E):(t.exit("codeFencedFenceSequence"),He(E)?$e(t,y,"whitespace")(E):y(E))}function y(E){return E===null||ke(E)?(t.exit("codeFencedFence"),l.interrupt?r(E):t.check(hg,I,G)(E)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),S(E))}function S(E){return E===null||ke(E)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),y(E)):He(E)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),$e(t,x,"whitespace")(E)):E===96&&E===h?i(E):(t.consume(E),S)}function x(E){return E===null||ke(E)?y(E):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),w(E))}function w(E){return E===null||ke(E)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),y(E)):E===96&&E===h?i(E):(t.consume(E),w)}function I(E){return t.attempt(o,G,H)(E)}function H(E){return t.enter("lineEnding"),t.consume(E),t.exit("lineEnding"),T}function T(E){return d>0&&He(E)?$e(t,N,"linePrefix",d+1)(E):N(E)}function N(E){return E===null||ke(E)?t.check(hg,I,G)(E):(t.enter("codeFlowValue"),A(E))}function A(E){return E===null||ke(E)?(t.exit("codeFlowValue"),N(E)):(t.consume(E),A)}function G(E){return t.exit("codeFenced"),r(E)}function K(E,$,te){let se=0;return z;function z(B){return E.enter("lineEnding"),E.consume(B),E.exit("lineEnding"),V}function V(B){return E.enter("codeFencedFence"),He(B)?$e(E,F,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):F(B)}function F(B){return B===h?(E.enter("codeFencedFenceSequence"),le(B)):te(B)}function le(B){return B===h?(se++,E.consume(B),le):se>=u?(E.exit("codeFencedFenceSequence"),He(B)?$e(E,X,"whitespace")(B):X(B)):te(B)}function X(B){return B===null||ke(B)?(E.exit("codeFencedFence"),$(B)):te(B)}}}function W0(t,r,i){const l=this;return o;function o(u){return u===null?i(u):(t.enter("lineEnding"),t.consume(u),t.exit("lineEnding"),d)}function d(u){return l.parser.lazy[l.now().line]?i(u):r(u)}}const Tc={name:"codeIndented",tokenize:tk},ek={partial:!0,tokenize:nk};function tk(t,r,i){const l=this;return o;function o(p){return t.enter("codeIndented"),$e(t,d,"linePrefix",5)(p)}function d(p){const v=l.events[l.events.length-1];return v&&v[1].type==="linePrefix"&&v[2].sliceSerialize(v[1],!0).length>=4?u(p):i(p)}function u(p){return p===null?g(p):ke(p)?t.attempt(ek,u,g)(p):(t.enter("codeFlowValue"),h(p))}function h(p){return p===null||ke(p)?(t.exit("codeFlowValue"),u(p)):(t.consume(p),h)}function g(p){return t.exit("codeIndented"),r(p)}}function nk(t,r,i){const l=this;return o;function o(u){return l.parser.lazy[l.now().line]?i(u):ke(u)?(t.enter("lineEnding"),t.consume(u),t.exit("lineEnding"),o):$e(t,d,"linePrefix",5)(u)}function d(u){const h=l.events[l.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?r(u):ke(u)?o(u):i(u)}}const rk={name:"codeText",previous:ak,resolve:ik,tokenize:lk};function ik(t){let r=t.length-4,i=3,l,o;if((t[i][1].type==="lineEnding"||t[i][1].type==="space")&&(t[r][1].type==="lineEnding"||t[r][1].type==="space")){for(l=i;++l<r;)if(t[l][1].type==="codeTextData"){t[i][1].type="codeTextPadding",t[r][1].type="codeTextPadding",i+=2,r-=2;break}}for(l=i-1,r++;++l<=r;)o===void 0?l!==r&&t[l][1].type!=="lineEnding"&&(o=l):(l===r||t[l][1].type==="lineEnding")&&(t[o][1].type="codeTextData",l!==o+2&&(t[o][1].end=t[l-1][1].end,t.splice(o+2,l-o-2),r-=l-o-2,l=o+2),o=void 0);return t}function ak(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function lk(t,r,i){let l=0,o,d;return u;function u(y){return t.enter("codeText"),t.enter("codeTextSequence"),h(y)}function h(y){return y===96?(t.consume(y),l++,h):(t.exit("codeTextSequence"),g(y))}function g(y){return y===null?i(y):y===32?(t.enter("space"),t.consume(y),t.exit("space"),g):y===96?(d=t.enter("codeTextSequence"),o=0,v(y)):ke(y)?(t.enter("lineEnding"),t.consume(y),t.exit("lineEnding"),g):(t.enter("codeTextData"),p(y))}function p(y){return y===null||y===32||y===96||ke(y)?(t.exit("codeTextData"),g(y)):(t.consume(y),p)}function v(y){return y===96?(t.consume(y),o++,v):o===l?(t.exit("codeTextSequence"),t.exit("codeText"),r(y)):(d.type="codeTextData",p(y))}}class sk{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 l=i??Number.POSITIVE_INFINITY;return l<this.left.length?this.left.slice(r,l):r>this.left.length?this.right.slice(this.right.length-l+this.left.length,this.right.length-r+this.left.length).reverse():this.left.slice(r).concat(this.right.slice(this.right.length-l+this.left.length).reverse())}splice(r,i,l){const o=i||0;this.setCursor(Math.trunc(r));const d=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return l&&Ja(this.left,l),d.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),Ja(this.left,r)}unshift(r){this.setCursor(0),this.right.push(r)}unshiftMany(r){this.setCursor(0),Ja(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);Ja(this.right,i.reverse())}else{const i=this.right.splice(this.left.length+this.right.length-r,Number.POSITIVE_INFINITY);Ja(this.left,i.reverse())}}}function Ja(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 Py(t){const r={};let i=-1,l,o,d,u,h,g,p;const v=new sk(t);for(;++i<v.length;){for(;i in r;)i=r[i];if(l=v.get(i),i&&l[1].type==="chunkFlow"&&v.get(i-1)[1].type==="listItemPrefix"&&(g=l[1]._tokenizer.events,d=0,d<g.length&&g[d][1].type==="lineEndingBlank"&&(d+=2),d<g.length&&g[d][1].type==="content"))for(;++d<g.length&&g[d][1].type!=="content";)g[d][1].type==="chunkText"&&(g[d][1]._isInFirstContentOfListItem=!0,d++);if(l[0]==="enter")l[1].contentType&&(Object.assign(r,ok(v,i)),i=r[i],p=!0);else if(l[1]._container){for(d=i,o=void 0;d--;)if(u=v.get(d),u[1].type==="lineEnding"||u[1].type==="lineEndingBlank")u[0]==="enter"&&(o&&(v.get(o)[1].type="lineEndingBlank"),u[1].type="lineEnding",o=d);else if(!(u[1].type==="linePrefix"||u[1].type==="listItemIndent"))break;o&&(l[1].end={...v.get(o)[1].start},h=v.slice(o,i),h.unshift(l),v.splice(o,i-o+1,h))}}return on(t,0,Number.POSITIVE_INFINITY,v.slice(0)),!p}function ok(t,r){const i=t.get(r)[1],l=t.get(r)[2];let o=r-1;const d=[];let u=i._tokenizer;u||(u=l.parser[i.contentType](i.start),i._contentTypeTextTrailing&&(u._contentTypeTextTrailing=!0));const h=u.events,g=[],p={};let v,y,S=-1,x=i,w=0,I=0;const H=[I];for(;x;){for(;t.get(++o)[1]!==x;);d.push(o),x._tokenizer||(v=l.sliceStream(x),x.next||v.push(null),y&&u.defineSkip(x.start),x._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=!0),u.write(v),x._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=void 0)),y=x,x=x.next}for(x=i;++S<h.length;)h[S][0]==="exit"&&h[S-1][0]==="enter"&&h[S][1].type===h[S-1][1].type&&h[S][1].start.line!==h[S][1].end.line&&(I=S+1,H.push(I),x._tokenizer=void 0,x.previous=void 0,x=x.next);for(u.events=[],x?(x._tokenizer=void 0,x.previous=void 0):H.pop(),S=H.length;S--;){const T=h.slice(H[S],H[S+1]),N=d.pop();g.push([N,N+T.length-1]),t.splice(N,2,T)}for(g.reverse(),S=-1;++S<g.length;)p[w+g[S][0]]=w+g[S][1],w+=g[S][1]-g[S][0]-1;return p}const uk={resolve:dk,tokenize:fk},ck={partial:!0,tokenize:hk};function dk(t){return Py(t),t}function fk(t,r){let i;return l;function l(h){return t.enter("content"),i=t.enter("chunkContent",{contentType:"content"}),o(h)}function o(h){return h===null?d(h):ke(h)?t.check(ck,u,d)(h):(t.consume(h),o)}function d(h){return t.exit("chunkContent"),t.exit("content"),r(h)}function u(h){return t.consume(h),t.exit("chunkContent"),i.next=t.enter("chunkContent",{contentType:"content",previous:i}),i=i.next,o}}function hk(t,r,i){const l=this;return o;function o(u){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(u),t.exit("lineEnding"),$e(t,d,"linePrefix")}function d(u){if(u===null||ke(u))return i(u);const h=l.events[l.events.length-1];return!l.parser.constructs.disable.null.includes("codeIndented")&&h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?r(u):t.interrupt(l.parser.constructs.flow,i,r)(u)}}function Yy(t,r,i,l,o,d,u,h,g){const p=g||Number.POSITIVE_INFINITY;let v=0;return y;function y(T){return T===60?(t.enter(l),t.enter(o),t.enter(d),t.consume(T),t.exit(d),S):T===null||T===32||T===41||zs(T)?i(T):(t.enter(l),t.enter(u),t.enter(h),t.enter("chunkString",{contentType:"string"}),I(T))}function S(T){return T===62?(t.enter(d),t.consume(T),t.exit(d),t.exit(o),t.exit(l),r):(t.enter(h),t.enter("chunkString",{contentType:"string"}),x(T))}function x(T){return T===62?(t.exit("chunkString"),t.exit(h),S(T)):T===null||T===60||ke(T)?i(T):(t.consume(T),T===92?w:x)}function w(T){return T===60||T===62||T===92?(t.consume(T),x):x(T)}function I(T){return!v&&(T===null||T===41||rt(T))?(t.exit("chunkString"),t.exit(h),t.exit(u),t.exit(l),r(T)):v<p&&T===40?(t.consume(T),v++,I):T===41?(t.consume(T),v--,I):T===null||T===32||T===40||zs(T)?i(T):(t.consume(T),T===92?H:I)}function H(T){return T===40||T===41||T===92?(t.consume(T),I):I(T)}}function Ky(t,r,i,l,o,d){const u=this;let h=0,g;return p;function p(x){return t.enter(l),t.enter(o),t.consume(x),t.exit(o),t.enter(d),v}function v(x){return h>999||x===null||x===91||x===93&&!g||x===94&&!h&&"_hiddenFootnoteSupport"in u.parser.constructs?i(x):x===93?(t.exit(d),t.enter(o),t.consume(x),t.exit(o),t.exit(l),r):ke(x)?(t.enter("lineEnding"),t.consume(x),t.exit("lineEnding"),v):(t.enter("chunkString",{contentType:"string"}),y(x))}function y(x){return x===null||x===91||x===93||ke(x)||h++>999?(t.exit("chunkString"),v(x)):(t.consume(x),g||(g=!He(x)),x===92?S:y)}function S(x){return x===91||x===92||x===93?(t.consume(x),h++,y):y(x)}}function Xy(t,r,i,l,o,d){let u;return h;function h(S){return S===34||S===39||S===40?(t.enter(l),t.enter(o),t.consume(S),t.exit(o),u=S===40?41:S,g):i(S)}function g(S){return S===u?(t.enter(o),t.consume(S),t.exit(o),t.exit(l),r):(t.enter(d),p(S))}function p(S){return S===u?(t.exit(d),g(u)):S===null?i(S):ke(S)?(t.enter("lineEnding"),t.consume(S),t.exit("lineEnding"),$e(t,p,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),v(S))}function v(S){return S===u||S===null||ke(S)?(t.exit("chunkString"),p(S)):(t.consume(S),S===92?y:v)}function y(S){return S===u||S===92?(t.consume(S),v):v(S)}}function rl(t,r){let i;return l;function l(o){return ke(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i=!0,l):He(o)?$e(t,l,i?"linePrefix":"lineSuffix")(o):r(o)}}const mk={name:"definition",tokenize:gk},pk={partial:!0,tokenize:yk};function gk(t,r,i){const l=this;let o;return d;function d(x){return t.enter("definition"),u(x)}function u(x){return Ky.call(l,t,h,i,"definitionLabel","definitionLabelMarker","definitionLabelString")(x)}function h(x){return o=Cn(l.sliceSerialize(l.events[l.events.length-1][1]).slice(1,-1)),x===58?(t.enter("definitionMarker"),t.consume(x),t.exit("definitionMarker"),g):i(x)}function g(x){return rt(x)?rl(t,p)(x):p(x)}function p(x){return Yy(t,v,i,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(x)}function v(x){return t.attempt(pk,y,y)(x)}function y(x){return He(x)?$e(t,S,"whitespace")(x):S(x)}function S(x){return x===null||ke(x)?(t.exit("definition"),l.parser.defined.push(o),r(x)):i(x)}}function yk(t,r,i){return l;function l(h){return rt(h)?rl(t,o)(h):i(h)}function o(h){return Xy(t,d,i,"definitionTitle","definitionTitleMarker","definitionTitleString")(h)}function d(h){return He(h)?$e(t,u,"whitespace")(h):u(h)}function u(h){return h===null||ke(h)?r(h):i(h)}}const vk={name:"hardBreakEscape",tokenize:bk};function bk(t,r,i){return l;function l(d){return t.enter("hardBreakEscape"),t.consume(d),o}function o(d){return ke(d)?(t.exit("hardBreakEscape"),r(d)):i(d)}}const xk={name:"headingAtx",resolve:Sk,tokenize:kk};function Sk(t,r){let i=t.length-2,l=3,o,d;return t[l][1].type==="whitespace"&&(l+=2),i-2>l&&t[i][1].type==="whitespace"&&(i-=2),t[i][1].type==="atxHeadingSequence"&&(l===i-1||i-4>l&&t[i-2][1].type==="whitespace")&&(i-=l+1===i?2:4),i>l&&(o={type:"atxHeadingText",start:t[l][1].start,end:t[i][1].end},d={type:"chunkText",start:t[l][1].start,end:t[i][1].end,contentType:"text"},on(t,l,i-l+1,[["enter",o,r],["enter",d,r],["exit",d,r],["exit",o,r]])),t}function kk(t,r,i){let l=0;return o;function o(v){return t.enter("atxHeading"),d(v)}function d(v){return t.enter("atxHeadingSequence"),u(v)}function u(v){return v===35&&l++<6?(t.consume(v),u):v===null||rt(v)?(t.exit("atxHeadingSequence"),h(v)):i(v)}function h(v){return v===35?(t.enter("atxHeadingSequence"),g(v)):v===null||ke(v)?(t.exit("atxHeading"),r(v)):He(v)?$e(t,h,"whitespace")(v):(t.enter("atxHeadingText"),p(v))}function g(v){return v===35?(t.consume(v),g):(t.exit("atxHeadingSequence"),h(v))}function p(v){return v===null||v===35||rt(v)?(t.exit("atxHeadingText"),h(v)):(t.consume(v),p)}}const wk=["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"],pg=["pre","script","style","textarea"],Ck={concrete:!0,name:"htmlFlow",resolveTo:Tk,tokenize:Ek},jk={partial:!0,tokenize:Ak},Rk={partial:!0,tokenize:Nk};function Tk(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 Ek(t,r,i){const l=this;let o,d,u,h,g;return p;function p(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),S):C===47?(t.consume(C),d=!0,I):C===63?(t.consume(C),o=3,l.interrupt?r:R):Ht(C)?(t.consume(C),u=String.fromCharCode(C),H):i(C)}function S(C){return C===45?(t.consume(C),o=2,x):C===91?(t.consume(C),o=5,h=0,w):Ht(C)?(t.consume(C),o=4,l.interrupt?r:R):i(C)}function x(C){return C===45?(t.consume(C),l.interrupt?r:R):i(C)}function w(C){const ie="CDATA[";return C===ie.charCodeAt(h++)?(t.consume(C),h===ie.length?l.interrupt?r:F:w):i(C)}function I(C){return Ht(C)?(t.consume(C),u=String.fromCharCode(C),H):i(C)}function H(C){if(C===null||C===47||C===62||rt(C)){const ie=C===47,de=u.toLowerCase();return!ie&&!d&&pg.includes(de)?(o=1,l.interrupt?r(C):F(C)):wk.includes(u.toLowerCase())?(o=6,ie?(t.consume(C),T):l.interrupt?r(C):F(C)):(o=7,l.interrupt&&!l.parser.lazy[l.now().line]?i(C):d?N(C):A(C))}return C===45||zt(C)?(t.consume(C),u+=String.fromCharCode(C),H):i(C)}function T(C){return C===62?(t.consume(C),l.interrupt?r:F):i(C)}function N(C){return He(C)?(t.consume(C),N):z(C)}function A(C){return C===47?(t.consume(C),z):C===58||C===95||Ht(C)?(t.consume(C),G):He(C)?(t.consume(C),A):z(C)}function G(C){return C===45||C===46||C===58||C===95||zt(C)?(t.consume(C),G):K(C)}function K(C){return C===61?(t.consume(C),E):He(C)?(t.consume(C),K):A(C)}function E(C){return C===null||C===60||C===61||C===62||C===96?i(C):C===34||C===39?(t.consume(C),g=C,$):He(C)?(t.consume(C),E):te(C)}function $(C){return C===g?(t.consume(C),g=null,se):C===null||ke(C)?i(C):(t.consume(C),$)}function te(C){return C===null||C===34||C===39||C===47||C===60||C===61||C===62||C===96||rt(C)?K(C):(t.consume(C),te)}function se(C){return C===47||C===62||He(C)?A(C):i(C)}function z(C){return C===62?(t.consume(C),V):i(C)}function V(C){return C===null||ke(C)?F(C):He(C)?(t.consume(C),V):i(C)}function F(C){return C===45&&o===2?(t.consume(C),O):C===60&&o===1?(t.consume(C),U):C===62&&o===4?(t.consume(C),D):C===63&&o===3?(t.consume(C),R):C===93&&o===5?(t.consume(C),W):ke(C)&&(o===6||o===7)?(t.exit("htmlFlowData"),t.check(jk,M,le)(C)):C===null||ke(C)?(t.exit("htmlFlowData"),le(C)):(t.consume(C),F)}function le(C){return t.check(Rk,X,M)(C)}function X(C){return t.enter("lineEnding"),t.consume(C),t.exit("lineEnding"),B}function B(C){return C===null||ke(C)?le(C):(t.enter("htmlFlowData"),F(C))}function O(C){return C===45?(t.consume(C),R):F(C)}function U(C){return C===47?(t.consume(C),u="",_):F(C)}function _(C){if(C===62){const ie=u.toLowerCase();return pg.includes(ie)?(t.consume(C),D):F(C)}return Ht(C)&&u.length<8?(t.consume(C),u+=String.fromCharCode(C),_):F(C)}function W(C){return C===93?(t.consume(C),R):F(C)}function R(C){return C===62?(t.consume(C),D):C===45&&o===2?(t.consume(C),R):F(C)}function D(C){return C===null||ke(C)?(t.exit("htmlFlowData"),M(C)):(t.consume(C),D)}function M(C){return t.exit("htmlFlow"),r(C)}}function Nk(t,r,i){const l=this;return o;function o(u){return ke(u)?(t.enter("lineEnding"),t.consume(u),t.exit("lineEnding"),d):i(u)}function d(u){return l.parser.lazy[l.now().line]?i(u):r(u)}}function Ak(t,r,i){return l;function l(o){return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),t.attempt(ol,r,i)}}const Ik={name:"htmlText",tokenize:Dk};function Dk(t,r,i){const l=this;let o,d,u;return h;function h(R){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(R),g}function g(R){return R===33?(t.consume(R),p):R===47?(t.consume(R),K):R===63?(t.consume(R),A):Ht(R)?(t.consume(R),te):i(R)}function p(R){return R===45?(t.consume(R),v):R===91?(t.consume(R),d=0,w):Ht(R)?(t.consume(R),N):i(R)}function v(R){return R===45?(t.consume(R),x):i(R)}function y(R){return R===null?i(R):R===45?(t.consume(R),S):ke(R)?(u=y,U(R)):(t.consume(R),y)}function S(R){return R===45?(t.consume(R),x):y(R)}function x(R){return R===62?O(R):R===45?S(R):y(R)}function w(R){const D="CDATA[";return R===D.charCodeAt(d++)?(t.consume(R),d===D.length?I:w):i(R)}function I(R){return R===null?i(R):R===93?(t.consume(R),H):ke(R)?(u=I,U(R)):(t.consume(R),I)}function H(R){return R===93?(t.consume(R),T):I(R)}function T(R){return R===62?O(R):R===93?(t.consume(R),T):I(R)}function N(R){return R===null||R===62?O(R):ke(R)?(u=N,U(R)):(t.consume(R),N)}function A(R){return R===null?i(R):R===63?(t.consume(R),G):ke(R)?(u=A,U(R)):(t.consume(R),A)}function G(R){return R===62?O(R):A(R)}function K(R){return Ht(R)?(t.consume(R),E):i(R)}function E(R){return R===45||zt(R)?(t.consume(R),E):$(R)}function $(R){return ke(R)?(u=$,U(R)):He(R)?(t.consume(R),$):O(R)}function te(R){return R===45||zt(R)?(t.consume(R),te):R===47||R===62||rt(R)?se(R):i(R)}function se(R){return R===47?(t.consume(R),O):R===58||R===95||Ht(R)?(t.consume(R),z):ke(R)?(u=se,U(R)):He(R)?(t.consume(R),se):O(R)}function z(R){return R===45||R===46||R===58||R===95||zt(R)?(t.consume(R),z):V(R)}function V(R){return R===61?(t.consume(R),F):ke(R)?(u=V,U(R)):He(R)?(t.consume(R),V):se(R)}function F(R){return R===null||R===60||R===61||R===62||R===96?i(R):R===34||R===39?(t.consume(R),o=R,le):ke(R)?(u=F,U(R)):He(R)?(t.consume(R),F):(t.consume(R),X)}function le(R){return R===o?(t.consume(R),o=void 0,B):R===null?i(R):ke(R)?(u=le,U(R)):(t.consume(R),le)}function X(R){return R===null||R===34||R===39||R===60||R===61||R===96?i(R):R===47||R===62||rt(R)?se(R):(t.consume(R),X)}function B(R){return R===47||R===62||rt(R)?se(R):i(R)}function O(R){return R===62?(t.consume(R),t.exit("htmlTextData"),t.exit("htmlText"),r):i(R)}function U(R){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(R),t.exit("lineEnding"),_}function _(R){return He(R)?$e(t,W,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):W(R)}function W(R){return t.enter("htmlTextData"),u(R)}}const xd={name:"labelEnd",resolveAll:_k,resolveTo:Lk,tokenize:Bk},Ok={tokenize:Hk},Mk={tokenize:Uk},zk={tokenize:qk};function _k(t){let r=-1;const i=[];for(;++r<t.length;){const l=t[r][1];if(i.push(t[r]),l.type==="labelImage"||l.type==="labelLink"||l.type==="labelEnd"){const o=l.type==="labelImage"?4:2;l.type="data",r+=o}}return t.length!==i.length&&on(t,0,t.length,i),t}function Lk(t,r){let i=t.length,l=0,o,d,u,h;for(;i--;)if(o=t[i][1],d){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;t[i][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(u){if(t[i][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(d=i,o.type!=="labelLink")){l=2;break}}else o.type==="labelEnd"&&(u=i);const g={type:t[d][1].type==="labelLink"?"link":"image",start:{...t[d][1].start},end:{...t[t.length-1][1].end}},p={type:"label",start:{...t[d][1].start},end:{...t[u][1].end}},v={type:"labelText",start:{...t[d+l+2][1].end},end:{...t[u-2][1].start}};return h=[["enter",g,r],["enter",p,r]],h=bn(h,t.slice(d+1,d+l+3)),h=bn(h,[["enter",v,r]]),h=bn(h,Xs(r.parser.constructs.insideSpan.null,t.slice(d+l+4,u-3),r)),h=bn(h,[["exit",v,r],t[u-2],t[u-1],["exit",p,r]]),h=bn(h,t.slice(u+1)),h=bn(h,[["exit",g,r]]),on(t,d,t.length,h),t}function Bk(t,r,i){const l=this;let o=l.events.length,d,u;for(;o--;)if((l.events[o][1].type==="labelImage"||l.events[o][1].type==="labelLink")&&!l.events[o][1]._balanced){d=l.events[o][1];break}return h;function h(S){return d?d._inactive?y(S):(u=l.parser.defined.includes(Cn(l.sliceSerialize({start:d.end,end:l.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(S),t.exit("labelMarker"),t.exit("labelEnd"),g):i(S)}function g(S){return S===40?t.attempt(Ok,v,u?v:y)(S):S===91?t.attempt(Mk,v,u?p:y)(S):u?v(S):y(S)}function p(S){return t.attempt(zk,v,y)(S)}function v(S){return r(S)}function y(S){return d._balanced=!0,i(S)}}function Hk(t,r,i){return l;function l(y){return t.enter("resource"),t.enter("resourceMarker"),t.consume(y),t.exit("resourceMarker"),o}function o(y){return rt(y)?rl(t,d)(y):d(y)}function d(y){return y===41?v(y):Yy(t,u,h,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(y)}function u(y){return rt(y)?rl(t,g)(y):v(y)}function h(y){return i(y)}function g(y){return y===34||y===39||y===40?Xy(t,p,i,"resourceTitle","resourceTitleMarker","resourceTitleString")(y):v(y)}function p(y){return rt(y)?rl(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 Uk(t,r,i){const l=this;return o;function o(h){return Ky.call(l,t,d,u,"reference","referenceMarker","referenceString")(h)}function d(h){return l.parser.defined.includes(Cn(l.sliceSerialize(l.events[l.events.length-1][1]).slice(1,-1)))?r(h):i(h)}function u(h){return i(h)}}function qk(t,r,i){return l;function l(d){return t.enter("reference"),t.enter("referenceMarker"),t.consume(d),t.exit("referenceMarker"),o}function o(d){return d===93?(t.enter("referenceMarker"),t.consume(d),t.exit("referenceMarker"),t.exit("reference"),r):i(d)}}const Gk={name:"labelStartImage",resolveAll:xd.resolveAll,tokenize:$k};function $k(t,r,i){const l=this;return o;function o(h){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(h),t.exit("labelImageMarker"),d}function d(h){return h===91?(t.enter("labelMarker"),t.consume(h),t.exit("labelMarker"),t.exit("labelImage"),u):i(h)}function u(h){return h===94&&"_hiddenFootnoteSupport"in l.parser.constructs?i(h):r(h)}}const Fk={name:"labelStartLink",resolveAll:xd.resolveAll,tokenize:Vk};function Vk(t,r,i){const l=this;return o;function o(u){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(u),t.exit("labelMarker"),t.exit("labelLink"),d}function d(u){return u===94&&"_hiddenFootnoteSupport"in l.parser.constructs?i(u):r(u)}}const Ec={name:"lineEnding",tokenize:Pk};function Pk(t,r){return i;function i(l){return t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),$e(t,r,"linePrefix")}}const As={name:"thematicBreak",tokenize:Yk};function Yk(t,r,i){let l=0,o;return d;function d(p){return t.enter("thematicBreak"),u(p)}function u(p){return o=p,h(p)}function h(p){return p===o?(t.enter("thematicBreakSequence"),g(p)):l>=3&&(p===null||ke(p))?(t.exit("thematicBreak"),r(p)):i(p)}function g(p){return p===o?(t.consume(p),l++,g):(t.exit("thematicBreakSequence"),He(p)?$e(t,h,"whitespace")(p):h(p))}}const Kt={continuation:{tokenize:Zk},exit:Wk,name:"list",tokenize:Qk},Kk={partial:!0,tokenize:ew},Xk={partial:!0,tokenize:Jk};function Qk(t,r,i){const l=this,o=l.events[l.events.length-1];let d=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,u=0;return h;function h(x){const w=l.containerState.type||(x===42||x===43||x===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!l.containerState.marker||x===l.containerState.marker:Qc(x)){if(l.containerState.type||(l.containerState.type=w,t.enter(w,{_container:!0})),w==="listUnordered")return t.enter("listItemPrefix"),x===42||x===45?t.check(As,i,p)(x):p(x);if(!l.interrupt||x===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),g(x)}return i(x)}function g(x){return Qc(x)&&++u<10?(t.consume(x),g):(!l.interrupt||u<2)&&(l.containerState.marker?x===l.containerState.marker:x===41||x===46)?(t.exit("listItemValue"),p(x)):i(x)}function p(x){return t.enter("listItemMarker"),t.consume(x),t.exit("listItemMarker"),l.containerState.marker=l.containerState.marker||x,t.check(ol,l.interrupt?i:v,t.attempt(Kk,S,y))}function v(x){return l.containerState.initialBlankLine=!0,d++,S(x)}function y(x){return He(x)?(t.enter("listItemPrefixWhitespace"),t.consume(x),t.exit("listItemPrefixWhitespace"),S):i(x)}function S(x){return l.containerState.size=d+l.sliceSerialize(t.exit("listItemPrefix"),!0).length,r(x)}}function Zk(t,r,i){const l=this;return l.containerState._closeFlow=void 0,t.check(ol,o,d);function o(h){return l.containerState.furtherBlankLines=l.containerState.furtherBlankLines||l.containerState.initialBlankLine,$e(t,r,"listItemIndent",l.containerState.size+1)(h)}function d(h){return l.containerState.furtherBlankLines||!He(h)?(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,u(h)):(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,t.attempt(Xk,r,u)(h))}function u(h){return l.containerState._closeFlow=!0,l.interrupt=void 0,$e(t,t.attempt(Kt,r,i),"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(h)}}function Jk(t,r,i){const l=this;return $e(t,o,"listItemIndent",l.containerState.size+1);function o(d){const u=l.events[l.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===l.containerState.size?r(d):i(d)}}function Wk(t){t.exit(this.containerState.type)}function ew(t,r,i){const l=this;return $e(t,o,"listItemPrefixWhitespace",l.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(d){const u=l.events[l.events.length-1];return!He(d)&&u&&u[1].type==="listItemPrefixWhitespace"?r(d):i(d)}}const gg={name:"setextUnderline",resolveTo:tw,tokenize:nw};function tw(t,r){let i=t.length,l,o,d;for(;i--;)if(t[i][0]==="enter"){if(t[i][1].type==="content"){l=i;break}t[i][1].type==="paragraph"&&(o=i)}else t[i][1].type==="content"&&t.splice(i,1),!d&&t[i][1].type==="definition"&&(d=i);const u={type:"setextHeading",start:{...t[l][1].start},end:{...t[t.length-1][1].end}};return t[o][1].type="setextHeadingText",d?(t.splice(o,0,["enter",u,r]),t.splice(d+1,0,["exit",t[l][1],r]),t[l][1].end={...t[d][1].end}):t[l][1]=u,t.push(["exit",u,r]),t}function nw(t,r,i){const l=this;let o;return d;function d(p){let v=l.events.length,y;for(;v--;)if(l.events[v][1].type!=="lineEnding"&&l.events[v][1].type!=="linePrefix"&&l.events[v][1].type!=="content"){y=l.events[v][1].type==="paragraph";break}return!l.parser.lazy[l.now().line]&&(l.interrupt||y)?(t.enter("setextHeadingLine"),o=p,u(p)):i(p)}function u(p){return t.enter("setextHeadingLineSequence"),h(p)}function h(p){return p===o?(t.consume(p),h):(t.exit("setextHeadingLineSequence"),He(p)?$e(t,g,"lineSuffix")(p):g(p))}function g(p){return p===null||ke(p)?(t.exit("setextHeadingLine"),r(p)):i(p)}}const rw={tokenize:iw};function iw(t){const r=this,i=t.attempt(ol,l,t.attempt(this.parser.constructs.flowInitial,o,$e(t,t.attempt(this.parser.constructs.flow,o,t.attempt(uk,o)),"linePrefix")));return i;function l(d){if(d===null){t.consume(d);return}return t.enter("lineEndingBlank"),t.consume(d),t.exit("lineEndingBlank"),r.currentConstruct=void 0,i}function o(d){if(d===null){t.consume(d);return}return t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),r.currentConstruct=void 0,i}}const aw={resolveAll:Zy()},lw=Qy("string"),sw=Qy("text");function Qy(t){return{resolveAll:Zy(t==="text"?ow:void 0),tokenize:r};function r(i){const l=this,o=this.parser.constructs[t],d=i.attempt(o,u,h);return u;function u(v){return p(v)?d(v):h(v)}function h(v){if(v===null){i.consume(v);return}return i.enter("data"),i.consume(v),g}function g(v){return p(v)?(i.exit("data"),d(v)):(i.consume(v),g)}function p(v){if(v===null)return!0;const y=o[v];let S=-1;if(y)for(;++S<y.length;){const x=y[S];if(!x.previous||x.previous.call(l,l.previous))return!0}return!1}}}function Zy(t){return r;function r(i,l){let o=-1,d;for(;++o<=i.length;)d===void 0?i[o]&&i[o][1].type==="data"&&(d=o,o++):(!i[o]||i[o][1].type!=="data")&&(o!==d+2&&(i[d][1].end=i[o-1][1].end,i.splice(d+2,o-d-2),o=d+2),d=void 0);return t?t(i,l):i}}function ow(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 l=t[i-1][1],o=r.sliceStream(l);let d=o.length,u=-1,h=0,g;for(;d--;){const p=o[d];if(typeof p=="string"){for(u=p.length;p.charCodeAt(u-1)===32;)h++,u--;if(u)break;u=-1}else if(p===-2)g=!0,h++;else if(p!==-1){d++;break}}if(r._contentTypeTextTrailing&&i===t.length&&(h=0),h){const p={type:i===t.length||g||h<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:d?u:l.start._bufferIndex+u,_index:l.start._index+d,line:l.end.line,column:l.end.column-h,offset:l.end.offset-h},end:{...l.end}};l.end={...p.start},l.start.offset===l.end.offset?Object.assign(l,p):(t.splice(i,0,["enter",p,r],["exit",p,r]),i+=2)}i++}return t}const uw={42:Kt,43:Kt,45:Kt,48:Kt,49:Kt,50:Kt,51:Kt,52:Kt,53:Kt,54:Kt,55:Kt,56:Kt,57:Kt,62:$y},cw={91:mk},dw={[-2]:Tc,[-1]:Tc,32:Tc},fw={35:xk,42:As,45:[gg,As],60:Ck,61:gg,95:As,96:mg,126:mg},hw={38:Vy,92:Fy},mw={[-5]:Ec,[-4]:Ec,[-3]:Ec,33:Gk,38:Vy,42:Zc,60:[F0,Ik],91:Fk,92:[vk,Fy],93:xd,95:Zc,96:rk},pw={null:[Zc,aw]},gw={null:[42,95]},yw={null:[]},vw=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:gw,contentInitial:cw,disable:yw,document:uw,flow:fw,flowInitial:dw,insideSpan:pw,string:hw,text:mw},Symbol.toStringTag,{value:"Module"}));function bw(t,r,i){let l={_bufferIndex:-1,_index:0,line:i&&i.line||1,column:i&&i.column||1,offset:i&&i.offset||0};const o={},d=[];let u=[],h=[];const g={attempt:$(K),check:$(E),consume:N,enter:A,exit:G,interrupt:$(E,{interrupt:!0})},p={code:null,containerState:{},defineSkip:I,events:[],now:w,parser:t,previous:null,sliceSerialize:S,sliceStream:x,write:y};let v=r.tokenize.call(p,g);return r.resolveAll&&d.push(r),p;function y(V){return u=bn(u,V),H(),u[u.length-1]!==null?[]:(te(r,0),p.events=Xs(d,p.events,p),p.events)}function S(V,F){return Sw(x(V),F)}function x(V){return xw(u,V)}function w(){const{_bufferIndex:V,_index:F,line:le,column:X,offset:B}=l;return{_bufferIndex:V,_index:F,line:le,column:X,offset:B}}function I(V){o[V.line]=V.column,z()}function H(){let V;for(;l._index<u.length;){const F=u[l._index];if(typeof F=="string")for(V=l._index,l._bufferIndex<0&&(l._bufferIndex=0);l._index===V&&l._bufferIndex<F.length;)T(F.charCodeAt(l._bufferIndex));else T(F)}}function T(V){v=v(V)}function N(V){ke(V)?(l.line++,l.column=1,l.offset+=V===-3?2:1,z()):V!==-1&&(l.column++,l.offset++),l._bufferIndex<0?l._index++:(l._bufferIndex++,l._bufferIndex===u[l._index].length&&(l._bufferIndex=-1,l._index++)),p.previous=V}function A(V,F){const le=F||{};return le.type=V,le.start=w(),p.events.push(["enter",le,p]),h.push(le),le}function G(V){const F=h.pop();return F.end=w(),p.events.push(["exit",F,p]),F}function K(V,F){te(V,F.from)}function E(V,F){F.restore()}function $(V,F){return le;function le(X,B,O){let U,_,W,R;return Array.isArray(X)?M(X):"tokenize"in X?M([X]):D(X);function D(Y){return ce;function ce(he){const pe=he!==null&&Y[he],ye=he!==null&&Y.null,je=[...Array.isArray(pe)?pe:pe?[pe]:[],...Array.isArray(ye)?ye:ye?[ye]:[]];return M(je)(he)}}function M(Y){return U=Y,_=0,Y.length===0?O:C(Y[_])}function C(Y){return ce;function ce(he){return R=se(),W=Y,Y.partial||(p.currentConstruct=Y),Y.name&&p.parser.constructs.disable.null.includes(Y.name)?de():Y.tokenize.call(F?Object.assign(Object.create(p),F):p,g,ie,de)(he)}}function ie(Y){return V(W,R),B}function de(Y){return R.restore(),++_<U.length?C(U[_]):O}}}function te(V,F){V.resolveAll&&!d.includes(V)&&d.push(V),V.resolve&&on(p.events,F,p.events.length-F,V.resolve(p.events.slice(F),p)),V.resolveTo&&(p.events=V.resolveTo(p.events,p))}function se(){const V=w(),F=p.previous,le=p.currentConstruct,X=p.events.length,B=Array.from(h);return{from:X,restore:O};function O(){l=V,p.previous=F,p.currentConstruct=le,p.events.length=X,h=B,z()}}function z(){l.line in o&&l.column<2&&(l.column=o[l.line],l.offset+=o[l.line]-1)}}function xw(t,r){const i=r.start._index,l=r.start._bufferIndex,o=r.end._index,d=r.end._bufferIndex;let u;if(i===o)u=[t[i].slice(l,d)];else{if(u=t.slice(i,o),l>-1){const h=u[0];typeof h=="string"?u[0]=h.slice(l):u.shift()}d>0&&u.push(t[o].slice(0,d))}return u}function Sw(t,r){let i=-1;const l=[];let o;for(;++i<t.length;){const d=t[i];let u;if(typeof d=="string")u=d;else switch(d){case-5:{u="\r";break}case-4:{u=`
|
|
14
|
-
`;break}case-3:{u=`\r
|
|
15
|
-
`;break}case-2:{u=r?" ":" ";break}case-1:{if(!r&&o)continue;u=" ";break}default:u=String.fromCharCode(d)}o=d===-2,l.push(u)}return l.join("")}function kw(t){const l={constructs:qy([vw,...(t||{}).extensions||[]]),content:o(L0),defined:[],document:o(H0),flow:o(rw),lazy:{},string:o(lw),text:o(sw)};return l;function o(d){return u;function u(h){return bw(l,d,h)}}}function ww(t){for(;!Py(t););return t}const yg=/[\0\t\n\r]/g;function Cw(){let t=1,r="",i=!0,l;return o;function o(d,u,h){const g=[];let p,v,y,S,x;for(d=r+(typeof d=="string"?d.toString():new TextDecoder(u||void 0).decode(d)),y=0,r="",i&&(d.charCodeAt(0)===65279&&y++,i=void 0);y<d.length;){if(yg.lastIndex=y,p=yg.exec(d),S=p&&p.index!==void 0?p.index:d.length,x=d.charCodeAt(S),!p){r=d.slice(y);break}if(x===10&&y===S&&l)g.push(-3),l=void 0;else switch(l&&(g.push(-5),l=void 0),y<S&&(g.push(d.slice(y,S)),t+=S-y),x){case 0:{g.push(65533),t++;break}case 9:{for(v=Math.ceil(t/4)*4,g.push(-2);t++<v;)g.push(-1);break}case 10:{g.push(-4),t=1;break}default:l=!0,t=1}y=S+1}return h&&(l&&g.push(-5),r&&g.push(r),g.push(null)),g}}const jw=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Rw(t){return t.replace(jw,Tw)}function Tw(t,r,i){if(r)return r;if(i.charCodeAt(0)===35){const o=i.charCodeAt(1),d=o===120||o===88;return Gy(i.slice(d?2:1),d?16:10)}return bd(i)||t}const Jy={}.hasOwnProperty;function Ew(t,r,i){return r&&typeof r=="object"&&(i=r,r=void 0),Nw(i)(ww(kw(i).document().write(Cw()(t,r,!0))))}function Nw(t){const r={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:d(gt),autolinkProtocol:se,autolinkEmail:se,atxHeading:d(lt),blockQuote:d(ye),characterEscape:se,characterReference:se,codeFenced:d(je),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:d(je,u),codeText:d(ze,u),codeTextData:se,data:se,codeFlowValue:se,definition:d(Ye),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:d(Ke),hardBreakEscape:d(Zt),hardBreakTrailing:d(Zt),htmlFlow:d(Tt,u),htmlFlowData:se,htmlText:d(Tt,u),htmlTextData:se,image:d(jn),label:u,link:d(gt),listItem:d(Ee),listItemValue:S,listOrdered:d(Jt,y),listUnordered:d(Jt),paragraph:d(Xe),reference:C,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:d(lt),strong:d(ut),thematicBreak:d(Se)},exit:{atxHeading:g(),atxHeadingSequence:K,autolink:g(),autolinkEmail:pe,autolinkProtocol:he,blockQuote:g(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:de,characterReferenceMarkerNumeric:de,characterReferenceValue:Y,characterReference:ce,codeFenced:g(H),codeFencedFence:I,codeFencedFenceInfo:x,codeFencedFenceMeta:w,codeFlowValue:z,codeIndented:g(T),codeText:g(B),codeTextData:z,data:z,definition:g(),definitionDestinationString:G,definitionLabelString:N,definitionTitleString:A,emphasis:g(),hardBreakEscape:g(F),hardBreakTrailing:g(F),htmlFlow:g(le),htmlFlowData:z,htmlText:g(X),htmlTextData:z,image:g(U),label:W,labelText:_,lineEnding:V,link:g(O),listItem:g(),listOrdered:g(),listUnordered:g(),paragraph:g(),referenceString:ie,resourceDestinationString:R,resourceTitleString:D,resource:M,setextHeading:g(te),setextHeadingLineSequence:$,setextHeadingText:E,strong:g(),thematicBreak:g()}};Wy(r,(t||{}).mdastExtensions||[]);const i={};return l;function l(re){let fe={type:"root",children:[]};const be={stack:[fe],tokenStack:[],config:r,enter:h,exit:p,buffer:u,resume:v,data:i},Re=[];let Te=-1;for(;++Te<re.length;)if(re[Te][1].type==="listOrdered"||re[Te][1].type==="listUnordered")if(re[Te][0]==="enter")Re.push(Te);else{const st=Re.pop();Te=o(re,st,Te)}for(Te=-1;++Te<re.length;){const st=r[re[Te][0]];Jy.call(st,re[Te][1].type)&&st[re[Te][1].type].call(Object.assign({sliceSerialize:re[Te][2].sliceSerialize},be),re[Te][1])}if(be.tokenStack.length>0){const st=be.tokenStack[be.tokenStack.length-1];(st[1]||vg).call(be,void 0,st[0])}for(fe.position={start:Tr(re.length>0?re[0][1].start:{line:1,column:1,offset:0}),end:Tr(re.length>0?re[re.length-2][1].end:{line:1,column:1,offset:0})},Te=-1;++Te<r.transforms.length;)fe=r.transforms[Te](fe)||fe;return fe}function o(re,fe,be){let Re=fe-1,Te=-1,st=!1,yt,we,Ne,_e;for(;++Re<=be;){const Ie=re[Re];switch(Ie[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ie[0]==="enter"?Te++:Te--,_e=void 0;break}case"lineEndingBlank":{Ie[0]==="enter"&&(yt&&!_e&&!Te&&!Ne&&(Ne=Re),_e=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:_e=void 0}if(!Te&&Ie[0]==="enter"&&Ie[1].type==="listItemPrefix"||Te===-1&&Ie[0]==="exit"&&(Ie[1].type==="listUnordered"||Ie[1].type==="listOrdered")){if(yt){let Lt=Re;for(we=void 0;Lt--;){const Ut=re[Lt];if(Ut[1].type==="lineEnding"||Ut[1].type==="lineEndingBlank"){if(Ut[0]==="exit")continue;we&&(re[we][1].type="lineEndingBlank",st=!0),Ut[1].type="lineEnding",we=Lt}else if(!(Ut[1].type==="linePrefix"||Ut[1].type==="blockQuotePrefix"||Ut[1].type==="blockQuotePrefixWhitespace"||Ut[1].type==="blockQuoteMarker"||Ut[1].type==="listItemIndent"))break}Ne&&(!we||Ne<we)&&(yt._spread=!0),yt.end=Object.assign({},we?re[we][1].start:Ie[1].end),re.splice(we||Re,0,["exit",yt,Ie[2]]),Re++,be++}if(Ie[1].type==="listItemPrefix"){const Lt={type:"listItem",_spread:!1,start:Object.assign({},Ie[1].start),end:void 0};yt=Lt,re.splice(Re,0,["enter",Lt,Ie[2]]),Re++,be++,Ne=void 0,_e=!0}}}return re[fe][1]._spread=st,be}function d(re,fe){return be;function be(Re){h.call(this,re(Re),Re),fe&&fe.call(this,Re)}}function u(){this.stack.push({type:"fragment",children:[]})}function h(re,fe,be){this.stack[this.stack.length-1].children.push(re),this.stack.push(re),this.tokenStack.push([fe,be||void 0]),re.position={start:Tr(fe.start),end:void 0}}function g(re){return fe;function fe(be){re&&re.call(this,be),p.call(this,be)}}function p(re,fe){const be=this.stack.pop(),Re=this.tokenStack.pop();if(Re)Re[0].type!==re.type&&(fe?fe.call(this,re,Re[0]):(Re[1]||vg).call(this,re,Re[0]));else throw new Error("Cannot close `"+re.type+"` ("+nl({start:re.start,end:re.end})+"): it’s not open");be.position.end=Tr(re.end)}function v(){return vd(this.stack.pop())}function y(){this.data.expectingFirstListItemValue=!0}function S(re){if(this.data.expectingFirstListItemValue){const fe=this.stack[this.stack.length-2];fe.start=Number.parseInt(this.sliceSerialize(re),10),this.data.expectingFirstListItemValue=void 0}}function x(){const re=this.resume(),fe=this.stack[this.stack.length-1];fe.lang=re}function w(){const re=this.resume(),fe=this.stack[this.stack.length-1];fe.meta=re}function I(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function H(){const re=this.resume(),fe=this.stack[this.stack.length-1];fe.value=re.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function T(){const re=this.resume(),fe=this.stack[this.stack.length-1];fe.value=re.replace(/(\r?\n|\r)$/g,"")}function N(re){const fe=this.resume(),be=this.stack[this.stack.length-1];be.label=fe,be.identifier=Cn(this.sliceSerialize(re)).toLowerCase()}function A(){const re=this.resume(),fe=this.stack[this.stack.length-1];fe.title=re}function G(){const re=this.resume(),fe=this.stack[this.stack.length-1];fe.url=re}function K(re){const fe=this.stack[this.stack.length-1];if(!fe.depth){const be=this.sliceSerialize(re).length;fe.depth=be}}function E(){this.data.setextHeadingSlurpLineEnding=!0}function $(re){const fe=this.stack[this.stack.length-1];fe.depth=this.sliceSerialize(re).codePointAt(0)===61?1:2}function te(){this.data.setextHeadingSlurpLineEnding=void 0}function se(re){const be=this.stack[this.stack.length-1].children;let Re=be[be.length-1];(!Re||Re.type!=="text")&&(Re=ee(),Re.position={start:Tr(re.start),end:void 0},be.push(Re)),this.stack.push(Re)}function z(re){const fe=this.stack.pop();fe.value+=this.sliceSerialize(re),fe.position.end=Tr(re.end)}function V(re){const fe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const be=fe.children[fe.children.length-1];be.position.end=Tr(re.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&r.canContainEols.includes(fe.type)&&(se.call(this,re),z.call(this,re))}function F(){this.data.atHardBreak=!0}function le(){const re=this.resume(),fe=this.stack[this.stack.length-1];fe.value=re}function X(){const re=this.resume(),fe=this.stack[this.stack.length-1];fe.value=re}function B(){const re=this.resume(),fe=this.stack[this.stack.length-1];fe.value=re}function O(){const re=this.stack[this.stack.length-1];if(this.data.inReference){const fe=this.data.referenceType||"shortcut";re.type+="Reference",re.referenceType=fe,delete re.url,delete re.title}else delete re.identifier,delete re.label;this.data.referenceType=void 0}function U(){const re=this.stack[this.stack.length-1];if(this.data.inReference){const fe=this.data.referenceType||"shortcut";re.type+="Reference",re.referenceType=fe,delete re.url,delete re.title}else delete re.identifier,delete re.label;this.data.referenceType=void 0}function _(re){const fe=this.sliceSerialize(re),be=this.stack[this.stack.length-2];be.label=Rw(fe),be.identifier=Cn(fe).toLowerCase()}function W(){const re=this.stack[this.stack.length-1],fe=this.resume(),be=this.stack[this.stack.length-1];if(this.data.inReference=!0,be.type==="link"){const Re=re.children;be.children=Re}else be.alt=fe}function R(){const re=this.resume(),fe=this.stack[this.stack.length-1];fe.url=re}function D(){const re=this.resume(),fe=this.stack[this.stack.length-1];fe.title=re}function M(){this.data.inReference=void 0}function C(){this.data.referenceType="collapsed"}function ie(re){const fe=this.resume(),be=this.stack[this.stack.length-1];be.label=fe,be.identifier=Cn(this.sliceSerialize(re)).toLowerCase(),this.data.referenceType="full"}function de(re){this.data.characterReferenceType=re.type}function Y(re){const fe=this.sliceSerialize(re),be=this.data.characterReferenceType;let Re;be?(Re=Gy(fe,be==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Re=bd(fe);const Te=this.stack[this.stack.length-1];Te.value+=Re}function ce(re){const fe=this.stack.pop();fe.position.end=Tr(re.end)}function he(re){z.call(this,re);const fe=this.stack[this.stack.length-1];fe.url=this.sliceSerialize(re)}function pe(re){z.call(this,re);const fe=this.stack[this.stack.length-1];fe.url="mailto:"+this.sliceSerialize(re)}function ye(){return{type:"blockquote",children:[]}}function je(){return{type:"code",lang:null,meta:null,value:""}}function ze(){return{type:"inlineCode",value:""}}function Ye(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ke(){return{type:"emphasis",children:[]}}function lt(){return{type:"heading",depth:0,children:[]}}function Zt(){return{type:"break"}}function Tt(){return{type:"html",value:""}}function jn(){return{type:"image",title:null,url:"",alt:null}}function gt(){return{type:"link",title:null,url:"",children:[]}}function Jt(re){return{type:"list",ordered:re.type==="listOrdered",start:null,spread:re._spread,children:[]}}function Ee(re){return{type:"listItem",spread:re._spread,checked:null,children:[]}}function Xe(){return{type:"paragraph",children:[]}}function ut(){return{type:"strong",children:[]}}function ee(){return{type:"text",value:""}}function Se(){return{type:"thematicBreak"}}}function Tr(t){return{line:t.line,column:t.column,offset:t.offset}}function Wy(t,r){let i=-1;for(;++i<r.length;){const l=r[i];Array.isArray(l)?Wy(t,l):Aw(t,l)}}function Aw(t,r){let i;for(i in r)if(Jy.call(r,i))switch(i){case"canContainEols":{const l=r[i];l&&t[i].push(...l);break}case"transforms":{const l=r[i];l&&t[i].push(...l);break}case"enter":case"exit":{const l=r[i];l&&Object.assign(t[i],l);break}}}function vg(t,r){throw t?new Error("Cannot close `"+t.type+"` ("+nl({start:t.start,end:t.end})+"): a different token (`"+r.type+"`, "+nl({start:r.start,end:r.end})+") is open"):new Error("Cannot close document, a token (`"+r.type+"`, "+nl({start:r.start,end:r.end})+") is still open")}function Iw(t){const r=this;r.parser=i;function i(l){return Ew(l,{...r.data("settings"),...t,extensions:r.data("micromarkExtensions")||[],mdastExtensions:r.data("fromMarkdownExtensions")||[]})}}function Dw(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 Ow(t,r){const i={type:"element",tagName:"br",properties:{},children:[]};return t.patch(r,i),[t.applyData(r,i),{type:"text",value:`
|
|
16
|
-
`}]}function Mw(t,r){const i=r.value?r.value+`
|
|
17
|
-
`:"",l={},o=r.lang?r.lang.split(/\s+/):[];o.length>0&&(l.className=["language-"+o[0]]);let d={type:"element",tagName:"code",properties:l,children:[{type:"text",value:i}]};return r.meta&&(d.data={meta:r.meta}),t.patch(r,d),d=t.applyData(r,d),d={type:"element",tagName:"pre",properties:{},children:[d]},t.patch(r,d),d}function zw(t,r){const i={type:"element",tagName:"del",properties:{},children:t.all(r)};return t.patch(r,i),t.applyData(r,i)}function _w(t,r){const i={type:"element",tagName:"em",properties:{},children:t.all(r)};return t.patch(r,i),t.applyData(r,i)}function Lw(t,r){const i=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",l=String(r.identifier).toUpperCase(),o=ta(l.toLowerCase()),d=t.footnoteOrder.indexOf(l);let u,h=t.footnoteCounts.get(l);h===void 0?(h=0,t.footnoteOrder.push(l),u=t.footnoteOrder.length):u=d+1,h+=1,t.footnoteCounts.set(l,h);const g={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(u)}]};t.patch(r,g);const p={type:"element",tagName:"sup",properties:{},children:[g]};return t.patch(r,p),t.applyData(r,p)}function Bw(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 Hw(t,r){if(t.options.allowDangerousHtml){const i={type:"raw",value:r.value};return t.patch(r,i),t.applyData(r,i)}}function ev(t,r){const i=r.referenceType;let l="]";if(i==="collapsed"?l+="[]":i==="full"&&(l+="["+(r.label||r.identifier)+"]"),r.type==="imageReference")return[{type:"text",value:"!["+r.alt+l}];const o=t.all(r),d=o[0];d&&d.type==="text"?d.value="["+d.value:o.unshift({type:"text",value:"["});const u=o[o.length-1];return u&&u.type==="text"?u.value+=l:o.push({type:"text",value:l}),o}function Uw(t,r){const i=String(r.identifier).toUpperCase(),l=t.definitionById.get(i);if(!l)return ev(t,r);const o={src:ta(l.url||""),alt:r.alt};l.title!==null&&l.title!==void 0&&(o.title=l.title);const d={type:"element",tagName:"img",properties:o,children:[]};return t.patch(r,d),t.applyData(r,d)}function qw(t,r){const i={src:ta(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 l={type:"element",tagName:"img",properties:i,children:[]};return t.patch(r,l),t.applyData(r,l)}function Gw(t,r){const i={type:"text",value:r.value.replace(/\r?\n|\r/g," ")};t.patch(r,i);const l={type:"element",tagName:"code",properties:{},children:[i]};return t.patch(r,l),t.applyData(r,l)}function $w(t,r){const i=String(r.identifier).toUpperCase(),l=t.definitionById.get(i);if(!l)return ev(t,r);const o={href:ta(l.url||"")};l.title!==null&&l.title!==void 0&&(o.title=l.title);const d={type:"element",tagName:"a",properties:o,children:t.all(r)};return t.patch(r,d),t.applyData(r,d)}function Fw(t,r){const i={href:ta(r.url)};r.title!==null&&r.title!==void 0&&(i.title=r.title);const l={type:"element",tagName:"a",properties:i,children:t.all(r)};return t.patch(r,l),t.applyData(r,l)}function Vw(t,r,i){const l=t.all(r),o=i?Pw(i):tv(r),d={},u=[];if(typeof r.checked=="boolean"){const v=l[0];let y;v&&v.type==="element"&&v.tagName==="p"?y=v:(y={type:"element",tagName:"p",properties:{},children:[]},l.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:[]}),d.className=["task-list-item"]}let h=-1;for(;++h<l.length;){const v=l[h];(o||h!==0||v.type!=="element"||v.tagName!=="p")&&u.push({type:"text",value:`
|
|
18
|
-
`}),v.type==="element"&&v.tagName==="p"&&!o?u.push(...v.children):u.push(v)}const g=l[l.length-1];g&&(o||g.type!=="element"||g.tagName!=="p")&&u.push({type:"text",value:`
|
|
19
|
-
`});const p={type:"element",tagName:"li",properties:d,children:u};return t.patch(r,p),t.applyData(r,p)}function Pw(t){let r=!1;if(t.type==="list"){r=t.spread||!1;const i=t.children;let l=-1;for(;!r&&++l<i.length;)r=tv(i[l])}return r}function tv(t){const r=t.spread;return r??t.children.length>1}function Yw(t,r){const i={},l=t.all(r);let o=-1;for(typeof r.start=="number"&&r.start!==1&&(i.start=r.start);++o<l.length;){const u=l[o];if(u.type==="element"&&u.tagName==="li"&&u.properties&&Array.isArray(u.properties.className)&&u.properties.className.includes("task-list-item")){i.className=["contains-task-list"];break}}const d={type:"element",tagName:r.ordered?"ol":"ul",properties:i,children:t.wrap(l,!0)};return t.patch(r,d),t.applyData(r,d)}function Kw(t,r){const i={type:"element",tagName:"p",properties:{},children:t.all(r)};return t.patch(r,i),t.applyData(r,i)}function Xw(t,r){const i={type:"root",children:t.wrap(t.all(r))};return t.patch(r,i),t.applyData(r,i)}function Qw(t,r){const i={type:"element",tagName:"strong",properties:{},children:t.all(r)};return t.patch(r,i),t.applyData(r,i)}function Zw(t,r){const i=t.all(r),l=i.shift(),o=[];if(l){const u={type:"element",tagName:"thead",properties:{},children:t.wrap([l],!0)};t.patch(r.children[0],u),o.push(u)}if(i.length>0){const u={type:"element",tagName:"tbody",properties:{},children:t.wrap(i,!0)},h=md(r.children[1]),g=My(r.children[r.children.length-1]);h&&g&&(u.position={start:h,end:g}),o.push(u)}const d={type:"element",tagName:"table",properties:{},children:t.wrap(o,!0)};return t.patch(r,d),t.applyData(r,d)}function Jw(t,r,i){const l=i?i.children:void 0,d=(l?l.indexOf(r):1)===0?"th":"td",u=i&&i.type==="table"?i.align:void 0,h=u?u.length:r.children.length;let g=-1;const p=[];for(;++g<h;){const y=r.children[g],S={},x=u?u[g]:void 0;x&&(S.align=x);let w={type:"element",tagName:d,properties:S,children:[]};y&&(w.children=t.all(y),t.patch(y,w),w=t.applyData(y,w)),p.push(w)}const v={type:"element",tagName:"tr",properties:{},children:t.wrap(p,!0)};return t.patch(r,v),t.applyData(r,v)}function Ww(t,r){const i={type:"element",tagName:"td",properties:{},children:t.all(r)};return t.patch(r,i),t.applyData(r,i)}const bg=9,xg=32;function eC(t){const r=String(t),i=/\r?\n|\r/g;let l=i.exec(r),o=0;const d=[];for(;l;)d.push(Sg(r.slice(o,l.index),o>0,!0),l[0]),o=l.index+l[0].length,l=i.exec(r);return d.push(Sg(r.slice(o),o>0,!1)),d.join("")}function Sg(t,r,i){let l=0,o=t.length;if(r){let d=t.codePointAt(l);for(;d===bg||d===xg;)l++,d=t.codePointAt(l)}if(i){let d=t.codePointAt(o-1);for(;d===bg||d===xg;)o--,d=t.codePointAt(o-1)}return o>l?t.slice(l,o):""}function tC(t,r){const i={type:"text",value:eC(String(r.value))};return t.patch(r,i),t.applyData(r,i)}function nC(t,r){const i={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(r,i),t.applyData(r,i)}const rC={blockquote:Dw,break:Ow,code:Mw,delete:zw,emphasis:_w,footnoteReference:Lw,heading:Bw,html:Hw,imageReference:Uw,image:qw,inlineCode:Gw,linkReference:$w,link:Fw,listItem:Vw,list:Yw,paragraph:Kw,root:Xw,strong:Qw,table:Zw,tableCell:Ww,tableRow:Jw,text:tC,thematicBreak:nC,toml:Cs,yaml:Cs,definition:Cs,footnoteDefinition:Cs};function Cs(){}const nv=-1,Qs=0,il=1,_s=2,Sd=3,kd=4,wd=5,Cd=6,rv=7,iv=8,av=typeof self=="object"?self:globalThis,kg=(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 av[t](r)},iC=(t,r)=>{const i=(o,d)=>(t.set(d,o),o),l=o=>{if(t.has(o))return t.get(o);const[d,u]=r[o];switch(d){case Qs:case nv:return i(u,o);case il:{const h=i([],o);for(const g of u)h.push(l(g));return h}case _s:{const h=i({},o);for(const[g,p]of u)h[l(g)]=l(p);return h}case Sd:return i(new Date(u),o);case kd:{const{source:h,flags:g}=u;return i(new RegExp(h,g),o)}case wd:{const h=i(new Map,o);for(const[g,p]of u)h.set(l(g),l(p));return h}case Cd:{const h=i(new Set,o);for(const g of u)h.add(l(g));return h}case rv:{const{name:h,message:g}=u;return i(typeof av[h]=="function"?kg(h,g):new Error(g),o)}case iv:return i(BigInt(u),o);case"BigInt":return i(Object(BigInt(u)),o);case"ArrayBuffer":return i(new Uint8Array(u).buffer,u);case"DataView":{const{buffer:h}=new Uint8Array(u);return i(new DataView(h),u)}}return i(kg(d,u),o)};return l},wg=t=>iC(new Map,t)(0),Jr="",{toString:aC}={},{keys:lC}=Object,Wa=t=>{const r=typeof t;if(r!=="object"||!t)return[Qs,r];const i=aC.call(t).slice(8,-1);switch(i){case"Array":return[il,Jr];case"Object":return[_s,Jr];case"Date":return[Sd,Jr];case"RegExp":return[kd,Jr];case"Map":return[wd,Jr];case"Set":return[Cd,Jr];case"DataView":return[il,i]}return i.includes("Array")?[il,i]:t instanceof Error?[rv,t.name||"Error"]:[_s,i]},js=([t,r])=>t===Qs&&(r==="function"||r==="symbol"),sC=(t,r,i,l)=>{const o=(u,h)=>{const g=l.push(u)-1;return i.set(h,g),g},d=u=>{if(i.has(u))return i.get(u);let[h,g]=Wa(u);switch(h){case Qs:{let v=u;switch(g){case"bigint":h=iv,v=u.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+g);v=null;break;case"undefined":return o([nv],u)}return o([h,v],u)}case il:{if(g){let S=u;return g==="DataView"?S=new Uint8Array(u.buffer):g==="ArrayBuffer"&&(S=new Uint8Array(u)),o([g,[...S]],u)}const v=[],y=o([h,v],u);for(const S of u)v.push(d(S));return y}case _s:{if(g)switch(g){case"BigInt":return o([g,u.toString()],u);case"Boolean":case"Number":case"String":return o([g,u.valueOf()],u)}if(r&&"toJSON"in u)return d(u.toJSON());const v=[],y=o([h,v],u);for(const S of lC(u))(t||!js(Wa(u[S])))&&v.push([d(S),d(u[S])]);return y}case Sd:return o([h,isNaN(u.getTime())?Jr:u.toISOString()],u);case kd:{const{source:v,flags:y}=u;return o([h,{source:v,flags:y}],u)}case wd:{const v=[],y=o([h,v],u);for(const[S,x]of u)(t||!(js(Wa(S))||js(Wa(x))))&&v.push([d(S),d(x)]);return y}case Cd:{const v=[],y=o([h,v],u);for(const S of u)(t||!js(Wa(S)))&&v.push(d(S));return y}}const{message:p}=u;return o([h,{name:g,message:p}],u)};return d},Cg=(t,{json:r,lossy:i}={})=>{const l=[];return sC(!(r||i),!!r,new Map,l)(t),l},Ls=typeof structuredClone=="function"?(t,r)=>r&&("json"in r||"lossy"in r)?wg(Cg(t,r)):structuredClone(t):(t,r)=>wg(Cg(t,r));function oC(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 uC(t,r){return"Back to reference "+(t+1)+(r>1?"-"+r:"")}function cC(t){const r=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",i=t.options.footnoteBackContent||oC,l=t.options.footnoteBackLabel||uC,o=t.options.footnoteLabel||"Footnotes",d=t.options.footnoteLabelTagName||"h2",u=t.options.footnoteLabelProperties||{className:["sr-only"]},h=[];let g=-1;for(;++g<t.footnoteOrder.length;){const p=t.footnoteById.get(t.footnoteOrder[g]);if(!p)continue;const v=t.all(p),y=String(p.identifier).toUpperCase(),S=ta(y.toLowerCase());let x=0;const w=[],I=t.footnoteCounts.get(y);for(;I!==void 0&&++x<=I;){w.length>0&&w.push({type:"text",value:" "});let N=typeof i=="string"?i:i(g,x);typeof N=="string"&&(N={type:"text",value:N}),w.push({type:"element",tagName:"a",properties:{href:"#"+r+"fnref-"+S+(x>1?"-"+x:""),dataFootnoteBackref:"",ariaLabel:typeof l=="string"?l:l(g,x),className:["data-footnote-backref"]},children:Array.isArray(N)?N:[N]})}const H=v[v.length-1];if(H&&H.type==="element"&&H.tagName==="p"){const N=H.children[H.children.length-1];N&&N.type==="text"?N.value+=" ":H.children.push({type:"text",value:" "}),H.children.push(...w)}else v.push(...w);const T={type:"element",tagName:"li",properties:{id:r+"fn-"+S},children:t.wrap(v,!0)};t.patch(p,T),h.push(T)}if(h.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:d,properties:{...Ls(u),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 Zs=(function(t){if(t==null)return mC;if(typeof t=="function")return Js(t);if(typeof t=="object")return Array.isArray(t)?dC(t):fC(t);if(typeof t=="string")return hC(t);throw new Error("Expected function, string, or object as test")});function dC(t){const r=[];let i=-1;for(;++i<t.length;)r[i]=Zs(t[i]);return Js(l);function l(...o){let d=-1;for(;++d<r.length;)if(r[d].apply(this,o))return!0;return!1}}function fC(t){const r=t;return Js(i);function i(l){const o=l;let d;for(d in t)if(o[d]!==r[d])return!1;return!0}}function hC(t){return Js(r);function r(i){return i&&i.type===t}}function Js(t){return r;function r(i,l,o){return!!(pC(i)&&t.call(this,i,typeof l=="number"?l:void 0,o||void 0))}}function mC(){return!0}function pC(t){return t!==null&&typeof t=="object"&&"type"in t}const lv=[],gC=!0,Jc=!1,yC="skip";function sv(t,r,i,l){let o;typeof r=="function"&&typeof i!="function"?(l=i,i=r):o=r;const d=Zs(o),u=l?-1:1;h(t,void 0,[])();function h(g,p,v){const y=g&&typeof g=="object"?g:{};if(typeof y.type=="string"){const x=typeof y.tagName=="string"?y.tagName:typeof y.name=="string"?y.name:void 0;Object.defineProperty(S,"name",{value:"node ("+(g.type+(x?"<"+x+">":""))+")"})}return S;function S(){let x=lv,w,I,H;if((!r||d(g,p,v[v.length-1]||void 0))&&(x=vC(i(g,v)),x[0]===Jc))return x;if("children"in g&&g.children){const T=g;if(T.children&&x[0]!==yC)for(I=(l?T.children.length:-1)+u,H=v.concat(T);I>-1&&I<T.children.length;){const N=T.children[I];if(w=h(N,I,H)(),w[0]===Jc)return w;I=typeof w[1]=="number"?w[1]:I+u}}return x}}}function vC(t){return Array.isArray(t)?t:typeof t=="number"?[gC,t]:t==null?lv:[t]}function jd(t,r,i,l){let o,d,u;typeof r=="function"&&typeof i!="function"?(d=void 0,u=r,o=i):(d=r,u=i,o=l),sv(t,d,h,o);function h(g,p){const v=p[p.length-1],y=v?v.children.indexOf(g):void 0;return u(g,y,v)}}const Wc={}.hasOwnProperty,bC={};function xC(t,r){const i=r||bC,l=new Map,o=new Map,d=new Map,u={...rC,...i.handlers},h={all:p,applyData:kC,definitionById:l,footnoteById:o,footnoteCounts:d,footnoteOrder:[],handlers:u,one:g,options:i,patch:SC,wrap:CC};return jd(t,function(v){if(v.type==="definition"||v.type==="footnoteDefinition"){const y=v.type==="definition"?l:o,S=String(v.identifier).toUpperCase();y.has(S)||y.set(S,v)}}),h;function g(v,y){const S=v.type,x=h.handlers[S];if(Wc.call(h.handlers,S)&&x)return x(h,v,y);if(h.options.passThrough&&h.options.passThrough.includes(S)){if("children"in v){const{children:I,...H}=v,T=Ls(H);return T.children=h.all(v),T}return Ls(v)}return(h.options.unknownHandler||wC)(h,v,y)}function p(v){const y=[];if("children"in v){const S=v.children;let x=-1;for(;++x<S.length;){const w=h.one(S[x],v);if(w){if(x&&S[x-1].type==="break"&&(!Array.isArray(w)&&w.type==="text"&&(w.value=jg(w.value)),!Array.isArray(w)&&w.type==="element")){const I=w.children[0];I&&I.type==="text"&&(I.value=jg(I.value))}Array.isArray(w)?y.push(...w):y.push(w)}}}return y}}function SC(t,r){t.position&&(r.position=u0(t))}function kC(t,r){let i=r;if(t&&t.data){const l=t.data.hName,o=t.data.hChildren,d=t.data.hProperties;if(typeof l=="string")if(i.type==="element")i.tagName=l;else{const u="children"in i?i.children:[i];i={type:"element",tagName:l,properties:{},children:u}}i.type==="element"&&d&&Object.assign(i.properties,Ls(d)),"children"in i&&i.children&&o!==null&&o!==void 0&&(i.children=o)}return i}function wC(t,r){const i=r.data||{},l="value"in r&&!(Wc.call(i,"hProperties")||Wc.call(i,"hChildren"))?{type:"text",value:r.value}:{type:"element",tagName:"div",properties:{},children:t.all(r)};return t.patch(r,l),t.applyData(r,l)}function CC(t,r){const i=[];let l=-1;for(r&&i.push({type:"text",value:`
|
|
22
|
-
`});++l<t.length;)l&&i.push({type:"text",value:`
|
|
23
|
-
`}),i.push(t[l]);return r&&t.length>0&&i.push({type:"text",value:`
|
|
24
|
-
`}),i}function jg(t){let r=0,i=t.charCodeAt(r);for(;i===9||i===32;)r++,i=t.charCodeAt(r);return t.slice(r)}function Rg(t,r){const i=xC(t,r),l=i.one(t,void 0),o=cC(i),d=Array.isArray(l)?{type:"root",children:l}:l||{type:"root",children:[]};return o&&d.children.push({type:"text",value:`
|
|
25
|
-
`},o),d}function jC(t,r){return t&&"run"in t?async function(i,l){const o=Rg(i,{file:l,...r});await t.run(o,l)}:function(i,l){return Rg(i,{file:l,...t||r})}}function Tg(t){if(t)throw t}var Nc,Eg;function RC(){if(Eg)return Nc;Eg=1;var t=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,l=Object.getOwnPropertyDescriptor,o=function(p){return typeof Array.isArray=="function"?Array.isArray(p):r.call(p)==="[object Array]"},d=function(p){if(!p||r.call(p)!=="[object Object]")return!1;var v=t.call(p,"constructor"),y=p.constructor&&p.constructor.prototype&&t.call(p.constructor.prototype,"isPrototypeOf");if(p.constructor&&!v&&!y)return!1;var S;for(S in p);return typeof S>"u"||t.call(p,S)},u=function(p,v){i&&v.name==="__proto__"?i(p,v.name,{enumerable:!0,configurable:!0,value:v.newValue,writable:!0}):p[v.name]=v.newValue},h=function(p,v){if(v==="__proto__")if(t.call(p,v)){if(l)return l(p,v).value}else return;return p[v]};return Nc=function g(){var p,v,y,S,x,w,I=arguments[0],H=1,T=arguments.length,N=!1;for(typeof I=="boolean"&&(N=I,I=arguments[1]||{},H=2),(I==null||typeof I!="object"&&typeof I!="function")&&(I={});H<T;++H)if(p=arguments[H],p!=null)for(v in p)y=h(I,v),S=h(p,v),I!==S&&(N&&S&&(d(S)||(x=o(S)))?(x?(x=!1,w=y&&o(y)?y:[]):w=y&&d(y)?y:{},u(I,{name:v,newValue:g(N,w,S)})):typeof S<"u"&&u(I,{name:v,newValue:S}));return I},Nc}var TC=RC();const Ac=od(TC);function ed(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 EC(){const t=[],r={run:i,use:l};return r;function i(...o){let d=-1;const u=o.pop();if(typeof u!="function")throw new TypeError("Expected function as last argument, not "+u);h(null,...o);function h(g,...p){const v=t[++d];let y=-1;if(g){u(g);return}for(;++y<o.length;)(p[y]===null||p[y]===void 0)&&(p[y]=o[y]);o=p,v?NC(v,h)(...p):u(null,...p)}}function l(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return t.push(o),r}}function NC(t,r){let i;return l;function l(...u){const h=t.length>u.length;let g;h&&u.push(o);try{g=t.apply(this,u)}catch(p){const v=p;if(h&&i)throw v;return o(v)}h||(g&&g.then&&typeof g.then=="function"?g.then(d,o):g instanceof Error?o(g):d(g))}function o(u,...h){i||(i=!0,r(u,...h))}function d(u){o(null,u)}}const Dn={basename:AC,dirname:IC,extname:DC,join:OC,sep:"/"};function AC(t,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');ul(t);let i=0,l=-1,o=t.length,d;if(r===void 0||r.length===0||r.length>t.length){for(;o--;)if(t.codePointAt(o)===47){if(d){i=o+1;break}}else l<0&&(d=!0,l=o+1);return l<0?"":t.slice(i,l)}if(r===t)return"";let u=-1,h=r.length-1;for(;o--;)if(t.codePointAt(o)===47){if(d){i=o+1;break}}else u<0&&(d=!0,u=o+1),h>-1&&(t.codePointAt(o)===r.codePointAt(h--)?h<0&&(l=o):(h=-1,l=u));return i===l?l=u:l<0&&(l=t.length),t.slice(i,l)}function IC(t){if(ul(t),t.length===0)return".";let r=-1,i=t.length,l;for(;--i;)if(t.codePointAt(i)===47){if(l){r=i;break}}else l||(l=!0);return r<0?t.codePointAt(0)===47?"/":".":r===1&&t.codePointAt(0)===47?"//":t.slice(0,r)}function DC(t){ul(t);let r=t.length,i=-1,l=0,o=-1,d=0,u;for(;r--;){const h=t.codePointAt(r);if(h===47){if(u){l=r+1;break}continue}i<0&&(u=!0,i=r+1),h===46?o<0?o=r:d!==1&&(d=1):o>-1&&(d=-1)}return o<0||i<0||d===0||d===1&&o===i-1&&o===l+1?"":t.slice(o,i)}function OC(...t){let r=-1,i;for(;++r<t.length;)ul(t[r]),t[r]&&(i=i===void 0?t[r]:i+"/"+t[r]);return i===void 0?".":MC(i)}function MC(t){ul(t);const r=t.codePointAt(0)===47;let i=zC(t,!r);return i.length===0&&!r&&(i="."),i.length>0&&t.codePointAt(t.length-1)===47&&(i+="/"),r?"/"+i:i}function zC(t,r){let i="",l=0,o=-1,d=0,u=-1,h,g;for(;++u<=t.length;){if(u<t.length)h=t.codePointAt(u);else{if(h===47)break;h=47}if(h===47){if(!(o===u-1||d===1))if(o!==u-1&&d===2){if(i.length<2||l!==2||i.codePointAt(i.length-1)!==46||i.codePointAt(i.length-2)!==46){if(i.length>2){if(g=i.lastIndexOf("/"),g!==i.length-1){g<0?(i="",l=0):(i=i.slice(0,g),l=i.length-1-i.lastIndexOf("/")),o=u,d=0;continue}}else if(i.length>0){i="",l=0,o=u,d=0;continue}}r&&(i=i.length>0?i+"/..":"..",l=2)}else i.length>0?i+="/"+t.slice(o+1,u):i=t.slice(o+1,u),l=u-o-1;o=u,d=0}else h===46&&d>-1?d++:d=-1}return i}function ul(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const _C={cwd:LC};function LC(){return"/"}function td(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function BC(t){if(typeof t=="string")t=new URL(t);else if(!td(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 HC(t)}function HC(t){if(t.hostname!==""){const l=new TypeError('File URL host must be "localhost" or empty on darwin');throw l.code="ERR_INVALID_FILE_URL_HOST",l}const r=t.pathname;let i=-1;for(;++i<r.length;)if(r.codePointAt(i)===37&&r.codePointAt(i+1)===50){const l=r.codePointAt(i+2);if(l===70||l===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 Ic=["history","path","basename","stem","extname","dirname"];class ov{constructor(r){let i;r?td(r)?i={path:r}:typeof r=="string"||UC(r)?i={value:r}:i=r:i={},this.cwd="cwd"in i?"":_C.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let l=-1;for(;++l<Ic.length;){const d=Ic[l];d in i&&i[d]!==void 0&&i[d]!==null&&(this[d]=d==="history"?[...i[d]]:i[d])}let o;for(o in i)Ic.includes(o)||(this[o]=i[o])}get basename(){return typeof this.path=="string"?Dn.basename(this.path):void 0}set basename(r){Oc(r,"basename"),Dc(r,"basename"),this.path=Dn.join(this.dirname||"",r)}get dirname(){return typeof this.path=="string"?Dn.dirname(this.path):void 0}set dirname(r){Ng(this.basename,"dirname"),this.path=Dn.join(r||"",this.basename)}get extname(){return typeof this.path=="string"?Dn.extname(this.path):void 0}set extname(r){if(Dc(r,"extname"),Ng(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=Dn.join(this.dirname,this.stem+(r||""))}get path(){return this.history[this.history.length-1]}set path(r){td(r)&&(r=BC(r)),Oc(r,"path"),this.path!==r&&this.history.push(r)}get stem(){return typeof this.path=="string"?Dn.basename(this.path,this.extname):void 0}set stem(r){Oc(r,"stem"),Dc(r,"stem"),this.path=Dn.join(this.dirname||"",r+(this.extname||""))}fail(r,i,l){const o=this.message(r,i,l);throw o.fatal=!0,o}info(r,i,l){const o=this.message(r,i,l);return o.fatal=void 0,o}message(r,i,l){const o=new _t(r,i,l);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 Dc(t,r){if(t&&t.includes(Dn.sep))throw new Error("`"+r+"` cannot be a path: did not expect `"+Dn.sep+"`")}function Oc(t,r){if(!t)throw new Error("`"+r+"` cannot be empty")}function Ng(t,r){if(!t)throw new Error("Setting `"+r+"` requires `path` to be set too")}function UC(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const qC=(function(t){const l=this.constructor.prototype,o=l[t],d=function(){return o.apply(d,arguments)};return Object.setPrototypeOf(d,l),d}),GC={}.hasOwnProperty;class Rd extends qC{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=EC()}copy(){const r=new Rd;let i=-1;for(;++i<this.attachers.length;){const l=this.attachers[i];r.use(...l)}return r.data(Ac(!0,{},this.namespace)),r}data(r,i){return typeof r=="string"?arguments.length===2?(_c("data",this.frozen),this.namespace[r]=i,this):GC.call(this.namespace,r)&&this.namespace[r]||void 0:r?(_c("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,...l]=this.attachers[this.freezeIndex];if(l[0]===!1)continue;l[0]===!0&&(l[0]=void 0);const o=i.call(r,...l);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(r){this.freeze();const i=Rs(r),l=this.parser||this.Parser;return Mc("parse",l),l(String(i),i)}process(r,i){const l=this;return this.freeze(),Mc("process",this.parser||this.Parser),zc("process",this.compiler||this.Compiler),i?o(void 0,i):new Promise(o);function o(d,u){const h=Rs(r),g=l.parse(h);l.run(g,h,function(v,y,S){if(v||!y||!S)return p(v);const x=y,w=l.stringify(x,S);VC(w)?S.value=w:S.result=w,p(v,S)});function p(v,y){v||!y?u(v):d?d(y):i(void 0,y)}}}processSync(r){let i=!1,l;return this.freeze(),Mc("processSync",this.parser||this.Parser),zc("processSync",this.compiler||this.Compiler),this.process(r,o),Ig("processSync","process",i),l;function o(d,u){i=!0,Tg(d),l=u}}run(r,i,l){Ag(r),this.freeze();const o=this.transformers;return!l&&typeof i=="function"&&(l=i,i=void 0),l?d(void 0,l):new Promise(d);function d(u,h){const g=Rs(i);o.run(r,g,p);function p(v,y,S){const x=y||r;v?h(v):u?u(x):l(void 0,x,S)}}}runSync(r,i){let l=!1,o;return this.run(r,i,d),Ig("runSync","run",l),o;function d(u,h){Tg(u),o=h,l=!0}}stringify(r,i){this.freeze();const l=Rs(i),o=this.compiler||this.Compiler;return zc("stringify",o),Ag(r),o(r,l)}use(r,...i){const l=this.attachers,o=this.namespace;if(_c("use",this.frozen),r!=null)if(typeof r=="function")g(r,i);else if(typeof r=="object")Array.isArray(r)?h(r):u(r);else throw new TypeError("Expected usable value, not `"+r+"`");return this;function d(p){if(typeof p=="function")g(p,[]);else if(typeof p=="object")if(Array.isArray(p)){const[v,...y]=p;g(v,y)}else u(p);else throw new TypeError("Expected usable value, not `"+p+"`")}function u(p){if(!("plugins"in p)&&!("settings"in p))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(p.plugins),p.settings&&(o.settings=Ac(!0,o.settings,p.settings))}function h(p){let v=-1;if(p!=null)if(Array.isArray(p))for(;++v<p.length;){const y=p[v];d(y)}else throw new TypeError("Expected a list of plugins, not `"+p+"`")}function g(p,v){let y=-1,S=-1;for(;++y<l.length;)if(l[y][0]===p){S=y;break}if(S===-1)l.push([p,...v]);else if(v.length>0){let[x,...w]=v;const I=l[S][1];ed(I)&&ed(x)&&(x=Ac(!0,I,x)),l[S]=[p,x,...w]}}}}const $C=new Rd().freeze();function Mc(t,r){if(typeof r!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function zc(t,r){if(typeof r!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function _c(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 Ag(t){if(!ed(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function Ig(t,r,i){if(!i)throw new Error("`"+t+"` finished async. Use `"+r+"` instead")}function Rs(t){return FC(t)?t:new ov(t)}function FC(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function VC(t){return typeof t=="string"||PC(t)}function PC(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const YC="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Dg=[],Og={allowDangerousHtml:!0},KC=/^(https?|ircs?|mailto|xmpp)$/i,XC=[{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 QC(t){const r=ZC(t),i=JC(t);return WC(r.runSync(r.parse(i),i),t)}function ZC(t){const r=t.rehypePlugins||Dg,i=t.remarkPlugins||Dg,l=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...Og}:Og;return $C().use(Iw).use(i).use(jC,l).use(r)}function JC(t){const r=t.children||"",i=new ov;return typeof r=="string"&&(i.value=r),i}function WC(t,r){const i=r.allowedElements,l=r.allowElement,o=r.components,d=r.disallowedElements,u=r.skipHtml,h=r.unwrapDisallowed,g=r.urlTransform||ej;for(const v of XC)Object.hasOwn(r,v.from)&&(""+v.from+(v.to?"use `"+v.to+"` instead":"remove it")+YC+v.id,void 0);return jd(t,p),m0(t,{Fragment:c.Fragment,components:o,ignoreInvalidStyle:!0,jsx:c.jsx,jsxs:c.jsxs,passKeys:!0,passNode:!0});function p(v,y,S){if(v.type==="raw"&&S&&typeof y=="number")return u?S.children.splice(y,1):S.children[y]={type:"text",value:v.value},y;if(v.type==="element"){let x;for(x in Rc)if(Object.hasOwn(Rc,x)&&Object.hasOwn(v.properties,x)){const w=v.properties[x],I=Rc[x];(I===null||I.includes(v.tagName))&&(v.properties[x]=g(String(w||""),x,v))}}if(v.type==="element"){let x=i?!i.includes(v.tagName):d?d.includes(v.tagName):!1;if(!x&&l&&typeof y=="number"&&(x=!l(v,y,S)),x&&S&&typeof y=="number")return h&&v.children?S.children.splice(y,1,...v.children):S.children.splice(y,1),y}}}function ej(t){const r=t.indexOf(":"),i=t.indexOf("?"),l=t.indexOf("#"),o=t.indexOf("/");return r===-1||o!==-1&&r>o||i!==-1&&r>i||l!==-1&&r>l||KC.test(t.slice(0,r))?t:""}function Mg(t,r){const i=String(t);if(typeof r!="string")throw new TypeError("Expected character");let l=0,o=i.indexOf(r);for(;o!==-1;)l++,o=i.indexOf(r,o+r.length);return l}function tj(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function nj(t,r,i){const o=Zs((i||{}).ignore||[]),d=rj(r);let u=-1;for(;++u<d.length;)sv(t,"text",h);function h(p,v){let y=-1,S;for(;++y<v.length;){const x=v[y],w=S?S.children:void 0;if(o(x,w?w.indexOf(x):void 0,S))return;S=x}if(S)return g(p,v)}function g(p,v){const y=v[v.length-1],S=d[u][0],x=d[u][1];let w=0;const H=y.children.indexOf(p);let T=!1,N=[];S.lastIndex=0;let A=S.exec(p.value);for(;A;){const G=A.index,K={index:A.index,input:A.input,stack:[...v,p]};let E=x(...A,K);if(typeof E=="string"&&(E=E.length>0?{type:"text",value:E}:void 0),E===!1?S.lastIndex=G+1:(w!==G&&N.push({type:"text",value:p.value.slice(w,G)}),Array.isArray(E)?N.push(...E):E&&N.push(E),w=G+A[0].length,T=!0),!S.global)break;A=S.exec(p.value)}return T?(w<p.value.length&&N.push({type:"text",value:p.value.slice(w)}),y.children.splice(H,1,...N)):N=[p],H+N.length}}function rj(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 l=-1;for(;++l<i.length;){const o=i[l];r.push([ij(o[0]),aj(o[1])])}return r}function ij(t){return typeof t=="string"?new RegExp(tj(t),"g"):t}function aj(t){return typeof t=="function"?t:function(){return t}}const Lc="phrasing",Bc=["autolink","link","image","label"];function lj(){return{transforms:[hj],enter:{literalAutolink:oj,literalAutolinkEmail:Hc,literalAutolinkHttp:Hc,literalAutolinkWww:Hc},exit:{literalAutolink:fj,literalAutolinkEmail:dj,literalAutolinkHttp:uj,literalAutolinkWww:cj}}}function sj(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Lc,notInConstruct:Bc},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Lc,notInConstruct:Bc},{character:":",before:"[ps]",after:"\\/",inConstruct:Lc,notInConstruct:Bc}]}}function oj(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function Hc(t){this.config.enter.autolinkProtocol.call(this,t)}function uj(t){this.config.exit.autolinkProtocol.call(this,t)}function cj(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 dj(t){this.config.exit.autolinkEmail.call(this,t)}function fj(t){this.exit(t)}function hj(t){nj(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,mj],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),pj]],{ignore:["link","linkReference"]})}function mj(t,r,i,l,o){let d="";if(!uv(o)||(/^w/i.test(r)&&(i=r+i,r="",d="http://"),!gj(i)))return!1;const u=yj(i+l);if(!u[0])return!1;const h={type:"link",title:null,url:d+r+u[0],children:[{type:"text",value:r+u[0]}]};return u[1]?[h,{type:"text",value:u[1]}]:h}function pj(t,r,i,l){return!uv(l,!0)||/[-\d_]$/.test(i)?!1:{type:"link",title:null,url:"mailto:"+r+"@"+i,children:[{type:"text",value:r+"@"+i}]}}function gj(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 yj(t){const r=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!r)return[t,void 0];t=t.slice(0,r.index);let i=r[0],l=i.indexOf(")");const o=Mg(t,"(");let d=Mg(t,")");for(;l!==-1&&o>d;)t+=i.slice(0,l+1),i=i.slice(l+1),l=i.indexOf(")"),d++;return[t,i]}function uv(t,r){const i=t.input.charCodeAt(t.index-1);return(t.index===0||ii(i)||Ks(i))&&(!r||i!==47)}cv.peek=Rj;function vj(){this.buffer()}function bj(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function xj(){this.buffer()}function Sj(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function kj(t){const r=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=Cn(this.sliceSerialize(t)).toLowerCase(),i.label=r}function wj(t){this.exit(t)}function Cj(t){const r=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=Cn(this.sliceSerialize(t)).toLowerCase(),i.label=r}function jj(t){this.exit(t)}function Rj(){return"["}function cv(t,r,i,l){const o=i.createTracker(l);let d=o.move("[^");const u=i.enter("footnoteReference"),h=i.enter("reference");return d+=o.move(i.safe(i.associationId(t),{after:"]",before:d})),h(),u(),d+=o.move("]"),d}function Tj(){return{enter:{gfmFootnoteCallString:vj,gfmFootnoteCall:bj,gfmFootnoteDefinitionLabelString:xj,gfmFootnoteDefinition:Sj},exit:{gfmFootnoteCallString:kj,gfmFootnoteCall:wj,gfmFootnoteDefinitionLabelString:Cj,gfmFootnoteDefinition:jj}}}function Ej(t){let r=!1;return t&&t.firstLineBlank&&(r=!0),{handlers:{footnoteDefinition:i,footnoteReference:cv},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function i(l,o,d,u){const h=d.createTracker(u);let g=h.move("[^");const p=d.enter("footnoteDefinition"),v=d.enter("label");return g+=h.move(d.safe(d.associationId(l),{before:g,after:"]"})),v(),g+=h.move("]:"),l.children&&l.children.length>0&&(h.shift(4),g+=h.move((r?`
|
|
26
|
-
`:" ")+d.indentLines(d.containerFlow(l,h.current()),r?dv:Nj))),p(),g}}function Nj(t,r,i){return r===0?t:dv(t,r,i)}function dv(t,r,i){return(i?"":" ")+t}const Aj=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];fv.peek=zj;function Ij(){return{canContainEols:["delete"],enter:{strikethrough:Oj},exit:{strikethrough:Mj}}}function Dj(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Aj}],handlers:{delete:fv}}}function Oj(t){this.enter({type:"delete",children:[]},t)}function Mj(t){this.exit(t)}function fv(t,r,i,l){const o=i.createTracker(l),d=i.enter("strikethrough");let u=o.move("~~");return u+=i.containerPhrasing(t,{...o.current(),before:u,after:"~"}),u+=o.move("~~"),d(),u}function zj(){return"~"}function _j(t){return t.length}function Lj(t,r){const i=r||{},l=(i.align||[]).concat(),o=i.stringLength||_j,d=[],u=[],h=[],g=[];let p=0,v=-1;for(;++v<t.length;){const I=[],H=[];let T=-1;for(t[v].length>p&&(p=t[v].length);++T<t[v].length;){const N=Bj(t[v][T]);if(i.alignDelimiters!==!1){const A=o(N);H[T]=A,(g[T]===void 0||A>g[T])&&(g[T]=A)}I.push(N)}u[v]=I,h[v]=H}let y=-1;if(typeof l=="object"&&"length"in l)for(;++y<p;)d[y]=zg(l[y]);else{const I=zg(l);for(;++y<p;)d[y]=I}y=-1;const S=[],x=[];for(;++y<p;){const I=d[y];let H="",T="";I===99?(H=":",T=":"):I===108?H=":":I===114&&(T=":");let N=i.alignDelimiters===!1?1:Math.max(1,g[y]-H.length-T.length);const A=H+"-".repeat(N)+T;i.alignDelimiters!==!1&&(N=H.length+N+T.length,N>g[y]&&(g[y]=N),x[y]=N),S[y]=A}u.splice(1,0,S),h.splice(1,0,x),v=-1;const w=[];for(;++v<u.length;){const I=u[v],H=h[v];y=-1;const T=[];for(;++y<p;){const N=I[y]||"";let A="",G="";if(i.alignDelimiters!==!1){const K=g[y]-(H[y]||0),E=d[y];E===114?A=" ".repeat(K):E===99?K%2?(A=" ".repeat(K/2+.5),G=" ".repeat(K/2-.5)):(A=" ".repeat(K/2),G=A):G=" ".repeat(K)}i.delimiterStart!==!1&&!y&&T.push("|"),i.padding!==!1&&!(i.alignDelimiters===!1&&N==="")&&(i.delimiterStart!==!1||y)&&T.push(" "),i.alignDelimiters!==!1&&T.push(A),T.push(N),i.alignDelimiters!==!1&&T.push(G),i.padding!==!1&&T.push(" "),(i.delimiterEnd!==!1||y!==p-1)&&T.push("|")}w.push(i.delimiterEnd===!1?T.join("").replace(/ +$/,""):T.join(""))}return w.join(`
|
|
27
|
-
`)}function Bj(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 Hj(t,r,i,l){const o=i.enter("blockquote"),d=i.createTracker(l);d.move("> "),d.shift(2);const u=i.indentLines(i.containerFlow(t,d.current()),Uj);return o(),u}function Uj(t,r,i){return">"+(i?"":" ")+t}function qj(t,r){return _g(t,r.inConstruct,!0)&&!_g(t,r.notInConstruct,!1)}function _g(t,r,i){if(typeof r=="string"&&(r=[r]),!r||r.length===0)return i;let l=-1;for(;++l<r.length;)if(t.includes(r[l]))return!0;return!1}function Lg(t,r,i,l){let o=-1;for(;++o<i.unsafe.length;)if(i.unsafe[o].character===`
|
|
28
|
-
`&&qj(i.stack,i.unsafe[o]))return/[ \t]/.test(l.before)?"":" ";return`\\
|
|
29
|
-
`}function Gj(t,r){const i=String(t);let l=i.indexOf(r),o=l,d=0,u=0;if(typeof r!="string")throw new TypeError("Expected substring");for(;l!==-1;)l===o?++d>u&&(u=d):d=1,o=l+r.length,l=i.indexOf(r,o);return u}function $j(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 Fj(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 Vj(t,r,i,l){const o=Fj(i),d=t.value||"",u=o==="`"?"GraveAccent":"Tilde";if($j(t,i)){const y=i.enter("codeIndented"),S=i.indentLines(d,Pj);return y(),S}const h=i.createTracker(l),g=o.repeat(Math.max(Gj(d,o)+1,3)),p=i.enter("codeFenced");let v=h.move(g);if(t.lang){const y=i.enter(`codeFencedLang${u}`);v+=h.move(i.safe(t.lang,{before:v,after:" ",encode:["`"],...h.current()})),y()}if(t.lang&&t.meta){const y=i.enter(`codeFencedMeta${u}`);v+=h.move(" "),v+=h.move(i.safe(t.meta,{before:v,after:`
|
|
30
|
-
`,encode:["`"],...h.current()})),y()}return v+=h.move(`
|
|
31
|
-
`),d&&(v+=h.move(d+`
|
|
32
|
-
`)),v+=h.move(g),p(),v}function Pj(t,r,i){return(i?"":" ")+t}function Td(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 Yj(t,r,i,l){const o=Td(i),d=o==='"'?"Quote":"Apostrophe",u=i.enter("definition");let h=i.enter("label");const g=i.createTracker(l);let p=g.move("[");return p+=g.move(i.safe(i.associationId(t),{before:p,after:"]",...g.current()})),p+=g.move("]: "),h(),!t.url||/[\0- \u007F]/.test(t.url)?(h=i.enter("destinationLiteral"),p+=g.move("<"),p+=g.move(i.safe(t.url,{before:p,after:">",...g.current()})),p+=g.move(">")):(h=i.enter("destinationRaw"),p+=g.move(i.safe(t.url,{before:p,after:t.title?" ":`
|
|
33
|
-
`,...g.current()}))),h(),t.title&&(h=i.enter(`title${d}`),p+=g.move(" "+o),p+=g.move(i.safe(t.title,{before:p,after:o,...g.current()})),p+=g.move(o),h()),u(),p}function Kj(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 ll(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Bs(t,r,i){const l=Ji(t),o=Ji(r);return l===void 0?o===void 0?i==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:l===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}}hv.peek=Xj;function hv(t,r,i,l){const o=Kj(i),d=i.enter("emphasis"),u=i.createTracker(l),h=u.move(o);let g=u.move(i.containerPhrasing(t,{after:o,before:h,...u.current()}));const p=g.charCodeAt(0),v=Bs(l.before.charCodeAt(l.before.length-1),p,o);v.inside&&(g=ll(p)+g.slice(1));const y=g.charCodeAt(g.length-1),S=Bs(l.after.charCodeAt(0),y,o);S.inside&&(g=g.slice(0,-1)+ll(y));const x=u.move(o);return d(),i.attentionEncodeSurroundingInfo={after:S.outside,before:v.outside},h+g+x}function Xj(t,r,i){return i.options.emphasis||"*"}function Qj(t,r){let i=!1;return jd(t,function(l){if("value"in l&&/\r?\n|\r/.test(l.value)||l.type==="break")return i=!0,Jc}),!!((!t.depth||t.depth<3)&&vd(t)&&(r.options.setext||i))}function Zj(t,r,i,l){const o=Math.max(Math.min(6,t.depth||1),1),d=i.createTracker(l);if(Qj(t,i)){const v=i.enter("headingSetext"),y=i.enter("phrasing"),S=i.containerPhrasing(t,{...d.current(),before:`
|
|
34
|
-
`,after:`
|
|
35
|
-
`});return y(),v(),S+`
|
|
36
|
-
`+(o===1?"=":"-").repeat(S.length-(Math.max(S.lastIndexOf("\r"),S.lastIndexOf(`
|
|
37
|
-
`))+1))}const u="#".repeat(o),h=i.enter("headingAtx"),g=i.enter("phrasing");d.move(u+" ");let p=i.containerPhrasing(t,{before:"# ",after:`
|
|
38
|
-
`,...d.current()});return/^[\t ]/.test(p)&&(p=ll(p.charCodeAt(0))+p.slice(1)),p=p?u+" "+p:u,i.options.closeAtx&&(p+=" "+u),g(),h(),p}mv.peek=Jj;function mv(t){return t.value||""}function Jj(){return"<"}pv.peek=Wj;function pv(t,r,i,l){const o=Td(i),d=o==='"'?"Quote":"Apostrophe",u=i.enter("image");let h=i.enter("label");const g=i.createTracker(l);let p=g.move("![");return p+=g.move(i.safe(t.alt,{before:p,after:"]",...g.current()})),p+=g.move("]("),h(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(h=i.enter("destinationLiteral"),p+=g.move("<"),p+=g.move(i.safe(t.url,{before:p,after:">",...g.current()})),p+=g.move(">")):(h=i.enter("destinationRaw"),p+=g.move(i.safe(t.url,{before:p,after:t.title?" ":")",...g.current()}))),h(),t.title&&(h=i.enter(`title${d}`),p+=g.move(" "+o),p+=g.move(i.safe(t.title,{before:p,after:o,...g.current()})),p+=g.move(o),h()),p+=g.move(")"),u(),p}function Wj(){return"!"}gv.peek=eR;function gv(t,r,i,l){const o=t.referenceType,d=i.enter("imageReference");let u=i.enter("label");const h=i.createTracker(l);let g=h.move("![");const p=i.safe(t.alt,{before:g,after:"]",...h.current()});g+=h.move(p+"]["),u();const v=i.stack;i.stack=[],u=i.enter("reference");const y=i.safe(i.associationId(t),{before:g,after:"]",...h.current()});return u(),i.stack=v,d(),o==="full"||!p||p!==y?g+=h.move(y+"]"):o==="shortcut"?g=g.slice(0,-1):g+=h.move("]"),g}function eR(){return"!"}yv.peek=tR;function yv(t,r,i){let l=t.value||"",o="`",d=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(l);)o+="`";for(/[^ \r\n]/.test(l)&&(/^[ \r\n]/.test(l)&&/[ \r\n]$/.test(l)||/^`|`$/.test(l))&&(l=" "+l+" ");++d<i.unsafe.length;){const u=i.unsafe[d],h=i.compilePattern(u);let g;if(u.atBreak)for(;g=h.exec(l);){let p=g.index;l.charCodeAt(p)===10&&l.charCodeAt(p-1)===13&&p--,l=l.slice(0,p)+" "+l.slice(g.index+1)}}return o+l+o}function tR(){return"`"}function vv(t,r){const i=vd(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))}bv.peek=nR;function bv(t,r,i,l){const o=Td(i),d=o==='"'?"Quote":"Apostrophe",u=i.createTracker(l);let h,g;if(vv(t,i)){const v=i.stack;i.stack=[],h=i.enter("autolink");let y=u.move("<");return y+=u.move(i.containerPhrasing(t,{before:y,after:">",...u.current()})),y+=u.move(">"),h(),i.stack=v,y}h=i.enter("link"),g=i.enter("label");let p=u.move("[");return p+=u.move(i.containerPhrasing(t,{before:p,after:"](",...u.current()})),p+=u.move("]("),g(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(g=i.enter("destinationLiteral"),p+=u.move("<"),p+=u.move(i.safe(t.url,{before:p,after:">",...u.current()})),p+=u.move(">")):(g=i.enter("destinationRaw"),p+=u.move(i.safe(t.url,{before:p,after:t.title?" ":")",...u.current()}))),g(),t.title&&(g=i.enter(`title${d}`),p+=u.move(" "+o),p+=u.move(i.safe(t.title,{before:p,after:o,...u.current()})),p+=u.move(o),g()),p+=u.move(")"),h(),p}function nR(t,r,i){return vv(t,i)?"<":"["}xv.peek=rR;function xv(t,r,i,l){const o=t.referenceType,d=i.enter("linkReference");let u=i.enter("label");const h=i.createTracker(l);let g=h.move("[");const p=i.containerPhrasing(t,{before:g,after:"]",...h.current()});g+=h.move(p+"]["),u();const v=i.stack;i.stack=[],u=i.enter("reference");const y=i.safe(i.associationId(t),{before:g,after:"]",...h.current()});return u(),i.stack=v,d(),o==="full"||!p||p!==y?g+=h.move(y+"]"):o==="shortcut"?g=g.slice(0,-1):g+=h.move("]"),g}function rR(){return"["}function Ed(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 iR(t){const r=Ed(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 aR(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 Sv(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 lR(t,r,i,l){const o=i.enter("list"),d=i.bulletCurrent;let u=t.ordered?aR(i):Ed(i);const h=t.ordered?u==="."?")":".":iR(i);let g=r&&i.bulletLastUsed?u===i.bulletLastUsed:!1;if(!t.ordered){const v=t.children?t.children[0]:void 0;if((u==="*"||u==="-")&&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&&(g=!0),Sv(i)===u&&v){let y=-1;for(;++y<t.children.length;){const S=t.children[y];if(S&&S.type==="listItem"&&S.children&&S.children[0]&&S.children[0].type==="thematicBreak"){g=!0;break}}}}g&&(u=h),i.bulletCurrent=u;const p=i.containerFlow(t,l);return i.bulletLastUsed=u,i.bulletCurrent=d,o(),p}function sR(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 oR(t,r,i,l){const o=sR(i);let d=i.bulletCurrent||Ed(i);r&&r.type==="list"&&r.ordered&&(d=(typeof r.start=="number"&&r.start>-1?r.start:1)+(i.options.incrementListMarker===!1?0:r.children.indexOf(t))+d);let u=d.length+1;(o==="tab"||o==="mixed"&&(r&&r.type==="list"&&r.spread||t.spread))&&(u=Math.ceil(u/4)*4);const h=i.createTracker(l);h.move(d+" ".repeat(u-d.length)),h.shift(u);const g=i.enter("listItem"),p=i.indentLines(i.containerFlow(t,h.current()),v);return g(),p;function v(y,S,x){return S?(x?"":" ".repeat(u))+y:(x?d:d+" ".repeat(u-d.length))+y}}function uR(t,r,i,l){const o=i.enter("paragraph"),d=i.enter("phrasing"),u=i.containerPhrasing(t,l);return d(),o(),u}const cR=Zs(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function dR(t,r,i,l){return(t.children.some(function(u){return cR(u)})?i.containerPhrasing:i.containerFlow).call(i,t,l)}function fR(t){const r=t.options.strong||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize strong with `"+r+"` for `options.strong`, expected `*`, or `_`");return r}kv.peek=hR;function kv(t,r,i,l){const o=fR(i),d=i.enter("strong"),u=i.createTracker(l),h=u.move(o+o);let g=u.move(i.containerPhrasing(t,{after:o,before:h,...u.current()}));const p=g.charCodeAt(0),v=Bs(l.before.charCodeAt(l.before.length-1),p,o);v.inside&&(g=ll(p)+g.slice(1));const y=g.charCodeAt(g.length-1),S=Bs(l.after.charCodeAt(0),y,o);S.inside&&(g=g.slice(0,-1)+ll(y));const x=u.move(o+o);return d(),i.attentionEncodeSurroundingInfo={after:S.outside,before:v.outside},h+g+x}function hR(t,r,i){return i.options.strong||"*"}function mR(t,r,i,l){return i.safe(t.value,l)}function pR(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 gR(t,r,i){const l=(Sv(i)+(i.options.ruleSpaces?" ":"")).repeat(pR(i));return i.options.ruleSpaces?l.slice(0,-1):l}const wv={blockquote:Hj,break:Lg,code:Vj,definition:Yj,emphasis:hv,hardBreak:Lg,heading:Zj,html:mv,image:pv,imageReference:gv,inlineCode:yv,link:bv,linkReference:xv,list:lR,listItem:oR,paragraph:uR,root:dR,strong:kv,text:mR,thematicBreak:gR};function yR(){return{enter:{table:vR,tableData:Bg,tableHeader:Bg,tableRow:xR},exit:{codeText:SR,table:bR,tableData:Uc,tableHeader:Uc,tableRow:Uc}}}function vR(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 bR(t){this.exit(t),this.data.inTable=void 0}function xR(t){this.enter({type:"tableRow",children:[]},t)}function Uc(t){this.exit(t)}function Bg(t){this.enter({type:"tableCell",children:[]},t)}function SR(t){let r=this.resume();this.data.inTable&&(r=r.replace(/\\([\\|])/g,kR));const i=this.stack[this.stack.length-1];i.type,i.value=r,this.exit(t)}function kR(t,r){return r==="|"?r:t}function wR(t){const r=t||{},i=r.tableCellPadding,l=r.tablePipeAlign,o=r.stringLength,d=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:S,table:u,tableCell:g,tableRow:h}};function u(x,w,I,H){return p(v(x,I,H),x.align)}function h(x,w,I,H){const T=y(x,I,H),N=p([T]);return N.slice(0,N.indexOf(`
|
|
40
|
-
`))}function g(x,w,I,H){const T=I.enter("tableCell"),N=I.enter("phrasing"),A=I.containerPhrasing(x,{...H,before:d,after:d});return N(),T(),A}function p(x,w){return Lj(x,{align:w,alignDelimiters:l,padding:i,stringLength:o})}function v(x,w,I){const H=x.children;let T=-1;const N=[],A=w.enter("table");for(;++T<H.length;)N[T]=y(H[T],w,I);return A(),N}function y(x,w,I){const H=x.children;let T=-1;const N=[],A=w.enter("tableRow");for(;++T<H.length;)N[T]=g(H[T],x,w,I);return A(),N}function S(x,w,I){let H=wv.inlineCode(x,w,I);return I.stack.includes("tableCell")&&(H=H.replace(/\|/g,"\\$&")),H}}function CR(){return{exit:{taskListCheckValueChecked:Hg,taskListCheckValueUnchecked:Hg,paragraph:RR}}}function jR(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:TR}}}function Hg(t){const r=this.stack[this.stack.length-2];r.type,r.checked=t.type==="taskListCheckValueChecked"}function RR(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 l=i.children[0];if(l&&l.type==="text"){const o=r.children;let d=-1,u;for(;++d<o.length;){const h=o[d];if(h.type==="paragraph"){u=h;break}}u===i&&(l.value=l.value.slice(1),l.value.length===0?i.children.shift():i.position&&l.position&&typeof l.position.start.offset=="number"&&(l.position.start.column++,l.position.start.offset++,i.position.start=Object.assign({},l.position.start)))}}this.exit(t)}function TR(t,r,i,l){const o=t.children[0],d=typeof t.checked=="boolean"&&o&&o.type==="paragraph",u="["+(t.checked?"x":" ")+"] ",h=i.createTracker(l);d&&h.move(u);let g=wv.listItem(t,r,i,{...l,...h.current()});return d&&(g=g.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,p)),g;function p(v){return v+u}}function ER(){return[lj(),Tj(),Ij(),yR(),CR()]}function NR(t){return{extensions:[sj(),Ej(t),Dj(),wR(t),jR()]}}const AR={tokenize:_R,partial:!0},Cv={tokenize:LR,partial:!0},jv={tokenize:BR,partial:!0},Rv={tokenize:HR,partial:!0},IR={tokenize:UR,partial:!0},Tv={name:"wwwAutolink",tokenize:MR,previous:Nv},Ev={name:"protocolAutolink",tokenize:zR,previous:Av},nr={name:"emailAutolink",tokenize:OR,previous:Iv},Mn={};function DR(){return{text:Mn}}let Zr=48;for(;Zr<123;)Mn[Zr]=nr,Zr++,Zr===58?Zr=65:Zr===91&&(Zr=97);Mn[43]=nr;Mn[45]=nr;Mn[46]=nr;Mn[95]=nr;Mn[72]=[nr,Ev];Mn[104]=[nr,Ev];Mn[87]=[nr,Tv];Mn[119]=[nr,Tv];function OR(t,r,i){const l=this;let o,d;return u;function u(y){return!nd(y)||!Iv.call(l,l.previous)||Nd(l.events)?i(y):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),h(y))}function h(y){return nd(y)?(t.consume(y),h):y===64?(t.consume(y),g):i(y)}function g(y){return y===46?t.check(IR,v,p)(y):y===45||y===95||zt(y)?(d=!0,t.consume(y),g):v(y)}function p(y){return t.consume(y),o=!0,g}function v(y){return d&&o&&Ht(l.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),r(y)):i(y)}}function MR(t,r,i){const l=this;return o;function o(u){return u!==87&&u!==119||!Nv.call(l,l.previous)||Nd(l.events)?i(u):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(AR,t.attempt(Cv,t.attempt(jv,d),i),i)(u))}function d(u){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),r(u)}}function zR(t,r,i){const l=this;let o="",d=!1;return u;function u(y){return(y===72||y===104)&&Av.call(l,l.previous)&&!Nd(l.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),o+=String.fromCodePoint(y),t.consume(y),h):i(y)}function h(y){if(Ht(y)&&o.length<5)return o+=String.fromCodePoint(y),t.consume(y),h;if(y===58){const S=o.toLowerCase();if(S==="http"||S==="https")return t.consume(y),g}return i(y)}function g(y){return y===47?(t.consume(y),d?p:(d=!0,g)):i(y)}function p(y){return y===null||zs(y)||rt(y)||ii(y)||Ks(y)?i(y):t.attempt(Cv,t.attempt(jv,v),i)(y)}function v(y){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),r(y)}}function _R(t,r,i){let l=0;return o;function o(u){return(u===87||u===119)&&l<3?(l++,t.consume(u),o):u===46&&l===3?(t.consume(u),d):i(u)}function d(u){return u===null?i(u):r(u)}}function LR(t,r,i){let l,o,d;return u;function u(p){return p===46||p===95?t.check(Rv,g,h)(p):p===null||rt(p)||ii(p)||p!==45&&Ks(p)?g(p):(d=!0,t.consume(p),u)}function h(p){return p===95?l=!0:(o=l,l=void 0),t.consume(p),u}function g(p){return o||l||!d?i(p):r(p)}}function BR(t,r){let i=0,l=0;return o;function o(u){return u===40?(i++,t.consume(u),o):u===41&&l<i?d(u):u===33||u===34||u===38||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===60||u===63||u===93||u===95||u===126?t.check(Rv,r,d)(u):u===null||rt(u)||ii(u)?r(u):(t.consume(u),o)}function d(u){return u===41&&l++,t.consume(u),o}}function HR(t,r,i){return l;function l(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),l):h===38?(t.consume(h),d):h===93?(t.consume(h),o):h===60||h===null||rt(h)||ii(h)?r(h):i(h)}function o(h){return h===null||h===40||h===91||rt(h)||ii(h)?r(h):l(h)}function d(h){return Ht(h)?u(h):i(h)}function u(h){return h===59?(t.consume(h),l):Ht(h)?(t.consume(h),u):i(h)}}function UR(t,r,i){return l;function l(d){return t.consume(d),o}function o(d){return zt(d)?i(d):r(d)}}function Nv(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||rt(t)}function Av(t){return!Ht(t)}function Iv(t){return!(t===47||nd(t))}function nd(t){return t===43||t===45||t===46||t===95||zt(t)}function Nd(t){let r=t.length,i=!1;for(;r--;){const l=t[r][1];if((l.type==="labelLink"||l.type==="labelImage")&&!l._balanced){i=!0;break}if(l._gfmAutolinkLiteralWalkedInto){i=!1;break}}return t.length>0&&!i&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),i}const qR={tokenize:XR,partial:!0};function GR(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:PR,continuation:{tokenize:YR},exit:KR}},text:{91:{name:"gfmFootnoteCall",tokenize:VR},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:$R,resolveTo:FR}}}}function $R(t,r,i){const l=this;let o=l.events.length;const d=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let u;for(;o--;){const g=l.events[o][1];if(g.type==="labelImage"){u=g;break}if(g.type==="gfmFootnoteCall"||g.type==="labelLink"||g.type==="label"||g.type==="image"||g.type==="link")break}return h;function h(g){if(!u||!u._balanced)return i(g);const p=Cn(l.sliceSerialize({start:u.end,end:l.now()}));return p.codePointAt(0)!==94||!d.includes(p.slice(1))?i(g):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(g),t.exit("gfmFootnoteCallLabelMarker"),r(g))}}function FR(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 l={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 d={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},t[t.length-1][1].start)},u={type:"chunkString",contentType:"string",start:Object.assign({},d.start),end:Object.assign({},d.end)},h=[t[i+1],t[i+2],["enter",l,r],t[i+3],t[i+4],["enter",o,r],["exit",o,r],["enter",d,r],["enter",u,r],["exit",u,r],["exit",d,r],t[t.length-2],t[t.length-1],["exit",l,r]];return t.splice(i,t.length-i+1,...h),t}function VR(t,r,i){const l=this,o=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let d=0,u;return h;function h(y){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(y),t.exit("gfmFootnoteCallLabelMarker"),g}function g(y){return y!==94?i(y):(t.enter("gfmFootnoteCallMarker"),t.consume(y),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",p)}function p(y){if(d>999||y===93&&!u||y===null||y===91||rt(y))return i(y);if(y===93){t.exit("chunkString");const S=t.exit("gfmFootnoteCallString");return o.includes(Cn(l.sliceSerialize(S)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(y),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),r):i(y)}return rt(y)||(u=!0),d++,t.consume(y),y===92?v:p}function v(y){return y===91||y===92||y===93?(t.consume(y),d++,p):p(y)}}function PR(t,r,i){const l=this,o=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let d,u=0,h;return g;function g(w){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(w),t.exit("gfmFootnoteDefinitionLabelMarker"),p}function p(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(u>999||w===93&&!h||w===null||w===91||rt(w))return i(w);if(w===93){t.exit("chunkString");const I=t.exit("gfmFootnoteDefinitionLabelString");return d=Cn(l.sliceSerialize(I)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(w),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),S}return rt(w)||(h=!0),u++,t.consume(w),w===92?y:v}function y(w){return w===91||w===92||w===93?(t.consume(w),u++,v):v(w)}function S(w){return w===58?(t.enter("definitionMarker"),t.consume(w),t.exit("definitionMarker"),o.includes(d)||o.push(d),$e(t,x,"gfmFootnoteDefinitionWhitespace")):i(w)}function x(w){return r(w)}}function YR(t,r,i){return t.check(ol,r,t.attempt(qR,r,i))}function KR(t){t.exit("gfmFootnoteDefinition")}function XR(t,r,i){const l=this;return $e(t,o,"gfmFootnoteDefinitionIndent",5);function o(d){const u=l.events[l.events.length-1];return u&&u[1].type==="gfmFootnoteDefinitionIndent"&&u[2].sliceSerialize(u[1],!0).length===4?r(d):i(d)}}function QR(t){let i=(t||{}).singleTilde;const l={name:"strikethrough",tokenize:d,resolveAll:o};return i==null&&(i=!0),{text:{126:l},insideSpan:{null:[l]},attentionMarkers:{null:[126]}};function o(u,h){let g=-1;for(;++g<u.length;)if(u[g][0]==="enter"&&u[g][1].type==="strikethroughSequenceTemporary"&&u[g][1]._close){let p=g;for(;p--;)if(u[p][0]==="exit"&&u[p][1].type==="strikethroughSequenceTemporary"&&u[p][1]._open&&u[g][1].end.offset-u[g][1].start.offset===u[p][1].end.offset-u[p][1].start.offset){u[g][1].type="strikethroughSequence",u[p][1].type="strikethroughSequence";const v={type:"strikethrough",start:Object.assign({},u[p][1].start),end:Object.assign({},u[g][1].end)},y={type:"strikethroughText",start:Object.assign({},u[p][1].end),end:Object.assign({},u[g][1].start)},S=[["enter",v,h],["enter",u[p][1],h],["exit",u[p][1],h],["enter",y,h]],x=h.parser.constructs.insideSpan.null;x&&on(S,S.length,0,Xs(x,u.slice(p+1,g),h)),on(S,S.length,0,[["exit",y,h],["enter",u[g][1],h],["exit",u[g][1],h],["exit",v,h]]),on(u,p-1,g-p+3,S),g=p+S.length-2;break}}for(g=-1;++g<u.length;)u[g][1].type==="strikethroughSequenceTemporary"&&(u[g][1].type="data");return u}function d(u,h,g){const p=this.previous,v=this.events;let y=0;return S;function S(w){return p===126&&v[v.length-1][1].type!=="characterEscape"?g(w):(u.enter("strikethroughSequenceTemporary"),x(w))}function x(w){const I=Ji(p);if(w===126)return y>1?g(w):(u.consume(w),y++,x);if(y<2&&!i)return g(w);const H=u.exit("strikethroughSequenceTemporary"),T=Ji(w);return H._open=!T||T===2&&!!I,H._close=!I||I===2&&!!T,h(w)}}}class ZR{constructor(){this.map=[]}add(r,i,l){JR(this,r,i,l)}consume(r){if(this.map.sort(function(d,u){return d[0]-u[0]}),this.map.length===0)return;let i=this.map.length;const l=[];for(;i>0;)i-=1,l.push(r.slice(this.map[i][0]+this.map[i][1]),this.map[i][2]),r.length=this.map[i][0];l.push(r.slice()),r.length=0;let o=l.pop();for(;o;){for(const d of o)r.push(d);o=l.pop()}this.map.length=0}}function JR(t,r,i,l){let o=0;if(!(i===0&&l.length===0)){for(;o<t.map.length;){if(t.map[o][0]===r){t.map[o][1]+=i,t.map[o][2].push(...l);return}o+=1}t.map.push([r,i,l])}}function WR(t,r){let i=!1;const l=[];for(;r<t.length;){const o=t[r];if(i){if(o[0]==="enter")o[1].type==="tableContent"&&l.push(t[r+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(t[r-1][1].type==="tableDelimiterMarker"){const d=l.length-1;l[d]=l[d]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(i=!0);r+=1}return l}function eT(){return{flow:{null:{name:"table",tokenize:tT,resolveAll:nT}}}}function tT(t,r,i){const l=this;let o=0,d=0,u;return h;function h(z){let V=l.events.length-1;for(;V>-1;){const X=l.events[V][1].type;if(X==="lineEnding"||X==="linePrefix")V--;else break}const F=V>-1?l.events[V][1].type:null,le=F==="tableHead"||F==="tableRow"?E:g;return le===E&&l.parser.lazy[l.now().line]?i(z):le(z)}function g(z){return t.enter("tableHead"),t.enter("tableRow"),p(z)}function p(z){return z===124||(u=!0,d+=1),v(z)}function v(z){return z===null?i(z):ke(z)?d>1?(d=0,l.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(z),t.exit("lineEnding"),x):i(z):He(z)?$e(t,v,"whitespace")(z):(d+=1,u&&(u=!1,o+=1),z===124?(t.enter("tableCellDivider"),t.consume(z),t.exit("tableCellDivider"),u=!0,v):(t.enter("data"),y(z)))}function y(z){return z===null||z===124||rt(z)?(t.exit("data"),v(z)):(t.consume(z),z===92?S:y)}function S(z){return z===92||z===124?(t.consume(z),y):y(z)}function x(z){return l.interrupt=!1,l.parser.lazy[l.now().line]?i(z):(t.enter("tableDelimiterRow"),u=!1,He(z)?$e(t,w,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):w(z))}function w(z){return z===45||z===58?H(z):z===124?(u=!0,t.enter("tableCellDivider"),t.consume(z),t.exit("tableCellDivider"),I):K(z)}function I(z){return He(z)?$e(t,H,"whitespace")(z):H(z)}function H(z){return z===58?(d+=1,u=!0,t.enter("tableDelimiterMarker"),t.consume(z),t.exit("tableDelimiterMarker"),T):z===45?(d+=1,T(z)):z===null||ke(z)?G(z):K(z)}function T(z){return z===45?(t.enter("tableDelimiterFiller"),N(z)):K(z)}function N(z){return z===45?(t.consume(z),N):z===58?(u=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(z),t.exit("tableDelimiterMarker"),A):(t.exit("tableDelimiterFiller"),A(z))}function A(z){return He(z)?$e(t,G,"whitespace")(z):G(z)}function G(z){return z===124?w(z):z===null||ke(z)?!u||o!==d?K(z):(t.exit("tableDelimiterRow"),t.exit("tableHead"),r(z)):K(z)}function K(z){return i(z)}function E(z){return t.enter("tableRow"),$(z)}function $(z){return z===124?(t.enter("tableCellDivider"),t.consume(z),t.exit("tableCellDivider"),$):z===null||ke(z)?(t.exit("tableRow"),r(z)):He(z)?$e(t,$,"whitespace")(z):(t.enter("data"),te(z))}function te(z){return z===null||z===124||rt(z)?(t.exit("data"),$(z)):(t.consume(z),z===92?se:te)}function se(z){return z===92||z===124?(t.consume(z),te):te(z)}}function nT(t,r){let i=-1,l=!0,o=0,d=[0,0,0,0],u=[0,0,0,0],h=!1,g=0,p,v,y;const S=new ZR;for(;++i<t.length;){const x=t[i],w=x[1];x[0]==="enter"?w.type==="tableHead"?(h=!1,g!==0&&(Ug(S,r,g,p,v),v=void 0,g=0),p={type:"table",start:Object.assign({},w.start),end:Object.assign({},w.end)},S.add(i,0,[["enter",p,r]])):w.type==="tableRow"||w.type==="tableDelimiterRow"?(l=!0,y=void 0,d=[0,0,0,0],u=[0,i+1,0,0],h&&(h=!1,v={type:"tableBody",start:Object.assign({},w.start),end:Object.assign({},w.end)},S.add(i,0,[["enter",v,r]])),o=w.type==="tableDelimiterRow"?2:v?3:1):o&&(w.type==="data"||w.type==="tableDelimiterMarker"||w.type==="tableDelimiterFiller")?(l=!1,u[2]===0&&(d[1]!==0&&(u[0]=u[1],y=Ts(S,r,d,o,void 0,y),d=[0,0,0,0]),u[2]=i)):w.type==="tableCellDivider"&&(l?l=!1:(d[1]!==0&&(u[0]=u[1],y=Ts(S,r,d,o,void 0,y)),d=u,u=[d[1],i,0,0])):w.type==="tableHead"?(h=!0,g=i):w.type==="tableRow"||w.type==="tableDelimiterRow"?(g=i,d[1]!==0?(u[0]=u[1],y=Ts(S,r,d,o,i,y)):u[1]!==0&&(y=Ts(S,r,u,o,i,y)),o=0):o&&(w.type==="data"||w.type==="tableDelimiterMarker"||w.type==="tableDelimiterFiller")&&(u[3]=i)}for(g!==0&&Ug(S,r,g,p,v),S.consume(r.events),i=-1;++i<r.events.length;){const x=r.events[i];x[0]==="enter"&&x[1].type==="table"&&(x[1]._align=WR(r.events,i))}return t}function Ts(t,r,i,l,o,d){const u=l===1?"tableHeader":l===2?"tableDelimiter":"tableData",h="tableContent";i[0]!==0&&(d.end=Object.assign({},Yi(r.events,i[0])),t.add(i[0],0,[["exit",d,r]]));const g=Yi(r.events,i[1]);if(d={type:u,start:Object.assign({},g),end:Object.assign({},g)},t.add(i[1],0,[["enter",d,r]]),i[2]!==0){const p=Yi(r.events,i[2]),v=Yi(r.events,i[3]),y={type:h,start:Object.assign({},p),end:Object.assign({},v)};if(t.add(i[2],0,[["enter",y,r]]),l!==2){const S=r.events[i[2]],x=r.events[i[3]];if(S[1].end=Object.assign({},x[1].end),S[1].type="chunkText",S[1].contentType="text",i[3]>i[2]+1){const w=i[2]+1,I=i[3]-i[2]-1;t.add(w,I,[])}}t.add(i[3]+1,0,[["exit",y,r]])}return o!==void 0&&(d.end=Object.assign({},Yi(r.events,o)),t.add(o,0,[["exit",d,r]]),d=void 0),d}function Ug(t,r,i,l,o){const d=[],u=Yi(r.events,i);o&&(o.end=Object.assign({},u),d.push(["exit",o,r])),l.end=Object.assign({},u),d.push(["exit",l,r]),t.add(i+1,0,d)}function Yi(t,r){const i=t[r],l=i[0]==="enter"?"start":"end";return i[1][l]}const rT={name:"tasklistCheck",tokenize:aT};function iT(){return{text:{91:rT}}}function aT(t,r,i){const l=this;return o;function o(g){return l.previous!==null||!l._gfmTasklistFirstContentOfListItem?i(g):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(g),t.exit("taskListCheckMarker"),d)}function d(g){return rt(g)?(t.enter("taskListCheckValueUnchecked"),t.consume(g),t.exit("taskListCheckValueUnchecked"),u):g===88||g===120?(t.enter("taskListCheckValueChecked"),t.consume(g),t.exit("taskListCheckValueChecked"),u):i(g)}function u(g){return g===93?(t.enter("taskListCheckMarker"),t.consume(g),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),h):i(g)}function h(g){return ke(g)?r(g):He(g)?t.check({tokenize:lT},r,i)(g):i(g)}}function lT(t,r,i){return $e(t,l,"whitespace");function l(o){return o===null?i(o):r(o)}}function sT(t){return qy([DR(),GR(),QR(t),eT(),iT()])}const oT={};function uT(t){const r=this,i=t||oT,l=r.data(),o=l.micromarkExtensions||(l.micromarkExtensions=[]),d=l.fromMarkdownExtensions||(l.fromMarkdownExtensions=[]),u=l.toMarkdownExtensions||(l.toMarkdownExtensions=[]);o.push(sT(i)),d.push(ER()),u.push(NR(i))}const Dv=/^(javascript|vbscript|data):/i;function cT(t){if(!t)return!1;const r=t.trim();return!(!r||Dv.test(r))}function dT(t){if(!t)return!1;const r=t.trim();return!r||Dv.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 fT=[[uT,{singleTilde:!1}]];function qg({lang:t,text:r}){const[i,l]=k.useState(!1),o=()=>{navigator.clipboard?.writeText(r).then(()=>{l(!0),window.setTimeout(()=>l(!1),1600)},()=>{})};return c.jsxs("div",{className:"oc-codeblock",children:[c.jsxs("div",{className:"oc-codeblock-head",children:[c.jsx("span",{className:"oc-codeblock-lang",children:t||"text"}),c.jsx("button",{type:"button",className:"oc-codeblock-copy",onClick:o,children:i?"已复制":"复制"})]}),c.jsx("pre",{children:c.jsx("code",{children:r})})]})}const hT={pre({children:t}){return c.jsx(c.Fragment,{children:t})},code({className:t,children:r,...i}){const l=String(r??"").replace(/\n$/,""),o=/language-([\w-]+)/.exec(t??"");return o||t&&l.includes(`
|
|
41
|
-
`)?c.jsx(qg,{lang:o?.[1]??"",text:l}):l.includes(`
|
|
42
|
-
`)?c.jsx(qg,{lang:"",text:l}):c.jsx("code",{className:t,...i,children:r})},a({href:t,children:r,...i}){if(!cT(t))return c.jsx("span",{...i,children:r});const l=/^https?:\/\//i.test(t??"");return c.jsx("a",{href:t,...l?{target:"_blank",rel:"noopener noreferrer"}:{},...i,children:r})},img({src:t,alt:r}){return dT(t)?c.jsxs(c.Fragment,{children:[c.jsx("img",{src:t,alt:r??"",loading:"lazy",onError:i=>{const l=i.currentTarget;l.hidden=!0,l.nextElementSibling?.removeAttribute("hidden")}}),c.jsx("span",{className:"oc-md-img-fallback",hidden:!0,title:t??void 0,children:r?`[图片加载失败: ${r}]`:"[图片加载失败]"})]}):c.jsx("span",{className:"oc-md-img-fallback",title:t??void 0,children:r?`[图片: ${r}]`:"[图片已屏蔽]"})},table({children:t}){return c.jsx("div",{className:"oc-md-table-wrap",children:c.jsx("table",{children:t})})},input(t){return t.type==="checkbox"?c.jsx("input",{type:"checkbox",checked:!!t.checked,disabled:!0,readOnly:!0}):c.jsx("input",{...t,disabled:!0,readOnly:!0})}};function mT({text:t}){try{return c.jsx("div",{className:"oc-md",children:c.jsx(QC,{remarkPlugins:fT,components:hT,children:t})})}catch{return c.jsx("div",{className:"oc-md",children:c.jsx("pre",{className:"oc-md-fallback",children:t})})}}function pT(){return c.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:[c.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),c.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})}function gT(){return c.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:c.jsx("polyline",{points:"20 6 9 17 4 12"})})}function yT(){return c.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:[c.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),c.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})}function vT(){return c.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:c.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})}function Ad(){return c.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:c.jsx("polyline",{points:"4 2.5 7.5 6 4 9.5"})})}function bT(){return c.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:c.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 rd(t){const[r,i]=k.useState(!1),l=()=>{navigator.clipboard?.writeText(t.text).then(()=>{i(!0),window.setTimeout(()=>i(!1),1600)},()=>{})};return c.jsx("button",{type:"button",className:`oc-message-copy${r?" is-copied":""}`,"aria-label":r?"已复制":"复制消息",title:r?"已复制":"复制",onClick:l,children:r?c.jsx(gT,{}):c.jsx(pT,{})})}function Gg(t){const{message:r,streaming:i,activeAssistantId:l}=t,o=r.role==="user",d=o?"你":"π",u=o?"你":"助手",h=!o&&i&&l!==null&&r.id===l,g=h&&r.text.length===0,p=r.text.trim().length>0;return c.jsxs("div",{className:`oc-row ${o?"is-user":"is-assistant"}`,children:[c.jsxs("div",{className:"oc-meta",children:[c.jsx("span",{className:`oc-avatar ${o?"oc-avatar-user":"oc-avatar-assistant"}`,"aria-hidden":"true",children:d}),c.jsx("span",{className:"oc-role",children:u}),c.jsx("span",{className:"oc-time",children:uy(r.createdAt)}),p&&c.jsx(rd,{text:r.text})]}),c.jsxs("div",{className:`oc-bubble ${o?"oc-bubble-user":"oc-bubble-assistant"}`,children:[p?o?c.jsx("div",{style:{whiteSpace:"pre-wrap"},children:r.text}):c.jsx(mT,{text:r.text}):g?c.jsx("span",{className:"oc-cursor","aria-hidden":"true"}):null,h&&p&&c.jsx("span",{className:"oc-cursor","aria-hidden":"true"})]})]})}function xT(t){if(!(!t||typeof t!="object"))return t}function Er(t){return typeof t=="string"?t:void 0}function Ws(t){if(!Array.isArray(t))return;const r=[];for(const i of t){const l=xT(i);if(!l)continue;const o=Er(l.type)??"";if(o==="thinking"||o==="reasoning"){const d=Er(l.thinking)??Er(l.text)??"";r.push({type:"thinking",thinking:d});continue}if(o==="toolCall"||o==="tool_call"||o==="toolUse"||o==="tool_use"){const d=Er(l.toolCallId)??Er(l.id)??"";if(!d)continue;const u=Er(l.toolName)??Er(l.name);r.push({type:"toolCall",toolCallId:d,...u?{toolName:u}:{}});continue}if(o==="text"||o==="output_text"||o===""){const d=Er(l.text);d!==void 0&&r.push({type:"text",text:d})}}return r}function ST(t,r={}){return t.type==="thinking"&&!r.isStreaming&&t.thinking.trim()===""}function Ov(t,r={}){return t.filter(i=>!ST(i,r))}function kT(t){return t.type==="text"}function wT(t,r={}){const i=Ov(t,r);let l=-1;for(let o=i.length-1;o>=0;o--)if(!kT(i[o])){l=o;break}return l===-1?{answerBlocks:i,processBlocks:[]}:{answerBlocks:i.slice(l+1),processBlocks:i.slice(0,l+1)}}function CT(t){return t.filter(r=>r.type==="text").map(r=>r.text).join("")}function $g(t){return{key:t,assistants:[],tools:[],processItems:[],live:!1}}function jT(t){const r=[],i=[];let l,o=[];const d=u=>{for(const h of o)h.assistantMessageId||(h.assistantMessageId=u),h.turnId||(h.turnId=l);o=[]};for(const u of t){const h=Date.parse(u.at)||Date.now();if(u.role==="user"){l=`restored-${u.id}`,o=[],r.push({id:u.id,role:"user",text:u.text,createdAt:h});continue}if(u.role==="assistant"){l||(l=`restored-${u.id}`);const g=Ws(u.content);r.push({id:u.id,role:"assistant",text:u.text,createdAt:h,...g&&g.length>0?{content:g}:{}}),d(u.id);continue}if(u.role==="tool"){l||(l=`restored-tool-${u.id}`);const g={id:u.toolCallId||u.id,toolName:u.toolName||"tool",status:u.isError===!0?"error":"ok",resultText:u.text,result:u.text,createdAt:h,finishedAt:h,turnId:l};i.push(g),o.push(g)}}return{messages:r,toolCalls:i}}function Fg(t,r,i,l){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 d=r.tools.find(u=>u.id===o.toolCallId);d&&(i.push({kind:"tool",tool:d}),l.add(d.id))}}function RT(t){const r=new Set,i=[],l=t.assistants.slice(0,-1),o=t.assistants[t.assistants.length-1];for(const g of l)Fg(Ov(g.content??[]),t,i,r);const d=o?.content??[],u=wT(d,{isStreaming:t.live});Fg(u.processBlocks,t,i,r);for(const g of t.tools)r.has(g.id)||i.push({kind:"tool",tool:g});if(t.processItems=i,!o)return;if(d.length===0){t.answer=o;return}const h=CT(u.answerBlocks);t.answer={...o,text:h,content:u.answerBlocks}}function TT(t){const r=t.messages.filter(h=>h.role==="user"||h.role==="assistant"),i=[];let l=null;const o=h=>{const g=$g(h);return i.push(g),g};for(const h of r){if(h.role==="user"){l=o(`user-${h.id}`),l.user=h;continue}l||(l=o(`assistant-${h.id}`)),l.assistants.push(h)}i.length===0&&t.toolCalls.length>0&&i.push($g("orphan-tools"));const d=new Set,u=new Map;for(const h of i)for(const g of h.assistants)u.set(g.id,h);for(const h of t.toolCalls)if(h.assistantMessageId){const g=u.get(h.assistantMessageId);if(g){g.tools.push(h),d.add(h.id);continue}}for(const h of t.toolCalls)if(!d.has(h.id)&&h.turnId){const g=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(g){g.tools.push(h),d.add(h.id);continue}const p=i.find(v=>h.turnId===`restored-${v.user?.id}`||v.assistants.some(y=>h.turnId===`restored-${y.id}`));if(p){p.tools.push(h),d.add(h.id);continue}}for(const h of t.toolCalls){if(d.has(h.id))continue;const g=i.find((p,v)=>{const y=p.user?.createdAt??p.assistants[0]?.createdAt??0,x=i[v+1]?.user?.createdAt??Number.POSITIVE_INFINITY;return h.createdAt>=y&&h.createdAt<x});g?(g.tools.push(h),d.add(h.id)):i.length>0&&(i[i.length-1].tools.push(h),d.add(h.id))}for(const h of i)h.tools.sort((g,p)=>g.createdAt-p.createdAt),h.live=t.streaming&&t.activeAssistantId!==null&&h.assistants.some(g=>g.id===t.activeAssistantId),RT(h);return i}function ET(t,r){const i=t.length,l=r?.thinkingCount??0,o=r?.textCount??0,d=l+o+i,u=t.filter(p=>p.status==="error").length,h=t.filter(p=>p.status==="running").length,g=[`处理详情 · ${d} 步`];return i>0&&g.push(`${i} 工具`),u>0?g.push(`${u} 出错`):h>0&&g.push("运行中"),{count:i,errorCount:u,runningCount:h,stepCount:d,label:g.join(" · ")}}function Mv(t){const{entry:r}=t,[i,l]=k.useState(r.status==="error"),[o,d]=k.useState(!1),u=r.status==="running"?"运行中":r.status==="error"?"出错":"完成",h=`is-${r.status}`,g=q1(r.args,{toolName:r.toolName}),p=V1(r.createdAt,r.finishedAt),v=G1(r.toolName),y=oy(r.resultText??r.result),S=F1(y,o?{maxLen:Number.MAX_SAFE_INTEGER}:void 0);return c.jsxs("div",{className:`oc-tool ${r.status==="error"?"is-error":""} ${r.status==="running"?"is-running":""}`,children:[c.jsxs("button",{type:"button",className:"oc-tool-head","aria-expanded":i,onClick:()=>l(x=>!x),children:[c.jsx(Ad,{}),c.jsx("span",{className:"oc-tool-icon","aria-hidden":"true",children:c.jsx(bT,{})}),c.jsx("span",{className:"oc-tool-name",children:r.toolName}),g&&c.jsx("span",{className:"oc-tool-args",children:g}),p!==void 0&&c.jsxs("span",{className:"oc-tool-duration",children:[p,"s"]}),c.jsx("span",{className:`oc-tool-status ${h}`,children:u})]}),i&&c.jsxs("div",{className:"oc-tool-body",children:[r.args!==void 0&&c.jsxs("div",{className:"oc-tool-section",children:[c.jsx("div",{className:"oc-tool-label",children:v.argsLabel}),c.jsx("pre",{className:"oc-tool-code",children:$1(r.args)})]}),(r.resultText!==void 0||r.result!==void 0)&&c.jsxs("div",{className:"oc-tool-section",children:[c.jsx("div",{className:"oc-tool-label",children:r.status==="error"?"错误":v.resultLabel}),c.jsx("pre",{className:"oc-tool-code",children:S.text}),S.truncated&&!o&&c.jsx("button",{type:"button",className:"btn btn-ghost oc-tool-expand-result",onClick:()=>d(!0),children:"展开全部"})]}),r.status==="running"&&r.resultText===void 0&&r.result===void 0&&r.args===void 0&&c.jsx("div",{className:"oc-tool-section",children:c.jsx("div",{className:"oc-tool-waiting",children:"等待结果…"})})]})]})}function NT(t){const{thinking:r,defaultOpen:i}=t,[l,o]=k.useState(i);return k.useEffect(()=>{o(i)},[i]),c.jsxs("div",{className:"oc-thinking",children:[c.jsxs("button",{type:"button",className:`oc-thinking-summary${l?" is-open":""}`,"aria-expanded":l,onClick:()=>o(d=>!d),children:[c.jsx(Ad,{}),c.jsx("span",{children:"思考"})]}),l?c.jsx("pre",{className:"oc-thinking-body",children:r||"…"}):null]})}function AT(t){const{items:r,defaultOpen:i}=t,[l,o]=k.useState(i),d=r.filter(h=>h.kind==="tool").map(h=>h.tool),u=ET(d,{thinkingCount:r.filter(h=>h.kind==="thinking").length,textCount:r.filter(h=>h.kind==="text").length});return k.useEffect(()=>{o(i)},[i]),c.jsxs("div",{className:"oc-process-inline",children:[c.jsxs("button",{type:"button",className:`oc-process-inline-summary${l?" is-open":""}${u.errorCount>0?" is-error":u.runningCount>0?" is-running":""}`,"aria-expanded":l,onClick:()=>o(h=>!h),children:[c.jsx(Ad,{}),c.jsx("span",{children:u.label})]}),l?c.jsx("div",{className:"oc-process-inline-body",children:r.map((h,g)=>h.kind==="thinking"?c.jsx(NT,{thinking:h.thinking,defaultOpen:i},`thinking-${g}`):h.kind==="text"?c.jsx("div",{className:"oc-process-text",children:h.text},`text-${g}`):c.jsx(Mv,{entry:h.tool},h.tool.id))}):null]})}function IT(t){const{scrollContainerRef:r,messagesEndRef:i,onScroll:l,hasThread:o,readiness:d,streaming:u,streamingAssistantId:h,messagesCount:g,visibleCount:p,onLoadMore:v,turnGroups:y,interview:S,humanGateCards:x,operationCards:w,artifactCards:I,origin:H,sessionId:T}=t;return c.jsxs("div",{ref:r,className:`oc-messages${o?" has-thread":" is-empty"}`,onScroll:l,children:[o?null:c.jsx(Sy,{mode:"empty-session",readiness:d,disabled:u,onSuggest:t.onSuggest}),o&&g>p&&c.jsx("button",{type:"button",className:"btn btn-ghost oc-load-history",onClick:v,children:"加载更早消息"}),o&&y.map((N,A)=>{const G=N.user??N.assistants[0],K=A>0?y[A-1].user??y[A-1].assistants[0]:void 0,E=!!G&&(!K||wc(K.createdAt)!==wc(G.createdAt)),$=N.answer,te=!!$?.text.trim(),se=N.live&&N.processItems.length===0;return c.jsxs("div",{className:"oc-turn-group",children:[E&&G&&c.jsx("div",{className:"oc-day-sep",children:wc(G.createdAt)}),N.user&&c.jsx(Gg,{message:N.user,streaming:u,activeAssistantId:h}),N.processItems.length>0&&c.jsx(AT,{items:N.processItems,defaultOpen:N.live}),$&&(te||se)?c.jsx(Gg,{message:$,streaming:u,activeAssistantId:h}):null]},N.key)}),S&&c.jsx(HS,{interview:S,interviewAnswer:t.interviewAnswer,onAnswerChange:t.onInterviewAnswerChange,onAnswer:t.onAnswerInterview,onConfirmTaskKind:t.onConfirmTaskKind}),x.map(N=>c.jsx(DS,{card:N,origin:H,sessionId:T},N.cardId)),w.map(N=>c.jsx(BS,{operation:N,origin:H,onNavigateWorkspace:t.onNavigateWorkspace},N.operationId)),I.map(N=>c.jsx(IS,{artifact:N},N.artifactId)),c.jsx("div",{ref:i})]})}function On(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:t.toLocaleString()}function DT(t){const r=[],i=t.inputTokens??0,l=t.outputTokens??0,o=t.cacheReadTokens??0,d=t.cacheWriteTokens??0,u=t.cost??0;if(i>0&&r.push(`${On(i)} in`),l>0&&r.push(`${On(l)} out`),o>0&&r.push(`${On(o)} cache R`),d>0&&r.push(`${On(d)} cache W`),u>0&&r.push(u>=.01?`$${u.toFixed(2)}`:"<$0.01"),r.length===0){const h=t.totalTokens??0;return h>0?`${On(h)} tokens`:"—"}return r.join(" · ")}const OT={auto:"auto(跟随 Pi 默认等级)",off:"off · 关闭",minimal:"minimal · 极简",low:"low · 低",medium:"medium · 中",high:"high · 高",xhigh:"xhigh · 极高",max:"max · 最高"};function MT(t,r){const i=r.trim().toLowerCase(),l=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 d=l.get(o.provider)??[];d.push(o),l.set(o.provider,d)}return[...l.entries()].map(([o,d])=>({provider:o,models:d}))}function zT(t,r){const i=new Set,l=[],o=d=>{i.has(d)||(i.add(d),l.push({value:d,label:OT[d]??d,...d==="auto"&&r?{effective:r}:{}}))};o("auto");for(const d of t)o(d);return l}function Hs(t,r){return`${t}/${r}`}function id(t){return{...t.modelProvider&&t.modelId?{model:{provider:t.modelProvider,modelId:t.modelId}}:{},...t.thinkingLevel?{thinkingLevel:t.thinkingLevel}:{}}}function zv(t,r){return{...t,model:r.model??t.model,thinkingLevel:r.thinkingLevel??t.thinkingLevel}}function _T(t,r){const i=zv(t,r);return i.model?.provider===t.model?.provider&&i.model?.modelId===t.model?.modelId&&i.thinkingLevel===t.thinkingLevel}function LT(){return c.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:c.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 BT(t){const r=Wi(),[i,l]=k.useState(!1),[o,d]=k.useState(""),[u,h]=k.useState(0),g=k.useRef(null),p=k.useRef(null),v=r.snapshot,y=r.status==="loading",S=r.status==="error"?r.error:null,x=v?(v.models??[]).map(N=>({provider:N.provider,id:N.id,...N.name?{name:N.name}:{},...N.hasCredentials!==void 0?{hasCredentials:N.hasCredentials}:{}})):t.models,w=k.useMemo(()=>MT(x,o),[x,o]),I=k.useMemo(()=>w.flatMap(N=>N.models),[w]);k.useEffect(()=>{i&&(d(""),h(0),window.setTimeout(()=>p.current?.focus(),0))},[i]),k.useEffect(()=>{if(!i)return;const N=G=>{const K=g.current;K&&G.target instanceof Node&&!K.contains(G.target)&&l(!1)},A=G=>{G.key==="Escape"&&l(!1)};return document.addEventListener("mousedown",N),document.addEventListener("keydown",A),()=>{document.removeEventListener("mousedown",N),document.removeEventListener("keydown",A)}},[i]);const H=N=>{if(t.disabled)return;const A=I[N];A&&(l(!1),t.onSelect(A.provider,A.id))},T=N=>{if(N.key==="ArrowDown"){N.preventDefault(),h(A=>I.length?(A+1)%I.length:0);return}if(N.key==="ArrowUp"){N.preventDefault(),h(A=>I.length?(A-1+I.length)%I.length:0);return}if(N.key==="Enter"){N.preventDefault(),H(u);return}if(N.key==="Escape"){N.preventDefault(),l(!1);return}};return c.jsxs("div",{className:"oc-select-menu oc-model-menu",ref:g,children:[c.jsxs("button",{type:"button",className:"oc-select-trigger","aria-haspopup":"listbox","aria-expanded":i,title:"选择模型",disabled:t.disabled,onClick:()=>l(N=>!N),children:[c.jsx("span",{className:"oc-select-trigger-label",children:t.triggerLabel}),c.jsx(LT,{})]}),i&&c.jsxs("div",{className:"oc-select-panel oc-model-panel",role:"listbox","aria-label":"选择模型",children:[c.jsx("input",{ref:p,className:"oc-select-search",placeholder:"搜索模型或 Provider…",value:o,onChange:N=>{d(N.target.value),h(0)},onKeyDown:T}),y&&c.jsx("div",{className:"oc-select-status",children:"模型列表加载中…"}),S&&c.jsxs("div",{className:"oc-select-status is-error",children:[c.jsxs("span",{children:[S.code?`${S.code}:`:"",S.message]}),c.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>{Zi()},children:"重试"})]}),!y&&!S&&w.length===0&&c.jsx("div",{className:"oc-select-status",children:"当前没有可用模型(真实空态,未伪造列表)"}),w.map(N=>c.jsxs("div",{className:"oc-model-group",children:[c.jsx("div",{className:"oc-model-group-head",children:N.provider}),N.models.map(A=>{const G=Hs(A.provider,A.id),K=G===t.activeModelRef,E=I[u]===A;return c.jsxs("button",{type:"button",role:"option","aria-selected":K,disabled:t.disabled,className:`oc-select-option oc-model-option${E?" is-highlighted":""}${K?" is-active":""}`,onMouseDown:$=>$.preventDefault(),onClick:()=>{t.disabled||(l(!1),t.onSelect(A.provider,A.id))},children:[c.jsxs("span",{className:"oc-model-option-name",children:[A.name?`${A.name} · `:"",A.id]}),K&&c.jsx("span",{className:"oc-model-option-check",children:"✓"})]},G)})]},N.provider))]})]})}function HT(){return c.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:c.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 UT(t){const r=Wi(),[i,l]=k.useState(!1),[o,d]=k.useState(0),u=k.useRef(null),h=t.effectiveLevel??r.snapshot?.selection?.effectiveThinkingLevel,g=r.snapshot?.thinkingLevels?.length?r.snapshot.thinkingLevels.map(S=>S.value):void 0,p=k.useMemo(()=>zT(g??t.levels,h),[g,t.levels,h]);k.useEffect(()=>{i&&d(0)},[i]),k.useEffect(()=>{if(!i)return;const S=w=>{const I=u.current;I&&w.target instanceof Node&&!I.contains(w.target)&&l(!1)},x=w=>{w.key==="Escape"&&l(!1)};return document.addEventListener("mousedown",S),document.addEventListener("keydown",x),()=>{document.removeEventListener("mousedown",S),document.removeEventListener("keydown",x)}},[i]);const v=S=>{if(t.disabled)return;const x=p[S];x&&(l(!1),t.onSelect(x.value))},y=S=>{if(S.key==="ArrowDown"){S.preventDefault(),d(x=>p.length?(x+1)%p.length:0);return}if(S.key==="ArrowUp"){S.preventDefault(),d(x=>p.length?(x-1+p.length)%p.length:0);return}if(S.key==="Enter"){S.preventDefault(),v(o);return}if(S.key==="Escape"){S.preventDefault(),l(!1);return}};return c.jsxs("div",{className:"oc-select-menu oc-thinking-menu",ref:u,children:[c.jsxs("button",{type:"button",className:"oc-select-trigger","aria-haspopup":"listbox","aria-expanded":i,title:"思考等级",disabled:t.disabled,onClick:()=>l(S=>!S),children:[c.jsx("span",{className:"oc-select-trigger-label",children:t.triggerLabel}),c.jsx(HT,{})]}),i&&c.jsx("div",{className:"oc-select-panel oc-thinking-panel",role:"listbox","aria-label":"思考等级",onKeyDown:y,children:p.map((S,x)=>{const w=S.value===t.activeValue,I=x===o;return c.jsxs("button",{type:"button",role:"option","aria-selected":w,disabled:t.disabled,className:`oc-select-option oc-thinking-option${I?" is-highlighted":""}${w?" is-active":""}`,onMouseDown:H=>H.preventDefault(),onClick:()=>{t.disabled||(l(!1),t.onSelect(S.value))},children:[c.jsx("span",{className:"oc-thinking-option-label",children:S.label}),S.value==="auto"&&S.effective?c.jsxs("span",{className:"oc-thinking-badge",children:["Pi 实际:",S.effective]}):null,w&&c.jsx("span",{className:"oc-model-option-check",children:"✓"})]},S.value)})})]})}function qT(){return c.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:[c.jsx("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"}),c.jsx("circle",{cx:"8.5",cy:"10",r:"1.5"}),c.jsx("path",{d:"m21 16-5.5-5.5L9 17"})]})}function GT(t){const{composer:r,streaming:i,hasThread:l}=t,o=Wi(),d=o.reloading,u=o.reloadError,g=o.mutationBusy||d||i,p=k.useCallback(()=>{r.setInput(""),r.setShortcutOpen(!1),Qi()},[r.setInput,r.setShortcutOpen]),v=k.useCallback(T=>{const N=r.isComposingNow()||T.nativeEvent.isComposing,A=r.recentlyComposedNow();if(T.key==="Enter"&&!T.shiftKey&&!N&&!A){if(r.shortcutOpen&&r.filteredShortcuts.length>0){if((r.filteredShortcuts[r.shortcutIndex]??r.filteredShortcuts[0])?.command==="/reload"){T.preventDefault(),p();return}}else if(r.input.trim()==="/reload"){T.preventDefault(),p();return}}t.onKeyDown(T)},[r.isComposingNow,r.recentlyComposedNow,r.shortcutOpen,r.filteredShortcuts,r.shortcutIndex,r.input,p,t.onKeyDown]),y=k.useCallback((T,N)=>{if(N==="pi-prompt"||T==="/name"||T==="/compact"){r.setInput(`${T} `),r.setShortcutOpen(!1),r.textareaRef.current?.focus();return}if(T==="/reload"){p();return}t.onRunShortcut(T)},[p,t.onRunShortcut,r]),S=k.useCallback(()=>{if(r.input.trim()==="/reload"){p();return}t.onSend(r.input)},[r.input,p,t.onSend]),x=(()=>{const T=t.processSummary;return T?T.statusKind==="error"?`查看工具调用记录,共 ${T.count} 次,其中 ${T.statusLabel}`:T.statusKind==="running"?`查看工具调用记录,共 ${T.count} 次,${T.statusLabel||"正在运行"}`:`查看工具调用记录,共 ${T.count} 次,全部已完成`:"查看工具调用记录"})(),w=(()=>{const T=t.usage.inputTokens,N=t.usage.outputTokens,A=t.usage.cacheReadTokens,G=t.usage.cacheWriteTokens,K=t.usage.cost??0,E=[];if(T>0&&E.push(c.jsxs("span",{className:"oc-usage-part is-in",title:"输入 tokens",children:["↑ ",On(T)]},"in")),N>0&&E.push(c.jsxs("span",{className:"oc-usage-part is-out",title:"输出 tokens",children:["↓ ",On(N)]},"out")),A>0&&E.push(c.jsxs("span",{className:"oc-usage-part",children:[On(A)," cache R"]},"cache-read")),G>0&&E.push(c.jsxs("span",{className:"oc-usage-part",children:[On(G)," cache W"]},"cache-write")),K>0&&E.push(c.jsx("span",{className:"oc-usage-part",children:K>=.01?`$${K.toFixed(2)}`:"<$0.01"},"cost")),E.length===0){const $=t.usage.totalTokens;$>0&&E.push(c.jsxs("span",{className:"oc-usage-part",children:[On($)," tokens"]},"total"))}return E})(),I=c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"oc-runtime-controls-group",children:[c.jsx(BT,{models:t.models,activeModelRef:t.activeModelRef,triggerLabel:t.activeModelRef||"选择模型",disabled:g,onSelect:(T,N)=>t.onSwitchRuntime({provider:T,modelId:N})}),c.jsx(UT,{levels:t.thinkingLevels,activeValue:t.activeThinkingLevel||"auto",triggerLabel:t.activeThinkingLevel||"auto",disabled:g,onSelect:T=>t.onSwitchRuntime({thinkingLevel:T})}),c.jsxs("span",{className:"oc-usage",title:DT(t.usage),children:[c.jsx("span",{className:"oc-usage-state",children:i?"运行中":"空闲"}),t.unread>0?c.jsxs("span",{className:"oc-usage-unread",children:[t.unread," 未读"]}):null,w]}),t.processSummary&&c.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":x,title:x,onClick:t.onToggleProcess,children:[c.jsx("span",{className:"oc-process-summary-label",children:"调用记录"}),c.jsx("span",{className:"oc-process-summary-badge",children:t.processSummary.count}),t.processSummary.statusKind!=="ok"&&t.processSummary.statusLabel?c.jsx("span",{className:"oc-process-summary-status",children:t.processSummary.statusLabel}):null]})]}),c.jsxs("div",{className:"oc-runtime-controls-group is-right",children:[c.jsx("button",{type:"button",className:"btn btn-ghost",onClick:t.onCompact,disabled:i||!l,title:l?i?"生成中,暂不可压缩":"压缩上下文,释放 token":"先进行对话后再压缩上下文","aria-label":l?i?"生成中,暂不可压缩":"压缩上下文,释放 token":"先进行对话后再压缩上下文",children:"压缩"}),t.runtimeContext?c.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]})]}),H=(()=>{const T=new Map;for(const N of r.filteredShortcuts){const A=N.source??"operator",G=T.get(A)??[];G.push(N),T.set(A,G)}return T})();return c.jsx("div",{className:"oc-composer",children:c.jsxs("div",{className:"oc-composer-inner",children:[r.fileOptions.length>0&&c.jsx("div",{className:"oc-file-palette",role:"listbox","aria-label":"Repository files",children:r.fileOptions.map(T=>c.jsx("button",{type:"button",role:"option",onMouseDown:N=>N.preventDefault(),onClick:()=>r.insertFileReference(T),children:c.jsxs("code",{children:["@",T]})},T))}),r.pendingImages.length>0&&c.jsx("div",{className:"oc-attachment-list",children:r.pendingImages.map(T=>c.jsxs("span",{children:[T.name,c.jsx("button",{type:"button","aria-label":`移除 ${T.name}`,onClick:()=>r.removeImage(T),children:"×"})]},T.name))}),c.jsxs("div",{className:"oc-composer-toolbar",children:[c.jsxs("label",{className:"oc-attach-button oc-attach-icon",title:"添加图片","aria-label":"添加图片",children:[c.jsx(qT,{}),c.jsx("span",{className:"sr-only",children:"添加图片"}),c.jsx("input",{type:"file",accept:"image/png,image/jpeg,image/gif,image/webp",multiple:!0,hidden:!0,onChange:T=>{r.addImagesFromFiles(Array.from(T.target.files??[]).slice(0,4)),T.target.value=""}})]}),c.jsxs("span",{className:"oc-composer-hint",children:[c.jsx("span",{className:"oc-kbd",children:"Enter"})," 发送"]}),c.jsxs("span",{className:"oc-composer-hint",children:[c.jsx("span",{className:"oc-kbd",children:"Shift"}),"+",c.jsx("span",{className:"oc-kbd",children:"Enter"})," 换行"]}),d&&c.jsx("span",{className:"oc-reload-status",children:"正在重新加载会话…"})]}),r.shortcutOpen&&r.filteredShortcuts.length>0&&c.jsxs("div",{className:"oc-shortcut-palette",role:"listbox","aria-label":"命令","aria-busy":r.dynamicCommandsLoading||void 0,children:[c.jsxs("div",{className:"oc-shortcut-palette-head",children:[c.jsxs("strong",{children:["命令 · ",r.filteredShortcuts.length]}),r.dynamicCommandsLoading?c.jsx("span",{className:"oc-shortcut-palette-meta",children:"正在加载扩展、提示词与技能…"}):null,r.dynamicCommandsError?c.jsxs("span",{className:"oc-shortcut-palette-meta is-error",children:[r.dynamicCommandsError,c.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>r.retryDynamicCommands(),children:"重试"})]}):null]}),[...H.entries()].map(([T,N])=>c.jsxs("div",{className:"oc-shortcut-group","data-source":T,children:[c.jsxs("small",{children:[TS[T]??T," ","· ",N.length]}),c.jsx("div",{className:"oc-shortcut-group-items",children:N.map(A=>{const G=r.filteredShortcuts.indexOf(A);return c.jsxs("button",{type:"button",role:"option","aria-selected":G===r.shortcutIndex,className:G===r.shortcutIndex?"is-active":"",title:A.command,onClick:()=>{y(A.command,A.action)},children:[c.jsx("code",{children:A.command}),A.description?c.jsx("span",{children:A.description}):A.label?c.jsx("span",{children:A.label}):null]},`${A.source}:${A.command}`)})})]},T))]}),c.jsxs("div",{className:`oc-composer-shell${i?" is-busy":""}`,children:[c.jsx("textarea",{ref:r.textareaRef,className:"oc-textarea",value:r.input,rows:3,placeholder:i?"正在生成回复…(停止后可发送下一轮)":l?"输入消息… Enter 发送 · Shift+Enter 换行":"描述目标,或点选上方建议开始…",onChange:T=>r.handleInputChange(T.target.value),onKeyDown:v,onCompositionStart:r.onCompositionStart,onCompositionEnd:r.onCompositionEnd,disabled:i,"aria-expanded":r.shortcutOpen,"aria-controls":(r.shortcutOpen,void 0)}),i?c.jsx("button",{type:"button",className:"oc-stop",title:"停止生成","aria-label":"停止生成",onClick:t.onStop,children:c.jsx(vT,{})}):c.jsx("button",{type:"button",className:"oc-send",title:"发送","aria-label":"发送",onClick:S,disabled:!r.input.trim()&&r.pendingImages.length===0||d,children:c.jsx(yT,{})})]}),u&&c.jsxs("div",{className:"oc-reload-banner is-error",role:"alert",children:[c.jsxs("span",{children:[u.code?`${u.code}:`:"",u.message]}),c.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>{Qi()},children:"重试"})]}),c.jsx("div",{className:"oc-runtime-controls",children:I})]})})}function $T(t){const{toolCalls:r,onClose:i,overlay:l=!1}=t,o=k.useRef(null);return dd({open:l,containerRef:o,triggerRef:t.triggerRef,onEscape:i}),c.jsxs("aside",{ref:o,id:"oc-process-panel",className:`oc-process${l?" is-process-overlay":""}`,"aria-label":"工具调用记录",role:l?"dialog":void 0,"aria-modal":l?!0:void 0,tabIndex:-1,children:[c.jsxs("header",{className:"oc-process-head",children:[c.jsxs("div",{className:"oc-process-title",children:[c.jsx("span",{className:"oc-process-title-mark","aria-hidden":"true"}),"工具调用记录",c.jsxs("span",{className:"oc-process-count",children:[r.length," 次"]})]}),c.jsx("button",{type:"button",className:"btn btn-ghost oc-process-close","aria-label":"关闭工具调用记录",onClick:i,children:"关闭"})]}),c.jsx("div",{className:"oc-process-timeline",children:r.length===0?c.jsx("div",{className:"oc-process-empty",children:"本轮对话尚无工具调用。诊断细节会在这里按时间线展示。"}):r.map((d,u)=>c.jsxs("div",{className:`oc-process-item${u===0?" is-first":""}${u===r.length-1?" is-last":""}${d.status==="error"?" is-error":""}${d.status==="running"?" is-running":""}`,children:[c.jsx("div",{className:"oc-process-rail","aria-hidden":"true",children:c.jsx("span",{className:"oc-process-dot"})}),c.jsx("div",{className:"oc-process-time",children:uy(d.createdAt)}),c.jsx("div",{className:"oc-process-body",children:c.jsx(Mv,{entry:d})})]},d.id))})]})}const Vg=[{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 Es(t){const r=Array.isArray(t.items)?t.items:void 0;return c.jsxs("section",{className:"oc-runtime-context-section",children:[c.jsxs("header",{className:"oc-runtime-context-section-head",children:[c.jsx("strong",{children:t.title}),c.jsx("span",{className:"oc-runtime-context-meta",children:r?`${r.length} 项`:"未投影"})]}),r===void 0?c.jsx("p",{className:"oc-runtime-context-empty",children:"该 session 未提供资源投影"}):r.length===0?c.jsx("p",{className:"oc-runtime-context-empty",children:t.emptyText}):c.jsx("ul",{className:"oc-runtime-context-resources",children:r.map((i,l)=>c.jsx(FT,{item:i},`${i.name??i.path??l}:${l}`))})]})}function FT(t){const r=t.item,l=[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 c.jsxs("li",{children:[c.jsxs("div",{className:"oc-runtime-context-resource-head",children:[c.jsx("strong",{className:"oc-runtime-context-resource-name",title:r.path??r.name,children:r.name||r.path||"未命名资源"}),r.enabled===!1?c.jsx("span",{className:"oc-runtime-context-resource-flag",children:"未启用"}):null,l?c.jsx("span",{className:"oc-runtime-context-meta",title:l,children:l}):null]}),r.description?c.jsx("span",{className:"oc-runtime-context-resource-desc",children:r.description}):null,r.path?c.jsx("code",{className:"oc-runtime-context-resource-path",title:o,children:o}):null,r.error?c.jsxs("span",{className:"oc-runtime-context-diag is-error",children:[c.jsx("span",{className:"oc-runtime-context-diag-icon","aria-hidden":"true",children:"✕"}),r.error]}):null,Array.isArray(r.diagnostics)&&r.diagnostics.length>0?c.jsxs("span",{className:"oc-runtime-context-diag",children:[c.jsx("span",{className:"oc-runtime-context-diag-icon","aria-hidden":"true",children:"⚠"}),r.diagnostics.join(";")]}):null,Array.isArray(r.resolved)&&r.resolved.length>0?c.jsxs("details",{className:"oc-runtime-context-resolved",children:[c.jsxs("summary",{children:["已解析 ",r.resolved.length," 项"]}),c.jsx("ul",{className:"oc-runtime-context-resolved-list",children:r.resolved.map((d,u)=>{const h=`${d.type??"?"}:${d.name??d.path??"?"}`;return c.jsx("li",{children:c.jsx("code",{title:h,children:h})},u)})})]}):null]})}const VT=k.forwardRef(function({open:r,onToggle:i,onClose:l,context:o,panelOnly:d=!1,triggerOnly:u=!1,triggerRef:h},g){const p=Wi(),v=p.reloading,y=p.reloadError,[S,x]=k.useState("overview"),w=k.useRef(null);dd({open:r&&!u,containerRef:w,triggerRef:h,onEscape:l}),k.useEffect(()=>{r||x("overview")},[r]);const I=Array.isArray(o.resources.activeTools)?o.resources.activeTools:[],H=typeof o.resources.activeToolCount=="number"?o.resources.activeToolCount:I.length,T=o.systemPrompt.text??o.systemPrompt.summary??"",N=o.systemPrompt.charCount??T.length,A=o.suffix.present?o.suffix.text??o.suffix.summary??"":"",G=o.model?Hs(o.model.provider,o.model.modelId):"",K=o.resources,E=String(o.resources.mode??"closed"),$=E.includes("open")?"open":"closed",te={files:K.contextFiles?.length??0,skills:K.skills?.length??0,extensions:K.extensions?.length??0,packages:K.packages?.length??0},se=["files","skills","extensions","packages"].map(F=>({id:F,label:Vg.find(le=>le.id===F)?.label??F,count:te[F]??0})),z=c.jsx("button",{type:"button",ref:F=>{typeof g=="function"?g(F):g&&(g.current=F)},className:`btn btn-ghost oc-runtime-context-toggle${r?" is-active":""}`,"aria-expanded":r,"aria-controls":"oc-runtime-context-panel",onClick:i,children:"注入上下文"});if(u)return z;const V=r?c.jsxs("div",{ref:w,id:"oc-runtime-context-panel",className:"oc-runtime-context-sidepanel",role:"dialog","aria-modal":"true","aria-label":"注入上下文",tabIndex:-1,children:[c.jsxs("header",{className:"oc-runtime-context-head",children:[c.jsxs("div",{className:"oc-runtime-context-head-copy",children:[c.jsx("strong",{children:"注入上下文"}),c.jsx("span",{className:"oc-runtime-context-meta",children:"只读 · 本轮实际注入的 system prompt / 资源(已脱敏)"})]}),c.jsx("button",{type:"button",className:"btn btn-ghost oc-runtime-context-close","aria-label":"关闭注入上下文",onClick:l,children:"关闭"})]}),c.jsxs("div",{className:"oc-runtime-context-layout",children:[c.jsx("nav",{className:"oc-runtime-context-nav","aria-label":"上下文分类",children:Vg.map(F=>{const le=te[F.id];return c.jsxs("button",{type:"button",className:`oc-runtime-context-nav-item${S===F.id?" is-active":""}`,"aria-current":S===F.id?"page":void 0,onClick:()=>x(F.id),children:[c.jsx("span",{className:"oc-runtime-context-nav-label",title:F.label,children:F.label}),typeof le=="number"?c.jsx("span",{className:"oc-runtime-context-nav-count",children:le}):null]},F.id)})}),c.jsxs("div",{className:"oc-runtime-context-body",children:[S==="overview"?c.jsxs("div",{className:"oc-runtime-context-overview",children:[o.model?c.jsxs("section",{className:"oc-runtime-context-model-card",children:[c.jsx("span",{className:"oc-runtime-context-model-label",children:"模型"}),c.jsx("code",{className:"oc-runtime-context-model-ref",title:G,children:G})]}):null,c.jsxs("div",{className:"oc-runtime-context-stat-grid",children:[c.jsxs("div",{className:"oc-runtime-context-stat",children:[c.jsx("span",{className:"oc-runtime-context-stat-label",children:"Prompt 字数"}),c.jsxs("strong",{className:"oc-runtime-context-stat-value",children:[N.toLocaleString()," 字"]})]}),c.jsxs("div",{className:"oc-runtime-context-stat",children:[c.jsx("span",{className:"oc-runtime-context-stat-label",children:"工具"}),c.jsx("strong",{className:"oc-runtime-context-stat-value",children:H})]}),c.jsxs("div",{className:"oc-runtime-context-stat",children:[c.jsx("span",{className:"oc-runtime-context-stat-label",children:"思考"}),c.jsx("strong",{className:"oc-runtime-context-stat-value",children:o.thinkingLevel??"—"})]}),c.jsxs("div",{className:"oc-runtime-context-stat",children:[c.jsx("span",{className:"oc-runtime-context-stat-label",children:"资源面"}),c.jsxs("strong",{className:`oc-runtime-context-stat-value oc-runtime-context-mode is-${$}`,title:E,children:[c.jsx("span",{className:"oc-runtime-context-mode-dot","aria-hidden":"true"}),E]})]})]}),c.jsxs("section",{className:"oc-runtime-context-section",children:[c.jsx("header",{className:"oc-runtime-context-section-head",children:c.jsx("strong",{children:"已加载资源"})}),c.jsx("div",{className:"oc-runtime-context-resource-links",children:se.map(F=>c.jsxs("button",{type:"button",className:"oc-runtime-context-resource-link",onClick:()=>x(F.id),children:[c.jsx("span",{className:"oc-runtime-context-resource-label",children:F.label}),c.jsx("span",{className:`oc-runtime-context-resource-count${F.count===0?" is-zero":""}`,children:F.count}),c.jsx("span",{className:"oc-runtime-context-resource-chevron","aria-hidden":"true",children:"›"})]},F.id))})]})]}):null,S==="system"?c.jsxs(c.Fragment,{children:[c.jsxs("section",{className:"oc-runtime-context-section",children:[c.jsxs("header",{className:"oc-runtime-context-section-head",children:[c.jsxs("div",{children:[c.jsx("strong",{children:"System prompt"}),c.jsxs("code",{className:"oc-runtime-context-hash",children:[o.systemPrompt.hash.slice(0,12),"…"]})]}),T?c.jsx(rd,{text:T}):null]}),c.jsx("pre",{className:"oc-runtime-context-text",children:T||"(空)"})]}),c.jsxs("section",{className:"oc-runtime-context-section",children:[c.jsxs("header",{className:"oc-runtime-context-section-head",children:[c.jsxs("div",{className:"oc-runtime-context-section-title",children:[c.jsx("strong",{children:"Session suffix"}),c.jsx("span",{className:"oc-runtime-context-meta",children:o.suffix.present?`${(o.suffix.charCount??0).toLocaleString()} 字`:"未注入"})]}),A?c.jsx(rd,{text:A}):null]}),o.suffix.present?c.jsx("pre",{className:"oc-runtime-context-text",children:A||"已注入"}):c.jsx("p",{className:"oc-runtime-context-empty",children:"本会话无额外 suffix"})]})]}):null,S==="files"?c.jsx(Es,{title:"Context files",items:K.contextFiles?.map(F=>({name:F.path,description:`${F.characters.toLocaleString()} 字符`})),emptyText:"该 session 未加载任何上下文文件"}):null,S==="skills"?c.jsx(Es,{title:"Skills",items:K.skills,emptyText:"该 session 未加载任何 Skills"}):null,S==="extensions"?c.jsx(Es,{title:"Extensions",items:K.extensions,emptyText:"该 session 未加载任何 Extensions"}):null,S==="packages"?c.jsx(Es,{title:"Packages",items:K.packages,emptyText:"该 session 未配置 Packages"}):null,S==="tools"?c.jsxs("section",{className:"oc-runtime-context-section",children:[c.jsxs("header",{className:"oc-runtime-context-section-head",children:[c.jsx("strong",{children:"Active tools"}),c.jsxs("span",{className:"oc-runtime-context-meta",children:[H," 项"]})]}),I.length===0?c.jsx("p",{className:"oc-runtime-context-empty",children:"无激活工具"}):c.jsx("ul",{className:"oc-runtime-context-tools",children:I.map(F=>c.jsx("li",{children:c.jsx("code",{children:F})},F))}),Array.isArray(K.diagnostics)&&K.diagnostics.length>0?c.jsx("ul",{className:"oc-runtime-context-resources",children:K.diagnostics.map((F,le)=>c.jsxs("li",{children:[c.jsxs("span",{className:`oc-runtime-context-diag is-${F.type??"warning"}`,children:[F.type,": ",F.message]}),F.path?c.jsx("code",{children:F.path}):null]},le))}):null]}):null,S==="raw"?c.jsxs("details",{className:"oc-runtime-context-raw",open:!0,children:[c.jsx("summary",{children:"原始投影 JSON"}),c.jsx("pre",{children:JSON.stringify(o,null,2)})]}):null]},S)]}),c.jsxs("footer",{className:"oc-runtime-context-foot",children:[c.jsx("span",{className:"oc-runtime-context-meta",children:v?"正在重新加载会话…":"重新加载 Pi 会话设置、扩展、技能、提示词与上下文文件"}),c.jsx("button",{type:"button",className:"btn btn-ghost",disabled:v,onClick:()=>{Qi()},children:"重新加载会话"}),y&&c.jsxs("span",{className:"oc-runtime-context-diag is-error",role:"alert",children:[y.code?`${y.code}:`:"",y.message,c.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>{Qi()},children:"重试"})]})]})]}):null;return d?V:c.jsxs("div",{className:"oc-runtime-context-menu",children:[z,V]})});function PT(){const t=k.useRef(null),r=k.useRef(!1),i=k.useRef(null),l=k.useRef(new Map),o=k.useRef(new Set),d=k.useRef(null),u=k.useRef(null),h=k.useRef(0),g=k.useRef(null),p=k.useRef(new Set),v=k.useRef(new Set),y=k.useRef(new Map),S=k.useRef(new Set),x=k.useRef(null),w=k.useRef(null),I=k.useRef(!1),H=k.useRef(0),T=k.useRef(null),N=k.useRef(!1),A=k.useRef(!1),G=k.useRef(null),K=k.useRef(new Set),E=k.useRef(new Set),$=k.useRef(new Set),te=k.useRef(!1),se=k.useRef(0);return k.useMemo(()=>({sessionRef:t,streamingRef:r,abortRef:i,sessionAbortControllersRef:l,inlineStreamSessionIdsRef:o,assistantIdRef:d,lastEventIdRef:u,sessionGenerationRef:h,eventsStreamStateRef:g,settledTurnIdsRef:p,seenEventIdsRef:v,turnAssistantIdsRef:y,sealedAssistantIdsRef:S,reconnectAbortRef:x,activeTurnIdRef:w,submitInFlightRef:I,submitGenerationRef:H,pendingSubmissionRef:T,stopInFlightRef:N,stopRequestedRef:A,stoppingTurnIdRef:G,abortPostedTurnIdsRef:K,releasedClientRequestIdsRef:E,usageResponseKeysRef:$,isComposingRef:te,compositionEndedAtRef:se}),[t,r,i,l,o,d,u,h,g,p,v,y,S,x,w,I,H,T,N,A,G,K,E,$,te,se])}const YT=["operation","contract","dag","report","html"];function KT(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"||!YT.includes(i.kind)||typeof i.previewHash!="string")){for(const l of["title","summary","htmlPreview","reportText","inspectHref"])if(i[l]!==void 0&&typeof i[l]!="string")return;return i}}function XT(t,r){const i=t.findIndex(l=>l.artifactId===r.artifactId);return i<0?[...t,r]:t.map((l,o)=>o===i?{...l,...r}:l)}function QT(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 ZT(t,r){const i=t.findIndex(o=>o.cardId===r.cardId);if(i<0)return[...t,r];const l=[...t];return l[i]=r,l}function JT(t,r){const i=t.findIndex(l=>l.operationId===r.operationId);return i<0?[...t,r]:t.map((l,o)=>o===i?{...l,...r}:l)}function WT(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 i}function eE(t){const{refs:r,onReconcile:i,setError:l,setInterview:o,setHumanGateCards:d,setArtifactCards:u,setStreaming:h,setStreamingAssistantId:g,setUnread:p,setOperationCards:v,setUsage:y,setMessages:S,setToolCalls:x}=t;return(w,I,H,T)=>{if(T?.generation!==void 0&&r.sessionGenerationRef.current!==T.generation)return;const N=T?.replay===!0;if(w==="stream_ready")return;if(w==="reconcile"){const E=typeof I.reason=="string"?I.reason:"cursor_expired";i?.({reason:E,...typeof I.minSeq=="number"?{minSeq:I.minSeq}:{},...typeof I.epoch=="string"?{epoch:I.epoch}:{},...typeof I.latestTurnId=="string"?{latestTurnId:I.latestTurnId}:{},...typeof I.latestEventId=="string"?{latestEventId:I.latestEventId}:I.latestEventId===null?{latestEventId:null}:{}});return}const A=I.data&&typeof I.data=="object"?I.data:I,G=typeof I.turnId=="string"?I.turnId:void 0;if(G&&(w==="agent_start"||w==="message_update")&&r.settledTurnIdsRef.current.has(G))return;let K=H;if(G){const E=r.turnAssistantIdsRef.current.get(G);E?K=E:r.turnAssistantIdsRef.current.set(G,H)}if(w==="interview-turn"){o(E=>({...E??{},interviewSessionId:typeof A.interviewSessionId=="string"?A.interviewSessionId:E?.interviewSessionId,taskId:typeof A.taskId=="string"?A.taskId:E?.taskId,state:typeof A.state=="string"?A.state:E?.state,question:A.question&&typeof A.question=="object"?A.question:void 0}));return}if(w==="draft"){o(E=>({...E??{},taskId:typeof A.taskId=="string"?A.taskId:E?.taskId,draft:A.draft&&typeof A.draft=="object"?A.draft:E?.draft,draftSha256:typeof A.draftSha256=="string"?A.draftSha256:E?.draftSha256,taskKindRecommendation:typeof A.taskKindRecommendation=="string"?A.taskKindRecommendation:E?.taskKindRecommendation}));return}if(w==="assessment"){o(E=>({...E??{},assessment:A}));return}if(w==="taskKind-confirmed"){o(E=>({...E??{},confirmedTaskKind:typeof A.taskKind=="string"?A.taskKind:E?.confirmedTaskKind,taskKindRecommendation:void 0}));return}if(w==="human-gate-card"){const E=QT(A);E&&d($=>ZT($,E));return}if(w==="artifact-ref"){const E=KT(A);E&&u($=>XT($,E));return}if(w==="agent_start"){if(N&&G!==void 0&&G!==r.activeTurnIdRef.current)return;G&&(r.settledTurnIdsRef.current.delete(G),r.activeTurnIdRef.current=G),r.streamingRef.current=!0,h(!0),g(K);return}if(w==="agent_settled"||w==="agent_end"){if(G&&r.settledTurnIdsRef.current.add(G),w==="agent_end")return;G===r.activeTurnIdRef.current&&(r.activeTurnIdRef.current=null),r.streamingRef.current=!1,h(!1),g(null),w==="agent_settled"&&!N&&typeof document<"u"&&document.hidden&&p(E=>E+1),S(E=>E.filter($=>!($.id===K&&$.role==="assistant"&&!$.text.trim()))),x(E=>E.map($=>$.status==="running"&&$.assistantMessageId===K?{...$,status:"error",finishedAt:Date.now()}:$));return}if(w==="operation-ref"||w==="operation-status"){const E=WT(A);E&&v($=>JT($,E));return}if(w==="usage"){if(N)return;const E=A,$=typeof E.responseKey=="string"&&E.responseKey?E.responseKey:void 0;if($&&r.usageResponseKeysRef.current.has($))return;$&&r.usageResponseKeysRef.current.add($),y(te=>{const se=E.inputTokens??0,z=E.outputTokens??0,V=E.cacheReadTokens??0,F=E.cacheWriteTokens??0,le=E.totalTokens??se+z+V+F;return{inputTokens:te.inputTokens+se,outputTokens:te.outputTokens+z,cacheReadTokens:te.cacheReadTokens+V,cacheWriteTokens:te.cacheWriteTokens+F,totalTokens:te.totalTokens+le,cost:E.cost===void 0?te.cost:(te.cost??0)+E.cost}});return}if(w==="message_update"||w==="message_end"){if(N)return;const E=r.sealedAssistantIdsRef.current;if(w==="message_update"&&E.has(K)){const z=Wr("a");G&&r.turnAssistantIdsRef.current.set(G,z),K=z,g(z)}const $=typeof A.text=="string"?A.text:"",te=Ws(A.content),se=K;S(z=>z.some(F=>F.id===se)?z.map(F=>F.id===se?{...F,text:$,...te?{content:te}:{}}:F):[...z,{id:se,role:"assistant",text:$,createdAt:Date.now(),...te?{content:te}:{}}]),w==="message_end"&&E.add(se)}else if(w==="tool_call"){const E=typeof A.toolCallId=="string"?A.toolCallId:Wr("t"),$=typeof A.toolName=="string"?A.toolName:"tool",te=typeof A.argsPreview=="string"?A.argsPreview:"{}",se=Date.now();x(z=>z.some(V=>V.id===E)?z.map(V=>V.id===E?{...V,args:te,status:"running",turnId:G??V.turnId,assistantMessageId:K}:V):[...z,{id:E,toolName:$,args:te,status:"running",createdAt:se,turnId:G,assistantMessageId:K}])}else if(w==="tool_result"){const E=typeof A.toolCallId=="string"?A.toolCallId:Wr("r"),$=typeof A.toolName=="string"?A.toolName:"tool",te=A.isError===!0,se=typeof A.resultPreview=="string"?A.resultPreview:"{}",z=Date.now();x(V=>V.find(le=>le.id===E)?V.map(le=>le.id===E?{...le,result:se,resultText:se,status:te?"error":"ok",finishedAt:z,turnId:G??le.turnId,assistantMessageId:le.assistantMessageId??K}:le):[...V,{id:E,toolName:$,result:se,resultText:se,status:te?"error":"ok",createdAt:z,finishedAt:z,turnId:G,assistantMessageId:K}])}else w==="error"&&l(typeof A.message=="string"?A.message:"chat error")}}const qc={inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheWriteTokens:0,totalTokens:0};function tE(t){const{origin:r,refs:i,sessionId:l,setError:o,onReconcile:d}=t,[u,h]=k.useState([]),[g,p]=k.useState([]),[v,y]=k.useState([]),[S,x]=k.useState([]),[w,I]=k.useState(50),[H,T]=k.useState(0),[N,A]=k.useState([]),[G,K]=k.useState(null),[E,$]=k.useState(null),[te,se]=k.useState(!1),[z,V]=k.useState(qc),[F,le]=k.useState(!1),[X,B]=k.useState(null),[O]=k.useState(!1),U=k.useMemo(()=>eE({refs:i,onReconcile:d,setError:o,setInterview:K,setHumanGateCards:A,setArtifactCards:x,setStreaming:le,setStreamingAssistantId:B,setUnread:T,setOperationCards:y,setUsage:V,setMessages:h,setToolCalls:p}),[i,d,o]),_=k.useCallback((Y,ce,he)=>{if(he?.targetSessionId&&i.sessionRef.current?.sessionId!==he.targetSessionId||he?.generation!==void 0&&i.sessionGenerationRef.current!==he.generation)return null;const pe=Y.split(`
|
|
43
|
-
`);let ye="message",je="",ze=null;for(const lt of pe)lt.startsWith("event: ")?ye=lt.slice(7).trim():lt.startsWith("data: ")?je+=lt.slice(6):lt.startsWith("id: ")&&(ze=lt.slice(4).trim());if(!je)return ze;let Ye;try{Ye=JSON.parse(je)}catch{return ze}const Ke=ze??(typeof Ye.eventId=="string"?Ye.eventId:null);if(Ke){if(i.seenEventIdsRef.current.has(Ke))return Ke;i.seenEventIdsRef.current.add(Ke)}return U(ye,Ye,ce,he),ze??Ke},[U,i]),W=k.useCallback(async(Y,ce)=>{const he=ce?.background===!0;he||se(!0);try{const pe=await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(Y)}/context`,{credentials:"include"});if(!pe.ok)return;const ye=await pe.json();ye.context&&i.sessionRef.current?.sessionId===Y&&$(je=>P1(je,ye.context)?je:ye.context)}finally{he||se(!1)}},[r,i]);k.useEffect(()=>{l&&W(l)},[l,W]),k.useEffect(()=>{if(!l)return;const Y=window.setTimeout(()=>{W(l,{background:!0})},350);return()=>window.clearTimeout(Y)},[l,v,N,G,W]);const R=k.useMemo(()=>u.filter(Y=>Y.role!=="system"||O).slice(-w),[u,O,w]);k.useEffect(()=>{const Y=()=>{document.hidden||T(0)};return document.addEventListener("visibilitychange",Y),()=>document.removeEventListener("visibilitychange",Y)},[]);const D=k.useMemo(()=>{if(g.length===0)return null;const Y=g.filter(je=>je.status==="running"),ce=g.filter(je=>je.status==="error"),he=Y[Y.length-1];let pe="完成",ye="ok";return ce.length>0?(pe=`${ce.length} 次出错`,ye="error"):Y.length>0?(pe=he?`${he.toolName} 运行中`:"运行中",ye="running"):pe="",{count:g.length,statusLabel:pe,statusKind:ye}},[g]),M=k.useMemo(()=>TT({messages:R,toolCalls:g,streaming:F,activeAssistantId:X}),[R,g,F,X]),C=k.useCallback(()=>{h([]),p([]),y([]),A([]),x([]),K(null),$(null),V(qc),le(!1),B(null),T(0),I(50),i.usageResponseKeysRef.current=new Set},[i]),ie=k.useCallback(Y=>{h(Y.messages),p(Y.toolCalls),y([]),A([]),x([]),$(null),K(null),V(qc),i.usageResponseKeysRef.current=new Set,le(Y.streaming),B(null),T(0),I(50)},[i]),de=k.useCallback(async Y=>{try{const ce=await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(Y)}`,{credentials:"include"});if(!ce.ok)return!1;const he=await ce.json();if(!he.session||i.sessionRef.current?.sessionId!==Y)return!1;const pe=he.session.activeTurnId??null;return i.activeTurnIdRef.current=pe,i.streamingRef.current=!!pe,i.lastEventIdRef.current=he.lastEventId??null,i.seenEventIdsRef.current=new Set,i.turnAssistantIdsRef.current=new Map,i.sealedAssistantIdsRef.current=new Set,h((he.session.messages??[]).filter(ye=>ye.role==="user"||ye.role==="assistant").map(ye=>{const je=Ws(ye.content);return{id:ye.id,role:ye.role,text:ye.text,createdAt:Date.parse(ye.at)||Date.now(),...je&&je.length>0?{content:je}:{}}})),B(null),!0}catch{return!1}},[r,i,h,B]);return{messages:u,setMessages:h,toolCalls:g,setToolCalls:p,operationCards:v,artifactCards:S,historyLimit:w,setHistoryLimit:I,unread:H,humanGateCards:N,interview:G,setInterview:K,taskContext:E,contextLoading:te,usage:z,streaming:F,setStreaming:le,streamingAssistantId:X,setStreamingAssistantId:B,visibleMessages:R,turnGroups:M,processSummary:D,applyChatSseEvent:U,applySseBlock:_,loadTaskContext:W,resetForNewSession:C,applyActivatedSession:ie,recoverSession:de}}class nE{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 l of this.controllers.keys())i.has(l)||this.cancel(l)}dispose(){for(const r of this.controllers.values())r.abort();this.controllers.clear(),this.eligible.clear()}async run(r,i){let l;const o=new Set;let d=!1;const u=window.setTimeout(()=>{d=!0,i.abort()},this.deadlineMs);try{for(;!i.signal.aborted;){try{const h={Accept:"text/event-stream"};l&&(h["Last-Event-ID"]=l);const g=await this.fetchFn(`${this.options.origin}/api/operator/v1/chat/sessions/${encodeURIComponent(r)}/events`,{headers:h,credentials:"include",signal:i.signal});if(g.status===404||!g.body)return;if(!g.ok)throw new Error(`HTTP ${g.status}`);const p=g.body.getReader(),v=new TextDecoder;let y="";for(;;){const{done:S,value:x}=await p.read();if(S||i.signal.aborted)break;y+=v.decode(x,{stream:!0});const w=y.split(`
|
|
44
|
-
|
|
45
|
-
`);y=w.pop()??"";for(const I of w){const H=I.split(`
|
|
46
|
-
`).find(N=>N.startsWith("id: "))?.slice(4);if(H&&(l=H),!H||o.has(H)||!I.includes("event: session_title"))continue;const T=I.split(`
|
|
47
|
-
`).find(N=>N.startsWith("data: "))?.slice(6);if(T)try{const N=JSON.parse(T),A=N.data?.title?.trim();if(!A)continue;if(o.add(H),!this.options.hasSession(r)||(this.options.onTitle(r,{title:A,automatic:!!N.data?.automatic}),N.data?.automatic))return}catch{}}}}catch{if(i.signal.aborted)return}i.signal.aborted||await rE(this.backoffMs,i.signal)}}finally{window.clearTimeout(u),this.controllers.get(r)===i&&this.controllers.delete(r),(d||!this.options.hasSession(r))&&this.options.refresh()}}}function rE(t,r){return new Promise(i=>{const l=window.setTimeout(d,t),o=()=>d();function d(){window.clearTimeout(l),r.removeEventListener("abort",o),i()}r.addEventListener("abort",o,{once:!0})})}async function iE(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":Xt()},credentials:"include",body:JSON.stringify(t.options??{})});if(!r.ok){const u=await r.json().catch(()=>({}));throw new Error(u.error?.message??`HTTP ${r.status}`)}const i=await r.json();if(!i.session)throw new Error("创建会话响应缺少 durable session");const l=i.session,o={sessionId:l.sessionId,...id(l)},d=[l,...t.sessionListRef.current.filter(u=>u.sessionId!==l.sessionId)].slice(0,Os);return t.sessionListRef.current=d,t.setSessionList(d),t.titleWatcher?.markEligible(l.sessionId),t.refreshSessionList(),o}finally{t.creatingRef&&(t.creatingRef.current=!1),t.setCreatingSession?.(!1)}}function aE(t){const{origin:r,refs:i,setSession:l,thread:o,composer:d,browser:u,setError:h,setProcessOpen:g,setAutoScroll:p}=t,{applyActivatedSession:v,resetForNewSession:y,setMessages:S}=o,{setInput:x,setPendingImages:w}=d,{setPreviews:I,setActivePreviewPath:H}=u,[T,N]=k.useState([]),A=k.useRef([]);A.current=T;const G=k.useRef(null),[K,E]=k.useState(!1),$=k.useRef(!1),te=k.useRef(0),se=k.useCallback(()=>{i.sessionGenerationRef.current+=1,i.abortRef.current?.abort(),i.reconnectAbortRef.current?.abort();for(const _ of i.sessionAbortControllersRef.current.values())_.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(),x(""),w([]),I([]),H(null),g(!1),p(!0)},[i,y,x,w,I,H,g,p]),z=k.useCallback(async()=>{try{const _=await fetch(`${r}/api/operator/v1/chat/sessions`,{credentials:"include"});if(!_.ok)return;const W=(await _.json()).sessions??[],R=W.slice(0,Os),D=W.slice(Os);if(N(R),D.length===0)return;await Promise.all(D.map(C=>fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(C.sessionId)}`,{method:"DELETE",credentials:"include",headers:{"x-loop-console-confirmation":Xt()}}).catch(()=>{})));const M=i.sessionRef.current?.sessionId;M&&D.some(C=>C.sessionId===M)&&(te.current+=1,i.sessionRef.current=null,se(),l(null),window.localStorage.removeItem(wn))}catch{}},[r,i,se,l]),V=k.useCallback(async _=>{if(window.confirm("确定删除该会话?删除后不可恢复。"))try{if(!(await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(_)}`,{method:"DELETE",credentials:"include",headers:{"x-loop-console-confirmation":Xt()}})).ok){h("删除会话失败");return}G.current?.cancel(_),i.sessionRef.current?.sessionId===_&&(te.current+=1,i.sessionRef.current=null,se(),l(null),window.localStorage.removeItem(wn)),await z()}catch(W){h(W instanceof Error?W.message:String(W))}},[r,i,l,se,z,h]),F=k.useCallback(async _=>{const W=++te.current;try{const R=await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(_)}`,{credentials:"include"}),D=await R.json();if(!R.ok||!D.session)throw new Error(D.error?.message??"会话不可用");if(W!==te.current)return;const M={sessionId:D.session.sessionId,...id(D.session)};se(),i.sessionRef.current=M,i.streamingRef.current=!!D.session.activeTurnId,i.activeTurnIdRef.current=D.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,l(M),i.assistantIdRef.current=null,i.abortRef.current=i.sessionAbortControllersRef.current.get(_)??null,w([]),I([]),x(D.session.composerDraft??"");const C=jT(D.session.messages??[]);v({messages:C.messages,toolCalls:C.toolCalls,streaming:!!D.session.activeTurnId}),window.localStorage.setItem(wn,_),H(null)}catch(R){if(W!==te.current)return;h(R instanceof Error?R.message:String(R))}},[r,i,l,w,I,x,v,se,H,h]);k.useEffect(()=>{z()},[z]),G.current||(G.current=new nE({origin:r,hasSession:_=>A.current.some(W=>W.sessionId===_),onTitle:(_,W)=>{N(R=>R.map(D=>D.sessionId!==_||W.automatic&&D.title?D:W.automatic?{...D,title:W.title}:{...D,displayTitle:W.title}))},refresh:z}));const le=k.useCallback(_=>G.current?.startIfEligible(_),[]);k.useEffect(()=>{G.current?.reconcile(T.filter(_=>_.state!=="archived"&&!_.title).map(_=>_.sessionId))},[T]),k.useEffect(()=>()=>G.current?.dispose(),[]),k.useEffect(()=>{let _=!1;const W=window.localStorage.getItem(wn);if(!W)return;const R=++te.current;return(async()=>{try{const D=await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(W)}`,{credentials:"include"});if(!D.ok){window.localStorage.removeItem(wn);return}const M=await D.json();if(_||R!==te.current||!M.session)return;const C={sessionId:M.session.sessionId,...id(M.session)};i.sessionGenerationRef.current+=1,i.sessionRef.current=C,i.activeTurnIdRef.current=M.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,l(C),x(M.session.composerDraft??""),S((M.session.messages??[]).filter(ie=>ie.role==="user"||ie.role==="assistant").map(ie=>{const de=Ws(ie.content);return{id:ie.id,role:ie.role,text:ie.text,createdAt:Date.parse(ie.at)||Date.now(),...de&&de.length>0?{content:de}:{}}}))}catch{}})(),()=>{_=!0}},[r,i,l,x,S]);const X=k.useCallback(_=>iE({origin:r,sessionListRef:A,setSessionList:N,titleWatcher:G.current,refreshSessionList:z,options:_,setCreatingSession:E,creatingRef:$}),[r,z]),B=k.useCallback(async _=>{if($.current)return null;const W=++te.current;h(null);try{const R=await X(_);return W!==te.current?null:(se(),i.sessionRef.current=R,window.localStorage.setItem(wn,R.sessionId),l(R),R)}catch(R){if(W!==te.current)return null;const D=R instanceof Error?R.message:String(R);return D!=="CREATE_SESSION_IN_FLIGHT"&&h(D),null}},[i,l,h,se,X]),O=k.useCallback(async()=>{const _=i.sessionRef.current;if(!(!_||i.streamingRef.current))try{const W=await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(_.sessionId)}/compact`,{method:"POST",credentials:"include",headers:{"x-loop-console-confirmation":Xt()}}),R=await W.json().catch(()=>({}));if(!W.ok){h(R.error?.message??"上下文压缩失败");return}h(null)}catch(W){h(W instanceof Error?W.message:"上下文压缩失败")}},[r,i,h]);return{sessionList:T,creatingSession:K,activateSession:F,refreshSessionList:z,deleteSession:V,createSession:B,updateSession:async(_,W)=>{if(!(await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(_)}`,{method:"PATCH",credentials:"include",headers:{"content-type":"application/json","x-loop-console-confirmation":Xt()},body:JSON.stringify(W)})).ok){h("会话更新失败");return}await z(),W.state==="archived"&&G.current?.cancel(_),W.state==="archived"&&i.sessionRef.current?.sessionId===_&&(te.current+=1,i.sessionRef.current=null,se(),l(null),window.localStorage.removeItem(wn))},watchSessionTitle:le,compactSession:O}}function Ki(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 lE(t){let r;const i=new Promise(l=>{r=l});return{...t,outcomePromise:i,resolveOutcome:r}}function Pg(t="network error while creating turn"){return{kind:"ambiguous",message:t}}function sE(t="无法确认 Turn 是否已创建,正在与服务端对账(不会重复提交新的请求 ID)"){return{kind:"ambiguous",message:t}}function Yg(t){const{body:r,clientRequestId:i}=t,l=r.error?.code,o=r.error?.message??(t.httpOk?"turn was not accepted":`HTTP ${t.status}`);if(l==="TURN_ACTIVE"&&r.activeTurn?.turnId)return{kind:"adopt-active",activeTurn:r.activeTurn,message:"上一轮仍在运行,已重新连接;当前消息已保留。"};if(r.accepted===!0||t.httpOk&&r.turnId){const d=r.turn?.turnId??r.turnId;return d?{kind:"accepted",turnId:d,idempotent:r.idempotent===!0,turn:r.turn??{turnId:d,clientRequestId:i,state:r.state}}:{kind:"ambiguous",message:o}}return r.accepted===!1||l?{kind:"rejected",code:l,message:o}:{kind:"ambiguous",message:o}}function oE(t){const r=t.clientRequestId,i=t.state?.activeTurn,l=t.state?.latestTurn;return i?.clientRequestId===r&&i.turnId?{kind:"accepted",turnId:i.turnId,idempotent:!0,turn:i}:l?.clientRequestId===r&&l.turnId?{kind:"accepted",turnId:l.turnId,idempotent:!0,turn:l}:i?.turnId?{kind:"adopt-active",activeTurn:i,message:"上一轮仍在运行,已重新连接;当前消息已保留。"}:null}function uE(t){const r=t.clientRequestId,i=t.state?.activeTurn,l=t.state?.latestTurn,o=i?.state??t.state?.activeTurnState??void 0,d=l?.state??t.state?.latestTurnState??void 0;if(i?.clientRequestId===r&&i.turnId)return ti(o)?{action:"release-terminal",turnId:i.turnId,state:String(o)}:{action:"bind-active",turnId:i.turnId};if(l?.clientRequestId===r&&l.turnId){if(ti(d))return{action:"release-terminal",turnId:l.turnId,state:String(d)};if(!i?.turnId||i.clientRequestId===r)return{action:"bind-active",turnId:l.turnId}}return!Us(t.state)&&!(!!i?.turnId&&i?.clientRequestId!==r)?{action:"release-not-accepted"}:{action:"hold"}}function Us(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 ti(t){return t==="settled"||t==="aborted"||t==="failed"}function qs(t){return t.pending.sessionId===t.sessionId&&t.pending.sessionGeneration===t.sessionGeneration&&t.pending.submitGeneration===t.submitGeneration}function cE(t,r){return`${t}/api/operator/v1/chat/sessions/${encodeURIComponent(r)}/turns`}function Kg(t,r){return`${t}/api/operator/v1/chat/sessions/${encodeURIComponent(r)}/state`}function dE(t,r){return`${t}/api/operator/v1/chat/sessions/${encodeURIComponent(r)}/events`}function fE(t,r,i){return`${t}/api/operator/v1/chat/sessions/${encodeURIComponent(r)}/turns/${encodeURIComponent(i)}/abort`}function na(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 _v(t){t.stopRequested=!0}function Gs(t){t.stopRequested=!1}function hE(t,r){return!(!r||t.abortPostedTurnIds.has(r))}function mE(t,r){r&&t.abortPostedTurnIds.add(r)}function $s(t,r){return!t.stopRequested||!hE(t,r)?null:(mE(t,r),t.stoppingTurnId=r,t.activeTurnId=r,r)}function Xg(t,r){const i=t.pendingSubmission;return i&&i.clientRequestId!==r.clientRequestId?!1:(r.turnId&&t.settledTurnIds.add(r.turnId),na(t,r.clientRequestId),Gs(t),r.markIdle!==!1&&(t.streaming=!1,t.activeTurnId=null,t.assistantId=null,t.stoppingTurnId=null),!0)}function pE(t,r){return qs({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 gE(t,r){r.pending.resolveOutcome({kind:"adopt-active",activeTurn:{turnId:r.activeTurnId},message:r.message}),na(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 yE(t,r){if(r.pending.resolveOutcome({kind:"rejected",message:r.message}),na(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 vE(t,r,i){const l=qs({pending:i.pending,sessionId:t.sessionId,sessionGeneration:t.sessionGeneration,submitGeneration:t.submitGeneration});if(r.kind==="accepted"){if(pE(t,{turnId:r.turnId,assistantId:i.assistantId,pending:i.pending,sessionId:i.sessionId,ui:i.acceptedUi})){const d=$s(t,r.turnId);d&&i.onAutoAbort?.(d)}return}if(r.kind==="adopt-active"){const o=l?$s(t,r.activeTurn.turnId):null;gE(t,{activeTurnId:r.activeTurn.turnId,message:r.message,assistantId:i.assistantId,text:i.text,images:i.images,pending:i.pending,current:l,notice:i.notice,ui:i.adoptUi}),o&&i.onAutoAbort?.(o);return}if(r.kind==="rejected"){yE(t,{message:r.message,assistantId:i.assistantId,text:i.text,images:i.images,pending:i.pending,current:l,ui:i.rejectedUi}),Gs(t);return}if(r.kind==="stale"){i.pending.resolveOutcome(r),na(t,i.pending.clientRequestId),Gs(t);return}i.pending.resolveOutcome(r)}function bE(t,r,i,l){const o=t.pendingSubmission;if(!o)return"held";if(r.action==="bind-active"){const u=!!o.acceptedTurnId;u||(o.acceptedTurnId=r.turnId,t.activeTurnId=r.turnId,t.turnAssistantIds.set(r.turnId,o.assistantId),t.streaming=!0,t.submitInFlight=!1);const h=$s(t,r.turnId);return h&&l?.onAutoAbort?.(h),u?"held":"bound"}if(r.action==="release-terminal"||r.action==="release-not-accepted")return r.action==="release-terminal"&&t.settledTurnIds.add(r.turnId),na(t,o.clientRequestId),Gs(t),Us(i)||(t.streaming=!1,t.activeTurnId=null,t.assistantId=null,t.stoppingTurnId=null,l?.markIdle?.()),"released";const d=i?.activeTurn?.turnId??i?.activeTurnId??null;return d&&(t.activeTurnId=d),"held"}const xE="正在停止…",SE="正在停止…",kE="停止请求未完成,正在与服务端对账…",wE="停止请求失败,正在与服务端对账…";function Qg(t){t.showNotice(xE)}function Zg(t){if(t.networkError)return{action:"keep-busy-notice",message:wE};const r=t.body.turn?.state;return t.body.accepted===!0&&ti(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:kE}}function Gc(t,r,i,l){const o=l?.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,l?.markIdle?.();return}if(r.action==="abort-pending-notice"){i.showNotice(SE);return}if(r.action==="owner-lost-reconcile"){if(!o)return;l?.runtimeBusy||(t.stoppingTurnId&&t.settledTurnIds.add(t.stoppingTurnId),t.streaming=!1,t.activeTurnId=null,t.assistantId=null,t.stoppingTurnId=null,l?.markIdle?.());return}if(r.action==="keep-busy-notice"){i.showNotice(r.message);return}}function Jg(t,r){_v(t);const i=t.activeTurnId??t.pendingSubmission?.acceptedTurnId??null;if(i){const l=$s(t,i);return l?(r.notice&&Qg(r.notice),r.postAbort(l),{abortedTurnId:l,stopRequested:!0}):{abortedTurnId:null,stopRequested:!0}}return r.notice&&Qg(r.notice),{abortedTurnId:null,stopRequested:!0}}function Wn(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 In(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 CE(t){return t.split(`
|
|
48
|
-
`).find(r=>r.startsWith("event: "))?.slice(7).trim()??"message"}function jE(){return new Promise(t=>window.setTimeout(t,25))}function $c(t,r){r&&t(i=>i.filter(l=>!(l.id===r&&l.role==="assistant"&&!l.text.trim())))}function RE(t){const{origin:r,refs:i,session:l,thread:o,composer:d,setError:u,setAutoScroll:h,setNotice:g,recoveryVersion:p=0,watchSessionTitle:v}=t,{applySseBlock:y,setMessages:S,setStreaming:x,setStreamingAssistantId:w,streaming:I}=o,{setInput:H,setPendingImages:T}=d,N=k.useCallback(B=>{g&&g({id:Date.now(),message:B})},[g]),A=k.useCallback(B=>{const O=Wn(i);na(O,B),In(i,O)},[i]),G=k.useCallback((B,O,U)=>{i.sessionRef.current?.sessionId!==B||i.sessionGenerationRef.current!==O||(i.streamingRef.current=!1,i.activeTurnIdRef.current=null,i.assistantIdRef.current=null,i.stoppingTurnIdRef.current=null,x(!1),w(null),$c(S,U))},[i,x,w,S]),K=k.useCallback(async(B,O,U)=>{for(;!U.aborted;){const _=i.eventsStreamStateRef.current;if(!_||_.sessionId!==B||_.generation!==O)return;_.ready=!1;try{const W={Accept:"text/event-stream"},R=i.lastEventIdRef.current;R&&(W["Last-Event-ID"]=R);const D=await fetch(dE(r,B),{headers:W,credentials:"include",signal:U});if(!D.ok||!D.body){if(D.status===404)return;await kc(2e3,U);continue}const M=D.body.getReader(),C=new TextDecoder;let ie="",de=!0;const Y=Wr("a");for(;;){const{done:he,value:pe}=await M.read();if(he)break;ie+=C.decode(pe,{stream:!0});const ye=ie.split(`
|
|
49
|
-
|
|
50
|
-
`);ie=ye.pop()??"";for(const je of ye){if(CE(je)==="stream_ready"){const Ke=i.eventsStreamStateRef.current;Ke?.sessionId===B&&Ke.generation===O&&(Ke.ready=!0),de=!1;continue}const ze=i.assistantIdRef.current??Y,Ye=y(je,ze,{replay:de,targetSessionId:B,generation:O});Ye&&(i.lastEventIdRef.current=Ye)}}const ce=i.eventsStreamStateRef.current;ce?.sessionId===B&&ce.generation===O&&(ce.ready=!1),await kc(1e3,U)}catch{if(U.aborted)return;await kc(2e3,U)}}},[r,i,y]),E=k.useCallback((B,O)=>{const U=i.eventsStreamStateRef.current;if(U?.sessionId===B&&U.generation===O&&i.reconnectAbortRef.current)return;i.reconnectAbortRef.current?.abort();const _=new AbortController;i.reconnectAbortRef.current=_,i.eventsStreamStateRef.current={sessionId:B,generation:O,ready:!1},K(B,O,_.signal)},[i,K]),$=k.useCallback(async(B,O)=>{E(B,O);const U=Date.now()+5e3;for(;Date.now()<U;){const _=i.eventsStreamStateRef.current;if(_?.sessionId===B&&_.generation===O&&_.ready)return;if(i.sessionRef.current?.sessionId!==B||i.sessionGenerationRef.current!==O)throw new Error("会话已切换");await jE()}throw new Error("事件连接未就绪,请检查 Console 连接后重试")},[i,E]),te=k.useCallback(async B=>{try{const O=await fetch(Kg(r,B),{credentials:"include"}),U=await O.json().catch(()=>({}));return O.ok?U.state??null:null}catch{return null}},[r]),se=k.useCallback(async B=>{try{const O=await fetch(cE(r,B.sessionId),{method:"POST",headers:{"Content-Type":"application/json","x-loop-console-confirmation":Xt()},credentials:"include",body:JSON.stringify({clientRequestId:B.clientRequestId,text:B.text.trim()||"请查看附件图片。",images:B.images.map(({type:_,mimeType:W,data:R})=>({type:_,mimeType:W,data:R}))})}),U=await O.json().catch(()=>({}));return{httpOk:O.ok,status:O.status,body:U}}catch{return{httpOk:!1,status:0,body:{},networkError:!0}}},[r]),z=k.useCallback(()=>({showNotice:N,setError:B=>u(B)}),[N,u]),V=k.useCallback(async(B,O,U)=>{i.stoppingTurnIdRef.current=U,i.streamingRef.current=!0,x(!0);try{const _=await fetch(fE(r,B,U),{method:"POST",headers:{"Content-Type":"application/json","x-loop-console-confirmation":Xt()},credentials:"include",body:"{}"}),W=await _.json().catch(()=>({}));if(i.sessionRef.current?.sessionId!==B||i.sessionGenerationRef.current!==O||i.stoppingTurnIdRef.current!==U)return;const R=Zg({httpOk:_.ok,turnId:U,body:W}),D=Wn(i);if(D.stoppingTurnId=U,R.action==="owner-lost-reconcile"){const M=await te(B),C=i.sessionRef.current?.sessionId===B&&i.sessionGenerationRef.current===O;Gc(D,R,z(),{sessionStillCurrent:C,runtimeBusy:Us(M??void 0),markIdle:()=>G(B,O,i.assistantIdRef.current)}),In(i,D);return}Gc(D,R,z(),{sessionStillCurrent:!0,markIdle:()=>G(B,O,i.assistantIdRef.current)}),In(i,D)}catch{const _=Wn(i);Gc(_,Zg({httpOk:!1,turnId:U,body:{},networkError:!0}),z()),In(i,_)}},[r,i,x,G,te,z]),F=k.useCallback((B,O)=>{const U=Wn(i);U.sessionId=i.sessionRef.current?.sessionId??null,U.sessionGeneration=i.sessionGenerationRef.current,U.submitGeneration=i.submitGenerationRef.current;const _=W=>{T(W)};vE(U,B,{assistantId:O.assistantId,text:O.text,images:O.images,pending:O.pending,sessionId:O.sessionId,notice:z(),acceptedUi:{setStreaming:x,setStreamingAssistantId:w,setPendingImages:_,watchSessionTitle:v},adoptUi:{clearEmptyAssistant:W=>$c(S,W),setInput:H,setPendingImages:_,setStreaming:x,setStreamingAssistantId:w},rejectedUi:{setError:u,setStreaming:x,setStreamingAssistantId:w,clearEmptyAssistant:W=>$c(S,W),setInput:H,setPendingImages:_,formatError:Ki},onAutoAbort:W=>{V(O.sessionId,O.generation,W)}}),In(i,U)},[i,z,x,w,T,v,S,H,u,V]),le=k.useCallback(async(B,O)=>{const U=i.sessionRef.current,_=i.sessionGenerationRef.current;if(!U||!B.trim()&&O.length===0||i.streamingRef.current||i.submitInFlightRef.current||i.pendingSubmissionRef.current)return;i.submitInFlightRef.current=!0;const W=++i.submitGenerationRef.current,R=Wr("chat-submit"),D=Wr("u"),M=Wr("a"),C=B.trim(),ie=O.slice(),de=lE({clientRequestId:R,submitGeneration:W,sessionId:U.sessionId,sessionGeneration:_,text:C,images:ie,assistantId:M,userMessageId:D});i.pendingSubmissionRef.current=de;try{await $(U.sessionId,_)}catch(ye){i.sessionRef.current?.sessionId===U.sessionId&&i.sessionGenerationRef.current===_&&u(Ki(ye instanceof Error?ye.message:String(ye))),A(R);return}if(i.sessionRef.current?.sessionId!==U.sessionId||i.sessionGenerationRef.current!==_){A(R);return}const Y={id:D,role:"user",text:C,createdAt:Date.now()};S(ye=>[...ye,Y,{id:M,role:"assistant",text:"",createdAt:Date.now()}]),H(""),h(!0),u(null),i.streamingRef.current=!0,i.assistantIdRef.current=M,x(!0),w(M);const ce={sessionId:U.sessionId,generation:_,submitGeneration:W,assistantId:M,text:C,images:ie,pending:de},he=await se({sessionId:U.sessionId,clientRequestId:R,text:C,images:ie});if(!qs({pending:de,sessionId:i.sessionRef.current?.sessionId,sessionGeneration:i.sessionGenerationRef.current,submitGeneration:i.submitGenerationRef.current})){de.resolveOutcome({kind:"stale"}),A(R);return}let pe=he.networkError?Pg():Yg({httpOk:he.httpOk,status:he.status,body:he.body,clientRequestId:R});if(pe.kind==="ambiguous"){const ye=await te(U.sessionId),je=ye?oE({clientRequestId:R,state:ye}):null;if(je)pe=je;else{const ze=await se({sessionId:U.sessionId,clientRequestId:R,text:C,images:ie});if(!qs({pending:de,sessionId:i.sessionRef.current?.sessionId,sessionGeneration:i.sessionGenerationRef.current,submitGeneration:i.submitGenerationRef.current})){de.resolveOutcome({kind:"stale"}),A(R);return}if(pe=ze.networkError?Pg("无法确认 Turn 是否已创建,正在与服务端对账(不会重复提交新的请求 ID)"):Yg({httpOk:ze.httpOk,status:ze.status,body:ze.body,clientRequestId:R}),pe.kind==="ambiguous"){const Ye=pe.message||"无法确认 Turn 是否已创建,正在与服务端对账(不会重复提交新的请求 ID)";pe=sE(Ye),N(Ye)}}}F(pe,ce)},[r,i,$,se,te,F,A,N,S,H,h,u,x,w]),X=k.useCallback(async()=>{const B=i.sessionRef.current?.sessionId,O=i.sessionGenerationRef.current;if(!B)return;const U=Wn(i),_=Jg(U,{postAbort:()=>{},notice:z()});if(In(i,U),_.abortedTurnId){if(i.stopInFlightRef.current)return;i.stopInFlightRef.current=!0;try{await V(B,O,_.abortedTurnId)}finally{i.stopInFlightRef.current=!1}return}const W=i.pendingSubmissionRef.current;if(W&&!i.stopInFlightRef.current){i.stopInFlightRef.current=!0;try{const R=await W.outcomePromise;if(i.sessionRef.current?.sessionId!==B||i.sessionGenerationRef.current!==O)return;let D=null;if(R.kind==="accepted")D=R.turnId;else if(R.kind==="adopt-active")D=R.activeTurn.turnId;else{if(R.kind==="ambiguous")return;i.stopRequestedRef.current=!1;return}if(!D)return;const M=Wn(i);_v(M);const C=Jg(M,{postAbort:()=>{},notice:z()});In(i,M),C.abortedTurnId&&await V(B,O,C.abortedTurnId)}finally{i.stopInFlightRef.current=!1}}},[i,z,V]);return k.useEffect(()=>{const B=!!i.pendingSubmissionRef.current||i.submitInFlightRef.current||i.stopRequestedRef.current||!!i.activeTurnIdRef.current;if(!l||!I&&!B)return;const O=l.sessionId,U=i.sessionGenerationRef.current;let _=!1;const W=async()=>{try{const C=await fetch(Kg(r,O),{credentials:"include"}),ie=await C.json().catch(()=>({}));if(_||!C.ok||i.sessionRef.current?.sessionId!==O||i.sessionGenerationRef.current!==U)return;const de=ie.state,Y=i.pendingSubmissionRef.current;if(Y){const ze=uE({clientRequestId:Y.clientRequestId,state:de}),Ye=Wn(i),Ke=bE(Ye,ze,de,{markIdle:()=>G(O,U,i.assistantIdRef.current),onAutoAbort:lt=>{V(O,U,lt)}});if(In(i,Ye),Ke==="bound"){x(!0);return}if(Ke==="released"||!Y.acceptedTurnId&&!Ye.pendingSubmission?.acceptedTurnId)return}const ce=de?.activeTurn?.turnId??de?.activeTurnId??null;i.activeTurnIdRef.current=ce;const he=Us(de),pe=i.pendingSubmissionRef.current;if(pe){const ze=de?.latestTurn?.clientRequestId===pe.clientRequestId&&ti(de?.latestTurn?.state),Ye=de?.activeTurn?.clientRequestId===pe.clientRequestId&&ti(de?.activeTurn?.state);if(ze||Ye){const Ke=Ye?de?.activeTurn?.turnId??null:de?.latestTurn?.turnId??pe.acceptedTurnId??null,lt=Wn(i);Xg(lt,{clientRequestId:pe.clientRequestId,turnId:Ke,markIdle:!he}),In(i,lt),he||G(O,U,i.assistantIdRef.current);return}}if(he)return;const ye=i.assistantIdRef.current;if(ce&&!(ti(de?.activeTurn?.state)||ti(de?.activeTurnState)))return;ce&&i.settledTurnIdsRef.current.add(ce);const je=pe?.clientRequestId;if(je){const ze=Wn(i);Xg(ze,{clientRequestId:je,turnId:ce,markIdle:!0}),In(i,ze)}else A();G(O,U,ye)}catch{}},R=()=>{document.visibilityState==="visible"&&W()},D=()=>{W()},M=window.setInterval(()=>{W()},15e3);return document.addEventListener("visibilitychange",R),window.addEventListener("online",D),W(),()=>{_=!0,window.clearInterval(M),document.removeEventListener("visibilitychange",R),window.removeEventListener("online",D)}},[r,i,l,I,G,A,V]),k.useEffect(()=>{if(!l)return;const B=i.sessionGenerationRef.current;return E(l.sessionId,B),()=>{const O=i.eventsStreamStateRef.current;O?.sessionId===l.sessionId&&O.generation===B&&(i.reconnectAbortRef.current?.abort(),i.reconnectAbortRef.current=null,i.eventsStreamStateRef.current=null)}},[l,p,i,E]),{sendPrompt:le,handleStop:X,openEventsStream:K}}function TE(t){const{origin:r,refs:i,thread:l,setError:o}=t,{interview:d,setInterview:u}=l,[h,g]=k.useState(""),p=k.useCallback(async()=>{const S=i.sessionRef.current;if(!S)return;const x=window.prompt("Task ID(例如 2026-07-26-my-task)")?.trim();if(!x)return;const w=await fetch(`${r}/api/operator/v1/chat/sessions/${S.sessionId}/interviews`,{method:"POST",headers:{"Content-Type":"application/json","x-loop-console-confirmation":Xt()},credentials:"include",body:JSON.stringify({taskId:x})}),I=await w.json();if(!w.ok){o(I.error?.message??`HTTP ${w.status}`);return}u({interviewSessionId:I.interview?.sessionId,taskId:x,state:I.interview?.state,question:I.question,draft:I.draft?.draft,draftSha256:I.draft?.draftSha256,assessment:I.assessment})},[r,i,u,o]),v=k.useCallback(async S=>{const x=i.sessionRef.current;if(!x||!d?.interviewSessionId||!d.question)return;const w=await fetch(`${r}/api/operator/v1/chat/sessions/${x.sessionId}/interviews/${d.interviewSessionId}/answers`,{method:"POST",headers:{"Content-Type":"application/json","x-loop-console-confirmation":Xt()},credentials:"include",body:JSON.stringify({questionId:d.question.id,response:S,...S==="override"?{text:h}:{}})}),I=await w.json();if(!w.ok){o(I.error?.message??`HTTP ${w.status}`);return}u(H=>({...H??{},state:I.interview?.state,question:I.question,draft:I.draft?.draft,draftSha256:I.draft?.draftSha256,assessment:I.assessment,taskKindRecommendation:I.taskKindRecommendation??H?.taskKindRecommendation})),g("")},[r,i,d,h,u,o]),y=k.useCallback(async()=>{const S=i.sessionRef.current;if(!S||!d?.interviewSessionId||!d.taskKindRecommendation)return;const x=await fetch(`${r}/api/operator/v1/chat/sessions/${S.sessionId}/interviews/${d.interviewSessionId}/task-kind/confirm`,{method:"POST",headers:{"Content-Type":"application/json","x-loop-console-confirmation":Xt()},credentials:"include",body:JSON.stringify({taskKind:d.taskKindRecommendation})}),w=await x.json();if(!x.ok){o(w.error?.message??`HTTP ${x.status}`);return}u(I=>({...I??{},confirmedTaskKind:I?.taskKindRecommendation,taskKindRecommendation:void 0,draft:w.draft?.draft,draftSha256:w.draft?.draftSha256,assessment:w.assessment}))},[r,i,d,u,o]);return{interviewAnswer:h,setInterviewAnswer:g,startInterview:p,answerInterview:v,confirmTaskKind:y}}function EE(t){const{origin:r,refs:i,sessionId:l,setError:o}=t,[d,u]=k.useState({}),[h,g]=k.useState(new Set),[p,v]=k.useState(null),[y,S]=k.useState([]),[x,w]=k.useState(null),[I,H]=k.useState(!1),T=k.useCallback(async(K="")=>{try{v(null);const E=await fetch(`${r}/api/operator/v1/chat/repo/tree?path=${encodeURIComponent(K)}`,{credentials:"include"}),$=await E.json();if(!E.ok)throw new Error($.error?.message??"无法读取仓库目录");u(te=>({...te,[K]:$.data?.entries??[]}))}catch(E){v(E instanceof Error?E.message:String(E))}},[r]);k.useEffect(()=>{T()},[T]);const N=k.useCallback(async K=>{H(!0);try{const E=await fetch(`${r}/api/operator/v1/chat/repo/file?path=${encodeURIComponent(K)}`,{credentials:"include"}),$=await E.json();if(!E.ok||!$.data)throw new Error($.error?.message??"无法预览文件");S(te=>{const se=[...te.filter(V=>V.path!==$.data.path),$.data],z=i.sessionRef.current?.sessionId;return z&&window.localStorage.setItem(`${wn}.previews.${z}`,JSON.stringify(se.map(V=>V.path))),se}),w($.data.path)}catch(E){o(E instanceof Error?E.message:String(E))}finally{H(!1)}},[r,i,o]);k.useEffect(()=>{if(!l)return;let K=[];try{const E=JSON.parse(window.localStorage.getItem(`${wn}.previews.${l}`)??"[]");Array.isArray(E)&&(K=E.filter($=>typeof $=="string").slice(0,10))}catch{}K.length&&Promise.all(K.map(async E=>{const $=await fetch(`${r}/api/operator/v1/chat/repo/file?path=${encodeURIComponent(E)}`,{credentials:"include"});if($.ok)return(await $.json()).data})).then(E=>{if(i.sessionRef.current?.sessionId!==l)return;const $=E.filter(te=>!!te);S($),w($.at(-1)?.path??null)})},[r,l,i]);const A=k.useCallback(K=>{g(E=>{const $=new Set(E);return $.has(K)?$.delete(K):$.add(K),$}),d[K]||T(K)},[d,T]),G=k.useCallback(K=>{S(E=>{const $=E.filter(te=>te.path!==K);return l&&window.localStorage.setItem(`${wn}.previews.${l}`,JSON.stringify($.map(te=>te.path))),$}),w(E=>E===K?y.find($=>$.path!==K)?.path??null:E)},[y,l]);return{tree:d,expandedDirs:h,treeError:p,previews:y,activePreviewPath:x,setActivePreviewPath:w,previewLoading:I,setPreviews:S,loadTree:T,openPreview:N,closePreview:G,toggleDir:A}}function NE(t){const{origin:r,sessionId:i,refs:l,setError:o}=t,[d,u]=k.useState(""),[h,g]=k.useState([]),[p,v]=k.useState([]),[y,S]=k.useState(!1),x=k.useCallback(M=>{if(typeof M=="function"){u(C=>{const ie=M(C);return S(ie.startsWith("/")),ie});return}u(M),S(M.startsWith("/"))},[]),[w,I]=k.useState(0),[H,T]=k.useState([]),[N,A]=k.useState(!1),[G,K]=k.useState(null),[E,$]=k.useState(0),te=k.useRef(null),se=k.useRef(void 0),z=k.useCallback(M=>{x(M),S(M.startsWith("/")),I(0)},[]),V=k.useCallback(async()=>{if(!i){T([]),K(null),A(!1);return}const M=i;se.current=M,A(!0),K(null);try{const C=await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(M)}/commands`,{credentials:"include"});if(se.current!==M)return;if(!C.ok){K("动态命令加载失败"),T([]);return}const ie=await C.json().catch(()=>null),de=[];for(const Y of ie?.commands??[]){const ce=Y.source;if(ce!=="extension"&&ce!=="prompt"&&ce!=="skill")continue;const he=String(Y.command??Y.name??"").trim();he&&de.push({command:he.startsWith("/")?he:`/${he}`,label:String(Y.label??Y.name??he),description:String(Y.description??""),source:ce})}if(se.current!==M)return;T(de)}catch{if(se.current!==M)return;K("动态命令加载失败"),T([])}finally{se.current===M&&A(!1)}},[r,i]);k.useEffect(()=>{T([]),K(null),i&&(!y&&E===0||V())},[i,y,E,V]);const F=k.useCallback(()=>{$(M=>M+1),V()},[V]);k.useEffect(()=>{if(!i)return;const M=d.slice(0,te.current?.selectionStart??d.length).match(/(?:^|\s)@([^\s@]*)$/);if(!M){g([]);return}const C=window.setTimeout(()=>{fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(i)}/files?q=${encodeURIComponent(M[1]??"")}`).then(ie=>ie.ok?ie.json():null).then(ie=>g((ie?.files??[]).map(de=>de.path)))},150);return()=>window.clearTimeout(C)},[r,i,d]);const le=k.useCallback(M=>{const C=te.current?.selectionStart??d.length,de=d.slice(0,C).search(/@[^\s@]*$/);de<0||(x(`${d.slice(0,de)}@${M} ${d.slice(C)}`),g([]))},[d]),X=k.useCallback(M=>{for(const C of Array.from(M).slice(0,4)){if(!C.type.startsWith("image/")||C.size>5*1024*1024){o("图片仅支持 PNG/JPEG/GIF/WebP,单张不超过 5 MiB");continue}const ie=new FileReader;ie.onload=()=>{const de=String(ie.result??""),Y=de.slice(de.indexOf(",")+1);v(ce=>[...ce,{name:C.name,type:"image",mimeType:C.type,data:Y}].slice(0,4))},ie.readAsDataURL(C)}},[o]),B=k.useCallback(M=>{v(C=>C.filter(ie=>ie!==M))},[]);k.useLayoutEffect(()=>{const M=te.current;M&&(M.style.height="auto",M.style.height=`${Math.min(M.scrollHeight,280)}px`)},[d]),k.useEffect(()=>{if(!i)return;const M=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":Xt()},body:JSON.stringify({text:d})})},400);return()=>window.clearTimeout(M)},[r,i,d]);const O=k.useMemo(()=>jS(H),[H]),U=k.useMemo(()=>d.startsWith("/")?RS(O,d):[],[d,O]),_=k.useCallback(()=>{l.isComposingRef.current=!0},[l]),W=k.useCallback(()=>{l.isComposingRef.current=!1,l.compositionEndedAtRef.current=Date.now()},[l]),R=k.useCallback(()=>l.isComposingRef.current,[l]),D=k.useCallback(()=>Date.now()-l.compositionEndedAtRef.current<100,[l]);return k.useEffect(()=>{Q1({origin:r,sessionId:i,refs:l})},[r,i,l]),{input:d,setInput:x,handleInputChange:z,fileOptions:h,pendingImages:p,setPendingImages:v,addImagesFromFiles:X,removeImage:B,shortcutOpen:y,setShortcutOpen:S,shortcutIndex:w,setShortcutIndex:I,filteredShortcuts:U,dynamicCommandsLoading:N,dynamicCommandsError:G,retryDynamicCommands:F,insertFileReference:le,textareaRef:te,onCompositionStart:_,onCompositionEnd:W,isComposingNow:R,recentlyComposedNow:D}}const AE=[{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 IE(t){if(!t)return null;const r=(t.tools??[]).map(l=>({toolId:l.toolId,action:l.action,description:l.description,kind:l.kind??"read",cli:l.cli})),i=[...AE];return{explore:i,operator:r,total:i.length+r.length}}let DE=0;function OE(t){const{origin:r,session:i,setSession:l,refs:o,setError:d}=t,[u,h]=k.useState(null),[g,p]=k.useState([]),[v,y]=k.useState("idle"),[S,x]=k.useState(null),[w,I]=k.useState([]),[H,T]=k.useState(null),[N,A]=k.useState(null),[G,K]=k.useState(!1),[E,$]=k.useState(!1),[te,se]=k.useState(!1),z=k.useRef(null),V=k.useRef(null),F=k.useRef(0);k.useEffect(()=>{F.current=-1,K(!1)},[i?.sessionId,K]);const X=Wi().snapshot,B=k.useCallback(async()=>{try{const Y=await fetch(`${r}/api/operator/v1/chat/capabilities`);if(!Y.ok)return;const ce=await Y.json();h(ce)}catch{}},[r]);k.useEffect(()=>{B()},[B]);const O=k.useCallback(async()=>{if(!i){p([]),y("idle");return}const Y=i.sessionId;y("loading"),x(null);try{const ce=await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(Y)}/models`,{credentials:"include"}),he=await ce.json().catch(()=>null);if(o.sessionRef.current?.sessionId!==Y)return;if(!ce.ok||!he){y("error"),x(he?.error?.message??`模型列表读取失败(HTTP ${ce.status})`);return}p(he.models??[]),I(he.thinkingLevels??[]),y("ready")}catch(ce){if(o.sessionRef.current?.sessionId!==Y)return;y("error"),x(ce instanceof Error?ce.message:String(ce))}},[r,i,o]);k.useEffect(()=>{O()},[O]),k.useEffect(()=>{if(!i){T(null),A(null);return}const Y=i.sessionId,ce=`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(Y)}`;A(null),fetch(`${ce}/runtime-context`,{credentials:"include"}).then(async he=>{const pe=await he.json().catch(()=>null);if(!pe?.context||o.sessionRef.current?.sessionId!==Y)return;const ye=pe.context,je=W1().snapshot;T(ze=>K1(ze,ye,je,Y))}).catch(()=>{o.sessionRef.current?.sessionId===Y&&A("注入上下文读取失败,请重试")})},[r,i?.sessionId,o]),k.useEffect(()=>{if(!X||!i||X.sessionId!==i.sessionId)return;const Y=dy(X);l(ce=>{if(!ce||ce.sessionId!==X.sessionId||_T(ce,Y))return ce;const he=zv(ce,Y);return o.sessionRef.current=he,he}),T(ce=>{if(!ce)return ce;const he={...ce,...Y.model?{model:Y.model}:{},...Y.thinkingLevel?{thinkingLevel:Y.thinkingLevel}:{}};return he.model?.provider===ce.model?.provider&&he.model?.modelId===ce.model?.modelId&&he.thinkingLevel===ce.thinkingLevel?ce:he})},[X,i?.sessionId,o,l,T]);const U=k.useCallback(async Y=>{if(!i)return!1;const ce=i.sessionId,he=++DE;F.current=he,my({type:"mutation-start",token:he}),K(!0);try{const pe=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":Xt()},body:JSON.stringify(Y)}),ye=await pe.json().catch(()=>({}));return F.current!==he?!1:pe.ok?!ye.session||o.sessionRef.current?.sessionId!==ce?!1:Z1(he,ce,ye.snapshot):(o.sessionRef.current?.sessionId===ce&&(d(ye.error?.message??`模型或思考等级切换失败(HTTP ${pe.status})`),Zi()),!1)}catch(pe){return F.current!==he||o.sessionRef.current?.sessionId===ce&&d(pe instanceof Error?pe.message:String(pe)),!1}finally{J1(he,ce,o)&&F.current===he&&K(!1)}},[r,i,o,l,d]);k.useEffect(()=>{if(!E)return;const Y=he=>{const pe=z.current;pe&&he.target instanceof Node&&!pe.contains(he.target)&&$(!1)},ce=he=>{he.key==="Escape"&&$(!1)};return document.addEventListener("mousedown",Y),document.addEventListener("keydown",ce),()=>{document.removeEventListener("mousedown",Y),document.removeEventListener("keydown",ce)}},[E]),k.useEffect(()=>{if(!te)return;const Y=he=>{const pe=V.current;pe&&he.target instanceof Node&&!pe.contains(he.target)&&se(!1)},ce=he=>{he.key==="Escape"&&se(!1)};return document.addEventListener("mousedown",Y),document.addEventListener("keydown",ce),()=>{document.removeEventListener("mousedown",Y),document.removeEventListener("keydown",ce)}},[te]);const _=k.useMemo(()=>IE(u),[u]),W=X?(X.models??[]).map(Y=>({provider:Y.provider,id:Y.id,...Y.name?{name:Y.name}:{},...Y.hasCredentials!==void 0?{hasCredentials:Y.hasCredentials}:{}})):g,R=X?.thinkingLevels?.length?X.thinkingLevels.map(Y=>Y.value):w,D=i?.model??H?.model,M=D?Hs(D.provider,D.modelId):"",C=X?.selection?.thinkingSelection??i?.thinkingLevel??"",ie=X?.selection?.effectiveThinkingLevel??i?.thinkingLevel??void 0,de=!M||W.some(Y=>Hs(Y.provider,Y.id)===M);return{capabilities:u,models:W,modelsStatus:v,modelsError:S,onRetryModels:()=>{O()},thinkingLevels:R,runtimeContext:H,runtimeContextError:N,onRetryRuntimeContext:()=>{A(null),Zi()},toolsOpen:E,setToolsOpen:$,runtimeContextOpen:te,setRuntimeContextOpen:se,toolsMenuRef:z,runtimeContextMenuRef:V,switchRuntime:U,switching:G,toolCatalog:_,activeModel:D,activeModelRef:M,activeThinkingLevel:C,effectiveThinkingLevel:ie,activeModelListed:de}}const Wg={comfortableMin:1450,compactMin:1100};function ME(t){return!Number.isFinite(t)||t<0?"narrow":t>=Wg.comfortableMin?"comfortable":t>=Wg.compactMin?"compact":"narrow"}function zE(t){return t==="compact"||t==="narrow"}const _E={mode:"comfortable",width:1600,landingDensity:"comfortable",emptyHeight:720};function LE(t,r){const[i,l]=k.useState(_E);return k.useEffect(()=>{const o=t.current;if(!o||typeof ResizeObserver>"u")return;const d=()=>{const v=o.getBoundingClientRect().width,y=r?.current??null,S=y?y.getBoundingClientRect().height:720;l({mode:ME(v),width:v,landingDensity:ES(S),emptyHeight:S})};d();const u=new ResizeObserver(()=>d());u.observe(o);let h=null;const g=()=>{const v=r?.current??null;v&&v!==h&&(h&&u.unobserve(h),u.observe(v),h=v,d())};g();const p=window.setInterval(g,250);return()=>{window.clearInterval(p),u.disconnect()}},[t,r]),i}function BE(t="none"){return{active:t}}function el(t,r){return{active:r}}function Nr(t={active:"none"}){return{active:"none"}}function HE(t){return{sidebarDrawerOpen:t.active==="sidebar-drawer",processOpen:t.active==="process",runtimeContextOpen:t.active==="runtime-context",toolsOpen:t.active==="tools"}}function UE(t){const{origin:r,surface:i="standalone"}=t,l=i==="workspace",o=PT(),[d,u]=k.useState(null),[h,g]=k.useState(null),[p,v]=k.useState(!0),[y,S]=k.useState(!0),[x,w]=k.useState(()=>BE()),[I,H]=k.useState(null),[T,N]=k.useState(0),A=k.useRef(null),G=k.useRef(null),K=k.useRef(null),E=k.useRef(null),$=k.useRef(null),te=k.useRef(null),se=k.useRef(null),z=k.useRef(()=>{}),V=LE(K,E),F=V.mode,le=HE(x),X=le.processOpen,B=zE(F)&&X,O=le.runtimeContextOpen;k.useEffect(()=>{F==="comfortable"&&x.active==="sidebar-drawer"&&w(ee=>ee.active==="sidebar-drawer"?Nr(ee):ee)},[F,x.active]);const U=k.useCallback(ee=>{w(Se=>{const re=Se.active==="process";return(typeof ee=="function"?ee(re):ee)?el(Se,"process"):Se.active==="process"?Nr(Se):Se})},[]),_=NE({origin:r,sessionId:h?.sessionId,refs:o,setError:u}),W=EE({origin:r,refs:o,sessionId:h?.sessionId,setError:u}),R=k.useRef(()=>{}),D=k.useCallback(ee=>{R.current(ee)},[]),M=tE({origin:r,refs:o,sessionId:h?.sessionId,setError:u,onReconcile:D});R.current=ee=>{const Se=o.sessionRef.current?.sessionId;Se&&(async()=>await M.recoverSession(Se)?(H({id:Date.now(),message:"已自动恢复:会话事件已重新同步,可继续对话。"}),N(fe=>fe+1)):H({id:Date.now(),message:"自动恢复未完成,将在重连时重试。"}))()};const C=aE({origin:r,refs:o,setSession:g,thread:M,composer:{setInput:_.setInput,setPendingImages:_.setPendingImages},browser:{setPreviews:W.setPreviews,setActivePreviewPath:W.setActivePreviewPath},setError:u,setProcessOpen:U,setAutoScroll:S}),ie=RE({origin:r,refs:o,session:h,thread:M,composer:{setInput:_.setInput,setPendingImages:_.setPendingImages},setError:u,setNotice:H,setAutoScroll:S,recoveryVersion:T,watchSessionTitle:C.watchSessionTitle}),de=TE({origin:r,refs:o,thread:M,setError:u}),Y=OE({origin:r,session:h,setSession:g,refs:o,setError:u});k.useEffect(()=>{Y.runtimeContextOpen&&x.active!=="runtime-context"?w(ee=>el(ee,"runtime-context")):!Y.runtimeContextOpen&&x.active==="runtime-context"&&w(ee=>Nr(ee))},[Y.runtimeContextOpen,x.active]),k.useEffect(()=>{x.active!=="runtime-context"&&Y.runtimeContextOpen&&Y.setRuntimeContextOpen(!1)},[x.active]);const{sendPrompt:ce,handleStop:he}=ie,pe=k.useCallback(async ee=>{await ce(ee,_.pendingImages)},[ce,_.pendingImages]);z.current=ee=>{pe(ee)};const ye=k.useCallback(()=>{_.textareaRef.current?.focus()},[_.textareaRef]),je=k.useCallback(()=>{w(ee=>ee.active==="sidebar-drawer"?Nr(ee):ee)},[]),ze=k.useCallback(()=>{Y.setRuntimeContextOpen(!1),w(ee=>el(ee,"sidebar-drawer"))},[Y.setRuntimeContextOpen]),Ye=k.useCallback(ee=>{C.activateSession(ee),je(),queueMicrotask(()=>{G.current?.focus?.(),ye()})},[C,je,ye]),Ke=k.useCallback(ee=>{_.setInput(Se=>`${Se}${Se&&!Se.endsWith(" ")?" ":""}@${ee} `),je(),queueMicrotask(()=>ye())},[_,je,ye]),lt=k.useCallback(ee=>{W.openPreview(ee),je()},[W,je]),Zt=k.useCallback(()=>{const ee=G.current;if(!ee)return;const Se=ee.scrollHeight-ee.scrollTop-ee.clientHeight<80;S(Se)},[]);k.useEffect(()=>{y&&A.current?.scrollIntoView({behavior:"smooth",block:"end"})},[M.messages,y,M.streaming]),k.useEffect(()=>{if(!I)return;const ee=window.setTimeout(()=>H(null),6e3);return()=>window.clearTimeout(ee)},[I]);const Tt=k.useCallback(ee=>{const Se=wS(ee),re=ee.trim(),fe=re.split(/\s+/,1)[0]?.toLowerCase()??"";if(_.setInput(""),_.setShortcutOpen(!1),!Se)return;if(Se.action==="focus:interview"){if(!h){H({id:Date.now(),message:"请先创建或打开一个会话,再开始 Interview"});return}de.startInterview();return}const be=CS(Se.action);if(be){t.onNavigateWorkspace?.(be,{});return}if(Se.action==="compact"){C.compactSession();return}if(Se.action==="name"){const Re=re.slice(fe.length).trim(),Te=h?.sessionId;if(!Te){u("当前没有可重命名的会话");return}const st=C.sessionList.find(we=>we.sessionId===Te),yt=Re||window.prompt("会话名称",st?.title??st?.displayTitle??"")||"";yt.trim()&&C.updateSession(Te,{title:yt.trim()});return}if(Se.action==="session"){const Re=h?.sessionId??"(none)",Te=C.sessionList.find(yt=>yt.sessionId===Re),st=Te?.title||Te?.displayTitle||"未命名对话";H({id:Date.now(),message:`当前会话:${st}(${Re})`});return}if(Se.action==="copy"){const Te=[...M.visibleMessages??[]].reverse().find(st=>st.role==="assistant");if(!Te?.text){u("没有可复制的助手消息");return}navigator.clipboard?.writeText(Te.text).then(()=>H({id:Date.now(),message:"已复制最后一条助手消息"}),()=>u("复制失败"));return}if(Se.action==="unknown"){z.current(re);return}u(`未知 shortcut:${Se.command}`)},[_.setInput,_.setShortcutOpen,de.startInterview,t.onNavigateWorkspace,C,h,M.visibleMessages]),jn=k.useCallback(ee=>{if(_.shortcutOpen&&_.filteredShortcuts.length>0&&!ee.nativeEvent.isComposing){if(ee.key==="ArrowDown"||ee.key==="ArrowUp"){ee.preventDefault(),_.setShortcutIndex(fe=>(fe+(ee.key==="ArrowDown"?1:_.filteredShortcuts.length-1))%_.filteredShortcuts.length);return}if(ee.key==="Escape"){ee.preventDefault(),_.setShortcutOpen(!1);return}if(ee.key==="Enter"){ee.preventDefault(),Tt(_.filteredShortcuts[_.shortcutIndex]?.command??_.filteredShortcuts[0].command);return}}const Se=Date.now()-o.compositionEndedAtRef.current<100,re=o.isComposingRef.current||ee.nativeEvent.isComposing;if(ee.key==="Enter"&&!ee.shiftKey&&(re||Se)){Se&&ee.preventDefault();return}if(ee.key==="Enter"&&!ee.shiftKey){ee.preventDefault(),pe(_.input);return}},[_.input,_.shortcutOpen,_.filteredShortcuts,_.shortcutIndex,_.setShortcutIndex,_.setShortcutOpen,o,pe,Tt]),gt=M.visibleMessages.length>0||M.operationCards.length>0||M.humanGateCards.length>0||M.artifactCards.length>0||!!M.interview,Jt=t.readiness==="setup-required"?"⚠ Pi 未就绪(setup-required):Chat 需要先完成 Pi 认证 / 模型配置。":t.readiness==="degraded"?"⚠ Pi 降级(degraded):可继续对话,但部分能力不可用。":null,Ee=c.jsx(xS,{origin:r,open:p,layoutMode:F,drawerOpen:le.sidebarDrawerOpen,activeSessionId:h?.sessionId,sessions:C.sessionList,tree:W.tree,expanded:W.expandedDirs,treeError:W.treeError,onToggleOpen:()=>v(ee=>!ee),onOpenDrawer:ze,onCloseDrawer:je,onCreate:()=>{C.createSession()},creatingSession:C.creatingSession,onActivate:ee=>{le.sidebarDrawerOpen?Ye(ee):C.activateSession(ee)},onRename:(ee,Se)=>{C.updateSession(ee,{title:Se})},onSetState:(ee,Se)=>{C.updateSession(ee,{state:Se})},onDelete:ee=>{C.deleteSession(ee)},onRefreshTree:()=>{W.loadTree()},onToggleDir:W.toggleDir,onInsert:ee=>{le.sidebarDrawerOpen?Ke(ee):_.setInput(Se=>`${Se}${Se&&!Se.endsWith(" ")?" ":""}@${ee} `)},onPreview:ee=>{le.sidebarDrawerOpen?lt(ee):W.openPreview(ee)},drawerTriggerRef:$}),Xe=["oc-workspace",X&&!B?"has-process":"",B?"has-process-overlay":""].filter(Boolean).join(" "),ut=ee=>c.jsx("div",{className:"oc-messages is-empty",ref:E,"data-landing-density":V.landingDensity,children:c.jsx(Sy,{mode:ee,readiness:t.readiness,density:V.landingDensity,onSuggest:async Se=>{C.creatingSession||(ee==="no-session"?await C.createSession()&&await pe(Se):await pe(Se))},disabled:C.creatingSession,onCreateSession:ee==="no-session"?()=>{C.createSession()}:void 0})});return c.jsxs("div",{className:"oc-shell",children:[l?null:c.jsxs("div",{className:"oc-banner",children:[c.jsxs("span",{className:"oc-banner-title",children:[c.jsx("span",{className:"oc-banner-dot","aria-hidden":"true"}),"对话"]}),c.jsxs("span",{className:"oc-banner-body",children:["用自然语言编排 loop-agent / agent-worker 的",c.jsx("strong",{children:"全部能力"}),"。这是 ",c.jsx("strong",{children:"Operator"})," 面:默认具备完整 Pi 工具(read/write/edit/bash/grep/find/ls)与 safe-* 探查、以及受策略约束的 operator action(ADR 0011)。",c.jsx("strong",{children:"软约束"}),":大改与高风险变更优先走受治 DAG 的 implement-pi / repair-pi 与 Human Gate,而非把 Chat 当作第二套 DAG kernel。"]})]}),Jt&&c.jsx("div",{className:"oc-alert oc-alert-warning",children:Jt}),d&&c.jsxs("div",{className:"oc-alert oc-alert-error",children:[c.jsx("strong",{children:"出错了:"}),d]}),I&&c.jsx("div",{className:"oc-alert oc-alert-warning",role:"status",children:I.message}),h?c.jsxs("div",{className:Xe,ref:K,"data-layout-mode":F,children:[Ee,c.jsxs("div",{className:`oc-main${gt?"":" is-landing"}`,children:[F==="narrow"?c.jsx("div",{className:"oc-main-topbar",children:c.jsx("button",{type:"button",className:"oc-main-topbar-btn",ref:$,"aria-label":"打开会话与仓库","aria-expanded":le.sidebarDrawerOpen,onClick:()=>le.sidebarDrawerOpen?je():ze(),children:"会话与仓库"})}):null,c.jsx(kS,{previews:W.previews,activePath:W.activePreviewPath,loading:W.previewLoading,onActivate:W.setActivePreviewPath,onClose:W.closePreview}),gt?c.jsx(IT,{scrollContainerRef:G,messagesEndRef:A,onScroll:Zt,hasThread:gt,readiness:t.readiness,streaming:M.streaming,streamingAssistantId:M.streamingAssistantId,messagesCount:M.messages.length,visibleCount:M.visibleMessages.length,onLoadMore:()=>M.setHistoryLimit(ee=>ee+50),turnGroups:M.turnGroups,interview:M.interview,interviewAnswer:de.interviewAnswer,onInterviewAnswerChange:de.setInterviewAnswer,onAnswerInterview:ee=>{de.answerInterview(ee)},onConfirmTaskKind:()=>{de.confirmTaskKind()},humanGateCards:M.humanGateCards,operationCards:M.operationCards,artifactCards:M.artifactCards,origin:r,sessionId:h.sessionId,onNavigateWorkspace:t.onNavigateWorkspace,onSuggest:ee=>{pe(ee)}}):ut("empty-session"),c.jsx(GT,{composer:_,streaming:M.streaming,hasThread:gt,onSend:ee=>{pe(ee)},onStop:he,onKeyDown:jn,onRunShortcut:Tt,models:Y.models,activeModel:Y.activeModel,activeModelRef:Y.activeModelRef,activeModelListed:Y.activeModelListed,activeThinkingLevel:Y.activeThinkingLevel,thinkingLevels:Y.thinkingLevels,onSwitchRuntime:ee=>{Y.switchRuntime(ee)},usage:M.usage,unread:M.unread,onCompact:()=>{C.compactSession()},processSummary:M.processSummary,processOpen:X,onToggleProcess:()=>{w(ee=>ee.active==="process"?Nr(ee):el(ee,"process")),X||Y.setRuntimeContextOpen(!1)},processTriggerRef:te,runtimeContext:Y.runtimeContext,runtimeContextOpen:O,onToggleRuntimeContext:()=>{O?(Y.setRuntimeContextOpen(!1),w(ee=>ee.active==="runtime-context"?Nr(ee):ee)):(Y.setRuntimeContextOpen(!0),w(ee=>el(ee,"runtime-context")))},runtimeContextTriggerRef:se})]}),O&&Y.runtimeContext?c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:"oc-overlay-backdrop is-runtime-context","aria-label":"关闭注入上下文遮罩",onClick:()=>{Y.setRuntimeContextOpen(!1),w(ee=>ee.active==="runtime-context"?Nr(ee):ee)}}),c.jsx(VT,{panelOnly:!0,open:O,onToggle:()=>{},onClose:()=>{Y.setRuntimeContextOpen(!1),w(ee=>ee.active==="runtime-context"?Nr(ee):ee)},context:Y.runtimeContext,triggerRef:se})]}):null,X&&c.jsxs(c.Fragment,{children:[B?c.jsx("button",{type:"button",className:"oc-overlay-backdrop is-process","aria-label":"关闭工具调用记录遮罩",onClick:()=>U(!1)}):null,c.jsx($T,{toolCalls:M.toolCalls,overlay:B,onClose:()=>U(!1),triggerRef:te})]})]}):c.jsxs("div",{className:Xe,ref:K,"data-layout-mode":F,children:[Ee,c.jsxs("div",{className:"oc-main is-landing",children:[F==="narrow"?c.jsx("div",{className:"oc-main-topbar",children:c.jsx("button",{type:"button",className:"oc-main-topbar-btn",ref:$,"aria-label":"打开会话与仓库","aria-expanded":le.sidebarDrawerOpen,onClick:()=>le.sidebarDrawerOpen?je():ze(),children:"会话与仓库"})}):null,ut("no-session")]})]})]})}function qE(t){return t==="validate"||t==="apply"||t==="spine"?"contract":t}const Lv="X-Loop-Console-Confirmation",Bv="agent-worker console doctor --repo .",ad=[{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)"}],Hv={"setup-required":"需要设置",ready:"已就绪",degraded:"降级可用",unknown:"未知"},GE={idle:"未探测",match:"匹配",mismatch:"仓库不匹配",unavailable:"不可用"},Uv={low:"低",medium:"中",high:"高"},qv={"validation-failed":"校验失败","contract-drift":"契约漂移","runtime-mismatch":"运行时不匹配","pause-on-human":"等待人工","verification-failed":"验证失败","orphan-unknown":"孤立/未知","terminal-failed":"已终止(失败)","terminal-succeeded":"已终止(成功)","needs-reconcile":"需要对账"},$E={idle:"空闲","not-started":"未开始","not-run":"未运行","n/a (MVP)":"不适用(MVP)",accepted:"已接受",succeeded:"已成功",running:"运行中",ran:"已执行"};function Ns(t){return $E[t]??t}function Gv(){return window.__CONSOLE_CONFIRMATION_TOKEN__??""}function Fs(t){return`${t}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}async function Id(t,r={},i){const l={"Content-Type":"application/json",[Lv]:Gv()},o=await fetch("/api/operator/v1/operations",{method:"POST",credentials:"same-origin",headers:l,body:JSON.stringify({action:t,actionParams:r,...i?{clientRequestId:i}:{}})});let d={};try{d=await o.json()}catch{d={ok:!1,error:{code:"INVALID_INPUT",message:"操作响应不是合法 JSON"}}}return{status:o.status,body:d}}const FE=new Set(["runDag","dagRerun","dagReconcileRun","standaloneTaskRerun"]);function Fc(t){const r=(t.blockedReasons??[]).map(String),i=(t.blockingNodes??[]).map(o=>[o.nodeId,o.reasonCode].filter(Boolean).join(":")),l=[...r,...i].filter(Boolean);return l.length===0?"从节点重跑不具备安全资格(子图含 writer / unsafe shell / decision-gate 等)。可改用「完整重跑任务」,或另选只读安全子图的起始节点。":`从节点重跑不具备安全资格:${l.slice(0,6).join("; ")}${l.length>6?"…":""}。可改用「完整重跑任务」。`}async function ey(t,r=9e4){const i=Date.now();for(;Date.now()-i<r;){const l=await fetch(`/api/operator/v1/operations/${encodeURIComponent(t)}`,{credentials:"same-origin"});if(!l.ok)return null;const o=await l.json(),d=o.operation??o,u=d.state??"";if(u==="succeeded"||u==="failed"||u==="needs-reconcile"||u==="timed-out")return d;await new Promise(h=>setTimeout(h,250))}return{state:"needs-reconcile",errorMessage:"等待操作结果超时"}}const VE={};function PE(){const[t,r]=k.useState(()=>jy({env:VE?.VITE_OPERATOR_CHAT_DEFAULT_LANDING,storage:window.localStorage,location:window.location})),[i,l]=k.useState(null),[o,d]=k.useState("setup-required"),[u,h]=k.useState(null),[g,p]=k.useState(null),[v,y]=k.useState(!1),[S,x]=k.useState(!1),[w,I]=k.useState(null),[H,T]=k.useState(null),[N,A]=k.useState(null),[G,K]=k.useState(null),[E,$]=k.useState({command:"idle",dag:"not-started",verification:"not-run",promote:"n/a (MVP)"}),[te,se]=k.useState("setup"),z=k.useCallback(B=>{se(O=>qE(typeof B=="function"?B(O):B))},[]),V=o==="setup-required",F=o==="degraded",le=k.useCallback(B=>{B!==t&&(I(null),A(null),T(null)),r(B)},[t]),X=k.useCallback(async()=>{try{const O=await(await fetch("/api/health")).json();l(O);const U=O.piReadiness??"setup-required";d(U),p(null),z(U==="ready"||U==="degraded"?_=>_==="setup"?"import-prd":_:"setup")}catch(B){p(B instanceof Error?B.message:String(B))}try{const O=await(await fetch("/api/operator/v1/readiness")).json();h(O),O.state&&d(O.state)}catch{}},[z]);return{nav:t,setNav:r,selectNav:le,health:i,readiness:o,setReadiness:d,readinessReport:u,healthError:g,loadHealth:X,busy:v,setBusy:y,observeBusy:S,setObserveBusy:x,opError:w,setOpError:I,opMessage:H,setOpMessage:T,opErrorCode:N,setOpErrorCode:A,lastOpState:G,setLastOpState:K,layers:E,setLayers:$,step:te,setStep:z,setupBlocked:V,degraded:F}}const YE={bootstrapFromPrd:"正在导入 PRD 并创建任务:归档文档 → 确定性解析 → 语义结构化(约 10–60 秒,请勿关闭页面)",importPrd:"正在导入 PRD:归档文档 → 确定性解析 → 语义结构化(约 10–60 秒,请勿关闭页面)",interviewStart:"正在启动需求访谈…",interviewTurn:"正在提交访谈回答…",interviewSkip:"正在跳过访谈并生成评估…",contractValidate:"正在校验契约草稿…",contractDiff:"正在计算契约差异…",contractApply:"正在应用契约(写入需求与执行约束)…",spineCheck:"正在运行 Spine 审计…",dagGenerate:"正在生成 DAG…"};function KE(t){const{shell:r,applyInterviewPayload:i}=t,{setBusy:l,setOpError:o,setOpErrorCode:d,setOpMessage:u,setReadiness:h,setStep:g,setNav:p,setLastOpState:v,setLayers:y,step:S,nav:x}=r,[w,I]=k.useState(null),[H,T]=k.useState([]),[N,A]=k.useState(!0),G=k.useRef(null),[K,E]=k.useState(null),[$,te]=k.useState(null),se=k.useCallback(async(X,B={},O)=>{l(!0),o(null),d(null),u(YE[X]??null);try{const{status:U,body:_}=await Id(X,B,O?.clientRequestId);if(U===412||_.error?.code==="PI_SETUP_REQUIRED")return o(Ki(_.error?.message??"Pi 未就绪或已降级:该操作暂不可用")),d(_.error?.code??"PI_SETUP_REQUIRED"),h("setup-required"),g("setup"),p("models"),_;if(U>=400||_.ok===!1)return o(Ki(_.error?.message??_.message??`操作失败(HTTP ${U})`)),d(_.error?.code??String(U)),v(_.state??`failed:${U}`),y(D=>({...D,command:_.error?.message??`failed:${_.error?.code??U}`})),_;if(_.operationId){const D=window.localStorage.getItem(wn)?.trim();if(D&&fetch(`/api/operator/v1/chat/sessions/${encodeURIComponent(D)}/operation-links`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json",[Lv]:Gv()},body:JSON.stringify({operationId:_.operationId})}).then(M=>{M.ok||console.warn("Operator Chat operation link failed",M.status)}).catch(M=>console.warn("Operator Chat operation link failed",M)),I(_.operationId),v(_.state??"accepted"),y(M=>({...M,command:_.state??"accepted",dag:X==="runDag"?"running":M.dag})),FE.has(X)){A(!0),u(`操作已接受,后台运行中:${_.operationId}(请看事件流;可同时打开 Observe)`);const M=_.operationId;ey(M,30*6e4).then(C=>{if(C){if(v(C.state??null),C.state==="failed"||C.state==="needs-reconcile"||C.state==="timed-out"){o(Ki(C.errorMessage??C.stderrPreview??`操作失败:${C.state}`)),d(C.errorCode??C.state??null),y(ie=>({...ie,command:`failed:${C.errorCode??C.state}`}));return}C.state==="succeeded"&&(u(`${X} 已成功`),y(ie=>({...ie,command:"succeeded"})))}})}else{u(`操作已接受:${_.operationId}`);const M=await ey(_.operationId);if(M){if(v(M.state??null),M.state==="failed"||M.state==="needs-reconcile"||M.state==="timed-out")return o(Ki(M.errorMessage??M.stderrPreview??`操作失败:${M.state}`)),d(M.errorCode??M.state??null),y(Y=>({...Y,command:`failed:${M.errorCode??M.state}`})),{ok:!1,operationId:_.operationId,state:M.state,error:{code:M.errorCode??M.state??"INTERNAL_ERROR",message:M.errorMessage??M.stderrPreview??`操作失败:${M.state}`}};u(M.errorMessage?`${X}:${M.errorMessage}`:`${X} 已成功`),y(Y=>({...Y,command:M.state??"succeeded"}));const C=M.result??{},ie={ok:!0,operationId:_.operationId,state:M.state??"succeeded",result:C};(X==="interviewStart"||X==="interviewTurn"||X==="interviewSkip")&&i(C);const de=C.confirmation;return de?.confirmationId&&(E(de.confirmationId),te(C)),O?.advanceTo&&g(O.advanceTo),ie}}}else u(`${X} 已完成`),v(_.state??"succeeded"),y(D=>({...D,command:"succeeded",verification:X==="contractValidate"||X==="spineCheck"?"ran":D.verification}));const W=_.result??{};(X==="interviewStart"||X==="interviewTurn"||X==="interviewSkip")&&i(W);const R=W.confirmation;return R?.confirmationId&&(E(R.confirmationId),te(W)),O?.advanceTo&&g(O.advanceTo),_}catch(U){o(U instanceof Error?U.message:String(U));return}finally{l(!1)}},[i,l,o,d,u,h,g,p,v,y]),z=k.useCallback(X=>{if(!X)return"无响应";if(X.error?.message)return X.error.message;if(X.message)return X.message;const B=X.result;if(B&&typeof B=="object")try{return JSON.stringify(B).slice(0,1200)}catch{return"已返回结果"}return X.ok===!1?"失败":"成功"},[]),V=k.useCallback(X=>{if(!X||X.ok===!1||X.error)return!1;const B=X.result;if(!B)return!0;if(typeof B.valid=="boolean")return B.valid;const O=B.result;return O&&typeof O.valid=="boolean"?O.valid:!0},[]),F=k.useCallback(async X=>{G.current?.abort();const B=new AbortController;G.current=B,T(O=>[...O,`开始跟随事件流 ${X}`]);try{const O=await fetch(`/api/operator/v1/operations/${encodeURIComponent(X)}/events`,{credentials:"same-origin",signal:B.signal});if(!O.ok||!O.body){T(R=>[...R,`事件流 HTTP ${O.status}`]);return}const U=O.body.getReader(),_=new TextDecoder;let W="";for(;N;){const{done:R,value:D}=await U.read();if(R)break;W+=_.decode(D,{stream:!0});const M=W.split(`
|
|
51
|
-
|
|
52
|
-
`);W=M.pop()??"";for(const C of M){const ie=C.split(`
|
|
53
|
-
`).find(Y=>Y.startsWith("data:"));if(!ie)continue;const de=ie.slice(5).trim();T(Y=>[...Y.slice(-80),de.slice(0,240)])}}}catch(O){O.name!=="AbortError"&&T(U=>[...U,`事件流错误:${O instanceof Error?O.message:String(O)}`])}},[N]);k.useEffect(()=>(w&&N&&(S==="run"||x==="recovery")&&F(w),()=>G.current?.abort()),[w,N,S,x,F]);const le=k.useCallback(()=>{A(!1),G.current?.abort(),u("已停止跟随日志(未取消子进程)")},[u]);return{runAction:se,summarizeEnvelope:z,isActionSuccess:V,operationId:w,setOperationId:I,sseLog:H,followSse:N,setFollowSse:A,stopFollowSse:le,confirmationId:K,setConfirmationId:E,confirmationDetails:$,setConfirmationDetails:te}}const ld=8*1024*1024,XE=10*1024*1024,Vs=8,QE=".md,.markdown,.txt,text/markdown,text/plain",ZE=[".md",".markdown",".txt"],Dd=/\.[^.]+$/;function JE(t){const r=Dd.exec(t.trim());return r?r[0].toLowerCase():""}function WE(t){const r=JE(t);return ZE.includes(r)}function sd(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 tr(t,r){return{ok:!1,code:t,message:r}}function eN(t,r){const i=t?Array.from(t):[],l=r?.maxFiles??Vs,o=r?.existingCount??0;return i.length===0?tr("file-count","请选择至少一个 .md / .markdown / .txt 文件"):o+i.length>l?tr("file-count",`最多支持 ${l} 个文件(当前已有 ${o} 个)`):null}async function tN(t){const r=t.name?.trim()||"untitled.md";if(!WE(r))return tr("unsupported-extension","仅支持 .md、.markdown、.txt 文件");if(t.size>ld)return tr("file-too-large",`文件不能超过 ${sd(ld)}`);let i;try{i=await t.arrayBuffer()}catch{return tr("read-failed","文件读取失败,请重试或直接粘贴")}let l;try{l=new TextDecoder("utf-8",{fatal:!0}).decode(i)}catch{return tr("invalid-utf8","文件不是有效 UTF-8,请另存为 UTF-8")}if(l.trim().length===0)return tr("empty-content","文件内容不能为空或只有空白");const o=new TextEncoder().encode(l).byteLength;return{ok:!0,text:l,fileName:r,sourceBytes:t.size,textBytes:o}}async function nN(t){if(t.length===0)return tr("file-count","请选择至少一个 .md / .markdown / .txt 文件");if(t.length>Vs)return tr("file-count",`最多支持 ${Vs} 个文件`);const r=[];for(const i of t){const l=await tN(i);if(!l.ok)return l;r.push({fileName:l.fileName,text:l.text,sourceBytes:l.sourceBytes,textBytes:l.textBytes})}return{ok:!0,documents:r}}function rN(t,r){const i=t.split(/\r?\n/);for(const o of i){const d=/^(#{1,6})\s+(.+)$/.exec(o.trim());if(d?.[2])return d[2].trim()}for(const o of i){const d=o.trim();if(d&&!/^---+$/.test(d)&&!/^```/.test(d)&&!/^<!--/.test(d))return d.replace(/^>\s+/,"").slice(0,120)}return r.replace(Dd,"").trim()||"需求"}function iN(t){return t.trim().toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"").replace(/-{2,}/g,"-")||"requirement"}function aN(t,r){const i=t.replace(Dd,"").trim(),l=iN(i);return l==="requirement"&&/[^\u0000-\u007f]/.test(i)?`part-${r+1}`:l==="requirement"?i?`part-${r+1}`:`part-${r+1}`:l}function lN(t){const r=new Set;return t.map((i,l)=>{let o=aN(i.fileName,l);if(r.has(o)){let d=2;for(;r.has(`${o}-${d}`);)d+=1;o=`${o}-${d}`}return r.add(o),{name:o,content:i.text,fileName:i.fileName}})}function sN(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),l=t[i],o=rN(l.text,l.fileName),u=[`<!-- composed-from: ${t.map(h=>h.fileName).join(", ")} -->`,"",`# ${o}`,""];for(const h of t)u.push(`## 来源:${h.fileName}`,"",h.text.trim(),"");return`${u.join(`
|
|
54
|
-
`).trimEnd()}
|
|
55
|
-
`}function oN(t,r,i){const l={action:t,actionParams:r};return new TextEncoder().encode(JSON.stringify(l)).byteLength<=XE}function uN(){return"最终内容导致请求体超过服务端限制,请缩小文档或减少文件数量"}function cN(){const[t,r]=k.useState(""),[i,l]=k.useState([]),[o,d]=k.useState(0),[u,h]=k.useState(!1),[g,p]=k.useState(null),[v,y]=k.useState(!1),[S,x]=k.useState(!1),w=k.useRef(0),I=k.useRef(0),H=k.useCallback((V,F)=>{const le=V.length===0?0:Math.min(Math.max(0,F),V.length-1);d(le),r(sN(V,{primaryIndex:le})),h(!1)},[]),T=k.useCallback(async V=>{const F=eN(V,{existingCount:i.length});if(F){p(F.message);return}const le=Array.from(V),X=++I.current;y(!0),p(null);try{const B=await nN(le);if(X!==I.current)return;if(!B.ok){p(B.message);return}const O=[...i,...B.documents],U=i.length===0?0:o;l(O),i.length===0||!u?(H(O,U),p(null)):p("已追加文件,未改正文(正文已手动编辑);可点「按文件重新合成」覆盖。")}catch{if(X!==I.current)return;p("文件读取失败,请重试或直接粘贴")}finally{X===I.current&&y(!1)}},[H,u,i,o]),N=k.useCallback(V=>{r(V),i.length>0&&h(!0)},[i.length]),A=k.useCallback(V=>{d(V),u||H(i,V)},[H,u,i]),G=k.useCallback((V,F)=>{const le=V+F,X=[...i],B=X[le];X[le]=X[V],X[V]=B;const O=o===V?le:o===le?V:o;l(X),d(O),u||H(X,O)},[H,u,i,o]),K=k.useCallback(V=>{const F=i.filter((X,B)=>B!==V),le=F.length===0?0:Math.min(o>=V?Math.max(0,o-1):o,Math.max(0,F.length-1));l(F),d(le),F.length===0?h(!1):u||H(F,le)},[H,u,i,o]),E=k.useCallback(()=>{l([]),d(0),h(!1),p(null)},[]),$=k.useCallback(()=>{u&&!window.confirm("将用当前文件列表重新合成正文,覆盖你在编辑区的修改。继续?")||(H(i,o),p(null))},[H,u,i,o]),te=k.useCallback((V,F)=>{V.preventDefault(),V.stopPropagation(),!F&&(w.current+=1,x(!0))},[]),se=k.useCallback(V=>{V.preventDefault(),V.stopPropagation(),w.current=Math.max(0,w.current-1),w.current===0&&x(!1)},[]),z=k.useCallback((V,F)=>{V.preventDefault(),V.stopPropagation(),w.current=0,x(!1),!F&&T(V.dataTransfer.files)},[T]);return{prdText:t,setPrdText:r,onPrdTextChange:N,prdDocuments:i,prdPrimaryIndex:o,prdComposedDirty:u,prdFileError:g,setPrdFileError:p,prdFileReading:v,prdDragOver:S,loadPrdFromFiles:T,applyPrdComposition:H,setPrimaryDocument:A,moveDocument:G,removeDocument:K,clearDocuments:E,recomposeDocuments:$,onDragEnter:te,onDragLeave:se,onDrop:z}}const dN={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>"}},ty={"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 fN(t){return(ty[t]??ty["orphan-unknown"]).map(i=>dN[i])}function hN(t){const r=[],i=[];for(const l of t)l.lane==="worker"?i.push(l):r.push(l);return{dag:r,worker:i}}function mN(t){return typeof t.action=="string"&&t.action.trim().length>0}function $v(t){return fN(t).filter(mN)}function pN(t){const r=new Set($v(t).map(l=>l.id)),i=(...l)=>{for(const o of l)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 gN(t){if(t.needsReconcile)return"needs-reconcile";const r=(t.errorCode??"").toLowerCase(),i=(t.operationState??"").toLowerCase(),l=(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")||l.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")||l==="interrupted"||l==="orphaned"||i.includes("controller-interrupted")||i.includes("interrupted")?"needs-reconcile":l==="running-suspected-stall"||l==="running-quiet"||l==="suspected-stall"||l.includes("suspected-stall")||i.includes("suspected-stall")?"orphan-unknown":i==="succeeded"||i==="completed"||i==="finished"||l==="succeeded"||l==="completed"||l==="finished"?"terminal-succeeded":i==="failed"||i.includes("fail")||l==="failed"||l==="partial_failed"||r.includes("fail")?"terminal-failed":r.includes("reconcil")||i.includes("reconcil")?"needs-reconcile":"orphan-unknown"}const Od=new Set(["failed","error","partial_failed"]),Fv=new Set(["blocked","paused","awaiting_human"]);function eo(t){return(t??"").trim().toLowerCase()}function yN(t){return Od.has(eo(t))}function ny(t){const r=eo(t.status);return Od.has(r)||r.includes("fail")?0:t.lifecycle==="paused"||r==="paused"?1:t.lifecycle==="active"?2:3}function vN(t){return[...t].sort((r,i)=>{const l=ny(r)-ny(i);return l!==0?l:i.mtimeMs-r.mtimeMs})}function bN(t){return vN(t)[0]?.dagRunId}function ry(t){const r=eo(t.status);return Od.has(r)?0:Fv.has(r)?1:2}function Vv(t){return[...t].sort((r,i)=>{const l=ry(r)-ry(i);return l!==0?l:r.nodeId.localeCompare(i.nodeId)})}function xN(t){const r=Vv(t);return r.find(l=>yN(l.status)||Fv.has(eo(l.status)))?.nodeId??r[0]?.nodeId}function SN(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 kN(t){const r=t.status?.trim()||"unknown",i=t.label?.trim();return i&&i!==t.nodeId?`${t.nodeId} · ${r} · ${i}`:`${t.nodeId} · ${r}`}function wN(t){const i=[`operator-recovery: ${t.actionLabel?.trim()||"恢复"}`],l=t.dagRunId?.trim();if(l){const h=t.runStatus?.trim();i.push(h?`run=${l} (${h})`:`run=${l}`)}const o=t.fromNodeId?.trim();if(o){const h=t.nodeStatus?.trim();i.push(h?`from-node=${o} (${h})`:`from-node=${o}`)}const d=t.factClassLabel?.trim();d&&i.push(`fact=${d}`);const u=t.nodeError?.trim()||t.errorMessage?.trim()||(t.errorCode?.trim()?`code=${t.errorCode.trim()}`:"");return u&&i.push(`detail=${u.replace(/\s+/g," ").slice(0,280)}`),i.join(`
|
|
56
|
-
`).slice(0,500)}function Pv(t){const r=t.trim();return r?r==="operator-recovery"||r.startsWith("operator-recovery:")||r.startsWith("recovery:"):!0}function CN(t){const{shell:r,actions:i,taskId:l,dagRunId:o,fromNodeId:d,featureId:u,recoveryReason:h,recoveryReasonTouched:g,recoveryConfirm:p,recoveryPlanSummary:v,setRecoveryConfirm:y,setRecoveryPlanSummary:S,setRecoveryReport:x,setRecoveryReason:w,setRecoveryReasonTouched:I,buildCurrentRecoveryReason:H,openFullCanvas:T}=t,{setOpError:N,setOpErrorCode:A,setOpMessage:G,setBusy:K}=r,{runAction:E,isActionSuccess:$}=i,te=k.useCallback(async z=>{if(z.requiresReason||(y(null),S(null)),z.action==="doctor"){x(null),E("doctor",{});return}if(z.action==="dagReport"||z.id==="report"){const V=o.trim();if(V){y(null),S(null);const F=await E("dagReport",{runId:V}),le=F?.result??{},X=(le.raw?.runs??le.runs)?.[0];F&&F.ok!==!1&&!F.error&&X&&(x({runId:X.runId??V,title:X.title,status:X.status,category:X.productLineFailureCategory,recommendation:X.recoveryRecommendation?.summary??X.recommendedFollowUp??void 0}),G(null));return}if(l.trim()){x(null),E("status",{taskId:l});return}N("查看报告需要先选择 DAG 运行 ID(或填写任务 ID)");return}if(z.action==="observeLink"){x(null),T();return}if(z.requiresReason){if(x(null),y(z),S(null),z.id!=="dagRerun"&&(N(null),A(null)),(!g||Pv(h))&&(w(H(z.label)),I(!1)),z.id==="dagRerun"&&o.trim()&&d.trim()){K(!0);try{const{status:V,body:F}=await Id("dagRerunPlan",{runId:o.trim(),fromNode:d.trim()}),le=F.result??{};le&&typeof le=="object"&&("eligible"in le||le.planHash)&&S(le),V<400&&F.ok!==!1&&le.eligible!==!1?G(null):le.eligible===!1?N(F.error?.message??Fc(le)):G(F.error?.message??"无法预检重跑计划;确认后仍将尝试提交(CLI 可能尚未就绪)")}finally{K(!1)}}return}N(null),A(null),G(`${z.label}:请经 CLI — ${z.commandHint??""}`)},[H,o,d,T,h,g,E,K,N,A,G,y,S,x,w,I,l]),se=k.useCallback(async()=>{const z=p;if(!z)return;const V=h.trim();if(!V){N("恢复操作需要结构化原因");return}const F=Fs(`recovery-${z.id}`);if(y(null),z.id==="dagRerun"){const le=o.trim(),X=d.trim();if(!le||!X){N("从节点重跑需要 DAG 运行 ID 与起始节点 ID");return}let B=v?.planHash?.trim(),O=v?.eligible;if(!B||O===void 0){const U=await E("dagRerunPlan",{runId:le,fromNode:X}),_=U?.result??{};if((_.planHash||_.eligible!==void 0)&&S(_),B=_.planHash?.trim()||B,O=_.eligible,_.eligible===!1){N(U?.error?.message??Fc(_));return}if(U&&U.ok===!1&&!B){N(U.error?.message??"无法获取 planHash;请确认 loop-agent dag rerun --plan 可用");return}}if(O===!1){N(Fc(v??{}));return}if(!B){N("无法获取 planHash;请确认 loop-agent dag rerun --plan 可用");return}await E("dagRerun",{runId:le,fromNode:X,planHash:B,reason:V},{clientRequestId:F});return}if(z.id==="standaloneTaskRerun"){const le=o.trim();if(!le){N("完整重跑任务需要 DAG 运行 ID");return}const X={runId:le,reason:V,...l.trim()?{taskId:l.trim()}:{}},B=await E("prepareMutationGate",{action:"standaloneTaskRerun",actionParams:X});if(!$(B))return;const O=B?.result??B;if(!O.receiptId||!O.humanGateToken){N("prepareMutationGate 未返回可消费的 Human Gate receipt");return}await E("standaloneTaskRerun",{...X,confirmationId:O.receiptId,humanGateToken:O.humanGateToken},{clientRequestId:F});return}if(z.id==="workerTaskRetry"){const le=l.trim();if(!le){N("重新排队 Worker Task 需要任务 ID");return}const X={taskId:le,reason:V,...u.trim()?{featureId:u.trim()}:{}},B=await E("prepareMutationGate",{action:"workerTaskRetry",actionParams:X});if(!$(B))return;const O=B?.result??B;if(!O.receiptId||!O.humanGateToken){N("prepareMutationGate 未返回可消费的 Human Gate receipt");return}await E("workerTaskRetry",{...X,confirmationId:O.receiptId,humanGateToken:O.humanGateToken},{clientRequestId:F});return}if(z.id==="reconcile"){const le=o.trim();if(!le){N("对账恢复需要 DAG 运行 ID");return}const X={runId:le,reason:V,reconcileAction:"supersede"},B=await E("prepareMutationGate",{action:"dagReconcileRun",actionParams:X});if(!$(B))return;const O=B?.result??B;if(!O.receiptId||!O.humanGateToken){N("prepareMutationGate 未返回可消费的 Human Gate receipt");return}await E("dagReconcileRun",{...X,confirmationId:O.receiptId,humanGateToken:O.humanGateToken},{clientRequestId:F});return}G(`${z.label}:请经 CLI — ${z.commandHint??""}`)},[o,u,d,p,v?.planHash,h,E,$,N,G,y,S,l]);return{handleRecoveryCta:te,submitRecoveryConfirm:se}}function jN(t){const{shell:r,actions:i,wizard:l}=t,{nav:o,opError:d,opErrorCode:u,lastOpState:h,setOpError:g,setObserveBusy:p}=r,{taskId:v}=l,[y,S]=k.useState(""),[x,w]=k.useState(""),[I,H]=k.useState(""),[T,N]=k.useState(""),[A,G]=k.useState(!1),[K,E]=k.useState(null),[$,te]=k.useState(null),[se,z]=k.useState([]),[V,F]=k.useState([]),[le,X]=k.useState(!1),[B,O]=k.useState(!1),[U,_]=k.useState(null),[W,R]=k.useState(null),[D,M]=k.useState(null),[C,ie]=k.useState(!1),[de,Y]=k.useState(!1),[ce,he]=k.useState(null),[pe,ye]=k.useState("idle"),[je,ze]=k.useState(null),[Ye,Ke]=k.useState(null),[lt,Zt]=k.useState(!1),Tt=k.useCallback(()=>y.trim()?`/inspect/#/dag/${encodeURIComponent(y.trim())}?from=recovery`:"/inspect/#/",[y]),jn=k.useCallback(()=>{window.location.assign(Tt())},[Tt]),gt=k.useCallback(async()=>{if(y.trim())return y.trim();const we=v.trim();if(!we)return g("打开 DAG 检视需要任务 ID 或 DAG 运行 ID"),null;p(!0),g(null);try{const{status:Ne,body:_e}=await Id("observeLink",{taskId:we}),Ie=_e.result??{};if(Ne>=400||_e.ok===!1)return g(_e.error?.message??"无法解析 DAG 画布地址"),ye("unavailable"),ze(_e.error?.message??null),null;const Lt=typeof Ie.dagRunId=="string"?Ie.dagRunId.trim():"";return Lt?(S(Lt),ye("match"),ze(null),Ke(`/inspect/#/dag/${encodeURIComponent(Lt)}`),Lt):(g("尚未找到该任务的 DAG 运行,请稍后再打开检视"),ye("unavailable"),ze(Ie.message??"未解析到 DAG run"),null)}catch(Ne){return g(Ne instanceof Error?Ne.message:String(Ne)),null}finally{p(!1)}},[y,v,g,p]),Jt=k.useCallback(async()=>{await gt()&&Zt(!0)},[gt]),Ee=k.useCallback(async()=>{const we=await gt();we&&window.location.assign(`/inspect/#/dag/${encodeURIComponent(we)}?from=recovery`)},[gt]),Xe=k.useCallback(async()=>{X(!0);try{const we=v.trim(),Ne=new URLSearchParams;we&&Ne.set("taskId",we),Ne.set("limit","40");const _e=await fetch(`/api/operator/v1/recovery/candidates?${Ne.toString()}`,{credentials:"same-origin"});if(!_e.ok){z([]);return}const Ie=await _e.json();z(Array.isArray(Ie.runs)?Ie.runs:[])}catch{z([])}finally{X(!1)}},[v]),ut=k.useCallback(async we=>{const Ne=we.trim();if(!Ne){F([]),_(null),R(null),M(null);return}O(!0);try{const _e=await fetch(`/api/dag-runs/${encodeURIComponent(Ne)}`,{credentials:"same-origin"});if(!_e.ok){F([]),_(null),R(null);return}const Ie=await _e.json(),Lt=typeof Ie.effectiveStatus=="string"&&Ie.effectiveStatus||typeof Ie.status=="string"&&Ie.status||null;_(Lt);const Ut=Array.isArray(Ie.nodes)?Ie.nodes:[],to=Vv(Ut.map(Et=>{const Rn=(Et.nodeId??Et.id??"").trim();return Rn?{nodeId:Rn,status:Et.status,label:Et.label??Et.name,errorPreview:Et.errorPreview}:null}).filter(Et=>Et!==null));F(to);const li=typeof Ie.failureCategory=="string"&&Ie.failureCategory||void 0,si=Ut.find(Et=>typeof Et.failureCategory=="string"&&Et.failureCategory&&Et.failureCategory!=="success")?.failureCategory;R(li??si??null),M(Ie.frontendRecovery??null)}catch{F([]),_(null),R(null),M(null)}finally{O(!1)}},[]);k.useEffect(()=>{o==="recovery"&&Xe()},[o,v,Xe]),k.useEffect(()=>{if(o!=="recovery"||C||se.length===0)return;const we=y.trim(),Ne=we?se.some(_e=>_e.dagRunId===we):!1;if(!we||!Ne){const _e=bN(se);_e&&_e!==we&&S(_e)}},[o,se,y,C]),k.useEffect(()=>{o==="recovery"&&ut(y)},[o,y,ut]),k.useEffect(()=>{if(o!=="recovery"||de||V.length===0)return;const we=x.trim(),Ne=we?V.some(_e=>_e.nodeId===we):!1;if(!we||!Ne){const _e=xN(V);_e&&_e!==we&&w(_e)}},[o,V,x,de]);const ee=gN({operationState:U?null:h,errorCode:U?null:u,dagStatus:U,failureCategory:W}),Se=k.useMemo(()=>$v(ee),[ee]),re=k.useMemo(()=>hN(Se),[Se]),fe=k.useMemo(()=>pN(ee),[ee]),be=k.useMemo(()=>V.find(we=>we.nodeId===x.trim()),[V,x]),Re=k.useRef(null);k.useEffect(()=>{$&&Re.current?.scrollIntoView({behavior:"smooth",block:"nearest"})},[$?.id]);const Te=k.useCallback(we=>wN({actionLabel:we,dagRunId:y.trim()||void 0,fromNodeId:x.trim()||void 0,runStatus:U,nodeStatus:be?.status,nodeError:be?.errorPreview,factClassLabel:qv[ee],errorMessage:d,errorCode:u}),[y,x,d,u,ee,U,be?.errorPreview,be?.status]);k.useEffect(()=>{if(o!=="recovery"||A&&!Pv(T))return;const we=Te($?.label);we&&we!==T&&N(we)},[o,y,x,U,be,ee,d,u,$?.label,A,T,Te]);const{handleRecoveryCta:st,submitRecoveryConfirm:yt}=CN({shell:r,actions:i,taskId:v,dagRunId:y,fromNodeId:x,featureId:I,recoveryReason:T,recoveryReasonTouched:A,recoveryConfirm:$,recoveryPlanSummary:K,setRecoveryConfirm:te,setRecoveryPlanSummary:E,setRecoveryReport:he,setRecoveryReason:N,setRecoveryReasonTouched:G,buildCurrentRecoveryReason:Te,openFullCanvas:Ee});return{dagRunId:y,setDagRunId:S,fromNodeId:x,setFromNodeId:w,featureId:I,setFeatureId:H,recoveryReason:T,setRecoveryReason:N,recoveryReasonTouched:A,setRecoveryReasonTouched:G,recoveryPlanSummary:K,recoveryConfirm:$,setRecoveryConfirm:te,setRecoveryPlanSummary:E,recoveryRuns:se,recoveryNodes:V,recoveryRunsLoading:le,recoveryNodesLoading:B,recoveryRunStatus:U,frontendRecovery:D,manualRunId:C,setManualRunId:ie,manualNodeId:de,setManualNodeId:Y,recoveryReport:ce,setRecoveryReport:he,observeLinkStatus:pe,observeLinkMessage:je,observeUrl:Ye,inspectSplitOpen:lt,setInspectSplitOpen:Zt,inspectPath:Tt,openFullInspect:jn,resolveDagRunForInspect:gt,openInspectSplit:Jt,openFullCanvas:Ee,loadRecoveryRuns:Xe,loadRecoveryNodes:ut,recoveryFact:ee,recoveryCtas:Se,recoveryLanes:re,recommendedCtaId:fe,recoveryConfirmRef:Re,buildCurrentRecoveryReason:Te,handleRecoveryCta:st,submitRecoveryConfirm:yt}}function RN(t){const{shell:r,actions:i,prd:l}=t,{step:o,setStep:d,setOpMessage:u}=r,{runAction:h,isActionSuccess:g,summarizeEnvelope:p}=i,[v,y]=k.useState(""),[S,x]=k.useState(""),[w,I]=k.useState("standard"),[H,T]=k.useState(""),[N,A]=k.useState(""),[G,K]=k.useState(""),E=ad.find(Ee=>Ee.kind===w)??ad[0],[$,te]=k.useState(null),[se,z]=k.useState(null),[V,F]=k.useState(""),[le,X]=k.useState(null),[B,O]=k.useState(null),[U,_]=k.useState(null),[W,R]=k.useState(null),[D,M]=k.useState(null),[C,ie]=k.useState(!1),[de,Y]=k.useState(null),[ce,he]=k.useState(null),pe=k.useRef(!1),ye=k.useCallback(()=>{_(null),R(null),M(null),ie(!1),Y(null),he(null),pe.current=!1},[]),je=k.useCallback(()=>{ye(),d("contract")},[ye,d]),ze=k.useCallback(Ee=>{const Xe=Ee.session;Xe?.sessionId&&te(Xe.sessionId);const ut=Ee.question;z(ut),X(Ee.summary??null);const ee=Ee.assessmentId;typeof ee=="string"&&ee&&O(ee),(Ee.complete===!0||typeof ee=="string"&&ee)&&(je(),u(Ee.skipped===!0?"已跳过访谈:已按推荐补齐草稿并签发评估":"访谈已完成:草稿已绑定完整评估结果"))},[je,u]),Ye=k.useCallback(async(Ee=!1)=>{const Xe=v.trim();if(!Xe)return;const ut=`${Xe}:${B??""}`;if(!(!Ee&&ce===ut&&U!==null)&&!pe.current){pe.current=!0,_(null),R(null),M(null),Y(null),ie(!1);try{const ee=await h("contractValidate",{taskId:Xe}),Se=g(ee);if(_(Se),R(p(ee)),!Se){he(ut),u("契约校验未通过:请先修正草稿后再应用");return}const re=await h("contractDiff",{taskId:Xe});M(p(re)),he(ut),u(g(re)?"校验与差异已就绪:确认后可应用契约":"校验通过,但差异查询失败(仍可查看下方摘要)")}finally{pe.current=!1}}},[B,ce,U,g,h,u,p,v]),Ke=k.useCallback(async()=>{const Ee=v.trim();if(!Ee||!B)return;const Xe=await h("contractApply",{taskId:Ee,assessmentId:B},{clientRequestId:Fs("apply")});if(!g(Xe)){ie(!1);return}ie(!0);const ut=await h("spineCheck",{taskId:Ee});if(g(ut)){Y(!0),d("dag-confirm"),u("契约已应用并通过 Spine 审计,可生成并运行 DAG");return}Y(!1),u("契约已应用,但 Spine 审计未通过:可重试 Spine")},[B,g,h,u,d,v]),lt=k.useCallback(async()=>{const Ee=v.trim();if(!Ee)return;const Xe=await h("spineCheck",{taskId:Ee});if(g(Xe)){Y(!0),d("dag-confirm"),u("Spine 审计已通过,可生成并运行 DAG");return}Y(!1)},[g,h,u,d,v]),Zt=k.useCallback(async()=>{const Ee=i.confirmationId?.trim();if(!Ee)return;const Xe=i.confirmationDetails?.confirmation?.humanGateToken,ut=await h("confirmDagConfirmation",{confirmationId:Ee,humanGateToken:Xe});g(ut)&&(d("run"),await h("runDag",{confirmationId:Ee},{clientRequestId:Fs("run")}))},[i.confirmationId,i.confirmationDetails,g,h,d]);k.useEffect(()=>{o==="contract"&&v.trim()&&Ye(!1)},[o,v,B,Ye]);const Tt=k.useCallback(Ee=>Ee.split(/[\n,;,;]+/).map(Xe=>Xe.trim()).filter(Boolean),[]),jn=k.useCallback(async()=>{const Ee=l.prdDocuments.length>0?lN(l.prdDocuments):void 0,Xe=Tt(H),ut=Tt(N),ee=Tt(G),Se={content:l.prdText,taskKind:w,...Ee?{documents:Ee}:{},...Xe.length>0?{allowedPaths:Xe}:{},...ut.length>0?{forbiddenPaths:ut}:{},...ee.length>0?{verifyCommands:ee}:{}};if(!oN("bootstrapFromPrd",Se)){l.setPrdFileError(uN());return}const re=await h("bootstrapFromPrd",Se);if(!re||re.ok===!1)return;const fe=re.result??{};fe.taskId&&y(fe.taskId),fe.title&&x(fe.title);const be=fe.parseStatus??"pending",Re=fe.draftPreview?.objective?.trim(),Te=Array.isArray(fe.gaps)?fe.gaps.length:0,st=fe.semanticIntake?.applied?"semantic":fe.semanticIntake?.code??"no-semantic",yt=(fe.autoImportedReferences??[]).filter(Ne=>Ne.repoRelative),we=(fe.unresolvedReferences??[]).filter(Ne=>Ne.token);u([`已创建任务「${fe.title??""}」(${fe.taskId??""})`,`来源:${fe.identitySource??"prd"}`,`解析:${be}(${st})`,Re?`目标:${Re.slice(0,120)}`:null,Te>0?`缺口 ${Te} 项待确认`:null,yt.length>0?`已自动导入 ${yt.length} 个引用文档(${yt.map(Ne=>`${Ne.repoRelative}${Ne.role?`:${Ne.role}`:""}`).join("、")})`:null,we.length>0?`有 ${we.length} 个引用未能解析:${we.map(Ne=>`${Ne.token}(${Ne.reason??"未知原因"})`).join("、")}`:null].filter(Boolean).join(" · ")),d("interview")},[H,N,l,h,u,d,Tt,w,G]),gt=[{id:"setup",label:"就绪检查"},{id:"import-prd",label:"导入需求"},{id:"interview",label:"需求访谈(可跳过)"},{id:"contract",label:"契约落地"},{id:"dag-confirm",label:"确认 DAG"},{id:"run",label:"运行"}],Jt=gt.findIndex(Ee=>Ee.id===o);return{taskId:v,setTaskId:y,taskTitle:S,taskKind:w,setTaskKind:I,engineering:{allowedPathsText:H,forbiddenPathsText:N,verifyCommandsText:G},setEngineering:Ee=>{Ee.allowedPathsText!==void 0&&T(Ee.allowedPathsText),Ee.forbiddenPathsText!==void 0&&A(Ee.forbiddenPathsText),Ee.verifyCommandsText!==void 0&&K(Ee.verifyCommandsText)},workflowMeta:E,sessionId:$,question:se,answerText:V,setAnswerText:F,draftSummary:le,assessmentId:B,contractValidateOk:U,contractValidateSummary:W,contractDiffSummary:D,contractApplied:C,spineOk:de,applyInterviewPayload:ze,runContractPreflight:Ye,applyContractThenSpine:Ke,retrySpineOnly:lt,confirmAndRunDag:Zt,importPrdAndCreate:jn,wizardSteps:gt,stepIndex:Jt}}const TN={chat:"对话",tasks:"任务",recovery:"恢复",night:"夜间",models:"模型与认证",settings:"设置"};async function EN(t){return await import(t)}function NN(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 AN(t){const{nav:r,readiness:i,setupBlocked:l,degraded:o,health:d,inspectHref:u}=t,h=l||o?"models":"settings",g=l?"Pi SDK / 认证 / 模型未就绪。不提供纯表单兜底。点击前往模型与认证。":o?"Pi 暂时降级:仍可恢复草稿与需求访谈。点击查看详情。":"Pi 已就绪。点击打开设置查看详情。";return{mode:"operate",activeTabHref:`#/${r}`,operateHref:"/#/",inspectHref:u,freshness:!1,readinessState:i,readinessHref:`#/${h}`,readinessTitle:g,repo:d?{name:NN(d),fingerprint:d.repoFingerprint??"",version:d.packageVersion??"",product:d.productName??d.product??"",inspectReady:d.inspect?.ready}:null}}function IN(t){const r=k.useRef(null),i=k.useRef(null),[l,o]=k.useState(!1),d=k.useMemo(()=>AN(t),[t.nav,t.readiness,t.setupBlocked,t.degraded,t.health,t.inspectHref]),u=k.useRef(d);return u.current=d,k.useEffect(()=>{let h=!1;return EN("/inspect/operator-chrome.js").then(g=>{h||!r.current||(i.current=g.mountOperatorChrome(r.current,u.current))}).catch(()=>{h||o(!0)}),()=>{h=!0,i.current?.destroy(),i.current=null}},[]),k.useEffect(()=>{i.current?.update(d)},[d]),c.jsxs(c.Fragment,{children:[c.jsx("div",{ref:r,"data-testid":"operator-chrome"}),l?c.jsxs("nav",{className:"operator-chrome-fallback","aria-label":"操作工作区",children:[c.jsx("button",{type:"button",onClick:()=>window.location.assign("/#/"),children:"Loop Agent"}),c.jsx("button",{type:"button",onClick:()=>window.location.assign(`#/${t.nav}`),children:TN[t.nav]}),c.jsx("button",{type:"button",onClick:()=>window.location.assign(t.inspectHref),children:"观测"}),c.jsx("span",{role:"status",children:"共享导航加载失败,请刷新页面"})]}):null]})}function DN(t){return c.jsxs(c.Fragment,{children:[t.opError?c.jsxs("div",{className:"flash flash-error","data-testid":"op-error",children:[c.jsx("span",{className:"flash-label",children:"错误"}),c.jsx("p",{className:"flash-body",children:t.opError})]}):null,t.opMessage?c.jsxs("div",{className:"flash flash-info","data-testid":"op-message",children:[c.jsx("span",{className:"flash-label",children:"状态"}),c.jsx("p",{className:"flash-body",children:t.opMessage})]}):null]})}const ON=[{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 MN(t){if(!t)return null;const r=Date.parse(t);return Number.isNaN(r)?t:new Date(r).toLocaleString()}function zN(t){const r=t.readinessReport?.state??t.readiness,i=t.readinessReport?.probe,l=i?.details??{},o=t.readinessReport?.blockedActions??[],d=MN(t.readinessReport?.generatedAt),u=t.readinessReport??{state:t.readiness,health:t.health};return c.jsxs("section",{className:"panel models-page","aria-labelledby":"models-title",children:[c.jsxs("div",{className:"models-header",children:[c.jsx("h2",{id:"models-title",children:"模型与认证"}),c.jsx("span",{className:"models-status-pill","data-state":r,"data-testid":"models-readiness-pill",children:Hv[r]??r})]}),c.jsxs("p",{className:"panel-lead",children:["复用 Pi ModelRuntime 凭据平面;密钥不会回传到页面。请用"," ",c.jsx("code",{children:"pi"})," 或 Pi 认证存储完成配置,然后刷新就绪探测。"]}),c.jsxs("section",{className:"models-probe-card","aria-labelledby":"models-probe-title","data-testid":"readiness-details",children:[c.jsx("h3",{id:"models-probe-title",className:"models-subtitle",children:"就绪检查"}),c.jsx("ul",{className:"models-probe-list",children:ON.map(h=>{const g=i?.[h.key],p=l[h.detailKey],v=g===void 0;return c.jsxs("li",{className:`models-probe-item${v?" is-pending":g?" is-ok":" is-bad"}`,children:[c.jsx("span",{className:"models-probe-badge","aria-label":v?"未探测":g?"通过":"未通过",children:v?"—":g?"✓":"✕"}),c.jsxs("div",{className:"models-probe-body",children:[c.jsx("strong",{children:h.label}),c.jsx("span",{className:"muted",children:h.hint}),p?c.jsx("p",{className:"models-probe-detail",children:p}):null]})]},h.key)})})]}),r==="setup-required"?c.jsxs("div",{className:"models-setup-card","data-testid":"models-setup-hint",children:[c.jsx("h3",{className:"models-subtitle",children:"如何完成配置"}),c.jsxs("ol",{className:"models-setup-steps",children:[c.jsxs("li",{children:["在终端配置 Pi 认证(例如 ",c.jsx("code",{children:"pi auth login"}),")或写入 provider API key。"]}),c.jsxs("li",{children:["确认 agent 目录下 ",c.jsx("code",{children:"models.json"})," / 认证文件可读。"]}),c.jsx("li",{children:"点击下方「刷新就绪探测」,或运行诊断命令查看详情。"})]}),c.jsx("pre",{className:"cmd",children:Bv})]}):null,r==="degraded"?c.jsx("p",{className:"models-degraded-note","data-testid":"models-degraded-note",children:"Pi 暂时降级:仍可恢复草稿与需求访谈;部分写入/运行类操作会被拦截。"}):null,o.length>0?c.jsxs("div",{className:"models-blocked-card",children:[c.jsx("h3",{className:"models-subtitle",children:"当前受限操作"}),c.jsx("ul",{className:"models-blocked-list",children:o.map(h=>c.jsx("li",{children:c.jsx("code",{children:h})},h))})]}):null,c.jsxs("div",{className:"models-actions",children:[c.jsx("button",{type:"button",className:"btn btn-primary",disabled:t.busy,onClick:t.onRefreshReadiness,children:"刷新就绪探测"}),d?c.jsxs("span",{className:"muted models-generated-at",children:["上次探测:",d]}):null]}),c.jsxs("details",{className:"models-raw-details",children:[c.jsx("summary",{children:"查看原始探测数据(调试)"}),c.jsx("pre",{className:"cmd models-raw-json",children:JSON.stringify(u,null,2)})]})]})}function iy(t){const{lane:r,cta:i,planSummary:l,reason:o,busy:d,confirmRef:u}=t;return!i||i.lane!==r?null:c.jsxs("div",{ref:u,className:"recovery-confirm","data-testid":"recovery-confirm",children:[c.jsxs("h3",{children:["待确认:",i.label]}),c.jsx("p",{className:"muted",children:"请核对上方运行 / 节点与恢复原因,再点「确定」执行。"}),l?c.jsxs("div",{className:"recovery-plan-summary",children:[c.jsxs("p",{className:"muted",children:["计划 eligible=",String(l.eligible??"—")," · 风险=",Uv[l.risk??""]??l.risk??"—"]}),l.effectiveFromNodeId?c.jsxs("p",{className:"muted",children:["有效起点:",l.effectiveFromNodeId]}):null,l.estimatedExecution?c.jsxs("p",{className:"muted",children:["将执行 ",l.estimatedExecution.nodeCount??"?"," 个节点 / ",l.estimatedExecution.piCallCount??"?"," 次 Pi;预计避免"," ",l.estimatedExecution.avoidedNodeCount??"?"," 个节点"]}):null,l.planHash?c.jsxs("p",{className:"muted",children:["planHash: ",c.jsxs("code",{children:[l.planHash.slice(0,16),"…"]})]}):null]}):i.id==="dagRerun"?c.jsx("p",{className:"muted",children:"未加载计划摘要;点「确定」前将再次尝试资格检查。"}):null,c.jsxs("div",{className:"cta-row",children:[c.jsx("button",{type:"button",className:"btn btn-primary",disabled:d||!o.trim(),"data-testid":"recovery-confirm-submit",onClick:t.onSubmit,children:"确定"}),c.jsx("button",{type:"button",className:"btn btn-secondary",disabled:d,"data-testid":"recovery-confirm-cancel",onClick:t.onCancel,children:"取消"})]})]})}function _N(t){const{shell:r,recovery:i,wizard:l}=t,{busy:o}=r,d={planSummary:i.recoveryPlanSummary,reason:i.recoveryReason,busy:o,confirmRef:i.recoveryConfirmRef,onSubmit:()=>{i.submitRecoveryConfirm()},onCancel:()=>{i.setRecoveryConfirm(null),i.setRecoveryPlanSummary(null)}};return c.jsxs("section",{className:"panel","aria-labelledby":"recovery-title",children:[c.jsx("h2",{id:"recovery-title",children:"恢复"}),c.jsxs("p",{className:"muted",children:["事实分类:",qv[i.recoveryFact]," · 无 Cancel · 无「直接改代码」"]}),i.frontendRecovery?c.jsxs("div",{className:"muted","data-testid":"frontend-recovery-lineage",style:{marginBottom:"0.75rem"},children:[c.jsxs("div",{children:["前端恢复:outcome=",c.jsx("code",{children:i.frontendRecovery.outcome??"—"})," phase=",c.jsx("code",{children:i.frontendRecovery.phase??"—"})]}),c.jsxs("div",{children:["root ",c.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,c.jsxs("ol",{className:"muted recovery-steps",children:[c.jsx("li",{children:"上方选 DAG 运行 / 节点,用「DAG 运行恢复」动作"}),c.jsx("li",{children:"Worker 队列失败才用下方「Worker Task 重排队」(二者不要混用)"}),c.jsx("li",{children:"带 * 的动作:核对预填原因 → 点下方「确定」"})]}),c.jsxs("p",{className:"muted",children:[l.taskId.trim()?`按任务 ${l.taskId.trim()} 拉取候选。`:"未填任务 ID 时列出最近 DAG 运行。","Doctor 诊断可选,不是重跑前置。"," ",c.jsx("button",{type:"button",className:"btn btn-secondary",disabled:o||i.recoveryRunsLoading,"data-testid":"recovery-refresh-candidates",onClick:()=>{i.loadRecoveryRuns()},children:i.recoveryRunsLoading?"刷新中…":"刷新候选"})]}),c.jsxs("label",{className:"field",children:[c.jsx("span",{className:"muted",children:"DAG 运行 ID"}),!i.manualRunId&&i.recoveryRuns.length>0?c.jsxs("select",{"data-testid":"recovery-run-select",value:i.dagRunId,disabled:o||i.recoveryRunsLoading,onChange:u=>{i.setManualRunId(!1),i.setManualNodeId(!1),i.setFromNodeId(""),i.setDagRunId(u.target.value),i.recoveryReasonTouched||i.setRecoveryReasonTouched(!1)},children:[i.recoveryRuns.some(u=>u.dagRunId===i.dagRunId)?null:c.jsx("option",{value:i.dagRunId||"",children:i.dagRunId?`${i.dagRunId}(当前)`:"— 请选择 —"}),i.recoveryRuns.map(u=>c.jsx("option",{value:u.dagRunId,children:SN(u)},u.dagRunId))]}):c.jsx("input",{"data-testid":"recovery-run-input",value:i.dagRunId,disabled:o,onChange:u=>{i.setManualRunId(!0),i.setDagRunId(u.target.value.trim())},placeholder:"dag-run-id(子图/完整重跑)"}),c.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":"刷新并改用下拉"})]}),c.jsxs("label",{className:"field",children:[c.jsxs("span",{className:"muted",children:["起始节点 ID(从节点重跑)",i.recoveryNodesLoading?" · 加载节点…":""]}),!i.manualNodeId&&i.recoveryNodes.length>0?c.jsxs("select",{"data-testid":"recovery-node-select",value:i.fromNodeId,disabled:o||i.recoveryNodesLoading,onChange:u=>{i.setManualNodeId(!1),i.setFromNodeId(u.target.value)},children:[i.recoveryNodes.some(u=>u.nodeId===i.fromNodeId)?null:c.jsx("option",{value:i.fromNodeId||"",children:i.fromNodeId?`${i.fromNodeId}(当前)`:"— 请选择 —"}),i.recoveryNodes.map(u=>c.jsx("option",{value:u.nodeId,children:kN(u)},u.nodeId))]}):c.jsx("input",{"data-testid":"recovery-node-input",value:i.fromNodeId,disabled:o,onChange:u=>{i.setManualNodeId(!0),i.setFromNodeId(u.target.value.trim())},placeholder:"例如 review-verdict-recovery-pi"}),c.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":"刷新并改用下拉"})]}),c.jsxs("label",{className:"field",children:[c.jsx("span",{className:"muted",children:"恢复原因(已按 run/节点失败事实自动预填,可编辑)"}),c.jsx("textarea",{"data-testid":"recovery-reason",value:i.recoveryReason,disabled:o,rows:4,onChange:u=>{i.setRecoveryReasonTouched(!0),i.setRecoveryReason(u.target.value)},placeholder:"将自动预填 operator-recovery / run / from-node / detail"}),c.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:"重新预填原因"})]}),c.jsxs("div",{className:"recovery-lane","data-testid":"recovery-lane-dag",children:[c.jsx("h3",{children:"DAG 运行恢复"}),c.jsx("p",{className:"muted",children:"针对 `.harness/dag-runs` 的 Agent DAG 运行。橙色为当前建议;带 * 需确认原因。"}),c.jsxs("div",{className:"recovery-cta-row","data-testid":"recovery-cta-row-dag",children:[i.recoveryLanes.dag.map(u=>{const h=u.id===i.recommendedCtaId;return c.jsxs("button",{type:"button",className:h?"btn btn-primary":"btn btn-secondary",disabled:o,title:u.guide,"aria-pressed":i.recoveryConfirm?.id===u.id?!0:void 0,"data-testid":`recovery-cta-${u.id}`,"data-recommended":h?"true":void 0,onClick:()=>{i.handleRecoveryCta(u)},children:[u.label,u.requiresReason?" *":""]},u.id)}),c.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?c.jsxs("div",{className:"recovery-report","data-testid":"recovery-report",children:[c.jsxs("div",{className:"recovery-report-header",children:[c.jsx("h3",{children:"交接报告摘要"}),c.jsx("button",{type:"button",className:"btn btn-ghost","data-testid":"recovery-report-close",onClick:()=>i.setRecoveryReport(null),children:"关闭"})]}),c.jsxs("dl",{className:"recovery-report-facts",children:[c.jsxs("div",{children:[c.jsx("dt",{children:"运行"}),c.jsx("dd",{children:c.jsx("code",{children:i.recoveryReport.runId})})]}),i.recoveryReport.title?c.jsxs("div",{children:[c.jsx("dt",{children:"标题"}),c.jsx("dd",{children:i.recoveryReport.title})]}):null,c.jsxs("div",{children:[c.jsx("dt",{children:"状态"}),c.jsx("dd",{children:i.recoveryReport.status??"—"})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"失败分类"}),c.jsx("dd",{children:i.recoveryReport.category??"—"})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"建议"}),c.jsx("dd",{children:i.recoveryReport.recommendation??"暂无结构化建议"})]})]}),c.jsxs("p",{className:"muted",children:["完整 Markdown 可用 CLI:",c.jsxs("code",{children:["loop-agent dag report --run-id"," ",i.recoveryReport.runId," --markdown"]})]})]}):null,c.jsx(iy,{lane:"dag",cta:i.recoveryConfirm,...d})]}),c.jsxs("div",{className:"recovery-lane","data-testid":"recovery-lane-worker",children:[c.jsx("h3",{children:"Worker Task 重排队"}),c.jsx("p",{className:"muted",children:"针对 agent-worker Task Pool,不是 DAG run。需要 Task ID;Feature ID 可选。"}),c.jsxs("label",{className:"field",children:[c.jsx("span",{className:"muted",children:"Task ID(Worker 重排队必填)"}),c.jsx("input",{"data-testid":"recovery-worker-task-id",value:l.taskId,disabled:o,onChange:u=>l.setTaskId(u.target.value.trim()),placeholder:"harness / worker task-id"})]}),c.jsxs("label",{className:"field",children:[c.jsx("span",{className:"muted",children:"Feature ID(可选)"}),c.jsx("input",{"data-testid":"recovery-feature-id",value:i.featureId,disabled:o,onChange:u=>i.setFeatureId(u.target.value.trim()),placeholder:"feature-id"})]}),c.jsx("div",{className:"recovery-cta-row","data-testid":"recovery-cta-row-worker",children:i.recoveryLanes.worker.length>0?i.recoveryLanes.worker.map(u=>c.jsxs("button",{type:"button",className:u.id===i.recommendedCtaId?"btn btn-primary":"btn btn-secondary",disabled:o,title:u.guide,"data-testid":`recovery-cta-${u.id}`,"data-recommended":u.id===i.recommendedCtaId?"true":void 0,onClick:()=>{i.handleRecoveryCta(u)},children:[u.label,u.requiresReason?" *":""]},u.id)):c.jsx("p",{className:"muted","data-testid":"recovery-worker-unavailable",children:"当前事实分类下不提供 Worker 重排队。"})}),c.jsx(iy,{lane:"worker",cta:i.recoveryConfirm,...d})]}),c.jsx("div",{className:"recovery-cta-row","data-testid":"recovery-cta-row",hidden:!0,children:i.recoveryCtas.map(u=>c.jsx("span",{children:u.id},u.id))}),i.observeLinkMessage?c.jsxs("p",{className:"muted",children:["[",GE[i.observeLinkStatus],"]"," ",i.observeLinkMessage]}):null,i.observeUrl?c.jsx("p",{className:"muted",children:c.jsx("a",{className:"external-link",href:i.observeUrl,children:i.observeUrl})}):null]})}function LN(t){const{health:r,readiness:i,healthError:l,layers:o,setupBlocked:d,degraded:u}=t;return c.jsxs(c.Fragment,{children:[c.jsxs("section",{className:"panel","aria-labelledby":"settings-title",children:[c.jsx("h2",{id:"settings-title",children:"设置"}),c.jsxs("dl",{className:"kv",children:[c.jsxs("div",{children:[c.jsx("dt",{children:"产品"}),c.jsx("dd",{children:r?.productName??"Loop Operator Console"})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"仓库根目录"}),c.jsx("dd",{children:c.jsx("code",{children:r?.repoRoot??"—"})})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"仓库指纹"}),c.jsx("dd",{children:c.jsx("code",{title:r?.repoFingerprint??void 0,children:r?.repoFingerprint?`${r.repoFingerprint.slice(0,12)}…`:"—"})})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"Pi 就绪"}),c.jsxs("dd",{children:[c.jsxs("code",{children:[Hv[i]??i,"(",i,")"]}),d?c.jsx("p",{className:"muted",children:"Pi SDK / 认证 / 模型未就绪。不提供纯表单兜底。请前往「模型与认证」。"}):u?c.jsx("p",{className:"muted",children:"Pi 暂时降级:仍可恢复草稿与需求访谈。"}):null]})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"Inspect"}),c.jsxs("dd",{children:[c.jsx("code",{children:"/inspect/"}),"(同一 Console 进程)"]})]})]}),l?c.jsx("p",{className:"error",children:l}):null]}),c.jsxs("section",{className:"panel","aria-labelledby":"layers-title",children:[c.jsx("h2",{id:"layers-title",children:"完成语义分层"}),c.jsx("p",{className:"muted",children:"MVP 不执行收尾提交;不显示「任务已关闭/已交付」。"}),c.jsxs("dl",{className:"kv","data-testid":"completion-layers",children:[c.jsxs("div",{children:[c.jsx("dt",{children:"命令"}),c.jsx("dd",{children:Ns(o.command)})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"DAG 生命周期"}),c.jsx("dd",{children:Ns(o.dag)})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"最终验证"}),c.jsx("dd",{children:Ns(o.verification)})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"晋升"}),c.jsx("dd",{children:Ns(o.promote)})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"任务关闭"}),c.jsx("dd",{children:"不可用(MVP)"})]})]})]})]})}function BN(t){const{busy:r,degraded:i,taskId:l,assessmentId:o,contractValidateOk:d,contractValidateSummary:u,contractDiffSummary:h,contractApplied:g,spineOk:p,onRerunPreflight:v,onApplyContract:y,onRetrySpine:S}=t;return c.jsxs("div",{"data-testid":"panel-contract",children:[c.jsx("h3",{children:"契约落地"}),c.jsx("p",{className:"muted",children:"进入本步后自动跑确定性校验与差异(非 AI 代判)。写入仓库仍需你人工确认一次;应用成功后会自动跑 Spine 审计。"}),c.jsxs("p",{className:"muted",children:["评估 ID: ",c.jsx("code",{children:o??"—"})]}),c.jsxs("div",{className:"contract-checks",children:[c.jsxs("p",{children:[c.jsx("strong",{children:"校验"}),":"," ",d===null?r?"进行中…":"等待开始":d?"通过":"未通过"]}),u?c.jsx("pre",{className:"cmd","data-testid":"contract-validate-summary",children:u}):null,c.jsxs("p",{children:[c.jsx("strong",{children:"差异"}),h?"":":尚未拉取"]}),h?c.jsx("pre",{className:"cmd","data-testid":"contract-diff-summary",children:h}):null,g?c.jsxs("p",{children:[c.jsx("strong",{children:"Spine"}),":"," ",p===null?"待检查":p?"通过":"未通过"]}):null]}),c.jsxs("div",{className:"cta-row",children:[c.jsx("button",{type:"button",className:"btn btn-secondary",disabled:r||!l.trim(),onClick:v,children:"重新校验"}),c.jsx("button",{type:"button",className:"btn btn-primary","data-testid":"contract-apply",disabled:r||i||!o||d!==!0||g,onClick:y,children:"确认并应用契约"}),g&&p===!1?c.jsx("button",{type:"button",className:"btn btn-primary",disabled:r,onClick:S,children:"重试 Spine"}):null]})]})}function HN(t){const{busy:r,taskId:i,confirmationId:l,confirmationDetails:o,runAction:d,onConfirmAndRun:u}=t;return c.jsxs("div",{"data-testid":"panel-dag-confirm",children:[c.jsx("h3",{children:"DAG 确认(§5.5)"}),c.jsxs("ul",{className:"checklist",children:[c.jsx("li",{children:"源绑定(source)"}),c.jsx("li",{children:"Writer 写集范围(writer-scope)"}),c.jsx("li",{children:"验证命令(verification)"}),c.jsx("li",{children:"人工门禁(human-gates)"})]}),o?c.jsx("pre",{className:"cmd",children:JSON.stringify(o,null,2).slice(0,4e3)}):null,c.jsxs("div",{className:"cta-row",children:[c.jsx("button",{type:"button",className:"btn btn-primary",disabled:r,onClick:()=>{d("prepareDagConfirmation",{taskId:i,dagHandle:`${i}.dag.json`,profile:"auto"})},children:"生成 DAG 并准备确认"}),c.jsx("button",{type:"button",className:"btn btn-primary",disabled:r||!l,onClick:u,children:"开始运行"})]}),l?c.jsxs("p",{className:"muted",children:["确认 ID: ",c.jsx("code",{children:l})]}):null]})}function UN(t){const{busy:r,taskKind:i,onTaskKindChange:l,workflowHint:o,prd:d,engineering:u,onEngineeringChange:h,onImport:g}=t,p=r||d.prdFileReading;return c.jsxs("div",{"data-testid":"panel-import-prd",children:[c.jsx("h3",{children:"导入需求"}),c.jsx("p",{className:"muted",children:"粘贴、选择或拖入一份或多份 PRD / 需求 Markdown。多文件会分别归档到 source/references,并合成一份可编辑正文。创建前可继续编辑。 系统会对 PRD 做确定性/语义结构化;工程边界(路径与验证)须人类确认,不会由模型编造。"}),c.jsxs("label",{className:"field",children:[c.jsx("span",{className:"muted",children:"流程类型"}),c.jsx("select",{"data-testid":"workflow-kind-select",value:i,disabled:r||d.prdFileReading,onChange:v=>l(v.target.value),children:ad.map(v=>c.jsx("option",{value:v.kind,children:v.label},v.kind))})]}),c.jsxs("p",{className:"workflow-hint","data-testid":"workflow-kind-hint",children:[o," · taskKind=",c.jsx("code",{children:i})]}),c.jsxs("div",{className:`prd-drop-zone${d.prdDragOver?" is-dragover":""}`,"data-testid":"prd-drop-zone","data-dragover":d.prdDragOver?"true":"false",onDragEnter:v=>d.onDragEnter(v,p),onDragOver:v=>{v.preventDefault(),v.stopPropagation()},onDragLeave:d.onDragLeave,onDrop:v=>d.onDrop(v,p),children:[c.jsxs("div",{className:"prd-upload-toolbar",children:[c.jsxs("label",{className:`btn btn-ghost prd-upload-btn${p?" is-disabled":""}`,children:["选择需求文档",c.jsx("input",{type:"file",accept:QE,multiple:!0,hidden:!0,disabled:p,"data-testid":"prd-file-input",onChange:v=>{const y=v.currentTarget;d.loadPrdFromFiles(y.files).finally(()=>{y.value=""})}})]}),c.jsxs("span",{className:"muted prd-upload-hint",children:["支持多文件 .md / .markdown / .txt,单文件最大"," ",sd(ld),",最多 ",Vs," 个"]}),d.prdDocuments.length>0?c.jsx("button",{type:"button",className:"btn btn-ghost","data-testid":"prd-recompose",disabled:p,onClick:d.recomposeDocuments,children:"按文件重新合成"}):null]}),d.prdDocuments.length>0?c.jsx("ul",{className:"prd-file-list","data-testid":"prd-file-list",children:d.prdDocuments.map((v,y)=>c.jsxs("li",{className:y===d.prdPrimaryIndex?"is-primary":void 0,"data-testid":`prd-file-item-${y}`,children:[c.jsxs("span",{className:"prd-file-item-name",children:[v.fileName,y===d.prdPrimaryIndex?c.jsx("span",{className:"prd-file-primary-tag",children:"主"}):null,c.jsxs("span",{className:"muted",children:[" ","· ",sd(v.sourceBytes)]})]}),c.jsxs("span",{className:"prd-file-item-actions",children:[c.jsx("button",{type:"button",className:"btn btn-ghost",disabled:p||y===d.prdPrimaryIndex,onClick:()=>d.setPrimaryDocument(y),children:"设为主"}),c.jsx("button",{type:"button",className:"btn btn-ghost",disabled:p||y===0,onClick:()=>d.moveDocument(y,-1),children:"上移"}),c.jsx("button",{type:"button",className:"btn btn-ghost",disabled:p||y===d.prdDocuments.length-1,onClick:()=>d.moveDocument(y,1),children:"下移"}),c.jsx("button",{type:"button",className:"btn btn-ghost",disabled:p,onClick:()=>d.removeDocument(y),children:"移除"})]})]},`${v.fileName}-${y}`))}):null,d.prdDocuments.length>0?c.jsxs("div",{className:"prd-file-meta",children:[c.jsxs("span",{children:["分卷=上传原件(将分别归档);正文=本会话采用稿",d.prdComposedDirty?"(已手动编辑)":""]}),c.jsx("button",{type:"button",className:"btn btn-ghost prd-file-clear","data-testid":"prd-file-clear",disabled:p,onClick:d.clearDocuments,children:"清除来源列表"})]}):null,d.prdDragOver?c.jsx("p",{className:"prd-drop-hint","data-testid":"prd-drop-hint",children:"释放以载入"}):null,c.jsxs("label",{className:"field prd-text-field",children:[c.jsx("span",{className:"muted",children:"PRD Markdown"}),c.jsx("textarea",{rows:10,value:d.prdText,disabled:p,"data-testid":"prd-textarea",onChange:v=>d.onPrdTextChange(v.target.value)})]})]}),d.prdFileError?c.jsx("p",{className:"prd-file-error",role:"alert","aria-live":"polite","data-testid":"prd-file-error",children:d.prdFileError}):null,c.jsxs("details",{className:"engineering-boundary","data-testid":"engineering-boundary",children:[c.jsx("summary",{children:"工程边界(可选,人类确认)"}),c.jsxs("p",{className:"muted",children:["逗号或换行分隔。留空则 intake 后进入访谈补齐;不会自动填",c.jsx("code",{children:"src/worker/console/**"})," 模板。"]}),c.jsxs("label",{className:"field",children:[c.jsx("span",{className:"muted",children:"allowedPaths"}),c.jsx("textarea",{rows:2,value:u.allowedPathsText,disabled:p,"data-testid":"prd-allowed-paths",placeholder:"src/**, test/**",onChange:v=>h({allowedPathsText:v.target.value})})]}),c.jsxs("label",{className:"field",children:[c.jsx("span",{className:"muted",children:"forbiddenPaths"}),c.jsx("textarea",{rows:2,value:u.forbiddenPathsText,disabled:p,"data-testid":"prd-forbidden-paths",placeholder:".harness/**, node_modules/**",onChange:v=>h({forbiddenPathsText:v.target.value})})]}),c.jsxs("label",{className:"field",children:[c.jsx("span",{className:"muted",children:"verifyCommands(label:command 或纯命令)"}),c.jsx("textarea",{rows:2,value:u.verifyCommandsText,disabled:p,"data-testid":"prd-verify-commands",placeholder:"typecheck:npm run typecheck",onChange:v=>h({verifyCommandsText:v.target.value})})]})]}),c.jsx("div",{className:"cta-row",children:c.jsxs("button",{type:"button",className:`btn btn-primary${r?" is-loading":""}`,disabled:r||d.prdFileReading||!d.prdText.trim(),"aria-busy":r||void 0,onClick:g,children:[r?c.jsx("span",{className:"spinner","aria-hidden":"true"}):null,r?"导入中…":"导入并创建任务"]})})]})}function qN(t){const{busy:r,taskId:i,taskTitle:l,taskKind:o,sessionId:d,question:u,answerText:h,onAnswerTextChange:g,draftSummary:p,assessmentId:v,runAction:y}=t;return c.jsxs("div",{"data-testid":"panel-interview",children:[c.jsx("h3",{children:"需求访谈(grill-me)"}),c.jsx("p",{className:"muted",children:"一次一问;也可跳过:系统会按推荐补齐草稿并签发评估,随后进入校验。 访谈中不可应用契约 / 运行 DAG / 对账。"}),p?c.jsx("pre",{className:"cmd","data-testid":"draft-summary",children:JSON.stringify(p,null,2)}):null,c.jsxs("div",{className:"cta-row",style:{marginBottom:"0.75rem"},children:[!d||!u?c.jsx("button",{type:"button",className:"btn btn-primary",disabled:r||!i.trim(),onClick:()=>{y("interviewStart",{taskId:i,title:l,taskKind:o})},children:"开始 / 继续访谈"}):null,c.jsx("button",{type:"button",className:"btn btn-ghost","data-testid":"interview-skip",disabled:r||!i.trim(),onClick:()=>{y("interviewSkip",{taskId:i,title:l,taskKind:o})},children:"跳过访谈"})]}),d&&u?c.jsxs("div",{className:"interview-card",children:[c.jsxs("p",{className:"interview-q",children:[c.jsx("strong",{children:u.id})," · 风险=",Uv[u.risk??""]??u.risk??"—"]}),c.jsx("p",{children:u.text}),u.recommendation?c.jsxs("p",{className:"muted",children:["推荐:",u.recommendation]}):null,c.jsxs("label",{className:"field",children:[c.jsx("span",{className:"muted",children:"你的回答(覆盖推荐)"}),c.jsx("textarea",{rows:3,value:h,disabled:r,onChange:S=>g(S.target.value)})]}),c.jsxs("div",{className:"cta-row",children:[c.jsx("button",{type:"button",className:"btn btn-primary",disabled:r,onClick:()=>{y("interviewTurn",{sessionId:d,questionId:u.id,response:"accept-recommendation"}).then(()=>g(""))},children:"接受推荐"}),c.jsx("button",{type:"button",className:"btn btn-primary",disabled:r||!h.trim(),onClick:()=>{y("interviewTurn",{sessionId:d,questionId:u.id,response:"override",text:h}).then(()=>g(""))},children:"提交自定义回答"}),c.jsx("button",{type:"button",className:"btn btn-secondary",disabled:r||u.risk==="high",onClick:()=>{y("interviewTurn",{sessionId:d,questionId:u.id,response:"defer",text:h||u.recommendation}).then(()=>g(""))},children:"暂缓(非高风险)"})]})]}):null,v?c.jsxs("p",{className:"muted",children:["评估 ID: ",c.jsx("code",{children:v})]}):null]})}function GN(t){const{busy:r,confirmationId:i,operationId:l,dagRunId:o,taskId:d,observeBusy:u,sseLog:h,runAction:g,onStopFollow:p,onShowInspectSplit:v,onOpenInspectSplit:y}=t;return c.jsxs("div",{"data-testid":"panel-run",children:[c.jsx("h3",{children:"运行详情"}),c.jsxs("div",{className:"meta-row",children:[c.jsxs("div",{children:["操作 ID: ",c.jsx("code",{children:l??"—"})]}),c.jsxs("div",{children:["确认 ID: ",c.jsx("code",{children:i??"—"})]})]}),c.jsxs("div",{className:"cta-row",children:[c.jsx("button",{type:"button",className:"btn btn-primary",disabled:r||!i,onClick:()=>{g("runDag",{confirmationId:i},{clientRequestId:Fs("run")})},children:"重新运行"}),c.jsx("button",{type:"button",className:"btn btn-secondary",onClick:p,children:"停止跟随日志"}),c.jsx("button",{type:"button",className:"btn btn-secondary",disabled:!o.trim(),onClick:v,children:"打开检视"}),c.jsx("button",{type:"button",className:"btn btn-ghost",disabled:u||!o.trim()&&!d.trim(),title:"在本页侧栏预览,可关闭返回",onClick:y,children:"侧栏预览"})]}),c.jsx("pre",{className:"cmd","data-testid":"sse-log",children:h.join(`
|
|
57
|
-
`)||"(尚无事件)"})]})}function $N(t){const{shell:r,actions:i,wizard:l,prd:o,recovery:d}=t,{busy:u,step:h,setupBlocked:g,degraded:p}=r;return c.jsxs("section",{className:"panel task-ops","aria-labelledby":"task-ops-title",children:[c.jsx("h2",{id:"task-ops-title",children:"任务操作"}),c.jsx("p",{className:"panel-lead",children:"按 Happy Path 推进;契约落地一步内自动校验,人工确认写入。"}),c.jsx("ol",{className:"wizard-steps","data-testid":"wizard-steps",children:l.wizardSteps.map((v,y)=>c.jsxs("li",{"data-active":h===v.id,"data-done":y<l.stepIndex,children:[c.jsx("span",{className:"step-index",children:String(y+1).padStart(2,"0")}),c.jsx("span",{className:"step-label",children:v.label})]},v.id))}),c.jsxs("label",{className:"field",children:[c.jsx("span",{className:"muted",children:"任务 ID"}),c.jsx("input",{"data-testid":"task-id-input",value:l.taskId,disabled:u||g||h==="import-prd",placeholder:h==="import-prd"?"导入需求后自动生成":"task-id",onChange:v=>l.setTaskId(v.target.value.trim())})]}),l.taskTitle?c.jsxs("p",{className:"workflow-hint","data-testid":"task-title-chip",children:["任务名称:",l.taskTitle]}):null,h!=="import-prd"&&!g?c.jsxs("p",{className:"workflow-hint","data-testid":"workflow-kind-chip",children:["当前流程:",l.workflowMeta.label," ·"," ",c.jsx("code",{children:l.taskKind})]}):null,g||h==="setup"?c.jsxs("div",{className:"empty-state","data-testid":"setup-gate",children:[c.jsx("p",{className:"empty-title",children:"需要先完成设置"}),c.jsx("p",{className:"muted",children:"请先在「模型与认证」完成 Pi 就绪,再导入需求与访谈。"}),c.jsxs("div",{className:"cta-row",children:[c.jsx("button",{type:"button",className:"btn btn-primary",disabled:u,onClick:()=>{r.selectNav("models"),i.runAction("refreshReadiness",{}).then(()=>r.loadHealth())},children:"刷新就绪状态"}),c.jsx("button",{type:"button",className:"btn btn-primary",disabled:u,onClick:()=>{i.runAction("doctor",{})},children:"运行诊断"}),c.jsx("pre",{className:"cmd",children:Bv})]})]}):c.jsxs("div",{className:"wizard-body","data-testid":"wizard-body",children:[h==="import-prd"&&c.jsx(UN,{busy:u,taskKind:l.taskKind,onTaskKindChange:l.setTaskKind,workflowHint:l.workflowMeta.hint,prd:o,engineering:l.engineering,onEngineeringChange:l.setEngineering,onImport:()=>{l.importPrdAndCreate()}}),h==="interview"&&c.jsx(qN,{busy:u,taskId:l.taskId,taskTitle:l.taskTitle,taskKind:l.taskKind,sessionId:l.sessionId,question:l.question,answerText:l.answerText,onAnswerTextChange:l.setAnswerText,draftSummary:l.draftSummary,assessmentId:l.assessmentId,runAction:i.runAction}),h==="contract"&&c.jsx(BN,{busy:u,degraded:p,taskId:l.taskId,assessmentId:l.assessmentId,contractValidateOk:l.contractValidateOk,contractValidateSummary:l.contractValidateSummary,contractDiffSummary:l.contractDiffSummary,contractApplied:l.contractApplied,spineOk:l.spineOk,onRerunPreflight:()=>{l.runContractPreflight(!0)},onApplyContract:()=>{l.applyContractThenSpine()},onRetrySpine:()=>{l.retrySpineOnly()}}),h==="dag-confirm"&&c.jsx(HN,{busy:u,taskId:l.taskId,confirmationId:i.confirmationId,confirmationDetails:i.confirmationDetails,runAction:i.runAction,onConfirmAndRun:()=>{l.confirmAndRunDag()}}),h==="run"&&c.jsx(GN,{busy:u,confirmationId:i.confirmationId,operationId:i.operationId,dagRunId:d.dagRunId,taskId:l.taskId,observeBusy:r.observeBusy,sseLog:i.sseLog,runAction:i.runAction,onStopFollow:i.stopFollowSse,onShowInspectSplit:()=>d.setInspectSplitOpen(!0),onOpenInspectSplit:()=>{d.openInspectSplit()}})]})]})}const FN={};function VN(){const t=PE(),r=k.useRef(()=>{}),i=k.useCallback(v=>r.current(v),[]),l=KE({shell:t,applyInterviewPayload:i}),o=cN(),d=RN({shell:t,actions:l,prd:o}),u=jN({shell:t,actions:l,wizard:d});k.useEffect(()=>{r.current=d.applyInterviewPayload}),k.useEffect(()=>{t.loadHealth()},[t.loadHealth]);const h=k.useCallback((v,y={})=>{t.selectNav(v),y.taskId&&d.setTaskId(y.taskId),y.dagRunId&&u.setDagRunId(y.dagRunId),y.fromNodeId&&u.setFromNodeId(y.fromNodeId),y.featureId&&u.setFeatureId(y.featureId);const S=Ry(v,y);window.location.hash.replace(/^#/,"")!==S&&(window.location.hash=S)},[t.selectNav,d.setTaskId,u.setDagRunId,u.setFromNodeId,u.setFeatureId]),g=k.useCallback(()=>{const v=LS(window.location);if(v){h(v.workspace,v);return}const y=jy({env:FN?.VITE_OPERATOR_CHAT_DEFAULT_LANDING,storage:window.localStorage,location:window.location});h(y,{})},[h]);k.useEffect(()=>(g(),window.addEventListener("hashchange",g),()=>window.removeEventListener("hashchange",g)),[g]);const p=t.nav==="recovery"&&u.dagRunId.trim()?`/inspect/#/dag/${encodeURIComponent(u.dagRunId.trim())}?from=recovery`:"/inspect/#/";return c.jsx(c.Fragment,{children:c.jsxs("div",{className:`console-app${t.nav==="chat"?" is-chat-focus":""}`,children:[c.jsx(IN,{nav:t.nav,readiness:t.readiness,setupBlocked:t.setupBlocked,degraded:t.degraded,health:t.health,inspectHref:p}),c.jsxs("div",{className:`console-shell${t.nav==="chat"?" is-chat-focus":""}`,children:[c.jsx(DN,{opError:t.opError,opMessage:t.opMessage}),c.jsxs("main",{className:`console-main${t.nav==="chat"?" console-main--fill":""}`,children:[t.nav==="tasks"?c.jsx($N,{shell:t,actions:l,wizard:d,prd:o,recovery:u}):null,t.nav==="recovery"?c.jsx(_N,{shell:t,recovery:u,wizard:d}):null,t.nav==="night"?c.jsx(A1,{busy:t.busy,runAction:l.runAction,isActionSuccess:l.isActionSuccess,setOpError:t.setOpError}):null,t.nav==="models"?c.jsx(zN,{busy:t.busy,readiness:t.readiness,readinessReport:t.readinessReport,health:t.health,onRefreshReadiness:()=>{l.runAction("refreshReadiness",{}).then(()=>t.loadHealth())}}):null,t.nav==="chat"?c.jsxs("section",{className:"panel panel--chat","aria-labelledby":"chat-title",children:[c.jsx("h2",{id:"chat-title",className:"sr-only",children:"对话"}),c.jsx(UE,{origin:"",readiness:t.readiness,surface:"workspace",onNavigateWorkspace:h})]}):null,t.nav==="settings"?c.jsx(LN,{health:t.health,readiness:t.readiness,healthError:t.healthError,layers:t.layers,setupBlocked:t.setupBlocked,degraded:t.degraded}):null]}),u.inspectSplitOpen&&u.dagRunId.trim()?c.jsx(y1,{dagRunId:u.dagRunId.trim(),nodeId:u.fromNodeId.trim()||void 0,onClose:()=>u.setInspectSplitOpen(!1),onOpenFull:u.openFullInspect}):null]})]})})}const Yv=document.getElementById("root");if(!Yv)throw new Error("Loop Operator Console: #root missing");p1.createRoot(Yv).render(c.jsx(k.StrictMode,{children:c.jsx(VN,{})}));
|