@amenophis1er/foreman 0.1.16 → 0.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,76 @@
1
+ (function(){const c=document.createElement("link").relList;if(c&&c.supports&&c.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))o(d);new MutationObserver(d=>{for(const f of d)if(f.type==="childList")for(const m of f.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&o(m)}).observe(document,{childList:!0,subtree:!0});function u(d){const f={};return d.integrity&&(f.integrity=d.integrity),d.referrerPolicy&&(f.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?f.credentials="include":d.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function o(d){if(d.ep)return;d.ep=!0;const f=u(d);fetch(d.href,f)}})();function Cg(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Oc={exports:{}},Ri={};var Fh;function Tg(){if(Fh)return Ri;Fh=1;var i=Symbol.for("react.transitional.element"),c=Symbol.for("react.fragment");function u(o,d,f){var m=null;if(f!==void 0&&(m=""+f),d.key!==void 0&&(m=""+d.key),"key"in d){f={};for(var y in d)y!=="key"&&(f[y]=d[y])}else f=d;return d=f.ref,{$$typeof:i,type:o,key:m,ref:d!==void 0?d:null,props:f}}return Ri.Fragment=c,Ri.jsx=u,Ri.jsxs=u,Ri}var Jh;function Mg(){return Jh||(Jh=1,Oc.exports=Tg()),Oc.exports}var a=Mg(),Nc={exports:{}},Se={};var Ih;function Eg(){if(Ih)return Se;Ih=1;var i=Symbol.for("react.transitional.element"),c=Symbol.for("react.portal"),u=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),f=Symbol.for("react.consumer"),m=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),j=Symbol.for("react.activity"),S=Symbol.iterator;function z(k){return k===null||typeof k!="object"?null:(k=S&&k[S]||k["@@iterator"],typeof k=="function"?k:null)}var D={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},G=Object.assign,T={};function w(k,V,C){this.props=k,this.context=V,this.refs=T,this.updater=C||D}w.prototype.isReactComponent={},w.prototype.setState=function(k,V){if(typeof k!="object"&&typeof k!="function"&&k!=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,k,V,"setState")},w.prototype.forceUpdate=function(k){this.updater.enqueueForceUpdate(this,k,"forceUpdate")};function R(){}R.prototype=w.prototype;function H(k,V,C){this.props=k,this.context=V,this.refs=T,this.updater=C||D}var K=H.prototype=new R;K.constructor=H,G(K,w.prototype),K.isPureReactComponent=!0;var se=Array.isArray;function B(){}var q={H:null,A:null,T:null,S:null},I=Object.prototype.hasOwnProperty;function W(k,V,C){var L=C.ref;return{$$typeof:i,type:k,key:V,ref:L!==void 0?L:null,props:C}}function ue(k,V){return W(k.type,V,k.props)}function ne(k){return typeof k=="object"&&k!==null&&k.$$typeof===i}function de(k){var V={"=":"=0",":":"=2"};return"$"+k.replace(/[=:]/g,function(C){return V[C]})}var je=/\/+/g;function re(k,V){return typeof k=="object"&&k!==null&&k.key!=null?de(""+k.key):V.toString(36)}function xe(k){switch(k.status){case"fulfilled":return k.value;case"rejected":throw k.reason;default:switch(typeof k.status=="string"?k.then(B,B):(k.status="pending",k.then(function(V){k.status==="pending"&&(k.status="fulfilled",k.value=V)},function(V){k.status==="pending"&&(k.status="rejected",k.reason=V)})),k.status){case"fulfilled":return k.value;case"rejected":throw k.reason}}throw k}function _(k,V,C,L,Z){var ce=typeof k;(ce==="undefined"||ce==="boolean")&&(k=null);var be=!1;if(k===null)be=!0;else switch(ce){case"bigint":case"string":case"number":be=!0;break;case"object":switch(k.$$typeof){case i:case c:be=!0;break;case b:return be=k._init,_(be(k._payload),V,C,L,Z)}}if(be)return Z=Z(k),be=L===""?"."+re(k,0):L,se(Z)?(C="",be!=null&&(C=be.replace(je,"$&/")+"/"),_(Z,V,C,"",function(ie){return ie})):Z!=null&&(ne(Z)&&(Z=ue(Z,C+(Z.key==null||k&&k.key===Z.key?"":(""+Z.key).replace(je,"$&/")+"/")+be)),V.push(Z)),1;be=0;var He=L===""?".":L+":";if(se(k))for(var ge=0;ge<k.length;ge++)L=k[ge],ce=He+re(L,ge),be+=_(L,V,C,ce,Z);else if(ge=z(k),typeof ge=="function")for(k=ge.call(k),ge=0;!(L=k.next()).done;)L=L.value,ce=He+re(L,ge++),be+=_(L,V,C,ce,Z);else if(ce==="object"){if(typeof k.then=="function")return _(xe(k),V,C,L,Z);throw V=String(k),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(k).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.")}return be}function O(k,V,C){if(k==null)return k;var L=[],Z=0;return _(k,L,"","",function(ce){return V.call(C,ce,Z++)}),L}function ee(k){if(k._status===-1){var V=k._result;V=V(),V.then(function(C){(k._status===0||k._status===-1)&&(k._status=1,k._result=C)},function(C){(k._status===0||k._status===-1)&&(k._status=2,k._result=C)}),k._status===-1&&(k._status=0,k._result=V)}if(k._status===1)return k._result.default;throw k._result}var P=typeof reportError=="function"?reportError:function(k){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var V=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof k=="object"&&k!==null&&typeof k.message=="string"?String(k.message):String(k),error:k});if(!window.dispatchEvent(V))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",k);return}console.error(k)},oe={map:O,forEach:function(k,V,C){O(k,function(){V.apply(this,arguments)},C)},count:function(k){var V=0;return O(k,function(){V++}),V},toArray:function(k){return O(k,function(V){return V})||[]},only:function(k){if(!ne(k))throw Error("React.Children.only expected to receive a single React element child.");return k}};return Se.Activity=j,Se.Children=oe,Se.Component=w,Se.Fragment=u,Se.Profiler=d,Se.PureComponent=H,Se.StrictMode=o,Se.Suspense=x,Se.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=q,Se.__COMPILER_RUNTIME={__proto__:null,c:function(k){return q.H.useMemoCache(k)}},Se.cache=function(k){return function(){return k.apply(null,arguments)}},Se.cacheSignal=function(){return null},Se.cloneElement=function(k,V,C){if(k==null)throw Error("The argument must be a React element, but you passed "+k+".");var L=G({},k.props),Z=k.key;if(V!=null)for(ce in V.key!==void 0&&(Z=""+V.key),V)!I.call(V,ce)||ce==="key"||ce==="__self"||ce==="__source"||ce==="ref"&&V.ref===void 0||(L[ce]=V[ce]);var ce=arguments.length-2;if(ce===1)L.children=C;else if(1<ce){for(var be=Array(ce),He=0;He<ce;He++)be[He]=arguments[He+2];L.children=be}return W(k.type,Z,L)},Se.createContext=function(k){return k={$$typeof:m,_currentValue:k,_currentValue2:k,_threadCount:0,Provider:null,Consumer:null},k.Provider=k,k.Consumer={$$typeof:f,_context:k},k},Se.createElement=function(k,V,C){var L,Z={},ce=null;if(V!=null)for(L in V.key!==void 0&&(ce=""+V.key),V)I.call(V,L)&&L!=="key"&&L!=="__self"&&L!=="__source"&&(Z[L]=V[L]);var be=arguments.length-2;if(be===1)Z.children=C;else if(1<be){for(var He=Array(be),ge=0;ge<be;ge++)He[ge]=arguments[ge+2];Z.children=He}if(k&&k.defaultProps)for(L in be=k.defaultProps,be)Z[L]===void 0&&(Z[L]=be[L]);return W(k,ce,Z)},Se.createRef=function(){return{current:null}},Se.forwardRef=function(k){return{$$typeof:y,render:k}},Se.isValidElement=ne,Se.lazy=function(k){return{$$typeof:b,_payload:{_status:-1,_result:k},_init:ee}},Se.memo=function(k,V){return{$$typeof:p,type:k,compare:V===void 0?null:V}},Se.startTransition=function(k){var V=q.T,C={};q.T=C;try{var L=k(),Z=q.S;Z!==null&&Z(C,L),typeof L=="object"&&L!==null&&typeof L.then=="function"&&L.then(B,P)}catch(ce){P(ce)}finally{V!==null&&C.types!==null&&(V.types=C.types),q.T=V}},Se.unstable_useCacheRefresh=function(){return q.H.useCacheRefresh()},Se.use=function(k){return q.H.use(k)},Se.useActionState=function(k,V,C){return q.H.useActionState(k,V,C)},Se.useCallback=function(k,V){return q.H.useCallback(k,V)},Se.useContext=function(k){return q.H.useContext(k)},Se.useDebugValue=function(){},Se.useDeferredValue=function(k,V){return q.H.useDeferredValue(k,V)},Se.useEffect=function(k,V){return q.H.useEffect(k,V)},Se.useEffectEvent=function(k){return q.H.useEffectEvent(k)},Se.useId=function(){return q.H.useId()},Se.useImperativeHandle=function(k,V,C){return q.H.useImperativeHandle(k,V,C)},Se.useInsertionEffect=function(k,V){return q.H.useInsertionEffect(k,V)},Se.useLayoutEffect=function(k,V){return q.H.useLayoutEffect(k,V)},Se.useMemo=function(k,V){return q.H.useMemo(k,V)},Se.useOptimistic=function(k,V){return q.H.useOptimistic(k,V)},Se.useReducer=function(k,V,C){return q.H.useReducer(k,V,C)},Se.useRef=function(k){return q.H.useRef(k)},Se.useState=function(k){return q.H.useState(k)},Se.useSyncExternalStore=function(k,V,C){return q.H.useSyncExternalStore(k,V,C)},Se.useTransition=function(){return q.H.useTransition()},Se.version="19.2.8",Se}var Ph;function ru(){return Ph||(Ph=1,Nc.exports=Eg()),Nc.exports}var g=ru();const wn=Cg(g);var Uc={exports:{}},Oi={},Hc={exports:{}},Bc={};var ep;function _g(){return ep||(ep=1,(function(i){function c(_,O){var ee=_.length;_.push(O);e:for(;0<ee;){var P=ee-1>>>1,oe=_[P];if(0<d(oe,O))_[P]=O,_[ee]=oe,ee=P;else break e}}function u(_){return _.length===0?null:_[0]}function o(_){if(_.length===0)return null;var O=_[0],ee=_.pop();if(ee!==O){_[0]=ee;e:for(var P=0,oe=_.length,k=oe>>>1;P<k;){var V=2*(P+1)-1,C=_[V],L=V+1,Z=_[L];if(0>d(C,ee))L<oe&&0>d(Z,C)?(_[P]=Z,_[L]=ee,P=L):(_[P]=C,_[V]=ee,P=V);else if(L<oe&&0>d(Z,ee))_[P]=Z,_[L]=ee,P=L;else break e}}return O}function d(_,O){var ee=_.sortIndex-O.sortIndex;return ee!==0?ee:_.id-O.id}if(i.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;i.unstable_now=function(){return f.now()}}else{var m=Date,y=m.now();i.unstable_now=function(){return m.now()-y}}var x=[],p=[],b=1,j=null,S=3,z=!1,D=!1,G=!1,T=!1,w=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,H=typeof setImmediate<"u"?setImmediate:null;function K(_){for(var O=u(p);O!==null;){if(O.callback===null)o(p);else if(O.startTime<=_)o(p),O.sortIndex=O.expirationTime,c(x,O);else break;O=u(p)}}function se(_){if(G=!1,K(_),!D)if(u(x)!==null)D=!0,B||(B=!0,de());else{var O=u(p);O!==null&&xe(se,O.startTime-_)}}var B=!1,q=-1,I=5,W=-1;function ue(){return T?!0:!(i.unstable_now()-W<I)}function ne(){if(T=!1,B){var _=i.unstable_now();W=_;var O=!0;try{e:{D=!1,G&&(G=!1,R(q),q=-1),z=!0;var ee=S;try{t:{for(K(_),j=u(x);j!==null&&!(j.expirationTime>_&&ue());){var P=j.callback;if(typeof P=="function"){j.callback=null,S=j.priorityLevel;var oe=P(j.expirationTime<=_);if(_=i.unstable_now(),typeof oe=="function"){j.callback=oe,K(_),O=!0;break t}j===u(x)&&o(x),K(_)}else o(x);j=u(x)}if(j!==null)O=!0;else{var k=u(p);k!==null&&xe(se,k.startTime-_),O=!1}}break e}finally{j=null,S=ee,z=!1}O=void 0}}finally{O?de():B=!1}}}var de;if(typeof H=="function")de=function(){H(ne)};else if(typeof MessageChannel<"u"){var je=new MessageChannel,re=je.port2;je.port1.onmessage=ne,de=function(){re.postMessage(null)}}else de=function(){w(ne,0)};function xe(_,O){q=w(function(){_(i.unstable_now())},O)}i.unstable_IdlePriority=5,i.unstable_ImmediatePriority=1,i.unstable_LowPriority=4,i.unstable_NormalPriority=3,i.unstable_Profiling=null,i.unstable_UserBlockingPriority=2,i.unstable_cancelCallback=function(_){_.callback=null},i.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"):I=0<_?Math.floor(1e3/_):5},i.unstable_getCurrentPriorityLevel=function(){return S},i.unstable_next=function(_){switch(S){case 1:case 2:case 3:var O=3;break;default:O=S}var ee=S;S=O;try{return _()}finally{S=ee}},i.unstable_requestPaint=function(){T=!0},i.unstable_runWithPriority=function(_,O){switch(_){case 1:case 2:case 3:case 4:case 5:break;default:_=3}var ee=S;S=_;try{return O()}finally{S=ee}},i.unstable_scheduleCallback=function(_,O,ee){var P=i.unstable_now();switch(typeof ee=="object"&&ee!==null?(ee=ee.delay,ee=typeof ee=="number"&&0<ee?P+ee:P):ee=P,_){case 1:var oe=-1;break;case 2:oe=250;break;case 5:oe=1073741823;break;case 4:oe=1e4;break;default:oe=5e3}return oe=ee+oe,_={id:b++,callback:O,priorityLevel:_,startTime:ee,expirationTime:oe,sortIndex:-1},ee>P?(_.sortIndex=ee,c(p,_),u(x)===null&&_===u(p)&&(G?(R(q),q=-1):G=!0,xe(se,ee-P))):(_.sortIndex=oe,c(x,_),D||z||(D=!0,B||(B=!0,de()))),_},i.unstable_shouldYield=ue,i.unstable_wrapCallback=function(_){var O=S;return function(){var ee=S;S=O;try{return _.apply(this,arguments)}finally{S=ee}}}})(Bc)),Bc}var tp;function Ag(){return tp||(tp=1,Hc.exports=_g()),Hc.exports}var $c={exports:{}},Tt={};var np;function Dg(){if(np)return Tt;np=1;var i=ru();function c(x){var p="https://react.dev/errors/"+x;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)p+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+x+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function u(){}var o={d:{f:u,r:function(){throw Error(c(522))},D:u,C:u,L:u,m:u,X:u,S:u,M:u},p:0,findDOMNode:null},d=Symbol.for("react.portal");function f(x,p,b){var j=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:d,key:j==null?null:""+j,children:x,containerInfo:p,implementation:b}}var m=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function y(x,p){if(x==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return Tt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,Tt.createPortal=function(x,p){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(c(299));return f(x,p,null,b)},Tt.flushSync=function(x){var p=m.T,b=o.p;try{if(m.T=null,o.p=2,x)return x()}finally{m.T=p,o.p=b,o.d.f()}},Tt.preconnect=function(x,p){typeof x=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,o.d.C(x,p))},Tt.prefetchDNS=function(x){typeof x=="string"&&o.d.D(x)},Tt.preinit=function(x,p){if(typeof x=="string"&&p&&typeof p.as=="string"){var b=p.as,j=y(b,p.crossOrigin),S=typeof p.integrity=="string"?p.integrity:void 0,z=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;b==="style"?o.d.S(x,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:j,integrity:S,fetchPriority:z}):b==="script"&&o.d.X(x,{crossOrigin:j,integrity:S,fetchPriority:z,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Tt.preinitModule=function(x,p){if(typeof x=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var b=y(p.as,p.crossOrigin);o.d.M(x,{crossOrigin:b,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&o.d.M(x)},Tt.preload=function(x,p){if(typeof x=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var b=p.as,j=y(b,p.crossOrigin);o.d.L(x,b,{crossOrigin:j,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},Tt.preloadModule=function(x,p){if(typeof x=="string")if(p){var b=y(p.as,p.crossOrigin);o.d.m(x,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:b,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else o.d.m(x)},Tt.requestFormReset=function(x){o.d.r(x)},Tt.unstable_batchedUpdates=function(x,p){return x(p)},Tt.useFormState=function(x,p,b){return m.H.useFormState(x,p,b)},Tt.useFormStatus=function(){return m.H.useHostTransitionStatus()},Tt.version="19.2.8",Tt}var ap;function Rg(){if(ap)return $c.exports;ap=1;function i(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(c){console.error(c)}}return i(),$c.exports=Dg(),$c.exports}var lp;function Og(){if(lp)return Oi;lp=1;var i=Ag(),c=ru(),u=Rg();function o(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function d(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function f(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function m(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function y(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function x(e){if(f(e)!==e)throw Error(o(188))}function p(e){var t=e.alternate;if(!t){if(t=f(e),t===null)throw Error(o(188));return t!==e?null:e}for(var n=e,l=t;;){var s=n.return;if(s===null)break;var r=s.alternate;if(r===null){if(l=s.return,l!==null){n=l;continue}break}if(s.child===r.child){for(r=s.child;r;){if(r===n)return x(s),e;if(r===l)return x(s),t;r=r.sibling}throw Error(o(188))}if(n.return!==l.return)n=s,l=r;else{for(var h=!1,v=s.child;v;){if(v===n){h=!0,n=s,l=r;break}if(v===l){h=!0,l=s,n=r;break}v=v.sibling}if(!h){for(v=r.child;v;){if(v===n){h=!0,n=r,l=s;break}if(v===l){h=!0,l=r,n=s;break}v=v.sibling}if(!h)throw Error(o(189))}}if(n.alternate!==l)throw Error(o(190))}if(n.tag!==3)throw Error(o(188));return n.stateNode.current===n?e:t}function b(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=b(e),t!==null)return t;e=e.sibling}return null}var j=Object.assign,S=Symbol.for("react.element"),z=Symbol.for("react.transitional.element"),D=Symbol.for("react.portal"),G=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),H=Symbol.for("react.context"),K=Symbol.for("react.forward_ref"),se=Symbol.for("react.suspense"),B=Symbol.for("react.suspense_list"),q=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),W=Symbol.for("react.activity"),ue=Symbol.for("react.memo_cache_sentinel"),ne=Symbol.iterator;function de(e){return e===null||typeof e!="object"?null:(e=ne&&e[ne]||e["@@iterator"],typeof e=="function"?e:null)}var je=Symbol.for("react.client.reference");function re(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===je?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case G:return"Fragment";case w:return"Profiler";case T:return"StrictMode";case se:return"Suspense";case B:return"SuspenseList";case W:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case D:return"Portal";case H:return e.displayName||"Context";case R:return(e._context.displayName||"Context")+".Consumer";case K:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case q:return t=e.displayName||null,t!==null?t:re(e.type)||"Memo";case I:t=e._payload,e=e._init;try{return re(e(t))}catch{}}return null}var xe=Array.isArray,_=c.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,O=u.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee={pending:!1,data:null,method:null,action:null},P=[],oe=-1;function k(e){return{current:e}}function V(e){0>oe||(e.current=P[oe],P[oe]=null,oe--)}function C(e,t){oe++,P[oe]=e.current,e.current=t}var L=k(null),Z=k(null),ce=k(null),be=k(null);function He(e,t){switch(C(ce,t),C(Z,e),C(L,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?xh(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=xh(t),e=bh(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}V(L),C(L,e)}function ge(){V(L),V(Z),V(ce)}function ie(e){e.memoizedState!==null&&C(be,e);var t=L.current,n=bh(t,e.type);t!==n&&(C(Z,e),C(L,n))}function qe(e){Z.current===e&&(V(L),V(Z)),be.current===e&&(V(be),Ei._currentValue=ee)}var le,at;function ot(e){if(le===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);le=t&&t[1]||"",at=-1<n.stack.indexOf(`
2
+ at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
3
+ `+le+e+at}var pe=!1;function Ie(e,t){if(!e||pe)return"";pe=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(t){var F=function(){throw Error()};if(Object.defineProperty(F.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(F,[])}catch(Y){var $=Y}Reflect.construct(e,[],F)}else{try{F.call()}catch(Y){$=Y}e.call(F.prototype)}}else{try{throw Error()}catch(Y){$=Y}(F=e())&&typeof F.catch=="function"&&F.catch(function(){})}}catch(Y){if(Y&&$&&typeof Y.stack=="string")return[Y.stack,$.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var s=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");s&&s.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var r=l.DetermineComponentFrameRoot(),h=r[0],v=r[1];if(h&&v){var M=h.split(`
4
+ `),U=v.split(`
5
+ `);for(s=l=0;l<M.length&&!M[l].includes("DetermineComponentFrameRoot");)l++;for(;s<U.length&&!U[s].includes("DetermineComponentFrameRoot");)s++;if(l===M.length||s===U.length)for(l=M.length-1,s=U.length-1;1<=l&&0<=s&&M[l]!==U[s];)s--;for(;1<=l&&0<=s;l--,s--)if(M[l]!==U[s]){if(l!==1||s!==1)do if(l--,s--,0>s||M[l]!==U[s]){var X=`
6
+ `+M[l].replace(" at new "," at ");return e.displayName&&X.includes("<anonymous>")&&(X=X.replace("<anonymous>",e.displayName)),X}while(1<=l&&0<=s);break}}}finally{pe=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?ot(n):""}function lt(e,t){switch(e.tag){case 26:case 27:case 5:return ot(e.type);case 16:return ot("Lazy");case 13:return e.child!==t&&t!==null?ot("Suspense Fallback"):ot("Suspense");case 19:return ot("SuspenseList");case 0:case 15:return Ie(e.type,!1);case 11:return Ie(e.type.render,!1);case 1:return Ie(e.type,!0);case 31:return ot("Activity");default:return""}}function on(e){try{var t="",n=null;do t+=lt(e,n),n=e,e=e.return;while(e);return t}catch(l){return`
7
+ Error generating stack: `+l.message+`
8
+ `+l.stack}}var ht=Object.prototype.hasOwnProperty,Xt=i.unstable_scheduleCallback,Et=i.unstable_cancelCallback,Bl=i.unstable_shouldYield,zn=i.unstable_requestPaint,vt=i.unstable_now,kr=i.unstable_getCurrentPriorityLevel,$l=i.unstable_ImmediatePriority,qi=i.unstable_UserBlockingPriority,ka=i.unstable_NormalPriority,wr=i.unstable_LowPriority,wa=i.unstable_IdlePriority,Li=i.log,Yi=i.unstable_setDisableYieldValue,za=null,Ct=null;function Ht(e){if(typeof Li=="function"&&Yi(e),Ct&&typeof Ct.setStrictMode=="function")try{Ct.setStrictMode(za,e)}catch{}}var xt=Math.clz32?Math.clz32:Wi,Gi=Math.log,zr=Math.LN2;function Wi(e){return e>>>=0,e===0?32:31-(Gi(e)/zr|0)|0}var Ca=256,Fa=262144,Qt=4194304;function Kt(e){var t=e&42;if(t!==0)return t;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 Ta(e,t,n){var l=e.pendingLanes;if(l===0)return 0;var s=0,r=e.suspendedLanes,h=e.pingedLanes;e=e.warmLanes;var v=l&134217727;return v!==0?(l=v&~r,l!==0?s=Kt(l):(h&=v,h!==0?s=Kt(h):n||(n=v&~e,n!==0&&(s=Kt(n))))):(v=l&~r,v!==0?s=Kt(v):h!==0?s=Kt(h):n||(n=l&~e,n!==0&&(s=Kt(n)))),s===0?0:t!==0&&t!==s&&(t&r)===0&&(r=s&-s,n=t&-t,r>=n||r===32&&(n&4194048)!==0)?t:s}function Vn(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Vi(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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 Ma(){var e=Qt;return Qt<<=1,(Qt&62914560)===0&&(Qt=4194304),e}function Xn(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Qn(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Xi(e,t,n,l,s,r){var h=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var v=e.entanglements,M=e.expirationTimes,U=e.hiddenUpdates;for(n=h&~n;0<n;){var X=31-xt(n),F=1<<X;v[X]=0,M[X]=-1;var $=U[X];if($!==null)for(U[X]=null,X=0;X<$.length;X++){var Y=$[X];Y!==null&&(Y.lane&=-536870913)}n&=~F}l!==0&&Ja(e,l,0),r!==0&&s===0&&e.tag!==0&&(e.suspendedLanes|=r&~(h&~t))}function Ja(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-xt(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|n&261930}function Qi(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var l=31-xt(n),s=1<<l;s&t|e[l]&t&&(e[l]|=t),n&=~s}}function ql(e,t){var n=t&-t;return n=(n&42)!==0?1:Ea(n),(n&(e.suspendedLanes|t))!==0?0:n}function Ea(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 cn(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function mn(){var e=O.p;return e!==0?e:(e=window.event,e===void 0?32:Gh(e.type))}function Cn(e,t){var n=O.p;try{return O.p=e,t()}finally{O.p=n}}var Zt=Math.random().toString(36).slice(2),it="__reactFiber$"+Zt,bt="__reactProps$"+Zt,Kn="__reactContainer$"+Zt,Ll="__reactEvents$"+Zt,Yl="__reactListeners$"+Zt,Ia="__reactHandles$"+Zt,Ki="__reactResources$"+Zt,gn="__reactMarker$"+Zt;function _a(e){delete e[it],delete e[bt],delete e[Ll],delete e[Yl],delete e[Ia]}function Zn(e){var t=e[it];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Kn]||n[it]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Th(e);e!==null;){if(n=e[it])return n;e=Th(e)}return t}e=n,n=e.parentNode}return null}function un(e){if(e=e[it]||e[Kn]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Aa(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function Fn(e){var t=e[Ki];return t||(t=e[Ki]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Pe(e){e[gn]=!0}var Gl=new Set,Wl={};function yn(e,t){Tn(e,t),Tn(e+"Capture",t)}function Tn(e,t){for(Wl[e]=t,e=0;e<t.length;e++)Gl.add(t[e])}var Zi=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]*$"),Fi={},Ji={};function Ii(e){return ht.call(Ji,e)?!0:ht.call(Fi,e)?!1:Zi.test(e)?Ji[e]=!0:(Fi[e]=!0,!1)}function J(e,t,n){if(Ii(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var l=t.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+n)}}function Me(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+n)}}function Ze(e,t,n,l){if(l===null)e.removeAttribute(n);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+l)}}function mt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function dn(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Vl(e,t,n){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var s=l.get,r=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(h){n=""+h,r.call(this,h)}}),Object.defineProperty(e,t,{enumerable:l.enumerable}),{getValue:function(){return n},setValue:function(h){n=""+h},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Cr(e){if(!e._valueTracker){var t=dn(e)?"checked":"value";e._valueTracker=Vl(e,t,""+e[t])}}function du(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),l="";return e&&(l=dn(e)?e.checked?"true":"false":e.value),e=l,e!==n?(t.setValue(e),!0):!1}function Pi(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 bv=/[\n"\\]/g;function Ft(e){return e.replace(bv,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Tr(e,t,n,l,s,r,h,v){e.name="",h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"?e.type=h:e.removeAttribute("type"),t!=null?h==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+mt(t)):e.value!==""+mt(t)&&(e.value=""+mt(t)):h!=="submit"&&h!=="reset"||e.removeAttribute("value"),t!=null?Mr(e,h,mt(t)):n!=null?Mr(e,h,mt(n)):l!=null&&e.removeAttribute("value"),s==null&&r!=null&&(e.defaultChecked=!!r),s!=null&&(e.checked=s&&typeof s!="function"&&typeof s!="symbol"),v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?e.name=""+mt(v):e.removeAttribute("name")}function fu(e,t,n,l,s,r,h,v){if(r!=null&&typeof r!="function"&&typeof r!="symbol"&&typeof r!="boolean"&&(e.type=r),t!=null||n!=null){if(!(r!=="submit"&&r!=="reset"||t!=null)){Cr(e);return}n=n!=null?""+mt(n):"",t=t!=null?""+mt(t):n,v||t===e.value||(e.value=t),e.defaultValue=t}l=l??s,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=v?e.checked:!!l,e.defaultChecked=!!l,h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.name=h),Cr(e)}function Mr(e,t,n){t==="number"&&Pi(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Pa(e,t,n,l){if(e=e.options,t){t={};for(var s=0;s<n.length;s++)t["$"+n[s]]=!0;for(n=0;n<e.length;n++)s=t.hasOwnProperty("$"+e[n].value),e[n].selected!==s&&(e[n].selected=s),s&&l&&(e[n].defaultSelected=!0)}else{for(n=""+mt(n),t=null,s=0;s<e.length;s++){if(e[s].value===n){e[s].selected=!0,l&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function hu(e,t,n){if(t!=null&&(t=""+mt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+mt(n):""}function pu(e,t,n,l){if(t==null){if(l!=null){if(n!=null)throw Error(o(92));if(xe(l)){if(1<l.length)throw Error(o(93));l=l[0]}n=l}n==null&&(n=""),t=n}n=mt(t),e.defaultValue=n,l=e.textContent,l===n&&l!==""&&l!==null&&(e.value=l),Cr(e)}function el(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var jv=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 vu(e,t,n){var l=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?l?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":l?e.setProperty(t,n):typeof n!="number"||n===0||jv.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function mu(e,t,n){if(t!=null&&typeof t!="object")throw Error(o(62));if(e=e.style,n!=null){for(var l in n)!n.hasOwnProperty(l)||t!=null&&t.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var s in t)l=t[s],t.hasOwnProperty(s)&&n[s]!==l&&vu(e,s,l)}else for(var r in t)t.hasOwnProperty(r)&&vu(e,r,t[r])}function Er(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 Sv=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"]]),kv=/^[\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 es(e){return kv.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Mn(){}var _r=null;function Ar(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var tl=null,nl=null;function gu(e){var t=un(e);if(t&&(e=t.stateNode)){var n=e[bt]||null;e:switch(e=t.stateNode,t.type){case"input":if(Tr(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+Ft(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var l=n[t];if(l!==e&&l.form===e.form){var s=l[bt]||null;if(!s)throw Error(o(90));Tr(l,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name)}}for(t=0;t<n.length;t++)l=n[t],l.form===e.form&&du(l)}break e;case"textarea":hu(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Pa(e,!!n.multiple,t,!1)}}}var Dr=!1;function yu(e,t,n){if(Dr)return e(t,n);Dr=!0;try{var l=e(t);return l}finally{if(Dr=!1,(tl!==null||nl!==null)&&(Ls(),tl&&(t=tl,e=nl,nl=tl=null,gu(t),e)))for(t=0;t<e.length;t++)gu(e[t])}}function Xl(e,t){var n=e.stateNode;if(n===null)return null;var l=n[bt]||null;if(l===null)return null;n=l[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(o(231,t,typeof n));return n}var En=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Rr=!1;if(En)try{var Ql={};Object.defineProperty(Ql,"passive",{get:function(){Rr=!0}}),window.addEventListener("test",Ql,Ql),window.removeEventListener("test",Ql,Ql)}catch{Rr=!1}var Jn=null,Or=null,ts=null;function xu(){if(ts)return ts;var e,t=Or,n=t.length,l,s="value"in Jn?Jn.value:Jn.textContent,r=s.length;for(e=0;e<n&&t[e]===s[e];e++);var h=n-e;for(l=1;l<=h&&t[n-l]===s[r-l];l++);return ts=s.slice(e,1<l?1-l:void 0)}function ns(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function as(){return!0}function bu(){return!1}function _t(e){function t(n,l,s,r,h){this._reactName=n,this._targetInst=s,this.type=l,this.nativeEvent=r,this.target=h,this.currentTarget=null;for(var v in e)e.hasOwnProperty(v)&&(n=e[v],this[v]=n?n(r):r[v]);return this.isDefaultPrevented=(r.defaultPrevented!=null?r.defaultPrevented:r.returnValue===!1)?as:bu,this.isPropagationStopped=bu,this}return j(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=as)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=as)},persist:function(){},isPersistent:as}),t}var Da={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ls=_t(Da),Kl=j({},Da,{view:0,detail:0}),wv=_t(Kl),Nr,Ur,Zl,is=j({},Kl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Br,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!==Zl&&(Zl&&e.type==="mousemove"?(Nr=e.screenX-Zl.screenX,Ur=e.screenY-Zl.screenY):Ur=Nr=0,Zl=e),Nr)},movementY:function(e){return"movementY"in e?e.movementY:Ur}}),ju=_t(is),zv=j({},is,{dataTransfer:0}),Cv=_t(zv),Tv=j({},Kl,{relatedTarget:0}),Hr=_t(Tv),Mv=j({},Da,{animationName:0,elapsedTime:0,pseudoElement:0}),Ev=_t(Mv),_v=j({},Da,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Av=_t(_v),Dv=j({},Da,{data:0}),Su=_t(Dv),Rv={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ov={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"},Nv={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Uv(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Nv[e])?!!t[e]:!1}function Br(){return Uv}var Hv=j({},Kl,{key:function(e){if(e.key){var t=Rv[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=ns(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Ov[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Br,charCode:function(e){return e.type==="keypress"?ns(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ns(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Bv=_t(Hv),$v=j({},is,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ku=_t($v),qv=j({},Kl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Br}),Lv=_t(qv),Yv=j({},Da,{propertyName:0,elapsedTime:0,pseudoElement:0}),Gv=_t(Yv),Wv=j({},is,{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}),Vv=_t(Wv),Xv=j({},Da,{newState:0,oldState:0}),Qv=_t(Xv),Kv=[9,13,27,32],$r=En&&"CompositionEvent"in window,Fl=null;En&&"documentMode"in document&&(Fl=document.documentMode);var Zv=En&&"TextEvent"in window&&!Fl,wu=En&&(!$r||Fl&&8<Fl&&11>=Fl),zu=" ",Cu=!1;function Tu(e,t){switch(e){case"keyup":return Kv.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Mu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var al=!1;function Fv(e,t){switch(e){case"compositionend":return Mu(t);case"keypress":return t.which!==32?null:(Cu=!0,zu);case"textInput":return e=t.data,e===zu&&Cu?null:e;default:return null}}function Jv(e,t){if(al)return e==="compositionend"||!$r&&Tu(e,t)?(e=xu(),ts=Or=Jn=null,al=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return wu&&t.locale!=="ko"?null:t.data;default:return null}}var Iv={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 Eu(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Iv[e.type]:t==="textarea"}function _u(e,t,n,l){tl?nl?nl.push(l):nl=[l]:tl=l,t=Ks(t,"onChange"),0<t.length&&(n=new ls("onChange","change",null,n,l),e.push({event:n,listeners:t}))}var Jl=null,Il=null;function Pv(e){hh(e,0)}function ss(e){var t=Aa(e);if(du(t))return e}function Au(e,t){if(e==="change")return t}var Du=!1;if(En){var qr;if(En){var Lr="oninput"in document;if(!Lr){var Ru=document.createElement("div");Ru.setAttribute("oninput","return;"),Lr=typeof Ru.oninput=="function"}qr=Lr}else qr=!1;Du=qr&&(!document.documentMode||9<document.documentMode)}function Ou(){Jl&&(Jl.detachEvent("onpropertychange",Nu),Il=Jl=null)}function Nu(e){if(e.propertyName==="value"&&ss(Il)){var t=[];_u(t,Il,e,Ar(e)),yu(Pv,t)}}function em(e,t,n){e==="focusin"?(Ou(),Jl=t,Il=n,Jl.attachEvent("onpropertychange",Nu)):e==="focusout"&&Ou()}function tm(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ss(Il)}function nm(e,t){if(e==="click")return ss(t)}function am(e,t){if(e==="input"||e==="change")return ss(t)}function lm(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Bt=typeof Object.is=="function"?Object.is:lm;function Pl(e,t){if(Bt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),l=Object.keys(t);if(n.length!==l.length)return!1;for(l=0;l<n.length;l++){var s=n[l];if(!ht.call(t,s)||!Bt(e[s],t[s]))return!1}return!0}function Uu(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Hu(e,t){var n=Uu(e);e=0;for(var l;n;){if(n.nodeType===3){if(l=e+n.textContent.length,e<=t&&l>=t)return{node:n,offset:t-e};e=l}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Uu(n)}}function Bu(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Bu(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function $u(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Pi(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Pi(e.document)}return t}function Yr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var im=En&&"documentMode"in document&&11>=document.documentMode,ll=null,Gr=null,ei=null,Wr=!1;function qu(e,t,n){var l=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Wr||ll==null||ll!==Pi(l)||(l=ll,"selectionStart"in l&&Yr(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),ei&&Pl(ei,l)||(ei=l,l=Ks(Gr,"onSelect"),0<l.length&&(t=new ls("onSelect","select",null,t,n),e.push({event:t,listeners:l}),t.target=ll)))}function Ra(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var il={animationend:Ra("Animation","AnimationEnd"),animationiteration:Ra("Animation","AnimationIteration"),animationstart:Ra("Animation","AnimationStart"),transitionrun:Ra("Transition","TransitionRun"),transitionstart:Ra("Transition","TransitionStart"),transitioncancel:Ra("Transition","TransitionCancel"),transitionend:Ra("Transition","TransitionEnd")},Vr={},Lu={};En&&(Lu=document.createElement("div").style,"AnimationEvent"in window||(delete il.animationend.animation,delete il.animationiteration.animation,delete il.animationstart.animation),"TransitionEvent"in window||delete il.transitionend.transition);function Oa(e){if(Vr[e])return Vr[e];if(!il[e])return e;var t=il[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Lu)return Vr[e]=t[n];return e}var Yu=Oa("animationend"),Gu=Oa("animationiteration"),Wu=Oa("animationstart"),sm=Oa("transitionrun"),rm=Oa("transitionstart"),om=Oa("transitioncancel"),Vu=Oa("transitionend"),Xu=new Map,Xr="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(" ");Xr.push("scrollEnd");function fn(e,t){Xu.set(e,t),yn(t,[e])}var rs=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=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(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Jt=[],sl=0,Qr=0;function os(){for(var e=sl,t=Qr=sl=0;t<e;){var n=Jt[t];Jt[t++]=null;var l=Jt[t];Jt[t++]=null;var s=Jt[t];Jt[t++]=null;var r=Jt[t];if(Jt[t++]=null,l!==null&&s!==null){var h=l.pending;h===null?s.next=s:(s.next=h.next,h.next=s),l.pending=s}r!==0&&Qu(n,s,r)}}function cs(e,t,n,l){Jt[sl++]=e,Jt[sl++]=t,Jt[sl++]=n,Jt[sl++]=l,Qr|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function Kr(e,t,n,l){return cs(e,t,n,l),us(e)}function Na(e,t){return cs(e,null,null,t),us(e)}function Qu(e,t,n){e.lanes|=n;var l=e.alternate;l!==null&&(l.lanes|=n);for(var s=!1,r=e.return;r!==null;)r.childLanes|=n,l=r.alternate,l!==null&&(l.childLanes|=n),r.tag===22&&(e=r.stateNode,e===null||e._visibility&1||(s=!0)),e=r,r=r.return;return e.tag===3?(r=e.stateNode,s&&t!==null&&(s=31-xt(n),e=r.hiddenUpdates,l=e[s],l===null?e[s]=[t]:l.push(t),t.lane=n|536870912),r):null}function us(e){if(50<Si)throw Si=0,lc=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var rl={};function cm(e,t,n,l){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function $t(e,t,n,l){return new cm(e,t,n,l)}function Zr(e){return e=e.prototype,!(!e||!e.isReactComponent)}function _n(e,t){var n=e.alternate;return n===null?(n=$t(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function Ku(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function ds(e,t,n,l,s,r){var h=0;if(l=e,typeof e=="function")Zr(e)&&(h=1);else if(typeof e=="string")h=pg(e,n,L.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case W:return e=$t(31,n,t,s),e.elementType=W,e.lanes=r,e;case G:return Ua(n.children,s,r,t);case T:h=8,s|=24;break;case w:return e=$t(12,n,t,s|2),e.elementType=w,e.lanes=r,e;case se:return e=$t(13,n,t,s),e.elementType=se,e.lanes=r,e;case B:return e=$t(19,n,t,s),e.elementType=B,e.lanes=r,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case H:h=10;break e;case R:h=9;break e;case K:h=11;break e;case q:h=14;break e;case I:h=16,l=null;break e}h=29,n=Error(o(130,e===null?"null":typeof e,"")),l=null}return t=$t(h,n,t,s),t.elementType=e,t.type=l,t.lanes=r,t}function Ua(e,t,n,l){return e=$t(7,e,l,t),e.lanes=n,e}function Fr(e,t,n){return e=$t(6,e,null,t),e.lanes=n,e}function Zu(e){var t=$t(18,null,null,0);return t.stateNode=e,t}function Jr(e,t,n){return t=$t(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Fu=new WeakMap;function It(e,t){if(typeof e=="object"&&e!==null){var n=Fu.get(e);return n!==void 0?n:(t={value:e,source:t,stack:on(t)},Fu.set(e,t),t)}return{value:e,source:t,stack:on(t)}}var ol=[],cl=0,fs=null,ti=0,Pt=[],en=0,In=null,xn=1,bn="";function An(e,t){ol[cl++]=ti,ol[cl++]=fs,fs=e,ti=t}function Ju(e,t,n){Pt[en++]=xn,Pt[en++]=bn,Pt[en++]=In,In=e;var l=xn;e=bn;var s=32-xt(l)-1;l&=~(1<<s),n+=1;var r=32-xt(t)+s;if(30<r){var h=s-s%5;r=(l&(1<<h)-1).toString(32),l>>=h,s-=h,xn=1<<32-xt(t)+s|n<<s|l,bn=r+e}else xn=1<<r|n<<s|l,bn=e}function Ir(e){e.return!==null&&(An(e,1),Ju(e,1,0))}function Pr(e){for(;e===fs;)fs=ol[--cl],ol[cl]=null,ti=ol[--cl],ol[cl]=null;for(;e===In;)In=Pt[--en],Pt[en]=null,bn=Pt[--en],Pt[en]=null,xn=Pt[--en],Pt[en]=null}function Iu(e,t){Pt[en++]=xn,Pt[en++]=bn,Pt[en++]=In,xn=t.id,bn=t.overflow,In=e}var jt=null,Xe=null,Ae=!1,Pn=null,tn=!1,eo=Error(o(519));function ea(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ni(It(t,e)),eo}function Pu(e){var t=e.stateNode,n=e.type,l=e.memoizedProps;switch(t[it]=e,t[bt]=l,n){case"dialog":Te("cancel",t),Te("close",t);break;case"iframe":case"object":case"embed":Te("load",t);break;case"video":case"audio":for(n=0;n<wi.length;n++)Te(wi[n],t);break;case"source":Te("error",t);break;case"img":case"image":case"link":Te("error",t),Te("load",t);break;case"details":Te("toggle",t);break;case"input":Te("invalid",t),fu(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Te("invalid",t);break;case"textarea":Te("invalid",t),pu(t,l.value,l.defaultValue,l.children)}n=l.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||l.suppressHydrationWarning===!0||gh(t.textContent,n)?(l.popover!=null&&(Te("beforetoggle",t),Te("toggle",t)),l.onScroll!=null&&Te("scroll",t),l.onScrollEnd!=null&&Te("scrollend",t),l.onClick!=null&&(t.onclick=Mn),t=!0):t=!1,t||ea(e,!0)}function ed(e){for(jt=e.return;jt;)switch(jt.tag){case 5:case 31:case 13:tn=!1;return;case 27:case 3:tn=!0;return;default:jt=jt.return}}function ul(e){if(e!==jt)return!1;if(!Ae)return ed(e),Ae=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||xc(e.type,e.memoizedProps)),n=!n),n&&Xe&&ea(e),ed(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));Xe=Ch(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));Xe=Ch(e)}else t===27?(t=Xe,pa(e.type)?(e=wc,wc=null,Xe=e):Xe=t):Xe=jt?an(e.stateNode.nextSibling):null;return!0}function Ha(){Xe=jt=null,Ae=!1}function to(){var e=Pn;return e!==null&&(Ot===null?Ot=e:Ot.push.apply(Ot,e),Pn=null),e}function ni(e){Pn===null?Pn=[e]:Pn.push(e)}var no=k(null),Ba=null,Dn=null;function ta(e,t,n){C(no,t._currentValue),t._currentValue=n}function Rn(e){e._currentValue=no.current,V(no)}function ao(e,t,n){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===n)break;e=e.return}}function lo(e,t,n,l){var s=e.child;for(s!==null&&(s.return=e);s!==null;){var r=s.dependencies;if(r!==null){var h=s.child;r=r.firstContext;e:for(;r!==null;){var v=r;r=s;for(var M=0;M<t.length;M++)if(v.context===t[M]){r.lanes|=n,v=r.alternate,v!==null&&(v.lanes|=n),ao(r.return,n,e),l||(h=null);break e}r=v.next}}else if(s.tag===18){if(h=s.return,h===null)throw Error(o(341));h.lanes|=n,r=h.alternate,r!==null&&(r.lanes|=n),ao(h,n,e),h=null}else h=s.child;if(h!==null)h.return=s;else for(h=s;h!==null;){if(h===e){h=null;break}if(s=h.sibling,s!==null){s.return=h.return,h=s;break}h=h.return}s=h}}function dl(e,t,n,l){e=null;for(var s=t,r=!1;s!==null;){if(!r){if((s.flags&524288)!==0)r=!0;else if((s.flags&262144)!==0)break}if(s.tag===10){var h=s.alternate;if(h===null)throw Error(o(387));if(h=h.memoizedProps,h!==null){var v=s.type;Bt(s.pendingProps.value,h.value)||(e!==null?e.push(v):e=[v])}}else if(s===be.current){if(h=s.alternate,h===null)throw Error(o(387));h.memoizedState.memoizedState!==s.memoizedState.memoizedState&&(e!==null?e.push(Ei):e=[Ei])}s=s.return}e!==null&&lo(t,e,n,l),t.flags|=262144}function hs(e){for(e=e.firstContext;e!==null;){if(!Bt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function $a(e){Ba=e,Dn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function St(e){return td(Ba,e)}function ps(e,t){return Ba===null&&$a(e),td(e,t)}function td(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Dn===null){if(e===null)throw Error(o(308));Dn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Dn=Dn.next=t;return n}var um=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,l){e.push(l)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},dm=i.unstable_scheduleCallback,fm=i.unstable_NormalPriority,ct={$$typeof:H,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function io(){return{controller:new um,data:new Map,refCount:0}}function ai(e){e.refCount--,e.refCount===0&&dm(fm,function(){e.controller.abort()})}var li=null,so=0,fl=0,hl=null;function hm(e,t){if(li===null){var n=li=[];so=0,fl=uc(),hl={status:"pending",value:void 0,then:function(l){n.push(l)}}}return so++,t.then(nd,nd),t}function nd(){if(--so===0&&li!==null){hl!==null&&(hl.status="fulfilled");var e=li;li=null,fl=0,hl=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function pm(e,t){var n=[],l={status:"pending",value:null,reason:null,then:function(s){n.push(s)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var s=0;s<n.length;s++)(0,n[s])(t)},function(s){for(l.status="rejected",l.reason=s,s=0;s<n.length;s++)(0,n[s])(void 0)}),l}var ad=_.S;_.S=function(e,t){Lf=vt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&hm(e,t),ad!==null&&ad(e,t)};var qa=k(null);function ro(){var e=qa.current;return e!==null?e:We.pooledCache}function vs(e,t){t===null?C(qa,qa.current):C(qa,t.pool)}function ld(){var e=ro();return e===null?null:{parent:ct._currentValue,pool:e}}var pl=Error(o(460)),oo=Error(o(474)),ms=Error(o(542)),gs={then:function(){}};function id(e){return e=e.status,e==="fulfilled"||e==="rejected"}function sd(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Mn,Mn),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,od(e),e;default:if(typeof t.status=="string")t.then(Mn,Mn);else{if(e=We,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status="pending",e.then(function(l){if(t.status==="pending"){var s=t;s.status="fulfilled",s.value=l}},function(l){if(t.status==="pending"){var s=t;s.status="rejected",s.reason=l}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,od(e),e}throw Ya=t,pl}}function La(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Ya=n,pl):n}}var Ya=null;function rd(){if(Ya===null)throw Error(o(459));var e=Ya;return Ya=null,e}function od(e){if(e===pl||e===ms)throw Error(o(483))}var vl=null,ii=0;function ys(e){var t=ii;return ii+=1,vl===null&&(vl=[]),sd(vl,e,t)}function si(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function xs(e,t){throw t.$$typeof===S?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function cd(e){function t(A,E){if(e){var N=A.deletions;N===null?(A.deletions=[E],A.flags|=16):N.push(E)}}function n(A,E){if(!e)return null;for(;E!==null;)t(A,E),E=E.sibling;return null}function l(A){for(var E=new Map;A!==null;)A.key!==null?E.set(A.key,A):E.set(A.index,A),A=A.sibling;return E}function s(A,E){return A=_n(A,E),A.index=0,A.sibling=null,A}function r(A,E,N){return A.index=N,e?(N=A.alternate,N!==null?(N=N.index,N<E?(A.flags|=67108866,E):N):(A.flags|=67108866,E)):(A.flags|=1048576,E)}function h(A){return e&&A.alternate===null&&(A.flags|=67108866),A}function v(A,E,N,Q){return E===null||E.tag!==6?(E=Fr(N,A.mode,Q),E.return=A,E):(E=s(E,N),E.return=A,E)}function M(A,E,N,Q){var me=N.type;return me===G?X(A,E,N.props.children,Q,N.key):E!==null&&(E.elementType===me||typeof me=="object"&&me!==null&&me.$$typeof===I&&La(me)===E.type)?(E=s(E,N.props),si(E,N),E.return=A,E):(E=ds(N.type,N.key,N.props,null,A.mode,Q),si(E,N),E.return=A,E)}function U(A,E,N,Q){return E===null||E.tag!==4||E.stateNode.containerInfo!==N.containerInfo||E.stateNode.implementation!==N.implementation?(E=Jr(N,A.mode,Q),E.return=A,E):(E=s(E,N.children||[]),E.return=A,E)}function X(A,E,N,Q,me){return E===null||E.tag!==7?(E=Ua(N,A.mode,Q,me),E.return=A,E):(E=s(E,N),E.return=A,E)}function F(A,E,N){if(typeof E=="string"&&E!==""||typeof E=="number"||typeof E=="bigint")return E=Fr(""+E,A.mode,N),E.return=A,E;if(typeof E=="object"&&E!==null){switch(E.$$typeof){case z:return N=ds(E.type,E.key,E.props,null,A.mode,N),si(N,E),N.return=A,N;case D:return E=Jr(E,A.mode,N),E.return=A,E;case I:return E=La(E),F(A,E,N)}if(xe(E)||de(E))return E=Ua(E,A.mode,N,null),E.return=A,E;if(typeof E.then=="function")return F(A,ys(E),N);if(E.$$typeof===H)return F(A,ps(A,E),N);xs(A,E)}return null}function $(A,E,N,Q){var me=E!==null?E.key:null;if(typeof N=="string"&&N!==""||typeof N=="number"||typeof N=="bigint")return me!==null?null:v(A,E,""+N,Q);if(typeof N=="object"&&N!==null){switch(N.$$typeof){case z:return N.key===me?M(A,E,N,Q):null;case D:return N.key===me?U(A,E,N,Q):null;case I:return N=La(N),$(A,E,N,Q)}if(xe(N)||de(N))return me!==null?null:X(A,E,N,Q,null);if(typeof N.then=="function")return $(A,E,ys(N),Q);if(N.$$typeof===H)return $(A,E,ps(A,N),Q);xs(A,N)}return null}function Y(A,E,N,Q,me){if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return A=A.get(N)||null,v(E,A,""+Q,me);if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case z:return A=A.get(Q.key===null?N:Q.key)||null,M(E,A,Q,me);case D:return A=A.get(Q.key===null?N:Q.key)||null,U(E,A,Q,me);case I:return Q=La(Q),Y(A,E,N,Q,me)}if(xe(Q)||de(Q))return A=A.get(N)||null,X(E,A,Q,me,null);if(typeof Q.then=="function")return Y(A,E,N,ys(Q),me);if(Q.$$typeof===H)return Y(A,E,N,ps(E,Q),me);xs(E,Q)}return null}function he(A,E,N,Q){for(var me=null,De=null,ve=E,ze=E=0,_e=null;ve!==null&&ze<N.length;ze++){ve.index>ze?(_e=ve,ve=null):_e=ve.sibling;var Re=$(A,ve,N[ze],Q);if(Re===null){ve===null&&(ve=_e);break}e&&ve&&Re.alternate===null&&t(A,ve),E=r(Re,E,ze),De===null?me=Re:De.sibling=Re,De=Re,ve=_e}if(ze===N.length)return n(A,ve),Ae&&An(A,ze),me;if(ve===null){for(;ze<N.length;ze++)ve=F(A,N[ze],Q),ve!==null&&(E=r(ve,E,ze),De===null?me=ve:De.sibling=ve,De=ve);return Ae&&An(A,ze),me}for(ve=l(ve);ze<N.length;ze++)_e=Y(ve,A,ze,N[ze],Q),_e!==null&&(e&&_e.alternate!==null&&ve.delete(_e.key===null?ze:_e.key),E=r(_e,E,ze),De===null?me=_e:De.sibling=_e,De=_e);return e&&ve.forEach(function(xa){return t(A,xa)}),Ae&&An(A,ze),me}function ye(A,E,N,Q){if(N==null)throw Error(o(151));for(var me=null,De=null,ve=E,ze=E=0,_e=null,Re=N.next();ve!==null&&!Re.done;ze++,Re=N.next()){ve.index>ze?(_e=ve,ve=null):_e=ve.sibling;var xa=$(A,ve,Re.value,Q);if(xa===null){ve===null&&(ve=_e);break}e&&ve&&xa.alternate===null&&t(A,ve),E=r(xa,E,ze),De===null?me=xa:De.sibling=xa,De=xa,ve=_e}if(Re.done)return n(A,ve),Ae&&An(A,ze),me;if(ve===null){for(;!Re.done;ze++,Re=N.next())Re=F(A,Re.value,Q),Re!==null&&(E=r(Re,E,ze),De===null?me=Re:De.sibling=Re,De=Re);return Ae&&An(A,ze),me}for(ve=l(ve);!Re.done;ze++,Re=N.next())Re=Y(ve,A,ze,Re.value,Q),Re!==null&&(e&&Re.alternate!==null&&ve.delete(Re.key===null?ze:Re.key),E=r(Re,E,ze),De===null?me=Re:De.sibling=Re,De=Re);return e&&ve.forEach(function(zg){return t(A,zg)}),Ae&&An(A,ze),me}function Ge(A,E,N,Q){if(typeof N=="object"&&N!==null&&N.type===G&&N.key===null&&(N=N.props.children),typeof N=="object"&&N!==null){switch(N.$$typeof){case z:e:{for(var me=N.key;E!==null;){if(E.key===me){if(me=N.type,me===G){if(E.tag===7){n(A,E.sibling),Q=s(E,N.props.children),Q.return=A,A=Q;break e}}else if(E.elementType===me||typeof me=="object"&&me!==null&&me.$$typeof===I&&La(me)===E.type){n(A,E.sibling),Q=s(E,N.props),si(Q,N),Q.return=A,A=Q;break e}n(A,E);break}else t(A,E);E=E.sibling}N.type===G?(Q=Ua(N.props.children,A.mode,Q,N.key),Q.return=A,A=Q):(Q=ds(N.type,N.key,N.props,null,A.mode,Q),si(Q,N),Q.return=A,A=Q)}return h(A);case D:e:{for(me=N.key;E!==null;){if(E.key===me)if(E.tag===4&&E.stateNode.containerInfo===N.containerInfo&&E.stateNode.implementation===N.implementation){n(A,E.sibling),Q=s(E,N.children||[]),Q.return=A,A=Q;break e}else{n(A,E);break}else t(A,E);E=E.sibling}Q=Jr(N,A.mode,Q),Q.return=A,A=Q}return h(A);case I:return N=La(N),Ge(A,E,N,Q)}if(xe(N))return he(A,E,N,Q);if(de(N)){if(me=de(N),typeof me!="function")throw Error(o(150));return N=me.call(N),ye(A,E,N,Q)}if(typeof N.then=="function")return Ge(A,E,ys(N),Q);if(N.$$typeof===H)return Ge(A,E,ps(A,N),Q);xs(A,N)}return typeof N=="string"&&N!==""||typeof N=="number"||typeof N=="bigint"?(N=""+N,E!==null&&E.tag===6?(n(A,E.sibling),Q=s(E,N),Q.return=A,A=Q):(n(A,E),Q=Fr(N,A.mode,Q),Q.return=A,A=Q),h(A)):n(A,E)}return function(A,E,N,Q){try{ii=0;var me=Ge(A,E,N,Q);return vl=null,me}catch(ve){if(ve===pl||ve===ms)throw ve;var De=$t(29,ve,null,A.mode);return De.lanes=Q,De.return=A,De}}}var Ga=cd(!0),ud=cd(!1),na=!1;function co(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function uo(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function aa(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function la(e,t,n){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Ne&2)!==0){var s=l.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),l.pending=t,t=us(e),Qu(e,null,n),t}return cs(e,l,t,n),us(e)}function ri(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var l=t.lanes;l&=e.pendingLanes,n|=l,t.lanes=n,Qi(e,n)}}function fo(e,t){var n=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,n===l)){var s=null,r=null;if(n=n.firstBaseUpdate,n!==null){do{var h={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};r===null?s=r=h:r=r.next=h,n=n.next}while(n!==null);r===null?s=r=t:r=r.next=t}else s=r=t;n={baseState:l.baseState,firstBaseUpdate:s,lastBaseUpdate:r,shared:l.shared,callbacks:l.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var ho=!1;function oi(){if(ho){var e=hl;if(e!==null)throw e}}function ci(e,t,n,l){ho=!1;var s=e.updateQueue;na=!1;var r=s.firstBaseUpdate,h=s.lastBaseUpdate,v=s.shared.pending;if(v!==null){s.shared.pending=null;var M=v,U=M.next;M.next=null,h===null?r=U:h.next=U,h=M;var X=e.alternate;X!==null&&(X=X.updateQueue,v=X.lastBaseUpdate,v!==h&&(v===null?X.firstBaseUpdate=U:v.next=U,X.lastBaseUpdate=M))}if(r!==null){var F=s.baseState;h=0,X=U=M=null,v=r;do{var $=v.lane&-536870913,Y=$!==v.lane;if(Y?(Ee&$)===$:(l&$)===$){$!==0&&$===fl&&(ho=!0),X!==null&&(X=X.next={lane:0,tag:v.tag,payload:v.payload,callback:null,next:null});e:{var he=e,ye=v;$=t;var Ge=n;switch(ye.tag){case 1:if(he=ye.payload,typeof he=="function"){F=he.call(Ge,F,$);break e}F=he;break e;case 3:he.flags=he.flags&-65537|128;case 0:if(he=ye.payload,$=typeof he=="function"?he.call(Ge,F,$):he,$==null)break e;F=j({},F,$);break e;case 2:na=!0}}$=v.callback,$!==null&&(e.flags|=64,Y&&(e.flags|=8192),Y=s.callbacks,Y===null?s.callbacks=[$]:Y.push($))}else Y={lane:$,tag:v.tag,payload:v.payload,callback:v.callback,next:null},X===null?(U=X=Y,M=F):X=X.next=Y,h|=$;if(v=v.next,v===null){if(v=s.shared.pending,v===null)break;Y=v,v=Y.next,Y.next=null,s.lastBaseUpdate=Y,s.shared.pending=null}}while(!0);X===null&&(M=F),s.baseState=M,s.firstBaseUpdate=U,s.lastBaseUpdate=X,r===null&&(s.shared.lanes=0),ca|=h,e.lanes=h,e.memoizedState=F}}function dd(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function fd(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)dd(n[e],t)}var ml=k(null),bs=k(0);function hd(e,t){e=Yn,C(bs,e),C(ml,t),Yn=e|t.baseLanes}function po(){C(bs,Yn),C(ml,ml.current)}function vo(){Yn=bs.current,V(ml),V(bs)}var qt=k(null),nn=null;function ia(e){var t=e.alternate;C(st,st.current&1),C(qt,e),nn===null&&(t===null||ml.current!==null||t.memoizedState!==null)&&(nn=e)}function mo(e){C(st,st.current),C(qt,e),nn===null&&(nn=e)}function pd(e){e.tag===22?(C(st,st.current),C(qt,e),nn===null&&(nn=e)):sa()}function sa(){C(st,st.current),C(qt,qt.current)}function Lt(e){V(qt),nn===e&&(nn=null),V(st)}var st=k(0);function js(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||Sc(n)||kc(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var On=0,we=null,Le=null,ut=null,Ss=!1,gl=!1,Wa=!1,ks=0,ui=0,yl=null,vm=0;function et(){throw Error(o(321))}function go(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Bt(e[n],t[n]))return!1;return!0}function yo(e,t,n,l,s,r){return On=r,we=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,_.H=e===null||e.memoizedState===null?Jd:Ro,Wa=!1,r=n(l,s),Wa=!1,gl&&(r=md(t,n,l,s)),vd(e),r}function vd(e){_.H=hi;var t=Le!==null&&Le.next!==null;if(On=0,ut=Le=we=null,Ss=!1,ui=0,yl=null,t)throw Error(o(300));e===null||dt||(e=e.dependencies,e!==null&&hs(e)&&(dt=!0))}function md(e,t,n,l){we=e;var s=0;do{if(gl&&(yl=null),ui=0,gl=!1,25<=s)throw Error(o(301));if(s+=1,ut=Le=null,e.updateQueue!=null){var r=e.updateQueue;r.lastEffect=null,r.events=null,r.stores=null,r.memoCache!=null&&(r.memoCache.index=0)}_.H=Id,r=t(n,l)}while(gl);return r}function mm(){var e=_.H,t=e.useState()[0];return t=typeof t.then=="function"?di(t):t,e=e.useState()[0],(Le!==null?Le.memoizedState:null)!==e&&(we.flags|=1024),t}function xo(){var e=ks!==0;return ks=0,e}function bo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function jo(e){if(Ss){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Ss=!1}On=0,ut=Le=we=null,gl=!1,ui=ks=0,yl=null}function Mt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ut===null?we.memoizedState=ut=e:ut=ut.next=e,ut}function rt(){if(Le===null){var e=we.alternate;e=e!==null?e.memoizedState:null}else e=Le.next;var t=ut===null?we.memoizedState:ut.next;if(t!==null)ut=t,Le=e;else{if(e===null)throw we.alternate===null?Error(o(467)):Error(o(310));Le=e,e={memoizedState:Le.memoizedState,baseState:Le.baseState,baseQueue:Le.baseQueue,queue:Le.queue,next:null},ut===null?we.memoizedState=ut=e:ut=ut.next=e}return ut}function ws(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function di(e){var t=ui;return ui+=1,yl===null&&(yl=[]),e=sd(yl,e,t),t=we,(ut===null?t.memoizedState:ut.next)===null&&(t=t.alternate,_.H=t===null||t.memoizedState===null?Jd:Ro),e}function zs(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return di(e);if(e.$$typeof===H)return St(e)}throw Error(o(438,String(e)))}function So(e){var t=null,n=we.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var l=we.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(s){return s.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=ws(),we.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),l=0;l<e;l++)n[l]=ue;return t.index++,n}function Nn(e,t){return typeof t=="function"?t(e):t}function Cs(e){var t=rt();return ko(t,Le,e)}function ko(e,t,n){var l=e.queue;if(l===null)throw Error(o(311));l.lastRenderedReducer=n;var s=e.baseQueue,r=l.pending;if(r!==null){if(s!==null){var h=s.next;s.next=r.next,r.next=h}t.baseQueue=s=r,l.pending=null}if(r=e.baseState,s===null)e.memoizedState=r;else{t=s.next;var v=h=null,M=null,U=t,X=!1;do{var F=U.lane&-536870913;if(F!==U.lane?(Ee&F)===F:(On&F)===F){var $=U.revertLane;if($===0)M!==null&&(M=M.next={lane:0,revertLane:0,gesture:null,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null}),F===fl&&(X=!0);else if((On&$)===$){U=U.next,$===fl&&(X=!0);continue}else F={lane:0,revertLane:U.revertLane,gesture:null,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null},M===null?(v=M=F,h=r):M=M.next=F,we.lanes|=$,ca|=$;F=U.action,Wa&&n(r,F),r=U.hasEagerState?U.eagerState:n(r,F)}else $={lane:F,revertLane:U.revertLane,gesture:U.gesture,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null},M===null?(v=M=$,h=r):M=M.next=$,we.lanes|=F,ca|=F;U=U.next}while(U!==null&&U!==t);if(M===null?h=r:M.next=v,!Bt(r,e.memoizedState)&&(dt=!0,X&&(n=hl,n!==null)))throw n;e.memoizedState=r,e.baseState=h,e.baseQueue=M,l.lastRenderedState=r}return s===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function wo(e){var t=rt(),n=t.queue;if(n===null)throw Error(o(311));n.lastRenderedReducer=e;var l=n.dispatch,s=n.pending,r=t.memoizedState;if(s!==null){n.pending=null;var h=s=s.next;do r=e(r,h.action),h=h.next;while(h!==s);Bt(r,t.memoizedState)||(dt=!0),t.memoizedState=r,t.baseQueue===null&&(t.baseState=r),n.lastRenderedState=r}return[r,l]}function gd(e,t,n){var l=we,s=rt(),r=Ae;if(r){if(n===void 0)throw Error(o(407));n=n()}else n=t();var h=!Bt((Le||s).memoizedState,n);if(h&&(s.memoizedState=n,dt=!0),s=s.queue,To(bd.bind(null,l,s,e),[e]),s.getSnapshot!==t||h||ut!==null&&ut.memoizedState.tag&1){if(l.flags|=2048,xl(9,{destroy:void 0},xd.bind(null,l,s,n,t),null),We===null)throw Error(o(349));r||(On&127)!==0||yd(l,t,n)}return n}function yd(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=we.updateQueue,t===null?(t=ws(),we.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function xd(e,t,n,l){t.value=n,t.getSnapshot=l,jd(t)&&Sd(e)}function bd(e,t,n){return n(function(){jd(t)&&Sd(e)})}function jd(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Bt(e,n)}catch{return!0}}function Sd(e){var t=Na(e,2);t!==null&&Nt(t,e,2)}function zo(e){var t=Mt();if(typeof e=="function"){var n=e;if(e=n(),Wa){Ht(!0);try{n()}finally{Ht(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Nn,lastRenderedState:e},t}function kd(e,t,n,l){return e.baseState=n,ko(e,Le,typeof l=="function"?l:Nn)}function gm(e,t,n,l,s){if(Es(e))throw Error(o(485));if(e=t.action,e!==null){var r={payload:s,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(h){r.listeners.push(h)}};_.T!==null?n(!0):r.isTransition=!1,l(r),n=t.pending,n===null?(r.next=t.pending=r,wd(t,r)):(r.next=n.next,t.pending=n.next=r)}}function wd(e,t){var n=t.action,l=t.payload,s=e.state;if(t.isTransition){var r=_.T,h={};_.T=h;try{var v=n(s,l),M=_.S;M!==null&&M(h,v),zd(e,t,v)}catch(U){Co(e,t,U)}finally{r!==null&&h.types!==null&&(r.types=h.types),_.T=r}}else try{r=n(s,l),zd(e,t,r)}catch(U){Co(e,t,U)}}function zd(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(l){Cd(e,t,l)},function(l){return Co(e,t,l)}):Cd(e,t,n)}function Cd(e,t,n){t.status="fulfilled",t.value=n,Td(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,wd(e,n)))}function Co(e,t,n){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=n,Td(t),t=t.next;while(t!==l)}e.action=null}function Td(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Md(e,t){return t}function Ed(e,t){if(Ae){var n=We.formState;if(n!==null){e:{var l=we;if(Ae){if(Xe){t:{for(var s=Xe,r=tn;s.nodeType!==8;){if(!r){s=null;break t}if(s=an(s.nextSibling),s===null){s=null;break t}}r=s.data,s=r==="F!"||r==="F"?s:null}if(s){Xe=an(s.nextSibling),l=s.data==="F!";break e}}ea(l)}l=!1}l&&(t=n[0])}}return n=Mt(),n.memoizedState=n.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Md,lastRenderedState:t},n.queue=l,n=Kd.bind(null,we,l),l.dispatch=n,l=zo(!1),r=Do.bind(null,we,!1,l.queue),l=Mt(),s={state:t,dispatch:null,action:e,pending:null},l.queue=s,n=gm.bind(null,we,s,r,n),s.dispatch=n,l.memoizedState=e,[t,n,!1]}function _d(e){var t=rt();return Ad(t,Le,e)}function Ad(e,t,n){if(t=ko(e,t,Md)[0],e=Cs(Nn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=di(t)}catch(h){throw h===pl?ms:h}else l=t;t=rt();var s=t.queue,r=s.dispatch;return n!==t.memoizedState&&(we.flags|=2048,xl(9,{destroy:void 0},ym.bind(null,s,n),null)),[l,r,e]}function ym(e,t){e.action=t}function Dd(e){var t=rt(),n=Le;if(n!==null)return Ad(t,n,e);rt(),t=t.memoizedState,n=rt();var l=n.queue.dispatch;return n.memoizedState=e,[t,l,!1]}function xl(e,t,n,l){return e={tag:e,create:n,deps:l,inst:t,next:null},t=we.updateQueue,t===null&&(t=ws(),we.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(l=n.next,n.next=e,e.next=l,t.lastEffect=e),e}function Rd(){return rt().memoizedState}function Ts(e,t,n,l){var s=Mt();we.flags|=e,s.memoizedState=xl(1|t,{destroy:void 0},n,l===void 0?null:l)}function Ms(e,t,n,l){var s=rt();l=l===void 0?null:l;var r=s.memoizedState.inst;Le!==null&&l!==null&&go(l,Le.memoizedState.deps)?s.memoizedState=xl(t,r,n,l):(we.flags|=e,s.memoizedState=xl(1|t,r,n,l))}function Od(e,t){Ts(8390656,8,e,t)}function To(e,t){Ms(2048,8,e,t)}function xm(e){we.flags|=4;var t=we.updateQueue;if(t===null)t=ws(),we.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Nd(e){var t=rt().memoizedState;return xm({ref:t,nextImpl:e}),function(){if((Ne&2)!==0)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function Ud(e,t){return Ms(4,2,e,t)}function Hd(e,t){return Ms(4,4,e,t)}function Bd(e,t){if(typeof t=="function"){e=e();var n=t(e);return function(){typeof n=="function"?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function $d(e,t,n){n=n!=null?n.concat([e]):null,Ms(4,4,Bd.bind(null,t,e),n)}function Mo(){}function qd(e,t){var n=rt();t=t===void 0?null:t;var l=n.memoizedState;return t!==null&&go(t,l[1])?l[0]:(n.memoizedState=[e,t],e)}function Ld(e,t){var n=rt();t=t===void 0?null:t;var l=n.memoizedState;if(t!==null&&go(t,l[1]))return l[0];if(l=e(),Wa){Ht(!0);try{e()}finally{Ht(!1)}}return n.memoizedState=[l,t],l}function Eo(e,t,n){return n===void 0||(On&1073741824)!==0&&(Ee&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=Gf(),we.lanes|=e,ca|=e,n)}function Yd(e,t,n,l){return Bt(n,t)?n:ml.current!==null?(e=Eo(e,n,l),Bt(e,t)||(dt=!0),e):(On&42)===0||(On&1073741824)!==0&&(Ee&261930)===0?(dt=!0,e.memoizedState=n):(e=Gf(),we.lanes|=e,ca|=e,t)}function Gd(e,t,n,l,s){var r=O.p;O.p=r!==0&&8>r?r:8;var h=_.T,v={};_.T=v,Do(e,!1,t,n);try{var M=s(),U=_.S;if(U!==null&&U(v,M),M!==null&&typeof M=="object"&&typeof M.then=="function"){var X=pm(M,l);fi(e,t,X,Wt(e))}else fi(e,t,l,Wt(e))}catch(F){fi(e,t,{then:function(){},status:"rejected",reason:F},Wt())}finally{O.p=r,h!==null&&v.types!==null&&(h.types=v.types),_.T=h}}function bm(){}function _o(e,t,n,l){if(e.tag!==5)throw Error(o(476));var s=Wd(e).queue;Gd(e,s,t,ee,n===null?bm:function(){return Vd(e),n(l)})}function Wd(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ee,baseState:ee,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Nn,lastRenderedState:ee},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Nn,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Vd(e){var t=Wd(e);t.next===null&&(t=e.alternate.memoizedState),fi(e,t.next.queue,{},Wt())}function Ao(){return St(Ei)}function Xd(){return rt().memoizedState}function Qd(){return rt().memoizedState}function jm(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Wt();e=aa(n);var l=la(t,e,n);l!==null&&(Nt(l,t,n),ri(l,t,n)),t={cache:io()},e.payload=t;return}t=t.return}}function Sm(e,t,n){var l=Wt();n={lane:l,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Es(e)?Zd(t,n):(n=Kr(e,t,n,l),n!==null&&(Nt(n,e,l),Fd(n,t,l)))}function Kd(e,t,n){var l=Wt();fi(e,t,n,l)}function fi(e,t,n,l){var s={lane:l,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Es(e))Zd(t,s);else{var r=e.alternate;if(e.lanes===0&&(r===null||r.lanes===0)&&(r=t.lastRenderedReducer,r!==null))try{var h=t.lastRenderedState,v=r(h,n);if(s.hasEagerState=!0,s.eagerState=v,Bt(v,h))return cs(e,t,s,0),We===null&&os(),!1}catch{}if(n=Kr(e,t,s,l),n!==null)return Nt(n,e,l),Fd(n,t,l),!0}return!1}function Do(e,t,n,l){if(l={lane:2,revertLane:uc(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Es(e)){if(t)throw Error(o(479))}else t=Kr(e,n,l,2),t!==null&&Nt(t,e,2)}function Es(e){var t=e.alternate;return e===we||t!==null&&t===we}function Zd(e,t){gl=Ss=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Fd(e,t,n){if((n&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,n|=l,t.lanes=n,Qi(e,n)}}var hi={readContext:St,use:zs,useCallback:et,useContext:et,useEffect:et,useImperativeHandle:et,useLayoutEffect:et,useInsertionEffect:et,useMemo:et,useReducer:et,useRef:et,useState:et,useDebugValue:et,useDeferredValue:et,useTransition:et,useSyncExternalStore:et,useId:et,useHostTransitionStatus:et,useFormState:et,useActionState:et,useOptimistic:et,useMemoCache:et,useCacheRefresh:et};hi.useEffectEvent=et;var Jd={readContext:St,use:zs,useCallback:function(e,t){return Mt().memoizedState=[e,t===void 0?null:t],e},useContext:St,useEffect:Od,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,Ts(4194308,4,Bd.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ts(4194308,4,e,t)},useInsertionEffect:function(e,t){Ts(4,2,e,t)},useMemo:function(e,t){var n=Mt();t=t===void 0?null:t;var l=e();if(Wa){Ht(!0);try{e()}finally{Ht(!1)}}return n.memoizedState=[l,t],l},useReducer:function(e,t,n){var l=Mt();if(n!==void 0){var s=n(t);if(Wa){Ht(!0);try{n(t)}finally{Ht(!1)}}}else s=t;return l.memoizedState=l.baseState=s,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:s},l.queue=e,e=e.dispatch=Sm.bind(null,we,e),[l.memoizedState,e]},useRef:function(e){var t=Mt();return e={current:e},t.memoizedState=e},useState:function(e){e=zo(e);var t=e.queue,n=Kd.bind(null,we,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Mo,useDeferredValue:function(e,t){var n=Mt();return Eo(n,e,t)},useTransition:function(){var e=zo(!1);return e=Gd.bind(null,we,e.queue,!0,!1),Mt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var l=we,s=Mt();if(Ae){if(n===void 0)throw Error(o(407));n=n()}else{if(n=t(),We===null)throw Error(o(349));(Ee&127)!==0||yd(l,t,n)}s.memoizedState=n;var r={value:n,getSnapshot:t};return s.queue=r,Od(bd.bind(null,l,r,e),[e]),l.flags|=2048,xl(9,{destroy:void 0},xd.bind(null,l,r,n,t),null),n},useId:function(){var e=Mt(),t=We.identifierPrefix;if(Ae){var n=bn,l=xn;n=(l&~(1<<32-xt(l)-1)).toString(32)+n,t="_"+t+"R_"+n,n=ks++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=vm++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Ao,useFormState:Ed,useActionState:Ed,useOptimistic:function(e){var t=Mt();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Do.bind(null,we,!0,n),n.dispatch=t,[e,t]},useMemoCache:So,useCacheRefresh:function(){return Mt().memoizedState=jm.bind(null,we)},useEffectEvent:function(e){var t=Mt(),n={impl:e};return t.memoizedState=n,function(){if((Ne&2)!==0)throw Error(o(440));return n.impl.apply(void 0,arguments)}}},Ro={readContext:St,use:zs,useCallback:qd,useContext:St,useEffect:To,useImperativeHandle:$d,useInsertionEffect:Ud,useLayoutEffect:Hd,useMemo:Ld,useReducer:Cs,useRef:Rd,useState:function(){return Cs(Nn)},useDebugValue:Mo,useDeferredValue:function(e,t){var n=rt();return Yd(n,Le.memoizedState,e,t)},useTransition:function(){var e=Cs(Nn)[0],t=rt().memoizedState;return[typeof e=="boolean"?e:di(e),t]},useSyncExternalStore:gd,useId:Xd,useHostTransitionStatus:Ao,useFormState:_d,useActionState:_d,useOptimistic:function(e,t){var n=rt();return kd(n,Le,e,t)},useMemoCache:So,useCacheRefresh:Qd};Ro.useEffectEvent=Nd;var Id={readContext:St,use:zs,useCallback:qd,useContext:St,useEffect:To,useImperativeHandle:$d,useInsertionEffect:Ud,useLayoutEffect:Hd,useMemo:Ld,useReducer:wo,useRef:Rd,useState:function(){return wo(Nn)},useDebugValue:Mo,useDeferredValue:function(e,t){var n=rt();return Le===null?Eo(n,e,t):Yd(n,Le.memoizedState,e,t)},useTransition:function(){var e=wo(Nn)[0],t=rt().memoizedState;return[typeof e=="boolean"?e:di(e),t]},useSyncExternalStore:gd,useId:Xd,useHostTransitionStatus:Ao,useFormState:Dd,useActionState:Dd,useOptimistic:function(e,t){var n=rt();return Le!==null?kd(n,Le,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:So,useCacheRefresh:Qd};Id.useEffectEvent=Nd;function Oo(e,t,n,l){t=e.memoizedState,n=n(l,t),n=n==null?t:j({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var No={enqueueSetState:function(e,t,n){e=e._reactInternals;var l=Wt(),s=aa(l);s.payload=t,n!=null&&(s.callback=n),t=la(e,s,l),t!==null&&(Nt(t,e,l),ri(t,e,l))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var l=Wt(),s=aa(l);s.tag=1,s.payload=t,n!=null&&(s.callback=n),t=la(e,s,l),t!==null&&(Nt(t,e,l),ri(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Wt(),l=aa(n);l.tag=2,t!=null&&(l.callback=t),t=la(e,l,n),t!==null&&(Nt(t,e,n),ri(t,e,n))}};function Pd(e,t,n,l,s,r,h){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,r,h):t.prototype&&t.prototype.isPureReactComponent?!Pl(n,l)||!Pl(s,r):!0}function ef(e,t,n,l){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,l),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,l),t.state!==e&&No.enqueueReplaceState(t,t.state,null)}function Va(e,t){var n=t;if("ref"in t){n={};for(var l in t)l!=="ref"&&(n[l]=t[l])}if(e=e.defaultProps){n===t&&(n=j({},n));for(var s in e)n[s]===void 0&&(n[s]=e[s])}return n}function tf(e){rs(e)}function nf(e){console.error(e)}function af(e){rs(e)}function _s(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function lf(e,t,n){try{var l=e.onCaughtError;l(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(s){setTimeout(function(){throw s})}}function Uo(e,t,n){return n=aa(n),n.tag=3,n.payload={element:null},n.callback=function(){_s(e,t)},n}function sf(e){return e=aa(e),e.tag=3,e}function rf(e,t,n,l){var s=n.type.getDerivedStateFromError;if(typeof s=="function"){var r=l.value;e.payload=function(){return s(r)},e.callback=function(){lf(t,n,l)}}var h=n.stateNode;h!==null&&typeof h.componentDidCatch=="function"&&(e.callback=function(){lf(t,n,l),typeof s!="function"&&(ua===null?ua=new Set([this]):ua.add(this));var v=l.stack;this.componentDidCatch(l.value,{componentStack:v!==null?v:""})})}function km(e,t,n,l,s){if(n.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=n.alternate,t!==null&&dl(t,n,s,!0),n=qt.current,n!==null){switch(n.tag){case 31:case 13:return nn===null?Ys():n.alternate===null&&tt===0&&(tt=3),n.flags&=-257,n.flags|=65536,n.lanes=s,l===gs?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([l]):t.add(l),rc(e,l,s)),!1;case 22:return n.flags|=65536,l===gs?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([l])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([l]):n.add(l)),rc(e,l,s)),!1}throw Error(o(435,n.tag))}return rc(e,l,s),Ys(),!1}if(Ae)return t=qt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=s,l!==eo&&(e=Error(o(422),{cause:l}),ni(It(e,n)))):(l!==eo&&(t=Error(o(423),{cause:l}),ni(It(t,n))),e=e.current.alternate,e.flags|=65536,s&=-s,e.lanes|=s,l=It(l,n),s=Uo(e.stateNode,l,s),fo(e,s),tt!==4&&(tt=2)),!1;var r=Error(o(520),{cause:l});if(r=It(r,n),ji===null?ji=[r]:ji.push(r),tt!==4&&(tt=2),t===null)return!0;l=It(l,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=s&-s,n.lanes|=e,e=Uo(n.stateNode,l,e),fo(n,e),!1;case 1:if(t=n.type,r=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||r!==null&&typeof r.componentDidCatch=="function"&&(ua===null||!ua.has(r))))return n.flags|=65536,s&=-s,n.lanes|=s,s=sf(s),rf(s,e,n,l),fo(n,s),!1}n=n.return}while(n!==null);return!1}var Ho=Error(o(461)),dt=!1;function kt(e,t,n,l){t.child=e===null?ud(t,null,n,l):Ga(t,e.child,n,l)}function of(e,t,n,l,s){n=n.render;var r=t.ref;if("ref"in l){var h={};for(var v in l)v!=="ref"&&(h[v]=l[v])}else h=l;return $a(t),l=yo(e,t,n,h,r,s),v=xo(),e!==null&&!dt?(bo(e,t,s),Un(e,t,s)):(Ae&&v&&Ir(t),t.flags|=1,kt(e,t,l,s),t.child)}function cf(e,t,n,l,s){if(e===null){var r=n.type;return typeof r=="function"&&!Zr(r)&&r.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=r,uf(e,t,r,l,s)):(e=ds(n.type,null,l,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(r=e.child,!Vo(e,s)){var h=r.memoizedProps;if(n=n.compare,n=n!==null?n:Pl,n(h,l)&&e.ref===t.ref)return Un(e,t,s)}return t.flags|=1,e=_n(r,l),e.ref=t.ref,e.return=t,t.child=e}function uf(e,t,n,l,s){if(e!==null){var r=e.memoizedProps;if(Pl(r,l)&&e.ref===t.ref)if(dt=!1,t.pendingProps=l=r,Vo(e,s))(e.flags&131072)!==0&&(dt=!0);else return t.lanes=e.lanes,Un(e,t,s)}return Bo(e,t,n,l,s)}function df(e,t,n,l){var s=l.children,r=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((t.flags&128)!==0){if(r=r!==null?r.baseLanes|n:n,e!==null){for(l=t.child=e.child,s=0;l!==null;)s=s|l.lanes|l.childLanes,l=l.sibling;l=s&~r}else l=0,t.child=null;return ff(e,t,r,n,l)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&vs(t,r!==null?r.cachePool:null),r!==null?hd(t,r):po(),pd(t);else return l=t.lanes=536870912,ff(e,t,r!==null?r.baseLanes|n:n,n,l)}else r!==null?(vs(t,r.cachePool),hd(t,r),sa(),t.memoizedState=null):(e!==null&&vs(t,null),po(),sa());return kt(e,t,s,n),t.child}function pi(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function ff(e,t,n,l,s){var r=ro();return r=r===null?null:{parent:ct._currentValue,pool:r},t.memoizedState={baseLanes:n,cachePool:r},e!==null&&vs(t,null),po(),pd(t),e!==null&&dl(e,t,l,!0),t.childLanes=s,null}function As(e,t){return t=Rs({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function hf(e,t,n){return Ga(t,e.child,null,n),e=As(t,t.pendingProps),e.flags|=2,Lt(t),t.memoizedState=null,e}function wm(e,t,n){var l=t.pendingProps,s=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Ae){if(l.mode==="hidden")return e=As(t,l),t.lanes=536870912,pi(null,e);if(mo(t),(e=Xe)?(e=zh(e,tn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:In!==null?{id:xn,overflow:bn}:null,retryLane:536870912,hydrationErrors:null},n=Zu(e),n.return=t,t.child=n,jt=t,Xe=null)):e=null,e===null)throw ea(t);return t.lanes=536870912,null}return As(t,l)}var r=e.memoizedState;if(r!==null){var h=r.dehydrated;if(mo(t),s)if(t.flags&256)t.flags&=-257,t=hf(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558));else if(dt||dl(e,t,n,!1),s=(n&e.childLanes)!==0,dt||s){if(l=We,l!==null&&(h=ql(l,n),h!==0&&h!==r.retryLane))throw r.retryLane=h,Na(e,h),Nt(l,e,h),Ho;Ys(),t=hf(e,t,n)}else e=r.treeContext,Xe=an(h.nextSibling),jt=t,Ae=!0,Pn=null,tn=!1,e!==null&&Iu(t,e),t=As(t,l),t.flags|=4096;return t}return e=_n(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Ds(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(o(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function Bo(e,t,n,l,s){return $a(t),n=yo(e,t,n,l,void 0,s),l=xo(),e!==null&&!dt?(bo(e,t,s),Un(e,t,s)):(Ae&&l&&Ir(t),t.flags|=1,kt(e,t,n,s),t.child)}function pf(e,t,n,l,s,r){return $a(t),t.updateQueue=null,n=md(t,l,n,s),vd(e),l=xo(),e!==null&&!dt?(bo(e,t,r),Un(e,t,r)):(Ae&&l&&Ir(t),t.flags|=1,kt(e,t,n,r),t.child)}function vf(e,t,n,l,s){if($a(t),t.stateNode===null){var r=rl,h=n.contextType;typeof h=="object"&&h!==null&&(r=St(h)),r=new n(l,r),t.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,r.updater=No,t.stateNode=r,r._reactInternals=t,r=t.stateNode,r.props=l,r.state=t.memoizedState,r.refs={},co(t),h=n.contextType,r.context=typeof h=="object"&&h!==null?St(h):rl,r.state=t.memoizedState,h=n.getDerivedStateFromProps,typeof h=="function"&&(Oo(t,n,h,l),r.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof r.getSnapshotBeforeUpdate=="function"||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(h=r.state,typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount(),h!==r.state&&No.enqueueReplaceState(r,r.state,null),ci(t,l,r,s),oi(),r.state=t.memoizedState),typeof r.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){r=t.stateNode;var v=t.memoizedProps,M=Va(n,v);r.props=M;var U=r.context,X=n.contextType;h=rl,typeof X=="object"&&X!==null&&(h=St(X));var F=n.getDerivedStateFromProps;X=typeof F=="function"||typeof r.getSnapshotBeforeUpdate=="function",v=t.pendingProps!==v,X||typeof r.UNSAFE_componentWillReceiveProps!="function"&&typeof r.componentWillReceiveProps!="function"||(v||U!==h)&&ef(t,r,l,h),na=!1;var $=t.memoizedState;r.state=$,ci(t,l,r,s),oi(),U=t.memoizedState,v||$!==U||na?(typeof F=="function"&&(Oo(t,n,F,l),U=t.memoizedState),(M=na||Pd(t,n,M,l,$,U,h))?(X||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount()),typeof r.componentDidMount=="function"&&(t.flags|=4194308)):(typeof r.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=U),r.props=l,r.state=U,r.context=h,l=M):(typeof r.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{r=t.stateNode,uo(e,t),h=t.memoizedProps,X=Va(n,h),r.props=X,F=t.pendingProps,$=r.context,U=n.contextType,M=rl,typeof U=="object"&&U!==null&&(M=St(U)),v=n.getDerivedStateFromProps,(U=typeof v=="function"||typeof r.getSnapshotBeforeUpdate=="function")||typeof r.UNSAFE_componentWillReceiveProps!="function"&&typeof r.componentWillReceiveProps!="function"||(h!==F||$!==M)&&ef(t,r,l,M),na=!1,$=t.memoizedState,r.state=$,ci(t,l,r,s),oi();var Y=t.memoizedState;h!==F||$!==Y||na||e!==null&&e.dependencies!==null&&hs(e.dependencies)?(typeof v=="function"&&(Oo(t,n,v,l),Y=t.memoizedState),(X=na||Pd(t,n,X,l,$,Y,M)||e!==null&&e.dependencies!==null&&hs(e.dependencies))?(U||typeof r.UNSAFE_componentWillUpdate!="function"&&typeof r.componentWillUpdate!="function"||(typeof r.componentWillUpdate=="function"&&r.componentWillUpdate(l,Y,M),typeof r.UNSAFE_componentWillUpdate=="function"&&r.UNSAFE_componentWillUpdate(l,Y,M)),typeof r.componentDidUpdate=="function"&&(t.flags|=4),typeof r.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof r.componentDidUpdate!="function"||h===e.memoizedProps&&$===e.memoizedState||(t.flags|=4),typeof r.getSnapshotBeforeUpdate!="function"||h===e.memoizedProps&&$===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=Y),r.props=l,r.state=Y,r.context=M,l=X):(typeof r.componentDidUpdate!="function"||h===e.memoizedProps&&$===e.memoizedState||(t.flags|=4),typeof r.getSnapshotBeforeUpdate!="function"||h===e.memoizedProps&&$===e.memoizedState||(t.flags|=1024),l=!1)}return r=l,Ds(e,t),l=(t.flags&128)!==0,r||l?(r=t.stateNode,n=l&&typeof n.getDerivedStateFromError!="function"?null:r.render(),t.flags|=1,e!==null&&l?(t.child=Ga(t,e.child,null,s),t.child=Ga(t,null,n,s)):kt(e,t,n,s),t.memoizedState=r.state,e=t.child):e=Un(e,t,s),e}function mf(e,t,n,l){return Ha(),t.flags|=256,kt(e,t,n,l),t.child}var $o={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function qo(e){return{baseLanes:e,cachePool:ld()}}function Lo(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Gt),e}function gf(e,t,n){var l=t.pendingProps,s=!1,r=(t.flags&128)!==0,h;if((h=r)||(h=e!==null&&e.memoizedState===null?!1:(st.current&2)!==0),h&&(s=!0,t.flags&=-129),h=(t.flags&32)!==0,t.flags&=-33,e===null){if(Ae){if(s?ia(t):sa(),(e=Xe)?(e=zh(e,tn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:In!==null?{id:xn,overflow:bn}:null,retryLane:536870912,hydrationErrors:null},n=Zu(e),n.return=t,t.child=n,jt=t,Xe=null)):e=null,e===null)throw ea(t);return kc(e)?t.lanes=32:t.lanes=536870912,null}var v=l.children;return l=l.fallback,s?(sa(),s=t.mode,v=Rs({mode:"hidden",children:v},s),l=Ua(l,s,n,null),v.return=t,l.return=t,v.sibling=l,t.child=v,l=t.child,l.memoizedState=qo(n),l.childLanes=Lo(e,h,n),t.memoizedState=$o,pi(null,l)):(ia(t),Yo(t,v))}var M=e.memoizedState;if(M!==null&&(v=M.dehydrated,v!==null)){if(r)t.flags&256?(ia(t),t.flags&=-257,t=Go(e,t,n)):t.memoizedState!==null?(sa(),t.child=e.child,t.flags|=128,t=null):(sa(),v=l.fallback,s=t.mode,l=Rs({mode:"visible",children:l.children},s),v=Ua(v,s,n,null),v.flags|=2,l.return=t,v.return=t,l.sibling=v,t.child=l,Ga(t,e.child,null,n),l=t.child,l.memoizedState=qo(n),l.childLanes=Lo(e,h,n),t.memoizedState=$o,t=pi(null,l));else if(ia(t),kc(v)){if(h=v.nextSibling&&v.nextSibling.dataset,h)var U=h.dgst;h=U,l=Error(o(419)),l.stack="",l.digest=h,ni({value:l,source:null,stack:null}),t=Go(e,t,n)}else if(dt||dl(e,t,n,!1),h=(n&e.childLanes)!==0,dt||h){if(h=We,h!==null&&(l=ql(h,n),l!==0&&l!==M.retryLane))throw M.retryLane=l,Na(e,l),Nt(h,e,l),Ho;Sc(v)||Ys(),t=Go(e,t,n)}else Sc(v)?(t.flags|=192,t.child=e.child,t=null):(e=M.treeContext,Xe=an(v.nextSibling),jt=t,Ae=!0,Pn=null,tn=!1,e!==null&&Iu(t,e),t=Yo(t,l.children),t.flags|=4096);return t}return s?(sa(),v=l.fallback,s=t.mode,M=e.child,U=M.sibling,l=_n(M,{mode:"hidden",children:l.children}),l.subtreeFlags=M.subtreeFlags&65011712,U!==null?v=_n(U,v):(v=Ua(v,s,n,null),v.flags|=2),v.return=t,l.return=t,l.sibling=v,t.child=l,pi(null,l),l=t.child,v=e.child.memoizedState,v===null?v=qo(n):(s=v.cachePool,s!==null?(M=ct._currentValue,s=s.parent!==M?{parent:M,pool:M}:s):s=ld(),v={baseLanes:v.baseLanes|n,cachePool:s}),l.memoizedState=v,l.childLanes=Lo(e,h,n),t.memoizedState=$o,pi(e.child,l)):(ia(t),n=e.child,e=n.sibling,n=_n(n,{mode:"visible",children:l.children}),n.return=t,n.sibling=null,e!==null&&(h=t.deletions,h===null?(t.deletions=[e],t.flags|=16):h.push(e)),t.child=n,t.memoizedState=null,n)}function Yo(e,t){return t=Rs({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Rs(e,t){return e=$t(22,e,null,t),e.lanes=0,e}function Go(e,t,n){return Ga(t,e.child,null,n),e=Yo(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function yf(e,t,n){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),ao(e.return,t,n)}function Wo(e,t,n,l,s,r){var h=e.memoizedState;h===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:n,tailMode:s,treeForkCount:r}:(h.isBackwards=t,h.rendering=null,h.renderingStartTime=0,h.last=l,h.tail=n,h.tailMode=s,h.treeForkCount=r)}function xf(e,t,n){var l=t.pendingProps,s=l.revealOrder,r=l.tail;l=l.children;var h=st.current,v=(h&2)!==0;if(v?(h=h&1|2,t.flags|=128):h&=1,C(st,h),kt(e,t,l,n),l=Ae?ti:0,!v&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&yf(e,n,t);else if(e.tag===19)yf(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(s){case"forwards":for(n=t.child,s=null;n!==null;)e=n.alternate,e!==null&&js(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),Wo(t,!1,s,n,r,l);break;case"backwards":case"unstable_legacy-backwards":for(n=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&js(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}Wo(t,!0,n,null,r,l);break;case"together":Wo(t,!1,null,null,void 0,l);break;default:t.memoizedState=null}return t.child}function Un(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),ca|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(dl(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,n=_n(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=_n(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Vo(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&hs(e)))}function zm(e,t,n){switch(t.tag){case 3:He(t,t.stateNode.containerInfo),ta(t,ct,e.memoizedState.cache),Ha();break;case 27:case 5:ie(t);break;case 4:He(t,t.stateNode.containerInfo);break;case 10:ta(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,mo(t),null;break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(ia(t),t.flags|=128,null):(n&t.child.childLanes)!==0?gf(e,t,n):(ia(t),e=Un(e,t,n),e!==null?e.sibling:null);ia(t);break;case 19:var s=(e.flags&128)!==0;if(l=(n&t.childLanes)!==0,l||(dl(e,t,n,!1),l=(n&t.childLanes)!==0),s){if(l)return xf(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),C(st,st.current),l)break;return null;case 22:return t.lanes=0,df(e,t,n,t.pendingProps);case 24:ta(t,ct,e.memoizedState.cache)}return Un(e,t,n)}function bf(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)dt=!0;else{if(!Vo(e,n)&&(t.flags&128)===0)return dt=!1,zm(e,t,n);dt=(e.flags&131072)!==0}else dt=!1,Ae&&(t.flags&1048576)!==0&&Ju(t,ti,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=La(t.elementType),t.type=e,typeof e=="function")Zr(e)?(l=Va(e,l),t.tag=1,t=vf(null,t,e,l,n)):(t.tag=0,t=Bo(null,t,e,l,n));else{if(e!=null){var s=e.$$typeof;if(s===K){t.tag=11,t=of(null,t,e,l,n);break e}else if(s===q){t.tag=14,t=cf(null,t,e,l,n);break e}}throw t=re(e)||e,Error(o(306,t,""))}}return t;case 0:return Bo(e,t,t.type,t.pendingProps,n);case 1:return l=t.type,s=Va(l,t.pendingProps),vf(e,t,l,s,n);case 3:e:{if(He(t,t.stateNode.containerInfo),e===null)throw Error(o(387));l=t.pendingProps;var r=t.memoizedState;s=r.element,uo(e,t),ci(t,l,null,n);var h=t.memoizedState;if(l=h.cache,ta(t,ct,l),l!==r.cache&&lo(t,[ct],n,!0),oi(),l=h.element,r.isDehydrated)if(r={element:l,isDehydrated:!1,cache:h.cache},t.updateQueue.baseState=r,t.memoizedState=r,t.flags&256){t=mf(e,t,l,n);break e}else if(l!==s){s=It(Error(o(424)),t),ni(s),t=mf(e,t,l,n);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,Xe=an(e.firstChild),jt=t,Ae=!0,Pn=null,tn=!0,n=ud(t,null,l,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Ha(),l===s){t=Un(e,t,n);break e}kt(e,t,l,n)}t=t.child}return t;case 26:return Ds(e,t),e===null?(n=Ah(t.type,null,t.pendingProps,null))?t.memoizedState=n:Ae||(n=t.type,e=t.pendingProps,l=Zs(ce.current).createElement(n),l[it]=t,l[bt]=e,wt(l,n,e),Pe(l),t.stateNode=l):t.memoizedState=Ah(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ie(t),e===null&&Ae&&(l=t.stateNode=Mh(t.type,t.pendingProps,ce.current),jt=t,tn=!0,s=Xe,pa(t.type)?(wc=s,Xe=an(l.firstChild)):Xe=s),kt(e,t,t.pendingProps.children,n),Ds(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ae&&((s=l=Xe)&&(l=tg(l,t.type,t.pendingProps,tn),l!==null?(t.stateNode=l,jt=t,Xe=an(l.firstChild),tn=!1,s=!0):s=!1),s||ea(t)),ie(t),s=t.type,r=t.pendingProps,h=e!==null?e.memoizedProps:null,l=r.children,xc(s,r)?l=null:h!==null&&xc(s,h)&&(t.flags|=32),t.memoizedState!==null&&(s=yo(e,t,mm,null,null,n),Ei._currentValue=s),Ds(e,t),kt(e,t,l,n),t.child;case 6:return e===null&&Ae&&((e=n=Xe)&&(n=ng(n,t.pendingProps,tn),n!==null?(t.stateNode=n,jt=t,Xe=null,e=!0):e=!1),e||ea(t)),null;case 13:return gf(e,t,n);case 4:return He(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=Ga(t,null,l,n):kt(e,t,l,n),t.child;case 11:return of(e,t,t.type,t.pendingProps,n);case 7:return kt(e,t,t.pendingProps,n),t.child;case 8:return kt(e,t,t.pendingProps.children,n),t.child;case 12:return kt(e,t,t.pendingProps.children,n),t.child;case 10:return l=t.pendingProps,ta(t,t.type,l.value),kt(e,t,l.children,n),t.child;case 9:return s=t.type._context,l=t.pendingProps.children,$a(t),s=St(s),l=l(s),t.flags|=1,kt(e,t,l,n),t.child;case 14:return cf(e,t,t.type,t.pendingProps,n);case 15:return uf(e,t,t.type,t.pendingProps,n);case 19:return xf(e,t,n);case 31:return wm(e,t,n);case 22:return df(e,t,n,t.pendingProps);case 24:return $a(t),l=St(ct),e===null?(s=ro(),s===null&&(s=We,r=io(),s.pooledCache=r,r.refCount++,r!==null&&(s.pooledCacheLanes|=n),s=r),t.memoizedState={parent:l,cache:s},co(t),ta(t,ct,s)):((e.lanes&n)!==0&&(uo(e,t),ci(t,null,null,n),oi()),s=e.memoizedState,r=t.memoizedState,s.parent!==l?(s={parent:l,cache:l},t.memoizedState=s,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=s),ta(t,ct,l)):(l=r.cache,ta(t,ct,l),l!==s.cache&&lo(t,[ct],n,!0))),kt(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function Hn(e){e.flags|=4}function Xo(e,t,n,l,s){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(s&335544128)===s)if(e.stateNode.complete)e.flags|=8192;else if(Qf())e.flags|=8192;else throw Ya=gs,oo}else e.flags&=-16777217}function jf(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Uh(t))if(Qf())e.flags|=8192;else throw Ya=gs,oo}function Os(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Ma():536870912,e.lanes|=t,kl|=t)}function vi(e,t){if(!Ae)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var l=null;n!==null;)n.alternate!==null&&(l=n),n=n.sibling;l===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function Qe(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,l=0;if(t)for(var s=e.child;s!==null;)n|=s.lanes|s.childLanes,l|=s.subtreeFlags&65011712,l|=s.flags&65011712,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)n|=s.lanes|s.childLanes,l|=s.subtreeFlags,l|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=l,e.childLanes=n,t}function Cm(e,t,n){var l=t.pendingProps;switch(Pr(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Qe(t),null;case 1:return Qe(t),null;case 3:return n=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),Rn(ct),ge(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(ul(t)?Hn(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,to())),Qe(t),null;case 26:var s=t.type,r=t.memoizedState;return e===null?(Hn(t),r!==null?(Qe(t),jf(t,r)):(Qe(t),Xo(t,s,null,l,n))):r?r!==e.memoizedState?(Hn(t),Qe(t),jf(t,r)):(Qe(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&Hn(t),Qe(t),Xo(t,s,e,l,n)),null;case 27:if(qe(t),n=ce.current,s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&Hn(t);else{if(!l){if(t.stateNode===null)throw Error(o(166));return Qe(t),null}e=L.current,ul(t)?Pu(t):(e=Mh(s,l,n),t.stateNode=e,Hn(t))}return Qe(t),null;case 5:if(qe(t),s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&Hn(t);else{if(!l){if(t.stateNode===null)throw Error(o(166));return Qe(t),null}if(r=L.current,ul(t))Pu(t);else{var h=Zs(ce.current);switch(r){case 1:r=h.createElementNS("http://www.w3.org/2000/svg",s);break;case 2:r=h.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;default:switch(s){case"svg":r=h.createElementNS("http://www.w3.org/2000/svg",s);break;case"math":r=h.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;case"script":r=h.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild);break;case"select":r=typeof l.is=="string"?h.createElement("select",{is:l.is}):h.createElement("select"),l.multiple?r.multiple=!0:l.size&&(r.size=l.size);break;default:r=typeof l.is=="string"?h.createElement(s,{is:l.is}):h.createElement(s)}}r[it]=t,r[bt]=l;e:for(h=t.child;h!==null;){if(h.tag===5||h.tag===6)r.appendChild(h.stateNode);else if(h.tag!==4&&h.tag!==27&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===t)break e;for(;h.sibling===null;){if(h.return===null||h.return===t)break e;h=h.return}h.sibling.return=h.return,h=h.sibling}t.stateNode=r;e:switch(wt(r,s,l),s){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&Hn(t)}}return Qe(t),Xo(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&Hn(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(o(166));if(e=ce.current,ul(t)){if(e=t.stateNode,n=t.memoizedProps,l=null,s=jt,s!==null)switch(s.tag){case 27:case 5:l=s.memoizedProps}e[it]=t,e=!!(e.nodeValue===n||l!==null&&l.suppressHydrationWarning===!0||gh(e.nodeValue,n)),e||ea(t,!0)}else e=Zs(e).createTextNode(l),e[it]=t,t.stateNode=e}return Qe(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(l=ul(t),n!==null){if(e===null){if(!l)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[it]=t}else Ha(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Qe(t),e=!1}else n=to(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Lt(t),t):(Lt(t),null);if((t.flags&128)!==0)throw Error(o(558))}return Qe(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(s=ul(t),l!==null&&l.dehydrated!==null){if(e===null){if(!s)throw Error(o(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(o(317));s[it]=t}else Ha(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Qe(t),s=!1}else s=to(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),s=!0;if(!s)return t.flags&256?(Lt(t),t):(Lt(t),null)}return Lt(t),(t.flags&128)!==0?(t.lanes=n,t):(n=l!==null,e=e!==null&&e.memoizedState!==null,n&&(l=t.child,s=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(s=l.alternate.memoizedState.cachePool.pool),r=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(r=l.memoizedState.cachePool.pool),r!==s&&(l.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Os(t,t.updateQueue),Qe(t),null);case 4:return ge(),e===null&&pc(t.stateNode.containerInfo),Qe(t),null;case 10:return Rn(t.type),Qe(t),null;case 19:if(V(st),l=t.memoizedState,l===null)return Qe(t),null;if(s=(t.flags&128)!==0,r=l.rendering,r===null)if(s)vi(l,!1);else{if(tt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(r=js(e),r!==null){for(t.flags|=128,vi(l,!1),e=r.updateQueue,t.updateQueue=e,Os(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Ku(n,e),n=n.sibling;return C(st,st.current&1|2),Ae&&An(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&vt()>$s&&(t.flags|=128,s=!0,vi(l,!1),t.lanes=4194304)}else{if(!s)if(e=js(r),e!==null){if(t.flags|=128,s=!0,e=e.updateQueue,t.updateQueue=e,Os(t,e),vi(l,!0),l.tail===null&&l.tailMode==="hidden"&&!r.alternate&&!Ae)return Qe(t),null}else 2*vt()-l.renderingStartTime>$s&&n!==536870912&&(t.flags|=128,s=!0,vi(l,!1),t.lanes=4194304);l.isBackwards?(r.sibling=t.child,t.child=r):(e=l.last,e!==null?e.sibling=r:t.child=r,l.last=r)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=vt(),e.sibling=null,n=st.current,C(st,s?n&1|2:n&1),Ae&&An(t,l.treeForkCount),e):(Qe(t),null);case 22:case 23:return Lt(t),vo(),l=t.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?(n&536870912)!==0&&(t.flags&128)===0&&(Qe(t),t.subtreeFlags&6&&(t.flags|=8192)):Qe(t),n=t.updateQueue,n!==null&&Os(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==n&&(t.flags|=2048),e!==null&&V(qa),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Rn(ct),Qe(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function Tm(e,t){switch(Pr(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Rn(ct),ge(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return qe(t),null;case 31:if(t.memoizedState!==null){if(Lt(t),t.alternate===null)throw Error(o(340));Ha()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Lt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));Ha()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return V(st),null;case 4:return ge(),null;case 10:return Rn(t.type),null;case 22:case 23:return Lt(t),vo(),e!==null&&V(qa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Rn(ct),null;case 25:return null;default:return null}}function Sf(e,t){switch(Pr(t),t.tag){case 3:Rn(ct),ge();break;case 26:case 27:case 5:qe(t);break;case 4:ge();break;case 31:t.memoizedState!==null&&Lt(t);break;case 13:Lt(t);break;case 19:V(st);break;case 10:Rn(t.type);break;case 22:case 23:Lt(t),vo(),e!==null&&V(qa);break;case 24:Rn(ct)}}function mi(e,t){try{var n=t.updateQueue,l=n!==null?n.lastEffect:null;if(l!==null){var s=l.next;n=s;do{if((n.tag&e)===e){l=void 0;var r=n.create,h=n.inst;l=r(),h.destroy=l}n=n.next}while(n!==s)}}catch(v){$e(t,t.return,v)}}function ra(e,t,n){try{var l=t.updateQueue,s=l!==null?l.lastEffect:null;if(s!==null){var r=s.next;l=r;do{if((l.tag&e)===e){var h=l.inst,v=h.destroy;if(v!==void 0){h.destroy=void 0,s=t;var M=n,U=v;try{U()}catch(X){$e(s,M,X)}}}l=l.next}while(l!==r)}}catch(X){$e(t,t.return,X)}}function kf(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{fd(t,n)}catch(l){$e(e,e.return,l)}}}function wf(e,t,n){n.props=Va(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(l){$e(e,t,l)}}function gi(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof n=="function"?e.refCleanup=n(l):n.current=l}}catch(s){$e(e,t,s)}}function jn(e,t){var n=e.ref,l=e.refCleanup;if(n!==null)if(typeof l=="function")try{l()}catch(s){$e(e,t,s)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(s){$e(e,t,s)}else n.current=null}function zf(e){var t=e.type,n=e.memoizedProps,l=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&l.focus();break e;case"img":n.src?l.src=n.src:n.srcSet&&(l.srcset=n.srcSet)}}catch(s){$e(e,e.return,s)}}function Qo(e,t,n){try{var l=e.stateNode;Zm(l,e.type,n,t),l[bt]=t}catch(s){$e(e,e.return,s)}}function Cf(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&pa(e.type)||e.tag===4}function Ko(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Cf(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&&pa(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 Zo(e,t,n){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Mn));else if(l!==4&&(l===27&&pa(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Zo(e,t,n),e=e.sibling;e!==null;)Zo(e,t,n),e=e.sibling}function Ns(e,t,n){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(l!==4&&(l===27&&pa(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Ns(e,t,n),e=e.sibling;e!==null;)Ns(e,t,n),e=e.sibling}function Tf(e){var t=e.stateNode,n=e.memoizedProps;try{for(var l=e.type,s=t.attributes;s.length;)t.removeAttributeNode(s[0]);wt(t,l,n),t[it]=e,t[bt]=n}catch(r){$e(e,e.return,r)}}var Bn=!1,ft=!1,Fo=!1,Mf=typeof WeakSet=="function"?WeakSet:Set,gt=null;function Mm(e,t){if(e=e.containerInfo,gc=nr,e=$u(e),Yr(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var l=n.getSelection&&n.getSelection();if(l&&l.rangeCount!==0){n=l.anchorNode;var s=l.anchorOffset,r=l.focusNode;l=l.focusOffset;try{n.nodeType,r.nodeType}catch{n=null;break e}var h=0,v=-1,M=-1,U=0,X=0,F=e,$=null;t:for(;;){for(var Y;F!==n||s!==0&&F.nodeType!==3||(v=h+s),F!==r||l!==0&&F.nodeType!==3||(M=h+l),F.nodeType===3&&(h+=F.nodeValue.length),(Y=F.firstChild)!==null;)$=F,F=Y;for(;;){if(F===e)break t;if($===n&&++U===s&&(v=h),$===r&&++X===l&&(M=h),(Y=F.nextSibling)!==null)break;F=$,$=F.parentNode}F=Y}n=v===-1||M===-1?null:{start:v,end:M}}else n=null}n=n||{start:0,end:0}}else n=null;for(yc={focusedElem:e,selectionRange:n},nr=!1,gt=t;gt!==null;)if(t=gt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,gt=e;else for(;gt!==null;){switch(t=gt,r=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n<e.length;n++)s=e[n],s.ref.impl=s.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&r!==null){e=void 0,n=t,s=r.memoizedProps,r=r.memoizedState,l=n.stateNode;try{var he=Va(n.type,s);e=l.getSnapshotBeforeUpdate(he,r),l.__reactInternalSnapshotBeforeUpdate=e}catch(ye){$e(n,n.return,ye)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)jc(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":jc(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(o(163))}if(e=t.sibling,e!==null){e.return=t.return,gt=e;break}gt=t.return}}function Ef(e,t,n){var l=n.flags;switch(n.tag){case 0:case 11:case 15:qn(e,n),l&4&&mi(5,n);break;case 1:if(qn(e,n),l&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(h){$e(n,n.return,h)}else{var s=Va(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(s,t,e.__reactInternalSnapshotBeforeUpdate)}catch(h){$e(n,n.return,h)}}l&64&&kf(n),l&512&&gi(n,n.return);break;case 3:if(qn(e,n),l&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{fd(e,t)}catch(h){$e(n,n.return,h)}}break;case 27:t===null&&l&4&&Tf(n);case 26:case 5:qn(e,n),t===null&&l&4&&zf(n),l&512&&gi(n,n.return);break;case 12:qn(e,n);break;case 31:qn(e,n),l&4&&Df(e,n);break;case 13:qn(e,n),l&4&&Rf(e,n),l&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Hm.bind(null,n),ag(e,n))));break;case 22:if(l=n.memoizedState!==null||Bn,!l){t=t!==null&&t.memoizedState!==null||ft,s=Bn;var r=ft;Bn=l,(ft=t)&&!r?Ln(e,n,(n.subtreeFlags&8772)!==0):qn(e,n),Bn=s,ft=r}break;case 30:break;default:qn(e,n)}}function _f(e){var t=e.alternate;t!==null&&(e.alternate=null,_f(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&_a(t)),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 Ke=null,At=!1;function $n(e,t,n){for(n=n.child;n!==null;)Af(e,t,n),n=n.sibling}function Af(e,t,n){if(Ct&&typeof Ct.onCommitFiberUnmount=="function")try{Ct.onCommitFiberUnmount(za,n)}catch{}switch(n.tag){case 26:ft||jn(n,t),$n(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:ft||jn(n,t);var l=Ke,s=At;pa(n.type)&&(Ke=n.stateNode,At=!1),$n(e,t,n),Ci(n.stateNode),Ke=l,At=s;break;case 5:ft||jn(n,t);case 6:if(l=Ke,s=At,Ke=null,$n(e,t,n),Ke=l,At=s,Ke!==null)if(At)try{(Ke.nodeType===9?Ke.body:Ke.nodeName==="HTML"?Ke.ownerDocument.body:Ke).removeChild(n.stateNode)}catch(r){$e(n,t,r)}else try{Ke.removeChild(n.stateNode)}catch(r){$e(n,t,r)}break;case 18:Ke!==null&&(At?(e=Ke,kh(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Al(e)):kh(Ke,n.stateNode));break;case 4:l=Ke,s=At,Ke=n.stateNode.containerInfo,At=!0,$n(e,t,n),Ke=l,At=s;break;case 0:case 11:case 14:case 15:ra(2,n,t),ft||ra(4,n,t),$n(e,t,n);break;case 1:ft||(jn(n,t),l=n.stateNode,typeof l.componentWillUnmount=="function"&&wf(n,t,l)),$n(e,t,n);break;case 21:$n(e,t,n);break;case 22:ft=(l=ft)||n.memoizedState!==null,$n(e,t,n),ft=l;break;default:$n(e,t,n)}}function Df(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Al(e)}catch(n){$e(t,t.return,n)}}}function Rf(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Al(e)}catch(n){$e(t,t.return,n)}}function Em(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Mf),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Mf),t;default:throw Error(o(435,e.tag))}}function Us(e,t){var n=Em(e);t.forEach(function(l){if(!n.has(l)){n.add(l);var s=Bm.bind(null,e,l);l.then(s,s)}})}function Dt(e,t){var n=t.deletions;if(n!==null)for(var l=0;l<n.length;l++){var s=n[l],r=e,h=t,v=h;e:for(;v!==null;){switch(v.tag){case 27:if(pa(v.type)){Ke=v.stateNode,At=!1;break e}break;case 5:Ke=v.stateNode,At=!1;break e;case 3:case 4:Ke=v.stateNode.containerInfo,At=!0;break e}v=v.return}if(Ke===null)throw Error(o(160));Af(r,h,s),Ke=null,At=!1,r=s.alternate,r!==null&&(r.return=null),s.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Of(t,e),t=t.sibling}var hn=null;function Of(e,t){var n=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Dt(t,e),Rt(e),l&4&&(ra(3,e,e.return),mi(3,e),ra(5,e,e.return));break;case 1:Dt(t,e),Rt(e),l&512&&(ft||n===null||jn(n,n.return)),l&64&&Bn&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?l:n.concat(l))));break;case 26:var s=hn;if(Dt(t,e),Rt(e),l&512&&(ft||n===null||jn(n,n.return)),l&4){var r=n!==null?n.memoizedState:null;if(l=e.memoizedState,n===null)if(l===null)if(e.stateNode===null){e:{l=e.type,n=e.memoizedProps,s=s.ownerDocument||s;t:switch(l){case"title":r=s.getElementsByTagName("title")[0],(!r||r[gn]||r[it]||r.namespaceURI==="http://www.w3.org/2000/svg"||r.hasAttribute("itemprop"))&&(r=s.createElement(l),s.head.insertBefore(r,s.querySelector("head > title"))),wt(r,l,n),r[it]=e,Pe(r),l=r;break e;case"link":var h=Oh("link","href",s).get(l+(n.href||""));if(h){for(var v=0;v<h.length;v++)if(r=h[v],r.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&r.getAttribute("rel")===(n.rel==null?null:n.rel)&&r.getAttribute("title")===(n.title==null?null:n.title)&&r.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){h.splice(v,1);break t}}r=s.createElement(l),wt(r,l,n),s.head.appendChild(r);break;case"meta":if(h=Oh("meta","content",s).get(l+(n.content||""))){for(v=0;v<h.length;v++)if(r=h[v],r.getAttribute("content")===(n.content==null?null:""+n.content)&&r.getAttribute("name")===(n.name==null?null:n.name)&&r.getAttribute("property")===(n.property==null?null:n.property)&&r.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&r.getAttribute("charset")===(n.charSet==null?null:n.charSet)){h.splice(v,1);break t}}r=s.createElement(l),wt(r,l,n),s.head.appendChild(r);break;default:throw Error(o(468,l))}r[it]=e,Pe(r),l=r}e.stateNode=l}else Nh(s,e.type,e.stateNode);else e.stateNode=Rh(s,l,e.memoizedProps);else r!==l?(r===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):r.count--,l===null?Nh(s,e.type,e.stateNode):Rh(s,l,e.memoizedProps)):l===null&&e.stateNode!==null&&Qo(e,e.memoizedProps,n.memoizedProps)}break;case 27:Dt(t,e),Rt(e),l&512&&(ft||n===null||jn(n,n.return)),n!==null&&l&4&&Qo(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Dt(t,e),Rt(e),l&512&&(ft||n===null||jn(n,n.return)),e.flags&32){s=e.stateNode;try{el(s,"")}catch(he){$e(e,e.return,he)}}l&4&&e.stateNode!=null&&(s=e.memoizedProps,Qo(e,s,n!==null?n.memoizedProps:s)),l&1024&&(Fo=!0);break;case 6:if(Dt(t,e),Rt(e),l&4){if(e.stateNode===null)throw Error(o(162));l=e.memoizedProps,n=e.stateNode;try{n.nodeValue=l}catch(he){$e(e,e.return,he)}}break;case 3:if(Is=null,s=hn,hn=Fs(t.containerInfo),Dt(t,e),hn=s,Rt(e),l&4&&n!==null&&n.memoizedState.isDehydrated)try{Al(t.containerInfo)}catch(he){$e(e,e.return,he)}Fo&&(Fo=!1,Nf(e));break;case 4:l=hn,hn=Fs(e.stateNode.containerInfo),Dt(t,e),Rt(e),hn=l;break;case 12:Dt(t,e),Rt(e);break;case 31:Dt(t,e),Rt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Us(e,l)));break;case 13:Dt(t,e),Rt(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Bs=vt()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Us(e,l)));break;case 22:s=e.memoizedState!==null;var M=n!==null&&n.memoizedState!==null,U=Bn,X=ft;if(Bn=U||s,ft=X||M,Dt(t,e),ft=X,Bn=U,Rt(e),l&8192)e:for(t=e.stateNode,t._visibility=s?t._visibility&-2:t._visibility|1,s&&(n===null||M||Bn||ft||Xa(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){M=n=t;try{if(r=M.stateNode,s)h=r.style,typeof h.setProperty=="function"?h.setProperty("display","none","important"):h.display="none";else{v=M.stateNode;var F=M.memoizedProps.style,$=F!=null&&F.hasOwnProperty("display")?F.display:null;v.style.display=$==null||typeof $=="boolean"?"":(""+$).trim()}}catch(he){$e(M,M.return,he)}}}else if(t.tag===6){if(n===null){M=t;try{M.stateNode.nodeValue=s?"":M.memoizedProps}catch(he){$e(M,M.return,he)}}}else if(t.tag===18){if(n===null){M=t;try{var Y=M.stateNode;s?wh(Y,!0):wh(M.stateNode,!1)}catch(he){$e(M,M.return,he)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}l&4&&(l=e.updateQueue,l!==null&&(n=l.retryQueue,n!==null&&(l.retryQueue=null,Us(e,n))));break;case 19:Dt(t,e),Rt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Us(e,l)));break;case 30:break;case 21:break;default:Dt(t,e),Rt(e)}}function Rt(e){var t=e.flags;if(t&2){try{for(var n,l=e.return;l!==null;){if(Cf(l)){n=l;break}l=l.return}if(n==null)throw Error(o(160));switch(n.tag){case 27:var s=n.stateNode,r=Ko(e);Ns(e,r,s);break;case 5:var h=n.stateNode;n.flags&32&&(el(h,""),n.flags&=-33);var v=Ko(e);Ns(e,v,h);break;case 3:case 4:var M=n.stateNode.containerInfo,U=Ko(e);Zo(e,U,M);break;default:throw Error(o(161))}}catch(X){$e(e,e.return,X)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Nf(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Nf(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function qn(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Ef(e,t.alternate,t),t=t.sibling}function Xa(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:ra(4,t,t.return),Xa(t);break;case 1:jn(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&wf(t,t.return,n),Xa(t);break;case 27:Ci(t.stateNode);case 26:case 5:jn(t,t.return),Xa(t);break;case 22:t.memoizedState===null&&Xa(t);break;case 30:Xa(t);break;default:Xa(t)}e=e.sibling}}function Ln(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var l=t.alternate,s=e,r=t,h=r.flags;switch(r.tag){case 0:case 11:case 15:Ln(s,r,n),mi(4,r);break;case 1:if(Ln(s,r,n),l=r,s=l.stateNode,typeof s.componentDidMount=="function")try{s.componentDidMount()}catch(U){$e(l,l.return,U)}if(l=r,s=l.updateQueue,s!==null){var v=l.stateNode;try{var M=s.shared.hiddenCallbacks;if(M!==null)for(s.shared.hiddenCallbacks=null,s=0;s<M.length;s++)dd(M[s],v)}catch(U){$e(l,l.return,U)}}n&&h&64&&kf(r),gi(r,r.return);break;case 27:Tf(r);case 26:case 5:Ln(s,r,n),n&&l===null&&h&4&&zf(r),gi(r,r.return);break;case 12:Ln(s,r,n);break;case 31:Ln(s,r,n),n&&h&4&&Df(s,r);break;case 13:Ln(s,r,n),n&&h&4&&Rf(s,r);break;case 22:r.memoizedState===null&&Ln(s,r,n),gi(r,r.return);break;case 30:break;default:Ln(s,r,n)}t=t.sibling}}function Jo(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&ai(n))}function Io(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ai(e))}function pn(e,t,n,l){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Uf(e,t,n,l),t=t.sibling}function Uf(e,t,n,l){var s=t.flags;switch(t.tag){case 0:case 11:case 15:pn(e,t,n,l),s&2048&&mi(9,t);break;case 1:pn(e,t,n,l);break;case 3:pn(e,t,n,l),s&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ai(e)));break;case 12:if(s&2048){pn(e,t,n,l),e=t.stateNode;try{var r=t.memoizedProps,h=r.id,v=r.onPostCommit;typeof v=="function"&&v(h,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(M){$e(t,t.return,M)}}else pn(e,t,n,l);break;case 31:pn(e,t,n,l);break;case 13:pn(e,t,n,l);break;case 23:break;case 22:r=t.stateNode,h=t.alternate,t.memoizedState!==null?r._visibility&2?pn(e,t,n,l):yi(e,t):r._visibility&2?pn(e,t,n,l):(r._visibility|=2,bl(e,t,n,l,(t.subtreeFlags&10256)!==0||!1)),s&2048&&Jo(h,t);break;case 24:pn(e,t,n,l),s&2048&&Io(t.alternate,t);break;default:pn(e,t,n,l)}}function bl(e,t,n,l,s){for(s=s&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var r=e,h=t,v=n,M=l,U=h.flags;switch(h.tag){case 0:case 11:case 15:bl(r,h,v,M,s),mi(8,h);break;case 23:break;case 22:var X=h.stateNode;h.memoizedState!==null?X._visibility&2?bl(r,h,v,M,s):yi(r,h):(X._visibility|=2,bl(r,h,v,M,s)),s&&U&2048&&Jo(h.alternate,h);break;case 24:bl(r,h,v,M,s),s&&U&2048&&Io(h.alternate,h);break;default:bl(r,h,v,M,s)}t=t.sibling}}function yi(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,l=t,s=l.flags;switch(l.tag){case 22:yi(n,l),s&2048&&Jo(l.alternate,l);break;case 24:yi(n,l),s&2048&&Io(l.alternate,l);break;default:yi(n,l)}t=t.sibling}}var xi=8192;function jl(e,t,n){if(e.subtreeFlags&xi)for(e=e.child;e!==null;)Hf(e,t,n),e=e.sibling}function Hf(e,t,n){switch(e.tag){case 26:jl(e,t,n),e.flags&xi&&e.memoizedState!==null&&vg(n,hn,e.memoizedState,e.memoizedProps);break;case 5:jl(e,t,n);break;case 3:case 4:var l=hn;hn=Fs(e.stateNode.containerInfo),jl(e,t,n),hn=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=xi,xi=16777216,jl(e,t,n),xi=l):jl(e,t,n));break;default:jl(e,t,n)}}function Bf(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function bi(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var l=t[n];gt=l,qf(l,e)}Bf(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)$f(e),e=e.sibling}function $f(e){switch(e.tag){case 0:case 11:case 15:bi(e),e.flags&2048&&ra(9,e,e.return);break;case 3:bi(e);break;case 12:bi(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Hs(e)):bi(e);break;default:bi(e)}}function Hs(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var l=t[n];gt=l,qf(l,e)}Bf(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:ra(8,t,t.return),Hs(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Hs(t));break;default:Hs(t)}e=e.sibling}}function qf(e,t){for(;gt!==null;){var n=gt;switch(n.tag){case 0:case 11:case 15:ra(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var l=n.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:ai(n.memoizedState.cache)}if(l=n.child,l!==null)l.return=n,gt=l;else e:for(n=e;gt!==null;){l=gt;var s=l.sibling,r=l.return;if(_f(l),l===n){gt=null;break e}if(s!==null){s.return=r,gt=s;break e}gt=r}}}var _m={getCacheForType:function(e){var t=St(ct),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return St(ct).controller.signal}},Am=typeof WeakMap=="function"?WeakMap:Map,Ne=0,We=null,Ce=null,Ee=0,Be=0,Yt=null,oa=!1,Sl=!1,Po=!1,Yn=0,tt=0,ca=0,Qa=0,ec=0,Gt=0,kl=0,ji=null,Ot=null,tc=!1,Bs=0,Lf=0,$s=1/0,qs=null,ua=null,pt=0,da=null,wl=null,Gn=0,nc=0,ac=null,Yf=null,Si=0,lc=null;function Wt(){return(Ne&2)!==0&&Ee!==0?Ee&-Ee:_.T!==null?uc():mn()}function Gf(){if(Gt===0)if((Ee&536870912)===0||Ae){var e=Fa;Fa<<=1,(Fa&3932160)===0&&(Fa=262144),Gt=e}else Gt=536870912;return e=qt.current,e!==null&&(e.flags|=32),Gt}function Nt(e,t,n){(e===We&&(Be===2||Be===9)||e.cancelPendingCommit!==null)&&(zl(e,0),fa(e,Ee,Gt,!1)),Qn(e,n),((Ne&2)===0||e!==We)&&(e===We&&((Ne&2)===0&&(Qa|=n),tt===4&&fa(e,Ee,Gt,!1)),Sn(e))}function Wf(e,t,n){if((Ne&6)!==0)throw Error(o(327));var l=!n&&(t&127)===0&&(t&e.expiredLanes)===0||Vn(e,t),s=l?Om(e,t):sc(e,t,!0),r=l;do{if(s===0){Sl&&!l&&fa(e,t,0,!1);break}else{if(n=e.current.alternate,r&&!Dm(n)){s=sc(e,t,!1),r=!1;continue}if(s===2){if(r=t,e.errorRecoveryDisabledLanes&r)var h=0;else h=e.pendingLanes&-536870913,h=h!==0?h:h&536870912?536870912:0;if(h!==0){t=h;e:{var v=e;s=ji;var M=v.current.memoizedState.isDehydrated;if(M&&(zl(v,h).flags|=256),h=sc(v,h,!1),h!==2){if(Po&&!M){v.errorRecoveryDisabledLanes|=r,Qa|=r,s=4;break e}r=Ot,Ot=s,r!==null&&(Ot===null?Ot=r:Ot.push.apply(Ot,r))}s=h}if(r=!1,s!==2)continue}}if(s===1){zl(e,0),fa(e,t,0,!0);break}e:{switch(l=e,r=s,r){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t)break;case 6:fa(l,t,Gt,!oa);break e;case 2:Ot=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(s=Bs+300-vt(),10<s)){if(fa(l,t,Gt,!oa),Ta(l,0,!0)!==0)break e;Gn=t,l.timeoutHandle=jh(Vf.bind(null,l,n,Ot,qs,tc,t,Gt,Qa,kl,oa,r,"Throttled",-0,0),s);break e}Vf(l,n,Ot,qs,tc,t,Gt,Qa,kl,oa,r,null,-0,0)}}break}while(!0);Sn(e)}function Vf(e,t,n,l,s,r,h,v,M,U,X,F,$,Y){if(e.timeoutHandle=-1,F=t.subtreeFlags,F&8192||(F&16785408)===16785408){F={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Mn},Hf(t,r,F);var he=(r&62914560)===r?Bs-vt():(r&4194048)===r?Lf-vt():0;if(he=mg(F,he),he!==null){Gn=r,e.cancelPendingCommit=he(Pf.bind(null,e,t,r,n,l,s,h,v,M,X,F,null,$,Y)),fa(e,r,h,!U);return}}Pf(e,t,r,n,l,s,h,v,M)}function Dm(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var l=0;l<n.length;l++){var s=n[l],r=s.getSnapshot;s=s.value;try{if(!Bt(r(),s))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function fa(e,t,n,l){t&=~ec,t&=~Qa,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var s=t;0<s;){var r=31-xt(s),h=1<<r;l[r]=-1,s&=~h}n!==0&&Ja(e,n,t)}function Ls(){return(Ne&6)===0?(ki(0),!1):!0}function ic(){if(Ce!==null){if(Be===0)var e=Ce.return;else e=Ce,Dn=Ba=null,jo(e),vl=null,ii=0,e=Ce;for(;e!==null;)Sf(e.alternate,e),e=e.return;Ce=null}}function zl(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Im(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Gn=0,ic(),We=e,Ce=n=_n(e.current,null),Ee=t,Be=0,Yt=null,oa=!1,Sl=Vn(e,t),Po=!1,kl=Gt=ec=Qa=ca=tt=0,Ot=ji=null,tc=!1,(t&8)!==0&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var s=31-xt(l),r=1<<s;t|=e[s],l&=~r}return Yn=t,os(),n}function Xf(e,t){we=null,_.H=hi,t===pl||t===ms?(t=rd(),Be=3):t===oo?(t=rd(),Be=4):Be=t===Ho?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Yt=t,Ce===null&&(tt=1,_s(e,It(t,e.current)))}function Qf(){var e=qt.current;return e===null?!0:(Ee&4194048)===Ee?nn===null:(Ee&62914560)===Ee||(Ee&536870912)!==0?e===nn:!1}function Kf(){var e=_.H;return _.H=hi,e===null?hi:e}function Zf(){var e=_.A;return _.A=_m,e}function Ys(){tt=4,oa||(Ee&4194048)!==Ee&&qt.current!==null||(Sl=!0),(ca&134217727)===0&&(Qa&134217727)===0||We===null||fa(We,Ee,Gt,!1)}function sc(e,t,n){var l=Ne;Ne|=2;var s=Kf(),r=Zf();(We!==e||Ee!==t)&&(qs=null,zl(e,t)),t=!1;var h=tt;e:do try{if(Be!==0&&Ce!==null){var v=Ce,M=Yt;switch(Be){case 8:ic(),h=6;break e;case 3:case 2:case 9:case 6:qt.current===null&&(t=!0);var U=Be;if(Be=0,Yt=null,Cl(e,v,M,U),n&&Sl){h=0;break e}break;default:U=Be,Be=0,Yt=null,Cl(e,v,M,U)}}Rm(),h=tt;break}catch(X){Xf(e,X)}while(!0);return t&&e.shellSuspendCounter++,Dn=Ba=null,Ne=l,_.H=s,_.A=r,Ce===null&&(We=null,Ee=0,os()),h}function Rm(){for(;Ce!==null;)Ff(Ce)}function Om(e,t){var n=Ne;Ne|=2;var l=Kf(),s=Zf();We!==e||Ee!==t?(qs=null,$s=vt()+500,zl(e,t)):Sl=Vn(e,t);e:do try{if(Be!==0&&Ce!==null){t=Ce;var r=Yt;t:switch(Be){case 1:Be=0,Yt=null,Cl(e,t,r,1);break;case 2:case 9:if(id(r)){Be=0,Yt=null,Jf(t);break}t=function(){Be!==2&&Be!==9||We!==e||(Be=7),Sn(e)},r.then(t,t);break e;case 3:Be=7;break e;case 4:Be=5;break e;case 7:id(r)?(Be=0,Yt=null,Jf(t)):(Be=0,Yt=null,Cl(e,t,r,7));break;case 5:var h=null;switch(Ce.tag){case 26:h=Ce.memoizedState;case 5:case 27:var v=Ce;if(h?Uh(h):v.stateNode.complete){Be=0,Yt=null;var M=v.sibling;if(M!==null)Ce=M;else{var U=v.return;U!==null?(Ce=U,Gs(U)):Ce=null}break t}}Be=0,Yt=null,Cl(e,t,r,5);break;case 6:Be=0,Yt=null,Cl(e,t,r,6);break;case 8:ic(),tt=6;break e;default:throw Error(o(462))}}Nm();break}catch(X){Xf(e,X)}while(!0);return Dn=Ba=null,_.H=l,_.A=s,Ne=n,Ce!==null?0:(We=null,Ee=0,os(),tt)}function Nm(){for(;Ce!==null&&!Bl();)Ff(Ce)}function Ff(e){var t=bf(e.alternate,e,Yn);e.memoizedProps=e.pendingProps,t===null?Gs(e):Ce=t}function Jf(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=pf(n,t,t.pendingProps,t.type,void 0,Ee);break;case 11:t=pf(n,t,t.pendingProps,t.type.render,t.ref,Ee);break;case 5:jo(t);default:Sf(n,t),t=Ce=Ku(t,Yn),t=bf(n,t,Yn)}e.memoizedProps=e.pendingProps,t===null?Gs(e):Ce=t}function Cl(e,t,n,l){Dn=Ba=null,jo(t),vl=null,ii=0;var s=t.return;try{if(km(e,s,t,n,Ee)){tt=1,_s(e,It(n,e.current)),Ce=null;return}}catch(r){if(s!==null)throw Ce=s,r;tt=1,_s(e,It(n,e.current)),Ce=null;return}t.flags&32768?(Ae||l===1?e=!0:Sl||(Ee&536870912)!==0?e=!1:(oa=e=!0,(l===2||l===9||l===3||l===6)&&(l=qt.current,l!==null&&l.tag===13&&(l.flags|=16384))),If(t,e)):Gs(t)}function Gs(e){var t=e;do{if((t.flags&32768)!==0){If(t,oa);return}e=t.return;var n=Cm(t.alternate,t,Yn);if(n!==null){Ce=n;return}if(t=t.sibling,t!==null){Ce=t;return}Ce=t=e}while(t!==null);tt===0&&(tt=5)}function If(e,t){do{var n=Tm(e.alternate,e);if(n!==null){n.flags&=32767,Ce=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Ce=e;return}Ce=e=n}while(e!==null);tt=6,Ce=null}function Pf(e,t,n,l,s,r,h,v,M){e.cancelPendingCommit=null;do Ws();while(pt!==0);if((Ne&6)!==0)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));if(r=t.lanes|t.childLanes,r|=Qr,Xi(e,n,r,h,v,M),e===We&&(Ce=We=null,Ee=0),wl=t,da=e,Gn=n,nc=r,ac=s,Yf=l,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,$m(ka,function(){return lh(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||l){l=_.T,_.T=null,s=O.p,O.p=2,h=Ne,Ne|=4;try{Mm(e,t,n)}finally{Ne=h,O.p=s,_.T=l}}pt=1,eh(),th(),nh()}}function eh(){if(pt===1){pt=0;var e=da,t=wl,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=_.T,_.T=null;var l=O.p;O.p=2;var s=Ne;Ne|=4;try{Of(t,e);var r=yc,h=$u(e.containerInfo),v=r.focusedElem,M=r.selectionRange;if(h!==v&&v&&v.ownerDocument&&Bu(v.ownerDocument.documentElement,v)){if(M!==null&&Yr(v)){var U=M.start,X=M.end;if(X===void 0&&(X=U),"selectionStart"in v)v.selectionStart=U,v.selectionEnd=Math.min(X,v.value.length);else{var F=v.ownerDocument||document,$=F&&F.defaultView||window;if($.getSelection){var Y=$.getSelection(),he=v.textContent.length,ye=Math.min(M.start,he),Ge=M.end===void 0?ye:Math.min(M.end,he);!Y.extend&&ye>Ge&&(h=Ge,Ge=ye,ye=h);var A=Hu(v,ye),E=Hu(v,Ge);if(A&&E&&(Y.rangeCount!==1||Y.anchorNode!==A.node||Y.anchorOffset!==A.offset||Y.focusNode!==E.node||Y.focusOffset!==E.offset)){var N=F.createRange();N.setStart(A.node,A.offset),Y.removeAllRanges(),ye>Ge?(Y.addRange(N),Y.extend(E.node,E.offset)):(N.setEnd(E.node,E.offset),Y.addRange(N))}}}}for(F=[],Y=v;Y=Y.parentNode;)Y.nodeType===1&&F.push({element:Y,left:Y.scrollLeft,top:Y.scrollTop});for(typeof v.focus=="function"&&v.focus(),v=0;v<F.length;v++){var Q=F[v];Q.element.scrollLeft=Q.left,Q.element.scrollTop=Q.top}}nr=!!gc,yc=gc=null}finally{Ne=s,O.p=l,_.T=n}}e.current=t,pt=2}}function th(){if(pt===2){pt=0;var e=da,t=wl,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=_.T,_.T=null;var l=O.p;O.p=2;var s=Ne;Ne|=4;try{Ef(e,t.alternate,t)}finally{Ne=s,O.p=l,_.T=n}}pt=3}}function nh(){if(pt===4||pt===3){pt=0,zn();var e=da,t=wl,n=Gn,l=Yf;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?pt=5:(pt=0,wl=da=null,ah(e,e.pendingLanes));var s=e.pendingLanes;if(s===0&&(ua=null),cn(n),t=t.stateNode,Ct&&typeof Ct.onCommitFiberRoot=="function")try{Ct.onCommitFiberRoot(za,t,void 0,(t.current.flags&128)===128)}catch{}if(l!==null){t=_.T,s=O.p,O.p=2,_.T=null;try{for(var r=e.onRecoverableError,h=0;h<l.length;h++){var v=l[h];r(v.value,{componentStack:v.stack})}}finally{_.T=t,O.p=s}}(Gn&3)!==0&&Ws(),Sn(e),s=e.pendingLanes,(n&261930)!==0&&(s&42)!==0?e===lc?Si++:(Si=0,lc=e):Si=0,ki(0)}}function ah(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ai(t)))}function Ws(){return eh(),th(),nh(),lh()}function lh(){if(pt!==5)return!1;var e=da,t=nc;nc=0;var n=cn(Gn),l=_.T,s=O.p;try{O.p=32>n?32:n,_.T=null,n=ac,ac=null;var r=da,h=Gn;if(pt=0,wl=da=null,Gn=0,(Ne&6)!==0)throw Error(o(331));var v=Ne;if(Ne|=4,$f(r.current),Uf(r,r.current,h,n),Ne=v,ki(0,!1),Ct&&typeof Ct.onPostCommitFiberRoot=="function")try{Ct.onPostCommitFiberRoot(za,r)}catch{}return!0}finally{O.p=s,_.T=l,ah(e,t)}}function ih(e,t,n){t=It(n,t),t=Uo(e.stateNode,t,2),e=la(e,t,2),e!==null&&(Qn(e,2),Sn(e))}function $e(e,t,n){if(e.tag===3)ih(e,e,n);else for(;t!==null;){if(t.tag===3){ih(t,e,n);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(ua===null||!ua.has(l))){e=It(n,e),n=sf(2),l=la(t,n,2),l!==null&&(rf(n,l,t,e),Qn(l,2),Sn(l));break}}t=t.return}}function rc(e,t,n){var l=e.pingCache;if(l===null){l=e.pingCache=new Am;var s=new Set;l.set(t,s)}else s=l.get(t),s===void 0&&(s=new Set,l.set(t,s));s.has(n)||(Po=!0,s.add(n),e=Um.bind(null,e,t,n),t.then(e,e))}function Um(e,t,n){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,We===e&&(Ee&n)===n&&(tt===4||tt===3&&(Ee&62914560)===Ee&&300>vt()-Bs?(Ne&2)===0&&zl(e,0):ec|=n,kl===Ee&&(kl=0)),Sn(e)}function sh(e,t){t===0&&(t=Ma()),e=Na(e,t),e!==null&&(Qn(e,t),Sn(e))}function Hm(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),sh(e,n)}function Bm(e,t){var n=0;switch(e.tag){case 31:case 13:var l=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(o(314))}l!==null&&l.delete(t),sh(e,n)}function $m(e,t){return Xt(e,t)}var Vs=null,Tl=null,oc=!1,Xs=!1,cc=!1,ha=0;function Sn(e){e!==Tl&&e.next===null&&(Tl===null?Vs=Tl=e:Tl=Tl.next=e),Xs=!0,oc||(oc=!0,Lm())}function ki(e,t){if(!cc&&Xs){cc=!0;do for(var n=!1,l=Vs;l!==null;){if(e!==0){var s=l.pendingLanes;if(s===0)var r=0;else{var h=l.suspendedLanes,v=l.pingedLanes;r=(1<<31-xt(42|e)+1)-1,r&=s&~(h&~v),r=r&201326741?r&201326741|1:r?r|2:0}r!==0&&(n=!0,uh(l,r))}else r=Ee,r=Ta(l,l===We?r:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(r&3)===0||Vn(l,r)||(n=!0,uh(l,r));l=l.next}while(n);cc=!1}}function qm(){rh()}function rh(){Xs=oc=!1;var e=0;ha!==0&&Jm()&&(e=ha);for(var t=vt(),n=null,l=Vs;l!==null;){var s=l.next,r=oh(l,t);r===0?(l.next=null,n===null?Vs=s:n.next=s,s===null&&(Tl=n)):(n=l,(e!==0||(r&3)!==0)&&(Xs=!0)),l=s}pt!==0&&pt!==5||ki(e),ha!==0&&(ha=0)}function oh(e,t){for(var n=e.suspendedLanes,l=e.pingedLanes,s=e.expirationTimes,r=e.pendingLanes&-62914561;0<r;){var h=31-xt(r),v=1<<h,M=s[h];M===-1?((v&n)===0||(v&l)!==0)&&(s[h]=Vi(v,t)):M<=t&&(e.expiredLanes|=v),r&=~v}if(t=We,n=Ee,n=Ta(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,n===0||e===t&&(Be===2||Be===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&Et(l),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||Vn(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(l!==null&&Et(l),cn(n)){case 2:case 8:n=qi;break;case 32:n=ka;break;case 268435456:n=wa;break;default:n=ka}return l=ch.bind(null,e),n=Xt(n,l),e.callbackPriority=t,e.callbackNode=n,t}return l!==null&&l!==null&&Et(l),e.callbackPriority=2,e.callbackNode=null,2}function ch(e,t){if(pt!==0&&pt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Ws()&&e.callbackNode!==n)return null;var l=Ee;return l=Ta(e,e===We?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(Wf(e,l,t),oh(e,vt()),e.callbackNode!=null&&e.callbackNode===n?ch.bind(null,e):null)}function uh(e,t){if(Ws())return null;Wf(e,t,!0)}function Lm(){Pm(function(){(Ne&6)!==0?Xt($l,qm):rh()})}function uc(){if(ha===0){var e=fl;e===0&&(e=Ca,Ca<<=1,(Ca&261888)===0&&(Ca=256)),ha=e}return ha}function dh(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:es(""+e)}function fh(e,t){var n=t.ownerDocument.createElement("input");return n.name=t.name,n.value=t.value,e.id&&n.setAttribute("form",e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function Ym(e,t,n,l,s){if(t==="submit"&&n&&n.stateNode===s){var r=dh((s[bt]||null).action),h=l.submitter;h&&(t=(t=h[bt]||null)?dh(t.formAction):h.getAttribute("formAction"),t!==null&&(r=t,h=null));var v=new ls("action","action",null,l,s);e.push({event:v,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(ha!==0){var M=h?fh(s,h):new FormData(s);_o(n,{pending:!0,data:M,method:s.method,action:r},null,M)}}else typeof r=="function"&&(v.preventDefault(),M=h?fh(s,h):new FormData(s),_o(n,{pending:!0,data:M,method:s.method,action:r},r,M))},currentTarget:s}]})}}for(var dc=0;dc<Xr.length;dc++){var fc=Xr[dc],Gm=fc.toLowerCase(),Wm=fc[0].toUpperCase()+fc.slice(1);fn(Gm,"on"+Wm)}fn(Yu,"onAnimationEnd"),fn(Gu,"onAnimationIteration"),fn(Wu,"onAnimationStart"),fn("dblclick","onDoubleClick"),fn("focusin","onFocus"),fn("focusout","onBlur"),fn(sm,"onTransitionRun"),fn(rm,"onTransitionStart"),fn(om,"onTransitionCancel"),fn(Vu,"onTransitionEnd"),Tn("onMouseEnter",["mouseout","mouseover"]),Tn("onMouseLeave",["mouseout","mouseover"]),Tn("onPointerEnter",["pointerout","pointerover"]),Tn("onPointerLeave",["pointerout","pointerover"]),yn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),yn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),yn("onBeforeInput",["compositionend","keypress","textInput","paste"]),yn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),yn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),yn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var wi="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(" "),Vm=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(wi));function hh(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var l=e[n],s=l.event;l=l.listeners;e:{var r=void 0;if(t)for(var h=l.length-1;0<=h;h--){var v=l[h],M=v.instance,U=v.currentTarget;if(v=v.listener,M!==r&&s.isPropagationStopped())break e;r=v,s.currentTarget=U;try{r(s)}catch(X){rs(X)}s.currentTarget=null,r=M}else for(h=0;h<l.length;h++){if(v=l[h],M=v.instance,U=v.currentTarget,v=v.listener,M!==r&&s.isPropagationStopped())break e;r=v,s.currentTarget=U;try{r(s)}catch(X){rs(X)}s.currentTarget=null,r=M}}}}function Te(e,t){var n=t[Ll];n===void 0&&(n=t[Ll]=new Set);var l=e+"__bubble";n.has(l)||(ph(t,e,2,!1),n.add(l))}function hc(e,t,n){var l=0;t&&(l|=4),ph(n,e,l,t)}var Qs="_reactListening"+Math.random().toString(36).slice(2);function pc(e){if(!e[Qs]){e[Qs]=!0,Gl.forEach(function(n){n!=="selectionchange"&&(Vm.has(n)||hc(n,!1,e),hc(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Qs]||(t[Qs]=!0,hc("selectionchange",!1,t))}}function ph(e,t,n,l){switch(Gh(t)){case 2:var s=xg;break;case 8:s=bg;break;default:s=Ec}n=s.bind(null,t,n,e),s=void 0,!Rr||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),l?s!==void 0?e.addEventListener(t,n,{capture:!0,passive:s}):e.addEventListener(t,n,!0):s!==void 0?e.addEventListener(t,n,{passive:s}):e.addEventListener(t,n,!1)}function vc(e,t,n,l,s){var r=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var h=l.tag;if(h===3||h===4){var v=l.stateNode.containerInfo;if(v===s)break;if(h===4)for(h=l.return;h!==null;){var M=h.tag;if((M===3||M===4)&&h.stateNode.containerInfo===s)return;h=h.return}for(;v!==null;){if(h=Zn(v),h===null)return;if(M=h.tag,M===5||M===6||M===26||M===27){l=r=h;continue e}v=v.parentNode}}l=l.return}yu(function(){var U=r,X=Ar(n),F=[];e:{var $=Xu.get(e);if($!==void 0){var Y=ls,he=e;switch(e){case"keypress":if(ns(n)===0)break e;case"keydown":case"keyup":Y=Bv;break;case"focusin":he="focus",Y=Hr;break;case"focusout":he="blur",Y=Hr;break;case"beforeblur":case"afterblur":Y=Hr;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Y=ju;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Y=Cv;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Y=Lv;break;case Yu:case Gu:case Wu:Y=Ev;break;case Vu:Y=Gv;break;case"scroll":case"scrollend":Y=wv;break;case"wheel":Y=Vv;break;case"copy":case"cut":case"paste":Y=Av;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Y=ku;break;case"toggle":case"beforetoggle":Y=Qv}var ye=(t&4)!==0,Ge=!ye&&(e==="scroll"||e==="scrollend"),A=ye?$!==null?$+"Capture":null:$;ye=[];for(var E=U,N;E!==null;){var Q=E;if(N=Q.stateNode,Q=Q.tag,Q!==5&&Q!==26&&Q!==27||N===null||A===null||(Q=Xl(E,A),Q!=null&&ye.push(zi(E,Q,N))),Ge)break;E=E.return}0<ye.length&&($=new Y($,he,null,n,X),F.push({event:$,listeners:ye}))}}if((t&7)===0){e:{if($=e==="mouseover"||e==="pointerover",Y=e==="mouseout"||e==="pointerout",$&&n!==_r&&(he=n.relatedTarget||n.fromElement)&&(Zn(he)||he[Kn]))break e;if((Y||$)&&($=X.window===X?X:($=X.ownerDocument)?$.defaultView||$.parentWindow:window,Y?(he=n.relatedTarget||n.toElement,Y=U,he=he?Zn(he):null,he!==null&&(Ge=f(he),ye=he.tag,he!==Ge||ye!==5&&ye!==27&&ye!==6)&&(he=null)):(Y=null,he=U),Y!==he)){if(ye=ju,Q="onMouseLeave",A="onMouseEnter",E="mouse",(e==="pointerout"||e==="pointerover")&&(ye=ku,Q="onPointerLeave",A="onPointerEnter",E="pointer"),Ge=Y==null?$:Aa(Y),N=he==null?$:Aa(he),$=new ye(Q,E+"leave",Y,n,X),$.target=Ge,$.relatedTarget=N,Q=null,Zn(X)===U&&(ye=new ye(A,E+"enter",he,n,X),ye.target=N,ye.relatedTarget=Ge,Q=ye),Ge=Q,Y&&he)t:{for(ye=Xm,A=Y,E=he,N=0,Q=A;Q;Q=ye(Q))N++;Q=0;for(var me=E;me;me=ye(me))Q++;for(;0<N-Q;)A=ye(A),N--;for(;0<Q-N;)E=ye(E),Q--;for(;N--;){if(A===E||E!==null&&A===E.alternate){ye=A;break t}A=ye(A),E=ye(E)}ye=null}else ye=null;Y!==null&&vh(F,$,Y,ye,!1),he!==null&&Ge!==null&&vh(F,Ge,he,ye,!0)}}e:{if($=U?Aa(U):window,Y=$.nodeName&&$.nodeName.toLowerCase(),Y==="select"||Y==="input"&&$.type==="file")var De=Au;else if(Eu($))if(Du)De=am;else{De=tm;var ve=em}else Y=$.nodeName,!Y||Y.toLowerCase()!=="input"||$.type!=="checkbox"&&$.type!=="radio"?U&&Er(U.elementType)&&(De=Au):De=nm;if(De&&(De=De(e,U))){_u(F,De,n,X);break e}ve&&ve(e,$,U),e==="focusout"&&U&&$.type==="number"&&U.memoizedProps.value!=null&&Mr($,"number",$.value)}switch(ve=U?Aa(U):window,e){case"focusin":(Eu(ve)||ve.contentEditable==="true")&&(ll=ve,Gr=U,ei=null);break;case"focusout":ei=Gr=ll=null;break;case"mousedown":Wr=!0;break;case"contextmenu":case"mouseup":case"dragend":Wr=!1,qu(F,n,X);break;case"selectionchange":if(im)break;case"keydown":case"keyup":qu(F,n,X)}var ze;if($r)e:{switch(e){case"compositionstart":var _e="onCompositionStart";break e;case"compositionend":_e="onCompositionEnd";break e;case"compositionupdate":_e="onCompositionUpdate";break e}_e=void 0}else al?Tu(e,n)&&(_e="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(_e="onCompositionStart");_e&&(wu&&n.locale!=="ko"&&(al||_e!=="onCompositionStart"?_e==="onCompositionEnd"&&al&&(ze=xu()):(Jn=X,Or="value"in Jn?Jn.value:Jn.textContent,al=!0)),ve=Ks(U,_e),0<ve.length&&(_e=new Su(_e,e,null,n,X),F.push({event:_e,listeners:ve}),ze?_e.data=ze:(ze=Mu(n),ze!==null&&(_e.data=ze)))),(ze=Zv?Fv(e,n):Jv(e,n))&&(_e=Ks(U,"onBeforeInput"),0<_e.length&&(ve=new Su("onBeforeInput","beforeinput",null,n,X),F.push({event:ve,listeners:_e}),ve.data=ze)),Ym(F,e,U,n,X)}hh(F,t)})}function zi(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Ks(e,t){for(var n=t+"Capture",l=[];e!==null;){var s=e,r=s.stateNode;if(s=s.tag,s!==5&&s!==26&&s!==27||r===null||(s=Xl(e,n),s!=null&&l.unshift(zi(e,s,r)),s=Xl(e,t),s!=null&&l.push(zi(e,s,r))),e.tag===3)return l;e=e.return}return[]}function Xm(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function vh(e,t,n,l,s){for(var r=t._reactName,h=[];n!==null&&n!==l;){var v=n,M=v.alternate,U=v.stateNode;if(v=v.tag,M!==null&&M===l)break;v!==5&&v!==26&&v!==27||U===null||(M=U,s?(U=Xl(n,r),U!=null&&h.unshift(zi(n,U,M))):s||(U=Xl(n,r),U!=null&&h.push(zi(n,U,M)))),n=n.return}h.length!==0&&e.push({event:t,listeners:h})}var Qm=/\r\n?/g,Km=/\u0000|\uFFFD/g;function mh(e){return(typeof e=="string"?e:""+e).replace(Qm,`
9
+ `).replace(Km,"")}function gh(e,t){return t=mh(t),mh(e)===t}function Ye(e,t,n,l,s,r){switch(n){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||el(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&el(e,""+l);break;case"className":Me(e,"class",l);break;case"tabIndex":Me(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":Me(e,n,l);break;case"style":mu(e,l,r);break;case"data":if(t!=="object"){Me(e,"data",l);break}case"src":case"href":if(l===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(n);break}l=es(""+l),e.setAttribute(n,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(n,"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 r=="function"&&(n==="formAction"?(t!=="input"&&Ye(e,t,"name",s.name,s,null),Ye(e,t,"formEncType",s.formEncType,s,null),Ye(e,t,"formMethod",s.formMethod,s,null),Ye(e,t,"formTarget",s.formTarget,s,null)):(Ye(e,t,"encType",s.encType,s,null),Ye(e,t,"method",s.method,s,null),Ye(e,t,"target",s.target,s,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(n);break}l=es(""+l),e.setAttribute(n,l);break;case"onClick":l!=null&&(e.onclick=Mn);break;case"onScroll":l!=null&&Te("scroll",e);break;case"onScrollEnd":l!=null&&Te("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(o(61));if(n=l.__html,n!=null){if(s.children!=null)throw Error(o(60));e.innerHTML=n}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}n=es(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(n,""+l):e.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":l===!0?e.setAttribute(n,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(n,l):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(n,l):e.removeAttribute(n);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(n):e.setAttribute(n,l);break;case"popover":Te("beforetoggle",e),Te("toggle",e),J(e,"popover",l);break;case"xlinkActuate":Ze(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Ze(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Ze(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Ze(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Ze(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Ze(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Ze(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Ze(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Ze(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":J(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=Sv.get(n)||n,J(e,n,l))}}function mc(e,t,n,l,s,r){switch(n){case"style":mu(e,l,r);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(o(61));if(n=l.__html,n!=null){if(s.children!=null)throw Error(o(60));e.innerHTML=n}}break;case"children":typeof l=="string"?el(e,l):(typeof l=="number"||typeof l=="bigint")&&el(e,""+l);break;case"onScroll":l!=null&&Te("scroll",e);break;case"onScrollEnd":l!=null&&Te("scrollend",e);break;case"onClick":l!=null&&(e.onclick=Mn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Wl.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(s=n.endsWith("Capture"),t=n.slice(2,s?n.length-7:void 0),r=e[bt]||null,r=r!=null?r[n]:null,typeof r=="function"&&e.removeEventListener(t,r,s),typeof l=="function")){typeof r!="function"&&r!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,l,s);break e}n in e?e[n]=l:l===!0?e.setAttribute(n,""):J(e,n,l)}}}function wt(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Te("error",e),Te("load",e);var l=!1,s=!1,r;for(r in n)if(n.hasOwnProperty(r)){var h=n[r];if(h!=null)switch(r){case"src":l=!0;break;case"srcSet":s=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:Ye(e,t,r,h,n,null)}}s&&Ye(e,t,"srcSet",n.srcSet,n,null),l&&Ye(e,t,"src",n.src,n,null);return;case"input":Te("invalid",e);var v=r=h=s=null,M=null,U=null;for(l in n)if(n.hasOwnProperty(l)){var X=n[l];if(X!=null)switch(l){case"name":s=X;break;case"type":h=X;break;case"checked":M=X;break;case"defaultChecked":U=X;break;case"value":r=X;break;case"defaultValue":v=X;break;case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(o(137,t));break;default:Ye(e,t,l,X,n,null)}}fu(e,r,v,M,U,h,s,!1);return;case"select":Te("invalid",e),l=h=r=null;for(s in n)if(n.hasOwnProperty(s)&&(v=n[s],v!=null))switch(s){case"value":r=v;break;case"defaultValue":h=v;break;case"multiple":l=v;default:Ye(e,t,s,v,n,null)}t=r,n=h,e.multiple=!!l,t!=null?Pa(e,!!l,t,!1):n!=null&&Pa(e,!!l,n,!0);return;case"textarea":Te("invalid",e),r=s=l=null;for(h in n)if(n.hasOwnProperty(h)&&(v=n[h],v!=null))switch(h){case"value":l=v;break;case"defaultValue":s=v;break;case"children":r=v;break;case"dangerouslySetInnerHTML":if(v!=null)throw Error(o(91));break;default:Ye(e,t,h,v,n,null)}pu(e,l,s,r);return;case"option":for(M in n)n.hasOwnProperty(M)&&(l=n[M],l!=null)&&(M==="selected"?e.selected=l&&typeof l!="function"&&typeof l!="symbol":Ye(e,t,M,l,n,null));return;case"dialog":Te("beforetoggle",e),Te("toggle",e),Te("cancel",e),Te("close",e);break;case"iframe":case"object":Te("load",e);break;case"video":case"audio":for(l=0;l<wi.length;l++)Te(wi[l],e);break;case"image":Te("error",e),Te("load",e);break;case"details":Te("toggle",e);break;case"embed":case"source":case"link":Te("error",e),Te("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(U in n)if(n.hasOwnProperty(U)&&(l=n[U],l!=null))switch(U){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:Ye(e,t,U,l,n,null)}return;default:if(Er(t)){for(X in n)n.hasOwnProperty(X)&&(l=n[X],l!==void 0&&mc(e,t,X,l,n,void 0));return}}for(v in n)n.hasOwnProperty(v)&&(l=n[v],l!=null&&Ye(e,t,v,l,n,null))}function Zm(e,t,n,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var s=null,r=null,h=null,v=null,M=null,U=null,X=null;for(Y in n){var F=n[Y];if(n.hasOwnProperty(Y)&&F!=null)switch(Y){case"checked":break;case"value":break;case"defaultValue":M=F;default:l.hasOwnProperty(Y)||Ye(e,t,Y,null,l,F)}}for(var $ in l){var Y=l[$];if(F=n[$],l.hasOwnProperty($)&&(Y!=null||F!=null))switch($){case"type":r=Y;break;case"name":s=Y;break;case"checked":U=Y;break;case"defaultChecked":X=Y;break;case"value":h=Y;break;case"defaultValue":v=Y;break;case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(o(137,t));break;default:Y!==F&&Ye(e,t,$,Y,l,F)}}Tr(e,h,v,M,U,X,r,s);return;case"select":Y=h=v=$=null;for(r in n)if(M=n[r],n.hasOwnProperty(r)&&M!=null)switch(r){case"value":break;case"multiple":Y=M;default:l.hasOwnProperty(r)||Ye(e,t,r,null,l,M)}for(s in l)if(r=l[s],M=n[s],l.hasOwnProperty(s)&&(r!=null||M!=null))switch(s){case"value":$=r;break;case"defaultValue":v=r;break;case"multiple":h=r;default:r!==M&&Ye(e,t,s,r,l,M)}t=v,n=h,l=Y,$!=null?Pa(e,!!n,$,!1):!!l!=!!n&&(t!=null?Pa(e,!!n,t,!0):Pa(e,!!n,n?[]:"",!1));return;case"textarea":Y=$=null;for(v in n)if(s=n[v],n.hasOwnProperty(v)&&s!=null&&!l.hasOwnProperty(v))switch(v){case"value":break;case"children":break;default:Ye(e,t,v,null,l,s)}for(h in l)if(s=l[h],r=n[h],l.hasOwnProperty(h)&&(s!=null||r!=null))switch(h){case"value":$=s;break;case"defaultValue":Y=s;break;case"children":break;case"dangerouslySetInnerHTML":if(s!=null)throw Error(o(91));break;default:s!==r&&Ye(e,t,h,s,l,r)}hu(e,$,Y);return;case"option":for(var he in n)$=n[he],n.hasOwnProperty(he)&&$!=null&&!l.hasOwnProperty(he)&&(he==="selected"?e.selected=!1:Ye(e,t,he,null,l,$));for(M in l)$=l[M],Y=n[M],l.hasOwnProperty(M)&&$!==Y&&($!=null||Y!=null)&&(M==="selected"?e.selected=$&&typeof $!="function"&&typeof $!="symbol":Ye(e,t,M,$,l,Y));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 ye in n)$=n[ye],n.hasOwnProperty(ye)&&$!=null&&!l.hasOwnProperty(ye)&&Ye(e,t,ye,null,l,$);for(U in l)if($=l[U],Y=n[U],l.hasOwnProperty(U)&&$!==Y&&($!=null||Y!=null))switch(U){case"children":case"dangerouslySetInnerHTML":if($!=null)throw Error(o(137,t));break;default:Ye(e,t,U,$,l,Y)}return;default:if(Er(t)){for(var Ge in n)$=n[Ge],n.hasOwnProperty(Ge)&&$!==void 0&&!l.hasOwnProperty(Ge)&&mc(e,t,Ge,void 0,l,$);for(X in l)$=l[X],Y=n[X],!l.hasOwnProperty(X)||$===Y||$===void 0&&Y===void 0||mc(e,t,X,$,l,Y);return}}for(var A in n)$=n[A],n.hasOwnProperty(A)&&$!=null&&!l.hasOwnProperty(A)&&Ye(e,t,A,null,l,$);for(F in l)$=l[F],Y=n[F],!l.hasOwnProperty(F)||$===Y||$==null&&Y==null||Ye(e,t,F,$,l,Y)}function yh(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Fm(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),l=0;l<n.length;l++){var s=n[l],r=s.transferSize,h=s.initiatorType,v=s.duration;if(r&&v&&yh(h)){for(h=0,v=s.responseEnd,l+=1;l<n.length;l++){var M=n[l],U=M.startTime;if(U>v)break;var X=M.transferSize,F=M.initiatorType;X&&yh(F)&&(M=M.responseEnd,h+=X*(M<v?1:(v-U)/(M-U)))}if(--l,t+=8*(r+h)/(s.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var gc=null,yc=null;function Zs(e){return e.nodeType===9?e:e.ownerDocument}function xh(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 bh(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function xc(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var bc=null;function Jm(){var e=window.event;return e&&e.type==="popstate"?e===bc?!1:(bc=e,!0):(bc=null,!1)}var jh=typeof setTimeout=="function"?setTimeout:void 0,Im=typeof clearTimeout=="function"?clearTimeout:void 0,Sh=typeof Promise=="function"?Promise:void 0,Pm=typeof queueMicrotask=="function"?queueMicrotask:typeof Sh<"u"?function(e){return Sh.resolve(null).then(e).catch(eg)}:jh;function eg(e){setTimeout(function(){throw e})}function pa(e){return e==="head"}function kh(e,t){var n=t,l=0;do{var s=n.nextSibling;if(e.removeChild(n),s&&s.nodeType===8)if(n=s.data,n==="/$"||n==="/&"){if(l===0){e.removeChild(s),Al(t);return}l--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")l++;else if(n==="html")Ci(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,Ci(n);for(var r=n.firstChild;r;){var h=r.nextSibling,v=r.nodeName;r[gn]||v==="SCRIPT"||v==="STYLE"||v==="LINK"&&r.rel.toLowerCase()==="stylesheet"||n.removeChild(r),r=h}}else n==="body"&&Ci(e.ownerDocument.body);n=s}while(n);Al(t)}function wh(e,t){var n=e;e=0;do{var l=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),l&&l.nodeType===8)if(n=l.data,n==="/$"){if(e===0)break;e--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=l}while(n)}function jc(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":jc(n),_a(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function tg(e,t,n,l){for(;e.nodeType===1;){var s=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[gn])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(r=e.getAttribute("rel"),r==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(r!==s.rel||e.getAttribute("href")!==(s.href==null||s.href===""?null:s.href)||e.getAttribute("crossorigin")!==(s.crossOrigin==null?null:s.crossOrigin)||e.getAttribute("title")!==(s.title==null?null:s.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(r=e.getAttribute("src"),(r!==(s.src==null?null:s.src)||e.getAttribute("type")!==(s.type==null?null:s.type)||e.getAttribute("crossorigin")!==(s.crossOrigin==null?null:s.crossOrigin))&&r&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var r=s.name==null?null:""+s.name;if(s.type==="hidden"&&e.getAttribute("name")===r)return e}else return e;if(e=an(e.nextSibling),e===null)break}return null}function ng(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=an(e.nextSibling),e===null))return null;return e}function zh(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=an(e.nextSibling),e===null))return null;return e}function Sc(e){return e.data==="$?"||e.data==="$~"}function kc(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function ag(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var l=function(){t(),n.removeEventListener("DOMContentLoaded",l)};n.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function an(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var wc=null;function Ch(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return an(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function Th(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(t===0)return e;t--}else n!=="/$"&&n!=="/&"||t++}e=e.previousSibling}return null}function Mh(e,t,n){switch(t=Zs(n),e){case"html":if(e=t.documentElement,!e)throw Error(o(452));return e;case"head":if(e=t.head,!e)throw Error(o(453));return e;case"body":if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function Ci(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);_a(e)}var ln=new Map,Eh=new Set;function Fs(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Wn=O.d;O.d={f:lg,r:ig,D:sg,C:rg,L:og,m:cg,X:dg,S:ug,M:fg};function lg(){var e=Wn.f(),t=Ls();return e||t}function ig(e){var t=un(e);t!==null&&t.tag===5&&t.type==="form"?Vd(t):Wn.r(e)}var Ml=typeof document>"u"?null:document;function _h(e,t,n){var l=Ml;if(l&&typeof t=="string"&&t){var s=Ft(t);s='link[rel="'+e+'"][href="'+s+'"]',typeof n=="string"&&(s+='[crossorigin="'+n+'"]'),Eh.has(s)||(Eh.add(s),e={rel:e,crossOrigin:n,href:t},l.querySelector(s)===null&&(t=l.createElement("link"),wt(t,"link",e),Pe(t),l.head.appendChild(t)))}}function sg(e){Wn.D(e),_h("dns-prefetch",e,null)}function rg(e,t){Wn.C(e,t),_h("preconnect",e,t)}function og(e,t,n){Wn.L(e,t,n);var l=Ml;if(l&&e&&t){var s='link[rel="preload"][as="'+Ft(t)+'"]';t==="image"&&n&&n.imageSrcSet?(s+='[imagesrcset="'+Ft(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(s+='[imagesizes="'+Ft(n.imageSizes)+'"]')):s+='[href="'+Ft(e)+'"]';var r=s;switch(t){case"style":r=El(e);break;case"script":r=_l(e)}ln.has(r)||(e=j({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),ln.set(r,e),l.querySelector(s)!==null||t==="style"&&l.querySelector(Ti(r))||t==="script"&&l.querySelector(Mi(r))||(t=l.createElement("link"),wt(t,"link",e),Pe(t),l.head.appendChild(t)))}}function cg(e,t){Wn.m(e,t);var n=Ml;if(n&&e){var l=t&&typeof t.as=="string"?t.as:"script",s='link[rel="modulepreload"][as="'+Ft(l)+'"][href="'+Ft(e)+'"]',r=s;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":r=_l(e)}if(!ln.has(r)&&(e=j({rel:"modulepreload",href:e},t),ln.set(r,e),n.querySelector(s)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Mi(r)))return}l=n.createElement("link"),wt(l,"link",e),Pe(l),n.head.appendChild(l)}}}function ug(e,t,n){Wn.S(e,t,n);var l=Ml;if(l&&e){var s=Fn(l).hoistableStyles,r=El(e);t=t||"default";var h=s.get(r);if(!h){var v={loading:0,preload:null};if(h=l.querySelector(Ti(r)))v.loading=5;else{e=j({rel:"stylesheet",href:e,"data-precedence":t},n),(n=ln.get(r))&&zc(e,n);var M=h=l.createElement("link");Pe(M),wt(M,"link",e),M._p=new Promise(function(U,X){M.onload=U,M.onerror=X}),M.addEventListener("load",function(){v.loading|=1}),M.addEventListener("error",function(){v.loading|=2}),v.loading|=4,Js(h,t,l)}h={type:"stylesheet",instance:h,count:1,state:v},s.set(r,h)}}}function dg(e,t){Wn.X(e,t);var n=Ml;if(n&&e){var l=Fn(n).hoistableScripts,s=_l(e),r=l.get(s);r||(r=n.querySelector(Mi(s)),r||(e=j({src:e,async:!0},t),(t=ln.get(s))&&Cc(e,t),r=n.createElement("script"),Pe(r),wt(r,"link",e),n.head.appendChild(r)),r={type:"script",instance:r,count:1,state:null},l.set(s,r))}}function fg(e,t){Wn.M(e,t);var n=Ml;if(n&&e){var l=Fn(n).hoistableScripts,s=_l(e),r=l.get(s);r||(r=n.querySelector(Mi(s)),r||(e=j({src:e,async:!0,type:"module"},t),(t=ln.get(s))&&Cc(e,t),r=n.createElement("script"),Pe(r),wt(r,"link",e),n.head.appendChild(r)),r={type:"script",instance:r,count:1,state:null},l.set(s,r))}}function Ah(e,t,n,l){var s=(s=ce.current)?Fs(s):null;if(!s)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=El(n.href),n=Fn(s).hoistableStyles,l=n.get(t),l||(l={type:"style",instance:null,count:0,state:null},n.set(t,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=El(n.href);var r=Fn(s).hoistableStyles,h=r.get(e);if(h||(s=s.ownerDocument||s,h={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},r.set(e,h),(r=s.querySelector(Ti(e)))&&!r._p&&(h.instance=r,h.state.loading=5),ln.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},ln.set(e,n),r||hg(s,e,n,h.state))),t&&l===null)throw Error(o(528,""));return h}if(t&&l!==null)throw Error(o(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=_l(n),n=Fn(s).hoistableScripts,l=n.get(t),l||(l={type:"script",instance:null,count:0,state:null},n.set(t,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function El(e){return'href="'+Ft(e)+'"'}function Ti(e){return'link[rel="stylesheet"]['+e+"]"}function Dh(e){return j({},e,{"data-precedence":e.precedence,precedence:null})}function hg(e,t,n,l){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?l.loading=1:(t=e.createElement("link"),l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2}),wt(t,"link",n),Pe(t),e.head.appendChild(t))}function _l(e){return'[src="'+Ft(e)+'"]'}function Mi(e){return"script[async]"+e}function Rh(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+Ft(n.href)+'"]');if(l)return t.instance=l,Pe(l),l;var s=j({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),Pe(l),wt(l,"style",s),Js(l,n.precedence,e),t.instance=l;case"stylesheet":s=El(n.href);var r=e.querySelector(Ti(s));if(r)return t.state.loading|=4,t.instance=r,Pe(r),r;l=Dh(n),(s=ln.get(s))&&zc(l,s),r=(e.ownerDocument||e).createElement("link"),Pe(r);var h=r;return h._p=new Promise(function(v,M){h.onload=v,h.onerror=M}),wt(r,"link",l),t.state.loading|=4,Js(r,n.precedence,e),t.instance=r;case"script":return r=_l(n.src),(s=e.querySelector(Mi(r)))?(t.instance=s,Pe(s),s):(l=n,(s=ln.get(r))&&(l=j({},n),Cc(l,s)),e=e.ownerDocument||e,s=e.createElement("script"),Pe(s),wt(s,"link",l),e.head.appendChild(s),t.instance=s);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,Js(l,n.precedence,e));return t.instance}function Js(e,t,n){for(var l=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),s=l.length?l[l.length-1]:null,r=s,h=0;h<l.length;h++){var v=l[h];if(v.dataset.precedence===t)r=v;else if(r!==s)break}r?r.parentNode.insertBefore(e,r.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function zc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Cc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Is=null;function Oh(e,t,n){if(Is===null){var l=new Map,s=Is=new Map;s.set(n,l)}else s=Is,l=s.get(n),l||(l=new Map,s.set(n,l));if(l.has(e))return l;for(l.set(e,null),n=n.getElementsByTagName(e),s=0;s<n.length;s++){var r=n[s];if(!(r[gn]||r[it]||e==="link"&&r.getAttribute("rel")==="stylesheet")&&r.namespaceURI!=="http://www.w3.org/2000/svg"){var h=r.getAttribute(t)||"";h=e+h;var v=l.get(h);v?v.push(r):l.set(h,[r])}}return l}function Nh(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function pg(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Uh(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function vg(e,t,n,l){if(n.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var s=El(l.href),r=t.querySelector(Ti(s));if(r){t=r._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Ps.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=r,Pe(r);return}r=t.ownerDocument||t,l=Dh(l),(s=ln.get(s))&&zc(l,s),r=r.createElement("link"),Pe(r);var h=r;h._p=new Promise(function(v,M){h.onload=v,h.onerror=M}),wt(r,"link",l),n.instance=r}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=Ps.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var Tc=0;function mg(e,t){return e.stylesheets&&e.count===0&&tr(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var l=setTimeout(function(){if(e.stylesheets&&tr(e,e.stylesheets),e.unsuspend){var r=e.unsuspend;e.unsuspend=null,r()}},6e4+t);0<e.imgBytes&&Tc===0&&(Tc=62500*Fm());var s=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&tr(e,e.stylesheets),e.unsuspend)){var r=e.unsuspend;e.unsuspend=null,r()}},(e.imgBytes>Tc?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(s)}}:null}function Ps(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)tr(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var er=null;function tr(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,er=new Map,t.forEach(gg,e),er=null,Ps.call(e))}function gg(e,t){if(!(t.state.loading&4)){var n=er.get(e);if(n)var l=n.get(null);else{n=new Map,er.set(e,n);for(var s=e.querySelectorAll("link[data-precedence],style[data-precedence]"),r=0;r<s.length;r++){var h=s[r];(h.nodeName==="LINK"||h.getAttribute("media")!=="not all")&&(n.set(h.dataset.precedence,h),l=h)}l&&n.set(null,l)}s=t.instance,h=s.getAttribute("data-precedence"),r=n.get(h)||l,r===l&&n.set(null,s),n.set(h,s),this.count++,l=Ps.bind(this),s.addEventListener("load",l),s.addEventListener("error",l),r?r.parentNode.insertBefore(s,r.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(s,e.firstChild)),t.state.loading|=4}}var Ei={$$typeof:H,Provider:null,Consumer:null,_currentValue:ee,_currentValue2:ee,_threadCount:0};function yg(e,t,n,l,s,r,h,v,M){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=Xn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Xn(0),this.hiddenUpdates=Xn(null),this.identifierPrefix=l,this.onUncaughtError=s,this.onCaughtError=r,this.onRecoverableError=h,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=M,this.incompleteTransitions=new Map}function Hh(e,t,n,l,s,r,h,v,M,U,X,F){return e=new yg(e,t,n,h,M,U,X,F,v),t=1,r===!0&&(t|=24),r=$t(3,null,null,t),e.current=r,r.stateNode=e,t=io(),t.refCount++,e.pooledCache=t,t.refCount++,r.memoizedState={element:l,isDehydrated:n,cache:t},co(r),e}function Bh(e){return e?(e=rl,e):rl}function $h(e,t,n,l,s,r){s=Bh(s),l.context===null?l.context=s:l.pendingContext=s,l=aa(t),l.payload={element:n},r=r===void 0?null:r,r!==null&&(l.callback=r),n=la(e,l,t),n!==null&&(Nt(n,e,t),ri(n,e,t))}function qh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Mc(e,t){qh(e,t),(e=e.alternate)&&qh(e,t)}function Lh(e){if(e.tag===13||e.tag===31){var t=Na(e,67108864);t!==null&&Nt(t,e,67108864),Mc(e,67108864)}}function Yh(e){if(e.tag===13||e.tag===31){var t=Wt();t=Ea(t);var n=Na(e,t);n!==null&&Nt(n,e,t),Mc(e,t)}}var nr=!0;function xg(e,t,n,l){var s=_.T;_.T=null;var r=O.p;try{O.p=2,Ec(e,t,n,l)}finally{O.p=r,_.T=s}}function bg(e,t,n,l){var s=_.T;_.T=null;var r=O.p;try{O.p=8,Ec(e,t,n,l)}finally{O.p=r,_.T=s}}function Ec(e,t,n,l){if(nr){var s=_c(l);if(s===null)vc(e,t,l,ar,n),Wh(e,l);else if(Sg(s,e,t,n,l))l.stopPropagation();else if(Wh(e,l),t&4&&-1<jg.indexOf(e)){for(;s!==null;){var r=un(s);if(r!==null)switch(r.tag){case 3:if(r=r.stateNode,r.current.memoizedState.isDehydrated){var h=Kt(r.pendingLanes);if(h!==0){var v=r;for(v.pendingLanes|=2,v.entangledLanes|=2;h;){var M=1<<31-xt(h);v.entanglements[1]|=M,h&=~M}Sn(r),(Ne&6)===0&&($s=vt()+500,ki(0))}}break;case 31:case 13:v=Na(r,2),v!==null&&Nt(v,r,2),Ls(),Mc(r,2)}if(r=_c(l),r===null&&vc(e,t,l,ar,n),r===s)break;s=r}s!==null&&l.stopPropagation()}else vc(e,t,l,null,n)}}function _c(e){return e=Ar(e),Ac(e)}var ar=null;function Ac(e){if(ar=null,e=Zn(e),e!==null){var t=f(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=m(t),e!==null)return e;e=null}else if(n===31){if(e=y(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return ar=e,null}function Gh(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(kr()){case $l:return 2;case qi:return 8;case ka:case wr:return 32;case wa:return 268435456;default:return 32}default:return 32}}var Dc=!1,va=null,ma=null,ga=null,_i=new Map,Ai=new Map,ya=[],jg="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 Wh(e,t){switch(e){case"focusin":case"focusout":va=null;break;case"dragenter":case"dragleave":ma=null;break;case"mouseover":case"mouseout":ga=null;break;case"pointerover":case"pointerout":_i.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ai.delete(t.pointerId)}}function Di(e,t,n,l,s,r){return e===null||e.nativeEvent!==r?(e={blockedOn:t,domEventName:n,eventSystemFlags:l,nativeEvent:r,targetContainers:[s]},t!==null&&(t=un(t),t!==null&&Lh(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function Sg(e,t,n,l,s){switch(t){case"focusin":return va=Di(va,e,t,n,l,s),!0;case"dragenter":return ma=Di(ma,e,t,n,l,s),!0;case"mouseover":return ga=Di(ga,e,t,n,l,s),!0;case"pointerover":var r=s.pointerId;return _i.set(r,Di(_i.get(r)||null,e,t,n,l,s)),!0;case"gotpointercapture":return r=s.pointerId,Ai.set(r,Di(Ai.get(r)||null,e,t,n,l,s)),!0}return!1}function Vh(e){var t=Zn(e.target);if(t!==null){var n=f(t);if(n!==null){if(t=n.tag,t===13){if(t=m(n),t!==null){e.blockedOn=t,Cn(e.priority,function(){Yh(n)});return}}else if(t===31){if(t=y(n),t!==null){e.blockedOn=t,Cn(e.priority,function(){Yh(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function lr(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=_c(e.nativeEvent);if(n===null){n=e.nativeEvent;var l=new n.constructor(n.type,n);_r=l,n.target.dispatchEvent(l),_r=null}else return t=un(n),t!==null&&Lh(t),e.blockedOn=n,!1;t.shift()}return!0}function Xh(e,t,n){lr(e)&&n.delete(t)}function kg(){Dc=!1,va!==null&&lr(va)&&(va=null),ma!==null&&lr(ma)&&(ma=null),ga!==null&&lr(ga)&&(ga=null),_i.forEach(Xh),Ai.forEach(Xh)}function ir(e,t){e.blockedOn===t&&(e.blockedOn=null,Dc||(Dc=!0,i.unstable_scheduleCallback(i.unstable_NormalPriority,kg)))}var sr=null;function Qh(e){sr!==e&&(sr=e,i.unstable_scheduleCallback(i.unstable_NormalPriority,function(){sr===e&&(sr=null);for(var t=0;t<e.length;t+=3){var n=e[t],l=e[t+1],s=e[t+2];if(typeof l!="function"){if(Ac(l||n)===null)continue;break}var r=un(n);r!==null&&(e.splice(t,3),t-=3,_o(r,{pending:!0,data:s,method:n.method,action:l},l,s))}}))}function Al(e){function t(M){return ir(M,e)}va!==null&&ir(va,e),ma!==null&&ir(ma,e),ga!==null&&ir(ga,e),_i.forEach(t),Ai.forEach(t);for(var n=0;n<ya.length;n++){var l=ya[n];l.blockedOn===e&&(l.blockedOn=null)}for(;0<ya.length&&(n=ya[0],n.blockedOn===null);)Vh(n),n.blockedOn===null&&ya.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(l=0;l<n.length;l+=3){var s=n[l],r=n[l+1],h=s[bt]||null;if(typeof r=="function")h||Qh(n);else if(h){var v=null;if(r&&r.hasAttribute("formAction")){if(s=r,h=r[bt]||null)v=h.formAction;else if(Ac(s)!==null)continue}else v=h.action;typeof v=="function"?n[l+1]=v:(n.splice(l,3),l-=3),Qh(n)}}}function Kh(){function e(r){r.canIntercept&&r.info==="react-transition"&&r.intercept({handler:function(){return new Promise(function(h){return s=h})},focusReset:"manual",scroll:"manual"})}function t(){s!==null&&(s(),s=null),l||setTimeout(n,20)}function n(){if(!l&&!navigation.transition){var r=navigation.currentEntry;r&&r.url!=null&&navigation.navigate(r.url,{state:r.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,s=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),s!==null&&(s(),s=null)}}}function Rc(e){this._internalRoot=e}rr.prototype.render=Rc.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var n=t.current,l=Wt();$h(n,l,e,t,null,null)},rr.prototype.unmount=Rc.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;$h(e.current,2,null,e,null,null),Ls(),t[Kn]=null}};function rr(e){this._internalRoot=e}rr.prototype.unstable_scheduleHydration=function(e){if(e){var t=mn();e={blockedOn:null,target:e,priority:t};for(var n=0;n<ya.length&&t!==0&&t<ya[n].priority;n++);ya.splice(n,0,e),n===0&&Vh(e)}};var Zh=c.version;if(Zh!=="19.2.8")throw Error(o(527,Zh,"19.2.8"));O.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=p(t),e=e!==null?b(e):null,e=e===null?null:e.stateNode,e};var wg={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:_,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var or=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!or.isDisabled&&or.supportsFiber)try{za=or.inject(wg),Ct=or}catch{}}return Oi.createRoot=function(e,t){if(!d(e))throw Error(o(299));var n=!1,l="",s=tf,r=nf,h=af;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(s=t.onUncaughtError),t.onCaughtError!==void 0&&(r=t.onCaughtError),t.onRecoverableError!==void 0&&(h=t.onRecoverableError)),t=Hh(e,1,!1,null,null,n,l,null,s,r,h,Kh),e[Kn]=t.current,pc(e),new Rc(t)},Oi.hydrateRoot=function(e,t,n){if(!d(e))throw Error(o(299));var l=!1,s="",r=tf,h=nf,v=af,M=null;return n!=null&&(n.unstable_strictMode===!0&&(l=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onUncaughtError!==void 0&&(r=n.onUncaughtError),n.onCaughtError!==void 0&&(h=n.onCaughtError),n.onRecoverableError!==void 0&&(v=n.onRecoverableError),n.formState!==void 0&&(M=n.formState)),t=Hh(e,1,!0,t,n??null,l,s,M,r,h,v,Kh),t.context=Bh(null),n=t.current,l=Wt(),l=Ea(l),s=aa(l),s.callback=null,la(n,s,l),n=l,t.current.lanes=n,Qn(t,n),Sn(t),e[Kn]=t.current,pc(e),new rr(t)},Oi.version="19.2.8",Oi}var ip;function Ng(){if(ip)return Uc.exports;ip=1;function i(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(c){console.error(c)}}return i(),Uc.exports=Og(),Uc.exports}var Ug=Ng();const Hg=["run_started","run_resumed","run_finished","run_error","run_titled","cost","budget_alert","budget_stop","usage_limit","mission_incomplete","mission_unreviewed","mission_done_at_cap","settings_changed","message","steer","review_verdict","worker_started","worker_progress","worker_finished","worker_stalled","worker_looping","director_looping","service_exposed","auto_allowed","auto_denied","root_allowed","permission_request","permission_resolved","permission_timeout","question","question_answered","question_timeout","chat_message","chat_turn","chat_cost","chat_error","chat_cleared","chat_proposal_dismissed","chat_question","chat_answered","chat_question_timeout","mission_proposed","models_changed","git_branch","git_note","git_committed","pull_request","memory_updated","mission_doc_restored","run_note","schedule_paused","schedule_skipped"],tu=new Set,mr=new Set;let Ni=null;function Wp(){if(!Ni){Ni=new EventSource("/events"),Ni.onopen=()=>mr.forEach(i=>i(!0)),Ni.onerror=()=>mr.forEach(i=>i(!1));for(const i of Hg)Ni.addEventListener(i,c=>{const u=JSON.parse(c.data);tu.forEach(o=>o(i,u))})}}function Ol(i){return Wp(),tu.add(i),()=>tu.delete(i)}function Bg(i){return Wp(),mr.add(i),()=>mr.delete(i)}function ba(i){return i.costBasis==="priced"||i.costBasis==="free"||i.costBasis==="unpriced"?i.costBasis:i.metered===!1?"unpriced":"priced"}function Vp(i){if(i)switch(i.kind){case"claude-code":return i.configDir;case"codex":return i.codexHome??"~/.codex";case"openai-compatible":return i.baseUrl;case"anthropic-api":return`$${i.apiKeyEnv}`}}function $g(i){if(!i||i.status!=="done")return[];const c=(i.crew??[]).filter(o=>o.requiredForDone===!0);if(!c.length)return[];const u=[];for(const o of c){let d;for(const f of i.reviews??[])f.presetId===o.id&&(!d||(f.at??0)>=(d.at??0))&&(d=f);if(!d?.pass)return[];u.push(o.name)}return u}const ou={runStatus:"idle",mission:"",title:"",costBasis:"priced",usage:null,costUsd:0,budgetUsd:5,agents:[],entries:[],approvals:[],questions:[],missionDoc:null,services:[]};let Oe=0;const qg={missing:"never reviewed this run",fail:"reviewed and did not pass",stale:"passed an earlier diff; the work changed after"};function Xp(i,c,u){const o=[],d=(f,m,y)=>o.push({id:++Oe,ts:u,agent:i,kind:f,title:m,body:y});if(c.type==="system"&&c.subtype==="init")d("system","init",`model: ${c.model??"?"}`);else if(c.type==="assistant"){for(const f of c.message?.content??[])if(f.type==="text"&&f.text?.trim())d("text",i,f.text);else if(f.type==="tool_use"){const m=String(f.name).replace("mcp__foreman__","").replace("mcp__playwright__","");d("tool",m,JSON.stringify(f.input).slice(0,4e3))}}else if(c.type==="user"&&Array.isArray(c.message?.content)){for(const f of c.message.content)if(f.type==="tool_result"){const m=typeof f.content=="string"?f.content:(f.content??[]).map(y=>y.text??"").join("");d("result","result",String(m).slice(0,700))}}else c.type==="result"&&d(c.is_error?"error":"system",`result · ${c.subtype??""}`,String(c.result??"").slice(0,2500));return o}const sp=i=>String(i??"").replace(/\s+/g," ").trim();function Lg(i,c){if(i.kind==="system"&&i.title.startsWith("result ·")&&i.body){for(let u=c.length-1;u>=0&&u>=c.length-40;u--){const o=c[u];if(o.agent===i.agent&&o.kind==="text"){const d=sp(o.body),f=sp(i.body);return d.length>=40&&f.length>=40&&(d.startsWith(f)||f.startsWith(d))?{...i,body:""}:i}}return i}if(i.kind==="result"){const u=/^\[(worker-\d+) (finished|failed|done|started|resumed|stalled|interrupted)\]\s*/.exec(i.body);if(u){const o=i.body.slice(u[0].length).split(`
10
+ `).find(d=>d.trim())??"";return{...i,title:`${u[1]} ${u[2]}`,body:o.length>160?`${o.slice(0,159).trimEnd()}…`:o}}}return i}function Yg(i,c){const u=c.ts??Date.now(),o=c.data;switch(c.event){case"run_started":return{...ou,missionDoc:i.missionDoc,runStatus:"running",mission:o.mission,budgetUsd:o.budgetUsd,costBasis:ba(o),usage:o.usage??null,agents:[{id:"director",status:"running"}]};case"run_resumed":{const d=i.agents.filter(f=>f.id!=="director").map(f=>f.status==="running"?{...f,status:"interrupted"}:f);return{...i,runStatus:"running",mission:o.mission??i.mission,budgetUsd:o.budgetUsd??i.budgetUsd,costUsd:o.costUsd??i.costUsd,costBasis:o.costBasis||o.metered!==void 0?ba(o):i.costBasis,usage:o.usage??i.usage,agents:[{id:"director",status:"running"},...d],entries:[...i.entries,{id:++Oe,ts:u,agent:"system",kind:"system",title:"mission resumed",body:"Director session restored; re-verifying state against MISSION.md."}]}}case"run_finished":return{...i,runStatus:o.status||"done",costUsd:o.costUsd??i.costUsd,approvals:[],questions:[],agents:i.agents.map(d=>d.id==="director"?{...d,status:o.status||"done"}:d)};case"mission_done_at_cap":return{...i,entries:[...i.entries,{id:++Oe,ts:u,agent:"system",kind:"system",title:"done, at the cap",body:String(o.text??"")}]};case"mission_incomplete":return{...i,entries:[...i.entries,{id:++Oe,ts:u,agent:"system",kind:"error",title:"not done",body:[o.text,"",...(o.unmet??[]).map(d=>`▢ ${d}`)].join(`
11
+ `)}]};case"mission_unreviewed":return{...i,entries:[...i.entries,{id:++Oe,ts:u,agent:"system",kind:"error",title:"not reviewed",body:[o.text,"",...(o.blockers??[]).map(d=>`▢ ${d.name??d.presetId??"reviewer"} — ${qg[String(d.reason)]??String(d.reason??"")}`)].join(`
12
+ `)}]};case"review_verdict":return{...i,entries:[...i.entries,{id:++Oe,ts:u,agent:String(o.workerId??"reviewer"),kind:"review",title:`review · ${String(o.name??"")}`,body:String(o.findings??""),review:{presetId:String(o.presetId??""),name:String(o.name??"reviewer"),pass:!!o.pass,findings:String(o.findings??""),diffHash:String(o.diffHash??""),workerId:String(o.workerId??""),model:o.model?String(o.model):void 0,costUsd:typeof o.costUsd=="number"?o.costUsd:void 0,at:u}}]};case"run_error":return{...i,entries:[...i.entries,{id:++Oe,ts:u,agent:"system",kind:"error",title:"error",body:o.error}]};case"worker_stalled":return{...i,entries:[...i.entries,{id:++Oe,ts:u,agent:String(o.id??"worker"),kind:"error",title:"worker stalled",body:String(o.text??"Worker produced no output and was stopped.")}]};case"worker_looping":return{...i,entries:[...i.entries,{id:++Oe,ts:u,agent:String(o.id??"worker"),kind:"error",title:"worker looping",body:String(o.text??`Worker repeated the identical ${String(o.toolName??"tool")} call ${String(o.count??"?")} times and was stopped.`)}]};case"director_looping":return{...i,entries:[...i.entries,{id:++Oe,ts:u,agent:"director",kind:"error",title:"director looping",body:String(o.text??`Director issued the identical ${String(o.toolName??"tool")} call ${String(o.count??"?")} times in a row — notified.`)}]};case"settings_changed":return{...i,budgetUsd:typeof o.budgetUsd=="number"?o.budgetUsd:i.budgetUsd,entries:[...i.entries,{id:++Oe,ts:u,agent:"system",kind:"steer",title:"settings changed",body:(o.changes??[]).join(`
13
+ `)}]};case"run_titled":return{...i,title:String(o.title??"")};case"cost":return{...i,costUsd:o.costUsd,budgetUsd:o.budgetUsd,usage:o.usage??i.usage,costBasis:ba(o)};case"message":{const d=o.agent==="director"&&o.msg?.session_id?{directorSessionId:o.msg.session_id}:{},f=Xp(o.agent,o.msg,u).map(m=>Lg(m,i.entries));return f.length||d.directorSessionId?{...i,...d,entries:[...i.entries.slice(-1499),...f]}:i}case"steer":return{...i,entries:[...i.entries,{id:++Oe,ts:u,agent:"you",kind:"steer",title:"steer",body:o.text,to:o.to,timing:o.timing}]};case"usage_limit":return{...i,entries:[...i.entries,{id:++Oe,ts:u,agent:"system",kind:"error",title:"usage limit",body:o.text}]};case"models_changed":return{...i,entries:[...i.entries,{id:++Oe,ts:u,agent:"system",kind:"system",title:"models changed",body:o.text}]};case"memory_updated":return{...i,entries:[...i.entries,{id:++Oe,ts:u,agent:"system",kind:"system",title:"memory",body:String(o.text??"Project memory rewritten.")}]};case"pull_request":return{...i,entries:[...i.entries,{id:++Oe,ts:u,agent:"system",kind:o.error?"error":"system",title:o.method==="gh"?"pull request":"branch pushed",body:String(o.text??"")}]};case"mission_doc_restored":return{...i,entries:[...i.entries,{id:++Oe,ts:u,agent:"system",kind:"system",title:"mission doc restored",body:String(o.text??"")}]};case"git_branch":case"git_note":case"git_committed":case"run_note":return{...i,entries:[...i.entries,{id:++Oe,ts:u,agent:"system",kind:c.event==="git_committed"&&o.error||c.event==="git_note"?"error":"system",title:c.event==="git_branch"?`branch · ${String(o.branch??"")}`:c.event==="git_committed"?"branch closed":c.event==="run_note"?"note":"git",body:String(o.text??"")}]};case"budget_alert":return{...i,entries:[...i.entries,{id:++Oe,ts:u,agent:"system",kind:o.level==="exceeded"?"error":"system",title:"budget",body:o.text}]};case"service_exposed":return{...i,services:[...i.services.filter(d=>d.port!==o.port),{port:o.port,label:o.label,path:o.path,url:o.url,since:u}]};case"worker_started":{const d=i.agents.filter(m=>m.id!==o.id),f=i.agents.find(m=>m.id===o.id);return{...i,agents:[...d,{id:o.id,status:"running",task:o.task??f?.task}],entries:[...i.entries,{id:++Oe,ts:u,agent:o.id,kind:"system",title:o.resumed?"resumed":"spawned",body:o.task??""}]}}case"worker_progress":{const d=String(o.status??""),f=[d,...Array.isArray(o.done)&&o.done.length?[`done: ${o.done.join(", ")}`]:[],...o.next?[`next: ${String(o.next)}`]:[],...o.blocked?[`BLOCKED: ${String(o.blocked)}`]:[]].join(`
14
+ `);return{...i,agents:i.agents.map(m=>m.id===o.id?{...m,task:d||m.task}:m),entries:[...i.entries,{id:++Oe,ts:u,agent:String(o.id??"worker"),kind:"system",title:o.blocked?"progress · blocked":"progress",body:f}]}}case"worker_finished":return{...i,agents:i.agents.map(d=>d.id===o.id?{...d,status:o.status}:d)};case"permission_request":return i.approvals.some(d=>d.id===o.id)?i:{...i,approvals:[...i.approvals,{...o,since:u}],entries:[...i.entries,{id:++Oe,ts:u,agent:String(o.agent??"director"),kind:"system",title:"waiting on you",body:`${String(o.toolName??"tool")}: ${String(o.description??o.decisionReason??o.title??"needs your approval")}`}]};case"permission_resolved":{const d=i.approvals.find(f=>f.id===o.id);return d?{...i,approvals:i.approvals.filter(f=>f.id!==o.id),entries:[...i.entries,{id:++Oe,ts:u,agent:String(d.agent??"director"),kind:"system",title:"resolved",body:String(o.behavior??"resolved")}]}:i}case"question":return i.questions.some(d=>d.id===o.id)?i:{...i,questions:[...i.questions,{...o,since:u}],entries:[...i.entries,{id:++Oe,ts:u,agent:"director",kind:"system",title:"waiting on you",body:`question: ${String(o.question??"")}`}]};case"question_answered":return i.questions.find(f=>f.id===o.id)?{...i,questions:i.questions.filter(f=>f.id!==o.id),entries:[...i.entries,{id:++Oe,ts:u,agent:"director",kind:"system",title:"resolved",body:"answered"}]}:i;case"root_allowed":return{...i,entries:[...i.entries,{id:++Oe,ts:u,agent:String(o.agent??"director"),kind:"system",title:"path allowed for run",body:o.reason?`${String(o.path??"")} — ${String(o.reason)}`:String(o.path??"")}]};case"auto_denied":return{...i,entries:[...i.entries,{id:++Oe,ts:u,agent:String(o.agent??"director"),kind:"system",title:"redirected to workspace",body:String(o.reason??"")}]};case"permission_timeout":case"question_timeout":{const d=c.event==="permission_timeout";if(!(d?i.approvals.find(y=>y.id===o.id):i.questions.find(y=>y.id===o.id)))return i;const m=Math.max(1,Math.round(Number(o.afterMs??0)/6e4));return{...i,approvals:d?i.approvals.filter(y=>y.id!==o.id):i.approvals,questions:d?i.questions:i.questions.filter(y=>y.id!==o.id),entries:[...i.entries,{id:++Oe,ts:u,agent:String(o.agent??"director"),kind:"error",title:d?"auto-denied (unattended)":"auto-answered (unattended)",body:d?`${String(o.toolName??"tool")} waited ${m} min with no answer and was denied; the agent was told to redo the work inside .foreman/work/.`:`The director's question waited ${m} min with no answer; it was told to decide itself and record the decision in MISSION.md.`}]}}default:return i}}function Gg(i,c){switch(c.t){case"reset":return ou;case"wire":return Yg(i,c.e);case"missiondoc":return{...i,missionDoc:c.doc}}}function Wg(i,c){const[u,o]=g.useReducer(Gg,ou),d=g.useRef(null);return g.useEffect(()=>{if(o({t:"reset"}),!i)return;let f=!1;d.current=[];const m=c?Ol((p,b)=>{if(b.runId!==i)return;const j={event:p,data:b.data};d.current?d.current.push(j):o({t:"wire",e:j})}):null;(async()=>{try{const p=await fetch(`/runs/${encodeURIComponent(i)}/events`).catch(()=>null);if(f||!p?.ok)return;const{events:b}=await p.json();if(f)return;for(const j of b)o({t:"wire",e:j})}finally{if(!f){for(const p of d.current??[])o({t:"wire",e:p});d.current=null}}})();const y=async()=>{const p=await fetch(`/missiondoc?run=${encodeURIComponent(i)}`).catch(()=>null);p?.ok&&!f&&o({t:"missiondoc",doc:(await p.json()).doc})};y();const x=c?setInterval(y,5e3):null;return()=>{f=!0,m?.(),x&&clearInterval(x)}},[i,c]),u}function Vg(i,c){if(i==="message"){const u=c.msg;if(u?.type==="assistant")for(const o of u.message?.content??[]){if(o.type==="text"&&o.text?.trim())return`${c.agent}: ${o.text.trim()}`;if(o.type==="tool_use"){const d=String(o.name||"").replace(/^mcp__(foreman|playwright)__/,"");return`${c.agent} · ${d}`}}return null}return i==="worker_started"?`${c.id} ${c.resumed?"resumed":"spawned"}`:i==="worker_finished"?`${c.id} ${c.status}`:i==="worker_progress"?`${c.id}: ${c.blocked?`BLOCKED — ${c.blocked}`:c.status}`:i==="steer"?`you → ${c.to}: ${c.text}`:i==="budget_alert"?c.text:i==="question"?`director asks: ${c.question}`:null}function Xg(){const[i,c]=g.useState([]),[u,o]=g.useState(!1),[d,f]=g.useState({mode:"none",source:""}),[m,y]=g.useState({}),[x,p]=g.useState(null),[b,j]=g.useState(""),[S,z]=g.useState(null),D=g.useCallback(async()=>{const G=await fetch("/projects").catch(()=>null);if(!G?.ok)return;const T=await G.json();c(T.projects),f({mode:T.authMode??"none",source:T.authSource??"",account:T.authAccount??void 0}),p(T.update?.latest?{latest:String(T.update.latest),current:String(T.version??"")}:null),j(String(T.version??"")),z(!!T.firstRun)},[]);return g.useEffect(()=>{D();const G=setInterval(D,3e3),T=Ol((R,H)=>{if(!H.chat&&(["run_started","run_resumed","run_finished","permission_request","permission_resolved","permission_timeout","question","question_answered","question_timeout"].includes(R)&&D(),H.projectId))if(R==="run_finished")y(K=>{const{[H.projectId]:se,...B}=K;return B});else{const K=Vg(R,H.data);K&&y(se=>({...se,[H.projectId]:K.slice(0,160)}))}}),w=Bg(R=>{o(R),R&&D()});return()=>{clearInterval(G),T(),w()}},[D]),{projects:i,connected:u,auth:d,refresh:D,activity:m,update:x,version:b,firstRun:S}}function Qg(i){const[c,u]=g.useState([]),o=g.useCallback(async()=>{const d=await fetch(`/runs?projectId=${encodeURIComponent(i)}`).catch(()=>null);d?.ok&&u((await d.json()).runs)},[i]);return g.useEffect(()=>(o(),Ol((f,m)=>{m.projectId===i&&(f==="run_started"||f==="run_resumed"||f==="run_finished"||f==="git_committed"||f==="pull_request")&&o()})),[i,o]),c}function Kg(i){const[c,u]=g.useState([]),[o,d]=g.useState({monthSpendUsd:0,monthlyCapUsd:0}),[f,m]=g.useState(!0),[y,x]=g.useState(""),p=g.useCallback(async()=>{if(!i){u([]),m(!1);return}const b=await ke.schedules(i).catch(()=>null);if(!b){x("could not reach the server"),m(!1);return}if(!b.ok){x((await b.json().catch(()=>({}))).error??`HTTP ${b.status}`),m(!1);return}const j=await b.json();u(j.schedules??[]),d({monthSpendUsd:j.monthSpendUsd??0,monthlyCapUsd:j.monthlyCapUsd??0}),x(""),m(!1)},[i]);return g.useEffect(()=>(m(!0),p(),Ol((j,S)=>{S.projectId===i&&(j==="schedule_paused"||j==="schedule_skipped"||j==="run_started"||j==="run_finished")&&p()})),[i,p]),{schedules:c,...o,loading:f,error:y,reload:p}}const nu={entries:[],costUsd:0,proposal:null,thinking:!1,question:null,who:null};function Zg(i,c){return i.map(u=>`${u.question.replace(/[?:]\s*$/,"")} → ${c[u.question]||"(no answer)"}`).join(`
15
+ `)}function Qp(i,c){const u=c.ts??Date.now(),o=c.data;switch(c.event){case"chat_cleared":return Kp(i,{t:"reset"});case"chat_proposal_dismissed":return{...i,proposal:null};case"chat_message":return{...i,entries:[...i.entries,{id:++Oe,ts:u,agent:"you",kind:"steer",title:"you",body:o.text}]};case"message":{const d=Xp("foreman",o.msg,u).filter(f=>f.kind==="text"||f.kind==="tool"&&!/ask_user/.test(f.title));return d.length?{...i,entries:[...i.entries,...d]}:i}case"mission_proposed":return{...i,proposal:o};case"chat_cost":return{...i,costUsd:o.costUsd??i.costUsd};case"chat_turn":return{...i,thinking:o.state==="thinking",who:typeof o.model=="string"&&typeof o.provider=="string"?{model:o.model,provider:o.provider,costBasis:ba(o)}:i.who};case"chat_question":return Array.isArray(o.questions)&&o.questions.length?{...i,question:{id:String(o.id),questions:o.questions,askedAt:u}}:i;case"chat_answered":{const d=i.question,f=d&&d.id===o.id?d.questions:[],m=f.length?Zg(f,o.answers??{}):Object.entries(o.answers??{}).map(([y,x])=>`${y} → ${x}`).join(`
16
+ `);return{...i,question:i.question?.id===o.id?null:i.question,entries:m?[...i.entries,{id:++Oe,ts:u,agent:"you",kind:"steer",title:o.source?`you chose · via ${o.source}`:"you chose",body:m}]:i.entries}}case"chat_question_timeout":return{...i,question:i.question?.id===o.id?null:i.question,entries:[...i.entries,{id:++Oe,ts:u,agent:"system",kind:"error",title:"no answer (unattended)",body:`No answer after ${Math.round((o.afterMs??0)/6e4)} minutes — the planner is proceeding on its recommended options and will state the assumptions.`}]};case"chat_error":return{...i,entries:[...i.entries,{id:++Oe,ts:u,agent:"system",kind:"error",title:"planner",body:o.error}]};default:return i}}function Kp(i,c){switch(c.t){case"reset":return nu;case"load":return c.view;case"dismiss":return{...i,proposal:null};case"wire":return Qp(i,c.e)}}function Fg(i){const[c,u]=g.useState([]),[o,d]=g.useState(!1);return g.useEffect(()=>{if(i.length<2){u([]),d(!1);return}let f=!1;d(!0);const m=setTimeout(()=>{fetch(`/search?q=${encodeURIComponent(i)}`).then(y=>y.ok?y.json():{runs:[]}).then(y=>{f||(u(y.runs??[]),d(!1))}).catch(()=>{f||(u([]),d(!1))})},200);return()=>{f=!0,clearTimeout(m)}},[i]),{hits:c,busy:o}}const Jg="_fleet";function Zp(i){const[c,u]=g.useReducer(Kp,nu),o=g.useRef(null),d=g.useCallback(async b=>{const j=await fetch(`/chat?projectId=${encodeURIComponent(b)}`).catch(()=>null);return j?.ok?await j.json():null},[]);g.useEffect(()=>{if(u({t:"reset"}),!i)return;let b=!1;o.current=[];const j=Ol((S,z)=>{if(!z.chat||z.projectId!==i)return;const D={event:S,data:z.data};o.current?o.current.push(D):u({t:"wire",e:D})});return(async()=>{const S=await d(i);if(!b){if(S){let z={...nu,costUsd:S.costUsd,proposal:S.proposal,thinking:S.thinking};for(const D of S.events)z=Qp(z,D);z={...z,question:S.question??null,who:S.who??z.who,thinking:S.thinking},u({t:"load",view:z})}for(const z of o.current??[])u({t:"wire",e:z});o.current=null}})(),()=>{b=!0,j()}},[i,d]);const f=g.useCallback(async b=>{if(!i)return"no project";const j=await nt("/chat",{projectId:i,text:b});return j.ok?null:(await j.json().catch(()=>({}))).error??"could not reach the planner"},[i]),m=g.useCallback(async()=>{i&&await nt("/chat/stop",{projectId:i}).catch(()=>{})},[i]),y=g.useCallback(async()=>{i&&(await fetch(`/chat?projectId=${encodeURIComponent(i)}`,{method:"DELETE"}).catch(()=>{}),u({t:"reset"}))},[i]),x=g.useCallback(async(b,j)=>{if(!i)return"no project";const S=await nt("/chat/answer",{projectId:i,id:b,answers:j});return S.ok?null:(await S.json().catch(()=>({}))).error??"could not deliver the answer"},[i]),p=g.useCallback(()=>u({t:"dismiss"}),[]);return{...c,send:f,answer:x,clear:y,stop:m,dismissProposal:p}}function Ig(){const[i,c]=g.useState(null),[u,o]=g.useState(!1),[d,f]=g.useState(""),m=g.useCallback(async()=>{const p=await fetch("/notify").catch(()=>null);p?.ok&&c(await p.json())},[]);g.useEffect(()=>{m()},[m]),g.useEffect(()=>{if(!i?.telegram.linking)return;const p=setInterval(()=>{m()},3e3);return()=>clearInterval(p)},[i?.telegram.linking,m]);const y=g.useCallback(async p=>{o(!0),f("");try{const b=await p();b.ok||f((await b.json().catch(()=>({}))).error??`HTTP ${b.status}`)}catch(b){f(b instanceof Error?b.message:String(b))}finally{o(!1),await m()}},[m]),x=(p,b,j)=>fetch(b,{method:p,headers:j?{"content-type":"application/json"}:void 0,body:j?JSON.stringify(j):void 0});return{status:i,busy:u,error:d,refresh:m,onSaveToken:p=>{y(()=>x("PUT","/notify/telegram/token",{token:p}))},onClearToken:()=>{y(()=>x("DELETE","/notify/telegram/token"))},onLink:()=>{y(()=>x("POST","/notify/telegram/link"))},onUnlink:()=>{y(()=>x("DELETE","/notify/telegram/link"))},onTest:()=>{y(()=>x("POST","/notify/test"))},onSavePublicUrl:p=>{y(()=>x("PATCH","/notify/settings",{publicUrl:p}))}}}function Pg(){const i=()=>{const f=window.location.hash.match(/^#\/p\/([^/]+)(?:\/r\/([^/]+)(?:\/(files|runs))?)?/);return{setup:/^#\/setup\b/.test(window.location.hash),projectId:f?decodeURIComponent(f[1]):null,runId:f?.[2]?decodeURIComponent(f[2]):null,tab:f?.[3]==="files"||f?.[3]==="runs"?f[3]:"mission"}},[c,u]=g.useState(i);g.useEffect(()=>{const f=()=>u(i());return window.addEventListener("hashchange",f),()=>window.removeEventListener("hashchange",f)},[]);const o=g.useCallback(f=>{window.location.hash=f?`#/p/${encodeURIComponent(f)}`:"#/"},[]),d=g.useCallback((f,m,y="mission")=>{window.location.hash=m?`#/p/${encodeURIComponent(f)}/r/${encodeURIComponent(m)}${y==="mission"?"":`/${y}`}`:`#/p/${encodeURIComponent(f)}`},[]);return{...c,go:o,goRun:d}}const nt=(i,c)=>fetch(i,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(c)}),ke={linkProject:(i,c,u)=>nt("/projects",{folder:i,name:c,provider:u}),cloneProject:(i,c)=>nt("/projects/clone",{url:i,branch:c}),cloneStatus:i=>fetch(`/projects/clone/${encodeURIComponent(i)}`),cloneWhere:i=>fetch(`/projects/clone/where?url=${encodeURIComponent(i)}`),prDraft:i=>fetch(`/runs/${encodeURIComponent(i)}/pr`),openPr:(i,c,u)=>nt(`/runs/${encodeURIComponent(i)}/pr`,{title:c,body:u}),prState:i=>fetch(`/runs/${encodeURIComponent(i)}/pr/state`),memory:i=>fetch(`/projects/${encodeURIComponent(i)}/memory`),runServices:i=>fetch(`/runs/${encodeURIComponent(i)}/services`),stopService:(i,c)=>nt(`/runs/${encodeURIComponent(i)}/services/${c}/stop`,{}),instances:()=>fetch("/instances"),doctor:()=>fetch("/doctor"),setupDone:()=>nt("/setup/done",{}),installBrowser:()=>nt("/setup/browser",{}),browserInstall:i=>fetch(`/setup/browser/${encodeURIComponent(i)}`),updateProject:(i,c)=>fetch(`/projects/${encodeURIComponent(i)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(c)}),unlinkProject:i=>fetch(`/projects/${encodeURIComponent(i)}`,{method:"DELETE"}),run:(i,c,u,o={})=>nt("/run",{projectId:i,mission:c,budgetUsd:u,directorModel:o.directorModel||void 0,workerModel:o.workerModel||void 0,directorProviderId:o.directorProviderId||void 0,workerProviderId:o.workerProviderId||void 0,browserTools:o.browserTools||void 0,crew:o.crew?.length?o.crew:void 0,allowDirty:o.allowDirty||void 0}),resume:(i,c={})=>nt(`/runs/${encodeURIComponent(i)}/resume`,c),permission:(i,c,u)=>nt("/permission",{id:i,behavior:c,message:u}),answer:(i,c)=>nt("/answer",{id:i,text:c}),attach:async(i,c)=>{const u=await Promise.all(c.map(async o=>({name:o.name,type:o.type,data:await new Promise((d,f)=>{const m=new FileReader;m.onload=()=>d(String(m.result).split(",")[1]??""),m.onerror=()=>f(m.error),m.readAsDataURL(o)})})));return nt("/attachments",{projectId:i,files:u})},forkPlan:(i,c)=>nt("/chat/fork",{projectId:i,runId:c}),steer:(i,c)=>nt("/steer",{runId:i,text:c}),interrupt:i=>nt("/interrupt",{runId:i}),updateRun:(i,c)=>fetch("/run",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({runId:i,...c})}).then(async u=>{if(!u.ok)throw new Error((await u.json().catch(()=>({}))).error||`HTTP ${u.status}`);return u.json()}),setProviderKey:(i,c)=>fetch(`/providers/${encodeURIComponent(i)}/key`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({key:c})}),clearProviderKey:i=>fetch(`/providers/${encodeURIComponent(i)}/key`,{method:"DELETE"}),schedules:i=>fetch(`/projects/${encodeURIComponent(i)}/schedules`),createSchedule:(i,c)=>nt(`/projects/${encodeURIComponent(i)}/schedules`,c),updateSchedule:(i,c)=>fetch(`/schedules/${encodeURIComponent(i)}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(c)}),deleteSchedule:i=>fetch(`/schedules/${encodeURIComponent(i)}`,{method:"DELETE"}),pauseSchedule:i=>nt(`/schedules/${encodeURIComponent(i)}/pause`,{}),resumeSchedule:i=>nt(`/schedules/${encodeURIComponent(i)}/resume`,{}),runScheduleNow:i=>nt(`/schedules/${encodeURIComponent(i)}/run-now`,{}),previewCadence:i=>fetch(`/schedules/preview?cadence=${encodeURIComponent(JSON.stringify(i))}`),browse:i=>fetch("/browse"+(i?`?path=${encodeURIComponent(i)}`:"")),mkdir:(i,c)=>nt("/mkdir",{parent:i,name:c}),locate:i=>fetch(`/locate?name=${encodeURIComponent(i)}`)};async function Fp(i,c,u){if(!u.length)return c;const o=await ke.attach(i,u),d=await o.json().catch(()=>({}));if(!o.ok)throw new Error(d.error||"could not save the attachments");const f=(d.files??[]).map(m=>m.path);return`${c}
17
+
18
+ Attached files (in the project folder — read them):
19
+ ${f.map(m=>`- ${m}`).join(`
20
+ `)}`}function Jp(i){const[c,u]=g.useState(null),o=g.useCallback(()=>{ke.installBrowser().then(async d=>{if(!d.ok){u({id:"",state:"error",progress:"",error:`HTTP ${d.status}`});return}const{id:f}=await d.json();u({id:f,state:"running",progress:"Starting…"})})},[]);return g.useEffect(()=>{if(!c||c.state!=="running"||!c.id)return;const d=setInterval(async()=>{const f=await ke.browserInstall(c.id).catch(()=>null);if(!f?.ok)return;const m=await f.json();u({id:c.id,...m}),m.state!=="running"&&(clearInterval(d),m.state==="done"&&i?.())},1e3);return()=>clearInterval(d)},[c?.id,c?.state]),{start:o,job:c?{state:c.state,progress:c.progress,error:c.error}:null}}const Ip=(...i)=>i.filter((c,u,o)=>!!c&&c.trim()!==""&&o.indexOf(c)===u).join(" ").trim();const ey=i=>i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const ty=i=>i.replace(/^([A-Z])|[\s-_]+(\w)/g,(c,u,o)=>o?o.toUpperCase():u.toLowerCase());const rp=i=>{const c=ty(i);return c.charAt(0).toUpperCase()+c.slice(1)};var qc={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const ny=i=>{for(const c in i)if(c.startsWith("aria-")||c==="role"||c==="title")return!0;return!1},ay=g.createContext({}),ly=()=>g.useContext(ay),iy=g.forwardRef(({color:i,size:c,strokeWidth:u,absoluteStrokeWidth:o,className:d="",children:f,iconNode:m,...y},x)=>{const{size:p=24,strokeWidth:b=2,absoluteStrokeWidth:j=!1,color:S="currentColor",className:z=""}=ly()??{},D=o??j?Number(u??b)*24/Number(c??p):u??b;return g.createElement("svg",{ref:x,...qc,width:c??p??qc.width,height:c??p??qc.height,stroke:i??S,strokeWidth:D,className:Ip("lucide",z,d),...!f&&!ny(y)&&{"aria-hidden":"true"},...y},[...m.map(([G,T])=>g.createElement(G,T)),...Array.isArray(f)?f:[f]])});const fe=(i,c)=>{const u=g.forwardRef(({className:o,...d},f)=>g.createElement(iy,{ref:f,iconNode:c,className:Ip(`lucide-${ey(rp(i))}`,`lucide-${i}`,o),...d}));return u.displayName=rp(i),u};const sy=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],ry=fe("activity",sy);const oy=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],cy=fe("arrow-left",oy);const uy=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],dy=fe("arrow-up-down",uy);const fy=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],hy=fe("bell",fy);const py=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],vy=fe("bot",py);const my=[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]],gy=fe("braces",my);const yy=[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]],xy=fe("bug",yy);const by=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],jy=fe("check",by);const Sy=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ky=fe("chevron-down",Sy);const wy=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],zy=fe("chevron-left",wy);const Cy=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Ty=fe("chevron-right",Cy);const My=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Ey=fe("circle",My);const _y=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],Ay=fe("clock",_y);const Dy=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],Ry=fe("code",Dy);const Oy=[["path",{d:"M13.744 17.736a6 6 0 1 1-7.48-7.48",key:"bq4yh3"}],["path",{d:"M15 6h1v4",key:"11y1tn"}],["path",{d:"m6.134 14.768.866-.5 2 3.464",key:"17snzx"}],["circle",{cx:"16",cy:"8",r:"6",key:"14bfc9"}]],Ny=fe("coins",Oy);const Uy=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],Hy=fe("corner-down-left",Uy);const By=[["path",{d:"M14 9 9 4 4 9",key:"1af5af"}],["path",{d:"M20 20h-7a4 4 0 0 1-4-4V4",key:"1blwi3"}]],$y=fe("corner-left-up",By);const qy=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],Ly=fe("cpu",qy);const Yy=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Gy=fe("eye",Yy);const Wy=[["path",{d:"M14.364 13.634a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506l4.013-4.009a1 1 0 0 0-3.004-3.004z",key:"ukzhwg"}],["path",{d:"M14.487 7.858A1 1 0 0 1 14 7V2",key:"1klhew"}],["path",{d:"M20 19.645V20a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l2.516 2.516",key:"rxaxab"}],["path",{d:"M8 18h1",key:"13wk12"}]],Vy=fe("file-pen-line",Wy);const Xy=[["path",{d:"M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34",key:"o6klzx"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z",key:"zhnas1"}]],Qy=fe("file-pen",Xy);const Ky=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Zy=fe("file-text",Ky);const Fy=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],Jy=fe("file",Fy);const Iy=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Py=fe("folder-open",Iy);const ex=[["path",{d:"M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1",key:"1bw5m7"}],["path",{d:"m21 21-1.9-1.9",key:"1g2n9r"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}]],tx=fe("folder-search",ex);const nx=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],ax=fe("folder",nx);const lx=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],ix=fe("funnel",lx);const sx=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],rx=fe("globe",sx);const ox=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],cx=fe("image",ox);const ux=[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]],dx=fe("layout-template",ux);const fx=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],hx=fe("list-checks",fx);const px=[["path",{d:"M16 5H3",key:"m91uny"}],["path",{d:"M16 12H3",key:"1a2rj7"}],["path",{d:"M9 19H3",key:"s61nz1"}],["path",{d:"m16 16-3 3 3 3",key:"117b85"}],["path",{d:"M21 5v12a2 2 0 0 1-2 2h-6",key:"hey24a"}]],vx=fe("list-end",px);const mx=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],gx=fe("loader-circle",mx);const yx=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],xx=fe("message-circle-question-mark",yx);const bx=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M12 8v6",key:"1ib9pf"}],["path",{d:"M9 11h6",key:"1fldmi"}]],jx=fe("message-square-plus",bx);const Sx=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],kx=fe("message-square",Sx);const wx=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],zx=fe("moon",wx);const Cx=[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]],Tx=fe("octagon-alert",Cx);const Mx=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],Ex=fe("paperclip",Mx);const _x=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],Ax=fe("pause",_x);const Dx=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],Rx=fe("pen-line",Dx);const Ox=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Nx=fe("plus",Ox);const Ux=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],Hx=fe("power",Ux);const Bx=[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]],$x=fe("quote",Bx);const qx=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],Lx=fe("rotate-ccw-clock",qx);const Yx=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],Gx=fe("rotate-cw",Yx);const Wx=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],Vx=fe("save",Wx);const Xx=[["path",{d:"m8 11 2 2 4-4",key:"1sed1v"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],Qx=fe("search-check",Xx);const Kx=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Zx=fe("search",Kx);const Fx=[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]],Jx=fe("send-horizontal",Fx);const Ix=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],Px=fe("server",Ix);const e0=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],t0=fe("settings",e0);const n0=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],a0=fe("shield-check",n0);const l0=[["path",{d:"m18 14 4 4-4 4",key:"10pe0f"}],["path",{d:"m18 2 4 4-4 4",key:"pucp1d"}],["path",{d:"M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22",key:"1ailkh"}],["path",{d:"M2 6h1.972a4 4 0 0 1 3.6 2.2",key:"km57vx"}],["path",{d:"M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45",key:"os18l9"}]],i0=fe("shuffle",l0);const s0=[["path",{d:"m10 9-3 3 3 3",key:"1oro0q"}],["path",{d:"m14 15 3-3-3-3",key:"bz13h7"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]],r0=fe("square-code",s0);const o0=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],c0=fe("sun",o0);const u0=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],d0=fe("terminal",u0);const f0=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]],h0=fe("text-align-start",f0);const p0=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],v0=fe("triangle-alert",p0);const m0=[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]],g0=fe("unlink",m0);const y0=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],x0=fe("user-plus",y0);const b0=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],j0=fe("user",b0);const S0=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],k0=fe("users",S0);const w0=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],z0=fe("wifi-off",w0);const C0=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],T0=fe("wrench",C0);const M0=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],E0=fe("x",M0);const _0=[["path",{d:"M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z",key:"1v7up4"}]],A0=fe("zap",_0),op={Circle:Ey,Activity:ry,Check:jy,X:E0,Pause:Ax,WifiOff:z0,History:Lx,TriangleAlert:v0,OctagonAlert:Tx,RotateCw:Gx,Bot:vy,Plus:Nx,CornerLeftUp:$y,ArrowLeft:cy,Folder:ax,Bell:hy,Unlink:g0,Sun:c0,Moon:zx,Clock:Ay,AlignLeft:h0,Users:k0,ChevronDown:ky,ChevronRight:Ty,ChevronLeft:zy,Braces:gy,MessageCircleQuestion:xx,ShieldCheck:a0,Coins:Ny,LayoutTemplate:dx,Save:Vx,Filter:ix,Settings:t0,Paperclip:Ex,File:Jy,Image:cx,Code:Ry,SquareCode:r0,Quote:$x,PenLine:Rx,Eye:Gy,Cpu:Ly,LoaderCircle:gx,MessageSquarePlus:jx,SendHorizontal:Jx,User:j0,Zap:A0,ListEnd:vx,FilePen:Qy,FilePenLine:Vy,FileText:Zy,Terminal:d0,Search:Zx,FolderSearch:tx,FolderOpen:Py,Globe:rx,ListChecks:hx,UserPlus:x0,MessageSquare:kx,CornerDownLeft:Hy,Power:Hx,Wrench:T0,Bug:xy,Shuffle:i0,SearchCheck:Qx,ArrowUpDown:dy,Server:Px},cp={idle:"Circle",running:"Activity",done:"Check",error:"X",interrupted:"Pause",disconnected:"WifiOff",readonly:"History",warning:"TriangleAlert",critical:"OctagonAlert",caution:"TriangleAlert",resume:"RotateCw",orchestration:"Bot",add:"Plus",parent:"CornerLeftUp",back:"ArrowLeft",folder:"Folder",needsYou:"Bell",unlink:"Unlink",sun:"Sun",moon:"Moon",provider:"Server",search:"Search",sort:"ArrowUpDown",timeline:"Clock",transcript:"AlignLeft",crew:"Users",chevronDown:"ChevronDown",chevronRight:"ChevronRight",chevronLeft:"ChevronLeft",raw:"Braces",question:"MessageCircleQuestion",approval:"ShieldCheck",check:"Check",close:"X",budget:"Coins",template:"LayoutTemplate",draft:"Save",filter:"Filter",settings:"Settings",attach:"Paperclip",file:"File",image:"Image",code:"Code",codeBlock:"SquareCode",quote:"Quote",write:"PenLine",preview:"Eye",model:"Cpu",loading:"LoaderCircle",steer:"MessageSquarePlus",send:"SendHorizontal",you:"User",now:"Zap",nextTurn:"ListEnd",Write:"FilePen",Edit:"FilePenLine",MultiEdit:"FilePenLine",Read:"FileText",Bash:"Terminal",Grep:"Search",Glob:"FolderSearch",LS:"FolderOpen",WebFetch:"Globe",WebSearch:"Globe",Task:"ListChecks",TodoWrite:"ListChecks",spawn_worker:"UserPlus",message_worker:"MessageSquare",ask_human:"MessageCircleQuestion",result:"CornerDownLeft",init:"Power",tool:"Wrench",Bug:"Bug",Shuffle:"Shuffle",SearchCheck:"SearchCheck"};function ae({name:i,size:c=16,strokeWidth:u=1.75,color:o,label:d,style:f}){const m=cp[i]||i,y=op[m]||op[cp.tool];return a.jsx(y,{width:c,height:c,strokeWidth:u,color:o||"currentColor","aria-hidden":d?void 0:!0,"aria-label":d,role:d?"img":void 0,style:{flex:"0 0 auto",display:"block",...f}})}const up={idle:{color:"var(--ink-2)",icon:"idle",label:"idle"},running:{color:"var(--status-good)",icon:"running",label:"running"},done:{color:"var(--status-good)",icon:"done",label:"done"},error:{color:"var(--status-critical)",icon:"error",label:"error"},interrupted:{color:"var(--status-serious)",icon:"interrupted",label:"interrupted"},"needs-you":{color:"var(--status-warning)",icon:"needsYou",label:"needs you"}};function ja({status:i,style:c}){const u=up[i]??up.idle;return a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,fontSize:"var(--fs-sm)",color:"var(--ink-1)",padding:"2px 8px 2px 6px",borderRadius:"var(--r-pill)",background:"var(--bg-inset)",border:"1px solid var(--line)",whiteSpace:"nowrap",lineHeight:"16px",...c},children:[a.jsx(ae,{name:u.icon,size:12,strokeWidth:2.25,color:u.color}),u.label]})}function D0({value:i,onChange:c,groups:u=[],placeholder:o="Search projects and runs…",busy:d=!1,style:f}){const m=g.useRef(null),[y,x]=g.useState(!1),[p,b]=g.useState(0),j=i.trim().length>0,S=u.flatMap(w=>w.items),z=y&&j&&(S.length>0||!d);g.useEffect(()=>{const w=R=>{const H=document.activeElement,K=H&&(H.tagName==="INPUT"||H.tagName==="TEXTAREA"||H.isContentEditable),se=R.key==="/"&&!K&&!R.metaKey&&!R.ctrlKey&&!R.altKey,B=R.key.toLowerCase()==="k"&&(R.metaKey||R.ctrlKey)&&!R.altKey;(se||B)&&(R.preventDefault(),m.current?.focus(),m.current?.select())};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[]),g.useEffect(()=>{b(0)},[i,S.length]);const D=w=>{w.onPick?.(),c?.(""),m.current?.blur()},G=w=>{if(w.key==="Escape"){i?c?.(""):w.currentTarget.blur();return}!z||!S.length||(w.key==="ArrowDown"?(w.preventDefault(),b(R=>(R+1)%S.length)):w.key==="ArrowUp"?(w.preventDefault(),b(R=>(R-1+S.length)%S.length)):w.key==="Enter"&&(w.preventDefault(),D(S[p]??S[0])))};let T=-1;return a.jsxs("div",{style:{position:"relative",flex:"0 1 26rem",minWidth:"12rem",...f},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",background:"var(--bg-card)",borderRadius:"var(--r-sm)",border:`1px solid ${y?"var(--brand)":"var(--line)"}`,padding:"4px var(--sp-2)",transition:"border-color var(--dur-fast) var(--ease)"},children:[a.jsx(ae,{name:"search",size:14,color:"var(--ink-2)"}),a.jsx("input",{ref:m,value:i,type:"text",placeholder:o,"aria-label":"Search projects, runs and actions",role:"combobox","aria-expanded":z,onChange:w=>c?.(w.target.value),onFocus:()=>x(!0),onBlur:()=>setTimeout(()=>x(!1),120),onKeyDown:G,style:{flex:1,minWidth:0,border:"none",outline:"none",background:"transparent",color:"var(--ink-0)",font:"inherit",fontSize:"var(--fs-sm)",padding:0,boxShadow:"none"}}),j?a.jsx("button",{type:"button",onClick:()=>{c?.(""),m.current?.focus()},title:"Clear (Esc)","aria-label":"Clear search",style:{display:"inline-flex",background:"none",border:"none",padding:0,cursor:"pointer",color:"var(--ink-2)"},children:a.jsx(ae,{name:"close",size:13})}):a.jsx("kbd",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",border:"1px solid var(--line)",borderRadius:3,padding:"0 4px",lineHeight:"15px",whiteSpace:"nowrap"},children:"⌘K"})]}),z&&a.jsxs("div",{role:"listbox",style:{position:"absolute",top:"calc(100% + 6px)",left:0,width:"max(100%, 34rem)",maxWidth:"calc(100vw - 2rem)",maxHeight:"60vh",overflowY:"auto",zIndex:30,background:"var(--bg-panel)",border:"1px solid var(--line-strong)",borderRadius:"var(--r-md)",boxShadow:"0 12px 32px rgba(0,0,0,.35)",padding:"var(--sp-1) 0"},children:[S.length===0&&a.jsxs("div",{style:{padding:"var(--sp-2) var(--sp-3)",fontSize:"var(--fs-sm)",color:"var(--ink-2)"},children:["Nothing matches “",i.trim(),"”."]}),u.filter(w=>w.items.length).map(w=>a.jsxs("div",{children:[a.jsxs("div",{style:{padding:"6px var(--sp-3) 2px",fontSize:"var(--fs-xs)",color:"var(--ink-2)",letterSpacing:".06em",textTransform:"uppercase"},children:[w.label,w.count!==void 0?` · ${w.count}`:""]}),w.items.map(R=>{T+=1;const H=T,K=H===p;return a.jsxs("button",{type:"button",role:"option","aria-selected":K,onMouseDown:se=>se.preventDefault(),onMouseEnter:()=>b(H),onClick:()=>D(R),style:{display:"grid",gridTemplateColumns:"auto minmax(0, 1fr) auto",alignItems:"center",gap:"var(--sp-2)",width:"100%",textAlign:"left",padding:"6px var(--sp-3)",border:"none",font:"inherit",background:K?"var(--bg-hover)":"transparent",color:"var(--ink-0)",cursor:"pointer"},children:[a.jsx(ae,{name:R.icon??"folder",size:14,color:"var(--ink-2)"}),a.jsxs("span",{style:{minWidth:0,display:"flex",flexDirection:"column"},children:[a.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"var(--fs-sm)"},children:R.title}),R.detail&&a.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:R.detail})]}),a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"var(--sp-2)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums"},children:[R.status&&a.jsx(ja,{status:R.status}),R.meta]})]},R.id)})]},w.label))]})]})}const dp={"api-key":{color:"var(--status-warning)",icon:"budget",label:"API key billing",hint:"Missions bill a metered API key, not a Claude subscription. Usage is charged per token."},subscription:{color:"var(--ink-2)",icon:"budget",label:"subscription",hint:"Missions run on the signed-in Claude subscription."},cloud:{color:"var(--ink-2)",icon:"budget",label:"cloud provider",hint:"Missions bill a cloud provider (Bedrock/Vertex)."},local:{color:"var(--ink-2)",icon:"model",label:"local model",hint:"Missions run on a model served from this machine. No per-token cost, so budgets are capped by turns and time."},provider:{color:"var(--status-warning)",icon:"budget",label:"external provider",hint:"Missions bill an endpoint Foreman does not price. Spend is real but its dollar figure is not shown."},none:{color:"var(--status-critical)",icon:"error",label:"no credentials",hint:"No credentials found — missions cannot run."}};function Pp({mode:i,source:c,account:u,compact:o,style:d}){const f=dp[i]??dp.none,m=u?.email,y=f.label,x=[f.hint,m&&u.org?`Account: ${m} (${u.org})`:m&&`Account: ${m}`,c&&`Source: ${c}`].filter(Boolean).join(`
21
+ `),p=i==="api-key"||i==="none"||i==="provider";return a.jsxs("span",{title:x,style:{display:"inline-flex",alignItems:"center",gap:5,fontSize:o?"var(--fs-xs)":"var(--fs-sm)",color:"var(--ink-1)",padding:o?"1px 6px 1px 5px":"2px 8px 2px 6px",borderRadius:"var(--r-pill)",background:"var(--bg-inset)",border:`1px solid ${p?f.color:"var(--line)"}`,whiteSpace:"nowrap",lineHeight:"16px",...d},children:[a.jsx(ae,{name:f.icon,size:12,strokeWidth:2.25,color:f.color}),o?y:`billing: ${y}`]})}function Ui({children:i,title:c,onClick:u,tone:o}){const d=o==="warn"?"var(--status-warning)":o==="bad"?"var(--status-error)":"var(--ink-2)",f=a.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:6,color:d,whiteSpace:"nowrap",minWidth:0},children:i});return u?a.jsx("button",{type:"button",onClick:u,title:c,style:{background:"none",border:0,padding:"0 2px",margin:"0 -2px",font:"inherit",cursor:"pointer",display:"inline-flex",minWidth:0,borderRadius:3},children:f}):a.jsx("span",{title:c,style:{display:"inline-flex",minWidth:0},children:f})}const R0=({color:i})=>a.jsx("span",{"aria-hidden":!0,style:{width:7,height:7,borderRadius:"50%",background:i,flex:"0 0 auto"}}),cr=()=>a.jsx("span",{"aria-hidden":!0,style:{width:1,height:12,background:"var(--line)",margin:"0 var(--sp-2)",flex:"0 0 auto"}}),ur=i=>String(i??"").replace(/^https?:\/\//,"").replace(/\/+$/,"");function O0({connected:i,localUrl:c,publicUrl:u,phone:o,auth:d,version:f,update:m,onOpenSettings:y,style:x}){const p=typeof u=="string"&&u.startsWith("https://"),b=u&&ur(u)!==ur(c)?u:null;return a.jsxs("footer",{style:{display:"flex",alignItems:"center",gap:0,flex:"0 0 auto",minHeight:24,padding:"2px var(--sp-4)",background:"var(--bg-panel)",borderTop:"1px solid var(--line)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontVariantNumeric:"tabular-nums",overflow:"hidden",...x},children:[a.jsxs(Ui,{title:i?"Live: this tab follows the server’s event stream":"Disconnected: the tab lost the server’s event stream and is reconnecting",tone:i?void 0:"bad",children:[a.jsx(R0,{color:i?"var(--status-success)":"var(--status-error)"}),i?"connected":"disconnected"]}),a.jsx(cr,{}),a.jsxs(Ui,{title:`Serving on ${c}${b?` and, on your tailnet, ${b}${p?" (HTTPS via tailscale serve)":" (plain HTTP — foreman doctor shows the one command for HTTPS)"}`:""}`,children:[a.jsx("span",{style:{fontFamily:"var(--font-mono)",overflow:"hidden",textOverflow:"ellipsis"},children:ur(c)}),b&&a.jsxs(a.Fragment,{children:[a.jsx("span",{"aria-hidden":!0,children:"·"}),a.jsx(ae,{name:p?"approval":"provider",size:12,color:p?"var(--status-success)":"var(--ink-2)"}),a.jsx("span",{style:{fontFamily:"var(--font-mono)",overflow:"hidden",textOverflow:"ellipsis"},children:ur(b)})]})]}),o!==void 0&&a.jsxs(a.Fragment,{children:[a.jsx(cr,{}),a.jsxs(Ui,{onClick:()=>y?.("notifications"),title:o?`Telegram linked to ${o}. Approvals, questions and the front desk reach that chat. Click for Notifications.`:"No phone linked. Settings → Notifications links a Telegram chat: approvals, questions and the front desk on the move.",children:[a.jsx(ae,{name:"needsYou",size:12}),o?`phone ${o}`:"no phone linked"]})]}),a.jsxs("span",{style:{marginLeft:"auto",display:"inline-flex",alignItems:"center",minWidth:0},children:[d&&a.jsxs(a.Fragment,{children:[a.jsx(Ui,{onClick:()=>y?.("provider"),title:"Who pays for missions by default. Click for Provider.",children:a.jsx(Pp,{mode:d.mode,source:d.source,account:d.account,compact:!0})}),a.jsx(cr,{})]}),m&&a.jsxs(a.Fragment,{children:[a.jsxs(Ui,{tone:"warn",title:`You run ${m.current}; ${m.latest} is on npm. In a terminal: foreman update — it refuses while a mission is live.`,children:[m.latest," available · ",a.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:"foreman update"})]}),a.jsx(cr,{})]}),f&&a.jsxs("a",{href:"https://github.com/amenophis1er/foreman/releases",target:"_blank",rel:"noopener noreferrer",title:`Foreman ${f} — release notes`,style:{fontFamily:"var(--font-mono)",color:"var(--ink-2)",textDecoration:"none",whiteSpace:"nowrap"},children:["v",f]})]})]})}const N0=/\.(png|jpe?g|gif|webp|svg|heic)$/i,U0=/\.(js|jsx|ts|tsx|py|rb|go|rs|java|kt|swift|c|cc|cpp|h|css|html|json|ya?ml|toml|sh|sql|md)$/i;function H0(i){return i==null?"":i<1024?`${i} B`:i<1024*1024?`${(i/1024).toFixed(i<10240?1:0)} KB`:`${(i/1048576).toFixed(1)} MB`}function ev({name:i,size:c,onRemove:u,style:o}){const[d,f]=g.useState(!1),m=N0.test(i)?"image":U0.test(i)?"code":"file";return a.jsxs("span",{onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),style:{display:"inline-flex",alignItems:"center",gap:6,maxWidth:260,height:24,padding:"0 4px 0 8px",background:"var(--bg-inset)",border:`1px solid ${d?"var(--line-strong)":"var(--line)"}`,borderRadius:"var(--r-sm)",fontSize:"var(--fs-sm)",color:"var(--ink-0)",...o},children:[a.jsx(ae,{name:m,size:13,color:"var(--ink-2)"}),a.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i}),c!=null&&a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",whiteSpace:"nowrap"},children:H0(c)}),u&&a.jsx("button",{type:"button",onClick:u,"aria-label":`Remove ${i}`,style:{display:"inline-flex",width:18,height:18,alignItems:"center",justifyContent:"center",background:"none",border:"none",borderRadius:3,padding:0,cursor:"pointer",color:"var(--ink-2)"},children:a.jsx(ae,{name:"close",size:12})})]})}const B0={default:{background:"var(--bg-card)",border:"1px solid var(--line-strong)",color:"var(--ink-0)"},primary:{background:"var(--brand)",border:"1px solid var(--brand)",color:"var(--brand-ink)",fontWeight:"var(--fw-semibold)"},good:{background:"transparent",border:"1px solid var(--status-good)",color:"var(--ink-0)"},danger:{background:"transparent",border:"1px solid var(--status-critical)",color:"var(--ink-0)"},ghost:{background:"none",border:"1px solid transparent",color:"var(--ink-1)"}},$0={default:{borderColor:"var(--ink-2)"},primary:{filter:"brightness(1.08)"},good:{background:"color-mix(in srgb, var(--status-good) 14%, transparent)"},danger:{background:"color-mix(in srgb, var(--status-critical) 14%, transparent)"},ghost:{color:"var(--ink-0)",background:"var(--bg-hover)"}},q0={default:{background:"var(--bg-inset)"},primary:{filter:"brightness(0.94)"},good:{background:"color-mix(in srgb, var(--status-good) 22%, transparent)"},danger:{background:"color-mix(in srgb, var(--status-critical) 22%, transparent)"},ghost:{background:"var(--bg-inset)"}},fp={sm:{padding:"3px 8px",fontSize:"var(--fs-sm)",gap:5,icon:13},md:{padding:"6px 12px",fontSize:"var(--fs-md)",gap:6,icon:15}};function te({children:i,onClick:c,variant:u="default",size:o="md",icon:d,disabled:f,title:m,type:y="button",style:x}){const[p,b]=g.useState(!1),[j,S]=g.useState(!1),z=fp[o]||fp.md;return a.jsxs("button",{type:y,title:m,disabled:f,onClick:c,onMouseEnter:()=>b(!0),onMouseLeave:()=>{b(!1),S(!1)},onMouseDown:()=>S(!0),onMouseUp:()=>S(!1),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:z.gap,padding:z.padding,borderRadius:"var(--r-sm)",fontSize:z.fontSize,lineHeight:"var(--lh)",whiteSpace:"nowrap",cursor:f?"default":"pointer",transition:"background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), filter var(--dur-fast) var(--ease)",...B0[u],...f?{opacity:.5}:p?$0[u]:null,...!f&&j?q0[u]:null,...x},children:[d&&a.jsx(ae,{name:d,size:z.icon}),i]})}const Lc=i=>`${i.name}:${i.size}`,cu=22,hp=cu*3,pp=cu*10;function au({value:i,onChange:c,onSend:u,onStop:o,busy:d,disabled:f,disabledReason:m,placeholder:y,who:x,onChangeModel:p,autoFocus:b,style:j,hint:S,busyHint:z,attach:D=!0}){const[G,T]=g.useState(""),[w,R]=g.useState(!1),[H,K]=g.useState([]),[se,B]=g.useState(!1),q=g.useRef(null),I=g.useRef(null),W=re=>{if(!D)return;const xe=Array.from(re||[]);xe.length&&K(_=>{const O=new Set(_.map(Lc));return[..._,...xe.filter(ee=>!O.has(Lc(ee)))]})},ue=i??G,ne=c??T,de=!f&&!d&&(ue.trim().length>0||H.length>0);g.useEffect(()=>{const re=q.current;re&&(re.style.height="auto",re.style.height=Math.max(hp,Math.min(re.scrollHeight,pp))+"px")},[ue]);const je=()=>{de&&(u?.(ue.trim()||(H.length?"See the attached files.":""),H),ne(""),K([]))};return a.jsxs("div",{style:{flex:"0 0 auto",background:se?"var(--brand-wash)":"var(--bg-card)",border:`1px solid ${w||se?"var(--brand)":"var(--line-strong)"}`,borderRadius:"var(--r-md)",padding:"var(--sp-2) var(--sp-3)",display:"flex",flexDirection:"column",gap:"var(--sp-2)",opacity:f?.6:1,transition:"border-color var(--dur-fast) var(--ease)",...j},onDragOver:re=>{f||(re.preventDefault(),B(!0))},onDragLeave:re=>{re.target===re.currentTarget&&B(!1)},onDrop:re=>{re.preventDefault(),B(!1),f||W(re.dataTransfer.files)},children:[a.jsxs("div",{style:{display:"flex",gap:"var(--sp-2)",alignItems:"flex-start"},children:[a.jsx("span",{className:d?"pulse":void 0,style:{marginTop:3,flex:"0 0 auto",display:"inline-flex"},children:a.jsx(ae,{name:d?"loading":"steer",size:15,color:"var(--brand)"})}),a.jsx("textarea",{ref:q,rows:3,value:ue,disabled:f,autoFocus:b,placeholder:f?m||"Not available right now.":y||"Ask, think out loud, or describe what you want built…",onChange:re=>ne(re.target.value),onPaste:re=>{re.clipboardData?.files?.length&&(re.preventDefault(),W(re.clipboardData.files))},onFocus:()=>R(!0),onBlur:()=>R(!1),onKeyDown:re=>{(re.metaKey||re.ctrlKey)&&re.key==="Enter"&&(re.preventDefault(),je())},style:{flex:1,minWidth:0,resize:"none",border:"none",outline:"none",boxShadow:"none",background:"transparent",borderRadius:"var(--r-sm)",color:"var(--ink-0)",font:"inherit",lineHeight:`${cu}px`,padding:"2px 0",minHeight:hp,maxHeight:pp}})]}),H.length>0&&a.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:H.map((re,xe)=>a.jsx(ev,{name:re.name,size:re.size,onRemove:()=>K(_=>_.filter((O,ee)=>ee!==xe))},Lc(re)))}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)"},children:[a.jsxs("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:x?`${x.model} via ${x.provider}`:void 0,children:[x&&a.jsxs("span",{style:{fontFamily:"var(--font-mono)",color:"var(--ink-1)"},role:p?"button":void 0,onClick:p,title:p?"Change the planner model in Settings → Models":void 0,...p?{style:{fontFamily:"var(--font-mono)",color:"var(--ink-1)",cursor:"pointer",textDecoration:"underline dotted",textUnderlineOffset:3}}:{},children:[x.model," · ",x.provider.split(" · ")[0],x.costBasis==="free"?" · free":x.costBasis==="unpriced"?" · unpriced":""," — "]}),d?z??"The foreman is looking…":S??"Reads the project, never changes it."]}),a.jsx("span",{style:{marginLeft:"auto"}}),D&&a.jsx("input",{ref:I,type:"file",multiple:!0,style:{display:"none"},onChange:re=>{W(re.target.files),re.target.value=""}}),D&&a.jsx(te,{size:"sm",variant:"ghost",icon:"attach",disabled:f,title:"Attach files — or drop them here, or paste an image",onClick:()=>I.current?.click(),children:"Attach"}),d&&o?a.jsx(te,{size:"sm",variant:"danger",icon:"close",onClick:o,title:"Stop the planner and discard the rest of this reply",children:"Stop"}):a.jsx(te,{size:"sm",icon:"send",onClick:je,disabled:!de,title:"⌘↵",children:"Send"})]})]})}function xr({children:i,accent:c,tone:u="card",style:o,onClick:d,title:f}){const m=u==="panel"?"var(--bg-panel)":u==="inset"?"var(--bg-inset)":"var(--bg-card)";return a.jsx("div",{onClick:d,title:f,role:d?"button":void 0,style:{background:m,border:"1px solid var(--line)",borderLeft:c?`var(--accent-w) solid ${c}`:"1px solid var(--line)",borderRadius:"var(--r-sm)",padding:"var(--sp-3)",cursor:d?"pointer":void 0,...o},children:i})}function gr(i){if(i==="director")return"var(--brand)";if(i==="you")return"var(--ink-0)";const c=/(\d+)/.exec(String(i||""));return`var(--agent-worker-${c?(parseInt(c[1],10)-1)%6+1:1})`}function vn({agent:i,size:c="md",style:u}){const o=c==="sm"?"var(--dot-sm)":"var(--dot)";return a.jsx("span",{"aria-hidden":!0,style:{width:o,height:o,borderRadius:"var(--r-pill)",background:gr(i),flex:"0 0 auto",...u}})}function tv(i){if(i==null)return null;if(typeof i=="object")return i;try{return JSON.parse(i)}catch{return null}}function vp(i){if(!i)return"";const c=String(i).split("/");return c.length>3?"…/"+c.slice(-3).join("/"):i}function nv(i,c){if(!c)return"";switch(i){case"Write":case"Edit":case"MultiEdit":case"Read":return vp(c.file_path||c.path);case"Bash":return c.command||"";case"Grep":return`${c.pattern??""}${c.path?" in "+vp(c.path):""}`;case"Glob":return c.pattern||"";case"WebFetch":case"WebSearch":return c.url||c.query||"";case"spawn_worker":return`${c.id??"worker"} — ${(c.task||"").slice(0,80)}`;case"message_worker":return`${c.id??"worker"} — ${(c.message||"").slice(0,80)}`;case"ask_human":return c.question||"";default:{const u=Object.keys(c)[0];return u?`${u}: ${String(c[u]).slice(0,80)}`:""}}}function Yc({text:i,tone:c,max:u=12}){const o=String(i??"").split(`
22
+ `),d=o.slice(0,u),f=c==="add"?"var(--diff-add-bg)":c==="del"?"var(--diff-del-bg)":"transparent",m=c==="add"?"+":c==="del"?"−":" ";return a.jsxs("div",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",lineHeight:1.5},children:[d.map((y,x)=>a.jsxs("div",{style:{display:"flex",background:f,padding:"0 8px"},children:[a.jsx("span",{style:{width:14,flex:"0 0 auto",color:c==="add"?"var(--status-good)":c==="del"?"var(--status-critical)":"var(--ink-2)"},children:m}),a.jsx("span",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word",color:"var(--ink-0)"},children:y})]},x)),o.length>u&&a.jsxs("div",{style:{padding:"2px 8px",color:"var(--ink-2)"},children:["… ",o.length-u," more lines"]})]})}function L0({tool:i,input:c}){if(!c)return null;if(i==="Write")return a.jsx(Yc,{text:c.content,tone:"add"});const u=i==="MultiEdit"?c.edits||[]:[c];return a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:u.map((o,d)=>a.jsxs("div",{children:[a.jsx(Yc,{text:o.old_string,tone:"del",max:8}),a.jsx(Yc,{text:o.new_string,tone:"add",max:8})]},d))})}const Y0=new Set(["spawn_worker","message_worker","ask_human"]);function av({tool:i="tool",input:c,body:u,defaultOpen:o=!1,style:d}){const f=c??tv(u),[m,y]=g.useState(o),[x,p]=g.useState(!1),b=Y0.has(i),j=f&&(i==="Write"||i==="Edit"||i==="MultiEdit"),S=nv(i,f)||(typeof u=="string"?u.slice(0,120):"");return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,...d},children:[a.jsxs("button",{type:"button",onClick:()=>y(!m),title:m?"Collapse":"Expand",style:{display:"flex",alignItems:"center",gap:8,padding:0,background:"none",border:"none",cursor:"pointer",color:"var(--ink-0)",textAlign:"left",width:"100%",font:"inherit"},children:[a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,padding:"2px 8px 2px 6px",borderRadius:"var(--r-pill)",background:b?"var(--brand-wash-strong)":"var(--bg-inset)",border:`1px solid ${b?"var(--brand)":"var(--line)"}`,color:b?"var(--brand)":"var(--ink-1)",fontSize:"var(--fs-xs)",fontWeight:"var(--fw-semibold)",fontFamily:"var(--font-mono)",whiteSpace:"nowrap",lineHeight:"16px"},children:[a.jsx(ae,{name:i,size:12,strokeWidth:2}),i]}),a.jsx("span",{style:{flex:1,minWidth:0,fontFamily:"var(--font-mono)",fontSize:"var(--fs-sm)",color:"var(--ink-1)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:S}),a.jsx(ae,{name:m?"chevronDown":"chevronRight",size:14,color:"var(--ink-2)"})]}),m&&a.jsxs("div",{style:{background:"var(--bg-inset)",border:"1px solid var(--line)",borderRadius:"var(--r-sm)",overflow:"hidden"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"4px 8px",borderBottom:"1px solid var(--line)",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:[a.jsx("span",{children:j&&!x?"changes":"payload"}),a.jsx("span",{style:{flex:1}}),j&&a.jsxs("button",{type:"button",onClick:()=>p(!x),style:{display:"inline-flex",alignItems:"center",gap:4,background:"none",border:"none",color:"var(--ink-2)",cursor:"pointer",font:"inherit",padding:0},children:[a.jsx(ae,{name:"raw",size:12}),x?"diff":"raw"]})]}),a.jsx("div",{style:{padding:"6px 0",maxHeight:260,overflow:"auto"},children:j&&!x?a.jsx(L0,{tool:i,input:f}):a.jsx("pre",{style:{margin:0,padding:"0 8px",fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",whiteSpace:"pre-wrap",wordBreak:"break-word",color:"var(--ink-0)"},children:f?JSON.stringify(f,null,2):String(u??"")})})]})]})}const G0=/(`[^`\n]+`|\*\*[^*\n]+\*\*|<[^<>\n]{1,80}>)/g;function dr(i,c){return i.split(G0).filter(Boolean).map((u,o)=>u.startsWith("`")&&u.endsWith("`")&&u.length>2?a.jsx("code",{style:{fontFamily:"var(--font-mono)",fontSize:"0.92em",background:"var(--bg-inset)",border:"1px solid var(--line)",borderRadius:4,padding:"0 5px"},children:u.slice(1,-1)},o):u.startsWith("**")&&u.endsWith("**")&&u.length>4?a.jsx("strong",{style:{fontWeight:"var(--fw-semibold)",color:"var(--ink-0)"},children:u.slice(2,-2)},o):c&&u.startsWith("<")&&u.endsWith(">")?a.jsx("span",{style:{background:"var(--brand-wash-strong)",border:"1px dashed var(--brand)",borderRadius:4,padding:"0 5px",color:"var(--ink-0)"},children:u.slice(1,-1)},o):u)}function W0(i){const c=String(i||"").replace(/\r\n?/g,`
23
+ `).split(`
24
+ `),u=[];let o=0;for(;o<c.length;){const d=c[o];if(/^```/.test(d)){const y=d.slice(3).trim(),x=[];for(o++;o<c.length&&!/^```/.test(c[o]);)x.push(c[o++]);o++,u.push({t:"code",lang:y,body:x.join(`
25
+ `)});continue}if(/^>\s?/.test(d)){const y=[];for(;o<c.length&&/^>\s?/.test(c[o]);)y.push(c[o++].replace(/^>\s?/,""));u.push({t:"quote",body:y});continue}if(/^\s*[-*]\s+/.test(d)){const y=[];for(;o<c.length&&/^\s*[-*]\s+/.test(c[o]);)y.push(c[o++].replace(/^\s*[-*]\s+/,""));u.push({t:"list",items:y});continue}const f=/^(#{1,3})\s+(.*)$/.exec(d);if(f){u.push({t:"h",level:f[1].length,body:f[2]}),o++;continue}if(!d.trim()){o++;continue}const m=[];for(;o<c.length&&c[o].trim()&&!/^(```|>|\s*[-*]\s|#{1,3}\s)/.test(c[o]);)m.push(c[o++]);u.push({t:"p",body:m})}return u}function Nl({text:i,slots:c=!0,style:u}){const o=W0(i);return a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10,lineHeight:"var(--lh-prose)",color:"var(--ink-prose, var(--ink-0))",...u},children:o.map((d,f)=>d.t==="code"?a.jsxs("pre",{style:{margin:0,padding:"var(--sp-2) var(--sp-3)",background:"var(--bg-inset)",border:"1px solid var(--line)",borderRadius:"var(--r-sm)",fontFamily:"var(--font-mono)",fontSize:"var(--fs-sm)",lineHeight:"var(--lh)",overflowX:"auto",whiteSpace:"pre",position:"relative"},children:[d.lang&&a.jsx("span",{style:{position:"absolute",top:4,right:8,fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:d.lang}),d.body]},f):d.t==="quote"?a.jsx("blockquote",{style:{margin:0,padding:"2px 0 2px 12px",borderLeft:"2px solid var(--agent-worker)",color:"var(--ink-1)"},children:d.body.map((m,y)=>a.jsx("div",{children:dr(m,c)},y))},f):d.t==="list"?a.jsx("ul",{style:{margin:0,paddingLeft:20},children:d.items.map((m,y)=>a.jsx("li",{children:dr(m,c)},y))},f):d.t==="h"?a.jsx("div",{style:{fontWeight:"var(--fw-semibold)",fontSize:d.level===1?"var(--fs-lg)":"var(--fs-md)",color:"var(--ink-0)",marginTop:f?4:0},children:dr(d.body,c)},f):a.jsx("p",{style:{margin:0},children:d.body.map((m,y)=>a.jsxs(wn.Fragment,{children:[y>0&&a.jsx("br",{}),dr(m,c)]},y))},f))})}const lv=new Set(["spawn_worker","message_worker","ask_human"]);function uu({agent:i,title:c,kind:u="text",body:o,ts:d,to:f,timing:m,review:y,costBasis:x,dense:p=!1,style:b}){const j=u==="tool";if(j&&p)return a.jsx(F0,{agent:i,title:c,body:o,ts:d,style:b});if(u==="review"&&y)return a.jsx(V0,{agent:i,review:y,ts:d,costBasis:x,style:b});if(u==="system"&&!o&&typeof c=="string"&&c.startsWith("result ·"))return a.jsx(Z0,{agent:i,title:c,ts:d,style:b});const S=u==="steer",z=u==="result",D=u==="error"?"var(--status-critical)":S?"var(--ink-0)":u==="text"?gr(i):void 0,G=d?new Date(d).toLocaleTimeString(void 0,{hour12:!1}):null,T=j?String(c||"tool").replace(/^[^\w]+/,""):null,w=j?null:c;return a.jsxs(xr,{accent:D,style:{padding:"var(--sp-2) var(--sp-3)",...z?{fontFamily:"var(--font-mono)",fontSize:"var(--fs-sm)"}:null,...u==="system"?{color:"var(--ink-1)",fontSize:"var(--fs-sm)"}:null,...b},children:[a.jsxs("div",{style:{fontSize:"var(--fs-xs)",color:u==="error"?"var(--status-critical)":"var(--ink-2)",marginBottom:4,display:"flex",alignItems:"center",gap:6,fontFamily:"var(--font-ui)"},children:[a.jsx(vn,{agent:i,size:"sm"}),a.jsx("span",{children:i}),S&&f&&a.jsxs(a.Fragment,{children:[a.jsx(ae,{name:"chevronRight",size:11}),a.jsx(vn,{agent:f,size:"sm"}),a.jsx("span",{children:f})]}),S&&m&&a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"·"}),a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[a.jsx(ae,{name:m==="now"?"now":"nextTurn",size:11}),m==="now"?"now":"next turn"]})]}),w&&w!==i&&a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"·"}),a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[u==="error"&&a.jsx(ae,{name:"error",size:11,strokeWidth:2.25}),w]})]}),j&&lv.has(T)&&a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"·"}),a.jsx("span",{style:{color:"var(--brand)"},children:"orchestration"})]}),G&&a.jsx("span",{style:{marginLeft:"auto",fontVariantNumeric:"tabular-nums"},children:G})]}),j?a.jsx(av,{tool:T,body:o}):u==="text"&&typeof o=="string"?a.jsx(Nl,{text:o}):a.jsx(iv,{body:o})]})}function V0({agent:i,review:c,ts:u,costBasis:o,style:d}){const f=!!c.pass,m=f?"var(--status-good)":"var(--status-serious)",y=u?new Date(u).toLocaleTimeString(void 0,{hour12:!1}):null,x=o==="priced"&&typeof c.costUsd=="number"?`$${c.costUsd.toFixed(2)}`:null;return a.jsxs(xr,{accent:m,style:{padding:"var(--sp-2) var(--sp-3)",...d},children:[a.jsxs("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",marginBottom:6,display:"flex",alignItems:"center",gap:6,flexWrap:"wrap",fontFamily:"var(--font-ui)"},children:[a.jsx(vn,{agent:i,size:"sm"}),a.jsx("span",{children:i}),a.jsx("span",{children:"·"}),a.jsx("span",{style:{color:"var(--ink-1)"},children:c.name}),c.model&&a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"·"}),a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,fontFamily:"var(--font-mono)"},children:[a.jsx(ae,{name:"model",size:11}),c.model]})]}),x&&a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"·"}),a.jsx("span",{style:{fontVariantNumeric:"tabular-nums"},children:x})]}),a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,marginLeft:4,padding:"1px 8px 1px 6px",borderRadius:"var(--r-pill)",background:"var(--bg-inset)",border:"1px solid var(--line)",color:"var(--ink-1)",letterSpacing:"0.04em"},children:[a.jsx(ae,{name:f?"check":"caution",size:11,strokeWidth:2.25,color:m}),f?"PASS":"FAIL"]}),y&&a.jsx("span",{style:{marginLeft:"auto",fontVariantNumeric:"tabular-nums"},children:y})]}),c.findings?.trim()?a.jsx(iv,{body:c.findings,rich:!0}):a.jsx("div",{style:{fontSize:"var(--fs-sm)",color:"var(--ink-2)"},children:f?"Nothing to raise.":"No findings were given."})]})}const mp=12,X0=/^\s*[-*]\s+/,Q0=/^(```|>|\s*[-*]\s|#{1,3}\s)/;function K0(i){const c=String(i??"").replace(/\r\n?/g,`
26
+ `).split(`
27
+ `),u=[];let o=!1,d=!1;for(const f of c){if(/^```/.test(f)){o=!o,d=!1,u.push(f);continue}if(o){u.push(f);continue}if(X0.test(f)){d=!0,u.push(f);continue}if(d&&f.trim()&&!Q0.test(f)){u[u.length-1]=`${u[u.length-1]} ${f.trim()}`;continue}d=!1,u.push(f)}return u.join(`
28
+ `)}function iv({body:i,rich:c=!1}){const[u,o]=g.useState(!1),d=typeof i=="string"?i:null,f=d?d.split(`
29
+ `):[],m=d!==null&&(f.length>mp+4||d.length>1600),y=p=>c?a.jsx(Nl,{text:K0(p)}):a.jsx("div",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word"},children:p});if(!m)return c&&d!==null?y(d):a.jsx("div",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word"},children:i});const x=u?d:f.slice(0,mp).join(`
30
+ `).slice(0,1600);return a.jsxs("div",{children:[c?y(u?x:`${x}
31
+
32
+ …`):a.jsxs("div",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word"},children:[x,!u&&`
33
+ …`]}),a.jsx("button",{type:"button",onClick:()=>o(!u),style:{marginTop:4,padding:0,background:"none",border:"none",cursor:"pointer",font:"inherit",fontFamily:"var(--font-ui)",fontSize:"var(--fs-xs)",color:"var(--brand)"},children:u?"Show less":`Show all · ${f.length} lines`})]})}function Z0({agent:i,title:c,ts:u,style:o}){const d=u?new Date(u).toLocaleTimeString(void 0,{hour12:!1}):null;return a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px var(--sp-2)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",whiteSpace:"nowrap",overflow:"hidden",...o},children:[a.jsx(vn,{agent:i,size:"sm"}),a.jsx("span",{children:i}),a.jsx("span",{children:"·"}),a.jsx("span",{children:c.replace(/^result · /,"turn ended · ")}),d&&a.jsx("span",{style:{marginLeft:"auto",fontVariantNumeric:"tabular-nums"},children:d})]})}function F0({agent:i,title:c,body:u,ts:o,style:d}){const f=String(c||"tool").replace(/^[^\w]+/,""),m=nv(f,tv(u))||(typeof u=="string"?u:""),y=String(m).replace(/\s+/g," ").slice(0,90),x=o?new Date(o).toLocaleTimeString(void 0,{hour12:!1}):null;return a.jsxs("div",{title:typeof u=="string"?u.slice(0,2e3):void 0,style:{display:"flex",alignItems:"center",gap:6,padding:"1px var(--sp-2)",fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",whiteSpace:"nowrap",overflow:"hidden",minWidth:0,...d},children:[a.jsx(vn,{agent:i,size:"sm"}),a.jsx(ae,{name:f,size:12}),a.jsx("span",{style:{color:lv.has(f)?"var(--brand)":"var(--ink-1)",flex:"0 0 auto"},children:f}),a.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",minWidth:0},children:y}),x&&a.jsx("span",{style:{marginLeft:"auto",fontVariantNumeric:"tabular-nums",flex:"0 0 auto"},children:x})]})}function Sa({icon:i,label:c,onClick:u,active:o,size:d="md",disabled:f,style:m}){const[y,x]=g.useState(!1),p=d==="sm"?26:32;return a.jsx("button",{type:"button",title:c,"aria-label":c,"aria-pressed":o,disabled:f,onClick:u,onMouseEnter:()=>x(!0),onMouseLeave:()=>x(!1),style:{width:p,height:p,display:"inline-flex",alignItems:"center",justifyContent:"center",padding:0,borderRadius:"var(--r-sm)",cursor:f?"default":"pointer",background:o?"var(--bg-card)":y?"var(--bg-hover)":"transparent",border:`1px solid ${o?"var(--line-strong)":"transparent"}`,color:o||y?"var(--ink-0)":"var(--ink-1)",opacity:f?.5:1,transition:"background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease)",...m},children:a.jsx(ae,{name:i,size:d==="sm"?14:16})})}function br(i){if(!i)return"";let c=String(i).replace(/^\/(Users|home)\/[^/]+/,"~");const u=c.split("/");return u.length>4&&(c=[u[0],u[1],"…",...u.slice(-2)].join("/")),c}function sv({size:i=24,mono:c,style:u}){const o=c?"currentColor":"var(--brand)",d=c?"currentColor":"var(--agent-worker)";return a.jsxs("svg",{viewBox:"0 0 32 32",width:i,height:i,"aria-hidden":!0,style:{flex:"0 0 auto",display:"block",...u},children:[a.jsx("rect",{x:"5",y:"4",width:"6",height:"24",rx:"3",fill:o}),a.jsx("rect",{x:"5",y:"4",width:"22",height:"6",rx:"3",fill:o}),a.jsx("rect",{x:"5",y:"13",width:"15",height:"6",rx:"3",fill:d,opacity:c?.55:1})]})}function J0({size:i=22,tagline:c,mono:u,style:o}){return a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:Math.round(i*.4),...o},children:[a.jsx(sv,{size:i,mono:u}),a.jsx("span",{style:{fontSize:Math.round(i*.82),fontWeight:"var(--fw-semibold)",letterSpacing:"-0.01em",color:u?"currentColor":"var(--ink-0)",lineHeight:1},children:"Foreman"}),c&&a.jsx("span",{style:{color:"var(--ink-2)",fontSize:"var(--fs-sm)",marginLeft:4},children:c})]})}function I0({folder:i}){const[c,u]=wn.useState(!1),[o,d]=wn.useState(!1),f=()=>{navigator.clipboard&&navigator.clipboard.writeText(i).catch(()=>{}),u(!0),setTimeout(()=>u(!1),1200)};return a.jsxs("button",{type:"button",onClick:f,title:c?"Copied":i,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{display:"inline-flex",alignItems:"center",gap:6,minWidth:0,maxWidth:420,padding:"3px 8px",borderRadius:999,border:"1px solid transparent",background:o?"var(--bg-inset, rgba(255,255,255,.06))":"transparent",color:c?"var(--ink-1)":"var(--ink-2)",cursor:"pointer",font:"inherit"},children:[a.jsx(ae,{name:"folder",size:13}),a.jsx("span",{style:{fontSize:"var(--fs-xs)",fontFamily:"var(--font-mono)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c?"copied":br(i)})]})}function rv({mode:i="fleet",title:c,subtitle:u="mission control",folder:o,branch:d,onBack:f,theme:m,onToggleTheme:y,onSettings:x,version:p,search:b,children:j,style:S}){const z=i==="fleet";return a.jsxs("header",{style:{display:"flex",alignItems:"center",gap:"var(--sp-3)",padding:z?"var(--sp-3) var(--sp-5)":"var(--sp-2) var(--sp-3)",background:"var(--bg-panel)",borderBottom:"1px solid var(--line)",flex:"0 0 auto",minHeight:48,...S},children:[z?a.jsx(J0,{size:22,tagline:u}):a.jsxs("nav",{"aria-label":"Breadcrumb",style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",minWidth:0},children:[a.jsx("button",{type:"button",onClick:f,title:"Back to the fleet","aria-label":"Back to the fleet",style:{background:"none",border:0,padding:0,cursor:"pointer",display:"inline-flex",alignItems:"center"},children:a.jsx(sv,{size:22})}),a.jsx("button",{type:"button",onClick:f,style:{background:"none",border:0,padding:0,font:"inherit",color:"var(--ink-2)",cursor:"pointer"},children:"Fleet"}),a.jsx(ae,{name:"chevronRight",size:14,color:"var(--ink-3, var(--ink-2))"}),a.jsx("span",{style:{fontWeight:"var(--fw-semibold)",whiteSpace:"nowrap"},children:c}),o&&a.jsx(I0,{folder:o}),d&&a.jsxs("span",{title:d.hint??`On branch ${d.name}${d.dirty?" · uncommitted changes":""}`,style:{display:"inline-flex",alignItems:"center",gap:5,padding:"2px 8px",borderRadius:999,border:"1px solid var(--line)",fontSize:"var(--fs-xs)",fontFamily:"var(--font-mono)",color:"var(--ink-1)",whiteSpace:"nowrap",maxWidth:260},children:[a.jsx("span",{"aria-hidden":!0,style:{color:"var(--ink-2)"},children:"⎇"}),a.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis"},children:d.name}),d.dirty&&a.jsx("span",{"aria-label":"uncommitted changes",style:{width:6,height:6,borderRadius:"50%",background:"var(--status-warning)",flex:"0 0 auto"}})]})]}),b&&a.jsx("div",{style:{flex:"1 1 auto",display:"flex",justifyContent:"center",minWidth:0,padding:"0 var(--sp-3)"},children:b}),a.jsxs("div",{style:{marginLeft:b?0:"auto",display:"flex",alignItems:"center",gap:"var(--sp-3)",flexWrap:"wrap",justifyContent:"flex-end"},children:[j,y&&a.jsx(Sa,{icon:m==="light"?"moon":"sun",label:m==="light"?"Switch to dark theme":"Switch to light theme",onClick:y}),x&&a.jsx(Sa,{icon:"settings",label:"Settings",onClick:x}),p&&a.jsxs("a",{href:"https://github.com/amenophis1er/foreman/releases",target:"_blank",rel:"noopener noreferrer",title:`Foreman ${p} — release notes`,style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",textDecoration:"none",whiteSpace:"nowrap"},children:["v",p]})]})]})}function Ve({children:i}){return a.jsx("div",{style:{color:"var(--ink-2)",fontSize:"var(--fs-sm)"},children:i})}function kn({children:i,style:c}){return a.jsx("h2",{style:{margin:"0 0 var(--sp-2)",fontSize:"var(--fs-xs)",fontWeight:"var(--fw-semibold)",textTransform:"uppercase",letterSpacing:"var(--ls-caps)",color:"var(--ink-2)",...c},children:i})}const gp={readonly:{icon:"readonly",color:"var(--status-warning)"},disconnected:{icon:"disconnected",color:"var(--status-serious)"},error:{icon:"error",color:"var(--status-critical)"},caution:{icon:"caution",color:"var(--status-serious)"}};function Je({tone:i="readonly",children:c,inline:u,style:o}){const d=gp[i]??gp.readonly;return u?a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,color:d.color,fontSize:"var(--fs-sm)",...o},children:[a.jsx(ae,{name:d.icon,size:13,strokeWidth:2}),c]}):a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"var(--sp-1) var(--sp-3)",background:"var(--bg-inset)",borderBottom:"1px solid var(--line)",fontSize:"var(--fs-sm)",color:"var(--ink-1)",...o},children:[a.jsx(ae,{name:d.icon,size:14,color:d.color}),c]})}function ov(i,c=Date.now()){const u=Math.max(0,Math.round((c-i)/1e3));if(u<60)return`${u}s`;const o=Math.floor(u/60);if(o<60)return`${o}m`;const d=Math.floor(o/60);return d<24?o%60?`${d}h ${o%60}m`:`${d}h`:`${Math.floor(d/24)}d`}const P0={permission:"approval",question:"director asks",planner:"the planner is asking",summary:"needs you"};function yp(i,c){return`${i} ${c}${i>1?"s":""}`}function e1({item:i,onPermission:c,onAnswer:u,onPlanner:o,onOpen:d}){const[f,m]=g.useState(!1),[y,x]=g.useState(""),[p,b]=g.useState(!1),[j,S]=g.useState("");g.useEffect(()=>{m(!1),x(""),b(!1),S("")},[i.id]);const z=async H=>{if(!f){m(!0),x("");try{const K=await H();K&&(x(K),m(!1))}catch(K){x(K instanceof Error?K.message:String(K)),m(!1)}}},D=H=>i.kind==="planner"?z(()=>o(i,H)):z(()=>u(i,H)),G=()=>{const H=j.trim();H&&D(H)},T=Array.isArray(i.options)&&i.options.length>0,w=i.kind==="question"||i.kind==="planner",R=w&&(p||!T);return a.jsxs("div",{className:f?void 0:"pulse",style:{display:"flex",flexDirection:"column",gap:"var(--sp-2)",padding:"var(--sp-3) var(--sp-4)",background:"var(--brand-wash-strong)",border:"1px solid var(--status-warning)",borderLeft:"var(--accent-w) solid var(--status-warning)",borderRadius:"var(--r-md)",opacity:f?.7:1,transition:"opacity var(--dur-fast) var(--ease)"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--sp-2)",minWidth:0,fontSize:"var(--fs-sm)"},children:[a.jsx(ae,{name:i.kind==="permission"?"approval":i.kind==="summary"?"needsYou":"question",size:14,strokeWidth:2,color:"var(--status-warning)",style:{alignSelf:"center",flex:"0 0 auto"}}),a.jsx("span",{style:{fontWeight:"var(--fw-semibold)",color:"var(--ink-0)",flex:"0 0 auto"},children:i.projectName}),a.jsx("span",{style:{color:"var(--status-warning)",fontWeight:"var(--fw-medium)",flex:"0 0 auto"},children:P0[i.kind]??i.kind}),a.jsx("span",{title:i.text,style:{color:"var(--ink-0)",minWidth:0,flex:"1 1 auto",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i.text}),typeof i.since=="number"&&a.jsxs("span",{style:{color:"var(--ink-2)",fontSize:"var(--fs-xs)",fontVariantNumeric:"tabular-nums",flex:"0 0 auto"},children:["waiting ",ov(i.since)]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[i.kind==="permission"&&a.jsxs(a.Fragment,{children:[a.jsx(te,{size:"sm",variant:"good",disabled:f,onClick:()=>{z(()=>c(i,"allow"))},children:"Allow"}),a.jsx(te,{size:"sm",variant:"danger",disabled:f,onClick:()=>{z(()=>c(i,"deny"))},children:"Deny"})]}),w&&T&&i.options.map((H,K)=>a.jsxs("button",{type:"button",disabled:f,onClick:()=>{D(H)},title:K===0?"Recommended":void 0,style:{display:"inline-flex",alignItems:"center",gap:5,padding:"4px 10px",borderRadius:"var(--r-sm)",cursor:f?"default":"pointer",font:"inherit",fontSize:"var(--fs-sm)",textAlign:"left",maxWidth:360,background:"var(--bg-card)",border:"1px solid var(--line-strong)",color:"var(--ink-0)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[K===0&&a.jsx("span",{style:{color:"var(--status-warning)",fontSize:"var(--fs-xs)"},children:"★"}),H]},H)),w&&T&&!p&&a.jsx(te,{size:"sm",variant:"ghost",disabled:f,onClick:()=>b(!0),children:"type…"}),R&&a.jsxs("form",{onSubmit:H=>{H.preventDefault(),G()},style:{display:"flex",alignItems:"center",gap:6,flex:"1 1 16rem",minWidth:0},children:[a.jsx("input",{autoFocus:p,value:j,disabled:f,placeholder:i.kind==="planner"?"Answer the planner…":"Answer the director…",onChange:H=>S(H.target.value),onKeyDown:H=>{H.key==="Escape"&&T&&(b(!1),S(""))},style:{flex:"1 1 auto",minWidth:0,font:"inherit",fontSize:"var(--fs-sm)",padding:"4px 8px",borderRadius:"var(--r-sm)",background:"var(--bg-card)",border:"1px solid var(--line-strong)",color:"var(--ink-0)",outline:"none"}}),a.jsx(te,{size:"sm",type:"submit",icon:"send",disabled:f||!j.trim(),children:"Send"})]}),a.jsx("span",{style:{marginLeft:"auto",flex:"0 0 auto"},children:a.jsx(te,{size:"sm",variant:"ghost",onClick:()=>d?.(i.projectId),title:"Open the project for the full context",children:"open"})})]}),y&&a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5,fontSize:"var(--fs-xs)",color:"var(--text-danger)"},children:[a.jsx(ae,{name:"caution",size:12,strokeWidth:2}),y]})]})}function t1({items:i=[],onPermission:c,onAnswer:u,onPlanner:o,onOpen:d,style:f}){return i.length?a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-2)",...f},children:i.map(m=>a.jsx(e1,{item:m,onPermission:c,onAnswer:u,onPlanner:o,onOpen:d},`${m.projectId}:${m.kind}:${m.id??""}`))}):null}function n1({approvals:i=0,questions:c=0,planner:u=!1}){const o=[];i>0&&o.push(yp(i,"approval"));const d=u?c-1:c;return d>0&&o.push(yp(d,"question")),u&&o.push("the planner is asking"),o.join(", ")}function a1(i){const c=Math.max(0,Math.round(Number(i)||0)/1e3);if(c<60)return`${Math.round(c)}s`;const u=Math.round(c/60);return u<60?`${u}m`:`${Math.floor(u/60)}h ${String(u%60).padStart(2,"0")}m`}function Za(i){return i>=1e6?`${(i/1e6).toFixed(1)}m`:i>=1e3?`${(i/1e3).toFixed(1)}k`:String(i)}const l1=i=>i?i.inputTokens+i.outputTokens+i.cacheReadTokens+i.cacheWriteTokens:0,i1="repeating-linear-gradient(-45deg, var(--line-strong) 0 3px, transparent 3px 7px)";function cv({spent:i,budget:c,costBasis:u="priced",usage:o=null,turns:d,elapsedMs:f,detail:m=!1,style:y}){const x=typeof f=="number"&&f>0?` · ${a1(f)}`:"";if(i=Number(i)||0,c=Number(c)||0,u!=="priced"){const S=u==="unpriced",z=l1(o);return a.jsxs("div",{title:S?"Real spend, on an account Foreman cannot price — no table for this endpoint, or a plan being drawn down. Check the provider for the bill; turns and tokens are all that is known here.":"Runs on hardware you already own, so nothing is billed per token. Turns and tokens are the only real units.",style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",minWidth:170,...y},children:[a.jsx("div",{style:{flex:1,height:"var(--meter-h)",background:"var(--bg-inset)",borderRadius:2,overflow:"hidden",backgroundImage:S?i1:void 0}}),a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:"var(--fs-sm)",color:"var(--ink-1)",fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap"},children:[m?`${Za(o?.inputTokens??0)} in · ${Za(o?.outputTokens??0)} out`:`${Za(z)} tok`,typeof d=="number"?` · ${d} turn${d===1?"":"s"}`:"",x]})]})}const p=c>0?Math.min(i/c,1):0,b=p>=.9?"critical":p>=.7?"warning":"ok",j=b==="critical"?"var(--status-critical)":b==="warning"?"var(--status-warning)":"var(--brand)";return a.jsxs("div",{title:`$${i.toFixed(2)} spent of $${c.toFixed(2)} budget`,style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",minWidth:170,...y},children:[a.jsx("div",{style:{flex:1,height:"var(--meter-h)",background:"var(--bg-inset)",borderRadius:2,overflow:"hidden"},children:a.jsx("div",{style:{width:`${p*100}%`,height:"100%",background:j,transition:"width var(--dur-meter)"}})}),a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:"var(--fs-sm)",color:"var(--ink-1)",fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap"},children:[b!=="ok"&&a.jsx(ae,{name:b,size:12,strokeWidth:2.25,color:j}),"$",i.toFixed(2)," / $",c.toFixed(0),x]})]})}function s1({name:i,folder:c,title:u,mission:o,activity:d,costUsd:f,budgetUsd:m,costBasis:y,usage:x,turns:p,directorModel:b,workerModel:j,createdAt:S,onOpen:z,style:D}){const[G,T]=g.useState(!1),w=[b,j].filter(Boolean);return a.jsxs("div",{role:"button",tabIndex:0,onClick:z,onKeyDown:R=>{(R.key==="Enter"||R.key===" ")&&(R.preventDefault(),z?.())},onMouseEnter:()=>T(!0),onMouseLeave:()=>T(!1),style:{display:"grid",gridTemplateColumns:"minmax(9rem, 12rem) minmax(0, 1fr) minmax(11rem, 15rem) auto",gap:"var(--sp-4)",alignItems:"center",padding:"var(--sp-3) var(--sp-4)",cursor:"pointer",background:G?"var(--bg-hover)":"transparent",borderLeft:`var(--accent-w) solid ${G?"var(--brand)":"transparent"}`,transition:"background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease)",...D},children:[a.jsxs("div",{style:{minWidth:0},children:[a.jsx("div",{style:{fontSize:"var(--fs-md)",fontWeight:"var(--fw-semibold)",color:"var(--ink-0)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i}),a.jsx("div",{title:c,style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontFamily:"var(--font-mono)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:br(c)})]}),a.jsxs("div",{style:{minWidth:0},children:[a.jsx("div",{title:o,style:{fontSize:"var(--fs-md)",color:"var(--ink-0)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u||o}),d&&a.jsx("div",{className:"ticker",title:d,style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontFamily:"var(--font-mono)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d},d)]}),a.jsx(cv,{spent:f,budget:m,costBasis:y,usage:x,turns:p}),a.jsxs("div",{style:{textAlign:"right",fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap"},children:[w.length>0&&a.jsx("div",{title:"director · worker",style:{maxWidth:"16rem",overflow:"hidden",textOverflow:"ellipsis"},children:w.join(" · ")}),typeof S=="number"&&a.jsx("div",{children:ov(S)})]})]})}function r1(i){return new Date(i).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function fr(){return a.jsx("span",{style:{color:"var(--ink-2)",opacity:.6},children:"·"})}function o1({name:i,folder:c,lastRun:u,onOpen:o,onUnlink:d,style:f}){const[m,y]=g.useState(!1),[x,p]=g.useState(!1),b=u?.usage?u.usage.inputTokens+u.usage.outputTokens:null,j=u?.status==="done"?u.reviewedBy??[]:[];return a.jsxs("article",{role:"button",tabIndex:0,onClick:o,onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),o?.())},onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1),style:{background:"var(--bg-card)",borderRadius:"var(--r-md)",cursor:"pointer",border:`1px solid ${m?"var(--line-strong)":"var(--line)"}`,padding:"var(--sp-3) var(--sp-4)",display:"flex",flexDirection:"column",gap:6,minWidth:0,transition:"border-color var(--dur-fast) var(--ease)",...f},children:[a.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--sp-2)",minWidth:0},children:[a.jsx("span",{style:{fontSize:"var(--fs-md)",fontWeight:"var(--fw-semibold)",color:"var(--ink-0)",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i}),a.jsx("span",{title:c,style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontFamily:"var(--font-mono)",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginLeft:"auto"},children:br(c)})]}),u?a.jsxs(a.Fragment,{children:[a.jsx("div",{title:u.mission,style:{fontSize:"var(--fs-sm)",color:"var(--ink-1)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u.title||u.mission}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap",fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontVariantNumeric:"tabular-nums"},children:[a.jsx(ja,{status:u.status}),j.length>0&&a.jsxs(a.Fragment,{children:[a.jsx(fr,{}),a.jsxs("span",{role:"img","aria-label":`Reviewed by ${j.join(", ")}`,title:`Reviewed by ${j.join(", ")} — ${j.length===1?"its":"their"} PASS on this run's final diff is what let Foreman record it done`,style:{display:"inline-flex",alignItems:"center",gap:1,color:"var(--ink-2)"},children:[a.jsx(ae,{name:"preview",size:12}),a.jsx(ae,{name:"check",size:10,strokeWidth:2.5})]})]}),u.createdAt&&a.jsxs(a.Fragment,{children:[a.jsx(fr,{}),r1(u.createdAt)]}),u.costBasis==="priced"?a.jsxs(a.Fragment,{children:[a.jsx(fr,{}),"$",(Number(u.costUsd)||0).toFixed(2)]}):b!==null?a.jsxs(a.Fragment,{children:[a.jsx(fr,{}),Za(b)," tok"]}):null]})]}):a.jsx("div",{style:{fontSize:"var(--fs-sm)",color:"var(--ink-2)"},children:"No missions yet — open to compose one."}),a.jsx("div",{style:{display:"flex",justifyContent:"flex-end",height:14,marginTop:-2},children:a.jsxs("button",{type:"button",tabIndex:m?0:-1,onClick:S=>{S.stopPropagation(),d?.()},onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),title:"Unlink project (run history is kept)",style:{display:"inline-flex",alignItems:"center",gap:4,background:"none",border:"none",cursor:"pointer",padding:0,font:"inherit",fontSize:"var(--fs-xs)",color:x?"var(--ink-0)":"var(--ink-2)",opacity:m?1:0,pointerEvents:m?"auto":"none",transition:"opacity var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease)"},children:[a.jsx(ae,{name:"unlink",size:11}),"Unlink"]})})]})}function c1({onClick:i,style:c}){const[u,o]=g.useState(!1);return a.jsxs("div",{role:"button",onClick:i,onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),style:{border:`1px dashed ${u?"var(--ink-2)":"var(--line-strong)"}`,borderRadius:"var(--r-md)",minHeight:"var(--card-min-h)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"var(--sp-2)",cursor:"pointer",color:u?"var(--ink-0)":"var(--ink-1)",background:u?"var(--bg-hover)":"transparent",transition:"border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease)",...c},children:[a.jsx(ae,{name:"add",size:22,strokeWidth:1.5}),a.jsx("span",{style:{fontSize:"var(--fs-sm)"},children:"Link a project"}),a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:"or drop a folder anywhere"})]})}const xp={ok:{icon:"done",color:"var(--status-good)"},warn:{icon:"caution",color:"var(--status-serious)"},error:{icon:"critical",color:"var(--status-critical)"}};function u1({load:i,onSettings:c,onInstallBrowser:u,install:o,style:d}){const[f,m]=g.useState(null),[y,x]=g.useState(!1),[p,b]=g.useState(null),j=async()=>{x(!0),b(null);try{const z=await i();if(!z.ok)throw new Error(`HTTP ${z.status}`);m((await z.json()).checks??[])}catch(z){b(z instanceof Error?z.message:String(z))}finally{x(!1)}};g.useEffect(()=>{j()},[]);const S=(f??[]).filter(z=>z.status!=="ok").length;return a.jsxs("section",{style:{border:"1px solid var(--line)",borderRadius:"var(--r-md)",background:"var(--bg-card)",padding:"var(--sp-3) var(--sp-4)",textAlign:"left",display:"flex",flexDirection:"column",gap:"var(--sp-2)",...d},children:[a.jsxs("header",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)"},children:[a.jsx("span",{style:{fontSize:"var(--fs-sm)",fontWeight:"var(--fw-semibold)",flex:1},children:"This machine"}),f&&a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:S?"var(--status-serious)":"var(--ink-2)"},children:S?`${S} thing${S===1?"":"s"} to look at`:"ready"}),a.jsx(te,{variant:"ghost",size:"sm",icon:y?"loading":"resume",onClick:j,disabled:y,children:"Check again"}),a.jsx(te,{variant:"ghost",size:"sm",onClick:()=>{window.location.hash="#/setup"},children:"Walk-through"})]}),p&&a.jsxs("div",{style:{fontSize:"var(--fs-xs)",color:"var(--status-critical)"},children:["Could not run the checks: ",p]}),!f&&!p&&a.jsx("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:"Checking…"}),f&&a.jsx("div",{style:{display:"flex",flexDirection:"column"},children:f.map(z=>{const D=xp[z.status]||xp.warn;return a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"16px minmax(0, 1fr)",columnGap:"var(--sp-2)",padding:"5px 0",borderTop:"1px solid var(--line)",fontSize:"var(--fs-sm)"},children:[a.jsx(ae,{name:D.icon,size:14,color:D.color,style:{marginTop:2}}),a.jsxs("div",{style:{minWidth:0},children:[a.jsxs("div",{style:{display:"flex",gap:"var(--sp-2)",alignItems:"baseline",minWidth:0},children:[a.jsx("span",{style:{color:"var(--ink-0)",flex:"0 0 auto"},children:z.name}),a.jsx("span",{style:{color:"var(--ink-2)",minWidth:0,overflowWrap:"anywhere"},children:z.detail})]}),z.fix&&z.status!=="ok"&&a.jsx("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-1)",marginTop:2,overflowWrap:"anywhere"},children:z.fix}),z.name==="Browser"&&z.status!=="ok"&&!/install-deps/.test(z.fix||"")&&u&&a.jsxs("div",{style:{marginTop:4,display:"flex",alignItems:"center",gap:"var(--sp-2)",flexWrap:"wrap"},children:[a.jsx(te,{size:"sm",icon:o?.state==="running"?"loading":"add",disabled:o?.state==="running",onClick:u,children:o?.state==="running"?"Installing…":"Install Playwright Chromium"}),o&&a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:o.state==="error"?"var(--status-critical)":"var(--ink-2)",fontFamily:"var(--font-mono)"},children:o.state==="error"?o.error:o.progress})]})]})]},z.name)})}),a.jsxs("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",lineHeight:"var(--lh)"},children:["A project can run on a provider of its own — an Anthropic API key, a Codex login or any OpenAI-compatible endpoint — from"," ",a.jsx("button",{type:"button",onClick:c,style:{background:"none",border:"none",padding:0,font:"inherit",color:"var(--brand)",cursor:"pointer",textDecoration:"underline"},children:"Settings → Provider"})," ","once it is linked."]})]})}function Ul({width:i=480,children:c,onClose:u,dismissible:o=!0,style:d}){return a.jsx("div",{onClick:f=>{o&&f.target===f.currentTarget&&u?.()},style:{position:"fixed",inset:0,background:"var(--scrim)",zIndex:10,display:"flex",alignItems:"center",justifyContent:"center"},children:a.jsx("div",{style:{width:i,maxHeight:"70vh",display:"flex",flexDirection:"column",background:"var(--bg-panel)",border:"1px solid var(--line-strong)",borderRadius:"var(--r-md)",overflow:"hidden",...d},children:c})})}function jr({children:i,style:c}){return a.jsx("div",{style:{padding:"var(--sp-3)",borderBottom:"1px solid var(--line)",wordBreak:"break-all",...c},children:i})}function Hl({children:i,style:c}){return a.jsx("div",{style:{display:"flex",gap:"var(--sp-2)",alignItems:"center",padding:"var(--sp-3)",borderTop:"1px solid var(--line)",...c},children:i})}function Ue({value:i,onChange:c,placeholder:u,type:o="text",min:d,max:f,step:m,width:y,mono:x,prefix:p,autoFocus:b,onKeyDown:j,style:S}){const z=a.jsx("input",{type:o,min:d,max:f,step:m,value:i,autoFocus:b,placeholder:u,onKeyDown:j,onChange:D=>c?.(o==="number"?Number(D.target.value):D.target.value),style:{width:p?"100%":y??"100%",background:p?"transparent":"var(--bg-card)",border:p?"none":"1px solid var(--line-strong)",borderRadius:"var(--r-sm)",padding:p?"6px 9px 6px 0":"6px 9px",color:"var(--ink-0)",outline:p?"none":void 0,fontFamily:x?"var(--font-mono)":"var(--font-ui)",...p?null:S}});return p?a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",width:y??"100%",boxSizing:"border-box",background:"var(--bg-card)",border:"1px solid var(--line-strong)",borderRadius:"var(--r-sm)",paddingLeft:9,...S},children:[a.jsx("span",{style:{color:"var(--ink-2)",marginRight:4,userSelect:"none"},children:p}),z]}):z}function Vt({tabs:i,value:c,onChange:u,size:o="md",style:d}){return a.jsx("div",{role:"tablist",style:{display:"inline-flex",gap:2,padding:2,background:"var(--bg-inset)",border:"1px solid var(--line)",borderRadius:"var(--r-sm)",...d},children:i.map(f=>a.jsx(d1,{tab:f,selected:f.value===c,size:o,onSelect:()=>u?.(f.value)},f.value))})}function d1({tab:i,selected:c,size:u,onSelect:o}){const[d,f]=g.useState(!1);return a.jsxs("button",{type:"button",role:"tab","aria-selected":c,onClick:o,onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),style:{display:"inline-flex",alignItems:"center",gap:6,padding:u==="sm"?"3px 8px":"5px 10px",borderRadius:4,border:"none",cursor:"pointer",fontSize:u==="sm"?"var(--fs-xs)":"var(--fs-sm)",fontWeight:c?"var(--fw-semibold)":"var(--fw-regular)",background:c?"var(--bg-card)":d?"var(--bg-hover)":"transparent",color:c?"var(--ink-0)":"var(--ink-1)",whiteSpace:"nowrap",boxShadow:c?"inset 0 0 0 1px var(--line-strong)":"none",transition:"background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease)"},children:[i.icon&&a.jsx(ae,{name:i.icon,size:u==="sm"?12:14}),i.label,i.count>0&&a.jsx("span",{style:{fontSize:"var(--fs-xs)",padding:"0 5px",borderRadius:"var(--r-pill)",lineHeight:"16px",background:i.attention?"var(--status-warning)":"var(--line-strong)",color:i.attention?"var(--brand-ink)":"var(--ink-0)",fontWeight:"var(--fw-semibold)"},children:i.count})]})}function bp({children:i,icon:c,onClick:u}){const[o,d]=g.useState(!1);return a.jsxs("div",{role:"button",onClick:u,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{display:"flex",alignItems:"center",gap:8,padding:"7px 12px",cursor:"pointer",fontSize:"var(--fs-md)",background:o?"var(--bg-card)":"transparent",transition:"background var(--dur-fast) var(--ease)"},children:[a.jsx(ae,{name:c,size:15,color:"var(--ink-1)"}),i]})}function f1({path:i="…",parent:c,dirs:u=[],error:o,onNavigate:d,onCreate:f,onPick:m,onClone:y,cloneWhere:x,clone:p,onClose:b}){const[j,S]=g.useState("folder"),[z,D]=g.useState(!1),[G,T]=g.useState(""),[w,R]=g.useState(""),[H,K]=g.useState(""),[se,B]=g.useState(null),q=p?.state==="running",I=!!w.trim()&&!!se?.dest&&!q;g.useEffect(()=>{if(!x)return;const ne=w.trim();if(!ne){B(null);return}let de=!1;const je=setTimeout(()=>{Promise.resolve(x(ne)).then(re=>{de||B(re)}).catch(()=>{de||B(null)})},250);return()=>{de=!0,clearTimeout(je)}},[w,x]);const W=()=>{I&&y?.(w.trim(),H.trim()||void 0)},ue=j==="git"&&y;return a.jsxs(Ul,{width:520,onClose:q?void 0:b,children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-3)",padding:"var(--sp-3) var(--sp-3) var(--sp-2)"},children:[a.jsx("span",{style:{fontWeight:"var(--fw-semibold)"},children:"Link a project"}),y&&a.jsx(Vt,{size:"sm",value:j,onChange:ne=>{q||S(ne)},style:{marginLeft:"auto"},tabs:[{value:"folder",label:"Folder on this machine",icon:"folder"},{value:"git",label:"Git repository",icon:"provider"}]})]}),ue?a.jsxs("div",{style:{padding:"0 var(--sp-3) var(--sp-3)",display:"flex",flexDirection:"column",gap:"var(--sp-3)"},children:[a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx("label",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:"Repository"}),a.jsx(Ue,{autoFocus:!0,placeholder:"https://github.com/owner/repo · git@host:owner/repo.git · owner/repo",value:w,onChange:R,disabled:q,onKeyDown:ne=>{ne.key==="Enter"&&W()}})]}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsxs("label",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:["Branch ",a.jsx("span",{style:{color:"var(--ink-3, var(--ink-2))"},children:"· optional, the default branch otherwise"})]}),a.jsx(Ue,{placeholder:"main",value:H,onChange:K,disabled:q,width:220,onKeyDown:ne=>{ne.key==="Enter"&&W()}})]}),a.jsxs("div",{style:{padding:"var(--sp-2) var(--sp-3)",background:"var(--bg-inset)",border:"1px solid var(--line)",borderRadius:"var(--r-sm)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",display:"flex",flexDirection:"column",gap:4},children:[!w.trim()&&a.jsx("span",{children:"Will be cloned under your projects root and linked as a project. Paste a URL to see the exact folder."}),w.trim()&&se?.dest&&a.jsxs("span",{children:["Will be cloned to ",a.jsx("span",{style:{fontFamily:"var(--font-mono)",color:"var(--brand)"},children:se.dest})," and linked as ",a.jsx("b",{style:{color:"var(--ink-1)"},children:se.name}),"."]}),w.trim()&&se&&!se.dest&&a.jsx("span",{style:{color:"var(--status-error)"},children:se.error}),w.trim()&&!se&&a.jsx("span",{children:"Checking…"}),a.jsxs("span",{children:["Runs ",a.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:"git clone"})," as you, with your own SSH keys and credential helpers. Foreman never asks for a token. Full clone, so the deck can diff against it."]})]}),p?.state==="running"&&a.jsx("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-1)",fontFamily:"var(--font-mono)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:p.progress||"Starting git…"}),p?.state==="error"&&a.jsx(Je,{tone:"error",inline:!0,style:{fontSize:"var(--fs-xs)"},children:p.error})]}):a.jsxs(a.Fragment,{children:[a.jsx(jr,{style:{font:"var(--fs-sm) var(--font-mono)",color:"var(--brand)"},children:i}),a.jsxs("div",{style:{overflowY:"auto",flex:1},children:[c&&a.jsx(bp,{icon:"parent",onClick:()=>d?.(c),children:".."}),u.map(ne=>a.jsx(bp,{icon:"folder",onClick:()=>d?.(`${i}${i.endsWith("/")?"":"/"}${ne}`),children:ne},ne)),u.length===0&&a.jsx("div",{style:{padding:"var(--sp-3)",color:"var(--ink-2)",fontSize:"var(--fs-sm)"},children:"No subfolders."})]}),z&&a.jsxs("div",{style:{display:"flex",gap:"var(--sp-2)",alignItems:"center",padding:"var(--sp-2) var(--sp-3)",borderTop:"1px solid var(--line)"},children:[a.jsx(Ue,{autoFocus:!0,placeholder:"New folder name",value:G,onChange:T,onKeyDown:ne=>{ne.key==="Enter"&&f?.(G)},style:{flex:1}}),a.jsx(te,{variant:"good",onClick:()=>f?.(G),children:"Create"})]}),o&&a.jsx("div",{style:{padding:"4px var(--sp-3)"},children:a.jsx(Je,{tone:"error",inline:!0,style:{fontSize:"var(--fs-xs)"},children:o})})]}),a.jsxs(Hl,{children:[ue?null:a.jsx(te,{icon:"add",onClick:()=>D(!z),title:"Create a subfolder here",children:"New folder"}),a.jsx("span",{style:{flex:1}}),a.jsx(te,{onClick:b,disabled:q,children:"Cancel"}),ue?a.jsx(te,{variant:"primary",disabled:!I,onClick:W,children:q?"Cloning…":"Clone & link"}):a.jsx(te,{variant:"primary",onClick:()=>m?.(i),children:"Select this folder"})]})]})}function h1({name:i,matches:c,onPick:u,onClose:o}){const[d,f]=g.useState(null);return a.jsxs(Ul,{width:520,onClose:o,style:{maxHeight:"60vh"},children:[a.jsxs(jr,{children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontWeight:"var(--fw-semibold)"},children:[a.jsx(ae,{name:"folder",size:16,color:"var(--ink-1)"}),i]}),a.jsx("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",marginTop:2},children:"Browsers hide dropped folders' full paths — pick the matching location."})]}),a.jsxs("div",{style:{overflowY:"auto",flex:1},children:[c==null&&a.jsx("div",{style:{padding:"var(--sp-3)",color:"var(--ink-2)",fontSize:"var(--fs-sm)"},children:"Searching your home folder…"}),c?.map(m=>a.jsx("div",{role:"button",onClick:()=>u?.(m),onMouseEnter:()=>f(m),onMouseLeave:()=>f(null),style:{padding:"8px 12px",cursor:"pointer",fontFamily:"var(--font-mono)",fontSize:"var(--fs-sm)",background:d===m?"var(--bg-card)":"transparent",transition:"background var(--dur-fast) var(--ease)"},children:m},m)),c?.length===0&&a.jsxs("div",{style:{padding:"var(--sp-3)",color:"var(--ink-2)",fontSize:"var(--fs-sm)"},children:["No folder named “",i,"” found under your home directory — use the folder picker instead."]})]}),a.jsx(Hl,{style:{justifyContent:"flex-end"},children:a.jsx(te,{onClick:o,children:"Cancel"})})]})}function p1({children:i="Drop a folder to link it"}){return a.jsxs("div",{style:{position:"absolute",inset:8,zIndex:5,pointerEvents:"none",border:"2px dashed var(--brand)",borderRadius:"var(--r-md)",background:"var(--brand-wash)",display:"flex",alignItems:"center",gap:10,justifyContent:"center",color:"var(--brand)",fontSize:"var(--fs-lg)"},children:[a.jsx(ae,{name:"folder",size:20}),i]})}function uv({title:i,body:c,confirmLabel:u="Confirm",tone:o="danger",icon:d,onConfirm:f,onCancel:m}){return a.jsxs(Ul,{width:420,onClose:m,children:[a.jsx(jr,{children:a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontWeight:"var(--fw-semibold)"},children:[d&&a.jsx(ae,{name:d,size:16,color:o==="danger"?"var(--status-critical)":"var(--ink-1)"}),i]})}),a.jsx("div",{style:{padding:"var(--sp-3)",fontSize:"var(--fs-md)",color:"var(--ink-1)",lineHeight:"var(--lh-prose)"},children:c}),a.jsxs(Hl,{style:{justifyContent:"flex-end"},children:[a.jsx(te,{onClick:m,children:"Cancel"}),a.jsx(te,{variant:o,onClick:f,children:u})]})]})}const v1=3e4;function m1(i){const[c,u]=g.useState({}),o=g.useRef(0);return g.useEffect(()=>{const d=i.map(x=>x.id),f=Date.now()-o.current>=v1,m=f?d:d.filter(x=>!(x in c));if(m.length===0)return;f&&(o.current=Date.now());let y=!0;return Promise.all(m.map(async x=>{const p=await fetch(`/projects/${encodeURIComponent(x)}/schedules`).catch(()=>null);if(!p?.ok)return[x,[]];const b=await p.json().catch(()=>({}));return[x,b.schedules??[]]})).then(x=>{y&&u(p=>({...p,...Object.fromEntries(x)}))}),()=>{y=!1}},[i,c]),c}function g1(i){const c=Math.round(i/6e4);if(c<=0)return"due now";if(c===1)return"in a minute";if(c<60)return`in ${c} min`;const u=Math.round(c/60);return u===1?"in an hour":u<48?`in ${u} h`:`in ${Math.round(u/24)} days`}function y1(i){return i==="failures"?"two runs in a row failed":i==="monthly-cap"?"this month’s scheduled spend reached its ceiling":"you paused it"}function x1(i){const c=(i??[]).filter(f=>f.enabled);if(c.length===0)return null;const u=f=>f>0?` (+${f} more scheduled)`:"",o=c.find(f=>f.pausedReason);if(o)return{paused:!0,text:`Paused — “${o.name}” will not run because ${y1(o.pausedReason)}. Resume it from the project page.${u(c.length-1)}`};const d=c.filter(f=>typeof f.nextRunAt=="number").sort((f,m)=>f.nextRunAt-m.nextRunAt)[0];return d?{paused:!1,text:`Next scheduled run ${g1(d.nextRunAt-Date.now())} — ${d.name}${u(c.length-1)}`}:{paused:!1,text:`Scheduled: “${c[0].name}” — no next run planned yet.${u(c.length-1)}`}}function b1({clock:i}){return a.jsxs("span",{tabIndex:0,role:"img",title:i.text,"aria-label":i.text,style:{position:"absolute",left:"var(--sp-4)",bottom:"var(--sp-3)",display:"inline-flex",alignItems:"center",gap:3,borderRadius:i.paused?"var(--r-pill)":"var(--r-sm)",border:i.paused?"1px solid var(--status-warning)":void 0,padding:i.paused?"0 5px":void 0,fontSize:"var(--fs-xs)",lineHeight:"15px",color:i.paused?"var(--status-warning)":"var(--ink-2)"},children:[a.jsx(ae,{name:i.paused?"interrupted":"timeline",size:i.paused?10:12}),i.paused&&"paused"]})}const jp="foreman.fleet.desk";function j1(){const[i,c]=g.useState(()=>{try{return localStorage.getItem(jp)!=="closed"}catch{return!0}});return[i,()=>c(o=>{try{localStorage.setItem(jp,o?"closed":"open")}catch{}return!o})]}function S1({onSettings:i,open:c,onToggle:u}){const o=Zp(Jg),[d,f]=g.useState(null),m=g.useRef(null),y=o.entries.filter(S=>S.kind!=="tool"),[x,p]=g.useState(!1),b=g.useRef(0);g.useEffect(()=>{c?(b.current=y.length,p(!1)):y.length>b.current&&!o.thinking&&p(!0)},[c,y.length,o.thinking]),g.useEffect(()=>{c&&m.current?.scrollIntoView({block:"end"})},[y.length,o.thinking,c]);const j=async S=>f(await o.send(S));return c?a.jsxs("aside",{style:{width:"clamp(22rem, 28vw, 30rem)",flex:"0 0 auto",minHeight:0,display:"flex",flexDirection:"column",borderLeft:"1px solid var(--line)",background:"var(--bg-panel)"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-3)",borderBottom:"1px solid var(--line)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",flex:"0 0 auto"},children:[a.jsx("span",{style:{color:"var(--ink-0)",fontSize:"var(--fs-sm)",fontWeight:"var(--fw-semibold)"},children:"Front desk"}),a.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:"the same conversation as your phone"}),a.jsxs("span",{style:{marginLeft:"auto",display:"inline-flex",gap:"var(--sp-1)",alignItems:"center",flex:"0 0 auto"},children:[o.costUsd>0&&a.jsxs("span",{title:"What this conversation has cost. Not charged to any mission.",style:{fontVariantNumeric:"tabular-nums",marginRight:"var(--sp-1)"},children:["$",o.costUsd.toFixed(2)]}),y.length>0&&!o.thinking&&a.jsx(te,{variant:"ghost",size:"sm",onClick:()=>{o.clear()},title:"Forget this conversation; the next message starts fresh",children:"Forget"}),a.jsx(Sa,{icon:"chevronRight",label:"Fold the front desk away",onClick:u})]})]}),a.jsxs("div",{style:{flex:1,minHeight:0,overflowY:"auto",padding:"var(--sp-3)",display:"flex",flexDirection:"column",gap:"var(--sp-2)"},children:[y.length===0&&!o.thinking&&a.jsx(Ve,{children:"Ask how things are going, or say what you want started where. It knows every project, can open a planning conversation, propose a mission, or pass a note to a running director. It never starts a run or answers an approval for you."}),y.map(S=>a.jsx(uu,{agent:S.agent,title:S.title,kind:S.kind,body:S.body,ts:S.ts},S.id)),a.jsx("div",{ref:m})]}),a.jsxs("div",{style:{flex:"0 0 auto",padding:"var(--sp-2) var(--sp-3) var(--sp-3)",borderTop:"1px solid var(--line)"},children:[a.jsx(au,{busy:o.thinking,who:o.who,placeholder:"How is everything going?",attach:!1,hint:"Knows the fleet. Never starts a run or answers for you.",busyHint:"The front desk is looking…",onSend:S=>{j(S)},onStop:()=>{o.stop()},onChangeModel:i}),d&&a.jsx(Je,{tone:"error",inline:!0,style:{marginTop:4},children:d})]})]}):a.jsx("aside",{style:{flex:"0 0 auto",borderLeft:"1px solid var(--line)",background:"var(--bg-panel)",display:"flex",flexDirection:"column",alignItems:"center",padding:"var(--sp-2) 4px"},children:a.jsxs("button",{type:"button",onClick:u,title:o.thinking?"The front desk is replying — open it":x?"The front desk answered — open it":"Open the front desk (the same conversation as your phone)","aria-label":"Open the front desk",style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8,background:"none",border:0,padding:"6px 4px",cursor:"pointer",color:"var(--ink-2)",borderRadius:"var(--r-sm)",position:"relative"},children:[a.jsx(ae,{name:"chevronLeft",size:14}),a.jsx("span",{style:{writingMode:"vertical-rl",fontSize:"var(--fs-xs)",letterSpacing:".06em",textTransform:"uppercase"},children:"Front desk"}),(x||o.thinking)&&a.jsx("span",{"aria-hidden":!0,style:{position:"absolute",top:4,right:2,width:7,height:7,borderRadius:"50%",background:o.thinking?"var(--ink-2)":"var(--brand)"}})]})})}function k1(i,c){const u=i.activeRun??i.lastRun;return[i.name,i.folder,u?.title,u?.mission].some(o=>o?.toLowerCase().includes(c))}function w1(i){const c=[];for(const u of i){if(Array.isArray(u.needs)){const f=[...u.needs].sort((m,y)=>(m.since??0)-(y.since??0));for(const m of f)c.push({...m,projectId:u.id,projectName:u.name});continue}const o=u.pendingPermissions||0,d=u.pendingQuestions||0;o+d!==0&&c.push({projectId:u.id,projectName:u.name,kind:"summary",text:n1({approvals:o,questions:d,planner:!!u.plannerQuestion})})}return c}async function z1(i){return i.ok?null:(await i.json().catch(()=>({}))).error??(i.status===404?"already answered or timed out":`HTTP ${i.status}`)}function C1(i,c){const[u,o]=g.useState(!1),[d,f]=g.useState(null),[m,y]=g.useState(""),[x,p]=g.useState(null),b=async(z,D)=>{p({state:"running",progress:"Starting git…"});const G=await ke.cloneProject(z,D),T=await G.json().catch(()=>({}));if(!G.ok){p({state:"error",error:T.error??`HTTP ${G.status}`});return}const w=T.id,R=async()=>{const H=await ke.cloneStatus(w).catch(()=>null),K=H&&H.ok?await H.json():null;if(!K){p({state:"error",error:"Lost track of the clone. Check the projects root."});return}if(K.state==="running"){p({state:"running",progress:K.progress,dest:K.dest}),setTimeout(()=>{R()},1e3);return}if(K.state==="error"){p({state:"error",error:K.error});return}p(null),o(!1),f(null),K.projectId&&c(K.projectId)};R()},j=async z=>{y("");const D=await ke.browse(z);D.ok&&f(await D.json())},S=async z=>{if(!d)return;y("");const D=await ke.mkdir(d.path,z);D.ok?await j((await D.json().catch(()=>null))?.path??d.path):y((await D.json()).error)};return{open:u,show:()=>{o(!0),j()},close:()=>{x?.state!=="running"&&(o(!1),f(null),p(null))},props:d&&{path:d.path,parent:d.parent,dirs:d.dirs,error:m,onNavigate:z=>{j(z)},onCreate:z=>{S(z)},onPick:z=>{o(!1),f(null),i(z)},onClone:(z,D)=>{b(z,D)},cloneWhere:z=>ke.cloneWhere(z).then(D=>D.json()),clone:x}}}const Gc={display:"flex",flexDirection:"column",gap:"var(--sp-2)"};function T1({projects:i,connected:c,activity:u,auth:o,onOpen:d,onOpenRun:f,refresh:m,theme:y,onToggleTheme:x,onSettings:p,query:b="",onQuery:j,search:S}){const[z,D]=g.useState(!1),[G,T]=j1(),[w,R]=g.useState(null),[H,K]=g.useState(null),se=async C=>{const L=await ke.linkProject(C);L.ok&&(m(),d((await L.json()).project.id))},B=Jp(),q=m1(i),I=C1(C=>{se(C)},C=>{m(),d(C)}),W=b.trim().toLowerCase(),ue=W?i.filter(C=>k1(C,W)):i,ne=w1(ue),de=ue.filter(C=>C.activeRun).sort((C,L)=>(L.lastActivityAt??0)-(C.lastActivityAt??0)),je=ue.filter(C=>!C.activeRun),re=i.filter(C=>C.activeRun).length,xe=i.reduce((C,L)=>C+(Array.isArray(L.needs)?L.needs.length:(L.pendingPermissions||0)+(L.pendingQuestions||0)),0),_=re===0&&xe===0,O=_&&i.length>0?"all quiet":[re>0?`${re} running`:null,xe>0?`${xe} needs you`:null].filter(Boolean).join(" · "),ee=async C=>{C.preventDefault(),D(!1);const L=C.dataTransfer.items[0]?.webkitGetAsEntry?.();if(!L?.isDirectory)return;R({name:L.name,matches:null});const Z=await ke.locate(L.name);R({name:L.name,matches:Z.ok?(await Z.json()).matches:[]})},P=async C=>{const L=await z1(await C);return m(),L},oe=(C,L)=>P(ke.permission(C.id,L)),k=(C,L)=>P(ke.answer(C.id,L)),V=(C,L)=>P(fetch("/chat/answer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({projectId:C.projectId,id:C.id,answers:{[C.text]:L}})}));return a.jsxs("div",{style:{height:"100%",overflow:"hidden",position:"relative",display:"flex",flexDirection:"column"},onDragOver:C=>{C.preventDefault(),D(!0)},onDragLeave:C=>{C.target===C.currentTarget&&D(!1)},onDrop:C=>{ee(C)},children:[z&&a.jsx(p1,{}),a.jsxs(rv,{mode:"fleet",subtitle:"mission control",theme:y,onToggleTheme:x,onSettings:p,search:S,children:[!c&&a.jsx(Je,{tone:"disconnected",inline:!0,children:"disconnected"}),c&&o.mode==="none"&&a.jsx(Je,{tone:"caution",inline:!0,children:"No model credentials on this machine, so missions cannot start. Sign in with Claude Code and restart Foreman, or give a project its own API key or endpoint in Settings → Provider."}),O&&a.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:6,padding:"2px 10px",borderRadius:"var(--r-pill)",border:`1px solid ${xe>0?"var(--status-warning)":_?"var(--line)":"var(--line-strong)"}`,background:xe>0?"var(--brand-wash)":"transparent",fontSize:"var(--fs-xs)",color:_?"var(--ink-3)":"var(--ink-1)",fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap"},children:O}),i.length>0&&a.jsx(te,{variant:"primary",icon:"add",onClick:I.show,title:"Link a folder as a project (or drop one anywhere on this page)",children:"Link project"})]}),a.jsxs("div",{style:{flex:1,minHeight:0,display:"flex"},children:[a.jsxs("div",{style:{flex:1,minWidth:0,overflowY:"auto",display:"flex",flexDirection:"column"},children:[W&&a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",maxWidth:"var(--fleet-max)",margin:"0 auto",width:"100%",padding:"var(--sp-4) var(--sp-5) 0",boxSizing:"border-box",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:[a.jsxs("span",{children:["Showing projects matching “",b.trim(),"” · ",a.jsxs("span",{style:{fontVariantNumeric:"tabular-nums"},children:[ue.length," of ",i.length]})]}),a.jsx(te,{variant:"ghost",size:"sm",onClick:()=>j?.(""),children:"Show all"})]}),i.length===0?a.jsxs("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"var(--sp-3)",padding:"var(--sp-5)",textAlign:"center"},children:[a.jsx("div",{style:{width:"20rem",maxWidth:"100%"},children:a.jsx(c1,{onClick:I.show})}),a.jsx(Ve,{children:"No projects linked yet — link a folder to give the director a job site."}),a.jsx("div",{style:{width:"32rem",maxWidth:"100%",marginTop:"var(--sp-3)"},children:a.jsx(u1,{load:ke.doctor,onSettings:()=>p("provider"),onInstallBrowser:B.start,install:B.job})})]}):a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-5)",padding:"var(--sp-5)",maxWidth:"var(--fleet-max)",margin:"0 auto",width:"100%",boxSizing:"border-box"},children:[ue.length===0&&a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)"},children:[a.jsxs(Ve,{children:["No project matches “",b.trim(),"”. Runs that do are in the search box above."]}),a.jsx(te,{variant:"ghost",size:"sm",onClick:()=>j?.(""),children:"Show all"})]}),ne.length===0&&de.length===0&&ue.length>0&&a.jsx(Ve,{children:"All quiet — nothing running, nothing waiting on you. Open a project to plan its next mission."}),ne.length>0&&a.jsxs("section",{style:Gc,children:[a.jsxs(kn,{children:["Needs you · ",ne.length]}),a.jsx(t1,{items:ne,onPermission:oe,onAnswer:k,onPlanner:V,onOpen:d})]}),de.length>0&&a.jsxs("section",{style:Gc,children:[a.jsxs(kn,{children:["Running · ",de.length]}),a.jsx("div",{style:{background:"var(--bg-card)",border:"1px solid var(--line)",borderRadius:"var(--r-md)",overflow:"hidden"},children:de.map((C,L)=>{const Z=C.activeRun;return a.jsx(s1,{name:C.name,folder:C.folder,title:Z.title,mission:Z.mission,activity:u[C.id],costUsd:Z.costUsd,budgetUsd:Z.budgetUsd,costBasis:ba(Z),usage:Z.usage,turns:Z.turns,directorModel:Z.directorModel,workerModel:Z.workerModel,createdAt:Z.createdAt,onOpen:()=>d(C.id),style:L>0?{borderTop:"1px solid var(--line)"}:void 0},C.id)})})]}),je.length>0&&a.jsxs("section",{style:Gc,children:[a.jsxs(kn,{children:["Recent · ",je.length]}),a.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:"var(--sp-3)"},children:je.map(C=>{const L=x1(q[C.id]);return a.jsxs("div",{style:{position:"relative",display:"flex",minWidth:0},children:[a.jsx(o1,{name:C.name,folder:C.folder,style:{flex:1,minWidth:0},lastRun:C.lastRun&&C.lastRun.status!=="idle"&&C.lastRun.status!=="running"?C.lastRun:null,onOpen:()=>{const Z=C.lastRun;Z?.id&&f&&(Z.status==="error"||Z.status==="interrupted")?f(C.id,Z.id):d(C.id)},onUnlink:()=>K(C)}),L&&a.jsx(b1,{clock:L})]},C.id)})})]})]})]}),i.length>0&&a.jsx(S1,{onSettings:p,open:G,onToggle:T})]}),I.open&&I.props&&a.jsx(f1,{...I.props,onClose:I.close}),w&&a.jsx(h1,{name:w.name,matches:w.matches,onPick:C=>{R(null),se(C)},onClose:()=>R(null)}),H&&a.jsx(uv,{title:`Unlink ${H.name}?`,body:"Foreman stops tracking this folder. Run history and its .foreman/ files stay on disk; you can link it again later.",confirmLabel:"Unlink",tone:"danger",icon:"unlink",onConfirm:()=>{const C=H.id;K(null),ke.unlinkProject(C).then(m)},onCancel:()=>K(null)})]})}const Sp=["Welcome","Where missions run","Your phone","Reach & browser","Ready"],M1={ok:{icon:"done",color:"var(--status-good)"},warn:{icon:"caution",color:"var(--status-serious)"},none:{icon:"idle",color:"var(--ink-2)"}};function zt({tone:i,title:c,children:u}){const o=M1[i];return a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"20px minmax(0, 1fr)",columnGap:"var(--sp-2)",padding:"var(--sp-2) 0",borderTop:"1px solid var(--line)"},children:[a.jsx(ae,{name:o.icon,size:16,color:o.color,style:{marginTop:2}}),a.jsxs("div",{style:{minWidth:0},children:[a.jsx("div",{style:{color:"var(--ink-0)",fontWeight:"var(--fw-semibold)"},children:c}),u&&a.jsx("div",{style:{color:"var(--ink-1)",marginTop:2,lineHeight:"var(--lh)"},children:u})]})]})}function sn({children:i}){return a.jsx("code",{style:{fontFamily:"var(--font-mono)",fontSize:"0.92em",background:"var(--bg-inset)",padding:"1px 5px",borderRadius:"var(--r-xs, 3px)"},children:i})}function E1({onDone:i,onSettings:c}){const[u,o]=g.useState(0),[d,f]=g.useState(null),[m,y]=g.useState(!1),[x,p]=g.useState(null),b=async()=>{y(!0),p(null);try{const T=await ke.doctor();if(!T.ok)throw new Error(`HTTP ${T.status}`);f(await T.json())}catch(T){p(T instanceof Error?T.message:String(T))}finally{y(!1)}};g.useEffect(()=>{b()},[]),g.useEffect(()=>{u>0&&b()},[u]);const j=Jp(()=>{b()}),S=j.job?.state==="running",z=d?d.auth.mode==="none"&&!d.ollama&&!d.codex:!1,D=u===Sp.length-1,G=()=>{if(u===0)return a.jsxs(a.Fragment,{children:[a.jsx("h1",{style:Hi,children:"Foreman runs missions on your projects."}),a.jsx("p",{style:Dl,children:"You link a folder, talk over what should happen with a planner that reads the code and never changes it, and start a mission with a budget. A director plans the work, hires workers, verifies what they did and stops at the cap. You approve what matters — from here or from your phone — and read the result: the files that changed, the screenshots, the branch, a pull request when you want one."}),a.jsx("p",{style:Dl,children:"The next four pages show what this machine has for that. Nothing on them is required; anything missing says how to get it."})]});if(!d)return a.jsx("p",{style:Dl,children:x?`Could not read this machine: ${x}`:"Reading this machine…"});if(u===1){const w=d.auth;return a.jsxs(a.Fragment,{children:[a.jsx("h1",{style:Hi,children:z?"Nothing to run missions on yet.":"Where missions run."}),a.jsx("p",{style:Dl,children:"Missions run through a model provider. By default that is the Claude Code install on this machine, and whoever it is signed in as pays. A project can also have a provider of its own."}),a.jsxs("div",{children:[w.mode==="subscription"&&a.jsxs(zt,{tone:"ok",title:`Claude Code is signed in${w.account?.email?` as ${w.account.email}`:""}`,children:["Missions bill that subscription",w.account?.org?` (${w.account.org})`:"",". Source: ",a.jsx(sn,{children:w.source}),"."]}),w.mode==="api-key"&&a.jsxs(zt,{tone:"ok",title:"An Anthropic API key is set in the environment",children:["Missions bill that key, per token. Source: ",a.jsx(sn,{children:w.source}),"."]}),w.mode==="cloud"&&a.jsx(zt,{tone:"ok",title:`Claude through ${w.source}`,children:"Missions bill that cloud account."}),w.mode==="none"&&a.jsxs(zt,{tone:"warn",title:"Claude Code is not signed in on this machine",children:["Until it is, or a project gets a provider of its own, nothing can run. Three ways forward:",a.jsxs("ol",{style:{margin:"var(--sp-2) 0 0",paddingLeft:"1.2em",display:"flex",flexDirection:"column",gap:4},children:[a.jsxs("li",{children:["In a terminal, run ",a.jsx(sn,{children:"claude"}),", then ",a.jsx(sn,{children:"/login"}),". Restart Foreman and press ",a.jsx("em",{children:"Check again"}),"."]}),a.jsxs("li",{children:["Start Foreman with ",a.jsx(sn,{children:"ANTHROPIC_API_KEY"})," set. The key is billed per token."]}),a.jsx("li",{children:"Link a project, then give it an Anthropic API key, a Codex login or any OpenAI-compatible endpoint in Settings → Provider."})]})]}),d.ollama&&a.jsxs(zt,{tone:"ok",title:`Ollama is running with ${d.ollama.models} model${d.ollama.models===1?"":"s"}`,children:[d.ollama.local," served from this machine at no cost per token; the rest are cloud models Ollama proxies. They appear in every model picker."]}),d.codex&&a.jsx(zt,{tone:"ok",title:`Codex is signed in, ${d.codex.models} model${d.codex.models===1?"":"s"}`,children:"Runs on the ChatGPT subscription. In every model picker as well."}),!d.ollama&&!d.codex&&w.mode!=="none"&&a.jsx(zt,{tone:"none",title:"No local Ollama or Codex",children:"Not needed. If either is installed later, its models show up in the pickers on their own."})]})]})}if(u===2){const w=d.phone;return a.jsxs(a.Fragment,{children:[a.jsx("h1",{style:Hi,children:"Your phone."}),a.jsx("p",{style:Dl,children:"Foreman can reach you on Telegram: an approval to tap, a question to answer, a mission that finished, a budget alert. From there you can also talk to the front desk and start planning. Optional, and the bot token is only ever typed into Settings."}),a.jsxs("div",{children:[w?.label&&a.jsxs(zt,{tone:"ok",title:`Linked to ${w.label}`,children:["Through ",w.bot?a.jsxs(sn,{children:["@",w.bot.replace(/^@/,"")]}):"your bot","."]}),w&&!w.label&&a.jsxs(zt,{tone:"warn",title:"A bot is configured but no chat is linked yet",children:["Send it ",a.jsx(sn,{children:"/start"})," from your phone to link this chat."]}),!w&&a.jsxs(zt,{tone:"none",title:"Not set up",children:["Create a bot with @BotFather, paste its token in Settings → Notifications, then send it ",a.jsx(sn,{children:"/start"}),"."]})]}),a.jsx("div",{children:a.jsx(te,{variant:"ghost",size:"sm",icon:"needsYou",onClick:()=>c("notifications"),children:"Settings → Notifications"})})]})}if(u===3){const w=d.tailnet,R=d.browser;return a.jsxs(a.Fragment,{children:[a.jsx("h1",{style:Hi,children:"Reach, and a browser for the crew."}),a.jsxs("div",{children:[w?a.jsxs(zt,{tone:"ok",title:`On a tailnet: ${w.dnsName??w.ip}`,children:["The dashboard is also at ",a.jsx(sn,{children:w.url}),w.https?", over HTTPS":"",". Phone links open there.",!w.https&&a.jsxs(a.Fragment,{children:[" For HTTPS, ",a.jsx(sn,{children:"tailscale serve"})," can front it; Foreman never opens a Funnel."]})]}):a.jsx(zt,{tone:"none",title:"This machine only",children:"The dashboard listens on localhost. With Tailscale installed it also listens on the tailnet, so the phone can open links; nothing is ever exposed to the internet."}),R&&a.jsxs(zt,{tone:R.status==="ok"?"ok":"warn",title:R.status==="ok"?"A browser for missions":/install-deps/.test(R.fix??"")?"A browser is installed, but it cannot start here":"No browser for missions",children:[R.detail,R.status!=="ok"&&R.fix&&/install-deps/.test(R.fix)&&a.jsxs(a.Fragment,{children:[a.jsx("br",{}),R.fix,a.jsx("br",{}),"That is the one step Foreman will not do for you: it never runs anything as root. Once the libraries are in, press ",a.jsx("em",{children:"Check again"}),". Missions that do not need a browser are unaffected."]}),R.status!=="ok"&&!/install-deps/.test(R.fix??"")&&a.jsxs(a.Fragment,{children:[a.jsx("br",{}),"Missions that do not need a browser are unaffected. Foreman can install Playwright's own Chromium for you — about 150 MB, into your home directory, no administrator rights.",a.jsxs("div",{style:{marginTop:"var(--sp-2)",display:"flex",alignItems:"center",gap:"var(--sp-2)",flexWrap:"wrap"},children:[a.jsx(te,{variant:"primary",size:"sm",icon:j.job?.state==="running"?"loading":"add",disabled:j.job?.state==="running",onClick:j.start,children:j.job?.state==="running"?"Installing…":"Install Playwright Chromium"}),j.job&&a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:j.job.state==="error"?"var(--status-critical)":"var(--ink-2)",fontFamily:"var(--font-mono)"},children:j.job.state==="error"?j.job.error:j.job.progress})]})]})]})]})]})}const T=d.auth;return a.jsxs(a.Fragment,{children:[a.jsx("h1",{style:Hi,children:z?"Set up, minus a provider.":"Ready."}),a.jsxs("div",{children:[a.jsxs(zt,{tone:T.mode==="none"?(d.ollama||d.codex,"warn"):"ok",title:"Missions run on",children:[T.mode==="none"?"nothing yet — see page 2":T.mode==="subscription"?`Claude Code${T.account?.email?`, ${T.account.email}`:""}`:T.mode==="api-key"?"an Anthropic API key":T.source,d.ollama?` · Ollama, ${d.ollama.models} models`:"",d.codex?" · Codex":""]}),a.jsx(zt,{tone:d.phone?.label?"ok":"none",title:"Phone",children:d.phone?.label?`Telegram, ${d.phone.label}`:"not linked"}),a.jsx(zt,{tone:d.tailnet?"ok":"none",title:"Reach",children:d.tailnet?`localhost and ${d.tailnet.dnsName??d.tailnet.ip}`:"localhost"}),a.jsx(zt,{tone:d.browser?.status==="ok"?"ok":"warn",title:"Browser",children:d.browser?.status==="ok"?"found":"none — browser missions will fail"})]}),a.jsxs("p",{style:Dl,children:["Next: link a project — a folder on this machine, or a Git URL to clone. The fleet page has the card; dropping a folder anywhere on it works too. This walk-through is at ",a.jsx(sn,{children:"#/setup"})," whenever you want it, and ",a.jsx(sn,{children:"foreman doctor"})," says the same in a terminal."]})]})};return a.jsx("div",{style:{height:"100%",overflowY:"auto",background:"var(--bg-app)",display:"flex",flexDirection:"column"},children:a.jsxs("div",{style:{width:"100%",maxWidth:"44rem",margin:"0 auto",padding:"56px var(--sp-4) 40px",boxSizing:"border-box",display:"flex",flexDirection:"column",gap:"var(--sp-4)",flex:1},children:[a.jsxs("header",{style:{display:"flex",alignItems:"center",gap:"var(--sp-3)"},children:[a.jsx("span",{style:{fontWeight:"var(--fw-semibold)"},children:"Foreman"}),a.jsxs("span",{style:{color:"var(--ink-2)",fontSize:"var(--fs-sm)"},children:["first run",d?.version?` · v${d.version}`:""]}),a.jsx("span",{style:{flex:1}}),a.jsx(te,{variant:"ghost",size:"sm",disabled:S,onClick:i,children:"Skip to the fleet"})]}),a.jsx("ol",{style:{listStyle:"none",margin:0,padding:0,display:"flex",gap:"var(--sp-2)",flexWrap:"wrap"},children:Sp.map((T,w)=>{const R=w<u?"done":w===u?"now":"todo";return a.jsx("li",{children:a.jsxs("button",{type:"button",onClick:()=>w<u&&o(w),disabled:w>u,style:{display:"inline-flex",alignItems:"center",gap:6,background:"none",border:"none",padding:"4px 6px",font:"inherit",fontSize:"var(--fs-sm)",cursor:w<u?"pointer":"default",color:R==="now"?"var(--ink-0)":R==="done"?"var(--ink-1)":"var(--ink-2)",fontWeight:R==="now"?"var(--fw-semibold)":"inherit"},children:[a.jsx("span",{style:{width:18,height:18,borderRadius:"50%",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"var(--fs-xs)",fontVariantNumeric:"tabular-nums",background:R==="now"?"var(--brand)":R==="done"?"var(--status-good)":"transparent",color:R==="todo"?"var(--ink-2)":"var(--brand-ink)",border:R==="todo"?"1px solid var(--line-strong)":"1px solid transparent"},children:R==="done"?a.jsx(ae,{name:"done",size:11}):w+1}),T]})},T)})}),a.jsx("section",{style:{background:"var(--bg-card)",border:"1px solid var(--line)",borderRadius:"var(--r-md)",padding:"var(--sp-5)",display:"flex",flexDirection:"column",gap:"var(--sp-3)",fontSize:"var(--fs-md, var(--fs-sm))"},children:G()}),a.jsxs("footer",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)"},children:[u>0&&a.jsx(te,{variant:"ghost",icon:"back",disabled:S,onClick:()=>o(u-1),children:"Back"}),a.jsx("span",{style:{flex:1}}),S&&a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:"Installing — stay on this page"}),u>0&&a.jsx(te,{variant:"ghost",icon:m?"loading":"resume",disabled:m||S,onClick:()=>{b()},children:"Check again"}),D?a.jsx(te,{variant:"primary",icon:"add",disabled:S,onClick:i,children:"Go link a project"}):a.jsx(te,{variant:"primary",disabled:S,onClick:()=>o(u+1),children:u===0?"Show me":u===1&&z?"Continue without a provider":"Continue"})]})]})})}const Hi={margin:0,fontSize:"var(--fs-xl, 1.35rem)",fontWeight:"var(--fw-semibold)",lineHeight:1.25,textWrap:"balance"},Dl={margin:0,color:"var(--ink-1)",lineHeight:"var(--lh)",maxWidth:"62ch"},_1=15e3;function A1(i,c){const[u,o]=g.useState(null),[d,f]=g.useState(!1),[m,y]=g.useState(null),[x,p]=g.useState(!1),[b,j]=g.useState(0),S=g.useCallback(()=>j(z=>z+1),[]);return g.useEffect(()=>{if(o(null),y(null),p(!1),!i){f(!1);return}let z=!1;f(!0);const D=async()=>{const T=await fetch(`/runs/${encodeURIComponent(i)}/deck`).catch(()=>null);if(z)return;if(!T){y("Could not reach the server."),f(!1);return}if(T.status===404){p(!0),y(null),f(!1);return}if(!T.ok){const R=await T.json().catch(()=>({}));y(R.error||`HTTP ${T.status}`),f(!1);return}const w=await T.json().catch(()=>null);z||(w&&(o(w),p(!1),y(null)),f(!1))};D();const G=c?setInterval(()=>{D()},_1):null;return()=>{z=!0,G&&clearInterval(G)}},[i,c,b]),{deck:u,loading:d,error:m,missing:x,refresh:S}}function D1(i,c=null){const[u,o]=g.useState([]),[d,f]=g.useState(!1),[m,y]=g.useState(!1),[x,p]=g.useState(null),[b,j]=g.useState(0),S=g.useCallback(()=>j(z=>z+1),[]);return g.useEffect(()=>{if(o([]),p(null),!i){y(!1);return}let z=!1;return y(!0),fetch(`/projects/${encodeURIComponent(i)}/tree`).then(async D=>{if(z)return;if(!D.ok){p((await D.json().catch(()=>({}))).error||`HTTP ${D.status}`);return}const G=await D.json();o(G.files??[]),f(!!G.truncated)}).catch(()=>{z||p("Could not reach the server.")}).finally(()=>{z||y(!1)}),()=>{z=!0}},[i,b,c]),{files:u,truncated:d,loading:m,error:x,refresh:S}}const Sr=g.forwardRef(function({value:c,onChange:u,placeholder:o,size:d="mission",bare:f,onKeyDown:m,onPaste:y,onFocus:x,onBlur:p,style:b},j){const S=d==="mission";return a.jsx("textarea",{ref:j,value:c,placeholder:o,onKeyDown:m,onPaste:y,onFocus:x,onBlur:p,onChange:z=>u?.(z.target.value),style:{width:"100%",boxSizing:"border-box",display:"block",minHeight:S?180:void 0,height:S?void 0:56,resize:"vertical",background:f?"transparent":S?"var(--bg-card)":"var(--bg-inset)",border:f?"none":"1px solid var(--line-strong)",outline:f?"none":void 0,borderRadius:f?0:S?"var(--r-md)":"var(--r-sm)",padding:S?"var(--sp-3)":"var(--sp-2)",color:"var(--ink-0)",lineHeight:S?"var(--lh-prose)":"var(--lh)",...b}})});function hr(i){return new Date(i).toLocaleTimeString(void 0,{hour12:!1})}const Wc=[1,5,15,30,60,120,300,600,900,1800,3600,7200,21600].map(i=>i*1e3);function R1(i,c){const u=c-i,o=Wc.find(f=>u/f<=6)??Wc[Wc.length-1],d=[];for(let f=Math.ceil(i/o)*o;f<c;f+=o)d.push(f);return{marks:d,step:o}}function O1({agents:i=[],entries:c=[],live:u,selected:o,onSelect:d,onTick:f,height:m=22,style:y}){if(!c.length)return null;const x=Math.min(...c.map(T=>T.ts)),p=Math.max(...c.map(T=>T.ts)),b=u?Math.min(Math.max(Date.now(),p),p+6e4):p,j=Math.max(b-x,1e3),S=T=>`${(T-x)/j*100}%`,z=T=>(T-x)/j*100,{marks:D}=R1(x,x+j),G=i.length?i.map(T=>T.id??T):[...new Set(c.map(T=>T.agent))];return a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"84px 1fr",rowGap:4,columnGap:10,fontSize:"var(--fs-xs)",color:"var(--ink-2)",...y},children:[G.map(T=>{const w=c.filter(B=>B.agent===T);if(!w.length)return null;const R=Math.min(...w.map(B=>B.ts)),H=i.find(B=>(B.id??B)===T)?.status,K=H==="running"&&u?b:Math.max(...w.map(B=>B.ts)),se=o&&o!==T;return a.jsxs(wn.Fragment,{children:[a.jsxs("button",{type:"button",onClick:()=>d?.(T),title:`Filter transcript to ${T}`,style:{display:"flex",alignItems:"center",gap:6,background:"none",border:"none",padding:0,cursor:d?"pointer":"default",color:se?"var(--ink-2)":"var(--ink-1)",font:"inherit",textAlign:"left",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[a.jsx(vn,{agent:T,size:"sm"}),T]}),a.jsxs("div",{style:{position:"relative",height:m,background:"var(--bg-inset)",borderRadius:4,opacity:se?.45:1,overflow:"hidden"},children:[D.map(B=>a.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:S(B),top:0,bottom:0,width:1,background:"var(--line)",opacity:.9}},B)),a.jsx("div",{style:{position:"absolute",left:S(R),width:`calc(${S(K)} - ${S(R)})`,top:6,bottom:6,minWidth:3,background:gr(T),opacity:.15,borderRadius:3}}),w.map(B=>{const q=a.jsx("span",{style:{display:"block",width:B.kind==="text"?3:2,height:B.kind==="text"?m-6:m-14,borderRadius:1,background:B.kind==="error"?"var(--status-critical)":B.kind==="tool"?"var(--ink-0)":gr(T),boxShadow:"0 0 0 1px var(--bg-inset)"}}),I=`${hr(B.ts)} · ${B.title||B.kind}`;return f?a.jsx("button",{type:"button",title:I,"aria-label":`Jump to ${I}`,onClick:()=>f(B),style:{position:"absolute",left:S(B.ts),top:0,bottom:0,width:9,marginLeft:-4,display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",padding:0,cursor:"pointer"},children:q},B.id??B.ts):a.jsx("span",{title:I,style:{position:"absolute",left:S(B.ts),top:B.kind==="text"?3:7,marginLeft:-1},children:q},B.id??B.ts)}),u&&H==="running"&&a.jsx("span",{className:"pulse",style:{position:"absolute",right:0,top:0,bottom:0,width:2,background:"var(--status-good)"}})]})]},T)}),a.jsx("span",{}),a.jsxs("div",{style:{position:"relative",height:16,fontVariantNumeric:"tabular-nums"},children:[a.jsx("span",{style:{position:"absolute",left:0,top:0},children:hr(x)}),D.map(T=>{const w=z(T);return w<12||w>88?null:a.jsx("span",{style:{position:"absolute",left:`${w}%`,top:0,transform:"translateX(-50%)",color:"var(--ink-3, var(--ink-2))"},children:hr(T)},T)}),a.jsx("span",{style:{position:"absolute",right:0,top:0},children:u?"now":hr(b)})]})]})}function N1(i){const c=[];let u=!1;for(const o of String(i||"").split(`
34
+ `)){const d=/^#{1,6}\s+(.*)$/.exec(o.trim());if(d){u=/^DONE\s*WHEN/i.test(d[1]);continue}if(u)continue;const f=/^\s*[-*]\s*\[([ xX])\]\s*(.+)$/.exec(o);f&&c.push({done:f[1]!==" ",text:f[2].trim()})}return c}function U1({doc:i,style:c}){const[u,o]=g.useState(!1),d=i?N1(i):[],f=d.filter(m=>m.done).length;return a.jsxs("section",{style:c,children:[a.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--sp-2)"},children:[a.jsx(kn,{children:"Plan"}),d.length>0&&a.jsxs("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontVariantNumeric:"tabular-nums"},children:[f,"/",d.length]}),i&&a.jsxs("button",{type:"button",onClick:()=>o(!u),style:{marginLeft:"auto",display:"inline-flex",alignItems:"center",gap:4,background:"none",border:"none",cursor:"pointer",color:"var(--ink-2)",fontSize:"var(--fs-xs)",padding:0,font:"inherit"},children:[a.jsx(ae,{name:"raw",size:12}),u?"board":"raw doc"]})]}),d.length>0&&!u&&a.jsx("div",{style:{height:3,background:"var(--bg-inset)",borderRadius:2,marginBottom:6,overflow:"hidden"},children:a.jsx("div",{style:{width:`${f/d.length*100}%`,height:"100%",background:"var(--status-good)",transition:"width var(--dur-meter)"}})}),!i&&a.jsx(Ve,{children:"MISSION.md not written yet."}),i&&!u&&d.map((m,y)=>a.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"var(--sp-2)",padding:"4px 0",fontSize:"var(--fs-sm)",color:m.done?"var(--ink-2)":"var(--ink-0)"},children:[a.jsx(ae,{name:m.done?"done":"idle",size:14,strokeWidth:2,color:m.done?"var(--status-good)":"var(--ink-2)",style:{marginTop:2}}),a.jsx("span",{style:{textDecoration:m.done?"line-through":"none"},children:m.text})]},y)),i&&u&&a.jsx("pre",{style:{fontSize:"var(--fs-xs)",whiteSpace:"pre-wrap",color:"var(--ink-1)",background:"var(--bg-inset)",borderRadius:"var(--r-sm)",padding:"var(--sp-2)",maxHeight:320,overflowY:"auto",fontFamily:"var(--font-mono)",margin:0},children:i})]})}function Fe({label:i,hint:c,layout:u="inline",children:o,style:d}){return u==="stacked"?a.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:5,...d},children:[a.jsx("span",{style:{fontSize:"var(--fs-xs)",fontWeight:"var(--fw-semibold)",letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--ink-2)"},children:i}),o,c&&a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:c})]}):a.jsxs("label",{title:c,style:{display:"flex",alignItems:"center",gap:6,color:"var(--ink-1)",fontSize:"var(--fs-sm)",...d},children:[i,o]})}const H1=/(`[^`\n]+`|<[^<>\n]{1,80}>)/g;function B1(i){const c=[];let u=!1;for(const o of i.split(`
35
+ `)){if(/^```/.test(o)){c.push({text:o,kind:"fence",open:!u}),u=!u;continue}if(u){c.push({text:o,kind:"code"});continue}/^>\s?/.test(o)?c.push({text:o,kind:"quote"}):/^\s*[-*]\s+/.test(o)?c.push({text:o,kind:"list"}):/^#{1,3}\s/.test(o)?c.push({text:o,kind:"heading"}):c.push({text:o,kind:"text"})}return c}function pr(i){return i.split(H1).filter(Boolean).map((c,u)=>c.length>2&&c.startsWith("`")&&c.endsWith("`")?a.jsxs("span",{style:{background:"var(--bg-inset)",boxShadow:"0 0 0 1px var(--line)",borderRadius:3,color:"var(--agent-worker)"},children:[a.jsx("span",{style:{color:"var(--ink-2)"},children:"`"}),c.slice(1,-1),a.jsx("span",{style:{color:"var(--ink-2)"},children:"`"})]},u):c.startsWith("<")&&c.endsWith(">")?a.jsx("span",{style:{background:"var(--brand-wash-strong)",boxShadow:"0 0 0 1px var(--brand)",borderRadius:3},children:c},u):c)}const Bi="var(--sp-3)",$1=g.forwardRef(function({value:c,onChange:u,placeholder:o,minHeight:d=200,maxHeight:f=460,onKeyDown:m,onPaste:y,onFocus:x,onBlur:p,style:b},j){const S=g.useRef(null),z=g.useRef(null);g.useImperativeHandle(j,()=>S.current),g.useEffect(()=>{const w=S.current;w&&(w.style.height="0px",w.style.height=`${Math.max(w.scrollHeight,d)}px`,z.current!=null&&(w.setSelectionRange(z.current,z.current),z.current=null))},[c,d]);const D=w=>{const R=w.target;let H=R.value,K=R.selectionStart;const se=w.nativeEvent?.inputType==="insertText"&&w.nativeEvent?.data==="`",B=H.slice(0,K),q=H.slice(K),I=B.lastIndexOf(`
36
+ `)+1;if(se&&B.slice(I)==="```"&&(q===""||q.startsWith(`
37
+ `))){const W=(B.match(/^```/gm)||[]).length%2===1;W&&(q.match(/^```/gm)||[]).length%2===0?(H=`${B}
38
+
39
+ \`\`\`
40
+ ${q.replace(/^\n/,"")}`,K+=1):W||(H=q.startsWith(`
41
+ `)?H:`${B}
42
+ ${q}`,K+=1),z.current=K}u?.(H)},G=B1(c||""),T={margin:0,padding:Bi,boxSizing:"border-box",width:"100%",font:"inherit",fontSize:"inherit",lineHeight:"var(--lh-prose)",whiteSpace:"pre-wrap",overflowWrap:"break-word",wordBreak:"break-word",tabSize:4};return a.jsxs("div",{style:{position:"relative",overflowY:"auto",maxHeight:f,...b},children:[a.jsxs("div",{"aria-hidden":!0,style:{...T,position:"absolute",inset:0,height:"auto",color:"var(--ink-0)",pointerEvents:"none"},children:[!c&&o&&a.jsx("div",{style:{color:"var(--ink-2)"},children:o}),c&&G.map((w,R)=>{const H=w.kind==="code"||w.kind==="fence";return a.jsx("div",{style:{...H?{background:"var(--bg-inset)",margin:`0 calc(-0.5 * ${Bi})`,padding:`0 calc(0.5 * ${Bi})`}:null,...w.kind==="fence"?{borderRadius:w.open?"6px 6px 0 0":"0 0 6px 6px"}:null,...w.kind==="quote"?{color:"var(--ink-1)",boxShadow:"inset 2px 0 0 var(--agent-worker)",margin:`0 calc(-1 * ${Bi})`,padding:`0 ${Bi}`}:null,...w.kind==="fence"?{color:"var(--ink-2)"}:null,...w.kind==="code"?{color:"var(--ink-1)"}:null},children:w.text===""?"​":w.kind==="fence"?a.jsxs(a.Fragment,{children:[a.jsx("span",{style:{color:"transparent"},children:"```"}),w.text.slice(3)]}):w.kind==="code"?w.text:w.kind==="list"?a.jsxs(a.Fragment,{children:[a.jsx("span",{style:{color:"var(--brand)"},children:/^\s*[-*]\s+/.exec(w.text)[0]}),pr(w.text.replace(/^\s*[-*]\s+/,""))]}):w.kind==="heading"?a.jsxs(a.Fragment,{children:[a.jsx("span",{style:{color:"var(--brand)"},children:/^#{1,3}\s/.exec(w.text)[0]}),pr(w.text.replace(/^#{1,3}\s/,""))]}):w.kind==="quote"?a.jsxs(a.Fragment,{children:[a.jsx("span",{style:{color:"var(--ink-2)"},children:/^>\s?/.exec(w.text)[0]}),pr(w.text.replace(/^>\s?/,""))]}):pr(w.text)},R)})]}),a.jsx("textarea",{ref:S,value:c,onChange:D,spellCheck:!1,onKeyDown:m,onPaste:y,onFocus:x,onBlur:p,style:{...T,position:"relative",display:"block",minHeight:d,resize:"none",overflow:"hidden",background:"transparent",border:"none",outline:"none",color:"transparent",caretColor:"var(--ink-0)"}})]})}),q1=[{id:"fable",label:"Fable",model:"claude-fable-5",cost:4,note:"Frontier. Long-horizon planning and verification."},{id:"opus",label:"Opus",model:"claude-opus-5",cost:3,note:"Deep reasoning for hard refactors."},{id:"sonnet",label:"Sonnet",model:"claude-sonnet-5",cost:2,note:"Balanced. The usual worker."},{id:"haiku",label:"Haiku",model:"claude-haiku-4-5",cost:1,note:"Fast and cheap for reads and mechanical edits."}],kp={id:"",label:"Default",model:"inherits your Claude Code default",cost:0};function L1(i){const[c,u]=g.useState({models:null,loading:!!i,error:null});return g.useEffect(()=>{if(!i)return;let o=!0;return u(f=>({...f,loading:!0})),(typeof i=="string"?fetch(i).then(f=>{if(!f.ok)throw new Error(`${f.status} from ${i}`);return f.json()}).then(f=>f.models||f):Promise.resolve().then(i)).then(f=>o&&u({models:f,loading:!1,error:null})).catch(f=>o&&u({models:null,loading:!1,error:String(f&&f.message||f)})),()=>{o=!1}},[i]),c}function Y1({cost:i}){return i?a.jsx("span",{"aria-label":`cost ${i} of 4`,style:{display:"inline-flex",gap:2},children:[1,2,3,4].map(c=>a.jsx("span",{style:{width:4,height:10,borderRadius:1,background:c<=i?"var(--ink-1)":"var(--line-strong)"}},c))}):a.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:"—"})}function dv(i){return i&&i.providerLabel||"Anthropic"}function G1(i){const c=[];for(const u of i){const o=dv(u);let d=c.find(f=>f.label===o);d||(d={label:o,items:[]},c.push(d)),d.items.push(u)}return c}function Ut({align:i="left",block:c=!1,value:u="",onChange:o,models:d,loading:f,note:m,inheritNote:y,allowDefault:x=!0,disabled:p,style:b}){const[j,S]=g.useState(!1),[z,D]=g.useState(null),[G,T]=g.useState(""),w=g.useRef(null),R=g.useRef(null),H=g.useRef(null),K=y?{...kp,model:y}:kp,se=d||q1,B=[...x?[K]:[],...se],q=B.find(O=>O.id===u)||(u?{id:u,label:u,model:u}:K),I=se.length>6,W=G.trim().toLowerCase(),ue=O=>!W||[O.label,O.model,O.id,O.providerLabel,O.note,O.record].some(ee=>String(ee??"").toLowerCase().includes(W)),ne=I&&W?se.filter(ue):se,de=G1(ne),je=de.length>1;g.useEffect(()=>{if(!j)return;const O=P=>{w.current&&!w.current.contains(P.target)&&S(!1)},ee=P=>{P.key==="Escape"&&S(!1)};return document.addEventListener("mousedown",O),document.addEventListener("keydown",ee),()=>{document.removeEventListener("mousedown",O),document.removeEventListener("keydown",ee)}},[j]),g.useEffect(()=>{if(!j||!R.current)return;const O=R.current.querySelector('[data-selected="true"]');O&&O.scrollIntoView({block:"nearest"})},[j]),g.useEffect(()=>{if(!j){T("");return}H.current?.focus()},[j]);const re=()=>{const O=de[0]?.items[0];O&&(o?.(O.id,O),S(!1))},xe=dv(q),_=q.id&&xe!=="Anthropic";return a.jsxs("div",{ref:w,style:{position:"relative",display:c?"block":"inline-block",...c?{width:"100%"}:{},...b},children:[a.jsxs("button",{type:"button",disabled:p||f,onClick:()=>S(O=>!O),"aria-haspopup":"listbox","aria-expanded":j,style:{display:c?"flex":"inline-flex",alignItems:"center",gap:8,minWidth:150,padding:"6px 8px 6px 10px",...c?{width:"100%",boxSizing:"border-box"}:{},background:"var(--bg-card)",border:`1px solid ${j?"var(--ink-2)":"var(--line-strong)"}`,borderRadius:"var(--r-sm)",color:f?"var(--ink-2)":"var(--ink-0)",cursor:p||f?"default":"pointer",textAlign:"left",transition:"border-color var(--dur-fast) var(--ease)"},children:[a.jsx(ae,{name:f?"loading":"model",size:14,color:"var(--ink-2)"}),a.jsxs("span",{style:{flex:1,display:"inline-flex",alignItems:"center",gap:6,minWidth:0},children:[a.jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:f?"Fetching models…":q.label}),_&&a.jsx("span",{style:{flex:"0 0 auto",fontSize:"var(--fs-xs)",lineHeight:1,padding:"2px 5px",borderRadius:"var(--r-xs, 3px)",background:"var(--bg-hover)",color:"var(--ink-2)",border:"1px solid var(--line)"},children:xe})]}),a.jsx(ae,{name:"chevronDown",size:14,color:"var(--ink-2)"})]}),j&&a.jsxs("div",{role:"listbox",style:{position:"absolute",top:"calc(100% + 4px)",zIndex:20,minWidth:300,...c?{left:0,right:0}:i==="right"?{right:0}:{left:0},background:"var(--bg-panel)",border:"1px solid var(--line-strong)",borderRadius:"var(--r-sm)",boxShadow:"0 8px 24px rgba(0,0,0,0.28)",padding:4,display:"flex",flexDirection:"column"},children:[m&&a.jsx("div",{style:{padding:"6px 10px",fontSize:"var(--fs-xs)",color:"var(--ink-2)",borderBottom:B.length?"1px solid var(--line)":"none"},children:m}),I&&a.jsx("div",{style:{padding:6,borderBottom:"1px solid var(--line)"},children:a.jsx("input",{ref:H,value:G,onChange:O=>T(O.target.value),placeholder:`Filter ${se.length} models…`,"aria-label":"Filter models",onKeyDown:O=>{O.key==="Enter"&&(O.preventDefault(),re())},style:{width:"100%",boxSizing:"border-box",padding:"5px 8px",font:"inherit",fontSize:"var(--fs-sm)",color:"var(--ink-0)",background:"var(--bg-inset)",border:"1px solid var(--line)",borderRadius:"var(--r-sm)",outline:"none"}})}),a.jsxs("div",{ref:R,style:{maxHeight:360,overflowY:"auto",display:"flex",flexDirection:"column"},children:[I&&W&&ne.length===0&&a.jsxs("div",{style:{padding:"10px",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:["No model matches “",G.trim(),"”."]}),x&&!W&&a.jsx(wp,{m:K,selected:q.id===K.id,hover:z===K.id,onHover:D,onClick:()=>{o?.(K.id,K),S(!1)}},K.id),de.map(O=>a.jsxs(wn.Fragment,{children:[je&&a.jsxs("div",{style:{padding:"6px 8px 4px",marginTop:2,fontSize:"var(--fs-xs)",fontWeight:"var(--fw-semibold)",color:"var(--ink-2)",textTransform:"uppercase",letterSpacing:"0.04em",display:"flex",justifyContent:"space-between",position:"sticky",top:0,background:"var(--bg-panel)",zIndex:1},children:[a.jsx("span",{children:O.label}),a.jsx("span",{children:O.items.length})]}),O.items.map(ee=>a.jsx(wp,{m:ee,selected:q.id===ee.id,hover:z===ee.id,onHover:D,onClick:()=>{o?.(ee.id,ee),S(!1)}},ee.id))]},O.label))]})]})]})}function wp({m:i,selected:c,hover:u,onHover:o,onClick:d}){return a.jsxs("button",{type:"button",role:"option","aria-selected":c,"data-selected":c||void 0,onMouseEnter:()=>o(i.id),onMouseLeave:()=>o(null),onClick:d,style:{display:"grid",gridTemplateColumns:"14px 1fr auto",columnGap:10,alignItems:"start",textAlign:"left",padding:"7px 8px",border:"none",borderRadius:4,cursor:"pointer",color:"var(--ink-0)",background:u?"var(--bg-hover)":"transparent",width:"100%"},children:[a.jsx("span",{style:{paddingTop:2},children:c&&a.jsx(ae,{name:"check",size:14,color:"var(--brand)"})}),a.jsxs("span",{style:{display:"flex",flexDirection:"column",gap:1,minWidth:0},children:[a.jsxs("span",{style:{display:"flex",alignItems:"baseline",gap:8},children:[a.jsx("span",{style:{fontWeight:c?"var(--fw-semibold)":"inherit"},children:i.label}),a.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i.model})]}),i.note&&a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:i.note}),i.record&&a.jsx("span",{title:"From Foreman's own run records on this machine",style:{fontSize:"var(--fs-xs)",color:"var(--ink-1)",fontVariantNumeric:"tabular-nums"},children:i.record})]}),a.jsx("span",{style:{paddingTop:3},children:a.jsx(Y1,{cost:i.cost})})]})}Ut.useModels=L1;function yt({checked:i=!1,onChange:c,disabled:u,label:o,size:d="md",style:f}){const[m,y]=g.useState(!1),x=d==="sm"?28:34,p=d==="sm"?16:20,b=p-4;return a.jsx("button",{type:"button",role:"switch","aria-checked":i,"aria-label":o,disabled:u,onClick:()=>c?.(!i),onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1),style:{position:"relative",width:x,height:p,flex:"0 0 auto",padding:0,borderRadius:"var(--r-pill)",border:`1px solid ${i?"var(--brand)":m?"var(--ink-2)":"var(--line-strong)"}`,background:i?"var(--brand)":"var(--bg-inset)",cursor:u?"default":"pointer",opacity:u?.5:1,transition:"background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease)",...f},children:a.jsx("span",{"aria-hidden":!0,style:{position:"absolute",top:1,left:i?x-b-3:1,width:b,height:b,borderRadius:"var(--r-pill)",background:i?"var(--brand-ink)":"var(--ink-1)",transition:"left var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease)"}})})}const W1=`Describe the mission…
43
+
44
+ Say what "done" looks like, name constraints, and flag any decision the director should ask you about before implementing.`,V1=[{id:"bugfix",label:"Bug fix",icon:"Bug",budget:3,director:"",worker:"sonnet",brief:`Fix: <describe the bug and how to reproduce it>
45
+
46
+ Done when: the reproduction no longer fails and a regression test covers it.
47
+ Constraints: no unrelated refactors; keep the public API unchanged.
48
+ Ask me before: changing behaviour that other code depends on.`},{id:"tests",label:"Add tests",icon:"ListChecks",budget:4,director:"",worker:"haiku",brief:`Add tests for: <module or feature>
49
+
50
+ Done when: each public function has at least one happy-path and one edge-case test, and the suite passes.
51
+ Constraints: use the existing test runner and conventions; no new dependencies.
52
+ Ask me before: changing production code to make it testable.`},{id:"refactor",label:"Refactor",icon:"Shuffle",budget:6,director:"fable",worker:"sonnet",brief:`Refactor: <what, and why>
53
+
54
+ Done when: behaviour is unchanged (existing tests pass), the code is <goal, e.g. split into pure functions>, and nothing outside <scope> is touched.
55
+ Constraints: one concern per commit-sized step; keep diffs reviewable.
56
+ Ask me before: renaming anything exported.`},{id:"audit",label:"Audit",icon:"SearchCheck",budget:2,director:"",worker:"haiku",brief:`Audit: <area, e.g. error handling / security / accessibility>
57
+
58
+ Done when: a written report in .foreman/AUDIT.md lists findings ranked by severity with file:line references — no code changes.
59
+ Constraints: read-only; do not modify source files.
60
+ Ask me before: nothing — this mission only reads.`}];function X1(i){if(!i)return"";let c=i.replace(/^\/(Users|home)\/[^/]+/,"~");const u=c.split("/");return u.length>4&&(c=[u[0],u[1],"…",...u.slice(-2)].join("/")),c}function Vc(i){return`foreman:draft:${i||"default"}`}const Xc=i=>`${i.name}:${i.size}`;function zp({children:i}){return a.jsx("kbd",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:18,height:18,padding:"0 4px",boxSizing:"border-box",background:"var(--bg-inset)",border:"1px solid var(--line-strong)",borderRadius:4,color:"var(--ink-1)",fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",lineHeight:1},children:i})}function Qc({icon:i,label:c,active:u,onClick:o}){const[d,f]=g.useState(!1);return a.jsx("button",{type:"button",title:c,"aria-label":c,"aria-pressed":u,onClick:o,onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:26,height:24,padding:0,background:u?"var(--bg-inset)":d?"var(--bg-hover)":"transparent",border:"none",borderRadius:4,color:u||d?"var(--ink-0)":"var(--ink-2)",cursor:"pointer"},children:a.jsx(ae,{name:i,size:14})})}function fv({presets:i=[],value:c=[],onChange:u,style:o}){if(!i.length)return null;const d=f=>{const m=c.includes(f)?c.filter(y=>y!==f):[...c,f];u?.(i.filter(y=>m.includes(y.id)).map(y=>y.id))};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,...o},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-3)",flexWrap:"wrap"},children:[a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",textTransform:"uppercase",letterSpacing:"var(--ls-caps)"},children:"Crew"}),i.map(f=>a.jsxs("span",{title:`${f.brief?`${f.brief}
61
+
62
+ `:""}${f.toolPolicy==="read-only"?"Read-only. ":""}${f.requiredForDone?"Must return PASS before the run counts as done.":"Advisory — its verdict does not hold the run."}`,style:{display:"inline-flex",alignItems:"center",gap:6},children:[a.jsx(yt,{size:"sm",checked:c.includes(f.id),onChange:()=>d(f.id),label:f.name}),a.jsxs("span",{onClick:()=>d(f.id),style:{fontSize:"var(--fs-sm)",color:"var(--ink-1)",cursor:"pointer"},children:[f.name,f.model&&a.jsxs("span",{style:{color:"var(--ink-2)",fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)"},children:[" · ",f.model]})]})]},f.id))]}),a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:"A required reviewer must return PASS on the final diff before the run counts as done."})]})}function Cp({icon:i,label:c,active:u,onClick:o}){return a.jsxs("button",{type:"button",onClick:o,"aria-selected":u,role:"tab",style:{display:"inline-flex",alignItems:"center",gap:5,padding:"0 10px",height:32,background:"none",border:"none",borderBottom:`2px solid ${u?"var(--brand)":"transparent"}`,marginBottom:-1,color:u?"var(--ink-0)":"var(--ink-2)",fontSize:"var(--fs-sm)",fontWeight:u?"var(--fw-semibold)":"inherit",cursor:"pointer"},children:[a.jsx(ae,{name:i,size:13}),c]})}function Q1({folder:i,defaultBudgetUsd:c=5,error:u,errorAction:o,busy:d,templates:f=V1,models:m,modelsLoading:y,modelsNote:x,modelsInheritNote:p,crewPresets:b=[],crew:j,onCrewChange:S,onStart:z,style:D}){const G=g.useMemo(()=>{try{return JSON.parse(localStorage.getItem(Vc(i))||"null")}catch{return null}},[i]),[T,w]=g.useState(G?.mission??""),[R,H]=g.useState(G?.budget??c),[K,se]=g.useState(G?.directorModel??""),[B,q]=g.useState(G?.workerModel??""),[I,W]=g.useState(G?.directorProviderId),[ue,ne]=g.useState(G?.workerProviderId),[de,je]=g.useState(G?.browserTools??!1),[re,xe]=g.useState(j??[]),[_,O]=g.useState(G?"restored":null),[ee,P]=g.useState("write"),[oe,k]=g.useState([]),[V,C]=g.useState(!1),[L,Z]=g.useState(!1),ce=g.useRef(null),be=g.useRef(null);g.useEffect(()=>{const pe=setTimeout(()=>{try{(T.trim()||G)&&(localStorage.setItem(Vc(i),JSON.stringify({mission:T,budget:R,directorModel:K,workerModel:B,browserTools:de})),T.trim()&&O("saved"))}catch{}},400);return()=>clearTimeout(pe)},[T,R,K,B,de,i]);const He=pe=>{w(pe.brief),H(pe.budget),se(pe.director),q(pe.worker),P("write")},ge=()=>{w(""),k([]),O(null);try{localStorage.removeItem(Vc(i))}catch{}},ie=pe=>{const Ie=Array.from(pe||[]);Ie.length&&k(lt=>{const on=new Set(lt.map(Xc));return[...lt,...Ie.filter(ht=>!on.has(Xc(ht)))]})},qe=!d&&T.trim().length>0,le=()=>{qe&&z?.({mission:T.trim(),budget:R,directorModel:K,workerModel:B,directorProviderId:I,workerProviderId:ue,browserTools:de,crew:b.filter(pe=>re.includes(pe.id)).map(pe=>pe.id),attachments:oe})},at=pe=>{const Ie=ce.current;if(!Ie){P("write");return}const lt=Ie.selectionStart??T.length,on=Ie.selectionEnd??lt,ht=T.slice(lt,on);let Xt,Et;if(pe==="code")Xt=`\`${ht||"code"}\``,Et=ht?lt+Xt.length:lt+1;else if(pe==="quote")Xt=(ht||"quoted text").split(`
63
+ `).map(vt=>`> ${vt}`).join(`
64
+ `),Et=ht?lt+Xt.length:lt+2;else{const zn=lt>0&&T[lt-1]!==`
65
+ `?`
66
+ `:"";Xt=`${zn}\`\`\`
67
+ ${ht||""}
68
+ \`\`\`
69
+ `,Et=lt+zn.length+4}const Bl=T.slice(0,lt)+Xt+T.slice(on);w(Bl),P("write"),requestAnimationFrame(()=>{Ie.focus();const zn=ht?Et:Et+(pe==="code"?4:pe==="quote"?11:0);Ie.setSelectionRange(Et,zn)})},ot=V?"var(--brand)":L?"var(--ink-2)":"var(--line-strong)";return a.jsxs("div",{style:{maxWidth:"var(--composer-max)",margin:"var(--sp-5) auto",padding:"0 var(--sp-4)",display:"flex",flexDirection:"column",gap:"var(--sp-3)",...D},children:[a.jsxs("div",{style:{minWidth:0},children:[a.jsx("h2",{style:{margin:0,fontSize:"var(--fs-lg)"},children:"New mission"}),a.jsx("div",{title:i,style:{color:"var(--ink-2)",fontSize:"var(--fs-xs)",fontFamily:"var(--font-mono)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:X1(i)})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:"var(--fs-xs)",color:"var(--ink-2)",marginRight:2},children:[a.jsx(ae,{name:"template",size:12}),"Start from"]}),f.map(pe=>a.jsx(te,{size:"sm",icon:pe.icon,title:`Budget $${pe.budget} · director ${pe.director||"default"} · workers ${pe.worker||"default"}`,onClick:()=>He(pe),children:pe.label},pe.id))]}),a.jsxs("div",{onDragOver:pe=>{pe.preventDefault(),V||C(!0)},onDragLeave:pe=>{pe.currentTarget.contains(pe.relatedTarget)||C(!1)},onDrop:pe=>{pe.preventDefault(),C(!1),ie(pe.dataTransfer.files)},style:{background:"var(--bg-card)",border:`1px solid ${ot}`,borderRadius:"var(--r-md)",overflow:"hidden",boxShadow:V?"0 0 0 3px var(--brand-wash-strong)":"none",transition:"border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease)"},children:[a.jsxs("div",{role:"tablist",style:{display:"flex",alignItems:"center",gap:2,padding:"0 6px",borderBottom:"1px solid var(--line)",background:"var(--bg-panel)"},children:[a.jsx(Cp,{icon:"write",label:"Write",active:ee==="write",onClick:()=>P("write")}),a.jsx(Cp,{icon:"preview",label:"Preview",active:ee==="preview",onClick:()=>P("preview")}),a.jsx("span",{style:{flex:1}}),a.jsx(Qc,{icon:"quote",label:"Quote (> )",onClick:()=>at("quote")}),a.jsx(Qc,{icon:"code",label:"Inline code (`)",onClick:()=>at("code")}),a.jsx(Qc,{icon:"codeBlock",label:"Code block (```)",onClick:()=>at("block")})]}),ee==="write"?a.jsx($1,{ref:ce,value:T,onChange:w,placeholder:W1,minHeight:200,maxHeight:440,onKeyDown:pe=>{(pe.metaKey||pe.ctrlKey)&&pe.key==="Enter"&&(pe.preventDefault(),le())},onPaste:pe=>{pe.clipboardData?.files?.length&&(pe.preventDefault(),ie(pe.clipboardData.files))},onFocus:()=>Z(!0),onBlur:()=>Z(!1)}):a.jsx("div",{style:{minHeight:200,maxHeight:440,overflowY:"auto",padding:"var(--sp-3)",boxSizing:"border-box"},children:T.trim()?a.jsx(Nl,{text:T}):a.jsx("span",{style:{color:"var(--ink-2)"},children:"Nothing to preview yet."})}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap",padding:"6px 8px",borderTop:"1px solid var(--line)",minHeight:36,boxSizing:"border-box"},children:[a.jsx("input",{ref:be,type:"file",multiple:!0,style:{display:"none"},onChange:pe=>{ie(pe.target.files),pe.target.value=""}}),a.jsx(te,{size:"sm",variant:"ghost",icon:"attach",title:"Attach files — or drop them on the editor, or paste an image",onClick:()=>be.current?.click(),children:"Attach"}),oe.map((pe,Ie)=>a.jsx(ev,{name:pe.name,size:pe.size,onRemove:()=>k(lt=>lt.filter((on,ht)=>ht!==Ie))},Xc(pe))),a.jsx("span",{style:{flex:1}}),a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8,fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:[_&&a.jsxs(a.Fragment,{children:[a.jsx(ae,{name:"draft",size:11}),_==="restored"?"Draft restored":"Draft saved"]}),(T||oe.length>0)&&a.jsx("button",{type:"button",onClick:ge,style:{background:"none",border:"none",padding:0,color:"var(--ink-2)",cursor:"pointer",font:"inherit",textDecoration:"underline"},children:"Clear"})]})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"var(--sp-4)",flexWrap:"wrap"},children:[a.jsx(Fe,{layout:"stacked",label:"Budget cap",hint:"Hard stop; the run halts here.",children:a.jsx(Ue,{type:"number",min:1,step:1,width:96,prefix:"$",value:R,onChange:H})}),a.jsx(Fe,{layout:"stacked",label:"Director",hint:"Plans, delegates, verifies.",children:a.jsx(Ut,{value:K,models:m,loading:y,note:x,inheritNote:p,onChange:(pe,Ie)=>{se(pe),W(Ie?.providerId)}})}),a.jsx(Fe,{layout:"stacked",label:"Workers",hint:"Implement. Cheaper models cut cost.",children:a.jsx(Ut,{value:B,models:m,loading:y,note:x,inheritNote:p,onChange:(pe,Ie)=>{q(pe),ne(Ie?.providerId)}})}),a.jsx(Fe,{label:"Browser",hint:"Headless Playwright for the agents — navigate, click, screenshot. Non-local URLs still ask you.",children:a.jsx(yt,{checked:de,onChange:je,label:de?"on":"off"})})]}),a.jsx(fv,{presets:b,value:re,onChange:pe=>{xe(pe),S?.(pe)}}),a.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"var(--sp-3)",flexWrap:"wrap"},children:[u&&a.jsxs(Je,{tone:"error",inline:!0,style:{marginRight:"auto"},children:[u,o&&a.jsx("button",{type:"button",onClick:o.onClick,disabled:d,style:{marginLeft:8,background:"none",border:0,padding:0,font:"inherit",color:"inherit",textDecoration:"underline",cursor:d?"default":"pointer"},children:o.label})]}),a.jsxs("span",{title:"Start the mission with Cmd+Enter from the editor",style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:[a.jsx(zp,{children:"⌘"}),a.jsx(zp,{children:"↵"})]}),a.jsx(te,{variant:"primary",disabled:!qe,onClick:le,children:"Start mission"})]})]})}function K1({questions:i=[],askedAt:c,who:u,onAnswer:o,onFreeText:d,style:f}){const[m,y]=g.useState({}),[x,p]=g.useState(""),[b,j]=g.useState(0),[S,z]=g.useState(!1),D=g.useRef(null),G=i.length===1&&!i[0]?.multi,T=i.every(q=>{const I=m[q.question];return Array.isArray(I)?I.length>0:!!I});g.useEffect(()=>{y({}),p(""),j(0),z(!1)},[i]);const w=g.useMemo(()=>{const q={};for(const I of i){const W=m[I.question];Array.isArray(W)?q[I.question]=W.join(", "):W&&(q[I.question]=W)}return q},[m,i]),R=q=>{S||(z(!0),o?.(q))},H=(q,I)=>{if(S)return;if(q.multi){y(ue=>{const ne=Array.isArray(ue[q.question])?ue[q.question]:[],de=ne.includes(I)?ne.filter(je=>je!==I):[...ne,I];return{...ue,[q.question]:de}});return}const W={...m,[q.question]:I};y(W),G&&R({[q.question]:I})},K=()=>{const q=x.trim();if(!q||S)return;const I=i[Math.min(b,i.length-1)],W={...w,[I.question]:q};if(i.length===1){z(!0),o?.(W);return}z(!0),o?.(W)},se=q=>{if(q.target.tagName==="TEXTAREA"){(q.metaKey||q.ctrlKey)&&q.key==="Enter"&&(q.preventDefault(),K());return}const I=i[b];if(I)if(/^[1-9]$/.test(q.key)){const W=I.options[Number(q.key)-1];W&&(q.preventDefault(),H(I,W.label))}else q.key==="ArrowDown"?(q.preventDefault(),j(W=>Math.min(i.length-1,W+1))):q.key==="ArrowUp"?(q.preventDefault(),j(W=>Math.max(0,W-1))):q.key==="Enter"&&!G&&T&&(q.preventDefault(),R(w))},B=c?Math.max(0,Math.round((Date.now()-c)/6e4)):0;return a.jsxs("div",{ref:D,tabIndex:0,onKeyDown:se,style:{flex:"0 0 auto",outline:"none",background:"var(--bg-card)",border:"1px solid var(--brand)",borderRadius:"var(--r-md)",overflow:"hidden",opacity:S?.6:1,transition:"opacity var(--dur-fast) var(--ease)",...f},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"var(--sp-2) var(--sp-3)",borderBottom:"1px solid var(--line)",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:[a.jsx(ae,{name:"question",size:14,color:"var(--brand)"}),a.jsx("span",{style:{color:"var(--ink-1)",fontWeight:"var(--fw-semibold)"},children:"The foreman asks"}),a.jsx("span",{children:"· pick an answer, or type one"}),B>=1&&a.jsxs("span",{style:{marginLeft:"auto"},children:["waiting ",B,"m"]})]}),i.map((q,I)=>{const W=m[q.question],ue=Array.isArray(W)?W.length>0:!!W,ne=I===b;return a.jsxs("div",{onMouseEnter:()=>j(I),style:{padding:"var(--sp-2) var(--sp-3)",borderBottom:"1px solid var(--line)",background:ne&&i.length>1?"var(--bg-inset)":"transparent"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:6,marginBottom:6,fontSize:"var(--fs-md)",color:"var(--ink-0)"},children:[i.length>1&&a.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",color:ue?"var(--status-ok, var(--brand))":"var(--ink-2)"},children:ue?"✓":`${I+1}.`}),a.jsx("span",{children:q.question}),q.multi&&a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:"choose any"})]}),a.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:q.options.map((de,je)=>{const re=Array.isArray(W)?W.includes(de.label):W===de.label;return a.jsxs("button",{type:"button",disabled:S,onClick:()=>H(q,de.label),title:de.hint||(je===0?"Recommended":void 0),style:{display:"inline-flex",flexDirection:"column",alignItems:"flex-start",gap:2,padding:"6px 10px",borderRadius:"var(--r-sm)",cursor:S?"default":"pointer",font:"inherit",textAlign:"left",maxWidth:360,background:re?"color-mix(in srgb, var(--brand) 16%, transparent)":"var(--bg-inset)",border:`1px solid ${re?"var(--brand)":"var(--line-strong)"}`,color:re?"var(--brand)":"var(--ink-0)",transition:"border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease)"},children:[a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:"var(--fs-sm)"},children:[a.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",minWidth:14,color:re?"var(--brand)":"var(--ink-2)"},children:je+1}),de.label,je===0&&a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontWeight:"var(--fw-normal)"},children:"· recommended"})]}),de.hint&&a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",lineHeight:"var(--lh)"},children:de.hint})]},de.label)})})]},q.question)}),a.jsxs("div",{style:{display:"flex",alignItems:"flex-end",gap:"var(--sp-2)",padding:"var(--sp-2) var(--sp-3)"},children:[a.jsx("textarea",{rows:1,value:x,disabled:S,placeholder:i.length>1?`Something else for question ${b+1}…`:"Something else…",onChange:q=>p(q.target.value),onFocus:()=>{},style:{flex:1,minWidth:0,resize:"none",border:"none",outline:"none",background:"transparent",color:"var(--ink-0)",font:"inherit",lineHeight:"var(--lh)",padding:"4px 0"}}),x.trim()?a.jsx(te,{size:"sm",icon:"send",onClick:K,disabled:S,title:"⌘↵",children:"Send"}):G?null:a.jsx(te,{size:"sm",variant:"primary",onClick:()=>R(w),disabled:S||!T,title:T?"Enter":"Answer every question first",children:"Send answers"})]}),u&&a.jsxs("div",{style:{padding:"0 var(--sp-3) var(--sp-2)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontFamily:"var(--font-mono)"},children:[u.model," · ",String(u.provider).split(" · ")[0]]})]})}function Z1({mission:i,doneWhen:c=[],budgetUsd:u=5,rationale:o,browser:d=!1,directorModel:f="",workerModel:m="",directorProviderId:y,workerProviderId:x,modelRationale:p,models:b,modelsLoading:j,modelsNote:S,modelsInheritNote:z,crewPresets:D=[],crew:G,onCrewChange:T,busy:w,error:R,errorAction:H,onStart:K,onDismiss:se,style:B}){const[q,I]=g.useState(i),[W,ue]=g.useState(u),[ne,de]=g.useState(!!d),[je,re]=g.useState(f||""),[xe,_]=g.useState(m||""),[O,ee]=g.useState(y),[P,oe]=g.useState(x),[k,V]=g.useState(G??[]),C=q!==i||Number(W)!==Number(u);return a.jsxs("section",{style:{background:"var(--bg-card)",border:"1px solid var(--brand)",borderRadius:"var(--r-md)",padding:"var(--sp-4)",display:"flex",flexDirection:"column",gap:"var(--sp-3)",...B},children:[a.jsxs("header",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)"},children:[a.jsx(ae,{name:"orchestration",size:16,color:"var(--brand)"}),a.jsx("span",{style:{fontSize:"var(--fs-lg)",fontWeight:"var(--fw-semibold)"},children:"Proposed mission"}),C&&a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:"edited"})]}),o&&a.jsx("p",{style:{margin:0,fontSize:"var(--fs-sm)",color:"var(--ink-1)"},children:o}),a.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",textTransform:"uppercase",letterSpacing:"var(--ls-caps)"},children:"Brief"}),a.jsx("textarea",{value:q,onChange:L=>I(L.target.value),rows:6,style:{resize:"vertical",minHeight:"6rem",background:"var(--bg-inset)",border:"1px solid var(--line)",borderRadius:"var(--r-sm)",padding:"var(--sp-2) var(--sp-3)",color:"var(--ink-0)",font:"inherit",lineHeight:"var(--lh-prose)",outline:"none"}})]}),c.length>0&&a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",textTransform:"uppercase",letterSpacing:"var(--ls-caps)"},children:"Done when"}),c.map((L,Z)=>a.jsxs("div",{style:{display:"flex",gap:8,alignItems:"flex-start",fontSize:"var(--fs-sm)",color:"var(--ink-1)"},children:[a.jsx("span",{style:{color:"var(--ink-2)",fontFamily:"var(--font-mono)",flex:"0 0 auto"},children:"▢"}),a.jsx("span",{children:L})]},Z))]}),p&&(f||m)&&a.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:6,fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:[a.jsx(ae,{name:"model",size:12}),a.jsxs("span",{children:[a.jsx("span",{style:{color:"var(--ink-1)"},children:"Suggested models —"})," ",p]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"var(--sp-4)",flexWrap:"wrap"},children:[a.jsx(Fe,{layout:"stacked",label:"Budget cap",hint:"Hard stop; the run halts here.",children:a.jsx(Ue,{type:"number",prefix:"$",min:0,step:1,width:96,value:W,onChange:ue})}),a.jsx(Fe,{layout:"stacked",label:"Director",hint:"Plans, delegates, verifies.",children:a.jsx(Ut,{value:je,models:b,loading:j,note:S,inheritNote:z,onChange:(L,Z)=>{re(L),ee(Z?.providerId)}})}),a.jsx(Fe,{layout:"stacked",label:"Workers",hint:"Implement. Cheaper models cut cost.",children:a.jsx(Ut,{value:xe,models:b,loading:j,note:S,inheritNote:z,onChange:(L,Z)=>{_(L),oe(Z?.providerId)}})}),a.jsx(Fe,{label:"Browser",hint:d?"The planner judged the criteria need a browser, so it starts on.":"Headless Playwright for the agents — navigate, click, screenshot. Non-local URLs still ask you.",children:a.jsx(yt,{checked:ne,onChange:de,label:ne?"on":"off"})})]}),a.jsx(fv,{presets:D,value:k,onChange:L=>{V(L),T?.(L)}}),R&&a.jsxs(Je,{tone:"error",inline:!0,children:[R,H&&a.jsx("button",{type:"button",onClick:H.onClick,disabled:w,style:{marginLeft:8,background:"none",border:0,padding:0,font:"inherit",color:"inherit",textDecoration:"underline",cursor:w?"default":"pointer"},children:H.label})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"var(--sp-2)"},children:[a.jsx(te,{variant:"ghost",onClick:se,disabled:w,children:"Not this one"}),a.jsx(te,{variant:"primary",icon:"orchestration",disabled:w||!q.trim(),title:"Starts the mission: a director plans it and workers do the work",onClick:()=>K?.({mission:q.trim(),budget:Number(W)||u,directorModel:je,workerModel:xe,directorProviderId:O,workerProviderId:P,browserTools:ne,crew:D.filter(L=>k.includes(L.id)).map(L=>L.id)}),children:w?"Starting…":"Start mission"})]})]})}const F1=[{value:"next",label:"Next turn",icon:"nextTurn"},{value:"now",label:"Now",icon:"now"}];function J1({agents:i=[],to:c,onTo:u,value:o,onChange:d,timing:f,onTiming:m,onSend:y,disabled:x,disabledReason:p,style:b}){const[j,S]=g.useState(""),[z,D]=g.useState("director"),[G,T]=g.useState("next"),[w,R]=g.useState(!1),[H,K]=g.useState(!1),se=g.useRef(null),B=g.useRef(null),q=o??j,I=d??S,W=c??z,ue=u??D,ne=f??G,de=m??T,je=i.filter(_=>_.status==="running"||_.id==="director"),re=!x&&q.trim().length>0;g.useEffect(()=>{const _=se.current;_&&(_.style.height="auto",_.style.height=Math.min(_.scrollHeight,132)+"px")},[q]),g.useEffect(()=>{if(!w)return;const _=O=>{B.current&&!B.current.contains(O.target)&&R(!1)};return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[w]);const xe=()=>{re&&(y?.(q.trim(),{to:W,timing:ne}),I(""))};return a.jsxs("div",{ref:B,style:{position:"relative",flex:"0 0 auto",background:"var(--bg-card)",border:`1px solid ${H?"var(--brand)":"var(--line-strong)"}`,borderRadius:"var(--r-md)",padding:"var(--sp-2) var(--sp-3)",display:"flex",flexDirection:"column",gap:"var(--sp-2)",opacity:x?.6:1,transition:"border-color var(--dur-fast) var(--ease)",...b},children:[a.jsxs("div",{style:{display:"flex",gap:"var(--sp-2)",alignItems:"flex-start"},children:[a.jsx(ae,{name:"steer",size:15,color:"var(--brand)",style:{marginTop:3,flex:"0 0 auto"}}),a.jsx("textarea",{ref:se,rows:1,value:q,disabled:x,placeholder:x?p||"Nothing is running.":`Steer ${W}… a constraint, a correction, a hint. Not a question reply.`,onChange:_=>I(_.target.value),onFocus:()=>K(!0),onBlur:()=>K(!1),onKeyDown:_=>{(_.metaKey||_.ctrlKey)&&_.key==="Enter"&&(_.preventDefault(),xe())},style:{flex:1,minWidth:0,resize:"none",border:"none",outline:"none",background:"transparent",color:"var(--ink-0)",font:"inherit",lineHeight:"var(--lh)",padding:"2px 0",maxHeight:132}})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",flexWrap:"wrap"},children:[a.jsx(I1,{agent:W,open:w,onClick:()=>!x&&R(_=>!_),disabled:x}),a.jsx(Vt,{size:"sm",tabs:F1,value:ne,onChange:de}),a.jsx("span",{style:{marginLeft:"auto",fontSize:"var(--fs-xs)",color:"var(--ink-2)",whiteSpace:"nowrap"},children:ne==="now"?"Interrupts the current tool call":"Delivered before the next tool call"}),a.jsx(te,{size:"sm",icon:"send",onClick:xe,disabled:!re,title:"⌘↵",children:"Send"})]}),w&&a.jsx("div",{role:"listbox",style:{position:"absolute",left:"var(--sp-3)",bottom:"calc(100% - 4px)",zIndex:10,minWidth:220,background:"var(--bg-panel)",border:"1px solid var(--line-strong)",borderRadius:"var(--r-sm)",boxShadow:"var(--shadow-pop, 0 8px 24px rgba(0,0,0,.35))",padding:4},children:je.map(_=>a.jsx(P1,{agent:_,selected:_.id===W,onSelect:()=>{ue(_.id),R(!1),se.current?.focus()}},_.id))})]})}function I1({agent:i,open:c,onClick:u,disabled:o}){const[d,f]=g.useState(!1);return a.jsxs("button",{type:"button",onClick:u,disabled:o,"aria-haspopup":"listbox","aria-expanded":c,onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),style:{display:"inline-flex",alignItems:"center",gap:6,padding:"3px 8px 3px 6px",borderRadius:"var(--r-pill)",border:"1px solid var(--line)",cursor:o?"default":"pointer",background:c||d?"var(--bg-hover)":"var(--bg-inset)",color:"var(--ink-0)",font:"inherit",fontSize:"var(--fs-xs)"},children:[a.jsx("span",{style:{color:"var(--ink-2)"},children:"to"}),a.jsx(vn,{agent:i,size:"sm"}),a.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:i}),a.jsx(ae,{name:"chevronDown",size:12,color:"var(--ink-2)"})]})}function P1({agent:i,selected:c,onSelect:u}){const[o,d]=g.useState(!1);return a.jsxs("button",{type:"button",role:"option","aria-selected":c,onClick:u,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{display:"flex",alignItems:"center",gap:8,width:"100%",textAlign:"left",padding:"6px 8px",borderRadius:4,border:"none",cursor:"pointer",font:"inherit",background:o?"var(--bg-hover)":"transparent",color:"var(--ink-0)"},children:[a.jsx("span",{style:{width:12,display:"inline-flex",color:"var(--brand)"},children:c&&a.jsx(ae,{name:"check",size:12,strokeWidth:2.5})}),a.jsx(vn,{agent:i.id,size:"sm"}),a.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-sm)"},children:i.id}),i.task&&a.jsx("span",{style:{marginLeft:"auto",fontSize:"var(--fs-xs)",color:"var(--ink-2)",maxWidth:140,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i.task})]})}function eb({agents:i=[],filter:c,onFilter:u,style:o}){return a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap",...o},children:[a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:"var(--fs-xs)",color:"var(--ink-2)",marginRight:2},children:[a.jsx(ae,{name:"crew",size:12}),"Crew"]}),i.map(d=>{const f=c===d.id;return a.jsxs("button",{type:"button",onClick:()=>u?.(d.id),title:d.task||d.id,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"2px 8px 2px 6px",borderRadius:"var(--r-pill)",background:f?"var(--bg-card)":"var(--bg-inset)",border:`1px solid ${f?"var(--line-strong)":"var(--line)"}`,color:f?"var(--ink-0)":"var(--ink-1)",fontSize:"var(--fs-xs)",cursor:"pointer",font:"inherit",lineHeight:"16px"},children:[a.jsx(vn,{agent:d.id,size:"sm"}),d.id,a.jsx(ae,{name:d.status||"running",size:11,strokeWidth:2.25,color:d.status==="error"?"var(--status-critical)":d.status==="interrupted"?"var(--status-serious)":d.status==="idle"?"var(--ink-2)":"var(--status-good)"})]},d.id)})]})}function tb({mission:i,title:c,createdAt:u,costUsd:o=0,costBasis:d="priced",usage:f,status:m="done",selected:y,current:x,onSelect:p,style:b}){const[j,S]=g.useState(!1),z=Number(o)||0,D=f?(f.inputTokens||0)+(f.outputTokens||0)+(f.cacheReadTokens||0)+(f.cacheWriteTokens||0):0,G=d==="priced"?`$${z.toFixed(2)}`:d==="unpriced"&&D>0?`${Za(D)} tok`:null,T=u?new Date(u).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):null;return a.jsxs("div",{role:"button",title:i,onClick:p,onMouseEnter:()=>S(!0),onMouseLeave:()=>S(!1),style:{padding:"6px 10px",borderRadius:"var(--r-sm)",cursor:p?"pointer":"default",background:y?"var(--bg-card)":j&&p?"var(--bg-hover)":"transparent",border:y?"1px solid var(--line-strong)":"1px solid transparent",marginBottom:2,transition:"background var(--dur-fast) var(--ease)",...b},children:[a.jsx("div",{style:{fontSize:"var(--fs-sm)",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",color:"var(--ink-0)",fontWeight:x?"var(--fw-semibold)":"var(--fw-regular)"},children:c||i}),a.jsxs("div",{style:{display:"flex",gap:"var(--sp-2)",alignItems:"center",marginTop:2,fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontVariantNumeric:"tabular-nums"},children:[T&&a.jsx("span",{children:T}),G&&a.jsx("span",{title:d==="unpriced"?"This provider publishes no prices; tokens are what is known.":void 0,children:G}),a.jsx(ja,{status:m})]})]})}function nb({agent:i,title:c,toolName:u,decisionReason:o,input:d,escapedPath:f,onAllow:m,onAlways:y,onDeny:x,style:p}){const b=u||(c||"").replace(/^Wants to use\s+/i,"")||"tool",j=f?{label:"Allow this path (run)",hint:`Allow ${f} for the rest of the run; other paths outside the folder will still ask`}:{label:"Always (run)",hint:"Allow this tool for the rest of the run"};return a.jsxs(xr,{accent:"var(--brand)",style:{marginBottom:"var(--sp-2)",...p},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontWeight:"var(--fw-semibold)",color:"var(--brand)",fontSize:"var(--fs-sm)"},children:[a.jsx(ae,{name:"approval",size:14,strokeWidth:2}),a.jsxs("span",{children:[i," wants to use ",b]})]}),o&&a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5,color:"var(--status-serious)",fontSize:"var(--fs-xs)",marginTop:4},children:[a.jsx(ae,{name:"caution",size:12,strokeWidth:2}),o]}),a.jsx(av,{tool:b,input:typeof d=="string"?void 0:d,body:typeof d=="string"?d:void 0,defaultOpen:!0,style:{margin:"var(--sp-2) 0"}}),a.jsxs("div",{style:{display:"flex",gap:"var(--sp-2)",flexWrap:"wrap",justifyContent:"flex-end"},children:[a.jsx(te,{variant:"good",onClick:m,children:"Allow"}),a.jsx(te,{variant:"good",onClick:y,title:j.hint,children:j.label}),a.jsx(te,{variant:"danger",onClick:x,children:"Deny"})]})]})}function ab({question:i,options:c=[],value:u,onChange:o,onAnswer:d,style:f}){const[m,y]=g.useState(""),x=u??m,p=o??y;return a.jsxs(xr,{accent:"var(--brand)",style:{marginBottom:"var(--sp-2)",...f},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontWeight:"var(--fw-semibold)",color:"var(--brand)",fontSize:"var(--fs-sm)",marginBottom:4},children:[a.jsx(ae,{name:"question",size:14,strokeWidth:2}),"Director asks:"]}),a.jsx("div",{style:{whiteSpace:"pre-wrap",fontSize:"var(--fs-md)"},children:i}),c.length>0&&a.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6,margin:"var(--sp-2) 0 0"},children:c.map((b,j)=>a.jsxs("button",{type:"button",onClick:()=>d?.(b),title:j===0?"Recommended":void 0,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"6px 10px",borderRadius:"var(--r-sm)",cursor:"pointer",font:"inherit",fontSize:"var(--fs-sm)",background:"var(--bg-inset)",border:"1px solid var(--line-strong)",color:"var(--ink-0)"},children:[a.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:j+1}),b,j===0&&a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:"· recommended"})]},b))}),a.jsx("div",{style:{margin:"var(--sp-2) 0"},children:a.jsx(Sr,{size:"answer",value:x,onChange:p})}),a.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:a.jsx(te,{variant:"primary",onClick:()=>d?.(x),disabled:!String(x).trim(),children:"Answer"})})]})}function lb(i,c){if(!i)return"";const u=Math.max(0,Math.round((c-i)/1e3));return u<60?`${u}s`:u<3600?`${Math.floor(u/60)}m`:`${Math.floor(u/3600)}h ${Math.floor(u%3600/60)}m`}function Tp({since:i,now:c}){const u=lb(i,c);return u?a.jsxs("div",{style:{fontSize:"var(--fs-xs)",color:"var(--status-warning)",fontWeight:"var(--fw-semibold)",marginBottom:4},children:["waiting ",u]}):null}function ib({approvals:i=[],questions:c=[],now:u=Date.now(),running:o=!1,activity:d,onAllow:f,onAlways:m,onDeny:y,onAnswer:x,style:p}){const b=i.length+c.length;if(b===0&&!o||b===0&&!d)return null;const j={flex:"0 0 auto",padding:"var(--sp-2) var(--sp-3)",borderBottom:"1px solid var(--line)",...p};return b===0?a.jsxs("div",{role:"status",style:{...j,display:"flex",alignItems:"center",gap:"var(--sp-2)",background:"var(--bg-panel)",fontSize:"var(--fs-sm)",minWidth:0},children:[a.jsx(ae,{name:"running",size:14,color:"var(--status-good)",strokeWidth:2}),d.agent&&a.jsx(vn,{agent:d.agent,size:"sm"}),a.jsx("span",{style:{color:"var(--ink-0)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},title:d.line,children:d.line}),d.crew&&a.jsx("span",{style:{marginLeft:"auto",flex:"0 0 auto",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:d.crew})]}):a.jsxs("div",{role:"region","aria-label":"Needs you",style:{...j,background:"var(--brand-wash-strong)",borderTop:"2px solid var(--status-warning)",display:"flex",flexDirection:"column",gap:"var(--sp-2)",maxHeight:"55vh",overflowY:"auto"},children:[a.jsxs("div",{className:"pulse",style:{display:"flex",alignItems:"center",gap:6,fontSize:"var(--fs-xs)",color:"var(--status-warning)",fontWeight:"var(--fw-semibold)",textTransform:"uppercase",letterSpacing:"var(--ls-caps)"},children:[a.jsx(ae,{name:"needsYou",size:13,strokeWidth:2.25}),"Needs you — ",[i.length?`${i.length} approval${i.length===1?"":"s"}`:null,c.length?`${c.length} question${c.length===1?"":"s"}`:null].filter(Boolean).join(", ")]}),i.map(S=>a.jsxs("div",{children:[a.jsx(Tp,{since:S.since,now:u}),a.jsx(nb,{agent:S.agent,title:S.title,toolName:S.toolName,decisionReason:S.decisionReason,input:S.input,escapedPath:S.escapedPath,onAllow:()=>f?.(S.id),onAlways:()=>m?.(S.id),onDeny:()=>y?.(S.id)})]},S.id)),c.map(S=>a.jsxs("div",{children:[a.jsx(Tp,{since:S.since,now:u}),a.jsx(ab,{question:S.question,options:S.options,onAnswer:z=>x?.(S.id,z)})]},S.id))]})}function hv(i){if(!i)return null;const c=String(i).split(`
70
+ `),u=c.findIndex(d=>/^#{1,6}\s*DONE\s*WHEN/i.test(d.trim()));if(u===-1)return null;const o=[];for(const d of c.slice(u+1)){if(/^#{1,6}\s/.test(d))break;const f=d.match(/^\s*[-*]\s*\[( |x|X)\]\s*(.*)$/);if(!f)continue;const m=f[2].trim().replace(/\*\*(.+?)\*\*/g,"$1").replace(/`([^`]*)`/g,"$1");o.push({text:m,done:f[1]!==" "})}return o.length?o:null}function sb(i){return i?`Done when · ${i.filter(c=>c.done).length} / ${i.length}`:"Done when"}function rb({doc:i,style:c}){const u=hv(i),o=u?u.filter(d=>d.done).length:0;return a.jsxs("section",{style:c,children:[a.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--sp-2)",marginBottom:"var(--sp-2)",fontSize:"var(--fs-xs)",fontWeight:"var(--fw-semibold)",textTransform:"uppercase",letterSpacing:"var(--ls-caps)",color:"var(--ink-2)"},children:[a.jsx("span",{children:"Done when"}),u&&a.jsxs("span",{style:{fontVariantNumeric:"tabular-nums",textTransform:"none",letterSpacing:0,color:o===u.length?"var(--status-good)":"var(--ink-1)"},children:[o," / ",u.length]})]}),!i&&a.jsx(Ve,{children:"MISSION.md not written yet."}),i&&!u&&a.jsx(Ve,{children:"No DONE WHEN section in the mission doc."}),u&&u.map((d,f)=>a.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"var(--sp-2)",padding:"3px 0",fontSize:"var(--fs-sm)",lineHeight:"var(--lh)",color:d.done?"var(--ink-2)":"var(--ink-0)"},children:[a.jsx(ae,{name:d.done?"done":"idle",size:14,strokeWidth:2,color:d.done?"var(--status-good)":"var(--ink-2)",style:{marginTop:2}}),a.jsx("span",{style:{textDecoration:d.done?"line-through":"none"},children:d.text})]},f))]})}function ob({text:i,truncated:c,style:u}){const o=String(i||"").split(`
71
+ `);return a.jsxs("div",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",lineHeight:"var(--lh)",background:"var(--bg-inset)",overflowX:"auto",...u},children:[o.map((d,f)=>{const m=d.startsWith("@@")||d.startsWith("diff ")||d.startsWith("index ")||d.startsWith("--- ")||d.startsWith("+++ "),y=!m&&d.startsWith("+"),x=!m&&d.startsWith("-");return a.jsx("div",{style:{padding:"0 var(--sp-2)",whiteSpace:"pre",background:y?"var(--diff-add-bg)":x?"var(--diff-del-bg)":"transparent",color:m?"var(--ink-2)":"var(--ink-0)"},children:d||" "},f)}),c&&a.jsx("div",{style:{padding:"2px var(--sp-2)",color:"var(--ink-2)",fontFamily:"var(--font-ui)"},children:"first 400 lines — the rest is in your working tree"})]})}const Kc=512*1024;function lu({artifact:i,url:c,previewUrl:u,onClose:o,index:d,count:f,onStep:m}){const y=/\.html?$/i.test(i?.path??""),[x,p]=g.useState("rendered"),b=typeof m=="function"&&typeof f=="number"&&f>1,j=b&&d>0?()=>m(d-1):null,S=b&&d<f-1?()=>m(d+1):null,[z,D]=g.useState(null),[G,T]=g.useState(null),w=i?.kind,R=w==="diff",H=i?.path?.split("/").pop()??"",K=/\.md$/i.test(H);if(g.useEffect(()=>{const I=W=>{W.key==="Escape"?o():W.key==="ArrowLeft"&&j?(W.preventDefault(),j()):W.key==="ArrowRight"&&S&&(W.preventDefault(),S())};return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[o,j,S]),g.useEffect(()=>{if(D(null),T(null),w!=="text"||!c)return;let I=!0;return fetch(c).then(async W=>{if(!W.ok)throw new Error(`HTTP ${W.status}`);const ue=await W.text();I&&D(ue.length>Kc?`${ue.slice(0,Kc)}
72
+
73
+ [… ${ue.length-Kc} more characters — open in a new tab for the whole file]`:ue)}).catch(W=>{I&&T(String(W.message||W))}),()=>{I=!1}},[c,w]),!i)return null;const se=typeof i.size!="number"?null:i.size>=1024*1024?`${(i.size/1024/1024).toFixed(1)} MB`:i.size>=1024?`${(i.size/1024).toFixed(1)} KB`:`${i.size} B`;let B;return R&&i.binary&&c&&/\.(png|jpe?g|webp|gif|svg)$/i.test(H)?B=a.jsx("img",{src:c,alt:i.path,style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain",display:"block",margin:"auto",background:"var(--bg-inset)"}}):R?B=i.binary?a.jsx("div",{style:{margin:"auto",color:"var(--ink-2)"},children:"Binary file — no diff to show."}):i.diff?a.jsx(ob,{text:i.diff,truncated:i.truncated,style:{minHeight:"100%"}}):a.jsx("div",{style:{margin:"auto",color:"var(--ink-2)"},children:"No diff recorded for this file."}):y&&u&&x==="rendered"?B=a.jsx("iframe",{title:i.path,src:u,sandbox:"allow-scripts",style:{width:"100%",height:"100%",border:"none",background:"#fff"}}):w==="image"?B=a.jsx("img",{src:c,alt:i.path,style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain",display:"block",margin:"auto",background:"var(--bg-inset)"}}):w==="pdf"?B=a.jsx("iframe",{title:i.path,src:c,style:{width:"100%",height:"100%",border:"none",background:"var(--bg-inset)"}}):w==="text"?B=G?a.jsxs("div",{style:{padding:"var(--sp-3)",color:"var(--status-critical)"},children:["Could not load it: ",G]}):z===null?a.jsx("div",{style:{padding:"var(--sp-3)",color:"var(--ink-2)"},children:"Loading…"}):K?a.jsx("div",{style:{padding:"var(--sp-3) var(--sp-4)",maxWidth:"72ch",margin:"0 auto"},children:a.jsx(Nl,{text:z,slots:!1})}):a.jsx("pre",{style:{margin:0,padding:"var(--sp-3) var(--sp-4)",fontFamily:"var(--font-mono)",fontSize:"var(--fs-sm)",lineHeight:1.5,whiteSpace:"pre-wrap",wordBreak:"break-word",color:"var(--ink-0)",tabSize:2},children:z}):B=a.jsxs("div",{style:{margin:"auto",textAlign:"center",color:"var(--ink-2)",display:"flex",flexDirection:"column",gap:"var(--sp-2)",alignItems:"center"},children:[a.jsx(ae,{name:"file",size:28,color:"var(--ink-3)"}),a.jsx("span",{children:"No preview for this kind of file."}),a.jsxs("a",{href:c,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--brand)"},children:["Download ",H]})]}),a.jsx("div",{role:"dialog","aria-modal":"true","aria-label":i.path,onClick:o,style:{position:"fixed",inset:0,zIndex:1e3,background:"rgba(0,0,0,0.55)",display:"flex",alignItems:"center",justifyContent:"center",padding:"var(--sp-4)"},children:a.jsxs("div",{onClick:I=>I.stopPropagation(),style:{width:"min(1200px, 100%)",height:"min(900px, 100%)",display:"flex",flexDirection:"column",background:"var(--bg-card)",border:"1px solid var(--line-strong)",borderRadius:"var(--r-md)",boxShadow:"0 24px 64px rgba(0,0,0,0.35)",overflow:"hidden"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"6px var(--sp-2) 6px var(--sp-3)",borderBottom:"1px solid var(--line)",background:"var(--bg-panel)",flex:"0 0 auto",minWidth:0},children:[a.jsx(ae,{name:w==="image"?"Image":w==="text"?"transcript":"file",size:14,color:"var(--ink-2)"}),R&&i.status&&a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",flex:"0 0 auto"},children:i.status}),a.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-sm)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,flex:1},title:i.path,children:i.path}),R?a.jsxs("span",{style:{fontSize:"var(--fs-xs)",fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums",flex:"0 0 auto"},children:[a.jsxs("span",{style:{color:"var(--status-good)"},children:["+",i.additions??0]})," ",a.jsxs("span",{style:{color:"var(--status-critical)"},children:["−",i.deletions??0]})]}):se&&a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontVariantNumeric:"tabular-nums",flex:"0 0 auto"},children:se}),y&&u&&a.jsx(Vt,{size:"sm",value:x,onChange:p,tabs:[{value:"rendered",label:"Rendered"},{value:"source",label:"Source"}]}),b&&a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:2,flex:"0 0 auto",marginLeft:"var(--sp-1)"},children:[a.jsx(Sa,{icon:"chevronLeft",label:"Previous (←)",onClick:j??void 0,disabled:!j,size:"sm"}),a.jsxs("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontVariantNumeric:"tabular-nums",minWidth:"4.5ch",textAlign:"center"},children:[d+1," / ",f]}),a.jsx(Sa,{icon:"chevronRight",label:"Next (→)",onClick:S??void 0,disabled:!S,size:"sm"})]}),c&&!R&&a.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",style:{textDecoration:"none",flex:"0 0 auto"},children:a.jsx(te,{variant:"ghost",size:"sm",children:"Open in a new tab"})}),a.jsx(Sa,{icon:"close",label:"Close (Esc)",onClick:o,size:"sm"})]}),a.jsx("div",{style:{flex:1,minHeight:0,overflow:"auto",display:"flex",flexDirection:"column",background:w==="image"?"var(--bg-inset)":"var(--bg-card)"},children:B})]})})}function Zc(i){return i<1024?`${i} B`:i<1024*1024?`${(i/1024).toFixed(i<10*1024?1:0)} KB`:`${(i/1024/1024).toFixed(1)} MB`}function Mp(i,c){return`${i}/preview/${c.split("/").map(encodeURIComponent).join("/")}`}function Fc(i,c){return`${i}/artifact?path=${encodeURIComponent(c)}`}const cb={image:"image",text:"transcript",pdf:"file",other:"file"};function pv(i,c){const u=c?`${c}/`:"",o=new Map,d=[];for(const y of i){if(!y.path.startsWith(u))continue;const x=y.path.slice(u.length),p=x.indexOf("/");if(p<0){d.push(y);continue}const b=x.slice(0,p),j=o.get(b)??{name:b,count:0,sub:new Set};j.count+=1;const S=x.slice(p+1),z=S.indexOf("/");j.sub.add(z<0?"":S.slice(0,z)),o.set(b,j)}const f=(y,x)=>y.localeCompare(x,void 0,{sensitivity:"base",numeric:!0}),m=[...o.values()].sort((y,x)=>f(y.name,x.name)).map(y=>{let x=y.name,p=`${u}${y.name}`,b=y;for(;b.sub.size===1&&!b.sub.has("");){const[j]=[...b.sub],S=pv(i,p).dirs.find(z=>z.name===j);if(!S)break;x=`${x}/${j}`,p=`${p}/${j}`,b={sub:S.sub}}return{name:y.name,label:x,path:p,count:y.count,sub:y.sub}});return d.sort((y,x)=>f(y.path,x.path)),{dirs:m,files:d}}const ub={display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"5px 6px",width:"100%",fontSize:"var(--fs-sm)",color:"inherit",minWidth:0,background:"none",border:"none",borderRadius:"var(--r-sm)",cursor:"pointer",font:"inherit",textAlign:"left"};function Jc({onClick:i,title:c,children:u}){const[o,d]=g.useState(!1);return a.jsx("button",{type:"button",onClick:i,title:c,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{...ub,background:o?"var(--bg-hover)":"none"},children:u})}const Ic={fontFamily:"var(--font-mono)",flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--ink-0)"},Ep={fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontVariantNumeric:"tabular-nums",flex:"0 0 auto"};function db(i){if(!i?.length)return"";let c=i[0].path.split("/").slice(0,-1);for(const u of i){const o=u.path.split("/").slice(0,-1);let d=0;for(;d<c.length&&d<o.length&&c[d]===o[d];)d++;if(c=c.slice(0,d),!c.length)break}return c.join("/")}const _p=9;function iu({files:i,truncated:c,loading:u,error:o,onRefresh:d,urlBase:f,initialDir:m="",summary:y,images:x=!0,style:p}){const[b,j]=g.useState(m),[S,z]=g.useState(null),[D,G]=g.useState(!1),[T,w]=g.useState(null),R=g.useMemo(()=>pv(i??[],b),[i,b]),H=g.useMemo(()=>x?(i??[]).filter(W=>W.kind==="image").sort((W,ue)=>(ue.mtimeMs??0)-(W.mtimeMs??0)):[],[i,x]),K=D?H:H.slice(0,_p),se={display:"flex",flexDirection:"column",gap:"var(--sp-2)",...p};if(o)return a.jsx("div",{style:se,children:a.jsxs(Ve,{children:["Could not list the folder: ",o]})});if(u&&!i?.length)return a.jsx("div",{style:se,children:a.jsx(Ve,{children:"Reading the folder…"})});const B=b?b.split("/"):[],q=S===null?null:R.files[S]??null,I=i?.length??0;return a.jsxs("div",{style:se,children:[y!==null&&a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",lineHeight:"var(--lh)"},children:[a.jsx("span",{style:{flex:1,minWidth:0},children:y??a.jsxs(a.Fragment,{children:[a.jsxs("span",{style:{color:"var(--ink-0)"},children:[I," file",I===1?"":"s"]})," in the folder as it stands · every run here shares them"]})}),d&&a.jsx("button",{type:"button",onClick:d,title:"Read the folder again",disabled:u,style:{background:"none",border:"none",padding:2,cursor:"pointer",color:"var(--ink-2)",display:"inline-flex"},children:a.jsx(ae,{name:u?"loading":"resume",size:13})})]}),c&&a.jsx("div",{style:{fontSize:"var(--fs-xs)",color:"var(--status-serious)"},children:"A large folder: only the first 2000 files are listed."}),H.length>0&&a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[a.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(88px, 1fr))",gap:6},children:K.map((W,ue)=>a.jsxs("button",{type:"button",onClick:()=>w(ue),title:`${W.path} · ${Zc(W.size)}`,style:{display:"block",padding:0,width:"100%",cursor:"pointer",font:"inherit",border:"1px solid var(--line)",borderRadius:"var(--r-sm)",overflow:"hidden",background:"var(--bg-inset)",color:"inherit",textAlign:"left"},children:[a.jsx("img",{src:Fc(f,W.path),alt:W.path,loading:"lazy",style:{display:"block",width:"100%",aspectRatio:"4 / 3",objectFit:"cover"}}),a.jsx("div",{style:{padding:"2px 5px",fontSize:"var(--fs-xs)",fontFamily:"var(--font-mono)",color:"var(--ink-1)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:W.path.split("/").pop()})]},W.path))}),H.length>_p&&a.jsx("button",{type:"button",onClick:()=>G(W=>!W),style:{alignSelf:"flex-start",background:"none",border:"none",padding:"0 2px",cursor:"pointer",font:"inherit",fontSize:"var(--fs-xs)",color:"var(--ink-2)",textDecoration:"underline"},children:D?"Fewer images":`All ${H.length} images`})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:2,padding:"4px 6px",border:"1px solid var(--line)",borderRadius:"var(--r-sm)",background:"var(--bg-inset)",fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",minWidth:0},children:[a.jsxs("button",{type:"button",onClick:()=>j(""),title:"The project folder",style:{background:"none",border:"none",padding:"1px 3px",cursor:b?"pointer":"default",color:b?"var(--ink-2)":"var(--ink-0)",display:"inline-flex",alignItems:"center",gap:4,font:"inherit"},children:[a.jsx(ae,{name:"folder",size:12}),!b&&a.jsx("span",{children:"/"})]}),B.map((W,ue)=>{const ne=ue===B.length-1,de=B.slice(0,ue+1).join("/");return a.jsxs(wn.Fragment,{children:[a.jsx("span",{style:{color:"var(--ink-2)"},children:"/"}),a.jsx("button",{type:"button",onClick:()=>j(de),disabled:ne,style:{background:"none",border:"none",padding:"1px 3px",cursor:ne?"default":"pointer",color:ne?"var(--ink-0)":"var(--ink-2)",font:"inherit",fontWeight:ne?"var(--fw-semibold)":"inherit"},children:W})]},de)})]}),a.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[b&&a.jsxs(Jc,{onClick:()=>j(B.slice(0,-1).join("/")),title:"Up one level",children:[a.jsx(ae,{name:"parent",size:13,color:"var(--ink-2)"}),a.jsx("span",{style:{...Ic,color:"var(--ink-2)"},children:".."})]}),R.dirs.map(W=>a.jsxs(Jc,{onClick:()=>j(W.path),title:`${W.path}/ · ${W.count} file${W.count===1?"":"s"}`,children:[a.jsx(ae,{name:"folder",size:13,color:"var(--brand)"}),a.jsx("span",{style:Ic,children:W.label}),a.jsx("span",{style:Ep,children:W.count}),a.jsx(ae,{name:"chevronRight",size:12,color:"var(--ink-2)"})]},W.path)),R.files.map((W,ue)=>a.jsxs(Jc,{onClick:()=>z(ue),title:`${W.path} · ${Zc(W.size)}`,children:[a.jsx(ae,{name:cb[W.kind]||"file",size:13,color:"var(--ink-2)"}),a.jsx("span",{style:Ic,children:W.path.slice(W.path.lastIndexOf("/")+1)}),a.jsx("span",{style:Ep,children:Zc(W.size)})]},W.path)),R.dirs.length===0&&R.files.length===0&&a.jsx(Ve,{children:b?"Nothing here.":"The folder is empty."})]}),T!==null&&K[T]&&a.jsx(lu,{artifact:K[T],url:Fc(f,K[T].path),previewUrl:Mp(f,K[T].path),onClose:()=>w(null),index:T,count:K.length,onStep:w}),q&&a.jsx(lu,{artifact:q,url:Fc(f,q.path),previewUrl:Mp(f,q.path),onClose:()=>z(null),index:S,count:R.files.length,onStep:z})]})}const fb={added:"added",modified:"modified",deleted:"deleted",renamed:"renamed"},Ap={added:"var(--status-good)",deleted:"var(--status-critical)",modified:"var(--ink-1)",renamed:"var(--ink-1)"};function hb(i,c){return`${i}/artifact?path=${encodeURIComponent(c)}`}function pb({path:i,muted:c,strike:u}){const o=i.lastIndexOf("/"),d=o>=0?i.slice(0,o+1):"",f=o>=0?i.slice(o+1):i;return a.jsxs("span",{title:i,style:{fontFamily:"var(--font-mono)",display:"flex",minWidth:0,flex:1,color:c?"var(--ink-2)":"var(--ink-0)",textDecoration:u?"line-through":"none"},children:[d&&a.jsx("span",{style:{color:"var(--ink-2)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,flex:"0 1 auto"},children:d}),a.jsx("span",{style:{whiteSpace:"nowrap",flex:"0 0 auto"},children:f})]})}const vv={display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"4px 6px",width:"100%",fontSize:"var(--fs-sm)",color:"inherit",minWidth:0,background:"none",border:"none",borderRadius:"var(--r-sm)",cursor:"pointer",font:"inherit",textAlign:"left"};function vb({onClick:i,title:c,children:u}){const[o,d]=g.useState(!1);return a.jsx("button",{type:"button",onClick:i,title:c,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{...vv,background:o?"var(--bg-hover)":"none"},children:u})}function mb({runId:i,deck:c,loading:u,error:o,missing:d,services:f=[],urlBase:m,tree:y,style:x}){const p=m??`/runs/${encodeURIComponent(i)}`,[b,j]=g.useState(null),S={display:"flex",flexDirection:"column",gap:"var(--sp-3)",...x};if(o)return a.jsx("div",{style:S,children:a.jsxs(Ve,{children:["Could not read the working tree: ",o]})});if(d||!c&&!u)return a.jsx("div",{style:S,children:a.jsx(Ve,{children:"No file record for this run — the server has no baseline for it."})});if(!c)return a.jsx("div",{style:S,children:a.jsx(Ve,{children:"Reading the working tree…"})});const{files:z,artifacts:D,totals:G}=c,T=z.map(B=>({...B,kind:"diff"})),w=B=>j(B),R=b===null?null:T[b]??null,H=new Set((y?.files??[]).map(B=>B.path)),K=[...y?.files??[],...D.filter(B=>!H.has(B.path))],se=(c.baseline.kind==="git"&&c.baseline.head?`against ${String(c.baseline.head).slice(0,8)}`:c.baseline.kind==="snapshot"?"against a snapshot at run start":"no baseline")+(c.frozenAt?` · as it ended ${new Date(c.frozenAt).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}`:"");return a.jsxs("div",{style:S,children:[a.jsxs("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontVariantNumeric:"tabular-nums",lineHeight:"var(--lh)"},children:[a.jsxs("span",{style:{color:"var(--ink-0)"},children:[G.files," changed · ",a.jsxs("span",{style:{color:"var(--status-good)"},children:["+",G.additions]})," ",a.jsxs("span",{style:{color:"var(--status-critical)"},children:["−",G.deletions]})," · ",D.length," artifact",D.length===1?"":"s"]})," ",a.jsx("span",{children:se}),c.note&&a.jsx("div",{style:{color:"var(--status-serious)"},children:c.note})]}),f.length>0&&a.jsxs("section",{children:[a.jsx(kn,{children:"Services"}),a.jsx("div",{style:{display:"flex",flexDirection:"column"},children:f.map(B=>a.jsxs("a",{href:B.url??B.path,target:"_blank",rel:"noopener noreferrer",title:`${B.label} — 127.0.0.1:${B.port} through Foreman`,style:{...vv,textDecoration:"none"},children:[a.jsx(ae,{name:"provider",size:12,color:"var(--status-good)"}),a.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--ink-0)"},children:B.label}),a.jsxs("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontFamily:"var(--font-mono)",flex:"0 0 auto"},children:[":",B.port]})]},B.port))})]}),a.jsxs("section",{children:[a.jsx(kn,{children:"Changed files"}),z.length===0&&a.jsx(Ve,{children:"Nothing changed in the folder yet."}),a.jsx("div",{style:{display:"flex",flexDirection:"column"},children:z.map((B,q)=>a.jsxs(vb,{onClick:()=>w(q),title:B.binary?`${B.path} — binary, no diff`:B.preexisting?`${B.path} — also dirty before the run`:`${B.path} — open the diff`,children:[a.jsx(ae,{name:"file",size:12,color:"var(--ink-2)"}),a.jsx(pb,{path:B.path,muted:B.status==="deleted",strike:B.status==="deleted"}),a.jsx("span",{style:{fontSize:"var(--fs-xs)",padding:"0 5px",borderRadius:"var(--r-pill)",lineHeight:"15px",border:`1px solid ${Ap[B.status]||"var(--line-strong)"}`,color:Ap[B.status]||"var(--ink-1)",flex:"0 0 auto"},children:B.binary?"binary":fb[B.status]||B.status}),a.jsxs("span",{style:{fontVariantNumeric:"tabular-nums",fontSize:"var(--fs-xs)",fontFamily:"var(--font-mono)",flex:"0 0 auto"},children:[a.jsxs("span",{style:{color:"var(--status-good)"},children:["+",B.additions]})," ",a.jsxs("span",{style:{color:"var(--status-critical)"},children:["−",B.deletions]})]})]},`${B.status}:${B.path}`))})]}),a.jsxs("section",{children:[a.jsx(kn,{children:"Folder"}),y?a.jsx(iu,{files:K,truncated:y.truncated,loading:y.loading,error:y.error,onRefresh:y.refresh,urlBase:p,summary:a.jsxs(a.Fragment,{children:[a.jsxs("span",{style:{color:"var(--ink-0)"},children:[K.length," file",K.length===1?"":"s"]})," as the folder stands · the run's work files included"]})},i):D.length===0?a.jsx(Ve,{children:"No screenshots or work files yet."}):a.jsx(iu,{files:D,urlBase:p,initialDir:db(D),summary:null},i)]}),R&&a.jsx(lu,{artifact:R,url:R.kind==="diff"&&!R.binary?void 0:hb(p,R.path),previewUrl:void 0,onClose:()=>j(null),index:b,count:T.length,onStep:j})]})}const gb=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function mv(i){if(!i||typeof i!="object")return"no cadence";switch(i.kind){case"daily":return`daily ${i.at}`;case"weekly":return`every ${gb[i.day]??`day ${i.day}`} ${i.at}`;case"interval":{const c=Number(i.everyMinutes)||0;return c%60===0?c===60?"every hour":`every ${c/60} hours`:`every ${c} minutes`}case"cron":return`cron ${i.expr}`;default:return"no cadence"}}function yb({cadence:i}){return i&&i.kind==="cron"?a.jsxs(a.Fragment,{children:["cron ",a.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:i.expr})]}):a.jsx(a.Fragment,{children:mv(i)})}function xb(i,c=Date.now()){if(!i)return null;const u=i-c;if(u<=0)return"due now";const o=Math.round(u/6e4);if(o<1)return"any moment now";if(o<60)return`in ${o} min`;const d=Math.round(o/60);return d<36?`in ${d} h`:`in ${Math.round(d/24)} days`}function Rl(i){const c=Number(i)||0;return`$${Number.isInteger(c)?c:c.toFixed(2)}`}const bb={failures:"paused — two runs in a row failed","monthly-cap":"paused — this month's scheduled spend would pass the ceiling",human:"paused by you"},Dp={done:"var(--status-good)",error:"var(--status-critical)",interrupted:"var(--status-serious)",skipped:"var(--ink-2)"};function jb({children:i,color:c,title:u,icon:o}){return a.jsxs("span",{title:u,style:{display:"inline-flex",alignItems:"center",gap:3,padding:"0 6px",borderRadius:"var(--r-pill)",border:`1px solid ${c??"var(--line-strong)"}`,color:c??"var(--ink-1)",fontSize:"var(--fs-xs)",lineHeight:"16px",flex:"0 0 auto",whiteSpace:"nowrap"},children:[o&&a.jsx(ae,{name:o,size:10}),i]})}function Sb({s:i,projectId:c,onEdit:u,onPause:o,onResume:d,onRunNow:f,onDelete:m}){const[y,x]=g.useState(""),[p,b]=g.useState(""),[j,S]=g.useState(!1),z=!i.enabled||!!i.pausedReason,D=bb[i.pausedReason]??(z?"paused — it will not fire until you resume it":null),G=async(w,R)=>{x(w),b("");try{const H=await R();H&&b(H)}catch(H){b(H instanceof Error?H.message:String(H))}finally{x("")}},T=z?null:xb(i.nextRunAt);return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,padding:"var(--sp-2)",border:"1px solid var(--line)",borderRadius:"var(--r-sm)",background:z?"var(--bg-inset)":"var(--bg-card)",minWidth:0},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",minWidth:0},children:[a.jsx("span",{title:i.brief,style:{fontSize:"var(--fs-sm)",color:z?"var(--ink-1)":"var(--ink-0)",fontWeight:"var(--fw-semibold)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,flex:1},children:i.name}),z&&a.jsx(jb,{icon:"interrupted",color:"var(--ink-2)",title:D,children:"paused"})]}),a.jsxs("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",lineHeight:"var(--lh)"},children:[a.jsx("span",{title:`One run costs at most ${Rl(i.budgetUsd)}`,children:a.jsx(yb,{cadence:i.cadence})}),T&&a.jsxs(a.Fragment,{children:[" · ",a.jsx("span",{style:{color:"var(--ink-1)"},children:T})]})," · ",a.jsxs("span",{children:[Rl(i.budgetUsd)," a run"]})]}),z&&a.jsx("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-1)"},children:D}),i.lastOutcome&&a.jsxs("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:["last:"," ",i.lastRunId?a.jsx("a",{href:`#/p/${encodeURIComponent(i.projectId??c)}/r/${encodeURIComponent(i.lastRunId)}`,title:i.lastNote||`Open the run that ${i.lastOutcome==="done"?"finished":"ended"} ${i.lastRunAt?new Date(i.lastRunAt).toLocaleString():""}`,style:{color:Dp[i.lastOutcome]??"var(--ink-1)",textDecoration:"underline"},children:i.lastOutcome}):a.jsx("span",{style:{color:Dp[i.lastOutcome]??"var(--ink-1)"},children:i.lastOutcome}),i.lastRunAt&&a.jsxs("span",{children:[" · ",new Date(i.lastRunAt).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,flexWrap:"wrap"},children:[z?a.jsx(te,{variant:"good",size:"sm",icon:"resume",disabled:!!y,title:`Resume ${i.name} — it fires again on its cadence`,onClick:()=>{G("resume",()=>d(i))},children:y==="resume"?"Resuming…":"Resume"}):a.jsx(te,{variant:"default",size:"sm",icon:"interrupted",disabled:!!y,title:`Pause ${i.name} — it stops firing until you resume it`,onClick:()=>{G("pause",()=>o(i))},children:y==="pause"?"Pausing…":"Pause"}),a.jsx(te,{variant:"default",size:"sm",icon:"now",disabled:!!y,title:`Start this mission now, once — ${Rl(i.budgetUsd)} cap. The cadence is unchanged.`,onClick:()=>{G("run",()=>f(i))},children:y==="run"?"Starting…":"Run now"}),a.jsx(te,{variant:"ghost",size:"sm",icon:"write",disabled:!!y,title:`Edit ${i.name} — brief, cadence, budget, models`,onClick:()=>u(i),children:"Edit"}),a.jsx(te,{variant:"ghost",size:"sm",icon:"unlink",disabled:!!y,title:`Delete ${i.name} — asks first`,onClick:()=>S(!0),children:"Delete"})]}),p&&a.jsx("div",{style:{fontSize:"var(--fs-xs)",color:"var(--status-critical)"},children:p}),j&&a.jsx(uv,{title:`Delete ${i.name}?`,body:"This schedule stops existing and never fires again. The runs it already started are kept.",confirmLabel:"Delete",icon:"unlink",onCancel:()=>S(!1),onConfirm:()=>{S(!1),G("delete",()=>m(i))}})]})}function kb({schedules:i=[],monthSpendUsd:c=0,monthlyCapUsd:u=0,loading:o,error:d,projectId:f,onNew:m,onEdit:y,onPause:x,onResume:p,onRunNow:b,onDelete:j,style:S}){const z=u>0&&c>=u;return a.jsxs("section",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-2)",minWidth:0,...S},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",minWidth:0},children:[a.jsx(kn,{style:{flex:"0 0 auto"},children:"Schedules"}),a.jsx("span",{style:{flex:1}}),a.jsx(te,{variant:"ghost",size:"sm",icon:"add",title:"Write a new standing instruction for this project",onClick:m,children:"New"})]}),(u>0||c>0)&&a.jsx("div",{title:"Scheduled runs only. At the ceiling, schedules pause themselves rather than spend past it.",style:{fontSize:"var(--fs-xs)",fontVariantNumeric:"tabular-nums",color:z?"var(--status-serious)":"var(--ink-2)"},children:u>0?a.jsxs(a.Fragment,{children:[Rl(c)," of ",Rl(u)," this month",z&&" — at the ceiling"]}):a.jsxs(a.Fragment,{children:[Rl(c)," this month · no ceiling set"]})}),d?a.jsxs(Ve,{children:["Could not read the schedules: ",d]}):o&&i.length===0?a.jsx(Ve,{children:"Reading the schedules…"}):i.length===0?a.jsx(Ve,{children:"Nothing standing. A schedule starts an ordinary mission here on a cadence — nightly dependency checks, a Monday morning review — and pauses itself when it fails twice or would pass the month's ceiling."}):a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-2)"},children:i.map(D=>a.jsx(Sb,{s:D,projectId:f,onEdit:y,onPause:x,onResume:p,onRunNow:b,onDelete:j},D.id))})]})}const wb=[{day:1,short:"Mon"},{day:2,short:"Tue"},{day:3,short:"Wed"},{day:4,short:"Thu"},{day:5,short:"Fri"},{day:6,short:"Sat"},{day:0,short:"Sun"}],Rp=/^([01]\d|2[0-3]):([0-5]\d)$/;function zb(i){const c={kind:"daily",at:"09:00",day:1,hours:6,expr:"0 9 * * 1"};return i?i.kind==="daily"?{...c,kind:"daily",at:i.at}:i.kind==="weekly"?{...c,kind:"weekly",at:i.at,day:i.day}:i.kind==="interval"?{...c,kind:"interval",hours:Math.max(1,Math.round((i.everyMinutes??60)/60))}:i.kind==="cron"?{...c,kind:"cron",expr:i.expr}:c:c}function Cb(i){if(i.kind==="daily")return Rp.test(i.at)?{kind:"daily",at:i.at}:null;if(i.kind==="weekly")return Rp.test(i.at)?{kind:"weekly",day:i.day,at:i.at}:null;if(i.kind==="interval"){const c=Number(i.hours);return Number.isFinite(c)&&c>=1?{kind:"interval",everyMinutes:Math.round(c)*60}:null}return i.kind==="cron"&&i.expr.trim()?{kind:"cron",expr:i.expr.trim()}:null}function Tb(i){return new Date(i).toLocaleString(void 0,{weekday:"short",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Mb({schedule:i,models:c,modelsLoading:u,modelsNote:o,modelsInheritNote:d,defaultBudgetUsd:f=6,onPreview:m,onSave:y,onClose:x}){const p=!!i,[b,j]=g.useState(i?.name??""),[S,z]=g.useState(i?.brief??""),[D,G]=g.useState(()=>zb(i?.cadence)),[T,w]=g.useState(i?.budgetUsd??f),[R,H]=g.useState(i?.directorModel??""),[K,se]=g.useState(i?.workerModel??""),[B,q]=g.useState(i?.directorProviderId),[I,W]=g.useState(i?.workerProviderId),[ue,ne]=g.useState(i?i.enabled!==!1:!0),[de,je]=g.useState(!1),[re,xe]=g.useState(""),[_,O]=g.useState({next:[],error:"",loading:!1}),ee=g.useMemo(()=>Cb(D),[D]),P=ee?JSON.stringify(ee):"";g.useEffect(()=>{if(!ee||!m){O({next:[],error:"",loading:!1});return}let C=!1;O({next:[],error:"",loading:!0});const L=setTimeout(()=>{Promise.resolve(m(ee)).then(Z=>{C||O({next:Z?.next??[],error:Z?.error??"",loading:!1})}).catch(Z=>{C||O({next:[],error:Z instanceof Error?Z.message:String(Z),loading:!1})})},300);return()=>{C=!0,clearTimeout(L)}},[P]);const oe=!!(ee&&_.error),k=b.trim()?S.trim()?ee?Number(T)>0?"":"A run needs a budget cap.":D.kind==="interval"?"Hours must be a whole number, one or more.":D.kind==="cron"?"Write a five-field cron expression.":"Time must read as HH:MM, like 07:30.":"Say what the mission should do.":"Give it a name.",V=async()=>{if(k){xe(k);return}je(!0),xe("");try{const C=await y({name:b.trim(),brief:S.trim(),cadence:ee,budgetUsd:Number(T),directorModel:R||void 0,workerModel:K||void 0,directorProviderId:B||void 0,workerProviderId:I||void 0,enabled:ue});C?xe(C):x?.()}catch(C){xe(C instanceof Error?C.message:String(C))}finally{je(!1)}};return a.jsxs(Ul,{width:640,onClose:de?void 0:x,children:[a.jsxs(jr,{children:[a.jsx("div",{style:{fontSize:"var(--fs-md)",fontWeight:"var(--fw-semibold)",color:"var(--ink-0)"},children:p?"Edit schedule":"New schedule"}),a.jsx("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",marginTop:2},children:"A standing instruction: Foreman starts this mission on its own, on this cadence, with nobody watching."})]}),a.jsxs("div",{style:{padding:"var(--sp-3)",overflowY:"auto",display:"flex",flexDirection:"column",gap:"var(--sp-3)"},children:[a.jsx(Fe,{layout:"stacked",label:"Name",hint:"What it is called in the rail and in the notification.",children:a.jsx(Ue,{value:b,onChange:j,placeholder:"Nightly dependency check",autoFocus:!0})}),a.jsx(Fe,{layout:"stacked",label:"Brief",hint:"The mission, written as you would write it in the composer.",children:a.jsx(Sr,{value:S,onChange:z,size:"answer",style:{height:120,minHeight:72},placeholder:"Check for outdated dependencies, open a branch with the safe upgrades, run the tests."})}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-2)"},children:[a.jsx(Vt,{size:"sm",value:D.kind,onChange:C=>G({...D,kind:C}),tabs:[{value:"daily",label:"Daily"},{value:"weekly",label:"Weekly"},{value:"interval",label:"Every N hours"},{value:"cron",label:"Cron"}]}),a.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"var(--sp-3)",flexWrap:"wrap"},children:[(D.kind==="daily"||D.kind==="weekly")&&a.jsx(Fe,{layout:"stacked",label:"At",hint:"24-hour clock, this machine's time zone.",children:a.jsx(Ue,{value:D.at,onChange:C=>G({...D,at:C}),width:96,mono:!0,placeholder:"07:30"})}),D.kind==="weekly"&&a.jsx(Fe,{layout:"stacked",label:"Day",hint:"Which day of the week it fires.",children:a.jsx("div",{style:{display:"flex",gap:4,flexWrap:"wrap"},children:wb.map(C=>a.jsx(te,{size:"sm",variant:D.day===C.day?"primary":"default",title:`Every ${C.short}`,onClick:()=>G({...D,day:C.day}),children:C.short},C.day))})}),D.kind==="interval"&&a.jsx(Fe,{layout:"stacked",label:"Every",hint:"Hours between runs. One hour is the shortest Foreman allows.",children:a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[a.jsx(Ue,{type:"number",min:1,step:1,width:96,value:D.hours,onChange:C=>G({...D,hours:C})}),a.jsx("span",{style:{fontSize:"var(--fs-sm)",color:"var(--ink-2)"},children:"hours"})]})}),D.kind==="cron"&&a.jsx(Fe,{layout:"stacked",label:"Expression",hint:"Five fields: minute hour day-of-month month day-of-week.",children:a.jsx(Ue,{value:D.expr,mono:!0,onChange:C=>G({...D,expr:C}),placeholder:"0 9 * * 1"})})]}),a.jsx("div",{style:{padding:"var(--sp-2)",background:"var(--bg-inset)",border:"1px solid var(--line)",borderRadius:"var(--r-sm)",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:_.error?a.jsxs("span",{style:{color:"var(--status-critical)",display:"inline-flex",alignItems:"center",gap:4},children:[a.jsx(ae,{name:"warning",size:11}),_.error]}):ee?_.loading&&_.next.length===0?a.jsx("span",{children:"Working out the next three runs…"}):_.next.length===0?a.jsx("span",{children:"Nothing scheduled from this cadence."}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{style:{color:"var(--ink-1)"},children:[mv(ee)," — next three runs:"]}),a.jsx("div",{style:{fontVariantNumeric:"tabular-nums"},children:_.next.slice(0,3).map(C=>a.jsx("div",{children:Tb(C)},C))})]}):a.jsx("span",{children:"Next three runs appear once the cadence reads."})})]}),a.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"var(--sp-4)",flexWrap:"wrap"},children:[a.jsx(Fe,{layout:"stacked",label:"Budget cap",hint:"Per run, not per month. The run halts here.",children:a.jsx(Ue,{type:"number",min:1,step:1,width:96,prefix:"$",value:T,onChange:w})}),a.jsx(Fe,{layout:"stacked",label:"Director",hint:"Plans, delegates, verifies.",children:a.jsx(Ut,{value:R,models:c,loading:u,note:o,inheritNote:d,onChange:(C,L)=>{H(C),q(L?.providerId)}})}),a.jsx(Fe,{layout:"stacked",label:"Workers",hint:"Implement. Cheaper models cut cost.",children:a.jsx(Ut,{value:K,models:c,loading:u,note:o,inheritNote:d,onChange:(C,L)=>{se(C),W(L?.providerId)}})})]})]}),a.jsxs(Hl,{children:[a.jsxs("span",{title:"Off keeps the schedule but stops it firing.",style:{display:"inline-flex",alignItems:"center",gap:6,flex:"0 0 auto"},children:[a.jsx(yt,{checked:ue,onChange:ne,disabled:de,size:"sm",label:"Enabled"}),a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:ue?"var(--ink-1)":"var(--ink-2)"},children:ue?"Enabled":"Paused"})]}),(re||k)&&a.jsx("span",{title:re||k,style:{fontSize:"var(--fs-xs)",color:re?"var(--status-critical)":"var(--ink-2)",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:re||k}),a.jsx("span",{style:{marginLeft:"auto"}}),a.jsx(te,{variant:"ghost",disabled:de,onClick:x,children:"Cancel"}),a.jsx(te,{variant:"primary",disabled:de||!!k||oe,title:k||(oe?`The server will not take this cadence: ${_.error}`:"")||(p?"Save the changes":"Create this schedule"),onClick:()=>{V()},children:de?"Saving…":p?"Save":"Create"})]})]})}const Eb=[{value:"default",label:"Server default"},{value:"claude-code",label:"Claude Code",icon:"model"},{value:"anthropic-api",label:"Anthropic API",icon:"budget"},{value:"codex",label:"Codex",icon:"Bash"},{value:"openai-compatible",label:"Custom endpoint",icon:"WebFetch"}];function _b(i){const c=`pr-${Math.random().toString(16).slice(2,10)}`;switch(i){case"claude-code":return{kind:i};case"anthropic-api":return{kind:i,id:c,apiKeyEnv:""};case"codex":return{kind:i,id:c};case"openai-compatible":return{kind:i,id:c,baseUrl:""};default:return null}}function Op(){return a.jsx("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",marginTop:4},children:"Names an environment variable on the server. A stored key below takes precedence; leave both empty and this endpoint needs no credential."})}function Np({providerId:i,hasKey:c,busy:u,error:o,onStore:d,onClear:f}){const[m,y]=g.useState(""),[x,p]=g.useState(!1);return!d||!i?null:a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",flexWrap:"wrap"},children:[a.jsx("span",{style:{fontSize:"var(--fs-sm)",color:"var(--ink-1)"},children:c?"A key is stored for this provider.":"No key stored."}),c&&a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:"It cannot be shown — only replaced or removed."}),a.jsxs("span",{style:{marginLeft:"auto",display:"inline-flex",gap:"var(--sp-2)"},children:[a.jsx(te,{size:"sm",variant:"ghost",onClick:()=>p(b=>!b),children:x?"Cancel":c?"Replace":"Add a key"}),c&&a.jsx(te,{size:"sm",variant:"danger",disabled:u,onClick:()=>f?.(i),children:"Remove"})]})]}),x&&a.jsxs("div",{style:{display:"flex",gap:"var(--sp-2)",alignItems:"center"},children:[a.jsx(Ue,{mono:!0,type:"password",placeholder:"paste the key",value:m,onChange:y,autoFocus:!0,onKeyDown:b=>{b.key==="Enter"&&m.trim()&&(d(i,m.trim()),y(""),p(!1))}}),a.jsx(te,{size:"sm",variant:"good",disabled:u||!m.trim(),onClick:()=>{d(i,m.trim()),y(""),p(!1)},children:u?"Saving…":"Save key"})]}),o&&a.jsx(Je,{tone:"error",inline:!0,children:o})]})}function rn({label:i,children:c}){return a.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:4},children:[a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:i}),c]})}function Ab({inst:i,selected:c,onClick:u}){const[o,d]=g.useState(!1);return a.jsxs("button",{type:"button",onClick:u,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{display:"flex",alignItems:"center",gap:8,textAlign:"left",width:"100%",padding:"6px 8px",borderRadius:"var(--r-sm)",cursor:"pointer",font:"inherit",background:c?"var(--brand-wash-strong)":o?"var(--bg-hover)":"transparent",border:`1px solid ${c?"var(--brand)":"var(--line)"}`},children:[a.jsx(ae,{name:"model",size:13,color:c?"var(--brand)":"var(--ink-2)"}),a.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-sm)",flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:i.configDir,children:br(i.configDir)}),a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:i.origin}),i.hasStoredLogin&&a.jsx("span",{title:"Has a stored login",style:{width:6,height:6,borderRadius:"var(--r-pill)",background:"var(--status-good)",flex:"0 0 auto"}})]})}function Db({value:i,onChange:c,instances:u,ollama:o,hasKey:d,keyBusy:f,keyError:m,onStoreKey:y,onClearKey:x,style:p}){const[b,j]=g.useState(!1),S=i?.kind??"default",z=T=>c({...i,...T}),D=T=>c(_b(T)),G=S==="openai-compatible"&&o&&i.baseUrl===o.host;return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-3)",...p},children:[a.jsx(Vt,{size:"sm",value:S,onChange:D,tabs:Eb}),S==="default"&&a.jsx("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:"Runs on whatever the server itself authenticates as."}),S==="claude-code"&&a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-2)"},children:[u?.length>0&&a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:u.map(T=>a.jsx(Ab,{inst:T,selected:(i.configDir??"")===T.configDir,onClick:()=>z({configDir:T.configDir})},T.configDir))}),a.jsx(rn,{label:"Config dir (blank inherits the server's own install)",children:a.jsx(Ue,{mono:!0,placeholder:"~/.claude-work",value:i.configDir??"",onChange:T=>z({configDir:T||void 0})})}),b?a.jsx(rn,{label:"Executable (blank uses the SDK's bundled one)",children:a.jsx(Ue,{mono:!0,placeholder:"/usr/local/bin/claude",value:i.executable??"",onChange:T=>z({executable:T||void 0})})}):a.jsx("button",{type:"button",onClick:()=>j(!0),style:{alignSelf:"flex-start",background:"none",border:0,padding:0,font:"inherit",fontSize:"var(--fs-xs)",color:"var(--ink-2)",cursor:"pointer",textDecoration:"underline",textUnderlineOffset:2},children:"Pin an executable too"}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx(yt,{checked:!!i.ownLogin,onChange:T=>z({ownLogin:T||void 0})}),a.jsx("span",{style:{fontSize:"var(--fs-sm)"},children:"Own login"})]}),a.jsx("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:"Strips any inherited API key from this project's agents so this install's own stored subscription pays, instead of whatever the server process authenticates as."})]}),S==="anthropic-api"&&a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-2)"},children:[a.jsx(Np,{providerId:i.id,hasKey:d,busy:f,error:m,onStore:y,onClear:x}),a.jsx(rn,{label:"Environment variable (optional fallback)",children:a.jsx(Ue,{mono:!0,placeholder:"ANTHROPIC_API_KEY_ALPHA",value:i.apiKeyEnv??"",onChange:T=>z({apiKeyEnv:T})})}),a.jsx(Op,{}),a.jsx(rn,{label:"Model (blank uses the provider's default)",children:a.jsx(Ue,{mono:!0,placeholder:"claude-sonnet-4-5",value:i.model??"",onChange:T=>z({model:T||void 0})})})]}),S==="codex"&&a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-2)"},children:[a.jsx("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:"Reads the login `codex login` already stored — Foreman never mints its own token."}),a.jsx(rn,{label:"Codex home (blank is ~/.codex)",children:a.jsx(Ue,{mono:!0,placeholder:"~/.codex",value:i.codexHome??"",onChange:T=>z({codexHome:T||void 0})})}),b?a.jsx(rn,{label:"Upstream URL (blank is the public ChatGPT backend)",children:a.jsx(Ue,{mono:!0,placeholder:"https://chatgpt.com/backend-api/codex",value:i.upstreamUrl??"",onChange:T=>z({upstreamUrl:T||void 0})})}):a.jsx("button",{type:"button",onClick:()=>j(!0),style:{alignSelf:"flex-start",background:"none",border:0,padding:0,font:"inherit",fontSize:"var(--fs-xs)",color:"var(--ink-2)",cursor:"pointer",textDecoration:"underline",textUnderlineOffset:2},children:"Point at a different upstream"}),a.jsx(rn,{label:"Model (blank uses Codex's own default)",children:a.jsx(Ue,{mono:!0,placeholder:"gpt-5-codex",value:i.model??"",onChange:T=>z({model:T||void 0})})})]}),S==="openai-compatible"&&a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-2)"},children:[o&&a.jsxs("button",{type:"button",onClick:()=>z({baseUrl:o.host,label:"Ollama"}),style:{display:"flex",alignItems:"center",gap:8,textAlign:"left",width:"100%",padding:"6px 8px",borderRadius:"var(--r-sm)",cursor:"pointer",font:"inherit",background:G?"var(--brand-wash-strong)":"transparent",border:`1px solid ${G?"var(--brand)":"var(--line)"}`},children:[a.jsx(ae,{name:"Bash",size:13,color:G?"var(--brand)":"var(--ink-2)"}),a.jsx("span",{style:{fontSize:"var(--fs-sm)",flex:1},children:"Use local Ollama"}),a.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:[o.host," · ",o.models.length," model",o.models.length===1?"":"s"]})]}),a.jsx(rn,{label:"Base URL",children:a.jsx(Ue,{mono:!0,placeholder:"http://127.0.0.1:11434",value:i.baseUrl??"",onChange:T=>z({baseUrl:T})})}),G&&o.models.length>0?a.jsx(rn,{label:"Model (blank lets the run pick)",children:a.jsxs("select",{value:i.model??"",onChange:T=>z({model:T.target.value||void 0}),style:{font:"inherit",fontFamily:"var(--font-mono)",fontSize:"var(--fs-sm)",padding:"6px 8px",borderRadius:"var(--r-sm)",border:"1px solid var(--line-strong)",background:"var(--bg-card)",color:"var(--ink-0)"},children:[a.jsx("option",{value:"",children:"— server picks —"}),o.models.map(T=>a.jsxs("option",{value:T.id,children:[T.id,T.remote?" (cloud)":""]},T.id))]})}):a.jsx(rn,{label:"Model (blank lets the run pick)",children:a.jsx(Ue,{mono:!0,placeholder:"llama3.1",value:i.model??"",onChange:T=>z({model:T||void 0})})}),a.jsx(rn,{label:"Label (shown in place of the raw URL)",children:a.jsx(Ue,{placeholder:"OpenRouter",value:i.label??"",onChange:T=>z({label:T||void 0})})}),a.jsx(rn,{label:"Environment variable (blank when the endpoint needs no key)",children:a.jsx(Ue,{mono:!0,placeholder:"OPENROUTER_API_KEY",value:i.apiKeyEnv??"",onChange:T=>z({apiKeyEnv:T||void 0})})}),!!i.apiKeyEnv&&a.jsx(Op,{}),a.jsx(Np,{providerId:i.id,hasKey:d,busy:f,error:m,onStore:y,onClear:x}),a.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",fontSize:"var(--fs-sm)"},children:[a.jsx(yt,{checked:i.needsKey===!0,onChange:T=>z({needsKey:T||void 0})}),"This endpoint requires a credential"]})]})]})}function Rb({status:i,busy:c,error:u,onSaveToken:o,onClearToken:d,onLink:f,onUnlink:m,onTest:y,onSavePublicUrl:x,style:p}){const[b,j]=g.useState(""),[S,z]=g.useState(!1),[D,G]=g.useState(null),T=i?.telegram,w=!!T?.hasToken,R=!!T?.chatId,H=T?.linking,K=D??i?.publicUrl??"",se=D!==null&&D!==(i?.publicUrl??""),B=(q,I,W)=>a.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"var(--sp-3)",padding:"var(--sp-2) 0",borderTop:"1px solid var(--line)"},children:[a.jsxs("div",{style:{flex:"0 0 180px"},children:[a.jsx("div",{style:{fontSize:"var(--fs-sm)",color:"var(--ink-0)"},children:q}),I&&a.jsx("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",lineHeight:"var(--lh)"},children:I})]}),a.jsx("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:6},children:W})]});return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-2)",marginTop:"var(--sp-3)",...p},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:"var(--fs-sm)",fontWeight:"var(--fw-semibold)"},children:[a.jsx(ae,{name:"send",size:13,color:"var(--brand)"})," Telegram",a.jsxs("span",{style:{marginLeft:"auto",fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontWeight:"var(--fw-normal)"},children:[R?`linked · ${T.chatLabel||T.chatId}`:w?"token stored · not linked":"not set up",i?.delivered?` · ${i.delivered} sent`:"",i?.failures?` · ${i.failures} failed`:""]})]}),a.jsx("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",lineHeight:"var(--lh-prose)"},children:"Approvals, questions, stalls and finished missions arrive in a chat with your own bot, using the toggles above. Every ask still has its unattended default — this makes it less likely to be needed."}),u&&a.jsx(Je,{tone:"error",inline:!0,children:u}),B("Bot token",a.jsxs(a.Fragment,{children:["Create a bot with ",a.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:"@BotFather"})," and paste its token. Stored write-only; Foreman can replace it but never show it."]}),w&&!S?a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",fontSize:"var(--fs-sm)"},children:[a.jsx("span",{style:{fontFamily:"var(--font-mono)",color:"var(--ink-1)"},children:T?.bot||"token stored"}),a.jsx(te,{size:"sm",variant:"ghost",onClick:()=>z(!0),disabled:c,children:"Replace"}),a.jsx(te,{size:"sm",variant:"ghost",onClick:d,disabled:c,children:"Remove"})]}):a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)"},children:[a.jsx(Ue,{mono:!0,type:"password",width:320,placeholder:"123456789:AA…",value:b,onChange:j}),a.jsx(te,{size:"sm",variant:"primary",disabled:c||!b.trim(),onClick:()=>{o?.(b.trim()),j(""),z(!1)},children:c?"Checking…":"Save"}),w&&a.jsx(te,{size:"sm",variant:"ghost",onClick:()=>z(!1),children:"Cancel"})]})),B("Linked chat","Send the one-time command to your bot from the chat that should receive messages. Only that chat is ever written to.",R?a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",fontSize:"var(--fs-sm)"},children:[a.jsx(ae,{name:"check",size:13,color:"var(--status-ok, var(--brand))"}),a.jsxs("span",{children:[T.chatLabel||"linked"," ",a.jsx("span",{style:{color:"var(--ink-2)",fontFamily:"var(--font-mono)"},children:T.chatId})]}),a.jsx(te,{size:"sm",variant:"ghost",onClick:y,disabled:c,children:"Send test"}),a.jsx(te,{size:"sm",variant:"ghost",onClick:m,disabled:c,children:"Unlink"})]}):H?a.jsxs("div",{style:{display:"flex",gap:"var(--sp-3)",alignItems:"flex-start"},children:[H.deepLink&&a.jsx("a",{href:H.deepLink,target:"_blank",rel:"noreferrer",title:"Open in Telegram",style:{flex:"0 0 auto",display:"block",padding:6,background:"#fff",borderRadius:"var(--r-sm)",border:"1px solid var(--line-strong)",lineHeight:0},children:a.jsx("img",{src:`/notify/telegram/qr.svg?c=${encodeURIComponent(H.code)}`,alt:`QR: ${H.deepLink}`,width:132,height:132,style:{display:"block"}})}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,fontSize:"var(--fs-sm)",minWidth:0},children:[a.jsx("div",{children:"Scan with your phone, or send this to your bot:"}),a.jsxs("code",{style:{alignSelf:"flex-start",fontFamily:"var(--font-mono)",fontSize:"var(--fs-lg)",padding:"4px 10px",background:"var(--bg-inset)",border:"1px solid var(--line-strong)",borderRadius:"var(--r-sm)"},children:["/start ",H.code]}),H.deepLink&&a.jsx("a",{href:H.deepLink,target:"_blank",rel:"noreferrer",style:{fontSize:"var(--fs-xs)",color:"var(--brand)",textDecoration:"none"},children:"Open in Telegram on this computer →"}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:"var(--fs-xs)",color:"var(--ink-2)",flexWrap:"wrap"},children:[a.jsx("span",{className:"pulse",style:{display:"inline-flex"},children:a.jsx(ae,{name:"loading",size:12})}),"waiting… the code expires in 10 minutes",a.jsx(te,{size:"sm",variant:"ghost",onClick:f,disabled:c,children:"New code"})]})]})]}):a.jsx("div",{children:a.jsx(te,{size:"sm",variant:"primary",onClick:f,disabled:c||!w,title:w?"Shows a one-time code to send to your bot":"Store a bot token first",children:"Link a chat"})})),B("Foreman URL","Where links in messages point. A phone cannot open localhost — use a LAN or Tailscale address if you have one.",a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)"},children:[a.jsx(Ue,{mono:!0,width:320,value:K,onChange:G,placeholder:"http://localhost:4177"}),a.jsx(te,{size:"sm",disabled:c||!se,onClick:()=>{x?.(K),G(null)},children:"Save"})]}))]})}const Pc=[{id:"provider",label:"Provider",icon:"provider"},{id:"models",label:"Models",icon:"model"},{id:"crew",label:"Crew",icon:"crew"},{id:"budget",label:"Budget",icon:"budget"},{id:"approvals",label:"Approvals",icon:"approval"},{id:"appearance",label:"Appearance",icon:"sun"},{id:"notifications",label:"Notifications",icon:"needsYou"},{id:"projects",label:"Projects",icon:"folder"}],gv=[{id:"reviewer",name:"Reviewer",kind:"reviewer",model:"opus",toolPolicy:"read-only",requiredForDone:!0,brief:"Review the mission’s diff against MISSION.md and the brief as a demanding senior engineer would. Look for correctness, missing tests, security, and anything the criteria did not name. Verdict PASS only when you would merge it yourself."},{id:"security-review",name:"Security review",kind:"reviewer",model:"opus",toolPolicy:"read-only",requiredForDone:!1,brief:"Review the mission’s diff for secrets committed or logged, injection of every kind, path handling that can escape its root, and permissions granted wider than the work needs. Verdict PASS only when none of those is present."}],su={directorModel:"opus",workerModel:"sonnet",plannerModel:"sonnet",budgetCap:5,budgetWarnAt:60,budgetHardStop:!0,scheduledMonthlyCapUsd:25,crewPresets:gv,autoAllowReadOnly:!0,alwaysSurvivesResume:!0,toolPolicy:{Bash:"allow",Write:"allow",Edit:"allow",WebFetch:"allow",spawn_worker:"allow"},theme:"light",textSize:"default",density:"comfortable",showTimestamps:!0,notifyNeedsYou:!0,notifyDone:!0,notifyBudget:!0,sound:!1,gitBranchPerMission:!0,projectsRoot:"~/Projects",missionDir:".foreman",showHidden:!1},Ob=[{value:"allow",label:"Allow"},{value:"ask",label:"Ask"},{value:"deny",label:"Deny"}],Nb=["Bash","Write","Edit","WebFetch","spawn_worker"];function Ub({instances:i=[],ollama:c,codex:u}){const o=[...i.map(d=>({icon:"orchestration",name:"Claude Code",detail:d.configDir,note:d.hasStoredLogin?"signed in":"no stored login"})),...c?[{icon:"model",name:"Ollama",detail:c.host,note:`${c.models.length} model${c.models.length===1?"":"s"}`}]:[],...u?[{icon:"provider",name:"Codex",detail:u.home,note:u.signedIn?"signed in":"not signed in"}]:[]];return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-3)"},children:[a.jsxs("div",{style:{fontSize:"var(--fs-sm)",color:"var(--ink-1)",lineHeight:"var(--lh-prose)"},children:["A provider is chosen per project — open one and its tab appears beside",a.jsx("b",{style:{color:"var(--ink-0)"},children:" Global"})," above. These are what this machine can offer."]}),o.length===0&&a.jsx(Ve,{children:"Nothing detected. An Anthropic API key or any OpenAI-compatible endpoint still works."}),o.map((d,f)=>a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"var(--sp-2) var(--sp-3)",background:"var(--bg-inset)",border:"1px solid var(--line)",borderRadius:"var(--r-sm)"},children:[a.jsx(ae,{name:d.icon,size:14,color:"var(--ink-2)"}),a.jsx("span",{style:{fontSize:"var(--fs-sm)",fontWeight:"var(--fw-medium)"},children:d.name}),a.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.detail}),a.jsx("span",{style:{marginLeft:"auto",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:d.note})]},f))]})}function Hb({global:i,project:c,projectName:u,models:o,modelsLoading:d,modelsNote:f,provider:m,providerInstances:y,providerOllama:x,providerCodex:p,providerHasKey:b,providerKeyBusy:j,providerKeyError:S,onStoreProviderKey:z,onClearProviderKey:D,notify:G,scope:T,onScope:w,section:R,onSection:H,onSave:K,onClose:se,onUnlink:B,style:q}){const[I,W]=g.useState(T??"global"),[ue,ne]=g.useState(R??"models"),de=w?T:I,je=w??W,re=H?R:ue,xe=H??ne,[_,O]=g.useState({...su,...i}),[ee,P]=g.useState({...c}),[oe,k]=g.useState(m??null),V=JSON.stringify(oe)!==JSON.stringify(m??null),C=JSON.stringify(_)!==JSON.stringify({...su,...i})||JSON.stringify(ee)!==JSON.stringify({...c})||V,L=de==="project",Z=le=>L&&le in ee?ee[le]:_[le],ce=(le,at)=>L?P(ot=>({...ot,[le]:at})):O(ot=>({...ot,[le]:at})),be=le=>L&&le in ee,He=le=>P(at=>{const ot={...at};return delete ot[le],ot}),ge=(le,at,ot,pe)=>a.jsx($i,{label:at,hint:ot,overridden:be(le),inherits:L&&!be(le),onReset:()=>He(le),children:pe}),ie={models:a.jsxs(a.Fragment,{children:[ge("directorModel","Director","Plans, delegates, verifies. Opus by default; Fable for long-horizon work.",a.jsx(Ut,{align:"right",allowDefault:!1,models:o,loading:d,note:f,value:Z("directorModel"),onChange:(le,at)=>{ce("directorModel",le),ce("directorProviderId",at?.providerId)}})),ge("workerModel","Workers","Implement scoped tasks. Cheaper models cut cost sharply.",a.jsx(Ut,{align:"right",allowDefault:!1,models:o,loading:d,note:f,value:Z("workerModel"),onChange:(le,at)=>{ce("workerModel",le),ce("workerProviderId",at?.providerId)}})),ge("plannerModel","Planner","Talks the next mission through with you and reads the project. Conversation, not deep reasoning; Sonnet by default.",a.jsx(Ut,{align:"right",allowDefault:!1,models:o,loading:d,note:f,value:Z("plannerModel"),onChange:le=>ce("plannerModel",le)})),!L&&ge("fleetPlannerModel","Fleet planner","The front desk on your phone: knows every project, opens planning, proposes, steers. Fast tool calls matter more than depth; follows the planner when unset.",a.jsx(Ut,{align:"right",allowDefault:!1,models:o,loading:d,note:f,value:Z("fleetPlannerModel")||Z("plannerModel"),onChange:le=>ce("fleetPlannerModel",le)}))]}),crew:a.jsxs(a.Fragment,{children:[a.jsxs("div",{style:{fontSize:"var(--fs-sm)",color:"var(--ink-1)",lineHeight:"var(--lh-prose)",paddingBottom:"var(--sp-2)"},children:["A preset is a role you can add to a mission when you compose it: a fixed brief, its own model, and how much of the machine it is allowed to touch. A reviewer marked",a.jsx("b",{style:{color:"var(--ink-0)"},children:" required"})," must return ",a.jsx("b",{style:{color:"var(--ink-0)"},children:"PASS"})," on the run’s final diff before Foreman will record the run done."]}),a.jsx($i,{label:"Presets",hint:"Offered in the composer, in this order. Nothing here runs on its own.",overridden:be("crewPresets"),inherits:L&&!be("crewPresets"),onReset:()=>He("crewPresets"),stacked:!0,children:a.jsx(Gb,{value:Z("crewPresets")||gv,onChange:le=>ce("crewPresets",le),models:o,modelsLoading:d,modelsNote:f})})]}),budget:a.jsxs(a.Fragment,{children:[ge("budgetCap","Default cap per run","The composer starts here; you can change it per mission.",a.jsx(Ue,{type:"number",prefix:"$",min:0,step:1,width:110,value:Z("budgetCap"),onChange:le=>ce("budgetCap",le)})),ge("budgetWarnAt","Warn at","Meter turns amber, the director is told to start verifying, and, if enabled, you get a notification. Leave room: the wind-down turn has to pay for verification and the report.",a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[a.jsx(Ue,{type:"number",min:10,max:100,step:5,width:80,value:Z("budgetWarnAt"),onChange:le=>ce("budgetWarnAt",le)}),a.jsx("span",{style:{color:"var(--ink-2)"},children:"%"})]})),ge("budgetHardStop","Hard stop at cap","Off: the run pauses and asks instead of stopping.",a.jsx(yt,{checked:Z("budgetHardStop"),onChange:le=>ce("budgetHardStop",le)})),ge("scheduledMonthlyCapUsd","Scheduled spend per month","All this project’s scheduled runs together, per calendar month. Foreman pauses a schedule before the run that would go past this, rather than stopping it halfway; only you can resume it, from the project view.",a.jsx(Ue,{type:"number",prefix:"$",min:0,step:5,width:110,value:Z("scheduledMonthlyCapUsd"),onChange:le=>ce("scheduledMonthlyCapUsd",le)}))]}),approvals:a.jsxs(a.Fragment,{children:[ge("autoAllowReadOnly","Auto-allow read-only tools","Read, Grep, Glob, LS never prompt.",a.jsx(yt,{checked:Z("autoAllowReadOnly"),onChange:le=>ce("autoAllowReadOnly",le)})),ge("alwaysSurvivesResume","“Always (run)” survives resume","Grants made during a run carry into a resumed run.",a.jsx(yt,{checked:Z("alwaysSurvivesResume"),onChange:le=>ce("alwaysSurvivesResume",le)})),a.jsx($i,{label:"Guarded tools",hint:"Policy per tool. “Ask” escalates to an approval card; writes outside the project folder always ask.",overridden:be("toolPolicy"),inherits:L&&!be("toolPolicy"),onReset:()=>He("toolPolicy"),stacked:!0,children:a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:Nb.map(le=>a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx(ae,{name:le,size:14,color:"var(--ink-2)"}),a.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-sm)",flex:1},children:le}),a.jsx(Vt,{size:"sm",tabs:Ob,value:Z("toolPolicy")[le]||"ask",onChange:at=>ce("toolPolicy",{...Z("toolPolicy"),[le]:at})})]},le))})})]}),appearance:a.jsxs(a.Fragment,{children:[ge("theme","Theme",null,a.jsx(Vt,{size:"sm",value:Z("theme"),onChange:le=>ce("theme",le),tabs:[{value:"system",label:"System"},{value:"dark",label:"Dark",icon:"moon"},{value:"light",label:"Light",icon:"sun"}]})),ge("textSize","Text size","Scales the whole interface. Anything but Default overrides your browser’s own font size.",a.jsx(Vt,{size:"sm",value:Z("textSize"),onChange:le=>ce("textSize",le),tabs:[{value:"small",label:"Small"},{value:"default",label:"Default"},{value:"large",label:"Large"},{value:"larger",label:"Larger"}]})),ge("density","Density","Compact tightens transcript rows and rail padding.",a.jsx(Vt,{size:"sm",value:Z("density"),onChange:le=>ce("density",le),tabs:[{value:"comfortable",label:"Comfortable"},{value:"compact",label:"Compact"}]})),ge("showTimestamps","Timestamps in transcript",null,a.jsx(yt,{checked:Z("showTimestamps"),onChange:le=>ce("showTimestamps",le)}))]}),notifications:a.jsxs(a.Fragment,{children:[ge("notifyNeedsYou","Needs you","An approval or question is waiting.",a.jsx(yt,{checked:Z("notifyNeedsYou"),onChange:le=>ce("notifyNeedsYou",le)})),ge("notifyDone","Run finished","Done, errored or interrupted.",a.jsx(yt,{checked:Z("notifyDone"),onChange:le=>ce("notifyDone",le)})),ge("notifyBudget","Budget warning","When spend crosses the warn threshold.",a.jsx(yt,{checked:Z("notifyBudget"),onChange:le=>ce("notifyBudget",le)})),ge("sound","Sound",null,a.jsx(yt,{checked:Z("sound"),onChange:le=>ce("sound",le)})),!L&&G&&a.jsx(Rb,{...G})]}),provider:L?a.jsx($i,{label:"Provider",hint:"Which engine runs this project's agents, who pays, and where requests go. Clearing it returns to the server default.",stacked:!0,children:a.jsx(Db,{value:oe,onChange:k,instances:y,ollama:x,hasKey:b,keyBusy:j,keyError:S,onStoreKey:z,onClearKey:D})}):a.jsx(Ub,{instances:y,ollama:x,codex:p}),projects:a.jsxs(a.Fragment,{children:[!L&&ge("projectsRoot","Projects root","Where the folder picker opens.",a.jsx(Ue,{mono:!0,width:260,value:Z("projectsRoot"),onChange:le=>ce("projectsRoot",le)})),ge("missionDir","Mission folder","Relative to the project. Holds MISSION.md and run history.",a.jsx(Ue,{mono:!0,width:160,value:Z("missionDir"),onChange:le=>ce("missionDir",le)})),ge("allowWorktreeParent","Worktree parent","A mission in a git worktree may use the repository it was made from without asking. Sibling worktrees stay closed.",a.jsx(yt,{checked:Z("allowWorktreeParent")!==!1,onChange:le=>ce("allowWorktreeParent",le)})),ge("gitBranchPerMission","Each mission on its own branch","In a git repository: Foreman creates foreman/<mission> from what is checked out, commits the work on it at the end, and never merges or pushes. Off: missions edit the current branch.",a.jsx(yt,{checked:Z("gitBranchPerMission")!==!1,onChange:le=>ce("gitBranchPerMission",le)})),!L&&ge("showHidden","Show hidden folders in picker",null,a.jsx(yt,{checked:Z("showHidden"),onChange:le=>ce("showHidden",le)})),L&&a.jsx($i,{label:"Unlink this project",hint:"Removes it from the fleet. Files on disk are untouched.",danger:!0,children:a.jsx(te,{variant:"danger",size:"sm",icon:"unlink",onClick:B,children:"Unlink"})})]})},qe=Pc.find(le=>le.id===re)||Pc[0];return a.jsxs(Ul,{width:"51.25rem",onClose:se,dismissible:!1,style:{maxHeight:"82vh",height:"37.5rem",...q},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-3)",padding:"var(--sp-2) var(--sp-3)",borderBottom:"1px solid var(--line)"},children:[a.jsx("span",{style:{fontSize:"var(--fs-lg)",fontWeight:"var(--fw-semibold)"},children:"Settings"}),a.jsx(Vt,{size:"sm",value:de,onChange:je,tabs:[...u?[{value:"project",label:u,icon:"folder"}]:[],{value:"global",label:"Global"}]}),a.jsx(Sa,{icon:"close",label:"Close",onClick:se,style:{marginLeft:"auto"}})]}),a.jsxs("div",{style:{flex:1,minHeight:0,display:"grid",gridTemplateColumns:"11.25rem 1fr"},children:[a.jsx("nav",{style:{background:"var(--bg-inset)",borderRight:"1px solid var(--line)",padding:"var(--sp-2)",display:"flex",flexDirection:"column",gap:2},children:Pc.map(le=>a.jsx(Wb,{s:le,selected:le.id===re,dot:L&&($b(le.id,ee)||le.id==="provider"&&!!oe),onClick:()=>xe(le.id)},le.id))}),a.jsxs("div",{style:{minHeight:0,overflowY:"auto",padding:"var(--sp-3) var(--sp-5)"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--sp-2)",marginBottom:"var(--sp-2)"},children:[a.jsx("span",{style:{fontSize:"var(--fs-lg)",fontWeight:"var(--fw-semibold)"},children:qe.label}),L&&a.jsxs("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:["Overrides for ",a.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:u}),". Rows without a change inherit global."]})]}),ie[qe.id]]})]}),a.jsxs(Hl,{children:[a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:C?"var(--status-warning)":"var(--ink-2)"},children:C?"Unsaved changes":"Nothing to save"}),a.jsxs("span",{style:{marginLeft:"auto",display:"flex",gap:"var(--sp-2)"},children:[a.jsx(te,{onClick:se,children:"Cancel"}),a.jsx(te,{variant:"primary",disabled:!C,onClick:()=>K?.({global:_,project:ee,provider:V?oe:void 0}),children:"Save"})]})]})]})}const Bb={models:["directorModel","workerModel","plannerModel","fleetPlannerModel","directorProviderId","workerProviderId"],budget:["budgetCap","budgetWarnAt","budgetHardStop","scheduledMonthlyCapUsd"],crew:["crewPresets"],approvals:["autoAllowReadOnly","alwaysSurvivesResume","toolPolicy"],appearance:["theme","density","showTimestamps"],notifications:["notifyNeedsYou","notifyDone","notifyBudget","sound"],projects:["missionDir","gitBranchPerMission"]};function $b(i,c){return(Bb[i]||[]).some(u=>u in c)}const qb=[{value:"reviewer",label:"Reviewer"},{value:"specialist",label:"Specialist"}],Lb=[{value:"read-only",label:"Read-only"},{value:"default",label:"Default"}];function Yb(i,c){const u=String(i).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"preset";let o;do o=`${u}-${Math.random().toString(36).slice(2,6)}`;while(c.includes(o));return o}function Gb({value:i,onChange:c,models:u,modelsLoading:o,modelsNote:d}){const[f,m]=g.useState(null),y=(b,j,S)=>c(i.map((z,D)=>D===b?{...z,[j]:S}:z)),x=b=>(u||[]).find(j=>j.id===b)?.label||b||"Default",p=()=>{const b=Yb("preset",i.map(j=>j.id));c([...i,{id:b,name:"New preset",kind:"reviewer",model:"opus",toolPolicy:"read-only",requiredForDone:!1,brief:""}]),m(b)};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,width:"100%"},children:[i.length===0&&a.jsx(Ve,{children:"No crew. Missions run with the director and its workers only."}),i.map((b,j)=>{const S=f===b.id;return a.jsxs("div",{style:{border:"1px solid var(--line)",borderRadius:"var(--r-sm)",background:"var(--bg-inset)"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",...S?{position:"sticky",top:0,zIndex:1,background:"var(--bg-inset)",borderRadius:"var(--r-sm) var(--r-sm) 0 0"}:null},children:[a.jsxs("button",{type:"button",onClick:()=>m(S?null:b.id),"aria-expanded":S,style:{flex:1,minWidth:0,display:"flex",alignItems:"center",gap:8,padding:0,background:"none",border:0,font:"inherit",color:"var(--ink-0)",cursor:"pointer",textAlign:"left"},children:[a.jsx(ae,{name:S?"chevronDown":"chevronRight",size:14,color:"var(--ink-2)"}),a.jsx("span",{style:{fontWeight:"var(--fw-medium)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:b.name}),a.jsx(yr,{children:b.kind}),a.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:x(b.model)}),b.kind==="reviewer"&&b.requiredForDone&&a.jsx(yr,{brand:!0,children:"required"})]}),a.jsx(Sa,{icon:"close",size:"sm",label:`Remove ${b.name}`,onClick:()=>c(i.filter((z,D)=>D!==j))})]}),S&&a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-3)",padding:"var(--sp-3)",borderTop:"1px solid var(--line)"},children:[a.jsxs("div",{style:{display:"flex",gap:"var(--sp-3)",flexWrap:"wrap",alignItems:"flex-end"},children:[a.jsx(Fe,{label:"Name",layout:"stacked",style:{flex:"1 1 180px",minWidth:0},children:a.jsx(Ue,{value:b.name,onChange:z=>y(j,"name",z)})}),a.jsx(Fe,{label:"Kind",layout:"stacked",hint:b.kind==="reviewer"?"Judges the finished diff.":"Works alongside the others.",children:a.jsx(Vt,{size:"sm",tabs:qb,value:b.kind,onChange:z=>c(i.map((D,G)=>G===j?{...D,kind:z,requiredForDone:z==="reviewer"?D.requiredForDone:!1}:D))})}),a.jsx(Fe,{label:"Model",layout:"stacked",children:a.jsx(Ut,{allowDefault:!1,models:u,loading:o,note:d,value:b.model||"",onChange:(z,D)=>c(i.map((G,T)=>T===j?{...G,model:z,providerId:D?.providerId}:G))})})]}),a.jsx(Fe,{label:"Brief",layout:"stacked",hint:"What it is for, and what it must say. A reviewer’s verdict is the word PASS or FAIL on its own line.",children:a.jsx(Sr,{size:"answer",value:b.brief||"",onChange:z=>y(j,"brief",z),placeholder:"Review the diff for…",style:{height:120,resize:"none"}})}),a.jsxs("div",{style:{display:"flex",gap:"var(--sp-4)",flexWrap:"wrap",alignItems:"flex-end"},children:[a.jsx(Fe,{label:"Tools",layout:"stacked",hint:"Read-only: Read, Grep, Glob, LS and nothing else.",children:a.jsx(Vt,{size:"sm",tabs:Lb,value:b.toolPolicy||"read-only",onChange:z=>y(j,"toolPolicy",z)})}),b.kind==="reviewer"&&a.jsx(Fe,{label:"Required for done",layout:"stacked",hint:"The run cannot be recorded done until this one passes.",children:a.jsx(yt,{checked:b.requiredForDone===!0,onChange:z=>y(j,"requiredForDone",z)})})]})]})]},b.id)}),a.jsx("div",{children:a.jsx(te,{size:"sm",icon:"add",onClick:p,children:"Add preset"})})]})}function Wb({s:i,selected:c,dot:u,onClick:o}){const[d,f]=g.useState(!1);return a.jsxs("button",{type:"button",onClick:o,"aria-current":c||void 0,onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderRadius:"var(--r-sm)",border:"none",textAlign:"left",cursor:"pointer",font:"inherit",color:c?"var(--ink-0)":"var(--ink-1)",fontWeight:c?"var(--fw-semibold)":"var(--fw-regular)",background:c?"var(--bg-card)":d?"var(--bg-hover)":"transparent",boxShadow:c?"inset 0 0 0 1px var(--line-strong)":"none"},children:[a.jsx(ae,{name:i.icon,size:14,color:c?"var(--brand)":"var(--ink-2)"}),a.jsx("span",{style:{flex:1},children:i.label}),u&&a.jsx("span",{title:"Has project overrides",style:{width:6,height:6,borderRadius:"var(--r-pill)",background:"var(--brand)"}})]})}function $i({label:i,hint:c,children:u,overridden:o,inherits:d,onReset:f,stacked:m,danger:y}){return a.jsxs("div",{style:{display:"grid",gridTemplateColumns:m?"1fr":"1fr auto",gap:m?10:"var(--sp-4)",alignItems:"center",padding:"var(--sp-3) 0",borderBottom:"1px solid var(--line)"},children:[a.jsxs("div",{style:{minWidth:0},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:y?"var(--status-critical)":"var(--ink-0)"},children:[a.jsx("span",{children:i}),d&&a.jsx(yr,{children:"global"}),o&&a.jsxs(a.Fragment,{children:[a.jsx(yr,{brand:!0,children:"override"}),a.jsx("button",{type:"button",onClick:f,style:{background:"none",border:0,padding:0,font:"inherit",fontSize:"var(--fs-xs)",color:"var(--ink-2)",cursor:"pointer",textDecoration:"underline",textUnderlineOffset:2},children:"reset to global"})]})]}),c&&a.jsx("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",marginTop:2},children:c})]}),a.jsx("div",{style:{display:"flex",justifyContent:m?"stretch":"flex-end",minWidth:0},children:u})]})}function yr({children:i,brand:c}){return a.jsx("span",{style:{fontSize:"var(--fs-xs)",letterSpacing:"0.06em",textTransform:"uppercase",padding:"1px 6px",borderRadius:"var(--r-pill)",background:c?"var(--brand-wash-strong)":"var(--bg-inset)",color:c?"var(--brand)":"var(--ink-2)",border:`1px solid ${c?"transparent":"var(--line)"}`},children:i})}function Up({agent:i,status:c="running",task:u,selected:o,indent:d,last:f,onSelect:m,style:y}){const[x,p]=g.useState(!1);return a.jsxs("div",{style:{position:"relative",marginLeft:d?14:0},children:[d&&a.jsx("span",{"aria-hidden":!0,style:{position:"absolute",left:-8,top:0,bottom:f?"50%":0,borderLeft:"1px solid var(--line-strong)"}}),d&&a.jsx("span",{"aria-hidden":!0,style:{position:"absolute",left:-8,top:"50%",width:8,borderTop:"1px solid var(--line-strong)"}}),a.jsxs("div",{role:"button",title:u,onClick:()=>m?.(i),onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"6px 8px",borderRadius:"var(--r-sm)",cursor:"pointer",background:o?"var(--bg-card)":x?"var(--bg-hover)":"transparent",border:o?"1px solid var(--line-strong)":"1px solid transparent",transition:"background var(--dur-fast) var(--ease)",...y},children:[a.jsx(vn,{agent:i}),a.jsx("span",{style:{flex:1,minWidth:0,fontSize:"var(--fs-md)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i}),a.jsx(ja,{status:c})]})]})}function Vb({agents:i=[],filter:c,onFilter:u,sessionId:o,details:d,style:f}){const m=i.find(p=>p.id==="director"),y=i.filter(p=>p.id!=="director"),x={margin:"0 0 6px 0",fontSize:"var(--fs-xs)",color:"var(--ink-1)",lineHeight:"var(--lh)",overflow:"hidden",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-3)",...f},children:[a.jsxs("section",{style:{minWidth:0},children:[a.jsx(kn,{children:"Crew"}),i.length===0&&a.jsx(Ve,{children:"No agents yet."}),m&&a.jsx(Up,{agent:"director",status:m.status,selected:c==="director",onSelect:u}),y.map((p,b)=>a.jsxs(wn.Fragment,{children:[a.jsx(Up,{agent:p.id,status:p.status,task:p.task,indent:!0,last:b===y.length-1,selected:c===p.id,onSelect:u}),p.task&&a.jsx("div",{title:p.task,style:{...x,marginLeft:34},children:p.task})]},p.id)),c&&a.jsxs("div",{style:{marginTop:4,fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:["Transcript shows only ",a.jsx("b",{style:{color:"var(--ink-1)"},children:c})," — click again to clear."]})]}),a.jsxs("section",{style:{minWidth:0},children:[a.jsx(kn,{children:"Run"}),d??a.jsx(Ve,{children:"No run details."}),o&&a.jsxs("div",{style:{marginTop:6,fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontFamily:"var(--font-mono)"},children:["director session ",String(o).slice(0,8)]})]})]})}function Xb({director:i,worker:c,budget:u,spent:o,models:d,loading:f,note:m,busy:y,onResume:x,style:p}){const[b,j]=g.useState(!1),[S,z]=g.useState({id:i||"",providerId:void 0}),[D,G]=g.useState({id:c||"",providerId:void 0}),[T,w]=g.useState(u??0),R=g.useRef(null);g.useEffect(()=>{z({id:i||"",providerId:void 0}),G({id:c||"",providerId:void 0}),w(u??0)},[i,c,u,b]),g.useEffect(()=>{if(!b)return;const I=ue=>{R.current&&!R.current.contains(ue.target)&&j(!1)},W=ue=>{ue.key==="Escape"&&j(!1)};return document.addEventListener("mousedown",I),document.addEventListener("keydown",W),()=>{document.removeEventListener("mousedown",I),document.removeEventListener("keydown",W)}},[b]);const H=typeof u=="number"&&Number.isFinite(T)&&T>0&&Math.abs(T-u)>=.005,K=S.id&&S.id!==i||D.id&&D.id!==c||H,se=()=>{x?.({...S.id&&S.id!==i?{directorModel:S.id,directorProviderId:S.providerId}:{},...D.id&&D.id!==c?{workerModel:D.id,workerProviderId:D.providerId}:{},...H?{budgetUsd:Math.round(T*100)/100}:{}}),j(!1)},B=I=>w(Math.round((T+I)*100)/100),q={fontSize:"var(--fs-xs)",color:"var(--ink-2)",textTransform:"uppercase",letterSpacing:"var(--ls-caps)",marginBottom:4};return a.jsxs("div",{ref:R,style:{position:"relative",display:"inline-flex",...p},children:[a.jsx(te,{variant:"good",icon:"resume",disabled:y,title:"Restore the director's session and continue this mission",onClick:()=>x?.({}),style:{borderTopRightRadius:0,borderBottomRightRadius:0},children:y?"Resuming…":"Resume"}),a.jsx(te,{variant:"good",disabled:y,"aria-label":"Resume on other models",title:"Resume on other models…",onClick:()=>j(!b),style:{borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeft:"1px solid rgba(255,255,255,0.35)",paddingLeft:6,paddingRight:6},children:a.jsx(ae,{name:"chevronDown",size:14})}),b&&a.jsxs("div",{role:"dialog","aria-label":"Resume on other models",style:{position:"absolute",top:"calc(100% + 6px)",right:0,zIndex:50,width:340,background:"var(--bg-card)",border:"1px solid var(--line-strong)",borderRadius:"var(--r-md)",boxShadow:"0 12px 32px rgba(0,0,0,0.25)",padding:"var(--sp-3)",display:"flex",flexDirection:"column",gap:"var(--sp-3)"},children:[a.jsx("div",{style:{fontSize:"var(--fs-sm)",color:"var(--ink-1)",lineHeight:"var(--lh)"},children:"Same mission, other terms. A new director starts a fresh session and reads the mission doc; workers change for the next spawns; a new cap applies from the first turn."}),typeof u=="number"&&a.jsxs("div",{children:[a.jsx("div",{style:q,children:"Budget cap"}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[a.jsx("span",{style:{color:"var(--ink-2)"},children:"$"}),a.jsx("input",{type:"number",min:"0.5",step:"0.5",value:T,onChange:I=>w(Number(I.target.value)),style:{width:72,font:"inherit",fontFamily:"var(--font-mono)",padding:"4px 6px",border:"1px solid var(--line-strong)",borderRadius:"var(--r-sm)",background:"var(--bg-inset)",color:"var(--ink-0)"}}),a.jsx(te,{size:"sm",onClick:()=>B(5),children:"+$5"}),a.jsx(te,{size:"sm",onClick:()=>B(10),children:"+$10"}),a.jsx(te,{size:"sm",onClick:()=>w(Math.round(u*2*100)/100),children:"×2"}),typeof o=="number"&&a.jsxs("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontVariantNumeric:"tabular-nums"},children:["$",o.toFixed(2)," spent of $",u.toFixed(2)]})]})]}),a.jsxs("div",{children:[a.jsx("div",{style:q,children:"Director"}),a.jsx(Ut,{block:!0,allowDefault:!1,models:d,loading:f,note:m,value:S.id,onChange:(I,W)=>z({id:I,providerId:W?.providerId})})]}),a.jsxs("div",{children:[a.jsx("div",{style:q,children:"Workers"}),a.jsx(Ut,{block:!0,allowDefault:!1,models:d,loading:f,note:m,value:D.id,onChange:(I,W)=>G({id:I,providerId:W?.providerId})})]}),a.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"var(--sp-2)"},children:[a.jsx(te,{variant:"ghost",size:"sm",onClick:()=>j(!1),children:"Cancel"}),a.jsx(te,{variant:"good",size:"sm",icon:"resume",disabled:y||!K,onClick:se,title:K?"Resume on these terms":"Change a model or the cap first — or use Resume as is",children:"Resume"})]})]})]})}function Qb(i,c){const u=Vp(i.provider);return!i.provider||!u?c:i.provider.kind==="claude-code"?i.provider.ownLogin?`${u} (this project's own login)`:u:`${i.provider.kind} · ${u}`}function Kb(i){const c=`(min-width: ${i}px)`,[u,o]=g.useState(()=>typeof window<"u"&&window.matchMedia(c).matches);return g.useEffect(()=>{const d=window.matchMedia(c),f=()=>o(d.matches);return f(),d.addEventListener("change",f),()=>d.removeEventListener("change",f)},[c]),u}const Zb=1100;function Fb(i){const c=i.agents.filter(y=>y.status==="running"),u=c.filter(y=>y.id!=="director").length,o=c.length===0?"":[c.some(y=>y.id==="director")?"director":null,u?`${u} worker${u===1?"":"s"}`:null].filter(Boolean).join(" · ");let d=null;for(let y=i.entries.length-1;y>=0&&y>=i.entries.length-40;y--){const x=i.entries[y],p=x.kind==="system"&&x.title.startsWith("progress"),b=x.kind==="text"&&x.agent==="director";if(p||b){d=x;break}}if(!d){const y=c.find(x=>x.id!=="director"&&x.task);return y?{line:`${y.id}: ${y.task}`,agent:y.id,crew:o}:o?{line:"Crew is starting up",crew:o}:null}const f=d.body.split(`
74
+ `).find(y=>y.trim())??"";return{line:`${d.agent}: ${f.replace(/[*_`#>]/g,"").trim().slice(0,160)}`,agent:d.agent,crew:o}}function Ka({label:i,open:c,onToggle:u,children:o}){return a.jsxs("div",{style:{border:"1px solid var(--line)",borderRadius:"var(--r-sm)",background:"var(--bg-panel)"},children:[a.jsxs("button",{type:"button",onClick:u,style:{display:"flex",alignItems:"center",gap:6,width:"100%",padding:"6px 10px",background:"none",border:"none",cursor:"pointer",font:"inherit",textAlign:"left",fontSize:"var(--fs-xs)",color:"var(--ink-2)",textTransform:"uppercase",letterSpacing:"var(--ls-caps)"},children:[a.jsx(ae,{name:c?"chevronDown":"chevronRight",size:12}),i]}),c&&a.jsx("div",{style:{padding:"0 10px 10px"},children:o})]})}const yv={width:"100%",maxWidth:"var(--spine-max)",margin:"0 auto",display:"flex",flexDirection:"column",gap:"var(--sp-2)",boxSizing:"border-box"},Hp="foreman.transcriptOrder",Bp="foreman.timeline",vr=i=>new Date(i).toLocaleDateString(void 0,{month:"short",day:"numeric"}),$p="foreman.railWidth",eu=280,qp=340,xv=i=>`foreman.crew.${i}`,Jb=[{id:"reviewer",name:"Reviewer",kind:"reviewer",model:"opus",brief:"",toolPolicy:"read-only",requiredForDone:!0},{id:"security-review",name:"Security review",kind:"reviewer",model:"opus",brief:"",toolPolicy:"read-only",requiredForDone:!1}];function Ib(i){const c=u=>u?.crewPresets;return c(i.project)??c(i.global)}function Lp(i,c){try{const u=JSON.parse(localStorage.getItem(xv(i))||"null");return Array.isArray(u)?c.filter(o=>u.includes(o.id)).map(o=>o.id):[]}catch{return[]}}function Pb(i,c){try{localStorage.setItem(xv(i),JSON.stringify(c))}catch{}}function e2(){const[i,c]=g.useState(()=>{try{return localStorage.getItem(Hp)==="oldest"?"oldest":"newest"}catch{return"newest"}});return[i,u=>{c(u);try{localStorage.setItem(Hp,u)}catch{}}]}function Yp(i,c){return c==="newest"?0:i.scrollHeight}function t2({run:i,filter:c,jump:u,order:o,header:d}){const f=g.useRef(null),m=g.useRef(!0),[y,x]=g.useState(null),p=c?i.entries.filter(j=>j.agent===c):i.entries,b=o==="newest"?[...p].reverse():p;return g.useEffect(()=>{const j=f.current;j&&m.current&&(j.scrollTop=Yp(j,o))},[b.length,o]),g.useEffect(()=>{m.current=!0;const j=f.current;j&&(j.scrollTop=Yp(j,o))},[o]),g.useEffect(()=>{if(!u)return;m.current=!1;const j=requestAnimationFrame(()=>{document.getElementById(`entry-${u.id}`)?.scrollIntoView({behavior:"smooth",block:"center"}),x(u.id)}),S=setTimeout(()=>x(null),1600);return()=>{cancelAnimationFrame(j),clearTimeout(S)}},[u]),a.jsx("div",{ref:f,onScroll:j=>{const S=j.currentTarget;m.current=o==="newest"?S.scrollTop<60:S.scrollHeight-S.scrollTop-S.clientHeight<60},style:{overflowY:"auto",padding:"var(--sp-3)",minHeight:0,flex:1,display:"flex",flexDirection:"column",gap:"var(--sp-2)"},children:a.jsxs("div",{style:yv,children:[d,b.length===0&&a.jsx(Ve,{children:"Transcript will appear here."}),b.map(j=>a.jsx("div",{id:`entry-${j.id}`,style:{scrollMarginTop:8,borderRadius:"var(--r-sm)",outline:y===j.id?"2px solid var(--brand)":"none",transition:"outline-color var(--dur-fast) var(--ease)"},children:a.jsx(uu,{agent:j.agent,title:j.title,dense:!0,kind:j.kind,body:j.body,ts:j.ts,to:j.to,timing:j.timing,review:j.review,costBasis:i.costBasis})},j.id))]})})}function n2(i){const[c,u]=g.useState({text:"",loaded:!1});return g.useEffect(()=>{let o=!1;const d=()=>ke.memory(i).then(async m=>{if(o||!m.ok)return;const y=await m.json();u({text:y.text??"",updatedAt:y.updatedAt,loaded:!0})}).catch(()=>{});d();const f=Ol((m,y)=>{m==="memory_updated"&&y.projectId===i&&d()});return()=>{o=!0,f()}},[i]),c}function a2(i,c){const[u,o]=g.useState([]),d=wn.useCallback(()=>{if(!i){o([]);return}ke.runServices(i).then(async f=>{if(!f.ok)return;const m=await f.json();o(m.services??[])}).catch(()=>{})},[i]);return g.useEffect(d,[d,c]),{list:u,refresh:d}}function l2({runId:i,services:c,onDone:u}){const[o,d]=g.useState(null),[f,m]=g.useState(""),y=c.filter(p=>p.listening);if(!y.length)return null;const x=async p=>{d(p),m("");const b=await ke.stopService(i,p).finally(()=>d(null));b.ok||m((await b.json().catch(()=>({error:"could not stop it"}))).error),u()};return a.jsxs(Je,{tone:"caution",children:["This run left ",y.length===1?"a server":`${y.length} servers`," running:"," ",y.map((p,b)=>a.jsxs("span",{children:[b>0?", ":"",a.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:p.port})," (",p.label,")",p.ours?a.jsx(te,{variant:"ghost",size:"sm",disabled:o===p.port,style:{marginLeft:4},onClick:()=>{x(p.port)},children:o===p.port?"Stopping…":"Stop"}):a.jsx("span",{style:{color:"var(--ink-2)"},children:" — held by another process now, left alone"})]},p.port)),f&&a.jsx("div",{style:{marginTop:4,color:"var(--ink-2)"},children:f})]})}function i2({memory:i}){const c=i.updatedAt?new Date(i.updatedAt).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):null;return a.jsxs("section",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-2)"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--sp-2)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",textTransform:"uppercase",letterSpacing:"var(--ls-caps)"},children:["Memory",c&&a.jsx("span",{style:{textTransform:"none",letterSpacing:0,marginLeft:"auto"},children:c})]}),i.loaded&&!i.text.trim()?a.jsxs(Ve,{children:["Nothing yet. The director writes ",a.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:".foreman/MEMORY.md"})," at the end of a mission: how to run and test the project, ports and paths, conventions, traps. Every later crew and the planner read it first."]}):i.text.trim()?a.jsx("div",{title:"The project's notes for the next crew — .foreman/MEMORY.md. Edit it with any editor.",style:{padding:"var(--sp-2) var(--sp-3)",background:"var(--bg-card)",border:"1px solid var(--line)",borderRadius:"var(--r-sm)",fontSize:"var(--fs-sm)",maxHeight:"40vh",overflowY:"auto"},children:a.jsx(Nl,{text:i.text})}):null]})}function s2({runId:i,onClose:c,onDone:u}){const[o,d]=g.useState(null),[f,m]=g.useState(""),[y,x]=g.useState(""),[p,b]=g.useState(""),[j,S]=g.useState(!1),[z,D]=g.useState(null);g.useEffect(()=>{let w=!1;return ke.prDraft(i).then(async R=>{const H=await R.json().catch(()=>({}));if(!w){if(!R.ok){m(H.error??`HTTP ${R.status}`);return}d(H),x(H.title),b(H.body)}}).catch(()=>{w||m("Could not reach the server.")}),()=>{w=!0}},[i]);const G=async()=>{S(!0),m("");try{const w=await ke.openPr(i,y,p),R=await w.json().catch(()=>({}));if(!w.ok){m(R.error??`HTTP ${w.status}`);return}D(R),u(R.url)}finally{S(!1)}},T=o?.gh.present&&o.gh.authed&&/github\.com/.test(o.remote);return a.jsxs(Ul,{width:640,onClose:j?void 0:c,children:[a.jsxs("div",{style:{padding:"var(--sp-3)",borderBottom:"1px solid var(--line)",display:"flex",flexDirection:"column",gap:4},children:[a.jsx("span",{style:{fontWeight:"var(--fw-semibold)"},children:"Open a pull request"}),o&&a.jsxs("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontFamily:"var(--font-mono)"},children:[o.branch," → ",o.base,o.commits!==null?` · ${o.commits} commit${o.commits===1?"":"s"}`:""," · ",o.remote]})]}),a.jsxs("div",{style:{padding:"var(--sp-3)",display:"flex",flexDirection:"column",gap:"var(--sp-3)",overflowY:"auto",minHeight:0},children:[!o&&!f&&a.jsx(Ve,{children:"Reading the branch…"}),o&&!z&&a.jsxs(a.Fragment,{children:[o.pr&&a.jsxs(Je,{tone:"readonly",inline:!0,children:["A pull request already exists for this branch: ",a.jsx("a",{href:o.pr,target:"_blank",rel:"noopener noreferrer",children:o.pr})]}),o.baseFellBack&&a.jsxs(Je,{tone:"caution",inline:!0,children:["This mission was branched from ",a.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:o.branchedFrom}),", which is not on the remote — a previous mission's branch, most likely. The request targets"," ",a.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:o.base})," instead, so it carries that mission's commits too until its own branch is merged."]}),!o.onBranch&&a.jsxs(Je,{tone:"caution",inline:!0,children:["The folder is currently on another branch. The push sends ",o.branch," as it is in git, which is fine; just know what you are looking at locally."]}),o.dirty&&o.onBranch&&a.jsx(Je,{tone:"caution",inline:!0,children:"There are uncommitted changes in the folder. They are not part of this pull request."}),a.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:6,fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:["Title",a.jsx(Ue,{value:y,onChange:x})]}),a.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:6,fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:["Body",a.jsx(Sr,{size:"mission",value:p,onChange:b})]}),a.jsxs("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:["Create pushes ",a.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:o.branch})," to origin as you, with your own git credentials",T?a.jsxs(a.Fragment,{children:[", then opens the pull request with ",a.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:"gh"}),"."]}):a.jsxs(a.Fragment,{children:[", then gives you the link to finish the pull request in the browser",o.gh.present?"":" (gh is not installed)","."]})," ","Nothing is merged."]})]}),z&&a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-2)"},children:[a.jsx("span",{children:z.method==="gh"?"Pull request opened.":"Branch pushed. Finish the pull request in the browser:"}),z.url&&a.jsx("a",{href:z.url,target:"_blank",rel:"noopener noreferrer",style:{fontFamily:"var(--font-mono)",wordBreak:"break-all"},children:z.url}),z.note&&a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:z.note})]}),f&&a.jsx(Je,{tone:"error",inline:!0,children:f})]}),a.jsxs(Hl,{children:[a.jsx("span",{style:{flex:1}}),a.jsx(te,{onClick:c,disabled:j,children:z?"Close":"Cancel"}),o&&!z&&a.jsx(te,{variant:"primary",disabled:j||!y.trim(),onClick:()=>{G()},children:j?"Pushing…":T?"Push & create pull request":"Push & get the link"})]})]})}function r2({chat:i,folder:c,starting:u,error:o,errorAction:d,models:f,modelsLoading:m,modelsNote:y,modelsInheritNote:x,onStart:p,onCompose:b,hasRuns:j,projectId:S,onSettings:z,crewPresets:D=[],crew:G=[],onCrewChange:T,recent:w=[],runsOn:R,onOpenRun:H,onForkRun:K,forking:se=!1}){const[B,q]=g.useState(""),[I,W]=g.useState(""),[ue,ne]=g.useState(0),[de,je]=g.useState(!1),re=P=>{W(P),ne(oe=>oe+1)},xe=async(P,oe=[])=>{q("");try{await i.send(await Fp(S,P,oe))}catch(k){q(k.message)}},_=g.useRef(null),O=g.useRef(!0);return g.useEffect(()=>{const P=_.current;P&&O.current&&(P.scrollTop=P.scrollHeight)},[i.entries.length,i.proposal,i.thinking]),i.entries.length===0&&!i.thinking&&!i.question&&!i.proposal?a.jsx("div",{style:{flex:1,minHeight:0,overflowY:"auto",display:"flex",flexDirection:"column"},children:a.jsxs("div",{style:{margin:"auto",width:"100%",maxWidth:"var(--composer-max)",padding:"var(--sp-4) var(--sp-3)",boxSizing:"border-box",display:"flex",flexDirection:"column",gap:"var(--sp-4)"},children:[a.jsxs("div",{style:{textAlign:"center",display:"flex",flexDirection:"column",gap:"var(--sp-1)"},children:[a.jsx("span",{style:{fontSize:"var(--fs-lg)",fontWeight:"var(--fw-semibold)"},children:w.length?"Pick up where you left off, or start something new":"What should this project do next?"}),a.jsx("span",{style:{fontSize:"var(--fs-sm)",color:"var(--ink-2)"},children:w.length?"Open a run to see what it built, plan the next step from it, or describe something new below.":"Describe it, paste a spec or a screenshot, or pick a starter and edit it before sending."})]}),w.length>0&&a.jsxs("div",{style:{border:"1px solid var(--line)",borderRadius:"var(--r-md)",background:"var(--bg-card)",overflow:"hidden"},children:[(de?w:w.slice(0,4)).map((P,oe)=>{const k=P.status!=="running",V=new Date(P.createdAt).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});return a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) auto",alignItems:"center",gap:"var(--sp-3)",padding:"var(--sp-2) var(--sp-3)",borderTop:oe>0?"1px solid var(--line)":"none"},children:[a.jsxs("button",{type:"button",onClick:()=>H?.(P.id),title:"Open this run",style:{minWidth:0,textAlign:"left",background:"none",border:0,padding:0,font:"inherit",color:"inherit",cursor:"pointer",display:"flex",flexDirection:"column",gap:2},children:[a.jsx("span",{style:{fontSize:"var(--fs-sm)",color:"var(--ink-0)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:P.title||P.mission.split(`
75
+ `)[0]}),a.jsxs("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",display:"inline-flex",alignItems:"center",gap:"var(--sp-2)",fontVariantNumeric:"tabular-nums"},children:[a.jsx(ja,{status:P.status}),a.jsx("span",{children:V}),ba(P)==="priced"&&a.jsxs("span",{children:["$",P.costUsd.toFixed(2)]})]})]}),a.jsxs("span",{style:{display:"inline-flex",gap:"var(--sp-1)",flex:"0 0 auto"},children:[a.jsx(te,{variant:"ghost",size:"sm",onClick:()=>H?.(P.id),children:"Open"}),k&&a.jsx(te,{size:"sm",icon:"steer",disabled:se||i.thinking,title:"Start a planning conversation seeded with what this run built",onClick:()=>K?.(P.id),children:"Plan the next step"})]})]},P.id)}),w.length>4&&a.jsx("div",{style:{borderTop:"1px solid var(--line)",padding:"4px var(--sp-2)"},children:a.jsx(te,{variant:"ghost",size:"sm",onClick:()=>je(P=>!P),children:de?"Show the latest four":`Show all ${w.length} runs`})})]}),a.jsx("div",{style:{display:"grid",gridTemplateColumns:`repeat(auto-fit, minmax(${w.length?150:200}px, 1fr))`,gap:"var(--sp-2)"},children:[...w.length?[]:[{t:"Survey the project",q:"Read this project and tell me what it is, how it is built, and what state it is in."}],{t:"Find risks worth a mission",q:"Audit this project for bugs, security holes and missing tests. Rank what you find and propose the one mission most worth running first."},{t:"Scope a feature",q:"I have a feature in mind. Ask me what you need to know to scope it, then draft the mission."},{t:"Plan a refactor",q:"Where is this codebase hardest to change? Propose one contained refactor with clear DONE WHEN criteria."}].map(P=>a.jsxs("button",{type:"button",onClick:()=>re(P.q),disabled:i.thinking,title:w.length?P.q:void 0,style:{textAlign:"left",padding:w.length?"6px 10px":"8px 10px",background:"var(--bg-card)",border:"1px solid var(--line)",borderRadius:"var(--r-sm)",cursor:"pointer",font:"inherit",color:"inherit",display:"flex",flexDirection:"column",gap:2},children:[a.jsx("span",{style:{fontSize:"var(--fs-sm)",fontWeight:"var(--fw-semibold)",color:"var(--ink-0)"},children:P.t}),!w.length&&a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",lineHeight:"var(--lh)"},children:P.q})]},P.t))}),a.jsx(au,{value:I,onChange:W,busy:i.thinking,who:i.who,onSend:(P,oe)=>{xe(P,oe)},onStop:()=>{i.stop()},onChangeModel:z,autoFocus:!0},ue),B&&a.jsx(Je,{tone:"error",inline:!0,children:B}),a.jsxs("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",textAlign:"center"},children:["Planning reads the project and never changes it — a mission does that. Know what you want already? ",a.jsx("b",{style:{color:"var(--ink-1)"},children:"New mission"}),", top right."]}),R&&a.jsx("div",{style:{display:"flex",justifyContent:"center"},children:R})]})}):a.jsxs(a.Fragment,{children:[a.jsx("div",{ref:_,onScroll:P=>{const oe=P.currentTarget;O.current=oe.scrollHeight-oe.scrollTop-oe.clientHeight<60},style:{flex:1,minHeight:0,overflowY:"auto",padding:"var(--sp-3)",display:"flex",flexDirection:"column",gap:"var(--sp-2)"},children:a.jsxs("div",{style:yv,children:[i.entries.map((P,oe)=>{const k=vr(P.ts),V=oe>0?vr(i.entries[oe-1].ts):null;return a.jsxs(wn.Fragment,{children:[k!==V&&(oe>0||k!==vr(Date.now()))&&a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",margin:"4px 0"},children:[a.jsx("span",{style:{flex:1,borderTop:"1px solid var(--line)"}}),a.jsx("span",{children:k===vr(Date.now())?"today":k}),a.jsx("span",{style:{flex:1,borderTop:"1px solid var(--line)"}})]}),a.jsx(uu,{agent:P.agent,title:P.title,kind:P.kind,body:P.body,ts:P.ts})]},P.id)}),i.proposal&&a.jsx(Z1,{mission:i.proposal.mission,doneWhen:i.proposal.doneWhen,budgetUsd:i.proposal.budgetUsd,rationale:i.proposal.rationale,browser:i.proposal.browser,directorModel:i.proposal.directorModel,workerModel:i.proposal.workerModel,directorProviderId:i.proposal.directorProviderId,workerProviderId:i.proposal.workerProviderId,modelRationale:i.proposal.modelRationale,crewPresets:D,crew:i.proposal.crew??G,onCrewChange:T,models:f,modelsLoading:m,modelsNote:y,modelsInheritNote:x,busy:u,error:o,errorAction:d,onStart:P=>p(P),onDismiss:i.dismissProposal})]})}),a.jsxs("div",{style:{padding:"var(--sp-2) var(--sp-3) var(--sp-3)",flex:"0 0 auto",width:"100%",maxWidth:"var(--spine-max)",margin:"0 auto",boxSizing:"border-box"},children:[i.question?a.jsx(K1,{questions:i.question.questions,askedAt:i.question.askedAt,who:i.who,onAnswer:P=>{i.answer(i.question.id,P)},onFreeText:P=>{xe(P)}}):a.jsx(au,{busy:i.thinking,who:i.who,onSend:(P,oe)=>{xe(P,oe)},onStop:()=>{i.stop()},onChangeModel:z}),B&&a.jsx(Je,{tone:"error",inline:!0,style:{marginTop:4},children:B}),(i.costUsd>0||i.entries.length>0)&&a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"4px 2px 0",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:[i.costUsd>0&&a.jsxs("span",{title:"What this conversation has cost so far. Planning is not charged to any mission budget.",style:{fontVariantNumeric:"tabular-nums"},children:["conversation $",i.costUsd.toFixed(3)]}),a.jsx("span",{style:{flex:1}}),i.thinking&&a.jsx(te,{variant:"ghost",size:"sm",icon:"close",title:"Stop the planner and discard the rest of this reply",onClick:()=>{i.stop()},children:"Stop"}),i.entries.length>0&&a.jsx(te,{variant:"ghost",size:"sm",icon:"close",disabled:i.thinking,title:i.thinking?"The planner is replying — clear once it has answered.":"Forget this conversation and start a new one",onClick:()=>{i.clear()},children:i.thinking?"Clear (after this reply)":"Clear conversation"})]})]}),a.jsxs("button",{type:"button",onClick:b,style:{flex:"0 0 auto",display:"flex",alignItems:"center",gap:6,margin:"0 auto var(--sp-3)",padding:"6px 10px",width:"calc(100% - 2 * var(--sp-3))",maxWidth:"calc(var(--spine-max) - 2 * var(--sp-3))",boxSizing:"border-box",background:"none",border:"1px dashed var(--line-strong)",borderRadius:"var(--r-sm)",cursor:"pointer",font:"inherit",fontSize:"var(--fs-xs)",color:"var(--ink-2)",textAlign:"left"},children:[a.jsx(ae,{name:"write",size:12}),"Or skip the talk: describe the mission and start it",a.jsx(ae,{name:"chevronRight",size:12,style:{marginLeft:"auto"}})]})]})}function o2({r:i,live:c,liveCost:u,liveBasis:o,liveUsage:d,liveTurns:f,onChanged:m}){const[y,x]=g.useState(!1),[p,b]=g.useState(""),j=!!c&&i.status==="running",S=async R=>{x(!0),b("");try{await ke.updateRun(i.id,R),m?.()}catch(H){b(H instanceof Error?H.message:String(H))}finally{x(!1)}},z=o??ba(i),D=d??i.usage??null,G=f??i.turns,T=[["director",i.directorModel||"default"],["workers",i.workerModel||"default"],["budget",z==="priced"?`$${((u??i.costUsd)||0).toFixed(2)} / $${i.budgetUsd.toFixed(2)}`:`${Za(D?.inputTokens??0)} in · ${Za(D?.outputTokens??0)} out${typeof G=="number"?` · ${G} turn${G===1?"":"s"}`:""}`+(z==="unpriced"?" · cost not tracked":" · no per-token cost")]],w={color:"var(--ink-1)",fontFamily:"var(--font-mono)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};return a.jsxs("div",{style:{marginTop:8,fontSize:"var(--fs-xs)"},children:[a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",columnGap:10,rowGap:2},children:[T.map(([R,H])=>a.jsxs(wn.Fragment,{children:[a.jsx("span",{style:{color:"var(--ink-2)"},children:R}),a.jsx("span",{style:w,children:H})]},R)),a.jsx("span",{style:{color:"var(--ink-2)"},children:"browser"}),j?a.jsx("button",{type:"button",disabled:y,onClick:()=>{S({browserTools:!i.browserTools})},title:i.browserTools?"Turn off. No worker spawned after this gets a browser.":"Turn on. Workers spawned after this get a headless browser; the director itself gains it when the run is resumed.",style:{...w,justifySelf:"start",background:"none",padding:0,border:"none",borderBottom:"1px dashed var(--line-strong)",cursor:y?"wait":"pointer",font:"inherit",fontFamily:"var(--font-mono)",color:"var(--ink-1)"},children:i.browserTools?"on":"off"}):a.jsx("span",{style:w,children:i.browserTools?"on":"off"}),i.resumes?a.jsxs(a.Fragment,{children:[a.jsx("span",{style:{color:"var(--ink-2)"},children:"resumes"}),a.jsx("span",{style:w,children:i.resumes})]}):null]}),p&&a.jsx("div",{style:{marginTop:4,color:"var(--status-critical)"},children:p})]})}function c2({p:i,models:c,modelsLoading:u,modelsNote:o,modelsInheritNote:d,routeRunId:f,onSelectRun:m,routeTab:y,onSelectTab:x,onBack:p,refreshFleet:b,auth:j,theme:S,onToggleTheme:z,onSettings:D,settings:G,search:T}){const w=Qg(i.id),R=n2(i.id),H=Kg(i.id),[K,se]=g.useState(null),B=async J=>{const Me=await J.catch(()=>null);return Me?Me.ok?(await H.reload(),null):(await Me.json().catch(()=>({}))).error??`HTTP ${Me.status}`:"could not reach the server"},q={...su,...G.global,...G.project??{}},I=Object.keys(G.project??{}),W=q.gitBranchPerMission!==!1,ue=Ib(G),ne=g.useMemo(()=>Array.isArray(ue)?ue:Jb,[ue]),[de,je]=g.useState(()=>Lp(i.id,ne));g.useEffect(()=>{je(Lp(i.id,ne))},[i.id,ne]);const re=J=>{je(J),Pb(i.id,J)},xe=a.jsxs("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",display:"inline-flex",alignItems:"center",gap:6,flexWrap:"wrap",justifyContent:"center"},children:[a.jsx("span",{children:"missions here run on"}),a.jsxs("span",{style:{fontFamily:"var(--font-mono)",color:"var(--ink-1)"},children:[String(q.directorModel??"opus")," · ",String(q.workerModel??"sonnet")]}),a.jsx("span",{children:"· cap"}),a.jsxs("span",{style:{fontFamily:"var(--font-mono)",color:"var(--ink-1)"},children:["$",String(q.budgetCap??6)]}),i.git?.repo&&a.jsxs("span",{children:["· ",W?"each on its own branch":`on ${i.git.branch} directly`]}),I.length>0&&a.jsxs("span",{children:["· ",I.length," project override",I.length===1?"":"s"]}),a.jsx(te,{variant:"ghost",size:"sm",icon:"settings",onClick:D,children:"Change…"})]}),_=i.activeRun?.id??null,O=f,ee=m;g.useEffect(()=>{_&&m(_)},[_]);const P=_?w.find(J=>J.id===_)?.git?.branch:void 0,oe=O!==null&&O===_,k=Wg(O,oe),V=a2(O,k.runStatus),C=w.find(J=>J.id===O),L=oe&&k.runStatus==="running",[Z,ce]=g.useState(null),[be,He]=g.useState(null),ge=y,ie=x,[qe,le]=g.useState(()=>{try{const J=Number(localStorage.getItem($p));return J>=eu?J:qp}catch{return qp}}),at=J=>{const Me=Math.max(eu,Math.floor(window.innerWidth*.5)),Ze=Math.min(Me,Math.max(eu,Math.round(J)));le(Ze);try{localStorage.setItem($p,String(Ze))}catch{}},ot=J=>{J.preventDefault();const Me=J.clientX,Ze=qe,mt=Vl=>at(Ze+(Me-Vl.clientX)),dn=()=>{window.removeEventListener("pointermove",mt),window.removeEventListener("pointerup",dn),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("pointermove",mt),window.addEventListener("pointerup",dn)},pe=J=>{typeof J.id=="number"&&(Z&&Z!==J.agent&&ce(null),He({id:J.id,n:Date.now()}))},Ie=J=>ce(Z===J?null:J),[lt,on]=g.useState(!1),[ht,Xt]=e2(),[Et,Bl]=g.useState(()=>{try{return localStorage.getItem(Bp)!=="closed"}catch{return!0}}),zn=J=>{Bl(J);try{localStorage.setItem(Bp,J?"open":"closed")}catch{}},[vt,kr]=g.useState(!1),[$l,qi]=g.useState(!1),[ka,wr]=g.useState(!1),[wa,Li]=g.useState(!1),[Yi,za]=g.useState(!1),[Ct,Ht]=g.useState(""),[xt,Gi]=g.useState(!1),[zr,Wi]=g.useState(!1),[Ca,Fa]=g.useState(!1),[Qt,Kt]=g.useState(null),Ta=C?.git?.pr;g.useEffect(()=>{if(!O||!Ta){Kt(null);return}if(C?.git?.prState){Kt({runId:O,state:C.git.prState});return}let J=!1;return ke.prState(O).then(async Me=>{const Ze=Me.ok?await Me.json():{state:null};J||Kt({runId:O,state:Ze.state})}).catch(()=>{J||Kt({runId:O,state:null})}),()=>{J=!0}},[O,Ta,C?.git?.prState]);const Vn=async J=>{Ht(""),Gi(!0);try{const Me=await ke.forkPlan(i.id,J);if(!Me.ok){Ht((await Me.json()).error);return}ee(null)}finally{Gi(!1)}},[Vi,Ma]=g.useState(""),[Xn,Qn]=g.useState(null),[Xi,Ja]=g.useState(!1),Qi=Zp(_?null:i.id),[ql,Ea]=g.useState(!1),cn=Kb(Zb),mn=A1(O,L),Cn=D1(i.id,O),Zt=k.approvals.length+k.questions.length,[it,bt]=g.useState(()=>Date.now());g.useEffect(()=>{if(Zt===0&&!L)return;bt(Date.now());const J=setInterval(()=>bt(Date.now()),1e4);return()=>clearInterval(J)},[Zt,L]),g.useEffect(()=>{ce(null)},[O]);const Kn=g.useMemo(()=>L?Fb(k):null,[L,k]),Ll=g.useMemo(()=>hv(k.missionDoc),[k.missionDoc]),Yl=async(J={})=>{if(!O)return;Ht(""),on(!0);const Me=await ke.resume(O,J).finally(()=>on(!1));Me.ok?b():Ht((await Me.json()).error)},Ia=async(J,Me=!1)=>{Ma(""),Qn(null),Ja(!0);let Ze=J.mission;try{Ze=await Fp(i.id,J.mission,J.attachments??[])}catch(Vl){Ma(Vl.message),Ja(!1);return}const mt=await ke.run(i.id,Ze,J.budget,{directorModel:J.directorModel,workerModel:J.workerModel,directorProviderId:J.directorProviderId,workerProviderId:J.workerProviderId,browserTools:J.browserTools,crew:J.crew,allowDirty:Me||void 0}).finally(()=>Ja(!1));if(mt.ok){b();return}const dn=await mt.json().catch(()=>({}));Ma(dn.error??"could not start"),dn.code==="dirty-checkout"&&(Ma(`${dn.error}${dn.files?.length?` (${dn.files.join(", ")})`:""}`),Qn({v:{...J,mission:Ze,attachments:[]}}))},Ki=!_&&O===null,gn=$g(C),_a=!_&&O&&(C?.status==="interrupted"||C?.status==="error")&&C?.directorSessionId,Zn=cn&&C&&(C.directorModel||C.workerModel)?a.jsxs("span",{title:`director: ${C.directorModel||"default"} · workers: ${C.workerModel||"default"}`,style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 8px",borderRadius:"var(--r-pill)",border:"1px solid var(--line)",background:"var(--bg-inset)",fontSize:"var(--fs-xs)",fontFamily:"var(--font-mono)",color:"var(--ink-1)",maxWidth:260,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[a.jsx(ae,{name:"model",size:11}),C.directorModel||"default"," · ",C.workerModel||"default"]}):null,un=C?.scheduleId?H.schedules.find(J=>J.id===C.scheduleId)?.name:void 0,Aa=C?.scheduleId?a.jsxs("span",{title:un?`Started by the schedule "${un}" — nobody pressed anything`:"Started by a schedule that has since been deleted",style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 8px",borderRadius:"var(--r-pill)",border:"1px solid var(--line)",background:"var(--bg-inset)",fontSize:"var(--fs-xs)",fontFamily:"var(--font-mono)",color:"var(--ink-1)",maxWidth:260,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[a.jsx(ae,{name:"timeline",size:11}),un?`scheduled · ${un}`:"scheduled"]}):null,Fn=C&&a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,minWidth:0},children:[a.jsx("div",{style:{fontSize:"var(--fs-sm)",fontWeight:"var(--fw-semibold)",color:"var(--ink-0)",lineHeight:"var(--lh)"},title:C.mission,children:C.title||C.mission.split(`
76
+ `).find(J=>J.trim())||"Untitled run"}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontVariantNumeric:"tabular-nums",flexWrap:"wrap"},children:[a.jsx("span",{children:new Date(C.createdAt).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}),a.jsx(ja,{status:oe?k.runStatus:C.status}),!oe&&a.jsx("span",{children:"read-only"})]})]}),Pe=a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[w.length===0&&a.jsx(Ve,{children:"No runs yet."}),w.map(J=>a.jsx(tb,{mission:J.mission,title:J.title,createdAt:J.createdAt,costUsd:J.costUsd,costBasis:ba(J),usage:J.usage,status:J.status,selected:J.id===O,current:J.id===_,onSelect:J.id===O?void 0:()=>ee(J.id)},J.id))]}),Gl=a.jsx(kb,{schedules:H.schedules,monthSpendUsd:H.monthSpendUsd,monthlyCapUsd:H.monthlyCapUsd,loading:H.loading,error:H.error,projectId:i.id,onNew:()=>se("new"),onEdit:J=>se(J),onPause:J=>B(ke.pauseSchedule(J.id)),onResume:J=>B(ke.resumeSchedule(J.id)),onRunNow:async J=>{const Me=await B(ke.runScheduleNow(J.id));return Me||b(),Me},onDelete:J=>B(ke.deleteSchedule(J.id))}),Wl=(J,Me)=>a.jsxs("aside",{style:{position:"relative",borderLeft:"1px solid var(--line)",background:"var(--bg-panel)",minHeight:0,minWidth:0,display:"flex",flexDirection:"column"},children:[a.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize the rail",title:"Drag to resize",onPointerDown:ot,style:{position:"absolute",left:-4,top:0,bottom:0,width:8,cursor:"col-resize",zIndex:2}}),J&&a.jsx("div",{style:{padding:"var(--sp-2) var(--sp-3) 0",flex:"0 0 auto"},children:J}),a.jsx("div",{style:{minHeight:0,overflowY:"auto",padding:"var(--sp-3)"},children:Me})]}),yn=a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-3)"},children:[Fn,a.jsx(rb,{doc:k.missionDoc}),a.jsx(Ka,{label:"Mission doc",open:vt,onToggle:()=>kr(!vt),children:a.jsx(U1,{doc:k.missionDoc??void 0})}),R.text.trim()&&a.jsx(Ka,{label:"Project memory",open:Ca,onToggle:()=>Fa(!Ca),children:a.jsx("div",{style:{fontSize:"var(--fs-sm)"},children:a.jsx(Nl,{text:R.text})})}),a.jsx(Vb,{agents:k.agents,filter:Z,onFilter:Ie,sessionId:k.directorSessionId,details:C&&a.jsx(o2,{r:C,live:oe,liveCost:k.costUsd,liveBasis:k.costBasis,liveUsage:k.usage,liveTurns:C.turns,onChanged:b})})]}),Tn=O?a.jsx(mb,{runId:O,deck:mn.deck,loading:mn.loading,error:mn.error,missing:mn.missing,services:k.services,tree:Cn}):null,Zi=mn.deck?mn.deck.totals.files+mn.deck.artifacts.length:0,Fi=a.jsx(Vt,{size:"sm",value:ge,onChange:J=>ie(J),tabs:[{value:"mission",label:"Mission"},{value:"files",label:"Files",count:Zi},{value:"runs",label:"Runs",count:w.length}]}),Ji=a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flex:"0 0 auto",flexWrap:"wrap",padding:"6px var(--sp-3) 0",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:[k.agents.length>1&&a.jsx(eb,{agents:k.agents,filter:Z,onFilter:Ie}),a.jsx("span",{style:{flex:1}}),k.entries.length>0&&a.jsxs(a.Fragment,{children:[a.jsx(te,{variant:"ghost",size:"sm",icon:"timeline",title:Et?"Hide the timeline":"Show the swimlane timeline — click a tick to jump to its entry",onClick:()=>zn(!Et),children:"Timeline"}),a.jsx(te,{variant:"ghost",size:"sm",icon:"sort",title:ht==="newest"?"Newest first — click to read oldest first":"Oldest first — click to read newest first",onClick:()=>Xt(ht==="newest"?"oldest":"newest"),children:ht==="newest"?"Newest first":"Oldest first"})]})]}),Ii=a.jsxs("div",{style:{minHeight:0,minWidth:0,display:"flex",flexDirection:"column"},children:[Ji,Et&&k.entries.length>0&&a.jsx("div",{style:{padding:"6px var(--sp-3) 0",flex:"0 0 auto"},children:a.jsx("div",{style:{background:"var(--bg-panel)",border:"1px solid var(--line)",borderRadius:"var(--r-sm)",padding:"8px 10px"},children:a.jsx(O1,{agents:k.agents,entries:k.entries,live:L,selected:Z,onSelect:Ie,onTick:pe})})}),!cn&&a.jsxs("div",{style:{padding:"6px var(--sp-3) 0",flex:"0 0 auto",display:"flex",flexDirection:"column",gap:6},children:[a.jsx(Ka,{label:sb(Ll),open:$l,onToggle:()=>qi(!$l),children:yn}),a.jsx(Ka,{label:`Files · ${Zi}`,open:ka,onToggle:()=>wr(!ka),children:Tn}),a.jsx(Ka,{label:`Runs · ${w.length}`,open:wa,onToggle:()=>Li(!wa),children:Pe})]}),a.jsx(t2,{run:k,filter:Z,jump:be,order:ht})]});return a.jsxs("div",{style:{height:"100%",display:"flex",flexDirection:"column"},children:[a.jsxs(rv,{mode:"project",title:i.name,folder:i.folder,onBack:p,branch:C?.git?{name:C.git.branch,hint:`This mission runs on ${C.git.branch}, made from ${C.git.base}${C.git.commits!==void 0?` · ${C.git.commits} commit${C.git.commits===1?"":"s"} ahead`:""}`}:i.git?.repo&&i.git.branch?{name:i.git.branch,dirty:i.git.dirty}:null,theme:S,onToggleTheme:z,onSettings:D,search:T,children:[Ct&&a.jsx(Je,{tone:"error",inline:!0,children:Ct}),O&&(k.runStatus==="running"&&Zt>0?a.jsx("span",{title:`Waiting on you: ${k.approvals.length} approval(s), ${k.questions.length} question(s)`,children:a.jsx(ja,{status:"needs-you"})}):a.jsx(ja,{status:k.runStatus})),O&&C?.status==="done"&&C?.stopReason==="budget"&&a.jsx("span",{title:"Every DONE WHEN criterion was verified; the run stopped at its cap rather than finishing under it.",style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",whiteSpace:"nowrap"},children:"at the cap"}),O&&gn.length>0&&a.jsxs("span",{title:`Reviewed by ${gn.join(", ")} — ${gn.length===1?"its":"their"} PASS on this run's final diff is what let Foreman record it done`,style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:"var(--fs-xs)",color:"var(--ink-2)",whiteSpace:"nowrap"},children:[a.jsx(ae,{name:"approval",size:11,color:"var(--status-good)"}),"reviewed by ",gn.join(", ")]}),O&&a.jsx(cv,{spent:k.costUsd,budget:k.budgetUsd,detail:!0,costBasis:k.costBasis,usage:k.usage,turns:C?.turns,elapsedMs:C?.createdAt?(L?it:C.endedAt??it)-C.createdAt:void 0}),Aa,Zn,L&&a.jsx(te,{variant:"danger",onClick:()=>{ke.interrupt(O)},children:"Interrupt"}),_a&&a.jsx(Xb,{director:C?.directorModel,worker:C?.workerModel,budget:C?.budgetUsd,spent:C?.costUsd,models:c,loading:u,note:o,busy:lt,onResume:J=>{Yl(J)}}),!_&&O&&C&&C.status!=="running"&&a.jsx(te,{variant:"good",icon:"write",disabled:xt,title:"Start a new planning conversation that builds on what this mission did",onClick:()=>{Vn(O)},children:xt?"Opening…":"Plan the next step"}),!_&&O&&C?.git&&C.status!=="running"&&i.git?.remote&&(C.git.pr?a.jsxs(te,{icon:Qt?.state==="merged"?"check":Qt?.state==="closed"?"close":"preview",onClick:()=>window.open(C.git.pr,"_blank","noopener"),title:`${C.git.pr}${Qt?.state?` · ${Qt.state}`:""}`,children:["Pull request",Qt?.runId===O&&Qt.state?` · ${Qt.state}`:""," ↗"]}):a.jsx(te,{icon:"steer",onClick:()=>Wi(!0),title:`Push ${C.git.branch} and open a pull request against ${C.git.base}`,children:"Open pull request…"})),!_&&O&&a.jsx(te,{variant:"primary",onClick:()=>ee(null),children:"New mission"}),!_&&!O&&!ql&&a.jsx(te,{variant:"primary",icon:"write",onClick:()=>Ea(!0),title:"Skip the talk: describe the mission and start it",children:"New mission"})]}),zr&&O&&a.jsx(s2,{runId:O,onClose:()=>Wi(!1),onDone:()=>b()}),K&&a.jsx(Mb,{schedule:K==="new"?null:K,models:c,modelsLoading:u,modelsNote:o,modelsInheritNote:d,defaultBudgetUsd:i.defaultBudgetUsd,onClose:()=>se(null),onPreview:async J=>{const Me=await ke.previewCadence(J).catch(()=>null);if(!Me)return{error:"could not reach the server"};const Ze=await Me.json().catch(()=>({}));return Me.ok?{next:Ze.next??[]}:{error:Ze.error??`HTTP ${Me.status}`}},onSave:J=>B(K==="new"?ke.createSchedule(i.id,J):ke.updateSchedule(K.id,J))}),O&&a.jsx(ib,{approvals:k.approvals,questions:k.questions,now:it,running:L,activity:Kn,onAllow:J=>{ke.permission(J,"allow")},onAlways:J=>{ke.permission(J,"allow_always")},onDeny:J=>{ke.permission(J,"deny")},onAnswer:(J,Me)=>{ke.answer(J,Me)}}),(i.billingMode??j.mode)==="none"&&a.jsxs(Je,{tone:"caution",children:["This project has nothing to run on: Claude Code is not signed in on this machine. Sign in and restart Foreman, or give the project a provider of its own.",a.jsx(te,{variant:"ghost",size:"sm",icon:"provider",style:{marginLeft:"var(--sp-2)"},onClick:()=>D("provider"),children:"Settings → Provider"})]}),_a&&C?.stopReason==="budget"&&a.jsxs(Je,{tone:"caution",children:["This run stopped at its $",C.budgetUsd.toFixed(2)," cap with $",C.costUsd.toFixed(2)," spent. Raise the cap and continue:",[5,10].map(J=>a.jsxs(te,{variant:"good",size:"sm",icon:"resume",disabled:lt,style:{marginLeft:"var(--sp-2)"},onClick:()=>{Yl({budgetUsd:Math.round((C.budgetUsd+J)*100)/100})},children:["+$",J," & resume"]},J)),a.jsx(te,{variant:"good",size:"sm",icon:"resume",disabled:lt,style:{marginLeft:"var(--sp-2)"},onClick:()=>{Yl({budgetUsd:Math.round(C.budgetUsd*2*100)/100})},children:"Double & resume"})]}),_a&&C?.stopReason&&C.stopReason!=="budget"&&a.jsxs(Je,{tone:"caution",children:["This run stopped at its ",C.stopReason==="turns"?"turn":C.stopReason==="time"?"time":"token"," cap. Resume continues it with a fresh allowance."]}),O&&a.jsx(l2,{runId:O,services:V.list,onDone:V.refresh}),P&&a.jsxs(Je,{tone:"caution",children:["This checkout is held by the running mission, on"," ",a.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:P}),". Commits you make in the folder land on that branch, and anything left uncommitted joins the mission's closing commit."]}),O&&!oe&&a.jsxs(Je,{tone:"readonly",children:["Viewing a past run (read-only).",a.jsx(te,{variant:"ghost",size:"sm",icon:"back",style:{marginLeft:"var(--sp-2)"},onClick:()=>ee(_??null),children:_?"Back to the live run":"Back to planning"})]}),Ki?a.jsxs("div",{style:{flex:1,minHeight:0,minWidth:0,display:cn?"grid":"flex",flexDirection:"column",gridTemplateColumns:cn?`minmax(0, 1fr) ${qe}px`:void 0},children:[a.jsxs("div",{style:{minHeight:0,minWidth:0,display:"flex",flexDirection:"column"},children:[!cn&&a.jsxs("div",{style:{padding:"6px var(--sp-3) 0",flex:"0 0 auto",display:"flex",flexDirection:"column",gap:6},children:[a.jsx(Ka,{label:`Schedules · ${H.schedules.length}`,open:Yi,onToggle:()=>za(!Yi),children:Gl}),w.length>0&&a.jsx(Ka,{label:`Runs · ${w.length}`,open:wa,onToggle:()=>Li(!wa),children:Pe})]}),ql?a.jsxs("div",{style:{flex:1,minHeight:0,overflowY:"auto",display:"flex",flexDirection:"column"},children:[a.jsx("div",{style:{padding:"var(--sp-2) var(--sp-3) 0",flex:"0 0 auto"},children:a.jsx(te,{variant:"ghost",size:"sm",icon:"back",onClick:()=>Ea(!1),children:"Back to the conversation"})}),a.jsxs("div",{style:{margin:"auto",width:"100%",padding:"var(--sp-4) 0 var(--sp-5)"},children:[a.jsx(Q1,{folder:i.folder,defaultBudgetUsd:i.defaultBudgetUsd,error:Vi,errorAction:Xn?{label:"Start anyway",onClick:()=>{Ia(Xn.v,!0)}}:void 0,busy:Xi,models:c,modelsLoading:u,modelsNote:o,modelsInheritNote:d,crewPresets:ne,crew:de,onCrewChange:re,onStart:J=>{Ia(J)},style:{background:"var(--bg-panel)",border:"1px solid var(--line)",borderRadius:"var(--r-md)",padding:"var(--sp-5)",margin:"0 auto",boxSizing:"border-box"}}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",flexWrap:"wrap",margin:"var(--sp-3) auto 0",maxWidth:"var(--composer-max)",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:[a.jsx(Pp,{mode:i.billingMode??j.mode,compact:!0,account:j.account,source:Qb(i,j.source)}),a.jsxs("span",{style:{fontFamily:"var(--font-mono)"},children:["runs on ",Vp(i.provider)??"the server default instance"]}),i.git?.repo&&a.jsxs("span",{title:W?"Foreman creates the branch from what is checked out, commits the mission's work on it at the end, and never merges or pushes. Settings → Projects turns this off.":"The mission edits the current branch. Settings → Projects can give each mission a branch of its own.",children:["· ",W?a.jsxs(a.Fragment,{children:["on its own branch from ",a.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:i.git.branch})]}):a.jsxs(a.Fragment,{children:["on ",a.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:i.git.branch})," directly"]})]})]})]})]}):a.jsx(a.Fragment,{children:a.jsx(r2,{chat:Qi,folder:i.folder,starting:Xi,error:Vi,errorAction:Xn?{label:"Start anyway",onClick:()=>{Ia(Xn.v,!0)}}:void 0,models:c,modelsLoading:u,modelsNote:o,modelsInheritNote:d,crewPresets:ne,crew:de,onCrewChange:re,onStart:J=>{Ia(J)},onCompose:()=>Ea(!0),hasRuns:w.length>0,recent:w,runsOn:xe,onOpenRun:J=>ee(J),onForkRun:J=>{Vn(J)},forking:xt,projectId:i.id,onSettings:D})})]}),cn&&Wl(null,a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-4)"},children:[Gl,a.jsx(i2,{memory:R}),a.jsx(iu,{files:Cn.files,truncated:Cn.truncated,loading:Cn.loading,error:Cn.error,onRefresh:Cn.refresh,urlBase:`/projects/${encodeURIComponent(i.id)}`},i.id)]}))]}):a.jsxs("main",{style:{flex:1,minHeight:0,minWidth:0,display:"flex",flexDirection:"column"},children:[cn?a.jsxs("div",{style:{flex:1,minHeight:0,display:"grid",gridTemplateColumns:`minmax(0, 1fr) ${qe}px`},children:[Ii,Wl(Fi,ge==="mission"?yn:ge==="files"?Tn:Pe)]}):a.jsx("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column"},children:Ii}),oe&&a.jsx("div",{style:{padding:"var(--sp-2) var(--sp-3) var(--sp-3)",flex:"0 0 auto"},children:a.jsx(J1,{agents:[{id:"director",status:k.runStatus==="running"?"running":"done"}],to:"director",onTo:()=>{},timing:"next",onTiming:()=>{},disabled:k.runStatus!=="running",disabledReason:"Run finished — start a new mission.",onSend:J=>{ke.steer(O,J)}})})]})]})}const Gp={small:.88,default:1,large:1.15,larger:1.3};function u2(){const i=g.useCallback(c=>{const u=Gp[c]??1;document.documentElement.style.setProperty("--ui-scale",String(u));try{localStorage.setItem("foreman:textSize",c)}catch{}},[]);return g.useEffect(()=>{let c=null;try{c=localStorage.getItem("foreman:textSize")}catch{}c&&c in Gp&&i(c)},[i]),i}function d2(){const[i,c]=g.useState(()=>localStorage.getItem("foreman:theme")||"light");g.useEffect(()=>{document.documentElement.dataset.theme=i,localStorage.setItem("foreman:theme",i)},[i]);const u=g.useCallback(o=>{c(o==="system"?window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark":o)},[]);return[i,()=>c(o=>o==="dark"?"light":"dark"),u]}function f2(i){const[c,u]=g.useState({models:null,loading:!0});return g.useEffect(()=>{let o=!0;u(f=>({...f,loading:!0}));const d=i?`/models?projectId=${encodeURIComponent(i)}`:"/models";return fetch(d).then(f=>f.ok?f.json():null).then(f=>{if(o){if(!f)return u({models:null,loading:!1});u({models:f.models,loading:!1,note:f.reachable===!1?`Cannot reach ${f.endpoint??"this project’s endpoint"}.`:f.models?.length===0?"This endpoint has no models installed.":void 0,inheritNote:f.provider&&f.provider!=="claude-code"?"inherits this project’s provider default":void 0})}}).catch(()=>o&&u({models:null,loading:!1})),()=>{o=!1}},[i]),c}function h2(i){const[c,u]=g.useState({instances:[],ollama:null,codex:null});return g.useEffect(()=>{if(!i)return;let o=!0;return fetch("/instances").then(d=>d.ok?d.json():null).then(d=>{o&&d&&u({instances:d.instances??[],ollama:d.ollama??null,codex:d.codex??null})}).catch(()=>{}),()=>{o=!1}},[i]),c}function p2(){const{projects:i,connected:c,auth:u,refresh:o,activity:d,update:f,version:m,firstRun:y}=Xg(),{setup:x,projectId:p,runId:b,tab:j,go:S,goRun:z}=Pg(),[D,G,T]=d2(),w=u2(),R=f2(p),[H,K]=g.useState({global:{},projects:{}}),[se,B]=g.useState(!1),[q,I]=g.useState("models"),W=ie=>{ie&&I(ie),B(!0)},ue=h2(se);g.useEffect(()=>{fetch("/settings").then(ie=>ie.ok?ie.json():null).then(ie=>ie&&K(ie)).catch(()=>{})},[]);const ne=p?i.find(ie=>ie.id===p):null,[de,je]=g.useState(!1),[re,xe]=g.useState(""),_=async(ie,qe)=>{xe(""),je(!0);const le=await(qe===null?ke.clearProviderKey(ie):ke.setProviderKey(ie,qe)).finally(()=>je(!1));le.ok?o():xe((await le.json().catch(()=>({}))).error??"could not save the key")},O=async ie=>{const qe={global:ie.global,projects:{...H.projects}};ne&&(Object.keys(ie.project).length?qe.projects[ne.id]=ie.project:delete qe.projects[ne.id]),K(qe),B(!1),ie.global.theme&&T(ie.global.theme),ie.global.textSize&&w(ie.global.textSize),await fetch("/settings",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({global:ie.global,projectId:ne?.id,project:ne?qe.projects[ne.id]??{}:void 0})}).catch(()=>{}),ne&&ie.provider!==void 0&&(await ke.updateProject(ne.id,{provider:ie.provider}).catch(()=>{}),o())},[ee,P]=g.useState(""),oe=ee.trim().toLowerCase(),k=Fg(oe),V=ie=>new Date(ie).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),C=oe?i.filter(ie=>[ie.name,ie.folder].some(qe=>qe.toLowerCase().includes(oe))).slice(0,8):[],L=[{id:"act-fleet",title:"Fleet",detail:"The board: what needs you, what is running, what finished",icon:"back",keys:"fleet home board",onPick:()=>S(null)},{id:"act-settings",title:"Settings",detail:ne?`Global, and ${ne.name}'s overrides`:"Models, budget, approvals, notifications",icon:"settings",keys:"settings preferences models budget telegram",onPick:()=>B(!0)},...ne?[{id:"act-plan",title:`Plan in ${ne.name}`,detail:"Back to the planning conversation",icon:"steer",keys:"plan planner mission new",onPick:()=>S(ne.id)}]:[]].filter(ie=>oe&&(ie.title.toLowerCase().includes(oe)||ie.keys.includes(oe))),Z=[{label:"Projects",items:C.map(ie=>({id:`p-${ie.id}`,title:ie.name,detail:ie.folder,icon:"folder",onPick:()=>S(ie.id)}))},{label:"Runs",count:k.hits.length>=30?30:void 0,items:k.hits.map(ie=>({id:`r-${ie.id}`,title:ie.title||ie.mission,detail:`${ie.projectName}${ie.title?` · ${ie.mission}`:""}`,icon:"idle",status:ie.status,meta:`${V(ie.endedAt??ie.createdAt)}${ie.costBasis==="priced"?` · $${ie.costUsd.toFixed(2)}`:""}`,onPick:()=>{ie.projectId&&z(ie.projectId,ie.id)}}))},{label:"Actions",items:L}],ce=a.jsx(D0,{value:ee,onChange:P,groups:Z,busy:k.busy}),be={theme:D,onToggleTheme:G,search:ce,onSettings:ie=>W(ie),auth:u},He=Ig(),ge=He.status?He.status.telegram.chatId?He.status.telegram.chatLabel??"linked":null:void 0;return a.jsxs("div",{style:{height:"100%",display:"flex",flexDirection:"column"},children:[a.jsx("div",{style:{flex:1,minHeight:0},children:x||y===!0&&!ne?a.jsx(E1,{onDone:()=>{ke.setupDone().then(()=>o()),x&&S(null)},onSettings:ie=>W(ie)}):ne?a.jsx(c2,{p:ne,models:R.models,modelsLoading:R.loading,modelsNote:R.note,modelsInheritNote:R.inheritNote,routeRunId:b,onSelectRun:ie=>z(ne.id,ie),routeTab:j,onSelectTab:ie=>b&&z(ne.id,b,ie),onBack:()=>S(null),refreshFleet:o,settings:{global:H.global,project:H.projects[ne.id]},...be}):a.jsx(T1,{projects:i,connected:c,activity:d,onOpen:ie=>S(ie),onOpenRun:(ie,qe)=>z(ie,qe),refresh:o,query:ee,onQuery:P,...be})}),a.jsx(O0,{connected:c,localUrl:window.location.origin,publicUrl:He.status?.publicUrl,phone:ge,auth:u,version:m,update:f,onOpenSettings:W}),se&&a.jsx(Hb,{scope:ne?"project":"global",section:q,onSection:I,global:H.global,project:ne?H.projects[ne.id]:void 0,projectName:ne?.name,models:R.models,modelsLoading:R.loading,modelsNote:R.note,provider:ne?.provider??null,providerInstances:ue.instances,providerOllama:ue.ollama,providerCodex:ue.codex,providerHasKey:ne?.providerHasKey,providerKeyBusy:de,providerKeyError:re,onStoreProviderKey:(ie,qe)=>{_(ie,qe)},onClearProviderKey:ie=>{_(ie,null)},notify:He,onSave:ie=>{O(ie)},onClose:()=>B(!1)})]})}Ug.createRoot(document.getElementById("root")).render(a.jsx(g.StrictMode,{children:a.jsx(p2,{})}));