@sma1lboy/rove 0.9.294-next.296 → 0.9.294-next.298
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web/assets/{index-D5D7mU3q.js → index-CBqkyhKb.js} +5 -5
- package/dist/web/assets/index-dIOpG1Sd.css +1 -0
- package/dist/web/assets/{term-mount-D3IRbkGD.js → term-mount-DAe6rd3Z.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/index-CSqODeYL.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/term-mount-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/term-mount-DAe6rd3Z.js","assets/term-mount-BrP-ENHg.css"])))=>i.map(i=>d[i]);
|
|
2
2
|
var e=Object.defineProperty,t=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),n=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var r=`rove.bridge.token`;if(typeof window<`u`){let e=new URLSearchParams(window.location.hash.slice(1)).get(`token`);e&&(localStorage.setItem(r,e),history.replaceState(null,``,window.location.pathname+window.location.search))}function i(){return localStorage.getItem(r)}function a(e){localStorage.setItem(r,e)}function o(){localStorage.removeItem(r)}var s=t((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=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,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function ee(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function j(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function te(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,te(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+ee(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),te(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+ee(a,u),c+=te(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+ee(a,u++),c+=te(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return te(j(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function M(e,t,n){if(e==null)return e;var r=[],i=0;return te(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function N(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var P=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&&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)},F={map:M,forEach:function(e,t,n){M(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return M(e,function(){t++}),t},toArray:function(e){return M(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=F,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:N}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,P)}catch(e){P(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.8`})),c=t(((e,t)=>{t.exports=s()})),l=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&ee(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ee(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function ee(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,ee(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),u=t(((e,t)=>{t.exports=l()})),d=t((e=>{var t=c();function n(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 r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=l(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)}},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.8`})),f=t(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=d()})),p=t((e=>{var t=u(),n=c(),r=f();function i(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 a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(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 l(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 d(e){if(o(e)!==e)throw Error(i(188))}function p(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return d(a),e;if(s===r)return d(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,l=a.child;l;){if(l===n){c=!0,n=a,r=s;break}if(l===r){c=!0,r=a,n=s;break}l=l.sibling}if(!c){for(l=s.child;l;){if(l===n){c=!0,n=s,r=a;break}if(l===r){c=!0,r=s,n=a;break}l=l.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function m(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=m(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),k=Symbol.for(`react.activity`),A=Symbol.for(`react.memo_cache_sentinel`),ee=Symbol.iterator;function j(e){return typeof e!=`object`||!e?null:(e=ee&&e[ee]||e[`@@iterator`],typeof e==`function`?e:null)}var te=Symbol.for(`react.client.reference`);function M(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===te?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case k:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?M(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return M(e(t))}catch{}}return null}var N=Array.isArray,P=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne={pending:!1,data:null,method:null,action:null},re=[],ie=-1;function ae(e){return{current:e}}function I(e){0>ie||(e.current=re[ie],re[ie]=null,ie--)}function L(e,t){ie++,re[ie]=e.current,e.current=t}var oe=ae(null),R=ae(null),se=ae(null),ce=ae(null);function le(e,t){switch(L(se,t),L(R,e),L(oe,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Ud(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Ud(t),e=Wd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}I(oe),L(oe,e)}function ue(){I(oe),I(R),I(se)}function de(e){e.memoizedState!==null&&L(ce,e);var t=oe.current,n=Wd(t,e.type);t!==n&&(L(R,e),L(oe,n))}function fe(e){R.current===e&&(I(oe),I(R)),ce.current===e&&(I(ce),ep._currentValue=ne)}var pe,me;function he(e){if(pe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);pe=t&&t[1]||``,me=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+pe+e+me}var ge=!1;function _e(e,t){if(!e||ge)return``;ge=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
@@ -13,7 +13,7 @@ Error generating stack: `+e.message+`
|
|
|
13
13
|
This worktree is at the PR's head ({head}, going into {base}). Read the change against {base} (git diff origin/{base}...HEAD), then tell me what you find: bugs, risks, missing tests, anything unclear. Do not push, comment on or approve the PR; report here.`}},ot={reviewQueue:{sourceIssues:`[ 议题 ]`,sourceReviews:`[ 等我评审的 PR ]`,palette:`评审队列`,title:`等我评审的 PR`,empty:`你的项目里没有等你评审的 PR。`,other:`另有 {count} 个在 Rove 不认识的项目里。`,draft:`草稿`,fork:`fork`,checksPassing:`检查通过`,checksFailing:`检查未通过`,checksPending:`检查进行中`,start:`[ 评审 ]`,preparing:`正在获取 #{number}…`,failed:`无法开始评审 #{number}:{error}`,gh:{missing:"没有安装 `gh` 命令行,或不在 PATH 中。",unauthenticated:"`gh` 未登录:请在这台 Mac 上运行 `gh auth login`。",failed:`暂时读不到 GitHub。按 r 重试。`},prompt:`评审 {repo} 的拉取请求 #{number}:{title}
|
|
14
14
|
{url}
|
|
15
15
|
|
|
16
|
-
这个 worktree 在该 PR 的头部({head},合入 {base})。对照 {base} 阅读改动(git diff origin/{base}...HEAD),然后告诉我你的发现:bug、风险、缺失的测试、不清楚的地方。不要推送、评论或批准这个 PR;在这里汇报。`}},st=n({en:()=>ct,zh:()=>lt}),ct={runLog:{title:`Runs`,all:`all`,outcome:{ok:`ok`,blocked:`blocked`,failed:`failed`,skipped:`skipped`},source:{schedule:`schedule`,manual:`manual`,webhook:`webhook`},blocked:{"task-missing":`task is gone`,"awaiting-owner":`waiting on a decision`,"report-missing":`last run never reported`,quota:`rate limited`,"engine-error":`engine error`,"engine-dead":`engine stopped`,"awaiting-permission":`waiting on a permission`,busy:`still working`},blockedRun:`blocked: {reason}`,empty:`No runs match.`,more:`+{count} more`}},lt={runLog:{title:`运行记录`,all:`全部`,outcome:{ok:`成功`,blocked:`受阻`,failed:`失败`,skipped:`跳过`},source:{schedule:`定时`,manual:`手动`,webhook:`Webhook`},blocked:{"task-missing":`任务已不存在`,"awaiting-owner":`等你做决定`,"report-missing":`上次运行没有汇报`,quota:`触发限流`,"engine-error":`引擎出错`,"engine-dead":`引擎已停止`,"awaiting-permission":`等你授权`,busy:`仍在运行`},blockedRun:`受阻:{reason}`,empty:`没有符合条件的运行。`,more:`另有 {count} 条`}},ut=n({en:()=>dt,zh:()=>ft}),dt={settings:{title:`Settings`,open:`settings`,sections:{connectors:`Connectors`,appearance:`Appearance`,notifications:`Notifications`,snippets:`Snippets`,about:`About`,voice:`Voice`},groups:{preferences:`Preferences`,agents:`Agents and tools`,more:`More`},pages:{general:`Language, layout, and where Rove opens files and creates worktrees.`,appearance:`Theme, colours, and how tasks and panes look.`,notifications:`When Rove tells you a task finished or needs you.`,keys:`Rebind chords in your own file, and how the prefix guide behaves.`,engines:`The coding agents Rove can start, and how it plugs into them.`,autoRouting:`What each depth tier starts, and who picks the tier.`,voice:`Dictation: the recognizer that turns what you say into prompts.`,connectors:`Accounts Rove uses, here and on your other machines.`,plugins:`Built-in pages and registered plugins.`,about:`Versions, updates, and this browser.`,feedback:`Send a note to the Rove team.`,dev:`Experimental switches, restarts and resets.`,snippets:`Prompt text you reuse. Type @name in a prompt to insert it.`},connectors:{githubDescription:`Clone, push and open PRs on every machine with one GitHub account`,connect:`Connect`,disconnect:`Disconnect`,disconnectBody:`Signs this machine's gh out of GitHub, for every tool that uses gh and not only Rove. Other machines keep their own sign-ins.`,machines:`Machines`,thisMachine:`This machine`,machinesHint:`Each machine signs in to GitHub by itself. The mark says whether it uses the same account as this one.`,refresh:`Check again`,refreshing:`Checking…`,useRove:`Use Rove's account`,loginThere:`Log in there`,codeHint:`Enter this code at GitHub (click the code to copy it)`,openGithub:`Open github.com/login/device`,codeCopied:`Code copied`,syncing:`Signed in. Bringing the other machines along…`,loginFailed:`Sign-in failed: {error}`,dismiss:`Dismiss`,loading:`checking…`,markSame:`✓ same account`,markDifferent:`⚠ @{login}`,markSignedOut:`✗ signed out`,markNoGh:`gh is not installed`,markOutdated:`Rove there is outdated`,markOffline:`offline`,markDenied:`refuses credential changes`,markFailed:`could not check`,detail:`git over {protocol} · SSH key {ssh}`,synced:`{machine} now uses @{login}`},general:{groupInterface:`Interface`,groupFiles:`Worktrees`,groupTerminal:`Terminal`,tabStrip:`Tab strip`,scrollback:`Scrollback`},appearance:{groupColours:`Colours`,groupTasks:`Tasks and panes`,taskColorsNote:`Gives each task its own hue on the working border and in the list.`,colorblindNote:`Shows added and removed lines in blue and red instead of green and red.`,workingBorderNote:`The pane's border while the selected task is working.`,railGroup:`Task list`,railGroupProject:`By project`,railGroupState:`By state`,statusMark:`Task status`,statusMarkEngine:`Engine icon`,statusMarkBoth:`Icon and dots`,statusMarkDots:`Dots only`,previewWorking:`Working`,previewDone:`Finished, unread`,previewIdle:`Idle`,previewWaiting:`Waiting for you`,previewBroken:`Broken`,previewTitle:`Fix the login redirect`},notifications:{toastNote:`A popup in the corner of this page.`,volume:`Chime volume`},about:{groupRove:`Rove`,daemon:`Daemon`,daemonCurrent:`rove {version}, same build as this page`,daemonStale:"rove {version} is out of date; run `rove daemon restart`",updates:`Updates`,browser:`This browser`,browserHint:`Forget this browser's token. A login token is revoked on the host too.`,access:`Access`,signIn:`Sign-in`,signInMode:{open:`None`,password:`Password`,token:`Token link`},signInHint:{open:`A browser on this computer opens Rove with no link or password. Phones and other computers still need a token.`,password:`A browser without a token signs in with the password. Token links keep working.`,token:`Only the link rove printed, or a device token, gets in. Password sign-in is off.`},passwordSet:`Set a password`,passwordChange:`Change the password`,passwordHint:`At least {min} characters. It is stored hashed on this computer.`,passwordField:`New password`,passwordSave:`Save`,signOut:`Sign out`},engines:{enabled:`Offer {name} when picking an engine`,default:`Make {name} the default engine`,namePlaceholder:`Display name (blank = default)`,rename:`Rename`,reset:`Reset to defaults`,remove:`Remove engine`,save:`Save`,cancel:`Cancel`},plugins:{builtIn:`Built in`,builtInHint:`First-party pages. Turning one off removes its entry from the rail.`,registered:`Registered plugins`,empty:`No other plugins registered.`,linked:`linked`,unsupportedPlatform:`unsupported platform`,turnOn:`Install {name}`},feedback:{hint:"Files a public GitHub issue on the Rove repo, through `gh` on the machine running rove. Without a signed-in `gh` you get a prefilled link to open instead.",kindLabel:`Kind`,kindBug:`Bug`,kindIdea:`Idea`,kindQuestion:`Question`,titleLabel:`Title`,body:`What happened`,send:`File issue`,sent:`Filed issue #{number}`,notFiled:`Not filed yet. {hint}`,openLink:`Open the prefilled issue`,report:`Report a problem with an agent`,reportNote:`An agent asks what went wrong, drafts the issue with you and files it.`,reportFailed:`Could not start the conversation.`,reportPrompt:"You are helping the user report a problem with Rove itself (not their own project) as a GitHub issue. First ask what they were doing and what felt wrong: one to three short questions, one at a time. Then collect context: run `rove --version` and `rove daemon status`, and read the last ~50 lines of `${ROVE_HOME_DIR:-$HOME}/.rove/daemon.log` only if the problem could involve the daemon. Draft an issue title and body (what happened, what they expected, steps, relevant output) and show it to the user. Only after they say OK, file it with a heredoc: `rove feedback --kind bug|idea|question --title \"...\" --body-file - <<'EOF'` followed by the body and `EOF`. Then share the issue URL. If it prints a prefilled link instead (gh missing or signed out), give the user that link and tell them to run `gh auth login`."}},prefs:{languageHint:`Display language, shared with the TUI.`,soundHint:`chime, plus a desktop notification while this tab is in the background`,soundVolumeHint:`Plays the new level when you pick it.`,push:`Notify when this page is closed`,pushHint:`This browser gets a notification when a task finishes, needs you or fails, even with no Rove page open. Follows the cross-task switch.`,pushUnsupported:`This browser can't receive push here: it needs https (or localhost), and on iPhone/iPad the page added to the home screen.`,pushBlocked:`Notifications are blocked for this site; allow them in the browser's site settings.`,pushFailed:`Couldn't turn it on: {error}`,zenHint:`Hide the Files pane. The zen chip and ctrl+a z toggle it and write this same setting.`,editInTui:`Edit it in the TUI.`,tierModel:`model`,tierEdit:`Edit`,tierEffort:`Reasoning effort`,classifierConnection:`Classifier connection`,unset:`(none)`,modeAuto:`Auto (follow the browser)`,themePreviewHint:`Point at a theme to see this page in it; click to keep it. The TUI follows.`,themeUser:`yours`,themeInstalled:`Installed`,themeMoreHint:`Not installed yet: point to preview, click to install and switch.`,themeBrowse:`Browse {count} more from rove.run`,themeHide:`Hide themes from rove.run`,themeGet:`get`,themeInstalling:`installing…`,themeInstallFailed:`failed, retry`,themeAgent:`Make one with an agent`,themeAgentHint:`opens a Scratch session; reopen Settings to see what it wrote.`,themeAgentFailed:`couldn't open the session; try again.`,themeAgentPrompt:"Make me a new Rove color theme. Ask me first what look I want, unless I already said. Save it as one JSON file in {dir} (for example {dir}/my-theme.json); the file name is the theme's name. The format is in https://github.com/sma1lboy/rove/blob/main/docs/themes.md and the JSON schema is https://raw.githubusercontent.com/sma1lboy/rove/main/packages/rove/src/tui/context/theme/theme.schema.json. Start from https://raw.githubusercontent.com/sma1lboy/rove/main/packages/rove/src/tui/context/theme/claude.json, give each color slot a { dark, light } pair, and keep text readable on every background. When it's saved, run `rove theme list` to check it loads, then tell me the name: it appears in Settings → Appearance.",resetButton:`Reset`,resetHint:`Clears this Mac's saved settings and task list, restarts the Rove daemon, then reloads this page. Worktrees on disk and engine session history are not touched.`,resetBody:`Wipes ~/.config/rove/state.json and ~/.rove/tasks.json and restarts the daemon, then reloads this page with an empty task list. Worktrees on disk and engine session history are NOT touched.`,restartButton:`Restart`,restartHint:`Stops the Rove daemon and starts a fresh one; this page reconnects on its own. Running engine sessions live in the PTY host and survive it.`,restartBody:`Stops the Rove daemon and starts a fresh one, picking up daemon edits. This page reconnects in a few seconds. Running engine sessions survive.`,keysYaml:`The file is read on the Mac; changes apply when you come back to this page.`},keys:{editHint:`Click a key to record a new one, then press the key you want. To put it behind the prefix, press the prefix key first. The × removes it.`,reset:`Reset`,recordFor:`Record a key for {name}`,removeFor:`Remove the key for {name}`,pluginNoTask:`Select a task before using a plugin chord.`,pluginChords:`Plugin chords`,agent:`Change them with an agent`,agentHint:`opens a Scratch session; reopen Settings to see what it changed.`,agentFailed:`couldn't open the session; try again.`,agentPrompt:"Change my Rove keybindings. Ask me first what I want changed, unless I already said. Edit {path} (create it if it is missing; keep existing entries and comments you were not asked to change). The format, every binding id and its default chord are in https://github.com/sma1lboy/rove/blob/main/docs/KEYBINDINGS.md (see Customizing). Only use binding ids listed there; a direct override replaces that binding's whole chord list, and null unbinds. The file must stay valid YAML: check it parses (for example with `ruby -ryaml -e 'YAML.load_file(ARGV[0])' {path}` or any YAML parser you have). Rove reloads it live, and unknown ids or invalid chords are ignored with a warning, so when you are done tell me what you changed and ask me to reopen Settings → Keybindings: it lists every applied override and every warning."},pages:{attachTooLarge:`{name} is larger than 500 MB`,new:`[ new ]`,routinePause:`[ pause ]`,routineEnable:`[ enable ]`,delete:`[ delete ]`,routinesNeedYou:`NEEDS YOU`,routinesActive:`ACTIVE`,routinesPaused:`PAUSED`,laterStarts:`LATER`,laterCancel:`[ cancel ]`,laterFailed:`Did not start: {error}`,laterCancelFailed:`Could not cancel the start: {error}`,routineSchedule:`Schedule`,routineNext:`Next run`,routineProject:`Project`,routineDelivers:`Delivers to`,routineEngine:`Engine`,routineChangeEngine:`[ change ]`,routinePrompt:`PROMPT`,routineScript:`SCRIPT`,cronDown:`Decrease {field}`,cronUp:`Increase {field}`,storySave:`save`,storySaveStart:`save & start`,storyStart:`start`,attachHintTouch:`paste a path / a screenshot → inserts an image placeholder`}},ft={settings:{title:`设置`,open:`设置`,sections:{connectors:`连接器`,appearance:`外观`,notifications:`通知`,snippets:`片段`,about:`关于`,voice:`语音`},groups:{preferences:`偏好`,agents:`智能体与工具`,more:`更多`},pages:{general:`语言、布局,以及 Rove 在哪里打开文件、创建 worktree。`,appearance:`主题、颜色,以及任务和面板的外观。`,notifications:`任务完成或需要你时,Rove 怎么提醒。`,keys:`在你自己的文件里重绑快捷键,以及前缀引导的行为。`,engines:`Rove 能启动的编码智能体,以及它如何接入它们。`,autoRouting:`每个深度档位启动什么,以及由谁选择档位。`,voice:`口述:把你说的话变成提示词的识别器。`,connectors:`Rove 使用的账号,本机和你的其他机器。`,plugins:`内置页面和已注册的插件。`,about:`版本、更新,以及此浏览器。`,feedback:`给 Rove 团队留一条意见。`,dev:`实验开关、重启和重置。`,snippets:`常用的提示词文本。在提示词里输入 @名称 即可插入。`},connectors:{githubDescription:`用同一个 GitHub 账号在每台机器上克隆、推送和开 PR`,connect:`连接`,disconnect:`断开`,disconnectBody:`把这台机器的 gh 从 GitHub 退出登录,所有用 gh 的工具都会受影响,不只是 Rove。其他机器保持各自的登录。`,machines:`机器`,thisMachine:`本机`,machinesHint:`每台机器各自登录 GitHub。右边的标记表示它和本机用的是不是同一个账号。`,refresh:`重新检查`,refreshing:`检查中…`,useRove:`使用 Rove 的账号`,loginThere:`在那里登录`,codeHint:`到 GitHub 输入这个验证码(点击验证码可复制)`,openGithub:`打开 github.com/login/device`,codeCopied:`验证码已复制`,syncing:`已登录,正在同步其他机器…`,loginFailed:`登录失败:{error}`,dismiss:`关闭`,loading:`检查中…`,markSame:`✓ 同一账号`,markDifferent:`⚠ @{login}`,markSignedOut:`✗ 未登录`,markNoGh:`未安装 gh`,markOutdated:`那边的 Rove 版本过旧`,markOffline:`离线`,markDenied:`拒绝修改凭据`,markFailed:`无法检查`,detail:`git 走 {protocol} · SSH 密钥 {ssh}`,synced:`{machine} 现在使用 @{login}`},general:{groupInterface:`界面`,groupFiles:`Worktree`,groupTerminal:`终端`,tabStrip:`标签栏`,scrollback:`回滚行数`},appearance:{groupColours:`颜色`,groupTasks:`任务与面板`,taskColorsNote:`让每个任务在工作边框和列表里有自己的色调。`,colorblindNote:`新增和删除的行用蓝色和红色,而不是绿色和红色。`,workingBorderNote:`所选任务工作时,面板边框的样子。`,railGroup:`任务列表`,railGroupProject:`按项目`,railGroupState:`按状态`,statusMark:`任务状态`,statusMarkEngine:`引擎图标`,statusMarkBoth:`图标加点阵`,statusMarkDots:`只有点阵`,previewWorking:`正在跑`,previewDone:`完成未读`,previewIdle:`空闲`,previewWaiting:`等你回答`,previewBroken:`出错`,previewTitle:`修复登录跳转`},notifications:{toastNote:`本页角落里的弹出提示。`,volume:`提示音音量`},about:{groupRove:`Rove`,daemon:`守护进程`,daemonCurrent:`rove {version},与本页同一版本`,daemonStale:"rove {version} 版本过旧;运行 `rove daemon restart`",updates:`更新`,browser:`此浏览器`,browserHint:`忘掉此浏览器的令牌。登录得到的令牌也会在主机上吊销。`,access:`访问`,signIn:`登录方式`,signInMode:{open:`免登录`,password:`密码`,token:`Token 链接`},signInHint:{open:`本机浏览器不用链接或密码就能打开 Rove。手机和其他电脑仍然需要 token。`,password:`没有 token 的浏览器用密码登录。Token 链接照常可用。`,token:`只有 rove 打印的链接或设备 token 能进。密码登录关闭。`},passwordSet:`设置密码`,passwordChange:`修改密码`,passwordHint:`至少 {min} 个字符。以哈希形式存在本机。`,passwordField:`新密码`,passwordSave:`保存`,signOut:`退出登录`},engines:{enabled:`选引擎时列出 {name}`,default:`把 {name} 设为默认引擎`,namePlaceholder:`显示名称(留空 = 默认)`,rename:`重命名`,reset:`恢复默认`,remove:`移除引擎`,save:`保存`,cancel:`取消`},plugins:{builtIn:`内置`,builtInHint:`官方页面。关掉后,它在侧栏的入口会消失。`,registered:`已注册的插件`,empty:`没有其他已注册的插件。`,linked:`已链接`,unsupportedPlatform:`平台不支持`,turnOn:`安装 {name}`},feedback:{hint:"通过运行 rove 那台机器上的 `gh`,在 Rove 仓库提一个公开的 GitHub issue。没有登录 `gh` 时会给你一条预填好的链接。",kindLabel:`类型`,kindBug:`缺陷`,kindIdea:`想法`,kindQuestion:`问题`,titleLabel:`标题`,body:`发生了什么`,send:`提交 issue`,sent:`已提交 issue #{number}`,notFiled:`还没提交。{hint}`,openLink:`打开预填好的 issue`,report:`让 agent 帮我报告问题`,reportNote:`由 agent 问清哪里不对,和你一起起草 issue 并提交。`,reportFailed:`没能开始对话。`,reportPrompt:"你在帮用户把 Rove 本身的问题(不是他们自己项目的问题)提成一个 GitHub issue。先问清楚他们当时在做什么、哪里不对劲:一到三个简短的问题,一次问一个。然后收集上下文:运行 `rove --version` 和 `rove daemon status`,只有问题可能和 daemon 有关时才读 `${ROVE_HOME_DIR:-$HOME}/.rove/daemon.log` 的最后约 50 行。起草 issue 的标题和正文(发生了什么、期望什么、复现步骤、相关输出)并展示给用户。用户确认之后才提交,用 heredoc:`rove feedback --kind bug|idea|question --title \"...\" --body-file - <<'EOF'`,接正文,最后一行 `EOF`。然后把 issue 链接发给用户。如果输出的是预填链接(没装 gh 或没登录),把链接给用户,并告诉他运行 `gh auth login`。"}},prefs:{languageHint:`显示语言,与 TUI 共用同一设置。`,soundHint:`提示音;本页在后台时另发桌面通知`,soundVolumeHint:`选中后会播放新音量。`,push:`页面关闭时也通知`,pushHint:`任务完成、需要你或出错时,即使没有打开任何 Rove 页面,这个浏览器也会收到通知。跟随「跨任务通知」开关。`,pushUnsupported:`这个浏览器在这里收不到推送:需要 https(或 localhost),iPhone/iPad 上还要先把页面添加到主屏幕。`,pushBlocked:`这个网站的通知被浏览器屏蔽了,去浏览器的网站设置里允许。`,pushFailed:`没能开启:{error}`,zenHint:`收起文件栏。zen 按钮和 ctrl+a z 切换时会写入同一个设置。`,editInTui:`请在 TUI 中编辑`,tierModel:`模型`,tierEdit:`编辑`,tierEffort:`推理强度`,classifierConnection:`分类器连接`,unset:`(无)`,modeAuto:`自动(跟随浏览器)`,themePreviewHint:`鼠标指向一个主题,整页就换成它看看;点一下就定下来。TUI 也会跟着换。`,themeUser:`自装`,themeInstalled:`已安装`,themeMoreHint:`尚未安装:指向即预览,点一下安装并切换。`,themeBrowse:`浏览 rove.run 上的另外 {count} 个主题`,themeHide:`收起 rove.run 的主题`,themeGet:`安装`,themeInstalling:`安装中…`,themeInstallFailed:`失败,重试`,themeAgent:`让 agent 做一个`,themeAgentHint:`会开一个 Scratch 会话;做好后重新打开设置就能看到。`,themeAgentFailed:`会话没打开,再试一次。`,themeAgentPrompt:"帮我做一个新的 Rove 配色主题。先问我想要什么风格,除非我已经说过。把它存成 {dir} 下的一个 JSON 文件(比如 {dir}/my-theme.json),文件名就是主题名。格式说明见 https://github.com/sma1lboy/rove/blob/main/docs/themes.md,JSON schema 是 https://raw.githubusercontent.com/sma1lboy/rove/main/packages/rove/src/tui/context/theme/theme.schema.json。以 https://raw.githubusercontent.com/sma1lboy/rove/main/packages/rove/src/tui/context/theme/claude.json 为起点,每个颜色槽都给 { dark, light } 两个值,并保证文字在每种背景上都看得清。存好后运行 `rove theme list` 确认能加载,然后告诉我主题名:它会出现在 设置 → 外观 里。",resetButton:`重置`,resetHint:`清空这台 Mac 上保存的设置和任务列表,重启 Rove 守护进程,然后刷新本页。磁盘上的工作树和引擎会话历史不受影响。`,resetBody:`清空 ~/.config/rove/state.json 和 ~/.rove/tasks.json 并重启守护进程,然后刷新本页,任务列表为空。磁盘上的工作树和引擎会话历史不会被动。`,restartButton:`重启`,restartHint:`停止 Rove 守护进程并启动新的进程,本页会自动重连。运行中的引擎会话在 PTY 宿主里,不受影响。`,restartBody:`停止 Rove 守护进程并启动新的进程,载入守护进程的改动。本页几秒后自动重连,运行中的引擎会话不受影响。`,keysYaml:`该文件在 Mac 上读取,改动会在你回到本页时生效。`},keys:{editHint:`点一个按键开始录入,再按你想要的键。想放到 prefix 后面,就先按 prefix 键。× 是删掉它。`,reset:`恢复默认`,recordFor:`为「{name}」录入按键`,removeFor:`删掉「{name}」的按键`,pluginNoTask:`使用插件快捷键前请先选中一个任务。`,pluginChords:`插件快捷键`,agent:`让 agent 来改`,agentHint:`会开一个 Scratch 会话;改好后重新打开设置就能看到。`,agentFailed:`会话没打开,再试一次。`,agentPrompt:"帮我改 Rove 的快捷键。先问我想改什么,除非我已经说过。编辑 {path}(不存在就新建;没让你改的条目和注释都保留)。格式、每个 binding id 及其默认按键见 https://github.com/sma1lboy/rove/blob/main/docs/KEYBINDINGS.md(Customizing 一节)。只用那里列出的 binding id;直接覆盖会替换该 binding 的整个按键列表,null 表示解绑。文件必须保持合法 YAML:确认它能解析(比如 `ruby -ryaml -e 'YAML.load_file(ARGV[0])' {path}`,或任何你有的 YAML 解析器)。Rove 会实时重新加载它,未知 id 或无效按键会被忽略并给出警告,所以改完后告诉我改了什么,并请我重新打开 设置 → 快捷键:那里会列出所有生效的覆盖和所有警告。"},pages:{attachTooLarge:`{name} 超过 500 MB`,new:`[ 新建 ]`,routinePause:`[ 暂停 ]`,routineEnable:`[ 启用 ]`,delete:`[ 删除 ]`,routinesNeedYou:`需要处理`,routinesActive:`运行中`,routinesPaused:`已暂停`,laterStarts:`稍后启动`,laterCancel:`[ 取消 ]`,laterFailed:`没有启动:{error}`,laterCancelFailed:`取消失败:{error}`,routineSchedule:`调度`,routineNext:`下次执行`,routineProject:`项目`,routineDelivers:`投递到`,routineEngine:`引擎`,routineChangeEngine:`[ 更换 ]`,routinePrompt:`提示词`,routineScript:`脚本`,cronDown:`减小{field}`,cronUp:`增大{field}`,storySave:`保存`,storySaveStart:`保存并启动`,storyStart:`启动`,attachHintTouch:`粘贴路径 / 截图 → 插入图片占位行`}},pt=n({en:()=>mt,zh:()=>ht}),mt={transcript:{you:`You`,agent:`Agent`,system:`System`,copy:`[ copy ]`,copied:`Copied`,export:`[ export .md ]`,findPlaceholder:`Find in this conversation`,findCount:`{at} / {total}`,findNone:`no match`,prev:`[ prev ]`,next:`[ next ]`,older:`[ load earlier ]`,loading:`Reading the conversation…`,empty:`Nothing said yet.`,failed:`failed`,error:`Could not read the conversation: {error}`,retry:`[ retry ]`,noHistory:`This engine keeps no history Rove can read. Showing its terminal tail.`,tail:`Terminal tail`}},ht={transcript:{you:`你`,agent:`智能体`,system:`系统`,copy:`[ 复制 ]`,copied:`已复制`,export:`[ 导出 .md ]`,findPlaceholder:`在这段对话中查找`,findCount:`{at} / {total}`,findNone:`没有匹配`,prev:`[ 上一个 ]`,next:`[ 下一个 ]`,older:`[ 加载更早 ]`,loading:`正在读取对话…`,empty:`还没有对话内容。`,failed:`失败`,error:`读不到这段对话:{error}`,retry:`[ 重试 ]`,noHistory:`这个引擎没有 Rove 能读取的历史记录,显示的是它的终端末尾。`,tail:`终端末尾`}},gt=n({en:()=>_t,zh:()=>vt}),_t={usage:{title:`Usage`,receipt:`Usage receipt`,total:`Total tokens`,thanks:`Thank you, burn again soon`,open:`Open usage`,range:`last {days} days · tokens are input + output`,perDay:`Per day`,byModel:`By engine and model`,topTasks:`Top tasks`,quota:`Quota`,turns:`{count} turns`,loading:`Loading…`,empty:`No turns recorded in this window.`,failed:`Could not read usage: {error}`,cutoff:`The daemon returns at most {count} turns: {day} and earlier are partial.`,noReader:`{engines}: no turn reader, so their work is not counted here.`,removedTask:`(removed task)`,full:`at this pace full around {time}, before it resets`,lasts:`at this pace it lasts until the reset`}},vt={usage:{title:`用量`,receipt:`用量小票`,total:`合计 token`,thanks:`谢谢惠顾,欢迎再烧`,open:`打开用量`,range:`最近 {days} 天 · token 为输入加输出`,perDay:`按天`,byModel:`按引擎和模型`,topTasks:`用量最高的任务`,quota:`额度`,turns:`{count} 轮`,loading:`加载中…`,empty:`这段时间没有记录到任何一轮。`,failed:`无法读取用量:{error}`,cutoff:`守护进程最多返回 {count} 轮:{day} 及更早的数据不完整。`,noReader:`{engines}:没有轮次读取器,这里不统计它们的工作。`,removedTask:`(已删除的任务)`,full:`按当前速度约 {time} 用完,早于重置时间`,lasts:`按当前速度可撑到重置`}},yt=n({en:()=>bt,zh:()=>xt}),bt={voice:{say:`Say`,stop:`Stop {time}`,release:`Release {time}`,working:`Hearing…`,hint:`Dictate: tap to start and stop, or hold to talk and let go`,slideToSend:`Slide up to send`,tipSend:`Let go to send`,hold:`Hold to talk`,holdOrType:`Hold to talk, tap to type`,learned:`Learned {pairs}`,learnedPair:`{spoken} → {term}`,undo:`undo`,unlearned:`Forgotten`,unlearnFailed:`Couldn't undo: the voice sidecar isn't answering`,setup:{dictation:`Dictation`,backend:{off:`Off`,local:`On this Mac`,cloud:`Cloud`},unavailable:`This Rove cannot set up dictation`,offHint:`The mic is hidden. Nothing runs in the background.`,localNeeded:`Install the model below; the mic shows once it is ready.`,localInstalling:`Installing the model; the mic shows once it is ready.`,cloudNeeded:`Save an endpoint below to turn dictation on.`,ready:`{model} · ready`,starting:`Starting…`,localTitle:`Whisper large-v3`,localHint:`Runs on this Mac's GPU, about 3.5 GB to download. Audio never leaves the Mac.`,install:`Install`,installing:`Installing…`,installed:`Installed, about 4 GB on disk.`,failed:`Install failed: {line}`,uninstall:`Uninstall`,uninstallAsk:`Remove the model?`,cancel:`Cancel`,cloudTitle:`Cloud endpoint`,cloudHint:`Any OpenAI-compatible /audio/transcriptions service. The audio and your terms go there; the key stays on the Mac.`,baseURL:`Base URL`,model:`Model`,apiKey:`API key`,keySaved:`Saved; leave empty to keep it`,save:`Save`,saveAndUse:`Save and use`,forget:`Forget`,forgetAsk:`Remove the endpoint and its key?`}}},xt={voice:{say:`说`,stop:`停 {time}`,release:`松手 {time}`,working:`在听…`,hint:`口述:点一下开始、再点一下结束,或按住说话、松手结束`,slideToSend:`上滑发送`,tipSend:`松手发送`,hold:`按住说话`,holdOrType:`按住说话,轻点打字`,learned:`记住了 {pairs}`,learnedPair:`{spoken} → {term}`,undo:`撤销`,unlearned:`已撤销`,unlearnFailed:`没能撤销:语音服务没有响应`,setup:{dictation:`语音输入`,backend:{off:`关闭`,local:`本机`,cloud:`云端`},unavailable:`这个 Rove 无法设置语音输入`,offHint:`不显示麦克风,后台也不运行任何东西。`,localNeeded:`在下面安装模型,就绪后显示麦克风。`,localInstalling:`正在安装模型,就绪后显示麦克风。`,cloudNeeded:`在下面保存一个服务地址后开启。`,ready:`{model} · 就绪`,starting:`启动中…`,localTitle:`Whisper large-v3`,localHint:`在这台 Mac 的 GPU 上运行,约需下载 3.5 GB。音频不离开这台 Mac。`,install:`安装`,installing:`安装中…`,installed:`已安装,约占 4 GB 磁盘。`,failed:`安装失败:{line}`,uninstall:`卸载`,uninstallAsk:`删除模型?`,cancel:`取消`,cloudTitle:`云端服务`,cloudHint:`任何兼容 OpenAI /audio/transcriptions 的服务。音频和你的术语会发到那里;密钥只存在这台 Mac 上。`,baseURL:`Base URL`,model:`模型`,apiKey:`API 密钥`,keySaved:`已保存;留空则保留原密钥`,save:`保存`,saveAndUse:`保存并使用`,forget:`删除`,forgetAsk:`删除这个服务地址和密钥?`}}},St=n({en:()=>Ct,zh:()=>wt}),Ct={workspace:{pickTask:`pick a task on the left`,noTabs:`no open sessions in this task`,startEngine:`Start {engine}`,startSession:`Start session`,tabNotLive:`this tab has no running session`,restored:`restored session, read-only until reopened`,exited:`session ended (exit {code})`,attachFailed:`could not open this session: {message}`,reopen:`Reopen session`,reopening:`Reopening…`,reopenFailed:`could not reopen this session: {message}`,engineExited:`engine exited (code {code})`,retry:`Retry`,engineSettings:`Settings → Engines`,usageLimitUntil:`usage limit reached — rove resumes this task at {time}`,resumeQuota:`resume now`,resumingQuota:`resuming…`,usageLimit:`usage limit reached`,dismiss:`Dismiss`,openTask:`Open`},tab:{shell:`shell`,engine:`engine`},firstRun:{title:`All your coding agents, in one place`,body:`When one runs out of quota, switch the task to another. Agents talk to each other directly, and every task gets its own worktree and branch.`,start:`Start your first task`},status:{connecting:`connecting`,retrying:`reconnecting, attempt {count}`,retry:`retry now`,backlog:`Backlog`,inProgress:`In progress`,inReview:`In review`,done:`Done`,canceled:`Canceled`,error:`Error`},connect:{title:`open the link rove printed`,body:"Run `rove --web` and open the link it prints, or paste it here.",placeholder:`http://127.0.0.1:7878/#token=…`,submit:`connect`,invalid:"that is not a `rove --web` link",failing:"can't reach rove. Is `rove --web` still running? After `--rotate-token`, open the new link.",forget:`forget this link`,notConnected:`not connected to rove — reconnecting (the view refreshes on its own)`},relay:{unpaired:"open the relay link that `rove --web --preset relay` printed on your computer",connecting:`connecting to your computer through the relay…`,loading:`loading rove…`,offline:"your computer is not answering on this relay. Is `rove --web --preset relay` still running? After `--rotate-relay`, open the new link. Reload to retry.",failed:`can't reach your computer through the relay ({error}). Reload to retry.`},login:{title:`sign in`,body:`Enter this Rove's password.`,field:`password`,submit:`sign in`,checking:`checking…`,wrong:`that did not work`,locked:`too many tries from here; try again in {minutes} min`,lockedHost:"password login is locked; run `rove --web --unlock` on the host",unreachable:"can't reach rove. Is `rove --web` still running?"},layout:{splitTooSmall:`Not enough room to split here`,railFold:`Fold the task list`,navBack:`Back`,navForward:`Forward`,railUnfold:`Unfold the task list`,dropUploading:`Uploading {name}…`,pasteNoImage:`No image on this browser's clipboard`,pasteNoAccess:`Can't read this browser's clipboard: {error}`,pasteNeedsHttps:`the page needs https or localhost`,refreshTimeout:"The daemon did not come back on the new build in time; check `rove daemon status`",railResize:`Drag to resize the task list, click to fold it, double-click to reset`,composerPlaceholder:`Message the agent`,composerSend:`Send`,composerAttach:`Attach a file`,composerNotSent:`Not sent: {reason}`,composerOldBridge:`This Mac's rove --web is older than this page; restart it to send from here.`,composerAtMenu:`The agent is waiting on a choice. Answer it with the 1–4 and ⏎ keys below; your message is kept.`,termKeys:`Terminal keys`,termKeyUp:`Up arrow`,termKeyDown:`Down arrow`,termKeyLeft:`Left arrow`,termKeyRight:`Right arrow`,termKeyInterrupt:`Ctrl+C, interrupt`,termKeyEnter:`Enter`,narrowTerminal:`Terminal`}},wt={workspace:{pickTask:`从左边选一个任务`,noTabs:`这个任务没有打开的会话`,startEngine:`启动 {engine}`,startSession:`启动会话`,tabNotLive:`这个标签没有在运行的会话`,restored:`已恢复的会话,重新打开前只读`,exited:`会话已结束(退出码 {code})`,attachFailed:`打不开这个会话:{message}`,reopen:`重新打开会话`,reopening:`正在重新打开…`,reopenFailed:`重新打开失败:{message}`,engineExited:`引擎已退出(退出码 {code})`,retry:`重试`,engineSettings:`设置 → 引擎`,usageLimitUntil:`已达到用量上限 —— rove 会在 {time} 自动继续这个任务`,resumeQuota:`现在继续`,resumingQuota:`正在继续…`,usageLimit:`已达到用量上限`,dismiss:`忽略`,openTask:`打开`},tab:{shell:`终端`,engine:`引擎`},firstRun:{title:`所有编程 agent,都在一个地方`,body:`一个额度用完了,换另一个接着干;agent 之间直接对话。每个任务有独立的 worktree 和分支,互不覆盖。`,start:`开始第一个任务`},status:{connecting:`连接中`,retrying:`重连中,第 {count} 次`,retry:`立即重试`,backlog:`待办`,inProgress:`进行中`,inReview:`待评审`,done:`已完成`,canceled:`已取消`,error:`出错`},connect:{title:`打开 rove 打印的链接`,body:"运行 `rove --web`,打开它打印的链接,或者把链接粘贴到这里。",placeholder:`http://127.0.0.1:7878/#token=…`,submit:`连接`,invalid:"这不是 `rove --web` 打印的链接",failing:"连不上 rove。`rove --web` 还在运行吗?用过 `--rotate-token` 的话,请打开新的链接。",forget:`忘掉这个链接`,notConnected:`没有连上 rove,正在重连(连上后这里会自动刷新)`},relay:{unpaired:"打开电脑上 `rove --web --preset relay` 打印的 relay 链接",connecting:`正在通过 relay 连接你的电脑…`,loading:`正在加载 rove…`,offline:"你的电脑没有在这个 relay 上应答。`rove --web --preset relay` 还在运行吗?用过 `--rotate-relay` 的话,请打开新的链接。刷新重试。",failed:`无法通过 relay 连到你的电脑({error})。刷新重试。`},login:{title:`登录`,body:`输入这台 Rove 的密码。`,field:`密码`,submit:`登录`,checking:`验证中…`,wrong:`登录失败`,locked:`这里尝试次数过多;{minutes} 分钟后再试`,lockedHost:"密码登录已锁定;在主机上运行 `rove --web --unlock`",unreachable:"连不上 rove。`rove --web` 还在运行吗?"},layout:{splitTooSmall:`这里放不下分屏了`,railFold:`折叠任务列表`,navBack:`后退`,navForward:`前进`,railUnfold:`展开任务列表`,dropUploading:`正在上传 {name}…`,pasteNoImage:`浏览器剪贴板里没有图片`,pasteNoAccess:`读不到浏览器剪贴板:{error}`,pasteNeedsHttps:`页面要走 https 或 localhost`,refreshTimeout:"守护进程没能及时以新版本重新上线,请检查 `rove daemon status`",railResize:`拖动调整任务列表宽度,单击折叠,双击还原`,composerPlaceholder:`给 agent 发消息`,composerSend:`发送`,composerAttach:`附加文件`,composerNotSent:`没发出去:{reason}`,composerOldBridge:`这台 Mac 上的 rove --web 比页面旧,重启它之后才能从这里发送。`,composerAtMenu:`agent 正在等你选择。用下方的 1–4 和 ⏎ 键回答;你的消息已保留。`,termKeys:`终端按键`,termKeyUp:`上方向键`,termKeyDown:`下方向键`,termKeyLeft:`左方向键`,termKeyRight:`右方向键`,termKeyInterrupt:`Ctrl+C 中断`,termKeyEnter:`回车`,narrowTerminal:`终端`}},Tt=[tt,St,Ue,Ye,ut,Le,Qe,st,gt,pt,Ke,Pe,it,Be,yt],Et=Object.assign({},...Tt.map(e=>e.en)),Dt={en:Et,zh:Object.assign({},...Tt.map(e=>e.zh))};function Ot(){try{let e=JSON.parse(localStorage.getItem(`rove.prefs`)??`null`);if(e&&typeof e==`object`&&`prefs`in e){let t=e.prefs;if(t&&typeof t==`object`&&`locale`in t&&(t.locale===`en`||t.locale===`zh`))return t.locale}}catch{}return globalThis.navigator?.language?.toLowerCase().startsWith(`zh`)?`zh`:`en`}var kt=v(Ot());function At(){let e=typeof document>`u`?void 0:document.documentElement;e&&(e.lang=kt.get()===`zh`?`zh-CN`:`en`)}At(),kt.subscribe(At);function jt(e,t){let n=e;for(let e of t.split(`.`)){if(!n||typeof n!=`object`||!(e in n))return;n=Reflect.get(n,e)}return typeof n==`string`?n:void 0}function Mt(e,t){return t?e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e)):e}function z(e,t){return Mt(jt(Dt[kt.get()],e)??jt(Et,e)??e,t)}function Nt(e,t,n){return Mt(jt(e[kt.get()],t)??jt(e.en,t)??t,n)}function B(){return y(kt)}function Pt(e){let t=e.trim(),n=t.indexOf(`#`),r=n>=0?new URLSearchParams(t.slice(n+1)).get(`token`):t;return r&&/^[A-Za-z0-9_-]{43}$/.test(r)?r:null}var Ft=(...e)=>e.filter(Boolean).join(` `),It=`text-meta leading-[inherit]`,Lt=`font-normal normal-nums`,Rt=`touch:relative touch:after:absolute touch:after:content-['']`,zt=`flex h-full flex-col`,Bt=e=>[`app relative grid min-h-0 flex-1 grid-rows-[1fr_auto] transition-[grid-template-columns] duration-220 ease-snap motion-reduce:transition-none`,e.surface?`is-narrow narrow-${e.surface} grid-cols-[minmax(0,1fr)]`:e.zen?`grid-cols-[var(--rail-w,minmax(220px,280px))_1fr]`:`grid-cols-[var(--rail-w,minmax(220px,280px))_1fr_var(--panel-w,clamp(300px,28vw,440px))]`,e.zen?`is-zen`:``,e.expanded?`is-panel-expanded`:``,e.folded?`is-rail-folded`:``,e.peek?`is-rail-peek`:``,e.dragging?`is-dragging transition-none`:``].join(` `),Vt=[`relative narrow-content:hidden narrow-back:col-1 narrow-back:row-1 touch:select-none touch:touch-callout-none`,`wide:overflow-x-clip wide:pt-8.5 wide:[&>:not([data-grip])]:min-w-(--rail-open-w)`,`rail-folded:absolute rail-folded:inset-y-1.5 rail-folded:left-1.5 rail-folded:z-6 rail-folded:col-1 rail-folded:row-1 rail-folded:box-border rail-folded:w-(--rail-open-w) rail-folded:-translate-x-[calc(100%+12px)] rail-folded:rounded-md rail-folded:border-hairline rail-folded:border-line rail-folded:bg-surface rail-folded:shadow-none rail-folded:transition-[translate] rail-folded:duration-200 rail-folded:ease-snap rail-folded:motion-reduce:transition-none rail-folded:[&>:not([data-grip])]:min-w-0`,`rail-peek:translate-none rail-peek:shadow-dialog`].join(` `),Ht=`rail-folded:col-2 panel-expanded:invisible panel-expanded:col-2 narrow-sidebar:hidden narrow-back:z-1 narrow-back:col-1 narrow-back:translate-x-(--back-x) narrow-back:bg-paper narrow-back:shadow-dialog`,Ut=`rail-folded:col-3 panel-expanded:z-2 panel-expanded:col-[2/-1] panel-expanded:bg-paper panel-expanded:pl-2`,Wt=`${Rt} touch:after:-inset-x-1.5 touch:after:-inset-y-3`,Gt=`flex items-center gap-2`,Kt=`flex min-w-0 items-baseline gap-1.5 px-1.5 py-0.5 text-meta font-bold ${Rt} touch:after:-inset-2.5 touch:after:-bottom-1`,qt=`flex items-center rounded-sm px-2.5 py-1.5 text-muted aria-selected:bg-inset aria-selected:text-ink [&_svg]:size-4 ${Rt} touch:after:-inset-x-px touch:after:-top-2 touch:after:-bottom-1.5`,Jt=`keys-only m-0 overflow-hidden px-3.5 py-1 text-meta text-ellipsis whitespace-nowrap`,Yt=e=>`shortcut-badge absolute top-1/2 z-8 -translate-y-1/2 cursor-pointer rounded-sm border-hairline border-accent bg-surface px-1.25 py-px text-meta text-accent ${e?`right-full mr-1.5`:`right-1`}`,Xt=`relative min-w-0 flex-1`,Zt={left:[`[border-left:var(--hairline)_solid_var(--line)]`,`[border-left:var(--hairline)_solid_var(--accent)]`],top:[`[border-top:var(--hairline)_solid_var(--line)]`,`[border-top:var(--hairline)_solid_var(--accent)]`]},Qt=(e,t)=>Zt[e][+!!t],$t=(e,t)=>{let n=`split-leaf absolute box-border flex min-h-0 min-w-0 ${t.active?`is-active`:``}`,r=t.active?`border-accent`:``;return e===`box`?`${n} rounded-[calc(var(--radius)-1px)] border-hairline ${t.active?`border-accent`:`border-line`}`:e===`line`?`${n} ${t.left?Qt(`left`,t.active):``} ${t.top?Qt(`top`,t.active):``} ${t.left||t.top?r:``}`:e===`rail`?`${n} ${Qt(`left`,t.active)} ${r} ${t.top?`[--mt:6px]`:``}`:e===`rule`?`${n} ${Qt(`top`,t.active)} ${r} ${t.left?`[--ml:8px]`:``}`:n},en=(e,t)=>`absolute right-2 z-3 bg-paper px-1 font-mono text-meta ${Lt} ${e?`-top-2`:`top-0.5`} ${t?`text-accent`:`text-subtle`}`,tn=`hidden gap-1 overflow-x-auto scrollbar-none [border-top:var(--hairline)_solid_var(--line)] bg-surface px-1.5 py-1 touch:flex`,nn=e=>`h-10 min-w-max touch-manipulation [flex:1_1_0] rounded-sm border-hairline bg-inset px-0.5 py-0 font-mono text-meta ${Lt} ${e?`border-accent text-accent`:`border-line text-ink`}`,rn=`prefix-guide fixed bottom-19 left-3 z-40 max-h-[60vh] w-[min(560px,calc(100vw-24px))] overflow-y-auto rounded-sm border-hairline border-line bg-surface px-3 py-2 text-meta shadow-popover motion-safe:animate-rise-in [&.is-leaving]:pointer-events-none [&.is-leaving]:animate-sink-out`,an=`min-w-[3ch] text-accent`,on=`mb-1.5 flex justify-between gap-4`,sn=`columns-[2_220px] gap-x-5`,cn=`mb-2 break-inside-avoid`,ln=`flex w-full gap-2.5 px-0 py-px text-left text-ink enabled:hover:bg-hover disabled:cursor-default touch:py-2.5`,un=`mx-0 my-2 overflow-x-hidden overflow-y-auto scrollbar-none`,dn=e=>`flex w-full min-w-0 justify-between gap-4 rounded-sm px-1.5 py-0.75 text-left font-mono text-meta ${Lt} whitespace-pre text-ink touch:py-2.5 ${e?`is-selected bg-hover`:``}`,fn=`min-w-0 overflow-hidden text-ellipsis`,pn=`w-full rounded-none border-0 [border-bottom:var(--hairline)_solid_var(--line)] bg-transparent px-1.5 py-2 font-mono text-meta font-normal normal-nums text-ink focus-visible:outline-none`,mn=`flex justify-between gap-4`,hn=`flex flex-col items-end ${It}`,gn=`mt-2 max-h-[52vh] overflow-y-auto`,_n=`mb-2.5`,vn=`m-0 mb-1 font-sans text-meta font-bold normal-nums text-accent`,yn=`flex gap-3 py-px ${It}`,bn=`min-w-[14ch] text-ink`,xn=`flex flex-wrap items-baseline gap-3 [border-bottom:var(--hairline)_solid_var(--warning)] bg-inset px-3.5 py-1 text-meta text-warning [&_span]:text-muted`,Sn=`keys-only fixed bottom-[34px] left-3 z-40 min-w-55 rounded-sm border-hairline border-line bg-surface px-3 py-2 font-mono text-meta ${Lt} text-ink shadow-popover`,Cn=e=>`mb-0.5 ${e?`motion-safe:[animation:sink-out_140ms_ease-in_var(--hud-out,3860ms)_forwards]`:`motion-safe:[animation:rise-in_140ms_ease-out,sink-out_140ms_ease-in_var(--hud-out,3860ms)_forwards]`}`,wn=`m-auto font-mono text-meta ${Lt} text-subtle`,Tn=`${wn} flex flex-col items-center gap-3 [&_p]:m-0`,En=`workspace row-1 flex min-h-0 min-w-0 flex-col gap-1.5 px-1 pt-2 pb-1`,Dn=`flex min-h-0 flex-1 overflow-hidden rounded-md border-hairline border-line bg-paper focus-within:border-focus`,On=`working-flow:border-transparent working-flow:[background:linear-gradient(var(--paper),var(--paper))_0_0/100%_100%_padding-box,linear-gradient(90deg,var(--line),var(--task-ink,var(--focus)),var(--line),var(--task-ink,var(--focus)),var(--line))_0_0/300%_100%_border-box] working-flow:motion-safe:animate-flow-border`,kn=`relative flex min-w-0 flex-1 flex-col`,An=`relative flex min-h-0 min-w-0 flex-1 flex-col`,jn=`term-host relative min-h-0 min-w-0 flex-1 touch-none overflow-hidden`,Mn=`pointer-events-none absolute inset-0 z-5 h-full w-full`,Nn=`relative h-full [&.is-leaving]:pointer-events-none [&.is-leaving]:absolute [&.is-leaving]:inset-0 [&.is-leaving]:z-6`,Pn=`pointer-events-none absolute inset-0 z-1 overflow-hidden [&_pre]:m-0 [&_pre>div>div]:overflow-hidden [&_pre>div>div]:[height:var(--row-h,1.15em)] [&_pre>div>div]:[line-height:var(--row-h,1.15em)]`,Fn=e=>`absolute right-2.5 bottom-2.5 z-5 flex max-w-[calc(100%-20px)] flex-wrap items-center gap-x-3 gap-y-1 rounded-sm border-hairline border-line bg-inset px-2.5 py-1.25 font-mono text-meta ${Lt} ${e?`text-error`:`text-muted`} [&_.link:disabled]:pointer-events-none [&_.link:disabled]:opacity-60 [&_button]:whitespace-nowrap`,In=`col-span-full touch:[&_.link]:after:inset-[-2px_-6px_-4px] flex min-w-0 items-center gap-2 [border-top:var(--hairline)_solid_var(--line)] bg-surface px-3 py-1 font-mono text-meta ${Lt} whitespace-nowrap text-muted`,Ln=e=>`size-1.5 rounded-full ${e?`bg-warning`:`bg-subtle`}`,Rn=`grid min-w-0 grid-cols-[auto_minmax(2rem,1fr)_auto] gap-x-2.5 gap-y-1 pt-2 pb-1 font-sans whitespace-nowrap text-meta text-subtle normal-nums`,zn=`col-span-3 grid cursor-pointer grid-cols-subgrid items-center text-left hover:text-ink`,Bn={ok:`text-muted`,warn:`text-warning`,crit:`text-error`},Vn={ok:`text-success`,warn:`text-warning`,crit:`text-error`},Hn=e=>`relative h-0.75 overflow-hidden rounded-full bg-[color-mix(in_srgb,currentColor_18%,transparent)] after:absolute after:inset-y-0 after:left-0 after:w-(--fill) after:rounded-full after:bg-current after:content-[''] ${Vn[e]??Vn.ok}`,Un=`font-mono text-title font-bold normal-nums tracking-[0.02em] whitespace-nowrap`,Wn=`text-accent`,Gn=`grid h-full place-items-center p-6`,Kn=`flex w-[min(460px,100%)] flex-col gap-3 rounded-md border-hairline border-line bg-surface p-6 [&_p]:m-0`,qn=`flex flex-col gap-2 p-3.5 text-left font-sans text-meta ${Lt} leading-[1.5]`,Jn=`flex-none fill-none stroke-current [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:1.25]`,Yn=(e={})=>`relative grid cursor-pointer place-items-center rounded-sm border-none p-0 disabled:cursor-default disabled:opacity-35 [&_svg]:fill-none [&_svg]:stroke-current [&_svg]:[stroke-linecap:round] [&_svg]:[stroke-linejoin:round] [&_svg]:[stroke-width:1.25] touch:after:absolute touch:after:-inset-x-px touch:after:-top-2 touch:after:-bottom-1.25 touch:after:content-[''] touch:first:after:-left-2 ${e.tool?`size-5.5 flex-none`:`size-6.5`} ${e.tool||e.small?`[&_svg]:size-3.5`:`[&_svg]:size-4`} ${e.on?`bg-accent-soft text-accent`:`bg-transparent text-subtle enabled:hover:bg-hover enabled:hover:text-ink`}`,Xn=`absolute top-2 left-[calc(--spacing(2)+var(--shell-inset-left,0px))] z-7 flex items-center gap-0.5`,Zn=`[&.is-resizing_iframe]:pointer-events-none`,Qn=e=>`side-panel ${Ut} relative row-1 flex min-h-0 min-w-0 flex-col ${Zn} ${e?`flex-1 p-0`:`pt-2 pr-1 pb-1 pl-0`}`,$n=`grid min-h-0 flex-1 grid-rows-[minmax(0,1fr)] [--divider:5px] ${Zn}`,er=`side-col row-1 flex min-h-0 min-w-0 flex-col`,tr=e=>`side-head flex min-h-6.5 min-w-0 items-center gap-0.5 pb-1.5 font-mono text-meta normal-nums ${e?`px-2 pt-0`:`narrow:px-2 narrow:pt-0`}`,nr=`min-w-0 flex-1 truncate px-2 text-ink`,rr=`flex min-w-0 flex-1 items-center gap-0.5`,ir=`scrollbar-none flex min-w-0 gap-0.5 overflow-x-auto`,ar=e=>`group/ptab relative flex min-w-12 max-w-40 items-center hover:text-ink ${e.active?`is-active text-ink`:`text-muted`} ${e.compact&&!e.active?`max-w-24 flex-none`:`flex-initial`}`,or=e=>`flex min-w-0 cursor-pointer items-center gap-1.5 border-none bg-transparent py-1 pl-1.5 text-inherit [font:inherit] ${e?`pr-0.5`:`pr-1.5`}`,sr=`truncate`,cr=e=>`touch:relative size-4 flex-none cursor-pointer rounded-xs border-none p-0 font-mono text-title leading-none text-subtle hover:bg-hover hover:text-ink touch:after:absolute touch:after:-inset-1.5 touch:after:-left-1 touch:after:content-[''] ${e?`mr-0.5 bg-transparent`:`absolute top-1/2 right-0.5 -translate-y-1/2 bg-paper opacity-0 group-hover/ptab:opacity-100 focus-visible:opacity-100 [@media(hover:none)]:opacity-100`}`,lr=`ml-auto flex gap-0.5`,ur=`relative row-1 cursor-col-resize touch-none before:absolute before:inset-y-0 before:left-[calc(var(--divider)/2)] before:w-px before:bg-line before:content-[''] hover:before:bg-line-active after:absolute after:inset-x-[-3px] after:inset-y-0 after:content-['']`,dr=`side-view flex min-h-0 min-w-0 flex-1 flex-col [&[hidden]]:hidden`,fr=`m-auto flex max-w-[44ch] flex-col items-center gap-2.5 p-4 text-center font-mono text-meta leading-[1.5] text-subtle normal-nums`,pr=`flex min-h-0 flex-1 flex-col gap-1.5`,mr=`flex items-center gap-0.5 [&_svg]:flex-none`,hr=`mx-0.5 min-w-0 flex-1 rounded-sm border-none bg-inset px-2 py-1 text-ink [font-size:var(--fs-meta)] focus:bg-hover focus:outline-none aria-invalid:text-muted`,gr=`min-w-0 flex-1 rounded-sm border-none bg-paper`,_r=`relative flex min-h-0 min-w-0 flex-1`,vr=`absolute inset-0 size-full cursor-crosshair touch-none fill-none stroke-accent [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:2.5]`,yr=t((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),V=t(((e,t)=>{t.exports=yr()}))(),br=({danger:e=!1}={})=>`rounded-sm font-sans text-meta not-italic normal-nums text-paper active:scale-97 motion-reduce:active:scale-none disabled:cursor-default disabled:opacity-50 touch:min-h-10 ${e?`bg-error`:`bg-accent`} px-3.5 py-1.5 font-semibold`,xr={link:`text-accent hover:underline`,filled:br(),danger:br({danger:!0}),action:`rounded-sm border-hairline border-line bg-inset px-3 py-1.5 font-sans text-meta text-ink hover:border-line-active hover:bg-menu active:scale-97 motion-reduce:active:scale-none disabled:cursor-default disabled:opacity-50 touch:min-h-10 focus-visible:outline-1 focus-visible:outline-offset-1 focus-visible:outline-focus`,floating:`whitespace-nowrap rounded-sm border-hairline border-line-active bg-surface px-2 py-0.5 font-mono text-meta text-ink shadow-popover`,row:``,pill:`inline-flex flex-none items-center gap-1.5 whitespace-nowrap font-mono text-meta text-muted hover:text-ink aria-[current=true]:text-accent`,icon:Yn({small:!0}),iconOn:Yn({small:!0,on:!0}),card:`flex min-w-0 flex-col gap-1.5 rounded-sm border-hairline p-1.5 text-left focus-visible:outline-1 focus-visible:outline-offset-1 focus-visible:outline-focus`},Sr={roomy:`relative touch:after:absolute touch:after:content-[''] touch:after:-inset-x-1.5 touch:after:-inset-y-3`,tight:`relative touch:after:absolute touch:after:content-[''] touch:after:-inset-x-0.75 touch:after:-inset-y-0.5`,none:``};function H({variant:e=`link`,hit:t=e===`link`?`roomy`:`none`,className:n,type:r=`button`,...i}){return(0,V.jsx)(`button`,{type:r,className:Ft(xr[e],Sr[t],n),...i})}var Cr=`mx-2.5 my-3 font-mono text-meta text-subtle`,wr=`font-sans text-meta text-subtle`,Tr=`m-0 max-h-[38vh] overflow-auto rounded-sm border-hairline border-line bg-paper px-3 py-2.5 font-mono text-meta leading-[1.5] whitespace-pre-wrap wrap-anywhere`,Er=e=>`flex w-full flex-col gap-0.5 rounded-sm px-2.5 py-1.5 text-left focus-visible:bg-accent-soft focus-visible:outline-none ${e?`bg-accent-soft`:``}`,Dr=`mx-0 mt-1 mb-0 max-h-47 list-none overflow-y-auto rounded-sm border-hairline border-line bg-inset p-0.5 font-mono text-meta`,Or=e=>`block w-full cursor-pointer overflow-hidden rounded-[calc(var(--radius-sm)-2px)] px-2 py-0.75 text-left text-ellipsis whitespace-nowrap [font:inherit] touch:py-2.5 ${e.cursor?`bg-hover`:``} ${e.accent?`text-accent`:e.cursor?`text-ink`:`text-muted`}`,U=`m-0 font-sans text-meta font-medium normal-nums`,kr=`link text-accent [&:hover]:underline touch-hit`,Ar=`rounded-sm border-hairline border-line bg-paper font-mono text-meta font-normal normal-nums text-ink focus-visible:border-line-active focus-visible:outline-none`,jr=`${Ar} w-full px-2.5 py-2`,Mr=`actions flex items-center justify-end gap-3.5`;function Nr({failing:e=!1}){B();let[t,n]=(0,h.useState)(``),[r,i]=(0,h.useState)(!1);return(0,V.jsx)(`div`,{className:Gn,children:(0,V.jsxs)(`form`,{className:Kn,onSubmit:e=>{e.preventDefault();let n=Pt(t);if(!n){i(!0);return}a(n),window.location.reload()},children:[(0,V.jsxs)(`span`,{className:Un,children:[(0,V.jsx)(`span`,{className:Wn,children:`[`}),` rove `,(0,V.jsx)(`span`,{className:Wn,children:`]`})]}),(0,V.jsx)(`h1`,{className:`${U} text-muted`,children:z(`connect.title`)}),(0,V.jsx)(`p`,{className:e?`text-error`:`text-muted`,children:z(e?`connect.failing`:`connect.body`)}),(0,V.jsx)(`input`,{className:jr,autoFocus:!0,spellCheck:!1,placeholder:z(`connect.placeholder`),value:t,onChange:e=>{n(e.target.value),i(!1)}}),r&&(0,V.jsx)(`p`,{className:`text-error`,children:z(`connect.invalid`)}),(0,V.jsxs)(`div`,{className:Mr,children:[e&&(0,V.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>{o(),window.location.reload()},children:z(`connect.forget`)}),(0,V.jsx)(`button`,{type:`submit`,className:br(),children:z(`connect.submit`)})]})]})})}var Pr=`flex flex-col gap-1.5`,Fr=`min-h-18 max-h-[50vh] leading-[1.45]`,Ir=`flex flex-wrap gap-1.5`,Lr=(e=!1,t=!1)=>`rounded-sm border-hairline px-2.5 py-1 font-mono text-meta font-normal not-italic normal-nums ${e?`border-accent bg-accent-soft text-ink`:`border-line hover:bg-hover ${t?`text-subtle`:`text-muted`}`}`,Rr=`m-0 list-none p-0`,zr=`overlay fixed inset-0 z-20 grid justify-items-center [align-items:start] bg-(--scrim) pt-[12vh] motion-safe:animate-fade-in [&.is-leaving]:pointer-events-none [&.is-leaving]:animate-fade-out short:pt-3`,Br=(e=!1)=>`dialog static m-0 flex max-h-[76vh] ${e?`w-[min(620px,calc(100vw-32px))]`:`w-[min(440px,calc(100vw-32px))]`} flex-col gap-3 rounded-md border-hairline border-line bg-surface px-5 py-4.5 text-inherit shadow-dialog focus:outline-none motion-safe:animate-rise-in [.is-leaving_&]:animate-sink-out short:max-h-[calc(100dvh-24px)] short:px-4 short:py-3`,Vr=`flex items-center justify-between gap-3`,Hr=`m-0 min-w-0 font-sans text-title leading-[1.4] font-semibold normal-nums text-ink wrap-anywhere`,Ur=`grid size-6 place-items-center -my-1 mr-[-6px] ml-0 rounded-sm text-display leading-none text-muted hover:bg-inset hover:text-ink focus-visible:bg-inset focus-visible:text-ink touch:relative touch:after:absolute touch:after:-inset-2.5 touch:after:content-['']`,Wr=`dialog-body -m-0.5 flex min-h-0 flex-col gap-3 overflow-y-auto p-0.5 [&_p]:m-0 [&>.actions]:sticky [&>.actions]:-bottom-0.5 [&>.actions]:bg-surface [.dialog-body+div>&]:mt-3.5`,Gr=(e=!1)=>`menu fixed z-30 flex max-h-[calc(100vh-16px)] ${e?`min-w-40`:`min-w-50`} origin-top-left flex-col overflow-y-auto rounded-md border-hairline border-line bg-surface p-1 shadow-popover motion-safe:animate-menu-in [&.is-leaving]:pointer-events-none [&.is-leaving]:animate-sink-out`,Kr=e=>`flex items-baseline justify-between gap-6 rounded-[calc(var(--radius)-4px)] px-2.5 py-1.25 text-left text-body leading-[inherit] touch:py-2.5 ${e.danger&&e.selected?`bg-error text-paper`:e.selected||e.open?`bg-hover`:``} ${e.danger&&!e.selected?`text-error`:``} ${e.selected?`forced-colors:outline-2 forced-colors:-outline-offset-2 forced-colors:outline-[Highlight] forced-colors:outline-solid`:``}`,qr=`font-mono text-meta normal-nums`,Jr=e=>`${qr} ${e.danger&&e.selected?`text-inherit`:e.selected?`text-muted`:`text-subtle`} touch:hidden!`,Yr=e=>`${qr} ${e?`text-ink`:`text-subtle`}`,Xr=`${qr} text-accent`,Zr=`fixed right-3.5 bottom-8.5 z-40 flex flex-col gap-1.5 narrow:pointer-events-none narrow:top-12 narrow:bottom-auto narrow:left-3.5 narrow:items-end narrow:*:pointer-events-auto`,Qr=`flex cursor-default flex-wrap items-baseline justify-between gap-x-3`,$r=e=>`toast max-w-105 cursor-pointer rounded-sm border-hairline border-line bg-inset px-3 py-1.5 text-left font-sans text-meta normal-nums wrap-anywhere ${e?`text-error`:`text-ink`} motion-safe:animate-rise-in [&.is-leaving]:pointer-events-none [&.is-leaving]:animate-sink-out`,ei=`text-subtle`,ti=`flex items-baseline justify-between gap-3`,ni=`mt-1`,ri=`m-0 flex list-none flex-col gap-0.5 p-0`,ii=`flex min-w-0 items-baseline gap-2.5`,ai=`flex-none font-mono text-meta font-normal normal-nums min-w-[3ch] text-right text-subtle`,oi=`flex items-baseline gap-1`,si=`min-w-0 flex-1`,ci=`flex-none min-w-[calc(9ch+0.5rem)] whitespace-nowrap pr-2 text-right font-mono text-meta`,li=`font-mono [&:hover]:text-accent`,ui={row:`min-h-6.5 touch:min-h-10`,file:`min-h-6 font-mono text-meta touch:min-h-10`,"file-narrow":`min-h-9 font-mono text-meta`,pane:`min-h-5.5 touch:min-h-10`},di=`bg-hover cursor-grabbing scale-[1.02] motion-reduce:scale-none`,fi=`before:absolute before:top-1/2 before:h-3 before:w-0.5 before:-translate-y-1/2 before:rounded-full before:bg-subtle before:opacity-0 before:transition-opacity before:duration-150 before:content-[''] hover:before:opacity-70 touch:before:hidden`;function pi(e){let t=e.stack?`flex-col items-stretch gap-0.5 px-2.5 py-1.5`:`items-center gap-2 px-2 py-0.75`,n=e.lifted?di:e.moving?`bg-accent-soft`:e.selected?`bg-menu`:`hover:bg-hover data-menu-open:bg-hover`;return`relative flex w-full rounded-sm text-left ${e.lifted?``:`active:scale-97 motion-reduce:active:scale-none`} ${e.grab&&!e.lifted?`cursor-grab before:left-0.5 ${fi}`:``} ${t} ${ui[e.size??`row`]} ${n}`}var mi=`row-title min-w-0 flex-1 truncate`,hi=`row-title min-w-0 flex-auto truncate text-(length:--fs-title)`,gi=`running-shimmer:bg-[linear-gradient(90deg,var(--ink)_0%,var(--ink)_35%,var(--accent)_50%,var(--ink)_65%,var(--ink)_100%)] running-shimmer:bg-size-[300%_100%] running-shimmer:bg-clip-text running-shimmer:text-transparent running-shimmer:animate-shimmer`,_i=`w-[1ch] flex-none text-center font-mono`,vi=`grid w-[2ch] flex-none place-items-center font-mono text-subtle`,yi=`flex flex-none gap-1.5 font-mono text-meta`;function W(e){return e instanceof Error?e.message:String(e)}function bi(e){B();let t=(0,h.useRef)(null);return(0,h.useEffect)(()=>{t.current&&!t.current.contains(document.activeElement)&&t.current.focus();let e=e=>{e.key===`Escape`&&(e.preventDefault(),R())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,V.jsx)(`div`,{className:zr,onMouseDown:e=>e.target===e.currentTarget&&R(),children:(0,V.jsxs)(`dialog`,{ref:t,tabIndex:-1,open:!0,className:Br(e.wide),"aria-label":e.title,children:[(0,V.jsxs)(`div`,{className:Vr,children:[(0,V.jsx)(`h1`,{className:Hr,children:e.title}),(0,V.jsx)(`button`,{type:`button`,className:Ur,"aria-label":z(`dialog.close`),title:z(`dialog.close`),onClick:R,children:`×`})]}),e.children]})})}function xi(){let[e,t]=(0,h.useState)(!1),[n,r]=(0,h.useState)(null);return{busy:e,error:n,setError:r,submit:async e=>{t(!0),r(null);try{await e(),R()}catch(e){r(W(e))}finally{t(!1)}}}}function Si(e){let[t,n]=(0,h.useState)(e.initial??``),{busy:r,error:i,submit:a}=xi();return(0,V.jsx)(bi,{title:e.title,children:(0,V.jsxs)(`form`,{className:Wr,onSubmit:n=>{n.preventDefault(),(t.trim()||e.allowEmpty)&&a(()=>e.onSubmit(t.trim()))},children:[e.multiline?(0,V.jsx)(`textarea`,{className:`${jr} ${Fr}`,"aria-label":e.title,autoFocus:!0,rows:4,value:t,onChange:e=>n(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},onFocus:e=>e.currentTarget.setSelectionRange(t.length,t.length)}):(0,V.jsx)(`input`,{className:jr,"aria-label":e.title,autoFocus:!0,spellCheck:!1,value:t,onChange:e=>n(e.target.value),onFocus:e=>e.currentTarget.select()}),i&&(0,V.jsx)(`p`,{className:`text-error`,children:i}),(0,V.jsx)(Ti,{busy:r,submitLabel:e.submitLabel})]})})}function Ci(e){let{busy:t,error:n,setError:r,submit:i}=xi(),[a,o]=(0,h.useState)(!1),[s,c]=(0,h.useState)(null),[l,u]=(0,h.useState)(!1),d=(0,h.useRef)(null);(0,h.useEffect)(()=>d.current?.focus(),[]);let f=t=>void i(async()=>{try{a&&e.escalate?await e.escalate.run(l):await(t&&e.secondary?e.secondary.onConfirm():e.onConfirm())}catch(n){throw!a&&e.escalate?.when(n)&&(o(!0),c(n),u(t),r(W(n))),n}});return(0,V.jsx)(bi,{title:a&&e.escalate?.title||e.title,children:(0,V.jsxs)(`div`,{className:Wr,children:[(0,V.jsx)(`p`,{className:`whitespace-pre-line text-muted`,children:a&&e.escalate?.body?e.escalate.body(s):e.body}),n&&!(a&&e.escalate?.body)&&(0,V.jsx)(`p`,{className:`text-error`,children:n}),(0,V.jsxs)(`div`,{className:Mr,children:[(0,V.jsx)(`button`,{type:`button`,className:kr,onClick:R,children:z(`dialog.cancel`)}),e.secondary&&!a&&(0,V.jsx)(`button`,{type:`button`,className:br({danger:!0}),disabled:t,onClick:()=>f(!0),children:e.secondary.label}),(0,V.jsx)(`button`,{ref:d,type:`button`,className:br({danger:!0}),disabled:t,onClick:()=>f(!1),children:a&&e.escalate?e.escalate.label:e.confirmLabel})]})]})})}function wi(e){let t=Math.max(0,e.choices.findIndex(t=>t.value===e.current)),[n,r]=(0,h.useState)(t),{busy:i,error:a,submit:o}=xi(),s=t=>void o(()=>e.onPick(t));return(0,h.useEffect)(()=>{let t=t=>{if(t.key===`ArrowDown`||t.key===`j`)r(t=>Math.min(e.choices.length-1,t+1));else if(t.key===`ArrowUp`||t.key===`k`)r(e=>Math.max(0,e-1));else if(t.key===`Enter`){let t=e.choices[n];t&&s(t.value)}else return;t.preventDefault()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)}),(0,V.jsx)(bi,{title:e.title,children:(0,V.jsxs)(`div`,{className:Wr,children:[(0,V.jsx)(`ul`,{className:Rr,children:e.choices.map((t,a)=>(0,V.jsx)(`li`,{children:(0,V.jsxs)(`button`,{type:`button`,"aria-pressed":t.value===e.current,disabled:i,className:pi({selected:a===n}),onMouseEnter:()=>r(a),onClick:()=>s(t.value),children:[(0,V.jsx)(`span`,{className:`${_i} text-accent`,children:t.value===e.current?`●`:` `}),(0,V.jsx)(`span`,{className:mi,children:t.label})]})},t.value))}),a&&(0,V.jsx)(`p`,{className:`text-error`,children:a})]})})}function Ti({busy:e,submitLabel:t}){return(0,V.jsxs)(`div`,{className:Mr,children:[(0,V.jsx)(`button`,{type:`button`,className:kr,onClick:R,children:z(`dialog.cancel`)}),(0,V.jsx)(`button`,{type:`submit`,className:br(),disabled:e,children:t})]})}function Ei(e,t){let n=window.setInterval(()=>{(typeof document>`u`||document.visibilityState===`visible`)&&t()},e),r=()=>{document.visibilityState===`visible`&&t()};return document.addEventListener(`visibilitychange`,r),()=>{window.clearInterval(n),document.removeEventListener(`visibilitychange`,r)}}var Di={cancel:`Cancel`,failureHint:"Run `{command}` for diagnosis and next steps.",toastFailureHint:`Next: run rove doctor`,loading:`Loading…`,create:`create`,confirm:`Confirm`,paneCrash:{title:`This pane crashed`,hint:`The error was logged to client.log. Retry, or restart Rove if it keeps happening.`,regionTitle:`The {region} hit an error`,regionHint:"The rest of Rove keeps working. Retry below; if it persists, inspect client.log and run `rove doctor`.",retry:`[ retry ]`,region:{sidebar:`task list`,workspace:`workspace`,files:`file tree`,page:`page`}},rename:{defaultTitle:`Rename task`,defaultFieldLabel:`TITLE`,footerHint:`enter {submitLabel} · esc cancel`,defaultSubmitLabel:`rename`},prompt:{fieldLabel:`input`,submitLabel:`submit`}},Oi={cancel:`取消`,failureHint:"运行 `{command}` 查看诊断和后续步骤。",toastFailureHint:`下一步:运行 rove doctor`,loading:`加载中…`,create:`创建`,confirm:`确认`,paneCrash:{title:`此面板已崩溃`,hint:`错误已记录到 client.log。可重试;若反复出现请重启 Rove。`,regionTitle:`{region}出错了`,regionHint:"Rove 的其余部分仍可正常使用。请在下方重试;若问题持续,请查看 client.log 并运行 `rove doctor`。",retry:`[ 重试 ]`,region:{sidebar:`任务列表`,workspace:`工作区`,files:`文件树`,page:`页面`}},rename:{defaultTitle:`重命名任务`,defaultFieldLabel:`名称`,footerHint:`enter {submitLabel} · esc 取消`,defaultSubmitLabel:`重命名`},prompt:{fieldLabel:`输入`,submitLabel:`提交`}},ki={fix:{hint:"{count} finding(s) above have a known fix — run `{command}` to review them one by one",none:`fix: nothing to fix — no known remediation applies to this report`,header:`fixes — each one asks before running:`,willRun:`will run: {command}`,confirmPrompt:`apply this fix? [y/N] `,done:`✓ done`,failed:`✗ exited with code {code}; inspect the command output above, then rerun rove doctor`,skipped:`· skipped`,nonInteractive:`no interactive terminal — nothing was executed; run the commands above yourself`,manualHeader:`manual steps — doctor prints these but never runs them:`,daemonRestartWhy:`safe to run: engine sessions live in the separate PTY host and survive a daemon restart`,daemonStale:`restart the daemon — it is running an older build than this CLI`,daemonDown:`start the daemon — it is not running`,hooksDown:`restart the daemon to re-establish the engine hook channel`,inspectStale:`restart the daemon — it predates the hook-channel check`,skillInstallWhy:`safe to run: installs skill files only; re-running is idempotent`,skillMissing:`install the Rove agent skill`,skillStale:`update the Rove agent skill to the version this build expects`,spawnHelper:`restore the exec bit on node-pty's spawn-helper — every node-pty PTY spawn fails without it`,spawnHelperWhy:"safe to run: chmod on two prebuilt binaries; idempotent, and `bun install` does the same",resetWhy:`stops the daemon, the PTY host, and every live session — not undoable, so doctor only prints it`,resetDaemonWedged:`the daemon process is alive but unreachable (wedged)`,resetPty:`the PTY host process is alive but its socket is unreachable (wedged)`,resetPtyStale:`the PTY host is still running an older build than the one you launched`,resetLegacy:`pre-v0.8 tmux sessions are still holding processes and memory`,orphans:`{count} process(es) outlived the PTY session that spawned them and are still running`,orphansWhy:`kills processes, which is not undoable — and a task you backgrounded on purpose looks the same; read the list, then run it yourself`,engineTabs:`engine tabs may hold a stale daemon socket path`,engineTabsAction:`close and reopen the affected engine tabs in the TUI`,engineTabsWhy:`kills that tab's live engine session — your call, not doctor's`,staleInstall:`the install this Rove runs from no longer exists on disk`,staleInstallAction:`npm install -g @sma1lboy/rove, then relaunch Rove`,staleInstallWhy:`doctor cannot reinstall Rove over the running process — a human has to, then relaunch`,humanOnlyWhy:`doctor does not install software or log in to accounts for you`,git:`git is not on PATH`,gitAction:`install git with your OS package manager`,noEngine:`no usable engine — no engine CLI is both installed and logged in`,noEngineAction:`install an engine CLI (claude, codex, copilot, or kimi) and log in`,noEngineLogin:`no usable engine — an engine CLI is installed but not signed in`,noEngineLoginAction:`run one of the installed engine CLIs ({list}) in a shell and complete its login`,windowsNode:`Node.js is missing — the Windows PTY host cannot start`,windowsNodeAction:`install Node.js from https://nodejs.org`,staleBun:`the Bun running Rove is older than this build supports — terminals will not paint`,staleBunAction:"upgrade Bun (`bun upgrade`, `brew upgrade bun`, or `npm install -g bun@latest`), then relaunch Rove"}},Ai={fix:{hint:"上面有 {count} 项发现存在已知修法 — 运行 `{command}` 逐条查看",none:`fix: 无可修项 — 本次报告没有匹配到已知修法`,header:`修复项 — 每一条都会先询问再执行:`,willRun:`将执行: {command}`,confirmPrompt:`执行这条修复吗? [y/N] `,done:`✓ 完成`,failed:`✗ 退出码 {code};请检查上方命令输出,再运行 rove doctor`,skipped:`· 已跳过`,nonInteractive:`没有交互终端 — 未执行任何命令; 请自行运行上面的命令`,manualHeader:`人工步骤 — doctor 只打印, 永远不会替你执行:`,daemonRestartWhy:`可安全执行: 引擎会话在独立的 PTY host 里, daemon 重启后仍然存活`,daemonStale:`重启 daemon — 它运行的构建比当前 CLI 旧`,daemonDown:`启动 daemon — 它当前没有在运行`,hooksDown:`重启 daemon 以重建引擎 hook 通道`,inspectStale:`重启 daemon — 它的版本早于 hook 通道检查`,skillInstallWhy:`可安全执行: 只写入 skill 文件; 重复运行是幂等的`,skillMissing:`安装 Rove agent skill`,skillStale:`把 Rove agent skill 更新到当前构建期望的版本`,spawnHelper:`恢复 node-pty spawn-helper 的可执行位 — 缺了它 node-pty 的每次 PTY 启动都会失败`,spawnHelperWhy:"可安全执行: 只对两个预编译二进制做 chmod; 幂等, `bun install` 也会做同样的事",resetWhy:`会停掉 daemon、PTY host 和所有活动会话 — 不可撤销, 所以 doctor 只打印`,resetDaemonWedged:`daemon 进程存活但无法连接 (卡死)`,resetPty:`PTY host 进程存活但 socket 无法连接 (卡死)`,resetPtyStale:`PTY host 仍在跑比你启动的版本更旧的构建`,resetLegacy:`v0.8 之前的 tmux 会话仍占用进程和内存`,orphans:`有 {count} 个进程比启动它们的 PTY 会话活得更久, 现在还在运行`,orphansWhy:`会杀进程, 不可撤销 — 而且你故意放后台的任务看起来一模一样; 先看清单, 再自己执行`,engineTabs:`引擎 tab 可能持有过期的 daemon socket 路径`,engineTabsAction:`在 TUI 里关闭并重开受影响的引擎 tab`,engineTabsWhy:`会杀掉该 tab 的活动引擎会话 — 由你决定, doctor 不代劳`,staleInstall:`当前 Rove 所在的安装已从磁盘删除`,staleInstallAction:`npm install -g @sma1lboy/rove, 然后重新启动 Rove`,staleInstallWhy:`doctor 无法在运行中的进程上重装 Rove — 需要人工重装后重新启动`,humanOnlyWhy:`doctor 不会替你安装软件或登录账号`,git:`PATH 上找不到 git`,gitAction:`用你的系统包管理器安装 git`,noEngine:`没有可用引擎 — 没有任何引擎 CLI 同时满足已安装且已登录`,noEngineAction:`安装任一引擎 CLI(claude、codex、copilot 或 kimi)并登录`,noEngineLogin:`没有可用引擎 — 引擎 CLI 已安装, 但没有登录`,noEngineLoginAction:`在 shell 里运行已安装的引擎 CLI({list})之一并完成登录`,windowsNode:`缺少 Node.js — Windows PTY host 无法启动`,windowsNodeAction:`从 https://nodejs.org 安装 Node.js`,staleBun:`运行 Rove 的 Bun 版本低于本构建的要求 — 终端不会有任何输出`,staleBunAction:"升级 Bun (`bun upgrade` / `brew upgrade bun` / `npm install -g bun@latest`), 然后重新启动 Rove"}},ji={mentionNoEngine:`No engine session in this task — nothing to mention into. Open one with ctrl+t.`,tabs:{all:`All`,changes:`Changes`},actions:{zen:`Zen`,createPR:`Ask agent to create PR`,diffAll:`[D] diff everything`},legend:{changes:`M modified · A added · D deleted · ? untracked`},scope:{working:`scope: working tree`,branch:`scope: vs {base}`,toggleHint:`b to toggle`,noBase:`no base ref for branch scope (no origin/HEAD, main or master)`},empty:{noTask:`(no task — press n to create)`,noFiles:`(empty worktree)`,noChanges:`(no changes — clean worktree)`},error:{retryHint:`press r to retry`,notGitRepo:"not a git repository — run `git init` here, or open a task in a repo",pathMissing:`the worktree directory is gone — reopen the task to re-create it`,permissionDenied:`permission denied reading the worktree — check the directory's owner and mode`,gitNotInstalled:`git is not on PATH — install it with your OS package manager`,gitFailed:"git command failed; run `git status` in this worktree to diagnose"},toast:{prOnTargetBranch:`Already on the target branch ({branch}) — ask the agent to create the PR from a task branch`,noPausedOperation:`Nothing to resolve — no merge, rebase or cherry-pick is paused here`,conflictReadFailed:`Git could not read the conflicted files. Run git status in this worktree, then retry.`,conflictSendFailed:`Could not send the conflict prompt. Open an engine tab in this task, then retry.`,ciNoFailingChecks:`No failing check logs to read — the run may have expired, or the checks are no longer red`,ciChecksUnavailable:"gh could not read this PR's checks: {detail}. Run `gh auth status`, then retry."}},Mi={mentionNoEngine:`这个任务没有引擎会话——没有地方可以提及。用 ctrl+t 开一个。`,tabs:{all:`全部`,changes:`改动`},actions:{zen:`专注模式`,createPR:`让 agent 创建 PR`,diffAll:`[D] 查看全部改动`},legend:{changes:`M 已修改 · A 已添加 · D 已删除 · ? 未跟踪`},scope:{working:`范围:工作区改动`,branch:`范围:对比 {base}`,toggleHint:`按 b 切换`,noBase:`分支范围没有基准 ref(没有 origin/HEAD、main 或 master)`},empty:{noTask:`(暂无任务 — 按 n 创建)`,noFiles:`(worktree 为空)`,noChanges:`(无改动 — worktree 干净)`},error:{retryHint:`按 r 重试`,notGitRepo:"不是 git 仓库——在这里执行 `git init`,或改为打开仓库里的任务",pathMissing:`worktree 目录已不存在——重新打开该任务会重建它`,permissionDenied:`读取 worktree 时权限不足——请检查该目录的属主和权限`,gitNotInstalled:`PATH 上找不到 git——请用系统包管理器安装`,gitFailed:"git 命令失败;请在此 worktree 运行 `git status` 诊断"},toast:{prOnTargetBranch:`当前就在目标分支({branch})— 请在任务分支上让 agent 创建 PR`,noPausedOperation:`没有要解决的冲突——这里没有暂停中的合并、变基或拣选`,conflictReadFailed:`Git 无法读取冲突文件。请在此 worktree 运行 git status,然后重试。`,conflictSendFailed:`无法发送冲突提示。请在此任务中打开一个引擎标签页,然后重试。`,ciNoFailingChecks:`没有可读的失败检查日志——运行记录可能已过期,或检查已不再是红的`,ciChecksUnavailable:"gh 读不到这个 PR 的检查状态:{detail}。请运行 `gh auth status`,然后重试。"}},Ni={retryHint:`Correct the field above, then choose Create again.`,title:`New task`,legend:`{enter} · tab complete/fields · ctrl+[ ] mode · ctrl+e engine · esc cancel`,enterCreate:`enter create`,enterNext:`enter next field`,tabs:{existing:`For Existing`,clone:`For New Repo`,adopt:`Adopt Worktree`},field:{mode:`MODE`,tier:`DEPTH`,engine:`ENGINE`,effort:`EFFORT`,repo:`REPO`,fromBranch:`FROM BRANCH`,prompt:`FIRST MESSAGE`,extras:`ALSO INCLUDE`,gitUrl:`GIT URL`,parentDir:`PARENT DIR`,folderName:`FOLDER NAME`,baseBranch:`BASE BRANCH`,adoptFilter:`FILTER (PATH GLOB)`,opens:`OPENS`},intent:{task:`a new task worktree`,project:`the project itself`},placeholder:{folderName:`auto from url`,adoptFilter:`* — type e.g. feature-* to narrow`,prompt:`Describe a task or ask a question (optional)`},hint:{modeCycle:`ctrl+[ ]`,engineCycle:`ctrl+e`,remembered:`(remembered — next clone defaults to this dir)`,currentDir:`(current dir)`,noBranchesFound:`(no local branches found — typed text will be used as ref)`,noMatchBranch:`(no match — typed text will be used as ref)`,scanningWorktrees:`scanning worktrees…`,extrasNone:`(none — enter picks a repo; the first is the primary)`,extrasPicked:`{count} more repo(s) in this task`},picker:{moreAbove:`↑ {count} more`,moreBelow:`↓ {count} more`},scroll:{moreAbove:`↑ {count} more rows`,moreBelow:`↓ {count} more rows`},open:{failed:`Couldn't open the project: {error}`},adopt:{repoLine:`repo: {path}`,repoNone:`(none)`,noUnlinked:`no unlinked worktrees — every git worktree here is already a task`,noMatch:`no worktrees match the filter`,hintSelected:`{count} selected · enter toggles · ctrl+a all · Create imports`,hintDefault:`enter toggles · ctrl+a all · Create imports the highlighted row`,summaryAll:`Adopted {count} worktree(s)`,summaryPartial:`Adopted {done}/{total} worktrees — the rest failed (see log)`,summaryNone:`Couldn't adopt any worktree: {error}`},clone:{progressFallback:`Cloning…`,progressInto:`Cloning into {target}…`},button:{create:`Create`,cloning:`Cloning…`},error:{gitUrlRequired:`git URL is required`,gitUrlInvalid:`does not look like a git URL: {url}`,folderRequired:`folder name is required`,folderHasSeparator:`folder name cannot contain path separators`,parentRequired:`parent directory is required`,parentNotFound:`parent directory does not exist: {path}`,parentNotDir:`not a directory: {path}`,targetExists:`target already exists: {path}`,cloneFailed:`git clone failed: {error}`,noAdoptable:`no adoptable worktrees to import`,repoAmbiguous:`more than one saved repo is named {name} — pick the one you mean from the list`,tierUnavailable:`{tier} points at engine {engine}, which is not available here — retarget it in Settings → Auto routing`}},Pi={retryHint:`请修正上方字段,然后再次选择创建。`,title:`新建任务`,legend:`{enter} · tab 补全/切字段 · ctrl+[ ] 切模式 · ctrl+e 引擎 · esc 取消`,enterCreate:`enter 创建`,enterNext:`enter 下一个字段`,tabs:{existing:`已有仓库`,clone:`克隆新仓库`,adopt:`接管 Worktree`},field:{mode:`模式`,tier:`深度`,engine:`引擎`,effort:`推理强度`,repo:`仓库`,fromBranch:`基准分支`,prompt:`第一条消息`,extras:`同时包含`,gitUrl:`git 地址`,parentDir:`父目录`,folderName:`文件夹名`,baseBranch:`基准分支`,adoptFilter:`过滤(路径 glob)`,opens:`打开`},intent:{task:`新建任务 worktree`,project:`项目本身`},placeholder:{folderName:`自动从地址推导`,adoptFilter:`* — 输入如 feature-* 来缩小范围`,prompt:`描述一个任务,或提个问题(可选)`},hint:{modeCycle:`ctrl+[ ]`,engineCycle:`ctrl+e`,remembered:`(已记住 — 下次克隆默认使用此目录)`,currentDir:`(当前目录)`,noBranchesFound:`(未找到本地分支 — 将直接使用输入文本作为 ref)`,noMatchBranch:`(无匹配 — 将直接使用输入文本作为 ref)`,scanningWorktrees:`正在扫描 worktree…`,extrasNone:`(未选 — 回车选一个仓库,第一个是主仓库)`,extrasPicked:`任务里另含 {count} 个仓库`},picker:{moreAbove:`↑ 还有 {count} 项`,moreBelow:`↓ 还有 {count} 项`},scroll:{moreAbove:`↑ 上方还有 {count} 行`,moreBelow:`↓ 下方还有 {count} 行`},open:{failed:`无法打开项目:{error}`},adopt:{repoLine:`仓库:{path}`,repoNone:`(无)`,noUnlinked:`没有未关联的 worktree — 此仓库所有 git worktree 均已是任务`,noMatch:`没有 worktree 匹配此过滤条件`,hintSelected:`已选 {count} 项 · enter 切换选中 · ctrl+a 全选 · 创建 导入`,hintDefault:`enter 切换选中 · ctrl+a 全选 · 创建 将导入高亮行`,summaryAll:`已接管 {count} 个 worktree`,summaryPartial:`已接管 {done}/{total} 个 worktree — 其余失败(详见日志)`,summaryNone:`没有 worktree 接管成功:{error}`},clone:{progressFallback:`克隆中…`,progressInto:`正在克隆到 {target}…`},button:{create:`创建`,cloning:`克隆中…`},error:{gitUrlRequired:`git 地址不能为空`,gitUrlInvalid:`不像是有效的 git 地址:{url}`,folderRequired:`文件夹名不能为空`,folderHasSeparator:`文件夹名不能包含路径分隔符`,parentRequired:`父目录不能为空`,parentNotFound:`父目录不存在:{path}`,parentNotDir:`不是目录:{path}`,targetExists:`目标路径已存在:{path}`,cloneFailed:`git clone 失败:{error}`,noAdoptable:`没有可接管的 worktree`,repoAmbiguous:`有多个已保存仓库都叫 {name} — 请从列表中选择你要的那个`,tierUnavailable:`{tier} 指向的引擎 {engine} 在这台机器上不可用——去 设置 → 自动路由 重新指定`}},Fi={engineTitle:`Engine and account`,engineChecking:`Checking installed engines and accounts…`,engineReady:`✓ Ready to start a task`,engineMissing:`No usable engine yet`,engineUsable:`✓ {engine}: ready`,engineSignedOut:`! {engine}: installed, not signed in`,engineSetup:"Install an engine using docs.rove.run/rove/engines, then run its CLI and sign in. Run `rove doctor --fix` to check setup; Settings → Engines lists integrations.",engineContinue:`❯ Continue to optional setup`,engineLegend:`enter continue · esc skip optional setup`,quickStart:`Start a task with a prompt`,quickIntent:`Creates an isolated worktree and branch. Use {key} for the full task dialog.`,tabShared:`New conversations share this task’s files`,tabIsolated:`{key}: new task, isolated worktree`,title:`Welcome to Rove`,subtitle:`Managed tasks get isolated worktrees and branches. Directory and project tasks reuse existing files.`,completionsLabel:`Shell completions for {shell}`,completionsExplain:`Tab-completes rove subcommands. One line is added to your shell config.`,skillLabel:`Rove agent skill`,skillExplain:`Lets the coding agents on this machine drive Rove themselves: start tasks, read other sessions, message them.`,optionYes:`Install`,recommended:`recommended`,stepCounter:`{n} / {total}`,optionNo:`Not now`,queued:`Queued — installs when you quit Rove`,skillInstalled:`Installed for {engines}`,skillFailed:`Install failed: {reason}`,skillNoEngines:`No coding agent here takes the skill`,skipped:`Skipped`,installFailed:`! {item} failed: {reason}. Retry: {command} (or quit Rove again).`,legend:`↑↓ select · enter confirm · esc close`,keysTitle:`Keyboard basics`,keysBare:`Bare keys act in the focused pane — {nav} moves, {open} opens.`,keysOnePress:`A few one-press chords are Rove's own — {newTab} new tab, {focusNext} next pane.`,keysPrefix:`{prefix} opens the command map — hold it a beat and a guide appears.`,keysHelp:`{help} shows the full live reference anytime.`,keysNext:`Next: Settings → Engines lists every engine and installs its activity hooks.`,keysLegend:`enter finish`,appliedCompletions:`✓ completions hooked into {path} (takes effect in new shells)`,keptCompletions:`· {path} already has a completions block — left untouched`},Ii={engineTitle:`引擎与账户`,engineChecking:`正在检查引擎与账户…`,engineReady:`✓ 可以开始任务`,engineMissing:`还没有可用的引擎`,engineUsable:`✓ {engine}:可用`,engineSignedOut:`! {engine}:已安装,未登录`,engineSetup:"从 docs.rove.run/rove/engines 安装引擎,然后运行其 CLI 并登录。运行 `rove doctor --fix` 检查配置;设置 → 引擎 可查看集成。",engineContinue:`❯ 继续可选设置`,engineLegend:`enter 继续 · esc 跳过可选设置`,quickStart:`输入提示词开始任务`,quickIntent:`创建独立 worktree 和分支。按 {key} 打开完整任务对话框。`,tabShared:`新对话共享当前任务的文件`,tabIsolated:`{key}:新建任务,使用独立 worktree`,title:`欢迎使用 Rove`,subtitle:`托管任务使用独立的 worktree 和分支;目录与项目任务复用现有文件。`,completionsLabel:`{shell} 的 shell 补全`,completionsExplain:`让 rove 子命令支持 Tab 补全,会在你的 shell 配置里加一行。`,skillLabel:`Rove agent skill`,skillExplain:`让本机的编码 agent 自己操作 Rove:开任务、读其他会话、给它们发消息。`,optionYes:`安装`,recommended:`推荐`,stepCounter:`{n} / {total}`,optionNo:`跳过`,queued:`已排队 — 退出 Rove 后安装`,skillInstalled:`已为 {engines} 安装`,skillFailed:`安装失败:{reason}`,skillNoEngines:`这台机器上没有能装 skill 的编码 agent`,skipped:`已跳过`,installFailed:`! {item} 安装失败:{reason}。重试:{command}(或再次退出 Rove)。`,legend:`↑↓ 选择 · enter 确认 · esc 关闭`,keysTitle:`键盘基础`,keysBare:`裸键作用于当前聚焦面板 — {nav} 移动,{open} 打开。`,keysOnePress:`少量单次快捷键属于 Rove 自己 — {newTab} 新标签页,{focusNext} 切换面板。`,keysPrefix:`{prefix} 打开命令层 — 按住稍等会出现命令指南。`,keysHelp:`随时按 {help} 查看完整的实时键位表。`,keysNext:`接下来:设置 → 引擎 里列出每个引擎,并可在那里安装它们的活动钩子。`,keysLegend:`enter 完成`,appliedCompletions:`✓ 补全已写入 {path}(新开的 shell 生效)`,keptCompletions:`· {path} 里已有补全配置 — 未改动`},Li={title:`Quick task · {repoLabel}`,promptLabel:`PROMPT`,promptPlaceholder:`what should this task do?`,attemptsLabel:`ATTEMPTS`,engineLabel:`ENGINE`,branchLabel:`BRANCH`,legend:`enter create · tab fields · ctrl+e engine · ctrl+v attach · esc cancel`,startedRound:`Started {count} attempts`,roundPartial:`Started {ok}/{count} attempts — {failed} failed`},Ri={title:`快速任务 · {repoLabel}`,promptLabel:`提示词`,promptPlaceholder:`这个任务要做什么?`,attemptsLabel:`尝试次数`,engineLabel:`引擎`,branchLabel:`分支`,legend:`enter 创建 · tab 切换字段 · ctrl+e 引擎 · ctrl+v 附件 · esc 取消`,startedRound:`已启动 {count} 个尝试`,roundPartial:`已启动 {ok}/{count} 个尝试 —— {failed} 个失败`},zi={cancel:`cancel`,forgetProjectTitle:`Remove project "{title}"?`,forgetProjectBody:"Forgets it from the projects list and closes the sessions in its main checkout. The repo, its branches, worktrees, and any tasks under it stay on disk — re-add it with `rove add`.",forgetProjectConfirm:`remove`,deleteTitle:`Remove session "{title}"?`,deleteTitleDir:`Remove session "{title}"?`,deleteBodyDir:`Ends this session and closes all its tabs. Nothing on disk changes: the folder and its files stay.`,deleteBodyMain:`Ends this session and closes all its tabs. The project stays in your list and nothing on disk changes: the repo, its branches and worktrees stay.`,deleteBodyTask:`Ends this session, closes all its tabs and removes its worktree folder. The git branch stays.`,deleteBodyTaskBranch:`Ends this session, closes all its tabs and removes its worktree folder, and its git branch if it is merged. An unmerged branch stays.`,deleteConfirm:`remove`,childrenTitle:`"{title}" has {count} child tasks`,childrenBody:`Promote moves them up one level and keeps their worktrees and sessions. Remove with children removes them too.`,childrenPromote:`promote children`,childrenCascade:`remove with children`,childrenBodyMain:`Ends this session and closes its tabs; nothing on disk changes. Its child tasks keep running unless you delete them too.`,childrenKeepMain:`remove session`,childrenCascadeMain:`remove with children`,forceDeleteTitle:`"{title}" has uncommitted changes`,forceDeleteConfirm:`force remove`,legacyAdoptTitle:`Remove {count} sessions Rove added by itself?`,legacyAdoptBody:`An older Rove added a session whenever a worktree was created outside it. It no longer does. These look like leftovers:
|
|
16
|
+
这个 worktree 在该 PR 的头部({head},合入 {base})。对照 {base} 阅读改动(git diff origin/{base}...HEAD),然后告诉我你的发现:bug、风险、缺失的测试、不清楚的地方。不要推送、评论或批准这个 PR;在这里汇报。`}},st=n({en:()=>ct,zh:()=>lt}),ct={runLog:{title:`Runs`,all:`all`,outcome:{ok:`ok`,blocked:`blocked`,failed:`failed`,skipped:`skipped`},source:{schedule:`schedule`,manual:`manual`,webhook:`webhook`},blocked:{"task-missing":`task is gone`,"awaiting-owner":`waiting on a decision`,"report-missing":`last run never reported`,quota:`rate limited`,"engine-error":`engine error`,"engine-dead":`engine stopped`,"awaiting-permission":`waiting on a permission`,busy:`still working`},blockedRun:`blocked: {reason}`,empty:`No runs match.`,more:`+{count} more`}},lt={runLog:{title:`运行记录`,all:`全部`,outcome:{ok:`成功`,blocked:`受阻`,failed:`失败`,skipped:`跳过`},source:{schedule:`定时`,manual:`手动`,webhook:`Webhook`},blocked:{"task-missing":`任务已不存在`,"awaiting-owner":`等你做决定`,"report-missing":`上次运行没有汇报`,quota:`触发限流`,"engine-error":`引擎出错`,"engine-dead":`引擎已停止`,"awaiting-permission":`等你授权`,busy:`仍在运行`},blockedRun:`受阻:{reason}`,empty:`没有符合条件的运行。`,more:`另有 {count} 条`}},ut=n({en:()=>dt,zh:()=>ft}),dt={settings:{title:`Settings`,open:`settings`,sections:{connectors:`Connectors`,appearance:`Appearance`,notifications:`Notifications`,snippets:`Snippets`,about:`About`,voice:`Voice`},groups:{preferences:`Preferences`,agents:`Agents and tools`,more:`More`},pages:{general:`Language, layout, and where Rove opens files and creates worktrees.`,appearance:`Theme, colours, and how tasks and panes look.`,notifications:`When Rove tells you a task finished or needs you.`,keys:`Rebind chords in your own file, and how the prefix guide behaves.`,engines:`The coding agents Rove can start, and how it plugs into them.`,autoRouting:`What each depth tier starts, and who picks the tier.`,voice:`Dictation: the recognizer that turns what you say into prompts.`,connectors:`Accounts Rove uses, here and on your other machines.`,plugins:`Built-in pages and registered plugins.`,about:`Versions, updates, and this browser.`,feedback:`Send a note to the Rove team.`,dev:`Experimental switches, restarts and resets.`,snippets:`Prompt text you reuse. Type @name in a prompt to insert it.`},connectors:{githubDescription:`Clone, push and open PRs on every machine with one GitHub account`,connect:`Connect`,disconnect:`Disconnect`,disconnectBody:`Signs this machine's gh out of GitHub, for every tool that uses gh and not only Rove. Other machines keep their own sign-ins.`,machines:`Machines`,thisMachine:`This machine`,machinesHint:`Each machine signs in to GitHub by itself. The mark says whether it uses the same account as this one.`,refresh:`Check again`,refreshing:`Checking…`,useRove:`Use Rove's account`,loginThere:`Log in there`,codeHint:`Enter this code at GitHub (click the code to copy it)`,openGithub:`Open github.com/login/device`,codeCopied:`Code copied`,syncing:`Signed in. Bringing the other machines along…`,loginFailed:`Sign-in failed: {error}`,dismiss:`Dismiss`,loading:`checking…`,markSame:`✓ same account`,markDifferent:`⚠ @{login}`,markSignedOut:`✗ signed out`,markNoGh:`gh is not installed`,markOutdated:`Rove there is outdated`,markOffline:`offline`,markDenied:`refuses credential changes`,markFailed:`could not check`,detail:`git over {protocol} · SSH key {ssh}`,synced:`{machine} now uses @{login}`},general:{groupInterface:`Interface`,groupFiles:`Worktrees`,groupTerminal:`Terminal`,tabStrip:`Tab strip`,scrollback:`Scrollback`},appearance:{groupColours:`Colours`,groupTasks:`Tasks and panes`,taskColorsNote:`Gives each task its own hue on the working border and in the list.`,colorblindNote:`Shows added and removed lines in blue and red instead of green and red.`,workingBorderNote:`The pane's border while the selected task is working.`,railGroup:`Task list`,railGroupProject:`By project`,railGroupState:`By state`,statusMark:`Task status`,statusMarkEngine:`Engine icon`,statusMarkBoth:`Icon and dots`,statusMarkDots:`Dots only`,previewWorking:`Working`,previewDone:`Finished, unread`,previewIdle:`Idle`,previewWaiting:`Waiting for you`,previewBroken:`Broken`,previewTitle:`Fix the login redirect`},notifications:{toastNote:`A popup in the corner of this page.`,volume:`Chime volume`},about:{groupRove:`Rove`,daemon:`Daemon`,daemonCurrent:`rove {version}, same build as this page`,daemonStale:"rove {version} is out of date; run `rove daemon restart`",updates:`Updates`,browser:`This browser`,browserHint:`Forget this browser's token. A login token is revoked on the host too.`,access:`Access`,signIn:`Sign-in`,signInMode:{open:`None`,password:`Password`,token:`Token link`},signInHint:{open:`A browser on this computer opens Rove with no link or password. Phones and other computers still need a token.`,password:`A browser without a token signs in with the password. Token links keep working.`,token:`Only the link rove printed, or a device token, gets in. Password sign-in is off.`},passwordSet:`Set a password`,passwordChange:`Change the password`,passwordHint:`At least {min} characters. It is stored hashed on this computer.`,passwordField:`New password`,passwordSave:`Save`,signOut:`Sign out`},engines:{enabled:`Offer {name} when picking an engine`,default:`Make {name} the default engine`,namePlaceholder:`Display name (blank = default)`,rename:`Rename`,reset:`Reset to defaults`,remove:`Remove engine`,save:`Save`,cancel:`Cancel`},plugins:{builtIn:`Built in`,builtInHint:`First-party pages. Turning one off removes its entry from the rail.`,registered:`Registered plugins`,empty:`No other plugins registered.`,linked:`linked`,unsupportedPlatform:`unsupported platform`,turnOn:`Install {name}`},feedback:{hint:"Files a public GitHub issue on the Rove repo, through `gh` on the machine running rove. Without a signed-in `gh` you get a prefilled link to open instead.",kindLabel:`Kind`,kindBug:`Bug`,kindIdea:`Idea`,kindQuestion:`Question`,titleLabel:`Title`,body:`What happened`,send:`File issue`,sent:`Filed issue #{number}`,notFiled:`Not filed yet. {hint}`,openLink:`Open the prefilled issue`,report:`Report a problem with an agent`,reportNote:`An agent asks what went wrong, drafts the issue with you and files it.`,reportFailed:`Could not start the conversation.`,reportPrompt:"You are helping the user report a problem with Rove itself (not their own project) as a GitHub issue. First ask what they were doing and what felt wrong: one to three short questions, one at a time. Then collect context: run `rove --version` and `rove daemon status`, and read the last ~50 lines of `${ROVE_HOME_DIR:-$HOME}/.rove/daemon.log` only if the problem could involve the daemon. Draft an issue title and body (what happened, what they expected, steps, relevant output) and show it to the user. Only after they say OK, file it with a heredoc: `rove feedback --kind bug|idea|question --title \"...\" --body-file - <<'EOF'` followed by the body and `EOF`. Then share the issue URL. If it prints a prefilled link instead (gh missing or signed out), give the user that link and tell them to run `gh auth login`."}},prefs:{languageHint:`Display language, shared with the TUI.`,soundHint:`chime, plus a desktop notification while this tab is in the background`,soundVolumeHint:`Plays the new level when you pick it.`,push:`Notify when this page is closed`,pushHint:`This browser gets a notification when a task finishes, needs you or fails, even with no Rove page open. Follows the cross-task switch.`,pushUnsupported:`This browser can't receive push here: it needs https (or localhost), and on iPhone/iPad the page added to the home screen.`,pushBlocked:`Notifications are blocked for this site; allow them in the browser's site settings.`,pushFailed:`Couldn't turn it on: {error}`,zenHint:`Hide the Files pane. The zen chip and ctrl+a z toggle it and write this same setting.`,editInTui:`Edit it in the TUI.`,tierModel:`model`,tierEdit:`Edit`,tierEffort:`Reasoning effort`,classifierConnection:`Classifier connection`,unset:`(none)`,modeAuto:`Auto (follow the browser)`,themePreviewHint:`Point at a theme to see this page in it; click to keep it. The TUI follows.`,themeUser:`yours`,themeInstalled:`Installed`,themeMoreHint:`Not installed yet: point to preview, click to install and switch.`,themeBrowse:`Browse {count} more from rove.run`,themeHide:`Hide themes from rove.run`,themeGet:`get`,themeInstalling:`installing…`,themeInstallFailed:`failed, retry`,themeAgent:`Make one with an agent`,themeAgentHint:`opens a Scratch session; reopen Settings to see what it wrote.`,themeAgentFailed:`couldn't open the session; try again.`,themeAgentPrompt:"Make me a new Rove color theme. Ask me first what look I want, unless I already said. Save it as one JSON file in {dir} (for example {dir}/my-theme.json); the file name is the theme's name. The format is in https://github.com/sma1lboy/rove/blob/main/docs/themes.md and the JSON schema is https://raw.githubusercontent.com/sma1lboy/rove/main/packages/rove/src/tui/context/theme/theme.schema.json. Start from https://raw.githubusercontent.com/sma1lboy/rove/main/packages/rove/src/tui/context/theme/claude.json, give each color slot a { dark, light } pair, and keep text readable on every background. When it's saved, run `rove theme list` to check it loads, then tell me the name: it appears in Settings → Appearance.",resetButton:`Reset`,resetHint:`Clears this Mac's saved settings and task list, restarts the Rove daemon, then reloads this page. Worktrees on disk and engine session history are not touched.`,resetBody:`Wipes ~/.config/rove/state.json and ~/.rove/tasks.json and restarts the daemon, then reloads this page with an empty task list. Worktrees on disk and engine session history are NOT touched.`,restartButton:`Restart`,restartHint:`Stops the Rove daemon and starts a fresh one; this page reconnects on its own. Running engine sessions live in the PTY host and survive it.`,restartBody:`Stops the Rove daemon and starts a fresh one, picking up daemon edits. This page reconnects in a few seconds. Running engine sessions survive.`,keysYaml:`The file is read on the Mac; changes apply when you come back to this page.`},keys:{editHint:`Click a key to record a new one, then press the key you want. To put it behind the prefix, press the prefix key first. The × removes it.`,reset:`Reset`,recordFor:`Record a key for {name}`,removeFor:`Remove the key for {name}`,pluginNoTask:`Select a task before using a plugin chord.`,pluginChords:`Plugin chords`,agent:`Change them with an agent`,agentHint:`opens a Scratch session; reopen Settings to see what it changed.`,agentFailed:`couldn't open the session; try again.`,agentPrompt:"Change my Rove keybindings. Ask me first what I want changed, unless I already said. Edit {path} (create it if it is missing; keep existing entries and comments you were not asked to change). The format, every binding id and its default chord are in https://github.com/sma1lboy/rove/blob/main/docs/KEYBINDINGS.md (see Customizing). Only use binding ids listed there; a direct override replaces that binding's whole chord list, and null unbinds. The file must stay valid YAML: check it parses (for example with `ruby -ryaml -e 'YAML.load_file(ARGV[0])' {path}` or any YAML parser you have). Rove reloads it live, and unknown ids or invalid chords are ignored with a warning, so when you are done tell me what you changed and ask me to reopen Settings → Keybindings: it lists every applied override and every warning."},pages:{attachTooLarge:`{name} is larger than 500 MB`,new:`[ new ]`,routinePause:`[ pause ]`,routineEnable:`[ enable ]`,delete:`[ delete ]`,routinesNeedYou:`NEEDS YOU`,routinesActive:`ACTIVE`,routinesPaused:`PAUSED`,laterStarts:`LATER`,laterCancel:`[ cancel ]`,laterFailed:`Did not start: {error}`,laterCancelFailed:`Could not cancel the start: {error}`,routineSchedule:`Schedule`,routineNext:`Next run`,routineProject:`Project`,routineDelivers:`Delivers to`,routineEngine:`Engine`,routineChangeEngine:`[ change ]`,routinePrompt:`PROMPT`,routineScript:`SCRIPT`,cronDown:`Decrease {field}`,cronUp:`Increase {field}`,storySave:`save`,storySaveStart:`save & start`,storyStart:`start`,attachHintTouch:`paste a path / a screenshot → inserts an image placeholder`}},ft={settings:{title:`设置`,open:`设置`,sections:{connectors:`连接器`,appearance:`外观`,notifications:`通知`,snippets:`片段`,about:`关于`,voice:`语音`},groups:{preferences:`偏好`,agents:`智能体与工具`,more:`更多`},pages:{general:`语言、布局,以及 Rove 在哪里打开文件、创建 worktree。`,appearance:`主题、颜色,以及任务和面板的外观。`,notifications:`任务完成或需要你时,Rove 怎么提醒。`,keys:`在你自己的文件里重绑快捷键,以及前缀引导的行为。`,engines:`Rove 能启动的编码智能体,以及它如何接入它们。`,autoRouting:`每个深度档位启动什么,以及由谁选择档位。`,voice:`口述:把你说的话变成提示词的识别器。`,connectors:`Rove 使用的账号,本机和你的其他机器。`,plugins:`内置页面和已注册的插件。`,about:`版本、更新,以及此浏览器。`,feedback:`给 Rove 团队留一条意见。`,dev:`实验开关、重启和重置。`,snippets:`常用的提示词文本。在提示词里输入 @名称 即可插入。`},connectors:{githubDescription:`用同一个 GitHub 账号在每台机器上克隆、推送和开 PR`,connect:`连接`,disconnect:`断开`,disconnectBody:`把这台机器的 gh 从 GitHub 退出登录,所有用 gh 的工具都会受影响,不只是 Rove。其他机器保持各自的登录。`,machines:`机器`,thisMachine:`本机`,machinesHint:`每台机器各自登录 GitHub。右边的标记表示它和本机用的是不是同一个账号。`,refresh:`重新检查`,refreshing:`检查中…`,useRove:`使用 Rove 的账号`,loginThere:`在那里登录`,codeHint:`到 GitHub 输入这个验证码(点击验证码可复制)`,openGithub:`打开 github.com/login/device`,codeCopied:`验证码已复制`,syncing:`已登录,正在同步其他机器…`,loginFailed:`登录失败:{error}`,dismiss:`关闭`,loading:`检查中…`,markSame:`✓ 同一账号`,markDifferent:`⚠ @{login}`,markSignedOut:`✗ 未登录`,markNoGh:`未安装 gh`,markOutdated:`那边的 Rove 版本过旧`,markOffline:`离线`,markDenied:`拒绝修改凭据`,markFailed:`无法检查`,detail:`git 走 {protocol} · SSH 密钥 {ssh}`,synced:`{machine} 现在使用 @{login}`},general:{groupInterface:`界面`,groupFiles:`Worktree`,groupTerminal:`终端`,tabStrip:`标签栏`,scrollback:`回滚行数`},appearance:{groupColours:`颜色`,groupTasks:`任务与面板`,taskColorsNote:`让每个任务在工作边框和列表里有自己的色调。`,colorblindNote:`新增和删除的行用蓝色和红色,而不是绿色和红色。`,workingBorderNote:`所选任务工作时,面板边框的样子。`,railGroup:`任务列表`,railGroupProject:`按项目`,railGroupState:`按状态`,statusMark:`任务状态`,statusMarkEngine:`引擎图标`,statusMarkBoth:`图标加点阵`,statusMarkDots:`只有点阵`,previewWorking:`正在跑`,previewDone:`完成未读`,previewIdle:`空闲`,previewWaiting:`等你回答`,previewBroken:`出错`,previewTitle:`修复登录跳转`},notifications:{toastNote:`本页角落里的弹出提示。`,volume:`提示音音量`},about:{groupRove:`Rove`,daemon:`守护进程`,daemonCurrent:`rove {version},与本页同一版本`,daemonStale:"rove {version} 版本过旧;运行 `rove daemon restart`",updates:`更新`,browser:`此浏览器`,browserHint:`忘掉此浏览器的令牌。登录得到的令牌也会在主机上吊销。`,access:`访问`,signIn:`登录方式`,signInMode:{open:`免登录`,password:`密码`,token:`Token 链接`},signInHint:{open:`本机浏览器不用链接或密码就能打开 Rove。手机和其他电脑仍然需要 token。`,password:`没有 token 的浏览器用密码登录。Token 链接照常可用。`,token:`只有 rove 打印的链接或设备 token 能进。密码登录关闭。`},passwordSet:`设置密码`,passwordChange:`修改密码`,passwordHint:`至少 {min} 个字符。以哈希形式存在本机。`,passwordField:`新密码`,passwordSave:`保存`,signOut:`退出登录`},engines:{enabled:`选引擎时列出 {name}`,default:`把 {name} 设为默认引擎`,namePlaceholder:`显示名称(留空 = 默认)`,rename:`重命名`,reset:`恢复默认`,remove:`移除引擎`,save:`保存`,cancel:`取消`},plugins:{builtIn:`内置`,builtInHint:`官方页面。关掉后,它在侧栏的入口会消失。`,registered:`已注册的插件`,empty:`没有其他已注册的插件。`,linked:`已链接`,unsupportedPlatform:`平台不支持`,turnOn:`安装 {name}`},feedback:{hint:"通过运行 rove 那台机器上的 `gh`,在 Rove 仓库提一个公开的 GitHub issue。没有登录 `gh` 时会给你一条预填好的链接。",kindLabel:`类型`,kindBug:`缺陷`,kindIdea:`想法`,kindQuestion:`问题`,titleLabel:`标题`,body:`发生了什么`,send:`提交 issue`,sent:`已提交 issue #{number}`,notFiled:`还没提交。{hint}`,openLink:`打开预填好的 issue`,report:`让 agent 帮我报告问题`,reportNote:`由 agent 问清哪里不对,和你一起起草 issue 并提交。`,reportFailed:`没能开始对话。`,reportPrompt:"你在帮用户把 Rove 本身的问题(不是他们自己项目的问题)提成一个 GitHub issue。先问清楚他们当时在做什么、哪里不对劲:一到三个简短的问题,一次问一个。然后收集上下文:运行 `rove --version` 和 `rove daemon status`,只有问题可能和 daemon 有关时才读 `${ROVE_HOME_DIR:-$HOME}/.rove/daemon.log` 的最后约 50 行。起草 issue 的标题和正文(发生了什么、期望什么、复现步骤、相关输出)并展示给用户。用户确认之后才提交,用 heredoc:`rove feedback --kind bug|idea|question --title \"...\" --body-file - <<'EOF'`,接正文,最后一行 `EOF`。然后把 issue 链接发给用户。如果输出的是预填链接(没装 gh 或没登录),把链接给用户,并告诉他运行 `gh auth login`。"}},prefs:{languageHint:`显示语言,与 TUI 共用同一设置。`,soundHint:`提示音;本页在后台时另发桌面通知`,soundVolumeHint:`选中后会播放新音量。`,push:`页面关闭时也通知`,pushHint:`任务完成、需要你或出错时,即使没有打开任何 Rove 页面,这个浏览器也会收到通知。跟随「跨任务通知」开关。`,pushUnsupported:`这个浏览器在这里收不到推送:需要 https(或 localhost),iPhone/iPad 上还要先把页面添加到主屏幕。`,pushBlocked:`这个网站的通知被浏览器屏蔽了,去浏览器的网站设置里允许。`,pushFailed:`没能开启:{error}`,zenHint:`收起文件栏。zen 按钮和 ctrl+a z 切换时会写入同一个设置。`,editInTui:`请在 TUI 中编辑`,tierModel:`模型`,tierEdit:`编辑`,tierEffort:`推理强度`,classifierConnection:`分类器连接`,unset:`(无)`,modeAuto:`自动(跟随浏览器)`,themePreviewHint:`鼠标指向一个主题,整页就换成它看看;点一下就定下来。TUI 也会跟着换。`,themeUser:`自装`,themeInstalled:`已安装`,themeMoreHint:`尚未安装:指向即预览,点一下安装并切换。`,themeBrowse:`浏览 rove.run 上的另外 {count} 个主题`,themeHide:`收起 rove.run 的主题`,themeGet:`安装`,themeInstalling:`安装中…`,themeInstallFailed:`失败,重试`,themeAgent:`让 agent 做一个`,themeAgentHint:`会开一个 Scratch 会话;做好后重新打开设置就能看到。`,themeAgentFailed:`会话没打开,再试一次。`,themeAgentPrompt:"帮我做一个新的 Rove 配色主题。先问我想要什么风格,除非我已经说过。把它存成 {dir} 下的一个 JSON 文件(比如 {dir}/my-theme.json),文件名就是主题名。格式说明见 https://github.com/sma1lboy/rove/blob/main/docs/themes.md,JSON schema 是 https://raw.githubusercontent.com/sma1lboy/rove/main/packages/rove/src/tui/context/theme/theme.schema.json。以 https://raw.githubusercontent.com/sma1lboy/rove/main/packages/rove/src/tui/context/theme/claude.json 为起点,每个颜色槽都给 { dark, light } 两个值,并保证文字在每种背景上都看得清。存好后运行 `rove theme list` 确认能加载,然后告诉我主题名:它会出现在 设置 → 外观 里。",resetButton:`重置`,resetHint:`清空这台 Mac 上保存的设置和任务列表,重启 Rove 守护进程,然后刷新本页。磁盘上的工作树和引擎会话历史不受影响。`,resetBody:`清空 ~/.config/rove/state.json 和 ~/.rove/tasks.json 并重启守护进程,然后刷新本页,任务列表为空。磁盘上的工作树和引擎会话历史不会被动。`,restartButton:`重启`,restartHint:`停止 Rove 守护进程并启动新的进程,本页会自动重连。运行中的引擎会话在 PTY 宿主里,不受影响。`,restartBody:`停止 Rove 守护进程并启动新的进程,载入守护进程的改动。本页几秒后自动重连,运行中的引擎会话不受影响。`,keysYaml:`该文件在 Mac 上读取,改动会在你回到本页时生效。`},keys:{editHint:`点一个按键开始录入,再按你想要的键。想放到 prefix 后面,就先按 prefix 键。× 是删掉它。`,reset:`恢复默认`,recordFor:`为「{name}」录入按键`,removeFor:`删掉「{name}」的按键`,pluginNoTask:`使用插件快捷键前请先选中一个任务。`,pluginChords:`插件快捷键`,agent:`让 agent 来改`,agentHint:`会开一个 Scratch 会话;改好后重新打开设置就能看到。`,agentFailed:`会话没打开,再试一次。`,agentPrompt:"帮我改 Rove 的快捷键。先问我想改什么,除非我已经说过。编辑 {path}(不存在就新建;没让你改的条目和注释都保留)。格式、每个 binding id 及其默认按键见 https://github.com/sma1lboy/rove/blob/main/docs/KEYBINDINGS.md(Customizing 一节)。只用那里列出的 binding id;直接覆盖会替换该 binding 的整个按键列表,null 表示解绑。文件必须保持合法 YAML:确认它能解析(比如 `ruby -ryaml -e 'YAML.load_file(ARGV[0])' {path}`,或任何你有的 YAML 解析器)。Rove 会实时重新加载它,未知 id 或无效按键会被忽略并给出警告,所以改完后告诉我改了什么,并请我重新打开 设置 → 快捷键:那里会列出所有生效的覆盖和所有警告。"},pages:{attachTooLarge:`{name} 超过 500 MB`,new:`[ 新建 ]`,routinePause:`[ 暂停 ]`,routineEnable:`[ 启用 ]`,delete:`[ 删除 ]`,routinesNeedYou:`需要处理`,routinesActive:`运行中`,routinesPaused:`已暂停`,laterStarts:`稍后启动`,laterCancel:`[ 取消 ]`,laterFailed:`没有启动:{error}`,laterCancelFailed:`取消失败:{error}`,routineSchedule:`调度`,routineNext:`下次执行`,routineProject:`项目`,routineDelivers:`投递到`,routineEngine:`引擎`,routineChangeEngine:`[ 更换 ]`,routinePrompt:`提示词`,routineScript:`脚本`,cronDown:`减小{field}`,cronUp:`增大{field}`,storySave:`保存`,storySaveStart:`保存并启动`,storyStart:`启动`,attachHintTouch:`粘贴路径 / 截图 → 插入图片占位行`}},pt=n({en:()=>mt,zh:()=>ht}),mt={transcript:{you:`You`,agent:`Agent`,system:`System`,copy:`[ copy ]`,copied:`Copied`,export:`[ export .md ]`,findPlaceholder:`Find in this conversation`,findCount:`{at} / {total}`,findNone:`no match`,prev:`[ prev ]`,next:`[ next ]`,older:`[ load earlier ]`,loading:`Reading the conversation…`,empty:`Nothing said yet.`,failed:`failed`,error:`Could not read the conversation: {error}`,retry:`[ retry ]`,noHistory:`This engine keeps no history Rove can read. Showing its terminal tail.`,tail:`Terminal tail`}},ht={transcript:{you:`你`,agent:`智能体`,system:`系统`,copy:`[ 复制 ]`,copied:`已复制`,export:`[ 导出 .md ]`,findPlaceholder:`在这段对话中查找`,findCount:`{at} / {total}`,findNone:`没有匹配`,prev:`[ 上一个 ]`,next:`[ 下一个 ]`,older:`[ 加载更早 ]`,loading:`正在读取对话…`,empty:`还没有对话内容。`,failed:`失败`,error:`读不到这段对话:{error}`,retry:`[ 重试 ]`,noHistory:`这个引擎没有 Rove 能读取的历史记录,显示的是它的终端末尾。`,tail:`终端末尾`}},gt=n({en:()=>_t,zh:()=>vt}),_t={usage:{title:`Usage`,receipt:`Usage receipt`,total:`Total tokens`,thanks:`Thank you, burn again soon`,open:`Open usage`,range:`last {days} days · tokens are input + output`,perDay:`Per day`,byModel:`By engine and model`,topTasks:`Top tasks`,quota:`Quota`,turns:`{count} turns`,loading:`Loading…`,empty:`No turns recorded in this window.`,failed:`Could not read usage: {error}`,cutoff:`The daemon returns at most {count} turns: {day} and earlier are partial.`,noReader:`{engines}: no turn reader, so their work is not counted here.`,removedTask:`(removed task)`,full:`at this pace full around {time}, before it resets`,lasts:`at this pace it lasts until the reset`}},vt={usage:{title:`用量`,receipt:`用量小票`,total:`合计 token`,thanks:`谢谢惠顾,欢迎再烧`,open:`打开用量`,range:`最近 {days} 天 · token 为输入加输出`,perDay:`按天`,byModel:`按引擎和模型`,topTasks:`用量最高的任务`,quota:`额度`,turns:`{count} 轮`,loading:`加载中…`,empty:`这段时间没有记录到任何一轮。`,failed:`无法读取用量:{error}`,cutoff:`守护进程最多返回 {count} 轮:{day} 及更早的数据不完整。`,noReader:`{engines}:没有轮次读取器,这里不统计它们的工作。`,removedTask:`(已删除的任务)`,full:`按当前速度约 {time} 用完,早于重置时间`,lasts:`按当前速度可撑到重置`}},yt=n({en:()=>bt,zh:()=>xt}),bt={voice:{say:`Say`,stop:`Stop {time}`,release:`Release {time}`,working:`Hearing…`,hint:`Dictate: tap to start and stop, or hold to talk and let go`,slideToSend:`Slide up to send`,tipSend:`Let go to send`,hold:`Hold to talk`,holdOrType:`Hold to talk, tap to type`,learned:`Learned {pairs}`,learnedPair:`{spoken} → {term}`,undo:`undo`,unlearned:`Forgotten`,unlearnFailed:`Couldn't undo: the voice sidecar isn't answering`,setup:{dictation:`Dictation`,backend:{off:`Off`,local:`On this Mac`,cloud:`Cloud`},unavailable:`This Rove cannot set up dictation`,offHint:`The mic is hidden. Nothing runs in the background.`,localNeeded:`Install the model below; the mic shows once it is ready.`,localInstalling:`Installing the model; the mic shows once it is ready.`,cloudNeeded:`Save an endpoint below to turn dictation on.`,ready:`{model} · ready`,starting:`Starting…`,localTitle:`Whisper large-v3`,localHint:`Runs on this Mac's GPU, about 3.5 GB to download. Audio never leaves the Mac.`,install:`Install`,installing:`Installing…`,installed:`Installed, about 4 GB on disk.`,failed:`Install failed: {line}`,uninstall:`Uninstall`,uninstallAsk:`Remove the model?`,cancel:`Cancel`,cloudTitle:`Cloud endpoint`,cloudHint:`Any OpenAI-compatible /audio/transcriptions service. The audio and your terms go there; the key stays on the Mac.`,baseURL:`Base URL`,model:`Model`,apiKey:`API key`,keySaved:`Saved; leave empty to keep it`,save:`Save`,saveAndUse:`Save and use`,forget:`Forget`,forgetAsk:`Remove the endpoint and its key?`}}},xt={voice:{say:`说`,stop:`停 {time}`,release:`松手 {time}`,working:`在听…`,hint:`口述:点一下开始、再点一下结束,或按住说话、松手结束`,slideToSend:`上滑发送`,tipSend:`松手发送`,hold:`按住说话`,holdOrType:`按住说话,轻点打字`,learned:`记住了 {pairs}`,learnedPair:`{spoken} → {term}`,undo:`撤销`,unlearned:`已撤销`,unlearnFailed:`没能撤销:语音服务没有响应`,setup:{dictation:`语音输入`,backend:{off:`关闭`,local:`本机`,cloud:`云端`},unavailable:`这个 Rove 无法设置语音输入`,offHint:`不显示麦克风,后台也不运行任何东西。`,localNeeded:`在下面安装模型,就绪后显示麦克风。`,localInstalling:`正在安装模型,就绪后显示麦克风。`,cloudNeeded:`在下面保存一个服务地址后开启。`,ready:`{model} · 就绪`,starting:`启动中…`,localTitle:`Whisper large-v3`,localHint:`在这台 Mac 的 GPU 上运行,约需下载 3.5 GB。音频不离开这台 Mac。`,install:`安装`,installing:`安装中…`,installed:`已安装,约占 4 GB 磁盘。`,failed:`安装失败:{line}`,uninstall:`卸载`,uninstallAsk:`删除模型?`,cancel:`取消`,cloudTitle:`云端服务`,cloudHint:`任何兼容 OpenAI /audio/transcriptions 的服务。音频和你的术语会发到那里;密钥只存在这台 Mac 上。`,baseURL:`Base URL`,model:`模型`,apiKey:`API 密钥`,keySaved:`已保存;留空则保留原密钥`,save:`保存`,saveAndUse:`保存并使用`,forget:`删除`,forgetAsk:`删除这个服务地址和密钥?`}}},St=n({en:()=>Ct,zh:()=>wt}),Ct={workspace:{pickTask:`pick a task on the left`,noTabs:`no open sessions in this task`,startEngine:`Start {engine}`,startSession:`Start session`,tabNotLive:`this tab has no running session`,restored:`restored session, read-only until reopened`,exited:`session ended (exit {code})`,attachFailed:`could not open this session: {message}`,reopen:`Reopen session`,reopening:`Reopening…`,reopenFailed:`could not reopen this session: {message}`,engineExited:`engine exited (code {code})`,retry:`Retry`,engineSettings:`Settings → Engines`,usageLimitUntil:`usage limit reached — rove resumes this task at {time}`,resumeQuota:`resume now`,resumingQuota:`resuming…`,usageLimit:`usage limit reached`,dismiss:`Dismiss`,openTask:`Open`},tab:{shell:`shell`,engine:`engine`},firstRun:{title:`All your coding agents, in one place`,body:`When one runs out of quota, switch the task to another. Agents talk to each other directly, and every task gets its own worktree and branch.`,start:`Start your first task`},status:{connecting:`connecting`,retrying:`reconnecting, attempt {count}`,retry:`retry now`,backlog:`Backlog`,inProgress:`In progress`,inReview:`In review`,done:`Done`,canceled:`Canceled`,error:`Error`},connect:{title:`open the link rove printed`,body:"Run `rove --web` and open the link it prints, or paste it here.",placeholder:`http://127.0.0.1:7878/#token=…`,submit:`connect`,invalid:"that is not a `rove --web` link",failing:"can't reach rove. Is `rove --web` still running? After `--rotate-token`, open the new link.",forget:`forget this link`,notConnected:`not connected to rove — reconnecting (the view refreshes on its own)`},relay:{unpaired:"open the relay link that `rove --web --preset relay` printed on your computer",connecting:`connecting to your computer through the relay…`,loading:`loading rove…`,offline:"your computer is not answering on this relay. Is `rove --web --preset relay` still running? After `--rotate-relay`, open the new link. Reload to retry.",failed:`can't reach your computer through the relay ({error}). Reload to retry.`},login:{title:`sign in`,body:`Enter this Rove's password.`,field:`password`,submit:`sign in`,checking:`checking…`,wrong:`that did not work`,locked:`too many tries from here; try again in {minutes} min`,lockedHost:"password login is locked; run `rove --web --unlock` on the host",unreachable:"can't reach rove. Is `rove --web` still running?"},layout:{splitTooSmall:`Not enough room to split here`,railFold:`Fold the task list`,navBack:`Back`,navForward:`Forward`,railUnfold:`Unfold the task list`,dropUploading:`Uploading {name}…`,pasteNoImage:`No image on this browser's clipboard`,pasteNoAccess:`Can't read this browser's clipboard: {error}`,pasteNeedsHttps:`the page needs https or localhost`,refreshTimeout:"The daemon did not come back on the new build in time; check `rove daemon status`",railResize:`Drag to resize the task list, click to fold it, double-click to reset`,composerPlaceholder:`Message the agent`,composerSend:`Send`,composerAttach:`Attach a file`,composerNotSent:`Not sent: {reason}`,composerOldBridge:`This Mac's rove --web is older than this page; restart it to send from here.`,composerAtMenu:`The agent is waiting on a choice. Answer it with the 1–4 and ⏎ keys below; your message is kept.`,termKeys:`Terminal keys`,termKeyUp:`Up arrow`,termKeyDown:`Down arrow`,termKeyLeft:`Left arrow`,termKeyRight:`Right arrow`,termKeyInterrupt:`Ctrl+C, interrupt`,termKeyEnter:`Enter`,narrowTerminal:`Terminal`}},wt={workspace:{pickTask:`从左边选一个任务`,noTabs:`这个任务没有打开的会话`,startEngine:`启动 {engine}`,startSession:`启动会话`,tabNotLive:`这个标签没有在运行的会话`,restored:`已恢复的会话,重新打开前只读`,exited:`会话已结束(退出码 {code})`,attachFailed:`打不开这个会话:{message}`,reopen:`重新打开会话`,reopening:`正在重新打开…`,reopenFailed:`重新打开失败:{message}`,engineExited:`引擎已退出(退出码 {code})`,retry:`重试`,engineSettings:`设置 → 引擎`,usageLimitUntil:`已达到用量上限 —— rove 会在 {time} 自动继续这个任务`,resumeQuota:`现在继续`,resumingQuota:`正在继续…`,usageLimit:`已达到用量上限`,dismiss:`忽略`,openTask:`打开`},tab:{shell:`终端`,engine:`引擎`},firstRun:{title:`所有编程 agent,都在一个地方`,body:`一个额度用完了,换另一个接着干;agent 之间直接对话。每个任务有独立的 worktree 和分支,互不覆盖。`,start:`开始第一个任务`},status:{connecting:`连接中`,retrying:`重连中,第 {count} 次`,retry:`立即重试`,backlog:`待办`,inProgress:`进行中`,inReview:`待评审`,done:`已完成`,canceled:`已取消`,error:`出错`},connect:{title:`打开 rove 打印的链接`,body:"运行 `rove --web`,打开它打印的链接,或者把链接粘贴到这里。",placeholder:`http://127.0.0.1:7878/#token=…`,submit:`连接`,invalid:"这不是 `rove --web` 打印的链接",failing:"连不上 rove。`rove --web` 还在运行吗?用过 `--rotate-token` 的话,请打开新的链接。",forget:`忘掉这个链接`,notConnected:`没有连上 rove,正在重连(连上后这里会自动刷新)`},relay:{unpaired:"打开电脑上 `rove --web --preset relay` 打印的 relay 链接",connecting:`正在通过 relay 连接你的电脑…`,loading:`正在加载 rove…`,offline:"你的电脑没有在这个 relay 上应答。`rove --web --preset relay` 还在运行吗?用过 `--rotate-relay` 的话,请打开新的链接。刷新重试。",failed:`无法通过 relay 连到你的电脑({error})。刷新重试。`},login:{title:`登录`,body:`输入这台 Rove 的密码。`,field:`密码`,submit:`登录`,checking:`验证中…`,wrong:`登录失败`,locked:`这里尝试次数过多;{minutes} 分钟后再试`,lockedHost:"密码登录已锁定;在主机上运行 `rove --web --unlock`",unreachable:"连不上 rove。`rove --web` 还在运行吗?"},layout:{splitTooSmall:`这里放不下分屏了`,railFold:`折叠任务列表`,navBack:`后退`,navForward:`前进`,railUnfold:`展开任务列表`,dropUploading:`正在上传 {name}…`,pasteNoImage:`浏览器剪贴板里没有图片`,pasteNoAccess:`读不到浏览器剪贴板:{error}`,pasteNeedsHttps:`页面要走 https 或 localhost`,refreshTimeout:"守护进程没能及时以新版本重新上线,请检查 `rove daemon status`",railResize:`拖动调整任务列表宽度,单击折叠,双击还原`,composerPlaceholder:`给 agent 发消息`,composerSend:`发送`,composerAttach:`附加文件`,composerNotSent:`没发出去:{reason}`,composerOldBridge:`这台 Mac 上的 rove --web 比页面旧,重启它之后才能从这里发送。`,composerAtMenu:`agent 正在等你选择。用下方的 1–4 和 ⏎ 键回答;你的消息已保留。`,termKeys:`终端按键`,termKeyUp:`上方向键`,termKeyDown:`下方向键`,termKeyLeft:`左方向键`,termKeyRight:`右方向键`,termKeyInterrupt:`Ctrl+C 中断`,termKeyEnter:`回车`,narrowTerminal:`终端`}},Tt=[tt,St,Ue,Ye,ut,Le,Qe,st,gt,pt,Ke,Pe,it,Be,yt],Et=Object.assign({},...Tt.map(e=>e.en)),Dt={en:Et,zh:Object.assign({},...Tt.map(e=>e.zh))};function Ot(){try{let e=JSON.parse(localStorage.getItem(`rove.prefs`)??`null`);if(e&&typeof e==`object`&&`prefs`in e){let t=e.prefs;if(t&&typeof t==`object`&&`locale`in t&&(t.locale===`en`||t.locale===`zh`))return t.locale}}catch{}return globalThis.navigator?.language?.toLowerCase().startsWith(`zh`)?`zh`:`en`}var kt=v(Ot());function At(){let e=typeof document>`u`?void 0:document.documentElement;e&&(e.lang=kt.get()===`zh`?`zh-CN`:`en`)}At(),kt.subscribe(At);function jt(e,t){let n=e;for(let e of t.split(`.`)){if(!n||typeof n!=`object`||!(e in n))return;n=Reflect.get(n,e)}return typeof n==`string`?n:void 0}function Mt(e,t){return t?e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e)):e}function z(e,t){return Mt(jt(Dt[kt.get()],e)??jt(Et,e)??e,t)}function Nt(e,t,n){return Mt(jt(e[kt.get()],t)??jt(e.en,t)??t,n)}function B(){return y(kt)}function Pt(e){let t=e.trim(),n=t.indexOf(`#`),r=n>=0?new URLSearchParams(t.slice(n+1)).get(`token`):t;return r&&/^[A-Za-z0-9_-]{43}$/.test(r)?r:null}var Ft=(...e)=>e.filter(Boolean).join(` `),It=`text-meta leading-[inherit]`,Lt=`font-normal normal-nums`,Rt=`touch:relative touch:after:absolute touch:after:content-['']`,zt=`flex h-full flex-col`,Bt=e=>[`app relative grid min-h-0 flex-1 grid-rows-[1fr_auto] transition-[grid-template-columns] duration-220 ease-snap motion-reduce:transition-none`,e.surface?`is-narrow narrow-${e.surface} grid-cols-[minmax(0,1fr)]`:e.zen?`grid-cols-[var(--rail-w,minmax(220px,280px))_1fr]`:`grid-cols-[var(--rail-w,minmax(220px,280px))_1fr_var(--panel-w,clamp(300px,28vw,440px))]`,e.zen?`is-zen`:``,e.expanded?`is-panel-expanded`:``,e.folded?`is-rail-folded`:``,e.peek?`is-rail-peek`:``,e.dragging?`is-dragging transition-none`:``].join(` `),Vt=[`relative narrow-content:hidden narrow-back:col-1 narrow-back:row-1 touch:select-none touch:touch-callout-none`,`wide:overflow-x-clip wide:pt-8.5 wide:[&>:not([data-grip])]:min-w-(--rail-open-w)`,`rail-folded:absolute rail-folded:inset-y-1.5 rail-folded:left-1.5 rail-folded:z-6 rail-folded:col-1 rail-folded:row-1 rail-folded:box-border rail-folded:w-(--rail-open-w) rail-folded:-translate-x-[calc(100%+12px)] rail-folded:rounded-md rail-folded:border-hairline rail-folded:border-line rail-folded:bg-surface rail-folded:shadow-none rail-folded:transition-[translate] rail-folded:duration-200 rail-folded:ease-snap rail-folded:motion-reduce:transition-none rail-folded:[&>:not([data-grip])]:min-w-0`,`rail-peek:translate-none rail-peek:shadow-dialog`].join(` `),Ht=`rail-folded:col-2 panel-expanded:invisible panel-expanded:col-2 narrow-sidebar:hidden narrow-back:z-1 narrow-back:col-1 narrow-back:translate-x-(--back-x) narrow-back:bg-paper narrow-back:shadow-dialog`,Ut=`rail-folded:col-3 panel-expanded:z-2 panel-expanded:col-[2/-1] panel-expanded:bg-paper panel-expanded:pl-2`,Wt=`${Rt} touch:after:-inset-x-1.5 touch:after:-inset-y-3`,Gt=`flex items-center gap-2`,Kt=`flex min-w-0 items-baseline gap-1.5 px-1.5 py-0.5 text-meta font-bold ${Rt} touch:after:-inset-2.5 touch:after:-bottom-1`,qt=`flex items-center rounded-sm px-2.5 py-1.5 text-muted aria-selected:bg-inset aria-selected:text-ink [&_svg]:size-4 ${Rt} touch:after:-inset-x-px touch:after:-top-2 touch:after:-bottom-1.5`,Jt=`keys-only m-0 overflow-hidden px-3.5 py-1 text-meta text-ellipsis whitespace-nowrap`,Yt=e=>`shortcut-badge absolute top-1/2 z-8 -translate-y-1/2 cursor-pointer rounded-sm border-hairline border-accent bg-surface px-1.25 py-px text-meta text-accent ${e?`right-full mr-1.5`:`right-1`}`,Xt=`relative min-w-0 flex-1`,Zt={left:[`[border-left:var(--hairline)_solid_var(--line)]`,`[border-left:var(--hairline)_solid_var(--accent)]`],top:[`[border-top:var(--hairline)_solid_var(--line)]`,`[border-top:var(--hairline)_solid_var(--accent)]`]},Qt=(e,t)=>Zt[e][+!!t],$t=(e,t)=>{let n=`split-leaf absolute box-border flex min-h-0 min-w-0 ${t.active?`is-active`:``}`,r=t.active?`border-accent`:``;return e===`box`?`${n} rounded-[calc(var(--radius)-1px)] border-hairline ${t.active?`border-accent`:`border-line`}`:e===`line`?`${n} ${t.left?Qt(`left`,t.active):``} ${t.top?Qt(`top`,t.active):``} ${t.left||t.top?r:``}`:e===`rail`?`${n} ${Qt(`left`,t.active)} ${r} ${t.top?`[--mt:6px]`:``}`:e===`rule`?`${n} ${Qt(`top`,t.active)} ${r} ${t.left?`[--ml:8px]`:``}`:n},en=(e,t)=>`absolute right-2 z-3 bg-paper px-1 font-mono text-meta ${Lt} ${e?`-top-2`:`top-0.5`} ${t?`text-accent`:`text-subtle`}`,tn=`hidden gap-1 overflow-x-auto scrollbar-none [border-top:var(--hairline)_solid_var(--line)] bg-surface px-1.5 py-1 touch:flex`,nn=e=>`h-10 min-w-max touch-manipulation [flex:1_1_0] rounded-sm border-hairline bg-inset px-0.5 py-0 font-mono text-meta ${Lt} ${e?`border-accent text-accent`:`border-line text-ink`}`,rn=`prefix-guide fixed bottom-19 left-3 z-40 max-h-[60vh] w-[min(560px,calc(100vw-24px))] overflow-y-auto rounded-sm border-hairline border-line bg-surface px-3 py-2 text-meta shadow-popover motion-safe:animate-rise-in [&.is-leaving]:pointer-events-none [&.is-leaving]:animate-sink-out`,an=`min-w-[3ch] text-accent`,on=`mb-1.5 flex justify-between gap-4`,sn=`columns-[2_220px] gap-x-5`,cn=`mb-2 break-inside-avoid`,ln=`flex w-full gap-2.5 px-0 py-px text-left text-ink enabled:hover:bg-hover disabled:cursor-default touch:py-2.5`,un=`mx-0 my-2 overflow-x-hidden overflow-y-auto scrollbar-none`,dn=e=>`flex w-full min-w-0 justify-between gap-4 rounded-sm px-1.5 py-0.75 text-left font-mono text-meta ${Lt} whitespace-pre text-ink touch:py-2.5 ${e?`is-selected bg-hover`:``}`,fn=`min-w-0 overflow-hidden text-ellipsis`,pn=`w-full rounded-none border-0 [border-bottom:var(--hairline)_solid_var(--line)] bg-transparent px-1.5 py-2 font-mono text-meta font-normal normal-nums text-ink focus-visible:outline-none`,mn=`flex justify-between gap-4`,hn=`flex flex-col items-end ${It}`,gn=`mt-2 max-h-[52vh] overflow-y-auto`,_n=`mb-2.5`,vn=`m-0 mb-1 font-sans text-meta font-bold normal-nums text-accent`,yn=`flex gap-3 py-px ${It}`,bn=`min-w-[14ch] text-ink`,xn=`flex flex-wrap items-baseline gap-3 [border-bottom:var(--hairline)_solid_var(--warning)] bg-inset px-3.5 py-1 text-meta text-warning [&_span]:text-muted`,Sn=`keys-only fixed bottom-[34px] left-3 z-40 min-w-55 rounded-sm border-hairline border-line bg-surface px-3 py-2 font-mono text-meta ${Lt} text-ink shadow-popover`,Cn=e=>`mb-0.5 ${e?`motion-safe:[animation:sink-out_140ms_ease-in_var(--hud-out,3860ms)_forwards]`:`motion-safe:[animation:rise-in_140ms_ease-out,sink-out_140ms_ease-in_var(--hud-out,3860ms)_forwards]`}`,wn=`m-auto font-mono text-meta ${Lt} text-subtle`,Tn=`${wn} flex flex-col items-center gap-3 [&_p]:m-0`,En=`workspace isolate row-1 flex min-h-0 min-w-0 flex-col gap-1.5 px-1 pt-2 pb-1`,Dn=`flex min-h-0 flex-1 overflow-hidden rounded-md border-hairline border-line bg-paper focus-within:border-focus`,On=`working-flow:border-transparent working-flow:[background:linear-gradient(var(--paper),var(--paper))_0_0/100%_100%_padding-box,linear-gradient(90deg,var(--line),var(--task-ink,var(--focus)),var(--line),var(--task-ink,var(--focus)),var(--line))_0_0/300%_100%_border-box] working-flow:motion-safe:animate-flow-border`,kn=`relative flex min-w-0 flex-1 flex-col`,An=`relative flex min-h-0 min-w-0 flex-1 flex-col`,jn=`term-host relative min-h-0 min-w-0 flex-1 touch-none overflow-hidden`,Mn=`pointer-events-none absolute inset-0 z-5 h-full w-full`,Nn=`relative h-full [&.is-leaving]:pointer-events-none [&.is-leaving]:absolute [&.is-leaving]:inset-0 [&.is-leaving]:z-6`,Pn=`pointer-events-none absolute inset-0 z-1 overflow-hidden [&_pre]:m-0 [&_pre>div>div]:overflow-hidden [&_pre>div>div]:[height:var(--row-h,1.15em)] [&_pre>div>div]:[line-height:var(--row-h,1.15em)]`,Fn=e=>`absolute right-2.5 bottom-2.5 z-5 flex max-w-[calc(100%-20px)] flex-wrap items-center gap-x-3 gap-y-1 rounded-sm border-hairline border-line bg-inset px-2.5 py-1.25 font-mono text-meta ${Lt} ${e?`text-error`:`text-muted`} [&_.link:disabled]:pointer-events-none [&_.link:disabled]:opacity-60 [&_button]:whitespace-nowrap`,In=`col-span-full touch:[&_.link]:after:inset-[-2px_-6px_-4px] flex min-w-0 items-center gap-2 [border-top:var(--hairline)_solid_var(--line)] bg-surface px-3 py-1 font-mono text-meta ${Lt} whitespace-nowrap text-muted`,Ln=e=>`size-1.5 rounded-full ${e?`bg-warning`:`bg-subtle`}`,Rn=`grid min-w-0 grid-cols-[auto_minmax(2rem,1fr)_auto] gap-x-2.5 gap-y-1 pt-2 pb-1 font-sans whitespace-nowrap text-meta text-subtle normal-nums`,zn=`col-span-3 grid cursor-pointer grid-cols-subgrid items-center text-left hover:text-ink`,Bn={ok:`text-muted`,warn:`text-warning`,crit:`text-error`},Vn={ok:`text-success`,warn:`text-warning`,crit:`text-error`},Hn=e=>`relative h-0.75 overflow-hidden rounded-full bg-[color-mix(in_srgb,currentColor_18%,transparent)] after:absolute after:inset-y-0 after:left-0 after:w-(--fill) after:rounded-full after:bg-current after:content-[''] ${Vn[e]??Vn.ok}`,Un=`font-mono text-title font-bold normal-nums tracking-[0.02em] whitespace-nowrap`,Wn=`text-accent`,Gn=`grid h-full place-items-center p-6`,Kn=`flex w-[min(460px,100%)] flex-col gap-3 rounded-md border-hairline border-line bg-surface p-6 [&_p]:m-0`,qn=`flex flex-col gap-2 p-3.5 text-left font-sans text-meta ${Lt} leading-[1.5]`,Jn=`flex-none fill-none stroke-current [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:1.25]`,Yn=(e={})=>`relative grid cursor-pointer place-items-center rounded-sm border-none p-0 disabled:cursor-default disabled:opacity-35 [&_svg]:fill-none [&_svg]:stroke-current [&_svg]:[stroke-linecap:round] [&_svg]:[stroke-linejoin:round] [&_svg]:[stroke-width:1.25] touch:after:absolute touch:after:-inset-x-px touch:after:-top-2 touch:after:-bottom-1.25 touch:after:content-[''] touch:first:after:-left-2 ${e.tool?`size-5.5 flex-none`:`size-6.5`} ${e.tool||e.small?`[&_svg]:size-3.5`:`[&_svg]:size-4`} ${e.on?`bg-accent-soft text-accent`:`bg-transparent text-subtle enabled:hover:bg-hover enabled:hover:text-ink`}`,Xn=`absolute top-2 left-[calc(--spacing(2)+var(--shell-inset-left,0px))] z-7 flex items-center gap-0.5`,Zn=`[&.is-resizing_iframe]:pointer-events-none`,Qn=e=>`side-panel ${Ut} relative row-1 flex min-h-0 min-w-0 flex-col ${Zn} ${e?`flex-1 p-0`:`pt-2 pr-1 pb-1 pl-0`}`,$n=`grid min-h-0 flex-1 grid-rows-[minmax(0,1fr)] [--divider:5px] ${Zn}`,er=`side-col row-1 flex min-h-0 min-w-0 flex-col`,tr=e=>`side-head flex min-h-6.5 min-w-0 items-center gap-0.5 pb-1.5 font-mono text-meta normal-nums ${e?`px-2 pt-0`:`narrow:px-2 narrow:pt-0`}`,nr=`min-w-0 flex-1 truncate px-2 text-ink`,rr=`flex min-w-0 flex-1 items-center gap-0.5`,ir=`scrollbar-none flex min-w-0 gap-0.5 overflow-x-auto`,ar=e=>`group/ptab relative flex min-w-12 max-w-40 items-center hover:text-ink ${e.active?`is-active text-ink`:`text-muted`} ${e.compact&&!e.active?`max-w-24 flex-none`:`flex-initial`}`,or=e=>`flex min-w-0 cursor-pointer items-center gap-1.5 border-none bg-transparent py-1 pl-1.5 text-inherit [font:inherit] ${e?`pr-0.5`:`pr-1.5`}`,sr=`truncate`,cr=e=>`touch:relative size-4 flex-none cursor-pointer rounded-xs border-none p-0 font-mono text-title leading-none text-subtle hover:bg-hover hover:text-ink touch:after:absolute touch:after:-inset-1.5 touch:after:-left-1 touch:after:content-[''] ${e?`mr-0.5 bg-transparent`:`absolute top-1/2 right-0.5 -translate-y-1/2 bg-paper opacity-0 group-hover/ptab:opacity-100 focus-visible:opacity-100 [@media(hover:none)]:opacity-100`}`,lr=`ml-auto flex gap-0.5`,ur=`relative row-1 cursor-col-resize touch-none before:absolute before:inset-y-0 before:left-[calc(var(--divider)/2)] before:w-px before:bg-line before:content-[''] hover:before:bg-line-active after:absolute after:inset-x-[-3px] after:inset-y-0 after:content-['']`,dr=`side-view flex min-h-0 min-w-0 flex-1 flex-col [&[hidden]]:hidden`,fr=`m-auto flex max-w-[44ch] flex-col items-center gap-2.5 p-4 text-center font-mono text-meta leading-[1.5] text-subtle normal-nums`,pr=`flex min-h-0 flex-1 flex-col gap-1.5`,mr=`flex items-center gap-0.5 [&_svg]:flex-none`,hr=`mx-0.5 min-w-0 flex-1 rounded-sm border-none bg-inset px-2 py-1 text-ink [font-size:var(--fs-meta)] focus:bg-hover focus:outline-none aria-invalid:text-muted`,gr=`min-w-0 flex-1 rounded-sm border-none bg-paper`,_r=`relative flex min-h-0 min-w-0 flex-1`,vr=`absolute inset-0 size-full cursor-crosshair touch-none fill-none stroke-accent [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:2.5]`,yr=t((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),V=t(((e,t)=>{t.exports=yr()}))(),br=({danger:e=!1}={})=>`rounded-sm font-sans text-meta not-italic normal-nums text-paper active:scale-97 motion-reduce:active:scale-none disabled:cursor-default disabled:opacity-50 touch:min-h-10 ${e?`bg-error`:`bg-accent`} px-3.5 py-1.5 font-semibold`,xr={link:`text-accent hover:underline`,filled:br(),danger:br({danger:!0}),action:`rounded-sm border-hairline border-line bg-inset px-3 py-1.5 font-sans text-meta text-ink hover:border-line-active hover:bg-menu active:scale-97 motion-reduce:active:scale-none disabled:cursor-default disabled:opacity-50 touch:min-h-10 focus-visible:outline-1 focus-visible:outline-offset-1 focus-visible:outline-focus`,floating:`whitespace-nowrap rounded-sm border-hairline border-line-active bg-surface px-2 py-0.5 font-mono text-meta text-ink shadow-popover`,row:``,pill:`inline-flex flex-none items-center gap-1.5 whitespace-nowrap font-mono text-meta text-muted hover:text-ink aria-[current=true]:text-accent`,icon:Yn({small:!0}),iconOn:Yn({small:!0,on:!0}),card:`flex min-w-0 flex-col gap-1.5 rounded-sm border-hairline p-1.5 text-left focus-visible:outline-1 focus-visible:outline-offset-1 focus-visible:outline-focus`},Sr={roomy:`relative touch:after:absolute touch:after:content-[''] touch:after:-inset-x-1.5 touch:after:-inset-y-3`,tight:`relative touch:after:absolute touch:after:content-[''] touch:after:-inset-x-0.75 touch:after:-inset-y-0.5`,none:``};function H({variant:e=`link`,hit:t=e===`link`?`roomy`:`none`,className:n,type:r=`button`,...i}){return(0,V.jsx)(`button`,{type:r,className:Ft(xr[e],Sr[t],n),...i})}var Cr=`mx-2.5 my-3 font-mono text-meta text-subtle`,wr=`font-sans text-meta text-subtle`,Tr=`m-0 max-h-[38vh] overflow-auto rounded-sm border-hairline border-line bg-paper px-3 py-2.5 font-mono text-meta leading-[1.5] whitespace-pre-wrap wrap-anywhere`,Er=e=>`flex w-full flex-col gap-0.5 rounded-sm px-2.5 py-1.5 text-left focus-visible:bg-accent-soft focus-visible:outline-none ${e?`bg-accent-soft`:``}`,Dr=`mx-0 mt-1 mb-0 max-h-47 list-none overflow-y-auto rounded-sm border-hairline border-line bg-inset p-0.5 font-mono text-meta`,Or=e=>`block w-full cursor-pointer overflow-hidden rounded-[calc(var(--radius-sm)-2px)] px-2 py-0.75 text-left text-ellipsis whitespace-nowrap [font:inherit] touch:py-2.5 ${e.cursor?`bg-hover`:``} ${e.accent?`text-accent`:e.cursor?`text-ink`:`text-muted`}`,U=`m-0 font-sans text-meta font-medium normal-nums`,kr=`link text-accent [&:hover]:underline touch-hit`,Ar=`rounded-sm border-hairline border-line bg-paper font-mono text-meta font-normal normal-nums text-ink focus-visible:border-line-active focus-visible:outline-none`,jr=`${Ar} w-full px-2.5 py-2`,Mr=`actions flex items-center justify-end gap-3.5`;function Nr({failing:e=!1}){B();let[t,n]=(0,h.useState)(``),[r,i]=(0,h.useState)(!1);return(0,V.jsx)(`div`,{className:Gn,children:(0,V.jsxs)(`form`,{className:Kn,onSubmit:e=>{e.preventDefault();let n=Pt(t);if(!n){i(!0);return}a(n),window.location.reload()},children:[(0,V.jsxs)(`span`,{className:Un,children:[(0,V.jsx)(`span`,{className:Wn,children:`[`}),` rove `,(0,V.jsx)(`span`,{className:Wn,children:`]`})]}),(0,V.jsx)(`h1`,{className:`${U} text-muted`,children:z(`connect.title`)}),(0,V.jsx)(`p`,{className:e?`text-error`:`text-muted`,children:z(e?`connect.failing`:`connect.body`)}),(0,V.jsx)(`input`,{className:jr,autoFocus:!0,spellCheck:!1,placeholder:z(`connect.placeholder`),value:t,onChange:e=>{n(e.target.value),i(!1)}}),r&&(0,V.jsx)(`p`,{className:`text-error`,children:z(`connect.invalid`)}),(0,V.jsxs)(`div`,{className:Mr,children:[e&&(0,V.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>{o(),window.location.reload()},children:z(`connect.forget`)}),(0,V.jsx)(`button`,{type:`submit`,className:br(),children:z(`connect.submit`)})]})]})})}var Pr=`flex flex-col gap-1.5`,Fr=`min-h-18 max-h-[50vh] leading-[1.45]`,Ir=`flex flex-wrap gap-1.5`,Lr=(e=!1,t=!1)=>`rounded-sm border-hairline px-2.5 py-1 font-mono text-meta font-normal not-italic normal-nums ${e?`border-accent bg-accent-soft text-ink`:`border-line hover:bg-hover ${t?`text-subtle`:`text-muted`}`}`,Rr=`m-0 list-none p-0`,zr=`overlay fixed inset-0 z-20 grid justify-items-center [align-items:start] bg-(--scrim) pt-[12vh] motion-safe:animate-fade-in [&.is-leaving]:pointer-events-none [&.is-leaving]:animate-fade-out short:pt-3`,Br=(e=!1)=>`dialog static m-0 flex max-h-[76vh] ${e?`w-[min(620px,calc(100vw-32px))]`:`w-[min(440px,calc(100vw-32px))]`} flex-col gap-3 rounded-md border-hairline border-line bg-surface px-5 py-4.5 text-inherit shadow-dialog focus:outline-none motion-safe:animate-rise-in [.is-leaving_&]:animate-sink-out short:max-h-[calc(100dvh-24px)] short:px-4 short:py-3`,Vr=`flex items-center justify-between gap-3`,Hr=`m-0 min-w-0 font-sans text-title leading-[1.4] font-semibold normal-nums text-ink wrap-anywhere`,Ur=`grid size-6 place-items-center -my-1 mr-[-6px] ml-0 rounded-sm text-display leading-none text-muted hover:bg-inset hover:text-ink focus-visible:bg-inset focus-visible:text-ink touch:relative touch:after:absolute touch:after:-inset-2.5 touch:after:content-['']`,Wr=`dialog-body -m-0.5 flex min-h-0 flex-col gap-3 overflow-y-auto p-0.5 [&_p]:m-0 [&>.actions]:sticky [&>.actions]:-bottom-0.5 [&>.actions]:bg-surface [.dialog-body+div>&]:mt-3.5`,Gr=(e=!1)=>`menu fixed z-30 flex max-h-[calc(100vh-16px)] ${e?`min-w-40`:`min-w-50`} origin-top-left flex-col overflow-y-auto rounded-md border-hairline border-line bg-surface p-1 shadow-popover motion-safe:animate-menu-in [&.is-leaving]:pointer-events-none [&.is-leaving]:animate-sink-out`,Kr=e=>`flex items-baseline justify-between gap-6 rounded-[calc(var(--radius)-4px)] px-2.5 py-1.25 text-left text-body leading-[inherit] touch:py-2.5 ${e.danger&&e.selected?`bg-error text-paper`:e.selected||e.open?`bg-hover`:``} ${e.danger&&!e.selected?`text-error`:``} ${e.selected?`forced-colors:outline-2 forced-colors:-outline-offset-2 forced-colors:outline-[Highlight] forced-colors:outline-solid`:``}`,qr=`font-mono text-meta normal-nums`,Jr=e=>`${qr} ${e.danger&&e.selected?`text-inherit`:e.selected?`text-muted`:`text-subtle`} touch:hidden!`,Yr=e=>`${qr} ${e?`text-ink`:`text-subtle`}`,Xr=`${qr} text-accent`,Zr=`fixed right-3.5 bottom-8.5 z-40 flex flex-col gap-1.5 narrow:pointer-events-none narrow:top-12 narrow:bottom-auto narrow:left-3.5 narrow:items-end narrow:*:pointer-events-auto`,Qr=`flex cursor-default flex-wrap items-baseline justify-between gap-x-3`,$r=e=>`toast max-w-105 cursor-pointer rounded-sm border-hairline border-line bg-inset px-3 py-1.5 text-left font-sans text-meta normal-nums wrap-anywhere ${e?`text-error`:`text-ink`} motion-safe:animate-rise-in [&.is-leaving]:pointer-events-none [&.is-leaving]:animate-sink-out`,ei=`text-subtle`,ti=`flex items-baseline justify-between gap-3`,ni=`mt-1`,ri=`m-0 flex list-none flex-col gap-0.5 p-0`,ii=`flex min-w-0 items-baseline gap-2.5`,ai=`flex-none font-mono text-meta font-normal normal-nums min-w-[3ch] text-right text-subtle`,oi=`flex items-baseline gap-1`,si=`min-w-0 flex-1`,ci=`flex-none min-w-[calc(9ch+0.5rem)] whitespace-nowrap pr-2 text-right font-mono text-meta`,li=`font-mono [&:hover]:text-accent`,ui={row:`min-h-6.5 touch:min-h-10`,file:`min-h-6 font-mono text-meta touch:min-h-10`,"file-narrow":`min-h-9 font-mono text-meta`,pane:`min-h-5.5 touch:min-h-10`},di=`bg-hover cursor-grabbing scale-[1.02] motion-reduce:scale-none`,fi=`before:absolute before:top-1/2 before:h-3 before:w-0.5 before:-translate-y-1/2 before:rounded-full before:bg-subtle before:opacity-0 before:transition-opacity before:duration-150 before:content-[''] hover:before:opacity-70 touch:before:hidden`;function pi(e){let t=e.stack?`flex-col items-stretch gap-0.5 px-2.5 py-1.5`:`items-center gap-2 px-2 py-0.75`,n=e.lifted?di:e.moving?`bg-accent-soft`:e.selected?`bg-menu`:`hover:bg-hover data-menu-open:bg-hover`;return`relative flex w-full rounded-sm text-left ${e.lifted?``:`active:scale-97 motion-reduce:active:scale-none`} ${e.grab&&!e.lifted?`cursor-grab before:left-0.5 ${fi}`:``} ${t} ${ui[e.size??`row`]} ${n}`}var mi=`row-title min-w-0 flex-1 truncate`,hi=`row-title min-w-0 flex-auto truncate text-(length:--fs-title)`,gi=`running-shimmer:bg-[linear-gradient(90deg,var(--ink)_0%,var(--ink)_35%,var(--accent)_50%,var(--ink)_65%,var(--ink)_100%)] running-shimmer:bg-size-[300%_100%] running-shimmer:bg-clip-text running-shimmer:text-transparent running-shimmer:animate-shimmer`,_i=`w-[1ch] flex-none text-center font-mono`,vi=`grid w-[2ch] flex-none place-items-center font-mono text-subtle`,yi=`flex flex-none gap-1.5 font-mono text-meta`;function W(e){return e instanceof Error?e.message:String(e)}function bi(e){B();let t=(0,h.useRef)(null);return(0,h.useEffect)(()=>{t.current&&!t.current.contains(document.activeElement)&&t.current.focus();let e=e=>{e.key===`Escape`&&(e.preventDefault(),R())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,V.jsx)(`div`,{className:zr,onMouseDown:e=>e.target===e.currentTarget&&R(),children:(0,V.jsxs)(`dialog`,{ref:t,tabIndex:-1,open:!0,className:Br(e.wide),"aria-label":e.title,children:[(0,V.jsxs)(`div`,{className:Vr,children:[(0,V.jsx)(`h1`,{className:Hr,children:e.title}),(0,V.jsx)(`button`,{type:`button`,className:Ur,"aria-label":z(`dialog.close`),title:z(`dialog.close`),onClick:R,children:`×`})]}),e.children]})})}function xi(){let[e,t]=(0,h.useState)(!1),[n,r]=(0,h.useState)(null);return{busy:e,error:n,setError:r,submit:async e=>{t(!0),r(null);try{await e(),R()}catch(e){r(W(e))}finally{t(!1)}}}}function Si(e){let[t,n]=(0,h.useState)(e.initial??``),{busy:r,error:i,submit:a}=xi();return(0,V.jsx)(bi,{title:e.title,children:(0,V.jsxs)(`form`,{className:Wr,onSubmit:n=>{n.preventDefault(),(t.trim()||e.allowEmpty)&&a(()=>e.onSubmit(t.trim()))},children:[e.multiline?(0,V.jsx)(`textarea`,{className:`${jr} ${Fr}`,"aria-label":e.title,autoFocus:!0,rows:4,value:t,onChange:e=>n(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},onFocus:e=>e.currentTarget.setSelectionRange(t.length,t.length)}):(0,V.jsx)(`input`,{className:jr,"aria-label":e.title,autoFocus:!0,spellCheck:!1,value:t,onChange:e=>n(e.target.value),onFocus:e=>e.currentTarget.select()}),i&&(0,V.jsx)(`p`,{className:`text-error`,children:i}),(0,V.jsx)(Ti,{busy:r,submitLabel:e.submitLabel})]})})}function Ci(e){let{busy:t,error:n,setError:r,submit:i}=xi(),[a,o]=(0,h.useState)(!1),[s,c]=(0,h.useState)(null),[l,u]=(0,h.useState)(!1),d=(0,h.useRef)(null);(0,h.useEffect)(()=>d.current?.focus(),[]);let f=t=>void i(async()=>{try{a&&e.escalate?await e.escalate.run(l):await(t&&e.secondary?e.secondary.onConfirm():e.onConfirm())}catch(n){throw!a&&e.escalate?.when(n)&&(o(!0),c(n),u(t),r(W(n))),n}});return(0,V.jsx)(bi,{title:a&&e.escalate?.title||e.title,children:(0,V.jsxs)(`div`,{className:Wr,children:[(0,V.jsx)(`p`,{className:`whitespace-pre-line text-muted`,children:a&&e.escalate?.body?e.escalate.body(s):e.body}),n&&!(a&&e.escalate?.body)&&(0,V.jsx)(`p`,{className:`text-error`,children:n}),(0,V.jsxs)(`div`,{className:Mr,children:[(0,V.jsx)(`button`,{type:`button`,className:kr,onClick:R,children:z(`dialog.cancel`)}),e.secondary&&!a&&(0,V.jsx)(`button`,{type:`button`,className:br({danger:!0}),disabled:t,onClick:()=>f(!0),children:e.secondary.label}),(0,V.jsx)(`button`,{ref:d,type:`button`,className:br({danger:!0}),disabled:t,onClick:()=>f(!1),children:a&&e.escalate?e.escalate.label:e.confirmLabel})]})]})})}function wi(e){let t=Math.max(0,e.choices.findIndex(t=>t.value===e.current)),[n,r]=(0,h.useState)(t),{busy:i,error:a,submit:o}=xi(),s=t=>void o(()=>e.onPick(t));return(0,h.useEffect)(()=>{let t=t=>{if(t.key===`ArrowDown`||t.key===`j`)r(t=>Math.min(e.choices.length-1,t+1));else if(t.key===`ArrowUp`||t.key===`k`)r(e=>Math.max(0,e-1));else if(t.key===`Enter`){let t=e.choices[n];t&&s(t.value)}else return;t.preventDefault()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)}),(0,V.jsx)(bi,{title:e.title,children:(0,V.jsxs)(`div`,{className:Wr,children:[(0,V.jsx)(`ul`,{className:Rr,children:e.choices.map((t,a)=>(0,V.jsx)(`li`,{children:(0,V.jsxs)(`button`,{type:`button`,"aria-pressed":t.value===e.current,disabled:i,className:pi({selected:a===n}),onMouseEnter:()=>r(a),onClick:()=>s(t.value),children:[(0,V.jsx)(`span`,{className:`${_i} text-accent`,children:t.value===e.current?`●`:` `}),(0,V.jsx)(`span`,{className:mi,children:t.label})]})},t.value))}),a&&(0,V.jsx)(`p`,{className:`text-error`,children:a})]})})}function Ti({busy:e,submitLabel:t}){return(0,V.jsxs)(`div`,{className:Mr,children:[(0,V.jsx)(`button`,{type:`button`,className:kr,onClick:R,children:z(`dialog.cancel`)}),(0,V.jsx)(`button`,{type:`submit`,className:br(),disabled:e,children:t})]})}function Ei(e,t){let n=window.setInterval(()=>{(typeof document>`u`||document.visibilityState===`visible`)&&t()},e),r=()=>{document.visibilityState===`visible`&&t()};return document.addEventListener(`visibilitychange`,r),()=>{window.clearInterval(n),document.removeEventListener(`visibilitychange`,r)}}var Di={cancel:`Cancel`,failureHint:"Run `{command}` for diagnosis and next steps.",toastFailureHint:`Next: run rove doctor`,loading:`Loading…`,create:`create`,confirm:`Confirm`,paneCrash:{title:`This pane crashed`,hint:`The error was logged to client.log. Retry, or restart Rove if it keeps happening.`,regionTitle:`The {region} hit an error`,regionHint:"The rest of Rove keeps working. Retry below; if it persists, inspect client.log and run `rove doctor`.",retry:`[ retry ]`,region:{sidebar:`task list`,workspace:`workspace`,files:`file tree`,page:`page`}},rename:{defaultTitle:`Rename task`,defaultFieldLabel:`TITLE`,footerHint:`enter {submitLabel} · esc cancel`,defaultSubmitLabel:`rename`},prompt:{fieldLabel:`input`,submitLabel:`submit`}},Oi={cancel:`取消`,failureHint:"运行 `{command}` 查看诊断和后续步骤。",toastFailureHint:`下一步:运行 rove doctor`,loading:`加载中…`,create:`创建`,confirm:`确认`,paneCrash:{title:`此面板已崩溃`,hint:`错误已记录到 client.log。可重试;若反复出现请重启 Rove。`,regionTitle:`{region}出错了`,regionHint:"Rove 的其余部分仍可正常使用。请在下方重试;若问题持续,请查看 client.log 并运行 `rove doctor`。",retry:`[ 重试 ]`,region:{sidebar:`任务列表`,workspace:`工作区`,files:`文件树`,page:`页面`}},rename:{defaultTitle:`重命名任务`,defaultFieldLabel:`名称`,footerHint:`enter {submitLabel} · esc 取消`,defaultSubmitLabel:`重命名`},prompt:{fieldLabel:`输入`,submitLabel:`提交`}},ki={fix:{hint:"{count} finding(s) above have a known fix — run `{command}` to review them one by one",none:`fix: nothing to fix — no known remediation applies to this report`,header:`fixes — each one asks before running:`,willRun:`will run: {command}`,confirmPrompt:`apply this fix? [y/N] `,done:`✓ done`,failed:`✗ exited with code {code}; inspect the command output above, then rerun rove doctor`,skipped:`· skipped`,nonInteractive:`no interactive terminal — nothing was executed; run the commands above yourself`,manualHeader:`manual steps — doctor prints these but never runs them:`,daemonRestartWhy:`safe to run: engine sessions live in the separate PTY host and survive a daemon restart`,daemonStale:`restart the daemon — it is running an older build than this CLI`,daemonDown:`start the daemon — it is not running`,hooksDown:`restart the daemon to re-establish the engine hook channel`,inspectStale:`restart the daemon — it predates the hook-channel check`,skillInstallWhy:`safe to run: installs skill files only; re-running is idempotent`,skillMissing:`install the Rove agent skill`,skillStale:`update the Rove agent skill to the version this build expects`,spawnHelper:`restore the exec bit on node-pty's spawn-helper — every node-pty PTY spawn fails without it`,spawnHelperWhy:"safe to run: chmod on two prebuilt binaries; idempotent, and `bun install` does the same",resetWhy:`stops the daemon, the PTY host, and every live session — not undoable, so doctor only prints it`,resetDaemonWedged:`the daemon process is alive but unreachable (wedged)`,resetPty:`the PTY host process is alive but its socket is unreachable (wedged)`,resetPtyStale:`the PTY host is still running an older build than the one you launched`,resetLegacy:`pre-v0.8 tmux sessions are still holding processes and memory`,orphans:`{count} process(es) outlived the PTY session that spawned them and are still running`,orphansWhy:`kills processes, which is not undoable — and a task you backgrounded on purpose looks the same; read the list, then run it yourself`,engineTabs:`engine tabs may hold a stale daemon socket path`,engineTabsAction:`close and reopen the affected engine tabs in the TUI`,engineTabsWhy:`kills that tab's live engine session — your call, not doctor's`,staleInstall:`the install this Rove runs from no longer exists on disk`,staleInstallAction:`npm install -g @sma1lboy/rove, then relaunch Rove`,staleInstallWhy:`doctor cannot reinstall Rove over the running process — a human has to, then relaunch`,humanOnlyWhy:`doctor does not install software or log in to accounts for you`,git:`git is not on PATH`,gitAction:`install git with your OS package manager`,noEngine:`no usable engine — no engine CLI is both installed and logged in`,noEngineAction:`install an engine CLI (claude, codex, copilot, or kimi) and log in`,noEngineLogin:`no usable engine — an engine CLI is installed but not signed in`,noEngineLoginAction:`run one of the installed engine CLIs ({list}) in a shell and complete its login`,windowsNode:`Node.js is missing — the Windows PTY host cannot start`,windowsNodeAction:`install Node.js from https://nodejs.org`,staleBun:`the Bun running Rove is older than this build supports — terminals will not paint`,staleBunAction:"upgrade Bun (`bun upgrade`, `brew upgrade bun`, or `npm install -g bun@latest`), then relaunch Rove"}},Ai={fix:{hint:"上面有 {count} 项发现存在已知修法 — 运行 `{command}` 逐条查看",none:`fix: 无可修项 — 本次报告没有匹配到已知修法`,header:`修复项 — 每一条都会先询问再执行:`,willRun:`将执行: {command}`,confirmPrompt:`执行这条修复吗? [y/N] `,done:`✓ 完成`,failed:`✗ 退出码 {code};请检查上方命令输出,再运行 rove doctor`,skipped:`· 已跳过`,nonInteractive:`没有交互终端 — 未执行任何命令; 请自行运行上面的命令`,manualHeader:`人工步骤 — doctor 只打印, 永远不会替你执行:`,daemonRestartWhy:`可安全执行: 引擎会话在独立的 PTY host 里, daemon 重启后仍然存活`,daemonStale:`重启 daemon — 它运行的构建比当前 CLI 旧`,daemonDown:`启动 daemon — 它当前没有在运行`,hooksDown:`重启 daemon 以重建引擎 hook 通道`,inspectStale:`重启 daemon — 它的版本早于 hook 通道检查`,skillInstallWhy:`可安全执行: 只写入 skill 文件; 重复运行是幂等的`,skillMissing:`安装 Rove agent skill`,skillStale:`把 Rove agent skill 更新到当前构建期望的版本`,spawnHelper:`恢复 node-pty spawn-helper 的可执行位 — 缺了它 node-pty 的每次 PTY 启动都会失败`,spawnHelperWhy:"可安全执行: 只对两个预编译二进制做 chmod; 幂等, `bun install` 也会做同样的事",resetWhy:`会停掉 daemon、PTY host 和所有活动会话 — 不可撤销, 所以 doctor 只打印`,resetDaemonWedged:`daemon 进程存活但无法连接 (卡死)`,resetPty:`PTY host 进程存活但 socket 无法连接 (卡死)`,resetPtyStale:`PTY host 仍在跑比你启动的版本更旧的构建`,resetLegacy:`v0.8 之前的 tmux 会话仍占用进程和内存`,orphans:`有 {count} 个进程比启动它们的 PTY 会话活得更久, 现在还在运行`,orphansWhy:`会杀进程, 不可撤销 — 而且你故意放后台的任务看起来一模一样; 先看清单, 再自己执行`,engineTabs:`引擎 tab 可能持有过期的 daemon socket 路径`,engineTabsAction:`在 TUI 里关闭并重开受影响的引擎 tab`,engineTabsWhy:`会杀掉该 tab 的活动引擎会话 — 由你决定, doctor 不代劳`,staleInstall:`当前 Rove 所在的安装已从磁盘删除`,staleInstallAction:`npm install -g @sma1lboy/rove, 然后重新启动 Rove`,staleInstallWhy:`doctor 无法在运行中的进程上重装 Rove — 需要人工重装后重新启动`,humanOnlyWhy:`doctor 不会替你安装软件或登录账号`,git:`PATH 上找不到 git`,gitAction:`用你的系统包管理器安装 git`,noEngine:`没有可用引擎 — 没有任何引擎 CLI 同时满足已安装且已登录`,noEngineAction:`安装任一引擎 CLI(claude、codex、copilot 或 kimi)并登录`,noEngineLogin:`没有可用引擎 — 引擎 CLI 已安装, 但没有登录`,noEngineLoginAction:`在 shell 里运行已安装的引擎 CLI({list})之一并完成登录`,windowsNode:`缺少 Node.js — Windows PTY host 无法启动`,windowsNodeAction:`从 https://nodejs.org 安装 Node.js`,staleBun:`运行 Rove 的 Bun 版本低于本构建的要求 — 终端不会有任何输出`,staleBunAction:"升级 Bun (`bun upgrade` / `brew upgrade bun` / `npm install -g bun@latest`), 然后重新启动 Rove"}},ji={mentionNoEngine:`No engine session in this task — nothing to mention into. Open one with ctrl+t.`,tabs:{all:`All`,changes:`Changes`},actions:{zen:`Zen`,createPR:`Ask agent to create PR`,diffAll:`[D] diff everything`},legend:{changes:`M modified · A added · D deleted · ? untracked`},scope:{working:`scope: working tree`,branch:`scope: vs {base}`,toggleHint:`b to toggle`,noBase:`no base ref for branch scope (no origin/HEAD, main or master)`},empty:{noTask:`(no task — press n to create)`,noFiles:`(empty worktree)`,noChanges:`(no changes — clean worktree)`},error:{retryHint:`press r to retry`,notGitRepo:"not a git repository — run `git init` here, or open a task in a repo",pathMissing:`the worktree directory is gone — reopen the task to re-create it`,permissionDenied:`permission denied reading the worktree — check the directory's owner and mode`,gitNotInstalled:`git is not on PATH — install it with your OS package manager`,gitFailed:"git command failed; run `git status` in this worktree to diagnose"},toast:{prOnTargetBranch:`Already on the target branch ({branch}) — ask the agent to create the PR from a task branch`,noPausedOperation:`Nothing to resolve — no merge, rebase or cherry-pick is paused here`,conflictReadFailed:`Git could not read the conflicted files. Run git status in this worktree, then retry.`,conflictSendFailed:`Could not send the conflict prompt. Open an engine tab in this task, then retry.`,ciNoFailingChecks:`No failing check logs to read — the run may have expired, or the checks are no longer red`,ciChecksUnavailable:"gh could not read this PR's checks: {detail}. Run `gh auth status`, then retry."}},Mi={mentionNoEngine:`这个任务没有引擎会话——没有地方可以提及。用 ctrl+t 开一个。`,tabs:{all:`全部`,changes:`改动`},actions:{zen:`专注模式`,createPR:`让 agent 创建 PR`,diffAll:`[D] 查看全部改动`},legend:{changes:`M 已修改 · A 已添加 · D 已删除 · ? 未跟踪`},scope:{working:`范围:工作区改动`,branch:`范围:对比 {base}`,toggleHint:`按 b 切换`,noBase:`分支范围没有基准 ref(没有 origin/HEAD、main 或 master)`},empty:{noTask:`(暂无任务 — 按 n 创建)`,noFiles:`(worktree 为空)`,noChanges:`(无改动 — worktree 干净)`},error:{retryHint:`按 r 重试`,notGitRepo:"不是 git 仓库——在这里执行 `git init`,或改为打开仓库里的任务",pathMissing:`worktree 目录已不存在——重新打开该任务会重建它`,permissionDenied:`读取 worktree 时权限不足——请检查该目录的属主和权限`,gitNotInstalled:`PATH 上找不到 git——请用系统包管理器安装`,gitFailed:"git 命令失败;请在此 worktree 运行 `git status` 诊断"},toast:{prOnTargetBranch:`当前就在目标分支({branch})— 请在任务分支上让 agent 创建 PR`,noPausedOperation:`没有要解决的冲突——这里没有暂停中的合并、变基或拣选`,conflictReadFailed:`Git 无法读取冲突文件。请在此 worktree 运行 git status,然后重试。`,conflictSendFailed:`无法发送冲突提示。请在此任务中打开一个引擎标签页,然后重试。`,ciNoFailingChecks:`没有可读的失败检查日志——运行记录可能已过期,或检查已不再是红的`,ciChecksUnavailable:"gh 读不到这个 PR 的检查状态:{detail}。请运行 `gh auth status`,然后重试。"}},Ni={retryHint:`Correct the field above, then choose Create again.`,title:`New task`,legend:`{enter} · tab complete/fields · ctrl+[ ] mode · ctrl+e engine · esc cancel`,enterCreate:`enter create`,enterNext:`enter next field`,tabs:{existing:`For Existing`,clone:`For New Repo`,adopt:`Adopt Worktree`},field:{mode:`MODE`,tier:`DEPTH`,engine:`ENGINE`,effort:`EFFORT`,repo:`REPO`,fromBranch:`FROM BRANCH`,prompt:`FIRST MESSAGE`,extras:`ALSO INCLUDE`,gitUrl:`GIT URL`,parentDir:`PARENT DIR`,folderName:`FOLDER NAME`,baseBranch:`BASE BRANCH`,adoptFilter:`FILTER (PATH GLOB)`,opens:`OPENS`},intent:{task:`a new task worktree`,project:`the project itself`},placeholder:{folderName:`auto from url`,adoptFilter:`* — type e.g. feature-* to narrow`,prompt:`Describe a task or ask a question (optional)`},hint:{modeCycle:`ctrl+[ ]`,engineCycle:`ctrl+e`,remembered:`(remembered — next clone defaults to this dir)`,currentDir:`(current dir)`,noBranchesFound:`(no local branches found — typed text will be used as ref)`,noMatchBranch:`(no match — typed text will be used as ref)`,scanningWorktrees:`scanning worktrees…`,extrasNone:`(none — enter picks a repo; the first is the primary)`,extrasPicked:`{count} more repo(s) in this task`},picker:{moreAbove:`↑ {count} more`,moreBelow:`↓ {count} more`},scroll:{moreAbove:`↑ {count} more rows`,moreBelow:`↓ {count} more rows`},open:{failed:`Couldn't open the project: {error}`},adopt:{repoLine:`repo: {path}`,repoNone:`(none)`,noUnlinked:`no unlinked worktrees — every git worktree here is already a task`,noMatch:`no worktrees match the filter`,hintSelected:`{count} selected · enter toggles · ctrl+a all · Create imports`,hintDefault:`enter toggles · ctrl+a all · Create imports the highlighted row`,summaryAll:`Adopted {count} worktree(s)`,summaryPartial:`Adopted {done}/{total} worktrees — the rest failed (see log)`,summaryNone:`Couldn't adopt any worktree: {error}`},clone:{progressFallback:`Cloning…`,progressInto:`Cloning into {target}…`},button:{create:`Create`,cloning:`Cloning…`},error:{gitUrlRequired:`git URL is required`,gitUrlInvalid:`does not look like a git URL: {url}`,folderRequired:`folder name is required`,folderHasSeparator:`folder name cannot contain path separators`,parentRequired:`parent directory is required`,parentNotFound:`parent directory does not exist: {path}`,parentNotDir:`not a directory: {path}`,targetExists:`target already exists: {path}`,cloneFailed:`git clone failed: {error}`,noAdoptable:`no adoptable worktrees to import`,repoAmbiguous:`more than one saved repo is named {name} — pick the one you mean from the list`,tierUnavailable:`{tier} points at engine {engine}, which is not available here — retarget it in Settings → Auto routing`}},Pi={retryHint:`请修正上方字段,然后再次选择创建。`,title:`新建任务`,legend:`{enter} · tab 补全/切字段 · ctrl+[ ] 切模式 · ctrl+e 引擎 · esc 取消`,enterCreate:`enter 创建`,enterNext:`enter 下一个字段`,tabs:{existing:`已有仓库`,clone:`克隆新仓库`,adopt:`接管 Worktree`},field:{mode:`模式`,tier:`深度`,engine:`引擎`,effort:`推理强度`,repo:`仓库`,fromBranch:`基准分支`,prompt:`第一条消息`,extras:`同时包含`,gitUrl:`git 地址`,parentDir:`父目录`,folderName:`文件夹名`,baseBranch:`基准分支`,adoptFilter:`过滤(路径 glob)`,opens:`打开`},intent:{task:`新建任务 worktree`,project:`项目本身`},placeholder:{folderName:`自动从地址推导`,adoptFilter:`* — 输入如 feature-* 来缩小范围`,prompt:`描述一个任务,或提个问题(可选)`},hint:{modeCycle:`ctrl+[ ]`,engineCycle:`ctrl+e`,remembered:`(已记住 — 下次克隆默认使用此目录)`,currentDir:`(当前目录)`,noBranchesFound:`(未找到本地分支 — 将直接使用输入文本作为 ref)`,noMatchBranch:`(无匹配 — 将直接使用输入文本作为 ref)`,scanningWorktrees:`正在扫描 worktree…`,extrasNone:`(未选 — 回车选一个仓库,第一个是主仓库)`,extrasPicked:`任务里另含 {count} 个仓库`},picker:{moreAbove:`↑ 还有 {count} 项`,moreBelow:`↓ 还有 {count} 项`},scroll:{moreAbove:`↑ 上方还有 {count} 行`,moreBelow:`↓ 下方还有 {count} 行`},open:{failed:`无法打开项目:{error}`},adopt:{repoLine:`仓库:{path}`,repoNone:`(无)`,noUnlinked:`没有未关联的 worktree — 此仓库所有 git worktree 均已是任务`,noMatch:`没有 worktree 匹配此过滤条件`,hintSelected:`已选 {count} 项 · enter 切换选中 · ctrl+a 全选 · 创建 导入`,hintDefault:`enter 切换选中 · ctrl+a 全选 · 创建 将导入高亮行`,summaryAll:`已接管 {count} 个 worktree`,summaryPartial:`已接管 {done}/{total} 个 worktree — 其余失败(详见日志)`,summaryNone:`没有 worktree 接管成功:{error}`},clone:{progressFallback:`克隆中…`,progressInto:`正在克隆到 {target}…`},button:{create:`创建`,cloning:`克隆中…`},error:{gitUrlRequired:`git 地址不能为空`,gitUrlInvalid:`不像是有效的 git 地址:{url}`,folderRequired:`文件夹名不能为空`,folderHasSeparator:`文件夹名不能包含路径分隔符`,parentRequired:`父目录不能为空`,parentNotFound:`父目录不存在:{path}`,parentNotDir:`不是目录:{path}`,targetExists:`目标路径已存在:{path}`,cloneFailed:`git clone 失败:{error}`,noAdoptable:`没有可接管的 worktree`,repoAmbiguous:`有多个已保存仓库都叫 {name} — 请从列表中选择你要的那个`,tierUnavailable:`{tier} 指向的引擎 {engine} 在这台机器上不可用——去 设置 → 自动路由 重新指定`}},Fi={engineTitle:`Engine and account`,engineChecking:`Checking installed engines and accounts…`,engineReady:`✓ Ready to start a task`,engineMissing:`No usable engine yet`,engineUsable:`✓ {engine}: ready`,engineSignedOut:`! {engine}: installed, not signed in`,engineSetup:"Install an engine using docs.rove.run/rove/engines, then run its CLI and sign in. Run `rove doctor --fix` to check setup; Settings → Engines lists integrations.",engineContinue:`❯ Continue to optional setup`,engineLegend:`enter continue · esc skip optional setup`,quickStart:`Start a task with a prompt`,quickIntent:`Creates an isolated worktree and branch. Use {key} for the full task dialog.`,tabShared:`New conversations share this task’s files`,tabIsolated:`{key}: new task, isolated worktree`,title:`Welcome to Rove`,subtitle:`Managed tasks get isolated worktrees and branches. Directory and project tasks reuse existing files.`,completionsLabel:`Shell completions for {shell}`,completionsExplain:`Tab-completes rove subcommands. One line is added to your shell config.`,skillLabel:`Rove agent skill`,skillExplain:`Lets the coding agents on this machine drive Rove themselves: start tasks, read other sessions, message them.`,optionYes:`Install`,recommended:`recommended`,stepCounter:`{n} / {total}`,optionNo:`Not now`,queued:`Queued — installs when you quit Rove`,skillInstalled:`Installed for {engines}`,skillFailed:`Install failed: {reason}`,skillNoEngines:`No coding agent here takes the skill`,skipped:`Skipped`,installFailed:`! {item} failed: {reason}. Retry: {command} (or quit Rove again).`,legend:`↑↓ select · enter confirm · esc close`,keysTitle:`Keyboard basics`,keysBare:`Bare keys act in the focused pane — {nav} moves, {open} opens.`,keysOnePress:`A few one-press chords are Rove's own — {newTab} new tab, {focusNext} next pane.`,keysPrefix:`{prefix} opens the command map — hold it a beat and a guide appears.`,keysHelp:`{help} shows the full live reference anytime.`,keysNext:`Next: Settings → Engines lists every engine and installs its activity hooks.`,keysLegend:`enter finish`,appliedCompletions:`✓ completions hooked into {path} (takes effect in new shells)`,keptCompletions:`· {path} already has a completions block — left untouched`},Ii={engineTitle:`引擎与账户`,engineChecking:`正在检查引擎与账户…`,engineReady:`✓ 可以开始任务`,engineMissing:`还没有可用的引擎`,engineUsable:`✓ {engine}:可用`,engineSignedOut:`! {engine}:已安装,未登录`,engineSetup:"从 docs.rove.run/rove/engines 安装引擎,然后运行其 CLI 并登录。运行 `rove doctor --fix` 检查配置;设置 → 引擎 可查看集成。",engineContinue:`❯ 继续可选设置`,engineLegend:`enter 继续 · esc 跳过可选设置`,quickStart:`输入提示词开始任务`,quickIntent:`创建独立 worktree 和分支。按 {key} 打开完整任务对话框。`,tabShared:`新对话共享当前任务的文件`,tabIsolated:`{key}:新建任务,使用独立 worktree`,title:`欢迎使用 Rove`,subtitle:`托管任务使用独立的 worktree 和分支;目录与项目任务复用现有文件。`,completionsLabel:`{shell} 的 shell 补全`,completionsExplain:`让 rove 子命令支持 Tab 补全,会在你的 shell 配置里加一行。`,skillLabel:`Rove agent skill`,skillExplain:`让本机的编码 agent 自己操作 Rove:开任务、读其他会话、给它们发消息。`,optionYes:`安装`,recommended:`推荐`,stepCounter:`{n} / {total}`,optionNo:`跳过`,queued:`已排队 — 退出 Rove 后安装`,skillInstalled:`已为 {engines} 安装`,skillFailed:`安装失败:{reason}`,skillNoEngines:`这台机器上没有能装 skill 的编码 agent`,skipped:`已跳过`,installFailed:`! {item} 安装失败:{reason}。重试:{command}(或再次退出 Rove)。`,legend:`↑↓ 选择 · enter 确认 · esc 关闭`,keysTitle:`键盘基础`,keysBare:`裸键作用于当前聚焦面板 — {nav} 移动,{open} 打开。`,keysOnePress:`少量单次快捷键属于 Rove 自己 — {newTab} 新标签页,{focusNext} 切换面板。`,keysPrefix:`{prefix} 打开命令层 — 按住稍等会出现命令指南。`,keysHelp:`随时按 {help} 查看完整的实时键位表。`,keysNext:`接下来:设置 → 引擎 里列出每个引擎,并可在那里安装它们的活动钩子。`,keysLegend:`enter 完成`,appliedCompletions:`✓ 补全已写入 {path}(新开的 shell 生效)`,keptCompletions:`· {path} 里已有补全配置 — 未改动`},Li={title:`Quick task · {repoLabel}`,promptLabel:`PROMPT`,promptPlaceholder:`what should this task do?`,attemptsLabel:`ATTEMPTS`,engineLabel:`ENGINE`,branchLabel:`BRANCH`,legend:`enter create · tab fields · ctrl+e engine · ctrl+v attach · esc cancel`,startedRound:`Started {count} attempts`,roundPartial:`Started {ok}/{count} attempts — {failed} failed`},Ri={title:`快速任务 · {repoLabel}`,promptLabel:`提示词`,promptPlaceholder:`这个任务要做什么?`,attemptsLabel:`尝试次数`,engineLabel:`引擎`,branchLabel:`分支`,legend:`enter 创建 · tab 切换字段 · ctrl+e 引擎 · ctrl+v 附件 · esc 取消`,startedRound:`已启动 {count} 个尝试`,roundPartial:`已启动 {ok}/{count} 个尝试 —— {failed} 个失败`},zi={cancel:`cancel`,forgetProjectTitle:`Remove project "{title}"?`,forgetProjectBody:"Forgets it from the projects list and closes the sessions in its main checkout. The repo, its branches, worktrees, and any tasks under it stay on disk — re-add it with `rove add`.",forgetProjectConfirm:`remove`,deleteTitle:`Remove session "{title}"?`,deleteTitleDir:`Remove session "{title}"?`,deleteBodyDir:`Ends this session and closes all its tabs. Nothing on disk changes: the folder and its files stay.`,deleteBodyMain:`Ends this session and closes all its tabs. The project stays in your list and nothing on disk changes: the repo, its branches and worktrees stay.`,deleteBodyTask:`Ends this session, closes all its tabs and removes its worktree folder. The git branch stays.`,deleteBodyTaskBranch:`Ends this session, closes all its tabs and removes its worktree folder, and its git branch if it is merged. An unmerged branch stays.`,deleteConfirm:`remove`,childrenTitle:`"{title}" has {count} child tasks`,childrenBody:`Promote moves them up one level and keeps their worktrees and sessions. Remove with children removes them too.`,childrenPromote:`promote children`,childrenCascade:`remove with children`,childrenBodyMain:`Ends this session and closes its tabs; nothing on disk changes. Its child tasks keep running unless you delete them too.`,childrenKeepMain:`remove session`,childrenCascadeMain:`remove with children`,forceDeleteTitle:`"{title}" has uncommitted changes`,forceDeleteConfirm:`force remove`,legacyAdoptTitle:`Remove {count} sessions Rove added by itself?`,legacyAdoptBody:`An older Rove added a session whenever a worktree was created outside it. It no longer does. These look like leftovers:
|
|
17
17
|
{list}
|
|
18
18
|
|
|
19
19
|
An agent can list them, remove the ones you confirm, and take out any old Rove worktree hook still in your settings.`,legacyAdoptMore:`… and {count} more`,legacyAdoptClean:`ask an agent`,legacyAdoptLater:`not now`,legacyAdoptNever:`don't ask again`,legacyAdoptSessionTitle:`Remove leftover sessions`,legacyAdoptPrompt:`An older Rove version added sessions to the sidebar by itself whenever a git worktree was created outside Rove. These look like leftovers:
|
|
@@ -36,7 +36,7 @@ Then look for the hook that older version installed. Check my engine settings fi
|
|
|
36
36
|
`)})}async function rs(e){if(Zo||$o())return;Zo=!0;let{tasks:t}=await e.client.request(`worktree.legacyAdopted`,{}).catch(()=>({tasks:[]}));t.length!==0&&C.get()===null&&C.set((0,V.jsx)(is,{model:e,tasks:t}))}function is(e){let[t,n]=(0,h.useState)(!1),[r,i]=(0,h.useState)(null),a=async()=>{n(!0),i(null);try{let{taskId:t}=await e.model.client.request(`worktree.legacyCleanup`,{title:G(`tasks`,`confirm.legacyAdoptSessionTitle`),prompt:ns(e.tasks)});R(),e.model.selectWhenListed(t)}catch(e){i(G(`tasks`,`confirm.legacyAdoptFailed`,{message:Jo(e)}))}finally{n(!1)}};return(0,V.jsx)(bi,{title:G(`tasks`,`confirm.legacyAdoptTitle`,{count:e.tasks.length}),children:(0,V.jsxs)(`div`,{className:Wr,children:[(0,V.jsx)(`p`,{className:`text-muted whitespace-pre-wrap`,children:G(`tasks`,`confirm.legacyAdoptBody`,{list:ts(e.tasks)})}),r&&(0,V.jsx)(`p`,{className:`text-error`,children:r}),(0,V.jsxs)(`div`,{className:Mr,children:[(0,V.jsx)(H,{onClick:()=>{es(),R()},children:G(`tasks`,`confirm.legacyAdoptNever`)}),(0,V.jsx)(H,{onClick:R,children:G(`tasks`,`confirm.legacyAdoptLater`)}),(0,V.jsx)(H,{variant:`filled`,disabled:t,autoFocus:!0,onClick:()=>void a(),children:G(`tasks`,`confirm.legacyAdoptClean`)})]})]})})}function as(e,t){let n=t&&typeof t==`object`?t:{};if(e===200&&typeof n.token==`string`&&/^[A-Za-z0-9_-]{43}$/.test(n.token))return{kind:`ok`,token:n.token};if(e===429){if(n.locked===`global`)return{kind:`lockedHost`};let e=typeof n.retryAfterSeconds==`number`?n.retryAfterSeconds:900;return{kind:`locked`,minutes:Math.max(1,Math.ceil(e/60))}}return e===401?{kind:`wrong`}:{kind:`unreachable`}}async function os(e=Bo){try{let t=await e(`/login`,{headers:{Accept:`application/json`},cache:`no-store`});return!t.ok||!(t.headers.get(`content-type`)??``).includes(`application/json`)?!1:(await t.json()).password===!0}catch{return!1}}async function ss(e=Bo){try{let t=await e(`/auth`,{headers:{Accept:`application/json`},cache:`no-store`});return!t.ok||!(t.headers.get(`content-type`)??``).includes(`application/json`)?!1:(await t.json()).open===!0}catch{return!1}}async function cs(e,t=Bo){try{let n=await t(`/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({password:e}),credentials:`omit`}),r=as(n.status,await n.json().catch(()=>null));return r.kind===`ok`&&a(r.token),r}catch{return{kind:`unreachable`}}}async function ls(e=Bo){let t=i();o(),t&&await e(`/logout`,{method:`POST`,headers:{Authorization:`Bearer ${t}`}}).catch(()=>{})}function us(e){if(!e)return null;switch(e.kind){case`ok`:return null;case`wrong`:return z(`login.wrong`);case`locked`:return z(`login.locked`,{minutes:e.minutes});case`lockedHost`:return z(`login.lockedHost`);case`unreachable`:return z(`login.unreachable`)}}function ds(){B();let[e,t]=(0,h.useState)(``),[n,r]=(0,h.useState)(!1),[i,a]=(0,h.useState)(null),o=us(i);return(0,V.jsx)(`div`,{className:Gn,children:(0,V.jsxs)(`form`,{className:Kn,onSubmit:async i=>{if(i.preventDefault(),n||!e)return;r(!0);let o=await cs(e);if(o.kind===`ok`){window.location.reload();return}t(``),a(o),r(!1)},children:[(0,V.jsxs)(`span`,{className:Un,children:[(0,V.jsx)(`span`,{className:Wn,children:`[`}),` rove `,(0,V.jsx)(`span`,{className:Wn,children:`]`})]}),(0,V.jsx)(`h1`,{className:`${U} text-muted`,children:z(`login.title`)}),(0,V.jsx)(`p`,{className:`text-muted`,children:z(`login.body`)}),(0,V.jsx)(`input`,{className:jr,type:`password`,autoComplete:`current-password`,"aria-label":z(`login.field`),placeholder:z(`login.field`),autoFocus:!0,value:e,disabled:n,onChange:e=>{t(e.target.value),a(null)}}),o&&(0,V.jsx)(`p`,{className:`text-error`,role:`alert`,children:o}),(0,V.jsx)(`div`,{className:Mr,children:(0,V.jsx)(`button`,{type:`submit`,className:br(),disabled:n||!e,children:z(n?`login.checking`:`login.submit`)})})]})})}function fs(e){return(0,V.jsx)(`svg`,{className:`block size-2.5 flex-none transition-[rotate,opacity] duration-120 ease-[ease] motion-reduce:transition-none ${e.right?`-rotate-90 is-right`:``} ${e.className??``}`,viewBox:`0 0 10 10`,"aria-hidden":`true`,children:(0,V.jsx)(`path`,{d:`M2.5 3.75 5 6.25l2.5-2.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.3`,strokeLinecap:`round`,strokeLinejoin:`round`})})}var ps=120;function ms(e,t,n,r=e-t){return e+t+8<=n?e:Math.max(8,Math.min(r,n-t-8))}function hs(e){let{item:t}=e;return(0,V.jsxs)(`button`,{ref:e.rowRef,type:`button`,role:t.checked===void 0?`menuitem`:`menuitemradio`,"aria-checked":t.checked,"aria-haspopup":t.children?`menu`:void 0,"aria-expanded":t.children?!!e.open:void 0,className:Kr({selected:e.selected,open:e.open,danger:t.danger}),onMouseEnter:e.onEnter,onMouseLeave:e.onLeave,onClick:e.onPick,children:[(0,V.jsx)(`span`,{children:t.label}),t.children?(0,V.jsx)(fs,{right:!0,className:Yr(!!(e.selected||e.open))}):t.checked?(0,V.jsx)(`span`,{className:Xr,"aria-hidden":!0,children:`✓`}):t.key&&(0,V.jsx)(`span`,{className:Jr({selected:e.selected,danger:t.danger}),children:t.key})]})}function gs(){let e=y(S),[t,n]=(0,h.useState)(0),[r,i]=(0,h.useState)(null),[a,o]=(0,h.useState)(-1),[s,c]=(0,h.useState)(!1),l=(0,h.useRef)(null),u=(0,h.useRef)(null),d=(0,h.useRef)([]),f=(0,h.useRef)(void 0),[p,m]=(0,h.useState)({x:0,y:0}),[g,_]=(0,h.useState)({x:0,y:0});if((0,h.useLayoutEffect)(()=>{if(!e||!l.current)return;n(e.start??(e.fromKeyboard?0:-1)),i(null),c(!1);let{width:t,height:r}=l.current.getBoundingClientRect(),a=e.right===void 0?e.x:Math.max(e.right-l.current.offsetWidth,0);m({x:ms(a,t,window.innerWidth),y:ms(e.y,r,window.innerHeight)});let o=e.target;return o?.setAttribute(`data-menu-open`,``),()=>o?.removeAttribute(`data-menu-open`)},[e]),(0,h.useLayoutEffect)(()=>{let e=r===null?null:d.current[r];if(!e||!l.current||!u.current)return;let t=l.current.getBoundingClientRect(),n=e.getBoundingClientRect(),{width:i,height:a}=u.current.getBoundingClientRect();_({x:ms(t.right+2,i,window.innerWidth,t.left-i-2),y:ms(n.top-5,a,window.innerHeight,n.bottom+5-a)})},[r]),(0,h.useEffect)(()=>()=>window.clearTimeout(f.current),[]),(0,h.useEffect)(()=>{if(!e)return;let d=e.items,f=r===null?[]:d[r]?.children??[],p=()=>S.set(null),m=e=>{e?.run&&(p(),e.run())},h=(e,t,n)=>e(e=>n===1?e>=t?0:e+1:e<=0?t:e-1),g=e=>{let l=e.key;if(s&&r!==null){let t=f.length-1;if(l===`Escape`||l===`ArrowLeft`||l===`h`)i(null),c(!1);else if(l===`ArrowDown`||l===`j`)h(o,t,1);else if(l===`ArrowUp`||l===`k`)h(o,t,-1);else if(l===`Home`)o(0);else if(l===`End`)o(t);else if(l===`Enter`)m(f[a]);else return;e.preventDefault(),e.stopPropagation();return}let u=d.length-1,g=d[t],_=()=>{i(t),c(!0),o(0)};if(l===`Escape`)p();else if(l===`ArrowDown`||l===`j`)h(n,u,1);else if(l===`ArrowUp`||l===`k`)h(n,u,-1);else if(l===`Home`)n(0);else if(l===`End`)n(u);else if((l===`ArrowRight`||l===`l`)&&g?.children)_();else if(l===`Enter`)g?.children?_():m(g);else return;e.preventDefault(),e.stopPropagation()},_=e=>{e.target instanceof Node&&(l.current?.contains(e.target)||u.current?.contains(e.target))||p()};return window.addEventListener(`keydown`,g,!0),window.addEventListener(`mousedown`,_),()=>{window.removeEventListener(`keydown`,g,!0),window.removeEventListener(`mousedown`,_)}},[e,t,r,a,s]),!e)return null;let v=r===null?null:e.items[r]?.children,b=e=>{e.run&&(S.set(null),e.run())},x=e=>{window.clearTimeout(f.current),i(e),c(!1),o(-1)};return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{ref:l,className:Gr(),role:`menu`,style:{left:p.x,top:p.y,minWidth:e.minWidth},children:e.items.map((a,o)=>(0,V.jsxs)(h.Fragment,{children:[o>0&&a.section!==e.items[o-1]?.section&&(0,V.jsx)(`hr`,{className:`-mx-1 my-1 h-px flex-none border-none bg-line`}),(0,V.jsx)(hs,{item:a,rowRef:e=>{d.current[o]=e},selected:o===t,open:o===r,onEnter:()=>{n(o),window.clearTimeout(f.current),a.children?f.current=window.setTimeout(()=>x(o),ps):i(null)},onLeave:()=>{window.clearTimeout(f.current),o!==r&&n(-1)},onPick:()=>a.children?x(o):b(a)})]},a.label))}),v&&(0,V.jsx)(`div`,{ref:u,className:Gr(!0),role:`menu`,style:{left:g.x,top:g.y},children:v.map((e,t)=>(0,V.jsx)(hs,{item:e,selected:t===a,onEnter:()=>{o(t),c(!0)},onLeave:()=>o(-1),onPick:()=>b(e)},e.label))})]})}function _s(){let e=y(C),t=y(T);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(gs,{}),e,(0,V.jsx)(`div`,{className:Zr,"aria-live":`polite`,children:t.map(e=>{let t=`${$r(e.tone===`error`)} ${e.leaving?`is-leaving`:``}`,n=e.action;return n?(0,V.jsxs)(`div`,{className:`${t} ${Qr}`,children:[(0,V.jsx)(`span`,{children:e.text}),(0,V.jsx)(H,{onClick:()=>{oe(e.id),n.run()},children:`[ ${n.label} ]`})]},e.id):(0,V.jsx)(`button`,{type:`button`,className:t,onClick:()=>oe(e.id),children:e.text},e.id)})})]})}function vs(e){return e.urls[e.at]??``}function ys(e){try{return new URL(e).host.replace(/^www\./,``)}catch{return e}}function bs(){return{kind:`browser`,tabs:[{id:`t1`,urls:[],at:-1}],active:`t1`,recent:[`t1`],next:2}}function xs(e,t){return!e.tabs.some(e=>e.id===t)||e.active===t&&e.recent.at(-1)===t?e:{...e,active:t,recent:[...e.recent.filter(e=>e!==t),t]}}function Ss(e){let t=e;for(;t.tabs.length>12;){let e=t.tabs.filter(e=>e.id!==t.active).sort((e,n)=>t.recent.indexOf(e.id)-t.recent.indexOf(n.id))[0];if(!e)break;t=ks(t,e.id)??t}return t}function Cs(e,t){let n=`t${e.next}`,r={id:n,urls:t,at:t.length-1};return Ss(xs({...e,tabs:[...e.tabs,r],next:e.next+1},n))}function ws(e){return Cs(e,[])}function Ts(e,t){return{...e,tabs:e.tabs.map(e=>e.id===t.id?t:e)}}function Es(e,t,n){let r=e.tabs.find(e=>e.id===t);if(!r||vs(r)===n)return e;let i=[...r.urls.slice(0,r.at+1),n].slice(-30);return Ts(e,{...r,urls:i,at:i.length-1})}function Ds(e,t,n){let r=e.tabs.find(e=>e.id===t);return!r||n===r.at||n<0||n>=r.urls.length?e:Ts(e,{...r,at:n})}function Os(e,t){let n=e.tabs.find(e=>vs(e)===t);if(n)return xs(e,n.id);let r=e.tabs.find(e=>vs(e)===``);return r?Es(xs(e,r.id),r.id,t):Cs(e,[t])}function ks(e,t){let n=e.tabs.filter(e=>e.id!==t);if(n.length===0)return null;let r=e.recent.filter(e=>e!==t);if(e.active!==t)return{...e,tabs:n,recent:r};let i=[...r].reverse().find(e=>n.some(t=>t.id===e))??n[0].id;return{...e,tabs:n,active:i,recent:[...r.filter(e=>e!==i),i]}}function As(e,t){return e.tabs.some(e=>e.id===t)?ks(e,t):e}function js(e,t){let n=e.tabs.find(e=>e.id===t);return n?{...e,tabs:[n],active:t,recent:[t]}:e}function Ms(e,t,n){let r=new Set(n.map(e=>e.id)),i=[...e.filter(e=>r.has(e)&&e!==t),...r.has(t)?[t]:[]];return i.slice(Math.max(0,i.length-3))}function Ns(e,t,n,r){if(!Array.isArray(e))return null;let i=[];for(let t of e){if(!t||typeof t!=`object`)continue;let e=t;if(typeof e.id!=`string`||!/^t\d+$/.test(e.id)||i.some(t=>t.id===e.id))continue;let n=Array.isArray(e.urls)?e.urls.filter(e=>typeof e==`string`&&e!==``).slice(-30):[],r=typeof e.at==`number`&&Number.isInteger(e.at)?e.at:n.length-1;i.push({id:e.id,urls:n,at:n.length===0?-1:Math.min(n.length-1,Math.max(0,r))})}let a=i[0];if(!a)return null;let o=new Set(i.map(e=>e.id)),s=Array.isArray(n)?n.filter(e=>typeof e==`string`&&o.has(e)):[],c=typeof t==`string`&&o.has(t)?t:s.at(-1)??a.id,l=Math.max(...i.map(e=>Number(e.id.slice(1))));return{kind:`browser`,tabs:i,active:c,recent:[...s.filter(e=>e!==c),c],next:Math.max(l+1,typeof r==`number`&&Number.isInteger(r)?r:0)}}var Ps=[`quota`,`files`,`file`,`diff`,`chat`,`browser`],Fs=1e3;function Is(){return{columns:[{kind:`files`}],weights:{}}}function Ls(e,t){return e.columns.find(e=>e.kind===t)}function Rs(e){return e.slice(e.lastIndexOf(`/`)+1)}function zs(e,t){return{...e,columns:e.columns.map(e=>e.kind===t.kind?t:e)}}function Bs(e){return[...e].sort((e,t)=>Ps.indexOf(e.kind)-Ps.indexOf(t.kind))}function Vs(e,t){return{...e,columns:Bs([...e.columns,t])}}function Hs(e,t){return Ls(e,t)||t===`file`?e:Vs(e,t===`diff`?{kind:t,path:`.`,scope:`working`}:t===`browser`?bs():{kind:t})}function Us(e,t,n){let r=n===void 0?{kind:`file`,path:t}:{kind:`file`,path:t,at:n},i=Ls(e,`file`);return i?i.kind===`file`&&i.path===t&&(n===void 0||i.at===n)?e:zs(e,r):Vs(e,r)}function Ws(e,t,n,r){let i=r===void 0?{kind:`diff`,path:t,scope:n}:{kind:`diff`,path:t,scope:n,at:r},a=Ls(e,`diff`);return a?a.kind===`diff`&&a.path===t&&a.scope===n&&(r===void 0||a.at===r)?e:zs(e,i):Vs(e,i)}function Gs(e,t){let n=Ls(e,`browser`);return n?.kind===`browser`?zs(e,Os(n,t)):Vs(e,Os(bs(),t))}function Ks(e,t){if(!Ls(e,t))return e;let{[t]:n,...r}=e.weights;return{columns:e.columns.filter(e=>e.kind!==t),weights:r}}function qs(e,t){let n=Ls(e,`browser`);if(n?.kind!==`browser`)return e;let r=t(n);return r===n?e:r?zs(e,r):Ks(e,`browser`)}function Js(e,t,n,r=!1){if(t&&Ls(e,n)){let t=Ks(e,n);return{panel:t,open:t.columns.length>0}}if(r){let t=e.columns.filter(e=>e.kind===n);return{panel:Hs({...e,columns:t},n),open:!0}}return{panel:Hs(e,n),open:!0}}function Ys(e){let t=e.columns.flatMap(t=>{let n=e.weights[t.kind];return n!==void 0&&n>0?[n]:[]}),n=t.length>0?t.reduce((e,t)=>e+t,0)/t.length:1,r=e.columns.map(t=>e.weights[t.kind]||n),i=r.reduce((e,t)=>e+t,0);return r.map(e=>e/i*Fs)}function Xs(e,t){let n=t.reduce((e,t)=>e+t,0);if(t.length!==e.columns.length||!(n>0))return e;let r=Object.fromEntries(e.columns.map((e,r)=>[e.kind,Math.round(t[r]/n*1e3)/1e3]));return e.columns.every(t=>Math.abs((e.weights[t.kind]??0)-(r[t.kind]??0))<.001)?e:{...e,weights:r}}function Zs(e){return Object.keys(e.weights).length===0?e:{...e,weights:{}}}function Qs(e,t,n,r){let i=e[t],a=e[t+1];if(i===void 0||a===void 0)return[...e];let o=i+a,s=Math.min(r,o/2),c=Math.max(s,Math.min(o-s,i+n));return e.map((e,n)=>n===t?c:n===t+1?o-c:e)}var $s=Ps.filter(e=>e!==`chat`&&e!==`file`),ec=v(`terminal`),tc=`rove.web.panelWidth`,nc=`rove.web.panelOpen`,rc=v((()=>{let e=Number(localStorage.getItem(tc));return Number.isFinite(e)&&e>0?e:null})());rc.subscribe(()=>{let e=rc.get();e===null?localStorage.removeItem(tc):localStorage.setItem(tc,String(Math.round(e)))}),rc.subscribe(le);var ic=v(localStorage.getItem(nc)===`1`);ic.subscribe(()=>localStorage.setItem(nc,ic.get()?`1`:`0`));var ac=v(!1);ic.subscribe(()=>{ic.get()||ac.set(!1)});function oc(e,t,n=window.innerWidth){let r=Math.max(280,n-t-320);return Math.max(280,Math.min(r,Math.round(e)))}function sc(e,t,n=window.innerWidth){return e<2?null:oc(Math.max(300,Math.min(440,n*.28))*e,t,n)}var cc=[`files`,`diff`,`browser`];function lc(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.taskId==`string`&&t.taskId!==``&&cc.includes(t.view)&&typeof t.at==`number`&&(t.url===void 0||typeof t.url==`string`)&&(t.path===void 0||typeof t.path==`string`)}function uc(e){return e.narrow?{panel:!1,panelOpen:!1,narrow:!0}:{panel:!0,panelOpen:e.panelOpen&&!e.zen,narrow:!1}}function dc(e,t){return{tab:e.path?e.view===`files`?`file`:`diff`:e.view,...e.view===`browser`&&e.url?{url:e.url}:{},...e.view!==`browser`&&e.path?{path:e.path}:{},show:t.taskId===e.taskId&&!t.narrow}}function fc(e,t,n){return t.url?Gs(e,t.url):t.path?t.tab===`file`?Us(e,t.path,n):Ws(e,t.path,`working`,n):Hs(e,t.tab)}var pc=[`files`,`chat`,`diff`,`browser`,`quota`],mc=e=>e===`branch`||e===`task`?e:`working`;function hc(e){if(!e||typeof e!=`object`)return null;let t=e;return t.kind===`files`||t.kind===`chat`||t.kind===`quota`?{kind:t.kind}:t.kind===`file`&&typeof t.path==`string`&&t.path!==``&&t.path!==`.`?{kind:`file`,path:t.path}:t.kind===`diff`&&typeof t.path==`string`&&t.path!==``?{kind:`diff`,path:t.path,scope:mc(t.scope)}:t.kind===`browser`?Ns(t.tabs,t.active,t.recent,t.next):null}function gc(e,t){if(!e||typeof e!=`object`)return{};let n=e,r=t.flatMap(({kind:e})=>{let t=n[e];return typeof t==`number`&&Number.isFinite(t)&&t>0?[[e,t]]:[]});return Object.fromEntries(r)}function _c(e){let t=[e.top,e.bottom].map(e=>e&&typeof e==`object`&&`tabs`in e&&Array.isArray(e.tabs)?e.tabs:null);return t[0]?{tabs:t.flatMap(e=>e??[]).filter(e=>!!e&&typeof e==`object`&&/^t\d+$/.test(String(e.id))),recent:Array.isArray(e.recent)?e.recent.filter(e=>typeof e==`string`):[]}:null}function vc(e){let t=_c(e);if(!t)return null;let n=[...new Set(t.tabs.map(e=>e.kind))],r=[];for(let i of n){if((i===`files`||i===`chat`||i===`quota`)&&r.push({kind:i}),i===`diff`){let e=t.tabs.filter(e=>e.kind===`diff`&&typeof e.path==`string`&&e.path!==``),n=[...t.recent].reverse().map(t=>e.find(e=>e.id===t)).find(e=>e)??e[0];n&&r.push({kind:`diff`,path:n.path,scope:mc(n.scope)})}if(i===`browser`){let n=Ns(t.tabs.filter(e=>e.kind===`browser`),void 0,t.recent,e.next);n&&r.push(n)}}return{columns:Bs(r),weights:{}}}function yc(e){if(!e||typeof e!=`object`)return null;let t=e;if(!Array.isArray(t.columns))return vc(t);let n=[];for(let e of t.columns){let t=hc(e);t&&!n.some(e=>e.kind===t.kind)&&n.push(t)}return{columns:Bs(n),weights:gc(t.weights,n)}}function bc(e,t){let n=Is(),r=typeof t==`string`&&t!==``?t:``;return e!==`browser`&&!r?n:{...n,columns:[...n.columns,r?Os(bs(),r):bs()]}}function xc(e){try{let t=JSON.parse(e??`{}`);return t&&typeof t==`object`&&!Array.isArray(t)?Object.entries(t):[]}catch{return[]}}function Sc(e,t,n){let r=Object.fromEntries(Object.entries(e).filter(([e])=>e!==t));r[t]=n;for(let e of Object.keys(r).slice(0,-50))delete r[e];return r}function Cc(e,t){let n={};for(let[t,r]of xc(e)){let e=yc(r);e&&(n[t]=e)}let r=new Map(xc(t.tab).filter(([,e])=>pc.includes(e))),i=new Map(xc(t.url)),a=[...new Set([...r.keys(),...i.keys()])].filter(e=>!(e in n));n={...Object.fromEntries(a.map(e=>[e,bc(r.get(e),i.get(e))])),...n};for(let e of Object.keys(n).slice(0,-50))delete n[e];return n}var wc=`rove.web.panels`,Tc=`rove.web.panelTab`,Ec=`rove.web.panelUrl`;function Dc(){let e={tab:localStorage.getItem(Tc),url:localStorage.getItem(Ec)},t=Cc(localStorage.getItem(wc),e);return(e.tab!==null||e.url!==null)&&(localStorage.setItem(wc,JSON.stringify(t)),localStorage.removeItem(Tc),localStorage.removeItem(Ec)),t}var Oc=v(Dc()),kc={columns:[],weights:{}};function Ac(e){return y(Oc)[e]??kc}function jc(e){let t=Ac(e??``);return y(ic)&&(e===null||t.columns.length>0)}function Mc(e){return ic.get()&&(e===null||(Oc.get()[e]??kc).columns.length>0)}var Nc=e=>Oc.subscribe(e);function Pc(e,t){let n=Oc.get()[e]??kc,r=t(n);if(r===n)return;let i=Sc(Oc.get(),e,r);Oc.set(i),localStorage.setItem(wc,JSON.stringify(i))}function Fc(e,t){Pc(e,e=>Hs(e,t)),ic.set(!0),ye()&&ec.set(t)}function Ic(e,t){let n=ic.get(),r=Js(Oc.get()[e]??kc,n&&!j.get(),t,!n);Pc(e,()=>r.panel),r.open?ic.set(!0):ac.set(!1),r.open&&j.get()&&j.set(!1)}function Lc(e){Pc(e.taskId,t=>Ws(t,e.path,e.scope)),ic.set(!0),j.get()&&j.set(!1),ye()&&ec.set(`diff`)}function Rc(e,t){Pc(e,e=>Us(e,t)),ic.set(!0),j.get()&&j.set(!1),ye()&&ec.set(`file`)}function zc(e,t){Pc(e,e=>Gs(e,t)),ic.set(!0),j.get()&&j.set(!1),ye()&&ec.set(`browser`)}function Bc(e,t){let n=Oc.get()[e]??kc;!ye()&&n.columns.length===0&&ac.set(!1),ye()&&ec.get()===t&&!Ls(n,t)&&Fc(e,`files`)}function Vc(e,t){Pc(e,e=>Ks(e,t)),Bc(e,t)}function Hc(e,t){Pc(e,e=>qs(e,t)),Bc(e,`browser`)}function Uc(e,t){Hc(e,e=>As(e,t))}function Wc(e,t){let n=dc(e,{taskId:t,narrow:ye()});Pc(e.taskId,t=>fc(t,n,e.at)),n.show&&(ic.set(!0),j.get()&&j.set(!1))}var Gc={Enter:`return`," ":`space`,Escape:`escape`,ArrowUp:`up`,ArrowDown:`down`,ArrowLeft:`left`,ArrowRight:`right`,PageUp:`pageup`,PageDown:`pagedown`};function Kc(e){if(e.altKey&&e.code){let t=/^Key([A-Z])$/.exec(e.code);if(t?.[1])return t[1].toLowerCase();let n=/^Digit(\d)$/.exec(e.code);if(n?.[1])return n[1]}return Gc[e.key]??e.key.toLowerCase()}function qc(e){let t=Kc(e),n=t===`return`?[`return`,`enter`]:[t],r=[];e.ctrlKey&&r.push(`ctrl`),e.metaKey&&r.push(`cmd`),e.altKey&&r.push(`alt`);let i=t.length===1;return e.shiftKey&&!i&&r.push(`shift`),r.length===0?e.shiftKey&&i?[...n.map(e=>`shift+${e}`),...n]:n:e.shiftKey&&i?[]:n.map(e=>`${r.join(`+`)}+${e}`)}function Jc(e){return e.startsWith(`shift+`)&&e.length===7?e.slice(6).toUpperCase():e}var Yc=new Map(ia.map(e=>[e.id,{keys:[...e.keys],prefixKeys:e.prefixKeys&&[...e.prefixKeys],hint:e.hint?{...e.hint}:void 0}]));function Xc(){return ia.map(e=>{let t=Yc.get(e.id);return{id:e.id,scope:e.scope,category:e.category,...e.bareKeys?{bareKeys:!0}:{},keys:[...t?.keys??[]],...t?.prefixKeys?{prefixKeys:[...t.prefixKeys]}:{},...t?.hint?{hint:{...t.hint}}:{}}})}var Zc=new Map(ia.map(e=>[e.id,e]));function Qc(e){return Zc.get(e)}function $c(e,t){if(!e)return!0;let n=e.toLowerCase(),r=t.toLowerCase(),i=0;for(let e=0;e<r.length&&i<n.length;e++)r.charCodeAt(e)===n.charCodeAt(i)&&i++;return i===n.length}function el(e){let t=[],n=new Map;for(let r of e){let e=n.get(r.category);e||(e=[],n.set(r.category,e),t.push({category:r.category,rows:e})),e.push(r)}return t}function tl(e){return e.hint?.keys??e.keys[0]}function nl(e){let t=Qc(e);if(!t)return null;let n=tl(t);return n&&n.length>0?n:null}function rl(e){return e.keys.length>0?e.hint?.keys??e.keys[0]??null:e.prefixKeys?.length?null:e.hint?.keys??null}function il(e,t){return e.scope===`global`?!0:t===null?!1:e.scope===t||t===`terminal`&&e.scope===`workspace`}function al(e,t,n,r){let i=[],a=[],o=[],s=new Map;for(let c of e){let e=rl(c),l=il(c,t),u=r?r.direct.has(c.id):l,d=r?r.prefix.has(c.id):l;if(e){let t={binding:c,primary:e,aliases:c.keys.filter(t=>t!==e)};if(u&&(l||c.presentation===`onePress`))c.presentation===`onePress`?a.push(t):i.push(t);else if(!l&&c.scope!==`global`){let e=s.get(c.scope);e?e.push(t):s.set(c.scope,[t])}}n&&d&&c.prefixKeys?.length&&o.push({binding:c,primary:`${n} + ${c.prefixKeys[0]}`,aliases:c.prefixKeys.slice(1).map(e=>`${n} + ${e}`)})}let c=[];i.length&&c.push({kind:`here`,scope:t??void 0,rows:i}),a.length&&c.push({kind:`direct`,rows:a}),o.length&&c.push({kind:`prefix`,rows:o});for(let[e,t]of s)c.push({kind:`other`,scope:e,rows:t});return c}var ol={global:`Global`,sidebar:`Sidebar`,workspace:`Workspace`,files:`Files`,inbox:`Inbox`,terminal:`Terminal`};function sl(e){return e?ol[e]:`Global`}function cl(e){return[`kanban.open`,`automations.open`,`workItems.open`].includes(e)?`Views`:e.startsWith(`focus.`)?`Navigation`:e.startsWith(`inbox.`)||e.startsWith(`attention.`)?`Attention`:e.startsWith(`chat.tab.`)||e.startsWith(`chat.session.`)?`Sessions`:e.startsWith(`chat.fork.`)||e.startsWith(`task.`)?`Tasks`:e.startsWith(`settings.`)||e===`workspace.zenToggle`?`Tools`:Qc(e)?.category??`Global`}function ll(e,t,n){let r=e.trim();return $c(r,t)||$c(r,n)}var ul={title:`Rove — keybindings`,palette:`Search commands`,search:`Type an action name or chord…`,filter:`/ filter actions`,noResults:`No matching actions. Try another name or clear the filter.`,run:`↑↓ select · enter run · esc cancel`,reportProblem:`Report a problem`,reportPrompt:"You are helping the user report a problem with Rove itself (not their own project) as a GitHub issue. First ask what they were doing and what felt wrong: one to three short questions, one at a time. Then collect context: run `rove --version` and `rove daemon status`, and read the last ~50 lines of {logPath} only if the problem could involve the daemon. Draft an issue title and body (what happened, what they expected, steps, relevant output) and show it to the user. Only after they say OK, file it with a heredoc: `rove feedback --kind bug|idea|question --title \"...\" --body-file - <<'EOF'` followed by the body and `EOF`. Then share the issue URL. If it prints a prefilled link instead (gh missing or signed out), give the user that link and tell them to run `gh auth login`.",unavailable:`This action is no longer available. Close and reopen the palette.`,esc:`esc`,scrollKeys:`↑↓ ⇞⇟ scroll`,commandLayer:`{prefix} — more Rove commands`,escCancel:`esc cancel`,directLayer:`Hold ctrl — Rove shortcuts`,releaseCtrl:`release ctrl to close`,overflow:`… F1 for all shortcuts`,moreCommandsPrefix:`More commands (prefix)`,focused:`Focused: {surface}`,allBindings:`All keybinding contexts`,grammar:`Use keys here · one-press Rove shortcuts · {prefix} for more commands · right-click a row for its menu`,disabled:`prefix disabled`,here:`HERE — only in {surface}`,direct:`ONE PRESS — Rove shortcuts`,afterPrefix:`AFTER PREFIX — more Rove commands`,otherPane:`OTHER PANE — {surface}`,marks:{rows:`MARKS — task and tab rows`,inbox:`MARKS — tab strip and Inbox`,pr:`MARKS — pull request chip`},mark:{spinner:`working: an engine turn or a task job is running`,needsInput:`waiting on your answer: a permission prompt or a question`,attention:`needs you: an error, a rate limit, an exited engine or a failed deletion`,unseen:`a turn finished and you have not looked yet`,idle:`quiet`,subagent:`running subagents, in front of the branch`,remote:`the task lives on another machine`,done:`the turn finished`,rateLimited:`rate limited; it resumes on its own`,dead:`the engine process exited`,routineFailed:`a routine run failed`,conflict:`merge conflicts`,checksFailing:`checks failing`,checksPassing:`checks passing`}},dl={title:`Rove — 快捷键`,palette:`搜索命令`,search:`输入操作名称或快捷键…`,filter:`/ 筛选操作`,noResults:`没有匹配的操作。请换个名称或清空筛选。`,run:`↑↓ 选择 · enter 执行 · esc 取消`,reportProblem:`报告问题`,reportPrompt:"你在帮用户把 Rove 本身的问题(不是他们自己项目的问题)提成一个 GitHub issue。先问清楚他们当时在做什么、哪里不对劲:一到三个简短的问题,一次问一个。然后收集上下文:运行 `rove --version` 和 `rove daemon status`,只有问题可能和 daemon 有关时才读 {logPath} 的最后约 50 行。起草 issue 的标题和正文(发生了什么、期望什么、复现步骤、相关输出)并展示给用户。用户确认之后才提交,用 heredoc:`rove feedback --kind bug|idea|question --title \"...\" --body-file - <<'EOF'`,接正文,最后一行 `EOF`。然后把 issue 链接发给用户。如果输出的是预填链接(没装 gh 或没登录),把链接给用户,并告诉他运行 `gh auth login`。",unavailable:`此操作已不可用。请关闭并重新打开命令面板。`,esc:`esc`,scrollKeys:`↑↓ ⇞⇟ 滚动`,commandLayer:`{prefix} — 更多 Rove 命令`,escCancel:`esc 取消`,directLayer:`按住 ctrl — Rove 快捷键`,releaseCtrl:`松开 ctrl 关闭`,overflow:`… 按 F1 查看全部快捷键`,moreCommandsPrefix:`更多命令(prefix)`,focused:`当前焦点:{surface}`,allBindings:`所有快捷键上下文`,grammar:`当前区域直接按 · Rove 单次快捷键 · {prefix} 打开更多命令 · 右键任务行打开菜单`,disabled:`Prefix 已禁用`,here:`当前区域 — 仅在{surface}`,direct:`一次按下 — Rove 快捷键`,afterPrefix:`按下 Prefix 后 — 更多 Rove 命令`,otherPane:`其他区域 — {surface}`,marks:{rows:`标记 — 任务行和标签行`,inbox:`标记 — 标签栏和收件箱`,pr:`标记 — PR 标记`},mark:{spinner:`运行中:引擎正在执行一轮,或任务作业正在运行`,needsInput:`等你回答:权限确认或提问`,attention:`需要你处理:出错、限流、引擎已退出或删除失败`,unseen:`一轮已结束,你还没看过`,idle:`空闲`,subagent:`正在运行的子代理,显示在分支名前`,remote:`任务在另一台机器上`,done:`这一轮已结束`,rateLimited:`被限流,会自动恢复`,dead:`引擎进程已退出`,routineFailed:`例行任务运行失败`,conflict:`存在合并冲突`,checksFailing:`检查未通过`,checksPassing:`检查已通过`}},fl={status:{commands:`{key} commands`,help:`{key} help`,sidebar:`{key} sidebar`,settings:`settings`},pane:{move:`move`,open:`open`,collapse:`collapse`,diff:`diff`}},pl={status:{commands:`{key} 命令`,help:`{key} 帮助`,sidebar:`{key} 侧栏`,settings:`设置`},pane:{move:`移动`,open:`打开`,collapse:`折叠`,diff:`差异`}},ml={category:{Global:`Global`,Sidebar:`Sidebar`,Workspace:`Workspace`,Navigation:`Navigation`,"Tasks pane":`Tasks pane`,Files:`Files`,Terminal:`Terminal`,Views:`Views`,Tasks:`Tasks`,Sessions:`Sessions`,Attention:`Attention`,Tools:`Tools`,"Diff review":`Diff review`,Inbox:`Inbox`},desc:{"palette.open":`Search commands`,"help.open":`Show keybindings help`,"task.new":`New task`,"task.new.global":`New task`,"task.openEditor":`Open active Task directory in editor`,"task.moveMode":`Reorder sidebar rows (then j/k — tab, task, or project)`,"settings.open":`Open settings`,"app.refresh":`Refresh Rove onto the installed build (after an update)`,"settings.open.sidebar":`Open settings`,"inbox.show":`Open Inbox`,"worktrees.open.sidebar":`Open worktrees`,"kanban.open":`Open kanban (issues board)`,"automations.open":`Open routines (scheduled tasks)`,"workItems.open":`Open GitHub issues (external tracker)`,"app.quit":`Quit (with confirm)`,"focus.sidebar":`Back to sidebar (tasks)`,"focus.previous":`Focus previous pane (files → workspace → sidebar)`,"focus.next":`Focus next pane (sidebar → workspace → files)`,"workspace.zenToggle":`Toggle zen mode`,"view.redraw":`Redraw the screen`,"attention.next":`Jump to the next Inbox item`,"sidebar.nav":`Move cursor up/down`,"sidebar.select":`Open the selected task`,"sidebar.tree.open":`Open the row under the cursor`,"sidebar.goto":`Top / bottom of list (gg or shift-G)`,"sidebar.rename":`Rename task`,"sidebar.localMerge":`Reorder row (Shift+M, then j/k — tab, task, or project)`,"sidebar.pin":`Pin / unpin task at top (Shift+P)`,"sidebar.sort":`Cycle task sort (default → recent → attention → name)`,"sidebar.delete":`Remove session (with confirm)`,"sidebar.search.enter":`Search tasks (fuzzy filter)`,"sidebar.search.nav":`Move highlight in search results`,"sidebar.search.submit":`Select search match and exit search`,"sidebar.search.cancel":`Cancel search (restore prior selection)`,"tasks.openWorktree":`Open selected Task directory in your editor`,"tasks.renameBranch":`Rename the selected task's git branch`,"tasks.cycleEngine":`Cycle engine vendor — applies on reopen`,"tasks.update":`Open the update page (when a new version is available)`,"tasks.focusEngine":`Focus the engine pane of the current window`,"chat.tab.new":`New conversation here (a child task sharing this directory)`,"chat.tab.chooseEngine":`New conversation — engine/shell picker with destination + context toggles`,"chat.tab.fork":`Continue this chat in a new child task (same directory, keeps the conversation)`,"chat.fork.new":`Quick-fork: create child task seeded with current repo/branch/model`,"chat.tab.close":`Close chat tab`,"chat.tab.rename":`Rename active chat tab`,"chat.tab.cycle-next":`Next chat tab`,"chat.tab.cycle-prev":`Previous chat tab`,"chat.tab.goto":`Go to chat tab N`,"workspace.split.right":`Split right`,"workspace.split.down":`Split down`,"workspace.split.focus-next":`Focus next split`,"workspace.split.close":`Close active split (tab when unsplit)`,"workspace.split.rename":`Rename active split (tab when unsplit)`,"workspace.reopenSession":`Reopen a session in a task whose tabs are all closed`,"files.nav":`Move cursor up/down`,"files.hierarchy":`Collapse / expand tree level`,"files.open":`Open file in configured editor (diff when supported)`,"files.tab":`Switch tab (cycle All / Changes)`,"files.refresh":`Refresh`,"files.scope":`Toggle Changes scope (working ↔ branch vs base)`,"files.diff":`Open a read-only diff in a workspace tab`,"files.diffAll":`Open the whole worktree's diff in one workspace tab`,"files.openExternal":`Open file in system default app (audio / video / pdf preview)`,"files.mention":`Inject @<path> mention into the engine pane`,"files.createPR":`Ask the agent to create a PR from the current task`,"files.fixChecks":`Ask the agent to fix the failing PR checks`,"files.syncBase":`Merge the base branch into this task's worktree`,"diff.review.cursor":`Move the line cursor over the diff`,"diff.review.range":`Toggle range anchor at the cursor`,"diff.review.note":`Add a review note at the cursor`,"diff.review.send":`Send all unsent review notes to the engine`,"diff.review.drop":`Drop the review note the cursor sits inside`,"diff.review.reload":`Reload the previewed file from disk`,"inbox.nav":`Move through Inbox items`,"inbox.open":`Open the selected Inbox item`,"inbox.delete":`Ack the selected Inbox item`,"inbox.deleteAll":`Ack every ATTENTION item`,"terminal.scroll-up":`Scroll scrollback up`,"terminal.scroll-down":`Scroll scrollback down`,"terminal.reset":`Reset terminal — kill the current shell and respawn`}},hl={category:{Global:`全局`,Sidebar:`侧边栏`,Workspace:`工作区`,Navigation:`导航`,"Tasks pane":`任务面板`,Files:`文件`,Terminal:`终端`,Views:`视图`,Tasks:`任务`,Sessions:`会话`,Attention:`提醒`,Tools:`工具`,"Diff review":`差异审阅`,Inbox:`收件箱`},desc:{"palette.open":`搜索命令`,"help.open":`显示快捷键帮助`,"task.new":`新建任务`,"task.new.global":`新建任务`,"task.openEditor":`在编辑器中打开当前 Task 的目录`,"task.moveMode":`调整侧边栏行顺序(然后 j/k——tab / 任务 / 项目)`,"settings.open":`打开设置`,"app.refresh":`让 Rove 刷新到已安装的版本(更新之后)`,"settings.open.sidebar":`打开设置`,"inbox.show":`打开收件箱`,"worktrees.open.sidebar":`打开 worktrees`,"kanban.open":`打开看板(issues)`,"automations.open":`打开例行任务(定时任务)`,"workItems.open":`打开 GitHub issues(外部跟踪器)`,"app.quit":`退出(需确认)`,"focus.sidebar":`返回侧边栏(任务列表)`,"focus.previous":`聚焦上一个面板(文件 → 工作区 → 侧边栏)`,"focus.next":`聚焦下一个面板(侧边栏 → 工作区 → 文件)`,"workspace.zenToggle":`切换禅模式`,"view.redraw":`重绘屏幕`,"attention.next":`跳到下一个收件箱条目`,"sidebar.nav":`上下移动光标`,"sidebar.select":`打开选中的任务`,"sidebar.tree.open":`打开光标所在行`,"sidebar.goto":`跳到列表顶部 / 底部(gg 或 shift-G)`,"sidebar.rename":`重命名任务`,"sidebar.localMerge":`调整当前行顺序(Shift+M,然后 j/k——tab / 任务 / 项目)`,"sidebar.pin":`置顶 / 取消置顶任务(Shift+P)`,"sidebar.sort":`切换任务排序方式(默认 → 最近 → 关注 → 名称)`,"sidebar.delete":`移除会话(需确认)`,"sidebar.search.enter":`搜索任务(模糊过滤)`,"sidebar.search.nav":`在搜索结果中移动高亮`,"sidebar.search.submit":`选中搜索匹配项并退出搜索`,"sidebar.search.cancel":`取消搜索(恢复之前的选中项)`,"tasks.openWorktree":`在编辑器中打开选中 Task 的目录`,"tasks.renameBranch":`重命名选中任务的 git 分支`,"tasks.cycleEngine":`循环切换引擎厂商——重新打开后生效`,"tasks.update":`打开更新页面(有新版本时)`,"tasks.focusEngine":`聚焦当前窗口的引擎面板`,"chat.tab.new":`在此新建对话(共享当前目录的子任务)`,"chat.tab.chooseEngine":`新建对话 —— 选择引擎或 shell,可切换落点与上下文`,"chat.tab.fork":`把当前对话接到新子任务(同一目录,带上已有对话)`,"chat.fork.new":`快速派生:以当前仓库/分支/模型创建子任务`,"chat.tab.close":`关闭聊天标签页`,"chat.tab.rename":`重命名当前聊天标签页`,"chat.tab.cycle-next":`下一个聊天标签页`,"chat.tab.cycle-prev":`上一个聊天标签页`,"chat.tab.goto":`跳到第 N 个聊天标签页`,"workspace.split.right":`向右分屏`,"workspace.split.down":`向下分屏`,"workspace.split.focus-next":`聚焦下一个分屏`,"workspace.split.close":`关闭当前分屏(未分屏时关闭标签页)`,"workspace.split.rename":`重命名当前分屏(未分屏时重命名标签页)`,"workspace.reopenSession":`在标签页全部关闭的任务中重新打开会话`,"files.nav":`上下移动光标`,"files.hierarchy":`折叠 / 展开树层级`,"files.open":`在已配置的编辑器中打开文件(支持时显示 diff)`,"files.tab":`切换标签页(循环 全部 / 变更)`,"files.refresh":`刷新`,"files.scope":`切换变更范围(工作区 ↔ 分支对比 base)`,"files.diff":`在工作区标签页中打开只读 diff`,"files.diffAll":`把整个 worktree 的 diff 打开在一个工作区标签页里`,"files.openExternal":`在系统默认应用中打开文件(音频 / 视频 / pdf 预览)`,"files.mention":`将 @<path> 提及注入引擎面板`,"files.createPR":`让 agent 从当前任务创建 PR`,"files.fixChecks":`让 agent 修复失败的 PR 检查`,"files.syncBase":`把基础分支合并进该任务的工作树`,"diff.review.cursor":`在 diff 中移动行光标`,"diff.review.range":`在光标处切换范围锚点`,"diff.review.note":`在光标处添加审阅备注`,"diff.review.send":`将所有未发送的审阅备注发给引擎`,"diff.review.drop":`删除光标所在的评审备注`,"diff.review.reload":`从磁盘重新加载当前预览的文件`,"inbox.nav":`在收件箱条目之间移动`,"inbox.open":`打开选中的收件箱条目`,"inbox.delete":`将选中的收件箱条目标为已阅`,"inbox.deleteAll":`将所有待处理条目标为已阅`,"terminal.scroll-up":`向上滚动回滚`,"terminal.scroll-down":`向下滚动回滚`,"terminal.reset":`重置终端——关闭当前 shell 并重新启动`}};function gl(e,t){let n=e;for(let e of t.split(`.`)){if(!n||typeof n!=`object`||!(e in n))return;n=Reflect.get(n,e)}return typeof n==`string`?n:void 0}function _l(e,t){return kt.get()===`zh`?t:e}function vl(e,t){return t?e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e)):e}var yl=(e,t)=>vl(gl(_l(ul,dl),e)??gl(ul,e)??e,t),bl=(e,t)=>vl(gl(_l(fl,pl),e)??gl(fl,e)??e,t),xl=(e,t)=>vl(gl(_l(Gi,Ki),e)??gl(Gi,e)??e,t);function Sl(e){return _l(ml,hl).desc[e]??ml.desc[e]??e}function Cl(e){let t=Sl(e),n=t.search(/\s—\s|——/);return n>0?t.slice(0,n):t}function wl(e){return _l(ml,hl).category[e]??e}var Tl=(e,t)=>vl(gl(_l(Yi,Xi),e)??gl(Yi,e)??e,t),El=(e,t)=>vl(gl(_l(Ui,Wi),e)??gl(Ui,e)??e,t),Dl=e=>e.split(` + `).map(e=>ca(e)).join(` + `);function Ol(e){let t=wl(sl(e.scope));return e.kind===`here`?yl(`here`,{surface:t}):e.kind===`direct`?yl(`direct`):e.kind===`prefix`?yl(`afterPrefix`):yl(`otherPane`,{surface:t})}function kl(e){let t=document.activeElement instanceof HTMLElement?document.activeElement:null;C.set((0,V.jsx)(Al,{model:e,surface:Do(),origin:t}))}function Al({model:e,surface:t,origin:n}){B();let r=y(ua),[i,a]=(0,h.useState)(!1),[o,s]=(0,h.useState)(``),c=(0,h.useRef)(null),l=(0,h.useMemo)(()=>Oo(e,t),[e,t]),u=(0,h.useMemo)(()=>al(ko(),t===`terminal`?`terminal`:t,ha(),l),[l,t,r]).map(e=>({...e,rows:e.rows.filter(e=>ll(o,Sl(e.binding.id),e.primary))})).filter(e=>e.rows.length>0);return(0,h.useEffect)(()=>()=>n?.focus(),[n]),(0,h.useEffect)(()=>{let e=c.current,t=t=>{if(!e||t.ctrlKey||t.metaKey||t.altKey)return;let n=e.clientHeight;if(t.key===`ArrowUp`)e.scrollBy({top:-24});else if(t.key===`ArrowDown`)e.scrollBy({top:24});else if(t.key===`PageUp`)e.scrollBy({top:-n});else if(t.key===`PageDown`)e.scrollBy({top:n});else if(t.key===`Home`)e.scrollTo({top:0});else if(t.key===`End`)e.scrollTo({top:e.scrollHeight});else if(!i&&t.key===`?`)R();else if(!i&&t.key===`/`)a(!0);else return;t.preventDefault()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[i]),(0,V.jsx)(bi,{title:yl(`title`),wide:!0,children:(0,V.jsxs)(`div`,{className:`${Wr} help`,children:[(0,V.jsxs)(`div`,{className:mn,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-muted`,children:t?yl(`focused`,{surface:wl(sl(t))}):yl(`allBindings`)}),(0,V.jsx)(`p`,{className:`text-muted`,children:yl(`grammar`,{prefix:ga()})})]}),(0,V.jsxs)(`div`,{className:hn,children:[(0,V.jsx)(`span`,{className:`subtle`,children:yl(`scrollKeys`)}),(0,V.jsx)(`button`,{type:`button`,className:kr,onClick:R,children:yl(`esc`)})]})]}),i?(0,V.jsx)(`input`,{className:jr,autoFocus:!0,spellCheck:!1,value:o,placeholder:yl(`search`),onChange:e=>{s(e.target.value),c.current?.scrollTo({top:0})}}):(0,V.jsx)(`p`,{className:`text-muted`,children:yl(`filter`)}),u.length===0&&(0,V.jsx)(`p`,{className:`text-muted`,children:yl(`noResults`)}),(0,V.jsx)(`div`,{className:gn,ref:c,children:u.map((e,t)=>(0,V.jsxs)(`section`,{className:_n,children:[(0,V.jsx)(`h2`,{className:vn,children:Ol(e)}),e.rows.map(t=>(0,V.jsxs)(`div`,{className:yn,children:[(0,V.jsx)(`span`,{className:`mono ${bn}`,children:Dl(t.primary)}),(0,V.jsx)(`span`,{className:`flex-1`,children:Sl(t.binding.id)}),t.aliases.length>0&&(0,V.jsx)(`span`,{className:`text-muted`,children:`(${t.aliases.map(Dl).join(`, `)})`})]},`${e.kind}-${t.binding.id}`))]},`${e.kind}-${e.scope??t}`))})]})})}function jl(e){switch(e){case`permission_needed`:return{glyph:`?`,tone:`warning`,stateKey:`inbox.state.needsInput`};case`turn_complete`:return{glyph:`✓`,tone:`success`,stateKey:`inbox.state.done`};case`rate_limited`:return{glyph:`◷`,tone:`warning`,stateKey:`inbox.state.rateLimited`};case`dead`:return{glyph:`†`,tone:`attention`,stateKey:`inbox.state.dead`};case`decision_needed`:return{glyph:`?`,tone:`warning`,stateKey:`inbox.state.decision`};case`routine_failed`:return{glyph:`↻`,tone:`attention`,stateKey:`inbox.state.routineFailed`};case`report_missing`:return{glyph:`!`,tone:`warning`,stateKey:`inbox.state.reportMissing`};default:return{glyph:`!`,tone:`attention`,stateKey:`inbox.state.error`}}}function Ml(e){let t=Math.max(0,Math.round(e/1e3));if(t<60)return`${t}s`;let n=Math.round(t/60);if(n<60)return`${n}m`;let r=Math.round(n/60);return r<48?`${r}h`:`${Math.round(r/24)}d`}var Nl=e=>e===`routine_failed`,Pl=e=>`${e.taskId??``}:${e.tabId??``}`;function Fl(e,t){let n=new Map(t.map((e,t)=>[e,t])),r=e=>+(e.state===`turn_complete`),i=e=>n.get(e.taskId??``)??2**53-1;return[...e].sort((e,t)=>r(e)-r(t)||e.at-t.at||i(e)-i(t)||Pl(e).localeCompare(Pl(t)))}function Il(e,t,n){let r=new Set(t),i=Fl(e,t).filter(e=>e.taskId===null||r.has(e.taskId));if(i.length===0)return null;let a=n.taskId===null?-1:i.findIndex(e=>Pl(e)===Pl(n));return a<0||i.length===1?i[0]??null:i[(a+1)%i.length]??null}function Ll(e){let t=(e.terminal?.tail??[]).map(e=>e.trimEnd()),n=t.length;for(;n>0&&t[n-1]===``;)n--;let r=0;for(;r<n&&t[r]===``;)r++;return t.slice(Math.max(r,n-12),n)}async function Rl(e,t,n=!1){let r=`attention.dismiss`,i;if(Nl(t.state)){if(!t.automationId)return;r=`attention.dismissRoutine`,i={automationId:t.automationId}}else{if(t.gateId||t.state===`decision_needed`||t.state===`report_missing`&&!n||t.taskId===null)return;i={taskId:t.taskId,...t.tabId?{tabId:t.tabId}:{},...t.deliveryId?{deliveryId:t.deliveryId}:{}}}await e.client.request(r,i).catch(e=>I(String(e),`error`))}function zl(e,t){Rl(e,t),R(),k.set(t.automationId??null),O.set(`routines`)}var q=524288e3,J=1048576;function Bl(e,t){return/\.pdf$/i.test(e)?`pdf[${t}]`:/\.(png|jpe?g|gif|webp)$/i.test(e)?`images[${t}]`:`files[${t}]`}function Vl(e){let t=-1;for(let n of e.matchAll(/^(?:images|pdf|files)\[(\d+)\]:/gm)){let e=Number.parseInt(n[1],10);e>t&&(t=e)}return t+1}function Hl(e,t){let n=e.replace(/\s+$/,``),r=Vl(e);for(let e of t){let t=`${Bl(e,r)}: ${e}`;n=n.length>0?`${n}\n${t}`:t,r+=1}return n}function Ul(e){let t=``;for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}async function Wl(e,t){if(t.size>524288e3)throw Error(z(`pages.attachTooLarge`,{name:t.name}));let n={mime:t.type,name:t.name},r=async(e,n)=>Ul(new Uint8Array(await t.slice(e,n).arrayBuffer()));if(t.size<=1048576)return e.request(`attachment.put`,{...n,data:await r(0,t.size)});let i;for(let a=0;;){let o=Math.min(a+J,t.size),s=await e.request(`attachment.part`,{...n,...i?{upload:i}:{},offset:a,data:await r(a,o),done:o===t.size});if(s.path!==void 0)return{path:s.path,kind:s.kind??`file`};i=s.upload,a=o}}async function Gl(e,t){return(await Wl(e,t)).path}function Kl(e){if(e<1024)return`${e} B`;let t=[`KB`,`MB`,`GB`,`TB`],n=e/1024,r=0;for(;n>=1023.5&&r<t.length-1;)n/=1024,r++;let i=n.toFixed(1);return`${Number(i)>=100?Math.round(n):i} ${t[r]}`}var ql=`size-14 rounded-sm border-hairline border-line object-cover`;function Jl({name:e,thumb:t}){if(t)return(0,V.jsx)(`img`,{src:t,alt:``,draggable:!1,className:ql});let n=e.includes(`.`)?e.split(`.`).pop()??``:``;return(0,V.jsx)(`span`,{className:`${ql} flex items-center justify-center font-mono text-meta uppercase text-muted`,children:n.slice(0,4)||`file`})}function Yl({item:e,onRemove:t}){let[n]=(0,h.useState)(e.pending);return(0,V.jsxs)(`li`,{className:`group relative size-14 shrink-0 ${n?`motion-safe:animate-rise-in`:``}`,title:`${e.name} · ${Kl(e.size)}`,children:[(0,V.jsx)(`div`,{className:`transition-opacity duration-150 motion-reduce:transition-none ${e.pending?`opacity-50`:``}`,children:(0,V.jsx)(Jl,{...e})}),(0,V.jsx)(`button`,{type:`button`,"aria-label":z(`newSession.removeAttachment`,{name:e.name}),className:`absolute top-0.5 right-0.5 flex size-5 cursor-pointer items-center justify-center rounded-full border-hairline border-line bg-paper p-0 text-meta leading-none text-ink opacity-0 group-focus-within:opacity-100 group-hover:opacity-100 touch:size-7 touch:opacity-100 touch:after:absolute touch:after:-inset-2 touch:after:content-['']`,onClick:()=>t(e.id),children:`×`})]})}function Xl({items:e,onRemove:t}){return e.length===0?null:(0,V.jsx)(`ul`,{className:`m-0 flex min-w-0 list-none flex-wrap gap-1.5 p-0`,"data-field":`attachments`,children:e.map(e=>(0,V.jsx)(Yl,{item:e,onRemove:t},e.id))})}function Zl(e){return{drop:{onDragOver:e=>e.dataTransfer.types.includes(`Files`)&&e.preventDefault(),onDrop:t=>{t.dataTransfer.files.length!==0&&(t.preventDefault(),e(Array.from(t.dataTransfer.files)))}},onPaste:t=>{let n=Array.from(t.clipboardData.files);n.length!==0&&(t.preventDefault(),e(n))}}}function Ql(e){return(0,V.jsxs)(`label`,{className:e.className,title:e.title,children:[e.children,(0,V.jsx)(`input`,{type:`file`,multiple:!0,className:`sr-only`,disabled:e.disabled,onChange:t=>{let n=Array.from(t.target.files??[]);t.target.value=``,n.length>0&&e.onFiles(n)}})]})}var $l={image:`images`,pdf:`pdf`};function eu(e,t){let n=t.filter(e=>e.path!==void 0);return n.length===0?e:`${e}\n\n${n.map((e,t)=>`${$l[e.kind??`image`]??`files`}[${t}]: ${e.path}`).join(`
|
|
37
37
|
`)}`}var tu=112;async function nu(e){if(e.type.startsWith(`image/`))try{let t=await createImageBitmap(e),n=Math.min(1,tu/Math.min(t.width,t.height)),r=document.createElement(`canvas`);return r.width=Math.round(t.width*n),r.height=Math.round(t.height*n),r.getContext(`2d`)?.drawImage(t,0,0,r.width,r.height),t.close(),r.toDataURL(`image/webp`,.8)}catch{return}}function ru(e){if(!e)return[];try{let t=JSON.parse(sessionStorage.getItem(e)??`[]`);return Array.isArray(t)?t:[]}catch{return[]}}var iu=0;function au(e,t,n){let[r,i]=(0,h.useState)(()=>ru(n)),a=(0,h.useRef)(r),o=(0,h.useRef)(new Set),s=e=>{if(a.current=e(a.current),i(a.current),n)try{sessionStorage.setItem(n,JSON.stringify(a.current.filter(e=>e.path!==void 0)))}catch{}},c=async n=>{let r=`${Date.now()}-${iu++}`,i=await nu(n);s(e=>[...e,{id:r,name:n.name,size:n.size,mime:n.type,...i?{thumb:i}:{}}]);try{let t=await Wl(e.client,n);s(e=>e.map(e=>e.id===r?{...e,path:t.path,kind:t.kind}:e))}catch(e){s(e=>e.filter(e=>e.id!==r)),t(e instanceof Error?e.message:String(e))}};return{attachments:r,attach:e=>{for(let t of e){let e=c(t);o.current.add(e),e.finally(()=>o.current.delete(e))}},remove:e=>s(t=>t.filter(t=>t.id!==e)),ready:async()=>(await Promise.all(o.current),a.current),clear:()=>s(()=>[])}}function ou(e){return(0,V.jsx)(Xl,{items:e.attachments.map(e=>({...e,pending:e.path===void 0})),onRemove:e.onRemove})}function su(e){let t=(0,h.useRef)(null),n=(0,h.useRef)(e.value);n.current=e.value;let r=(r,i)=>{r.preventDefault();let a=e.choices.findIndex(e=>e.id===n.current),o=e.choices[(a+i+e.choices.length)%e.choices.length];o&&(n.current=o.id,e.onChange(o.id),requestAnimationFrame(()=>t.current?.querySelector(`[aria-pressed=true]`)?.focus()))};return(0,V.jsx)(`div`,{ref:t,className:Ir,"aria-label":e.label,"data-field":e.field,onKeyDown:t=>{t.ctrlKey||t.metaKey||t.altKey||e.choices.length===0||(t.key===`ArrowRight`||t.key===`l`?r(t,1):(t.key===`ArrowLeft`||t.key===`h`)&&r(t,-1))},children:e.choices.map(t=>(0,V.jsx)(`button`,{type:`button`,"aria-pressed":t.id===e.value,tabIndex:t.id===e.value||!e.choices.some(t=>t.id===e.value)?0:-1,className:Lr(t.id===e.value,t.dim),title:t.title,onClick:()=>e.onChange(t.id),children:t.label},t.id))})}function cu(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(hover: none) and (pointer: coarse)`).matches}var lu=/^(?:enter|return|tab|esc|space|shift|ctrl\+\S+|cmd\+\S+|alt\+\S+|[↑↓←→]+(?:\/[↑↓←→]+)?|[b-hj-z](?:\/[b-hj-z])?)(?:\/\S+)?(?:\s|$)/i;function uu(e){return e.split(`·`).map(e=>e.trim()).filter(e=>e&&!lu.test(e)).join(` · `)}function du(e){return cu()?uu(e):e}function fu(e){if(typeof e!=`string`)return``;let t=e.replace(/\s+/g,` `).trim();if(t.length===0)return``;let n=[...t];return n.length<=40?t:`${n.slice(0,40).join(``)}…`}function pu(e){let t=hu(e);return t<0||t===e.length-1?{base:e,dir:``}:{base:e.slice(t+1),dir:e.slice(0,t+1)}}function mu(e){return/^(?:[A-Za-z]:(?:[\\/]|$)|\\\\)/.test(e)}function hu(e){return mu(e)||/^~\\/.test(e)?Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`)):e.lastIndexOf(`/`)}function gu(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>e.toLowerCase().includes(n)):e}function _u(e){return e.startsWith(`~`)||e.includes(`/`)||mu(e)}function vu(e,t){return t?e===`~`?t:e.startsWith(`~/`)||e.startsWith(`~\\`)?t+e.slice(1):e:e}function yu(e){let t=mu(e),n=t&&/^[A-Za-z]:/.test(e)?3:1,r=e.length;for(;r>n&&(e[r-1]===`/`||t&&e[r-1]===`\\`);)r--;return e.slice(0,r)}var bu=/^(?:(?:https?|ssh|git):\/\/[A-Za-z0-9[]\S*|[A-Za-z0-9._-]+@[A-Za-z0-9][A-Za-z0-9.-]*:\S+)$/i,xu=/^[A-Za-z0-9][A-Za-z0-9-]{0,38}\/(?![.]+(?:git)?$)[A-Za-z0-9._-]{1,100}$/i;function Su(e){let t=e.trim();return bu.test(t)||xu.test(t)?t:null}var Cu=/^(?:https?:\/\/(?:www\.)?github\.com\/|(?:ssh:\/\/)?git@github\.com[:/])/i;function wu(e){let t=e.trim(),n=t.replace(Cu,``);if(n===t)return xu.test(t)?t.replace(/\.git$/i,``).toLowerCase():null;let[r,i]=n.split(/[/?#]/),a=i?.replace(/\.git$/i,``);return r&&a?`${r}/${a}`.toLowerCase():null}function Tu(e,t){return e.filter(e=>e.enabled!==!1||e.id===t)}function Eu(e,t){return(e.find(e=>e.id===t)??e.find(e=>e.ready!==!1)??e[0])?.id??``}function Du(e,t){return!e||e.acceptsModel===!1?[]:[{id:``,label:t},...(e.models??[]).map(e=>({id:e.id,label:e.label??e.id}))]}function Ou(e,t,n){return t?e.find(e=>e.id===t)?.label??t:n}function ku(e,t){return e.includes(t)?e.length>1?e.filter(e=>e!==t):e:[...e,t]}function Au(e){let[t,n,...r]=e;return!t||!n?t??``:r.length>0?`${t} + ${n} +${r.length}`:`${t} + ${n}`}function ju(e){if(!(e instanceof Error)||!(`code`in e)||e.code!==`PARTIAL_FANOUT`)return;let t=`detail`in e&&e.detail&&typeof e.detail==`object`?e.detail:void 0;return t&&`groupId`in t&&typeof t.groupId==`string`&&t.groupId?t.groupId:void 0}function Mu(e){let[t,...n]=e;if(!t)return``;let r=pu(t).base;return n.length>0?`${r} +${n.length}`:r}function Nu(e,t){return e.includes(t)?e.filter(e=>e!==t):e.length>=8?e:[...e,t]}function Pu(e,t){if(!/^[1-9]$/.test(e))return null;let n=Number(e)-1;return n<t?n:null}function Fu(e){let[t,...n]=e.repos;if(!t)throw Error(`no repo`);let r=e.at?fu(e.prompt):``,i=(e.engines?.length??0)>1;return{repo:t.repo,...t.baseRef?{baseBranch:t.baseRef}:{},...n.length>0?{extraRepos:n.map(e=>({repo:e.repo,...e.baseRef?{baseRef:e.baseRef}:{}}))}:{},...!i&&n.length>0&&e.branch?{branch:e.branch}:{},...e.at?{scheduleAt:e.at.toISOString(),schedulePrompt:e.prompt}:e.prompt?{prompt:e.prompt}:{},...r?{title:r}:{},...i?{agents:(e.engines??[]).map(e=>`${e}:1`).join(`,`)}:{},...!i&&e.engine?{engine:e.engine}:{},...!i&&e.engine&&e.commandFrom?{commandFrom:e.commandFrom}:{},...!i&&e.model?{model:e.model}:{}}}async function Iu(e,t,n){let r=t?{engine:t}:{},{taskId:i}=await e(`task.openScratch`,r);return await e(`tab.new`,{taskId:i,kind:`engine`,...r,prompt:n.trim()}),i}async function Lu(e,t,n,r,i=r.trim(),a){let o=n?{engine:n}:{},s=r.trim()?fu(r):``,{taskId:c}=await e(`task.openCheckout`,{repo:t,...o,...s?{title:s}:{},...a?{scheduleAt:a.toISOString(),schedulePrompt:i}:{}});if(!(a||!c))return await e(`tab.new`,{taskId:c,kind:`engine`,...o,prompt:i}),c}function Ru(e,t){let n=e.querySelector(`[data-field="${t}"]`);(n?.matches(`input, textarea`)?n:n?.querySelector(`[tabindex='0']`))?.focus()}function zu(e,t,n){let r=document.activeElement?.closest(`[data-field]`)?.getAttribute(`data-field`),i=t.findIndex(e=>e===r),a=t[i<0?0:(i+n+t.length)%t.length];a&&Ru(e,a)}var Bu=new WeakMap,Vu=200,Hu=e=>`client`in e?e.client:e,Uu=(e,t)=>t?`${e} ${JSON.stringify(t)}`:e;function Y(e,t,n){return Bu.get(Hu(e))?.get(Uu(t,n))}function Wu(e,t,n,r){let i=Hu(e),a=Bu.get(i)??new Map,o=Uu(t,n);a.delete(o),a.set(o,r),Bu.set(i,a);for(let e of a.keys()){if(a.size<=Vu)break;a.delete(e)}return r}function Gu(e,t,n){return Hu(e).request(t,n).then(r=>Wu(e,t,n,r))}function X(e,t,n){return n&&n!==`leaf-1`?`${e}::${t}::${n}`:`${e}::${t}`}function Ku(e,t,n){let r=t?{repo:t}:{},[i]=(0,h.useState)(()=>{let t=Y(e,`engines.list`,r),i=t?Tu(t.engines):[];return{offered:i,engine:t?Eu(i,n??t.preferred):``}}),[a,o]=(0,h.useState)(i.offered),[s,c]=(0,h.useState)(i.engine);return(0,h.useEffect)(()=>{Gu(e,`engines.list`,r).then(e=>{let t=Tu(e.engines);o(t),c(Eu(t,n??e.preferred))}).catch(()=>o([]))},[e]),{engines:a,engine:s,setEngine:c}}var qu=`shell`,Ju=`pane:`,Yu=e=>e.startsWith(Ju),Xu=e=>e.slice(5);function Zu(e){let[t,n]=(0,h.useState)(()=>Y(e,`plugin.panes`)?.panes??[]);return(0,h.useEffect)(()=>{Gu(e,`plugin.panes`).then(e=>n(e.panes)).catch(()=>n([]))},[e]),t}function Qu(e){let t=[...e.engines,...e.withShell?[{id:qu,name:z(`tab.shell`)}]:[],...(e.panes??[]).map(e=>({id:Ju+e.id,name:e.title}))];return(0,V.jsx)(su,{label:z(`newTask.engine`),field:`engine`,value:e.value,onChange:e.onChange,choices:t.map(e=>({id:e.id,label:e.name,dim:`ready`in e&&e.ready===!1,title:`ready`in e&&e.ready===!1?z(`newTask.notReady`):void 0}))})}function $u(e,t){return ed(e,t,{kind:`engine`,latest:!0}).catch(e=>I(String(e),`error`))}async function ed(e,t,n){let{tabId:r,taskId:i}=await e.client.request(`tab.new`,{taskId:t,kind:n.kind,...n.engine?{engine:n.engine}:{},...n.prompt?{prompt:n.prompt}:{},...n.latest?{latest:!0}:{},...n.replaceTab?{replaceTab:n.replaceTab}:{}});if(i){e.selectWhenListed(i);return}await e.refreshTabsNow(t),n.replaceTab&&await No(X(t,r))?.reattach(),e.select(t,r)}async function td(e){await ed(e,(await e.client.request(`task.openScratch`,{})).taskId,{kind:`shell`})}var nd=[`1`,`2`,`3`,`4`,`5`],rd=[`tab`,`fork`,`scratch`],id=[`message`,`attempts`,`engine`,`fork-base`,`destination`];function ad(e){B();let{model:t,taskId:n}=e,r=t.tasks.get()?.tasks.find(e=>e.id===n),i=Ku(t,r?.repo),[a,o]=(0,h.useState)(e.destination??`tab`),[s,c]=(0,h.useState)(e.context??`fresh`),[l,u]=(0,h.useState)(``),[d,f]=(0,h.useState)(`1`),[p,m]=(0,h.useState)(r?.branch??`main`),{busy:g,error:_,setError:v,submit:y}=xi(),{attachments:b,attach:x,remove:S,ready:C}=au(t,v),w=s===`fresh`&&a!==`fork`,T=a===`tab`&&s===`fresh`,E=Zu(t),D=i.engine===`shell`&&!w||Yu(i.engine)&&!T?``:i.engine,O=D===qu,k=Yu(D),A=a===`fork`,ee=(e,t)=>{let n=e===`scratch`&&t===`continue`&&a===`scratch`?`tab`:e;o(n),c(n===`scratch`?`fresh`:t)},j=()=>{let r=t.selection.get();return e.sourceTabId??(r.taskId===n?r.tabId:null)??`tab-1`},te=()=>t.tasks.get()?.tasks.find(e=>e.id===n)?.tabStatus?.[j()]?.reason===`dead`,M=async()=>{let e=await t.client.request(`tab.handoff`,{taskId:n,tabId:j()});if(e.kind===`handoff`&&e.prompt)return e.prompt;throw Error(e.kind===`no-transcript`?G(`terminal`,`tab.noTranscriptToHandOff`,{engine:e.engine??``}):G(`terminal`,`tab.nothingToFork`))},N=()=>y(async()=>{let e=s===`continue`&&a===`tab`&&!O&&!k&&te(),i=[s===`continue`&&!e?await M():``,eu(l.trim(),await C())].filter(Boolean).join(`
|
|
38
38
|
|
|
39
|
-
`);if(a===`scratch`){let e=await t.client.request(`task.openScratch`,O?{}:{engine:D});O?await ed(t,e.taskId,{kind:`shell`}):t.selectWhenListed(e.taskId)}else if(A){if(!r)throw Error(G(`terminal`,`tab.tabGone`));if(!l.trim())throw Error(z(`taskops.forkNeedsMessage`));let e=p.trim()||r.branch,a;try{a=await t.client.request(`tab.forkTask`,{repo:r.repo,baseBranch:e,prompt:i,...D?{engine:D}:{},...Number(d)>1?{count:Number(d)}:{},...e===r.branch?{forkFrom:n}:{}})}catch(e){let t=ju(e);if(!t)throw e;I(e instanceof Error?e.message:String(e),`error`),ge(t);return}a.forkRefused&&I(z(`taskops.forkLeftBehind`,{reason:a.forkRefused}));let o=a.taskIds[0];a.groupId?ge(a.groupId):o&&t.selectWhenListed(o)}else if(O)await ed(t,n,{kind:`shell`});else if(k){let{selection:e}=t,r=e.get().taskId===n?e.get().tabId:null,i=await t.client.request(`plugin.paneOpen`,{taskId:n,pane:Xu(D),...r?{tabId:r}:{}});await t.refreshTabsNow(n),t.select(n,i.tabId)}else await ed(t,n,{kind:`engine`,engine:D,prompt:i,...e?{replaceTab:j()}:{}})});return(0,V.jsx)(bi,{title:G(`terminal`,`tab.newChat.title`),wide:!0,children:(0,V.jsxs)(`form`,{className:Wr,onKeyDown:e=>{if(e.key===`Tab`&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&(A||!e.shiftKey))e.preventDefault(),e.stopPropagation(),A?zu(e.currentTarget,id,e.shiftKey?-1:1):ee(rd[(rd.indexOf(a)+1)%rd.length]??`tab`,s);else if(e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`e`){e.preventDefault(),e.stopPropagation();let t=i.engines.filter(e=>e.ready!==!1),n=t[(t.findIndex(e=>e.id===i.engine)+1)%t.length];n&&i.setEngine(n.id)}else e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`f`?(e.preventDefault(),e.stopPropagation(),ee(a,s===`fresh`?`continue`:`fresh`)):e.key===`Enter`&&A&&e.target.closest(`[data-field=attempts], [data-field=engine]`)&&(e.preventDefault(),e.currentTarget.requestSubmit())},onSubmit:e=>{e.preventDefault(),N()},onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),x(Array.from(e.dataTransfer.files))},children:[(0,V.jsxs)(`div`,{className:Pr,children:[(0,V.jsx)(`span`,{className:`${U} text-muted`,children:G(`terminal`,`tab.newChat.engine`)}),(0,V.jsx)(Qu,{engines:i.engines,value:D,onChange:i.setEngine,withShell:w,panes:T?E:[]})]}),(0,V.jsxs)(`div`,{className:Pr,children:[(0,V.jsx)(`span`,{className:`${U} text-muted`,children:G(`terminal`,`tab.newChat.destLabel`)}),(0,V.jsx)(su,{label:G(`terminal`,`tab.newChat.destLabel`),field:`destination`,value:a,onChange:e=>ee(e,s),choices:rd.map(e=>({id:e,label:G(`terminal`,`tab.newChat.dest${e===`tab`?`Tab`:e===`fork`?`Fork`:`Scratch`}`)}))})]}),(0,V.jsxs)(`div`,{className:Pr,children:[(0,V.jsxs)(`span`,{className:`${U} text-muted`,children:[G(`terminal`,`tab.newChat.ctxLabel`),` `,(0,V.jsx)(`span`,{className:`keys-only`,children:`ctrl+f`})]}),(0,V.jsx)(su,{label:G(`terminal`,`tab.newChat.ctxLabel`),field:`context`,value:s,onChange:e=>ee(a,e===`continue`?`continue`:`fresh`),choices:[`fresh`,`continue`].map(e=>({id:e,label:G(`terminal`,`tab.newChat.ctx${e===`fresh`?`Fresh`:`Continue`}`)}))})]}),A&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,V.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:G(`quickTask`,`attemptsLabel`)}),(0,V.jsx)(su,{label:G(`quickTask`,`attemptsLabel`),field:`attempts`,value:d,onChange:f,choices:nd.map(e=>({id:e,label:e}))})]}),(0,V.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,V.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:z(`taskops.forkBranch`)}),(0,V.jsx)(`input`,{className:jr,"data-field":`fork-base`,spellCheck:!1,value:p,onChange:e=>m(e.target.value)})]})]}),!O&&!k&&a!==`scratch`&&(0,V.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,V.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:z(`newChat.prompt`)}),(0,V.jsx)(`textarea`,{className:`${jr} min-h-18 max-h-[50vh] leading-[1.45]`,"data-field":`message`,autoFocus:!0,rows:4,placeholder:z(`newChat.promptPlaceholder`),value:l,onChange:e=>u(e.target.value),onPaste:e=>{let t=Array.from(e.clipboardData.files);t.length!==0&&(e.preventDefault(),x(t))},onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&e.currentTarget.form?.requestSubmit()}})]}),(0,V.jsx)(ou,{attachments:b,onRemove:S}),cu()?(0,V.jsx)(`p`,{className:`text-muted`,children:z(`pages.attachHintTouch`)}):(0,V.jsx)(`p`,{className:`keys-only mx-0 mt-2 mb-0 ${wr}`,children:G(`quickTask`,`legend`)}),_&&(0,V.jsx)(`p`,{className:`text-error`,children:_}),(0,V.jsx)(Ti,{busy:g,submitLabel:z(`newChat.start`)})]})})}var od=e=>e.split(`/`).filter(Boolean).pop()??e;function sd(e,t,n=``){let r=od(e),i=t.filter(t=>(t.repo!==e||t.host!==n)&&od(t.repo)===r);if(i.length===0)return r;let a=e=>e.split(`/`).filter(Boolean).slice(-2).join(`/`);return i.some(e=>e.host===n)?i.some(t=>t.host!==n&&a(t.repo)===a(e))&&n?`${n}:${a(e)}`:a(e):n?`${n}:${r}`:r}var cd=e=>e.startsWith(`root:`)?null:e.split(`/`).slice(-2).join(`/`);function ld(e,t){let n=od(e.repo),r=t.filter(t=>t!==e&&od(t.repo)===n);if(r.length===0)return n;let i=e.repoId,a=i?cd(i):null;return i&&a?r.some(e=>e.repoId&&e.repoId!==i&&cd(e.repoId)===a)?i:a:sd(e.repo,[e,...r].map(e=>({repo:e.repo,host:``})))}var ud=/\s+#\d+\/\d+$/,dd=(e,t)=>(e.createdAt??``).localeCompare(t.createdAt??``)||e.id.localeCompare(t.id),fd=e=>e.groupId&&e.kind!==`main`?`${e.machine?.id??``}\0${e.groupId}`:null;function pd(e){let t=new Map;for(let n of e){let e=fd(n);if(e===null)continue;let r=t.get(e);r?r.push(n):t.set(e,[n])}for(let[e,n]of t)n.length<2?t.delete(e):n.sort(dd);return t}function md(e){return(e[0]?.label??``).replace(ud,``)}function hd(e){let t=e=>e.engine?.name??e.label,n=new Map;for(let r of e)n.set(t(r),(n.get(t(r))??0)+1);let r=new Map;return new Map(e.map(e=>{let i=t(e),a=(r.get(i)??0)+1;return r.set(i,a),[e.id,(n.get(i)??0)>1?`${i} #${a}`:i]}))}var gd=[`default`,`recent`,`attention`,`name`],_d={folded:new Set,opened:new Set},vd=e=>{let t=Date.parse(e??``);return Number.isFinite(t)?t:0},yd=e=>vd(e.updatedAt??e.createdAt),bd=e=>vd(e.createdAt),Z=(e,t)=>bd(t)-bd(e)||t.id.localeCompare(e.id),xd=(e,t)=>yd(t)-yd(e)||t.id.localeCompare(e.id),Sd=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`}),Cd={default:null,recent:Z,attention:(e,t)=>e.rank-t.rank||xd(e,t),name:(e,t)=>Sd.compare(e.label.trim(),t.label.trim())||e.id.localeCompare(t.id)},wd=`~scratch`,Td=e=>e.kind===`dir`&&(e.scratch===!0||e.noProject===!0);function Ed(e,t){return[...e].sort((e,t)=>(e.order??e.rank)-(t.order??t.rank)).sort(kd(Cd[t]))}function Dd(e,t=`default`){let n=[...e].sort((e,t)=>(e.order??e.rank)-(t.order??t.rank)),r=new Map;for(let e of n){let t=Td(e)?wd:e.repo,n=r.get(t);n?n.push(e):r.set(t,[e])}let i=Cd[t],a=[...r].map(([e,t])=>{let n=t.sort(kd(i));if(e===`~scratch`&&t.every(Td))return{repo:``,label:z(`rail.noProject`),tasks:n,key:wd,noProject:!0};let r=t.find(e=>e.repoId)?.repoId;return{repo:e,label:od(e),tasks:n,...r?{repoId:r}:{}}});return[...a.filter(e=>e.noProject),...a.filter(e=>!e.noProject)]}var Od=e=>e.kind===`main`?0:e.pinned?1:2,kd=e=>(t,n)=>Od(t)-Od(n)||(e?e(t,n):0);function Ad(e,t){let n=new Set([e.id]);for(let r=e.parentTaskId;r!==void 0;r=t.get(r)?.parentTaskId){if(n.has(r))return r===e.id;n.add(r)}return!1}function jd(e){let t=new Map;for(let n of e)for(let e of n.tasks)t.set(e.id,e);let n=new Map,r=new Set;for(let e of t.values()){let i=e.parentTaskId;if(i===void 0||!t.has(i)||Ad(e,t))continue;r.add(e.id);let a=n.get(i);a?a.push(e):n.set(i,[e])}return{children:n,nested:r}}function Md(e,t,n=[]){for(let r of e.get(t)??[])n.push(r.id),Md(e,r.id,n);return n}function Nd(e,t,n,r){return r.folded.has(e)?!0:r.opened.has(e)||t<=5?!1:r.selectedId===void 0||!n.includes(r.selectedId)}function Pd(e,t=``,n=_d,r=0,i=!0){let a=t.trim(),o=(...e)=>e.some(e=>e!==``&&$c(a,e)),{children:s,nested:c}=jd(e),l=[];for(let t of e){let e=a===``||o(t.label),u=t.machine===void 0?{}:{machine:t.machine},d=t.key??t.repo,f=t=>e||o(t.label,t.title,t.branch,od(t.repo)),p=e=>f(e)||(s.get(e.id)??[]).some(p),m=(e,t,r,i=!1,o)=>{let c=r+1,l=t.machine?{machine:t.machine.id}:{},u=s.get(t.id),d=u?Md(s,t.id):[],m=u!==void 0&&a===``&&Nd(t.id,u.length,d,n);e.push({id:t.id,kind:`task`,task:t,depth:Math.min(c,3),...c>3?{level:c}:{},...u?{fold:{count:d.length,collapsed:m,descendantIds:d}}:{},...o===void 0?{}:{attempt:o},...l});let g=i||f(t);m||h(e,(u??[]).filter(e=>g||p(e)),r+1,g)},h=(e,t,n,r)=>{let a=i?pd(t):new Map,o=new Set;for(let i of t){let t=fd(i),s=t===null?void 0:a.get(t);if(t===null||!s){m(e,i,n,r);continue}if(o.has(t))continue;o.add(t);let c=s[0];if(!c)continue;let l=n+1;e.push({id:`round:${c.machine?.id??``}:${c.groupId}`,kind:`round`,groupId:c.groupId??``,title:md(s),tasks:s,depth:Math.min(l,3),...c.machine?{machine:c.machine.id}:{}});let u=hd(s);for(let t of s)m(e,t,n+1,r,u.get(t.id))}},g=[];h(g,t.tasks.filter(e=>!c.has(e.id)&&p(e)),r,!1),!(g.length===0&&!e)&&l.push({id:`project:${d}`,kind:`project`,repo:t.repo,label:t.label,...t.noProject?{noProject:!0}:{},...u},...g)}return l}var Fd=e=>Math.max(0,...e.tasks.map(bd));function Id(e){let t=e.tasks.filter(e=>!e.routine),n=e.remote.filter(e=>!e.routine),r=[...Dd(t,e.sort).map(e=>({group:e})),...e.machines.flatMap(t=>Dd(n.filter(e=>e.machine?.id===t.alias),e.sort).map(e=>({group:e,machine:t.alias})))],i=new Map;for(let e of r){let{repoId:t,repo:n}=e.group,r=e.group.noProject?wd:t??(e.machine===void 0?n:`${e.machine}\0${n}`),a=i.get(r);a?a.push(e):i.set(r,[e])}let a=Cd[e.sort],o=new Map,s=[];for(let[e,t]of i){let n=t[0];if(!n)continue;let r=t.flatMap(e=>e.group.tasks),i=n.group.noProject===!0,c={repo:n.group.repo,label:i?n.group.label:``,key:e,tasks:t.length===1?n.group.tasks:r.sort(kd(a)),...n.group.repoId?{repoId:n.group.repoId}:{},...n.machine===void 0||i?{}:{machine:n.machine},...i?{noProject:!0}:{}};s.push(c);for(let e of t)o.set(e,c)}let c=new Map(s.map(e=>[e,e.noProject?e.label:ld(e,s)])),l=s.map(e=>({...e,label:c.get(e)??e.label}));return e.sort===`recent`&&l.sort((e,t)=>Fd(t)-Fd(e)),e.sort===`name`&&l.sort((e,t)=>Sd.compare(e.label,t.label)),l.sort((e,t)=>Number(t.noProject===!0)-Number(e.noProject===!0)),{rows:Pd(l,e.query,e.fold),groups:r.filter(e=>e.machine===void 0).map(e=>{let t=o.get(e);return{...e.group,label:(t&&c.get(t))??e.group.label}})}}function Ld(e){return e.title??e.engineName??(e.kind===`engine`?z(`tab.engine`):z(`tab.shell`))}function Rd(e,t){if(t.size===0)return e;let n=!1;return e.filter(e=>e.kind===`project`||e.kind===`state`?(n=t.has(e.id),!0):!n)}function zd(e){return e.kind===`leaf`?[e]:e.children.flatMap(zd)}function Bd(e){return!!e&&zd(e.root).length>1}function Vd(e){let t=[],n=(e,r,i,a,o,s,c)=>{if(e.kind===`leaf`){t.push({id:e.id,x:r,y:i,w:a,h:o,left:s,top:c});return}let l=e.children.length;e.children.forEach((t,u)=>{e.orientation===`row`?n(t,r+a*u/l,i,a/l,o,u>0||s,c):n(t,r,i+o*u/l,a,o/l,s,u>0||c)})};return n(e,0,0,1,1,!1,!1),t}function Hd(e,t,n=1){let r=zd(e.root).map(e=>e.id),i=r.indexOf(t);return r[(Math.max(0,i)+n+r.length)%r.length]??t}function Ud(e,t){let n=new Map,r=new Map;for(let i of zd(e.root)){if(i.title){r.set(i.id,i.title);continue}let e=i.own?t:`shell`,a=(n.get(e)??0)+1;n.set(e,a),r.set(i.id,a===1?e:`${e} ${a}`)}return r}function Wd(e,t,n){return e.kind===`engine`&&zd(t.root).some(e=>e.id===n&&e.own)}function Gd(e){return e.alive!==!1||!!e.split&&!zd(e.split.root).some(e=>e.own)}function Kd(e){return zd(e.root).map(e=>e.id).join(`,`)}function qd(e){return!(e instanceof HTMLElement)||e.closest(`.xterm`)?!1:e.isContentEditable||[`INPUT`,`TEXTAREA`,`SELECT`].includes(e.tagName)}function Jd(e){return e instanceof HTMLElement&&!!e.closest(`.rail, button, a`)}var Yd=e=>e.tabs.get()[e.selection.get().taskId??``]??[];function Xd(e){let{taskId:t,tabId:n}=e.selection.get(),r=Yd(e);return{taskId:t,tabs:r,at:r.findIndex(e=>e.id===n)}}function Zd(e,t){let{taskId:n,tabs:r}=Xd(e),i=r[t];!n||!i||e.select(n,i.id)}function Qd(e){let{taskId:t,tabs:n,at:r}=Xd(e),i=n[r];!t||!i||C.set((0,V.jsx)(Si,{title:z(`menu.renameTab`),initial:Ld(i),submitLabel:z(`dialog.save`),onSubmit:async n=>{await e.renameTab(t,i.id,n)}}))}var $d=e=>!!e.selection.get().taskId,ef=e=>Yd(e).length>0,tf=[{id:`help.open`,chords:[`f1`],prefix:!1,run:kl},{id:`focus.next`,chords:[`f4`],prefix:!1,run:()=>bo(1)},{id:`chat.tab.chooseEngine`,chords:[`ctrl+e`],prefix:!1,surface:`workspace`,live:$d,run:e=>{let{taskId:t}=e.selection.get();t&&C.set((0,V.jsx)(ad,{model:e,taskId:t}))}},{id:`chat.tab.rename`,chords:[`f2`],prefix:!1,surface:`workspace`,live:e=>{let{tabs:t,at:n}=Xd(e);return!!t[n]&&!Bd(t[n]?.split)},run:Qd},{id:`chat.tab.cycle-next`,chords:[`ctrl+]`],prefix:!1,surface:`workspace`,live:ef,run:e=>Zd(e,(Xd(e).at+1)%Yd(e).length)},{id:`chat.tab.cycle-prev`,chords:[`ctrl+[`],prefix:!1,surface:`workspace`,live:ef,run:e=>Zd(e,(Xd(e).at-1+Yd(e).length)%Yd(e).length)},{id:`chat.tab.goto`,chords:[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`].map(e=>`ctrl+${e}`),prefix:!1,surface:`workspace`,live:ef,run:(e,t=``)=>{let n=wo().find(e=>e.id===`chat.tab.goto`&&!e.prefix)?.chords.indexOf(t)??-1;n>=0&&Zd(e,n)}},{id:`attention.next`,chords:[`f7`],prefix:!1,run:e=>rf(e)}];So(()=>tf);function nf(e){(0,h.useEffect)(()=>{let t=t=>{if(C.get()||qd(t.target))return;let n=O.get();if(n===`worktrees`)return;let r=Do()??($d(e)?`workspace`:`sidebar`),{taskId:i}=e.selection.get();if(!n&&i&&!t.ctrlKey&&!t.shiftKey&&!t.metaKey&&!t.altKey&&t.key===`Enter`&&!ef(e)&&!Jd(t.target)){t.preventDefault(),t.stopPropagation(),C.set((0,V.jsx)(ad,{model:e,taskId:i}));return}let a=qc(t),o=wo().filter(t=>!t.prefix&&!t.native&&t.chords.some(e=>a.includes(e))&&To(t,r)&&!(n&&t.surface)&&t.live?.(e)!==!1).sort((e,t)=>Eo(e,r)-Eo(t,r))[0];o&&(t.preventDefault(),t.stopPropagation(),o.run(e,a.find(e=>o.chords.includes(e))))};return window.addEventListener(`keydown`,t,{capture:!0}),()=>window.removeEventListener(`keydown`,t,{capture:!0})},[e])}function rf(e){let t=e.tasks.get();if(!t)return;let n=Il(t.attention,t.tasks.map(e=>e.id),e.selection.get());if(!n){I(z(`inbox.empty`));return}if(Nl(n.state)){zl(e,n);return}n.taskId!==null&&(e.select(n.taskId,n.tabId),Rl(e,n))}async function af(e,t){try{if(t.kind===`action`){await e.client.request(`plugin.chordAction`,{chord:t.chord});return}let{taskId:n,tabId:r}=e.selection.get();if(!n){I(z(`keys.pluginNoTask`),`error`);return}let i=await e.client.request(`plugin.paneOpen`,{taskId:n,pane:t.target,...r?{tabId:r}:{}});await e.refreshTabsNow(n),e.select(n,i.tabId)}catch(e){I(W(e),`error`)}}function of(e){(0,h.useEffect)(()=>{let t=t=>{let n=ua.get().plugins;if(n.length===0||!Ca({dialog:C.get()!==null,page:O.get()})||qd(t.target))return;let r=Sa(n,qc(t));r&&(t.preventDefault(),t.stopImmediatePropagation(),af(e,r))};return window.addEventListener(`keydown`,t,{capture:!0}),()=>window.removeEventListener(`keydown`,t,{capture:!0})},[e])}var sf=`prefix.moreCommands`,cf=/^ctrl\+[^+]+$/;function lf(e){return cf.test(e)?e.slice(5):null}function uf(e){let t=Qc(e.bindingId);if(!t)return null;if(e.reachability.direct.has(e.bindingId)){let e=t.keys[0];if(e)return ca(e)}if(e.prefixKey&&e.reachability.prefix.has(e.bindingId)){let n=t.prefixKeys?.[0];if(n)return`${ca(e.prefixKey)} ${ca(n)}`}return null}function df(e,t){let n=ia.filter(t=>e.direct.has(t.id)).flatMap(e=>{let t=e.keys.flatMap(e=>lf(e)??[]);return t.length>2?[{stroke:`${t[0]}-${t.at(-1)}`,action:e.id}]:t.map(t=>({stroke:t,action:e.id}))}),r=t?lf(t):null;return r&&e.prefix.size>0&&n.push({stroke:r,action:sf}),n}var ff=4e3,pf=180,mf=ff,hf=v({guide:null,entries:[]}),gf=1;function _f(e,t){let n={id:gf++,stroke:e,action:t,at:Date.now()};hf.set({guide:null,entries:[...hf.get().entries,n].slice(-3)})}var vf=`modulepreload`,yf=function(e){return`/`+e},bf={},xf=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=yf(t,n),t=s(t),t in bf)return;bf[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:vf,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Sf=8,Cf=32,wf=3e3,Tf=100,Ef=new WeakMap,Df=null;function Of(e){let t=Ef.get(e);return t||(t={entries:new Map,snapshots:new Map,left:null},Ef.set(e,t)),t}function kf(){return Df||(Df=document.createElement(`div`),Df.style.display=`none`,document.body.append(Df)),Df}function Af(e,t,n){e.snapshots.delete(t),e.snapshots.set(t,n);for(let t of e.snapshots.keys()){if(e.snapshots.size<=Cf)break;e.snapshots.delete(t)}}function jf(e,t,n){e.entries.delete(t.key),t.leaving!==null&&window.clearTimeout(t.leaving),t.leaving=null,n?Af(e,t.key,t.handle.snapshot()):e.snapshots.delete(t.key),t.handle.dispose(),t.box.remove()}function Mf(e){let t=[...e.entries.values()].filter(e=>e.slot.parkedAt!==null);t.sort((e,t)=>(e.slot.parkedAt??0)-(t.slot.parkedAt??0));for(let n of t.slice(0,Math.max(0,t.length-Sf)))jf(e,n,!0)}function Nf(e,t){return Of(e).entries.get(t)?.handle??null}function Pf(e,t,n,r){return Of(e).entries.get(X(t,n,r))?.slot.parkedAt!=null}async function Ff(e,t){let n=Of(e.client),r=X(e.taskId,e.tabId,e.leafId),i=n.entries.get(r);if(i&&i.slot.parkedAt!==null){let{slot:r,handle:a,box:o}=i;return r.parkedAt=null,r.binding=t,i.leaving!==null&&(window.clearTimeout(i.leaving),i.leaving=null,o.classList.remove(`is-leaving`)),n.left=null,zf(n),e.host.append(o),t.setNotice(r.notice),t.onScrolled(r.scrolled),a.term.refresh(0,a.term.rows-1),e.focusOnMount&&a.term.focus(),{handle:a,release:()=>If(n,i)}}let a=document.createElement(`div`);a.className=Nn,e.host.append(a),Lf(n,e.host);let o=!i,s={binding:t,notice:{kind:`none`},scrolled:0,parkedAt:null},c=null,l=o?n.snapshots.get(r):void 0;l&&n.snapshots.delete(r);let{mountTerminal:u}=await xf(async()=>{let{mountTerminal:e}=await import(`./term-mount-D3IRbkGD.js`);return{mountTerminal:e}},__vite__mapDeps([0,1])),d=u({...e,el:a,snapshot:l,onPainted:()=>zf(n),setNotice:e=>{s.notice=e,s.binding?.setNotice(e)},onScrolled:e=>{s.scrolled=e,s.binding?.onScrolled(e)},onFocusChange:e=>s.binding?.onFocusChange(e),onExit:e=>{s.binding?s.binding.onExit(e):c&&n.entries.get(r)===c&&jf(n,c,!1)},copyText:e=>s.binding?.copyText(e)??Promise.resolve(!1),pasteImage:()=>s.binding?.pasteImage()??Promise.resolve()});if(!o)return{handle:d,release:()=>{d.dispose(),a.remove()}};let f={key:r,handle:d,box:a,slot:s,leaving:null};return c=f,n.entries.set(r,f),{handle:d,release:()=>If(n,f)}}function If(e,t){let{slot:n}=t;e.entries.get(t.key)===t&&n.parkedAt===null&&(n.binding?.onFocusChange(!1),n.binding=null,t.handle.term.blur(),n.parkedAt=performance.now(),kf().append(t.box),e.left=t,Mf(e))}function Lf(e,t){let n=e.left;e.left=null,!(!n||n.slot.parkedAt===null||performance.now()-n.slot.parkedAt>Tf)&&e.entries.get(n.key)===n&&(n.box.classList.add(`is-leaving`),t.append(n.box),n.leaving=window.setTimeout(()=>Rf(e,n),wf))}function Rf(e,t){t.leaving!==null&&(window.clearTimeout(t.leaving),t.leaving=null,t.box.classList.remove(`is-leaving`),e.entries.get(t.key)===t&&t.slot.parkedAt!==null&&kf().append(t.box))}function zf(e){for(let t of e.entries.values())Rf(e,t)}async function Bf(e,t,n){return Ll(await e.request(`output.read`,{taskId:t,tab:n,source:`terminal`,limit:12}))}async function Vf(e,t,n,r){try{let i=await e.client.request(`tab.send`,{taskId:t,tabId:n,prompt:r});return i.delivered?!0:(I(z(`layout.composerNotSent`,{reason:i.reason??``}),`error`),!1)}catch(e){let t=e instanceof Ho?e.code:void 0;return I(t===`UNKNOWN_OP`?z(`layout.composerOldBridge`):t===`AWAITING_PERMISSION`?z(`layout.composerAtMenu`):e instanceof Error?e.message:String(e),`error`),!1}}async function Hf(e,t,n,r){let{client:i}=e,a=X(t,n),o=No(a)!==void 0||Pf(i,t,n);try{return o||await i.request(`term.attach`,{taskId:t,tabId:n}),await i.request(`term.input`,{stream:a,data:r}),!0}catch(e){return I(e instanceof Error?e.message:String(e),`error`),!1}finally{o||await i.request(`term.detach`,{stream:a}).catch(()=>{})}}async function Uf(e,t,n){try{return(await e.client.request(`gate.answer`,{gateId:t,...n})).delivered||I(z(`inbox.gateKept`)),!0}catch(e){return I(e instanceof Error?e.message:String(e),`error`),!1}}var Wf=(e,t,n)=>({id:e,cap:t,bytes:e=>`\x1b${e?`O`:`[`}${n}`}),Gf={id:`enter`,cap:`⏎`,bytes:()=>`\r`},Kf=[{id:`esc`,cap:`esc`,bytes:()=>`\x1B`},{id:`tab`,cap:`tab`,bytes:()=>` `},{id:`backtab`,cap:`⇧tab`,bytes:()=>`\x1B[Z`},{id:`interrupt`,cap:`^C`,bytes:()=>``},Wf(`up`,`↑`,`A`),Wf(`down`,`↓`,`B`),Wf(`left`,`←`,`D`),Wf(`right`,`→`,`C`),Gf],qf=e=>({id:`option-${e}`,cap:String(e),bytes:()=>String(e)}),Jf=[qf(1),qf(2),qf(3),qf(4),Gf];function Yf(e){if(e.length!==1)return e;let t=e.toUpperCase().charCodeAt(0);return t===32?`\0`:t===63?``:t>=64&&t<=95?String.fromCharCode(t&31):e}var Xf=`\x1B[27;2;13~`;function Zf(e){return e.key!==`Enter`||!e.shiftKey||e.ctrlKey||e.metaKey||e.altKey?!1:!e.isComposing&&e.keyCode!==229}function Qf(e){return e.type!==`keydown`||e.key.toLowerCase()!==`c`||e.altKey?null:e.metaKey||e.ctrlKey&&e.shiftKey?`copy`:e.ctrlKey?`interrupt-or-copy`:null}var $f=`mx-2.5 mt-0.5 mb-1.5 flex min-w-0 flex-col gap-1.5 font-mono text-meta`,ep=2e3;function tp(e,t,n){let[r,i]=(0,h.useState)(null),[a,o]=(0,h.useState)(0);return(0,h.useEffect)(()=>{if(!n)return;let r=!0,a=0,o=async()=>{try{let a=await Bf(e.client,t,n);r&&i(a)}catch{r&&i(e=>e??[])}r&&(a=window.setTimeout(o,ep))};return o(),()=>{r=!1,window.clearTimeout(a)}},[e,t,n,a]),{lines:r,refresh:()=>o(e=>e+1)}}function np(e){B();let{model:t,taskId:n,tabId:r,mode:i,gate:a}=e,{lines:o,refresh:s}=tp(t,n,r),c=(0,h.useRef)(null),[l,u]=(0,h.useState)(``),[d,f]=(0,h.useState)(!1);(0,h.useEffect)(()=>{let e=c.current;e&&(e.scrollTop=e.scrollHeight)},[o]);let p=async e=>{f(!0);let t=await e();return f(!1),t&&window.setTimeout(s,600),t},m=async()=>{let e=l.trim();!e||d||await p(()=>i===`gate`&&a?Uf(t,a.id,{text:e}):r?Vf(t,n,r,e):Promise.resolve(!1))&&u(``)};return(0,V.jsxs)(`div`,{className:$f,children:[a&&(0,V.jsx)(`p`,{className:`m-0 whitespace-pre-wrap wrap-anywhere text-ink`,children:a.question}),r&&(0,V.jsx)(`pre`,{ref:c,className:`m-0 max-h-60 overflow-y-auto rounded-sm border-hairline border-line bg-inset px-2 py-1.5 text-ink whitespace-pre-wrap wrap-anywhere`,"data-peek-lines":12,children:o===null?`…`:o.length===0?z(`inbox.noOutput`):o.join(`
|
|
39
|
+
`);if(a===`scratch`){let e=await t.client.request(`task.openScratch`,O?{}:{engine:D});O?await ed(t,e.taskId,{kind:`shell`}):t.selectWhenListed(e.taskId)}else if(A){if(!r)throw Error(G(`terminal`,`tab.tabGone`));if(!l.trim())throw Error(z(`taskops.forkNeedsMessage`));let e=p.trim()||r.branch,a;try{a=await t.client.request(`tab.forkTask`,{repo:r.repo,baseBranch:e,prompt:i,...D?{engine:D}:{},...Number(d)>1?{count:Number(d)}:{},...e===r.branch?{forkFrom:n}:{}})}catch(e){let t=ju(e);if(!t)throw e;I(e instanceof Error?e.message:String(e),`error`),ge(t);return}a.forkRefused&&I(z(`taskops.forkLeftBehind`,{reason:a.forkRefused}));let o=a.taskIds[0];a.groupId?ge(a.groupId):o&&t.selectWhenListed(o)}else if(O)await ed(t,n,{kind:`shell`});else if(k){let{selection:e}=t,r=e.get().taskId===n?e.get().tabId:null,i=await t.client.request(`plugin.paneOpen`,{taskId:n,pane:Xu(D),...r?{tabId:r}:{}});await t.refreshTabsNow(n),t.select(n,i.tabId)}else await ed(t,n,{kind:`engine`,engine:D,prompt:i,...e?{replaceTab:j()}:{}})});return(0,V.jsx)(bi,{title:G(`terminal`,`tab.newChat.title`),wide:!0,children:(0,V.jsxs)(`form`,{className:Wr,onKeyDown:e=>{if(e.key===`Tab`&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&(A||!e.shiftKey))e.preventDefault(),e.stopPropagation(),A?zu(e.currentTarget,id,e.shiftKey?-1:1):ee(rd[(rd.indexOf(a)+1)%rd.length]??`tab`,s);else if(e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`e`){e.preventDefault(),e.stopPropagation();let t=i.engines.filter(e=>e.ready!==!1),n=t[(t.findIndex(e=>e.id===i.engine)+1)%t.length];n&&i.setEngine(n.id)}else e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`f`?(e.preventDefault(),e.stopPropagation(),ee(a,s===`fresh`?`continue`:`fresh`)):e.key===`Enter`&&A&&e.target.closest(`[data-field=attempts], [data-field=engine]`)&&(e.preventDefault(),e.currentTarget.requestSubmit())},onSubmit:e=>{e.preventDefault(),N()},onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),x(Array.from(e.dataTransfer.files))},children:[(0,V.jsxs)(`div`,{className:Pr,children:[(0,V.jsx)(`span`,{className:`${U} text-muted`,children:G(`terminal`,`tab.newChat.engine`)}),(0,V.jsx)(Qu,{engines:i.engines,value:D,onChange:i.setEngine,withShell:w,panes:T?E:[]})]}),(0,V.jsxs)(`div`,{className:Pr,children:[(0,V.jsx)(`span`,{className:`${U} text-muted`,children:G(`terminal`,`tab.newChat.destLabel`)}),(0,V.jsx)(su,{label:G(`terminal`,`tab.newChat.destLabel`),field:`destination`,value:a,onChange:e=>ee(e,s),choices:rd.map(e=>({id:e,label:G(`terminal`,`tab.newChat.dest${e===`tab`?`Tab`:e===`fork`?`Fork`:`Scratch`}`)}))})]}),(0,V.jsxs)(`div`,{className:Pr,children:[(0,V.jsxs)(`span`,{className:`${U} text-muted`,children:[G(`terminal`,`tab.newChat.ctxLabel`),` `,(0,V.jsx)(`span`,{className:`keys-only`,children:`ctrl+f`})]}),(0,V.jsx)(su,{label:G(`terminal`,`tab.newChat.ctxLabel`),field:`context`,value:s,onChange:e=>ee(a,e===`continue`?`continue`:`fresh`),choices:[`fresh`,`continue`].map(e=>({id:e,label:G(`terminal`,`tab.newChat.ctx${e===`fresh`?`Fresh`:`Continue`}`)}))})]}),A&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,V.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:G(`quickTask`,`attemptsLabel`)}),(0,V.jsx)(su,{label:G(`quickTask`,`attemptsLabel`),field:`attempts`,value:d,onChange:f,choices:nd.map(e=>({id:e,label:e}))})]}),(0,V.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,V.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:z(`taskops.forkBranch`)}),(0,V.jsx)(`input`,{className:jr,"data-field":`fork-base`,spellCheck:!1,value:p,onChange:e=>m(e.target.value)})]})]}),!O&&!k&&a!==`scratch`&&(0,V.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,V.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:z(`newChat.prompt`)}),(0,V.jsx)(`textarea`,{className:`${jr} min-h-18 max-h-[50vh] leading-[1.45]`,"data-field":`message`,autoFocus:!0,rows:4,placeholder:z(`newChat.promptPlaceholder`),value:l,onChange:e=>u(e.target.value),onPaste:e=>{let t=Array.from(e.clipboardData.files);t.length!==0&&(e.preventDefault(),x(t))},onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&e.currentTarget.form?.requestSubmit()}})]}),(0,V.jsx)(ou,{attachments:b,onRemove:S}),cu()?(0,V.jsx)(`p`,{className:`text-muted`,children:z(`pages.attachHintTouch`)}):(0,V.jsx)(`p`,{className:`keys-only mx-0 mt-2 mb-0 ${wr}`,children:G(`quickTask`,`legend`)}),_&&(0,V.jsx)(`p`,{className:`text-error`,children:_}),(0,V.jsx)(Ti,{busy:g,submitLabel:z(`newChat.start`)})]})})}var od=e=>e.split(`/`).filter(Boolean).pop()??e;function sd(e,t,n=``){let r=od(e),i=t.filter(t=>(t.repo!==e||t.host!==n)&&od(t.repo)===r);if(i.length===0)return r;let a=e=>e.split(`/`).filter(Boolean).slice(-2).join(`/`);return i.some(e=>e.host===n)?i.some(t=>t.host!==n&&a(t.repo)===a(e))&&n?`${n}:${a(e)}`:a(e):n?`${n}:${r}`:r}var cd=e=>e.startsWith(`root:`)?null:e.split(`/`).slice(-2).join(`/`);function ld(e,t){let n=od(e.repo),r=t.filter(t=>t!==e&&od(t.repo)===n);if(r.length===0)return n;let i=e.repoId,a=i?cd(i):null;return i&&a?r.some(e=>e.repoId&&e.repoId!==i&&cd(e.repoId)===a)?i:a:sd(e.repo,[e,...r].map(e=>({repo:e.repo,host:``})))}var ud=/\s+#\d+\/\d+$/,dd=(e,t)=>(e.createdAt??``).localeCompare(t.createdAt??``)||e.id.localeCompare(t.id),fd=e=>e.groupId&&e.kind!==`main`?`${e.machine?.id??``}\0${e.groupId}`:null;function pd(e){let t=new Map;for(let n of e){let e=fd(n);if(e===null)continue;let r=t.get(e);r?r.push(n):t.set(e,[n])}for(let[e,n]of t)n.length<2?t.delete(e):n.sort(dd);return t}function md(e){return(e[0]?.label??``).replace(ud,``)}function hd(e){let t=e=>e.engine?.name??e.label,n=new Map;for(let r of e)n.set(t(r),(n.get(t(r))??0)+1);let r=new Map;return new Map(e.map(e=>{let i=t(e),a=(r.get(i)??0)+1;return r.set(i,a),[e.id,(n.get(i)??0)>1?`${i} #${a}`:i]}))}var gd=[`default`,`recent`,`attention`,`name`],_d={folded:new Set,opened:new Set},vd=e=>{let t=Date.parse(e??``);return Number.isFinite(t)?t:0},yd=e=>vd(e.updatedAt??e.createdAt),bd=e=>vd(e.createdAt),Z=(e,t)=>bd(t)-bd(e)||t.id.localeCompare(e.id),xd=(e,t)=>yd(t)-yd(e)||t.id.localeCompare(e.id),Sd=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`}),Cd={default:null,recent:Z,attention:(e,t)=>e.rank-t.rank||xd(e,t),name:(e,t)=>Sd.compare(e.label.trim(),t.label.trim())||e.id.localeCompare(t.id)},wd=`~scratch`,Td=e=>e.kind===`dir`&&(e.scratch===!0||e.noProject===!0);function Ed(e,t){return[...e].sort((e,t)=>(e.order??e.rank)-(t.order??t.rank)).sort(kd(Cd[t]))}function Dd(e,t=`default`){let n=[...e].sort((e,t)=>(e.order??e.rank)-(t.order??t.rank)),r=new Map;for(let e of n){let t=Td(e)?wd:e.repo,n=r.get(t);n?n.push(e):r.set(t,[e])}let i=Cd[t],a=[...r].map(([e,t])=>{let n=t.sort(kd(i));if(e===`~scratch`&&t.every(Td))return{repo:``,label:z(`rail.noProject`),tasks:n,key:wd,noProject:!0};let r=t.find(e=>e.repoId)?.repoId;return{repo:e,label:od(e),tasks:n,...r?{repoId:r}:{}}});return[...a.filter(e=>e.noProject),...a.filter(e=>!e.noProject)]}var Od=e=>e.kind===`main`?0:e.pinned?1:2,kd=e=>(t,n)=>Od(t)-Od(n)||(e?e(t,n):0);function Ad(e,t){let n=new Set([e.id]);for(let r=e.parentTaskId;r!==void 0;r=t.get(r)?.parentTaskId){if(n.has(r))return r===e.id;n.add(r)}return!1}function jd(e){let t=new Map;for(let n of e)for(let e of n.tasks)t.set(e.id,e);let n=new Map,r=new Set;for(let e of t.values()){let i=e.parentTaskId;if(i===void 0||!t.has(i)||Ad(e,t))continue;r.add(e.id);let a=n.get(i);a?a.push(e):n.set(i,[e])}return{children:n,nested:r}}function Md(e,t,n=[]){for(let r of e.get(t)??[])n.push(r.id),Md(e,r.id,n);return n}function Nd(e,t,n,r){return r.folded.has(e)?!0:r.opened.has(e)||t<=5?!1:r.selectedId===void 0||!n.includes(r.selectedId)}function Pd(e,t=``,n=_d,r=0,i=!0){let a=t.trim(),o=(...e)=>e.some(e=>e!==``&&$c(a,e)),{children:s,nested:c}=jd(e),l=[];for(let t of e){let e=a===``||o(t.label),u=t.machine===void 0?{}:{machine:t.machine},d=t.key??t.repo,f=t=>e||o(t.label,t.title,t.branch,od(t.repo)),p=e=>f(e)||(s.get(e.id)??[]).some(p),m=(e,t,r,i=!1,o)=>{let c=r+1,l=t.machine?{machine:t.machine.id}:{},u=s.get(t.id),d=u?Md(s,t.id):[],m=u!==void 0&&a===``&&Nd(t.id,u.length,d,n);e.push({id:t.id,kind:`task`,task:t,depth:Math.min(c,3),...c>3?{level:c}:{},...u?{fold:{count:d.length,collapsed:m,descendantIds:d}}:{},...o===void 0?{}:{attempt:o},...l});let g=i||f(t);m||h(e,(u??[]).filter(e=>g||p(e)),r+1,g)},h=(e,t,n,r)=>{let a=i?pd(t):new Map,o=new Set;for(let i of t){let t=fd(i),s=t===null?void 0:a.get(t);if(t===null||!s){m(e,i,n,r);continue}if(o.has(t))continue;o.add(t);let c=s[0];if(!c)continue;let l=n+1;e.push({id:`round:${c.machine?.id??``}:${c.groupId}`,kind:`round`,groupId:c.groupId??``,title:md(s),tasks:s,depth:Math.min(l,3),...c.machine?{machine:c.machine.id}:{}});let u=hd(s);for(let t of s)m(e,t,n+1,r,u.get(t.id))}},g=[];h(g,t.tasks.filter(e=>!c.has(e.id)&&p(e)),r,!1),!(g.length===0&&!e)&&l.push({id:`project:${d}`,kind:`project`,repo:t.repo,label:t.label,...t.noProject?{noProject:!0}:{},...u},...g)}return l}var Fd=e=>Math.max(0,...e.tasks.map(bd));function Id(e){let t=e.tasks.filter(e=>!e.routine),n=e.remote.filter(e=>!e.routine),r=[...Dd(t,e.sort).map(e=>({group:e})),...e.machines.flatMap(t=>Dd(n.filter(e=>e.machine?.id===t.alias),e.sort).map(e=>({group:e,machine:t.alias})))],i=new Map;for(let e of r){let{repoId:t,repo:n}=e.group,r=e.group.noProject?wd:t??(e.machine===void 0?n:`${e.machine}\0${n}`),a=i.get(r);a?a.push(e):i.set(r,[e])}let a=Cd[e.sort],o=new Map,s=[];for(let[e,t]of i){let n=t[0];if(!n)continue;let r=t.flatMap(e=>e.group.tasks),i=n.group.noProject===!0,c={repo:n.group.repo,label:i?n.group.label:``,key:e,tasks:t.length===1?n.group.tasks:r.sort(kd(a)),...n.group.repoId?{repoId:n.group.repoId}:{},...n.machine===void 0||i?{}:{machine:n.machine},...i?{noProject:!0}:{}};s.push(c);for(let e of t)o.set(e,c)}let c=new Map(s.map(e=>[e,e.noProject?e.label:ld(e,s)])),l=s.map(e=>({...e,label:c.get(e)??e.label}));return e.sort===`recent`&&l.sort((e,t)=>Fd(t)-Fd(e)),e.sort===`name`&&l.sort((e,t)=>Sd.compare(e.label,t.label)),l.sort((e,t)=>Number(t.noProject===!0)-Number(e.noProject===!0)),{rows:Pd(l,e.query,e.fold),groups:r.filter(e=>e.machine===void 0).map(e=>{let t=o.get(e);return{...e.group,label:(t&&c.get(t))??e.group.label}})}}function Ld(e){return e.title??e.engineName??(e.kind===`engine`?z(`tab.engine`):z(`tab.shell`))}function Rd(e,t){if(t.size===0)return e;let n=!1;return e.filter(e=>e.kind===`project`||e.kind===`state`?(n=t.has(e.id),!0):!n)}function zd(e){return e.kind===`leaf`?[e]:e.children.flatMap(zd)}function Bd(e){return!!e&&zd(e.root).length>1}function Vd(e){let t=[],n=(e,r,i,a,o,s,c)=>{if(e.kind===`leaf`){t.push({id:e.id,x:r,y:i,w:a,h:o,left:s,top:c});return}let l=e.children.length;e.children.forEach((t,u)=>{e.orientation===`row`?n(t,r+a*u/l,i,a/l,o,u>0||s,c):n(t,r,i+o*u/l,a,o/l,s,u>0||c)})};return n(e,0,0,1,1,!1,!1),t}function Hd(e,t,n=1){let r=zd(e.root).map(e=>e.id),i=r.indexOf(t);return r[(Math.max(0,i)+n+r.length)%r.length]??t}function Ud(e,t){let n=new Map,r=new Map;for(let i of zd(e.root)){if(i.title){r.set(i.id,i.title);continue}let e=i.own?t:`shell`,a=(n.get(e)??0)+1;n.set(e,a),r.set(i.id,a===1?e:`${e} ${a}`)}return r}function Wd(e,t,n){return e.kind===`engine`&&zd(t.root).some(e=>e.id===n&&e.own)}function Gd(e){return e.alive!==!1||!!e.split&&!zd(e.split.root).some(e=>e.own)}function Kd(e){return zd(e.root).map(e=>e.id).join(`,`)}function qd(e){return!(e instanceof HTMLElement)||e.closest(`.xterm`)?!1:e.isContentEditable||[`INPUT`,`TEXTAREA`,`SELECT`].includes(e.tagName)}function Jd(e){return e instanceof HTMLElement&&!!e.closest(`.rail, button, a`)}var Yd=e=>e.tabs.get()[e.selection.get().taskId??``]??[];function Xd(e){let{taskId:t,tabId:n}=e.selection.get(),r=Yd(e);return{taskId:t,tabs:r,at:r.findIndex(e=>e.id===n)}}function Zd(e,t){let{taskId:n,tabs:r}=Xd(e),i=r[t];!n||!i||e.select(n,i.id)}function Qd(e){let{taskId:t,tabs:n,at:r}=Xd(e),i=n[r];!t||!i||C.set((0,V.jsx)(Si,{title:z(`menu.renameTab`),initial:Ld(i),submitLabel:z(`dialog.save`),onSubmit:async n=>{await e.renameTab(t,i.id,n)}}))}var $d=e=>!!e.selection.get().taskId,ef=e=>Yd(e).length>0,tf=[{id:`help.open`,chords:[`f1`],prefix:!1,run:kl},{id:`focus.next`,chords:[`f4`],prefix:!1,run:()=>bo(1)},{id:`chat.tab.chooseEngine`,chords:[`ctrl+e`],prefix:!1,surface:`workspace`,live:$d,run:e=>{let{taskId:t}=e.selection.get();t&&C.set((0,V.jsx)(ad,{model:e,taskId:t}))}},{id:`chat.tab.rename`,chords:[`f2`],prefix:!1,surface:`workspace`,live:e=>{let{tabs:t,at:n}=Xd(e);return!!t[n]&&!Bd(t[n]?.split)},run:Qd},{id:`chat.tab.cycle-next`,chords:[`ctrl+]`],prefix:!1,surface:`workspace`,live:ef,run:e=>Zd(e,(Xd(e).at+1)%Yd(e).length)},{id:`chat.tab.cycle-prev`,chords:[`ctrl+[`],prefix:!1,surface:`workspace`,live:ef,run:e=>Zd(e,(Xd(e).at-1+Yd(e).length)%Yd(e).length)},{id:`chat.tab.goto`,chords:[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`].map(e=>`ctrl+${e}`),prefix:!1,surface:`workspace`,live:ef,run:(e,t=``)=>{let n=wo().find(e=>e.id===`chat.tab.goto`&&!e.prefix)?.chords.indexOf(t)??-1;n>=0&&Zd(e,n)}},{id:`attention.next`,chords:[`f7`],prefix:!1,run:e=>rf(e)}];So(()=>tf);function nf(e){(0,h.useEffect)(()=>{let t=t=>{if(C.get()||qd(t.target))return;let n=O.get();if(n===`worktrees`)return;let r=Do()??($d(e)?`workspace`:`sidebar`),{taskId:i}=e.selection.get();if(!n&&i&&!t.ctrlKey&&!t.shiftKey&&!t.metaKey&&!t.altKey&&t.key===`Enter`&&!ef(e)&&!Jd(t.target)){t.preventDefault(),t.stopPropagation(),C.set((0,V.jsx)(ad,{model:e,taskId:i}));return}let a=qc(t),o=wo().filter(t=>!t.prefix&&!t.native&&t.chords.some(e=>a.includes(e))&&To(t,r)&&!(n&&t.surface)&&t.live?.(e)!==!1).sort((e,t)=>Eo(e,r)-Eo(t,r))[0];o&&(t.preventDefault(),t.stopPropagation(),o.run(e,a.find(e=>o.chords.includes(e))))};return window.addEventListener(`keydown`,t,{capture:!0}),()=>window.removeEventListener(`keydown`,t,{capture:!0})},[e])}function rf(e){let t=e.tasks.get();if(!t)return;let n=Il(t.attention,t.tasks.map(e=>e.id),e.selection.get());if(!n){I(z(`inbox.empty`));return}if(Nl(n.state)){zl(e,n);return}n.taskId!==null&&(e.select(n.taskId,n.tabId),Rl(e,n))}async function af(e,t){try{if(t.kind===`action`){await e.client.request(`plugin.chordAction`,{chord:t.chord});return}let{taskId:n,tabId:r}=e.selection.get();if(!n){I(z(`keys.pluginNoTask`),`error`);return}let i=await e.client.request(`plugin.paneOpen`,{taskId:n,pane:t.target,...r?{tabId:r}:{}});await e.refreshTabsNow(n),e.select(n,i.tabId)}catch(e){I(W(e),`error`)}}function of(e){(0,h.useEffect)(()=>{let t=t=>{let n=ua.get().plugins;if(n.length===0||!Ca({dialog:C.get()!==null,page:O.get()})||qd(t.target))return;let r=Sa(n,qc(t));r&&(t.preventDefault(),t.stopImmediatePropagation(),af(e,r))};return window.addEventListener(`keydown`,t,{capture:!0}),()=>window.removeEventListener(`keydown`,t,{capture:!0})},[e])}var sf=`prefix.moreCommands`,cf=/^ctrl\+[^+]+$/;function lf(e){return cf.test(e)?e.slice(5):null}function uf(e){let t=Qc(e.bindingId);if(!t)return null;if(e.reachability.direct.has(e.bindingId)){let e=t.keys[0];if(e)return ca(e)}if(e.prefixKey&&e.reachability.prefix.has(e.bindingId)){let n=t.prefixKeys?.[0];if(n)return`${ca(e.prefixKey)} ${ca(n)}`}return null}function df(e,t){let n=ia.filter(t=>e.direct.has(t.id)).flatMap(e=>{let t=e.keys.flatMap(e=>lf(e)??[]);return t.length>2?[{stroke:`${t[0]}-${t.at(-1)}`,action:e.id}]:t.map(t=>({stroke:t,action:e.id}))}),r=t?lf(t):null;return r&&e.prefix.size>0&&n.push({stroke:r,action:sf}),n}var ff=4e3,pf=180,mf=ff,hf=v({guide:null,entries:[]}),gf=1;function _f(e,t){let n={id:gf++,stroke:e,action:t,at:Date.now()};hf.set({guide:null,entries:[...hf.get().entries,n].slice(-3)})}var vf=`modulepreload`,yf=function(e){return`/`+e},bf={},xf=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=yf(t,n),t=s(t),t in bf)return;bf[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:vf,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Sf=8,Cf=32,wf=3e3,Tf=100,Ef=new WeakMap,Df=null;function Of(e){let t=Ef.get(e);return t||(t={entries:new Map,snapshots:new Map,left:null},Ef.set(e,t)),t}function kf(){return Df||(Df=document.createElement(`div`),Df.style.display=`none`,document.body.append(Df)),Df}function Af(e,t,n){e.snapshots.delete(t),e.snapshots.set(t,n);for(let t of e.snapshots.keys()){if(e.snapshots.size<=Cf)break;e.snapshots.delete(t)}}function jf(e,t,n){e.entries.delete(t.key),t.leaving!==null&&window.clearTimeout(t.leaving),t.leaving=null,n?Af(e,t.key,t.handle.snapshot()):e.snapshots.delete(t.key),t.handle.dispose(),t.box.remove()}function Mf(e){let t=[...e.entries.values()].filter(e=>e.slot.parkedAt!==null);t.sort((e,t)=>(e.slot.parkedAt??0)-(t.slot.parkedAt??0));for(let n of t.slice(0,Math.max(0,t.length-Sf)))jf(e,n,!0)}function Nf(e,t){return Of(e).entries.get(t)?.handle??null}function Pf(e,t,n,r){return Of(e).entries.get(X(t,n,r))?.slot.parkedAt!=null}async function Ff(e,t){let n=Of(e.client),r=X(e.taskId,e.tabId,e.leafId),i=n.entries.get(r);if(i&&i.slot.parkedAt!==null){let{slot:r,handle:a,box:o}=i;return r.parkedAt=null,r.binding=t,i.leaving!==null&&(window.clearTimeout(i.leaving),i.leaving=null,o.classList.remove(`is-leaving`)),n.left=null,zf(n),e.host.append(o),t.setNotice(r.notice),t.onScrolled(r.scrolled),a.term.refresh(0,a.term.rows-1),e.focusOnMount&&a.term.focus(),{handle:a,release:()=>If(n,i)}}let a=document.createElement(`div`);a.className=Nn,e.host.append(a),Lf(n,e.host);let o=!i,s={binding:t,notice:{kind:`none`},scrolled:0,parkedAt:null},c=null,l=o?n.snapshots.get(r):void 0;l&&n.snapshots.delete(r);let{mountTerminal:u}=await xf(async()=>{let{mountTerminal:e}=await import(`./term-mount-DAe6rd3Z.js`);return{mountTerminal:e}},__vite__mapDeps([0,1])),d=u({...e,el:a,snapshot:l,onPainted:()=>zf(n),setNotice:e=>{s.notice=e,s.binding?.setNotice(e)},onScrolled:e=>{s.scrolled=e,s.binding?.onScrolled(e)},onFocusChange:e=>s.binding?.onFocusChange(e),onExit:e=>{s.binding?s.binding.onExit(e):c&&n.entries.get(r)===c&&jf(n,c,!1)},copyText:e=>s.binding?.copyText(e)??Promise.resolve(!1),pasteImage:()=>s.binding?.pasteImage()??Promise.resolve()});if(!o)return{handle:d,release:()=>{d.dispose(),a.remove()}};let f={key:r,handle:d,box:a,slot:s,leaving:null};return c=f,n.entries.set(r,f),{handle:d,release:()=>If(n,f)}}function If(e,t){let{slot:n}=t;e.entries.get(t.key)===t&&n.parkedAt===null&&(n.binding?.onFocusChange(!1),n.binding=null,t.handle.term.blur(),n.parkedAt=performance.now(),kf().append(t.box),e.left=t,Mf(e))}function Lf(e,t){let n=e.left;e.left=null,!(!n||n.slot.parkedAt===null||performance.now()-n.slot.parkedAt>Tf)&&e.entries.get(n.key)===n&&(n.box.classList.add(`is-leaving`),t.append(n.box),n.leaving=window.setTimeout(()=>Rf(e,n),wf))}function Rf(e,t){t.leaving!==null&&(window.clearTimeout(t.leaving),t.leaving=null,t.box.classList.remove(`is-leaving`),e.entries.get(t.key)===t&&t.slot.parkedAt!==null&&kf().append(t.box))}function zf(e){for(let t of e.entries.values())Rf(e,t)}async function Bf(e,t,n){return Ll(await e.request(`output.read`,{taskId:t,tab:n,source:`terminal`,limit:12}))}async function Vf(e,t,n,r){try{let i=await e.client.request(`tab.send`,{taskId:t,tabId:n,prompt:r});return i.delivered?!0:(I(z(`layout.composerNotSent`,{reason:i.reason??``}),`error`),!1)}catch(e){let t=e instanceof Ho?e.code:void 0;return I(t===`UNKNOWN_OP`?z(`layout.composerOldBridge`):t===`AWAITING_PERMISSION`?z(`layout.composerAtMenu`):e instanceof Error?e.message:String(e),`error`),!1}}async function Hf(e,t,n,r){let{client:i}=e,a=X(t,n),o=No(a)!==void 0||Pf(i,t,n);try{return o||await i.request(`term.attach`,{taskId:t,tabId:n}),await i.request(`term.input`,{stream:a,data:r}),!0}catch(e){return I(e instanceof Error?e.message:String(e),`error`),!1}finally{o||await i.request(`term.detach`,{stream:a}).catch(()=>{})}}async function Uf(e,t,n){try{return(await e.client.request(`gate.answer`,{gateId:t,...n})).delivered||I(z(`inbox.gateKept`)),!0}catch(e){return I(e instanceof Error?e.message:String(e),`error`),!1}}var Wf=(e,t,n)=>({id:e,cap:t,bytes:e=>`\x1b${e?`O`:`[`}${n}`}),Gf={id:`enter`,cap:`⏎`,bytes:()=>`\r`},Kf=[{id:`esc`,cap:`esc`,bytes:()=>`\x1B`},{id:`tab`,cap:`tab`,bytes:()=>` `},{id:`backtab`,cap:`⇧tab`,bytes:()=>`\x1B[Z`},{id:`interrupt`,cap:`^C`,bytes:()=>``},Wf(`up`,`↑`,`A`),Wf(`down`,`↓`,`B`),Wf(`left`,`←`,`D`),Wf(`right`,`→`,`C`),Gf],qf=e=>({id:`option-${e}`,cap:String(e),bytes:()=>String(e)}),Jf=[qf(1),qf(2),qf(3),qf(4),Gf];function Yf(e){if(e.length!==1)return e;let t=e.toUpperCase().charCodeAt(0);return t===32?`\0`:t===63?``:t>=64&&t<=95?String.fromCharCode(t&31):e}var Xf=`\x1B[27;2;13~`;function Zf(e){return e.key!==`Enter`||!e.shiftKey||e.ctrlKey||e.metaKey||e.altKey?!1:!e.isComposing&&e.keyCode!==229}function Qf(e){return e.type!==`keydown`||e.key.toLowerCase()!==`c`||e.altKey?null:e.metaKey||e.ctrlKey&&e.shiftKey?`copy`:e.ctrlKey?`interrupt-or-copy`:null}var $f=`mx-2.5 mt-0.5 mb-1.5 flex min-w-0 flex-col gap-1.5 font-mono text-meta`,ep=2e3;function tp(e,t,n){let[r,i]=(0,h.useState)(null),[a,o]=(0,h.useState)(0);return(0,h.useEffect)(()=>{if(!n)return;let r=!0,a=0,o=async()=>{try{let a=await Bf(e.client,t,n);r&&i(a)}catch{r&&i(e=>e??[])}r&&(a=window.setTimeout(o,ep))};return o(),()=>{r=!1,window.clearTimeout(a)}},[e,t,n,a]),{lines:r,refresh:()=>o(e=>e+1)}}function np(e){B();let{model:t,taskId:n,tabId:r,mode:i,gate:a}=e,{lines:o,refresh:s}=tp(t,n,r),c=(0,h.useRef)(null),[l,u]=(0,h.useState)(``),[d,f]=(0,h.useState)(!1);(0,h.useEffect)(()=>{let e=c.current;e&&(e.scrollTop=e.scrollHeight)},[o]);let p=async e=>{f(!0);let t=await e();return f(!1),t&&window.setTimeout(s,600),t},m=async()=>{let e=l.trim();!e||d||await p(()=>i===`gate`&&a?Uf(t,a.id,{text:e}):r?Vf(t,n,r,e):Promise.resolve(!1))&&u(``)};return(0,V.jsxs)(`div`,{className:$f,children:[a&&(0,V.jsx)(`p`,{className:`m-0 whitespace-pre-wrap wrap-anywhere text-ink`,children:a.question}),r&&(0,V.jsx)(`pre`,{ref:c,className:`m-0 max-h-60 overflow-y-auto rounded-sm border-hairline border-line bg-inset px-2 py-1.5 text-ink whitespace-pre-wrap wrap-anywhere`,"data-peek-lines":12,children:o===null?`…`:o.length===0?z(`inbox.noOutput`):o.join(`
|
|
40
40
|
`)}),i===`gate`&&a&&(0,V.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:a.options.map(e=>(0,V.jsxs)(H,{disabled:d,title:e.detail,onClick:()=>void p(()=>Uf(t,a.id,{option:e.key})),children:[`[ `,e.key===a.recommended?`★ `:``,e.label,` ]`]},e.key))}),i===`menu`&&r&&(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[Jf.map(e=>(0,V.jsxs)(H,{disabled:d,onClick:()=>void p(()=>Hf(t,n,r,e.bytes(!1))),children:[`[ `,e.cap,` ]`]},e.id)),(0,V.jsx)(H,{onClick:e.onOpenTab,children:z(`inbox.openTab`)})]}),(i===`reply`||i===`gate`)&&(0,V.jsxs)(`form`,{className:`flex min-w-0 items-center gap-2`,onSubmit:e=>{e.preventDefault(),m()},children:[(0,V.jsx)(`input`,{className:`min-w-0 flex-1 rounded-sm border-hairline border-line bg-paper px-2 py-1.5 font-mono text-ink focus-visible:border-line-active focus-visible:outline-none touch:min-h-10 touch:text-display`,value:l,disabled:d,placeholder:z(`inbox.replyPlaceholder`),"aria-label":z(`inbox.replyPlaceholder`),autoComplete:`off`,enterKeyHint:`send`,onChange:e=>u(e.target.value)}),(0,V.jsx)(H,{type:`submit`,disabled:d||l.trim()===``,children:z(`inbox.send`)})]})]})}function rp({text:e}){return(0,V.jsx)(`span`,{className:`inline-flex flex-wrap gap-x-3 gap-y-0`,children:e.split(`·`).map(e=>e.trim()).filter(Boolean).map(e=>(0,V.jsx)(`span`,{children:e},e))})}var ip={accent:`text-accent`,muted:`text-subtle`,attention:`text-error`,warning:`text-warning`,info:`text-info`,success:`text-success`,added:`text-diff-added`,removed:`text-diff-removed`},ap={accent:`text-accent`,muted:`text-subtle`,attention:`text-error`,warning:`text-warning`,success:`text-success`,info:`text-accent`,ink:`text-ink`},op=6;function sp(e,t){return e?`${e.repo.split(`/`).filter(Boolean).pop()??e.repo} › ${e.label}`:t}function cp({model:e}){B();let t=y(e.tasks),n=y(e.visits),r=y(e.tabs),[i,a]=(0,h.useState)(0),[o,s]=(0,h.useState)(null),[c,l]=(0,h.useState)(Date.now());(0,h.useEffect)(()=>{let e=window.setInterval(()=>l(Date.now()),3e4);return()=>window.clearInterval(e)},[]);let u=new Map((t?.tasks??[]).map(e=>[e.id,e])),d=(e,t)=>e&&t&&r[e]?.find(e=>e.id===t)?.title||``,f=Fl(t?.attention??[],t?.tasks.map(e=>e.id)??[]).map((e,t)=>{let n=e.taskId?u.get(e.taskId):void 0;return{key:`a${t}:${e.taskId}:${e.tabId}`,section:`attention`,taskId:e.taskId,tabId:e.tabId,identity:sp(n,e.label??e.taskId??``),subtitle:d(e.taskId,e.tabId)||n?.branch||``,at:e.at,attention:e}}),p=new Set(f.map(e=>`${e.taskId}:${e.tabId}`)),m=n.filter(e=>u.has(e.taskId)&&!p.has(`${e.taskId}:${e.tabId}`)).slice(0,op).map(e=>({key:`r:${e.taskId}:${e.tabId}`,section:`recent`,taskId:e.taskId,tabId:e.tabId,identity:sp(u.get(e.taskId),e.taskId),subtitle:d(e.taskId,e.tabId)||u.get(e.taskId)?.branch||``,at:e.at})),g=[...f,...m],_=g[Math.min(i,g.length-1)],v=t=>{if(t.attention&&Nl(t.attention.state))return zl(e,t.attention);t.attention&&Rl(e,t.attention),t.taskId&&u.has(t.taskId)&&(e.select(t.taskId,t.tabId),R())},b=()=>void Promise.all(f.map(t=>t.attention&&Rl(e,t.attention,!0)));(0,h.useEffect)(()=>{let t=t=>{if(!(t.target instanceof HTMLElement&&t.target.closest(`input, textarea`))){if(t.key===`ArrowDown`||t.key===`j`)a(e=>Math.min(g.length-1,e+1));else if(t.key===`ArrowUp`||t.key===`k`)a(e=>Math.max(0,e-1));else if(t.key===`Enter`&&_)v(_);else if(t.key===`d`&&_?.attention)Rl(e,_.attention,!0);else if(t.key===`D`)b();else return;t.preventDefault()}};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)});let x=n=>{let r=n.attention?jl(n.attention.state):null,i=n===_,l=n.attention,d=n.taskId?u.get(n.taskId):void 0,f=l?.gateId?t?.gates?.find(e=>e.id===l.gateId&&e.status===`open`):void 0,p=n.tabId??f?.tabId??null,m=!!l&&!!d&&!d.machine&&!Nl(l.state)&&(!l.gateId||!!f)&&(!!p||!!f),h=l?.state===`permission_needed`||!!p&&d?.tabStatus?.[p]?.kind===`needs-input`,y=f?`gate`:l?.state===`dead`?`readonly`:h?`menu`:`reply`,b=`${n.taskId}:${n.tabId}:${l?.gateId??``}`,x=m&&o===b;return(0,V.jsxs)(`li`,{children:[(0,V.jsxs)(`div`,{className:oi,children:[(0,V.jsxs)(`button`,{type:`button`,className:`${pi({selected:i,stack:!0})} ${si}`,onMouseEnter:()=>a(g.indexOf(n)),onClick:()=>v(n),children:[(0,V.jsxs)(`span`,{className:ii,children:[(0,V.jsx)(`span`,{className:mi,children:n.identity}),r&&(0,V.jsxs)(`span`,{className:`flex-none font-mono text-meta font-normal normal-nums ${ap[r.tone]}`,children:[r.glyph,` `,z(r.stateKey)]}),(0,V.jsx)(`span`,{className:ai,children:Ml(c-n.at)})]}),n.subtitle&&(0,V.jsx)(`span`,{className:`truncate font-mono text-meta font-normal normal-nums text-muted`,children:n.subtitle})]}),m?(0,V.jsx)(H,{className:ci,"aria-expanded":x,onClick:()=>{a(g.indexOf(n)),s(x?null:b)},children:z(x?`inbox.hide`:`inbox.reply`)}):(0,V.jsx)(`span`,{"aria-hidden":!0,className:ci})]}),x&&n.taskId&&(0,V.jsx)(np,{model:e,taskId:n.taskId,tabId:p,mode:y,gate:f,onOpenTab:()=>v(n)})]},n.key)};return(0,V.jsx)(bi,{title:z(`inbox.title`),wide:!0,children:(0,V.jsxs)(`div`,{className:Wr,children:[(0,V.jsxs)(`div`,{className:ti,children:[(0,V.jsx)(`p`,{className:`${U} text-muted ${ei} touch:hidden!`,children:(0,V.jsx)(rp,{text:z(`inbox.hints`)})}),f.length>0&&(0,V.jsx)(H,{className:`flex-none min-w-[calc(9ch+0.5rem)] whitespace-nowrap pr-2 text-right font-mono text-meta`,onClick:b,children:z(`inbox.ackAll`)})]}),(0,V.jsx)(`h2`,{className:`${U} text-muted ${ni}`,children:z(`inbox.attention`)}),f.length===0?(0,V.jsx)(`p`,{className:`mono text-muted`,children:z(`inbox.empty`)}):(0,V.jsx)(`ul`,{className:ri,children:f.map(x)}),m.length>0&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`h2`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted mt-1`,children:z(`inbox.recent`)}),(0,V.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-0.5 p-0`,children:m.map(x)})]})]})})}var lp=`rove.prefs`,up={locale:`en`,theme:`claude`,themeMode:`dark`,transparent:!0,focusAccent:`primary`,splitStyle:`line`,railFold:`glyphs`,workingBorder:`flow`,taskColors:`on`,glyphSet:`braille`,colorblind:`off`,runningTitle:`shimmer`,statusMark:`both`,statusMarkNoticeSeen:!0,railSort:`recent`,railGroup:`project`,toast:!0,sound:!0,soundVolume:.4,crossTask:!0,finishedAlerts:!0,keyHints:!0,zen:!0,editorKind:`auto`,worktreeBase:`default`,scrollbackRows:1e3,tabStrip:`never`,prefixTap:`local`,remoteProjects:!1,autoStatus:!1,dispatcher:!1,updateChannel:`latest`,updateNotify:!0};function dp(){try{let e=JSON.parse(localStorage.getItem(lp)??`null`);if(e&&typeof e==`object`&&`prefs`in e&&`themes`in e){let t=e;return{...t,prefs:{...up,...t.prefs},loaded:!0}}}catch{}return{loaded:!1,prefs:up,options:{},info:{editorCustomSet:!1,worktreeCustomPath:``},themes:[],glyphSets:{}}}var fp=v(dp());function pp(e){(e.locale===`en`||e.locale===`zh`)&&kt.set(e.locale)}pp(fp.get().prefs);function mp(e){let t={loaded:!0,prefs:e.prefs,options:e.options,info:e.info,themes:e.themes,glyphSets:e.glyphSets};fp.set(t),pp(t.prefs),localStorage.setItem(lp,JSON.stringify(t))}var hp=null;async function gp(e){hp=e,mp(await e.request(`prefs.get`))}async function _p(e,t,n){let r=fp.get();fp.set({...r,prefs:{...r.prefs,[t]:n}}),pp(fp.get().prefs);try{let r=await e.request(`prefs.set`,{key:t,value:n});mp({...fp.get(),prefs:r.prefs})}catch(e){fp.set(r),pp(r.prefs),I(e instanceof Error?e.message:String(e),`error`)}}function vp(e,t){if(hp)return void _p(hp,e,t);let n=fp.get();fp.set({...n,prefs:{...n.prefs,[e]:t}})}function yp(){return y(fp)}function bp(e,t){let n=e.options[t];return Array.isArray(n)?n:[]}var xp=[`project`,`state`],Sp=`rove.railGroup`,Cp=v(xp.find(e=>e===localStorage.getItem(Sp))??`project`);function wp(e){e!==Cp.get()&&(Cp.set(e),localStorage.setItem(Sp,e))}fp.subscribe(()=>{let{loaded:e,prefs:t}=fp.get();e&&xp.includes(t.railGroup)&&wp(t.railGroup)});function Tp(e){wp(e),vp(`railGroup`,e)}var Ep=`rove.activeSortMode`;function Dp(){let e=localStorage.getItem(Ep);return gd.find(t=>t===e)??`recent`}var Op=v(Dp());function kp(e){e!==Op.get()&&(Op.set(e),localStorage.setItem(Ep,e))}fp.subscribe(()=>{let{loaded:e,prefs:t}=fp.get();e&&gd.includes(t.railSort)&&kp(t.railSort)});function Ap(e){kp(e),vp(`railSort`,e)}function jp(){Ap(gd[(gd.indexOf(Op.get())+1)%gd.length]??`default`)}var Mp=v(!1),Np=v(null);function Pp(e){e&&(Op.get()!=="default"||Cp.get()===`state`)&&(Ap(`default`),Tp(`project`),I(G(`tasks`,`sort.reorderSwitched`))),e||Np.set(null),Mp.set(e)}async function Fp(e,t,n){let r=n<0?`up`:`down`;try{await e.client.request(`task.move`,{taskId:t.task.id,direction:r})}catch(e){I(G(`tasks`,`toast.moveFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)}}async function Ip(e,t,n){let r=n<0?`up`:`down`;try{for(let i=0;i<Math.abs(n);i++)await e.client.request(`task.move`,{taskId:t,direction:r})}catch(e){I(G(`tasks`,`toast.moveFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)}}var Lp=`flex min-h-0 min-w-0 flex-1 flex-col p-4 font-mono text-meta leading-[1.5] font-normal not-italic normal-nums`,Rp=`flex min-h-0 flex-1 flex-col items-center justify-center gap-1.5 overflow-hidden text-center keyboard:hidden`,zp=`relative mx-auto flex w-full max-w-[104ch] flex-none flex-col gap-2 keyboard:mt-auto`,Bp=`pointer-events-none absolute bottom-full left-0 mb-2 flex flex-col gap-1`,Vp=`flex flex-col gap-2 rounded-md border-hairline border-line bg-surface px-3 py-2.5 focus-within:border-line-active`,Hp=`flex flex-wrap items-center justify-end gap-1.5`,Up=`max-h-[40vh] min-h-[4.5em] w-full bg-transparent text-ink [border:0] [outline:0]`,Wp=`flex items-center gap-1.5 px-1`,Gp=`flex min-w-0 items-center gap-1.5`,Kp=`${Gp} group/end ml-auto narrow:ml-0`,qp=(e=!1)=>`flex h-7 min-w-7 cursor-pointer items-center justify-center rounded-sm px-1 has-[:disabled]:opacity-60 disabled:opacity-60 [&:hover]:bg-hover [&:hover]:text-ink ${e?`text-accent`:`text-muted`}`,Jp=`size-3.25 flex-none fill-none stroke-current [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:1.3]`,Yp=`narrow:sr-only`,Xp=(e=!1)=>`inline-flex max-w-[28ch] items-center gap-1.5 overflow-hidden rounded-full border-hairline px-2.5 py-0.75 text-ellipsis whitespace-nowrap touch:py-1.75 [&:hover]:bg-hover [&:hover]:text-ink aria-expanded:bg-hover aria-expanded:text-ink ${e?`border-[color-mix(in_srgb,var(--accent)_45%,transparent)] bg-accent-soft text-accent`:`border-line text-muted`}`,Zp=`disabled:cursor-default disabled:opacity-60`,Qp=e=>`${Xp(e)} min-w-[9ch] justify-center ${Zp}`,$p=`touch-none select-none [-webkit-touch-callout:none]`,em=`group/chip relative inline-flex`,tm=`flex min-h-0 flex-col gap-1 overflow-x-hidden overflow-y-auto p-1.5 [outline:0]`,nm=`flex min-h-0 flex-col overflow-x-hidden overflow-y-auto`,rm=`sticky top-0 z-1 m-0 bg-surface px-1.5 pt-1.5 pb-0.5 text-left`,im=e=>`flex w-full items-baseline gap-2 rounded-[calc(var(--radius)-6px)] px-2 py-1 text-left touch:py-2.5 disabled:cursor-default disabled:opacity-50 ${e.dim?`text-subtle`:`text-ink`} ${e.cursor?`bg-hover`:``}`,am=`flex-[0_0_1.5ch] text-accent`,om=`ml-auto pl-3 inline-flex items-center gap-1`,sm=`min-w-0 overflow-hidden text-ellipsis whitespace-nowrap`,cm=`${sm} narrow:max-w-[13ch]`,lm=`${sm} [direction:rtl]`,um=`flex-none whitespace-nowrap`,dm=`mx-2 my-1`,fm=`flex flex-col gap-0.5 px-1.5 py-0.5`,pm=`min-w-[36ch]`,mm=`flex items-center gap-1.5 p-1.5`;function hm(){return(0,V.jsx)(`svg`,{className:Jp,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,V.jsx)(`path`,{d:`M2 4.5a1 1 0 0 1 1-1h3l1.5 1.5H13a1 1 0 0 1 1 1V12a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1z`})})}function gm(){return(0,V.jsxs)(`svg`,{className:Jp,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,V.jsx)(`circle`,{cx:`4.5`,cy:`3.5`,r:`1.5`}),(0,V.jsx)(`circle`,{cx:`4.5`,cy:`12.5`,r:`1.5`}),(0,V.jsx)(`circle`,{cx:`11.5`,cy:`5`,r:`1.5`}),(0,V.jsx)(`path`,{d:`M4.5 5v6M11.5 6.5c0 3-7 2-7 4.5`})]})}function _m(e){return e instanceof Error?e.message:String(e)}function vm(e){return/no space left on device|ENOSPC|disk quota exceeded/i.test(_m(e))}var ym=`-my-0.75 -mr-0.5 ml-0 flex flex-none self-stretch`,bm=`before:absolute before:top-0 before:left-1 before:content-[''] before:[border-left:var(--hairline)_solid_var(--line-active)]`,xm={blank:``,pipe:`${bm} before:bottom-0`,tee:`${bm} before:bottom-0`,elbow:`${bm} before:right-0 before:bottom-1/2 before:rounded-bl-[6px] before:[border-bottom:var(--hairline)_solid_var(--line-active)]`},Sm=e=>`relative w-3 ${xm[e]}`,Cm=`-mx-1 inline-flex min-w-6 cursor-pointer items-center justify-center gap-1 self-stretch rounded-xs px-2 font-mono hover:bg-hover`,wm=`inline-flex items-center gap-1`,Tm=e=>`fixed z-35 flex max-h-[min(380px,60vh)] w-85 max-w-[calc(100vw-24px)] animate-pr-list-in flex-col overflow-y-auto overscroll-contain rounded-md border-hairline border-line bg-surface p-1.5 shadow-popover transition-[opacity,translate] duration-120 ease-in motion-reduce:animate-none motion-reduce:transition-none ${e?`-translate-x-1 opacity-0`:``}`,Em=`inline-flex flex-none items-center text-subtle`,Dm=`group/rail rail @container row-1 flex min-h-0 flex-col focus:outline-none ${Vt}`,Om=`flex min-w-0 items-center gap-2.5 overflow-hidden px-3.5 pt-3.5 pb-2.5 whitespace-nowrap`,km=`flex gap-1 px-3.5 pb-2 text-meta`,Am=`min-w-0 flex-1 border-none bg-transparent p-0 text-ink [font:inherit] outline-none placeholder:text-subtle`,jm=e=>`flex-1 overflow-y-auto px-1.5 pt-1 pb-3 scrollbar-none ${e?`[&>[data-row]]:[transition:transform_150ms_ease-out,scale_150ms_ease-out,opacity_150ms_ease-out] motion-reduce:[&>[data-row]]:transition-none [&>[data-row]]:[box-shadow:none]! [&>[data-row]:not([data-lifted])]:opacity-45`:``}`,Mm=`group-focus-within/rail:[box-shadow:inset_0_0_0_1px_var(--focus)]`,Nm=e=>`group/head mx-2 mt-1.5 mb-1 flex items-center gap-1 font-mono text-meta font-semibold normal-nums not-first:mt-4.5 ${e.dragging?`origin-left scale-[1.03] cursor-grabbing text-ink motion-reduce:scale-none`:`text-subtle`} ${e.grab&&!e.dragging?`relative cursor-grab before:-left-1.5 [&>button:first-child]:cursor-grab ${fi}`:``} ${e.moving?`bg-accent-soft after:font-mono after:text-meta after:font-medium after:normal-nums after:text-accent after:content-['move']`:``}`,Pm=`touch:relative touch:after:absolute touch:after:-inset-x-1.5 touch:after:-inset-y-3 touch:after:content-['']`,Fm=`group/toggle -ml-1 inline-flex min-w-0 cursor-pointer items-center gap-1 rounded-xs border-none bg-transparent px-1 py-0.5 text-inherit [font:inherit] hover:text-ink ${Pm}`,Im=e=>e?``:`opacity-0 group-hover/head:opacity-100 group-focus-visible/toggle:opacity-100 touch:opacity-100`,Lm=`-mr-[4.5px] ml-auto size-5 cursor-pointer rounded-xs border-none bg-transparent text-muted opacity-0 [font:400_var(--fs-display)/1_var(--sans)] group-hover/head:opacity-100 hover:bg-hover hover:text-ink focus-visible:opacity-100 touch:opacity-100 ${Pm}`,Rm=1e4;function zm(e,t){let n=e.hostLabel||e.alias;if(e.state===`online`)return e.version?`${n} · v${e.version}`:n;let r=t[e.state];return e.state===`mismatch`?e.version?`${n} · ⚠ v${e.version} (${r})`:`${n} · ⚠ ${r}`:`${n} · ${r}`}function Bm(e,t,n,r=e){let i=t?.hostLabel&&t.hostLabel!==e?` (${t.hostLabel})`:``,a=n.runsOn.replace(`{host}`,t?`${e}${i}`:r);return!t||t.state===`online`?a:`${a}${zm(t,n).slice((t.hostLabel||t.alias).length)}`}function Vm(e,t,n){if(e.kind!==`task`||e.machine===void 0)return null;let r=e.machine;return Bm(r,t.find(e=>e.alias===r),n,e.task.machine?.label)}function Hm({label:e}){return(0,V.jsx)(`span`,{className:Em,title:e,role:`img`,"aria-label":e,children:(0,V.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`12`,height:`12`,"aria-hidden":`true`,children:(0,V.jsx)(`path`,{d:`M4.5 13a3 3 0 0 1-.4-5.97A4.5 4.5 0 0 1 12.8 6.6 3.2 3.2 0 0 1 12.3 13Z`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinejoin:`round`})})})}function Um({host:e,onMachines:t}){return B(),(0,V.jsxs)(`div`,{className:qn,children:[(0,V.jsx)(`p`,{className:`text-muted`,children:G(`tasks`,`machine.filesElsewhere`,{host:e})}),(0,V.jsx)(`p`,{className:`text-muted`,children:G(`tasks`,`machine.filesHint`,{host:e})}),(0,V.jsx)(`div`,{children:(0,V.jsx)(H,{hit:`tight`,onClick:t,children:z(`machines.open`)})})]})}function Wm(e){let t=y(e.client.conn),n=y(e.remote),[r,i]=(0,h.useState)(()=>Y(e,`machines.list`)?.machines??[]),a=[...new Set(n.map(e=>`${e.machine?.id}:${e.machine?.stale??!1}`))].join();return(0,h.useEffect)(()=>{if(t.state!==`open`)return;let n=!0,r=()=>Gu(e,`machines.list`).then(e=>n&&i(e.machines),()=>{});r();let a=Ei(Rm,r);return()=>{n=!1,a()}},[e.client,t.state,a]),r}function Gm(e){let[t,n]=(0,h.useState)(!1),r=(0,h.useRef)(e.onClose);r.current=e.onClose,(0,h.useEffect)(()=>{t||r.current?.()},[t]);let i=(0,h.useRef)(null),a=(0,h.useRef)(null),o=(0,h.useRef)(null);(0,h.useLayoutEffect)(()=>{let e=o.current;if(!t||!e)return;let n=e.getBoundingClientRect(),r=n.right>window.innerWidth-8?window.innerWidth-8-n.right:n.left<8?8-n.left:0;r&&(e.style.transform=`translateX(${Math.round(r)}px)`)},[t]);let s=()=>{n(!1),a.current?.focus()};return(0,h.useEffect)(()=>{if(!t)return;let e=e=>{i.current?.contains(e.target)||n(!1)};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[t]),(0,V.jsxs)(`span`,{ref:i,className:em,onKeyDown:e=>{e.key!==`Escape`||!t||(e.preventDefault(),e.stopPropagation(),s())},children:[(0,V.jsx)(`button`,{ref:a,type:`button`,className:Xp(),"data-field":e.field,title:e.title,"aria-haspopup":`menu`,"aria-expanded":t,disabled:e.disabled,onClick:()=>n(e=>!e),children:e.label}),t&&(0,V.jsx)(`div`,{ref:o,className:`absolute bottom-[calc(100%+6px)] left-0 z-20 flex max-h-[min(50vh,420px)] max-w-[min(52ch,calc(100vw-16px))] min-w-[min(34ch,calc(100vw-16px))] flex-col overflow-hidden rounded-md border-hairline border-line-active bg-surface shadow-popover group-[&]/end:group-last-of-type/chip:right-0 group-[&]/end:group-last-of-type/chip:left-auto`,children:e.children(s)})]})}function Km(e){let[t,n]=(0,h.useState)(0),r=[...e.extra?[e.extra]:[],...e.rows,...e.more??[]],i=Math.min(t,Math.max(0,r.length-1)),a=(0,h.useRef)(null);return(0,h.useEffect)(()=>{a.current?.scrollIntoView({block:`nearest`})},[i,e.rows]),(0,V.jsxs)(`div`,{className:tm,children:[(0,V.jsx)(`input`,{className:pn,autoFocus:!0,spellCheck:!1,placeholder:e.placeholder,value:e.query,onChange:t=>{n(0),e.onQuery(t.target.value)},onKeyDown:t=>{if(!t.nativeEvent.isComposing){if(t.key===`ArrowDown`||t.key===`ArrowUp`)t.preventDefault(),n(Math.max(0,Math.min(r.length-1,i+(t.key===`ArrowDown`?1:-1))));else if(t.key===`Enter`){t.preventDefault();let n=r[i];n&&e.onPick(n.key,t.shiftKey||t.metaKey||t.ctrlKey)}}}}),(0,V.jsxs)(`div`,{className:nm,children:[r.length===0&&(0,V.jsx)(`p`,{className:`mx-2 my-1 text-muted`,children:e.empty}),r.map((t,r)=>(0,V.jsxs)(h.Fragment,{children:[e.moreLabel&&t===e.more?.[0]&&(0,V.jsx)(`p`,{className:`mx-2 mt-2 mb-0.5 text-muted`,children:e.moreLabel}),t.ruled&&r>0&&(0,V.jsx)(`div`,{className:`mx-2 my-1 flex-none border-t-hairline border-t-line`}),(0,V.jsxs)(`button`,{type:`button`,"aria-current":t.checked===!0,ref:r===i?a:void 0,tabIndex:-1,title:t.title,className:im({cursor:r===i}),onMouseMove:()=>n(r),onClick:n=>e.onPick(t.key,n.shiftKey||n.metaKey||n.ctrlKey),children:[(0,V.jsx)(`span`,{className:am,children:t.checked?`✓`:``}),(0,V.jsx)(`span`,{className:um,children:t.text}),t.dim&&(0,V.jsx)(`span`,{className:`ml-auto pl-3 text-muted ${t.dimPath?lm:`min-w-0 overflow-hidden text-ellipsis whitespace-nowrap`}`,children:t.dimPath?(0,V.jsx)(`bdi`,{children:t.dim}):t.dim})]})]},t.key))]}),e.hint&&(0,V.jsx)(`p`,{className:`m-0 flex-none border-t-hairline border-t-line px-2 pt-1.5 pb-0.5 text-subtle`,children:e.hint})]})}function qm(e){return(0,V.jsxs)(`button`,{type:`button`,role:e.multi?`menuitemcheckbox`:`menuitemradio`,"aria-checked":e.checked,tabIndex:-1,disabled:e.option.disabled,className:im({cursor:e.cursor,dim:e.option.dim}),onMouseMove:e.onHover,onClick:e.onPick,children:[(0,V.jsx)(`span`,{className:am,children:e.checked?`✓`:``}),(0,V.jsx)(`span`,{children:e.option.label}),!e.checked&&e.digit!==void 0&&!e.option.disabled&&(0,V.jsx)(`span`,{className:`ml-auto pl-3 text-muted`,children:e.digit})]})}function Jm(e){let[t,n]=(0,h.useState)(()=>Math.max(0,e.options.findIndex(t=>t.id===e.value))),r=(0,h.useRef)(null);return(0,h.useEffect)(()=>r.current?.focus(),[]),(0,V.jsxs)(`div`,{ref:r,role:`menu`,tabIndex:-1,className:tm,onKeyDown:r=>{if(!(r.ctrlKey||r.metaKey||r.altKey||r.nativeEvent.isComposing)){if(r.key===`ArrowDown`||r.key===`ArrowUp`)r.preventDefault(),n(Math.max(0,Math.min(e.options.length-1,t+(r.key===`ArrowDown`?1:-1))));else if(r.key===`Enter`){r.preventDefault();let n=e.options[t];n&&!n.disabled&&e.onPick(n.id)}else if(e.onBack&&(r.key===`Escape`||r.key===`ArrowLeft`))r.preventDefault(),r.stopPropagation(),e.onBack();else{let t=e.digits?Pu(r.key,e.options.length):null,n=t===null?void 0:e.options[t];if(!n||n.disabled)return;r.preventDefault(),e.onPick(n.id)}}},children:[e.onBack?(0,V.jsxs)(`button`,{type:`button`,className:`${rm} ${U} text-muted`,tabIndex:-1,onClick:e.onBack,children:[`‹ `,e.heading]}):(0,V.jsx)(`p`,{className:`${rm} ${U} text-muted`,children:e.heading}),e.options.map((r,i)=>(0,V.jsx)(qm,{option:r,checked:e.values?e.values.includes(r.id):r.id===e.value,multi:e.values!==void 0,cursor:i===t,digit:e.digits&&i<9?i+1:void 0,onHover:()=>n(i),onPick:()=>e.onPick(r.id)},r.id)),e.footer]})}function Ym(e){return(0,V.jsxs)(`div`,{className:`${tm} ${pm}`,children:[(0,V.jsx)(`p`,{className:`${rm} ${U} text-muted`,children:z(`newSession.branches`)}),(0,V.jsxs)(`label`,{className:fm,children:[(0,V.jsx)(`span`,{className:`text-muted`,children:z(`newSession.branchName`)}),(0,V.jsx)(`input`,{className:jr,autoFocus:!0,spellCheck:!1,placeholder:z(`newSession.branchNamePlaceholder`),value:e.branch,onChange:t=>e.onBranch(t.target.value)})]}),e.repos.map(t=>(0,V.jsxs)(`label`,{className:fm,children:[(0,V.jsxs)(`span`,{children:[t.name,t.primary&&(0,V.jsxs)(`span`,{className:`text-muted`,children:[` `,z(`newSession.primary`)]})]}),(0,V.jsx)(`select`,{className:jr,"aria-label":t.name,value:t.base||t.current,onChange:n=>e.onBase(t.path,n.target.value),children:(t.branches.includes(t.base||t.current)?t.branches:[t.base||t.current,...t.branches]).filter(e=>e!==``).map(e=>(0,V.jsx)(`option`,{value:e,children:e},e))})]},t.path))]})}function Xm(e){return e.replace(/\.git$/,``).split(/[/:]/).filter(Boolean).slice(-2).join(`/`)}function Zm(e){return e.id.startsWith(`root:`)?e.primary??e.checkouts[0]??e.id:e.id}function Qm(e,t){if(!e)return null;let n=t.find(t=>t.id===e||t.checkouts.includes(e));return n?{ref:Zm(n),clone:!1}:e.startsWith(`/`)?{ref:e,clone:!1}:null}function $m(e,t,n){let r=t.toLowerCase();return n?e.some(e=>e.toLowerCase()===`github.com/${r}`):e.some(e=>pu(e).base.toLowerCase()===(r.split(`/`)[1]??``))}function eh(e,t,n){let r=t.find(t=>t.id===e||t.checkouts.includes(e))?.id??e,i=n.find(e=>e.id===r);return i?{ref:Zm(i),clone:!1}:r.startsWith(`root:`)||r.startsWith(`/`)?null:{ref:r,clone:!0}}function th(e,t){let n=new Set(t.filter(e=>e.installed!==!1).map(e=>e.id)),r=new Set(t.length>0?e.filter(e=>!n.has(e.id)).map(e=>e.id):[]),i=new Set(e.map(e=>e.id)),a=t.filter(e=>n.has(e.id)&&!i.has(e.id)).map(e=>({id:e.id,name:e.name??e.id}));return{rows:[...e,...a],missing:r}}function nh(e){return{repo:e.pick.ref,machine:e.machine,...e.pick.clone?{clone:!0}:{},...e.baseRef?{baseBranch:e.baseRef}:{},...e.prompt?{prompt:e.prompt}:{},...e.engine?{engine:e.engine}:{},...e.engineThere?{engineThere:!0}:{},...!e.engineThere&&e.model?{model:e.model}:{}}}var rh=1.2,ih=.3,ah=20,oh=.35,sh=.25,ch=.12,lh=2,uh=1,dh={error:{dots:[0,4,8,2,6],bright:1},done:{dots:[3,7,5,2],bright:1},idle:{dots:[1,2,5,8,7,6,3,0],bright:.6}},fh=Array.from({length:9},(e,t)=>Math.hypot(t%3-1,Math.floor(t/3)-1));function ph(e){return oh+.65*(.5+.5*Math.cos(2*Math.PI*e/rh))}function mh(e,t,n,r=1){switch(e){case`working`:{let e=t*80/1e3/r;return fh.map(t=>ph(e-t*ih))}case`waiting`:{let e=[0,1,4,5].includes(Math.floor(t/r)%ah);return Array(9).fill(e?sh:1)}default:{let t=dh[e],r=Array(9).fill(ch);return t?.dots.forEach((e,i)=>{let a=Math.min(Math.max(n-i*uh,0),lh)/lh;r[e]=t.bright*a+ch*(1-a)}),r}}}function hh(e,t){let n=dh[e];return!n||t<(n.dots.length-1)*uh+lh}var gh={working:`info`,waiting:`warning`,error:`attention`,done:`success`,idle:`muted`},_h={prOpen:``,prMerged:``,prClosed:``};function vh(e){let t=yh(e);return{look:t,tone:gh[t]}}function yh(e){switch(e?.kind){case`busy`:case`running`:return`working`;case`needs-input`:return`waiting`;case`attention`:return e.reason===`rate_limited`?`waiting`:`error`;case`unseen`:return`done`;default:return`idle`}}function bh(e){return e.rowStatus?.kind===`needs-input`||e.rowStatus?.kind===`attention`}var xh={busy:0,attention:1,"needs-input":2,running:3,unseen:4,idle:5};function Sh(e){let t;for(let{rowStatus:n}of e)n&&(!t||xh[n.kind]<xh[t.kind]||n.kind===t.kind&&n.since>t.since)&&(t=n);return t}function Ch(e,t,n){if(!e)return null;if(e.lifecycle===`merged`)return{glyph:_h.prMerged,tone:n?`text-muted`:`text-merged`,state:`merged`};if(e.lifecycle===`closed`)return{glyph:_h.prClosed,tone:`text-muted`,state:`closed`};if(e.lifecycle!==`open`&&e.lifecycle!==`ready_to_merge`&&e.lifecycle!==`unknown`)return null;let r=t===`conflict`?`conflict`:t===`failing`?`failing`:t===`passing`?`passing`:e.checkState===`pending`?`pending`:void 0,i=n?`text-muted`:r===`conflict`?`text-warning`:r===`failing`?`text-error`:r===`passing`?`text-success`:`text-muted`;return{glyph:_h.prOpen,tone:i,state:`open`,...r?{checks:r}:{}}}function wh(e){return Ch(e.pr,e.prChip,e.prChipStale===!0)}function Th(e){return Ch(e,(e.mergeable??``).toUpperCase()===`CONFLICTING`?`conflict`:e.checkState===`failing`?`failing`:e.checkState===`passing`?`passing`:null,!1)}function Eh(e){let t=e=>e.state===`open`?e.checks===`conflict`||e.checks===`failing`?0:1:e.state===`merged`?2:3;return[...e].sort((e,n)=>t(e)-t(n))[0]}var Dh=3,Oh=new Set,kh;function Ah(e,t){let n=typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches,r=1/0,i=e.held+t-e.step,a=hh(e.look,n?r:i);return mh(e.look,t,n?r:i,n?Dh:1).forEach((t,n)=>{let r=e.el.children[n].style;r.opacity=t.toFixed(3)}),a}function jh(){let e=Math.floor(performance.now()/80);for(let t of Oh)Ah(t,e)||Oh.delete(t);Mh()}function Mh(){kh=Oh.size?window.setTimeout(jh,80-performance.now()%80+2):void 0}function Nh(e,t,n){let r=Math.floor(performance.now()/80),i=n>0?Math.max(Date.now()-n,0):1/0,a={el:e,look:t,step:r,held:Math.floor(i/80)};return Ah(a,r)&&(Oh.add(a),kh===void 0&&Mh()),()=>{Oh.delete(a)}}function Ph({status:e}){let{look:t,tone:n}=vh(e);return(0,V.jsx)(Lh,{look:t,tone:n,since:e?.since??0},t)}var Fh=e=>e===`muted`?`text-muted`:e===`ink`?`text-ink`:ip[e];function Ih(){return(0,V.jsx)(Lh,{look:`working`,tone:`info`,since:Date.now()})}function Lh({look:e,tone:t,since:n}){let r=(0,h.useRef)(null),[i]=(0,h.useState)(n);return(0,h.useLayoutEffect)(()=>{let t=r.current;return t?Nh(t,e,i):void 0},[e,i]),(0,V.jsx)(`span`,{ref:r,className:`inline-grid flex-none grid-cols-[repeat(3,3px)] auto-rows-[3px] gap-px self-center ${Fh(t)}`,"aria-hidden":`true`,children:Array.from({length:9},(e,t)=>(0,V.jsx)(`i`,{className:`rounded-full bg-current opacity-12`},t))})}var Rh={offline:`newSession.remoteOffline`,outdated:`newSession.remoteOutdated`},zh=`local`,Bh=`auto`,Vh=`rove.newSession.autoMachine`;function Hh(){try{return localStorage.getItem(Vh)===`1`}catch{return!1}}var Uh=(e,t)=>Gu(e,`machines.repos`,{machine:t});function Wh(e,t){let n=t.filter(e=>e.state===`online`).map(e=>e.alias).join(`
|
|
41
41
|
`);(0,h.useEffect)(()=>{for(let t of n?[zh,...n.split(`
|
|
42
42
|
`)]:[])Uh(e,t).catch(()=>{})},[e,n])}function Gh(e,t){let[n,r]=(0,h.useState)(null);return(0,h.useEffect)(()=>{if(!t)return;let n=!1;return Gu(e,`machines.engines`,{machine:t}).then(e=>!n&&r({machine:t,reply:e})).catch(()=>{}),()=>{n=!0}},[e,t]),t?(n?.machine===t?n.reply:Y(e,`machines.engines`,{machine:t}))?.engines??[]:[]}function Kh(e,t,n){let r=th(n.engines,Gh(e,t)),i=r.rows.filter(e=>!r.missing.has(e.id)),a=i.some(e=>e.id===n.engine)?n.engine:i[0]?.id??n.engine;return{engines:r.rows,engine:a,setEngine:n.setEngine,missing:t?r.missing:void 0}}function qh(e,t,n){let[r,i]=(0,h.useState)(null),a=Yh(e,r?.from??``);return(0,h.useEffect)(()=>{!r||!a.loaded||!t.loaded||(t.problem||n(eh(r.ref,a.repos,t.repos)),i(null))},[r,a,t,n]),(e,t)=>i(e&&t?{from:e,ref:t}:null)}function Jh(e,t,n){let r=Wm(e),[i,a]=(0,h.useState)(t.machine??``),[o,s]=(0,h.useState)(()=>!t.machine&&Hh()),c=Yh(e,i),[l,u]=(0,h.useState)(!1),d=Kh(e,l?i:``,n);Wh(e,r);let[f,p]=(0,h.useState)(null),[m,g]=(0,h.useState)(``),_=qh(e,c,e=>p(t=>t??e));return(0,h.useEffect)(()=>{!i||!c.loaded||i!==t.machine||p(e=>e??Qm(t.repo,c.repos))},[c.loaded]),{machines:r,machine:i,auto:o,remote:i!==``,machineName:r.find(e=>e.alias===i)?.hostLabel||i,remoteList:c,engineThere:l,setEngineThere:u,shown:d,pick:f,setPick:p,base:m,setBase:g,switchTo(e,t){let n=e===`auto`?``:e;s(e===Bh);try{localStorage.setItem(Vh,e===`auto`?`1`:`0`)}catch{}_(n&&(i||`local`),i?f?.ref:t),a(n),p(null),g(``)}}}function Yh(e,t){B();let[n,r]=(0,h.useState)(null);if((0,h.useEffect)(()=>{if(!t)return;let n=!1;return Uh(e,t).then(e=>!n&&r({machine:t,reply:e,failed:``})).catch(e=>!n&&r({machine:t,reply:null,failed:String(e)})),()=>{n=!0}},[e,t]),!t)return{repos:[],loaded:!0,problem:``};let i=n?.machine===t?n:void 0,a=Y(e,`machines.repos`,{machine:t});if(!i&&!a)return{repos:[],loaded:!1,problem:``};let o=i?i.reply:a;if(!o)return{repos:[],loaded:!0,problem:z(`newSession.remoteFailed`,{machine:t,message:i?.failed??``})};let s=o.reason?Rh[o.reason]:void 0,c=o.reason?s?z(s,{machine:t}):z(`newSession.remoteFailed`,{machine:t,message:o.message??o.reason}):``;return{repos:o.repos,loaded:!0,problem:c}}function Xh(e,t){return t.problem?t.problem:t.loaded?z(`newSession.remoteNone`,{machine:e}):z(`newSession.remoteLoading`,{machine:e})}function Zh(){return(0,V.jsxs)(`svg`,{className:Jp,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,V.jsx)(`rect`,{x:`2`,y:`3`,width:`12`,height:`8`,rx:`1`}),(0,V.jsx)(`path`,{d:`M5.5 13.5h5M8 11v2.5`})]})}function Qh(e){let t=(B()===`zh`?Wi:Ui).machine,n=e.machines.find(t=>t.alias===e.value),r=e.value===`auto`?z(`newSession.machineAuto`):e.value?n?.hostLabel||e.value:z(`newSession.thisMachine`);return(0,V.jsx)(Gm,{field:`machine`,title:z(`newSession.machine`),label:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Zh,{}),(0,V.jsx)(`span`,{className:Yp,children:r})]}),children:n=>(0,V.jsx)(Jm,{heading:z(`newSession.machine`),options:[{id:Bh,label:z(`newSession.machineAuto`)},{id:``,label:z(`newSession.thisMachine`)},...e.machines.map(e=>({id:e.alias,label:zm(e,t),disabled:e.state!==`online`}))],footer:e.value===`auto`?(0,V.jsx)(`p`,{className:`${dm} text-muted`,children:z(`newSession.machineAutoNote`)}):null,value:e.value,digits:!0,onPick:t=>{e.onPick(t),n()}})})}function $h(e){let{machine:t}=e;return(0,V.jsx)(Jm,{heading:z(`newSession.agentPlace`),options:[{id:``,label:z(`newSession.thisMachine`)},{id:`there`,label:t}],value:e.there?`there`:``,digits:!0,onBack:e.onBack,onPick:t=>e.onPick(t!==``),footer:(0,V.jsx)(`p`,{className:`${dm} text-muted`,children:z(e.there?`newSession.agentThereNote`:`newSession.agentHereNote`,{machine:t})})})}function eg(e){let[t,n]=(0,h.useState)(``),r=t.trim();return(0,V.jsx)(Gm,{field:`branch`,title:z(`newSession.branch`),label:e.value||z(`newSession.branch`),children:i=>(0,V.jsx)(Km,{placeholder:z(`newSession.branchTypeRef`),empty:``,rows:[{key:``,text:z(`newSession.branchRemoteDefault`),checked:e.value===``}],query:t,onQuery:n,extra:r?{key:r,text:r,checked:e.value===r}:null,onPick:t=>{e.onPick(t),n(``),i()}})})}async function tg(e,t){return(await e.client.request(`task.spawn`,nh(t))).taskIds[0]}function ng(e){let{progress:t,error:n}=e;return!t&&!n?null:(0,V.jsxs)(`div`,{className:Bp,children:[t&&(0,V.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-muted`,"data-field":`clone-progress`,children:[(0,V.jsx)(Ih,{}),(0,V.jsx)(`span`,{className:`running-shimmer:bg-[linear-gradient(90deg,var(--ink)_0%,var(--ink)_35%,var(--accent)_50%,var(--ink)_65%,var(--ink)_100%)] running-shimmer:bg-size-[300%_100%] running-shimmer:bg-clip-text running-shimmer:text-transparent running-shimmer:animate-shimmer`,children:t})]}),n&&!vm(n)&&(0,V.jsxs)(`p`,{className:`m-0 text-error`,children:[`※ `,n]}),n&&vm(n)&&(0,V.jsxs)(`p`,{className:`pointer-events-auto m-0 text-error`,"data-field":`no-disk-space`,children:[`※ `,G(`tasks`,`toast.noDiskSpace`),` `,(0,V.jsx)(H,{hit:`tight`,disabled:e.busy,onClick:e.onRetry,children:z(`newSession.retry`)})]})]})}function rg(e){return e instanceof Ho&&e.code===`CLONE_FAILED`?G(`newTask`,`error.cloneFailed`,{error:e.message}):e instanceof Error?e.message:String(e)}function ig({on:e,...t}){return(0,V.jsx)(`button`,{type:`button`,className:`${Xp(e)} ${Zp}`,"aria-pressed":e,...t})}function ag(e){let[t,n]=(0,h.useState)(``);if(e.ungrouped)return null;if(e.remote)return e.remotePick&&(0,V.jsx)(eg,{value:e.remoteBase,onPick:e.onRemoteBase});let{repos:r,bases:i,inPlace:a}=e,o=r[0]??``,s=e.probes[o]??null,c=i[o]||s?.current||``,l=gu(s?.branches??[],t).map(e=>({key:e,text:e,checked:e===(i[o]||s?.current)})),u=r.map(t=>({path:t,name:pu(t).base,primary:t===o,branches:e.probes[t]?.branches??[],current:e.probes[t]?.current??``,base:i[t]??``}));return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(ig,{on:!a,disabled:r.length>1||e.plain,title:e.plain?z(`newSession.worktreeNoGit`):r.length>1?z(`newSession.worktreeMulti`):z(a?`newSession.worktreeOff`:`newSession.worktreeOn`),onClick:e.onToggleWorktree,children:[(0,V.jsx)(gm,{}),(0,V.jsx)(`span`,{className:Yp,children:z(`newSession.worktree`)})]}),r.length>1?(0,V.jsx)(Gm,{field:`branch`,title:z(`newSession.branches`),label:z(`newSession.branches`),children:()=>(0,V.jsx)(Ym,{repos:u,branch:e.branchName,onBranch:e.onBranchName,onBase:e.onBase})}):!a&&s?.ok&&c&&(0,V.jsx)(Gm,{field:`branch`,title:z(`newSession.branch`),label:c,children:r=>(0,V.jsx)(Km,{placeholder:z(`newSession.branchSearch`),empty:z(`newSession.branchEmpty`),rows:l,query:t,onQuery:n,onPick:t=>{e.onBase(o,t),n(``),r()}})})]})}var og=`rove.web.newSession.prompt`,sg=`rove.web.newSession.attachments`,cg=sessionStorage.getItem(og)??``;function lg(){return cg}function ug(e){cg=e;try{sessionStorage.setItem(og,e)}catch{}}function dg(e,t){let[n,r]=(0,h.useState)(null),i=t&&n!==null,a=i?n:e.engine?[e.engine]:[];return{ids:a,comparing:i,setComparing:e=>r(e?a:null),toggle(t){let n=ku(a,t);r(n),n[0]&&n[0]!==e.engine&&e.setEngine(n[0])}}}function fg(e){let{picks:t,choice:n}=e,r=n.engines;if(r.length<2)return null;let i=t.ids.map(e=>r.find(t=>t.id===e)?.name??e);return(0,V.jsx)(Gm,{field:`engine`,title:z(`newSession.engine`),label:Au(i)||z(`newSession.engine`),children:i=>(0,V.jsx)(Jm,{heading:z(`newSession.engine`),options:r.map(t=>{if(!e.missing)return{id:t.id,label:t.name,dim:t.ready===!1};let n=e.missing.has(t.id);return{id:t.id,label:n?z(`newSession.engineMissing`,{engine:t.name}):t.name,disabled:n}}),value:n.engine,...t.comparing?{values:t.ids}:{},onPick:e=>{if(t.comparing)return t.toggle(e);n.setEngine(e),i()},footer:e.available&&r.length>1?(0,V.jsx)(H,{className:`mx-2 mt-1 mb-0.5 self-start font-mono`,"data-field":`compare-engines`,hit:`tight`,onClick:()=>t.setComparing(!t.comparing),children:z(t.comparing?`compare.oneEngine`:`compare.severalEngines`)}):null})})}function pg(e){return(0,V.jsx)(Gm,{field:`model`,title:z(`newSession.model`),label:Ou(e.models,e.model,z(`newSession.model`)),children:t=>(0,V.jsx)(Jm,{heading:z(`newSession.modelHeading`),options:e.models,value:e.model,digits:!0,onPick:n=>{e.onModel(n),t()}})})}var mg=6e4,hg=/^(?:(today|tomorrow|今天|明天)\s*)?(\d{1,2})(?::(\d{2}))?\s*(am|pm)?$/i,gg=/^\+\s*(?:(\d+)\s*h)?\s*(?:(\d+)\s*m)?$/i;function _g(e,t){let n=e.trim(),r=gg.exec(n);if(r&&(r[1]||r[2])){let e=Number(r[1]??0)*60+Number(r[2]??0);return e>0?new Date(t.getTime()+e*mg):null}let i=hg.exec(n);if(!i)return null;let a=i[1]?.toLowerCase(),o=Number(i[2]),s=Number(i[3]??0),c=i[4]?.toLowerCase();if(c){if(o<1||o>12)return null;o=o%12+(c===`pm`?12:0)}if(o>23||s>59)return null;let l=new Date(t.getFullYear(),t.getMonth(),t.getDate(),o,s);if(a===`tomorrow`||a===`明天`)l.setDate(l.getDate()+1);else if(l.getTime()<=t.getTime()){if(a)return null;l.setDate(l.getDate()+1)}return l.getTime()>t.getTime()?l:null}function vg(e,t=new Date){let n=e.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`});return e.toDateString()===t.toDateString()?n:`${e.toLocaleDateString([],{weekday:`short`})} ${n}`}function yg(e){let[t,n]=(0,h.useState)(``),r=()=>{let n=_g(t,new Date);if(!n)return e.onInvalid(z(`newSession.laterBad`));e.onSchedule(n)};return(0,V.jsxs)(`div`,{className:mm,children:[(0,V.jsx)(`input`,{className:`${jr} min-w-0 flex-1`,value:t,placeholder:z(`newSession.laterPlaceholder`),"aria-label":z(`newSession.later`),spellCheck:!1,autoComplete:`off`,autoFocus:!0,onChange:e=>n(e.target.value),onKeyDown:t=>{if(t.key===`Escape`)return t.preventDefault(),t.stopPropagation(),e.onBack();t.key!==`Enter`||t.nativeEvent.isComposing||(t.preventDefault(),t.stopPropagation(),r())}}),(0,V.jsx)(H,{variant:`filled`,disabled:!t.trim(),onClick:r,children:z(`newSession.laterConfirm`)})]})}function bg(e){let[t,n]=(0,h.useState)(`root`),r=e.agentPlace;return(0,V.jsx)(Gm,{field:`more`,title:z(`newSession.more`),label:(0,V.jsx)(`span`,{"aria-hidden":`true`,children:`⋯`}),onClose:()=>n(`root`),children:i=>t===`later`?(0,V.jsxs)(`div`,{className:tm,children:[(0,V.jsxs)(`button`,{type:`button`,className:`${rm} ${U} text-muted`,onClick:()=>n(`root`),children:[`‹ `,z(`newSession.later`)]}),(0,V.jsx)(yg,{onBack:()=>n(`root`),onInvalid:e.onInvalid,onSchedule:t=>{i(),e.onLater?.(t)}})]}):t===`agent`&&r?(0,V.jsx)($h,{...r,onBack:()=>n(`root`),onPick:e=>{r.onPick(e),i()}}):(0,V.jsxs)(`div`,{role:`menu`,className:tm,children:[r&&(0,V.jsx)(xg,{label:z(`newSession.agentPlace`),dim:r.there?r.machine:z(`newSession.thisMachine`),sub:!0,disabled:e.busy,onClick:()=>n(`agent`)}),e.onLater&&(0,V.jsx)(xg,{label:z(`newSession.later`),sub:!0,disabled:e.busy,onClick:()=>n(`later`)})]})})}function xg(e){return(0,V.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`${im({cursor:!1})} [&:hover:not(:disabled)]:bg-hover`,disabled:e.disabled,onClick:e.onClick,children:[(0,V.jsx)(`span`,{className:sm,children:e.label}),(e.dim!==void 0||e.sub)&&(0,V.jsxs)(`span`,{className:`${om} text-muted`,children:[e.dim,e.sub&&(0,V.jsx)(fs,{right:!0})]})]})}var Sg=128,Cg=80,wg=3,Tg=2,Eg=Sg/2,Dg=Cg/2,Og=25,kg=(1-1.2/Og)**2,Ag=1e3/30,jg=7,Mg=0,Ng=1,Pg=2,Fg=3,Ig=4,Lg=[``,`--color-subtle`,`--color-muted`,`--color-ink`,`--color-accent`],Rg=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5],zg=Array.from({length:64},(e,t)=>{let n=t%8,r=t>>3;return(4*(Rg[(r&3)*4+(n&3)]??0)+([0,2,3,1][(r>>2)*2+(n>>2)]??0)+.5)/64}),Bg=(e,t)=>zg[(t&7)*8+(e&7)]??1,Vg=[{radius:1.55,lift:.3,roll:-.42,speed:.9,phase:.4,ink:Ig},{radius:1.95,lift:.22,roll:.3,speed:-.55,phase:2.6,ink:Fg},{radius:2.4,lift:.36,roll:-.12,speed:.38,phase:4.4,ink:Fg}],Hg=1.9,Ug=[[6,9,.3],[22,68,2.1],[37,4,4],[95,7,1.2],[118,20,3.3],[122,62,5.1],[11,40,2.8],[83,75,.9]];function Wg(e,t){e.fill(Mg);let n=(t,n,r)=>{t>=0&&t<Sg&&n>=0&&n<Cg&&(e[n*Sg+t]=r)};for(let[e,r,i]of Ug)Math.sin(t*.8+i)>-.5&&n(e,r,Ng);let r=-.55+.25*Math.sin(t*.3),i=-.5,a=.67,o=Math.hypot(r,i,a),s=t*.35,c=Math.sin(s),l=Math.cos(s),u=.4,d=Math.sin(u),f=Math.cos(u);for(let e=0;e<Cg;e++)for(let t=0;t<Sg;t++){let s=(t+.5-Eg)/Og,u=(e+.5-Dg)/Og,p=s*s+u*u;if(p>=1)continue;let m=Math.sqrt(1-p),h=Math.max(0,(s*r+u*i+m*a)/o),g=s*f+u*d,_=u*f-s*d,v=Math.atan2(g*l+m*c,m*l-g*c),y=Math.asin(Math.max(-1,Math.min(1,_))),b=.5+.5*Math.sin(y*9+1.3*Math.sin(v*2+y*3));h**.75*(.4+.6*b)>Bg(t,e)?n(t,e,h>.4?Fg:Pg):p>kg&&n(t,e,Ng)}for(let e of Vg){let r=Math.sin(e.roll),i=Math.cos(e.roll),a=t=>{let n=e.radius*Math.cos(t),a=e.radius*Math.sin(t),o=a*e.lift,s=n*i-o*r,c=n*r+o*i,l=s*s+c*c<1;return a<0&&l?null:[Math.floor(Eg+s*Og),Math.floor(Dg+c*Og),l]},o=Math.round(Math.PI*e.radius*Og);for(let e=0;e<o;e++){let t=a(e/o*Math.PI*2);t&&!t[2]&&n(t[0],t[1],Ng)}let s=e.phase+t*e.speed,c=.5/(e.radius*Og),l=-Math.sign(e.speed)*c;for(let e=Hg/c;e>=0;e--){let t=a(s+e*l);if(t?.[2])for(let e=-2;e<=2;e++)for(let r=-2;r<=2;r++)n(t[0]+r,t[1]+e,Mg)}for(let t=Hg/c;t>0;t--){let r=a(s+t*l),i=1-t*c/Hg;r&&i>Bg(r[0],r[1])&&n(r[0],r[1],i>.6?e.ink:Pg)}let u=a(s);if(u)for(let t=-1;t<=1;t++)for(let r=-1;r<=1;r++)n(u[0]+r,u[1]+t,e.ink)}}function Gg(e,t){let n=e.getContext(`2d`);if(!n)return;let r=window.devicePixelRatio||1,i=Math.round(384*r);e.width!==i&&(e.width=i,e.height=Math.round(240*r)),n.setTransform(r,0,0,r,0,0),n.clearRect(0,0,384,240);let a=getComputedStyle(e);for(let e=Ng;e<=Ig;e++){n.fillStyle=a.getPropertyValue(Lg[e]??``)||a.color;for(let r=0;r<t.length;r++)t[r]===e&&n.fillRect(r%Sg*wg,Math.floor(r/Sg)*wg,Tg,Tg)}}function Kg(){let e=(0,h.useRef)(null);return(0,h.useEffect)(()=>{let t=e.current;if(!t)return;let n=new Uint8Array(10240);if(typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches){Wg(n,jg),Gg(t,n);return}let r=0,i=0,a=e=>{r=requestAnimationFrame(a),!(e-i<Ag)&&(i=e,Wg(n,e/1e3),Gg(t,n))};return r=requestAnimationFrame(a),()=>cancelAnimationFrame(r)},[]),(0,V.jsx)(`div`,{"aria-hidden":`true`,className:`mb-3 max-w-full`,children:(0,V.jsx)(`canvas`,{ref:e,width:384,height:240,"data-plate":`rove`,className:`h-auto w-96 max-w-full text-muted`})})}var qg=`clone:`;function Jg(e){let{model:t,saved:n,picked:r,primary:i,home:a,query:o,remote:s}=e,[c,l]=(0,h.useState)(()=>Y(t,`github.repos`)??null);(0,h.useEffect)(()=>{let e=!1,n=t.client.onOpen(()=>{Gu(t,`github.repos`).then(t=>!e&&l(t)).catch(()=>!e&&l(e=>e??{repos:[],reason:`failed`}))});return()=>{e=!0,n()}},[t]);let u=o.trim(),d=u.toLowerCase(),f=wu(u),p=n.filter(e=>e.toLowerCase().includes(d)||f!==null&&`/${pu(e).base.toLowerCase()}`===f.slice(f.indexOf(`/`))),m=z(`newSession.noFolder`),g=e.ungrouped&&(!u||m.toLowerCase().includes(u.toLowerCase()))?[{key:wd,text:m,checked:e.ungrouped.on}]:[],_=p.map((e,t)=>{let{base:n,dir:a}=pu(e);return{key:e,text:n,dim:e===i&&r.length>1?`${z(`newSession.primary`)}, ${a}`:a,dimPath:!0,title:e,checked:r.includes(e),ruled:t===0&&g.length>0}}),v=Su(u),y=v&&(v.includes(`:`)||p.length===0)?v:null,b=!y&&_u(u)&&!n.includes(u)&&(!s||u.startsWith(`/`))?yu(vu(u,a)):``,x=(c?.repos??[]).filter(e=>e.nameWithOwner.toLowerCase().includes(f??d)).filter(e=>!$m(n,e.nameWithOwner,s!==void 0)).sort((e,t)=>Number(t.nameWithOwner.toLowerCase()===f)-Number(e.nameWithOwner.toLowerCase()===f)).map(t=>({key:qg+t.nameWithOwner,text:t.nameWithOwner,dim:t.description,title:t.description,checked:e.cloning===t.nameWithOwner})),S=f!==null&&!/^(?:ssh:|git@)/i.test(u)&&x[0]?.text.toLowerCase()===f?null:y?{key:qg+y,text:s?z(`newSession.cloneRowOn`,{source:y,machine:s.name}):z(`newSession.cloneRow`,{source:y})}:b?{key:b,text:b,checked:r.includes(b)}:null;return(0,V.jsx)(Km,{placeholder:z(s?`newSession.repoSearchRemote`:`newSession.repoSearch`),empty:s?.empty??z(`newSession.repoEmpty`),rows:s?.blocked?[]:[...g,..._],query:o,onQuery:e.onQuery,extra:s?.blocked?null:S,more:s?.blocked?[]:x,moreLabel:z(`newSession.githubGroup`),hint:s?void 0:z(`newSession.repoMultiHint`),onPick:(t,n)=>{if(t===`~scratch`)return e.ungrouped?.pick(),e.close();if(!t.startsWith(`clone:`))return e.onToggle(t,n);e.onClone(t.slice(6)),e.close()}})}function Yg(e,t){let n=e.scratch||e.noProject,r=n?[]:t.extraRepos??[];return{...n?{ungrouped:!0}:{repo:t.repo},...t.baseRef?{baseBranch:t.baseRef}:{},...r.length>0?{extras:r}:{},...e.machine?{machine:e.machine.id}:{},prompt:t.prompt,...t.engine?{engine:t.engine}:{},worktree:e.kind===`task`,retryOf:{id:e.id,label:e.label}}}function Xg(e,t){return e?[e,...(t.extras??[]).map(e=>e.repo)]:[]}function Zg(e,t){return e?{...t.baseBranch?{[e]:t.baseBranch}:{},...Object.fromEntries((t.extras??[]).flatMap(e=>e.baseRef?[[e.repo,e.baseRef]]:[]))}:{}}function Qg(e){return[e.machine??``,e.repo??``,e.ungrouped?`u`:``,e.retryOf?.id??``,e.baseBranch??``,e.worktree===void 0?``:String(e.worktree)].join(`\0`)}function $g(e,t){return e.retryOf&&e.engine&&e.engine===t?e.retryOf.id:void 0}async function e_(e,t){try{let{task:n}=await e.client.request(`task.get`,{taskId:t.id});if(!n.prompt)return void I(z(`menu.retryNoPrompt`),`error`);F(Yg(t,{...n,prompt:n.prompt}))}catch(e){I(W(e),`error`)}}function t_(e,t){let n=async n=>{await e.act(`task.archive`,{taskId:t.id,archived:!0,...n?{force:n}:{}}),I(G(`tasks`,`archive.done`,{title:t.label}))};C.set((0,V.jsx)(Ci,{title:z(`newSession.retryArchiveTitle`,{title:t.label}),body:z(`newSession.retryArchiveBody`),confirmLabel:G(`tasks`,`menu.archive`),onConfirm:()=>n(!1),escalate:{when:e=>e instanceof Ho&&e.code===`TASK_BUSY`,label:G(`tasks`,`archive.busyConfirm`),title:G(`tasks`,`archive.busyTitle`),body:()=>G(`tasks`,`archive.busyBody`,{title:t.label}),run:()=>n(!0)}}))}var n_=v([]),r_=()=>y(n_);async function i_(e){n_.set((await e.request(`snippets.get`)).snippets)}async function a_(e,t){n_.set((await e.request(`snippets.save`,{name:t.name,text:t.text})).snippets)}async function o_(e,t){n_.set((await e.request(`snippets.remove`,{name:t})).snippets)}var s_=/^[A-Za-z0-9][\w-]{0,31}$/;function c_(e,t){let n=t;for(;n>0&&/[\w-]/.test(e[n-1]??``);)n--;if(n===0||e[n-1]!==`@`)return null;let r=e[n-2];if(r!==void 0&&!/\s/.test(r))return null;let i=t;for(;i<e.length&&/[\w-]/.test(e[i]??``);)i++;return{start:n-1,end:i,query:e.slice(n,t)}}function l_(e,t){let n=t.toLowerCase(),r=e.filter(e=>e.name.toLowerCase().startsWith(n));return[...r.filter(e=>e.name.toLowerCase()===n),...r.filter(e=>e.name.toLowerCase()!==n)]}function u_(e,t,n){return{text:e.slice(0,t.start)+n.text+e.slice(t.end),caret:t.start+n.text.length}}var d_=e=>e.split(`
|
|
@@ -57,7 +57,7 @@ Then look for the hook that older version installed. Check my engine settings fi
|
|
|
57
57
|
`),[i,a]=(0,h.useState)(()=>Y(e,`kanban.boards`)??null);return(0,h.useEffect)(()=>{let t=!0,r=e.client,i=e=>r.request(e).then(e=>e.repos).catch(()=>[]);return Promise.all([i(`repos.list`),i(`issue.repos`)]).then(([e,t])=>_E(e,n,t)).then(e=>Promise.all(e.map(e=>r.request(`issue.list`,{repo:e}).catch(t=>({repoRoot:e,nextId:1,issues:[],readError:mE(t)}))))).then(n=>{let r=Wu(e,`kanban.boards`,void 0,[...n].sort((e,t)=>e.repoRoot.localeCompare(t.repoRoot)));t&&a(r)}),()=>{t=!1}},[e,t,r]),i}function YD(e){let{issue:t}=e,n=t.body.trim();return(0,V.jsxs)(`div`,{"data-issue":t.id,className:wD({selected:e.selected,attention:e.badge?.tone===`text-error`}),onClick:()=>e.selected?e.onOpen():e.onSelect(),onContextMenu:t=>{t.preventDefault(),e.onMenu(t.clientX,t.clientY)},children:[(0,V.jsxs)(`div`,{className:TD,children:[(0,V.jsx)(`span`,{className:ED(e.column===`done`),children:t.title}),(0,V.jsxs)(`span`,{className:`mono text-muted`,children:[`#`,t.id]})]}),(0,V.jsx)(`div`,{className:`text-muted ${DD}`,children:n}),(0,V.jsxs)(`div`,{className:`mono text-muted ${OD}`,children:[(0,V.jsx)(`span`,{children:t.created}),e.badge&&(0,V.jsx)(`span`,{className:e.badge.tone,children:e.badge.label})]})]})}var XD=5e3,ZD=760;function QD({model:e}){let{kanban:t,group:n,common:r}=fE(),[i,a]=bE(XD),o=JD(e,i),{engines:s,defaultEngine:c}=qD(e),l=y(e.tasks),u=yE(e),[d,f]=(0,h.useState)(null),[p,m]=(0,h.useState)(null),g=CE(),[_,v]=(0,h.useState)(!1);(0,h.useEffect)(()=>{let e=g.current;if(!e)return;let t=new ResizeObserver(()=>v(e.clientWidth<ZD));return t.observe(e),()=>t.disconnect()},[g]);let b=o??[],x=u?b.find(e=>e.repoRoot.replace(/^\/private\//,`/`)===u.replace(/^\/private\//,`/`)):void 0,w=Math.max(0,b.findIndex(e=>e.repoRoot===(d??x?.repoRoot))),T=b[w],E=b.map(e=>e.repoRoot),D=b.filter(e=>e.readError).map(e=>`${e.repoRoot}\0${e.readError}`).join(`
|
|
58
58
|
`);(0,h.useEffect)(()=>{for(let e of b)e.readError&&I($(t.readFailedToast,{repo:gE(e.repoRoot,E),error:e.readError}),`error`)},[D]);let k=l?.tasks??[],A=new Set(k.map(e=>e.id)),ee=e=>k.find(t=>t.id===e)?.group,{columns:j,attentionCount:te}=rD(T?aD(T.issues,A.size===0?void 0:e=>A.has(e)):[],e=>ee(e)===`waiting-on-you`),M={backlog:t.column.backlog,in_progress:t.column.inProgress,parked:t.column.parked,done:t.column.done},N=(e,t)=>{let r=e.taskId&&(t===`in_progress`||t===`parked`)?ee(e.taskId):void 0,i=r===`waiting-on-you`?n.waitingOnYou:r===`landing`?n.landing:r===`ready-for-review`?n.readyForReview:r===`working`?n.working:null;return r&&i?{label:i,tone:KD[r]??`text-muted`}:null},P=async(t,n,r,i)=>{try{return await e.client.request(t,{repo:T?.repoRoot,...n})}catch(e){return I($(r,{id:String(i),error:mE(e)}),`error`),null}finally{a()}},F=(e,n)=>P(`issue.setStatus`,{id:e.id,status:n},t.statusFailed,e.id),ne=t=>{O.set(null),e.select(t)},re=async(n,r,i)=>{try{let a=await sD(e.client,{repo:n,issue:r,engine:i.engine,placement:i.placement});for(let e of a.warnings)I($(e.kind===`link`?t.linkFailed:t.statusFailed,{id:String(r.id),error:e.error}),`error`);i.jump?(O.set(null),e.selectWhenListed(a.taskId),a.tabId&&await e.refreshTabsNow(a.taskId).then(()=>e.select(a.taskId,a.tabId))):I($(t.detail.startedBackground,{title:`#${r.id} ${r.title}`}))}catch(e){I(W(e),`error`)}finally{a()}},ie=async(e,n)=>{if(!T||n.kind===`create`)return;let r={};n.title!==e.title&&(r.title=n.title),n.body!==e.body&&(r.body=n.body),(r.title!==void 0||r.body!==void 0)&&await P(`issue.update`,{id:e.id,...r},t.updateFailed,e.id),n.status!==e.status&&await F(e,n.status),n.kind===`open`?ne(n.taskId):n.kind===`unlink`?await P(`issue.update`,{id:e.id,task:`none`},t.unlinkFailed,e.id):n.kind===`start`&&await re(T.repoRoot,{...e,...r},n)},ae=t=>{T&&(m(t.id),C.set((0,V.jsx)(GD,{model:e,issue:t,mode:`detail`,engines:s,defaultEngine:c,onOutcome:e=>void ie(t,e)})))},L=()=>{if(!T)return;let n=T.repoRoot,r={id:T.nextId,title:``,status:`open`,created:new Date().toISOString().slice(0,10),body:``};C.set((0,V.jsx)(GD,{model:e,issue:r,mode:`create`,engines:s,defaultEngine:c,onOutcome:i=>{i.kind===`create`&&(async()=>{try{let t=await e.client.request(`issue.create`,{repo:n,title:i.title,body:i.body});if(a(),!i.start)return;let o=t.issues.find(e=>e.id===r.id)??t.issues.reduce((e,t)=>e&&e.id>t.id?e:t,null);o&&await re(n,o,i.start)}catch(e){I($(t.createFailed,{error:mE(e)}),`error`)}})()}}))},oe=()=>{let n=T?.issues.find(e=>e.id===p);if(!T||!n)return;let i=T.repoRoot;C.set((0,V.jsx)(Ci,{title:$(t.confirmDelete.title,{id:String(n.id)}),body:$(t.confirmDelete.body,{title:n.title}),confirmLabel:r.confirm,onConfirm:async()=>{try{await e.client.request(`issue.delete`,{repo:i,id:n.id}),m(null)}catch(e){I($(t.deleteFailed,{id:String(n.id),error:mE(e)}),`error`)}finally{a()}}}))},R=e=>{b.length!==0&&(f(b[(w+e+b.length)%b.length]?.repoRoot??null),m(null))},se=e=>{let t=tD(j,p,e);t!=null&&m(t)},ce=e=>j.some(e=>e.issues.length>0)?se(e):R(e===`left`?-1:1);SE(e=>{if(e.ctrlKey)return e.key===`c`&&(O.set(null),!0);switch(e.key){case`Escape`:case`q`:return O.set(null),!0;case`r`:return a(),!0;case`Tab`:return R(e.shiftKey?-1:1),!0;case`ArrowUp`:return se(`up`),!0;case`ArrowDown`:return se(`down`),!0;case`ArrowRight`:case`l`:return ce(`right`),!0;case`ArrowLeft`:case`h`:return ce(`left`),!0;case`Enter`:{let e=T?.issues.find(e=>e.id===p);return e&&ae(e),!0}case`n`:return L(),!0;case`d`:return oe(),!0;default:return!1}});let le=(0,h.useRef)(null);(0,h.useEffect)(()=>{le.current?.querySelector(`[data-issue="${p}"]`)?.scrollIntoView({block:`nearest`})},[p]);let ue=(e,n,r)=>{m(e.id),S.set({x:n,y:r,items:UD.filter(t=>t!==e.status).map(n=>({label:$(t.menu.setStatus,{status:t.detail.status[n]}),run:()=>void F(e,n)}))})},de=j.find(e=>e.issues.some(e=>e.id===p))??j.find(e=>e.issues.length>0)??j[0],fe=(e,n=!1)=>{let r=$(t.attention,{count:String(te)});return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`span`,{children:[M[e.key],` (`,e.issues.length+e.hiddenCount,`)`]}),e.key===`in_progress`&&te>0&&(0,V.jsx)(`span`,{className:`text-warning`,title:n?r:void 0,children:n?`!${te}`:r})]})},pe=(e,n)=>(0,V.jsxs)(`section`,{className:bD(!n),children:[n&&(0,V.jsx)(`h2`,{className:xD(e.key),children:fe(e)}),(0,V.jsxs)(`div`,{className:SD,children:[e.issues.map(t=>(0,V.jsx)(YD,{issue:t,column:e.key,selected:t.id===p,badge:N(t,e.key),onSelect:()=>m(t.id),onOpen:()=>ae(t),onMenu:(e,n)=>ue(t,e,n)},t.id)),e.issues.length===0&&e.hiddenCount===0&&(0,V.jsx)(`p`,{className:`mono text-muted ${CD}`,children:t.columnEmpty}),e.hiddenCount>0&&(0,V.jsx)(`p`,{className:`mono text-muted ${CD}`,children:$(t.more,{count:String(e.hiddenCount)})})]})]},e.key);return(0,V.jsxs)(`div`,{className:`${Cx} ${uD}`,tabIndex:0,ref:g,children:[(0,V.jsxs)(`div`,{className:`kb-top`,children:[(0,V.jsx)(`h1`,{className:Tx,children:t.title}),(0,V.jsx)(`span`,{className:`mono keys-only text-muted`,children:t.hint}),(0,V.jsxs)(`span`,{className:`mono ${Ox}`,children:[(0,V.jsx)(`button`,{type:`button`,className:`${kr} ${kx.kanban}`,disabled:!T,onClick:L,children:z(`pages.new`)}),(0,V.jsx)(`button`,{type:`button`,className:`${kr} ${kx.kanban}`,disabled:!T?.issues.some(e=>e.id===p),onClick:oe,children:z(`pages.delete`)})]})]}),o===null?(0,V.jsx)(`p`,{className:`text-muted`,children:t.loading}):T?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:dD,children:[(0,V.jsxs)(`button`,{type:`button`,className:fD,onClick:()=>R(1),children:[gE(T.repoRoot,E),b.length>1&&(0,V.jsx)(`span`,{className:`text-muted`,children:` ${w+1}/${b.length}`})]}),!_&&(0,V.jsx)(`span`,{className:`mono text-muted ${pD}`,children:T.repoRoot}),T.issues.length===0&&!T.readError&&(0,V.jsx)(`span`,{className:`text-muted ${mD}`,children:t.empty})]}),T.readError?(0,V.jsx)(`p`,{className:`text-error`,children:$(t.readFailed,{error:T.readError})}):_&&de?(0,V.jsxs)(`div`,{className:gD,ref:le,children:[(0,V.jsx)(`div`,{className:`mono ${_D}`,children:j.map(e=>(0,V.jsx)(`button`,{type:`button`,className:vD(e.key===de.key),onClick:()=>{let t=e.issues[0];t&&m(t.id)},children:fe(e,!0)},e.key))}),pe(de,!1)]}):(0,V.jsx)(`div`,{className:hD,ref:le,children:j.map(e=>pe(e,!0))})]}):(0,V.jsx)(`p`,{className:`text-muted`,children:t.noRepos})]})}var $D={title:`Mods`,empty:`No mod is drawing anything.`,emptyHint:`A plugin with a [mod] entry draws its panes here, in the TUI and the web alike.`,keys:`↑↓/tab move · enter press · esc back`,pressFailed:`{plugin}: the press did not reach the mod ({reason})`},eO={title:`Mods`,empty:`当前没有 mod 在绘制内容。`,emptyHint:`声明了 [mod] 的插件会在这里绘制面板,TUI 和 web 显示的是同一份。`,keys:`↑↓/tab 移动 · enter 按下 · esc 返回`,pressFailed:`{plugin}:按键没有送达 mod({reason})`},tO={info:`text-info`,success:`text-success`,warning:`text-warning`,error:`text-error`,muted:`text-muted`},nO=`flex flex-col gap-3`,rO=`[&_p]:mx-0 [&_p]:my-1`,iO=`rounded-md border-hairline border-line px-3 pt-2 pb-3 font-mono`,aO=`mb-2 text-meta leading-[inherit] text-ink`,oO=(e,t)=>`flex min-w-0 items-start ${e?`[&>form]:flex-[1_1_12em] [&>form]:self-center`:``} ${t?`rounded-sm border-hairline border-line`:``}`,sO=(e,t)=>`whitespace-pre-wrap wrap-anywhere ${e?tO[e]:`text-ink`} ${t?`font-bold`:``}`,cO=(e,t)=>`cursor-pointer rounded-sm border-hairline border-current px-2.5 py-0.5 [font:inherit] font-bold! ${tO[e]} ${t?`bg-[color-mix(in_srgb,currentcolor_18%,transparent)]`:`bg-transparent [&:hover]:bg-[color-mix(in_srgb,currentcolor_18%,transparent)]`}`,lO=`flex min-w-0 max-w-[40em] self-stretch`,uO=`w-full font-mono`,dO=[0,6,12,20];function fO(e){return`mod-${e.kind}:${e.plugin}/${e.pane}/${e.key}`}function pO(e){let[t,n]=(0,h.useState)(e.value??``);return(0,V.jsx)(`form`,{className:lO,onSubmit:r=>{r.preventDefault(),e.onSubmit(t),n(e.value??``)},children:(0,V.jsx)(`input`,{id:e.id,className:`${jr} ${uO}`,spellCheck:!1,value:t,placeholder:e.placeholder,onFocus:e.onFocus,onChange:e=>n(e.target.value)})})}function mO(e){let{node:t}=e;if(t.type===`text`)return(0,V.jsx)(`span`,{className:sO(t.tone,t.bold===!0),children:t.text});if(t.type===`input`){let n={kind:`input`,plugin:e.pane.plugin,pane:e.pane.id,key:t.key};return(0,V.jsx)(pO,{id:fO(n),placeholder:t.placeholder,value:t.value,onFocus:()=>e.onFocus(n),onSubmit:t=>e.onSubmit(n,t)},t.value??``)}if(t.type===`button`){let n={kind:`button`,plugin:e.pane.plugin,pane:e.pane.id,key:t.key};return(0,V.jsx)(`button`,{type:`button`,id:fO(n),className:cO(t.tone??`info`,Va(n,e.cursor)),onFocus:()=>e.onFocus(n),onClick:()=>e.onPress(n),children:t.label})}return(0,V.jsx)(`div`,{className:oO(t.direction===`row`,t.border===!0),style:{flexDirection:t.direction??`column`,gap:dO[t.gap??0],padding:dO[t.padding??0]},children:t.children.map((t,n)=>(0,V.jsx)(mO,{...e,node:t},n))})}function hO({model:e}){let t=B()===`zh`?eO:$D,n=y(e.mods),r=Ba(n),[i,a]=(0,h.useState)(null),o=Ha(r,i),s=CE(),c=(0,h.useRef)(!1),l=(t,n,r={})=>{a(t),!c.current&&(c.current=!0,e.client.request(n,{plugin:t.plugin,pane:t.pane,key:t.key,...r}).catch(e=>I(e instanceof Error?e.message:String(e),`error`)).finally(()=>{c.current=!1}))},u=e=>l(e,`mod.press`),d=(e,t)=>l(e,`mod.submit`,{value:t}),f=e=>{let t=Ua(r,o,e);a(t),t&&document.getElementById(fO(t))?.focus()};return SE(e=>{if(e.ctrlKey)return e.key===`c`&&(O.set(null),!0);switch(e.key){case`Escape`:case`q`:return O.set(null),!0;case`ArrowDown`:return f(1),!0;case`ArrowUp`:return f(-1),!0;case`Enter`:return e.target instanceof HTMLButtonElement?!1:(o?.kind===`button`&&u(o),!0);default:return!1}}),(0,V.jsxs)(`div`,{className:`${wx} ${nO}`,tabIndex:0,ref:s,children:[(0,V.jsxs)(`div`,{className:Ex,children:[(0,V.jsx)(`h1`,{className:Tx,children:t.title}),(0,V.jsx)(`span`,{className:`keys-only touch:empty:hidden! text-muted ${Dx(!1)}`,children:t.keys})]}),n.length===0?(0,V.jsxs)(`div`,{className:rO,children:[(0,V.jsx)(`p`,{children:t.empty}),(0,V.jsx)(`p`,{className:`text-muted`,children:t.emptyHint})]}):n.map(e=>(0,V.jsxs)(`section`,{className:iO,children:[(0,V.jsxs)(`header`,{className:aO,children:[e.title,` `,(0,V.jsx)(`span`,{className:`text-muted`,children:e.plugin})]}),(0,V.jsx)(mO,{node:e.tree,pane:e,cursor:o,onPress:u,onSubmit:d,onFocus:a})]},`${e.plugin}/${e.id}`))]})}function gO(e,t,n){if(e.script||e.target)return null;let r=e.vendor?t(e.vendor):n;return{full:[r,e.model,e.modelEffort].filter(Boolean).join(` · `),short:e.model??r}}function _O(e){return e===`dispatch_failed`||e===`skipped_unavailable`||e===`script_failed`}function vO(e,t){return e.response?`responded`:e.status!==`dispatched`&&e.status!==`revived`||e.deliveryStatus===`quiet`?null:e.deliveryStatus===`missing`?`missing`:e.deliveryStatus===`awaiting`?`awaiting`:t-Date.parse(e.at)>72e5?`missing`:`awaiting`}var yO=6e4,bO=3294,xO=new Map([[`JAN`,1],[`FEB`,2],[`MAR`,3],[`APR`,4],[`MAY`,5],[`JUN`,6],[`JUL`,7],[`AUG`,8],[`SEP`,9],[`OCT`,10],[`NOV`,11],[`DEC`,12]]),SO=new Map([[`SUN`,0],[`MON`,1],[`TUE`,2],[`WED`,3],[`THU`,4],[`FRI`,5],[`SAT`,6]]),CO=256;function wO(e,t,n){let r=e.toUpperCase(),i=t?.get(r);if(i!==void 0)return i;if(!/^\d+$/.test(r))throw Error(`invalid cron ${n}: ${e}`);return Number(r)}function TO(e){let t=new Set;for(let n of e.value.split(`,`)){if(n.length===0)throw Error(`invalid cron ${e.field}: ${e.value}`);let[r,i,...a]=n.split(`/`);if(a.length>0||r===void 0)throw Error(`invalid cron ${e.field}: ${n}`);let o=1;if(i!==void 0&&(!/^\d+$/.test(i)||(o=Number(i),o<1)))throw Error(`invalid cron ${e.field} step: ${n}`);let s,c;if(r===`*`)s=e.min,c=e.max;else if(r.includes(`-`)){let[t,i,...a]=r.split(`-`);if(a.length>0||t===void 0||i===void 0)throw Error(`invalid cron ${e.field} range: ${n}`);s=wO(t,e.names,e.field),c=wO(i,e.names,e.field)}else s=wO(r,e.names,e.field),c=i===void 0?s:e.max;if(s<e.min||c>e.max||s>c)throw Error(`cron ${e.field} out of range: ${n}`);for(let n=s;n<=c;n+=o)t.add(e.normalize?e.normalize(n):n)}return t}function EO(e){if(e.length>CO)throw Error(`cron expression is too long`);let t=e.trim().split(/\s+/).filter(Boolean);if(t.length!==5)throw Error(`cron expression needs 5 fields (minute hour day month weekday), got ${t.length}`);let[n,r,i,a,o]=t;return{minutes:TO({value:n,min:0,max:59,field:`minute`}),hours:TO({value:r,min:0,max:23,field:`hour`}),daysOfMonth:TO({value:i,min:1,max:31,field:`day-of-month`}),months:TO({value:a,min:1,max:12,field:`month`,names:xO}),daysOfWeek:TO({value:o,min:0,max:7,field:`weekday`,names:SO,normalize:e=>e%7}),dayOfMonthRestricted:!i.startsWith(`*`),dayOfWeekRestricted:!o.startsWith(`*`)}}function DO(e){try{return EO(e),!0}catch{return!1}}function OO(e,t,n){return new Date(e.year,e.month-1,e.day,t,n,0,0).getTime()}function kO(e){let t=new Date(e);return{year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()}}function AO(e,t){return kO(new Date(e.year,e.month-1,e.day+t,12,0,0,0).getTime())}function jO(e,t){if(!e.months.has(t.month))return!1;let n=e.daysOfMonth.has(t.day),r=e.daysOfWeek.has(new Date(t.year,t.month-1,t.day).getDay());return e.dayOfMonthRestricted&&e.dayOfWeekRestricted?n||r:n&&r}function MO(e){return e-e%yO}function NO(e,t){return[...e].sort((e,n)=>(e-n)*t)}function PO(e,t){let n=EO(e),r=NO(n.hours,1),i=NO(n.minutes,1),a=new Date(MO(t)+yO),o=kO(a.getTime()),s=a.getHours(),c=a.getMinutes();for(let e=0;e<bO;e++){if(jO(n,o)){for(let e of r)if(!(e<s))for(let n of i){if(e===s&&n<c)continue;let r=OO(o,e,n);if(r>t)return r}}o=AO(o,1),s=0,c=0}throw Error(`cron expression never matches: ${e}`)}var FO=[`minute`,`hour`,`dayOfMonth`,`month`,`dayOfWeek`];function IO(e){let t=e.trim().split(/\s+/).filter(Boolean);return FO.map((e,n)=>t[n]??`*`)}function LO(e){return FO.map((t,n)=>e[n]??`*`).join(` `)}var RO=[`*`,`*/5`,`*/10`,`*/15`,`*/30`,...WO(0,59)],zO=[`*`,`*/2`,`*/3`,`*/4`,`*/6`,`*/12`,...WO(0,23)],BO=[`*`,...WO(1,31)],VO=[`*`,`JAN`,`FEB`,`MAR`,`APR`,`MAY`,`JUN`,`JUL`,`AUG`,`SEP`,`OCT`,`NOV`,`DEC`],HO=[`*`,`MON-FRI`,`SAT,SUN`,`MON`,`TUE`,`WED`,`THU`,`FRI`,`SAT`,`SUN`],UO=[`MON`,`TUE`,`WED`,`THU`,`FRI`,`SAT`,`SUN`];function WO(e,t){let n=[];for(let r=e;r<=t;r++)n.push(String(r));return n}var GO={minute:RO,hour:zO,dayOfMonth:BO,month:VO,dayOfWeek:HO};function KO(e,t,n){let r=GO[e],i=r.indexOf(t.trim().toUpperCase());return i<0?(n>0?r[0]:r[r.length-1])??t:r[(i+n+r.length)%r.length]??t}function qO(e,t){return Math.min(Math.max(e+t,0),FO.length-1)}function JO(e,t,n){let r=IO(e);return t<0||t>=FO.length||(r[t]=n),LO(r)}function YO(e,t){let[n,r,i,a,o]=IO(e);if(a!==`*`||i!==`*`||n===void 0||r===void 0||o===void 0)return null;let s=XO(n,r,t);if(!s)return null;let{at:c,bare:l}=s;if(o===`*`)return l?c:t(`automations.schedule.everyDay`,{at:c});if(o===`MON-FRI`)return t(`automations.schedule.weekdays`,{at:c});if(o===`SAT,SUN`)return t(`automations.schedule.weekends`,{at:c});let u=UO.find(e=>e===o.toUpperCase());return u?t(`automations.schedule.onWeekday`,{weekday:t(`automations.schedule.dow.${u}`),at:c}):null}function XO(e,t,n){return t===`*`?e===`*`?{at:n(`automations.schedule.everyMinute`),bare:!0}:e.startsWith(`*/`)?{at:n(`automations.schedule.everyMinutes`,{n:e.slice(2)}),bare:!0}:/^\d+$/.test(e)?{at:n(`automations.schedule.hourlyAt`,{minute:e.padStart(2,`0`)}),bare:!1}:null:t.startsWith(`*/`)&&e===`0`?{at:n(`automations.schedule.everyHours`,{n:t.slice(2)}),bare:!0}:/^\d+$/.test(t)&&/^\d+$/.test(e)?{at:n(`automations.schedule.atClock`,{time:`${t.padStart(2,`0`)}:${e.padStart(2,`0`)}`}),bare:!1}:null}function ZO(e,t,n,r){let i=e.trim();if(!DO(i))return{kind:`invalid`};let a;try{a=PO(i,t)}catch{return{kind:`never`}}return{kind:`ok`,nextRunMs:a,relative:QO(a-t,n),absolute:$O(a,t,n,r)}}function QO(e,t){let{minutes:n,hours:r,days:i}=BE(e);return n<60?t(`automations.when.inMinutes`,{n:Math.max(1,n)}):r<24?t(`automations.when.inHours`,{n:r}):t(`automations.when.inDays`,{n:i})}function $O(e,t,n,r){let i=new Date(e),a=`${String(i.getHours()).padStart(2,`0`)}:${String(i.getMinutes()).padStart(2,`0`)}`,o=new Date(t);if(i.getFullYear()===o.getFullYear()&&i.getMonth()===o.getMonth()&&i.getDate()===o.getDate())return a;let s=e-t<5184e5,c=i.toLocaleDateString(r,s?{weekday:`short`}:{weekday:`short`,month:`short`,day:`numeric`});return s?`${c} ${a}`:n(`automations.when.dateTime`,{date:c,time:a})}function ek(e,t){let n=t?.trim()??``;return n&&e?.effortLevels?.includes(n)?n:``}function tk(e){let{model:t}=e,[n,r]=(0,h.useState)([]),[i,a]=(0,h.useState)({}),[o,s]=(0,h.useState)(``),[c,l]=(0,h.useState)(``),[u,d]=(0,h.useState)(``),[f,p]=(0,h.useState)(!1),{busy:m,error:g,submit:_}=xi();(0,h.useEffect)(()=>{Promise.all([t.client.request(`engines.list`),e.current()]).then(([e,t])=>{let n=Tu(e.engines,t.engine).filter(e=>e.ready!==!1||e.id===t.engine),i=n.find(e=>e.id===t.engine)??n[0];r(n),a(t),s(i?.id??``),l(ek(i,t.effort)),d(i?.id===t.engine?t.model??``:``),p(!0)})},[t]);let v=n.find(e=>e.id===o),y=v?.effortLevels??[],b=y.length>0?[``,...y]:[],x=(v?.models??[]).map(e=>e.id).filter(e=>e.toLowerCase().includes(u.trim().toLowerCase())&&e!==u.trim()).slice(0,6),S=e=>{s(e);let t=n.find(t=>t.id===e);l(ek(t,e===i.engine?i.effort:void 0)),d(e===i.engine?i.model??``:``)},C=e=>{let t=n.findIndex(e=>e.id===o),r=n[Math.max(0,Math.min(n.length-1,t+e))];r&&S(r.id)},w=e=>{if(b.length===0)return;let t=Math.max(0,b.indexOf(c));l(b[Math.max(0,Math.min(b.length-1,t+e))]??``)},T=e=>{let t=e.target instanceof HTMLInputElement;if(e.key===`ArrowUp`&&!t)C(-1);else if(e.key===`ArrowDown`&&!t)C(1);else if((e.key===`ArrowLeft`||e.key===`h`)&&!t)w(-1);else if((e.key===`ArrowRight`||e.key===`l`)&&!t)w(1);else return;e.preventDefault()},E=()=>_(async()=>{if(!v)return;let t=y.length>0?c:void 0,n=v.acceptsModel?u.trim():void 0;(v.id!==i.engine||t!==void 0&&t!==(i.effort??``)||n!==void 0&&n!==(i.model??``))&&await e.onSet({engine:v,...t===void 0?{}:{effort:t},...n===void 0?{}:{model:n}})});return(0,V.jsx)(bi,{title:G(`tasks`,`changeEngine.title`),wide:!0,children:(0,V.jsxs)(`form`,{className:Wr,onKeyDown:T,onSubmit:e=>{e.preventDefault(),E()},children:[(0,V.jsx)(`ul`,{className:Rr,"aria-label":G(`tasks`,`changeEngine.title`),children:n.map(e=>(0,V.jsx)(`li`,{children:(0,V.jsxs)(`button`,{type:`button`,"aria-pressed":e.id===o,className:pi({selected:e.id===o}),onClick:()=>S(e.id),children:[(0,V.jsx)(`span`,{className:`${_i} text-accent`,children:e.id===o?`●`:` `}),(0,V.jsx)(`span`,{className:mi,children:e.name}),e.id===i.engine&&(0,V.jsx)(`span`,{className:`text-muted`,children:G(`tasks`,`changeEngine.current`)})]})},e.id))}),f&&v&&v.acceptsModel&&(0,V.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,V.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:G(`tasks`,`engineModel.label`)}),(0,V.jsx)(`input`,{className:jr,spellCheck:!1,placeholder:G(`tasks`,`engineModel.placeholder`),value:u,onChange:e=>d(e.target.value)}),x.length>0&&(0,V.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:x.map(e=>(0,V.jsx)(`button`,{type:`button`,className:Lr(),onClick:()=>d(e),children:e},e))})]}),b.length>0&&(0,V.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,V.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:G(`tasks`,`changeEngine.effortLabel`)}),(0,V.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:b.map(e=>(0,V.jsx)(`button`,{type:`button`,"aria-pressed":e===c,className:Lr(e===c),onClick:()=>l(e),children:e===``?G(`tasks`,`changeEngine.noEffort`):e},e||`default`))})]}),(0,V.jsx)(`p`,{className:`keys-only ${wr}`,children:(0,V.jsx)(rp,{text:[G(`tasks`,`changeEngine.footer.engine`),...v?.acceptsModel?[G(`tasks`,`changeEngine.footer.model`)]:[],...b.length>0?[G(`tasks`,`changeEngine.footer.effort`)]:[],G(`tasks`,`changeEngine.footer.set`),G(`tasks`,`changeEngine.footer.cancel`)].join(` · `)})}),g&&(0,V.jsx)(`p`,{className:`text-error`,children:g}),(0,V.jsx)(Ti,{busy:m||!f,submitLabel:z(`taskops.set`)})]})})}var nk=`flex flex-col overflow-hidden @container`,rk=`mt-2.5 grid min-h-0 flex-1 grid-cols-[minmax(260px,2fr)_minmax(0,3fr)] gap-4 rt-narrow:flex rt-narrow:flex-col rt-narrow:overflow-y-auto`,ik=`flex min-h-0 flex-col gap-3 overflow-y-auto scrollbar-none rt-narrow:shrink-0 rt-narrow:overflow-visible`,ak=`flex gap-1.5 px-2 pt-0 pb-1`,ok=e=>`flex min-w-0 cursor-pointer flex-col gap-0.5 rounded-sm px-2 py-1.5 ${e?`bg-menu`:`[&:hover]:bg-hover`}`,sk=`flex min-w-0 items-baseline gap-2.5`,ck=e=>`min-w-0 flex-1 truncate font-bold ${e?`text-muted`:``}`,lk=`whitespace-nowrap text-meta`,uk=`truncate text-meta`,dk=`flex min-h-0 flex-col gap-1.5 overflow-y-auto py-0 pr-0 pl-4 [border-left:var(--hairline)_solid_var(--line)] [&_h2]:m-0 [&_p]:m-0 [&>*]:shrink-0 [&>h2]:mt-2.5 rt-narrow:shrink-0 rt-narrow:overflow-visible rt-narrow:pt-3 rt-narrow:pl-0 rt-narrow:[border-left:none] rt-narrow:[border-top:var(--hairline)_solid_var(--line)]`,fk=`flex flex-wrap items-baseline justify-between gap-3`,pk=`font-sans text-display font-bold normal-nums wrap-anywhere`,mk=`mx-0 mt-1 mb-0 grid grid-cols-[max-content_minmax(0,1fr)] items-baseline gap-x-3.5 gap-y-1 [&_dd]:m-0 [&_dd]:wrap-anywhere [&_dd_.mono]:whitespace-pre`,hk=`max-h-[12lh] overflow-y-auto rounded-sm bg-inset px-2.5 py-2 whitespace-pre-wrap wrap-anywhere`,gk=`min-w-0 text-meta leading-[inherit]`,_k=`flex w-full min-w-0 gap-2 text-inherit`,vk=_k,yk=`${_k} cursor-pointer border-none bg-transparent p-0 text-left font-[inherit] [&:hover]:underline`,bk=`min-w-0 flex-1 truncate`,xk=`[&+&]:mt-1.5`,Sk=e=>`whitespace-pre-wrap wrap-anywhere text-meta ${e?``:`leading-[inherit]`}`,Ck=`text-meta`,wk=`flex gap-4.5`,Tk=e=>`flex min-w-[5ch] flex-col gap-0.5 rounded-sm border-hairline px-1.5 py-1 text-left font-mono text-body normal-nums [&>span]:text-meta [&>span]:text-subtle ${e?`border-accent font-bold text-accent`:`border-transparent font-normal`}`,Ek=`hidden gap-2 px-1 pt-0.5 pb-1.5 touch:flex`,Dk=`h-8 w-11 touch-manipulation rounded-sm border-hairline border-line bg-inset font-mono text-display font-normal normal-nums text-ink`;function Ok(e){let t=e.client,[n,r]=(0,h.useState)(()=>Y(t,`pendingStart.list`)?.starts??[]);if((0,h.useEffect)(()=>{let e=!0;return Gu(t,`pendingStart.list`).then(t=>e&&r(t.starts)).catch(()=>void 0),()=>{e=!1}},[t,e.tick]),n.length===0)return null;let i=n.map(e=>e.repo),a=async n=>{try{await t.request(`pendingStart.cancel`,{id:n.id}),r(e=>e.filter(e=>e.id!==n.id)),e.reload()}catch(e){I($(z(`pages.laterCancelFailed`),{error:mE(e)}),`error`)}};return(0,V.jsxs)(`section`,{"data-field":`later`,className:`mt-2.5`,children:[(0,V.jsxs)(`h2`,{className:`${U} ${ak} text-muted`,children:[z(`pages.laterStarts`),` `,(0,V.jsx)(`span`,{className:`mono`,children:n.length})]}),n.map(e=>(0,V.jsxs)(`div`,{className:ok(!1),children:[(0,V.jsxs)(`span`,{className:sk,children:[(0,V.jsx)(`span`,{className:ck(!1),children:e.title}),(0,V.jsx)(`span`,{className:`mono text-muted ${lk}`,title:new Date(e.at).toLocaleString(),children:vg(new Date(e.at))}),(0,V.jsx)(H,{className:`font-mono`,hit:`tight`,onClick:()=>void a(e),children:z(`pages.laterCancel`)})]}),(0,V.jsx)(`span`,{className:`mono text-muted ${uk}`,children:gE(e.repo,i)}),e.error&&(0,V.jsx)(`span`,{className:`mono text-warning truncate text-meta`,title:e.error,children:$(z(`pages.laterFailed`),{error:e.error})})]},e.id))]})}var kk={name:``,repo:``,prompt:``,schedule:`0 9 * * MON-FRI`};function Ak(e){return e.name.trim().length>0&&(e.repo===null||e.repo.trim().length>0)&&e.prompt.trim().length>0&&(!e.target||e.target.taskId.trim().length>0&&/^tab-[\w-]+$/.test(e.target.tabId))&&DO(e.schedule.trim())}function jk(e){return e.name.trim().length===0?`name`:e.repo!==null&&e.repo.trim().length===0?`repo`:e.target&&!e.target.taskId.trim()?`target`:e.target&&!/^tab-[\w-]+$/.test(e.target.tabId)?`targetTab`:e.prompt.trim().length===0?`prompt`:DO(e.schedule.trim())?null:`schedule`}function Mk(e){let{auto:t,common:n}=fE(),r=pE(),i=B()===`zh`?`zh-CN`:`en-US`,[a,o]=(0,h.useState)(()=>({...kk,repo:e.repos.find(t=>e.defaultRepo&&hE(t)===hE(e.defaultRepo))??e.repos[0]??null})),[s,c]=(0,h.useState)(0),[l,u]=(0,h.useState)(null),d=(0,h.useRef)({}),f=e=>t=>{d.current[e]=t};(0,h.useEffect)(()=>d.current.name?.focus(),[]);let p=e=>{o(t=>({...t,...e})),u(null)};(0,h.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopImmediatePropagation(),R())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},[]);let m=()=>{if(Ak(a)){R(),e.onSubmit({name:a.name.trim(),repo:a.repo===null?null:a.repo.trim(),prompt:a.prompt.trim(),schedule:a.schedule.trim(),...a.target?{target:a.target}:{}});return}let n=jk(a);n&&(d.current[n]?.focus(),u(Reflect.get(t.missing,n)))},g=a.repo===null?[]:e.tasks.filter(e=>hE(e.repo)===hE(a.repo??``)),_=a.target?g.findIndex(e=>e.id===a.target?.taskId)+1:0,v=e=>{let t=(_+e+g.length+1)%(g.length+1),n=g[t-1];p({target:n?{kind:`existing-tab`,taskId:n.id,tabId:`tab-1`}:void 0})},y=[null,...e.repos],b=e=>{let t=Math.min(Math.max(y.indexOf(a.repo)+e,0),y.length-1),n=y[t];n!==void 0&&p({repo:n,target:void 0})},x=e=>t=>{(t.key===`ArrowUp`||t.key===`ArrowDown`)&&(t.preventDefault(),e(t.key===`ArrowDown`?1:-1))},S=e=>t=>{t.key===`Enter`&&(t.preventDefault(),d.current[e]?.focus())},C=IO(a.schedule),w=e=>{let t=FO[s];t&&p({schedule:JO(a.schedule,s,KO(t,C[s]??`*`,e))})},T=e=>{if(!(e.ctrlKey||e.metaKey||e.altKey)){if(e.key===`ArrowLeft`||e.key===`h`)c(qO(s,-1));else if(e.key===`ArrowRight`||e.key===`l`)c(qO(s,1));else if(e.key===`ArrowUp`||e.key===`ArrowDown`)w(e.key===`ArrowUp`?1:-1);else return;e.preventDefault()}},E=ZO(a.schedule,Date.now(),r,i),D=YO(a.schedule,r);return(0,V.jsx)(`div`,{className:zr,onMouseDown:e=>e.target===e.currentTarget&&R(),children:(0,V.jsxs)(`dialog`,{open:!0,className:`${Br(!0)} ${kD}`,"aria-label":t.newTitle,children:[(0,V.jsx)(`h1`,{className:`${U} text-muted`,children:t.newTitle}),(0,V.jsxs)(`div`,{className:Wr,children:[(0,V.jsxs)(`label`,{className:Pr,children:[(0,V.jsx)(`span`,{className:`${U} text-muted`,children:t.fieldName}),(0,V.jsx)(`input`,{ref:f(`name`),className:jr,spellCheck:!1,placeholder:t.namePlaceholder,value:a.name,onChange:e=>p({name:e.target.value}),onKeyDown:S(`repo`)})]}),(0,V.jsxs)(`div`,{className:Pr,children:[(0,V.jsxs)(`span`,{className:`${U} text-muted ${jD}`,children:[t.fieldRepo,(0,V.jsx)(`span`,{className:`keys-only text-muted ${MD}`,children:`↑/↓`})]}),(0,V.jsx)(HD,{fieldRef:f(`repo`),kind:`list`,label:t.fieldRepo,className:PD,onKeyDown:x(b),children:y.map(t=>(0,V.jsxs)(`button`,{type:`button`,tabIndex:-1,"aria-selected":t===a.repo,className:`touch:py-1.5 ${FD(t===a.repo)}`,onClick:()=>{p({repo:t,target:void 0}),d.current.repo?.focus()},children:[t===a.repo?`▸ `:` `,t===null?z(`rail.noProject`):gE(t,e.repos)]},t??``))})]}),(0,V.jsxs)(`div`,{className:Pr,children:[(0,V.jsxs)(`span`,{className:`${U} text-muted ${jD}`,children:[t.fieldTarget,(0,V.jsx)(`span`,{className:`keys-only text-muted ${MD}`,children:`↑/↓`})]}),(0,V.jsx)(HD,{fieldRef:f(`target`),kind:`list`,label:t.fieldTarget,onKeyDown:x(v),onClick:()=>v(1),children:a.target?g[_-1]?.title??a.target.taskId:t.targetFresh})]}),a.target&&(0,V.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,V.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:t.fieldTargetTab}),(0,V.jsx)(`input`,{ref:f(`targetTab`),className:jr,spellCheck:!1,value:a.target.tabId,onChange:e=>a.target&&p({target:{...a.target,tabId:e.target.value}}),onKeyDown:S(`prompt`)})]}),(0,V.jsxs)(`label`,{className:Pr,children:[(0,V.jsx)(`span`,{className:`${U} text-muted`,children:t.fieldPrompt}),(0,V.jsx)(`input`,{ref:f(`prompt`),className:jr,spellCheck:!1,placeholder:t.promptPlaceholder,value:a.prompt,onChange:e=>p({prompt:e.target.value}),onKeyDown:S(`schedule`)})]}),(0,V.jsxs)(`div`,{className:Pr,children:[(0,V.jsxs)(`span`,{className:`${U} text-muted ${jD}`,children:[t.fieldSchedule,(0,V.jsx)(`span`,{className:`keys-only text-muted ${MD}`,children:`←/→ ↑/↓`})]}),(0,V.jsx)(HD,{fieldRef:f(`schedule`),kind:`cells`,label:t.fieldSchedule,className:wk,onKeyDown:T,children:FO.map((e,n)=>(0,V.jsxs)(`button`,{type:`button`,tabIndex:-1,className:Tk(n===s),onClick:()=>{c(n),d.current.schedule?.focus()},children:[C[n]??`*`,(0,V.jsx)(`span`,{children:t.cronField[e]})]},e))}),(0,V.jsx)(`div`,{className:Ek,children:[-1,1].map(e=>{let n=t.cronField[FO[s]??`minute`]??``;return(0,V.jsx)(`button`,{type:`button`,tabIndex:-1,className:Dk,"aria-label":z(e<0?`pages.cronDown`:`pages.cronUp`,{field:n}),onClick:()=>{w(e),d.current.schedule?.focus()},children:e<0?`−`:`+`},e)})}),E.kind===`ok`?(0,V.jsxs)(`p`,{className:`mono text-success`,children:[D?`${D}, `:``,E.relative,`, `,E.absolute]}):(0,V.jsx)(`p`,{className:`mono text-error`,children:E.kind===`never`?t.cronNever:t.cronInvalid})]}),l&&(0,V.jsxs)(`p`,{className:`text-error`,children:[`※ `,l]}),(0,V.jsx)(`p`,{className:`touch:empty:hidden! text-muted ${ID}`,children:(0,V.jsx)(rp,{text:du(t.composerLegend)})}),(0,V.jsxs)(`div`,{className:Mr,children:[(0,V.jsx)(`button`,{type:`button`,className:kr,onClick:R,children:n.cancel}),(0,V.jsx)(`button`,{ref:f(`confirm`),type:`button`,className:br(),onClick:m,children:n.create})]})]})]})})}var Nk=[`ok`,`blocked`,`failed`,`skipped`];function Pk(e){switch(e.status){case`dispatched`:case`revived`:case`ran`:return`ok`;case`skipped_blocked`:return`blocked`;case`dispatch_failed`:case`skipped_unavailable`:case`script_failed`:return`failed`;default:return`skipped`}}var Fk={scheduled:`schedule`,manual:`manual`,webhook:`webhook`};function Ik(e){if(e.status===`skipped_precheck`)return e.precheckResult?.durationMs??null;if(e.status===`ran`||e.status===`script_failed`)return null;let t=Date.parse(e.at),n=Date.parse(e.response?.at??``);return Number.isFinite(t)&&Number.isFinite(n)&&n>=t?n-t:null}function Lk(e){if(e<1e3)return`${Math.max(0,Math.round(e))}ms`;let t=Math.round(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);return n%60==0?`${r}h`:`${r}h ${n%60}m`}function Rk(e,t){return e.filter(e=>t===null||Pk(e)===t).sort((e,t)=>Date.parse(t.at)-Date.parse(e.at)||t.runNumber-e.runNumber)}function zk(e){let t=e.indexOf(`{`),n=e.lastIndexOf(`}`);if(t<0||n<=t)return null;try{return{prefix:e.slice(0,t).trim(),value:JSON.parse(e.slice(t,n+1))}}catch{return null}}var Bk=(e,t)=>e&&typeof e==`object`?Reflect.get(e,t):void 0;function Vk(e){let t=zk(e);if(!t)return{summary:e,full:e};let n=Bk(t.value,`error`)??t.value,r=Bk(n,`message`),i=Bk(n,`code`),a=typeof r==`string`?typeof i==`string`?`${i}: ${r}`:r:null,o=t.prefix.replace(/:$/,``);return{summary:a?`${o} — ${a}`:e,full:`${t.prefix}\n${JSON.stringify(t.value,null,2)}`}}function Hk(e){let t=e.trim();if(!/^[[{]/.test(t))return e;try{return JSON.stringify(JSON.parse(t),null,2)}catch{return e}}var Uk={dispatched:`success`,revived:`success`,skipped_precheck:`muted`,skipped_blocked:`warning`,skipped_cancelled:`muted`,skipped_missed:`warning`,skipped_unavailable:`warning`,dispatch_failed:`error`,ran:`success`,script_failed:`error`},Wk={success:`text-success`,muted:`text-muted`,warning:`text-warning`,error:`text-error`},Gk={success:`✓`,error:`†`,warning:`!`,muted:`·`},Kk=e=>Uk[e]??`muted`;function qk(e){let{auto:t}=fE(),{runs:n,when:r}=e,i=e=>t.runStatus[e]??e,a=n.filter(e=>e.response);return(0,V.jsxs)(V.Fragment,{children:[n[0]?.precheckResult&&(0,V.jsx)(Jk,{run:n[0]}),(0,V.jsx)(`h2`,{className:`${U} text-muted`,children:t.responses}),a.length===0?(0,V.jsx)(`p`,{className:`text-muted`,children:t.noResponses}):a.map(e=>(0,V.jsxs)(`div`,{className:xk,children:[(0,V.jsx)(`p`,{className:`mono ${Ck} ${Wk[Kk(e.status)]}`,children:`#${e.runNumber} ${i(e.status)}, ${r(e.response?.at)}`}),(0,V.jsx)(`p`,{className:Sk(!1),children:Hk(e.response?.text??``)})]},e.id))]})}function Jk({run:e}){let{auto:t}=fE(),n=e.precheckResult;if(!n)return null;let r=n.timedOut?t.precheckTimedOut:$(t.precheckExited,{code:String(n.exitCode??`?`)}),i=[{label:t.precheckStdout,text:n.stdout},{label:t.precheckStderr,text:n.stderr}].filter(e=>e.text.trim().length>0);return(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h2`,{className:`${U} text-muted`,children:$(t.precheckDetail,{exit:r,duration:String(n.durationMs)})}),i.length===0?(0,V.jsx)(`p`,{className:`text-muted`,children:t.precheckNoOutput}):i.map(e=>(0,V.jsx)(`p`,{className:`mono ${Sk(!0)}`,children:`${e.label}: ${e.text.replace(/\s+$/,``).split(`
|
|
59
59
|
`).slice(-10).join(`
|
|
60
|
-
`)}`},e.label))]})}var Yk=30;function Xk(e,t,n){let r=t.join(`\0`),[i,a]=(0,h.useState)(()=>Object.fromEntries(t.map(t=>[t,Y(e,`routine.runs`,{id:t})?.runs??[]])));return(0,h.useEffect)(()=>{let n=!0;for(let r of t)Gu(e,`routine.runs`,{id:r}).then(e=>n&&a(t=>({...t,[r]:e.runs}))).catch(()=>void 0);return()=>{n=!1}},[e,r,n]),i}function Zk(e){B();let{auto:t}=fE(),[n,r]=(0,h.useState)(null),i=Rk(e.runs,n),a=e=>{if(e.status===`skipped_blocked`){let t=e.blocked?.reason;return t?$(z(`runLog.blockedRun`),{reason:z(`runLog.blocked.${t}`)}):z(`runLog.outcome.blocked`)}return t.runStatus[e.status]??e.status},o=(e,t,n,r)=>(0,V.jsx)(H,{variant:`pill`,hit:`tight`,"aria-current":t,className:`max-w-40 truncate`,onClick:n,children:`[ ${e} ]`},r);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`h2`,{className:`${U} text-muted`,children:z(`runLog.title`)}),(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1`,children:[o(z(`runLog.all`),n===null,()=>r(null),`all`),Nk.map(e=>o(z(`runLog.outcome.${e}`),n===e,()=>r(e),e))]}),i.length===0?(0,V.jsx)(`p`,{className:`text-muted`,children:e.runs.length===0?t.noRuns:z(`runLog.empty`)}):i.slice(0,Yk).map(n=>{let r=Kk(n.status),i=vO(n,e.now),o=i===`awaiting`?`, ${t.responseAwaiting}`:i===`missing`?`, ${t.responseMissing}`:``,s=Ik(n),c=(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{children:Gk[r]}),(0,V.jsx)(`span`,{children:`#${n.runNumber}`}),(0,V.jsx)(`span`,{className:bk,children:`${a(n)}${n.tabId?`, ${n.tabId}`:``}${o}`}),(0,V.jsx)(`span`,{className:`text-subtle`,children:z(`runLog.source.${Fk[n.trigger]}`)}),s!==null&&(0,V.jsx)(`span`,{className:`text-muted`,children:Lk(s)}),(0,V.jsx)(`span`,{className:`text-muted`,children:e.when(n.at)})]}),l=n.error?Vk(n.error):null,u=n.taskId,d=i===`missing`?`text-warning`:Wk[r];return(0,V.jsxs)(`div`,{className:`${gk} ${d}`,children:[u?(0,V.jsx)(`button`,{type:`button`,className:`mono ${yk}`,onClick:()=>e.openRun(u),children:c}):(0,V.jsx)(`span`,{className:`mono ${vk}`,children:c}),l&&(0,V.jsxs)(`details`,{className:`mono pl-[calc(2ch+16px)] [&_summary]:cursor-pointer [&_summary]:list-none [&_summary]:truncate [&_summary::-webkit-details-marker]:hidden [&[open]_summary]:whitespace-normal [&_pre]:mx-0 [&_pre]:mt-1 [&_pre]:mb-1.5 [&_pre]:max-h-[16lh] [&_pre]:overflow-auto [&_pre]:rounded-sm [&_pre]:bg-inset [&_pre]:px-2 [&_pre]:py-1.5 [&_pre]:whitespace-pre-wrap [&_pre]:wrap-anywhere [&_pre]:text-muted`,children:[(0,V.jsx)(`summary`,{children:l.summary}),(0,V.jsx)(`pre`,{children:l.full})]})]},n.id)}),i.length>Yk&&(0,V.jsx)(`p`,{className:`text-muted`,children:z(`runLog.more`,{count:i.length-Yk})})]})}function Qk(e){let{auto:t}=fE(),n=pE(),r=B()===`zh`?`zh-CN`:`en-US`,{routine:i,busy:a,when:o}=e,s=YO(i.schedule,n),c=i.nextRunAt?Date.parse(i.nextRunAt):NaN;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:fk,children:[(0,V.jsx)(`h2`,{className:pk,children:i.name}),(0,V.jsxs)(`span`,{className:`mono ${Ox}`,children:[(0,V.jsx)(`button`,{type:`button`,className:`${kr} ${kx.row}`,disabled:a,onClick:e.onRunNow,children:t.runNow}),(0,V.jsx)(`button`,{type:`button`,className:`${kr} ${kx.row}`,disabled:a,onClick:e.onToggle,children:z(i.enabled?`pages.routinePause`:`pages.routineEnable`)}),(0,V.jsx)(`button`,{type:`button`,className:`${kr} ${kx.row}`,disabled:a,onClick:e.onDelete,children:z(`pages.delete`)})]})]}),(0,V.jsxs)(`dl`,{className:mk,children:[(0,V.jsx)(`dt`,{className:`text-muted`,children:z(`pages.routineSchedule`)}),(0,V.jsxs)(`dd`,{children:[s??(0,V.jsx)(`span`,{className:`mono`,children:i.schedule}),s&&(0,V.jsx)(`span`,{className:`mono text-muted`,children:` ${i.schedule}`})]}),(0,V.jsx)(`dt`,{className:`text-muted`,children:z(`pages.routineNext`)}),(0,V.jsx)(`dd`,{className:i.enabled?``:`text-warning`,children:i.enabled?Number.isFinite(c)?`${o(i.nextRunAt)} · ${new Date(c).toLocaleString(r,{weekday:`short`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}`:`—`:t.paused}),(0,V.jsx)(`dt`,{className:`text-muted`,children:z(`pages.routineProject`)}),(0,V.jsx)(`dd`,{children:e.project}),!i.script&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`dt`,{className:`text-muted`,children:z(`pages.routineDelivers`)}),(0,V.jsx)(`dd`,{children:i.target?$(t.targetExisting,{task:e.targetTitle??i.target.taskId,tab:i.target.tabId}):i.persistentSession?i.newConversation?t.targetStandingNew:t.targetStanding:t.targetFresh})]}),e.engine&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`dt`,{className:`text-muted`,children:z(`pages.routineEngine`)}),(0,V.jsxs)(`dd`,{className:`flex flex-wrap items-baseline gap-x-3.5`,children:[(0,V.jsx)(`span`,{children:e.engine}),(0,V.jsx)(H,{className:`font-mono`,hit:`tight`,disabled:a,onClick:e.onChangeEngine,children:z(`pages.routineChangeEngine`)})]})]})]}),i.precheck&&(0,V.jsx)(`p`,{className:`mono text-muted`,children:$(t.precheck,{command:i.precheck.command})}),i.script?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`h2`,{className:`${U} text-muted`,children:z(`pages.routineScript`)}),(0,V.jsx)(`p`,{className:`mono ${hk}`,children:i.script.command})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`h2`,{className:`${U} text-muted`,children:z(`pages.routinePrompt`)}),(0,V.jsx)(`p`,{className:hk,children:i.prompt})]}),(0,V.jsx)(Zk,{runs:e.runs,now:e.now,when:o,openRun:e.openRun}),(0,V.jsx)(qk,{runs:e.runs,when:o})]})}var $k=5e3;function eA({model:e}){let{auto:t,common:n}=fE(),r=e.client,[i,a]=bE($k),o=y(e.tasks),s=vE(e),c=yE(e),[l,u]=(0,h.useState)(()=>Y(r,`routine.list`)??null),[d,f]=(0,h.useState)(null),[p,m]=(0,h.useState)(null),[g,_]=(0,h.useState)(null),v=CE(),b=pE(),x=(0,h.useRef)(null);(0,h.useEffect)(()=>{let e=!0;return Gu(r,`routine.list`).then(t=>e&&u(t)).catch(()=>e&&u(e=>e??{automations:[],keepsDaemonAlive:!1})),()=>{e=!1}},[r,i]);let[S,w]=(0,h.useState)(()=>Y(r,`engines.list`)?.engines??[]);(0,h.useEffect)(()=>{let e=!0;return Gu(r,`engines.list`).then(t=>e&&w(t.engines)).catch(()=>{}),()=>{e=!1}},[r]);let T=l?.automations??[],E=l?.lastRunStatus??{},D=l?.lastFailure??{},A=e=>{let t=E[e.id];return t!==void 0&&_O(t)},ee=[{key:`pages.routinesNeedYou`,rows:T.filter(A)},{key:`pages.routinesActive`,rows:T.filter(e=>e.enabled&&!A(e))},{key:`pages.routinesPaused`,rows:T.filter(e=>!e.enabled&&!A(e))}],j=ee.flatMap(e=>e.rows),te=Math.max(0,j.findIndex(e=>e.id===d)),M=j[te],N=e=>f(j[e]?.id??null),P=ee[0]?.rows.length??0,F=y(k);(0,h.useEffect)(()=>{F===null||!l||(l.automations.some(e=>e.id===F)&&f(F),k.set(null))},[F,l]);let ne=Xk(r,M?[M.id]:[],i),re=M?ne[M.id]??[]:[];(0,h.useEffect)(()=>_(null),[M?.id]);let ie=(0,h.useRef)(null),[ae,L]=(0,h.useState)(0),oe=(0,h.useRef)(0);(0,h.useEffect)(()=>{let e=x.current,t=ae!==oe.current;if(oe.current=ae,t&&e&&ie.current&&e.offsetTop>ie.current.offsetTop){e.scrollIntoView({block:`start`,behavior:`smooth`});return}ie.current?.querySelector(`[data-row="${te}"]`)?.scrollIntoView({block:`nearest`})},[te,ae]);let R=Date.now(),se=e=>{let n=e?Date.parse(e):NaN;if(!Number.isFinite(n))return`—`;let r=n-R,i=r>=0,a=Math.floor(Math.abs(r)/6e4),o=Math.floor(a/60);return a<1?i?t.when.now:t.when.justNow:a<60?$(i?t.when.inMinutes:t.when.minutesAgo,{n:a}):o<24?$(i?t.when.inHours:t.when.hoursAgo,{n:o}):new Date(n).toLocaleDateString()},ce=e=>o?.tasks.find(t=>t.id===e)?.label??e,le=t=>{O.set(null),e.select(t)},ue=(e,t,n)=>I($(e,{name:t,error:mE(n)}),`error`),de=async()=>{if(!(!M||p)){m(M.id);try{await r.request(`routine.setEnabled`,{id:M.id,enabled:!M.enabled}),a()}catch(e){ue(M.enabled?t.disableFailed:t.enableFailed,M.name,e)}finally{m(null)}}},fe=async()=>{if(!(!M||p)){m(M.id),_($(t.running,{name:M.name}));try{let e=await r.request(`routine.runNow`,{id:M.id});_($(t.ranWith,{name:M.name,status:e.status})),a()}catch(e){ue(t.runFailed,M.name,e)}finally{m(null)}}},pe=async()=>{if(p)return;let e=_E(await r.request(`repos.list`).then(e=>e.repos).catch(()=>[]),s);C.set((0,V.jsx)(Mk,{repos:e,tasks:(o?.tasks??[]).filter(e=>!e.deleting).map(e=>({id:e.id,title:e.label,repo:e.repo})),defaultRepo:c,onSubmit:e=>{(async()=>{m(`new`);try{await r.request(`routine.create`,{...e.repo===null?{}:{repo:e.repo},name:e.name,prompt:e.prompt,schedule:e.schedule,...e.target?{targetTask:e.target.taskId,targetTab:e.target.tabId}:{}}),a()}catch(e){I($(t.createFailed,{error:mE(e)}),`error`)}finally{m(null)}})()}}))},me=()=>{if(!M||p)return;let e=M;C.set((0,V.jsx)(Ci,{title:t.deleteTitle,body:$(t.deleteBody,{name:e.name}),confirmLabel:t.deleteButton,onConfirm:async()=>{m(e.id);try{await r.request(`routine.delete`,{id:e.id}),a()}catch(n){ue(t.deleteFailed,e.name,n)}finally{m(null)}}}))};SE(e=>{if(e.ctrlKey)return e.key===`c`&&(O.set(null),!0);switch(e.key){case`Escape`:case`q`:return O.set(null),!0;case`j`:case`ArrowDown`:return N(Math.min(j.length-1,te+1)),!0;case`k`:case`ArrowUp`:return N(Math.max(0,te-1)),!0;case`n`:return pe(),!0;case`r`:return a(),!0;case`e`:return de(),!0;case`s`:return fe(),!0;case`d`:return me(),!0;case`Enter`:{let e=re[0]?.taskId;return e?le(e):re.length>0&&_(t.latestRunNoTask),!0}default:return!1}});let he=e=>gO(e,e=>S.find(t=>t.id===e)?.name??e,t.engineDefault),ge=()=>{if(!M)return;let n=M;C.set((0,V.jsx)(tk,{model:e,current:async()=>({engine:n.vendor,effort:n.modelEffort,model:n.model}),onSet:async e=>{let i=await r.request(`routine.setEngine`,{id:n.id,engine:e.engine.id,model:e.model??``,effort:e.effort??``});_($(i.releasedSessionTaskId?t.engineChangedNewSession:t.engineChanged,{name:n.name,engine:[e.engine.name,e.model,e.effort].filter(Boolean).join(` · `)})),a()}}))},_e=e=>e===void 0?z(`rail.noProject`):gE(e,T.flatMap(e=>e.repo??[]));return(0,V.jsxs)(`div`,{className:`${Cx} ${nk}`,tabIndex:0,ref:v,children:[(0,V.jsxs)(`div`,{className:Ex,children:[(0,V.jsx)(`h1`,{className:Tx,children:t.title}),(0,V.jsxs)(`span`,{className:`mono ${Ox}`,children:[P>0&&(0,V.jsx)(`span`,{className:`text-error`,children:$(t.needAttention,{count:String(P),total:String(j.length)})}),(0,V.jsx)(`span`,{className:`text-muted`,children:l?.keepsDaemonAlive?t.holdingDaemon:t.notHolding}),(0,V.jsx)(`button`,{type:`button`,className:`${kr} ${kx.header}`,onClick:()=>void pe(),children:z(`pages.new`)})]})]}),(0,V.jsx)(Ok,{client:r,tick:i,reload:a}),l===null?(0,V.jsx)(`p`,{className:`text-muted`,children:n.loading}):j.length===0?(0,V.jsxs)(`div`,{className:Ax,children:[(0,V.jsx)(`p`,{className:`text-muted`,children:t.empty}),(0,V.jsx)(`p`,{className:`keys-only`,children:t.emptyHint})]}):(0,V.jsxs)(`div`,{className:rk,children:[(0,V.jsx)(`div`,{className:ik,ref:ie,children:ee.map(e=>e.rows.length===0?null:(0,V.jsxs)(`section`,{children:[(0,V.jsxs)(`h2`,{className:`${U} ${ak} ${e===ee[0]?`text-error`:`text-muted`}`,children:[z(e.key),` `,(0,V.jsx)(`span`,{className:`mono`,children:e.rows.length})]}),e.rows.map(e=>{let n=j.indexOf(e),r=E[e.id],i=r?Kk(r):null;return(0,V.jsxs)(`div`,{"data-row":n,className:ok(n===te),onClick:()=>{N(n),L(e=>e+1)},children:[(0,V.jsxs)(`span`,{className:sk,children:[(0,V.jsx)(`span`,{className:ck(!e.enabled),children:e.name}),(0,V.jsx)(`span`,{className:`mono text-muted ${lk}`,children:e.enabled?se(e.nextRunAt):t.paused}),(0,V.jsx)(`span`,{className:`mono ${i?Wk[i]:`text-muted`}`,style:{width:`1ch`},children:i?Gk[i]:` `})]}),(0,V.jsx)(`span`,{className:`mono text-muted ${uk}`,title:e.schedule,children:[_e(e.repo),YO(e.schedule,b)??e.schedule,he(e)?.short].filter(Boolean).join(` · `)}),D[e.id]?(0,V.jsx)(`span`,{className:`mono text-warning ${uk}`,title:D[e.id]?.reason,children:$(t.lastFailed,{when:se(D[e.id]?.at),reason:D[e.id]?.reason??``})}):null]},e.id)})]},e.key))}),(0,V.jsx)(`div`,{className:dk,ref:x,children:M?(0,V.jsx)(Qk,{routine:M,runs:re,busy:p===M.id,project:_e(M.repo),engine:he(M)?.full??null,targetTitle:M.target?ce(M.target.taskId):void 0,now:R,when:se,openRun:le,onRunNow:()=>void fe(),onToggle:()=>void de(),onDelete:me,onChangeEngine:ge}):(0,V.jsx)(`p`,{className:`text-muted`,children:t.noSelection})})]}),g&&(0,V.jsx)(`p`,{className:`text-muted mx-0 mt-2 mb-0 text-meta leading-[inherit]`,children:g})]})}function tA({active:e=!1,onSelect:t,plus:n=!1,children:r}){return(0,V.jsxs)(`button`,{type:`button`,className:`rail-nav-row ${zx(e)}`,"aria-current":e?`page`:void 0,onClick:t,children:[r,n?(0,V.jsx)(`span`,{className:Bx,"aria-hidden":`true`,children:`+`}):null]})}var nA=`mx-auto flex max-w-[76rem] flex-col font-mono text-meta leading-[1.5]`,rA=`flex items-end justify-between gap-[4ch]`,iA=`m-0 text-title font-bold tracking-[0.02em]`,aA=`font-bold tracking-code uppercase`,oA=`text-muted`,sA=`text-subtle`,cA=`my-4 border-t-hairline border-dashed! border-line-active`,lA=`m-0 mb-1.5 text-meta text-muted ${aA}`,uA=`${lA} flex flex-wrap items-baseline justify-between gap-x-[4ch]`,dA=`flex flex-wrap items-start gap-x-[8ch] gap-y-4`,fA=`min-w-[min(100%,36ch)] flex-1`,pA=`text-[3.5rem] leading-none font-bold tracking-[-0.03em]`,mA=`grid grid-cols-[repeat(auto-fit,minmax(min(100%,34ch),1fr))] items-start gap-x-[6ch] gap-y-5`,hA=`flex min-w-0 items-baseline gap-[1ch] whitespace-nowrap`,gA=`min-w-0 truncate`,_A=`min-w-[2ch] flex-1 -translate-y-0.75 border-b-hairline border-dotted! border-line-active`,vA=`pl-[2ch] text-subtle`,yA=`-mx-[1ch] block rounded-sm px-[1ch] py-0.5 text-left`,bA=`${yA} w-[calc(100%+2ch)] cursor-pointer hover:bg-hover focus-visible:outline-1 focus-visible:-outline-offset-1 focus-visible:outline-focus`,xA=`grid grid-cols-[6ch_minmax(0,1fr)_5ch_5ch_8ch] items-center gap-x-[2ch] py-0.5 whitespace-nowrap`,SA=[`bg-accent`,`bg-info`,`bg-merged`,`bg-subtle`],CA=`grid grid-cols-[minmax(0,1fr)_minmax(8ch,14ch)_5ch] items-center gap-x-[1ch] whitespace-nowrap`,wA=`relative h-2.5 border-hairline border-current after:absolute after:inset-y-0 after:left-0 after:w-(--fill) after:bg-current after:content-['']`,TA={ok:`${wA} text-success`,warn:`${wA} text-warning`,crit:`${wA} text-error`},EA=`flex h-9 flex-none items-stretch text-ink`,DA=`flex-none bg-current`,OA=`flex flex-wrap items-baseline justify-between gap-x-[4ch] gap-y-1 text-subtle`,kA={turns:0,tokens:0,ms:0},AA=e=>(e.usage?.input_tokens??0)+(e.usage?.output_tokens??0),jA=e=>Math.max(0,e.endedAt-e.startedAt),MA=(e,t)=>({turns:e.turns+1,tokens:e.tokens+AA(t),ms:e.ms+jA(t)});function NA(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function PA(e,t,n,r){let i=[];for(let e=n-1;e>=0;e--){let n=new Date(t);n.setDate(n.getDate()-e),i.push(NA(n.getTime()))}let a=new Map(i.map(e=>[e,{sum:kA,byEngine:{}}]));for(let t of e){let e=a.get(NA(t.startedAt));if(!e)continue;let n=t.vendor??`unknown`;e.sum=MA(e.sum,t),e.byEngine[n]=(e.byEngine[n]??0)+AA(t)}let o=e.reduce((e,t)=>Math.min(e,t.startedAt),1/0),s=e.length>=r&&Number.isFinite(o)?{count:e.length,day:NA(o)}:null;return{cutoff:s,days:i.map(e=>{let t=a.get(e);return{day:e,...t?.sum??kA,byEngine:t?.byEngine??{},partial:s!==null&&e<=s.day}})}}function FA(e){let t=new Map;for(let n of e){let e=n.vendor??`unknown`,r=n.model??`unknown`,i=`${e}\0${r}`;t.set(i,{engine:e,model:r,...MA(t.get(i)??kA,n)})}return[...t.values()].sort((e,t)=>t.tokens-e.tokens||t.turns-e.turns)}function IA(e,t){let n=new Map;for(let t of e)n.set(t.taskId,{taskId:t.taskId,...MA(n.get(t.taskId)??kA,t)});return[...n.values()].sort((e,t)=>t.tokens-e.tokens||t.turns-e.turns).slice(0,t)}function LA(e){return e<1e3?String(e):e<1e6?`${(e/1e3).toFixed(+(e<1e4)).replace(/\.0$/,``)}k`:`${(e/1e6).toFixed(+(e<1e7)).replace(/\.0$/,``)}M`}var RA=.1,zA=/^(\d+)\s*(h|d)$/;function BA(e,t){let n=zA.exec(e.label.trim());if(!n||e.resetsAt===null||e.percent<=0)return null;let r=Number(n[1])*(n[2]===`d`?24:1)*36e5,i=r-(e.resetsAt-t);if(!(i>=r*RA)||i>r)return null;if(e.percent>=100)return{kind:`full`,at:t};let a=t+(100-e.percent)/e.percent*i;return a<e.resetsAt?{kind:`full`,at:a}:{kind:`lasts`}}var VA=14,HA=500,UA=3e4,WA=8;function GA(e,t,n,r){let i=Y(e,t,n),[a,o]=(0,h.useState)(i?{kind:`ready`,value:i}:{kind:`loading`}),s=JSON.stringify(n);return(0,h.useEffect)(()=>{let r=!0;return Gu(e,t,n).then(e=>r&&o({kind:`ready`,value:e})).catch(e=>r&&o(t=>t.kind===`ready`?t:{kind:`failed`,error:mE(e)})),()=>{r=!1}},[e,t,s,r]),a}var KA=()=>(0,V.jsx)(`div`,{className:cA});function qA({name:e,title:t,sum:n,sub:r,open:i}){let a=(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`span`,{className:hA,children:[(0,V.jsx)(`span`,{className:gA,title:t,children:e}),(0,V.jsx)(`span`,{className:_A}),(0,V.jsx)(`span`,{children:LA(n.tokens)})]}),(0,V.jsx)(`span`,{className:`block truncate ${vA}`,children:[r,`${n.turns}t`,Lk(n.ms)].filter(Boolean).join(` · `)})]});return i?(0,V.jsx)(H,{variant:`row`,className:bA,onClick:i,children:a}):(0,V.jsx)(`div`,{className:yA,children:a})}function JA({sum:e}){let t=`${e.tokens}${e.turns}${e.ms}`.repeat(4).slice(0,36);return(0,V.jsx)(`div`,{className:EA,"aria-hidden":`true`,children:[...t].map((e,t)=>(0,V.jsx)(`span`,{className:DA,style:{width:1+Number(e)%3,marginRight:1+Number(e)%2}},t))})}function YA({usage:e,nameOf:t}){let n=Date.now(),r=e.flatMap(e=>e.windows.map(r=>{let i=BA(r,n),a=i?.kind===`full`&&i.at-n<72e6,o=i?.kind===`full`?$(z(`usage.full`),{time:new Date(i.at).toLocaleString([],{...a?{}:{weekday:`short`},hour:`2-digit`,minute:`2-digit`})}):i?z(`usage.lasts`):``;return{key:`${e.vendor}:${r.kind}`,name:`${e.name||t(e.vendor)} ${r.label}`,percent:Math.round(r.percent),tone:rT({capturedAt:e.capturedAt,windows:[r]},n)?.tone??`ok`,note:o}}));return r.length===0?null:(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`h2`,{className:lA,children:z(`usage.quota`)}),r.map(e=>(0,V.jsxs)(`div`,{className:`py-0.5`,children:[(0,V.jsxs)(`div`,{className:CA,children:[(0,V.jsx)(`span`,{className:gA,children:e.name}),(0,V.jsx)(`span`,{className:TA[e.tone]??TA.ok,style:{"--fill":`${Math.min(100,Math.max(0,e.percent))}%`}}),(0,V.jsx)(`span`,{className:`text-right ${Bn[e.tone]}`,children:`${e.percent}%`})]}),e.note&&(0,V.jsx)(`div`,{className:`pl-[2ch] text-subtle`,children:e.note})]},e.key))]})}function XA({model:e}){B();let t=CE(),[n]=bE(UA),r=GA(e,`turns.list`,{sinceDays:VA,limit:HA},n),i=GA(e,`engines.list`,{},n),a=GA(e,`usage.get`,{},n),o=y(e.tasks),s=i.kind===`ready`?i.value.engines:[],c=e=>s.find(t=>t.id===e)?.name??e,l=e=>o?.tasks.find(t=>t.id===e)?.label??z(`usage.removedTask`),u=a.kind===`ready`&&a.value.usage&&(0,V.jsx)(YA,{usage:a.value.usage,nameOf:c});return(0,V.jsx)(`div`,{className:wx,tabIndex:0,ref:t,onKeyDown:e=>{e.metaKey||e.ctrlKey||e.altKey||e.key!==`q`&&e.key!==`Escape`||(e.preventDefault(),O.set(null))},children:(0,V.jsx)(`div`,{className:nA,children:(()=>{if(r.kind===`loading`)return(0,V.jsx)(`p`,{className:`m-0 ${oA}`,children:z(`usage.loading`)});if(r.kind===`failed`)return(0,V.jsx)(`p`,{className:`m-0 text-error`,children:$(z(`usage.failed`),{error:r.error})});let t=r.value.turns,n=new Set(r.value.readers??[]),i=PA(t,Date.now(),VA,HA),a=new Map;for(let e of i.days)for(let[t,n]of Object.entries(e.byEngine))a.set(t,(a.get(t)??0)+n);let s=[...a].sort((e,t)=>t[1]-e[1]).map(([e])=>e),d=e=>SA[Math.max(0,s.indexOf(e))%SA.length]??SA[0],f=Math.max(0,...i.days.map(e=>e.tokens)),p=i.days.slice(Math.max(0,i.days.findIndex(e=>e.turns>0))),m=i.days.reduce((e,t)=>({turns:e.turns+t.turns,tokens:e.tokens+t.tokens,ms:e.ms+t.ms}),{turns:0,tokens:0,ms:0}),h=[...new Set((o?.tasks??[]).flatMap(e=>e.engine?.id&&!n.has(e.engine.id)?[e.engine.id]:[]))];return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:rA,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`h1`,{className:iA,children:[(0,V.jsx)(`span`,{className:Wn,children:`[`}),` rove `,(0,V.jsx)(`span`,{className:Wn,children:`]`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:aA,children:z(`usage.receipt`)}),(0,V.jsx)(`span`,{className:oA,children:` ${i.days[0]?.day.slice(5)} → ${i.days.at(-1)?.day.slice(5)}`})]})]}),t.length>0&&(0,V.jsx)(JA,{sum:m})]}),(0,V.jsx)(KA,{}),t.length===0?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`p`,{className:`m-0 ${oA}`,children:z(`usage.empty`)}),u&&(0,V.jsx)(KA,{}),u]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:dA,children:[(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`h2`,{className:lA,children:z(`usage.total`)}),(0,V.jsx)(`div`,{className:pA,children:LA(m.tokens)}),(0,V.jsx)(`div`,{className:`mt-1.5 ${oA}`,children:`${$(z(`usage.turns`),{count:m.turns})} · ${Lk(m.ms)}`})]}),(0,V.jsxs)(`section`,{className:fA,children:[(0,V.jsxs)(`h2`,{className:uA,children:[z(`usage.perDay`),s.length>1&&(0,V.jsx)(`span`,{className:`flex flex-wrap gap-x-[2ch] font-normal tracking-normal normal-case`,children:s.map(e=>(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`span`,{className:`mr-[1ch] inline-block size-2 align-baseline ${d(e)}`}),c(e)]},e))})]}),p.map(e=>(0,V.jsxs)(`div`,{className:xA,children:[(0,V.jsx)(`span`,{className:oA,children:`${e.day.slice(5)}${e.partial?`~`:``}`}),(0,V.jsx)(`span`,{className:`flex min-w-0`,children:e.tokens>0&&f>0&&(0,V.jsx)(`span`,{className:`flex h-2.5 w-(--fill) min-w-0.5 gap-px`,style:{"--fill":`${e.tokens/f*100}%`},children:s.map(t=>(e.byEngine[t]??0)>0&&(0,V.jsx)(`span`,{className:`min-w-0.5 basis-0 ${d(t)}`,style:{flexGrow:e.byEngine[t]}},t))})}),e.turns>0&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`text-right`,children:LA(e.tokens)}),(0,V.jsx)(`span`,{className:`text-right text-subtle`,children:`${e.turns}t`}),(0,V.jsx)(`span`,{className:`text-right text-subtle`,children:Lk(e.ms)})]})]},e.day))]})]}),(0,V.jsx)(KA,{}),(0,V.jsxs)(`div`,{className:mA,children:[(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`h2`,{className:lA,children:z(`usage.byModel`)}),FA(t).map(e=>(0,V.jsx)(qA,{name:e.model,title:`${c(e.engine)} · ${e.model}`,sum:e,sub:c(e.engine)},`${e.engine}\0${e.model}`))]}),(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`h2`,{className:lA,children:z(`usage.topTasks`)}),IA(t,WA).map(t=>{let n=o?.tasks.some(e=>e.id===t.taskId),r=l(t.taskId);return(0,V.jsx)(qA,{name:n?r:(0,V.jsx)(`span`,{className:sA,children:r}),title:r,sum:t,open:n?()=>{O.set(null),e.select(t.taskId)}:null},t.taskId)})]}),u]})]}),(0,V.jsx)(KA,{}),(0,V.jsxs)(`div`,{className:OA,children:[(0,V.jsx)(`span`,{children:$(z(`usage.range`),{days:VA})}),i.cutoff&&(0,V.jsx)(`span`,{children:$(z(`usage.cutoff`),{count:i.cutoff.count,day:i.cutoff.day.slice(5)})}),h.length>0&&(0,V.jsx)(`span`,{children:$(z(`usage.noReader`),{engines:h.map(c).join(`, `)})}),(0,V.jsx)(`span`,{className:`${aA} ml-auto`,children:z(`usage.thanks`)})]})]})})()})})}var ZA={id:`mods`,label:`mods`},QA=[{id:`kanban`,label:`kanban`,mod:`kanban`},{id:`routines`,label:`automations`},{id:`issues`,label:`issues`,mod:`issues`}];function $A({model:e}){let{nav:t}=fE(),n=y(O),r=y(e.mods).length>0,i=y(e.installedMods),a=[...QA.filter(e=>!e.mod||i.has(e.mod)),...r?[ZA]:[]];return(0,V.jsxs)(`div`,{className:Ix,children:[(0,V.jsx)(tA,{plus:!0,onSelect:()=>mv(),children:z(`rail.newTask`)}),a.map(e=>(0,V.jsx)(tA,{active:n===e.id,onSelect:()=>he(e.id),children:t[e.label]},e.id))]})}function ej({model:e,page:t}){(0,h.useEffect)(()=>e.selection.subscribe(()=>O.set(null)),[e]);let n=y(e.installedMods);return t===`kanban`&&n.has(`kanban`)?(0,V.jsx)(QD,{model:e}):t===`routines`?(0,V.jsx)(eA,{model:e}):t===`issues`&&n.has(`issues`)?(0,V.jsx)(ZE,{model:e}):t===`mods`?(0,V.jsx)(hO,{model:e}):t===`compare`?(0,V.jsx)(zE,{model:e}):t===`usage`?(0,V.jsx)(XA,{model:e}):null}var tj=f();function nj(e){return e?.match(/^https?:\/\/[^/]+\/([^/]+\/[^/]+)\/(?:pull|merge_requests|-\/merge_requests)\//)?.[1]}var rj=e=>e.charAt(0).toUpperCase()+e.slice(1);function ij(e){return[z(`rail.pr.state.${e.state}`),...e.checks?[z(`rail.pr.checks.${e.checks}`)]:[]].join(`, `)}function aj(e){let t=new Map;for(let n of e){let e=wh(n),r=[...e&&n.pr?[{pr:n.pr,mark:e}]:[],...(n.sessionPrs??[]).flatMap(e=>{let t=Th(e);return t?[{pr:e,mark:t}]:[]})];for(let{pr:e,mark:i}of r){let r=e.url??(e.number===void 0?n.id:`${n.repo}#${e.number}`),a=t.get(r),o=e.lifecycle===`unknown`,s=a?.pr.lifecycle===`unknown`;(!a||s&&!o||o===s&&Eh([a.mark,i])!==a.mark)&&t.set(r,{task:n,pr:e,mark:i})}}return[...t.values()]}function oj({tasks:e,onOpen:t}){let[n,r]=(0,h.useState)(null),[i,a]=(0,h.useState)(!1),o=(0,h.useRef)(null),s=(0,h.useRef)(null),c=(0,h.useRef)(null),l=cu();(0,h.useLayoutEffect)(()=>{let e=c.current;if(!e||!n)return;let t=e.getBoundingClientRect();t.right>window.innerWidth-8&&(e.style.left=`${Math.max(8,window.innerWidth-t.width-8)}px`,e.style.top=`${n.bottom+6}px`);let r=e.getBoundingClientRect().bottom-(window.innerHeight-8);r>0&&(e.style.top=`${Math.max(8,e.getBoundingClientRect().top-r)}px`)},[n]);let u=()=>{t?.(),s.current!==null&&window.clearTimeout(s.current),s.current=null,a(!1),o.current&&!n&&r(o.current.getBoundingClientRect())},d=()=>{a(!0),s.current=window.setTimeout(()=>r(null),140)};(0,h.useEffect)(()=>{if(!l||!n)return;let e=e=>{let t=e.target;o.current?.contains(t)||c.current?.contains(t)||(a(!0),s.current=window.setTimeout(()=>r(null),140))};return document.addEventListener(`pointerdown`,e,!0),()=>document.removeEventListener(`pointerdown`,e,!0)},[l,n]),(0,h.useEffect)(()=>()=>{s.current!==null&&window.clearTimeout(s.current)},[]);let f=aj(e),p=Eh(f.map(e=>e.mark));if(!p)return null;let m=f.length===1?`PR #${f[0]?.pr.number??``}, ${ij(p)}`:z(`rail.pr.many`,{count:f.length});return(0,V.jsxs)(`span`,{ref:o,className:`chip ${wm} ${p.tone}`,"aria-label":m,onMouseEnter:l?void 0:u,onMouseLeave:l?void 0:d,onClick:e=>{l&&(e.stopPropagation(),n&&!i?d():u())},children:[p.glyph,f.length>1&&(0,V.jsx)(`span`,{className:`font-sans`,children:f.length}),n&&(0,tj.createPortal)((0,V.jsx)(`div`,{ref:c,className:Tm(i),style:{top:n.top-6,left:n.right+8},onMouseEnter:l?void 0:u,onMouseLeave:l?void 0:d,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onContextMenu:e=>e.stopPropagation(),children:f.map(({task:e,pr:t,mark:n})=>{let r=nj(t?.url),i=t?.additions!==void 0&&t.deletions!==void 0;return(0,V.jsxs)(`button`,{type:`button`,className:`flex flex-col gap-1 rounded-[calc(var(--radius)-6px)] px-3 py-2 text-left font-sans enabled:hover:bg-hover`,disabled:!t?.url,onClick:()=>t?.url&&window.open(t.url,`_blank`,`noopener`),children:[(0,V.jsx)(`span`,{className:`truncate font-semibold text-ink`,children:t.title||e.label}),(0,V.jsxs)(`span`,{className:`flex items-baseline gap-0 text-meta leading-[inherit] whitespace-nowrap`,children:[(0,V.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.25 ${n.tone}`,children:[(0,V.jsx)(`span`,{className:`font-mono`,children:n.glyph}),rj(z(`rail.pr.state.${n.state}`))]}),(0,V.jsx)(`span`,{className:`overflow-hidden text-ellipsis whitespace-pre text-muted`,children:[...n.checks?[z(`rail.pr.checks.${n.checks}`)]:[],[r,t?.number===void 0?``:`#${t.number}`].filter(Boolean).join(` `)].filter(Boolean).map(e=>`, ${e}`).join(``)}),i&&(0,V.jsxs)(`span`,{className:`ml-auto flex gap-1.5 pl-3 tabular-nums`,children:[(0,V.jsxs)(`span`,{className:`text-success`,children:[`+`,t.additions]}),(0,V.jsxs)(`span`,{className:`text-error`,children:[`−`,t.deletions]})]})]})]},t.url??`${e.id}#${t.number??``}`)})}),document.body)]})}function sj(e,t,n){let r=t.kind===`main`,i=e=>r?e.kind===`main`:e.kind!==`main`&&e.repo===t.repo&&!e.pinned==!t.pinned;if(t.id===n.id||!i(n))return null;let a=e.filter(i).sort((e,t)=>(e.order??e.rank)-(t.order??t.rank)).map(e=>e.id);return a.indexOf(n.id)-a.indexOf(t.id)}function cj(e,t,n,r){let i=sj(e,t,n);return i===null?null:r===`above`&&i>0?i-1:r===`below`&&i<0?i+1:i}function lj(e,t){return e.id===t.id?!1:e.kind===`main`?t.kind===`main`:t.kind!==`main`&&t.repo===e.repo&&!t.pinned==!e.pinned}var uj=e=>e===void 0||e.kind===`project`||e.kind===`state`?0:e.kind===`task`||e.kind===`pane`||e.kind===`round`?e.depth:1;function dj(e,t){let n=uj(e[t]),r=t+1;for(;r<e.length&&uj(e[r])>n;)r++;return r}function fj(e,t){let n=uj(e[t]),r=[];for(let i=2;i<=n;i++){let a=t+1;for(;a<e.length&&uj(e[a])>i;)a++;let o=a<e.length&&uj(e[a])===i;r.push(i===n?o?`tee`:`elbow`:o?`pipe`:`blank`)}return r}function pj(e,t,n,r){let i=e.findIndex(e=>e.id===t);if(i<0||t===n)return e;let a=dj(e,i),o=e.slice(i,a),s=[...e.slice(0,i),...e.slice(a)],c=s.findIndex(e=>e.id===n);if(c<0)return e;let l=r===`above`?c:dj(s,c);return[...s.slice(0,l),...o,...s.slice(l)]}var mj={duration:180,easing:`cubic-bezier(0.16, 1, 0.3, 1)`};function hj(e,t){let n=(0,h.useRef)(null);(0,h.useLayoutEffect)(()=>{let r=[...document.querySelectorAll(`[data-rail-body] > [data-row]`)],i=new Map(r.map(e=>[e.dataset.row??``,e.offsetTop])),a=n.current;if(n.current={list:e,tops:i},!(!a||a.list===e||a.tops.size===0||t)&&!window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)for(let e of r){let t=a.tops.get(e.dataset.row??``);t===void 0?e.animate([{opacity:0},{opacity:1}],mj):t!==e.offsetTop&&e.animate([{transform:`translateY(${t-e.offsetTop}px)`},{transform:`none`}],mj)}})}var gj=null,_j=()=>(gj||(gj=new Image,gj.src=`data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7`),gj);function vj(e,t,n,r){let[i,a]=(0,h.useState)(null),o=(0,h.useRef)(t);o.current=t;let[s,c]=(0,h.useState)(null),l=(0,h.useRef)(()=>a(null));(0,h.useEffect)(()=>{if(!s)return;let e=()=>{c(null),l.current()};if(t!==s)return e();let n=window.setTimeout(e,3e3);return()=>window.clearTimeout(n)},[t,s]);let u=(0,h.useRef)(null),d=(0,h.useRef)(null);hj(t,i!==null||s!==null);let f=()=>[...u.current?.querySelectorAll(`[data-row]`)??[]];(0,h.useLayoutEffect)(()=>{let e=d.current;if(!e||(d.current=null,window.matchMedia(`(prefers-reduced-motion: reduce)`).matches))return;let t=f().flatMap(t=>{let n=e.get(t.dataset.row??``),r=n===void 0?0:n-t.getBoundingClientRect().top;return r?[{el:t,dy:r}]:[]});for(let{el:e,dy:n}of t)e.style.transition=`none`,e.style.transform=`translateY(${n}px)`;u.current?.getBoundingClientRect();for(let{el:e}of t)e.style.transition=`transform 150ms ease-out`,e.style.transform=``,e.addEventListener(`transitionend`,()=>e.style.removeProperty(`transition`),{once:!0})});let p=(0,h.useRef)(null),m=(0,h.useRef)([]),g=(0,h.useRef)(new Map),_=(0,h.useRef)(0),v=(0,h.useRef)(0),y=e=>{p.current=e,a(e)},b=e=>!n||e.machine!==void 0?null:e.kind===`project`?e.noProject?null:t.find(t=>t.repo===e.repo&&!Td(t))??null:e.kind===`task`&&e.depth===1&&e.task.kind!==`main`?e.task:null,x=e=>{let t=b(e);if(t)return{draggable:!0,onDragStart:n=>{n.dataTransfer.effectAllowed=`move`,n.dataTransfer.setDragImage(_j(),0,0),n.dataTransfer.setData(`text/plain`,t.id),u.current=n.currentTarget.closest(`[data-rail-body]`),w(u.current);let r=m.current,i=r.findIndex(t=>t.id===e.id);_.current=r.slice(i,dj(r,i)).reduce((e,t,n)=>e+(g.current.get(t.id)?.height??0)+(n>0?g.current.get(t.id)?.gap??0:0),0),v.current=n.clientY,y({fromRow:e.id,from:t,toRow:e.id,to:t,side:`above`,project:e.kind===`project`})},onDragEnd:()=>p.current&&y(null)}},S=(e,t,n)=>{let r=t;if(n.project)for(;r>0&&e[r]?.kind!==`project`;)r--;let i=e[r];if(!i||i.kind===`project`!==n.project)return null;let a=b(i);return!a||!n.project&&!lj(n.from,a)?null:{row:i.id,task:a}},C={onDragOver:e=>{let t=p.current;if(!t)return;e.preventDefault();let n=e.clientY-v.current;v.current=e.clientY;let r=e.target.closest(`[data-row]`)?.dataset.row,i=m.current,a=S(i,i.findIndex(e=>e.id===r),t);if(!a||a.row===t.fromRow)return;let o=e.currentTarget.querySelector(`[data-row="${CSS.escape(t.fromRow)}"]`)?.getBoundingClientRect().top;if(o===void 0||e.clientY>=o&&e.clientY<o+_.current)return;let s=e.clientY<o?`above`:`below`;(s===`above`?n>=0:n<=0)||(t.toRow!==a.row||t.side!==s)&&y({...t,toRow:a.row,to:a.task,side:s})},onDrop:n=>{let i=p.current;if(!i)return;n.preventDefault(),p.current=null,r?l.current=()=>a(null):l.current=()=>{d.current=new Map(f().map(e=>[e.dataset.row??``,e.getBoundingClientRect().top])),a(null),Ap(`default`),I(G(`tasks`,`sort.label`,{mode:G(`tasks`,`sort.modes.default`)}))};let s=o.current,u=()=>o.current===s?c(s):l.current();if(i.project){if(i.toRow===i.fromRow)return l.current();let t={repo:i.from.repo,target:i.to.repo,side:i.side===`above`?`before`:`after`};e.client.request(`project.move`,t).catch(e=>I(G(`tasks`,`toast.moveFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)).finally(u);return}let m=cj(t,i.from,i.to,i.side);m?Ip(e,i.from.id,m).finally(u):l.current()}},w=e=>{let t=[...e?.querySelectorAll(`[data-row]`)??[]];g.current=new Map(t.map((e,n)=>{let r=t[n-1],i=r?e.offsetTop-r.offsetTop-r.offsetHeight:0;return[e.dataset.row??``,{top:e.offsetTop,gap:i,height:e.offsetHeight}]}))},T=(e,t)=>{m.current=t?pj(e,t.fromRow,t.toRow,t.side):e;let n=new Map;if(!t)return n;let r=Math.min(...[...g.current.values()].map(e=>e.top)),i=e=>e.kind===`project`||e.kind===`state`,a=Math.max(0,...e.filter(i).map(e=>g.current.get(e.id)?.gap??0));for(let[e,t]of m.current.entries()){let o=g.current.get(t.id);if(!o)return new Map;e>0&&(r+=i(t)?a:o.gap),r!==o.top&&n.set(t.id,r-o.top),r+=o.height}return n};return{props:x,body:C,places:e=>{let t=[...g.current.keys()],n=i&&e.length===t.length&&e.every((e,n)=>e.id===t[n])?i:null,r=T(e,n),a=n?e.findIndex(e=>e.id===n.fromRow):-1,o=new Set(a<0?[]:e.slice(a,dj(e,a)).map(e=>e.id));return{dragging:n?.fromRow??null,place:e=>{let t=r.get(e.id);return{"data-row":e.id,...o.has(e.id)?{"data-lifted":``}:{},...t?{style:{transform:`translateY(${t}px)`}}:{}}}}}}}function yj({model:e,narrow:t,onSettings:n}){B();let r=y(IC),i=Q(`engines.skill.bannerHintWeb`,{engines:r.join(`, `)});return(0,V.jsxs)(`div`,{className:Lx,children:[!t&&(0,V.jsx)(aT,{client:e.client}),(0,V.jsxs)(`div`,{className:Rx,children:[(0,V.jsxs)(`button`,{type:`button`,className:`rail-nav-row ${zx(!1)}`,onClick:n,children:[(0,V.jsxs)(`svg`,{className:Vx,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,V.jsx)(`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`}),(0,V.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`})]}),(0,V.jsx)(`span`,{children:z(`rail.settings`)}),r.length>0&&(0,V.jsx)(`span`,{className:`ml-2 min-w-0 truncate text-meta text-subtle`,title:i,children:z(`rail.skillCue`)})]}),(0,V.jsx)(FT,{model:e,bindingId:`settings.open`})]})]})}function bj(e,t,n,r,i=null){let a=e=>e.kind===`task`&&e.task.kind===`main`&&e.fold===void 0&&e.task.id!==n&&e.task.id!==i&&(r?t[e.task.id]?.length===0:(t[e.task.id]?.length??0)===0),o=e.filter(e=>!a(e));return o.filter((e,t)=>{if(e.kind!==`project`&&e.kind!==`state`)return!0;let n=o[t+1];return n!==void 0&&n.kind!==`project`&&n.kind!==`state`})}var xj=`rove.web.rail.shownMains`;function Sj(){try{let e=JSON.parse(localStorage.getItem(xj)??`[]`);return Array.isArray(e)?Object.fromEntries(e.map(e=>[String(e),[null]])):{}}catch{return{}}}function Cj(e,t){try{let n=e.filter(e=>e.kind===`main`&&(t[e.id]?.length??0)>0).map(e=>e.id);localStorage.setItem(xj,JSON.stringify(n))}catch{}}function wj(e,t,n){return(0,h.useEffect)(()=>{n&&Cj(e,t)},[n,e,t]),(0,h.useMemo)(()=>n?t:{...Sj(),...t},[n,t])}var Tj=v({});function Ej(e,t,n){let r=Tj.get()[`${e}::${t.id}`];return r&&r.sig===Kd(n)&&zd(n.root).some(e=>e.id===r.leaf)?r.leaf:n.activeLeafId}function Dj(e,t,n,r){Tj.set({...Tj.get(),[`${e}::${t}`]:{sig:Kd(n),leaf:r}})}function Oj(e,t,n,r){Dj(e,t.id,n,r),No(X(e,t.id,r))?.focus()}function kj(e){let{taskId:t,tabId:n}=e.selection.get(),r=t?e.tabs.get()[t]?.find(e=>e.id===n):void 0;return t&&r?{taskId:t,tab:r}:null}async function Aj(e,t,n){try{let r=await e.client.request(`tab.split`,t);typeof t.taskId==`string`&&await e.refreshTabsNow(t.taskId),n?.(r)}catch(e){I(e instanceof Error?e.message:String(e),`error`)}}function jj(e,t,n,r,i){let a=i??(n.split?Ej(t,n,n.split):`leaf-1`),o=e.selection.get();(o.taskId!==t||o.tabId!==n.id)&&e.select(t,n.id);let s=No(X(t,n.id,a))?.size();Aj(e,{taskId:t,tabId:n.id,action:`open`,direction:r,leafId:a,...s},e=>{e.changed?e.split&&Dj(t,n.id,e.split,e.leaf):I(z(`layout.splitTooSmall`),`error`)})}function Mj(e,t,n,r){let i=n.split,a=i?Ej(t,n,i):r,o=()=>Aj(e,{taskId:t,tabId:n.id,action:`close`,leafId:r},e=>{let i=e.split;if(!i)return;let o=a!==r&&zd(i.root).some(e=>e.id===a);Dj(t,n.id,i,o?a:i.activeLeafId)});if(!i||!Wd(n,i,r)){o();return}C.set((0,V.jsx)(Ci,{title:z(`confirm.closePaneTitle`,{pane:Ud(i,Ld(n)).get(r)??r}),body:z(`confirm.closePaneBody`),confirmLabel:z(`menu.closePane`),onConfirm:o}))}function Nj(e,t,n,r){let i=n.split;i&&C.set((0,V.jsx)(Si,{title:xl(`split.renameTitle`),initial:Ud(i,Ld(n)).get(r)??``,allowEmpty:!0,submitLabel:z(`dialog.save`),onSubmit:i=>Aj(e,{taskId:t,tabId:n.id,action:`rename`,leafId:r,title:i})}))}function Pj(e,t,n,r){return[{label:z(`menu.renamePane`),section:`split`,key:nl(`workspace.split.rename`)??void 0,run:()=>Nj(e,t,n,r)},{label:z(`menu.closePane`),section:`split`,key:ya(`workspace.split.close`)||void 0,run:()=>Mj(e,t,n,r)}]}function Fj(e,t,n,r){return[{label:z(`menu.splitRight`),section:`split`,key:nl(`workspace.split.right`)??void 0,run:()=>jj(e,t,n,`right`,r)},{label:z(`menu.splitDown`),section:`split`,key:nl(`workspace.split.down`)??void 0,run:()=>jj(e,t,n,`down`,r)}]}function Ij(e,t,n,r){let i=n.split,a=r??(i?Ej(t,n,i):`leaf-1`);return[...Fj(e,t,n,a),...Bd(i)?Pj(e,t,n,a):[]]}function Lj(e,t){let n=e.tabs.get()[t]??[],r=e.selection.get(),i=(r.taskId===t?n.find(e=>e.id===r.tabId):void 0)??fo(n);return!i||!Gd(i)?[]:Fj(e,t,i,i.split?Ej(t,i,i.split):`leaf-1`)}function Rj(e,{task:t,tab:n,leaf:r}){n.split&&Oj(t.id,n,n.split,r),e.select(t.id,n.id)}function zj(e){let{row:t}=e,n=y(e.model.selection);y(Tj);let r=n.taskId===t.task.id&&n.tabId===t.tab.id&&!!t.tab.split&&Ej(t.task.id,t.tab,t.tab.split)===t.leaf;return(0,V.jsxs)(`button`,{type:`button`,className:`${pi({size:`pane`})} ${e.cursor?Mm:``}`,"aria-current":r||void 0,onClick:e.onClick,onContextMenu:e.onMenu,...e.place,children:[(0,V.jsx)(`span`,{className:ym,"aria-hidden":`true`,children:e.guides?.map((e,t)=>(0,V.jsx)(`span`,{className:Sm(e)},t))}),(0,V.jsx)(`span`,{className:`${mi} text-(length:--fs-meta) ${r?`text-ink`:`text-muted`}`,children:t.label})]})}function Bj({model:e,task:t}){let[n,r]=(0,h.useState)(()=>Y(e,`task.get`,{taskId:t.id})?.task??null),[i,a]=(0,h.useState)(null),{busy:o,error:s,submit:c}=xi();(0,h.useEffect)(()=>{Gu(e,`task.get`,{taskId:t.id}).then(e=>r(e.task)).catch(e=>a(W(e)))},[e,t.id]);let l=()=>c(async()=>{if(!n?.prompt)return;let t=(await e.client.request(`task.spawn`,{repo:n.repo,prompt:n.prompt,...n.engine?{engine:n.engine}:{},...n.baseRef?{baseBranch:n.baseRef}:{}})).taskIds[0];t&&e.selectWhenListed(t)});return(0,V.jsx)(bi,{title:G(`tasks`,`runAgain.title`),wide:!0,children:(0,V.jsxs)(`form`,{className:Wr,onSubmit:e=>{e.preventDefault(),l()},children:[(0,V.jsx)(`p`,{className:`text-muted`,children:G(`tasks`,`runAgain.source`,{title:t.label})}),(0,V.jsx)(`pre`,{className:Tr,children:n?.prompt??i??G(`tasks`,`fieldNotes.loading`)}),(0,V.jsx)(`p`,{className:wr,children:G(`tasks`,`runAgain.hint`)}),s&&(0,V.jsx)(`p`,{className:`text-error`,children:s}),(0,V.jsx)(Ti,{busy:o||!n?.prompt,submitLabel:G(`tasks`,`runAgain.confirm`)})]})})}function Vj(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}function Hj({model:e,repo:t}){let[n,r]=(0,h.useState)({kind:`loading`}),[i,a]=(0,h.useState)(0),[o,s]=(0,h.useState)(null),[c,l]=(0,h.useState)(null),u=(0,h.useRef)(null),d=()=>e.client.request(`notes.list`,{repo:t}).then(e=>r({kind:`ready`,notes:e.notes})).catch(e=>r({kind:`error`,message:W(e)}));(0,h.useEffect)(()=>void d(),[]);let f=n.kind===`ready`?n.notes:[];(0,h.useEffect)(()=>a(e=>Math.max(0,Math.min(e,f.length-1))),[f.length]),(0,h.useEffect)(()=>{u.current?.querySelector(`.is-selected`)?.scrollIntoView({block:`nearest`})},[i]);let p=async n=>{if(n.id!==void 0){l(null);try{await e.client.request(`notes.delete`,{repo:t,id:n.id}),s(null),await d()}catch(e){l(W(e))}}};return(0,V.jsx)(bi,{title:G(`tasks`,`fieldNotes.title`),wide:!0,children:(0,V.jsxs)(`div`,{className:Wr,onKeyDown:e=>{if(!o){if(e.key===`ArrowDown`||e.key===`j`)a(e=>Math.min(f.length-1,e+1));else if(e.key===`ArrowUp`||e.key===`k`)a(e=>Math.max(0,e-1));else if(e.key===`d`&&f[i]?.id!==void 0)s(f[i]??null);else return;e.preventDefault()}},children:[(0,V.jsx)(`p`,{className:`font-mono text-meta break-all text-muted`,children:t}),n.kind===`loading`&&(0,V.jsx)(`p`,{className:`text-muted`,children:G(`tasks`,`fieldNotes.loading`)}),n.kind===`error`&&(0,V.jsx)(`p`,{className:`text-error`,children:n.message}),n.kind===`ready`&&f.length===0&&(0,V.jsx)(`p`,{className:`text-muted`,children:G(`tasks`,`fieldNotes.empty`)}),f.length>0&&(0,V.jsx)(`ul`,{className:`m-0 list-none p-0 flex max-h-[44vh] flex-col gap-2 overflow-y-auto`,ref:u,children:f.map((e,t)=>(0,V.jsx)(`li`,{children:(0,V.jsxs)(`button`,{type:`button`,className:Er(t===i),onClick:()=>a(t),autoFocus:t===0,children:[(0,V.jsxs)(`span`,{className:`font-mono text-meta whitespace-pre text-accent`,children:[t===i?`▸ `:` `,Vj(e.at),`, `,e.author]}),(0,V.jsx)(`span`,{className:`text-ink whitespace-pre-wrap wrap-anywhere`,children:e.text})]})},`${e.at}:${t}`))}),o&&(0,V.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-line bg-paper px-3 py-2.5`,children:[(0,V.jsx)(`p`,{children:(0,V.jsx)(`strong`,{children:G(`tasks`,`fieldNotes.confirmDelete.title`)})}),(0,V.jsx)(`p`,{className:`text-muted`,children:G(`tasks`,`fieldNotes.confirmDelete.body`,{text:o.text})}),c&&(0,V.jsx)(`p`,{className:`text-error`,children:c}),(0,V.jsxs)(`div`,{className:`actions flex items-center justify-end gap-3.5`,children:[(0,V.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>s(null),children:z(`dialog.cancel`)}),(0,V.jsx)(`button`,{type:`button`,className:br({danger:!0}),onClick:()=>void p(o),children:z(`taskops.retire`)})]})]}),!o&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`p`,{className:`keys-only font-sans text-meta text-subtle`,children:G(`tasks`,`fieldNotes.footerDeletable`)}),(0,V.jsxs)(`div`,{className:`actions flex items-center justify-end gap-3.5`,children:[(0,V.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,disabled:f[i]?.id===void 0,onClick:()=>s(f[i]??null),children:z(`taskops.retire`)}),(0,V.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:R,children:z(`taskops.close`)})]})]})]})})}var Uj=[`backlog`,`in_progress`,`in_review`,`done`,`canceled`,`error`],Wj={backlog:`status.backlog`,in_progress:`status.inProgress`,in_review:`status.inReview`,done:`status.done`,canceled:`status.canceled`,error:`status.error`},Gj=e=>({binding:e,key:nl(e)??void 0});async function Kj(e,t){if(!e){I(z(`menu.nothingToCopy`,{what:t}),`error`);return}try{await navigator.clipboard.writeText(e),I(z(`menu.copied`,{text:e}))}catch{I(z(`menu.copyFailed`),`error`)}}function qj(e,t,n){let r=[{label:z(`menu.newTask`),section:`open`,run:()=>mv(t)}],i=n.mainTaskId;return i&&(n.first||r.push({label:G(`tasks`,`menu.moveToTop`),section:`edit`,run:()=>void e.client.request(`task.move`,{taskId:i,direction:`top`}).catch(e=>I(G(`tasks`,`toast.moveFailed`,{error:String(e)}),`error`))}),r.push({label:G(`tasks`,`menu.reorderProject`),section:`edit`,...Gj(`sidebar.localMerge`),run:()=>Yj(i)})),r.push({label:G(`tasks`,`menu.fieldNotes`),section:`notes`,run:()=>C.set((0,V.jsx)(Hj,{model:e,repo:t}))}),i&&r.push({label:G(`tasks`,`menu.forgetProject`),section:`danger`,danger:!0,run:()=>C.set(Ey(e,t,n.label))}),r}function Jj(e){return[{label:z(`menu.newChatNoFolder`),section:`open`,run:()=>hv()},{label:z(`menu.newShell`),section:`open`,run:()=>void td(e).catch(e=>I(String(e),`error`))}]}function Yj(e){let t=!Mp.get();t&&e!==void 0&&Np.set(e),Pp(t),document.querySelector(`.rail`)?.focus()}function Xj(e,t){let n=(e.tasks.get()?.tasks??[]).filter(e=>e.kind===`main`&&!e.machine&&e.repo!==t.repo).map(e=>e.repo),r=n.map(e=>{let t=e.slice(e.lastIndexOf(`/`)+1);return{value:e,label:n.filter(e=>e.endsWith(`/${t}`)).length>1?e:t}});return r.length===0?(I(G(`tasks`,`moveToProject.empty`),`error`),null):(0,V.jsx)(wi,{title:G(`tasks`,`moveToProject.title`),choices:r,onPick:async n=>{await e.client.request(`task.moveToProject`,{taskId:t.id,repo:n}),I(G(`tasks`,`toast.movedToProject`,{project:r.find(e=>e.value===n)?.label??n}))}})}function Zj(e,t,n){let r=e.client,i=[];n&&(i.push({label:z(`menu.closeTab`),section:`tab`,run:()=>C.set((0,V.jsx)(Ci,{title:z(`confirm.closeTabTitle`,{tab:n.title??n.engineName??n.id}),body:z(`confirm.closeTabBody`),confirmLabel:z(`menu.closeTab`),onConfirm:async()=>{await e.closeTab(t.id,n.id)}}))}),i.push(...Ij(e,t.id,n))),i.push({label:z(`menu.newChat`),section:`open`,run:()=>void $u(e,t.id)}),i.push({label:z(`menu.newChatPick`),section:`open`,rare:!0,run:()=>C.set((0,V.jsx)(ad,{model:e,taskId:t.id}))}),i.push({label:z(`menu.continueEngine`),section:`open`,rare:!0,...Gj(`chat.tab.fork`),run:()=>C.set((0,V.jsx)(ad,{model:e,taskId:t.id,context:`continue`,sourceTabId:n?.id}))}),i.push({label:z(`menu.newShell`),section:`open`,run:()=>void ed(e,t.id,{kind:`shell`}).catch(e=>I(String(e),`error`))}),t.kind===`task`&&t.ownsBranch===!0&&t.branch&&!t.sharesWorkspaceOf&&!t.machine&&!t.extraRepoCount&&i.push({label:G(`tasks`,`menu.newTaskFromBranch`),section:`open`,rare:!0,run:()=>F({repo:t.repo,baseBranch:t.branch,worktree:!0})}),t.startsAt&&(i.push({label:z(`menu.startNow`),section:`open`,run:()=>void e.client.request(`task.startScheduledNow`,{taskId:t.id}).catch(e=>I(String(e),`error`))}),i.push({label:z(`menu.cancelStart`),section:`open`,run:()=>void e.client.request(`task.cancelScheduledStart`,{taskId:t.id}).catch(e=>I(String(e),`error`))})),t.hasPrompt&&(i.push({label:G(`tasks`,`menu.runAgain`),section:`open`,run:()=>C.set((0,V.jsx)(Bj,{model:e,task:t}))}),i.push({label:z(`menu.retryEdit`),section:`open`,rare:!0,run:()=>void e_(e,t)}));let a=!t.machine;if(a&&i.push({label:G(`tasks`,`menu.openEditor`),section:`open`,...Gj(`tasks.openWorktree`),run:()=>void xy(e,t.id)}),t.groupId){let e=t.groupId;i.push({label:z(`compare.menu`),section:`open`,run:()=>ge(e)})}i.push({label:z(`menu.rename`),section:`edit`,...Gj(`sidebar.rename`),run:()=>C.set((0,V.jsx)(Si,{title:z(`menu.rename`),initial:t.title,submitLabel:z(`dialog.save`),onSubmit:n=>e.act(`task.rename`,{taskId:t.id,title:n}).then(()=>{})}))}),t.kind!==`main`&&i.push({label:t.pinned?z(`menu.unpin`):z(`menu.pin`),section:`edit`,...Gj(`sidebar.pin`),run:()=>void e.act(`task.pin`,{taskId:t.id,pinned:!t.pinned}).catch(e=>I(String(e),`error`))}),a&&i.push({label:G(`tasks`,`menu.reorder`),section:`edit`,rare:!0,...Gj(`sidebar.localMerge`),run:()=>Yj()}),i.push({label:z(`menu.setStatus`),section:`edit`,children:Uj.map(n=>({label:z(Wj[n]),checked:n===t.status,run:()=>void e.act(`task.setStatus`,{taskId:t.id,status:n}).catch(e=>I(String(e),`error`))}))}),a&&t.kind!==`main`&&!t.routine&&!t.parentTaskId&&!t.extraRepoCount&&i.push({label:G(`tasks`,`menu.moveToProject`),section:`edit`,rare:!0,run:()=>{let n=Xj(e,t);n&&C.set(n)}}),a&&i.push({label:z(`menu.changeEngine`),section:`edit`,rare:!0,...Gj(`tasks.cycleEngine`),run:()=>C.set((0,V.jsx)(tk,{model:e,current:async()=>(await e.client.request(`task.get`,{taskId:t.id})).task,onSet:async n=>{await e.client.request(`task.setEngine`,{taskId:t.id,engine:n.engine.id,...n.effort===void 0?{}:{effort:n.effort},...n.model===void 0?{}:{model:n.model}}),I(G(`tasks`,`toast.engineSwitched`,{engine:n.engine.name}))}}))}),t.pr?.checkState===`failing`&&i.push({label:G(`tasks`,`menu.fixChecks`),section:`git`,key:ya(`files.fixChecks`),run:()=>void by(e,t.id,z(`taskops.fixSent`))}),t.kind===`task`&&t.branch&&a&&i.push({label:G(`tasks`,`menu.syncBase`),section:`git`,rare:!0,key:ya(`files.syncBase`),run:()=>void vy(e,t.id)}),t.branch&&i.push({label:z(`menu.renameBranch`),section:`git`,rare:!0,...Gj(`tasks.renameBranch`),run:()=>C.set((0,V.jsx)(Si,{title:z(`menu.renameBranch`),initial:t.branch,submitLabel:z(`dialog.save`),onSubmit:e=>r.request(`task.setBranch`,{taskId:t.id,branch:e}).then(()=>{})}))}),t.kind===`task`&&t.branch&&i.push({label:z(`menu.land`),section:`git`,run:()=>void gy(e,t)});let o=[{label:z(`menu.copyWhat.id`),run:()=>void Kj(t.id,z(`menu.what.id`))}];return t.branch&&o.push({label:z(`menu.copyWhat.branch`),run:()=>void Kj(t.branch,z(`menu.what.branch`))}),o.push({label:z(`menu.copyWhat.path`),run:()=>void r.request(`task.get`,{taskId:t.id}).then(e=>Kj(e.task.worktreePath,z(`menu.what.path`))).catch(e=>I(String(e),`error`))}),i.push({label:z(`menu.copy`),section:`copy`,children:o}),t.kind!==`main`&&i.push({label:G(`tasks`,t.archived?`menu.unarchive`:`menu.archive`),section:`danger`,run:()=>void Ty(e,t)}),i.push({label:z(`menu.removeSession`),section:`danger`,...Gj(`sidebar.delete`),danger:!0,run:()=>C.set(t.kind===`main`?wy(e,t):Cy(e,t))}),i}var Qj=`rove.collapsedProjects`,$j=`rove.foldedTasks`,eM=`rove.openedTasks`,tM=600;function nM(e){try{let t=JSON.parse(localStorage.getItem(e)??`[]`);return new Set(Array.isArray(t)?t.filter(e=>typeof e==`string`):[])}catch{return new Set}}function rM(e,t){try{localStorage.setItem(e,JSON.stringify([...t]))}catch{}}var iM=(e,t)=>{let n=new Set(e);return n.delete(t)||n.add(t),n};function aM(){let e=y(Op),[t,n]=(0,h.useState)({active:!1,query:``}),[r,i]=(0,h.useState)(()=>nM(Qj)),a=e=>i(t=>{let n=iM(t,e);return rM(Qj,n),n}),[o,s]=(0,h.useState)(()=>({folded:nM($j),opened:nM(eM)}));return{sort:e,cycleSort:jp,search:t,setSearch:n,collapsed:r,toggleProject:a,hand:o,toggleTaskFold:(e,t)=>s(n=>{let r=new Set(n.folded),i=new Set(n.opened);return t?(r.delete(e),i.add(e)):(i.delete(e),r.add(e)),rM($j,r),rM(eM,i),{folded:r,opened:i}})}}var oM=[`sidebar.nav`,`sidebar.goto`,`sidebar.select`,`sidebar.tree.open`,`sidebar.rename`,`sidebar.pin`,`sidebar.localMerge`,`sidebar.delete`,`sidebar.sort`,`sidebar.search.enter`,`tasks.renameBranch`,`tasks.cycleEngine`,`tasks.openWorktree`,`tasks.update`,`tasks.focusEngine`,`task.new`,`settings.open.sidebar`,`worktrees.open.sidebar`];function sM(e){for(let t of e)for(let e of oM){let n=va(e).indexOf(t);if(n>=0)return{id:e,slot:n}}return null}function cM(e,t){let n=e.selection.get().taskId===t;e.select(t),pe(),n&&!fv(e.client)&&yo()}function lM(e,t,n,r){let{search:i,setSearch:a}=n,[o,s]=(0,h.useState)(null),c=(0,h.useRef)(0),l=t.filter(e=>e.kind!==`project`&&e.kind!==`state`),u=l.findIndex(e=>e.id===o);(0,h.useEffect)(()=>{u<0&&s(r.selectedId&&l.some(e=>e.id===r.selectedId)?r.selectedId:l[0]?.id??null)},[u,l,r.selectedId]);let d=l[u],f=d?.kind===`task`||d?.kind===`pane`?d.task.id:null;(0,h.useEffect)(()=>Fy.set(f),[f]);let p=l[0]?.id??null;(0,h.useEffect)(()=>{i.query,i.active&&s(p)},[i.active,i.query,p]);let m=e=>{let t=l[Math.max(0,Math.min(l.length-1,e))];t&&s(t.id)},g=t=>{t?.kind===`task`&&e.select(t.task.id),t?.kind===`round`&&ge(t.groupId),t?.kind===`pane`&&Rj(e,t),t&&pe()},_=(t,n)=>{t?.kind===`task`&&x(Zj(e,t.task,null),n)?.run?.()},v=async t=>{if(t?.kind===`task`&&t.machine===void 0)try{let{engines:n}=await e.client.request(`engines.list`),r=Tu(n).filter(e=>e.ready!==!1),i=r[(r.findIndex(e=>e.id===t.task.engine?.id)+1)%r.length];if(!i||i.id===t.task.engine?.id)return;await e.client.request(`task.setCommand`,{taskId:t.task.id,engine:i.id}),I(z(`rail.engineSwitched`,{engine:i.name}))}catch(e){I(z(`rail.engineSwitchFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)}};return{cursor:o,setCursor:s,onKeyDown:t=>{let o=l[u],s=t.target instanceof HTMLInputElement;if(i.active){if(t.metaKey||t.ctrlKey||t.altKey)return;if(t.key===`Escape`)a({active:!1,query:``});else if(t.key===`Enter`)g(o),a({active:!1,query:``});else if(t.key===`ArrowDown`)m(u+1);else if(t.key===`ArrowUp`)m(u-1);else if(t.key===`Backspace`&&!s)a(e=>({...e,query:e.query.slice(0,-1)}));else if(t.key.length===1&&!s)a(e=>({...e,query:e.query+t.key}));else return;t.preventDefault();return}let d=sM(qc(t));if(Mp.get()){let n=o?.kind===`task`&&o.machine===void 0;if(d?.id===`sidebar.nav`)n&&Fp(e,o,d.slot%2==0?1:-1);else if(d?.id===`sidebar.localMerge`||t.key===`Enter`||t.key===`Escape`)Pp(!1);else return;t.preventDefault();return}switch(d?.id){case`sidebar.nav`:m(d.slot%2==0?u+1:u-1);break;case`sidebar.goto`:d.slot%2==1?m(l.length-1):Date.now()-c.current<tM?(m(0),c.current=0):c.current=Date.now();break;case`sidebar.select`:case`sidebar.tree.open`:g(o);break;case`tasks.focusEngine`:yo();break;case`sidebar.rename`:case`sidebar.pin`:case`sidebar.delete`:case`tasks.renameBranch`:case`tasks.openWorktree`:_(o,d.id);break;case`tasks.cycleEngine`:v(o);break;case`sidebar.localMerge`:o?.machine===void 0&&Pp(!0);break;case`sidebar.sort`:n.cycleSort(),I(G(`tasks`,`sort.label`,{mode:G(`tasks`,`sort.modes.${Op.get()}`)}));break;case`sidebar.search.enter`:a({active:!0,query:``});break;case`task.new`:r.onNewTask(o?.kind===`task`||o?.kind===`pane`?o.task.repo:void 0,o?.machine);break;case`settings.open.sidebar`:r.onSettings();break;case`worktrees.open.sidebar`:he(`worktrees`);break;case`tasks.update`:he(`update`);break;default:return}t.preventDefault()},onPress:e=>{let t=e.target.closest(`[data-row]`)?.dataset.row;t&&s(t)}}}var uM=192,dM=`rove.web.railWidth`,fM=`rove.web.railFolded`;function pM(){let e=Number(localStorage.getItem(dM));return Number.isFinite(e)&&e>0?e:null}var mM=v(pM());mM.subscribe(()=>{let e=mM.get();e===null?localStorage.removeItem(dM):localStorage.setItem(dM,String(Math.round(e)))}),mM.subscribe(le);var hM=v(localStorage.getItem(fM)===`1`);hM.subscribe(()=>localStorage.setItem(fM,hM.get()?`1`:`0`));var gM=v(!1),_M=null,vM=!1;function yM(e){_M!==null&&window.clearTimeout(_M),_M=null,vM=e,e?gM.set(!0):_M=window.setTimeout(()=>S.get()===null&&gM.set(!1),250)}S.subscribe(()=>{S.get()===null&&gM.get()&&!vM&&yM(!1)}),hM.subscribe(()=>gM.set(!1)),hM.subscribe(le);function bM(e,t=window.innerWidth){let n=Math.max(uM,t-320);return Math.max(uM,Math.min(n,Math.round(e)))}var xM=(e,t,n)=>`~pane:${e}:${t}:${n}`;function SM(e,t){return e.flatMap(e=>e.kind===`task`?[e,...(t[e.task.id]??[]).flatMap(t=>{let n=t.split;if(!n||!Bd(n))return[];let r=Ud(n,Ld(t));return zd(n.root).map(n=>({id:xM(e.task.id,t.id,n.id),kind:`pane`,task:e.task,tab:t,leaf:n.id,label:r.get(n.id)??n.id,depth:e.depth+1,...e.machine===void 0?{}:{machine:e.machine}}))})]:[e])}function CM(e){let{row:t}=e;return(0,V.jsxs)(`button`,{type:`button`,className:`${pi({size:`pane`})} ${e.cursor?Mm:``}`,title:z(`compare.menu`),onClick:()=>{e.onClick(),ge(t.groupId)},...e.place,children:[e.guides&&(0,V.jsx)(`span`,{className:`-my-0.75 -mr-0.5 ml-0 flex flex-none self-stretch`,"aria-hidden":`true`,children:e.guides.map((e,t)=>(0,V.jsx)(`span`,{className:Sm(e)},t))}),(0,V.jsx)(`span`,{className:`${mi} text-(length:--fs-meta) text-muted`,children:t.title}),(0,V.jsxs)(`span`,{className:`${yi} ml-auto items-center`,children:[e.repo&&(0,V.jsx)(`span`,{className:`max-w-24 truncate text-subtle`,children:e.repo}),(0,V.jsx)(`span`,{className:`text-subtle`,children:t.tasks.length}),(0,V.jsx)(Ph,{status:Sh(t.tasks)})]})]})}function wM(e){let t=(0,h.useRef)(null);return(0,h.useEffect)(()=>{let e=t.current;return()=>{e&&document.activeElement===e&&e.closest(`nav`)?.focus()}},[]),(0,V.jsxs)(`div`,{className:`${km} mono items-center`,children:[(0,V.jsx)(`span`,{className:`text-accent`,children:`/`}),(0,V.jsx)(`input`,{ref:t,className:Am,type:`text`,autoFocus:!0,spellCheck:!1,autoComplete:`off`,autoCapitalize:`off`,enterKeyHint:`go`,value:e.query,placeholder:z(`rail.searchPlaceholder`),"aria-label":z(`rail.searchPlaceholder`),onChange:t=>e.onChange(t.target.value)}),e.query&&(0,V.jsx)(`span`,{className:`ml-1.5 text-muted`,children:e.count})]})}var TM=Math.min,EM=Math.max,DM=Math.round,OM=Math.floor,kM=e=>({x:e,y:e}),AM={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function jM(e,t,n){return EM(e,TM(t,n))}function MM(e,t){return typeof e==`function`?e(t):e}function NM(e){return e.split(`-`)[0]}function PM(e){return e.split(`-`)[1]}function FM(e){return e===`x`?`y`:`x`}function IM(e){return e===`y`?`height`:`width`}function LM(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function RM(e){return FM(LM(e))}function zM(e,t,n){n===void 0&&(n=!1);let r=PM(e),i=RM(e),a=IM(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=JM(o)),[o,JM(o)]}function BM(e){let t=JM(e);return[VM(e),t,VM(t)]}function VM(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var HM=[`left`,`right`],UM=[`right`,`left`],WM=[`top`,`bottom`],GM=[`bottom`,`top`];function KM(e,t,n){switch(e){case`top`:case`bottom`:return n?t?UM:HM:t?HM:UM;case`left`:case`right`:return t?WM:GM;default:return[]}}function qM(e,t,n,r){let i=PM(e),a=KM(NM(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(VM)))),a}function JM(e){let t=NM(e);return AM[t]+e.slice(t.length)}function YM(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function XM(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:YM(e)}function ZM(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function QM(e,t,n){let{reference:r,floating:i}=e,a=LM(t),o=RM(t),s=IM(o),c=NM(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=PM(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function $M(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=MM(t,e),p=XM(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=ZM(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=ZM(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var eN=50,tN=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:$M},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=QM(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<eN&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=QM(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},nN=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=MM(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=NM(r),_=LM(o),v=NM(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[JM(o)]:BM(o)),x=p!==`none`;!d&&x&&b.push(...qM(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=zM(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===LM(t)||T.every(e=>LM(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=LM(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}},rN=new Set([`left`,`top`]);async function iN(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=NM(n),s=PM(n),c=LM(n)===`y`,l=rN.has(o)?-1:1,u=a&&c?-1:1,d=MM(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var aN=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await iN(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},oN=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=MM(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=LM(i),p=FM(f),m=u[p],h=u[f],g=(e,t)=>jM(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}};function sN(){return typeof window<`u`}function cN(e){return dN(e)?(e.nodeName||``).toLowerCase():`#document`}function lN(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function uN(e){return((dN(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function dN(e){return sN()?e instanceof Node||e instanceof lN(e).Node:!1}function fN(e){return sN()?e instanceof Element||e instanceof lN(e).Element:!1}function pN(e){return sN()?e instanceof HTMLElement||e instanceof lN(e).HTMLElement:!1}function mN(e){return!sN()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof lN(e).ShadowRoot}function hN(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=EN(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function gN(e){return/^(table|td|th)$/.test(cN(e))}function _N(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var vN=/transform|translate|scale|rotate|perspective|filter/,yN=/paint|layout|strict|content/,bN=e=>!!e&&e!==`none`,xN;function SN(e){let t=fN(e)?EN(e):e;return bN(t.transform)||bN(t.translate)||bN(t.scale)||bN(t.rotate)||bN(t.perspective)||!wN()&&(bN(t.backdropFilter)||bN(t.filter))||vN.test(t.willChange||``)||yN.test(t.contain||``)}function CN(e){let t=ON(e);for(;pN(t)&&!TN(t);){if(SN(t))return t;if(_N(t))return null;t=ON(t)}return null}function wN(){return xN??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),xN}function TN(e){return/^(html|body|#document)$/.test(cN(e))}function EN(e){return lN(e).getComputedStyle(e)}function DN(e){return fN(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ON(e){if(cN(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||mN(e)&&e.host||uN(e);return mN(t)?t.host:t}function kN(e){let t=ON(e);return TN(t)?(e.ownerDocument||e).body:pN(t)&&hN(t)?t:kN(t)}function AN(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=kN(e),i=r===e.ownerDocument?.body,a=lN(r);if(i){let e=jN(a);return t.concat(a,a.visualViewport||[],hN(r)?r:[],e&&n?AN(e):[])}return t.concat(r,AN(r,[],n))}function jN(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function MN(e){let t=EN(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=pN(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=DM(n)!==a||DM(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function NN(e){return fN(e)?e:e.contextElement}function PN(e){let t=NN(e);if(!pN(t))return kM(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=MN(t),o=(a?DM(n.width):n.width)/r,s=(a?DM(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var FN=kM(0);function IN(e){let t=lN(e);return!wN()||!t.visualViewport?FN:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function LN(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===lN(e)}function RN(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=NN(e),o=kM(1);t&&(r?fN(r)&&(o=PN(r)):o=PN(e));let s=LN(a,n,r)?IN(a):kM(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=lN(a),t=fN(r)?lN(r):r,n=e,i=jN(n);for(;i&&t!==n;){let e=PN(i),t=i.getBoundingClientRect(),r=EN(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=lN(i),i=jN(n)}}return ZM({width:u,height:d,x:c,y:l})}function zN(e,t){let n=DN(e).scrollLeft;return t?t.left+n:RN(uN(e)).left+n}function BN(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-zN(e,n),y:n.top+t.scrollTop}}function VN(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=uN(r),s=t?_N(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=kM(1),u=kM(0),d=pN(r);if((d||!a)&&((cN(r)!==`body`||hN(o))&&(c=DN(r)),d)){let e=RN(r);l=PN(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?BN(o,c):kM(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function HN(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function UN(e){let t=DN(e),n=e.ownerDocument.body,r=EM(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=EM(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+zN(e),o=-t.scrollTop;return EN(n).direction===`rtl`&&(a+=EM(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var WN=25;function GN(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=lN(e),a=uN(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!wN()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(zN(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=WN&&(s-=o)}return{width:s,height:c,x:l,y:u}}function KN(e,t){let n=RN(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=PN(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function qN(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=GN(e,n,t);else if(t===`document`)r=UN(uN(e));else if(fN(t))r=KN(t,n);else{let n=IN(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return ZM(r)}function JN(e,t){let n=t.get(e);if(n)return n;let r=AN(e,[],!1).filter(e=>fN(e)&&cN(e)!==`body`),i=null,a=EN(e).position===`fixed`,o=a?ON(e):e;for(;fN(o)&&!TN(o);){let e=EN(o),t=SN(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=ON(o)}return t.set(e,r),r}function YN(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?_N(t)?[]:JN(t,this._c):[].concat(n),r],o=qN(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=qN(t,a[e],i);s=EM(n.top,s),c=TM(n.right,c),l=TM(n.bottom,l),u=EM(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function XN(e){let{width:t,height:n}=MN(e);return{width:t,height:n}}function ZN(e,t,n){let r=pN(t),i=uN(t),a=n===`fixed`,o=RN(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=kM(0);if((r||!a)&&((cN(t)!==`body`||hN(i))&&(s=DN(t)),r)){let e=RN(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=zN(i));let l=i&&!r&&!a?BN(i,s):kM(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function QN(e){return EN(e).position===`static`}function $N(e,t){if(!pN(e)||EN(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return uN(e)===n&&(n=n.ownerDocument.body),n}function eP(e,t){let n=lN(e);if(_N(e))return n;if(!pN(e)){let t=ON(e);for(;t&&!TN(t);){if(fN(t)&&!QN(t))return t;t=ON(t)}return n}let r=$N(e,t);for(;r&&gN(r)&&QN(r);)r=$N(r,t);return r&&TN(r)&&QN(r)&&!SN(r)?n:r||CN(e)||n}var tP=async function(e){let t=this.getOffsetParent||eP,n=this.getDimensions,r=await n(e.floating);return{reference:ZN(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function nP(e){return EN(e).direction===`rtl`}var rP={convertOffsetParentRelativeRectToViewportRelativeRect:VN,getDocumentElement:uN,getClippingRect:YN,getOffsetParent:eP,getElementRects:tP,getClientRects:HN,getDimensions:XN,getScale:PN,isElement:fN,isRTL:nP};function iP(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function aP(e,t,n){let r=null,i,a=uN(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=OM(d),h=OM(a.clientWidth-(u+f)),g=OM(a.clientHeight-(d+p)),_=OM(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:EM(0,TM(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!iP(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=lN(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function oP(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=NN(e),u=i||a?[...l?AN(l):[],...t?AN(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?aP(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?RN(e):null;c&&g();function g(){let t=RN(e);h&&!iP(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var sP=aN,cP=oN,lP=nN,uP=(e,t,n)=>{let r=new Map,i=n??{},a={...rP,...i.platform,_c:r};return tN(e,t,{...i,platform:a})},dP=`pointer-events-none fixed top-0 left-0 z-35 max-w-80 animate-tip-in rounded-sm border-hairline border-line bg-inset px-2.5 py-1.5 font-sans text-meta leading-[1.4] whitespace-normal wrap-anywhere text-ink shadow-popover motion-reduce:animate-none`,fP=500,pP=400,mP=`rove-tip`,hP=null,gP=null,_P=null,vP=null,yP=0,bP=!1,xP=()=>bP;function SP(){return hP?.isConnected?hP:(hP=document.createElement(`div`),hP.id=mP,hP.setAttribute(`role`,`tooltip`),hP.className=dP,hP.hidden=!0,document.body.append(hP),hP)}function CP(){vP!==null&&window.clearTimeout(vP),vP=null}function wP(e,t,n=`top`){CP(),TP();let r=SP();r.textContent=t,r.hidden=!1,gP=e,e.setAttribute(`aria-describedby`,mP),_P=oP(e,r,()=>{if(!e.isConnected)return TP();uP(e,r,{strategy:`fixed`,placement:n,middleware:[sP(6),lP(),cP({padding:8})]}).then(({x:e,y:t})=>{r.style.left=`${e}px`,r.style.top=`${t}px`})})}function TP(){CP(),gP&&(_P?.(),_P=null,gP.getAttribute(`aria-describedby`)===mP&&gP.removeAttribute(`aria-describedby`),gP=null,hP&&(hP.hidden=!0),yP=performance.now())}function EP(e){if(!(e instanceof Element))return null;let t=e.closest(`[title], [data-tip]`);if(!t||t instanceof HTMLIFrameElement)return null;let n=t.getAttribute(`title`);if(n!==null){if(t.removeAttribute(`title`),n===``)return null;t.dataset.tip=n,!t.hasAttribute(`aria-label`)&&!t.textContent?.trim()&&t.setAttribute(`aria-label`,n)}return t.dataset.tip?t:null}function DP(e){if(e===gP)return;CP();let t=gP!==null||performance.now()-yP<pP,n=()=>e.isConnected&&e.dataset.tip&&wP(e,e.dataset.tip);t?n():vP=window.setTimeout(n,fP)}var OP=!1;function kP(){OP||(OP=!0,document.addEventListener(`pointerover`,e=>{if(e.pointerType===`touch`)return;let t=EP(e.target);t?DP(t):gP&&e.target instanceof Node&&gP.contains(e.target)||TP()}),document.addEventListener(`pointerout`,e=>{let t=EP(e.target);t&&!(e.relatedTarget instanceof Node&&t.contains(e.relatedTarget))&&TP()}),document.addEventListener(`keydown`,e=>{bP=!0,e.key===`Escape`&&TP()},!0),document.addEventListener(`pointerdown`,()=>{bP=!1,TP()},!0),document.addEventListener(`focusin`,e=>{let t=bP?EP(e.target):null;t&&DP(t)}),document.addEventListener(`focusout`,e=>{e.target===gP&&TP()}),window.addEventListener(`blur`,TP))}var AP=450,jP=e=>{let t=e.querySelector(`.row-title`);return!!t&&t.scrollWidth>t.clientWidth};function MP(e,t){let n=(0,h.useRef)(null),r=(0,h.useRef)(null),i=(0,h.useRef)(e);i.current=e;let a=()=>{n.current!==null&&window.clearTimeout(n.current),n.current=null},o=e=>{a(),n.current=window.setTimeout(()=>wP(e,i.current,`right`),AP)},s=()=>{a(),TP()};return(0,h.useEffect)(()=>{let e=r.current,n=e?.closest(`.rail`);if(!t||!e||!n||!xP()||!n.contains(document.activeElement)||!jP(e))return;let i=e=>{e.relatedTarget instanceof Node&&n.contains(e.relatedTarget)||s()};return o(e),n.addEventListener(`focusout`,i),()=>{n.removeEventListener(`focusout`,i),s()}},[t]),(0,h.useEffect)(()=>()=>{n.current!==null&&window.clearTimeout(n.current)},[]),{ref:e=>{r.current=e},onPointerEnter:e=>{e.pointerType===`touch`||!jP(e.currentTarget)||o(e.currentTarget)},onPointerLeave:s,hide:s}}function NP({at:e}){let t=new Date(e);if(Number.isNaN(t.getTime()))return null;let n=vg(t);return(0,V.jsxs)(`span`,{className:`text-subtle`,title:z(`rail.startsAt`,{time:t.toLocaleString()}),children:[`◷ `,n]})}var PP=2e4;function FP(e,t){let n=yp().prefs.statusMarkNoticeSeen===!1,r=NS();(0,h.useEffect)(()=>{!n||t===void 0||(_p(e.client,`statusMarkNoticeSeen`,!0),t!==0&&r!==`dots`&&I(z(`rail.markNotice`),`info`,{label:z(`rail.markNoticeUndo`),run:()=>PS(e.client,`dots`)},PP))},[e,n,t,r])}var IP=150,LP=128,RP=0,zP=2,BP=[{reach:.96,grow:1.5,pulse:.9,done:104},{reach:.72,grow:1.1,pulse:1.2,done:84},{reach:1,grow:1.7,pulse:.7,done:116},{reach:.84,grow:1.3,pulse:1,done:96},{reach:.62,grow:1.2,pulse:1.3,done:80}],VP=`/-\\|`,HP=6,UP=(e,t,n,r)=>{let i=e[n];i&&t>=0&&t<i.length&&(i[t]=r)};function WP(e,t){let n=Math.min(64,Math.max(24,Math.floor(t))),r=(Math.floor(e)%IP+IP)%IP,i=Array.from({length:11},()=>Array(n).fill(` `)),a=Array.from({length:11},()=>Array(n).fill(` `));UP(a,RP,0,`o`);let o=zP+2*(BP.length-1),s=Math.min(o,Math.floor(r/2));for(let e=1;e<=s;e++)UP(i,RP,e,`|`);if(BP.forEach((e,t)=>{let o=zP+2*t,s=2*o;if(r<s)return;UP(i,RP,o,`+`);let c=n-1-1,l=1+Math.max(1,Math.floor(c*e.reach)),u=Math.min(l,1+Math.floor((r-s)*e.grow)),d=r>=e.done&&u===l;for(let t=1;t<u;t++)!d&&((t-Math.floor(r*e.pulse))%HP+HP)%HP===0?UP(a,t,o,`=`):UP(i,t,o,`-`);d?UP(a,u,o,`o`):u<l?UP(a,u,o,`>`):UP(a,u,o,VP[(Math.floor(r/2)+t)%4]??`-`)}),r>=LP){let e=Math.ceil((r-LP+1)/22*(n+1));for(let t of[i,a])for(let r of t)r.fill(` `,0,Math.min(n,e))}return{base:i.map(e=>e.join(``)).join(`
|
|
60
|
+
`)}`},e.label))]})}var Yk=30;function Xk(e,t,n){let r=t.join(`\0`),[i,a]=(0,h.useState)(()=>Object.fromEntries(t.map(t=>[t,Y(e,`routine.runs`,{id:t})?.runs??[]])));return(0,h.useEffect)(()=>{let n=!0;for(let r of t)Gu(e,`routine.runs`,{id:r}).then(e=>n&&a(t=>({...t,[r]:e.runs}))).catch(()=>void 0);return()=>{n=!1}},[e,r,n]),i}function Zk(e){B();let{auto:t}=fE(),[n,r]=(0,h.useState)(null),i=Rk(e.runs,n),a=e=>{if(e.status===`skipped_blocked`){let t=e.blocked?.reason;return t?$(z(`runLog.blockedRun`),{reason:z(`runLog.blocked.${t}`)}):z(`runLog.outcome.blocked`)}return t.runStatus[e.status]??e.status},o=(e,t,n,r)=>(0,V.jsx)(H,{variant:`pill`,hit:`tight`,"aria-current":t,className:`max-w-40 truncate`,onClick:n,children:`[ ${e} ]`},r);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`h2`,{className:`${U} text-muted`,children:z(`runLog.title`)}),(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1`,children:[o(z(`runLog.all`),n===null,()=>r(null),`all`),Nk.map(e=>o(z(`runLog.outcome.${e}`),n===e,()=>r(e),e))]}),i.length===0?(0,V.jsx)(`p`,{className:`text-muted`,children:e.runs.length===0?t.noRuns:z(`runLog.empty`)}):i.slice(0,Yk).map(n=>{let r=Kk(n.status),i=vO(n,e.now),o=i===`awaiting`?`, ${t.responseAwaiting}`:i===`missing`?`, ${t.responseMissing}`:``,s=Ik(n),c=(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{children:Gk[r]}),(0,V.jsx)(`span`,{children:`#${n.runNumber}`}),(0,V.jsx)(`span`,{className:bk,children:`${a(n)}${n.tabId?`, ${n.tabId}`:``}${o}`}),(0,V.jsx)(`span`,{className:`text-subtle`,children:z(`runLog.source.${Fk[n.trigger]}`)}),s!==null&&(0,V.jsx)(`span`,{className:`text-muted`,children:Lk(s)}),(0,V.jsx)(`span`,{className:`text-muted`,children:e.when(n.at)})]}),l=n.error?Vk(n.error):null,u=n.taskId,d=i===`missing`?`text-warning`:Wk[r];return(0,V.jsxs)(`div`,{className:`${gk} ${d}`,children:[u?(0,V.jsx)(`button`,{type:`button`,className:`mono ${yk}`,onClick:()=>e.openRun(u),children:c}):(0,V.jsx)(`span`,{className:`mono ${vk}`,children:c}),l&&(0,V.jsxs)(`details`,{className:`mono pl-[calc(2ch+16px)] [&_summary]:cursor-pointer [&_summary]:list-none [&_summary]:truncate [&_summary::-webkit-details-marker]:hidden [&[open]_summary]:whitespace-normal [&_pre]:mx-0 [&_pre]:mt-1 [&_pre]:mb-1.5 [&_pre]:max-h-[16lh] [&_pre]:overflow-auto [&_pre]:rounded-sm [&_pre]:bg-inset [&_pre]:px-2 [&_pre]:py-1.5 [&_pre]:whitespace-pre-wrap [&_pre]:wrap-anywhere [&_pre]:text-muted`,children:[(0,V.jsx)(`summary`,{children:l.summary}),(0,V.jsx)(`pre`,{children:l.full})]})]},n.id)}),i.length>Yk&&(0,V.jsx)(`p`,{className:`text-muted`,children:z(`runLog.more`,{count:i.length-Yk})})]})}function Qk(e){let{auto:t}=fE(),n=pE(),r=B()===`zh`?`zh-CN`:`en-US`,{routine:i,busy:a,when:o}=e,s=YO(i.schedule,n),c=i.nextRunAt?Date.parse(i.nextRunAt):NaN;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:fk,children:[(0,V.jsx)(`h2`,{className:pk,children:i.name}),(0,V.jsxs)(`span`,{className:`mono ${Ox}`,children:[(0,V.jsx)(`button`,{type:`button`,className:`${kr} ${kx.row}`,disabled:a,onClick:e.onRunNow,children:t.runNow}),(0,V.jsx)(`button`,{type:`button`,className:`${kr} ${kx.row}`,disabled:a,onClick:e.onToggle,children:z(i.enabled?`pages.routinePause`:`pages.routineEnable`)}),(0,V.jsx)(`button`,{type:`button`,className:`${kr} ${kx.row}`,disabled:a,onClick:e.onDelete,children:z(`pages.delete`)})]})]}),(0,V.jsxs)(`dl`,{className:mk,children:[(0,V.jsx)(`dt`,{className:`text-muted`,children:z(`pages.routineSchedule`)}),(0,V.jsxs)(`dd`,{children:[s??(0,V.jsx)(`span`,{className:`mono`,children:i.schedule}),s&&(0,V.jsx)(`span`,{className:`mono text-muted`,children:` ${i.schedule}`})]}),(0,V.jsx)(`dt`,{className:`text-muted`,children:z(`pages.routineNext`)}),(0,V.jsx)(`dd`,{className:i.enabled?``:`text-warning`,children:i.enabled?Number.isFinite(c)?`${o(i.nextRunAt)} · ${new Date(c).toLocaleString(r,{weekday:`short`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}`:`—`:t.paused}),(0,V.jsx)(`dt`,{className:`text-muted`,children:z(`pages.routineProject`)}),(0,V.jsx)(`dd`,{children:e.project}),!i.script&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`dt`,{className:`text-muted`,children:z(`pages.routineDelivers`)}),(0,V.jsx)(`dd`,{children:i.target?$(t.targetExisting,{task:e.targetTitle??i.target.taskId,tab:i.target.tabId}):i.persistentSession?i.newConversation?t.targetStandingNew:t.targetStanding:t.targetFresh})]}),e.engine&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`dt`,{className:`text-muted`,children:z(`pages.routineEngine`)}),(0,V.jsxs)(`dd`,{className:`flex flex-wrap items-baseline gap-x-3.5`,children:[(0,V.jsx)(`span`,{children:e.engine}),(0,V.jsx)(H,{className:`font-mono`,hit:`tight`,disabled:a,onClick:e.onChangeEngine,children:z(`pages.routineChangeEngine`)})]})]})]}),i.precheck&&(0,V.jsx)(`p`,{className:`mono text-muted`,children:$(t.precheck,{command:i.precheck.command})}),i.script?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`h2`,{className:`${U} text-muted`,children:z(`pages.routineScript`)}),(0,V.jsx)(`p`,{className:`mono ${hk}`,children:i.script.command})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`h2`,{className:`${U} text-muted`,children:z(`pages.routinePrompt`)}),(0,V.jsx)(`p`,{className:hk,children:i.prompt})]}),(0,V.jsx)(Zk,{runs:e.runs,now:e.now,when:o,openRun:e.openRun}),(0,V.jsx)(qk,{runs:e.runs,when:o})]})}var $k=5e3;function eA({model:e}){let{auto:t,common:n}=fE(),r=e.client,[i,a]=bE($k),o=y(e.tasks),s=vE(e),c=yE(e),[l,u]=(0,h.useState)(()=>Y(r,`routine.list`)??null),[d,f]=(0,h.useState)(null),[p,m]=(0,h.useState)(null),[g,_]=(0,h.useState)(null),v=CE(),b=pE(),x=(0,h.useRef)(null);(0,h.useEffect)(()=>{let e=!0;return Gu(r,`routine.list`).then(t=>e&&u(t)).catch(()=>e&&u(e=>e??{automations:[],keepsDaemonAlive:!1})),()=>{e=!1}},[r,i]);let[S,w]=(0,h.useState)(()=>Y(r,`engines.list`)?.engines??[]);(0,h.useEffect)(()=>{let e=!0;return Gu(r,`engines.list`).then(t=>e&&w(t.engines)).catch(()=>{}),()=>{e=!1}},[r]);let T=l?.automations??[],E=l?.lastRunStatus??{},D=l?.lastFailure??{},A=e=>{let t=E[e.id];return t!==void 0&&_O(t)},ee=[{key:`pages.routinesNeedYou`,rows:T.filter(A)},{key:`pages.routinesActive`,rows:T.filter(e=>e.enabled&&!A(e))},{key:`pages.routinesPaused`,rows:T.filter(e=>!e.enabled&&!A(e))}],j=ee.flatMap(e=>e.rows),te=Math.max(0,j.findIndex(e=>e.id===d)),M=j[te],N=e=>f(j[e]?.id??null),P=ee[0]?.rows.length??0,F=y(k);(0,h.useEffect)(()=>{F===null||!l||(l.automations.some(e=>e.id===F)&&f(F),k.set(null))},[F,l]);let ne=Xk(r,M?[M.id]:[],i),re=M?ne[M.id]??[]:[];(0,h.useEffect)(()=>_(null),[M?.id]);let ie=(0,h.useRef)(null),[ae,L]=(0,h.useState)(0),oe=(0,h.useRef)(0);(0,h.useEffect)(()=>{let e=x.current,t=ae!==oe.current;if(oe.current=ae,t&&e&&ie.current&&e.offsetTop>ie.current.offsetTop){e.scrollIntoView({block:`start`,behavior:`smooth`});return}ie.current?.querySelector(`[data-row="${te}"]`)?.scrollIntoView({block:`nearest`})},[te,ae]);let R=Date.now(),se=e=>{let n=e?Date.parse(e):NaN;if(!Number.isFinite(n))return`—`;let r=n-R,i=r>=0,a=Math.floor(Math.abs(r)/6e4),o=Math.floor(a/60);return a<1?i?t.when.now:t.when.justNow:a<60?$(i?t.when.inMinutes:t.when.minutesAgo,{n:a}):o<24?$(i?t.when.inHours:t.when.hoursAgo,{n:o}):new Date(n).toLocaleDateString()},ce=e=>o?.tasks.find(t=>t.id===e)?.label??e,le=t=>{O.set(null),e.select(t)},ue=(e,t,n)=>I($(e,{name:t,error:mE(n)}),`error`),de=async()=>{if(!(!M||p)){m(M.id);try{await r.request(`routine.setEnabled`,{id:M.id,enabled:!M.enabled}),a()}catch(e){ue(M.enabled?t.disableFailed:t.enableFailed,M.name,e)}finally{m(null)}}},fe=async()=>{if(!(!M||p)){m(M.id),_($(t.running,{name:M.name}));try{let e=await r.request(`routine.runNow`,{id:M.id});_($(t.ranWith,{name:M.name,status:e.status})),a()}catch(e){ue(t.runFailed,M.name,e)}finally{m(null)}}},pe=async()=>{if(p)return;let e=_E(await r.request(`repos.list`).then(e=>e.repos).catch(()=>[]),s);C.set((0,V.jsx)(Mk,{repos:e,tasks:(o?.tasks??[]).filter(e=>!e.deleting).map(e=>({id:e.id,title:e.label,repo:e.repo})),defaultRepo:c,onSubmit:e=>{(async()=>{m(`new`);try{await r.request(`routine.create`,{...e.repo===null?{}:{repo:e.repo},name:e.name,prompt:e.prompt,schedule:e.schedule,...e.target?{targetTask:e.target.taskId,targetTab:e.target.tabId}:{}}),a()}catch(e){I($(t.createFailed,{error:mE(e)}),`error`)}finally{m(null)}})()}}))},me=()=>{if(!M||p)return;let e=M;C.set((0,V.jsx)(Ci,{title:t.deleteTitle,body:$(t.deleteBody,{name:e.name}),confirmLabel:t.deleteButton,onConfirm:async()=>{m(e.id);try{await r.request(`routine.delete`,{id:e.id}),a()}catch(n){ue(t.deleteFailed,e.name,n)}finally{m(null)}}}))};SE(e=>{if(e.ctrlKey)return e.key===`c`&&(O.set(null),!0);switch(e.key){case`Escape`:case`q`:return O.set(null),!0;case`j`:case`ArrowDown`:return N(Math.min(j.length-1,te+1)),!0;case`k`:case`ArrowUp`:return N(Math.max(0,te-1)),!0;case`n`:return pe(),!0;case`r`:return a(),!0;case`e`:return de(),!0;case`s`:return fe(),!0;case`d`:return me(),!0;case`Enter`:{let e=re[0]?.taskId;return e?le(e):re.length>0&&_(t.latestRunNoTask),!0}default:return!1}});let he=e=>gO(e,e=>S.find(t=>t.id===e)?.name??e,t.engineDefault),ge=()=>{if(!M)return;let n=M;C.set((0,V.jsx)(tk,{model:e,current:async()=>({engine:n.vendor,effort:n.modelEffort,model:n.model}),onSet:async e=>{let i=await r.request(`routine.setEngine`,{id:n.id,engine:e.engine.id,model:e.model??``,effort:e.effort??``});_($(i.releasedSessionTaskId?t.engineChangedNewSession:t.engineChanged,{name:n.name,engine:[e.engine.name,e.model,e.effort].filter(Boolean).join(` · `)})),a()}}))},_e=e=>e===void 0?z(`rail.noProject`):gE(e,T.flatMap(e=>e.repo??[]));return(0,V.jsxs)(`div`,{className:`${Cx} ${nk}`,tabIndex:0,ref:v,children:[(0,V.jsxs)(`div`,{className:Ex,children:[(0,V.jsx)(`h1`,{className:Tx,children:t.title}),(0,V.jsxs)(`span`,{className:`mono ${Ox}`,children:[P>0&&(0,V.jsx)(`span`,{className:`text-error`,children:$(t.needAttention,{count:String(P),total:String(j.length)})}),(0,V.jsx)(`span`,{className:`text-muted`,children:l?.keepsDaemonAlive?t.holdingDaemon:t.notHolding}),(0,V.jsx)(`button`,{type:`button`,className:`${kr} ${kx.header}`,onClick:()=>void pe(),children:z(`pages.new`)})]})]}),(0,V.jsx)(Ok,{client:r,tick:i,reload:a}),l===null?(0,V.jsx)(`p`,{className:`text-muted`,children:n.loading}):j.length===0?(0,V.jsxs)(`div`,{className:Ax,children:[(0,V.jsx)(`p`,{className:`text-muted`,children:t.empty}),(0,V.jsx)(`p`,{className:`keys-only`,children:t.emptyHint})]}):(0,V.jsxs)(`div`,{className:rk,children:[(0,V.jsx)(`div`,{className:ik,ref:ie,children:ee.map(e=>e.rows.length===0?null:(0,V.jsxs)(`section`,{children:[(0,V.jsxs)(`h2`,{className:`${U} ${ak} ${e===ee[0]?`text-error`:`text-muted`}`,children:[z(e.key),` `,(0,V.jsx)(`span`,{className:`mono`,children:e.rows.length})]}),e.rows.map(e=>{let n=j.indexOf(e),r=E[e.id],i=r?Kk(r):null;return(0,V.jsxs)(`div`,{"data-row":n,className:ok(n===te),onClick:()=>{N(n),L(e=>e+1)},children:[(0,V.jsxs)(`span`,{className:sk,children:[(0,V.jsx)(`span`,{className:ck(!e.enabled),children:e.name}),(0,V.jsx)(`span`,{className:`mono text-muted ${lk}`,children:e.enabled?se(e.nextRunAt):t.paused}),(0,V.jsx)(`span`,{className:`mono ${i?Wk[i]:`text-muted`}`,style:{width:`1ch`},children:i?Gk[i]:` `})]}),(0,V.jsx)(`span`,{className:`mono text-muted ${uk}`,title:e.schedule,children:[_e(e.repo),YO(e.schedule,b)??e.schedule,he(e)?.short].filter(Boolean).join(` · `)}),D[e.id]?(0,V.jsx)(`span`,{className:`mono text-warning ${uk}`,title:D[e.id]?.reason,children:$(t.lastFailed,{when:se(D[e.id]?.at),reason:D[e.id]?.reason??``})}):null]},e.id)})]},e.key))}),(0,V.jsx)(`div`,{className:dk,ref:x,children:M?(0,V.jsx)(Qk,{routine:M,runs:re,busy:p===M.id,project:_e(M.repo),engine:he(M)?.full??null,targetTitle:M.target?ce(M.target.taskId):void 0,now:R,when:se,openRun:le,onRunNow:()=>void fe(),onToggle:()=>void de(),onDelete:me,onChangeEngine:ge}):(0,V.jsx)(`p`,{className:`text-muted`,children:t.noSelection})})]}),g&&(0,V.jsx)(`p`,{className:`text-muted mx-0 mt-2 mb-0 text-meta leading-[inherit]`,children:g})]})}function tA({active:e=!1,onSelect:t,plus:n=!1,children:r}){return(0,V.jsxs)(`button`,{type:`button`,className:`rail-nav-row ${zx(e)}`,"aria-current":e?`page`:void 0,onClick:t,children:[r,n?(0,V.jsx)(`span`,{className:Bx,"aria-hidden":`true`,children:`+`}):null]})}var nA=`mx-auto flex max-w-[76rem] flex-col font-mono text-meta leading-[1.5]`,rA=`flex items-end justify-between gap-[4ch]`,iA=`m-0 text-title font-bold tracking-[0.02em]`,aA=`font-bold tracking-code uppercase`,oA=`text-muted`,sA=`text-subtle`,cA=`my-4 border-t-hairline border-dashed! border-line-active`,lA=`m-0 mb-1.5 text-meta text-muted ${aA}`,uA=`${lA} flex flex-wrap items-baseline justify-between gap-x-[4ch]`,dA=`flex flex-wrap items-start gap-x-[8ch] gap-y-4`,fA=`min-w-[min(100%,36ch)] flex-1`,pA=`text-[3.5rem] leading-none font-bold tracking-[-0.03em]`,mA=`grid grid-cols-[repeat(auto-fit,minmax(min(100%,34ch),1fr))] items-start gap-x-[6ch] gap-y-5`,hA=`flex min-w-0 items-baseline gap-[1ch] whitespace-nowrap`,gA=`min-w-0 truncate`,_A=`min-w-[2ch] flex-1 -translate-y-0.75 border-b-hairline border-dotted! border-line-active`,vA=`pl-[2ch] text-subtle`,yA=`-mx-[1ch] block rounded-sm px-[1ch] py-0.5 text-left`,bA=`${yA} w-[calc(100%+2ch)] cursor-pointer hover:bg-hover focus-visible:outline-1 focus-visible:-outline-offset-1 focus-visible:outline-focus`,xA=`grid grid-cols-[6ch_minmax(0,1fr)_5ch_5ch_8ch] items-center gap-x-[2ch] py-0.5 whitespace-nowrap`,SA=[`bg-accent`,`bg-info`,`bg-merged`,`bg-subtle`],CA=`grid grid-cols-[minmax(0,1fr)_minmax(8ch,14ch)_5ch] items-center gap-x-[1ch] whitespace-nowrap`,wA=`relative h-2.5 border-hairline border-current after:absolute after:inset-y-0 after:left-0 after:w-(--fill) after:bg-current after:content-['']`,TA={ok:`${wA} text-success`,warn:`${wA} text-warning`,crit:`${wA} text-error`},EA=`flex h-9 flex-none items-stretch text-ink`,DA=`flex-none bg-current`,OA=`flex flex-wrap items-baseline justify-between gap-x-[4ch] gap-y-1 text-subtle`,kA={turns:0,tokens:0,ms:0},AA=e=>(e.usage?.input_tokens??0)+(e.usage?.output_tokens??0),jA=e=>Math.max(0,e.endedAt-e.startedAt),MA=(e,t)=>({turns:e.turns+1,tokens:e.tokens+AA(t),ms:e.ms+jA(t)});function NA(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function PA(e,t,n,r){let i=[];for(let e=n-1;e>=0;e--){let n=new Date(t);n.setDate(n.getDate()-e),i.push(NA(n.getTime()))}let a=new Map(i.map(e=>[e,{sum:kA,byEngine:{}}]));for(let t of e){let e=a.get(NA(t.startedAt));if(!e)continue;let n=t.vendor??`unknown`;e.sum=MA(e.sum,t),e.byEngine[n]=(e.byEngine[n]??0)+AA(t)}let o=e.reduce((e,t)=>Math.min(e,t.startedAt),1/0),s=e.length>=r&&Number.isFinite(o)?{count:e.length,day:NA(o)}:null;return{cutoff:s,days:i.map(e=>{let t=a.get(e);return{day:e,...t?.sum??kA,byEngine:t?.byEngine??{},partial:s!==null&&e<=s.day}})}}function FA(e){let t=new Map;for(let n of e){let e=n.vendor??`unknown`,r=n.model??`unknown`,i=`${e}\0${r}`;t.set(i,{engine:e,model:r,...MA(t.get(i)??kA,n)})}return[...t.values()].sort((e,t)=>t.tokens-e.tokens||t.turns-e.turns)}function IA(e,t){let n=new Map;for(let t of e)n.set(t.taskId,{taskId:t.taskId,...MA(n.get(t.taskId)??kA,t)});return[...n.values()].sort((e,t)=>t.tokens-e.tokens||t.turns-e.turns).slice(0,t)}function LA(e){return e<1e3?String(e):e<1e6?`${(e/1e3).toFixed(+(e<1e4)).replace(/\.0$/,``)}k`:`${(e/1e6).toFixed(+(e<1e7)).replace(/\.0$/,``)}M`}var RA=.1,zA=/^(\d+)\s*(h|d)$/;function BA(e,t){let n=zA.exec(e.label.trim());if(!n||e.resetsAt===null||e.percent<=0)return null;let r=Number(n[1])*(n[2]===`d`?24:1)*36e5,i=r-(e.resetsAt-t);if(!(i>=r*RA)||i>r)return null;if(e.percent>=100)return{kind:`full`,at:t};let a=t+(100-e.percent)/e.percent*i;return a<e.resetsAt?{kind:`full`,at:a}:{kind:`lasts`}}var VA=14,HA=500,UA=3e4,WA=8;function GA(e,t,n,r){let i=Y(e,t,n),[a,o]=(0,h.useState)(i?{kind:`ready`,value:i}:{kind:`loading`}),s=JSON.stringify(n);return(0,h.useEffect)(()=>{let r=!0;return Gu(e,t,n).then(e=>r&&o({kind:`ready`,value:e})).catch(e=>r&&o(t=>t.kind===`ready`?t:{kind:`failed`,error:mE(e)})),()=>{r=!1}},[e,t,s,r]),a}var KA=()=>(0,V.jsx)(`div`,{className:cA});function qA({name:e,title:t,sum:n,sub:r,open:i}){let a=(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`span`,{className:hA,children:[(0,V.jsx)(`span`,{className:gA,title:t,children:e}),(0,V.jsx)(`span`,{className:_A}),(0,V.jsx)(`span`,{children:LA(n.tokens)})]}),(0,V.jsx)(`span`,{className:`block truncate ${vA}`,children:[r,`${n.turns}t`,Lk(n.ms)].filter(Boolean).join(` · `)})]});return i?(0,V.jsx)(H,{variant:`row`,className:bA,onClick:i,children:a}):(0,V.jsx)(`div`,{className:yA,children:a})}function JA({sum:e}){let t=`${e.tokens}${e.turns}${e.ms}`.repeat(4).slice(0,36);return(0,V.jsx)(`div`,{className:EA,"aria-hidden":`true`,children:[...t].map((e,t)=>(0,V.jsx)(`span`,{className:DA,style:{width:1+Number(e)%3,marginRight:1+Number(e)%2}},t))})}function YA({usage:e,nameOf:t}){let n=Date.now(),r=e.flatMap(e=>e.windows.map(r=>{let i=BA(r,n),a=i?.kind===`full`&&i.at-n<72e6,o=i?.kind===`full`?$(z(`usage.full`),{time:new Date(i.at).toLocaleString([],{...a?{}:{weekday:`short`},hour:`2-digit`,minute:`2-digit`})}):i?z(`usage.lasts`):``;return{key:`${e.vendor}:${r.kind}`,name:`${e.name||t(e.vendor)} ${r.label}`,percent:Math.round(r.percent),tone:rT({capturedAt:e.capturedAt,windows:[r]},n)?.tone??`ok`,note:o}}));return r.length===0?null:(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`h2`,{className:lA,children:z(`usage.quota`)}),r.map(e=>(0,V.jsxs)(`div`,{className:`py-0.5`,children:[(0,V.jsxs)(`div`,{className:CA,children:[(0,V.jsx)(`span`,{className:gA,children:e.name}),(0,V.jsx)(`span`,{className:TA[e.tone]??TA.ok,style:{"--fill":`${Math.min(100,Math.max(0,e.percent))}%`}}),(0,V.jsx)(`span`,{className:`text-right ${Bn[e.tone]}`,children:`${e.percent}%`})]}),e.note&&(0,V.jsx)(`div`,{className:`pl-[2ch] text-subtle`,children:e.note})]},e.key))]})}function XA({model:e}){B();let t=CE(),[n]=bE(UA),r=GA(e,`turns.list`,{sinceDays:VA,limit:HA},n),i=GA(e,`engines.list`,{},n),a=GA(e,`usage.get`,{},n),o=y(e.tasks),s=i.kind===`ready`?i.value.engines:[],c=e=>s.find(t=>t.id===e)?.name??e,l=e=>o?.tasks.find(t=>t.id===e)?.label??z(`usage.removedTask`),u=a.kind===`ready`&&a.value.usage&&(0,V.jsx)(YA,{usage:a.value.usage,nameOf:c});return(0,V.jsx)(`div`,{className:wx,tabIndex:0,ref:t,onKeyDown:e=>{e.metaKey||e.ctrlKey||e.altKey||e.key!==`q`&&e.key!==`Escape`||(e.preventDefault(),O.set(null))},children:(0,V.jsx)(`div`,{className:nA,children:(()=>{if(r.kind===`loading`)return(0,V.jsx)(`p`,{className:`m-0 ${oA}`,children:z(`usage.loading`)});if(r.kind===`failed`)return(0,V.jsx)(`p`,{className:`m-0 text-error`,children:$(z(`usage.failed`),{error:r.error})});let t=r.value.turns,n=new Set(r.value.readers??[]),i=PA(t,Date.now(),VA,HA),a=new Map;for(let e of i.days)for(let[t,n]of Object.entries(e.byEngine))a.set(t,(a.get(t)??0)+n);let s=[...a].sort((e,t)=>t[1]-e[1]).map(([e])=>e),d=e=>SA[Math.max(0,s.indexOf(e))%SA.length]??SA[0],f=Math.max(0,...i.days.map(e=>e.tokens)),p=i.days.slice(Math.max(0,i.days.findIndex(e=>e.turns>0))),m=i.days.reduce((e,t)=>({turns:e.turns+t.turns,tokens:e.tokens+t.tokens,ms:e.ms+t.ms}),{turns:0,tokens:0,ms:0}),h=[...new Set((o?.tasks??[]).flatMap(e=>e.engine?.id&&!n.has(e.engine.id)?[e.engine.id]:[]))];return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:rA,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`h1`,{className:iA,children:[(0,V.jsx)(`span`,{className:Wn,children:`[`}),` rove `,(0,V.jsx)(`span`,{className:Wn,children:`]`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:aA,children:z(`usage.receipt`)}),(0,V.jsx)(`span`,{className:oA,children:` ${i.days[0]?.day.slice(5)} → ${i.days.at(-1)?.day.slice(5)}`})]})]}),t.length>0&&(0,V.jsx)(JA,{sum:m})]}),(0,V.jsx)(KA,{}),t.length===0?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`p`,{className:`m-0 ${oA}`,children:z(`usage.empty`)}),u&&(0,V.jsx)(KA,{}),u]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:dA,children:[(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`h2`,{className:lA,children:z(`usage.total`)}),(0,V.jsx)(`div`,{className:pA,children:LA(m.tokens)}),(0,V.jsx)(`div`,{className:`mt-1.5 ${oA}`,children:`${$(z(`usage.turns`),{count:m.turns})} · ${Lk(m.ms)}`})]}),(0,V.jsxs)(`section`,{className:fA,children:[(0,V.jsxs)(`h2`,{className:uA,children:[z(`usage.perDay`),s.length>1&&(0,V.jsx)(`span`,{className:`flex flex-wrap gap-x-[2ch] font-normal tracking-normal normal-case`,children:s.map(e=>(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`span`,{className:`mr-[1ch] inline-block size-2 align-baseline ${d(e)}`}),c(e)]},e))})]}),p.map(e=>(0,V.jsxs)(`div`,{className:xA,children:[(0,V.jsx)(`span`,{className:oA,children:`${e.day.slice(5)}${e.partial?`~`:``}`}),(0,V.jsx)(`span`,{className:`flex min-w-0`,children:e.tokens>0&&f>0&&(0,V.jsx)(`span`,{className:`flex h-2.5 w-(--fill) min-w-0.5 gap-px`,style:{"--fill":`${e.tokens/f*100}%`},children:s.map(t=>(e.byEngine[t]??0)>0&&(0,V.jsx)(`span`,{className:`min-w-0.5 basis-0 ${d(t)}`,style:{flexGrow:e.byEngine[t]}},t))})}),e.turns>0&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`text-right`,children:LA(e.tokens)}),(0,V.jsx)(`span`,{className:`text-right text-subtle`,children:`${e.turns}t`}),(0,V.jsx)(`span`,{className:`text-right text-subtle`,children:Lk(e.ms)})]})]},e.day))]})]}),(0,V.jsx)(KA,{}),(0,V.jsxs)(`div`,{className:mA,children:[(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`h2`,{className:lA,children:z(`usage.byModel`)}),FA(t).map(e=>(0,V.jsx)(qA,{name:e.model,title:`${c(e.engine)} · ${e.model}`,sum:e,sub:c(e.engine)},`${e.engine}\0${e.model}`))]}),(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`h2`,{className:lA,children:z(`usage.topTasks`)}),IA(t,WA).map(t=>{let n=o?.tasks.some(e=>e.id===t.taskId),r=l(t.taskId);return(0,V.jsx)(qA,{name:n?r:(0,V.jsx)(`span`,{className:sA,children:r}),title:r,sum:t,open:n?()=>{O.set(null),e.select(t.taskId)}:null},t.taskId)})]}),u]})]}),(0,V.jsx)(KA,{}),(0,V.jsxs)(`div`,{className:OA,children:[(0,V.jsx)(`span`,{children:$(z(`usage.range`),{days:VA})}),i.cutoff&&(0,V.jsx)(`span`,{children:$(z(`usage.cutoff`),{count:i.cutoff.count,day:i.cutoff.day.slice(5)})}),h.length>0&&(0,V.jsx)(`span`,{children:$(z(`usage.noReader`),{engines:h.map(c).join(`, `)})}),(0,V.jsx)(`span`,{className:`${aA} ml-auto`,children:z(`usage.thanks`)})]})]})})()})})}var ZA={id:`mods`,label:`mods`},QA=[{id:`kanban`,label:`kanban`,mod:`kanban`},{id:`routines`,label:`automations`},{id:`issues`,label:`issues`,mod:`issues`}];function $A({model:e}){let{nav:t}=fE(),n=y(O),r=y(e.mods).length>0,i=y(e.installedMods),a=[...QA.filter(e=>!e.mod||i.has(e.mod)),...r?[ZA]:[]];return(0,V.jsxs)(`div`,{className:Ix,children:[(0,V.jsx)(tA,{plus:!0,onSelect:()=>mv(),children:z(`rail.newTask`)}),a.map(e=>(0,V.jsx)(tA,{active:n===e.id,onSelect:()=>he(e.id),children:t[e.label]},e.id))]})}function ej({model:e,page:t}){let n=y(e.installedMods);return t===`kanban`&&n.has(`kanban`)?(0,V.jsx)(QD,{model:e}):t===`routines`?(0,V.jsx)(eA,{model:e}):t===`issues`&&n.has(`issues`)?(0,V.jsx)(ZE,{model:e}):t===`mods`?(0,V.jsx)(hO,{model:e}):t===`compare`?(0,V.jsx)(zE,{model:e}):t===`usage`?(0,V.jsx)(XA,{model:e}):null}var tj=f();function nj(e){return e?.match(/^https?:\/\/[^/]+\/([^/]+\/[^/]+)\/(?:pull|merge_requests|-\/merge_requests)\//)?.[1]}var rj=e=>e.charAt(0).toUpperCase()+e.slice(1);function ij(e){return[z(`rail.pr.state.${e.state}`),...e.checks?[z(`rail.pr.checks.${e.checks}`)]:[]].join(`, `)}function aj(e){let t=new Map;for(let n of e){let e=wh(n),r=[...e&&n.pr?[{pr:n.pr,mark:e}]:[],...(n.sessionPrs??[]).flatMap(e=>{let t=Th(e);return t?[{pr:e,mark:t}]:[]})];for(let{pr:e,mark:i}of r){let r=e.url??(e.number===void 0?n.id:`${n.repo}#${e.number}`),a=t.get(r),o=e.lifecycle===`unknown`,s=a?.pr.lifecycle===`unknown`;(!a||s&&!o||o===s&&Eh([a.mark,i])!==a.mark)&&t.set(r,{task:n,pr:e,mark:i})}}return[...t.values()]}function oj({tasks:e,onOpen:t}){let[n,r]=(0,h.useState)(null),[i,a]=(0,h.useState)(!1),o=(0,h.useRef)(null),s=(0,h.useRef)(null),c=(0,h.useRef)(null),l=cu();(0,h.useLayoutEffect)(()=>{let e=c.current;if(!e||!n)return;let t=e.getBoundingClientRect();t.right>window.innerWidth-8&&(e.style.left=`${Math.max(8,window.innerWidth-t.width-8)}px`,e.style.top=`${n.bottom+6}px`);let r=e.getBoundingClientRect().bottom-(window.innerHeight-8);r>0&&(e.style.top=`${Math.max(8,e.getBoundingClientRect().top-r)}px`)},[n]);let u=()=>{t?.(),s.current!==null&&window.clearTimeout(s.current),s.current=null,a(!1),o.current&&!n&&r(o.current.getBoundingClientRect())},d=()=>{a(!0),s.current=window.setTimeout(()=>r(null),140)};(0,h.useEffect)(()=>{if(!l||!n)return;let e=e=>{let t=e.target;o.current?.contains(t)||c.current?.contains(t)||(a(!0),s.current=window.setTimeout(()=>r(null),140))};return document.addEventListener(`pointerdown`,e,!0),()=>document.removeEventListener(`pointerdown`,e,!0)},[l,n]),(0,h.useEffect)(()=>()=>{s.current!==null&&window.clearTimeout(s.current)},[]);let f=aj(e),p=Eh(f.map(e=>e.mark));if(!p)return null;let m=f.length===1?`PR #${f[0]?.pr.number??``}, ${ij(p)}`:z(`rail.pr.many`,{count:f.length});return(0,V.jsxs)(`span`,{ref:o,className:`chip ${wm} ${p.tone}`,"aria-label":m,onMouseEnter:l?void 0:u,onMouseLeave:l?void 0:d,onClick:e=>{l&&(e.stopPropagation(),n&&!i?d():u())},children:[p.glyph,f.length>1&&(0,V.jsx)(`span`,{className:`font-sans`,children:f.length}),n&&(0,tj.createPortal)((0,V.jsx)(`div`,{ref:c,className:Tm(i),style:{top:n.top-6,left:n.right+8},onMouseEnter:l?void 0:u,onMouseLeave:l?void 0:d,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onContextMenu:e=>e.stopPropagation(),children:f.map(({task:e,pr:t,mark:n})=>{let r=nj(t?.url),i=t?.additions!==void 0&&t.deletions!==void 0;return(0,V.jsxs)(`button`,{type:`button`,className:`flex flex-col gap-1 rounded-[calc(var(--radius)-6px)] px-3 py-2 text-left font-sans enabled:hover:bg-hover`,disabled:!t?.url,onClick:()=>t?.url&&window.open(t.url,`_blank`,`noopener`),children:[(0,V.jsx)(`span`,{className:`truncate font-semibold text-ink`,children:t.title||e.label}),(0,V.jsxs)(`span`,{className:`flex items-baseline gap-0 text-meta leading-[inherit] whitespace-nowrap`,children:[(0,V.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.25 ${n.tone}`,children:[(0,V.jsx)(`span`,{className:`font-mono`,children:n.glyph}),rj(z(`rail.pr.state.${n.state}`))]}),(0,V.jsx)(`span`,{className:`overflow-hidden text-ellipsis whitespace-pre text-muted`,children:[...n.checks?[z(`rail.pr.checks.${n.checks}`)]:[],[r,t?.number===void 0?``:`#${t.number}`].filter(Boolean).join(` `)].filter(Boolean).map(e=>`, ${e}`).join(``)}),i&&(0,V.jsxs)(`span`,{className:`ml-auto flex gap-1.5 pl-3 tabular-nums`,children:[(0,V.jsxs)(`span`,{className:`text-success`,children:[`+`,t.additions]}),(0,V.jsxs)(`span`,{className:`text-error`,children:[`−`,t.deletions]})]})]})]},t.url??`${e.id}#${t.number??``}`)})}),document.body)]})}function sj(e,t,n){let r=t.kind===`main`,i=e=>r?e.kind===`main`:e.kind!==`main`&&e.repo===t.repo&&!e.pinned==!t.pinned;if(t.id===n.id||!i(n))return null;let a=e.filter(i).sort((e,t)=>(e.order??e.rank)-(t.order??t.rank)).map(e=>e.id);return a.indexOf(n.id)-a.indexOf(t.id)}function cj(e,t,n,r){let i=sj(e,t,n);return i===null?null:r===`above`&&i>0?i-1:r===`below`&&i<0?i+1:i}function lj(e,t){return e.id===t.id?!1:e.kind===`main`?t.kind===`main`:t.kind!==`main`&&t.repo===e.repo&&!t.pinned==!e.pinned}var uj=e=>e===void 0||e.kind===`project`||e.kind===`state`?0:e.kind===`task`||e.kind===`pane`||e.kind===`round`?e.depth:1;function dj(e,t){let n=uj(e[t]),r=t+1;for(;r<e.length&&uj(e[r])>n;)r++;return r}function fj(e,t){let n=uj(e[t]),r=[];for(let i=2;i<=n;i++){let a=t+1;for(;a<e.length&&uj(e[a])>i;)a++;let o=a<e.length&&uj(e[a])===i;r.push(i===n?o?`tee`:`elbow`:o?`pipe`:`blank`)}return r}function pj(e,t,n,r){let i=e.findIndex(e=>e.id===t);if(i<0||t===n)return e;let a=dj(e,i),o=e.slice(i,a),s=[...e.slice(0,i),...e.slice(a)],c=s.findIndex(e=>e.id===n);if(c<0)return e;let l=r===`above`?c:dj(s,c);return[...s.slice(0,l),...o,...s.slice(l)]}var mj={duration:180,easing:`cubic-bezier(0.16, 1, 0.3, 1)`};function hj(e,t){let n=(0,h.useRef)(null);(0,h.useLayoutEffect)(()=>{let r=[...document.querySelectorAll(`[data-rail-body] > [data-row]`)],i=new Map(r.map(e=>[e.dataset.row??``,e.offsetTop])),a=n.current;if(n.current={list:e,tops:i},!(!a||a.list===e||a.tops.size===0||t)&&!window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)for(let e of r){let t=a.tops.get(e.dataset.row??``);t===void 0?e.animate([{opacity:0},{opacity:1}],mj):t!==e.offsetTop&&e.animate([{transform:`translateY(${t-e.offsetTop}px)`},{transform:`none`}],mj)}})}var gj=null,_j=()=>(gj||(gj=new Image,gj.src=`data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7`),gj);function vj(e,t,n,r){let[i,a]=(0,h.useState)(null),o=(0,h.useRef)(t);o.current=t;let[s,c]=(0,h.useState)(null),l=(0,h.useRef)(()=>a(null));(0,h.useEffect)(()=>{if(!s)return;let e=()=>{c(null),l.current()};if(t!==s)return e();let n=window.setTimeout(e,3e3);return()=>window.clearTimeout(n)},[t,s]);let u=(0,h.useRef)(null),d=(0,h.useRef)(null);hj(t,i!==null||s!==null);let f=()=>[...u.current?.querySelectorAll(`[data-row]`)??[]];(0,h.useLayoutEffect)(()=>{let e=d.current;if(!e||(d.current=null,window.matchMedia(`(prefers-reduced-motion: reduce)`).matches))return;let t=f().flatMap(t=>{let n=e.get(t.dataset.row??``),r=n===void 0?0:n-t.getBoundingClientRect().top;return r?[{el:t,dy:r}]:[]});for(let{el:e,dy:n}of t)e.style.transition=`none`,e.style.transform=`translateY(${n}px)`;u.current?.getBoundingClientRect();for(let{el:e}of t)e.style.transition=`transform 150ms ease-out`,e.style.transform=``,e.addEventListener(`transitionend`,()=>e.style.removeProperty(`transition`),{once:!0})});let p=(0,h.useRef)(null),m=(0,h.useRef)([]),g=(0,h.useRef)(new Map),_=(0,h.useRef)(0),v=(0,h.useRef)(0),y=e=>{p.current=e,a(e)},b=e=>!n||e.machine!==void 0?null:e.kind===`project`?e.noProject?null:t.find(t=>t.repo===e.repo&&!Td(t))??null:e.kind===`task`&&e.depth===1&&e.task.kind!==`main`?e.task:null,x=e=>{let t=b(e);if(t)return{draggable:!0,onDragStart:n=>{n.dataTransfer.effectAllowed=`move`,n.dataTransfer.setDragImage(_j(),0,0),n.dataTransfer.setData(`text/plain`,t.id),u.current=n.currentTarget.closest(`[data-rail-body]`),w(u.current);let r=m.current,i=r.findIndex(t=>t.id===e.id);_.current=r.slice(i,dj(r,i)).reduce((e,t,n)=>e+(g.current.get(t.id)?.height??0)+(n>0?g.current.get(t.id)?.gap??0:0),0),v.current=n.clientY,y({fromRow:e.id,from:t,toRow:e.id,to:t,side:`above`,project:e.kind===`project`})},onDragEnd:()=>p.current&&y(null)}},S=(e,t,n)=>{let r=t;if(n.project)for(;r>0&&e[r]?.kind!==`project`;)r--;let i=e[r];if(!i||i.kind===`project`!==n.project)return null;let a=b(i);return!a||!n.project&&!lj(n.from,a)?null:{row:i.id,task:a}},C={onDragOver:e=>{let t=p.current;if(!t)return;e.preventDefault();let n=e.clientY-v.current;v.current=e.clientY;let r=e.target.closest(`[data-row]`)?.dataset.row,i=m.current,a=S(i,i.findIndex(e=>e.id===r),t);if(!a||a.row===t.fromRow)return;let o=e.currentTarget.querySelector(`[data-row="${CSS.escape(t.fromRow)}"]`)?.getBoundingClientRect().top;if(o===void 0||e.clientY>=o&&e.clientY<o+_.current)return;let s=e.clientY<o?`above`:`below`;(s===`above`?n>=0:n<=0)||(t.toRow!==a.row||t.side!==s)&&y({...t,toRow:a.row,to:a.task,side:s})},onDrop:n=>{let i=p.current;if(!i)return;n.preventDefault(),p.current=null,r?l.current=()=>a(null):l.current=()=>{d.current=new Map(f().map(e=>[e.dataset.row??``,e.getBoundingClientRect().top])),a(null),Ap(`default`),I(G(`tasks`,`sort.label`,{mode:G(`tasks`,`sort.modes.default`)}))};let s=o.current,u=()=>o.current===s?c(s):l.current();if(i.project){if(i.toRow===i.fromRow)return l.current();let t={repo:i.from.repo,target:i.to.repo,side:i.side===`above`?`before`:`after`};e.client.request(`project.move`,t).catch(e=>I(G(`tasks`,`toast.moveFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)).finally(u);return}let m=cj(t,i.from,i.to,i.side);m?Ip(e,i.from.id,m).finally(u):l.current()}},w=e=>{let t=[...e?.querySelectorAll(`[data-row]`)??[]];g.current=new Map(t.map((e,n)=>{let r=t[n-1],i=r?e.offsetTop-r.offsetTop-r.offsetHeight:0;return[e.dataset.row??``,{top:e.offsetTop,gap:i,height:e.offsetHeight}]}))},T=(e,t)=>{m.current=t?pj(e,t.fromRow,t.toRow,t.side):e;let n=new Map;if(!t)return n;let r=Math.min(...[...g.current.values()].map(e=>e.top)),i=e=>e.kind===`project`||e.kind===`state`,a=Math.max(0,...e.filter(i).map(e=>g.current.get(e.id)?.gap??0));for(let[e,t]of m.current.entries()){let o=g.current.get(t.id);if(!o)return new Map;e>0&&(r+=i(t)?a:o.gap),r!==o.top&&n.set(t.id,r-o.top),r+=o.height}return n};return{props:x,body:C,places:e=>{let t=[...g.current.keys()],n=i&&e.length===t.length&&e.every((e,n)=>e.id===t[n])?i:null,r=T(e,n),a=n?e.findIndex(e=>e.id===n.fromRow):-1,o=new Set(a<0?[]:e.slice(a,dj(e,a)).map(e=>e.id));return{dragging:n?.fromRow??null,place:e=>{let t=r.get(e.id);return{"data-row":e.id,...o.has(e.id)?{"data-lifted":``}:{},...t?{style:{transform:`translateY(${t}px)`}}:{}}}}}}}function yj({model:e,narrow:t,onSettings:n}){B();let r=y(IC),i=Q(`engines.skill.bannerHintWeb`,{engines:r.join(`, `)});return(0,V.jsxs)(`div`,{className:Lx,children:[!t&&(0,V.jsx)(aT,{client:e.client}),(0,V.jsxs)(`div`,{className:Rx,children:[(0,V.jsxs)(`button`,{type:`button`,className:`rail-nav-row ${zx(!1)}`,onClick:n,children:[(0,V.jsxs)(`svg`,{className:Vx,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,V.jsx)(`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`}),(0,V.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`})]}),(0,V.jsx)(`span`,{children:z(`rail.settings`)}),r.length>0&&(0,V.jsx)(`span`,{className:`ml-2 min-w-0 truncate text-meta text-subtle`,title:i,children:z(`rail.skillCue`)})]}),(0,V.jsx)(FT,{model:e,bindingId:`settings.open`})]})]})}function bj(e,t,n,r,i=null){let a=e=>e.kind===`task`&&e.task.kind===`main`&&e.fold===void 0&&e.task.id!==n&&e.task.id!==i&&(r?t[e.task.id]?.length===0:(t[e.task.id]?.length??0)===0),o=e.filter(e=>!a(e));return o.filter((e,t)=>{if(e.kind!==`project`&&e.kind!==`state`)return!0;let n=o[t+1];return n!==void 0&&n.kind!==`project`&&n.kind!==`state`})}var xj=`rove.web.rail.shownMains`;function Sj(){try{let e=JSON.parse(localStorage.getItem(xj)??`[]`);return Array.isArray(e)?Object.fromEntries(e.map(e=>[String(e),[null]])):{}}catch{return{}}}function Cj(e,t){try{let n=e.filter(e=>e.kind===`main`&&(t[e.id]?.length??0)>0).map(e=>e.id);localStorage.setItem(xj,JSON.stringify(n))}catch{}}function wj(e,t,n){return(0,h.useEffect)(()=>{n&&Cj(e,t)},[n,e,t]),(0,h.useMemo)(()=>n?t:{...Sj(),...t},[n,t])}var Tj=v({});function Ej(e,t,n){let r=Tj.get()[`${e}::${t.id}`];return r&&r.sig===Kd(n)&&zd(n.root).some(e=>e.id===r.leaf)?r.leaf:n.activeLeafId}function Dj(e,t,n,r){Tj.set({...Tj.get(),[`${e}::${t}`]:{sig:Kd(n),leaf:r}})}function Oj(e,t,n,r){Dj(e,t.id,n,r),No(X(e,t.id,r))?.focus()}function kj(e){let{taskId:t,tabId:n}=e.selection.get(),r=t?e.tabs.get()[t]?.find(e=>e.id===n):void 0;return t&&r?{taskId:t,tab:r}:null}async function Aj(e,t,n){try{let r=await e.client.request(`tab.split`,t);typeof t.taskId==`string`&&await e.refreshTabsNow(t.taskId),n?.(r)}catch(e){I(e instanceof Error?e.message:String(e),`error`)}}function jj(e,t,n,r,i){let a=i??(n.split?Ej(t,n,n.split):`leaf-1`),o=e.selection.get();(o.taskId!==t||o.tabId!==n.id)&&e.select(t,n.id);let s=No(X(t,n.id,a))?.size();Aj(e,{taskId:t,tabId:n.id,action:`open`,direction:r,leafId:a,...s},e=>{e.changed?e.split&&Dj(t,n.id,e.split,e.leaf):I(z(`layout.splitTooSmall`),`error`)})}function Mj(e,t,n,r){let i=n.split,a=i?Ej(t,n,i):r,o=()=>Aj(e,{taskId:t,tabId:n.id,action:`close`,leafId:r},e=>{let i=e.split;if(!i)return;let o=a!==r&&zd(i.root).some(e=>e.id===a);Dj(t,n.id,i,o?a:i.activeLeafId)});if(!i||!Wd(n,i,r)){o();return}C.set((0,V.jsx)(Ci,{title:z(`confirm.closePaneTitle`,{pane:Ud(i,Ld(n)).get(r)??r}),body:z(`confirm.closePaneBody`),confirmLabel:z(`menu.closePane`),onConfirm:o}))}function Nj(e,t,n,r){let i=n.split;i&&C.set((0,V.jsx)(Si,{title:xl(`split.renameTitle`),initial:Ud(i,Ld(n)).get(r)??``,allowEmpty:!0,submitLabel:z(`dialog.save`),onSubmit:i=>Aj(e,{taskId:t,tabId:n.id,action:`rename`,leafId:r,title:i})}))}function Pj(e,t,n,r){return[{label:z(`menu.renamePane`),section:`split`,key:nl(`workspace.split.rename`)??void 0,run:()=>Nj(e,t,n,r)},{label:z(`menu.closePane`),section:`split`,key:ya(`workspace.split.close`)||void 0,run:()=>Mj(e,t,n,r)}]}function Fj(e,t,n,r){return[{label:z(`menu.splitRight`),section:`split`,key:nl(`workspace.split.right`)??void 0,run:()=>jj(e,t,n,`right`,r)},{label:z(`menu.splitDown`),section:`split`,key:nl(`workspace.split.down`)??void 0,run:()=>jj(e,t,n,`down`,r)}]}function Ij(e,t,n,r){let i=n.split,a=r??(i?Ej(t,n,i):`leaf-1`);return[...Fj(e,t,n,a),...Bd(i)?Pj(e,t,n,a):[]]}function Lj(e,t){let n=e.tabs.get()[t]??[],r=e.selection.get(),i=(r.taskId===t?n.find(e=>e.id===r.tabId):void 0)??fo(n);return!i||!Gd(i)?[]:Fj(e,t,i,i.split?Ej(t,i,i.split):`leaf-1`)}function Rj(e,{task:t,tab:n,leaf:r}){n.split&&Oj(t.id,n,n.split,r),e.select(t.id,n.id)}function zj(e){let{row:t}=e,n=y(e.model.selection);y(Tj);let r=n.taskId===t.task.id&&n.tabId===t.tab.id&&!!t.tab.split&&Ej(t.task.id,t.tab,t.tab.split)===t.leaf;return(0,V.jsxs)(`button`,{type:`button`,className:`${pi({size:`pane`})} ${e.cursor?Mm:``}`,"aria-current":r||void 0,onClick:e.onClick,onContextMenu:e.onMenu,...e.place,children:[(0,V.jsx)(`span`,{className:ym,"aria-hidden":`true`,children:e.guides?.map((e,t)=>(0,V.jsx)(`span`,{className:Sm(e)},t))}),(0,V.jsx)(`span`,{className:`${mi} text-(length:--fs-meta) ${r?`text-ink`:`text-muted`}`,children:t.label})]})}function Bj({model:e,task:t}){let[n,r]=(0,h.useState)(()=>Y(e,`task.get`,{taskId:t.id})?.task??null),[i,a]=(0,h.useState)(null),{busy:o,error:s,submit:c}=xi();(0,h.useEffect)(()=>{Gu(e,`task.get`,{taskId:t.id}).then(e=>r(e.task)).catch(e=>a(W(e)))},[e,t.id]);let l=()=>c(async()=>{if(!n?.prompt)return;let t=(await e.client.request(`task.spawn`,{repo:n.repo,prompt:n.prompt,...n.engine?{engine:n.engine}:{},...n.baseRef?{baseBranch:n.baseRef}:{}})).taskIds[0];t&&e.selectWhenListed(t)});return(0,V.jsx)(bi,{title:G(`tasks`,`runAgain.title`),wide:!0,children:(0,V.jsxs)(`form`,{className:Wr,onSubmit:e=>{e.preventDefault(),l()},children:[(0,V.jsx)(`p`,{className:`text-muted`,children:G(`tasks`,`runAgain.source`,{title:t.label})}),(0,V.jsx)(`pre`,{className:Tr,children:n?.prompt??i??G(`tasks`,`fieldNotes.loading`)}),(0,V.jsx)(`p`,{className:wr,children:G(`tasks`,`runAgain.hint`)}),s&&(0,V.jsx)(`p`,{className:`text-error`,children:s}),(0,V.jsx)(Ti,{busy:o||!n?.prompt,submitLabel:G(`tasks`,`runAgain.confirm`)})]})})}function Vj(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}function Hj({model:e,repo:t}){let[n,r]=(0,h.useState)({kind:`loading`}),[i,a]=(0,h.useState)(0),[o,s]=(0,h.useState)(null),[c,l]=(0,h.useState)(null),u=(0,h.useRef)(null),d=()=>e.client.request(`notes.list`,{repo:t}).then(e=>r({kind:`ready`,notes:e.notes})).catch(e=>r({kind:`error`,message:W(e)}));(0,h.useEffect)(()=>void d(),[]);let f=n.kind===`ready`?n.notes:[];(0,h.useEffect)(()=>a(e=>Math.max(0,Math.min(e,f.length-1))),[f.length]),(0,h.useEffect)(()=>{u.current?.querySelector(`.is-selected`)?.scrollIntoView({block:`nearest`})},[i]);let p=async n=>{if(n.id!==void 0){l(null);try{await e.client.request(`notes.delete`,{repo:t,id:n.id}),s(null),await d()}catch(e){l(W(e))}}};return(0,V.jsx)(bi,{title:G(`tasks`,`fieldNotes.title`),wide:!0,children:(0,V.jsxs)(`div`,{className:Wr,onKeyDown:e=>{if(!o){if(e.key===`ArrowDown`||e.key===`j`)a(e=>Math.min(f.length-1,e+1));else if(e.key===`ArrowUp`||e.key===`k`)a(e=>Math.max(0,e-1));else if(e.key===`d`&&f[i]?.id!==void 0)s(f[i]??null);else return;e.preventDefault()}},children:[(0,V.jsx)(`p`,{className:`font-mono text-meta break-all text-muted`,children:t}),n.kind===`loading`&&(0,V.jsx)(`p`,{className:`text-muted`,children:G(`tasks`,`fieldNotes.loading`)}),n.kind===`error`&&(0,V.jsx)(`p`,{className:`text-error`,children:n.message}),n.kind===`ready`&&f.length===0&&(0,V.jsx)(`p`,{className:`text-muted`,children:G(`tasks`,`fieldNotes.empty`)}),f.length>0&&(0,V.jsx)(`ul`,{className:`m-0 list-none p-0 flex max-h-[44vh] flex-col gap-2 overflow-y-auto`,ref:u,children:f.map((e,t)=>(0,V.jsx)(`li`,{children:(0,V.jsxs)(`button`,{type:`button`,className:Er(t===i),onClick:()=>a(t),autoFocus:t===0,children:[(0,V.jsxs)(`span`,{className:`font-mono text-meta whitespace-pre text-accent`,children:[t===i?`▸ `:` `,Vj(e.at),`, `,e.author]}),(0,V.jsx)(`span`,{className:`text-ink whitespace-pre-wrap wrap-anywhere`,children:e.text})]})},`${e.at}:${t}`))}),o&&(0,V.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-line bg-paper px-3 py-2.5`,children:[(0,V.jsx)(`p`,{children:(0,V.jsx)(`strong`,{children:G(`tasks`,`fieldNotes.confirmDelete.title`)})}),(0,V.jsx)(`p`,{className:`text-muted`,children:G(`tasks`,`fieldNotes.confirmDelete.body`,{text:o.text})}),c&&(0,V.jsx)(`p`,{className:`text-error`,children:c}),(0,V.jsxs)(`div`,{className:`actions flex items-center justify-end gap-3.5`,children:[(0,V.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>s(null),children:z(`dialog.cancel`)}),(0,V.jsx)(`button`,{type:`button`,className:br({danger:!0}),onClick:()=>void p(o),children:z(`taskops.retire`)})]})]}),!o&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`p`,{className:`keys-only font-sans text-meta text-subtle`,children:G(`tasks`,`fieldNotes.footerDeletable`)}),(0,V.jsxs)(`div`,{className:`actions flex items-center justify-end gap-3.5`,children:[(0,V.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,disabled:f[i]?.id===void 0,onClick:()=>s(f[i]??null),children:z(`taskops.retire`)}),(0,V.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:R,children:z(`taskops.close`)})]})]})]})})}var Uj=[`backlog`,`in_progress`,`in_review`,`done`,`canceled`,`error`],Wj={backlog:`status.backlog`,in_progress:`status.inProgress`,in_review:`status.inReview`,done:`status.done`,canceled:`status.canceled`,error:`status.error`},Gj=e=>({binding:e,key:nl(e)??void 0});async function Kj(e,t){if(!e){I(z(`menu.nothingToCopy`,{what:t}),`error`);return}try{await navigator.clipboard.writeText(e),I(z(`menu.copied`,{text:e}))}catch{I(z(`menu.copyFailed`),`error`)}}function qj(e,t,n){let r=[{label:z(`menu.newTask`),section:`open`,run:()=>mv(t)}],i=n.mainTaskId;return i&&(n.first||r.push({label:G(`tasks`,`menu.moveToTop`),section:`edit`,run:()=>void e.client.request(`task.move`,{taskId:i,direction:`top`}).catch(e=>I(G(`tasks`,`toast.moveFailed`,{error:String(e)}),`error`))}),r.push({label:G(`tasks`,`menu.reorderProject`),section:`edit`,...Gj(`sidebar.localMerge`),run:()=>Yj(i)})),r.push({label:G(`tasks`,`menu.fieldNotes`),section:`notes`,run:()=>C.set((0,V.jsx)(Hj,{model:e,repo:t}))}),i&&r.push({label:G(`tasks`,`menu.forgetProject`),section:`danger`,danger:!0,run:()=>C.set(Ey(e,t,n.label))}),r}function Jj(e){return[{label:z(`menu.newChatNoFolder`),section:`open`,run:()=>hv()},{label:z(`menu.newShell`),section:`open`,run:()=>void td(e).catch(e=>I(String(e),`error`))}]}function Yj(e){let t=!Mp.get();t&&e!==void 0&&Np.set(e),Pp(t),document.querySelector(`.rail`)?.focus()}function Xj(e,t){let n=(e.tasks.get()?.tasks??[]).filter(e=>e.kind===`main`&&!e.machine&&e.repo!==t.repo).map(e=>e.repo),r=n.map(e=>{let t=e.slice(e.lastIndexOf(`/`)+1);return{value:e,label:n.filter(e=>e.endsWith(`/${t}`)).length>1?e:t}});return r.length===0?(I(G(`tasks`,`moveToProject.empty`),`error`),null):(0,V.jsx)(wi,{title:G(`tasks`,`moveToProject.title`),choices:r,onPick:async n=>{await e.client.request(`task.moveToProject`,{taskId:t.id,repo:n}),I(G(`tasks`,`toast.movedToProject`,{project:r.find(e=>e.value===n)?.label??n}))}})}function Zj(e,t,n){let r=e.client,i=[];n&&(i.push({label:z(`menu.closeTab`),section:`tab`,run:()=>C.set((0,V.jsx)(Ci,{title:z(`confirm.closeTabTitle`,{tab:n.title??n.engineName??n.id}),body:z(`confirm.closeTabBody`),confirmLabel:z(`menu.closeTab`),onConfirm:async()=>{await e.closeTab(t.id,n.id)}}))}),i.push(...Ij(e,t.id,n))),i.push({label:z(`menu.newChat`),section:`open`,run:()=>void $u(e,t.id)}),i.push({label:z(`menu.newChatPick`),section:`open`,rare:!0,run:()=>C.set((0,V.jsx)(ad,{model:e,taskId:t.id}))}),i.push({label:z(`menu.continueEngine`),section:`open`,rare:!0,...Gj(`chat.tab.fork`),run:()=>C.set((0,V.jsx)(ad,{model:e,taskId:t.id,context:`continue`,sourceTabId:n?.id}))}),i.push({label:z(`menu.newShell`),section:`open`,run:()=>void ed(e,t.id,{kind:`shell`}).catch(e=>I(String(e),`error`))}),t.kind===`task`&&t.ownsBranch===!0&&t.branch&&!t.sharesWorkspaceOf&&!t.machine&&!t.extraRepoCount&&i.push({label:G(`tasks`,`menu.newTaskFromBranch`),section:`open`,rare:!0,run:()=>F({repo:t.repo,baseBranch:t.branch,worktree:!0})}),t.startsAt&&(i.push({label:z(`menu.startNow`),section:`open`,run:()=>void e.client.request(`task.startScheduledNow`,{taskId:t.id}).catch(e=>I(String(e),`error`))}),i.push({label:z(`menu.cancelStart`),section:`open`,run:()=>void e.client.request(`task.cancelScheduledStart`,{taskId:t.id}).catch(e=>I(String(e),`error`))})),t.hasPrompt&&(i.push({label:G(`tasks`,`menu.runAgain`),section:`open`,run:()=>C.set((0,V.jsx)(Bj,{model:e,task:t}))}),i.push({label:z(`menu.retryEdit`),section:`open`,rare:!0,run:()=>void e_(e,t)}));let a=!t.machine;if(a&&i.push({label:G(`tasks`,`menu.openEditor`),section:`open`,...Gj(`tasks.openWorktree`),run:()=>void xy(e,t.id)}),t.groupId){let e=t.groupId;i.push({label:z(`compare.menu`),section:`open`,run:()=>ge(e)})}i.push({label:z(`menu.rename`),section:`edit`,...Gj(`sidebar.rename`),run:()=>C.set((0,V.jsx)(Si,{title:z(`menu.rename`),initial:t.title,submitLabel:z(`dialog.save`),onSubmit:n=>e.act(`task.rename`,{taskId:t.id,title:n}).then(()=>{})}))}),t.kind!==`main`&&i.push({label:t.pinned?z(`menu.unpin`):z(`menu.pin`),section:`edit`,...Gj(`sidebar.pin`),run:()=>void e.act(`task.pin`,{taskId:t.id,pinned:!t.pinned}).catch(e=>I(String(e),`error`))}),a&&i.push({label:G(`tasks`,`menu.reorder`),section:`edit`,rare:!0,...Gj(`sidebar.localMerge`),run:()=>Yj()}),i.push({label:z(`menu.setStatus`),section:`edit`,children:Uj.map(n=>({label:z(Wj[n]),checked:n===t.status,run:()=>void e.act(`task.setStatus`,{taskId:t.id,status:n}).catch(e=>I(String(e),`error`))}))}),a&&t.kind!==`main`&&!t.routine&&!t.parentTaskId&&!t.extraRepoCount&&i.push({label:G(`tasks`,`menu.moveToProject`),section:`edit`,rare:!0,run:()=>{let n=Xj(e,t);n&&C.set(n)}}),a&&i.push({label:z(`menu.changeEngine`),section:`edit`,rare:!0,...Gj(`tasks.cycleEngine`),run:()=>C.set((0,V.jsx)(tk,{model:e,current:async()=>(await e.client.request(`task.get`,{taskId:t.id})).task,onSet:async n=>{await e.client.request(`task.setEngine`,{taskId:t.id,engine:n.engine.id,...n.effort===void 0?{}:{effort:n.effort},...n.model===void 0?{}:{model:n.model}}),I(G(`tasks`,`toast.engineSwitched`,{engine:n.engine.name}))}}))}),t.pr?.checkState===`failing`&&i.push({label:G(`tasks`,`menu.fixChecks`),section:`git`,key:ya(`files.fixChecks`),run:()=>void by(e,t.id,z(`taskops.fixSent`))}),t.kind===`task`&&t.branch&&a&&i.push({label:G(`tasks`,`menu.syncBase`),section:`git`,rare:!0,key:ya(`files.syncBase`),run:()=>void vy(e,t.id)}),t.branch&&i.push({label:z(`menu.renameBranch`),section:`git`,rare:!0,...Gj(`tasks.renameBranch`),run:()=>C.set((0,V.jsx)(Si,{title:z(`menu.renameBranch`),initial:t.branch,submitLabel:z(`dialog.save`),onSubmit:e=>r.request(`task.setBranch`,{taskId:t.id,branch:e}).then(()=>{})}))}),t.kind===`task`&&t.branch&&i.push({label:z(`menu.land`),section:`git`,run:()=>void gy(e,t)});let o=[{label:z(`menu.copyWhat.id`),run:()=>void Kj(t.id,z(`menu.what.id`))}];return t.branch&&o.push({label:z(`menu.copyWhat.branch`),run:()=>void Kj(t.branch,z(`menu.what.branch`))}),o.push({label:z(`menu.copyWhat.path`),run:()=>void r.request(`task.get`,{taskId:t.id}).then(e=>Kj(e.task.worktreePath,z(`menu.what.path`))).catch(e=>I(String(e),`error`))}),i.push({label:z(`menu.copy`),section:`copy`,children:o}),t.kind!==`main`&&i.push({label:G(`tasks`,t.archived?`menu.unarchive`:`menu.archive`),section:`danger`,run:()=>void Ty(e,t)}),i.push({label:z(`menu.removeSession`),section:`danger`,...Gj(`sidebar.delete`),danger:!0,run:()=>C.set(t.kind===`main`?wy(e,t):Cy(e,t))}),i}var Qj=`rove.collapsedProjects`,$j=`rove.foldedTasks`,eM=`rove.openedTasks`,tM=600;function nM(e){try{let t=JSON.parse(localStorage.getItem(e)??`[]`);return new Set(Array.isArray(t)?t.filter(e=>typeof e==`string`):[])}catch{return new Set}}function rM(e,t){try{localStorage.setItem(e,JSON.stringify([...t]))}catch{}}var iM=(e,t)=>{let n=new Set(e);return n.delete(t)||n.add(t),n};function aM(){let e=y(Op),[t,n]=(0,h.useState)({active:!1,query:``}),[r,i]=(0,h.useState)(()=>nM(Qj)),a=e=>i(t=>{let n=iM(t,e);return rM(Qj,n),n}),[o,s]=(0,h.useState)(()=>({folded:nM($j),opened:nM(eM)}));return{sort:e,cycleSort:jp,search:t,setSearch:n,collapsed:r,toggleProject:a,hand:o,toggleTaskFold:(e,t)=>s(n=>{let r=new Set(n.folded),i=new Set(n.opened);return t?(r.delete(e),i.add(e)):(i.delete(e),r.add(e)),rM($j,r),rM(eM,i),{folded:r,opened:i}})}}var oM=[`sidebar.nav`,`sidebar.goto`,`sidebar.select`,`sidebar.tree.open`,`sidebar.rename`,`sidebar.pin`,`sidebar.localMerge`,`sidebar.delete`,`sidebar.sort`,`sidebar.search.enter`,`tasks.renameBranch`,`tasks.cycleEngine`,`tasks.openWorktree`,`tasks.update`,`tasks.focusEngine`,`task.new`,`settings.open.sidebar`,`worktrees.open.sidebar`];function sM(e){for(let t of e)for(let e of oM){let n=va(e).indexOf(t);if(n>=0)return{id:e,slot:n}}return null}function cM(e,t){let n=e.selection.get().taskId===t;e.select(t),pe(),n&&!fv(e.client)&&yo()}function lM(e,t,n,r){let{search:i,setSearch:a}=n,[o,s]=(0,h.useState)(null),c=(0,h.useRef)(0),l=t.filter(e=>e.kind!==`project`&&e.kind!==`state`),u=l.findIndex(e=>e.id===o);(0,h.useEffect)(()=>{u<0&&s(r.selectedId&&l.some(e=>e.id===r.selectedId)?r.selectedId:l[0]?.id??null)},[u,l,r.selectedId]);let d=l[u],f=d?.kind===`task`||d?.kind===`pane`?d.task.id:null;(0,h.useEffect)(()=>Fy.set(f),[f]);let p=l[0]?.id??null;(0,h.useEffect)(()=>{i.query,i.active&&s(p)},[i.active,i.query,p]);let m=e=>{let t=l[Math.max(0,Math.min(l.length-1,e))];t&&s(t.id)},g=t=>{t?.kind===`task`&&e.select(t.task.id),t?.kind===`round`&&ge(t.groupId),t?.kind===`pane`&&Rj(e,t),t&&pe()},_=(t,n)=>{t?.kind===`task`&&x(Zj(e,t.task,null),n)?.run?.()},v=async t=>{if(t?.kind===`task`&&t.machine===void 0)try{let{engines:n}=await e.client.request(`engines.list`),r=Tu(n).filter(e=>e.ready!==!1),i=r[(r.findIndex(e=>e.id===t.task.engine?.id)+1)%r.length];if(!i||i.id===t.task.engine?.id)return;await e.client.request(`task.setCommand`,{taskId:t.task.id,engine:i.id}),I(z(`rail.engineSwitched`,{engine:i.name}))}catch(e){I(z(`rail.engineSwitchFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)}};return{cursor:o,setCursor:s,onKeyDown:t=>{let o=l[u],s=t.target instanceof HTMLInputElement;if(i.active){if(t.metaKey||t.ctrlKey||t.altKey)return;if(t.key===`Escape`)a({active:!1,query:``});else if(t.key===`Enter`)g(o),a({active:!1,query:``});else if(t.key===`ArrowDown`)m(u+1);else if(t.key===`ArrowUp`)m(u-1);else if(t.key===`Backspace`&&!s)a(e=>({...e,query:e.query.slice(0,-1)}));else if(t.key.length===1&&!s)a(e=>({...e,query:e.query+t.key}));else return;t.preventDefault();return}let d=sM(qc(t));if(Mp.get()){let n=o?.kind===`task`&&o.machine===void 0;if(d?.id===`sidebar.nav`)n&&Fp(e,o,d.slot%2==0?1:-1);else if(d?.id===`sidebar.localMerge`||t.key===`Enter`||t.key===`Escape`)Pp(!1);else return;t.preventDefault();return}switch(d?.id){case`sidebar.nav`:m(d.slot%2==0?u+1:u-1);break;case`sidebar.goto`:d.slot%2==1?m(l.length-1):Date.now()-c.current<tM?(m(0),c.current=0):c.current=Date.now();break;case`sidebar.select`:case`sidebar.tree.open`:g(o);break;case`tasks.focusEngine`:yo();break;case`sidebar.rename`:case`sidebar.pin`:case`sidebar.delete`:case`tasks.renameBranch`:case`tasks.openWorktree`:_(o,d.id);break;case`tasks.cycleEngine`:v(o);break;case`sidebar.localMerge`:o?.machine===void 0&&Pp(!0);break;case`sidebar.sort`:n.cycleSort(),I(G(`tasks`,`sort.label`,{mode:G(`tasks`,`sort.modes.${Op.get()}`)}));break;case`sidebar.search.enter`:a({active:!0,query:``});break;case`task.new`:r.onNewTask(o?.kind===`task`||o?.kind===`pane`?o.task.repo:void 0,o?.machine);break;case`settings.open.sidebar`:r.onSettings();break;case`worktrees.open.sidebar`:he(`worktrees`);break;case`tasks.update`:he(`update`);break;default:return}t.preventDefault()},onPress:e=>{let t=e.target.closest(`[data-row]`)?.dataset.row;t&&s(t)}}}var uM=192,dM=`rove.web.railWidth`,fM=`rove.web.railFolded`;function pM(){let e=Number(localStorage.getItem(dM));return Number.isFinite(e)&&e>0?e:null}var mM=v(pM());mM.subscribe(()=>{let e=mM.get();e===null?localStorage.removeItem(dM):localStorage.setItem(dM,String(Math.round(e)))}),mM.subscribe(le);var hM=v(localStorage.getItem(fM)===`1`);hM.subscribe(()=>localStorage.setItem(fM,hM.get()?`1`:`0`));var gM=v(!1),_M=null,vM=!1;function yM(e){_M!==null&&window.clearTimeout(_M),_M=null,vM=e,e?gM.set(!0):_M=window.setTimeout(()=>S.get()===null&&gM.set(!1),250)}S.subscribe(()=>{S.get()===null&&gM.get()&&!vM&&yM(!1)}),hM.subscribe(()=>gM.set(!1)),hM.subscribe(le);function bM(e,t=window.innerWidth){let n=Math.max(uM,t-320);return Math.max(uM,Math.min(n,Math.round(e)))}var xM=(e,t,n)=>`~pane:${e}:${t}:${n}`;function SM(e,t){return e.flatMap(e=>e.kind===`task`?[e,...(t[e.task.id]??[]).flatMap(t=>{let n=t.split;if(!n||!Bd(n))return[];let r=Ud(n,Ld(t));return zd(n.root).map(n=>({id:xM(e.task.id,t.id,n.id),kind:`pane`,task:e.task,tab:t,leaf:n.id,label:r.get(n.id)??n.id,depth:e.depth+1,...e.machine===void 0?{}:{machine:e.machine}}))})]:[e])}function CM(e){let{row:t}=e;return(0,V.jsxs)(`button`,{type:`button`,className:`${pi({size:`pane`})} ${e.cursor?Mm:``}`,title:z(`compare.menu`),onClick:()=>{e.onClick(),ge(t.groupId)},...e.place,children:[e.guides&&(0,V.jsx)(`span`,{className:`-my-0.75 -mr-0.5 ml-0 flex flex-none self-stretch`,"aria-hidden":`true`,children:e.guides.map((e,t)=>(0,V.jsx)(`span`,{className:Sm(e)},t))}),(0,V.jsx)(`span`,{className:`${mi} text-(length:--fs-meta) text-muted`,children:t.title}),(0,V.jsxs)(`span`,{className:`${yi} ml-auto items-center`,children:[e.repo&&(0,V.jsx)(`span`,{className:`max-w-24 truncate text-subtle`,children:e.repo}),(0,V.jsx)(`span`,{className:`text-subtle`,children:t.tasks.length}),(0,V.jsx)(Ph,{status:Sh(t.tasks)})]})]})}function wM(e){let t=(0,h.useRef)(null);return(0,h.useEffect)(()=>{let e=t.current;return()=>{e&&document.activeElement===e&&e.closest(`nav`)?.focus()}},[]),(0,V.jsxs)(`div`,{className:`${km} mono items-center`,children:[(0,V.jsx)(`span`,{className:`text-accent`,children:`/`}),(0,V.jsx)(`input`,{ref:t,className:Am,type:`text`,autoFocus:!0,spellCheck:!1,autoComplete:`off`,autoCapitalize:`off`,enterKeyHint:`go`,value:e.query,placeholder:z(`rail.searchPlaceholder`),"aria-label":z(`rail.searchPlaceholder`),onChange:t=>e.onChange(t.target.value)}),e.query&&(0,V.jsx)(`span`,{className:`ml-1.5 text-muted`,children:e.count})]})}var TM=Math.min,EM=Math.max,DM=Math.round,OM=Math.floor,kM=e=>({x:e,y:e}),AM={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function jM(e,t,n){return EM(e,TM(t,n))}function MM(e,t){return typeof e==`function`?e(t):e}function NM(e){return e.split(`-`)[0]}function PM(e){return e.split(`-`)[1]}function FM(e){return e===`x`?`y`:`x`}function IM(e){return e===`y`?`height`:`width`}function LM(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function RM(e){return FM(LM(e))}function zM(e,t,n){n===void 0&&(n=!1);let r=PM(e),i=RM(e),a=IM(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=JM(o)),[o,JM(o)]}function BM(e){let t=JM(e);return[VM(e),t,VM(t)]}function VM(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var HM=[`left`,`right`],UM=[`right`,`left`],WM=[`top`,`bottom`],GM=[`bottom`,`top`];function KM(e,t,n){switch(e){case`top`:case`bottom`:return n?t?UM:HM:t?HM:UM;case`left`:case`right`:return t?WM:GM;default:return[]}}function qM(e,t,n,r){let i=PM(e),a=KM(NM(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(VM)))),a}function JM(e){let t=NM(e);return AM[t]+e.slice(t.length)}function YM(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function XM(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:YM(e)}function ZM(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function QM(e,t,n){let{reference:r,floating:i}=e,a=LM(t),o=RM(t),s=IM(o),c=NM(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=PM(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function $M(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=MM(t,e),p=XM(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=ZM(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=ZM(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var eN=50,tN=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:$M},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=QM(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<eN&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=QM(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},nN=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=MM(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=NM(r),_=LM(o),v=NM(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[JM(o)]:BM(o)),x=p!==`none`;!d&&x&&b.push(...qM(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=zM(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===LM(t)||T.every(e=>LM(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=LM(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}},rN=new Set([`left`,`top`]);async function iN(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=NM(n),s=PM(n),c=LM(n)===`y`,l=rN.has(o)?-1:1,u=a&&c?-1:1,d=MM(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var aN=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await iN(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},oN=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=MM(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=LM(i),p=FM(f),m=u[p],h=u[f],g=(e,t)=>jM(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}};function sN(){return typeof window<`u`}function cN(e){return dN(e)?(e.nodeName||``).toLowerCase():`#document`}function lN(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function uN(e){return((dN(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function dN(e){return sN()?e instanceof Node||e instanceof lN(e).Node:!1}function fN(e){return sN()?e instanceof Element||e instanceof lN(e).Element:!1}function pN(e){return sN()?e instanceof HTMLElement||e instanceof lN(e).HTMLElement:!1}function mN(e){return!sN()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof lN(e).ShadowRoot}function hN(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=EN(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function gN(e){return/^(table|td|th)$/.test(cN(e))}function _N(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var vN=/transform|translate|scale|rotate|perspective|filter/,yN=/paint|layout|strict|content/,bN=e=>!!e&&e!==`none`,xN;function SN(e){let t=fN(e)?EN(e):e;return bN(t.transform)||bN(t.translate)||bN(t.scale)||bN(t.rotate)||bN(t.perspective)||!wN()&&(bN(t.backdropFilter)||bN(t.filter))||vN.test(t.willChange||``)||yN.test(t.contain||``)}function CN(e){let t=ON(e);for(;pN(t)&&!TN(t);){if(SN(t))return t;if(_N(t))return null;t=ON(t)}return null}function wN(){return xN??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),xN}function TN(e){return/^(html|body|#document)$/.test(cN(e))}function EN(e){return lN(e).getComputedStyle(e)}function DN(e){return fN(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ON(e){if(cN(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||mN(e)&&e.host||uN(e);return mN(t)?t.host:t}function kN(e){let t=ON(e);return TN(t)?(e.ownerDocument||e).body:pN(t)&&hN(t)?t:kN(t)}function AN(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=kN(e),i=r===e.ownerDocument?.body,a=lN(r);if(i){let e=jN(a);return t.concat(a,a.visualViewport||[],hN(r)?r:[],e&&n?AN(e):[])}return t.concat(r,AN(r,[],n))}function jN(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function MN(e){let t=EN(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=pN(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=DM(n)!==a||DM(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function NN(e){return fN(e)?e:e.contextElement}function PN(e){let t=NN(e);if(!pN(t))return kM(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=MN(t),o=(a?DM(n.width):n.width)/r,s=(a?DM(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var FN=kM(0);function IN(e){let t=lN(e);return!wN()||!t.visualViewport?FN:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function LN(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===lN(e)}function RN(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=NN(e),o=kM(1);t&&(r?fN(r)&&(o=PN(r)):o=PN(e));let s=LN(a,n,r)?IN(a):kM(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=lN(a),t=fN(r)?lN(r):r,n=e,i=jN(n);for(;i&&t!==n;){let e=PN(i),t=i.getBoundingClientRect(),r=EN(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=lN(i),i=jN(n)}}return ZM({width:u,height:d,x:c,y:l})}function zN(e,t){let n=DN(e).scrollLeft;return t?t.left+n:RN(uN(e)).left+n}function BN(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-zN(e,n),y:n.top+t.scrollTop}}function VN(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=uN(r),s=t?_N(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=kM(1),u=kM(0),d=pN(r);if((d||!a)&&((cN(r)!==`body`||hN(o))&&(c=DN(r)),d)){let e=RN(r);l=PN(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?BN(o,c):kM(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function HN(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function UN(e){let t=DN(e),n=e.ownerDocument.body,r=EM(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=EM(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+zN(e),o=-t.scrollTop;return EN(n).direction===`rtl`&&(a+=EM(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var WN=25;function GN(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=lN(e),a=uN(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!wN()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(zN(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=WN&&(s-=o)}return{width:s,height:c,x:l,y:u}}function KN(e,t){let n=RN(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=PN(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function qN(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=GN(e,n,t);else if(t===`document`)r=UN(uN(e));else if(fN(t))r=KN(t,n);else{let n=IN(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return ZM(r)}function JN(e,t){let n=t.get(e);if(n)return n;let r=AN(e,[],!1).filter(e=>fN(e)&&cN(e)!==`body`),i=null,a=EN(e).position===`fixed`,o=a?ON(e):e;for(;fN(o)&&!TN(o);){let e=EN(o),t=SN(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=ON(o)}return t.set(e,r),r}function YN(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?_N(t)?[]:JN(t,this._c):[].concat(n),r],o=qN(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=qN(t,a[e],i);s=EM(n.top,s),c=TM(n.right,c),l=TM(n.bottom,l),u=EM(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function XN(e){let{width:t,height:n}=MN(e);return{width:t,height:n}}function ZN(e,t,n){let r=pN(t),i=uN(t),a=n===`fixed`,o=RN(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=kM(0);if((r||!a)&&((cN(t)!==`body`||hN(i))&&(s=DN(t)),r)){let e=RN(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=zN(i));let l=i&&!r&&!a?BN(i,s):kM(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function QN(e){return EN(e).position===`static`}function $N(e,t){if(!pN(e)||EN(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return uN(e)===n&&(n=n.ownerDocument.body),n}function eP(e,t){let n=lN(e);if(_N(e))return n;if(!pN(e)){let t=ON(e);for(;t&&!TN(t);){if(fN(t)&&!QN(t))return t;t=ON(t)}return n}let r=$N(e,t);for(;r&&gN(r)&&QN(r);)r=$N(r,t);return r&&TN(r)&&QN(r)&&!SN(r)?n:r||CN(e)||n}var tP=async function(e){let t=this.getOffsetParent||eP,n=this.getDimensions,r=await n(e.floating);return{reference:ZN(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function nP(e){return EN(e).direction===`rtl`}var rP={convertOffsetParentRelativeRectToViewportRelativeRect:VN,getDocumentElement:uN,getClippingRect:YN,getOffsetParent:eP,getElementRects:tP,getClientRects:HN,getDimensions:XN,getScale:PN,isElement:fN,isRTL:nP};function iP(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function aP(e,t,n){let r=null,i,a=uN(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=OM(d),h=OM(a.clientWidth-(u+f)),g=OM(a.clientHeight-(d+p)),_=OM(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:EM(0,TM(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!iP(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=lN(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function oP(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=NN(e),u=i||a?[...l?AN(l):[],...t?AN(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?aP(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?RN(e):null;c&&g();function g(){let t=RN(e);h&&!iP(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var sP=aN,cP=oN,lP=nN,uP=(e,t,n)=>{let r=new Map,i=n??{},a={...rP,...i.platform,_c:r};return tN(e,t,{...i,platform:a})},dP=`pointer-events-none fixed top-0 left-0 z-35 max-w-80 animate-tip-in rounded-sm border-hairline border-line bg-inset px-2.5 py-1.5 font-sans text-meta leading-[1.4] whitespace-normal wrap-anywhere text-ink shadow-popover motion-reduce:animate-none`,fP=500,pP=400,mP=`rove-tip`,hP=null,gP=null,_P=null,vP=null,yP=0,bP=!1,xP=()=>bP;function SP(){return hP?.isConnected?hP:(hP=document.createElement(`div`),hP.id=mP,hP.setAttribute(`role`,`tooltip`),hP.className=dP,hP.hidden=!0,document.body.append(hP),hP)}function CP(){vP!==null&&window.clearTimeout(vP),vP=null}function wP(e,t,n=`top`){CP(),TP();let r=SP();r.textContent=t,r.hidden=!1,gP=e,e.setAttribute(`aria-describedby`,mP),_P=oP(e,r,()=>{if(!e.isConnected)return TP();uP(e,r,{strategy:`fixed`,placement:n,middleware:[sP(6),lP(),cP({padding:8})]}).then(({x:e,y:t})=>{r.style.left=`${e}px`,r.style.top=`${t}px`})})}function TP(){CP(),gP&&(_P?.(),_P=null,gP.getAttribute(`aria-describedby`)===mP&&gP.removeAttribute(`aria-describedby`),gP=null,hP&&(hP.hidden=!0),yP=performance.now())}function EP(e){if(!(e instanceof Element))return null;let t=e.closest(`[title], [data-tip]`);if(!t||t instanceof HTMLIFrameElement)return null;let n=t.getAttribute(`title`);if(n!==null){if(t.removeAttribute(`title`),n===``)return null;t.dataset.tip=n,!t.hasAttribute(`aria-label`)&&!t.textContent?.trim()&&t.setAttribute(`aria-label`,n)}return t.dataset.tip?t:null}function DP(e){if(e===gP)return;CP();let t=gP!==null||performance.now()-yP<pP,n=()=>e.isConnected&&e.dataset.tip&&wP(e,e.dataset.tip);t?n():vP=window.setTimeout(n,fP)}var OP=!1;function kP(){OP||(OP=!0,document.addEventListener(`pointerover`,e=>{if(e.pointerType===`touch`)return;let t=EP(e.target);t?DP(t):gP&&e.target instanceof Node&&gP.contains(e.target)||TP()}),document.addEventListener(`pointerout`,e=>{let t=EP(e.target);t&&!(e.relatedTarget instanceof Node&&t.contains(e.relatedTarget))&&TP()}),document.addEventListener(`keydown`,e=>{bP=!0,e.key===`Escape`&&TP()},!0),document.addEventListener(`pointerdown`,()=>{bP=!1,TP()},!0),document.addEventListener(`focusin`,e=>{let t=bP?EP(e.target):null;t&&DP(t)}),document.addEventListener(`focusout`,e=>{e.target===gP&&TP()}),window.addEventListener(`blur`,TP))}var AP=450,jP=e=>{let t=e.querySelector(`.row-title`);return!!t&&t.scrollWidth>t.clientWidth};function MP(e,t){let n=(0,h.useRef)(null),r=(0,h.useRef)(null),i=(0,h.useRef)(e);i.current=e;let a=()=>{n.current!==null&&window.clearTimeout(n.current),n.current=null},o=e=>{a(),n.current=window.setTimeout(()=>wP(e,i.current,`right`),AP)},s=()=>{a(),TP()};return(0,h.useEffect)(()=>{let e=r.current,n=e?.closest(`.rail`);if(!t||!e||!n||!xP()||!n.contains(document.activeElement)||!jP(e))return;let i=e=>{e.relatedTarget instanceof Node&&n.contains(e.relatedTarget)||s()};return o(e),n.addEventListener(`focusout`,i),()=>{n.removeEventListener(`focusout`,i),s()}},[t]),(0,h.useEffect)(()=>()=>{n.current!==null&&window.clearTimeout(n.current)},[]),{ref:e=>{r.current=e},onPointerEnter:e=>{e.pointerType===`touch`||!jP(e.currentTarget)||o(e.currentTarget)},onPointerLeave:s,hide:s}}function NP({at:e}){let t=new Date(e);if(Number.isNaN(t.getTime()))return null;let n=vg(t);return(0,V.jsxs)(`span`,{className:`text-subtle`,title:z(`rail.startsAt`,{time:t.toLocaleString()}),children:[`◷ `,n]})}var PP=2e4;function FP(e,t){let n=yp().prefs.statusMarkNoticeSeen===!1,r=NS();(0,h.useEffect)(()=>{!n||t===void 0||(_p(e.client,`statusMarkNoticeSeen`,!0),t!==0&&r!==`dots`&&I(z(`rail.markNotice`),`info`,{label:z(`rail.markNoticeUndo`),run:()=>PS(e.client,`dots`)},PP))},[e,n,t,r])}var IP=150,LP=128,RP=0,zP=2,BP=[{reach:.96,grow:1.5,pulse:.9,done:104},{reach:.72,grow:1.1,pulse:1.2,done:84},{reach:1,grow:1.7,pulse:.7,done:116},{reach:.84,grow:1.3,pulse:1,done:96},{reach:.62,grow:1.2,pulse:1.3,done:80}],VP=`/-\\|`,HP=6,UP=(e,t,n,r)=>{let i=e[n];i&&t>=0&&t<i.length&&(i[t]=r)};function WP(e,t){let n=Math.min(64,Math.max(24,Math.floor(t))),r=(Math.floor(e)%IP+IP)%IP,i=Array.from({length:11},()=>Array(n).fill(` `)),a=Array.from({length:11},()=>Array(n).fill(` `));UP(a,RP,0,`o`);let o=zP+2*(BP.length-1),s=Math.min(o,Math.floor(r/2));for(let e=1;e<=s;e++)UP(i,RP,e,`|`);if(BP.forEach((e,t)=>{let o=zP+2*t,s=2*o;if(r<s)return;UP(i,RP,o,`+`);let c=n-1-1,l=1+Math.max(1,Math.floor(c*e.reach)),u=Math.min(l,1+Math.floor((r-s)*e.grow)),d=r>=e.done&&u===l;for(let t=1;t<u;t++)!d&&((t-Math.floor(r*e.pulse))%HP+HP)%HP===0?UP(a,t,o,`=`):UP(i,t,o,`-`);d?UP(a,u,o,`o`):u<l?UP(a,u,o,`>`):UP(a,u,o,VP[(Math.floor(r/2)+t)%4]??`-`)}),r>=LP){let e=Math.ceil((r-LP+1)/22*(n+1));for(let t of[i,a])for(let r of t)r.fill(` `,0,Math.min(n,e))}return{base:i.map(e=>e.join(``)).join(`
|
|
61
61
|
`),accent:a.map(e=>e.join(``)).join(`
|
|
62
62
|
`)}}var GP=`min-h-0 w-full overflow-y-auto`,KP=`mx-auto mt-[min(16vh,8rem)] flex w-full max-w-130 flex-col gap-4 px-5 pb-7`,qP=`relative grid w-full select-none overflow-hidden font-mono text-(length:--fs-body) text-subtle [contain:layout_paint]`,JP=`col-start-1 row-start-1 m-0 whitespace-pre font-[inherit] leading-[inherit]`,YP=`invisible absolute top-0 left-0 whitespace-pre`,XP=1.3,ZP=`0000000000`,QP=1e3/12;function $P(){let e=(0,h.useRef)(null),t=(0,h.useRef)(null),n=(0,h.useRef)(null),r=(0,h.useRef)(null);return(0,h.useEffect)(()=>{let i=e.current,a=t.current,o=n.current,s=r.current;if(!i||!a||!o||!s)return;let c=window.matchMedia(`(prefers-reduced-motion: reduce)`),l=24,u=90,d=0,f=0,p=0,m=-1,h=!0,g=()=>{let e=WP(u,l);o.textContent=e.base,s.textContent=e.accent},_=()=>{let e=a.getBoundingClientRect().width/10;e>0&&(l=Math.min(64,Math.max(24,Math.floor(i.clientWidth/e)))),g()},v=e=>{d=requestAnimationFrame(v);let t=p+Math.floor((e-f)/QP);t!==m&&(m=t,u=t,g())},y=()=>{cancelAnimationFrame(d),d=0},b=()=>{y(),c.matches?(u=90,g()):h&&document.visibilityState===`visible`&&(f=performance.now(),p=u,m=-1,d=requestAnimationFrame(v))},x=new ResizeObserver(_);x.observe(i),_(),b();let S=new IntersectionObserver(e=>{h=e[e.length-1]?.isIntersecting??!0,b()});return S.observe(i),c.addEventListener(`change`,b),document.addEventListener(`visibilitychange`,b),()=>{y(),x.disconnect(),S.disconnect(),c.removeEventListener(`change`,b),document.removeEventListener(`visibilitychange`,b)}},[]),(0,V.jsxs)(`div`,{ref:e,"aria-hidden":`true`,"data-field":`first-run-art`,className:qP,style:{height:`${11*XP}em`,lineHeight:XP},children:[(0,V.jsx)(`span`,{ref:t,className:YP,children:ZP}),(0,V.jsx)(`pre`,{ref:n,className:JP}),(0,V.jsx)(`pre`,{ref:r,className:`${JP} text-accent`})]})}function eF(e){let t=G(`doctor`,`fix.humanOnlyWhy`),n=[];if(e.git||n.push({id:`git`,label:G(`doctor`,`fix.git`),action:G(`doctor`,`fix.gitAction`),why:t}),e.engines.length===0){let r=e.signedOut.length>0;n.push({id:`engine`,label:G(`doctor`,r?`fix.noEngineLogin`:`fix.noEngine`),action:G(`doctor`,r?`fix.noEngineLoginAction`:`fix.noEngineAction`,{list:e.signedOut.map(e=>e.id).join(`, `)}),why:t})}return n}function tF({model:e}){B(),y(ua);let[t,n]=(0,h.useState)(()=>Y(e,`welcome.env`)??null);(0,h.useEffect)(()=>{let t=!0;return Gu(e,`welcome.env`).then(e=>t&&n(e)).catch(()=>{}),()=>{t=!1}},[e]);let r=t===null?null:t.engines.length>0?{key:`enginesFound`,warn:!1,list:t.engines.map(e=>e.name).join(`, `)}:t.signedOut.length>0?{key:`enginesSignedOut`,warn:!0,list:t.signedOut.map(e=>e.name).join(`, `)}:{key:`enginesMissing`,warn:!0,list:``},i=t!==null&&(t.engines.length===0||!t.git)?eF(t):[];return(0,V.jsx)(`div`,{className:GP,"data-field":`welcome`,children:(0,V.jsxs)(`div`,{className:KP,children:[(0,V.jsx)($P,{}),(0,V.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,V.jsx)(`h1`,{className:`m-0 font-sans text-title font-semibold text-ink`,children:z(`firstRun.title`)}),(0,V.jsx)(`p`,{className:`m-0 font-sans text-body text-muted`,children:z(`firstRun.body`)})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(`button`,{type:`button`,className:br(),"data-field":`start-first-task`,onClick:()=>mv(t?.start?.repo),children:z(`firstRun.start`)}),(0,V.jsx)(`span`,{className:`keys-only mono text-meta text-subtle`,children:ya(`task.new.global`)})]}),t!==null&&r!==null&&(0,V.jsxs)(`div`,{className:`flex flex-col gap-1.5 font-sans text-meta`,children:[(0,V.jsx)(`p`,{className:`m-0 ${r.warn?`text-warning`:`text-subtle`}`,children:G(`workspace`,`welcome.${r.key}`,{list:r.list})}),!t.git&&(0,V.jsx)(`p`,{className:`m-0 text-warning`,children:G(`workspace`,`welcome.gitMissing`)}),i.map(e=>(0,V.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,V.jsx)(`p`,{className:`m-0 text-warning`,children:e.label}),(0,V.jsx)(`p`,{className:`mono m-0 text-accent`,children:e.action}),(0,V.jsx)(`p`,{className:`m-0 text-muted`,children:e.why})]},e.id)),i.length>0&&(0,V.jsx)(`p`,{className:`m-0 text-muted`,children:G(`common`,`failureHint`,{command:`rove doctor`})})]})]})})}function nF(e,t){e.preventDefault(),S.set({x:e.clientX,y:e.clientY,items:t,target:e.currentTarget,fromKeyboard:e.button!==2})}function rF({model:e,narrow:t}){let n=B(),r=y(e.tasks),i=y(e.remote),a=Wm(e),o=y(e.tabs),s=jS(e);FP(e,r?.tasks.length);let c=y(e.tabsSettled),l=y(e.selection),u=r?.tasks??[],d=r?.attention.filter(e=>e.unread).length??0,f=l.taskId,p=wj(u,o,c),m=new Map([...u,...i].map(e=>[e.id,e])),g=aM(),_=y(Mp),v=y(Cp)===`state`,x=y(Np),S=e=>(v?Cv:Id)({tasks:u,remote:i,machines:a,sort:g.sort,query:e,fold:{...g.hand,selectedId:f??void 0}}),w=S(g.search.active?g.search.query:``),{groups:T}=w,E=g.search.active?w.rows:Rd(SM(wv(bj(w.rows,p,l.taskId,c,x)),o),g.collapsed),D=e=>e.filter(e=>e.kind!==`project`&&e.kind!==`state`&&e.kind!==`round`),O=(n===`zh`?Wi:Ui).machine,k=new Set(a.filter(e=>e.state!==`online`).map(e=>e.alias)),A=T.find(e=>e.tasks.some(e=>e.kind===`main`))?.repo,ee=e=>({mainTaskId:T.find(t=>t.repo===e)?.tasks.find(e=>e.kind===`main`)?.id??null,label:od(e),first:e===A}),j=vj(e,u,!g.search.active&&!v,g.sort==="default"),{place:te,dragging:M}=j.places(E),N=()=>C.set((0,V.jsx)(mT,{model:e})),P=lM(e,E,g,{selectedId:f,onNewTask:mv,onSettings:N}),F=x!==null&&E.some(e=>e.id===x),ne=P.setCursor;(0,h.useEffect)(()=>{F&&x!==null&&ne(x)},[F,x,ne]);let re=D(S(``).rows).length,ie=(0,h.useRef)(null),ae=y(hM)&&!t,I=y(gM)&&ae,L=t?u.find(e=>e.id===l.taskId&&!e.deleting)??null:null;return(0,V.jsxs)(`nav`,{className:`${Dm} ${ae?`is-folded`:``}`,ref:ie,inert:ae&&!I,"aria-hidden":ae&&!I,onMouseEnter:ae?()=>yM(!0):void 0,onMouseLeave:ae?()=>yM(!1):void 0,tabIndex:0,onKeyDown:e=>{HT(`sidebar`),P.onKeyDown(e)},children:[(0,V.jsxs)(`header`,{className:Om,children:[(0,V.jsxs)(`span`,{className:`${Un} mr-auto`,children:[(0,V.jsx)(`span`,{className:Wn,children:`[`}),` rove `,(0,V.jsx)(`span`,{className:Wn,children:`]`})]}),(0,V.jsxs)(`span`,{className:`relative`,children:[(0,V.jsx)(`button`,{type:`button`,className:`m-0 text-meta font-medium normal-nums inbox-chip relative ${li} ${Wt} ${d>0?`text-accent`:`text-muted`}`,onClick:()=>C.set((0,V.jsx)(cp,{model:e})),children:z(`rail.inbox`,{count:d})}),(0,V.jsx)(FT,{model:e,bindingId:`inbox.show`,head:!0})]}),(0,V.jsx)(gS,{})]}),_&&(0,V.jsxs)(`div`,{className:`flex gap-1 px-3.5 pb-2 text-meta mono`,children:[(0,V.jsx)(`span`,{className:`text-accent`,children:G(`tasks`,`moveChip`).trim()}),(0,V.jsx)(`span`,{className:`keys-only ml-1.5 text-muted`,children:(0,V.jsx)(rp,{text:z(`taskops.moveHint`)})})]}),g.search.active&&(0,V.jsx)(wM,{query:g.search.query,count:`${D(E).length}/${re}`,onChange:e=>g.setSearch(t=>({...t,query:e}))}),(0,V.jsx)($A,{model:e}),(0,V.jsxs)(`div`,{"data-rail-body":!0,className:jm(M!==null),...j.body,onPointerDownCapture:P.onPress,children:[r&&u.length===0&&i.length===0&&t&&(0,V.jsx)(tF,{model:e}),r&&u.length===0&&i.length===0&&!t&&(0,V.jsx)(`p`,{className:`m-0 px-2 py-3 font-mono text-meta text-subtle`,children:z(`rail.empty`)}),L&&(0,V.jsx)(EF,{title:L.title}),E.map((t,n)=>t.kind===`round`?(0,V.jsx)(CM,{row:t,guides:t.depth>1?fj(E,n):void 0,repo:v&&t.depth===1?xv(t.tasks[0]):void 0,cursor:t.id===P.cursor,place:te(t),onClick:()=>P.setCursor(t.id)},t.id):t.kind===`pane`?(0,V.jsx)(zj,{model:e,row:t,guides:fj(E,n),cursor:t.id===P.cursor,place:te(t),onClick:()=>{P.setCursor(t.id),Rj(e,t),pe()},onMenu:n=>{P.setCursor(t.id),nF(n,Pj(e,t.task.id,t.tab,t.leaf))}},t.id):(0,V.jsx)(iF,{row:t,guides:t.kind===`task`&&t.depth>1?fj(E,n):void 0,cloud:Vm(t,a,O),repo:v&&t.kind===`task`&&t.depth===1?xv(t.task):void 0,tabs:t.kind===`task`?o[t.task.id]:void 0,engineIcon:t.kind===`task`?s.get(t.task.engine?.id??``):void 0,selected:t.id===f,cursor:t.id===P.cursor&&M===null,stale:t.machine!==void 0&&k.has(t.machine),collapsed:(t.kind===`project`||t.kind===`state`)&&g.collapsed.has(t.id),drag:j.props(t),dragging:M===t.id,place:te(t),onNewTask:t.kind===`project`?t.noProject?hv:()=>mv(t.repo,t.machine):void 0,moving:_&&t.machine===void 0&&(t.kind===`project`?!t.noProject&&ee(t.repo).mainTaskId===P.cursor:t.id===P.cursor&&(t.kind!==`task`||t.task.kind!==`main`)),prTasks:t.kind===`task`?[t.task,...(t.fold?.descendantIds??[]).flatMap(e=>m.get(e)??[])]:void 0,rollup:t.kind===`task`&&t.fold?.collapsed?Sh([t.task,...t.fold.descendantIds.flatMap(e=>m.get(e)??[])]):void 0,onToggleFold:()=>{t.kind===`task`&&g.toggleTaskFold(t.id,t.fold?.collapsed===!0)},onClick:()=>{P.setCursor(t.id),(t.kind===`project`||t.kind===`state`)&&g.toggleProject(t.id),t.kind===`task`&&cM(e,t.task.id)},onMenu:n=>{if(t.kind!==`project`||t.machine===void 0){if(t.kind===`project`&&t.noProject){nF(n,Jj(e));return}if(t.kind===`project`){let r=ee(t.repo);r.mainTaskId&&E.some(e=>e.id===r.mainTaskId)&&P.setCursor(r.mainTaskId),nF(n,qj(e,t.repo,r));return}t.kind===`task`&&(P.setCursor(t.id),nF(n,b(sF(oF(Zj(e,t.task,null),t.fold,()=>g.toggleTaskFold(t.id,t.fold?.collapsed===!0)),Lj(e,t.task.id)),z(`menu.more`))))}}},t.id))]}),(0,V.jsx)(yj,{model:e,narrow:t,onSettings:N}),(0,V.jsx)(DF,{pane:`sidebar`}),!t&&!ae&&(0,V.jsx)(xF,{rail:ie})]})}function iF(e){let{row:t}=e,n=MP(t.kind===`task`?t.task.label:``,e.cursor&&t.kind===`task`),r=e.cursor?Mm:``;if(t.kind===`project`||t.kind===`state`)return(0,V.jsxs)(`h2`,{className:Nm({moving:e.moving,dragging:e.dragging,grab:e.drag!==void 0}),onContextMenu:e.onMenu,...e.place,...e.drag,children:[(0,V.jsxs)(`button`,{type:`button`,className:Fm,title:t.kind===`project`&&!t.noProject?t.repo:void 0,"aria-expanded":!e.collapsed,onClick:e.onClick,children:[(0,V.jsx)(`span`,{className:`truncate`,children:t.label}),t.kind===`state`&&(0,V.jsx)(`span`,{className:`font-normal text-subtle`,children:t.count}),(0,V.jsx)(fs,{right:e.collapsed,className:Im(!!e.collapsed)})]}),e.onNewTask&&t.kind===`project`&&(0,V.jsx)(`button`,{type:`button`,className:Lm,title:z(`rail.newTask`),onClick:e.onNewTask,children:`+`})]});let i=t.task,a=i.rowStatus?.kind===`running`,o=ly(i),s=NS(),c=s===`engine`,l=t.fold?.collapsed?e.rollup:i.rowStatus;return(0,V.jsxs)(`button`,{type:`button`,ref:n.ref,className:`${pi({selected:e.selected,moving:e.moving,lifted:e.dragging,grab:e.drag!==void 0})} ${r}`,onClick:e.onClick,onContextMenu:e.onMenu,onPointerEnter:n.onPointerEnter,onPointerLeave:n.onPointerLeave,...e.place,...e.drag,children:[e.guides&&(0,V.jsx)(`span`,{className:`-my-0.75 -mr-0.5 ml-0 flex flex-none self-stretch`,"aria-hidden":`true`,children:e.guides.map((e,t)=>(0,V.jsx)(`span`,{className:Sm(e)},t))}),s!==`dots`&&(0,V.jsx)(LS,{icon:e.engineIcon,name:i.engine?.name,status:c?vh(l):void 0}),(0,V.jsx)(`span`,{className:`${hi} ${e.stale?`text-subtle`:``} ${a?gi:``}`,children:t.attempt??i.label}),(0,V.jsxs)(`span`,{className:`${yi} ml-auto items-center`,children:[e.repo&&(0,V.jsx)(`span`,{className:`max-w-24 truncate text-subtle`,children:e.repo}),t.level!==void 0&&(0,V.jsx)(`span`,{className:`text-subtle`,children:t.level}),(i.extraRepoCount??0)>0&&(0,V.jsxs)(`span`,{className:`text-subtle`,title:z(`rail.extraRepos`,{count:i.extraRepoCount??0}),children:[`+`,i.extraRepoCount]}),o&&(0,V.jsxs)(`span`,{className:`text-subtle tabular-nums`,title:z(`rail.todos`,o),children:[o.done,`/`,o.total]}),t.fold?.collapsed&&(0,V.jsx)(aF,{count:t.fold.count,onUnfold:e.onToggleFold}),i.kept&&(0,V.jsx)(`span`,{className:`text-accent`,title:z(`compare.kept`),children:`✓`}),i.pinned&&(0,V.jsx)(`span`,{className:`text-subtle`,children:`▴`}),i.startsAt&&(0,V.jsx)(NP,{at:i.startsAt}),(0,V.jsx)(oj,{tasks:e.prTasks??[i],onOpen:n.hide}),!c&&(0,V.jsx)(Ph,{status:l}),e.cloud&&(0,V.jsx)(Hm,{label:e.cloud})]})]})}function aF(e){let t=G(`tasks`,`menu.expandChildren`);return(0,V.jsxs)(`span`,{role:`button`,tabIndex:-1,"aria-label":t,"aria-expanded":!1,className:`chip text-muted ${Cm}`,title:t,onClick:t=>{t.stopPropagation(),e.onUnfold()},children:[e.count,(0,V.jsx)(fs,{right:!0})]})}function oF(e,t,n){if(!t)return e;let r={label:G(`tasks`,t.collapsed?`menu.expandChildren`:`menu.collapseChildren`),section:`open`,rare:!0,run:n},i=e.map(e=>e.section).lastIndexOf(`open`);return[...e.slice(0,i+1),r,...e.slice(i+1)]}function sF(e,t){let n=e.map(e=>e.section).lastIndexOf(`open`);return[...e.slice(0,n+1),...t.map(e=>({...e,rare:!0})),...e.slice(n+1)]}function cF({children:e}){return(0,V.jsx)(`svg`,{className:`size-3.5 ${Jn}`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:e})}var lF={chat:(0,V.jsx)(`path`,{d:`M3 3.5h10a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H8l-3 2.5v-2.5H3a1 1 0 0 1-1-1v-6a1 1 0 0 1 1-1zM5 6.5h6M5 8.5h4`}),files:(0,V.jsx)(`path`,{d:`M2 4.5a1 1 0 0 1 1-1h3l1.5 1.5H13a1 1 0 0 1 1 1V12a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1z`}),file:(0,V.jsx)(`path`,{d:`M4 2h5l3 3v8a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1zM9 2v3h3M5.5 8h5M5.5 10.5h5`}),diff:(0,V.jsx)(`path`,{d:`M3.5 2.5h9a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1h-9a1 1 0 0 1-1-1v-9a1 1 0 0 1 1-1zM8 5v4M6 7h4M6 11h4`}),browser:(0,V.jsx)(`path`,{d:`M8 2a6 6 0 1 0 0 12A6 6 0 0 0 8 2zM2 8h12M8 2c2.2 2 2.2 10 0 12M8 2c-2.2 2-2.2 10 0 12`}),quota:(0,V.jsx)(`path`,{d:`M2 10a6 6 0 1 1 12 0M8 10l2.5-3.5M4 13h8`})};function uF(e){let t=vs(e);return t?ys(t):z(`panel.browser`)}var dF=7.3,fF=22,pF=160,mF=2,hF=24;function gF(e,t){let n=0;for(let t of e){let e=0;for(let n of t)e+=(n.codePointAt(0)??0)>11903?2:1;n+=Math.min(pF,fF+e*dF)+mF}return n<=t}function _F(e,t,n){let r=[{label:z(`panel.close`),section:`close`,run:()=>Uc(e,n.id)}];return t.tabs.length>1&&r.push({label:z(`panel.closeOthers`),section:`close`,run:()=>Hc(e,e=>js(e,n.id))}),r}function vF({taskId:e,column:t}){B();let n=(0,h.useRef)(null),r=(0,h.useRef)(null),[i,a]=(0,h.useState)(0);(0,h.useEffect)(()=>{let e=n.current;if(!e)return;let t=new ResizeObserver(([e])=>a(e?.contentRect.width??0));return t.observe(e),()=>t.disconnect()},[]);let o=i>0&&!gF(t.tabs.map(uF),i-hF);return(0,h.useEffect)(()=>{r.current?.querySelector(`.is-active`)?.scrollIntoView({block:`nearest`,inline:`nearest`})},[t.active,t.tabs.length,o]),(0,V.jsxs)(`div`,{className:rr,ref:n,children:[(0,V.jsx)(`div`,{className:ir,role:`tablist`,"aria-label":z(`panel.tabs`),ref:r,children:t.tabs.map(n=>{let r=n.id===t.active;return(0,V.jsxs)(`div`,{role:`presentation`,className:ar({active:r,compact:o}),onMouseDown:e=>{e.button===1&&e.preventDefault()},onAuxClick:t=>{t.button===1&&(t.preventDefault(),Uc(e,n.id))},onContextMenu:r=>nF(r,_F(e,t,n)),children:[(0,V.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":r,className:or(r),title:vs(n)||uF(n),onClick:()=>Hc(e,e=>xs(e,n.id)),children:(0,V.jsx)(`span`,{className:sr,children:uF(n)})}),(0,V.jsx)(`button`,{type:`button`,className:cr(r),"aria-label":z(`panel.close`),tabIndex:-1,onClick:()=>Uc(e,n.id),children:`×`})]},n.id)})}),(0,V.jsx)(`button`,{type:`button`,className:Yn({tool:!0}),title:z(`panel.new`),"aria-label":z(`panel.new`),onClick:()=>Hc(e,ws),children:(0,V.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,V.jsx)(`path`,{d:`M8 3.5v9M3.5 8h9`})})})]})}function yF({edge:e,className:t,...n}){return(0,V.jsx)(`div`,{"data-grip":``,className:Ft(`absolute inset-y-0 z-5 w-1.5 cursor-col-resize touch-none`,`after:absolute after:inset-y-0 after:w-0.5 after:bg-line-active after:opacity-0 after:transition-opacity after:duration-120`,`hover:after:opacity-100 hover:after:delay-250 active:after:bg-accent active:after:opacity-100 active:after:delay-0`,e===`right`?`right-0 after:right-0`:`left-0 after:left-0`,t),...n})}var bF=400;function xF({rail:e}){B();let t=(0,h.useRef)(null),n=(0,h.useRef)(0),r=(0,h.useRef)(null);return(0,V.jsx)(yF,{edge:`right`,title:z(`layout.railResize`),onPointerDown:n=>{t.current={x:n.clientX,width:e.current?.getBoundingClientRect().width??0,moved:!1},n.currentTarget.setPointerCapture(n.pointerId),ue(!0)},onPointerMove:e=>{let n=t.current;!n||e.clientX===n.x||(n.moved=!0,mM.set(bM(n.width+e.clientX-n.x)))},onPointerUp:()=>{let e=t.current;if(t.current=null,!e)return;if(e.moved){n.current=0;return}let i=Date.now();r.current!==null&&window.clearTimeout(r.current),r.current=null,i-n.current<bF?(n.current=0,mM.set(null)):(n.current=i,r.current=window.setTimeout(()=>hM.set(!0),bF))},onLostPointerCapture:()=>ue(!1)})}function SF({side:e}){return(0,V.jsxs)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,V.jsx)(`rect`,{x:`1.5`,y:`2.5`,width:`13`,height:`11`,rx:`2.5`}),(0,V.jsx)(`path`,{d:e===`left`?`M6 2.5v11`:`M10 2.5v11`})]})}function CF({model:e}){B();let t=y(qT),n=y(hM),r=y(e.tasks),i=t=>YT(e,t),a=z(n?`layout.railUnfold`:`layout.railFold`),o=n&&(r?.tasks??[]).some(bh);return(0,V.jsxs)(`div`,{className:Xn,onMouseEnter:()=>n&&gM.get()&&yM(!0),onMouseLeave:()=>n&&gM.get()&&yM(!1),children:[(0,V.jsxs)(`button`,{type:`button`,className:Yn(),title:a,"aria-label":a,onClick:()=>hM.set(!n),children:[(0,V.jsx)(SF,{side:`left`}),o&&(0,V.jsx)(`span`,{className:`absolute top-0.75 right-0.75 size-1.5 rounded-full bg-accent`})]}),(0,V.jsx)(`button`,{type:`button`,className:Yn(),title:z(`layout.navBack`),"aria-label":z(`layout.navBack`),disabled:KT(t,-1,i)<0,onClick:()=>QT(e,-1),children:(0,V.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,V.jsx)(`path`,{d:`M10 3.5 5.5 8l4.5 4.5`})})}),(0,V.jsx)(`button`,{type:`button`,className:Yn(),title:z(`layout.navForward`),"aria-label":z(`layout.navForward`),disabled:KT(t,1,i)<0,onClick:()=>QT(e,1),children:(0,V.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,V.jsx)(`path`,{d:`M6 3.5 10.5 8 6 12.5`})})})]})}var wF=(0,V.jsx)(`path`,{d:`M3 3.5h10a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-7a1 1 0 0 1 1-1zM4.5 6.5 6.5 8l-2 1.5M8 10h3`});function TF({taskId:e,title:t}){B();let n=y(ec);return(0,V.jsxs)(`div`,{className:Gt,children:[(0,V.jsxs)(`button`,{type:`button`,className:`mono ${Kt}`,"aria-label":Tl(`narrowBack`),onClick:me,children:[(0,V.jsx)(`span`,{className:`flex-none text-accent`,children:t?`‹`:`‹ ${Tl(`narrowBack`)}`}),t&&(0,V.jsx)(`span`,{className:`truncate font-sans text-body font-normal text-ink`,children:t})]}),e&&(0,V.jsx)(`span`,{className:`mono ml-auto flex flex-none gap-0.5`,role:`tablist`,children:[`terminal`,...$s].map(t=>{let r=z(t===`terminal`?`layout.narrowTerminal`:`panel.${t}`);return(0,V.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":n===t,"aria-label":r,title:r,className:qt,onClick:()=>t===`terminal`?ec.set(t):Fc(e,t),children:(0,V.jsx)(cF,{children:t===`terminal`?wF:lF[t]})},t)})})]})}function EF({title:e}){return B(),(0,V.jsxs)(`button`,{type:`button`,className:pi({}),onClick:pe,children:[(0,V.jsx)(`span`,{className:`${_i} font-bold text-accent`,children:`↩`}),(0,V.jsx)(`span`,{className:mi,children:El(`recentJump`,{title:e})})]})}function DF({pane:e}){B();let{prefs:t}=yp(),n=y(VT)[e];if(!t.keyHints)return null;let r=zT(e,n?`always`:`firstUse`);return r.length===0?null:(0,V.jsx)(`p`,{className:`mono text-muted ${Jt}`,children:(0,V.jsx)(rp,{text:r.map(e=>`${ca(e.cap)} ${bl(`pane.${e.msg}`)}`).join(` · `)})})}function OF(e,t,n){let r=n.width/t.width,i=n.height/t.height,a=Math.min(n.width,Math.max(0,Math.round(e.left*r))),o=Math.min(n.height,Math.max(0,Math.round(e.top*i)));return{x:a,y:o,width:Math.min(n.width-a,Math.round(e.width*r)),height:Math.min(n.height-o,Math.round(e.height*i))}}function kF(e,t,n){let r={left:0,top:0,width:n.innerWidth,height:n.innerHeight},i={left:(n.outerWidth-n.innerWidth)/2,top:n.outerHeight-n.innerHeight},a={...i,width:n.outerWidth,height:n.outerHeight},o={left:n.screenX+i.left,top:n.screenY+i.top,...n.screen},s={browser:r,window:a,monitor:o}[e??``];if(s)return s;let c=e=>Math.abs(e.width/e.height-t.width/t.height);return[r,a,o].reduce((e,t)=>c(t)<c(e)?t:e)}function AF(){return typeof navigator.mediaDevices?.getDisplayMedia==`function`}async function jF(e,t){let n=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:`browser`},preferCurrentTab:!0,selfBrowserSurface:`include`});try{let r=document.createElement(`video`);r.muted=!0,r.srcObject=n,await r.play();let i={width:r.videoWidth,height:r.videoHeight},a=e.getBoundingClientRect(),o=kF(n.getVideoTracks()[0]?.getSettings().displaySurface,i,window),s=OF({left:a.left+o.left,top:a.top+o.top,width:a.width,height:a.height},o,i),c=document.createElement(`canvas`);c.width=s.width,c.height=s.height,c.getContext(`2d`)?.drawImage(r,s.x,s.y,s.width,s.height,0,0,s.width,s.height);let l=await new Promise(e=>c.toBlob(e,`image/png`));if(!l)throw Error(`empty capture`);return new File([l],t,{type:`image/png`})}finally{for(let e of n.getTracks())e.stop()}}var MF=new Set,NF=2e3;function PF(e){MF.add(e)}function FF(e,t=NF){setTimeout(()=>MF.delete(e),t)}var IF=e=>MF.has(e),LF=new Map,RF=new Set,zF=(e,t)=>`${e}/${t}`,BF=e=>LF.get(e)??``;function VF(e,t){t===``?LF.delete(e):LF.set(e,t);for(let e of RF)e()}function HF(e){return RF.add(e),()=>RF.delete(e)}function UF(e,t){let n=BF(e).trimEnd();VF(e,n===``?t:`${n}\n\n${t}`)}function WF(e,t,n,r,i,a){let o=n.length-t.length;return{base:n,spans:[...e?.base===t?e.spans.filter(([e,t])=>t<=r||e>=i).map(([e,t])=>e>=i?[e+o,t+o]:[e,t]):[],a]}}async function GF(e,t,n){if(n===t.base)return;let r;try{r=(await e.request(`voice.learn`,{base:t.base,spans:t.spans,sent:n})).learned??[]}catch{return}r.length!==0&&I(z(`voice.learned`,{pairs:r.map(e=>z(`voice.learnedPair`,{spoken:e.spoken,term:e.term})).join(`, `)}),`info`,{label:z(`voice.undo`),run:()=>void e.request(`voice.unlearn`,{learned:r}).then(()=>I(z(`voice.unlearned`)),()=>I(z(`voice.unlearnFailed`),`error`))})}function KF({model:e,taskId:t,tabId:n}){let r=y(e.tasks)?.tasks.find(e=>e.id===t)!==void 0,i=zF(t,n),a=(0,h.useSyncExternalStore)(HF,()=>BF(i)),[o,s]=(0,h.useState)(!1),{attachments:c,attach:l,remove:u,ready:d,clear:f}=au(e,e=>I(e,`error`)),p=(0,h.useRef)(null),m=dv(e.client),[g,_]=(0,h.useState)(!1),v=p_({value:a,onChange:e=>VF(i,e),area:p,listClassName:`m-0`}),b=(0,h.useRef)(null),x=e=>{let t=p.current,n=t?.selectionStart??a.length,r=t?.selectionEnd??a.length,o=n>0&&!/\s$/.test(a.slice(0,n))?` `:``,s=`${a.slice(0,n)}${o}${e}${a.slice(r)}`;VF(i,s);let c=n+o.length+e.length;b.current=WF(b.current,a,s,n,r,[n+o.length,c]),requestAnimationFrame(()=>t?.setSelectionRange(c,c))},S=async e=>{let t=a.trim()?`${a.trimEnd()} ${e}`:e;await w(t)||VF(i,t)},C=e=>void S(e),w=async(r=a)=>{s(!0);try{let a=eu(r.trim(),await d()).trim();if(!a)return!1;let o=await e.client.request(`tab.send`,{taskId:t,tabId:n,prompt:a});return o.delivered?(VF(i,``),f(),_(!1),b.current&&GF(e.client,b.current,r),b.current=null,!0):(I(z(`layout.composerNotSent`,{reason:o.reason??``}),`error`),!1)}catch(e){let t=e instanceof Ho?e.code:void 0;return I(t===`UNKNOWN_OP`?z(`layout.composerOldBridge`):t===`AWAITING_PERMISSION`?z(`layout.composerAtMenu`):e instanceof Error?e.message:String(e),`error`),!1}finally{s(!1)}};if(!r)return null;let T=l,E={client:e.client,context:()=>({draft:a,taskId:t,tabId:n}),onText:e=>void x(e),disabled:o},D=m===!0&&!g&&a===``,O=()=>{(0,tj.flushSync)(()=>_(!0)),p.current?.focus()};return(0,V.jsx)(U_,{value:a,placeholder:z(`layout.composerPlaceholder`),sendLabel:z(`layout.composerSend`),busy:o,ready:a.trim()!==``||c.length>0,attached:(0,V.jsx)(ou,{attachments:c,onRemove:u}),attach:(0,V.jsxs)(Ql,{className:T_(),title:z(`layout.composerAttach`),disabled:o,onFiles:T,children:[(0,V.jsx)(`span`,{className:`sr-only`,children:z(`layout.composerAttach`)}),(0,V.jsx)(j_,{})]}),dictate:(0,V.jsx)(pv,{...E,look:E_,face:e=>(0,V.jsx)(V_,{state:e})}),voice:D?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(pv,{...E,onSend:C,look:D_,onTap:O,idle:z(`voice.holdOrType`),face:e=>(0,V.jsx)(B_,{state:e,idle:z(`voice.holdOrType`),working:z(`voice.working`),slide:z(`voice.slideToSend`),release:z(`voice.tipSend`)})}),(0,V.jsx)(M_,{label:z(`layout.composerSend`),disabled:o||c.length===0})]}):void 0,composerKey:i,fieldRef:p,suggest:v.list,...v.field,onPaste:Zl(T).onPaste,onBlur:()=>a===``&&_(!1),onSend:()=>void w()})}var qF={up:`layout.termKeyUp`,down:`layout.termKeyDown`,left:`layout.termKeyLeft`,right:`layout.termKeyRight`,interrupt:`layout.termKeyInterrupt`,enter:`layout.termKeyEnter`};function JF({handle:e,atMenu:t}){B();let[n,r]=(0,h.useState)(!1);(0,h.useEffect)(()=>{e.armCtrl(n?()=>r(!1):null)},[e,n]),(0,h.useEffect)(()=>()=>e.armCtrl(null),[e]);let{term:i}=e,a=e=>(0,V.jsx)(`button`,{type:`button`,className:nn(!1),"aria-label":qF[e.id]?z(qF[e.id]):void 0,onClick:()=>{r(!1),i.input(e.bytes(i.modes.applicationCursorKeysMode),!0)},children:e.cap},e.id);return(0,V.jsxs)(`div`,{className:`mono ${tn}`,role:`toolbar`,"aria-label":z(`layout.termKeys`),onPointerDown:e=>e.preventDefault(),children:[t&&Jf.map(a),(0,V.jsx)(`button`,{type:`button`,className:nn(n),"aria-pressed":n,onClick:()=>r(!n),children:`ctrl`}),Kf.filter(e=>!(t&&Jf.includes(e))).map(a)]})}var YF={background:`#141413`,foreground:`#eae7df`,cursor:`#cc785c`,cursorAccent:`#141413`,selectionBackground:`#33312e`,black:`#141413`,red:`#ec6f74`,green:`#9aca86`,yellow:`#e8c96b`,blue:`#61aaf2`,magenta:`#9b87f5`,cyan:`#d4967e`,white:`#a9a39a`,brightBlack:`#6b665f`,brightRed:`#ec6f74`,brightGreen:`#9aca86`,brightYellow:`#e8c96b`,brightBlue:`#61aaf2`,brightMagenta:`#9b87f5`,brightCyan:`#e0ab96`,brightWhite:`#eae7df`},XF=`Rove Nerd Symbols`,ZF=[`"JetBrains Mono"`,`"${XF}"`,`"SF Mono"`,`ui-monospace`,`Menlo`,`monospace`].join(`, `);function QF(e){switch(e.kind){case`restored`:return z(`workspace.restored`);case`notLive`:return z(`workspace.tabNotLive`);case`exited`:return z(`workspace.exited`,{code:e.code??`?`});case`failed`:return z(`workspace.attachFailed`,{message:e.message});case`none`:return``}}function $F(e){B();let{notice:t,engineExit:n,model:r,taskId:i,tabId:a,revive:o}=e,s=t.kind===`none`?n:null,c=t.kind===`none`&&!s&&e.usageLimit===!0&&!o.error,[l,u]=(0,h.useState)(!1);if(t.kind===`none`&&!s&&!c)return null;let d=c?r.tasks.get()?.attention.find(e=>e.taskId===i&&e.state===`rate_limited`)?.resumeAt:void 0,f=t.kind===`notLive`||t.kind===`restored`||t.kind===`exited`,p=t.kind===`exited`||s!==null,m=o.error?z(`workspace.reopenFailed`,{message:o.error}):s?z(`workspace.engineExited`,{code:s.code??`?`}):c?d?z(`workspace.usageLimitUntil`,{time:new Date(d).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}):z(`workspace.usageLimit`):QF(t);return(0,V.jsxs)(`div`,{className:Fn(t.kind===`failed`||!!o.error),children:[(0,V.jsx)(`span`,{children:m}),e.onReopen&&(f||s)&&(0,V.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,disabled:o.busy,onClick:()=>e.onReopen?.(s!==null),children:o.busy?z(`workspace.reopening`):z(s?`workspace.retry`:`workspace.reopen`)}),t.kind===`failed`&&e.onRetryAttach&&(0,V.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:e.onRetryAttach,children:z(`workspace.retry`)}),c&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(H,{variant:`link`,hit:`tight`,onClick:()=>C.set((0,V.jsx)(ad,{model:r,taskId:i,context:`continue`,sourceTabId:a})),children:z(`menu.continueEngine`)}),(0,V.jsx)(H,{variant:`link`,hit:`tight`,disabled:l,onClick:()=>{u(!0),r.client.request(`task.resumeQuota`,{taskId:i}).catch(e=>I(e instanceof Error?e.message:String(e),`error`)).finally(()=>u(!1))},children:z(l?`workspace.resumingQuota`:`workspace.resumeQuota`)}),(0,V.jsx)(H,{variant:`link`,hit:`tight`,onClick:e.onDismissLimit,children:z(`workspace.dismiss`)})]}),p&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>C.set((0,V.jsx)(mT,{model:r,section:`engines`})),children:z(`workspace.engineSettings`)}),(0,V.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>C.set((0,V.jsx)(ad,{model:r,taskId:i})),children:z(`menu.newChatPick`)}),(0,V.jsx)(H,{variant:`link`,hit:`tight`,onClick:()=>C.set((0,V.jsx)(ad,{model:r,taskId:i,context:`continue`,sourceTabId:a})),children:z(`menu.continueEngine`)})]})]})}function eI(e){let t=e.split(`
|
|
63
63
|
`).map(e=>e.trimEnd());for(;t[0]===``;)t.shift();for(;t.at(-1)===``;)t.pop();if(t.length===0)return null;let n=Math.max(0,...Array.from(t.join(`
|
|
@@ -80,4 +80,4 @@ Then look for the hook that older version installed. Check my engine settings fi
|
|
|
80
80
|
`)}function vB(e,t){return e.text===``?_B(e,t):e.text}function yB(e,t,n,r){return`# ${e}\n\n${t.map(e=>`${`## ${r[e.role]}${e.at?` · ${e.at}`:``}`}\n\n${_B(e,n)}`).join(`
|
|
81
81
|
|
|
82
82
|
`)}\n`}var bB=50;function xB(e,t){let[n,r]=(0,h.useState)({kind:`loading`}),[i,a]=(0,h.useState)(!1),o=(0,h.useRef)(n);o.current=n;let s=(0,h.useRef)(!1),c=(0,h.useRef)(0),l=(0,h.useCallback)(n=>e.client.request(`output.read`,{taskId:t,limit:bB,...n}),[e,t]),u=(0,h.useCallback)(async()=>{let e=++c.current;s.current=!0;try{let t=await l({});if(e!==c.current)return;if(t.source===`terminal`||!t.history){r({kind:`terminal`,tail:t.terminal?.tail??[]});return}let n=fB(aB,t.history.messages??[],t.history.firstIndex??0);r({kind:`ready`,transcript:n,cursor:t.cursor??null,older:t.olderCursor??null})}catch(t){e===c.current&&r({kind:`error`,message:W(t)})}finally{e===c.current&&(s.current=!1)}},[l]);(0,h.useEffect)(()=>(r({kind:`loading`}),u(),()=>{c.current++,s.current=!1}),[u]);let d=(0,h.useCallback)(async()=>{let e=o.current;if(s.current)return;if(e.kind===`terminal`)return u();if(e.kind!==`ready`||!e.cursor)return;let t=c.current;s.current=!0;try{let n=await l({cursor:e.cursor,source:`history`});if(t!==c.current)return;r(e=>e.kind===`ready`?{...e,transcript:fB(e.transcript,n.history?.messages??[],n.history?.firstIndex??0),cursor:n.cursor??e.cursor}:e)}catch{t===c.current&&(s.current=!1,await u())}finally{t===c.current&&(s.current=!1)}},[l,u]);return{state:n,paging:i,loadOlder:(0,h.useCallback)(async()=>{let e=o.current;if(s.current||e.kind!==`ready`||!e.older)return;let t=c.current;s.current=!0,a(!0);try{let n=await l({cursor:e.older,source:`history`});if(t!==c.current)return;r(e=>e.kind===`ready`?{...e,transcript:fB(e.transcript,n.history?.messages??[],n.history?.firstIndex??0),older:n.olderCursor??null}:e)}catch(e){t===c.current&&r({kind:`error`,message:W(e)})}finally{t===c.current&&(s.current=!1,a(!1))}},[l]),loadAll:(0,h.useCallback)(async()=>{let e=o.current;if(e.kind!==`ready`)return null;if(s.current||!e.older)return e.transcript;let t=c.current;s.current=!0,a(!0);let n=[],i=e.transcript;try{for(let r=e.older;r&&t===c.current;){let e=await l({cursor:r,source:`history`}),t={messages:e.history?.messages??[],firstIndex:e.history?.firstIndex??0};n.push(t),i=fB(i,t.messages,t.firstIndex),r=e.olderCursor??null}return t===c.current?(r(e=>e.kind===`ready`?{...e,transcript:n.reduce((e,t)=>fB(e,t.messages,t.firstIndex),e.transcript),older:null}:e),i):null}catch(e){return t===c.current&&r({kind:`error`,message:W(e)}),null}finally{t===c.current&&(s.current=!1,a(!1))}},[l]),refresh:d,reload:(0,h.useCallback)(()=>{r({kind:`loading`}),u()},[u])}}var SB=3e3,CB=80,wB=2500;function TB(e,t){let n=URL.createObjectURL(new Blob([t],{type:`text/markdown;charset=utf-8`})),r=document.createElement(`a`);r.href=n,r.download=e,r.click(),URL.revokeObjectURL(n)}var EB=e=>{let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})};function DB(e){let{entry:t}=e,n=z(t.role===`user`?`transcript.you`:t.role===`assistant`?`transcript.agent`:`transcript.system`);return(0,V.jsxs)(`article`,{className:iR(e),"data-index":t.index,children:[(0,V.jsxs)(`header`,{className:aR,children:[(0,V.jsx)(`span`,{className:oR(t.role),children:n}),(0,V.jsx)(`span`,{className:sR,children:EB(t.at)}),(0,V.jsx)(H,{className:cR,onClick:e.onCopy,children:z(`transcript.copy`)})]}),t.text!==``&&(0,V.jsx)(kR,{source:t.text,needle:e.needle}),t.tools.map((t,n)=>(0,V.jsxs)(`p`,{className:lR,title:`${t.name} ${t.summary}`,children:[(0,V.jsx)(`span`,{className:uR,children:CR(t.name,e.needle)}),(0,V.jsx)(`span`,{className:dR,children:CR(t.summary,e.needle)}),e.failed.has(t.callId)&&(0,V.jsx)(`span`,{className:`flex-none text-error`,children:z(`transcript.failed`)})]},n))]})}function OB({model:e,task:t,active:n}){B();let r=xB(e,t.id),{state:i}=r,[a,o]=(0,h.useState)(``),[s,c]=(0,h.useState)(0),[l,u]=(0,h.useState)(null),d=(0,h.useRef)(null),f=(0,h.useRef)(!0),p=(0,h.useRef)(null),m=y(Dy),g=i.kind===`ready`?i:null,_=(0,h.useMemo)(()=>g?.transcript.entries??[],[g?.transcript]),v=g?.transcript.failed??new Set,b=(0,h.useMemo)(()=>pB(_,a),[_,a]),x=b.length===0?0:Math.min(s,b.length-1),S=b[x]??null,C=e=>{f.current=!1,d.current?.querySelector(`[data-index="${e}"]`)?.scrollIntoView({block:`center`})},w=t.rowStatus?.kind,T=w===`running`||w===`needs-input`,{refresh:E}=r;(0,h.useEffect)(()=>{n&&E()},[n,w,E]),(0,h.useEffect)(()=>{if(!n||!T)return;let e=setInterval(()=>void E(),SB);return()=>clearInterval(e)},[n,T,E]),(0,h.useLayoutEffect)(()=>{let e=d.current;e&&(p.current?(e.scrollTop=p.current.top+(e.scrollHeight-p.current.height),p.current=null):f.current&&(e.scrollTop=e.scrollHeight))},[_]);let D=async()=>{let e=d.current;e&&(p.current={height:e.scrollHeight,top:e.scrollTop}),await r.loadOlder()};(0,h.useEffect)(()=>{if(!m||m.taskId!==t.id||!g||!n)return;let e=hB(_,m.hit);e===null?g.older&&gB(_,m.hit)?D():Dy.set(null):(u(e),C(e),Dy.set(null))},[m,g,_,n,t.id]),(0,h.useEffect)(()=>{if(l===null)return;let e=setTimeout(()=>u(null),wB);return()=>clearTimeout(e)},[l]),(0,h.useEffect)(()=>{c(0);let e=pB(_,a)[0];e!==void 0&&C(e)},[a]);let O=e=>{if(b.length===0)return;let t=(x+e+b.length)%b.length;c(t),C(b[t])},k=e=>{e.key===`Enter`&&!e.nativeEvent.isComposing?(e.preventDefault(),O(e.shiftKey?-1:1)):e.key===`Escape`&&a!==``&&(e.stopPropagation(),o(``))},A=e=>void navigator.clipboard.writeText(vB(e,v)).then(()=>I(z(`transcript.copied`)),()=>I(z(`menu.copyFailed`),`error`)),ee=async()=>{let e=await r.loadAll();if(!e)return;let n={user:z(`transcript.you`),assistant:z(`transcript.agent`),system:z(`transcript.system`)};TB(`${t.label.replace(/[^\p{L}\p{N}]+/gu,`-`).replace(/^-|-$/g,``)||`conversation`}.md`,yB(t.label,e.entries,e.failed,n))};return i.kind===`loading`?(0,V.jsx)(`div`,{className:QL,children:(0,V.jsx)(`p`,{className:nR,children:z(`transcript.loading`)})}):i.kind===`error`?(0,V.jsxs)(`div`,{className:QL,children:[(0,V.jsx)(`p`,{className:`${nR} text-error`,children:z(`transcript.error`,{error:i.message})}),(0,V.jsx)(`p`,{className:nR,children:(0,V.jsx)(H,{onClick:r.reload,children:z(`transcript.retry`)})})]}):i.kind===`terminal`?(0,V.jsxs)(`div`,{className:QL,children:[(0,V.jsx)(`p`,{className:nR,children:z(`transcript.noHistory`)}),(0,V.jsx)(`pre`,{className:`${rR} min-h-0 flex-1 overflow-y-auto`,children:i.tail.join(`
|
|
83
|
-
`)})]}):(0,V.jsxs)(`div`,{className:QL,children:[(0,V.jsxs)(`div`,{className:$L,children:[(0,V.jsx)(`input`,{className:`${jr} ${eR}`,value:a,placeholder:z(`transcript.findPlaceholder`),"aria-label":z(`transcript.findPlaceholder`),spellCheck:!1,autoComplete:`off`,onChange:e=>o(e.target.value),onKeyDown:k}),a.trim()!==``&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`whitespace-nowrap text-muted`,children:b.length===0?z(`transcript.findNone`):z(`transcript.findCount`,{at:x+1,total:b.length})}),(0,V.jsx)(H,{onClick:()=>O(-1),disabled:b.length===0,children:z(`transcript.prev`)}),(0,V.jsx)(H,{onClick:()=>O(1),disabled:b.length===0,children:z(`transcript.next`)})]}),(0,V.jsx)(H,{onClick:()=>void ee(),disabled:_.length===0,children:z(`transcript.export`)})]}),(0,V.jsxs)(`div`,{ref:d,className:tR,onScroll:e=>{let t=e.currentTarget;f.current=t.scrollHeight-t.scrollTop-t.clientHeight<CB,t.scrollTop<CB&&g?.older&&!r.paging&&D()},children:[g?.older&&(0,V.jsx)(`p`,{className:`m-0 px-3 py-2 font-mono text-meta text-subtle`,children:(0,V.jsx)(H,{onClick:()=>void D(),disabled:r.paging,children:z(`transcript.older`)})}),_.length===0&&(0,V.jsx)(`p`,{className:`m-0 px-3 py-2 font-mono text-meta text-subtle`,children:z(`transcript.empty`)}),_.map(e=>(0,V.jsx)(DB,{entry:e,failed:v,needle:a,flash:l===e.index,current:S===e.index,onCopy:()=>A(e)},e.index))]})]})}var kB={working:`review.scopeWorking`,branch:`review.scopeBranch`,task:`review.scopeTask`};function AB(e){return e.kind===`file`?{text:Rs(e.path),hint:e.path}:e.kind===`diff`?e.path===`.`?{text:z(kB[e.scope]),hint:z(`preview.whole`)}:{text:Rs(e.path),hint:e.path}:{text:z(`panel.${e.kind}`),hint:z(`panel.${e.kind}`)}}function jB({taskId:e,kind:t,expand:n}){B();let r=y(ac),i=z(r?`panel.restore`:`panel.expand`);return(0,V.jsxs)(V.Fragment,{children:[n&&(0,V.jsx)(`button`,{type:`button`,className:Yn({tool:!0}),title:i,"aria-label":i,"aria-pressed":r,onClick:()=>ac.set(!r),children:(0,V.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,V.jsx)(`path`,{d:r?`M13.5 6.5h-4v-4M2.5 9.5h4v4M9.5 6.5l4-4M6.5 9.5l-4 4`:`M9.5 2.5h4v4M6.5 13.5h-4v-4M13.5 2.5l-4.5 4.5M2.5 13.5 7 9`})})}),(0,V.jsx)(`button`,{type:`button`,className:Yn({tool:!0}),title:z(`panel.close`),"aria-label":z(`panel.close`),onClick:()=>Vc(e,t),children:(0,V.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,V.jsx)(`path`,{d:`M4 4l8 8M12 4l-8 8`})})})]})}function MB({taskId:e,column:t,narrow:n}){if(B(),t.kind===`browser`)return(0,V.jsxs)(`div`,{className:tr(n),children:[(0,V.jsx)(vF,{taskId:e,column:t}),!n&&(0,V.jsx)(jB,{taskId:e,kind:`browser`,expand:!0})]});if(n&&t.kind!==`diff`)return null;let{text:r,hint:i}=AB(t);return(0,V.jsxs)(`div`,{className:tr(n),children:[(0,V.jsx)(`span`,{className:nr,title:i,children:r}),(0,V.jsx)(jB,{taskId:e,kind:t.kind,expand:!n})]})}function NB({model:e,task:t,column:n}){let r=(0,h.useRef)([]);return r.current=Ms(r.current,n.active,n.tabs),n.tabs.filter(e=>r.current.includes(e.id)).map(r=>(0,V.jsx)(`div`,{className:dr,hidden:r.id!==n.active,children:(0,V.jsx)(EI,{model:e,taskId:t.id,tab:r,onNavigate:e=>Hc(t.id,t=>Es(t,r.id,e)),onStep:e=>Hc(t.id,t=>Ds(t,r.id,e))})},r.id))}function PB({model:e,task:t,column:n,narrow:r,restored:i}){return n.kind===`browser`?(0,V.jsx)(NB,{model:e,task:t,column:n}):(0,V.jsxs)(`div`,{className:dr,children:[n.kind===`files`&&(0,V.jsx)(jL,{model:e,task:t,narrow:r}),n.kind===`chat`&&(0,V.jsx)(OB,{model:e,task:t,active:!0}),n.kind===`quota`&&(0,V.jsx)(QI,{model:e,task:t,active:!0}),n.kind===`file`&&(0,V.jsx)(iB,{model:e,view:{taskId:t.id,path:n.path,scope:`working`,file:!0},active:!0,restored:i,onClose:()=>Vc(t.id,`file`)},`${t.id}:file:${n.path}:${n.at??``}`),n.kind===`diff`&&(0,V.jsx)(iB,{model:e,view:{taskId:t.id,path:n.path,scope:n.scope},active:!0,restored:i,onClose:()=>Vc(t.id,`diff`)},`${t.id}:${n.path}:${n.scope}:${n.at??``}`)]})}function FB({taskId:e,kinds:t,index:n,body:r,slot:i}){B();let a=(0,h.useRef)(null);return(0,V.jsx)(`div`,{className:ur,style:{gridColumn:i},title:z(`panel.resizeSplit`),onPointerDown:e=>{let n=t.map(e=>r.current?.querySelector(`[data-kind="${e}"]`)?.getBoundingClientRect().width??0);a.current={x:e.clientX,widths:n},r.current?.classList.add(`is-resizing`),e.currentTarget.setPointerCapture(e.pointerId)},onPointerMove:t=>{let r=a.current;if(!r)return;let i=Qs(r.widths,n,t.clientX-r.x,220);Pc(e,e=>Xs(e,i))},onLostPointerCapture:()=>{a.current=null,r.current?.classList.remove(`is-resizing`)},onDoubleClick:()=>Pc(e,Zs)})}function IB({panel:e}){B();let t=(0,h.useRef)(null);return(0,V.jsx)(yF,{edge:`left`,title:z(`panel.resize`),onPointerDown:n=>{t.current={x:n.clientX,width:e.current?.getBoundingClientRect().width??0},e.current?.classList.add(`is-resizing`),n.currentTarget.setPointerCapture(n.pointerId),ue(!0)},onPointerMove:e=>{let n=t.current;if(!n||e.clientX===n.x)return;let r=hM.get()?0:bM(mM.get()??280);rc.set(oc(n.width-(e.clientX-n.x),r))},onLostPointerCapture:()=>{t.current=null,e.current?.classList.remove(`is-resizing`),ue(!1)},onDoubleClick:()=>rc.set(null)})}var LB=e=>e.kind===`diff`?`diff:${e.path}:${e.scope}`:e.kind===`file`?`file:${e.path}`:e.kind;function RB({model:e,task:t,narrow:n}){B();let r=Ac(t.id),i=y(ec),a=y(ac),o=(0,h.useRef)(null),s=(0,h.useRef)(null),c=i===`terminal`?`files`:i,l=n?Ls(r,c):void 0;(0,h.useEffect)(()=>{n&&!l&&Pc(t.id,e=>Hs(e,c))},[n,l,c,t.id]);let u=n?l?[l]:[]:r.columns,d=u.map(e=>e.kind),f=(n?[1]:Ys(r)).map((e,t)=>`${t>0?`var(--divider) `:``}minmax(0, ${e}fr)`).join(` `),p=(0,h.useRef)(u.map(LB));return(0,V.jsxs)(`aside`,{className:Qn(n),ref:o,children:[!n&&!a&&(0,V.jsx)(IB,{panel:o}),(0,V.jsxs)(`div`,{className:$n,ref:s,style:{gridTemplateColumns:f},children:[u.map(r=>(0,V.jsxs)(`section`,{className:er,"data-kind":r.kind,style:{gridColumn:2*d.indexOf(r.kind)+1},children:[(0,V.jsx)(MB,{taskId:t.id,column:r,narrow:n}),(0,V.jsx)(PB,{model:e,task:t,column:r,narrow:n,restored:p.current.includes(LB(r))})]},r.kind)),!n&&u.slice(1).map((e,n)=>(0,V.jsx)(FB,{taskId:t.id,kinds:d,index:n,body:s,slot:2*n+2},`divider:${e.kind}`))]})]})}function zB({model:e,task:t,remoteHost:n,narrow:r=!1}){let i=y(j),a=jc(t?.id??null);return!r&&(i||!a)?null:t?(0,V.jsx)(RB,{model:e,task:t,narrow:r},t.id):n?(0,V.jsx)(`aside`,{className:Qn(!1),children:(0,V.jsx)(Um,{host:n,onMachines:()=>zv(e)})}):null}var BB=1500;function VB({model:e}){let t=e.client,n=y(t.conn),[r,i]=(0,h.useState)(!1);return(0,h.useEffect)(()=>{if(n.state!==`connecting`)return i(!1);let e=window.setTimeout(()=>i(!0),BB);return()=>window.clearTimeout(e)},[n.state]),n.state===`open`||n.state===`connecting`&&!r?null:(0,V.jsxs)(`footer`,{className:In,children:[(0,V.jsx)(`span`,{className:Ln(n.state===`retrying`)}),(0,V.jsx)(`span`,{children:n.state===`retrying`?z(`status.retrying`,{count:n.failures}):z(`status.connecting`)}),n.state===`retrying`&&(0,V.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>t.retryNow(),children:z(`status.retry`)})]})}var HB=`rove.web.update.skipped`,UB=`rove.web.update.askedAt`;function WB(e){return!e.latest||!e.notify||e.latest===e.skipped||e.askedAt!==null&&e.now-e.askedAt<18e6?null:e.latest}function GB(){let e=uS.get(),t=WB({latest:e?.info?.hasUpdate?e.info.latest:null,notify:fp.get().prefs.updateNotify,skipped:localStorage.getItem(HB),askedAt:Number(localStorage.getItem(UB))||null,now:Date.now()});!t||C.get()!==null||(localStorage.setItem(UB,String(Date.now())),C.set((0,V.jsx)(KB,{current:e?.current??``,latest:t,notes:e?.notes??[]})))}function KB(e){let[t]=e.notes;return(0,V.jsx)(bi,{title:z(`updatePrompt.title`,{version:e.latest}),wide:e.notes.length>0,children:(0,V.jsxs)(`div`,{className:Wr,children:[(0,V.jsx)(`p`,{className:`text-muted`,children:z(`updatePrompt.body`,{current:e.current})}),e.notes.length===1&&t?(0,V.jsx)(lS,{body:t.body}):(0,V.jsx)(_S,{notes:e.notes}),(0,V.jsxs)(`div`,{className:Mr,children:[(0,V.jsx)(H,{onClick:()=>{localStorage.setItem(HB,e.latest),R()},children:z(`updatePrompt.skip`)}),(0,V.jsx)(H,{onClick:R,children:z(`updatePrompt.later`)}),(0,V.jsx)(H,{variant:`filled`,autoFocus:!0,onClick:()=>{R(),dS.set(!0),he(`update`)},children:z(`updatePrompt.yes`)})]})]})})}function qB({model:e,taskId:t,groupId:n}){B();let r=y(e.tasks),i=r?$T(r.tasks,n):[];return i.length<2||!i.some(e=>e.id===t)?null:(0,V.jsxs)(`nav`,{className:PE,"aria-label":z(`compare.menu`),children:[i.map((n,r)=>(0,V.jsxs)(H,{variant:`pill`,hit:`tight`,"aria-current":n.id===t,onClick:()=>e.select(n.id),children:[`[ `,(0,V.jsx)(Ph,{status:n.rowStatus}),r+1,` `,n.engine?.name??n.label,n.kept&&(0,V.jsx)(`span`,{className:`text-accent`,children:`✓`}),` ]`]},n.id)),(0,V.jsx)(H,{hit:`tight`,className:`ml-auto flex-none whitespace-nowrap`,onClick:()=>ge(n),children:z(`compare.strip`)})]})}var JB=e=>kj(e)!==null,YB=e=>Bd(kj(e)?.tab.split);function XB(e){let t=kj(e),n=t?.tab.split;return t&&n?{...t,split:n,leaf:Ej(t.taskId,t.tab,n)}:null}So(()=>[{id:`workspace.split.right`,chords:[`ctrl+\\`],prefix:!1,surface:`workspace`,live:JB,run:e=>{let t=kj(e);t&&jj(e,t.taskId,t.tab,`right`)}},{id:`workspace.split.down`,chords:[`ctrl+=`],prefix:!1,surface:`workspace`,live:JB,run:e=>{let t=kj(e);t&&jj(e,t.taskId,t.tab,`down`)}},{id:`workspace.split.focus-next`,chords:[`f3`],prefix:!1,surface:`workspace`,live:YB,run:e=>{let t=XB(e);t&&Oj(t.taskId,t.tab,t.split,Hd(t.split,t.leaf))}},{id:`workspace.split.close`,chords:[`w`],prefix:!0,surface:`workspace`,live:YB,run:e=>{let t=XB(e);t&&Mj(e,t.taskId,t.tab,t.leaf)}},{id:`workspace.split.rename`,chords:[`f2`],prefix:!1,surface:`workspace`,live:YB,run:e=>{let t=XB(e);t&&Nj(e,t.taskId,t.tab,t.leaf)}}]);var ZB=[{id:`leaf-1`,x:0,y:0,w:1,h:1,left:!1,top:!1}];function QB({model:e,taskId:t,tab:n}){let r=n.split;y(Tj);let i=r?Ej(t,n,r):`leaf-1`,a=r?Ud(r,Ld(n)):new Map,o=Bd(r),{prefs:s}=yp(),c=y(e.tasks)?.tasks.find(e=>e.id===t)?.tabStatus?.[n.id]??n.status,l=n.kind===`engine`&&c?.reason===`dead`?c.since:null;(0,h.useEffect)(()=>{l!==null&&e.refreshTabsNow(t)},[l,e,t]);let u=l!==null&&n.alive!==!1?{code:n.exit?.code??null,since:l}:null,d=n.kind===`engine`&&c?.reason===`rate_limited`?{since:c.since}:null;return(0,V.jsx)(`div`,{className:Xt,children:(r?Vd(r.root):ZB).map(c=>(0,V.jsxs)(`div`,{className:$t(o?s.splitStyle:null,{left:c.left,top:c.top,active:c.id===i}),style:{left:`calc(${c.x*100}% + var(--ml, 0px))`,top:`calc(${c.y*100}% + var(--mt, 0px))`,width:`calc(${c.w*100}% - var(--ml, 0px))`,height:`calc(${c.h*100}% - var(--mt, 0px))`},children:[(0,V.jsx)(sI,{client:e.client,model:e,engineExit:c.id===`leaf-1`?u:null,usageLimit:c.id===`leaf-1`?d:null,composer:n.kind===`engine`&&c.id===`leaf-1`,taskId:t,tabId:n.id,leafId:c.id,focused:c.id===i,onActivate:()=>r&&Dj(t,n.id,r,c.id),onExit:()=>{o?Aj(e,{taskId:t,tabId:n.id,action:`close`,leafId:c.id}):n.kind!==`engine`&&e.closeTab(t,n.id).catch(()=>{})}}),o&&(0,V.jsx)(`span`,{className:en(s.splitStyle===`rule`,c.id===i),onContextMenu:r=>nF(r,Ij(e,t,n,c.id)),children:a.get(c.id)})]},c.id))})}var $B=/^[0-9a-f]{7,40}$/i;function eV(e,t){return t.sharesWorkspaceOf||!t.baseRef?null:e.find(e=>e.id!==t.id&&e.branch!==``&&e.branch===t.baseRef)||($B.test(t.baseRef)&&t.parentTaskId?e.find(e=>e.id===t.parentTaskId)??null:null)}function tV(e,t){let n=[];for(let r=eV(e,t);r&&n.length<20&&!n.includes(r);r=eV(e,r))n.unshift(r);let r=e.filter(n=>!n.deleting&&eV(e,n)?.id===t.id).sort((e,t)=>(e.createdAt??``).localeCompare(t.createdAt??``));if(n.length===0&&r.length===0)return null;let i=n[0]??t,a=i.baseRef&&!$B.test(i.baseRef)?i.baseRef:null;return{nodes:[...n,t,...r],at:n.length,base:a}}var nV=e=>e.pr?.lifecycle===`merged`;function rV(e){return e.nodes.find(e=>!nV(e))??null}function iV({model:e,taskId:t}){B();let n=y(e.tasks)?.tasks??[],r=n.find(e=>e.id===t),i=r?tV(n,r):null;if(!i)return null;let a=rV(i);return(0,V.jsxs)(`nav`,{className:PE,"aria-label":z(`compare.stackLabel`),children:[i.base&&(0,V.jsxs)(`span`,{className:`text-subtle`,children:[i.base,` ←`]}),i.nodes.map((n,r)=>(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-x-3.5`,children:[r>0&&(0,V.jsx)(`span`,{className:`text-subtle`,children:`←`}),(0,V.jsxs)(H,{variant:`pill`,hit:`tight`,"aria-current":n.id===t,onClick:()=>e.select(n.id),children:[`[ `,(0,V.jsx)(Ph,{status:n.rowStatus}),n.label||n.title,nV(n)?(0,V.jsx)(`span`,{className:`text-accent`,children:`✓`}):n.pr?.number?(0,V.jsx)(`span`,{children:`PR`}):null,` ]`]})]},n.id)),a&&!a.machine&&(0,V.jsx)(H,{hit:`tight`,className:`ml-auto flex-none whitespace-nowrap`,onClick:()=>void gy(e,a),children:z(`compare.landBottom`)})]})}function aV(e,t){return e===`never`?!1:e!==`multipleOnly`||t>=2}function oV({taskId:e}){B();let t=Ac(e),n=y(j),r=jc(e)&&!n;return(0,V.jsx)(`div`,{className:lr,children:$s.map(n=>{let i=r&&!!Ls(t,n);return(0,V.jsx)(`button`,{type:`button`,className:Yn({on:i}),title:z(`panel.${n}`),"aria-label":z(`panel.${n}`),"aria-pressed":i,onClick:()=>Ic(e,n),children:(0,V.jsx)(cF,{children:lF[n]})},n)})})}function sV({model:e,task:t,tabs:n,narrow:r}){let i=y(e.selection),{prefs:a}=yp(),o=!aV(a.tabStrip,n.length);return(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-0.5 font-mono text-meta/body transition-padding-left duration-220 ease-snap motion-reduce:transition-none rail-folded:min-h-6.5 rail-folded:pl-23`,role:`tablist`,children:[n.map((n,r)=>(0,V.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":n.id===i.tabId,className:`group/tab flex items-center gap-1.5 whitespace-nowrap rounded-sm px-2.5 py-1 active:scale-97 motion-reduce:active:scale-none touch:select-none touch:touch-callout-none ${o?`hidden`:``} ${n.id===i.tabId?`bg-inset text-ink`:`text-muted hover:bg-hover data-menu-open:bg-hover`}`,onClick:()=>e.select(t.id,n.id),onContextMenu:r=>nF(r,b(Zj(e,t,n),z(`menu.more`))),children:[(0,V.jsx)(`span`,{className:`text-subtle group-aria-selected/tab:text-accent`,children:r+1}),Ld(n)]},n.id)),!r&&(0,V.jsx)(oV,{taskId:t.id})]})}function cV(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e))}function lV({model:e}){let t=B()===`zh`?Qi:Zi,n=e.client,[r,i]=(0,h.useState)(()=>(Y(n,`worktrees.list`,{network:!0})??Y(n,`worktrees.list`,{network:!1}))?.projects??null),[a,o]=(0,h.useState)([]),[s,c]=(0,h.useState)(0),[l,u]=(0,h.useState)(0),d=(0,h.useRef)(null);(0,h.useEffect)(()=>{let e=!0,t=!1,r=r=>Gu(n,`worktrees.list`,{network:r}).then(n=>{if(!(!e||!r&&t)&&(r&&(t=!0),i(n.projects),r)){let e=new Set(n.projects.flatMap(e=>e.worktrees.map(e=>e.path)));o(t=>t.filter(t=>e.has(t)))}}).catch(()=>{});return r(!1),r(!0),()=>{e=!1}},[n,l]),(0,h.useEffect)(()=>d.current?.focus(),[]);let f=(r??[]).map(e=>({...e,worktrees:e.worktrees.filter(e=>!a.includes(e.path))})),p=f.flatMap(e=>e.worktrees),m=Math.min(s,Math.max(0,p.length-1));(0,h.useEffect)(()=>{d.current?.querySelector(`[data-row="${m}"]`)?.scrollIntoView({block:`nearest`})},[m]);let g=(0,h.useCallback)(()=>u(e=>e+1),[]),_=async(e,r)=>{o(t=>[...t,e.path]);try{let i=await n.request(`worktrees.remove`,{path:e.path,force:r});i.residue&&I(cV(t.delete.residue,i.residue)),g()}catch(n){o(t=>t.filter(t=>t!==e.path));let i=n&&typeof n==`object`&&`code`in n?n.code:null;if(!r&&i===`DIRTY_WORKTREE`){C.set((0,V.jsx)(Ci,{title:t.delete.forceTitle,body:`${cV(t.delete.forceBody,{branch:e.branch||e.path})}\n\n${cV(t.delete.forceReason,{reason:W(n)})}`,confirmLabel:t.delete.button,onConfirm:()=>_(e,!0)}));return}I(cV(t.delete.failed,{error:W(n)}),`error`)}},v=e=>C.set((0,V.jsx)(Ci,{title:t.delete.confirmTitle,body:cV(t.delete.confirmBody,{branch:e.branch||e.path}),confirmLabel:t.delete.button,onConfirm:async()=>{_(e,!1)}})),y=n=>{if(!n.taskId){I(t.land.noTask,`error`);return}gy(e,{id:n.taskId,title:n.branch,branch:n.branch},g)},b=e=>{if(e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`c`&&!window.getSelection()?.toString())return e.preventDefault(),O.set(null);if(e.metaKey||e.ctrlKey||e.altKey)return;let t=p[m];if(e.key===`j`||e.key===`ArrowDown`)c(Math.min(p.length-1,m+1));else if(e.key===`k`||e.key===`ArrowUp`)c(Math.max(0,m-1));else if(e.key===`d`&&t)v(t);else if(e.key===`l`&&t)y(t);else if(e.key===`q`||e.key===`Escape`)O.set(null);else return;e.preventDefault()},x=0;return(0,V.jsxs)(`div`,{className:wx,tabIndex:0,ref:d,onKeyDown:b,children:[(0,V.jsx)(`h1`,{className:Tx,children:t.title}),r===null?(0,V.jsx)(`p`,{className:`text-muted`,children:t.loading}):f.length===0?(0,V.jsx)(`p`,{className:`text-muted`,children:t.noProjects}):f.map(e=>{let n=x;return x+=e.worktrees.length,(0,V.jsxs)(`section`,{className:Qx,children:[(0,V.jsxs)(`h2`,{className:`mt-1.5 mr-2 mb-1 ml-0 flex items-center gap-1 font-mono text-meta font-semibold normal-nums text-subtle`,children:[(0,V.jsx)(`span`,{children:e.repo}),(0,V.jsx)(`span`,{className:`rule`})]}),e.worktrees.length===0&&(0,V.jsx)(`p`,{className:`mono text-muted`,children:t.noWorktrees}),e.worktrees.map((e,r)=>{let i=n+r;return(0,V.jsxs)(`div`,{"data-row":i,className:$x(i===m),onClick:()=>c(i),children:[(0,V.jsxs)(`div`,{className:eS,children:[(0,V.jsx)(`span`,{className:nS,children:e.branch||t.row.detached}),e.roveManaged&&(0,V.jsx)(`span`,{className:`chip text-muted`,children:t.badge.roveManaged}),e.dirty===!0&&(0,V.jsx)(`span`,{className:`chip text-warning`,children:t.badge.dirty}),e.dirty===null&&(0,V.jsx)(`span`,{className:`chip text-muted`,children:t.badge.dirtyUnknown}),(0,V.jsx)(`span`,{className:`chip ${e.branchOnRemote===!0?`text-success`:e.branchOnRemote===!1?`text-warning`:`text-muted`}`,children:e.branchOnRemote===!0?t.badge.remoteOn:e.branchOnRemote===!1?t.badge.remoteOff:t.badge.remoteUnknown}),e.verdictReason!==`dirty`&&e.verdictReason!==`fresh`&&(0,V.jsx)(`span`,{className:`chip ${e.verdict===`merged`?`text-success`:e.verdict===`stale`?`text-warning`:`text-accent`}`,children:t.verdict[e.verdictReason]??e.verdictReason})]}),(0,V.jsxs)(`div`,{className:`${tS} mono text-muted`,children:[(0,V.jsx)(`span`,{className:rS,children:e.path}),e.createdAtMs>0&&(0,V.jsx)(`span`,{children:cV(t.row.created,{age:Ml(Date.now()-e.createdAtMs)})})]}),i===m&&(0,V.jsxs)(`div`,{className:`flex items-baseline gap-2 text-[length:var(--fs-body)]`,children:[(0,V.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>v(e),children:t.delete.button}),e.taskId&&(0,V.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>y(e),children:t.land.button})]})]},e.path)})]},e.repo)}),(0,V.jsx)(`p`,{className:`${iS} mono keys-only text-muted`,children:(0,V.jsx)(rp,{text:`j/k · d ${t.delete.button} · l ${t.land.button} · q/esc`})})]})}function uV({model:e,narrow:t}){let n=y(e.selection),r=y(e.tabs),i=y(e.tasks),a=y(e.remote),o=a.find(e=>e.id===n.taskId&&!e.machine?.stale),s=co(i,n.taskId)??o??null,c=o?void 0:a.find(e=>e.id===n.taskId),l=s?r[s.id]??[]:[],u=s?s.id in r:!1,d=y(O),f=pC(s?.id),p=s?.rowStatus?.kind===`running`,m=y(N),g=y(ec)!==`terminal`&&t&&!!s;return(0,h.useEffect)(()=>{let t=e.selection.get();return e.selection.subscribe(()=>{N.set(null);let n=e.selection.get();(n.taskId!==t.taskId||n.tabId!==t.tabId)&&ec.set(`terminal`),t=n})},[e]),(0,h.useEffect)(()=>ZT(e),[e]),d===`update`?(0,V.jsxs)(`main`,{className:`${En} ${Ht}`,children:[t&&(0,V.jsx)(TF,{}),(0,V.jsx)(bS,{client:e.client})]}):d===`worktrees`?(0,V.jsxs)(`main`,{className:`${En} ${Ht}`,children:[t&&(0,V.jsx)(TF,{}),(0,V.jsx)(lV,{model:e})]}):d?(0,V.jsxs)(`main`,{className:`${En} ${Ht}`,children:[t&&(0,V.jsx)(TF,{}),(0,V.jsx)(ej,{model:e,page:d})]}):m?(0,V.jsxs)(`main`,{className:`${En} ${Ht}`,children:[t&&(0,V.jsx)(TF,{}),(0,V.jsx)(`div`,{className:Dn,children:(0,V.jsx)(_v,{model:e,seed:m},Qg(m))})]}):(0,V.jsxs)(`main`,{className:`${En} ${Ht}`,children:[t&&(0,V.jsx)(TF,{taskId:s?.id,title:s?.title}),s&&(0,V.jsx)(sV,{model:e,task:s,tabs:l,narrow:t}),s&&!s.groupId&&(0,V.jsx)(iV,{model:e,taskId:s.id}),s?.groupId&&(0,V.jsx)(qB,{model:e,taskId:s.id,groupId:s.groupId}),(0,V.jsxs)(`div`,{className:`${Dn} ${p?On:``}`,style:f?{"--task-ink":f}:void 0,children:[!t&&!s&&!c&&i&&i.tasks.length+a.length===0&&(0,V.jsx)(tF,{model:e}),!s&&!c&&i&&i.tasks.length+a.length>0&&(0,V.jsx)(`p`,{className:wn,children:z(`workspace.pickTask`)}),c?.machine&&(0,V.jsx)(`div`,{className:Tn,children:(0,V.jsx)(Um,{host:c.machine.label,onMachines:()=>zv(e)})}),s&&u&&l.length===0&&!g&&(0,V.jsxs)(`div`,{className:Tn,children:[(0,V.jsx)(`p`,{children:z(`workspace.noTabs`)}),(0,V.jsx)(H,{variant:`filled`,onClick:()=>void ed(e,s.id,{kind:`engine`}).catch(e=>I(String(e),`error`)),children:s.engine?z(`workspace.startEngine`,{engine:s.engine.name}):z(`workspace.startSession`)}),` `,(0,V.jsx)(H,{variant:`filled`,onClick:()=>void $u(e,s.id),children:z(`menu.newChat`)}),` `,(0,V.jsx)(H,{variant:`filled`,onClick:()=>C.set((0,V.jsx)(ad,{model:e,taskId:s.id})),children:z(`menu.newChatPick`)})]}),s&&g&&(0,V.jsx)(zB,{model:e,task:s,narrow:!0}),s&&n.tabId&&l.some(e=>e.id===n.tabId)&&(0,V.jsx)(`div`,{className:`min-w-0 flex-1 ${g?`hidden`:`flex`}`,children:(0,V.jsx)(QB,{model:e,taskId:s.id,tab:l.find(e=>e.id===n.tabId)??l[0]},`${s.id}::${n.tabId}`)})]})]})}function dV({model:e}){B();let t=y(e.client.conn);return t.hello===null&&t.failures>=2?(0,V.jsx)(fV,{}):(0,V.jsx)(pV,{model:e})}function fV(){let[e,t]=(0,h.useState)(null);return(0,h.useEffect)(()=>{os().then(t)},[]),e===null?null:e?(0,V.jsx)(ds,{}):(0,V.jsx)(Nr,{failing:!0})}function pV({model:e}){OT(e);let t=y(e.client.conn).hello;(0,h.useEffect)(()=>{if(!t)return;wS(e.client,t.roveVersion);let n=()=>void hS(e.client).then(GB);n();let r=window.setInterval(n,36e5);return()=>window.clearInterval(r)},[t,e.client]),(0,h.useEffect)(()=>{t&&rs(e)},[t,e]),of(e),nf(e),Ro(),ma(e.client),LT(e),Da(e.client),zC(e.client),(0,h.useEffect)(()=>{e.onSelect=pe;let t=N.subscribe(()=>{N.get()!==null&&pe()});return ne(),t},[e]),(0,h.useEffect)(()=>Mw(e),[e]);let n=y(j),r=y(e.selection),i=y(e.tasks),a=y(e.remote),o=xe(),s=y(hM),c=y(gM),l=y(mM),u=y(fe),d=y(De)===`app`,f=y(rc),p=y(ac),m=y(O),g=y(se)===`drag`,_=y(N)!==null,v=a.find(e=>e.id===r.taskId&&!e.machine?.stale),b=co(i,r.taskId)??v??null,x=v?void 0:a.find(e=>e.id===r.taskId),S=jc(b?.id??null),C=Ac(b?.id??``).columns.length,w=o?Se(u,!!b||!!x,m!==null||_):null;(0,h.useEffect)(()=>e.setTaskShown(w===null||w===`content`&&m===null&&!_),[e,w,m,_]);let T=bM(l??280),E=s?0:T,D=f===null?sc(C,E):oc(f,E),k={"--rail-w":`${s?0:T}px`,"--rail-open-w":`${T}px`,"--panel-w":D===null?void 0:`${D}px`};return(0,V.jsxs)(`div`,{className:zt,children:[(0,V.jsx)(ka,{onRefresh:()=>Oa(e.client)}),(0,V.jsxs)(`div`,{className:Bt({zen:n||!S||!b&&!x||o||_,expanded:p&&!n&&!o,surface:w&&d?`back`:w,folded:s&&!o,peek:s&&c&&!o,dragging:g}),style:o?void 0:k,children:[!o&&(0,V.jsx)(CF,{model:e}),s&&!o&&(0,V.jsx)(`div`,{className:`absolute inset-y-0 left-0 z-5 col-1 row-1 w-2.5`,title:z(`layout.railUnfold`),onMouseEnter:()=>yM(!0),onMouseLeave:()=>yM(!1),onMouseUp:()=>hM.set(!1)}),(0,V.jsx)(rF,{model:e,narrow:o}),(0,V.jsx)(uV,{model:e,narrow:o}),!o&&(0,V.jsx)(zB,{model:e,task:b,remoteHost:x?.machine?.label}),(0,V.jsx)(VB,{model:e}),(0,V.jsx)(_s,{}),(0,V.jsx)(NT,{model:e}),(0,V.jsx)(po,{model:e})]})]})}var mV=`a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`;function hV(e){return[...e.querySelectorAll(mV)].filter(e=>e.tabIndex>=0&&e.offsetParent!==null)}function gV(){window.addEventListener(`keydown`,e=>{if(e.key!==`Tab`||e.defaultPrevented||e.ctrlKey||e.metaKey||e.altKey)return;let t=[...document.querySelectorAll(`.overlay:not(.is-leaving)`)].at(-1);if(!t)return;let n=hV(t);if(n.length===0)return;let r=document.activeElement,i=r instanceof HTMLElement&&t.contains(r),a=e.shiftKey?n.filter(e=>i&&!!(r.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)).at(-1)??n.at(-1):n.find(e=>i&&!!(r.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING))??n[0];e.preventDefault(),a?.focus()})}function _V(e){if(!L())for(let t of document.querySelectorAll(`${e}:not(.is-leaving)`)){let e=t.cloneNode(!0);e.classList.add(`is-leaving`),e.inert=!0,e.setAttribute(`aria-hidden`,`true`),document.body.append(e);let n=t.querySelectorAll(`*`),r=e.querySelectorAll(`*`);n.forEach((e,t)=>{let n=r[t];e.scrollTop&&(n.scrollTop=e.scrollTop),(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&(n.value=e.value)}),window.setTimeout(()=>e.remove(),200)}}function vV(e){for(let t of document.querySelectorAll(`${e}.is-leaving`))t.remove()}function yV(){for(let e of document.querySelectorAll(`.overlay:not(.is-leaving)`))for(let t of e.getAnimations())t instanceof CSSAnimation&&t.animationName===`fade-in`&&t.finish()}function bV(){let e=C.get(),t=-1/0;C.subscribe(()=>{let n=C.get();if(n===null&&e!==null)t=performance.now(),_V(`.overlay`);else if(n!==null){let n=e!==null||performance.now()-t<140;vV(`.overlay`),n&&requestAnimationFrame(yV)}e=n});let n=S.get();S.subscribe(()=>{let e=S.get();e===null&&n!==null?_V(`.menu`):e!==null&&vV(`.menu`),n=e});let r=hf.get().guide;hf.subscribe(()=>{let e=hf.get().guide;e===null&&r!==null?_V(`.prefix-guide`):e!==null&&vV(`.prefix-guide`),r=e})}var xV=500,SV=10,CV=`input, textarea, select, [contenteditable], .xterm`,wV=[`mousedown`,`mouseup`,`click`,`contextmenu`];function TV(){let e=null,t=()=>{e&&window.clearTimeout(e.timer),e=null},n=()=>{let e=e=>{e.preventDefault(),e.stopPropagation()},t=()=>{for(let t of wV)document.removeEventListener(t,e,!0);document.removeEventListener(`pointerdown`,t,!0),document.removeEventListener(`keydown`,t,!0)};for(let t of wV)document.addEventListener(t,e,!0);document.addEventListener(`pointerdown`,t,!0),document.addEventListener(`keydown`,t,!0)};document.addEventListener(`pointerdown`,r=>{if(t(),r.pointerType!==`touch`||!(r.target instanceof Element)||r.target.closest(CV))return;let i=r.target,a={x:r.clientX,y:r.clientY,native:!1,timer:window.setTimeout(()=>{e=null,!(a.native||!i.isConnected)&&(i.dispatchEvent(new MouseEvent(`contextmenu`,{bubbles:!0,cancelable:!0,clientX:a.x,clientY:a.y,button:2})),n())},xV)};e=a},!0),document.addEventListener(`pointermove`,n=>{e&&Math.hypot(n.clientX-e.x,n.clientY-e.y)>SV&&t()},!0),document.addEventListener(`pointerup`,t,!0),document.addEventListener(`pointercancel`,t,!0),document.addEventListener(`contextmenu`,t=>{e&&t.isTrusted&&(e.native=!0)},!0)}function EV(e,t){e.viewingExtras=()=>uc({narrow:ye(),panelOpen:Mc(e.selection.get().taskId),zen:j.get()});let n=()=>e.reportViewing();ic.subscribe(n),Nc(n),j.subscribe(n),be(n),t.on(`panel`,t=>{lc(t)&&Wc(t,e.selection.get().taskId)})}function DV(e){let t=e;return!!t&&typeof t.promptId==`string`&&typeof t.title==`string`}function OV({client:e,prompt:t}){let n=(B()===`zh`?Oi:Di).prompt,[r,i]=(0,h.useState)(t.initial??``),a=(0,h.useRef)(!1),{busy:o,error:s,submit:c}=xi();return(0,h.useEffect)(()=>()=>{a.current||e.request(`ui.promptReply`,{promptId:t.promptId}).catch(()=>{})},[e,t.promptId]),(0,V.jsx)(bi,{title:t.title,children:(0,V.jsxs)(`form`,{className:Wr,onSubmit:n=>{n.preventDefault(),c(async()=>{await e.request(`ui.promptReply`,{promptId:t.promptId,value:r}),a.current=!0})},children:[(0,V.jsx)(`input`,{className:jr,"aria-label":n.fieldLabel,autoFocus:!0,spellCheck:!1,value:r,placeholder:t.placeholder,onChange:e=>i(e.target.value)}),s&&(0,V.jsx)(`p`,{className:`text-error`,children:s}),(0,V.jsx)(Ti,{busy:o,submitLabel:n.submitLabel})]})})}function kV(e,t){C.get()||C.set((0,V.jsx)(OV,{client:e,prompt:t},t.promptId))}var AV=900,jV=new WeakMap;function MV(e){e.setAttribute(`data-scrolling`,``),window.clearTimeout(jV.get(e)),jV.set(e,window.setTimeout(()=>e.removeAttribute(`data-scrolling`),AV))}function NV(){document.addEventListener(`scroll`,e=>{let t=e.target instanceof Element?e.target:document.scrollingElement;t&&MV(t)},{capture:!0,passive:!0})}var PV=`rove-web.reloadedFor`;function FV(e,t,n){return e===null?`adopt`:t===e||t===n?`stay`:`reload`}function IV(){let e=null;try{e=window.sessionStorage}catch{}return{storage:e,reload:()=>window.location.reload()}}function LV(e,t=IV()){let n=null,r=null,i=()=>{try{return t.storage?.getItem(PV)??r}catch{return r}};return e.conn.subscribe(()=>{let{state:a,hello:o}=e.conn.get();if(a!==`open`||!o)return;let s=FV(n,o.roveVersion,i());if(s===`adopt`&&(n=o.roveVersion),s===`reload`){r=o.roveVersion;try{t.storage?.setItem(PV,o.roveVersion)}catch{}t.reload()}})}function RV(){let e=window.visualViewport;if(!e)return;let t=document.documentElement,n=()=>{t.style.setProperty(`--vvh`,`${e.height*e.scale}px`),t.toggleAttribute(`data-keyboard`,window.innerHeight-e.height*e.scale>120),e.scale===1&&window.scrollY!==0&&window.scrollTo(0,0)};e.addEventListener(`resize`,n),e.addEventListener(`scroll`,n),window.addEventListener(`scroll`,n,{passive:!0}),n()}var zV=(0,g.createRoot)(document.getElementById(`root`));RV(),TV(),Ne(),NV(),bV(),gV(),kP();function BV(e){let t=new Ko(qo(),e),n=new uo(t);t.on(`prompt`,e=>{DV(e)&&kV(t,e)}),EV(n,t),LV(t),t.start(),zV.render((0,V.jsx)(h.StrictMode,{children:(0,V.jsx)(dV,{model:n})}))}var VV=i();VV?BV(VV):Promise.all([ss(),os()]).then(([e,t])=>{e?BV(``):zV.render((0,V.jsx)(h.StrictMode,{children:t?(0,V.jsx)(ds,{}):(0,V.jsx)(Nr,{})}))});export{fp as a,Qf as c,Ho as d,Mn as f,se as h,$S as i,Zf as l,ee as m,ZF as n,Xf as o,Pn as p,YF as r,Yf as s,MV as t,X as u};
|
|
83
|
+
`)})]}):(0,V.jsxs)(`div`,{className:QL,children:[(0,V.jsxs)(`div`,{className:$L,children:[(0,V.jsx)(`input`,{className:`${jr} ${eR}`,value:a,placeholder:z(`transcript.findPlaceholder`),"aria-label":z(`transcript.findPlaceholder`),spellCheck:!1,autoComplete:`off`,onChange:e=>o(e.target.value),onKeyDown:k}),a.trim()!==``&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`whitespace-nowrap text-muted`,children:b.length===0?z(`transcript.findNone`):z(`transcript.findCount`,{at:x+1,total:b.length})}),(0,V.jsx)(H,{onClick:()=>O(-1),disabled:b.length===0,children:z(`transcript.prev`)}),(0,V.jsx)(H,{onClick:()=>O(1),disabled:b.length===0,children:z(`transcript.next`)})]}),(0,V.jsx)(H,{onClick:()=>void ee(),disabled:_.length===0,children:z(`transcript.export`)})]}),(0,V.jsxs)(`div`,{ref:d,className:tR,onScroll:e=>{let t=e.currentTarget;f.current=t.scrollHeight-t.scrollTop-t.clientHeight<CB,t.scrollTop<CB&&g?.older&&!r.paging&&D()},children:[g?.older&&(0,V.jsx)(`p`,{className:`m-0 px-3 py-2 font-mono text-meta text-subtle`,children:(0,V.jsx)(H,{onClick:()=>void D(),disabled:r.paging,children:z(`transcript.older`)})}),_.length===0&&(0,V.jsx)(`p`,{className:`m-0 px-3 py-2 font-mono text-meta text-subtle`,children:z(`transcript.empty`)}),_.map(e=>(0,V.jsx)(DB,{entry:e,failed:v,needle:a,flash:l===e.index,current:S===e.index,onCopy:()=>A(e)},e.index))]})]})}var kB={working:`review.scopeWorking`,branch:`review.scopeBranch`,task:`review.scopeTask`};function AB(e){return e.kind===`file`?{text:Rs(e.path),hint:e.path}:e.kind===`diff`?e.path===`.`?{text:z(kB[e.scope]),hint:z(`preview.whole`)}:{text:Rs(e.path),hint:e.path}:{text:z(`panel.${e.kind}`),hint:z(`panel.${e.kind}`)}}function jB({taskId:e,kind:t,expand:n}){B();let r=y(ac),i=z(r?`panel.restore`:`panel.expand`);return(0,V.jsxs)(V.Fragment,{children:[n&&(0,V.jsx)(`button`,{type:`button`,className:Yn({tool:!0}),title:i,"aria-label":i,"aria-pressed":r,onClick:()=>ac.set(!r),children:(0,V.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,V.jsx)(`path`,{d:r?`M13.5 6.5h-4v-4M2.5 9.5h4v4M9.5 6.5l4-4M6.5 9.5l-4 4`:`M9.5 2.5h4v4M6.5 13.5h-4v-4M13.5 2.5l-4.5 4.5M2.5 13.5 7 9`})})}),(0,V.jsx)(`button`,{type:`button`,className:Yn({tool:!0}),title:z(`panel.close`),"aria-label":z(`panel.close`),onClick:()=>Vc(e,t),children:(0,V.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,V.jsx)(`path`,{d:`M4 4l8 8M12 4l-8 8`})})})]})}function MB({taskId:e,column:t,narrow:n}){if(B(),t.kind===`browser`)return(0,V.jsxs)(`div`,{className:tr(n),children:[(0,V.jsx)(vF,{taskId:e,column:t}),!n&&(0,V.jsx)(jB,{taskId:e,kind:`browser`,expand:!0})]});if(n&&t.kind!==`diff`)return null;let{text:r,hint:i}=AB(t);return(0,V.jsxs)(`div`,{className:tr(n),children:[(0,V.jsx)(`span`,{className:nr,title:i,children:r}),(0,V.jsx)(jB,{taskId:e,kind:t.kind,expand:!n})]})}function NB({model:e,task:t,column:n}){let r=(0,h.useRef)([]);return r.current=Ms(r.current,n.active,n.tabs),n.tabs.filter(e=>r.current.includes(e.id)).map(r=>(0,V.jsx)(`div`,{className:dr,hidden:r.id!==n.active,children:(0,V.jsx)(EI,{model:e,taskId:t.id,tab:r,onNavigate:e=>Hc(t.id,t=>Es(t,r.id,e)),onStep:e=>Hc(t.id,t=>Ds(t,r.id,e))})},r.id))}function PB({model:e,task:t,column:n,narrow:r,restored:i}){return n.kind===`browser`?(0,V.jsx)(NB,{model:e,task:t,column:n}):(0,V.jsxs)(`div`,{className:dr,children:[n.kind===`files`&&(0,V.jsx)(jL,{model:e,task:t,narrow:r}),n.kind===`chat`&&(0,V.jsx)(OB,{model:e,task:t,active:!0}),n.kind===`quota`&&(0,V.jsx)(QI,{model:e,task:t,active:!0}),n.kind===`file`&&(0,V.jsx)(iB,{model:e,view:{taskId:t.id,path:n.path,scope:`working`,file:!0},active:!0,restored:i,onClose:()=>Vc(t.id,`file`)},`${t.id}:file:${n.path}:${n.at??``}`),n.kind===`diff`&&(0,V.jsx)(iB,{model:e,view:{taskId:t.id,path:n.path,scope:n.scope},active:!0,restored:i,onClose:()=>Vc(t.id,`diff`)},`${t.id}:${n.path}:${n.scope}:${n.at??``}`)]})}function FB({taskId:e,kinds:t,index:n,body:r,slot:i}){B();let a=(0,h.useRef)(null);return(0,V.jsx)(`div`,{className:ur,style:{gridColumn:i},title:z(`panel.resizeSplit`),onPointerDown:e=>{let n=t.map(e=>r.current?.querySelector(`[data-kind="${e}"]`)?.getBoundingClientRect().width??0);a.current={x:e.clientX,widths:n},r.current?.classList.add(`is-resizing`),e.currentTarget.setPointerCapture(e.pointerId)},onPointerMove:t=>{let r=a.current;if(!r)return;let i=Qs(r.widths,n,t.clientX-r.x,220);Pc(e,e=>Xs(e,i))},onLostPointerCapture:()=>{a.current=null,r.current?.classList.remove(`is-resizing`)},onDoubleClick:()=>Pc(e,Zs)})}function IB({panel:e}){B();let t=(0,h.useRef)(null);return(0,V.jsx)(yF,{edge:`left`,title:z(`panel.resize`),onPointerDown:n=>{t.current={x:n.clientX,width:e.current?.getBoundingClientRect().width??0},e.current?.classList.add(`is-resizing`),n.currentTarget.setPointerCapture(n.pointerId),ue(!0)},onPointerMove:e=>{let n=t.current;if(!n||e.clientX===n.x)return;let r=hM.get()?0:bM(mM.get()??280);rc.set(oc(n.width-(e.clientX-n.x),r))},onLostPointerCapture:()=>{t.current=null,e.current?.classList.remove(`is-resizing`),ue(!1)},onDoubleClick:()=>rc.set(null)})}var LB=e=>e.kind===`diff`?`diff:${e.path}:${e.scope}`:e.kind===`file`?`file:${e.path}`:e.kind;function RB({model:e,task:t,narrow:n}){B();let r=Ac(t.id),i=y(ec),a=y(ac),o=(0,h.useRef)(null),s=(0,h.useRef)(null),c=i===`terminal`?`files`:i,l=n?Ls(r,c):void 0;(0,h.useEffect)(()=>{n&&!l&&Pc(t.id,e=>Hs(e,c))},[n,l,c,t.id]);let u=n?l?[l]:[]:r.columns,d=u.map(e=>e.kind),f=(n?[1]:Ys(r)).map((e,t)=>`${t>0?`var(--divider) `:``}minmax(0, ${e}fr)`).join(` `),p=(0,h.useRef)(u.map(LB));return(0,V.jsxs)(`aside`,{className:Qn(n),ref:o,children:[!n&&!a&&(0,V.jsx)(IB,{panel:o}),(0,V.jsxs)(`div`,{className:$n,ref:s,style:{gridTemplateColumns:f},children:[u.map(r=>(0,V.jsxs)(`section`,{className:er,"data-kind":r.kind,style:{gridColumn:2*d.indexOf(r.kind)+1},children:[(0,V.jsx)(MB,{taskId:t.id,column:r,narrow:n}),(0,V.jsx)(PB,{model:e,task:t,column:r,narrow:n,restored:p.current.includes(LB(r))})]},r.kind)),!n&&u.slice(1).map((e,n)=>(0,V.jsx)(FB,{taskId:t.id,kinds:d,index:n,body:s,slot:2*n+2},`divider:${e.kind}`))]})]})}function zB({model:e,task:t,remoteHost:n,narrow:r=!1}){let i=y(j),a=jc(t?.id??null);return!r&&(i||!a)?null:t?(0,V.jsx)(RB,{model:e,task:t,narrow:r},t.id):n?(0,V.jsx)(`aside`,{className:Qn(!1),children:(0,V.jsx)(Um,{host:n,onMachines:()=>zv(e)})}):null}var BB=1500;function VB({model:e}){let t=e.client,n=y(t.conn),[r,i]=(0,h.useState)(!1);return(0,h.useEffect)(()=>{if(n.state!==`connecting`)return i(!1);let e=window.setTimeout(()=>i(!0),BB);return()=>window.clearTimeout(e)},[n.state]),n.state===`open`||n.state===`connecting`&&!r?null:(0,V.jsxs)(`footer`,{className:In,children:[(0,V.jsx)(`span`,{className:Ln(n.state===`retrying`)}),(0,V.jsx)(`span`,{children:n.state===`retrying`?z(`status.retrying`,{count:n.failures}):z(`status.connecting`)}),n.state===`retrying`&&(0,V.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>t.retryNow(),children:z(`status.retry`)})]})}var HB=`rove.web.update.skipped`,UB=`rove.web.update.askedAt`;function WB(e){return!e.latest||!e.notify||e.latest===e.skipped||e.askedAt!==null&&e.now-e.askedAt<18e6?null:e.latest}function GB(){let e=uS.get(),t=WB({latest:e?.info?.hasUpdate?e.info.latest:null,notify:fp.get().prefs.updateNotify,skipped:localStorage.getItem(HB),askedAt:Number(localStorage.getItem(UB))||null,now:Date.now()});!t||C.get()!==null||(localStorage.setItem(UB,String(Date.now())),C.set((0,V.jsx)(KB,{current:e?.current??``,latest:t,notes:e?.notes??[]})))}function KB(e){let[t]=e.notes;return(0,V.jsx)(bi,{title:z(`updatePrompt.title`,{version:e.latest}),wide:e.notes.length>0,children:(0,V.jsxs)(`div`,{className:Wr,children:[(0,V.jsx)(`p`,{className:`text-muted`,children:z(`updatePrompt.body`,{current:e.current})}),e.notes.length===1&&t?(0,V.jsx)(lS,{body:t.body}):(0,V.jsx)(_S,{notes:e.notes}),(0,V.jsxs)(`div`,{className:Mr,children:[(0,V.jsx)(H,{onClick:()=>{localStorage.setItem(HB,e.latest),R()},children:z(`updatePrompt.skip`)}),(0,V.jsx)(H,{onClick:R,children:z(`updatePrompt.later`)}),(0,V.jsx)(H,{variant:`filled`,autoFocus:!0,onClick:()=>{R(),dS.set(!0),he(`update`)},children:z(`updatePrompt.yes`)})]})]})})}function qB({model:e,taskId:t,groupId:n}){B();let r=y(e.tasks),i=r?$T(r.tasks,n):[];return i.length<2||!i.some(e=>e.id===t)?null:(0,V.jsxs)(`nav`,{className:PE,"aria-label":z(`compare.menu`),children:[i.map((n,r)=>(0,V.jsxs)(H,{variant:`pill`,hit:`tight`,"aria-current":n.id===t,onClick:()=>e.select(n.id),children:[`[ `,(0,V.jsx)(Ph,{status:n.rowStatus}),r+1,` `,n.engine?.name??n.label,n.kept&&(0,V.jsx)(`span`,{className:`text-accent`,children:`✓`}),` ]`]},n.id)),(0,V.jsx)(H,{hit:`tight`,className:`ml-auto flex-none whitespace-nowrap`,onClick:()=>ge(n),children:z(`compare.strip`)})]})}var JB=e=>kj(e)!==null,YB=e=>Bd(kj(e)?.tab.split);function XB(e){let t=kj(e),n=t?.tab.split;return t&&n?{...t,split:n,leaf:Ej(t.taskId,t.tab,n)}:null}So(()=>[{id:`workspace.split.right`,chords:[`ctrl+\\`],prefix:!1,surface:`workspace`,live:JB,run:e=>{let t=kj(e);t&&jj(e,t.taskId,t.tab,`right`)}},{id:`workspace.split.down`,chords:[`ctrl+=`],prefix:!1,surface:`workspace`,live:JB,run:e=>{let t=kj(e);t&&jj(e,t.taskId,t.tab,`down`)}},{id:`workspace.split.focus-next`,chords:[`f3`],prefix:!1,surface:`workspace`,live:YB,run:e=>{let t=XB(e);t&&Oj(t.taskId,t.tab,t.split,Hd(t.split,t.leaf))}},{id:`workspace.split.close`,chords:[`w`],prefix:!0,surface:`workspace`,live:YB,run:e=>{let t=XB(e);t&&Mj(e,t.taskId,t.tab,t.leaf)}},{id:`workspace.split.rename`,chords:[`f2`],prefix:!1,surface:`workspace`,live:YB,run:e=>{let t=XB(e);t&&Nj(e,t.taskId,t.tab,t.leaf)}}]);var ZB=[{id:`leaf-1`,x:0,y:0,w:1,h:1,left:!1,top:!1}];function QB({model:e,taskId:t,tab:n}){let r=n.split;y(Tj);let i=r?Ej(t,n,r):`leaf-1`,a=r?Ud(r,Ld(n)):new Map,o=Bd(r),{prefs:s}=yp(),c=y(e.tasks)?.tasks.find(e=>e.id===t)?.tabStatus?.[n.id]??n.status,l=n.kind===`engine`&&c?.reason===`dead`?c.since:null;(0,h.useEffect)(()=>{l!==null&&e.refreshTabsNow(t)},[l,e,t]);let u=l!==null&&n.alive!==!1?{code:n.exit?.code??null,since:l}:null,d=n.kind===`engine`&&c?.reason===`rate_limited`?{since:c.since}:null;return(0,V.jsx)(`div`,{className:Xt,children:(r?Vd(r.root):ZB).map(c=>(0,V.jsxs)(`div`,{className:$t(o?s.splitStyle:null,{left:c.left,top:c.top,active:c.id===i}),style:{left:`calc(${c.x*100}% + var(--ml, 0px))`,top:`calc(${c.y*100}% + var(--mt, 0px))`,width:`calc(${c.w*100}% - var(--ml, 0px))`,height:`calc(${c.h*100}% - var(--mt, 0px))`},children:[(0,V.jsx)(sI,{client:e.client,model:e,engineExit:c.id===`leaf-1`?u:null,usageLimit:c.id===`leaf-1`?d:null,composer:n.kind===`engine`&&c.id===`leaf-1`,taskId:t,tabId:n.id,leafId:c.id,focused:c.id===i,onActivate:()=>r&&Dj(t,n.id,r,c.id),onExit:()=>{o?Aj(e,{taskId:t,tabId:n.id,action:`close`,leafId:c.id}):n.kind!==`engine`&&e.closeTab(t,n.id).catch(()=>{})}}),o&&(0,V.jsx)(`span`,{className:en(s.splitStyle===`rule`,c.id===i),onContextMenu:r=>nF(r,Ij(e,t,n,c.id)),children:a.get(c.id)})]},c.id))})}var $B=/^[0-9a-f]{7,40}$/i;function eV(e,t){return t.sharesWorkspaceOf||!t.baseRef?null:e.find(e=>e.id!==t.id&&e.branch!==``&&e.branch===t.baseRef)||($B.test(t.baseRef)&&t.parentTaskId?e.find(e=>e.id===t.parentTaskId)??null:null)}function tV(e,t){let n=[];for(let r=eV(e,t);r&&n.length<20&&!n.includes(r);r=eV(e,r))n.unshift(r);let r=e.filter(n=>!n.deleting&&eV(e,n)?.id===t.id).sort((e,t)=>(e.createdAt??``).localeCompare(t.createdAt??``));if(n.length===0&&r.length===0)return null;let i=n[0]??t,a=i.baseRef&&!$B.test(i.baseRef)?i.baseRef:null;return{nodes:[...n,t,...r],at:n.length,base:a}}var nV=e=>e.pr?.lifecycle===`merged`;function rV(e){return e.nodes.find(e=>!nV(e))??null}function iV({model:e,taskId:t}){B();let n=y(e.tasks)?.tasks??[],r=n.find(e=>e.id===t),i=r?tV(n,r):null;if(!i)return null;let a=rV(i);return(0,V.jsxs)(`nav`,{className:PE,"aria-label":z(`compare.stackLabel`),children:[i.base&&(0,V.jsxs)(`span`,{className:`text-subtle`,children:[i.base,` ←`]}),i.nodes.map((n,r)=>(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-x-3.5`,children:[r>0&&(0,V.jsx)(`span`,{className:`text-subtle`,children:`←`}),(0,V.jsxs)(H,{variant:`pill`,hit:`tight`,"aria-current":n.id===t,onClick:()=>e.select(n.id),children:[`[ `,(0,V.jsx)(Ph,{status:n.rowStatus}),n.label||n.title,nV(n)?(0,V.jsx)(`span`,{className:`text-accent`,children:`✓`}):n.pr?.number?(0,V.jsx)(`span`,{children:`PR`}):null,` ]`]})]},n.id)),a&&!a.machine&&(0,V.jsx)(H,{hit:`tight`,className:`ml-auto flex-none whitespace-nowrap`,onClick:()=>void gy(e,a),children:z(`compare.landBottom`)})]})}function aV(e,t){return e===`never`?!1:e!==`multipleOnly`||t>=2}function oV({taskId:e}){B();let t=Ac(e),n=y(j),r=jc(e)&&!n;return(0,V.jsx)(`div`,{className:lr,children:$s.map(n=>{let i=r&&!!Ls(t,n);return(0,V.jsx)(`button`,{type:`button`,className:Yn({on:i}),title:z(`panel.${n}`),"aria-label":z(`panel.${n}`),"aria-pressed":i,onClick:()=>Ic(e,n),children:(0,V.jsx)(cF,{children:lF[n]})},n)})})}function sV({model:e,task:t,tabs:n,narrow:r}){let i=y(e.selection),{prefs:a}=yp(),o=!aV(a.tabStrip,n.length);return(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-0.5 font-mono text-meta/body transition-padding-left duration-220 ease-snap motion-reduce:transition-none rail-folded:min-h-6.5 rail-folded:pl-23`,role:`tablist`,children:[n.map((n,r)=>(0,V.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":n.id===i.tabId,className:`group/tab flex items-center gap-1.5 whitespace-nowrap rounded-sm px-2.5 py-1 active:scale-97 motion-reduce:active:scale-none touch:select-none touch:touch-callout-none ${o?`hidden`:``} ${n.id===i.tabId?`bg-inset text-ink`:`text-muted hover:bg-hover data-menu-open:bg-hover`}`,onClick:()=>e.select(t.id,n.id),onContextMenu:r=>nF(r,b(Zj(e,t,n),z(`menu.more`))),children:[(0,V.jsx)(`span`,{className:`text-subtle group-aria-selected/tab:text-accent`,children:r+1}),Ld(n)]},n.id)),!r&&(0,V.jsx)(oV,{taskId:t.id})]})}function cV(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e))}function lV({model:e}){let t=B()===`zh`?Qi:Zi,n=e.client,[r,i]=(0,h.useState)(()=>(Y(n,`worktrees.list`,{network:!0})??Y(n,`worktrees.list`,{network:!1}))?.projects??null),[a,o]=(0,h.useState)([]),[s,c]=(0,h.useState)(0),[l,u]=(0,h.useState)(0),d=(0,h.useRef)(null);(0,h.useEffect)(()=>{let e=!0,t=!1,r=r=>Gu(n,`worktrees.list`,{network:r}).then(n=>{if(!(!e||!r&&t)&&(r&&(t=!0),i(n.projects),r)){let e=new Set(n.projects.flatMap(e=>e.worktrees.map(e=>e.path)));o(t=>t.filter(t=>e.has(t)))}}).catch(()=>{});return r(!1),r(!0),()=>{e=!1}},[n,l]),(0,h.useEffect)(()=>d.current?.focus(),[]);let f=(r??[]).map(e=>({...e,worktrees:e.worktrees.filter(e=>!a.includes(e.path))})),p=f.flatMap(e=>e.worktrees),m=Math.min(s,Math.max(0,p.length-1));(0,h.useEffect)(()=>{d.current?.querySelector(`[data-row="${m}"]`)?.scrollIntoView({block:`nearest`})},[m]);let g=(0,h.useCallback)(()=>u(e=>e+1),[]),_=async(e,r)=>{o(t=>[...t,e.path]);try{let i=await n.request(`worktrees.remove`,{path:e.path,force:r});i.residue&&I(cV(t.delete.residue,i.residue)),g()}catch(n){o(t=>t.filter(t=>t!==e.path));let i=n&&typeof n==`object`&&`code`in n?n.code:null;if(!r&&i===`DIRTY_WORKTREE`){C.set((0,V.jsx)(Ci,{title:t.delete.forceTitle,body:`${cV(t.delete.forceBody,{branch:e.branch||e.path})}\n\n${cV(t.delete.forceReason,{reason:W(n)})}`,confirmLabel:t.delete.button,onConfirm:()=>_(e,!0)}));return}I(cV(t.delete.failed,{error:W(n)}),`error`)}},v=e=>C.set((0,V.jsx)(Ci,{title:t.delete.confirmTitle,body:cV(t.delete.confirmBody,{branch:e.branch||e.path}),confirmLabel:t.delete.button,onConfirm:async()=>{_(e,!1)}})),y=n=>{if(!n.taskId){I(t.land.noTask,`error`);return}gy(e,{id:n.taskId,title:n.branch,branch:n.branch},g)},b=e=>{if(e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`c`&&!window.getSelection()?.toString())return e.preventDefault(),O.set(null);if(e.metaKey||e.ctrlKey||e.altKey)return;let t=p[m];if(e.key===`j`||e.key===`ArrowDown`)c(Math.min(p.length-1,m+1));else if(e.key===`k`||e.key===`ArrowUp`)c(Math.max(0,m-1));else if(e.key===`d`&&t)v(t);else if(e.key===`l`&&t)y(t);else if(e.key===`q`||e.key===`Escape`)O.set(null);else return;e.preventDefault()},x=0;return(0,V.jsxs)(`div`,{className:wx,tabIndex:0,ref:d,onKeyDown:b,children:[(0,V.jsx)(`h1`,{className:Tx,children:t.title}),r===null?(0,V.jsx)(`p`,{className:`text-muted`,children:t.loading}):f.length===0?(0,V.jsx)(`p`,{className:`text-muted`,children:t.noProjects}):f.map(e=>{let n=x;return x+=e.worktrees.length,(0,V.jsxs)(`section`,{className:Qx,children:[(0,V.jsxs)(`h2`,{className:`mt-1.5 mr-2 mb-1 ml-0 flex items-center gap-1 font-mono text-meta font-semibold normal-nums text-subtle`,children:[(0,V.jsx)(`span`,{children:e.repo}),(0,V.jsx)(`span`,{className:`rule`})]}),e.worktrees.length===0&&(0,V.jsx)(`p`,{className:`mono text-muted`,children:t.noWorktrees}),e.worktrees.map((e,r)=>{let i=n+r;return(0,V.jsxs)(`div`,{"data-row":i,className:$x(i===m),onClick:()=>c(i),children:[(0,V.jsxs)(`div`,{className:eS,children:[(0,V.jsx)(`span`,{className:nS,children:e.branch||t.row.detached}),e.roveManaged&&(0,V.jsx)(`span`,{className:`chip text-muted`,children:t.badge.roveManaged}),e.dirty===!0&&(0,V.jsx)(`span`,{className:`chip text-warning`,children:t.badge.dirty}),e.dirty===null&&(0,V.jsx)(`span`,{className:`chip text-muted`,children:t.badge.dirtyUnknown}),(0,V.jsx)(`span`,{className:`chip ${e.branchOnRemote===!0?`text-success`:e.branchOnRemote===!1?`text-warning`:`text-muted`}`,children:e.branchOnRemote===!0?t.badge.remoteOn:e.branchOnRemote===!1?t.badge.remoteOff:t.badge.remoteUnknown}),e.verdictReason!==`dirty`&&e.verdictReason!==`fresh`&&(0,V.jsx)(`span`,{className:`chip ${e.verdict===`merged`?`text-success`:e.verdict===`stale`?`text-warning`:`text-accent`}`,children:t.verdict[e.verdictReason]??e.verdictReason})]}),(0,V.jsxs)(`div`,{className:`${tS} mono text-muted`,children:[(0,V.jsx)(`span`,{className:rS,children:e.path}),e.createdAtMs>0&&(0,V.jsx)(`span`,{children:cV(t.row.created,{age:Ml(Date.now()-e.createdAtMs)})})]}),i===m&&(0,V.jsxs)(`div`,{className:`flex items-baseline gap-2 text-[length:var(--fs-body)]`,children:[(0,V.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>v(e),children:t.delete.button}),e.taskId&&(0,V.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>y(e),children:t.land.button})]})]},e.path)})]},e.repo)}),(0,V.jsx)(`p`,{className:`${iS} mono keys-only text-muted`,children:(0,V.jsx)(rp,{text:`j/k · d ${t.delete.button} · l ${t.land.button} · q/esc`})})]})}function uV({model:e,narrow:t}){let n=y(e.selection),r=y(e.tabs),i=y(e.tasks),a=y(e.remote),o=a.find(e=>e.id===n.taskId&&!e.machine?.stale),s=co(i,n.taskId)??o??null,c=o?void 0:a.find(e=>e.id===n.taskId),l=s?r[s.id]??[]:[],u=s?s.id in r:!1,d=y(O),f=pC(s?.id),p=s?.rowStatus?.kind===`running`,m=y(N),g=y(ec)!==`terminal`&&t&&!!s;return(0,h.useEffect)(()=>{let t=e.selection.get();return e.selection.subscribe(()=>{O.set(null),N.set(null);let n=e.selection.get();(n.taskId!==t.taskId||n.tabId!==t.tabId)&&ec.set(`terminal`),t=n})},[e]),(0,h.useEffect)(()=>ZT(e),[e]),d===`update`?(0,V.jsxs)(`main`,{className:`${En} ${Ht}`,children:[t&&(0,V.jsx)(TF,{}),(0,V.jsx)(bS,{client:e.client})]}):d===`worktrees`?(0,V.jsxs)(`main`,{className:`${En} ${Ht}`,children:[t&&(0,V.jsx)(TF,{}),(0,V.jsx)(lV,{model:e})]}):d?(0,V.jsxs)(`main`,{className:`${En} ${Ht}`,children:[t&&(0,V.jsx)(TF,{}),(0,V.jsx)(ej,{model:e,page:d})]}):m?(0,V.jsxs)(`main`,{className:`${En} ${Ht}`,children:[t&&(0,V.jsx)(TF,{}),(0,V.jsx)(`div`,{className:Dn,children:(0,V.jsx)(_v,{model:e,seed:m},Qg(m))})]}):(0,V.jsxs)(`main`,{className:`${En} ${Ht}`,children:[t&&(0,V.jsx)(TF,{taskId:s?.id,title:s?.title}),s&&(0,V.jsx)(sV,{model:e,task:s,tabs:l,narrow:t}),s&&!s.groupId&&(0,V.jsx)(iV,{model:e,taskId:s.id}),s?.groupId&&(0,V.jsx)(qB,{model:e,taskId:s.id,groupId:s.groupId}),(0,V.jsxs)(`div`,{className:`${Dn} ${p?On:``}`,style:f?{"--task-ink":f}:void 0,children:[!t&&!s&&!c&&i&&i.tasks.length+a.length===0&&(0,V.jsx)(tF,{model:e}),!s&&!c&&i&&i.tasks.length+a.length>0&&(0,V.jsx)(`p`,{className:wn,children:z(`workspace.pickTask`)}),c?.machine&&(0,V.jsx)(`div`,{className:Tn,children:(0,V.jsx)(Um,{host:c.machine.label,onMachines:()=>zv(e)})}),s&&u&&l.length===0&&!g&&(0,V.jsxs)(`div`,{className:Tn,children:[(0,V.jsx)(`p`,{children:z(`workspace.noTabs`)}),(0,V.jsx)(H,{variant:`filled`,onClick:()=>void ed(e,s.id,{kind:`engine`}).catch(e=>I(String(e),`error`)),children:s.engine?z(`workspace.startEngine`,{engine:s.engine.name}):z(`workspace.startSession`)}),` `,(0,V.jsx)(H,{variant:`filled`,onClick:()=>void $u(e,s.id),children:z(`menu.newChat`)}),` `,(0,V.jsx)(H,{variant:`filled`,onClick:()=>C.set((0,V.jsx)(ad,{model:e,taskId:s.id})),children:z(`menu.newChatPick`)})]}),s&&g&&(0,V.jsx)(zB,{model:e,task:s,narrow:!0}),s&&n.tabId&&l.some(e=>e.id===n.tabId)&&(0,V.jsx)(`div`,{className:`min-w-0 flex-1 ${g?`hidden`:`flex`}`,children:(0,V.jsx)(QB,{model:e,taskId:s.id,tab:l.find(e=>e.id===n.tabId)??l[0]},`${s.id}::${n.tabId}`)})]})]})}function dV({model:e}){B();let t=y(e.client.conn);return t.hello===null&&t.failures>=2?(0,V.jsx)(fV,{}):(0,V.jsx)(pV,{model:e})}function fV(){let[e,t]=(0,h.useState)(null);return(0,h.useEffect)(()=>{os().then(t)},[]),e===null?null:e?(0,V.jsx)(ds,{}):(0,V.jsx)(Nr,{failing:!0})}function pV({model:e}){OT(e);let t=y(e.client.conn).hello;(0,h.useEffect)(()=>{if(!t)return;wS(e.client,t.roveVersion);let n=()=>void hS(e.client).then(GB);n();let r=window.setInterval(n,36e5);return()=>window.clearInterval(r)},[t,e.client]),(0,h.useEffect)(()=>{t&&rs(e)},[t,e]),of(e),nf(e),Ro(),ma(e.client),LT(e),Da(e.client),zC(e.client),(0,h.useEffect)(()=>{e.onSelect=pe;let t=N.subscribe(()=>{N.get()!==null&&pe()});return ne(),t},[e]),(0,h.useEffect)(()=>Mw(e),[e]);let n=y(j),r=y(e.selection),i=y(e.tasks),a=y(e.remote),o=xe(),s=y(hM),c=y(gM),l=y(mM),u=y(fe),d=y(De)===`app`,f=y(rc),p=y(ac),m=y(O),g=y(se)===`drag`,_=y(N)!==null,v=a.find(e=>e.id===r.taskId&&!e.machine?.stale),b=co(i,r.taskId)??v??null,x=v?void 0:a.find(e=>e.id===r.taskId),S=jc(b?.id??null),C=Ac(b?.id??``).columns.length,w=o?Se(u,!!b||!!x,m!==null||_):null;(0,h.useEffect)(()=>e.setTaskShown(w===null||w===`content`&&m===null&&!_),[e,w,m,_]);let T=bM(l??280),E=s?0:T,D=f===null?sc(C,E):oc(f,E),k={"--rail-w":`${s?0:T}px`,"--rail-open-w":`${T}px`,"--panel-w":D===null?void 0:`${D}px`};return(0,V.jsxs)(`div`,{className:zt,children:[(0,V.jsx)(ka,{onRefresh:()=>Oa(e.client)}),(0,V.jsxs)(`div`,{className:Bt({zen:n||!S||!b&&!x||o||_,expanded:p&&!n&&!o,surface:w&&d?`back`:w,folded:s&&!o,peek:s&&c&&!o,dragging:g}),style:o?void 0:k,children:[!o&&(0,V.jsx)(CF,{model:e}),s&&!o&&(0,V.jsx)(`div`,{className:`absolute inset-y-0 left-0 z-5 col-1 row-1 w-2.5`,title:z(`layout.railUnfold`),onMouseEnter:()=>yM(!0),onMouseLeave:()=>yM(!1),onMouseUp:()=>hM.set(!1)}),(0,V.jsx)(rF,{model:e,narrow:o}),(0,V.jsx)(uV,{model:e,narrow:o}),!o&&(0,V.jsx)(zB,{model:e,task:b,remoteHost:x?.machine?.label}),(0,V.jsx)(VB,{model:e}),(0,V.jsx)(_s,{}),(0,V.jsx)(NT,{model:e}),(0,V.jsx)(po,{model:e})]})]})}var mV=`a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`;function hV(e){return[...e.querySelectorAll(mV)].filter(e=>e.tabIndex>=0&&e.offsetParent!==null)}function gV(){window.addEventListener(`keydown`,e=>{if(e.key!==`Tab`||e.defaultPrevented||e.ctrlKey||e.metaKey||e.altKey)return;let t=[...document.querySelectorAll(`.overlay:not(.is-leaving)`)].at(-1);if(!t)return;let n=hV(t);if(n.length===0)return;let r=document.activeElement,i=r instanceof HTMLElement&&t.contains(r),a=e.shiftKey?n.filter(e=>i&&!!(r.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)).at(-1)??n.at(-1):n.find(e=>i&&!!(r.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING))??n[0];e.preventDefault(),a?.focus()})}function _V(e){if(!L())for(let t of document.querySelectorAll(`${e}:not(.is-leaving)`)){let e=t.cloneNode(!0);e.classList.add(`is-leaving`),e.inert=!0,e.setAttribute(`aria-hidden`,`true`),document.body.append(e);let n=t.querySelectorAll(`*`),r=e.querySelectorAll(`*`);n.forEach((e,t)=>{let n=r[t];e.scrollTop&&(n.scrollTop=e.scrollTop),(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&(n.value=e.value)}),window.setTimeout(()=>e.remove(),200)}}function vV(e){for(let t of document.querySelectorAll(`${e}.is-leaving`))t.remove()}function yV(){for(let e of document.querySelectorAll(`.overlay:not(.is-leaving)`))for(let t of e.getAnimations())t instanceof CSSAnimation&&t.animationName===`fade-in`&&t.finish()}function bV(){let e=C.get(),t=-1/0;C.subscribe(()=>{let n=C.get();if(n===null&&e!==null)t=performance.now(),_V(`.overlay`);else if(n!==null){let n=e!==null||performance.now()-t<140;vV(`.overlay`),n&&requestAnimationFrame(yV)}e=n});let n=S.get();S.subscribe(()=>{let e=S.get();e===null&&n!==null?_V(`.menu`):e!==null&&vV(`.menu`),n=e});let r=hf.get().guide;hf.subscribe(()=>{let e=hf.get().guide;e===null&&r!==null?_V(`.prefix-guide`):e!==null&&vV(`.prefix-guide`),r=e})}var xV=500,SV=10,CV=`input, textarea, select, [contenteditable], .xterm`,wV=[`mousedown`,`mouseup`,`click`,`contextmenu`];function TV(){let e=null,t=()=>{e&&window.clearTimeout(e.timer),e=null},n=()=>{let e=e=>{e.preventDefault(),e.stopPropagation()},t=()=>{for(let t of wV)document.removeEventListener(t,e,!0);document.removeEventListener(`pointerdown`,t,!0),document.removeEventListener(`keydown`,t,!0)};for(let t of wV)document.addEventListener(t,e,!0);document.addEventListener(`pointerdown`,t,!0),document.addEventListener(`keydown`,t,!0)};document.addEventListener(`pointerdown`,r=>{if(t(),r.pointerType!==`touch`||!(r.target instanceof Element)||r.target.closest(CV))return;let i=r.target,a={x:r.clientX,y:r.clientY,native:!1,timer:window.setTimeout(()=>{e=null,!(a.native||!i.isConnected)&&(i.dispatchEvent(new MouseEvent(`contextmenu`,{bubbles:!0,cancelable:!0,clientX:a.x,clientY:a.y,button:2})),n())},xV)};e=a},!0),document.addEventListener(`pointermove`,n=>{e&&Math.hypot(n.clientX-e.x,n.clientY-e.y)>SV&&t()},!0),document.addEventListener(`pointerup`,t,!0),document.addEventListener(`pointercancel`,t,!0),document.addEventListener(`contextmenu`,t=>{e&&t.isTrusted&&(e.native=!0)},!0)}function EV(e,t){e.viewingExtras=()=>uc({narrow:ye(),panelOpen:Mc(e.selection.get().taskId),zen:j.get()});let n=()=>e.reportViewing();ic.subscribe(n),Nc(n),j.subscribe(n),be(n),t.on(`panel`,t=>{lc(t)&&Wc(t,e.selection.get().taskId)})}function DV(e){let t=e;return!!t&&typeof t.promptId==`string`&&typeof t.title==`string`}function OV({client:e,prompt:t}){let n=(B()===`zh`?Oi:Di).prompt,[r,i]=(0,h.useState)(t.initial??``),a=(0,h.useRef)(!1),{busy:o,error:s,submit:c}=xi();return(0,h.useEffect)(()=>()=>{a.current||e.request(`ui.promptReply`,{promptId:t.promptId}).catch(()=>{})},[e,t.promptId]),(0,V.jsx)(bi,{title:t.title,children:(0,V.jsxs)(`form`,{className:Wr,onSubmit:n=>{n.preventDefault(),c(async()=>{await e.request(`ui.promptReply`,{promptId:t.promptId,value:r}),a.current=!0})},children:[(0,V.jsx)(`input`,{className:jr,"aria-label":n.fieldLabel,autoFocus:!0,spellCheck:!1,value:r,placeholder:t.placeholder,onChange:e=>i(e.target.value)}),s&&(0,V.jsx)(`p`,{className:`text-error`,children:s}),(0,V.jsx)(Ti,{busy:o,submitLabel:n.submitLabel})]})})}function kV(e,t){C.get()||C.set((0,V.jsx)(OV,{client:e,prompt:t},t.promptId))}var AV=900,jV=new WeakMap;function MV(e){e.setAttribute(`data-scrolling`,``),window.clearTimeout(jV.get(e)),jV.set(e,window.setTimeout(()=>e.removeAttribute(`data-scrolling`),AV))}function NV(){document.addEventListener(`scroll`,e=>{let t=e.target instanceof Element?e.target:document.scrollingElement;t&&MV(t)},{capture:!0,passive:!0})}var PV=`rove-web.reloadedFor`;function FV(e,t,n){return e===null?`adopt`:t===e||t===n?`stay`:`reload`}function IV(){let e=null;try{e=window.sessionStorage}catch{}return{storage:e,reload:()=>window.location.reload()}}function LV(e,t=IV()){let n=null,r=null,i=()=>{try{return t.storage?.getItem(PV)??r}catch{return r}};return e.conn.subscribe(()=>{let{state:a,hello:o}=e.conn.get();if(a!==`open`||!o)return;let s=FV(n,o.roveVersion,i());if(s===`adopt`&&(n=o.roveVersion),s===`reload`){r=o.roveVersion;try{t.storage?.setItem(PV,o.roveVersion)}catch{}t.reload()}})}function RV(){let e=window.visualViewport;if(!e)return;let t=document.documentElement,n=()=>{t.style.setProperty(`--vvh`,`${e.height*e.scale}px`),t.toggleAttribute(`data-keyboard`,window.innerHeight-e.height*e.scale>120),e.scale===1&&window.scrollY!==0&&window.scrollTo(0,0)};e.addEventListener(`resize`,n),e.addEventListener(`scroll`,n),window.addEventListener(`scroll`,n,{passive:!0}),n()}var zV=(0,g.createRoot)(document.getElementById(`root`));RV(),TV(),Ne(),NV(),bV(),gV(),kP();function BV(e){let t=new Ko(qo(),e),n=new uo(t);t.on(`prompt`,e=>{DV(e)&&kV(t,e)}),EV(n,t),LV(t),t.start(),zV.render((0,V.jsx)(h.StrictMode,{children:(0,V.jsx)(dV,{model:n})}))}var VV=i();VV?BV(VV):Promise.all([ss(),os()]).then(([e,t])=>{e?BV(``):zV.render((0,V.jsx)(h.StrictMode,{children:t?(0,V.jsx)(ds,{}):(0,V.jsx)(Nr,{})}))});export{fp as a,Qf as c,Ho as d,Mn as f,se as h,$S as i,Zf as l,ee as m,ZF as n,Xf as o,Pn as p,YF as r,Yf as s,MV as t,X as u};
|