clinkx 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -1
- package/README.md +210 -177
- package/clinkx-workflows/dist/architecture-comparison/admission.d.ts +5 -0
- package/clinkx-workflows/dist/architecture-comparison/admission.js +50 -0
- package/clinkx-workflows/dist/architecture-comparison/admission.js.map +1 -0
- package/clinkx-workflows/dist/architecture-comparison/contract.d.ts +995 -0
- package/clinkx-workflows/dist/architecture-comparison/contract.js +149 -0
- package/clinkx-workflows/dist/architecture-comparison/contract.js.map +1 -0
- package/clinkx-workflows/dist/architecture-comparison/runtime.d.ts +29 -0
- package/clinkx-workflows/dist/architecture-comparison/runtime.js +387 -0
- package/clinkx-workflows/dist/architecture-comparison/runtime.js.map +1 -0
- package/clinkx-workflows/dist/contained-file.js +1 -1
- package/clinkx-workflows/dist/contained-file.js.map +1 -1
- package/clinkx-workflows/dist/council-execution-policy.d.ts +4 -2
- package/clinkx-workflows/dist/council-execution-policy.js +5 -1
- package/clinkx-workflows/dist/council-execution-policy.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/activity-contract.d.ts +72 -72
- package/clinkx-workflows/dist/dashboard/contracts.d.ts +1564 -122
- package/clinkx-workflows/dist/dashboard/contracts.js +4 -0
- package/clinkx-workflows/dist/dashboard/contracts.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/progress-report-contract.d.ts +12 -12
- package/clinkx-workflows/dist/dashboard/progress-report-status-overlay.d.ts +8 -8
- package/clinkx-workflows/dist/dashboard/scanner.d.ts +3 -0
- package/clinkx-workflows/dist/dashboard/scanner.js +27 -0
- package/clinkx-workflows/dist/dashboard/scanner.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/session-log-contract.d.ts +48 -48
- package/clinkx-workflows/dist/dashboard/session-log-redaction.d.ts +2 -0
- package/clinkx-workflows/dist/dashboard/session-log-redaction.js +4 -0
- package/clinkx-workflows/dist/dashboard/session-log-redaction.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/verified-repair-contract.d.ts +191 -0
- package/clinkx-workflows/dist/dashboard/verified-repair-contract.js +28 -0
- package/clinkx-workflows/dist/dashboard/verified-repair-contract.js.map +1 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/index-BdpmbPps.js +115 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/style-Im5i1iAs.css +1 -0
- package/clinkx-workflows/dist/dashboard-ui/index.html +2 -2
- package/clinkx-workflows/dist/engine.d.ts +6 -0
- package/clinkx-workflows/dist/engine.js +78 -7
- package/clinkx-workflows/dist/engine.js.map +1 -1
- package/clinkx-workflows/dist/index.d.ts +3 -0
- package/clinkx-workflows/dist/index.js +3 -2
- package/clinkx-workflows/dist/index.js.map +1 -1
- package/clinkx-workflows/dist/reducers/index.d.ts +9 -1
- package/clinkx-workflows/dist/reducers/index.js +22 -0
- package/clinkx-workflows/dist/reducers/index.js.map +1 -1
- package/clinkx-workflows/dist/state.js +17 -7
- package/clinkx-workflows/dist/state.js.map +1 -1
- package/clinkx-workflows/dist/validators/architecture-comparison.d.ts +2 -0
- package/clinkx-workflows/dist/validators/architecture-comparison.js +12 -0
- package/clinkx-workflows/dist/validators/architecture-comparison.js.map +1 -0
- package/clinkx-workflows/dist/validators/index.js +4 -0
- package/clinkx-workflows/dist/validators/index.js.map +1 -1
- package/clinkx-workflows/dist/validators/verified-repair.d.ts +2 -0
- package/clinkx-workflows/dist/validators/verified-repair.js +12 -0
- package/clinkx-workflows/dist/validators/verified-repair.js.map +1 -0
- package/clinkx-workflows/dist/verification-proof.d.ts +254 -0
- package/clinkx-workflows/dist/verification-proof.js +195 -0
- package/clinkx-workflows/dist/verification-proof.js.map +1 -0
- package/clinkx-workflows/dist/verified-repair/admission.d.ts +72 -0
- package/clinkx-workflows/dist/verified-repair/admission.js +63 -0
- package/clinkx-workflows/dist/verified-repair/admission.js.map +1 -0
- package/clinkx-workflows/dist/verified-repair/contract.d.ts +1910 -0
- package/clinkx-workflows/dist/verified-repair/contract.js +127 -0
- package/clinkx-workflows/dist/verified-repair/contract.js.map +1 -0
- package/clinkx-workflows/dist/verified-repair/host.d.ts +32 -0
- package/clinkx-workflows/dist/verified-repair/host.js +2 -0
- package/clinkx-workflows/dist/verified-repair/host.js.map +1 -0
- package/clinkx-workflows/dist/verified-repair/prompts.d.ts +12 -0
- package/clinkx-workflows/dist/verified-repair/prompts.js +58 -0
- package/clinkx-workflows/dist/verified-repair/prompts.js.map +1 -0
- package/clinkx-workflows/dist/verified-repair/result.d.ts +16 -0
- package/clinkx-workflows/dist/verified-repair/result.js +102 -0
- package/clinkx-workflows/dist/verified-repair/result.js.map +1 -0
- package/clinkx-workflows/dist/verified-repair/runtime.d.ts +28 -0
- package/clinkx-workflows/dist/verified-repair/runtime.js +186 -0
- package/clinkx-workflows/dist/verified-repair/runtime.js.map +1 -0
- package/clinkx-workflows/dist/workflow-tools.d.ts +3 -0
- package/clinkx-workflows/dist/workflow-tools.js +148 -14
- package/clinkx-workflows/dist/workflow-tools.js.map +1 -1
- package/clinkx-workflows/dist/workflow-verification-contract.d.ts +539 -0
- package/clinkx-workflows/dist/workflow-verification-contract.js +52 -0
- package/clinkx-workflows/dist/workflow-verification-contract.js.map +1 -0
- package/clinkx-workflows/dist/workflow-verification.d.ts +15 -0
- package/clinkx-workflows/dist/workflow-verification.js +218 -0
- package/clinkx-workflows/dist/workflow-verification.js.map +1 -0
- package/clinkx-workflows/templates/architecture-comparison/candidate.txt +29 -0
- package/clinkx-workflows/templates/architecture-comparison/judge.txt +31 -0
- package/clinkx-workflows/templates/verified-repair/investigate.txt +20 -0
- package/clinkx-workflows/templates/verified-repair/repair.txt +11 -0
- package/clinkx-workflows/templates/verified-repair/review.txt +18 -0
- package/clinkx-workflows/workflows/architecture-comparison.yaml +133 -0
- package/clinkx-workflows/workflows/verified-repair.yaml +104 -0
- package/dist/allowed-roots.js +4 -1
- package/dist/allowed-roots.js.map +1 -1
- package/dist/codex/app-server-client.d.ts +1 -0
- package/dist/codex/app-server-client.js +3 -2
- package/dist/codex/app-server-client.js.map +1 -1
- package/dist/context-builder/diagnostics.d.ts +1 -0
- package/dist/context-builder/diagnostics.js +1 -1
- package/dist/context-builder/diagnostics.js.map +1 -1
- package/dist/context-builder/discovery.d.ts +18 -1
- package/dist/context-builder/discovery.js +69 -1
- package/dist/context-builder/discovery.js.map +1 -1
- package/dist/context-builder/handler.js +8 -1
- package/dist/context-builder/handler.js.map +1 -1
- package/dist/context-builder/lifecycle-contract.d.ts +24 -24
- package/dist/context-builder/refine-handler.js +16 -1
- package/dist/context-builder/refine-handler.js.map +1 -1
- package/dist/context-builder/secrets.d.ts +11 -0
- package/dist/context-builder/secrets.js +81 -1
- package/dist/context-builder/secrets.js.map +1 -1
- package/dist/context-builder/versions.d.ts +5 -2
- package/dist/context-builder/versions.js +5 -2
- package/dist/context-builder/versions.js.map +1 -1
- package/dist/dashboard-cli.js +10 -3
- package/dist/dashboard-cli.js.map +1 -1
- package/dist/dashboard-gateway/main.js +8 -3
- package/dist/dashboard-gateway/main.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/dist/project-verification/contract.d.ts +537 -0
- package/dist/project-verification/contract.js +40 -0
- package/dist/project-verification/contract.js.map +1 -0
- package/dist/project-verification/files.d.ts +23 -0
- package/dist/project-verification/files.js +80 -0
- package/dist/project-verification/files.js.map +1 -0
- package/dist/project-verification/process.d.ts +7 -0
- package/dist/project-verification/process.js +115 -0
- package/dist/project-verification/process.js.map +1 -0
- package/dist/project-verification/runner.d.ts +35 -0
- package/dist/project-verification/runner.js +185 -0
- package/dist/project-verification/runner.js.map +1 -0
- package/dist/project-verification/service.d.ts +37 -0
- package/dist/project-verification/service.js +151 -0
- package/dist/project-verification/service.js.map +1 -0
- package/dist/provider-doctor.d.ts +22 -0
- package/dist/provider-doctor.js +22 -0
- package/dist/provider-doctor.js.map +1 -0
- package/dist/server.js +29 -1
- package/dist/server.js.map +1 -1
- package/dist/verification-tools.d.ts +90 -0
- package/dist/verification-tools.js +120 -0
- package/dist/verification-tools.js.map +1 -0
- package/dist/verified-repair/files.d.ts +22 -0
- package/dist/verified-repair/files.js +114 -0
- package/dist/verified-repair/files.js.map +1 -0
- package/dist/verified-repair/host.d.ts +14 -0
- package/dist/verified-repair/host.js +612 -0
- package/dist/verified-repair/host.js.map +1 -0
- package/docs/configuration.md +493 -0
- package/docs/engineering-recipes.md +415 -0
- package/docs/security.md +293 -0
- package/docs/verification/README.md +59 -0
- package/docs/verification/dashboard-real-disk.md +436 -0
- package/docs/verification/project-checks.example.json +14 -0
- package/docs/verification/project-checks.md +444 -0
- package/docs/verification/workflow-handoff.md +113 -0
- package/package.json +13 -6
- package/scripts/provider-doctor-core.mjs +364 -0
- package/scripts/provider-doctor-probe.mjs +34 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/index-JPHQVtn9.js +0 -106
- package/clinkx-workflows/dist/dashboard-ui/assets/style-DOMHk-j6.css +0 -1
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
var Tp={exports:{}},No={};var Tv;function vj(){if(Tv)return No;Tv=1;var t=Symbol.for("react.transitional.element"),a=Symbol.for("react.fragment");function i(r,c,f){var p=null;if(f!==void 0&&(p=""+f),c.key!==void 0&&(p=""+c.key),"key"in c){f={};for(var h in c)h!=="key"&&(f[h]=c[h])}else f=c;return c=f.ref,{$$typeof:t,type:r,key:p,ref:c!==void 0?c:null,props:f}}return No.Fragment=a,No.jsx=i,No.jsxs=i,No}var Cv;function bj(){return Cv||(Cv=1,Tp.exports=vj()),Tp.exports}var l=bj(),Cp={exports:{}},Ke={};var Ov;function yj(){if(Ov)return Ke;Ov=1;var t=Symbol.for("react.transitional.element"),a=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),f=Symbol.for("react.consumer"),p=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),v=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),E=Symbol.iterator;function S(j){return j===null||typeof j!="object"?null:(j=E&&j[E]||j["@@iterator"],typeof j=="function"?j:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},T=Object.assign,N={};function M(j,L,U){this.props=j,this.context=L,this.refs=N,this.updater=U||C}M.prototype.isReactComponent={},M.prototype.setState=function(j,L){if(typeof j!="object"&&typeof j!="function"&&j!=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,j,L,"setState")},M.prototype.forceUpdate=function(j){this.updater.enqueueForceUpdate(this,j,"forceUpdate")};function k(){}k.prototype=M.prototype;function z(j,L,U){this.props=j,this.context=L,this.refs=N,this.updater=U||C}var R=z.prototype=new k;R.constructor=z,T(R,M.prototype),R.isPureReactComponent=!0;var B=Array.isArray;function q(){}var Z={H:null,A:null,T:null,S:null},ae=Object.prototype.hasOwnProperty;function oe(j,L,U){var Q=U.ref;return{$$typeof:t,type:j,key:L,ref:Q!==void 0?Q:null,props:U}}function P(j,L){return oe(j.type,L,j.props)}function ue(j){return typeof j=="object"&&j!==null&&j.$$typeof===t}function _e(j){var L={"=":"=0",":":"=2"};return"$"+j.replace(/[=:]/g,function(U){return L[U]})}var me=/\/+/g;function be(j,L){return typeof j=="object"&&j!==null&&j.key!=null?_e(""+j.key):L.toString(36)}function ve(j){switch(j.status){case"fulfilled":return j.value;case"rejected":throw j.reason;default:switch(typeof j.status=="string"?j.then(q,q):(j.status="pending",j.then(function(L){j.status==="pending"&&(j.status="fulfilled",j.value=L)},function(L){j.status==="pending"&&(j.status="rejected",j.reason=L)})),j.status){case"fulfilled":return j.value;case"rejected":throw j.reason}}throw j}function $(j,L,U,Q,he){var F=typeof j;(F==="undefined"||F==="boolean")&&(j=null);var ge=!1;if(j===null)ge=!0;else switch(F){case"bigint":case"string":case"number":ge=!0;break;case"object":switch(j.$$typeof){case t:case a:ge=!0;break;case x:return ge=j._init,$(ge(j._payload),L,U,Q,he)}}if(ge)return he=he(j),ge=Q===""?"."+be(j,0):Q,B(he)?(U="",ge!=null&&(U=ge.replace(me,"$&/")+"/"),$(he,L,U,"",function(Re){return Re})):he!=null&&(ue(he)&&(he=P(he,U+(he.key==null||j&&j.key===he.key?"":(""+he.key).replace(me,"$&/")+"/")+ge)),L.push(he)),1;ge=0;var Ve=Q===""?".":Q+":";if(B(j))for(var Se=0;Se<j.length;Se++)Q=j[Se],F=Ve+be(Q,Se),ge+=$(Q,L,U,F,he);else if(Se=S(j),typeof Se=="function")for(j=Se.call(j),Se=0;!(Q=j.next()).done;)Q=Q.value,F=Ve+be(Q,Se++),ge+=$(Q,L,U,F,he);else if(F==="object"){if(typeof j.then=="function")return $(ve(j),L,U,Q,he);throw L=String(j),Error("Objects are not valid as a React child (found: "+(L==="[object Object]"?"object with keys {"+Object.keys(j).join(", ")+"}":L)+"). If you meant to render a collection of children, use an array instead.")}return ge}function ee(j,L,U){if(j==null)return j;var Q=[],he=0;return $(j,Q,"","",function(F){return L.call(U,F,he++)}),Q}function ce(j){if(j._status===-1){var L=j._result;L=L(),L.then(function(U){(j._status===0||j._status===-1)&&(j._status=1,j._result=U)},function(U){(j._status===0||j._status===-1)&&(j._status=2,j._result=U)}),j._status===-1&&(j._status=0,j._result=L)}if(j._status===1)return j._result.default;throw j._result}var de=typeof reportError=="function"?reportError:function(j){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var L=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof j=="object"&&j!==null&&typeof j.message=="string"?String(j.message):String(j),error:j});if(!window.dispatchEvent(L))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",j);return}console.error(j)},ye={map:ee,forEach:function(j,L,U){ee(j,function(){L.apply(this,arguments)},U)},count:function(j){var L=0;return ee(j,function(){L++}),L},toArray:function(j){return ee(j,function(L){return L})||[]},only:function(j){if(!ue(j))throw Error("React.Children.only expected to receive a single React element child.");return j}};return Ke.Activity=y,Ke.Children=ye,Ke.Component=M,Ke.Fragment=i,Ke.Profiler=c,Ke.PureComponent=z,Ke.StrictMode=r,Ke.Suspense=v,Ke.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Z,Ke.__COMPILER_RUNTIME={__proto__:null,c:function(j){return Z.H.useMemoCache(j)}},Ke.cache=function(j){return function(){return j.apply(null,arguments)}},Ke.cacheSignal=function(){return null},Ke.cloneElement=function(j,L,U){if(j==null)throw Error("The argument must be a React element, but you passed "+j+".");var Q=T({},j.props),he=j.key;if(L!=null)for(F in L.key!==void 0&&(he=""+L.key),L)!ae.call(L,F)||F==="key"||F==="__self"||F==="__source"||F==="ref"&&L.ref===void 0||(Q[F]=L[F]);var F=arguments.length-2;if(F===1)Q.children=U;else if(1<F){for(var ge=Array(F),Ve=0;Ve<F;Ve++)ge[Ve]=arguments[Ve+2];Q.children=ge}return oe(j.type,he,Q)},Ke.createContext=function(j){return j={$$typeof:p,_currentValue:j,_currentValue2:j,_threadCount:0,Provider:null,Consumer:null},j.Provider=j,j.Consumer={$$typeof:f,_context:j},j},Ke.createElement=function(j,L,U){var Q,he={},F=null;if(L!=null)for(Q in L.key!==void 0&&(F=""+L.key),L)ae.call(L,Q)&&Q!=="key"&&Q!=="__self"&&Q!=="__source"&&(he[Q]=L[Q]);var ge=arguments.length-2;if(ge===1)he.children=U;else if(1<ge){for(var Ve=Array(ge),Se=0;Se<ge;Se++)Ve[Se]=arguments[Se+2];he.children=Ve}if(j&&j.defaultProps)for(Q in ge=j.defaultProps,ge)he[Q]===void 0&&(he[Q]=ge[Q]);return oe(j,F,he)},Ke.createRef=function(){return{current:null}},Ke.forwardRef=function(j){return{$$typeof:h,render:j}},Ke.isValidElement=ue,Ke.lazy=function(j){return{$$typeof:x,_payload:{_status:-1,_result:j},_init:ce}},Ke.memo=function(j,L){return{$$typeof:m,type:j,compare:L===void 0?null:L}},Ke.startTransition=function(j){var L=Z.T,U={};Z.T=U;try{var Q=j(),he=Z.S;he!==null&&he(U,Q),typeof Q=="object"&&Q!==null&&typeof Q.then=="function"&&Q.then(q,de)}catch(F){de(F)}finally{L!==null&&U.types!==null&&(L.types=U.types),Z.T=L}},Ke.unstable_useCacheRefresh=function(){return Z.H.useCacheRefresh()},Ke.use=function(j){return Z.H.use(j)},Ke.useActionState=function(j,L,U){return Z.H.useActionState(j,L,U)},Ke.useCallback=function(j,L){return Z.H.useCallback(j,L)},Ke.useContext=function(j){return Z.H.useContext(j)},Ke.useDebugValue=function(){},Ke.useDeferredValue=function(j,L){return Z.H.useDeferredValue(j,L)},Ke.useEffect=function(j,L){return Z.H.useEffect(j,L)},Ke.useEffectEvent=function(j){return Z.H.useEffectEvent(j)},Ke.useId=function(){return Z.H.useId()},Ke.useImperativeHandle=function(j,L,U){return Z.H.useImperativeHandle(j,L,U)},Ke.useInsertionEffect=function(j,L){return Z.H.useInsertionEffect(j,L)},Ke.useLayoutEffect=function(j,L){return Z.H.useLayoutEffect(j,L)},Ke.useMemo=function(j,L){return Z.H.useMemo(j,L)},Ke.useOptimistic=function(j,L){return Z.H.useOptimistic(j,L)},Ke.useReducer=function(j,L,U){return Z.H.useReducer(j,L,U)},Ke.useRef=function(j){return Z.H.useRef(j)},Ke.useState=function(j){return Z.H.useState(j)},Ke.useSyncExternalStore=function(j,L,U){return Z.H.useSyncExternalStore(j,L,U)},Ke.useTransition=function(){return Z.H.useTransition()},Ke.version="19.2.7",Ke}var $v;function Mh(){return $v||($v=1,Cp.exports=yj()),Cp.exports}var b=Mh(),Op={exports:{}},ko={},$p={exports:{}},Mp={};var Mv;function xj(){return Mv||(Mv=1,(function(t){function a($,ee){var ce=$.length;$.push(ee);e:for(;0<ce;){var de=ce-1>>>1,ye=$[de];if(0<c(ye,ee))$[de]=ee,$[ce]=ye,ce=de;else break e}}function i($){return $.length===0?null:$[0]}function r($){if($.length===0)return null;var ee=$[0],ce=$.pop();if(ce!==ee){$[0]=ce;e:for(var de=0,ye=$.length,j=ye>>>1;de<j;){var L=2*(de+1)-1,U=$[L],Q=L+1,he=$[Q];if(0>c(U,ce))Q<ye&&0>c(he,U)?($[de]=he,$[Q]=ce,de=Q):($[de]=U,$[L]=ce,de=L);else if(Q<ye&&0>c(he,ce))$[de]=he,$[Q]=ce,de=Q;else break e}}return ee}function c($,ee){var ce=$.sortIndex-ee.sortIndex;return ce!==0?ce:$.id-ee.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;t.unstable_now=function(){return f.now()}}else{var p=Date,h=p.now();t.unstable_now=function(){return p.now()-h}}var v=[],m=[],x=1,y=null,E=3,S=!1,C=!1,T=!1,N=!1,M=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,z=typeof setImmediate<"u"?setImmediate:null;function R($){for(var ee=i(m);ee!==null;){if(ee.callback===null)r(m);else if(ee.startTime<=$)r(m),ee.sortIndex=ee.expirationTime,a(v,ee);else break;ee=i(m)}}function B($){if(T=!1,R($),!C)if(i(v)!==null)C=!0,q||(q=!0,_e());else{var ee=i(m);ee!==null&&ve(B,ee.startTime-$)}}var q=!1,Z=-1,ae=5,oe=-1;function P(){return N?!0:!(t.unstable_now()-oe<ae)}function ue(){if(N=!1,q){var $=t.unstable_now();oe=$;var ee=!0;try{e:{C=!1,T&&(T=!1,k(Z),Z=-1),S=!0;var ce=E;try{t:{for(R($),y=i(v);y!==null&&!(y.expirationTime>$&&P());){var de=y.callback;if(typeof de=="function"){y.callback=null,E=y.priorityLevel;var ye=de(y.expirationTime<=$);if($=t.unstable_now(),typeof ye=="function"){y.callback=ye,R($),ee=!0;break t}y===i(v)&&r(v),R($)}else r(v);y=i(v)}if(y!==null)ee=!0;else{var j=i(m);j!==null&&ve(B,j.startTime-$),ee=!1}}break e}finally{y=null,E=ce,S=!1}ee=void 0}}finally{ee?_e():q=!1}}}var _e;if(typeof z=="function")_e=function(){z(ue)};else if(typeof MessageChannel<"u"){var me=new MessageChannel,be=me.port2;me.port1.onmessage=ue,_e=function(){be.postMessage(null)}}else _e=function(){M(ue,0)};function ve($,ee){Z=M(function(){$(t.unstable_now())},ee)}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($){$.callback=null},t.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):ae=0<$?Math.floor(1e3/$):5},t.unstable_getCurrentPriorityLevel=function(){return E},t.unstable_next=function($){switch(E){case 1:case 2:case 3:var ee=3;break;default:ee=E}var ce=E;E=ee;try{return $()}finally{E=ce}},t.unstable_requestPaint=function(){N=!0},t.unstable_runWithPriority=function($,ee){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var ce=E;E=$;try{return ee()}finally{E=ce}},t.unstable_scheduleCallback=function($,ee,ce){var de=t.unstable_now();switch(typeof ce=="object"&&ce!==null?(ce=ce.delay,ce=typeof ce=="number"&&0<ce?de+ce:de):ce=de,$){case 1:var ye=-1;break;case 2:ye=250;break;case 5:ye=1073741823;break;case 4:ye=1e4;break;default:ye=5e3}return ye=ce+ye,$={id:x++,callback:ee,priorityLevel:$,startTime:ce,expirationTime:ye,sortIndex:-1},ce>de?($.sortIndex=ce,a(m,$),i(v)===null&&$===i(m)&&(T?(k(Z),Z=-1):T=!0,ve(B,ce-de))):($.sortIndex=ye,a(v,$),C||S||(C=!0,q||(q=!0,_e()))),$},t.unstable_shouldYield=P,t.unstable_wrapCallback=function($){var ee=E;return function(){var ce=E;E=ee;try{return $.apply(this,arguments)}finally{E=ce}}}})(Mp)),Mp}var Lv;function wj(){return Lv||(Lv=1,$p.exports=xj()),$p.exports}var Lp={exports:{}},In={};var Iv;function jj(){if(Iv)return In;Iv=1;var t=Mh();function a(v){var m="https://react.dev/errors/"+v;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var x=2;x<arguments.length;x++)m+="&args[]="+encodeURIComponent(arguments[x])}return"Minified React error #"+v+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var r={d:{f:i,r:function(){throw Error(a(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},c=Symbol.for("react.portal");function f(v,m,x){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:y==null?null:""+y,children:v,containerInfo:m,implementation:x}}var p=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(v,m){if(v==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return In.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,In.createPortal=function(v,m){var x=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(a(299));return f(v,m,null,x)},In.flushSync=function(v){var m=p.T,x=r.p;try{if(p.T=null,r.p=2,v)return v()}finally{p.T=m,r.p=x,r.d.f()}},In.preconnect=function(v,m){typeof v=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,r.d.C(v,m))},In.prefetchDNS=function(v){typeof v=="string"&&r.d.D(v)},In.preinit=function(v,m){if(typeof v=="string"&&m&&typeof m.as=="string"){var x=m.as,y=h(x,m.crossOrigin),E=typeof m.integrity=="string"?m.integrity:void 0,S=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;x==="style"?r.d.S(v,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:y,integrity:E,fetchPriority:S}):x==="script"&&r.d.X(v,{crossOrigin:y,integrity:E,fetchPriority:S,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},In.preinitModule=function(v,m){if(typeof v=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var x=h(m.as,m.crossOrigin);r.d.M(v,{crossOrigin:x,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&r.d.M(v)},In.preload=function(v,m){if(typeof v=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var x=m.as,y=h(x,m.crossOrigin);r.d.L(v,x,{crossOrigin:y,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},In.preloadModule=function(v,m){if(typeof v=="string")if(m){var x=h(m.as,m.crossOrigin);r.d.m(v,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:x,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else r.d.m(v)},In.requestFormReset=function(v){r.d.r(v)},In.unstable_batchedUpdates=function(v,m){return v(m)},In.useFormState=function(v,m,x){return p.H.useFormState(v,m,x)},In.useFormStatus=function(){return p.H.useHostTransitionStatus()},In.version="19.2.7",In}var Dv;function zy(){if(Dv)return Lp.exports;Dv=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(a){console.error(a)}}return t(),Lp.exports=jj(),Lp.exports}var zv;function Sj(){if(zv)return ko;zv=1;var t=wj(),a=Mh(),i=zy();function r(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var s=2;s<arguments.length;s++)n+="&args[]="+encodeURIComponent(arguments[s])}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 c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function f(e){var n=e,s=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(s=n.return),e=n.return;while(e)}return n.tag===3?s:null}function p(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 v(e){if(f(e)!==e)throw Error(r(188))}function m(e){var n=e.alternate;if(!n){if(n=f(e),n===null)throw Error(r(188));return n!==e?null:e}for(var s=e,o=n;;){var u=s.return;if(u===null)break;var d=u.alternate;if(d===null){if(o=u.return,o!==null){s=o;continue}break}if(u.child===d.child){for(d=u.child;d;){if(d===s)return v(u),e;if(d===o)return v(u),n;d=d.sibling}throw Error(r(188))}if(s.return!==o.return)s=u,o=d;else{for(var _=!1,w=u.child;w;){if(w===s){_=!0,s=u,o=d;break}if(w===o){_=!0,o=u,s=d;break}w=w.sibling}if(!_){for(w=d.child;w;){if(w===s){_=!0,s=d,o=u;break}if(w===o){_=!0,o=d,s=u;break}w=w.sibling}if(!_)throw Error(r(189))}}if(s.alternate!==o)throw Error(r(190))}if(s.tag!==3)throw Error(r(188));return s.stateNode.current===s?e:n}function x(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=x(e),n!==null)return n;e=e.sibling}return null}var y=Object.assign,E=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),k=Symbol.for("react.consumer"),z=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),q=Symbol.for("react.suspense_list"),Z=Symbol.for("react.memo"),ae=Symbol.for("react.lazy"),oe=Symbol.for("react.activity"),P=Symbol.for("react.memo_cache_sentinel"),ue=Symbol.iterator;function _e(e){return e===null||typeof e!="object"?null:(e=ue&&e[ue]||e["@@iterator"],typeof e=="function"?e:null)}var me=Symbol.for("react.client.reference");function be(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===me?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case T:return"Fragment";case M:return"Profiler";case N:return"StrictMode";case B:return"Suspense";case q:return"SuspenseList";case oe:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case C:return"Portal";case z:return e.displayName||"Context";case k:return(e._context.displayName||"Context")+".Consumer";case R:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Z:return n=e.displayName||null,n!==null?n:be(e.type)||"Memo";case ae:n=e._payload,e=e._init;try{return be(e(n))}catch{}}return null}var ve=Array.isArray,$=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ce={pending:!1,data:null,method:null,action:null},de=[],ye=-1;function j(e){return{current:e}}function L(e){0>ye||(e.current=de[ye],de[ye]=null,ye--)}function U(e,n){ye++,de[ye]=e.current,e.current=n}var Q=j(null),he=j(null),F=j(null),ge=j(null);function Ve(e,n){switch(U(F,n),U(he,e),U(Q,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?W_(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=W_(n),e=ev(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}L(Q),U(Q,e)}function Se(){L(Q),L(he),L(F)}function Re(e){e.memoizedState!==null&&U(ge,e);var n=Q.current,s=ev(n,e.type);n!==s&&(U(he,e),U(Q,s))}function Pe(e){he.current===e&&(L(Q),L(he)),ge.current===e&&(L(ge),xo._currentValue=ce)}var Gt,Vt;function kt(e){if(Gt===void 0)try{throw Error()}catch(s){var n=s.stack.trim().match(/\n( *(at )?)/);Gt=n&&n[1]||"",Vt=-1<s.stack.indexOf(`
|
|
2
|
-
at`)?" (<anonymous>)":-1<s.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
-
`+Gt+e+Vt}var Xt=!1;function $t(e,n){if(!e||Xt)return"";Xt=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(n){var re=function(){throw Error()};if(Object.defineProperty(re.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(re,[])}catch(X){var Y=X}Reflect.construct(e,[],re)}else{try{re.call()}catch(X){Y=X}e.call(re.prototype)}}else{try{throw Error()}catch(X){Y=X}(re=e())&&typeof re.catch=="function"&&re.catch(function(){})}}catch(X){if(X&&Y&&typeof X.stack=="string")return[X.stack,Y.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var d=o.DetermineComponentFrameRoot(),_=d[0],w=d[1];if(_&&w){var O=_.split(`
|
|
4
|
-
`),K=w.split(`
|
|
5
|
-
`);for(u=o=0;o<O.length&&!O[o].includes("DetermineComponentFrameRoot");)o++;for(;u<K.length&&!K[u].includes("DetermineComponentFrameRoot");)u++;if(o===O.length||u===K.length)for(o=O.length-1,u=K.length-1;1<=o&&0<=u&&O[o]!==K[u];)u--;for(;1<=o&&0<=u;o--,u--)if(O[o]!==K[u]){if(o!==1||u!==1)do if(o--,u--,0>u||O[o]!==K[u]){var J=`
|
|
6
|
-
`+O[o].replace(" at new "," at ");return e.displayName&&J.includes("<anonymous>")&&(J=J.replace("<anonymous>",e.displayName)),J}while(1<=o&&0<=u);break}}}finally{Xt=!1,Error.prepareStackTrace=s}return(s=e?e.displayName||e.name:"")?kt(s):""}function Pt(e,n){switch(e.tag){case 26:case 27:case 5:return kt(e.type);case 16:return kt("Lazy");case 13:return e.child!==n&&n!==null?kt("Suspense Fallback"):kt("Suspense");case 19:return kt("SuspenseList");case 0:case 15:return $t(e.type,!1);case 11:return $t(e.type.render,!1);case 1:return $t(e.type,!0);case 31:return kt("Activity");default:return""}}function Qt(e){try{var n="",s=null;do n+=Pt(e,s),s=e,e=e.return;while(e);return n}catch(o){return`
|
|
7
|
-
Error generating stack: `+o.message+`
|
|
8
|
-
`+o.stack}}var Kt=Object.prototype.hasOwnProperty,sn=t.unstable_scheduleCallback,Mn=t.unstable_cancelCallback,ln=t.unstable_shouldYield,Jt=t.unstable_requestPaint,lt=t.unstable_now,Be=t.unstable_getCurrentPriorityLevel,le=t.unstable_ImmediatePriority,Ae=t.unstable_UserBlockingPriority,Le=t.unstable_NormalPriority,qe=t.unstable_LowPriority,it=t.unstable_IdlePriority,Et=t.log,ut=t.unstable_setDisableYieldValue,Qe=null,dt=null;function wt(e){if(typeof Et=="function"&&ut(e),dt&&typeof dt.setStrictMode=="function")try{dt.setStrictMode(Qe,e)}catch{}}var Tt=Math.clz32?Math.clz32:hn,pn=Math.log,kn=Math.LN2;function hn(e){return e>>>=0,e===0?32:31-(pn(e)/kn|0)|0}var Wt=256,ht=262144,en=4194304;function At(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 Ln(e,n,s){var o=e.pendingLanes;if(o===0)return 0;var u=0,d=e.suspendedLanes,_=e.pingedLanes;e=e.warmLanes;var w=o&134217727;return w!==0?(o=w&~d,o!==0?u=At(o):(_&=w,_!==0?u=At(_):s||(s=w&~e,s!==0&&(u=At(s))))):(w=o&~d,w!==0?u=At(w):_!==0?u=At(_):s||(s=o&~e,s!==0&&(u=At(s)))),u===0?0:n!==0&&n!==u&&(n&d)===0&&(d=u&-u,s=n&-n,d>=s||d===32&&(s&4194048)!==0)?n:u}function Dt(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function rt(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 zt(){var e=en;return en<<=1,(en&62914560)===0&&(en=4194304),e}function Gn(e){for(var n=[],s=0;31>s;s++)n.push(e);return n}function sa(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Fn(e,n,s,o,u,d){var _=e.pendingLanes;e.pendingLanes=s,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=s,e.entangledLanes&=s,e.errorRecoveryDisabledLanes&=s,e.shellSuspendCounter=0;var w=e.entanglements,O=e.expirationTimes,K=e.hiddenUpdates;for(s=_&~s;0<s;){var J=31-Tt(s),re=1<<J;w[J]=0,O[J]=-1;var Y=K[J];if(Y!==null)for(K[J]=null,J=0;J<Y.length;J++){var X=Y[J];X!==null&&(X.lane&=-536870913)}s&=~re}o!==0&&Ia(e,o,0),d!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=d&~(_&~n))}function Ia(e,n,s){e.pendingLanes|=n,e.suspendedLanes&=~n;var o=31-Tt(n);e.entangledLanes|=n,e.entanglements[o]=e.entanglements[o]|1073741824|s&261930}function Da(e,n){var s=e.entangledLanes|=n;for(e=e.entanglements;s;){var o=31-Tt(s),u=1<<o;u&n|e[o]&n&&(e[o]|=n),s&=~u}}function za(e,n){var s=n&-n;return s=(s&42)!==0?1:Pa(s),(s&(e.suspendedLanes|n))!==0?0:s}function Pa(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 la(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function I(){var e=ee.p;return e!==0?e:(e=window.event,e===void 0?32:jv(e.type))}function xe(e,n){var s=ee.p;try{return ee.p=e,n()}finally{ee.p=s}}var je=Math.random().toString(36).slice(2),ke="__reactFiber$"+je,Oe="__reactProps$"+je,Fe="__reactContainer$"+je,Je="__reactEvents$"+je,Ct="__reactListeners$"+je,vn="__reactHandles$"+je,Ye="__reactResources$"+je,qt="__reactMarker$"+je;function An(e){delete e[ke],delete e[Oe],delete e[Je],delete e[Ct],delete e[vn]}function mn(e){var n=e[ke];if(n)return n;for(var s=e.parentNode;s;){if(n=s[Fe]||s[ke]){if(s=n.alternate,n.child!==null||s!==null&&s.child!==null)for(e=rv(e);e!==null;){if(s=e[ke])return s;e=rv(e)}return n}e=s,s=e.parentNode}return null}function Ot(e){if(e=e[ke]||e[Fe]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function rn(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(r(33))}function bn(e){var n=e[Ye];return n||(n=e[Ye]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function ft(e){e[qt]=!0}var gs=new Set,Qa={};function ia(e,n){yn(e,n),yn(e+"Capture",n)}function yn(e,n){for(Qa[e]=n,e=0;e<n.length;e++)gs.add(n[e])}var xi=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]*$"),Qs={},Js={};function _s(e){return Kt.call(Js,e)?!0:Kt.call(Qs,e)?!1:xi.test(e)?Js[e]=!0:(Qs[e]=!0,!1)}function vs(e,n,s){if(_s(n))if(s===null)e.removeAttribute(n);else{switch(typeof s){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var o=n.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,""+s)}}function Ja(e,n,s){if(s===null)e.removeAttribute(n);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+s)}}function ie(e,n,s,o){if(o===null)e.removeAttribute(s);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(s);return}e.setAttributeNS(n,s,""+o)}}function Ee(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function pe(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Ws(e,n,s){var o=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var u=o.get,d=o.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return u.call(this)},set:function(_){s=""+_,d.call(this,_)}}),Object.defineProperty(e,n,{enumerable:o.enumerable}),{getValue:function(){return s},setValue:function(_){s=""+_},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function bs(e){if(!e._valueTracker){var n=pe(e)?"checked":"value";e._valueTracker=Ws(e,n,""+e[n])}}function ba(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var s=n.getValue(),o="";return e&&(o=pe(e)?e.checked?"true":"false":e.value),e=o,e!==s?(n.setValue(e),!0):!1}function Wa(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 wi=/[\n"\\]/g;function Hn(e){return e.replace(wi,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function ji(e,n,s,o,u,d,_,w){e.name="",_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?e.type=_:e.removeAttribute("type"),n!=null?_==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+Ee(n)):e.value!==""+Ee(n)&&(e.value=""+Ee(n)):_!=="submit"&&_!=="reset"||e.removeAttribute("value"),n!=null?el(e,_,Ee(n)):s!=null?el(e,_,Ee(s)):o!=null&&e.removeAttribute("value"),u==null&&d!=null&&(e.defaultChecked=!!d),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?e.name=""+Ee(w):e.removeAttribute("name")}function Qo(e,n,s,o,u,d,_,w){if(d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(e.type=d),n!=null||s!=null){if(!(d!=="submit"&&d!=="reset"||n!=null)){bs(e);return}s=s!=null?""+Ee(s):"",n=n!=null?""+Ee(n):s,w||n===e.value||(e.value=n),e.defaultValue=n}o=o??u,o=typeof o!="function"&&typeof o!="symbol"&&!!o,e.checked=w?e.checked:!!o,e.defaultChecked=!!o,_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"&&(e.name=_),bs(e)}function el(e,n,s){n==="number"&&Wa(e.ownerDocument)===e||e.defaultValue===""+s||(e.defaultValue=""+s)}function ys(e,n,s,o){if(e=e.options,n){n={};for(var u=0;u<s.length;u++)n["$"+s[u]]=!0;for(s=0;s<e.length;s++)u=n.hasOwnProperty("$"+e[s].value),e[s].selected!==u&&(e[s].selected=u),u&&o&&(e[s].defaultSelected=!0)}else{for(s=""+Ee(s),n=null,u=0;u<e.length;u++){if(e[u].value===s){e[u].selected=!0,o&&(e[u].defaultSelected=!0);return}n!==null||e[u].disabled||(n=e[u])}n!==null&&(n.selected=!0)}}function $r(e,n,s){if(n!=null&&(n=""+Ee(n),n!==e.value&&(e.value=n),s==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=s!=null?""+Ee(s):""}function Jo(e,n,s,o){if(n==null){if(o!=null){if(s!=null)throw Error(r(92));if(ve(o)){if(1<o.length)throw Error(r(93));o=o[0]}s=o}s==null&&(s=""),n=s}s=Ee(n),e.defaultValue=s,o=e.textContent,o===s&&o!==""&&o!==null&&(e.value=o),bs(e)}function tl(e,n){if(n){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=n;return}}e.textContent=n}var Mr=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 Si(e,n,s){var o=n.indexOf("--")===0;s==null||typeof s=="boolean"||s===""?o?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":o?e.setProperty(n,s):typeof s!="number"||s===0||Mr.has(n)?n==="float"?e.cssFloat=s:e[n]=(""+s).trim():e[n]=s+"px"}function Wo(e,n,s){if(n!=null&&typeof n!="object")throw Error(r(62));if(e=e.style,s!=null){for(var o in s)!s.hasOwnProperty(o)||n!=null&&n.hasOwnProperty(o)||(o.indexOf("--")===0?e.setProperty(o,""):o==="float"?e.cssFloat="":e[o]="");for(var u in n)o=n[u],n.hasOwnProperty(u)&&s[u]!==o&&Si(e,u,o)}else for(var d in n)n.hasOwnProperty(d)&&Si(e,d,n[d])}function Lr(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 Rd=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"]]),Ed=/^[\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 Ni(e){return Ed.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ya(){}var ki=null;function Ai(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var xn=null,es=null;function ec(e){var n=Ot(e);if(n&&(e=n.stateNode)){var s=e[Oe]||null;e:switch(e=n.stateNode,n.type){case"input":if(ji(e,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name),n=s.name,s.type==="radio"&&n!=null){for(s=e;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll('input[name="'+Hn(""+n)+'"][type="radio"]'),n=0;n<s.length;n++){var o=s[n];if(o!==e&&o.form===e.form){var u=o[Oe]||null;if(!u)throw Error(r(90));ji(o,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(n=0;n<s.length;n++)o=s[n],o.form===e.form&&ba(o)}break e;case"textarea":$r(e,s.value,s.defaultValue);break e;case"select":n=s.value,n!=null&&ys(e,!!s.multiple,n,!1)}}}var nl=!1;function Ri(e,n,s){if(nl)return e(n,s);nl=!0;try{var o=e(n);return o}finally{if(nl=!1,(xn!==null||es!==null)&&(Vc(),xn&&(n=xn,e=es,es=xn=null,ec(n),e)))for(n=0;n<e.length;n++)ec(e[n])}}function al(e,n){var s=e.stateNode;if(s===null)return null;var o=s[Oe]||null;if(o===null)return null;s=o[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":(o=!o.disabled)||(e=e.type,o=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!o;break e;default:e=!1}if(e)return null;if(s&&typeof s!="function")throw Error(r(231,n,typeof s));return s}var ra=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ei=!1;if(ra)try{var xs={};Object.defineProperty(xs,"passive",{get:function(){Ei=!0}}),window.addEventListener("test",xs,xs),window.removeEventListener("test",xs,xs)}catch{Ei=!1}var qa=null,Ir=null,Ua=null;function Ti(){if(Ua)return Ua;var e,n=Ir,s=n.length,o,u="value"in qa?qa.value:qa.textContent,d=u.length;for(e=0;e<s&&n[e]===u[e];e++);var _=s-e;for(o=1;o<=_&&n[s-o]===u[d-o];o++);return Ua=u.slice(e,1<o?1-o:void 0)}function Ci(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 Oi(){return!0}function tc(){return!1}function wn(e){function n(s,o,u,d,_){this._reactName=s,this._targetInst=u,this.type=o,this.nativeEvent=d,this.target=_,this.currentTarget=null;for(var w in e)e.hasOwnProperty(w)&&(s=e[w],this[w]=s?s(d):d[w]);return this.isDefaultPrevented=(d.defaultPrevented!=null?d.defaultPrevented:d.returnValue===!1)?Oi:tc,this.isPropagationStopped=tc,this}return y(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=Oi)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=Oi)},persist:function(){},isPersistent:Oi}),n}var Ba={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},zl=wn(Ba),ws=y({},Ba,{view:0,detail:0}),nc=wn(ws),$i,Mi,tn,xa=y({},ws,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Li,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!==tn&&(tn&&e.type==="mousemove"?($i=e.screenX-tn.screenX,Mi=e.screenY-tn.screenY):Mi=$i=0,tn=e),$i)},movementY:function(e){return"movementY"in e?e.movementY:Mi}}),ql=wn(xa),Td=y({},xa,{dataTransfer:0}),Cd=wn(Td),ac=y({},ws,{relatedTarget:0}),ts=wn(ac),Rn=y({},Ba,{animationName:0,elapsedTime:0,pseudoElement:0}),sc=wn(Rn),Yn=y({},Ba,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),lc=wn(Yn),Dr=y({},Ba,{data:0}),ic=wn(Dr),js={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},zr={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"},Od={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ul(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=Od[e])?!!n[e]:!1}function Li(){return Ul}var qr=y({},ws,{key:function(e){if(e.key){var n=js[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=Ci(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?zr[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Li,charCode:function(e){return e.type==="keypress"?Ci(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ci(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),rc=wn(qr),oc=y({},xa,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ur=wn(oc),$d=y({},ws,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Li}),Md=wn($d),Ld=y({},Ba,{propertyName:0,elapsedTime:0,pseudoElement:0}),g=wn(Ld),A=y({},xa,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),H=wn(A),W=y({},Ba,{newState:0,oldState:0}),fe=wn(W),te=[9,13,27,32],$e=ra&&"CompositionEvent"in window,Ue=null;ra&&"documentMode"in document&&(Ue=document.documentMode);var et=ra&&"TextEvent"in window&&!Ue,Ss=ra&&(!$e||Ue&&8<Ue&&11>=Ue),Ii=" ",Br=!1;function om(e,n){switch(e){case"keyup":return te.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function cm(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Di=!1;function G0(e,n){switch(e){case"compositionend":return cm(n);case"keypress":return n.which!==32?null:(Br=!0,Ii);case"textInput":return e=n.data,e===Ii&&Br?null:e;default:return null}}function H0(e,n){if(Di)return e==="compositionend"||!$e&&om(e,n)?(e=Ti(),Ua=Ir=qa=null,Di=!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 Ss&&n.locale!=="ko"?null:n.data;default:return null}}var V0={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 um(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!V0[e.type]:n==="textarea"}function dm(e,n,s,o){xn?es?es.push(o):es=[o]:xn=o,n=Qc(n,"onChange"),0<n.length&&(s=new zl("onChange","change",null,s,o),e.push({event:s,listeners:n}))}var Gr=null,Hr=null;function K0(e){F_(e,0)}function cc(e){var n=rn(e);if(ba(n))return e}function fm(e,n){if(e==="change")return n}var pm=!1;if(ra){var Id;if(ra){var Dd="oninput"in document;if(!Dd){var hm=document.createElement("div");hm.setAttribute("oninput","return;"),Dd=typeof hm.oninput=="function"}Id=Dd}else Id=!1;pm=Id&&(!document.documentMode||9<document.documentMode)}function mm(){Gr&&(Gr.detachEvent("onpropertychange",gm),Hr=Gr=null)}function gm(e){if(e.propertyName==="value"&&cc(Hr)){var n=[];dm(n,Hr,e,Ai(e)),Ri(K0,n)}}function Z0(e,n,s){e==="focusin"?(mm(),Gr=n,Hr=s,Gr.attachEvent("onpropertychange",gm)):e==="focusout"&&mm()}function F0(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return cc(Hr)}function Y0(e,n){if(e==="click")return cc(n)}function X0(e,n){if(e==="input"||e==="change")return cc(n)}function P0(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var oa=typeof Object.is=="function"?Object.is:P0;function Vr(e,n){if(oa(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var s=Object.keys(e),o=Object.keys(n);if(s.length!==o.length)return!1;for(o=0;o<s.length;o++){var u=s[o];if(!Kt.call(n,u)||!oa(e[u],n[u]))return!1}return!0}function _m(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function vm(e,n){var s=_m(e);e=0;for(var o;s;){if(s.nodeType===3){if(o=e+s.textContent.length,e<=n&&o>=n)return{node:s,offset:n-e};e=o}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=_m(s)}}function bm(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?bm(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function ym(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=Wa(e.document);n instanceof e.HTMLIFrameElement;){try{var s=typeof n.contentWindow.location.href=="string"}catch{s=!1}if(s)e=n.contentWindow;else break;n=Wa(e.document)}return n}function zd(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 Q0=ra&&"documentMode"in document&&11>=document.documentMode,zi=null,qd=null,Kr=null,Ud=!1;function xm(e,n,s){var o=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;Ud||zi==null||zi!==Wa(o)||(o=zi,"selectionStart"in o&&zd(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),Kr&&Vr(Kr,o)||(Kr=o,o=Qc(qd,"onSelect"),0<o.length&&(n=new zl("onSelect","select",null,n,s),e.push({event:n,listeners:o}),n.target=zi)))}function Bl(e,n){var s={};return s[e.toLowerCase()]=n.toLowerCase(),s["Webkit"+e]="webkit"+n,s["Moz"+e]="moz"+n,s}var qi={animationend:Bl("Animation","AnimationEnd"),animationiteration:Bl("Animation","AnimationIteration"),animationstart:Bl("Animation","AnimationStart"),transitionrun:Bl("Transition","TransitionRun"),transitionstart:Bl("Transition","TransitionStart"),transitioncancel:Bl("Transition","TransitionCancel"),transitionend:Bl("Transition","TransitionEnd")},Bd={},wm={};ra&&(wm=document.createElement("div").style,"AnimationEvent"in window||(delete qi.animationend.animation,delete qi.animationiteration.animation,delete qi.animationstart.animation),"TransitionEvent"in window||delete qi.transitionend.transition);function Gl(e){if(Bd[e])return Bd[e];if(!qi[e])return e;var n=qi[e],s;for(s in n)if(n.hasOwnProperty(s)&&s in wm)return Bd[e]=n[s];return e}var jm=Gl("animationend"),Sm=Gl("animationiteration"),Nm=Gl("animationstart"),J0=Gl("transitionrun"),W0=Gl("transitionstart"),ew=Gl("transitioncancel"),km=Gl("transitionend"),Am=new Map,Gd="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(" ");Gd.push("scrollEnd");function Ga(e,n){Am.set(e,n),ia(n,[e])}var uc=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)},wa=[],Ui=0,Hd=0;function dc(){for(var e=Ui,n=Hd=Ui=0;n<e;){var s=wa[n];wa[n++]=null;var o=wa[n];wa[n++]=null;var u=wa[n];wa[n++]=null;var d=wa[n];if(wa[n++]=null,o!==null&&u!==null){var _=o.pending;_===null?u.next=u:(u.next=_.next,_.next=u),o.pending=u}d!==0&&Rm(s,u,d)}}function fc(e,n,s,o){wa[Ui++]=e,wa[Ui++]=n,wa[Ui++]=s,wa[Ui++]=o,Hd|=o,e.lanes|=o,e=e.alternate,e!==null&&(e.lanes|=o)}function Vd(e,n,s,o){return fc(e,n,s,o),pc(e)}function Hl(e,n){return fc(e,null,null,n),pc(e)}function Rm(e,n,s){e.lanes|=s;var o=e.alternate;o!==null&&(o.lanes|=s);for(var u=!1,d=e.return;d!==null;)d.childLanes|=s,o=d.alternate,o!==null&&(o.childLanes|=s),d.tag===22&&(e=d.stateNode,e===null||e._visibility&1||(u=!0)),e=d,d=d.return;return e.tag===3?(d=e.stateNode,u&&n!==null&&(u=31-Tt(s),e=d.hiddenUpdates,o=e[u],o===null?e[u]=[n]:o.push(n),n.lane=s|536870912),d):null}function pc(e){if(50<ho)throw ho=0,ep=null,Error(r(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var Bi={};function tw(e,n,s,o){this.tag=e,this.key=s,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=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ca(e,n,s,o){return new tw(e,n,s,o)}function Kd(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ns(e,n){var s=e.alternate;return s===null?(s=ca(e.tag,n,e.key,e.mode),s.elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=n,s.type=e.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=e.flags&65011712,s.childLanes=e.childLanes,s.lanes=e.lanes,s.child=e.child,s.memoizedProps=e.memoizedProps,s.memoizedState=e.memoizedState,s.updateQueue=e.updateQueue,n=e.dependencies,s.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s.refCleanup=e.refCleanup,s}function Em(e,n){e.flags&=65011714;var s=e.alternate;return s===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=s.childLanes,e.lanes=s.lanes,e.child=s.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=s.memoizedProps,e.memoizedState=s.memoizedState,e.updateQueue=s.updateQueue,e.type=s.type,n=s.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function hc(e,n,s,o,u,d){var _=0;if(o=e,typeof e=="function")Kd(e)&&(_=1);else if(typeof e=="string")_=ij(e,s,Q.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case oe:return e=ca(31,s,n,u),e.elementType=oe,e.lanes=d,e;case T:return Vl(s.children,u,d,n);case N:_=8,u|=24;break;case M:return e=ca(12,s,n,u|2),e.elementType=M,e.lanes=d,e;case B:return e=ca(13,s,n,u),e.elementType=B,e.lanes=d,e;case q:return e=ca(19,s,n,u),e.elementType=q,e.lanes=d,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case z:_=10;break e;case k:_=9;break e;case R:_=11;break e;case Z:_=14;break e;case ae:_=16,o=null;break e}_=29,s=Error(r(130,e===null?"null":typeof e,"")),o=null}return n=ca(_,s,n,u),n.elementType=e,n.type=o,n.lanes=d,n}function Vl(e,n,s,o){return e=ca(7,e,o,n),e.lanes=s,e}function Zd(e,n,s){return e=ca(6,e,null,n),e.lanes=s,e}function Tm(e){var n=ca(18,null,null,0);return n.stateNode=e,n}function Fd(e,n,s){return n=ca(4,e.children!==null?e.children:[],e.key,n),n.lanes=s,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var Cm=new WeakMap;function ja(e,n){if(typeof e=="object"&&e!==null){var s=Cm.get(e);return s!==void 0?s:(n={value:e,source:n,stack:Qt(n)},Cm.set(e,n),n)}return{value:e,source:n,stack:Qt(n)}}var Gi=[],Hi=0,mc=null,Zr=0,Sa=[],Na=0,sl=null,ns=1,as="";function ks(e,n){Gi[Hi++]=Zr,Gi[Hi++]=mc,mc=e,Zr=n}function Om(e,n,s){Sa[Na++]=ns,Sa[Na++]=as,Sa[Na++]=sl,sl=e;var o=ns;e=as;var u=32-Tt(o)-1;o&=~(1<<u),s+=1;var d=32-Tt(n)+u;if(30<d){var _=u-u%5;d=(o&(1<<_)-1).toString(32),o>>=_,u-=_,ns=1<<32-Tt(n)+u|s<<u|o,as=d+e}else ns=1<<d|s<<u|o,as=e}function Yd(e){e.return!==null&&(ks(e,1),Om(e,1,0))}function Xd(e){for(;e===mc;)mc=Gi[--Hi],Gi[Hi]=null,Zr=Gi[--Hi],Gi[Hi]=null;for(;e===sl;)sl=Sa[--Na],Sa[Na]=null,as=Sa[--Na],Sa[Na]=null,ns=Sa[--Na],Sa[Na]=null}function $m(e,n){Sa[Na++]=ns,Sa[Na++]=as,Sa[Na++]=sl,ns=n.id,as=n.overflow,sl=e}var En=null,Mt=null,ot=!1,ll=null,ka=!1,Pd=Error(r(519));function il(e){var n=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Fr(ja(n,e)),Pd}function Mm(e){var n=e.stateNode,s=e.type,o=e.memoizedProps;switch(n[ke]=e,n[Oe]=o,s){case"dialog":nt("cancel",n),nt("close",n);break;case"iframe":case"object":case"embed":nt("load",n);break;case"video":case"audio":for(s=0;s<go.length;s++)nt(go[s],n);break;case"source":nt("error",n);break;case"img":case"image":case"link":nt("error",n),nt("load",n);break;case"details":nt("toggle",n);break;case"input":nt("invalid",n),Qo(n,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":nt("invalid",n);break;case"textarea":nt("invalid",n),Jo(n,o.value,o.defaultValue,o.children)}s=o.children,typeof s!="string"&&typeof s!="number"&&typeof s!="bigint"||n.textContent===""+s||o.suppressHydrationWarning===!0||Q_(n.textContent,s)?(o.popover!=null&&(nt("beforetoggle",n),nt("toggle",n)),o.onScroll!=null&&nt("scroll",n),o.onScrollEnd!=null&&nt("scrollend",n),o.onClick!=null&&(n.onclick=ya),n=!0):n=!1,n||il(e,!0)}function Lm(e){for(En=e.return;En;)switch(En.tag){case 5:case 31:case 13:ka=!1;return;case 27:case 3:ka=!0;return;default:En=En.return}}function Vi(e){if(e!==En)return!1;if(!ot)return Lm(e),ot=!0,!1;var n=e.tag,s;if((s=n!==3&&n!==27)&&((s=n===5)&&(s=e.type,s=!(s!=="form"&&s!=="button")||mp(e.type,e.memoizedProps)),s=!s),s&&Mt&&il(e),Lm(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));Mt=iv(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));Mt=iv(e)}else n===27?(n=Mt,yl(e.type)?(e=yp,yp=null,Mt=e):Mt=n):Mt=En?Ra(e.stateNode.nextSibling):null;return!0}function Kl(){Mt=En=null,ot=!1}function Qd(){var e=ll;return e!==null&&(Jn===null?Jn=e:Jn.push.apply(Jn,e),ll=null),e}function Fr(e){ll===null?ll=[e]:ll.push(e)}var Jd=j(null),Zl=null,As=null;function rl(e,n,s){U(Jd,n._currentValue),n._currentValue=s}function Rs(e){e._currentValue=Jd.current,L(Jd)}function Wd(e,n,s){for(;e!==null;){var o=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,o!==null&&(o.childLanes|=n)):o!==null&&(o.childLanes&n)!==n&&(o.childLanes|=n),e===s)break;e=e.return}}function ef(e,n,s,o){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var d=u.dependencies;if(d!==null){var _=u.child;d=d.firstContext;e:for(;d!==null;){var w=d;d=u;for(var O=0;O<n.length;O++)if(w.context===n[O]){d.lanes|=s,w=d.alternate,w!==null&&(w.lanes|=s),Wd(d.return,s,e),o||(_=null);break e}d=w.next}}else if(u.tag===18){if(_=u.return,_===null)throw Error(r(341));_.lanes|=s,d=_.alternate,d!==null&&(d.lanes|=s),Wd(_,s,e),_=null}else _=u.child;if(_!==null)_.return=u;else for(_=u;_!==null;){if(_===e){_=null;break}if(u=_.sibling,u!==null){u.return=_.return,_=u;break}_=_.return}u=_}}function Ki(e,n,s,o){e=null;for(var u=n,d=!1;u!==null;){if(!d){if((u.flags&524288)!==0)d=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var _=u.alternate;if(_===null)throw Error(r(387));if(_=_.memoizedProps,_!==null){var w=u.type;oa(u.pendingProps.value,_.value)||(e!==null?e.push(w):e=[w])}}else if(u===ge.current){if(_=u.alternate,_===null)throw Error(r(387));_.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(xo):e=[xo])}u=u.return}e!==null&&ef(n,e,s,o),n.flags|=262144}function gc(e){for(e=e.firstContext;e!==null;){if(!oa(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Fl(e){Zl=e,As=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Tn(e){return Im(Zl,e)}function _c(e,n){return Zl===null&&Fl(e),Im(e,n)}function Im(e,n){var s=n._currentValue;if(n={context:n,memoizedValue:s,next:null},As===null){if(e===null)throw Error(r(308));As=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else As=As.next=n;return s}var nw=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(s,o){e.push(o)}};this.abort=function(){n.aborted=!0,e.forEach(function(s){return s()})}},aw=t.unstable_scheduleCallback,sw=t.unstable_NormalPriority,on={$$typeof:z,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function tf(){return{controller:new nw,data:new Map,refCount:0}}function Yr(e){e.refCount--,e.refCount===0&&aw(sw,function(){e.controller.abort()})}var Xr=null,nf=0,Zi=0,Fi=null;function lw(e,n){if(Xr===null){var s=Xr=[];nf=0,Zi=ip(),Fi={status:"pending",value:void 0,then:function(o){s.push(o)}}}return nf++,n.then(Dm,Dm),n}function Dm(){if(--nf===0&&Xr!==null){Fi!==null&&(Fi.status="fulfilled");var e=Xr;Xr=null,Zi=0,Fi=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function iw(e,n){var s=[],o={status:"pending",value:null,reason:null,then:function(u){s.push(u)}};return e.then(function(){o.status="fulfilled",o.value=n;for(var u=0;u<s.length;u++)(0,s[u])(n)},function(u){for(o.status="rejected",o.reason=u,u=0;u<s.length;u++)(0,s[u])(void 0)}),o}var zm=$.S;$.S=function(e,n){x_=lt(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&lw(e,n),zm!==null&&zm(e,n)};var Yl=j(null);function af(){var e=Yl.current;return e!==null?e:Rt.pooledCache}function vc(e,n){n===null?U(Yl,Yl.current):U(Yl,n.pool)}function qm(){var e=af();return e===null?null:{parent:on._currentValue,pool:e}}var Yi=Error(r(460)),sf=Error(r(474)),bc=Error(r(542)),yc={then:function(){}};function Um(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Bm(e,n,s){switch(s=e[s],s===void 0?e.push(n):s!==n&&(n.then(ya,ya),n=s),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,Hm(e),e;default:if(typeof n.status=="string")n.then(ya,ya);else{if(e=Rt,e!==null&&100<e.shellSuspendCounter)throw Error(r(482));e=n,e.status="pending",e.then(function(o){if(n.status==="pending"){var u=n;u.status="fulfilled",u.value=o}},function(o){if(n.status==="pending"){var u=n;u.status="rejected",u.reason=o}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,Hm(e),e}throw Pl=n,Yi}}function Xl(e){try{var n=e._init;return n(e._payload)}catch(s){throw s!==null&&typeof s=="object"&&typeof s.then=="function"?(Pl=s,Yi):s}}var Pl=null;function Gm(){if(Pl===null)throw Error(r(459));var e=Pl;return Pl=null,e}function Hm(e){if(e===Yi||e===bc)throw Error(r(483))}var Xi=null,Pr=0;function xc(e){var n=Pr;return Pr+=1,Xi===null&&(Xi=[]),Bm(Xi,e,n)}function Qr(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function wc(e,n){throw n.$$typeof===E?Error(r(525)):(e=Object.prototype.toString.call(n),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function Vm(e){function n(G,D){if(e){var V=G.deletions;V===null?(G.deletions=[D],G.flags|=16):V.push(D)}}function s(G,D){if(!e)return null;for(;D!==null;)n(G,D),D=D.sibling;return null}function o(G){for(var D=new Map;G!==null;)G.key!==null?D.set(G.key,G):D.set(G.index,G),G=G.sibling;return D}function u(G,D){return G=Ns(G,D),G.index=0,G.sibling=null,G}function d(G,D,V){return G.index=V,e?(V=G.alternate,V!==null?(V=V.index,V<D?(G.flags|=67108866,D):V):(G.flags|=67108866,D)):(G.flags|=1048576,D)}function _(G){return e&&G.alternate===null&&(G.flags|=67108866),G}function w(G,D,V,ne){return D===null||D.tag!==6?(D=Zd(V,G.mode,ne),D.return=G,D):(D=u(D,V),D.return=G,D)}function O(G,D,V,ne){var De=V.type;return De===T?J(G,D,V.props.children,ne,V.key):D!==null&&(D.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===ae&&Xl(De)===D.type)?(D=u(D,V.props),Qr(D,V),D.return=G,D):(D=hc(V.type,V.key,V.props,null,G.mode,ne),Qr(D,V),D.return=G,D)}function K(G,D,V,ne){return D===null||D.tag!==4||D.stateNode.containerInfo!==V.containerInfo||D.stateNode.implementation!==V.implementation?(D=Fd(V,G.mode,ne),D.return=G,D):(D=u(D,V.children||[]),D.return=G,D)}function J(G,D,V,ne,De){return D===null||D.tag!==7?(D=Vl(V,G.mode,ne,De),D.return=G,D):(D=u(D,V),D.return=G,D)}function re(G,D,V){if(typeof D=="string"&&D!==""||typeof D=="number"||typeof D=="bigint")return D=Zd(""+D,G.mode,V),D.return=G,D;if(typeof D=="object"&&D!==null){switch(D.$$typeof){case S:return V=hc(D.type,D.key,D.props,null,G.mode,V),Qr(V,D),V.return=G,V;case C:return D=Fd(D,G.mode,V),D.return=G,D;case ae:return D=Xl(D),re(G,D,V)}if(ve(D)||_e(D))return D=Vl(D,G.mode,V,null),D.return=G,D;if(typeof D.then=="function")return re(G,xc(D),V);if(D.$$typeof===z)return re(G,_c(G,D),V);wc(G,D)}return null}function Y(G,D,V,ne){var De=D!==null?D.key:null;if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return De!==null?null:w(G,D,""+V,ne);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case S:return V.key===De?O(G,D,V,ne):null;case C:return V.key===De?K(G,D,V,ne):null;case ae:return V=Xl(V),Y(G,D,V,ne)}if(ve(V)||_e(V))return De!==null?null:J(G,D,V,ne,null);if(typeof V.then=="function")return Y(G,D,xc(V),ne);if(V.$$typeof===z)return Y(G,D,_c(G,V),ne);wc(G,V)}return null}function X(G,D,V,ne,De){if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return G=G.get(V)||null,w(D,G,""+ne,De);if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case S:return G=G.get(ne.key===null?V:ne.key)||null,O(D,G,ne,De);case C:return G=G.get(ne.key===null?V:ne.key)||null,K(D,G,ne,De);case ae:return ne=Xl(ne),X(G,D,V,ne,De)}if(ve(ne)||_e(ne))return G=G.get(V)||null,J(D,G,ne,De,null);if(typeof ne.then=="function")return X(G,D,V,xc(ne),De);if(ne.$$typeof===z)return X(G,D,V,_c(D,ne),De);wc(D,ne)}return null}function Te(G,D,V,ne){for(var De=null,mt=null,Me=D,Xe=D=0,st=null;Me!==null&&Xe<V.length;Xe++){Me.index>Xe?(st=Me,Me=null):st=Me.sibling;var gt=Y(G,Me,V[Xe],ne);if(gt===null){Me===null&&(Me=st);break}e&&Me&>.alternate===null&&n(G,Me),D=d(gt,D,Xe),mt===null?De=gt:mt.sibling=gt,mt=gt,Me=st}if(Xe===V.length)return s(G,Me),ot&&ks(G,Xe),De;if(Me===null){for(;Xe<V.length;Xe++)Me=re(G,V[Xe],ne),Me!==null&&(D=d(Me,D,Xe),mt===null?De=Me:mt.sibling=Me,mt=Me);return ot&&ks(G,Xe),De}for(Me=o(Me);Xe<V.length;Xe++)st=X(Me,G,Xe,V[Xe],ne),st!==null&&(e&&st.alternate!==null&&Me.delete(st.key===null?Xe:st.key),D=d(st,D,Xe),mt===null?De=st:mt.sibling=st,mt=st);return e&&Me.forEach(function(Nl){return n(G,Nl)}),ot&&ks(G,Xe),De}function ze(G,D,V,ne){if(V==null)throw Error(r(151));for(var De=null,mt=null,Me=D,Xe=D=0,st=null,gt=V.next();Me!==null&&!gt.done;Xe++,gt=V.next()){Me.index>Xe?(st=Me,Me=null):st=Me.sibling;var Nl=Y(G,Me,gt.value,ne);if(Nl===null){Me===null&&(Me=st);break}e&&Me&&Nl.alternate===null&&n(G,Me),D=d(Nl,D,Xe),mt===null?De=Nl:mt.sibling=Nl,mt=Nl,Me=st}if(gt.done)return s(G,Me),ot&&ks(G,Xe),De;if(Me===null){for(;!gt.done;Xe++,gt=V.next())gt=re(G,gt.value,ne),gt!==null&&(D=d(gt,D,Xe),mt===null?De=gt:mt.sibling=gt,mt=gt);return ot&&ks(G,Xe),De}for(Me=o(Me);!gt.done;Xe++,gt=V.next())gt=X(Me,G,Xe,gt.value,ne),gt!==null&&(e&>.alternate!==null&&Me.delete(gt.key===null?Xe:gt.key),D=d(gt,D,Xe),mt===null?De=gt:mt.sibling=gt,mt=gt);return e&&Me.forEach(function(_j){return n(G,_j)}),ot&&ks(G,Xe),De}function Nt(G,D,V,ne){if(typeof V=="object"&&V!==null&&V.type===T&&V.key===null&&(V=V.props.children),typeof V=="object"&&V!==null){switch(V.$$typeof){case S:e:{for(var De=V.key;D!==null;){if(D.key===De){if(De=V.type,De===T){if(D.tag===7){s(G,D.sibling),ne=u(D,V.props.children),ne.return=G,G=ne;break e}}else if(D.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===ae&&Xl(De)===D.type){s(G,D.sibling),ne=u(D,V.props),Qr(ne,V),ne.return=G,G=ne;break e}s(G,D);break}else n(G,D);D=D.sibling}V.type===T?(ne=Vl(V.props.children,G.mode,ne,V.key),ne.return=G,G=ne):(ne=hc(V.type,V.key,V.props,null,G.mode,ne),Qr(ne,V),ne.return=G,G=ne)}return _(G);case C:e:{for(De=V.key;D!==null;){if(D.key===De)if(D.tag===4&&D.stateNode.containerInfo===V.containerInfo&&D.stateNode.implementation===V.implementation){s(G,D.sibling),ne=u(D,V.children||[]),ne.return=G,G=ne;break e}else{s(G,D);break}else n(G,D);D=D.sibling}ne=Fd(V,G.mode,ne),ne.return=G,G=ne}return _(G);case ae:return V=Xl(V),Nt(G,D,V,ne)}if(ve(V))return Te(G,D,V,ne);if(_e(V)){if(De=_e(V),typeof De!="function")throw Error(r(150));return V=De.call(V),ze(G,D,V,ne)}if(typeof V.then=="function")return Nt(G,D,xc(V),ne);if(V.$$typeof===z)return Nt(G,D,_c(G,V),ne);wc(G,V)}return typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint"?(V=""+V,D!==null&&D.tag===6?(s(G,D.sibling),ne=u(D,V),ne.return=G,G=ne):(s(G,D),ne=Zd(V,G.mode,ne),ne.return=G,G=ne),_(G)):s(G,D)}return function(G,D,V,ne){try{Pr=0;var De=Nt(G,D,V,ne);return Xi=null,De}catch(Me){if(Me===Yi||Me===bc)throw Me;var mt=ca(29,Me,null,G.mode);return mt.lanes=ne,mt.return=G,mt}}}var Ql=Vm(!0),Km=Vm(!1),ol=!1;function lf(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function rf(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 cl(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ul(e,n,s){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,(_t&2)!==0){var u=o.pending;return u===null?n.next=n:(n.next=u.next,u.next=n),o.pending=n,n=pc(e),Rm(e,null,s),n}return fc(e,o,n,s),pc(e)}function Jr(e,n,s){if(n=n.updateQueue,n!==null&&(n=n.shared,(s&4194048)!==0)){var o=n.lanes;o&=e.pendingLanes,s|=o,n.lanes=s,Da(e,s)}}function of(e,n){var s=e.updateQueue,o=e.alternate;if(o!==null&&(o=o.updateQueue,s===o)){var u=null,d=null;if(s=s.firstBaseUpdate,s!==null){do{var _={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};d===null?u=d=_:d=d.next=_,s=s.next}while(s!==null);d===null?u=d=n:d=d.next=n}else u=d=n;s={baseState:o.baseState,firstBaseUpdate:u,lastBaseUpdate:d,shared:o.shared,callbacks:o.callbacks},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=n:e.next=n,s.lastBaseUpdate=n}var cf=!1;function Wr(){if(cf){var e=Fi;if(e!==null)throw e}}function eo(e,n,s,o){cf=!1;var u=e.updateQueue;ol=!1;var d=u.firstBaseUpdate,_=u.lastBaseUpdate,w=u.shared.pending;if(w!==null){u.shared.pending=null;var O=w,K=O.next;O.next=null,_===null?d=K:_.next=K,_=O;var J=e.alternate;J!==null&&(J=J.updateQueue,w=J.lastBaseUpdate,w!==_&&(w===null?J.firstBaseUpdate=K:w.next=K,J.lastBaseUpdate=O))}if(d!==null){var re=u.baseState;_=0,J=K=O=null,w=d;do{var Y=w.lane&-536870913,X=Y!==w.lane;if(X?(at&Y)===Y:(o&Y)===Y){Y!==0&&Y===Zi&&(cf=!0),J!==null&&(J=J.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var Te=e,ze=w;Y=n;var Nt=s;switch(ze.tag){case 1:if(Te=ze.payload,typeof Te=="function"){re=Te.call(Nt,re,Y);break e}re=Te;break e;case 3:Te.flags=Te.flags&-65537|128;case 0:if(Te=ze.payload,Y=typeof Te=="function"?Te.call(Nt,re,Y):Te,Y==null)break e;re=y({},re,Y);break e;case 2:ol=!0}}Y=w.callback,Y!==null&&(e.flags|=64,X&&(e.flags|=8192),X=u.callbacks,X===null?u.callbacks=[Y]:X.push(Y))}else X={lane:Y,tag:w.tag,payload:w.payload,callback:w.callback,next:null},J===null?(K=J=X,O=re):J=J.next=X,_|=Y;if(w=w.next,w===null){if(w=u.shared.pending,w===null)break;X=w,w=X.next,X.next=null,u.lastBaseUpdate=X,u.shared.pending=null}}while(!0);J===null&&(O=re),u.baseState=O,u.firstBaseUpdate=K,u.lastBaseUpdate=J,d===null&&(u.shared.lanes=0),ml|=_,e.lanes=_,e.memoizedState=re}}function Zm(e,n){if(typeof e!="function")throw Error(r(191,e));e.call(n)}function Fm(e,n){var s=e.callbacks;if(s!==null)for(e.callbacks=null,e=0;e<s.length;e++)Zm(s[e],n)}var Pi=j(null),jc=j(0);function Ym(e,n){e=Ds,U(jc,e),U(Pi,n),Ds=e|n.baseLanes}function uf(){U(jc,Ds),U(Pi,Pi.current)}function df(){Ds=jc.current,L(Pi),L(jc)}var ua=j(null),Aa=null;function dl(e){var n=e.alternate;U(nn,nn.current&1),U(ua,e),Aa===null&&(n===null||Pi.current!==null||n.memoizedState!==null)&&(Aa=e)}function ff(e){U(nn,nn.current),U(ua,e),Aa===null&&(Aa=e)}function Xm(e){e.tag===22?(U(nn,nn.current),U(ua,e),Aa===null&&(Aa=e)):fl()}function fl(){U(nn,nn.current),U(ua,ua.current)}function da(e){L(ua),Aa===e&&(Aa=null),L(nn)}var nn=j(0);function Sc(e){for(var n=e;n!==null;){if(n.tag===13){var s=n.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||vp(s)||bp(s)))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 Es=0,Ze=null,jt=null,cn=null,Nc=!1,Qi=!1,Jl=!1,kc=0,to=0,Ji=null,rw=0;function Zt(){throw Error(r(321))}function pf(e,n){if(n===null)return!1;for(var s=0;s<n.length&&s<e.length;s++)if(!oa(e[s],n[s]))return!1;return!0}function hf(e,n,s,o,u,d){return Es=d,Ze=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,$.H=e===null||e.memoizedState===null?Og:Ef,Jl=!1,d=s(o,u),Jl=!1,Qi&&(d=Qm(n,s,o,u)),Pm(e),d}function Pm(e){$.H=so;var n=jt!==null&&jt.next!==null;if(Es=0,cn=jt=Ze=null,Nc=!1,to=0,Ji=null,n)throw Error(r(300));e===null||un||(e=e.dependencies,e!==null&&gc(e)&&(un=!0))}function Qm(e,n,s,o){Ze=e;var u=0;do{if(Qi&&(Ji=null),to=0,Qi=!1,25<=u)throw Error(r(301));if(u+=1,cn=jt=null,e.updateQueue!=null){var d=e.updateQueue;d.lastEffect=null,d.events=null,d.stores=null,d.memoCache!=null&&(d.memoCache.index=0)}$.H=$g,d=n(s,o)}while(Qi);return d}function ow(){var e=$.H,n=e.useState()[0];return n=typeof n.then=="function"?no(n):n,e=e.useState()[0],(jt!==null?jt.memoizedState:null)!==e&&(Ze.flags|=1024),n}function mf(){var e=kc!==0;return kc=0,e}function gf(e,n,s){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~s}function _f(e){if(Nc){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}Nc=!1}Es=0,cn=jt=Ze=null,Qi=!1,to=kc=0,Ji=null}function Vn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return cn===null?Ze.memoizedState=cn=e:cn=cn.next=e,cn}function an(){if(jt===null){var e=Ze.alternate;e=e!==null?e.memoizedState:null}else e=jt.next;var n=cn===null?Ze.memoizedState:cn.next;if(n!==null)cn=n,jt=e;else{if(e===null)throw Ze.alternate===null?Error(r(467)):Error(r(310));jt=e,e={memoizedState:jt.memoizedState,baseState:jt.baseState,baseQueue:jt.baseQueue,queue:jt.queue,next:null},cn===null?Ze.memoizedState=cn=e:cn=cn.next=e}return cn}function Ac(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function no(e){var n=to;return to+=1,Ji===null&&(Ji=[]),e=Bm(Ji,e,n),n=Ze,(cn===null?n.memoizedState:cn.next)===null&&(n=n.alternate,$.H=n===null||n.memoizedState===null?Og:Ef),e}function Rc(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return no(e);if(e.$$typeof===z)return Tn(e)}throw Error(r(438,String(e)))}function vf(e){var n=null,s=Ze.updateQueue;if(s!==null&&(n=s.memoCache),n==null){var o=Ze.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(n={data:o.data.map(function(u){return u.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),s===null&&(s=Ac(),Ze.updateQueue=s),s.memoCache=n,s=n.data[n.index],s===void 0)for(s=n.data[n.index]=Array(e),o=0;o<e;o++)s[o]=P;return n.index++,s}function Ts(e,n){return typeof n=="function"?n(e):n}function Ec(e){var n=an();return bf(n,jt,e)}function bf(e,n,s){var o=e.queue;if(o===null)throw Error(r(311));o.lastRenderedReducer=s;var u=e.baseQueue,d=o.pending;if(d!==null){if(u!==null){var _=u.next;u.next=d.next,d.next=_}n.baseQueue=u=d,o.pending=null}if(d=e.baseState,u===null)e.memoizedState=d;else{n=u.next;var w=_=null,O=null,K=n,J=!1;do{var re=K.lane&-536870913;if(re!==K.lane?(at&re)===re:(Es&re)===re){var Y=K.revertLane;if(Y===0)O!==null&&(O=O.next={lane:0,revertLane:0,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null}),re===Zi&&(J=!0);else if((Es&Y)===Y){K=K.next,Y===Zi&&(J=!0);continue}else re={lane:0,revertLane:K.revertLane,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},O===null?(w=O=re,_=d):O=O.next=re,Ze.lanes|=Y,ml|=Y;re=K.action,Jl&&s(d,re),d=K.hasEagerState?K.eagerState:s(d,re)}else Y={lane:re,revertLane:K.revertLane,gesture:K.gesture,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},O===null?(w=O=Y,_=d):O=O.next=Y,Ze.lanes|=re,ml|=re;K=K.next}while(K!==null&&K!==n);if(O===null?_=d:O.next=w,!oa(d,e.memoizedState)&&(un=!0,J&&(s=Fi,s!==null)))throw s;e.memoizedState=d,e.baseState=_,e.baseQueue=O,o.lastRenderedState=d}return u===null&&(o.lanes=0),[e.memoizedState,o.dispatch]}function yf(e){var n=an(),s=n.queue;if(s===null)throw Error(r(311));s.lastRenderedReducer=e;var o=s.dispatch,u=s.pending,d=n.memoizedState;if(u!==null){s.pending=null;var _=u=u.next;do d=e(d,_.action),_=_.next;while(_!==u);oa(d,n.memoizedState)||(un=!0),n.memoizedState=d,n.baseQueue===null&&(n.baseState=d),s.lastRenderedState=d}return[d,o]}function Jm(e,n,s){var o=Ze,u=an(),d=ot;if(d){if(s===void 0)throw Error(r(407));s=s()}else s=n();var _=!oa((jt||u).memoizedState,s);if(_&&(u.memoizedState=s,un=!0),u=u.queue,jf(tg.bind(null,o,u,e),[e]),u.getSnapshot!==n||_||cn!==null&&cn.memoizedState.tag&1){if(o.flags|=2048,Wi(9,{destroy:void 0},eg.bind(null,o,u,s,n),null),Rt===null)throw Error(r(349));d||(Es&127)!==0||Wm(o,n,s)}return s}function Wm(e,n,s){e.flags|=16384,e={getSnapshot:n,value:s},n=Ze.updateQueue,n===null?(n=Ac(),Ze.updateQueue=n,n.stores=[e]):(s=n.stores,s===null?n.stores=[e]:s.push(e))}function eg(e,n,s,o){n.value=s,n.getSnapshot=o,ng(n)&&ag(e)}function tg(e,n,s){return s(function(){ng(n)&&ag(e)})}function ng(e){var n=e.getSnapshot;e=e.value;try{var s=n();return!oa(e,s)}catch{return!0}}function ag(e){var n=Hl(e,2);n!==null&&Wn(n,e,2)}function xf(e){var n=Vn();if(typeof e=="function"){var s=e;if(e=s(),Jl){wt(!0);try{s()}finally{wt(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ts,lastRenderedState:e},n}function sg(e,n,s,o){return e.baseState=s,bf(e,jt,typeof o=="function"?o:Ts)}function cw(e,n,s,o,u){if(Oc(e))throw Error(r(485));if(e=n.action,e!==null){var d={payload:u,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(_){d.listeners.push(_)}};$.T!==null?s(!0):d.isTransition=!1,o(d),s=n.pending,s===null?(d.next=n.pending=d,lg(n,d)):(d.next=s.next,n.pending=s.next=d)}}function lg(e,n){var s=n.action,o=n.payload,u=e.state;if(n.isTransition){var d=$.T,_={};$.T=_;try{var w=s(u,o),O=$.S;O!==null&&O(_,w),ig(e,n,w)}catch(K){wf(e,n,K)}finally{d!==null&&_.types!==null&&(d.types=_.types),$.T=d}}else try{d=s(u,o),ig(e,n,d)}catch(K){wf(e,n,K)}}function ig(e,n,s){s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(function(o){rg(e,n,o)},function(o){return wf(e,n,o)}):rg(e,n,s)}function rg(e,n,s){n.status="fulfilled",n.value=s,og(n),e.state=s,n=e.pending,n!==null&&(s=n.next,s===n?e.pending=null:(s=s.next,n.next=s,lg(e,s)))}function wf(e,n,s){var o=e.pending;if(e.pending=null,o!==null){o=o.next;do n.status="rejected",n.reason=s,og(n),n=n.next;while(n!==o)}e.action=null}function og(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function cg(e,n){return n}function ug(e,n){if(ot){var s=Rt.formState;if(s!==null){e:{var o=Ze;if(ot){if(Mt){t:{for(var u=Mt,d=ka;u.nodeType!==8;){if(!d){u=null;break t}if(u=Ra(u.nextSibling),u===null){u=null;break t}}d=u.data,u=d==="F!"||d==="F"?u:null}if(u){Mt=Ra(u.nextSibling),o=u.data==="F!";break e}}il(o)}o=!1}o&&(n=s[0])}}return s=Vn(),s.memoizedState=s.baseState=n,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:cg,lastRenderedState:n},s.queue=o,s=Eg.bind(null,Ze,o),o.dispatch=s,o=xf(!1),d=Rf.bind(null,Ze,!1,o.queue),o=Vn(),u={state:n,dispatch:null,action:e,pending:null},o.queue=u,s=cw.bind(null,Ze,u,d,s),u.dispatch=s,o.memoizedState=e,[n,s,!1]}function dg(e){var n=an();return fg(n,jt,e)}function fg(e,n,s){if(n=bf(e,n,cg)[0],e=Ec(Ts)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var o=no(n)}catch(_){throw _===Yi?bc:_}else o=n;n=an();var u=n.queue,d=u.dispatch;return s!==n.memoizedState&&(Ze.flags|=2048,Wi(9,{destroy:void 0},uw.bind(null,u,s),null)),[o,d,e]}function uw(e,n){e.action=n}function pg(e){var n=an(),s=jt;if(s!==null)return fg(n,s,e);an(),n=n.memoizedState,s=an();var o=s.queue.dispatch;return s.memoizedState=e,[n,o,!1]}function Wi(e,n,s,o){return e={tag:e,create:s,deps:o,inst:n,next:null},n=Ze.updateQueue,n===null&&(n=Ac(),Ze.updateQueue=n),s=n.lastEffect,s===null?n.lastEffect=e.next=e:(o=s.next,s.next=e,e.next=o,n.lastEffect=e),e}function hg(){return an().memoizedState}function Tc(e,n,s,o){var u=Vn();Ze.flags|=e,u.memoizedState=Wi(1|n,{destroy:void 0},s,o===void 0?null:o)}function Cc(e,n,s,o){var u=an();o=o===void 0?null:o;var d=u.memoizedState.inst;jt!==null&&o!==null&&pf(o,jt.memoizedState.deps)?u.memoizedState=Wi(n,d,s,o):(Ze.flags|=e,u.memoizedState=Wi(1|n,d,s,o))}function mg(e,n){Tc(8390656,8,e,n)}function jf(e,n){Cc(2048,8,e,n)}function dw(e){Ze.flags|=4;var n=Ze.updateQueue;if(n===null)n=Ac(),Ze.updateQueue=n,n.events=[e];else{var s=n.events;s===null?n.events=[e]:s.push(e)}}function gg(e){var n=an().memoizedState;return dw({ref:n,nextImpl:e}),function(){if((_t&2)!==0)throw Error(r(440));return n.impl.apply(void 0,arguments)}}function _g(e,n){return Cc(4,2,e,n)}function vg(e,n){return Cc(4,4,e,n)}function bg(e,n){if(typeof n=="function"){e=e();var s=n(e);return function(){typeof s=="function"?s():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function yg(e,n,s){s=s!=null?s.concat([e]):null,Cc(4,4,bg.bind(null,n,e),s)}function Sf(){}function xg(e,n){var s=an();n=n===void 0?null:n;var o=s.memoizedState;return n!==null&&pf(n,o[1])?o[0]:(s.memoizedState=[e,n],e)}function wg(e,n){var s=an();n=n===void 0?null:n;var o=s.memoizedState;if(n!==null&&pf(n,o[1]))return o[0];if(o=e(),Jl){wt(!0);try{e()}finally{wt(!1)}}return s.memoizedState=[o,n],o}function Nf(e,n,s){return s===void 0||(Es&1073741824)!==0&&(at&261930)===0?e.memoizedState=n:(e.memoizedState=s,e=j_(),Ze.lanes|=e,ml|=e,s)}function jg(e,n,s,o){return oa(s,n)?s:Pi.current!==null?(e=Nf(e,s,o),oa(e,n)||(un=!0),e):(Es&42)===0||(Es&1073741824)!==0&&(at&261930)===0?(un=!0,e.memoizedState=s):(e=j_(),Ze.lanes|=e,ml|=e,n)}function Sg(e,n,s,o,u){var d=ee.p;ee.p=d!==0&&8>d?d:8;var _=$.T,w={};$.T=w,Rf(e,!1,n,s);try{var O=u(),K=$.S;if(K!==null&&K(w,O),O!==null&&typeof O=="object"&&typeof O.then=="function"){var J=iw(O,o);ao(e,n,J,ha(e))}else ao(e,n,o,ha(e))}catch(re){ao(e,n,{then:function(){},status:"rejected",reason:re},ha())}finally{ee.p=d,_!==null&&w.types!==null&&(_.types=w.types),$.T=_}}function fw(){}function kf(e,n,s,o){if(e.tag!==5)throw Error(r(476));var u=Ng(e).queue;Sg(e,u,n,ce,s===null?fw:function(){return kg(e),s(o)})}function Ng(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:ce,baseState:ce,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ts,lastRenderedState:ce},next:null};var s={};return n.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ts,lastRenderedState:s},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function kg(e){var n=Ng(e);n.next===null&&(n=e.alternate.memoizedState),ao(e,n.next.queue,{},ha())}function Af(){return Tn(xo)}function Ag(){return an().memoizedState}function Rg(){return an().memoizedState}function pw(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var s=ha();e=cl(s);var o=ul(n,e,s);o!==null&&(Wn(o,n,s),Jr(o,n,s)),n={cache:tf()},e.payload=n;return}n=n.return}}function hw(e,n,s){var o=ha();s={lane:o,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Oc(e)?Tg(n,s):(s=Vd(e,n,s,o),s!==null&&(Wn(s,e,o),Cg(s,n,o)))}function Eg(e,n,s){var o=ha();ao(e,n,s,o)}function ao(e,n,s,o){var u={lane:o,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(Oc(e))Tg(n,u);else{var d=e.alternate;if(e.lanes===0&&(d===null||d.lanes===0)&&(d=n.lastRenderedReducer,d!==null))try{var _=n.lastRenderedState,w=d(_,s);if(u.hasEagerState=!0,u.eagerState=w,oa(w,_))return fc(e,n,u,0),Rt===null&&dc(),!1}catch{}if(s=Vd(e,n,u,o),s!==null)return Wn(s,e,o),Cg(s,n,o),!0}return!1}function Rf(e,n,s,o){if(o={lane:2,revertLane:ip(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Oc(e)){if(n)throw Error(r(479))}else n=Vd(e,s,o,2),n!==null&&Wn(n,e,2)}function Oc(e){var n=e.alternate;return e===Ze||n!==null&&n===Ze}function Tg(e,n){Qi=Nc=!0;var s=e.pending;s===null?n.next=n:(n.next=s.next,s.next=n),e.pending=n}function Cg(e,n,s){if((s&4194048)!==0){var o=n.lanes;o&=e.pendingLanes,s|=o,n.lanes=s,Da(e,s)}}var so={readContext:Tn,use:Rc,useCallback:Zt,useContext:Zt,useEffect:Zt,useImperativeHandle:Zt,useLayoutEffect:Zt,useInsertionEffect:Zt,useMemo:Zt,useReducer:Zt,useRef:Zt,useState:Zt,useDebugValue:Zt,useDeferredValue:Zt,useTransition:Zt,useSyncExternalStore:Zt,useId:Zt,useHostTransitionStatus:Zt,useFormState:Zt,useActionState:Zt,useOptimistic:Zt,useMemoCache:Zt,useCacheRefresh:Zt};so.useEffectEvent=Zt;var Og={readContext:Tn,use:Rc,useCallback:function(e,n){return Vn().memoizedState=[e,n===void 0?null:n],e},useContext:Tn,useEffect:mg,useImperativeHandle:function(e,n,s){s=s!=null?s.concat([e]):null,Tc(4194308,4,bg.bind(null,n,e),s)},useLayoutEffect:function(e,n){return Tc(4194308,4,e,n)},useInsertionEffect:function(e,n){Tc(4,2,e,n)},useMemo:function(e,n){var s=Vn();n=n===void 0?null:n;var o=e();if(Jl){wt(!0);try{e()}finally{wt(!1)}}return s.memoizedState=[o,n],o},useReducer:function(e,n,s){var o=Vn();if(s!==void 0){var u=s(n);if(Jl){wt(!0);try{s(n)}finally{wt(!1)}}}else u=n;return o.memoizedState=o.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},o.queue=e,e=e.dispatch=hw.bind(null,Ze,e),[o.memoizedState,e]},useRef:function(e){var n=Vn();return e={current:e},n.memoizedState=e},useState:function(e){e=xf(e);var n=e.queue,s=Eg.bind(null,Ze,n);return n.dispatch=s,[e.memoizedState,s]},useDebugValue:Sf,useDeferredValue:function(e,n){var s=Vn();return Nf(s,e,n)},useTransition:function(){var e=xf(!1);return e=Sg.bind(null,Ze,e.queue,!0,!1),Vn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,s){var o=Ze,u=Vn();if(ot){if(s===void 0)throw Error(r(407));s=s()}else{if(s=n(),Rt===null)throw Error(r(349));(at&127)!==0||Wm(o,n,s)}u.memoizedState=s;var d={value:s,getSnapshot:n};return u.queue=d,mg(tg.bind(null,o,d,e),[e]),o.flags|=2048,Wi(9,{destroy:void 0},eg.bind(null,o,d,s,n),null),s},useId:function(){var e=Vn(),n=Rt.identifierPrefix;if(ot){var s=as,o=ns;s=(o&~(1<<32-Tt(o)-1)).toString(32)+s,n="_"+n+"R_"+s,s=kc++,0<s&&(n+="H"+s.toString(32)),n+="_"}else s=rw++,n="_"+n+"r_"+s.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:Af,useFormState:ug,useActionState:ug,useOptimistic:function(e){var n=Vn();n.memoizedState=n.baseState=e;var s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=s,n=Rf.bind(null,Ze,!0,s),s.dispatch=n,[e,n]},useMemoCache:vf,useCacheRefresh:function(){return Vn().memoizedState=pw.bind(null,Ze)},useEffectEvent:function(e){var n=Vn(),s={impl:e};return n.memoizedState=s,function(){if((_t&2)!==0)throw Error(r(440));return s.impl.apply(void 0,arguments)}}},Ef={readContext:Tn,use:Rc,useCallback:xg,useContext:Tn,useEffect:jf,useImperativeHandle:yg,useInsertionEffect:_g,useLayoutEffect:vg,useMemo:wg,useReducer:Ec,useRef:hg,useState:function(){return Ec(Ts)},useDebugValue:Sf,useDeferredValue:function(e,n){var s=an();return jg(s,jt.memoizedState,e,n)},useTransition:function(){var e=Ec(Ts)[0],n=an().memoizedState;return[typeof e=="boolean"?e:no(e),n]},useSyncExternalStore:Jm,useId:Ag,useHostTransitionStatus:Af,useFormState:dg,useActionState:dg,useOptimistic:function(e,n){var s=an();return sg(s,jt,e,n)},useMemoCache:vf,useCacheRefresh:Rg};Ef.useEffectEvent=gg;var $g={readContext:Tn,use:Rc,useCallback:xg,useContext:Tn,useEffect:jf,useImperativeHandle:yg,useInsertionEffect:_g,useLayoutEffect:vg,useMemo:wg,useReducer:yf,useRef:hg,useState:function(){return yf(Ts)},useDebugValue:Sf,useDeferredValue:function(e,n){var s=an();return jt===null?Nf(s,e,n):jg(s,jt.memoizedState,e,n)},useTransition:function(){var e=yf(Ts)[0],n=an().memoizedState;return[typeof e=="boolean"?e:no(e),n]},useSyncExternalStore:Jm,useId:Ag,useHostTransitionStatus:Af,useFormState:pg,useActionState:pg,useOptimistic:function(e,n){var s=an();return jt!==null?sg(s,jt,e,n):(s.baseState=e,[e,s.queue.dispatch])},useMemoCache:vf,useCacheRefresh:Rg};$g.useEffectEvent=gg;function Tf(e,n,s,o){n=e.memoizedState,s=s(o,n),s=s==null?n:y({},n,s),e.memoizedState=s,e.lanes===0&&(e.updateQueue.baseState=s)}var Cf={enqueueSetState:function(e,n,s){e=e._reactInternals;var o=ha(),u=cl(o);u.payload=n,s!=null&&(u.callback=s),n=ul(e,u,o),n!==null&&(Wn(n,e,o),Jr(n,e,o))},enqueueReplaceState:function(e,n,s){e=e._reactInternals;var o=ha(),u=cl(o);u.tag=1,u.payload=n,s!=null&&(u.callback=s),n=ul(e,u,o),n!==null&&(Wn(n,e,o),Jr(n,e,o))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var s=ha(),o=cl(s);o.tag=2,n!=null&&(o.callback=n),n=ul(e,o,s),n!==null&&(Wn(n,e,s),Jr(n,e,s))}};function Mg(e,n,s,o,u,d,_){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(o,d,_):n.prototype&&n.prototype.isPureReactComponent?!Vr(s,o)||!Vr(u,d):!0}function Lg(e,n,s,o){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(s,o),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(s,o),n.state!==e&&Cf.enqueueReplaceState(n,n.state,null)}function Wl(e,n){var s=n;if("ref"in n){s={};for(var o in n)o!=="ref"&&(s[o]=n[o])}if(e=e.defaultProps){s===n&&(s=y({},s));for(var u in e)s[u]===void 0&&(s[u]=e[u])}return s}function Ig(e){uc(e)}function Dg(e){console.error(e)}function zg(e){uc(e)}function $c(e,n){try{var s=e.onUncaughtError;s(n.value,{componentStack:n.stack})}catch(o){setTimeout(function(){throw o})}}function qg(e,n,s){try{var o=e.onCaughtError;o(s.value,{componentStack:s.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function Of(e,n,s){return s=cl(s),s.tag=3,s.payload={element:null},s.callback=function(){$c(e,n)},s}function Ug(e){return e=cl(e),e.tag=3,e}function Bg(e,n,s,o){var u=s.type.getDerivedStateFromError;if(typeof u=="function"){var d=o.value;e.payload=function(){return u(d)},e.callback=function(){qg(n,s,o)}}var _=s.stateNode;_!==null&&typeof _.componentDidCatch=="function"&&(e.callback=function(){qg(n,s,o),typeof u!="function"&&(gl===null?gl=new Set([this]):gl.add(this));var w=o.stack;this.componentDidCatch(o.value,{componentStack:w!==null?w:""})})}function mw(e,n,s,o,u){if(s.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(n=s.alternate,n!==null&&Ki(n,s,u,!0),s=ua.current,s!==null){switch(s.tag){case 31:case 13:return Aa===null?Kc():s.alternate===null&&Ft===0&&(Ft=3),s.flags&=-257,s.flags|=65536,s.lanes=u,o===yc?s.flags|=16384:(n=s.updateQueue,n===null?s.updateQueue=new Set([o]):n.add(o),ap(e,o,u)),!1;case 22:return s.flags|=65536,o===yc?s.flags|=16384:(n=s.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([o])},s.updateQueue=n):(s=n.retryQueue,s===null?n.retryQueue=new Set([o]):s.add(o)),ap(e,o,u)),!1}throw Error(r(435,s.tag))}return ap(e,o,u),Kc(),!1}if(ot)return n=ua.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=u,o!==Pd&&(e=Error(r(422),{cause:o}),Fr(ja(e,s)))):(o!==Pd&&(n=Error(r(423),{cause:o}),Fr(ja(n,s))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,o=ja(o,s),u=Of(e.stateNode,o,u),of(e,u),Ft!==4&&(Ft=2)),!1;var d=Error(r(520),{cause:o});if(d=ja(d,s),po===null?po=[d]:po.push(d),Ft!==4&&(Ft=2),n===null)return!0;o=ja(o,s),s=n;do{switch(s.tag){case 3:return s.flags|=65536,e=u&-u,s.lanes|=e,e=Of(s.stateNode,o,e),of(s,e),!1;case 1:if(n=s.type,d=s.stateNode,(s.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||d!==null&&typeof d.componentDidCatch=="function"&&(gl===null||!gl.has(d))))return s.flags|=65536,u&=-u,s.lanes|=u,u=Ug(u),Bg(u,e,s,o),of(s,u),!1}s=s.return}while(s!==null);return!1}var $f=Error(r(461)),un=!1;function Cn(e,n,s,o){n.child=e===null?Km(n,null,s,o):Ql(n,e.child,s,o)}function Gg(e,n,s,o,u){s=s.render;var d=n.ref;if("ref"in o){var _={};for(var w in o)w!=="ref"&&(_[w]=o[w])}else _=o;return Fl(n),o=hf(e,n,s,_,d,u),w=mf(),e!==null&&!un?(gf(e,n,u),Cs(e,n,u)):(ot&&w&&Yd(n),n.flags|=1,Cn(e,n,o,u),n.child)}function Hg(e,n,s,o,u){if(e===null){var d=s.type;return typeof d=="function"&&!Kd(d)&&d.defaultProps===void 0&&s.compare===null?(n.tag=15,n.type=d,Vg(e,n,d,o,u)):(e=hc(s.type,null,o,n,n.mode,u),e.ref=n.ref,e.return=n,n.child=e)}if(d=e.child,!Bf(e,u)){var _=d.memoizedProps;if(s=s.compare,s=s!==null?s:Vr,s(_,o)&&e.ref===n.ref)return Cs(e,n,u)}return n.flags|=1,e=Ns(d,o),e.ref=n.ref,e.return=n,n.child=e}function Vg(e,n,s,o,u){if(e!==null){var d=e.memoizedProps;if(Vr(d,o)&&e.ref===n.ref)if(un=!1,n.pendingProps=o=d,Bf(e,u))(e.flags&131072)!==0&&(un=!0);else return n.lanes=e.lanes,Cs(e,n,u)}return Mf(e,n,s,o,u)}function Kg(e,n,s,o){var u=o.children,d=e!==null?e.memoizedState:null;if(e===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((n.flags&128)!==0){if(d=d!==null?d.baseLanes|s:s,e!==null){for(o=n.child=e.child,u=0;o!==null;)u=u|o.lanes|o.childLanes,o=o.sibling;o=u&~d}else o=0,n.child=null;return Zg(e,n,d,s,o)}if((s&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&vc(n,d!==null?d.cachePool:null),d!==null?Ym(n,d):uf(),Xm(n);else return o=n.lanes=536870912,Zg(e,n,d!==null?d.baseLanes|s:s,s,o)}else d!==null?(vc(n,d.cachePool),Ym(n,d),fl(),n.memoizedState=null):(e!==null&&vc(n,null),uf(),fl());return Cn(e,n,u,s),n.child}function lo(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function Zg(e,n,s,o,u){var d=af();return d=d===null?null:{parent:on._currentValue,pool:d},n.memoizedState={baseLanes:s,cachePool:d},e!==null&&vc(n,null),uf(),Xm(n),e!==null&&Ki(e,n,o,!0),n.childLanes=u,null}function Mc(e,n){return n=Ic({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function Fg(e,n,s){return Ql(n,e.child,null,s),e=Mc(n,n.pendingProps),e.flags|=2,da(n),n.memoizedState=null,e}function gw(e,n,s){var o=n.pendingProps,u=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(ot){if(o.mode==="hidden")return e=Mc(n,o),n.lanes=536870912,lo(null,e);if(ff(n),(e=Mt)?(e=lv(e,ka),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:sl!==null?{id:ns,overflow:as}:null,retryLane:536870912,hydrationErrors:null},s=Tm(e),s.return=n,n.child=s,En=n,Mt=null)):e=null,e===null)throw il(n);return n.lanes=536870912,null}return Mc(n,o)}var d=e.memoizedState;if(d!==null){var _=d.dehydrated;if(ff(n),u)if(n.flags&256)n.flags&=-257,n=Fg(e,n,s);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(r(558));else if(un||Ki(e,n,s,!1),u=(s&e.childLanes)!==0,un||u){if(o=Rt,o!==null&&(_=za(o,s),_!==0&&_!==d.retryLane))throw d.retryLane=_,Hl(e,_),Wn(o,e,_),$f;Kc(),n=Fg(e,n,s)}else e=d.treeContext,Mt=Ra(_.nextSibling),En=n,ot=!0,ll=null,ka=!1,e!==null&&$m(n,e),n=Mc(n,o),n.flags|=4096;return n}return e=Ns(e.child,{mode:o.mode,children:o.children}),e.ref=n.ref,n.child=e,e.return=n,e}function Lc(e,n){var s=n.ref;if(s===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof s!="function"&&typeof s!="object")throw Error(r(284));(e===null||e.ref!==s)&&(n.flags|=4194816)}}function Mf(e,n,s,o,u){return Fl(n),s=hf(e,n,s,o,void 0,u),o=mf(),e!==null&&!un?(gf(e,n,u),Cs(e,n,u)):(ot&&o&&Yd(n),n.flags|=1,Cn(e,n,s,u),n.child)}function Yg(e,n,s,o,u,d){return Fl(n),n.updateQueue=null,s=Qm(n,o,s,u),Pm(e),o=mf(),e!==null&&!un?(gf(e,n,d),Cs(e,n,d)):(ot&&o&&Yd(n),n.flags|=1,Cn(e,n,s,d),n.child)}function Xg(e,n,s,o,u){if(Fl(n),n.stateNode===null){var d=Bi,_=s.contextType;typeof _=="object"&&_!==null&&(d=Tn(_)),d=new s(o,d),n.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=Cf,n.stateNode=d,d._reactInternals=n,d=n.stateNode,d.props=o,d.state=n.memoizedState,d.refs={},lf(n),_=s.contextType,d.context=typeof _=="object"&&_!==null?Tn(_):Bi,d.state=n.memoizedState,_=s.getDerivedStateFromProps,typeof _=="function"&&(Tf(n,s,_,o),d.state=n.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof d.getSnapshotBeforeUpdate=="function"||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(_=d.state,typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount(),_!==d.state&&Cf.enqueueReplaceState(d,d.state,null),eo(n,o,d,u),Wr(),d.state=n.memoizedState),typeof d.componentDidMount=="function"&&(n.flags|=4194308),o=!0}else if(e===null){d=n.stateNode;var w=n.memoizedProps,O=Wl(s,w);d.props=O;var K=d.context,J=s.contextType;_=Bi,typeof J=="object"&&J!==null&&(_=Tn(J));var re=s.getDerivedStateFromProps;J=typeof re=="function"||typeof d.getSnapshotBeforeUpdate=="function",w=n.pendingProps!==w,J||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(w||K!==_)&&Lg(n,d,o,_),ol=!1;var Y=n.memoizedState;d.state=Y,eo(n,o,d,u),Wr(),K=n.memoizedState,w||Y!==K||ol?(typeof re=="function"&&(Tf(n,s,re,o),K=n.memoizedState),(O=ol||Mg(n,s,O,o,Y,K,_))?(J||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount()),typeof d.componentDidMount=="function"&&(n.flags|=4194308)):(typeof d.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=o,n.memoizedState=K),d.props=o,d.state=K,d.context=_,o=O):(typeof d.componentDidMount=="function"&&(n.flags|=4194308),o=!1)}else{d=n.stateNode,rf(e,n),_=n.memoizedProps,J=Wl(s,_),d.props=J,re=n.pendingProps,Y=d.context,K=s.contextType,O=Bi,typeof K=="object"&&K!==null&&(O=Tn(K)),w=s.getDerivedStateFromProps,(K=typeof w=="function"||typeof d.getSnapshotBeforeUpdate=="function")||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(_!==re||Y!==O)&&Lg(n,d,o,O),ol=!1,Y=n.memoizedState,d.state=Y,eo(n,o,d,u),Wr();var X=n.memoizedState;_!==re||Y!==X||ol||e!==null&&e.dependencies!==null&&gc(e.dependencies)?(typeof w=="function"&&(Tf(n,s,w,o),X=n.memoizedState),(J=ol||Mg(n,s,J,o,Y,X,O)||e!==null&&e.dependencies!==null&&gc(e.dependencies))?(K||typeof d.UNSAFE_componentWillUpdate!="function"&&typeof d.componentWillUpdate!="function"||(typeof d.componentWillUpdate=="function"&&d.componentWillUpdate(o,X,O),typeof d.UNSAFE_componentWillUpdate=="function"&&d.UNSAFE_componentWillUpdate(o,X,O)),typeof d.componentDidUpdate=="function"&&(n.flags|=4),typeof d.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof d.componentDidUpdate!="function"||_===e.memoizedProps&&Y===e.memoizedState||(n.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||_===e.memoizedProps&&Y===e.memoizedState||(n.flags|=1024),n.memoizedProps=o,n.memoizedState=X),d.props=o,d.state=X,d.context=O,o=J):(typeof d.componentDidUpdate!="function"||_===e.memoizedProps&&Y===e.memoizedState||(n.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||_===e.memoizedProps&&Y===e.memoizedState||(n.flags|=1024),o=!1)}return d=o,Lc(e,n),o=(n.flags&128)!==0,d||o?(d=n.stateNode,s=o&&typeof s.getDerivedStateFromError!="function"?null:d.render(),n.flags|=1,e!==null&&o?(n.child=Ql(n,e.child,null,u),n.child=Ql(n,null,s,u)):Cn(e,n,s,u),n.memoizedState=d.state,e=n.child):e=Cs(e,n,u),e}function Pg(e,n,s,o){return Kl(),n.flags|=256,Cn(e,n,s,o),n.child}var Lf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function If(e){return{baseLanes:e,cachePool:qm()}}function Df(e,n,s){return e=e!==null?e.childLanes&~s:0,n&&(e|=pa),e}function Qg(e,n,s){var o=n.pendingProps,u=!1,d=(n.flags&128)!==0,_;if((_=d)||(_=e!==null&&e.memoizedState===null?!1:(nn.current&2)!==0),_&&(u=!0,n.flags&=-129),_=(n.flags&32)!==0,n.flags&=-33,e===null){if(ot){if(u?dl(n):fl(),(e=Mt)?(e=lv(e,ka),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:sl!==null?{id:ns,overflow:as}:null,retryLane:536870912,hydrationErrors:null},s=Tm(e),s.return=n,n.child=s,En=n,Mt=null)):e=null,e===null)throw il(n);return bp(e)?n.lanes=32:n.lanes=536870912,null}var w=o.children;return o=o.fallback,u?(fl(),u=n.mode,w=Ic({mode:"hidden",children:w},u),o=Vl(o,u,s,null),w.return=n,o.return=n,w.sibling=o,n.child=w,o=n.child,o.memoizedState=If(s),o.childLanes=Df(e,_,s),n.memoizedState=Lf,lo(null,o)):(dl(n),zf(n,w))}var O=e.memoizedState;if(O!==null&&(w=O.dehydrated,w!==null)){if(d)n.flags&256?(dl(n),n.flags&=-257,n=qf(e,n,s)):n.memoizedState!==null?(fl(),n.child=e.child,n.flags|=128,n=null):(fl(),w=o.fallback,u=n.mode,o=Ic({mode:"visible",children:o.children},u),w=Vl(w,u,s,null),w.flags|=2,o.return=n,w.return=n,o.sibling=w,n.child=o,Ql(n,e.child,null,s),o=n.child,o.memoizedState=If(s),o.childLanes=Df(e,_,s),n.memoizedState=Lf,n=lo(null,o));else if(dl(n),bp(w)){if(_=w.nextSibling&&w.nextSibling.dataset,_)var K=_.dgst;_=K,o=Error(r(419)),o.stack="",o.digest=_,Fr({value:o,source:null,stack:null}),n=qf(e,n,s)}else if(un||Ki(e,n,s,!1),_=(s&e.childLanes)!==0,un||_){if(_=Rt,_!==null&&(o=za(_,s),o!==0&&o!==O.retryLane))throw O.retryLane=o,Hl(e,o),Wn(_,e,o),$f;vp(w)||Kc(),n=qf(e,n,s)}else vp(w)?(n.flags|=192,n.child=e.child,n=null):(e=O.treeContext,Mt=Ra(w.nextSibling),En=n,ot=!0,ll=null,ka=!1,e!==null&&$m(n,e),n=zf(n,o.children),n.flags|=4096);return n}return u?(fl(),w=o.fallback,u=n.mode,O=e.child,K=O.sibling,o=Ns(O,{mode:"hidden",children:o.children}),o.subtreeFlags=O.subtreeFlags&65011712,K!==null?w=Ns(K,w):(w=Vl(w,u,s,null),w.flags|=2),w.return=n,o.return=n,o.sibling=w,n.child=o,lo(null,o),o=n.child,w=e.child.memoizedState,w===null?w=If(s):(u=w.cachePool,u!==null?(O=on._currentValue,u=u.parent!==O?{parent:O,pool:O}:u):u=qm(),w={baseLanes:w.baseLanes|s,cachePool:u}),o.memoizedState=w,o.childLanes=Df(e,_,s),n.memoizedState=Lf,lo(e.child,o)):(dl(n),s=e.child,e=s.sibling,s=Ns(s,{mode:"visible",children:o.children}),s.return=n,s.sibling=null,e!==null&&(_=n.deletions,_===null?(n.deletions=[e],n.flags|=16):_.push(e)),n.child=s,n.memoizedState=null,s)}function zf(e,n){return n=Ic({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function Ic(e,n){return e=ca(22,e,null,n),e.lanes=0,e}function qf(e,n,s){return Ql(n,e.child,null,s),e=zf(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function Jg(e,n,s){e.lanes|=n;var o=e.alternate;o!==null&&(o.lanes|=n),Wd(e.return,n,s)}function Uf(e,n,s,o,u,d){var _=e.memoizedState;_===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:o,tail:s,tailMode:u,treeForkCount:d}:(_.isBackwards=n,_.rendering=null,_.renderingStartTime=0,_.last=o,_.tail=s,_.tailMode=u,_.treeForkCount=d)}function Wg(e,n,s){var o=n.pendingProps,u=o.revealOrder,d=o.tail;o=o.children;var _=nn.current,w=(_&2)!==0;if(w?(_=_&1|2,n.flags|=128):_&=1,U(nn,_),Cn(e,n,o,s),o=ot?Zr:0,!w&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Jg(e,s,n);else if(e.tag===19)Jg(e,s,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(u){case"forwards":for(s=n.child,u=null;s!==null;)e=s.alternate,e!==null&&Sc(e)===null&&(u=s),s=s.sibling;s=u,s===null?(u=n.child,n.child=null):(u=s.sibling,s.sibling=null),Uf(n,!1,u,s,d,o);break;case"backwards":case"unstable_legacy-backwards":for(s=null,u=n.child,n.child=null;u!==null;){if(e=u.alternate,e!==null&&Sc(e)===null){n.child=u;break}e=u.sibling,u.sibling=s,s=u,u=e}Uf(n,!0,s,null,d,o);break;case"together":Uf(n,!1,null,null,void 0,o);break;default:n.memoizedState=null}return n.child}function Cs(e,n,s){if(e!==null&&(n.dependencies=e.dependencies),ml|=n.lanes,(s&n.childLanes)===0)if(e!==null){if(Ki(e,n,s,!1),(s&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(r(153));if(n.child!==null){for(e=n.child,s=Ns(e,e.pendingProps),n.child=s,s.return=n;e.sibling!==null;)e=e.sibling,s=s.sibling=Ns(e,e.pendingProps),s.return=n;s.sibling=null}return n.child}function Bf(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&gc(e)))}function _w(e,n,s){switch(n.tag){case 3:Ve(n,n.stateNode.containerInfo),rl(n,on,e.memoizedState.cache),Kl();break;case 27:case 5:Re(n);break;case 4:Ve(n,n.stateNode.containerInfo);break;case 10:rl(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,ff(n),null;break;case 13:var o=n.memoizedState;if(o!==null)return o.dehydrated!==null?(dl(n),n.flags|=128,null):(s&n.child.childLanes)!==0?Qg(e,n,s):(dl(n),e=Cs(e,n,s),e!==null?e.sibling:null);dl(n);break;case 19:var u=(e.flags&128)!==0;if(o=(s&n.childLanes)!==0,o||(Ki(e,n,s,!1),o=(s&n.childLanes)!==0),u){if(o)return Wg(e,n,s);n.flags|=128}if(u=n.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),U(nn,nn.current),o)break;return null;case 22:return n.lanes=0,Kg(e,n,s,n.pendingProps);case 24:rl(n,on,e.memoizedState.cache)}return Cs(e,n,s)}function e_(e,n,s){if(e!==null)if(e.memoizedProps!==n.pendingProps)un=!0;else{if(!Bf(e,s)&&(n.flags&128)===0)return un=!1,_w(e,n,s);un=(e.flags&131072)!==0}else un=!1,ot&&(n.flags&1048576)!==0&&Om(n,Zr,n.index);switch(n.lanes=0,n.tag){case 16:e:{var o=n.pendingProps;if(e=Xl(n.elementType),n.type=e,typeof e=="function")Kd(e)?(o=Wl(e,o),n.tag=1,n=Xg(null,n,e,o,s)):(n.tag=0,n=Mf(null,n,e,o,s));else{if(e!=null){var u=e.$$typeof;if(u===R){n.tag=11,n=Gg(null,n,e,o,s);break e}else if(u===Z){n.tag=14,n=Hg(null,n,e,o,s);break e}}throw n=be(e)||e,Error(r(306,n,""))}}return n;case 0:return Mf(e,n,n.type,n.pendingProps,s);case 1:return o=n.type,u=Wl(o,n.pendingProps),Xg(e,n,o,u,s);case 3:e:{if(Ve(n,n.stateNode.containerInfo),e===null)throw Error(r(387));o=n.pendingProps;var d=n.memoizedState;u=d.element,rf(e,n),eo(n,o,null,s);var _=n.memoizedState;if(o=_.cache,rl(n,on,o),o!==d.cache&&ef(n,[on],s,!0),Wr(),o=_.element,d.isDehydrated)if(d={element:o,isDehydrated:!1,cache:_.cache},n.updateQueue.baseState=d,n.memoizedState=d,n.flags&256){n=Pg(e,n,o,s);break e}else if(o!==u){u=ja(Error(r(424)),n),Fr(u),n=Pg(e,n,o,s);break e}else for(e=n.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,Mt=Ra(e.firstChild),En=n,ot=!0,ll=null,ka=!0,s=Km(n,null,o,s),n.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(Kl(),o===u){n=Cs(e,n,s);break e}Cn(e,n,o,s)}n=n.child}return n;case 26:return Lc(e,n),e===null?(s=dv(n.type,null,n.pendingProps,null))?n.memoizedState=s:ot||(s=n.type,e=n.pendingProps,o=Jc(F.current).createElement(s),o[ke]=n,o[Oe]=e,On(o,s,e),ft(o),n.stateNode=o):n.memoizedState=dv(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return Re(n),e===null&&ot&&(o=n.stateNode=ov(n.type,n.pendingProps,F.current),En=n,ka=!0,u=Mt,yl(n.type)?(yp=u,Mt=Ra(o.firstChild)):Mt=u),Cn(e,n,n.pendingProps.children,s),Lc(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&ot&&((u=o=Mt)&&(o=Fw(o,n.type,n.pendingProps,ka),o!==null?(n.stateNode=o,En=n,Mt=Ra(o.firstChild),ka=!1,u=!0):u=!1),u||il(n)),Re(n),u=n.type,d=n.pendingProps,_=e!==null?e.memoizedProps:null,o=d.children,mp(u,d)?o=null:_!==null&&mp(u,_)&&(n.flags|=32),n.memoizedState!==null&&(u=hf(e,n,ow,null,null,s),xo._currentValue=u),Lc(e,n),Cn(e,n,o,s),n.child;case 6:return e===null&&ot&&((e=s=Mt)&&(s=Yw(s,n.pendingProps,ka),s!==null?(n.stateNode=s,En=n,Mt=null,e=!0):e=!1),e||il(n)),null;case 13:return Qg(e,n,s);case 4:return Ve(n,n.stateNode.containerInfo),o=n.pendingProps,e===null?n.child=Ql(n,null,o,s):Cn(e,n,o,s),n.child;case 11:return Gg(e,n,n.type,n.pendingProps,s);case 7:return Cn(e,n,n.pendingProps,s),n.child;case 8:return Cn(e,n,n.pendingProps.children,s),n.child;case 12:return Cn(e,n,n.pendingProps.children,s),n.child;case 10:return o=n.pendingProps,rl(n,n.type,o.value),Cn(e,n,o.children,s),n.child;case 9:return u=n.type._context,o=n.pendingProps.children,Fl(n),u=Tn(u),o=o(u),n.flags|=1,Cn(e,n,o,s),n.child;case 14:return Hg(e,n,n.type,n.pendingProps,s);case 15:return Vg(e,n,n.type,n.pendingProps,s);case 19:return Wg(e,n,s);case 31:return gw(e,n,s);case 22:return Kg(e,n,s,n.pendingProps);case 24:return Fl(n),o=Tn(on),e===null?(u=af(),u===null&&(u=Rt,d=tf(),u.pooledCache=d,d.refCount++,d!==null&&(u.pooledCacheLanes|=s),u=d),n.memoizedState={parent:o,cache:u},lf(n),rl(n,on,u)):((e.lanes&s)!==0&&(rf(e,n),eo(n,null,null,s),Wr()),u=e.memoizedState,d=n.memoizedState,u.parent!==o?(u={parent:o,cache:o},n.memoizedState=u,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=u),rl(n,on,o)):(o=d.cache,rl(n,on,o),o!==u.cache&&ef(n,[on],s,!0))),Cn(e,n,n.pendingProps.children,s),n.child;case 29:throw n.pendingProps}throw Error(r(156,n.tag))}function Os(e){e.flags|=4}function Gf(e,n,s,o,u){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(u&335544128)===u)if(e.stateNode.complete)e.flags|=8192;else if(A_())e.flags|=8192;else throw Pl=yc,sf}else e.flags&=-16777217}function t_(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!gv(n))if(A_())e.flags|=8192;else throw Pl=yc,sf}function Dc(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?zt():536870912,e.lanes|=n,ar|=n)}function io(e,n){if(!ot)switch(e.tailMode){case"hidden":n=e.tail;for(var s=null;n!==null;)n.alternate!==null&&(s=n),n=n.sibling;s===null?e.tail=null:s.sibling=null;break;case"collapsed":s=e.tail;for(var o=null;s!==null;)s.alternate!==null&&(o=s),s=s.sibling;o===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:o.sibling=null}}function Lt(e){var n=e.alternate!==null&&e.alternate.child===e.child,s=0,o=0;if(n)for(var u=e.child;u!==null;)s|=u.lanes|u.childLanes,o|=u.subtreeFlags&65011712,o|=u.flags&65011712,u.return=e,u=u.sibling;else for(u=e.child;u!==null;)s|=u.lanes|u.childLanes,o|=u.subtreeFlags,o|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=o,e.childLanes=s,n}function vw(e,n,s){var o=n.pendingProps;switch(Xd(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Lt(n),null;case 1:return Lt(n),null;case 3:return s=n.stateNode,o=null,e!==null&&(o=e.memoizedState.cache),n.memoizedState.cache!==o&&(n.flags|=2048),Rs(on),Se(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(e===null||e.child===null)&&(Vi(n)?Os(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Qd())),Lt(n),null;case 26:var u=n.type,d=n.memoizedState;return e===null?(Os(n),d!==null?(Lt(n),t_(n,d)):(Lt(n),Gf(n,u,null,o,s))):d?d!==e.memoizedState?(Os(n),Lt(n),t_(n,d)):(Lt(n),n.flags&=-16777217):(e=e.memoizedProps,e!==o&&Os(n),Lt(n),Gf(n,u,e,o,s)),null;case 27:if(Pe(n),s=F.current,u=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==o&&Os(n);else{if(!o){if(n.stateNode===null)throw Error(r(166));return Lt(n),null}e=Q.current,Vi(n)?Mm(n):(e=ov(u,o,s),n.stateNode=e,Os(n))}return Lt(n),null;case 5:if(Pe(n),u=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==o&&Os(n);else{if(!o){if(n.stateNode===null)throw Error(r(166));return Lt(n),null}if(d=Q.current,Vi(n))Mm(n);else{var _=Jc(F.current);switch(d){case 1:d=_.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:d=_.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":d=_.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":d=_.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":d=_.createElement("div"),d.innerHTML="<script><\/script>",d=d.removeChild(d.firstChild);break;case"select":d=typeof o.is=="string"?_.createElement("select",{is:o.is}):_.createElement("select"),o.multiple?d.multiple=!0:o.size&&(d.size=o.size);break;default:d=typeof o.is=="string"?_.createElement(u,{is:o.is}):_.createElement(u)}}d[ke]=n,d[Oe]=o;e:for(_=n.child;_!==null;){if(_.tag===5||_.tag===6)d.appendChild(_.stateNode);else if(_.tag!==4&&_.tag!==27&&_.child!==null){_.child.return=_,_=_.child;continue}if(_===n)break e;for(;_.sibling===null;){if(_.return===null||_.return===n)break e;_=_.return}_.sibling.return=_.return,_=_.sibling}n.stateNode=d;e:switch(On(d,u,o),u){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&Os(n)}}return Lt(n),Gf(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,s),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==o&&Os(n);else{if(typeof o!="string"&&n.stateNode===null)throw Error(r(166));if(e=F.current,Vi(n)){if(e=n.stateNode,s=n.memoizedProps,o=null,u=En,u!==null)switch(u.tag){case 27:case 5:o=u.memoizedProps}e[ke]=n,e=!!(e.nodeValue===s||o!==null&&o.suppressHydrationWarning===!0||Q_(e.nodeValue,s)),e||il(n,!0)}else e=Jc(e).createTextNode(o),e[ke]=n,n.stateNode=e}return Lt(n),null;case 31:if(s=n.memoizedState,e===null||e.memoizedState!==null){if(o=Vi(n),s!==null){if(e===null){if(!o)throw Error(r(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(557));e[ke]=n}else Kl(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Lt(n),e=!1}else s=Qd(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),e=!0;if(!e)return n.flags&256?(da(n),n):(da(n),null);if((n.flags&128)!==0)throw Error(r(558))}return Lt(n),null;case 13:if(o=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=Vi(n),o!==null&&o.dehydrated!==null){if(e===null){if(!u)throw Error(r(318));if(u=n.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(317));u[ke]=n}else Kl(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Lt(n),u=!1}else u=Qd(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return n.flags&256?(da(n),n):(da(n),null)}return da(n),(n.flags&128)!==0?(n.lanes=s,n):(s=o!==null,e=e!==null&&e.memoizedState!==null,s&&(o=n.child,u=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(u=o.alternate.memoizedState.cachePool.pool),d=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(d=o.memoizedState.cachePool.pool),d!==u&&(o.flags|=2048)),s!==e&&s&&(n.child.flags|=8192),Dc(n,n.updateQueue),Lt(n),null);case 4:return Se(),e===null&&up(n.stateNode.containerInfo),Lt(n),null;case 10:return Rs(n.type),Lt(n),null;case 19:if(L(nn),o=n.memoizedState,o===null)return Lt(n),null;if(u=(n.flags&128)!==0,d=o.rendering,d===null)if(u)io(o,!1);else{if(Ft!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(d=Sc(e),d!==null){for(n.flags|=128,io(o,!1),e=d.updateQueue,n.updateQueue=e,Dc(n,e),n.subtreeFlags=0,e=s,s=n.child;s!==null;)Em(s,e),s=s.sibling;return U(nn,nn.current&1|2),ot&&ks(n,o.treeForkCount),n.child}e=e.sibling}o.tail!==null&<()>Gc&&(n.flags|=128,u=!0,io(o,!1),n.lanes=4194304)}else{if(!u)if(e=Sc(d),e!==null){if(n.flags|=128,u=!0,e=e.updateQueue,n.updateQueue=e,Dc(n,e),io(o,!0),o.tail===null&&o.tailMode==="hidden"&&!d.alternate&&!ot)return Lt(n),null}else 2*lt()-o.renderingStartTime>Gc&&s!==536870912&&(n.flags|=128,u=!0,io(o,!1),n.lanes=4194304);o.isBackwards?(d.sibling=n.child,n.child=d):(e=o.last,e!==null?e.sibling=d:n.child=d,o.last=d)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=lt(),e.sibling=null,s=nn.current,U(nn,u?s&1|2:s&1),ot&&ks(n,o.treeForkCount),e):(Lt(n),null);case 22:case 23:return da(n),df(),o=n.memoizedState!==null,e!==null?e.memoizedState!==null!==o&&(n.flags|=8192):o&&(n.flags|=8192),o?(s&536870912)!==0&&(n.flags&128)===0&&(Lt(n),n.subtreeFlags&6&&(n.flags|=8192)):Lt(n),s=n.updateQueue,s!==null&&Dc(n,s.retryQueue),s=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(s=e.memoizedState.cachePool.pool),o=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),o!==s&&(n.flags|=2048),e!==null&&L(Yl),null;case 24:return s=null,e!==null&&(s=e.memoizedState.cache),n.memoizedState.cache!==s&&(n.flags|=2048),Rs(on),Lt(n),null;case 25:return null;case 30:return null}throw Error(r(156,n.tag))}function bw(e,n){switch(Xd(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return Rs(on),Se(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return Pe(n),null;case 31:if(n.memoizedState!==null){if(da(n),n.alternate===null)throw Error(r(340));Kl()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(da(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(r(340));Kl()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return L(nn),null;case 4:return Se(),null;case 10:return Rs(n.type),null;case 22:case 23:return da(n),df(),e!==null&&L(Yl),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return Rs(on),null;case 25:return null;default:return null}}function n_(e,n){switch(Xd(n),n.tag){case 3:Rs(on),Se();break;case 26:case 27:case 5:Pe(n);break;case 4:Se();break;case 31:n.memoizedState!==null&&da(n);break;case 13:da(n);break;case 19:L(nn);break;case 10:Rs(n.type);break;case 22:case 23:da(n),df(),e!==null&&L(Yl);break;case 24:Rs(on)}}function ro(e,n){try{var s=n.updateQueue,o=s!==null?s.lastEffect:null;if(o!==null){var u=o.next;s=u;do{if((s.tag&e)===e){o=void 0;var d=s.create,_=s.inst;o=d(),_.destroy=o}s=s.next}while(s!==u)}}catch(w){xt(n,n.return,w)}}function pl(e,n,s){try{var o=n.updateQueue,u=o!==null?o.lastEffect:null;if(u!==null){var d=u.next;o=d;do{if((o.tag&e)===e){var _=o.inst,w=_.destroy;if(w!==void 0){_.destroy=void 0,u=n;var O=s,K=w;try{K()}catch(J){xt(u,O,J)}}}o=o.next}while(o!==d)}}catch(J){xt(n,n.return,J)}}function a_(e){var n=e.updateQueue;if(n!==null){var s=e.stateNode;try{Fm(n,s)}catch(o){xt(e,e.return,o)}}}function s_(e,n,s){s.props=Wl(e.type,e.memoizedProps),s.state=e.memoizedState;try{s.componentWillUnmount()}catch(o){xt(e,n,o)}}function oo(e,n){try{var s=e.ref;if(s!==null){switch(e.tag){case 26:case 27:case 5:var o=e.stateNode;break;case 30:o=e.stateNode;break;default:o=e.stateNode}typeof s=="function"?e.refCleanup=s(o):s.current=o}}catch(u){xt(e,n,u)}}function ss(e,n){var s=e.ref,o=e.refCleanup;if(s!==null)if(typeof o=="function")try{o()}catch(u){xt(e,n,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof s=="function")try{s(null)}catch(u){xt(e,n,u)}else s.current=null}function l_(e){var n=e.type,s=e.memoizedProps,o=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":s.autoFocus&&o.focus();break e;case"img":s.src?o.src=s.src:s.srcSet&&(o.srcset=s.srcSet)}}catch(u){xt(e,e.return,u)}}function Hf(e,n,s){try{var o=e.stateNode;Bw(o,e.type,s,n),o[Oe]=n}catch(u){xt(e,e.return,u)}}function i_(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&yl(e.type)||e.tag===4}function Vf(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||i_(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&&yl(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 Kf(e,n,s){var o=e.tag;if(o===5||o===6)e=e.stateNode,n?(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s).insertBefore(e,n):(n=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,n.appendChild(e),s=s._reactRootContainer,s!=null||n.onclick!==null||(n.onclick=ya));else if(o!==4&&(o===27&&yl(e.type)&&(s=e.stateNode,n=null),e=e.child,e!==null))for(Kf(e,n,s),e=e.sibling;e!==null;)Kf(e,n,s),e=e.sibling}function zc(e,n,s){var o=e.tag;if(o===5||o===6)e=e.stateNode,n?s.insertBefore(e,n):s.appendChild(e);else if(o!==4&&(o===27&&yl(e.type)&&(s=e.stateNode),e=e.child,e!==null))for(zc(e,n,s),e=e.sibling;e!==null;)zc(e,n,s),e=e.sibling}function r_(e){var n=e.stateNode,s=e.memoizedProps;try{for(var o=e.type,u=n.attributes;u.length;)n.removeAttributeNode(u[0]);On(n,o,s),n[ke]=e,n[Oe]=s}catch(d){xt(e,e.return,d)}}var $s=!1,dn=!1,Zf=!1,o_=typeof WeakSet=="function"?WeakSet:Set,jn=null;function yw(e,n){if(e=e.containerInfo,pp=lu,e=ym(e),zd(e)){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else e:{s=(s=e.ownerDocument)&&s.defaultView||window;var o=s.getSelection&&s.getSelection();if(o&&o.rangeCount!==0){s=o.anchorNode;var u=o.anchorOffset,d=o.focusNode;o=o.focusOffset;try{s.nodeType,d.nodeType}catch{s=null;break e}var _=0,w=-1,O=-1,K=0,J=0,re=e,Y=null;t:for(;;){for(var X;re!==s||u!==0&&re.nodeType!==3||(w=_+u),re!==d||o!==0&&re.nodeType!==3||(O=_+o),re.nodeType===3&&(_+=re.nodeValue.length),(X=re.firstChild)!==null;)Y=re,re=X;for(;;){if(re===e)break t;if(Y===s&&++K===u&&(w=_),Y===d&&++J===o&&(O=_),(X=re.nextSibling)!==null)break;re=Y,Y=re.parentNode}re=X}s=w===-1||O===-1?null:{start:w,end:O}}else s=null}s=s||{start:0,end:0}}else s=null;for(hp={focusedElem:e,selectionRange:s},lu=!1,jn=n;jn!==null;)if(n=jn,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,jn=e;else for(;jn!==null;){switch(n=jn,d=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(s=0;s<e.length;s++)u=e[s],u.ref.impl=u.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&d!==null){e=void 0,s=n,u=d.memoizedProps,d=d.memoizedState,o=s.stateNode;try{var Te=Wl(s.type,u);e=o.getSnapshotBeforeUpdate(Te,d),o.__reactInternalSnapshotBeforeUpdate=e}catch(ze){xt(s,s.return,ze)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,s=e.nodeType,s===9)_p(e);else if(s===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":_p(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(r(163))}if(e=n.sibling,e!==null){e.return=n.return,jn=e;break}jn=n.return}}function c_(e,n,s){var o=s.flags;switch(s.tag){case 0:case 11:case 15:Ls(e,s),o&4&&ro(5,s);break;case 1:if(Ls(e,s),o&4)if(e=s.stateNode,n===null)try{e.componentDidMount()}catch(_){xt(s,s.return,_)}else{var u=Wl(s.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(u,n,e.__reactInternalSnapshotBeforeUpdate)}catch(_){xt(s,s.return,_)}}o&64&&a_(s),o&512&&oo(s,s.return);break;case 3:if(Ls(e,s),o&64&&(e=s.updateQueue,e!==null)){if(n=null,s.child!==null)switch(s.child.tag){case 27:case 5:n=s.child.stateNode;break;case 1:n=s.child.stateNode}try{Fm(e,n)}catch(_){xt(s,s.return,_)}}break;case 27:n===null&&o&4&&r_(s);case 26:case 5:Ls(e,s),n===null&&o&4&&l_(s),o&512&&oo(s,s.return);break;case 12:Ls(e,s);break;case 31:Ls(e,s),o&4&&f_(e,s);break;case 13:Ls(e,s),o&4&&p_(e,s),o&64&&(e=s.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(s=Ew.bind(null,s),Xw(e,s))));break;case 22:if(o=s.memoizedState!==null||$s,!o){n=n!==null&&n.memoizedState!==null||dn,u=$s;var d=dn;$s=o,(dn=n)&&!d?Is(e,s,(s.subtreeFlags&8772)!==0):Ls(e,s),$s=u,dn=d}break;case 30:break;default:Ls(e,s)}}function u_(e){var n=e.alternate;n!==null&&(e.alternate=null,u_(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&An(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 Ut=null,Xn=!1;function Ms(e,n,s){for(s=s.child;s!==null;)d_(e,n,s),s=s.sibling}function d_(e,n,s){if(dt&&typeof dt.onCommitFiberUnmount=="function")try{dt.onCommitFiberUnmount(Qe,s)}catch{}switch(s.tag){case 26:dn||ss(s,n),Ms(e,n,s),s.memoizedState?s.memoizedState.count--:s.stateNode&&(s=s.stateNode,s.parentNode.removeChild(s));break;case 27:dn||ss(s,n);var o=Ut,u=Xn;yl(s.type)&&(Ut=s.stateNode,Xn=!1),Ms(e,n,s),vo(s.stateNode),Ut=o,Xn=u;break;case 5:dn||ss(s,n);case 6:if(o=Ut,u=Xn,Ut=null,Ms(e,n,s),Ut=o,Xn=u,Ut!==null)if(Xn)try{(Ut.nodeType===9?Ut.body:Ut.nodeName==="HTML"?Ut.ownerDocument.body:Ut).removeChild(s.stateNode)}catch(d){xt(s,n,d)}else try{Ut.removeChild(s.stateNode)}catch(d){xt(s,n,d)}break;case 18:Ut!==null&&(Xn?(e=Ut,av(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,s.stateNode),dr(e)):av(Ut,s.stateNode));break;case 4:o=Ut,u=Xn,Ut=s.stateNode.containerInfo,Xn=!0,Ms(e,n,s),Ut=o,Xn=u;break;case 0:case 11:case 14:case 15:pl(2,s,n),dn||pl(4,s,n),Ms(e,n,s);break;case 1:dn||(ss(s,n),o=s.stateNode,typeof o.componentWillUnmount=="function"&&s_(s,n,o)),Ms(e,n,s);break;case 21:Ms(e,n,s);break;case 22:dn=(o=dn)||s.memoizedState!==null,Ms(e,n,s),dn=o;break;default:Ms(e,n,s)}}function f_(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{dr(e)}catch(s){xt(n,n.return,s)}}}function p_(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{dr(e)}catch(s){xt(n,n.return,s)}}function xw(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new o_),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new o_),n;default:throw Error(r(435,e.tag))}}function qc(e,n){var s=xw(e);n.forEach(function(o){if(!s.has(o)){s.add(o);var u=Tw.bind(null,e,o);o.then(u,u)}})}function Pn(e,n){var s=n.deletions;if(s!==null)for(var o=0;o<s.length;o++){var u=s[o],d=e,_=n,w=_;e:for(;w!==null;){switch(w.tag){case 27:if(yl(w.type)){Ut=w.stateNode,Xn=!1;break e}break;case 5:Ut=w.stateNode,Xn=!1;break e;case 3:case 4:Ut=w.stateNode.containerInfo,Xn=!0;break e}w=w.return}if(Ut===null)throw Error(r(160));d_(d,_,u),Ut=null,Xn=!1,d=u.alternate,d!==null&&(d.return=null),u.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)h_(n,e),n=n.sibling}var Ha=null;function h_(e,n){var s=e.alternate,o=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Pn(n,e),Qn(e),o&4&&(pl(3,e,e.return),ro(3,e),pl(5,e,e.return));break;case 1:Pn(n,e),Qn(e),o&512&&(dn||s===null||ss(s,s.return)),o&64&&$s&&(e=e.updateQueue,e!==null&&(o=e.callbacks,o!==null&&(s=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=s===null?o:s.concat(o))));break;case 26:var u=Ha;if(Pn(n,e),Qn(e),o&512&&(dn||s===null||ss(s,s.return)),o&4){var d=s!==null?s.memoizedState:null;if(o=e.memoizedState,s===null)if(o===null)if(e.stateNode===null){e:{o=e.type,s=e.memoizedProps,u=u.ownerDocument||u;t:switch(o){case"title":d=u.getElementsByTagName("title")[0],(!d||d[qt]||d[ke]||d.namespaceURI==="http://www.w3.org/2000/svg"||d.hasAttribute("itemprop"))&&(d=u.createElement(o),u.head.insertBefore(d,u.querySelector("head > title"))),On(d,o,s),d[ke]=e,ft(d),o=d;break e;case"link":var _=hv("link","href",u).get(o+(s.href||""));if(_){for(var w=0;w<_.length;w++)if(d=_[w],d.getAttribute("href")===(s.href==null||s.href===""?null:s.href)&&d.getAttribute("rel")===(s.rel==null?null:s.rel)&&d.getAttribute("title")===(s.title==null?null:s.title)&&d.getAttribute("crossorigin")===(s.crossOrigin==null?null:s.crossOrigin)){_.splice(w,1);break t}}d=u.createElement(o),On(d,o,s),u.head.appendChild(d);break;case"meta":if(_=hv("meta","content",u).get(o+(s.content||""))){for(w=0;w<_.length;w++)if(d=_[w],d.getAttribute("content")===(s.content==null?null:""+s.content)&&d.getAttribute("name")===(s.name==null?null:s.name)&&d.getAttribute("property")===(s.property==null?null:s.property)&&d.getAttribute("http-equiv")===(s.httpEquiv==null?null:s.httpEquiv)&&d.getAttribute("charset")===(s.charSet==null?null:s.charSet)){_.splice(w,1);break t}}d=u.createElement(o),On(d,o,s),u.head.appendChild(d);break;default:throw Error(r(468,o))}d[ke]=e,ft(d),o=d}e.stateNode=o}else mv(u,e.type,e.stateNode);else e.stateNode=pv(u,o,e.memoizedProps);else d!==o?(d===null?s.stateNode!==null&&(s=s.stateNode,s.parentNode.removeChild(s)):d.count--,o===null?mv(u,e.type,e.stateNode):pv(u,o,e.memoizedProps)):o===null&&e.stateNode!==null&&Hf(e,e.memoizedProps,s.memoizedProps)}break;case 27:Pn(n,e),Qn(e),o&512&&(dn||s===null||ss(s,s.return)),s!==null&&o&4&&Hf(e,e.memoizedProps,s.memoizedProps);break;case 5:if(Pn(n,e),Qn(e),o&512&&(dn||s===null||ss(s,s.return)),e.flags&32){u=e.stateNode;try{tl(u,"")}catch(Te){xt(e,e.return,Te)}}o&4&&e.stateNode!=null&&(u=e.memoizedProps,Hf(e,u,s!==null?s.memoizedProps:u)),o&1024&&(Zf=!0);break;case 6:if(Pn(n,e),Qn(e),o&4){if(e.stateNode===null)throw Error(r(162));o=e.memoizedProps,s=e.stateNode;try{s.nodeValue=o}catch(Te){xt(e,e.return,Te)}}break;case 3:if(tu=null,u=Ha,Ha=Wc(n.containerInfo),Pn(n,e),Ha=u,Qn(e),o&4&&s!==null&&s.memoizedState.isDehydrated)try{dr(n.containerInfo)}catch(Te){xt(e,e.return,Te)}Zf&&(Zf=!1,m_(e));break;case 4:o=Ha,Ha=Wc(e.stateNode.containerInfo),Pn(n,e),Qn(e),Ha=o;break;case 12:Pn(n,e),Qn(e);break;case 31:Pn(n,e),Qn(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,qc(e,o)));break;case 13:Pn(n,e),Qn(e),e.child.flags&8192&&e.memoizedState!==null!=(s!==null&&s.memoizedState!==null)&&(Bc=lt()),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,qc(e,o)));break;case 22:u=e.memoizedState!==null;var O=s!==null&&s.memoizedState!==null,K=$s,J=dn;if($s=K||u,dn=J||O,Pn(n,e),dn=J,$s=K,Qn(e),o&8192)e:for(n=e.stateNode,n._visibility=u?n._visibility&-2:n._visibility|1,u&&(s===null||O||$s||dn||ei(e)),s=null,n=e;;){if(n.tag===5||n.tag===26){if(s===null){O=s=n;try{if(d=O.stateNode,u)_=d.style,typeof _.setProperty=="function"?_.setProperty("display","none","important"):_.display="none";else{w=O.stateNode;var re=O.memoizedProps.style,Y=re!=null&&re.hasOwnProperty("display")?re.display:null;w.style.display=Y==null||typeof Y=="boolean"?"":(""+Y).trim()}}catch(Te){xt(O,O.return,Te)}}}else if(n.tag===6){if(s===null){O=n;try{O.stateNode.nodeValue=u?"":O.memoizedProps}catch(Te){xt(O,O.return,Te)}}}else if(n.tag===18){if(s===null){O=n;try{var X=O.stateNode;u?sv(X,!0):sv(O.stateNode,!1)}catch(Te){xt(O,O.return,Te)}}}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;s===n&&(s=null),n=n.return}s===n&&(s=null),n.sibling.return=n.return,n=n.sibling}o&4&&(o=e.updateQueue,o!==null&&(s=o.retryQueue,s!==null&&(o.retryQueue=null,qc(e,s))));break;case 19:Pn(n,e),Qn(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,qc(e,o)));break;case 30:break;case 21:break;default:Pn(n,e),Qn(e)}}function Qn(e){var n=e.flags;if(n&2){try{for(var s,o=e.return;o!==null;){if(i_(o)){s=o;break}o=o.return}if(s==null)throw Error(r(160));switch(s.tag){case 27:var u=s.stateNode,d=Vf(e);zc(e,d,u);break;case 5:var _=s.stateNode;s.flags&32&&(tl(_,""),s.flags&=-33);var w=Vf(e);zc(e,w,_);break;case 3:case 4:var O=s.stateNode.containerInfo,K=Vf(e);Kf(e,K,O);break;default:throw Error(r(161))}}catch(J){xt(e,e.return,J)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function m_(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;m_(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function Ls(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)c_(e,n.alternate,n),n=n.sibling}function ei(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:pl(4,n,n.return),ei(n);break;case 1:ss(n,n.return);var s=n.stateNode;typeof s.componentWillUnmount=="function"&&s_(n,n.return,s),ei(n);break;case 27:vo(n.stateNode);case 26:case 5:ss(n,n.return),ei(n);break;case 22:n.memoizedState===null&&ei(n);break;case 30:ei(n);break;default:ei(n)}e=e.sibling}}function Is(e,n,s){for(s=s&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var o=n.alternate,u=e,d=n,_=d.flags;switch(d.tag){case 0:case 11:case 15:Is(u,d,s),ro(4,d);break;case 1:if(Is(u,d,s),o=d,u=o.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(K){xt(o,o.return,K)}if(o=d,u=o.updateQueue,u!==null){var w=o.stateNode;try{var O=u.shared.hiddenCallbacks;if(O!==null)for(u.shared.hiddenCallbacks=null,u=0;u<O.length;u++)Zm(O[u],w)}catch(K){xt(o,o.return,K)}}s&&_&64&&a_(d),oo(d,d.return);break;case 27:r_(d);case 26:case 5:Is(u,d,s),s&&o===null&&_&4&&l_(d),oo(d,d.return);break;case 12:Is(u,d,s);break;case 31:Is(u,d,s),s&&_&4&&f_(u,d);break;case 13:Is(u,d,s),s&&_&4&&p_(u,d);break;case 22:d.memoizedState===null&&Is(u,d,s),oo(d,d.return);break;case 30:break;default:Is(u,d,s)}n=n.sibling}}function Ff(e,n){var s=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(s=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==s&&(e!=null&&e.refCount++,s!=null&&Yr(s))}function Yf(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&Yr(e))}function Va(e,n,s,o){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)g_(e,n,s,o),n=n.sibling}function g_(e,n,s,o){var u=n.flags;switch(n.tag){case 0:case 11:case 15:Va(e,n,s,o),u&2048&&ro(9,n);break;case 1:Va(e,n,s,o);break;case 3:Va(e,n,s,o),u&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&Yr(e)));break;case 12:if(u&2048){Va(e,n,s,o),e=n.stateNode;try{var d=n.memoizedProps,_=d.id,w=d.onPostCommit;typeof w=="function"&&w(_,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(O){xt(n,n.return,O)}}else Va(e,n,s,o);break;case 31:Va(e,n,s,o);break;case 13:Va(e,n,s,o);break;case 23:break;case 22:d=n.stateNode,_=n.alternate,n.memoizedState!==null?d._visibility&2?Va(e,n,s,o):co(e,n):d._visibility&2?Va(e,n,s,o):(d._visibility|=2,er(e,n,s,o,(n.subtreeFlags&10256)!==0||!1)),u&2048&&Ff(_,n);break;case 24:Va(e,n,s,o),u&2048&&Yf(n.alternate,n);break;default:Va(e,n,s,o)}}function er(e,n,s,o,u){for(u=u&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var d=e,_=n,w=s,O=o,K=_.flags;switch(_.tag){case 0:case 11:case 15:er(d,_,w,O,u),ro(8,_);break;case 23:break;case 22:var J=_.stateNode;_.memoizedState!==null?J._visibility&2?er(d,_,w,O,u):co(d,_):(J._visibility|=2,er(d,_,w,O,u)),u&&K&2048&&Ff(_.alternate,_);break;case 24:er(d,_,w,O,u),u&&K&2048&&Yf(_.alternate,_);break;default:er(d,_,w,O,u)}n=n.sibling}}function co(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var s=e,o=n,u=o.flags;switch(o.tag){case 22:co(s,o),u&2048&&Ff(o.alternate,o);break;case 24:co(s,o),u&2048&&Yf(o.alternate,o);break;default:co(s,o)}n=n.sibling}}var uo=8192;function tr(e,n,s){if(e.subtreeFlags&uo)for(e=e.child;e!==null;)__(e,n,s),e=e.sibling}function __(e,n,s){switch(e.tag){case 26:tr(e,n,s),e.flags&uo&&e.memoizedState!==null&&rj(s,Ha,e.memoizedState,e.memoizedProps);break;case 5:tr(e,n,s);break;case 3:case 4:var o=Ha;Ha=Wc(e.stateNode.containerInfo),tr(e,n,s),Ha=o;break;case 22:e.memoizedState===null&&(o=e.alternate,o!==null&&o.memoizedState!==null?(o=uo,uo=16777216,tr(e,n,s),uo=o):tr(e,n,s));break;default:tr(e,n,s)}}function v_(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 fo(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var s=0;s<n.length;s++){var o=n[s];jn=o,y_(o,e)}v_(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)b_(e),e=e.sibling}function b_(e){switch(e.tag){case 0:case 11:case 15:fo(e),e.flags&2048&&pl(9,e,e.return);break;case 3:fo(e);break;case 12:fo(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,Uc(e)):fo(e);break;default:fo(e)}}function Uc(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var s=0;s<n.length;s++){var o=n[s];jn=o,y_(o,e)}v_(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:pl(8,n,n.return),Uc(n);break;case 22:s=n.stateNode,s._visibility&2&&(s._visibility&=-3,Uc(n));break;default:Uc(n)}e=e.sibling}}function y_(e,n){for(;jn!==null;){var s=jn;switch(s.tag){case 0:case 11:case 15:pl(8,s,n);break;case 23:case 22:if(s.memoizedState!==null&&s.memoizedState.cachePool!==null){var o=s.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:Yr(s.memoizedState.cache)}if(o=s.child,o!==null)o.return=s,jn=o;else e:for(s=e;jn!==null;){o=jn;var u=o.sibling,d=o.return;if(u_(o),o===s){jn=null;break e}if(u!==null){u.return=d,jn=u;break e}jn=d}}}var ww={getCacheForType:function(e){var n=Tn(on),s=n.data.get(e);return s===void 0&&(s=e(),n.data.set(e,s)),s},cacheSignal:function(){return Tn(on).controller.signal}},jw=typeof WeakMap=="function"?WeakMap:Map,_t=0,Rt=null,tt=null,at=0,yt=0,fa=null,hl=!1,nr=!1,Xf=!1,Ds=0,Ft=0,ml=0,ti=0,Pf=0,pa=0,ar=0,po=null,Jn=null,Qf=!1,Bc=0,x_=0,Gc=1/0,Hc=null,gl=null,gn=0,_l=null,sr=null,zs=0,Jf=0,Wf=null,w_=null,ho=0,ep=null;function ha(){return(_t&2)!==0&&at!==0?at&-at:$.T!==null?ip():I()}function j_(){if(pa===0)if((at&536870912)===0||ot){var e=ht;ht<<=1,(ht&3932160)===0&&(ht=262144),pa=e}else pa=536870912;return e=ua.current,e!==null&&(e.flags|=32),pa}function Wn(e,n,s){(e===Rt&&(yt===2||yt===9)||e.cancelPendingCommit!==null)&&(lr(e,0),vl(e,at,pa,!1)),sa(e,s),((_t&2)===0||e!==Rt)&&(e===Rt&&((_t&2)===0&&(ti|=s),Ft===4&&vl(e,at,pa,!1)),ls(e))}function S_(e,n,s){if((_t&6)!==0)throw Error(r(327));var o=!s&&(n&127)===0&&(n&e.expiredLanes)===0||Dt(e,n),u=o?kw(e,n):np(e,n,!0),d=o;do{if(u===0){nr&&!o&&vl(e,n,0,!1);break}else{if(s=e.current.alternate,d&&!Sw(s)){u=np(e,n,!1),d=!1;continue}if(u===2){if(d=n,e.errorRecoveryDisabledLanes&d)var _=0;else _=e.pendingLanes&-536870913,_=_!==0?_:_&536870912?536870912:0;if(_!==0){n=_;e:{var w=e;u=po;var O=w.current.memoizedState.isDehydrated;if(O&&(lr(w,_).flags|=256),_=np(w,_,!1),_!==2){if(Xf&&!O){w.errorRecoveryDisabledLanes|=d,ti|=d,u=4;break e}d=Jn,Jn=u,d!==null&&(Jn===null?Jn=d:Jn.push.apply(Jn,d))}u=_}if(d=!1,u!==2)continue}}if(u===1){lr(e,0),vl(e,n,0,!0);break}e:{switch(o=e,d=u,d){case 0:case 1:throw Error(r(345));case 4:if((n&4194048)!==n)break;case 6:vl(o,n,pa,!hl);break e;case 2:Jn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((n&62914560)===n&&(u=Bc+300-lt(),10<u)){if(vl(o,n,pa,!hl),Ln(o,0,!0)!==0)break e;zs=n,o.timeoutHandle=tv(N_.bind(null,o,s,Jn,Hc,Qf,n,pa,ti,ar,hl,d,"Throttled",-0,0),u);break e}N_(o,s,Jn,Hc,Qf,n,pa,ti,ar,hl,d,null,-0,0)}}break}while(!0);ls(e)}function N_(e,n,s,o,u,d,_,w,O,K,J,re,Y,X){if(e.timeoutHandle=-1,re=n.subtreeFlags,re&8192||(re&16785408)===16785408){re={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ya},__(n,d,re);var Te=(d&62914560)===d?Bc-lt():(d&4194048)===d?x_-lt():0;if(Te=oj(re,Te),Te!==null){zs=d,e.cancelPendingCommit=Te($_.bind(null,e,n,d,s,o,u,_,w,O,J,re,null,Y,X)),vl(e,d,_,!K);return}}$_(e,n,d,s,o,u,_,w,O)}function Sw(e){for(var n=e;;){var s=n.tag;if((s===0||s===11||s===15)&&n.flags&16384&&(s=n.updateQueue,s!==null&&(s=s.stores,s!==null)))for(var o=0;o<s.length;o++){var u=s[o],d=u.getSnapshot;u=u.value;try{if(!oa(d(),u))return!1}catch{return!1}}if(s=n.child,n.subtreeFlags&16384&&s!==null)s.return=n,n=s;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 vl(e,n,s,o){n&=~Pf,n&=~ti,e.suspendedLanes|=n,e.pingedLanes&=~n,o&&(e.warmLanes|=n),o=e.expirationTimes;for(var u=n;0<u;){var d=31-Tt(u),_=1<<d;o[d]=-1,u&=~_}s!==0&&Ia(e,s,n)}function Vc(){return(_t&6)===0?(mo(0),!1):!0}function tp(){if(tt!==null){if(yt===0)var e=tt.return;else e=tt,As=Zl=null,_f(e),Xi=null,Pr=0,e=tt;for(;e!==null;)n_(e.alternate,e),e=e.return;tt=null}}function lr(e,n){var s=e.timeoutHandle;s!==-1&&(e.timeoutHandle=-1,Vw(s)),s=e.cancelPendingCommit,s!==null&&(e.cancelPendingCommit=null,s()),zs=0,tp(),Rt=e,tt=s=Ns(e.current,null),at=n,yt=0,fa=null,hl=!1,nr=Dt(e,n),Xf=!1,ar=pa=Pf=ti=ml=Ft=0,Jn=po=null,Qf=!1,(n&8)!==0&&(n|=n&32);var o=e.entangledLanes;if(o!==0)for(e=e.entanglements,o&=n;0<o;){var u=31-Tt(o),d=1<<u;n|=e[u],o&=~d}return Ds=n,dc(),s}function k_(e,n){Ze=null,$.H=so,n===Yi||n===bc?(n=Gm(),yt=3):n===sf?(n=Gm(),yt=4):yt=n===$f?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,fa=n,tt===null&&(Ft=1,$c(e,ja(n,e.current)))}function A_(){var e=ua.current;return e===null?!0:(at&4194048)===at?Aa===null:(at&62914560)===at||(at&536870912)!==0?e===Aa:!1}function R_(){var e=$.H;return $.H=so,e===null?so:e}function E_(){var e=$.A;return $.A=ww,e}function Kc(){Ft=4,hl||(at&4194048)!==at&&ua.current!==null||(nr=!0),(ml&134217727)===0&&(ti&134217727)===0||Rt===null||vl(Rt,at,pa,!1)}function np(e,n,s){var o=_t;_t|=2;var u=R_(),d=E_();(Rt!==e||at!==n)&&(Hc=null,lr(e,n)),n=!1;var _=Ft;e:do try{if(yt!==0&&tt!==null){var w=tt,O=fa;switch(yt){case 8:tp(),_=6;break e;case 3:case 2:case 9:case 6:ua.current===null&&(n=!0);var K=yt;if(yt=0,fa=null,ir(e,w,O,K),s&&nr){_=0;break e}break;default:K=yt,yt=0,fa=null,ir(e,w,O,K)}}Nw(),_=Ft;break}catch(J){k_(e,J)}while(!0);return n&&e.shellSuspendCounter++,As=Zl=null,_t=o,$.H=u,$.A=d,tt===null&&(Rt=null,at=0,dc()),_}function Nw(){for(;tt!==null;)T_(tt)}function kw(e,n){var s=_t;_t|=2;var o=R_(),u=E_();Rt!==e||at!==n?(Hc=null,Gc=lt()+500,lr(e,n)):nr=Dt(e,n);e:do try{if(yt!==0&&tt!==null){n=tt;var d=fa;t:switch(yt){case 1:yt=0,fa=null,ir(e,n,d,1);break;case 2:case 9:if(Um(d)){yt=0,fa=null,C_(n);break}n=function(){yt!==2&&yt!==9||Rt!==e||(yt=7),ls(e)},d.then(n,n);break e;case 3:yt=7;break e;case 4:yt=5;break e;case 7:Um(d)?(yt=0,fa=null,C_(n)):(yt=0,fa=null,ir(e,n,d,7));break;case 5:var _=null;switch(tt.tag){case 26:_=tt.memoizedState;case 5:case 27:var w=tt;if(_?gv(_):w.stateNode.complete){yt=0,fa=null;var O=w.sibling;if(O!==null)tt=O;else{var K=w.return;K!==null?(tt=K,Zc(K)):tt=null}break t}}yt=0,fa=null,ir(e,n,d,5);break;case 6:yt=0,fa=null,ir(e,n,d,6);break;case 8:tp(),Ft=6;break e;default:throw Error(r(462))}}Aw();break}catch(J){k_(e,J)}while(!0);return As=Zl=null,$.H=o,$.A=u,_t=s,tt!==null?0:(Rt=null,at=0,dc(),Ft)}function Aw(){for(;tt!==null&&!ln();)T_(tt)}function T_(e){var n=e_(e.alternate,e,Ds);e.memoizedProps=e.pendingProps,n===null?Zc(e):tt=n}function C_(e){var n=e,s=n.alternate;switch(n.tag){case 15:case 0:n=Yg(s,n,n.pendingProps,n.type,void 0,at);break;case 11:n=Yg(s,n,n.pendingProps,n.type.render,n.ref,at);break;case 5:_f(n);default:n_(s,n),n=tt=Em(n,Ds),n=e_(s,n,Ds)}e.memoizedProps=e.pendingProps,n===null?Zc(e):tt=n}function ir(e,n,s,o){As=Zl=null,_f(n),Xi=null,Pr=0;var u=n.return;try{if(mw(e,u,n,s,at)){Ft=1,$c(e,ja(s,e.current)),tt=null;return}}catch(d){if(u!==null)throw tt=u,d;Ft=1,$c(e,ja(s,e.current)),tt=null;return}n.flags&32768?(ot||o===1?e=!0:nr||(at&536870912)!==0?e=!1:(hl=e=!0,(o===2||o===9||o===3||o===6)&&(o=ua.current,o!==null&&o.tag===13&&(o.flags|=16384))),O_(n,e)):Zc(n)}function Zc(e){var n=e;do{if((n.flags&32768)!==0){O_(n,hl);return}e=n.return;var s=vw(n.alternate,n,Ds);if(s!==null){tt=s;return}if(n=n.sibling,n!==null){tt=n;return}tt=n=e}while(n!==null);Ft===0&&(Ft=5)}function O_(e,n){do{var s=bw(e.alternate,e);if(s!==null){s.flags&=32767,tt=s;return}if(s=e.return,s!==null&&(s.flags|=32768,s.subtreeFlags=0,s.deletions=null),!n&&(e=e.sibling,e!==null)){tt=e;return}tt=e=s}while(e!==null);Ft=6,tt=null}function $_(e,n,s,o,u,d,_,w,O){e.cancelPendingCommit=null;do Fc();while(gn!==0);if((_t&6)!==0)throw Error(r(327));if(n!==null){if(n===e.current)throw Error(r(177));if(d=n.lanes|n.childLanes,d|=Hd,Fn(e,s,d,_,w,O),e===Rt&&(tt=Rt=null,at=0),sr=n,_l=e,zs=s,Jf=d,Wf=u,w_=o,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Cw(Le,function(){return z_(),null})):(e.callbackNode=null,e.callbackPriority=0),o=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||o){o=$.T,$.T=null,u=ee.p,ee.p=2,_=_t,_t|=4;try{yw(e,n,s)}finally{_t=_,ee.p=u,$.T=o}}gn=1,M_(),L_(),I_()}}function M_(){if(gn===1){gn=0;var e=_l,n=sr,s=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||s){s=$.T,$.T=null;var o=ee.p;ee.p=2;var u=_t;_t|=4;try{h_(n,e);var d=hp,_=ym(e.containerInfo),w=d.focusedElem,O=d.selectionRange;if(_!==w&&w&&w.ownerDocument&&bm(w.ownerDocument.documentElement,w)){if(O!==null&&zd(w)){var K=O.start,J=O.end;if(J===void 0&&(J=K),"selectionStart"in w)w.selectionStart=K,w.selectionEnd=Math.min(J,w.value.length);else{var re=w.ownerDocument||document,Y=re&&re.defaultView||window;if(Y.getSelection){var X=Y.getSelection(),Te=w.textContent.length,ze=Math.min(O.start,Te),Nt=O.end===void 0?ze:Math.min(O.end,Te);!X.extend&&ze>Nt&&(_=Nt,Nt=ze,ze=_);var G=vm(w,ze),D=vm(w,Nt);if(G&&D&&(X.rangeCount!==1||X.anchorNode!==G.node||X.anchorOffset!==G.offset||X.focusNode!==D.node||X.focusOffset!==D.offset)){var V=re.createRange();V.setStart(G.node,G.offset),X.removeAllRanges(),ze>Nt?(X.addRange(V),X.extend(D.node,D.offset)):(V.setEnd(D.node,D.offset),X.addRange(V))}}}}for(re=[],X=w;X=X.parentNode;)X.nodeType===1&&re.push({element:X,left:X.scrollLeft,top:X.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<re.length;w++){var ne=re[w];ne.element.scrollLeft=ne.left,ne.element.scrollTop=ne.top}}lu=!!pp,hp=pp=null}finally{_t=u,ee.p=o,$.T=s}}e.current=n,gn=2}}function L_(){if(gn===2){gn=0;var e=_l,n=sr,s=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||s){s=$.T,$.T=null;var o=ee.p;ee.p=2;var u=_t;_t|=4;try{c_(e,n.alternate,n)}finally{_t=u,ee.p=o,$.T=s}}gn=3}}function I_(){if(gn===4||gn===3){gn=0,Jt();var e=_l,n=sr,s=zs,o=w_;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?gn=5:(gn=0,sr=_l=null,D_(e,e.pendingLanes));var u=e.pendingLanes;if(u===0&&(gl=null),la(s),n=n.stateNode,dt&&typeof dt.onCommitFiberRoot=="function")try{dt.onCommitFiberRoot(Qe,n,void 0,(n.current.flags&128)===128)}catch{}if(o!==null){n=$.T,u=ee.p,ee.p=2,$.T=null;try{for(var d=e.onRecoverableError,_=0;_<o.length;_++){var w=o[_];d(w.value,{componentStack:w.stack})}}finally{$.T=n,ee.p=u}}(zs&3)!==0&&Fc(),ls(e),u=e.pendingLanes,(s&261930)!==0&&(u&42)!==0?e===ep?ho++:(ho=0,ep=e):ho=0,mo(0)}}function D_(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,Yr(n)))}function Fc(){return M_(),L_(),I_(),z_()}function z_(){if(gn!==5)return!1;var e=_l,n=Jf;Jf=0;var s=la(zs),o=$.T,u=ee.p;try{ee.p=32>s?32:s,$.T=null,s=Wf,Wf=null;var d=_l,_=zs;if(gn=0,sr=_l=null,zs=0,(_t&6)!==0)throw Error(r(331));var w=_t;if(_t|=4,b_(d.current),g_(d,d.current,_,s),_t=w,mo(0,!1),dt&&typeof dt.onPostCommitFiberRoot=="function")try{dt.onPostCommitFiberRoot(Qe,d)}catch{}return!0}finally{ee.p=u,$.T=o,D_(e,n)}}function q_(e,n,s){n=ja(s,n),n=Of(e.stateNode,n,2),e=ul(e,n,2),e!==null&&(sa(e,2),ls(e))}function xt(e,n,s){if(e.tag===3)q_(e,e,s);else for(;n!==null;){if(n.tag===3){q_(n,e,s);break}else if(n.tag===1){var o=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(gl===null||!gl.has(o))){e=ja(s,e),s=Ug(2),o=ul(n,s,2),o!==null&&(Bg(s,o,n,e),sa(o,2),ls(o));break}}n=n.return}}function ap(e,n,s){var o=e.pingCache;if(o===null){o=e.pingCache=new jw;var u=new Set;o.set(n,u)}else u=o.get(n),u===void 0&&(u=new Set,o.set(n,u));u.has(s)||(Xf=!0,u.add(s),e=Rw.bind(null,e,n,s),n.then(e,e))}function Rw(e,n,s){var o=e.pingCache;o!==null&&o.delete(n),e.pingedLanes|=e.suspendedLanes&s,e.warmLanes&=~s,Rt===e&&(at&s)===s&&(Ft===4||Ft===3&&(at&62914560)===at&&300>lt()-Bc?(_t&2)===0&&lr(e,0):Pf|=s,ar===at&&(ar=0)),ls(e)}function U_(e,n){n===0&&(n=zt()),e=Hl(e,n),e!==null&&(sa(e,n),ls(e))}function Ew(e){var n=e.memoizedState,s=0;n!==null&&(s=n.retryLane),U_(e,s)}function Tw(e,n){var s=0;switch(e.tag){case 31:case 13:var o=e.stateNode,u=e.memoizedState;u!==null&&(s=u.retryLane);break;case 19:o=e.stateNode;break;case 22:o=e.stateNode._retryCache;break;default:throw Error(r(314))}o!==null&&o.delete(n),U_(e,s)}function Cw(e,n){return sn(e,n)}var Yc=null,rr=null,sp=!1,Xc=!1,lp=!1,bl=0;function ls(e){e!==rr&&e.next===null&&(rr===null?Yc=rr=e:rr=rr.next=e),Xc=!0,sp||(sp=!0,$w())}function mo(e,n){if(!lp&&Xc){lp=!0;do for(var s=!1,o=Yc;o!==null;){if(e!==0){var u=o.pendingLanes;if(u===0)var d=0;else{var _=o.suspendedLanes,w=o.pingedLanes;d=(1<<31-Tt(42|e)+1)-1,d&=u&~(_&~w),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(s=!0,V_(o,d))}else d=at,d=Ln(o,o===Rt?d:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(d&3)===0||Dt(o,d)||(s=!0,V_(o,d));o=o.next}while(s);lp=!1}}function Ow(){B_()}function B_(){Xc=sp=!1;var e=0;bl!==0&&Hw()&&(e=bl);for(var n=lt(),s=null,o=Yc;o!==null;){var u=o.next,d=G_(o,n);d===0?(o.next=null,s===null?Yc=u:s.next=u,u===null&&(rr=s)):(s=o,(e!==0||(d&3)!==0)&&(Xc=!0)),o=u}gn!==0&&gn!==5||mo(e),bl!==0&&(bl=0)}function G_(e,n){for(var s=e.suspendedLanes,o=e.pingedLanes,u=e.expirationTimes,d=e.pendingLanes&-62914561;0<d;){var _=31-Tt(d),w=1<<_,O=u[_];O===-1?((w&s)===0||(w&o)!==0)&&(u[_]=rt(w,n)):O<=n&&(e.expiredLanes|=w),d&=~w}if(n=Rt,s=at,s=Ln(e,e===n?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o=e.callbackNode,s===0||e===n&&(yt===2||yt===9)||e.cancelPendingCommit!==null)return o!==null&&o!==null&&Mn(o),e.callbackNode=null,e.callbackPriority=0;if((s&3)===0||Dt(e,s)){if(n=s&-s,n===e.callbackPriority)return n;switch(o!==null&&Mn(o),la(s)){case 2:case 8:s=Ae;break;case 32:s=Le;break;case 268435456:s=it;break;default:s=Le}return o=H_.bind(null,e),s=sn(s,o),e.callbackPriority=n,e.callbackNode=s,n}return o!==null&&o!==null&&Mn(o),e.callbackPriority=2,e.callbackNode=null,2}function H_(e,n){if(gn!==0&&gn!==5)return e.callbackNode=null,e.callbackPriority=0,null;var s=e.callbackNode;if(Fc()&&e.callbackNode!==s)return null;var o=at;return o=Ln(e,e===Rt?o:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o===0?null:(S_(e,o,n),G_(e,lt()),e.callbackNode!=null&&e.callbackNode===s?H_.bind(null,e):null)}function V_(e,n){if(Fc())return null;S_(e,n,!0)}function $w(){Kw(function(){(_t&6)!==0?sn(le,Ow):B_()})}function ip(){if(bl===0){var e=Zi;e===0&&(e=Wt,Wt<<=1,(Wt&261888)===0&&(Wt=256)),bl=e}return bl}function K_(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Ni(""+e)}function Z_(e,n){var s=n.ownerDocument.createElement("input");return s.name=n.name,s.value=n.value,e.id&&s.setAttribute("form",e.id),n.parentNode.insertBefore(s,n),e=new FormData(e),s.parentNode.removeChild(s),e}function Mw(e,n,s,o,u){if(n==="submit"&&s&&s.stateNode===u){var d=K_((u[Oe]||null).action),_=o.submitter;_&&(n=(n=_[Oe]||null)?K_(n.formAction):_.getAttribute("formAction"),n!==null&&(d=n,_=null));var w=new zl("action","action",null,o,u);e.push({event:w,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(bl!==0){var O=_?Z_(u,_):new FormData(u);kf(s,{pending:!0,data:O,method:u.method,action:d},null,O)}}else typeof d=="function"&&(w.preventDefault(),O=_?Z_(u,_):new FormData(u),kf(s,{pending:!0,data:O,method:u.method,action:d},d,O))},currentTarget:u}]})}}for(var rp=0;rp<Gd.length;rp++){var op=Gd[rp],Lw=op.toLowerCase(),Iw=op[0].toUpperCase()+op.slice(1);Ga(Lw,"on"+Iw)}Ga(jm,"onAnimationEnd"),Ga(Sm,"onAnimationIteration"),Ga(Nm,"onAnimationStart"),Ga("dblclick","onDoubleClick"),Ga("focusin","onFocus"),Ga("focusout","onBlur"),Ga(J0,"onTransitionRun"),Ga(W0,"onTransitionStart"),Ga(ew,"onTransitionCancel"),Ga(km,"onTransitionEnd"),yn("onMouseEnter",["mouseout","mouseover"]),yn("onMouseLeave",["mouseout","mouseover"]),yn("onPointerEnter",["pointerout","pointerover"]),yn("onPointerLeave",["pointerout","pointerover"]),ia("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ia("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ia("onBeforeInput",["compositionend","keypress","textInput","paste"]),ia("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ia("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ia("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var go="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(" "),Dw=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(go));function F_(e,n){n=(n&4)!==0;for(var s=0;s<e.length;s++){var o=e[s],u=o.event;o=o.listeners;e:{var d=void 0;if(n)for(var _=o.length-1;0<=_;_--){var w=o[_],O=w.instance,K=w.currentTarget;if(w=w.listener,O!==d&&u.isPropagationStopped())break e;d=w,u.currentTarget=K;try{d(u)}catch(J){uc(J)}u.currentTarget=null,d=O}else for(_=0;_<o.length;_++){if(w=o[_],O=w.instance,K=w.currentTarget,w=w.listener,O!==d&&u.isPropagationStopped())break e;d=w,u.currentTarget=K;try{d(u)}catch(J){uc(J)}u.currentTarget=null,d=O}}}}function nt(e,n){var s=n[Je];s===void 0&&(s=n[Je]=new Set);var o=e+"__bubble";s.has(o)||(Y_(n,e,2,!1),s.add(o))}function cp(e,n,s){var o=0;n&&(o|=4),Y_(s,e,o,n)}var Pc="_reactListening"+Math.random().toString(36).slice(2);function up(e){if(!e[Pc]){e[Pc]=!0,gs.forEach(function(s){s!=="selectionchange"&&(Dw.has(s)||cp(s,!1,e),cp(s,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[Pc]||(n[Pc]=!0,cp("selectionchange",!1,n))}}function Y_(e,n,s,o){switch(jv(n)){case 2:var u=dj;break;case 8:u=fj;break;default:u=Np}s=u.bind(null,n,s,e),u=void 0,!Ei||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(u=!0),o?u!==void 0?e.addEventListener(n,s,{capture:!0,passive:u}):e.addEventListener(n,s,!0):u!==void 0?e.addEventListener(n,s,{passive:u}):e.addEventListener(n,s,!1)}function dp(e,n,s,o,u){var d=o;if((n&1)===0&&(n&2)===0&&o!==null)e:for(;;){if(o===null)return;var _=o.tag;if(_===3||_===4){var w=o.stateNode.containerInfo;if(w===u)break;if(_===4)for(_=o.return;_!==null;){var O=_.tag;if((O===3||O===4)&&_.stateNode.containerInfo===u)return;_=_.return}for(;w!==null;){if(_=mn(w),_===null)return;if(O=_.tag,O===5||O===6||O===26||O===27){o=d=_;continue e}w=w.parentNode}}o=o.return}Ri(function(){var K=d,J=Ai(s),re=[];e:{var Y=Am.get(e);if(Y!==void 0){var X=zl,Te=e;switch(e){case"keypress":if(Ci(s)===0)break e;case"keydown":case"keyup":X=rc;break;case"focusin":Te="focus",X=ts;break;case"focusout":Te="blur",X=ts;break;case"beforeblur":case"afterblur":X=ts;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":X=ql;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":X=Cd;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":X=Md;break;case jm:case Sm:case Nm:X=sc;break;case km:X=g;break;case"scroll":case"scrollend":X=nc;break;case"wheel":X=H;break;case"copy":case"cut":case"paste":X=lc;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":X=Ur;break;case"toggle":case"beforetoggle":X=fe}var ze=(n&4)!==0,Nt=!ze&&(e==="scroll"||e==="scrollend"),G=ze?Y!==null?Y+"Capture":null:Y;ze=[];for(var D=K,V;D!==null;){var ne=D;if(V=ne.stateNode,ne=ne.tag,ne!==5&&ne!==26&&ne!==27||V===null||G===null||(ne=al(D,G),ne!=null&&ze.push(_o(D,ne,V))),Nt)break;D=D.return}0<ze.length&&(Y=new X(Y,Te,null,s,J),re.push({event:Y,listeners:ze}))}}if((n&7)===0){e:{if(Y=e==="mouseover"||e==="pointerover",X=e==="mouseout"||e==="pointerout",Y&&s!==ki&&(Te=s.relatedTarget||s.fromElement)&&(mn(Te)||Te[Fe]))break e;if((X||Y)&&(Y=J.window===J?J:(Y=J.ownerDocument)?Y.defaultView||Y.parentWindow:window,X?(Te=s.relatedTarget||s.toElement,X=K,Te=Te?mn(Te):null,Te!==null&&(Nt=f(Te),ze=Te.tag,Te!==Nt||ze!==5&&ze!==27&&ze!==6)&&(Te=null)):(X=null,Te=K),X!==Te)){if(ze=ql,ne="onMouseLeave",G="onMouseEnter",D="mouse",(e==="pointerout"||e==="pointerover")&&(ze=Ur,ne="onPointerLeave",G="onPointerEnter",D="pointer"),Nt=X==null?Y:rn(X),V=Te==null?Y:rn(Te),Y=new ze(ne,D+"leave",X,s,J),Y.target=Nt,Y.relatedTarget=V,ne=null,mn(J)===K&&(ze=new ze(G,D+"enter",Te,s,J),ze.target=V,ze.relatedTarget=Nt,ne=ze),Nt=ne,X&&Te)t:{for(ze=zw,G=X,D=Te,V=0,ne=G;ne;ne=ze(ne))V++;ne=0;for(var De=D;De;De=ze(De))ne++;for(;0<V-ne;)G=ze(G),V--;for(;0<ne-V;)D=ze(D),ne--;for(;V--;){if(G===D||D!==null&&G===D.alternate){ze=G;break t}G=ze(G),D=ze(D)}ze=null}else ze=null;X!==null&&X_(re,Y,X,ze,!1),Te!==null&&Nt!==null&&X_(re,Nt,Te,ze,!0)}}e:{if(Y=K?rn(K):window,X=Y.nodeName&&Y.nodeName.toLowerCase(),X==="select"||X==="input"&&Y.type==="file")var mt=fm;else if(um(Y))if(pm)mt=X0;else{mt=F0;var Me=Z0}else X=Y.nodeName,!X||X.toLowerCase()!=="input"||Y.type!=="checkbox"&&Y.type!=="radio"?K&&Lr(K.elementType)&&(mt=fm):mt=Y0;if(mt&&(mt=mt(e,K))){dm(re,mt,s,J);break e}Me&&Me(e,Y,K),e==="focusout"&&K&&Y.type==="number"&&K.memoizedProps.value!=null&&el(Y,"number",Y.value)}switch(Me=K?rn(K):window,e){case"focusin":(um(Me)||Me.contentEditable==="true")&&(zi=Me,qd=K,Kr=null);break;case"focusout":Kr=qd=zi=null;break;case"mousedown":Ud=!0;break;case"contextmenu":case"mouseup":case"dragend":Ud=!1,xm(re,s,J);break;case"selectionchange":if(Q0)break;case"keydown":case"keyup":xm(re,s,J)}var Xe;if($e)e:{switch(e){case"compositionstart":var st="onCompositionStart";break e;case"compositionend":st="onCompositionEnd";break e;case"compositionupdate":st="onCompositionUpdate";break e}st=void 0}else Di?om(e,s)&&(st="onCompositionEnd"):e==="keydown"&&s.keyCode===229&&(st="onCompositionStart");st&&(Ss&&s.locale!=="ko"&&(Di||st!=="onCompositionStart"?st==="onCompositionEnd"&&Di&&(Xe=Ti()):(qa=J,Ir="value"in qa?qa.value:qa.textContent,Di=!0)),Me=Qc(K,st),0<Me.length&&(st=new ic(st,e,null,s,J),re.push({event:st,listeners:Me}),Xe?st.data=Xe:(Xe=cm(s),Xe!==null&&(st.data=Xe)))),(Xe=et?G0(e,s):H0(e,s))&&(st=Qc(K,"onBeforeInput"),0<st.length&&(Me=new ic("onBeforeInput","beforeinput",null,s,J),re.push({event:Me,listeners:st}),Me.data=Xe)),Mw(re,e,K,s,J)}F_(re,n)})}function _o(e,n,s){return{instance:e,listener:n,currentTarget:s}}function Qc(e,n){for(var s=n+"Capture",o=[];e!==null;){var u=e,d=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||d===null||(u=al(e,s),u!=null&&o.unshift(_o(e,u,d)),u=al(e,n),u!=null&&o.push(_o(e,u,d))),e.tag===3)return o;e=e.return}return[]}function zw(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function X_(e,n,s,o,u){for(var d=n._reactName,_=[];s!==null&&s!==o;){var w=s,O=w.alternate,K=w.stateNode;if(w=w.tag,O!==null&&O===o)break;w!==5&&w!==26&&w!==27||K===null||(O=K,u?(K=al(s,d),K!=null&&_.unshift(_o(s,K,O))):u||(K=al(s,d),K!=null&&_.push(_o(s,K,O)))),s=s.return}_.length!==0&&e.push({event:n,listeners:_})}var qw=/\r\n?/g,Uw=/\u0000|\uFFFD/g;function P_(e){return(typeof e=="string"?e:""+e).replace(qw,`
|
|
9
|
-
`).replace(Uw,"")}function Q_(e,n){return n=P_(n),P_(e)===n}function St(e,n,s,o,u,d){switch(s){case"children":typeof o=="string"?n==="body"||n==="textarea"&&o===""||tl(e,o):(typeof o=="number"||typeof o=="bigint")&&n!=="body"&&tl(e,""+o);break;case"className":Ja(e,"class",o);break;case"tabIndex":Ja(e,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":Ja(e,s,o);break;case"style":Wo(e,o,d);break;case"data":if(n!=="object"){Ja(e,"data",o);break}case"src":case"href":if(o===""&&(n!=="a"||s!=="href")){e.removeAttribute(s);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(s);break}o=Ni(""+o),e.setAttribute(s,o);break;case"action":case"formAction":if(typeof o=="function"){e.setAttribute(s,"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 d=="function"&&(s==="formAction"?(n!=="input"&&St(e,n,"name",u.name,u,null),St(e,n,"formEncType",u.formEncType,u,null),St(e,n,"formMethod",u.formMethod,u,null),St(e,n,"formTarget",u.formTarget,u,null)):(St(e,n,"encType",u.encType,u,null),St(e,n,"method",u.method,u,null),St(e,n,"target",u.target,u,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(s);break}o=Ni(""+o),e.setAttribute(s,o);break;case"onClick":o!=null&&(e.onclick=ya);break;case"onScroll":o!=null&&nt("scroll",e);break;case"onScrollEnd":o!=null&&nt("scrollend",e);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(r(61));if(s=o.__html,s!=null){if(u.children!=null)throw Error(r(60));e.innerHTML=s}}break;case"multiple":e.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":e.muted=o&&typeof o!="function"&&typeof o!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o=="function"||typeof o=="boolean"||typeof o=="symbol"){e.removeAttribute("xlink:href");break}s=Ni(""+o),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(s,""+o):e.removeAttribute(s);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":o&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(s,""):e.removeAttribute(s);break;case"capture":case"download":o===!0?e.setAttribute(s,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(s,o):e.removeAttribute(s);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?e.setAttribute(s,o):e.removeAttribute(s);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?e.removeAttribute(s):e.setAttribute(s,o);break;case"popover":nt("beforetoggle",e),nt("toggle",e),vs(e,"popover",o);break;case"xlinkActuate":ie(e,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":ie(e,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":ie(e,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":ie(e,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":ie(e,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":ie(e,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":ie(e,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":ie(e,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":ie(e,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":vs(e,"is",o);break;case"innerText":case"textContent":break;default:(!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(s=Rd.get(s)||s,vs(e,s,o))}}function fp(e,n,s,o,u,d){switch(s){case"style":Wo(e,o,d);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(r(61));if(s=o.__html,s!=null){if(u.children!=null)throw Error(r(60));e.innerHTML=s}}break;case"children":typeof o=="string"?tl(e,o):(typeof o=="number"||typeof o=="bigint")&&tl(e,""+o);break;case"onScroll":o!=null&&nt("scroll",e);break;case"onScrollEnd":o!=null&&nt("scrollend",e);break;case"onClick":o!=null&&(e.onclick=ya);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Qa.hasOwnProperty(s))e:{if(s[0]==="o"&&s[1]==="n"&&(u=s.endsWith("Capture"),n=s.slice(2,u?s.length-7:void 0),d=e[Oe]||null,d=d!=null?d[s]:null,typeof d=="function"&&e.removeEventListener(n,d,u),typeof o=="function")){typeof d!="function"&&d!==null&&(s in e?e[s]=null:e.hasAttribute(s)&&e.removeAttribute(s)),e.addEventListener(n,o,u);break e}s in e?e[s]=o:o===!0?e.setAttribute(s,""):vs(e,s,o)}}}function On(e,n,s){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":nt("error",e),nt("load",e);var o=!1,u=!1,d;for(d in s)if(s.hasOwnProperty(d)){var _=s[d];if(_!=null)switch(d){case"src":o=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:St(e,n,d,_,s,null)}}u&&St(e,n,"srcSet",s.srcSet,s,null),o&&St(e,n,"src",s.src,s,null);return;case"input":nt("invalid",e);var w=d=_=u=null,O=null,K=null;for(o in s)if(s.hasOwnProperty(o)){var J=s[o];if(J!=null)switch(o){case"name":u=J;break;case"type":_=J;break;case"checked":O=J;break;case"defaultChecked":K=J;break;case"value":d=J;break;case"defaultValue":w=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(r(137,n));break;default:St(e,n,o,J,s,null)}}Qo(e,d,w,O,K,_,u,!1);return;case"select":nt("invalid",e),o=_=d=null;for(u in s)if(s.hasOwnProperty(u)&&(w=s[u],w!=null))switch(u){case"value":d=w;break;case"defaultValue":_=w;break;case"multiple":o=w;default:St(e,n,u,w,s,null)}n=d,s=_,e.multiple=!!o,n!=null?ys(e,!!o,n,!1):s!=null&&ys(e,!!o,s,!0);return;case"textarea":nt("invalid",e),d=u=o=null;for(_ in s)if(s.hasOwnProperty(_)&&(w=s[_],w!=null))switch(_){case"value":o=w;break;case"defaultValue":u=w;break;case"children":d=w;break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(r(91));break;default:St(e,n,_,w,s,null)}Jo(e,o,u,d);return;case"option":for(O in s)s.hasOwnProperty(O)&&(o=s[O],o!=null)&&(O==="selected"?e.selected=o&&typeof o!="function"&&typeof o!="symbol":St(e,n,O,o,s,null));return;case"dialog":nt("beforetoggle",e),nt("toggle",e),nt("cancel",e),nt("close",e);break;case"iframe":case"object":nt("load",e);break;case"video":case"audio":for(o=0;o<go.length;o++)nt(go[o],e);break;case"image":nt("error",e),nt("load",e);break;case"details":nt("toggle",e);break;case"embed":case"source":case"link":nt("error",e),nt("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(K in s)if(s.hasOwnProperty(K)&&(o=s[K],o!=null))switch(K){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:St(e,n,K,o,s,null)}return;default:if(Lr(n)){for(J in s)s.hasOwnProperty(J)&&(o=s[J],o!==void 0&&fp(e,n,J,o,s,void 0));return}}for(w in s)s.hasOwnProperty(w)&&(o=s[w],o!=null&&St(e,n,w,o,s,null))}function Bw(e,n,s,o){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,d=null,_=null,w=null,O=null,K=null,J=null;for(X in s){var re=s[X];if(s.hasOwnProperty(X)&&re!=null)switch(X){case"checked":break;case"value":break;case"defaultValue":O=re;default:o.hasOwnProperty(X)||St(e,n,X,null,o,re)}}for(var Y in o){var X=o[Y];if(re=s[Y],o.hasOwnProperty(Y)&&(X!=null||re!=null))switch(Y){case"type":d=X;break;case"name":u=X;break;case"checked":K=X;break;case"defaultChecked":J=X;break;case"value":_=X;break;case"defaultValue":w=X;break;case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(r(137,n));break;default:X!==re&&St(e,n,Y,X,o,re)}}ji(e,_,w,O,K,J,d,u);return;case"select":X=_=w=Y=null;for(d in s)if(O=s[d],s.hasOwnProperty(d)&&O!=null)switch(d){case"value":break;case"multiple":X=O;default:o.hasOwnProperty(d)||St(e,n,d,null,o,O)}for(u in o)if(d=o[u],O=s[u],o.hasOwnProperty(u)&&(d!=null||O!=null))switch(u){case"value":Y=d;break;case"defaultValue":w=d;break;case"multiple":_=d;default:d!==O&&St(e,n,u,d,o,O)}n=w,s=_,o=X,Y!=null?ys(e,!!s,Y,!1):!!o!=!!s&&(n!=null?ys(e,!!s,n,!0):ys(e,!!s,s?[]:"",!1));return;case"textarea":X=Y=null;for(w in s)if(u=s[w],s.hasOwnProperty(w)&&u!=null&&!o.hasOwnProperty(w))switch(w){case"value":break;case"children":break;default:St(e,n,w,null,o,u)}for(_ in o)if(u=o[_],d=s[_],o.hasOwnProperty(_)&&(u!=null||d!=null))switch(_){case"value":Y=u;break;case"defaultValue":X=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(r(91));break;default:u!==d&&St(e,n,_,u,o,d)}$r(e,Y,X);return;case"option":for(var Te in s)Y=s[Te],s.hasOwnProperty(Te)&&Y!=null&&!o.hasOwnProperty(Te)&&(Te==="selected"?e.selected=!1:St(e,n,Te,null,o,Y));for(O in o)Y=o[O],X=s[O],o.hasOwnProperty(O)&&Y!==X&&(Y!=null||X!=null)&&(O==="selected"?e.selected=Y&&typeof Y!="function"&&typeof Y!="symbol":St(e,n,O,Y,o,X));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 ze in s)Y=s[ze],s.hasOwnProperty(ze)&&Y!=null&&!o.hasOwnProperty(ze)&&St(e,n,ze,null,o,Y);for(K in o)if(Y=o[K],X=s[K],o.hasOwnProperty(K)&&Y!==X&&(Y!=null||X!=null))switch(K){case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(r(137,n));break;default:St(e,n,K,Y,o,X)}return;default:if(Lr(n)){for(var Nt in s)Y=s[Nt],s.hasOwnProperty(Nt)&&Y!==void 0&&!o.hasOwnProperty(Nt)&&fp(e,n,Nt,void 0,o,Y);for(J in o)Y=o[J],X=s[J],!o.hasOwnProperty(J)||Y===X||Y===void 0&&X===void 0||fp(e,n,J,Y,o,X);return}}for(var G in s)Y=s[G],s.hasOwnProperty(G)&&Y!=null&&!o.hasOwnProperty(G)&&St(e,n,G,null,o,Y);for(re in o)Y=o[re],X=s[re],!o.hasOwnProperty(re)||Y===X||Y==null&&X==null||St(e,n,re,Y,o,X)}function J_(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Gw(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,s=performance.getEntriesByType("resource"),o=0;o<s.length;o++){var u=s[o],d=u.transferSize,_=u.initiatorType,w=u.duration;if(d&&w&&J_(_)){for(_=0,w=u.responseEnd,o+=1;o<s.length;o++){var O=s[o],K=O.startTime;if(K>w)break;var J=O.transferSize,re=O.initiatorType;J&&J_(re)&&(O=O.responseEnd,_+=J*(O<w?1:(w-K)/(O-K)))}if(--o,n+=8*(d+_)/(u.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 pp=null,hp=null;function Jc(e){return e.nodeType===9?e:e.ownerDocument}function W_(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 ev(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 mp(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 gp=null;function Hw(){var e=window.event;return e&&e.type==="popstate"?e===gp?!1:(gp=e,!0):(gp=null,!1)}var tv=typeof setTimeout=="function"?setTimeout:void 0,Vw=typeof clearTimeout=="function"?clearTimeout:void 0,nv=typeof Promise=="function"?Promise:void 0,Kw=typeof queueMicrotask=="function"?queueMicrotask:typeof nv<"u"?function(e){return nv.resolve(null).then(e).catch(Zw)}:tv;function Zw(e){setTimeout(function(){throw e})}function yl(e){return e==="head"}function av(e,n){var s=n,o=0;do{var u=s.nextSibling;if(e.removeChild(s),u&&u.nodeType===8)if(s=u.data,s==="/$"||s==="/&"){if(o===0){e.removeChild(u),dr(n);return}o--}else if(s==="$"||s==="$?"||s==="$~"||s==="$!"||s==="&")o++;else if(s==="html")vo(e.ownerDocument.documentElement);else if(s==="head"){s=e.ownerDocument.head,vo(s);for(var d=s.firstChild;d;){var _=d.nextSibling,w=d.nodeName;d[qt]||w==="SCRIPT"||w==="STYLE"||w==="LINK"&&d.rel.toLowerCase()==="stylesheet"||s.removeChild(d),d=_}}else s==="body"&&vo(e.ownerDocument.body);s=u}while(s);dr(n)}function sv(e,n){var s=e;e=0;do{var o=s.nextSibling;if(s.nodeType===1?n?(s._stashedDisplay=s.style.display,s.style.display="none"):(s.style.display=s._stashedDisplay||"",s.getAttribute("style")===""&&s.removeAttribute("style")):s.nodeType===3&&(n?(s._stashedText=s.nodeValue,s.nodeValue=""):s.nodeValue=s._stashedText||""),o&&o.nodeType===8)if(s=o.data,s==="/$"){if(e===0)break;e--}else s!=="$"&&s!=="$?"&&s!=="$~"&&s!=="$!"||e++;s=o}while(s)}function _p(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var s=n;switch(n=n.nextSibling,s.nodeName){case"HTML":case"HEAD":case"BODY":_p(s),An(s);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(s.rel.toLowerCase()==="stylesheet")continue}e.removeChild(s)}}function Fw(e,n,s,o){for(;e.nodeType===1;){var u=s;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!o&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(o){if(!e[qt])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(d=e.getAttribute("rel"),d==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(d!==u.rel||e.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||e.getAttribute("title")!==(u.title==null?null:u.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(d=e.getAttribute("src"),(d!==(u.src==null?null:u.src)||e.getAttribute("type")!==(u.type==null?null:u.type)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&d&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var d=u.name==null?null:""+u.name;if(u.type==="hidden"&&e.getAttribute("name")===d)return e}else return e;if(e=Ra(e.nextSibling),e===null)break}return null}function Yw(e,n,s){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!s||(e=Ra(e.nextSibling),e===null))return null;return e}function lv(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Ra(e.nextSibling),e===null))return null;return e}function vp(e){return e.data==="$?"||e.data==="$~"}function bp(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Xw(e,n){var s=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||s.readyState!=="loading")n();else{var o=function(){n(),s.removeEventListener("DOMContentLoaded",o)};s.addEventListener("DOMContentLoaded",o),e._reactRetry=o}}function Ra(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 yp=null;function iv(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var s=e.data;if(s==="/$"||s==="/&"){if(n===0)return Ra(e.nextSibling);n--}else s!=="$"&&s!=="$!"&&s!=="$?"&&s!=="$~"&&s!=="&"||n++}e=e.nextSibling}return null}function rv(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var s=e.data;if(s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"){if(n===0)return e;n--}else s!=="/$"&&s!=="/&"||n++}e=e.previousSibling}return null}function ov(e,n,s){switch(n=Jc(s),e){case"html":if(e=n.documentElement,!e)throw Error(r(452));return e;case"head":if(e=n.head,!e)throw Error(r(453));return e;case"body":if(e=n.body,!e)throw Error(r(454));return e;default:throw Error(r(451))}}function vo(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);An(e)}var Ea=new Map,cv=new Set;function Wc(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var qs=ee.d;ee.d={f:Pw,r:Qw,D:Jw,C:Ww,L:ej,m:tj,X:aj,S:nj,M:sj};function Pw(){var e=qs.f(),n=Vc();return e||n}function Qw(e){var n=Ot(e);n!==null&&n.tag===5&&n.type==="form"?kg(n):qs.r(e)}var or=typeof document>"u"?null:document;function uv(e,n,s){var o=or;if(o&&typeof n=="string"&&n){var u=Hn(n);u='link[rel="'+e+'"][href="'+u+'"]',typeof s=="string"&&(u+='[crossorigin="'+s+'"]'),cv.has(u)||(cv.add(u),e={rel:e,crossOrigin:s,href:n},o.querySelector(u)===null&&(n=o.createElement("link"),On(n,"link",e),ft(n),o.head.appendChild(n)))}}function Jw(e){qs.D(e),uv("dns-prefetch",e,null)}function Ww(e,n){qs.C(e,n),uv("preconnect",e,n)}function ej(e,n,s){qs.L(e,n,s);var o=or;if(o&&e&&n){var u='link[rel="preload"][as="'+Hn(n)+'"]';n==="image"&&s&&s.imageSrcSet?(u+='[imagesrcset="'+Hn(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(u+='[imagesizes="'+Hn(s.imageSizes)+'"]')):u+='[href="'+Hn(e)+'"]';var d=u;switch(n){case"style":d=cr(e);break;case"script":d=ur(e)}Ea.has(d)||(e=y({rel:"preload",href:n==="image"&&s&&s.imageSrcSet?void 0:e,as:n},s),Ea.set(d,e),o.querySelector(u)!==null||n==="style"&&o.querySelector(bo(d))||n==="script"&&o.querySelector(yo(d))||(n=o.createElement("link"),On(n,"link",e),ft(n),o.head.appendChild(n)))}}function tj(e,n){qs.m(e,n);var s=or;if(s&&e){var o=n&&typeof n.as=="string"?n.as:"script",u='link[rel="modulepreload"][as="'+Hn(o)+'"][href="'+Hn(e)+'"]',d=u;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":d=ur(e)}if(!Ea.has(d)&&(e=y({rel:"modulepreload",href:e},n),Ea.set(d,e),s.querySelector(u)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(yo(d)))return}o=s.createElement("link"),On(o,"link",e),ft(o),s.head.appendChild(o)}}}function nj(e,n,s){qs.S(e,n,s);var o=or;if(o&&e){var u=bn(o).hoistableStyles,d=cr(e);n=n||"default";var _=u.get(d);if(!_){var w={loading:0,preload:null};if(_=o.querySelector(bo(d)))w.loading=5;else{e=y({rel:"stylesheet",href:e,"data-precedence":n},s),(s=Ea.get(d))&&xp(e,s);var O=_=o.createElement("link");ft(O),On(O,"link",e),O._p=new Promise(function(K,J){O.onload=K,O.onerror=J}),O.addEventListener("load",function(){w.loading|=1}),O.addEventListener("error",function(){w.loading|=2}),w.loading|=4,eu(_,n,o)}_={type:"stylesheet",instance:_,count:1,state:w},u.set(d,_)}}}function aj(e,n){qs.X(e,n);var s=or;if(s&&e){var o=bn(s).hoistableScripts,u=ur(e),d=o.get(u);d||(d=s.querySelector(yo(u)),d||(e=y({src:e,async:!0},n),(n=Ea.get(u))&&wp(e,n),d=s.createElement("script"),ft(d),On(d,"link",e),s.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},o.set(u,d))}}function sj(e,n){qs.M(e,n);var s=or;if(s&&e){var o=bn(s).hoistableScripts,u=ur(e),d=o.get(u);d||(d=s.querySelector(yo(u)),d||(e=y({src:e,async:!0,type:"module"},n),(n=Ea.get(u))&&wp(e,n),d=s.createElement("script"),ft(d),On(d,"link",e),s.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},o.set(u,d))}}function dv(e,n,s,o){var u=(u=F.current)?Wc(u):null;if(!u)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return typeof s.precedence=="string"&&typeof s.href=="string"?(n=cr(s.href),s=bn(u).hoistableStyles,o=s.get(n),o||(o={type:"style",instance:null,count:0,state:null},s.set(n,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(s.rel==="stylesheet"&&typeof s.href=="string"&&typeof s.precedence=="string"){e=cr(s.href);var d=bn(u).hoistableStyles,_=d.get(e);if(_||(u=u.ownerDocument||u,_={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},d.set(e,_),(d=u.querySelector(bo(e)))&&!d._p&&(_.instance=d,_.state.loading=5),Ea.has(e)||(s={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},Ea.set(e,s),d||lj(u,e,s,_.state))),n&&o===null)throw Error(r(528,""));return _}if(n&&o!==null)throw Error(r(529,""));return null;case"script":return n=s.async,s=s.src,typeof s=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=ur(s),s=bn(u).hoistableScripts,o=s.get(n),o||(o={type:"script",instance:null,count:0,state:null},s.set(n,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,e))}}function cr(e){return'href="'+Hn(e)+'"'}function bo(e){return'link[rel="stylesheet"]['+e+"]"}function fv(e){return y({},e,{"data-precedence":e.precedence,precedence:null})}function lj(e,n,s,o){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?o.loading=1:(n=e.createElement("link"),o.preload=n,n.addEventListener("load",function(){return o.loading|=1}),n.addEventListener("error",function(){return o.loading|=2}),On(n,"link",s),ft(n),e.head.appendChild(n))}function ur(e){return'[src="'+Hn(e)+'"]'}function yo(e){return"script[async]"+e}function pv(e,n,s){if(n.count++,n.instance===null)switch(n.type){case"style":var o=e.querySelector('style[data-href~="'+Hn(s.href)+'"]');if(o)return n.instance=o,ft(o),o;var u=y({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return o=(e.ownerDocument||e).createElement("style"),ft(o),On(o,"style",u),eu(o,s.precedence,e),n.instance=o;case"stylesheet":u=cr(s.href);var d=e.querySelector(bo(u));if(d)return n.state.loading|=4,n.instance=d,ft(d),d;o=fv(s),(u=Ea.get(u))&&xp(o,u),d=(e.ownerDocument||e).createElement("link"),ft(d);var _=d;return _._p=new Promise(function(w,O){_.onload=w,_.onerror=O}),On(d,"link",o),n.state.loading|=4,eu(d,s.precedence,e),n.instance=d;case"script":return d=ur(s.src),(u=e.querySelector(yo(d)))?(n.instance=u,ft(u),u):(o=s,(u=Ea.get(d))&&(o=y({},s),wp(o,u)),e=e.ownerDocument||e,u=e.createElement("script"),ft(u),On(u,"link",o),e.head.appendChild(u),n.instance=u);case"void":return null;default:throw Error(r(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(o=n.instance,n.state.loading|=4,eu(o,s.precedence,e));return n.instance}function eu(e,n,s){for(var o=s.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=o.length?o[o.length-1]:null,d=u,_=0;_<o.length;_++){var w=o[_];if(w.dataset.precedence===n)d=w;else if(d!==u)break}d?d.parentNode.insertBefore(e,d.nextSibling):(n=s.nodeType===9?s.head:s,n.insertBefore(e,n.firstChild))}function xp(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function wp(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var tu=null;function hv(e,n,s){if(tu===null){var o=new Map,u=tu=new Map;u.set(s,o)}else u=tu,o=u.get(s),o||(o=new Map,u.set(s,o));if(o.has(e))return o;for(o.set(e,null),s=s.getElementsByTagName(e),u=0;u<s.length;u++){var d=s[u];if(!(d[qt]||d[ke]||e==="link"&&d.getAttribute("rel")==="stylesheet")&&d.namespaceURI!=="http://www.w3.org/2000/svg"){var _=d.getAttribute(n)||"";_=e+_;var w=o.get(_);w?w.push(d):o.set(_,[d])}}return o}function mv(e,n,s){e=e.ownerDocument||e,e.head.insertBefore(s,n==="title"?e.querySelector("head > title"):null)}function ij(e,n,s){if(s===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 gv(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function rj(e,n,s,o){if(s.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var u=cr(o.href),d=n.querySelector(bo(u));if(d){n=d._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=nu.bind(e),n.then(e,e)),s.state.loading|=4,s.instance=d,ft(d);return}d=n.ownerDocument||n,o=fv(o),(u=Ea.get(u))&&xp(o,u),d=d.createElement("link"),ft(d);var _=d;_._p=new Promise(function(w,O){_.onload=w,_.onerror=O}),On(d,"link",o),s.instance=d}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(s,n),(n=s.state.preload)&&(s.state.loading&3)===0&&(e.count++,s=nu.bind(e),n.addEventListener("load",s),n.addEventListener("error",s))}}var jp=0;function oj(e,n){return e.stylesheets&&e.count===0&&su(e,e.stylesheets),0<e.count||0<e.imgCount?function(s){var o=setTimeout(function(){if(e.stylesheets&&su(e,e.stylesheets),e.unsuspend){var d=e.unsuspend;e.unsuspend=null,d()}},6e4+n);0<e.imgBytes&&jp===0&&(jp=62500*Gw());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&su(e,e.stylesheets),e.unsuspend)){var d=e.unsuspend;e.unsuspend=null,d()}},(e.imgBytes>jp?50:800)+n);return e.unsuspend=s,function(){e.unsuspend=null,clearTimeout(o),clearTimeout(u)}}:null}function nu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)su(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var au=null;function su(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,au=new Map,n.forEach(cj,e),au=null,nu.call(e))}function cj(e,n){if(!(n.state.loading&4)){var s=au.get(e);if(s)var o=s.get(null);else{s=new Map,au.set(e,s);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;d<u.length;d++){var _=u[d];(_.nodeName==="LINK"||_.getAttribute("media")!=="not all")&&(s.set(_.dataset.precedence,_),o=_)}o&&s.set(null,o)}u=n.instance,_=u.getAttribute("data-precedence"),d=s.get(_)||o,d===o&&s.set(null,u),s.set(_,u),this.count++,o=nu.bind(this),u.addEventListener("load",o),u.addEventListener("error",o),d?d.parentNode.insertBefore(u,d.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(u,e.firstChild)),n.state.loading|=4}}var xo={$$typeof:z,Provider:null,Consumer:null,_currentValue:ce,_currentValue2:ce,_threadCount:0};function uj(e,n,s,o,u,d,_,w,O){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=Gn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Gn(0),this.hiddenUpdates=Gn(null),this.identifierPrefix=o,this.onUncaughtError=u,this.onCaughtError=d,this.onRecoverableError=_,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=O,this.incompleteTransitions=new Map}function _v(e,n,s,o,u,d,_,w,O,K,J,re){return e=new uj(e,n,s,_,O,K,J,re,w),n=1,d===!0&&(n|=24),d=ca(3,null,null,n),e.current=d,d.stateNode=e,n=tf(),n.refCount++,e.pooledCache=n,n.refCount++,d.memoizedState={element:o,isDehydrated:s,cache:n},lf(d),e}function vv(e){return e?(e=Bi,e):Bi}function bv(e,n,s,o,u,d){u=vv(u),o.context===null?o.context=u:o.pendingContext=u,o=cl(n),o.payload={element:s},d=d===void 0?null:d,d!==null&&(o.callback=d),s=ul(e,o,n),s!==null&&(Wn(s,e,n),Jr(s,e,n))}function yv(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var s=e.retryLane;e.retryLane=s!==0&&s<n?s:n}}function Sp(e,n){yv(e,n),(e=e.alternate)&&yv(e,n)}function xv(e){if(e.tag===13||e.tag===31){var n=Hl(e,67108864);n!==null&&Wn(n,e,67108864),Sp(e,67108864)}}function wv(e){if(e.tag===13||e.tag===31){var n=ha();n=Pa(n);var s=Hl(e,n);s!==null&&Wn(s,e,n),Sp(e,n)}}var lu=!0;function dj(e,n,s,o){var u=$.T;$.T=null;var d=ee.p;try{ee.p=2,Np(e,n,s,o)}finally{ee.p=d,$.T=u}}function fj(e,n,s,o){var u=$.T;$.T=null;var d=ee.p;try{ee.p=8,Np(e,n,s,o)}finally{ee.p=d,$.T=u}}function Np(e,n,s,o){if(lu){var u=kp(o);if(u===null)dp(e,n,o,iu,s),Sv(e,o);else if(hj(u,e,n,s,o))o.stopPropagation();else if(Sv(e,o),n&4&&-1<pj.indexOf(e)){for(;u!==null;){var d=Ot(u);if(d!==null)switch(d.tag){case 3:if(d=d.stateNode,d.current.memoizedState.isDehydrated){var _=At(d.pendingLanes);if(_!==0){var w=d;for(w.pendingLanes|=2,w.entangledLanes|=2;_;){var O=1<<31-Tt(_);w.entanglements[1]|=O,_&=~O}ls(d),(_t&6)===0&&(Gc=lt()+500,mo(0))}}break;case 31:case 13:w=Hl(d,2),w!==null&&Wn(w,d,2),Vc(),Sp(d,2)}if(d=kp(o),d===null&&dp(e,n,o,iu,s),d===u)break;u=d}u!==null&&o.stopPropagation()}else dp(e,n,o,null,s)}}function kp(e){return e=Ai(e),Ap(e)}var iu=null;function Ap(e){if(iu=null,e=mn(e),e!==null){var n=f(e);if(n===null)e=null;else{var s=n.tag;if(s===13){if(e=p(n),e!==null)return e;e=null}else if(s===31){if(e=h(n),e!==null)return e;e=null}else if(s===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return iu=e,null}function jv(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(Be()){case le:return 2;case Ae:return 8;case Le:case qe:return 32;case it:return 268435456;default:return 32}default:return 32}}var Rp=!1,xl=null,wl=null,jl=null,wo=new Map,jo=new Map,Sl=[],pj="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 Sv(e,n){switch(e){case"focusin":case"focusout":xl=null;break;case"dragenter":case"dragleave":wl=null;break;case"mouseover":case"mouseout":jl=null;break;case"pointerover":case"pointerout":wo.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":jo.delete(n.pointerId)}}function So(e,n,s,o,u,d){return e===null||e.nativeEvent!==d?(e={blockedOn:n,domEventName:s,eventSystemFlags:o,nativeEvent:d,targetContainers:[u]},n!==null&&(n=Ot(n),n!==null&&xv(n)),e):(e.eventSystemFlags|=o,n=e.targetContainers,u!==null&&n.indexOf(u)===-1&&n.push(u),e)}function hj(e,n,s,o,u){switch(n){case"focusin":return xl=So(xl,e,n,s,o,u),!0;case"dragenter":return wl=So(wl,e,n,s,o,u),!0;case"mouseover":return jl=So(jl,e,n,s,o,u),!0;case"pointerover":var d=u.pointerId;return wo.set(d,So(wo.get(d)||null,e,n,s,o,u)),!0;case"gotpointercapture":return d=u.pointerId,jo.set(d,So(jo.get(d)||null,e,n,s,o,u)),!0}return!1}function Nv(e){var n=mn(e.target);if(n!==null){var s=f(n);if(s!==null){if(n=s.tag,n===13){if(n=p(s),n!==null){e.blockedOn=n,xe(e.priority,function(){wv(s)});return}}else if(n===31){if(n=h(s),n!==null){e.blockedOn=n,xe(e.priority,function(){wv(s)});return}}else if(n===3&&s.stateNode.current.memoizedState.isDehydrated){e.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}e.blockedOn=null}function ru(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var s=kp(e.nativeEvent);if(s===null){s=e.nativeEvent;var o=new s.constructor(s.type,s);ki=o,s.target.dispatchEvent(o),ki=null}else return n=Ot(s),n!==null&&xv(n),e.blockedOn=s,!1;n.shift()}return!0}function kv(e,n,s){ru(e)&&s.delete(n)}function mj(){Rp=!1,xl!==null&&ru(xl)&&(xl=null),wl!==null&&ru(wl)&&(wl=null),jl!==null&&ru(jl)&&(jl=null),wo.forEach(kv),jo.forEach(kv)}function ou(e,n){e.blockedOn===n&&(e.blockedOn=null,Rp||(Rp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,mj)))}var cu=null;function Av(e){cu!==e&&(cu=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){cu===e&&(cu=null);for(var n=0;n<e.length;n+=3){var s=e[n],o=e[n+1],u=e[n+2];if(typeof o!="function"){if(Ap(o||s)===null)continue;break}var d=Ot(s);d!==null&&(e.splice(n,3),n-=3,kf(d,{pending:!0,data:u,method:s.method,action:o},o,u))}}))}function dr(e){function n(O){return ou(O,e)}xl!==null&&ou(xl,e),wl!==null&&ou(wl,e),jl!==null&&ou(jl,e),wo.forEach(n),jo.forEach(n);for(var s=0;s<Sl.length;s++){var o=Sl[s];o.blockedOn===e&&(o.blockedOn=null)}for(;0<Sl.length&&(s=Sl[0],s.blockedOn===null);)Nv(s),s.blockedOn===null&&Sl.shift();if(s=(e.ownerDocument||e).$$reactFormReplay,s!=null)for(o=0;o<s.length;o+=3){var u=s[o],d=s[o+1],_=u[Oe]||null;if(typeof d=="function")_||Av(s);else if(_){var w=null;if(d&&d.hasAttribute("formAction")){if(u=d,_=d[Oe]||null)w=_.formAction;else if(Ap(u)!==null)continue}else w=_.action;typeof w=="function"?s[o+1]=w:(s.splice(o,3),o-=3),Av(s)}}}function Rv(){function e(d){d.canIntercept&&d.info==="react-transition"&&d.intercept({handler:function(){return new Promise(function(_){return u=_})},focusReset:"manual",scroll:"manual"})}function n(){u!==null&&(u(),u=null),o||setTimeout(s,20)}function s(){if(!o&&!navigation.transition){var d=navigation.currentEntry;d&&d.url!=null&&navigation.navigate(d.url,{state:d.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var o=!1,u=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(s,100),function(){o=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),u!==null&&(u(),u=null)}}}function Ep(e){this._internalRoot=e}uu.prototype.render=Ep.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(r(409));var s=n.current,o=ha();bv(s,o,e,n,null,null)},uu.prototype.unmount=Ep.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;bv(e.current,2,null,e,null,null),Vc(),n[Fe]=null}};function uu(e){this._internalRoot=e}uu.prototype.unstable_scheduleHydration=function(e){if(e){var n=I();e={blockedOn:null,target:e,priority:n};for(var s=0;s<Sl.length&&n!==0&&n<Sl[s].priority;s++);Sl.splice(s,0,e),s===0&&Nv(e)}};var Ev=a.version;if(Ev!=="19.2.7")throw Error(r(527,Ev,"19.2.7"));ee.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(r(188)):(e=Object.keys(e).join(","),Error(r(268,e)));return e=m(n),e=e!==null?x(e):null,e=e===null?null:e.stateNode,e};var gj={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:$,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var du=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!du.isDisabled&&du.supportsFiber)try{Qe=du.inject(gj),dt=du}catch{}}return ko.createRoot=function(e,n){if(!c(e))throw Error(r(299));var s=!1,o="",u=Ig,d=Dg,_=zg;return n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onUncaughtError!==void 0&&(u=n.onUncaughtError),n.onCaughtError!==void 0&&(d=n.onCaughtError),n.onRecoverableError!==void 0&&(_=n.onRecoverableError)),n=_v(e,1,!1,null,null,s,o,null,u,d,_,Rv),e[Fe]=n.current,up(e),new Ep(n)},ko.hydrateRoot=function(e,n,s){if(!c(e))throw Error(r(299));var o=!1,u="",d=Ig,_=Dg,w=zg,O=null;return s!=null&&(s.unstable_strictMode===!0&&(o=!0),s.identifierPrefix!==void 0&&(u=s.identifierPrefix),s.onUncaughtError!==void 0&&(d=s.onUncaughtError),s.onCaughtError!==void 0&&(_=s.onCaughtError),s.onRecoverableError!==void 0&&(w=s.onRecoverableError),s.formState!==void 0&&(O=s.formState)),n=_v(e,1,!0,n,s??null,o,u,O,d,_,w,Rv),n.context=vv(null),s=n.current,o=ha(),o=Pa(o),u=cl(o),u.callback=null,ul(s,u,o),s=o,n.current.lanes=s,sa(n,s),ls(n),e[Fe]=n.current,up(e),new uu(n)},ko.version="19.2.7",ko}var qv;function Nj(){if(qv)return Op.exports;qv=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(a){console.error(a)}}return t(),Op.exports=Sj(),Op.exports}var kj=Nj();function Aj({error:t,onAddPasskey:a,onSignOut:i,pending:r}){const[c,f]=b.useState(!1),[p,h]=b.useState(!1),v=b.useId(),m=b.useRef(null),x=b.useRef(null),y=b.useRef(null),E=b.useRef(null);b.useEffect(()=>{if(c){h(!1);return}h(!0);const M=window.setTimeout(()=>h(!1),160);return()=>window.clearTimeout(M)},[c]),b.useEffect(()=>{if(!c)return;y.current?.focus();const M=k=>{k.target instanceof Node&&!m.current?.contains(k.target)&&f(!1)};return document.addEventListener("pointerdown",M),()=>document.removeEventListener("pointerdown",M)},[c]),b.useEffect(()=>{t!==null&&f(!0)},[t]);const S=()=>{f(!1),x.current?.focus()},C=M=>{f(!1),M()},T=M=>{if(M.key==="Escape"){M.preventDefault(),S();return}if(M.key==="Tab"){f(!1);return}if(M.key==="Home"||M.key==="End"){M.preventDefault(),(M.key==="Home"?y:E).current?.focus();return}if(M.key==="ArrowDown"||M.key==="ArrowUp"){M.preventDefault();const k=[y.current,E.current].filter(q=>q!==null&&!q.disabled);if(k.length===0)return;const z=k.indexOf(document.activeElement),R=M.key==="ArrowDown"?1:-1,B=z===-1?0:(z+R+k.length)%k.length;k[B]?.focus()}},N=r!==null;return l.jsxs("div",{className:"account-menu",ref:m,children:[l.jsxs("button",{"aria-busy":N,"aria-controls":c?v:void 0,"aria-expanded":c,"aria-haspopup":"menu","aria-label":"Account menu",className:"account-menu__trigger",disabled:N,onClick:()=>f(M=>!M),ref:x,title:"Account",type:"button",children:[l.jsx("span",{"aria-hidden":"true",className:"account-menu__mark",children:l.jsx("span",{className:"account-menu__mark-dot"})}),l.jsx("span",{className:"account-menu__trigger-label",children:"account"}),l.jsx("span",{"aria-hidden":"true",className:"account-menu__chevron",children:c?"⌃":"⌄"})]}),c||p?l.jsxs("div",{"aria-hidden":p&&!c?"true":void 0,className:"account-menu__panel","data-closing":p&&!c?"true":void 0,inert:p&&!c?!0:void 0,children:[l.jsxs("div",{className:"account-menu__heading",children:[l.jsx("span",{children:"Account"}),l.jsxs("span",{className:"account-menu__status",children:[l.jsx("span",{"aria-hidden":"true",className:"account-menu__status-dot"}),"passkey authenticated"]})]}),l.jsxs("div",{"aria-label":"Account",id:v,onKeyDown:T,role:"menu",children:[l.jsxs("button",{className:"account-menu__item",disabled:N,onClick:()=>C(a),ref:y,role:"menuitem",type:"button",children:[l.jsx("span",{className:"account-menu__item-label",children:r==="register"?"Adding passkey…":"Add passkey"}),l.jsx("span",{className:"account-menu__item-detail",children:"Register a backup authenticator"})]}),l.jsxs("button",{className:"account-menu__item account-menu__item--sign-out",disabled:N,onClick:()=>C(i),ref:E,role:"menuitem",type:"button",children:[l.jsx("span",{className:"account-menu__item-label",children:r==="logout"?"Signing out…":"Sign out"}),l.jsx("span",{className:"account-menu__item-detail",children:"End this dashboard session"})]})]}),t===null?null:l.jsx("p",{className:"account-menu__error",role:"alert",children:t})]}):null]})}var qy=zy();const Rj=["button:not([disabled])","[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");function Uv(t){return[...t.querySelectorAll(Rj)].filter(a=>{const i=window.getComputedStyle(a);return a.getAttribute("aria-hidden")!=="true"&&!a.hidden&&i.display!=="none"&&i.visibility!=="hidden"})}function fd({applicationRootId:t,children:a,labelledBy:i,onClose:r,open:c,panelClassName:f}){const p=b.useRef(null),h=b.useRef(null),[v,m]=b.useState(c);if(b.useEffect(()=>{if(c){m(!0);return}if(!v)return;const S=window.setTimeout(()=>m(!1),200);return()=>window.clearTimeout(S)},[c,v]),b.useEffect(()=>{if(!c||!v)return;h.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const S=document.getElementById(t),C=S?.hasAttribute("inert")??!1,T=S?.getAttribute("aria-hidden")??null;S?.setAttribute("inert",""),S?.setAttribute("aria-hidden","true");const N=p.current;return((N?Uv(N)[0]:void 0)??N)?.focus(),()=>{S&&(C||S.removeAttribute("inert"),T===null?S.removeAttribute("aria-hidden"):S.setAttribute("aria-hidden",T)),h.current?.focus(),h.current=null}},[t,c,v]),!v)return null;const x=S=>{if(S.key==="Escape"){S.preventDefault(),r();return}if(S.key!=="Tab"||!p.current)return;const C=Uv(p.current);if(C.length===0){S.preventDefault(),p.current.focus();return}const T=C[0],N=C[C.length-1];(!S.shiftKey&&document.activeElement===N||S.shiftKey&&document.activeElement===T||!p.current.contains(document.activeElement))&&(S.preventDefault(),(S.shiftKey?N:T)?.focus())},y=S=>{S.target===S.currentTarget&&r()},E=!c;return qy.createPortal(l.jsx("div",{"aria-hidden":E?"true":void 0,className:"accessible-dialog__backdrop","data-closing":E?"true":void 0,inert:E?!0:void 0,onMouseDown:y,children:l.jsx("div",{"aria-hidden":E?"true":void 0,"aria-labelledby":i,"aria-modal":"true",className:f===void 0?"accessible-dialog":`accessible-dialog ${f}`,"data-closing":E?"true":void 0,inert:E?!0:void 0,onKeyDown:x,ref:p,role:"dialog",tabIndex:-1,children:a})}),document.body)}const Ej={runs:"M5 3h4a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z M15 13h4a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2z M7 11v4a2 2 0 0 0 2 2h4",calls:"M4 17l6-6-6-6 M12 19h8",context:"M12 2L2 7l10 5 10-5-10-5z M2 12l10 5 10-5 M2 17l10 5 10-5",progress:"M3 17l2 2 4-4 M3 7l2 2 4-4 M13 6h8 M13 12h8 M13 18h8",workflows:"M6 3v12 M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6z M6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z M18 9a9 9 0 0 1-9 9",adapters:"M12 22v-5 M9 8V2 M15 8V2 M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8z",artifacts:"M3 3h18a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1z M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8 M10 12h4",builder:"M12 20h9 M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4z",more:"M5 11a1 1 0 1 0 0 2a1 1 0 1 0 0-2z M12 11a1 1 0 1 0 0 2a1 1 0 1 0 0-2z M19 11a1 1 0 1 0 0 2a1 1 0 1 0 0-2z",dark:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9z",light:"M12 4V2 M12 22v-2 M4.93 4.93l1.41 1.41 M17.66 17.66l1.41 1.41 M2 12h2 M20 12h2 M6.34 17.66l-1.41 1.41 M19.07 4.93l-1.41 1.41 M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8z",search:"M11 4a7 7 0 1 0 0 14 7 7 0 0 0 0-14z M21 21l-4.35-4.35"};function Tl({className:t,name:a}){return l.jsx("svg",{"aria-hidden":"true",className:t===void 0?"monoline-icon":`monoline-icon ${t}`,focusable:"false",viewBox:"0 0 24 24",children:l.jsx("path",{d:Ej[a]})})}function Lh({announcement:t}){const a=b.useRef(t?.key??null),[i,r]=b.useState(t?.message??"");return b.useEffect(()=>{if(!t){a.current=null,r("");return}t.key!==a.current&&(a.current=t.key,r(t.message))},[t]),l.jsx("div",{"aria-atomic":"true","aria-live":"polite",className:"visually-hidden",role:"status",children:i})}const Tj=["runs","calls","context","progress","workflows","adapters"],Bv={runs:"Workflow runs",calls:"Single calls",context:"Context runs",progress:"Progress reports",workflows:"Workflows",adapters:"Adapters"},Cj=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.userAgent??""),Uy=Cj?"⌘K":"ctrl K",Gv=`jump to a run, call, context run or report · ${Uy}`;function Hv(t){const[a,i]=b.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia(t).matches);return b.useEffect(()=>{if(typeof window.matchMedia!="function")return;const r=window.matchMedia(t),c=()=>i(r.matches);return c(),r.addEventListener("change",c),()=>r.removeEventListener("change",c)},[t]),a}function Vv(t){return`jump-palette-option-${t.id}`}function Oj({applicationRootId:t="root",items:a,onOpen:i}){const[r,c]=b.useState(!1),[f,p]=b.useState(""),[h,v]=b.useState(0),m=b.useRef(null),x=b.useRef(null),y=b.useRef(null),E=b.useRef(null),S=Hv("(max-width: 880px)"),C=Hv("(max-width: 1279px)"),T=f.trim().toLowerCase(),N=b.useMemo(()=>Tj.map(ue=>({groupId:ue,items:a.filter(_e=>_e.group===ue&&(T===""||_e.searchTerms.some(me=>me.toLowerCase().includes(T))))})).filter(ue=>ue.items.length>0),[a,T]),M=b.useMemo(()=>N.flatMap(ue=>ue.items),[N]),k=Math.min(h,Math.max(M.length-1,0)),z=M[k],R=M.length===1?"1 match":`${M.length} matches`,B=C?"jump to…":"jump to a run, call or context…",q=b.useCallback(()=>{c(!1),p(""),v(0)},[]),Z=b.useCallback(()=>{p(""),v(0),c(!0)},[]);b.useEffect(()=>{const ue=_e=>{!_e.metaKey&&!_e.ctrlKey||_e.altKey||_e.key!=="k"&&_e.key!=="K"||S||(_e.preventDefault(),r?q():Z())};return window.addEventListener("keydown",ue),()=>window.removeEventListener("keydown",ue)},[q,S,r,Z]),b.useEffect(()=>{r&&S&&q()},[q,S,r]),b.useEffect(()=>{if(!r)return;y.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const ue=document.getElementById(t),_e=ue?.hasAttribute("inert")??!1,me=ue?.getAttribute("aria-hidden")??null;return ue?.setAttribute("inert",""),ue?.setAttribute("aria-hidden","true"),m.current?.focus(),()=>{ue&&(_e||ue.removeAttribute("inert"),me===null?ue.removeAttribute("aria-hidden"):ue.setAttribute("aria-hidden",me)),y.current?.focus(),y.current=null}},[t,r]),b.useEffect(()=>{E.current?.scrollIntoView?.({block:"nearest"})},[k,M.length]);const ae=()=>{z!==void 0&&(q(),i(z))},oe=ue=>{if(ue.key==="ArrowDown"||ue.key==="ArrowUp"){if(ue.preventDefault(),M.length===0)return;const _e=ue.key==="ArrowDown"?1:-1;v(me=>(Math.min(me,M.length-1)+_e+M.length)%M.length);return}if(ue.key==="Enter"){ue.preventDefault(),ae();return}if(ue.key==="Escape"){ue.preventDefault(),q();return}ue.key==="Tab"&&ue.preventDefault()},P=r?{key:`${T}:${M.length}`,message:R}:null;return l.jsxs(l.Fragment,{children:[l.jsxs("button",{"aria-label":Gv,className:"app-shell__jump-trigger",onClick:Z,ref:x,title:Gv,type:"button",children:[l.jsx(Tl,{className:"monoline-icon--thin",name:"search"}),l.jsx("span",{className:"app-shell__jump-placeholder",children:B}),l.jsx("span",{"aria-hidden":"true",className:"app-shell__jump-kbd",children:Uy})]}),r?qy.createPortal(l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"jump-palette__scrim",onMouseDown:ue=>{ue.target===ue.currentTarget&&q()}}),l.jsxs("div",{"aria-modal":"true",className:"jump-palette",role:"dialog","aria-label":"jump to",children:[l.jsxs("div",{className:"jump-palette__input-row",children:[l.jsx(Tl,{className:"monoline-icon--thin jump-palette__search-icon",name:"search"}),l.jsx("input",{"aria-activedescendant":z===void 0?void 0:Vv(z),"aria-autocomplete":"list","aria-controls":"jump-palette-listbox","aria-expanded":"true","aria-label":"jump to",autoComplete:"off",className:"jump-palette__input",onChange:ue=>{p(ue.target.value),v(0)},onKeyDown:oe,placeholder:"jump to a run, call, context run or report",ref:m,role:"combobox",spellCheck:!1,type:"text",value:f}),l.jsx("span",{"aria-hidden":"true",className:"jump-palette__kbd",children:"esc"})]}),l.jsxs("div",{"aria-label":"matches",className:"jump-palette__listbox",id:"jump-palette-listbox",role:"listbox",children:[N.map(ue=>l.jsxs("div",{"aria-label":Bv[ue.groupId],className:"jump-palette__group",role:"group",children:[l.jsx("div",{"aria-hidden":"true",className:"jump-palette__group-label",children:Bv[ue.groupId]}),ue.items.map(_e=>{const me=_e===z;return l.jsxs("div",{"aria-selected":me,className:"jump-palette__option","data-item-id":_e.id,id:Vv(_e),onClick:()=>{v(M.indexOf(_e)),q(),i(_e)},onMouseEnter:()=>{v(M.indexOf(_e))},ref:me?E:void 0,role:"option",tabIndex:-1,children:[l.jsx("span",{className:"jump-palette__name",children:_e.name}),l.jsx("span",{className:"jump-palette__sub",children:_e.sub}),l.jsx("span",{"aria-hidden":"true",className:"jump-palette__gap"}),l.jsx("span",{className:"jump-palette__meta",children:_e.meta}),_e.status===""?null:l.jsx("span",{className:"jump-palette__tag","data-status":_e.status,children:_e.status})]},_e.id)})]},ue.groupId)),M.length===0?l.jsxs("p",{className:"jump-palette__empty",children:["Nothing on the sheet matches “",f,"”."]}):null]}),l.jsxs("div",{className:"jump-palette__foot",children:[l.jsxs("span",{className:"jump-palette__foot-keys",children:[l.jsx("span",{"aria-hidden":"true",className:"jump-palette__kbd",children:"↑"}),l.jsx("span",{"aria-hidden":"true",className:"jump-palette__kbd",children:"↓"}),"move"]}),l.jsxs("span",{className:"jump-palette__foot-keys",children:[l.jsx("span",{"aria-hidden":"true",className:"jump-palette__kbd",children:"↵"}),"open"]}),l.jsx("span",{"aria-hidden":"true",className:"jump-palette__gap"}),l.jsx("span",{className:"jump-palette__count",children:R})]}),l.jsx(Lh,{announcement:P})]})]}),document.body):null]})}const $j="clinkx-theme";function By(t=document.documentElement){return t.getAttribute("data-theme")==="dark"?"dark":"light"}function Gy(t,a){try{(a??window.localStorage).setItem($j,t)}catch{}}function Hy(t,a=document.documentElement){if(t==="dark"){a.setAttribute("data-theme","dark");return}a.removeAttribute("data-theme")}function Vy(t){return t==="dark"?"light":"dark"}const Mj={dark:"switch to light theme",light:"switch to dark theme"};function Ky(){const[t,a]=b.useState(By);return[t,()=>{const r=Vy(t);a(r),Gy(r),Hy(r)}]}function Lj(){const[t,a]=Ky(),i=Mj[t];return l.jsx("button",{"aria-label":i,className:"app-shell__theme-toggle",onClick:a,title:i,type:"button",children:l.jsx("span",{"aria-hidden":"true",children:t==="dark"?"◑":"◐"})})}function Ij(){const[t,a]=Ky(),i=t==="dark";return l.jsxs("button",{"aria-checked":i,"aria-label":"dark appearance",className:"app-shell__more-theme",onClick:a,role:"switch",type:"button",children:[l.jsx(Tl,{className:"app-shell__more-theme-icon",name:i?"dark":"light"}),l.jsx("span",{className:"app-shell__more-theme-label",children:"appearance"}),l.jsx("span",{className:"app-shell__more-theme-value",children:t}),l.jsx("span",{"aria-hidden":"true",className:`app-shell__more-switch${i?" app-shell__more-switch--on":""}`,children:l.jsx("span",{className:"app-shell__more-knob"})})]})}const Zy=[{destination:"runs",desktopLabel:"runs",icon:"runs",mobileLabel:"runs"},{destination:"activities",desktopLabel:"single calls",icon:"calls",mobileLabel:"calls"},{destination:"context_runs",desktopLabel:"context runs",icon:"context",mobileLabel:"context"},{destination:"progress_reports",desktopLabel:"progress",icon:"progress",mobileLabel:"progress"}],hh=[{destination:"workflows",desktopLabel:"workflows",icon:"workflows",mobileLabel:"workflows"},{destination:"adapters",desktopLabel:"adapters",icon:"adapters",mobileLabel:"adapters"},{destination:"artifacts",desktopLabel:"artifacts",icon:"artifacts",mobileLabel:"artifacts"}],Su=[{destination:"prompt_builder",desktopLabel:"prompt builder",icon:"builder",mobileLabel:"builder"}],Dj=[...Zy,...hh,...Su];function Ip(t){return t===void 0?"—":String(t)}const zj={initial_loading:"loading",current:"live",stale:"stale",offline:"offline",auth_expired:"auth expired",connection_changed:"connection changed",error:"error"};function qj({count:t}){const a=Math.min(t,8);return l.jsx("span",{"aria-hidden":"true",className:"app-shell__calls-dots",children:a===0?l.jsx("span",{className:"app-shell__calls-dot app-shell__calls-dot--idle"}):Array.from({length:a},(i,r)=>l.jsx("span",{className:"app-shell__calls-dot"},r))})}function Uj({accountActions:t,activeDestination:a,applicationRootId:i="root",children:r,environment:c,jumpItems:f,navigationCounts:p,observationAvailable:h=!0,onJumpOpen:v,onNavigate:m,pageTitle:x,pollingPhase:y,reportedRunningCalls:E}){const S=h?zj[y]:"static",C=h?y:"static",[T,N]=b.useState(!1),[M,k]=b.useState(!1),z=[...hh,...Su].find(B=>B.destination===a);b.useEffect(()=>{if(!M||typeof window.matchMedia!="function")return;const B=window.matchMedia("(min-width: 881px)"),q=()=>{B.matches&&k(!1)};return q(),B.addEventListener("change",q),()=>B.removeEventListener("change",q)},[M]);const R=`Reported running workflow calls · ${E.refreshedLabel??"refresh pending"} · not a worker-health signal`;return l.jsxs("div",{className:"app-shell",children:[l.jsxs("header",{className:"app-shell__bar",children:[l.jsxs("span",{"aria-hidden":"true",className:"app-shell__mobile-identity",children:[l.jsx("span",{className:"app-shell__identity-mark",children:l.jsx("span",{className:"app-shell__identity-dot"})}),l.jsx("span",{className:"app-shell__identity-name",children:"ClinkX"})]}),l.jsx("div",{className:"app-shell__brand-line",children:l.jsx("span",{className:"app-shell__page-title",children:x})}),l.jsx("span",{className:"app-shell__mobile-title",children:x}),f!==void 0&&v!==void 0?l.jsx(Oj,{applicationRootId:i,items:f,onOpen:v}):null,l.jsx("span",{"aria-hidden":"true",className:"app-shell__bar-spacer"}),l.jsxs("span",{className:`app-shell__live-tag app-shell__live-tag--${C}`,"data-phase":C,children:[l.jsx("span",{"aria-hidden":"true",className:"app-shell__live-dot"}),S]}),l.jsx("span",{className:"app-shell__theme-control",children:l.jsx(Lj,{})}),t===void 0?l.jsx("button",{className:"app-shell__run-action",onClick:()=>m("workflows"),type:"button",children:"run workflow"}):l.jsx(Aj,{...t})]}),l.jsxs("div",{className:"app-shell__workspace",children:[l.jsxs("aside",{className:"app-shell__sidebar","aria-label":"Dashboard context",children:[l.jsxs("div",{className:"app-shell__identity","aria-hidden":"true",children:[l.jsx("span",{className:"app-shell__identity-mark",children:l.jsx("span",{className:"app-shell__identity-dot"})}),l.jsx("span",{className:"app-shell__identity-name",children:"ClinkX"})]}),l.jsx("nav",{className:"app-shell__desktop-nav","aria-label":"Primary",children:Dj.map(B=>{const q=B.destination===a;return l.jsxs(b.Fragment,{children:[Su[0]?.destination===B.destination?l.jsx("div",{"aria-hidden":"true",className:"app-shell__nav-separator"}):null,l.jsxs("button",{"aria-current":q?"page":void 0,className:"app-shell__nav-button",onClick:()=>m(B.destination),type:"button",children:[l.jsx(Tl,{className:"app-shell__nav-icon",name:B.icon}),l.jsx("span",{className:"app-shell__nav-label",children:B.desktopLabel}),l.jsx("span",{className:"app-shell__nav-count",children:Ip(p[B.destination])})]})]},B.destination)})}),l.jsxs("section",{className:"app-shell__instrument","aria-labelledby":"calls-label",children:[l.jsx("h2",{className:"app-shell__section-label",id:"calls-label",title:R,children:"Running calls"}),l.jsx("p",{className:"app-shell__instrument-value",children:E.count===null?"not loaded":l.jsxs(l.Fragment,{children:[l.jsx(qj,{count:E.count}),l.jsx("span",{className:"app-shell__calls-count",children:E.count})]})})]}),l.jsxs("section",{className:"app-shell__environment","aria-labelledby":"env-label",children:[l.jsx("h2",{className:"app-shell__section-label",id:"env-label",children:l.jsxs("button",{"aria-controls":"app-shell-environment-list","aria-expanded":T,className:"app-shell__environment-toggle",onClick:()=>N(B=>!B),title:"effective paths of this dashboard process",type:"button",children:[l.jsx("span",{className:"app-shell__environment-word",children:"Env"}),l.jsx("span",{className:"app-shell__environment-toggle-word",children:T?"[ hide ]":"[ show ]"})]})}),l.jsxs("dl",{className:"app-shell__environment-list",hidden:!T,id:"app-shell-environment-list",children:[l.jsxs("div",{children:[l.jsx("dt",{children:"WORKSPACE_ROOT"}),l.jsx("dd",{children:c?.workspaceRoot??"not reported"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"STATE_DIR"}),l.jsx("dd",{children:c?.stateDir??"not reported"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"RUNS_ROOT"}),l.jsx("dd",{children:c?.runsRoot??"not reported"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"ACTIVITIES_ROOT"}),l.jsx("dd",{children:c?.activitiesRoot??"not reported"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"WORKFLOWS_PATH"}),l.jsx("dd",{children:c?.workflowsPath??"not reported"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"TEMPLATES_PATH"}),l.jsx("dd",{children:c?.templatesPath??"not reported"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"CHILD_CONFIG"}),l.jsx("dd",{children:c?.childConfig??"not reported"})]})]})]})]}),l.jsxs("main",{className:"app-shell__main","aria-labelledby":"dashboard-page-title",id:"main-content",tabIndex:0,children:[r,l.jsx("span",{"aria-hidden":"true",className:"app-shell__version-stamp",children:"clinkx-workflows · dashboard · observer · state_version 1"})]})]}),l.jsxs("nav",{className:"app-shell__mobile-tabs","aria-label":"Mobile",children:[Zy.map(B=>{const q=B.destination===a;return l.jsxs("button",{"aria-current":q?"page":void 0,"aria-label":`${B.mobileLabel} · ${Ip(p[B.destination])}`,className:"app-shell__mobile-tab",onClick:()=>m(B.destination),type:"button",children:[l.jsx(Tl,{className:"app-shell__mobile-tab-icon",name:B.icon}),l.jsx("span",{className:"app-shell__mobile-tab-label",children:B.mobileLabel})]},B.destination)}),l.jsxs("button",{"aria-current":z===void 0?void 0:"page","aria-label":"more · catalogs and the prompt builder",className:"app-shell__mobile-tab","data-more-open":M?"true":void 0,onClick:()=>k(B=>!B),type:"button",children:[l.jsx(Tl,{className:"app-shell__mobile-tab-icon",name:z===void 0?"more":z.icon}),l.jsx("span",{className:"app-shell__mobile-tab-label",children:z===void 0?"more":z.mobileLabel})]})]}),l.jsx(fd,{applicationRootId:i,labelledBy:"app-shell-more-title",onClose:()=>k(!1),open:M,panelClassName:"accessible-dialog--sheet app-shell__more-sheet",children:l.jsxs("div",{className:"app-shell__more-sheet-inner",children:[l.jsx("button",{"aria-label":"close",className:"app-shell__more-handle",onClick:()=>k(!1),type:"button",children:l.jsx("span",{"aria-hidden":"true",className:"app-shell__more-handle-pill"})}),l.jsx("div",{className:"app-shell__more-head",children:l.jsx("span",{className:"app-shell__more-title",id:"app-shell-more-title",children:"Catalogs"})}),l.jsx("div",{className:"app-shell__more-rows",children:hh.map(B=>{const q=B.destination===a;return l.jsxs("button",{"aria-current":q?"page":void 0,className:`app-shell__more-row${q?" app-shell__more-row--active":""}`,onClick:()=>{k(!1),m(B.destination)},type:"button",children:[l.jsx(Tl,{className:"app-shell__more-row-icon",name:B.icon}),l.jsx("span",{className:"app-shell__more-row-label",children:B.desktopLabel}),l.jsx("span",{className:"app-shell__more-row-count",children:Ip(p[B.destination])}),l.jsx("span",{"aria-hidden":"true",className:"app-shell__more-row-chevron",children:"›"})]},B.destination)})}),l.jsx("div",{"aria-hidden":"true",className:"app-shell__more-divider"}),l.jsx("div",{className:"app-shell__more-head",children:l.jsx("span",{className:"app-shell__more-title",children:"Compose"})}),l.jsx("div",{className:"app-shell__more-rows",children:Su.map(B=>{const q=B.destination===a;return l.jsxs("button",{"aria-current":q?"page":void 0,className:`app-shell__more-row${q?" app-shell__more-row--active":""}`,onClick:()=>{k(!1),m(B.destination)},type:"button",children:[l.jsx(Tl,{className:"app-shell__more-row-icon",name:B.icon}),l.jsxs("span",{className:"app-shell__more-row-text",children:[l.jsx("span",{className:"app-shell__more-row-label",children:B.desktopLabel}),l.jsx("span",{className:"app-shell__more-row-desc",children:"assemble a run-workflow prompt"})]}),l.jsx("span",{"aria-hidden":"true",className:"app-shell__more-row-chevron",children:"›"})]},B.destination)})}),l.jsx("div",{"aria-hidden":"true",className:"app-shell__more-divider"}),l.jsx(Ij,{})]})})]})}function _n(t,a){const i=Date.parse(t);if(!Number.isFinite(i))return"not reported";const r=Math.max(0,a-i),c=Math.floor(r/1e3);if(c<60)return`${String(c)}s ago`;const f=Math.floor(c/60);if(f<60)return`${String(f)}m ago`;const p=Math.floor(f/60);return p<24?`${String(p)}h ago`:`${String(Math.floor(p/24))}d ago`}function Lu(t){const a=Math.max(0,t),i=Math.floor(a/1e3);if(i<60)return`${String(i)}s`;const r=Math.floor(i/60);return r<60?`${String(r)}m`:`${String(Math.floor(r/60))}h`}function Cr(t){return t.status!=="pending"&&t.status!=="running"?"terminal":t.orphaned||t.workerLockObservation==="orphaned"?"orphaned":t.workerLockObservation==="live"?"live":t.workerLockObservation==="heartbeat_live"?"heartbeat_live":"unknown"}function Zo(t){return t==="live"||t==="heartbeat_live"}function Kv(t){const a=t.callTotal;if(a===void 0)return`${t.stageId} · ${t.state}`;const i=t.callSucceeded??0,r=a===1?"call":"calls";return(t.state==="pending"||t.state==="cancelled")&&i===0?`${t.stageId} · ${String(a)} ${r} · ${t.state}`:`${t.stageId} · ${String(i)}/${String(a)} ${r} · ${t.state}`}function Nr(t){const a=Math.floor(Math.max(0,t)/1e3),i=Math.floor(a/3600),r=Math.floor(a%3600/60),c=a%60;return i>0?`${String(i)}:${String(r).padStart(2,"0")}:${String(c).padStart(2,"0")}`:`${String(r)}:${String(c).padStart(2,"0")}`}function Bj(t,a){return a==="orphaned"?"orphaned":a==="unknown"?"worker unknown":t.status}function Gj(t,a){if(t.startedAt!==void 0&&t.completedAt!==void 0){const i=Math.max(0,Date.parse(t.completedAt)-Date.parse(t.startedAt));return`duration ${Lu(i)}`}if(t.startedAt!==void 0){const i=Date.parse(t.stateUpdatedAt),r=Cr(t),c=Zo(r)||r==="unknown"||!Number.isFinite(i)?a:i;return`started ${_n(t.startedAt,c)}`}return t.completedAt!==void 0?`completed ${_n(t.completedAt,a)}`:"timing not reported"}function Hj(t,a){if(t.startedAt===void 0)return null;const i=Date.parse(t.startedAt);if(!Number.isFinite(i))return null;if(t.completedAt!==void 0){const p=Date.parse(t.completedAt);if(Number.isFinite(p))return Math.max(0,p-i)}const r=Cr(t),c=Date.parse(t.stateUpdatedAt),f=r==="orphaned"&&Number.isFinite(c)?c:a;return Math.max(0,f-i)}function Vj(t,a,i){if(a==="orphaned")return`stale · last write ${_n(t.stateUpdatedAt,i)}`;if(t.status==="running"){const c=t.stageMarkers.find(p=>p.state==="running");if(c===void 0)return"▸ finalizing";if(c.callTotal===void 0)return`▸ ${c.stageId}`;const f=c.callSucceeded??0;return`▸ ${c.stageId} · ${String(f)}/${String(c.callTotal)} calls done`}if(t.status==="pending")return"";const r=_n(t.completedAt??t.stateUpdatedAt,i);if(t.status==="failed"){const c=t.stageMarkers.find(f=>f.state==="failed");return c===void 0?`failed · ${r}`:`failed at ${c.stageId} · ${r}`}return`finished ${r}`}function Ih(t){const a=t.resumable===!0&&t.workflowName!=="plan-review-receipts"&&(t.status==="failed"||t.status==="cancelled");return t.orphaned===!0?{tool:"resume_workflow",label:"resume + cancel handoff",text:`resume_workflow run_id=${t.runId}
|
|
10
|
-
cancel_workflow run_id=${t.runId}`}:t.status==="pending"||t.status==="running"?{tool:"cancel_workflow",label:"cancel handoff",text:`cancel_workflow run_id=${t.runId}`}:a?{tool:"resume_workflow",label:"resume handoff",text:`resume_workflow run_id=${t.runId}`}:null}function Zv(t,a){if(t.availability==="unavailable")return{availability:"unavailable",row:t,statusLabel:t.reason.replaceAll("_"," ")};const i=Cr(t),r=[...i==="heartbeat_live"?["heartbeat"]:[],...t.async?["async"]:[],...t.debugKeepArtifacts?["debug kept"]:[]];return{availability:"available",row:t,workflowLabel:`${t.workflowName} · v${t.workflowVersion}`,statusLabel:Bj(t,i),workerObservation:i,showLiveMotion:Zo(i),statusTags:t.status==="failed"&&t.stageCounts.succeeded>0?["partially_succeeded"]:t.status==="succeeded"&&(t.callCounts.failed>0||t.stageCounts.failed>0)?["degraded"]:[],timingLabel:Gj(t,a),updatedAgeLabel:_n(t.stateUpdatedAt,a),reportedRunningCallsLabel:`${String(t.reportedRunningCalls)} reported running calls — not a worker-health signal`,elapsedLabel:(()=>{const c=Hj(t,a);return c===null?"timing not reported":Nr(c)})(),stageProgressLabel:Vj(t,i,a),flags:r,actionHandoff:Ih(t)}}const Kj={initial_loading:"Loading runs…",current:"Current",stale:"Stale data — retrying",offline:"Offline — retained data shown",auth_expired:"Authentication expired",connection_changed:"Connection changed — rebootstrap required",error:"Run data request failed"};function Fy(t){const i=[...t.live,...t.history].reduce((r,c)=>r+(c.availability==="available"?c.reportedRunningCalls:0),0);return{phaseLabel:Kj[t.phase],lastRefreshLabel:t.lastRefreshAtMs===null?"last refresh not loaded":`last refresh ${_n(new Date(t.lastRefreshAtMs).toISOString(),t.displayNowMs)}`,liveCountLabel:`${String(t.live.length)} reported live runs loaded`,historyCountLabel:`${String(t.history.length)} history runs loaded · page ${String(t.historyPage+1)}`,reportedRunningCallsLabel:`${String(i)} reported running calls · not a worker-health signal`,observedAgeLabel:t.lastRefreshAtMs===null||t.displayNowMs-t.lastRefreshAtMs<1e4?null:`observed ${_n(new Date(t.lastRefreshAtMs).toISOString(),t.displayNowMs)}`,live:t.live.map(r=>Zv(r,t.displayNowMs)),history:t.history.map(r=>Zv(r,t.displayNowMs))}}const Yy=new Set(["succeeded","failed","cancelled"]);function Vs(t){if(t===void 0)return null;const a=Date.parse(t);return Number.isFinite(a)?a:null}function Iu(t){return typeof t!="string"?null:/T(\d{2}:\d{2}:\d{2})/.exec(t)?.[1]??null}function Fa(t){const a=Math.max(0,t);return a<1e3?`${Math.round(a)}ms`:Nr(a)}function Dh(t){return t.length===0?"not reported":t.join(", ")}const Zj="CLI default",Fj="accepted value not recorded";function Fv(t,a){if(a?.state==="recorded")return a.value;const i=t!==void 0&&"applied"in t?t.applied:void 0;if(t!==void 0&&t.provenance!=="cli_default_unknown"){if(typeof i=="string")return i;if(i?.state==="recorded")return i.value}return a?.state==="accepted_unrepresentable"||typeof i=="object"&&i.state==="accepted_unrepresentable"?Fj:t?.provenance==="cli_default_unknown"?Zj:"not recorded"}function pd(t,a){return[Fv(t?.model,a?.model),Fv(t?.effort,a?.effort)]}const Yv=["model","effort"];function Xy(t,a){const i=pd(t,a);return[`${Yv[0]} ${i[0]}`,`${Yv[1]} ${i[1]}`]}function Du(t){if(t==null)return"not recorded";const a=`${t.cli_name??"not recorded"}/${t.role??"not recorded"}`,i=[t.model===void 0?null:`model ${t.model}`,t.effort===void 0?null:`effort ${t.effort}`].filter(r=>r!==null);return t.cli_name===void 0&&t.role===void 0&&i.length===0?"not recorded":i.length===0?a:`${a} · ${i.join(" · ")}`}function Yj(t){if(!(t==null||t.availability==="absent"))return t.effectiveDelegate}function Xj(t){return t===void 0?[]:[{label:"configured context curator",value:Du(t.curator)},{label:"configured context finalizer",value:Du(t.finalizer)}]}function Pj(t){const a=["curator","finalizer"].flatMap(i=>{const[r,c]=pd(t.audit[i]);return[{label:`${i} model`,value:r},{label:`${i} effort`,value:c}]});return{operationLabel:t.execution==="cache_source"?"cache hit — no delegate dispatched":"current source execution",sourceLabel:t.execution==="cache_source"?"historical/source execution audit":"current source execution audit",artifactRunId:t.artifactRunId,facts:a}}function Qj(t,a){const i=Vs(t.startedAt);if(i===null)return t.status==="pending"?"not started":"not reported";const r=Yy.has(t.status)?Vs(t.completedAt)??Vs(t.stateUpdatedAt):a;return r===null?"not reported":Fa(r-i)}function zu(t,a){if("durationMs"in t&&t.durationMs!==void 0)return Fa(t.durationMs);const i=Vs(t.startedAt);if(i===null)return t.state==="pending"?"not started":"not reported";const r=Vs(t.completedAt);return r!==null?Fa(r-i):t.state==="running"?Fa(a-i):"not reported"}function Py(t,a){return t.length>0?`Uses data from ${t.join(" + ")}`:a===0?"Entry stage":"No upstream data dependency"}function Xv(t,a,i){const r=Vs(a.startedAt);if(r===null)return null;const c=Vs(a.completedAt),f="durationMs"in a&&a.durationMs!==void 0?r+Math.max(0,a.durationMs):null,p=c??f??(a.state==="running"?i:null);return p===null||p<r?null:{id:t,state:a.state,startMs:r,endMs:p}}function Jj(t){const a=Math.max(0,Math.round(t/1e3)),i=Math.floor(a/3600),r=Math.floor(a%3600/60),c=a%60;return i>0?`+${i}:${String(r).padStart(2,"0")}:${String(c).padStart(2,"0")}`:`+${r}:${String(c).padStart(2,"0")}`}function Wj(t){const a=Math.max(1e3,t/3),r=[1e3,5e3,1e4,15e3,3e4,6e4,12e4,24e4,3e5,6e5,9e5,18e5,36e5,72e5,108e5,216e5,432e5,864e5,1728e5,2592e5,6048e5].reduce((v,m)=>Math.abs(m-a)<Math.abs(v-a)?m:v);if(Math.floor(t/r)+1<=6)return r;const c=t/5,f=10**Math.floor(Math.log10(c)),p=c/f;return(p<=1?1:p<=2?2:p<=5?5:10)*f}function eS(t,a,i){const r=new Map(a.availability==="available"?a.stages.map(T=>[T.stageId,T.dependsOn]):[]),c=t.stages.map((T,N)=>{const M=r.get(T.stageId)??[];return{stageId:T.stageId,stateLabel:T.state,dependsOn:M,dependencyLabel:a.availability==="available"?Py(M,N):null,stageBar:Xv(T.stageId,T,i),callBars:T.calls.flatMap(k=>{const z=Xv(k.callId,k,i);if(z===null)return[];const R=k.snapshotIdentity?.adapter??"adapter not reported",B=k.snapshotIdentity?.role??"role not reported";return[{bar:z,stageId:T.stageId,callId:k.callId,adapterLabel:R,roleLabel:B,durationLabel:zu(k,i),tooltipLabel:`member ${k.callId} · CLI ${R} · role ${B} · ${k.state} · ${zu(k,i)}`}]}),callCountLabel:T.state==="pending"||T.state==="cancelled"?`· ${T.calls.length}`:`${T.calls.filter(k=>k.state==="succeeded"||k.state==="failed").length}/${T.calls.length}`}}),f=c.flatMap(T=>[...T.stageBar===null?[]:[T.stageBar],...T.callBars.map(N=>N.bar)]);if(f.length===0)return null;const p=Vs(t.startedAt)??Math.min(...f.map(T=>T.startMs)),h=Math.max(...f.map(T=>T.endMs)),v=Math.max(0,h-p),m=Math.max(1,v*1.05),x=T=>({id:T.id,state:T.state,startPercent:(T.startMs-p)/m*100,widthPercent:(T.endMs-T.startMs)/m*100}),y=t.stages.reduce((T,N)=>T+N.calls.length,0),E=Zo(Cr(t))?Math.min(100,Math.max(0,(i-p)/m*100)):null,S=Wj(v),C=Array.from({length:Math.floor(v/S)+1},(T,N)=>{const M=N*S;return{label:Jj(M),positionPercent:M/m*100}});return{spanLabel:`span ${Fa(v)} · ${t.stages.length} stages · ${y} calls`,ticks:C,fanInPositions:c.map(T=>T.stageBar).filter(T=>T!==null).map(T=>(T.endMs-p)/m*100),livePositionPercent:E,stages:c.map(T=>({stageId:T.stageId,stateLabel:T.stateLabel,callCountLabel:T.callCountLabel,dependsOn:T.dependsOn,dependencyLabel:T.dependencyLabel,stageBar:T.stageBar===null?null:x(T.stageBar),callBars:T.callBars.map(N=>({...x(N.bar),stageId:N.stageId,callId:N.callId,adapterLabel:N.adapterLabel,roleLabel:N.roleLabel,durationLabel:N.durationLabel,tooltipLabel:N.tooltipLabel}))}))}}function tS(t,a){const i=[t.hasWorkflowInput?"workflow input persisted":null,t.hasOutput?"output persisted":null,t.hasRawError?"raw error persisted":null,t.hasArtifactReference?"artifact referenced":null].filter(f=>f!==null),[r,c]=Xy(t.invocation,t.observedInvocation);return{callId:t.callId,statusLabel:t.state,adapterLabel:t.snapshotIdentity?.adapter??null,modelLabel:r,effortLabel:c,retryLabel:t.retryCount===0?null:t.attemptsConsumed===void 0?`${t.retryCount} ${t.retryCount===1?"retry":"retries"}`:`attempt ${t.attemptsConsumed}`,timingLabel:zu(t,a),failureLabel:t.failureClass===void 0?null:`${t.failureClass} failure`,contentLabels:i}}function Pv(t,a){const i=Object.keys(a);return[{label:t,value:String(i.reduce((r,c)=>r+a[c],0))},...i.filter(r=>a[r]>0).map(r=>({label:`${t} ${r}`,value:String(a[r])}))]}function nS(t){return t.kind==="generic"?{kind:t.kind,title:"Persisted state counts",facts:[...Pv("stages",t.stageCounts),...Pv("calls",t.callCounts)]}:{kind:t.kind,title:"Plan-review transport facts",facts:[{label:"execution",value:t.executionStatus},{label:"seats",value:String(t.seatCount)},{label:"completed",value:String(t.completedSeats)},...t.failedSeats===0?[]:[{label:"failed",value:String(t.failedSeats)}],...t.missingSeats===0?[]:[{label:"missing",value:String(t.missingSeats)}],{label:"chairman",value:t.chairmanStatus},{label:"context",value:t.contextStatus},{label:"contract digest",value:t.executionContractDigestPrefix}]}}function aS(t){return t.availability==="available"?`${t.kind.replace("_"," ")} result available`:`result unavailable · ${t.reason.replaceAll("_"," ")}`}function sS(t){return typeof t!="object"||t===null||!("availability"in t)?{availability:"unavailable",reason:"invalid"}:t.availability==="available"&&"kind"in t&&["text","json","plan_review"].includes(String(t.kind))||t.availability==="unavailable"&&"reason"in t&&["run_pending","run_running","run_failed","run_cancelled","not_persisted","missing","invalid","too_large"].includes(String(t.reason))?t:{availability:"unavailable",reason:"invalid"}}function lS(t){return typeof t=="object"&&t!==null&&"availability"in t&&t.availability==="available"&&"stages"in t&&Array.isArray(t.stages)||typeof t=="object"&&t!==null&&"availability"in t&&t.availability==="unavailable"&&"reason"in t&&typeof t.reason=="string"?t:{availability:"unavailable",reason:"invalid"}}function iS(t){const a=t.card;return typeof a=="object"&&a!==null&&"kind"in a&&(a.kind==="generic"||a.kind==="council-plan-review")?a:{kind:"generic",stageCounts:t.stageCounts,callCounts:t.callCounts}}function rS(t,a){const i=Cr(t),r=Zo(i)||i==="unknown"?a:Vs(t.stateUpdatedAt)??a,c=lS(t.snapshotEnrichment),f=c.availability==="available"?new Map(c.stages.map(N=>[N.stageId,N])):new Map,p=c.availability==="available",h=sS(t.result),v=!Yy.has(t.status),m=Qj(t,r),x=Iu(t.startedAt),y=t.completedAt??t.stateUpdatedAt,E=Iu(y),S=[...x===null?t.startedAt===void 0?[]:[{label:"started",value:t.startedAt}]:[{label:"started",value:x}],{label:v?"elapsed":"duration",value:m},...v?[{label:"updated",value:_n(t.stateUpdatedAt,a)}]:E===null?[]:[{label:"finished",value:E}]],C=Ih(t),T=[{label:"started_at",value:t.startedAt??"not reported"},...t.completedAt===void 0?[]:[{label:"completed_at",value:t.completedAt}],{label:"last persisted update",value:t.stateUpdatedAt},{label:"resumable",value:t.resumable===!0?"yes":"no"},{label:"generation · state revision",value:`${t.runGeneration} · ${t.stateRevision}`},{label:"project folder",value:Dh(t.projectFolders)},...C===null?[]:[{label:"mcp tool handoff",value:C.text}]];return{runId:t.runId,workflowLabel:`${t.workflowName} · v${t.workflowVersion}`,statusLabel:i==="orphaned"?"orphaned":i==="unknown"?"worker unknown":t.status,statusState:i==="unknown"?"worker-unknown":i==="orphaned"?"orphaned":t.status,workerEvidenceLabel:i==="live"?"pid probe":i==="heartbeat_live"?"heartbeat":null,workerEvidenceDescription:i==="live"?"worker liveness from a local process probe":i==="heartbeat_live"?"worker liveness from a lock heartbeat refreshed within its declared freshness window, not a local process probe":null,isLive:v,elapsedLabel:m,startedLabel:t.startedAt??"not reported",updatedLabel:t.stateUpdatedAt,headerFacts:S,detailFacts:T,modeLabels:[...t.async?["async"]:[],...t.debugKeepArtifacts?["debug artifacts kept"]:[]],snapshotAvailable:p,snapshotLabel:p?"Graph derived from verified workflow snapshot":`Workflow snapshot unavailable · ${c.reason.replaceAll("_"," ")}`,timeline:eS(t,c,r),stages:t.stages.map((N,M)=>{const k=f.get(N.stageId),z=k?.dependsOn??[];return{stageId:N.stageId,label:k?.label??N.stageId,statusLabel:N.state,timingLabel:zu(N,r),dependsOn:z,sequenceLabel:`Stage ${String(M+1)} of ${String(t.stages.length)}`,dependencyLabel:p?Py(z,M):null,calls:N.calls.map(R=>tS(R,r))}}),decisiveFailureLabel:t.decisiveFailure===void 0?null:[t.decisiveFailure.stageId,t.decisiveFailure.callId,`${t.decisiveFailure.failureClass} failure`].filter(N=>N!==void 0).join(" · "),result:h,resultLabel:aS(h),card:nS(iS(t))}}const Qy={standalone:"standalone",refine:"refine",workflow_preflight:"workflow preflight",historical:"historical"};function oS(t,a){if(t.startedAt!==null&&t.completedAt!==null){const i=Math.max(0,Date.parse(t.completedAt)-Date.parse(t.startedAt));return`duration ${Lu(i)}`}return t.startedAt!==null?`started ${_n(t.startedAt,a)}`:t.completedAt!==null?`completed ${_n(t.completedAt,a)}`:t.durationMs!==null?`duration ${Lu(t.durationMs)}`:"timing not reported"}function zn(t){return t.replaceAll("_"," ")}function qu(t){return t===null?"":` · score ${t.toFixed(1)}`}function cS(t){const{coverage:a}=t;if(a.status==="not_evaluated")return"coverage not evaluated";const i=a.policy===null?"":` · ${a.policy}`;return`coverage ${a.status} ${String(a.selected)}/${String(a.required)}${i}`}function uS(t){const a=t.cache.write==="not_attempted"?"":` · write ${zn(t.cache.write)}`;return`cache ${zn(t.cache.lookup)}${a}`}function dS(t){return`curator ${zn(t.curator.status)}${qu(t.curator.score)} · finalizer ${zn(t.finalizer.status)}${qu(t.finalizer.score)}`}function fS(t){const a=(i,r)=>`${i} ${r.status==="succeeded"&&r.score!==null?r.score.toFixed(1):zn(r.status)}`;return`${a("curator",t.curator)} · ${a("finalizer",t.finalizer)}`}function pS(t){const{coverage:a}=t;return a.status==="satisfied"||a.status==="not_evaluated"?"":`coverage ${String(a.selected)}/${String(a.required)}`}function hS(t){return`cache ${zn(t.cache.lookup)}`}function mS(t){return t.durationMs===null?"":t.durationMs>=1e3?Nr(t.durationMs):`${String(t.durationMs)} ms`}function Qv(t){return t==="current"?null:t}function gS(t){return t.fallback.status==="not_applicable"||t.fallback.status==="not_used"?null:`fallback ${zn(t.fallback.status)}`}const _S=["all","orphaned","pending","running","succeeded","partial","failed","cancelled","unsupported"];function Jy(t){return t.lifecycle===null?"unsupported":t.orphaned||t.liveness==="orphaned"?"orphaned":t.lifecycle.status}function Jv(t,a){return a==="all"||Jy(t)===a}function Wy(t,a="workflow_preflight",i="workflow preflight",r=Date.now()){return{contextRunId:i,operationKindLabel:Qy[a],statusLabel:t.status,statusState:t.status,phaseLabel:zn(t.phase),coverageLabel:cS(t),coverageState:t.coverage.status,cacheLabel:uS(t),isCacheHit:t.cache.lookup==="hit",delegateLabel:dS(t),fallbackLabel:gS(t),delegateFootnote:fS(t),coverageFootnote:pS(t),cacheFootnote:hS(t),durationFootnote:mS(t),updatedAt:t.updatedAt??"not reported",timingLabel:oS(t,r),updatedAgeLabel:t.updatedAt===null?"not reported":_n(t.updatedAt,r),legacyUnsupported:!1,compatibilityLabel:"current",compatChip:null,artifactRunId:t.artifactRunId}}function zh(t,a){const i=Jy(t);if(t.lifecycle===null){const c=zn(t.compatibility);return{contextRunId:t.id,operationKindLabel:Qy[t.operationKind],statusLabel:"unsupported",statusState:i,phaseLabel:"lifecycle unavailable",coverageLabel:"coverage unavailable",coverageState:"not_available",cacheLabel:"cache unavailable",isCacheHit:!1,delegateLabel:"lifecycle unavailable",fallbackLabel:null,delegateFootnote:"",coverageFootnote:"",cacheFootnote:"cache unavailable",durationFootnote:"",updatedAt:"not reported",timingLabel:"timing not reported",updatedAgeLabel:"not reported",legacyUnsupported:!0,compatibilityLabel:c,compatChip:Qv(c),artifactRunId:null}}const r={...Wy(t.lifecycle,t.operationKind,t.id,a),statusLabel:i,statusState:i,compatibilityLabel:zn(t.compatibility)};return{...r,compatChip:Qv(r.compatibilityLabel)}}function Wv(t,a){const[i,r]=pd(a);return[{label:`${t} model`,value:i},{label:`${t} effort`,value:r}]}function vS(t,a=Date.now()){const i=zh(t,a),r=[{label:"route identity",value:t.id},{label:"identity domain",value:zn(t.source)},{label:"operation",value:i.operationKindLabel},{label:"compatibility",value:i.compatibilityLabel}],c=t.lifecycle;return c===null?{...i,identityFacts:r,lifecycleFacts:[],delegateFacts:[],cacheFacts:[],coverageFacts:[],countFacts:[],reasonCodes:[],legacyNotice:"This historical manifest has a forward-incompatible artifact set. No lifecycle was synthesized and no raw manifest content is exposed.",canViewArtifacts:!1}:(r.push({label:"artifact run id",value:c.artifactRunId??"none persisted"}),{...i,identityFacts:r,lifecycleFacts:[{label:"status",value:i.statusLabel},...i.statusState==="orphaned"?[{label:"persisted status",value:c.status}]:[],{label:"liveness",value:t.liveness},{label:"phase",value:i.phaseLabel},{label:"created",value:c.createdAt??"not reported"},{label:"updated",value:c.updatedAt??"not reported"},{label:"started",value:c.startedAt??"not started"},{label:"completed",value:c.completedAt??"not completed"},{label:"duration",value:c.durationMs===null?"not reported":`${String(c.durationMs)} ms`}],delegateFacts:[{label:"curator",value:`${zn(c.curator.status)}${qu(c.curator.score)}`},...Wv("curator",t.invocationAudit?.curator),{label:"finalizer",value:`${zn(c.finalizer.status)}${qu(c.finalizer.score)}`},...Wv("finalizer",t.invocationAudit?.finalizer)],cacheFacts:[{label:"lookup",value:zn(c.cache.lookup)},{label:"write",value:zn(c.cache.write)}],coverageFacts:[{label:"policy",value:c.coverage.policy??"none"},{label:"coverage",value:c.coverage.status},{label:"required",value:String(c.coverage.required)},{label:"selected",value:String(c.coverage.selected)},{label:"missing",value:String(c.coverage.missing)}],countFacts:[{label:"files seen",value:String(c.counts.filesSeen)},{label:"files considered",value:String(c.counts.filesConsidered)},{label:"files selected",value:String(c.counts.filesSelected)},{label:"files omitted",value:String(c.counts.filesOmitted)},{label:"search results",value:String(c.counts.searchResults)},{label:"bytes read",value:String(c.counts.bytesRead)},{label:"bytes written",value:String(c.counts.bytesWritten)}],reasonCodes:c.reasonCodes.map(zn),legacyNotice:null,canViewArtifacts:c.artifactRunId!==null})}const bS=new Set(["resolving","cache_lookup","validating","scanning","searching","selecting"]),yS=new Set(["writing","materializing","committing"]),fu=new Set(["not_configured","disabled","succeeded","failed","cancelled","skipped"]),eb=new Set(["running","succeeded","failed","cancelled"]);function qo(t){return t.status==="pending"?"pending":t.status==="running"?"running":t.status==="cancelled"?"cancelled":t.status==="failed"?"failed":"succeeded"}function xS(t){return bS.has(t.phase)?qo(t):t.phase!=="terminal"||eb.has(t.curator.status)||eb.has(t.finalizer.status)||wS(t)?"succeeded":qo(t)}function wS(t){return t.counts.filesSelected>0||t.counts.filesOmitted>0||t.coverage.status!=="not_evaluated"||t.reasonCodes.includes("empty_selection")||t.cache.lookup==="hit"||t.cache.write==="written"||ex(t)}function ex(t){return t.counts.bytesWritten>0||t.artifactRunId!==null}function jS(t){return t.phase==="complete"?"succeeded":t.phase==="terminal"?ex(t)?qo(t):"skipped":yS.has(t.phase)?qo(t):"pending"}function tb(t,a){return t.phase!=="terminal"?a:a==="pending"?"skipped":a==="running"?qo(t):a}function Nu(t){return t.replaceAll("_"," ")}function SS(t){return[{id:"discover",state:xS(t),score:null,knobLabel:null},{id:"curator",state:tb(t,t.curator.status),score:t.curator.score,knobLabel:`configured intent · ${Du(t.effectiveDelegate?.curator)}`},{id:"finalizer",state:tb(t,t.finalizer.status),score:t.finalizer.score,knobLabel:`configured intent · ${Du(t.effectiveDelegate?.finalizer)}`},{id:"materialize",state:jS(t),score:null,knobLabel:null}]}function ku(t){return t?.replaceAll("_"," ")??"not recorded"}function NS(t){return t===void 0?"not recorded":t?"yes":"no"}function kS({configuration:t}){return l.jsxs("dl",{className:"context-preflight__configuration","aria-label":"Preflight configuration",children:[l.jsxs("div",{children:[l.jsx("dt",{children:"profile"}),l.jsx("dd",{children:ku(t.profile)})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"effective mode"}),l.jsx("dd",{children:ku(t.effectiveMode)})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"on delegate failure"}),l.jsx("dd",{children:t.failurePolicy==="fail"?"fail closed":ku(t.failurePolicy)})]})]})}function AS(t){if(t.coverage.status==="not_evaluated")return"not evaluated for this profile";const a=t.coverage.missing===0?"":` · ${String(t.coverage.missing)} missing`;return`${t.coverage.status} · ${String(t.coverage.selected)}/${String(t.coverage.required)} obligations${a}`}function tx(t){return t.cache.lookup==="hit"?`${String(t.counts.filesSelected)} files restored`:`${String(t.counts.filesSelected)} of ${String(t.counts.filesConsidered)} files selected`}function RS(t){if(t.durationMs!==null)return t.durationMs;const a=Date.parse(t.createdAt??t.startedAt??""),i=!["pending","running"].includes(t.status),r=Date.parse((i?t.completedAt:null)??t.updatedAt??"");return!Number.isFinite(a)||!Number.isFinite(r)?null:Math.max(0,r-a)}const mh=new Set(["cache_disabled","cache_miss"]);function ES(t){const a=t.coverage.status==="not_evaluated"?"coverage not evaluated":`coverage ${String(t.coverage.selected)}/${String(t.coverage.required)}${t.coverage.missing===0?"":` · ${String(t.coverage.missing)} missing`}`,i=[tx(t),a,...t.cache.lookup==="hit"?["cache hit"]:[]],r=RS(t);r!==null&&i.push(Fa(r));const c=t.reasonCodes.filter(f=>!mh.has(f)).map(Nu);return c.length>0&&i.push(c.join(" · ")),i.join(" · ")}function Au({invocation:t}){if(t===void 0)return null;const a=Pj(t);return l.jsxs("section",{"aria-label":"Context preflight invocation evidence",className:"run-detail__snapshot-unavailable",children:[l.jsx("h4",{children:a.operationLabel}),l.jsxs("p",{children:[a.sourceLabel," · artifact run"," ",l.jsx("span",{className:"op-mono overflow-safe",children:a.artifactRunId})]}),l.jsx("dl",{className:"context-preflight__facts",children:a.facts.map(i=>l.jsxs("div",{children:[l.jsx("dt",{children:i.label}),l.jsx("dd",{children:i.value})]},i.label))}),l.jsx("p",{className:"context-preflight__note",children:"Value-only execution evidence · no argv or unavailable value bytes."})]})}function TS({preflight:t,invocation:a,onInspectSessionLog:i}){const[r,c]=b.useState(!1);if(t===null||t.availability==="absent")return l.jsxs(l.Fragment,{children:[l.jsxs("section",{className:"context-preflight","aria-labelledby":"run-preflight-title",role:"status",children:[l.jsx("header",{className:"context-preflight__header",children:l.jsx("h3",{id:"run-preflight-title",children:"Context preflight"})}),l.jsx("p",{className:"context-preflight__summary",children:"This run reported no context-builder preflight."})]}),l.jsx(Au,{invocation:a})]});if(t.availability==="legacy_without_telemetry")return l.jsxs("section",{className:"context-preflight","aria-labelledby":"run-preflight-title",children:[l.jsxs("header",{className:"context-preflight__header",children:[l.jsx("h3",{id:"run-preflight-title",children:"Context preflight"}),l.jsx("span",{className:"run-detail__status","data-state":t.status,children:t.status})]}),l.jsx("p",{className:"context-preflight__summary",role:"status",children:"Preflight completed, but this legacy run has no lifecycle telemetry."}),l.jsx(Au,{invocation:a})]});if(t.availability!=="current"){const p={bypassed:{label:"bypassed",state:"disabled",message:`Context preflight was bypassed by effective mode ${t.effectiveMode}.`},awaiting_telemetry:{label:"awaiting telemetry",state:"running",message:"Context preflight is awaiting lifecycle telemetry."},telemetry_unavailable:{label:"telemetry unavailable",state:"partial",message:"This run is terminal, but context preflight lifecycle telemetry is unavailable."}}[t.availability];return l.jsxs("section",{className:"context-preflight","aria-labelledby":"run-preflight-title",children:[l.jsxs("header",{className:"context-preflight__header",children:[l.jsx("h3",{id:"run-preflight-title",children:"Context preflight"}),l.jsx("span",{className:"run-detail__status","data-state":p.state,children:p.label})]}),l.jsx("p",{className:"context-preflight__summary",role:"status",children:p.message}),l.jsx(Au,{invocation:a})]})}const f=Wy(t);return l.jsxs("section",{className:"context-preflight","aria-labelledby":"run-preflight-title",children:[l.jsxs("header",{className:"context-preflight__header",children:[l.jsx("h3",{id:"run-preflight-title",children:"Context preflight"}),l.jsx("span",{className:"run-detail__status","data-state":f.statusState,children:f.statusLabel}),l.jsx("button",{"aria-expanded":r,className:"run-detail__fact-toggle",onClick:()=>c(p=>!p),type:"button",children:r?"[ collapse ]":"[ expand ]"})]}),l.jsx("p",{className:"context-preflight__summary",children:ES(t)}),l.jsx("div",{className:"context-preflight__detail",hidden:!r,children:l.jsx(CS,{invocation:a,preflight:t,view:f,...i===void 0?{}:{onInspectSessionLog:i}})})]})}function CS({invocation:t,preflight:a,view:i,onInspectSessionLog:r}){const c=SS(a),f=c.filter(h=>fu.has(h.state)).length,p=c.map(h=>`${h.id}: ${Nu(h.state)}${h.score===null?"":`, score ${h.score.toFixed(1)} out of 10`}`).join("; ");return l.jsxs(l.Fragment,{children:[l.jsx(kS,{configuration:a}),l.jsxs("div",{"aria-label":"Context preflight progress","aria-valuemax":c.length,"aria-valuemin":0,"aria-valuenow":f,"aria-valuetext":`${String(f)} of ${String(c.length)} milestones resolved · ${i.statusLabel}`,"aria-describedby":"context-preflight-milestone-summary",className:"context-preflight__stage-track",role:"progressbar",children:[l.jsx("span",{className:"visually-hidden",id:"context-preflight-milestone-summary",children:p}),l.jsx("div",{className:"context-preflight__stage-list","aria-hidden":"true",children:c.map((h,v)=>{const m=c[v+1],x=m!==void 0&&fu.has(h.state)&&fu.has(m.state),y=m?.state==="running"&&fu.has(h.state),E=h.state==="succeeded"?null:Nu(h.state),S=h.score===null?null:`${E===null?"":" · "}${h.score.toFixed(1)}/10`;return l.jsxs("div",{className:["context-preflight__stage",x?"context-preflight__stage--resolved-connector":"",y?"context-preflight__stage--live-connector":""].filter(Boolean).join(" "),title:h.knobLabel??void 0,children:[l.jsx("span",{className:`context-preflight__stage-dot context-preflight__stage-dot--${h.state}`,children:h.state==="failed"?"×":null}),l.jsxs("span",{className:"context-preflight__stage-label",children:[l.jsx("span",{children:h.id}),E===null&&S===null?null:l.jsxs("span",{className:"context-preflight__stage-state",children:[E,S]})]})]},h.id)})})]}),l.jsxs("dl",{className:"context-preflight__facts",children:[l.jsxs("div",{children:[l.jsx("dt",{children:"finalizer execution"}),l.jsx("dd",{children:ku(a.finalizerExecutionStatus)})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"effective enabled"}),l.jsx("dd",{children:NS(a.finalizerEffectiveEnabled)})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"selection"}),l.jsx("dd",{children:tx(a)})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"coverage"}),l.jsx("dd",{children:AS(a)})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"cache"}),l.jsx("dd",{children:i.cacheLabel})]}),["complete","terminal"].includes(a.phase)?null:l.jsxs("div",{children:[l.jsx("dt",{children:"current phase"}),l.jsx("dd",{children:i.phaseLabel})]}),i.artifactRunId===null?null:l.jsxs("div",{children:[l.jsx("dt",{children:"artifact run"}),l.jsx("dd",{className:"op-mono overflow-safe",children:i.artifactRunId})]}),i.fallbackLabel===null?null:l.jsxs("div",{children:[l.jsx("dt",{children:"fallback"}),l.jsx("dd",{children:i.fallbackLabel})]}),a.reasonCodes.filter(h=>!mh.has(h)).length===0?null:l.jsxs("div",{className:"context-preflight__fact--wide",children:[l.jsx("dt",{children:"reasons"}),l.jsx("dd",{children:a.reasonCodes.filter(h=>!mh.has(h)).map(Nu).join(" · ")})]})]}),l.jsx(Au,{invocation:t}),r===void 0?null:l.jsx("button",{"aria-label":"Inspect context preflight curator/finalizer session log",className:"run-detail__inspect context-preflight__log",onClick:r,title:"curator · finalizer session log",type:"button",children:"[ log ]"})]})}const OS=1400;function $S(t){const a=document.createElement("textarea");a.className="copy-fallback-input",a.value=t,a.setAttribute("readonly",""),document.body.append(a),a.select();try{return document.execCommand("copy")}catch{return!1}finally{a.remove()}}async function MS(t){try{if(navigator.clipboard)return await navigator.clipboard.writeText(t),!0}catch{}return $S(t)}function ma({label:t,text:a}){const[i,r]=b.useState("idle");b.useEffect(()=>{if(i!=="copied")return;const f=setTimeout(()=>r("idle"),OS);return()=>{clearTimeout(f)}},[i]);const c=i==="copied"?"copied ✓":i==="failed"?"copy failed; select the text":"[ copy ]";return l.jsxs("span",{className:"copy-control",children:[l.jsx("button",{"aria-label":t,className:"copy-control__button","data-copy-state":i,onClick:()=>{MS(a).then(f=>r(f?"copied":"failed"))},type:"button",children:c}),i==="idle"?null:l.jsx("span",{"aria-live":"polite",className:"copy-control__status",role:"status",children:i==="copied"?"Copied":"Copy failed; select the text"})]})}function yr({children:t}){return l.jsx("pre",{className:"selectable-content",tabIndex:0,children:t})}function qh({activeTabId:t,ariaLabel:a,onChange:i,tabs:r}){const c=b.useId(),f=b.useRef(new Map),p=Math.max(0,r.findIndex(x=>x.id===t)),h=r[p],v=x=>{const y=r[x];y&&(i(y.id),f.current.get(y.id)?.focus())},m=(x,y)=>{if(r.length===0)return;let E=null;x.key==="ArrowRight"?E=(y+1)%r.length:x.key==="ArrowLeft"?E=(y-1+r.length)%r.length:x.key==="Home"?E=0:x.key==="End"&&(E=r.length-1),E!==null&&(x.preventDefault(),v(E))};return l.jsxs("div",{className:"tab-list",children:[l.jsx("div",{"aria-label":a,className:"tab-list__tabs",role:"tablist",children:r.map((x,y)=>{const E=x.id===h?.id;return l.jsx("button",{"aria-controls":`${c}-${x.id}-panel`,"aria-selected":E,className:"tab-list__tab",id:`${c}-${x.id}-tab`,onClick:()=>i(x.id),onKeyDown:S=>m(S,y),ref:S=>{S?f.current.set(x.id,S):f.current.delete(x.id)},role:"tab",tabIndex:E?0:-1,type:"button",children:x.label},x.id)})}),r.map(x=>{const y=x.id===h?.id;return!y&&x.keepMounted!==!0?null:l.jsx("div",{"aria-labelledby":`${c}-${x.id}-tab`,className:"tab-list__panel",hidden:!y,id:`${c}-${x.id}-panel`,role:"tabpanel",tabIndex:y?0:-1,children:x.panel},x.id)})]})}const Uu="X-ClinkX-Agent-Instance-Id",Bu="X-ClinkX-Local-Origin-Proof",LS="dashboard-connection-v1",nx="clinkx-dashboard-connection-v1:",IS="clinkx-dashboard-local-origin-proof-v1:",gh="clinkx-dashboard-auth-expired",Dp=["v","apiOrigin","agentInstanceId","token"],hd=/^[A-Za-z0-9_-]{43}$/,ax=/^[A-Za-z0-9_-]{43}$/,Uo=/^[A-Za-z0-9_-]{22}$/;let Sn=null,Zn=null,Ya=0,Ys=!1,Us="bearer";const sx=new WeakMap;class bt extends Error{constructor(){super("connection_changed"),this.name="ConnectionChangedError"}}function cs(){return{mode:"local",apiOrigin:window.location.origin,uiOrigin:window.location.origin,agentInstanceId:null}}const DS=new Set(["127.0.0.1","localhost","[::1]"]);function Fo(t){if(t==null&&typeof window>"u")return!1;try{const a=new URL(t??window.location.origin);return a.protocol==="http:"&&DS.has(a.hostname)}catch{return!1}}function Gu(){return`${IS}${encodeURIComponent(window.location.origin)}`}function Uh(){if(!Fo())return null;try{const t=window.sessionStorage.getItem(Gu());if(t===null)return null;if(ax.test(t))return t;window.sessionStorage.removeItem(Gu())}catch{}return null}function zS(t){if(!Fo()||!ax.test(t))throw new Error("invalid local dashboard origin proof");window.sessionStorage.setItem(Gu(),t)}function ds(){try{window.sessionStorage.removeItem(Gu())}catch{}}function lx(t){return`${nx}${encodeURIComponent(t)}`}function Bh(t){try{const a=new URL(t);return a.protocol==="https:"&&a.username===""&&a.password===""&&a.pathname==="/"&&a.search===""&&a.hash===""&&a.origin===t}catch{return!1}}function qS(t){if(typeof t!="object"||t===null||Array.isArray(t))return!1;const a=t;return Object.keys(a).sort().join("\0")!==["agentInstanceId","apiOrigin","mode","uiOrigin"].sort().join("\0")||a.uiOrigin!==window.location.origin?!1:a.mode==="local"?a.apiOrigin===window.location.origin&&(a.agentInstanceId===null||typeof a.agentInstanceId=="string"&&Uo.test(a.agentInstanceId)):a.mode==="remote"&&typeof a.apiOrigin=="string"&&Bh(a.apiOrigin)&&typeof a.agentInstanceId=="string"&&Uo.test(a.agentInstanceId)}function US(t,a){try{const i=JSON.parse(t);if(typeof i!="object"||i===null||Array.isArray(i))return null;const r=i;if(Object.keys(r).sort().join("\0")!==["bearer","connection","schemaVersion"].sort().join("\0")||r.schemaVersion!=="dashboard-browser-authority-v1"||!qS(r.connection)||typeof r.bearer!="object"||r.bearer===null||Array.isArray(r.bearer))return null;const c=r.bearer;return Object.keys(c).join("\0")!=="token"||typeof c.token!="string"||!hd.test(c.token)||lx(r.connection.apiOrigin)!==a?null:i}catch{return null}}function ix(){const t=[];try{for(let a=0;a<window.sessionStorage.length;a+=1){const i=window.sessionStorage.key(a);i?.startsWith(nx)&&t.push(i)}}catch{return[]}return t}function Ml(){try{for(const t of ix())window.sessionStorage.removeItem(t)}catch{}}function rx(){if(Sn===null||Zn===null)return;const t={schemaVersion:"dashboard-browser-authority-v1",connection:Sn,bearer:Zn};try{Ml(),window.sessionStorage.setItem(lx(Sn.apiOrigin),JSON.stringify(t))}catch{}}function BS(){const t=[];try{for(const i of ix()){const r=window.sessionStorage.getItem(i),c=r===null?null:US(r,i);c===null?window.sessionStorage.removeItem(i):t.push(c)}}catch{return!1}if(t.length!==1)return t.length>1&&Ml(),!1;const a=t[0];return a===void 0?!1:(Sn=a.connection,Zn=a.bearer,Ya+=1,Ys=!1,!0)}function _h(t,a){Ml(),Sn=t,Zn={token:a},Ya+=1,Ys=!1,rx()}function GS(){window.history.replaceState(window.history.state,"",window.location.pathname+window.location.search)}function HS(t){const a=t.split("&");if(a.length!==Dp.length)return null;const i=[];for(let v=0;v<Dp.length;v+=1){const m=a[v],x=Dp[v];if(m===void 0||x===void 0)return null;const y=m.indexOf("=");if(y<=0||m.indexOf("=",y+1)!==-1||m.slice(0,y)!==x)return null;i.push(m.slice(y+1))}const[r,c,f,p]=i;if(r!=="1"||c===void 0||f===void 0||p===void 0||!Uo.test(f)||!hd.test(p))return null;let h;try{h=decodeURIComponent(c)}catch{return null}return encodeURIComponent(h)!==c||!Bh(h)?null:{apiOrigin:h,agentInstanceId:f,token:p}}function VS(t){if(!t.startsWith("token="))return null;const a=t.slice(6);return hd.test(a)?a:null}function li(){return{...Sn??cs(),authenticated:Zn!==null,revision:Ya,rebootstrapRequired:Ys}}function ox(){const t=window.location.hash;if(t!==""){const a=t.startsWith("#")?t.slice(1):t;GS();const i=HS(a);if(i!==null)return Bh(window.location.origin)?(_h({mode:"remote",apiOrigin:i.apiOrigin,uiOrigin:window.location.origin,agentInstanceId:i.agentInstanceId},i.token),li()):(Ml(),Sn=cs(),Zn=null,Ya+=1,Ys=!0,li());const r=VS(a);return r!==null?(_h(cs(),r),li()):(Ml(),Sn=cs(),Zn=null,Ya+=1,Ys=!0,li())}return(Sn===null||Zn===null)&&BS(),Sn===null&&(Sn=cs()),li()}function KS(){return Sn===null&&(Sn=cs()),li()}function ZS(t){const a=t.trim();return hd.test(a)?(_h(cs(),a),!0):!1}function FS(){return Zn!==null}function vh(){Zn!==null&&(Zn=null,Ya+=1,Ml())}function Hu(t){Us=t,t==="passkey"||t==="none"?(Zn=null,Ml(),Sn=cs(),Ys=!1,Ya+=1):ds()}function Io(){throw ds(),Zn=null,Ya+=1,Ys=!0,Ml(),new bt}function cx(t){if(Ys||t.revision!==Ya)throw new bt}function ux(t,a){cx(a);const i=t.headers.get(Uu);if(a.agentInstanceId===null){a.requireAgentInstanceHeader&&(i===null||!Uo.test(i))&&Io();return}i!==a.agentInstanceId&&Io()}function Hs(t){const a=sx.get(t);a!==void 0&&ux(t,a)}async function na(t){Hs(t);const a=await t.json();return Hs(t),a}async function Gh(t){Hs(t);const a=await t.text();return Hs(t),a}const YS=/^\/api\/progress-reports\/[A-Za-z0-9][A-Za-z0-9_-]{0,63}\/status-override$/,XS="/api/prompt-builder/library/save";function PS(t){return YS.test(t)||t===XS}function QS(t,a){let i;try{i=new URL(t,a)}catch{throw new Error("apiFetch only permits normalized /api/* paths")}if(!t.startsWith("/api/")||i.origin!==a||i.hash!==""||i.pathname+i.search!==t||!i.pathname.startsWith("/api/"))throw new Error("apiFetch only permits normalized /api/* paths");return i}async function dx(t,a){if(Sn===null&&ox(),Ys)throw new bt;const i=Sn??cs(),r=QS(t,i.apiOrigin),c={revision:Ya,agentInstanceId:Us==="bearer"?i.agentInstanceId:null,requireAgentInstanceHeader:Us==="bearer"&&t==="/api/connection"},f=new Headers(a.headers);Us==="passkey"||Zn===null?f.delete("Authorization"):f.set("Authorization",`Bearer ${Zn.token}`),Us==="bearer"&&i.mode==="remote"&&i.agentInstanceId!==null?f.set(Uu,i.agentInstanceId):f.delete(Uu);const p=Us==="passkey"?Uh():null;p===null?f.delete(Bu):f.set(Bu,p);let h;try{h=await fetch(r.href,{...a,method:a.method,headers:f,credentials:Us==="bearer"?"omit":"same-origin",redirect:"error",referrerPolicy:"no-referrer"})}catch(v){throw cx(c),v}return sx.set(h,c),ux(h,c),h.status===401&&(Us==="passkey"||Us==="none"?(ds(),window.dispatchEvent(new CustomEvent(gh))):vh()),h}async function hs(t,a){const i=(a?.method??"GET").toUpperCase();if(i!=="GET"&&i!=="HEAD")throw new Error("apiFetch only permits GET and HEAD requests");return dx(t,{...a,method:i})}async function fx(t,a){if(!PS(t))throw new Error("apiMutate only permits the progress-report status-override path or the prompt-builder library save path");return dx(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})}function JS(t){if(typeof t!="object"||t===null||Array.isArray(t))return null;const a=t;return Object.keys(a).sort().join("\0")!==["agentInstanceId","schemaVersion"].sort().join("\0")?null:a.schemaVersion===LS&&typeof a.agentInstanceId=="string"&&Uo.test(a.agentInstanceId)?a:null}async function px(){const t=await hs("/api/connection");if(t.status===401)throw new Error("dashboard authorization expired");if(!t.ok)return Io();const a=JS(await na(t)),i=t.headers.get(Uu);if(a===null||i!==a.agentInstanceId)return Io();const r=Sn??cs();return r.agentInstanceId!==null&&r.agentInstanceId!==a.agentInstanceId?Io():(r.agentInstanceId===null&&(Sn={...r,agentInstanceId:a.agentInstanceId},Ya+=1,rx()),li())}const WS=new Set(["unauthorized","not_found","run_generation_changed","run_state_changed","agent_instance_changed","content_too_large_for_dashboard"]),eN={input:"prompt",output:"output",error:"error",artifact:"artifact"};class Za extends Error{constructor(a,i,r){super(a),this.kind=a,this.status=i,this.code=r,this.name="InspectorApiError"}}function tN(t){return t??new AbortController().signal}async function nN(t){try{const a=await na(t);return typeof a.error?.code=="string"&&WS.has(a.error.code)?a.error.code:void 0}catch(a){if(a instanceof bt)throw new Za("connection_changed",409,"agent_instance_changed");return}}function aN(t=hs){return{async readPane(a,i){const r=tN(i),c=encodeURIComponent(a.runId),f=encodeURIComponent(a.stageId),p=encodeURIComponent(a.callId),h=encodeURIComponent(a.runGeneration),v=`/api/runs/${c}/stages/${f}/calls/${p}/${eN[a.kind]}?generation=${h}`;let m;try{m=await t(v,{signal:r})}catch(y){throw y instanceof bt?new Za("connection_changed",409,"agent_instance_changed"):r.aborted||y instanceof DOMException&&y.name==="AbortError"?new Za("aborted"):new Za("offline")}if(m.status===401)throw new Za("auth_expired",401,"unauthorized");if(!m.ok){const y=await nN(m);throw y==="agent_instance_changed"?new Za("connection_changed",m.status,y):new Za("request_error",m.status,y)}let x;try{x=await Gh(m)}catch(y){throw y instanceof bt?new Za("connection_changed",409,"agent_instance_changed"):y}return{content:x,etag:m.headers.get("ETag"),mediaType:m.headers.get("Content-Type")??"text/plain; charset=utf-8"}}}}const sN={input:"workflow input (pre-dispatch)",output:"final persisted output",error:"raw persisted error",artifact:"validated artifact"},lN={input:"input",output:"output",error:"error",artifact:"artifact"};function iN(t){return[["input",t.hasWorkflowInput],["output",t.hasOutput],["error",t.hasRawError],["artifact",t.hasArtifactReference]].filter(a=>a[1]).map(([a])=>({kind:a,label:sN[a]}))}function rN(t){return(t.state==="failed"||t.state==="cancelled")&&t.hasRawError&&!t.hasWorkflowInput&&!t.hasOutput&&!t.hasArtifactReference?`This ${t.state} call has only a raw persisted error; no workflow input, final output, or validated artifact is available.`:null}function oN(t){switch(t){case"content_too_large_for_dashboard":return"Content exceeds the dashboard cap.";case"not_found":return"Persisted content is missing or was pruned.";case"run_state_changed":case"obsolete_etag":return"Persisted state changed while this pane was loading. Retry this pane.";case"auth_expired":return"Dashboard authorization expired.";case"connection_changed":return"Dashboard connection changed; rebootstrap is required.";case"offline":return"Dashboard is offline. Retry this pane when the server is reachable.";case"request_error":return"Persisted content could not be loaded. Retry this pane."}}const cN={maxDepth:12,maxNodes:1e3};function uN(t,a){let i=Math.max(1,a.maxNodes),r=!1;const c=(f,p)=>{if(i<=0)return r=!0,"[node limit]";if(i-=1,f===null||typeof f!="object")return f;if(p>=Math.max(1,a.maxDepth))return r=!0,"[depth limit]";if(Array.isArray(f)){const v=[];for(let m=0;m<f.length;m+=1){if(i<=0){r=!0,v.push("[node limit]");break}v.push(c(f[m],p+1))}return v}const h={};for(const v in f)if(Object.prototype.hasOwnProperty.call(f,v)){if(i<=0){r=!0,h["[truncated]"]="[node limit]";break}h[v]=c(f[v],p+1)}return h};return{value:c(t,0),truncated:r}}function dN(t,a=cN){let i;try{i=JSON.parse(t)}catch{return{kind:"text",rendered:t,truncated:!1}}const r=uN(i,a);return{kind:"json",rendered:JSON.stringify(r.value,null,2),truncated:r.truncated}}function fN(t,a){return t.runId===a.runId&&t.runGeneration===a.runGeneration&&t.stateRevision===a.stateRevision}function _r(){let t=0,a=null;return{begin(i){a?.controller.abort();const r=new AbortController,c={...i,requestId:++t};return a={identity:c,controller:r},{identity:c,signal:r.signal}},isActive(i){return a!==null&&a.identity.requestId===i.requestId&&!a.controller.signal.aborted},accepts(i,r){return a!==null&&a.identity.requestId===i.requestId&&!a.controller.signal.aborted&&fN(i,r)},acceptsDetail(i,r){return a!==null&&a.identity.requestId===i.requestId&&!a.controller.signal.aborted&&i.runId===r.runId&&i.runGeneration===r.runGeneration},acceptsEtag(i,r){return a!==null&&a.identity.requestId===i.requestId&&!a.controller.signal.aborted&&r===`"${i.stateRevision}"`},cancel(){a?.controller.abort(),a=null}}}var pt;(function(t){t.assertEqual=c=>{};function a(c){}t.assertIs=a;function i(c){throw new Error}t.assertNever=i,t.arrayToEnum=c=>{const f={};for(const p of c)f[p]=p;return f},t.getValidEnumValues=c=>{const f=t.objectKeys(c).filter(h=>typeof c[c[h]]!="number"),p={};for(const h of f)p[h]=c[h];return t.objectValues(p)},t.objectValues=c=>t.objectKeys(c).map(function(f){return c[f]}),t.objectKeys=typeof Object.keys=="function"?c=>Object.keys(c):c=>{const f=[];for(const p in c)Object.prototype.hasOwnProperty.call(c,p)&&f.push(p);return f},t.find=(c,f)=>{for(const p of c)if(f(p))return p},t.isInteger=typeof Number.isInteger=="function"?c=>Number.isInteger(c):c=>typeof c=="number"&&Number.isFinite(c)&&Math.floor(c)===c;function r(c,f=" | "){return c.map(p=>typeof p=="string"?`'${p}'`:p).join(f)}t.joinValues=r,t.jsonStringifyReplacer=(c,f)=>typeof f=="bigint"?f.toString():f})(pt||(pt={}));var nb;(function(t){t.mergeShapes=(a,i)=>({...a,...i})})(nb||(nb={}));const Ce=pt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Al=t=>{switch(typeof t){case"undefined":return Ce.undefined;case"string":return Ce.string;case"number":return Number.isNaN(t)?Ce.nan:Ce.number;case"boolean":return Ce.boolean;case"function":return Ce.function;case"bigint":return Ce.bigint;case"symbol":return Ce.symbol;case"object":return Array.isArray(t)?Ce.array:t===null?Ce.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Ce.promise:typeof Map<"u"&&t instanceof Map?Ce.map:typeof Set<"u"&&t instanceof Set?Ce.set:typeof Date<"u"&&t instanceof Date?Ce.date:Ce.object;default:return Ce.unknown}},se=pt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Xs extends Error{get errors(){return this.issues}constructor(a){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const i=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,i):this.__proto__=i,this.name="ZodError",this.issues=a}format(a){const i=a||function(f){return f.message},r={_errors:[]},c=f=>{for(const p of f.issues)if(p.code==="invalid_union")p.unionErrors.map(c);else if(p.code==="invalid_return_type")c(p.returnTypeError);else if(p.code==="invalid_arguments")c(p.argumentsError);else if(p.path.length===0)r._errors.push(i(p));else{let h=r,v=0;for(;v<p.path.length;){const m=p.path[v];v===p.path.length-1?(h[m]=h[m]||{_errors:[]},h[m]._errors.push(i(p))):h[m]=h[m]||{_errors:[]},h=h[m],v++}}};return c(this),r}static assert(a){if(!(a instanceof Xs))throw new Error(`Not a ZodError: ${a}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,pt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(a=i=>i.message){const i={},r=[];for(const c of this.issues)if(c.path.length>0){const f=c.path[0];i[f]=i[f]||[],i[f].push(a(c))}else r.push(a(c));return{formErrors:r,fieldErrors:i}}get formErrors(){return this.flatten()}}Xs.create=t=>new Xs(t);const bh=(t,a)=>{let i;switch(t.code){case se.invalid_type:t.received===Ce.undefined?i="Required":i=`Expected ${t.expected}, received ${t.received}`;break;case se.invalid_literal:i=`Invalid literal value, expected ${JSON.stringify(t.expected,pt.jsonStringifyReplacer)}`;break;case se.unrecognized_keys:i=`Unrecognized key(s) in object: ${pt.joinValues(t.keys,", ")}`;break;case se.invalid_union:i="Invalid input";break;case se.invalid_union_discriminator:i=`Invalid discriminator value. Expected ${pt.joinValues(t.options)}`;break;case se.invalid_enum_value:i=`Invalid enum value. Expected ${pt.joinValues(t.options)}, received '${t.received}'`;break;case se.invalid_arguments:i="Invalid function arguments";break;case se.invalid_return_type:i="Invalid function return type";break;case se.invalid_date:i="Invalid date";break;case se.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(i=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(i=`${i} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?i=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?i=`Invalid input: must end with "${t.validation.endsWith}"`:pt.assertNever(t.validation):t.validation!=="regex"?i=`Invalid ${t.validation}`:i="Invalid";break;case se.too_small:t.type==="array"?i=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?i=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?i=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?i=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?i=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:i="Invalid input";break;case se.too_big:t.type==="array"?i=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?i=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?i=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?i=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?i=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:i="Invalid input";break;case se.custom:i="Invalid input";break;case se.invalid_intersection_types:i="Intersection results could not be merged";break;case se.not_multiple_of:i=`Number must be a multiple of ${t.multipleOf}`;break;case se.not_finite:i="Number must be finite";break;default:i=a.defaultError,pt.assertNever(t)}return{message:i}};let pN=bh;function hN(){return pN}const mN=t=>{const{data:a,path:i,errorMaps:r,issueData:c}=t,f=[...i,...c.path||[]],p={...c,path:f};if(c.message!==void 0)return{...c,path:f,message:c.message};let h="";const v=r.filter(m=>!!m).slice().reverse();for(const m of v)h=m(p,{data:a,defaultError:h}).message;return{...c,path:f,message:h}};function Ne(t,a){const i=hN(),r=mN({issueData:a,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,i,i===bh?void 0:bh].filter(c=>!!c)});t.common.issues.push(r)}class ga{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(a,i){const r=[];for(const c of i){if(c.status==="aborted")return Ge;c.status==="dirty"&&a.dirty(),r.push(c.value)}return{status:a.value,value:r}}static async mergeObjectAsync(a,i){const r=[];for(const c of i){const f=await c.key,p=await c.value;r.push({key:f,value:p})}return ga.mergeObjectSync(a,r)}static mergeObjectSync(a,i){const r={};for(const c of i){const{key:f,value:p}=c;if(f.status==="aborted"||p.status==="aborted")return Ge;f.status==="dirty"&&a.dirty(),p.status==="dirty"&&a.dirty(),f.value!=="__proto__"&&(typeof p.value<"u"||c.alwaysSet)&&(r[f.value]=p.value)}return{status:a.value,value:r}}}const Ge=Object.freeze({status:"aborted"}),Oo=t=>({status:"dirty",value:t}),La=t=>({status:"valid",value:t}),ab=t=>t.status==="aborted",sb=t=>t.status==="dirty",kr=t=>t.status==="valid",Vu=t=>typeof Promise<"u"&&t instanceof Promise;var Ie;(function(t){t.errToObj=a=>typeof a=="string"?{message:a}:a||{},t.toString=a=>typeof a=="string"?a:a?.message})(Ie||(Ie={}));class Ll{constructor(a,i,r,c){this._cachedPath=[],this.parent=a,this.data=i,this._path=r,this._key=c}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const lb=(t,a)=>{if(kr(a))return{success:!0,data:a.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const i=new Xs(t.common.issues);return this._error=i,this._error}}};function We(t){if(!t)return{};const{errorMap:a,invalid_type_error:i,required_error:r,description:c}=t;if(a&&(i||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return a?{errorMap:a,description:c}:{errorMap:(p,h)=>{const{message:v}=t;return p.code==="invalid_enum_value"?{message:v??h.defaultError}:typeof h.data>"u"?{message:v??r??h.defaultError}:p.code!=="invalid_type"?{message:h.defaultError}:{message:v??i??h.defaultError}},description:c}}class ct{get description(){return this._def.description}_getType(a){return Al(a.data)}_getOrReturnCtx(a,i){return i||{common:a.parent.common,data:a.data,parsedType:Al(a.data),schemaErrorMap:this._def.errorMap,path:a.path,parent:a.parent}}_processInputParams(a){return{status:new ga,ctx:{common:a.parent.common,data:a.data,parsedType:Al(a.data),schemaErrorMap:this._def.errorMap,path:a.path,parent:a.parent}}}_parseSync(a){const i=this._parse(a);if(Vu(i))throw new Error("Synchronous parse encountered promise.");return i}_parseAsync(a){const i=this._parse(a);return Promise.resolve(i)}parse(a,i){const r=this.safeParse(a,i);if(r.success)return r.data;throw r.error}safeParse(a,i){const r={common:{issues:[],async:i?.async??!1,contextualErrorMap:i?.errorMap},path:i?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:a,parsedType:Al(a)},c=this._parseSync({data:a,path:r.path,parent:r});return lb(r,c)}"~validate"(a){const i={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:a,parsedType:Al(a)};if(!this["~standard"].async)try{const r=this._parseSync({data:a,path:[],parent:i});return kr(r)?{value:r.value}:{issues:i.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),i.common={issues:[],async:!0}}return this._parseAsync({data:a,path:[],parent:i}).then(r=>kr(r)?{value:r.value}:{issues:i.common.issues})}async parseAsync(a,i){const r=await this.safeParseAsync(a,i);if(r.success)return r.data;throw r.error}async safeParseAsync(a,i){const r={common:{issues:[],contextualErrorMap:i?.errorMap,async:!0},path:i?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:a,parsedType:Al(a)},c=this._parse({data:a,path:r.path,parent:r}),f=await(Vu(c)?c:Promise.resolve(c));return lb(r,f)}refine(a,i){const r=c=>typeof i=="string"||typeof i>"u"?{message:i}:typeof i=="function"?i(c):i;return this._refinement((c,f)=>{const p=a(c),h=()=>f.addIssue({code:se.custom,...r(c)});return typeof Promise<"u"&&p instanceof Promise?p.then(v=>v?!0:(h(),!1)):p?!0:(h(),!1)})}refinement(a,i){return this._refinement((r,c)=>a(r)?!0:(c.addIssue(typeof i=="function"?i(r,c):i),!1))}_refinement(a){return new pi({schema:this,typeName:He.ZodEffects,effect:{type:"refinement",refinement:a}})}superRefine(a){return this._refinement(a)}constructor(a){this.spa=this.safeParseAsync,this._def=a,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:i=>this["~validate"](i)}}optional(){return Ks.create(this,this._def)}nullable(){return hi.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return fs.create(this)}promise(){return Xu.create(this,this._def)}or(a){return Zu.create([this,a],this._def)}and(a){return Fu.create(this,a,this._def)}transform(a){return new pi({...We(this._def),schema:this,typeName:He.ZodEffects,effect:{type:"transform",transform:a}})}default(a){const i=typeof a=="function"?a:()=>a;return new Pu({...We(this._def),innerType:this,defaultValue:i,typeName:He.ZodDefault})}brand(){return new _x({typeName:He.ZodBranded,type:this,...We(this._def)})}catch(a){const i=typeof a=="function"?a:()=>a;return new Qu({...We(this._def),innerType:this,catchValue:i,typeName:He.ZodCatch})}describe(a){const i=this.constructor;return new i({...this._def,description:a})}pipe(a){return Vh.create(this,a)}readonly(){return Ju.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const gN=/^c[^\s-]{8,}$/i,_N=/^[0-9a-z]+$/,vN=/^[0-9A-HJKMNP-TV-Z]{26}$/i,bN=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,yN=/^[a-z0-9_-]{21}$/i,xN=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,wN=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,jN=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,SN="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let zp;const NN=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,kN=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,AN=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,RN=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,EN=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,TN=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,hx="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",CN=new RegExp(`^${hx}$`);function mx(t){let a="[0-5]\\d";t.precision?a=`${a}\\.\\d{${t.precision}}`:t.precision==null&&(a=`${a}(\\.\\d+)?`);const i=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${a})${i}`}function ON(t){return new RegExp(`^${mx(t)}$`)}function $N(t){let a=`${hx}T${mx(t)}`;const i=[];return i.push(t.local?"Z?":"Z"),t.offset&&i.push("([+-]\\d{2}:?\\d{2})"),a=`${a}(${i.join("|")})`,new RegExp(`^${a}$`)}function MN(t,a){return!!((a==="v4"||!a)&&NN.test(t)||(a==="v6"||!a)&&AN.test(t))}function LN(t,a){if(!xN.test(t))return!1;try{const[i]=t.split(".");if(!i)return!1;const r=i.replace(/-/g,"+").replace(/_/g,"/").padEnd(i.length+(4-i.length%4)%4,"="),c=JSON.parse(atob(r));return!(typeof c!="object"||c===null||"typ"in c&&c?.typ!=="JWT"||!c.alg||a&&c.alg!==a)}catch{return!1}}function IN(t,a){return!!((a==="v4"||!a)&&kN.test(t)||(a==="v6"||!a)&&RN.test(t))}class Ol extends ct{_parse(a){if(this._def.coerce&&(a.data=String(a.data)),this._getType(a)!==Ce.string){const f=this._getOrReturnCtx(a);return Ne(f,{code:se.invalid_type,expected:Ce.string,received:f.parsedType}),Ge}const r=new ga;let c;for(const f of this._def.checks)if(f.kind==="min")a.data.length<f.value&&(c=this._getOrReturnCtx(a,c),Ne(c,{code:se.too_small,minimum:f.value,type:"string",inclusive:!0,exact:!1,message:f.message}),r.dirty());else if(f.kind==="max")a.data.length>f.value&&(c=this._getOrReturnCtx(a,c),Ne(c,{code:se.too_big,maximum:f.value,type:"string",inclusive:!0,exact:!1,message:f.message}),r.dirty());else if(f.kind==="length"){const p=a.data.length>f.value,h=a.data.length<f.value;(p||h)&&(c=this._getOrReturnCtx(a,c),p?Ne(c,{code:se.too_big,maximum:f.value,type:"string",inclusive:!0,exact:!0,message:f.message}):h&&Ne(c,{code:se.too_small,minimum:f.value,type:"string",inclusive:!0,exact:!0,message:f.message}),r.dirty())}else if(f.kind==="email")jN.test(a.data)||(c=this._getOrReturnCtx(a,c),Ne(c,{validation:"email",code:se.invalid_string,message:f.message}),r.dirty());else if(f.kind==="emoji")zp||(zp=new RegExp(SN,"u")),zp.test(a.data)||(c=this._getOrReturnCtx(a,c),Ne(c,{validation:"emoji",code:se.invalid_string,message:f.message}),r.dirty());else if(f.kind==="uuid")bN.test(a.data)||(c=this._getOrReturnCtx(a,c),Ne(c,{validation:"uuid",code:se.invalid_string,message:f.message}),r.dirty());else if(f.kind==="nanoid")yN.test(a.data)||(c=this._getOrReturnCtx(a,c),Ne(c,{validation:"nanoid",code:se.invalid_string,message:f.message}),r.dirty());else if(f.kind==="cuid")gN.test(a.data)||(c=this._getOrReturnCtx(a,c),Ne(c,{validation:"cuid",code:se.invalid_string,message:f.message}),r.dirty());else if(f.kind==="cuid2")_N.test(a.data)||(c=this._getOrReturnCtx(a,c),Ne(c,{validation:"cuid2",code:se.invalid_string,message:f.message}),r.dirty());else if(f.kind==="ulid")vN.test(a.data)||(c=this._getOrReturnCtx(a,c),Ne(c,{validation:"ulid",code:se.invalid_string,message:f.message}),r.dirty());else if(f.kind==="url")try{new URL(a.data)}catch{c=this._getOrReturnCtx(a,c),Ne(c,{validation:"url",code:se.invalid_string,message:f.message}),r.dirty()}else f.kind==="regex"?(f.regex.lastIndex=0,f.regex.test(a.data)||(c=this._getOrReturnCtx(a,c),Ne(c,{validation:"regex",code:se.invalid_string,message:f.message}),r.dirty())):f.kind==="trim"?a.data=a.data.trim():f.kind==="includes"?a.data.includes(f.value,f.position)||(c=this._getOrReturnCtx(a,c),Ne(c,{code:se.invalid_string,validation:{includes:f.value,position:f.position},message:f.message}),r.dirty()):f.kind==="toLowerCase"?a.data=a.data.toLowerCase():f.kind==="toUpperCase"?a.data=a.data.toUpperCase():f.kind==="startsWith"?a.data.startsWith(f.value)||(c=this._getOrReturnCtx(a,c),Ne(c,{code:se.invalid_string,validation:{startsWith:f.value},message:f.message}),r.dirty()):f.kind==="endsWith"?a.data.endsWith(f.value)||(c=this._getOrReturnCtx(a,c),Ne(c,{code:se.invalid_string,validation:{endsWith:f.value},message:f.message}),r.dirty()):f.kind==="datetime"?$N(f).test(a.data)||(c=this._getOrReturnCtx(a,c),Ne(c,{code:se.invalid_string,validation:"datetime",message:f.message}),r.dirty()):f.kind==="date"?CN.test(a.data)||(c=this._getOrReturnCtx(a,c),Ne(c,{code:se.invalid_string,validation:"date",message:f.message}),r.dirty()):f.kind==="time"?ON(f).test(a.data)||(c=this._getOrReturnCtx(a,c),Ne(c,{code:se.invalid_string,validation:"time",message:f.message}),r.dirty()):f.kind==="duration"?wN.test(a.data)||(c=this._getOrReturnCtx(a,c),Ne(c,{validation:"duration",code:se.invalid_string,message:f.message}),r.dirty()):f.kind==="ip"?MN(a.data,f.version)||(c=this._getOrReturnCtx(a,c),Ne(c,{validation:"ip",code:se.invalid_string,message:f.message}),r.dirty()):f.kind==="jwt"?LN(a.data,f.alg)||(c=this._getOrReturnCtx(a,c),Ne(c,{validation:"jwt",code:se.invalid_string,message:f.message}),r.dirty()):f.kind==="cidr"?IN(a.data,f.version)||(c=this._getOrReturnCtx(a,c),Ne(c,{validation:"cidr",code:se.invalid_string,message:f.message}),r.dirty()):f.kind==="base64"?EN.test(a.data)||(c=this._getOrReturnCtx(a,c),Ne(c,{validation:"base64",code:se.invalid_string,message:f.message}),r.dirty()):f.kind==="base64url"?TN.test(a.data)||(c=this._getOrReturnCtx(a,c),Ne(c,{validation:"base64url",code:se.invalid_string,message:f.message}),r.dirty()):pt.assertNever(f);return{status:r.value,value:a.data}}_regex(a,i,r){return this.refinement(c=>a.test(c),{validation:i,code:se.invalid_string,...Ie.errToObj(r)})}_addCheck(a){return new Ol({...this._def,checks:[...this._def.checks,a]})}email(a){return this._addCheck({kind:"email",...Ie.errToObj(a)})}url(a){return this._addCheck({kind:"url",...Ie.errToObj(a)})}emoji(a){return this._addCheck({kind:"emoji",...Ie.errToObj(a)})}uuid(a){return this._addCheck({kind:"uuid",...Ie.errToObj(a)})}nanoid(a){return this._addCheck({kind:"nanoid",...Ie.errToObj(a)})}cuid(a){return this._addCheck({kind:"cuid",...Ie.errToObj(a)})}cuid2(a){return this._addCheck({kind:"cuid2",...Ie.errToObj(a)})}ulid(a){return this._addCheck({kind:"ulid",...Ie.errToObj(a)})}base64(a){return this._addCheck({kind:"base64",...Ie.errToObj(a)})}base64url(a){return this._addCheck({kind:"base64url",...Ie.errToObj(a)})}jwt(a){return this._addCheck({kind:"jwt",...Ie.errToObj(a)})}ip(a){return this._addCheck({kind:"ip",...Ie.errToObj(a)})}cidr(a){return this._addCheck({kind:"cidr",...Ie.errToObj(a)})}datetime(a){return typeof a=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:a}):this._addCheck({kind:"datetime",precision:typeof a?.precision>"u"?null:a?.precision,offset:a?.offset??!1,local:a?.local??!1,...Ie.errToObj(a?.message)})}date(a){return this._addCheck({kind:"date",message:a})}time(a){return typeof a=="string"?this._addCheck({kind:"time",precision:null,message:a}):this._addCheck({kind:"time",precision:typeof a?.precision>"u"?null:a?.precision,...Ie.errToObj(a?.message)})}duration(a){return this._addCheck({kind:"duration",...Ie.errToObj(a)})}regex(a,i){return this._addCheck({kind:"regex",regex:a,...Ie.errToObj(i)})}includes(a,i){return this._addCheck({kind:"includes",value:a,position:i?.position,...Ie.errToObj(i?.message)})}startsWith(a,i){return this._addCheck({kind:"startsWith",value:a,...Ie.errToObj(i)})}endsWith(a,i){return this._addCheck({kind:"endsWith",value:a,...Ie.errToObj(i)})}min(a,i){return this._addCheck({kind:"min",value:a,...Ie.errToObj(i)})}max(a,i){return this._addCheck({kind:"max",value:a,...Ie.errToObj(i)})}length(a,i){return this._addCheck({kind:"length",value:a,...Ie.errToObj(i)})}nonempty(a){return this.min(1,Ie.errToObj(a))}trim(){return new Ol({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ol({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ol({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(a=>a.kind==="datetime")}get isDate(){return!!this._def.checks.find(a=>a.kind==="date")}get isTime(){return!!this._def.checks.find(a=>a.kind==="time")}get isDuration(){return!!this._def.checks.find(a=>a.kind==="duration")}get isEmail(){return!!this._def.checks.find(a=>a.kind==="email")}get isURL(){return!!this._def.checks.find(a=>a.kind==="url")}get isEmoji(){return!!this._def.checks.find(a=>a.kind==="emoji")}get isUUID(){return!!this._def.checks.find(a=>a.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(a=>a.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(a=>a.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(a=>a.kind==="cuid2")}get isULID(){return!!this._def.checks.find(a=>a.kind==="ulid")}get isIP(){return!!this._def.checks.find(a=>a.kind==="ip")}get isCIDR(){return!!this._def.checks.find(a=>a.kind==="cidr")}get isBase64(){return!!this._def.checks.find(a=>a.kind==="base64")}get isBase64url(){return!!this._def.checks.find(a=>a.kind==="base64url")}get minLength(){let a=null;for(const i of this._def.checks)i.kind==="min"&&(a===null||i.value>a)&&(a=i.value);return a}get maxLength(){let a=null;for(const i of this._def.checks)i.kind==="max"&&(a===null||i.value<a)&&(a=i.value);return a}}Ol.create=t=>new Ol({checks:[],typeName:He.ZodString,coerce:t?.coerce??!1,...We(t)});function DN(t,a){const i=(t.toString().split(".")[1]||"").length,r=(a.toString().split(".")[1]||"").length,c=i>r?i:r,f=Number.parseInt(t.toFixed(c).replace(".","")),p=Number.parseInt(a.toFixed(c).replace(".",""));return f%p/10**c}class Ar extends ct{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(a){if(this._def.coerce&&(a.data=Number(a.data)),this._getType(a)!==Ce.number){const f=this._getOrReturnCtx(a);return Ne(f,{code:se.invalid_type,expected:Ce.number,received:f.parsedType}),Ge}let r;const c=new ga;for(const f of this._def.checks)f.kind==="int"?pt.isInteger(a.data)||(r=this._getOrReturnCtx(a,r),Ne(r,{code:se.invalid_type,expected:"integer",received:"float",message:f.message}),c.dirty()):f.kind==="min"?(f.inclusive?a.data<f.value:a.data<=f.value)&&(r=this._getOrReturnCtx(a,r),Ne(r,{code:se.too_small,minimum:f.value,type:"number",inclusive:f.inclusive,exact:!1,message:f.message}),c.dirty()):f.kind==="max"?(f.inclusive?a.data>f.value:a.data>=f.value)&&(r=this._getOrReturnCtx(a,r),Ne(r,{code:se.too_big,maximum:f.value,type:"number",inclusive:f.inclusive,exact:!1,message:f.message}),c.dirty()):f.kind==="multipleOf"?DN(a.data,f.value)!==0&&(r=this._getOrReturnCtx(a,r),Ne(r,{code:se.not_multiple_of,multipleOf:f.value,message:f.message}),c.dirty()):f.kind==="finite"?Number.isFinite(a.data)||(r=this._getOrReturnCtx(a,r),Ne(r,{code:se.not_finite,message:f.message}),c.dirty()):pt.assertNever(f);return{status:c.value,value:a.data}}gte(a,i){return this.setLimit("min",a,!0,Ie.toString(i))}gt(a,i){return this.setLimit("min",a,!1,Ie.toString(i))}lte(a,i){return this.setLimit("max",a,!0,Ie.toString(i))}lt(a,i){return this.setLimit("max",a,!1,Ie.toString(i))}setLimit(a,i,r,c){return new Ar({...this._def,checks:[...this._def.checks,{kind:a,value:i,inclusive:r,message:Ie.toString(c)}]})}_addCheck(a){return new Ar({...this._def,checks:[...this._def.checks,a]})}int(a){return this._addCheck({kind:"int",message:Ie.toString(a)})}positive(a){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ie.toString(a)})}negative(a){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ie.toString(a)})}nonpositive(a){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ie.toString(a)})}nonnegative(a){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ie.toString(a)})}multipleOf(a,i){return this._addCheck({kind:"multipleOf",value:a,message:Ie.toString(i)})}finite(a){return this._addCheck({kind:"finite",message:Ie.toString(a)})}safe(a){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ie.toString(a)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ie.toString(a)})}get minValue(){let a=null;for(const i of this._def.checks)i.kind==="min"&&(a===null||i.value>a)&&(a=i.value);return a}get maxValue(){let a=null;for(const i of this._def.checks)i.kind==="max"&&(a===null||i.value<a)&&(a=i.value);return a}get isInt(){return!!this._def.checks.find(a=>a.kind==="int"||a.kind==="multipleOf"&&pt.isInteger(a.value))}get isFinite(){let a=null,i=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(i===null||r.value>i)&&(i=r.value):r.kind==="max"&&(a===null||r.value<a)&&(a=r.value)}return Number.isFinite(i)&&Number.isFinite(a)}}Ar.create=t=>new Ar({checks:[],typeName:He.ZodNumber,coerce:t?.coerce||!1,...We(t)});class Bo extends ct{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(a){if(this._def.coerce)try{a.data=BigInt(a.data)}catch{return this._getInvalidInput(a)}if(this._getType(a)!==Ce.bigint)return this._getInvalidInput(a);let r;const c=new ga;for(const f of this._def.checks)f.kind==="min"?(f.inclusive?a.data<f.value:a.data<=f.value)&&(r=this._getOrReturnCtx(a,r),Ne(r,{code:se.too_small,type:"bigint",minimum:f.value,inclusive:f.inclusive,message:f.message}),c.dirty()):f.kind==="max"?(f.inclusive?a.data>f.value:a.data>=f.value)&&(r=this._getOrReturnCtx(a,r),Ne(r,{code:se.too_big,type:"bigint",maximum:f.value,inclusive:f.inclusive,message:f.message}),c.dirty()):f.kind==="multipleOf"?a.data%f.value!==BigInt(0)&&(r=this._getOrReturnCtx(a,r),Ne(r,{code:se.not_multiple_of,multipleOf:f.value,message:f.message}),c.dirty()):pt.assertNever(f);return{status:c.value,value:a.data}}_getInvalidInput(a){const i=this._getOrReturnCtx(a);return Ne(i,{code:se.invalid_type,expected:Ce.bigint,received:i.parsedType}),Ge}gte(a,i){return this.setLimit("min",a,!0,Ie.toString(i))}gt(a,i){return this.setLimit("min",a,!1,Ie.toString(i))}lte(a,i){return this.setLimit("max",a,!0,Ie.toString(i))}lt(a,i){return this.setLimit("max",a,!1,Ie.toString(i))}setLimit(a,i,r,c){return new Bo({...this._def,checks:[...this._def.checks,{kind:a,value:i,inclusive:r,message:Ie.toString(c)}]})}_addCheck(a){return new Bo({...this._def,checks:[...this._def.checks,a]})}positive(a){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ie.toString(a)})}negative(a){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ie.toString(a)})}nonpositive(a){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ie.toString(a)})}nonnegative(a){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ie.toString(a)})}multipleOf(a,i){return this._addCheck({kind:"multipleOf",value:a,message:Ie.toString(i)})}get minValue(){let a=null;for(const i of this._def.checks)i.kind==="min"&&(a===null||i.value>a)&&(a=i.value);return a}get maxValue(){let a=null;for(const i of this._def.checks)i.kind==="max"&&(a===null||i.value<a)&&(a=i.value);return a}}Bo.create=t=>new Bo({checks:[],typeName:He.ZodBigInt,coerce:t?.coerce??!1,...We(t)});class yh extends ct{_parse(a){if(this._def.coerce&&(a.data=!!a.data),this._getType(a)!==Ce.boolean){const r=this._getOrReturnCtx(a);return Ne(r,{code:se.invalid_type,expected:Ce.boolean,received:r.parsedType}),Ge}return La(a.data)}}yh.create=t=>new yh({typeName:He.ZodBoolean,coerce:t?.coerce||!1,...We(t)});class Ku extends ct{_parse(a){if(this._def.coerce&&(a.data=new Date(a.data)),this._getType(a)!==Ce.date){const f=this._getOrReturnCtx(a);return Ne(f,{code:se.invalid_type,expected:Ce.date,received:f.parsedType}),Ge}if(Number.isNaN(a.data.getTime())){const f=this._getOrReturnCtx(a);return Ne(f,{code:se.invalid_date}),Ge}const r=new ga;let c;for(const f of this._def.checks)f.kind==="min"?a.data.getTime()<f.value&&(c=this._getOrReturnCtx(a,c),Ne(c,{code:se.too_small,message:f.message,inclusive:!0,exact:!1,minimum:f.value,type:"date"}),r.dirty()):f.kind==="max"?a.data.getTime()>f.value&&(c=this._getOrReturnCtx(a,c),Ne(c,{code:se.too_big,message:f.message,inclusive:!0,exact:!1,maximum:f.value,type:"date"}),r.dirty()):pt.assertNever(f);return{status:r.value,value:new Date(a.data.getTime())}}_addCheck(a){return new Ku({...this._def,checks:[...this._def.checks,a]})}min(a,i){return this._addCheck({kind:"min",value:a.getTime(),message:Ie.toString(i)})}max(a,i){return this._addCheck({kind:"max",value:a.getTime(),message:Ie.toString(i)})}get minDate(){let a=null;for(const i of this._def.checks)i.kind==="min"&&(a===null||i.value>a)&&(a=i.value);return a!=null?new Date(a):null}get maxDate(){let a=null;for(const i of this._def.checks)i.kind==="max"&&(a===null||i.value<a)&&(a=i.value);return a!=null?new Date(a):null}}Ku.create=t=>new Ku({checks:[],coerce:t?.coerce||!1,typeName:He.ZodDate,...We(t)});class ib extends ct{_parse(a){if(this._getType(a)!==Ce.symbol){const r=this._getOrReturnCtx(a);return Ne(r,{code:se.invalid_type,expected:Ce.symbol,received:r.parsedType}),Ge}return La(a.data)}}ib.create=t=>new ib({typeName:He.ZodSymbol,...We(t)});class xh extends ct{_parse(a){if(this._getType(a)!==Ce.undefined){const r=this._getOrReturnCtx(a);return Ne(r,{code:se.invalid_type,expected:Ce.undefined,received:r.parsedType}),Ge}return La(a.data)}}xh.create=t=>new xh({typeName:He.ZodUndefined,...We(t)});class wh extends ct{_parse(a){if(this._getType(a)!==Ce.null){const r=this._getOrReturnCtx(a);return Ne(r,{code:se.invalid_type,expected:Ce.null,received:r.parsedType}),Ge}return La(a.data)}}wh.create=t=>new wh({typeName:He.ZodNull,...We(t)});class rb extends ct{constructor(){super(...arguments),this._any=!0}_parse(a){return La(a.data)}}rb.create=t=>new rb({typeName:He.ZodAny,...We(t)});class ob extends ct{constructor(){super(...arguments),this._unknown=!0}_parse(a){return La(a.data)}}ob.create=t=>new ob({typeName:He.ZodUnknown,...We(t)});class Il extends ct{_parse(a){const i=this._getOrReturnCtx(a);return Ne(i,{code:se.invalid_type,expected:Ce.never,received:i.parsedType}),Ge}}Il.create=t=>new Il({typeName:He.ZodNever,...We(t)});class cb extends ct{_parse(a){if(this._getType(a)!==Ce.undefined){const r=this._getOrReturnCtx(a);return Ne(r,{code:se.invalid_type,expected:Ce.void,received:r.parsedType}),Ge}return La(a.data)}}cb.create=t=>new cb({typeName:He.ZodVoid,...We(t)});class fs extends ct{_parse(a){const{ctx:i,status:r}=this._processInputParams(a),c=this._def;if(i.parsedType!==Ce.array)return Ne(i,{code:se.invalid_type,expected:Ce.array,received:i.parsedType}),Ge;if(c.exactLength!==null){const p=i.data.length>c.exactLength.value,h=i.data.length<c.exactLength.value;(p||h)&&(Ne(i,{code:p?se.too_big:se.too_small,minimum:h?c.exactLength.value:void 0,maximum:p?c.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:c.exactLength.message}),r.dirty())}if(c.minLength!==null&&i.data.length<c.minLength.value&&(Ne(i,{code:se.too_small,minimum:c.minLength.value,type:"array",inclusive:!0,exact:!1,message:c.minLength.message}),r.dirty()),c.maxLength!==null&&i.data.length>c.maxLength.value&&(Ne(i,{code:se.too_big,maximum:c.maxLength.value,type:"array",inclusive:!0,exact:!1,message:c.maxLength.message}),r.dirty()),i.common.async)return Promise.all([...i.data].map((p,h)=>c.type._parseAsync(new Ll(i,p,i.path,h)))).then(p=>ga.mergeArray(r,p));const f=[...i.data].map((p,h)=>c.type._parseSync(new Ll(i,p,i.path,h)));return ga.mergeArray(r,f)}get element(){return this._def.type}min(a,i){return new fs({...this._def,minLength:{value:a,message:Ie.toString(i)}})}max(a,i){return new fs({...this._def,maxLength:{value:a,message:Ie.toString(i)}})}length(a,i){return new fs({...this._def,exactLength:{value:a,message:Ie.toString(i)}})}nonempty(a){return this.min(1,a)}}fs.create=(t,a)=>new fs({type:t,minLength:null,maxLength:null,exactLength:null,typeName:He.ZodArray,...We(a)});function gr(t){if(t instanceof fn){const a={};for(const i in t.shape){const r=t.shape[i];a[i]=Ks.create(gr(r))}return new fn({...t._def,shape:()=>a})}else return t instanceof fs?new fs({...t._def,type:gr(t.element)}):t instanceof Ks?Ks.create(gr(t.unwrap())):t instanceof hi?hi.create(gr(t.unwrap())):t instanceof di?di.create(t.items.map(a=>gr(a))):t}class fn extends ct{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const a=this._def.shape(),i=pt.objectKeys(a);return this._cached={shape:a,keys:i},this._cached}_parse(a){if(this._getType(a)!==Ce.object){const m=this._getOrReturnCtx(a);return Ne(m,{code:se.invalid_type,expected:Ce.object,received:m.parsedType}),Ge}const{status:r,ctx:c}=this._processInputParams(a),{shape:f,keys:p}=this._getCached(),h=[];if(!(this._def.catchall instanceof Il&&this._def.unknownKeys==="strip"))for(const m in c.data)p.includes(m)||h.push(m);const v=[];for(const m of p){const x=f[m],y=c.data[m];v.push({key:{status:"valid",value:m},value:x._parse(new Ll(c,y,c.path,m)),alwaysSet:m in c.data})}if(this._def.catchall instanceof Il){const m=this._def.unknownKeys;if(m==="passthrough")for(const x of h)v.push({key:{status:"valid",value:x},value:{status:"valid",value:c.data[x]}});else if(m==="strict")h.length>0&&(Ne(c,{code:se.unrecognized_keys,keys:h}),r.dirty());else if(m!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const m=this._def.catchall;for(const x of h){const y=c.data[x];v.push({key:{status:"valid",value:x},value:m._parse(new Ll(c,y,c.path,x)),alwaysSet:x in c.data})}}return c.common.async?Promise.resolve().then(async()=>{const m=[];for(const x of v){const y=await x.key,E=await x.value;m.push({key:y,value:E,alwaysSet:x.alwaysSet})}return m}).then(m=>ga.mergeObjectSync(r,m)):ga.mergeObjectSync(r,v)}get shape(){return this._def.shape()}strict(a){return Ie.errToObj,new fn({...this._def,unknownKeys:"strict",...a!==void 0?{errorMap:(i,r)=>{const c=this._def.errorMap?.(i,r).message??r.defaultError;return i.code==="unrecognized_keys"?{message:Ie.errToObj(a).message??c}:{message:c}}}:{}})}strip(){return new fn({...this._def,unknownKeys:"strip"})}passthrough(){return new fn({...this._def,unknownKeys:"passthrough"})}extend(a){return new fn({...this._def,shape:()=>({...this._def.shape(),...a})})}merge(a){return new fn({unknownKeys:a._def.unknownKeys,catchall:a._def.catchall,shape:()=>({...this._def.shape(),...a._def.shape()}),typeName:He.ZodObject})}setKey(a,i){return this.augment({[a]:i})}catchall(a){return new fn({...this._def,catchall:a})}pick(a){const i={};for(const r of pt.objectKeys(a))a[r]&&this.shape[r]&&(i[r]=this.shape[r]);return new fn({...this._def,shape:()=>i})}omit(a){const i={};for(const r of pt.objectKeys(this.shape))a[r]||(i[r]=this.shape[r]);return new fn({...this._def,shape:()=>i})}deepPartial(){return gr(this)}partial(a){const i={};for(const r of pt.objectKeys(this.shape)){const c=this.shape[r];a&&!a[r]?i[r]=c:i[r]=c.optional()}return new fn({...this._def,shape:()=>i})}required(a){const i={};for(const r of pt.objectKeys(this.shape))if(a&&!a[r])i[r]=this.shape[r];else{let f=this.shape[r];for(;f instanceof Ks;)f=f._def.innerType;i[r]=f}return new fn({...this._def,shape:()=>i})}keyof(){return gx(pt.objectKeys(this.shape))}}fn.create=(t,a)=>new fn({shape:()=>t,unknownKeys:"strip",catchall:Il.create(),typeName:He.ZodObject,...We(a)});fn.strictCreate=(t,a)=>new fn({shape:()=>t,unknownKeys:"strict",catchall:Il.create(),typeName:He.ZodObject,...We(a)});fn.lazycreate=(t,a)=>new fn({shape:t,unknownKeys:"strip",catchall:Il.create(),typeName:He.ZodObject,...We(a)});class Zu extends ct{_parse(a){const{ctx:i}=this._processInputParams(a),r=this._def.options;function c(f){for(const h of f)if(h.result.status==="valid")return h.result;for(const h of f)if(h.result.status==="dirty")return i.common.issues.push(...h.ctx.common.issues),h.result;const p=f.map(h=>new Xs(h.ctx.common.issues));return Ne(i,{code:se.invalid_union,unionErrors:p}),Ge}if(i.common.async)return Promise.all(r.map(async f=>{const p={...i,common:{...i.common,issues:[]},parent:null};return{result:await f._parseAsync({data:i.data,path:i.path,parent:p}),ctx:p}})).then(c);{let f;const p=[];for(const v of r){const m={...i,common:{...i.common,issues:[]},parent:null},x=v._parseSync({data:i.data,path:i.path,parent:m});if(x.status==="valid")return x;x.status==="dirty"&&!f&&(f={result:x,ctx:m}),m.common.issues.length&&p.push(m.common.issues)}if(f)return i.common.issues.push(...f.ctx.common.issues),f.result;const h=p.map(v=>new Xs(v));return Ne(i,{code:se.invalid_union,unionErrors:h}),Ge}}get options(){return this._def.options}}Zu.create=(t,a)=>new Zu({options:t,typeName:He.ZodUnion,...We(a)});const Bs=t=>t instanceof Sh?Bs(t.schema):t instanceof pi?Bs(t.innerType()):t instanceof Yu?[t.value]:t instanceof fi?t.options:t instanceof Nh?pt.objectValues(t.enum):t instanceof Pu?Bs(t._def.innerType):t instanceof xh?[void 0]:t instanceof wh?[null]:t instanceof Ks?[void 0,...Bs(t.unwrap())]:t instanceof hi?[null,...Bs(t.unwrap())]:t instanceof _x||t instanceof Ju?Bs(t.unwrap()):t instanceof Qu?Bs(t._def.innerType):[];class Hh extends ct{_parse(a){const{ctx:i}=this._processInputParams(a);if(i.parsedType!==Ce.object)return Ne(i,{code:se.invalid_type,expected:Ce.object,received:i.parsedType}),Ge;const r=this.discriminator,c=i.data[r],f=this.optionsMap.get(c);return f?i.common.async?f._parseAsync({data:i.data,path:i.path,parent:i}):f._parseSync({data:i.data,path:i.path,parent:i}):(Ne(i,{code:se.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Ge)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(a,i,r){const c=new Map;for(const f of i){const p=Bs(f.shape[a]);if(!p.length)throw new Error(`A discriminator value for key \`${a}\` could not be extracted from all schema options`);for(const h of p){if(c.has(h))throw new Error(`Discriminator property ${String(a)} has duplicate value ${String(h)}`);c.set(h,f)}}return new Hh({typeName:He.ZodDiscriminatedUnion,discriminator:a,options:i,optionsMap:c,...We(r)})}}function jh(t,a){const i=Al(t),r=Al(a);if(t===a)return{valid:!0,data:t};if(i===Ce.object&&r===Ce.object){const c=pt.objectKeys(a),f=pt.objectKeys(t).filter(h=>c.indexOf(h)!==-1),p={...t,...a};for(const h of f){const v=jh(t[h],a[h]);if(!v.valid)return{valid:!1};p[h]=v.data}return{valid:!0,data:p}}else if(i===Ce.array&&r===Ce.array){if(t.length!==a.length)return{valid:!1};const c=[];for(let f=0;f<t.length;f++){const p=t[f],h=a[f],v=jh(p,h);if(!v.valid)return{valid:!1};c.push(v.data)}return{valid:!0,data:c}}else return i===Ce.date&&r===Ce.date&&+t==+a?{valid:!0,data:t}:{valid:!1}}class Fu extends ct{_parse(a){const{status:i,ctx:r}=this._processInputParams(a),c=(f,p)=>{if(ab(f)||ab(p))return Ge;const h=jh(f.value,p.value);return h.valid?((sb(f)||sb(p))&&i.dirty(),{status:i.value,value:h.data}):(Ne(r,{code:se.invalid_intersection_types}),Ge)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([f,p])=>c(f,p)):c(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Fu.create=(t,a,i)=>new Fu({left:t,right:a,typeName:He.ZodIntersection,...We(i)});class di extends ct{_parse(a){const{status:i,ctx:r}=this._processInputParams(a);if(r.parsedType!==Ce.array)return Ne(r,{code:se.invalid_type,expected:Ce.array,received:r.parsedType}),Ge;if(r.data.length<this._def.items.length)return Ne(r,{code:se.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ge;!this._def.rest&&r.data.length>this._def.items.length&&(Ne(r,{code:se.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),i.dirty());const f=[...r.data].map((p,h)=>{const v=this._def.items[h]||this._def.rest;return v?v._parse(new Ll(r,p,r.path,h)):null}).filter(p=>!!p);return r.common.async?Promise.all(f).then(p=>ga.mergeArray(i,p)):ga.mergeArray(i,f)}get items(){return this._def.items}rest(a){return new di({...this._def,rest:a})}}di.create=(t,a)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new di({items:t,typeName:He.ZodTuple,rest:null,...We(a)})};class ub extends ct{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(a){const{status:i,ctx:r}=this._processInputParams(a);if(r.parsedType!==Ce.map)return Ne(r,{code:se.invalid_type,expected:Ce.map,received:r.parsedType}),Ge;const c=this._def.keyType,f=this._def.valueType,p=[...r.data.entries()].map(([h,v],m)=>({key:c._parse(new Ll(r,h,r.path,[m,"key"])),value:f._parse(new Ll(r,v,r.path,[m,"value"]))}));if(r.common.async){const h=new Map;return Promise.resolve().then(async()=>{for(const v of p){const m=await v.key,x=await v.value;if(m.status==="aborted"||x.status==="aborted")return Ge;(m.status==="dirty"||x.status==="dirty")&&i.dirty(),h.set(m.value,x.value)}return{status:i.value,value:h}})}else{const h=new Map;for(const v of p){const m=v.key,x=v.value;if(m.status==="aborted"||x.status==="aborted")return Ge;(m.status==="dirty"||x.status==="dirty")&&i.dirty(),h.set(m.value,x.value)}return{status:i.value,value:h}}}}ub.create=(t,a,i)=>new ub({valueType:a,keyType:t,typeName:He.ZodMap,...We(i)});class Go extends ct{_parse(a){const{status:i,ctx:r}=this._processInputParams(a);if(r.parsedType!==Ce.set)return Ne(r,{code:se.invalid_type,expected:Ce.set,received:r.parsedType}),Ge;const c=this._def;c.minSize!==null&&r.data.size<c.minSize.value&&(Ne(r,{code:se.too_small,minimum:c.minSize.value,type:"set",inclusive:!0,exact:!1,message:c.minSize.message}),i.dirty()),c.maxSize!==null&&r.data.size>c.maxSize.value&&(Ne(r,{code:se.too_big,maximum:c.maxSize.value,type:"set",inclusive:!0,exact:!1,message:c.maxSize.message}),i.dirty());const f=this._def.valueType;function p(v){const m=new Set;for(const x of v){if(x.status==="aborted")return Ge;x.status==="dirty"&&i.dirty(),m.add(x.value)}return{status:i.value,value:m}}const h=[...r.data.values()].map((v,m)=>f._parse(new Ll(r,v,r.path,m)));return r.common.async?Promise.all(h).then(v=>p(v)):p(h)}min(a,i){return new Go({...this._def,minSize:{value:a,message:Ie.toString(i)}})}max(a,i){return new Go({...this._def,maxSize:{value:a,message:Ie.toString(i)}})}size(a,i){return this.min(a,i).max(a,i)}nonempty(a){return this.min(1,a)}}Go.create=(t,a)=>new Go({valueType:t,minSize:null,maxSize:null,typeName:He.ZodSet,...We(a)});class Sh extends ct{get schema(){return this._def.getter()}_parse(a){const{ctx:i}=this._processInputParams(a);return this._def.getter()._parse({data:i.data,path:i.path,parent:i})}}Sh.create=(t,a)=>new Sh({getter:t,typeName:He.ZodLazy,...We(a)});class Yu extends ct{_parse(a){if(a.data!==this._def.value){const i=this._getOrReturnCtx(a);return Ne(i,{received:i.data,code:se.invalid_literal,expected:this._def.value}),Ge}return{status:"valid",value:a.data}}get value(){return this._def.value}}Yu.create=(t,a)=>new Yu({value:t,typeName:He.ZodLiteral,...We(a)});function gx(t,a){return new fi({values:t,typeName:He.ZodEnum,...We(a)})}class fi extends ct{_parse(a){if(typeof a.data!="string"){const i=this._getOrReturnCtx(a),r=this._def.values;return Ne(i,{expected:pt.joinValues(r),received:i.parsedType,code:se.invalid_type}),Ge}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(a.data)){const i=this._getOrReturnCtx(a),r=this._def.values;return Ne(i,{received:i.data,code:se.invalid_enum_value,options:r}),Ge}return La(a.data)}get options(){return this._def.values}get enum(){const a={};for(const i of this._def.values)a[i]=i;return a}get Values(){const a={};for(const i of this._def.values)a[i]=i;return a}get Enum(){const a={};for(const i of this._def.values)a[i]=i;return a}extract(a,i=this._def){return fi.create(a,{...this._def,...i})}exclude(a,i=this._def){return fi.create(this.options.filter(r=>!a.includes(r)),{...this._def,...i})}}fi.create=gx;class Nh extends ct{_parse(a){const i=pt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(a);if(r.parsedType!==Ce.string&&r.parsedType!==Ce.number){const c=pt.objectValues(i);return Ne(r,{expected:pt.joinValues(c),received:r.parsedType,code:se.invalid_type}),Ge}if(this._cache||(this._cache=new Set(pt.getValidEnumValues(this._def.values))),!this._cache.has(a.data)){const c=pt.objectValues(i);return Ne(r,{received:r.data,code:se.invalid_enum_value,options:c}),Ge}return La(a.data)}get enum(){return this._def.values}}Nh.create=(t,a)=>new Nh({values:t,typeName:He.ZodNativeEnum,...We(a)});class Xu extends ct{unwrap(){return this._def.type}_parse(a){const{ctx:i}=this._processInputParams(a);if(i.parsedType!==Ce.promise&&i.common.async===!1)return Ne(i,{code:se.invalid_type,expected:Ce.promise,received:i.parsedType}),Ge;const r=i.parsedType===Ce.promise?i.data:Promise.resolve(i.data);return La(r.then(c=>this._def.type.parseAsync(c,{path:i.path,errorMap:i.common.contextualErrorMap})))}}Xu.create=(t,a)=>new Xu({type:t,typeName:He.ZodPromise,...We(a)});class pi extends ct{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===He.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(a){const{status:i,ctx:r}=this._processInputParams(a),c=this._def.effect||null,f={addIssue:p=>{Ne(r,p),p.fatal?i.abort():i.dirty()},get path(){return r.path}};if(f.addIssue=f.addIssue.bind(f),c.type==="preprocess"){const p=c.transform(r.data,f);if(r.common.async)return Promise.resolve(p).then(async h=>{if(i.value==="aborted")return Ge;const v=await this._def.schema._parseAsync({data:h,path:r.path,parent:r});return v.status==="aborted"?Ge:v.status==="dirty"||i.value==="dirty"?Oo(v.value):v});{if(i.value==="aborted")return Ge;const h=this._def.schema._parseSync({data:p,path:r.path,parent:r});return h.status==="aborted"?Ge:h.status==="dirty"||i.value==="dirty"?Oo(h.value):h}}if(c.type==="refinement"){const p=h=>{const v=c.refinement(h,f);if(r.common.async)return Promise.resolve(v);if(v instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return h};if(r.common.async===!1){const h=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return h.status==="aborted"?Ge:(h.status==="dirty"&&i.dirty(),p(h.value),{status:i.value,value:h.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(h=>h.status==="aborted"?Ge:(h.status==="dirty"&&i.dirty(),p(h.value).then(()=>({status:i.value,value:h.value}))))}if(c.type==="transform")if(r.common.async===!1){const p=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!kr(p))return Ge;const h=c.transform(p.value,f);if(h instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:i.value,value:h}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(p=>kr(p)?Promise.resolve(c.transform(p.value,f)).then(h=>({status:i.value,value:h})):Ge);pt.assertNever(c)}}pi.create=(t,a,i)=>new pi({schema:t,typeName:He.ZodEffects,effect:a,...We(i)});pi.createWithPreprocess=(t,a,i)=>new pi({schema:a,effect:{type:"preprocess",transform:t},typeName:He.ZodEffects,...We(i)});class Ks extends ct{_parse(a){return this._getType(a)===Ce.undefined?La(void 0):this._def.innerType._parse(a)}unwrap(){return this._def.innerType}}Ks.create=(t,a)=>new Ks({innerType:t,typeName:He.ZodOptional,...We(a)});class hi extends ct{_parse(a){return this._getType(a)===Ce.null?La(null):this._def.innerType._parse(a)}unwrap(){return this._def.innerType}}hi.create=(t,a)=>new hi({innerType:t,typeName:He.ZodNullable,...We(a)});class Pu extends ct{_parse(a){const{ctx:i}=this._processInputParams(a);let r=i.data;return i.parsedType===Ce.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:i.path,parent:i})}removeDefault(){return this._def.innerType}}Pu.create=(t,a)=>new Pu({innerType:t,typeName:He.ZodDefault,defaultValue:typeof a.default=="function"?a.default:()=>a.default,...We(a)});class Qu extends ct{_parse(a){const{ctx:i}=this._processInputParams(a),r={...i,common:{...i.common,issues:[]}},c=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Vu(c)?c.then(f=>({status:"valid",value:f.status==="valid"?f.value:this._def.catchValue({get error(){return new Xs(r.common.issues)},input:r.data})})):{status:"valid",value:c.status==="valid"?c.value:this._def.catchValue({get error(){return new Xs(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Qu.create=(t,a)=>new Qu({innerType:t,typeName:He.ZodCatch,catchValue:typeof a.catch=="function"?a.catch:()=>a.catch,...We(a)});class db extends ct{_parse(a){if(this._getType(a)!==Ce.nan){const r=this._getOrReturnCtx(a);return Ne(r,{code:se.invalid_type,expected:Ce.nan,received:r.parsedType}),Ge}return{status:"valid",value:a.data}}}db.create=t=>new db({typeName:He.ZodNaN,...We(t)});class _x extends ct{_parse(a){const{ctx:i}=this._processInputParams(a),r=i.data;return this._def.type._parse({data:r,path:i.path,parent:i})}unwrap(){return this._def.type}}class Vh extends ct{_parse(a){const{status:i,ctx:r}=this._processInputParams(a);if(r.common.async)return(async()=>{const f=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return f.status==="aborted"?Ge:f.status==="dirty"?(i.dirty(),Oo(f.value)):this._def.out._parseAsync({data:f.value,path:r.path,parent:r})})();{const c=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?Ge:c.status==="dirty"?(i.dirty(),{status:"dirty",value:c.value}):this._def.out._parseSync({data:c.value,path:r.path,parent:r})}}static create(a,i){return new Vh({in:a,out:i,typeName:He.ZodPipeline})}}class Ju extends ct{_parse(a){const i=this._def.innerType._parse(a),r=c=>(kr(c)&&(c.value=Object.freeze(c.value)),c);return Vu(i)?i.then(c=>r(c)):r(i)}unwrap(){return this._def.innerType}}Ju.create=(t,a)=>new Ju({innerType:t,typeName:He.ZodReadonly,...We(a)});var He;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(He||(He={}));const ps=Ol.create,Yo=Ar.create,vx=yh.create;Il.create;const Kh=fs.create,Bt=fn.create,zN=Zu.create,bx=Hh.create;Fu.create;di.create;const It=Yu.create,Un=fi.create;Xu.create;Ks.create;hi.create;const Kn=ps().min(1).max(128).regex(/^[A-Za-z0-9_-]+$/),Zh=ps().min(16).max(128).regex(/^[A-Za-z0-9_-]+$/),yx=Yo().int().min(1).max(1e6),qN=Yo().int().min(0).max(Number.MAX_SAFE_INTEGER-1),qp=Yo().int().min(0).max(Number.MAX_SAFE_INTEGER),pu=Yo().int().min(0).max(Number.MAX_SAFE_INTEGER),xx=Bt({laneId:ps().min(1).max(160).regex(/^[A-Za-z0-9_:-]+$/)}).strict(),UN=Bt({family:It("workflow"),runId:ps().min(1).max(64).regex(/^[A-Za-z0-9_-]+$/),runGeneration:Zh,stageId:Kn.optional(),callId:Kn.optional(),attempt:yx.optional()}).strict().superRefine((t,a)=>{t.callId!==void 0&&t.stageId===void 0&&a.addIssue({code:se.custom,message:"call requires stage"}),t.attempt!==void 0&&t.callId===void 0&&a.addIssue({code:se.custom,message:"attempt requires call"})}),BN=Bt({family:It("activity"),activityId:Kn,activityGeneration:Zh,sessionId:Kn.optional(),threadId:Kn.optional(),turnId:Kn.optional()}).strict().superRefine((t,a)=>{t.sessionId!==void 0&&t.sessionId!==t.activityId&&a.addIssue({code:se.custom,message:"session mismatch"}),t.threadId!==void 0&&t.sessionId===void 0&&a.addIssue({code:se.custom,message:"thread requires session"}),t.turnId!==void 0&&t.threadId===void 0&&a.addIssue({code:se.custom,message:"turn requires thread"})}),GN=Bt({family:It("context"),contextRunId:ps().max(40).refine(t=>{if(!/^ctxop_\d{8}T\d{6}Z_[0-9a-f]{12}$/.test(t))return!1;const a=t.slice(6,22),i=[a.slice(0,4),"-",a.slice(4,6),"-",a.slice(6,8),"T",a.slice(9,11),":",a.slice(11,13),":",a.slice(13,15),".000Z"].join(""),r=new Date(i);return!Number.isNaN(r.getTime())&&r.toISOString()===i}),contextGeneration:Zh,executor:Un(["curator","finalizer"]).optional(),executionId:Kn.optional(),attempt:yx.optional()}).strict().superRefine((t,a)=>{t.executionId!==void 0&&t.executor===void 0&&a.addIssue({code:se.custom,message:"execution requires executor"}),t.attempt!==void 0&&t.executionId===void 0&&a.addIssue({code:se.custom,message:"attempt requires execution"})}),wx=zN([UN,BN,GN]),fr=ps().max(4096),HN=Bt({content:ps().max(32768).refine(t=>new TextEncoder().encode(t).byteLength<=32768),omission:Un(["none","size_limit","structure_limit","invalid"])}).strict().superRefine((t,a)=>{if(t.omission!=="none"){t.content!==""&&a.addIssue({code:se.custom,message:"omitted arguments contain content"});return}try{JSON.parse(t.content)}catch{a.addIssue({code:se.custom,message:"arguments are not JSON"})}}),VN=bx("kind",[Bt({kind:It("user"),content:ps().max(32768)}).strict(),Bt({kind:It("assistant"),content:ps().max(32768)}).strict(),Bt({kind:It("tool_call"),toolName:Kn,callId:Kn,summary:fr,arguments:HN.optional()}).strict(),Bt({kind:It("tool_result"),toolName:Kn,callId:Kn,outcome:Un(["succeeded","failed","cancelled"]),summary:fr}).strict(),Bt({kind:It("approval_request"),approvalId:Kn,action:fr,risk:Un(["low","medium","high"])}).strict(),Bt({kind:It("approval_resolution"),approvalId:Kn,decision:Un(["approved","denied","cancelled"])}).strict(),Bt({kind:It("error"),code:Kn,message:fr,retryable:vx()}).strict(),Bt({kind:It("lifecycle"),state:Un(["pending","queued","resolving","running","parsing","awaiting_approval","succeeded","partial","failed","cancelled","interrupted","timeout","completed"])}).strict(),Bt({kind:It("usage"),completeness:Un(["complete","partial","unknown"]),inputTokens:pu.nullable(),outputTokens:pu.nullable(),cachedInputTokens:pu.nullable(),reasoningTokens:pu.nullable()}).strict(),Bt({kind:It("reasoning"),summary:fr}).strict(),Bt({kind:It("unknown"),originalKind:Kn,summary:fr,forwardCaptured:It(!0)}).strict()]).superRefine((t,a)=>{if(t.kind!=="usage")return;const i=[t.inputTokens,t.outputTokens,t.cachedInputTokens,t.reasoningTokens],r=i.filter(c=>c!==null).length;t.completeness==="unknown"&&r!==0?a.addIssue({code:se.custom,message:"unknown usage has counters"}):t.completeness==="complete"&&(t.inputTokens===null||t.outputTokens===null)?a.addIssue({code:se.custom,message:"complete usage lacks totals"}):t.completeness==="partial"&&(r===0||r===i.length)&&a.addIssue({code:se.custom,message:"partial usage is not partial"})}),KN=Un(["unknown_event_type","provider_payload_omitted","malformed_field_omitted","unsupported_field_omitted","content_truncated","corrupt_capture"]);function ZN(t){if(t.family==="workflow"&&t.attempt!==void 0)return`attempt:${String(t.attempt)}`;if(t.family==="activity"&&t.turnId!==void 0)return`turn:${t.turnId}`;if(t.family==="context"&&t.executionId!==void 0&&t.attempt!==void 0)return`execution:${t.executionId}:${String(t.attempt)}`}const jx=Bt({schemaVersion:It("session-log-v1"),sequence:qN,timestamp:ps().max(64).datetime({offset:!0}),producerFamily:Un(["workflow","activity","context"]),owner:wx,lane:xx,authority:It("observability_only"),redaction:Bt({ran:It(!0),status:Un(["no_matches","redacted"]),count:Yo().int().min(0).max(1e4),coverage:It("pattern_best_effort").optional()}).strict(),truncation:Un(["none","head","tail","middle"]),completeness:Un(["complete","partial","unknown"]),parseWarnings:Kh(KN).max(8).refine(t=>new Set(t).size===t.length),event:VN}).strict().superRefine((t,a)=>{t.producerFamily!==t.owner.family&&a.addIssue({code:se.custom,message:"producer mismatch"}),ZN(t.owner)!==t.lane.laneId&&a.addIssue({code:se.custom,message:"lane mismatch"}),(t.redaction.status==="no_matches"&&t.redaction.count!==0||t.redaction.status==="redacted"&&t.redaction.count===0)&&a.addIssue({code:se.custom,message:"redaction mismatch"}),t.event.kind==="tool_call"&&t.event.arguments!==void 0&&t.event.arguments.omission!=="none"&&(t.completeness!=="partial"||!t.parseWarnings.includes("provider_payload_omitted"))&&a.addIssue({code:se.custom,message:"omitted arguments require loss metadata"});const i=t.parseWarnings.includes("content_truncated"),r=t.parseWarnings.some(c=>["malformed_field_omitted","unsupported_field_omitted","content_truncated","corrupt_capture"].includes(c));t.truncation==="none"&&i&&a.addIssue({code:se.custom,message:"unexpected truncation warning"}),t.truncation!=="none"&&!i&&a.addIssue({code:se.custom,message:"missing truncation warning"}),t.truncation!=="none"&&t.completeness!=="partial"&&a.addIssue({code:se.custom,message:"truncation completeness mismatch"}),t.completeness==="complete"&&r&&a.addIssue({code:se.custom,message:"complete event claims loss"})}),FN=Un(["retention_gap","truncated","incomplete_capture","parse_warning","corrupt_capture"]),YN=bx("availability",[Bt({availability:It("available")}).strict(),Bt({availability:It("degraded"),reasons:Kh(FN).min(1).max(5).refine(t=>new Set(t).size===t.length)}).strict(),Bt({availability:It("not_retained"),reason:Un(["retention_disabled","retention_expired","producer_did_not_retain"])}).strict(),Bt({availability:It("not_executed"),reason:Un(["not_requested","disabled","skipped","cancelled_before_start"])}).strict(),Bt({availability:It("pruned"),reason:Un(["retention_limit","age_limit","size_limit","event_limit","operator_request"])}).strict()]),XN=Bt({schemaVersion:It("session-log-v1"),owner:wx,lane:xx,availability:YN,requestedSequence:qp,floorSequence:qp,nextSequence:qp,truncated:vx(),events:Kh(jx).max(500)}).strict().superRefine((t,a)=>{t.truncated!==t.requestedSequence<t.floorSequence&&a.addIssue({code:se.custom,message:"truncation mismatch"});const i=JSON.stringify(t.owner),r=Math.max(t.requestedSequence,t.floorSequence),c=new Set;t.truncated&&c.add("retention_gap");let f;for(const h of t.events){if(JSON.stringify(h.owner)!==i||h.lane.laneId!==t.lane.laneId||h.sequence<r||f!==void 0&&h.sequence<=f){a.addIssue({code:se.custom,message:"event page mismatch"});break}f=h.sequence,h.truncation!=="none"&&c.add("truncated"),h.completeness!=="complete"&&c.add("incomplete_capture"),h.parseWarnings.some(v=>v==="malformed_field_omitted"||v==="unsupported_field_omitted")&&c.add("parse_warning"),h.parseWarnings.includes("corrupt_capture")&&c.add("corrupt_capture")}const p=f===void 0?r:f+1;if(t.nextSequence!==p&&a.addIssue({code:se.custom,message:"cursor mismatch"}),t.availability.availability==="available")c.size!==0&&a.addIssue({code:se.custom,message:"available page claims loss"});else if(t.availability.availability==="degraded"){const h=new Set(t.availability.reasons);(h.size!==c.size||[...c].some(v=>!h.has(v)))&&a.addIssue({code:se.custom,message:"degraded loss mismatch"})}else(t.events.length!==0||c.size!==0)&&a.addIssue({code:se.custom,message:"unavailable page claims data or loss"})});function PN(t){return jx.parse(t)}function QN(t){return XN.parse(t)}const Sx=new Set(["run_generation_changed","activity_generation_changed","context_generation_changed"]),JN=new Set([...Sx,"agent_instance_changed","session_logs_unavailable","not_found"]);class vt extends Error{kind;status;code;constructor(a,i,r){super(a),this.name="SessionLogApiError",this.kind=a,this.status=i,this.code=r}}function fb(t){return t??new AbortController().signal}function pb(t){return t.family==="workflow"?{path:["/api/runs/",encodeURIComponent(t.runId),"/stages/",encodeURIComponent(t.stageId),"/calls/",encodeURIComponent(t.callId),"/session-logs"].join(""),generation:t.runGeneration}:t.family==="activity"?{path:`/api/activities/${encodeURIComponent(t.activityId)}/session-logs`,generation:t.activityGeneration}:"runId"in t&&"runGeneration"in t?{path:`/api/runs/${encodeURIComponent(t.runId)}/context-preflight/session-logs`,generation:t.runGeneration}:{path:`/api/context-runs/${encodeURIComponent(t.contextRunId)}/session-logs`,generation:t.contextGeneration}}function ri(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)?t:void 0}function WN(t){const a=ri(t),r=ri(a?.error)?.code;return typeof r=="string"&&JN.has(r)?r:void 0}function Wu(t,a){const i=Object.keys(t).sort(),r=[...a].sort();return i.length===r.length&&i.every((c,f)=>c===r[f])}function Nx(t,a){return t.family!==a.family?!1:t.family==="workflow"&&a.family==="workflow"?t.runId===a.runId&&t.stageId===a.stageId&&t.callId===a.callId&&t.attempt!==void 0:t.family==="activity"&&a.family==="activity"?t.activityId===a.activityId&&t.turnId!==void 0:t.family==="context"&&a.family==="context"?t.contextRunId===a.contextRunId&&t.executor!==void 0&&t.executionId!==void 0&&t.attempt!==void 0:!1}function ek(t,a){const i=ri(t),r=ri(i?.lane);if(i===void 0||!Wu(i,["owner","lane","nextSequence"])||r===void 0||!Wu(r,["laneId"])||!Number.isSafeInteger(i.nextSequence)||i.nextSequence<0)throw new vt("request_error",502);try{const c=PN({schemaVersion:"session-log-v1",sequence:0,timestamp:"2000-01-01T00:00:00.000Z",producerFamily:ri(i.owner)?.family,owner:i.owner,lane:i.lane,authority:"observability_only",redaction:{ran:!0,status:"no_matches",count:0},truncation:"none",completeness:"complete",parseWarnings:[],event:{kind:"lifecycle",state:"pending"}});if(!Nx(c.owner,a))throw new vt("request_error",502);return Object.freeze({owner:c.owner,lane:c.lane,nextSequence:i.nextSequence})}catch(c){throw c instanceof vt?c:new vt("request_error",502)}}function tk(t,a){const i=ri(t),r=ri(i?.availability),c=i?.lanes,f=r?.availability==="available",p=r?.availability==="not_retained"&&r.reason==="producer_did_not_retain";if(i===void 0||!Wu(i,["schemaVersion","availability","lanes"])||i?.schemaVersion!=="session-log-index-v1"||!f&&!p||r===void 0||!Wu(r,f?["availability"]:["availability","reason"])||!Array.isArray(c)||c.length>2e3||f!==c.length>0)throw new vt("request_error",502);const h=c.map(m=>ek(m,a));if(new Set(h.map(({owner:m})=>m.family==="workflow"?m.runGeneration:m.family==="activity"?m.activityGeneration:m.contextGeneration)).size>1)throw new vt("request_error",502);return Object.freeze({schemaVersion:"session-log-index-v1",availability:Object.freeze(f?{availability:"available"}:{availability:"not_retained",reason:"producer_did_not_retain"}),lanes:Object.freeze(h)})}function nk(t,a,i){try{const r=QN(t);if(r.events.length>500||JSON.stringify(r.lane)!==JSON.stringify(i.lane)||JSON.stringify(r.owner)!==JSON.stringify(i.owner)||!Nx(r.owner,a))throw new vt("request_error",502);return r}catch(r){throw r instanceof vt?r:new vt("request_error",502)}}async function hb(t,a,i){let r;try{r=await t(a,{signal:i})}catch(c){throw c instanceof bt?new vt("connection_changed",409,"agent_instance_changed"):i.aborted||c instanceof DOMException&&c.name==="AbortError"?new vt("aborted"):new vt("offline")}if(r.status===401)throw new vt("auth_expired",401);if(!r.ok){let c;try{c=WN(await na(r))}catch(f){if(f instanceof bt)throw new vt("connection_changed",409,"agent_instance_changed")}throw c!==void 0&&Sx.has(c)?new vt("generation_changed",r.status,c):c==="agent_instance_changed"?new vt("connection_changed",r.status,c):c==="session_logs_unavailable"?new vt("unavailable",r.status,c):c==="not_found"?new vt("missing",r.status,c):new vt("request_error",r.status,c)}try{return await na(r)}catch(c){throw c instanceof bt?new vt("connection_changed",409,"agent_instance_changed"):new vt("request_error",r.status)}}function kx(t=hs){return Object.freeze({async listLanes(a,i){const r=pb(a),c=new URLSearchParams({generation:r.generation});return tk(await hb(t,`${r.path}?${c.toString()}`,fb(i)),a)},async readPage(a,i,r,c){const f=pb(a),p=new URLSearchParams({generation:f.generation,sequence:String(r.sequence),limit:String(r.limit)});return nk(await hb(t,`${f.path}/${encodeURIComponent(i.lane.laneId)}?${p.toString()}`,fb(c)),a,i)}})}const mb=500,hu=200;class ea extends Error{constructor(){super("session_log_protocol_error"),this.name="SessionLogProtocolError"}}function mu(t,a){return t<a?-1:t>a?1:0}function ak(t,a){if(t.owner.family==="workflow"&&a.owner.family==="workflow")return(t.owner.attempt??0)-(a.owner.attempt??0);if(t.owner.family==="activity"&&a.owner.family==="activity")return mu(t.owner.turnId??t.lane.laneId,a.owner.turnId??a.lane.laneId);if(t.owner.family==="context"&&a.owner.family==="context"){const i=mu(t.owner.executor??"",a.owner.executor??"");if(i!==0)return i;const r=mu(t.owner.executionId??t.lane.laneId,a.owner.executionId??a.lane.laneId);return r===0?(t.owner.attempt??0)-(a.owner.attempt??0):r}return mu(t.lane.laneId,a.lane.laneId)}function kh(t,a){return t.family!==a.family?!1:t.family==="workflow"&&a.family==="workflow"?t.runId===a.runId&&t.stageId===a.stageId&&t.callId===a.callId:t.family==="activity"&&a.family==="activity"?t.activityId===a.activityId:t.family==="context"&&a.family==="context"&&t.contextRunId===a.contextRunId}function Up(t,a){const i=t.owner,r=i.family==="workflow"&&i.attempt!==void 0?`attempt:${String(i.attempt)}`:i.family==="activity"&&i.turnId!==void 0?`turn:${i.turnId}`:i.family==="context"&&i.executionId!==void 0&&i.attempt!==void 0?`execution:${i.executionId}:${String(i.attempt)}`:void 0;return kh(i,a)&&r===t.lane.laneId&&Number.isSafeInteger(t.nextSequence)&&t.nextSequence>=0}function ni(t,a){return JSON.stringify(t)===JSON.stringify(a)}function gb(t){const a=new Set;for(const i of t)if(i.availability.availability==="degraded")for(const r of i.availability.reasons)a.add(r);else if(i.availability.availability!=="available")return i.availability;return a.size===0?{availability:"available"}:{availability:"degraded",reasons:[...a]}}function sk(t){const a={async discover(i,r=null,c){const f=await t.listLanes(i,c),p=new Set(f.lanes.map(({lane:x})=>x.laneId)),h=new Set(f.lanes.map(({owner:x})=>x.family==="workflow"?x.runGeneration:x.family==="activity"?x.activityGeneration:x.contextGeneration));if(f.schemaVersion!=="session-log-index-v1"||f.lanes.some(x=>!Up(x,i))||p.size!==f.lanes.length||h.size>1||f.availability.availability==="available"!=f.lanes.length>0)throw new ea;const v=Object.freeze([...f.lanes].sort(ak)),m=v.find(({lane:x})=>x.laneId===r)??v[0]??null;return Object.freeze({index:f,lanes:v,selectedLane:m})},async loadLane(i,r,c){const f=c??new AbortController().signal;if(!Up(r,i))throw new ea;if(r.nextSequence===0)return Object.freeze({schemaVersion:"session-log-v1",owner:r.owner,lane:r.lane,availability:{availability:"available"},requestedSequence:0,floorSequence:0,nextSequence:0,truncated:!1,events:Object.freeze([])});const p=[],h=new Map;let v=0;for(let x=0;x<hu;x+=1){const y=await t.readPage(i,r,{sequence:v,limit:mb},f);if(y.requestedSequence!==v||!ni(y.lane,r.lane)||!ni(y.owner,r.owner)||!kh(y.owner,i))throw new ea;if(!(y.availability.availability==="available"||y.availability.availability==="degraded")){if(y.events.length!==0||y.nextSequence!==v)throw new ea;return y}if(y.nextSequence<=v)throw new ea;p.push(y);for(const S of y.events){const C=h.get(S.sequence);if(C!==void 0&&!ni(C,S))throw new ea;C===void 0&&h.set(S.sequence,S)}if(v=y.nextSequence,v>=r.nextSequence)break}if(p.length===hu&&v<r.nextSequence)throw new ea;const m=p[0];if(m===void 0)throw new ea;return Object.freeze({schemaVersion:"session-log-v1",owner:m.owner,lane:m.lane,availability:gb(p),requestedSequence:0,floorSequence:m.floorSequence,nextSequence:v,truncated:p.some(x=>x.truncated),events:Object.freeze([...h.values()].sort((x,y)=>x.sequence-y.sequence))})},async readTail(i,r,c,f){if(!Up(r,i))throw new ea;if(c.lane.laneId!==r.lane.laneId||!ni(c.owner,r.owner)||c.nextSequence>r.nextSequence)return a.loadLane(i,r,f);if(r.nextSequence===c.nextSequence)return c;const p=f??new AbortController().signal,h=[],v=new Map;for(const x of c.events)v.set(x.sequence,x);let m=c.nextSequence;for(let x=0;x<hu;x+=1){const y=await t.readPage(i,r,{sequence:m,limit:mb},p);if(y.requestedSequence!==m||!ni(y.lane,r.lane)||!ni(y.owner,r.owner)||!kh(y.owner,i))throw new ea;if(!(y.availability.availability==="available"||y.availability.availability==="degraded")||y.floorSequence>c.nextSequence)return a.loadLane(i,r,f);if(y.nextSequence<=m)throw new ea;h.push(y);for(const S of y.events){const C=v.get(S.sequence);if(C!==void 0&&!ni(C,S))throw new ea;C===void 0&&v.set(S.sequence,S)}if(m=y.nextSequence,m>=r.nextSequence)break}if(h.length===hu&&m<r.nextSequence)throw new ea;return h.length===0||m===c.nextSequence?c:Object.freeze({schemaVersion:"session-log-v1",owner:c.owner,lane:c.lane,availability:gb([c,...h]),requestedSequence:c.requestedSequence,floorSequence:c.floorSequence,nextSequence:m,truncated:c.truncated||h.some(x=>x.truncated),events:Object.freeze([...v.values()].sort((x,y)=>x.sequence-y.sequence))})}};return Object.freeze(a)}const lk={available:"Available",degraded:"Degraded",not_retained:"Not retained",not_executed:"Not executed",pruned:"Pruned"},ik={not_retained:"This session log was not retained.",not_executed:"No session execution occurred for this lane.",pruned:"This session log was pruned."};function rk(t){const a=t.availability.availability==="available"?[]:t.availability.availability==="degraded"?t.availability.reasons.map(_b):[_b(t.availability.reason)];return{events:[...t.events].sort((i,r)=>i.sequence-r.sequence),availabilityLabel:lk[t.availability.availability],availabilityState:t.availability.availability,reasons:a,gapMessage:t.truncated&&t.floorSequence>t.requestedSequence?`Sequences ${String(t.requestedSequence)}–${String(t.floorSequence-1)} are no longer retained.`:null,unavailableMessage:t.availability.availability==="available"||t.availability.availability==="degraded"?null:ik[t.availability.availability]}}function _b(t){return t.replaceAll("_"," ")}function Yt(t){return Date.parse(t.timestamp)}function oi(t){const a=Math.max(0,Math.round(t/1e3)),i=Math.floor(a/3600),r=Math.floor(a%3600/60),c=a%60;return i>0?`+${String(i)}:${String(r).padStart(2,"0")}:${String(c).padStart(2,"0")}`:`+${String(r)}:${String(c).padStart(2,"0")}`}function Xo(t){if(!Number.isFinite(t)||t<0)return"—";if(t<1e3)return`${String(Math.round(t))}ms`;if(t<6e4)return`${(t/1e3).toFixed(1).replace(/\.0$/,"")}s`;const a=Math.round(t/1e3),i=Math.floor(a/60);return i<60?`${String(i)}m ${String(a%60).padStart(2,"0")}s`:`${String(Math.floor(i/60))}h ${String(i%60).padStart(2,"0")}m`}function us(t){return t===null?"unknown":String(t).replace(/\B(?=(\d{3})+(?!\d))/g,",")}function Fh(t){const a=[];t.truncation!=="none"&&a.push({label:`${t.truncation} truncated`,level:"warn"}),t.completeness!=="complete"&&a.push({label:`${t.completeness} capture`,level:"warn"}),t.redaction.status==="redacted"&&t.redaction.count>0&&a.push({label:`redacted ${String(t.redaction.count)}`,level:"neutral"});for(const i of t.parseWarnings)a.push({label:i.replaceAll("_"," "),level:i==="corrupt_capture"?"fail":"warn"});return a}function ok(t){const a=[],i=new Set;for(const r of t)for(const c of Fh(r))i.has(c.label)||(i.add(c.label),a.push(c));return a}const ck={pending:"running",queued:"running",resolving:"running",running:"running",parsing:"running",awaiting_approval:"running",succeeded:"ok",completed:"ok",partial:"ok",failed:"failed",timeout:"failed",interrupted:"failed",cancelled:"cancelled"};function uk(t){for(let a=t.length-1;a>=0;a-=1){const i=t[a];if(!(i===void 0||i.event.kind!=="lifecycle"))return ck[i.event.state]??"running"}return null}const dk={user:"prompt",assistant:"assistant",tool_call:"tool call",tool_result:"tool result",approval_request:"approval req",approval_resolution:"approval res",error:"error",lifecycle:"lifecycle",usage:"usage",reasoning:"reasoning",unknown:"unknown event"};function pr(t){return(t.split(`
|
|
11
|
-
`).find(i=>i.trim().length>0)??"").replace(/\s+/g," ").trim()}function fk(t){const a=t.event;let i;switch(a.kind){case"user":case"assistant":i=pr(a.content);break;case"tool_call":i=`${a.toolName} · ${a.callId} · ${pr(a.summary)}`;break;case"tool_result":i=`${a.toolName} · ${a.callId} · ${a.outcome} · ${pr(a.summary)}`;break;case"approval_request":i=`${pr(a.action)} · ${a.risk} risk · ${a.approvalId}`;break;case"approval_resolution":i=`${a.decision} · ${a.approvalId}`;break;case"error":i=`${a.code} · ${a.retryable?"retryable":"not retryable"} · ${a.message}`;break;case"usage":i=[`in ${us(a.inputTokens)}`,`out ${us(a.outputTokens)}`,`cached ${us(a.cachedInputTokens)}`,`reasoning ${us(a.reasoningTokens)}`,a.completeness].join(" · ");break;case"lifecycle":i=a.state;break;case"reasoning":i=pr(a.summary);break;case"unknown":i=`${a.originalKind} · ${pr(a.summary)}`;break}return i.length>200?`${i.slice(0,199)}…`:i}function gi(t){switch(t.kind){case"user":case"assistant":return t.content;case"lifecycle":return t.state;case"tool_call":return`${t.toolName} · ${t.callId}
|
|
12
|
-
${t.summary}`;case"tool_result":return`${t.toolName} · ${t.callId} · ${t.outcome}
|
|
13
|
-
${t.summary}`;case"approval_request":return`${t.action}
|
|
14
|
-
Risk: ${t.risk} · Approval: ${t.approvalId}`;case"approval_resolution":return`${t.decision}
|
|
15
|
-
Approval: ${t.approvalId}`;case"error":return`${t.code} · ${t.retryable?"retryable":"not retryable"}
|
|
16
|
-
${t.message}`;case"usage":return[`Completeness: ${t.completeness}`,`Input tokens: ${t.inputTokens??"unknown"}`,`Output tokens: ${t.outputTokens??"unknown"}`,`Cached input tokens: ${t.cachedInputTokens??"unknown"}`,`Reasoning tokens: ${t.reasoningTokens??"unknown"}`].join(`
|
|
17
|
-
`);case"reasoning":return t.summary;case"unknown":return`${t.originalKind}
|
|
18
|
-
${t.summary}`}}const pk=3e4;function _i(t){switch(t.kind){case"message":case"reasoning":case"error":return[t.event];case"tool":return t.result===null?[t.call]:[t.call,t.result];case"group":return t.cards.flatMap(_i);case"approval":{const a=[];return t.request!==null&&a.push(t.request),t.resolution!==null&&a.push(t.resolution),a}case"tick":return t.events;case"stamp":return t.events;case"gap":return[]}}function Bp(t){switch(t.kind){case"group":return t.sequenceRange[0];case"stamp":return t.anchor.sequence;case"gap":return Number.MAX_SAFE_INTEGER;default:{const a=_i(t)[0];return a===void 0?-1:a.sequence}}}function vb(t){switch(t.kind){case"error":case"approval":return!0;case"tool":return t.status!=="succeeded"&&t.status!=="running";case"group":return!1;default:return _i(t).some(a=>Fh(a).some(i=>i.level!=="neutral"))}}function bb(t){return t.kind==="__tick"}function Ah(t){return t.kind==="tool"}const hk=new Set(["succeeded","partial","failed","cancelled","interrupted","timeout","completed"]);function Yh(t){for(let a=t.length-1;a>=0;a-=1){const i=t[a];if(i!==void 0&&i.event.kind==="lifecycle")return hk.has(i.event.state)}return!1}function mk(t,a){if(t.event.kind!==a.event.kind)return!1;switch(t.event.kind){case"lifecycle":return a.event.kind==="lifecycle"&&t.event.state===a.event.state;case"usage":return a.event.kind==="usage"&&t.event.completeness===a.event.completeness&&t.event.inputTokens===a.event.inputTokens&&t.event.outputTokens===a.event.outputTokens&&t.event.cachedInputTokens===a.event.cachedInputTokens&&t.event.reasoningTokens===a.event.reasoningTokens;case"unknown":return a.event.kind==="unknown"&&t.event.originalKind===a.event.originalKind&&t.event.summary===a.event.summary&&t.event.forwardCaptured===a.event.forwardCaptured;default:return!1}}function gk(t,a){if(a===null)return null;const i=Yt(a)-Yt(t);return Number.isFinite(i)&&i>=0?i:null}function Ru(t,a,i){const r="callId"in t.event?t.event.callId:"",c="toolName"in t.event?t.event.toolName:"tool",f=a!==null&&a.event.kind==="tool_result"?a.event.outcome:null,p=f!==null?f:i?"unresolved":"running";return{kind:"tool",callId:r,toolName:c,call:t,result:a,durationMs:gk(t,a),status:p,fidelityEvents:a===null?[t]:[t,a]}}function _k(t){const a=[],i=new Map,r=new Map;for(const c of t)switch(c.event.kind){case"user":a.push({kind:"message",speaker:"prompt",event:c});break;case"assistant":a.push({kind:"message",speaker:"assistant",event:c});break;case"tool_call":{const f=Ru(c,null,!1);i.set(f.callId,{index:a.length,card:f}),a.push(f);break}case"tool_result":{const f=c.event.callId,p=i.get(f);if(p!==void 0&&p.card.result===null){const h=Ru(p.card.call,c,!1);i.set(f,{index:p.index,card:h}),a[p.index]=h}else{const h=Ru(c,c,!1);i.set(f,{index:a.length,card:h}),a.push(h)}break}case"approval_request":{const f={kind:"approval",approvalId:c.event.approvalId,request:c,resolution:null,fidelityEvents:[c]};r.set(c.event.approvalId,{index:a.length,item:f}),a.push(f);break}case"approval_resolution":{const f=r.get(c.event.approvalId);if(f!==void 0&&f.item.resolution===null){const p={...f.item,resolution:c,fidelityEvents:[...f.item.fidelityEvents,c]};r.set(c.event.approvalId,{index:f.index,item:p}),a[f.index]=p}else{const p={kind:"approval",approvalId:c.event.approvalId,request:null,resolution:c,fidelityEvents:[c]};r.set(c.event.approvalId,{index:a.length,item:p}),a.push(p)}break}case"error":a.push({kind:"error",event:c});break;case"reasoning":a.push({kind:"reasoning",event:c,foldedCount:1});break;default:a.push({kind:"__tick",event:c});break}return a}function vk(t){const a=new Map;for(const c of t)a.set(c.toolName,(a.get(c.toolName)??0)+1);const r=[...a.entries()].sort((c,f)=>f[1]!==c[1]?f[1]-c[1]:c[0].localeCompare(f[0])).map(([c,f])=>`${c} ×${String(f)}`);return`${String(t.length)} tools · ${r.join(", ")}`}function bk(t){return t.event.kind==="tool_call"?t.event.summary:""}function yk(t){const a=[];let i=0;for(;i<t.length;){const r=t[i];if(r===void 0||!Ah(r)||r.status!=="succeeded"){r!==void 0&&a.push(r),i+=1;continue}let c=i;for(;c<t.length;){const p=t[c];if(p===void 0||!Ah(p)||p.status!=="succeeded")break;c+=1}const f=t.slice(i,c);if(f.length>=3){const p=f[0],h=f[f.length-1],v=f.reduce((m,x)=>x.durationMs===null?m:m+x.durationMs,0);a.push({kind:"group",cards:f,summary:vk(f),preview:f.map(m=>bk(m.call).replaceAll(/\s+/g," ").trim()).filter(m=>m.length>0).join(" · "),totalMs:v,sequenceRange:[p.call.sequence,h.call.sequence]})}else a.push(...f);i=c}return a}function xk(t){const a=[];for(const i of t){const r=a[a.length-1];if(bb(i)&&r!==void 0&&r.kind==="tick"){const c=r;if(mk(c.events[0],i.event)){c.events.push(i.event),c.sequenceRange=[c.events[0].sequence,i.event.sequence];continue}}if(i.kind==="reasoning"&&r!==void 0&&r.kind==="reasoning"){const c=r.event.event.kind==="reasoning"?r.event.event.summary:"",f=i.event.event.kind==="reasoning"?i.event.event.summary:"";if(c===f){a[a.length-1]={...r,foldedCount:r.foldedCount+1};continue}}a.push(bb(i)?{kind:"tick",events:[i.event],eventKind:i.event.event.kind,sequenceRange:null}:i)}return a}function wk(t){switch(t.family){case"workflow":{const a=[`run ${t.runId}`];return t.stageId!==void 0&&a.push(t.stageId),t.callId!==void 0&&a.push(t.callId),t.attempt!==void 0&&a.push(`attempt ${String(t.attempt)}`),a.join(" · ")}case"activity":return[`activity ${t.activityId}`,...t.turnId===void 0?[]:[`turn ${t.turnId}`]].join(" · ");case"context":return[t.executor??"curator",`context ${t.contextRunId}`,...t.executionId===void 0?[]:[`execution ${t.executionId}`],...t.attempt===void 0?[]:[`attempt ${String(t.attempt)}`]].join(" · ")}}function jk(t){return t.timestamp.slice(11,19)}function Sk(t,a){const i=t[0];if(i===void 0)return null;let r=0;for(;r<t.length;){const v=t[r];if(v===void 0||v.event.kind!=="lifecycle")break;r+=1}const c=t.slice(0,r),f=c.flatMap(v=>v.event.kind==="lifecycle"?[v.event.state]:[]),p=a.floorSequence??0,h=[jk(i)];return a.includeOwnerFacts!==!1&&h.push(wk(i.owner)),f.length>0?h.push(f.join(" → ")):p>0&&h.push(`retention floor ${String(p)}`),{kind:"stamp",variant:"start",anchor:i,events:c,title:r>0?"session started":"capture begins",meta:h,failed:!1}}function Nk(t){if(t.event.kind!=="usage")return null;const a=t.event;if(a.inputTokens===null&&a.outputTokens===null)return{label:null};const i=[];if(a.inputTokens!==null){const r=a.cachedInputTokens!==null?` (cached ${us(a.cachedInputTokens)})`:"";i.push(`tokens in ${us(a.inputTokens)}${r}`)}return a.outputTokens!==null&&i.push(`out ${us(a.outputTokens)}`),a.reasoningTokens!==null&&i.push(`reasoning ${us(a.reasoningTokens)}`),{label:i.length>0?i.join(" · "):null}}function kk(t,a,i){const r=t[t.length-1];if(r===void 0)return null;let c=t.length;for(;c>0;){const y=t[c-1];if(y===void 0||y.event.kind!=="lifecycle"&&y.event.kind!=="usage")break;c-=1}const f=t.slice(c);let p=null;for(let y=f.length-1;y>=0;y-=1){const E=f[y];if(E!==void 0&&E.event.kind==="lifecycle"){p=E.event.state;break}}if(p===null)for(let y=t.length-1;y>=0;y-=1){const E=t[y];if(E!==void 0&&E.event.kind==="lifecycle"){p=E.event.state;break}}const h=t[0],v=h===void 0?null:Yt(r)-Yt(h),m=[];v!==null&&Number.isFinite(v)&&v>0&&m.push(Xo(v));for(let y=f.length-1;y>=0;y-=1){const E=f[y];if(E===void 0||E.event.kind!=="usage")continue;const S=Nk(E)?.label;S!=null&&m.push(S);break}const x=a.filter(y=>y.kind==="error").length;return x>0&&m.push(`${String(x)} ${x===1?"error":"errors"}`),i>0&&m.push(`${String(i)} unresolved ${i===1?"tool":"tools"}`),{kind:"stamp",variant:"end",anchor:r,events:f,title:p??"settled",meta:m,failed:p==="failed"}}function Ak(t){const a=[];let i=null;for(const r of t){if(r.kind==="stamp"||r.kind==="gap"){a.push(r);continue}const c=_i(r);let f=null,p=null;for(const h of c){const v=Yt(h);Number.isFinite(v)&&((f===null||v<f)&&(f=v),(p===null||v>p)&&(p=v))}if(f===null||p===null){a.push(r);continue}if(i!==null&&f-i>pk){const h=f-i;a.push({kind:"gap",durationMs:h,label:`${Xo(h)} quiet`})}a.push(r),i=i===null?p:Math.max(i,p)}return a}function Rk(t){return t.filter(a=>a.kind!=="stamp"&&a.kind!=="gap")}function yb(t,a={}){const i=a.laneSettled??Yh(t),c=_k(t).map(S=>Ah(S)?Ru(S.call,S.result,i):S),f=yk(c),p=xk(f);let h=Number.POSITIVE_INFINITY;for(const S of t)if(S.event.kind!=="lifecycle"){h=S.sequence;break}let v=Number.NEGATIVE_INFINITY;for(let S=t.length-1;S>=0;S-=1){const C=t[S];if(C===void 0)break;if(C.event.kind!=="lifecycle"&&C.event.kind!=="usage"){v=S+1<t.length?t[S+1]?.sequence??Number.NEGATIVE_INFINITY:Number.NEGATIVE_INFINITY;break}}const m=Sk(t,a),x=[];for(const S of p){if(S.kind==="tick"){const C=S.events[0]?.sequence??-1,N=(S.events[S.events.length-1]?.sequence??-1)<h,M=i&&C>=v;if(N||M)continue}x.push(S)}const y=x.filter(S=>S.kind==="tool"&&S.status==="unresolved").length,E=[];if(m!==null&&E.push(m),E.push(...Ak(x)),i){const S=kk(t,x,y);S!==null&&E.push(S)}return{items:E,laneSettled:i}}function Ax({lanes:t}){return l.jsxs("div",{"aria-label":"Session log lane",className:"session-log-viewer__lanes",role:"group",children:[l.jsx("span",{className:"session-log-viewer__lanes-label",children:"lane"}),t.map(a=>l.jsxs("button",{"aria-pressed":a.active,className:"session-log-viewer__lane-chip","data-status":a.status??"unknown",onClick:()=>a.onSelect(a.id),type:"button",children:[l.jsx("span",{"aria-hidden":"true",className:"session-log-viewer__lane-dot"}),a.label]},a.id))]})}const $o=500,Ek=$o*4,Tk=480,Ck=["all","messages","tools","reasoning","issues"];function Ok(t,a){return t.length<=a?t:t.slice(t.length-a)}function $k(t){switch(t.owner.family){case"workflow":return t.owner.runGeneration;case"activity":return t.owner.activityGeneration;case"context":return t.owner.contextGeneration}}function Cl(t,a){return`${t}-e${String(a)}`}function Mk(t,a){if(a.length===0)return[{text:t,hit:!1}];const i=[],r=t.toLowerCase();let c=0;for(;c<=t.length;){const f=r.indexOf(a,c);if(f<0){i.push({text:t.slice(c),hit:!1});break}f>c&&i.push({text:t.slice(c,f),hit:!1}),i.push({text:t.slice(f,f+a.length),hit:!0}),c=f+a.length}return i.some(f=>f.text.length>0)?i:[{text:t,hit:!1}]}function Xa({text:t,query:a}){const i=b.useMemo(()=>Mk(t,a.trim().toLowerCase()),[a,t]);return l.jsx(l.Fragment,{children:i.map((r,c)=>r.hit?l.jsx("mark",{className:"session-log-viewer__hit",children:r.text},c):l.jsx("span",{children:r.text},c))})}function vi({events:t}){const a=b.useMemo(()=>ok(t),[t]);return a.length===0?null:l.jsx("ul",{"aria-label":"Event fidelity",className:"session-log-viewer__chips",children:a.map(i=>l.jsx("li",{className:"session-log-viewer__chip","data-level":i.level,children:i.label},i.label))})}function Eu({kind:t}){return l.jsx("span",{"aria-hidden":"true",className:"session-log-viewer__node","data-node":t})}function Rx({event:t,originMs:a}){const i=a!==null&&Number.isFinite(Yt(t))?oi(Yt(t)-a):"—";return l.jsx("span",{className:"session-log-viewer__gutter-offset",title:t.timestamp,children:i})}function md({event:t,originMs:a}){const i=a!==null&&Number.isFinite(Yt(t))?oi(Yt(t)-a):"—";return l.jsx("span",{className:"session-log-viewer__inline-offset",title:t.timestamp,children:i})}function Ex({item:t,originMs:a,pinned:i,query:r}){const c=t.event,f=gi(c.event);return l.jsxs("div",{className:"session-log-viewer__card session-log-viewer__card--message",children:[l.jsxs("div",{className:"session-log-viewer__card-head",children:[l.jsx("strong",{className:"session-log-viewer__speaker",children:t.speaker}),l.jsx("span",{className:"session-log-viewer__seq",children:`#${String(c.sequence)}`}),l.jsx(md,{event:c,originMs:a}),i?l.jsx("span",{className:"session-log-viewer__pinned-chip",children:"pinned"}):null,l.jsx(vi,{events:[c]}),l.jsx("span",{className:"session-log-viewer__spacer"}),f.length===0?null:l.jsx("span",{className:"session-log-viewer__card-copy",children:l.jsx(ma,{label:`Copy ${t.speaker} message`,text:f})})]}),f.length===0?null:l.jsx(qk,{query:r,text:f})]})}const Lk=7.5,Ik=4;function Dk(t){const a=Number.parseFloat(getComputedStyle(t).fontSize);return Lk*(Number.isFinite(a)?a:16)}function zk(t){return t<1024?`${String(t)} B`:`${(t/1024).toFixed(1)} KiB`}function qk({query:t,text:a}){const r=`message-content-${b.useId()}`,c=b.useRef(null),[f,p]=b.useState(!1),[h,v]=b.useState(!1);return b.useLayoutEffect(()=>{const m=c.current;if(m===null)return;const x=()=>{const E=m.scrollHeight,S=Dk(m);p(E>S+Ik)};x();const y=typeof ResizeObserver>"u"?null:new ResizeObserver(x);return y!==null&&y.observe(m),()=>y?.disconnect()},[a]),l.jsxs("div",{className:"session-log-viewer__message-content","data-collapsed":(!h&&f).toString(),children:[l.jsx("pre",{className:"session-log-viewer__content session-log-viewer__message-body",id:r,ref:c,children:l.jsx(Xa,{text:a,query:t})}),f?l.jsx("button",{"aria-controls":r,"aria-expanded":h,className:"session-log-viewer__message-toggle",onClick:()=>v(m=>!m),type:"button",children:h?"collapse":`show all · ${zk(a.length)}`}):null]})}function Uk(t){return t==="succeeded"?"ok":t}function Bk(t){if(t===null)return null;const a=gi(t.event),i=a.includes(`
|
|
19
|
-
`)?a.slice(a.indexOf(`
|
|
20
|
-
`)+1):a;return i.trim().length===0?null:i}function Gk(t){return t.length<=150&&t.split(`
|
|
21
|
-
`).length<=3}function Hk(t){return(t.split(`
|
|
22
|
-
`).find(i=>i.trim().length>0)??t).replace(/\s+/g," ").trim()}function gd({open:t}){return l.jsx("span",{"aria-hidden":"true",className:"session-log-viewer__chevron","data-open":t})}function Tx({event:t,query:a}){const[i,r]=b.useState(!1),c=b.useId(),f=t.event.kind==="tool_call"?t.event.arguments:void 0;if(f===void 0)return null;if(f.omission!=="none"){const p=f.omission==="size_limit"?"size limit":f.omission==="structure_limit"?"structure limit":"invalid arguments";return l.jsxs("p",{className:"session-log-viewer__tool-output-meta",children:["Arguments omitted · ",p]})}return l.jsxs("div",{className:"session-log-viewer__tool-output",children:[l.jsxs("button",{"aria-controls":c,"aria-expanded":i,className:"session-log-viewer__tool-head","data-toggle":!0,onClick:()=>r(p=>!p),type:"button",children:["Arguments ",l.jsx(gd,{open:i})]}),i?l.jsxs("div",{id:c,children:[l.jsx(ma,{label:"Copy tool arguments",text:f.content}),l.jsx("pre",{className:"session-log-viewer__content session-log-viewer__tool-output-body","data-capped":"true",children:l.jsx(Xa,{text:f.content,query:a})})]}):null]})}function Cx({card:t,child:a,originMs:i,query:r}){const c=t.call.event.kind==="tool_call"?Hk(t.call.event.summary):`${t.toolName} · result — call outside the retained window`,f=Bk(t.result),p=f!==null&&Gk(f),[h,v]=b.useState(p),m=f!==null&&!p,x=f===null?0:f.split(`
|
|
23
|
-
`).length,y=l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"session-log-viewer__tool-tag",children:t.toolName}),l.jsx("span",{className:"session-log-viewer__tool-command",title:c,children:l.jsx(Xa,{text:c,query:r})}),l.jsx(vi,{events:t.fidelityEvents}),l.jsx("span",{className:"session-log-viewer__tool-meta",children:t.durationMs===null?"—":Xo(t.durationMs)}),l.jsx("span",{className:"session-log-viewer__tool-status","data-status":t.status,children:Uk(t.status)}),l.jsx(gd,{open:h&&m})]});return l.jsxs("div",{className:"session-log-viewer__card session-log-viewer__card--tool","data-child":a?"true":void 0,"data-status":t.status,children:[m?l.jsx("button",{"aria-expanded":h,className:"session-log-viewer__tool-head","data-toggle":!0,onClick:()=>v(E=>!E),type:"button",children:y}):l.jsxs("div",{className:"session-log-viewer__tool-head",children:[y,l.jsx("span",{className:"session-log-viewer__inline-offset",children:i===null?"":oi(Yt(t.call)-i)})]}),t.call.event.kind==="tool_call"&&t.call.event.arguments!==void 0?l.jsx(Tx,{event:t.call,query:r}):null,f!==null&&h?l.jsxs("div",{className:"session-log-viewer__tool-output",children:[l.jsxs("div",{className:"session-log-viewer__tool-output-meta",children:[l.jsx("span",{children:`output · ${String(x)} ${x===1?"line":"lines"}`}),l.jsx("span",{className:"session-log-viewer__spacer"}),l.jsx(ma,{label:`Copy ${t.toolName} output`,text:f})]}),l.jsx("pre",{className:"session-log-viewer__content session-log-viewer__tool-output-body","data-capped":x>12?"true":void 0,children:l.jsx(Xa,{text:f,query:r})})]}):null]})}function Vk({group:t,open:a,onToggle:i,query:r}){const c=b.useId();return l.jsxs("div",{className:"session-log-viewer__card session-log-viewer__card--group",children:[l.jsxs("button",{"aria-controls":c,"aria-expanded":a,className:"session-log-viewer__group-head","data-toggle":!0,onClick:i,type:"button",children:[l.jsx("span",{className:"session-log-viewer__group-summary",children:t.summary}),l.jsx("span",{className:"session-log-viewer__group-preview",title:t.preview,children:l.jsx(Xa,{text:t.preview,query:r})}),l.jsx("span",{className:"session-log-viewer__group-meta",children:`#${String(t.sequenceRange[0])}–#${String(t.sequenceRange[1])} · ${t.totalMs===null?"—":Xo(t.totalMs)}`}),l.jsx(gd,{open:a})]}),a?l.jsx("ul",{className:"session-log-viewer__group-children",id:c,children:t.cards.map(f=>l.jsx("li",{children:l.jsx(Cx,{card:f,child:!0,originMs:null,query:r})},f.callId))}):null]})}function Kk(t,a){if(t.resolution!==null&&t.resolution.event.kind==="approval_resolution"){const i=t.resolution.event.decision;return{word:i,tone:i==="approved"?"approved":"denied"}}return a?{word:"unresolved",tone:"unresolved"}:{word:"awaiting decision",tone:"pending"}}function Zk(t){return t.resolution!==null&&t.resolution.event.kind==="approval_resolution"?t.resolution.event.decision:"pending"}function Fk({item:t,originMs:a,settled:i,query:r}){const c=t.request??t.resolution;if(c===null)return l.jsx("div",{className:"session-log-viewer__card"});const f=t.request?.event.kind==="approval_request"?t.request.event:null,p=Kk(t,i),h=f!==null?f.action:"request outside the retained window",v=f!==null?`${f.risk} risk · ${f.approvalId}`:t.approvalId,m=t.request!==null&&t.resolution!==null?` · ${Xo(Yt(t.resolution)-Yt(t.request))} later`:"",x=_i(t).map(y=>gi(y.event)).join(`
|
|
24
|
-
`);return l.jsxs("div",{className:"session-log-viewer__card session-log-viewer__card--approval","data-decision":p.tone,children:[l.jsxs("div",{className:"session-log-viewer__card-head",children:[l.jsx("strong",{className:"session-log-viewer__speaker",children:"approval"}),l.jsx("span",{className:"session-log-viewer__seq",children:`#${String(c.sequence)}`}),l.jsx(md,{event:c,originMs:a}),l.jsx("span",{className:"session-log-viewer__sub",children:v}),l.jsx(vi,{events:t.fidelityEvents}),l.jsx("span",{className:"session-log-viewer__spacer"}),l.jsx("span",{className:"session-log-viewer__decision","data-tone":p.tone,children:p.word==="awaiting decision"||p.tone==="unresolved"?p.word:`${p.word}${m}`}),l.jsx("span",{className:"session-log-viewer__card-copy",children:l.jsx(ma,{label:"Copy approval",text:x})})]}),l.jsx("pre",{className:"session-log-viewer__content session-log-viewer__card-body",children:l.jsx(Xa,{text:h,query:r})})]})}function Yk({item:t,originMs:a,query:i}){const r=t.event,c=r.event.kind==="error"?r.event:null,f=gi(r.event);return l.jsxs("div",{className:"session-log-viewer__card session-log-viewer__card--error",role:"alert",children:[l.jsxs("div",{className:"session-log-viewer__card-head",children:[l.jsx("strong",{className:"session-log-viewer__speaker session-log-viewer__speaker--fail",children:"error"}),l.jsx("span",{className:"session-log-viewer__seq",children:`#${String(r.sequence)}`}),l.jsx(md,{event:r,originMs:a}),l.jsx("span",{className:"session-log-viewer__sub",children:c===null?"":`${c.code} · ${c.retryable?"retryable":"not retryable"}`}),l.jsx(vi,{events:[r]}),l.jsx("span",{className:"session-log-viewer__spacer"}),l.jsx("span",{className:"session-log-viewer__card-copy",children:l.jsx(ma,{label:"Copy error",text:f})})]}),l.jsx("pre",{className:"session-log-viewer__content session-log-viewer__card-body",children:l.jsx(Xa,{text:c===null?f:c.message,query:i})})]})}function Xk({item:t,query:a}){const i=t.events[0],r=t.events[t.events.length-1];if(i===void 0||r===void 0)return l.jsx("div",{});const c=t.sequenceRange!==null,f=c?`#${String(t.sequenceRange[0])}–#${String(t.sequenceRange[1])}`:`#${String(i.sequence)}`;let p,h;switch(i.event.kind){case"lifecycle":p="lifecycle",h=i.event.state;break;case"usage":p="usage",h=`in ${us(i.event.inputTokens)} · out ${us(i.event.outputTokens)}`;break;default:p="unknown event",h=i.event.kind==="unknown"&&i.event.originalKind==="producer_payload_omitted"?i.event.summary:`${i.event.kind==="unknown"?i.event.originalKind:""} — omitted`;break}return l.jsxs("div",{className:"session-log-viewer__tick",children:[l.jsxs("span",{className:"session-log-viewer__tick-text",children:[`${f} · ${p} · `,l.jsx(Xa,{text:h,query:a}),c?` · ×${String(t.events.length)}`:""]}),l.jsx(vi,{events:t.events})]})}function Pk({item:t}){return l.jsxs("div",{className:"session-log-viewer__stamp","data-variant":t.variant,"data-failed":t.failed?"true":void 0,"data-testid":"session-log-conversation-stamp",children:[l.jsx("strong",{className:"session-log-viewer__stamp-title",children:t.title}),t.meta.map(a=>l.jsx("span",{className:"session-log-viewer__stamp-meta",children:a},a)),l.jsx(vi,{events:t.events})]})}function Qk({item:t}){return l.jsxs("div",{className:"session-log-viewer__gap","data-testid":"session-log-conversation-gap",children:[l.jsx("span",{className:"session-log-viewer__gap-label",children:t.label}),l.jsx("span",{"aria-hidden":"true",className:"session-log-viewer__gap-rule"})]})}function Jk({instanceId:t,item:a,originMs:i,settled:r,query:c,openGroups:f,onToggleGroup:p}){const h=a.kind==="stamp"?a.anchor:_i(a)[0],v=a.kind==="stamp"||h===void 0?-1:h.sequence,m=a.kind==="stamp"&&h!==void 0?`${Cl(t,h.sequence)}-${a.variant}`:v>=0?Cl(t,v):void 0;let x="tick";switch(a.kind){case"message":x=a.speaker==="prompt"?"prompt":"assistant";break;case"reasoning":case"tool":case"group":case"approval":case"error":x=a.kind==="group"?"group":a.kind;break;case"stamp":x=a.variant==="start"?"stamp-start":"stamp-end";break;case"tick":case"gap":x=a.kind;break}const y=a.kind==="gap",E=a.kind==="stamp"||y,S=a.kind==="message"?"session-log-conversation-event":a.kind==="tool"?"session-log-conversation-tool":a.kind==="group"?"session-log-conversation-group":a.kind==="approval"?"session-log-conversation-approval":a.kind==="error"?"session-log-conversation-error":a.kind==="reasoning"?"session-log-conversation-reasoning":a.kind==="tick"?"session-log-conversation-system":void 0;return l.jsxs("li",{className:`session-log-viewer__entry session-log-viewer__entry--${a.kind}`,"data-event-kind":a.kind==="tick"?a.eventKind:a.kind==="message"||a.kind==="reasoning"||a.kind==="error"?h?.event.kind:a.kind,"data-seq":v>=0?String(v):void 0,"data-status":a.kind==="tool"?a.status:void 0,...a.kind==="message"&&h!==void 0?{"data-message-role":h.event.kind}:{},...a.kind==="approval"?{"data-decision":Zk(a)}:{},...a.kind==="group"?{"data-sequence-range":`${a.sequenceRange[0]}-${a.sequenceRange[1]}`}:{},...a.kind==="tick"&&a.sequenceRange!==null?{"data-sequence-range":`${a.sequenceRange[0]}-${a.sequenceRange[1]}`}:{},"data-testid":S,id:m,tabIndex:E?void 0:-1,children:[y?null:l.jsx(Eu,{kind:x}),y||h===void 0?null:l.jsx(Rx,{event:h,originMs:i}),l.jsx("div",{className:"session-log-viewer__entry-content",children:a.kind==="message"?l.jsx(Ex,{item:a,originMs:i,pinned:!1,query:c}):a.kind==="reasoning"?l.jsxs("div",{className:"session-log-viewer__reasoning",children:[l.jsxs("div",{className:"session-log-viewer__reasoning-head",children:[l.jsx("span",{children:"reasoning"}),l.jsx("span",{className:"session-log-viewer__seq",children:`#${String(a.event.sequence)}`}),l.jsx(md,{event:a.event,originMs:i}),a.foldedCount>1?l.jsx("span",{children:`×${String(a.foldedCount)}`}):null]}),l.jsx("pre",{className:"session-log-viewer__content session-log-viewer__reasoning-body",children:l.jsx(Xa,{text:a.event.event.kind==="reasoning"?a.event.event.summary.replaceAll("**",""):"",query:c})})]}):a.kind==="tool"?l.jsx(Cx,{card:a,child:!1,originMs:i,query:c}):a.kind==="group"?l.jsx(Vk,{group:a,open:f.has(`group-${String(a.sequenceRange[0])}`),onToggle:()=>p(`group-${String(a.sequenceRange[0])}`),query:c}):a.kind==="approval"?l.jsx(Fk,{item:a,originMs:i,settled:r,query:c}):a.kind==="error"?l.jsx(Yk,{item:a,originMs:i,query:c}):a.kind==="tick"?l.jsx(Xk,{item:a,query:c}):a.kind==="stamp"?l.jsx(Pk,{item:a}):a.kind==="gap"?l.jsx(Qk,{item:a}):null})]})}function Wk(t,a,i,r){switch(t.event.kind){case"user":return"prompt";case"assistant":return"assistant";case"reasoning":return"reasoning";case"tool_call":{const c=a.get(t.event.callId);return c===void 0||c.event.kind!=="tool_result"?r?"tool-unresolved":"tool-running":c.event.outcome==="succeeded"?"tool-ok":c.event.outcome==="cancelled"?"tool-cancelled":"tool-failed"}case"approval_request":{const c=i.get(t.event.approvalId);return c===void 0?r?"approval-unresolved":"approval-pending":c.event.kind==="approval_resolution"&&c.event.decision==="approved"?"approval-approved":"approval-denied"}case"error":return"error";default:return"assistant"}}function e1(t){return t.startsWith("tool-")?`tool · ${t.slice(5)}`:t.startsWith("approval-")?`approval · ${t.slice(9)}`:t}function xb(t,a){const i=t.event;return gi(i).toLowerCase().includes(a)||i.kind==="tool_call"&&i.arguments?.omission==="none"&&i.arguments.content.toLowerCase().includes(a)}function t1(t){const r=(gi(t.event).split(`
|
|
25
|
-
`).find(c=>c.trim().length>0)??"").replace(/\s+/g," ").trim();return r.length>64?`${r.slice(0,63)}…`:r}const wb={error:0,"tool-failed":1,"approval-denied":2,"tool-unresolved":3,"approval-unresolved":4,"approval-pending":5,"tool-running":6,"approval-approved":7,"tool-ok":8,assistant:9,prompt:10,reasoning:11,"tool-cancelled":12};function n1(t){if(t.length<=Tk)return t;const a=new Map;for(const i of t){const r=String(Math.round(i.pct*4)),c=a.get(r);(c===void 0||wb[i.kind]<wb[c.kind])&&a.set(r,i)}return[...a.values()].sort((i,r)=>i.pct-r.pct)}function a1(t){const a=t/1e3;return a<=90?15e3:a<=300?3e4:a<=900?6e4:a<=1800?3e5:a<=7200?6e5:18e5}function Ao(t,a,i){return Math.max(0,Math.min(100,(t-a)/i*100))}function jb(t,a){const i=t.find(r=>r.sequence===a);return i===void 0?null:Yt(i)}function s1({event:t,instanceId:a,originMs:i,query:r}){const[c,f]=b.useState(!1),p=gi(t.event),h=dk[t.event.kind],v=fk(t),m=i!==null?oi(Math.max(0,Yt(t)-i)):t.timestamp.slice(11,19);return l.jsxs("li",{className:"session-log-viewer__ledger-row","data-event-kind":t.event.kind,"data-sequence":t.sequence,"data-testid":"session-log-event",id:Cl(a,t.sequence),tabIndex:-1,children:[l.jsxs("button",{"aria-expanded":c,className:"session-log-viewer__ledger-head","data-toggle":!0,onClick:()=>f(x=>!x),type:"button",children:[l.jsx("span",{className:"session-log-viewer__ledger-seq",children:`#${String(t.sequence)}`}),l.jsx("time",{className:"session-log-viewer__ledger-time",dateTime:t.timestamp,title:t.timestamp,children:m}),l.jsx("span",{className:"session-log-viewer__chip session-log-viewer__ledger-kind",children:h}),l.jsx("span",{className:"session-log-viewer__ledger-summary",title:v,children:l.jsx(Xa,{text:v,query:r})}),l.jsx(vi,{events:[t]}),l.jsx(gd,{open:c})]}),c?l.jsxs("div",{children:[l.jsx("pre",{className:"session-log-viewer__ledger-body",children:l.jsx(Xa,{text:p,query:r})}),t.event.kind==="tool_call"&&t.event.arguments!==void 0?l.jsx(Tx,{event:t,query:r}):null]}):null]})}function l1(){const t=[{caps:["j","k"],label:"move"},{caps:["↵"],label:"expand"},{caps:["c"],label:"copy"},{caps:["/"],label:"find"},{caps:["esc"],label:"clear"}];return l.jsx(l.Fragment,{children:t.map(a=>l.jsxs("span",{className:"session-log-viewer__foot-key",children:[a.caps.map(i=>l.jsx("kbd",{className:"session-log-viewer__kbd",children:i},i)),a.label]},a.label))})}function i1({active:t=!0,fill:a=!1,lanes:i,page:r}){const c=b.useId(),f=`${c}-session-log-title`,[p,h]=b.useState("conversation"),[v,m]=b.useState($o),[x,y]=b.useState("all"),[E,S]=b.useState(""),[C,T]=b.useState(null),[N,M]=b.useState(!1),[k,z]=b.useState(!1),[R,B]=b.useState(()=>new Set),[q,Z]=b.useState(!1),[ae,oe]=b.useState(null),[P,ue]=b.useState({lo:null,hi:null,atBottom:!0}),_e=`${r.owner.family}\0${$k(r)}\0${r.lane.laneId}`;b.useEffect(()=>{m($o),y("all"),S(""),T(null),B(new Set)},[_e]);const me=b.useMemo(()=>rk(r),[r]),be=b.useMemo(()=>Yh(me.events),[me.events]),ve=me.events.length,$=ve>0,ee=$?Yt(me.events[0]):null,ce=b.useMemo(()=>{const I=new Map;for(const xe of me.events)xe.event.kind==="tool_result"&&I.set(xe.event.callId,xe);return I},[me.events]),de=b.useMemo(()=>Ok(me.events,v),[me.events,v]),ye=b.useMemo(()=>yb(de,{laneSettled:be,floorSequence:r.floorSequence,includeOwnerFacts:(i?.length??1)>1}),[i?.length,r.floorSequence,be,de]),j=b.useMemo(()=>me.events.find(I=>I.event.kind==="user")??null,[me.events]),L=de[0]?.sequence??0,U=j!==null&&j.sequence<L?j:null,Q=j===null&&r.floorSequence>0,he=Math.max(0,ve-de.length-(U!==null?1:0)),F=b.useCallback(()=>{qe.current="prepend",m(I=>Math.min(I+$o,ve))},[ve]),ge=b.useCallback(()=>{qe.current="prepend",m(ve)},[ve]),Ve=b.useCallback(I=>{B(xe=>{const je=new Set(xe);return je.has(I)?je.delete(I):je.add(I),je})},[]),Se=b.useMemo(()=>{const I=yb(me.events,{laneSettled:be});return Rk(I.items).filter(vb).length},[be,me.events]),Re=b.useMemo(()=>{let I=0,xe=0,je=0;for(const ke of me.events)switch(ke.event.kind){case"user":case"assistant":I+=1;break;case"tool_call":case"tool_result":xe+=1;break;case"reasoning":je+=1;break}return{all:ve,messages:I,tools:xe,reasoning:je,issues:Se}},[Se,ve,me.events]),Pe=E.trim().toLowerCase(),Gt=b.useCallback(I=>{switch(x){case"all":return!0;case"messages":return I.kind==="message";case"tools":return I.kind==="tool"||I.kind==="group";case"reasoning":return I.kind==="reasoning";case"issues":return vb(I)}},[x]),Vt=b.useCallback(I=>Pe.length===0?!0:_i(I).some(xe=>xb(xe,Pe)),[Pe]),kt=b.useMemo(()=>{const I=x==="all"&&Pe.length===0;return ye.items.filter(xe=>xe.kind==="stamp"||xe.kind==="gap"?I:Gt(xe)&&Vt(xe))},[ye.items,x,Vt,Gt,Pe.length]),Xt=b.useCallback(I=>{switch(x){case"all":return!0;case"messages":return I.event.kind==="user"||I.event.kind==="assistant";case"tools":return I.event.kind==="tool_call"||I.event.kind==="tool_result";case"reasoning":return I.event.kind==="reasoning";case"issues":return o1(I,ce,be)}},[x,ce,be]),$t=b.useCallback(I=>Pe.length===0||xb(I,Pe),[Pe]),Pt=b.useMemo(()=>de.filter(I=>Xt(I)&&$t(I)),[$t,Xt,de]),Qt=x!=="all"||Pe.length>0,Kt=he>0?`the latest ${String(de.length)} of ${String(ve)} events`:"this lane",sn=Pe.length>0?`no matches for “${E.trim()}”${x!=="all"?` in ${x}`:""} · searched ${Kt}`:`no ${x} in ${Kt}`,Mn=$&&Qt&&(p==="conversation"&&kt.length===0||p==="ledger"&&Pt.length===0),ln=b.useCallback(()=>{S(""),T(null)},[]),Jt=b.useMemo(()=>{if(!$)return null;const I=me.events[0],xe=me.events[ve-1],je=Yt(I),ke=be?Yt(xe):Date.now(),Oe=Math.max(1e3,ke-je),Fe=new Map;for(const Ye of me.events)Ye.event.kind==="approval_resolution"&&Fe.set(Ye.event.approvalId,Ye);const Je=me.events.filter(Ye=>Ye.event.kind==="user"||Ye.event.kind==="assistant"||Ye.event.kind==="reasoning"||Ye.event.kind==="tool_call"||Ye.event.kind==="approval_request"||Ye.event.kind==="error").map(Ye=>{const qt=Wk(Ye,ce,Fe,be),An=Yt(Ye),mn=Number.isFinite(An)?oi(An-je):"",Ot=e1(qt),rn=t1(Ye);return{seq:Ye.sequence,pct:Ao(An,je,Oe),kind:qt,ariaLabel:`#${String(Ye.sequence)} · ${Ot} · ${mn}${rn.length>0?` — ${rn}`:""}`,passes:Xt(Ye)&&$t(Ye),loaded:Ye.sequence>=L||U!==null&&Ye.sequence===U.sequence}}),Ct=a1(Oe),vn=[];for(let Ye=Ct;Ye<Oe;Ye+=Ct)vn.push({pct:Ao(je+Ye,je,Oe)});return{marks:n1(Je),ticks:vn,spanMs:Oe,originMs:je,firstTimeMs:Yt(I),loadedLeftPct:Ao(Yt(de[0]??I),je,Oe),axisLeft:`${I.timestamp.slice(11,19)} · +0:00`,axisRight:be?`${oi(Math.max(0,Yt(xe)-je))} · ${xe.timestamp.slice(11,19)}`:`now · ${oi(ke-je)}`,live:!be}},[$t,Xt,$,U,ce,be,ve,me.events,de,L]),lt=b.useRef(null),Be=b.useRef(null),le=b.useRef(!0),Ae=b.useRef(0),Le=b.useRef(null),qe=b.useRef("bottom"),it=b.useRef(null),Et=b.useRef(null),ut=b.useRef(!0),Qe=b.useRef(t),dt=b.useRef(!1),wt=b.useRef(null),Tt=b.useRef(!1),pn=b.useCallback(()=>{const I=lt.current;if(I===null||I.clientHeight===0)return;const xe=I.getBoundingClientRect();let je=null,ke=null,Oe=0;for(const Je of I.querySelectorAll("[data-seq]")){const Ct=Number.parseInt(Je.dataset.seq??"",10);if(!Number.isFinite(Ct))continue;const vn=Je.getBoundingClientRect();vn.bottom>xe.top+2&&vn.top<xe.bottom-2&&(je===null&&(je=Ct,Oe=vn.top-xe.top),ke=Ct)}const Fe=I.scrollHeight-(I.scrollTop+I.clientHeight)<30;le.current=Fe,wt.current=je===null?null:{seq:je,top:Oe},ue(Je=>Je.lo===je&&Je.hi===ke&&Je.atBottom===Fe?Je:{lo:je,hi:ke,atBottom:Fe})},[]),kn=b.useCallback(I=>{I.clientHeight!==0&&(Et.current=I.scrollTop,ut.current=le.current)},[]);b.useLayoutEffect(()=>{!Qe.current&&t&&(dt.current=!0),Qe.current=t},[t]),b.useLayoutEffect(()=>{const I=lt.current;if(I===null||I.clientHeight===0)return;const xe=Le.current!==_e,je=qe.current,ke=Et.current,Oe=dt.current&&!xe&&je!=="bottom"&&ke!==null;if(dt.current=!1,Oe){I.scrollTop=ut.current?I.scrollHeight:ke,Ae.current=I.scrollHeight,it.current=ve,Tt.current=!1,pn(),kn(I);return}if(xe)Le.current=_e,it.current=ve;else{const Ye=it.current;if(it.current=ve,Ye!==null&&ve>Ye&&!le.current){const qt=ve-Ye,An=Math.min(v,Ye)+qt,mn=Math.max(v,Math.min(An,Ek));if(Tt.current=!0,mn!==v){m(mn);return}}}const Fe=Ae.current,Je=I.scrollHeight>Fe,Ct=Fe>0&&Fe-(I.scrollTop+I.clientHeight)<30,vn=Tt.current;if(Tt.current=!1,je==="bottom"||xe)I.scrollTop=I.scrollHeight,je==="bottom"&&(qe.current=null);else if(je==="prepend")Je&&(I.scrollTop+=I.scrollHeight-Fe),qe.current=null;else if(Je&&Ct)I.scrollTop=I.scrollHeight;else if(vn&&wt.current!==null){const Ye=wt.current,qt=I.querySelector(`[data-seq="${String(Ye.seq)}"]`);if(qt!==null){const An=qt.getBoundingClientRect().top-I.getBoundingClientRect().top-Ye.top;An!==0&&(I.scrollTop+=An)}}Ae.current=I.scrollHeight,pn(),kn(I)}),b.useEffect(()=>{qe.current="bottom"},[p,x,Pe,_e]),b.useEffect(()=>()=>{Be.current!==null&&cancelAnimationFrame(Be.current)},[]);const hn=b.useCallback(()=>{qe.current=null;const I=lt.current;I!==null&&I.clientHeight>0&&(le.current=I.scrollHeight-(I.scrollTop+I.clientHeight)<30,kn(I)),Be.current===null&&(Be.current=requestAnimationFrame(()=>{Be.current=null,pn()}))},[pn,kn]),Wt=b.useCallback(()=>{const I=lt.current;I!==null&&(I.scrollTop=I.scrollHeight,pn())},[pn]),ht=b.useCallback(I=>{const xe=lt.current;if(xe===null)return;const je=I.getBoundingClientRect(),ke=xe.getBoundingClientRect();je.top<ke.top+8?xe.scrollTop-=ke.top+8-je.top:je.bottom>ke.bottom-8&&(xe.scrollTop+=je.bottom-ke.bottom+8)},[]),en=b.useCallback(I=>{qe.current=null,T(I),I<L&&I!==U?.sequence&&m(ve),y("all"),h("conversation"),requestAnimationFrame(()=>{const xe=document.getElementById(Cl(c,I));xe!==null&&(ht(xe),pn())})},[ht,c,pn,U?.sequence,ve,L]);b.useEffect(()=>{if(C!==null)for(const I of ye.items){if(I.kind!=="group"||C<I.sequenceRange[0]||C>I.sequenceRange[1])continue;const xe=`group-${String(I.sequenceRange[0])}`;R.has(xe)||Ve(xe)}},[ye.items,C,R,Ve]);const At=b.useRef(null),Ln=b.useCallback(()=>{z(!0),requestAnimationFrame(()=>At.current?.focus())},[]),Dt=b.useCallback(I=>{const xe=lt.current;if(xe===null)return;const je=[...xe.querySelectorAll("[data-seq]")].filter(Oe=>Oe.tagName==="LI"&&Oe.hasAttribute("tabindex")).sort((Oe,Fe)=>Number.parseInt(Oe.dataset.seq??"0",10)-Number.parseInt(Fe.dataset.seq??"0",10));if(je.length===0)return;let ke;if(I==="home")ke=je[0];else if(I==="end")ke=je[je.length-1];else{const Oe=C===null?-1:je.findIndex(Ct=>Ct.dataset.seq===String(C)),Fe=I>0?0:je.length-1,Je=Oe<0?Fe:Math.max(0,Math.min(je.length-1,Oe+I));ke=je[Je]??je[Fe]}ke.focus(),T(Number.parseInt(ke.dataset.seq??"",10)),ht(ke)},[ht,C]),rt=b.useCallback(I=>{if(I.metaKey||I.ctrlKey||I.altKey)return;const xe=I.target;if(xe instanceof HTMLElement&&(xe.isContentEditable||xe.closest("input,textarea")!==null))return;const je=xe instanceof HTMLElement&&xe.closest("button")!==null;switch(I.key){case"j":I.preventDefault(),Dt(1);break;case"k":I.preventDefault(),Dt(-1);break;case"ArrowDown":if(je)return;I.preventDefault(),Dt(1);break;case"ArrowUp":if(je)return;I.preventDefault(),Dt(-1);break;case"Home":if(xe!==I.currentTarget)return;I.preventDefault(),Dt("home");break;case"End":if(xe!==I.currentTarget)return;I.preventDefault(),Dt("end");break;case"Enter":case" ":{if(je||C===null)return;const Oe=document.getElementById(Cl(c,C))?.querySelector("[data-toggle]")??null;Oe!==null&&(I.preventDefault(),Oe.click());break}case"c":{if(C===null)return;const Oe=document.getElementById(Cl(c,C))?.querySelector(".copy-control__button")??null;Oe!==null&&Oe.click();break}case"/":I.preventDefault(),Ln();break;case"Escape":T(null),E.length>0&&S("");break}},[Ln,C,c,Dt,E]),zt=b.useMemo(()=>p==="conversation"?kt.filter(I=>I.kind!=="stamp"&&I.kind!=="gap").map(Bp):Pt.map(I=>I.sequence),[p,Pt,kt]),Gn=b.useCallback(I=>{if(I.key==="Escape"){S(""),T(null),I.currentTarget.blur();return}if(I.key!=="Enter"&&I.key!=="ArrowDown"&&I.key!=="ArrowUp")return;I.preventDefault();const xe=zt;if(xe.length===0)return;const je=C===null?-1:xe.indexOf(C),ke=I.shiftKey||I.key==="ArrowUp",Oe=Ct=>(Ct%xe.length+xe.length)%xe.length,Fe=je<0?ke?xe.length-1:0:Oe(je+(ke?-1:1)),Je=xe[Fe];Je!==void 0&&(T(Je),qe.current=null,requestAnimationFrame(()=>{const Ct=document.getElementById(Cl(c,Je));Ct!==null&&(ht(Ct),pn())}))},[ht,C,c,zt,pn]),sa=b.useMemo(()=>{if(Pe.length===0||zt.length===0)return null;if(C===null)return`${String(zt.length)} ${zt.length===1?"match":"matches"}`;const I=zt.indexOf(C);return I<0?`${String(zt.length)} ${zt.length===1?"match":"matches"}`:`${String(I+1)} of ${String(zt.length)}`},[C,zt,Pe.length]),Fn=b.useRef(null);b.useLayoutEffect(()=>{const I=Fn.current;if(I===null)return;for(const ke of I.querySelectorAll("[data-mark-pct]"))ke.style.setProperty("--mark-left",`${ke.dataset.markPct??"0"}%`);for(const ke of I.querySelectorAll("[data-tick-pct]"))ke.style.setProperty("--tick-left",`${ke.dataset.tickPct??"0"}%`);const xe=I.querySelector("[data-loaded]");xe!==null&&xe.style.setProperty("--loaded-left",`${I.dataset.loadedLeft??"0"}%`);const je=I.querySelector("[data-tip]");je!==null&&ae!==null&&(je.style.setProperty("--tip-left",`${String(ae.pct)}%`),je.dataset.side=ae.pct>=50?"right":"left")}),b.useLayoutEffect(()=>{const I=Fn.current;if(I===null)return;const xe=I.querySelector("[data-vp]");if(xe===null)return;const je=r1(me.events),ke=Number.parseFloat(I.dataset.spanMs??"0")||1e3,Oe=je===null||P.lo===null?null:jb(me.events,P.lo),Fe=je===null||P.hi===null?null:jb(me.events,P.hi);if(Oe===null||Fe===null){xe.dataset.empty="true";return}delete xe.dataset.empty;const Je=Ao(Oe,je,ke),Ct=Ao(Fe,je,ke);xe.style.setProperty("--vp-left",`${String(Je)}%`),xe.style.setProperty("--vp-width",`${String(Math.max(1.2,Ct-Je))}%`)});const Ia=me.availabilityState!=="available"||me.gapMessage!==null,Da=me.unavailableMessage!==null,za=`requested sequence ${String(r.requestedSequence)} · floor ${String(r.floorSequence)} · next cursor ${String(r.nextSequence)} · schema session-log-v1 · authority observability_only · lane ${r.lane.laneId}`,Pa=he>0?l.jsxs("li",{className:"session-log-viewer__earlier",children:[l.jsx("button",{className:"session-log-viewer__earlier-button",onClick:F,type:"button",children:`show earlier ${String(Math.min($o,he))} events`}),l.jsx("span",{className:"session-log-viewer__earlier-note",children:`latest ${String(de.length)} of ${String(ve)}`})]}):null,la=Mn?l.jsxs("li",{className:"session-log-viewer__empty-find",role:"status",children:[l.jsx("span",{className:"session-log-viewer__empty-text",children:sn}),l.jsx("span",{className:"session-log-viewer__spacer"}),Pe.length>0?l.jsx("button",{className:"session-log-viewer__bracket",onClick:x==="all"?ln:()=>{ln(),y("all")},type:"button",children:x==="all"?"[ clear find ]":"[ clear find and filter ]"}):l.jsx("button",{className:"session-log-viewer__bracket",onClick:()=>y("all"),type:"button",children:"[ show all ]"}),he>0?l.jsx("button",{className:"session-log-viewer__bracket",onClick:ge,type:"button",children:`[ load all ${String(ve)} events ]`}):null]}):null;return l.jsxs("section",{"aria-labelledby":f,className:"session-log-viewer","data-fill":a?"true":void 0,"data-view":p,children:[l.jsxs("div",{className:"session-log-viewer__head",children:[l.jsxs("div",{className:"session-log-viewer__title-row",children:[l.jsxs("h2",{"aria-label":"Session conversation",className:"session-log-viewer__specimen",id:f,children:[l.jsx("span",{"aria-hidden":"true",className:"session-log-viewer__specimen-label session-log-viewer__specimen-label--desktop",children:"Session conversation"}),l.jsx("span",{"aria-hidden":"true",className:"session-log-viewer__specimen-label session-log-viewer__specimen-label--phone",children:"Conversation"})]}),l.jsxs("button",{"aria-controls":`${c}-facts`,"aria-expanded":N,className:"session-log-viewer__facts-toggle","data-testid":"session-log-facts-toggle",onClick:()=>M(I=>!I),type:"button",children:[l.jsx("span",{className:"session-log-viewer__facts-toggle-label",children:N?"[ hide ]":"[ facts ]"}),l.jsx("span",{"aria-hidden":"true",className:"session-log-viewer__facts-toggle-chevron","data-open":N.toString()})]}),$?l.jsx("div",{"aria-label":"Session log views",className:"session-log-viewer__view-switch",role:"tablist",children:["conversation","ledger"].map(I=>l.jsx("button",{"aria-controls":`${c}-${I}-panel`,"aria-selected":p===I,className:"session-log-viewer__view-switch-button","data-active":(p===I).toString(),id:`${c}-${I}-tab`,onClick:()=>h(I),role:"tab",type:"button",children:I},I))}):null]}),N?l.jsx("p",{className:"session-log-viewer__facts-line",id:`${c}-facts`,children:za}):null,i!==void 0&&i.length>1?l.jsx(Ax,{lanes:i}):null,$&&Jt!==null?l.jsxs("div",{className:"session-log-viewer__strip-block",children:[l.jsxs("div",{className:"session-log-viewer__strip-row",children:[l.jsx("span",{className:"session-log-viewer__axis-label",children:Jt.axisLeft}),l.jsxs("div",{"aria-label":"Session strip — click a mark to jump",className:"session-log-viewer__strip","data-loaded-left":String(Jt.loadedLeftPct),"data-span-ms":String(Jt.spanMs),ref:Fn,role:"group",children:[l.jsx("span",{"aria-hidden":"true",className:"session-log-viewer__strip-rail"}),l.jsx("span",{"aria-hidden":"true",className:"session-log-viewer__strip-loaded","data-loaded":!0}),l.jsx("span",{"aria-hidden":"true",className:"session-log-viewer__strip-vp","data-vp":!0}),Jt.ticks.map((I,xe)=>l.jsx("span",{"aria-hidden":"true",className:"session-log-viewer__strip-tick","data-tick-pct":String(I.pct)},xe)),Jt.marks.map(I=>l.jsx("button",{"aria-label":I.ariaLabel,className:"session-log-viewer__strip-mark","data-mark-kind":I.kind,"data-mark-pct":String(I.pct),"data-dim":I.passes?void 0:"true","data-outside":I.loaded?void 0:"true","data-focused":C===I.seq?"true":void 0,"data-testid":"session-log-strip-mark",onBlur:()=>oe(xe=>xe?.seq===I.seq?null:xe),onClick:()=>en(I.seq),onFocus:()=>oe({seq:I.seq,pct:I.pct}),onMouseEnter:()=>oe({seq:I.seq,pct:I.pct}),onMouseLeave:()=>oe(xe=>xe?.seq===I.seq?null:xe),type:"button",children:l.jsx("span",{"aria-hidden":"true",className:"session-log-viewer__strip-glyph"})},I.seq)),Jt.live?l.jsx("span",{"aria-hidden":"true",className:"session-log-viewer__strip-now","data-now":!0}):null,ae!==null?l.jsx("span",{className:"session-log-viewer__strip-tip","data-tip":!0,role:"tooltip",children:Jt.marks.find(I=>I.seq===ae.seq)?.ariaLabel??""}):null]}),l.jsx("span",{className:"session-log-viewer__axis-label",children:Jt.axisRight})]}),l.jsxs("div",{className:"session-log-viewer__strip-under",children:[l.jsx("span",{className:"session-log-viewer__axis-label",children:Jt.axisLeft}),l.jsx("span",{className:"session-log-viewer__axis-label",children:Jt.axisRight})]})]}):null,$?l.jsxs("div",{className:"session-log-viewer__controls","data-find-open":k.toString(),children:[l.jsx("div",{"aria-label":"Filter transcript",className:"session-log-viewer__filters",role:"group",children:Ck.map(I=>l.jsxs("button",{"aria-pressed":x===I,className:"session-log-viewer__filter-chip","data-active":(x===I).toString(),"data-testid":"session-log-filter-chip",onClick:()=>{y(I),T(null)},type:"button",children:[I,l.jsx("span",{className:"session-log-viewer__filter-count","data-fail":(I==="issues"&&Re.issues>0).toString(),children:String(Re[I])})]},I))}),sa!==null?l.jsx("span",{className:"session-log-viewer__match-note",role:"status",children:sa}):null,l.jsxs("div",{className:"session-log-viewer__find",children:[l.jsx("button",{"aria-label":"find in transcript",className:"session-log-viewer__find-open",onClick:Ln,type:"button",children:l.jsx("span",{"aria-hidden":"true",className:"session-log-viewer__find-glyph"})}),l.jsxs("div",{className:"session-log-viewer__find-input-wrap",children:[l.jsx("input",{"aria-label":"find in transcript",className:"session-log-viewer__find-input","data-testid":"session-log-find-input",onChange:I=>{S(I.target.value),T(null)},onKeyDown:Gn,placeholder:"find in transcript",ref:At,type:"text",value:E}),E.length>0?l.jsx("button",{"aria-label":"clear find",className:"session-log-viewer__find-clear",onClick:ln,type:"button",children:"×"}):l.jsx("span",{"aria-hidden":"true",className:"session-log-viewer__find-kbd",children:"/"})]}),l.jsx("button",{className:"session-log-viewer__find-done",onClick:()=>{z(!1),ln()},type:"button",children:"done"})]})]}):null,Ia||Da?l.jsx("section",{"aria-label":"Session log availability",className:"session-log-viewer__availability","data-availability":me.availabilityState,role:"status",children:Da?l.jsxs(l.Fragment,{children:[l.jsx("strong",{className:"session-log-viewer__availability-word",children:me.availabilityLabel}),l.jsx("p",{className:"session-log-viewer__unavailable",children:me.unavailableMessage})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"session-log-viewer__availability-line",children:[l.jsx("span",{"aria-hidden":"true",className:"session-log-viewer__availability-dot"}),l.jsx("strong",{className:"session-log-viewer__availability-word",children:me.availabilityLabel}),me.reasons.length===0?null:l.jsx("ul",{className:"session-log-viewer__chips",children:me.reasons.map(I=>l.jsx("li",{className:"session-log-viewer__chip","data-level":"neutral",children:I},I))})]}),me.gapMessage===null?null:l.jsx("p",{className:"session-log-viewer__gap",children:me.gapMessage})]})}):null,Da?null:l.jsx("p",{className:"session-log-viewer__facts-line",children:"Pattern-based redaction is best effort; sensitive content may remain."})]}),Da?null:$?l.jsxs("div",{className:"session-log-viewer__transcript-wrap",children:[l.jsx("div",{"aria-label":p==="conversation"?"Session log conversation":"Session log ledger",className:"session-log-viewer__scroller","data-testid":"session-log-conversation-scroller",onBlur:I=>{I.currentTarget.contains(I.relatedTarget)||Z(!1)},onFocus:()=>Z(!0),onKeyDown:rt,onScroll:hn,ref:lt,role:"region",tabIndex:0,children:p==="conversation"?l.jsxs("ol",{"aria-label":"Session log conversation",className:"session-log-viewer__entries",id:`${c}-conversation-panel`,role:"tabpanel",children:[U!==null?l.jsxs("li",{className:"session-log-viewer__entry session-log-viewer__entry--message session-log-viewer__entry--pinned","data-seq":String(U.sequence),"data-testid":"session-log-pinned-prompt",id:Cl(c,U.sequence),tabIndex:-1,children:[l.jsx(Eu,{kind:"prompt"}),l.jsx(Rx,{event:U,originMs:ee}),l.jsx("div",{className:"session-log-viewer__entry-content",children:l.jsx(Ex,{item:{kind:"message",speaker:"prompt",event:U},originMs:ee,pinned:!0,query:Pe})})]}):null,Q?l.jsxs("li",{className:"session-log-viewer__entry session-log-viewer__entry--missing",children:[l.jsx(Eu,{kind:"missing"}),l.jsx("span",{className:"session-log-viewer__gutter-offset",children:"—"}),l.jsx("div",{className:"session-log-viewer__entry-content",children:l.jsx("div",{className:"session-log-viewer__missing",children:`prompt not retained — sequences 0–${String(r.floorSequence-1)} fell below the retention floor`})})]}):null,Pa,la,kt.map(I=>l.jsx(Jk,{instanceId:c,item:I,onToggleGroup:Ve,openGroups:R,originMs:ee,query:Pe,settled:be},I.kind==="stamp"?`${I.kind}-${I.variant}-${String(Bp(I))}`:`${I.kind}-${String(Bp(I))}`)),be?null:l.jsxs("li",{className:"session-log-viewer__entry session-log-viewer__entry--live",children:[l.jsx(Eu,{kind:"live"}),l.jsx("span",{className:"session-log-viewer__gutter-offset"}),l.jsx("div",{className:"session-log-viewer__entry-content",children:l.jsxs("div",{className:"session-log-viewer__live",role:"status",children:[l.jsx("span",{className:"session-log-viewer__live-word",children:"live"}),l.jsx("span",{children:"awaiting next event"})]})})]})]}):l.jsxs("ol",{"aria-label":"Session log ledger",className:"session-log-viewer__ledger",id:`${c}-ledger-panel`,role:"tabpanel",children:[Pa,la,Pt.map(I=>l.jsx(s1,{event:I,instanceId:c,originMs:ee,query:Pe},I.sequence))]})}),P.atBottom?null:l.jsxs("button",{className:"session-log-viewer__latest",onClick:Wt,type:"button",children:[l.jsx("span",{"aria-hidden":"true",children:"↓"}),"latest"]}),l.jsx("div",{"aria-hidden":"true",className:"session-log-viewer__foot","data-active":q.toString(),children:l.jsx(l1,{})})]}):l.jsx("p",{className:"session-log-viewer__empty",children:"No session events were captured for this lane."})]})}function r1(t){const a=t[0];return a===void 0?null:Yt(a)}function o1(t,a,i){switch(t.event.kind){case"error":case"approval_request":case"approval_resolution":return!0;case"tool_result":return t.event.outcome!=="succeeded";case"tool_call":{const r=a.get(t.event.callId);return r===void 0?i:r.event.kind==="tool_result"&&r.event.outcome!=="succeeded"}default:return Fh(t).some(r=>r.level!=="neutral")}}const c1=kx(),u1=2e3;function d1(t){return t.family==="workflow"?[t.family,t.runId,t.runGeneration,t.stageId,t.callId].join("\0"):t.family==="activity"?[t.family,t.activityId,t.activityGeneration].join("\0"):"runId"in t?[t.family,t.runId,t.runGeneration,t.contextRunId].join("\0"):[t.family,t.contextRunId,t.contextGeneration].join("\0")}function f1(t){const a=t.owner;if(a.family==="workflow")return a.attempt===void 0?"attempt 1":`attempt ${String(a.attempt)}`;if(a.family==="activity")return`turn ${a.turnId??t.lane.laneId.replace(/^turn:/,"")}`;const i=a.executor==="finalizer"?"finalizer":"curator";return a.attempt===void 0||a.attempt<=1?i:`${i} · attempt ${String(a.attempt)}`}function p1(t){switch(t){case"loading_index":return"Discovering session log lanes…";case"loading_page":return"Loading session log events…";case"not_retained":return"This session log was not retained.";case"missing":return"This session log lane is no longer retained.";case"unavailable":return"Session log storage is temporarily unavailable.";case"obsolete":return"The selected generation changed; obsolete events were discarded.";case"error":return"The session log could not be loaded.";case"ready":return null}}function Sb(t,a,i,r){const c=uk(r);if(c===null)return;const f=new Map(t.current);f.set(i,c),t.current=f,a(p=>p+1)}function h1(t,a){return t.length!==a.length?!1:t.every((i,r)=>{const c=a[r];return c!==void 0&&i.lane.laneId===c.lane.laneId&&i.nextSequence===c.nextSequence})}function _d({api:t=c1,caption:a,fill:i=!1,onGenerationChanged:r,scope:c,live:f=!0,active:p=!0,refreshToken:h}){const v=d1(c),m=b.useMemo(()=>c,[v]),x=b.useMemo(()=>sk(t),[t]),y=b.useRef(r),[E,S]=b.useState("loading_index"),[C,T]=b.useState([]),[N,M]=b.useState(null),[k,z]=b.useState(null),[R,B]=b.useState("live"),q=b.useRef(new Map),Z=b.useRef(C),ae=b.useRef(k),oe=b.useRef(h),P=b.useRef(null),[,ue]=b.useState(0);Z.current=C,ae.current=k,oe.current=h,b.useEffect(()=>{y.current=r},[r]),b.useEffect(()=>{q.current=new Map},[v]),b.useEffect(()=>{const be=new AbortController;return S("loading_index"),T([]),M(null),z(null),B("live"),x.discover(m,null,be.signal).then(ve=>{if(!be.signal.aborted){if(ve.index.availability.availability==="not_retained"){S("not_retained");return}T(ve.lanes),M(ve.selectedLane?.lane.laneId??null)}}).catch(ve=>{be.signal.aborted||(ve instanceof vt&&ve.kind==="generation_changed"?(S("obsolete"),y.current?.()):ve instanceof vt&&ve.kind==="unavailable"?S("unavailable"):ve instanceof vt&&ve.kind==="aborted"||S("error"))}),()=>be.abort()},[x,v,m]),b.useEffect(()=>{if(N===null)return;const be=Z.current.find(({lane:$})=>$.laneId===N);if(be===void 0)return;const ve=new AbortController;return S("loading_page"),z(null),B("live"),x.loadLane(m,be,ve.signal).then($=>{ve.signal.aborted||(Sb(q,ue,N,$.events),z($),S("ready"))}).catch($=>{ve.signal.aborted||($ instanceof vt&&$.kind==="generation_changed"?(S("obsolete"),y.current?.()):$ instanceof vt&&$.kind==="missing"?S("missing"):$ instanceof vt&&$.kind==="unavailable"?S("unavailable"):$ instanceof vt&&$.kind==="aborted"||S("error"))}),()=>ve.abort()},[x,N,m]),b.useEffect(()=>{if(!f||!p||E!=="ready"||N===null)return;let be=!1,ve=null,$=null,ee=!1,ce=oe.current,de=!1,ye=!1;B("live");const j=()=>{$!==null&&clearTimeout($),$=null},L=async()=>{if(be)return;if(oe.current!==ce&&(ce=oe.current,ee=!1),document.visibilityState!=="visible"){U();return}const he=ae.current;if(he===null){U();return}ve?.abort();const F=new AbortController;ve=F;try{const ge=await x.discover(m,N,F.signal);if(be||F.signal.aborted)return;if(ge.index.availability.availability==="not_retained"){T([]),z(null),S("not_retained");return}h1(Z.current,ge.lanes)||T(ge.lanes);const Ve=ge.lanes.find(({lane:Re})=>Re.laneId===N);if(Ve===void 0){z(null),S("missing");return}const Se=await x.readTail(m,Ve,he,F.signal);if(be||F.signal.aborted)return;if(ye=!1,B("live"),Se!==he&&(Sb(q,ue,N,Se.events),z(Se)),Yh(Se.events)){if(ee&&oe.current===ce){de=!0;return}ee=!0}}catch(ge){if(be||F.signal.aborted)return;if(ge instanceof vt&&ge.kind==="generation_changed"){S("obsolete"),y.current?.();return}if(ge instanceof vt&&ge.kind==="missing"){z(null),S("missing");return}if((ge instanceof ea||ge instanceof vt&&(ge.kind==="auth_expired"||ge.kind==="offline"||ge.kind==="connection_changed"))&&oe.current===ce){B("stopped"),ye=!0,de=!0;return}B("paused")}U()},U=()=>{be||(j(),$=setTimeout(()=>{$=null,L()},u1))},Q=()=>{be||document.visibilityState!=="visible"||(ye?(ye=!1,de=!1,L()):$!==null&&(j(),L()))};return P.current=()=>{be||!de||(de=!1,ye=!1,ee=!1,ce=oe.current,L())},document.addEventListener("visibilitychange",Q),U(),()=>{be=!0,P.current=null,j(),ve?.abort(),document.removeEventListener("visibilitychange",Q)}},[p,x,v,f,E,N,m]),b.useEffect(()=>{P.current?.()},[h]);const _e=b.useMemo(()=>{if(!(C.length<=1))return C.map(be=>({id:be.lane.laneId,label:f1(be),status:q.current.get(be.lane.laneId)??null,active:be.lane.laneId===N,onSelect:ve=>M(ve)}))},[C,N]),me=p1(E);return l.jsxs("section",{"aria-busy":E==="loading_index"||E==="loading_page","aria-label":"Session log panel",className:"session-log-panel","data-fill":i?"true":void 0,children:[_e===void 0||E==="ready"||k!==null?null:l.jsx(Ax,{lanes:_e}),me===null?null:l.jsx("p",{role:E==="error"?"alert":"status",children:me}),E==="ready"&&R==="paused"?l.jsx("p",{role:"status",children:"Live updates paused — session log could not be refreshed."}):null,E==="ready"&&R==="stopped"?l.jsx("p",{role:"status",children:"Live updates stopped — switch away and back, or refresh, to resume."}):null,E==="ready"&&k!==null?l.jsx(i1,{active:p,fill:i,page:k,..._e===void 0?{}:{lanes:_e}}):null]})}class qn extends Error{constructor(a,i,r){super(a),this.kind=a,this.status=i,this.code=r,this.name="ArtifactApiError"}}function Nb(t){return t??new AbortController().signal}function m1(t,a){return a.aborted||t instanceof DOMException&&t.name==="AbortError"}async function g1(t){try{const a=await na(t);return typeof a.error?.code=="string"?a.error.code:void 0}catch(a){if(a instanceof bt)throw new qn("connection_changed",409,"agent_instance_changed");return}}async function kb(t,a,i){let r;try{r=await t(a,{signal:i})}catch(c){throw c instanceof bt?new qn("connection_changed",409,"agent_instance_changed"):m1(c,i)?new qn("aborted"):new qn("offline")}if(r.status===401)throw new qn("auth_expired",401,"unauthorized");if(!r.ok){const c=await g1(r);throw c==="agent_instance_changed"?new qn("connection_changed",r.status,c):new qn("request_error",r.status,c)}return r}function _1(t=hs){return{async listArtifacts(a={}){const i=Nb(a.signal),r=new URLSearchParams({limit:"100"});a.before!==void 0&&r.set("before",a.before);const c=await kb(t,`/api/artifacts?${r.toString()}`,i);try{return await na(c)}catch(f){throw f instanceof bt?new qn("connection_changed",409,"agent_instance_changed"):new qn("request_error",c.status)}},async inspectArtifact(a,i){const r=Nb(i),c=encodeURIComponent(a.runId),f=encodeURIComponent(a.stageId),p=encodeURIComponent(a.callId),h=encodeURIComponent(a.runGeneration),v=await kb(t,`/api/runs/${c}/stages/${f}/calls/${p}/artifact?generation=${h}`,r);if(v.headers.get("ETag")!==`"${a.stateRevision}"`)throw new qn("stale_revision",v.status);let m;try{m=await Gh(v)}catch(E){throw E instanceof bt?new qn("connection_changed",409,"agent_instance_changed"):E}let x;try{x=JSON.parse(m)}catch{throw new qn("malformed_json",v.status)}const y=v.headers.get("X-ClinkX-Validator-Schema-Id");if(y===null||y.length===0)throw new qn("request_error",v.status);return{byteSize:new TextEncoder().encode(m).byteLength,content:m,parsed:x,validatorId:y}}}}function Ox(t){return t.findIndex(a=>a.disabled!==!0)}function Ab(t,a){const i=t.findIndex(r=>r.id===a&&r.disabled!==!0);return i>=0?i:Ox(t)}function Rb(t,a,i){if(t.length===0)return-1;for(let r=1;r<=t.length;r+=1){const c=(a+i*r+t.length)%t.length;if(t[c]?.disabled!==!0)return c}return a}function bi({ariaLabel:t,items:a,onMovePastBoundary:i,onSelect:r,rootRef:c,selectedId:f}){const[p,h]=b.useState(()=>Ab(a,f)),v=b.useRef(new Map),m=a.map(T=>`${T.id}:${T.disabled===!0?"disabled":"enabled"}`).join("\0"),x=Ab(a,f);b.useEffect(()=>{h(x)},[m,x,f]);const y=T=>{T<0||(h(T),v.current.get(T)?.focus())},E=(T,N)=>{let M=null;if(T.key==="ArrowDown"){if(i!==void 0&&!a.slice(N+1).some(k=>k.disabled!==!0)){T.preventDefault(),i(1);return}M=Rb(a,N,1)}else if(T.key==="ArrowUp"){if(i!==void 0&&!a.slice(0,N).some(k=>k.disabled!==!0)){T.preventDefault(),i(-1);return}M=Rb(a,N,-1)}else if(T.key==="Home")M=Ox(a);else if(T.key==="End")M=[...a].map((k,z)=>({item:k,itemIndex:z})).reverse().find(({item:k})=>k.disabled!==!0)?.itemIndex??-1;else if(T.key==="Enter"||T.key===" "){T.preventDefault();const k=a[N];k&&k.disabled!==!0&&r(k.id);return}M!==null&&(T.preventDefault(),y(M))},S=(T,N)=>l.jsx("div",{"aria-disabled":T.disabled===!0?"true":void 0,"aria-label":T.label,"aria-selected":T.id===f,className:"roving-listbox__option","data-item-id":T.id,onClick:()=>{T.disabled!==!0&&(h(N),v.current.get(N)?.focus(),r(T.id))},onFocus:()=>h(N),onKeyDown:M=>E(M,N),ref:M=>{M?v.current.set(N,M):v.current.delete(N)},role:"option",tabIndex:N===p&&T.disabled!==!0?0:-1,children:T.content},T.id),C=[];for(const[T,N]of a.entries()){const M=C[C.length-1];if(N.group!==void 0&&M?.group?.id===N.group.id){M.items.push({item:N,index:T});continue}C.push({...N.group===void 0?{}:{group:N.group},items:[{item:N,index:T}]})}return l.jsx("div",{className:"roving-listbox","aria-label":t,ref:c,role:"listbox",children:C.map((T,N)=>T.group===void 0?T.items.map(({item:M,index:k})=>S(M,k)):l.jsxs("div",{"aria-label":T.group.label,className:"roving-listbox__group",role:"group",children:[T.group.header,T.items.map(({item:M,index:k})=>S(M,k))]},T.group.id===""?`group-${String(N)}`:T.group.id))})}const v1=32,b1=1e4;function y1(t,a,i){const r=[{value:t,depth:0}];let c=0;for(;r.length>0;){const f=r.pop();if(c+=1,c>i)return"nodes";if(f.depth>a)return"depth";if(f.value!==null&&typeof f.value=="object")for(const p in f.value)Object.prototype.hasOwnProperty.call(f.value,p)&&r.push({value:f.value[p],depth:f.depth+1})}return null}function Rh({value:t}){if(Array.isArray(t))return l.jsx("ol",{className:"bounded-json__collection",children:t.map((a,i)=>l.jsxs("li",{children:[l.jsx("span",{className:"bounded-json__key",children:i}),l.jsx(Rh,{value:a})]},i))});if(t!==null&&typeof t=="object"){const a=[];for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&a.push(l.jsxs("div",{className:"bounded-json__entry",children:[l.jsx("dt",{className:"bounded-json__key",children:i}),l.jsx("dd",{children:l.jsx(Rh,{value:t[i]})})]},i));return l.jsx("dl",{className:"bounded-json__collection",children:a})}return l.jsx("span",{className:`bounded-json__value bounded-json__value--${t===null?"null":typeof t}`,children:typeof t=="string"?t:JSON.stringify(t)})}function vd({content:t,maxDepth:a=v1,maxNodes:i=b1,mediaType:r}){const[c,f]=b.useState("rendered"),p=b.useMemo(()=>{if(r==="text/plain")return null;try{const h=JSON.parse(t);return{kind:"valid",value:h,exceeded:y1(h,a,i)}}catch{return{kind:"invalid"}}},[t,a,i,r]);return r==="text/plain"?l.jsx(yr,{children:t}):p===null||p.kind==="invalid"?l.jsx(yr,{children:t}):l.jsx(qh,{activeTabId:c,ariaLabel:"Result representation",onChange:f,tabs:[{id:"rendered",label:"rendered",panel:p.exceeded!==null?l.jsxs("p",{className:"bounded-json__limit",role:"status",children:["JSON exceeds the ",p.exceeded==="depth"?`${a}-level`:`${i}-node`," rendering limit. Use the inert raw-text tab."]}):l.jsx("div",{className:"bounded-json",children:l.jsx(Rh,{value:p.value})})},{id:"raw",label:"raw",panel:l.jsx(yr,{children:t})}]})}function Rl({detail:t,detailAriaLabel:a="Run detail",listAriaLabel:i="Workflow runs",mobileView:r,runList:c}){return l.jsxs("div",{className:"dashboard-layout","data-mobile-view":r,children:[l.jsx("section",{className:"dashboard-layout__run-list overflow-safe","aria-label":i,children:c}),l.jsx("section",{className:"dashboard-layout__detail overflow-safe","aria-label":a,children:t})]})}function yi({children:t}){const a=b.useRef(null),[i,r]=b.useState(!1);return b.useEffect(()=>{const c=a.current?.closest(".dashboard-layout__detail");if(c==null)return;const f=()=>{const p=c.scrollTop>88;r(h=>h===p?h:p)};return f(),c.addEventListener("scroll",f,{passive:!0}),()=>{c.removeEventListener("scroll",f)}},[]),l.jsx("div",{className:"detail-sticky-bar__wrap",ref:a,children:l.jsx("div",{"aria-hidden":!i,className:"detail-sticky-bar","data-scrolled":i,children:t})})}function x1({children:t,label:a}){return l.jsx("div",{className:"mobile-chart-scroll","aria-label":a,role:"region",tabIndex:0,children:l.jsx("div",{className:"mobile-chart-scroll__canvas",children:t})})}function Rr({children:t}){return l.jsx("span",{className:"overflow-safe",children:t})}const $x="/contracts/council-plan-review-input-v1.json";function Ma(t){return t>=3600&&t%3600===0?`${String(t/3600)}h`:t>=60&&t%60===0?`${String(t/60)}m`:`${String(t)}s`}function xr(t){return t.expands==="per_roster_seat"}function Eh(t){return t.calls.some(a=>a.reducer!==void 0)}function w1(t){if(Eh(t))return`${t.id} · deterministic reducer · in-engine`;if(xr(t))return`${t.id} · 1 seed call, cloned per roster seat`;const a=t.calls.length;return`${t.id} · ${String(a)}${t.parallel&&a>1?" parallel calls":" call"}`}function j1(t){return t.stages===void 0?null:t.stages.map(a=>({id:a.id,title:w1(a),seed:xr(a),marks:a.calls.map(i=>({reducer:i.reducer!==void 0}))}))}function Mx(t){const a=t.timeoutSeconds===void 0?"":` · ${Ma(t.timeoutSeconds)}`;if(t.stages===void 0){const r=`${String(t.stageCount)} ${t.stageCount===1?"stage":"stages"}`,c=`${String(t.callCount)} ${t.callCount===1?"call":"calls"}`;return{label:`${r} · ${c}${a}`,note:""}}const i=t.stages.some(xr);return{label:`${String(t.callCount)}${i?" seed calls":" calls"}${a}`,note:i?"cloned per roster seat":""}}function S1(t){const a=t.stages;if(a===void 0)return null;const i=a.some(xr);let r;if(i)r=`${String(a.length)}-stage seed · the plan-review expander clones the reviewer and cross-review blueprints once per admitted roster seat`;else{const f=a.filter(v=>v.parallel).length,p=a.find(v=>!v.parallel),h=a[a.length-1];r=`${String(f)} parallel stages · fan-in at ${p===void 0?"—":p.id}`,h!==void 0&&h.onFailure==="abort"&&(r+=` · ${h.id} aborts the run on failure`)}const c=[{label:"call",kind:"call"},...i?[{label:"seed · cloned per seat",kind:"seed"}]:[],...a.some(Eh)?[{label:"in-engine reducer",kind:"reducer"}]:[]];return{note:r,legend:c,stages:a.map((f,p)=>{const v=Eh(f)?"deterministic reducer · in-engine":xr(f)?"1 seed call · cloned per roster seat":f.parallel&&f.calls.length>1?`${String(f.calls.length)} parallel calls`:"1 call · sequential",m=f.contextFrom.length===0?"":`context ← ${f.contextFrom.join(" · ")}${f.anonymizeContext?" · anonymized":""}`,x=[`on failure ${f.onFailure}`];return f.maxRetries>0&&x.push(`retry ×${String(f.maxRetries)}`),{index:String(p+1).padStart(2,"0"),id:f.id,modeLabel:v,seed:xr(f),calls:f.calls.map(y=>({id:y.id,who:y.reducer!==void 0?y.reducer:`${y.cliName??"—"} / ${y.role??"—"}`,reducer:y.reducer!==void 0})),contextLabel:m,failureLabel:x.join(" · "),aborts:f.onFailure==="abort"}})}}function N1(t,a){const i=[{label:"stages",value:String(t.stageCount)},{label:"calls",value:String(t.callCount)}];return t.timeoutSeconds!==void 0&&i.push({label:"timeout",value:Ma(t.timeoutSeconds)}),i.push({label:"on sheet",value:a===void 0||a===0?"idle":`${String(a)} ${a===1?"run":"runs"}`}),i}function k1(t){switch(t){case"number":return 0;case"boolean":return!1;case"string[]":return[];case"string":return"<required:string>"}}function A1(){return{schema_version:"council-plan-review-input-v1",contract_href:$x}}function R1(t){const a=Object.fromEntries(t.variables.filter(i=>i.required).sort((i,r)=>i.name.localeCompare(r.name)).map(i=>[i.name,k1(i.type)]));return JSON.stringify({tool:"run_workflow",arguments:{workflow:t.name,run_id:"<unique_run_id>",variables:a,...t.name==="plan-review-receipts"?{plan_review:A1()}:{}}},null,2)}function Lx(t){const a={name:t.name,version:t.version,description:t.description,...t.timeoutSeconds===void 0?{}:{timeoutSeconds:t.timeoutSeconds},...t.stages===void 0?{}:{stages:t.stages.map(i=>({id:i.id,parallel:i.parallel,onFailure:i.onFailure,maxRetries:i.maxRetries,contextFrom:[...i.contextFrom],anonymizeContext:i.anonymizeContext,...i.expands===void 0?{}:{expands:i.expands},calls:i.calls.map(r=>({id:r.id,...r.cliName===void 0?{}:{cliName:r.cliName},...r.role===void 0?{}:{role:r.role},...r.reducer===void 0?{}:{reducer:r.reducer}}))}))},stageCount:t.stageCount,callCount:t.callCount,variables:t.variables.map(({name:i,type:r,required:c,description:f})=>({name:i,type:r,required:c,...f===void 0?{}:{description:f}}))};return{...a,copyHandoff:R1(a),...a.name==="plan-review-receipts"?{contractHref:$x}:{}}}function E1(t){return{name:t.name,command:t.command,parser:t.parser,promptMode:t.promptMode,timeoutSeconds:t.timeoutSeconds,...t.idleTimeoutSeconds===void 0?{}:{idleTimeoutSeconds:t.idleTimeoutSeconds},...t.idleTimeoutStartupSeconds===void 0?{}:{idleTimeoutStartupSeconds:t.idleTimeoutStartupSeconds},roleNames:[...t.roleNames],environmentKeys:[...t.environmentKeys],supportsImages:t.supportsImages,resultContract:{enabled:t.resultContract.enabled,filename:t.resultContract.filename},backend:t.backend,...t.workflowEligible===void 0?{}:{workflowEligible:t.workflowEligible},...t.usableVia===void 0?{}:{usableVia:[...t.usableVia]}}}function Xh(t){if(t.backend==="app_server")return"app-server session";switch(t.promptMode){case"stdin":return"prompt on stdin";case"file":return"prompt via file";case"arg":return"prompt as argument"}}function Ix(t){const a=t.idleTimeoutStartupSeconds??0,i=[];return a>0&&i.push(`idle start ${Ma(a)}`),t.resultContract.enabled&&i.push(t.resultContract.filename),t.workflowEligible===!1&&i.push("not workflow-eligible"),{label:Ma(t.timeoutSeconds),note:i.join(" · ")}}function T1(t){return`[ ${String(t)} ${t===1?"call":"calls"} ]`}function Dx(t){return t===0?"idle":`${String(t)} ${t===1?"call":"calls"}`}function C1(t,a){const i=[{label:"binary",value:t.command},{label:"prompt",value:t.promptMode},{label:"timeout",value:Ma(t.timeoutSeconds)},{label:"result contract",value:t.resultContract.enabled?t.resultContract.filename:"none"}];return a!==void 0&&i.push({label:"on sheet",value:Dx(a)}),i}function Eb(t){return t===void 0?"not declared":t===0?"off":Ma(t)}function O1(t){return[{key:"timeout",value:Ma(t.timeoutSeconds),raw:`${String(t.timeoutSeconds)}s`,note:"hard wall for the whole call"},{key:"idle startup",value:Eb(t.idleTimeoutStartupSeconds),raw:t.idleTimeoutStartupSeconds===void 0?"":`${String(t.idleTimeoutStartupSeconds)}s`,note:"no output within this window after spawn kills the child"},{key:"idle",value:Eb(t.idleTimeoutSeconds),raw:t.idleTimeoutSeconds===void 0?"":`${String(t.idleTimeoutSeconds)}s`,note:"longest silence tolerated between outputs"}]}function $1(t){const a=t.idleTimeoutStartupSeconds;return a===void 0||a<=0?null:Math.max(3,a/t.timeoutSeconds*100)}function M1(t){const a=t.idleTimeoutStartupSeconds;return a===void 0||a<=0?null:`idle start · ${Ma(a)}`}function L1(t){return t.workflowEligible===void 0?{label:"workflow eligibility not reported",tone:"secondary"}:t.workflowEligible?{label:"workflow eligible",tone:"link"}:{label:"not workflow-eligible · agent sessions only",tone:"primary"}}function I1(t){return t.backend==="app_server"?"App-server tools require CLINKX_APP_SERVER_ENABLED on the MCP server process.":"Reachability names the supported tool path, not live producer availability."}function D1(t){return t.resultContract.enabled?`the child writes its final answer to ${t.resultContract.filename} in the run dir; the bridge reads it before any parser runs`:"the parser’s extracted output is the result"}function z1(t,a){if(t.length<2||a.length===0)return null;const i=a.join("\0");return t.every(c=>c.roleNames.join("\0")===i)?`the same ${String(a.length)} roles are declared on every adapter`:null}const q1=["PATH","HOME","USER","LANG","TMPDIR"];function U1(){return`none declared · the child inherits the baseline ${q1.join(" · ")}`}function B1(t,a,i){const r=[];if(a!==null)for(const c of a.stages)for(const f of c.calls)f.state!=="pending"&&f.snapshotIdentity?.adapter===t&&r.push({kind:"workflow",id:`run:${a.runId}:${c.stageId}:${f.callId}`,runId:a.runId,label:`${a.workflowName} · ${c.stageId} / ${f.callId}`,sub:`run ${a.runId}`,status:f.state});for(const c of i)c.adapter===t&&r.push({kind:"single",id:`activity:${c.activityId}`,activityId:c.activityId,label:`${c.kind} · ${c.role}`,sub:`activity ${c.activityId}`,status:c.status});return r}function G1(t){const a=t.filter(r=>r.kind==="workflow").length,i=t.length-a;return`${String(a)} workflow · ${String(i)} single`}function Tb(t){return t===void 0?"—":t===0?"off":Ma(t)}function H1(t,a){return[{label:"binary",read:r=>`$ ${r.command}`},{label:"backend",read:r=>r.backend},{label:"parser",read:r=>r.parser},{label:"prompt",read:r=>r.promptMode},{label:"timeout",read:r=>Ma(r.timeoutSeconds)},{label:"idle startup",read:r=>Tb(r.idleTimeoutStartupSeconds)},{label:"idle",read:r=>Tb(r.idleTimeoutSeconds)},{label:"result contract",read:r=>r.resultContract.enabled?r.resultContract.filename:"none"},{label:"images",read:r=>r.supportsImages?"yes":"no"},{label:"workflow eligible",read:r=>r.workflowEligible===void 0?"not reported":r.workflowEligible?"yes":"no"},{label:"usable via",read:r=>r.usableVia===void 0||r.usableVia.length===0?"not reported":r.usableVia.join(" · ")},{label:"roles",read:r=>String(r.roleNames.length)},{label:"env keys",read:r=>r.environmentKeys.length===0?"none":r.environmentKeys.join(" · ")},{label:"on sheet",read:r=>{const c=a?.[r.name];return c===void 0?"—":Dx(c)}}].map(r=>{const c=t.map(r.read),f=c.every(p=>p===c[0]);return{label:r.label,same:f,cells:c}})}function V1(t,a,i,r){const c=`${String(t)} adapters · ${String(a)} facts · `;return r?`${c}${String(i)} identical ${i===1?"row":"rows"} hidden · a column head opens that adapter`:`${c}${String(i)} ${i===1?"row reads":"rows read"} the same on every adapter and dim to slate · a column head opens that adapter`}function K1(t){return t.replaceAll("_","_")}function Ph({action:t,countLabel:a,infoLine:i,title:r}){return l.jsxs("header",{className:"catalog-index__header",children:[l.jsx("h2",{className:"catalog-view__title",title:i,children:r}),l.jsx("span",{"aria-hidden":"true",className:"catalog-index__spacer"}),t===void 0?null:t,l.jsx("span",{className:"catalog-index__count",children:a}),i===void 0?null:l.jsx("p",{className:"visually-hidden",children:i})]})}function ed({message:t,retry:a,role:i}){return l.jsxs("div",{className:"catalog-notice",role:i,children:[l.jsx("span",{className:"catalog-notice__message",children:t}),a===void 0?null:l.jsx("button",{className:"catalog-bracket",onClick:a.run,type:"button",children:a.label})]})}function zx({children:t}){return l.jsx("p",{className:"catalog-detail__empty",children:t})}const Z1=["plan-review-receipts","council-default","council-answer","council-code-review","council-debug","council-discover","council-plan-review"],F1=["codex","claude","agy","codex-app-server","glm"],qx=Object.freeze({});function Ux(t,a,i){const r=i.indexOf(t),c=i.indexOf(a);return r===-1&&c===-1?t.localeCompare(a):r===-1?1:c===-1?-1:r-c}function Bx(t){return t.map(Lx).sort((a,i)=>Ux(a.name,i.name,Z1))}function Gx(t,a){const i=Bx(t);return i.find(r=>r.name===a)??i[0]}function Y1(t){return`[ ${String(t)} ${t===1?"run":"runs"} ]`}function X1(t,a){const i=Mx(t),r=a===void 0||a===0?"idle":`${String(a)} ${a===1?"run":"runs"} on sheet`;return[`${t.name} version ${t.version}`,i.label,...i.note===""?[]:[i.note],r].join(", ")}function P1({onSelect:t,runCounts:a=qx,selectedName:i,sourcePath:r,workflows:c}){const f=Bx(c),p=Gx(c,i),h=String(f.length);return l.jsxs("section",{"aria-label":"Workflow catalog",className:"catalog-index",children:[l.jsx(Ph,{countLabel:`[ ${h} ]`,infoLine:r===void 0?`[ ${h} loaded descriptors ]`:`[ CLINKX_WORKFLOWS_PATH = ${r} ]`,title:"Shipped workflows"}),l.jsx(bi,{ariaLabel:"Shipped workflows",items:f.map(v=>{const m=a[v.name],x=j1(v),y=Mx(v),E=v.name==="plan-review-receipts";return{id:v.name,label:X1(v,m),content:l.jsxs("div",{className:"catalog-card catalog-card--workflow",children:[l.jsxs("div",{className:"catalog-card__head",children:[l.jsx("span",{className:"catalog-card__name",children:v.name}),l.jsxs("span",{className:"catalog-card__version",children:["v",v.version]}),l.jsx("span",{"aria-hidden":"true",className:"catalog-card__spacer"}),m===void 0||m===0?null:l.jsx("span",{className:"catalog-card__usage",children:Y1(m)})]}),E?l.jsx("div",{className:"catalog-card__stamp-row",children:l.jsx("span",{className:"catalog-stamp",children:"review-only"})}):null,l.jsx("p",{className:"catalog-card__blurb",children:v.description}),x===null?null:l.jsx("div",{"aria-hidden":"true",className:"catalog-strip",children:x.map((S,C)=>l.jsxs(b.Fragment,{children:[l.jsxs("span",{className:"catalog-strip__group",title:S.title,children:[l.jsx("span",{className:"catalog-strip__marks",children:S.marks.map((T,N)=>l.jsx("span",{className:["catalog-mark","catalog-mark--9",T.reducer?"catalog-mark--reducer":"",S.seed?"catalog-mark--seed":""].filter(Boolean).join(" ")},N))}),l.jsx("span",{className:"catalog-strip__label",children:S.id})]}),C===x.length-1?null:l.jsx("span",{className:"catalog-strip__connector"})]},S.id))}),l.jsxs("div",{className:"catalog-card__foot",children:[l.jsx("span",{className:"catalog-card__foot-label",children:y.label}),y.note===""?null:l.jsx("span",{className:"catalog-card__foot-note",children:y.note}),l.jsx("span",{"aria-hidden":"true",className:"catalog-card__foot-hint",children:"detail ›"})]})]})}}),onSelect:v=>t?.(v),selectedId:p===void 0?null:p.name})]})}function Q1({variables:t}){const a=t.filter(r=>r.required),i=t.filter(r=>!r.required);return l.jsx(l.Fragment,{children:[...a,...i].map(r=>{const c=r.name.startsWith("cb_");return l.jsxs("div",{className:"catalog-vars__row",title:r.description,children:[l.jsx("span",{className:"catalog-vars__name",children:c?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"catalog-vars__prefix",children:"cb_"}),l.jsx("span",{className:"catalog-vars__rest",children:r.name.slice(3)})]}):l.jsx("span",{className:"catalog-vars__rest",children:r.name})}),l.jsx("span",{className:"catalog-vars__type",children:r.type}),l.jsx("span",{className:r.required?"catalog-vars__input catalog-vars__input--required":"catalog-vars__input",children:r.required?"required":"optional"})]},r.name)})})}function J1(t){if(t.name==="plan-review-receipts")return t.variables.find(a=>a.name==="cb_task"&&a.description!==void 0)?.description}function W1({onBack:t,runCounts:a=qx,workflow:i}){const[r,c]=b.useState({});if(i===void 0)return l.jsx(zx,{children:"Select a shipped workflow to inspect its definition."});const f=Lx(i),p=S1(i),h=N1(i,a[i.name]),v=i.name==="plan-review-receipts",m=i.variables.filter(C=>C.required),x=i.variables.filter(C=>!C.required),y=r[i.name]===!0||m.length===0,E=y?[...m,...x]:m,S=J1(i);return l.jsxs("section",{className:"app-shell__view catalog-detail",children:[l.jsxs(yi,{children:[l.jsx("span",{className:"detail-sticky-bar__id",children:"workflow"}),l.jsx("span",{className:"detail-sticky-bar__name",children:i.name}),l.jsxs("span",{className:"detail-sticky-bar__muted",children:["v",i.version]}),l.jsx("span",{className:"detail-sticky-bar__spacer"}),l.jsx("span",{className:"detail-sticky-bar__wide",children:l.jsx(ma,{label:`Copy ${i.name} run handoff`,text:f.copyHandoff})})]}),l.jsxs("div",{className:"catalog-detail__back-bar",children:[t===void 0?null:l.jsx("button",{className:"catalog-back",onClick:t,type:"button",children:"‹ workflows"}),l.jsxs("span",{className:"catalog-detail__back-context",children:["v",i.version]})]}),l.jsxs("div",{className:"catalog-detail__content",children:[l.jsxs("div",{className:"catalog-detail__eyebrow",children:[l.jsx("span",{className:"catalog-detail__eyebrow-word",children:"workflow"}),v?l.jsx("span",{className:"catalog-stamp",children:"review-only"}):null]}),l.jsxs("div",{className:"catalog-detail__title-row",children:[l.jsx("h1",{className:"catalog-detail__name",children:i.name}),l.jsxs("span",{className:"catalog-detail__version",children:["v",i.version]}),l.jsxs("div",{className:"catalog-detail__actions",children:[f.contractHref===void 0?null:l.jsx("a",{className:"catalog-bracket",href:f.contractHref,children:"[ plan-review input contract ]"}),l.jsx(ma,{label:`Copy ${i.name} run handoff`,text:f.copyHandoff})]})]}),l.jsx("p",{className:"catalog-detail__description",children:i.description}),l.jsxs("div",{className:"catalog-facts",children:[l.jsx("div",{className:"catalog-facts__group",children:h.map(C=>l.jsxs("span",{className:"catalog-facts__item",children:[l.jsx("span",{className:"catalog-facts__k",children:C.label}),l.jsx("span",{className:"catalog-facts__v",children:C.value})]},C.label))}),l.jsxs("div",{className:"catalog-facts__actions",children:[l.jsx(ma,{label:`Copy ${i.name} run handoff`,text:f.copyHandoff}),f.contractHref===void 0?null:l.jsx("a",{className:"catalog-bracket catalog-bracket--target44",href:f.contractHref,children:"[ input contract ]"})]})]}),p===null?null:l.jsxs("section",{"aria-label":"Stage anatomy",className:"catalog-section",children:[l.jsx("div",{className:"catalog-section__head",children:l.jsx("h2",{className:"catalog-section__stamp",children:"Stage anatomy"})}),l.jsx("p",{className:"catalog-section__note",children:p.note}),l.jsx("div",{"aria-hidden":"true",className:"catalog-anatomy__legend",children:p.legend.map(C=>l.jsxs("span",{className:"catalog-anatomy__legend-item",children:[l.jsx("span",{className:["catalog-mark","catalog-mark--8",C.kind==="reducer"?"catalog-mark--reducer":"",C.kind==="seed"?"catalog-mark--seed":""].filter(Boolean).join(" ")}),l.jsx("span",{className:"catalog-anatomy__legend-label",children:C.label})]},C.label))}),l.jsx("div",{className:"catalog-anatomy",children:p.stages.map(C=>l.jsxs("div",{className:"catalog-anatomy__stage",children:[l.jsxs("div",{className:"catalog-anatomy__stage-head",children:[l.jsx("span",{"aria-hidden":"true",className:"catalog-anatomy__axis"}),l.jsx("span",{"aria-hidden":"true",className:"catalog-anatomy__node"}),l.jsx("span",{className:"catalog-anatomy__index",children:C.index}),l.jsx("span",{className:"catalog-anatomy__id",children:C.id})]}),l.jsx("div",{className:"catalog-anatomy__mode",children:C.modeLabel}),l.jsx("div",{className:"catalog-anatomy__calls",children:C.calls.map(T=>l.jsxs("div",{className:"catalog-anatomy__call",children:[l.jsx("span",{"aria-hidden":"true",className:["catalog-mark","catalog-mark--8",T.reducer?"catalog-mark--reducer":"",C.seed?"catalog-mark--seed":""].filter(Boolean).join(" ")}),l.jsxs("span",{className:"catalog-anatomy__call-text",children:[l.jsx("span",{className:"catalog-anatomy__call-id",children:T.id}),l.jsx("span",{className:"catalog-anatomy__call-who",children:T.who})]})]},T.id))}),l.jsxs("div",{className:"catalog-anatomy__foot",children:[C.contextLabel===""?null:l.jsx("span",{className:"catalog-anatomy__ctx",children:C.contextLabel}),l.jsx("span",{className:C.aborts?"catalog-anatomy__failure catalog-anatomy__failure--abort":"catalog-anatomy__failure",children:C.failureLabel})]})]},C.id))})]}),l.jsxs("section",{"aria-label":"Declared variables",className:"catalog-section",children:[l.jsxs("div",{className:"catalog-section__head",children:[l.jsx("h2",{className:"catalog-section__stamp",children:"Declared variables"}),l.jsx("span",{"aria-hidden":"true",className:"catalog-section__spacer"}),m.length>0&&x.length>0?l.jsx("button",{"aria-pressed":y,className:"catalog-bracket",onClick:()=>c(C=>({...C,[i.name]:!y})),type:"button",children:y?"[ required only ]":`[ show ${String(x.length)} optional ]`}):null]}),l.jsxs("p",{className:"catalog-section__note catalog-section__note--tabular",children:[String(m.length)," required ·"," ",String(x.length)," optional"]}),i.variables.length===0?l.jsx("p",{className:"catalog-card__empty",children:"No declared variables"}):l.jsxs("div",{className:"catalog-vars",children:[l.jsxs("div",{"aria-hidden":"true",className:"catalog-vars__header",children:[l.jsx("span",{children:"name"}),l.jsx("span",{children:"type"}),l.jsx("span",{children:"input"})]}),l.jsx(Q1,{variables:E}),S===void 0?null:l.jsx("p",{className:"catalog-vars__note",children:S})]})]}),l.jsxs("section",{"aria-label":"Run handoff",className:"catalog-section catalog-section--last",children:[l.jsxs("div",{className:"catalog-section__head",children:[l.jsx("h2",{className:"catalog-section__stamp",children:"Run handoff"}),l.jsx("span",{className:"catalog-section__caption",children:"run_workflow · required variables only"}),l.jsx("span",{"aria-hidden":"true",className:"catalog-section__spacer"}),l.jsx(ma,{label:`Copy ${i.name} run handoff`,text:f.copyHandoff})]}),l.jsx("div",{className:"catalog-handoff__body",children:l.jsx(yr,{children:f.copyHandoff})})]})]})]})}function Hx(t){return t.map(E1).sort((a,i)=>Ux(a.name,i.name,F1))}function Vx(t,a){const i=Hx(t);return i.find(r=>r.name===a)??i[0]}function eA(t,a){const i=[t.name,`$ ${t.command}`,t.parser,...t.supportsImages?["images"]:[],Xh(t),`timeout ${Ma(t.timeoutSeconds)}`],r=Ix(t);return r.note!==""&&i.push(r.note),a!==void 0&&a>0&&i.push(`${String(a)} ${a===1?"call":"calls"} on sheet`),i.join(", ")}function tA({adapters:t,compareOn:a=!1,onCompareToggle:i,onSelect:r,selectedName:c,useCounts:f}){const p=Hx(t),h=Vx(t,c),v=String(p.length),m=a||h===void 0?null:h.name;return l.jsxs("section",{"aria-label":"Adapter catalog",className:"catalog-index",children:[l.jsx(Ph,{countLabel:`[ ${v} ]`,infoLine:`[ configured adapters · ${v} ]`,title:"CLI adapters",...i===void 0?{}:{action:l.jsx("button",{"aria-pressed":a,className:a?"catalog-bracket catalog-bracket--on":"catalog-bracket",onClick:i,title:"every adapter side by side",type:"button",children:"[ compare ]"})}}),l.jsx(bi,{ariaLabel:"CLI adapters",items:p.map(x=>{const y=f?.[x.name],E=Ix(x);return{id:x.name,label:eA(x,y),content:l.jsxs("div",{className:"catalog-card catalog-card--adapter",children:[l.jsxs("div",{className:"catalog-card__head",children:[l.jsx("span",{className:"catalog-card__name",children:x.name}),l.jsx("span",{"aria-hidden":"true",className:"catalog-card__spacer"}),y===void 0||y===0?null:l.jsx("span",{className:"catalog-card__usage",children:T1(y)})]}),l.jsxs("div",{className:"catalog-card__adapter-line",children:[l.jsxs("span",{className:"catalog-card__adapter-command",children:["$ ",x.command]}),l.jsx("span",{className:"catalog-chip",children:x.parser}),x.supportsImages?l.jsx("span",{className:"catalog-chip catalog-chip--muted",children:"images"}):null,l.jsx("span",{className:"catalog-card__adapter-sketch",children:Xh(x)})]}),l.jsxs("div",{className:"catalog-card__foot",children:[l.jsx("span",{className:"catalog-card__foot-label",children:E.label}),E.note===""?null:l.jsx("span",{className:"catalog-card__foot-note",children:E.note}),l.jsx("span",{"aria-hidden":"true",className:"catalog-card__foot-hint",children:"detail ›"})]})]})}}),onSelect:x=>r?.(x),selectedId:m})]})}function Kx(){const[t,a]=b.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(max-width: 880px)").matches);return b.useEffect(()=>{if(typeof window.matchMedia!="function")return;const i=window.matchMedia("(max-width: 880px)"),r=()=>a(i.matches);return r(),i.addEventListener("change",r),()=>i.removeEventListener("change",r)},[]),t}function nA({adapter:t}){const a=b.useRef(null),i=$1(t),r=M1(t);return b.useLayoutEffect(()=>{const c=a.current;if(c!==null){if(i===null){c.style.removeProperty("--catalog-idle-pct");return}c.style.setProperty("--catalog-idle-pct",`${i.toFixed(1)}%`)}}),l.jsxs(l.Fragment,{children:[l.jsxs("div",{"aria-hidden":"true",className:i===null?"catalog-timing__bar":"catalog-timing__bar catalog-timing__bar--idle",ref:a,children:[i===null||r===null?null:l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"catalog-timing__idle-label",children:r}),l.jsx("span",{className:"catalog-timing__idle-wash"}),l.jsx("span",{className:"catalog-timing__idle-tick"})]}),l.jsx("span",{className:"catalog-timing__axis"}),l.jsx("span",{className:"catalog-timing__node catalog-timing__node--spawn"}),l.jsx("span",{className:"catalog-timing__node catalog-timing__node--end"})]}),l.jsxs("div",{"aria-hidden":"true",className:"catalog-timing__captions",children:[l.jsx("span",{children:"spawn"}),l.jsxs("span",{children:["timeout · ",Ma(t.timeoutSeconds)]})]})]})}function aA(t){return`catalog-dot catalog-dot--${t}`}function sA({onOpenUse:t,uses:a}){const i=a.slice(0,6),r=a.length-i.length;return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"catalog-panel__uses",children:i.map(c=>l.jsxs("button",{className:"catalog-use",onClick:()=>t?.(c),type:"button",children:[l.jsx("span",{"aria-hidden":"true",className:aA(c.status)}),l.jsx("span",{className:"catalog-use__label",children:c.label}),l.jsx("span",{className:"catalog-use__sub",children:c.sub}),l.jsx("span",{"aria-hidden":"true",className:"catalog-use__hint",children:"›"})]},c.id))}),r>0?l.jsxs("p",{className:"catalog-panel__foot",children:["+ ",String(r)," more on sheet"]}):null]})}function lA({adapter:t,adapters:a=[],onBack:i,onOpenUse:r,uses:c}){if(t===void 0)return l.jsx(zx,{children:"Select a configured adapter to open it."});const f=C1(t,c?.length),p=L1(t),h=O1(t),v=z1(a,t.roleNames);return l.jsxs("section",{className:"app-shell__view catalog-detail",children:[l.jsxs(yi,{children:[l.jsx("span",{className:"detail-sticky-bar__id",children:"adapter"}),l.jsx("span",{className:"detail-sticky-bar__name",children:t.name}),l.jsxs("span",{className:"detail-sticky-bar__muted",children:["$ ",t.command," · ",t.parser]}),l.jsx("span",{className:"detail-sticky-bar__spacer"})]}),l.jsxs("div",{className:"catalog-detail__back-bar",children:[i===void 0?null:l.jsx("button",{className:"catalog-back",onClick:i,type:"button",children:"‹ adapters"}),l.jsxs("span",{className:"catalog-detail__back-context",children:["$ ",t.command," · ",t.parser]})]}),l.jsxs("div",{className:"catalog-detail__content",children:[l.jsxs("div",{className:"catalog-detail__eyebrow",children:[l.jsx("span",{className:"catalog-detail__eyebrow-word",children:"adapter"}),l.jsx("span",{className:"catalog-chip",children:t.backend}),l.jsx("span",{className:"catalog-chip",children:t.parser}),t.supportsImages?l.jsx("span",{className:"catalog-chip catalog-chip--muted",children:"images"}):null]}),l.jsxs("div",{className:"catalog-detail__title-row",children:[l.jsx("h1",{className:"catalog-detail__name",children:t.name}),l.jsxs("span",{className:"catalog-detail__command",children:["$ ",t.command]}),l.jsx("span",{className:"catalog-detail__sketch",children:Xh(t)})]}),l.jsx("div",{className:"catalog-facts",children:l.jsx("div",{className:"catalog-facts__group",children:f.map(m=>l.jsxs("span",{className:"catalog-facts__item",children:[l.jsx("span",{className:"catalog-facts__k",children:m.label}),l.jsx("span",{className:"catalog-facts__v",children:m.value})]},m.label))})}),l.jsxs("div",{className:"catalog-panels",children:[l.jsxs("section",{"aria-label":"Timing",className:"catalog-panel",children:[l.jsxs("div",{className:"catalog-panel__head",children:[l.jsx("h2",{className:"catalog-panel__stamp",children:"Timing"}),l.jsx("span",{"aria-hidden":"true",className:"catalog-panel__spacer"}),l.jsx("span",{className:"catalog-panel__caption",children:"seconds as configured"})]}),l.jsx(nA,{adapter:t}),l.jsx("div",{className:"catalog-panel__ledger",children:h.map(m=>l.jsxs("div",{className:"catalog-timing__row",children:[l.jsx("span",{className:"catalog-timing__key",children:m.key}),l.jsxs("span",{className:"catalog-timing__value",children:[m.value,m.raw===""?null:l.jsxs(l.Fragment,{children:[" ",l.jsx("span",{className:"catalog-timing__raw",children:m.raw})]})]}),l.jsx("span",{"aria-hidden":"true",className:"catalog-timing__key"}),l.jsx("span",{className:"catalog-timing__note",children:m.note})]},m.key))})]}),l.jsxs("div",{className:"catalog-panels__stack",children:[l.jsxs("section",{"aria-label":"Reachability",className:"catalog-panel",children:[l.jsxs("div",{className:"catalog-panel__head",children:[l.jsx("h2",{className:"catalog-panel__stamp",children:"Reachability"}),l.jsx("span",{"aria-hidden":"true",className:"catalog-panel__spacer"}),l.jsx("span",{className:`catalog-panel__flag catalog-panel__flag--${p.tone}`,children:p.label})]}),l.jsx("div",{className:"catalog-panel__chips",children:t.usableVia===void 0||t.usableVia.length===0?l.jsx("span",{className:"catalog-chip catalog-chip--pad catalog-chip--muted",children:"not reported"}):t.usableVia.map(m=>l.jsx("span",{className:"catalog-chip catalog-chip--pad",children:m},m))}),l.jsx("p",{className:"catalog-panel__note",children:I1(t)})]}),l.jsxs("section",{"aria-label":"Result contract",className:"catalog-panel",children:[l.jsxs("div",{className:"catalog-panel__head",children:[l.jsx("h2",{className:"catalog-panel__stamp",children:"Result contract"}),l.jsx("span",{"aria-hidden":"true",className:"catalog-panel__spacer"}),l.jsx("span",{className:"catalog-panel__value",children:t.resultContract.enabled?t.resultContract.filename:"none"})]}),l.jsx("p",{className:"catalog-panel__note",children:D1(t)})]})]}),l.jsxs("section",{"aria-label":"Roles and environment keys",className:"catalog-panel",children:[l.jsxs("div",{className:"catalog-panel__head",children:[l.jsx("h2",{className:"catalog-panel__stamp",children:"Roles"}),l.jsx("span",{className:"catalog-panel__count",children:String(t.roleNames.length)})]}),l.jsx("div",{className:"catalog-panel__chips",children:t.roleNames.map(m=>l.jsx("span",{className:"catalog-chip catalog-chip--pad",children:m},m))}),v===null?null:l.jsx("p",{className:"catalog-panel__note",children:v}),l.jsxs("div",{className:"catalog-panel__head catalog-panel__head--divided",children:[l.jsx("h2",{className:"catalog-panel__stamp",children:"Env keys"}),l.jsx("span",{className:"catalog-panel__count",children:String(t.environmentKeys.length)}),l.jsx("span",{"aria-hidden":"true",className:"catalog-panel__spacer"}),l.jsx("span",{className:"catalog-panel__caption",children:"names only · values never served"})]}),t.environmentKeys.length===0?l.jsx("p",{className:"catalog-panel__empty",children:U1()}):l.jsx("div",{className:"catalog-panel__chips",children:t.environmentKeys.map(m=>l.jsx("span",{className:"catalog-chip catalog-chip--pad",children:m},m))})]}),c===void 0?null:l.jsxs("section",{"aria-label":"On sheet",className:"catalog-panel catalog-panel--sheet",children:[l.jsxs("div",{className:"catalog-panel__head",children:[l.jsx("h2",{className:"catalog-panel__stamp",children:"On sheet"}),l.jsx("span",{"aria-hidden":"true",className:"catalog-panel__spacer"}),l.jsx("span",{className:"catalog-panel__caption catalog-panel__caption--tabular",children:G1(c)})]}),c.length===0?l.jsx("p",{className:"catalog-panel__empty",children:"no loaded call ran through this adapter"}):l.jsx(sA,{onOpenUse:r,uses:c})]})]})]})]})}function iA({adapters:t,differencesOnly:a=!1,onClose:i,onDifferencesToggle:r,onOpenAdapter:c,selectedName:f,useCounts:p}){const h=H1(t,p),v=h.filter(C=>C.same).length,m=a?h.filter(C=>!C.same):h,x=b.useRef(null),[y,E]=b.useState(!1),S=()=>{const C=x.current;if(C===null)return;const T=C.scrollWidth-C.clientWidth-C.scrollLeft>2;E(N=>N===T?N:T)};return b.useLayoutEffect(S),l.jsx("section",{className:"app-shell__view catalog-detail",children:l.jsxs("div",{className:"catalog-detail__content",children:[l.jsxs("div",{className:"catalog-detail__eyebrow",children:[l.jsx("span",{className:"catalog-detail__eyebrow-word",children:"adapters"}),l.jsx("span",{className:"catalog-chip",children:"compare"})]}),l.jsxs("div",{className:"catalog-detail__title-row",children:[l.jsx("h1",{className:"catalog-detail__name",children:"Compare adapters"}),l.jsxs("div",{className:"catalog-detail__actions",children:[l.jsx("button",{"aria-pressed":a,className:"catalog-bracket",onClick:()=>r?.(),title:"hide the rows that read the same on every adapter",type:"button",children:a?`[ all ${String(h.length)} facts ]`:"[ differences only ]"}),l.jsx("button",{className:"catalog-bracket",onClick:()=>i?.(),type:"button",children:"[ close ]"})]})]}),l.jsx("p",{className:"catalog-compare__note",children:V1(t.length,h.length,v,a)}),l.jsxs("div",{className:"catalog-compare",children:[l.jsxs("div",{className:"catalog-compare__scroll",onScroll:S,ref:x,children:[l.jsxs("div",{className:"catalog-compare__head-row",children:[l.jsx("span",{"aria-hidden":"true",className:"catalog-compare__label"}),t.map(C=>l.jsx("button",{className:C.name===f?"catalog-compare__head-btn catalog-compare__head-btn--sel":"catalog-compare__head-btn",onClick:()=>c?.(C.name),title:`open ${C.name}`,type:"button",children:C.name},C.name))]}),m.map(C=>l.jsxs("div",{className:"catalog-compare__row",children:[l.jsx("span",{className:"catalog-compare__label",children:C.label}),C.cells.map((T,N)=>l.jsx("span",{className:["catalog-compare__cell",C.same?"catalog-compare__cell--same":"",t[N]?.name===f?"catalog-compare__cell--sel":""].filter(Boolean).join(" "),children:K1(T)},t[N]?.name??String(N)))]},C.label)),m.length===0?l.jsxs("p",{className:"catalog-compare__empty",children:["every fact reads the same on all ",String(t.length)," adapters"]}):null]}),l.jsx("span",{"aria-hidden":"true",className:"catalog-compare__fade","data-on":y?"true":"false"})]})]})})}function Po({groupLabel:t,chips:a,selected:i,onSelect:r}){return l.jsx("div",{"aria-label":t,className:"run-list__filters",role:"group",children:a.filter(c=>c.count>0||c.id===i||c.id==="all").map(c=>l.jsxs("button",{"aria-pressed":i===c.id,onClick:()=>{i!==c.id&&r(c.id)},type:"button",children:[l.jsx("span",{children:c.label}),l.jsx("span",{className:"run-list__filter-count",children:String(c.count)})]},c.id))})}const rA=["all","orphaned","running","succeeded","partial","failed","cancelled"];function Ta(t){return[t.runId,t.runGeneration,t.stateRevision,t.stageId,t.callId].join("\0")}function Cb(t){return[t.runId,t.runGeneration,t.stateRevision].join("\0")}function oA(t,a){return t!==void 0&&t.runId===a.runId&&t.runGeneration===a.runGeneration&&t.stateRevision===a.stateRevision}function cA(t){return Cr(t)==="orphaned"?"orphaned":t.status==="failed"&&t.stageCounts.succeeded>0?"partial":t.status}function uA(t){return t instanceof qn?t.kind==="auth_expired"?"Authentication expired; artifact references were not loaded.":t.kind==="connection_changed"?"Dashboard connection changed; rebootstrap is required.":t.kind==="offline"?"Offline; artifact references could not be refreshed.":t.code==="artifact_catalog_limit_exceeded"?"The retained artifact reference catalog exceeded its server bound; no partial page was returned.":"Artifact references could not be loaded.":"Artifact references could not be loaded."}function dA(t){return t instanceof qn?t.kind==="auth_expired"?"Authentication expired; artifact bytes were not loaded.":t.kind==="connection_changed"?"Dashboard connection changed; rebootstrap is required.":t.kind==="offline"?"Offline; artifact bytes were not loaded.":t.kind==="malformed_json"?"The inspected artifact was malformed JSON; no content was displayed.":t.kind==="stale_revision"||t.code==="run_state_changed"?"The run revision changed after this reference was loaded; refetch the artifact catalog.":t.status===404||t.code==="not_found"||t.code==="run_generation_changed"?"This retained reference was pruned or its run ID was recycled; refetch the artifact catalog.":t.code==="content_too_large_for_dashboard"?"The artifact exceeds the dashboard inspection cap; no content was displayed.":"Artifact inspection failed; no content was displayed.":"Artifact inspection failed."}function Zx(){const[t,a]=b.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(max-width: 880px)").matches);return b.useEffect(()=>{if(typeof window.matchMedia!="function")return;const i=window.matchMedia("(max-width: 880px)"),r=()=>a(i.matches);return r(),i.addEventListener("change",r),()=>i.removeEventListener("change",r)},[]),t}function fA(t){return`${t.runId} ${t.stageId} ${t.callId} JSON validation deferred until inspect`}function pA({collapsed:t,group:a,reference:i,onToggle:r}){const c=a.references.length;return l.jsxs("button",{"aria-expanded":!t,className:"artifact-group__head",onClick:r,title:a.title??void 0,type:"button",children:[l.jsxs("span",{className:"artifact-group__head-row",children:[l.jsx("span",{className:"artifact-group__name",children:a.name??`run ${i.runId}`}),a.status===null?null:l.jsx("span",{className:`artifact-stamp artifact-stamp--${a.status}`,children:a.status}),l.jsx("span",{"aria-hidden":"true",className:"artifact-group__chevron","data-open":!t})]}),l.jsxs("span",{className:"artifact-group__meta",children:["run ",i.runId," · ",String(c)," ref",c===1?"":"s"," ·"," ","gen ",i.runGeneration," · rev ",i.stateRevision]})]})}function hA(t){return t.phase==="loading"?{label:"validating…",tone:"validating"}:t.phase==="current"?{label:"validated",tone:"validated"}:t.phase==="error"?{label:"rejected",tone:"rejected"}:null}function Ob({nextReference:t,onStep:a,positionLabel:i,previousReference:r}){return l.jsxs("span",{className:"artifact-stepper",children:[l.jsx("button",{"aria-label":"previous reference",className:"artifact-stepper__button",disabled:r===void 0,onClick:()=>{r!==void 0&&a(r)},title:"previous reference",type:"button",children:"‹"}),l.jsx("span",{className:"artifact-stepper__position",children:i}),l.jsx("button",{"aria-label":"next reference",className:"artifact-stepper__button",disabled:t===void 0,onClick:()=>{t!==void 0&&a(t)},title:"next reference",type:"button",children:"›"})]})}function mA({active:t=!1,api:a,mobileView:i="list",onBackToList:r,onLoadedCount:c,onSelectReference:f,runs:p,runsRoot:h,selection:v=null}){const m=Zx(),[x,y]=b.useState([void 0]),[E,S]=b.useState(0),[C,T]=b.useState(null),[N,M]=b.useState("loading"),[k,z]=b.useState(null),[R,B]=b.useState({phase:"idle"}),[q,Z]=b.useState(null),[ae,oe]=b.useState("all"),[P,ue]=b.useState({}),[_e,me]=b.useState({}),[be,ve]=b.useState(null),$=b.useRef(null),ee=b.useRef(null),ce=b.useRef(0),de=b.useCallback(async(le,Ae)=>{$.current?.controller.abort();const Le=new AbortController,qe=++ce.current;$.current={id:qe,controller:Le},M("loading"),z(null);let it=le,Et=Ae;try{for(;;){const ut=Et[it],Qe=await a.listArtifacts({...ut===void 0?{}:{before:ut},signal:Le.signal});if($.current?.id!==qe||Le.signal.aborted)return;if(Qe.artifacts.length>0||it===0){y(Et),S(it),T(Qe),M("current"),c?.(Qe.artifacts.length),B(dt=>dt.phase==="idle"||Qe.artifacts.some(wt=>Ta(wt)===Ta(dt.reference))?dt:{phase:"idle"}),ve(dt=>dt!==null&&Qe.artifacts.some(wt=>Ta(wt)===dt)?dt:null);return}it-=1,Et=Et.slice(0,it+1),Z({key:`artifact-page-pruned-${String(qe)}-${String(it)}`,message:"That artifact page was pruned; returned to the nearest newer page."})}}catch(ut){if($.current?.id!==qe||Le.signal.aborted)return;M("error"),z(uA(ut))}},[a,c]);b.useEffect(()=>(de(0,[void 0]),()=>{$.current?.controller.abort(),ee.current?.abort()}),[de]);const ye=b.useCallback(le=>{ee.current?.abort();const Ae=new AbortController;ee.current=Ae,B({phase:"loading",reference:le}),a.inspectArtifact(le,Ae.signal).then(Le=>{if(Ae.signal.aborted||ee.current!==Ae)return;B({phase:"current",reference:le,inspection:Le});const qe=Ta(le);me(it=>it[qe]===!0?it:{...it,[qe]:!0})}).catch(Le=>{Ae.signal.aborted||ee.current!==Ae||Le instanceof qn&&Le.kind==="aborted"||B({phase:"error",reference:le,message:dA(Le)})})},[a]),j=b.useRef(ye);b.useEffect(()=>{j.current=ye},[ye]);const L=C?.artifacts??[],U=b.useMemo(()=>{const le=new Map;for(const Le of p??[])Le.availability==="available"&&(le.has(Le.runId)||le.set(Le.runId,Le));const Ae=[];for(let Le=0;Le<L.length;Le+=1){const qe=L[Le];if(qe===void 0)continue;const it=Cb(qe);if(oA(L[Le-1],qe)){Ae[Ae.length-1]?.references.push(qe);continue}const Et=le.get(qe.runId);Ae.push({key:it,references:[qe],name:Et?.workflowName??null,status:Et===void 0?null:cA(Et),title:h===void 0?null:`${h}/${qe.runId}/artifacts/`})}return Ae},[L,p,h]),Q=b.useMemo(()=>ae==="all"?U:U.filter(le=>le.status===ae),[U,ae]),he=b.useMemo(()=>{const le=[];for(const Ae of Q)P[Ae.key]!==!0&&le.push(...Ae.references);return le},[P,Q]),F=b.useMemo(()=>{if(v!==null){const le=L.find(Ae=>Ae.runId===v.runId&&Ae.stageId===v.stageId&&Ae.callId===v.callId);if(le!==void 0)return le}if(be!==null){const le=L.find(Ae=>Ta(Ae)===be);if(le!==void 0)return le}if(!m)return he[0]},[L,m,be,v,he]),ge=F===void 0?null:Ta(F);b.useEffect(()=>{if(F===void 0){ee.current?.abort(),B({phase:"idle"});return}j.current(F)},[ge]);const Ve=le=>{ve(Ta(le)),f?.({runId:le.runId,stageId:le.stageId,callId:le.callId})},Se=()=>{if(C?.nextBefore===void 0)return;const le=[...x.slice(0,E+1),C.nextBefore];de(E+1,le)},Re=()=>{E!==0&&de(E-1,x)},Pe=()=>{F!==void 0&&j.current(F)},Gt=F===void 0?void 0:U.find(le=>le.key===Cb(F)),Vt=ge===null?-1:he.findIndex(le=>Ta(le)===ge),kt=Vt>0?he[Vt-1]:void 0,Xt=Vt>=0&&Vt<he.length-1?he[Vt+1]:void 0,$t=`${String(Vt+1)} / ${String(he.length)}`,Pt=`${String(Vt+1)} of ${String(he.length)}`,Qt=he.length>1,Kt=N!=="error"&&L.length>0&&C?.nextBefore===void 0,sn=String(L.length),Mn=h===void 0?`[ ${sn} loaded references ]`:`[ RUNS_ROOT = ${h} ]`,ln=rA.map(le=>({id:le,label:le,count:le==="all"?U.length:U.filter(Ae=>Ae.status===le).length})),Jt=l.jsxs("section",{"aria-label":"Run artifacts",className:"artifact-catalog",children:[l.jsx(Ph,{countLabel:`[ ${sn} references ]`,infoLine:Mn,title:"Run artifacts"}),l.jsx(Lh,{announcement:q}),N==="loading"&&C===null?l.jsx(ed,{message:"Loading artifact references…",role:"status"}):null,N==="error"?l.jsx(ed,{message:k??"Artifact references could not be loaded.",retry:{label:"[ retry artifacts ]",run:()=>{de(E,x)}},role:"alert"}):null,U.length>0?l.jsx(Po,{chips:ln,groupLabel:"Filter artifact groups by run status",onSelect:oe,selected:ae}):null,N!=="error"&&L.length===0?l.jsx("p",{className:"artifact-empty",children:"No retained artifact references are loaded on this page."}):null,L.length>0&&Q.length===0?l.jsx("p",{className:"artifact-empty",children:`No loaded artifact references match “${ae}”.`}):null,Q.length>0?l.jsx(bi,{ariaLabel:"Retained artifact references",items:Q.flatMap(le=>{const Ae=P[le.key]===!0,[Le]=le.references;return Le===void 0?[]:le.references.map((qe,it)=>{const Et=le.references[it-1];return{id:Ta(qe),label:fA(qe),disabled:Ae,group:{header:l.jsx(pA,{collapsed:Ae,group:le,onToggle:()=>{ue(ut=>({...ut,[le.key]:!Ae}))},reference:Le}),id:le.key,label:`${le.name??`run ${Le.runId}`} artifact references`},content:l.jsx("div",{className:["artifact-option",it===0?"artifact-option--group-start":"",it===le.references.length-1||Ae?"artifact-option--group-end":"",Ae?"artifact-option--collapsed":""].filter(Boolean).join(" "),"data-collapsed":Ae?"true":void 0,children:Ae?null:l.jsxs(l.Fragment,{children:[Et===void 0||Et.stageId!==qe.stageId?l.jsx("div",{className:"artifact-stage",children:qe.stageId}):null,l.jsxs("div",{className:"artifact-row",children:[l.jsxs("span",{className:"artifact-row__file",children:[qe.callId,".json"]}),l.jsx("span",{className:["artifact-row__meta",_e[Ta(qe)]===!0?"artifact-row__meta--validated":""].filter(Boolean).join(" "),children:_e[Ta(qe)]===!0?"validated":"deferred"}),l.jsx("span",{"aria-hidden":"true",className:"artifact-row__hint",children:"›"})]})]})})}})}),onSelect:le=>{const Ae=L.find(Le=>Ta(Le)===le);Ae!==void 0&&Ve(Ae)},selectedId:ge}):null,l.jsxs("nav",{"aria-label":"Artifact pages",className:"artifact-pager",children:[l.jsx("button",{"aria-label":"newer artifacts",className:"artifact-pager__chip",disabled:E===0||N==="loading",onClick:Re,type:"button",children:"[ newer ]"}),l.jsx("button",{"aria-label":"older artifacts",className:"artifact-pager__chip",disabled:C?.nextBefore===void 0||N==="loading",onClick:Se,type:"button",children:"[ older ]"})]}),Kt?l.jsx("p",{className:"artifact-pager__note",children:"end of retained references"}):null]}),lt=hA(R);let Be;if(F===void 0)Be=l.jsx("section",{"aria-live":"off",className:"app-shell__view",children:l.jsx("p",{className:"artifact-inspector__empty",children:"Select a reference to validate it on the server and inspect the bytes."})});else{const le=F,Ae=`${le.callId}.json`,Le=Gt?.name===void 0||Gt.name===null?le.stageId:`${le.stageId} · ${Gt.name}`,qe=Gt?.status===null||Gt?.status===void 0?null:`artifact-stamp artifact-stamp--${Gt.status}`,it=[["run",le.runId],["generation",le.runGeneration],["revision",le.stateRevision],["kind",le.kind],["reference",Pt]],Et={nextReference:Xt,onStep:Ve,positionLabel:$t,previousReference:kt};Be=l.jsxs("section",{"aria-live":"off",className:"app-shell__view catalog-detail",children:[l.jsxs(yi,{children:[l.jsxs("span",{className:"detail-sticky-bar__id",children:["run ",le.runId]}),qe===null?null:l.jsx("span",{className:qe,children:Gt?.status}),l.jsxs("span",{className:"detail-sticky-bar__name",children:[le.stageId," / ",Ae]}),l.jsx("span",{className:"detail-sticky-bar__spacer"}),l.jsx("span",{className:"detail-sticky-bar__wide",children:Qt?l.jsx(Ob,{...Et}):null})]}),l.jsxs("div",{className:"catalog-detail__back-bar",children:[r===void 0?null:l.jsx("button",{className:"catalog-back",onClick:r,type:"button",children:"‹ artifacts"}),l.jsxs("span",{className:"catalog-detail__back-context",children:["run ",le.runId]}),qe===null?null:l.jsx("span",{className:qe,children:Gt?.status})]}),l.jsxs("div",{className:"catalog-detail__content",children:[l.jsxs("div",{className:"catalog-detail__eyebrow",children:[l.jsx("span",{className:"catalog-detail__eyebrow-word",children:"artifact reference"}),qe===null?null:l.jsx("span",{className:qe,children:Gt?.status}),l.jsx("span",{className:"artifact-chip",children:"json"}),lt===null?null:l.jsx("span",{className:`artifact-chip artifact-chip--${lt.tone}`,children:lt.label})]}),l.jsxs("div",{className:"catalog-detail__title-row",children:[l.jsx("h1",{className:"catalog-detail__name",children:Ae}),l.jsx("span",{className:"catalog-detail__version",children:Le}),l.jsxs("div",{className:"catalog-detail__actions",children:[R.phase==="current"?l.jsx(ma,{label:`Copy ${le.callId} validated artifact bytes`,text:R.inspection.content}):null,Qt?l.jsx(Ob,{...Et}):null]})]}),l.jsxs("div",{className:"catalog-facts",children:[l.jsx("div",{className:"catalog-facts__group",children:it.map(([ut,Qe])=>l.jsxs("span",{className:"catalog-facts__item",children:[l.jsx("span",{className:"catalog-facts__k",children:ut}),l.jsx("span",{className:"catalog-facts__v",children:Qe})]},ut))}),l.jsxs("div",{className:"catalog-facts__actions",children:[R.phase==="current"?l.jsx(ma,{label:`Copy ${le.callId} validated artifact bytes`,text:R.inspection.content}):null,Qt?l.jsxs(l.Fragment,{children:[l.jsx("button",{className:"catalog-bracket catalog-bracket--target44",disabled:kt===void 0,onClick:()=>{kt!==void 0&&Ve(kt)},type:"button",children:"‹ previous"}),l.jsx("button",{className:"catalog-bracket catalog-bracket--target44",disabled:Xt===void 0,onClick:()=>{Xt!==void 0&&Ve(Xt)},type:"button",children:"next ›"})]}):null]})]}),R.phase==="loading"?l.jsxs("div",{className:"artifact-phase artifact-phase--loading",role:"status",children:[l.jsxs("div",{className:"artifact-phase__line",children:[l.jsx("span",{"aria-hidden":"true",className:"artifact-dot artifact-dot--breathing"}),l.jsx("span",{children:"Validating artifact on the server…"})]}),l.jsx("div",{"aria-hidden":"true",className:"artifact-phase__placeholder"})]}):null,R.phase==="error"?l.jsxs("div",{className:"artifact-phase artifact-phase--error",role:"alert",children:[l.jsx("h2",{className:"artifact-phase__stamp",children:"Inspection failed"}),l.jsx("p",{className:"artifact-phase__message",children:R.message}),l.jsx("button",{className:"catalog-bracket artifact-phase__retry",onClick:Pe,type:"button",children:"[ retry inspection ]"})]}):null,R.phase==="current"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"artifact-ok__line",children:[l.jsx("span",{"aria-hidden":"true",className:"artifact-dot artifact-dot--ok"}),l.jsx("span",{role:"status",children:"Server validation succeeded."})]}),l.jsxs("div",{className:"artifact-vfacts",children:[l.jsxs("div",{className:"artifact-vfacts__item",children:[l.jsx("span",{className:"artifact-vfacts__k",children:"validator schema id"}),l.jsx("span",{className:"artifact-vfacts__v",children:R.inspection.validatorId})]}),l.jsxs("div",{className:"artifact-vfacts__item",children:[l.jsx("span",{className:"artifact-vfacts__k",children:"validated byte size"}),l.jsxs("span",{className:"artifact-vfacts__v",children:[String(R.inspection.byteSize)," bytes"]})]}),l.jsxs("div",{className:"artifact-vfacts__item",children:[l.jsx("span",{className:"artifact-vfacts__k",children:"revision fence"}),l.jsxs("span",{className:"artifact-vfacts__v",children:['etag "',le.stateRevision,'" matched']})]})]}),l.jsxs("div",{className:"artifact-view__head",children:[l.jsx("span",{"aria-hidden":"true",className:"catalog-section__spacer"}),l.jsx("span",{className:"artifact-view__caption",children:"bounded json"})]}),l.jsxs("div",{className:"artifact-view__body",children:[l.jsx(vd,{content:R.inspection.content,mediaType:"application/json"}),l.jsx("p",{className:"artifact-view__note",children:"keyed collection view · raw preserves exact bytes"})]})]}):null]})]})}return l.jsx(Rl,{detail:Be,detailAriaLabel:"Artifact inspection",listAriaLabel:"Artifact references",mobileView:i,runList:l.jsxs("section",{"aria-live":"off",className:"app-shell__view",children:[l.jsx("h1",{className:"visually-hidden",id:t?"dashboard-page-title":void 0,children:"Artifacts"}),Jt]})})}const gA=aN(),gu={};function _A(){return{input:_r(),output:_r(),error:_r(),artifact:_r()}}function vA(t){return t instanceof Za?t.code==="run_state_changed"?"run_state_changed":t.code==="content_too_large_for_dashboard"?"content_too_large_for_dashboard":t.code==="not_found"?"not_found":t.kind==="auth_expired"?"auth_expired":t.kind==="connection_changed"?"connection_changed":t.kind==="offline"?"offline":"request_error":"request_error"}function bA({content:t,kind:a,label:i}){const[r,c]=b.useState("rendered"),f=b.useMemo(()=>dN(t.content),[t.content]),p={input:"Prompt",output:"Output",error:"Error",artifact:"Artifact"};return l.jsxs("section",{className:"persisted-call-inspector__loaded-pane",children:[l.jsxs("header",{className:"persisted-call-inspector__content-heading",children:[l.jsx("h3",{children:p[a]}),l.jsxs("p",{children:[i," · ",t.mediaType]})]}),l.jsx(qh,{activeTabId:r,ariaLabel:`${i} representation`,onChange:c,tabs:[{id:"rendered",label:"rendered",panel:l.jsxs("div",{className:"persisted-call-inspector__representation","data-representation":"rendered","data-value-kind":f.kind,children:[l.jsxs("div",{className:"persisted-call-inspector__representation-header",children:[l.jsx("p",{className:"persisted-call-inspector__format",children:f.kind==="json"?"bounded json":"escaped text"}),l.jsx(ma,{label:`Copy ${i}`,text:t.content})]}),l.jsx(yr,{children:f.rendered}),f.truncated?l.jsx("p",{className:"persisted-call-inspector__notice",role:"status",children:"Rendered JSON reached the viewer depth or node limit. Raw persisted content remains available."}):null]})},{id:"raw",label:"raw",panel:l.jsxs("div",{className:"persisted-call-inspector__representation","data-representation":"raw",children:[l.jsx("div",{className:"persisted-call-inspector__representation-header",children:l.jsx(ma,{label:`Copy ${i}`,text:t.content})}),l.jsx(yr,{children:t.content})]})}]}),l.jsx("p",{className:"persisted-call-inspector__pane-foot",children:"bounded persisted content · byte-capped · loaded per pane on demand"})]})}function yA({kind:t,label:a,onRetry:i,state:r}){return r===void 0||r.status==="loading"?l.jsxs("p",{role:"status",children:["Loading ",a,"…"]}):r.status==="error"?l.jsxs("div",{className:"persisted-call-inspector__pane-state",children:[l.jsx("p",{role:"alert",children:oN(r.failure)}),l.jsxs("button",{onClick:i,type:"button",children:["Retry ",a]})]}):l.jsx(bA,{content:r.content,kind:t,label:a})}function xA({api:t=gA,applicationRootId:a,call:i,callNavigation:r,onClose:c,onObsoleteSelection:f,open:p,selection:h,sessionLogApi:v}){const m=Zx(),x=i,y=iN(x),E=[h.runId,h.runGeneration,i.stageId,i.callId].join("\0"),S=`${E}\0${p?"open":"closed"}`,C=y[0]?.kind??(v===void 0?null:"conversation"),[T,N]=b.useState({identity:S,pane:C}),M=T.identity===S?T.pane:C,k=M==="conversation"?v===void 0?C:M:M!==null&&y.some(({kind:L})=>L===M)?M:C,z=b.useCallback(L=>{N({identity:S,pane:L})},[S]),[R,B]=b.useState(()=>C==="conversation");b.useEffect(()=>{B(!1)},[E]),b.useEffect(()=>{k==="conversation"&&B(!0)},[k]);const q=`${h.runId}\0${h.runGeneration}\0${h.stateRevision}`,[Z,ae]=b.useState({identity:q,states:gu}),oe=Z.identity===q?Z.states:gu,P=b.useCallback(L=>{ae(U=>({identity:q,states:L(U.identity===q?U.states:gu)}))},[q]),ue=b.useRef(_A()),_e="persisted-call-inspector-title",me=b.useCallback(()=>{for(const L of Object.values(ue.current))L.cancel()},[]);b.useEffect(()=>{me(),P(()=>gu)},[me,h.stateRevision,P]),b.useEffect(()=>me,[me]),b.useEffect(()=>{if(!p||r===void 0)return;const L=U=>{const Q=U.target;Q instanceof HTMLElement&&(Q.isContentEditable||Q.closest("pre,textarea,input,[contenteditable]")!==null)||(U.key==="ArrowLeft"?(U.preventDefault(),r.onStepCall(-1)):U.key==="ArrowRight"&&(U.preventDefault(),r.onStepCall(1)))};return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[r,p]);const be=b.useCallback(L=>{const U=ue.current[L],Q=U.begin(h);P(he=>({...he,[L]:{status:"loading"}})),t.readPane({...h,stageId:i.stageId,callId:i.callId,kind:L},Q.signal).then(he=>{if(U.accepts(Q.identity,h)){if(!U.acceptsEtag(Q.identity,he.etag)){P(F=>({...F,[L]:{status:"error",failure:"obsolete_etag"}}));return}P(F=>({...F,[L]:{status:"loaded",content:he}}))}}).catch(he=>{if(U.accepts(Q.identity,h)){if(he instanceof Za&&he.code==="run_generation_changed"){f(),c();return}he instanceof Za&&he.kind==="aborted"||P(F=>({...F,[L]:{status:"error",failure:vA(he)}}))}})},[t,i.callId,i.stageId,c,f,h,P]);b.useEffect(()=>{!p||k===null||k==="conversation"||oe[k]!==void 0||be(k)},[k,be,p,oe]);const ve=rN(x),$=r!==void 0&&r.total>1&&r.position>=1&&r.position<=r.total,ee=$&&r.position>1,ce=$&&r.position<r.total,de=b.useCallback(L=>{r!==void 0&&(L===-1&&!ee||L===1&&!ce||r.onStepCall(L))},[r,ce,ee]),ye=b.useCallback(()=>{f(),c()},[c,f]),j=[...y.map(L=>({id:L.kind,label:m?lN[L.kind]:L.label,panel:l.jsx(yA,{kind:L.kind,label:L.label,onRetry:()=>be(L.kind),state:oe[L.kind]})})),...v===void 0?[]:[{id:"conversation",label:"conversation",...R?{keepMounted:!0}:{},panel:l.jsx(_d,{active:k==="conversation",api:v,fill:!0,onGenerationChanged:ye,refreshToken:h.stateRevision,scope:{family:"workflow",runId:h.runId,runGeneration:h.runGeneration,stageId:i.stageId,callId:i.callId}})}]];return l.jsxs(fd,{applicationRootId:a,labelledBy:_e,onClose:c,open:p,panelClassName:"accessible-dialog--sheet",children:[l.jsx("button",{"aria-label":"close inspector",className:"persisted-call-inspector__grab-handle",onClick:c,type:"button",children:l.jsx("span",{"aria-hidden":"true"})}),l.jsxs("header",{className:"persisted-call-inspector__header",children:[l.jsxs("div",{className:"persisted-call-inspector__heading",children:[l.jsx("h2",{className:"visually-hidden",id:_e,children:"Call inspector"}),l.jsxs("div",{className:"persisted-call-inspector__title-line",children:[l.jsx("strong",{children:i.callId}),i.snapshotIdentity===void 0?null:l.jsxs("span",{className:"persisted-call-inspector__identity-badge",children:[i.snapshotIdentity.adapter," · ",i.snapshotIdentity.role]}),Xy(i.invocation,i.observedInvocation).map((L,U)=>{const Q=U===1?"effort":"model";return l.jsx("span",{className:"persisted-call-inspector__identity-badge persisted-call-inspector__knob-badge",children:L},Q)}),l.jsx("span",{className:"persisted-call-inspector__status","data-state":i.state,children:i.state}),$?l.jsxs("span",{className:"persisted-call-inspector__call-nav",children:[l.jsx("button",{"aria-label":"previous call",className:"persisted-call-inspector__call-nav-btn",disabled:!ee,onClick:()=>de(-1),title:"previous call (←)",type:"button",children:"‹"}),l.jsxs("span",{className:"persisted-call-inspector__call-nav-label",children:[String(r.position)," / ",String(r.total)]}),l.jsx("button",{"aria-label":"next call",className:"persisted-call-inspector__call-nav-btn",disabled:!ce,onClick:()=>de(1),title:"next call (→)",type:"button",children:"›"})]}):null]}),l.jsxs("div",{className:"persisted-call-inspector__meta-line",children:[l.jsxs("p",{className:"persisted-call-inspector__identity",children:[m&&i.snapshotIdentity!==void 0?`${i.snapshotIdentity.adapter} · ${i.snapshotIdentity.role} · `:"","run ",h.runId," · stage ",i.stageId,i.durationMs===void 0?"":` · duration ${Fa(i.durationMs)}`]}),l.jsx("span",{className:"persisted-call-inspector__close-hint",children:"esc to close"})]})]}),l.jsx("button",{"aria-label":"Close inspector",className:"persisted-call-inspector__close",onClick:c,type:"button",children:"×"})]}),l.jsxs("div",{className:"persisted-call-inspector__body","data-conversation":k==="conversation"?"true":void 0,children:[l.jsxs("p",{className:"persisted-call-inspector__scope-note",children:["persisted call content is separate from the redacted per-attempt session log",i.hasWorkflowInput?" · workflow input is not the fully composed provider prompt":""]}),ve?l.jsx("p",{className:"persisted-call-inspector__notice",role:"status",children:ve}):null,j.length===0||k===null?l.jsx("p",{className:"persisted-call-inspector__empty",children:"No persisted call content is available."}):l.jsx(qh,{activeTabId:k,ariaLabel:"Persisted call content",onChange:L=>z(L),tabs:j})]})]})}const Th="clinkx-invocation-audit-v2",$b="clinkx-observed-invocation-v1",Mb="context-builder-invocation-audit-v1",Lb="context-builder-invocation-audit-v2",wA=["caller_override","adapter_pin","cli_default_unknown"],jA=["caller_override","adapter_pin","adapter_default","cli_default_unknown"],SA=["claude_stream_json_init","codex_app_server_thread_start"];class NA extends Error{constructor(a){super(a),this.name="InvocationAuditParseError"}}const kA=128,AA=32,RA=/^[^\s\u0000-][^\s\u0000]*$/,EA=/^[a-z0-9][a-z0-9_-]*$/,TA=/^[A-Za-z0-9_-]{1,64}$/;function Nn(t,a){throw new NA(`${t} ${a}`)}function CA(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function ms(t,a){return CA(t)||Nn(a,"must be an object"),t}function Tu(t,a){return Object.prototype.hasOwnProperty.call(t,a)}function $a(t,a,i){const r=new Set(a),c=Object.keys(t).find(f=>!r.has(f));c!==void 0&&Nn(`${i}.${c}`,"is unexpected")}function OA(t,a){return typeof t=="string"&&a.some(i=>i===t)}function bd(t,a,i){return OA(t,a)||Nn(i,"is not a recognized value"),t}function Cu(t,a,i){const r=a==="model"?kA:AA,c=a==="model"?RA:EA;return(typeof t!="string"||t.length===0||t.length>r||!c.test(t))&&Nn(i,`must match the bounded ${a} grammar`),t}function Ib(t,a,i){const r=ms(t,i);$a(r,["requested","applied","provenance"],i);const c=bd(r.provenance,wA,`${i}.provenance`);if(c==="caller_override"){const f=Cu(r.requested,a,`${i}.requested`),p=Cu(r.applied,a,`${i}.applied`);return f!==p&&Nn(i,"requires requested and applied values to agree"),Object.freeze({provenance:c,requested:f,applied:p})}return c==="adapter_pin"?(r.requested!==void 0&&Nn(`${i}.requested`,"is impossible for adapter_pin"),Object.freeze({provenance:c,applied:Cu(r.applied,a,`${i}.applied`)})):((r.requested!==void 0||r.applied!==void 0)&&Nn(i,"cannot carry values for cli_default_unknown"),Object.freeze({provenance:c}))}function Ch(t,a="invocation"){const i=ms(t,a);$a(i,["model","effort"],a);const r=i.model===void 0?void 0:Ib(i.model,"model",`${a}.model`),c=i.effort===void 0?void 0:Ib(i.effort,"effort",`${a}.effort`);return Object.freeze({...r===void 0?{}:{model:r},...c===void 0?{}:{effort:c}})}function Do(t,a,i){const r=ms(t,i);if(r.state==="recorded")return $a(r,["state","value"],i),Tu(r,"value")||Nn(`${i}.value`,"is required"),Object.freeze({state:"recorded",value:Cu(r.value,a,`${i}.value`)});if(r.state==="accepted_unrepresentable")return $a(r,["state"],i),Object.freeze({state:"accepted_unrepresentable"});Nn(`${i}.state`,"is not a recognized value state")}function $A(t,a){return t.state!==a.state?!1:t.state==="accepted_unrepresentable"||a.state==="recorded"&&t.value===a.value}function Db(t,a,i){const r=ms(t,i),c=bd(r.provenance,jA,`${i}.provenance`);if(c==="caller_override"){$a(r,["provenance","requested","applied"],i),(!Tu(r,"requested")||!Tu(r,"applied"))&&Nn(i,"requires requested and applied value states");const f=Do(r.requested,a,`${i}.requested`),p=Do(r.applied,a,`${i}.applied`);return $A(f,p)||Nn(i,"requires requested and applied value states to agree"),Object.freeze({provenance:c,requested:f,applied:p})}return c==="adapter_pin"||c==="adapter_default"?($a(r,["provenance","applied"],i),Tu(r,"applied")||Nn(`${i}.applied`,"is required"),Object.freeze({provenance:c,applied:Do(r.applied,a,`${i}.applied`)})):($a(r,["provenance"],i),Object.freeze({provenance:c}))}function MA(t,a="invocation"){const i=ms(t,a);$a(i,["schemaVersion","model","effort"],a),i.schemaVersion!==Th&&Nn(`${a}.schemaVersion`,"is not the supported V2 version");const r=i.model===void 0?void 0:Db(i.model,"model",`${a}.model`),c=i.effort===void 0?void 0:Db(i.effort,"effort",`${a}.effort`);return r===void 0&&c===void 0&&Nn(a,"must record at least one knob in V2"),Object.freeze({schemaVersion:Th,...r===void 0?{}:{model:r},...c===void 0?{}:{effort:c}})}function Ho(t,a="invocation"){const i=ms(t,a);return i.schemaVersion===Th?MA(i,a):Ch(i,a)}function LA(t,a="observedInvocation"){const i=ms(t,a);$a(i,["schemaVersion","source","model","effort"],a),i.schemaVersion!==$b&&Nn(`${a}.schemaVersion`,"is not the supported observed invocation version");const r=bd(i.source,SA,`${a}.source`),c=i.model===void 0?void 0:Do(i.model,"model",`${a}.model`),f=i.effort===void 0?void 0:Do(i.effort,"effort",`${a}.effort`);return c===void 0&&f===void 0&&Nn(a,"must record at least one observed knob"),Object.freeze({schemaVersion:$b,source:r,...c===void 0?{}:{model:c},...f===void 0?{}:{effort:f}})}function Fx(t,a="observedInvocation"){if(t!==void 0)try{return LA(t,a)}catch{return}}function IA(t,a="invocationAudit"){const i=ms(t,a);$a(i,["curator","finalizer"],a);const r=i.curator===void 0?void 0:Ho(i.curator,`${a}.curator`),c=i.finalizer===void 0?void 0:Ho(i.finalizer,`${a}.finalizer`);return Object.freeze({...r===void 0?{}:{curator:r},...c===void 0?{}:{finalizer:c}})}function DA(t,a="audit"){const i=ms(t,a);if($a(i,["schema_version","curator","finalizer"],a),i.schema_version===Mb){const r=i.curator===void 0?void 0:Ch(i.curator,`${a}.curator`),c=i.finalizer===void 0?void 0:Ch(i.finalizer,`${a}.finalizer`);return Object.freeze({schema_version:Mb,...r===void 0?{}:{curator:r},...c===void 0?{}:{finalizer:c}})}if(i.schema_version===Lb){const r=i.curator===void 0?void 0:Ho(i.curator,`${a}.curator`),c=i.finalizer===void 0?void 0:Ho(i.finalizer,`${a}.finalizer`);return Object.freeze({schema_version:Lb,...r===void 0?{}:{curator:r},...c===void 0?{}:{finalizer:c}})}Nn(`${a}.schema_version`,"is not a supported sidecar version")}function zA(t,a="contextPreflightInvocation"){const i=ms(t,a);$a(i,["execution","artifactRunId","audit"],a);const r=bd(i.execution,["current","cache_source"],`${a}.execution`);return(typeof i.artifactRunId!="string"||!TA.test(i.artifactRunId))&&Nn(`${a}.artifactRunId`,"is malformed"),Object.freeze({execution:r,artifactRunId:i.artifactRunId,audit:DA(i.audit,`${a}.audit`)})}const qA=["not_configured","disabled","pending","running","succeeded","failed","cancelled","skipped"],Yx=new Set(["unauthorized","invalid_request","method_not_allowed","host_rejected","origin_rejected","agent_instance_changed","not_found","dashboard_busy","run_directory_limit_exceeded","scan_byte_budget_exceeded","projection_cache_budget_exceeded","live_run_limit_exceeded","artifact_catalog_limit_exceeded","run_generation_changed","run_state_changed","activity_generation_changed","activity_state_changed","content_too_large_for_dashboard","progress_report_malformed","progress_report_overrides_unavailable","prompt_builder_library_unavailable","internal_error"]);class we extends Error{kind;status;code;constructor(a,i,r){super(a),this.name="DashboardApiError",this.kind=a,this.status=i,this.code=r}}function El(t){return t??new AbortController().signal}function UA(t){return typeof DOMException<"u"&&t instanceof DOMException&&t.name==="AbortError"}function td(t,a,i){try{Hs(t)}catch(r){throw r instanceof bt?new we("connection_changed",409,"agent_instance_changed"):r}if(a.aborted||UA(i))throw new we("aborted")}async function vr(t,a,i){let r;try{r=await t(a,{signal:i})}catch(c){throw c instanceof bt?new we("connection_changed",409,"agent_instance_changed"):i.aborted||c instanceof DOMException&&c.name==="AbortError"?new we("aborted"):new we("offline")}if(r.status===401)throw new we("auth_expired",401,"unauthorized");if(!r.ok){let c;try{const f=await na(r);typeof f.error?.code=="string"&&Yx.has(f.error.code)&&(c=f.error.code)}catch(f){if(f instanceof bt)throw new we("connection_changed",409,"agent_instance_changed");td(r,i,f)}throw c==="agent_instance_changed"?new we("connection_changed",r.status,c):new we("request_error",r.status,c)}try{return await na(r)}catch(c){throw c instanceof bt?new we("connection_changed",409,"agent_instance_changed"):(td(r,i,c),new we("request_error",r.status))}}async function zb(t,a,i){let r;try{r=await t(a,{signal:i})}catch(c){throw c instanceof bt?new we("connection_changed",409,"agent_instance_changed"):i.aborted||c instanceof DOMException&&c.name==="AbortError"?new we("aborted"):new we("offline")}if(r.status===401)throw new we("auth_expired",401,"unauthorized");if(!r.ok){let c;try{const f=await na(r);typeof f.error?.code=="string"&&Yx.has(f.error.code)&&(c=f.error.code)}catch(f){if(f instanceof bt)throw new we("connection_changed",409,"agent_instance_changed");td(r,i,f)}throw c==="agent_instance_changed"?new we("connection_changed",r.status,c):new we("request_error",r.status,c)}try{return{content:await Gh(r),mediaType:r.headers.get("content-type")?.toLowerCase().startsWith("application/json")?"application/json":"text/plain",etag:r.headers.get("etag")}}catch(c){throw c instanceof bt?new we("connection_changed",409,"agent_instance_changed"):(td(r,i,c),new we("request_error",r.status))}}function Xx(t,a){if(t!==void 0)try{return Ho(t,a)}catch{return}}function Px(t){const{invocation:a,observedInvocation:i,...r}=t,c=Xx(a,"activity.invocation"),f=Fx(i,"activity.observedInvocation");return{...r,...c===void 0?{}:{invocation:c},...f===void 0?{}:{observedInvocation:f}}}function BA(t,a,i){const{invocation:r,observedInvocation:c,...f}=t,p=`run.stages[${String(a)}].calls[${String(i)}]`,h=Xx(r,`${p}.invocation`),v=Fx(c,`${p}.observedInvocation`);return{...f,...h===void 0?{}:{invocation:h},...v===void 0?{}:{observedInvocation:v}}}function GA(t){return typeof t=="string"&&qA.includes(t)}function HA(t){if(t===void 0)return;if(t.availability!=="current")return t;const{finalizerEffectiveEnabled:a,finalizerExecutionStatus:i,...r}=t,c=typeof a=="boolean"?a:void 0,f=GA(i)?i:void 0;return{...r,...c===void 0?{}:{finalizerEffectiveEnabled:c},...f===void 0?{}:{finalizerExecutionStatus:f}}}function Qx(t){if(t.availability!=="available")return t;const{contextPreflight:a,contextPreflightInvocation:i,...r}=t,c=t.stages.map((h,v)=>({...h,calls:h.calls.map((m,x)=>BA(m,v,x))})),f=HA(a);let p;if(i!==void 0)try{p=zA(i,"run.contextPreflightInvocation")}catch{p=void 0}return{...r,stages:c,...f===void 0?{}:{contextPreflight:f},...p===void 0?{}:{contextPreflightInvocation:p}}}async function qb(t,a,i,r){const c=encodeURIComponent(a.runId),f=await vr(t,`/api/runs/${c}`,El(i)),p=Qx(f);if(p.runGeneration!==a.runGeneration)throw new we("request_error",409,"run_generation_changed");if(r&&p.stateRevision!==a.stateRevision)throw new we("request_error",409,"run_state_changed");return p}async function Ub(t,a,i,r){const c=encodeURIComponent(a.activityId),f=await vr(t,`/api/activities/${c}`,El(i)),p=Px(f);if(p.activityGeneration!==a.activityGeneration)throw new we("request_error",409,"activity_generation_changed");if(r&&p.stateRevision!==a.stateRevision)throw new we("request_error",409,"activity_state_changed");return p}function Jx(t=hs){return{async getRunDetailCurrent(a,i){const r=await vr(t,`/api/runs/${encodeURIComponent(a)}`,El(i));return Qx(r)},async getActivityDetailCurrent(a,i){const r=await vr(t,`/api/activities/${encodeURIComponent(a)}`,El(i));return Px(r)},async listActivities(a={}){const i=new URLSearchParams({limit:"100"});return a.before!==void 0&&i.set("before",a.before),await vr(t,`/api/activities?${i.toString()}`,El(a.signal))},async getActivityDetailForPolling(a,i){return Ub(t,a,i,!1)},async getActivityDetail(a,i){return Ub(t,a,i,!0)},async getActivityResult(a,i){const r=encodeURIComponent(a.activityId),c=encodeURIComponent(a.activityGeneration);return await zb(t,`/api/activities/${r}/result?generation=${c}`,El(i))},async listRuns(a={}){const i=new URLSearchParams({limit:"100"});return a.before!==void 0&&i.set("before",a.before),await vr(t,`/api/runs?${i.toString()}`,El(a.signal))},async getRunDetailForPolling(a,i){return qb(t,a,i,!1)},async getRunDetail(a,i){return qb(t,a,i,!0)},async getRunResult(a,i){const r=encodeURIComponent(a.runId),c=encodeURIComponent(a.runGeneration);return await zb(t,`/api/runs/${r}/result?generation=${c}`,El(i))}}}async function VA(t){const a=await globalThis.crypto.subtle.digest("SHA-256",new TextEncoder().encode(t));return[...new Uint8Array(a)].map(i=>i.toString(16).padStart(2,"0")).join("")}async function KA(t){const a=JSON.parse(t);if(a===null||typeof a!="object"||!("schema_version"in a)||a.schema_version!=="council-plan-review-result-v1")throw new Error("validated plan-review result schema is unavailable");return{bytes:new TextEncoder().encode(t).byteLength,schemaVersion:a.schema_version,sha256:await VA(t)}}function ZA(t){switch(t.reason){case"run_pending":return"Result is not available while the run is pending.";case"run_running":return"Result is not available while the run is running.";case"run_failed":return"This failed run has no successful result.";case"run_cancelled":return"This cancelled run has no successful result.";case"not_persisted":return"No result was persisted for this run.";case"missing":return"The persisted result is missing or was pruned.";case"invalid":return"The persisted result failed server validation.";case"too_large":return"The persisted result exceeds the dashboard content cap."}}function FA(t){return t instanceof we?t.code==="run_state_changed"?"The run state changed during the result read. Retry to use the current revision.":t.code==="content_too_large_for_dashboard"?"The persisted result exceeds the dashboard content cap.":t.code==="not_found"||t.status===404?"The persisted result is missing or was pruned. Run metadata remains available.":t.kind==="auth_expired"?"Dashboard authorization expired.":t.kind==="connection_changed"?"Dashboard connection changed; rebootstrap is required.":t.kind==="offline"?"The dashboard server is offline.":"The result could not be loaded. Retry the local read.":"The result could not be rendered. Retry the local read."}function Wx(t){const a=new TextEncoder().encode(t).byteLength;return a<1024?`${String(a)} B`:`${(a/1024).toFixed(1)} KiB`}function YA({api:t=Jx(),availability:a,onRunGenerationChanged:i,selection:r}){const c=b.useRef(_r()),[f,p]=b.useState({kind:"idle"}),h=`${r.runId}\0${r.runGeneration}\0${r.stateRevision}`,v=f.kind!=="idle"&&f.identity!==h?{kind:"idle"}:f;if(b.useEffect(()=>(c.current.cancel(),p({kind:"idle"}),()=>c.current.cancel()),[r.runId,r.runGeneration,r.stateRevision]),a.availability==="unavailable"){const x=a.reason==="not_persisted"||a.reason==="missing";return l.jsxs("section",{"aria-labelledby":"run-result-heading",className:"run-result-panel",children:[l.jsxs("div",{className:"run-result-panel__header",children:[l.jsx("h2",{"aria-label":"Run result",id:"run-result-heading",children:"Result"}),x?l.jsx("span",{className:"run-result-panel__metadata",children:"not retained"}):null]}),l.jsx("p",{className:"run-result-panel__local-state",children:ZA(a)})]})}const m=()=>{const x=c.current.begin(r);p({kind:"loading",identity:h}),t.getRunResult(r,x.signal).then(async y=>{if(!c.current.isActive(x.identity))return;if(!c.current.acceptsEtag(x.identity,y.etag)){p({kind:"error",identity:h,message:"The result response belongs to an obsolete state revision. Retry the local read."});return}const E=a.kind==="plan_review"?await KA(y.content):void 0;c.current.acceptsEtag(x.identity,y.etag)&&p({kind:"available",identity:h,raw:y,...E===void 0?{}:{publication:E}})}).catch(y=>{if(c.current.isActive(x.identity)&&!(y instanceof we&&y.kind==="aborted")){if(y instanceof we&&y.code==="run_generation_changed"){i();return}p({kind:"error",identity:h,message:FA(y)})}})};return l.jsxs("section",{"aria-labelledby":"run-result-heading",className:"run-result-panel",children:[l.jsxs("div",{className:"run-result-panel__header",children:[l.jsx("h2",{"aria-label":"Run result",id:"run-result-heading",children:"Result"}),v.kind==="available"?l.jsx("span",{className:"run-result-panel__metadata",children:Wx(v.raw.content)}):null,v.kind==="available"?null:l.jsx("button",{"aria-label":v.kind==="error"?"Retry result":"Load result",disabled:v.kind==="loading",onClick:m,type:"button",children:v.kind==="loading"?"[ loading result… ]":v.kind==="error"?"[ retry result ]":"[ load result ]"})]}),v.kind==="loading"?l.jsx("p",{role:"status",children:"Loading persisted result…"}):null,v.kind==="error"?l.jsx("p",{className:"run-result-panel__local-state",role:"status",children:v.message}):null,v.kind==="available"?l.jsxs(l.Fragment,{children:[v.publication?l.jsxs("dl",{"aria-label":"Plan-review publication facts",className:"publication-facts",children:[l.jsxs("div",{children:[l.jsx("dt",{children:"Publication marker"}),l.jsx("dd",{children:"committed and server-validated"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"Validated size"}),l.jsxs("dd",{children:[v.publication.bytes," bytes"]})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"Validated SHA-256"}),l.jsx("dd",{className:"publication-facts__digest",children:v.publication.sha256})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"Result schema"}),l.jsx("dd",{children:v.publication.schemaVersion})]})]}):null,l.jsx(vd,{content:v.raw.content,mediaType:v.raw.mediaType})]}):null]})}const XA=1400;function PA(){const[t,a]=b.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(max-width: 880px)").matches);return b.useEffect(()=>{if(typeof window.matchMedia!="function")return;const i=window.matchMedia("(max-width: 880px)"),r=()=>a(i.matches);return r(),i.addEventListener("change",r),()=>i.removeEventListener("change",r)},[]),t}async function QA(t){try{if(navigator.clipboard)return await navigator.clipboard.writeText(t),!0}catch{}try{const a=document.createElement("textarea");return a.className="copy-fallback-input",a.value=t,a.setAttribute("readonly",""),document.body.append(a),a.select(),document.execCommand("copy")}catch{return!1}}function Gp({phase:t,onRetry:a}){return t==="stale"||t==="offline"||t==="error"?l.jsx("button",{className:"run-detail__button",type:"button",onClick:a,children:"[ retry now ]"}):null}function Hp({source:t}){const a=b.useMemo(()=>Ih(t),[t]),[i,r]=b.useState(!1);if(b.useEffect(()=>{if(!i)return;const f=setTimeout(()=>r(!1),XA);return()=>{clearTimeout(f)}},[i]),a===null)return null;const c=a.text.includes(`
|
|
26
|
-
`)?"[ copy mcp handoff ]":`[ copy ${a.tool} ]`;return l.jsxs(l.Fragment,{children:[l.jsx("button",{"aria-label":`Copy ${a.tool} handoff for ${t.runId}`,className:"run-detail__button","data-copy-state":i?"copied":"idle",onClick:()=>{QA(a.text).then(f=>r(f))},title:`read-only dashboard — copies the MCP tool invocation to dispatch from your client
|
|
27
|
-
${a.text}`,type:"button",children:i?"copied ✓":c}),i?l.jsx("span",{className:"visually-hidden",role:"status",children:"Copied"}):null]})}function JA({stage:t,trackTopPx:a,hoveredKey:i,isPhone:r,onHoverCall:c,onInspectCall:f}){const p=e0(t),h=Math.max(0,t.callBars.length*9-3),v=Math.round((p-h)/2);return l.jsx("div",{className:"run-detail__timeline-track",children:l.jsx("svg",{className:"run-detail__timeline-svg",height:p,children:t.callBars.map((m,x)=>{const y=v+x*9,E=`${m.stageId}\0${m.callId}`,S=()=>f({stageId:m.stageId,callId:m.callId}),C={callKey:E,cxPercent:m.startPercent+m.widthPercent/2,topPx:a+y+3,callId:m.callId,who:`${m.adapterLabel} / ${m.roleLabel}`,state:m.state,duration:m.durationLabel,ariaText:`${m.callId} ${m.adapterLabel} / ${m.roleLabel} · ${m.state} ${m.durationLabel}`};return l.jsxs("g",{"aria-label":`Open persisted log for ${m.tooltipLabel}`,className:"run-detail__timeline-call","data-hov":i===E,onBlur:()=>c(null),onClick:S,onFocus:()=>c(C),onKeyDown:T=>{T.key!=="Enter"&&T.key!==" "||(T.preventDefault(),S())},onMouseEnter:()=>c(C),onMouseLeave:()=>c(null),role:"button",tabIndex:0,children:[r?l.jsx("title",{children:m.tooltipLabel}):null,l.jsx("rect",{className:"run-detail__timeline-bar-hit",height:"9",rx:"4.5",width:`${String(m.widthPercent)}%`,x:`${String(m.startPercent)}%`,y:y-1.5}),l.jsx("rect",{className:`run-detail__timeline-bar run-detail__timeline-bar--call run-detail__timeline-bar--${m.state}`,"data-bar-id":m.id,height:"6",rx:"3",width:`${String(m.widthPercent)}%`,x:`${String(m.startPercent)}%`,y})]},m.id)})})})}function e0(t){return Math.max(30,t.callBars.length*9-3)}const Bb=28;function WA({applicationRootId:t,inspectorApi:a,resultApi:i,sessionLogApi:r,state:c,contextPreflight:f,routeCall:p,onInspectorRouteChange:h,onBack:v,onRetry:m,onRunGenerationChanged:x}){const y=c.detail,E=PA(),S=b.useRef(null),[C,T]=b.useState(null),[N,M]=b.useState(null),[k,z]=b.useState(null),[R,B]=b.useState(!1),[q,Z]=b.useState(!1),ae=c.selected===null?null:`${c.selected.runId}\0${c.selected.runGeneration}`,oe=p!==void 0,P=p===void 0?" unmanaged":p===null?" none":`${p.stageId} ${p.callId}`;b.useEffect(()=>{z(null),M(null),T(p==null?null:{stageId:p.stageId,callId:p.callId})},[ae,P]);const ue=F=>{const ge=C===null?"open":"switch";T(F),oe&&h?.(F,ge)},_e=()=>{T(null),oe&&h?.(null,"close")},me=b.useMemo(()=>C===null||y===null||y.availability!=="available"?null:y.stages.find(F=>F.stageId===C.stageId)?.calls.find(F=>F.callId===C.callId)??null,[y,C]),be=b.useMemo(()=>y===null||y.availability!=="available"?[]:y.stages.flatMap(F=>F.calls.filter(ge=>ge.hasWorkflowInput||ge.hasOutput||ge.hasRawError||ge.hasArtifactReference).map(ge=>({stageId:F.stageId,callId:ge.callId}))),[y]),ve=b.useMemo(()=>{if(C===null||be.length<=1)return;const F=be.findIndex(ge=>ge.stageId===C.stageId&&ge.callId===C.callId);if(!(F<0))return{total:be.length,position:F+1,onStepCall:ge=>{const Se=be.findIndex(Pe=>Pe.stageId===C.stageId&&Pe.callId===C.callId)+ge,Re=be[Se];Re!==void 0&&ue(Re)}}},[be,C]);if(c.selected===null)return l.jsxs("section",{className:"app-shell__view run-detail run-detail--empty",children:[l.jsx("h2",{className:"app-shell__title",children:"Run detail"}),l.jsx("p",{className:"app-shell__note",children:"Select a retained run to inspect persisted state."})]});if(y===null)return l.jsxs("section",{className:"app-shell__view run-detail","aria-busy":"true",children:[l.jsx("button",{className:"run-detail__back",type:"button",onClick:v,children:"‹ back to run list"}),l.jsx("h2",{className:"app-shell__title",children:"Run detail"}),l.jsx("p",{className:"app-shell__note",children:"Loading selected run state…"})]});if(y.availability==="unavailable")return l.jsxs("section",{className:"app-shell__view run-detail",children:[l.jsx("button",{className:"run-detail__back",type:"button",onClick:v,children:"‹ back to run list"}),l.jsx("h2",{className:"app-shell__title",children:"Run detail unavailable"}),l.jsx("p",{className:"run-detail__run-id op-mono overflow-safe",children:y.runId}),l.jsxs("p",{className:"app-shell__note",children:["Diagnostic metadata only · ",y.reason.replaceAll("_"," ")]})]});const $=rS(y,c.displayNowMs),ee=f!=null&&f.availability==="current"?f:void 0,ce=ee?.contextRunId!==void 0,de=F=>{const ge=S.current;if(ge===null)return;const Ve=ge.querySelector(`[data-stage-id="${F.replaceAll('"','\\"')}"]`);if(Ve===null)return;const Se=ge.closest(".dashboard-layout__detail");if(Se===null||typeof Se.scrollTo!="function")return;const Re=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;Se.scrollTo({top:Ve.getBoundingClientRect().top-Se.getBoundingClientRect().top+Se.scrollTop-12,behavior:Re?"auto":"smooth"})};let ye=28;const j=$.timeline?.stages.map(F=>{const ge=ye;return ye+=e0(F)+2,ge})??[],L=F=>{z(F),M(F===null?null:F.callKey)},U=l.jsx("button",{"aria-expanded":R,className:"run-detail__fact-toggle",onClick:()=>B(F=>!F),type:"button",children:R?"[ hide details ]":"[ details ]"}),Q=k===null?null:k.cxPercent<18?"start":k.cxPercent>82?"end":"middle",he=k===null?0:k.topPx>64?k.topPx-Bb-8:k.topPx-Bb+18;return l.jsxs("section",{className:"app-shell__view run-detail",children:[l.jsxs(yi,{children:[l.jsxs("span",{className:"detail-sticky-bar__id",children:["run ",$.runId]}),l.jsx("span",{className:"run-detail__status","data-state":$.statusState,children:$.statusLabel}),l.jsx("span",{className:"detail-sticky-bar__name",children:y.workflowName}),l.jsx("span",{className:"detail-sticky-bar__spacer"}),l.jsxs("span",{className:"detail-sticky-bar__wide detail-sticky-bar__fact",children:[l.jsx("span",{className:"detail-sticky-bar__fact-k",children:$.isLive?"elapsed":"duration"}),l.jsx("span",{className:"detail-sticky-bar__fact-v",children:$.elapsedLabel})]}),l.jsxs("span",{className:"detail-sticky-bar__wide detail-sticky-bar__actions",children:[l.jsx(Gp,{phase:c.phase,onRetry:m}),l.jsx(Hp,{source:y})]})]}),l.jsxs("div",{className:"run-detail__mobile-nav",children:[l.jsx("button",{"aria-label":"back to run list",className:"run-detail__back",type:"button",onClick:v,children:"‹ runs"}),l.jsxs("span",{className:"op-caption op-mono overflow-safe",children:["run ",$.runId]}),y.async?l.jsx("span",{className:"run-detail__mode",children:"async"}):null,l.jsx("span",{className:"run-detail__status","data-state":$.statusState,children:$.statusLabel})]}),l.jsx("header",{className:"run-detail__header",children:l.jsxs("div",{className:"run-detail__header-identity",children:[l.jsxs("div",{className:"run-detail__identity-line",children:[l.jsxs("span",{className:"op-caption op-mono overflow-safe",children:["run ",$.runId]}),l.jsx("span",{className:"run-detail__status","data-state":$.statusState,children:$.statusLabel}),$.workerEvidenceLabel===null?null:l.jsx("span",{className:"run-detail__mode",title:$.workerEvidenceDescription??void 0,children:$.workerEvidenceLabel}),$.modeLabels.map(F=>l.jsx("span",{className:"run-detail__mode",children:F},F))]}),l.jsxs("div",{className:"run-detail__workflow-heading",children:[l.jsx("h2",{className:"run-detail__title run-detail__title--major overflow-safe",children:y.workflowName}),l.jsxs("span",{className:"op-caption op-mono",children:["v",y.workflowVersion]}),E?null:l.jsxs("div",{className:"run-detail__header-actions",children:[l.jsx(Gp,{phase:c.phase,onRetry:m}),l.jsx(Hp,{source:y})]})]})]})}),l.jsxs("div",{className:"run-detail__facts",children:[l.jsxs("div",{className:"run-detail__facts-group",children:[$.headerFacts.map(F=>l.jsxs("span",{className:"run-detail__fact",children:[l.jsx("span",{className:"run-detail__fact-k",children:F.label}),l.jsx("span",{className:"run-detail__fact-v",children:F.value})]},F.label)),E?null:U]}),E?l.jsxs("div",{className:"run-detail__facts-actions",children:[U,l.jsx(Gp,{phase:c.phase,onRetry:m}),l.jsx(Hp,{source:y})]}):null]}),l.jsxs("dl",{"aria-label":"Run metadata",className:"run-detail__details",hidden:!R,children:[$.detailFacts.map(F=>l.jsxs("div",{children:[l.jsx("dt",{children:F.label}),l.jsx("dd",{children:l.jsx(Rr,{children:F.value})})]},F.label)),Xj(Yj(f)).map(F=>l.jsxs("div",{children:[l.jsx("dt",{children:F.label}),l.jsx("dd",{children:l.jsx(Rr,{children:F.value})})]},F.label))]}),$.decisiveFailureLabel===null?null:l.jsxs("section",{className:"run-detail__failure","aria-labelledby":"decisive-failure-title",children:[l.jsx("h3",{id:"decisive-failure-title",children:"Decisive failure"}),l.jsx("p",{className:"op-mono overflow-safe",children:$.decisiveFailureLabel})]}),l.jsxs("section",{className:"run-detail__summary-strip","aria-labelledby":"run-card-title",children:[l.jsxs("h3",{id:"run-card-title",title:`summary card · ${$.card.kind}`,children:[l.jsx("span",{"aria-hidden":"true",children:"Run summary"}),l.jsx("span",{className:"visually-hidden",children:$.card.title})]}),l.jsx("dl",{className:"run-detail__card-facts",children:$.card.facts.map(F=>l.jsxs("div",{children:[l.jsx("dt",{children:F.label}),l.jsx("dd",{children:F.value})]},F.label))})]}),f==null?null:l.jsx(TS,{preflight:f,...y.contextPreflightInvocation===void 0?{}:{invocation:y.contextPreflightInvocation},...ce?{onInspectSessionLog:()=>Z(!0)}:{}}),$.snapshotAvailable?l.jsxs("section",{className:"run-detail__chart",children:[l.jsxs("div",{className:"run-detail__chart-heading",children:[l.jsx("h3",{className:"op-specimen",children:"Stage chart"}),l.jsx("span",{className:"run-detail__chart-meta op-mono",children:$.timeline?.spanLabel??"persisted timing not reported"})]}),$.timeline===null?l.jsx("div",{className:"run-detail__timeline-unavailable",role:"status",children:"Verified stage dependencies are available, but no persisted stage or call interval has both a start and a truthful end."}):l.jsx(x1,{label:"Verified workflow stage timeline",children:l.jsxs("div",{className:"run-detail__timeline",children:[l.jsx("span",{className:"run-detail__timeline-label-spacer"}),l.jsx("svg",{"aria-hidden":"true",className:"run-detail__timeline-ticks",children:$.timeline.ticks.map(F=>l.jsx("text",{textAnchor:"middle",x:`${String(F.positionPercent)}%`,y:"12",children:F.label},`${F.label}:${String(F.positionPercent)}`))}),$.timeline.stages.map((F,ge)=>l.jsxs(b.Fragment,{children:[l.jsxs("button",{"aria-label":`${F.stageId} · ${F.stateLabel} — jump to its calls`,className:"mobile-chart-scroll__sticky-label run-detail__timeline-label",onClick:()=>de(F.stageId),title:`${F.stageId} · ${F.stateLabel} — jump to its calls`,type:"button",children:[l.jsx("span",{"aria-hidden":"true",className:"run-detail__timeline-stage-dot","data-state":F.stateLabel}),l.jsx("span",{className:"run-detail__timeline-stage-id overflow-safe",children:F.stageId}),l.jsx("span",{className:"run-detail__timeline-count",children:F.callCountLabel})]}),l.jsx(JA,{hoveredKey:N,isPhone:E,onHoverCall:L,onInspectCall:ue,stage:F,trackTopPx:j[ge]??28})]},F.stageId)),l.jsxs("svg",{"aria-hidden":"true",className:"run-detail__timeline-overlay",preserveAspectRatio:"none",children:[$.timeline.fanInPositions.map((F,ge)=>l.jsx("line",{className:"run-detail__timeline-fan-in",x1:`${String(F)}%`,x2:`${String(F)}%`,y1:"0",y2:"100%"},`${String(F)}:${String(ge)}`)),$.timeline.livePositionPercent===null?null:l.jsxs(l.Fragment,{children:[l.jsx("line",{className:"run-detail__timeline-now",x1:`${String($.timeline.livePositionPercent)}%`,x2:`${String($.timeline.livePositionPercent)}%`,y1:"0",y2:"100%"}),l.jsx("circle",{className:"run-detail__timeline-now-dot",cx:`${String($.timeline.livePositionPercent)}%`,cy:"3",r:"3"})]})]}),k===null||Q===null?null:l.jsx("svg",{className:"run-detail__timeline-overlay run-detail__timeline-tip-layer",children:l.jsxs("g",{"aria-label":k.ariaText,className:"run-detail__timeline-tip",role:"tooltip",children:[l.jsxs("text",{className:"run-detail__timeline-tip-line",textAnchor:Q,x:`${String(k.cxPercent)}%`,y:he,children:[l.jsx("tspan",{className:"run-detail__timeline-tip-id",children:k.callId}),l.jsx("tspan",{className:"run-detail__timeline-tip-who",dx:"8",children:k.who})]}),l.jsxs("text",{className:"run-detail__timeline-tip-line",textAnchor:Q,x:`${String(k.cxPercent)}%`,y:he+15,children:[l.jsx("tspan",{className:"run-detail__timeline-tip-state","data-state":k.state,children:k.state}),l.jsx("tspan",{className:"run-detail__timeline-tip-dur",dx:"8",children:k.duration})]})]})})]})})]}):l.jsxs("section",{className:"run-detail__snapshot-unavailable",role:"status",children:[l.jsx("h3",{children:"Stage graph unavailable"}),l.jsx("p",{children:$.snapshotLabel}),l.jsx("p",{children:"Persisted stage and call state remains available below."})]}),l.jsxs("section",{"aria-labelledby":"stage-rows-title",className:"run-detail__stages",ref:S,children:[l.jsx("h3",{className:"op-specimen",id:"stage-rows-title",children:"Stages"}),l.jsx("div",{className:"run-detail__stages-card",children:$.stages.map((F,ge)=>{const Ve=y.stages.find(Re=>Re.stageId===F.stageId),Se=[F.label,F.dependsOn.length===0?null:`context from ${F.dependsOn.join(" · ")}`].filter(Re=>Re!==null).join(" · ");return l.jsxs("article",{"aria-label":`Stage ${F.stageId}`,className:"run-detail__stage","data-stage-id":F.stageId,children:[l.jsxs("header",{className:"run-detail__stage-header",children:[l.jsx("span",{className:"run-detail__stage-number",children:String(ge+1).padStart(2,"0")}),l.jsx("h4",{className:"overflow-safe",title:Se,children:F.stageId}),l.jsx("span",{className:"run-detail__timing",children:F.timingLabel}),l.jsx("span",{className:"run-detail__stage-word","data-state":Ve?.state,children:F.statusLabel})]}),l.jsx("div",{className:"run-detail__calls",children:F.calls.length===0?l.jsx("p",{className:"run-detail__section-note",children:"No persisted calls."}):F.calls.map(Re=>{const Pe=`${F.stageId}\0${Re.callId}`;return l.jsxs("article",{"aria-label":`Call ${Re.callId}: ${Re.statusLabel} · ${Re.modelLabel} · ${Re.effortLabel}`,className:"run-detail__call","data-hov":N===Pe,onMouseEnter:()=>M(Pe),onMouseLeave:()=>M(null),children:[l.jsx("span",{"aria-hidden":"true",className:"run-detail__call-state","data-state":Ve?.calls.find(Gt=>Gt.callId===Re.callId)?.state,children:Re.statusLabel==="failed"?"×":null}),l.jsxs("span",{className:"run-detail__call-id-cell",children:[l.jsx("h5",{className:"op-mono overflow-safe",children:Re.callId}),Re.retryLabel===null?null:l.jsx("span",{className:"run-detail__call-retry",children:Re.retryLabel})]}),Re.adapterLabel===null?l.jsx("span",{className:"run-detail__call-adapter",children:"not reported"}):l.jsx("span",{className:"run-detail__call-adapter",children:Re.adapterLabel}),l.jsxs("span",{className:"run-detail__call-knobs",title:`${Re.modelLabel} · ${Re.effortLabel}`,children:[l.jsx("span",{className:"run-detail__call-knob overflow-safe",children:Re.modelLabel}),l.jsx("span",{className:"run-detail__call-knob overflow-safe",children:Re.effortLabel})]}),l.jsx("span",{className:"run-detail__call-timing",children:Re.timingLabel}),Re.contentLabels.length===0?l.jsx("span",{"aria-label":"No persisted call content",className:"run-detail__log-unavailable",children:"—"}):l.jsxs("button",{"aria-label":`Inspect persisted content for ${Re.callId}`,className:"run-detail__inspect",onClick:()=>ue({stageId:F.stageId,callId:Re.callId}),title:Re.contentLabels.join(" · "),type:"button",children:[l.jsx("span",{className:"run-detail__inspect-label",children:"[ log ]"}),l.jsx("span",{"aria-hidden":"true",className:"run-detail__inspect-glyph",children:"›"})]}),Re.failureLabel===null?null:l.jsx("p",{className:"run-detail__call-failure",children:Re.failureLabel})]},Re.callId)})})]},F.stageId)})})]}),l.jsx(YA,{...i===void 0?{}:{api:i},availability:$.result,onRunGenerationChanged:x,selection:c.selected}),oe&&p!==void 0&&p!==null&&me===null?l.jsxs("p",{className:"run-detail__section-note",role:"status",children:["The requested call ",p.callId," in stage ",p.stageId," is not present in this run’s persisted state."]}):null,me===null?null:l.jsx(xA,{...a===void 0?{}:{api:a},applicationRootId:t,call:me,...ve===void 0?{}:{callNavigation:ve},onClose:_e,onObsoleteSelection:x,open:!0,selection:c.selected,...r===void 0?{}:{sessionLogApi:r}}),ee===void 0||ee.contextRunId===void 0||r===void 0?null:l.jsx(eR,{applicationRootId:t,contextRunId:ee.contextRunId,onClose:()=>Z(!1),onRunGenerationChanged:x,open:q,refreshToken:y.stateRevision,runGeneration:y.runGeneration,runId:y.runId,sessionLogApi:r})]})}function eR({applicationRootId:t,contextRunId:a,onClose:i,onRunGenerationChanged:r,open:c,refreshToken:f,runGeneration:p,runId:h,sessionLogApi:v}){const m=b.useMemo(()=>({family:"context",runId:h,runGeneration:p,contextRunId:a}),[h,p,a]);return l.jsxs(fd,{applicationRootId:t,labelledBy:"preflight-log-title",onClose:i,open:c,panelClassName:"accessible-dialog--sheet run-detail__preflight-log-dialog",children:[l.jsxs("header",{className:"run-detail__preflight-log-header",children:[l.jsx("h3",{id:"preflight-log-title",className:"overflow-safe",children:"Context preflight log"}),l.jsx("button",{className:"run-detail__button",type:"button",onClick:i,children:"[ close ]"})]}),l.jsx(_d,{api:v,onGenerationChanged:r,refreshToken:f,scope:m})]})}const tR=["all","orphaned","running","succeeded","failed","cancelled"];function yd(t){return t.status!=="running"?"terminal":t.orphaned===!0||t.leaseObservation==="orphaned"?"orphaned":t.leaseObservation==="live"?"live":"unknown"}function Qh(t){return yd(t)==="orphaned"?"orphaned":t.status}function nR(t){return Qh(t)}function Gb(t,a){return a==="all"?!0:nR(t)===a}function aR(t,a){const i=Date.parse(t.startedAt);if(t.completedAt!==void 0){const r=Date.parse(t.completedAt);if(Number.isFinite(i)&&Number.isFinite(r)){const c=Math.max(0,r-i);return`duration ${Lu(c)}`}if(Number.isFinite(r))return`completed ${_n(t.completedAt,a)}`}if(Number.isFinite(i)){const r=Date.parse(t.stateUpdatedAt),f=yd(t)!=="orphaned"||!Number.isFinite(r)?a:r;return`started ${_n(t.startedAt,f)}`}return"timing not reported"}function sR(t,a){const i=Date.parse(t.startedAt);if(!Number.isFinite(i))return"not reported";const r=yd(t);if(r==="orphaned"){const c=Date.parse(t.stateUpdatedAt);return Number.isFinite(c)?Fa(c-i):"not reported"}if(r==="terminal"){const c=Date.parse(t.completedAt??t.stateUpdatedAt);return Number.isFinite(c)?Fa(c-i):"not reported"}return Fa(a-i)}function lR(t,a){const i=Date.parse(t.startedAt);if(!Number.isFinite(i))return null;if(t.completedAt!==void 0){const p=Date.parse(t.completedAt);if(Number.isFinite(p))return Math.max(0,p-i)}const r=yd(t),c=Date.parse(t.stateUpdatedAt),f=r==="orphaned"&&Number.isFinite(c)?c:a;return Math.max(0,f-i)}function iR(t,a){const i=Qh(t);if(i==="orphaned")return`stale · last write ${_n(t.stateUpdatedAt,a)}`;if(i==="running")return"awaiting provider";const r=_n(t.completedAt??t.stateUpdatedAt,a);return i==="failed"?`failed ${r}`:`finished ${r}`}function t0(t,a){const i=Qh(t),r=lR(t,a);return{timingLabel:aR(t,a),updatedAgeLabel:_n(t.stateUpdatedAt,a),elapsedLabel:r===null?"timing not reported":Nr(r),statusFootnote:iR(t,a),resultRetentionLabel:t.hasResult?"bounded result retained":"metadata only",statusLabel:i,cardModifier:i}}function rR(t,a){const i=t0(t,a);return{statusLabel:i.statusLabel,statusState:i.cardModifier,observedSpanLabel:sR(t,a),invocationLabels:pd(t.invocation,t.observedInvocation)}}function oR(){const[t,a]=b.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(max-width: 880px)").matches);return b.useEffect(()=>{if(typeof window.matchMedia!="function")return;const i=window.matchMedia("(max-width: 880px)"),r=()=>a(i.matches);return r(),i.addEventListener("change",r),()=>i.removeEventListener("change",r)},[]),t}function cR({api:t,detail:a,detailPhase:i,nowMs:r,onBack:c,onGenerationChanged:f,selection:p,sessionLogApi:h}){const[v,m]=b.useState(null),[x,y]=b.useState("idle"),[E,S]=b.useState(!1),C=oR(),T=b.useRef(null),N=a?.stateRevision??"",[M,k]=b.useState(N);if(M!==N&&(T.current?.abort(),k(N),m(null),y("idle")),b.useEffect(()=>()=>T.current?.abort(),[]),a===null&&p!==null){const P=i==="error";return l.jsxs("section",{"aria-busy":P?void 0:"true",className:"app-shell__view run-detail run-detail--empty",children:[l.jsxs("div",{className:"run-detail__mobile-nav",children:[l.jsx("button",{"aria-label":"back to single-call list",autoFocus:!0,className:"run-detail__back",onClick:c,type:"button",children:"‹ calls"}),l.jsxs("span",{className:"op-caption op-mono overflow-safe",children:["activity ",p.activityId]})]}),l.jsx("h2",{className:"app-shell__title",children:P?"Single-call detail unavailable":"Single-call detail"}),l.jsx("p",{className:"app-shell__note",role:P?"alert":"status",children:P?"The selected activity detail could not be loaded. Return to the list and retry the call feed.":"Loading selected single-call state…"})]})}if(a===null)return l.jsxs("section",{className:"app-shell__view run-detail run-detail--empty",children:[l.jsx("h2",{className:"app-shell__title",children:"Single-call detail"}),l.jsx("p",{className:"app-shell__note",children:"Select a retained direct call or agent session to inspect its persisted lifecycle and content boundary."})]});const z=()=>{if(!a.hasResult||x==="loading")return;T.current?.abort();const P=new AbortController;T.current=P,y("loading"),t.getActivityResult(a,P.signal).then(ue=>{if(!P.signal.aborted){if(ue.etag!==`"${a.stateRevision}"`){m(null),y("error");return}m(ue),y("loaded")}}).catch(()=>{P.signal.aborted||y("error")})},R=rR(a,r),B=R.statusState==="running"||R.statusState==="orphaned",Z=[{label:"started",value:Iu(a.startedAt)??a.startedAt},{label:B?"elapsed":"duration",value:R.observedSpanLabel},B?{label:"journal write",value:_n(a.stateUpdatedAt,r)}:{label:"outcome",value:a.outcome?.kind??"not reported"}],ae=[{label:"started",value:a.startedAt},{label:"completed",value:a.completedAt??"not reported"},{label:"last journal write",value:a.stateUpdatedAt},{label:"outcome",value:a.outcome?.kind??"not reported"},{label:"generation · revision",value:`${a.activityGeneration} · ${a.stateRevision}`},{label:"project folder",value:Dh(a.projectFolders)}],oe=l.jsx("button",{"aria-expanded":E,className:"run-detail__fact-toggle",onClick:()=>S(P=>!P),type:"button",children:E?"[ hide details ]":"[ details ]"});return l.jsxs("section",{className:"app-shell__view run-detail activity-detail",children:[l.jsxs(yi,{children:[l.jsxs("span",{className:"detail-sticky-bar__id",children:["activity ",a.activityId]}),l.jsx("span",{className:"run-detail__status","data-state":R.statusState,children:R.statusLabel}),l.jsx("span",{className:"detail-sticky-bar__name",children:a.kind}),l.jsxs("span",{className:"detail-sticky-bar__wide detail-sticky-bar__muted",children:[a.adapter," / ",a.role]}),l.jsx("span",{className:"detail-sticky-bar__spacer"}),l.jsxs("span",{className:"detail-sticky-bar__wide detail-sticky-bar__fact",children:[l.jsx("span",{className:"detail-sticky-bar__fact-k",children:B?"elapsed":"duration"}),l.jsx("span",{className:"detail-sticky-bar__fact-v",children:R.observedSpanLabel})]})]}),l.jsxs("div",{className:"run-detail__mobile-nav",children:[l.jsx("button",{"aria-label":"back to single-call list",autoFocus:!0,className:"run-detail__back",onClick:c,type:"button",children:"‹ calls"}),l.jsxs("span",{className:"op-caption op-mono overflow-safe",children:["activity ",a.activityId]}),l.jsx("span",{className:"run-detail__status","data-state":R.statusState,children:R.statusLabel})]}),l.jsx("header",{className:"run-detail__header",children:l.jsxs("div",{className:"run-detail__header-identity",children:[l.jsxs("div",{className:"run-detail__identity-line",children:[l.jsxs("span",{className:"op-caption op-mono overflow-safe",children:["activity ",a.activityId]}),l.jsx("span",{className:"run-detail__status","data-state":R.statusState,children:R.statusLabel}),B?l.jsx("span",{className:"run-detail__mode",children:a.phase}):null]}),l.jsxs("div",{className:"run-detail__workflow-heading",children:[l.jsx("h2",{className:"run-detail__title overflow-safe",children:a.kind}),l.jsxs("span",{className:"op-caption op-mono overflow-safe",children:[a.adapter," / ",a.role]})]})]})}),l.jsxs("div",{className:"run-detail__facts",children:[l.jsxs("div",{className:"run-detail__facts-group",children:[Z.map(P=>l.jsxs("span",{className:"run-detail__fact",children:[l.jsx("span",{className:"run-detail__fact-k",children:P.label}),l.jsx("span",{className:"run-detail__fact-v",children:P.value})]},P.label)),C?null:oe]}),C?l.jsx("div",{className:"run-detail__facts-actions",children:oe}):null]}),l.jsxs("dl",{"aria-label":"Single-call metadata",className:"run-detail__details",hidden:!E,children:[ae.map(P=>l.jsxs("div",{children:[l.jsx("dt",{children:P.label}),l.jsx("dd",{children:l.jsx(Rr,{children:P.value})})]},P.label)),R.invocationLabels.map((P,ue)=>l.jsxs("div",{children:[l.jsx("dt",{children:ue===1?"effort":"model"}),l.jsx("dd",{children:l.jsx(Rr,{children:P})})]},ue===1?"effort":"model"))]}),B?l.jsxs("p",{className:"activity-detail__live-note",role:"status",children:[l.jsx("span",{"aria-hidden":"true",className:"activity-detail__live-dot"}),"reported ",R.statusLabel," — a journal record is not proof its producer process is alive"]}):null,h===void 0?null:l.jsx("section",{className:"run-detail__card activity-detail__content",children:l.jsx(_d,{api:h,...f===void 0?{}:{onGenerationChanged:f},refreshToken:a.stateRevision,scope:{family:"activity",activityId:a.activityId,activityGeneration:a.activityGeneration}})}),l.jsxs("section",{className:"run-detail__card activity-detail__content","aria-labelledby":"activity-content-title",children:[l.jsxs("div",{className:"run-detail__section-heading",children:[l.jsx("h3",{className:"activity-detail__result-heading",id:"activity-content-title",children:"Result"}),a.hasResult?l.jsxs(l.Fragment,{children:[x==="loaded"&&v!==null?l.jsx("span",{className:"activity-detail__result-meta",children:Wx(v.content)}):null,l.jsx("button",{className:"run-detail__inspect",disabled:x==="loading",onClick:z,type:"button",children:x==="loaded"?"[ reload ]":"[ load result ]"})]}):l.jsx("span",{className:"activity-detail__result-meta",children:"not retained"})]}),a.hasResult?x==="loading"?l.jsx("p",{role:"status",children:"Loading retained result…"}):x==="error"?l.jsxs("div",{role:"alert",children:[l.jsx("p",{children:"The retained result is unavailable for this exact revision."}),l.jsx("button",{className:"run-detail__button",onClick:z,type:"button",children:"[ retry result ]"})]}):v===null?null:l.jsxs("div",{className:"activity-detail__result",children:[a.resultTruncated?l.jsx("p",{className:"run-detail__section-note",role:"status",children:"Retained output was truncated at the configured persistence limit."}):null,l.jsx(vd,{content:v.content,mediaType:v.mediaType})]}):l.jsx("p",{children:a.kind==="clink_agent_run"?"A final agent-session result was not retained for this activity.":"Result retention was not enabled when this direct call ran."})]})]})}const uR=["all","orphaned","pending","running","succeeded","failed","cancelled"];function Vp(t){return t==="succeeded"||t==="failed"||t==="cancelled"}function Kp(t,a){return a==="all"?!0:t.availability==="unavailable"?!1:a==="orphaned"?t.workerObservation==="orphaned":a==="pending"||a==="running"?Zo(t.workerObservation)&&t.row.status===a:t.row.status===a}function dR(t){return t.workerObservation==="unknown"?"worker-unknown":t.workerObservation==="orphaned"?"orphaned":t.row.status}function fR({card:t}){return t.availability==="unavailable"?l.jsxs("div",{className:"run-card run-card--unavailable",children:[l.jsxs("span",{className:"run-card__header",children:[l.jsx("span",{className:"run-card__identity",children:l.jsxs("span",{className:"run-card__id",children:["run ",t.row.runId]})}),l.jsx("span",{className:"run-card__status",children:"unreadable"})]}),l.jsx("span",{className:"run-card__diagnostic",children:t.statusLabel})]}):l.jsxs("div",{className:`run-card run-card--${dR(t)}`,children:[l.jsxs("span",{className:"run-card__header",children:[l.jsxs("span",{className:"run-card__identity",children:[l.jsxs("span",{className:"run-card__id",children:["run ",t.row.runId]}),t.flags.map(a=>l.jsx("span",{className:"run-card__flag",children:a},a))]}),l.jsx("span",{className:"run-card__status",children:t.statusLabel})]}),l.jsxs("span",{className:"run-card__workflow",children:[l.jsx("span",{className:"run-card__workflow-name",children:t.row.workflowName}),l.jsxs("span",{className:"run-card__workflow-version",children:["v",t.row.workflowVersion]}),t.statusTags.map(a=>l.jsx("span",{className:"run-card__tag",children:a},a))]}),t.row.stageMarkers.length===0?l.jsx("span",{className:"run-card__stage-empty",children:"stage state not reported"}):l.jsxs("span",{"aria-label":"stage states",className:"run-card__stage-track",children:[l.jsx("span",{className:"run-card__stage-list",children:t.row.stageMarkers.map((a,i,r)=>l.jsx("span",{className:["run-card__stage-node",Vp(a.state)&&Vp(r[i+1]?.state)?"run-card__stage-node--complete-connector":"",t.showLiveMotion&&t.row.status==="running"&&Vp(a.state)&&r[i+1]?.state==="running"?"run-card__stage-node--live-connector":""].filter(Boolean).join(" "),children:l.jsx("span",{"aria-label":Kv(a),className:`run-card__stage-dot run-card__stage-dot--${a.state}`,title:Kv(a),children:a.state==="failed"?"×":null})},a.stageId))}),t.row.additionalStageCount>0?l.jsxs("span",{className:"run-card__stage-overflow",children:["+",String(t.row.additionalStageCount)," retained stages"]}):null]}),l.jsxs("span",{className:"run-card__footer",children:[l.jsx("span",{className:"run-card__timing",children:t.elapsedLabel}),t.stageProgressLabel===""?null:l.jsx("span",{className:"run-card__footnote",children:t.stageProgressLabel}),l.jsx("span",{className:"run-card__detail-hint",children:"detail ›"})]})]})}function pR(t,a){return t.selected?.runId===a.runId&&t.selected.runGeneration===a.runGeneration}function Ou(t){return`${t.runId}:${t.runGeneration}`}function Hb({cards:t,label:a,onMovePastBoundary:i,onSelect:r,rootRef:c,state:f}){const p=new Map(t.map(v=>[Ou(v.row),v])),h=t.find(v=>pR(f,v.row));return l.jsx(bi,{ariaLabel:a,items:t.map(v=>({id:Ou(v.row),label:v.availability==="unavailable"?`${v.row.runId} unreadable ${v.statusLabel}`:`${v.row.runId} ${v.statusLabel}`,content:l.jsx(fR,{card:v})})),...i===void 0?{}:{onMovePastBoundary:i},onSelect:v=>{const m=p.get(v);m!==void 0&&r(m.row)},...c===void 0?{}:{rootRef:c},selectedId:h===void 0?null:Ou(h.row)})}function Vb(t,a){const i=t?.querySelectorAll('[role="option"]:not([aria-disabled="true"])');i?.length&&i.item(a==="first"?0:i.length-1).focus()}function xd(t){if(t.key!=="j"&&t.key!=="k")return;const a=Array.from(t.currentTarget.querySelectorAll('[role="option"]')).filter(f=>f.getAttribute("aria-disabled")!=="true");if(a.length===0)return;const i=a.findIndex(f=>f===document.activeElement),r=t.key==="j"?1:-1,c=i===-1?a[0]:a[(i+r+a.length)%a.length];c!==void 0&&c.focus(),t.preventDefault()}function wd(t,a){if(a===null||t===null)return;const i=t.querySelector(`[role="option"][data-item-id="${CSS.escape(a)}"]`);i!==null&&typeof i.scrollIntoView=="function"&&i.scrollIntoView({block:"nearest"})}function hR({label:t}){return l.jsxs("div",{className:"run-list__placeholders",children:[l.jsx("p",{className:"run-list__placeholder-copy",role:"status",children:t}),l.jsx("div",{className:"run-list__placeholder","aria-hidden":"true"}),l.jsx("div",{className:"run-list__placeholder","aria-hidden":"true"}),l.jsx("div",{className:"run-list__placeholder","aria-hidden":"true"})]})}function mR(t){const[a,i]=b.useState("all");b.useEffect(()=>{i("all")},[t.filterResetKey]);const r=Fy(t.state),c=r.live.filter(N=>Kp(N,a)),f=r.history.filter(N=>Kp(N,a)),p=[...r.live,...r.history],h=N=>p.filter(M=>Kp(M,N)).length,v=a==="all"?String(r.live.length):`${String(c.length)}/${String(r.live.length)}`,m=a==="all"?String(r.history.length):`${String(f.length)}/${String(r.history.length)}`,x=["stale","offline","error"].includes(t.state.phase),y=b.useRef(null),E=b.useRef(null),S=b.useRef(null),C=b.useRef(null),T=t.state.selected===null?null:Ou(t.state.selected);return b.useEffect(()=>{T!==C.current&&(C.current=T,wd(S.current,T))},[T]),l.jsxs("section",{"aria-label":"Run monitor lanes",className:"run-list",onKeyDown:xd,ref:S,children:[l.jsxs("div",{className:x?"run-list__recovery":"visually-hidden",role:"status",children:[l.jsxs("span",{children:[r.phaseLabel," · ",r.lastRefreshLabel]}),x?l.jsx("button",{onClick:t.onRetry,type:"button",children:"[ retry now ]"}):null]}),t.state.announcement===null?null:l.jsx("p",{className:"run-list__announcement","data-selection-loss-announcement":!0,role:"status",tabIndex:-1,children:t.state.announcement}),l.jsxs("header",{className:"run-list__heading",children:[l.jsx("h2",{children:"Workflow runs"}),l.jsx("span",{className:"run-list__observed-age",children:r.observedAgeLabel??""}),l.jsxs("span",{className:"run-list__heading-count",children:["[ live ",v," ]"]})]}),l.jsx(Po,{groupLabel:"Filter runs by status",selected:a,onSelect:i,chips:uR.map(N=>({id:N,label:N,count:h(N)}))}),p.length===0&&t.state.phase==="initial_loading"?l.jsx(hR,{label:r.phaseLabel}):l.jsxs(l.Fragment,{children:[l.jsxs("section",{"aria-label":"Live runs",className:"run-list__lane",children:[l.jsxs("div",{className:"run-list__lane-heading run-list__lane-heading--live",children:[l.jsx("h2",{children:"Live"}),l.jsx("span",{className:"run-list__observed-age",children:r.observedAgeLabel??""}),l.jsxs("span",{className:"run-list__heading-count",children:["[ live ",v," ]"]})]}),r.live.length===0?l.jsx("p",{className:"run-list__empty",children:"No runs are currently reported pending or running."}):c.length===0?l.jsxs("p",{className:"run-list__empty",children:["No loaded live runs match ",a,"."]}):l.jsx(Hb,{cards:c,label:"Live runs",...f.length===0?{}:{onMovePastBoundary:N=>{N===1&&Vb(E.current,"first")}},onSelect:t.onSelect,rootRef:y,state:t.state})]}),l.jsxs("section",{"aria-label":"Settled runs",className:"run-list__lane",children:[l.jsxs("div",{className:"run-list__lane-heading run-list__lane-heading--settled",children:[l.jsx("h2",{children:"Settled"}),l.jsxs("p",{children:["[ history ",m," ]"]})]}),r.history.length===0?l.jsx("p",{className:"run-list__empty",children:"No history runs are loaded on this page."}):f.length===0?l.jsxs("p",{className:"run-list__empty",children:["No loaded history runs match ",a,"."]}):l.jsx(Hb,{cards:f,label:"History runs",...c.length===0?{}:{onMovePastBoundary:N=>{N===-1&&Vb(y.current,"last")}},onSelect:t.onSelect,rootRef:E,state:t.state}),l.jsxs("nav",{"aria-label":"History pages",className:"run-list__pagination",children:[l.jsx("button",{disabled:!t.state.canGoNewer,onClick:t.onNewer,type:"button",children:"[ newer ]"}),l.jsx("button",{disabled:!t.state.canGoOlder,onClick:t.onOlder,type:"button",children:"[ older ]"})]}),t.state.canGoOlder?null:l.jsx("p",{className:"run-list__pagination-note",children:"end of retained history"})]})]}),l.jsxs("p",{"aria-hidden":"true",className:"run-list__keyboard-hint",children:[l.jsx("kbd",{children:"↑"}),l.jsx("kbd",{children:"↓"}),l.jsx("kbd",{children:"j k"}),l.jsx("span",{children:"select run"})]})]})}function gR({activity:t,view:a}){return l.jsxs("div",{className:`run-card run-card--${a.cardModifier}`,children:[l.jsxs("span",{className:"run-card__header",children:[l.jsx("span",{"aria-hidden":"true",className:`run-card__status-dot run-card__status-dot--${a.cardModifier}`}),l.jsx("span",{className:"run-card__identity",children:l.jsxs("span",{className:"run-card__id",children:["activity ",t.activityId]})}),l.jsx("span",{className:"run-card__status",children:a.statusLabel})]}),l.jsx("span",{className:"run-card__workflow run-card__workflow--plain",children:l.jsx("span",{className:"run-card__workflow-name",children:t.kind})}),l.jsxs("span",{className:"run-card__meta-line",children:[t.adapter," / ",t.role]}),l.jsxs("span",{className:"run-card__footer",children:[l.jsx("span",{className:"run-card__timing",children:a.elapsedLabel}),l.jsx("span",{className:"run-card__footnote",children:a.statusFootnote}),l.jsx("span",{className:"run-card__detail-hint",children:"detail ›"})]})]})}function _R({activities:t,announcement:a,filterResetKey:i,hasSnapshot:r,onRetry:c,onSelect:f,phase:p,selected:h,nowMs:v}){const[m,x]=b.useState("all");b.useEffect(()=>{x("all")},[i]);const y=t.filter(M=>Gb(M,m)),E=new Map(t.map(M=>[M.activityId,M])),S=["stale","offline","error"].includes(p),C=b.useRef(null),T=b.useRef(null),N=h?.activityId??null;return b.useEffect(()=>{N!==T.current&&(T.current=N,wd(C.current,N))},[N]),l.jsxs("section",{"aria-label":"Single-call monitor",className:"run-list",onKeyDown:xd,ref:C,children:[a===null?null:l.jsx("p",{className:"run-list__announcement","data-selection-loss-announcement":!0,role:"status",tabIndex:-1,children:a}),["stale","offline","auth_expired","connection_changed","error"].includes(p)?l.jsxs("div",{className:"run-list__recovery",role:"status",children:[l.jsxs("span",{children:["Single-call feed ",p.replace("_"," "),"."]}),S?l.jsx("button",{onClick:c,type:"button",children:"[ retry calls ]"}):null]}):null,l.jsx(Po,{groupLabel:"Filter single calls by status",selected:m,onSelect:x,chips:tR.map(M=>({id:M,label:M,count:t.filter(k=>Gb(k,M)).length}))}),l.jsxs("section",{"aria-labelledby":"activity-list-title",className:"run-list__lane",children:[l.jsxs("div",{className:"run-list__lane-heading",children:[l.jsx("h2",{id:"activity-list-title",children:"Single calls"}),m==="all"?null:l.jsxs("p",{children:["[ activity ",String(y.length),"/",String(t.length)," ]"]})]}),t.length===0&&p==="initial_loading"?l.jsxs("div",{className:"run-list__placeholders",children:[l.jsx("p",{className:"run-list__placeholder-copy",role:"status",children:"Loading retained single calls…"}),l.jsx("div",{className:"run-list__placeholder","aria-hidden":"true"}),l.jsx("div",{className:"run-list__placeholder","aria-hidden":"true"}),l.jsx("div",{className:"run-list__placeholder","aria-hidden":"true"})]}):t.length===0&&!r?l.jsx("p",{className:"run-list__empty",children:"No authoritative single-call snapshot is available."}):t.length===0?l.jsx("p",{className:"run-list__empty",children:"No retained direct or agent-session activity is available."}):y.length===0?l.jsxs("p",{className:"run-list__empty",children:["No loaded activities match ",m,"."]}):l.jsx(bi,{ariaLabel:"Single calls",items:y.map(M=>{const k=t0(M,v);return{id:M.activityId,label:`${M.activityId} ${M.kind} ${k.statusLabel}`,content:l.jsx(gR,{activity:M,view:k})}}),onSelect:M=>{const k=E.get(M);k!==void 0&&f(k)},selectedId:h?.activityId??null})]}),l.jsxs("p",{"aria-hidden":"true",className:"run-list__keyboard-hint",children:[l.jsx("kbd",{children:"↑"}),l.jsx("kbd",{children:"↓"}),l.jsx("kbd",{children:"j k"}),l.jsx("span",{children:"select call"})]})]})}const vR=["standalone","refine","workflow_preflight","historical"],bR=["pending","running","succeeded","partial","failed","cancelled"],yR=["live","orphaned","unknown"],xR=["resolving","cache_lookup","validating","scanning","searching","selecting","curating","finalizing","writing","materializing","committing","complete","terminal"],wR=["not_configured","disabled","pending","running","succeeded","failed","cancelled","skipped"],jR=["not_applicable","not_used","used","failed"],SR=["not_checked","miss","hit"],NR=["not_attempted","skipped","written"],kR=["satisfied","degraded","not_evaluated"],AR=["cache_disabled","cache_miss","cache_stale","delegate_disabled","delegate_failed","delegate_fallback","delegate_invalid","delegate_timeout","coverage_degraded","empty_selection","operation_cancelled","internal_failure","legacy_supported","legacy_unsupported","generation_replaced"];class Dn extends Error{kind;status;constructor(a,i){super(`context run artifact fetch failed: ${a}`),this.name="ContextRunArtifactApiError",this.kind=a,this.status=i}}const RR=["current","legacy_synthesized","legacy_unsupported"],ER=["journal","historical_manifest"],n0=/^[A-Za-z0-9_-]{1,64}$/,TR=/^[A-Za-z0-9_-]{16,128}$/,CR=16;class OR extends Error{constructor(a){super(a),this.name="ContextRunParseError"}}function Ht(t){throw new OR(t)}function Zs(t,a){return(typeof t!="object"||t===null||Array.isArray(t))&&Ht(`${a} must be an object`),t}function Fs(t,a,i){const r=new Set(a),c=Object.keys(t).find(f=>!r.has(f));c!==void 0&&Ht(`${i}.${c} is unexpected`)}function Oa(t,a,i){return(typeof t!="string"||!a.includes(t))&&Ht(`${i} is not a recognized value`),t}function rs(t,a){return(typeof t!="number"||!Number.isSafeInteger(t)||t<0||t>25e7)&&Ht(`${a} must be a bounded non-negative integer`),t}function Mo(t,a){return t===null?null:((typeof t!="string"||Number.isNaN(Date.parse(t)))&&Ht(`${a} must be null or an ISO timestamp`),t)}function Kb(t,a){const i=Zs(t,a);Fs(i,["status","score"],a);const r=i.score;return r!==null&&(typeof r!="number"||!Number.isFinite(r)||r<0||r>10)&&Ht(`${a}.score must be null or a score from 0 through 10`),Object.freeze({status:Oa(i.status,wR,`${a}.status`),score:r})}function $R(t){const a=Zs(t,"lifecycle.counts");return Fs(a,["filesSeen","filesConsidered","filesSelected","filesOmitted","searchResults","bytesRead","bytesWritten"],"lifecycle.counts"),Object.freeze({filesSeen:rs(a.filesSeen,"lifecycle.counts.filesSeen"),filesConsidered:rs(a.filesConsidered,"lifecycle.counts.filesConsidered"),filesSelected:rs(a.filesSelected,"lifecycle.counts.filesSelected"),filesOmitted:rs(a.filesOmitted,"lifecycle.counts.filesOmitted"),searchResults:rs(a.searchResults,"lifecycle.counts.searchResults"),bytesRead:rs(a.bytesRead,"lifecycle.counts.bytesRead"),bytesWritten:rs(a.bytesWritten,"lifecycle.counts.bytesWritten")})}function MR(t){const a=Zs(t,"lifecycle.coverage");Fs(a,["policy","status","required","selected","missing"],"lifecycle.coverage"),a.policy!==null&&a.policy!=="review_deep_v1"&&Ht("lifecycle.coverage.policy is invalid");const i={policy:a.policy,status:Oa(a.status,kR,"lifecycle.coverage.status"),required:rs(a.required,"lifecycle.coverage.required"),selected:rs(a.selected,"lifecycle.coverage.selected"),missing:rs(a.missing,"lifecycle.coverage.missing")};return i.missing>i.required&&Ht("lifecycle.coverage.missing exceeds required"),Object.freeze(i)}function LR(t){(!Array.isArray(t)||t.length>CR)&&Ht("lifecycle.reasonCodes must be a bounded array");const a=t.map((i,r)=>Oa(i,AR,`lifecycle.reasonCodes[${String(r)}]`));return new Set(a).size!==a.length&&Ht("lifecycle.reasonCodes must be unique"),Object.freeze(a)}const IR=20,a0=["id","contextGeneration","source","compatibility","operationKind","lifecycle","projectFolders","orphaned","liveness"],DR=[...a0,"invocationAudit"];function zR(t){(!Array.isArray(t)||t.length>IR)&&Ht("contextRun.projectFolders must be a bounded array");const a=t.map((i,r)=>((typeof i!="string"||i.length===0)&&Ht(`contextRun.projectFolders[${String(r)}] must be a non-empty string`),i));return Object.freeze(a)}function qR(t){const a=Zs(t,"lifecycle");Fs(a,["status","phase","createdAt","updatedAt","startedAt","completedAt","durationMs","curator","finalizer","cache","fallback","counts","coverage","reasonCodes","artifactRunId"],"lifecycle");const i=Zs(a.cache,"lifecycle.cache");Fs(i,["lookup","write"],"lifecycle.cache");const r=Zs(a.fallback,"lifecycle.fallback");Fs(r,["status"],"lifecycle.fallback");const c=a.artifactRunId;c!==null&&(typeof c!="string"||!n0.test(c))&&Ht("lifecycle.artifactRunId is malformed");const f=a.durationMs;return f!==null&&(typeof f!="number"||!Number.isSafeInteger(f)||f<0)&&Ht("lifecycle.durationMs must be null or a non-negative integer"),Object.freeze({status:Oa(a.status,bR,"lifecycle.status"),phase:Oa(a.phase,xR,"lifecycle.phase"),createdAt:Mo(a.createdAt,"lifecycle.createdAt"),updatedAt:Mo(a.updatedAt,"lifecycle.updatedAt"),startedAt:Mo(a.startedAt,"lifecycle.startedAt"),completedAt:Mo(a.completedAt,"lifecycle.completedAt"),durationMs:f,curator:Kb(a.curator,"lifecycle.curator"),finalizer:Kb(a.finalizer,"lifecycle.finalizer"),cache:Object.freeze({lookup:Oa(i.lookup,SR,"lifecycle.cache.lookup"),write:Oa(i.write,NR,"lifecycle.cache.write")}),fallback:Object.freeze({status:Oa(r.status,jR,"lifecycle.fallback.status")}),counts:$R(a.counts),coverage:MR(a.coverage),reasonCodes:LR(a.reasonCodes),artifactRunId:c})}function s0(t){const a=Zs(t,"contextRun");Fs(a,a0,"contextRun");const i=a.id;(typeof i!="string"||!n0.test(i)||i.startsWith("wfctx")||i.startsWith("wfpre"))&&Ht("contextRun.id is malformed");const r=a.contextGeneration;(typeof r!="string"||!TR.test(r))&&Ht("contextRun.contextGeneration is malformed");const c=Oa(a.compatibility,RR,"contextRun.compatibility"),f=a.lifecycle===null?null:qR(a.lifecycle);c==="legacy_unsupported"!=(f===null)&&Ht("only legacy_unsupported context runs omit lifecycle");const p=a.orphaned===void 0?!1:a.orphaned;typeof p!="boolean"&&Ht("contextRun.orphaned must be a boolean");const h=a.liveness===void 0?p?"orphaned":"unknown":Oa(a.liveness,yR,"contextRun.liveness");p!==(h==="orphaned")&&Ht("contextRun.orphaned must agree with liveness");const v=f?.status;return!(v==="pending"||v==="running")&&(p||h!=="unknown")&&Ht("terminal or unsupported context runs cannot carry live or orphaned liveness"),Object.freeze({id:i,contextGeneration:r,source:Oa(a.source,ER,"contextRun.source"),compatibility:c,operationKind:Oa(a.operationKind,vR,"contextRun.operationKind"),lifecycle:f,projectFolders:zR(a.projectFolders),orphaned:p,liveness:h})}function UR(t){const a=Zs(t,"contextRun");Fs(a,DR,"contextRun");const{invocationAudit:i,...r}=a,c=s0(r);if(i===void 0)return c;try{return Object.freeze({...c,invocationAudit:IA(i,"contextRun.invocationAudit")})}catch{return c}}function BR(t){const a=Zs(t,"response");Fs(a,["contextRuns","serverNow","truncated"],"response"),Array.isArray(a.contextRuns)||Ht("response.contextRuns must be an array"),typeof a.truncated!="boolean"&&Ht("response.truncated must be a boolean");const i=Mo(a.serverNow,"response.serverNow");return i===null&&Ht("response.serverNow must not be null"),Object.freeze({contextRuns:Object.freeze(a.contextRuns.map(s0)),serverNow:i,truncated:a.truncated})}function Zp(t){return t??new AbortController().signal}async function Zb(t,a,i){let r;try{r=await t(a,{signal:i})}catch(c){throw c instanceof bt?new we("connection_changed",409,"agent_instance_changed"):i.aborted||c instanceof DOMException&&c.name==="AbortError"?new we("aborted"):new we("offline")}if(r.status===401)throw new we("auth_expired",401,"unauthorized");if(!r.ok)throw new we("request_error",r.status);try{return await na(r)}catch(c){throw c instanceof bt?new we("connection_changed",409,"agent_instance_changed"):new we("request_error",r.status)}}async function GR(t,a,i){let r;try{r=await t(a,{signal:i})}catch(p){throw p instanceof bt?new Dn("connection_changed",409):i.aborted||p instanceof DOMException&&p.name==="AbortError"?new Dn("aborted"):new Dn("offline")}if(r.status===401)throw new Dn("auth_expired",401);if(r.status===404)throw new Dn("missing",404);if(r.status===409)throw new Dn("generation_changed",409);if(r.status===413)throw new Dn("content_too_large",413);if(r.status===503)throw new Dn("unavailable",503);if(!r.ok)throw new Dn("request_error",r.status);const c=HR(r.headers.get("content-type"));let f;try{f=await r.text()}catch(p){throw p instanceof bt?new Dn("connection_changed",409):new Dn("request_error",r.status)}return{content:f,mediaType:c}}function HR(t){if(t===null)return"text/plain";const a=t.toLowerCase();return a.startsWith("application/json")?"application/json":a.startsWith("application/x-ndjson")?"application/x-ndjson":a.startsWith("text/markdown")?"text/markdown":"text/plain"}function l0(t=hs){return{async listContextRuns(a={}){const i=await Zb(t,"/api/context-runs?limit=100",Zp(a.signal));return BR(i)},async getContextRunDetail(a,i){const r=await Zb(t,`/api/context-runs/${encodeURIComponent(a)}`,Zp(i)),c=UR(r);if(c.id!==a)throw new we("request_error",502,"internal_error");return c},async getArtifact(a,i){const r=`/api/context-runs/${encodeURIComponent(a.contextRunId)}/artifacts/${encodeURIComponent(a.artifactKey)}?generation=${encodeURIComponent(a.contextGeneration)}`;return await GR(t,r,Zp(i))}}}const VR=l0(),KR=["bundle_md","summary_json","selected_context_jsonl","tree_json","search_jsonl","slices_jsonl","codemap_jsonl","manifest_json"],Fp={bundle_md:"bundle.md",summary_json:"summary.json",selected_context_jsonl:"selected-context.jsonl",tree_json:"tree.json",search_jsonl:"search.jsonl",slices_jsonl:"slices.jsonl",codemap_jsonl:"codemap.jsonl",manifest_json:"manifest.json"},ZR={bundle_md:"context packet",manifest_json:"receipt"};function FR(t,a){return[t.contextRunId,t.contextGeneration,a].join("\0")}function YR(t){switch(t){case"loading":return"Loading artifact…";case"ready":return null;case"missing":return"This artifact was not retained for this run.";case"content_too_large":return"This artifact exceeds the dashboard size limit and cannot be shown.";case"unavailable":return"Artifact storage is temporarily unavailable.";case"obsolete":return"The selected generation changed; the artifact view was discarded.";case"error":return"The artifact could not be loaded."}}function XR({api:t=VR,onGenerationChanged:a,scope:i,defaultArtifactKey:r="bundle_md"}){const[c,f]=b.useState(r),p=FR(i,c),h=b.useMemo(()=>({...i,artifactKey:c}),[p]),v=b.useRef(a),[m,x]=b.useState("loading"),[y,E]=b.useState(null);b.useEffect(()=>{v.current=a},[a]);const S=`${i.contextRunId}\0${i.contextGeneration}`;b.useEffect(()=>{f(r)},[S,r]),b.useEffect(()=>{const N=new AbortController;return x("loading"),E(null),t.getArtifact(h,N.signal).then(M=>{N.signal.aborted||(E(M),x("ready"))}).catch(M=>{N.signal.aborted||(M instanceof Dn&&M.kind==="generation_changed"?(x("obsolete"),v.current?.()):M instanceof Dn&&M.kind==="missing"?x("missing"):M instanceof Dn&&M.kind==="content_too_large"?x("content_too_large"):M instanceof Dn&&M.kind==="unavailable"?x("unavailable"):M instanceof Dn&&M.kind==="aborted"||x("error"))}),()=>N.abort()},[t,p,h]);const C=YR(m),T=m==="ready"&&y!==null?[y.mediaType,...y.mediaType==="text/markdown"?["shown as plain text · markdown is not rendered"]:[]].join(" · "):void 0;return l.jsxs("section",{"aria-busy":m==="loading","aria-label":"Run artifacts panel",className:"context-run-artifacts-panel","data-phase":m,children:[l.jsx("div",{"aria-label":"Artifact",className:"context-run-artifacts-panel__chips",role:"group",children:KR.map(N=>{const M=ZR[N];return l.jsx("button",{"aria-pressed":c===N,className:"context-run-artifacts-panel__chip",onClick:()=>f(N),title:M===void 0?Fp[N]:`${Fp[N]} · ${M}`,type:"button",children:Fp[N]},N)})}),C===null?null:l.jsx("p",{role:m==="error"?"alert":"status",children:C}),m==="ready"&&y!==null?l.jsx("div",{className:"context-run-artifacts-panel__body",title:T,children:l.jsx(vd,{content:y.content,mediaType:PR(y.mediaType)})}):null]})}function PR(t){return t==="application/json"?"application/json":"text/plain"}function Fb(t){return t.replaceAll("_"," ")}function Yp({label:t,facts:a}){return l.jsx("dl",{className:"context-run-detail__facts","aria-label":t,children:a.map(i=>l.jsxs("div",{children:[l.jsx("dt",{children:i.label}),l.jsx("dd",{children:l.jsx(Rr,{children:i.value})})]},i.label))})}function QR(t){const a=t.lifecycle;return a===null?null:a.cache.lookup==="hit"?"This cache hit reused an earlier context bundle, so no curator or finalizer session conversation exists.":a.curator.status==="not_configured"&&a.finalizer.status==="not_configured"?"Curator and finalizer were not configured, so no delegate session conversation exists.":null}function JR(){const[t,a]=b.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(max-width: 880px)").matches);return b.useEffect(()=>{if(typeof window.matchMedia!="function")return;const i=window.matchMedia("(max-width: 880px)"),r=()=>a(i.matches);return r(),i.addEventListener("change",r),()=>i.removeEventListener("change",r)},[]),t}function WR({canRetry:t,detail:a,detailPhase:i,onBack:r,onGenerationChanged:c,onRetry:f,selectedId:p,sessionLogApi:h,contextRunsApi:v}){const[m,x]=b.useState(!1),y=JR();if(p===null)return l.jsxs("section",{className:"app-shell__view run-detail run-detail--empty",children:[l.jsx("h2",{className:"app-shell__title",children:"Context run detail"}),l.jsx("p",{className:"app-shell__note",children:"Select a context-builder run to inspect its lifecycle metadata."})]});const E=t===!0&&i==="error"&&f!==void 0?l.jsxs("section",{className:"run-detail__snapshot-unavailable",role:"status",children:[l.jsx("h3",{children:"Detail refresh is pending"}),l.jsx("p",{children:"The latest detail read did not complete. The retained snapshot may be stale until the selected generation is refreshed."}),l.jsx("button",{className:"run-detail__button",type:"button",onClick:f,children:"retry context run"})]}):null;if(a===null)return l.jsxs("section",{className:"app-shell__view run-detail","aria-busy":i==="loading",children:[l.jsx("button",{className:"run-detail__back",type:"button",onClick:r,children:"‹ back to context runs"}),l.jsx("h2",{className:"app-shell__title",children:"Context run detail"}),l.jsx("p",{className:"app-shell__note",children:i==="loading"?"Loading context run lifecycle…":i==="not_found"?"The selected context run is no longer retained.":"Context run lifecycle is unavailable."}),E]});const S=vS(a),C=QR(a),T=a.lifecycle!==null&&(a.lifecycle.status==="running"||a.lifecycle.status==="pending"),N=a.lifecycle,M=N===null?null:Iu(N.startedAt??N.createdAt??null),k=N===null?"not reported":N.durationMs===null?T?"in progress":"not reported":Fa(N.durationMs),z=N===null?"not reported":Fb(N.cache.lookup)+(N.cache.write==="not_attempted"?"":` · ${Fb(N.cache.write)}`),R=[M===null?{label:"timing",value:"not reported"}:{label:N?.startedAt==null?"created":"started",value:M},{label:"duration",value:k},{label:"cache",value:z}],B=[...S.lifecycleFacts.filter(Z=>Z.label!=="duration"),...S.identityFacts,{label:"project folder",value:Dh(a.projectFolders)}],q=l.jsx("button",{"aria-expanded":m,className:"run-detail__fact-toggle",onClick:()=>x(Z=>!Z),type:"button",children:m?"[ hide details ]":"[ details ]"});return l.jsxs("section",{className:"app-shell__view run-detail",children:[l.jsxs(yi,{children:[l.jsx("span",{className:"detail-sticky-bar__id",children:S.contextRunId}),l.jsx("span",{className:"run-detail__status","data-state":S.statusState,children:S.statusLabel}),l.jsxs("span",{className:"detail-sticky-bar__name",children:["Context builder · ",S.operationKindLabel]}),l.jsx("span",{className:"detail-sticky-bar__spacer"}),l.jsxs("span",{className:"detail-sticky-bar__wide detail-sticky-bar__fact",children:[l.jsx("span",{className:"detail-sticky-bar__fact-k",children:"duration"}),l.jsx("span",{className:"detail-sticky-bar__fact-v",children:k})]})]}),l.jsxs("div",{className:"run-detail__mobile-nav",children:[l.jsx("button",{"aria-label":"back to context runs",className:"run-detail__back",type:"button",onClick:r,children:"‹ context runs"}),l.jsx("span",{className:"op-caption op-mono overflow-safe",children:S.contextRunId}),l.jsx("span",{className:"run-detail__status","data-state":S.statusState,children:S.statusLabel})]}),l.jsx("header",{className:"run-detail__header",children:l.jsxs("div",{className:"run-detail__header-identity",children:[l.jsxs("div",{className:"run-detail__identity-line",children:[l.jsx("span",{className:"op-caption op-mono overflow-safe",children:S.contextRunId}),l.jsx("span",{className:"run-detail__status","data-state":S.statusState,children:S.statusLabel}),S.isCacheHit?l.jsx("span",{className:"run-detail__mode",children:"cache hit"}):null]}),l.jsxs("div",{className:"run-detail__workflow-heading",children:[l.jsxs("h2",{className:"run-detail__title overflow-safe",children:["Context builder · ",S.operationKindLabel]}),T?l.jsxs("span",{className:"run-detail__phase",children:["phase ",S.phaseLabel]}):null]})]})}),l.jsxs("div",{className:"run-detail__facts",children:[l.jsxs("div",{className:"run-detail__facts-group",children:[R.map(Z=>l.jsxs("span",{className:"run-detail__fact",children:[l.jsx("span",{className:"run-detail__fact-k",children:Z.label}),l.jsx("span",{className:"run-detail__fact-v",children:Z.value})]},Z.label)),y?null:q]}),y?l.jsx("div",{className:"run-detail__facts-actions",children:q}):null]}),l.jsx("dl",{"aria-label":"Context run record",className:"run-detail__details",hidden:!m,children:B.map(Z=>l.jsxs("div",{children:[l.jsx("dt",{children:Z.label}),l.jsx("dd",{children:l.jsx(Rr,{children:Z.value})})]},Z.label))}),E,S.legacyNotice===null?null:l.jsxs("section",{className:"run-detail__failure","aria-labelledby":"context-legacy-title",children:[l.jsx("h3",{id:"context-legacy-title",children:"Legacy artifact set unsupported"}),l.jsx("p",{className:"overflow-safe",children:S.legacyNotice})]}),S.isCacheHit?l.jsxs("section",{className:"run-detail__snapshot-unavailable",role:"status",children:[l.jsx("h3",{children:"Cache-hit materialization"}),l.jsx("p",{children:"This run was served from the workflow context cache. Selection was materialized from a prior curated bundle; curator and finalizer did not re-execute for this operation."})]}):null,l.jsxs("section",{"aria-labelledby":"context-delegate-title",children:[l.jsx("h3",{className:"run-detail__section-note",id:"context-delegate-title",children:"Delegate"}),l.jsx(Yp,{label:"Context run delegate",facts:S.delegateFacts})]}),l.jsxs("section",{"aria-labelledby":"context-coverage-title",children:[l.jsx("h3",{className:"run-detail__section-note",id:"context-coverage-title",children:"Coverage"}),l.jsx(Yp,{label:"Context run coverage",facts:S.coverageFacts})]}),l.jsxs("section",{"aria-labelledby":"context-counts-title",children:[l.jsx("h3",{className:"run-detail__section-note",id:"context-counts-title",children:"Aggregate counts"}),l.jsx(Yp,{label:"Context run counts",facts:S.countFacts})]}),S.fallbackLabel===null?null:l.jsx("p",{className:"run-detail__section-note",children:S.fallbackLabel}),S.reasonCodes.length===0?null:l.jsxs("section",{"aria-labelledby":"context-reasons-title",children:[l.jsx("h3",{className:"run-detail__section-note",id:"context-reasons-title",children:"Reason codes"}),l.jsx("ul",{className:"context-run-detail__modes",children:S.reasonCodes.map(Z=>l.jsx("li",{className:"run-detail__mode",children:Z},Z))})]}),S.canViewArtifacts&&v!==void 0?l.jsxs("section",{children:[l.jsx("h3",{className:"run-detail__section-note",children:"Run artifacts"}),l.jsx("section",{className:"run-detail__card",children:l.jsx(XR,{api:v,...c===void 0?{}:{onGenerationChanged:c},scope:{contextRunId:a.id,contextGeneration:a.contextGeneration}})})]}):null,h===void 0?null:l.jsx("section",{className:"run-detail__card",children:C===null?l.jsx(_d,{api:h,...c===void 0?{}:{onGenerationChanged:c},refreshToken:N===null?"none":[N.status,N.phase,N.updatedAt??"",N.curator.status,N.finalizer.status].join(" "),scope:{family:"context",contextRunId:a.id,contextGeneration:a.contextGeneration}}):l.jsx("section",{"aria-label":"Session log panel",className:"session-log-panel",children:l.jsxs("section",{"aria-label":"Session log availability",className:"session-log-viewer__availability","data-availability":"not_executed",role:"status",children:[l.jsx("strong",{children:"Not executed"}),l.jsx("p",{children:C})]})})})]})}function eE({item:t,nowMs:a}){const i=zh(t,a),r=i.durationFootnote===""?i.cacheFootnote:`${i.durationFootnote} · ${i.isCacheHit?"cache hit":i.cacheFootnote}`;return l.jsxs("div",{className:`run-card run-card--${i.statusState}`,children:[l.jsxs("span",{className:"run-card__header",children:[l.jsx("span",{"aria-hidden":"true",className:`run-card__status-dot run-card__status-dot--${i.statusState}`}),l.jsx("span",{className:"run-card__identity",children:l.jsx("span",{className:"run-card__id",children:i.contextRunId})}),l.jsx("span",{className:"run-card__status",children:i.statusLabel})]}),l.jsxs("span",{className:"run-card__workflow run-card__workflow--plain",children:[l.jsx("span",{className:"run-card__workflow-name",children:i.operationKindLabel}),i.compatChip===null?null:l.jsx("span",{className:"run-card__compat-chip",children:i.compatChip})]}),i.delegateFootnote===""?null:l.jsx("span",{className:"run-card__meta-line",children:i.delegateFootnote}),l.jsxs("span",{className:"run-card__footer",children:[l.jsx("span",{className:"run-card__timing",children:r}),i.coverageFootnote===""?null:l.jsx("span",{className:"run-card__footnote",children:i.coverageFootnote}),i.legacyUnsupported?l.jsx("span",{className:"run-card__footnote",children:"legacy unsupported"}):null,l.jsx("span",{className:"run-card__detail-hint",children:"detail ›"})]})]})}function tE({announcement:t,filterResetKey:a,contextRuns:i,hasSnapshot:r,nowMs:c,onRetry:f,onSelect:p,phase:h,selectedId:v}){const[m,x]=b.useState("all");b.useEffect(()=>{x("all")},[a]);const y=i.filter(T=>Jv(T,m)),E=["stale","offline","error"].includes(h),S=b.useRef(null),C=b.useRef(null);return b.useEffect(()=>{v!==C.current&&(C.current=v,wd(S.current,v))},[v]),l.jsxs("section",{"aria-label":"Context run monitor",className:"run-list",onKeyDown:xd,ref:S,children:[t===null?null:l.jsx("p",{className:"run-list__announcement","data-selection-loss-announcement":!0,role:"status",tabIndex:-1,children:t}),["stale","offline","auth_expired","connection_changed","error"].includes(h)?l.jsxs("div",{className:"run-list__recovery",role:"status",children:[l.jsxs("span",{children:["Context run feed ",h.replace("_"," "),"."]}),E?l.jsx("button",{onClick:f,type:"button",children:"[ retry context runs ]"}):null]}):null,l.jsx(Po,{chips:_S.map(T=>({id:T,label:T,count:i.filter(N=>Jv(N,T)).length})),groupLabel:"Filter context runs by status",onSelect:x,selected:m}),l.jsxs("section",{"aria-labelledby":"context-run-list-title",className:"run-list__lane",children:[l.jsxs("div",{className:"run-list__lane-heading",children:[l.jsx("h2",{id:"context-run-list-title",children:"Context runs"}),m==="all"?null:l.jsxs("p",{children:["[ context ",String(y.length),"/",String(i.length)," ]"]})]}),i.length===0&&h==="initial_loading"?l.jsxs("div",{className:"run-list__placeholders",children:[l.jsx("p",{className:"run-list__placeholder-copy",role:"status",children:"Loading context-builder runs…"}),l.jsx("div",{className:"run-list__placeholder","aria-hidden":"true"}),l.jsx("div",{className:"run-list__placeholder","aria-hidden":"true"}),l.jsx("div",{className:"run-list__placeholder","aria-hidden":"true"})]}):i.length===0&&!r?l.jsx("p",{className:"run-list__empty",children:"No authoritative context-run snapshot is available."}):i.length===0?l.jsx("p",{className:"run-list__empty",children:"No retained context-builder run is available."}):y.length===0?l.jsxs("p",{className:"run-list__empty",children:["No loaded context runs match ",m,"."]}):l.jsx(bi,{ariaLabel:"Context runs",items:y.map(T=>{const N=zh(T,c);return{id:N.contextRunId,label:`${N.contextRunId} ${N.operationKindLabel} ${N.statusLabel}`,content:l.jsx(eE,{item:T,nowMs:c})}}),onSelect:p,selectedId:v})]}),l.jsxs("p",{"aria-hidden":"true",className:"run-list__keyboard-hint",children:[l.jsx("kbd",{children:"↑"}),l.jsx("kbd",{children:"↓"}),l.jsx("kbd",{children:"j k"}),l.jsx("span",{children:"select context run"})]})]})}const nE=["all","running","paused","blocked","done","failed"];function Yb(t,a){return a==="all"?!0:t.status===a}function aE({item:t,nowMs:a}){const i=_n(t.updatedAt,a),r=t.taskCounts===void 0?null:`${String(t.taskCounts.done)}/${String(t.taskCounts.total)} tasks`;return l.jsxs("div",{className:`run-card run-card--${t.status}`,children:[l.jsxs("span",{className:"run-card__header",children:[l.jsx("span",{className:"run-card__identity",children:l.jsx("span",{className:"run-card__id",children:t.title})}),l.jsx("span",{className:"run-card__status","data-state":t.status,children:t.status})]}),t.publishedStatus===void 0?null:l.jsxs("span",{className:"run-card__published-status",children:["agent published: ",t.publishedStatus]}),l.jsx("span",{className:"run-card__workflow run-card__workflow--plain",title:t.projectFolder,children:l.jsxs("span",{className:"run-card__workflow-name",children:[String(t.agentCount)," agent",t.agentCount===1?"":"s"]})}),l.jsxs("span",{className:"run-card__footer",children:[l.jsxs("span",{className:"run-card__timing",children:["updated ",i]}),l.jsx("span",{className:"run-card__footnote",children:r===null?"no task counts":r}),l.jsx("span",{className:"run-card__detail-hint",children:"detail ›"})]})]})}function sE({announcement:t,progressReports:a,hasSnapshot:i,nowMs:r,onRetry:c,onSelect:f,phase:p,progressReportsRoot:h,selectedId:v,truncated:m}){const[x,y]=b.useState("all"),E=a.filter(M=>Yb(M,x)),S=M=>a.filter(k=>Yb(k,M)).length,C=["stale","offline","error"].includes(p),T=b.useRef(null),N=b.useRef(null);return b.useEffect(()=>{v!==N.current&&(N.current=v,wd(T.current,v))},[v]),l.jsxs("section",{"aria-label":"Progress report monitor",className:"run-list",onKeyDown:xd,ref:T,children:[t===null?null:l.jsx("p",{className:"run-list__announcement","data-selection-loss-announcement":!0,role:"status",tabIndex:-1,children:t}),["stale","offline","auth_expired","connection_changed","error"].includes(p)?l.jsxs("div",{className:"run-list__recovery",role:"status",children:[l.jsxs("span",{children:["Progress report feed ",p.replace("_"," "),"."]}),C?l.jsx("button",{onClick:c,type:"button",children:"[ retry progress reports ]"}):null]}):null,l.jsx(Po,{chips:nE.map(M=>({id:M,label:M,count:S(M)})),groupLabel:"Filter progress reports by status",onSelect:y,selected:x}),l.jsxs("section",{"aria-labelledby":"progress-report-list-title",className:"run-list__lane",children:[l.jsxs("div",{className:"run-list__lane-heading",children:[l.jsx("h2",{id:"progress-report-list-title",tabIndex:-1,children:"Progress reports"}),x==="all"?null:l.jsxs("p",{children:["[ reports ",String(E.length),"/",String(a.length)," ]"]})]}),m?l.jsx("p",{className:"run-list__announcement",role:"status",children:"Partial results: additional progress reports may exist."}):null,a.length===0&&p==="initial_loading"?l.jsxs("div",{className:"run-list__placeholders",children:[l.jsx("p",{className:"run-list__placeholder-copy",role:"status",children:"Loading agent progress reports…"}),l.jsx("div",{className:"run-list__placeholder","aria-hidden":"true"}),l.jsx("div",{className:"run-list__placeholder","aria-hidden":"true"}),l.jsx("div",{className:"run-list__placeholder","aria-hidden":"true"})]}):a.length===0?l.jsxs("div",{className:"run-list__empty",children:[l.jsxs("p",{children:[i?"No agent progress reports are available":"No agent progress report snapshot is available yet",h===void 0?".":` under ${h}.`]}),l.jsxs("p",{children:["Reports appear once an agent opens one with the"," ",l.jsx("code",{children:"progress_report_start"})," tool."]})]}):E.length===0?l.jsxs("p",{className:"run-list__empty",children:["No loaded progress reports match ",x,"."]}):l.jsx(bi,{ariaLabel:"Progress reports",items:E.map(M=>({id:M.id,label:`${M.title} ${M.status}`,content:l.jsx(aE,{item:M,nowMs:r})})),onSelect:f,selectedId:v})]}),l.jsxs("p",{"aria-hidden":"true",className:"run-list__keyboard-hint",children:[l.jsx("kbd",{children:"↑"}),l.jsx("kbd",{children:"↓"}),l.jsx("kbd",{children:"j k"}),l.jsx("span",{children:"select report"}),l.jsx("span",{children:"·"}),l.jsx("kbd",{children:"enter"}),l.jsx("span",{children:"open detail"})]})]})}const mi=["running","paused","blocked","done","failed"],lE=["working","idle","blocked","done"],iE=["pending","active","done","blocked","failed"],rE=["info","success","warn","error"],oE=["added","modified","deleted"],i0=/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/,cE=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.\d+)?(?:Z|([+-])(\d{2}):(\d{2}))$/;class uE extends Error{constructor(a){super(a),this.name="ProgressReportParseError"}}function aa(t){throw new uE(t)}function _a(t,a){return(typeof t!="object"||t===null||Array.isArray(t))&&aa(`${a} must be an object`),t}function va(t,a,i){const r=new Set(a),c=Object.keys(t).find(f=>!r.has(f));c!==void 0&&aa(`${i}.${c} is unexpected`)}function Jh(t,a){return(typeof t!="string"||t.length===0)&&aa(`${a} must be a non-empty string`),t}function Ps(t,a,i){return(typeof t!="string"||!a.includes(t))&&aa(`${i} is not a recognized value`),t}function $l(t,a){return(typeof t!="number"||!Number.isSafeInteger(t)||t<0)&&aa(`${a} must be a non-negative integer`),t}function Er(t,a){return(typeof t!="string"||!r0(t))&&aa(`${a} must be an ISO timestamp`),t}function r0(t){const a=cE.exec(t);if(a===null)return!1;const i=Number(a[1]),r=Number(a[2]),c=Number(a[3]),f=Number(a[4]),p=Number(a[5]),h=Number(a[6]),v=a[8]===void 0?0:Number(a[8]),m=a[9]===void 0?0:Number(a[9]),y=[31,i%4===0&&(i%100!==0||i%400===0)?29:28,31,30,31,30,31,31,30,31,30,31];return i>=1&&i<=9999&&r>=1&&r<=12&&c>=1&&c<=(y[r-1]??0)&&f<=23&&p<=59&&h<=59&&v<=23&&m<=59&&Number.isFinite(Date.parse(t))}function o0(t,a){const i=Jh(t,a);return i0.test(i)||aa(`${a} is malformed`),i}function jd(t,a){return(typeof t!="string"||!r0(t))&&aa(`${a} must be an ISO timestamp`),t}const dE=50,fE=200,pE=200,hE=500,mE=50,gE=100,_E=100,vE=256,bE=300,yE=500,xE=500,wE=200,jE=16;function SE(t,a){let i=0;const r=t[Symbol.iterator]();for(;!r.next().done;)if(i+=1,i>a)return!1;return!0}function NE(t){return t.startsWith("/")}function Sd(t,a,i,r){const c=Jh(t,a);return SE(c,i)||aa(`${a} exceeds ${i} Unicode code points (${r} bound)`),c}function Dl(t,a){return Sd(t,a,vE,"id")}function Or(t,a){return Sd(t,a,bE,"message")}function nd(t,a){return Sd(t,a,yE,"title")}function c0(t,a){const i=Sd(t,a,xE,"path");return NE(i)||aa(`${a} must be an absolute path`),i}function Gs(t,a,i){return(!Array.isArray(t)||t.length>a)&&aa(`${i} must be a bounded array`),t}function kE(t){const a=_a(t,"taskCounts");return va(a,["total","done"],"taskCounts"),Object.freeze({total:$l(a.total,"taskCounts.total"),done:$l(a.done,"taskCounts.done")})}function AE(t){const a=_a(t,"progressReport");return va(a,["id","title","status","projectFolder","startedAt","updatedAt","agentCount","taskCounts","publishedStatus"],"progressReport"),Object.freeze({id:o0(a.id,"progressReport.id"),title:nd(a.title,"progressReport.title"),status:Ps(a.status,mi,"progressReport.status"),projectFolder:c0(a.projectFolder,"progressReport.projectFolder"),startedAt:Er(a.startedAt,"progressReport.startedAt"),updatedAt:Er(a.updatedAt,"progressReport.updatedAt"),agentCount:$l(a.agentCount,"progressReport.agentCount"),...a.taskCounts===void 0?{}:{taskCounts:kE(a.taskCounts)},...a.publishedStatus===void 0?{}:{publishedStatus:Ps(a.publishedStatus,mi,"progressReport.publishedStatus")}})}function RE(t){const a=_a(t,"response");va(a,["progressReports","serverNow","truncated"],"response");const i=Gs(a.progressReports,wE,"response.progressReports");typeof a.truncated!="boolean"&&aa("response.truncated must be a boolean");const r=Er(a.serverNow,"response.serverNow");return Object.freeze({progressReports:Object.freeze(i.map(AE)),serverNow:r,truncated:a.truncated})}function EE(t,a){const i=`session.agents[${String(a)}]`,r=_a(t,i);return va(r,["name","role","status","activity","updatedAt"],i),Object.freeze({name:Dl(r.name,`${i}.name`),role:Dl(r.role,`${i}.role`),status:Ps(r.status,lE,`${i}.status`),activity:Or(r.activity,`${i}.activity`),updatedAt:jd(r.updatedAt,`${i}.updatedAt`)})}function TE(t,a){const i=`session.tasks[${String(a)}]`,r=_a(t,i);va(r,["id","title","status","agent","note"],i);const c={id:Dl(r.id,`${i}.id`),title:nd(r.title,`${i}.title`),status:Ps(r.status,iE,`${i}.status`)};return r.agent!==void 0&&(c.agent=Dl(r.agent,`${i}.agent`)),r.note!==void 0&&(c.note=Or(r.note,`${i}.note`)),Object.freeze(c)}function CE(t,a){const i=`session.log[${String(a)}]`,r=_a(t,i);return va(r,["t","agent","kind","msg"],i),Object.freeze({t:jd(r.t,`${i}.t`),agent:Dl(r.agent,`${i}.agent`),kind:Ps(r.kind,rE,`${i}.kind`),msg:Or(r.msg,`${i}.msg`)})}function OE(t,a){const i=`session.files[${String(a)}]`,r=_a(t,i);return va(r,["path","change","adds","dels"],i),Object.freeze({path:Dl(r.path,`${i}.path`),change:Ps(r.change,oE,`${i}.change`),adds:$l(r.adds,`${i}.adds`),dels:$l(r.dels,`${i}.dels`)})}function $E(t){const a=_a(t,"session.tests");va(a,["passed","failed","skipped","failing","lastRun"],"session.tests");const i=Gs(a.failing,_E,"session.tests.failing");return Object.freeze({passed:$l(a.passed,"session.tests.passed"),failed:$l(a.failed,"session.tests.failed"),skipped:$l(a.skipped,"session.tests.skipped"),failing:Object.freeze(i.map((r,c)=>Or(r,`session.tests.failing[${String(c)}]`))),lastRun:jd(a.lastRun,"session.tests.lastRun")})}function ME(t,a){const i=`session.blockers[${String(a)}]`,r=_a(t,i);return va(r,["msg","raisedBy","needsHuman"],i),typeof r.needsHuman!="boolean"&&aa(`${i}.needsHuman must be a boolean`),Object.freeze({msg:Or(r.msg,`${i}.msg`),raisedBy:Dl(r.raisedBy,`${i}.raisedBy`),needsHuman:r.needsHuman})}function LE(t,a){const i=`session.decisions[${String(a)}]`,r=_a(t,i);return va(r,["t","by","msg"],i),Object.freeze({t:jd(r.t,`${i}.t`),by:Dl(r.by,`${i}.by`),msg:Or(r.msg,`${i}.msg`)})}function IE(t){const a=_a(t,"progressReport");va(a,["schemaVersion","session","agents","tasks","log","files","tests","blockers","decisions"],"progressReport"),a.schemaVersion!=="progress-report-v1"&&aa("progressReport.schemaVersion must be progress-report-v1");const i=_a(a.session,"session.session");va(i,["id","title","goal","status","startedAt","updatedAt","projectFolder"],"session.session");const r=Object.freeze({id:o0(i.id,"session.session.id"),title:nd(i.title,"session.session.title"),goal:nd(i.goal,"session.session.goal"),status:Ps(i.status,mi,"session.session.status"),startedAt:Er(i.startedAt,"session.session.startedAt"),updatedAt:Er(i.updatedAt,"session.session.updatedAt"),projectFolder:c0(i.projectFolder,"session.session.projectFolder")});return Object.freeze({session:r,...a.agents===void 0?{}:{agents:Object.freeze(Gs(a.agents,dE,"session.agents").map(EE))},...a.tasks===void 0?{}:{tasks:Object.freeze(Gs(a.tasks,fE,"session.tasks").map(TE))},...a.log===void 0?{}:{log:Object.freeze(Gs(a.log,pE,"session.log").map(CE))},...a.files===void 0?{}:{files:Object.freeze(Gs(a.files,hE,"session.files").map(OE))},...a.tests===void 0?{}:{tests:$E(a.tests)},...a.blockers===void 0?{}:{blockers:Object.freeze(Gs(a.blockers,mE,"session.blockers").map(ME))},...a.decisions===void 0?{}:{decisions:Object.freeze(Gs(a.decisions,gE,"session.decisions").map(LE))}})}function u0(t){const a=_a(t,"response");va(a,["progressReport","serverNow","omittedSections","publishedSessionStatus"],"response");const r=Gs(a.omittedSections,jE,"response.omittedSections").map((c,f)=>Jh(c,`response.omittedSections[${String(f)}]`));return Object.freeze({progressReport:IE(a.progressReport),serverNow:Er(a.serverNow,"response.serverNow"),omittedSections:Object.freeze(r),...a.publishedSessionStatus===void 0?{}:{publishedSessionStatus:Ps(a.publishedSessionStatus,mi,"response.publishedSessionStatus")}})}function DE(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)&&Object.prototype.hasOwnProperty.call(t,"progressReport")?Object.freeze({kind:"detail",...u0(t)}):Object.freeze({kind:"ack"})}function zE(t){return t.action==="set"?{action:"set",status:Ps(t.status,mi,"status")}:{action:"revert"}}function Xb(t){if(t instanceof we){if(t.code==="progress_report_malformed")return"malformed";if(t.code==="content_too_large_for_dashboard")return"oversized";if(t.status===404)return"removed";if(t.status===413)return"oversized"}}function Pb(t){return t??new AbortController().signal}const Qb=16*1024,qE=new Set(["invalid_request","method_not_allowed","agent_instance_changed","not_found","dashboard_busy","scan_byte_budget_exceeded","content_too_large_for_dashboard","progress_report_malformed","progress_report_overrides_unavailable","internal_error"]);async function UE(t){Hs(t);const a=Number(t.headers.get("content-length"));if(Number.isFinite(a)&&a>Qb){await t.body?.cancel(),Hs(t);return}if(t.body===null)return;const i=t.body.getReader(),r=new TextDecoder;let c=0,f="";try{for(;;){const p=await i.read();if(p.done)break;if(c+=p.value.byteLength,c>Qb){await i.cancel(),Hs(t);return}f+=r.decode(p.value,{stream:!0})}f+=r.decode()}finally{i.releaseLock()}Hs(t);try{const h=JSON.parse(f).error?.code;return typeof h=="string"&&qE.has(h)?h:void 0}catch{return}}async function d0(t,a){let i;try{i=await t()}catch(r){throw r instanceof bt?new we("connection_changed",409,"agent_instance_changed"):a?.aborted===!0||r instanceof DOMException&&r.name==="AbortError"?new we("aborted"):new we("offline")}if(i.status===401)throw new we("auth_expired",401,"unauthorized");if(!i.ok){let r;try{r=await UE(i)}catch(c){if(c instanceof bt)throw new we("connection_changed",409,"agent_instance_changed")}throw r==="agent_instance_changed"?new we("connection_changed",i.status,r):new we("request_error",i.status,r)}if(i.status===204){await i.body?.cancel();return}try{return await na(i)}catch(r){throw r instanceof bt?new we("connection_changed",409,"agent_instance_changed"):new we("request_error",i.status)}}async function Jb(t,a,i){return d0(()=>t(a,{signal:i}),i)}function BE(t=hs,a=fx){return{async listProgressReports(i={}){const r=await Jb(t,"/api/progress-reports",Pb(i.signal));return RE(r)},async getProgressReportDetail(i,r){const c=await Jb(t,`/api/progress-reports/${encodeURIComponent(i)}/data`,Pb(r)),f=u0(c);if(f.progressReport.session.id!==i)throw new we("request_error",502,"internal_error");return f},async setStatusOverride(i,r){if(!i0.test(i))throw new we("request_error",400,"invalid_request");const c=await d0(()=>a(`/api/progress-reports/${i}/status-override`,zE(r))),f=DE(c);if(f.kind==="detail"&&f.progressReport.session.id!==i)throw new we("request_error",502,"internal_error");return f}}}function ci(t){const a=Date.parse(t);return Number.isNaN(a)?null:a}function _u(t,a){const i=ci(t);if(i===null)return"—";const r=Math.max(0,Math.floor((a-i)/1e3));return r<60?`${String(r)}s ago`:r<3600?`${String(Math.floor(r/60))}m ago`:r<86400?`${String(Math.floor(r/3600))}h ${String(Math.floor(r%3600/60))}m ago`:`${String(Math.floor(r/86400))}d ago`}function GE(t,a){const i=Math.min(.03,.9/Math.max(1,a));return Number((.25+t*i).toFixed(2))*1e3}function HE(t){const a=ci(t);return a===null?"—":new Date(a).toISOString().slice(11,16)}function Xp(t){const a=ci(t);if(a===null)return"";const i=new Date(a);return`${["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"][i.getUTCMonth()]??""} ${String(i.getUTCDate())}`.trim()}function VE(t,a){const i=ci(t);if(i===null)return"—";const r=Math.max(0,Math.floor((a-i)/1e3));return r<60?`${String(r)}s`:r<3600?`${String(Math.floor(r/60))}m`:`${String(Math.floor(r/3600))}h ${String(Math.floor(r%3600/60))}m`}function KE(t,a,i){const r=t.tasks??[],c=t.agents??[],f=r.filter(R=>R.status==="done").length,p=r.filter(R=>R.status==="active").length,h=r.filter(R=>R.status==="blocked"||R.status==="failed").length,v=R=>(i.agentFilter===null||R.agent===i.agentFilter)&&(i.statusFilter===null||R.status===i.statusFilter),m=r.filter(v),x=(t.log??[]).filter(R=>(i.agentFilter===null||R.agent===i.agentFilter)&&(!i.issuesOnly||R.kind==="warn"||R.kind==="error")),y=x.slice(-25).reverse(),E=new Set(y.map(R=>Xp(R.t)).filter(Boolean)),S=[...t.files??[]].sort((R,B)=>B.adds+B.dels-(R.adds+R.dels)),C=(i.filesExpanded?S:S.slice(0,8)).map(R=>({...R,displayPath:R.path.replaceAll("/","/")})),T=(t.files??[]).reduce((R,B)=>({adds:R.adds+B.adds,dels:R.dels+B.dels}),{adds:0,dels:0}),N=i.agentFilter!==null||i.statusFilter!==null,M=[`${String(m.length)} of ${String(r.length)} shown`,i.agentFilter,i.statusFilter==="pending"?"queued":i.statusFilter].filter(R=>R!==null),z=t.session.status==="done"||t.session.status==="failed"?ci(t.session.updatedAt)??a:a;return{agents:c.map(R=>({...R,updatedLabel:_u(R.updatedAt,a)})),decisions:(t.decisions??[]).map(R=>({...R,relativeLabel:_u(R.t,a)})),elapsedLabel:VE(t.session.startedAt,z),files:C,filesToggleLabel:S.length>8?i.filesExpanded?"[ show fewer ]":"[ show all ]":null,fileTotals:T,logs:y.map((R,B)=>{const q=Xp(R.t),Z=B===0?null:Xp(y[B-1]?.t??"");return{...R,clockLabel:ci(R.t)===null?"—":new Date(ci(R.t)??0).toISOString().slice(11,19),dayLabel:q,showDay:E.size>1&&q.length>0&&q!==Z}}),logTotal:x.length,notice:(t.blockers??[]).find(R=>R.needsHuman)??null,progress:{active:p,activeWidthPercent:r.length===0?0:p/r.length*100,blocked:h,done:f,donePercent:r.length===0?0:Math.round(f/r.length*100),doneWidthPercent:r.length===0?0:f/r.length*100,total:r.length},startedClock:`${HE(t.session.startedAt)} utc`,taskFilterLabel:N?M.join(" · "):null,tasks:m,testsLastRunLabel:t.tests===void 0?null:_u(t.tests.lastRun,a),updatedLabel:_u(t.session.updatedAt,a),workingAgentCount:c.filter(R=>R.status==="working").length}}const f0={active:{glyph:"◐",label:"active"},blocked:{glyph:"⊘",label:"blocked"},done:{glyph:"●",label:"done"},failed:{glyph:"✕",label:"failed"},pending:{glyph:"○",label:"queued"}},ZE=["done","active","pending","blocked","failed"],FE={blocked:"⊘",done:"●",idle:"○",working:"◐"},YE={error:"✕",info:"·",success:"✓",warn:"!"},Wb={auth_expired:{label:"auth expired",terminal:!0},connection_changed:{label:"connection changed",terminal:!0},current:{label:"live · 3s",terminal:!1},error:{label:"error · retrying",terminal:!1},initial_loading:{label:"connecting · 3s",terminal:!1},offline:{label:"offline · retrying",terminal:!1},stale:{label:"stale · retrying",terminal:!1}};function Pp(t){return`${t.t}|${t.agent}|${t.msg}`}function zo({children:t}){return l.jsxs("span",{className:"progress-report-page__axis",children:["[ ",t," ]"]})}function ii({children:t,label:a}){return l.jsxs("section",{className:"progress-report-page__card",children:[l.jsx("h3",{className:"progress-report-page__card-label",children:a}),l.jsx("div",{className:"progress-report-page__card-body",children:t})]})}function XE(){const[t,a]=b.useState(By),i=Vy(t),r=()=>{a(i),Gy(i),Hy(i)};return l.jsxs("button",{"aria-pressed":t==="dark",className:"progress-report-page__text-control",onClick:r,title:`switch to ${i} theme · saved in this browser`,type:"button",children:["[ ",i," mode ]"]})}function PE(t){switch(t){case"removed":return"This progress report is no longer available. It may have been rotated or removed.";case"malformed":return"This progress report could not be parsed. The document may be corrupted or from an incompatible version.";case"oversized":return"This progress report is too large to display in the dashboard."}}function Qp({backRef:t,busy:a=!1,children:i,onBack:r}){return l.jsx("main",{"aria-busy":a,className:"progress-report-page progress-report-page--state",children:l.jsxs("div",{className:"progress-report-page__state-wrap",children:[l.jsx("button",{"aria-label":"back to progress reports",className:"progress-report-page__tag progress-report-page__back-tag",onClick:r,ref:t,type:"button",children:"progress reports"}),l.jsx(ii,{label:"PROGRESS REPORT",children:i})]})})}function QE({onLocate:t,presentation:a,setStatusFilter:i,tasks:r}){const c=b.useRef(new WeakSet),f=b.useRef(new Set),p=b.useRef(null);p.current===null&&typeof window.matchMedia=="function"&&(p.current=window.matchMedia("(prefers-reduced-motion: reduce)"));const h=r.slice(0,60),v=h.length<=14;return b.useEffect(()=>{const m=()=>{f.current.forEach(E=>E.cancel()),f.current.clear()},x=p.current,y=()=>{x?.matches===!0&&m()};return x?.addEventListener("change",y),()=>{x?.removeEventListener("change",y),m()}},[]),l.jsxs("div",{className:"progress-report-page__timeline",children:[l.jsxs("div",{className:"progress-report-page__timeline-meta",children:[l.jsx("span",{children:"task completion · one node per task"}),l.jsx("div",{className:"progress-report-page__legend",children:ZE.map(m=>{const x=f0[m],y=a.statusFilter===m;return l.jsxs("button",{"aria-pressed":y,className:"progress-report-page__legend-button","data-state":m,onClick:()=>i(m),title:y?`showing ${x.label} only — click to clear`:`filter tasks: ${x.label}`,type:"button",children:[l.jsx("span",{className:"progress-report-page__legend-dot",children:m==="failed"?"✕":""}),x.label]},m)})})]}),l.jsxs("div",{"aria-label":"Task completion timeline",className:"progress-report-page__timeline-chart",role:"group",children:[l.jsx("span",{"aria-hidden":"true",className:"progress-report-page__timeline-line"}),l.jsx("div",{className:"progress-report-page__timeline-nodes","data-single":h.length===1||void 0,children:h.map((m,x)=>{const y=GE(x,h.length),E=(a.agentFilter!==null||a.statusFilter!==null)&&!((a.agentFilter===null||m.agent===a.agentFilter)&&(a.statusFilter===null||m.status===a.statusFilter));return l.jsx("span",{className:"progress-report-page__node-slot",children:l.jsxs("button",{"aria-label":`${m.id} — ${m.title} · ${m.status}${m.note===void 0?"":` · ${m.note}`} · locate task`,className:"progress-report-page__node","data-dimmed":E||void 0,"data-entrance-delay":`${(y/1e3).toFixed(2)}s`,"data-state":m.status,onClick:()=>t(m),ref:S=>{if(S===null||c.current.has(S)||(c.current.add(S),p.current?.matches===!0||typeof S.animate!="function"))return;const T=S.animate([{opacity:0},{opacity:1}],{delay:y,duration:350,easing:"ease-out",fill:"backwards"});f.current.add(T);const N=()=>{f.current.delete(T)};T.finished.then(N,N)},title:`${m.id} — ${m.title} · ${m.status}${m.note===void 0?"":` · ${m.note}`}`,type:"button",children:[l.jsx("span",{className:"progress-report-page__node-dot",children:m.status==="failed"?"✕":""}),v?l.jsx("span",{className:"progress-report-page__node-label",children:m.id}):null]})},`${m.id}-${String(x)}`)})})]}),l.jsxs("div",{className:"progress-report-page__timeline-axis",children:[l.jsx(zo,{children:h[0]?.id??"T1"}),l.jsx(zo,{children:h.at(-1)?.id??`T${String(r.length)}`})]})]})}function JE({agent:t,pressed:a,toggle:i}){return l.jsxs("button",{"aria-pressed":a,className:"progress-report-page__agent-row","data-selected":a||void 0,"data-state":t.status,onClick:i,title:a?"filtering by this agent — click to clear":"filter tasks and log to this agent",type:"button",children:[l.jsx("span",{className:"progress-report-page__glyph",children:FE[t.status]}),l.jsxs("span",{className:"progress-report-page__agent-name",children:[t.name," ",l.jsxs("span",{children:["· ",t.role]})]}),l.jsx("span",{className:"progress-report-page__agent-activity",children:t.activity}),l.jsx("span",{className:"progress-report-page__state-word",children:t.status}),l.jsx("span",{className:"progress-report-page__relative",children:t.updatedLabel})]})}function WE({flash:t,highlighted:a,task:i}){const r=f0[i.status];return l.jsxs("div",{className:"progress-report-page__task-row","data-flash":t??void 0,"data-highlighted":a||void 0,"data-state":i.status,"data-task-id":i.id,children:[l.jsx("span",{className:"progress-report-page__glyph",children:r.glyph}),l.jsx("span",{className:"progress-report-page__task-id",title:i.id,children:i.id}),l.jsxs("span",{className:"progress-report-page__task-copy",children:[l.jsx("span",{children:i.title}),i.note===void 0?null:l.jsx("span",{children:i.note})]}),l.jsx("span",{className:"progress-report-page__task-agent",children:i.agent??""}),l.jsx("span",{className:"progress-report-page__state-word",children:i.status})]})}function eT({entry:t,flash:a}){return l.jsxs(l.Fragment,{children:[t.showDay?l.jsxs("div",{className:"progress-report-page__day-separator",children:[l.jsx("span",{children:t.dayLabel}),l.jsx("span",{})]}):null,l.jsxs("div",{className:"progress-report-page__log-row","data-flash":a??void 0,"data-kind":t.kind,title:t.t,children:[l.jsx("span",{children:t.clockLabel}),l.jsx("span",{children:t.agent}),l.jsxs("span",{className:"progress-report-page__log-message",children:[l.jsx("span",{children:YE[t.kind]}),l.jsx("span",{children:t.msg})]})]})]})}function tT({blockers:t}){const a=t.findIndex(i=>i.needsHuman);return l.jsx(ii,{label:"BLOCKERS",children:l.jsx("div",{className:"progress-report-page__blockers",children:t.map((i,r)=>l.jsxs("div",{children:[i.needsHuman?l.jsx("span",{className:"progress-report-page__human-stamp","data-primary":r===a||void 0,children:"NEEDS HUMAN"}):null,l.jsx("span",{children:i.msg}),l.jsxs("span",{children:["raised by ",i.raisedBy]})]},`${i.raisedBy}-${String(r)}`))})})}function nT({onSet:t,status:a}){const[i,r]=b.useState(!1),c=b.useId(),f=b.useRef(null),p=b.useRef(null),h=b.useRef(new Map);b.useEffect(()=>{if(!i)return;h.current.get(a)?.focus();const y=E=>{E.target instanceof Node&&!f.current?.contains(E.target)&&r(!1)};return document.addEventListener("pointerdown",y),()=>document.removeEventListener("pointerdown",y)},[i,a]);const v=()=>{r(!1),p.current?.focus()},m=y=>{r(!1),p.current?.focus(),y!==a&&t(y)},x=y=>{if(y.key==="Escape"){y.preventDefault(),v();return}if(y.key==="Tab"){r(!1);return}if(y.key==="Home"||y.key==="End"||y.key==="ArrowDown"||y.key==="ArrowUp"){y.preventDefault();const E=mi.map(T=>h.current.get(T)).filter(T=>T!==void 0);if(E.length===0)return;const S=E.indexOf(document.activeElement),C=y.key==="Home"?0:y.key==="End"?E.length-1:S===-1?0:(S+(y.key==="ArrowDown"?1:-1)+E.length)%E.length;E[C]?.focus()}};return l.jsxs("div",{className:"progress-report-page__status-menu",ref:f,children:[l.jsxs("button",{"aria-controls":i?c:void 0,"aria-expanded":i,"aria-haspopup":"listbox","aria-label":"session status",className:"progress-report-page__tag progress-report-page__status-trigger","data-state":a,onClick:()=>r(y=>!y),ref:p,type:"button",children:[l.jsx("span",{children:a}),l.jsx("span",{"aria-hidden":"true",className:"progress-report-page__status-chevron",children:i?"⌃":"⌄"})]}),i?l.jsx("div",{"aria-label":"session status",className:"progress-report-page__status-panel",id:c,onKeyDown:x,role:"listbox",children:mi.map(y=>l.jsxs("button",{"aria-selected":y===a,className:"progress-report-page__status-option","data-state":y,onClick:()=>m(y),ref:E=>{E===null?h.current.delete(y):h.current.set(y,E)},role:"option",type:"button",children:[l.jsx("span",{children:y}),y===a?l.jsx("span",{"aria-hidden":"true",className:"progress-report-page__status-current",children:"current"}):null]},y))}):null]})}function aT({expanded:t,files:a,label:i,onToggle:r,totals:c,totalCount:f}){return l.jsx(ii,{label:"FILES CHANGED",children:l.jsxs("div",{className:"progress-report-page__files",children:[a.map((p,h)=>l.jsxs("span",{className:"progress-report-page__file-row","data-change":p.change,children:[l.jsx("span",{children:p.change[0]?.toUpperCase()}),l.jsx("span",{"aria-label":p.path,children:p.displayPath}),l.jsx("span",{children:p.adds===0?"":`+${String(p.adds)}`}),l.jsx("span",{children:p.dels===0?"":`−${String(p.dels)}`})]},`${p.path}-${String(h)}`)),l.jsxs("div",{className:"progress-report-page__file-summary",children:[l.jsxs("span",{children:[i===null||t?`${String(f)} ${f===1?"file":"files"}`:`top 8 of ${String(f)} by churn`,i===null?null:l.jsxs(l.Fragment,{children:[" · ",l.jsx("button",{className:"progress-report-page__text-control",onClick:r,type:"button",children:i})]})]}),l.jsxs("span",{children:[l.jsxs("strong",{children:["+",String(c.adds)]})," · −",String(c.dels)]})]})]})})}function ey({detail:t,detailPhase:a,nowMs:i,onBack:r,onRetry:c,onSetStatusOverride:f,omittedSections:p,pollingPhase:h="current",publishedSessionStatus:v,selectedId:m,unreadableReason:x}){const y=b.useRef(null),E=b.useRef(null),S=b.useRef(null),C=b.useRef(null),T=b.useRef(0),N=b.useRef(null),[M,k]=b.useState(()=>window.innerWidth<=880),[z,R]=b.useState({agentFilter:null,filesExpanded:!1,issuesOnly:!1,statusFilter:null}),[B,q]=b.useState(null),[Z,ae]=b.useState(null),oe=x!==null?"unreadable":t===null?"empty":"detail";if(b.useEffect(()=>{const U=()=>k(window.innerWidth<=880);return window.addEventListener("resize",U),()=>window.removeEventListener("resize",U)},[]),b.useEffect(()=>{if(m===null||!M){E.current=null;return}const U=`${m}:${oe}`;E.current!==U&&(E.current=U,y.current?.focus())},[oe,M,m]),b.useEffect(()=>()=>{S.current!==null&&window.clearTimeout(S.current),N.current!==null&&window.clearTimeout(N.current)},[]),b.useEffect(()=>{if(t===null){C.current=null,ae(null),N.current!==null&&window.clearTimeout(N.current);return}const U=C.current;if(C.current=t,U===null||U.session.id!==t.session.id){ae(null),N.current!==null&&window.clearTimeout(N.current);return}T.current+=1;const Q=new Map((U.tasks??[]).map(Re=>[Re.id,Re.status])),he=new Set((t.tasks??[]).filter(Re=>Q.get(Re.id)!==Re.status).map(Re=>Re.id)),F=new Set((U.log??[]).map(Pp)),ge=new Set((t.log??[]).map(Pp).filter(Re=>!F.has(Re))),Ve=U.session.updatedAt!==t.session.updatedAt;if(!Ve&&he.size===0&&ge.size===0){ae(null),N.current!==null&&window.clearTimeout(N.current);return}const Se=T.current%2===1?"a":"b";ae({generation:Se,logKeys:ge,taskIds:he,wrote:Ve}),N.current!==null&&window.clearTimeout(N.current),N.current=window.setTimeout(()=>ae(null),2600)},[t]),m===null)return l.jsx(Qp,{backRef:y,onBack:r,children:l.jsx("p",{children:"Select an agent progress report to inspect its narrative."})});if(x!==null)return l.jsxs(Qp,{backRef:y,onBack:r,children:[l.jsx("h1",{children:"Progress report unavailable"}),l.jsx("p",{children:PE(x)}),l.jsx("button",{className:"progress-report-page__action",onClick:c,type:"button",children:"retry progress report"})]});if(t===null){const U=a==="error";return l.jsxs(Qp,{backRef:y,busy:a==="loading",onBack:r,children:[l.jsx("h1",{children:"Progress report"}),l.jsx("p",{children:a==="loading"?"Loading progress report…":a==="not_found"?"The selected progress report is no longer available.":U?"The progress report could not be loaded.":"Progress report is unavailable."}),U?l.jsx("button",{className:"progress-report-page__action",onClick:c,type:"button",children:"retry progress report"}):null]})}const P=KE(t,i,z),ue=a==="stale",_e=Wb[h],me=ue||!["current","initial_loading"].includes(h),be=ue&&h==="current"?Wb.stale.label:_e.label,ve=t.tasks??[],$=U=>{R(Q=>({...Q,statusFilter:Q.statusFilter===U?null:U}))},ee=()=>{R(U=>({...U,agentFilter:null,statusFilter:null}))},ce=U=>{P.tasks.some(he=>he===U)||ee(),q(U.id),S.current!==null&&window.clearTimeout(S.current),S.current=window.setTimeout(()=>q(null),2200),window.setTimeout(()=>{document.querySelector(`[data-task-id="${CSS.escape(U.id)}"]`)?.scrollIntoView({behavior:"smooth",block:"center"})},60)},de=t.blockers??[],ye=de.filter(U=>U.needsHuman).length,j=t.tests,L=t.files??[];return l.jsxs("main",{className:"progress-report-page",children:[l.jsxs("span",{"aria-hidden":"true",className:"progress-report-page__stamp",children:[t.session.id," · started ",P.startedClock," · operate terminal"]}),l.jsxs("div",{className:"progress-report-page__wrap",children:[l.jsxs("div",{className:"progress-report-page__stack",children:[l.jsxs("header",{className:"progress-report-page__header",children:[l.jsxs("div",{className:"progress-report-page__meta-row",children:[l.jsxs("div",{className:"progress-report-page__tags",children:[l.jsx("button",{"aria-label":"back to progress reports",className:"progress-report-page__tag progress-report-page__back-tag",onClick:r,ref:y,title:"back to progress reports",type:"button",children:t.session.id}),f===void 0?l.jsx("span",{className:"progress-report-page__tag","data-state":t.session.status,children:t.session.status}):l.jsx(nT,{onSet:U=>{f({action:"set",status:U})},status:t.session.status}),l.jsx("button",{className:"progress-report-page__text-control",onClick:()=>{f?.({action:"revert"})},type:"button",children:"[ revert ]"}),ue?l.jsx("span",{className:"progress-report-page__tag","data-variant":"outline",children:"stale"}):null]}),l.jsxs("span",{className:"progress-report-page__header-controls",children:[l.jsxs("span",{className:"progress-report-page__updated","data-flash":Z?.wrote?Z.generation:void 0,"data-stale":ue||void 0,title:`last write ${t.session.updatedAt}`,children:[ue?"last write":"updated"," ",P.updatedLabel]}),l.jsx(XE,{})]})]}),v===void 0?null:l.jsxs("span",{className:"progress-report-page__published-status",children:["agent published: ",v]}),l.jsx("h1",{children:t.session.title}),l.jsx("p",{children:t.session.goal}),l.jsxs("span",{className:"progress-report-page__session-line",children:["started ",P.startedClock," · elapsed ",P.elapsedLabel," · ",String(P.agents.length)," agents · ",String(P.progress.total)," tasks"]}),P.notice===null?null:l.jsxs("div",{className:"progress-report-page__notice",children:[l.jsx("span",{className:"progress-report-page__tag","data-variant":"outline",children:"needs human"}),l.jsx("span",{children:P.notice.msg.length>140?`${P.notice.msg.slice(0,139).trimEnd()}…`:P.notice.msg}),l.jsxs("span",{children:["raised by ",P.notice.raisedBy,ye>1?` · +${String(ye-1)} more`:""]}),l.jsxs("button",{className:"progress-report-page__text-control",onClick:()=>document.querySelector("[data-progress-blockers]")?.scrollIntoView({behavior:"smooth"}),type:"button",children:["[ view ",de.filter(U=>U.needsHuman).length>1?"blockers":"blocker"," ]"]})]})]}),ue?l.jsxs("section",{className:"progress-report-page__truth-state",role:"status",children:[l.jsx("strong",{children:"Showing a stale snapshot."})," ",_e.terminal?`The last verified report remains visible; polling stopped because ${_e.label}.`:"The live read failed; the last verified report remains visible while polling retries."]}):null,ve.length===0?null:l.jsxs("section",{className:"progress-report-page__hero",children:[l.jsx(QE,{onLocate:ce,presentation:z,setStatusFilter:$,tasks:ve}),l.jsx("div",{className:"progress-report-page__progress-card",children:l.jsxs(ii,{label:"COMPLETE",children:[l.jsxs("div",{className:"progress-report-page__progress-value",children:[String(P.progress.donePercent),"%"]}),l.jsxs("svg",{"aria-hidden":"true",className:"progress-report-page__bar",preserveAspectRatio:"none",viewBox:"0 0 100 4",children:[l.jsx("rect",{className:"progress-report-page__bar-track",height:"4",width:"100"}),l.jsx("rect",{className:"progress-report-page__bar-done",height:"4",width:P.progress.doneWidthPercent}),l.jsx("rect",{className:"progress-report-page__bar-active",height:"4",width:P.progress.activeWidthPercent,x:P.progress.doneWidthPercent})]}),l.jsxs("span",{className:"progress-report-page__caption",children:[String(P.progress.done)," of ",String(P.progress.total)," tasks done · ",String(P.progress.active)," active · ",String(P.progress.blocked)," blocked"]})]})})]}),P.agents.length===0?null:l.jsxs("section",{className:"progress-report-page__agents","aria-labelledby":"progress-agents-title",children:[l.jsxs("div",{className:"progress-report-page__section-heading",children:[l.jsx(zo,{children:l.jsx("span",{id:"progress-agents-title",children:"Agents"})}),l.jsxs("span",{children:[String(P.workingAgentCount)," working"]})]}),P.agents.map((U,Q)=>l.jsx(JE,{agent:U,pressed:z.agentFilter===U.name,toggle:()=>R(he=>({...he,agentFilter:he.agentFilter===U.name?null:U.name}))},`${U.name}-${String(Q)}`))]}),l.jsxs("section",{className:"progress-report-page__main",children:[l.jsx("div",{className:"progress-report-page__blocker-slot","data-progress-blockers":!0,children:de.length===0?null:l.jsx(tT,{blockers:de})}),l.jsxs("div",{className:"progress-report-page__left",children:[ve.length===0?null:l.jsxs("section",{"aria-labelledby":"progress-tasks-title",children:[l.jsxs("div",{className:"progress-report-page__section-heading",children:[l.jsx(zo,{children:l.jsx("span",{id:"progress-tasks-title",children:"Tasks"})}),P.taskFilterLabel===null?l.jsxs("span",{children:[String(P.progress.done)," done · ",String(P.progress.active)," active · ",String(P.progress.blocked)," blocked"]}):l.jsxs("span",{children:[P.taskFilterLabel," · ",l.jsx("button",{className:"progress-report-page__text-control",onClick:ee,type:"button",children:"[ clear ]"})]})]}),P.tasks.map((U,Q)=>l.jsx(WE,{flash:Z?.taskIds.has(U.id)===!0?Z.generation:null,highlighted:B===U.id,task:U},`${U.id}-${String(Q)}`)),P.tasks.length===0?l.jsxs("div",{className:"progress-report-page__empty-filter",children:["no tasks match the current filter · ",l.jsx("button",{className:"progress-report-page__text-control",onClick:ee,type:"button",children:"[ clear ]"})]}):null]}),(t.log??[]).length===0?null:l.jsxs("section",{"aria-labelledby":"progress-log-title",children:[l.jsxs("div",{className:"progress-report-page__section-heading",children:[l.jsx(zo,{children:l.jsx("span",{id:"progress-log-title",children:"Activity log"})}),l.jsxs("span",{children:["newest first · showing ",P.logs.length<P.logTotal?`${String(P.logs.length)} of ${String(P.logTotal)}`:String(P.logTotal),z.agentFilter===null?"":` · ${z.agentFilter}`,(t.log??[]).some(U=>U.kind==="warn"||U.kind==="error")?l.jsxs(l.Fragment,{children:[" · ",l.jsx("button",{"aria-pressed":z.issuesOnly,className:"progress-report-page__text-control",onClick:()=>R(U=>({...U,issuesOnly:!U.issuesOnly})),type:"button",children:z.issuesOnly?"[ show all ]":"[ issues only ]"})]}):null]})]}),P.logs.map((U,Q)=>l.jsx(eT,{entry:U,flash:Z?.logKeys.has(Pp(U))===!0?Z.generation:null},`${U.t}-${String(Q)}`)),P.logs.length===0?l.jsx("div",{className:"progress-report-page__empty-filter",children:"no entries match the current filter"}):null]})]}),l.jsxs("aside",{className:"progress-report-page__rail",children:[j===void 0?null:l.jsxs(ii,{label:"TESTS",children:[l.jsxs("div",{className:"progress-report-page__test-counts",children:[l.jsxs("span",{children:[l.jsx("strong",{children:String(j.passed)}),l.jsx("small",{children:"passed"})]}),l.jsxs("span",{children:[l.jsx("strong",{"data-failed":j.failed>0||void 0,children:String(j.failed)}),l.jsx("small",{children:"failed"})]}),l.jsxs("span",{children:[l.jsx("strong",{children:String(j.skipped)}),l.jsx("small",{children:"skipped"})]})]}),j.passed+j.failed+j.skipped===0?null:l.jsxs("svg",{"aria-hidden":"true",className:"progress-report-page__bar",preserveAspectRatio:"none",viewBox:"0 0 100 4",children:[l.jsx("rect",{className:"progress-report-page__bar-track",height:"4",width:"100"}),l.jsx("rect",{className:"progress-report-page__bar-pass",height:"4",width:j.passed/(j.passed+j.failed+j.skipped)*100}),l.jsx("rect",{className:"progress-report-page__bar-fail",height:"4",width:j.failed/(j.passed+j.failed+j.skipped)*100,x:j.passed/(j.passed+j.failed+j.skipped)*100})]}),j.failing.length===0?null:l.jsx("div",{className:"progress-report-page__failing",children:j.failing.map((U,Q)=>l.jsxs("span",{children:[l.jsx("span",{"aria-hidden":"true",children:"✕ "}),l.jsx("span",{children:U})]},`${U}-${String(Q)}`))}),l.jsx("span",{className:"progress-report-page__caption",children:j.passed+j.failed+j.skipped===0?"no results recorded yet":`${String(j.passed)} of ${String(j.passed+j.failed)} passing · last run ${P.testsLastRunLabel??"—"}`})]}),L.length===0?null:l.jsx(aT,{expanded:z.filesExpanded,files:P.files,label:P.filesToggleLabel,onToggle:()=>R(U=>({...U,filesExpanded:!U.filesExpanded})),totalCount:L.length,totals:P.fileTotals}),P.decisions.length===0?null:l.jsx(ii,{label:"DECISIONS",children:l.jsx("div",{className:"progress-report-page__decisions",children:P.decisions.map((U,Q)=>l.jsxs("div",{children:[l.jsx("span",{children:U.msg}),l.jsxs("span",{children:[U.by," · ",U.relativeLabel]})]},`${U.by}-${String(Q)}`))})}),p.length===0?null:l.jsx(ii,{label:"PARTIALLY OMITTED",children:l.jsxs("p",{className:"progress-report-page__omitted",children:["The server omitted these sections: ",p.join(", "),"."]})})]})]})]}),l.jsxs("footer",{className:"progress-report-page__footer",children:[l.jsx("span",{}),l.jsxs("div",{children:[l.jsx("span",{children:"native projection · poll every 3s · times utc"}),l.jsx("span",{children:"[ authenticated · strict csp ]"})]})]})]}),l.jsxs("p",{className:"progress-report-page__live-chip","data-degraded":me||void 0,title:_e.terminal?`${_e.label} — reconnect from the dashboard`:void 0,children:[l.jsx("span",{}),be]})]})}const p0=`Invoke your run-workflow skill via the clinkx mcp server with the following inputs.
|
|
28
|
-
|
|
29
|
-
Only <user_request> is required. The skill infers the council from intent, derives
|
|
30
|
-
the context anchors itself, and launches async or sync with a full-mode
|
|
31
|
-
context_builder preflight (curator + finalizer, failure_policy:fail). An async run
|
|
32
|
-
is polled to completion; a sync run returns inline. Either way it reports the
|
|
33
|
-
chairman's synthesis. Add any optional tag below only to override a default;
|
|
34
|
-
delete the tags you don't use.
|
|
35
|
-
|
|
36
|
-
Per-seat model and effort are structured, never read out of prose. The
|
|
37
|
-
deterministic path is <members_json> for council seats, the scalar curator and
|
|
38
|
-
finalizer tags (<curator_role>, <curator_model>, <curator_effort>,
|
|
39
|
-
<finalizer_role>, <finalizer_model>, <finalizer_effort>) for the preflight
|
|
40
|
-
seats, and <roster> for a named preset. Every model value is REQUESTED: omit a
|
|
41
|
-
tag or JSON field and the adapter's own default applies. The skill echoes the
|
|
42
|
-
resolved roster before launch; the engine returns resolved_roster after
|
|
43
|
-
admission. Effort vocabularies are adapter-specific; low, medium and high work
|
|
44
|
-
everywhere. An undeclared value is rejected up front, before anything runs,
|
|
45
|
-
with the allowed values named in the error.
|
|
46
|
-
|
|
47
|
-
Which repo gets scanned is <roots>. Set it and the skill scans exactly that
|
|
48
|
-
tree. Leave it empty and the skill falls back to a path named in your prose, and
|
|
49
|
-
failing that to the server's own working directory — which is whatever repo the
|
|
50
|
-
session that started the server happened to be in, so it may not be yours. The
|
|
51
|
-
skill always prints the roots it resolved in its pre-launch echo; check that line.
|
|
52
|
-
|
|
53
|
-
There is no tag for the anchors themselves; the skill derives them from <user_request>. A request naming nothing concrete may get one clarifying question before launch.`;function sT(t){const a=[];for(const i of t.split(/\n{2,}/)){const r=i.replace(/[ \t]*\n[ \t]*/g," ").replace(/ {2,}/g," ").trim();r.length>0&&a.push(r)}return a}const lT=["workflow","sync_mode","members_json","chairman","chairman_model","chairman_effort","curator","curator_model","curator_effort","finalizer","finalizer_model","finalizer_effort","user_request"],h0="Is the retry/backoff logic in src/pipeline.ts correct for transient child failures? Look at classifyFailureClass and the ExecutionError path, and say whether a permanent panic class can be reclassified transient.";function iT(t,a){return`${t}
|
|
54
|
-
|
|
55
|
-
---
|
|
56
|
-
|
|
57
|
-
${a}
|
|
58
|
-
`}const Wh=/^[^\s\0-][^\s\0]*$/,em=/^[a-z0-9][a-z0-9_-]*$/,Tr=128,ad=32,sd=200,$u=10,rT={codex:["none","minimal","low","medium","high","xhigh","max"],claude:["low","medium","high","xhigh","max"],glm:["low","medium","high","xhigh","max"],grok:["low","medium","high","xhigh"],agy:["low","medium","high"]},tm={codex:["gpt-5.5","gpt-5-codex"],claude:["claude-fable-5-1"],glm:["glm-5.3[1m]","glm-4.7"],grok:[],agy:[]},nm=["security reviewer: attack surface, trust boundaries, secrets handling","correctness reviewer: edge cases, error paths, invariants, retries","performance reviewer: hot paths, allocations, I/O and concurrency costs","maintainability reviewer: naming, module boundaries, coupling, test coverage","operator's view: production failure modes, observability, rollback"],am=[{name:"retry-backoff-review",text:h0},{name:"retry-ledger-migration",text:"Review the retry-ledger migration: are attemptsConsumed and max_retries reconciled the same way in src/pipeline.ts and the ledger reader, and does a run resumed after a crash double-count attempts? Name every call site that writes the ledger."},{name:"symlink-containment-audit",text:"Audit contained-file symlink handling across packages: does every read of a curated path resolve links (O_NOFOLLOW or an lstat check) before the containment test, and can a link created between selection and read escape the root? Start from the context_builder curator's read path."}];function oT(t){return t.filter(a=>a.name.startsWith("council-")).flatMap(a=>{const i=a.stages??[],r=i[0],c=i[3];if(r===void 0||c===void 0)return[];const f=r.calls.map(h=>h.cliName??"").filter(h=>h!==""),p=c.calls[0]?.cliName??"";return f.length===0||p===""?[]:[{name:a.name,description:a.description.replace(/\s*\(1-10 members\)/,"").replace(/\.\s*$/,""),seats:f,chairCli:p}]})}function cT(t){return t.filter(a=>a.workflowEligible===!0).map(a=>a.name)}function uT(t){const a=new Map(t.map(i=>[i.name,i]));return i=>{const r=a.get(i);return r?.capabilities!==void 0?r.capabilities.effortAllowedValues:rT[i]??[]}}const dT=["codex","codex","claude"];function Nd(t){return(t?.seats??dT).map(a=>({cli:a,model:"",effort:"",stance:""}))}function m0(){return{workflow:"",seats:Nd(null),chair:{cli:"",model:"",effort:""},curator:{cli:"",model:"",effort:""},finalizer:{cli:"",model:"",effort:""},sync:"",request:"",preset:"",advOpen:!0}}function br(t){return t?.chairCli??"codex"}function fT(t,a){const i=Nd(a);return t.length===i.length&&t.every((r,c)=>r.cli===i[c]?.cli)}function Jp(t){const a=t??{};return{cli:typeof a.cli=="string"?a.cli:"",model:typeof a.model=="string"?a.model:"",effort:typeof a.effort=="string"?a.effort:""}}function pT(t){const a=t??{};return{cli:typeof a.cli=="string"?a.cli:"",model:typeof a.model=="string"?a.model:"",effort:typeof a.effort=="string"?a.effort:"",stance:typeof a.stance=="string"?a.stance:""}}function ty(t,a){if(t==null||typeof t!="object")return m0();const i=t,r=typeof i.workflow=="string"?i.workflow:"";return{workflow:r,seats:Array.isArray(i.seats)&&i.seats.length>0?i.seats.map(pT):Nd(a(r)),chair:Jp(i.chair),curator:Jp(i.curator),finalizer:Jp(i.finalizer),sync:i.sync==="sync"?"sync":"",request:typeof i.request=="string"?i.request:"",preset:typeof i.preset=="string"?i.preset:"",advOpen:i.advOpen==null?!0:i.advOpen!==!1}}function hT(t){return`[
|
|
59
|
-
${t.map(a=>{const i={cli_name:a.cli},r=a.stance.trim();return r!==""&&(i.stance=r.replace(/\s+/g," ")),a.model!==""&&(i.model=a.model.trim()),a.effort!==""&&(i.effort=a.effort),` ${JSON.stringify(i).replace(/","/g,'", "').replace(/":"/g,'": "')}`}).join(`,
|
|
60
|
-
`)}
|
|
61
|
-
]`}function mT(t){return t==="workflow"||t==="user_request"?"required":/_(model|effort)$/.test(t)?"adapter default":""}function Wp(t,a,i){const r=[],c=(k,z,R,B)=>{r.push({field:k,sub:z,kind:"missing",short:R,message:B})},f=(k,z,R)=>{r.push({field:k,sub:z,kind:"invalid",message:R})},p=(k,z,R)=>{k.model===""&&c(z,"model",`${R} model`,`${R} needs a model id`),k.effort===""&&c(z,"effort",`${R} effort`,`${R} needs an effort`)},h=(k,z,R)=>{k!==""&&(k.length>Tr||!Wh.test(k))&&f(z,"model",`${R} model id: no whitespace, no leading “-”, at most ${Tr} characters`)},v=(k,z,R,B)=>{if(k==="")return;if(k.length>ad||!em.test(k)){f(R,"effort",`${B} effort has an invalid format (lowercase, digits, _ -)`);return}const q=i(z);q.length>0&&!q.includes(k)&&f(R,"effort",`${B}: ${z} has no effort “${k}” — allowed: ${q.join(" · ")}`)},m=new Map,x=(k,z)=>{z!==""&&m.set(k,z)};t.workflow!==""?x("workflow",t.workflow):c("workflow","","workflow","pick a workflow"),t.sync==="sync"&&x("sync_mode","sync"),t.seats.length===0&&c("seats","","a seat","add at least one seat"),t.seats.length>$u&&f("seats","","a council has at most 10 seats"),t.seats.forEach((k,z)=>{const R=`seat:${z}`,B=`seat ${z+1}`;k.cli===""&&c(R,"cli",`${B} cli`,`${B} needs a cli_name`),h(k.model,R,B),v(k.effort,k.cli,R,B),p(k,R,B);const q=k.stance.trim().replace(/\s+/g," ");z>=3&&q===""?c(R,"stance",`${B} stance`,`${B} needs a stance (required from seat 4)`):q.includes("{{")||q.includes("}}")?f(R,"stance",`${B} stance must not contain {{ or }}`):q.length>sd&&f(R,"stance",`${B} stance: at most ${sd} characters`)}),t.seats.length>0&&x("members_json",hT(t.seats));const y=t.chair.cli||br(a);x("chairman",t.chair.cli),x("chairman_model",t.chair.model),x("chairman_effort",t.chair.effort),h(t.chair.model,"chair","chairman"),v(t.chair.effort,y,"chair","chairman"),p(t.chair,"chair","chairman");for(const k of["curator","finalizer"]){const z=t[k];x(k,z.cli),x(`${k}_model`,z.model),x(`${k}_effort`,z.effort),h(z.model,k,k),v(z.effort,z.cli||"codex",k,k),p(z,k,k)}const E=t.request.trim();E===""&&c("request","","request","the request is empty — <user_request> is the one required tag"),x("user_request",E);const S=new Map([["sync_mode","async"],["chairman",br(a)],["curator","codex"],["finalizer","codex"]]),C=lT.map(k=>{const z=m.get(k)??"",R=z!=="",B=S.get(k)??"";return{tag:k,value:R?z:B,isSet:R,isDefault:!R&&B!=="",ghost:!R&&B==="",why:mT(k)}}),T=C.filter(k=>k.value!==""),N=C.filter(k=>k.value===""&&/_(model|effort)$/.test(k.tag)),M=T.map(k=>`<${k.tag}>
|
|
62
|
-
${k.value}
|
|
63
|
-
</${k.tag}>`).join(`
|
|
64
|
-
|
|
65
|
-
`);return{every:C,written:T,omitted:N,issues:r,text:iT(p0,M)}}function gT(t){return t==="workflow"?0:t==="curator"||t==="finalizer"?1:t.startsWith("seat")||t==="chair"||t==="seats"?2:3}function ny(t){return t==="workflow"?"workflow":t==="sync_mode"?"sync":t==="members_json"?"seats":t.startsWith("chairman")?"chair":t.startsWith("curator")?"curator":t.startsWith("finalizer")?"finalizer":t==="user_request"?"request":""}const g0=`## Task
|
|
66
|
-
|
|
67
|
-
Use the \`chief-of-staff\` skill to execute the request below.
|
|
68
|
-
|
|
69
|
-
## Invocation Policy
|
|
70
|
-
|
|
71
|
-
- Run in supervised mode. First perform a bounded, read-only readiness preflight. Resolve questions from repository evidence, available OpenViking context, and discovery before asking me anything.
|
|
72
|
-
- Report READY or BLOCKED, including consequential unresolved decisions, proposed execution routes, and integration target. Then ask for my explicit go-ahead before implementation, durable-task or automation creation, or task curation.
|
|
73
|
-
- After approval, create durable isolated-worktree implementation tasks. Select model and effort according to the skill's capability-aware routing; report the selected profiles and any necessary fallback.
|
|
74
|
-
- Prefer compatible ClinkX routes for bounded scouts, advice, and independent verification, honoring the tier XML. Do not silently substitute XML-selected adapters.
|
|
75
|
-
- Maintain up to three non-overlapping writers when safe and useful, accounting for live capacity and verification needs. Never manufacture work merely to fill capacity.
|
|
76
|
-
- Use manager and worker goals when goal tools are exposed.
|
|
77
|
-
- After approval, create or update a matching portfolio heartbeat when scheduling is exposed. Monitor workers through accepted integration and completion, or until a genuine blocker requires me. Notify only on meaningful changes or required action.
|
|
78
|
-
- Publish and maintain a progress report via ClinkX.
|
|
79
|
-
- Prioritize independent source implementation over qualification-only gates. Preserve schema, safety, authorization, and runtime prerequisites. Prefer running-app QA when available and authorized.
|
|
80
|
-
- If \`.ai/\` inputs are ignored, copy only the relevant non-secret inputs into isolated worker worktrees.
|
|
81
|
-
- Do not stage, commit, push, merge, rebase, reset, stash, clean, or rewrite Git state without my explicit authorization for that action.`,_T="## ClinkX Profiles",vT="## Request",wr="tier_1_agents_json",jr="tier_2_agents_json",Vo="user_request";function bT(t,a,i){const r=[g0];return(t!==null||a!==null)&&(r.push(`
|
|
82
|
-
|
|
83
|
-
`,_T),t!==null&&r.push(`
|
|
84
|
-
|
|
85
|
-
`,`<${wr}>
|
|
86
|
-
`,t,`
|
|
87
|
-
</${wr}>`),a!==null&&r.push(`
|
|
88
|
-
|
|
89
|
-
`,`<${jr}>
|
|
90
|
-
`,a,`
|
|
91
|
-
</${jr}>`)),r.push(`
|
|
92
|
-
|
|
93
|
-
`,vT,`
|
|
94
|
-
|
|
95
|
-
`,`<${Vo}>
|
|
96
|
-
`,i,`
|
|
97
|
-
</${Vo}>
|
|
98
|
-
`),r.join("")}function yT(t){const a="## Task",i="## Invocation Policy",r=t.slice(t.indexOf(a)+a.length,t.indexOf(i)).trim(),c=t.slice(t.indexOf(i)+i.length).split(`
|
|
99
|
-
`).map(f=>f.trim()).filter(f=>f.startsWith("- ")).map(f=>f.slice(2));return{task:r,bullets:c}}const ld={tier1:[{cli:"codex",model:"gpt-5.6-luna",effort:"max"},{cli:"codex",model:"gpt-5.6-sol",effort:"medium"}],tier2:[{cli:"glm",model:"glm-5.3[1m]",effort:"max"},{cli:"agy",model:"gemini-3.8-flash",effort:"high"}]},ay=64;function _0(){return{tier1:ld.tier1.map(t=>({...t})),tier2:ld.tier2.map(t=>({...t})),request:"",preset:""}}function xT(t){const a=t??{};return{cli:typeof a.cli=="string"?a.cli:"",model:typeof a.model=="string"?a.model:"",effort:typeof a.effort=="string"?a.effort:""}}function sy(t,a){return t===null?null:Array.isArray(t)?t.map(xT):a.map(i=>({...i}))}function ly(t){if(t==null||typeof t!="object")return _0();const a=t;return{tier1:sy(a.tier1,ld.tier1),tier2:sy(a.tier2,ld.tier2),request:typeof a.request=="string"?a.request:"",preset:typeof a.preset=="string"?a.preset:""}}function eh(t){return t.length===0?"[]":`[
|
|
100
|
-
${t.map(a=>{const i={cli_name:a.cli};return a.model!==""&&(i.model=a.model.trim()),a.effort!==""&&(i.effort=a.effort),` ${JSON.stringify(i).replace(/","/g,'", "').replace(/":"/g,'": "')}`}).join(`,
|
|
101
|
-
`)}
|
|
102
|
-
]`}function v0(t){return t.startsWith("-")||/\s/.test(t)||/[\x00-\x1f\x7f]/.test(t)||t.length>ay?`no whitespace, no leading “-”, no control characters, at most ${ay} characters`:""}function wT(t,a){const i=[],r=(m,x,y,E)=>{i.push({field:m,sub:x,kind:"missing",short:y,message:E})},c=(m,x,y)=>{i.push({field:m,sub:x,kind:"invalid",message:y})},f=(m,x,y)=>{i.push({field:m,sub:x,kind:"warning",message:y})},p=(m,x,y,E)=>{(m.includes("{{")||m.includes("}}")||m.includes("Example:")||/^YOUR_[A-Z0-9_]+$/.test(m))&&c(x,y,`${E} ${y}: unfilled placeholder from the template Example — replace it`)},h=[];["tier1","tier2"].forEach((m,x)=>{const y=x+1,E=t[m];E!==null&&(h.push({tag:y===1?wr:jr,value:eh(E)}),E.forEach((S,C)=>{const T=`tier${y}:${C}`,N=`tier ${y} profile ${C+1}`;if(S.cli==="")r(T,"cli",`t${y}·${C+1} cli`,`${N} needs a cli_name`);else{const M=v0(S.cli);M!==""&&c(T,"cli",`${N} cli_name: ${M}`),p(S.cli,T,"cli",N)}if(S.model!==""&&(p(S.model,T,"model",N),(S.model.length>Tr||!Wh.test(S.model))&&c(T,"model",`${N} model id: no whitespace, no leading “-”, at most ${Tr} characters`)),S.effort!=="")if(p(S.effort,T,"effort",N),S.effort.length>ad||!em.test(S.effort))c(T,"effort",`${N} effort has an invalid format (lowercase, digits, _ -)`);else{const M=a(S.cli);M.length>0&&!M.includes(S.effort)&&f(T,"effort",`${N}: ${S.cli} does not declare effort “${S.effort}” — passed through verbatim; admission decides`)}}))});const v=t.request.trim();return v===""&&r("request","","request","the request is empty — the user request is the one required fill point"),h.push({tag:Vo,value:v}),{issues:i,text:bT(t.tier1===null?null:eh(t.tier1),t.tier2===null?null:eh(t.tier2),v),written:h}}function jT(t){return t==="request"?1:0}const ST="/api/prompt-builder/library",NT="/api/prompt-builder/library/save",Oh="prompt-builder-library-v1",kT="prompt-builder-library-response-v1";function Mu(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function AT(t){if(!Mu(t)||t.schemaVersion!==Oh||typeof t.updatedAt!="string"||!Mu(t.models)||!Array.isArray(t.requests)||!Array.isArray(t.stances))return null;const a={};for(const[r,c]of Object.entries(t.models)){if(!Array.isArray(c)||!c.every(f=>typeof f=="string"))return null;a[r]=c}const i=[];for(const r of t.requests){if(!Mu(r)||typeof r.name!="string"||typeof r.text!="string")return null;i.push({name:r.name,text:r.text})}return t.stances.every(r=>typeof r=="string")?{schemaVersion:Oh,updatedAt:t.updatedAt,models:a,requests:i,stances:t.stances}:null}function RT(t){if(!Mu(t)||t.schemaVersion!==kT)return null;if(t.state==="absent"||t.state==="unreadable")return{state:t.state};if(t.state==="present"){const a=AT(t.library);return a===null?null:{state:"present",library:a}}return null}async function ET(t){const a=await hs(ST,t===void 0?void 0:{signal:t});if(!a.ok)throw new Error(`prompt-builder library GET failed: ${String(a.status)}`);const i=RT(await na(a));if(i===null)throw new Error("prompt-builder library GET response was invalid");return i}async function TT(t){const a=await fx(NT,t);if(a.status!==204&&!a.ok)throw new Error(`prompt-builder library save failed: ${String(a.status)}`)}const b0="clinkx-pb-form",y0="clinkx-pb-cos-form",x0="clinkx-pb-history",sm="clinkx-pb-models",lm="clinkx-pb-requests",im="clinkx-pb-stances",rm="clinkx-pb-library-dirty",w0="clinkx-pb-active-target",j0=12,CT=110,iy=32,ry=64,oy=64,cy=64,uy=40,Ro=16e3;function si(t,a){try{const i=(t??window.localStorage).getItem(a);return i===null?null:JSON.parse(i)}catch{return null}}function ui(t,a,i){try{(t??window.localStorage).setItem(a,JSON.stringify(i))}catch{}}function th(t,a){ui(t,sm,a.models),ui(t,lm,a.requests),ui(t,im,a.stances)}function dy(t){try{return(t??window.localStorage).getItem(rm)==="1"}catch{return!1}}function fy(t){try{(t??window.localStorage).setItem(rm,"1")}catch{}}function OT(t){try{(t??window.localStorage).removeItem(rm)}catch{}}function $T(t){return si(t,w0)==="chief-of-staff"?"chief-of-staff":"workflow"}function MT(t,a){ui(t,w0,a)}function LT(t){return Array.isArray(t)?t.flatMap(a=>{if(a==null||typeof a!="object")return[];const i=a;return typeof i.at!="number"||typeof i.form!="object"?[]:[{at:i.at,workflow:typeof i.workflow=="string"?i.workflow:"",council:typeof i.council=="string"?i.council:"",head:typeof i.head=="string"?i.head:"",form:i.form,...i.target==="chief-of-staff"&&i.cosForm!=null&&typeof i.cosForm=="object"&&!Array.isArray(i.cosForm)?{target:"chief-of-staff",cosForm:i.cosForm}:{}}]}).slice(0,j0):[]}function S0(t){return Array.isArray(t)?t.flatMap(a=>{if(a==null||typeof a!="object")return[];const i=a;return typeof i.name!="string"||typeof i.text!="string"?[]:[{name:i.name,text:i.text}]}):null}function N0(t){if(t==null||typeof t!="object")return{};const a={};for(const[i,r]of Object.entries(t))Array.isArray(r)&&r.every(c=>typeof c=="string")&&(a[i]=r);return a}function k0(t){return Array.isArray(t)?t.filter(a=>typeof a=="string"):null}function IT(t){const a=S0(si(t,lm)),i=k0(si(t,im));return{form:si(t,b0),cosForm:si(t,y0),history:LT(si(t,x0)),models:{...tm,...N0(si(t,sm))},requests:a??am,stances:i??[...nm]}}function hr(t){return JSON.stringify(t)}function DT(t){return hr(t.models)===hr({...tm})&&hr(t.requests)===hr(am)&&hr(t.stances)===hr([...nm])}function zT(t){const a=typeof window>"u"?void 0:window.localStorage;if(a===void 0)return null;let i,r,c;try{i=a.getItem(sm),r=a.getItem(lm),c=a.getItem(im)}catch{return null}if(i===null&&r===null&&c===null)return null;const f=i===null?{}:N0(nh(i)),p=r===null?[]:S0(nh(r))??[],h=c===null?[]:k0(nh(c))??[],v={models:f,requests:p,stances:h};return DT({models:{...tm,...f},requests:r===null?am:p,stances:c===null?[...nm]:h})?null:v}function nh(t){try{return JSON.parse(t)}catch{return null}}function py(t){return t.trim().replace(/\s+/g," ").slice(0,CT)}let id=0,Eo=0,ah=!1,Lo=null,$h=null;function hy(){return id}function vu(){return id+=1,id}function my(t){$h=t}function sh(t,a){Lo={snapshot:t,gen:a},A0()}async function A0(){if(ah)return;ah=!0;const t=Eo;try{for(;Lo!==null;){const a=Lo;Lo=null;try{await TT({schemaVersion:Oh,models:a.snapshot.models,requests:a.snapshot.requests,stances:a.snapshot.stances}),a.gen===id&&(OT(),$h?.onSynced())}catch{$h?.onUnsynced()}}}finally{ah=!1,Lo!==null&&t===Eo&&A0()}}function R0({config:t,phone:a,addText:i,highlight:r,applyAllOn:c,onAddTextChange:f,onHighlight:p,onApplyAllToggle:h,onPick:v,onAdd:m,onRemove:x,onClose:y}){const E=b.useRef(null),S=b.useId();b.useEffect(()=>{E.current?.focus({preventScroll:!0})},[]);const C=t.addable===void 0?"":i.trim().toLowerCase(),T=t.noneLabel===void 0?t.options:[{value:"",label:t.noneLabel},...t.options],N=C===""?T:T.filter(q=>q.label.toLowerCase().includes(C)),M=N.findIndex(q=>q.value===t.current),k=N.length===0?0:r===null?Math.max(0,M):Math.min(r,N.length-1),z=q=>{N.length>0&&p((k+q+N.length)%N.length)},R=()=>{const q=i.trim();if(r!==null&&N[k]!==void 0){v(N[k].value);return}if(q==="")return;const Z=T.find(ae=>ae.value!==""&&ae.value.toLowerCase()===q.toLowerCase());if(Z!==void 0){v(Z.value);return}t.addable!==void 0&&t.addable.addError(q)===""&&m(q)},B=t.addable===void 0?"":t.addable.addError(i.trim());return l.jsxs("div",{"aria-activedescendant":N.length>0?`${S}-opt-${k}`:void 0,"aria-label":t.title,className:"pb-picker__options","data-phone":a?"true":void 0,onKeyDown:q=>{q.key==="ArrowDown"||q.key==="ArrowUp"?(q.preventDefault(),q.stopPropagation(),z(q.key==="ArrowDown"?1:-1)):q.key==="Enter"?(q.preventDefault(),q.stopPropagation(),N.length>0&&v(N[k].value)):q.key==="Escape"&&(q.preventDefault(),q.stopPropagation(),y())},ref:E,role:"listbox",tabIndex:-1,children:[N.map((q,Z)=>l.jsxs("div",{"aria-selected":q.value===t.current,className:`pb-picker__option${Z===k&&!a?" pb-picker__option--hi":""}${q.value===""?" pb-picker__option--none":""}`,id:`${S}-opt-${Z}`,onClick:()=>v(q.value),role:"option",children:[l.jsxs("span",{className:"pb-picker__option-text",children:[l.jsx("span",{className:"pb-picker__option-label",children:q.label}),q.desc!==void 0&&q.desc!==""?l.jsx("span",{className:"pb-picker__option-desc",children:q.desc}):null]}),q.value===t.current?l.jsx("span",{"aria-hidden":"true",className:"pb-picker__option-mark",children:"✓"}):null,q.removable===!0&&q.value!==""?l.jsx("button",{"aria-label":t.removeLabel??"remove from the curated list",className:"pb-picker__option-remove",onClick:ae=>{ae.stopPropagation(),x(q.value)},title:t.removeLabel??"remove from the curated list",type:"button",children:"×"}):null]},q.value===""?"—":q.value)),N.length===0?l.jsx("div",{className:"pb-picker__empty",children:C!==""?`nothing matches “${i.trim()}” — [ add ] saves it`:t.emptyText??"nothing to pick yet"}):null,t.applyAll!==void 0?l.jsxs("button",{"aria-checked":c,className:"pb-picker__apply",onClick:q=>{q.stopPropagation(),h()},role:"checkbox",type:"button",children:[l.jsx("span",{"aria-hidden":"true",className:"pb-picker__apply-box","data-on":c?"true":void 0,children:c?"✓":""}),t.applyAll.label]}):null,t.addable!==void 0?l.jsxs("div",{className:"pb-picker__add",children:[l.jsx("span",{"aria-hidden":"true",className:"pb-picker__add-plus",children:"+"}),l.jsx("input",{"aria-label":"new option",className:"pb-picker__add-input",onChange:q=>{f(q.target.value),p(null)},onKeyDown:q=>{q.stopPropagation(),q.key==="Enter"?(q.preventDefault(),R()):q.key==="ArrowDown"||q.key==="ArrowUp"?(q.preventDefault(),z(q.key==="ArrowDown"?1:-1)):q.key==="Escape"&&y()},placeholder:t.addable.placeholder,type:"text",value:i}),l.jsx("button",{className:"pb-picker__add-submit",onClick:q=>{q.stopPropagation(),R()},type:"button",children:"[ add ]"})]}):null,B!==""?l.jsx("div",{className:"pb-picker__add-err",role:"alert",children:B}):null]})}function qT(t){const{anchor:a,config:i,onClose:r}=t,c=b.useRef(null),f=p=>{c.current=p,!(p===null||a===null)&&(p.style.setProperty("--pb-pop-left",`${a.left}px`),p.style.setProperty("--pb-pop-top",`${a.top}px`),p.style.setProperty("--pb-pop-row-w",`${a.rowW}px`),p.style.setProperty("--pb-pop-w",`${Math.min(i.width,a.rowW)}px`))};return l.jsxs("div",{className:"pb-pop","data-pbpop":"1",onClick:p=>p.stopPropagation(),ref:f,children:[l.jsxs("div",{className:"pb-pop__head",children:[l.jsx("span",{className:"pb-pop__title",children:i.title}),l.jsx("span",{className:"pb-pop__sub",children:i.sub}),l.jsx("button",{"aria-label":"close",className:"pb-pop__close",onClick:r,type:"button",children:"×"})]}),l.jsx(R0,{...t})]})}function UT(t){const{config:a,onClose:i}=t,r=b.useId();return l.jsx(fd,{applicationRootId:"root",labelledBy:r,onClose:i,open:!0,panelClassName:"accessible-dialog--sheet pb-sheet",children:l.jsxs("div",{className:"pb-sheet__inner",children:[l.jsx("button",{"aria-label":"close",className:"pb-sheet__handle",onClick:i,type:"button",children:l.jsx("span",{"aria-hidden":"true",className:"pb-sheet__handle-pill"})}),l.jsxs("div",{className:"pb-sheet__head",children:[l.jsx("span",{className:"pb-sheet__title",id:r,children:a.title}),l.jsx("span",{className:"pb-sheet__sub",children:a.sub})]}),l.jsx(R0,{...t})]})})}function gy(t){return t.phone?l.jsx(UT,{...t}):l.jsx(qT,{...t})}const BT=["Workflow","Context preflight","Council","Request"],GT=["workflow","preflight","council","request"],HT=["Profiles","Request"],VT=["profiles","request"],KT=[{keys:["curator_role"],value:"json"},{keys:["finalizer_role"],value:"json-codereviewer"},{keys:["roots"],value:"derived from the request by the skill — check the pre-launch echo"}];function _y(t,a){const i=new Date(t),r=`${String(i.getHours()).padStart(2,"0")}:${String(i.getMinutes()).padStart(2,"0")}`,c=new Date(a);return i.toDateString()===c.toDateString()?r:`${i.getMonth()+1}/${i.getDate()} ${r}`}function ZT(){if(typeof window<"u")try{if(new URLSearchParams(window.location.search).get("mode")==="chief-of-staff")return"chief-of-staff"}catch{}return $T()}function FT(t){return t===null?"unspecified — tag omitted":t.length===0?"empty pool — writes []":`${t.length} profile${t.length===1?"":"s"}`}function YT({workflows:t,adapters:a}){const i=Kx(),c=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.userAgent)?"⌘":"ctrl+",[f]=b.useState(()=>IT()),[p]=b.useState(()=>zT()),[h,v]=b.useState(()=>ty(f.form,()=>null)),[m,x]=b.useState(f.history),[y,E]=b.useState(()=>p?.models??f.models),[S,C]=b.useState(()=>p?.requests??f.requests),[T,N]=b.useState(()=>p?.stances??f.stances),[M,k]=b.useState(()=>ly(f.cosForm)),[z,R]=b.useState(ZT);b.useEffect(()=>{ui(void 0,b0,h)},[h]),b.useEffect(()=>{ui(void 0,x0,m)},[m]),b.useEffect(()=>{ui(void 0,y0,M)},[M]);const[B,q]=b.useState("loading"),[Z,ae]=b.useState(0),oe=b.useRef({models:p?.models??f.models,requests:p?.requests??f.requests,stances:p?.stances??f.stances}),P=b.useRef(null),ue=b.useRef(!0);oe.current={models:y,requests:S,stances:T};const _e=b.useCallback(g=>{oe.current=g,E(g.models),C(g.requests),N(g.stances)},[]),me=b.useCallback((g,A)=>{P.current=null,sh(g,A)},[]),be=b.useCallback(g=>{const A=oe.current,H=g(A);if(H===A)return;_e(H),th(void 0,H),fy(),q("unsynced");const W=vu();P.current={gen:W,snapshot:H},ae(W)},[_e]);b.useEffect(()=>(ue.current=!0,my({onSynced:()=>{ue.current&&q("synced")},onUnsynced:()=>{ue.current&&q("unsynced")}}),()=>{ue.current=!1,my(null)}),[]),b.useEffect(()=>{const g=new AbortController,A=p;return(async()=>{const H=hy();try{const W=await ET(g.signal);if(g.signal.aborted)return;if(dy()){q("unsynced");const te=P.current;P.current=null;const $e=te?.snapshot??oe.current,Ue=te?.gen??vu();me($e,Ue);return}if(hy()!==H)return;if(W.state==="present"){const te={models:W.library.models,requests:W.library.requests,stances:[...W.library.stances]};_e(te),th(void 0,te),q("synced");return}if(W.state==="absent"){if(A!==null){_e(A),th(void 0,A),fy(),q("unsynced"),me(A,vu());return}q("local");return}q("unsynced")}catch{if(g.signal.aborted)return;if(dy()){q("unsynced");const W=P.current;P.current=null,me(W?.snapshot??oe.current,W?.gen??vu());return}q("unsynced")}})(),()=>g.abort()},[_e,p,me]),b.useEffect(()=>{if(Z===0)return;const g=window.setTimeout(()=>{const A=P.current;A!==null&&(P.current=null,sh(A.snapshot,A.gen))},400);return()=>window.clearTimeout(g)},[Z]),b.useEffect(()=>()=>{const g=P.current;g!==null&&(P.current=null,sh(g.snapshot,g.gen))},[]);const[ve,$]=b.useState(null),[ee,ce]=b.useState(null),[de,ye]=b.useState(""),[j,L]=b.useState(!1),[U,Q]=b.useState(null),[he,F]=b.useState(!1),[ge,Ve]=b.useState(0),[Se,Re]=b.useState(!1),[Pe,Gt]=b.useState(!1),[Vt,kt]=b.useState(!1),[Xt,$t]=b.useState(null),[Pt,Qt]=b.useState({}),[Kt,sn]=b.useState(null),[Mn,ln]=b.useState(!1),[Jt,lt]=b.useState(""),[Be,le]=b.useState(null),[Ae,Le]=b.useState(0),qe=b.useRef(null),it=b.useRef(null),Et=b.useRef(null),ut=b.useRef(null),Qe=b.useRef(null),dt=b.useRef(null),wt=b.useRef(null),Tt=b.useRef(null),pn=b.useMemo(()=>oT(t.rows),[t.rows]),kn=b.useCallback(g=>pn.find(A=>A.name===g)??null,[pn]),hn=kn(h.workflow),Wt=b.useMemo(()=>cT(a.rows),[a.rows]),ht=b.useMemo(()=>uT(a.rows),[a.rows]),en=b.useMemo(()=>Wp(h,hn,ht),[h,hn,ht]),At=en.issues,Ln=At.filter(g=>g.kind==="missing"),Dt=At.filter(g=>g.kind!=="missing"),rt=(g,A)=>Dt.filter(H=>H.field===g&&(A===void 0||H.sub===A)).map(H=>H.message).join(" · "),zt=(g,A)=>Ln.some(H=>H.field===g&&(A===void 0||H.sub===A)),Gn=b.useMemo(()=>wT(M,ht),[M,ht]),sa=b.useMemo(()=>yT(g0),[]),Fn=new Map(Gn.written.map(g=>[g.tag,g.value])),Ia=Gn.issues.filter(g=>g.kind==="invalid"),Da=Gn.issues.filter(g=>g.kind==="warning"),za=(g,A)=>Ia.filter(H=>H.field===g&&(A===void 0||H.sub===A)).map(H=>H.message).join(" · "),Pa=g=>Da.filter(A=>A.field===g).map(A=>A.message).join(" · "),la=M.request.trim(),I=`tier1 ${M.tier1===null?"—":String(M.tier1.length)} · tier2 ${M.tier2===null?"—":String(M.tier2.length)}`,xe=[];["tier1","tier2"].forEach((g,A)=>{M[g]?.forEach((W,fe)=>{const te=[...W.model===""?["model"]:[],...W.effort===""?["effort"]:[]];te.length>0&&xe.push(`t${A+1}:${fe+1} ${te.join(" + ")}`)})});const je=[...M.tier1===null?[{keys:[wr],value:"omitted (unspecified); the skill inspects exposed tools"}]:[],...M.tier2===null?[{keys:[jr],value:"omitted (unspecified); the skill inspects exposed tools"}]:[],...xe.length===0?[]:[{keys:["model","effort"],value:`adapter default applies — empty on ${xe.join(" · ")}`}]],ke=z==="workflow"?en:Gn,Oe=z==="workflow"?At:Gn.issues.filter(g=>g.kind!=="warning"),Fe=Oe.filter(g=>g.kind!=="missing"),Je=Oe.filter(g=>g.kind==="missing"),Ct=z==="workflow"?BT:HT,vn=z==="workflow"?GT:VT,Ye=z==="workflow"?g=>gT(g):g=>jT(g),qt=z==="workflow"?4:2,An=b.useRef(h),mn=b.useCallback(g=>{An.current=g,v(g)},[]),Ot=b.useCallback(g=>{const A=An.current,H=g(A),W=Wp(A,kn(A.workflow),ht),fe=Wp(H,kn(H.workflow),ht),te=Date.now();Qt($e=>{const Ue={...$e};for(const et of fe.every){if(et.tag==="user_request")continue;const Ss=W.every.find(Ii=>Ii.tag===et.tag);(Ss===void 0||Ss.value!==et.value||Ss.isSet!==et.isSet)&&(Ue[et.tag]=te)}return Ue}),Re(!1),mn(H)},[mn,kn,ht]),rn=b.useCallback(g=>{k(A=>g(A)),Re(!1)},[]),bn=b.useCallback(()=>({form:h,cosForm:M,target:z,history:m,models:y,requests:S,stances:T}),[h,M,z,m,y,S,T]),ft=b.useCallback((g,A)=>{wt.current!==null&&window.clearTimeout(wt.current),dt.current=A,sn({key:Date.now(),message:g,undoable:A!==null}),wt.current=window.setTimeout(()=>sn(null),A===null?3400:7e3)},[]);b.useEffect(()=>()=>{wt.current!==null&&window.clearTimeout(wt.current),Tt.current!==null&&window.clearTimeout(Tt.current)},[]);const gs=()=>{const g=dt.current;if(g===null)return;wt.current!==null&&window.clearTimeout(wt.current),dt.current=null,Qa(g.target),mn(g.form),k(g.cosForm),x(g.history),JSON.stringify({models:oe.current.models,requests:oe.current.requests,stances:oe.current.stances})!==JSON.stringify({models:g.models,requests:g.requests,stances:g.stances})?be(()=>({models:g.models,requests:g.requests,stances:g.stances})):_e({models:g.models,requests:g.requests,stances:g.stances}),sn(null),$(null),Re(!1)},Qa=b.useCallback(g=>{R(g),MT(void 0,g);try{const A=new URLSearchParams(window.location.search);A.delete("mode"),g==="chief-of-staff"&&A.set("mode","chief-of-staff");const H=A.toString();window.history.replaceState(null,"",`${window.location.pathname}${H===""?"":`?${H}`}${window.location.hash}`)}catch{}},[]),ia=b.useCallback(g=>{if(g===z)return;Qa(g),$(null),ce(null),Re(!1),kt(!1);const A=g==="chief-of-staff"?"chief of staff mode":"run-workflow mode";le({key:`target-${g}-${Date.now()}`,message:A})},[Qa,z]),yn=b.useCallback(()=>{const g=qe.current;if(qe.current=null,$(null),ye(""),Q(null),g instanceof HTMLElement&&document.body.contains(g))try{g.focus({preventScroll:!0})}catch{}},[]),xi=g=>A=>{A.stopPropagation&&A.stopPropagation();const H=A.currentTarget,W=H.closest("[data-pbpop]");let fe=null;if(W!==null){const te=H.getBoundingClientRect(),$e=W.getBoundingClientRect();fe={left:te.left-$e.left,top:te.bottom-$e.top,rowW:W.clientWidth}}qe.current=H,Q(fe),ce(null),ye(""),$(te=>te===g?null:g)},Qs=(g,A)=>A===""||(y[g]??[]).includes(A)?A:"",Js=g=>{Ot(A=>{if(fT(A.seats,kn(A.workflow))){const H=Nd(kn(g));return{...A,workflow:g,seats:H.map((W,fe)=>({...W,model:A.seats[fe]?.model??"",effort:A.seats[fe]?.effort??""}))}}return{...A,workflow:g}})},_s=(g,A)=>{Ot(H=>({...H,seats:H.seats.map((W,fe)=>fe===g?{...W,...A}:W)}))},vs=(g,A)=>{rn(H=>g===1?{...H,tier1:A}:{...H,tier2:A})},Ja=(g,A,H)=>{rn(W=>{const fe=g===1?W.tier1:W.tier2;if(fe===null)return W;const te=fe.map(($e,Ue)=>Ue===A?{...$e,...H}:$e);return g===1?{...W,tier1:te}:{...W,tier2:te}})},ie=g=>{rn(A=>{const H=g===1?A.tier1:A.tier2;if(H===null)return A;const W=[...H,{cli:"",model:"",effort:""}];return g===1?{...A,tier1:W}:{...A,tier2:W}})},Ee=(g,A)=>{rn(H=>{const W=g===1?H.tier1:H.tier2;if(W===null)return H;const fe=W.filter((te,$e)=>$e!==A);return g===1?{...H,tier1:fe}:{...H,tier2:fe}})},pe=(g,A)=>{Ot(H=>({...H,[g]:{...H[g],...A}}))},Ws=(g,A,H)=>{Ot(W=>{const fe={chair:br(kn(W.workflow)),curator:"codex",finalizer:"codex"};return{...W,seats:W.seats.map(te=>te.cli===g?{...te,[A]:H}:te),chair:(W.chair.cli||fe.chair)===g?{...W.chair,[A]:H}:W.chair,curator:(W.curator.cli||fe.curator)===g?{...W.curator,[A]:H}:W.curator,finalizer:(W.finalizer.cli||fe.finalizer)===g?{...W.finalizer,[A]:H}:W.finalizer}})},bs=(g,A,H)=>{rn(W=>{const fe=te=>te===null?null:te.map($e=>$e.cli===g?A==="model"?{...$e,model:H}:{...$e,effort:H}:$e);return{...W,tier1:fe(W.tier1),tier2:fe(W.tier2)}})},ba=b.useCallback(()=>{if(Oe.length>0)return;const g=ke.text,A=()=>{Re(!0),Tt.current!==null&&window.clearTimeout(Tt.current),Tt.current=window.setTimeout(()=>Re(!1),1600);const fe=z==="workflow"?{at:Date.now(),workflow:h.workflow,council:`${h.seats.length} seat${h.seats.length===1?"":"s"}`,head:py(h.request),form:h}:{at:Date.now(),workflow:"chief-of-staff",council:I,head:py(M.request),form:h,target:"chief-of-staff",cosForm:M};x($e=>[fe,...$e].slice(0,j0));const te=`copied · ${g.length.toLocaleString()} chars · paste it into your agent session`;ft(te,null),le({key:`copy-${fe.at}`,message:te})},H=()=>{F(!0),Ve(te=>te+1);const fe=`clipboard blocked — the raw prompt is selected, press ${c}C`;ft(fe,null),le({key:`copy-blocked-${Date.now()}`,message:fe})},W=()=>{try{const fe=document.createElement("textarea");fe.value=g,fe.setAttribute("readonly",""),fe.className="pb-copy-fallback",document.body.appendChild(fe),fe.select();const te=document.execCommand("copy");return document.body.removeChild(fe),te}catch{return!1}};navigator.clipboard?.writeText!=null?navigator.clipboard.writeText(g).then(A,()=>W()?A():H()):W()?A():H()},[ke,Oe.length,M,I,h,c,ft,z]),Wa=b.useRef(ba);Wa.current=ba,b.useEffect(()=>{if(!(ge===0||it.current===null))try{const g=document.createRange();g.selectNodeContents(it.current);const A=window.getSelection();A?.removeAllRanges(),A?.addRange(g)}catch{}},[ge]);const wi=g=>{Qe.current=g,/^(curator|finalizer)/.test(g)&&!h.advOpen&&Ot(W=>({...W,advOpen:!0}));const H=!/^(request|mode|h\d)|:stance$/.test(g);i&&kt(!1),qe.current=null,ce(null),ye(""),Q(null),$(H?g:null),Le(W=>W+1)};b.useEffect(()=>{const g=Qe.current;if(g===null)return;Qe.current=null;const A=ut.current?.closest(".dashboard-layout__run-list")??null,H=g.replace(/:(cli|model|effort|stance)$/,""),W=g==="request"?Et.current:A?.querySelector(`[data-pbrow="${H}"]`)??null;if(A!==null&&W!==null){const fe=W.getBoundingClientRect(),te=A.getBoundingClientRect(),$e=g.startsWith("h")?4:i?64:28;A.scrollTop+=fe.top-te.top-$e}if(g==="request")try{Et.current?.focus({preventScroll:!0})}catch{}if(/:stance$/.test(g)){const fe=A?.querySelector(`[data-pbstance="${H}"]`);try{fe?.focus({preventScroll:!0})}catch{}}},[Ae,i]),b.useEffect(()=>{const g=H=>{if((H.metaKey||H.ctrlKey)&&H.key==="Enter"){H.preventDefault(),Wa.current();return}H.key==="Escape"&&ve!==null&&yn()},A=H=>{ve!==null&&!(H.target instanceof Element&&H.target.closest("[data-pbpop]"))&&yn()};return window.addEventListener("keydown",g),window.addEventListener("pointerdown",A),()=>{window.removeEventListener("keydown",g),window.removeEventListener("pointerdown",A)}},[yn,ve]);const Hn=(g,A)=>{if(A==="")return"";if(A.length>Tr||!Wh.test(A))return`a model id has no whitespace, no leading “-” and at most ${Tr} characters`;const H=y[g]??[];return H.includes(A)?"":H.length>=ry?`a library holds at most ${ry} model ids per CLI`:y[g]===void 0&&Object.keys(y).length>=iy?`a library holds at most ${iy} CLI model lists`:""},ji=g=>g===""?"":/\{\{|\}\}/.test(g)||g.replace(/\s+/g," ").length>sd?`a stance has no {{ }} and at most ${sd} characters`:!T.includes(g)&&T.length>=cy?`a library holds at most ${cy} stances`:"",Qo=g=>{const A={chair:h.chair.cli||br(hn),curator:h.curator.cli||"codex",finalizer:h.finalizer.cli||"codex"};return h.seats.filter(H=>H.cli===g).length+Object.values(A).filter(H=>H===g).length},el=(g,A)=>{const H=Qo(g);if(!(H<2))return{label:`set on all ${H} ${g} seats`,cli:g,field:A}},ys=(g,A)=>{if(g==="")return;const H=["tier1","tier2"].reduce((W,fe)=>W+(M[fe]??[]).filter(te=>te.cli===g).length,0);if(!(H<2))return{label:`set on all ${H} ${g} profiles`,cli:g,field:A}},$r=(g,A,H,W)=>({key:g,title:"CLI adapter",sub:"workflow-eligible · conf/adapters/*.json",width:300,current:A,...W===""?{}:{noneLabel:`Workflow default — ${W}`},options:Wt.map(fe=>({value:fe,label:fe,desc:`effort ${ht(fe).join(" · ")}`})),pick:H}),Jo=g=>{if(g==="")return"";const A=v0(g);return A!==""?`a cli_name has ${A}`:g.includes("{{")||g.includes("}}")||g.includes("Example:")||/^YOUR_[A-Z0-9_]+$/.test(g)?"that looks like an unfilled template placeholder — replace it":""},tl=(g,A,H)=>({key:g,title:"CLI adapter",sub:"any adapter · free text allowed",width:300,current:A,options:Wt.map(W=>({value:W,label:W,desc:`effort ${ht(W).join(" · ")}`})),pick:H,emptyText:"no catalog match — type a cli_name below",addable:{placeholder:"type to filter, or add any cli_name…",addError:Jo},add:W=>{ye(""),H(W)}}),Mr=(g,A,H,W,fe)=>({key:g,title:"Reasoning effort",sub:`${A} · invocation_overrides.effort.allowed_values`,width:300,current:H,options:ht(A).map(te=>({value:te,label:te})),pick:W,...fe===void 0?{}:{applyAll:fe},emptyText:`${A} declares no effort override`}),Si=(g,A,H,W,fe)=>({key:g,title:"Model id",sub:`${A} · curated list`,width:380,current:H,options:(y[A]??[]).map(te=>({value:te,label:te,removable:!0})),pick:W,...fe===void 0?{}:{applyAll:fe},emptyText:`no curated model ids for ${A} yet — type one below`,addable:{placeholder:"type to filter, or add a new model id…",addError:te=>Hn(A,te)},add:te=>{be($e=>{const Ue=$e.models[A]??[];return Ue.includes(te)||Hn(A,te)!==""?$e:{...$e,models:{...$e.models,[A]:[...Ue,te]}}}),ye(""),W(te)},remove:te=>{const $e=bn();be(Ue=>({...Ue,models:{...Ue.models,[A]:(Ue.models[A]??[]).filter(et=>et!==te)}})),ft(`removed ${te} from the ${A} list`,$e)}}),Wo=g=>g===""?"":!em.test(g)||g.length>ad?`an effort is lowercase, digits, _ and -, at most ${ad} characters`:"",Lr=(g,A,H,W,fe)=>({...Si(g,A,H,W,fe),noneLabel:"None — adapter default"}),Rd=(g,A,H,W,fe)=>({...Mr(g,A,H,W,fe),sub:`${A} · any well-formed effort — admission decides`,noneLabel:"None — adapter default",addable:{placeholder:"type to filter, or add any effort…",addError:Wo},add:te=>{ye(""),W(te)}}),Ed=(g,A,H)=>({key:g,title:"Stance",sub:"curated list · free text allowed",width:440,current:A,options:T.map(W=>({value:W,label:W,removable:!0})),pick:H,emptyText:"no curated stances yet — type one below",addable:{placeholder:"type to filter, or add a stance…",addError:ji},add:W=>{be(fe=>fe.stances.includes(W)||ji(W)!==""?fe:{...fe,stances:[...fe.stances,W]}),ye(""),H(W)},remove:W=>{const fe=bn();be(te=>({...te,stances:te.stances.filter($e=>$e!==W)})),ft("removed a curated stance",fe)}}),Ni=g=>{if(g==="workflow")return{key:g,title:"Workflow",sub:"<workflow> · one of the shipped councils",width:440,current:h.workflow,options:pn.map(fe=>({value:fe.name,label:fe.name,desc:fe.description})),pick:Js};if(g==="preset"){const fe=z==="workflow"?h.preset:M.preset;return{key:g,title:"Request preset",sub:"saved requests · this dashboard",width:440,current:S.find(te=>te.name===fe)?.name??"",noneLabel:"None — start blank",removeLabel:"remove this preset",options:S.map(te=>({value:te.name,label:te.name,desc:te.text.replace(/\s+/g," ").slice(0,96)+(te.text.length>96?"…":""),removable:!0})),pick:te=>{const $e=S.find(et=>et.name===te),Ue=$e===void 0?{request:"",preset:""}:{request:$e.text,preset:$e.name};z==="workflow"?Ot(et=>({...et,...Ue})):rn(et=>({...et,...Ue}))},remove:te=>{const $e=bn();be(Ue=>({...Ue,requests:Ue.requests.filter(et=>et.name!==te)})),Ot(Ue=>Ue.preset===te?{...Ue,preset:""}:Ue),k(Ue=>Ue.preset===te?{...Ue,preset:""}:Ue),ft(`removed preset ${te}`,$e)},emptyText:"no saved requests yet — type one below and save it"}}const A=/^(chair|curator|finalizer):(cli|model|effort)$/.exec(g);if(A!==null){const fe=A[1],te=h[fe],$e=fe==="chair"?br(hn):"codex",Ue=te.cli||$e;return A[2]==="cli"?$r(g,te.cli,et=>{pe(fe,{cli:et,model:Qs(et||$e,te.model)})},$e):A[2]==="model"?Si(g,Ue,te.model,et=>pe(fe,{model:et}),el(Ue,"model")):Mr(g,Ue,te.effort,et=>pe(fe,{effort:et}),el(Ue,"effort"))}const H=/^seat:(\d+):(cli|model|effort|stancepick)$/.exec(g);if(H!==null){const fe=Number(H[1]),te=h.seats[fe];return te===void 0?null:H[2]==="cli"?$r(g,te.cli,$e=>{_s(fe,{cli:$e,model:Qs($e,te.model)})},""):H[2]==="model"?Si(g,te.cli,te.model,$e=>_s(fe,{model:$e}),el(te.cli,"model")):H[2]==="effort"?Mr(g,te.cli,te.effort,$e=>_s(fe,{effort:$e}),el(te.cli,"effort")):Ed(g,te.stance,$e=>_s(fe,{stance:$e}))}const W=/^t([12]):(\d+):(cli|model|effort)$/.exec(g);if(W!==null){const fe=W[1]==="1"?1:2,te=Number(W[2]),$e=fe===1?M.tier1:M.tier2,Ue=$e===null?void 0:$e[te];return Ue===void 0?null:W[3]==="cli"?tl(g,Ue.cli,et=>Ja(fe,te,{cli:et,model:Qs(et,Ue.model)})):W[3]==="model"?Lr(g,Ue.cli,Ue.model,et=>Ja(fe,te,{model:et}),ys(Ue.cli,"model")):Rd(g,Ue.cli,Ue.effort,et=>Ja(fe,te,{effort:et}),ys(Ue.cli,"effort"))}return null},ya=(g,A)=>{j&&g.applyAll!==void 0?z==="chief-of-staff"?bs(g.applyAll.cli,g.applyAll.field,A):Ws(g.applyAll.cli,g.applyAll.field,A):g.pick(A),yn()},ki=(g,A)=>{g.add?.(A),yn()},Ai=(g,A)=>{g.remove?.(A)},xn=ve===null?null:Ni(ve),es=(...g)=>i||xn===null||!g.includes(xn.key)?null:l.jsx(gy,{addText:de,anchor:U,applyAllOn:j,config:xn,highlight:ee,phone:!1,onAdd:A=>ki(xn,A),onAddTextChange:ye,onApplyAllToggle:()=>L(A=>!A),onClose:yn,onHighlight:ce,onPick:A=>ya(xn,A),onRemove:A=>Ai(xn,A)}),ec=i&&xn!==null?l.jsx(gy,{addText:de,anchor:null,applyAllOn:j,config:xn,highlight:ee,phone:!0,onAdd:g=>ki(xn,g),onAddTextChange:ye,onApplyAllToggle:()=>L(g=>!g),onClose:yn,onHighlight:ce,onPick:g=>ya(xn,g),onRemove:g=>Ai(xn,g)}):null,nl=Array.from({length:qt},(g,A)=>Je.filter(H=>Ye(H.field)===A).length),Ri=Array.from({length:qt},(g,A)=>Fe.filter(H=>Ye(H.field)===A).length),al=g=>h[g].cli!==""||h[g].model!==""||h[g].effort!=="",ra=Array.from({length:qt},(g,A)=>Ri[A]!==0?"issue":nl[A]!==0?"pending":z==="workflow"&&A===1&&!al("curator")&&!al("finalizer")?"default":"set"),Ei=ra.map(g=>g==="set"||g==="default"),xs=Array.from({length:qt-1},(g,A)=>Ei.slice(0,A+1).every(Boolean)),qa=g=>{const A=ra[g];return A==="issue"?`${Ri[g]} issue${Ri[g]===1?"":"s"}`+(nl[g]!==0?` · ${nl[g]} to fill`:""):A==="pending"?`${nl[g]} to fill`:A==="default"?"defaults":"set"},Ir=Ei.filter(Boolean).length,Ua=Fe.length!==0?`${Fe.length} issue${Fe.length===1?"":"s"}`+(Je.length!==0?` · ${Je.length} to fill`:""):Je.length!==0?`${Je.length} to fill`:"ready to copy",Ti=z==="workflow"?h.workflow!==""?h.workflow:"run-workflow · pick a workflow":"chief-of-staff",Ci=en.written.filter(g=>g.isSet).length,Oi=en.written.filter(g=>g.isDefault).length,tc=`${h.seats.length} seat${h.seats.length===1?"":"s"}`,wn=Se?"copied ✓":"copy prompt",Ba=Oe.length!==0?`finish the checklist first · ${Ua}`:`copy the assembled prompt · ${c}↵`,zl=Date.now(),ws=g=>z==="workflow"?g.field==="request"?"request":g.field==="seats"?"h03":g.sub!==""?`${g.field}:${g.sub}`:g.field:g.field==="request"?"h02":"h01",nc=Fe.map(g=>({issue:g,jump:ws(g)})),$i=Array.from({length:qt},(g,A)=>({section:A,chips:Je.filter(H=>Ye(H.field)===A)})).filter(g=>g.chips.length>0),Mi=Fe[0]??Je[0]??null,tn=(g,A,H,W,fe)=>({key:g,label:A,value:H,empty:W,on:ve===g,go:xi(g),title:[fe.err===void 0?"":fe.err,fe.miss===!0?"required · pick one":"",fe.tip??""].filter(Boolean).join(" · "),aria:fe.aria,cellLabel:fe.cellLabel??A,state:(fe.err!==void 0&&fe.err!==""?"err":"")||(ve===g?"open":"")||(fe.miss===!0?"miss":"")||"",isDefault:H===""}),xa=g=>({onMouseEnter:()=>{!i&&Xt!==g&&$t(g)},onMouseLeave:()=>{!i&&Xt!==null&&$t(null)}}),ql=g=>{const A=!i&&Xt===g.field;return l.jsx("div",{className:`pb-row__content pb-knob${A?" pb-knob--hl":""}`,"data-pbpop":"1","data-pbrow":g.key,...xa(g.field),children:i?l.jsxs("div",{className:"pb-knob-card",children:[l.jsxs("div",{className:"pb-knob-card__row",children:[l.jsx(lh,{cell:g.cli}),g.del!==void 0?l.jsx("button",{"aria-label":g.del.title,className:"pb-knob-card__del",onClick:g.del.run,title:g.del.title,type:"button",children:"×"}):null]}),l.jsxs("div",{className:"pb-knob-card__row pb-knob-card__row--split",children:[l.jsx(lh,{cell:g.model}),l.jsx("span",{"aria-hidden":"true",className:"pb-knob-card__divider"}),l.jsx(lh,{cell:g.effort})]}),g.stance!==void 0?l.jsxs("div",{className:"pb-knob-card__stance",children:[l.jsx("input",{"aria-label":"seat stance",className:`pb-stance-input pb-stance-input--phone${g.stance.err?" pb-stance-input--err":""}${g.stance.miss&&!g.stance.err?" pb-stance-input--miss":""}`,"data-pbstance":g.stance.key,onChange:H=>g.stance?.onChange(H.target.value),placeholder:"stance · type, or pick ▾",type:"text",value:g.stance.value}),l.jsx(ai,{caretOnly:!0,phone:!0,pill:g.stance.pick})]}):null,g.sub!==void 0&&g.sub!==""?l.jsx("span",{className:"pb-sub pb-sub--phone",children:g.sub}):null,g.err!==void 0&&g.err!==""?l.jsx("div",{className:"pb-err pb-err--phone",role:"alert",children:g.err}):null,g.warn!==void 0&&g.warn!==""?l.jsx("div",{className:"pb-warn-line pb-warn-line--phone",role:"status",children:g.warn}):null]}):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"pb-knob__label",children:g.label}),l.jsx(ai,{pill:g.cli}),l.jsxs("div",{className:"pb-knob__knobs",children:[l.jsx(ai,{pill:g.model}),l.jsx(ai,{pill:g.effort})]}),g.del!==void 0?l.jsx("button",{"aria-label":g.del.title,className:"pb-knob__del",onClick:g.del.run,title:g.del.title,type:"button",children:"×"}):null,g.stance!==void 0?l.jsxs("div",{className:"pb-knob__stance",children:[l.jsx("input",{"aria-label":"seat stance",className:`pb-stance-input${g.stance.err?" pb-stance-input--err":""}${g.stance.miss&&!g.stance.err?" pb-stance-input--miss":""}`,"data-pbstance":g.stance.key,onChange:H=>g.stance?.onChange(H.target.value),placeholder:"stance · type, or pick ▾",type:"text",value:g.stance.value}),l.jsx(ai,{caretOnly:!0,pill:g.stance.pick})]}):null,g.sub!==void 0&&g.sub!==""?l.jsx("span",{className:"pb-sub",children:g.sub}):null,g.err!==void 0&&g.err!==""?l.jsx("div",{className:"pb-err",role:"alert",children:g.err}):null,g.warn!==void 0&&g.warn!==""?l.jsx("div",{className:"pb-warn-line",role:"status",children:g.warn}):null,es(`${g.key}:cli`,`${g.key}:model`,`${g.key}:effort`,`${g.key}:stancepick`)]})})},Td=(()=>{const A=(z==="workflow"?[{kind:"workflow",phase:t.phase},{kind:"adapter",phase:a.phase}]:[{kind:"adapter",phase:a.phase}]).find($e=>$e.phase!=="current");if(A===void 0)return null;const{kind:H,phase:W}=A,fe=W==="loading"?`Loading ${H} catalog…`:W==="auth_expired"?`Authentication expired; the ${H} catalog was not loaded.`:W==="connection_changed"?`Connection changed; rebootstrap before loading the ${H} catalog.`:W==="offline"?`Offline; the ${H} catalog could not be loaded.`:`The ${H} catalog request failed.`,te=W!=="auth_expired"&&W!=="connection_changed";return l.jsxs("div",{className:"pb-catalog-banner",role:W==="loading"?"status":"alert",children:[l.jsx("span",{children:fe}),te?l.jsxs("button",{className:"pb-fact-btn",onClick:H==="workflow"?t.retry:a.retry,type:"button",children:["[ retry ",H," catalog ]"]}):null]})})(),Cd=m.map(g=>({entry:g,time:_y(g.at,zl),reopen:()=>{const A=bn();g.target==="chief-of-staff"?(Qa("chief-of-staff"),k(ly(g.cosForm))):(Qa("workflow"),mn(ty(g.form,kn))),$(null),Re(!1),kt(!1);const H=ut.current?.closest(".dashboard-layout__run-list")??null;H!==null&&(H.scrollTop=0),ft(`reopened the ${_y(g.at,Date.now())} prompt`,A)}})),ac=(g,A)=>l.jsx("div",{"aria-hidden":A?void 0:!0,className:"pb-row__gutter",children:A?l.jsxs(l.Fragment,{children:[g>0?l.jsx("div",{className:`pb-track pb-track--top${xs[g-1]?" pb-track--solid":""}`}):null,g<qt-1?l.jsx("div",{className:`pb-track pb-track--bot${xs[g]?" pb-track--solid":""}`}):null,l.jsx("button",{"aria-label":`0${g+1} ${Ct[g]} · ${qa(g)}`,className:"pb-node",onClick:()=>wi(`h0${g+1}`),title:`0${g+1} ${Ct[g]} · ${qa(g)}`,type:"button",children:l.jsx("span",{className:`pb-node__dot pb-node__dot--${ra[g]}`})})]}):l.jsx("div",{className:g<qt-1?`pb-track pb-track--full${xs[g]?" pb-track--solid":""}`:"pb-track pb-track--none"})}),ts=(g,A,H)=>l.jsxs("div",{className:"pb-row",children:[ac(g,!0),l.jsxs("div",{className:"pb-row__content pb-head","data-pbrow":`h0${g+1}`,children:[l.jsxs("span",{className:"pb-head__num",children:["0",g+1]}),l.jsx("span",{className:"pb-head__label",children:Ct[g]}),l.jsx("span",{className:"pb-head__spacer"}),A!==void 0?l.jsx("button",{className:"pb-fact-btn pb-head__btn",onClick:A.run,type:"button",children:A.label}):null,H!==void 0&&H!==""?l.jsx("span",{className:"pb-head__sub",children:H}):null]})]}),Rn=(g,A)=>l.jsxs("div",{className:"pb-row",children:[ac(g,!1),A]}),sc=g=>{const A=g===1?"tier1":"tier2",H=M[A],W=g===1?wr:jr;return l.jsxs(l.Fragment,{children:[Rn(0,l.jsxs("div",{className:"pb-row__content pb-tier-head","data-pbrow":`t${g}`,children:[l.jsx("span",{className:"pb-tier-head__label",children:`Tier ${g}`}),l.jsx("span",{className:"pb-tier-head__state",children:FT(H)}),l.jsx("span",{className:"pb-form-head__spacer"}),H!==null?l.jsx("button",{className:"pb-fact-btn",onClick:()=>vs(g,null),title:`omit <${W}> entirely — the skill inspects exposed tools and inherits`,type:"button",children:"[ omit tag ]"}):null,H===null||H.length>0?l.jsx("button",{className:"pb-fact-btn",onClick:()=>vs(g,[]),title:`write an explicit empty pool — <${W}>[]`,type:"button",children:"[ write empty ]"}):null]})),H===null?Rn(0,l.jsx("div",{className:"pb-row__content",children:l.jsx("div",{className:"pb-tier-null",children:"unspecified — the skill inspects exposed tools and inherits"})})):l.jsxs(l.Fragment,{children:[H.map((fe,te)=>Rn(0,ql({key:`t${g}:${te}`,field:A,label:`T${g} · ${String(te+1).padStart(2,"0")}`,cli:tn(`t${g}:${te}:cli`,"",fe.cli,"cli",{aria:`tier ${g} profile ${te+1} cli`,cellLabel:`T${g}·${te+1}`,err:za(`tier${g}:${te}`,"cli"),miss:fe.cli===""}),model:tn(`t${g}:${te}:model`,"model",fe.model,"—",{aria:`tier ${g} profile ${te+1} model`,err:za(`tier${g}:${te}`,"model"),tip:"empty keeps the adapter default"}),effort:tn(`t${g}:${te}:effort`,"effort",fe.effort,"—",{aria:`tier ${g} profile ${te+1} effort`,err:za(`tier${g}:${te}`,"effort"),tip:"empty keeps the adapter default"}),del:{title:`remove tier ${g} profile ${te+1}`,run:()=>{const $e=bn();Ee(g,te),ft(`tier ${g} profile ${te+1} removed`,$e)}},err:za(`tier${g}:${te}`),warn:Pa(`tier${g}:${te}`)}))),Rn(0,l.jsxs("div",{className:"pb-row__content pb-add-seat","data-pbrow":`t${g}:add`,children:[l.jsx("button",{className:"pb-fact-btn",onClick:()=>ie(g),type:"button",children:"[ + add profile ]"}),l.jsx("span",{className:"pb-add-seat__meta",children:`${H.length} profile${H.length===1?"":"s"} · no cap — a tier is an eligible pool`})]}))]})]})},Yn=z==="workflow"?h.request:M.request,lc=z==="workflow"?h.preset:M.preset,Dr=z==="workflow"?3:1,ic=g=>{z==="workflow"?Ot(A=>({...A,request:g})):rn(A=>({...A,request:g}))},js=S.find(g=>g.name===lc)??null,zr=js!==null&&js.text!==Yn,Od=tn("preset","preset",js===null?"":js.name+(zr?" · edited":""),"none · type your own",{aria:"request preset"}),Ul=Jt.trim(),Li=S.find(g=>g.name.toLowerCase()===Ul.toLowerCase()),qr=!Mn||Ul===""?"":Ul.length>uy?`keep the name under ${uy} characters`:Li!==void 0?`a preset named ${Li.name} already exists`:Yn.trim()===""?"type the request first":Yn.length>Ro?`keep the request under ${Ro} characters`:S.length>=oy?`a library holds at most ${oy} request presets`:"",rc=!Mn&&zr&&js!==null&&Yn.trim()!==""&&Yn.length>Ro?`keep the request under ${Ro} characters`:"",oc=Ul!==""&&qr===""&&Yn.trim()!=="",Ur=()=>{if(!oc)return;const g=Ul;be(A=>({...A,requests:[...A.requests,{name:g,text:Yn}]})),ln(!1),lt(""),z==="workflow"?Ot(A=>({...A,preset:g})):rn(A=>({...A,preset:g}))},$d=l.jsxs("section",{"aria-label":"Prompt builder",className:"pb-form-view",children:[l.jsx("h1",{className:"visually-hidden",id:"dashboard-page-title",children:"Prompt builder"}),l.jsxs("div",{className:"pb-form-head",children:[l.jsx("span",{className:"pb-specimen",title:"assembles the invocation prompt · only the tags you set are emitted, the agent infers the rest",children:"Prompt builder"}),l.jsxs("div",{"aria-label":"prompt target",className:"pb-seg",role:"group",children:[l.jsx("button",{"aria-pressed":z==="workflow",className:"pb-seg__opt",onClick:()=>ia("workflow"),title:"assemble the run-workflow invocation prompt (prompt.md)",type:"button",children:"run-workflow"}),l.jsx("button",{"aria-pressed":z==="chief-of-staff",className:"pb-seg__opt",onClick:()=>ia("chief-of-staff"),title:"assemble the chief-of-staff skill invocation prompt (tier routing)",type:"button",children:"chief-of-staff"})]}),l.jsx("span",{className:"pb-form-head__spacer"}),l.jsx("span",{className:"pb-form-head__sub",title:"models, request presets, and stances",children:B==="synced"?"library on this dashboard":B==="unsynced"?"library saved in this browser only":B==="loading"?"library…":"library local"}),l.jsx("button",{className:"pb-fact-btn",onClick:()=>{const g=bn();z==="workflow"?(Qt({}),mn(m0())):k(_0()),$(null),Re(!1),ln(!1),lt(""),ft("form cleared",g)},title:"clear every field",type:"button",children:"[ reset ]"})]}),Td,l.jsxs("div",{className:"pb-form-scroll",ref:ut,children:[l.jsxs("div",{className:"pb-rows",children:[z==="workflow"?l.jsxs(l.Fragment,{children:[ts(0),Rn(0,l.jsxs("div",{className:"pb-row__content pb-single","data-pbpop":"1","data-pbrow":"workflow",...xa("workflow"),children:[l.jsx(ai,{pill:tn("workflow","workflow",h.workflow,"pick a workflow",{aria:"workflow",err:rt("workflow"),miss:h.workflow===""}),phone:i}),hn!==null?l.jsx("span",{className:"pb-sub",children:hn.description}):null,rt("workflow")!==""?l.jsx("div",{className:"pb-err",role:"alert",children:rt("workflow")}):null,es("workflow")]})),Rn(0,l.jsxs("div",{className:"pb-row__content pb-seg-row","data-pbrow":"sync",children:[l.jsx("span",{className:"pb-row-label",children:"launch"}),l.jsxs("div",{"aria-label":"launch mode",className:"pb-seg",role:"group",children:[l.jsx("button",{"aria-pressed":h.sync==="",className:"pb-seg__opt",onClick:()=>Ot(g=>({...g,sync:""})),title:"async",type:"button",children:"async"}),l.jsx("button",{"aria-pressed":h.sync==="sync",className:"pb-seg__opt",onClick:()=>Ot(g=>({...g,sync:"sync"})),title:"sync",type:"button",children:"sync"})]}),h.sync==="sync"?l.jsx("span",{className:"pb-sub",children:"blocks until the council finishes"}):null]})),ts(1,{label:h.advOpen?"[ hide ]":"[ show ]",run:()=>Ot(g=>({...g,advOpen:!g.advOpen}))},"curator · finalizer"),h.advOpen?[["curator","role json"],["finalizer","role json-codereviewer"]].map(([g,A])=>Rn(1,ql({key:g,field:g,label:g,cli:tn(`${g}:cli`,"",h[g].cli,"codex",{aria:`${g} cli`,cellLabel:g}),model:tn(`${g}:model`,"model",h[g].model,"—",{aria:`${g} model`,err:rt(g,"model"),miss:zt(g,"model")}),effort:tn(`${g}:effort`,"effort",h[g].effort,"—",{aria:`${g} effort`,err:rt(g,"effort"),miss:zt(g,"effort")}),sub:A,err:rt(g)}))):Rn(1,l.jsx("div",{className:"pb-row__content pb-folded",children:l.jsx("span",{className:"pb-sub",children:`curator ${vy(h.curator,"codex")} · finalizer ${vy(h.finalizer,"codex")}`})})),ts(2,void 0,"seats · chairman"),h.seats.map((g,A)=>Rn(2,ql({key:`seat:${A}`,field:"seats",label:`seat ${A+1}`,cli:tn(`seat:${A}:cli`,"",g.cli,"cli",{aria:`seat ${A+1} cli`,cellLabel:`seat ${A+1}`}),model:tn(`seat:${A}:model`,"model",g.model,"—",{aria:`seat ${A+1} model`,err:rt(`seat:${A}`,"model"),miss:zt(`seat:${A}`,"model"),tip:"also applies to this seat’s reviewer seat"}),effort:tn(`seat:${A}:effort`,"effort",g.effort,"—",{aria:`seat ${A+1} effort`,err:rt(`seat:${A}`,"effort"),miss:zt(`seat:${A}`,"effort"),tip:"also applies to this seat’s reviewer seat"}),del:{title:`remove seat ${A+1}`,run:()=>{const H=bn();Ot(W=>({...W,seats:W.seats.filter((fe,te)=>te!==A)})),ft(`seat ${A+1} removed`,H)}},stance:A>=3?{key:`seat:${A}`,value:g.stance,err:rt(`seat:${A}`,"stance")!=="",miss:zt(`seat:${A}`,"stance"),onChange:H=>_s(A,{stance:H}),pick:tn(`seat:${A}:stancepick`,"","","",{aria:`seat ${A+1} curated stances`})}:void 0,err:rt(`seat:${A}`)}))),Rn(2,l.jsxs("div",{className:"pb-row__content pb-add-seat","data-pbrow":"addseat",children:[h.seats.length>=$u?l.jsx("span",{className:"pb-add-seat__full",children:"10 of 10 seats"}):l.jsx("button",{className:"pb-fact-btn",onClick:()=>Ot(g=>g.seats.length>=$u?g:{...g,seats:[...g.seats,{cli:"codex",model:"",effort:"",stance:""}]}),type:"button",children:"[ + add seat ]"}),l.jsx("span",{className:"pb-add-seat__meta",children:`${h.seats.length} / 10`+(h.seats.length>=3&&h.seats.length<$u?" · a stance is required from seat 4":"")})]})),Rn(2,ql({key:"chair",field:"chair",label:"chairman",cli:tn("chair:cli","",h.chair.cli,br(hn),{aria:"chairman cli",cellLabel:"chairman"}),model:tn("chair:model","model",h.chair.model,"—",{aria:"chairman model",err:rt("chair","model"),miss:zt("chair","model")}),effort:tn("chair:effort","effort",h.chair.effort,"—",{aria:"chairman effort",err:rt("chair","effort"),miss:zt("chair","effort")}),err:rt("chair")})),ts(3,void 0,"required")]}):l.jsxs(l.Fragment,{children:[ts(0,void 0,"tier 1 · tier 2"),sc(1),sc(2),Rn(0,l.jsx("div",{className:"pb-row__content pb-single",children:l.jsx("span",{className:"pb-sub",children:"A tier is an eligible pool, not a fan-out count — listing four adapters does not create four workers. Omitted tag = unspecified; [] = no eligible profiles; empty model/effort keep the adapter default."})})),ts(1,void 0,"required")]}),Rn(Dr,l.jsxs("div",{className:"pb-row__content pb-single","data-pbpop":"1","data-pbrow":"preset",...xa("request"),children:[l.jsx(ai,{pill:Od,phone:i}),es("preset")]})),Rn(Dr,l.jsxs("div",{className:"pb-row__content pb-request","data-pbrow":"request",...xa("request"),children:[l.jsx("textarea",{"aria-label":"user request",className:"pb-request-input",onChange:g=>ic(g.target.value),placeholder:h0,ref:Et,rows:Math.min(16,Math.max(i?6:7,Yn.split(`
|
|
103
|
-
`).length+1)),value:Yn}),l.jsx("span",{className:"pb-request-hint",children:`Name files, symbols or error text — and the repo path if it is not the server’s.${i?"":` ${c}↵ copies.`}`})]})),Rn(Dr,l.jsxs("div",{className:"pb-row__content pb-save","data-pbrow":"reqsave",children:[l.jsx("button",{"aria-expanded":Mn,className:"pb-fact-btn",onClick:()=>{ln(g=>!g),lt("")},type:"button",children:Mn?"[ cancel ]":"[ save as preset ]"}),!Mn&&zr&&Yn.trim()!==""&&js!==null?l.jsxs("button",{className:"pb-fact-btn",onClick:()=>{Yn.length>Ro||be(g=>({...g,requests:g.requests.map(A=>A.name===lc?{name:A.name,text:Yn}:A)}))},type:"button",children:["[ update ",js.name," ]"]}):null,Mn?l.jsxs(l.Fragment,{children:[l.jsx("input",{"aria-label":"preset name",className:"pb-save-input",onChange:g=>lt(g.target.value),onKeyDown:g=>{g.key==="Enter"&&Ur(),g.key==="Escape"&&(ln(!1),lt(""))},placeholder:"preset name · e.g. retry-review",spellCheck:!1,type:"text",value:Jt}),l.jsx("button",{className:`pb-fact-btn${oc?"":" pb-fact-btn--off"}`,onClick:Ur,type:"button",children:"[ save preset ]"})]}):null,qr!==""?l.jsx("div",{className:"pb-err",role:"alert",children:qr}):rc!==""?l.jsx("div",{className:"pb-err",role:"alert",children:rc}):null,l.jsx("span",{className:"pb-save-sub",children:B==="synced"?"saved on this dashboard":"this browser only"})]}))]}),l.jsxs("div",{className:"pb-history",children:[l.jsxs("div",{className:"pb-history__head",children:[l.jsx("span",{className:"pb-specimen pb-specimen--sm",children:"History"}),m.length>0?l.jsxs("span",{className:"pb-history__count",children:["[ ",m.length," ]"]}):null,l.jsx("span",{className:"pb-form-head__spacer"}),m.length>0?l.jsx("button",{className:"pb-fact-btn",onClick:()=>{const g=bn();x([]),ft("history cleared",g)},type:"button",children:"[ clear ]"}):null]}),m.length===0?l.jsx("p",{className:"pb-history__empty",children:"Copied prompts land here · this browser, last 12."}):Cd.map(g=>l.jsxs("button",{className:"pb-history__row",onClick:g.reopen,title:"reopen this prompt in the form",type:"button",children:[l.jsx("span",{className:"pb-history__time",children:g.time}),l.jsx("span",{className:"pb-history__wf",children:g.entry.workflow===""?"inferred":g.entry.workflow}),l.jsx("span",{className:"pb-history__council",children:g.entry.council}),l.jsx("span",{className:"pb-history__head-text",children:g.entry.head===""?"(empty request)":g.entry.head}),l.jsx("span",{className:"pb-history__reopen",children:"reopen ›"})]},g.entry.at))]})]})]}),Md=l.jsxs("div",{className:"pb-prompt-body",children:[i?null:l.jsxs("div",{className:"pb-eyebrow",children:[l.jsx("span",{className:"pb-eyebrow__label",children:"prompt"}),l.jsx("span",{className:"pb-eyebrow__chip",title:z==="workflow"?"the skill's input template · prompt.md":"the skill's input template · CHIEF-OF-STAFF-PROMPT.md",children:z==="workflow"?"run-workflow · prompt.md":"chief-of-staff · CHIEF-OF-STAFF-PROMPT.md"})]}),l.jsxs("div",{className:"pb-h1-row",children:[l.jsx("h2",{className:"pb-h1",children:Ti}),i?null:l.jsx("button",{className:"pb-cta",disabled:Oe.length>0,onClick:ba,title:Ba,type:"button",children:wn})]}),l.jsxs("div",{className:"pb-facts",children:[l.jsxs("span",{className:"pb-fact",children:["sections ",Ir," / ",qt," ready"]}),z==="workflow"?l.jsx("span",{className:"pb-fact",children:`tags ${Ci} set · ${Oi} default`+(en.omitted.length>0?` · ${en.omitted.length} omitted`:"")}):l.jsx("span",{className:"pb-fact",children:`tags ${Gn.written.length} written`}),l.jsxs("span",{className:"pb-fact",children:["chars ",ke.text.length.toLocaleString()]}),z==="workflow"?l.jsxs("span",{className:"pb-fact",children:["council ",tc]}):l.jsx("span",{className:"pb-fact",children:I}),l.jsx("span",{className:"pb-fact",children:l.jsx("span",{className:`pb-status pb-status--${bu(Fe.length,Je.length)}`,children:Ua})})]}),Oe.length>0?l.jsxs("div",{className:"pb-before",role:"status",children:[l.jsxs("div",{className:"pb-before__head",children:[l.jsx("span",{className:"pb-specimen pb-specimen--sm",children:"Before copy"}),l.jsx("span",{className:`pb-status pb-status--${bu(Fe.length,Je.length)}`,children:Ua})]}),nc.length>0?l.jsx("div",{className:"pb-before__errors",children:nc.map(({issue:g,jump:A})=>l.jsxs("button",{className:"pb-issue-line",onClick:()=>wi(A),type:"button",children:[l.jsx("span",{"aria-hidden":"true",className:"pb-issue-line__dot"}),l.jsx("span",{className:"pb-issue-line__msg",children:g.message}),l.jsx("span",{"aria-hidden":"true",className:"pb-issue-line__go",children:"›"})]},`${g.field}:${g.sub}:${g.message}`))}):null,$i.length>0?l.jsx("div",{className:"pb-before__groups",children:$i.map(g=>l.jsxs("div",{className:"pb-before__group",children:[l.jsxs("span",{className:"pb-before__group-label",children:["0",g.section+1," ",vn[g.section]]}),l.jsx("div",{className:"pb-before__chips",children:g.chips.map((A,H)=>l.jsxs("button",{className:"pb-chip",onClick:()=>wi(ws(A)),title:"jump to this field",type:"button",children:[l.jsx("span",{"aria-hidden":"true",className:"pb-chip__dot"}),A.short]},`${A.field}:${A.sub}:${H}`))})]},g.section))}):null]}):null,l.jsxs("div",{className:`pb-card${Se?" pb-card--flash":""}`,children:[l.jsxs("div",{className:"pb-card__head",children:[he?l.jsxs("span",{className:"pb-card__note",children:["exact copy · ",ke.text.length.toLocaleString()," chars"]}):l.jsxs(l.Fragment,{children:[l.jsxs("button",{"aria-expanded":Pe,className:"pb-fact-btn",onClick:()=>Gt(g=>!g),type:"button",children:[Pe?"[ hide ]":"[ show ]"," ",z==="workflow"?"preamble":"policy"]}),l.jsx("span",{className:"pb-card__note",children:z==="workflow"?"preamble · verbatim from prompt.md":"invocation policy · verbatim from the template"})]}),l.jsx("span",{className:"pb-form-head__spacer"}),l.jsx("button",{"aria-pressed":he,className:"pb-fact-btn",onClick:()=>F(g=>!g),title:he?"back to the annotated view":"the exact text that is copied, selectable",type:"button",children:he?"[ formatted ]":"[ raw ]"})]}),he?l.jsx("pre",{"aria-label":"the prompt exactly as copied",className:"pb-raw",ref:it,tabIndex:0,children:ke.text}):z==="workflow"?l.jsxs(l.Fragment,{children:[Pe?l.jsx("div",{className:"pb-card__preamble",children:sT(p0).map(g=>l.jsx("p",{children:g},g))}):null,l.jsx("div",{className:"pb-card__divider",children:"---"}),l.jsx("div",{className:"pb-card__tags",children:en.every.map((g,A)=>{const H=ny(g.tag),W=Pt[g.tag]!==void 0&&zl-Pt[g.tag]<1200,fe=!i&&H!==""&&Xt===H,te=A===0?"":ny(en.every[A-1].tag),$e=H!==te,Ue=g.tag==="members_json"&&!g.ghost?g.value.split(`
|
|
104
|
-
`).slice(1,-1).map(et=>({line:et,parts:et.trim().split(", ")})):[];return l.jsxs("div",{className:`pb-tag${$e?"":" pb-tag--tight"}${fe?" pb-tag--hl":""}${W?" pb-tag--pulse":""}`,...H===""?{}:xa(H),children:[l.jsx("span",{className:g.ghost?"pb-tag__name pb-tag__name--ghost":"pb-tag__name",children:`<${g.tag}>`}),(g.isDefault||g.ghost)&&!he?l.jsx("span",{className:"pb-tag__stamp",title:g.ghost?"the template has this tag; the builder leaves it out so the adapter or skill default applies (an empty tag is rejected at admission)":"effective default — written so the run is explicit; change it in the form",children:g.ghost?`not written · ${g.why}`:"default"}):null,g.tag==="members_json"&&!g.ghost?l.jsxs("span",{className:"pb-tag__seats",children:[l.jsx("span",{className:"pb-tag__seat-line",children:"["}),Ue.map((et,Ss)=>l.jsx("span",{className:"pb-tag__seat-line",children:et.parts.map((Ii,Br)=>l.jsx("span",{className:"pb-tag__seat-part",children:Ii+(Br<et.parts.length-1?",":"")},`${Ss}:${Br}`))},Ss)),l.jsx("span",{className:"pb-tag__seat-line",children:"]"})]}):g.ghost?null:l.jsx("span",{className:"pb-tag__value","data-default":g.isSet?void 0:"true",children:g.value}),l.jsx("span",{className:g.ghost?"pb-tag__name pb-tag__name--ghost":"pb-tag__name",children:`</${g.tag}>`})]},`${g.tag}:${Pt[g.tag]??0}`)})})]}):l.jsxs(l.Fragment,{children:[Pe?l.jsxs("div",{className:"pb-card__preamble pb-card__policy",children:[l.jsx("span",{className:"pb-card__h",children:"Task"}),l.jsx("p",{children:sa.task}),l.jsx("span",{className:"pb-card__h",children:"Invocation policy"}),l.jsx("ul",{className:"pb-card__list",children:sa.bullets.map(g=>l.jsx("li",{children:g},g))})]}):null,l.jsxs("div",{className:"pb-card__tags",children:[l.jsx("span",{className:"pb-card__h",children:"ClinkX profiles"}),[1,2].map(g=>{const A=g===1?wr:jr,H=Fn.get(A),W=H===void 0?"pb-tag__name pb-tag__name--ghost":"pb-tag__name";return l.jsxs("div",{className:"pb-tag",...xa(g===1?"tier1":"tier2"),children:[l.jsx("span",{className:W,children:`<${A}>`}),H===void 0?l.jsx("span",{className:"pb-tag__stamp",title:"the tier is unspecified; the skill inspects exposed tools and inherits",children:"not written · unspecified"}):l.jsx("span",{className:"pb-tag__value",children:H}),l.jsx("span",{className:W,children:`</${A}>`})]},A)}),l.jsx("span",{className:"pb-card__h",children:"Request"}),l.jsxs("div",{className:"pb-tag",...xa("request"),children:[l.jsx("span",{className:la===""?"pb-tag__name pb-tag__name--ghost":"pb-tag__name",children:`<${Vo}>`}),la===""?l.jsx("span",{className:"pb-tag__stamp",title:"the user request is the one required fill point",children:"empty · required"}):l.jsx("span",{className:"pb-tag__value",children:la}),l.jsx("span",{className:la===""?"pb-tag__name pb-tag__name--ghost":"pb-tag__name",children:`</${Vo}>`})]})]})]})]}),l.jsxs("div",{className:"pb-ledger",children:[l.jsxs("div",{className:"pb-ledger__head",children:[l.jsx("span",{className:"pb-specimen pb-specimen--sm",children:"Left to defaults"}),l.jsx("span",{className:"pb-ledger__note",children:"never written here · what resolves them"})]}),l.jsx("div",{className:"pb-ledger__card",children:(z==="workflow"?KT:je).map(g=>l.jsxs("div",{className:"pb-ledger__row",children:[l.jsx("span",{className:"pb-ledger__keys",children:g.keys.map(A=>l.jsx("span",{className:"pb-ledger__key",children:A},A))}),l.jsx("span",{className:"pb-ledger__value",children:g.value})]},g.keys.join("|")))})]}),i?l.jsx("div",{"aria-hidden":"true",className:"pb-preview-spacer"}):null]}),Ld=l.jsxs("section",{"aria-label":"Assembled prompt",className:"pb-prompt-view",children:[i?l.jsxs("div",{className:"pb-preview-bar",children:[l.jsx("button",{className:"pb-preview-back",onClick:()=>kt(!1),type:"button",children:"‹ builder"}),l.jsx("span",{className:"pb-preview-bar-title",children:Ti})]}):l.jsxs(yi,{children:[l.jsx("span",{className:"pb-sticky__id",children:"prompt"}),l.jsx("span",{className:"pb-sticky__name",children:Ti}),l.jsx("span",{className:`pb-sticky__status pb-status--${bu(Fe.length,Je.length)}`,children:Ua}),l.jsx("span",{className:"pb-form-head__spacer"}),l.jsx("button",{className:"pb-fact-btn",disabled:Oe.length>0,onClick:ba,title:Ba,type:"button",children:Se?"copied ✓":"[ copy prompt ]"})]}),Md,i?l.jsxs("div",{className:"pb-preview-foot",children:[l.jsx("span",{className:`pb-preview-foot-status pb-status--${bu(Fe.length,Je.length)}`,children:Ua}),l.jsx("button",{className:"pb-cta pb-cta--md",disabled:Oe.length>0,onClick:ba,title:Ba,type:"button",children:wn})]}):null]});return l.jsxs("div",{className:"prompt-builder",children:[l.jsx(Rl,{detail:Ld,detailAriaLabel:"Assembled prompt",listAriaLabel:"Prompt builder form",mobileView:Vt?"detail":"list",runList:$d}),i&&!Vt?l.jsxs("div",{className:"pb-action-bar","data-screen-label":"Builder action bar",children:[l.jsx("button",{className:"pb-action-bar__status",onClick:()=>{Mi!==null?wi(ws(Mi)):kt(!0)},type:"button",children:Oe.length>0?`${Ua} · tap to fix`:`ready · ${ke.text.length.toLocaleString()} chars · preview ›`}),l.jsx("button",{className:`pb-cta pb-cta--md${Oe.length>0?" pb-cta--outline":""}`,onClick:()=>{Oe.length>0?kt(!0):ba()},type:"button",children:Oe.length>0?"preview ›":wn})]}):null,ec,Kt!==null?l.jsx("div",{className:`pb-toast${Vt?" pb-toast--preview":""}${i?" pb-toast--phone":""}`,"data-screen-label":"Builder toast",children:l.jsxs("div",{className:"pb-toast__pill",role:"status",children:[l.jsx("span",{className:"pb-toast__msg",children:Kt.message}),Kt.undoable?l.jsx("button",{className:"pb-toast__undo",onClick:gs,title:"undo · 7 seconds",type:"button",children:"undo"}):null,l.jsx("button",{"aria-label":"dismiss",className:"pb-toast__dismiss",onClick:()=>{wt.current!==null&&window.clearTimeout(wt.current),sn(null)},type:"button",children:"×"})]})}):null,l.jsx(Lh,{announcement:Be})]})}function bu(t,a){return t>0?"err":a>0?"pending":"ready"}function vy(t,a){return t.cli===""&&t.model===""&&t.effort===""?a:(t.cli||a)+(t.model!==""?` ${t.model}`:"")+(t.effort!==""?` @${t.effort}`:"")}function ai({pill:t,phone:a=!1,caretOnly:i=!1}){const r=t.value!==""?t.value:t.empty,c=t.state==="err"?" pb-pill--err":t.state==="open"?" pb-pill--open":t.state==="miss"?" pb-pill--miss":"";return l.jsxs("button",{"aria-expanded":t.on,"aria-haspopup":"listbox","aria-label":t.aria,className:`${a?"pb-cell":"pb-pill"}${c}${i?" pb-pill--caret":""}`,onClick:t.go,title:t.title===""?void 0:t.title,type:"button",children:[i?null:l.jsxs(l.Fragment,{children:[t.label!==""?l.jsx("span",{className:"pb-pill__label",children:t.label}):null,l.jsx("span",{className:"pb-pill__value","data-default":t.isDefault?"true":void 0,children:r})]}),l.jsx("span",{"aria-hidden":"true",className:"pb-pill__caret",children:"▾"})]})}function lh({cell:t}){const a=t.value!==""?t.value:t.empty,i=t.state==="err"?" pb-cell--err":t.state==="open"?" pb-cell--open":t.state==="miss"?" pb-cell--miss":"";return l.jsxs("button",{"aria-expanded":t.on,"aria-haspopup":"listbox","aria-label":t.aria,className:`pb-cell pb-cell--flow${i}`,onClick:t.go,title:t.title===""?void 0:t.title,type:"button",children:[l.jsx("span",{className:"pb-cell__label",children:t.cellLabel}),l.jsx("span",{className:"pb-cell__value","data-default":t.isDefault?"true":void 0,children:a}),l.jsx("span",{"aria-hidden":"true",className:"pb-cell__caret",children:"▾"})]})}const XT=t=>(document.addEventListener("visibilitychange",t),()=>{document.removeEventListener("visibilitychange",t)}),by=()=>document.visibilityState==="visible";function E0(){return b.useSyncExternalStore(XT,by,by)}function kd(t,a,i,r){const c=E0(),p=a||i&&!r&&c;b.useEffect(()=>{if(!p)return;let h=!1;return t.start().finally(()=>{!h&&!a&&t.stop()}),()=>{h=!0,t.stop()}},[a,t,p])}function PT(t,a=!0,i=!1){const r=b.useSyncExternalStore(t.subscribe,t.getState,t.getState);return kd(t,a,i,r.lastRefreshAtMs!==null),r}function QT(t,a=!0,i=!1){const r=b.useSyncExternalStore(t.subscribe,t.getState,t.getState);return kd(t,a,i,r.lastRefreshAtMs!==null),r}function JT(t,a=!0,i=!1){const r=b.useSyncExternalStore(t.subscribe,t.getState,t.getState);return kd(t,a,i,r.lastRefreshAtMs!==null),r}function WT(t,a=!0,i=!1){const r=b.useSyncExternalStore(t.subscribe,t.getState,t.getState);return kd(t,a,i,r.lastRefreshAtMs!==null),r}const eC=/%(?:2f|5c|00)/i,tC=/%[0-9a-f]{2}/i,Sr=/^[A-Za-z0-9_-]{1,64}$/,ta=/^[A-Za-z0-9_-]{1,128}$/,nC=/^ctxop_\d{8}T\d{6}Z_[0-9a-f]{12}$/,aC=/^[A-Za-z0-9_-]{1,64}$/,sC=/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/;function lC(t){if(t==="/")return Object.freeze({kind:"runs"});if(!t.startsWith("/")||t.includes("?")||t.includes("#")||t.endsWith("/"))return;const a=iC(t);if(a!==void 0){if(a.length===1)switch(a[0]){case"runs":case"activities":case"workflows":case"adapters":case"artifacts":return Object.freeze({kind:a[0]});case"context-runs":return Object.freeze({kind:"context_runs"});case"progress-reports":return Object.freeze({kind:"progress_reports"});case"prompt-builder":return Object.freeze({kind:"prompt_builder"});default:return}if(a.length===2){const[i,r]=a;return i==="runs"&&r!==void 0&&Sr.test(r)?Object.freeze({kind:"run_detail",runId:r}):i==="activities"&&r!==void 0&&ta.test(r)?Object.freeze({kind:"activity_detail",activityId:r}):i==="context-runs"&&r!==void 0&&T0(r)?Object.freeze({kind:"context_run_detail",contextRunId:r}):i==="progress-reports"&&r!==void 0&&C0(r)?Object.freeze({kind:"progress_report_detail",progressReportId:r}):i==="workflows"&&r!==void 0&&ta.test(r)?Object.freeze({kind:"workflow_detail",workflowName:r}):i==="adapters"&&r!==void 0&&ta.test(r)?Object.freeze({kind:"adapter_detail",adapterName:r}):void 0}if(a.length===6&&a[0]==="runs"&&Sr.test(a[1]??"")&&a[2]==="stages"&&ta.test(a[3]??"")&&a[4]==="calls"&&ta.test(a[5]??""))return Object.freeze({kind:"run_call",runId:a[1],stageId:a[3],callId:a[5]});if(a.length===4&&a[0]==="artifacts"&&Sr.test(a[1]??"")&&ta.test(a[2]??"")&&ta.test(a[3]??""))return Object.freeze({kind:"artifact_reference",runId:a[1],stageId:a[2],callId:a[3]})}}function rd(t){switch(t.kind){case"runs":return"/runs";case"run_detail":return`/runs/${Ca(t.runId,Sr,"runId")}`;case"run_call":return["/runs",Ca(t.runId,Sr,"runId"),"stages",Ca(t.stageId,ta,"stageId"),"calls",Ca(t.callId,ta,"callId")].join("/");case"activities":return"/activities";case"activity_detail":return`/activities/${Ca(t.activityId,ta,"activityId")}`;case"context_runs":return"/context-runs";case"context_run_detail":return`/context-runs/${Ca(t.contextRunId,{test:T0},"contextRunId")}`;case"progress_reports":return"/progress-reports";case"progress_report_detail":return`/progress-reports/${Ca(t.progressReportId,{test:C0},"progressReportId")}`;case"workflows":return"/workflows";case"workflow_detail":return`/workflows/${Ca(t.workflowName,ta,"workflowName")}`;case"adapters":return"/adapters";case"adapter_detail":return`/adapters/${Ca(t.adapterName,ta,"adapterName")}`;case"artifacts":return"/artifacts";case"prompt_builder":return"/prompt-builder";case"artifact_reference":return["/artifacts",Ca(t.runId,Sr,"runId"),Ca(t.stageId,ta,"stageId"),Ca(t.callId,ta,"callId")].join("/")}}function iC(t){const a=[];for(const i of t.slice(1).split("/")){if(i.length===0||i.includes("\\")||i.includes("\0")||eC.test(i))return;let r;try{r=decodeURIComponent(i)}catch{return}if(r==="."||r===".."||r.includes("/")||r.includes("\\")||r.includes("\0")||tC.test(r))return;a.push(r)}return Object.freeze(a)}function Ca(t,a,i){if(!a.test(t))throw new TypeError(`invalid dashboard browser route ${i}`);return encodeURIComponent(t)}function T0(t){if(!aC.test(t)||t.startsWith("wfctx")||t.startsWith("wfpre"))return!1;if(!nC.test(t))return!0;const a=t.slice(6,22),i=[a.slice(0,4),"-",a.slice(4,6),"-",a.slice(6,8),"T",a.slice(9,11),":",a.slice(11,13),":",a.slice(13,15),".000Z"].join(""),r=new Date(i);return!Number.isNaN(r.getTime())&&r.toISOString()===i}function C0(t){return sC.test(t)}function rC(t){switch(t.kind){case"runs":case"run_detail":case"run_call":return"runs";case"activities":case"activity_detail":return"activities";case"context_runs":case"context_run_detail":return"context_runs";case"progress_reports":case"progress_report_detail":return"progress_reports";case"workflows":case"workflow_detail":return"workflows";case"adapters":case"adapter_detail":return"adapters";case"artifacts":case"artifact_reference":return"artifacts";case"prompt_builder":return"prompt_builder"}}function oC(t){switch(t){case"runs":return{kind:"runs"};case"activities":return{kind:"activities"};case"context_runs":return{kind:"context_runs"};case"progress_reports":return{kind:"progress_reports"};case"workflows":return{kind:"workflows"};case"adapters":return{kind:"adapters"};case"artifacts":return{kind:"artifacts"};case"prompt_builder":return{kind:"prompt_builder"}}}function cC(t){return rd(oC(t))}function uC(t){switch(t.kind){case"run_detail":return{kind:"run",runId:t.runId};case"run_call":return{kind:"run_call",runId:t.runId,stageId:t.stageId,callId:t.callId};case"activity_detail":return{kind:"activity",activityId:t.activityId};case"context_run_detail":return{kind:"context_run",contextRunId:t.contextRunId};case"progress_report_detail":return{kind:"progress_report",progressReportId:t.progressReportId};case"workflow_detail":return{kind:"workflow",workflowName:t.workflowName};case"adapter_detail":return{kind:"adapter",adapterName:t.adapterName};case"artifact_reference":return{kind:"artifact_reference",runId:t.runId,stageId:t.stageId,callId:t.callId};default:return null}}function To(t){const a=lC(t);return a===void 0?{kind:"not_found",rawPath:t}:{kind:"resolved",route:a,destination:rC(a),canonicalPath:rd(a),selection:uC(a)}}function yu(t){return{kind:"run_detail",runId:t}}function yy(t,a,i){return{kind:"run_call",runId:t,stageId:a,callId:i}}function ih(t){return{kind:"activity_detail",activityId:t}}function xy(t){return{kind:"context_run_detail",contextRunId:t}}function wy(t){return{kind:"progress_report_detail",progressReportId:t}}function jy(t){return{kind:"workflow_detail",workflowName:t}}function rh(t){return{kind:"adapter_detail",adapterName:t}}function dC(t,a,i){return{kind:"artifact_reference",runId:t,stageId:a,callId:i}}function xu(){return window.location.pathname}function Sy(t){return{clinkxRoute:t}}function fC(){const[t,a]=b.useState(()=>To(xu())),i=b.useRef(t);i.current=t,b.useEffect(()=>{const h=xu(),v=To(h);v.kind==="resolved"&&v.canonicalPath!==h&&window.history.replaceState(Sy(v.canonicalPath),"",v.canonicalPath),a(v)},[]),b.useEffect(()=>{const h=()=>{a(To(xu()))};return window.addEventListener("popstate",h),()=>window.removeEventListener("popstate",h)},[]);const r=b.useCallback((h,v)=>{if(h===xu()){a(To(h));return}const m=Sy(h);v==="push"?window.history.pushState(m,"",h):window.history.replaceState(m,"",h),a(To(h))},[]),c=b.useCallback(h=>{r(cC(h),"push")},[r]),f=b.useCallback(h=>{r(rd(h),"push")},[r]),p=b.useCallback(h=>{r(rd(h),"replace")},[r]);return{resolution:t,navigateToDestination:c,pushRoute:f,replaceRoute:p}}function Ny(t){return t??new AbortController().signal}async function ky(t,a,i){let r;try{r=await t(a,{signal:i})}catch(c){throw c instanceof bt?new we("connection_changed",409,"agent_instance_changed"):i.aborted||c instanceof DOMException&&c.name==="AbortError"?new we("aborted"):new we("offline")}if(r.status===401)throw new we("auth_expired",401,"unauthorized");if(!r.ok)throw new we("request_error",r.status);try{return await na(r)}catch(c){throw c instanceof bt?new we("connection_changed",409,"agent_instance_changed"):new we("request_error",r.status)}}function pC(t=hs){return{async listWorkflows(a){return await ky(t,"/api/workflows",Ny(a))},async listAdapters(a){return await ky(t,"/api/adapters",Ny(a))}}}const hC=2e3;function mC(t){return{phase:"initial_loading",live:[],history:[],nextBefore:void 0,historyPage:0,canGoNewer:!1,canGoOlder:!1,selected:null,detail:null,lastRefreshAtMs:null,displayNowMs:t,serverOffsetMs:0,announcement:null}}function Ay(t,a){const i=t instanceof we?t.kind:"request_error";return i==="auth_expired"?"auth_expired":i==="connection_changed"?"connection_changed":i==="offline"?"offline":a?"stale":"error"}function gC(t){let a=mC(Date.now()),i=null,r=null,c=!1,f=!1,p=0,h=[void 0],v=0,m=0;const x=new Set,y=_r(),E=B=>{a=B;for(const q of x)q()},S=()=>{i!==null&&clearTimeout(i),i=null},C=()=>{S(),!(c||a.phase==="auth_expired"||a.phase==="connection_changed"||a.phase==="error"||document.visibilityState!=="visible")&&(i=setTimeout(()=>{M()},hC))},T=B=>({runId:B.runId,runGeneration:B.runGeneration,stateRevision:B.stateRevision}),N=async(B,q=!1)=>{const Z=y.begin(B);try{const ae=q&&t.getRunDetailForPolling!==void 0?await t.getRunDetailForPolling(B,Z.signal):await t.getRunDetail(B,Z.signal);return y.acceptsDetail(Z.identity,ae)?ae:null}catch(ae){if(!y.isActive(Z.identity))return null;throw ae}},M=async(B=h)=>{if(c||document.visibilityState!=="visible")return!1;S(),r?.abort(),y.cancel();const q=++p,Z=v,ae=++m,oe=new AbortController;r=oe;const P=Date.now(),ue=[...B];try{let _e=ue[ue.length-1],me=await t.listRuns(_e===void 0?{signal:oe.signal}:{before:_e,signal:oe.signal}),be=!1;for(;me.history.length===0&&ue.length>1;)ue.pop(),be=!0,_e=ue[ue.length-1],me=await t.listRuns(_e===void 0?{signal:oe.signal}:{before:_e,signal:oe.signal});if(c||oe.signal.aborted||q!==p)return!1;const ve=Date.now(),$=Date.parse(me.serverNow),ee=P+(ve-P)/2,ce=Number.isFinite($)?$-ee:a.serverOffsetMs,de=ve+ce,ye=[...me.live,...me.history];let j=a.selected,L=a.detail,U=!1,Q=be?"The previous page was pruned. Showing the nearest newer history page.":null;const he=a.selected!==null&&a.live.some(ge=>ge.runId===a.selected?.runId&&ge.runGeneration===a.selected.runGeneration);if(j!==null&&Z===v){const ge=ye.find(Se=>Se.runId===j?.runId&&Se.runGeneration===j.runGeneration),Ve=ye.find(Se=>Se.runId===j?.runId);if(ge!==void 0?j=T(ge):Ve!==void 0&&(j=null,L=null,Q="Run generation changed. Select the replacement deliberately to inspect it."),j!==null)try{U=!0;const Se=await N(j,!0);if(Se===null||c||oe.signal.aborted||q!==p||ae!==m)return!1;L=Se,j=T(Se);const Re=me.live.some(Pe=>Pe.runId===Se.runId&&Pe.runGeneration===Se.runGeneration);he&&!Re&&Se.availability==="available"&&Se.status!=="pending"&&Se.status!=="running"&&(Q="Selected run moved to history.")}catch(Se){if(ae!==m)return!1;if(Se instanceof we&&Se.code==="run_generation_changed")j=null,L=null,Q="Run generation changed. Select the replacement deliberately to inspect it.";else if(Se instanceof we&&Se.status===404)j=null,L=null,Q="The selected run is no longer available.";else throw Se}}if(c||oe.signal.aborted||q!==p||U&&ae!==m)return!1;h=ue;const F=Z!==v;return E({...a,phase:F?a.phase:"current",live:me.live,history:me.history,nextBefore:me.nextBefore,canGoOlder:me.nextBefore!==void 0,historyPage:ue.length-1,canGoNewer:ue.length>1,selected:F?a.selected:j,detail:F?a.detail:L,lastRefreshAtMs:de,displayNowMs:de,serverOffsetMs:ce,announcement:F?a.announcement:Q}),!0}catch(_e){return c||oe.signal.aborted||q!==p||ae!==m||Z!==v||E({...a,phase:Ay(_e,a.lastRefreshAtMs!==null)}),!1}finally{!c&&q===p&&C()}},k=()=>{document.visibilityState==="visible"?M():(S(),r?.abort(),m+=1,y.cancel())},z=()=>{document.visibilityState==="visible"&&M()},R=()=>{f&&(f=!1,p+=1,m+=1,S(),r?.abort(),r=null,y.cancel(),document.removeEventListener("visibilitychange",k),window.removeEventListener("focus",z))};return{async start(){f||c||(f=!0,document.addEventListener("visibilitychange",k),window.addEventListener("focus",z),await M())},stop:R,dispose(){c||(R(),c=!0,x.clear())},getState(){return a},subscribe(B){return x.add(B),()=>x.delete(B)},async retry(){await M()},runGenerationChanged(){c||a.selected===null||(v+=1,m+=1,y.cancel(),E({...a,phase:"current",selected:null,detail:null,announcement:"Run generation changed. Select the replacement deliberately to inspect it."}))},async select(B){if(c)return;v+=1;const q=++m,Z=T(B);E({...a,selected:Z,detail:null,announcement:null});try{const ae=await N(Z);ae!==null&&!c&&q===m&&E({...a,selected:T(ae),detail:ae})}catch(ae){if(c||q!==m||ae instanceof we&&ae.kind==="aborted")return;if(ae instanceof we&&ae.code==="run_generation_changed"){E({...a,phase:"current",selected:null,detail:null,announcement:"Run generation changed. Select the replacement deliberately to inspect it."});return}if(ae instanceof we&&ae.status===404){E({...a,phase:"current",selected:null,detail:null,announcement:"The selected run is no longer available."});return}E({...a,phase:Ay(ae,a.lastRefreshAtMs!==null)})}},async older(){c||a.nextBefore===void 0||await M([...h,a.nextBefore])},async newer(){c||h.length<=1||await M(h.slice(0,-1))}}}function _C(t){return t??new AbortController().signal}function Ry(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function kl(t){if(typeof t!="string"||t.length===0)throw new we("request_error",200);return t}function vC(t){if(!Ry(t)||!Ry(t.childConfig))throw new we("request_error",200);const a=t.childConfig,i=a.source==="ambient"&&a.configured===!1?{source:"ambient",configured:!1}:a.source==="explicit"&&a.configured===!0?{source:"explicit",configured:!0,path:kl(a.path)}:(()=>{throw new we("request_error",200)})();return{stateDir:kl(t.stateDir),...t.activitiesRoot===void 0?{}:{activitiesRoot:kl(t.activitiesRoot)},...t.progressReportsRoot===void 0?{}:{progressReportsRoot:kl(t.progressReportsRoot)},runsRoot:kl(t.runsRoot),workspaceRoot:kl(t.workspaceRoot),workflowsPath:kl(t.workflowsPath),templatesPath:kl(t.templatesPath),childConfig:i}}function bC(t=hs){return{async getEnvironment(a){const i=_C(a);let r;try{r=await t("/api/env",{signal:i})}catch(c){throw c instanceof bt?new we("connection_changed",409,"agent_instance_changed"):i.aborted||c instanceof DOMException&&c.name==="AbortError"?new we("aborted"):new we("offline")}if(r.status===401)throw new we("auth_expired",401,"unauthorized");if(!r.ok)throw new we("request_error",r.status);try{return vC(await na(r))}catch(c){throw c instanceof we?c:c instanceof bt?new we("connection_changed",409,"agent_instance_changed"):new we("request_error",r.status)}}}}const yC=2e3,xC=Object.freeze({phase:"current",detailPhase:"idle",activities:Object.freeze([]),selected:null,detail:null,lastRefreshAtMs:null,announcement:null,displayNowMs:0,serverOffsetMs:0});function wC(){return Object.freeze({async start(){},stop(){},dispose(){},getState:()=>xC,subscribe:()=>()=>{},async retry(){},async select(){},clearSelection(){}})}function wu(t){return{activityId:t.activityId,activityGeneration:t.activityGeneration,stateRevision:t.stateRevision}}function Ey(t,a){const i=t instanceof we?t.kind:"request_error";return i==="auth_expired"?"auth_expired":i==="connection_changed"?"connection_changed":i==="offline"?"offline":a?"stale":"error"}function jC(t){let a={phase:"initial_loading",detailPhase:"idle",activities:[],selected:null,detail:null,lastRefreshAtMs:null,announcement:null,displayNowMs:0,serverOffsetMs:0},i=!1,r=!1,c=0,f=0,p=null,h=null;const v=new Set,m=k=>{a=k;for(const z of v)z()},x=()=>{p!==null&&clearTimeout(p),p=null},y=()=>{x(),!(r||a.phase==="auth_expired"||a.phase==="connection_changed"||a.phase==="error"||document.visibilityState!=="visible")&&(p=setTimeout(()=>{C()},yC))},E=(k,z)=>!r&&h===z&&!z.signal.aborted&&k===c,S=(k,z)=>!r&&h===z&&!z.signal.aborted&&k===f,C=async()=>{if(r||document.visibilityState!=="visible")return!1;x(),h?.abort();const k=++c,z=f,R=new AbortController;h=R;const B=Date.now();try{const q=await t.listActivities({signal:R.signal});if(!E(k,R))return!1;const Z=Date.now();let ae=a.selected,oe=a.detail,P=a.detailPhase,ue=null;if(ae!==null&&z===f){const $=q.activities.find(ce=>ce.activityId===ae?.activityId&&ce.activityGeneration===ae.activityGeneration),ee=q.activities.find(ce=>ce.activityId===ae?.activityId);if($===void 0&&ee!==void 0)ae=null,oe=null,P="idle",ue="Activity generation changed. Select the replacement deliberately.";else{$!==void 0&&(ae=wu($));try{if(oe=await(t.getActivityDetailForPolling??t.getActivityDetail)(ae,R.signal),!E(k,R))return!1;ae=wu(oe),P="loaded"}catch(ce){if(!E(k,R))return!1;if(ce instanceof we&&(ce.code==="activity_generation_changed"||ce.code==="activity_state_changed"||ce.status===404))ae=null,oe=null,P="idle",ue="The selected activity changed or is no longer retained.";else throw ce}}}if(!E(k,R))return!1;const _e=Date.parse(q.serverNow),me=B+(Z-B)/2,be=Number.isFinite(_e)?_e-me:a.serverOffsetMs,ve=Z+be;return m({phase:"current",detailPhase:P,activities:q.activities,selected:ae,detail:oe,lastRefreshAtMs:ve,displayNowMs:ve,serverOffsetMs:be,announcement:ue}),!0}catch(q){return E(k,R)&&m({...a,phase:Ey(q,a.lastRefreshAtMs!==null)}),!1}finally{!r&&k===c&&y()}},T=()=>{document.visibilityState==="visible"?C():(x(),h?.abort(),h=null)},N=()=>{document.visibilityState==="visible"&&C()},M=()=>{i&&(i=!1,c+=1,f+=1,x(),h?.abort(),h=null,document.removeEventListener("visibilitychange",T),window.removeEventListener("focus",N))};return{async start(){i||r||(i=!0,document.addEventListener("visibilitychange",T),window.addEventListener("focus",N),await C())},stop:M,dispose(){r||(M(),r=!0,v.clear())},getState(){return a},subscribe(k){return v.add(k),()=>v.delete(k)},async retry(){await C()},async select(k){if(r)return;h?.abort();const z=++f,R=new AbortController;h=R;const B=wu(k);m({...a,selected:B,detail:null,detailPhase:"loading",announcement:null});try{const q=await t.getActivityDetail(B,R.signal);S(z,R)&&m({...a,selected:wu(q),detail:q,detailPhase:"loaded"})}catch(q){if(!S(z,R)||q instanceof we&&q.kind==="aborted")return;if(q instanceof we&&(q.code==="activity_generation_changed"||q.code==="activity_state_changed"||q.status===404)){m({...a,selected:null,detail:null,detailPhase:"idle",announcement:"The selected activity changed or is no longer retained."});return}m({...a,phase:Ey(q,a.lastRefreshAtMs!==null),detailPhase:"error"})}},clearSelection(){f+=1,h?.abort(),h=null,m({...a,selected:null,detail:null,detailPhase:"idle",announcement:null})}}}const SC=3e3,NC=Object.freeze({phase:"current",detailPhase:"idle",contextRuns:Object.freeze([]),selectedId:null,detail:null,lastRefreshAtMs:null,displayNowMs:0,serverOffsetMs:0,announcement:null});function kC(){return Object.freeze({async start(){},stop(){},dispose(){},getState:()=>NC,subscribe:()=>()=>{},async retry(){},async select(){},clearSelection(){}})}function Ty(t,a){const i=t instanceof we?t.kind:"request_error";return i==="auth_expired"?"auth_expired":i==="connection_changed"?"connection_changed":i==="offline"?"offline":a?"stale":"error"}function is(t,a){if(a!==null)return t.find(i=>i.id===a)}function Cy(t,a){return Ka(t.lifecycle?.status)&&!Ka(a.lifecycle?.status)?t:Object.freeze({...t,lifecycle:a.lifecycle,orphaned:a.orphaned,liveness:a.liveness})}function Oy(t,a,i){const r=t?.contextGeneration===i.contextGeneration?t.lifecycle?.status:a?.contextGeneration===i.contextGeneration?a.lifecycle?.status:void 0,c=i.lifecycle?.status;return od(r)&&c!==void 0&&!od(c)}function od(t){return t==="pending"||t==="running"}function Ka(t){return t!==void 0&&!od(t)}function AC(t){let a={phase:"initial_loading",detailPhase:"idle",contextRuns:[],selectedId:null,detail:null,lastRefreshAtMs:null,displayNowMs:0,serverOffsetMs:0,announcement:null},i=!1,r=!1,c=0,f=0,p=null,h=null,v=null,m=0,x,y,E,S=!0;const C=new Set,T=Z=>{a=Z;for(const ae of C)ae()},N=()=>{p!==null&&clearTimeout(p),p=null},M=()=>{N(),!(r||a.phase==="auth_expired"||a.phase==="connection_changed"||a.phase==="error"||document.visibilityState!=="visible")&&(p=setTimeout(()=>{z()},SC))},k=async(Z,ae,oe,P)=>{const ue=is(a.contextRuns,Z),_e=f,me=E,be=ue?.contextGeneration===ae&&Ka(ue?.lifecycle?.status)||oe?.contextGeneration===ae&&Ka(oe?.lifecycle?.status)||me?.contextRunId===Z&&me.expectedGeneration===ae&&me.requiresTerminalAudit,ve=++m;v?.abort();const $=new AbortController;v=$;const ee=de=>{if(de===null||f<=_e)return de;const ye=is(a.contextRuns,Z);return ye?.contextGeneration===de.contextGeneration?Cy(de,ye):de},ce=de=>{if(de===void 0)return!1;const ye=is(a.contextRuns,Z),j=a.detail?.id===Z?a.detail:null;return ae===de&&be||ye?.contextGeneration===de&&Ka(ye.lifecycle?.status)||j?.contextGeneration===de&&Ka(j.lifecycle?.status)};try{const de=await t.getContextRunDetail(Z,$.signal);if(r||$.signal.aborted||ve!==m||a.selectedId!==Z)return;const j=is(a.contextRuns,Z)?.contextGeneration??x??ae;if(j!==void 0&&de.contextGeneration!==j){if(j!==ae){const Q=a.detail?.id===Z&&a.detail.contextGeneration===j?a.detail:null;if(x=j,E={contextRunId:Z,expectedGeneration:j,requiresTerminalAudit:ce(j)},P&&S){S=!1,await k(Z,j,Q,!1);return}T({...a,detail:Q,detailPhase:"error",announcement:"Context run generation changed again. Retry to inspect the current incarnation."});return}E={contextRunId:Z,expectedGeneration:j,requiresTerminalAudit:ce(j)},T({...a,detail:null,detailPhase:"error",announcement:"Context run generation changed again. Retry to inspect the current incarnation."});return}const L=a.detail?.id===Z&&a.detail.contextGeneration===de.contextGeneration?a.detail:oe?.contextGeneration===de.contextGeneration?oe:null;if(ce(de.contextGeneration)&&od(de.lifecycle?.status)){if(x=de.contextGeneration,E={contextRunId:Z,expectedGeneration:de.contextGeneration,requiresTerminalAudit:!0},!be&&P&&S){S=!1,await k(Z,de.contextGeneration,oe,!1);return}T({...a,detail:ee(L),detailPhase:"error",announcement:"Context run reached a terminal state, but its audited detail is not available yet. Retry to inspect it."});return}const U=ee(de)??de;x=de.contextGeneration,y=void 0,E=void 0,S=!0,T({...a,selectedId:U.id,detail:U,detailPhase:"loaded",announcement:null})}catch(de){if($.signal.aborted||ve!==m||de instanceof we&&de.kind==="aborted")return;if(de instanceof we&&(de.code==="not_found"||de.status===404)){y=a.lastRefreshAtMs!==null&&is(a.contextRuns,Z)===void 0?f:void 0,E=void 0,S=!0,T({...a,selectedId:Z,detail:null,detailPhase:"not_found",announcement:"The selected context run is no longer retained."});return}const j=is(a.contextRuns,Z)?.contextGeneration??x??ae,L=oe!==null&&(j===void 0||oe.contextGeneration===j)?oe:null,U=a.detail?.id===Z&&(j===void 0||a.detail.contextGeneration===j)?a.detail:L,Q=ee(U);E={contextRunId:Z,expectedGeneration:j,requiresTerminalAudit:ce(j)},T({...a,phase:Ty(de,a.lastRefreshAtMs!==null),detail:Q,detailPhase:"error",announcement:null})}},z=async(Z=!0)=>{if(r||document.visibilityState!=="visible")return!1;N(),h?.abort();const ae=++c,oe=new AbortController;h=oe;try{const P=Date.now(),ue=await t.listContextRuns({signal:oe.signal});if(r||oe.signal.aborted||ae!==c)return!1;f=ae;const _e=Date.now(),me=Date.parse(ue.serverNow),be=P+(_e-P)/2,ve=Number.isFinite(me)?me-be:a.serverOffsetMs,$=_e+ve;let ee=null,ce=a.detail,de=a.detailPhase;const ye=a.selectedId;let j;if(ye!==null){const L=is(ue.contextRuns,ye);if(L!==void 0){const U=is(a.contextRuns,ye),Q=ce?.contextGeneration??U?.contextGeneration??x;x=L.contextGeneration;const he=E;if(Ka(L.lifecycle?.status)&&he?.contextRunId===ye&&(he.expectedGeneration===void 0||he.expectedGeneration===L.contextGeneration)&&(E={contextRunId:ye,expectedGeneration:L.contextGeneration,requiresTerminalAudit:!0}),de==="not_found")y!==void 0?ae>y?(y=void 0,m+=1,v?.abort(),ce=null,de="loading",j={expectedGeneration:L.contextGeneration,retainedDetail:null,requiresTerminalAudit:Ka(L.lifecycle?.status)}):ae===y&&(y=void 0):Q!==void 0&&Q!==L.contextGeneration&&(m+=1,v?.abort(),ce=null,de="loading",j={expectedGeneration:L.contextGeneration,retainedDetail:null,requiresTerminalAudit:Ka(L.lifecycle?.status)});else if(Q!==void 0&&Q!==L.contextGeneration)m+=1,v?.abort(),ce=null,de="loading",j={expectedGeneration:L.contextGeneration,retainedDetail:null,requiresTerminalAudit:Ka(L.lifecycle?.status)},ee="Context run generation changed. Reloading the current incarnation.";else if(ce!==null&&ce.contextGeneration===L.contextGeneration){const F=de==="loaded"&&Oy(U,ce,L);ce=Cy(ce,L);const ge=E?.contextRunId===ye&&(E.expectedGeneration===void 0||E.expectedGeneration===L.contextGeneration);de=de==="loading"&&ge?"loading":ge?"error":"loaded",F&&(m+=1,v?.abort(),j={expectedGeneration:L.contextGeneration,retainedDetail:ce,requiresTerminalAudit:!0})}else ce===null&&de==="loading"&&(Oy(U,null,L)||U===void 0&&a.lastRefreshAtMs!==null)&&(m+=1,v?.abort(),j={expectedGeneration:L.contextGeneration,retainedDetail:null,requiresTerminalAudit:Ka(L.lifecycle?.status)})}}if(j!==void 0&&ye!==null){const L=j;x=L.expectedGeneration,Z&&S?(S=!1,E=void 0):(E={contextRunId:ye,expectedGeneration:L.expectedGeneration,requiresTerminalAudit:L.requiresTerminalAudit},ce=L.retainedDetail,de="error",ee="Context run detail changed. Retry to inspect the current incarnation.",j=void 0)}return T({phase:"current",detailPhase:de,contextRuns:ue.contextRuns,selectedId:ye,detail:ce,lastRefreshAtMs:$,displayNowMs:$,serverOffsetMs:ve,announcement:ee}),ye!==null&&a.selectedId===ye&&j!==void 0&&await k(ye,j.expectedGeneration,j.retainedDetail,!1),!0}catch(P){return r||oe.signal.aborted||ae!==c||T({...a,phase:Ty(P,a.lastRefreshAtMs!==null)}),!1}finally{!r&&ae===c&&M()}},R=()=>{document.visibilityState==="visible"?z():(N(),h?.abort())},B=()=>{document.visibilityState==="visible"&&z()},q=()=>{i&&(i=!1,c+=1,N(),h?.abort(),h=null,m+=1,v?.abort(),v=null,document.removeEventListener("visibilitychange",R),window.removeEventListener("focus",B))};return{async start(){i||r||(i=!0,document.addEventListener("visibilitychange",R),window.addEventListener("focus",B),await z())},stop:q,dispose(){r||(q(),r=!0,C.clear())},getState(){return a},subscribe(Z){return C.add(Z),()=>C.delete(Z)},async retry(){if(!await z(!1))return;const Z=E;if(Z===void 0||a.selectedId!==Z.contextRunId)return;const oe=is(a.contextRuns,Z.contextRunId)?.contextGeneration??x??Z.expectedGeneration,P=Z.requiresTerminalAudit&&Z.expectedGeneration===oe;x=oe,E={contextRunId:Z.contextRunId,expectedGeneration:oe,requiresTerminalAudit:P};const ue=a.detail?.id===Z.contextRunId&&(oe===void 0||a.detail.contextGeneration===oe)?a.detail:null;T({...a,detail:ue,detailPhase:"loading",announcement:null}),await k(Z.contextRunId,oe,ue,!1)},async select(Z){if(r)return;const ae=a.selectedId,oe=a.detail?.id===Z?a.detail:null,P=is(a.contextRuns,Z)?.contextGeneration??oe?.contextGeneration??(ae===Z?x:void 0);(ae!==Z||x!==void 0&&P!==void 0&&x!==P)&&(E=void 0),x=P,y=void 0,S=!0,T({...a,selectedId:Z,detail:oe,detailPhase:oe===null?"loading":"loaded",announcement:null}),await k(Z,x,oe,!0)},clearSelection(){m+=1,v?.abort(),x=void 0,y=void 0,E=void 0,S=!0,T({...a,selectedId:null,detail:null,detailPhase:"idle",announcement:null})}}}const RC=3e3,EC=Object.freeze({phase:"current",progressReports:Object.freeze([]),truncated:!1,selectedId:null,detail:null,detailPhase:"idle",omittedSections:Object.freeze([]),publishedSessionStatus:null,unreadableReason:null,lastRefreshAtMs:null,displayNowMs:0,serverOffsetMs:0,announcement:null});function TC(){return Object.freeze({async start(){},stop(){},dispose(){},getState:()=>EC,subscribe:()=>()=>{},async retry(){},async select(){},clearSelection(){},async setStatusOverride(){}})}function ju(t,a){const i=t instanceof we?t.kind:"request_error";return i==="auth_expired"?"auth_expired":i==="connection_changed"?"connection_changed":i==="offline"?"offline":a?"stale":"error"}function oh(t,a,i,r){const c=Date.parse(t),f=a+(i-a)/2,p=Number.isFinite(c)?c-f:r;return{serverOffsetMs:p,alignedNowMs:i+p}}function CC(t){let a={phase:"initial_loading",progressReports:[],truncated:!1,selectedId:null,detail:null,detailPhase:"idle",omittedSections:[],publishedSessionStatus:null,unreadableReason:null,lastRefreshAtMs:null,displayNowMs:0,serverOffsetMs:0,announcement:null},i=!1,r=!1,c=0,f=null,p=null;const h=new Set,v=k=>{a=k;for(const z of h)z()},m=()=>{f!==null&&clearTimeout(f),f=null},x=()=>{m(),!(r||a.phase==="auth_expired"||a.phase==="connection_changed"||a.phase==="error"||document.visibilityState!=="visible")&&(f=setTimeout(()=>{S()},RC))},y=async()=>{if(r||document.visibilityState!=="visible")return!1;m(),p?.abort();const k=++c,z=new AbortController;p=z;try{const R=Date.now(),B=await t.listProgressReports({signal:z.signal});if(r||z.signal.aborted||k!==c)return!1;const q=Date.now(),{serverOffsetMs:Z,alignedNowMs:ae}=oh(B.serverNow,R,q,a.serverOffsetMs);return v({phase:"current",progressReports:B.progressReports,truncated:B.truncated,selectedId:a.selectedId,detail:a.detail,detailPhase:a.detailPhase,omittedSections:a.omittedSections,publishedSessionStatus:a.publishedSessionStatus,unreadableReason:a.unreadableReason,lastRefreshAtMs:ae,displayNowMs:ae,serverOffsetMs:Z,announcement:null}),!0}catch(R){return r||z.signal.aborted||k!==c||v({...a,phase:ju(R,a.lastRefreshAtMs!==null)}),!1}finally{!r&&k===c&&x()}},E=async()=>{if(r||document.visibilityState!=="visible"||a.selectedId===null)return!1;m(),p?.abort();const k=++c,z=new AbortController;p=z;const R=a.selectedId;try{const B=Date.now(),q=await t.getProgressReportDetail(R,z.signal);if(r||z.signal.aborted||k!==c)return!1;const Z=Date.now(),{serverOffsetMs:ae,alignedNowMs:oe}=oh(q.serverNow,B,Z,a.serverOffsetMs);return v({phase:"current",progressReports:a.progressReports,truncated:a.truncated,selectedId:q.progressReport.session.id,detail:q.progressReport,detailPhase:"loaded",omittedSections:q.omittedSections,publishedSessionStatus:q.publishedSessionStatus??null,unreadableReason:null,lastRefreshAtMs:oe,displayNowMs:oe,serverOffsetMs:ae,announcement:null}),!0}catch(B){if(r||z.signal.aborted||k!==c)return!1;const q=Xb(B);return q!==void 0?(v({...a,selectedId:R,detail:null,detailPhase:"not_found",unreadableReason:q,announcement:$y(q)}),!1):(v({...a,phase:ju(B,a.lastRefreshAtMs!==null),detailPhase:a.detail===null?"error":"stale"}),!1)}finally{!r&&k===c&&a.unreadableReason===null&&x()}},S=async()=>a.unreadableReason!==null?!1:a.selectedId===null?y():E(),C=()=>{document.visibilityState==="visible"?S():(m(),p?.abort())},T=()=>{document.visibilityState==="visible"&&S()},N=()=>{i&&(i=!1,c+=1,m(),p?.abort(),p=null,document.removeEventListener("visibilitychange",C),window.removeEventListener("focus",T))};return{async start(){i||r||(i=!0,(a.phase==="error"||a.phase==="offline")&&v({...a,phase:"initial_loading"}),document.addEventListener("visibilitychange",C),window.addEventListener("focus",T),await S())},stop:N,dispose(){r||(N(),r=!0,h.clear())},getState(){return a},subscribe(k){return h.add(k),()=>h.delete(k)},async retry(){a.unreadableReason!==null&&v({...a,detailPhase:a.selectedId===null?"idle":"loading",unreadableReason:null,announcement:null}),await S()},async select(k){if(r)return;m(),p?.abort(),c+=1;const z=++c,R=new AbortController;p=R,v({...a,selectedId:k,detail:null,detailPhase:"loading",omittedSections:[],publishedSessionStatus:null,unreadableReason:null,announcement:null});try{const B=Date.now(),q=await t.getProgressReportDetail(k,R.signal);if(!r&&!R.signal.aborted&&z===c){const Z=Date.now(),{serverOffsetMs:ae,alignedNowMs:oe}=oh(q.serverNow,B,Z,a.serverOffsetMs);v({phase:"current",progressReports:a.progressReports,truncated:a.truncated,selectedId:q.progressReport.session.id,detail:q.progressReport,detailPhase:"loaded",omittedSections:q.omittedSections,publishedSessionStatus:q.publishedSessionStatus??null,unreadableReason:null,lastRefreshAtMs:oe,displayNowMs:oe,serverOffsetMs:ae,announcement:null})}}catch(B){if(R.signal.aborted||z!==c||B instanceof we&&B.kind==="aborted")return;const q=Xb(B);if(q!==void 0){v({...a,selectedId:k,detail:null,detailPhase:"not_found",unreadableReason:q,announcement:$y(q)});return}v({...a,phase:ju(B,a.lastRefreshAtMs!==null),detailPhase:"error"})}finally{!r&&z===c&&a.unreadableReason===null&&x()}},clearSelection(){c+=1,m(),p?.abort(),v({...a,selectedId:null,detail:null,detailPhase:"idle",omittedSections:[],publishedSessionStatus:null,unreadableReason:null,announcement:null}),!r&&document.visibilityState==="visible"&&y()},async setStatusOverride(k,z){if(!r){m(),p?.abort(),c+=1;try{const R=await t.setStatusOverride(k,z);if(r)return;R.kind==="detail"&&M(k,R),await S()}catch(R){if(r)return;v({...a,phase:ju(R,a.lastRefreshAtMs!==null)}),a.unreadableReason===null&&x()}}}};function M(k,z){if(z.progressReport.session.id!==k)return;const R=z.publishedSessionStatus;v({...a,progressReports:a.progressReports.map(B=>B.id===k?OC(B,z.progressReport.session.status,R):B),...a.selectedId===k?{detail:z.progressReport,detailPhase:"loaded",omittedSections:z.omittedSections,publishedSessionStatus:R??null,unreadableReason:null}:{}})}}function OC(t,a,i){return Object.freeze({id:t.id,title:t.title,status:a,projectFolder:t.projectFolder,startedAt:t.startedAt,updatedAt:t.updatedAt,agentCount:t.agentCount,...t.taskCounts===void 0?{}:{taskCounts:t.taskCounts},...i===void 0?{}:{publishedStatus:i}})}function $y(t){switch(t){case"removed":return"The selected progress report is no longer available.";case"malformed":return"The selected progress report could not be parsed.";case"oversized":return"The selected progress report is too large to display in the dashboard."}}const $C=3e3,mr={runs:"Run monitor",activities:"Single calls",context_runs:"Context runs",progress_reports:"Progress reports",workflows:"Workflows",adapters:"Adapters",artifacts:"Artifacts",prompt_builder:"Prompt builder"};function My(t,a){const[i,r]=b.useState(0),[c,f]=b.useState({phase:"loading",rows:[]}),p=b.useRef(!1);return b.useEffect(()=>{if(!a||p.current)return;const h=new AbortController;return f(v=>({phase:"loading",rows:v.rows})),t(h.signal).then(v=>{h.signal.aborted||(p.current=!0,f({phase:"current",rows:v.rows}))}).catch(v=>{if(h.signal.aborted)return;p.current=!0;const m=v instanceof we&&(v.kind==="auth_expired"||v.kind==="connection_changed"||v.kind==="offline")?v.kind:"error";f(x=>({phase:m,rows:x.rows}))}),()=>h.abort()},[a,i,t]),{state:c,retry:()=>{p.current=!1,r(h=>h+1)}}}function Ly({kind:t,phase:a,retry:i}){if(a==="current")return null;if(a==="loading")return l.jsx(ed,{message:`Loading ${t} catalog…`,role:"status"});const r=a==="auth_expired"?`Authentication expired; the ${t} catalog was not loaded.`:a==="connection_changed"?`Connection changed; rebootstrap before loading the ${t} catalog.`:a==="offline"?`Offline; the ${t} catalog could not be loaded.`:`The ${t} catalog request failed.`,c=a==="auth_expired"||a==="connection_changed"?void 0:{label:`[ retry ${t} catalog ]`,run:i};return l.jsx(ed,{message:r,...c===void 0?{}:{retry:c},role:"alert"})}function O0({accountActions:t,applicationRootId:a="root",activityApi:i,activityController:r,artifactApi:c,catalogApi:f,contextRunsApi:p,contextRunsController:h,progressReportsApi:v,progressReportsController:m,controller:x,environmentApi:y,inspectorApi:E,resultApi:S,routeHydrationApi:C,sessionLogApi:T}){const N=fC(),M=N.resolution,k=M.kind==="not_found",z=M.kind==="resolved"?M:null,R=z?.destination??"runs",B=z?.selection??null,[q,Z]=b.useState(!1),[ae,oe]=b.useState(!1),[P,ue]=b.useState(!1),[_e,me]=b.useState(!1),[be]=b.useState(()=>Jx()),[ve]=b.useState(()=>gC(be)),[$]=b.useState(()=>jC(be)),[ee]=b.useState(()=>wC()),[ce]=b.useState(()=>p??l0()),[de]=b.useState(()=>AC(ce)),[ye]=b.useState(()=>kC()),[j]=b.useState(()=>v??BE()),[L]=b.useState(()=>CC(j)),[U]=b.useState(()=>TC()),[Q]=b.useState(()=>pC()),[he]=b.useState(()=>_1()),[F]=b.useState(()=>bC()),[ge]=b.useState(()=>kx()),Ve=y??F,[Se,Re]=b.useState(null),[Pe,Gt]=b.useState(0),[Vt,kt]=b.useState(!1),Xt=E0(),$t=x??ve,Pt=r??(x===void 0?$:ee),Qt=h??(x===void 0?de:ye),Kt=m??(x===void 0?L:U),sn=C??(x===void 0?be:void 0),Mn=i??be,ln=T??(x===void 0&&r===void 0&&h===void 0&&m===void 0?ge:void 0),Jt=Se!==null,lt=ie=>Jt&&(ie.lastRefreshAtMs!==null||ie.phase==="error"||ie.phase==="offline"||ie.phase==="stale"),Be=WT(Kt,R==="progress_reports",Jt),le=PT($t,R==="runs",lt(Be)),Ae=QT(Pt,R==="activities",lt(le)),Le=JT(Qt,R==="context_runs",lt(Ae)),qe=b.useRef(le.phase);b.useEffect(()=>{const ie=new AbortController;return kt(!1),Ve.getEnvironment(ie.signal).then(Ee=>{ie.signal.aborted||Re({stateDir:Ee.stateDir,...Ee.activitiesRoot===void 0?{}:{activitiesRoot:Ee.activitiesRoot},...Ee.progressReportsRoot===void 0?{}:{progressReportsRoot:Ee.progressReportsRoot},runsRoot:Ee.runsRoot,workspaceRoot:Ee.workspaceRoot,workflowsPath:Ee.workflowsPath,templatesPath:Ee.templatesPath,childConfig:Ee.childConfig.source==="explicit"?`explicit · ${Ee.childConfig.path}`:"ambient · not configured"})}).catch(()=>{ie.signal.aborted||kt(!0)}),()=>ie.abort()},[Ve,Pe]),b.useEffect(()=>{if(!Vt||!Xt)return;const ie=window.setTimeout(()=>{Gt(Ee=>Ee+1)},$C);return()=>window.clearTimeout(ie)},[Xt,Vt]),b.useEffect(()=>{const ie=qe.current;qe.current=le.phase,le.phase==="current"&&ie!=="current"&&Vt&&Gt(Ee=>Ee+1)},[le.phase,Vt]);const it=f??Q,Et=x===void 0||f!==void 0,ut=My(b.useCallback(async ie=>({rows:(await it.listWorkflows(ie)).workflows}),[it]),R==="workflows"||R==="prompt_builder"||Et),Qe=My(b.useCallback(async ie=>({rows:(await it.listAdapters(ie)).adapters}),[it]),R==="adapters"||R==="prompt_builder"||Et),[dt,wt]=b.useState(null),Tt=Fy(le),pn=[...le.live,...le.history].reduce((ie,Ee)=>(Ee.availability!=="available"||(ie[Ee.workflowName]=(ie[Ee.workflowName]??0)+1),ie),{}),kn=[...le.live,...le.history].reduce((ie,Ee)=>ie+(Ee.availability==="available"?Ee.reportedRunningCalls:0),0),hn=le.selected,Wt=Ae.selected,ht=B?.kind==="run"||B?.kind==="run_call"?B.runId:null,en=b.useRef(null);b.useEffect(()=>{if(R!=="runs")return;if(ht===null){en.current=null;return}if(en.current===ht||(en.current=ht,le.selected?.runId===ht))return;const ie=[...le.live,...le.history].find(Ee=>Ee.availability==="available"&&Ee.runId===ht);if(ie!==void 0){$t.select(ie);return}sn!==void 0&&sn.getRunDetailCurrent(ht).then(Ee=>{en.current===ht&&Ee.availability==="available"&&$t.select(Ee)}).catch(()=>{})},[R,sn,$t,le.live,le.history,le.selected,ht]);const At=B?.kind==="activity"?B.activityId:null,Ln=b.useRef(null);b.useEffect(()=>{if(R!=="activities")return;if(At===null){Ln.current=null,oe(!1);return}if(Ln.current===At||(Ln.current=At,oe(!0),Ae.selected?.activityId===At))return;const ie=Ae.activities.find(Ee=>Ee.activityId===At);if(ie!==void 0){Pt.select(ie);return}sn!==void 0&&sn.getActivityDetailCurrent(At).then(Ee=>{Ln.current===At&&Pt.select(Ee)}).catch(()=>{})},[Pt,R,sn,Ae.activities,Ae.selected,At]);const Dt=B?.kind==="context_run"?B.contextRunId:null;b.useEffect(()=>{if(R!=="context_runs"){Le.selectedId!==null&&Qt.clearSelection();return}if(Dt===null){oe(!1),Le.selectedId!==null&&Qt.clearSelection();return}oe(!0),Le.selectedId!==Dt&&Qt.select(Dt)},[Qt,R,Le.selectedId,Dt]);const rt=B?.kind==="progress_report"?B.progressReportId:null,zt=b.useRef(rt);b.useEffect(()=>{if(R==="progress_reports"){if(rt===null){oe(!1),Be.selectedId!==null&&Kt.clearSelection();return}oe(!0),Be.selectedId!==rt&&Kt.select(rt)}},[Kt,R,Be.selectedId,rt]),b.useEffect(()=>{const ie=zt.current;zt.current=rt,!(R!=="progress_reports"||ie===null||rt!==null)&&window.setTimeout(()=>{const Ee=document.querySelector(`.dashboard-layout__run-list [role="option"][data-item-id="${CSS.escape(ie)}"]`),pe=document.querySelector(".dashboard-layout__run-list #progress-report-list-title"),Ws=document.querySelector('.dashboard-layout__run-list [role="option"]');(Ee??pe??Ws)?.focus()},0)},[R,rt]);const Gn=ht??le.selected?.runId??null,sa=B?.kind==="run_call"?{stageId:B.stageId,callId:B.callId}:null,Fn=B?.kind==="artifact_reference"?{runId:B.runId,stageId:B.stageId,callId:B.callId}:null,Ia=b.useRef(!1);b.useEffect(()=>{B?.kind!=="run_call"&&(Ia.current=!1)},[B]);const Da=b.useCallback((ie,Ee)=>{const pe=Gn;pe!==null&&(Ee==="open"&&ie!==null?(Ia.current=!0,N.pushRoute(yy(pe,ie.stageId,ie.callId))):Ee==="switch"&&ie!==null?N.replaceRoute(yy(pe,ie.stageId,ie.callId)):Ia.current?(Ia.current=!1,window.history.back()):N.replaceRoute(yu(pe)))},[N,Gn]),za=b.useCallback(()=>{$t.runGenerationChanged()},[$t]),Pa=b.useCallback(()=>{Pt.clearSelection()},[Pt]),la=b.useCallback(()=>{Qt.clearSelection(),N.replaceRoute({kind:"context_runs"})},[Qt,N.replaceRoute]),I=b.useRef(hn);b.useEffect(()=>{const ie=I.current;I.current=hn,!(R!=="runs"||!ae||ie===null||hn!==null)&&(oe(!1),window.setTimeout(()=>{const Ee=document.querySelector(".dashboard-layout__run-list [data-selection-loss-announcement]"),pe=document.querySelector('.dashboard-layout__run-list [role="option"]');(Ee??pe)?.focus()},0))},[R,ae,hn]);const xe=b.useRef(Wt);b.useEffect(()=>{const ie=xe.current;xe.current=Wt,!(R!=="activities"||!ae||ie===null||Wt!==null)&&(oe(!1),window.setTimeout(()=>{const Ee=document.querySelector(".dashboard-layout__run-list [data-selection-loss-announcement]"),pe=document.querySelector('.dashboard-layout__run-list [role="option"]');(Ee??pe)?.focus()},0))},[R,ae,Wt]);const je=B?.kind==="workflow"?B.workflowName:null,ke=B?.kind==="adapter"?B.adapterName:null;b.useEffect(()=>{R!=="adapters"&&(ue(!1),me(!1))},[R]);const Oe=b.useRef(null);b.useEffect(()=>{const ie=R==="runs"?hn?.runId??null:R==="activities"?Wt?.activityId??null:R==="context_runs"?Dt:R==="progress_reports"?rt:R==="workflows"?je:R==="adapters"?ke:R==="artifacts"?Fn===null?null:`${Fn.runId}:${Fn.callId}`:null;ie===null||ie===Oe.current||(Oe.current=ie,document.querySelector(".dashboard-layout__detail")?.scrollTo?.({top:0}))},[R,hn,Wt,Dt,rt,je,ke,Fn]);const Fe=R==="activities"?Ae.phase:R==="context_runs"?Le.phase:R==="progress_reports"?Be.phase:le.phase,Je=R==="runs"||R==="activities"||R==="context_runs"||R==="progress_reports",Ct=ie=>{ie==="artifacts"&&Z(!0),oe(!1),N.navigateToDestination(ie)},vn=()=>{oe(!1),window.setTimeout(()=>{document.querySelector('.dashboard-layout__run-list [role="option"][aria-selected="true"]')?.focus()},0)},Ye=()=>{N.pushRoute({kind:"activities"}),vn()},qt=()=>{N.pushRoute({kind:"workflows"}),vn()},An=()=>{N.pushRoute({kind:"adapters"}),vn()},mn=()=>{N.pushRoute({kind:"artifacts"}),vn()},Ot=()=>{N.pushRoute({kind:"progress_reports"})},rn=le.detail!==null&&le.detail.availability==="available"?le.detail:null,bn=rn!==null||Ae.lastRefreshAtMs!==null,ft=ie=>B1(ie,rn,Ae.activities),gs=bn&&Qe.state.phase==="current"?Object.fromEntries(Qe.state.rows.map(ie=>[ie.name,ft(ie.name).length])):void 0,Qa=Kx(),ia=P&&!Qa,yn=Vx(Qe.state.rows,ke??void 0),xi=bn&&yn!==void 0?ft(yn.name):void 0,Qs={...le.lastRefreshAtMs===null?{}:{runs:le.live.length+le.history.length},...Ae.lastRefreshAtMs===null?{}:{activities:Ae.activities.length},...Le.lastRefreshAtMs===null?{}:{context_runs:Le.contextRuns.length},...Be.lastRefreshAtMs===null?{}:{progress_reports:Be.progressReports.length},...ut.state.phase==="current"?{workflows:ut.state.rows.length}:{},...Qe.state.phase==="current"?{adapters:Qe.state.rows.length}:{},...dt===null?{}:{artifacts:dt}},[Js,_s]=b.useState(0),vs=b.useMemo(()=>{const ie=(pe,Ws)=>{if(pe===void 0)return"";const bs=Date.parse(pe);if(!Number.isFinite(bs))return"";const ba=Ws===void 0?Number.NaN:Date.parse(Ws),Wa=Number.isFinite(ba)?ba-bs:le.displayNowMs-bs;return Wa>=0?Nr(Wa):""},Ee=[];for(const pe of le.live)pe.availability==="available"&&Ee.push({group:"runs",id:`run:${pe.runId}`,name:pe.workflowName,sub:`run ${pe.runId}`,meta:ie(pe.startedAt,pe.completedAt),status:pe.status,searchTerms:[pe.runId,pe.workflowName,pe.status,`v${pe.workflowVersion}`],targetId:pe.runId});for(const pe of le.history)pe.availability==="available"&&Ee.push({group:"runs",id:`run:${pe.runId}`,name:pe.workflowName,sub:`run ${pe.runId}`,meta:ie(pe.startedAt,pe.completedAt),status:pe.status,searchTerms:[pe.runId,pe.workflowName,pe.status,`v${pe.workflowVersion}`],targetId:pe.runId});for(const pe of Ae.activities)Ee.push({group:"calls",id:`call:${pe.activityId}`,name:`${pe.kind} · ${pe.adapter} / ${pe.role}`,sub:`activity ${pe.activityId}`,meta:ie(pe.startedAt,pe.completedAt),status:pe.status,searchTerms:[pe.activityId,pe.kind,pe.adapter,pe.role,pe.status],targetId:pe.activityId});for(const pe of Le.contextRuns)pe.lifecycle!==null&&Ee.push({group:"context",id:`ctx:${pe.id}`,name:pe.operationKind,sub:pe.id,meta:pe.lifecycle.durationMs===null?"":Nr(pe.lifecycle.durationMs),status:pe.lifecycle.status,searchTerms:[pe.id,pe.operationKind,pe.source,pe.lifecycle.status],targetId:pe.id});for(const pe of Be.progressReports)Ee.push({group:"progress",id:`report:${pe.id}`,name:pe.title,sub:pe.id,meta:_n(pe.updatedAt,Be.displayNowMs),status:pe.status,searchTerms:[pe.id,pe.title,pe.status],targetId:pe.id});if(ut.state.phase==="current")for(const pe of ut.state.rows)Ee.push({group:"workflows",id:`workflow:${pe.name}`,name:pe.name,sub:`workflow · v${pe.version}`,meta:`${String(pe.stageCount)} stages · ${String(pe.callCount)} calls`,status:"",searchTerms:[pe.name,"workflow",`v${pe.version}`,pe.description],targetId:pe.name});if(Qe.state.phase==="current")for(const pe of Qe.state.rows)Ee.push({group:"adapters",id:`adapter:${pe.name}`,name:pe.name,sub:`adapter · $ ${pe.command}`,meta:pe.parser,status:"",searchTerms:[pe.name,"adapter",pe.parser,pe.command,pe.backend],targetId:pe.name});return Ee},[le,Ae.activities,Le.contextRuns,Be,ut.state,Qe.state]);if(!k&&R==="progress_reports"&&rt!==null)return l.jsx(ey,{detail:Be.detail,detailPhase:Be.detailPhase,nowMs:Be.displayNowMs,onBack:Ot,onRetry:()=>{Kt.retry()},onSetStatusOverride:ie=>{Kt.setStatusOverride(rt,ie)},omittedSections:Be.omittedSections,pollingPhase:Be.phase,...Be.publishedSessionStatus===null?{}:{publishedSessionStatus:Be.publishedSessionStatus},selectedId:rt,unreadableReason:Be.unreadableReason});const Ja=ie=>{switch(_s(Ee=>Ee+1),ie.group){case"runs":oe(!0),N.pushRoute(yu(ie.targetId));return;case"calls":oe(!0),N.pushRoute(ih(ie.targetId));return;case"context":N.pushRoute(xy(ie.targetId));return;case"progress":N.pushRoute(wy(ie.targetId));return;case"workflows":N.pushRoute(jy(ie.targetId));return;case"adapters":N.pushRoute(rh(ie.targetId));return}};return l.jsxs(Uj,{...t===void 0?{}:{accountActions:t},activeDestination:R,applicationRootId:a,environment:Se,jumpItems:vs,navigationCounts:Qs,observationAvailable:k?!1:Je,onJumpOpen:Ja,onNavigate:Ct,pageTitle:k?"Not found":mr[R],pollingPhase:Fe,reportedRunningCalls:{count:le.lastRefreshAtMs===null?null:kn,refreshedLabel:le.lastRefreshAtMs===null?null:Tt.lastRefreshLabel},children:[k?l.jsxs("section",{className:"app-shell__view","aria-labelledby":"dashboard-page-title",children:[l.jsx("h1",{id:"dashboard-page-title",className:"app-shell__title",children:"Page not found"}),l.jsxs("p",{className:"app-shell__note",role:"status",children:["No dashboard view matches ",l.jsx("code",{children:M.rawPath}),"."]}),l.jsx("button",{type:"button",onClick:()=>Ct("runs"),children:"Go to run monitor"})]}):null,!k&&R==="runs"?l.jsx(Rl,{detail:l.jsx(WA,{applicationRootId:a,...E===void 0?{}:{inspectorApi:E},onBack:vn,onInspectorRouteChange:Da,onRetry:()=>{$t.retry()},onRunGenerationChanged:za,...le.detail?.availability!=="available"?{}:{contextPreflight:le.detail.contextPreflight??null},...S===void 0?{}:{resultApi:S},routeCall:sa,...ln===void 0?{}:{sessionLogApi:ln},state:le}),mobileView:hn!==null&&ae?"detail":"list",runList:l.jsxs("section",{className:"app-shell__view","aria-live":"off",children:[l.jsx("h1",{id:"dashboard-page-title",className:"visually-hidden",children:mr[R]}),l.jsx(mR,{filterResetKey:Js,onNewer:()=>{$t.newer()},onOlder:()=>{$t.older()},onRetry:()=>{$t.retry()},onSelect:ie=>{oe(!0),en.current=ie.runId,N.pushRoute(yu(ie.runId)),$t.select(ie)},state:le})]})}):null,!k&&R==="activities"?l.jsx(Rl,{detailAriaLabel:"Single-call detail",listAriaLabel:"Single-call list",detail:l.jsx(cR,{api:Mn,detail:At===null?null:Ae.detail,detailPhase:At===null?"idle":Ae.detailPhase,nowMs:Ae.displayNowMs,onBack:Ye,onGenerationChanged:Pa,selection:At===null?null:Wt,...ln===void 0?{}:{sessionLogApi:ln}},At===null||Wt===null?"activity:none":[Wt.activityId,Wt.activityGeneration].join(":")),mobileView:Wt!==null&&ae?"detail":"list",runList:l.jsxs("section",{className:"app-shell__view","aria-live":"off",children:[l.jsx("h1",{id:"dashboard-page-title",className:"visually-hidden",children:mr[R]}),l.jsx(_R,{filterResetKey:Js,activities:Ae.activities,announcement:Ae.announcement,hasSnapshot:Ae.lastRefreshAtMs!==null,onRetry:()=>{Pt.retry()},onSelect:ie=>{oe(!0),Ln.current=ie.activityId,N.pushRoute(ih(ie.activityId)),Pt.select(ie)},phase:Ae.phase,selected:Ae.selected,nowMs:Ae.displayNowMs})]})}):null,!k&&R==="context_runs"?l.jsx(Rl,{detailAriaLabel:"Context run detail",listAriaLabel:"Context run list",detail:l.jsx(WR,{canRetry:Le.phase==="current"||Le.phase==="stale"||Le.phase==="offline"||Le.phase==="error",detail:Le.detail,detailPhase:Le.detailPhase,onBack:()=>{N.pushRoute({kind:"context_runs"})},onGenerationChanged:la,onRetry:()=>{Qt.retry()},selectedId:Dt,contextRunsApi:ce,...ln===void 0?{}:{sessionLogApi:ln}}),mobileView:Dt!==null?"detail":"list",runList:l.jsxs("section",{className:"app-shell__view","aria-live":"off",children:[l.jsx("h1",{id:"dashboard-page-title",className:"visually-hidden",children:mr[R]}),l.jsx(tE,{filterResetKey:Js,announcement:Le.announcement,contextRuns:Le.contextRuns,hasSnapshot:Le.lastRefreshAtMs!==null,nowMs:Le.displayNowMs,onRetry:()=>{Qt.retry()},onSelect:ie=>{N.pushRoute(xy(ie))},phase:Le.phase,selectedId:Le.selectedId})]})}):null,!k&&R==="progress_reports"?l.jsx(Rl,{detailAriaLabel:"Progress report detail",listAriaLabel:"Progress report list",detail:l.jsx(ey,{detail:Be.detail,detailPhase:Be.detailPhase,nowMs:Be.displayNowMs,onBack:Ot,onRetry:()=>{Kt.retry()},onSetStatusOverride:ie=>{rt!==null&&Kt.setStatusOverride(rt,ie)},omittedSections:Be.omittedSections,pollingPhase:Be.phase,...Be.publishedSessionStatus===null?{}:{publishedSessionStatus:Be.publishedSessionStatus},selectedId:rt,unreadableReason:Be.unreadableReason}),mobileView:rt!==null?"detail":"list",runList:l.jsxs("section",{className:"app-shell__view","aria-live":"off",children:[l.jsx("h1",{id:"dashboard-page-title",className:"visually-hidden",children:mr[R]}),l.jsx(sE,{announcement:Be.announcement,progressReports:Be.progressReports,hasSnapshot:Be.lastRefreshAtMs!==null,nowMs:Be.displayNowMs,onRetry:()=>{Kt.retry()},onSelect:ie=>{N.pushRoute(wy(ie))},phase:Be.phase,...Se?.progressReportsRoot===void 0?{}:{progressReportsRoot:Se.progressReportsRoot},selectedId:Be.selectedId,truncated:Be.truncated})]})}):null,!k&&R==="workflows"?l.jsx(Rl,{detailAriaLabel:"Workflow detail",listAriaLabel:"Workflow index",detail:ut.state.phase==="current"?l.jsx(W1,{onBack:qt,runCounts:pn,workflow:Gx(ut.state.rows,je??void 0)}):null,mobileView:je!==null?"detail":"list",runList:l.jsxs("section",{className:"app-shell__view","aria-live":"off",children:[l.jsx("h1",{id:"dashboard-page-title",className:"visually-hidden",children:mr[R]}),l.jsx(Ly,{kind:"workflow",phase:ut.state.phase,retry:ut.retry}),ut.state.phase==="current"?l.jsx(P1,{onSelect:ie=>N.pushRoute(jy(ie)),...Se?.workflowsPath===void 0?{}:{sourcePath:Se.workflowsPath},runCounts:pn,...je===null?{}:{selectedName:je},workflows:ut.state.rows}):null]})}):null,!k&&R==="adapters"?l.jsx(Rl,{detailAriaLabel:"Adapter detail",listAriaLabel:"Adapter index",detail:Qe.state.phase==="current"?ia?l.jsx(iA,{adapters:Qe.state.rows,differencesOnly:_e,onClose:()=>ue(!1),onDifferencesToggle:()=>me(ie=>!ie),onOpenAdapter:ie=>{ue(!1),N.pushRoute(rh(ie))},...ke===null?{}:{selectedName:ke},...gs===void 0?{}:{useCounts:gs}}):l.jsx(lA,{adapter:yn,adapters:Qe.state.rows,onBack:An,onOpenUse:ie=>{ie.kind==="workflow"?N.pushRoute(yu(ie.runId)):N.pushRoute(ih(ie.activityId))},...xi===void 0?{}:{uses:xi}}):null,mobileView:ke!==null?"detail":"list",runList:l.jsxs("section",{className:"app-shell__view","aria-live":"off",children:[l.jsx("h1",{id:"dashboard-page-title",className:"visually-hidden",children:"Adapters"}),l.jsx(Ly,{kind:"adapter",phase:Qe.state.phase,retry:Qe.retry}),Qe.state.phase==="current"?l.jsx(tA,{adapters:Qe.state.rows,compareOn:ia,onCompareToggle:()=>ue(ie=>!ie),onSelect:ie=>N.pushRoute(rh(ie)),...ke===null?{}:{selectedName:ke},...gs===void 0?{}:{useCounts:gs}}):null]})}):null,!k&&(q||le.lastRefreshAtMs!==null&&(x===void 0||c!==void 0))?l.jsx("div",{className:"app-shell__catalog-frame",hidden:R!=="artifacts",children:l.jsx(mA,{active:R==="artifacts",api:c??he,mobileView:Fn!==null?"detail":"list",onBackToList:mn,onLoadedCount:wt,onSelectReference:ie=>{N.pushRoute(dC(ie.runId,ie.stageId,ie.callId))},runs:[...le.live,...le.history],selection:Fn,...Se?.runsRoot===void 0?{}:{runsRoot:Se.runsRoot}})}):null,!k&&R==="prompt_builder"?l.jsx(YT,{adapters:{phase:Qe.state.phase,rows:Qe.state.rows,retry:Qe.retry},workflows:{phase:ut.state.phase,rows:ut.state.rows,retry:ut.retry}}):null]})}function os(t){const a=new Uint8Array(t);let i="";for(const c of a)i+=String.fromCharCode(c);return btoa(i).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function cd(t){const a=t.replace(/-/g,"+").replace(/_/g,"/"),i=(4-a.length%4)%4,r=a.padEnd(a.length+i,"="),c=atob(r),f=new ArrayBuffer(c.length),p=new Uint8Array(f);for(let h=0;h<c.length;h++)p[h]=c.charCodeAt(h);return f}function Ad(){return MC.stubThis(globalThis?.PublicKeyCredential!==void 0&&typeof globalThis.PublicKeyCredential=="function")}const MC={stubThis:t=>t};function $0(t){const{id:a}=t;return{...t,id:cd(a),transports:t.transports}}function M0(t){return t==="localhost"||/^((xn--[a-z0-9-]+|[a-z0-9]+(-[a-z0-9]+)*)\.)+([a-z]{2,}|xn--[a-z0-9-]+)$/i.test(t)}class $n extends Error{constructor({message:a,code:i,cause:r,name:c}){super(a,{cause:r}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=c??r.name,this.code=i}}function LC({error:t,options:a}){const{publicKey:i}=a;if(!i)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(a.signal instanceof AbortSignal)return new $n({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(i.authenticatorSelection?.requireResidentKey===!0)return new $n({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(a.mediation==="conditional"&&i.authenticatorSelection?.userVerification==="required")return new $n({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(i.authenticatorSelection?.userVerification==="required")return new $n({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new $n({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new $n({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return i.pubKeyCredParams.filter(c=>c.type==="public-key").length===0?new $n({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new $n({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){const r=globalThis.location.hostname;if(M0(r)){if(i.rp.id!==r)return new $n({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new $n({message:`${globalThis.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(i.user.id.byteLength<1||i.user.id.byteLength>64)return new $n({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new $n({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return t}class IC{constructor(){Object.defineProperty(this,"controller",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}createNewAbortSignal(){if(this.controller){const i=new Error("Cancelling existing WebAuthn API call for new one");i.name="AbortError",this.controller.abort(i)}const a=new AbortController;return this.controller=a,a.signal}cancelCeremony(){if(this.controller){const a=new Error("Manually cancelling existing WebAuthn API call");a.name="AbortError",this.controller.abort(a),this.controller=void 0}}}const L0=new IC,DC=["cross-platform","platform"];function I0(t){if(t&&!(DC.indexOf(t)<0))return t}async function zC(t){!t.optionsJSON&&t.challenge&&(console.warn("startRegistration() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information."),t={optionsJSON:t});const{optionsJSON:a,useAutoRegister:i=!1}=t;if(!Ad())throw new Error("WebAuthn is not supported in this browser");const r={...a,challenge:cd(a.challenge),user:{...a.user,id:cd(a.user.id)},excludeCredentials:a.excludeCredentials?.map($0)},c={};i&&(c.mediation="conditional"),c.publicKey=r,c.signal=L0.createNewAbortSignal();let f;try{f=await navigator.credentials.create(c)}catch(C){throw LC({error:C,options:c})}if(!f)throw new Error("Registration was not completed");const{id:p,rawId:h,response:v,type:m}=f;let x;typeof v.getTransports=="function"&&(x=v.getTransports());let y;if(typeof v.getPublicKeyAlgorithm=="function")try{y=v.getPublicKeyAlgorithm()}catch(C){ch("getPublicKeyAlgorithm()",C)}let E;if(typeof v.getPublicKey=="function")try{const C=v.getPublicKey();C!==null&&(E=os(C))}catch(C){ch("getPublicKey()",C)}let S;if(typeof v.getAuthenticatorData=="function")try{S=os(v.getAuthenticatorData())}catch(C){ch("getAuthenticatorData()",C)}return{id:p,rawId:os(h),response:{attestationObject:os(v.attestationObject),clientDataJSON:os(v.clientDataJSON),transports:x,publicKeyAlgorithm:y,publicKey:E,authenticatorData:S},type:m,clientExtensionResults:f.getClientExtensionResults(),authenticatorAttachment:I0(f.authenticatorAttachment)}}function ch(t,a){console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${t}. You should report this error to them.
|
|
105
|
-
`,a)}function qC(){if(!Ad())return uh.stubThis(new Promise(a=>a(!1)));const t=globalThis.PublicKeyCredential;return t?.isConditionalMediationAvailable===void 0?uh.stubThis(new Promise(a=>a(!1))):uh.stubThis(t.isConditionalMediationAvailable())}const uh={stubThis:t=>t};function UC({error:t,options:a}){const{publicKey:i}=a;if(!i)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(a.signal instanceof AbortSignal)return new $n({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new $n({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const r=globalThis.location.hostname;if(M0(r)){if(i.rpId!==r)return new $n({message:`The RP ID "${i.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new $n({message:`${globalThis.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new $n({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return t}async function BC(t){!t.optionsJSON&&t.challenge&&(console.warn("startAuthentication() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information."),t={optionsJSON:t});const{optionsJSON:a,useBrowserAutofill:i=!1,verifyBrowserAutofillInput:r=!0}=t;if(!Ad())throw new Error("WebAuthn is not supported in this browser");let c;a.allowCredentials?.length!==0&&(c=a.allowCredentials?.map($0));const f={...a,challenge:cd(a.challenge),allowCredentials:c},p={};if(i){if(!await qC())throw Error("Browser does not support WebAuthn autofill");if(document.querySelectorAll("input[autocomplete$='webauthn']").length<1&&r)throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');p.mediation="conditional",f.allowCredentials=[]}p.publicKey=f,p.signal=L0.createNewAbortSignal();let h;try{h=await navigator.credentials.get(p)}catch(S){throw UC({error:S,options:p})}if(!h)throw new Error("Authentication was not completed");const{id:v,rawId:m,response:x,type:y}=h;let E;return x.userHandle&&(E=os(x.userHandle)),{id:v,rawId:os(m),response:{authenticatorData:os(x.authenticatorData),clientDataJSON:os(x.clientDataJSON),signature:os(x.signature),userHandle:E},type:y,clientExtensionResults:h.getClientExtensionResults(),authenticatorAttachment:I0(h.authenticatorAttachment)}}class Bn extends Error{status;code;constructor(a,i){super(i),this.name="DashboardAuthApiError",this.status=a,this.code=i}}const GC=`{"error":{"code":"not_found"}}
|
|
106
|
-
`,HC="no-store",VC="application/json; charset=utf-8",KC=/^[A-Za-z0-9_-]{43}$/,D0=new WeakSet;function ZC(){const t=new Bn(404,"not_found");return D0.add(t),t}async function FC(t,a){try{return(await t.status()).mode}catch(i){if(a&&i instanceof Bn&&D0.has(i))return"bearer";throw i}}function Ko(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function z0(t,a){if(!t.ok){const i=Ko(a)&&Ko(a.error)&&typeof a.error.code=="string"?a.error.code:"request_failed";throw new Bn(t.status,i)}return a}async function q0(t){let a;try{a=await t.json()}catch{throw new Bn(t.status,"invalid_response")}return z0(t,a)}async function YC(t){if(t.status!==404)return q0(t);let a;try{a=await t.text()}catch{throw new Bn(t.status,"invalid_response")}if(a===GC&&t.headers.get("cache-control")===HC&&t.headers.get("content-type")===VC)throw ZC();let i;try{i=JSON.parse(a)}catch{throw new Bn(t.status,"invalid_response")}return z0(t,i)}async function Co(t,a,i){const r=Uh(),c=await fetch(t,{method:"POST",credentials:"same-origin",redirect:"error",referrerPolicy:"no-referrer",headers:{"Content-Type":"application/json",...i==null?{}:{"X-Enrollment-Code":i},...r==null?{}:{[Bu]:r}},body:JSON.stringify(a)});try{return await q0(c)}catch(f){throw f instanceof Bn&&f.status===401&&ds(),f}}function XC(t){if(!Ko(t))throw new Bn(200,"invalid_response");if(Object.keys(t).sort().join("\0")!==["authenticated","enrolled","mode"].sort().join("\0")||typeof t.enrolled!="boolean"||typeof t.authenticated!="boolean"||t.mode!=="passkey"&&t.mode!=="bearer"&&t.mode!=="none")throw new Bn(200,"invalid_response");return t}function Iy(t){if(!Ko(t)||typeof t.challenge!="string")throw new Bn(200,"invalid_response");return t}function PC(t){if(!Ko(t))throw ds(),new Bn(200,"invalid_response");const a=Object.keys(t).sort().join("\0");if(Fo()){if(a!==["originProof","verified"].sort().join("\0")||t.verified!==!0||typeof t.originProof!="string"||!KC.test(t.originProof))throw ds(),new Bn(200,"invalid_response");try{zS(t.originProof)}catch{throw ds(),new Bn(200,"invalid_response")}return}if(a!=="verified"||t.verified!==!0)throw new Bn(200,"invalid_response")}function U0(){return{async status(t){try{const a=Uh(),i=await fetch("/api/auth/status",{method:"GET",credentials:"same-origin",redirect:"error",referrerPolicy:"no-referrer",...a==null?{}:{headers:{[Bu]:a}},...t==null?{}:{signal:t}}),r=XC(await YC(i));return r.authenticated||ds(),r}catch(a){throw Fo()&&a instanceof Bn&&ds(),a}},async registrationOptions(t){return Iy(await Co("/api/auth/register/options",{},t))},async verifyRegistration(t,a,i){await Co("/api/auth/register/verify",{response:t,...i==null?{}:{label:i}},a)},async authenticationOptions(){return Iy(await Co("/api/auth/login/options",{}))},async verifyAuthentication(t){PC(await Co("/api/auth/login/verify",{response:t}))},async logout(){try{await Co("/api/auth/logout",{})}finally{ds()}}}}const QC=/^[A-Za-z0-9_-]{32}$/,JC={supports:Ad,register:async t=>zC({optionsJSON:t}),authenticate:async t=>BC({optionsJSON:t})};function dh(t){if(t instanceof Bn){if(t.status===401)return"Authorization was rejected.";if(t.code==="not_enrolled")return"Register a passkey before signing in.";if(t.code==="state_conflict")return"Enrollment changed. Refresh the status and try again."}return t instanceof DOMException&&t.name==="NotAllowedError"?"The passkey request was cancelled or timed out.":"The passkey request could not be completed."}function WC({api:t,webauthn:a,authenticatedContent:i}){const r=b.useMemo(()=>t??U0(),[t]),c=a??JC,[f,p]=b.useState(null),[h,v]=b.useState(""),m=b.useRef(""),x=b.useRef(!0),[y,E]=b.useState(null),[S,C]=b.useState(null);b.useEffect(()=>{x.current=!0,Hu("passkey");const k=new AbortController;r.status(k.signal).then(R=>{k.signal.aborted||p(R)},R=>{k.signal.aborted||C(dh(R))});const z=()=>{p(R=>R==null?R:{...R,authenticated:!1}),C("Your dashboard session expired. Sign in again.")};return window.addEventListener(gh,z),()=>{x.current=!1,k.abort(),window.removeEventListener(gh,z),m.current="",v("")}},[r]);const T=k=>{if(y!=null)return;const z=k?void 0:m.current.trim();if(!k&&!QC.test(z??"")){C("Enter the 32-character enrollment code from the launch output.");return}C(null),E("register"),r.registrationOptions(z).then(R=>c.register(R)).then(R=>r.verifyRegistration(R,k?void 0:m.current.trim()||void 0)).then(async()=>{if(m.current="",!x.current)return;v("");const R=await r.status();x.current&&p(R)}).catch(R=>{m.current="",x.current&&(v(""),C(dh(R)))}).finally(()=>{x.current&&E(null)})},N=()=>{y==null&&(C(null),E("login"),(async()=>{const k=await r.authenticationOptions();if(!x.current)return;const z=await c.authenticate(k);if(!x.current||(await r.verifyAuthentication(z),!x.current))return;const R=await r.status();x.current&&p(R)})().catch(k=>{x.current&&C(dh(k))}).finally(()=>{x.current&&E(null)}))},M=()=>{y==null&&(C(null),E("logout"),r.logout().then(async()=>{if(x.current){p(k=>k==null?k:{...k,authenticated:!1});try{const k=await r.status();x.current&&p(k)}catch{x.current&&C("Signed out locally, but authentication status could not be refreshed.")}}}).catch(()=>{x.current&&(p(k=>k==null?k:{...k,authenticated:!1}),C("Sign-out could not be confirmed. You were signed out locally."))}).finally(()=>{x.current&&E(null)}))};if(f===null)return l.jsx("main",{className:"auth-gate",children:l.jsxs("section",{className:"auth-gate__card","aria-live":"polite",children:[l.jsx("h1",{children:"ClinkX field station"}),l.jsx("p",{children:S??"Checking passkey status…"})]})});if(!c.supports())return l.jsx("main",{className:"auth-gate",children:l.jsxs("section",{className:"auth-gate__card",children:[l.jsx("h1",{children:"Passkeys unavailable"}),l.jsx("p",{children:"This browser does not support WebAuthn. Open the dashboard in a supported browser."})]})});if(f.authenticated){const k={error:S,onAddPasskey:()=>T(!0),onSignOut:M,pending:y==="register"||y==="logout"?y:null};return l.jsx("div",{className:"auth-gate__authenticated",children:i?.(k)??l.jsx(O0,{accountActions:k})})}return l.jsx("main",{className:"auth-gate",children:l.jsxs("section",{className:"auth-gate__card","aria-labelledby":"auth-gate-title",children:[l.jsx("span",{"aria-hidden":"true",className:"auth-gate__mark"}),l.jsx("h1",{id:"auth-gate-title",children:"ClinkX field station"}),f.enrolled?l.jsxs(l.Fragment,{children:[l.jsx("p",{children:"Use your passkey to open the run monitor."}),l.jsx("button",{type:"button",disabled:y!==null,onClick:N,children:y==="login"?"Waiting for passkey…":"Sign in"})]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{children:"Register the first passkey with the one-time enrollment code."}),l.jsx("label",{htmlFor:"enrollment-code",children:"Enrollment code"}),l.jsx("input",{id:"enrollment-code",value:h,disabled:y!==null,autoComplete:"off",autoCapitalize:"off",spellCheck:!1,onChange:k=>{m.current=k.target.value,v(k.target.value),S!=null&&C(null)}}),l.jsx("button",{type:"button",disabled:y!==null,onClick:()=>T(!1),children:y==="register"?"Waiting for passkey…":"Register this device"})]}),S==null?null:l.jsx("p",{className:"auth-gate__error",role:"alert",children:S})]})})}const eO=/^[A-Za-z0-9_-]{43}$/;function tO({onSubmit:t}){const[a,i]=b.useState(""),[r,c]=b.useState(null),[f,p]=b.useState(!1),h=b.useId(),v=b.useId(),m=x=>{if(x.preventDefault(),f)return;const y=a.trim();if(!eO.test(y)){c("Enter the 43-character access token from the launch output.");return}c(null),p(!0),t(y).then(E=>{E||(c("That token was rejected. Check the launch output and try again."),p(!1))},()=>{c("Could not reach the dashboard. Is it still running?"),p(!1)})};return l.jsx("main",{className:"login",children:l.jsxs("section",{className:"login__card","aria-labelledby":"login-title",children:[l.jsx("span",{"aria-hidden":"true",className:"login__mark",children:l.jsx("span",{className:"login__mark-dot"})}),l.jsx("h1",{className:"login__title",id:"login-title",children:"ClinkX field station"}),l.jsx("p",{className:"login__lede",children:"Paste the access token printed when the dashboard started to open the run monitor."}),l.jsxs("form",{className:"login__form",onSubmit:m,noValidate:!0,children:[l.jsx("label",{className:"login__label op-caption",htmlFor:h,children:"Access token"}),l.jsx("input",{id:h,className:"login__input",type:"password",autoComplete:"off",autoCapitalize:"off",spellCheck:!1,autoFocus:!0,value:a,disabled:f,"aria-invalid":r!==null,...r===null?{}:{"aria-describedby":v},onChange:x=>{i(x.target.value),r!==null&&c(null)}}),r===null?null:l.jsx("p",{className:"login__error op-caption",id:v,role:"alert",children:r}),l.jsx("button",{className:"login__submit",type:"submit",disabled:f,children:f?"Opening…":"Open dashboard"})]})]})})}function nO(t,a=window.location.origin){return t.mode==="local"&&!t.authenticated&&Fo(a)}const B0=document.getElementById("root");if(!B0)throw new Error("Root element #root not found");const ud=kj.createRoot(B0),aO=ox(),dd=()=>{ud.render(l.jsx(b.StrictMode,{children:l.jsx(O0,{})}))},sO=async t=>{if(!ZS(t))return!1;try{return(await px()).authenticated?(dd(),!0):(vh(),!1)}catch(a){const i=FS();if(vh(),i)throw a;return!1}},fh=()=>{ud.render(l.jsx(b.StrictMode,{children:l.jsx(tO,{onSubmit:sO})}))},ph=()=>nO(KS(),window.location.origin),lO=()=>{if(Hu("bearer"),ph()){fh();return}px().then(()=>ph()?fh():dd(),()=>ph()?fh():dd())},Dy=U0();FC(Dy,aO.mode==="remote").then(t=>{if(t==="passkey"){Hu("passkey"),ud.render(l.jsx(b.StrictMode,{children:l.jsx(WC,{api:Dy})}));return}if(t==="none"){Hu("none"),dd();return}lO()},()=>{ud.render(l.jsx(b.StrictMode,{children:l.jsx("main",{className:"auth-gate",children:l.jsxs("section",{className:"auth-gate__card",role:"alert",children:[l.jsx("h1",{children:"ClinkX field station"}),l.jsx("p",{children:"Could not load dashboard authentication status."})]})})}))});
|