@sma1lboy/rove 0.9.285-next.179 → 0.9.285-next.180

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.
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/term-mount-C2LWd3qT.js","assets/term-mount-BrP-ENHg.css"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/term-mount-Dd1VUXUW.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 ee=/\/+/g;function A(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function te(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 ne(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,ne(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+A(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(ee,`$&/`)+`/`),ne(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(ee,`$&/`)+`/`)+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+A(a,u),c+=ne(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+A(a,u++),c+=ne(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return ne(te(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 j(e,t,n){if(e==null)return e;var r=[],i=0;return ne(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function re(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 M=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)},N={map:j,forEach:function(e,t,n){j(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return j(e,function(){t++}),t},toArray:function(e){return j(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=N,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:re}},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,M)}catch(e){M(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&&A(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&&A(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,ee=k.port2;k.port1.onmessage=D,O=function(){ee.postMessage(null)}}else O=function(){_(D,0)};function A(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,A(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`),ee=Symbol.for(`react.memo_cache_sentinel`),A=Symbol.iterator;function te(e){return typeof e!=`object`||!e?null:(e=A&&e[A]||e[`@@iterator`],typeof e==`function`?e:null)}var ne=Symbol.for(`react.client.reference`);function j(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ne?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?j(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return j(e(t))}catch{}}return null}var re=Array.isArray,M=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,N=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ie={pending:!1,data:null,method:null,action:null},ae=[],oe=-1;function se(e){return{current:e}}function ce(e){0>oe||(e.current=ae[oe],ae[oe]=null,oe--)}function P(e,t){oe++,ae[oe]=e.current,e.current=t}var le=se(null),ue=se(null),de=se(null),fe=se(null);function pe(e,t){switch(P(de,t),P(ue,e),P(le,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}}ce(le),P(le,e)}function me(){ce(le),ce(ue),ce(de)}function he(e){e.memoizedState!==null&&P(fe,e);var t=le.current,n=Wd(t,e.type);t!==n&&(P(ue,e),P(le,n))}function ge(e){ue.current===e&&(ce(le),ce(ue)),fe.current===e&&(ce(fe),ep._currentValue=ie)}var _e,ve;function ye(e){if(_e===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);_e=t&&t[1]||``,ve=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+_e+e+ve}var be=!1;function xe(e,t){if(!e||be)return``;be=!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,10 +13,10 @@ 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.`}},le={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;在这里汇报。`}},ue=n({en:()=>de,zh:()=>fe}),de={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`}},fe={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} 条`}},pe=n({en:()=>me,zh:()=>he}),me={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`,refresh:`Refresh`,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:`{protocol}, ssh {ssh}`,synced:`{machine} now uses @{login}`},general:{groupInterface:`Interface`,groupFiles:`Files and worktrees`,groupTerminal:`Terminal`,editorNote:`Opens files from the file tree. auto follows $VISUAL / $EDITOR, else nvim / vim / emacs / nano.`,tabStrip:`Tab strip`,scrollback:`Scrollback`},appearance:{groupColours:`Colours`,groupTasks:`Tasks and panes`,groupTerminal:`Terminal app only`,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`,statusMarkNote:`Engine icon: its colour is the state. Dots: the icon keeps its own colours and a dot mark at the row's end is the state.`,statusMarkEngine:`Engine icon`,statusMarkDots:`Dots`},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:{terminalOnly:`Terminal only: the TUI changes, this page has nothing to draw.`,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`}},he={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:`本机`,refresh:`刷新`,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:`{protocol}, ssh {ssh}`,synced:`{machine} 现在使用 @{login}`},general:{groupInterface:`界面`,groupFiles:`文件与 worktree`,groupTerminal:`终端`,editorNote:`从文件树打开文件时用它。auto 跟随 $VISUAL / $EDITOR,否则依次尝试 nvim / vim / emacs / nano。`,tabStrip:`标签栏`,scrollback:`回滚行数`},appearance:{groupColours:`颜色`,groupTasks:`任务与面板`,groupTerminal:`仅终端应用`,taskColorsNote:`让每个任务在工作边框和列表里有自己的色调。`,colorblindNote:`新增和删除的行用蓝色和红色,而不是绿色和红色。`,workingBorderNote:`所选任务工作时,面板边框的样子。`,railGroup:`任务列表`,railGroupProject:`按项目`,railGroupState:`按状态`,statusMark:`任务状态`,statusMarkNote:`引擎图标:图标的颜色表示状态。点阵:图标保持自己的颜色,由行尾的点阵表示状态。`,statusMarkEngine:`引擎图标`,statusMarkDots:`点阵`},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:{terminalOnly:`仅终端:TUI 会变化,网页没有可画的东西。`,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:`粘贴路径 / 截图 → 插入图片占位行`}},ge=n({en:()=>_e,zh:()=>ve}),_e={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`}},ve={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:`终端末尾`}},ye=n({en:()=>be,zh:()=>xe}),be={usage:{title:`Usage`,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:`{engine} {label} {percent}% · at this pace full around {time}, before it resets`,lasts:`{engine} {label} {percent}% · at this pace it lasts until the reset`,window:`{engine} {label} {percent}%`}},xe={usage:{title:`用量`,open:`打开用量`,range:`最近 {days} 天 · token 为输入加输出`,perDay:`按天`,byModel:`按引擎和模型`,topTasks:`用量最高的任务`,quota:`额度`,turns:`{count} 轮`,loading:`加载中…`,empty:`这段时间没有记录到任何一轮。`,failed:`无法读取用量:{error}`,cutoff:`守护进程最多返回 {count} 轮:{day} 及更早的数据不完整。`,noReader:`{engines}:没有轮次读取器,这里不统计它们的工作。`,removedTask:`(已删除的任务)`,full:`{engine} {label} {percent}% · 按当前速度约 {time} 用完,早于重置时间`,lasts:`{engine} {label} {percent}% · 按当前速度可撑到重置`,window:`{engine} {label} {percent}%`}},Se=n({en:()=>Ce,zh:()=>we}),Ce={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`,type:`Type instead`,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?`}}},we={voice:{say:`说`,stop:`停 {time}`,release:`松手 {time}`,working:`在听…`,hint:`口述:点一下开始、再点一下结束,或按住说话、松手结束`,slideToSend:`上滑发送`,tipSend:`松手发送`,hold:`按住说话`,type:`打字`,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:`删除这个服务地址和密钥?`}}},Te=n({en:()=>Ee,zh:()=>De}),Ee={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`},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`}},De={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:`忽略`},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:`终端`}},Oe=[ae,Te,D,ne,pe,x,M,ue,ye,ge,ee,v,ce,w,Se],ke=Object.assign({},...Oe.map(e=>e.en)),Ae={en:ke,zh:Object.assign({},...Oe.map(e=>e.zh))};function je(){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 Me=g(je());function Ne(){let e=typeof document>`u`?void 0:document.documentElement;e&&(e.lang=Me.get()===`zh`?`zh-CN`:`en`)}Ne(),Me.subscribe(Ne);function Pe(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 Fe(e,t){return t?e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e)):e}function F(e,t){return Fe(Pe(Ae[Me.get()],e)??Pe(ke,e)??e,t)}function Ie(e,t,n){return Fe(Pe(e[Me.get()],t)??Pe(e.en,t)??t,n)}function I(){return _(Me)}function Le(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 Re=(...e)=>e.filter(Boolean).join(` `),ze=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})),L=t(((e,t)=>{t.exports=ze()}))(),Be=({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`,Ve={link:`text-accent hover:underline`,filled:Be(),danger:Be({danger:!0}),action:`rounded-sm border-hairline border-line px-3 py-1.25 font-sans text-meta text-ink hover:border-line-active hover:bg-hover 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`,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`},He={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 R({variant:e=`link`,hit:t=e===`link`?`roomy`:`none`,className:n,type:r=`button`,...i}){return(0,L.jsx)(`button`,{type:r,className:Re(Ve[e],He[t],n),...i})}var Ue=`text-meta leading-[inherit]`,We=`font-normal normal-nums`,Ge=`touch:relative touch:after:absolute touch:after:content-['']`,Ke=`flex h-full flex-col`,qe=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(` `),Je=[`relative narrow-content:hidden 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(` `),Ye=`rail-folded:col-2 panel-expanded:invisible panel-expanded:col-2 narrow-sidebar:hidden`,Xe=`rail-folded:col-3 panel-expanded:z-2 panel-expanded:col-[2/-1] panel-expanded:bg-paper panel-expanded:pl-2`,Ze=`${Ge} touch:after:-inset-x-1.5 touch:after:-inset-y-3`,Qe=`flex items-center gap-2`,$e=`px-1.5 py-0.5 text-meta font-bold ${Ge} touch:after:-inset-2.5 touch:after:-bottom-1`,et=`flex items-center rounded-sm px-2.5 py-1.5 text-muted aria-selected:bg-inset aria-selected:text-ink [&_svg]:size-4 ${Ge} touch:after:-inset-x-px touch:after:-top-2 touch:after:-bottom-1.5`,tt=`keys-only m-0 overflow-hidden px-3.5 py-1 text-meta text-ellipsis whitespace-nowrap`,nt=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`}`,rt=`relative min-w-0 flex-1`,it={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)]`]},at=(e,t)=>it[e][+!!t],ot=(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?at(`left`,t.active):``} ${t.top?at(`top`,t.active):``} ${t.left||t.top?r:``}`:e===`rail`?`${n} ${at(`left`,t.active)} ${r} ${t.top?`[--mt:6px]`:``}`:e===`rule`?`${n} ${at(`top`,t.active)} ${r} ${t.left?`[--ml:8px]`:``}`:n},st=(e,t)=>`absolute right-2 z-3 bg-paper px-1 font-mono text-meta ${We} ${e?`-top-2`:`top-0.5`} ${t?`text-accent`:`text-subtle`}`,ct=`hidden gap-1 overflow-x-auto scrollbar-none [border-top:var(--hairline)_solid_var(--line)] bg-surface px-1.5 py-1 touch:flex`,lt=e=>`h-8 min-w-max touch-manipulation [flex:1_1_0] rounded-sm border-hairline bg-inset px-0.5 py-0 font-mono text-meta ${We} ${e?`border-accent text-accent`:`border-line text-ink`}`,ut=`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`,dt=`min-w-[3ch] text-accent`,ft=`mb-1.5 flex justify-between gap-4`,pt=`columns-[2_220px] gap-x-5`,mt=`mb-2 break-inside-avoid`,ht=`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`,gt=`mx-0 my-2 overflow-x-hidden overflow-y-auto scrollbar-none`,_t=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 ${We} whitespace-pre text-ink touch:py-2.5 ${e?`is-selected bg-hover`:``}`,vt=`min-w-0 overflow-hidden text-ellipsis`,yt=`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`,bt=`flex justify-between gap-4`,xt=`flex flex-col items-end ${Ue}`,St=`mt-2 max-h-[52vh] overflow-y-auto`,Ct=`mb-2.5`,wt=`m-0 mb-1 font-sans text-meta font-bold normal-nums text-accent`,Tt=`flex gap-3 py-px ${Ue}`,Et=`min-w-[14ch] text-ink`,Dt=`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`,Ot=`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 ${We} text-ink shadow-popover`,kt=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]`}`,At=`m-auto font-mono text-meta ${We} text-subtle`,jt=`${At} flex flex-col items-center gap-3 [&_p]:m-0`,Mt=`workspace row-1 flex min-h-0 min-w-0 flex-col gap-1.5 px-1 pt-2 pb-1`,Nt=`flex min-h-0 flex-1 overflow-hidden rounded-md border-hairline border-line bg-paper focus-within:border-focus`,Pt=`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`,Ft=`relative flex min-w-0 flex-1 flex-col`,It=`relative flex min-h-0 min-w-0 flex-1 flex-col`,Lt=`term-host relative min-h-0 min-w-0 flex-1 touch-none overflow-hidden`,Rt=`pointer-events-none absolute inset-0 z-5 h-full w-full`,zt=`relative h-full [&.is-leaving]:pointer-events-none [&.is-leaving]:absolute [&.is-leaving]:inset-0 [&.is-leaving]:z-6`,Bt=`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)]`,Vt=e=>`absolute right-2.5 bottom-2.5 z-5 flex items-center gap-3 rounded-sm border-hairline border-line bg-inset px-2.5 py-1.25 font-mono text-meta ${We} ${e?`text-error`:`text-muted`} [&_.link:disabled]:pointer-events-none [&_.link:disabled]:opacity-60`,Ht=`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 ${We} whitespace-nowrap text-muted`,Ut=e=>`size-1.5 rounded-full ${e?`bg-warning`:`bg-subtle`}`,Wt=`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`,Gt=`col-span-3 grid cursor-pointer grid-cols-subgrid items-center text-left hover:text-ink`,Kt={ok:`text-muted`,warn:`text-warning`,crit:`text-error`},qt={ok:`text-success`,warn:`text-warning`,crit:`text-error`},Jt=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-[''] ${qt[e]??qt.ok}`,Yt=`font-mono text-title font-bold normal-nums tracking-[0.02em] whitespace-nowrap`,Xt=`text-accent`,Zt=`grid h-full place-items-center p-6`,Qt=`flex w-[min(460px,100%)] flex-col gap-3 rounded-md border-hairline border-line bg-surface p-6 [&_p]:m-0`,$t=`flex flex-col gap-2 p-3.5 text-left font-sans text-meta ${We} leading-[1.5]`,en=`mx-2.5 my-3 font-mono text-meta text-subtle`,tn=`font-sans text-meta text-subtle`,nn=`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`,rn=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`:``}`,an=`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`,on=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`}`,z=`m-0 font-sans text-meta font-medium normal-nums`,sn=`link text-accent [&:hover]:underline touch-hit`,cn=`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`,ln=`${cn} w-full px-2.5 py-2`,un=`actions flex items-center justify-end gap-3.5`;function dn({failing:e=!1}){I();let[t,n]=(0,h.useState)(``),[r,i]=(0,h.useState)(!1);return(0,L.jsx)(`div`,{className:Zt,children:(0,L.jsxs)(`form`,{className:Qt,onSubmit:e=>{e.preventDefault();let n=Le(t);if(!n){i(!0);return}a(n),window.location.reload()},children:[(0,L.jsxs)(`span`,{className:Yt,children:[(0,L.jsx)(`span`,{className:Xt,children:`[`}),` rove `,(0,L.jsx)(`span`,{className:Xt,children:`]`})]}),(0,L.jsx)(`h1`,{className:`${z} text-muted`,children:F(`connect.title`)}),(0,L.jsx)(`p`,{className:e?`text-error`:`text-muted`,children:F(e?`connect.failing`:`connect.body`)}),(0,L.jsx)(`input`,{className:ln,autoFocus:!0,spellCheck:!1,placeholder:F(`connect.placeholder`),value:t,onChange:e=>{n(e.target.value),i(!1)}}),r&&(0,L.jsx)(`p`,{className:`text-error`,children:F(`connect.invalid`)}),(0,L.jsxs)(`div`,{className:un,children:[e&&(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>{o(),window.location.reload()},children:F(`connect.forget`)}),(0,L.jsx)(`button`,{type:`submit`,className:Be(),children:F(`connect.submit`)})]})]})})}function fn(e,t){let n=e.filter(e=>e.rare&&!e.children);if(n.length===0)return[...e];let r=e.filter(e=>!n.includes(e)),i={label:t,section:`more`,children:n.map(({section:e,...t})=>t)},a=r.findIndex(e=>e.section===`danger`);return a<0?[...r,i]:[...r.slice(0,a),i,...r.slice(a)]}function pn(e,t){for(let n of e){if(n.binding===t)return n;let e=n.children&&pn(n.children,t);if(e)return e}}var mn=g(null),B=g(null),hn=null;B.subscribe(()=>{let e=document.activeElement;if(B.get()!==null){!hn&&e instanceof HTMLElement&&!e.closest(`.dialog`)&&(hn=e);return}let t=hn;hn=null,window.setTimeout(()=>{t?.isConnected&&(!document.activeElement||document.activeElement===document.body)&&t.focus()},0)});var gn=g([]),_n=[`worktrees`,`update`,`kanban`,`routines`,`issues`,`mods`,`compare`,`usage`];function vn(e,t){let n=null;try{n=t(JSON.parse(sessionStorage.getItem(e)??`null`))}catch{}let r=g(n);return r.subscribe(()=>{try{let t=r.get();t===null?sessionStorage.removeItem(e):sessionStorage.setItem(e,JSON.stringify(t))}catch{}}),r}var V=vn(`rove.web.page`,e=>_n.find(t=>t===e)??null),yn=g(null),bn=vn(`rove.web.compareGroup`,e=>typeof e==`string`?e:null),xn=g(null),Sn=g(!0),Cn=`rove.web.newSession`;function wn(){try{let e=JSON.parse(sessionStorage.getItem(Cn)??`null`);return e&&typeof e==`object`?e:null}catch{return null}}var Tn=g(wn());Tn.subscribe(()=>{try{let e=Tn.get();if(!e)return sessionStorage.removeItem(Cn);let{prompt:t,...n}=e;sessionStorage.setItem(Cn,JSON.stringify(n))}catch{}});function En(e,t,n,r,i){Dn({...e?{repo:e}:{},...t?{baseBranch:t}:{},...n?{machine:n}:{},...r?{prompt:r}:{},...i?{ungrouped:!0}:{}})}function Dn(e){V.set(null),B.set(null),Tn.set(e)}function On(){let e=new URLSearchParams(window.location.search),t=e.get(`prompt`);if(t===null)return;let n=e.get(`repo`)??void 0;e.delete(`prompt`),e.delete(`repo`);let r=e.toString();history.replaceState(null,``,`${window.location.pathname}${r?`?${r}`:``}${window.location.hash}`),En(n,void 0,void 0,t)}var kn=1,An=4e3,jn=8e3;function H(e,t=`info`,n){let r=kn++;gn.set([...gn.get(),{id:r,text:e,tone:t,...n?{action:n}:{}}].slice(-3)),window.setTimeout(()=>Nn(r),n?jn:An)}function Mn(){return typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches}function Nn(e){if(!gn.get().some(t=>t.id===e&&!t.leaving))return;let t=()=>gn.set(gn.get().filter(t=>t.id!==e));if(Mn()){t();return}gn.set(gn.get().map(t=>t.id===e?{...t,leaving:!0}:t)),window.setTimeout(t,140)}function Pn(){B.set(null)}var Fn=g(null),In=null;function Ln(){Fn.get()!==`drag`&&(In!==null&&window.clearTimeout(In),Fn.set(`slide`),In=window.setTimeout(()=>Fn.set(null),240))}function Rn(e){In!==null&&window.clearTimeout(In),In=null,Fn.set(e?`drag`:null)}var zn=`flex flex-col gap-1.5`,Bn=`min-h-18 max-h-[50vh] leading-[1.45]`,Vn=`flex flex-wrap gap-1.5`,Hn=(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`}`}`,Un=`m-0 list-none p-0`,Wn=`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`,Gn=(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`,Kn=`flex items-center justify-between gap-3`,qn=`m-0 min-w-0 font-sans text-title leading-[1.4] font-semibold normal-nums text-ink wrap-anywhere`,Jn=`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-['']`,Yn=`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`,Xn=(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`,Zn=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`:``}`,Qn=`font-mono text-meta normal-nums`,$n=e=>`${Qn} ${e.danger&&e.selected?`text-inherit`:e.selected?`text-muted`:`text-subtle`} touch:hidden!`,er=e=>`${Qn} ${e?`text-ink`:`text-subtle`}`,tr=`${Qn} text-accent`,nr=`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`,rr=`flex cursor-default flex-wrap items-baseline justify-between gap-x-3`,ir=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`,ar=`text-subtle`,or=`flex items-baseline justify-between gap-3`,sr=`mt-1`,cr=`m-0 flex list-none flex-col gap-0.5 p-0`,lr=`flex min-w-0 items-baseline gap-2.5`,ur=`flex-none font-mono text-meta font-normal normal-nums min-w-[3ch] text-right text-subtle`,dr=`flex items-baseline gap-1`,fr=`min-w-0 flex-1`,pr=`flex-none min-w-[calc(9ch+0.5rem)] whitespace-nowrap pr-2 text-right font-mono text-meta`,mr=`font-mono [&:hover]:text-accent`,hr={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`},gr=`bg-hover cursor-grabbing scale-[1.02] motion-reduce:scale-none`,_r=`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 vr(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?gr: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 ${_r}`:``} ${t} ${hr[e.size??`row`]} ${n}`}var yr=`row-title min-w-0 flex-1 truncate`,br=`row-title min-w-0 flex-auto truncate text-(length:--fs-title)`,xr=`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`,Sr=`w-[1ch] flex-none text-center font-mono`,Cr=`grid w-[2ch] flex-none place-items-center font-mono text-subtle`,wr=`flex flex-none gap-1.5 font-mono text-meta`;function U(e){return e instanceof Error?e.message:String(e)}function Tr(e){I();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(),Pn())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,L.jsx)(`div`,{className:Wn,onMouseDown:e=>e.target===e.currentTarget&&Pn(),children:(0,L.jsxs)(`dialog`,{ref:t,tabIndex:-1,open:!0,className:Gn(e.wide),"aria-label":e.title,children:[(0,L.jsxs)(`div`,{className:Kn,children:[(0,L.jsx)(`h1`,{className:qn,children:e.title}),(0,L.jsx)(`button`,{type:`button`,className:Jn,"aria-label":F(`dialog.close`),title:F(`dialog.close`),onClick:Pn,children:`×`})]}),e.children]})})}function Er(){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(),Pn()}catch(e){r(U(e))}finally{t(!1)}}}}function Dr(e){let[t,n]=(0,h.useState)(e.initial??``),{busy:r,error:i,submit:a}=Er();return(0,L.jsx)(Tr,{title:e.title,children:(0,L.jsxs)(`form`,{className:Yn,onSubmit:n=>{n.preventDefault(),(t.trim()||e.allowEmpty)&&a(()=>e.onSubmit(t.trim()))},children:[e.multiline?(0,L.jsx)(`textarea`,{className:`${ln} ${Bn}`,"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,L.jsx)(`input`,{className:ln,"aria-label":e.title,autoFocus:!0,spellCheck:!1,value:t,onChange:e=>n(e.target.value),onFocus:e=>e.currentTarget.select()}),i&&(0,L.jsx)(`p`,{className:`text-error`,children:i}),(0,L.jsx)(Ar,{busy:r,submitLabel:e.submitLabel})]})})}function Or(e){let{busy:t,error:n,setError:r,submit:i}=Er(),[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(U(n))),n}});return(0,L.jsx)(Tr,{title:a&&e.escalate?.title||e.title,children:(0,L.jsxs)(`div`,{className:Yn,children:[(0,L.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,L.jsx)(`p`,{className:`text-error`,children:n}),(0,L.jsxs)(`div`,{className:un,children:[(0,L.jsx)(`button`,{type:`button`,className:sn,onClick:Pn,children:F(`dialog.cancel`)}),e.secondary&&!a&&(0,L.jsx)(`button`,{type:`button`,className:Be({danger:!0}),disabled:t,onClick:()=>f(!0),children:e.secondary.label}),(0,L.jsx)(`button`,{ref:d,type:`button`,className:Be({danger:!0}),disabled:t,onClick:()=>f(!1),children:a&&e.escalate?e.escalate.label:e.confirmLabel})]})]})})}function kr(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}=Er(),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,L.jsx)(Tr,{title:e.title,children:(0,L.jsxs)(`div`,{className:Yn,children:[(0,L.jsx)(`ul`,{className:Un,children:e.choices.map((t,a)=>(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{type:`button`,"aria-pressed":t.value===e.current,disabled:i,className:vr({selected:a===n}),onMouseEnter:()=>r(a),onClick:()=>s(t.value),children:[(0,L.jsx)(`span`,{className:`${Sr} text-accent`,children:t.value===e.current?`●`:` `}),(0,L.jsx)(`span`,{className:yr,children:t.label})]})},t.value))}),a&&(0,L.jsx)(`p`,{className:`text-error`,children:a})]})})}function Ar({busy:e,submitLabel:t}){return(0,L.jsxs)(`div`,{className:un,children:[(0,L.jsx)(`button`,{type:`button`,className:sn,onClick:Pn,children:F(`dialog.cancel`)}),(0,L.jsx)(`button`,{type:`submit`,className:Be(),disabled:e,children:t})]})}function jr(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 Mr={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`}},Nr={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:`提交`}},Pr={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"}},Fr={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"}},Ir={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."}},Lr={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`,然后重试。"}},Rr={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`}},zr={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} 在这台机器上不可用——去 设置 → 自动路由 重新指定`}},Br={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`},Vr={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} 里已有补全配置 — 未改动`},Hr={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`},Ur={title:`快速任务 · {repoLabel}`,promptLabel:`提示词`,promptPlaceholder:`这个任务要做什么?`,attemptsLabel:`尝试次数`,engineLabel:`引擎`,branchLabel:`分支`,legend:`enter 创建 · tab 切换字段 · ctrl+e 引擎 · ctrl+v 附件 · esc 取消`,startedRound:`已启动 {count} 个尝试`,roundPartial:`已启动 {ok}/{count} 个尝试 —— {failed} 个失败`},Wr={cancel:`cancel`,forgetProjectTitle:`Remove project "{title}"?`,forgetProjectBody:"Forgets it from the projects list. 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`},Gr={cancel:`取消`,forgetProjectTitle:`从列表中移除项目「{title}」?`,forgetProjectBody:"只是把它从项目列表里忘掉。仓库、分支、worktree 以及它下面的任务都会留在磁盘上——之后可以用 `rove add` 重新加回来。",forgetProjectConfirm:`移除`,deleteTitle:`移除会话「{title}」?`,deleteTitleDir:`移除会话「{title}」?`,deleteBodyDir:`结束这个会话,关闭它的所有标签页。磁盘上什么都不动:文件夹和里面的文件都会保留。`,deleteBodyMain:`结束这个会话,关闭它的所有标签页。项目仍留在列表里,磁盘上什么都不动:仓库、分支和 worktree 都会保留。`,deleteBodyTask:`结束这个会话,关闭它的所有标签页,并删除它的 worktree 文件夹。git 分支会保留。`,deleteBodyTaskBranch:`结束这个会话,关闭它的所有标签页,删除它的 worktree 文件夹,以及已合并的 git 分支。未合并的分支会保留。`,deleteConfirm:`移除`,childrenTitle:`「{title}」有 {count} 个子任务`,childrenBody:`提升会把它们上移一级,并保留它们的 worktree 和会话。连同子任务移除会把它们一并移除。`,childrenPromote:`提升子任务`,childrenCascade:`连同子任务移除`,childrenBodyMain:`结束这个会话并关闭它的标签页,磁盘上什么都不动。它的子任务会继续运行,除非你也选择把它们一并删除。`,childrenKeepMain:`移除会话`,childrenCascadeMain:`连同子任务移除`,forceDeleteTitle:`「{title}」有未提交的改动`,forceDeleteConfirm:`强制移除`},Kr={noDaemonWorktree:"No daemon running — can't create the worktree. Start it with `rove daemon restart`.",noEditor:`No editor found — set ROVE_OPEN_EDITOR (e.g. 'code', 'cursor', 'nvim')`,openWorktreeFailed:`Couldn't open worktree with {label}`,worktreeErrorDeleting:`This task is being deleted — it can't be opened`,worktreeErrorNotGit:"This project isn't a git repo yet — a task needs a git branch. Run `git init` (+ a first commit) in the project, then open the task. Non-git support is coming.",worktreeErrorGeneric:`Couldn't create the worktree: {message}`,scratchAdopted:`Adopted into {repo} — save it as a project from New Task if you want it in the picker`,scratchOpenFailed:`Couldn't open a scratch shell: {message}`,scratchCloseFailed:`Couldn't close the scratch task: {message}`,worktreeGoneTitle:`Worktree for "{title}" is gone`,worktreeGoneBody:`Closed {count} tab(s). The branch {branch} is still there — reopen the task to re-create its worktree.`,checksPassingTitle:`Checks passed for "{title}"`,checksFailingTitle:`Checks failed for "{title}"`,checksResolvedBody:`PR {pr} on {branch}`,copiedId:`Copied task ID {text}`,copiedTab:`Copied tab address {text}`,copiedBranch:`Copied branch {text}`,copiedPath:`Copied path {text}`,copyFailed:`Couldn't reach a clipboard — no clipboard command on PATH, and this terminal refused OSC 52.`,forgetProjectFailed:`Couldn't remove the project — it stays in the projects list: {error}`,deleteFailed:`Couldn't delete "{title}" — the task and its worktree are untouched: {error}`,createFailed:`Couldn't create the task — nothing was created: {error}`,engineStartFailed:`Task created; engine did not start`,engineStartRetry:`{error}. Press ⏎ on the task to retry.`,forkFailed:`Couldn't fork the task — the original is untouched: {error}`,forkLeftBehind:`Started from the last commit — uncommitted work stays in the original task ({reason})`,childFailed:`Couldn't start the new conversation — the current one is untouched: {error}`,renameFailed:`Couldn't rename the task — it keeps its old title: {error}`,renameBranchFailed:`Couldn't rename the branch — it stays "{branch}": {error}`,switchEngineFailed:`Couldn't switch the engine — the task keeps the one it had: {error}`,setStatusFailed:`Couldn't set the status — it stays {status}: {error}`,pinFailed:`Couldn't change the pin — the task keeps its current place: {error}`,moveFailed:`Couldn't move the task — it keeps its current place: {error}`,moveToProjectFailed:`Couldn't move the task to that project — it stays where it was: {error}`,movedToProject:`Moved to {project} — the session and its checkout stay where they are`,issueChatFailed:`Couldn't start the issue chat — the issue is unchanged: {error}`,inboxMarkReadFailed:`Couldn't mark it read — it stays in the inbox: {error}`,inboxDismissFailed:`Couldn't dismiss it — it stays in the inbox: {error}`,engineSwitched:`Engine → {engine} (applies on reopen)`,statusSet:`Status → {status}`},qr={noDaemonWorktree:"守护进程未运行——无法创建 worktree。请运行 `rove daemon restart` 启动它。",noEditor:`未找到编辑器——请设置 ROVE_OPEN_EDITOR(如 'code'、'cursor'、'nvim')`,openWorktreeFailed:`无法用 {label} 打开 worktree`,worktreeErrorDeleting:`该任务正在删除中——无法打开`,worktreeErrorNotGit:"该项目尚非 git 仓库——任务需要 git 分支。请在项目中执行 `git init`(+ 首次提交)后再打开任务。非 git 项目的支持即将推出。",worktreeErrorGeneric:`无法创建 worktree:{message}`,scratchAdopted:`已归入 {repo}——若要出现在项目选择器里,可在新建任务中保存为项目`,scratchOpenFailed:`无法打开临时 Shell:{message}`,scratchCloseFailed:`无法关闭临时任务:{message}`,worktreeGoneTitle:`"{title}" 的 worktree 已消失`,worktreeGoneBody:`已关闭 {count} 个标签页。分支 {branch} 仍在——重新打开该任务会重建 worktree。`,checksPassingTitle:`「{title}」的 PR 检查已通过`,checksFailingTitle:`「{title}」的 PR 检查失败了`,checksResolvedBody:`PR {pr},分支 {branch}`,copiedId:`已复制任务 ID {text}`,copiedTab:`已复制标签页地址 {text}`,copiedBranch:`已复制分支 {text}`,copiedPath:`已复制路径 {text}`,copyFailed:`无法访问剪贴板——PATH 上没有剪贴板命令,这个终端也拒绝了 OSC 52。`,forgetProjectFailed:`移除项目失败——它仍在项目列表里:{error}`,deleteFailed:`删除「{title}」失败——任务和它的 worktree 都没有被改动:{error}`,createFailed:`创建任务失败——什么都没有被创建:{error}`,engineStartFailed:`任务已创建,引擎没有启动`,engineStartRetry:`{error}。在任务上按 ⏎ 重试。`,forkFailed:`fork 任务失败——原任务没有被改动:{error}`,forkLeftBehind:`已从最近一次提交开始——未提交的改动留在原任务里({reason})`,childFailed:`无法开始新对话——当前对话没有被改动:{error}`,renameFailed:`重命名任务失败——它仍用原来的标题:{error}`,renameBranchFailed:`重命名分支失败——它仍是「{branch}」:{error}`,switchEngineFailed:`切换引擎失败——任务仍使用原来的引擎:{error}`,setStatusFailed:`设置状态失败——它仍是 {status}:{error}`,pinFailed:`修改置顶状态失败——任务仍在原来的位置:{error}`,moveFailed:`移动任务失败——它仍在原来的位置:{error}`,moveToProjectFailed:`移到该项目失败——任务仍在原来的项目:{error}`,movedToProject:`已移到 {project}——会话和它的工作目录都没有动`,issueChatFailed:`启动议题会话失败——议题没有被改动:{error}`,inboxMarkReadFailed:`标记为已读失败——它仍留在收件箱里:{error}`,inboxDismissFailed:`忽略失败——它仍留在收件箱里:{error}`,engineSwitched:`引擎 → {engine}(重新打开后生效)`,statusSet:`状态 → {status}`},Jr={nav:{kanban:`Kanban`,automations:`Routines`,issues:`Issues`,mods:`Mods`},header:{scratch:`Ungrouped`},search:{placeholder:`fuzzy filter`},sort:{label:`sort: {mode}`,hint:`Change the order (manual → newest → attention → name)`,reorderSwitched:`Reorder needs manual order — switched`,modes:{default:`manual`,recent:`newest`,attention:`attention`,name:`name`}},menu:{open:`Open`,collapseChildren:`Collapse children`,expandChildren:`Expand children`,newChat:`New conversation`,newShell:`New shell`,continueEngine:`Continue in another engine…`,newScratchChat:`New conversation (no folder)`,newTask:`New task`,newTaskFromBranch:`New task from this branch`,forgetProject:`Remove project`,fieldNotes:`Field notes`,rename:`Rename`,pin:`Pin`,unpin:`Unpin`,reorder:`Reorder row`,moveToTop:`Move to top`,reorderProject:`Reorder project`,runAgain:`Run again`,setStatus:`Set status`,moveToProject:`Move to project…`,copyId:`Copy task ID`,copyBranch:`Copy branch name`,copyPath:`Copy path`,openEditor:`Open in editor`,renameBranch:`Rename branch`,changeEngine:`Change engine`,fixChecks:`Fix failing checks`,rerunChecks:`Re-run failed checks`,syncBase:`Sync with base`,resolveConflicts:`Resolve conflicts`,land:`Land into base branch`,archive:`Archive`,unarchive:`Unarchive`,delete:`Remove session`},status:{backlog:`Backlog`,inProgress:`In progress`,inReview:`In review`,done:`Done`,canceled:`Canceled`,error:`Error`},setStatus:{title:`Set status`,current:`current`,footer:`↑↓ choose · enter set · esc cancel`},moveToProject:{title:`Move to project`,empty:"No other project yet — add one first, or run `rove api update --project PATH`",footer:`↑↓ choose · enter move · esc cancel`},sync:{done:`Merged {base} into this worktree`,alreadyCurrent:`Already up to date with {base}`,conflict:`Merge conflict — resolve then commit: {files}`,dirty:`Commit the worktree's changes first, then sync: {files}`,failed:`Sync failed: {error}`},archive:{done:`Archived {title}. Its worktree, branch and sessions are untouched`,restored:`Restored {title}`,busyTitle:`Archive while it's working?`,busyBody:`An engine in {title} is still working or waiting on you. Archiving hides the row without stopping it.`,busyConfirm:`Archive anyway`,failed:`Couldn't archive: {error}`,restoreFailed:`Couldn't restore: {error}`},rerun:{started:`Re-running failed checks`,none:`No failed checks to re-run`,external:`These checks didn't run on GitHub Actions; re-run them where they ran`,refused:`Re-run refused: {detail}`},changeEngine:{title:`Change engine`,current:`current`,effortLabel:`EFFORT`,noEffort:`engine default`,footer:{engine:`↑↓ engine`,effort:`←→ effort`,model:`tab model`,set:`enter set`,cancel:`esc cancel`}},engineModel:{label:`MODEL`,placeholder:`engine default`,loading:`listing models…`},tier:{swift:`swift`,standard:`standard`,deep:`deep`,manual:`manual`},tierDesc:{swift:`small, well-specified edits — the fastest, cheapest setting`,standard:`everyday feature work and bug fixes`,deep:`hard problems: unclear root causes, large refactors, design decisions`},runAgain:{title:`Run again`,source:`Brief from “{title}”`,hint:`Runs this brief again in a new task, on its own branch and worktree.`,confirm:`Run again`,footer:`↑↓ scroll · ←→ choose · enter run · esc cancel`},fieldNotes:{title:`Field notes`,empty:"No field notes for this repo yet — agents file one with `rove api note`.",loading:`Loading…`,footer:`↑↓ scroll · esc close`,footerDeletable:`↑↓ select · d delete · esc close`,confirmDelete:{title:`Delete this field note?`,body:`“{text}” stops being injected into new sessions on this repo. Nothing else changes.`}},confirm:Wr,renameBranch:{title:`Rename branch`,fieldLabel:`branch`},moveChip:` move`,recentJump:`Recent: {title}`,archivedHit:`{title} · archived, enter unarchives`,machine:{connecting:`connecting…`,offline:`offline`,unsupported:`unsupported`,mismatch:`protocol mismatch`,filesElsewhere:`on {host}`,filesHint:`{host} is unreachable right now; its files show here again when it reconnects.`,terminalElsewhere:`This task runs on {host}, which is unreachable right now.`,runsOn:`on {host}`,noTabs:`No tabs on {host} yet — prefix t opens one there.`},empty:{noMatchSearch:`No matching tasks — esc to clear.`,noActiveProject:`No active tasks for this project.`,noActive:`No active tasks — create one above.`},activity:{working:`working`,rateLimited:`rate limited`,permissionNeeded:`needs permission`,error:`error`,dead:`engine exited`},group:{waitingOnYou:`needs you`,landing:`ready to land`,readyForReview:`needs review`,working:`working`},subtitle:{noTracking:`no activity tracking`,materializing:`materializing`,deleting:`deleting`,deleteFailed:`delete failed`},reBranch:{title:`Set branch`,fieldLabel:`branch`,hintNoBranches:`(no local branches — type a new name)`,hintNoMatch:`(no match — enter renames to this branch)`,footer:`↑↓ pick · enter set · esc cancel`},toast:Kr},Yr={nav:{kanban:`看板`,automations:`例行任务`,issues:`议题`,mods:`Mods`},header:{scratch:`未分组`},search:{placeholder:`模糊搜索`},sort:{label:`排序:{mode}`,hint:`切换排序(手动 → 最新 → 关注 → 名称)`,reorderSwitched:`调整顺序需手动排序,已切换`,modes:{default:`手动`,recent:`最新`,attention:`关注`,name:`名称`}},menu:{open:`打开`,collapseChildren:`折叠子任务`,expandChildren:`展开子任务`,newChat:`新建会话`,newShell:`新建终端`,continueEngine:`换个引擎继续…`,newScratchChat:`新建会话(无文件夹)`,newTask:`新建任务`,newTaskFromBranch:`基于此分支新建任务`,forgetProject:`移除项目`,fieldNotes:`现场笔记`,rename:`重命名`,pin:`置顶`,unpin:`取消置顶`,reorder:`重新排序`,moveToTop:`移到顶部`,reorderProject:`调整项目顺序`,runAgain:`重新运行`,setStatus:`设置状态`,moveToProject:`移到其他项目…`,copyId:`复制任务 ID`,copyBranch:`复制分支名`,copyPath:`复制路径`,openEditor:`在编辑器中打开`,renameBranch:`重命名分支`,changeEngine:`切换引擎`,fixChecks:`修复失败的检查`,rerunChecks:`重新运行失败的检查`,syncBase:`同步基础分支`,resolveConflicts:`让 agent 解决冲突`,land:`合入基础分支`,archive:`归档`,unarchive:`取消归档`,delete:`移除会话`},status:{backlog:`待办`,inProgress:`进行中`,inReview:`待评审`,done:`已完成`,canceled:`已取消`,error:`出错`},setStatus:{title:`设置状态`,current:`当前`,footer:`↑↓ 选择 · enter 设置 · esc 取消`},moveToProject:{title:`移到其他项目`,empty:"还没有其他项目——先添加一个,或运行 `rove api update --project PATH`",footer:`↑↓ 选择 · enter 移动 · esc 取消`},sync:{done:`已把 {base} 合并进该工作树`,alreadyCurrent:`已经和 {base} 同步`,conflict:`合并冲突——解决后提交:{files}`,dirty:`请先提交工作树里的改动,再同步:{files}`,failed:`同步失败:{error}`},archive:{done:`已归档 {title}。工作树、分支和会话都保持原样`,restored:`已恢复 {title}`,busyTitle:`它还在工作,仍要归档?`,busyBody:`{title} 里有引擎仍在工作或在等你。归档只隐藏这一行,不会停止它。`,busyConfirm:`仍要归档`,failed:`归档失败:{error}`,restoreFailed:`恢复失败:{error}`},rerun:{started:`正在重新运行失败的检查`,none:`没有可重新运行的失败检查`,external:`这些检查不是在 GitHub Actions 上运行的,请到它们运行的地方重新运行`,refused:`无法重新运行:{detail}`},changeEngine:{title:`切换引擎`,current:`当前`,effortLabel:`推理强度`,noEffort:`引擎默认`,footer:{engine:`↑↓ 引擎`,effort:`←→ 强度`,model:`tab 模型`,set:`enter 设置`,cancel:`esc 取消`}},engineModel:{label:`模型`,placeholder:`引擎默认`,loading:`正在列出模型…`},tier:{swift:`轻快`,standard:`标准`,deep:`深入`,manual:`手动`},tierDesc:{swift:`小而明确的改动——最快、最省的一档`,standard:`日常的功能开发和修 bug`,deep:`难题:根因不明、大重构、设计决策`},runAgain:{title:`重新运行`,source:`来自任务「{title}」的指令`,hint:`在新任务里重新执行这段指令,新任务有自己的分支和工作树。`,confirm:`重新运行`,footer:`↑↓ 滚动 · ←→ 选择 · enter 运行 · esc 取消`},confirm:Gr,renameBranch:{title:`重命名分支`,fieldLabel:`分支`},fieldNotes:{title:`现场笔记`,empty:"该仓库暂无现场笔记——agent 可用 `rove api note` 记录。",loading:`加载中…`,footer:`↑↓ 滚动 · esc 关闭`,footerDeletable:`↑↓ 选择 · d 删除 · esc 关闭`,confirmDelete:{title:`删除这条现场笔记?`,body:`「{text}」将不再注入该仓库的新会话。其他内容不受影响。`}},moveChip:` 移动`,recentJump:`最近:{title}`,archivedHit:`{title} · 已归档,回车恢复`,machine:{connecting:`连接中…`,offline:`离线`,unsupported:`不支持`,mismatch:`协议不兼容`,filesElsewhere:`在 {host} 上`,filesHint:`{host} 暂时连不上;重新连上后这里会再显示它的文件。`,terminalElsewhere:`这个任务跑在 {host} 上,暂时连不上。`,runsOn:`在 {host} 上`,noTabs:`{host} 上还没有 tab——按 prefix t 在那里新开一个。`},empty:{noMatchSearch:`无匹配任务——按 esc 清除。`,noActiveProject:`该项目暂无活跃任务。`,noActive:`暂无活跃任务——在上方新建。`},activity:{working:`运行中`,rateLimited:`请求受限`,permissionNeeded:`等待授权`,error:`错误`,dead:`引擎已退出`},group:{waitingOnYou:`等你处理`,landing:`可以合了`,readyForReview:`待你验收`,working:`运行中`},subtitle:{noTracking:`不跟踪活动`,materializing:`正在创建 worktree`,deleting:`正在删除`,deleteFailed:`删除失败`},reBranch:{title:`设置分支`,fieldLabel:`分支`,hintNoBranches:`(没有本地分支——输入新名称)`,hintNoMatch:`(无匹配——回车将分支重命名为此名)`,footer:`↑↓ 选择 · enter 设置 · esc 取消`},toast:qr},Xr={noTask:`(no task — press n to create)`,exited:`process exited — F5 restarts it`,engineExit:{title:`Engine exited`,titleCode:`Engine exited (code {code})`,retry:`Retry`,settings:`Settings → Engines`,another:`Another engine`,continueIn:`Continue in another engine`},usageLimit:{title:`Usage limit reached`,dismiss:`Dismiss`},restoring:`restoring session…`,recovery:{live:`Live process reattached`,relaunched:`Command relaunched in a new process. Any restored output is historical; check the engine to resume or continue your conversation.`,restored:`Historical screen restored; previous process ended. Restart and check the engine before continuing.`},tab:{groupTitle:`group {n}`,renameTitle:`Rename tab`,renameField:`TAB TITLE`,renameSubmit:`rename`,chooseEngineHint:`←/→ or h/l choose, enter confirm, esc cancel`,newChat:{title:`New conversation`,engine:`ENGINE`,destLabel:`DESTINATION`,destTab:`child task, same directory`,destFork:`fork a child task (new worktree)`,destScratch:`new scratch task ($HOME)`,ctxLabel:`CONTEXT`,ctxFresh:`fresh conversation`,ctxContinue:`continue this conversation`},cannotCloseLast:`Cannot close the only tab`,tabGone:`That tab is no longer there`,closeOthersTitle:`Close the other tabs?`,closeOthersBody:`Closing {count} · their sessions end, this tab stays open.`,closeOthersConfirm:`close tabs`,closeOthersCancel:`cancel`,menu:{rename:`Rename tab`,copyAddress:`Copy tab address`,continueEngine:`Continue in another engine…`,closeOthers:`Close other tabs`,close:`Close tab`},nothingToFork:`No conversation in this tab to fork yet`,noTranscriptToHandOff:`{engine} keeps no readable transcript to hand over`},split:{renameTitle:`Rename split`,renameField:`SPLIT NAME`},scrolledBack:`↑ scrolled {lines}L`,scrollFirst:`[first]`,scrollLatest:`[latest]`,unavailable:{shellMissing:`terminal unavailable — the shell named by $SHELL isn't on this machine. Point $SHELL at one that exists, or unset it to fall back to the system default.`,spawnFailed:`terminal unavailable — the shell exited immediately. Its error is in ~/.rove/pty.log.`,retry:`F5 tries again`},reset:{title:`Reset terminal?`,body:`The running shell will be killed and a fresh one will spawn at the worktree. Any in-flight processes (vim, htop, paused jobs) end immediately.`}},Zr={recovery:{live:`已重新连接仍在运行的进程`,relaunched:`命令已在新进程中重启。如有恢复的输出,它属于历史记录;请在引擎内确认会话恢复或继续操作。`,restored:`已恢复历史画面;原进程已结束。请重启并确认引擎状态后继续。`},noTask:`(无任务 —— 按 n 创建)`,exited:`进程已退出 —— 按 F5 重启`,engineExit:{title:`引擎已退出`,titleCode:`引擎已退出(退出码 {code})`,retry:`重试`,settings:`设置 → 引擎`,another:`换个引擎`,continueIn:`换个引擎继续`},usageLimit:{title:`已达到用量上限`,dismiss:`忽略`},restoring:`正在恢复会话…`,tab:{groupTitle:`group {n}`,renameTitle:`重命名标签页`,renameField:`标签页名称`,renameSubmit:`重命名`,chooseEngineHint:`←/→ 或 h/l 选择,enter 确认,esc 取消`,newChat:{title:`新建对话`,engine:`引擎`,destLabel:`落点`,destTab:`子任务,同一目录`,destFork:`fork 子任务(新 worktree)`,destScratch:`新临时任务($HOME)`,ctxLabel:`上下文`,ctxFresh:`全新对话`,ctxContinue:`接着当前对话`},cannotCloseLast:`无法关闭唯一的标签页`,tabGone:`这个标签页已经不在了`,closeOthersTitle:`关闭其他标签页?`,closeOthersBody:`将关闭 {count} 个,它们的会话会结束,只保留这个标签页。`,closeOthersConfirm:`关闭标签页`,closeOthersCancel:`取消`,menu:{rename:`重命名标签页`,copyAddress:`复制标签页地址`,continueEngine:`换个引擎继续…`,closeOthers:`关闭其他标签页`,close:`关闭标签页`},nothingToFork:`这个标签页还没有可派生的对话`,noTranscriptToHandOff:`{engine} 没有可读的对话记录,无法交接`},split:{renameTitle:`重命名分屏`,renameField:`分屏名称`},scrolledBack:`↑ 已回滚 {lines} 行`,scrollFirst:`[最早]`,scrollLatest:`[最新]`,unavailable:{shellMissing:`终端不可用 —— $SHELL 指向的 shell 在这台机器上不存在。请把 $SHELL 指向一个真实存在的 shell,或取消设置以回退到系统默认。`,spawnFailed:`终端不可用 —— shell 启动后立即退出。具体错误见 ~/.rove/pty.log。`,retry:`按 F5 重试`},reset:{title:`重置终端?`,body:`正在运行的 shell 会被杀掉并在 worktree 重新启动,进行中的进程(vim、htop、暂停的任务)会立即结束。`}},Qr={pageTitle:`ROVE UPDATE`,closeHint:`q / esc close`,chip:`↑ {version}`,current:`current`,available:`v{version} available`,latest:`latest`,latestUnknown:`unknown — could not reach the registry`,registryRetry:`Check your connection, then close and reopen Update to retry.`,upToDate:`No newer release — nothing to install.`,releaseUrlUnavailable:`release URL unavailable; visit github.com/Sma1lboy/rove/releases`,statusReleaseOpened:`Opened release page in your browser.`,statusReleaseError:`Could not open release URL. Visit github.com/Sma1lboy/rove/releases in your browser.`,statusRunningUpdater:`Closing the TUI and running the updater in this terminal...`,loadingNotes:`Loading release notes...`,notesUnavailable:`Release notes are unavailable. Use Open release to view the GitHub release page.`,changesSectionHeader:`── changes from v{from} to v{to} ──`,updateComplete:`Rove update complete. Relaunch Rove to use the new version.`,updateFailed:"Rove update failed with exit code {code}. Check the output above, then run `rove update` to retry.",pressAnyKey:`Press any key to close this update window.`,webRunning:`Running {command} …`,webInstalled:"Installed. The daemon and this web bridge still run v{current}: run `rove daemon restart`, then restart `rove --web`. The page reloads itself once the bridge runs the new version.",webStartFailed:`Could not start the updater: {error}`,actions:{updateNow:`Update now`,openRelease:`Open release`,close:`Close`,closeDetail:`return to the workspace`},whatsNew:{title:`WHAT'S NEW`,closeHint:`q / esc continue`,upgraded:`You're now on Rove v{to}, up from v{from}. Here's what changed.`,notesUnavailable:`Could not load the release notes — check your connection, or read them on GitHub.`,sourceHint:`release notes: {url}`},skew:{title:`⚠ DAEMON OUT OF DATE`,olderBuild:`an older build`,hint:`daemon is {daemon} — you launched v{clientVersion}. Press {keys} to refresh Rove onto the installed build`,hintNoKey:"daemon is {daemon} — you launched v{clientVersion}. Run `rove daemon restart`, then relaunch Rove"},refresh:{confirmTitle:`Refresh Rove?`,confirmBody:`Rove restarts the daemon and relaunches itself on the installed build. Running engine sessions live in the PTY host and keep going; open tabs come back.`,confirmLabel:`Refresh`,relaunching:`rove: restarting on the installed build...`,alreadyCurrent:`Rove and the daemon already run the same build — nothing to refresh.`,installGone:"This Rove was installed from a directory that no longer exists, so it cannot relaunch itself. Reinstall with `npm install -g @sma1lboy/rove`."},staleInstall:{title:`✕ ROVE INSTALL IS GONE`,hint:"this Rove is running from an install that no longer exists on disk, so it cannot start a daemon. Reinstall (`npm install -g @sma1lboy/rove`) and relaunch Rove"},versions:{pageTitle:`ROVE VERSIONS`,loading:`Loading releases...`,unavailable:`Could not fetch releases. Check your connection or wait for the rate limit, then reopen this page.`,tagCurrent:`current`,tagLatest:`latest`,tagBreaking:`breaking`,breakingWarning:"⚠ installing this crosses breaking version(s) {versions}. Rove will refuse to start until you run `rove reset`, which stops the daemon, the PTY host, and every live session. Tasks and worktrees are kept.",footerHint:`j/k select · enter install · q close`,closeHint:`q / esc close`}},$r={pageTitle:`ROVE 更新`,closeHint:`q / esc 关闭`,chip:`↑ {version}`,current:`当前`,available:`有新版本 v{version}`,latest:`最新`,latestUnknown:`未知 —— 无法连接到 registry`,registryRetry:`请检查网络,然后关闭并重新打开更新页重试。`,upToDate:`没有更新的版本 —— 无需安装。`,releaseUrlUnavailable:`发布链接不可用;请访问 github.com/Sma1lboy/rove/releases`,statusReleaseOpened:`已在浏览器中打开发布说明页面。`,statusReleaseError:`无法打开发布链接。请在浏览器访问 github.com/Sma1lboy/rove/releases。`,statusRunningUpdater:`正在关闭 TUI,并在当前终端中运行更新程序……`,loadingNotes:`正在加载发布说明……`,notesUnavailable:`发布说明不可用。请使用「打开发布页」查看 GitHub 发布页面。`,changesSectionHeader:`── v{from} 至 v{to} 的变更 ──`,updateComplete:`Rove 更新完成。请重新启动 Rove 以使用新版本。`,updateFailed:"Rove 更新失败,退出码为 {code}。请检查上方输出,再运行 `rove update` 重试。",pressAnyKey:`按任意键关闭此更新窗口。`,webRunning:`正在运行 {command} …`,webInstalled:"已安装。daemon 和这个 web bridge 仍在跑 v{current}:先运行 `rove daemon restart`,再重启 `rove --web`。bridge 换到新版本后,页面会自动刷新。",webStartFailed:`无法启动更新程序:{error}`,actions:{updateNow:`立即更新`,openRelease:`打开发布页`,close:`关闭`,closeDetail:`返回工作区`},whatsNew:{title:`更新内容`,closeHint:`q / esc 继续`,upgraded:`Rove 已从 v{from} 更新到 v{to},本次变更如下。`,notesUnavailable:`无法加载发布说明 —— 请检查网络连接,或到 GitHub 上查看。`,sourceHint:`发布说明:{url}`},skew:{title:`⚠ DAEMON 版本不一致`,olderBuild:`旧版本构建`,hint:`daemon 运行的是 {daemon},而你启动的是 v{clientVersion}。按 {keys} 可让 Rove 刷新到已安装的版本`,hintNoKey:"daemon 运行的是 {daemon},而你启动的是 v{clientVersion}。请运行 `rove daemon restart`,然后重新启动 Rove"},refresh:{confirmTitle:`刷新 Rove?`,confirmBody:`Rove 会重启 daemon,并以已安装的版本重新启动自身。正在运行的引擎会话由 PTY host 托管,不会中断;已打开的标签页会恢复。`,confirmLabel:`刷新`,relaunching:`rove:正在以已安装的版本重新启动……`,alreadyCurrent:`Rove 与 daemon 已经是同一个版本 —— 无需刷新。`,installGone:"当前 Rove 的安装目录已不存在,无法重新启动自身。请运行 `npm install -g @sma1lboy/rove` 重新安装。"},staleInstall:{title:`✕ ROVE 安装已不存在`,hint:"当前 Rove 运行自一份已从磁盘删除的安装,因此无法启动 daemon。请重新安装(`npm install -g @sma1lboy/rove`)并重新启动 Rove"},versions:{pageTitle:`ROVE 版本列表`,loading:`正在加载发布列表……`,unavailable:`无法获取发布列表。请检查网络或等待限流解除,然后重新打开本页。`,tagCurrent:`当前`,tagLatest:`最新`,tagBreaking:`breaking`,breakingWarning:"⚠ 安装该版本会跨过 breaking 版本 {versions}。更新后 Rove 会拒绝启动,直到你运行 `rove reset`——它会停掉 daemon、PTY host 和所有活动会话。任务和 worktree 会保留。",footerHint:`j/k 选择 · enter 安装 · q 关闭`,closeHint:`q / esc 关闭`}},ei={quit:{confirmTitle:`Quit Rove?`,confirmBody:`The daemon and task sessions keep running. This closes only the native workspace.`,confirmLabel:`Quit`},narrowBack:`Tasks`,empty:{selectTask:`Select a task with a worktree`,noSessions:`No sessions here — press ⏎ to start {engine}, or ctrl+e to pick another`,noSessionsShell:`No sessions here — press ⏎ to start a shell, or ctrl+e to pick another`,remoteUnsupported:`Hosted engine launch over SSH is not implemented — this task's worktree is on {host}`},welcome:{title:`Welcome to Rove`,tagline:`All your coding agents in one place: when one runs out of quota, switch the task to another, and agents talk to each other directly.`,worktreeExplain:`Managed tasks create isolated worktrees and branches. Directory and project tasks reuse existing files; tabs within a task share its directory.`,stepNew:`creates your first task — pick a repo, a base branch, an engine`,stepHelp:`shows every shortcut reachable from the current focus`,stepPrefix:`opens the command menu`,enginesFound:`✓ engines: {list}`,enginesSignedOut:`✗ installed but not signed in: {list} — run one of them in a shell and log in`,enginesMissing:`✗ no engine CLI found — install claude, codex, copilot, or kimi, then restart Rove`,gitMissing:`✗ git not found on PATH — Rove needs git to create worktrees`,doctorHint:"run `rove doctor` in a shell for the full diagnosis",docsHint:`docs: https://docs.rove.run`},attention:{none:`No available Inbox items`},inbox:{title:`INBOX`,empty:`No pending attention`,openHint:`enter open`,clearHint:`d ack`,clearAllHint:`D ack all`,more:`+{count} more`,section:{attention:`ATTENTION`,recent:`RECENT`},state:{done:`done`,needsInput:`needs input`,error:`error`,rateLimited:`rate limited`,running:`running`,dead:`engine exited`,routineFailed:`routine needs you`,reportMissing:`report missing`,decisionNeeded:`decision needed`,gateAnswered:`answered · engine not running`},resumesAt:`resumes {time}`}},ti={quit:{confirmTitle:`退出 Rove?`,confirmBody:`守护进程和任务会话会继续运行,这里只关闭原生工作区。`,confirmLabel:`退出`},narrowBack:`任务`,empty:{selectTask:`请选择一个带 worktree 的任务`,noSessions:`这里没有会话——按 ⏎ 启动 {engine},或按 ctrl+e 另选一个`,noSessionsShell:`这里没有会话——按 ⏎ 启动 shell,或按 ctrl+e 另选一个`,remoteUnsupported:`尚未实现通过 SSH 启动托管引擎——该任务的 worktree 在 {host} 上`},welcome:{title:`欢迎使用 Rove`,tagline:`所有编程 agent 都在一个地方:一个额度用完了,换另一个接着干;agent 之间直接对话,不用你传话。`,worktreeExplain:`托管任务创建独立的 worktree 和分支。目录与项目任务复用现有文件;同一任务内的标签页共享目录。`,stepNew:`创建你的第一个任务——选仓库、基础分支和引擎`,stepHelp:`查看当前焦点下的全部快捷键`,stepPrefix:`打开命令菜单`,enginesFound:`✓ 已检测到引擎:{list}`,enginesSignedOut:`✗ 已安装但未登录:{list}——请在 shell 里运行其中之一并完成登录`,enginesMissing:`✗ 未找到引擎 CLI——请安装 claude、codex、copilot 或 kimi 后重启 Rove`,gitMissing:`✗ PATH 上没有 git——Rove 需要 git 来创建 worktree`,doctorHint:"在 shell 里运行 `rove doctor` 查看完整诊断",docsHint:`文档:https://docs.rove.run`},attention:{none:`收件箱中没有可打开的项目`},inbox:{title:`收件箱`,empty:`暂无待处理`,openHint:`enter 打开`,clearHint:`d 已阅`,clearAllHint:`D 全部已阅`,more:`还有 {count} 条`,section:{attention:`待处理`,recent:`最近使用`},state:{done:`完成`,needsInput:`需要输入`,error:`出错`,rateLimited:`限流`,running:`进行中`,dead:`引擎已退出`,routineFailed:`例行任务需要处理`,reportMissing:`未回报`,decisionNeeded:`等你决定`,gateAnswered:`已回答 · 引擎未运行`},resumesAt:`{time} 恢复`}},ni={title:`Worktrees`,loading:`Loading worktrees…`,noProjects:`No local projects known to Rove yet.`,loadFailed:`Could not read the worktrees: {message}`,noWorktrees:`No worktrees.`,badge:{roveManaged:`rove`,dirty:`dirty`,dirtyUnknown:`dirty?`,remoteOn:`on remote`,remoteOff:`not pushed`,remoteUnknown:`remote unknown`},verdict:{prOpen:`PR open`,prMerged:`merged (PR)`,inMain:`in main`,prClosed:`PR closed`,idle:`stale`},row:{detached:`(detached)`,created:`created {age} ago`},delete:{button:`Delete`,confirmTitle:`Delete worktree?`,confirmBody:`Delete the worktree for "{branch}"? This removes the working directory; the branch itself is kept.`,forceTitle:`Force delete worktree?`,forceBody:'"{branch}" has uncommitted, untracked, or gitignored work. Force delete removes the worktree, but the work is snapshotted first to a salvage ref — list them with `git for-each-ref refs/rove/salvage`. Force delete anyway?',forceReason:`Refused because: {reason}`,failed:`Failed to delete worktree: {error}`,residue:`Git deregistered the worktree, but couldn't delete {path} ({reason}). Rove is done with it — retrying won't help; delete the directory by hand if you want the space.`},land:{button:`Land`,confirmTitle:`Land branch?`,confirmBody:`Merge "{branch}" into {landedOn} ({commits} commits), then remove this worktree? The branch is kept. Conflicts abort with a file list.`,confirmBodyOne:`Merge "{branch}" into {landedOn} (1 commit), then remove this worktree? The branch is kept. Conflicts abort with a file list.`,noTask:`This worktree isn't tracked as a Rove task — nothing to land.`,conflict:`Land hit conflicts (merge aborted). Resolve by hand: {files}`,dirtyBase:"The base checkout has uncommitted changes — commit them, then land. Never `git stash` here: the stash stack lives in the repo's common dir and is shared by every linked worktree, so a stash can entangle other tasks' work.",failed:`Land failed: {error}`,done:`Landed "{branch}" onto {landedOn} ({commit}).`,worktreeKept:`Landed, but the worktree was kept: {reason}`,worktreePathStale:`Landed and removed the worktree, but the task still points at it: {reason}`,worktreeResidue:`Landed. Git deregistered the worktree, but couldn't delete {path} ({reason}) — delete the directory by hand if you want the space.`},hint:{}},ri={title:`工作树`,loading:`正在加载 worktree…`,noProjects:`Rove 还没有已知的本地项目。`,loadFailed:`读不到 worktree 列表:{message}`,noWorktrees:`没有 worktree。`,badge:{roveManaged:`rove`,dirty:`有改动`,dirtyUnknown:`改动未知`,remoteOn:`已推送`,remoteOff:`未推送`,remoteUnknown:`远端未知`},verdict:{prOpen:`PR 评审中`,prMerged:`已合入 (PR)`,inMain:`已在主分支`,prClosed:`PR 已关闭`,idle:`陈旧`},row:{detached:`(游离状态)`,created:`{age}前创建`},delete:{button:`删除`,confirmTitle:`删除 worktree?`,confirmBody:`确定删除 "{branch}" 对应的 worktree?工作目录会被移除,分支本身会保留。`,forceTitle:`强制删除 worktree?`,forceBody:'"{branch}" 存在未提交、未跟踪或被 gitignore 的改动。强制删除会移除 worktree,但这些改动会先被快照到一个 salvage ref——用 `git for-each-ref refs/rove/salvage` 可以列出它们。仍要强制删除吗?',forceReason:`拒绝原因:{reason}`,failed:`删除 worktree 失败:{error}`,residue:`Git 已注销该 worktree,但没能删掉 {path}({reason})。Rove 这边已经处理完了——重试没有用;想要回磁盘空间请手动删除该目录。`},land:{button:`合入`,confirmTitle:`合入分支?`,confirmBody:`把 "{branch}" 合入 {landedOn}({commits} 个提交),然后移除这个 worktree?分支会保留。冲突会中止并给出文件清单。`,confirmBodyOne:`把 "{branch}" 合入 {landedOn}(1 个提交),然后移除这个 worktree?分支会保留。冲突会中止并给出文件清单。`,noTask:`该 worktree 未作为 Rove 任务被跟踪——没有可合入的对象。`,conflict:`合入遇到冲突(已中止)。请手动解决:{files}`,dirtyBase:"基础检出有未提交改动——请先提交再合入。绝不要在这里 `git stash`:stash 栈存放在仓库的 common dir 中,该仓库所有 linked worktree 共享,一次 stash 可能纠缠其他任务的工作。",failed:`合入失败:{error}`,done:`已把 "{branch}" 合入 {landedOn}({commit})。`,worktreeKept:`已合入,但 worktree 保留了:{reason}`,worktreePathStale:`已合入并移除 worktree,但任务仍指向它:{reason}`,worktreeResidue:`已合入。Git 已注销该 worktree,但没能删掉 {path}({reason})——想要回磁盘空间请手动删除该目录。`},hint:{}},ii={common:{en:Mr,zh:Nr},doctor:{en:Pr,zh:Fr},files:{en:Ir,zh:Lr},newTask:{en:Rr,zh:zr},onboarding:{en:Br,zh:Vr},quickTask:{en:Hr,zh:Ur},tasks:{en:Jr,zh:Yr},terminal:{en:Xr,zh:Zr},update:{en:Qr,zh:$r},workspace:{en:ei,zh:ti},worktrees:{en:ni,zh:ri}};function ai(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 W(e,t,n){let r=ii[e],i=ai(r[Me.get()],t)??ai(r.en,t)??t;return n?i.replace(/\{(\w+)\}/g,(e,t)=>String(n[t]??e)):i}var oi=[{id:`chat.tab.new`,scope:`workspace`,keys:[`ctrl+t`],category:`Workspace`,description:`New chat tab`,hint:{keys:`ctrl+t`},presentation:`onePress`},{id:`chat.tab.chooseEngine`,scope:`workspace`,keys:[`ctrl+e`],category:`Workspace`,description:`New conversation — engine/shell picker with destination + context toggles`,hint:{keys:`ctrl+e`},presentation:`onePress`},{id:`chat.tab.fork`,scope:`workspace`,keys:[],prefixKeys:[`c`],category:`Workspace`,description:`Fork this chat into a new tab (same Task directory, keeps the conversation)`,hint:{keys:`ctrl+a c`}},{id:`chat.fork.new`,scope:`workspace`,keys:[],prefixKeys:[`f`],category:`Workspace`,description:`Quick-fork: create child task seeded with current repo/branch/model`,hint:{keys:`ctrl+a f`}},{id:`chat.tab.close`,scope:`workspace`,keys:[`ctrl+w`],prefixKeys:[`w`],category:`Workspace`,description:`Close chat tab`,hint:{keys:`ctrl+w`},presentation:`onePress`},{id:`workspace.reopenSession`,scope:`workspace`,keys:[`return`],category:`Workspace`,description:`Reopen a session in a task whose tabs are all closed`,hint:{keys:`enter`},presentation:`onePress`},{id:`chat.tab.rename`,scope:`workspace`,keys:[`f2`],category:`Workspace`,description:`Rename active chat tab`,hint:{keys:`f2`},presentation:`onePress`},{id:`chat.tab.cycle-next`,scope:`workspace`,keys:[`ctrl+]`],category:`Workspace`,description:`Next chat tab`,hint:{keys:`ctrl+]`},presentation:`onePress`},{id:`chat.tab.cycle-prev`,scope:`workspace`,keys:[`ctrl+[`],category:`Workspace`,description:`Previous chat tab`,hint:{keys:`ctrl+[`},presentation:`onePress`},{id:`chat.tab.goto`,scope:`workspace`,keys:[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`].map(e=>`ctrl+${e}`),category:`Workspace`,description:`Go to chat tab N`,hint:{keys:`ctrl+1-9`},presentation:`onePress`},{id:`workspace.split.right`,scope:`workspace`,keys:[`ctrl+\\`],category:`Workspace`,description:`Split right`,hint:{keys:`ctrl+\\`},presentation:`onePress`},{id:`workspace.split.down`,scope:`workspace`,keys:[`ctrl+=`],category:`Workspace`,description:`Split down`,hint:{keys:`ctrl+=`},presentation:`onePress`},{id:`workspace.split.focus-next`,scope:`workspace`,keys:[`f3`],category:`Workspace`,description:`Focus next split`,hint:{keys:`f3`},presentation:`onePress`},{id:`workspace.split.close`,scope:`workspace`,keys:[`ctrl+w`],prefixKeys:[`w`],category:`Workspace`,description:`Close active split (tab when unsplit)`,hint:{keys:`ctrl+w`},presentation:`onePress`},{id:`workspace.split.rename`,scope:`workspace`,keys:[`f2`],category:`Workspace`,description:`Rename active split (tab when unsplit)`,hint:{keys:`f2`},presentation:`onePress`}],si=[{id:`files.nav`,scope:`files`,keys:[`j`,`k`,`down`,`up`],category:`Files`,description:`Move cursor up/down`,hint:{keys:`j/k`}},{id:`files.hierarchy`,scope:`files`,keys:[`h`,`l`,`left`,`right`],category:`Files`,description:`Collapse / expand tree level`,hint:{keys:`h/l`}},{id:`files.open`,scope:`files`,keys:[`return`],category:`Files`,description:`Open file in configured editor (diff when supported)`,hint:{keys:`enter`}},{id:`files.tab`,scope:`files`,keys:[`[`,`]`],category:`Files`,description:`Switch tab (cycle All / Changes)`,hint:{keys:`[/]`}},{id:`files.refresh`,scope:`files`,keys:[`r`],category:`Files`,description:`Refresh`,hint:{keys:`r`}},{id:`files.scope`,scope:`files`,keys:[`b`],category:`Files`,description:`Toggle Changes scope (working ↔ branch vs base)`,hint:{keys:`b`}},{id:`files.diff`,scope:`files`,keys:[`d`],category:`Files`,description:`Open read-only diff in a workspace tab`,hint:{keys:`d`}},{id:`files.diffAll`,scope:`files`,keys:[`shift+d`],category:`Files`,description:`Open the whole worktree's diff in one workspace tab`,hint:{keys:`D`}},{id:`files.openExternal`,scope:`files`,keys:[`o`],category:`Files`,description:`Open file in system default app (audio / video / pdf preview)`,hint:{keys:`o`}},{id:`files.mention`,scope:`files`,keys:[`a`],category:`Files`,description:`Inject @<path> mention into the engine pane`,hint:{keys:`a`}},{id:`files.createPR`,scope:`global`,keys:[],prefixKeys:[`p`,`shift+p`],category:`Files`,description:`Ask the agent to create a PR from the current task`},{id:`files.fixChecks`,scope:`global`,keys:[],prefixKeys:[`k`],category:`Files`,description:`Ask the agent to fix the failing PR checks`},{id:`files.syncBase`,scope:`global`,keys:[],prefixKeys:[`u`],category:`Files`,description:`Merge the base branch into this task's worktree`},{id:`diff.review.cursor`,scope:`workspace`,keys:[`j`,`k`,`down`,`up`],bareKeys:!0,category:`Diff review`,description:`Move the line cursor over the diff`,hint:{keys:`j/k`}},{id:`diff.review.range`,scope:`workspace`,keys:[`v`],bareKeys:!0,category:`Diff review`,description:`Toggle range anchor at the cursor`,hint:{keys:`v`}},{id:`diff.review.note`,scope:`workspace`,keys:[`c`],bareKeys:!0,category:`Diff review`,description:`Add a review note at the cursor`,hint:{keys:`c`}},{id:`diff.review.send`,scope:`workspace`,keys:[`s`],bareKeys:!0,category:`Diff review`,description:`Send all unsent review notes to the engine`,hint:{keys:`s`}},{id:`diff.review.drop`,scope:`workspace`,keys:[`x`],bareKeys:!0,category:`Diff review`,description:`Drop the review note the cursor sits inside`,hint:{keys:`x`}},{id:`diff.review.reload`,scope:`workspace`,keys:[`r`],bareKeys:!0,category:`Diff review`,description:`Reload the previewed file from disk`,hint:{keys:`r`}}],ci=[{id:`inbox.show`,scope:`global`,keys:[],prefixKeys:[`i`],category:`Global`,description:`Open Inbox`},{id:`inbox.nav`,scope:`inbox`,keys:[`j`,`k`,`down`,`up`],category:`Inbox`,description:`Move cursor up/down`,hint:{keys:`j/k`}},{id:`inbox.open`,scope:`inbox`,keys:[`return`],category:`Inbox`,description:`Open the selected Task and Terminal Tab`,hint:{keys:`enter`}},{id:`inbox.delete`,scope:`inbox`,keys:[`d`],category:`Inbox`,description:`Ack the selected Inbox item`,hint:{keys:`d`}},{id:`inbox.deleteAll`,scope:`inbox`,keys:[`shift+d`],category:`Inbox`,description:`Ack every ATTENTION item`,hint:{keys:`D`}}],li=[{id:`palette.open`,scope:`global`,keys:[],prefixKeys:[`/`],category:`Global`,description:`Search commands`},{id:`help.open`,scope:`global`,keys:[`f1`],category:`Global`,description:`Show keybindings help`,hint:{keys:`F1`},presentation:`onePress`},{id:`task.new`,scope:`sidebar`,keys:[`n`],category:`Sidebar`,description:`New task`,hint:{keys:`n`}},{id:`task.new.global`,scope:`global`,keys:[],prefixKeys:[`n`],category:`Global`,description:`New task`},{id:`task.openEditor`,scope:`global`,keys:[],prefixKeys:[`o`],category:`Global`,description:`Open active Task directory in editor`},{id:`task.moveMode`,scope:`global`,keys:[],prefixKeys:[`m`],category:`Global`,description:`Reorder sidebar rows (then j/k)`},{id:`settings.open`,scope:`global`,keys:[],prefixKeys:[`,`],category:`Global`,description:`Open settings`},{id:`app.refresh`,scope:`global`,keys:[],prefixKeys:[`r`],category:`Global`,description:`Refresh Rove onto the installed build (after an update)`},{id:`settings.open.sidebar`,scope:`sidebar`,keys:[`s`],category:`Sidebar`,description:`Open settings`,hint:{keys:`s`}},{id:`worktrees.open.sidebar`,scope:`sidebar`,keys:[`x`],category:`Sidebar`,description:`Open worktrees`,hint:{keys:`x`}},{id:`kanban.open`,scope:`global`,keys:[],prefixKeys:[`1`],category:`Global`,description:`Open kanban (issues board)`},{id:`automations.open`,scope:`global`,keys:[],prefixKeys:[`2`],category:`Global`,description:`Open routines (scheduled tasks)`},{id:`workItems.open`,scope:`global`,keys:[],prefixKeys:[`3`],category:`Global`,description:`Open GitHub issues (external tracker)`},{id:`app.quit`,scope:`sidebar`,keys:[`q`,`ctrl+q`],category:`Sidebar`,description:`Quit (with confirm)`,hint:{keys:`q`}},{id:`focus.sidebar`,scope:`workspace`,keys:[`ctrl+q`],prefixKeys:[`q`],category:`Workspace`,description:`Back to sidebar (tasks)`,hint:{keys:`ctrl+q`},presentation:`onePress`},{id:`focus.previous`,scope:`global`,keys:[],prefixKeys:[`h`],category:`Navigation`,description:`Focus previous pane (files → workspace → sidebar)`},{id:`focus.next`,scope:`global`,keys:[`f4`],prefixKeys:[`l`],category:`Navigation`,description:`Focus next pane (sidebar → workspace → files)`,hint:{keys:`f4`},presentation:`onePress`},{id:`attention.next`,scope:`global`,keys:[`f7`],category:`Navigation`,description:`Jump to the next available Inbox item`,hint:{keys:`f7`},presentation:`onePress`},{id:`workspace.zenToggle`,scope:`global`,keys:[],prefixKeys:[`z`],category:`Navigation`,description:`Toggle zen mode (hide the files column)`},{id:`view.redraw`,scope:`global`,keys:[],prefixKeys:[`r`],category:`Global`,description:`Redraw the screen`},{id:`sidebar.nav`,scope:`sidebar`,keys:[`j`,`k`,`down`,`up`],category:`Sidebar`,description:`Move cursor up/down`,hint:{keys:`j/k`}},{id:`sidebar.select`,scope:`sidebar`,keys:[`return`],category:`Sidebar`,description:`Open the selected task`,hint:{keys:`enter`}},{id:`sidebar.tree.open`,scope:`sidebar`,keys:[`l`,`space`],category:`Sidebar`,description:`Open the row under the cursor (a tab row enters its chat)`,hint:{keys:`l`}},{id:`sidebar.goto`,scope:`sidebar`,keys:[`g`,`shift+g`],category:`Sidebar`,description:`Top / bottom of list (gg or shift-G)`},{id:`sidebar.rename`,scope:`sidebar`,keys:[`r`],category:`Sidebar`,description:`Rename task`,hint:{keys:`r`}},{id:`sidebar.localMerge`,scope:`sidebar`,keys:[`shift+m`],category:`Sidebar`,description:`Reorder row (Shift+M, then j/k)`,hint:{keys:`M`}},{id:`sidebar.pin`,scope:`sidebar`,keys:[`shift+p`],category:`Sidebar`,description:`Pin / unpin task at top (Shift+P)`,hint:{keys:`P`}},{id:`sidebar.sort`,scope:`sidebar`,keys:[`t`],category:`Sidebar`,description:`Cycle task sort (default → recent → attention → name)`,hint:{keys:`t`}},{id:`sidebar.delete`,scope:`sidebar`,keys:[`d`],category:`Sidebar`,description:`Remove session (with confirm)`,hint:{keys:`d`}},{id:`sidebar.search.enter`,scope:`sidebar`,keys:[`/`],category:`Sidebar`,description:`Search tasks (fuzzy filter)`,hint:{keys:`/`}},{id:`sidebar.search.nav`,scope:`sidebar`,keys:[`down`,`up`],category:`Sidebar`,description:`Move highlight in search results`},{id:`sidebar.search.submit`,scope:`sidebar`,keys:[`return`],category:`Sidebar`,description:`Select search match and exit search`},{id:`sidebar.search.cancel`,scope:`sidebar`,keys:[`escape`],category:`Sidebar`,description:`Cancel search (restore prior selection)`},{id:`tasks.openWorktree`,scope:`sidebar`,keys:[`o`],category:`Tasks pane`,description:`Open selected Task directory in your editor`,hint:{keys:`o`}},{id:`tasks.renameBranch`,scope:`sidebar`,keys:[`b`],category:`Tasks pane`,description:`Rename the selected task's git branch`,hint:{keys:`b`}},{id:`tasks.cycleEngine`,scope:`sidebar`,keys:[`v`],category:`Tasks pane`,description:`Cycle engine vendor — applies on reopen`,hint:{keys:`v`}},{id:`tasks.update`,scope:`sidebar`,keys:[`u`],category:`Tasks pane`,description:`Open the update page — version check + release notes`,hint:{keys:`u`}},{id:`tasks.focusEngine`,scope:`sidebar`,keys:[`right`],category:`Tasks pane`,description:`Focus the engine pane of the current window`,hint:{keys:`→`}},...oi,...si,...ci,{id:`terminal.scroll-up`,scope:`terminal`,keys:[`ctrl+pageup`],category:`Terminal`,description:`Scroll scrollback up`,hint:{keys:`ctrl+pgup`}},{id:`terminal.scroll-down`,scope:`terminal`,keys:[`ctrl+pagedown`],category:`Terminal`,description:`Scroll scrollback down`},{id:`terminal.reset`,scope:`terminal`,keys:[`f5`],category:`Terminal`,description:`Reset terminal — kill the current shell and respawn`,hint:{keys:`f5`},presentation:`onePress`}],ui={ctrl:`⌃`,control:`⌃`,alt:`⌥`,opt:`⌥`,option:`⌥`,shift:`⇧`,cmd:`⌘`,command:`⌘`,meta:`⌘`,super:`⌘`},di={enter:`⏎`,return:`⏎`,esc:`⎋`,escape:`⎋`,space:`␣`,up:`↑`,down:`↓`,left:`←`,right:`→`,backspace:`⌫`,delete:`⌦`,del:`⌦`,pgup:`⇞`,pageup:`⇞`,pgdn:`⇟`,pagedown:`⇟`,home:`↖`,end:`↘`};function fi(e,t){if(e.includes(`/`))return e.split(`/`).map(e=>fi(e,t)).join(`/`);let n=e.toLowerCase();return n===`tab`?`tab`:di[n]||(/^f\d{1,2}$/.test(n)?n.toUpperCase():t?/^[a-z]$/.test(n)?e.toUpperCase():e.replace(/[a-z]+/gi,e=>e.toUpperCase()):e)}function pi(e,t=`⌃A`){let n=e.trim();if(!n)return n;let r=/^prefix\s+(.+)$/i.exec(n);if(r){let e=r[1]??``;return`${t} ${e.includes(`+`)?pi(e,t):fi(e,!0)}`}let i=n.split(`+`);if(i.length===1)return fi(i[0]??``,!1);let a=i[i.length-1]??``;return`${i.slice(0,-1).map(e=>ui[e.toLowerCase().trim()]??e).join(``)} ${fi(a,!0)}`}var mi={path:``,exists:!1,rows:[],prefix:{key:`ctrl+a`,firstStrokes:[`ctrl+a`],timeoutMs:5e3},plugins:[],applied:[],warnings:[]},hi=g(mi),gi=new Map(li.map(e=>[e.id,{keys:[...e.keys],prefixKeys:e.prefixKeys&&[...e.prefixKeys],hint:e.hint&&{...e.hint}}]));function _i(e){for(let e of li){let t=gi.get(e.id);if(!t)continue;let n=e;n.keys=[...t.keys],n.prefixKeys=t.prefixKeys&&[...t.prefixKeys],n.hint=t.hint&&{...t.hint}}for(let t of e.rows){let e=li.find(e=>e.id===t.id);e&&(e.keys=[...t.keys],e.prefixKeys=t.prefixKeys&&[...t.prefixKeys],e.hint=t.hint&&{...t.hint})}hi.set(e)}async function vi(e){try{_i(await e.request(`keybindings.get`))}catch{}}function yi(e){let t=_(e.conn).hello;(0,h.useEffect)(()=>{if(!t)return;let n=()=>void vi(e);return n(),window.addEventListener(`focus`,n),()=>window.removeEventListener(`focus`,n)},[t,e])}var bi=()=>hi.get().prefix.key,xi=()=>{let e=bi();return e===null?``:pi(e)};function Si(e,t=`direct`){let n=li.find(t=>t.id===e),r=t===`prefix`?n?.prefixKeys?.[0]:n?.keys[0];return r===void 0?void 0:pi(r)}var Ci=e=>li.find(t=>t.id===e)?.keys??[];function wi(e){let t=xi(),n=Si(e,`prefix`);return t&&n?`${t} ${n}`:``}var Ti=e=>gi.get(e)?.prefixKeys??[];function Ei(e,t){let n=hi.get().rows.find(t=>t.id===e),r=gi.get(e),i=t===`prefix`?n?.prefixKeys:n?.keys,a=t===`prefix`?r?.prefixKeys:r?.keys;return i&&JSON.stringify(i)!==JSON.stringify(a??[])?i:void 0}function Di(e,t){for(let n of t){let t=e.find(e=>e.chord===n);if(t)return t}}function Oi(e){return!e.dialog&&e.page!==`worktrees`&&e.page!==`update`}var G=g({stale:!1,daemonVersion:null,bridgeVersion:null}),ki=2e4;async function Ai(e){try{let t=await e.request(`daemon.info`);return G.set({stale:t.stale,daemonVersion:t.daemonVersion,bridgeVersion:t.bridgeVersion}),t.stale}catch{return G.get().stale}}function ji(e){(0,h.useEffect)(()=>{let t=e.onOpen(()=>void Ai(e)),n=jr(ki,()=>void Ai(e));return()=>{t(),n()}},[e])}function Mi(e){if(!G.get().stale){H(W(`update`,`refresh.alreadyCurrent`),`error`);return}B.set((0,L.jsx)(Or,{title:W(`update`,`refresh.confirmTitle`),body:W(`update`,`refresh.confirmBody`),confirmLabel:W(`update`,`refresh.confirmLabel`),onConfirm:async()=>{await e.request(`daemon.restart`),H(W(`update`,`refresh.relaunching`));for(let t=0;t<20;t++)if(await new Promise(e=>window.setTimeout(e,1e3)),!await Ai(e))return;throw Error(F(`layout.refreshTimeout`))}}))}function Ni({onRefresh:e}){I();let{stale:t,daemonVersion:n,bridgeVersion:r}=_(G);if(_(hi),!t)return null;let i=W(`update`,`skew.hint`,{daemon:n?`v${n}`:W(`update`,`skew.olderBuild`),clientVersion:r??``,keys:wi(`app.refresh`)});return(0,L.jsxs)(`div`,{className:`mono ${Dt}`,role:`alert`,children:[(0,L.jsx)(`b`,{children:W(`update`,`skew.title`)}),(0,L.jsx)(`span`,{children:i}),(0,L.jsx)(`button`,{type:`button`,className:sn,onClick:e,children:W(`update`,`refresh.confirmLabel`)})]})}var Pi=[`info`,`success`,`warning`,`error`,`muted`],Fi=4e3,Ii=4e3,Li=/^[A-Za-z0-9._:-]{1,64}$/,Ri={box:new Set([`type`,`direction`,`gap`,`padding`,`border`,`children`]),text:new Set([`type`,`text`,`tone`,`bold`]),button:new Set([`type`,`key`,`label`,`tone`]),input:new Set([`type`,`key`,`placeholder`,`value`])};function zi(e){return typeof e==`string`&&Pi.includes(e)}function Bi(e){return e===0||e===1||e===2||e===3}var Vi=class extends Error{};function Hi(e){let t=0,n=new Set,r=(e,i,a)=>{if(a>12)throw new Vi(`${i}: deeper than 12`);if(++t>400)throw new Vi(`more than 400 elements`);if(!e||typeof e!=`object`||Array.isArray(e))throw new Vi(`${i}: not an element`);let o=e,s=o.type;if(s!==`box`&&s!==`text`&&s!==`button`&&s!==`input`)throw new Vi(`${i}: unknown element ${JSON.stringify(s)}`);for(let e of Object.keys(o))if(!Ri[s].has(e))throw new Vi(`${i}: ${s} has no prop "${e}"`);if(o.tone!==void 0&&!zi(o.tone))throw new Vi(`${i}: tone must be one of ${Pi.join(`, `)}`);if(s===`text`){if(typeof o.text!=`string`||o.text.length>4e3)throw new Vi(`${i}: text must be a string of at most ${Fi} chars`);if(o.bold!==void 0&&typeof o.bold!=`boolean`)throw new Vi(`${i}: bold must be boolean`);return{type:s,text:o.text,...o.tone===void 0?{}:{tone:o.tone},...o.bold?{bold:!0}:{}}}if(s===`button`||s===`input`){if(typeof o.key!=`string`||!Li.test(o.key))throw new Vi(`${i}: bad ${s} key`);if(n.has(o.key))throw new Vi(`${i}: duplicate key "${o.key}"`);n.add(o.key)}if(s===`input`){for(let e of[`placeholder`,`value`]){let t=o[e];if(t!==void 0&&(typeof t!=`string`||t.length>4e3))throw new Vi(`${i}: ${e} must be a string of at most ${Ii} chars`)}return{type:s,key:o.key,...o.placeholder===void 0?{}:{placeholder:o.placeholder},...o.value===void 0?{}:{value:o.value}}}if(s===`button`){if(typeof o.label!=`string`||o.label.length===0||o.label.length>40)throw new Vi(`${i}: label must be 1-40 chars`);return{type:s,key:o.key,label:o.label,...o.tone===void 0?{}:{tone:o.tone}}}if(o.direction!==void 0&&o.direction!==`row`&&o.direction!==`column`)throw new Vi(`${i}: direction must be "row" or "column"`);for(let e of[`gap`,`padding`])if(o[e]!==void 0&&!Bi(o[e]))throw new Vi(`${i}: ${e} must be 0-3`);if(o.border!==void 0&&typeof o.border!=`boolean`)throw new Vi(`${i}: border must be boolean`);if(!Array.isArray(o.children))throw new Vi(`${i}: box needs children`);return{type:s,...o.direction===void 0?{}:{direction:o.direction},...o.gap===void 0?{}:{gap:o.gap},...o.padding===void 0?{}:{padding:o.padding},...o.border?{border:!0}:{},children:o.children.map((e,t)=>r(e,`${i}.children[${t}]`,a+1))}};try{return{ok:!0,tree:r(e,`tree`,1)}}catch(e){if(e instanceof Vi)return{ok:!1,error:e.message};throw e}}function Ui(e){let t=e?.panes;if(!Array.isArray(t))return null;let n=[];for(let e of t){if(!e||typeof e!=`object`)continue;let t=e;if(typeof t.plugin!=`string`||typeof t.id!=`string`||typeof t.title!=`string`)continue;let r=Hi(t.tree);r.ok&&n.push({plugin:t.plugin,id:t.id,title:t.title,tree:r.tree})}return n}function Wi(e){let t=[],n=(e,r,i)=>{if(e.type===`button`||e.type===`input`)t.push({kind:e.type,plugin:r,pane:i,key:e.key});else if(e.type===`box`)for(let t of e.children)n(t,r,i)};for(let t of e)n(t.tree,t.plugin,t.id);return t}function Gi(e,t){return e!==null&&t!==null&&e.plugin===t.plugin&&e.pane===t.pane&&e.key===t.key}function Ki(e,t){return e.find(e=>Gi(e,t))??e[0]??null}function qi(e,t,n){if(e.length===0)return null;let r=e.findIndex(e=>Gi(e,t));return r<0?e[0]??null:e[(r+n+e.length)%e.length]??null}function Ji(e,t){if(!t)return e;let n=new Map(e.map(e=>[e.id,e]));for(let e of t.remove)n.delete(e);for(let e of t.upsert)n.set(e.id,e);return t.order?t.order.flatMap(e=>n.get(e)??[]):e.map(e=>n.get(e.id)??e)}function Yi(e,t){return{...e,rev:t.rev,tasks:Ji(e.tasks,t.tasks),...t.archived?{archived:Ji(e.archived??[],t.archived)}:{},...t.attention?{attention:t.attention}:{},...t.gates?{gates:t.gates}:{}}}function Xi(e){return!!e&&typeof e==`object`&&typeof e.from==`number`}var Zi=(e,t)=>n=>({...n,tasks:n.tasks.map(n=>n.id===e?{...n,...t}:n)}),Qi=(e,t)=>n=>({...n,tasks:n.tasks.map(n=>n.id===e?{...n,title:t,label:n.label===n.title?t:n.label}:n)});function $i(e,t){let n=new Set([t]);for(let t=!0;t;){t=!1;for(let r of e)r.parentTaskId&&n.has(r.parentTaskId)&&!n.has(r.id)&&(n.add(r.id),t=!0)}return n}var ea=(e,t)=>n=>{let r=t?n.tasks:n.archived??[],i=$i(r,e),a=r.filter(e=>i.has(e.id)).map(e=>({...e,archived:t})),o=r.filter(e=>!i.has(e.id));return t?{...n,tasks:o,archived:[...n.archived??[],...a]}:{...n,tasks:[...n.tasks,...a],archived:o}},ta=(e,t)=>n=>{let r=[...n.tasks,...n.archived??[]],i=t?$i(r,e):new Set([e]),a=r.find(t=>t.id===e)?.parentTaskId,o=t=>t.filter(e=>!i.has(e.id)).map(t=>t.parentTaskId===e?{...t,parentTaskId:a}:t);return{...n,tasks:o(n.tasks),...n.archived?{archived:o(n.archived)}:{}}},na={"task.pin":(e,t)=>Zi(e,{pinned:t.pinned===!0}),"task.keep":(e,t)=>Zi(e,{kept:t.kept===!0}),"task.setStatus":(e,t)=>Zi(e,{status:t.status}),"task.rename":(e,t)=>Qi(e,String(t.title)),"task.archive":(e,t)=>ea(e,t.archived===!0),"task.delete":(e,t)=>ta(e,t.cascade===!0)};Object.keys(na);function ra(e,t){return na[e]?.(String(t.taskId),t)??null}var ia=`rove.web.selection`,aa=`null`,oa=300;function sa(){try{let e=JSON.parse(localStorage.getItem(ia)??`null`);if(e&&typeof e==`object`&&`taskId`in e&&typeof e.taskId==`string`)return{taskId:e.taskId,tabId:`tabId`in e&&typeof e.tabId==`string`?e.tabId:null}}catch{}return{taskId:null,tabId:null}}function ca(e){if(!e||typeof e!=`object`||!(`taskIds`in e))return;let t=e.taskIds;return Array.isArray(t)?t.filter(e=>typeof e==`string`):void 0}function la(e){return!!e&&typeof e==`object`&&`tasks`in e&&Array.isArray(e.tasks)}var ua=`rove.web.visits`,da=20;function fa(){try{let e=JSON.parse(localStorage.getItem(ua)??`[]`);return Array.isArray(e)?e.filter(e=>!!e&&typeof e==`object`&&typeof e.taskId==`string`):[]}catch{return[]}}function pa(e,t){if(t)return e?.tasks.find(e=>e.id===t)??e?.archived?.find(e=>e.id===t)}function ma(e,t,n,r){let i=(e,t)=>e.some(e=>e.id===t&&!e.deleting),a=n.taskId;if(a===null||!i(e,a)||i(t,a))return null;let o=r.find(e=>e.taskId!==a&&i(t,e.taskId));return o?{taskId:o.taskId,tabId:o.tabId}:{taskId:null,tabId:null}}var ha=class{client;tasks=g(null);remote=g([]);tabs=g({});tabsSettled=g(!1);mods=g([]);installedMods=g(new Set);selection=g(sa());visits=g(fa());tabTimer=null;tabsReadAt=-1/0;tabScope=new Set;tabSets=new Map;tabReads=new Map;syncing=null;served=null;edits=new Map;pendingSelect=null;selectIntent=0;provisioning=new Map;viewingSent=aa;taskShown=!0;viewingExtras=()=>({});constructor(e){this.client=e,e.onOpen(()=>{this.resync(),this.viewingSent=aa,this.reportViewing(),this.refreshMods()}),typeof document<`u`&&typeof document.addEventListener==`function`&&document.addEventListener(`visibilitychange`,()=>{this.reportViewing(),document.visibilityState===`visible`&&this.refreshMods()}),typeof window<`u`&&typeof window.addEventListener==`function`&&window.addEventListener(`pagehide`,()=>this.reportViewing(!0)),e.on(`tasks`,e=>{la(e)&&this.acceptTasks(e)}),e.on(`tasks.patch`,e=>{let t=this.served;t&&Xi(e)&&e.from===t.rev?this.acceptTasks(Yi(t,e)):this.resync()}),e.on(`tabs`,e=>this.scheduleTabRefresh(ca(e))),e.on(`mods`,e=>this.mods.set(Ui(e)??[]))}resync(){return this.syncing??=this.client.request(`tasks.subscribe`,{patches:!0}).then(e=>this.acceptTasks(e)).catch(()=>{}).finally(()=>{this.syncing=null}),this.syncing}async refreshMods(){try{let{mods:e}=await this.client.request(`builtinMods.list`);this.installedMods.set(new Set(e.filter(e=>e.installed).map(e=>e.id)))}catch{}}onSelect=()=>{};setTaskShown(e){this.taskShown!==e&&(this.taskShown=e,this.reportViewing())}select(e,t=null){this.onSelect();let n=++this.selectIntent;if(this.tasks.get()?.tasks.find(t=>t.id===e)?.noWorktree){this.provisioning.has(e)?this.provisioning.set(e,{intent:n,tabId:t}):this.provisionThenSelect(e,{intent:n,tabId:t});return}this.commitSelection(e,t)}commitSelection(e,t){let n=this.tabs.get()[e]??[],r={taskId:e,tabId:t??ga(n)?.id??null};this.selection.set(r),localStorage.setItem(ia,JSON.stringify(r));let i=[{...r,at:Date.now()},...this.visits.get().filter(e=>e.taskId!==r.taskId||e.tabId!==r.tabId)].slice(0,da);this.visits.set(i),localStorage.setItem(ua,JSON.stringify(i)),this.reportViewing(),e in this.tabs.get()||this.scheduleTabRefresh([e])}reportViewing(e=!1){let{taskId:t,tabId:n}=this.selection.get(),r=e||typeof document<`u`&&document.visibilityState===`hidden`||!t||!this.taskShown?null:{taskId:t,...n?{tabId:n}:{},...this.viewingExtras()},i=JSON.stringify(r);i!==this.viewingSent&&(this.viewingSent=i,this.client.request(`ui.viewing`,r??{taskId:null}).catch(()=>{this.viewingSent===i&&(this.viewingSent=aa)}))}async provisionThenSelect(e,t){this.provisioning.set(e,t);let n=!0;try{await this.client.request(`task.ensureWorktree`,{taskId:e})}catch(e){n=!1,H(e instanceof Error?e.message:String(e),`error`)}let r=this.provisioning.get(e)??t;this.provisioning.delete(e),n&&(this.markProvisioned(e),(this.tasks.get()?.tasks.some(t=>t.id===e)??!1)&&r.intent===this.selectIntent&&this.commitSelection(e,r.tabId))}markProvisioned(e){let t=this.tasks.get();if(!t)return;let n=t.tasks.map(t=>t.id===e?{...t,noWorktree:void 0}:t);this.tasks.set({...t,tasks:n})}selectWhenListed(e){this.tasks.get()?.tasks.some(t=>t.id===e)?this.select(e):this.pendingSelect=e}engineTarget(e){let{taskId:t,tabId:n}=this.selection.get(),r=t===e?this.tabs.get()[e]?.find(e=>e.id===n):void 0;return r?.kind===`engine`?{taskId:e,tabId:r.id}:{taskId:e}}async refreshTabsNow(e){await this.refreshTabs([e])}tabbedTasks(){let e=this.tasks.get(),t=e?.archived?.find(e=>e.id===this.selection.get().taskId);return[...e?.tasks??[],...t?[t]:[],...this.remote.get().filter(e=>!e.machine?.stale)]}act(e,t){let n=ra(e,t),r=()=>this.client.request(e,t);return n?this.optimistic(n,r):r()}closeTab(e,t){return this.tabAct(e,`tab.close`,{taskId:e,tabId:t},e=>e.filter(e=>e.id!==t))}renameTab(e,t,n){return this.tabAct(e,`tab.rename`,{taskId:e,tabId:t,title:n},e=>e.map(e=>e.id===t?{...e,title:n}:e))}async tabAct(e,t,n,r){let i=this.tabs.get()[e];i&&(this.tabReads.set(e,(this.tabReads.get(e)??0)+1),this.tabs.set({...this.tabs.get(),[e]:r(i)}),this.reselectIfClosed(e));try{await this.client.request(t,n)}finally{await this.refreshTabs([e])}}async optimistic(e,t){this.edits.set(e,!1);let n=this.selection.get();this.served&&this.acceptTasks(this.served,!0);try{let n=await t();return this.edits.has(e)&&this.edits.set(e,!0),n}catch(t){throw this.edits.delete(e),this.served&&this.acceptTasks(this.served,!0),n.taskId!==null&&this.selection.get().taskId!==n.taskId&&pa(this.tasks.get(),n.taskId)&&this.commitSelection(n.taskId,n.tabId),t}}acceptTasks(e,t=!1){this.served=e;let n=e;for(let[e,r]of this.edits)r&&!t?this.edits.delete(e):n=e(n);let r=[...this.tasks.get()?.tasks??[],...this.remote.get()];this.remote.set(n.tasks.filter(e=>e.machine)),this.tasks.set({...n,tasks:n.tasks.filter(e=>!e.machine)});let i=ma(r,n.tasks,this.selection.get(),this.visits.get());i?.taskId?this.commitSelection(i.taskId,i.tabId):i&&(this.selection.set(i),localStorage.setItem(ia,JSON.stringify(i)),this.reportViewing()),this.pendingSelect&&n.tasks.some(e=>e.id===this.pendingSelect)&&(this.select(this.pendingSelect),this.pendingSelect=null);let a=this.tabbedTasks(),o=new Set(a.map(e=>e.id)),s=this.tabs.get();Object.keys(s).some(e=>!o.has(e))&&this.tabs.set(Object.fromEntries(Object.entries(s).filter(([e])=>o.has(e))));for(let e of this.tabSets.keys())o.has(e)||this.tabSets.delete(e);let c=a.filter(e=>{let t=Object.keys(e.tabStatus??{}).sort().join(` `);return this.tabSets.get(e.id)!==t&&(this.tabSets.set(e.id,t),!0)});c.length>0&&this.scheduleTabRefresh(c.map(e=>e.id))}scheduleTabRefresh(e){if(!e)this.tabScope=null;else for(let t of e)this.tabScope?.add(t);if(this.tabTimer!==null)return;let t=Math.max(0,this.tabsReadAt+oa-Date.now());this.tabTimer=window.setTimeout(()=>{this.tabTimer=null,this.tabsReadAt=Date.now();let e=this.tabScope;this.tabScope=new Set,this.refreshTabs(e?[...e]:this.tabbedTasks().map(e=>e.id))},t)}async refreshTabs(e){await Promise.all(e.map(async e=>{let t=(this.tabReads.get(e)??0)+1;this.tabReads.set(e,t);let n;try{n=(await this.client.request(`task.tabs`,{taskId:e})).tabs}catch{return}this.tabReads.get(e)===t&&(this.tabs.set({...this.tabs.get(),[e]:n}),this.reselectIfClosed(e))})),this.tabsSettled.get()||this.tabsSettled.set(!0)}reselectIfClosed(e){let t=this.selection.get();t.taskId===e&&((this.tabs.get()[e]??[]).some(e=>e.id===t.tabId)||this.commitSelection(e,null))}};function ga(e){return e.find(e=>e.alive!==!1)??e[0]}function _a({model:e}){let t=_(e.selection),n=_(e.tasks),r=_(e.remote),i=pa(n,t.taskId)??r.find(e=>e.id===t.taskId),a=n?.attention.filter(e=>e.unread).length??0,o=`${a>0?`(${a}) `:``}${i?`${i.label} - `:``}rove`;return(0,h.useEffect)(()=>{document.title=o},[o]),null}var va=[`sidebar`,`workspace`,`files`];function ya(e,t,n){let r=va.filter(e=>e!==`files`||n.filesVisible),i=r.indexOf(e);if(i<0)return(t>0?r[r.length-1]:r[0])??null;let a=Math.min(Math.max(i+t,0),r.length-1);return a===i?null:r[a]??null}var ba=`.split-leaf.is-active textarea.xterm-helper-textarea`,xa={sidebar:[`.rail`,`.rail`],workspace:[`.workspace`,ba],files:[`.side-panel`,`.side-view:not([hidden]) :is([tabindex='0'], input)`]};function Sa(){for(let e of document.querySelectorAll(ba))if(e.closest(`[data-stream]`)?.getClientRects().length)return e;return null}function Ca(){let e=Sa();return e?.focus(),e!==null}function wa(e){let t=ya(Object.keys(xa).find(e=>document.activeElement?.closest(xa[e][0]))??`sidebar`,e,{filesVisible:document.querySelector(xa.files[0])!==null});t&&document.querySelector(xa[t][1])?.focus()}var Ta=[];function Ea(e){Ta.push(e)}var Da={workspace:`workspace`,sidebar:`sidebar`,files:`files`,terminal:`terminal`};function Oa(){let e=Ta.flatMap(e=>e()),t=new Set(e.filter(e=>!e.prefix).map(e=>e.id)),n=e.map(e=>{let t=Ei(e.id,e.prefix?`prefix`:`direct`);return t?{...e,chords:t}:e});for(let r of e){let e=r.prefix?Ei(r.id,`direct`):void 0;if(!e||e.length===0||t.has(r.id))continue;t.add(r.id);let i=li.find(e=>e.id===r.id)?.scope??`global`;n.push({...r,prefix:!1,chords:e,...Da[i]?{surface:Da[i]}:{}})}return n}function ka(e,t){return!e.surface||e.surface===t||t===`terminal`&&e.surface===`workspace`}function Aa(e,t){return e.surface===t?0:e.surface?1:2}function ja(){let e=document.activeElement;return e instanceof Element?e.closest(`.xterm`)?`terminal`:e.closest(`.rail`)?`sidebar`:e.closest(`.files`)?`files`:e.closest(`.workspace, .side-panel`)?`workspace`:null:null}function Ma(e,t){let n=new Set,r=new Set;for(let i of Oa())!ka(i,t)||i.live?.(e)===!1||(i.prefix?r:n).add(i.id);return{direct:n,prefix:r,inputPassthrough:t===`terminal`}}function Na(){let e=new Set(Oa().map(e=>e.id));return li.filter(t=>e.has(t.id))}var Pa=new Map,Fa=g(null);function Ia(e){return Pa.set(e.stream,e),()=>{Pa.get(e.stream)===e&&Pa.delete(e.stream),Fa.get()===e&&Fa.set(null)}}function La(e){return Pa.get(e)}Ea(()=>[{id:`terminal.scroll-up`,chords:[`ctrl+pageup`],prefix:!1,surface:`terminal`,run:()=>Fa.get()?.scrollPages(-1)},{id:`terminal.scroll-down`,chords:[`ctrl+pagedown`],prefix:!1,surface:`terminal`,run:()=>Fa.get()?.scrollPages(1)},{id:`terminal.reset`,chords:[`f5`],prefix:!1,surface:`terminal`,run:()=>Fa.get()?.reset()}]);var Ra={INPUT:!0,TEXTAREA:!0,SELECT:!0},za=`.rail, .side-panel, dialog, [role=dialog], [role=menu], [role=listbox]`;function Ba(e){return!e||e.tagName===`BODY`||e.tagName===`HTML`?`none`:e.closest(`.xterm`)?`terminal`:Ra[e.tagName]===!0||e.isContentEditable?`field`:e.closest(za)?`pane`:`loose`}function Va(e,t,n){return e.key!==`Escape`||e.defaultPrevented||e.isComposing||e.ctrlKey||e.metaKey||e.altKey||e.shiftKey||n.overlay||!n.terminal?!1:t===`none`||t===`loose`}function Ha(){(0,h.useEffect)(()=>{let e=e=>{if(e.key!==`Escape`)return;let t=Sa(),n=document.activeElement;if(!Va(e,Ba(n instanceof HTMLElement?n:null),{overlay:B.get()!==null||mn.get()!==null||V.get()!==null||Tn.get()!==null,terminal:t!==null}))return;let r=t?.closest(`[data-stream]`)?.dataset.stream,i=r?La(r):void 0;!t||!i||(e.preventDefault(),t.focus(),i.input(`\x1B`))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[])}function Ua(e){return e.focusedPane===`sidebar`?`sidebar`:e.hasSelection||e.hasOpenPage?`content`:`sidebar`}var Wa=`(max-width: 559px)`,Ga=g(`sidebar`),Ka=()=>Ga.set(`workspace`),qa=()=>Ga.set(`sidebar`);function Ja(e){V.set(e),Ka()}function Ya(e){bn.set(e),Ja(`compare`)}var Xa,Za=()=>(Xa??=window.matchMedia(Wa),Xa),Qa=()=>Za().matches,$a=e=>{let t=Za();return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)};function eo(){return(0,h.useSyncExternalStore)(e=>{let t=Za();return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)},()=>Za().matches)}function to(e,t,n){return Ua({focusedPane:e,hasSelection:t,hasOpenPage:n})}var no=Reflect.get(globalThis,`__roveRelay`);function ro(e,t){return no?no.fetch(e,t):fetch(e,t)}function io(e,t){return no?new no.WebSocket(e,t):new WebSocket(e,t)}function ao(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 oo(e=ro){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 K(e=ro){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 so(e,t=ro){try{let n=await t(`/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({password:e}),credentials:`omit`}),r=ao(n.status,await n.json().catch(()=>null));return r.kind===`ok`&&a(r.token),r}catch{return{kind:`unreachable`}}}async function co(e=ro){let t=i();o(),t&&await e(`/logout`,{method:`POST`,headers:{Authorization:`Bearer ${t}`}}).catch(()=>{})}function lo(e){if(!e)return null;switch(e.kind){case`ok`:return null;case`wrong`:return F(`login.wrong`);case`locked`:return F(`login.locked`,{minutes:e.minutes});case`lockedHost`:return F(`login.lockedHost`);case`unreachable`:return F(`login.unreachable`)}}function uo(){I();let[e,t]=(0,h.useState)(``),[n,r]=(0,h.useState)(!1),[i,a]=(0,h.useState)(null),o=lo(i);return(0,L.jsx)(`div`,{className:Zt,children:(0,L.jsxs)(`form`,{className:Qt,onSubmit:async i=>{if(i.preventDefault(),n||!e)return;r(!0);let o=await so(e);if(o.kind===`ok`){window.location.reload();return}t(``),a(o),r(!1)},children:[(0,L.jsxs)(`span`,{className:Yt,children:[(0,L.jsx)(`span`,{className:Xt,children:`[`}),` rove `,(0,L.jsx)(`span`,{className:Xt,children:`]`})]}),(0,L.jsx)(`h1`,{className:`${z} text-muted`,children:F(`login.title`)}),(0,L.jsx)(`p`,{className:`text-muted`,children:F(`login.body`)}),(0,L.jsx)(`input`,{className:ln,type:`password`,autoComplete:`current-password`,"aria-label":F(`login.field`),placeholder:F(`login.field`),autoFocus:!0,value:e,disabled:n,onChange:e=>{t(e.target.value),a(null)}}),o&&(0,L.jsx)(`p`,{className:`text-error`,role:`alert`,children:o}),(0,L.jsx)(`div`,{className:un,children:(0,L.jsx)(`button`,{type:`submit`,className:Be(),disabled:n||!e,children:F(n?`login.checking`:`login.submit`)})})]})})}function fo(e){return(0,L.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,L.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 po=120;function mo(e,t,n,r=e-t){return e+t+8<=n?e:Math.max(8,Math.min(r,n-t-8))}function ho(e){let{item:t}=e;return(0,L.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:Zn({selected:e.selected,open:e.open,danger:t.danger}),onMouseEnter:e.onEnter,onMouseLeave:e.onLeave,onClick:e.onPick,children:[(0,L.jsx)(`span`,{children:t.label}),t.children?(0,L.jsx)(fo,{right:!0,className:er(!!(e.selected||e.open))}):t.checked?(0,L.jsx)(`span`,{className:tr,"aria-hidden":!0,children:`✓`}):t.key&&(0,L.jsx)(`span`,{className:$n({selected:e.selected,danger:t.danger}),children:t.key})]})}function go(){let e=_(mn),[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,v]=(0,h.useState)({x:0,y:0});if((0,h.useLayoutEffect)(()=>{if(!e||!l.current)return;n(e.fromKeyboard?0:-1),i(null),c(!1);let{width:t,height:r}=l.current.getBoundingClientRect();m({x:mo(e.x,t,window.innerWidth),y:mo(e.y,r,window.innerHeight)});let a=e.target;return a?.setAttribute(`data-menu-open`,``),()=>a?.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();v({x:mo(t.right+2,i,window.innerWidth,t.left-i-2),y:mo(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=()=>mn.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 y=r===null?null:e.items[r]?.children,b=e=>{e.run&&(mn.set(null),e.run())},x=e=>{window.clearTimeout(f.current),i(e),c(!1),o(-1)};return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{ref:l,className:Xn(),role:`menu`,style:{left:p.x,top:p.y},children:e.items.map((a,o)=>(0,L.jsxs)(h.Fragment,{children:[o>0&&a.section!==e.items[o-1]?.section&&(0,L.jsx)(`hr`,{className:`-mx-1 my-1 h-px flex-none border-none bg-line`}),(0,L.jsx)(ho,{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),po):i(null)},onLeave:()=>{window.clearTimeout(f.current),o!==r&&n(-1)},onPick:()=>a.children?x(o):b(a)})]},a.label))}),y&&(0,L.jsx)(`div`,{ref:u,className:Xn(!0),role:`menu`,style:{left:g.x,top:g.y},children:y.map((e,t)=>(0,L.jsx)(ho,{item:e,selected:t===a,onEnter:()=>{o(t),c(!0)},onLeave:()=>o(-1),onPick:()=>b(e)},e.label))})]})}function _o(){let e=_(B),t=_(gn);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(go,{}),e,(0,L.jsx)(`div`,{className:nr,"aria-live":`polite`,children:t.map(e=>{let t=`${ir(e.tone===`error`)} ${e.leaving?`is-leaving`:``}`,n=e.action;return n?(0,L.jsxs)(`div`,{className:`${t} ${rr}`,children:[(0,L.jsx)(`span`,{children:e.text}),(0,L.jsx)(R,{onClick:()=>{Nn(e.id),n.run()},children:`[ ${n.label} ]`})]},e.id):(0,L.jsx)(`button`,{type:`button`,className:t,onClick:()=>Nn(e.id),children:e.text},e.id)})})]})}function vo(e){return e.urls[e.at]??``}function yo(e){try{return new URL(e).host.replace(/^www\./,``)}catch{return e}}function bo(){return{kind:`browser`,tabs:[{id:`t1`,urls:[],at:-1}],active:`t1`,recent:[`t1`],next:2}}function xo(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 So(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=ko(t,e.id)??t}return t}function Co(e,t){let n=`t${e.next}`,r={id:n,urls:t,at:t.length-1};return So(xo({...e,tabs:[...e.tabs,r],next:e.next+1},n))}function wo(e){return Co(e,[])}function To(e,t){return{...e,tabs:e.tabs.map(e=>e.id===t.id?t:e)}}function Eo(e,t,n){let r=e.tabs.find(e=>e.id===t);if(!r||vo(r)===n)return e;let i=[...r.urls.slice(0,r.at+1),n].slice(-30);return To(e,{...r,urls:i,at:i.length-1})}function Do(e,t,n){let r=e.tabs.find(e=>e.id===t);return!r||n===r.at||n<0||n>=r.urls.length?e:To(e,{...r,at:n})}function Oo(e,t){let n=e.tabs.find(e=>vo(e)===t);if(n)return xo(e,n.id);let r=e.tabs.find(e=>vo(e)===``);return r?Eo(xo(e,r.id),r.id,t):Co(e,[t])}function ko(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 Ao(e,t){return e.tabs.some(e=>e.id===t)?ko(e,t):e}function jo(e,t){let n=e.tabs.find(e=>e.id===t);return n?{...e,tabs:[n],active:t,recent:[t]}:e}function Mo(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 No(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 Po=[`quota`,`files`,`file`,`diff`,`chat`,`browser`],Fo=1e3;function Io(){return{columns:[{kind:`files`}],weights:{}}}function Lo(e,t){return e.columns.find(e=>e.kind===t)}function Ro(e){return e.slice(e.lastIndexOf(`/`)+1)}function zo(e,t){return{...e,columns:e.columns.map(e=>e.kind===t.kind?t:e)}}function Bo(e){return[...e].sort((e,t)=>Po.indexOf(e.kind)-Po.indexOf(t.kind))}function Vo(e,t){return{...e,columns:Bo([...e.columns,t])}}function Ho(e,t){return Lo(e,t)||t===`file`?e:Vo(e,t===`diff`?{kind:t,path:`.`,scope:`working`}:t===`browser`?bo():{kind:t})}function Uo(e,t){let n=Lo(e,`file`);return n?n.kind===`file`&&n.path===t?e:zo(e,{kind:`file`,path:t}):Vo(e,{kind:`file`,path:t})}function Wo(e,t,n){let r={kind:`diff`,path:t,scope:n},i=Lo(e,`diff`);return i?i.kind===`diff`&&i.path===t&&i.scope===n?e:zo(e,r):Vo(e,r)}function Go(e,t){let n=Lo(e,`browser`);return n?.kind===`browser`?zo(e,Oo(n,t)):Vo(e,Oo(bo(),t))}function Ko(e,t){if(!Lo(e,t))return e;let{[t]:n,...r}=e.weights;return{columns:e.columns.filter(e=>e.kind!==t),weights:r}}function qo(e,t){let n=Lo(e,`browser`);if(n?.kind!==`browser`)return e;let r=t(n);return r===n?e:r?zo(e,r):Ko(e,`browser`)}function Jo(e,t,n,r=!1){if(t&&Lo(e,n)){let t=Ko(e,n);return{panel:t,open:t.columns.length>0}}if(r){let t=e.columns.filter(e=>e.kind===n);return{panel:Ho({...e,columns:t},n),open:!0}}return{panel:Ho(e,n),open:!0}}function Yo(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*Fo)}function Xo(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 Zo(e){return Object.keys(e.weights).length===0?e:{...e,weights:{}}}function Qo(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 $o=Po.filter(e=>e!==`chat`&&e!==`file`),es=g(`terminal`),ts=`rove.web.panelWidth`,ns=`rove.web.panelOpen`,rs=g((()=>{let e=Number(localStorage.getItem(ts));return Number.isFinite(e)&&e>0?e:null})());rs.subscribe(()=>{let e=rs.get();e===null?localStorage.removeItem(ts):localStorage.setItem(ts,String(Math.round(e)))}),rs.subscribe(Ln);var is=g(localStorage.getItem(ns)===`1`);is.subscribe(()=>localStorage.setItem(ns,is.get()?`1`:`0`));var as=g(!1);is.subscribe(()=>{is.get()||as.set(!1)});function os(e,t,n=window.innerWidth){let r=Math.max(280,n-t-320);return Math.max(280,Math.min(r,Math.round(e)))}function ss(e,t,n=window.innerWidth){return e<2?null:os(Math.max(300,Math.min(440,n*.28))*e,t,n)}var cs=[`files`,`diff`,`browser`];function ls(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.taskId==`string`&&t.taskId!==``&&cs.includes(t.view)&&typeof t.at==`number`&&(t.url===void 0||typeof t.url==`string`)&&(t.path===void 0||typeof t.path==`string`)}function us(e){return e.narrow?{panel:!1,panelOpen:!1,narrow:!0}:{panel:!0,panelOpen:e.panelOpen&&!e.zen,narrow:!1}}function ds(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 fs(e,t){return t.url?Go(e,t.url):t.path?t.tab===`file`?Uo(e,t.path):Wo(e,t.path,`working`):Ho(e,t.tab)}var ps=[`files`,`chat`,`diff`,`browser`,`quota`],ms=e=>e===`branch`||e===`task`?e:`working`;function hs(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:ms(t.scope)}:t.kind===`browser`?No(t.tabs,t.active,t.recent,t.next):null}function gs(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 _s(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 vs(e){let t=_s(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:ms(n.scope)})}if(i===`browser`){let n=No(t.tabs.filter(e=>e.kind===`browser`),void 0,t.recent,e.next);n&&r.push(n)}}return{columns:Bo(r),weights:{}}}function ys(e){if(!e||typeof e!=`object`)return null;let t=e;if(!Array.isArray(t.columns))return vs(t);let n=[];for(let e of t.columns){let t=hs(e);t&&!n.some(e=>e.kind===t.kind)&&n.push(t)}return{columns:Bo(n),weights:gs(t.weights,n)}}function bs(e,t){let n=Io(),r=typeof t==`string`&&t!==``?t:``;return e!==`browser`&&!r?n:{...n,columns:[...n.columns,r?Oo(bo(),r):bo()]}}function xs(e){try{let t=JSON.parse(e??`{}`);return t&&typeof t==`object`&&!Array.isArray(t)?Object.entries(t):[]}catch{return[]}}function Ss(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 Cs(e,t){let n={};for(let[t,r]of xs(e)){let e=ys(r);e&&(n[t]=e)}let r=new Map(xs(t.tab).filter(([,e])=>ps.includes(e))),i=new Map(xs(t.url)),a=[...new Set([...r.keys(),...i.keys()])].filter(e=>!(e in n));n={...Object.fromEntries(a.map(e=>[e,bs(r.get(e),i.get(e))])),...n};for(let e of Object.keys(n).slice(0,-50))delete n[e];return n}var ws=`rove.web.panels`,Ts=`rove.web.panelTab`,Es=`rove.web.panelUrl`;function Ds(){let e={tab:localStorage.getItem(Ts),url:localStorage.getItem(Es)},t=Cs(localStorage.getItem(ws),e);return(e.tab!==null||e.url!==null)&&(localStorage.setItem(ws,JSON.stringify(t)),localStorage.removeItem(Ts),localStorage.removeItem(Es)),t}var Os=g(Ds()),ks=Io();function As(e){return _(Os)[e]??ks}function js(e){let t=As(e??``);return _(is)&&(e===null||t.columns.length>0)}function Ms(e,t){let n=Os.get()[e]??ks,r=t(n);if(r===n)return;let i=Ss(Os.get(),e,r);Os.set(i),localStorage.setItem(ws,JSON.stringify(i))}function Ns(e,t){Ms(e,e=>Ho(e,t)),is.set(!0),Qa()&&es.set(t)}function Ps(e,t){let n=is.get(),r=Jo(Os.get()[e]??ks,n&&!Sn.get(),t,!n);Ms(e,()=>r.panel),is.set(r.open),r.open&&Sn.get()&&Sn.set(!1)}function Fs(e){Ms(e.taskId,t=>Wo(t,e.path,e.scope)),is.set(!0),Sn.get()&&Sn.set(!1),Qa()&&es.set(`diff`)}function Is(e,t){Ms(e,e=>Uo(e,t)),is.set(!0),Sn.get()&&Sn.set(!1),Qa()&&es.set(`file`)}function Ls(e,t){Ms(e,e=>Go(e,t)),is.set(!0),Sn.get()&&Sn.set(!1),Qa()&&es.set(`browser`)}function Rs(e,t){let n=Os.get()[e]??ks;!Qa()&&n.columns.length===0&&is.set(!1),Qa()&&es.get()===t&&!Lo(n,t)&&Ns(e,`files`)}function zs(e,t){Ms(e,e=>Ko(e,t)),Rs(e,t)}function Bs(e,t){Ms(e,e=>qo(e,t)),Rs(e,`browser`)}function Vs(e,t){Bs(e,e=>Ao(e,t))}function Hs(e,t){let n=ds(e,{taskId:t,narrow:Qa()});Ms(e.taskId,e=>fs(e,n)),n.show&&(is.set(!0),Sn.get()&&Sn.set(!1))}var Us={Enter:`return`," ":`space`,Escape:`escape`,ArrowUp:`up`,ArrowDown:`down`,ArrowLeft:`left`,ArrowRight:`right`,PageUp:`pageup`,PageDown:`pagedown`};function Ws(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 Us[e.key]??e.key.toLowerCase()}function Gs(e){let t=Ws(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 Ks(e){return e.startsWith(`shift+`)&&e.length===7?e.slice(6).toUpperCase():e}var qs=new Map(li.map(e=>[e.id,{keys:[...e.keys],prefixKeys:e.prefixKeys&&[...e.prefixKeys],hint:e.hint?{...e.hint}:void 0}]));function Js(){return li.map(e=>{let t=qs.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 Ys=new Map(li.map(e=>[e.id,e]));function Xs(e){return Ys.get(e)}function Zs(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 Qs(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 $s(e){return e.hint?.keys??e.keys[0]}function ec(e){let t=Xs(e);if(!t)return null;let n=$s(t);return n&&n.length>0?n:null}function tc(e){return e.keys.length>0?e.hint?.keys??e.keys[0]??null:e.prefixKeys?.length?null:e.hint?.keys??null}function nc(e,t){return e.scope===`global`?!0:t===null?!1:e.scope===t||t===`terminal`&&e.scope===`workspace`}function rc(e,t,n,r){let i=[],a=[],o=[],s=new Map;for(let c of e){let e=tc(c),l=nc(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 ic={global:`Global`,sidebar:`Sidebar`,workspace:`Workspace`,files:`Files`,inbox:`Inbox`,terminal:`Terminal`};function ac(e){return e?ic[e]:`Global`}function oc(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`:Xs(e)?.category??`Global`}function sc(e,t,n){let r=e.trim();return Zs(r,t)||Zs(r,n)}var cc={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`}},lc={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:`检查已通过`}},uc={status:{commands:`{key} commands`,help:`{key} help`,sidebar:`{key} sidebar`,settings:`settings`},pane:{move:`move`,open:`open`,collapse:`collapse`,diff:`diff`}},dc={status:{commands:`{key} 命令`,help:`{key} 帮助`,sidebar:`{key} 侧栏`,settings:`设置`},pane:{move:`移动`,open:`打开`,collapse:`折叠`,diff:`差异`}},fc={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`}},pc={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 mc(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 hc(e,t){return Me.get()===`zh`?t:e}function gc(e,t){return t?e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e)):e}var _c=(e,t)=>gc(mc(hc(cc,lc),e)??mc(cc,e)??e,t),vc=(e,t)=>gc(mc(hc(uc,dc),e)??mc(uc,e)??e,t),yc=(e,t)=>gc(mc(hc(Xr,Zr),e)??mc(Xr,e)??e,t);function bc(e){return hc(fc,pc).desc[e]??fc.desc[e]??e}function xc(e){let t=bc(e),n=t.search(/\s—\s|——/);return n>0?t.slice(0,n):t}function Sc(e){return hc(fc,pc).category[e]??e}var Cc=(e,t)=>gc(mc(hc(ei,ti),e)??mc(ei,e)??e,t),wc=(e,t)=>gc(mc(hc(Jr,Yr),e)??mc(Jr,e)??e,t),Tc=e=>e.split(` + `).map(e=>pi(e)).join(` + `);function Ec(e){let t=Sc(ac(e.scope));return e.kind===`here`?_c(`here`,{surface:t}):e.kind===`direct`?_c(`direct`):e.kind===`prefix`?_c(`afterPrefix`):_c(`otherPane`,{surface:t})}function Dc(e){let t=document.activeElement instanceof HTMLElement?document.activeElement:null;B.set((0,L.jsx)(Oc,{model:e,surface:ja(),origin:t}))}function Oc({model:e,surface:t,origin:n}){I();let r=_(hi),[i,a]=(0,h.useState)(!1),[o,s]=(0,h.useState)(``),c=(0,h.useRef)(null),l=(0,h.useMemo)(()=>Ma(e,t),[e,t]),u=(0,h.useMemo)(()=>rc(Na(),t===`terminal`?`terminal`:t,bi(),l),[l,t,r]).map(e=>({...e,rows:e.rows.filter(e=>sc(o,bc(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===`?`)Pn();else if(!i&&t.key===`/`)a(!0);else return;t.preventDefault()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[i]),(0,L.jsx)(Tr,{title:_c(`title`),wide:!0,children:(0,L.jsxs)(`div`,{className:`${Yn} help`,children:[(0,L.jsxs)(`div`,{className:bt,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`p`,{className:`text-muted`,children:t?_c(`focused`,{surface:Sc(ac(t))}):_c(`allBindings`)}),(0,L.jsx)(`p`,{className:`text-muted`,children:_c(`grammar`,{prefix:xi()})})]}),(0,L.jsxs)(`div`,{className:xt,children:[(0,L.jsx)(`span`,{className:`subtle`,children:_c(`scrollKeys`)}),(0,L.jsx)(`button`,{type:`button`,className:sn,onClick:Pn,children:_c(`esc`)})]})]}),i?(0,L.jsx)(`input`,{className:ln,autoFocus:!0,spellCheck:!1,value:o,placeholder:_c(`search`),onChange:e=>{s(e.target.value),c.current?.scrollTo({top:0})}}):(0,L.jsx)(`p`,{className:`text-muted`,children:_c(`filter`)}),u.length===0&&(0,L.jsx)(`p`,{className:`text-muted`,children:_c(`noResults`)}),(0,L.jsx)(`div`,{className:St,ref:c,children:u.map((e,t)=>(0,L.jsxs)(`section`,{className:Ct,children:[(0,L.jsx)(`h2`,{className:wt,children:Ec(e)}),e.rows.map(t=>(0,L.jsxs)(`div`,{className:Tt,children:[(0,L.jsx)(`span`,{className:`mono ${Et}`,children:Tc(t.primary)}),(0,L.jsx)(`span`,{className:`flex-1`,children:bc(t.binding.id)}),t.aliases.length>0&&(0,L.jsx)(`span`,{className:`text-muted`,children:`(${t.aliases.map(Tc).join(`, `)})`})]},`${e.kind}-${t.binding.id}`))]},`${e.kind}-${e.scope??t}`))})]})})}function kc(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 Ac(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 jc=e=>e===`routine_failed`,Mc=e=>`${e.taskId??``}:${e.tabId??``}`;function Nc(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)||Mc(e).localeCompare(Mc(t)))}function Pc(e,t,n){let r=new Set(t),i=Nc(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=>Mc(e)===Mc(n));return a<0||i.length===1?i[0]??null:i[(a+1)%i.length]??null}function Fc(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 Ic(e,t,n=!1){let r=`attention.dismiss`,i;if(jc(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=>H(String(e),`error`))}function Lc(e,t){Ic(e,t),Pn(),yn.set(t.automationId??null),V.set(`routines`)}var Rc=524288e3,zc=1048576;function Bc(e,t){return/\.pdf$/i.test(e)?`pdf[${t}]`:/\.(png|jpe?g|gif|webp)$/i.test(e)?`images[${t}]`:`files[${t}]`}function Vc(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 Hc(e,t){let n=e.replace(/\s+$/,``),r=Vc(e);for(let e of t){let t=`${Bc(e,r)}: ${e}`;n=n.length>0?`${n}\n${t}`:t,r+=1}return n}function Uc(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 Wc(e,t){if(t.size>524288e3)throw Error(F(`pages.attachTooLarge`,{name:t.name}));let n={mime:t.type,name:t.name},r=async(e,n)=>Uc(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+zc,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 Gc(e,t){return(await Wc(e,t)).path}function Kc(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 qc=`size-14 rounded-sm border-hairline border-line object-cover`;function Jc({name:e,thumb:t}){if(t)return(0,L.jsx)(`img`,{src:t,alt:``,draggable:!1,className:qc});let n=e.includes(`.`)?e.split(`.`).pop()??``:``;return(0,L.jsx)(`span`,{className:`${qc} flex items-center justify-center font-mono text-meta uppercase text-muted`,children:n.slice(0,4)||`file`})}function Yc({item:e,onRemove:t}){let[n]=(0,h.useState)(e.pending);return(0,L.jsxs)(`li`,{className:`group relative size-14 shrink-0 ${n?`motion-safe:animate-rise-in`:``}`,title:`${e.name} · ${Kc(e.size)}`,children:[(0,L.jsx)(`div`,{className:`transition-opacity duration-150 motion-reduce:transition-none ${e.pending?`opacity-50`:``}`,children:(0,L.jsx)(Jc,{...e})}),(0,L.jsx)(`button`,{type:`button`,"aria-label":F(`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 Xc({items:e,onRemove:t}){return e.length===0?null:(0,L.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,L.jsx)(Yc,{item:e,onRemove:t},e.id))})}function Zc(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 Qc(e){return(0,L.jsxs)(`label`,{className:e.className,title:e.title,children:[e.children,(0,L.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 $c={image:`images`,pdf:`pdf`};function el(e,t){let n=t.filter(e=>e.path!==void 0);return n.length===0?e:`${e}\n\n${n.map((e,t)=>`${$c[e.kind??`image`]??`files`}[${t}]: ${e.path}`).join(`
16
+ 这个 worktree 在该 PR 的头部({head},合入 {base})。对照 {base} 阅读改动(git diff origin/{base}...HEAD),然后告诉我你的发现:bug、风险、缺失的测试、不清楚的地方。不要推送、评论或批准这个 PR;在这里汇报。`}},ue=n({en:()=>de,zh:()=>fe}),de={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`}},fe={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} 条`}},pe=n({en:()=>me,zh:()=>he}),me={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`,refresh:`Refresh`,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:`{protocol}, ssh {ssh}`,synced:`{machine} now uses @{login}`},general:{groupInterface:`Interface`,groupFiles:`Files and worktrees`,groupTerminal:`Terminal`,editorNote:`Opens files from the file tree. auto follows $VISUAL / $EDITOR, else nvim / vim / emacs / nano.`,tabStrip:`Tab strip`,scrollback:`Scrollback`},appearance:{groupColours:`Colours`,groupTasks:`Tasks and panes`,groupTerminal:`Terminal app only`,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`,statusMarkNote:`Engine icon: its colour is the state. Dots: the icon keeps its own colours and a dot mark at the row's end is the state.`,statusMarkEngine:`Engine icon`,statusMarkDots:`Dots`,previewWorking:`Working`,previewDone:`Finished, unread`,previewIdle:`Idle`,previewWaiting:`Waiting for you`,previewBroken:`Broken`},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:{terminalOnly:`Terminal only: the TUI changes, this page has nothing to draw.`,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`}},he={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:`本机`,refresh:`刷新`,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:`{protocol}, ssh {ssh}`,synced:`{machine} 现在使用 @{login}`},general:{groupInterface:`界面`,groupFiles:`文件与 worktree`,groupTerminal:`终端`,editorNote:`从文件树打开文件时用它。auto 跟随 $VISUAL / $EDITOR,否则依次尝试 nvim / vim / emacs / nano。`,tabStrip:`标签栏`,scrollback:`回滚行数`},appearance:{groupColours:`颜色`,groupTasks:`任务与面板`,groupTerminal:`仅终端应用`,taskColorsNote:`让每个任务在工作边框和列表里有自己的色调。`,colorblindNote:`新增和删除的行用蓝色和红色,而不是绿色和红色。`,workingBorderNote:`所选任务工作时,面板边框的样子。`,railGroup:`任务列表`,railGroupProject:`按项目`,railGroupState:`按状态`,statusMark:`任务状态`,statusMarkNote:`引擎图标:图标的颜色表示状态。点阵:图标保持自己的颜色,由行尾的点阵表示状态。`,statusMarkEngine:`引擎图标`,statusMarkDots:`点阵`,previewWorking:`正在跑`,previewDone:`完成未读`,previewIdle:`空闲`,previewWaiting:`等你回答`,previewBroken:`出错`},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:{terminalOnly:`仅终端:TUI 会变化,网页没有可画的东西。`,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:`粘贴路径 / 截图 → 插入图片占位行`}},ge=n({en:()=>_e,zh:()=>ve}),_e={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`}},ve={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:`终端末尾`}},ye=n({en:()=>be,zh:()=>xe}),be={usage:{title:`Usage`,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:`{engine} {label} {percent}% · at this pace full around {time}, before it resets`,lasts:`{engine} {label} {percent}% · at this pace it lasts until the reset`,window:`{engine} {label} {percent}%`}},xe={usage:{title:`用量`,open:`打开用量`,range:`最近 {days} 天 · token 为输入加输出`,perDay:`按天`,byModel:`按引擎和模型`,topTasks:`用量最高的任务`,quota:`额度`,turns:`{count} 轮`,loading:`加载中…`,empty:`这段时间没有记录到任何一轮。`,failed:`无法读取用量:{error}`,cutoff:`守护进程最多返回 {count} 轮:{day} 及更早的数据不完整。`,noReader:`{engines}:没有轮次读取器,这里不统计它们的工作。`,removedTask:`(已删除的任务)`,full:`{engine} {label} {percent}% · 按当前速度约 {time} 用完,早于重置时间`,lasts:`{engine} {label} {percent}% · 按当前速度可撑到重置`,window:`{engine} {label} {percent}%`}},Se=n({en:()=>Ce,zh:()=>we}),Ce={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`,type:`Type instead`,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?`}}},we={voice:{say:`说`,stop:`停 {time}`,release:`松手 {time}`,working:`在听…`,hint:`口述:点一下开始、再点一下结束,或按住说话、松手结束`,slideToSend:`上滑发送`,tipSend:`松手发送`,hold:`按住说话`,type:`打字`,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:`删除这个服务地址和密钥?`}}},Te=n({en:()=>Ee,zh:()=>De}),Ee={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`},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`}},De={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:`忽略`},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:`终端`}},Oe=[ae,Te,D,ne,pe,x,M,ue,ye,ge,ee,v,ce,w,Se],ke=Object.assign({},...Oe.map(e=>e.en)),Ae={en:ke,zh:Object.assign({},...Oe.map(e=>e.zh))};function je(){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 Me=g(je());function Ne(){let e=typeof document>`u`?void 0:document.documentElement;e&&(e.lang=Me.get()===`zh`?`zh-CN`:`en`)}Ne(),Me.subscribe(Ne);function Pe(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 Fe(e,t){return t?e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e)):e}function F(e,t){return Fe(Pe(Ae[Me.get()],e)??Pe(ke,e)??e,t)}function Ie(e,t,n){return Fe(Pe(e[Me.get()],t)??Pe(e.en,t)??t,n)}function I(){return _(Me)}function Le(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 Re=(...e)=>e.filter(Boolean).join(` `),ze=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})),L=t(((e,t)=>{t.exports=ze()}))(),Be=({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`,Ve={link:`text-accent hover:underline`,filled:Be(),danger:Be({danger:!0}),action:`rounded-sm border-hairline border-line px-3 py-1.25 font-sans text-meta text-ink hover:border-line-active hover:bg-hover 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`,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`},He={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 R({variant:e=`link`,hit:t=e===`link`?`roomy`:`none`,className:n,type:r=`button`,...i}){return(0,L.jsx)(`button`,{type:r,className:Re(Ve[e],He[t],n),...i})}var Ue=`text-meta leading-[inherit]`,We=`font-normal normal-nums`,Ge=`touch:relative touch:after:absolute touch:after:content-['']`,Ke=`flex h-full flex-col`,qe=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(` `),Je=[`relative narrow-content:hidden 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(` `),Ye=`rail-folded:col-2 panel-expanded:invisible panel-expanded:col-2 narrow-sidebar:hidden`,Xe=`rail-folded:col-3 panel-expanded:z-2 panel-expanded:col-[2/-1] panel-expanded:bg-paper panel-expanded:pl-2`,Ze=`${Ge} touch:after:-inset-x-1.5 touch:after:-inset-y-3`,Qe=`flex items-center gap-2`,$e=`px-1.5 py-0.5 text-meta font-bold ${Ge} touch:after:-inset-2.5 touch:after:-bottom-1`,et=`flex items-center rounded-sm px-2.5 py-1.5 text-muted aria-selected:bg-inset aria-selected:text-ink [&_svg]:size-4 ${Ge} touch:after:-inset-x-px touch:after:-top-2 touch:after:-bottom-1.5`,tt=`keys-only m-0 overflow-hidden px-3.5 py-1 text-meta text-ellipsis whitespace-nowrap`,nt=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`}`,rt=`relative min-w-0 flex-1`,it={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)]`]},at=(e,t)=>it[e][+!!t],ot=(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?at(`left`,t.active):``} ${t.top?at(`top`,t.active):``} ${t.left||t.top?r:``}`:e===`rail`?`${n} ${at(`left`,t.active)} ${r} ${t.top?`[--mt:6px]`:``}`:e===`rule`?`${n} ${at(`top`,t.active)} ${r} ${t.left?`[--ml:8px]`:``}`:n},st=(e,t)=>`absolute right-2 z-3 bg-paper px-1 font-mono text-meta ${We} ${e?`-top-2`:`top-0.5`} ${t?`text-accent`:`text-subtle`}`,ct=`hidden gap-1 overflow-x-auto scrollbar-none [border-top:var(--hairline)_solid_var(--line)] bg-surface px-1.5 py-1 touch:flex`,lt=e=>`h-8 min-w-max touch-manipulation [flex:1_1_0] rounded-sm border-hairline bg-inset px-0.5 py-0 font-mono text-meta ${We} ${e?`border-accent text-accent`:`border-line text-ink`}`,ut=`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`,dt=`min-w-[3ch] text-accent`,ft=`mb-1.5 flex justify-between gap-4`,pt=`columns-[2_220px] gap-x-5`,mt=`mb-2 break-inside-avoid`,ht=`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`,gt=`mx-0 my-2 overflow-x-hidden overflow-y-auto scrollbar-none`,_t=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 ${We} whitespace-pre text-ink touch:py-2.5 ${e?`is-selected bg-hover`:``}`,vt=`min-w-0 overflow-hidden text-ellipsis`,yt=`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`,bt=`flex justify-between gap-4`,xt=`flex flex-col items-end ${Ue}`,St=`mt-2 max-h-[52vh] overflow-y-auto`,Ct=`mb-2.5`,wt=`m-0 mb-1 font-sans text-meta font-bold normal-nums text-accent`,Tt=`flex gap-3 py-px ${Ue}`,Et=`min-w-[14ch] text-ink`,Dt=`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`,Ot=`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 ${We} text-ink shadow-popover`,kt=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]`}`,At=`m-auto font-mono text-meta ${We} text-subtle`,jt=`${At} flex flex-col items-center gap-3 [&_p]:m-0`,Mt=`workspace row-1 flex min-h-0 min-w-0 flex-col gap-1.5 px-1 pt-2 pb-1`,Nt=`flex min-h-0 flex-1 overflow-hidden rounded-md border-hairline border-line bg-paper focus-within:border-focus`,Pt=`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`,Ft=`relative flex min-w-0 flex-1 flex-col`,It=`relative flex min-h-0 min-w-0 flex-1 flex-col`,Lt=`term-host relative min-h-0 min-w-0 flex-1 touch-none overflow-hidden`,Rt=`pointer-events-none absolute inset-0 z-5 h-full w-full`,zt=`relative h-full [&.is-leaving]:pointer-events-none [&.is-leaving]:absolute [&.is-leaving]:inset-0 [&.is-leaving]:z-6`,Bt=`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)]`,Vt=e=>`absolute right-2.5 bottom-2.5 z-5 flex items-center gap-3 rounded-sm border-hairline border-line bg-inset px-2.5 py-1.25 font-mono text-meta ${We} ${e?`text-error`:`text-muted`} [&_.link:disabled]:pointer-events-none [&_.link:disabled]:opacity-60`,Ht=`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 ${We} whitespace-nowrap text-muted`,Ut=e=>`size-1.5 rounded-full ${e?`bg-warning`:`bg-subtle`}`,Wt=`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`,Gt=`col-span-3 grid cursor-pointer grid-cols-subgrid items-center text-left hover:text-ink`,Kt={ok:`text-muted`,warn:`text-warning`,crit:`text-error`},qt={ok:`text-success`,warn:`text-warning`,crit:`text-error`},Jt=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-[''] ${qt[e]??qt.ok}`,Yt=`font-mono text-title font-bold normal-nums tracking-[0.02em] whitespace-nowrap`,Xt=`text-accent`,Zt=`grid h-full place-items-center p-6`,Qt=`flex w-[min(460px,100%)] flex-col gap-3 rounded-md border-hairline border-line bg-surface p-6 [&_p]:m-0`,$t=`flex flex-col gap-2 p-3.5 text-left font-sans text-meta ${We} leading-[1.5]`,en=`mx-2.5 my-3 font-mono text-meta text-subtle`,tn=`font-sans text-meta text-subtle`,nn=`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`,rn=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`:``}`,an=`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`,on=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`}`,z=`m-0 font-sans text-meta font-medium normal-nums`,sn=`link text-accent [&:hover]:underline touch-hit`,cn=`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`,ln=`${cn} w-full px-2.5 py-2`,un=`actions flex items-center justify-end gap-3.5`;function dn({failing:e=!1}){I();let[t,n]=(0,h.useState)(``),[r,i]=(0,h.useState)(!1);return(0,L.jsx)(`div`,{className:Zt,children:(0,L.jsxs)(`form`,{className:Qt,onSubmit:e=>{e.preventDefault();let n=Le(t);if(!n){i(!0);return}a(n),window.location.reload()},children:[(0,L.jsxs)(`span`,{className:Yt,children:[(0,L.jsx)(`span`,{className:Xt,children:`[`}),` rove `,(0,L.jsx)(`span`,{className:Xt,children:`]`})]}),(0,L.jsx)(`h1`,{className:`${z} text-muted`,children:F(`connect.title`)}),(0,L.jsx)(`p`,{className:e?`text-error`:`text-muted`,children:F(e?`connect.failing`:`connect.body`)}),(0,L.jsx)(`input`,{className:ln,autoFocus:!0,spellCheck:!1,placeholder:F(`connect.placeholder`),value:t,onChange:e=>{n(e.target.value),i(!1)}}),r&&(0,L.jsx)(`p`,{className:`text-error`,children:F(`connect.invalid`)}),(0,L.jsxs)(`div`,{className:un,children:[e&&(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>{o(),window.location.reload()},children:F(`connect.forget`)}),(0,L.jsx)(`button`,{type:`submit`,className:Be(),children:F(`connect.submit`)})]})]})})}function fn(e,t){let n=e.filter(e=>e.rare&&!e.children);if(n.length===0)return[...e];let r=e.filter(e=>!n.includes(e)),i={label:t,section:`more`,children:n.map(({section:e,...t})=>t)},a=r.findIndex(e=>e.section===`danger`);return a<0?[...r,i]:[...r.slice(0,a),i,...r.slice(a)]}function pn(e,t){for(let n of e){if(n.binding===t)return n;let e=n.children&&pn(n.children,t);if(e)return e}}var mn=g(null),B=g(null),hn=null;B.subscribe(()=>{let e=document.activeElement;if(B.get()!==null){!hn&&e instanceof HTMLElement&&!e.closest(`.dialog`)&&(hn=e);return}let t=hn;hn=null,window.setTimeout(()=>{t?.isConnected&&(!document.activeElement||document.activeElement===document.body)&&t.focus()},0)});var gn=g([]),_n=[`worktrees`,`update`,`kanban`,`routines`,`issues`,`mods`,`compare`,`usage`];function vn(e,t){let n=null;try{n=t(JSON.parse(sessionStorage.getItem(e)??`null`))}catch{}let r=g(n);return r.subscribe(()=>{try{let t=r.get();t===null?sessionStorage.removeItem(e):sessionStorage.setItem(e,JSON.stringify(t))}catch{}}),r}var V=vn(`rove.web.page`,e=>_n.find(t=>t===e)??null),yn=g(null),bn=vn(`rove.web.compareGroup`,e=>typeof e==`string`?e:null),xn=g(null),Sn=g(!0),Cn=`rove.web.newSession`;function wn(){try{let e=JSON.parse(sessionStorage.getItem(Cn)??`null`);return e&&typeof e==`object`?e:null}catch{return null}}var Tn=g(wn());Tn.subscribe(()=>{try{let e=Tn.get();if(!e)return sessionStorage.removeItem(Cn);let{prompt:t,...n}=e;sessionStorage.setItem(Cn,JSON.stringify(n))}catch{}});function En(e,t,n,r,i){Dn({...e?{repo:e}:{},...t?{baseBranch:t}:{},...n?{machine:n}:{},...r?{prompt:r}:{},...i?{ungrouped:!0}:{}})}function Dn(e){V.set(null),B.set(null),Tn.set(e)}function On(){let e=new URLSearchParams(window.location.search),t=e.get(`prompt`);if(t===null)return;let n=e.get(`repo`)??void 0;e.delete(`prompt`),e.delete(`repo`);let r=e.toString();history.replaceState(null,``,`${window.location.pathname}${r?`?${r}`:``}${window.location.hash}`),En(n,void 0,void 0,t)}var kn=1,An=4e3,jn=8e3;function H(e,t=`info`,n){let r=kn++;gn.set([...gn.get(),{id:r,text:e,tone:t,...n?{action:n}:{}}].slice(-3)),window.setTimeout(()=>Nn(r),n?jn:An)}function Mn(){return typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches}function Nn(e){if(!gn.get().some(t=>t.id===e&&!t.leaving))return;let t=()=>gn.set(gn.get().filter(t=>t.id!==e));if(Mn()){t();return}gn.set(gn.get().map(t=>t.id===e?{...t,leaving:!0}:t)),window.setTimeout(t,140)}function Pn(){B.set(null)}var Fn=g(null),In=null;function Ln(){Fn.get()!==`drag`&&(In!==null&&window.clearTimeout(In),Fn.set(`slide`),In=window.setTimeout(()=>Fn.set(null),240))}function Rn(e){In!==null&&window.clearTimeout(In),In=null,Fn.set(e?`drag`:null)}var zn=`flex flex-col gap-1.5`,Bn=`min-h-18 max-h-[50vh] leading-[1.45]`,Vn=`flex flex-wrap gap-1.5`,Hn=(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`}`}`,Un=`m-0 list-none p-0`,Wn=`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`,Gn=(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`,Kn=`flex items-center justify-between gap-3`,qn=`m-0 min-w-0 font-sans text-title leading-[1.4] font-semibold normal-nums text-ink wrap-anywhere`,Jn=`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-['']`,Yn=`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`,Xn=(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`,Zn=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`:``}`,Qn=`font-mono text-meta normal-nums`,$n=e=>`${Qn} ${e.danger&&e.selected?`text-inherit`:e.selected?`text-muted`:`text-subtle`} touch:hidden!`,er=e=>`${Qn} ${e?`text-ink`:`text-subtle`}`,tr=`${Qn} text-accent`,nr=`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`,rr=`flex cursor-default flex-wrap items-baseline justify-between gap-x-3`,ir=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`,ar=`text-subtle`,or=`flex items-baseline justify-between gap-3`,sr=`mt-1`,cr=`m-0 flex list-none flex-col gap-0.5 p-0`,lr=`flex min-w-0 items-baseline gap-2.5`,ur=`flex-none font-mono text-meta font-normal normal-nums min-w-[3ch] text-right text-subtle`,dr=`flex items-baseline gap-1`,fr=`min-w-0 flex-1`,pr=`flex-none min-w-[calc(9ch+0.5rem)] whitespace-nowrap pr-2 text-right font-mono text-meta`,mr=`font-mono [&:hover]:text-accent`,hr={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`},gr=`bg-hover cursor-grabbing scale-[1.02] motion-reduce:scale-none`,_r=`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 vr(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?gr: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 ${_r}`:``} ${t} ${hr[e.size??`row`]} ${n}`}var yr=`row-title min-w-0 flex-1 truncate`,br=`row-title min-w-0 flex-auto truncate text-(length:--fs-title)`,xr=`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`,Sr=`w-[1ch] flex-none text-center font-mono`,Cr=`grid w-[2ch] flex-none place-items-center font-mono text-subtle`,wr=`flex flex-none gap-1.5 font-mono text-meta`;function U(e){return e instanceof Error?e.message:String(e)}function Tr(e){I();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(),Pn())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,L.jsx)(`div`,{className:Wn,onMouseDown:e=>e.target===e.currentTarget&&Pn(),children:(0,L.jsxs)(`dialog`,{ref:t,tabIndex:-1,open:!0,className:Gn(e.wide),"aria-label":e.title,children:[(0,L.jsxs)(`div`,{className:Kn,children:[(0,L.jsx)(`h1`,{className:qn,children:e.title}),(0,L.jsx)(`button`,{type:`button`,className:Jn,"aria-label":F(`dialog.close`),title:F(`dialog.close`),onClick:Pn,children:`×`})]}),e.children]})})}function Er(){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(),Pn()}catch(e){r(U(e))}finally{t(!1)}}}}function Dr(e){let[t,n]=(0,h.useState)(e.initial??``),{busy:r,error:i,submit:a}=Er();return(0,L.jsx)(Tr,{title:e.title,children:(0,L.jsxs)(`form`,{className:Yn,onSubmit:n=>{n.preventDefault(),(t.trim()||e.allowEmpty)&&a(()=>e.onSubmit(t.trim()))},children:[e.multiline?(0,L.jsx)(`textarea`,{className:`${ln} ${Bn}`,"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,L.jsx)(`input`,{className:ln,"aria-label":e.title,autoFocus:!0,spellCheck:!1,value:t,onChange:e=>n(e.target.value),onFocus:e=>e.currentTarget.select()}),i&&(0,L.jsx)(`p`,{className:`text-error`,children:i}),(0,L.jsx)(Ar,{busy:r,submitLabel:e.submitLabel})]})})}function Or(e){let{busy:t,error:n,setError:r,submit:i}=Er(),[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(U(n))),n}});return(0,L.jsx)(Tr,{title:a&&e.escalate?.title||e.title,children:(0,L.jsxs)(`div`,{className:Yn,children:[(0,L.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,L.jsx)(`p`,{className:`text-error`,children:n}),(0,L.jsxs)(`div`,{className:un,children:[(0,L.jsx)(`button`,{type:`button`,className:sn,onClick:Pn,children:F(`dialog.cancel`)}),e.secondary&&!a&&(0,L.jsx)(`button`,{type:`button`,className:Be({danger:!0}),disabled:t,onClick:()=>f(!0),children:e.secondary.label}),(0,L.jsx)(`button`,{ref:d,type:`button`,className:Be({danger:!0}),disabled:t,onClick:()=>f(!1),children:a&&e.escalate?e.escalate.label:e.confirmLabel})]})]})})}function kr(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}=Er(),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,L.jsx)(Tr,{title:e.title,children:(0,L.jsxs)(`div`,{className:Yn,children:[(0,L.jsx)(`ul`,{className:Un,children:e.choices.map((t,a)=>(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{type:`button`,"aria-pressed":t.value===e.current,disabled:i,className:vr({selected:a===n}),onMouseEnter:()=>r(a),onClick:()=>s(t.value),children:[(0,L.jsx)(`span`,{className:`${Sr} text-accent`,children:t.value===e.current?`●`:` `}),(0,L.jsx)(`span`,{className:yr,children:t.label})]})},t.value))}),a&&(0,L.jsx)(`p`,{className:`text-error`,children:a})]})})}function Ar({busy:e,submitLabel:t}){return(0,L.jsxs)(`div`,{className:un,children:[(0,L.jsx)(`button`,{type:`button`,className:sn,onClick:Pn,children:F(`dialog.cancel`)}),(0,L.jsx)(`button`,{type:`submit`,className:Be(),disabled:e,children:t})]})}function jr(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 Mr={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`}},Nr={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:`提交`}},Pr={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"}},Fr={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"}},Ir={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."}},Lr={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`,然后重试。"}},Rr={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`}},zr={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} 在这台机器上不可用——去 设置 → 自动路由 重新指定`}},Br={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`},Vr={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} 里已有补全配置 — 未改动`},Hr={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`},Ur={title:`快速任务 · {repoLabel}`,promptLabel:`提示词`,promptPlaceholder:`这个任务要做什么?`,attemptsLabel:`尝试次数`,engineLabel:`引擎`,branchLabel:`分支`,legend:`enter 创建 · tab 切换字段 · ctrl+e 引擎 · ctrl+v 附件 · esc 取消`,startedRound:`已启动 {count} 个尝试`,roundPartial:`已启动 {ok}/{count} 个尝试 —— {failed} 个失败`},Wr={cancel:`cancel`,forgetProjectTitle:`Remove project "{title}"?`,forgetProjectBody:"Forgets it from the projects list. 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`},Gr={cancel:`取消`,forgetProjectTitle:`从列表中移除项目「{title}」?`,forgetProjectBody:"只是把它从项目列表里忘掉。仓库、分支、worktree 以及它下面的任务都会留在磁盘上——之后可以用 `rove add` 重新加回来。",forgetProjectConfirm:`移除`,deleteTitle:`移除会话「{title}」?`,deleteTitleDir:`移除会话「{title}」?`,deleteBodyDir:`结束这个会话,关闭它的所有标签页。磁盘上什么都不动:文件夹和里面的文件都会保留。`,deleteBodyMain:`结束这个会话,关闭它的所有标签页。项目仍留在列表里,磁盘上什么都不动:仓库、分支和 worktree 都会保留。`,deleteBodyTask:`结束这个会话,关闭它的所有标签页,并删除它的 worktree 文件夹。git 分支会保留。`,deleteBodyTaskBranch:`结束这个会话,关闭它的所有标签页,删除它的 worktree 文件夹,以及已合并的 git 分支。未合并的分支会保留。`,deleteConfirm:`移除`,childrenTitle:`「{title}」有 {count} 个子任务`,childrenBody:`提升会把它们上移一级,并保留它们的 worktree 和会话。连同子任务移除会把它们一并移除。`,childrenPromote:`提升子任务`,childrenCascade:`连同子任务移除`,childrenBodyMain:`结束这个会话并关闭它的标签页,磁盘上什么都不动。它的子任务会继续运行,除非你也选择把它们一并删除。`,childrenKeepMain:`移除会话`,childrenCascadeMain:`连同子任务移除`,forceDeleteTitle:`「{title}」有未提交的改动`,forceDeleteConfirm:`强制移除`},Kr={noDaemonWorktree:"No daemon running — can't create the worktree. Start it with `rove daemon restart`.",noEditor:`No editor found — set ROVE_OPEN_EDITOR (e.g. 'code', 'cursor', 'nvim')`,openWorktreeFailed:`Couldn't open worktree with {label}`,worktreeErrorDeleting:`This task is being deleted — it can't be opened`,worktreeErrorNotGit:"This project isn't a git repo yet — a task needs a git branch. Run `git init` (+ a first commit) in the project, then open the task. Non-git support is coming.",worktreeErrorGeneric:`Couldn't create the worktree: {message}`,scratchAdopted:`Adopted into {repo} — save it as a project from New Task if you want it in the picker`,scratchOpenFailed:`Couldn't open a scratch shell: {message}`,scratchCloseFailed:`Couldn't close the scratch task: {message}`,worktreeGoneTitle:`Worktree for "{title}" is gone`,worktreeGoneBody:`Closed {count} tab(s). The branch {branch} is still there — reopen the task to re-create its worktree.`,checksPassingTitle:`Checks passed for "{title}"`,checksFailingTitle:`Checks failed for "{title}"`,checksResolvedBody:`PR {pr} on {branch}`,copiedId:`Copied task ID {text}`,copiedTab:`Copied tab address {text}`,copiedBranch:`Copied branch {text}`,copiedPath:`Copied path {text}`,copyFailed:`Couldn't reach a clipboard — no clipboard command on PATH, and this terminal refused OSC 52.`,forgetProjectFailed:`Couldn't remove the project — it stays in the projects list: {error}`,deleteFailed:`Couldn't delete "{title}" — the task and its worktree are untouched: {error}`,createFailed:`Couldn't create the task — nothing was created: {error}`,engineStartFailed:`Task created; engine did not start`,engineStartRetry:`{error}. Press ⏎ on the task to retry.`,forkFailed:`Couldn't fork the task — the original is untouched: {error}`,forkLeftBehind:`Started from the last commit — uncommitted work stays in the original task ({reason})`,childFailed:`Couldn't start the new conversation — the current one is untouched: {error}`,renameFailed:`Couldn't rename the task — it keeps its old title: {error}`,renameBranchFailed:`Couldn't rename the branch — it stays "{branch}": {error}`,switchEngineFailed:`Couldn't switch the engine — the task keeps the one it had: {error}`,setStatusFailed:`Couldn't set the status — it stays {status}: {error}`,pinFailed:`Couldn't change the pin — the task keeps its current place: {error}`,moveFailed:`Couldn't move the task — it keeps its current place: {error}`,moveToProjectFailed:`Couldn't move the task to that project — it stays where it was: {error}`,movedToProject:`Moved to {project} — the session and its checkout stay where they are`,issueChatFailed:`Couldn't start the issue chat — the issue is unchanged: {error}`,inboxMarkReadFailed:`Couldn't mark it read — it stays in the inbox: {error}`,inboxDismissFailed:`Couldn't dismiss it — it stays in the inbox: {error}`,engineSwitched:`Engine → {engine} (applies on reopen)`,statusSet:`Status → {status}`},qr={noDaemonWorktree:"守护进程未运行——无法创建 worktree。请运行 `rove daemon restart` 启动它。",noEditor:`未找到编辑器——请设置 ROVE_OPEN_EDITOR(如 'code'、'cursor'、'nvim')`,openWorktreeFailed:`无法用 {label} 打开 worktree`,worktreeErrorDeleting:`该任务正在删除中——无法打开`,worktreeErrorNotGit:"该项目尚非 git 仓库——任务需要 git 分支。请在项目中执行 `git init`(+ 首次提交)后再打开任务。非 git 项目的支持即将推出。",worktreeErrorGeneric:`无法创建 worktree:{message}`,scratchAdopted:`已归入 {repo}——若要出现在项目选择器里,可在新建任务中保存为项目`,scratchOpenFailed:`无法打开临时 Shell:{message}`,scratchCloseFailed:`无法关闭临时任务:{message}`,worktreeGoneTitle:`"{title}" 的 worktree 已消失`,worktreeGoneBody:`已关闭 {count} 个标签页。分支 {branch} 仍在——重新打开该任务会重建 worktree。`,checksPassingTitle:`「{title}」的 PR 检查已通过`,checksFailingTitle:`「{title}」的 PR 检查失败了`,checksResolvedBody:`PR {pr},分支 {branch}`,copiedId:`已复制任务 ID {text}`,copiedTab:`已复制标签页地址 {text}`,copiedBranch:`已复制分支 {text}`,copiedPath:`已复制路径 {text}`,copyFailed:`无法访问剪贴板——PATH 上没有剪贴板命令,这个终端也拒绝了 OSC 52。`,forgetProjectFailed:`移除项目失败——它仍在项目列表里:{error}`,deleteFailed:`删除「{title}」失败——任务和它的 worktree 都没有被改动:{error}`,createFailed:`创建任务失败——什么都没有被创建:{error}`,engineStartFailed:`任务已创建,引擎没有启动`,engineStartRetry:`{error}。在任务上按 ⏎ 重试。`,forkFailed:`fork 任务失败——原任务没有被改动:{error}`,forkLeftBehind:`已从最近一次提交开始——未提交的改动留在原任务里({reason})`,childFailed:`无法开始新对话——当前对话没有被改动:{error}`,renameFailed:`重命名任务失败——它仍用原来的标题:{error}`,renameBranchFailed:`重命名分支失败——它仍是「{branch}」:{error}`,switchEngineFailed:`切换引擎失败——任务仍使用原来的引擎:{error}`,setStatusFailed:`设置状态失败——它仍是 {status}:{error}`,pinFailed:`修改置顶状态失败——任务仍在原来的位置:{error}`,moveFailed:`移动任务失败——它仍在原来的位置:{error}`,moveToProjectFailed:`移到该项目失败——任务仍在原来的项目:{error}`,movedToProject:`已移到 {project}——会话和它的工作目录都没有动`,issueChatFailed:`启动议题会话失败——议题没有被改动:{error}`,inboxMarkReadFailed:`标记为已读失败——它仍留在收件箱里:{error}`,inboxDismissFailed:`忽略失败——它仍留在收件箱里:{error}`,engineSwitched:`引擎 → {engine}(重新打开后生效)`,statusSet:`状态 → {status}`},Jr={nav:{kanban:`Kanban`,automations:`Routines`,issues:`Issues`,mods:`Mods`},header:{scratch:`Ungrouped`},search:{placeholder:`fuzzy filter`},sort:{label:`sort: {mode}`,hint:`Change the order (manual → newest → attention → name)`,reorderSwitched:`Reorder needs manual order — switched`,modes:{default:`manual`,recent:`newest`,attention:`attention`,name:`name`}},menu:{open:`Open`,collapseChildren:`Collapse children`,expandChildren:`Expand children`,newChat:`New conversation`,newShell:`New shell`,continueEngine:`Continue in another engine…`,newScratchChat:`New conversation (no folder)`,newTask:`New task`,newTaskFromBranch:`New task from this branch`,forgetProject:`Remove project`,fieldNotes:`Field notes`,rename:`Rename`,pin:`Pin`,unpin:`Unpin`,reorder:`Reorder row`,moveToTop:`Move to top`,reorderProject:`Reorder project`,runAgain:`Run again`,setStatus:`Set status`,moveToProject:`Move to project…`,copyId:`Copy task ID`,copyBranch:`Copy branch name`,copyPath:`Copy path`,openEditor:`Open in editor`,renameBranch:`Rename branch`,changeEngine:`Change engine`,fixChecks:`Fix failing checks`,rerunChecks:`Re-run failed checks`,syncBase:`Sync with base`,resolveConflicts:`Resolve conflicts`,land:`Land into base branch`,archive:`Archive`,unarchive:`Unarchive`,delete:`Remove session`},status:{backlog:`Backlog`,inProgress:`In progress`,inReview:`In review`,done:`Done`,canceled:`Canceled`,error:`Error`},setStatus:{title:`Set status`,current:`current`,footer:`↑↓ choose · enter set · esc cancel`},moveToProject:{title:`Move to project`,empty:"No other project yet — add one first, or run `rove api update --project PATH`",footer:`↑↓ choose · enter move · esc cancel`},sync:{done:`Merged {base} into this worktree`,alreadyCurrent:`Already up to date with {base}`,conflict:`Merge conflict — resolve then commit: {files}`,dirty:`Commit the worktree's changes first, then sync: {files}`,failed:`Sync failed: {error}`},archive:{done:`Archived {title}. Its worktree, branch and sessions are untouched`,restored:`Restored {title}`,busyTitle:`Archive while it's working?`,busyBody:`An engine in {title} is still working or waiting on you. Archiving hides the row without stopping it.`,busyConfirm:`Archive anyway`,failed:`Couldn't archive: {error}`,restoreFailed:`Couldn't restore: {error}`},rerun:{started:`Re-running failed checks`,none:`No failed checks to re-run`,external:`These checks didn't run on GitHub Actions; re-run them where they ran`,refused:`Re-run refused: {detail}`},changeEngine:{title:`Change engine`,current:`current`,effortLabel:`EFFORT`,noEffort:`engine default`,footer:{engine:`↑↓ engine`,effort:`←→ effort`,model:`tab model`,set:`enter set`,cancel:`esc cancel`}},engineModel:{label:`MODEL`,placeholder:`engine default`,loading:`listing models…`},tier:{swift:`swift`,standard:`standard`,deep:`deep`,manual:`manual`},tierDesc:{swift:`small, well-specified edits — the fastest, cheapest setting`,standard:`everyday feature work and bug fixes`,deep:`hard problems: unclear root causes, large refactors, design decisions`},runAgain:{title:`Run again`,source:`Brief from “{title}”`,hint:`Runs this brief again in a new task, on its own branch and worktree.`,confirm:`Run again`,footer:`↑↓ scroll · ←→ choose · enter run · esc cancel`},fieldNotes:{title:`Field notes`,empty:"No field notes for this repo yet — agents file one with `rove api note`.",loading:`Loading…`,footer:`↑↓ scroll · esc close`,footerDeletable:`↑↓ select · d delete · esc close`,confirmDelete:{title:`Delete this field note?`,body:`“{text}” stops being injected into new sessions on this repo. Nothing else changes.`}},confirm:Wr,renameBranch:{title:`Rename branch`,fieldLabel:`branch`},moveChip:` move`,recentJump:`Recent: {title}`,archivedHit:`{title} · archived, enter unarchives`,machine:{connecting:`connecting…`,offline:`offline`,unsupported:`unsupported`,mismatch:`protocol mismatch`,filesElsewhere:`on {host}`,filesHint:`{host} is unreachable right now; its files show here again when it reconnects.`,terminalElsewhere:`This task runs on {host}, which is unreachable right now.`,runsOn:`on {host}`,noTabs:`No tabs on {host} yet — prefix t opens one there.`},empty:{noMatchSearch:`No matching tasks — esc to clear.`,noActiveProject:`No active tasks for this project.`,noActive:`No active tasks — create one above.`},activity:{working:`working`,rateLimited:`rate limited`,permissionNeeded:`needs permission`,error:`error`,dead:`engine exited`},group:{waitingOnYou:`needs you`,landing:`ready to land`,readyForReview:`needs review`,working:`working`},subtitle:{noTracking:`no activity tracking`,materializing:`materializing`,deleting:`deleting`,deleteFailed:`delete failed`},reBranch:{title:`Set branch`,fieldLabel:`branch`,hintNoBranches:`(no local branches — type a new name)`,hintNoMatch:`(no match — enter renames to this branch)`,footer:`↑↓ pick · enter set · esc cancel`},toast:Kr},Yr={nav:{kanban:`看板`,automations:`例行任务`,issues:`议题`,mods:`Mods`},header:{scratch:`未分组`},search:{placeholder:`模糊搜索`},sort:{label:`排序:{mode}`,hint:`切换排序(手动 → 最新 → 关注 → 名称)`,reorderSwitched:`调整顺序需手动排序,已切换`,modes:{default:`手动`,recent:`最新`,attention:`关注`,name:`名称`}},menu:{open:`打开`,collapseChildren:`折叠子任务`,expandChildren:`展开子任务`,newChat:`新建会话`,newShell:`新建终端`,continueEngine:`换个引擎继续…`,newScratchChat:`新建会话(无文件夹)`,newTask:`新建任务`,newTaskFromBranch:`基于此分支新建任务`,forgetProject:`移除项目`,fieldNotes:`现场笔记`,rename:`重命名`,pin:`置顶`,unpin:`取消置顶`,reorder:`重新排序`,moveToTop:`移到顶部`,reorderProject:`调整项目顺序`,runAgain:`重新运行`,setStatus:`设置状态`,moveToProject:`移到其他项目…`,copyId:`复制任务 ID`,copyBranch:`复制分支名`,copyPath:`复制路径`,openEditor:`在编辑器中打开`,renameBranch:`重命名分支`,changeEngine:`切换引擎`,fixChecks:`修复失败的检查`,rerunChecks:`重新运行失败的检查`,syncBase:`同步基础分支`,resolveConflicts:`让 agent 解决冲突`,land:`合入基础分支`,archive:`归档`,unarchive:`取消归档`,delete:`移除会话`},status:{backlog:`待办`,inProgress:`进行中`,inReview:`待评审`,done:`已完成`,canceled:`已取消`,error:`出错`},setStatus:{title:`设置状态`,current:`当前`,footer:`↑↓ 选择 · enter 设置 · esc 取消`},moveToProject:{title:`移到其他项目`,empty:"还没有其他项目——先添加一个,或运行 `rove api update --project PATH`",footer:`↑↓ 选择 · enter 移动 · esc 取消`},sync:{done:`已把 {base} 合并进该工作树`,alreadyCurrent:`已经和 {base} 同步`,conflict:`合并冲突——解决后提交:{files}`,dirty:`请先提交工作树里的改动,再同步:{files}`,failed:`同步失败:{error}`},archive:{done:`已归档 {title}。工作树、分支和会话都保持原样`,restored:`已恢复 {title}`,busyTitle:`它还在工作,仍要归档?`,busyBody:`{title} 里有引擎仍在工作或在等你。归档只隐藏这一行,不会停止它。`,busyConfirm:`仍要归档`,failed:`归档失败:{error}`,restoreFailed:`恢复失败:{error}`},rerun:{started:`正在重新运行失败的检查`,none:`没有可重新运行的失败检查`,external:`这些检查不是在 GitHub Actions 上运行的,请到它们运行的地方重新运行`,refused:`无法重新运行:{detail}`},changeEngine:{title:`切换引擎`,current:`当前`,effortLabel:`推理强度`,noEffort:`引擎默认`,footer:{engine:`↑↓ 引擎`,effort:`←→ 强度`,model:`tab 模型`,set:`enter 设置`,cancel:`esc 取消`}},engineModel:{label:`模型`,placeholder:`引擎默认`,loading:`正在列出模型…`},tier:{swift:`轻快`,standard:`标准`,deep:`深入`,manual:`手动`},tierDesc:{swift:`小而明确的改动——最快、最省的一档`,standard:`日常的功能开发和修 bug`,deep:`难题:根因不明、大重构、设计决策`},runAgain:{title:`重新运行`,source:`来自任务「{title}」的指令`,hint:`在新任务里重新执行这段指令,新任务有自己的分支和工作树。`,confirm:`重新运行`,footer:`↑↓ 滚动 · ←→ 选择 · enter 运行 · esc 取消`},confirm:Gr,renameBranch:{title:`重命名分支`,fieldLabel:`分支`},fieldNotes:{title:`现场笔记`,empty:"该仓库暂无现场笔记——agent 可用 `rove api note` 记录。",loading:`加载中…`,footer:`↑↓ 滚动 · esc 关闭`,footerDeletable:`↑↓ 选择 · d 删除 · esc 关闭`,confirmDelete:{title:`删除这条现场笔记?`,body:`「{text}」将不再注入该仓库的新会话。其他内容不受影响。`}},moveChip:` 移动`,recentJump:`最近:{title}`,archivedHit:`{title} · 已归档,回车恢复`,machine:{connecting:`连接中…`,offline:`离线`,unsupported:`不支持`,mismatch:`协议不兼容`,filesElsewhere:`在 {host} 上`,filesHint:`{host} 暂时连不上;重新连上后这里会再显示它的文件。`,terminalElsewhere:`这个任务跑在 {host} 上,暂时连不上。`,runsOn:`在 {host} 上`,noTabs:`{host} 上还没有 tab——按 prefix t 在那里新开一个。`},empty:{noMatchSearch:`无匹配任务——按 esc 清除。`,noActiveProject:`该项目暂无活跃任务。`,noActive:`暂无活跃任务——在上方新建。`},activity:{working:`运行中`,rateLimited:`请求受限`,permissionNeeded:`等待授权`,error:`错误`,dead:`引擎已退出`},group:{waitingOnYou:`等你处理`,landing:`可以合了`,readyForReview:`待你验收`,working:`运行中`},subtitle:{noTracking:`不跟踪活动`,materializing:`正在创建 worktree`,deleting:`正在删除`,deleteFailed:`删除失败`},reBranch:{title:`设置分支`,fieldLabel:`分支`,hintNoBranches:`(没有本地分支——输入新名称)`,hintNoMatch:`(无匹配——回车将分支重命名为此名)`,footer:`↑↓ 选择 · enter 设置 · esc 取消`},toast:qr},Xr={noTask:`(no task — press n to create)`,exited:`process exited — F5 restarts it`,engineExit:{title:`Engine exited`,titleCode:`Engine exited (code {code})`,retry:`Retry`,settings:`Settings → Engines`,another:`Another engine`,continueIn:`Continue in another engine`},usageLimit:{title:`Usage limit reached`,dismiss:`Dismiss`},restoring:`restoring session…`,recovery:{live:`Live process reattached`,relaunched:`Command relaunched in a new process. Any restored output is historical; check the engine to resume or continue your conversation.`,restored:`Historical screen restored; previous process ended. Restart and check the engine before continuing.`},tab:{groupTitle:`group {n}`,renameTitle:`Rename tab`,renameField:`TAB TITLE`,renameSubmit:`rename`,chooseEngineHint:`←/→ or h/l choose, enter confirm, esc cancel`,newChat:{title:`New conversation`,engine:`ENGINE`,destLabel:`DESTINATION`,destTab:`child task, same directory`,destFork:`fork a child task (new worktree)`,destScratch:`new scratch task ($HOME)`,ctxLabel:`CONTEXT`,ctxFresh:`fresh conversation`,ctxContinue:`continue this conversation`},cannotCloseLast:`Cannot close the only tab`,tabGone:`That tab is no longer there`,closeOthersTitle:`Close the other tabs?`,closeOthersBody:`Closing {count} · their sessions end, this tab stays open.`,closeOthersConfirm:`close tabs`,closeOthersCancel:`cancel`,menu:{rename:`Rename tab`,copyAddress:`Copy tab address`,continueEngine:`Continue in another engine…`,closeOthers:`Close other tabs`,close:`Close tab`},nothingToFork:`No conversation in this tab to fork yet`,noTranscriptToHandOff:`{engine} keeps no readable transcript to hand over`},split:{renameTitle:`Rename split`,renameField:`SPLIT NAME`},scrolledBack:`↑ scrolled {lines}L`,scrollFirst:`[first]`,scrollLatest:`[latest]`,unavailable:{shellMissing:`terminal unavailable — the shell named by $SHELL isn't on this machine. Point $SHELL at one that exists, or unset it to fall back to the system default.`,spawnFailed:`terminal unavailable — the shell exited immediately. Its error is in ~/.rove/pty.log.`,retry:`F5 tries again`},reset:{title:`Reset terminal?`,body:`The running shell will be killed and a fresh one will spawn at the worktree. Any in-flight processes (vim, htop, paused jobs) end immediately.`}},Zr={recovery:{live:`已重新连接仍在运行的进程`,relaunched:`命令已在新进程中重启。如有恢复的输出,它属于历史记录;请在引擎内确认会话恢复或继续操作。`,restored:`已恢复历史画面;原进程已结束。请重启并确认引擎状态后继续。`},noTask:`(无任务 —— 按 n 创建)`,exited:`进程已退出 —— 按 F5 重启`,engineExit:{title:`引擎已退出`,titleCode:`引擎已退出(退出码 {code})`,retry:`重试`,settings:`设置 → 引擎`,another:`换个引擎`,continueIn:`换个引擎继续`},usageLimit:{title:`已达到用量上限`,dismiss:`忽略`},restoring:`正在恢复会话…`,tab:{groupTitle:`group {n}`,renameTitle:`重命名标签页`,renameField:`标签页名称`,renameSubmit:`重命名`,chooseEngineHint:`←/→ 或 h/l 选择,enter 确认,esc 取消`,newChat:{title:`新建对话`,engine:`引擎`,destLabel:`落点`,destTab:`子任务,同一目录`,destFork:`fork 子任务(新 worktree)`,destScratch:`新临时任务($HOME)`,ctxLabel:`上下文`,ctxFresh:`全新对话`,ctxContinue:`接着当前对话`},cannotCloseLast:`无法关闭唯一的标签页`,tabGone:`这个标签页已经不在了`,closeOthersTitle:`关闭其他标签页?`,closeOthersBody:`将关闭 {count} 个,它们的会话会结束,只保留这个标签页。`,closeOthersConfirm:`关闭标签页`,closeOthersCancel:`取消`,menu:{rename:`重命名标签页`,copyAddress:`复制标签页地址`,continueEngine:`换个引擎继续…`,closeOthers:`关闭其他标签页`,close:`关闭标签页`},nothingToFork:`这个标签页还没有可派生的对话`,noTranscriptToHandOff:`{engine} 没有可读的对话记录,无法交接`},split:{renameTitle:`重命名分屏`,renameField:`分屏名称`},scrolledBack:`↑ 已回滚 {lines} 行`,scrollFirst:`[最早]`,scrollLatest:`[最新]`,unavailable:{shellMissing:`终端不可用 —— $SHELL 指向的 shell 在这台机器上不存在。请把 $SHELL 指向一个真实存在的 shell,或取消设置以回退到系统默认。`,spawnFailed:`终端不可用 —— shell 启动后立即退出。具体错误见 ~/.rove/pty.log。`,retry:`按 F5 重试`},reset:{title:`重置终端?`,body:`正在运行的 shell 会被杀掉并在 worktree 重新启动,进行中的进程(vim、htop、暂停的任务)会立即结束。`}},Qr={pageTitle:`ROVE UPDATE`,closeHint:`q / esc close`,chip:`↑ {version}`,current:`current`,available:`v{version} available`,latest:`latest`,latestUnknown:`unknown — could not reach the registry`,registryRetry:`Check your connection, then close and reopen Update to retry.`,upToDate:`No newer release — nothing to install.`,releaseUrlUnavailable:`release URL unavailable; visit github.com/Sma1lboy/rove/releases`,statusReleaseOpened:`Opened release page in your browser.`,statusReleaseError:`Could not open release URL. Visit github.com/Sma1lboy/rove/releases in your browser.`,statusRunningUpdater:`Closing the TUI and running the updater in this terminal...`,loadingNotes:`Loading release notes...`,notesUnavailable:`Release notes are unavailable. Use Open release to view the GitHub release page.`,changesSectionHeader:`── changes from v{from} to v{to} ──`,updateComplete:`Rove update complete. Relaunch Rove to use the new version.`,updateFailed:"Rove update failed with exit code {code}. Check the output above, then run `rove update` to retry.",pressAnyKey:`Press any key to close this update window.`,webRunning:`Running {command} …`,webInstalled:"Installed. The daemon and this web bridge still run v{current}: run `rove daemon restart`, then restart `rove --web`. The page reloads itself once the bridge runs the new version.",webStartFailed:`Could not start the updater: {error}`,actions:{updateNow:`Update now`,openRelease:`Open release`,close:`Close`,closeDetail:`return to the workspace`},whatsNew:{title:`WHAT'S NEW`,closeHint:`q / esc continue`,upgraded:`You're now on Rove v{to}, up from v{from}. Here's what changed.`,notesUnavailable:`Could not load the release notes — check your connection, or read them on GitHub.`,sourceHint:`release notes: {url}`},skew:{title:`⚠ DAEMON OUT OF DATE`,olderBuild:`an older build`,hint:`daemon is {daemon} — you launched v{clientVersion}. Press {keys} to refresh Rove onto the installed build`,hintNoKey:"daemon is {daemon} — you launched v{clientVersion}. Run `rove daemon restart`, then relaunch Rove"},refresh:{confirmTitle:`Refresh Rove?`,confirmBody:`Rove restarts the daemon and relaunches itself on the installed build. Running engine sessions live in the PTY host and keep going; open tabs come back.`,confirmLabel:`Refresh`,relaunching:`rove: restarting on the installed build...`,alreadyCurrent:`Rove and the daemon already run the same build — nothing to refresh.`,installGone:"This Rove was installed from a directory that no longer exists, so it cannot relaunch itself. Reinstall with `npm install -g @sma1lboy/rove`."},staleInstall:{title:`✕ ROVE INSTALL IS GONE`,hint:"this Rove is running from an install that no longer exists on disk, so it cannot start a daemon. Reinstall (`npm install -g @sma1lboy/rove`) and relaunch Rove"},versions:{pageTitle:`ROVE VERSIONS`,loading:`Loading releases...`,unavailable:`Could not fetch releases. Check your connection or wait for the rate limit, then reopen this page.`,tagCurrent:`current`,tagLatest:`latest`,tagBreaking:`breaking`,breakingWarning:"⚠ installing this crosses breaking version(s) {versions}. Rove will refuse to start until you run `rove reset`, which stops the daemon, the PTY host, and every live session. Tasks and worktrees are kept.",footerHint:`j/k select · enter install · q close`,closeHint:`q / esc close`}},$r={pageTitle:`ROVE 更新`,closeHint:`q / esc 关闭`,chip:`↑ {version}`,current:`当前`,available:`有新版本 v{version}`,latest:`最新`,latestUnknown:`未知 —— 无法连接到 registry`,registryRetry:`请检查网络,然后关闭并重新打开更新页重试。`,upToDate:`没有更新的版本 —— 无需安装。`,releaseUrlUnavailable:`发布链接不可用;请访问 github.com/Sma1lboy/rove/releases`,statusReleaseOpened:`已在浏览器中打开发布说明页面。`,statusReleaseError:`无法打开发布链接。请在浏览器访问 github.com/Sma1lboy/rove/releases。`,statusRunningUpdater:`正在关闭 TUI,并在当前终端中运行更新程序……`,loadingNotes:`正在加载发布说明……`,notesUnavailable:`发布说明不可用。请使用「打开发布页」查看 GitHub 发布页面。`,changesSectionHeader:`── v{from} 至 v{to} 的变更 ──`,updateComplete:`Rove 更新完成。请重新启动 Rove 以使用新版本。`,updateFailed:"Rove 更新失败,退出码为 {code}。请检查上方输出,再运行 `rove update` 重试。",pressAnyKey:`按任意键关闭此更新窗口。`,webRunning:`正在运行 {command} …`,webInstalled:"已安装。daemon 和这个 web bridge 仍在跑 v{current}:先运行 `rove daemon restart`,再重启 `rove --web`。bridge 换到新版本后,页面会自动刷新。",webStartFailed:`无法启动更新程序:{error}`,actions:{updateNow:`立即更新`,openRelease:`打开发布页`,close:`关闭`,closeDetail:`返回工作区`},whatsNew:{title:`更新内容`,closeHint:`q / esc 继续`,upgraded:`Rove 已从 v{from} 更新到 v{to},本次变更如下。`,notesUnavailable:`无法加载发布说明 —— 请检查网络连接,或到 GitHub 上查看。`,sourceHint:`发布说明:{url}`},skew:{title:`⚠ DAEMON 版本不一致`,olderBuild:`旧版本构建`,hint:`daemon 运行的是 {daemon},而你启动的是 v{clientVersion}。按 {keys} 可让 Rove 刷新到已安装的版本`,hintNoKey:"daemon 运行的是 {daemon},而你启动的是 v{clientVersion}。请运行 `rove daemon restart`,然后重新启动 Rove"},refresh:{confirmTitle:`刷新 Rove?`,confirmBody:`Rove 会重启 daemon,并以已安装的版本重新启动自身。正在运行的引擎会话由 PTY host 托管,不会中断;已打开的标签页会恢复。`,confirmLabel:`刷新`,relaunching:`rove:正在以已安装的版本重新启动……`,alreadyCurrent:`Rove 与 daemon 已经是同一个版本 —— 无需刷新。`,installGone:"当前 Rove 的安装目录已不存在,无法重新启动自身。请运行 `npm install -g @sma1lboy/rove` 重新安装。"},staleInstall:{title:`✕ ROVE 安装已不存在`,hint:"当前 Rove 运行自一份已从磁盘删除的安装,因此无法启动 daemon。请重新安装(`npm install -g @sma1lboy/rove`)并重新启动 Rove"},versions:{pageTitle:`ROVE 版本列表`,loading:`正在加载发布列表……`,unavailable:`无法获取发布列表。请检查网络或等待限流解除,然后重新打开本页。`,tagCurrent:`当前`,tagLatest:`最新`,tagBreaking:`breaking`,breakingWarning:"⚠ 安装该版本会跨过 breaking 版本 {versions}。更新后 Rove 会拒绝启动,直到你运行 `rove reset`——它会停掉 daemon、PTY host 和所有活动会话。任务和 worktree 会保留。",footerHint:`j/k 选择 · enter 安装 · q 关闭`,closeHint:`q / esc 关闭`}},ei={quit:{confirmTitle:`Quit Rove?`,confirmBody:`The daemon and task sessions keep running. This closes only the native workspace.`,confirmLabel:`Quit`},narrowBack:`Tasks`,empty:{selectTask:`Select a task with a worktree`,noSessions:`No sessions here — press ⏎ to start {engine}, or ctrl+e to pick another`,noSessionsShell:`No sessions here — press ⏎ to start a shell, or ctrl+e to pick another`,remoteUnsupported:`Hosted engine launch over SSH is not implemented — this task's worktree is on {host}`},welcome:{title:`Welcome to Rove`,tagline:`All your coding agents in one place: when one runs out of quota, switch the task to another, and agents talk to each other directly.`,worktreeExplain:`Managed tasks create isolated worktrees and branches. Directory and project tasks reuse existing files; tabs within a task share its directory.`,stepNew:`creates your first task — pick a repo, a base branch, an engine`,stepHelp:`shows every shortcut reachable from the current focus`,stepPrefix:`opens the command menu`,enginesFound:`✓ engines: {list}`,enginesSignedOut:`✗ installed but not signed in: {list} — run one of them in a shell and log in`,enginesMissing:`✗ no engine CLI found — install claude, codex, copilot, or kimi, then restart Rove`,gitMissing:`✗ git not found on PATH — Rove needs git to create worktrees`,doctorHint:"run `rove doctor` in a shell for the full diagnosis",docsHint:`docs: https://docs.rove.run`},attention:{none:`No available Inbox items`},inbox:{title:`INBOX`,empty:`No pending attention`,openHint:`enter open`,clearHint:`d ack`,clearAllHint:`D ack all`,more:`+{count} more`,section:{attention:`ATTENTION`,recent:`RECENT`},state:{done:`done`,needsInput:`needs input`,error:`error`,rateLimited:`rate limited`,running:`running`,dead:`engine exited`,routineFailed:`routine needs you`,reportMissing:`report missing`,decisionNeeded:`decision needed`,gateAnswered:`answered · engine not running`},resumesAt:`resumes {time}`}},ti={quit:{confirmTitle:`退出 Rove?`,confirmBody:`守护进程和任务会话会继续运行,这里只关闭原生工作区。`,confirmLabel:`退出`},narrowBack:`任务`,empty:{selectTask:`请选择一个带 worktree 的任务`,noSessions:`这里没有会话——按 ⏎ 启动 {engine},或按 ctrl+e 另选一个`,noSessionsShell:`这里没有会话——按 ⏎ 启动 shell,或按 ctrl+e 另选一个`,remoteUnsupported:`尚未实现通过 SSH 启动托管引擎——该任务的 worktree 在 {host} 上`},welcome:{title:`欢迎使用 Rove`,tagline:`所有编程 agent 都在一个地方:一个额度用完了,换另一个接着干;agent 之间直接对话,不用你传话。`,worktreeExplain:`托管任务创建独立的 worktree 和分支。目录与项目任务复用现有文件;同一任务内的标签页共享目录。`,stepNew:`创建你的第一个任务——选仓库、基础分支和引擎`,stepHelp:`查看当前焦点下的全部快捷键`,stepPrefix:`打开命令菜单`,enginesFound:`✓ 已检测到引擎:{list}`,enginesSignedOut:`✗ 已安装但未登录:{list}——请在 shell 里运行其中之一并完成登录`,enginesMissing:`✗ 未找到引擎 CLI——请安装 claude、codex、copilot 或 kimi 后重启 Rove`,gitMissing:`✗ PATH 上没有 git——Rove 需要 git 来创建 worktree`,doctorHint:"在 shell 里运行 `rove doctor` 查看完整诊断",docsHint:`文档:https://docs.rove.run`},attention:{none:`收件箱中没有可打开的项目`},inbox:{title:`收件箱`,empty:`暂无待处理`,openHint:`enter 打开`,clearHint:`d 已阅`,clearAllHint:`D 全部已阅`,more:`还有 {count} 条`,section:{attention:`待处理`,recent:`最近使用`},state:{done:`完成`,needsInput:`需要输入`,error:`出错`,rateLimited:`限流`,running:`进行中`,dead:`引擎已退出`,routineFailed:`例行任务需要处理`,reportMissing:`未回报`,decisionNeeded:`等你决定`,gateAnswered:`已回答 · 引擎未运行`},resumesAt:`{time} 恢复`}},ni={title:`Worktrees`,loading:`Loading worktrees…`,noProjects:`No local projects known to Rove yet.`,loadFailed:`Could not read the worktrees: {message}`,noWorktrees:`No worktrees.`,badge:{roveManaged:`rove`,dirty:`dirty`,dirtyUnknown:`dirty?`,remoteOn:`on remote`,remoteOff:`not pushed`,remoteUnknown:`remote unknown`},verdict:{prOpen:`PR open`,prMerged:`merged (PR)`,inMain:`in main`,prClosed:`PR closed`,idle:`stale`},row:{detached:`(detached)`,created:`created {age} ago`},delete:{button:`Delete`,confirmTitle:`Delete worktree?`,confirmBody:`Delete the worktree for "{branch}"? This removes the working directory; the branch itself is kept.`,forceTitle:`Force delete worktree?`,forceBody:'"{branch}" has uncommitted, untracked, or gitignored work. Force delete removes the worktree, but the work is snapshotted first to a salvage ref — list them with `git for-each-ref refs/rove/salvage`. Force delete anyway?',forceReason:`Refused because: {reason}`,failed:`Failed to delete worktree: {error}`,residue:`Git deregistered the worktree, but couldn't delete {path} ({reason}). Rove is done with it — retrying won't help; delete the directory by hand if you want the space.`},land:{button:`Land`,confirmTitle:`Land branch?`,confirmBody:`Merge "{branch}" into {landedOn} ({commits} commits), then remove this worktree? The branch is kept. Conflicts abort with a file list.`,confirmBodyOne:`Merge "{branch}" into {landedOn} (1 commit), then remove this worktree? The branch is kept. Conflicts abort with a file list.`,noTask:`This worktree isn't tracked as a Rove task — nothing to land.`,conflict:`Land hit conflicts (merge aborted). Resolve by hand: {files}`,dirtyBase:"The base checkout has uncommitted changes — commit them, then land. Never `git stash` here: the stash stack lives in the repo's common dir and is shared by every linked worktree, so a stash can entangle other tasks' work.",failed:`Land failed: {error}`,done:`Landed "{branch}" onto {landedOn} ({commit}).`,worktreeKept:`Landed, but the worktree was kept: {reason}`,worktreePathStale:`Landed and removed the worktree, but the task still points at it: {reason}`,worktreeResidue:`Landed. Git deregistered the worktree, but couldn't delete {path} ({reason}) — delete the directory by hand if you want the space.`},hint:{}},ri={title:`工作树`,loading:`正在加载 worktree…`,noProjects:`Rove 还没有已知的本地项目。`,loadFailed:`读不到 worktree 列表:{message}`,noWorktrees:`没有 worktree。`,badge:{roveManaged:`rove`,dirty:`有改动`,dirtyUnknown:`改动未知`,remoteOn:`已推送`,remoteOff:`未推送`,remoteUnknown:`远端未知`},verdict:{prOpen:`PR 评审中`,prMerged:`已合入 (PR)`,inMain:`已在主分支`,prClosed:`PR 已关闭`,idle:`陈旧`},row:{detached:`(游离状态)`,created:`{age}前创建`},delete:{button:`删除`,confirmTitle:`删除 worktree?`,confirmBody:`确定删除 "{branch}" 对应的 worktree?工作目录会被移除,分支本身会保留。`,forceTitle:`强制删除 worktree?`,forceBody:'"{branch}" 存在未提交、未跟踪或被 gitignore 的改动。强制删除会移除 worktree,但这些改动会先被快照到一个 salvage ref——用 `git for-each-ref refs/rove/salvage` 可以列出它们。仍要强制删除吗?',forceReason:`拒绝原因:{reason}`,failed:`删除 worktree 失败:{error}`,residue:`Git 已注销该 worktree,但没能删掉 {path}({reason})。Rove 这边已经处理完了——重试没有用;想要回磁盘空间请手动删除该目录。`},land:{button:`合入`,confirmTitle:`合入分支?`,confirmBody:`把 "{branch}" 合入 {landedOn}({commits} 个提交),然后移除这个 worktree?分支会保留。冲突会中止并给出文件清单。`,confirmBodyOne:`把 "{branch}" 合入 {landedOn}(1 个提交),然后移除这个 worktree?分支会保留。冲突会中止并给出文件清单。`,noTask:`该 worktree 未作为 Rove 任务被跟踪——没有可合入的对象。`,conflict:`合入遇到冲突(已中止)。请手动解决:{files}`,dirtyBase:"基础检出有未提交改动——请先提交再合入。绝不要在这里 `git stash`:stash 栈存放在仓库的 common dir 中,该仓库所有 linked worktree 共享,一次 stash 可能纠缠其他任务的工作。",failed:`合入失败:{error}`,done:`已把 "{branch}" 合入 {landedOn}({commit})。`,worktreeKept:`已合入,但 worktree 保留了:{reason}`,worktreePathStale:`已合入并移除 worktree,但任务仍指向它:{reason}`,worktreeResidue:`已合入。Git 已注销该 worktree,但没能删掉 {path}({reason})——想要回磁盘空间请手动删除该目录。`},hint:{}},ii={common:{en:Mr,zh:Nr},doctor:{en:Pr,zh:Fr},files:{en:Ir,zh:Lr},newTask:{en:Rr,zh:zr},onboarding:{en:Br,zh:Vr},quickTask:{en:Hr,zh:Ur},tasks:{en:Jr,zh:Yr},terminal:{en:Xr,zh:Zr},update:{en:Qr,zh:$r},workspace:{en:ei,zh:ti},worktrees:{en:ni,zh:ri}};function ai(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 W(e,t,n){let r=ii[e],i=ai(r[Me.get()],t)??ai(r.en,t)??t;return n?i.replace(/\{(\w+)\}/g,(e,t)=>String(n[t]??e)):i}var oi=[{id:`chat.tab.new`,scope:`workspace`,keys:[`ctrl+t`],category:`Workspace`,description:`New chat tab`,hint:{keys:`ctrl+t`},presentation:`onePress`},{id:`chat.tab.chooseEngine`,scope:`workspace`,keys:[`ctrl+e`],category:`Workspace`,description:`New conversation — engine/shell picker with destination + context toggles`,hint:{keys:`ctrl+e`},presentation:`onePress`},{id:`chat.tab.fork`,scope:`workspace`,keys:[],prefixKeys:[`c`],category:`Workspace`,description:`Fork this chat into a new tab (same Task directory, keeps the conversation)`,hint:{keys:`ctrl+a c`}},{id:`chat.fork.new`,scope:`workspace`,keys:[],prefixKeys:[`f`],category:`Workspace`,description:`Quick-fork: create child task seeded with current repo/branch/model`,hint:{keys:`ctrl+a f`}},{id:`chat.tab.close`,scope:`workspace`,keys:[`ctrl+w`],prefixKeys:[`w`],category:`Workspace`,description:`Close chat tab`,hint:{keys:`ctrl+w`},presentation:`onePress`},{id:`workspace.reopenSession`,scope:`workspace`,keys:[`return`],category:`Workspace`,description:`Reopen a session in a task whose tabs are all closed`,hint:{keys:`enter`},presentation:`onePress`},{id:`chat.tab.rename`,scope:`workspace`,keys:[`f2`],category:`Workspace`,description:`Rename active chat tab`,hint:{keys:`f2`},presentation:`onePress`},{id:`chat.tab.cycle-next`,scope:`workspace`,keys:[`ctrl+]`],category:`Workspace`,description:`Next chat tab`,hint:{keys:`ctrl+]`},presentation:`onePress`},{id:`chat.tab.cycle-prev`,scope:`workspace`,keys:[`ctrl+[`],category:`Workspace`,description:`Previous chat tab`,hint:{keys:`ctrl+[`},presentation:`onePress`},{id:`chat.tab.goto`,scope:`workspace`,keys:[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`].map(e=>`ctrl+${e}`),category:`Workspace`,description:`Go to chat tab N`,hint:{keys:`ctrl+1-9`},presentation:`onePress`},{id:`workspace.split.right`,scope:`workspace`,keys:[`ctrl+\\`],category:`Workspace`,description:`Split right`,hint:{keys:`ctrl+\\`},presentation:`onePress`},{id:`workspace.split.down`,scope:`workspace`,keys:[`ctrl+=`],category:`Workspace`,description:`Split down`,hint:{keys:`ctrl+=`},presentation:`onePress`},{id:`workspace.split.focus-next`,scope:`workspace`,keys:[`f3`],category:`Workspace`,description:`Focus next split`,hint:{keys:`f3`},presentation:`onePress`},{id:`workspace.split.close`,scope:`workspace`,keys:[`ctrl+w`],prefixKeys:[`w`],category:`Workspace`,description:`Close active split (tab when unsplit)`,hint:{keys:`ctrl+w`},presentation:`onePress`},{id:`workspace.split.rename`,scope:`workspace`,keys:[`f2`],category:`Workspace`,description:`Rename active split (tab when unsplit)`,hint:{keys:`f2`},presentation:`onePress`}],si=[{id:`files.nav`,scope:`files`,keys:[`j`,`k`,`down`,`up`],category:`Files`,description:`Move cursor up/down`,hint:{keys:`j/k`}},{id:`files.hierarchy`,scope:`files`,keys:[`h`,`l`,`left`,`right`],category:`Files`,description:`Collapse / expand tree level`,hint:{keys:`h/l`}},{id:`files.open`,scope:`files`,keys:[`return`],category:`Files`,description:`Open file in configured editor (diff when supported)`,hint:{keys:`enter`}},{id:`files.tab`,scope:`files`,keys:[`[`,`]`],category:`Files`,description:`Switch tab (cycle All / Changes)`,hint:{keys:`[/]`}},{id:`files.refresh`,scope:`files`,keys:[`r`],category:`Files`,description:`Refresh`,hint:{keys:`r`}},{id:`files.scope`,scope:`files`,keys:[`b`],category:`Files`,description:`Toggle Changes scope (working ↔ branch vs base)`,hint:{keys:`b`}},{id:`files.diff`,scope:`files`,keys:[`d`],category:`Files`,description:`Open read-only diff in a workspace tab`,hint:{keys:`d`}},{id:`files.diffAll`,scope:`files`,keys:[`shift+d`],category:`Files`,description:`Open the whole worktree's diff in one workspace tab`,hint:{keys:`D`}},{id:`files.openExternal`,scope:`files`,keys:[`o`],category:`Files`,description:`Open file in system default app (audio / video / pdf preview)`,hint:{keys:`o`}},{id:`files.mention`,scope:`files`,keys:[`a`],category:`Files`,description:`Inject @<path> mention into the engine pane`,hint:{keys:`a`}},{id:`files.createPR`,scope:`global`,keys:[],prefixKeys:[`p`,`shift+p`],category:`Files`,description:`Ask the agent to create a PR from the current task`},{id:`files.fixChecks`,scope:`global`,keys:[],prefixKeys:[`k`],category:`Files`,description:`Ask the agent to fix the failing PR checks`},{id:`files.syncBase`,scope:`global`,keys:[],prefixKeys:[`u`],category:`Files`,description:`Merge the base branch into this task's worktree`},{id:`diff.review.cursor`,scope:`workspace`,keys:[`j`,`k`,`down`,`up`],bareKeys:!0,category:`Diff review`,description:`Move the line cursor over the diff`,hint:{keys:`j/k`}},{id:`diff.review.range`,scope:`workspace`,keys:[`v`],bareKeys:!0,category:`Diff review`,description:`Toggle range anchor at the cursor`,hint:{keys:`v`}},{id:`diff.review.note`,scope:`workspace`,keys:[`c`],bareKeys:!0,category:`Diff review`,description:`Add a review note at the cursor`,hint:{keys:`c`}},{id:`diff.review.send`,scope:`workspace`,keys:[`s`],bareKeys:!0,category:`Diff review`,description:`Send all unsent review notes to the engine`,hint:{keys:`s`}},{id:`diff.review.drop`,scope:`workspace`,keys:[`x`],bareKeys:!0,category:`Diff review`,description:`Drop the review note the cursor sits inside`,hint:{keys:`x`}},{id:`diff.review.reload`,scope:`workspace`,keys:[`r`],bareKeys:!0,category:`Diff review`,description:`Reload the previewed file from disk`,hint:{keys:`r`}}],ci=[{id:`inbox.show`,scope:`global`,keys:[],prefixKeys:[`i`],category:`Global`,description:`Open Inbox`},{id:`inbox.nav`,scope:`inbox`,keys:[`j`,`k`,`down`,`up`],category:`Inbox`,description:`Move cursor up/down`,hint:{keys:`j/k`}},{id:`inbox.open`,scope:`inbox`,keys:[`return`],category:`Inbox`,description:`Open the selected Task and Terminal Tab`,hint:{keys:`enter`}},{id:`inbox.delete`,scope:`inbox`,keys:[`d`],category:`Inbox`,description:`Ack the selected Inbox item`,hint:{keys:`d`}},{id:`inbox.deleteAll`,scope:`inbox`,keys:[`shift+d`],category:`Inbox`,description:`Ack every ATTENTION item`,hint:{keys:`D`}}],li=[{id:`palette.open`,scope:`global`,keys:[],prefixKeys:[`/`],category:`Global`,description:`Search commands`},{id:`help.open`,scope:`global`,keys:[`f1`],category:`Global`,description:`Show keybindings help`,hint:{keys:`F1`},presentation:`onePress`},{id:`task.new`,scope:`sidebar`,keys:[`n`],category:`Sidebar`,description:`New task`,hint:{keys:`n`}},{id:`task.new.global`,scope:`global`,keys:[],prefixKeys:[`n`],category:`Global`,description:`New task`},{id:`task.openEditor`,scope:`global`,keys:[],prefixKeys:[`o`],category:`Global`,description:`Open active Task directory in editor`},{id:`task.moveMode`,scope:`global`,keys:[],prefixKeys:[`m`],category:`Global`,description:`Reorder sidebar rows (then j/k)`},{id:`settings.open`,scope:`global`,keys:[],prefixKeys:[`,`],category:`Global`,description:`Open settings`},{id:`app.refresh`,scope:`global`,keys:[],prefixKeys:[`r`],category:`Global`,description:`Refresh Rove onto the installed build (after an update)`},{id:`settings.open.sidebar`,scope:`sidebar`,keys:[`s`],category:`Sidebar`,description:`Open settings`,hint:{keys:`s`}},{id:`worktrees.open.sidebar`,scope:`sidebar`,keys:[`x`],category:`Sidebar`,description:`Open worktrees`,hint:{keys:`x`}},{id:`kanban.open`,scope:`global`,keys:[],prefixKeys:[`1`],category:`Global`,description:`Open kanban (issues board)`},{id:`automations.open`,scope:`global`,keys:[],prefixKeys:[`2`],category:`Global`,description:`Open routines (scheduled tasks)`},{id:`workItems.open`,scope:`global`,keys:[],prefixKeys:[`3`],category:`Global`,description:`Open GitHub issues (external tracker)`},{id:`app.quit`,scope:`sidebar`,keys:[`q`,`ctrl+q`],category:`Sidebar`,description:`Quit (with confirm)`,hint:{keys:`q`}},{id:`focus.sidebar`,scope:`workspace`,keys:[`ctrl+q`],prefixKeys:[`q`],category:`Workspace`,description:`Back to sidebar (tasks)`,hint:{keys:`ctrl+q`},presentation:`onePress`},{id:`focus.previous`,scope:`global`,keys:[],prefixKeys:[`h`],category:`Navigation`,description:`Focus previous pane (files → workspace → sidebar)`},{id:`focus.next`,scope:`global`,keys:[`f4`],prefixKeys:[`l`],category:`Navigation`,description:`Focus next pane (sidebar → workspace → files)`,hint:{keys:`f4`},presentation:`onePress`},{id:`attention.next`,scope:`global`,keys:[`f7`],category:`Navigation`,description:`Jump to the next available Inbox item`,hint:{keys:`f7`},presentation:`onePress`},{id:`workspace.zenToggle`,scope:`global`,keys:[],prefixKeys:[`z`],category:`Navigation`,description:`Toggle zen mode (hide the files column)`},{id:`view.redraw`,scope:`global`,keys:[],prefixKeys:[`r`],category:`Global`,description:`Redraw the screen`},{id:`sidebar.nav`,scope:`sidebar`,keys:[`j`,`k`,`down`,`up`],category:`Sidebar`,description:`Move cursor up/down`,hint:{keys:`j/k`}},{id:`sidebar.select`,scope:`sidebar`,keys:[`return`],category:`Sidebar`,description:`Open the selected task`,hint:{keys:`enter`}},{id:`sidebar.tree.open`,scope:`sidebar`,keys:[`l`,`space`],category:`Sidebar`,description:`Open the row under the cursor (a tab row enters its chat)`,hint:{keys:`l`}},{id:`sidebar.goto`,scope:`sidebar`,keys:[`g`,`shift+g`],category:`Sidebar`,description:`Top / bottom of list (gg or shift-G)`},{id:`sidebar.rename`,scope:`sidebar`,keys:[`r`],category:`Sidebar`,description:`Rename task`,hint:{keys:`r`}},{id:`sidebar.localMerge`,scope:`sidebar`,keys:[`shift+m`],category:`Sidebar`,description:`Reorder row (Shift+M, then j/k)`,hint:{keys:`M`}},{id:`sidebar.pin`,scope:`sidebar`,keys:[`shift+p`],category:`Sidebar`,description:`Pin / unpin task at top (Shift+P)`,hint:{keys:`P`}},{id:`sidebar.sort`,scope:`sidebar`,keys:[`t`],category:`Sidebar`,description:`Cycle task sort (default → recent → attention → name)`,hint:{keys:`t`}},{id:`sidebar.delete`,scope:`sidebar`,keys:[`d`],category:`Sidebar`,description:`Remove session (with confirm)`,hint:{keys:`d`}},{id:`sidebar.search.enter`,scope:`sidebar`,keys:[`/`],category:`Sidebar`,description:`Search tasks (fuzzy filter)`,hint:{keys:`/`}},{id:`sidebar.search.nav`,scope:`sidebar`,keys:[`down`,`up`],category:`Sidebar`,description:`Move highlight in search results`},{id:`sidebar.search.submit`,scope:`sidebar`,keys:[`return`],category:`Sidebar`,description:`Select search match and exit search`},{id:`sidebar.search.cancel`,scope:`sidebar`,keys:[`escape`],category:`Sidebar`,description:`Cancel search (restore prior selection)`},{id:`tasks.openWorktree`,scope:`sidebar`,keys:[`o`],category:`Tasks pane`,description:`Open selected Task directory in your editor`,hint:{keys:`o`}},{id:`tasks.renameBranch`,scope:`sidebar`,keys:[`b`],category:`Tasks pane`,description:`Rename the selected task's git branch`,hint:{keys:`b`}},{id:`tasks.cycleEngine`,scope:`sidebar`,keys:[`v`],category:`Tasks pane`,description:`Cycle engine vendor — applies on reopen`,hint:{keys:`v`}},{id:`tasks.update`,scope:`sidebar`,keys:[`u`],category:`Tasks pane`,description:`Open the update page — version check + release notes`,hint:{keys:`u`}},{id:`tasks.focusEngine`,scope:`sidebar`,keys:[`right`],category:`Tasks pane`,description:`Focus the engine pane of the current window`,hint:{keys:`→`}},...oi,...si,...ci,{id:`terminal.scroll-up`,scope:`terminal`,keys:[`ctrl+pageup`],category:`Terminal`,description:`Scroll scrollback up`,hint:{keys:`ctrl+pgup`}},{id:`terminal.scroll-down`,scope:`terminal`,keys:[`ctrl+pagedown`],category:`Terminal`,description:`Scroll scrollback down`},{id:`terminal.reset`,scope:`terminal`,keys:[`f5`],category:`Terminal`,description:`Reset terminal — kill the current shell and respawn`,hint:{keys:`f5`},presentation:`onePress`}],ui={ctrl:`⌃`,control:`⌃`,alt:`⌥`,opt:`⌥`,option:`⌥`,shift:`⇧`,cmd:`⌘`,command:`⌘`,meta:`⌘`,super:`⌘`},di={enter:`⏎`,return:`⏎`,esc:`⎋`,escape:`⎋`,space:`␣`,up:`↑`,down:`↓`,left:`←`,right:`→`,backspace:`⌫`,delete:`⌦`,del:`⌦`,pgup:`⇞`,pageup:`⇞`,pgdn:`⇟`,pagedown:`⇟`,home:`↖`,end:`↘`};function fi(e,t){if(e.includes(`/`))return e.split(`/`).map(e=>fi(e,t)).join(`/`);let n=e.toLowerCase();return n===`tab`?`tab`:di[n]||(/^f\d{1,2}$/.test(n)?n.toUpperCase():t?/^[a-z]$/.test(n)?e.toUpperCase():e.replace(/[a-z]+/gi,e=>e.toUpperCase()):e)}function pi(e,t=`⌃A`){let n=e.trim();if(!n)return n;let r=/^prefix\s+(.+)$/i.exec(n);if(r){let e=r[1]??``;return`${t} ${e.includes(`+`)?pi(e,t):fi(e,!0)}`}let i=n.split(`+`);if(i.length===1)return fi(i[0]??``,!1);let a=i[i.length-1]??``;return`${i.slice(0,-1).map(e=>ui[e.toLowerCase().trim()]??e).join(``)} ${fi(a,!0)}`}var mi={path:``,exists:!1,rows:[],prefix:{key:`ctrl+a`,firstStrokes:[`ctrl+a`],timeoutMs:5e3},plugins:[],applied:[],warnings:[]},hi=g(mi),gi=new Map(li.map(e=>[e.id,{keys:[...e.keys],prefixKeys:e.prefixKeys&&[...e.prefixKeys],hint:e.hint&&{...e.hint}}]));function _i(e){for(let e of li){let t=gi.get(e.id);if(!t)continue;let n=e;n.keys=[...t.keys],n.prefixKeys=t.prefixKeys&&[...t.prefixKeys],n.hint=t.hint&&{...t.hint}}for(let t of e.rows){let e=li.find(e=>e.id===t.id);e&&(e.keys=[...t.keys],e.prefixKeys=t.prefixKeys&&[...t.prefixKeys],e.hint=t.hint&&{...t.hint})}hi.set(e)}async function vi(e){try{_i(await e.request(`keybindings.get`))}catch{}}function yi(e){let t=_(e.conn).hello;(0,h.useEffect)(()=>{if(!t)return;let n=()=>void vi(e);return n(),window.addEventListener(`focus`,n),()=>window.removeEventListener(`focus`,n)},[t,e])}var bi=()=>hi.get().prefix.key,xi=()=>{let e=bi();return e===null?``:pi(e)};function Si(e,t=`direct`){let n=li.find(t=>t.id===e),r=t===`prefix`?n?.prefixKeys?.[0]:n?.keys[0];return r===void 0?void 0:pi(r)}var Ci=e=>li.find(t=>t.id===e)?.keys??[];function wi(e){let t=xi(),n=Si(e,`prefix`);return t&&n?`${t} ${n}`:``}var Ti=e=>gi.get(e)?.prefixKeys??[];function Ei(e,t){let n=hi.get().rows.find(t=>t.id===e),r=gi.get(e),i=t===`prefix`?n?.prefixKeys:n?.keys,a=t===`prefix`?r?.prefixKeys:r?.keys;return i&&JSON.stringify(i)!==JSON.stringify(a??[])?i:void 0}function Di(e,t){for(let n of t){let t=e.find(e=>e.chord===n);if(t)return t}}function Oi(e){return!e.dialog&&e.page!==`worktrees`&&e.page!==`update`}var G=g({stale:!1,daemonVersion:null,bridgeVersion:null}),ki=2e4;async function Ai(e){try{let t=await e.request(`daemon.info`);return G.set({stale:t.stale,daemonVersion:t.daemonVersion,bridgeVersion:t.bridgeVersion}),t.stale}catch{return G.get().stale}}function ji(e){(0,h.useEffect)(()=>{let t=e.onOpen(()=>void Ai(e)),n=jr(ki,()=>void Ai(e));return()=>{t(),n()}},[e])}function Mi(e){if(!G.get().stale){H(W(`update`,`refresh.alreadyCurrent`),`error`);return}B.set((0,L.jsx)(Or,{title:W(`update`,`refresh.confirmTitle`),body:W(`update`,`refresh.confirmBody`),confirmLabel:W(`update`,`refresh.confirmLabel`),onConfirm:async()=>{await e.request(`daemon.restart`),H(W(`update`,`refresh.relaunching`));for(let t=0;t<20;t++)if(await new Promise(e=>window.setTimeout(e,1e3)),!await Ai(e))return;throw Error(F(`layout.refreshTimeout`))}}))}function Ni({onRefresh:e}){I();let{stale:t,daemonVersion:n,bridgeVersion:r}=_(G);if(_(hi),!t)return null;let i=W(`update`,`skew.hint`,{daemon:n?`v${n}`:W(`update`,`skew.olderBuild`),clientVersion:r??``,keys:wi(`app.refresh`)});return(0,L.jsxs)(`div`,{className:`mono ${Dt}`,role:`alert`,children:[(0,L.jsx)(`b`,{children:W(`update`,`skew.title`)}),(0,L.jsx)(`span`,{children:i}),(0,L.jsx)(`button`,{type:`button`,className:sn,onClick:e,children:W(`update`,`refresh.confirmLabel`)})]})}var Pi=[`info`,`success`,`warning`,`error`,`muted`],Fi=4e3,Ii=4e3,Li=/^[A-Za-z0-9._:-]{1,64}$/,Ri={box:new Set([`type`,`direction`,`gap`,`padding`,`border`,`children`]),text:new Set([`type`,`text`,`tone`,`bold`]),button:new Set([`type`,`key`,`label`,`tone`]),input:new Set([`type`,`key`,`placeholder`,`value`])};function zi(e){return typeof e==`string`&&Pi.includes(e)}function Bi(e){return e===0||e===1||e===2||e===3}var Vi=class extends Error{};function Hi(e){let t=0,n=new Set,r=(e,i,a)=>{if(a>12)throw new Vi(`${i}: deeper than 12`);if(++t>400)throw new Vi(`more than 400 elements`);if(!e||typeof e!=`object`||Array.isArray(e))throw new Vi(`${i}: not an element`);let o=e,s=o.type;if(s!==`box`&&s!==`text`&&s!==`button`&&s!==`input`)throw new Vi(`${i}: unknown element ${JSON.stringify(s)}`);for(let e of Object.keys(o))if(!Ri[s].has(e))throw new Vi(`${i}: ${s} has no prop "${e}"`);if(o.tone!==void 0&&!zi(o.tone))throw new Vi(`${i}: tone must be one of ${Pi.join(`, `)}`);if(s===`text`){if(typeof o.text!=`string`||o.text.length>4e3)throw new Vi(`${i}: text must be a string of at most ${Fi} chars`);if(o.bold!==void 0&&typeof o.bold!=`boolean`)throw new Vi(`${i}: bold must be boolean`);return{type:s,text:o.text,...o.tone===void 0?{}:{tone:o.tone},...o.bold?{bold:!0}:{}}}if(s===`button`||s===`input`){if(typeof o.key!=`string`||!Li.test(o.key))throw new Vi(`${i}: bad ${s} key`);if(n.has(o.key))throw new Vi(`${i}: duplicate key "${o.key}"`);n.add(o.key)}if(s===`input`){for(let e of[`placeholder`,`value`]){let t=o[e];if(t!==void 0&&(typeof t!=`string`||t.length>4e3))throw new Vi(`${i}: ${e} must be a string of at most ${Ii} chars`)}return{type:s,key:o.key,...o.placeholder===void 0?{}:{placeholder:o.placeholder},...o.value===void 0?{}:{value:o.value}}}if(s===`button`){if(typeof o.label!=`string`||o.label.length===0||o.label.length>40)throw new Vi(`${i}: label must be 1-40 chars`);return{type:s,key:o.key,label:o.label,...o.tone===void 0?{}:{tone:o.tone}}}if(o.direction!==void 0&&o.direction!==`row`&&o.direction!==`column`)throw new Vi(`${i}: direction must be "row" or "column"`);for(let e of[`gap`,`padding`])if(o[e]!==void 0&&!Bi(o[e]))throw new Vi(`${i}: ${e} must be 0-3`);if(o.border!==void 0&&typeof o.border!=`boolean`)throw new Vi(`${i}: border must be boolean`);if(!Array.isArray(o.children))throw new Vi(`${i}: box needs children`);return{type:s,...o.direction===void 0?{}:{direction:o.direction},...o.gap===void 0?{}:{gap:o.gap},...o.padding===void 0?{}:{padding:o.padding},...o.border?{border:!0}:{},children:o.children.map((e,t)=>r(e,`${i}.children[${t}]`,a+1))}};try{return{ok:!0,tree:r(e,`tree`,1)}}catch(e){if(e instanceof Vi)return{ok:!1,error:e.message};throw e}}function Ui(e){let t=e?.panes;if(!Array.isArray(t))return null;let n=[];for(let e of t){if(!e||typeof e!=`object`)continue;let t=e;if(typeof t.plugin!=`string`||typeof t.id!=`string`||typeof t.title!=`string`)continue;let r=Hi(t.tree);r.ok&&n.push({plugin:t.plugin,id:t.id,title:t.title,tree:r.tree})}return n}function Wi(e){let t=[],n=(e,r,i)=>{if(e.type===`button`||e.type===`input`)t.push({kind:e.type,plugin:r,pane:i,key:e.key});else if(e.type===`box`)for(let t of e.children)n(t,r,i)};for(let t of e)n(t.tree,t.plugin,t.id);return t}function Gi(e,t){return e!==null&&t!==null&&e.plugin===t.plugin&&e.pane===t.pane&&e.key===t.key}function Ki(e,t){return e.find(e=>Gi(e,t))??e[0]??null}function qi(e,t,n){if(e.length===0)return null;let r=e.findIndex(e=>Gi(e,t));return r<0?e[0]??null:e[(r+n+e.length)%e.length]??null}function Ji(e,t){if(!t)return e;let n=new Map(e.map(e=>[e.id,e]));for(let e of t.remove)n.delete(e);for(let e of t.upsert)n.set(e.id,e);return t.order?t.order.flatMap(e=>n.get(e)??[]):e.map(e=>n.get(e.id)??e)}function Yi(e,t){return{...e,rev:t.rev,tasks:Ji(e.tasks,t.tasks),...t.archived?{archived:Ji(e.archived??[],t.archived)}:{},...t.attention?{attention:t.attention}:{},...t.gates?{gates:t.gates}:{}}}function Xi(e){return!!e&&typeof e==`object`&&typeof e.from==`number`}var Zi=(e,t)=>n=>({...n,tasks:n.tasks.map(n=>n.id===e?{...n,...t}:n)}),Qi=(e,t)=>n=>({...n,tasks:n.tasks.map(n=>n.id===e?{...n,title:t,label:n.label===n.title?t:n.label}:n)});function $i(e,t){let n=new Set([t]);for(let t=!0;t;){t=!1;for(let r of e)r.parentTaskId&&n.has(r.parentTaskId)&&!n.has(r.id)&&(n.add(r.id),t=!0)}return n}var ea=(e,t)=>n=>{let r=t?n.tasks:n.archived??[],i=$i(r,e),a=r.filter(e=>i.has(e.id)).map(e=>({...e,archived:t})),o=r.filter(e=>!i.has(e.id));return t?{...n,tasks:o,archived:[...n.archived??[],...a]}:{...n,tasks:[...n.tasks,...a],archived:o}},ta=(e,t)=>n=>{let r=[...n.tasks,...n.archived??[]],i=t?$i(r,e):new Set([e]),a=r.find(t=>t.id===e)?.parentTaskId,o=t=>t.filter(e=>!i.has(e.id)).map(t=>t.parentTaskId===e?{...t,parentTaskId:a}:t);return{...n,tasks:o(n.tasks),...n.archived?{archived:o(n.archived)}:{}}},na={"task.pin":(e,t)=>Zi(e,{pinned:t.pinned===!0}),"task.keep":(e,t)=>Zi(e,{kept:t.kept===!0}),"task.setStatus":(e,t)=>Zi(e,{status:t.status}),"task.rename":(e,t)=>Qi(e,String(t.title)),"task.archive":(e,t)=>ea(e,t.archived===!0),"task.delete":(e,t)=>ta(e,t.cascade===!0)};Object.keys(na);function ra(e,t){return na[e]?.(String(t.taskId),t)??null}var ia=`rove.web.selection`,aa=`null`,oa=300;function sa(){try{let e=JSON.parse(localStorage.getItem(ia)??`null`);if(e&&typeof e==`object`&&`taskId`in e&&typeof e.taskId==`string`)return{taskId:e.taskId,tabId:`tabId`in e&&typeof e.tabId==`string`?e.tabId:null}}catch{}return{taskId:null,tabId:null}}function ca(e){if(!e||typeof e!=`object`||!(`taskIds`in e))return;let t=e.taskIds;return Array.isArray(t)?t.filter(e=>typeof e==`string`):void 0}function la(e){return!!e&&typeof e==`object`&&`tasks`in e&&Array.isArray(e.tasks)}var ua=`rove.web.visits`,da=20;function fa(){try{let e=JSON.parse(localStorage.getItem(ua)??`[]`);return Array.isArray(e)?e.filter(e=>!!e&&typeof e==`object`&&typeof e.taskId==`string`):[]}catch{return[]}}function pa(e,t){if(t)return e?.tasks.find(e=>e.id===t)??e?.archived?.find(e=>e.id===t)}function ma(e,t,n,r){let i=(e,t)=>e.some(e=>e.id===t&&!e.deleting),a=n.taskId;if(a===null||!i(e,a)||i(t,a))return null;let o=r.find(e=>e.taskId!==a&&i(t,e.taskId));return o?{taskId:o.taskId,tabId:o.tabId}:{taskId:null,tabId:null}}var ha=class{client;tasks=g(null);remote=g([]);tabs=g({});tabsSettled=g(!1);mods=g([]);installedMods=g(new Set);selection=g(sa());visits=g(fa());tabTimer=null;tabsReadAt=-1/0;tabScope=new Set;tabSets=new Map;tabReads=new Map;syncing=null;served=null;edits=new Map;pendingSelect=null;selectIntent=0;provisioning=new Map;viewingSent=aa;taskShown=!0;viewingExtras=()=>({});constructor(e){this.client=e,e.onOpen(()=>{this.resync(),this.viewingSent=aa,this.reportViewing(),this.refreshMods()}),typeof document<`u`&&typeof document.addEventListener==`function`&&document.addEventListener(`visibilitychange`,()=>{this.reportViewing(),document.visibilityState===`visible`&&this.refreshMods()}),typeof window<`u`&&typeof window.addEventListener==`function`&&window.addEventListener(`pagehide`,()=>this.reportViewing(!0)),e.on(`tasks`,e=>{la(e)&&this.acceptTasks(e)}),e.on(`tasks.patch`,e=>{let t=this.served;t&&Xi(e)&&e.from===t.rev?this.acceptTasks(Yi(t,e)):this.resync()}),e.on(`tabs`,e=>this.scheduleTabRefresh(ca(e))),e.on(`mods`,e=>this.mods.set(Ui(e)??[]))}resync(){return this.syncing??=this.client.request(`tasks.subscribe`,{patches:!0}).then(e=>this.acceptTasks(e)).catch(()=>{}).finally(()=>{this.syncing=null}),this.syncing}async refreshMods(){try{let{mods:e}=await this.client.request(`builtinMods.list`);this.installedMods.set(new Set(e.filter(e=>e.installed).map(e=>e.id)))}catch{}}onSelect=()=>{};setTaskShown(e){this.taskShown!==e&&(this.taskShown=e,this.reportViewing())}select(e,t=null){this.onSelect();let n=++this.selectIntent;if(this.tasks.get()?.tasks.find(t=>t.id===e)?.noWorktree){this.provisioning.has(e)?this.provisioning.set(e,{intent:n,tabId:t}):this.provisionThenSelect(e,{intent:n,tabId:t});return}this.commitSelection(e,t)}commitSelection(e,t){let n=this.tabs.get()[e]??[],r={taskId:e,tabId:t??ga(n)?.id??null};this.selection.set(r),localStorage.setItem(ia,JSON.stringify(r));let i=[{...r,at:Date.now()},...this.visits.get().filter(e=>e.taskId!==r.taskId||e.tabId!==r.tabId)].slice(0,da);this.visits.set(i),localStorage.setItem(ua,JSON.stringify(i)),this.reportViewing(),e in this.tabs.get()||this.scheduleTabRefresh([e])}reportViewing(e=!1){let{taskId:t,tabId:n}=this.selection.get(),r=e||typeof document<`u`&&document.visibilityState===`hidden`||!t||!this.taskShown?null:{taskId:t,...n?{tabId:n}:{},...this.viewingExtras()},i=JSON.stringify(r);i!==this.viewingSent&&(this.viewingSent=i,this.client.request(`ui.viewing`,r??{taskId:null}).catch(()=>{this.viewingSent===i&&(this.viewingSent=aa)}))}async provisionThenSelect(e,t){this.provisioning.set(e,t);let n=!0;try{await this.client.request(`task.ensureWorktree`,{taskId:e})}catch(e){n=!1,H(e instanceof Error?e.message:String(e),`error`)}let r=this.provisioning.get(e)??t;this.provisioning.delete(e),n&&(this.markProvisioned(e),(this.tasks.get()?.tasks.some(t=>t.id===e)??!1)&&r.intent===this.selectIntent&&this.commitSelection(e,r.tabId))}markProvisioned(e){let t=this.tasks.get();if(!t)return;let n=t.tasks.map(t=>t.id===e?{...t,noWorktree:void 0}:t);this.tasks.set({...t,tasks:n})}selectWhenListed(e){this.tasks.get()?.tasks.some(t=>t.id===e)?this.select(e):this.pendingSelect=e}engineTarget(e){let{taskId:t,tabId:n}=this.selection.get(),r=t===e?this.tabs.get()[e]?.find(e=>e.id===n):void 0;return r?.kind===`engine`?{taskId:e,tabId:r.id}:{taskId:e}}async refreshTabsNow(e){await this.refreshTabs([e])}tabbedTasks(){let e=this.tasks.get(),t=e?.archived?.find(e=>e.id===this.selection.get().taskId);return[...e?.tasks??[],...t?[t]:[],...this.remote.get().filter(e=>!e.machine?.stale)]}act(e,t){let n=ra(e,t),r=()=>this.client.request(e,t);return n?this.optimistic(n,r):r()}closeTab(e,t){return this.tabAct(e,`tab.close`,{taskId:e,tabId:t},e=>e.filter(e=>e.id!==t))}renameTab(e,t,n){return this.tabAct(e,`tab.rename`,{taskId:e,tabId:t,title:n},e=>e.map(e=>e.id===t?{...e,title:n}:e))}async tabAct(e,t,n,r){let i=this.tabs.get()[e];i&&(this.tabReads.set(e,(this.tabReads.get(e)??0)+1),this.tabs.set({...this.tabs.get(),[e]:r(i)}),this.reselectIfClosed(e));try{await this.client.request(t,n)}finally{await this.refreshTabs([e])}}async optimistic(e,t){this.edits.set(e,!1);let n=this.selection.get();this.served&&this.acceptTasks(this.served,!0);try{let n=await t();return this.edits.has(e)&&this.edits.set(e,!0),n}catch(t){throw this.edits.delete(e),this.served&&this.acceptTasks(this.served,!0),n.taskId!==null&&this.selection.get().taskId!==n.taskId&&pa(this.tasks.get(),n.taskId)&&this.commitSelection(n.taskId,n.tabId),t}}acceptTasks(e,t=!1){this.served=e;let n=e;for(let[e,r]of this.edits)r&&!t?this.edits.delete(e):n=e(n);let r=[...this.tasks.get()?.tasks??[],...this.remote.get()];this.remote.set(n.tasks.filter(e=>e.machine)),this.tasks.set({...n,tasks:n.tasks.filter(e=>!e.machine)});let i=ma(r,n.tasks,this.selection.get(),this.visits.get());i?.taskId?this.commitSelection(i.taskId,i.tabId):i&&(this.selection.set(i),localStorage.setItem(ia,JSON.stringify(i)),this.reportViewing()),this.pendingSelect&&n.tasks.some(e=>e.id===this.pendingSelect)&&(this.select(this.pendingSelect),this.pendingSelect=null);let a=this.tabbedTasks(),o=new Set(a.map(e=>e.id)),s=this.tabs.get();Object.keys(s).some(e=>!o.has(e))&&this.tabs.set(Object.fromEntries(Object.entries(s).filter(([e])=>o.has(e))));for(let e of this.tabSets.keys())o.has(e)||this.tabSets.delete(e);let c=a.filter(e=>{let t=Object.keys(e.tabStatus??{}).sort().join(` `);return this.tabSets.get(e.id)!==t&&(this.tabSets.set(e.id,t),!0)});c.length>0&&this.scheduleTabRefresh(c.map(e=>e.id))}scheduleTabRefresh(e){if(!e)this.tabScope=null;else for(let t of e)this.tabScope?.add(t);if(this.tabTimer!==null)return;let t=Math.max(0,this.tabsReadAt+oa-Date.now());this.tabTimer=window.setTimeout(()=>{this.tabTimer=null,this.tabsReadAt=Date.now();let e=this.tabScope;this.tabScope=new Set,this.refreshTabs(e?[...e]:this.tabbedTasks().map(e=>e.id))},t)}async refreshTabs(e){await Promise.all(e.map(async e=>{let t=(this.tabReads.get(e)??0)+1;this.tabReads.set(e,t);let n;try{n=(await this.client.request(`task.tabs`,{taskId:e})).tabs}catch{return}this.tabReads.get(e)===t&&(this.tabs.set({...this.tabs.get(),[e]:n}),this.reselectIfClosed(e))})),this.tabsSettled.get()||this.tabsSettled.set(!0)}reselectIfClosed(e){let t=this.selection.get();t.taskId===e&&((this.tabs.get()[e]??[]).some(e=>e.id===t.tabId)||this.commitSelection(e,null))}};function ga(e){return e.find(e=>e.alive!==!1)??e[0]}function _a({model:e}){let t=_(e.selection),n=_(e.tasks),r=_(e.remote),i=pa(n,t.taskId)??r.find(e=>e.id===t.taskId),a=n?.attention.filter(e=>e.unread).length??0,o=`${a>0?`(${a}) `:``}${i?`${i.label} - `:``}rove`;return(0,h.useEffect)(()=>{document.title=o},[o]),null}var va=[`sidebar`,`workspace`,`files`];function ya(e,t,n){let r=va.filter(e=>e!==`files`||n.filesVisible),i=r.indexOf(e);if(i<0)return(t>0?r[r.length-1]:r[0])??null;let a=Math.min(Math.max(i+t,0),r.length-1);return a===i?null:r[a]??null}var ba=`.split-leaf.is-active textarea.xterm-helper-textarea`,xa={sidebar:[`.rail`,`.rail`],workspace:[`.workspace`,ba],files:[`.side-panel`,`.side-view:not([hidden]) :is([tabindex='0'], input)`]};function Sa(){for(let e of document.querySelectorAll(ba))if(e.closest(`[data-stream]`)?.getClientRects().length)return e;return null}function Ca(){let e=Sa();return e?.focus(),e!==null}function wa(e){let t=ya(Object.keys(xa).find(e=>document.activeElement?.closest(xa[e][0]))??`sidebar`,e,{filesVisible:document.querySelector(xa.files[0])!==null});t&&document.querySelector(xa[t][1])?.focus()}var Ta=[];function Ea(e){Ta.push(e)}var Da={workspace:`workspace`,sidebar:`sidebar`,files:`files`,terminal:`terminal`};function Oa(){let e=Ta.flatMap(e=>e()),t=new Set(e.filter(e=>!e.prefix).map(e=>e.id)),n=e.map(e=>{let t=Ei(e.id,e.prefix?`prefix`:`direct`);return t?{...e,chords:t}:e});for(let r of e){let e=r.prefix?Ei(r.id,`direct`):void 0;if(!e||e.length===0||t.has(r.id))continue;t.add(r.id);let i=li.find(e=>e.id===r.id)?.scope??`global`;n.push({...r,prefix:!1,chords:e,...Da[i]?{surface:Da[i]}:{}})}return n}function ka(e,t){return!e.surface||e.surface===t||t===`terminal`&&e.surface===`workspace`}function Aa(e,t){return e.surface===t?0:e.surface?1:2}function ja(){let e=document.activeElement;return e instanceof Element?e.closest(`.xterm`)?`terminal`:e.closest(`.rail`)?`sidebar`:e.closest(`.files`)?`files`:e.closest(`.workspace, .side-panel`)?`workspace`:null:null}function Ma(e,t){let n=new Set,r=new Set;for(let i of Oa())!ka(i,t)||i.live?.(e)===!1||(i.prefix?r:n).add(i.id);return{direct:n,prefix:r,inputPassthrough:t===`terminal`}}function Na(){let e=new Set(Oa().map(e=>e.id));return li.filter(t=>e.has(t.id))}var Pa=new Map,Fa=g(null);function Ia(e){return Pa.set(e.stream,e),()=>{Pa.get(e.stream)===e&&Pa.delete(e.stream),Fa.get()===e&&Fa.set(null)}}function La(e){return Pa.get(e)}Ea(()=>[{id:`terminal.scroll-up`,chords:[`ctrl+pageup`],prefix:!1,surface:`terminal`,run:()=>Fa.get()?.scrollPages(-1)},{id:`terminal.scroll-down`,chords:[`ctrl+pagedown`],prefix:!1,surface:`terminal`,run:()=>Fa.get()?.scrollPages(1)},{id:`terminal.reset`,chords:[`f5`],prefix:!1,surface:`terminal`,run:()=>Fa.get()?.reset()}]);var Ra={INPUT:!0,TEXTAREA:!0,SELECT:!0},za=`.rail, .side-panel, dialog, [role=dialog], [role=menu], [role=listbox]`;function Ba(e){return!e||e.tagName===`BODY`||e.tagName===`HTML`?`none`:e.closest(`.xterm`)?`terminal`:Ra[e.tagName]===!0||e.isContentEditable?`field`:e.closest(za)?`pane`:`loose`}function Va(e,t,n){return e.key!==`Escape`||e.defaultPrevented||e.isComposing||e.ctrlKey||e.metaKey||e.altKey||e.shiftKey||n.overlay||!n.terminal?!1:t===`none`||t===`loose`}function Ha(){(0,h.useEffect)(()=>{let e=e=>{if(e.key!==`Escape`)return;let t=Sa(),n=document.activeElement;if(!Va(e,Ba(n instanceof HTMLElement?n:null),{overlay:B.get()!==null||mn.get()!==null||V.get()!==null||Tn.get()!==null,terminal:t!==null}))return;let r=t?.closest(`[data-stream]`)?.dataset.stream,i=r?La(r):void 0;!t||!i||(e.preventDefault(),t.focus(),i.input(`\x1B`))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[])}function Ua(e){return e.focusedPane===`sidebar`?`sidebar`:e.hasSelection||e.hasOpenPage?`content`:`sidebar`}var Wa=`(max-width: 559px)`,Ga=g(`sidebar`),Ka=()=>Ga.set(`workspace`),qa=()=>Ga.set(`sidebar`);function Ja(e){V.set(e),Ka()}function Ya(e){bn.set(e),Ja(`compare`)}var Xa,Za=()=>(Xa??=window.matchMedia(Wa),Xa),Qa=()=>Za().matches,$a=e=>{let t=Za();return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)};function eo(){return(0,h.useSyncExternalStore)(e=>{let t=Za();return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)},()=>Za().matches)}function to(e,t,n){return Ua({focusedPane:e,hasSelection:t,hasOpenPage:n})}var no=Reflect.get(globalThis,`__roveRelay`);function ro(e,t){return no?no.fetch(e,t):fetch(e,t)}function io(e,t){return no?new no.WebSocket(e,t):new WebSocket(e,t)}function ao(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 oo(e=ro){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 K(e=ro){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 so(e,t=ro){try{let n=await t(`/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({password:e}),credentials:`omit`}),r=ao(n.status,await n.json().catch(()=>null));return r.kind===`ok`&&a(r.token),r}catch{return{kind:`unreachable`}}}async function co(e=ro){let t=i();o(),t&&await e(`/logout`,{method:`POST`,headers:{Authorization:`Bearer ${t}`}}).catch(()=>{})}function lo(e){if(!e)return null;switch(e.kind){case`ok`:return null;case`wrong`:return F(`login.wrong`);case`locked`:return F(`login.locked`,{minutes:e.minutes});case`lockedHost`:return F(`login.lockedHost`);case`unreachable`:return F(`login.unreachable`)}}function uo(){I();let[e,t]=(0,h.useState)(``),[n,r]=(0,h.useState)(!1),[i,a]=(0,h.useState)(null),o=lo(i);return(0,L.jsx)(`div`,{className:Zt,children:(0,L.jsxs)(`form`,{className:Qt,onSubmit:async i=>{if(i.preventDefault(),n||!e)return;r(!0);let o=await so(e);if(o.kind===`ok`){window.location.reload();return}t(``),a(o),r(!1)},children:[(0,L.jsxs)(`span`,{className:Yt,children:[(0,L.jsx)(`span`,{className:Xt,children:`[`}),` rove `,(0,L.jsx)(`span`,{className:Xt,children:`]`})]}),(0,L.jsx)(`h1`,{className:`${z} text-muted`,children:F(`login.title`)}),(0,L.jsx)(`p`,{className:`text-muted`,children:F(`login.body`)}),(0,L.jsx)(`input`,{className:ln,type:`password`,autoComplete:`current-password`,"aria-label":F(`login.field`),placeholder:F(`login.field`),autoFocus:!0,value:e,disabled:n,onChange:e=>{t(e.target.value),a(null)}}),o&&(0,L.jsx)(`p`,{className:`text-error`,role:`alert`,children:o}),(0,L.jsx)(`div`,{className:un,children:(0,L.jsx)(`button`,{type:`submit`,className:Be(),disabled:n||!e,children:F(n?`login.checking`:`login.submit`)})})]})})}function fo(e){return(0,L.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,L.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 po=120;function mo(e,t,n,r=e-t){return e+t+8<=n?e:Math.max(8,Math.min(r,n-t-8))}function ho(e){let{item:t}=e;return(0,L.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:Zn({selected:e.selected,open:e.open,danger:t.danger}),onMouseEnter:e.onEnter,onMouseLeave:e.onLeave,onClick:e.onPick,children:[(0,L.jsx)(`span`,{children:t.label}),t.children?(0,L.jsx)(fo,{right:!0,className:er(!!(e.selected||e.open))}):t.checked?(0,L.jsx)(`span`,{className:tr,"aria-hidden":!0,children:`✓`}):t.key&&(0,L.jsx)(`span`,{className:$n({selected:e.selected,danger:t.danger}),children:t.key})]})}function go(){let e=_(mn),[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,v]=(0,h.useState)({x:0,y:0});if((0,h.useLayoutEffect)(()=>{if(!e||!l.current)return;n(e.fromKeyboard?0:-1),i(null),c(!1);let{width:t,height:r}=l.current.getBoundingClientRect();m({x:mo(e.x,t,window.innerWidth),y:mo(e.y,r,window.innerHeight)});let a=e.target;return a?.setAttribute(`data-menu-open`,``),()=>a?.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();v({x:mo(t.right+2,i,window.innerWidth,t.left-i-2),y:mo(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=()=>mn.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 y=r===null?null:e.items[r]?.children,b=e=>{e.run&&(mn.set(null),e.run())},x=e=>{window.clearTimeout(f.current),i(e),c(!1),o(-1)};return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{ref:l,className:Xn(),role:`menu`,style:{left:p.x,top:p.y},children:e.items.map((a,o)=>(0,L.jsxs)(h.Fragment,{children:[o>0&&a.section!==e.items[o-1]?.section&&(0,L.jsx)(`hr`,{className:`-mx-1 my-1 h-px flex-none border-none bg-line`}),(0,L.jsx)(ho,{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),po):i(null)},onLeave:()=>{window.clearTimeout(f.current),o!==r&&n(-1)},onPick:()=>a.children?x(o):b(a)})]},a.label))}),y&&(0,L.jsx)(`div`,{ref:u,className:Xn(!0),role:`menu`,style:{left:g.x,top:g.y},children:y.map((e,t)=>(0,L.jsx)(ho,{item:e,selected:t===a,onEnter:()=>{o(t),c(!0)},onLeave:()=>o(-1),onPick:()=>b(e)},e.label))})]})}function _o(){let e=_(B),t=_(gn);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(go,{}),e,(0,L.jsx)(`div`,{className:nr,"aria-live":`polite`,children:t.map(e=>{let t=`${ir(e.tone===`error`)} ${e.leaving?`is-leaving`:``}`,n=e.action;return n?(0,L.jsxs)(`div`,{className:`${t} ${rr}`,children:[(0,L.jsx)(`span`,{children:e.text}),(0,L.jsx)(R,{onClick:()=>{Nn(e.id),n.run()},children:`[ ${n.label} ]`})]},e.id):(0,L.jsx)(`button`,{type:`button`,className:t,onClick:()=>Nn(e.id),children:e.text},e.id)})})]})}function vo(e){return e.urls[e.at]??``}function yo(e){try{return new URL(e).host.replace(/^www\./,``)}catch{return e}}function bo(){return{kind:`browser`,tabs:[{id:`t1`,urls:[],at:-1}],active:`t1`,recent:[`t1`],next:2}}function xo(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 So(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=ko(t,e.id)??t}return t}function Co(e,t){let n=`t${e.next}`,r={id:n,urls:t,at:t.length-1};return So(xo({...e,tabs:[...e.tabs,r],next:e.next+1},n))}function wo(e){return Co(e,[])}function To(e,t){return{...e,tabs:e.tabs.map(e=>e.id===t.id?t:e)}}function Eo(e,t,n){let r=e.tabs.find(e=>e.id===t);if(!r||vo(r)===n)return e;let i=[...r.urls.slice(0,r.at+1),n].slice(-30);return To(e,{...r,urls:i,at:i.length-1})}function Do(e,t,n){let r=e.tabs.find(e=>e.id===t);return!r||n===r.at||n<0||n>=r.urls.length?e:To(e,{...r,at:n})}function Oo(e,t){let n=e.tabs.find(e=>vo(e)===t);if(n)return xo(e,n.id);let r=e.tabs.find(e=>vo(e)===``);return r?Eo(xo(e,r.id),r.id,t):Co(e,[t])}function ko(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 Ao(e,t){return e.tabs.some(e=>e.id===t)?ko(e,t):e}function jo(e,t){let n=e.tabs.find(e=>e.id===t);return n?{...e,tabs:[n],active:t,recent:[t]}:e}function Mo(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 No(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 Po=[`quota`,`files`,`file`,`diff`,`chat`,`browser`],Fo=1e3;function Io(){return{columns:[{kind:`files`}],weights:{}}}function Lo(e,t){return e.columns.find(e=>e.kind===t)}function Ro(e){return e.slice(e.lastIndexOf(`/`)+1)}function zo(e,t){return{...e,columns:e.columns.map(e=>e.kind===t.kind?t:e)}}function Bo(e){return[...e].sort((e,t)=>Po.indexOf(e.kind)-Po.indexOf(t.kind))}function Vo(e,t){return{...e,columns:Bo([...e.columns,t])}}function Ho(e,t){return Lo(e,t)||t===`file`?e:Vo(e,t===`diff`?{kind:t,path:`.`,scope:`working`}:t===`browser`?bo():{kind:t})}function Uo(e,t){let n=Lo(e,`file`);return n?n.kind===`file`&&n.path===t?e:zo(e,{kind:`file`,path:t}):Vo(e,{kind:`file`,path:t})}function Wo(e,t,n){let r={kind:`diff`,path:t,scope:n},i=Lo(e,`diff`);return i?i.kind===`diff`&&i.path===t&&i.scope===n?e:zo(e,r):Vo(e,r)}function Go(e,t){let n=Lo(e,`browser`);return n?.kind===`browser`?zo(e,Oo(n,t)):Vo(e,Oo(bo(),t))}function Ko(e,t){if(!Lo(e,t))return e;let{[t]:n,...r}=e.weights;return{columns:e.columns.filter(e=>e.kind!==t),weights:r}}function qo(e,t){let n=Lo(e,`browser`);if(n?.kind!==`browser`)return e;let r=t(n);return r===n?e:r?zo(e,r):Ko(e,`browser`)}function Jo(e,t,n,r=!1){if(t&&Lo(e,n)){let t=Ko(e,n);return{panel:t,open:t.columns.length>0}}if(r){let t=e.columns.filter(e=>e.kind===n);return{panel:Ho({...e,columns:t},n),open:!0}}return{panel:Ho(e,n),open:!0}}function Yo(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*Fo)}function Xo(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 Zo(e){return Object.keys(e.weights).length===0?e:{...e,weights:{}}}function Qo(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 $o=Po.filter(e=>e!==`chat`&&e!==`file`),es=g(`terminal`),ts=`rove.web.panelWidth`,ns=`rove.web.panelOpen`,rs=g((()=>{let e=Number(localStorage.getItem(ts));return Number.isFinite(e)&&e>0?e:null})());rs.subscribe(()=>{let e=rs.get();e===null?localStorage.removeItem(ts):localStorage.setItem(ts,String(Math.round(e)))}),rs.subscribe(Ln);var is=g(localStorage.getItem(ns)===`1`);is.subscribe(()=>localStorage.setItem(ns,is.get()?`1`:`0`));var as=g(!1);is.subscribe(()=>{is.get()||as.set(!1)});function os(e,t,n=window.innerWidth){let r=Math.max(280,n-t-320);return Math.max(280,Math.min(r,Math.round(e)))}function ss(e,t,n=window.innerWidth){return e<2?null:os(Math.max(300,Math.min(440,n*.28))*e,t,n)}var cs=[`files`,`diff`,`browser`];function ls(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.taskId==`string`&&t.taskId!==``&&cs.includes(t.view)&&typeof t.at==`number`&&(t.url===void 0||typeof t.url==`string`)&&(t.path===void 0||typeof t.path==`string`)}function us(e){return e.narrow?{panel:!1,panelOpen:!1,narrow:!0}:{panel:!0,panelOpen:e.panelOpen&&!e.zen,narrow:!1}}function ds(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 fs(e,t){return t.url?Go(e,t.url):t.path?t.tab===`file`?Uo(e,t.path):Wo(e,t.path,`working`):Ho(e,t.tab)}var ps=[`files`,`chat`,`diff`,`browser`,`quota`],ms=e=>e===`branch`||e===`task`?e:`working`;function hs(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:ms(t.scope)}:t.kind===`browser`?No(t.tabs,t.active,t.recent,t.next):null}function gs(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 _s(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 vs(e){let t=_s(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:ms(n.scope)})}if(i===`browser`){let n=No(t.tabs.filter(e=>e.kind===`browser`),void 0,t.recent,e.next);n&&r.push(n)}}return{columns:Bo(r),weights:{}}}function ys(e){if(!e||typeof e!=`object`)return null;let t=e;if(!Array.isArray(t.columns))return vs(t);let n=[];for(let e of t.columns){let t=hs(e);t&&!n.some(e=>e.kind===t.kind)&&n.push(t)}return{columns:Bo(n),weights:gs(t.weights,n)}}function bs(e,t){let n=Io(),r=typeof t==`string`&&t!==``?t:``;return e!==`browser`&&!r?n:{...n,columns:[...n.columns,r?Oo(bo(),r):bo()]}}function xs(e){try{let t=JSON.parse(e??`{}`);return t&&typeof t==`object`&&!Array.isArray(t)?Object.entries(t):[]}catch{return[]}}function Ss(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 Cs(e,t){let n={};for(let[t,r]of xs(e)){let e=ys(r);e&&(n[t]=e)}let r=new Map(xs(t.tab).filter(([,e])=>ps.includes(e))),i=new Map(xs(t.url)),a=[...new Set([...r.keys(),...i.keys()])].filter(e=>!(e in n));n={...Object.fromEntries(a.map(e=>[e,bs(r.get(e),i.get(e))])),...n};for(let e of Object.keys(n).slice(0,-50))delete n[e];return n}var ws=`rove.web.panels`,Ts=`rove.web.panelTab`,Es=`rove.web.panelUrl`;function Ds(){let e={tab:localStorage.getItem(Ts),url:localStorage.getItem(Es)},t=Cs(localStorage.getItem(ws),e);return(e.tab!==null||e.url!==null)&&(localStorage.setItem(ws,JSON.stringify(t)),localStorage.removeItem(Ts),localStorage.removeItem(Es)),t}var Os=g(Ds()),ks=Io();function As(e){return _(Os)[e]??ks}function js(e){let t=As(e??``);return _(is)&&(e===null||t.columns.length>0)}function Ms(e,t){let n=Os.get()[e]??ks,r=t(n);if(r===n)return;let i=Ss(Os.get(),e,r);Os.set(i),localStorage.setItem(ws,JSON.stringify(i))}function Ns(e,t){Ms(e,e=>Ho(e,t)),is.set(!0),Qa()&&es.set(t)}function Ps(e,t){let n=is.get(),r=Jo(Os.get()[e]??ks,n&&!Sn.get(),t,!n);Ms(e,()=>r.panel),is.set(r.open),r.open&&Sn.get()&&Sn.set(!1)}function Fs(e){Ms(e.taskId,t=>Wo(t,e.path,e.scope)),is.set(!0),Sn.get()&&Sn.set(!1),Qa()&&es.set(`diff`)}function Is(e,t){Ms(e,e=>Uo(e,t)),is.set(!0),Sn.get()&&Sn.set(!1),Qa()&&es.set(`file`)}function Ls(e,t){Ms(e,e=>Go(e,t)),is.set(!0),Sn.get()&&Sn.set(!1),Qa()&&es.set(`browser`)}function Rs(e,t){let n=Os.get()[e]??ks;!Qa()&&n.columns.length===0&&is.set(!1),Qa()&&es.get()===t&&!Lo(n,t)&&Ns(e,`files`)}function zs(e,t){Ms(e,e=>Ko(e,t)),Rs(e,t)}function Bs(e,t){Ms(e,e=>qo(e,t)),Rs(e,`browser`)}function Vs(e,t){Bs(e,e=>Ao(e,t))}function Hs(e,t){let n=ds(e,{taskId:t,narrow:Qa()});Ms(e.taskId,e=>fs(e,n)),n.show&&(is.set(!0),Sn.get()&&Sn.set(!1))}var Us={Enter:`return`," ":`space`,Escape:`escape`,ArrowUp:`up`,ArrowDown:`down`,ArrowLeft:`left`,ArrowRight:`right`,PageUp:`pageup`,PageDown:`pagedown`};function Ws(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 Us[e.key]??e.key.toLowerCase()}function Gs(e){let t=Ws(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 Ks(e){return e.startsWith(`shift+`)&&e.length===7?e.slice(6).toUpperCase():e}var qs=new Map(li.map(e=>[e.id,{keys:[...e.keys],prefixKeys:e.prefixKeys&&[...e.prefixKeys],hint:e.hint?{...e.hint}:void 0}]));function Js(){return li.map(e=>{let t=qs.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 Ys=new Map(li.map(e=>[e.id,e]));function Xs(e){return Ys.get(e)}function Zs(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 Qs(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 $s(e){return e.hint?.keys??e.keys[0]}function ec(e){let t=Xs(e);if(!t)return null;let n=$s(t);return n&&n.length>0?n:null}function tc(e){return e.keys.length>0?e.hint?.keys??e.keys[0]??null:e.prefixKeys?.length?null:e.hint?.keys??null}function nc(e,t){return e.scope===`global`?!0:t===null?!1:e.scope===t||t===`terminal`&&e.scope===`workspace`}function rc(e,t,n,r){let i=[],a=[],o=[],s=new Map;for(let c of e){let e=tc(c),l=nc(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 ic={global:`Global`,sidebar:`Sidebar`,workspace:`Workspace`,files:`Files`,inbox:`Inbox`,terminal:`Terminal`};function ac(e){return e?ic[e]:`Global`}function oc(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`:Xs(e)?.category??`Global`}function sc(e,t,n){let r=e.trim();return Zs(r,t)||Zs(r,n)}var cc={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`}},lc={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:`检查已通过`}},uc={status:{commands:`{key} commands`,help:`{key} help`,sidebar:`{key} sidebar`,settings:`settings`},pane:{move:`move`,open:`open`,collapse:`collapse`,diff:`diff`}},dc={status:{commands:`{key} 命令`,help:`{key} 帮助`,sidebar:`{key} 侧栏`,settings:`设置`},pane:{move:`移动`,open:`打开`,collapse:`折叠`,diff:`差异`}},fc={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`}},pc={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 mc(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 hc(e,t){return Me.get()===`zh`?t:e}function gc(e,t){return t?e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e)):e}var _c=(e,t)=>gc(mc(hc(cc,lc),e)??mc(cc,e)??e,t),vc=(e,t)=>gc(mc(hc(uc,dc),e)??mc(uc,e)??e,t),yc=(e,t)=>gc(mc(hc(Xr,Zr),e)??mc(Xr,e)??e,t);function bc(e){return hc(fc,pc).desc[e]??fc.desc[e]??e}function xc(e){let t=bc(e),n=t.search(/\s—\s|——/);return n>0?t.slice(0,n):t}function Sc(e){return hc(fc,pc).category[e]??e}var Cc=(e,t)=>gc(mc(hc(ei,ti),e)??mc(ei,e)??e,t),wc=(e,t)=>gc(mc(hc(Jr,Yr),e)??mc(Jr,e)??e,t),Tc=e=>e.split(` + `).map(e=>pi(e)).join(` + `);function Ec(e){let t=Sc(ac(e.scope));return e.kind===`here`?_c(`here`,{surface:t}):e.kind===`direct`?_c(`direct`):e.kind===`prefix`?_c(`afterPrefix`):_c(`otherPane`,{surface:t})}function Dc(e){let t=document.activeElement instanceof HTMLElement?document.activeElement:null;B.set((0,L.jsx)(Oc,{model:e,surface:ja(),origin:t}))}function Oc({model:e,surface:t,origin:n}){I();let r=_(hi),[i,a]=(0,h.useState)(!1),[o,s]=(0,h.useState)(``),c=(0,h.useRef)(null),l=(0,h.useMemo)(()=>Ma(e,t),[e,t]),u=(0,h.useMemo)(()=>rc(Na(),t===`terminal`?`terminal`:t,bi(),l),[l,t,r]).map(e=>({...e,rows:e.rows.filter(e=>sc(o,bc(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===`?`)Pn();else if(!i&&t.key===`/`)a(!0);else return;t.preventDefault()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[i]),(0,L.jsx)(Tr,{title:_c(`title`),wide:!0,children:(0,L.jsxs)(`div`,{className:`${Yn} help`,children:[(0,L.jsxs)(`div`,{className:bt,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`p`,{className:`text-muted`,children:t?_c(`focused`,{surface:Sc(ac(t))}):_c(`allBindings`)}),(0,L.jsx)(`p`,{className:`text-muted`,children:_c(`grammar`,{prefix:xi()})})]}),(0,L.jsxs)(`div`,{className:xt,children:[(0,L.jsx)(`span`,{className:`subtle`,children:_c(`scrollKeys`)}),(0,L.jsx)(`button`,{type:`button`,className:sn,onClick:Pn,children:_c(`esc`)})]})]}),i?(0,L.jsx)(`input`,{className:ln,autoFocus:!0,spellCheck:!1,value:o,placeholder:_c(`search`),onChange:e=>{s(e.target.value),c.current?.scrollTo({top:0})}}):(0,L.jsx)(`p`,{className:`text-muted`,children:_c(`filter`)}),u.length===0&&(0,L.jsx)(`p`,{className:`text-muted`,children:_c(`noResults`)}),(0,L.jsx)(`div`,{className:St,ref:c,children:u.map((e,t)=>(0,L.jsxs)(`section`,{className:Ct,children:[(0,L.jsx)(`h2`,{className:wt,children:Ec(e)}),e.rows.map(t=>(0,L.jsxs)(`div`,{className:Tt,children:[(0,L.jsx)(`span`,{className:`mono ${Et}`,children:Tc(t.primary)}),(0,L.jsx)(`span`,{className:`flex-1`,children:bc(t.binding.id)}),t.aliases.length>0&&(0,L.jsx)(`span`,{className:`text-muted`,children:`(${t.aliases.map(Tc).join(`, `)})`})]},`${e.kind}-${t.binding.id}`))]},`${e.kind}-${e.scope??t}`))})]})})}function kc(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 Ac(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 jc=e=>e===`routine_failed`,Mc=e=>`${e.taskId??``}:${e.tabId??``}`;function Nc(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)||Mc(e).localeCompare(Mc(t)))}function Pc(e,t,n){let r=new Set(t),i=Nc(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=>Mc(e)===Mc(n));return a<0||i.length===1?i[0]??null:i[(a+1)%i.length]??null}function Fc(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 Ic(e,t,n=!1){let r=`attention.dismiss`,i;if(jc(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=>H(String(e),`error`))}function Lc(e,t){Ic(e,t),Pn(),yn.set(t.automationId??null),V.set(`routines`)}var Rc=524288e3,zc=1048576;function Bc(e,t){return/\.pdf$/i.test(e)?`pdf[${t}]`:/\.(png|jpe?g|gif|webp)$/i.test(e)?`images[${t}]`:`files[${t}]`}function Vc(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 Hc(e,t){let n=e.replace(/\s+$/,``),r=Vc(e);for(let e of t){let t=`${Bc(e,r)}: ${e}`;n=n.length>0?`${n}\n${t}`:t,r+=1}return n}function Uc(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 Wc(e,t){if(t.size>524288e3)throw Error(F(`pages.attachTooLarge`,{name:t.name}));let n={mime:t.type,name:t.name},r=async(e,n)=>Uc(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+zc,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 Gc(e,t){return(await Wc(e,t)).path}function Kc(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 qc=`size-14 rounded-sm border-hairline border-line object-cover`;function Jc({name:e,thumb:t}){if(t)return(0,L.jsx)(`img`,{src:t,alt:``,draggable:!1,className:qc});let n=e.includes(`.`)?e.split(`.`).pop()??``:``;return(0,L.jsx)(`span`,{className:`${qc} flex items-center justify-center font-mono text-meta uppercase text-muted`,children:n.slice(0,4)||`file`})}function Yc({item:e,onRemove:t}){let[n]=(0,h.useState)(e.pending);return(0,L.jsxs)(`li`,{className:`group relative size-14 shrink-0 ${n?`motion-safe:animate-rise-in`:``}`,title:`${e.name} · ${Kc(e.size)}`,children:[(0,L.jsx)(`div`,{className:`transition-opacity duration-150 motion-reduce:transition-none ${e.pending?`opacity-50`:``}`,children:(0,L.jsx)(Jc,{...e})}),(0,L.jsx)(`button`,{type:`button`,"aria-label":F(`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 Xc({items:e,onRemove:t}){return e.length===0?null:(0,L.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,L.jsx)(Yc,{item:e,onRemove:t},e.id))})}function Zc(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 Qc(e){return(0,L.jsxs)(`label`,{className:e.className,title:e.title,children:[e.children,(0,L.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 $c={image:`images`,pdf:`pdf`};function el(e,t){let n=t.filter(e=>e.path!==void 0);return n.length===0?e:`${e}\n\n${n.map((e,t)=>`${$c[e.kind??`image`]??`files`}[${t}]: ${e.path}`).join(`
17
17
  `)}`}var tl=112;async function nl(e){if(e.type.startsWith(`image/`))try{let t=await createImageBitmap(e),n=Math.min(1,tl/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 rl(e){if(!e)return[];try{let t=JSON.parse(sessionStorage.getItem(e)??`[]`);return Array.isArray(t)?t:[]}catch{return[]}}var il=0;function al(e,t,n){let[r,i]=(0,h.useState)(()=>rl(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()}-${il++}`,i=await nl(n);s(e=>[...e,{id:r,name:n.name,size:n.size,mime:n.type,...i?{thumb:i}:{}}]);try{let t=await Wc(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 ol(e){return(0,L.jsx)(Xc,{items:e.attachments.map(e=>({...e,pending:e.path===void 0})),onRemove:e.onRemove})}function sl(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,L.jsx)(`div`,{ref:t,className:Vn,"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,L.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:Hn(t.id===e.value,t.dim),title:t.title,onClick:()=>e.onChange(t.id),children:t.label},t.id))})}function cl(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(hover: none) and (pointer: coarse)`).matches}var ll=/^(?:enter|return|tab|esc|space|shift|ctrl\+\S+|cmd\+\S+|alt\+\S+|[↑↓←→]+(?:\/[↑↓←→]+)?|[b-hj-z](?:\/[b-hj-z])?)(?:\/\S+)?(?:\s|$)/i;function ul(e){return e.split(`·`).map(e=>e.trim()).filter(e=>e&&!ll.test(e)).join(` · `)}function dl(e){return cl()?ul(e):e}function fl(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 pl(e){let t=e.lastIndexOf(`/`);return t<0||t===e.length-1?{base:e,dir:``}:{base:e.slice(t+1),dir:e.slice(0,t+1)}}function ml(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>e.toLowerCase().includes(n)):e}function hl(e){return e.startsWith(`~`)||e.includes(`/`)}function gl(e,t){return t?e===`~`?t:e.startsWith(`~/`)?t+e.slice(1):e:e}function _l(e){return e.length>1?e.replace(/\/+$/,``):e}var vl=/^(?:(?:https?|ssh|git):\/\/[A-Za-z0-9[]\S*|[A-Za-z0-9._-]+@[A-Za-z0-9][A-Za-z0-9.-]*:\S+)$/i,yl=/^[A-Za-z0-9][A-Za-z0-9-]{0,38}\/(?![.]+(?:git)?$)[A-Za-z0-9._-]{1,100}$/i;function bl(e){let t=e.trim();return vl.test(t)||yl.test(t)?t:null}function xl(e,t){return e.filter(e=>e.enabled!==!1||e.id===t)}function Sl(e,t){return(e.find(e=>e.id===t)??e.find(e=>e.ready!==!1)??e[0])?.id??``}function Cl(e,t){return!e||e.acceptsModel===!1?[]:[{id:``,label:t},...(e.models??[]).map(e=>({id:e.id,label:e.label??e.id}))]}function wl(e,t){let n=e?.effortLevels??[];return n.length===0?[]:[{id:``,label:t},...n.map(e=>({id:e,label:e}))]}function Tl(e,t,n,r){let i=t?e.find(e=>e.id===t)?.label??t:r;return n?`${i} ${n}`:i}function El(e,t){return e.includes(t)?e.length>1?e.filter(e=>e!==t):e:[...e,t]}function Dl(e){let[t,n,...r]=e;return!t||!n?t??``:r.length>0?`${t} + ${n} +${r.length}`:`${t} + ${n}`}function Ol(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 kl(e){let[t,...n]=e;if(!t)return``;let r=pl(t).base;return n.length>0?`${r} +${n.length}`:r}function Al(e,t){return e.includes(t)?e.filter(e=>e!==t):e.length>=8?e:[...e,t]}function jl(e,t){if(!/^[1-9]$/.test(e))return null;let n=Number(e)-1;return n<t?n:null}function Ml(e){let[t,...n]=e.repos;if(!t)throw Error(`no repo`);let r=e.at?fl(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}:{},...!i&&e.effort?{effort:e.effort}:{}}}async function Nl(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 Pl(e,t,n,r,i=r.trim(),a){let o=n?{engine:n}:{},s=r.trim()?fl(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 Fl(e,t){let n=e.querySelector(`[data-field="${t}"]`);(n?.matches(`input, textarea`)?n:n?.querySelector(`[tabindex='0']`))?.focus()}function Il(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&&Fl(e,a)}var Ll=new WeakMap,Rl=200,zl=e=>`client`in e?e.client:e,q=(e,t)=>t?`${e} ${JSON.stringify(t)}`:e;function J(e,t,n){return Ll.get(zl(e))?.get(q(t,n))}function Y(e,t,n,r){let i=zl(e),a=Ll.get(i)??new Map,o=q(t,n);a.delete(o),a.set(o,r),Ll.set(i,a);for(let e of a.keys()){if(a.size<=Rl)break;a.delete(e)}return r}function X(e,t,n){return zl(e).request(t,n).then(r=>Y(e,t,n,r))}function Bl(e,t,n){return n&&n!==`leaf-1`?`${e}::${t}::${n}`:`${e}::${t}`}function Vl(e,t,n){let r=t?{repo:t}:{},[i]=(0,h.useState)(()=>{let t=J(e,`engines.list`,r),i=t?xl(t.engines):[];return{offered:i,engine:t?Sl(i,n??t.preferred):``}}),[a,o]=(0,h.useState)(i.offered),[s,c]=(0,h.useState)(i.engine);return(0,h.useEffect)(()=>{X(e,`engines.list`,r).then(e=>{let t=xl(e.engines);o(t),c(Sl(t,n??e.preferred))}).catch(()=>o([]))},[e]),{engines:a,engine:s,setEngine:c}}var Hl=`shell`,Ul=`pane:`,Wl=e=>e.startsWith(Ul),Gl=e=>e.slice(5);function Kl(e){let[t,n]=(0,h.useState)(()=>J(e,`plugin.panes`)?.panes??[]);return(0,h.useEffect)(()=>{X(e,`plugin.panes`).then(e=>n(e.panes)).catch(()=>n([]))},[e]),t}function ql(e){let t=[...e.engines,...e.withShell?[{id:Hl,name:F(`tab.shell`)}]:[],...(e.panes??[]).map(e=>({id:Ul+e.id,name:e.title}))];return(0,L.jsx)(sl,{label:F(`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?F(`newTask.notReady`):void 0}))})}function Jl(e,t){return Yl(e,t,{kind:`engine`,latest:!0}).catch(e=>H(String(e),`error`))}async function Yl(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 La(Bl(t,r))?.reattach(),e.select(t,r)}async function Xl(e){await Yl(e,(await e.client.request(`task.openScratch`,{})).taskId,{kind:`shell`})}var Zl=[`1`,`2`,`3`,`4`,`5`],Ql=[`tab`,`fork`,`scratch`],$l=[`message`,`attempts`,`engine`,`fork-base`,`destination`];function eu(e){I();let{model:t,taskId:n}=e,r=t.tasks.get()?.tasks.find(e=>e.id===n),i=Vl(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}=Er(),{attachments:b,attach:x,remove:S,ready:C}=al(t,v),w=s===`fresh`&&a!==`fork`,T=a===`tab`&&s===`fresh`,E=Kl(t),D=i.engine===`shell`&&!w||Wl(i.engine)&&!T?``:i.engine,O=D===Hl,k=Wl(D),ee=a===`fork`,A=(e,t)=>{let n=e===`scratch`&&t===`continue`&&a===`scratch`?`tab`:e;o(n),c(n===`scratch`?`fresh`:t)},te=()=>{let r=t.selection.get();return e.sourceTabId??(r.taskId===n?r.tabId:null)??`tab-1`},ne=()=>t.tasks.get()?.tasks.find(e=>e.id===n)?.tabStatus?.[te()]?.reason===`dead`,j=async()=>{let e=await t.client.request(`tab.handoff`,{taskId:n,tabId:te()});if(e.kind===`handoff`&&e.prompt)return e.prompt;throw Error(e.kind===`no-transcript`?W(`terminal`,`tab.noTranscriptToHandOff`,{engine:e.engine??``}):W(`terminal`,`tab.nothingToFork`))},re=()=>y(async()=>{let e=s===`continue`&&a===`tab`&&!O&&!k&&ne(),i=[s===`continue`&&!e?await j():``,el(l.trim(),await C())].filter(Boolean).join(`
18
18
 
19
- `);if(a===`scratch`){let e=await t.client.request(`task.openScratch`,O?{}:{engine:D});O?await Yl(t,e.taskId,{kind:`shell`}):t.selectWhenListed(e.taskId)}else if(ee){if(!r)throw Error(W(`terminal`,`tab.tabGone`));if(!l.trim())throw Error(F(`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=Ol(e);if(!t)throw e;H(e instanceof Error?e.message:String(e),`error`),Ya(t);return}a.forkRefused&&H(F(`taskops.forkLeftBehind`,{reason:a.forkRefused}));let o=a.taskIds[0];a.groupId?Ya(a.groupId):o&&t.selectWhenListed(o)}else if(O)await Yl(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:Gl(D),...r?{tabId:r}:{}});await t.refreshTabsNow(n),t.select(n,i.tabId)}else await Yl(t,n,{kind:`engine`,engine:D,prompt:i,...e?{replaceTab:te()}:{}})});return(0,L.jsx)(Tr,{title:W(`terminal`,`tab.newChat.title`),wide:!0,children:(0,L.jsxs)(`form`,{className:Yn,onKeyDown:e=>{if(e.key===`Tab`&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&(ee||!e.shiftKey))e.preventDefault(),e.stopPropagation(),ee?Il(e.currentTarget,$l,e.shiftKey?-1:1):A(Ql[(Ql.indexOf(a)+1)%Ql.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(),A(a,s===`fresh`?`continue`:`fresh`)):e.key===`Enter`&&ee&&e.target.closest(`[data-field=attempts], [data-field=engine]`)&&(e.preventDefault(),e.currentTarget.requestSubmit())},onSubmit:e=>{e.preventDefault(),re()},onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),x(Array.from(e.dataTransfer.files))},children:[(0,L.jsxs)(`div`,{className:zn,children:[(0,L.jsx)(`span`,{className:`${z} text-muted`,children:W(`terminal`,`tab.newChat.engine`)}),(0,L.jsx)(ql,{engines:i.engines,value:D,onChange:i.setEngine,withShell:w,panes:T?E:[]})]}),(0,L.jsxs)(`div`,{className:zn,children:[(0,L.jsx)(`span`,{className:`${z} text-muted`,children:W(`terminal`,`tab.newChat.destLabel`)}),(0,L.jsx)(sl,{label:W(`terminal`,`tab.newChat.destLabel`),field:`destination`,value:a,onChange:e=>A(e,s),choices:Ql.map(e=>({id:e,label:W(`terminal`,`tab.newChat.dest${e===`tab`?`Tab`:e===`fork`?`Fork`:`Scratch`}`)}))})]}),(0,L.jsxs)(`div`,{className:zn,children:[(0,L.jsxs)(`span`,{className:`${z} text-muted`,children:[W(`terminal`,`tab.newChat.ctxLabel`),` `,(0,L.jsx)(`span`,{className:`keys-only`,children:`ctrl+f`})]}),(0,L.jsx)(sl,{label:W(`terminal`,`tab.newChat.ctxLabel`),field:`context`,value:s,onChange:e=>A(a,e===`continue`?`continue`:`fresh`),choices:[`fresh`,`continue`].map(e=>({id:e,label:W(`terminal`,`tab.newChat.ctx${e===`fresh`?`Fresh`:`Continue`}`)}))})]}),ee&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:W(`quickTask`,`attemptsLabel`)}),(0,L.jsx)(sl,{label:W(`quickTask`,`attemptsLabel`),field:`attempts`,value:d,onChange:f,choices:Zl.map(e=>({id:e,label:e}))})]}),(0,L.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:F(`taskops.forkBranch`)}),(0,L.jsx)(`input`,{className:ln,"data-field":`fork-base`,spellCheck:!1,value:p,onChange:e=>m(e.target.value)})]})]}),!O&&!k&&a!==`scratch`&&(0,L.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:F(`newChat.prompt`)}),(0,L.jsx)(`textarea`,{className:`${ln} min-h-18 max-h-[50vh] leading-[1.45]`,"data-field":`message`,autoFocus:!0,rows:4,placeholder:F(`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,L.jsx)(ol,{attachments:b,onRemove:S}),cl()?(0,L.jsx)(`p`,{className:`text-muted`,children:F(`pages.attachHintTouch`)}):(0,L.jsx)(`p`,{className:`keys-only mx-0 mt-2 mb-0 ${tn}`,children:W(`quickTask`,`legend`)}),_&&(0,L.jsx)(`p`,{className:`text-error`,children:_}),(0,L.jsx)(Ar,{busy:g,submitLabel:F(`newChat.start`)})]})})}var tu=e=>e.split(`/`).filter(Boolean).pop()??e;function nu(e,t,n=``){let r=tu(e),i=t.filter(t=>(t.repo!==e||t.host!==n)&&tu(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 ru=e=>e.startsWith(`root:`)?null:e.split(`/`).slice(-2).join(`/`);function iu(e,t){let n=tu(e.repo),r=t.filter(t=>t!==e&&tu(t.repo)===n);if(r.length===0)return n;let i=e.repoId,a=i?ru(i):null;return i&&a?r.some(e=>e.repoId&&e.repoId!==i&&ru(e.repoId)===a)?i:a:nu(e.repo,[e,...r].map(e=>({repo:e.repo,host:``})))}var au=/\s+#\d+\/\d+$/,ou=(e,t)=>(e.createdAt??``).localeCompare(t.createdAt??``)||e.id.localeCompare(t.id),su=e=>e.groupId&&e.kind!==`main`?`${e.machine?.id??``}\0${e.groupId}`:null;function cu(e){let t=new Map;for(let n of e){let e=su(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(ou);return t}function lu(e){return(e[0]?.label??``).replace(au,``)}function uu(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 du=[`default`,`recent`,`attention`,`name`],fu={folded:new Set,opened:new Set},pu=e=>{let t=Date.parse(e??``);return Number.isFinite(t)?t:0},mu=e=>pu(e.updatedAt??e.createdAt),hu=e=>pu(e.createdAt),gu=(e,t)=>hu(t)-hu(e)||t.id.localeCompare(e.id),_u=(e,t)=>mu(t)-mu(e)||t.id.localeCompare(e.id),vu=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`}),yu={default:null,recent:gu,attention:(e,t)=>e.rank-t.rank||_u(e,t),name:(e,t)=>vu.compare(e.label.trim(),t.label.trim())||e.id.localeCompare(t.id)},bu=`~scratch`,xu=e=>e.kind===`dir`&&(e.scratch===!0||e.noProject===!0);function Su(e,t){return[...e].sort((e,t)=>(e.order??e.rank)-(t.order??t.rank)).sort(Tu(yu[t]))}function Cu(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=xu(e)?bu:e.repo,n=r.get(t);n?n.push(e):r.set(t,[e])}let i=yu[t],a=[...r].map(([e,t])=>{let n=t.sort(Tu(i));if(e===`~scratch`&&t.every(xu))return{repo:``,label:F(`rail.noProject`),tasks:n,key:bu,noProject:!0};let r=t.find(e=>e.repoId)?.repoId;return{repo:e,label:tu(e),tasks:n,...r?{repoId:r}:{}}});return[...a.filter(e=>e.noProject),...a.filter(e=>!e.noProject)]}var wu=e=>e.kind===`main`?0:e.pinned?1:2,Tu=e=>(t,n)=>wu(t)-wu(n)||(e?e(t,n):0);function Eu(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 Du(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)||Eu(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 Ou(e,t,n=[]){for(let r of e.get(t)??[])n.push(r.id),Ou(e,r.id,n);return n}function ku(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 Au(e,t=``,n=fu,r=0,i=!0){let a=t.trim(),o=(...e)=>e.some(e=>e!==``&&Zs(a,e)),{children:s,nested:c}=Du(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,tu(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?Ou(s,t.id):[],m=u!==void 0&&a===``&&ku(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?cu(t):new Map,o=new Set;for(let i of t){let t=su(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:lu(s),tasks:s,depth:Math.min(l,3),...c.machine?{machine:c.machine.id}:{}});let u=uu(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 ju=e=>Math.max(0,...e.tasks.map(hu));function Mu(e){let t=e.tasks.filter(e=>!e.routine),n=e.remote.filter(e=>!e.routine),r=[...Cu(t,e.sort).map(e=>({group:e})),...e.machines.flatMap(t=>Cu(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?bu:t??(e.machine===void 0?n:`${e.machine}\0${n}`),a=i.get(r);a?a.push(e):i.set(r,[e])}let a=yu[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(Tu(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:iu(e,s)])),l=s.map(e=>({...e,label:c.get(e)??e.label}));return e.sort===`recent`&&l.sort((e,t)=>ju(t)-ju(e)),e.sort===`name`&&l.sort((e,t)=>vu.compare(e.label,t.label)),l.sort((e,t)=>Number(t.noProject===!0)-Number(e.noProject===!0)),{rows:Au(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 Nu(e){return e.title??e.engineName??(e.kind===`engine`?F(`tab.engine`):F(`tab.shell`))}function Pu(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 Fu(e){return e.kind===`leaf`?[e]:e.children.flatMap(Fu)}function Iu(e){return!!e&&Fu(e.root).length>1}function Lu(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 Ru(e,t,n=1){let r=Fu(e.root).map(e=>e.id),i=r.indexOf(t);return r[(Math.max(0,i)+n+r.length)%r.length]??t}function zu(e,t){let n=new Map,r=new Map;for(let i of Fu(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 Bu(e,t,n){return e.kind===`engine`&&Fu(t.root).some(e=>e.id===n&&e.own)}function Vu(e){return e.alive!==!1||!!e.split&&!Fu(e.split.root).some(e=>e.own)}function Hu(e){return Fu(e.root).map(e=>e.id).join(`,`)}function Uu(e){return!(e instanceof HTMLElement)||e.closest(`.xterm`)?!1:e.isContentEditable||[`INPUT`,`TEXTAREA`,`SELECT`].includes(e.tagName)}function Wu(e){return e instanceof HTMLElement&&!!e.closest(`.rail, button, a`)}var Gu=e=>e.tabs.get()[e.selection.get().taskId??``]??[];function Ku(e){let{taskId:t,tabId:n}=e.selection.get(),r=Gu(e);return{taskId:t,tabs:r,at:r.findIndex(e=>e.id===n)}}function qu(e,t){let{taskId:n,tabs:r}=Ku(e),i=r[t];!n||!i||e.select(n,i.id)}function Ju(e){let{taskId:t,tabs:n,at:r}=Ku(e),i=n[r];!t||!i||B.set((0,L.jsx)(Dr,{title:F(`menu.renameTab`),initial:Nu(i),submitLabel:F(`dialog.save`),onSubmit:async n=>{await e.renameTab(t,i.id,n)}}))}var Yu=e=>!!e.selection.get().taskId,Xu=e=>Gu(e).length>0,Zu=[{id:`help.open`,chords:[`f1`],prefix:!1,run:Dc},{id:`focus.next`,chords:[`f4`],prefix:!1,run:()=>wa(1)},{id:`chat.tab.chooseEngine`,chords:[`ctrl+e`],prefix:!1,surface:`workspace`,live:Yu,run:e=>{let{taskId:t}=e.selection.get();t&&B.set((0,L.jsx)(eu,{model:e,taskId:t}))}},{id:`chat.tab.rename`,chords:[`f2`],prefix:!1,surface:`workspace`,live:e=>{let{tabs:t,at:n}=Ku(e);return!!t[n]&&!Iu(t[n]?.split)},run:Ju},{id:`chat.tab.cycle-next`,chords:[`ctrl+]`],prefix:!1,surface:`workspace`,live:Xu,run:e=>qu(e,(Ku(e).at+1)%Gu(e).length)},{id:`chat.tab.cycle-prev`,chords:[`ctrl+[`],prefix:!1,surface:`workspace`,live:Xu,run:e=>qu(e,(Ku(e).at-1+Gu(e).length)%Gu(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:Xu,run:(e,t=``)=>{let n=Oa().find(e=>e.id===`chat.tab.goto`&&!e.prefix)?.chords.indexOf(t)??-1;n>=0&&qu(e,n)}},{id:`attention.next`,chords:[`f7`],prefix:!1,run:e=>$u(e)}];Ea(()=>Zu);function Qu(e){(0,h.useEffect)(()=>{let t=t=>{if(B.get()||Uu(t.target))return;let n=V.get();if(n===`worktrees`)return;let r=ja()??(Yu(e)?`workspace`:`sidebar`),{taskId:i}=e.selection.get();if(!n&&i&&!t.ctrlKey&&!t.shiftKey&&!t.metaKey&&!t.altKey&&t.key===`Enter`&&!Xu(e)&&!Wu(t.target)){t.preventDefault(),t.stopPropagation(),B.set((0,L.jsx)(eu,{model:e,taskId:i}));return}let a=Gs(t),o=Oa().filter(t=>!t.prefix&&!t.native&&t.chords.some(e=>a.includes(e))&&ka(t,r)&&!(n&&t.surface)&&t.live?.(e)!==!1).sort((e,t)=>Aa(e,r)-Aa(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 $u(e){let t=e.tasks.get();if(!t)return;let n=Pc(t.attention,t.tasks.map(e=>e.id),e.selection.get());if(!n){H(F(`inbox.empty`));return}if(jc(n.state)){Lc(e,n);return}n.taskId!==null&&(e.select(n.taskId,n.tabId),Ic(e,n))}async function ed(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){H(F(`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){H(U(e),`error`)}}function td(e){(0,h.useEffect)(()=>{let t=t=>{let n=hi.get().plugins;if(n.length===0||!Oi({dialog:B.get()!==null,page:V.get()})||Uu(t.target))return;let r=Di(n,Gs(t));r&&(t.preventDefault(),t.stopImmediatePropagation(),ed(e,r))};return window.addEventListener(`keydown`,t,{capture:!0}),()=>window.removeEventListener(`keydown`,t,{capture:!0})},[e])}var nd=`prefix.moreCommands`,rd=/^ctrl\+[^+]+$/;function id(e){return rd.test(e)?e.slice(5):null}function ad(e){let t=Xs(e.bindingId);if(!t)return null;if(e.reachability.direct.has(e.bindingId)){let e=t.keys[0];if(e)return pi(e)}if(e.prefixKey&&e.reachability.prefix.has(e.bindingId)){let n=t.prefixKeys?.[0];if(n)return`${pi(e.prefixKey)} ${pi(n)}`}return null}function od(e,t){let n=li.filter(t=>e.direct.has(t.id)).flatMap(e=>{let t=e.keys.flatMap(e=>id(e)??[]);return t.length>2?[{stroke:`${t[0]}-${t.at(-1)}`,action:e.id}]:t.map(t=>({stroke:t,action:e.id}))}),r=t?id(t):null;return r&&e.prefix.size>0&&n.push({stroke:r,action:nd}),n}var sd=4e3,cd=180,ld=sd,ud=g({guide:null,entries:[]}),dd=1;function fd(e,t){let n={id:dd++,stroke:e,action:t,at:Date.now()};ud.set({guide:null,entries:[...ud.get().entries,n].slice(-3)})}var pd=class extends Error{code;detail;constructor(e,t,n){super(t),this.code=e,this.detail=n}},md=[500,1e3,2e3,4e3,8e3,15e3],hd=4e3,gd=1e4,_d=class{url;token;conn=g({state:`connecting`,hello:null,failures:0});ws=null;nextId=1;pending=new Map;listeners=new Map;openHooks=new Set;retryTimer=null;deadline=null;constructor(e,t){this.url=e,this.token=t}start(){this.connect();let e=()=>{document.visibilityState===`visible`&&this.checkNow()};document.addEventListener(`visibilitychange`,e),window.addEventListener(`online`,e),window.addEventListener(`pageshow`,e)}checkNow(){if(this.retryTimer!==null){this.retryNow();return}let e=this.ws;!e||this.conn.get().state!==`open`||this.deadline!==null||(this.armDeadline(e,hd),this.request(`hello`).then(()=>this.clearDeadline(),e=>{e instanceof pd&&e.code!==`NOT_CONNECTED`&&this.clearDeadline()}))}armDeadline(e,t){this.clearDeadline(),this.deadline=window.setTimeout(()=>this.lost(e),t)}clearDeadline(){this.deadline!==null&&window.clearTimeout(this.deadline),this.deadline=null}onOpen(e){return this.openHooks.add(e),this.conn.get().state===`open`&&e(),()=>this.openHooks.delete(e)}on(e,t){let n=this.listeners.get(e);return n||(n=new Set,this.listeners.set(e,n)),n.add(t),()=>n.delete(t)}request(e,t={},n){let r=this.ws;if(!r||r.readyState!==WebSocket.OPEN)return Promise.reject(new pd(`NOT_CONNECTED`,`not connected to rove`));let i=this.nextId++;return new Promise((a,o)=>{this.pending.set(i,{resolve:e=>a(e),reject:o,progress:n}),r.send(JSON.stringify({id:i,op:e,args:t}))})}connect(){this.retryTimer=null;let e=io(this.url,this.token?[`rove.v1`,`rove.bearer.${this.token}`]:[`rove.v1`]);this.ws=e,this.armDeadline(e,gd),e.onmessage=e=>this.receive(String(e.data)),e.onopen=()=>{this.request(`hello`).then(e=>{this.clearDeadline(),this.conn.set({state:`open`,hello:e,failures:0});for(let e of this.openHooks)e()},()=>this.lost(e))},e.onclose=t=>this.lost(e,t?.code)}lost(e,t){if(this.ws!==e)return;this.ws=null,this.clearDeadline(),e.onopen=null,e.onclose=null,e.onmessage=null,e.close();for(let e of this.pending.values())e.reject(new pd(`NOT_CONNECTED`,`connection lost`));if(this.pending.clear(),t===4401){o(),this.conn.set({state:`retrying`,hello:null,failures:2});return}let n=this.conn.get().failures+1;this.conn.set({state:`retrying`,hello:this.conn.get().hello,failures:n});let r=md[Math.min(n-1,md.length-1)];this.retryTimer=window.setTimeout(()=>this.connect(),r)}receive(e){let t;try{t=JSON.parse(e)}catch{return}if(!t||typeof t!=`object`)return;if(`event`in t&&typeof t.event==`string`){let e=`data`in t?t.data:void 0;if(t.event===`op.progress`){let t=e;typeof t?.id==`number`&&typeof t.line==`string`&&this.pending.get(t.id)?.progress?.(t.line);return}for(let n of this.listeners.get(t.event)??[])n(e);return}if(!(`id`in t)||typeof t.id!=`number`)return;let n=this.pending.get(t.id);if(!n)return;if(this.pending.delete(t.id),`ok`in t&&t.ok===!0){n.resolve(`result`in t?t.result:void 0);return}let r=`error`in t&&t.error&&typeof t.error==`object`?t.error:{},i=`code`in r&&typeof r.code==`string`?r.code:`INTERNAL`,a=`message`in r&&typeof r.message==`string`?r.message:i;n.reject(new pd(i,a,r))}retryNow(){this.retryTimer!==null&&(window.clearTimeout(this.retryTimer),this.connect())}};function vd(){return`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}/ws`}var yd=`modulepreload`,bd=function(e){return`/`+e},Z={},xd=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=bd(t,n),t=s(t),t in Z)return;Z[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`:yd,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)})},Sd=8,Cd=32,wd=3e3,Td=100,Ed=new WeakMap,Dd=null;function Od(e){let t=Ed.get(e);return t||(t={entries:new Map,snapshots:new Map,left:null},Ed.set(e,t)),t}function kd(){return Dd||(Dd=document.createElement(`div`),Dd.style.display=`none`,document.body.append(Dd)),Dd}function Ad(e,t,n){e.snapshots.delete(t),e.snapshots.set(t,n);for(let t of e.snapshots.keys()){if(e.snapshots.size<=Cd)break;e.snapshots.delete(t)}}function jd(e,t,n){e.entries.delete(t.key),t.leaving!==null&&window.clearTimeout(t.leaving),t.leaving=null,n?Ad(e,t.key,t.handle.snapshot()):e.snapshots.delete(t.key),t.handle.dispose(),t.box.remove()}function Md(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-Sd)))jd(e,n,!0)}function Nd(e,t,n,r){return Od(e).entries.get(Bl(t,n,r))?.slot.parkedAt!=null}async function Pd(e,t){let n=Od(e.client),r=Bl(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,Rd(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:()=>Fd(n,i)}}let a=document.createElement(`div`);a.className=zt,e.host.append(a),Id(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 xd(async()=>{let{mountTerminal:e}=await import(`./term-mount-C2LWd3qT.js`);return{mountTerminal:e}},__vite__mapDeps([0,1])),d=u({...e,el:a,snapshot:l,onPainted:()=>Rd(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&&jd(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:()=>Fd(n,f)}}function Fd(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(),kd().append(t.box),e.left=t,Md(e))}function Id(e,t){let n=e.left;e.left=null,!(!n||n.slot.parkedAt===null||performance.now()-n.slot.parkedAt>Td)&&e.entries.get(n.key)===n&&(n.box.classList.add(`is-leaving`),t.append(n.box),n.leaving=window.setTimeout(()=>Ld(e,n),wd))}function Ld(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&&kd().append(t.box))}function Rd(e){for(let t of e.entries.values())Ld(e,t)}async function zd(e,t,n){return Fc(await e.request(`output.read`,{taskId:t,tab:n,source:`terminal`,limit:12}))}async function Bd(e,t,n,r){try{let i=await e.client.request(`tab.send`,{taskId:t,tabId:n,prompt:r});return i.delivered?!0:(H(F(`layout.composerNotSent`,{reason:i.reason??``}),`error`),!1)}catch(e){let t=e instanceof pd?e.code:void 0;return H(t===`UNKNOWN_OP`?F(`layout.composerOldBridge`):t===`AWAITING_PERMISSION`?F(`layout.composerAtMenu`):e instanceof Error?e.message:String(e),`error`),!1}}async function Vd(e,t,n,r){let{client:i}=e,a=Bl(t,n),o=La(a)!==void 0||Nd(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 H(e instanceof Error?e.message:String(e),`error`),!1}finally{o||await i.request(`term.detach`,{stream:a}).catch(()=>{})}}async function Hd(e,t,n){try{return(await e.client.request(`gate.answer`,{gateId:t,...n})).delivered||H(F(`inbox.gateKept`)),!0}catch(e){return H(e instanceof Error?e.message:String(e),`error`),!1}}var Ud=(e,t,n)=>({id:e,cap:t,bytes:e=>`\x1b${e?`O`:`[`}${n}`}),Wd={id:`enter`,cap:`⏎`,bytes:()=>`\r`},Gd=[{id:`esc`,cap:`esc`,bytes:()=>`\x1B`},{id:`tab`,cap:`tab`,bytes:()=>` `},{id:`backtab`,cap:`⇧tab`,bytes:()=>`\x1B[Z`},{id:`interrupt`,cap:`^C`,bytes:()=>``},Ud(`up`,`↑`,`A`),Ud(`down`,`↓`,`B`),Ud(`left`,`←`,`D`),Ud(`right`,`→`,`C`),Wd],Kd=e=>({id:`option-${e}`,cap:String(e),bytes:()=>String(e)}),qd=[Kd(1),Kd(2),Kd(3),Kd(4),Wd];function Jd(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 Yd=`mx-2.5 mt-0.5 mb-1.5 flex min-w-0 flex-col gap-1.5 font-mono text-meta`,Xd=2e3;function Zd(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 zd(e.client,t,n);r&&i(a)}catch{r&&i(e=>e??[])}r&&(a=window.setTimeout(o,Xd))};return o(),()=>{r=!1,window.clearTimeout(a)}},[e,t,n,a]),{lines:r,refresh:()=>o(e=>e+1)}}function Qd(e){I();let{model:t,taskId:n,tabId:r,mode:i,gate:a}=e,{lines:o,refresh:s}=Zd(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?Hd(t,a.id,{text:e}):r?Bd(t,n,r,e):Promise.resolve(!1))&&u(``)};return(0,L.jsxs)(`div`,{className:Yd,children:[a&&(0,L.jsx)(`p`,{className:`m-0 whitespace-pre-wrap wrap-anywhere text-ink`,children:a.question}),r&&(0,L.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?F(`inbox.noOutput`):o.join(`
19
+ `);if(a===`scratch`){let e=await t.client.request(`task.openScratch`,O?{}:{engine:D});O?await Yl(t,e.taskId,{kind:`shell`}):t.selectWhenListed(e.taskId)}else if(ee){if(!r)throw Error(W(`terminal`,`tab.tabGone`));if(!l.trim())throw Error(F(`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=Ol(e);if(!t)throw e;H(e instanceof Error?e.message:String(e),`error`),Ya(t);return}a.forkRefused&&H(F(`taskops.forkLeftBehind`,{reason:a.forkRefused}));let o=a.taskIds[0];a.groupId?Ya(a.groupId):o&&t.selectWhenListed(o)}else if(O)await Yl(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:Gl(D),...r?{tabId:r}:{}});await t.refreshTabsNow(n),t.select(n,i.tabId)}else await Yl(t,n,{kind:`engine`,engine:D,prompt:i,...e?{replaceTab:te()}:{}})});return(0,L.jsx)(Tr,{title:W(`terminal`,`tab.newChat.title`),wide:!0,children:(0,L.jsxs)(`form`,{className:Yn,onKeyDown:e=>{if(e.key===`Tab`&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&(ee||!e.shiftKey))e.preventDefault(),e.stopPropagation(),ee?Il(e.currentTarget,$l,e.shiftKey?-1:1):A(Ql[(Ql.indexOf(a)+1)%Ql.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(),A(a,s===`fresh`?`continue`:`fresh`)):e.key===`Enter`&&ee&&e.target.closest(`[data-field=attempts], [data-field=engine]`)&&(e.preventDefault(),e.currentTarget.requestSubmit())},onSubmit:e=>{e.preventDefault(),re()},onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),x(Array.from(e.dataTransfer.files))},children:[(0,L.jsxs)(`div`,{className:zn,children:[(0,L.jsx)(`span`,{className:`${z} text-muted`,children:W(`terminal`,`tab.newChat.engine`)}),(0,L.jsx)(ql,{engines:i.engines,value:D,onChange:i.setEngine,withShell:w,panes:T?E:[]})]}),(0,L.jsxs)(`div`,{className:zn,children:[(0,L.jsx)(`span`,{className:`${z} text-muted`,children:W(`terminal`,`tab.newChat.destLabel`)}),(0,L.jsx)(sl,{label:W(`terminal`,`tab.newChat.destLabel`),field:`destination`,value:a,onChange:e=>A(e,s),choices:Ql.map(e=>({id:e,label:W(`terminal`,`tab.newChat.dest${e===`tab`?`Tab`:e===`fork`?`Fork`:`Scratch`}`)}))})]}),(0,L.jsxs)(`div`,{className:zn,children:[(0,L.jsxs)(`span`,{className:`${z} text-muted`,children:[W(`terminal`,`tab.newChat.ctxLabel`),` `,(0,L.jsx)(`span`,{className:`keys-only`,children:`ctrl+f`})]}),(0,L.jsx)(sl,{label:W(`terminal`,`tab.newChat.ctxLabel`),field:`context`,value:s,onChange:e=>A(a,e===`continue`?`continue`:`fresh`),choices:[`fresh`,`continue`].map(e=>({id:e,label:W(`terminal`,`tab.newChat.ctx${e===`fresh`?`Fresh`:`Continue`}`)}))})]}),ee&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:W(`quickTask`,`attemptsLabel`)}),(0,L.jsx)(sl,{label:W(`quickTask`,`attemptsLabel`),field:`attempts`,value:d,onChange:f,choices:Zl.map(e=>({id:e,label:e}))})]}),(0,L.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:F(`taskops.forkBranch`)}),(0,L.jsx)(`input`,{className:ln,"data-field":`fork-base`,spellCheck:!1,value:p,onChange:e=>m(e.target.value)})]})]}),!O&&!k&&a!==`scratch`&&(0,L.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:F(`newChat.prompt`)}),(0,L.jsx)(`textarea`,{className:`${ln} min-h-18 max-h-[50vh] leading-[1.45]`,"data-field":`message`,autoFocus:!0,rows:4,placeholder:F(`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,L.jsx)(ol,{attachments:b,onRemove:S}),cl()?(0,L.jsx)(`p`,{className:`text-muted`,children:F(`pages.attachHintTouch`)}):(0,L.jsx)(`p`,{className:`keys-only mx-0 mt-2 mb-0 ${tn}`,children:W(`quickTask`,`legend`)}),_&&(0,L.jsx)(`p`,{className:`text-error`,children:_}),(0,L.jsx)(Ar,{busy:g,submitLabel:F(`newChat.start`)})]})})}var tu=e=>e.split(`/`).filter(Boolean).pop()??e;function nu(e,t,n=``){let r=tu(e),i=t.filter(t=>(t.repo!==e||t.host!==n)&&tu(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 ru=e=>e.startsWith(`root:`)?null:e.split(`/`).slice(-2).join(`/`);function iu(e,t){let n=tu(e.repo),r=t.filter(t=>t!==e&&tu(t.repo)===n);if(r.length===0)return n;let i=e.repoId,a=i?ru(i):null;return i&&a?r.some(e=>e.repoId&&e.repoId!==i&&ru(e.repoId)===a)?i:a:nu(e.repo,[e,...r].map(e=>({repo:e.repo,host:``})))}var au=/\s+#\d+\/\d+$/,ou=(e,t)=>(e.createdAt??``).localeCompare(t.createdAt??``)||e.id.localeCompare(t.id),su=e=>e.groupId&&e.kind!==`main`?`${e.machine?.id??``}\0${e.groupId}`:null;function cu(e){let t=new Map;for(let n of e){let e=su(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(ou);return t}function lu(e){return(e[0]?.label??``).replace(au,``)}function uu(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 du=[`default`,`recent`,`attention`,`name`],fu={folded:new Set,opened:new Set},pu=e=>{let t=Date.parse(e??``);return Number.isFinite(t)?t:0},mu=e=>pu(e.updatedAt??e.createdAt),hu=e=>pu(e.createdAt),gu=(e,t)=>hu(t)-hu(e)||t.id.localeCompare(e.id),_u=(e,t)=>mu(t)-mu(e)||t.id.localeCompare(e.id),vu=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`}),yu={default:null,recent:gu,attention:(e,t)=>e.rank-t.rank||_u(e,t),name:(e,t)=>vu.compare(e.label.trim(),t.label.trim())||e.id.localeCompare(t.id)},bu=`~scratch`,xu=e=>e.kind===`dir`&&(e.scratch===!0||e.noProject===!0);function Su(e,t){return[...e].sort((e,t)=>(e.order??e.rank)-(t.order??t.rank)).sort(Tu(yu[t]))}function Cu(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=xu(e)?bu:e.repo,n=r.get(t);n?n.push(e):r.set(t,[e])}let i=yu[t],a=[...r].map(([e,t])=>{let n=t.sort(Tu(i));if(e===`~scratch`&&t.every(xu))return{repo:``,label:F(`rail.noProject`),tasks:n,key:bu,noProject:!0};let r=t.find(e=>e.repoId)?.repoId;return{repo:e,label:tu(e),tasks:n,...r?{repoId:r}:{}}});return[...a.filter(e=>e.noProject),...a.filter(e=>!e.noProject)]}var wu=e=>e.kind===`main`?0:e.pinned?1:2,Tu=e=>(t,n)=>wu(t)-wu(n)||(e?e(t,n):0);function Eu(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 Du(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)||Eu(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 Ou(e,t,n=[]){for(let r of e.get(t)??[])n.push(r.id),Ou(e,r.id,n);return n}function ku(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 Au(e,t=``,n=fu,r=0,i=!0){let a=t.trim(),o=(...e)=>e.some(e=>e!==``&&Zs(a,e)),{children:s,nested:c}=Du(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,tu(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?Ou(s,t.id):[],m=u!==void 0&&a===``&&ku(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?cu(t):new Map,o=new Set;for(let i of t){let t=su(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:lu(s),tasks:s,depth:Math.min(l,3),...c.machine?{machine:c.machine.id}:{}});let u=uu(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 ju=e=>Math.max(0,...e.tasks.map(hu));function Mu(e){let t=e.tasks.filter(e=>!e.routine),n=e.remote.filter(e=>!e.routine),r=[...Cu(t,e.sort).map(e=>({group:e})),...e.machines.flatMap(t=>Cu(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?bu:t??(e.machine===void 0?n:`${e.machine}\0${n}`),a=i.get(r);a?a.push(e):i.set(r,[e])}let a=yu[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(Tu(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:iu(e,s)])),l=s.map(e=>({...e,label:c.get(e)??e.label}));return e.sort===`recent`&&l.sort((e,t)=>ju(t)-ju(e)),e.sort===`name`&&l.sort((e,t)=>vu.compare(e.label,t.label)),l.sort((e,t)=>Number(t.noProject===!0)-Number(e.noProject===!0)),{rows:Au(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 Nu(e){return e.title??e.engineName??(e.kind===`engine`?F(`tab.engine`):F(`tab.shell`))}function Pu(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 Fu(e){return e.kind===`leaf`?[e]:e.children.flatMap(Fu)}function Iu(e){return!!e&&Fu(e.root).length>1}function Lu(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 Ru(e,t,n=1){let r=Fu(e.root).map(e=>e.id),i=r.indexOf(t);return r[(Math.max(0,i)+n+r.length)%r.length]??t}function zu(e,t){let n=new Map,r=new Map;for(let i of Fu(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 Bu(e,t,n){return e.kind===`engine`&&Fu(t.root).some(e=>e.id===n&&e.own)}function Vu(e){return e.alive!==!1||!!e.split&&!Fu(e.split.root).some(e=>e.own)}function Hu(e){return Fu(e.root).map(e=>e.id).join(`,`)}function Uu(e){return!(e instanceof HTMLElement)||e.closest(`.xterm`)?!1:e.isContentEditable||[`INPUT`,`TEXTAREA`,`SELECT`].includes(e.tagName)}function Wu(e){return e instanceof HTMLElement&&!!e.closest(`.rail, button, a`)}var Gu=e=>e.tabs.get()[e.selection.get().taskId??``]??[];function Ku(e){let{taskId:t,tabId:n}=e.selection.get(),r=Gu(e);return{taskId:t,tabs:r,at:r.findIndex(e=>e.id===n)}}function qu(e,t){let{taskId:n,tabs:r}=Ku(e),i=r[t];!n||!i||e.select(n,i.id)}function Ju(e){let{taskId:t,tabs:n,at:r}=Ku(e),i=n[r];!t||!i||B.set((0,L.jsx)(Dr,{title:F(`menu.renameTab`),initial:Nu(i),submitLabel:F(`dialog.save`),onSubmit:async n=>{await e.renameTab(t,i.id,n)}}))}var Yu=e=>!!e.selection.get().taskId,Xu=e=>Gu(e).length>0,Zu=[{id:`help.open`,chords:[`f1`],prefix:!1,run:Dc},{id:`focus.next`,chords:[`f4`],prefix:!1,run:()=>wa(1)},{id:`chat.tab.chooseEngine`,chords:[`ctrl+e`],prefix:!1,surface:`workspace`,live:Yu,run:e=>{let{taskId:t}=e.selection.get();t&&B.set((0,L.jsx)(eu,{model:e,taskId:t}))}},{id:`chat.tab.rename`,chords:[`f2`],prefix:!1,surface:`workspace`,live:e=>{let{tabs:t,at:n}=Ku(e);return!!t[n]&&!Iu(t[n]?.split)},run:Ju},{id:`chat.tab.cycle-next`,chords:[`ctrl+]`],prefix:!1,surface:`workspace`,live:Xu,run:e=>qu(e,(Ku(e).at+1)%Gu(e).length)},{id:`chat.tab.cycle-prev`,chords:[`ctrl+[`],prefix:!1,surface:`workspace`,live:Xu,run:e=>qu(e,(Ku(e).at-1+Gu(e).length)%Gu(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:Xu,run:(e,t=``)=>{let n=Oa().find(e=>e.id===`chat.tab.goto`&&!e.prefix)?.chords.indexOf(t)??-1;n>=0&&qu(e,n)}},{id:`attention.next`,chords:[`f7`],prefix:!1,run:e=>$u(e)}];Ea(()=>Zu);function Qu(e){(0,h.useEffect)(()=>{let t=t=>{if(B.get()||Uu(t.target))return;let n=V.get();if(n===`worktrees`)return;let r=ja()??(Yu(e)?`workspace`:`sidebar`),{taskId:i}=e.selection.get();if(!n&&i&&!t.ctrlKey&&!t.shiftKey&&!t.metaKey&&!t.altKey&&t.key===`Enter`&&!Xu(e)&&!Wu(t.target)){t.preventDefault(),t.stopPropagation(),B.set((0,L.jsx)(eu,{model:e,taskId:i}));return}let a=Gs(t),o=Oa().filter(t=>!t.prefix&&!t.native&&t.chords.some(e=>a.includes(e))&&ka(t,r)&&!(n&&t.surface)&&t.live?.(e)!==!1).sort((e,t)=>Aa(e,r)-Aa(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 $u(e){let t=e.tasks.get();if(!t)return;let n=Pc(t.attention,t.tasks.map(e=>e.id),e.selection.get());if(!n){H(F(`inbox.empty`));return}if(jc(n.state)){Lc(e,n);return}n.taskId!==null&&(e.select(n.taskId,n.tabId),Ic(e,n))}async function ed(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){H(F(`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){H(U(e),`error`)}}function td(e){(0,h.useEffect)(()=>{let t=t=>{let n=hi.get().plugins;if(n.length===0||!Oi({dialog:B.get()!==null,page:V.get()})||Uu(t.target))return;let r=Di(n,Gs(t));r&&(t.preventDefault(),t.stopImmediatePropagation(),ed(e,r))};return window.addEventListener(`keydown`,t,{capture:!0}),()=>window.removeEventListener(`keydown`,t,{capture:!0})},[e])}var nd=`prefix.moreCommands`,rd=/^ctrl\+[^+]+$/;function id(e){return rd.test(e)?e.slice(5):null}function ad(e){let t=Xs(e.bindingId);if(!t)return null;if(e.reachability.direct.has(e.bindingId)){let e=t.keys[0];if(e)return pi(e)}if(e.prefixKey&&e.reachability.prefix.has(e.bindingId)){let n=t.prefixKeys?.[0];if(n)return`${pi(e.prefixKey)} ${pi(n)}`}return null}function od(e,t){let n=li.filter(t=>e.direct.has(t.id)).flatMap(e=>{let t=e.keys.flatMap(e=>id(e)??[]);return t.length>2?[{stroke:`${t[0]}-${t.at(-1)}`,action:e.id}]:t.map(t=>({stroke:t,action:e.id}))}),r=t?id(t):null;return r&&e.prefix.size>0&&n.push({stroke:r,action:nd}),n}var sd=4e3,cd=180,ld=sd,ud=g({guide:null,entries:[]}),dd=1;function fd(e,t){let n={id:dd++,stroke:e,action:t,at:Date.now()};ud.set({guide:null,entries:[...ud.get().entries,n].slice(-3)})}var pd=class extends Error{code;detail;constructor(e,t,n){super(t),this.code=e,this.detail=n}},md=[500,1e3,2e3,4e3,8e3,15e3],hd=4e3,gd=1e4,_d=class{url;token;conn=g({state:`connecting`,hello:null,failures:0});ws=null;nextId=1;pending=new Map;listeners=new Map;openHooks=new Set;retryTimer=null;deadline=null;constructor(e,t){this.url=e,this.token=t}start(){this.connect();let e=()=>{document.visibilityState===`visible`&&this.checkNow()};document.addEventListener(`visibilitychange`,e),window.addEventListener(`online`,e),window.addEventListener(`pageshow`,e)}checkNow(){if(this.retryTimer!==null){this.retryNow();return}let e=this.ws;!e||this.conn.get().state!==`open`||this.deadline!==null||(this.armDeadline(e,hd),this.request(`hello`).then(()=>this.clearDeadline(),e=>{e instanceof pd&&e.code!==`NOT_CONNECTED`&&this.clearDeadline()}))}armDeadline(e,t){this.clearDeadline(),this.deadline=window.setTimeout(()=>this.lost(e),t)}clearDeadline(){this.deadline!==null&&window.clearTimeout(this.deadline),this.deadline=null}onOpen(e){return this.openHooks.add(e),this.conn.get().state===`open`&&e(),()=>this.openHooks.delete(e)}on(e,t){let n=this.listeners.get(e);return n||(n=new Set,this.listeners.set(e,n)),n.add(t),()=>n.delete(t)}request(e,t={},n){let r=this.ws;if(!r||r.readyState!==WebSocket.OPEN)return Promise.reject(new pd(`NOT_CONNECTED`,`not connected to rove`));let i=this.nextId++;return new Promise((a,o)=>{this.pending.set(i,{resolve:e=>a(e),reject:o,progress:n}),r.send(JSON.stringify({id:i,op:e,args:t}))})}connect(){this.retryTimer=null;let e=io(this.url,this.token?[`rove.v1`,`rove.bearer.${this.token}`]:[`rove.v1`]);this.ws=e,this.armDeadline(e,gd),e.onmessage=e=>this.receive(String(e.data)),e.onopen=()=>{this.request(`hello`).then(e=>{this.clearDeadline(),this.conn.set({state:`open`,hello:e,failures:0});for(let e of this.openHooks)e()},()=>this.lost(e))},e.onclose=t=>this.lost(e,t?.code)}lost(e,t){if(this.ws!==e)return;this.ws=null,this.clearDeadline(),e.onopen=null,e.onclose=null,e.onmessage=null,e.close();for(let e of this.pending.values())e.reject(new pd(`NOT_CONNECTED`,`connection lost`));if(this.pending.clear(),t===4401){o(),this.conn.set({state:`retrying`,hello:null,failures:2});return}let n=this.conn.get().failures+1;this.conn.set({state:`retrying`,hello:this.conn.get().hello,failures:n});let r=md[Math.min(n-1,md.length-1)];this.retryTimer=window.setTimeout(()=>this.connect(),r)}receive(e){let t;try{t=JSON.parse(e)}catch{return}if(!t||typeof t!=`object`)return;if(`event`in t&&typeof t.event==`string`){let e=`data`in t?t.data:void 0;if(t.event===`op.progress`){let t=e;typeof t?.id==`number`&&typeof t.line==`string`&&this.pending.get(t.id)?.progress?.(t.line);return}for(let n of this.listeners.get(t.event)??[])n(e);return}if(!(`id`in t)||typeof t.id!=`number`)return;let n=this.pending.get(t.id);if(!n)return;if(this.pending.delete(t.id),`ok`in t&&t.ok===!0){n.resolve(`result`in t?t.result:void 0);return}let r=`error`in t&&t.error&&typeof t.error==`object`?t.error:{},i=`code`in r&&typeof r.code==`string`?r.code:`INTERNAL`,a=`message`in r&&typeof r.message==`string`?r.message:i;n.reject(new pd(i,a,r))}retryNow(){this.retryTimer!==null&&(window.clearTimeout(this.retryTimer),this.connect())}};function vd(){return`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}/ws`}var yd=`modulepreload`,bd=function(e){return`/`+e},Z={},xd=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=bd(t,n),t=s(t),t in Z)return;Z[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`:yd,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)})},Sd=8,Cd=32,wd=3e3,Td=100,Ed=new WeakMap,Dd=null;function Od(e){let t=Ed.get(e);return t||(t={entries:new Map,snapshots:new Map,left:null},Ed.set(e,t)),t}function kd(){return Dd||(Dd=document.createElement(`div`),Dd.style.display=`none`,document.body.append(Dd)),Dd}function Ad(e,t,n){e.snapshots.delete(t),e.snapshots.set(t,n);for(let t of e.snapshots.keys()){if(e.snapshots.size<=Cd)break;e.snapshots.delete(t)}}function jd(e,t,n){e.entries.delete(t.key),t.leaving!==null&&window.clearTimeout(t.leaving),t.leaving=null,n?Ad(e,t.key,t.handle.snapshot()):e.snapshots.delete(t.key),t.handle.dispose(),t.box.remove()}function Md(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-Sd)))jd(e,n,!0)}function Nd(e,t,n,r){return Od(e).entries.get(Bl(t,n,r))?.slot.parkedAt!=null}async function Pd(e,t){let n=Od(e.client),r=Bl(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,Rd(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:()=>Fd(n,i)}}let a=document.createElement(`div`);a.className=zt,e.host.append(a),Id(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 xd(async()=>{let{mountTerminal:e}=await import(`./term-mount-Dd1VUXUW.js`);return{mountTerminal:e}},__vite__mapDeps([0,1])),d=u({...e,el:a,snapshot:l,onPainted:()=>Rd(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&&jd(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:()=>Fd(n,f)}}function Fd(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(),kd().append(t.box),e.left=t,Md(e))}function Id(e,t){let n=e.left;e.left=null,!(!n||n.slot.parkedAt===null||performance.now()-n.slot.parkedAt>Td)&&e.entries.get(n.key)===n&&(n.box.classList.add(`is-leaving`),t.append(n.box),n.leaving=window.setTimeout(()=>Ld(e,n),wd))}function Ld(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&&kd().append(t.box))}function Rd(e){for(let t of e.entries.values())Ld(e,t)}async function zd(e,t,n){return Fc(await e.request(`output.read`,{taskId:t,tab:n,source:`terminal`,limit:12}))}async function Bd(e,t,n,r){try{let i=await e.client.request(`tab.send`,{taskId:t,tabId:n,prompt:r});return i.delivered?!0:(H(F(`layout.composerNotSent`,{reason:i.reason??``}),`error`),!1)}catch(e){let t=e instanceof pd?e.code:void 0;return H(t===`UNKNOWN_OP`?F(`layout.composerOldBridge`):t===`AWAITING_PERMISSION`?F(`layout.composerAtMenu`):e instanceof Error?e.message:String(e),`error`),!1}}async function Vd(e,t,n,r){let{client:i}=e,a=Bl(t,n),o=La(a)!==void 0||Nd(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 H(e instanceof Error?e.message:String(e),`error`),!1}finally{o||await i.request(`term.detach`,{stream:a}).catch(()=>{})}}async function Hd(e,t,n){try{return(await e.client.request(`gate.answer`,{gateId:t,...n})).delivered||H(F(`inbox.gateKept`)),!0}catch(e){return H(e instanceof Error?e.message:String(e),`error`),!1}}var Ud=(e,t,n)=>({id:e,cap:t,bytes:e=>`\x1b${e?`O`:`[`}${n}`}),Wd={id:`enter`,cap:`⏎`,bytes:()=>`\r`},Gd=[{id:`esc`,cap:`esc`,bytes:()=>`\x1B`},{id:`tab`,cap:`tab`,bytes:()=>` `},{id:`backtab`,cap:`⇧tab`,bytes:()=>`\x1B[Z`},{id:`interrupt`,cap:`^C`,bytes:()=>``},Ud(`up`,`↑`,`A`),Ud(`down`,`↓`,`B`),Ud(`left`,`←`,`D`),Ud(`right`,`→`,`C`),Wd],Kd=e=>({id:`option-${e}`,cap:String(e),bytes:()=>String(e)}),qd=[Kd(1),Kd(2),Kd(3),Kd(4),Wd];function Jd(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 Yd=`mx-2.5 mt-0.5 mb-1.5 flex min-w-0 flex-col gap-1.5 font-mono text-meta`,Xd=2e3;function Zd(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 zd(e.client,t,n);r&&i(a)}catch{r&&i(e=>e??[])}r&&(a=window.setTimeout(o,Xd))};return o(),()=>{r=!1,window.clearTimeout(a)}},[e,t,n,a]),{lines:r,refresh:()=>o(e=>e+1)}}function Qd(e){I();let{model:t,taskId:n,tabId:r,mode:i,gate:a}=e,{lines:o,refresh:s}=Zd(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?Hd(t,a.id,{text:e}):r?Bd(t,n,r,e):Promise.resolve(!1))&&u(``)};return(0,L.jsxs)(`div`,{className:Yd,children:[a&&(0,L.jsx)(`p`,{className:`m-0 whitespace-pre-wrap wrap-anywhere text-ink`,children:a.question}),r&&(0,L.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?F(`inbox.noOutput`):o.join(`
20
20
  `)}),i===`gate`&&a&&(0,L.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:a.options.map(e=>(0,L.jsxs)(R,{disabled:d,title:e.detail,onClick:()=>void p(()=>Hd(t,a.id,{option:e.key})),children:[`[ `,e.key===a.recommended?`★ `:``,e.label,` ]`]},e.key))}),i===`menu`&&r&&(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[qd.map(e=>(0,L.jsxs)(R,{disabled:d,onClick:()=>void p(()=>Vd(t,n,r,e.bytes(!1))),children:[`[ `,e.cap,` ]`]},e.id)),(0,L.jsx)(R,{onClick:e.onOpenTab,children:F(`inbox.openTab`)})]}),(i===`reply`||i===`gate`)&&(0,L.jsxs)(`form`,{className:`flex min-w-0 items-center gap-2`,onSubmit:e=>{e.preventDefault(),m()},children:[(0,L.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:F(`inbox.replyPlaceholder`),"aria-label":F(`inbox.replyPlaceholder`),autoComplete:`off`,enterKeyHint:`send`,onChange:e=>u(e.target.value)}),(0,L.jsx)(R,{type:`submit`,disabled:d||l.trim()===``,children:F(`inbox.send`)})]})]})}function $d({text:e}){return(0,L.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,L.jsx)(`span`,{children:e},e))})}var ef={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`},tf={accent:`text-accent`,muted:`text-subtle`,attention:`text-error`,warning:`text-warning`,success:`text-success`,info:`text-accent`,ink:`text-ink`},nf=6;function rf(e,t){return e?`${e.repo.split(`/`).filter(Boolean).pop()??e.repo} › ${e.label}`:t}function af({model:e}){I();let t=_(e.tasks),n=_(e.visits),r=_(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=Nc(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:rf(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,nf).map(e=>({key:`r:${e.taskId}:${e.tabId}`,section:`recent`,taskId:e.taskId,tabId:e.tabId,identity:rf(u.get(e.taskId),e.taskId),subtitle:d(e.taskId,e.tabId)||u.get(e.taskId)?.branch||``,at:e.at})),g=[...f,...m],v=g[Math.min(i,g.length-1)],y=t=>{if(t.attention&&jc(t.attention.state))return Lc(e,t.attention);t.attention&&Ic(e,t.attention),t.taskId&&u.has(t.taskId)&&(e.select(t.taskId,t.tabId),Pn())},b=()=>void Promise.all(f.map(t=>t.attention&&Ic(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)y(v);else if(t.key===`d`&&v?.attention)Ic(e,v.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?kc(n.attention.state):null,i=n===v,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&&!jc(l.state)&&(!l.gateId||!!f)&&(!!p||!!f),h=l?.state===`permission_needed`||!!p&&d?.tabStatus?.[p]?.kind===`needs-input`,_=f?`gate`:l?.state===`dead`?`readonly`:h?`menu`:`reply`,b=`${n.taskId}:${n.tabId}:${l?.gateId??``}`,x=m&&o===b;return(0,L.jsxs)(`li`,{children:[(0,L.jsxs)(`div`,{className:dr,children:[(0,L.jsxs)(`button`,{type:`button`,className:`${vr({selected:i,stack:!0})} ${fr}`,onMouseEnter:()=>a(g.indexOf(n)),onClick:()=>y(n),children:[(0,L.jsxs)(`span`,{className:lr,children:[(0,L.jsx)(`span`,{className:yr,children:n.identity}),r&&(0,L.jsxs)(`span`,{className:`flex-none font-mono text-meta font-normal normal-nums ${tf[r.tone]}`,children:[r.glyph,` `,F(r.stateKey)]}),(0,L.jsx)(`span`,{className:ur,children:Ac(c-n.at)})]}),n.subtitle&&(0,L.jsx)(`span`,{className:`truncate font-mono text-meta font-normal normal-nums text-muted`,children:n.subtitle})]}),m?(0,L.jsx)(R,{className:pr,"aria-expanded":x,onClick:()=>{a(g.indexOf(n)),s(x?null:b)},children:F(x?`inbox.hide`:`inbox.reply`)}):(0,L.jsx)(`span`,{"aria-hidden":!0,className:pr})]}),x&&n.taskId&&(0,L.jsx)(Qd,{model:e,taskId:n.taskId,tabId:p,mode:_,gate:f,onOpenTab:()=>y(n)})]},n.key)};return(0,L.jsx)(Tr,{title:F(`inbox.title`),wide:!0,children:(0,L.jsxs)(`div`,{className:Yn,children:[(0,L.jsxs)(`div`,{className:or,children:[(0,L.jsx)(`p`,{className:`${z} text-muted ${ar} touch:hidden!`,children:(0,L.jsx)($d,{text:F(`inbox.hints`)})}),f.length>0&&(0,L.jsx)(R,{className:`flex-none min-w-[calc(9ch+0.5rem)] whitespace-nowrap pr-2 text-right font-mono text-meta`,onClick:b,children:F(`inbox.ackAll`)})]}),(0,L.jsx)(`h2`,{className:`${z} text-muted ${sr}`,children:F(`inbox.attention`)}),f.length===0?(0,L.jsx)(`p`,{className:`mono text-muted`,children:F(`inbox.empty`)}):(0,L.jsx)(`ul`,{className:cr,children:f.map(x)}),m.length>0&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`h2`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted mt-1`,children:F(`inbox.recent`)}),(0,L.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-0.5 p-0`,children:m.map(x)})]})]})})}var of=[`project`,`state`],sf=`rove.railGroup`,cf=g(of.find(e=>e===localStorage.getItem(sf))??`project`);function lf(e){cf.set(e),localStorage.setItem(sf,e)}var uf=`rove.activeSortMode`;function df(){let e=localStorage.getItem(uf);return du.find(t=>t===e)??`recent`}var ff=g(df());function pf(e){ff.set(e),localStorage.setItem(uf,e)}function mf(){pf(du[(du.indexOf(ff.get())+1)%du.length]??`default`)}var hf=g(!1),gf=g(null);function _f(e){e&&(ff.get()!=="default"||cf.get()===`state`)&&(pf(`default`),lf(`project`),H(W(`tasks`,`sort.reorderSwitched`))),e||gf.set(null),hf.set(e)}async function vf(e,t,n){let r=n<0?`up`:`down`;try{await e.client.request(`task.move`,{taskId:t.task.id,direction:r})}catch(e){H(W(`tasks`,`toast.moveFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)}}async function yf(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){H(W(`tasks`,`toast.moveFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)}}async function bf(e,t,n){if(n.pin!==void 0)try{await e.act(`task.pin`,{taskId:t,pinned:n.pin})}catch(e){H(W(`tasks`,`toast.moveFailed`,{error:e instanceof Error?e.message:String(e)}),`error`);return}await yf(e,t,n.steps)}var xf=`-my-0.75 -mr-0.5 ml-0 flex flex-none self-stretch`,Sf=`before:absolute before:top-0 before:left-1 before:content-[''] before:[border-left:var(--hairline)_solid_var(--line-active)]`,Cf={blank:``,pipe:`${Sf} before:bottom-0`,tee:`${Sf} before:bottom-0`,elbow:`${Sf} before:right-0 before:bottom-1/2 before:rounded-bl-[6px] before:[border-bottom:var(--hairline)_solid_var(--line-active)]`},wf=e=>`relative w-3 ${Cf[e]}`,Tf=`-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`,Ef=`inline-flex items-center gap-1`,Df=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`:``}`,Of=`inline-flex flex-none items-center text-subtle`,kf=`group/rail rail @container row-1 flex min-h-0 flex-col focus:outline-none ${Je}`,Af=`flex min-w-0 items-center gap-2.5 overflow-hidden px-3.5 pt-3.5 pb-2.5 whitespace-nowrap`,jf=`flex gap-1 px-3.5 pb-2 text-meta`,Mf=`min-w-0 flex-1 border-none bg-transparent p-0 text-ink [font:inherit] outline-none placeholder:text-subtle`,Nf=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`:``}`,Pf=`group-focus-within/rail:[box-shadow:inset_0_0_0_1px_var(--focus)]`,Ff=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 ${_r}`:``} ${e.moving?`bg-accent-soft after:font-mono after:text-meta after:font-medium after:normal-nums after:text-accent after:content-['move']`:``}`,If=`touch:relative touch:after:absolute touch:after:-inset-x-1.5 touch:after:-inset-y-3 touch:after:content-['']`,Lf=`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 ${If}`,Rf=e=>e?``:`opacity-0 group-hover/head:opacity-100 group-focus-visible/toggle:opacity-100 touch:opacity-100`,zf=`-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 ${If}`,Bf=1e4;function Vf(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 Hf(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}${Vf(t,n).slice((t.hostLabel||t.alias).length)}`}function Uf(e,t,n){if(e.kind!==`task`||e.machine===void 0)return null;let r=e.machine;return Hf(r,t.find(e=>e.alias===r),n,e.task.machine?.label)}function Wf({label:e}){return(0,L.jsx)(`span`,{className:Of,title:e,role:`img`,"aria-label":e,children:(0,L.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`12`,height:`12`,"aria-hidden":`true`,children:(0,L.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 Gf({host:e,onMachines:t}){return I(),(0,L.jsxs)(`div`,{className:$t,children:[(0,L.jsx)(`p`,{className:`text-muted`,children:W(`tasks`,`machine.filesElsewhere`,{host:e})}),(0,L.jsx)(`p`,{className:`text-muted`,children:W(`tasks`,`machine.filesHint`,{host:e})}),(0,L.jsx)(`div`,{children:(0,L.jsx)(R,{hit:`tight`,onClick:t,children:F(`machines.open`)})})]})}function Kf(e){let t=_(e.client.conn),n=_(e.remote),[r,i]=(0,h.useState)(()=>J(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=()=>X(e,`machines.list`).then(e=>n&&i(e.machines),()=>{});r();let a=jr(Bf,r);return()=>{n=!1,a()}},[e.client,t.state,a]),r}var qf=`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`,Jf=`flex flex-1 flex-col items-center justify-center gap-1.5 text-center`,Yf=`relative mx-auto flex w-full max-w-[104ch] flex-col gap-2`,Xf=`flex flex-col gap-2 rounded-md border-hairline border-line bg-surface px-3 py-2.5 focus-within:border-line-active`,Zf=`flex flex-wrap items-center justify-end gap-1.5`,Qf=`max-h-[40vh] min-h-[4.5em] w-full bg-transparent text-ink [border:0] [outline:0]`,$f=`flex flex-wrap items-center gap-1.5 px-1`,ep=`flex-1`,tp=(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`}`,np=`size-3.25 flex-none fill-none stroke-current [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:1.3]`,rp=(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`}`,ip=`disabled:cursor-default disabled:opacity-60`,ap=e=>`${rp(e)} min-w-[9ch] justify-center ${ip}`,op=`touch-none select-none [-webkit-touch-callout:none]`,sp=`group/chip relative inline-flex`,cp=`flex min-h-0 flex-col gap-1 overflow-y-auto p-1.5 [outline:0]`,lp=`flex min-h-0 flex-col overflow-y-auto`,up=`sticky top-0 z-1 m-0 bg-surface px-1.5 pt-1.5 pb-0.5 text-left`,dp=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`:``}`,fp=`flex-[0_0_1.5ch] text-accent`,pp=`ml-auto pl-3 inline-flex items-center gap-1`,mp=`min-w-0 overflow-hidden text-ellipsis whitespace-nowrap`,hp=`flex-none whitespace-nowrap`,gp=`flex flex-col gap-0.5 px-1.5 py-0.5`,_p=`min-w-[36ch]`,vp=`flex items-center gap-1.5 p-1.5`;function yp(){return(0,L.jsx)(`svg`,{className:np,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,L.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 bp(){return(0,L.jsxs)(`svg`,{className:np,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,L.jsx)(`circle`,{cx:`4.5`,cy:`3.5`,r:`1.5`}),(0,L.jsx)(`circle`,{cx:`4.5`,cy:`12.5`,r:`1.5`}),(0,L.jsx)(`circle`,{cx:`11.5`,cy:`5`,r:`1.5`}),(0,L.jsx)(`path`,{d:`M4.5 5v6M11.5 6.5c0 3-7 2-7 4.5`})]})}function xp(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,L.jsxs)(`span`,{ref:i,className:sp,onKeyDown:e=>{e.key!==`Escape`||!t||(e.preventDefault(),e.stopPropagation(),s())},children:[(0,L.jsx)(`button`,{ref:a,type:`button`,className:rp(),"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,L.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-last-of-type/chip:right-0 group-last-of-type/chip:left-auto`,children:e.children(s)})]})}function Sp(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,L.jsxs)(`div`,{className:cp,children:[(0,L.jsx)(`input`,{className:ln,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.metaKey||t.ctrlKey)}}}}),(0,L.jsxs)(`div`,{className:lp,children:[r.length===0&&(0,L.jsx)(`p`,{className:`mx-2 my-1 text-muted`,children:e.empty}),r.map((t,r)=>(0,L.jsxs)(h.Fragment,{children:[e.moreLabel&&t===e.more?.[0]&&(0,L.jsx)(`p`,{className:`mx-2 mt-2 mb-0.5 text-muted`,children:e.moreLabel}),(0,L.jsxs)(`button`,{type:`button`,"aria-current":t.checked===!0,ref:r===i?a:void 0,tabIndex:-1,title:t.title,className:dp({cursor:r===i}),onMouseMove:()=>n(r),onClick:n=>e.onPick(t.key,n.metaKey||n.ctrlKey),children:[(0,L.jsx)(`span`,{className:fp,children:t.checked?`✓`:``}),(0,L.jsx)(`span`,{className:hp,children:t.text}),t.dim&&(0,L.jsx)(`span`,{className:`ml-auto pl-3 text-muted ${t.title?`min-w-0 overflow-hidden text-ellipsis whitespace-nowrap`:``}`,children:t.dim})]})]},t.key))]})]})}function Cp(e){return(0,L.jsxs)(`button`,{type:`button`,role:e.multi?`menuitemcheckbox`:`menuitemradio`,"aria-checked":e.checked,tabIndex:-1,disabled:e.option.disabled,className:dp({cursor:e.cursor,dim:e.option.dim}),onMouseMove:e.onHover,onClick:e.onPick,children:[(0,L.jsx)(`span`,{className:fp,children:e.checked?`✓`:``}),(0,L.jsx)(`span`,{children:e.option.label}),!e.checked&&e.digit!==void 0&&!e.option.disabled&&(0,L.jsx)(`span`,{className:`ml-auto pl-3 text-muted`,children:e.digit})]})}function wp(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,L.jsxs)(`div`,{ref:r,role:`menu`,tabIndex:-1,className:cp,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?jl(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,L.jsxs)(`button`,{type:`button`,className:`${up} ${z} text-muted`,tabIndex:-1,onClick:e.onBack,children:[`‹ `,e.heading]}):(0,L.jsx)(`p`,{className:`${up} ${z} text-muted`,children:e.heading}),e.options.map((r,i)=>(0,L.jsx)(Cp,{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 Tp(e){let[t,n]=(0,h.useState)(`root`),r=e.models.length+ +(e.efforts.length>0),[i,a]=(0,h.useState)(()=>Math.max(0,e.models.findIndex(t=>t.id===e.model))),o=(0,h.useRef)(null);if((0,h.useEffect)(()=>{t===`root`&&o.current?.focus()},[t]),t===`effort`)return(0,L.jsx)(wp,{heading:F(`newSession.effort`),options:e.efforts,value:e.effort,onBack:()=>n(`root`),onPick:t=>{e.onEffort(t),e.close()}});let s=t=>{e.onModel(t),e.close()},c=e.efforts.find(t=>t.id===e.effort)?.label??``;return(0,L.jsxs)(`div`,{ref:o,role:`menu`,tabIndex:-1,className:cp,onKeyDown:t=>{if(!(t.ctrlKey||t.metaKey||t.altKey||t.nativeEvent.isComposing)){if(t.key===`ArrowDown`||t.key===`ArrowUp`)t.preventDefault(),a(Math.max(0,Math.min(r-1,i+(t.key===`ArrowDown`?1:-1))));else if(t.key===`Enter`||t.key===`ArrowRight`&&i>=e.models.length){t.preventDefault();let r=e.models[i];r?s(r.id):e.efforts.length>0&&n(`effort`)}else{let n=jl(t.key,e.models.length),r=n===null?void 0:e.models[n];if(!r)return;t.preventDefault(),s(r.id)}}},children:[(0,L.jsx)(`p`,{className:`${up} ${z} text-muted`,children:F(`newSession.modelHeading`)}),e.models.map((t,n)=>(0,L.jsx)(Cp,{option:t,checked:t.id===e.model,multi:!1,cursor:n===i,digit:n<9?n+1:void 0,onHover:()=>a(n),onPick:()=>s(t.id)},t.id)),e.efforts.length>0&&(0,L.jsxs)(`button`,{type:`button`,role:`menuitem`,tabIndex:-1,className:`${dp({cursor:i===e.models.length})} mt-1 border-t-hairline border-t-line`,onMouseMove:()=>a(e.models.length),onClick:()=>n(`effort`),children:[(0,L.jsx)(`span`,{className:`flex-[0_0_1.5ch] text-accent`}),(0,L.jsx)(`span`,{children:F(`newSession.effort`)}),(0,L.jsxs)(`span`,{className:`${pp} text-muted`,children:[c,(0,L.jsx)(fo,{right:!0})]})]})]})}function Ep(e){return(0,L.jsxs)(`div`,{className:`${cp} ${_p}`,children:[(0,L.jsx)(`p`,{className:`${up} ${z} text-muted`,children:F(`newSession.branches`)}),(0,L.jsxs)(`label`,{className:gp,children:[(0,L.jsx)(`span`,{className:`text-muted`,children:F(`newSession.branchName`)}),(0,L.jsx)(`input`,{className:ln,autoFocus:!0,spellCheck:!1,placeholder:F(`newSession.branchNamePlaceholder`),value:e.branch,onChange:t=>e.onBranch(t.target.value)})]}),e.repos.map(t=>(0,L.jsxs)(`label`,{className:gp,children:[(0,L.jsxs)(`span`,{children:[t.name,t.primary&&(0,L.jsxs)(`span`,{className:`text-muted`,children:[` `,F(`newSession.primary`)]})]}),(0,L.jsx)(`select`,{className:ln,"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,L.jsx)(`option`,{value:e,children:e},e))})]},t.path))]})}function Dp(e){return e.id.startsWith(`root:`)?e.primary??e.checkouts[0]??e.id:e.id}function Op(e,t){if(!e)return null;let n=t.find(t=>t.id===e||t.checkouts.includes(e));return n?{ref:Dp(n),clone:!1}:e.startsWith(`/`)?{ref:e,clone:!1}:null}function kp(e,t,n){let r=t.toLowerCase();return n?e.some(e=>e.toLowerCase()===`github.com/${r}`):e.some(e=>pl(e).base.toLowerCase()===(r.split(`/`)[1]??``))}function Ap(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}:{}}}var jp={offline:`newSession.remoteOffline`,outdated:`newSession.remoteOutdated`},Mp=(e,t)=>X(e,`machines.repos`,{machine:t});function Np(e,t){let n=t.filter(e=>e.state===`online`).map(e=>e.alias).join(`
21
21
  `);(0,h.useEffect)(()=>{for(let t of n?n.split(`
22
22
  `):[])Mp(e,t).catch(()=>{})},[e,n])}function Pp(e,t){I();let[n,r]=(0,h.useState)(null);if((0,h.useEffect)(()=>{if(!t)return;let n=!1;return Mp(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=J(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:F(`newSession.remoteFailed`,{machine:t,message:i?.failed??``})};let s=o.reason?jp[o.reason]:void 0,c=o.reason?s?F(s,{machine:t}):F(`newSession.remoteFailed`,{machine:t,message:o.message??o.reason}):``;return{repos:o.repos,loaded:!0,problem:c}}function Fp(e,t){return t.problem?t.problem:t.loaded?F(`newSession.remoteNone`,{machine:e}):F(`newSession.remoteLoading`,{machine:e})}function Ip(){return(0,L.jsxs)(`svg`,{className:np,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,L.jsx)(`rect`,{x:`2`,y:`3`,width:`12`,height:`8`,rx:`1`}),(0,L.jsx)(`path`,{d:`M5.5 13.5h5M8 11v2.5`})]})}function Lp(e){let t=(I()===`zh`?Yr:Jr).machine,n=e.machines.find(t=>t.alias===e.value),r=e.value?n?.hostLabel||e.value:F(`newSession.thisMachine`);return(0,L.jsx)(xp,{field:`machine`,title:F(`newSession.machine`),label:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Ip,{}),r]}),children:n=>(0,L.jsx)(wp,{heading:F(`newSession.machine`),options:[{id:``,label:F(`newSession.thisMachine`)},...e.machines.map(e=>({id:e.alias,label:Vf(e,t),disabled:e.state!==`online`}))],value:e.value,digits:!0,onPick:t=>{e.onPick(t),n()}})})}function Rp(e){let[t,n]=(0,h.useState)(``),r=t.trim();return(0,L.jsx)(xp,{field:`branch`,title:F(`newSession.branch`),label:e.value||F(`newSession.branch`),children:i=>(0,L.jsx)(Sp,{placeholder:F(`newSession.branchTypeRef`),empty:``,rows:[{key:``,text:F(`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 zp(e,t){return(await e.client.request(`task.spawn`,Ap(t))).taskIds[0]}function Bp(e){return e instanceof pd&&e.code===`CLONE_FAILED`?W(`newTask`,`error.cloneFailed`,{error:e.message}):e instanceof Error?e.message:String(e)}function Vp(e){let[t,n]=(0,h.useState)(``);if(e.ungrouped)return null;if(e.remote)return e.remotePick&&(0,L.jsx)(Rp,{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=ml(s?.branches??[],t).map(e=>({key:e,text:e,checked:e===(i[o]||s?.current)})),u=r.map(t=>({path:t,name:pl(t).base,primary:t===o,branches:e.probes[t]?.branches??[],current:e.probes[t]?.current??``,base:i[t]??``}));return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`button`,{type:`button`,className:`${rp(!a)} ${ip}`,"aria-pressed":!a,disabled:r.length>1||e.plain,title:e.plain?F(`newSession.worktreeNoGit`):r.length>1?F(`newSession.worktreeMulti`):F(a?`newSession.worktreeOff`:`newSession.worktreeOn`),onClick:e.onToggleWorktree,children:[(0,L.jsx)(bp,{}),F(`newSession.worktree`)]}),r.length>1?(0,L.jsx)(xp,{field:`branch`,title:F(`newSession.branches`),label:F(`newSession.branches`),children:()=>(0,L.jsx)(Ep,{repos:u,branch:e.branchName,onBranch:e.onBranchName,onBase:e.onBase})}):!a&&s?.ok&&c&&(0,L.jsx)(xp,{field:`branch`,title:F(`newSession.branch`),label:c,children:r=>(0,L.jsx)(Sp,{placeholder:F(`newSession.branchSearch`),empty:F(`newSession.branchEmpty`),rows:l,query:t,onQuery:n,onPick:t=>{e.onBase(o,t),n(``),r()}})})]})}var Hp=`rove.web.newSession.prompt`,Up=`rove.web.newSession.attachments`,Wp=sessionStorage.getItem(Hp)??``;function Gp(){return Wp}function Kp(e){Wp=e;try{sessionStorage.setItem(Hp,e)}catch{}}function qp(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=El(a,t);r(n),n[0]&&n[0]!==e.engine&&e.setEngine(n[0])}}}function Jp(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,L.jsx)(xp,{field:`engine`,title:F(`newSession.engine`),label:Dl(i)||F(`newSession.engine`),children:i=>(0,L.jsx)(wp,{heading:F(`newSession.engine`),options:r.map(e=>({id:e.id,label:e.name,dim:e.ready===!1})),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,L.jsx)(R,{className:`mx-2 mt-1 mb-0.5 self-start font-mono`,"data-field":`compare-engines`,hit:`tight`,onClick:()=>t.setComparing(!t.comparing),children:F(t.comparing?`compare.oneEngine`:`compare.severalEngines`)}):null})})}function Yp(e){return(0,L.jsx)(xp,{field:`model`,title:F(`newSession.model`),label:Tl(e.models,e.model,e.effort,F(`newSession.modelDefault`)),children:t=>(0,L.jsx)(Tp,{...e,close:t})})}var Xp=6e4,Zp=/^(?:(today|tomorrow|今天|明天)\s*)?(\d{1,2})(?::(\d{2}))?\s*(am|pm)?$/i,Qp=/^\+\s*(?:(\d+)\s*h)?\s*(?:(\d+)\s*m)?$/i;function $p(e,t){let n=e.trim(),r=Qp.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*Xp):null}let i=Zp.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 em(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 tm(e){let[t,n]=(0,h.useState)(``),r=()=>{let n=$p(t,new Date);if(!n)return e.onInvalid(F(`newSession.laterBad`));e.onSchedule(n)};return(0,L.jsxs)(`div`,{className:vp,children:[(0,L.jsx)(`input`,{className:`${ln} min-w-0 flex-1`,value:t,placeholder:F(`newSession.laterPlaceholder`),"aria-label":F(`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,L.jsx)(R,{variant:`filled`,disabled:!t.trim(),onClick:r,children:F(`newSession.laterConfirm`)})]})}function nm(e){let[t,n]=(0,h.useState)(`root`);return(0,L.jsx)(xp,{field:`more`,title:F(`newSession.more`),label:(0,L.jsx)(`span`,{"aria-hidden":`true`,children:`⋯`}),onClose:()=>n(`root`),children:r=>t===`later`?(0,L.jsxs)(`div`,{className:cp,children:[(0,L.jsxs)(`button`,{type:`button`,className:`${up} ${z} text-muted`,onClick:()=>n(`root`),children:[`‹ `,F(`newSession.later`)]}),(0,L.jsx)(tm,{onBack:()=>n(`root`),onInvalid:e.onInvalid,onSchedule:t=>{r(),e.onLater?.(t)}})]}):(0,L.jsx)(`div`,{role:`menu`,className:cp,children:e.onLater&&(0,L.jsx)(rm,{label:F(`newSession.later`),sub:!0,disabled:e.busy,onClick:()=>n(`later`)})})})}function rm(e){return(0,L.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`${dp({cursor:!1})} [&:hover:not(:disabled)]:bg-hover`,disabled:e.disabled,onClick:e.onClick,children:[(0,L.jsx)(`span`,{className:mp,children:e.label}),(e.dim!==void 0||e.sub)&&(0,L.jsxs)(`span`,{className:`${pp} text-muted`,children:[e.dim,e.sub&&(0,L.jsx)(fo,{right:!0})]})]})}var im=128,am=80,om=3,sm=2,cm=im/2,lm=am/2,um=25,dm=(1-1.2/um)**2,fm=1e3/30,pm=7,mm=0,hm=1,gm=2,_m=3,vm=4,ym=[``,`--color-subtle`,`--color-muted`,`--color-ink`,`--color-accent`],bm=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5],xm=Array.from({length:64},(e,t)=>{let n=t%8,r=t>>3;return(4*(bm[(r&3)*4+(n&3)]??0)+([0,2,3,1][(r>>2)*2+(n>>2)]??0)+.5)/64}),Sm=(e,t)=>xm[(t&7)*8+(e&7)]??1,Cm=[{radius:1.55,lift:.3,roll:-.42,speed:.9,phase:.4,ink:vm},{radius:1.95,lift:.22,roll:.3,speed:-.55,phase:2.6,ink:_m},{radius:2.4,lift:.36,roll:-.12,speed:.38,phase:4.4,ink:_m}],wm=1.9,Tm=[[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 Em(e,t){e.fill(mm);let n=(t,n,r)=>{t>=0&&t<im&&n>=0&&n<am&&(e[n*im+t]=r)};for(let[e,r,i]of Tm)Math.sin(t*.8+i)>-.5&&n(e,r,hm);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<am;e++)for(let t=0;t<im;t++){let s=(t+.5-cm)/um,u=(e+.5-lm)/um,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)>Sm(t,e)?n(t,e,h>.4?_m:gm):p>dm&&n(t,e,hm)}for(let e of Cm){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(cm+s*um),Math.floor(lm+c*um),l]},o=Math.round(Math.PI*e.radius*um);for(let e=0;e<o;e++){let t=a(e/o*Math.PI*2);t&&!t[2]&&n(t[0],t[1],hm)}let s=e.phase+t*e.speed,c=.5/(e.radius*um),l=-Math.sign(e.speed)*c;for(let e=wm/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,mm)}for(let t=wm/c;t>0;t--){let r=a(s+t*l),i=1-t*c/wm;r&&i>Sm(r[0],r[1])&&n(r[0],r[1],i>.6?e.ink:gm)}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 Dm(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=hm;e<=vm;e++){n.fillStyle=a.getPropertyValue(ym[e]??``)||a.color;for(let r=0;r<t.length;r++)t[r]===e&&n.fillRect(r%im*om,Math.floor(r/im)*om,sm,sm)}}function Om(){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){Em(n,pm),Dm(t,n);return}let r=0,i=0,a=e=>{r=requestAnimationFrame(a),!(e-i<fm)&&(i=e,Em(n,e/1e3),Dm(t,n))};return r=requestAnimationFrame(a),()=>cancelAnimationFrame(r)},[]),(0,L.jsx)(`div`,{"aria-hidden":`true`,className:`mb-3 max-w-full`,children:(0,L.jsx)(`canvas`,{ref:e,width:384,height:240,"data-plate":`rove`,className:`h-auto w-96 max-w-full text-muted`})})}var km=`clone:`;function Am(e){let{model:t,saved:n,picked:r,primary:i,home:a,query:o,remote:s}=e,[c,l]=(0,h.useState)(()=>J(t,`github.repos`)??null);(0,h.useEffect)(()=>{let e=!1;return X(t,`github.repos`).then(t=>!e&&l(t)).catch(()=>!e&&l({repos:[],reason:`failed`})),()=>{e=!0}},[t]);let u=o.trim(),d=ml(n,o),f=F(`newSession.noFolder`),p=e.ungrouped&&(!u||f.toLowerCase().includes(u.toLowerCase()))?[{key:bu,text:f,checked:e.ungrouped.on}]:[],m=d.map(e=>{let{base:t,dir:n}=pl(e);return{key:e,text:t,dim:e===i&&r.length>1?`${F(`newSession.primary`)}, ${n}`:n,checked:r.includes(e)}}),g=bl(u),_=g&&(g.includes(`:`)||d.length===0)?g:null,v=!_&&hl(u)&&!n.includes(u)&&(!s||u.startsWith(`/`))?_l(gl(u,a)):``,y=_?{key:km+_,text:s?F(`newSession.cloneRowOn`,{source:_,machine:s.name}):F(`newSession.cloneRow`,{source:_})}:v?{key:v,text:v,checked:r.includes(v)}:null,b=u.toLowerCase(),x=(c?.repos??[]).filter(e=>e.nameWithOwner.toLowerCase().includes(b)).filter(e=>!kp(n,e.nameWithOwner,s!==void 0)).map(e=>({key:km+e.nameWithOwner,text:e.nameWithOwner,dim:e.description,title:e.description}));return(0,L.jsx)(Sp,{placeholder:F(s?`newSession.repoSearchRemote`:`newSession.repoSearch`),empty:s?.empty??F(`newSession.repoEmpty`),rows:s?.blocked?[]:[...p,...m],query:o,onQuery:e.onQuery,extra:s?.blocked?null:y,more:s?.blocked?[]:x,moreLabel:F(`newSession.githubGroup`),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 jm(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 Mm(e,t){return e?[e,...(t.extras??[]).map(e=>e.repo)]:[]}function Nm(e,t){return e?{...t.baseBranch?{[e]:t.baseBranch}:{},...Object.fromEntries((t.extras??[]).flatMap(e=>e.baseRef?[[e.repo,e.baseRef]]:[]))}:{}}function Pm(e){return[e.machine??``,e.repo??``,e.ungrouped?`u`:``,e.retryOf?.id??``,e.baseBranch??``,e.worktree===void 0?``:String(e.worktree)].join(`\0`)}function Fm(e,t){return e.retryOf&&e.engine&&e.engine===t?e.retryOf.id:void 0}async function Im(e,t){try{let{task:n}=await e.client.request(`task.get`,{taskId:t.id});if(!n.prompt)return void H(F(`menu.retryNoPrompt`),`error`);Dn(jm(t,{...n,prompt:n.prompt}))}catch(e){H(U(e),`error`)}}function Lm(e,t){let n=async n=>{await e.act(`task.archive`,{taskId:t.id,archived:!0,...n?{force:n}:{}}),H(W(`tasks`,`archive.done`,{title:t.label}))};B.set((0,L.jsx)(Or,{title:F(`newSession.retryArchiveTitle`,{title:t.label}),body:F(`newSession.retryArchiveBody`),confirmLabel:W(`tasks`,`menu.archive`),onConfirm:()=>n(!1),escalate:{when:e=>e instanceof pd&&e.code===`TASK_BUSY`,label:W(`tasks`,`archive.busyConfirm`),title:W(`tasks`,`archive.busyTitle`),body:()=>W(`tasks`,`archive.busyBody`,{title:t.label}),run:()=>n(!0)}}))}var Rm=g([]),zm=()=>_(Rm);async function Bm(e){Rm.set((await e.request(`snippets.get`)).snippets)}async function Vm(e,t){Rm.set((await e.request(`snippets.save`,{name:t.name,text:t.text})).snippets)}async function Hm(e,t){Rm.set((await e.request(`snippets.remove`,{name:t})).snippets)}var Um=/^[A-Za-z0-9][\w-]{0,31}$/;function Wm(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 Gm(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 Km(e,t,n){return{text:e.slice(0,t.start)+n.text+e.slice(t.end),caret:t.start+n.text.length}}var qm=e=>e.split(`
@@ -28,36 +28,36 @@ This worktree is at the PR's head ({head}, going into {base}). Read the change a
28
28
  {url}`,error:`error: {message}
29
29
  {hint}`},...T_},zh:{appearance:{enabled:`开启`,disabled:`关闭`,borderFlow:`流动渐变`,borderStill:`静止`,glyphsBraille:`盲文点`,glyphsStarburst:`星芒(需要含 Dingbats 符号区的字体)`,glyphsAscii:`ASCII`,titleShimmer:`流光`,titleStill:`静止`,preview:`工作区预览`,tasks:`任务`,terminal:`终端`,files:`文件`,testsPassed:`测试通过`,transparent:`透明背景`,opaque:`不透明背景`,modeDark:`深色`,modeLight:`浅色`,modeAuto:`自动(跟随终端)`,openHint:`按 Enter 打开选项和预览。`,chooseHint:`↑/↓ 或 j/k 预览 · enter 应用 · esc 取消`},title:`设置`,esc:`esc`,nav:{default:`j/k 选择 · h/l 切换层级 · enter 确认 · esc 关闭`,keys:`j/k 选择 · enter 录入按键 · backspace 恢复默认 · x 解绑 · esc 关闭`,feedback:`tab 下一项 · enter 在发送项发送 · esc 关闭`},sections:{general:`通用`,autoRouting:`自动路由`,engines:`引擎`,plugins:`插件`,marketplace:`插件市场`,keys:`快捷键`,feedback:`反馈`,dev:`开发`},general:{usage:`用量`,theme:`主题`,themeMode:`明暗`,themeHint:`l 进入列表 · j/k 高亮 · enter 应用`,language:`语言`,languageHint:`Rove 界面的显示语言。l 进入列表 · j/k 高亮 · enter 应用。`,transparent:`透明背景`,transparentHint:`去掉渲染器的背景填充,让宿主终端透出来。按 enter 切换。`,on:`[x] 开`,off:`[ ] 关`,focusAccent:`聚焦强调色`,focusAccentHint:`聚焦面板标题、▌ 标记和分隔边框的颜色。`,accentPrimary:`主色(品牌强调色)`,accentSuccess:`成功色(传统绿)`,accentInfo:`信息色(冷蓝)`,appearance:`外观`,appearanceHint:`分屏面板怎么画边。`,splitStyle:`分屏面板`,workingBorder:`运行中边框`,taskColors:`任务配色`,glyphSet:`状态符号`,colorblind:`色盲友好的增删配色`,runningTitle:`运行中标题`,splitBox:`方框边框`,splitLine:`单线分隔`,splitRail:`左侧强调条`,splitRule:`顶部横线`,notifications:`通知`,notificationsHint:`后台标签完成或在审批处暂停时触发。`,toast:`Toast 弹窗`,toastHint:`右下角弹窗`,sound:`声音`,soundHint:`响铃 + 提示音 + OSC 9 桌面通知(经 SSH 直达本地)`,soundVolume:`提示音音量 — {percent}%`,soundVolumeHint:`回车循环切换;下一声提示音生效`,crossTask:`跨任务`,crossTaskHint:`你已切走的任务也通知`,finishedAlerts:`回合完成`,finishedAlertsHint:`关闭后只有审批和错误会提醒;未读标记照常`,keyHints:`键盘提示`,keyHintsHint:`状态栏提醒,以及侧栏和文件面板的首用提示。`,keyHintsShow:`显示键盘提示`,keyHintsShowHint:`重新开启会点亮已因使用而熄灭的提示`,zen:`禅模式`,zenHint:"`zen` 标记和 `prefix`+z 隐藏 Files,保留 Tasks 侧栏与 workspace。",zenDefaultOn:`启动即进入禅模式`,updates:`更新`,updatesHint:`稳定版是默认渠道;next 预览即将发布的版本;nightly 每天从 main 自动构建。`,updateChannelTitle:`发布渠道`,updateChannel:`渠道:{channel}`,updateChannelHint:"enter 在稳定版 / next / nightly 间切换;`rove update` 跟随它",updateChannelName:{latest:`稳定版`,next:`next 预览版`,nightly:`nightly 预览版`},updateNotify:`有新版本时通知我`,updateNotifyHint:`只针对所选渠道;关闭后不再显示更新标记,手动检查仍会给出结果`,updateCheck:`[ 检查更新 ]`,updateCheckHint:`立即向 npm 查询所选渠道的最新版本`,updateCheckButton:`检查更新`,updateChecking:`检查中…`,updateOpenPage:`打开更新页`,updateOpenPageRow:`[ 打开更新页 ]`,railFold:`折叠后的任务栏`,railFoldHint:`任务栏从角标折叠之后显示什么。`,railFoldRow:`折叠后显示:{style}`,railFoldRowHint:`enter 切换`,railFoldGlyphs:`状态字形`,railFoldInitials:`字形 + 首字母`,railFoldHairline:`仅色带`,editor:`编辑器`,editorHint:`文件树里按 enter 用什么打开文件——支持时走编辑器 diff 模式,未安装时回退到只读预览。`,editorRow:`编辑器: < {kind} >`,editorRowHint:`auto 跟随 $VISUAL / $EDITOR,否则 nvim / vim / emacs / nano`,editorCustom:`自定义: {cmd}`,editorCustomUnset:`(未设置 — enter 编辑)`,worktree:`工作树位置`,worktreeHint:`新任务工作树的创建位置。仅对新任务生效。`,worktreeBase:`位置: < {kind} >`,worktreeBaseHint:"自定义可填 `~`、相对路径或以 `$project_dir` 开头",worktreeKindDefault:`默认 ~/.rove/worktrees`,worktreeKindNext:`项目旁边`,worktreeKindCustom:`自定义`,worktreeCustom:`自定义: {path}`,worktreeCustomUnset:`(未设置 — enter 编辑)`,worktreeBaseTitle:`自定义工作树位置(留空 = 默认;$project_dir = 项目根目录)`,worktreeBaseField:`路径`,editorCustomTitle:`自定义编辑器命令(用 {file} 代表文件路径)`,worktreeBaseInvalidTitle:`无法使用该工作树位置`,worktreeBaseTokenBody:`{token} 只能作为路径的第一段展开(如 {token}/../rove-worktrees)。保留原设置。`,worktreeBaseUnusableBody:`{path} 不可用({error})。保留原设置 —— 请选择一个可写目录。`,terminal:`终端`,terminalHint:`对修改后新打开的终端生效。`,scrollbackRow:`回滚行数: {rows} 行`,scrollbackRowHint:`100–100000 · 调大会按比例增加每次重绘的 CPU`,scrollbackTitle:`终端回滚行数(100–100000)`,scrollbackField:`行数`,scrollbackInvalidTitle:`不是数字`,scrollbackInvalidBody:`回滚行数必须是数字(如 1000)。保留原设置。`,tabStripRow:`标签栏: {mode}`,tabStripMode:{never:`关闭 — 标签在左侧树里`,multipleOnly:`仅 2 个以上标签时显示`,always:`始终显示`}},field:{command:`命令`,name:`名称`,id:`标识`},action:{save:`保存`,next:`下一步`,add:`添加`},reset:{title:`重置界面状态?`,body:`将清除 ~/.config/rove/state.json 和 ~/.rove/tasks.json 并退出 Rove —— 重新启动后会是一个干净的开始,工作会话列表为空。磁盘上的工作树和引擎会话历史不受影响。`,done:`Rove:界面状态已重置。重新启动 Rove 即可从头开始。`,failedTitle:`UI 状态未能重置`,failedBody:`无法写入设置文件。设置和任务均已保留,请稍后重新尝试重置。`},restart:{title:`重启后端?`,body:`会停掉 daemon,并以已安装的版本重新启动当前 Rove 窗口,从而让 daemon / orchestrator / 引擎的改动生效。正在运行的引擎会话由 PTY host 托管,不会中断;已打开的标签页会恢复。其他已连接的窗口会自行重连。`,done:`Rove:正在重启后端……`},stateWrite:{failedTitle:`设置未能保存`,failedBody:`{file} 写入失败({keys})。请检查目录权限和磁盘空间,再次保存。`},...w_,...O_,...A_,keybindings:{title:`快捷键`,hint:`在某一行按 enter,再按你想要的键。想放到 prefix 后面,就先按 prefix 键。改动会写进下面的文件,立即生效。`,configFile:`配置文件`,notCreated:` (尚未创建)`,prefixTitle:`命令层({prefix})`,prefixHint:`裸键作用于当前聚焦面板;少量单次快捷键覆盖高频 Rove 操作;{prefix} 打开命令层(第二击窗口 {timeout}ms)。Prefix 绑定保持原有的面板作用域和 modal 规则。`,tapPresentation:`点按 Prefix`,tapPresentationHint:`选择完整指南是否同时标记当前屏幕上的入口。`,tapPresentationLocal:`屏幕入口 + 完整指南(默认)`,tapPresentationGuide:`仅完整指南`,prefixDisabled:`已禁用`,prefixKey:`Prefix 键`,recording:`按下新的键…(esc 取消)`,recordingPrefix:`{prefix},然后…(esc 取消)`,recordingSlot:`按下「{slot}」对应的键…(esc 取消)`,unbound:`(已解绑)`,defaultKeys:`默认: {keys}`,warnings:`警告`},feedback:{title:`反馈`,hint:"通过 `gh` 在 Rove 仓库提一个 GitHub issue。需要 `gh auth login`;没登录时会给你一条预填好的链接。",titleLabel:`标题`,titlePlaceholder:`简短概括`,descriptionLabel:`描述`,descriptionPlaceholder:`发生了什么?(enter 换行 · tab 跳到发送)`,send:`[enter] 提交 GitHub issue`,submitting:`提交中...`,sent:`已提交 #{number}:{url}`,notFiled:`未提交:{hint}
30
30
  {url}`,error:`错误:{message}
31
- {hint}`},...E_}},M_={en:Jr,zh:Yr};function Q(e,t){return Ie(j_,e,t)}function N_(e,t){return Ie(M_,e,t)}function P_({label:e,value:t,picks:n,onPick:r}){return(0,L.jsx)(`fieldset`,{"aria-label":e,className:`m-0 inline-flex min-w-0 flex-wrap gap-0.5 rounded-sm border-hairline border-line bg-inset p-0.5`,children:n.map(e=>{let n=e.value===t;return(0,L.jsx)(`button`,{type:`button`,"aria-pressed":n,className:Re(`rounded-xs px-2.5 py-1 font-sans text-meta whitespace-nowrap touch:min-h-9`,`focus-visible:outline-1 focus-visible:outline-offset-1 focus-visible:outline-focus`,n?`bg-menu text-ink`:`text-muted hover:bg-hover`),onClick:()=>!n&&r(e.value),children:e.label},e.value)})})}function F_({label:e,value:t,picks:n,onPick:r}){return(0,L.jsxs)(`span`,{className:`relative inline-flex max-w-full min-w-0 text-ink`,children:[(0,L.jsx)(`select`,{"aria-label":e,value:t,className:`max-w-full min-w-0 truncate rounded-sm border-hairline border-line bg-paper py-1.25 pr-7 pl-2.5 font-sans text-meta hover:border-line-active focus-visible:border-line-active focus-visible:outline-none touch:min-h-10`,onChange:e=>{let t=n.find(t=>String(t.value)===e.target.value);t&&r(t.value)},children:n.map(e=>(0,L.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,L.jsx)(fo,{className:`pointer-events-none absolute top-1/2 right-2.5 -translate-y-1/2 text-subtle`})]})}var I_=`${Wn} w-narrow:pt-0`,L_=`dialog relative m-0 flex h-[min(640px,80vh)] w-[min(880px,calc(100vw-32px))] overflow-hidden rounded-md border-hairline border-line bg-surface text-inherit shadow-dialog focus:outline-none motion-safe:animate-rise-in [.is-leaving_&]:animate-sink-out w-narrow:h-dvh w-narrow:w-screen w-narrow:flex-col w-narrow:rounded-none w-narrow:border-0 w-narrow:pt-[env(safe-area-inset-top)] w-narrow:pb-[env(safe-area-inset-bottom)] short:h-[calc(100dvh-24px)]`,R_=`absolute top-3 right-3 z-1 grid size-7 place-items-center rounded-sm text-display leading-none text-muted hover:bg-inset hover:text-ink focus-visible:bg-inset focus-visible:text-ink touch:size-10`,z_=`flex w-56 flex-none flex-col gap-5 overflow-y-auto scrollbar-none [border-right:var(--hairline)_solid_var(--line)] px-2.5 py-4 w-narrow:w-full w-narrow:flex-1 w-narrow:[border-right:none] w-narrow:px-3 w-narrow:py-3`,B_=`m-0 px-2 pb-0.5 font-sans text-title font-semibold normal-nums text-ink`,V_=`flex flex-col gap-0.5`,H_=`m-0 px-2 pb-1 font-mono text-meta font-normal text-subtle`,U_=(e,t)=>`flex items-center rounded-sm px-2 py-1.25 text-left font-sans text-body touch:min-h-10 w-narrow:min-h-11 w-narrow:px-3 ${e?`bg-menu text-ink`:`${t?`text-muted`:`text-ink`} [&:hover]:bg-hover`}`,W_=`ml-auto hidden text-subtle w-narrow:block`,G_=`flex flex-col`,K_=`m-0 pb-2 text-meta text-subtle`,q_=`flex flex-col border-t-hairline border-t-line [&>*]:border-b-hairline [&>*]:border-b-line`,J_=`flex items-center justify-between gap-x-6 gap-y-2 py-3 w-narrow:flex-col w-narrow:items-stretch`,Y_=`flex items-center justify-between gap-x-6 py-3`,X_=`flex flex-col gap-3 py-3`,Z_=`flex min-w-0 flex-1 flex-col gap-0.5`,Q_=`text-body text-ink`,$_=`text-meta text-muted [&_a]:text-accent`,ev=`max-w-90 min-w-0 truncate font-mono text-meta text-muted [overflow-wrap:anywhere]`,tv=`m-0 py-3 text-body text-muted`,nv=`rounded-sm border-hairline border-line bg-paper px-2.5 py-1.5 font-sans text-body text-ink focus-visible:border-line-active focus-visible:outline-none`,rv=`${nv} w-24 text-right`,iv=`flex flex-col gap-1.5`,av=`text-meta font-medium text-muted`,ov=`min-h-30 max-h-[50vh] leading-[1.45]`,sv=`flex flex-wrap items-center justify-end gap-2.5`,cv=`flex items-center gap-2.5 rounded-sm bg-inset px-3 py-2 text-meta`,lv=`grid grid-cols-[minmax(0,1fr)_104px_72px] items-center gap-3`,uv=`flex flex-col`,dv=`${lv} pb-1.5 pl-7.5 font-sans text-meta font-medium normal-nums text-subtle [&>span:not(:first-child)]:text-center`,fv=`border-b-hairline border-b-line first:border-t-hairline first:border-t-line`,pv=`${lv} group/eng rounded-sm py-1.5 pr-1 pl-0`,mv=`flex min-w-0 items-center gap-2 rounded-sm py-1.5 pr-0 pl-1.5 text-left focus-visible:outline-1 focus-visible:outline-offset-1 focus-visible:outline-focus`,hv=e=>`mx-0.5 ${e?`text-muted`:`text-subtle`}`,gv=`flex min-w-0 flex-col gap-0.5`,_v=e=>`truncate text-body leading-[inherit] font-medium ${e?`text-muted`:`text-ink`}`,vv=`ml-2 text-meta leading-[inherit] font-normal text-subtle`,yv={ready:`bg-success`,attention:`bg-warning`,error:`bg-error`,absent:`bg-subtle`},bv=e=>`inline-flex items-center gap-1.5 text-meta leading-[inherit] ${e===`error`?`text-error`:`text-muted`}`,xv=e=>`size-1.75 flex-none rounded-full ${yv[e]}`,Sv=`flex justify-center`,Cv=`rounded-full bg-accent-soft px-2.5 py-0.5 font-sans text-meta font-medium normal-nums capitalize text-accent`,wv=`rounded-full border-hairline border-line px-2.5 py-0.5 text-meta leading-[inherit] whitespace-nowrap text-muted opacity-0 transition-opacity duration-120 ease-[ease] group-hover/eng:opacity-100 group-focus-within/eng:opacity-100 hover:border-line-active hover:text-ink motion-reduce:transition-none touch:opacity-100`,Tv=`mt-0 mr-1 mb-3 ml-7 flex flex-col gap-2.5 px-1.5 py-1`,Ev=`m-0 grid grid-cols-[max-content_minmax(0,1fr)] gap-x-3.5 gap-y-1.5 text-meta leading-[1.5]`,Dv=`text-subtle`,Ov=e=>`m-0 wrap-anywhere ${e?`text-warning`:`text-ink`}`,kv=`flex items-center gap-2`,Av=`flex-1 px-2 py-1.25`,jv=`text-meta leading-[inherit] text-success`,Mv=`flex items-center gap-3 py-2.5`,Nv=`flex min-w-0 flex-1 flex-col gap-0.5`,Pv=(e=!1)=>`overflow-hidden text-ellipsis text-meta text-muted ${e?`whitespace-normal`:`whitespace-nowrap`}`,Fv=`flex flex-col gap-1 py-3`,Iv=`flex items-baseline gap-3`,Lv=`flex flex-col gap-2.5 pt-2`,Rv=`grid grid-cols-[repeat(auto-fill,minmax(96px,1fr))] gap-2`,zv=`m-0 pb-1.5 text-meta font-medium text-subtle`,Bv=e=>e?`border-accent bg-accent-soft`:`border-line hover:bg-hover`,Vv=`flex h-9 overflow-hidden rounded-xs border-hairline`,Hv=`flex w-2/5 flex-col gap-0.75 p-1`,Uv=`flex min-w-0 flex-1 flex-col gap-0.75 p-1`,Wv=`h-0.75 rounded-xs`,Gv=`mt-auto flex gap-0.75`,Kv=`size-1 rounded-xs`,qv=`flex min-w-0 items-baseline gap-1.5 font-sans text-meta`,Jv=`group relative h-4.5 w-7.5 flex-none justify-self-center rounded-full border-hairline border-line bg-inset transition-[background,border-color] duration-120 ease-[ease] aria-checked:border-accent aria-checked:bg-accent motion-reduce:transition-none`,Yv=`absolute top-0.5 left-0.5 size-3 rounded-full bg-muted transition-[transform,background] duration-120 ease-[ease] group-aria-checked:[transform:translateX(12px)] group-aria-checked:bg-paper motion-reduce:transition-none`;function Xv({on:e,...t}){return(0,L.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,className:Jv,...t,children:(0,L.jsx)(`span`,{className:Yv})})}function Zv(e){return(0,L.jsxs)(`section`,{className:G_,children:[e.title&&(0,L.jsx)(`h2`,{className:`m-0 pb-1.5 font-sans text-meta font-medium normal-nums text-muted`,children:e.title}),e.hint&&(0,L.jsx)(`p`,{className:`m-0 pb-2 text-meta text-subtle`,children:e.hint}),(0,L.jsx)(`div`,{className:q_,children:e.children})]})}function Qv(e){let t=(0,L.jsxs)(`div`,{className:Z_,children:[(0,L.jsx)(`span`,{id:e.labelId,className:Q_,children:e.label}),e.hint&&(0,L.jsx)(`span`,{className:`text-meta text-muted [&_a]:text-accent`,children:e.hint})]});return e.stack?(0,L.jsxs)(`div`,{className:X_,children:[t,e.children]}):(0,L.jsxs)(`div`,{className:e.inline?Y_:J_,children:[t,e.children&&(0,L.jsx)(`div`,{className:`flex min-w-0 flex-none items-center justify-end gap-2 w-narrow:justify-start`,children:e.children})]})}function $v(e){let t=(0,h.useId)();return(0,L.jsx)(Qv,{label:e.label,hint:e.hint,labelId:t,inline:!0,children:(0,L.jsx)(Xv,{on:e.checked,"aria-labelledby":t,disabled:e.disabled,onClick:()=>e.onChange(!e.checked)})})}var ey=36;function ty(e){let t=e.picks.length<=4&&e.picks.reduce((e,t)=>e+t.label.length,0)<=ey?P_:F_;return(0,L.jsx)(Qv,{label:e.label,hint:e.hint,children:(0,L.jsx)(t,{label:e.label,value:e.value,picks:e.picks,onPick:e.onPick})})}function ny(e){return(0,L.jsx)(Qv,{label:e.label,hint:e.note,children:(0,L.jsx)(`span`,{className:ev,children:e.value})})}var ry=`flex items-baseline justify-between`,iy=`[&_b]:mr-2.5`,ay=`my-2.5 flex flex-col`,oy=e=>`flex gap-3 rounded-sm px-2 py-1 text-left text-[length:var(--fs-body)] ${e?`bg-menu`:``}`,sy=`min-w-[14ch]`,cy=`whitespace-nowrap text-[length:var(--fs-meta)] text-warning`,ly=`rail-tight:hidden`,uy=`[&_h2]:mx-0 [&_h2]:mt-3.5 [&_h2]:mb-1 [&_h2]:text-[length:var(--fs-body)]`,dy=`max-h-[55vh] overflow-x-hidden overflow-y-auto`,fy=`mr-auto text-[length:var(--fs-meta)]`,py=`text-[length:var(--fs-body)] leading-[1.55] wrap-anywhere [&_h3]:mx-0 [&_h3]:mt-3 [&_h3]:mb-1.5 [&_h3]:font-sans [&_h3]:text-meta [&_h3]:font-medium [&_h3]:normal-nums [&_h3]:text-muted [&_h3:first-child]:mt-0 [&_ul]:m-0 [&_ul]:pl-4.5 [&_li+li]:mt-2 [&_p]:mx-0 [&_p]:mt-0 [&_p]:mb-2 [&_a]:text-accent [&_a]:underline [&_a]:underline-offset-2 [&_code]:rounded-sm [&_code]:bg-inset [&_code]:px-1 [&_code]:py-0 [&_code]:font-mono [&_code]:text-meta [&_code]:font-normal [&_code]:normal-nums`,my=`mt-3`,hy=e=>`rounded-sm px-2 py-1.25 ${e?`bg-menu`:``}`,gy=`flex items-baseline gap-2 text-[length:var(--fs-body)]`,_y=`flex items-baseline justify-between gap-2`,vy=`font-mono`,yy=`truncate`,by=`mt-4 text-[length:var(--fs-meta)]`;function xy(e){return e.replace(/\[`[0-9a-f]{7,40}`\]\([^)]*\)\s*/g,``).replace(/\s+[—-]\s+\[@[^\]]+\]\([^)]*\)\s*$/,``).trim()}function Sy(e){let t=[],n=(e,n)=>t.push({kind:e,text:n,id:t.length});for(let r of e.split(/\r?\n/)){let e=r.trimEnd();if(e.trim()===``)continue;let i=/^#{1,6}\s+(.*)$/.exec(e);if(i){n(`heading`,i[1]??``);continue}let a=/^\s*[-*]\s+(.*)$/.exec(e);if(a){n(`item`,a[1]??``);continue}let o=t.at(-1);o&&o.kind!==`heading`?o.text=`${o.text} ${e.trim()}`:n(`para`,e.trim())}return t.map(e=>e.kind===`item`?{...e,text:xy(e.text)}:e)}var Cy=/\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)|`([^`]+)`|\*\*([^*]+)\*\*/g;function wy(e){let t=[],n=0;for(let r of e.matchAll(Cy)){let i=r.index??0;i>n&&t.push(e.slice(n,i));let[a,o,s,c,l]=r;o!==void 0&&s!==void 0?t.push((0,L.jsx)(`a`,{href:s,target:`_blank`,rel:`noopener noreferrer`,children:wy(o)},i)):c===void 0?l!==void 0&&t.push((0,L.jsx)(`b`,{children:l},i)):t.push((0,L.jsx)(`code`,{children:c},i)),n=i+a.length}return n<e.length&&t.push(e.slice(n)),t}function Ty({body:e}){let t=Sy(e),n=[],r=[],i=()=>{r.length>0&&n.push((0,L.jsx)(`ul`,{children:r},`ul-${n.length}`)),r=[]};for(let e of t){if(e.kind===`item`){r.push((0,L.jsx)(`li`,{children:wy(e.text)},e.id));continue}i(),n.push(e.kind===`heading`?(0,L.jsx)(`h3`,{children:e.text},e.id):(0,L.jsx)(`p`,{children:wy(e.text)},e.id))}return i(),(0,L.jsx)(`div`,{className:py,children:n})}var Ey=`page min-h-0 flex-1 rounded-md border-hairline border-line bg-paper px-4.5 py-3.5 focus:outline-none`,Dy=`${Ey} overflow-y-auto`,Oy=`page-title mx-0 mt-0 mb-1.5 font-sans text-title font-bold normal-nums`,ky=`flex items-baseline justify-between gap-4 [&_.page-title]:m-0`,Ay=e=>`min-w-0 truncate text-meta ${e?``:`leading-[inherit]`}`,jy=`flex flex-wrap items-center gap-2`,My={row:`touch:after:-inset-x-0.75 touch:after:-inset-y-0.5`,kanban:`touch:after:-inset-x-0.75 touch:after:-top-1.5 touch:after:-bottom-1`,header:`touch:after:-inset-x-0.75 touch:after:-top-2.5 touch:after:-bottom-1.25`},Ny=`mt-2.5 flex flex-col gap-1.5`,Py=e=>`flex cursor-pointer flex-col gap-0.5 rounded-sm px-2.5 py-1.5 ${e?`bg-menu`:``}`,Fy=`flex min-w-0 items-baseline gap-2.5`,Iy=`whitespace-nowrap text-muted`,Ly=`flex gap-2.5 pl-[4ch] text-meta leading-[inherit] text-muted`,Ry=`min-w-0 flex-1 truncate`,zy=`flex flex-col px-1.5 pb-2`,By=`flex flex-col border-t-hairline border-t-line px-1.5 pt-0.5 pb-0.5`,Vy=`relative flex flex-col`,Hy=e=>`flex items-center rounded-sm px-2 py-0.75 text-left touch:min-h-10 ${e?`bg-menu text-ink`:`text-muted [&:hover]:bg-hover`}`,Uy=`ml-auto -mr-[4.5px] w-5 text-center font-sans text-display leading-none font-normal text-accent normal-nums`,Wy=`mr-[7px] size-3.5 flex-none fill-none stroke-current stroke-[1.75] [stroke-linecap:round] [stroke-linejoin:round]`,Gy=g(null),Ky=g(!1),qy=(e,t)=>e.replace(/\{(\w+)\}/g,(e,n)=>t[n]??e),Jy=e=>`https://github.com/Sma1lboy/rove/releases/tag/v${e}`;function Yy(){return I()===`zh`?$r:Qr}function Xy(e,t){return e.request(`update.check`,{force:!0,locale:Me.get(),channel:t}).then(e=>(Gy.set(e),!0),()=>!1)}function Zy(){let e=Yy(),t=_(Gy),{prefs:n}=x_();return!n.updateNotify||!t?.info?.hasUpdate?null:(0,L.jsxs)(`button`,{type:`button`,className:`${z} text-muted ${cy} ${Ze}`,title:qy(e.chip,{version:t.info.latest}),onClick:()=>Ja(`update`),children:[`↑`,(0,L.jsxs)(`span`,{className:ly,children:[` `,t.info.latest]})]})}var Qy=1e3;function $y(e){let[t,n]=(0,h.useState)(null),[r,i]=(0,h.useState)(!0);return(0,h.useEffect)(()=>{if(!r)return;let t=!0,a,o=()=>e.request(`update.status`,{}).then(e=>{t&&(n(e.status),e.status?.running?a=setTimeout(o,Qy):i(!1))},()=>t&&i(!1));return o(),()=>{t=!1,clearTimeout(a)}},[e,r]),{run:t,setRun:n,poll:()=>i(!0)}}function eb({client:e}){let t=Yy(),n=_(Gy),[r,i]=(0,h.useState)(!1),[a,o]=(0,h.useState)(`release`),[s,c]=(0,h.useState)(null),{run:l,setRun:u,poll:d}=$y(e),f=(0,h.useRef)(null);(0,h.useEffect)(()=>{f.current?.focus(),Xy(e).finally(()=>i(!0))},[e]);let p=n?.info??null,m=n?.current??``,g=p?.latest??m,v=p?.hasUpdate===!0,y=r&&p===null,b=r&&p!==null&&!v,x=n?.notes??[],S=x[0]?.url??(g?Jy(g):null),C=[...v&&!l?.running?[{id:`update`,key:`U`,label:t.actions.updateNow,detail:`rove update`}]:[],{id:`release`,key:`R`,label:t.actions.openRelease,detail:S??t.releaseUrlUnavailable},{id:`close`,key:`Q`,label:t.actions.close,detail:t.actions.closeDetail}],w=n=>{if(n===`close`)return V.set(null);if(n===`update`){if(!v||l?.running)return;c(null),e.request(`update.run`,{}).then(e=>{u(e.status),d()},e=>{if(e instanceof pd&&e.code===`BUSY`)return d();c(qy(t.webStartFailed,{error:e instanceof Error?e.message:String(e)}))});return}c(S&&window.open(S,`_blank`,`noopener`)!==null?t.statusReleaseOpened:t.statusReleaseError)};return(0,h.useEffect)(()=>{!r||!Ky.get()||(Ky.set(!1),v&&w(`update`))},[r,v]),(0,L.jsxs)(`div`,{className:Dy,tabIndex:0,ref:f,onKeyDown:e=>{if(e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`c`&&!window.getSelection()?.toString())return e.preventDefault(),w(`close`);if(e.metaKey||e.ctrlKey||e.altKey)return;let t=C.findIndex(e=>e.id===a);if(e.key===`j`||e.key===`ArrowDown`)o(C[(t+1)%C.length]?.id??`close`);else if(e.key===`k`||e.key===`ArrowUp`)o(C[(t-1+C.length)%C.length]?.id??`close`);else if(e.key===`Enter`)w(a);else if(e.key===`u`)w(`update`);else if(e.key===`r`)w(`release`);else if(e.key===`q`||e.key===`Escape`)w(`close`);else return;e.preventDefault()},children:[(0,L.jsxs)(`div`,{className:ry,children:[(0,L.jsx)(`h1`,{className:Oy,children:t.pageTitle}),(0,L.jsx)(`button`,{type:`button`,className:`${sn} mono`,onClick:()=>w(`close`),children:cl()?F(`dialog.close`):t.closeHint})]}),(0,L.jsxs)(`p`,{className:`mono ${iy}`,children:[(0,L.jsx)(`span`,{className:`text-muted`,children:t.current}),` `,(0,L.jsxs)(`b`,{children:[`v`,m]}),` `,(0,L.jsx)(`span`,{className:`text-muted`,children:t.latest}),` `,y?(0,L.jsx)(`b`,{className:`text-muted`,children:t.latestUnknown}):r?(0,L.jsxs)(`b`,{className:v?`text-warning`:`text-success`,children:[`v`,g]}):(0,L.jsx)(`span`,{className:`text-muted`,children:`…`})]}),y&&(0,L.jsx)(`p`,{className:`text-muted`,children:t.registryRetry}),b&&(0,L.jsx)(`p`,{className:`text-success`,children:t.upToDate}),(0,L.jsx)(`div`,{className:ay,children:C.map(e=>(0,L.jsxs)(`button`,{type:`button`,className:oy(a===e.id),onClick:()=>w(e.id),children:[(0,L.jsxs)(`span`,{className:`mono keys-only text-accent`,children:[`[`,e.key,`]`]}),(0,L.jsx)(`span`,{className:sy,children:e.label}),(0,L.jsx)(`span`,{className:`text-muted`,children:e.detail})]},e.id))}),s&&(0,L.jsx)(`p`,{className:`mono text-accent`,children:s}),l&&(0,L.jsxs)(L.Fragment,{children:[l.output&&(0,L.jsx)(`pre`,{className:`my-2 max-h-[40vh] overflow-auto whitespace-pre-wrap wrap-anywhere rounded-sm bg-inset p-2 font-mono text-[length:var(--fs-meta)]`,children:l.output}),(0,L.jsx)(`p`,{className:`mono ${l.running?`text-muted`:l.code===0?`text-success`:`text-error`}`,children:l.running?qy(t.webRunning,{command:l.command}):l.code===0?qy(t.webInstalled,{current:m}):qy(t.updateFailed,{code:String(l.code)})})]}),v&&(0,L.jsx)(`p`,{className:`mono text-muted`,children:qy(t.changesSectionHeader,{from:m,to:g})}),!r&&(0,L.jsx)(`p`,{className:`text-muted`,children:t.loadingNotes}),r&&v&&x.length===0&&(0,L.jsx)(`p`,{className:`text-muted`,children:t.notesUnavailable}),x.map(e=>(0,L.jsxs)(`section`,{className:uy,children:[(0,L.jsxs)(`h2`,{className:`mono`,children:[`v`,e.version]}),(0,L.jsx)(Ty,{body:e.body})]},e.version))]})}var tb=`rove.whatsNewSeenVersion`,nb=e=>e.split(/[.-]/).slice(0,3).map(Number),rb=(e,t)=>{let[n,r]=[nb(e),nb(t)];for(let e=0;e<3;e++)if((n[e]??0)!==(r[e]??0))return(n[e]??0)>(r[e]??0);return!1};function ib(e,t){let n=localStorage.getItem(tb);localStorage.setItem(tb,t),!(!n||!rb(t,n))&&e.request(`release.notes`,{version:t.replace(/-.*$/,``),locale:Me.get()}).then(e=>B.set((0,L.jsx)(ab,{from:n,to:t,notes:e.notes})),()=>B.set((0,L.jsx)(ab,{from:n,to:t,notes:null})))}function ab(e){let t=Yy(),n=(0,h.useRef)(null);return(0,h.useEffect)(()=>n.current?.focus(),[]),(0,h.useEffect)(()=>{let e=e=>{e.key===`q`&&B.set(null)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,L.jsxs)(Tr,{title:t.whatsNew.title,wide:!0,children:[(0,L.jsx)(`p`,{className:`text-muted`,children:qy(t.whatsNew.upgraded,{from:e.from,to:e.to})}),(0,L.jsx)(`div`,{className:dy,children:e.notes?(0,L.jsx)(Ty,{body:e.notes.body}):(0,L.jsx)(`p`,{className:`text-muted`,children:t.whatsNew.notesUnavailable})}),(0,L.jsxs)(`div`,{className:un,children:[(0,L.jsx)(`span`,{className:`mono text-muted ${fy} touch:hidden!`,children:F(`whatsNew.keys`)}),(0,L.jsx)(`a`,{className:sn,href:e.notes?.url??Jy(e.to),target:`_blank`,rel:`noopener noreferrer`,children:F(`whatsNew.openRelease`)}),(0,L.jsx)(`button`,{ref:n,type:`button`,className:Be(),onClick:()=>B.set(null),children:F(`whatsNew.continue`)})]})]})}var ob=(e,t)=>e.replace(`{version}`,t);function sb({client:e}){let t=Yy(),n=_(Gy),{prefs:r}=x_(),[i,a]=(0,h.useState)(`idle`),o=()=>{a(`checking`),Xy(e,r.updateChannel).then(e=>a(e?`done`:`failed`))},s=t=>{a(`idle`),b_(e,`updateChannel`,t)},c=n?.info??null,l=i===`failed`||i===`done`&&c===null,u=i===`done`&&n&&c?c.hasUpdate?ob(t.available,c.latest):t.upToDate:l?t.latestUnknown:void 0,d=l?`text-muted`:c?.hasUpdate?`text-warning`:`text-success`;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(ty,{label:Q(`general.updateChannelTitle`),hint:Q(`general.updatesHint`),value:r.updateChannel,picks:f_.map(e=>({value:e,label:Q(`general.updateChannelName.${e}`)})),onPick:s}),(0,L.jsx)($v,{label:Q(`general.updateNotify`),hint:Q(`general.updateNotifyHint`),checked:r.updateNotify,onChange:t=>void b_(e,`updateNotify`,t)}),(0,L.jsxs)(Qv,{label:Q(`general.updates`),hint:Q(`general.updateCheckHint`),children:[i===`done`&&c?.hasUpdate&&(0,L.jsx)(R,{variant:`action`,onClick:()=>Ja(`update`),children:Q(`general.updateOpenPage`)}),(0,L.jsx)(R,{variant:`action`,disabled:i===`checking`,onClick:o,children:Q(i===`checking`?`general.updateChecking`:`general.updateCheckButton`)})]}),u&&(0,L.jsx)(Qv,{label:(0,L.jsx)(`span`,{className:d,children:u}),hint:c?.hasUpdate?(0,L.jsx)(`code`,{className:`font-mono`,children:`rove update`}):void 0,children:i===`done`&&n&&c&&(0,L.jsx)(`span`,{className:`max-w-90 min-w-0 truncate font-mono text-meta text-muted [overflow-wrap:anywhere]`,title:`${t.latest} v${c.latest}`,children:`${t.current} v${n.current} · ${t.latest} v${c.latest}`})})]})}function cb({client:e}){let[t,n]=(0,h.useState)(null),[r,i]=(0,h.useState)(!1),[o,s]=(0,h.useState)(``),[c,l]=(0,h.useState)(null),u=()=>e.request(`auth.status`).then(n,()=>n(null));if((0,h.useEffect)(()=>void u(),[e]),!t)return null;let d=async(t,n)=>{l(null);try{let r=n===void 0?{mode:t}:{mode:t,password:n},{token:o}=await e.request(`auth.setMode`,r);if(o){a(o),window.location.reload();return}i(!1),s(``),await u()}catch(e){l(e instanceof Error?e.message:String(e))}},f=r?`password`:t.mode,p=o.length<t.minPassword;return(0,L.jsxs)(Zv,{title:F(`settings.about.access`),children:[(0,L.jsx)(ty,{label:F(`settings.about.signIn`),hint:F(`settings.about.signInHint.${f}`),value:f,picks:t.modes.map(e=>({value:e,label:F(`settings.about.signInMode.${e}`)})),onPick:e=>{e===`password`&&!t.hasPassword?i(!0):d(e)}}),f===`password`&&(0,L.jsxs)(Qv,{label:F(t.hasPassword?`settings.about.passwordChange`:`settings.about.passwordSet`),hint:c??F(`settings.about.passwordHint`,{min:t.minPassword}),children:[(0,L.jsx)(`input`,{className:`rounded-sm border-hairline border-line bg-paper px-2.5 py-1.5 font-sans text-body text-ink focus-visible:border-line-active focus-visible:outline-none w-48`,type:`password`,autoComplete:`new-password`,"aria-label":F(`settings.about.passwordField`),placeholder:F(`settings.about.passwordField`),value:o,onChange:e=>s(e.target.value),onKeyDown:e=>e.key===`Enter`&&!p&&void d(`password`,o)}),(0,L.jsx)(R,{variant:`action`,disabled:p,onClick:()=>void d(`password`,o),children:F(`settings.about.passwordSave`)})]})]})}function lb({client:e}){let[t,n]=(0,h.useState)(()=>J(e,`daemon.info`)??null);return(0,h.useEffect)(()=>{X(e,`daemon.info`).then(n,()=>n(null))},[e]),(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(Zv,{title:F(`settings.about.groupRove`),children:[t?.daemonVersion&&(0,L.jsx)(Qv,{label:F(`settings.about.daemon`),hint:F(t.stale?`settings.about.daemonStale`:`settings.about.daemonCurrent`,{version:t.daemonVersion})}),(0,L.jsx)(sb,{client:e})]}),(0,L.jsx)(cb,{client:e}),(0,L.jsx)(Zv,{title:F(`settings.about.browser`),children:(0,L.jsx)(Qv,{label:F(`settings.about.signOut`),hint:F(`settings.about.browserHint`),children:(0,L.jsx)(R,{variant:`action`,onClick:()=>void co().then(()=>window.location.reload()),children:F(`settings.about.signOut`)})})})]})}function ub(e,t){return e===`auto`?t?`dark`:`light`:e}function db(e,t,n){let r=e.find(e=>e.name===t)??e.find(e=>e.name===`claude`);return r?r[n]:null}var fb=e=>[1,3,5].map(t=>Number.parseInt(e.slice(t,t+2),16));function pb(e){let[t=0,n=0,r=0]=fb(e).map(e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return .2126*t+.7152*n+.0722*r}function mb(e,t){let[n=0,r=0]=[pb(e),pb(t)].sort((e,t)=>t-e);return(n+.05)/(r+.05)}var hb=4.5,gb=1.1;function _b(e,t,n){let r=e=>t.every(t=>mb(e,t)>=n(t));if(r(e))return e;let i=fb(e),a=pb(t[0])<.18?255:0;for(let e=.02;e<1;e+=.02){let t=i.map(t=>Math.round(t+(a-t)*e).toString(16).padStart(2,`0`)).join(``);if(r(`#${t}`))return`#${t}`}return a?`#ffffff`:`#000000`}function vb(e){let t=[e.background,e.backgroundPanel,e.backgroundElement,e.backgroundMenu],n=_b(e.diffLineNumber,t,()=>hb);return{muted:_b(e.textMuted,t,e=>Math.max(hb,mb(n,e)*gb)),subtle:n}}function yb(e,t){let n=t.colorblind===`on`,r=vb(e);return{"--paper":e.background,"--surface":e.backgroundPanel,"--inset":e.backgroundElement,"--menu":e.backgroundMenu,"--line":e.border,"--line-active":e.borderActive,"--line-subtle":e.borderSubtle,"--ink":e.text,"--muted":r.muted,"--subtle":r.subtle,"--accent":e.primary,"--error":e.error,"--success":e.success,"--warning":e.warning,"--info":e.info,"--merged":e.syntaxType,"--focus":e[t.focusAccent]??e.primary,"--diff-added":(n?e.diffAddedColorblind:e.diffAdded)??e.diffAdded,"--diff-removed":e.diffRemoved,"--diff-added-bg":(n?e.diffAddedBgColorblind:e.diffAddedBg)??e.diffAddedBg,"--diff-removed-bg":e.diffRemovedBg}}function bb(e){return{background:e.background,foreground:e.text,cursor:e.primary,cursorAccent:e.background,selectionBackground:e.backgroundMenu,black:e.background,red:e.error,green:e.success,yellow:e.warning,blue:e.info,magenta:e.syntaxType,cyan:e.secondary,white:e.textMuted,brightBlack:e.diffLineNumber,brightRed:e.error,brightGreen:e.success,brightYellow:e.warning,brightBlue:e.info,brightMagenta:e.syntaxType,brightCyan:e.secondary,brightWhite:e.text}}var xb=g(null),Sb=g(null),Cb=g(null);function wb({theme:e,mode:t}){let n=e[t],r=(e,t)=>({background:e,width:t});return(0,L.jsxs)(`span`,{className:Vv,style:{background:n.background,borderColor:n.border},"aria-hidden":!0,children:[(0,L.jsxs)(`span`,{className:Hv,style:{background:n.backgroundPanel},children:[(0,L.jsx)(`span`,{className:Wv,style:r(n.primary,`70%`)}),(0,L.jsx)(`span`,{className:Wv,style:r(n.textMuted,`85%`)}),(0,L.jsx)(`span`,{className:Wv,style:r(n.textMuted,`55%`)})]}),(0,L.jsxs)(`span`,{className:Uv,children:[(0,L.jsx)(`span`,{className:Wv,style:r(n.text,`90%`)}),(0,L.jsx)(`span`,{className:Wv,style:r(n.textMuted,`65%`)}),(0,L.jsx)(`span`,{className:Wv,style:r(n.accent??n.primary,`40%`)}),(0,L.jsx)(`span`,{className:Gv,children:[n.success,n.warning,n.error,n.info].map((e,t)=>(0,L.jsx)(`span`,{className:Kv,style:{background:e}},t))})]})]})}function Tb(e){return(0,L.jsxs)(R,{variant:`card`,"aria-pressed":e.active,className:Bv(e.active),onMouseEnter:()=>Sb.set(e.theme),onFocus:()=>Sb.set(e.theme),onClick:e.onClick,children:[(0,L.jsx)(wb,{theme:e.theme,mode:e.mode}),(0,L.jsxs)(`span`,{className:qv,children:[(0,L.jsx)(`span`,{className:`truncate text-ink`,children:e.theme.name}),e.tag&&(0,L.jsx)(`span`,{className:`text-subtle`,children:e.tag})]})]})}function Eb({children:e}){return(0,L.jsx)(`div`,{className:Rv,onMouseLeave:()=>Sb.set(null),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||Sb.set(null)},children:e})}function Db(e){let{model:t}=e,{client:n}=t,r=_(Cb),[i,a]=(0,h.useState)(null),[o,s]=(0,h.useState)(null),[c,l]=(0,h.useState)(!1),[u,d]=(0,h.useState)(!1);(0,h.useEffect)(()=>()=>Sb.set(null),[]),(0,h.useEffect)(()=>void y_(n).catch(()=>void 0),[n]),(0,h.useEffect)(()=>{Cb.get()===null&&n.request(`theme.hosted`).then(e=>Cb.set(e),()=>Cb.set({themes:[],dir:null}))},[n]);let f=e=>{l(!1),Pg(t,F(`prefs.themeAgentPrompt`,{dir:e})).catch(()=>l(!0))},p=r?.dir??null,m=async e=>{a(e),s(null);try{await n.request(`theme.install`,{name:e}),await y_(n),await b_(n,`theme`,e)}catch{s(e)}finally{a(null)}},g=new Set(e.themes.map(e=>e.name)),v=(r?.themes??[]).filter(e=>!g.has(e.name));return(0,L.jsxs)(Qv,{label:e.label,hint:F(`prefs.themePreviewHint`),stack:!0,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`p`,{className:zv,children:F(`prefs.themeInstalled`)}),(0,L.jsx)(Eb,{children:e.themes.map(t=>(0,L.jsx)(Tb,{theme:t,mode:e.mode,active:t.name===e.value,tag:t.bundled?void 0:F(`prefs.themeUser`),onClick:()=>t.name!==e.value&&void b_(n,`theme`,t.name)},t.name))})]}),v.length>0&&(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(R,{className:`inline-flex items-center gap-1.5`,"aria-expanded":u,onClick:()=>d(!u),children:[(0,L.jsx)(fo,{right:!u}),u?F(`prefs.themeHide`):F(`prefs.themeBrowse`,{count:v.length})]}),u&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`p`,{className:`m-0 pb-1.5 text-meta font-medium text-subtle mt-2.5`,children:F(`prefs.themeMoreHint`)}),(0,L.jsx)(Eb,{children:v.map(t=>(0,L.jsx)(Tb,{theme:t,mode:e.mode,active:!1,tag:i===t.name?F(`prefs.themeInstalling`):o===t.name?F(`prefs.themeInstallFailed`):F(`prefs.themeGet`),onClick:()=>i===null&&void m(t.name)},t.name))})]})]}),p&&(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2.5`,children:[(0,L.jsx)(R,{variant:`action`,onClick:()=>f(p),children:F(`prefs.themeAgent`)}),(0,L.jsx)(`span`,{className:`text-meta text-muted [&_a]:text-accent`,children:F(c?`prefs.themeAgentFailed`:`prefs.themeAgentHint`)})]})]})}var Ob=[`engine`,`dots`],kb=`rove.statusMark`,Ab=g(Ob.find(e=>e===localStorage.getItem(kb))??`engine`);function jb(e){Ab.set(e),localStorage.setItem(kb,e)}var Mb=g({}),Nb=``,Pb=`(prefers-color-scheme: dark)`;function Fb(e){let t=window.matchMedia(Pb);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}function Ib(){return(0,h.useSyncExternalStore)(Fb,()=>window.matchMedia(Pb).matches)}function Lb(){let e=Ib();return ub(x_().prefs.themeMode,e)}function Rb(e){let t=Lb(),n=x_();(0,h.useEffect)(()=>{if(!n.loaded||n.prefs.taskColors!==`on`)return;let r=`${n.prefs.theme}/${t}`;r!==Nb&&(Nb=r,Mb.set({}));let i=()=>{let i=Mb.get(),a=e.tasks.get(),o=[...a?.tasks??[],...a?.archived??[]].map(e=>e.id).filter(e=>!(e in i));o.length!==0&&e.client.request(`theme.taskColors`,{theme:n.prefs.theme,mode:t,taskIds:o}).then(e=>{Nb===r&&Mb.set({...Mb.get(),...e.colors})}).catch(()=>void 0)};return i(),e.tasks.subscribe(i)},[e,t,n.loaded,n.prefs.taskColors,n.prefs.theme])}function zb(e){let t=x_(),n=_(Mb);return e&&t.prefs.taskColors===`on`?n[e]:void 0}var Bb={themeMode:{dark:`appearance.modeDark`,light:`appearance.modeLight`,auto:`appearance.modeAuto`},focusAccent:{primary:`general.accentPrimary`,success:`general.accentSuccess`,info:`general.accentInfo`},splitStyle:{box:`general.splitBox`,line:`general.splitLine`,rail:`general.splitRail`,rule:`general.splitRule`},railFold:{glyphs:`general.railFoldGlyphs`,initials:`general.railFoldInitials`,hairline:`general.railFoldHairline`},workingBorder:{flow:`appearance.borderFlow`,still:`appearance.borderStill`},glyphSet:{braille:`appearance.glyphsBraille`,starburst:`appearance.glyphsStarburst`,ascii:`appearance.glyphsAscii`},runningTitle:{shimmer:`appearance.titleShimmer`,still:`appearance.titleStill`}};function Vb({model:e}){let{client:t}=e,n=x_(),r=Lb(),i=_(cf),a=_(Ab),o=(e,n)=>void b_(t,e,n),s=(e,t,r)=>(0,L.jsx)(ty,{label:Q(t),hint:r,value:n.prefs[e],picks:S_(n,e).map(t=>({value:t,label:e===`themeMode`&&t===`auto`?F(`prefs.modeAuto`):Q(Bb[e]?.[String(t)]??String(t))})),onPick:t=>o(e,t)}),c=(e,t,r)=>(0,L.jsx)($v,{label:Q(t),hint:r,checked:e===`transparent`?n.prefs.transparent:n.prefs[e]===`on`,onChange:t=>o(e,e===`transparent`?t:t?`on`:`off`)});return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(Zv,{children:[(0,L.jsx)(Db,{model:e,label:Q(`general.theme`),themes:n.themes,value:n.prefs.theme,mode:r}),s(`themeMode`,`general.themeMode`)]}),(0,L.jsxs)(Zv,{title:F(`settings.appearance.groupColours`),children:[s(`focusAccent`,`general.focusAccent`,Q(`general.focusAccentHint`)),c(`taskColors`,`general.taskColors`,F(`settings.appearance.taskColorsNote`)),c(`colorblind`,`general.colorblind`,F(`settings.appearance.colorblindNote`))]}),(0,L.jsxs)(Zv,{title:F(`settings.appearance.groupTasks`),children:[s(`workingBorder`,`general.workingBorder`,F(`settings.appearance.workingBorderNote`)),s(`runningTitle`,`general.runningTitle`),s(`glyphSet`,`general.glyphSet`),s(`railFold`,`general.railFold`,Q(`general.railFoldHint`)),(0,L.jsx)(ty,{label:F(`settings.appearance.railGroup`),value:i,picks:of.map(e=>({value:e,label:F(e===`state`?`settings.appearance.railGroupState`:`settings.appearance.railGroupProject`)})),onPick:lf}),(0,L.jsx)(ty,{label:F(`settings.appearance.statusMark`),hint:F(`settings.appearance.statusMarkNote`),value:a,picks:Ob.map(e=>({value:e,label:F(e===`engine`?`settings.appearance.statusMarkEngine`:`settings.appearance.statusMarkDots`)})),onPick:jb})]}),(0,L.jsxs)(Zv,{title:F(`settings.appearance.groupTerminal`),hint:F(`prefs.terminalOnly`),children:[c(`transparent`,`general.transparent`),s(`splitStyle`,`general.splitStyle`)]})]})}function Hb(e,t,n){if(t===`offline`)return`offline`;if(t===`unsupported`||t===`mismatch`)return`outdated`;if(!e)return`loading`;let r=e.status;return r?r.gh?r.account?r.account===n?`same`:`different`:`signedOut`:`noGh`:e.reason===`failed`||!e.reason?`failed`:e.reason}var Ub=2e3,Wb=e=>e?.login?.state===`pending`||e?.login?.state===`syncing`;function Gb(e){let{client:t}=e,n=Kf(e),[r,i]=(0,h.useState)({}),a=n.flatMap(e=>e.state===`online`?[e.alias]:[]).join(`
31
+ {hint}`},...E_}},M_={en:Jr,zh:Yr};function Q(e,t){return Ie(j_,e,t)}function N_(e,t){return Ie(M_,e,t)}function P_({label:e,value:t,picks:n,onPick:r}){return(0,L.jsx)(`fieldset`,{"aria-label":e,className:`m-0 inline-flex min-w-0 flex-wrap gap-0.5 rounded-sm border-hairline border-line bg-inset p-0.5`,children:n.map(e=>{let n=e.value===t;return(0,L.jsx)(`button`,{type:`button`,"aria-pressed":n,className:Re(`rounded-xs px-2.5 py-1 font-sans text-meta whitespace-nowrap touch:min-h-9`,`focus-visible:outline-1 focus-visible:outline-offset-1 focus-visible:outline-focus`,n?`bg-menu text-ink`:`text-muted hover:bg-hover`),onClick:()=>!n&&r(e.value),children:e.label},e.value)})})}function F_({label:e,value:t,picks:n,onPick:r}){return(0,L.jsxs)(`span`,{className:`relative inline-flex max-w-full min-w-0 text-ink`,children:[(0,L.jsx)(`select`,{"aria-label":e,value:t,className:`max-w-full min-w-0 truncate rounded-sm border-hairline border-line bg-paper py-1.25 pr-7 pl-2.5 font-sans text-meta hover:border-line-active focus-visible:border-line-active focus-visible:outline-none touch:min-h-10`,onChange:e=>{let t=n.find(t=>String(t.value)===e.target.value);t&&r(t.value)},children:n.map(e=>(0,L.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,L.jsx)(fo,{className:`pointer-events-none absolute top-1/2 right-2.5 -translate-y-1/2 text-subtle`})]})}var I_=`${Wn} w-narrow:pt-0`,L_=`dialog relative m-0 flex h-[min(640px,80vh)] w-[min(880px,calc(100vw-32px))] overflow-hidden rounded-md border-hairline border-line bg-surface text-inherit shadow-dialog focus:outline-none motion-safe:animate-rise-in [.is-leaving_&]:animate-sink-out w-narrow:h-dvh w-narrow:w-screen w-narrow:flex-col w-narrow:rounded-none w-narrow:border-0 w-narrow:pt-[env(safe-area-inset-top)] w-narrow:pb-[env(safe-area-inset-bottom)] short:h-[calc(100dvh-24px)]`,R_=`absolute top-3 right-3 z-1 grid size-7 place-items-center rounded-sm text-display leading-none text-muted hover:bg-inset hover:text-ink focus-visible:bg-inset focus-visible:text-ink touch:size-10`,z_=`flex w-56 flex-none flex-col gap-5 overflow-y-auto scrollbar-none [border-right:var(--hairline)_solid_var(--line)] px-2.5 py-4 w-narrow:w-full w-narrow:flex-1 w-narrow:[border-right:none] w-narrow:px-3 w-narrow:py-3`,B_=`m-0 px-2 pb-0.5 font-sans text-title font-semibold normal-nums text-ink`,V_=`flex flex-col gap-0.5`,H_=`m-0 px-2 pb-1 font-mono text-meta font-normal text-subtle`,U_=(e,t)=>`flex items-center rounded-sm px-2 py-1.25 text-left font-sans text-body touch:min-h-10 w-narrow:min-h-11 w-narrow:px-3 ${e?`bg-menu text-ink`:`${t?`text-muted`:`text-ink`} [&:hover]:bg-hover`}`,W_=`ml-auto hidden text-subtle w-narrow:block`,G_=`flex flex-col`,K_=`sticky top-0 z-1 bg-surface py-2`,q_=`grid grid-cols-3 gap-x-4 rounded-md border-hairline border-line bg-paper px-2 py-1.5 w-narrow:grid-cols-2`,J_=`flex min-h-6.5 min-w-0 items-center gap-2 px-1`,Y_=`m-0 pb-2 text-meta text-subtle`,X_=`flex flex-col border-t-hairline border-t-line [&>*]:border-b-hairline [&>*]:border-b-line`,Z_=`flex items-center justify-between gap-x-6 gap-y-2 py-3 w-narrow:flex-col w-narrow:items-stretch`,Q_=`flex items-center justify-between gap-x-6 py-3`,$_=`flex flex-col gap-3 py-3`,ev=`flex min-w-0 flex-1 flex-col gap-0.5`,tv=`text-body text-ink`,nv=`text-meta text-muted [&_a]:text-accent`,rv=`max-w-90 min-w-0 truncate font-mono text-meta text-muted [overflow-wrap:anywhere]`,iv=`m-0 py-3 text-body text-muted`,av=`rounded-sm border-hairline border-line bg-paper px-2.5 py-1.5 font-sans text-body text-ink focus-visible:border-line-active focus-visible:outline-none`,ov=`${av} w-24 text-right`,sv=`flex flex-col gap-1.5`,cv=`text-meta font-medium text-muted`,lv=`min-h-30 max-h-[50vh] leading-[1.45]`,uv=`flex flex-wrap items-center justify-end gap-2.5`,dv=`flex items-center gap-2.5 rounded-sm bg-inset px-3 py-2 text-meta`,fv=`grid grid-cols-[minmax(0,1fr)_104px_72px] items-center gap-3`,pv=`flex flex-col`,mv=`${fv} pb-1.5 pl-7.5 font-sans text-meta font-medium normal-nums text-subtle [&>span:not(:first-child)]:text-center`,hv=`border-b-hairline border-b-line first:border-t-hairline first:border-t-line`,gv=`${fv} group/eng rounded-sm py-1.5 pr-1 pl-0`,_v=`flex min-w-0 items-center gap-2 rounded-sm py-1.5 pr-0 pl-1.5 text-left focus-visible:outline-1 focus-visible:outline-offset-1 focus-visible:outline-focus`,vv=e=>`mx-0.5 ${e?`text-muted`:`text-subtle`}`,yv=`flex min-w-0 flex-col gap-0.5`,bv=e=>`truncate text-body leading-[inherit] font-medium ${e?`text-muted`:`text-ink`}`,xv=`ml-2 text-meta leading-[inherit] font-normal text-subtle`,Sv={ready:`bg-success`,attention:`bg-warning`,error:`bg-error`,absent:`bg-subtle`},Cv=e=>`inline-flex items-center gap-1.5 text-meta leading-[inherit] ${e===`error`?`text-error`:`text-muted`}`,wv=e=>`size-1.75 flex-none rounded-full ${Sv[e]}`,Tv=`flex justify-center`,Ev=`rounded-full bg-accent-soft px-2.5 py-0.5 font-sans text-meta font-medium normal-nums capitalize text-accent`,Dv=`rounded-full border-hairline border-line px-2.5 py-0.5 text-meta leading-[inherit] whitespace-nowrap text-muted opacity-0 transition-opacity duration-120 ease-[ease] group-hover/eng:opacity-100 group-focus-within/eng:opacity-100 hover:border-line-active hover:text-ink motion-reduce:transition-none touch:opacity-100`,Ov=`mt-0 mr-1 mb-3 ml-7 flex flex-col gap-2.5 px-1.5 py-1`,kv=`m-0 grid grid-cols-[max-content_minmax(0,1fr)] gap-x-3.5 gap-y-1.5 text-meta leading-[1.5]`,Av=`text-subtle`,jv=e=>`m-0 wrap-anywhere ${e?`text-warning`:`text-ink`}`,Mv=`flex items-center gap-2`,Nv=`flex-1 px-2 py-1.25`,Pv=`text-meta leading-[inherit] text-success`,Fv=`flex items-center gap-3 py-2.5`,Iv=`flex min-w-0 flex-1 flex-col gap-0.5`,Lv=(e=!1)=>`overflow-hidden text-ellipsis text-meta text-muted ${e?`whitespace-normal`:`whitespace-nowrap`}`,Rv=`flex flex-col gap-1 py-3`,zv=`flex items-baseline gap-3`,Bv=`flex flex-col gap-2.5 pt-2`,Vv=`grid grid-cols-[repeat(auto-fill,minmax(96px,1fr))] gap-2`,Hv=`m-0 pb-1.5 text-meta font-medium text-subtle`,Uv=e=>e?`border-accent bg-accent-soft`:`border-line hover:bg-hover`,Wv=`flex h-9 overflow-hidden rounded-xs border-hairline`,Gv=`flex w-2/5 flex-col gap-0.75 p-1`,Kv=`flex min-w-0 flex-1 flex-col gap-0.75 p-1`,qv=`h-0.75 rounded-xs`,Jv=`mt-auto flex gap-0.75`,Yv=`size-1 rounded-xs`,Xv=`flex min-w-0 items-baseline gap-1.5 font-sans text-meta`,Zv=`group relative h-4.5 w-7.5 flex-none justify-self-center rounded-full border-hairline border-line bg-inset transition-[background,border-color] duration-120 ease-[ease] aria-checked:border-accent aria-checked:bg-accent motion-reduce:transition-none`,Qv=`absolute top-0.5 left-0.5 size-3 rounded-full bg-muted transition-[transform,background] duration-120 ease-[ease] group-aria-checked:[transform:translateX(12px)] group-aria-checked:bg-paper motion-reduce:transition-none`;function $v({on:e,...t}){return(0,L.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,className:Zv,...t,children:(0,L.jsx)(`span`,{className:Qv})})}function ey(e){return(0,L.jsxs)(`section`,{className:G_,children:[e.title&&(0,L.jsx)(`h2`,{className:`m-0 pb-1.5 font-sans text-meta font-medium normal-nums text-muted`,children:e.title}),e.hint&&(0,L.jsx)(`p`,{className:`m-0 pb-2 text-meta text-subtle`,children:e.hint}),e.lead,(0,L.jsx)(`div`,{className:X_,children:e.children})]})}function ty(e){let t=(0,L.jsxs)(`div`,{className:ev,children:[(0,L.jsx)(`span`,{id:e.labelId,className:tv,children:e.label}),e.hint&&(0,L.jsx)(`span`,{className:`text-meta text-muted [&_a]:text-accent`,children:e.hint})]});return e.stack?(0,L.jsxs)(`div`,{className:$_,children:[t,e.children]}):(0,L.jsxs)(`div`,{className:e.inline?Q_:Z_,children:[t,e.children&&(0,L.jsx)(`div`,{className:`flex min-w-0 flex-none items-center justify-end gap-2 w-narrow:justify-start`,children:e.children})]})}function ny(e){let t=(0,h.useId)();return(0,L.jsx)(ty,{label:e.label,hint:e.hint,labelId:t,inline:!0,children:(0,L.jsx)($v,{on:e.checked,"aria-labelledby":t,disabled:e.disabled,onClick:()=>e.onChange(!e.checked)})})}var ry=36;function iy(e){let t=e.picks.length<=4&&e.picks.reduce((e,t)=>e+t.label.length,0)<=ry?P_:F_;return(0,L.jsx)(ty,{label:e.label,hint:e.hint,children:(0,L.jsx)(t,{label:e.label,value:e.value,picks:e.picks,onPick:e.onPick})})}function ay(e){return(0,L.jsx)(ty,{label:e.label,hint:e.note,children:(0,L.jsx)(`span`,{className:rv,children:e.value})})}var oy=`flex items-baseline justify-between`,sy=`[&_b]:mr-2.5`,cy=`my-2.5 flex flex-col`,ly=e=>`flex gap-3 rounded-sm px-2 py-1 text-left text-[length:var(--fs-body)] ${e?`bg-menu`:``}`,uy=`min-w-[14ch]`,dy=`whitespace-nowrap text-[length:var(--fs-meta)] text-warning`,fy=`rail-tight:hidden`,py=`[&_h2]:mx-0 [&_h2]:mt-3.5 [&_h2]:mb-1 [&_h2]:text-[length:var(--fs-body)]`,my=`max-h-[55vh] overflow-x-hidden overflow-y-auto`,hy=`mr-auto text-[length:var(--fs-meta)]`,gy=`text-[length:var(--fs-body)] leading-[1.55] wrap-anywhere [&_h3]:mx-0 [&_h3]:mt-3 [&_h3]:mb-1.5 [&_h3]:font-sans [&_h3]:text-meta [&_h3]:font-medium [&_h3]:normal-nums [&_h3]:text-muted [&_h3:first-child]:mt-0 [&_ul]:m-0 [&_ul]:pl-4.5 [&_li+li]:mt-2 [&_p]:mx-0 [&_p]:mt-0 [&_p]:mb-2 [&_a]:text-accent [&_a]:underline [&_a]:underline-offset-2 [&_code]:rounded-sm [&_code]:bg-inset [&_code]:px-1 [&_code]:py-0 [&_code]:font-mono [&_code]:text-meta [&_code]:font-normal [&_code]:normal-nums`,_y=`mt-3`,vy=e=>`rounded-sm px-2 py-1.25 ${e?`bg-menu`:``}`,yy=`flex items-baseline gap-2 text-[length:var(--fs-body)]`,by=`flex items-baseline justify-between gap-2`,xy=`font-mono`,Sy=`truncate`,Cy=`mt-4 text-[length:var(--fs-meta)]`;function wy(e){return e.replace(/\[`[0-9a-f]{7,40}`\]\([^)]*\)\s*/g,``).replace(/\s+[—-]\s+\[@[^\]]+\]\([^)]*\)\s*$/,``).trim()}function Ty(e){let t=[],n=(e,n)=>t.push({kind:e,text:n,id:t.length});for(let r of e.split(/\r?\n/)){let e=r.trimEnd();if(e.trim()===``)continue;let i=/^#{1,6}\s+(.*)$/.exec(e);if(i){n(`heading`,i[1]??``);continue}let a=/^\s*[-*]\s+(.*)$/.exec(e);if(a){n(`item`,a[1]??``);continue}let o=t.at(-1);o&&o.kind!==`heading`?o.text=`${o.text} ${e.trim()}`:n(`para`,e.trim())}return t.map(e=>e.kind===`item`?{...e,text:wy(e.text)}:e)}var Ey=/\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)|`([^`]+)`|\*\*([^*]+)\*\*/g;function Dy(e){let t=[],n=0;for(let r of e.matchAll(Ey)){let i=r.index??0;i>n&&t.push(e.slice(n,i));let[a,o,s,c,l]=r;o!==void 0&&s!==void 0?t.push((0,L.jsx)(`a`,{href:s,target:`_blank`,rel:`noopener noreferrer`,children:Dy(o)},i)):c===void 0?l!==void 0&&t.push((0,L.jsx)(`b`,{children:l},i)):t.push((0,L.jsx)(`code`,{children:c},i)),n=i+a.length}return n<e.length&&t.push(e.slice(n)),t}function Oy({body:e}){let t=Ty(e),n=[],r=[],i=()=>{r.length>0&&n.push((0,L.jsx)(`ul`,{children:r},`ul-${n.length}`)),r=[]};for(let e of t){if(e.kind===`item`){r.push((0,L.jsx)(`li`,{children:Dy(e.text)},e.id));continue}i(),n.push(e.kind===`heading`?(0,L.jsx)(`h3`,{children:e.text},e.id):(0,L.jsx)(`p`,{children:Dy(e.text)},e.id))}return i(),(0,L.jsx)(`div`,{className:gy,children:n})}var ky=`page min-h-0 flex-1 rounded-md border-hairline border-line bg-paper px-4.5 py-3.5 focus:outline-none`,Ay=`${ky} overflow-y-auto`,jy=`page-title mx-0 mt-0 mb-1.5 font-sans text-title font-bold normal-nums`,My=`flex items-baseline justify-between gap-4 [&_.page-title]:m-0`,Ny=e=>`min-w-0 truncate text-meta ${e?``:`leading-[inherit]`}`,Py=`flex flex-wrap items-center gap-2`,Fy={row:`touch:after:-inset-x-0.75 touch:after:-inset-y-0.5`,kanban:`touch:after:-inset-x-0.75 touch:after:-top-1.5 touch:after:-bottom-1`,header:`touch:after:-inset-x-0.75 touch:after:-top-2.5 touch:after:-bottom-1.25`},Iy=`mt-2.5 flex flex-col gap-1.5`,Ly=e=>`flex cursor-pointer flex-col gap-0.5 rounded-sm px-2.5 py-1.5 ${e?`bg-menu`:``}`,Ry=`flex min-w-0 items-baseline gap-2.5`,zy=`whitespace-nowrap text-muted`,By=`flex gap-2.5 pl-[4ch] text-meta leading-[inherit] text-muted`,Vy=`min-w-0 flex-1 truncate`,Hy=`flex flex-col px-1.5 pb-2`,Uy=`flex flex-col border-t-hairline border-t-line px-1.5 pt-0.5 pb-0.5`,Wy=`relative flex flex-col`,Gy=e=>`flex items-center rounded-sm px-2 py-0.75 text-left touch:min-h-10 ${e?`bg-menu text-ink`:`text-muted [&:hover]:bg-hover`}`,Ky=`ml-auto -mr-[4.5px] w-5 text-center font-sans text-display leading-none font-normal text-accent normal-nums`,qy=`mr-[7px] size-3.5 flex-none fill-none stroke-current stroke-[1.75] [stroke-linecap:round] [stroke-linejoin:round]`,Jy=g(null),Yy=g(!1),Xy=(e,t)=>e.replace(/\{(\w+)\}/g,(e,n)=>t[n]??e),Zy=e=>`https://github.com/Sma1lboy/rove/releases/tag/v${e}`;function Qy(){return I()===`zh`?$r:Qr}function $y(e,t){return e.request(`update.check`,{force:!0,locale:Me.get(),channel:t}).then(e=>(Jy.set(e),!0),()=>!1)}function eb(){let e=Qy(),t=_(Jy),{prefs:n}=x_();return!n.updateNotify||!t?.info?.hasUpdate?null:(0,L.jsxs)(`button`,{type:`button`,className:`${z} text-muted ${dy} ${Ze}`,title:Xy(e.chip,{version:t.info.latest}),onClick:()=>Ja(`update`),children:[`↑`,(0,L.jsxs)(`span`,{className:fy,children:[` `,t.info.latest]})]})}var tb=1e3;function nb(e){let[t,n]=(0,h.useState)(null),[r,i]=(0,h.useState)(!0);return(0,h.useEffect)(()=>{if(!r)return;let t=!0,a,o=()=>e.request(`update.status`,{}).then(e=>{t&&(n(e.status),e.status?.running?a=setTimeout(o,tb):i(!1))},()=>t&&i(!1));return o(),()=>{t=!1,clearTimeout(a)}},[e,r]),{run:t,setRun:n,poll:()=>i(!0)}}function rb({client:e}){let t=Qy(),n=_(Jy),[r,i]=(0,h.useState)(!1),[a,o]=(0,h.useState)(`release`),[s,c]=(0,h.useState)(null),{run:l,setRun:u,poll:d}=nb(e),f=(0,h.useRef)(null);(0,h.useEffect)(()=>{f.current?.focus(),$y(e).finally(()=>i(!0))},[e]);let p=n?.info??null,m=n?.current??``,g=p?.latest??m,v=p?.hasUpdate===!0,y=r&&p===null,b=r&&p!==null&&!v,x=n?.notes??[],S=x[0]?.url??(g?Zy(g):null),C=[...v&&!l?.running?[{id:`update`,key:`U`,label:t.actions.updateNow,detail:`rove update`}]:[],{id:`release`,key:`R`,label:t.actions.openRelease,detail:S??t.releaseUrlUnavailable},{id:`close`,key:`Q`,label:t.actions.close,detail:t.actions.closeDetail}],w=n=>{if(n===`close`)return V.set(null);if(n===`update`){if(!v||l?.running)return;c(null),e.request(`update.run`,{}).then(e=>{u(e.status),d()},e=>{if(e instanceof pd&&e.code===`BUSY`)return d();c(Xy(t.webStartFailed,{error:e instanceof Error?e.message:String(e)}))});return}c(S&&window.open(S,`_blank`,`noopener`)!==null?t.statusReleaseOpened:t.statusReleaseError)};return(0,h.useEffect)(()=>{!r||!Yy.get()||(Yy.set(!1),v&&w(`update`))},[r,v]),(0,L.jsxs)(`div`,{className:Ay,tabIndex:0,ref:f,onKeyDown:e=>{if(e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`c`&&!window.getSelection()?.toString())return e.preventDefault(),w(`close`);if(e.metaKey||e.ctrlKey||e.altKey)return;let t=C.findIndex(e=>e.id===a);if(e.key===`j`||e.key===`ArrowDown`)o(C[(t+1)%C.length]?.id??`close`);else if(e.key===`k`||e.key===`ArrowUp`)o(C[(t-1+C.length)%C.length]?.id??`close`);else if(e.key===`Enter`)w(a);else if(e.key===`u`)w(`update`);else if(e.key===`r`)w(`release`);else if(e.key===`q`||e.key===`Escape`)w(`close`);else return;e.preventDefault()},children:[(0,L.jsxs)(`div`,{className:oy,children:[(0,L.jsx)(`h1`,{className:jy,children:t.pageTitle}),(0,L.jsx)(`button`,{type:`button`,className:`${sn} mono`,onClick:()=>w(`close`),children:cl()?F(`dialog.close`):t.closeHint})]}),(0,L.jsxs)(`p`,{className:`mono ${sy}`,children:[(0,L.jsx)(`span`,{className:`text-muted`,children:t.current}),` `,(0,L.jsxs)(`b`,{children:[`v`,m]}),` `,(0,L.jsx)(`span`,{className:`text-muted`,children:t.latest}),` `,y?(0,L.jsx)(`b`,{className:`text-muted`,children:t.latestUnknown}):r?(0,L.jsxs)(`b`,{className:v?`text-warning`:`text-success`,children:[`v`,g]}):(0,L.jsx)(`span`,{className:`text-muted`,children:`…`})]}),y&&(0,L.jsx)(`p`,{className:`text-muted`,children:t.registryRetry}),b&&(0,L.jsx)(`p`,{className:`text-success`,children:t.upToDate}),(0,L.jsx)(`div`,{className:cy,children:C.map(e=>(0,L.jsxs)(`button`,{type:`button`,className:ly(a===e.id),onClick:()=>w(e.id),children:[(0,L.jsxs)(`span`,{className:`mono keys-only text-accent`,children:[`[`,e.key,`]`]}),(0,L.jsx)(`span`,{className:uy,children:e.label}),(0,L.jsx)(`span`,{className:`text-muted`,children:e.detail})]},e.id))}),s&&(0,L.jsx)(`p`,{className:`mono text-accent`,children:s}),l&&(0,L.jsxs)(L.Fragment,{children:[l.output&&(0,L.jsx)(`pre`,{className:`my-2 max-h-[40vh] overflow-auto whitespace-pre-wrap wrap-anywhere rounded-sm bg-inset p-2 font-mono text-[length:var(--fs-meta)]`,children:l.output}),(0,L.jsx)(`p`,{className:`mono ${l.running?`text-muted`:l.code===0?`text-success`:`text-error`}`,children:l.running?Xy(t.webRunning,{command:l.command}):l.code===0?Xy(t.webInstalled,{current:m}):Xy(t.updateFailed,{code:String(l.code)})})]}),v&&(0,L.jsx)(`p`,{className:`mono text-muted`,children:Xy(t.changesSectionHeader,{from:m,to:g})}),!r&&(0,L.jsx)(`p`,{className:`text-muted`,children:t.loadingNotes}),r&&v&&x.length===0&&(0,L.jsx)(`p`,{className:`text-muted`,children:t.notesUnavailable}),x.map(e=>(0,L.jsxs)(`section`,{className:py,children:[(0,L.jsxs)(`h2`,{className:`mono`,children:[`v`,e.version]}),(0,L.jsx)(Oy,{body:e.body})]},e.version))]})}var ib=`rove.whatsNewSeenVersion`,ab=e=>e.split(/[.-]/).slice(0,3).map(Number),ob=(e,t)=>{let[n,r]=[ab(e),ab(t)];for(let e=0;e<3;e++)if((n[e]??0)!==(r[e]??0))return(n[e]??0)>(r[e]??0);return!1};function sb(e,t){let n=localStorage.getItem(ib);localStorage.setItem(ib,t),!(!n||!ob(t,n))&&e.request(`release.notes`,{version:t.replace(/-.*$/,``),locale:Me.get()}).then(e=>B.set((0,L.jsx)(cb,{from:n,to:t,notes:e.notes})),()=>B.set((0,L.jsx)(cb,{from:n,to:t,notes:null})))}function cb(e){let t=Qy(),n=(0,h.useRef)(null);return(0,h.useEffect)(()=>n.current?.focus(),[]),(0,h.useEffect)(()=>{let e=e=>{e.key===`q`&&B.set(null)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,L.jsxs)(Tr,{title:t.whatsNew.title,wide:!0,children:[(0,L.jsx)(`p`,{className:`text-muted`,children:Xy(t.whatsNew.upgraded,{from:e.from,to:e.to})}),(0,L.jsx)(`div`,{className:my,children:e.notes?(0,L.jsx)(Oy,{body:e.notes.body}):(0,L.jsx)(`p`,{className:`text-muted`,children:t.whatsNew.notesUnavailable})}),(0,L.jsxs)(`div`,{className:un,children:[(0,L.jsx)(`span`,{className:`mono text-muted ${hy} touch:hidden!`,children:F(`whatsNew.keys`)}),(0,L.jsx)(`a`,{className:sn,href:e.notes?.url??Zy(e.to),target:`_blank`,rel:`noopener noreferrer`,children:F(`whatsNew.openRelease`)}),(0,L.jsx)(`button`,{ref:n,type:`button`,className:Be(),onClick:()=>B.set(null),children:F(`whatsNew.continue`)})]})]})}var lb=(e,t)=>e.replace(`{version}`,t);function ub({client:e}){let t=Qy(),n=_(Jy),{prefs:r}=x_(),[i,a]=(0,h.useState)(`idle`),o=()=>{a(`checking`),$y(e,r.updateChannel).then(e=>a(e?`done`:`failed`))},s=t=>{a(`idle`),b_(e,`updateChannel`,t)},c=n?.info??null,l=i===`failed`||i===`done`&&c===null,u=i===`done`&&n&&c?c.hasUpdate?lb(t.available,c.latest):t.upToDate:l?t.latestUnknown:void 0,d=l?`text-muted`:c?.hasUpdate?`text-warning`:`text-success`;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(iy,{label:Q(`general.updateChannelTitle`),hint:Q(`general.updatesHint`),value:r.updateChannel,picks:f_.map(e=>({value:e,label:Q(`general.updateChannelName.${e}`)})),onPick:s}),(0,L.jsx)(ny,{label:Q(`general.updateNotify`),hint:Q(`general.updateNotifyHint`),checked:r.updateNotify,onChange:t=>void b_(e,`updateNotify`,t)}),(0,L.jsxs)(ty,{label:Q(`general.updates`),hint:Q(`general.updateCheckHint`),children:[i===`done`&&c?.hasUpdate&&(0,L.jsx)(R,{variant:`action`,onClick:()=>Ja(`update`),children:Q(`general.updateOpenPage`)}),(0,L.jsx)(R,{variant:`action`,disabled:i===`checking`,onClick:o,children:Q(i===`checking`?`general.updateChecking`:`general.updateCheckButton`)})]}),u&&(0,L.jsx)(ty,{label:(0,L.jsx)(`span`,{className:d,children:u}),hint:c?.hasUpdate?(0,L.jsx)(`code`,{className:`font-mono`,children:`rove update`}):void 0,children:i===`done`&&n&&c&&(0,L.jsx)(`span`,{className:`max-w-90 min-w-0 truncate font-mono text-meta text-muted [overflow-wrap:anywhere]`,title:`${t.latest} v${c.latest}`,children:`${t.current} v${n.current} · ${t.latest} v${c.latest}`})})]})}function db({client:e}){let[t,n]=(0,h.useState)(null),[r,i]=(0,h.useState)(!1),[o,s]=(0,h.useState)(``),[c,l]=(0,h.useState)(null),u=()=>e.request(`auth.status`).then(n,()=>n(null));if((0,h.useEffect)(()=>void u(),[e]),!t)return null;let d=async(t,n)=>{l(null);try{let r=n===void 0?{mode:t}:{mode:t,password:n},{token:o}=await e.request(`auth.setMode`,r);if(o){a(o),window.location.reload();return}i(!1),s(``),await u()}catch(e){l(e instanceof Error?e.message:String(e))}},f=r?`password`:t.mode,p=o.length<t.minPassword;return(0,L.jsxs)(ey,{title:F(`settings.about.access`),children:[(0,L.jsx)(iy,{label:F(`settings.about.signIn`),hint:F(`settings.about.signInHint.${f}`),value:f,picks:t.modes.map(e=>({value:e,label:F(`settings.about.signInMode.${e}`)})),onPick:e=>{e===`password`&&!t.hasPassword?i(!0):d(e)}}),f===`password`&&(0,L.jsxs)(ty,{label:F(t.hasPassword?`settings.about.passwordChange`:`settings.about.passwordSet`),hint:c??F(`settings.about.passwordHint`,{min:t.minPassword}),children:[(0,L.jsx)(`input`,{className:`rounded-sm border-hairline border-line bg-paper px-2.5 py-1.5 font-sans text-body text-ink focus-visible:border-line-active focus-visible:outline-none w-48`,type:`password`,autoComplete:`new-password`,"aria-label":F(`settings.about.passwordField`),placeholder:F(`settings.about.passwordField`),value:o,onChange:e=>s(e.target.value),onKeyDown:e=>e.key===`Enter`&&!p&&void d(`password`,o)}),(0,L.jsx)(R,{variant:`action`,disabled:p,onClick:()=>void d(`password`,o),children:F(`settings.about.passwordSave`)})]})]})}function fb({client:e}){let[t,n]=(0,h.useState)(()=>J(e,`daemon.info`)??null);return(0,h.useEffect)(()=>{X(e,`daemon.info`).then(n,()=>n(null))},[e]),(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(ey,{title:F(`settings.about.groupRove`),children:[t?.daemonVersion&&(0,L.jsx)(ty,{label:F(`settings.about.daemon`),hint:F(t.stale?`settings.about.daemonStale`:`settings.about.daemonCurrent`,{version:t.daemonVersion})}),(0,L.jsx)(ub,{client:e})]}),(0,L.jsx)(db,{client:e}),(0,L.jsx)(ey,{title:F(`settings.about.browser`),children:(0,L.jsx)(ty,{label:F(`settings.about.signOut`),hint:F(`settings.about.browserHint`),children:(0,L.jsx)(R,{variant:`action`,onClick:()=>void co().then(()=>window.location.reload()),children:F(`settings.about.signOut`)})})})]})}var pb=e=>new Map((e?.engines??[]).flatMap(e=>e.icon?[[e.id,e.icon]]:[]));function mb(e){let[t,n]=(0,h.useState)(()=>pb(J(e,`engines.list`))),r=_(e.tasks)!==null;return(0,h.useEffect)(()=>{r&&X(e,`engines.list`).then(e=>n(pb(e))).catch(()=>{})},[e,r]),t}var hb={working:`info`,waiting:`warning`,error:`attention`,done:`success`,idle:`muted`},gb={prOpen:``,prMerged:``,prClosed:``};function _b(e){let t=vb(e);return{look:t,tone:hb[t]}}function vb(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 yb(e){return e.rowStatus?.kind===`needs-input`||e.rowStatus?.kind===`attention`}var bb={busy:0,attention:1,"needs-input":2,running:3,unseen:4,idle:5};function xb(e){let t;for(let{rowStatus:n}of e)n&&(!t||bb[n.kind]<bb[t.kind]||n.kind===t.kind&&n.since>t.since)&&(t=n);return t}function Sb(e,t,n){if(!e)return null;if(e.lifecycle===`merged`)return{glyph:gb.prMerged,tone:n?`text-muted`:`text-merged`,state:`merged`};if(e.lifecycle===`closed`)return{glyph:gb.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:gb.prOpen,tone:i,state:`open`,...r?{checks:r}:{}}}function Cb(e){return Sb(e.pr,e.prChip,e.prChipStale===!0)}function wb(e){return Sb(e,(e.mergeable??``).toUpperCase()===`CONFLICTING`?`conflict`:e.checkState===`failing`?`failing`:e.checkState===`passing`?`passing`:null,!1)}function Tb(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 Eb=[`engine`,`dots`],Db=`rove.statusMark`,Ob=g(Eb.find(e=>e===localStorage.getItem(Db))??`engine`);function kb(e){Ob.set(e),localStorage.setItem(Db,e)}var Ab=`block size-3.5 flex-none translate-y-px`,jb=`animate-mark-pulse motion-reduce:[animation-duration:4.8s]`;function Mb(e){let t=e.status?.look;if(t===`waiting`||t===`error`)return(0,L.jsx)(`span`,{className:`${Ab} text-center font-mono text-meta leading-3.5 font-semibold ${tf[e.status?.tone??`muted`]}`,"aria-hidden":`true`,children:t===`waiting`?`?`:`!`});let n=e.status&&(t===`idle`?`text-muted`:tf[e.status.tone]);return(0,L.jsx)(`svg`,{className:`${Ab} ${n??(e.icon?`text-ink`:`text-muted`)} ${t===`working`?jb:``}`,viewBox:e.icon?.viewBox??`0 0 14 14`,role:e.name?`img`:void 0,"aria-label":e.name,"aria-hidden":!e.name||void 0,children:e.icon?e.icon.paths.map(e=>(0,L.jsx)(`path`,{d:e.d,fill:n?`currentColor`:e.fill??`currentColor`,fillRule:e.evenodd?`evenodd`:void 0},e.d)):(0,L.jsx)(`circle`,{cx:`7`,cy:`7`,r:`4.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.2`})})}var Nb=1.2,Pb=.3,Fb=20,Ib=.35,Lb=.25,Rb=.12,zb=2,Bb=1,Vb={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}},Hb=Array.from({length:9},(e,t)=>Math.hypot(t%3-1,Math.floor(t/3)-1));function Ub(e){return Ib+.65*(.5+.5*Math.cos(2*Math.PI*e/Nb))}function Wb(e,t,n,r=1){switch(e){case`working`:{let e=t*80/1e3/r;return Hb.map(t=>Ub(e-t*Pb))}case`waiting`:{let e=[0,1,4,5].includes(Math.floor(t/r)%Fb);return Array(9).fill(e?Lb:1)}default:{let t=Vb[e],r=Array(9).fill(Rb);return t?.dots.forEach((e,i)=>{let a=Math.min(Math.max(n-i*Bb,0),zb)/zb;r[e]=t.bright*a+Rb*(1-a)}),r}}}function Gb(e,t){let n=Vb[e];return!n||t<(n.dots.length-1)*Bb+zb}var Kb=3,qb=new Set,Jb;function Yb(e,t){let n=typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches,r=1/0,i=e.held+t-e.step,a=Gb(e.look,n?r:i);return Wb(e.look,t,n?r:i,n?Kb:1).forEach((t,n)=>{let r=e.el.children[n].style;r.opacity=t.toFixed(3)}),a}function Xb(){let e=Math.floor(performance.now()/80);for(let t of qb)Yb(t,e)||qb.delete(t);Zb()}function Zb(){Jb=qb.size?window.setTimeout(Xb,80-performance.now()%80+2):void 0}function Qb(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 Yb(a,r)&&(qb.add(a),Jb===void 0&&Zb()),()=>{qb.delete(a)}}function $b({status:e}){let{look:t,tone:n}=_b(e);return(0,L.jsx)(tx,{look:t,tone:n,since:e?.since??0},t)}var ex=e=>e===`muted`?`text-muted`:e===`ink`?`text-ink`:ef[e];function tx({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?Qb(t,e,i):void 0},[e,i]),(0,L.jsx)(`span`,{ref:r,className:`inline-grid flex-none grid-cols-[repeat(3,3px)] auto-rows-[3px] gap-px self-center ${ex(t)}`,"aria-hidden":`true`,children:Array.from({length:9},(e,t)=>(0,L.jsx)(`i`,{className:`rounded-full bg-current opacity-12`},t))})}var nx=[{label:`settings.appearance.previewWorking`,status:{kind:`running`,since:0}},{label:`settings.appearance.previewDone`,status:{kind:`unseen`,since:0}},{label:`settings.appearance.previewIdle`,status:{kind:`idle`,since:0}},{label:`settings.appearance.previewWaiting`,status:{kind:`needs-input`,since:0}},{label:`settings.appearance.previewBroken`,status:{kind:`attention`,reason:`error`,since:0}}];function rx({model:e}){let t=_(Ob)===`engine`,[n]=[...mb(e).values()];return(0,L.jsx)(`div`,{className:K_,"aria-hidden":`true`,children:(0,L.jsx)(`div`,{className:`${q_} ${Pt}`,children:nx.map(({label:e,status:r})=>(0,L.jsxs)(`div`,{className:J_,children:[(0,L.jsx)(Mb,{icon:n,status:t?_b(r):void 0}),(0,L.jsx)(`span`,{className:`${br} ${r.kind===`running`?xr:``}`,children:F(e)}),!t&&(0,L.jsx)($b,{status:r})]},e))})})}function ix(e,t){return e===`auto`?t?`dark`:`light`:e}function ax(e,t,n){let r=e.find(e=>e.name===t)??e.find(e=>e.name===`claude`);return r?r[n]:null}var ox=e=>[1,3,5].map(t=>Number.parseInt(e.slice(t,t+2),16));function sx(e){let[t=0,n=0,r=0]=ox(e).map(e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return .2126*t+.7152*n+.0722*r}function cx(e,t){let[n=0,r=0]=[sx(e),sx(t)].sort((e,t)=>t-e);return(n+.05)/(r+.05)}var lx=4.5,ux=1.1;function dx(e,t,n){let r=e=>t.every(t=>cx(e,t)>=n(t));if(r(e))return e;let i=ox(e),a=sx(t[0])<.18?255:0;for(let e=.02;e<1;e+=.02){let t=i.map(t=>Math.round(t+(a-t)*e).toString(16).padStart(2,`0`)).join(``);if(r(`#${t}`))return`#${t}`}return a?`#ffffff`:`#000000`}function fx(e){let t=[e.background,e.backgroundPanel,e.backgroundElement,e.backgroundMenu],n=dx(e.diffLineNumber,t,()=>lx);return{muted:dx(e.textMuted,t,e=>Math.max(lx,cx(n,e)*ux)),subtle:n}}function px(e,t){let n=t.colorblind===`on`,r=fx(e);return{"--paper":e.background,"--surface":e.backgroundPanel,"--inset":e.backgroundElement,"--menu":e.backgroundMenu,"--line":e.border,"--line-active":e.borderActive,"--line-subtle":e.borderSubtle,"--ink":e.text,"--muted":r.muted,"--subtle":r.subtle,"--accent":e.primary,"--error":e.error,"--success":e.success,"--warning":e.warning,"--info":e.info,"--merged":e.syntaxType,"--focus":e[t.focusAccent]??e.primary,"--diff-added":(n?e.diffAddedColorblind:e.diffAdded)??e.diffAdded,"--diff-removed":e.diffRemoved,"--diff-added-bg":(n?e.diffAddedBgColorblind:e.diffAddedBg)??e.diffAddedBg,"--diff-removed-bg":e.diffRemovedBg}}function mx(e){return{background:e.background,foreground:e.text,cursor:e.primary,cursorAccent:e.background,selectionBackground:e.backgroundMenu,black:e.background,red:e.error,green:e.success,yellow:e.warning,blue:e.info,magenta:e.syntaxType,cyan:e.secondary,white:e.textMuted,brightBlack:e.diffLineNumber,brightRed:e.error,brightGreen:e.success,brightYellow:e.warning,brightBlue:e.info,brightMagenta:e.syntaxType,brightCyan:e.secondary,brightWhite:e.text}}var hx=g(null),gx=g(null),_x=g(null);function vx({theme:e,mode:t}){let n=e[t],r=(e,t)=>({background:e,width:t});return(0,L.jsxs)(`span`,{className:Wv,style:{background:n.background,borderColor:n.border},"aria-hidden":!0,children:[(0,L.jsxs)(`span`,{className:Gv,style:{background:n.backgroundPanel},children:[(0,L.jsx)(`span`,{className:qv,style:r(n.primary,`70%`)}),(0,L.jsx)(`span`,{className:qv,style:r(n.textMuted,`85%`)}),(0,L.jsx)(`span`,{className:qv,style:r(n.textMuted,`55%`)})]}),(0,L.jsxs)(`span`,{className:Kv,children:[(0,L.jsx)(`span`,{className:qv,style:r(n.text,`90%`)}),(0,L.jsx)(`span`,{className:qv,style:r(n.textMuted,`65%`)}),(0,L.jsx)(`span`,{className:qv,style:r(n.accent??n.primary,`40%`)}),(0,L.jsx)(`span`,{className:Jv,children:[n.success,n.warning,n.error,n.info].map((e,t)=>(0,L.jsx)(`span`,{className:Yv,style:{background:e}},t))})]})]})}function yx(e){return(0,L.jsxs)(R,{variant:`card`,"aria-pressed":e.active,className:Uv(e.active),onMouseEnter:()=>gx.set(e.theme),onFocus:()=>gx.set(e.theme),onClick:e.onClick,children:[(0,L.jsx)(vx,{theme:e.theme,mode:e.mode}),(0,L.jsxs)(`span`,{className:Xv,children:[(0,L.jsx)(`span`,{className:`truncate text-ink`,children:e.theme.name}),e.tag&&(0,L.jsx)(`span`,{className:`text-subtle`,children:e.tag})]})]})}function bx({children:e}){return(0,L.jsx)(`div`,{className:Vv,onMouseLeave:()=>gx.set(null),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||gx.set(null)},children:e})}function xx(e){let{model:t}=e,{client:n}=t,r=_(_x),[i,a]=(0,h.useState)(null),[o,s]=(0,h.useState)(null),[c,l]=(0,h.useState)(!1),[u,d]=(0,h.useState)(!1);(0,h.useEffect)(()=>()=>gx.set(null),[]),(0,h.useEffect)(()=>void y_(n).catch(()=>void 0),[n]),(0,h.useEffect)(()=>{_x.get()===null&&n.request(`theme.hosted`).then(e=>_x.set(e),()=>_x.set({themes:[],dir:null}))},[n]);let f=e=>{l(!1),Pg(t,F(`prefs.themeAgentPrompt`,{dir:e})).catch(()=>l(!0))},p=r?.dir??null,m=async e=>{a(e),s(null);try{await n.request(`theme.install`,{name:e}),await y_(n),await b_(n,`theme`,e)}catch{s(e)}finally{a(null)}},g=new Set(e.themes.map(e=>e.name)),v=(r?.themes??[]).filter(e=>!g.has(e.name));return(0,L.jsxs)(ty,{label:e.label,hint:F(`prefs.themePreviewHint`),stack:!0,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`p`,{className:Hv,children:F(`prefs.themeInstalled`)}),(0,L.jsx)(bx,{children:e.themes.map(t=>(0,L.jsx)(yx,{theme:t,mode:e.mode,active:t.name===e.value,tag:t.bundled?void 0:F(`prefs.themeUser`),onClick:()=>t.name!==e.value&&void b_(n,`theme`,t.name)},t.name))})]}),v.length>0&&(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(R,{className:`inline-flex items-center gap-1.5`,"aria-expanded":u,onClick:()=>d(!u),children:[(0,L.jsx)(fo,{right:!u}),u?F(`prefs.themeHide`):F(`prefs.themeBrowse`,{count:v.length})]}),u&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`p`,{className:`m-0 pb-1.5 text-meta font-medium text-subtle mt-2.5`,children:F(`prefs.themeMoreHint`)}),(0,L.jsx)(bx,{children:v.map(t=>(0,L.jsx)(yx,{theme:t,mode:e.mode,active:!1,tag:i===t.name?F(`prefs.themeInstalling`):o===t.name?F(`prefs.themeInstallFailed`):F(`prefs.themeGet`),onClick:()=>i===null&&void m(t.name)},t.name))})]})]}),p&&(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2.5`,children:[(0,L.jsx)(R,{variant:`action`,onClick:()=>f(p),children:F(`prefs.themeAgent`)}),(0,L.jsx)(`span`,{className:`text-meta text-muted [&_a]:text-accent`,children:F(c?`prefs.themeAgentFailed`:`prefs.themeAgentHint`)})]})]})}var Sx=g({}),Cx=``,wx=`(prefers-color-scheme: dark)`;function Tx(e){let t=window.matchMedia(wx);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}function Ex(){return(0,h.useSyncExternalStore)(Tx,()=>window.matchMedia(wx).matches)}function Dx(){let e=Ex();return ix(x_().prefs.themeMode,e)}function Ox(e){let t=Dx(),n=x_();(0,h.useEffect)(()=>{if(!n.loaded||n.prefs.taskColors!==`on`)return;let r=`${n.prefs.theme}/${t}`;r!==Cx&&(Cx=r,Sx.set({}));let i=()=>{let i=Sx.get(),a=e.tasks.get(),o=[...a?.tasks??[],...a?.archived??[]].map(e=>e.id).filter(e=>!(e in i));o.length!==0&&e.client.request(`theme.taskColors`,{theme:n.prefs.theme,mode:t,taskIds:o}).then(e=>{Cx===r&&Sx.set({...Sx.get(),...e.colors})}).catch(()=>void 0)};return i(),e.tasks.subscribe(i)},[e,t,n.loaded,n.prefs.taskColors,n.prefs.theme])}function kx(e){let t=x_(),n=_(Sx);return e&&t.prefs.taskColors===`on`?n[e]:void 0}var Ax={themeMode:{dark:`appearance.modeDark`,light:`appearance.modeLight`,auto:`appearance.modeAuto`},focusAccent:{primary:`general.accentPrimary`,success:`general.accentSuccess`,info:`general.accentInfo`},splitStyle:{box:`general.splitBox`,line:`general.splitLine`,rail:`general.splitRail`,rule:`general.splitRule`},railFold:{glyphs:`general.railFoldGlyphs`,initials:`general.railFoldInitials`,hairline:`general.railFoldHairline`},workingBorder:{flow:`appearance.borderFlow`,still:`appearance.borderStill`},glyphSet:{braille:`appearance.glyphsBraille`,starburst:`appearance.glyphsStarburst`,ascii:`appearance.glyphsAscii`},runningTitle:{shimmer:`appearance.titleShimmer`,still:`appearance.titleStill`}};function jx({model:e}){let{client:t}=e,n=x_(),r=Dx(),i=_(cf),a=_(Ob),o=(e,n)=>void b_(t,e,n),s=(e,t,r)=>(0,L.jsx)(iy,{label:Q(t),hint:r,value:n.prefs[e],picks:S_(n,e).map(t=>({value:t,label:e===`themeMode`&&t===`auto`?F(`prefs.modeAuto`):Q(Ax[e]?.[String(t)]??String(t))})),onPick:t=>o(e,t)}),c=(e,t,r)=>(0,L.jsx)(ny,{label:Q(t),hint:r,checked:e===`transparent`?n.prefs.transparent:n.prefs[e]===`on`,onChange:t=>o(e,e===`transparent`?t:t?`on`:`off`)});return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(ey,{children:[(0,L.jsx)(xx,{model:e,label:Q(`general.theme`),themes:n.themes,value:n.prefs.theme,mode:r}),s(`themeMode`,`general.themeMode`)]}),(0,L.jsxs)(ey,{title:F(`settings.appearance.groupColours`),children:[s(`focusAccent`,`general.focusAccent`,Q(`general.focusAccentHint`)),c(`taskColors`,`general.taskColors`,F(`settings.appearance.taskColorsNote`)),c(`colorblind`,`general.colorblind`,F(`settings.appearance.colorblindNote`))]}),(0,L.jsxs)(ey,{title:F(`settings.appearance.groupTasks`),lead:(0,L.jsx)(rx,{model:e}),children:[s(`workingBorder`,`general.workingBorder`,F(`settings.appearance.workingBorderNote`)),s(`runningTitle`,`general.runningTitle`),s(`glyphSet`,`general.glyphSet`),s(`railFold`,`general.railFold`,Q(`general.railFoldHint`)),(0,L.jsx)(iy,{label:F(`settings.appearance.railGroup`),value:i,picks:of.map(e=>({value:e,label:F(e===`state`?`settings.appearance.railGroupState`:`settings.appearance.railGroupProject`)})),onPick:lf}),(0,L.jsx)(iy,{label:F(`settings.appearance.statusMark`),hint:F(`settings.appearance.statusMarkNote`),value:a,picks:Eb.map(e=>({value:e,label:F(e===`engine`?`settings.appearance.statusMarkEngine`:`settings.appearance.statusMarkDots`)})),onPick:kb})]}),(0,L.jsxs)(ey,{title:F(`settings.appearance.groupTerminal`),hint:F(`prefs.terminalOnly`),children:[c(`transparent`,`general.transparent`),s(`splitStyle`,`general.splitStyle`)]})]})}function Mx(e,t,n){if(t===`offline`)return`offline`;if(t===`unsupported`||t===`mismatch`)return`outdated`;if(!e)return`loading`;let r=e.status;return r?r.gh?r.account?r.account===n?`same`:`different`:`signedOut`:`noGh`:e.reason===`failed`||!e.reason?`failed`:e.reason}var Nx=2e3,Px=e=>e?.login?.state===`pending`||e?.login?.state===`syncing`;function Fx(e){let{client:t}=e,n=Kf(e),[r,i]=(0,h.useState)({}),a=n.flatMap(e=>e.state===`online`?[e.alias]:[]).join(`
32
32
  `),o=(0,h.useMemo)(()=>a?a.split(`
33
- `):[],[a]),s=(0,h.useRef)(new Set),c=(0,h.useCallback)(async e=>{let n=e===``?{}:{machine:e},r=await t.request(`github.status`,n).catch(e=>({status:null,reason:`failed`,message:U(e)}));i(t=>({...t,[e]:r}))},[t]),l=(0,h.useCallback)(()=>Promise.all([``,...o].map(c)).then(()=>{}),[c,o]);return(0,h.useEffect)(()=>{l()},[l]),(0,h.useEffect)(()=>{let e=new Set(Object.entries(r).flatMap(([e,t])=>Wb(t.status)?[e]:[])),t=[...s.current].some(t=>!e.has(t));if(s.current=e,t&&l(),e.size===0)return;let n=window.setTimeout(()=>{for(let t of e)c(t)},Ub);return()=>window.clearTimeout(n)},[r,c,l]),{machines:n,probes:r,refresh:l,probe:c,act:(0,h.useCallback)(async(e,n)=>{try{let r=await t.request(e,n);return r.ok||H(r.message,`error`),r}catch(e){return H(U(e),`error`),null}},[t])}}var Kb={same:`markSame`,different:`markDifferent`,signedOut:`markSignedOut`,noGh:`markNoGh`,outdated:`markOutdated`,offline:`markOffline`,denied:`markDenied`,failed:`markFailed`},qb=(e,t)=>F(`settings.connectors.${e}`,t),Jb={same:`text-diff-added`,signedOut:`text-diff-removed`,failed:`text-diff-removed`,denied:`text-diff-removed`,different:`text-warning`,outdated:`text-warning`,offline:`text-muted`,noGh:`text-muted`,loading:`text-muted`};function Yb(e,t){return e===`loading`?qb(`loading`):qb(Kb[e],{login:t?.account??``})}function Xb(e){if(!e?.gh)return``;let t=e.ssh.ok?`✓ ${e.ssh.user??``}`.trim():`✗`;return qb(`detail`,{protocol:e.protocol??`—`,ssh:t})}function Zb(){return(0,L.jsx)(`svg`,{className:`flex-none`,viewBox:`0 0 16 16`,width:`22`,height:`22`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{fill:`currentColor`,d:`M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z`})})}function Qb(e){navigator.clipboard.writeText(e).then(()=>H(qb(`codeCopied`)),()=>{})}function $b({login:e,onCancel:t}){return e.state===`failed`?(0,L.jsxs)(`div`,{className:cv,children:[(0,L.jsx)(`span`,{className:`text-muted`,children:qb(`loginFailed`,{error:e.error??``})}),(0,L.jsx)(R,{className:`ml-auto`,onClick:t,children:qb(`dismiss`)})]}):e.state===`syncing`?(0,L.jsx)(`div`,{className:cv,children:(0,L.jsx)(`span`,{className:`text-muted`,children:qb(`syncing`)})}):(0,L.jsxs)(`div`,{className:cv,children:[e.code?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`button`,{type:`button`,className:`font-mono font-normal normal-nums rounded-sm border-hairline border-dashed border-line px-2 py-0.5 text-display tracking-code`,title:qb(`codeHint`),onClick:()=>Qb(e.code??``),children:e.code}),(0,L.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,children:qb(`openGithub`)})]}):(0,L.jsx)(`span`,{className:`text-muted`,children:qb(`loading`)}),(0,L.jsx)(R,{className:`ml-auto`,onClick:t,children:F(`dialog.cancel`)})]})}function ex(e){let t=Hb(e.probe,e.machine,e.rove),n=e.probe?.status??null,r=Wb(n),i=t===`different`||t===`signedOut`,a=n?.login;return(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{className:Mv,children:[(0,L.jsxs)(`div`,{className:Nv,children:[(0,L.jsx)(`span`,{className:Q_,children:e.name}),(0,L.jsx)(`span`,{className:Pv(),title:[n?.authDetail,n?.ssh.detail].filter(Boolean).join(`, `)||void 0,children:Xb(n)})]}),(0,L.jsx)(`span`,{className:`whitespace-nowrap text-meta ${Jb[t]}`,title:e.probe?.message,children:Yb(t,n)}),e.onSync&&i&&e.rove&&!r&&(0,L.jsx)(R,{variant:`action`,disabled:e.busy,onClick:e.onSync,children:qb(`useRove`)}),e.onLogin&&i&&!r&&(0,L.jsx)(R,{variant:`action`,disabled:e.busy,onClick:e.onLogin,children:qb(`loginThere`)})]}),a&&(0,L.jsx)(`div`,{className:`pb-3`,children:(0,L.jsx)($b,{login:a,onCancel:e.onCancel})})]})}function tx({model:e}){let{machines:t,probes:n,refresh:r,probe:i,act:a}=Gb(e),[o,s]=(0,h.useState)(null),[c,l]=(0,h.useState)(!1),u=n[``],d=u?.status?.account??null,f=Wb(u?.status),p=async(e,t)=>{s(e);try{await t()}finally{s(null)}},m=e=>p(e,async()=>{await a(`github.login`,e===``?{}:{machine:e}),await i(e)}),g=e=>p(e,async()=>{await a(`github.login`,e===``?{cancel:!0}:{machine:e,cancel:!0}),await i(e)}),_=e=>p(e,async()=>{(await a(`github.sync`,{machine:e}))?.ok&&H(qb(`synced`,{machine:e,login:d??``})),await i(e)}),v=()=>p(``,async()=>{(await a(`github.logout`,{}))?.ok&&l(!1),await r()});return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Zv,{children:(0,L.jsxs)(`div`,{children:[(0,L.jsx)(Qv,{label:(0,L.jsxs)(`span`,{className:`flex items-center gap-2.5`,children:[(0,L.jsx)(Zb,{}),`GitHub`]}),hint:qb(`githubDescription`),children:d?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`span`,{className:ev,children:[`@`,d]}),(0,L.jsx)(R,{variant:`action`,disabled:o!==null,onClick:()=>l(!0),children:qb(`disconnect`)})]}):!f&&(0,L.jsx)(R,{variant:`filled`,disabled:o!==null||!u,onClick:()=>void m(``),children:qb(`connect`)})}),c&&(0,L.jsx)(`div`,{className:`pb-3`,children:(0,L.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-line bg-inset px-3 py-2.5 [&_p]:m-0 [&_p]:text-meta [&_p]:text-muted`,children:[(0,L.jsx)(`p`,{children:qb(`disconnectBody`)}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2.5`,children:[(0,L.jsx)(R,{onClick:()=>l(!1),children:F(`dialog.cancel`)}),(0,L.jsx)(R,{variant:`danger`,disabled:o!==null,onClick:()=>void v(),children:qb(`disconnect`)})]})]})}),!d&&u?.status?.login&&(0,L.jsx)(`div`,{className:`pb-3`,children:(0,L.jsx)($b,{login:u.status.login,onCancel:()=>void g(``)})})]})}),d&&(0,L.jsxs)(Zv,{title:qb(`machines`),children:[(0,L.jsx)(ex,{name:qb(`thisMachine`),probe:u,machine:null,rove:d,busy:o!==null,onCancel:()=>void g(``)}),t.map(e=>(0,L.jsx)(ex,{name:e.alias,probe:n[e.alias],machine:e.state,rove:d,busy:o!==null,onSync:()=>void _(e.alias),onLogin:()=>void m(e.alias),onCancel:()=>void g(e.alias)},e.alias)),(0,L.jsx)(`div`,{className:`py-2.5`,children:(0,L.jsx)(R,{onClick:()=>void r(),children:qb(`refresh`)})})]})]})}function nx({model:e}){return(0,L.jsx)(tx,{model:e})}var rx=[{key:`remoteProjects`,label:`dev.remote`,hint:`dev.remoteHint`},{key:`autoStatus`,label:`dev.autoStatus`,hint:`dev.autoStatusHint`},{key:`dispatcher`,label:`dev.dispatcher`,hint:`dev.dispatcherHint`}];function ix({client:e}){let{prefs:t}=x_(),[n,r]=(0,h.useState)(null),[i,a]=(0,h.useState)(!1),o=async()=>{if(n){a(!0);try{if(n===`reset`){await e.request(`dev.reset`),localStorage.removeItem(`rove.prefs`),window.location.reload();return}await e.request(`daemon.restart`),H(Q(`restart.done`)),r(null)}catch(e){H(U(e),`error`)}finally{a(!1)}}},s=(e,t,a,s,c)=>(0,L.jsxs)(`div`,{children:[(0,L.jsx)(Qv,{label:t,hint:a,children:(0,L.jsx)(R,{variant:`action`,onClick:()=>r(e),children:s})}),n===e&&(0,L.jsx)(`div`,{className:`pb-3`,children:(0,L.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-line bg-inset px-3 py-2.5 [&_p]:m-0 [&_p]:text-meta [&_p]:text-muted`,children:[(0,L.jsx)(`strong`,{children:Q(`${e}.title`)}),(0,L.jsx)(`p`,{children:F(e===`reset`?`prefs.resetBody`:`prefs.restartBody`)}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2.5`,children:[(0,L.jsx)(R,{onClick:()=>r(null),children:F(`dialog.cancel`)}),(0,L.jsx)(R,{variant:c?`danger`:`filled`,disabled:i,onClick:()=>void o(),children:s})]})]})})]});return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Zv,{title:Q(`dev.experimental`),children:rx.map(n=>(0,L.jsx)($v,{label:Q(n.label),hint:Q(n.hint),checked:t[n.key],onChange:t=>void b_(e,n.key,t)},n.key))}),(0,L.jsxs)(Zv,{hint:Q(`dev.doctorHint`),children:[s(`restart`,Q(`dev.restart`),F(`prefs.restartHint`),F(`prefs.restartButton`),!1),s(`reset`,Q(`dev.reset`),F(`prefs.resetHint`),F(`prefs.resetButton`),!0)]})]})}function ax(e){return e.binaryFound===void 0?{key:`settings.engines.status.checking`,tone:`unknown`}:e.binaryFound===null?{key:`settings.engines.status.unknown`,tone:`unknown`}:e.binaryFound?e.configIssue?{key:`settings.engines.status.integrationBlocked`,tone:`error`}:e.login===`no`?{key:`settings.engines.status.signIn`,tone:`attention`}:e.hooks===`outdated`?{key:`settings.engines.status.integrationOutdated`,tone:`attention`}:e.hooks===`not-installed`?{key:`settings.engines.status.integrationMissing`,tone:`attention`}:{key:`settings.engines.status.ready`,tone:`ready`}:e.commandChosen?{key:`settings.engines.status.notOnPath`,tone:`attention`}:{key:`settings.engines.status.notInstalled`,tone:`absent`}}var ox=g([]),sx=3e4;function cx(e){return e.request(`skill.missing`).then(e=>ox.set(e.engines),()=>{})}function lx(e){(0,h.useEffect)(()=>{let t=e.onOpen(()=>void cx(e)),n=jr(sx,()=>void cx(e));return()=>{t(),n()}},[e])}function ux(e){return e.request(`skill.install`).then(e=>{e.error&&H(Q(`engines.skill.failed`,{reason:e.error}),`error`)}).catch(e=>H(U(e),`error`)).then(()=>cx(e))}function dx(e){return ax({binaryFound:e.binaryFound,login:e.login,hooks:e.hooks,configIssue:e.configIssue,commandChosen:e.custom||e.customized})}var fx={ready:`ready`,attention:`attention`,error:`error`,absent:`absent`,unknown:`absent`};function px({client:e}){let[t,n]=(0,h.useState)(()=>J(e,`engines.settings`)?.engines??null),[r,i]=(0,h.useState)(null),a=(0,h.useCallback)(()=>X(e,`engines.settings`).then(e=>n(e.engines),e=>H(U(e),`error`)),[e]);(0,h.useEffect)(()=>{a()},[a]);let o=(t,n={})=>void e.request(t,n).then(a).catch(e=>H(U(e),`error`));return t?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`section`,{children:[(0,L.jsx)(`p`,{className:K_,children:Q(`engines.hint`)}),(0,L.jsxs)(`div`,{className:uv,children:[(0,L.jsxs)(`div`,{className:dv,"aria-hidden":`true`,children:[(0,L.jsx)(`span`,{}),(0,L.jsx)(`span`,{children:Q(`engines.defaultMark`)}),(0,L.jsx)(`span`,{children:Q(`engines.available`)})]}),t.map(e=>(0,L.jsx)(mx,{engine:e,open:r===e.id,onToggleOpen:()=>i(r===e.id?null:e.id),run:o},e.id))]})]}),(0,L.jsx)(_x,{engines:t,run:o}),(0,L.jsx)(vx,{engines:t,client:e,reload:a})]}):(0,L.jsx)(`p`,{className:tv,children:F(`preview.loading`)})}function mx(e){let{engine:t,run:n}=e,r=(0,h.useId)(),i=dx(t);return(0,L.jsxs)(`div`,{className:fv,children:[(0,L.jsxs)(`div`,{className:pv,children:[(0,L.jsxs)(`button`,{type:`button`,className:mv,"aria-expanded":e.open,"aria-controls":r,onClick:e.onToggleOpen,children:[(0,L.jsx)(fo,{right:!e.open,className:hv(e.open)}),(0,L.jsxs)(`span`,{className:gv,children:[(0,L.jsxs)(`span`,{className:_v(!t.enabled),children:[t.name,t.renamedFrom?(0,L.jsx)(`span`,{className:vv,children:t.renamedFrom}):null,t.custom&&!t.renamedFrom?(0,L.jsx)(`span`,{className:vv,children:Q(`engines.customTag`)}):null]}),(0,L.jsxs)(`span`,{className:bv(fx[i.tone]),children:[(0,L.jsx)(`span`,{className:xv(fx[i.tone]),"aria-hidden":`true`}),Q(i.key.slice(9))]})]})]}),(0,L.jsx)(`div`,{className:Sv,children:t.isDefault?(0,L.jsx)(`span`,{className:Cv,children:Q(`engines.defaultMark`)}):t.canBeDefault?(0,L.jsx)(`button`,{type:`button`,className:wv,"aria-label":F(`settings.engines.default`,{name:t.name}),onClick:()=>n(`engine.setDefault`,{id:t.id}),children:Q(`engines.makeDefault`)}):null}),(0,L.jsx)(Xv,{on:t.enabled,"aria-label":F(`settings.engines.enabled`,{name:t.name}),onClick:()=>n(`engine.setEnabled`,{id:t.id,enabled:!t.enabled})})]}),e.open?(0,L.jsx)(gx,{id:r,engine:t,run:n}):null]})}function hx(e){if(e.configIssue)return Q(`engines.detail.hooksBlockedHere`,{reason:e.configIssue});switch(e.hooks){case`installed`:return Q(`engines.detail.hooksInstalled`);case`outdated`:return Q(`engines.detail.hooksOutdated`);case`not-installed`:return e.binaryFound===!1?Q(`engines.detail.hooksAwaitEngine`):Q(`engines.detail.hooksMissing`);default:return Q(`engines.detail.hooksUnsupported`)}}function gx(e){let{engine:t,run:n}=e,[r,i]=(0,h.useState)(null),a=t.binaryFound===!0?Q(`engines.detail.programFound`,{binary:t.binary,path:t.binaryPath??t.binary}):t.binaryFound===!1?Q(`engines.detail.programMissing`,{binary:t.binary}):Q(`engines.detail.programUnknown`,{binary:t.binary}),o=t.login===`yes`?Q(`engines.detail.signedIn`):t.login===`no`?Q(`engines.detail.signedOut`):Q(`engines.detail.signInUnknown`),s=[hx(t),Q(t.markers?`engines.detail.markersYes`:`engines.detail.markersNo`),Q(t.screen?`engines.detail.screenYes`:t.hooks===`installed`?`engines.detail.screenNotNeeded`:`engines.detail.screenNo`)];return(0,L.jsxs)(`div`,{id:e.id,className:Tv,children:[(0,L.jsxs)(`dl`,{className:Ev,children:[(0,L.jsx)(`dt`,{className:Dv,children:Q(`engines.detail.program`)}),(0,L.jsx)(`dd`,{className:Ov(t.binaryFound===!1),children:a}),(0,L.jsx)(`dt`,{className:Dv,children:Q(`engines.detail.signIn`)}),(0,L.jsx)(`dd`,{className:Ov(t.login===`no`),children:o}),(0,L.jsx)(`dt`,{className:Dv,children:Q(`engines.detail.reporting`)}),(0,L.jsx)(`dd`,{className:Ov(!1),children:s.map(e=>(0,L.jsx)(`span`,{className:`block`,children:e},e))}),t.skill===`unsupported`?null:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`dt`,{className:Dv,children:Q(`engines.detail.skill`)}),(0,L.jsx)(`dd`,{className:Ov(t.skill!==`installed`),children:Q(t.skill===`installed`?`engines.detail.skillInstalledHere`:t.skill===`outdated`?`engines.detail.skillOutdated`:`engines.detail.skillMissing`)})]}),t.custom?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`dt`,{className:Dv,children:Q(`engines.detail.adapter`)}),(0,L.jsx)(`dd`,{className:Ov(!1),children:t.protocol?Q(`engines.detail.adapterDeclared`,{protocol:t.protocol}):Q(`engines.detail.adapterGeneric`)})]}):null]}),r===null?(0,L.jsxs)(`div`,{className:kv,children:[(0,L.jsx)(R,{variant:`action`,onClick:()=>i(t.name),children:F(`settings.engines.rename`)}),t.custom||t.customized?(0,L.jsx)(R,{variant:`action`,onClick:()=>n(`engine.reset`,{id:t.id}),children:t.custom?F(`settings.engines.remove`):F(`settings.engines.reset`)}):null]}):(0,L.jsxs)(`form`,{className:kv,onSubmit:e=>{e.preventDefault(),n(`engine.rename`,{id:t.id,name:r}),i(null)},children:[(0,L.jsx)(`input`,{className:`${cn} w-full ${Av}`,autoFocus:!0,value:r,"aria-label":F(`settings.engines.rename`),placeholder:F(`settings.engines.namePlaceholder`),onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),i(null))}}),(0,L.jsx)(R,{variant:`filled`,type:`submit`,children:F(`settings.engines.save`)}),(0,L.jsx)(R,{variant:`action`,onClick:()=>i(null),children:F(`settings.engines.cancel`)})]})]})}function _x({engines:e,run:t}){let n=e.filter(e=>e.hooks!==`unsupported`),r=n.filter(e=>e.binaryFound!==!1),i=r.filter(e=>e.hooks===`installed`).length,a=r.length-i,o=n.filter(e=>e.hooks!==`not-installed`).length;return n.length===0?null:(0,L.jsx)(Zv,{title:Q(`engines.integrations.title`),hint:Q(`engines.integrations.hint`),children:(0,L.jsx)(Qv,{label:Q(`engines.integrations.summary`,{installed:i,total:r.length}),children:(0,L.jsxs)(`div`,{className:sv,children:[a>0?(0,L.jsx)(R,{variant:`filled`,onClick:()=>t(`engines.hooks.install`),children:Q(`engines.integrations.install`,{count:a})}):(0,L.jsx)(`span`,{className:jv,children:Q(`engines.integrations.upToDate`)}),o>0?(0,L.jsx)(R,{variant:`action`,onClick:()=>t(`engines.hooks.uninstall`),children:Q(`engines.integrations.remove`,{count:o})}):null]})})})}function vx(e){let t=e.engines.filter(e=>e.skill!==`unsupported`),n=t.filter(e=>e.skill===`installed`).length,r=t.length-n;return(0,L.jsx)(Zv,{title:Q(`engines.skill.title`),hint:Q(`engines.skill.hint`),children:(0,L.jsx)(Qv,{label:t.length>0?Q(`engines.integrations.summary`,{installed:n,total:t.length}):Q(`engines.skill.noEngines`),children:r>0?(0,L.jsx)(R,{variant:`filled`,onClick:()=>void ux(e.client).then(e.reload),children:Q(`engines.skill.install`,{count:r})}):t.length>0?(0,L.jsx)(`span`,{className:jv,children:Q(`engines.integrations.upToDate`)}):null})})}var yx={bug:`settings.feedback.kindBug`,idea:`settings.feedback.kindIdea`,question:`settings.feedback.kindQuestion`};function bx({model:e}){let[t,n]=(0,h.useState)(`bug`),[r,i]=(0,h.useState)(``),[a,o]=(0,h.useState)(``),[s,c]=(0,h.useState)(!1),[l,u]=(0,h.useState)(null),[d,f]=(0,h.useState)(!1);return(0,L.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:n=>{n.preventDefault(),!(!r.trim()||!a.trim())&&(c(!0),u(null),e.client.request(`feedback.send`,{title:r.trim(),body:a,kind:t}).then(e=>{u(e),e.filed&&(i(``),o(``))}).catch(e=>H(U(e),`error`)).finally(()=>c(!1)))},children:[(0,L.jsx)(`p`,{className:`m-0 ${$_}`,children:F(`settings.feedback.hint`)}),(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,L.jsx)(`div`,{className:sv,children:(0,L.jsx)(R,{variant:`action`,type:`button`,onClick:()=>{f(!1),Fg(e).catch(()=>f(!0))},children:F(`settings.feedback.report`)})}),(0,L.jsx)(`p`,{className:`m-0 ${$_}`,children:F(d?`settings.feedback.reportFailed`:`settings.feedback.reportNote`)})]}),(0,L.jsxs)(`label`,{className:iv,children:[(0,L.jsx)(`span`,{className:av,children:F(`settings.feedback.kindLabel`)}),(0,L.jsx)(`select`,{className:`${nv} w-full`,value:t,onChange:e=>n(e.target.value),children:Object.keys(yx).map(e=>(0,L.jsx)(`option`,{value:e,children:F(yx[e])},e))})]}),(0,L.jsxs)(`label`,{className:iv,children:[(0,L.jsx)(`span`,{className:av,children:F(`settings.feedback.titleLabel`)}),(0,L.jsx)(`input`,{className:`${nv} w-full`,value:r,onChange:e=>i(e.target.value)})]}),(0,L.jsxs)(`label`,{className:iv,children:[(0,L.jsx)(`span`,{className:av,children:F(`settings.feedback.body`)}),(0,L.jsx)(`textarea`,{className:`${nv} ${ov} w-full`,rows:6,value:a,onChange:e=>o(e.target.value)})]}),l&&(0,L.jsxs)(`p`,{className:`m-0 text-meta text-muted [&_a]:text-accent break-words`,children:[l.filed?F(`settings.feedback.sent`,{number:l.number??0}):F(`settings.feedback.notFiled`,{hint:l.hint??``}),` `,(0,L.jsx)(`a`,{className:`underline`,href:l.url,target:`_blank`,rel:`noreferrer`,children:l.filed?l.url:F(`settings.feedback.openLink`)})]}),(0,L.jsx)(`div`,{className:sv,children:(0,L.jsx)(R,{variant:`filled`,type:`submit`,disabled:s||!r.trim()||!a.trim(),children:F(`settings.feedback.send`)})})]})}var xx=[{value:`en`,label:`English`},{value:`zh`,label:`中文`}],Sx={default:`general.worktreeKindDefault`,nextToProject:`general.worktreeKindNext`,custom:`general.worktreeKindCustom`};function Cx({model:e}){let{client:t}=e,n=x_(),{prefs:r,info:i}=n,a=(e,n)=>void b_(t,e,n),o=[`default`,`nextToProject`];(i.worktreeCustomPath||r.worktreeBase===`custom`)&&o.push(`custom`);let s=o.map(e=>({value:e,label:Q(Sx[e])}));return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(Zv,{title:F(`settings.general.groupInterface`),children:[(0,L.jsx)(ty,{label:Q(`general.language`),hint:F(`prefs.languageHint`),value:r.locale,picks:xx,onPick:e=>a(`locale`,e)}),(0,L.jsx)($v,{label:Q(`general.keyHintsShow`),hint:Q(`general.keyHintsHint`),checked:r.keyHints,onChange:e=>a(`keyHints`,e)}),(0,L.jsx)($v,{label:Q(`general.zenDefaultOn`),hint:F(`prefs.zenHint`),checked:r.zen,onChange:e=>a(`zen`,e)}),(0,L.jsx)(ty,{label:F(`settings.general.tabStrip`),value:r.tabStrip,picks:S_(n,`tabStrip`).map(e=>({value:e,label:Q(`general.tabStripMode.${e}`)})),onPick:e=>a(`tabStrip`,e)})]}),(0,L.jsxs)(Zv,{title:F(`settings.general.groupFiles`),children:[(0,L.jsx)(ty,{label:Q(`general.editor`),hint:F(`settings.general.editorNote`),value:r.editorKind,picks:S_(n,`editorKind`).map(e=>({value:e,label:e})),onPick:e=>a(`editorKind`,e)}),(0,L.jsx)(ty,{label:Q(`general.worktree`),hint:Q(`general.worktreeHint`),value:r.worktreeBase,picks:s,onPick:e=>a(`worktreeBase`,e)})]}),(0,L.jsx)(Zv,{title:F(`settings.general.groupTerminal`),hint:Q(`general.terminalHint`),children:(0,L.jsx)(wx,{client:t})})]})}function wx({client:e}){let t=x_(),n=t.options.scrollbackRows,r=n&&`min`in n?n:{min:100,max:1e5},[i,a]=(0,h.useState)(String(t.prefs.scrollbackRows));return(0,h.useEffect)(()=>a(String(t.prefs.scrollbackRows)),[t.prefs.scrollbackRows]),(0,L.jsx)(Qv,{label:F(`settings.general.scrollback`),hint:Q(`general.scrollbackRowHint`),children:(0,L.jsx)(`input`,{className:rv,inputMode:`numeric`,value:i,"aria-label":Q(`general.scrollbackTitle`),onChange:e=>a(e.target.value),onBlur:()=>{let n=Number(i);if(i.trim()===``||!Number.isInteger(n)){a(String(t.prefs.scrollbackRows));return}let o=Math.min(r.max,Math.max(r.min,n));o===t.prefs.scrollbackRows?a(String(o)):b_(e,`scrollbackRows`,o)},onKeyDown:e=>e.key===`Enter`&&e.currentTarget.blur()})})}var Tx=`prefix.key`;function Ex(e,t,n){let r=t.find(e=>e===`enter`||e.endsWith(`+enter`))??t[0];if(r===void 0)return{kind:`more`,recording:e};if(t.includes(`escape`))return{kind:`cancel`};if(e.prefixArmed)return{kind:`done`,mode:`prefix`,keys:[r]};if(e.got.length===0&&n.some(e=>t.includes(e)))return{kind:`more`,recording:{...e,prefixArmed:!0}};let i=[...e.got,r];return i.length<e.slots?{kind:`more`,recording:{...e,got:i}}:{kind:`done`,mode:`direct`,keys:i}}function Dx(){return Qs(Js().filter(e=>e.keys.length>0||e.prefixKeys!==void 0)).flatMap(e=>[...e.rows])}[...Array.from({length:12},(e,t)=>`f${t+1}`)];function Ox(e,t){let n=`alternating [${e}, ${t}] pairs`;return{layout:n,slots:[e,t],validateCount:e=>e>=2&&e%2==0?null:`needs ${n} (an even number of chords — got ${e})`}}var kx={"sidebar.goto":Ox(`top (double-tap)`,`bottom`),"sidebar.nav":Ox(`down`,`up`),"files.nav":Ox(`down`,`up`),"diff.review.cursor":Ox(`down`,`up`),"sidebar.search.nav":Ox(`down`,`up`),"files.hierarchy":Ox(`collapse`,`expand`),"files.tab":Ox(`previous tab`,`next tab`),"app.quit":{layout:`[quit confirm, hard exit] (second chord optional)`,validateCount:e=>e<=2?null:`needs [quit confirm, hard exit] (1 or 2 chords — got ${e})`}};function Ax(e){return kx[e]?.slots??[]}var jx=`group/cap relative inline-flex flex-none items-stretch rounded-sm border-hairline bg-surface font-mono text-meta has-[:focus-visible]:outline-1 has-[:focus-visible]:outline-offset-1 has-[:focus-visible]:outline-focus`,Mx={idle:`border-line text-ink hover:border-line-active`,changed:`border-line text-accent hover:border-line-active`,empty:`border-dashed border-line text-subtle hover:border-line-active`,active:`border-accent text-accent`},Nx=`absolute -top-1.5 -right-1.5 flex size-4 cursor-pointer items-center justify-center rounded-full border-hairline border-line bg-paper p-0 leading-none text-subtle hover:border-line-active hover:text-error focus-visible:opacity-100 group-hover/cap:opacity-100 touch:size-5 touch:opacity-100 touch:after:absolute touch:after:-inset-2.5 touch:after:content-['']`;function Px(e){return(0,L.jsxs)(`span`,{className:Re(jx,Mx[e.tone??`idle`]),children:[(0,L.jsx)(`button`,{type:`button`,"aria-label":e.label,className:`px-2 py-1 touch:min-h-10`,onClick:e.onPress,children:e.children}),e.onRemove&&(0,L.jsx)(`button`,{type:`button`,"aria-label":e.removeLabel,className:Re(Nx,!e.removeShown&&`opacity-0`),onClick:e.onRemove,children:`×`})]})}var Fx=Qs(Dx());function Ix(e){let[t,n]=(0,h.useState)(null),[r,i]=(0,h.useState)(null),a=(0,h.useRef)(t);a.current=t;let o=async(t,n)=>{try{let r=await e.request(`keybindings.set`,{id:t,...n});i({id:t,lines:r.lines}),await vi(e)}catch(e){H(U(e),`error`)}},s=(0,h.useRef)(o);s.current=o;let c=t!==null;return(0,h.useEffect)(()=>{if(!c)return;let e=e=>{e.preventDefault(),e.stopImmediatePropagation();let t=a.current;if(!t||[`Control`,`Shift`,`Alt`,`Meta`].includes(e.key))return;let r=t.id===`prefix.key`?[]:hi.get().prefix.firstStrokes,i=Ex(t,Gs(e),r);if(i.kind===`more`)return n(i.recording);n(null),i.kind===`done`&&s.current(t.id,{[i.mode]:i.keys})};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},[c]),{recording:t,notice:r,record:e=>{i(null),n({id:e,slots:Math.max(1,Ax(e).length),got:[],prefixArmed:!1})},save:(e,t)=>void o(e,t)}}function Lx(e,t){if(e.prefixArmed)return Q(`keybindings.recordingPrefix`,{prefix:t});let n=Ax(e.id)[e.got.length];return n?Q(`keybindings.recordingSlot`,{slot:n}):Q(`keybindings.recording`)}function Rx(e){let{editor:t,id:n}=e,r=()=>t.record(n),i=F(`keys.recordFor`,{name:e.name});if(t.recording?.id===n)return(0,L.jsx)(Px,{tone:`active`,label:i,onPress:r,children:Lx(t.recording,e.prefixName)});let a=e.changed?`changed`:`idle`,o=t.notice?.id===n,s=e.prefix??[];return e.direct.length===0&&s.length===0?(0,L.jsx)(Px,{tone:`empty`,label:i,onPress:r,children:Q(`keybindings.unbound`)}):(0,L.jsxs)(L.Fragment,{children:[e.direct.length>0&&(0,L.jsx)(Px,{tone:a,label:i,onPress:r,onRemove:()=>t.save(n,{direct:[]}),removeLabel:F(`keys.removeFor`,{name:e.name}),removeShown:o,children:e.direct.join(` / `)}),s.length>0&&(0,L.jsx)(Px,{tone:a,label:i,onPress:r,onRemove:()=>t.save(n,{prefix:[]}),removeLabel:F(`keys.removeFor`,{name:e.name}),removeShown:o,children:s.map(t=>`${e.prefixName} ${t}`).join(` / `)})]})}function zx(e,t,n,r){let i=e.notice?.id===t?e.notice.lines:[];return i.length>0?(0,L.jsx)(`span`,{className:`text-warning`,children:i.join(` `)}):n===null?r:(0,L.jsxs)(`span`,{className:`inline-flex flex-wrap items-baseline gap-x-2`,children:[Q(`keybindings.defaultKeys`,{keys:n}),(0,L.jsx)(R,{hit:`tight`,onClick:()=>e.save(t,{direct:`default`,prefix:`default`}),children:F(`keys.reset`)})]})}function Bx({editor:e,keys:t}){let n=t.prefix.key??Q(`keybindings.prefixDisabled`),r=(e,t=[])=>[...e,...t.map(e=>`${n} ${e}`)].join(` / `);return(0,L.jsx)(L.Fragment,{children:Fx.map(i=>(0,L.jsx)(Zv,{title:Sc(i.category),children:i.rows.map(i=>{let a=t.rows.find(e=>e.id===i.id),o=bc(i.id);return(0,L.jsx)(Qv,{label:o,hint:zx(e,i.id,a?r(i.keys,i.prefixKeys):null),children:(0,L.jsx)(Rx,{editor:e,id:i.id,name:o,direct:a?.keys??i.keys,prefix:a?a.prefixKeys:i.prefixKeys,prefixName:n,changed:a!==void 0})},i.id)})},i.category))})}function Vx({model:e}){let{client:t}=e,{prefs:n}=x_(),r=_(hi),[i,a]=(0,h.useState)(!1);(0,h.useEffect)(()=>void vi(t),[t]);let o=r.prefix.key??Q(`keybindings.prefixDisabled`),s=Ix(t),c=mi.prefix.firstStrokes,l=r.prefix.firstStrokes.join()!==c.join();return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(Zv,{children:[(0,L.jsx)(ty,{label:Q(`keybindings.tapPresentation`),hint:Q(`keybindings.tapPresentationHint`),value:n.prefixTap,picks:[{value:`local`,label:Q(`keybindings.tapPresentationLocal`)},{value:`guide`,label:Q(`keybindings.tapPresentationGuide`)}],onPick:e=>void b_(t,`prefixTap`,e)}),(0,L.jsx)(Qv,{label:Q(`keybindings.prefixTitle`,{prefix:o}),hint:zx(s,Tx,l?c.join(` / `):null,Q(`keybindings.prefixHint`,{prefix:o,timeout:r.prefix.timeoutMs})),children:(0,L.jsx)(Rx,{editor:s,id:Tx,name:Q(`keybindings.prefixKey`),direct:r.prefix.firstStrokes,prefixName:o,changed:l})})]}),(0,L.jsxs)(Zv,{title:Q(`keybindings.configFile`),hint:`${F(`keys.editHint`)} ${F(`prefs.keysYaml`)}`,children:[(0,L.jsx)(Qv,{label:(0,L.jsx)(`span`,{className:`font-mono break-all`,children:r.path+(r.exists?``:Q(`keybindings.notCreated`))})}),(0,L.jsx)(Qv,{label:F(`keys.agent`),hint:F(i?`keys.agentFailed`:`keys.agentHint`),children:(0,L.jsx)(R,{variant:`action`,onClick:()=>{a(!1),Pg(e,F(`keys.agentPrompt`,{path:r.path})).catch(()=>a(!0))},children:F(`keys.agent`)})})]}),r.warnings.length>0&&(0,L.jsx)(Zv,{title:Q(`keybindings.warnings`),children:r.warnings.map(e=>(0,L.jsx)(Qv,{label:(0,L.jsx)(`span`,{className:`text-warning`,children:e})},e))}),(0,L.jsx)(Bx,{editor:s,keys:r}),r.plugins.length>0&&(0,L.jsx)(Zv,{title:F(`keys.pluginChords`),children:r.plugins.map(e=>(0,L.jsx)(Qv,{label:(0,L.jsx)(`span`,{className:`font-mono`,children:e.chord}),hint:(0,L.jsx)(`span`,{className:`font-mono`,children:`${e.kind}:${e.target}`})},e.chord))})]})}var Hx=`/assets/pulse-3XJkP4CJ.wav`;function Ux(e,t){return e===`error`||t}function Wx(e,t){return t||e.kind!==`done`||e.turnEnd!==!0}function Gx(e,t){return t&&e.silent!==!0}function Kx(e){return e===`permission_needed`?`needs_input`:e===`error`||e===`rate_limited`||e===`dead`?`error`:e===`turn_complete`?`done`:null}function qx(e,t,n,r){if(e===null)return[];let i=[];for(let[a,o]of t){if(a===n||e.get(a)===o)continue;let t=r(o);t&&i.push({key:a,kind:t})}return i}function Jx(){return window.isSecureContext&&`serviceWorker`in navigator&&`PushManager`in window&&`Notification`in window}var Yx=()=>navigator.serviceWorker.register(`sw.js`);async function Xx(e){if(!Jx())return`unsupported`;if(Notification.permission===`denied`)return`blocked`;let t=await(await navigator.serviceWorker.getRegistration())?.pushManager.getSubscription();if(!t)return`off`;let{subscribed:n}=await e.request(`push.status`,{endpoint:t.endpoint});return n?`on`:`off`}async function Zx(e){if(!Jx())return`unsupported`;if(await Notification.requestPermission()!==`granted`)return`blocked`;let t=await Yx();await navigator.serviceWorker.ready;let{publicKey:n}=await e.request(`push.key`),r=await t.pushManager.getSubscription();return r?.options.applicationServerKey&&rS(r.options.applicationServerKey)!==n&&(await r.unsubscribe(),r=null),r??=await t.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:nS(n)}),await e.request(`push.subscribe`,{subscription:r.toJSON()}),`on`}async function Qx(e){let t=await(await navigator.serviceWorker.getRegistration())?.pushManager.getSubscription();return t&&(await e.request(`push.unsubscribe`,{endpoint:t.endpoint}),await t.unsubscribe()),`off`}async function $x(e,t,n,r){let i={body:r,tag:`task:${e}:${t}`,icon:`icon-192.png`,data:{taskId:e}},a=`serviceWorker`in navigator?await navigator.serviceWorker.getRegistration():void 0;if(a)return a.showNotification(`Rove — ${n}`,i);let o=new Notification(`Rove — ${n}`,i);o.onclick=()=>{window.focus(),eS?.(e),o.close()}}var eS=null;function tS(e){eS=t=>e.selectWhenListed(t);let t=new URLSearchParams(window.location.search),n=t.get(`task`);if(n){t.delete(`task`);let r=t.toString();history.replaceState(null,``,`${window.location.pathname}${r?`?${r}`:``}${window.location.hash}`),e.selectWhenListed(n)}let r=()=>{eS=null};if(!(`serviceWorker`in navigator))return r;let i=t=>{let n=t.data;n?.type===`rove.openTask`&&typeof n.taskId==`string`&&n.taskId&&e.selectWhenListed(n.taskId)};return navigator.serviceWorker.addEventListener(`message`,i),()=>{r(),navigator.serviceWorker.removeEventListener(`message`,i)}}function nS(e){let t=atob(e.replace(/-/g,`+`).replace(/_/g,`/`));return Uint8Array.from(t,e=>e.charCodeAt(0))}function rS(e){return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}var iS={done:`✓`,needs_input:`?`,error:`✕`};function aS(e){let t=new Audio(Hx);t.volume=Math.min(1,Math.max(0,e)),t.play().catch(()=>void 0)}function oS(e,t,n){!document.hidden||typeof Notification>`u`||Notification.permission!==`granted`||$x(e,t,n,iS[t]).catch(()=>void 0)}function sS(){typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission()}function cS(e){let t=new Map;for(let n of e.tasks)n.activity&&t.set(n.id,n.activity.state);return t}function lS(e){let t=(0,h.useRef)(null);(0,h.useEffect)(()=>{let n=()=>{let n=e.tasks.get();if(!n)return;let r=cS(n),i=qx(t.current,r,null,Kx);t.current=r;let{prefs:a}=g_.get();if(!a.crossTask)return;let o=e.selection.get().taskId,s=new Map(n.tasks.map(e=>[e.id,e.label]));for(let{key:e,kind:t}of i){if(e===o||!Wx({kind:t,turnEnd:!0},a.finishedAlerts))continue;let n=s.get(e)??e;Ux(t,a.toast)&&H(`${iS[t]} ${n}`,t===`error`?`error`:`info`),Gx({},a.sound)&&(aS(a.soundVolume),oS(e,t,n))}};return n(),e.tasks.subscribe(n)},[e])}function uS({client:e}){let[t,n]=(0,h.useState)(null),[r,i]=(0,h.useState)(null);(0,h.useEffect)(()=>{Xx(e).then(n,()=>n(`off`))},[e]);let a=t=>{i(null),(t?Zx(e):Qx(e)).then(n,e=>i(e instanceof Error?e.message:String(e)))},o=r?F(`prefs.pushFailed`,{error:r}):F(t===`unsupported`?`prefs.pushUnsupported`:t===`blocked`?`prefs.pushBlocked`:`prefs.pushHint`);return(0,L.jsx)($v,{label:F(`prefs.push`),hint:o,checked:t===`on`,disabled:t===null||t===`unsupported`||t===`blocked`,onChange:a})}function dS({model:e}){let{client:t}=e,n=x_(),{prefs:r}=n,i=(e,n)=>void b_(t,e,n);return(0,L.jsxs)(Zv,{children:[(0,L.jsx)($v,{label:Q(`general.toast`),hint:F(`settings.notifications.toastNote`),checked:r.toast,onChange:e=>i(`toast`,e)}),(0,L.jsx)($v,{label:Q(`general.sound`),hint:F(`prefs.soundHint`),checked:r.sound,onChange:e=>{e&&sS(),i(`sound`,e)}}),(0,L.jsx)(ty,{label:F(`settings.notifications.volume`),hint:F(`prefs.soundVolumeHint`),value:r.soundVolume,picks:S_(n,`soundVolume`).map(e=>({value:e,label:`${Math.round(e*100)}%`})),onPick:e=>{g_.get().prefs.sound&&aS(e),i(`soundVolume`,e)}}),(0,L.jsx)($v,{label:Q(`general.crossTask`),hint:Q(`general.crossTaskHint`),checked:r.crossTask,onChange:e=>i(`crossTask`,e)}),(0,L.jsx)($v,{label:Q(`general.finishedAlerts`),hint:Q(`general.finishedAlertsHint`),checked:r.finishedAlerts,onChange:e=>i(`finishedAlerts`,e)}),(0,L.jsx)(uS,{client:t})]})}var fS={kanban:`kanban`,issues:`issues`};function pS({model:e}){let t=_(e.installedMods),[n,r]=(0,h.useState)(()=>J(e,`builtinMods.list`)?.mods??null);if((0,h.useEffect)(()=>{X(e,`builtinMods.list`).then(e=>r(e.mods),()=>r([])),e.refreshMods()},[e]),!n||n.length===0)return null;let i=n=>{let r=!t.has(n.id);e.client.request(`builtinMod.setInstalled`,{id:n.id,installed:r}).then(()=>(!r&&V.get()===fS[n.id]&&V.set(null),e.refreshMods())).catch(e=>H(U(e),`error`))};return(0,L.jsx)(Zv,{title:F(`settings.plugins.builtIn`),hint:F(`settings.plugins.builtInHint`),children:n.map(e=>(0,L.jsx)(Qv,{label:e.name,hint:e.description,inline:!0,children:(0,L.jsx)(Xv,{on:t.has(e.id),"aria-label":F(`settings.plugins.turnOn`,{name:e.name}),onClick:()=>i(e)})},e.id))})}function mS({model:e}){let{client:t}=e,[n,r]=(0,h.useState)(()=>J(t,`plugins.list`)?.plugins??null),i=(0,h.useCallback)(()=>X(t,`plugins.list`).then(e=>r(e.plugins),e=>H(U(e),`error`)),[t]);return(0,h.useEffect)(()=>{i()},[i]),(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(pS,{model:e}),(0,L.jsx)(Zv,{title:F(`settings.plugins.registered`),children:n?n.length===0?(0,L.jsx)(`p`,{className:tv,children:F(`settings.plugins.empty`)}):n.map(e=>(0,L.jsx)(Qv,{label:e.id,hint:[e.version,e.linked?F(`settings.plugins.linked`):null,e.platformOk===!1?F(`settings.plugins.unsupportedPlatform`):null].filter(Boolean).join(`, `),inline:!0,children:(0,L.jsx)(Xv,{on:e.enabled,"aria-label":e.id,onClick:()=>void t.request(`plugin.setEnabled`,{id:e.id,enabled:!e.enabled}).then(i).catch(e=>H(U(e),`error`))})},e.id)):(0,L.jsx)(`p`,{className:tv,children:F(`preview.loading`)})})]})}function hS(e){let[t,n]=(0,h.useState)(e.tier.engine),[r,i]=(0,h.useState)(e.tier.model??``),[a,o]=(0,h.useState)(e.tier.effort??``),s=e.engines.find(e=>e.id===t);return(0,L.jsxs)(`form`,{className:Lv,onSubmit:n=>{n.preventDefault(),e.onSave(t,s?.takesModel?r.trim():``,a)},onKeyDown:t=>{t.key===`Escape`&&(t.stopPropagation(),e.onCancel())},children:[(0,L.jsx)(P_,{label:Q(`sections.engines`),value:t,picks:e.engines.map(e=>({value:e.id,label:e.name})),onPick:t=>{let r=e.engines.find(e=>e.id===t);n(t),r&&!r.effortLevels.includes(a)&&o(``),r&&!r.takesModel&&i(``)}}),s&&s.effortLevels.length>0&&(0,L.jsx)(P_,{label:F(`prefs.tierEffort`),value:a,picks:[``,...s.effortLevels].map(e=>({value:e,label:e||Q(`autoRouting.engineDefault`)})),onPick:o}),s?.takesModel&&(0,L.jsx)(`input`,{className:`rounded-sm border-hairline border-line bg-paper px-2.5 py-1.5 font-sans text-body text-ink focus-visible:border-line-active focus-visible:outline-none`,value:r,spellCheck:!1,placeholder:Q(`autoRouting.engineDefault`),"aria-label":F(`prefs.tierModel`),onChange:e=>i(e.target.value)}),(0,L.jsxs)(`div`,{className:sv,children:[(0,L.jsx)(R,{onClick:e.onCancel,children:F(`dialog.cancel`)}),(0,L.jsx)(R,{variant:`filled`,type:`submit`,children:Q(`action.save`)})]})]})}function gS({client:e}){let[t,n]=(0,h.useState)(()=>J(e,`autoRouting.get`)??null),[r,i]=(0,h.useState)(null),a=(0,h.useCallback)(()=>X(e,`autoRouting.get`).then(n,e=>H(U(e),`error`)),[e]);(0,h.useEffect)(()=>{a()},[a]);let o=(t,n)=>e.request(t,n).then(a).catch(e=>H(U(e),`error`));if(!t)return(0,L.jsx)(`p`,{className:tv,children:F(`preview.loading`)});let s=t.classifier,c=[{value:`off`,label:Q(`autoRouting.classifierOff`)},{value:`jev`,label:`jev`},...s.canCustom||s.mode===`custom`?[{value:`custom`,label:Q(`autoRouting.classifierCustomLabel`)}]:[]],l=s.mode===`off`?Q(`autoRouting.classifierOffHint`):s.mode===`jev`?Q(`autoRouting.classifierJevHint`):Q(`autoRouting.classifierCustomHint`),u=s.keySource===`env`?Q(`autoRouting.keyPresentEnv`,{env:s.keyEnv??``}):s.keySource===`file`?Q(`autoRouting.keySaved`):s.keyConfigured?Q(`autoRouting.keyMissing`):Q(`autoRouting.keyCustomUnused`);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(Zv,{hint:Q(`autoRouting.hint`),children:[!t.configured&&(0,L.jsx)(Qv,{label:(0,L.jsx)(`span`,{className:`text-warning`,children:Q(`autoRouting.unconfigured`)})}),t.tiers.map(e=>(0,L.jsxs)(`div`,{className:Fv,children:[(0,L.jsxs)(`div`,{className:Iv,children:[(0,L.jsx)(`span`,{className:Q_,children:N_(`tier.${e.tier}`)}),(0,L.jsx)(`span`,{className:`${$_} min-w-0 truncate`,children:[e.engineName,e.model??Q(`autoRouting.engineDefault`),e.effort??Q(`autoRouting.engineDefault`)].join(` · `)}),(0,L.jsx)(R,{className:`ml-auto`,onClick:()=>i(r===e.tier?null:e.tier),children:F(`prefs.tierEdit`)})]}),(0,L.jsx)(`span`,{className:$_,children:N_(`tierDesc.${e.tier}`)}),(0,L.jsx)(`span`,{className:`text-meta ${e.block?`text-warning`:`text-success`}`,children:e.block?Q(`autoRouting.unavailable`,{reason:e.block}):Q(`autoRouting.ready`)}),r===e.tier&&(0,L.jsx)(hS,{tier:e,engines:t.engines,onCancel:()=>i(null),onSave:(t,n,r)=>{i(null),o(`autoRouting.setTier`,{tier:e.tier,engine:t,model:n,effort:r})}})]},e.tier))]}),(0,L.jsxs)(Zv,{title:Q(`autoRouting.classifierTitle`),hint:Q(`autoRouting.classifierHint`),children:[(0,L.jsx)(Qv,{label:(0,L.jsx)(`span`,{className:s.mode===`off`?`text-muted`:`text-warning`,children:Q(`autoRouting.classifierDataFlow`)})}),(0,L.jsx)(ty,{label:Q(`autoRouting.classifierLabel`),hint:l.replace(/^[—\s]+/,``),value:s.mode,picks:c,onPick:e=>void o(`autoRouting.setClassifier`,{mode:e})})]}),(0,L.jsxs)(Zv,{title:F(`prefs.classifierConnection`),hint:F(`prefs.editInTui`),children:[(0,L.jsx)(ny,{label:Q(`autoRouting.endpointLabel`),value:s.endpointHost||F(`prefs.unset`)}),(0,L.jsx)(ny,{label:Q(`autoRouting.thresholdLabel`),value:s.threshold.toFixed(2)}),(0,L.jsx)(Qv,{label:Q(`autoRouting.keyLabel`),hint:u})]})]})}var _S=[{id:`preferences`,sections:[`general`,`appearance`,`notifications`,`snippets`,`keys`]},{id:`agents`,sections:[`engines`,`autoRouting`,`voice`,`connectors`,`plugins`]},{id:`more`,sections:[`about`,`feedback`,`dev`]}],vS=e=>({section:e??`general`,drilled:e!==void 0});function yS(e,t){return t&&e.drilled?`list`:`close`}var bS=e=>e.split(`
34
- `,1)[0]??``;function xS(e){let[t,n]=(0,h.useState)(e.editing?.name??``),[r,i]=(0,h.useState)(e.editing?.text??``),[a,o]=(0,h.useState)(!1),s=Um.test(t)&&r.trim()!==``;return(0,L.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:n=>{n.preventDefault(),s&&(o(!0),Vm(e.client,{name:t,text:r}).then(e.onDone).catch(e=>{H(U(e),`error`),o(!1)}))},children:[(0,L.jsxs)(`label`,{className:iv,children:[(0,L.jsx)(`span`,{className:av,children:F(`snippets.name`)}),(0,L.jsx)(`input`,{className:`${nv} w-full font-mono`,value:t,maxLength:32,spellCheck:!1,autoComplete:`off`,autoFocus:!e.editing,readOnly:e.editing!==void 0,placeholder:F(`snippets.namePlaceholder`),onChange:e=>n(e.target.value)}),t!==``&&!Um.test(t)&&(0,L.jsx)(`span`,{className:`text-meta text-muted [&_a]:text-accent`,children:F(`snippets.badName`)})]}),(0,L.jsxs)(`label`,{className:iv,children:[(0,L.jsx)(`span`,{className:av,children:F(`snippets.text`)}),(0,L.jsx)(`textarea`,{className:`${nv} ${ov} w-full`,rows:5,value:r,maxLength:8e3,placeholder:F(`snippets.textPlaceholder`),onChange:e=>i(e.target.value)})]}),(0,L.jsxs)(`div`,{className:sv,children:[(0,L.jsx)(R,{onClick:e.onDone,children:F(`snippets.cancel`)}),(0,L.jsx)(R,{type:`submit`,disabled:a||!s,children:F(`snippets.save`)})]})]})}function SS({model:e}){let{client:t}=e,n=zm(),[r,i]=(0,h.useState)(null);return(0,h.useEffect)(()=>void Bm(t).catch(()=>void 0),[t]),(0,L.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,L.jsxs)(Zv,{children:[n.length===0&&r===null&&(0,L.jsx)(Qv,{label:F(`snippets.empty`)}),n.map(e=>(0,L.jsxs)(Qv,{label:(0,L.jsxs)(`span`,{className:`font-mono`,children:[`@`,e.name]}),hint:bS(e.text),children:[(0,L.jsx)(R,{onClick:()=>i(e),children:F(`snippets.edit`)}),(0,L.jsx)(R,{onClick:()=>void Hm(t,e.name).then(()=>{i(null),H(F(`snippets.removed`,{name:e.name}))}).catch(e=>H(U(e),`error`)),children:F(`snippets.remove`)})]},e.name))]}),r===null?(0,L.jsx)(`div`,{className:sv,children:(0,L.jsx)(R,{onClick:()=>i(`new`),children:F(`snippets.add`)})}):(0,L.jsx)(xS,{client:t,editing:r===`new`?void 0:r,onDone:()=>i(null)},r===`new`?`new`:r.name)]})}var CS=e=>e>=95?`crit`:e>=75?`warn`:`ok`,wS=e=>String(e).padStart(2,`0`);function TS(e,t){if(e==null||e<=t)return``;let n=new Date(e),r=`${wS(n.getHours())}:${wS(n.getMinutes())}`;return e-t<864e5?`→ ${r}`:`→ ${n.getMonth()+1}/${n.getDate()} ${r}`}function ES(e,t){let n=e.windows.find(e=>e.kind===`session`)??e.windows[0];return n?{label:n.label,percentText:`${n.percent}%`,resetText:TS(n.resetsAt,t),tone:CS(n.percent)}:null}var DS=1e4;function OS({client:e,inset:t=!0}){let n=_(e.conn),[r,i]=(0,h.useState)(null);(0,h.useEffect)(()=>{if(n.state!==`open`)return;let t=!0,r=()=>e.request(`usage.get`,{}).then(e=>{t&&i(e.usage)}).catch(()=>{});r();let a=jr(DS,r);return()=>{t=!1,a()}},[e,n.state]);let a=Date.now(),o=(r??[]).flatMap(e=>{let t=ES({capturedAt:e.capturedAt,windows:e.windows},a);return t?[{vendor:e.vendor,name:e.name,chip:t}]:[]});return o.length===0?null:(0,L.jsx)(`div`,{className:`${Wt} ${t?`px-2`:``}`,children:o.map(({vendor:e,name:t,chip:n})=>{let r=Math.min(100,Math.max(0,Number.parseInt(n.percentText,10)||0));return(0,L.jsxs)(R,{variant:`row`,className:Gt,title:`${t} · ${n.label} ${n.percentText} ${n.resetText}`.trim(),"aria-label":`${F(`usage.open`)}: ${t}`,onClick:()=>{Pn(),Ja(`usage`)},children:[(0,L.jsx)(`span`,{className:`truncate`,children:t}),(0,L.jsx)(`span`,{className:Jt(n.tone),style:{"--fill":`${r}%`}}),(0,L.jsxs)(`span`,{children:[n.label,` `,(0,L.jsx)(`span`,{className:Kt[n.tone],children:n.percentText})]})]},e)})})}var kS=2e3;function AS(e){let[t,n]=(0,h.useState)(null),[r,i]=(0,h.useState)(null),a=(0,h.useCallback)(t=>{n(t),Rh(e,t.available)},[e]),o=(0,h.useCallback)(()=>e.request(`voice.status`).then(a,e=>i(U(e))),[e,a]);(0,h.useEffect)(()=>void o(),[o]);let s=t?.setup?.install.phase===`running`||t?.available===!0&&!t.ready;return(0,h.useEffect)(()=>{if(!s)return;let e=window.setInterval(()=>void o(),kS);return()=>window.clearInterval(e)},[s,o]),{status:t,error:r,setError:i,accept:a}}function jS(e){let[t,n]=(0,h.useState)(!1);return t?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:ev,children:e.ask}),(0,L.jsx)(R,{variant:`action`,disabled:e.disabled,onClick:()=>{n(!1),e.onConfirm()},children:e.label}),(0,L.jsx)(R,{variant:`action`,onClick:()=>n(!1),children:F(`voice.setup.cancel`)})]}):(0,L.jsx)(R,{variant:`action`,disabled:e.disabled,onClick:()=>n(!0),children:e.label})}function MS({client:e}){let{status:t,error:n,setError:r,accept:i}=AS(e),[a,o]=(0,h.useState)(!1),s=t?.setup,[c,l]=(0,h.useState)(!1),[u,d]=(0,h.useState)(``),[f,p]=(0,h.useState)(``),[m,g]=(0,h.useState)(``);(0,h.useEffect)(()=>{s?.cloud&&(d(e=>e||s.cloud?.baseURL||``),p(e=>e||s.cloud?.model||``))},[s?.cloud]);let _=(t,n)=>(o(!0),r(null),e.request(t,n).then(i,e=>r(U(e))).finally(()=>o(!1)));if(!t)return(0,L.jsx)(`p`,{className:tv,children:n??`…`});if(!s)return(0,L.jsx)(`p`,{className:tv,children:t.model??F(`voice.setup.unavailable`)});let v=s.install,y=v.phase===`running`,b=c?`cloud`:s.backend,x=e=>{if(e===`cloud`&&!s.cloud?.hasKey)return l(!0);l(!1),_(`voice.configure`,{backend:e})},S=b===`off`?F(`voice.setup.offHint`):c?F(`voice.setup.cloudNeeded`):b===`local`&&!s.localInstalled?F(y?`voice.setup.localInstalling`:`voice.setup.localNeeded`):t.ready?F(`voice.setup.ready`,{model:t.model??``}):t.error??F(`voice.setup.starting`),C=y?v.line??F(`voice.setup.installing`):v.phase===`failed`&&!s.localInstalled?F(`voice.setup.failed`,{line:v.line??``}):s.localInstalled?F(`voice.setup.installed`):s.blocked??F(`voice.setup.localHint`);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Zv,{children:(0,L.jsx)(ty,{label:F(`voice.setup.dictation`),hint:S,value:b,picks:[`off`,`local`,`cloud`].map(e=>({value:e,label:F(`voice.setup.backend.${e}`)})),onPick:x})}),(b===`local`||s.localInstalled||y)&&(0,L.jsx)(Zv,{title:F(`voice.setup.backend.local`),children:(0,L.jsx)(Qv,{label:F(`voice.setup.localTitle`),hint:C,children:y?(0,L.jsx)(`span`,{className:`max-w-90 min-w-0 truncate font-mono text-meta text-muted [overflow-wrap:anywhere]`,children:F(`voice.setup.installing`)}):s.localInstalled?(0,L.jsx)(jS,{label:F(`voice.setup.uninstall`),ask:F(`voice.setup.uninstallAsk`),disabled:a,onConfirm:()=>void _(`voice.uninstall`)}):!s.blocked&&(0,L.jsx)(R,{variant:`action`,disabled:a,onClick:()=>void _(`voice.install`),children:F(`voice.setup.install`)})})}),(b===`cloud`||s.cloud)&&(0,L.jsx)(Zv,{title:F(`voice.setup.cloudTitle`),hint:F(`voice.setup.cloudHint`),children:(0,L.jsxs)(`form`,{className:`flex flex-col gap-3 py-3`,onSubmit:e=>{e.preventDefault(),_(`voice.configure`,{backend:`cloud`,baseURL:u,model:f,apiKey:m}).then(()=>l(!1)),g(``)},children:[(0,L.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsx)(`span`,{className:`text-meta font-medium text-muted`,children:F(`voice.setup.baseURL`)}),(0,L.jsx)(`input`,{className:`rounded-sm border-hairline border-line bg-paper px-2.5 py-1.5 font-sans text-body text-ink focus-visible:border-line-active focus-visible:outline-none font-mono`,value:u,placeholder:`https://api.openai.com/v1`,spellCheck:!1,autoComplete:`off`,onChange:e=>d(e.target.value)})]}),(0,L.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsx)(`span`,{className:`text-meta font-medium text-muted`,children:F(`voice.setup.model`)}),(0,L.jsx)(`input`,{className:`rounded-sm border-hairline border-line bg-paper px-2.5 py-1.5 font-sans text-body text-ink focus-visible:border-line-active focus-visible:outline-none font-mono`,value:f,placeholder:`gpt-4o-mini-transcribe`,spellCheck:!1,autoComplete:`off`,onChange:e=>p(e.target.value)})]}),(0,L.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsx)(`span`,{className:`text-meta font-medium text-muted`,children:F(`voice.setup.apiKey`)}),(0,L.jsx)(`input`,{className:`rounded-sm border-hairline border-line bg-paper px-2.5 py-1.5 font-sans text-body text-ink focus-visible:border-line-active focus-visible:outline-none font-mono`,type:`password`,value:m,placeholder:s.cloud?.hasKey?F(`voice.setup.keySaved`):``,autoComplete:`off`,onChange:e=>g(e.target.value)})]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2.5`,children:[s.cloud&&(0,L.jsx)(jS,{label:F(`voice.setup.forget`),ask:F(`voice.setup.forgetAsk`),disabled:a,onConfirm:()=>{d(``),p(``),_(`voice.forgetCloud`)}}),(0,L.jsx)(R,{variant:`action`,type:`submit`,disabled:a||!u.trim()||!f.trim()||!(m||s.cloud?.hasKey),children:F(s.backend===`cloud`?`voice.setup.save`:`voice.setup.saveAndUse`)})]})]})}),n&&(0,L.jsx)(`p`,{className:`m-0 py-3 text-body text-muted text-error`,children:n})]})}var NS={general:e=>(0,L.jsx)(Cx,{model:e}),appearance:e=>(0,L.jsx)(Vb,{model:e}),notifications:e=>(0,L.jsx)(dS,{model:e}),snippets:e=>(0,L.jsx)(SS,{model:e}),keys:e=>(0,L.jsx)(Vx,{model:e}),engines:e=>(0,L.jsx)(px,{client:e.client}),autoRouting:e=>(0,L.jsx)(gS,{client:e.client}),voice:e=>(0,L.jsx)(MS,{client:e.client}),connectors:e=>(0,L.jsx)(nx,{model:e}),plugins:e=>(0,L.jsx)(mS,{model:e}),about:e=>(0,L.jsx)(lb,{client:e.client}),feedback:e=>(0,L.jsx)(bx,{model:e}),dev:e=>(0,L.jsx)(ix,{client:e.client})},PS={general:`sections.general`,engines:`sections.engines`,autoRouting:`sections.autoRouting`,plugins:`sections.plugins`,keys:`sections.keys`,feedback:`sections.feedback`,dev:`sections.dev`},FS=e=>{let t=PS[e];return t?Q(t):F(`settings.sections.${e}`)};function IS(e){return(0,L.jsxs)(`nav`,{className:z_,"aria-label":F(`settings.title`),children:[(0,L.jsx)(`h1`,{className:B_,children:F(`settings.title`)}),_S.map(t=>(0,L.jsxs)(`div`,{className:V_,children:[(0,L.jsx)(`p`,{className:H_,children:F(`settings.groups.${t.id}`)}),t.sections.map(n=>(0,L.jsxs)(R,{variant:`row`,className:U_(!e.narrow&&e.current===n,t.id===`more`),"aria-current":!e.narrow&&e.current===n?`page`:void 0,onClick:()=>e.onPick(n),children:[FS(n),(0,L.jsx)(fo,{right:!0,className:W_})]},n))]},t.id))]})}function LS({model:e,section:t}){I();let[n,r]=(0,h.useState)(()=>vS(t)),i=eo(),a=()=>yS(n,i)===`list`?r({...n,drilled:!1}):Pn();(0,h.useEffect)(()=>{let e=document.querySelector(`.dialog`);e&&!e.contains(document.activeElement)&&e.focus()},[]),(0,h.useEffect)(()=>{let e=e=>{e.key!==`Escape`||e.defaultPrevented||(e.preventDefault(),a())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)});let o=!i||!n.drilled,s=!i||n.drilled;return(0,L.jsx)(`div`,{className:I_,onMouseDown:e=>e.target===e.currentTarget&&Pn(),children:(0,L.jsxs)(`dialog`,{tabIndex:-1,open:!0,className:L_,"aria-label":F(`settings.title`),onKeyDown:e=>{let t=e.target;e.key===`Escape`&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)&&(t.blur(),e.stopPropagation(),e.nativeEvent.stopImmediatePropagation())},children:[(0,L.jsx)(R,{variant:`row`,className:R_,"aria-label":F(`dialog.close`),title:F(`dialog.close`),onClick:Pn,children:`×`}),i&&n.drilled&&(0,L.jsx)(R,{variant:`row`,className:`hidden flex-none items-center px-4 py-3 pr-12 text-left font-mono text-meta font-bold text-accent w-narrow:flex touch:min-h-11`,onClick:a,children:`‹ ${F(`settings.title`)}`}),o&&(0,L.jsx)(IS,{current:n.section,narrow:i,onPick:e=>r({section:e,drilled:!0})}),i&&o&&(0,L.jsx)(OS,{client:e.client,inset:!1}),s&&(0,L.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto scrollbar-none`,children:(0,L.jsxs)(`div`,{className:`flex w-full flex-col gap-7 px-8 pt-7 pb-10 w-narrow:gap-6 w-narrow:px-4 w-narrow:pt-1 w-narrow:pb-10`,children:[(0,L.jsxs)(`header`,{className:`flex flex-col gap-1 pr-8`,children:[(0,L.jsx)(`h1`,{className:`m-0 font-sans text-display font-semibold normal-nums text-ink`,children:FS(n.section)}),(0,L.jsx)(`p`,{className:`m-0 text-body text-muted`,children:F(`settings.pages.${n.section}`)})]}),(0,L.jsx)(`div`,{className:`flex flex-col gap-7 w-narrow:gap-6`,children:NS[n.section](e)})]})},n.section)]})})}var RS=e=>{let{taskId:t}=e.selection.get();return e.tasks.get()?.tasks.find(e=>e.id===t)??null},zS=e=>{let{taskId:t,tabId:n}=e.selection.get(),r=t?e.tabs.get()[t]?.find(e=>e.id===n):void 0;return!!r&&!Iu(r.split)},BS=[{id:`app.refresh`,live:()=>G.get().stale,run:e=>Mi(e.client)},{id:`palette.open`,live:()=>!0,run:s_},{id:`task.new.global`,live:()=>!0,run:e=>Uh(RS(e)?.repo)},{id:`chat.tab.fork`,live:e=>!!RS(e),run:e=>{let t=RS(e);t&&B.set((0,L.jsx)(eu,{model:e,taskId:t.id,context:`continue`}))}},{id:`chat.fork.new`,live:e=>!!RS(e),run:e=>{let t=RS(e);t&&B.set((0,L.jsx)(eu,{model:e,taskId:t.id,destination:`fork`}))}},{id:`settings.open`,live:()=>!0,run:e=>B.set((0,L.jsx)(LS,{model:e}))},{id:`inbox.show`,live:()=>!0,run:e=>B.set((0,L.jsx)(af,{model:e}))},{id:`focus.previous`,live:()=>!0,run:()=>wa(-1)},{id:`focus.next`,live:()=>!0,run:()=>wa(1)},{id:`workspace.zenToggle`,live:e=>!!RS(e),run:()=>Sn.set(!Sn.get())},{id:`files.createPR`,live:e=>!!RS(e),run:e=>{let t=RS(e);t&&e.client.request(`tab.requestPR`,e.engineTarget(t.id)).then(()=>H(F(`files.prRequested`))).catch(e=>H(e instanceof Error?e.message:String(e),`error`))}},{id:`chat.tab.close`,live:e=>!!e.selection.get().tabId&&zS(e),run:e=>{let{taskId:t,tabId:n}=e.selection.get();!t||!n||e.closeTab(t,n).catch(e=>H(e instanceof Error?e.message:String(e),`error`))}},{id:`kanban.open`,live:e=>e.installedMods.get().has(`kanban`),run:()=>Ja(`kanban`)},{id:`automations.open`,live:()=>!0,run:()=>Ja(`routines`)},{id:`workItems.open`,live:e=>e.installedMods.get().has(`issues`),run:()=>Ja(`issues`)},{id:`task.moveMode`,live:e=>!!d_(e),run:()=>{_f(!hf.get()),document.querySelector(`.rail`)?.focus()}},{id:`files.syncBase`,live:e=>d_(e)?.kind===`task`,run:e=>{let t=d_(e);t&&qg(e,t.id)}},{id:`files.fixChecks`,live:e=>!!d_(e),run:e=>{let t=d_(e);t&&Yg(e,t.id,F(`taskops.fixSent`))}},{id:`task.openEditor`,live:e=>!!d_(e),run:e=>{let t=d_(e);t&&Xg(e,t.id)}}];Ea(()=>BS.map(e=>({id:e.id,chords:Ti(e.id),prefix:!0,live:e.live,run:e.run})));function VS(e){return Ks(e[0]??``)}function HS(e,t){let n=ja(),r=Oa().filter(t=>t.prefix&&ka(t,n)&&t.live?.(e)!==!1);for(let e of t){let t=r.filter(t=>t.chords.includes(e)).sort((e,t)=>Aa(e,n)-Aa(t,n))[0];if(t)return t}}var US=null,WS=null;function GS(){US=null,WS!==null&&window.clearTimeout(WS),WS=null;let e=ud.get();e.guide?.kind===`prefix`&&ud.set({...e,guide:null})}function KS(){if(US!==null){GS();return}B.get()||bi()===null||(US=Date.now(),ud.set({...ud.get(),guide:{kind:`prefix`,armedAt:US}}),WS!==null&&window.clearTimeout(WS),WS=window.setTimeout(GS,hi.get().prefix.timeoutMs))}function qS(e,t){GS();let n=typeof t==`string`?[t]:t,r=HS(e,n);fd(VS(n),r?.id??null),r?.run(e)}var JS=null;function YS(){JS!==null&&window.clearTimeout(JS),JS=null;let e=ud.get();e.guide?.kind===`direct`&&ud.set({...e,guide:null})}function XS(){JS!==null||B.get()||(JS=window.setTimeout(()=>{GS(),ud.set({...ud.get(),guide:{kind:`direct`}})},400))}function ZS(e){(0,h.useEffect)(()=>{let t=t=>{if(t.key===`Control`){t.repeat||XS();return}if(YS(),[`Shift`,`Alt`,`Meta`].includes(t.key))return;let n=Gs(t),{firstStrokes:r,timeoutMs:i}=hi.get().prefix;if(US!==null&&Date.now()-US<=i){if(t.preventDefault(),t.stopImmediatePropagation(),t.key===`Escape`)return GS();qS(e,n);return}GS(),!B.get()&&n.some(e=>r.includes(e))&&(t.preventDefault(),t.stopImmediatePropagation(),KS())},n=e=>e.key===`Control`&&YS(),r=e=>{US!==null&&(e.target instanceof Element&&e.target.closest(`.prefix-guide, .shortcut-badge, [data-prefix-arm]`)||GS())};return window.addEventListener(`keydown`,t,{capture:!0}),window.addEventListener(`keyup`,n,{capture:!0}),window.addEventListener(`pointerdown`,r,{capture:!0}),window.addEventListener(`blur`,YS),()=>{window.removeEventListener(`keydown`,t,{capture:!0}),window.removeEventListener(`keyup`,n,{capture:!0}),window.removeEventListener(`pointerdown`,r,{capture:!0}),window.removeEventListener(`blur`,YS),YS(),GS()}},[e])}function QS(e){let t=ja(),n=new Map;for(let r of Oa()){if(!r.prefix||!ka(r,t)||r.live?.(e)===!1)continue;let i=Aa(r,t);for(let e of r.chords){let t=n.get(e);(!t||i<t.rank)&&n.set(e,{action:r.id,rank:i})}}return[...n].map(([e,{action:t}])=>({stroke:e,action:t}))}function $S(e){let t=new Map(li.map((e,t)=>[e.id,t])),n=new Map;for(let{stroke:t,action:r}of e)n.set(r,[...n.get(r)??[],t]);let r=new Map,i=[...n].sort(([e],[n])=>(t.get(e)??2**53-1)-(t.get(n)??2**53-1));for(let[e,t]of i){let n=oc(e);r.set(n,[...r.get(n)??[],{action:e,strokes:t}])}return[...r].map(([e,t])=>({category:e,actions:t}))}var eC=e=>e===`prefix.moreCommands`?_c(`moreCommandsPrefix`):xc(e);function tC(e){let[,t]=(0,h.useState)(0);(0,h.useEffect)(()=>{if(e===null)return;let n=window.setTimeout(()=>t(e=>e+1),Math.max(30,e-Date.now()));return()=>window.clearTimeout(n)},[e])}function nC({model:e}){I();let t=_(ud);_(hi),_(e.selection);let n=Date.now(),r=t.entries.filter(e=>n-e.at<ld),i=t.guide?.kind===`prefix`?t.guide.armedAt:null,a=i!==null&&n-i<cd?i+cd:null;tC(a??(r[0]?r[0].at+ld:null));let o=t.guide?.kind===`direct`||i!==null&&a===null;if(!o&&!t.guide&&r.length===0)return null;if(o&&t.guide){let n=t.guide.kind===`direct`,r=n?od(Ma(e,ja()),bi()):QS(e);return(0,L.jsxs)(`output`,{className:`mono ${ut}`,onMouseDown:e=>e.preventDefault(),children:[(0,L.jsxs)(`div`,{className:ft,children:[(0,L.jsx)(`span`,{className:`text-accent`,children:n?_c(`directLayer`):_c(`commandLayer`,{prefix:bi()??``})}),(0,L.jsx)(`span`,{className:`keys-only text-muted`,children:_c(n?`releaseCtrl`:`escCancel`)})]}),(0,L.jsx)(`div`,{className:pt,children:$S(r).map(t=>(0,L.jsxs)(`div`,{className:mt,children:[(0,L.jsx)(`div`,{className:`text-accent`,children:Sc(t.category)}),t.actions.map(({action:t,strokes:r})=>(0,L.jsxs)(`button`,{type:`button`,className:ht,disabled:n,onClick:()=>r[0]&&qS(e,r[0]),children:[(0,L.jsx)(`span`,{className:dt,children:r.map(Ks).join(`/`)}),(0,L.jsx)(`span`,{children:eC(t)})]},t))]},t.category))})]})}return(0,L.jsxs)(`output`,{className:Ot,children:[r.map(e=>(0,L.jsxs)(rC,{at:e.at,children:[(0,L.jsx)(`span`,{className:`text-accent`,children:bi()}),` + `,e.stroke,` →`,` `,e.action?eC(e.action):(0,L.jsx)(`span`,{className:`text-muted`,children:`∅`})]},e.id)),i!==null&&(0,L.jsxs)(`div`,{className:kt(!1),children:[(0,L.jsx)(`span`,{className:`text-accent`,children:bi()}),` ⋯`]})]})}function rC({at:e,children:t}){let[n]=(0,h.useState)(Date.now),r=n-e>140,i={"--hud-out":`${e+ld-140-n}ms`};return(0,L.jsx)(`div`,{className:kt(r),style:i,children:t})}function iC({model:e,bindingId:t,head:n=!1}){let r=_(ud);_(hi);let i=x_().prefs.prefixTap;if(r.guide?.kind!==`prefix`||i!==`local`)return null;let a=ad({bindingId:t,reachability:Ma(e,ja()),prefixKey:bi()});if(!a)return null;let o=Oa().find(e=>e.id===t&&e.prefix)?.chords[0];return(0,L.jsx)(`button`,{type:`button`,className:`mono ${nt(n)}`,onMouseDown:e=>e.preventDefault(),onClick:t=>{t.stopPropagation(),o&&qS(e,o)},children:a})}var aC=[`workingBorder`,`runningTitle`,`taskColors`,`glyphSet`,`colorblind`];function oC(e){let{client:t}=e,n=x_(),r=Lb(),i=_(Sb);Rb(e),lS(e),(0,h.useEffect)(()=>{let e=()=>{y_(t).catch(()=>void 0),Bm(t).catch(()=>void 0)},n=()=>document.visibilityState===`visible`&&e(),r=t.onOpen(e);return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,n),()=>{r(),window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,n)}},[t]),(0,h.useEffect)(()=>{let e=document.documentElement,t=i?i[r]:db(n.themes,n.prefs.theme,r),a=t?yb(t,n.prefs):{};for(let[t,n]of Object.entries(a))e.style.setProperty(t,n);e.style.colorScheme=r;for(let t of aC)e.dataset[t]=String(n.prefs[t]);xb.set(t?bb(t):null);let o=document.querySelector(`meta[name="theme-color"]`);o||(o=document.createElement(`meta`),o.name=`theme-color`,document.head.append(o)),o.content=getComputedStyle(document.body).backgroundColor},[n,r,i]),(0,h.useEffect)(()=>{n.loaded&&Sn.get()!==n.prefs.zen&&Sn.set(n.prefs.zen)},[n.loaded,n.prefs.zen]),(0,h.useEffect)(()=>Sn.subscribe(()=>{Sn.get()!==g_.get().prefs.zen&&b_(t,`zen`,Sn.get())}),[t])}var sC={sidebar:[{id:`sidebar.nav`,msg:`move`},{id:`sidebar.select`,msg:`open`}],files:[{id:`files.nav`,msg:`move`},{id:`files.hierarchy`,msg:`collapse`},{id:`files.open`,msg:`open`,always:!0},{id:`files.diff`,msg:`diff`,always:!0}]};function cC(e,t){return sC[e].flatMap(e=>{if(t===`always`&&e.always!==!0)return[];let n=ec(e.id);return n?[{cap:n,msg:e.msg}]:[]})}var lC=e=>`rove.web.hintUsed.${e}`,uC=g({sidebar:localStorage.getItem(lC(`sidebar`))===`1`});function dC(e){uC.get()[e]||(localStorage.setItem(lC(e),`1`),uC.set({...uC.get(),[e]:!0}))}function fC(e,t){return e.kind===`task`&&t.kind===`task`?e.taskId===t.taskId:e.kind===`page`&&t.kind===`page`?e.id===t.id:e.kind===`new`&&t.kind===`new`}var pC={entries:[],at:-1};function mC(e,t){let n=e.entries[e.at];if(n&&fC(n,t)){let n=[...e.entries];return n[e.at]=t,{entries:n,at:e.at}}let r=[...e.entries.slice(0,e.at+1),t].slice(-50);return{entries:r,at:r.length-1}}function hC(e,t,n){for(let r=e.at+t;r>=0&&r<e.entries.length;r+=t){let t=e.entries[r];if(t&&n(t))return r}return-1}var gC=g(pC);function _C(e){let t=V.get();if(t)return{kind:`page`,id:t};let n=Tn.get();if(n)return{kind:`new`,start:n};let{taskId:r,tabId:i}=e.selection.get();return r?{kind:`task`,taskId:r,tabId:i}:null}function vC(e,t){if(t.kind!==`task`)return!0;let n=e.tasks.get()?.tasks.find(e=>e.id===t.taskId);return n!==void 0&&!n.deleting}var yC=!1;function bC(e){let t=!1,n=()=>{t||(t=!0,queueMicrotask(()=>{if(t=!1,yC)return;let n=_C(e);n&&gC.set(mC(gC.get(),n))}))};n();let r=[e.selection.subscribe(n),V.subscribe(n),Tn.subscribe(n)];return()=>{for(let e of r)e()}}function xC(e,t){let n=gC.get(),r=hC(n,t,t=>vC(e,t)),i=n.entries[r];i&&(yC=!0,i.kind===`task`?(V.set(null),Tn.set(null),e.select(i.taskId,i.tabId)):i.kind===`page`?(Tn.set(null),Ja(i.id)):(V.set(null),Tn.set(i.start)),gC.set({entries:n.entries,at:r}),queueMicrotask(()=>{yC=!1}))}var SC=e=>new Map((e?.engines??[]).flatMap(e=>e.icon?[[e.id,e.icon]]:[]));function CC(e){let[t,n]=(0,h.useState)(()=>SC(J(e,`engines.list`))),r=_(e.tasks)!==null;return(0,h.useEffect)(()=>{r&&X(e,`engines.list`).then(e=>n(SC(e))).catch(()=>{})},[e,r]),t}function wC(e,t){return e.filter(e=>e.groupId===t).sort((e,t)=>(e.createdAt??``).localeCompare(t.createdAt??``)||e.title.localeCompare(t.title))}var TC=400;function EC(e){let t=null;for(let n of e.history?.messages??[]){if(n.role!==`assistant`)continue;let e=(n.blocks??[]).flatMap(e=>e.type===`text`&&e.text?[e.text]:[]).join(`
33
+ `):[],[a]),s=(0,h.useRef)(new Set),c=(0,h.useCallback)(async e=>{let n=e===``?{}:{machine:e},r=await t.request(`github.status`,n).catch(e=>({status:null,reason:`failed`,message:U(e)}));i(t=>({...t,[e]:r}))},[t]),l=(0,h.useCallback)(()=>Promise.all([``,...o].map(c)).then(()=>{}),[c,o]);return(0,h.useEffect)(()=>{l()},[l]),(0,h.useEffect)(()=>{let e=new Set(Object.entries(r).flatMap(([e,t])=>Px(t.status)?[e]:[])),t=[...s.current].some(t=>!e.has(t));if(s.current=e,t&&l(),e.size===0)return;let n=window.setTimeout(()=>{for(let t of e)c(t)},Nx);return()=>window.clearTimeout(n)},[r,c,l]),{machines:n,probes:r,refresh:l,probe:c,act:(0,h.useCallback)(async(e,n)=>{try{let r=await t.request(e,n);return r.ok||H(r.message,`error`),r}catch(e){return H(U(e),`error`),null}},[t])}}var Ix={same:`markSame`,different:`markDifferent`,signedOut:`markSignedOut`,noGh:`markNoGh`,outdated:`markOutdated`,offline:`markOffline`,denied:`markDenied`,failed:`markFailed`},Lx=(e,t)=>F(`settings.connectors.${e}`,t),Rx={same:`text-diff-added`,signedOut:`text-diff-removed`,failed:`text-diff-removed`,denied:`text-diff-removed`,different:`text-warning`,outdated:`text-warning`,offline:`text-muted`,noGh:`text-muted`,loading:`text-muted`};function zx(e,t){return e===`loading`?Lx(`loading`):Lx(Ix[e],{login:t?.account??``})}function Bx(e){if(!e?.gh)return``;let t=e.ssh.ok?`✓ ${e.ssh.user??``}`.trim():`✗`;return Lx(`detail`,{protocol:e.protocol??`—`,ssh:t})}function Vx(){return(0,L.jsx)(`svg`,{className:`flex-none`,viewBox:`0 0 16 16`,width:`22`,height:`22`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{fill:`currentColor`,d:`M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z`})})}function Hx(e){navigator.clipboard.writeText(e).then(()=>H(Lx(`codeCopied`)),()=>{})}function Ux({login:e,onCancel:t}){return e.state===`failed`?(0,L.jsxs)(`div`,{className:dv,children:[(0,L.jsx)(`span`,{className:`text-muted`,children:Lx(`loginFailed`,{error:e.error??``})}),(0,L.jsx)(R,{className:`ml-auto`,onClick:t,children:Lx(`dismiss`)})]}):e.state===`syncing`?(0,L.jsx)(`div`,{className:dv,children:(0,L.jsx)(`span`,{className:`text-muted`,children:Lx(`syncing`)})}):(0,L.jsxs)(`div`,{className:dv,children:[e.code?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`button`,{type:`button`,className:`font-mono font-normal normal-nums rounded-sm border-hairline border-dashed border-line px-2 py-0.5 text-display tracking-code`,title:Lx(`codeHint`),onClick:()=>Hx(e.code??``),children:e.code}),(0,L.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,children:Lx(`openGithub`)})]}):(0,L.jsx)(`span`,{className:`text-muted`,children:Lx(`loading`)}),(0,L.jsx)(R,{className:`ml-auto`,onClick:t,children:F(`dialog.cancel`)})]})}function Wx(e){let t=Mx(e.probe,e.machine,e.rove),n=e.probe?.status??null,r=Px(n),i=t===`different`||t===`signedOut`,a=n?.login;return(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{className:Fv,children:[(0,L.jsxs)(`div`,{className:Iv,children:[(0,L.jsx)(`span`,{className:tv,children:e.name}),(0,L.jsx)(`span`,{className:Lv(),title:[n?.authDetail,n?.ssh.detail].filter(Boolean).join(`, `)||void 0,children:Bx(n)})]}),(0,L.jsx)(`span`,{className:`whitespace-nowrap text-meta ${Rx[t]}`,title:e.probe?.message,children:zx(t,n)}),e.onSync&&i&&e.rove&&!r&&(0,L.jsx)(R,{variant:`action`,disabled:e.busy,onClick:e.onSync,children:Lx(`useRove`)}),e.onLogin&&i&&!r&&(0,L.jsx)(R,{variant:`action`,disabled:e.busy,onClick:e.onLogin,children:Lx(`loginThere`)})]}),a&&(0,L.jsx)(`div`,{className:`pb-3`,children:(0,L.jsx)(Ux,{login:a,onCancel:e.onCancel})})]})}function Gx({model:e}){let{machines:t,probes:n,refresh:r,probe:i,act:a}=Fx(e),[o,s]=(0,h.useState)(null),[c,l]=(0,h.useState)(!1),u=n[``],d=u?.status?.account??null,f=Px(u?.status),p=async(e,t)=>{s(e);try{await t()}finally{s(null)}},m=e=>p(e,async()=>{await a(`github.login`,e===``?{}:{machine:e}),await i(e)}),g=e=>p(e,async()=>{await a(`github.login`,e===``?{cancel:!0}:{machine:e,cancel:!0}),await i(e)}),_=e=>p(e,async()=>{(await a(`github.sync`,{machine:e}))?.ok&&H(Lx(`synced`,{machine:e,login:d??``})),await i(e)}),v=()=>p(``,async()=>{(await a(`github.logout`,{}))?.ok&&l(!1),await r()});return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(ey,{children:(0,L.jsxs)(`div`,{children:[(0,L.jsx)(ty,{label:(0,L.jsxs)(`span`,{className:`flex items-center gap-2.5`,children:[(0,L.jsx)(Vx,{}),`GitHub`]}),hint:Lx(`githubDescription`),children:d?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`span`,{className:rv,children:[`@`,d]}),(0,L.jsx)(R,{variant:`action`,disabled:o!==null,onClick:()=>l(!0),children:Lx(`disconnect`)})]}):!f&&(0,L.jsx)(R,{variant:`filled`,disabled:o!==null||!u,onClick:()=>void m(``),children:Lx(`connect`)})}),c&&(0,L.jsx)(`div`,{className:`pb-3`,children:(0,L.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-line bg-inset px-3 py-2.5 [&_p]:m-0 [&_p]:text-meta [&_p]:text-muted`,children:[(0,L.jsx)(`p`,{children:Lx(`disconnectBody`)}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2.5`,children:[(0,L.jsx)(R,{onClick:()=>l(!1),children:F(`dialog.cancel`)}),(0,L.jsx)(R,{variant:`danger`,disabled:o!==null,onClick:()=>void v(),children:Lx(`disconnect`)})]})]})}),!d&&u?.status?.login&&(0,L.jsx)(`div`,{className:`pb-3`,children:(0,L.jsx)(Ux,{login:u.status.login,onCancel:()=>void g(``)})})]})}),d&&(0,L.jsxs)(ey,{title:Lx(`machines`),children:[(0,L.jsx)(Wx,{name:Lx(`thisMachine`),probe:u,machine:null,rove:d,busy:o!==null,onCancel:()=>void g(``)}),t.map(e=>(0,L.jsx)(Wx,{name:e.alias,probe:n[e.alias],machine:e.state,rove:d,busy:o!==null,onSync:()=>void _(e.alias),onLogin:()=>void m(e.alias),onCancel:()=>void g(e.alias)},e.alias)),(0,L.jsx)(`div`,{className:`py-2.5`,children:(0,L.jsx)(R,{onClick:()=>void r(),children:Lx(`refresh`)})})]})]})}function Kx({model:e}){return(0,L.jsx)(Gx,{model:e})}var qx=[{key:`remoteProjects`,label:`dev.remote`,hint:`dev.remoteHint`},{key:`autoStatus`,label:`dev.autoStatus`,hint:`dev.autoStatusHint`},{key:`dispatcher`,label:`dev.dispatcher`,hint:`dev.dispatcherHint`}];function Jx({client:e}){let{prefs:t}=x_(),[n,r]=(0,h.useState)(null),[i,a]=(0,h.useState)(!1),o=async()=>{if(n){a(!0);try{if(n===`reset`){await e.request(`dev.reset`),localStorage.removeItem(`rove.prefs`),window.location.reload();return}await e.request(`daemon.restart`),H(Q(`restart.done`)),r(null)}catch(e){H(U(e),`error`)}finally{a(!1)}}},s=(e,t,a,s,c)=>(0,L.jsxs)(`div`,{children:[(0,L.jsx)(ty,{label:t,hint:a,children:(0,L.jsx)(R,{variant:`action`,onClick:()=>r(e),children:s})}),n===e&&(0,L.jsx)(`div`,{className:`pb-3`,children:(0,L.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-line bg-inset px-3 py-2.5 [&_p]:m-0 [&_p]:text-meta [&_p]:text-muted`,children:[(0,L.jsx)(`strong`,{children:Q(`${e}.title`)}),(0,L.jsx)(`p`,{children:F(e===`reset`?`prefs.resetBody`:`prefs.restartBody`)}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2.5`,children:[(0,L.jsx)(R,{onClick:()=>r(null),children:F(`dialog.cancel`)}),(0,L.jsx)(R,{variant:c?`danger`:`filled`,disabled:i,onClick:()=>void o(),children:s})]})]})})]});return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(ey,{title:Q(`dev.experimental`),children:qx.map(n=>(0,L.jsx)(ny,{label:Q(n.label),hint:Q(n.hint),checked:t[n.key],onChange:t=>void b_(e,n.key,t)},n.key))}),(0,L.jsxs)(ey,{hint:Q(`dev.doctorHint`),children:[s(`restart`,Q(`dev.restart`),F(`prefs.restartHint`),F(`prefs.restartButton`),!1),s(`reset`,Q(`dev.reset`),F(`prefs.resetHint`),F(`prefs.resetButton`),!0)]})]})}function Yx(e){return e.binaryFound===void 0?{key:`settings.engines.status.checking`,tone:`unknown`}:e.binaryFound===null?{key:`settings.engines.status.unknown`,tone:`unknown`}:e.binaryFound?e.configIssue?{key:`settings.engines.status.integrationBlocked`,tone:`error`}:e.login===`no`?{key:`settings.engines.status.signIn`,tone:`attention`}:e.hooks===`outdated`?{key:`settings.engines.status.integrationOutdated`,tone:`attention`}:e.hooks===`not-installed`?{key:`settings.engines.status.integrationMissing`,tone:`attention`}:{key:`settings.engines.status.ready`,tone:`ready`}:e.commandChosen?{key:`settings.engines.status.notOnPath`,tone:`attention`}:{key:`settings.engines.status.notInstalled`,tone:`absent`}}var Xx=g([]),Zx=3e4;function Qx(e){return e.request(`skill.missing`).then(e=>Xx.set(e.engines),()=>{})}function $x(e){(0,h.useEffect)(()=>{let t=e.onOpen(()=>void Qx(e)),n=jr(Zx,()=>void Qx(e));return()=>{t(),n()}},[e])}function eS(e){return e.request(`skill.install`).then(e=>{e.error&&H(Q(`engines.skill.failed`,{reason:e.error}),`error`)}).catch(e=>H(U(e),`error`)).then(()=>Qx(e))}function tS(e){return Yx({binaryFound:e.binaryFound,login:e.login,hooks:e.hooks,configIssue:e.configIssue,commandChosen:e.custom||e.customized})}var nS={ready:`ready`,attention:`attention`,error:`error`,absent:`absent`,unknown:`absent`};function rS({client:e}){let[t,n]=(0,h.useState)(()=>J(e,`engines.settings`)?.engines??null),[r,i]=(0,h.useState)(null),a=(0,h.useCallback)(()=>X(e,`engines.settings`).then(e=>n(e.engines),e=>H(U(e),`error`)),[e]);(0,h.useEffect)(()=>{a()},[a]);let o=(t,n={})=>void e.request(t,n).then(a).catch(e=>H(U(e),`error`));return t?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`section`,{children:[(0,L.jsx)(`p`,{className:Y_,children:Q(`engines.hint`)}),(0,L.jsxs)(`div`,{className:pv,children:[(0,L.jsxs)(`div`,{className:mv,"aria-hidden":`true`,children:[(0,L.jsx)(`span`,{}),(0,L.jsx)(`span`,{children:Q(`engines.defaultMark`)}),(0,L.jsx)(`span`,{children:Q(`engines.available`)})]}),t.map(e=>(0,L.jsx)(iS,{engine:e,open:r===e.id,onToggleOpen:()=>i(r===e.id?null:e.id),run:o},e.id))]})]}),(0,L.jsx)(sS,{engines:t,run:o}),(0,L.jsx)(cS,{engines:t,client:e,reload:a})]}):(0,L.jsx)(`p`,{className:iv,children:F(`preview.loading`)})}function iS(e){let{engine:t,run:n}=e,r=(0,h.useId)(),i=tS(t);return(0,L.jsxs)(`div`,{className:hv,children:[(0,L.jsxs)(`div`,{className:gv,children:[(0,L.jsxs)(`button`,{type:`button`,className:_v,"aria-expanded":e.open,"aria-controls":r,onClick:e.onToggleOpen,children:[(0,L.jsx)(fo,{right:!e.open,className:vv(e.open)}),(0,L.jsxs)(`span`,{className:yv,children:[(0,L.jsxs)(`span`,{className:bv(!t.enabled),children:[t.name,t.renamedFrom?(0,L.jsx)(`span`,{className:xv,children:t.renamedFrom}):null,t.custom&&!t.renamedFrom?(0,L.jsx)(`span`,{className:xv,children:Q(`engines.customTag`)}):null]}),(0,L.jsxs)(`span`,{className:Cv(nS[i.tone]),children:[(0,L.jsx)(`span`,{className:wv(nS[i.tone]),"aria-hidden":`true`}),Q(i.key.slice(9))]})]})]}),(0,L.jsx)(`div`,{className:Tv,children:t.isDefault?(0,L.jsx)(`span`,{className:Ev,children:Q(`engines.defaultMark`)}):t.canBeDefault?(0,L.jsx)(`button`,{type:`button`,className:Dv,"aria-label":F(`settings.engines.default`,{name:t.name}),onClick:()=>n(`engine.setDefault`,{id:t.id}),children:Q(`engines.makeDefault`)}):null}),(0,L.jsx)($v,{on:t.enabled,"aria-label":F(`settings.engines.enabled`,{name:t.name}),onClick:()=>n(`engine.setEnabled`,{id:t.id,enabled:!t.enabled})})]}),e.open?(0,L.jsx)(oS,{id:r,engine:t,run:n}):null]})}function aS(e){if(e.configIssue)return Q(`engines.detail.hooksBlockedHere`,{reason:e.configIssue});switch(e.hooks){case`installed`:return Q(`engines.detail.hooksInstalled`);case`outdated`:return Q(`engines.detail.hooksOutdated`);case`not-installed`:return e.binaryFound===!1?Q(`engines.detail.hooksAwaitEngine`):Q(`engines.detail.hooksMissing`);default:return Q(`engines.detail.hooksUnsupported`)}}function oS(e){let{engine:t,run:n}=e,[r,i]=(0,h.useState)(null),a=t.binaryFound===!0?Q(`engines.detail.programFound`,{binary:t.binary,path:t.binaryPath??t.binary}):t.binaryFound===!1?Q(`engines.detail.programMissing`,{binary:t.binary}):Q(`engines.detail.programUnknown`,{binary:t.binary}),o=t.login===`yes`?Q(`engines.detail.signedIn`):t.login===`no`?Q(`engines.detail.signedOut`):Q(`engines.detail.signInUnknown`),s=[aS(t),Q(t.markers?`engines.detail.markersYes`:`engines.detail.markersNo`),Q(t.screen?`engines.detail.screenYes`:t.hooks===`installed`?`engines.detail.screenNotNeeded`:`engines.detail.screenNo`)];return(0,L.jsxs)(`div`,{id:e.id,className:Ov,children:[(0,L.jsxs)(`dl`,{className:kv,children:[(0,L.jsx)(`dt`,{className:Av,children:Q(`engines.detail.program`)}),(0,L.jsx)(`dd`,{className:jv(t.binaryFound===!1),children:a}),(0,L.jsx)(`dt`,{className:Av,children:Q(`engines.detail.signIn`)}),(0,L.jsx)(`dd`,{className:jv(t.login===`no`),children:o}),(0,L.jsx)(`dt`,{className:Av,children:Q(`engines.detail.reporting`)}),(0,L.jsx)(`dd`,{className:jv(!1),children:s.map(e=>(0,L.jsx)(`span`,{className:`block`,children:e},e))}),t.skill===`unsupported`?null:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`dt`,{className:Av,children:Q(`engines.detail.skill`)}),(0,L.jsx)(`dd`,{className:jv(t.skill!==`installed`),children:Q(t.skill===`installed`?`engines.detail.skillInstalledHere`:t.skill===`outdated`?`engines.detail.skillOutdated`:`engines.detail.skillMissing`)})]}),t.custom?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`dt`,{className:Av,children:Q(`engines.detail.adapter`)}),(0,L.jsx)(`dd`,{className:jv(!1),children:t.protocol?Q(`engines.detail.adapterDeclared`,{protocol:t.protocol}):Q(`engines.detail.adapterGeneric`)})]}):null]}),r===null?(0,L.jsxs)(`div`,{className:Mv,children:[(0,L.jsx)(R,{variant:`action`,onClick:()=>i(t.name),children:F(`settings.engines.rename`)}),t.custom||t.customized?(0,L.jsx)(R,{variant:`action`,onClick:()=>n(`engine.reset`,{id:t.id}),children:t.custom?F(`settings.engines.remove`):F(`settings.engines.reset`)}):null]}):(0,L.jsxs)(`form`,{className:Mv,onSubmit:e=>{e.preventDefault(),n(`engine.rename`,{id:t.id,name:r}),i(null)},children:[(0,L.jsx)(`input`,{className:`${cn} w-full ${Nv}`,autoFocus:!0,value:r,"aria-label":F(`settings.engines.rename`),placeholder:F(`settings.engines.namePlaceholder`),onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),i(null))}}),(0,L.jsx)(R,{variant:`filled`,type:`submit`,children:F(`settings.engines.save`)}),(0,L.jsx)(R,{variant:`action`,onClick:()=>i(null),children:F(`settings.engines.cancel`)})]})]})}function sS({engines:e,run:t}){let n=e.filter(e=>e.hooks!==`unsupported`),r=n.filter(e=>e.binaryFound!==!1),i=r.filter(e=>e.hooks===`installed`).length,a=r.length-i,o=n.filter(e=>e.hooks!==`not-installed`).length;return n.length===0?null:(0,L.jsx)(ey,{title:Q(`engines.integrations.title`),hint:Q(`engines.integrations.hint`),children:(0,L.jsx)(ty,{label:Q(`engines.integrations.summary`,{installed:i,total:r.length}),children:(0,L.jsxs)(`div`,{className:uv,children:[a>0?(0,L.jsx)(R,{variant:`filled`,onClick:()=>t(`engines.hooks.install`),children:Q(`engines.integrations.install`,{count:a})}):(0,L.jsx)(`span`,{className:Pv,children:Q(`engines.integrations.upToDate`)}),o>0?(0,L.jsx)(R,{variant:`action`,onClick:()=>t(`engines.hooks.uninstall`),children:Q(`engines.integrations.remove`,{count:o})}):null]})})})}function cS(e){let t=e.engines.filter(e=>e.skill!==`unsupported`),n=t.filter(e=>e.skill===`installed`).length,r=t.length-n;return(0,L.jsx)(ey,{title:Q(`engines.skill.title`),hint:Q(`engines.skill.hint`),children:(0,L.jsx)(ty,{label:t.length>0?Q(`engines.integrations.summary`,{installed:n,total:t.length}):Q(`engines.skill.noEngines`),children:r>0?(0,L.jsx)(R,{variant:`filled`,onClick:()=>void eS(e.client).then(e.reload),children:Q(`engines.skill.install`,{count:r})}):t.length>0?(0,L.jsx)(`span`,{className:Pv,children:Q(`engines.integrations.upToDate`)}):null})})}var lS={bug:`settings.feedback.kindBug`,idea:`settings.feedback.kindIdea`,question:`settings.feedback.kindQuestion`};function uS({model:e}){let[t,n]=(0,h.useState)(`bug`),[r,i]=(0,h.useState)(``),[a,o]=(0,h.useState)(``),[s,c]=(0,h.useState)(!1),[l,u]=(0,h.useState)(null),[d,f]=(0,h.useState)(!1);return(0,L.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:n=>{n.preventDefault(),!(!r.trim()||!a.trim())&&(c(!0),u(null),e.client.request(`feedback.send`,{title:r.trim(),body:a,kind:t}).then(e=>{u(e),e.filed&&(i(``),o(``))}).catch(e=>H(U(e),`error`)).finally(()=>c(!1)))},children:[(0,L.jsx)(`p`,{className:`m-0 ${nv}`,children:F(`settings.feedback.hint`)}),(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,L.jsx)(`div`,{className:uv,children:(0,L.jsx)(R,{variant:`action`,type:`button`,onClick:()=>{f(!1),Fg(e).catch(()=>f(!0))},children:F(`settings.feedback.report`)})}),(0,L.jsx)(`p`,{className:`m-0 ${nv}`,children:F(d?`settings.feedback.reportFailed`:`settings.feedback.reportNote`)})]}),(0,L.jsxs)(`label`,{className:sv,children:[(0,L.jsx)(`span`,{className:cv,children:F(`settings.feedback.kindLabel`)}),(0,L.jsx)(`select`,{className:`${av} w-full`,value:t,onChange:e=>n(e.target.value),children:Object.keys(lS).map(e=>(0,L.jsx)(`option`,{value:e,children:F(lS[e])},e))})]}),(0,L.jsxs)(`label`,{className:sv,children:[(0,L.jsx)(`span`,{className:cv,children:F(`settings.feedback.titleLabel`)}),(0,L.jsx)(`input`,{className:`${av} w-full`,value:r,onChange:e=>i(e.target.value)})]}),(0,L.jsxs)(`label`,{className:sv,children:[(0,L.jsx)(`span`,{className:cv,children:F(`settings.feedback.body`)}),(0,L.jsx)(`textarea`,{className:`${av} ${lv} w-full`,rows:6,value:a,onChange:e=>o(e.target.value)})]}),l&&(0,L.jsxs)(`p`,{className:`m-0 text-meta text-muted [&_a]:text-accent break-words`,children:[l.filed?F(`settings.feedback.sent`,{number:l.number??0}):F(`settings.feedback.notFiled`,{hint:l.hint??``}),` `,(0,L.jsx)(`a`,{className:`underline`,href:l.url,target:`_blank`,rel:`noreferrer`,children:l.filed?l.url:F(`settings.feedback.openLink`)})]}),(0,L.jsx)(`div`,{className:uv,children:(0,L.jsx)(R,{variant:`filled`,type:`submit`,disabled:s||!r.trim()||!a.trim(),children:F(`settings.feedback.send`)})})]})}var dS=[{value:`en`,label:`English`},{value:`zh`,label:`中文`}],fS={default:`general.worktreeKindDefault`,nextToProject:`general.worktreeKindNext`,custom:`general.worktreeKindCustom`};function pS({model:e}){let{client:t}=e,n=x_(),{prefs:r,info:i}=n,a=(e,n)=>void b_(t,e,n),o=[`default`,`nextToProject`];(i.worktreeCustomPath||r.worktreeBase===`custom`)&&o.push(`custom`);let s=o.map(e=>({value:e,label:Q(fS[e])}));return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(ey,{title:F(`settings.general.groupInterface`),children:[(0,L.jsx)(iy,{label:Q(`general.language`),hint:F(`prefs.languageHint`),value:r.locale,picks:dS,onPick:e=>a(`locale`,e)}),(0,L.jsx)(ny,{label:Q(`general.keyHintsShow`),hint:Q(`general.keyHintsHint`),checked:r.keyHints,onChange:e=>a(`keyHints`,e)}),(0,L.jsx)(ny,{label:Q(`general.zenDefaultOn`),hint:F(`prefs.zenHint`),checked:r.zen,onChange:e=>a(`zen`,e)}),(0,L.jsx)(iy,{label:F(`settings.general.tabStrip`),value:r.tabStrip,picks:S_(n,`tabStrip`).map(e=>({value:e,label:Q(`general.tabStripMode.${e}`)})),onPick:e=>a(`tabStrip`,e)})]}),(0,L.jsxs)(ey,{title:F(`settings.general.groupFiles`),children:[(0,L.jsx)(iy,{label:Q(`general.editor`),hint:F(`settings.general.editorNote`),value:r.editorKind,picks:S_(n,`editorKind`).map(e=>({value:e,label:e})),onPick:e=>a(`editorKind`,e)}),(0,L.jsx)(iy,{label:Q(`general.worktree`),hint:Q(`general.worktreeHint`),value:r.worktreeBase,picks:s,onPick:e=>a(`worktreeBase`,e)})]}),(0,L.jsx)(ey,{title:F(`settings.general.groupTerminal`),hint:Q(`general.terminalHint`),children:(0,L.jsx)(mS,{client:t})})]})}function mS({client:e}){let t=x_(),n=t.options.scrollbackRows,r=n&&`min`in n?n:{min:100,max:1e5},[i,a]=(0,h.useState)(String(t.prefs.scrollbackRows));return(0,h.useEffect)(()=>a(String(t.prefs.scrollbackRows)),[t.prefs.scrollbackRows]),(0,L.jsx)(ty,{label:F(`settings.general.scrollback`),hint:Q(`general.scrollbackRowHint`),children:(0,L.jsx)(`input`,{className:ov,inputMode:`numeric`,value:i,"aria-label":Q(`general.scrollbackTitle`),onChange:e=>a(e.target.value),onBlur:()=>{let n=Number(i);if(i.trim()===``||!Number.isInteger(n)){a(String(t.prefs.scrollbackRows));return}let o=Math.min(r.max,Math.max(r.min,n));o===t.prefs.scrollbackRows?a(String(o)):b_(e,`scrollbackRows`,o)},onKeyDown:e=>e.key===`Enter`&&e.currentTarget.blur()})})}var hS=`prefix.key`;function gS(e,t,n){let r=t.find(e=>e===`enter`||e.endsWith(`+enter`))??t[0];if(r===void 0)return{kind:`more`,recording:e};if(t.includes(`escape`))return{kind:`cancel`};if(e.prefixArmed)return{kind:`done`,mode:`prefix`,keys:[r]};if(e.got.length===0&&n.some(e=>t.includes(e)))return{kind:`more`,recording:{...e,prefixArmed:!0}};let i=[...e.got,r];return i.length<e.slots?{kind:`more`,recording:{...e,got:i}}:{kind:`done`,mode:`direct`,keys:i}}function _S(){return Qs(Js().filter(e=>e.keys.length>0||e.prefixKeys!==void 0)).flatMap(e=>[...e.rows])}[...Array.from({length:12},(e,t)=>`f${t+1}`)];function vS(e,t){let n=`alternating [${e}, ${t}] pairs`;return{layout:n,slots:[e,t],validateCount:e=>e>=2&&e%2==0?null:`needs ${n} (an even number of chords — got ${e})`}}var yS={"sidebar.goto":vS(`top (double-tap)`,`bottom`),"sidebar.nav":vS(`down`,`up`),"files.nav":vS(`down`,`up`),"diff.review.cursor":vS(`down`,`up`),"sidebar.search.nav":vS(`down`,`up`),"files.hierarchy":vS(`collapse`,`expand`),"files.tab":vS(`previous tab`,`next tab`),"app.quit":{layout:`[quit confirm, hard exit] (second chord optional)`,validateCount:e=>e<=2?null:`needs [quit confirm, hard exit] (1 or 2 chords — got ${e})`}};function bS(e){return yS[e]?.slots??[]}var xS=`group/cap relative inline-flex flex-none items-stretch rounded-sm border-hairline bg-surface font-mono text-meta has-[:focus-visible]:outline-1 has-[:focus-visible]:outline-offset-1 has-[:focus-visible]:outline-focus`,SS={idle:`border-line text-ink hover:border-line-active`,changed:`border-line text-accent hover:border-line-active`,empty:`border-dashed border-line text-subtle hover:border-line-active`,active:`border-accent text-accent`},CS=`absolute -top-1.5 -right-1.5 flex size-4 cursor-pointer items-center justify-center rounded-full border-hairline border-line bg-paper p-0 leading-none text-subtle hover:border-line-active hover:text-error focus-visible:opacity-100 group-hover/cap:opacity-100 touch:size-5 touch:opacity-100 touch:after:absolute touch:after:-inset-2.5 touch:after:content-['']`;function wS(e){return(0,L.jsxs)(`span`,{className:Re(xS,SS[e.tone??`idle`]),children:[(0,L.jsx)(`button`,{type:`button`,"aria-label":e.label,className:`px-2 py-1 touch:min-h-10`,onClick:e.onPress,children:e.children}),e.onRemove&&(0,L.jsx)(`button`,{type:`button`,"aria-label":e.removeLabel,className:Re(CS,!e.removeShown&&`opacity-0`),onClick:e.onRemove,children:`×`})]})}var TS=Qs(_S());function ES(e){let[t,n]=(0,h.useState)(null),[r,i]=(0,h.useState)(null),a=(0,h.useRef)(t);a.current=t;let o=async(t,n)=>{try{let r=await e.request(`keybindings.set`,{id:t,...n});i({id:t,lines:r.lines}),await vi(e)}catch(e){H(U(e),`error`)}},s=(0,h.useRef)(o);s.current=o;let c=t!==null;return(0,h.useEffect)(()=>{if(!c)return;let e=e=>{e.preventDefault(),e.stopImmediatePropagation();let t=a.current;if(!t||[`Control`,`Shift`,`Alt`,`Meta`].includes(e.key))return;let r=t.id===`prefix.key`?[]:hi.get().prefix.firstStrokes,i=gS(t,Gs(e),r);if(i.kind===`more`)return n(i.recording);n(null),i.kind===`done`&&s.current(t.id,{[i.mode]:i.keys})};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},[c]),{recording:t,notice:r,record:e=>{i(null),n({id:e,slots:Math.max(1,bS(e).length),got:[],prefixArmed:!1})},save:(e,t)=>void o(e,t)}}function DS(e,t){if(e.prefixArmed)return Q(`keybindings.recordingPrefix`,{prefix:t});let n=bS(e.id)[e.got.length];return n?Q(`keybindings.recordingSlot`,{slot:n}):Q(`keybindings.recording`)}function OS(e){let{editor:t,id:n}=e,r=()=>t.record(n),i=F(`keys.recordFor`,{name:e.name});if(t.recording?.id===n)return(0,L.jsx)(wS,{tone:`active`,label:i,onPress:r,children:DS(t.recording,e.prefixName)});let a=e.changed?`changed`:`idle`,o=t.notice?.id===n,s=e.prefix??[];return e.direct.length===0&&s.length===0?(0,L.jsx)(wS,{tone:`empty`,label:i,onPress:r,children:Q(`keybindings.unbound`)}):(0,L.jsxs)(L.Fragment,{children:[e.direct.length>0&&(0,L.jsx)(wS,{tone:a,label:i,onPress:r,onRemove:()=>t.save(n,{direct:[]}),removeLabel:F(`keys.removeFor`,{name:e.name}),removeShown:o,children:e.direct.join(` / `)}),s.length>0&&(0,L.jsx)(wS,{tone:a,label:i,onPress:r,onRemove:()=>t.save(n,{prefix:[]}),removeLabel:F(`keys.removeFor`,{name:e.name}),removeShown:o,children:s.map(t=>`${e.prefixName} ${t}`).join(` / `)})]})}function kS(e,t,n,r){let i=e.notice?.id===t?e.notice.lines:[];return i.length>0?(0,L.jsx)(`span`,{className:`text-warning`,children:i.join(` `)}):n===null?r:(0,L.jsxs)(`span`,{className:`inline-flex flex-wrap items-baseline gap-x-2`,children:[Q(`keybindings.defaultKeys`,{keys:n}),(0,L.jsx)(R,{hit:`tight`,onClick:()=>e.save(t,{direct:`default`,prefix:`default`}),children:F(`keys.reset`)})]})}function AS({editor:e,keys:t}){let n=t.prefix.key??Q(`keybindings.prefixDisabled`),r=(e,t=[])=>[...e,...t.map(e=>`${n} ${e}`)].join(` / `);return(0,L.jsx)(L.Fragment,{children:TS.map(i=>(0,L.jsx)(ey,{title:Sc(i.category),children:i.rows.map(i=>{let a=t.rows.find(e=>e.id===i.id),o=bc(i.id);return(0,L.jsx)(ty,{label:o,hint:kS(e,i.id,a?r(i.keys,i.prefixKeys):null),children:(0,L.jsx)(OS,{editor:e,id:i.id,name:o,direct:a?.keys??i.keys,prefix:a?a.prefixKeys:i.prefixKeys,prefixName:n,changed:a!==void 0})},i.id)})},i.category))})}function jS({model:e}){let{client:t}=e,{prefs:n}=x_(),r=_(hi),[i,a]=(0,h.useState)(!1);(0,h.useEffect)(()=>void vi(t),[t]);let o=r.prefix.key??Q(`keybindings.prefixDisabled`),s=ES(t),c=mi.prefix.firstStrokes,l=r.prefix.firstStrokes.join()!==c.join();return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(ey,{children:[(0,L.jsx)(iy,{label:Q(`keybindings.tapPresentation`),hint:Q(`keybindings.tapPresentationHint`),value:n.prefixTap,picks:[{value:`local`,label:Q(`keybindings.tapPresentationLocal`)},{value:`guide`,label:Q(`keybindings.tapPresentationGuide`)}],onPick:e=>void b_(t,`prefixTap`,e)}),(0,L.jsx)(ty,{label:Q(`keybindings.prefixTitle`,{prefix:o}),hint:kS(s,hS,l?c.join(` / `):null,Q(`keybindings.prefixHint`,{prefix:o,timeout:r.prefix.timeoutMs})),children:(0,L.jsx)(OS,{editor:s,id:hS,name:Q(`keybindings.prefixKey`),direct:r.prefix.firstStrokes,prefixName:o,changed:l})})]}),(0,L.jsxs)(ey,{title:Q(`keybindings.configFile`),hint:`${F(`keys.editHint`)} ${F(`prefs.keysYaml`)}`,children:[(0,L.jsx)(ty,{label:(0,L.jsx)(`span`,{className:`font-mono break-all`,children:r.path+(r.exists?``:Q(`keybindings.notCreated`))})}),(0,L.jsx)(ty,{label:F(`keys.agent`),hint:F(i?`keys.agentFailed`:`keys.agentHint`),children:(0,L.jsx)(R,{variant:`action`,onClick:()=>{a(!1),Pg(e,F(`keys.agentPrompt`,{path:r.path})).catch(()=>a(!0))},children:F(`keys.agent`)})})]}),r.warnings.length>0&&(0,L.jsx)(ey,{title:Q(`keybindings.warnings`),children:r.warnings.map(e=>(0,L.jsx)(ty,{label:(0,L.jsx)(`span`,{className:`text-warning`,children:e})},e))}),(0,L.jsx)(AS,{editor:s,keys:r}),r.plugins.length>0&&(0,L.jsx)(ey,{title:F(`keys.pluginChords`),children:r.plugins.map(e=>(0,L.jsx)(ty,{label:(0,L.jsx)(`span`,{className:`font-mono`,children:e.chord}),hint:(0,L.jsx)(`span`,{className:`font-mono`,children:`${e.kind}:${e.target}`})},e.chord))})]})}var MS=`/assets/pulse-3XJkP4CJ.wav`;function NS(e,t){return e===`error`||t}function PS(e,t){return t||e.kind!==`done`||e.turnEnd!==!0}function FS(e,t){return t&&e.silent!==!0}function IS(e){return e===`permission_needed`?`needs_input`:e===`error`||e===`rate_limited`||e===`dead`?`error`:e===`turn_complete`?`done`:null}function LS(e,t,n,r){if(e===null)return[];let i=[];for(let[a,o]of t){if(a===n||e.get(a)===o)continue;let t=r(o);t&&i.push({key:a,kind:t})}return i}function RS(){return window.isSecureContext&&`serviceWorker`in navigator&&`PushManager`in window&&`Notification`in window}var zS=()=>navigator.serviceWorker.register(`sw.js`);async function BS(e){if(!RS())return`unsupported`;if(Notification.permission===`denied`)return`blocked`;let t=await(await navigator.serviceWorker.getRegistration())?.pushManager.getSubscription();if(!t)return`off`;let{subscribed:n}=await e.request(`push.status`,{endpoint:t.endpoint});return n?`on`:`off`}async function VS(e){if(!RS())return`unsupported`;if(await Notification.requestPermission()!==`granted`)return`blocked`;let t=await zS();await navigator.serviceWorker.ready;let{publicKey:n}=await e.request(`push.key`),r=await t.pushManager.getSubscription();return r?.options.applicationServerKey&&qS(r.options.applicationServerKey)!==n&&(await r.unsubscribe(),r=null),r??=await t.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:KS(n)}),await e.request(`push.subscribe`,{subscription:r.toJSON()}),`on`}async function HS(e){let t=await(await navigator.serviceWorker.getRegistration())?.pushManager.getSubscription();return t&&(await e.request(`push.unsubscribe`,{endpoint:t.endpoint}),await t.unsubscribe()),`off`}async function US(e,t,n,r){let i={body:r,tag:`task:${e}:${t}`,icon:`icon-192.png`,data:{taskId:e}},a=`serviceWorker`in navigator?await navigator.serviceWorker.getRegistration():void 0;if(a)return a.showNotification(`Rove — ${n}`,i);let o=new Notification(`Rove — ${n}`,i);o.onclick=()=>{window.focus(),WS?.(e),o.close()}}var WS=null;function GS(e){WS=t=>e.selectWhenListed(t);let t=new URLSearchParams(window.location.search),n=t.get(`task`);if(n){t.delete(`task`);let r=t.toString();history.replaceState(null,``,`${window.location.pathname}${r?`?${r}`:``}${window.location.hash}`),e.selectWhenListed(n)}let r=()=>{WS=null};if(!(`serviceWorker`in navigator))return r;let i=t=>{let n=t.data;n?.type===`rove.openTask`&&typeof n.taskId==`string`&&n.taskId&&e.selectWhenListed(n.taskId)};return navigator.serviceWorker.addEventListener(`message`,i),()=>{r(),navigator.serviceWorker.removeEventListener(`message`,i)}}function KS(e){let t=atob(e.replace(/-/g,`+`).replace(/_/g,`/`));return Uint8Array.from(t,e=>e.charCodeAt(0))}function qS(e){return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}var JS={done:`✓`,needs_input:`?`,error:`✕`};function YS(e){let t=new Audio(MS);t.volume=Math.min(1,Math.max(0,e)),t.play().catch(()=>void 0)}function XS(e,t,n){!document.hidden||typeof Notification>`u`||Notification.permission!==`granted`||US(e,t,n,JS[t]).catch(()=>void 0)}function ZS(){typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission()}function QS(e){let t=new Map;for(let n of e.tasks)n.activity&&t.set(n.id,n.activity.state);return t}function $S(e){let t=(0,h.useRef)(null);(0,h.useEffect)(()=>{let n=()=>{let n=e.tasks.get();if(!n)return;let r=QS(n),i=LS(t.current,r,null,IS);t.current=r;let{prefs:a}=g_.get();if(!a.crossTask)return;let o=e.selection.get().taskId,s=new Map(n.tasks.map(e=>[e.id,e.label]));for(let{key:e,kind:t}of i){if(e===o||!PS({kind:t,turnEnd:!0},a.finishedAlerts))continue;let n=s.get(e)??e;NS(t,a.toast)&&H(`${JS[t]} ${n}`,t===`error`?`error`:`info`),FS({},a.sound)&&(YS(a.soundVolume),XS(e,t,n))}};return n(),e.tasks.subscribe(n)},[e])}function eC({client:e}){let[t,n]=(0,h.useState)(null),[r,i]=(0,h.useState)(null);(0,h.useEffect)(()=>{BS(e).then(n,()=>n(`off`))},[e]);let a=t=>{i(null),(t?VS(e):HS(e)).then(n,e=>i(e instanceof Error?e.message:String(e)))},o=r?F(`prefs.pushFailed`,{error:r}):F(t===`unsupported`?`prefs.pushUnsupported`:t===`blocked`?`prefs.pushBlocked`:`prefs.pushHint`);return(0,L.jsx)(ny,{label:F(`prefs.push`),hint:o,checked:t===`on`,disabled:t===null||t===`unsupported`||t===`blocked`,onChange:a})}function tC({model:e}){let{client:t}=e,n=x_(),{prefs:r}=n,i=(e,n)=>void b_(t,e,n);return(0,L.jsxs)(ey,{children:[(0,L.jsx)(ny,{label:Q(`general.toast`),hint:F(`settings.notifications.toastNote`),checked:r.toast,onChange:e=>i(`toast`,e)}),(0,L.jsx)(ny,{label:Q(`general.sound`),hint:F(`prefs.soundHint`),checked:r.sound,onChange:e=>{e&&ZS(),i(`sound`,e)}}),(0,L.jsx)(iy,{label:F(`settings.notifications.volume`),hint:F(`prefs.soundVolumeHint`),value:r.soundVolume,picks:S_(n,`soundVolume`).map(e=>({value:e,label:`${Math.round(e*100)}%`})),onPick:e=>{g_.get().prefs.sound&&YS(e),i(`soundVolume`,e)}}),(0,L.jsx)(ny,{label:Q(`general.crossTask`),hint:Q(`general.crossTaskHint`),checked:r.crossTask,onChange:e=>i(`crossTask`,e)}),(0,L.jsx)(ny,{label:Q(`general.finishedAlerts`),hint:Q(`general.finishedAlertsHint`),checked:r.finishedAlerts,onChange:e=>i(`finishedAlerts`,e)}),(0,L.jsx)(eC,{client:t})]})}var nC={kanban:`kanban`,issues:`issues`};function rC({model:e}){let t=_(e.installedMods),[n,r]=(0,h.useState)(()=>J(e,`builtinMods.list`)?.mods??null);if((0,h.useEffect)(()=>{X(e,`builtinMods.list`).then(e=>r(e.mods),()=>r([])),e.refreshMods()},[e]),!n||n.length===0)return null;let i=n=>{let r=!t.has(n.id);e.client.request(`builtinMod.setInstalled`,{id:n.id,installed:r}).then(()=>(!r&&V.get()===nC[n.id]&&V.set(null),e.refreshMods())).catch(e=>H(U(e),`error`))};return(0,L.jsx)(ey,{title:F(`settings.plugins.builtIn`),hint:F(`settings.plugins.builtInHint`),children:n.map(e=>(0,L.jsx)(ty,{label:e.name,hint:e.description,inline:!0,children:(0,L.jsx)($v,{on:t.has(e.id),"aria-label":F(`settings.plugins.turnOn`,{name:e.name}),onClick:()=>i(e)})},e.id))})}function iC({model:e}){let{client:t}=e,[n,r]=(0,h.useState)(()=>J(t,`plugins.list`)?.plugins??null),i=(0,h.useCallback)(()=>X(t,`plugins.list`).then(e=>r(e.plugins),e=>H(U(e),`error`)),[t]);return(0,h.useEffect)(()=>{i()},[i]),(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(rC,{model:e}),(0,L.jsx)(ey,{title:F(`settings.plugins.registered`),children:n?n.length===0?(0,L.jsx)(`p`,{className:iv,children:F(`settings.plugins.empty`)}):n.map(e=>(0,L.jsx)(ty,{label:e.id,hint:[e.version,e.linked?F(`settings.plugins.linked`):null,e.platformOk===!1?F(`settings.plugins.unsupportedPlatform`):null].filter(Boolean).join(`, `),inline:!0,children:(0,L.jsx)($v,{on:e.enabled,"aria-label":e.id,onClick:()=>void t.request(`plugin.setEnabled`,{id:e.id,enabled:!e.enabled}).then(i).catch(e=>H(U(e),`error`))})},e.id)):(0,L.jsx)(`p`,{className:iv,children:F(`preview.loading`)})})]})}function aC(e){let[t,n]=(0,h.useState)(e.tier.engine),[r,i]=(0,h.useState)(e.tier.model??``),[a,o]=(0,h.useState)(e.tier.effort??``),s=e.engines.find(e=>e.id===t);return(0,L.jsxs)(`form`,{className:Bv,onSubmit:n=>{n.preventDefault(),e.onSave(t,s?.takesModel?r.trim():``,a)},onKeyDown:t=>{t.key===`Escape`&&(t.stopPropagation(),e.onCancel())},children:[(0,L.jsx)(P_,{label:Q(`sections.engines`),value:t,picks:e.engines.map(e=>({value:e.id,label:e.name})),onPick:t=>{let r=e.engines.find(e=>e.id===t);n(t),r&&!r.effortLevels.includes(a)&&o(``),r&&!r.takesModel&&i(``)}}),s&&s.effortLevels.length>0&&(0,L.jsx)(P_,{label:F(`prefs.tierEffort`),value:a,picks:[``,...s.effortLevels].map(e=>({value:e,label:e||Q(`autoRouting.engineDefault`)})),onPick:o}),s?.takesModel&&(0,L.jsx)(`input`,{className:`rounded-sm border-hairline border-line bg-paper px-2.5 py-1.5 font-sans text-body text-ink focus-visible:border-line-active focus-visible:outline-none`,value:r,spellCheck:!1,placeholder:Q(`autoRouting.engineDefault`),"aria-label":F(`prefs.tierModel`),onChange:e=>i(e.target.value)}),(0,L.jsxs)(`div`,{className:uv,children:[(0,L.jsx)(R,{onClick:e.onCancel,children:F(`dialog.cancel`)}),(0,L.jsx)(R,{variant:`filled`,type:`submit`,children:Q(`action.save`)})]})]})}function oC({client:e}){let[t,n]=(0,h.useState)(()=>J(e,`autoRouting.get`)??null),[r,i]=(0,h.useState)(null),a=(0,h.useCallback)(()=>X(e,`autoRouting.get`).then(n,e=>H(U(e),`error`)),[e]);(0,h.useEffect)(()=>{a()},[a]);let o=(t,n)=>e.request(t,n).then(a).catch(e=>H(U(e),`error`));if(!t)return(0,L.jsx)(`p`,{className:iv,children:F(`preview.loading`)});let s=t.classifier,c=[{value:`off`,label:Q(`autoRouting.classifierOff`)},{value:`jev`,label:`jev`},...s.canCustom||s.mode===`custom`?[{value:`custom`,label:Q(`autoRouting.classifierCustomLabel`)}]:[]],l=s.mode===`off`?Q(`autoRouting.classifierOffHint`):s.mode===`jev`?Q(`autoRouting.classifierJevHint`):Q(`autoRouting.classifierCustomHint`),u=s.keySource===`env`?Q(`autoRouting.keyPresentEnv`,{env:s.keyEnv??``}):s.keySource===`file`?Q(`autoRouting.keySaved`):s.keyConfigured?Q(`autoRouting.keyMissing`):Q(`autoRouting.keyCustomUnused`);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(ey,{hint:Q(`autoRouting.hint`),children:[!t.configured&&(0,L.jsx)(ty,{label:(0,L.jsx)(`span`,{className:`text-warning`,children:Q(`autoRouting.unconfigured`)})}),t.tiers.map(e=>(0,L.jsxs)(`div`,{className:Rv,children:[(0,L.jsxs)(`div`,{className:zv,children:[(0,L.jsx)(`span`,{className:tv,children:N_(`tier.${e.tier}`)}),(0,L.jsx)(`span`,{className:`${nv} min-w-0 truncate`,children:[e.engineName,e.model??Q(`autoRouting.engineDefault`),e.effort??Q(`autoRouting.engineDefault`)].join(` · `)}),(0,L.jsx)(R,{className:`ml-auto`,onClick:()=>i(r===e.tier?null:e.tier),children:F(`prefs.tierEdit`)})]}),(0,L.jsx)(`span`,{className:nv,children:N_(`tierDesc.${e.tier}`)}),(0,L.jsx)(`span`,{className:`text-meta ${e.block?`text-warning`:`text-success`}`,children:e.block?Q(`autoRouting.unavailable`,{reason:e.block}):Q(`autoRouting.ready`)}),r===e.tier&&(0,L.jsx)(aC,{tier:e,engines:t.engines,onCancel:()=>i(null),onSave:(t,n,r)=>{i(null),o(`autoRouting.setTier`,{tier:e.tier,engine:t,model:n,effort:r})}})]},e.tier))]}),(0,L.jsxs)(ey,{title:Q(`autoRouting.classifierTitle`),hint:Q(`autoRouting.classifierHint`),children:[(0,L.jsx)(ty,{label:(0,L.jsx)(`span`,{className:s.mode===`off`?`text-muted`:`text-warning`,children:Q(`autoRouting.classifierDataFlow`)})}),(0,L.jsx)(iy,{label:Q(`autoRouting.classifierLabel`),hint:l.replace(/^[—\s]+/,``),value:s.mode,picks:c,onPick:e=>void o(`autoRouting.setClassifier`,{mode:e})})]}),(0,L.jsxs)(ey,{title:F(`prefs.classifierConnection`),hint:F(`prefs.editInTui`),children:[(0,L.jsx)(ay,{label:Q(`autoRouting.endpointLabel`),value:s.endpointHost||F(`prefs.unset`)}),(0,L.jsx)(ay,{label:Q(`autoRouting.thresholdLabel`),value:s.threshold.toFixed(2)}),(0,L.jsx)(ty,{label:Q(`autoRouting.keyLabel`),hint:u})]})]})}var sC=[{id:`preferences`,sections:[`general`,`appearance`,`notifications`,`snippets`,`keys`]},{id:`agents`,sections:[`engines`,`autoRouting`,`voice`,`connectors`,`plugins`]},{id:`more`,sections:[`about`,`feedback`,`dev`]}],cC=e=>({section:e??`general`,drilled:e!==void 0});function lC(e,t){return t&&e.drilled?`list`:`close`}var uC=e=>e.split(`
34
+ `,1)[0]??``;function dC(e){let[t,n]=(0,h.useState)(e.editing?.name??``),[r,i]=(0,h.useState)(e.editing?.text??``),[a,o]=(0,h.useState)(!1),s=Um.test(t)&&r.trim()!==``;return(0,L.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:n=>{n.preventDefault(),s&&(o(!0),Vm(e.client,{name:t,text:r}).then(e.onDone).catch(e=>{H(U(e),`error`),o(!1)}))},children:[(0,L.jsxs)(`label`,{className:sv,children:[(0,L.jsx)(`span`,{className:cv,children:F(`snippets.name`)}),(0,L.jsx)(`input`,{className:`${av} w-full font-mono`,value:t,maxLength:32,spellCheck:!1,autoComplete:`off`,autoFocus:!e.editing,readOnly:e.editing!==void 0,placeholder:F(`snippets.namePlaceholder`),onChange:e=>n(e.target.value)}),t!==``&&!Um.test(t)&&(0,L.jsx)(`span`,{className:`text-meta text-muted [&_a]:text-accent`,children:F(`snippets.badName`)})]}),(0,L.jsxs)(`label`,{className:sv,children:[(0,L.jsx)(`span`,{className:cv,children:F(`snippets.text`)}),(0,L.jsx)(`textarea`,{className:`${av} ${lv} w-full`,rows:5,value:r,maxLength:8e3,placeholder:F(`snippets.textPlaceholder`),onChange:e=>i(e.target.value)})]}),(0,L.jsxs)(`div`,{className:uv,children:[(0,L.jsx)(R,{onClick:e.onDone,children:F(`snippets.cancel`)}),(0,L.jsx)(R,{type:`submit`,disabled:a||!s,children:F(`snippets.save`)})]})]})}function fC({model:e}){let{client:t}=e,n=zm(),[r,i]=(0,h.useState)(null);return(0,h.useEffect)(()=>void Bm(t).catch(()=>void 0),[t]),(0,L.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,L.jsxs)(ey,{children:[n.length===0&&r===null&&(0,L.jsx)(ty,{label:F(`snippets.empty`)}),n.map(e=>(0,L.jsxs)(ty,{label:(0,L.jsxs)(`span`,{className:`font-mono`,children:[`@`,e.name]}),hint:uC(e.text),children:[(0,L.jsx)(R,{onClick:()=>i(e),children:F(`snippets.edit`)}),(0,L.jsx)(R,{onClick:()=>void Hm(t,e.name).then(()=>{i(null),H(F(`snippets.removed`,{name:e.name}))}).catch(e=>H(U(e),`error`)),children:F(`snippets.remove`)})]},e.name))]}),r===null?(0,L.jsx)(`div`,{className:uv,children:(0,L.jsx)(R,{onClick:()=>i(`new`),children:F(`snippets.add`)})}):(0,L.jsx)(dC,{client:t,editing:r===`new`?void 0:r,onDone:()=>i(null)},r===`new`?`new`:r.name)]})}var pC=e=>e>=95?`crit`:e>=75?`warn`:`ok`,mC=e=>String(e).padStart(2,`0`);function hC(e,t){if(e==null||e<=t)return``;let n=new Date(e),r=`${mC(n.getHours())}:${mC(n.getMinutes())}`;return e-t<864e5?`→ ${r}`:`→ ${n.getMonth()+1}/${n.getDate()} ${r}`}function gC(e,t){let n=e.windows.find(e=>e.kind===`session`)??e.windows[0];return n?{label:n.label,percentText:`${n.percent}%`,resetText:hC(n.resetsAt,t),tone:pC(n.percent)}:null}var _C=1e4;function vC({client:e,inset:t=!0}){let n=_(e.conn),[r,i]=(0,h.useState)(null);(0,h.useEffect)(()=>{if(n.state!==`open`)return;let t=!0,r=()=>e.request(`usage.get`,{}).then(e=>{t&&i(e.usage)}).catch(()=>{});r();let a=jr(_C,r);return()=>{t=!1,a()}},[e,n.state]);let a=Date.now(),o=(r??[]).flatMap(e=>{let t=gC({capturedAt:e.capturedAt,windows:e.windows},a);return t?[{vendor:e.vendor,name:e.name,chip:t}]:[]});return o.length===0?null:(0,L.jsx)(`div`,{className:`${Wt} ${t?`px-2`:``}`,children:o.map(({vendor:e,name:t,chip:n})=>{let r=Math.min(100,Math.max(0,Number.parseInt(n.percentText,10)||0));return(0,L.jsxs)(R,{variant:`row`,className:Gt,title:`${t} · ${n.label} ${n.percentText} ${n.resetText}`.trim(),"aria-label":`${F(`usage.open`)}: ${t}`,onClick:()=>{Pn(),Ja(`usage`)},children:[(0,L.jsx)(`span`,{className:`truncate`,children:t}),(0,L.jsx)(`span`,{className:Jt(n.tone),style:{"--fill":`${r}%`}}),(0,L.jsxs)(`span`,{children:[n.label,` `,(0,L.jsx)(`span`,{className:Kt[n.tone],children:n.percentText})]})]},e)})})}var yC=2e3;function bC(e){let[t,n]=(0,h.useState)(null),[r,i]=(0,h.useState)(null),a=(0,h.useCallback)(t=>{n(t),Rh(e,t.available)},[e]),o=(0,h.useCallback)(()=>e.request(`voice.status`).then(a,e=>i(U(e))),[e,a]);(0,h.useEffect)(()=>void o(),[o]);let s=t?.setup?.install.phase===`running`||t?.available===!0&&!t.ready;return(0,h.useEffect)(()=>{if(!s)return;let e=window.setInterval(()=>void o(),yC);return()=>window.clearInterval(e)},[s,o]),{status:t,error:r,setError:i,accept:a}}function xC(e){let[t,n]=(0,h.useState)(!1);return t?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:rv,children:e.ask}),(0,L.jsx)(R,{variant:`action`,disabled:e.disabled,onClick:()=>{n(!1),e.onConfirm()},children:e.label}),(0,L.jsx)(R,{variant:`action`,onClick:()=>n(!1),children:F(`voice.setup.cancel`)})]}):(0,L.jsx)(R,{variant:`action`,disabled:e.disabled,onClick:()=>n(!0),children:e.label})}function SC({client:e}){let{status:t,error:n,setError:r,accept:i}=bC(e),[a,o]=(0,h.useState)(!1),s=t?.setup,[c,l]=(0,h.useState)(!1),[u,d]=(0,h.useState)(``),[f,p]=(0,h.useState)(``),[m,g]=(0,h.useState)(``);(0,h.useEffect)(()=>{s?.cloud&&(d(e=>e||s.cloud?.baseURL||``),p(e=>e||s.cloud?.model||``))},[s?.cloud]);let _=(t,n)=>(o(!0),r(null),e.request(t,n).then(i,e=>r(U(e))).finally(()=>o(!1)));if(!t)return(0,L.jsx)(`p`,{className:iv,children:n??`…`});if(!s)return(0,L.jsx)(`p`,{className:iv,children:t.model??F(`voice.setup.unavailable`)});let v=s.install,y=v.phase===`running`,b=c?`cloud`:s.backend,x=e=>{if(e===`cloud`&&!s.cloud?.hasKey)return l(!0);l(!1),_(`voice.configure`,{backend:e})},S=b===`off`?F(`voice.setup.offHint`):c?F(`voice.setup.cloudNeeded`):b===`local`&&!s.localInstalled?F(y?`voice.setup.localInstalling`:`voice.setup.localNeeded`):t.ready?F(`voice.setup.ready`,{model:t.model??``}):t.error??F(`voice.setup.starting`),C=y?v.line??F(`voice.setup.installing`):v.phase===`failed`&&!s.localInstalled?F(`voice.setup.failed`,{line:v.line??``}):s.localInstalled?F(`voice.setup.installed`):s.blocked??F(`voice.setup.localHint`);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(ey,{children:(0,L.jsx)(iy,{label:F(`voice.setup.dictation`),hint:S,value:b,picks:[`off`,`local`,`cloud`].map(e=>({value:e,label:F(`voice.setup.backend.${e}`)})),onPick:x})}),(b===`local`||s.localInstalled||y)&&(0,L.jsx)(ey,{title:F(`voice.setup.backend.local`),children:(0,L.jsx)(ty,{label:F(`voice.setup.localTitle`),hint:C,children:y?(0,L.jsx)(`span`,{className:`max-w-90 min-w-0 truncate font-mono text-meta text-muted [overflow-wrap:anywhere]`,children:F(`voice.setup.installing`)}):s.localInstalled?(0,L.jsx)(xC,{label:F(`voice.setup.uninstall`),ask:F(`voice.setup.uninstallAsk`),disabled:a,onConfirm:()=>void _(`voice.uninstall`)}):!s.blocked&&(0,L.jsx)(R,{variant:`action`,disabled:a,onClick:()=>void _(`voice.install`),children:F(`voice.setup.install`)})})}),(b===`cloud`||s.cloud)&&(0,L.jsx)(ey,{title:F(`voice.setup.cloudTitle`),hint:F(`voice.setup.cloudHint`),children:(0,L.jsxs)(`form`,{className:`flex flex-col gap-3 py-3`,onSubmit:e=>{e.preventDefault(),_(`voice.configure`,{backend:`cloud`,baseURL:u,model:f,apiKey:m}).then(()=>l(!1)),g(``)},children:[(0,L.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsx)(`span`,{className:`text-meta font-medium text-muted`,children:F(`voice.setup.baseURL`)}),(0,L.jsx)(`input`,{className:`rounded-sm border-hairline border-line bg-paper px-2.5 py-1.5 font-sans text-body text-ink focus-visible:border-line-active focus-visible:outline-none font-mono`,value:u,placeholder:`https://api.openai.com/v1`,spellCheck:!1,autoComplete:`off`,onChange:e=>d(e.target.value)})]}),(0,L.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsx)(`span`,{className:`text-meta font-medium text-muted`,children:F(`voice.setup.model`)}),(0,L.jsx)(`input`,{className:`rounded-sm border-hairline border-line bg-paper px-2.5 py-1.5 font-sans text-body text-ink focus-visible:border-line-active focus-visible:outline-none font-mono`,value:f,placeholder:`gpt-4o-mini-transcribe`,spellCheck:!1,autoComplete:`off`,onChange:e=>p(e.target.value)})]}),(0,L.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsx)(`span`,{className:`text-meta font-medium text-muted`,children:F(`voice.setup.apiKey`)}),(0,L.jsx)(`input`,{className:`rounded-sm border-hairline border-line bg-paper px-2.5 py-1.5 font-sans text-body text-ink focus-visible:border-line-active focus-visible:outline-none font-mono`,type:`password`,value:m,placeholder:s.cloud?.hasKey?F(`voice.setup.keySaved`):``,autoComplete:`off`,onChange:e=>g(e.target.value)})]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2.5`,children:[s.cloud&&(0,L.jsx)(xC,{label:F(`voice.setup.forget`),ask:F(`voice.setup.forgetAsk`),disabled:a,onConfirm:()=>{d(``),p(``),_(`voice.forgetCloud`)}}),(0,L.jsx)(R,{variant:`action`,type:`submit`,disabled:a||!u.trim()||!f.trim()||!(m||s.cloud?.hasKey),children:F(s.backend===`cloud`?`voice.setup.save`:`voice.setup.saveAndUse`)})]})]})}),n&&(0,L.jsx)(`p`,{className:`m-0 py-3 text-body text-muted text-error`,children:n})]})}var CC={general:e=>(0,L.jsx)(pS,{model:e}),appearance:e=>(0,L.jsx)(jx,{model:e}),notifications:e=>(0,L.jsx)(tC,{model:e}),snippets:e=>(0,L.jsx)(fC,{model:e}),keys:e=>(0,L.jsx)(jS,{model:e}),engines:e=>(0,L.jsx)(rS,{client:e.client}),autoRouting:e=>(0,L.jsx)(oC,{client:e.client}),voice:e=>(0,L.jsx)(SC,{client:e.client}),connectors:e=>(0,L.jsx)(Kx,{model:e}),plugins:e=>(0,L.jsx)(iC,{model:e}),about:e=>(0,L.jsx)(fb,{client:e.client}),feedback:e=>(0,L.jsx)(uS,{model:e}),dev:e=>(0,L.jsx)(Jx,{client:e.client})},wC={general:`sections.general`,engines:`sections.engines`,autoRouting:`sections.autoRouting`,plugins:`sections.plugins`,keys:`sections.keys`,feedback:`sections.feedback`,dev:`sections.dev`},TC=e=>{let t=wC[e];return t?Q(t):F(`settings.sections.${e}`)};function EC(e){return(0,L.jsxs)(`nav`,{className:z_,"aria-label":F(`settings.title`),children:[(0,L.jsx)(`h1`,{className:B_,children:F(`settings.title`)}),sC.map(t=>(0,L.jsxs)(`div`,{className:V_,children:[(0,L.jsx)(`p`,{className:H_,children:F(`settings.groups.${t.id}`)}),t.sections.map(n=>(0,L.jsxs)(R,{variant:`row`,className:U_(!e.narrow&&e.current===n,t.id===`more`),"aria-current":!e.narrow&&e.current===n?`page`:void 0,onClick:()=>e.onPick(n),children:[TC(n),(0,L.jsx)(fo,{right:!0,className:W_})]},n))]},t.id))]})}function DC({model:e,section:t}){I();let[n,r]=(0,h.useState)(()=>cC(t)),i=eo(),a=()=>lC(n,i)===`list`?r({...n,drilled:!1}):Pn();(0,h.useEffect)(()=>{let e=document.querySelector(`.dialog`);e&&!e.contains(document.activeElement)&&e.focus()},[]),(0,h.useEffect)(()=>{let e=e=>{e.key!==`Escape`||e.defaultPrevented||(e.preventDefault(),a())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)});let o=!i||!n.drilled,s=!i||n.drilled;return(0,L.jsx)(`div`,{className:I_,onMouseDown:e=>e.target===e.currentTarget&&Pn(),children:(0,L.jsxs)(`dialog`,{tabIndex:-1,open:!0,className:L_,"aria-label":F(`settings.title`),onKeyDown:e=>{let t=e.target;e.key===`Escape`&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)&&(t.blur(),e.stopPropagation(),e.nativeEvent.stopImmediatePropagation())},children:[(0,L.jsx)(R,{variant:`row`,className:R_,"aria-label":F(`dialog.close`),title:F(`dialog.close`),onClick:Pn,children:`×`}),i&&n.drilled&&(0,L.jsx)(R,{variant:`row`,className:`hidden flex-none items-center px-4 py-3 pr-12 text-left font-mono text-meta font-bold text-accent w-narrow:flex touch:min-h-11`,onClick:a,children:`‹ ${F(`settings.title`)}`}),o&&(0,L.jsx)(EC,{current:n.section,narrow:i,onPick:e=>r({section:e,drilled:!0})}),i&&o&&(0,L.jsx)(vC,{client:e.client,inset:!1}),s&&(0,L.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto scrollbar-none`,children:(0,L.jsxs)(`div`,{className:`flex w-full flex-col gap-7 px-8 pt-7 pb-10 w-narrow:gap-6 w-narrow:px-4 w-narrow:pt-1 w-narrow:pb-10`,children:[(0,L.jsxs)(`header`,{className:`flex flex-col gap-1 pr-8`,children:[(0,L.jsx)(`h1`,{className:`m-0 font-sans text-display font-semibold normal-nums text-ink`,children:TC(n.section)}),(0,L.jsx)(`p`,{className:`m-0 text-body text-muted`,children:F(`settings.pages.${n.section}`)})]}),(0,L.jsx)(`div`,{className:`flex flex-col gap-7 w-narrow:gap-6`,children:CC[n.section](e)})]})},n.section)]})})}var OC=e=>{let{taskId:t}=e.selection.get();return e.tasks.get()?.tasks.find(e=>e.id===t)??null},kC=e=>{let{taskId:t,tabId:n}=e.selection.get(),r=t?e.tabs.get()[t]?.find(e=>e.id===n):void 0;return!!r&&!Iu(r.split)},AC=[{id:`app.refresh`,live:()=>G.get().stale,run:e=>Mi(e.client)},{id:`palette.open`,live:()=>!0,run:s_},{id:`task.new.global`,live:()=>!0,run:e=>Uh(OC(e)?.repo)},{id:`chat.tab.fork`,live:e=>!!OC(e),run:e=>{let t=OC(e);t&&B.set((0,L.jsx)(eu,{model:e,taskId:t.id,context:`continue`}))}},{id:`chat.fork.new`,live:e=>!!OC(e),run:e=>{let t=OC(e);t&&B.set((0,L.jsx)(eu,{model:e,taskId:t.id,destination:`fork`}))}},{id:`settings.open`,live:()=>!0,run:e=>B.set((0,L.jsx)(DC,{model:e}))},{id:`inbox.show`,live:()=>!0,run:e=>B.set((0,L.jsx)(af,{model:e}))},{id:`focus.previous`,live:()=>!0,run:()=>wa(-1)},{id:`focus.next`,live:()=>!0,run:()=>wa(1)},{id:`workspace.zenToggle`,live:e=>!!OC(e),run:()=>Sn.set(!Sn.get())},{id:`files.createPR`,live:e=>!!OC(e),run:e=>{let t=OC(e);t&&e.client.request(`tab.requestPR`,e.engineTarget(t.id)).then(()=>H(F(`files.prRequested`))).catch(e=>H(e instanceof Error?e.message:String(e),`error`))}},{id:`chat.tab.close`,live:e=>!!e.selection.get().tabId&&kC(e),run:e=>{let{taskId:t,tabId:n}=e.selection.get();!t||!n||e.closeTab(t,n).catch(e=>H(e instanceof Error?e.message:String(e),`error`))}},{id:`kanban.open`,live:e=>e.installedMods.get().has(`kanban`),run:()=>Ja(`kanban`)},{id:`automations.open`,live:()=>!0,run:()=>Ja(`routines`)},{id:`workItems.open`,live:e=>e.installedMods.get().has(`issues`),run:()=>Ja(`issues`)},{id:`task.moveMode`,live:e=>!!d_(e),run:()=>{_f(!hf.get()),document.querySelector(`.rail`)?.focus()}},{id:`files.syncBase`,live:e=>d_(e)?.kind===`task`,run:e=>{let t=d_(e);t&&qg(e,t.id)}},{id:`files.fixChecks`,live:e=>!!d_(e),run:e=>{let t=d_(e);t&&Yg(e,t.id,F(`taskops.fixSent`))}},{id:`task.openEditor`,live:e=>!!d_(e),run:e=>{let t=d_(e);t&&Xg(e,t.id)}}];Ea(()=>AC.map(e=>({id:e.id,chords:Ti(e.id),prefix:!0,live:e.live,run:e.run})));function jC(e){return Ks(e[0]??``)}function MC(e,t){let n=ja(),r=Oa().filter(t=>t.prefix&&ka(t,n)&&t.live?.(e)!==!1);for(let e of t){let t=r.filter(t=>t.chords.includes(e)).sort((e,t)=>Aa(e,n)-Aa(t,n))[0];if(t)return t}}var NC=null,PC=null;function FC(){NC=null,PC!==null&&window.clearTimeout(PC),PC=null;let e=ud.get();e.guide?.kind===`prefix`&&ud.set({...e,guide:null})}function IC(){if(NC!==null){FC();return}B.get()||bi()===null||(NC=Date.now(),ud.set({...ud.get(),guide:{kind:`prefix`,armedAt:NC}}),PC!==null&&window.clearTimeout(PC),PC=window.setTimeout(FC,hi.get().prefix.timeoutMs))}function LC(e,t){FC();let n=typeof t==`string`?[t]:t,r=MC(e,n);fd(jC(n),r?.id??null),r?.run(e)}var RC=null;function zC(){RC!==null&&window.clearTimeout(RC),RC=null;let e=ud.get();e.guide?.kind===`direct`&&ud.set({...e,guide:null})}function BC(){RC!==null||B.get()||(RC=window.setTimeout(()=>{FC(),ud.set({...ud.get(),guide:{kind:`direct`}})},400))}function VC(e){(0,h.useEffect)(()=>{let t=t=>{if(t.key===`Control`){t.repeat||BC();return}if(zC(),[`Shift`,`Alt`,`Meta`].includes(t.key))return;let n=Gs(t),{firstStrokes:r,timeoutMs:i}=hi.get().prefix;if(NC!==null&&Date.now()-NC<=i){if(t.preventDefault(),t.stopImmediatePropagation(),t.key===`Escape`)return FC();LC(e,n);return}FC(),!B.get()&&n.some(e=>r.includes(e))&&(t.preventDefault(),t.stopImmediatePropagation(),IC())},n=e=>e.key===`Control`&&zC(),r=e=>{NC!==null&&(e.target instanceof Element&&e.target.closest(`.prefix-guide, .shortcut-badge, [data-prefix-arm]`)||FC())};return window.addEventListener(`keydown`,t,{capture:!0}),window.addEventListener(`keyup`,n,{capture:!0}),window.addEventListener(`pointerdown`,r,{capture:!0}),window.addEventListener(`blur`,zC),()=>{window.removeEventListener(`keydown`,t,{capture:!0}),window.removeEventListener(`keyup`,n,{capture:!0}),window.removeEventListener(`pointerdown`,r,{capture:!0}),window.removeEventListener(`blur`,zC),zC(),FC()}},[e])}function HC(e){let t=ja(),n=new Map;for(let r of Oa()){if(!r.prefix||!ka(r,t)||r.live?.(e)===!1)continue;let i=Aa(r,t);for(let e of r.chords){let t=n.get(e);(!t||i<t.rank)&&n.set(e,{action:r.id,rank:i})}}return[...n].map(([e,{action:t}])=>({stroke:e,action:t}))}function UC(e){let t=new Map(li.map((e,t)=>[e.id,t])),n=new Map;for(let{stroke:t,action:r}of e)n.set(r,[...n.get(r)??[],t]);let r=new Map,i=[...n].sort(([e],[n])=>(t.get(e)??2**53-1)-(t.get(n)??2**53-1));for(let[e,t]of i){let n=oc(e);r.set(n,[...r.get(n)??[],{action:e,strokes:t}])}return[...r].map(([e,t])=>({category:e,actions:t}))}var WC=e=>e===`prefix.moreCommands`?_c(`moreCommandsPrefix`):xc(e);function GC(e){let[,t]=(0,h.useState)(0);(0,h.useEffect)(()=>{if(e===null)return;let n=window.setTimeout(()=>t(e=>e+1),Math.max(30,e-Date.now()));return()=>window.clearTimeout(n)},[e])}function KC({model:e}){I();let t=_(ud);_(hi),_(e.selection);let n=Date.now(),r=t.entries.filter(e=>n-e.at<ld),i=t.guide?.kind===`prefix`?t.guide.armedAt:null,a=i!==null&&n-i<cd?i+cd:null;GC(a??(r[0]?r[0].at+ld:null));let o=t.guide?.kind===`direct`||i!==null&&a===null;if(!o&&!t.guide&&r.length===0)return null;if(o&&t.guide){let n=t.guide.kind===`direct`,r=n?od(Ma(e,ja()),bi()):HC(e);return(0,L.jsxs)(`output`,{className:`mono ${ut}`,onMouseDown:e=>e.preventDefault(),children:[(0,L.jsxs)(`div`,{className:ft,children:[(0,L.jsx)(`span`,{className:`text-accent`,children:n?_c(`directLayer`):_c(`commandLayer`,{prefix:bi()??``})}),(0,L.jsx)(`span`,{className:`keys-only text-muted`,children:_c(n?`releaseCtrl`:`escCancel`)})]}),(0,L.jsx)(`div`,{className:pt,children:UC(r).map(t=>(0,L.jsxs)(`div`,{className:mt,children:[(0,L.jsx)(`div`,{className:`text-accent`,children:Sc(t.category)}),t.actions.map(({action:t,strokes:r})=>(0,L.jsxs)(`button`,{type:`button`,className:ht,disabled:n,onClick:()=>r[0]&&LC(e,r[0]),children:[(0,L.jsx)(`span`,{className:dt,children:r.map(Ks).join(`/`)}),(0,L.jsx)(`span`,{children:WC(t)})]},t))]},t.category))})]})}return(0,L.jsxs)(`output`,{className:Ot,children:[r.map(e=>(0,L.jsxs)(qC,{at:e.at,children:[(0,L.jsx)(`span`,{className:`text-accent`,children:bi()}),` + `,e.stroke,` →`,` `,e.action?WC(e.action):(0,L.jsx)(`span`,{className:`text-muted`,children:`∅`})]},e.id)),i!==null&&(0,L.jsxs)(`div`,{className:kt(!1),children:[(0,L.jsx)(`span`,{className:`text-accent`,children:bi()}),` ⋯`]})]})}function qC({at:e,children:t}){let[n]=(0,h.useState)(Date.now),r=n-e>140,i={"--hud-out":`${e+ld-140-n}ms`};return(0,L.jsx)(`div`,{className:kt(r),style:i,children:t})}function JC({model:e,bindingId:t,head:n=!1}){let r=_(ud);_(hi);let i=x_().prefs.prefixTap;if(r.guide?.kind!==`prefix`||i!==`local`)return null;let a=ad({bindingId:t,reachability:Ma(e,ja()),prefixKey:bi()});if(!a)return null;let o=Oa().find(e=>e.id===t&&e.prefix)?.chords[0];return(0,L.jsx)(`button`,{type:`button`,className:`mono ${nt(n)}`,onMouseDown:e=>e.preventDefault(),onClick:t=>{t.stopPropagation(),o&&LC(e,o)},children:a})}var YC=[`workingBorder`,`runningTitle`,`taskColors`,`glyphSet`,`colorblind`];function XC(e){let{client:t}=e,n=x_(),r=Dx(),i=_(gx);Ox(e),$S(e),(0,h.useEffect)(()=>{let e=()=>{y_(t).catch(()=>void 0),Bm(t).catch(()=>void 0)},n=()=>document.visibilityState===`visible`&&e(),r=t.onOpen(e);return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,n),()=>{r(),window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,n)}},[t]),(0,h.useEffect)(()=>{let e=document.documentElement,t=i?i[r]:ax(n.themes,n.prefs.theme,r),a=t?px(t,n.prefs):{};for(let[t,n]of Object.entries(a))e.style.setProperty(t,n);e.style.colorScheme=r;for(let t of YC)e.dataset[t]=String(n.prefs[t]);hx.set(t?mx(t):null);let o=document.querySelector(`meta[name="theme-color"]`);o||(o=document.createElement(`meta`),o.name=`theme-color`,document.head.append(o)),o.content=getComputedStyle(document.body).backgroundColor},[n,r,i]),(0,h.useEffect)(()=>{n.loaded&&Sn.get()!==n.prefs.zen&&Sn.set(n.prefs.zen)},[n.loaded,n.prefs.zen]),(0,h.useEffect)(()=>Sn.subscribe(()=>{Sn.get()!==g_.get().prefs.zen&&b_(t,`zen`,Sn.get())}),[t])}var ZC={sidebar:[{id:`sidebar.nav`,msg:`move`},{id:`sidebar.select`,msg:`open`}],files:[{id:`files.nav`,msg:`move`},{id:`files.hierarchy`,msg:`collapse`},{id:`files.open`,msg:`open`,always:!0},{id:`files.diff`,msg:`diff`,always:!0}]};function QC(e,t){return ZC[e].flatMap(e=>{if(t===`always`&&e.always!==!0)return[];let n=ec(e.id);return n?[{cap:n,msg:e.msg}]:[]})}var $C=e=>`rove.web.hintUsed.${e}`,ew=g({sidebar:localStorage.getItem($C(`sidebar`))===`1`});function tw(e){ew.get()[e]||(localStorage.setItem($C(e),`1`),ew.set({...ew.get(),[e]:!0}))}function nw(e,t){return e.kind===`task`&&t.kind===`task`?e.taskId===t.taskId:e.kind===`page`&&t.kind===`page`?e.id===t.id:e.kind===`new`&&t.kind===`new`}var rw={entries:[],at:-1};function iw(e,t){let n=e.entries[e.at];if(n&&nw(n,t)){let n=[...e.entries];return n[e.at]=t,{entries:n,at:e.at}}let r=[...e.entries.slice(0,e.at+1),t].slice(-50);return{entries:r,at:r.length-1}}function aw(e,t,n){for(let r=e.at+t;r>=0&&r<e.entries.length;r+=t){let t=e.entries[r];if(t&&n(t))return r}return-1}var ow=g(rw);function sw(e){let t=V.get();if(t)return{kind:`page`,id:t};let n=Tn.get();if(n)return{kind:`new`,start:n};let{taskId:r,tabId:i}=e.selection.get();return r?{kind:`task`,taskId:r,tabId:i}:null}function cw(e,t){if(t.kind!==`task`)return!0;let n=e.tasks.get()?.tasks.find(e=>e.id===t.taskId);return n!==void 0&&!n.deleting}var lw=!1;function uw(e){let t=!1,n=()=>{t||(t=!0,queueMicrotask(()=>{if(t=!1,lw)return;let n=sw(e);n&&ow.set(iw(ow.get(),n))}))};n();let r=[e.selection.subscribe(n),V.subscribe(n),Tn.subscribe(n)];return()=>{for(let e of r)e()}}function dw(e,t){let n=ow.get(),r=aw(n,t,t=>cw(e,t)),i=n.entries[r];i&&(lw=!0,i.kind===`task`?(V.set(null),Tn.set(null),e.select(i.taskId,i.tabId)):i.kind===`page`?(Tn.set(null),Ja(i.id)):(V.set(null),Tn.set(i.start)),ow.set({entries:n.entries,at:r}),queueMicrotask(()=>{lw=!1}))}function fw(e,t){return e.filter(e=>e.groupId===t).sort((e,t)=>(e.createdAt??``).localeCompare(t.createdAt??``)||e.title.localeCompare(t.title))}var pw=400;function mw(e){let t=null;for(let n of e.history?.messages??[]){if(n.role!==`assistant`)continue;let e=(n.blocks??[]).flatMap(e=>e.type===`text`&&e.text?[e.text]:[]).join(`
35
35
  `).trim(),r=n.timestamp??``;e&&(!t||r>t.at)&&(t={at:r,text:e})}let n=(e.terminal?.tail??[]).map(e=>e.trimEnd()).filter(e=>e.trim()!==``),r=t?.text??n.slice(-6).join(`
36
- `);return r?r.length>TC?`${r.slice(0,TC).trimEnd()}…`:r:null}function DC(e){let t=e.files.filter(e=>e.scope===`working`),n=t.length>0?`working`:`branch`,r=n===`working`?t:e.files.filter(e=>e.scope===`branch`);return{scope:n,files:r,added:r.reduce((e,t)=>e+(t.added??0),0),deleted:r.reduce((e,t)=>e+(t.deleted??0),0)}}async function OC(e,t,n){let r=new Set(e.tasks.get()?.tasks.map(e=>e.id)),i=0;try{for(let a of t.filter(e=>r.has(e)))await e.act(`task.archive`,{taskId:a,archived:!0,...n?{force:!0}:{}}),i++}catch(e){if(i>0&&H(F(`compare.archived`,{count:i})),e instanceof pd&&e.code===`TASK_BUSY`)throw e;H(F(`compare.archiveFailed`,{error:U(e)}),`error`);return}H(F(`compare.archived`,{count:i}))}async function kC(e,t,n){try{for(let r of n)r.id!==t.id&&r.kept&&await e.act(`task.keep`,{taskId:r.id,kept:!1});await e.act(`task.keep`,{taskId:t.id,kept:!0})}catch(e){H(F(`compare.keepFailed`,{error:U(e)}),`error`);return}H(F(`compare.keptToast`,{title:t.label}));let r=n.filter(e=>e.id!==t.id).map(e=>e.id);r.length!==0&&B.set((0,L.jsx)(Or,{title:F(`compare.archiveTitle`),body:F(`compare.archiveBody`,{count:r.length}),confirmLabel:F(`compare.archiveConfirm`),onConfirm:()=>OC(e,r,!1),escalate:{when:e=>e instanceof pd&&e.code===`TASK_BUSY`,label:F(`compare.archiveBusyConfirm`),title:F(`compare.archiveBusyTitle`),body:()=>F(`compare.archiveBusyBody`),run:()=>OC(e,r,!0)}}))}async function AC(e,t){try{await e.act(`task.keep`,{taskId:t.id,kept:!1}),H(F(`compare.unkeptToast`,{title:t.label}))}catch(e){H(F(`compare.keepFailed`,{error:U(e)}),`error`)}}var jC={title:`ROUTINES`,holdingDaemon:`keeping the daemon awake`,notHolding:`none active`,needAttention:`{count} of {total} need you ·`,paused:`paused`,newTitle:`New routine`,composerLegend:`enter create · tab fields · ←→ ↑↓ edit the focused field · esc cancel`,fieldName:`NAME`,fieldRepo:`REPO`,fieldTarget:`DELIVER TO`,fieldTargetTab:`EXISTING ENGINE TAB`,targetFresh:`New task on each run`,targetStanding:`Routine-owned standing task`,targetStandingNew:`Routine-owned standing task, new conversation each run`,targetExisting:`Existing conversation: {task} / {tab}. Never creates or revives a session.`,fieldPrompt:`PROMPT`,fieldSchedule:`SCHEDULE (FIVE-FIELD CRON)`,namePlaceholder:`weekday dependency audit`,promptPlaceholder:`Audit dependencies and summarize risky changes.`,noProject:`Ungrouped`,cronInvalid:`not a five-field cron`,cronField:{minute:`min`,hour:`hour`,dayOfMonth:`day`,month:`month`,dayOfWeek:`weekday`},schedule:{everyDay:`every day {at}`,weekdays:`weekdays {at}`,weekends:`weekends {at}`,onWeekday:`{weekday} {at}`,everyMinute:`every minute`,everyMinutes:`every {n}m`,everyHours:`every {n}h`,hourlyAt:`hourly at :{minute}`,atClock:`at {time}`,dow:{MON:`Mondays`,TUE:`Tuesdays`,WED:`Wednesdays`,THU:`Thursdays`,FRI:`Fridays`,SAT:`Saturdays`,SUN:`Sundays`}},when:{inMinutes:`in {n}m`,inHours:`in {n}h`,inDays:`in {n}d`,minutesAgo:`{n}m ago`,hoursAgo:`{n}h ago`,now:`now`,justNow:`just now`,dateTime:`{date}, {time}`},runStatus:{dispatched:`dispatched`,revived:`revived`,skipped_cancelled:`cancelled before delivery`,skipped_precheck:`skipped (precheck)`,skipped_blocked:`skipped (task can't use it)`,skipped_missed:`skipped (missed)`,skipped_unavailable:`skipped (unavailable)`,dispatch_failed:`dispatch failed`,ran:`ran`,script_failed:`script failed`},cronNever:`valid, but never fires`,missing:{target:`Choose an existing task.`,targetTab:`Enter an existing tab id, e.g. tab-2.`,name:`Give it a name.`,repo:`Pick a project.`,prompt:`Say what it should do.`,schedule:`That schedule will not run.`},empty:`No routines scheduled.`,loadFailed:`Could not read the routines: {message}`,emptyHint:`Press n to create one.`,precheck:`precheck: {command}`,engineDefault:`default engine`,engineChanged:`{name} now runs on {engine}.`,engineChangedNewSession:`{name} now runs on {engine}. Its next run starts a new session; the earlier one stays as a task.`,lastFailed:`last failed {when}: {reason}`,recentRuns:`RECENT RUNS`,precheckDetail:`WHY IT SKIPPED — precheck {exit} in {duration}ms`,precheckExited:`exited {code}`,precheckTimedOut:`timed out`,precheckStdout:`stdout`,precheckStderr:`stderr`,precheckNoOutput:`(no output)`,noRuns:`Not run yet.`,responses:`RESPONSES`,noResponses:"No run has reported back yet. Agents answer with `routine-respond`.",responseAwaiting:`awaiting response`,responseMissing:`no response`,noSelection:`A routine runs its prompt in a project on a schedule.`,running:`Running {name}…`,ranWith:`{name}: {status}`,latestRunNoTask:`The latest run created no task.`,runNow:`[ run now ]`,deleteTitle:`Delete routine?`,deleteBody:`{name} and its run history will be removed. Tasks it already created are untouched.`,deleteButton:`Delete`,createFailed:`Couldn't create the routine: {error}`,deleteFailed:`Couldn't delete "{name}": {error}`,enableFailed:`"{name}" stays paused: {error}`,disableFailed:`"{name}" stays enabled: {error}`,runFailed:`Couldn't run "{name}" now — schedule unchanged: {error}`},MC={title:`例行任务`,holdingDaemon:`正在保持守护进程常驻`,notHolding:`无启用项`,needAttention:`{total} 个中有 {count} 个需要处理 ·`,paused:`已暂停`,newTitle:`新建例行任务`,composerLegend:`enter 创建 · tab 切字段 · ←→ ↑↓ 编辑当前字段 · esc 取消`,fieldName:`名称`,fieldTarget:`投递目标`,fieldTargetTab:`既有引擎标签页`,targetFresh:`每次新建任务`,targetStanding:`例行任务自有的常驻任务`,targetStandingNew:`例行任务自有的常驻任务,每次运行新开对话`,targetExisting:`既有会话:{task} / {tab}。不会创建或重启会话。`,fieldRepo:`仓库`,fieldPrompt:`提示词`,fieldSchedule:`调度(五段 cron)`,namePlaceholder:`工作日依赖审计`,promptPlaceholder:`审计依赖并总结有风险的变更。`,noProject:`未分组`,cronInvalid:`不是合法的五段 cron`,cronField:{minute:`分`,hour:`时`,dayOfMonth:`日`,month:`月`,dayOfWeek:`星期`},schedule:{everyDay:`每天{at}`,weekdays:`工作日{at}`,weekends:`周末{at}`,onWeekday:`{weekday}{at}`,everyMinute:`每分钟`,everyMinutes:`每 {n} 分钟`,everyHours:`每 {n} 小时`,hourlyAt:`每小时的 :{minute}`,atClock:`{time}`,dow:{MON:`每周一`,TUE:`每周二`,WED:`每周三`,THU:`每周四`,FRI:`每周五`,SAT:`每周六`,SUN:`每周日`}},when:{inMinutes:`{n} 分钟后`,inHours:`{n} 小时后`,inDays:`{n} 天后`,minutesAgo:`{n} 分钟前`,hoursAgo:`{n} 小时前`,now:`即将`,justNow:`刚刚`,dateTime:`{date} {time}`},runStatus:{dispatched:`已派发`,revived:`已重启会话`,skipped_cancelled:`交付前已取消`,skipped_precheck:`已跳过(预检)`,skipped_blocked:`已跳过(任务暂不能接收)`,skipped_missed:`已跳过(错过时间)`,skipped_unavailable:`已跳过(不可用)`,dispatch_failed:`派发失败`,ran:`已运行`,script_failed:`脚本失败`},cronNever:`语法合法,但永远不会触发`,missing:{target:`请选择既有任务。`,targetTab:`请输入既有标签页 ID,例如 tab-2。`,name:`起个名字。`,repo:`选一个项目。`,prompt:`说明它要做什么。`,schedule:`这个调度不会触发。`},empty:`还没有例行任务。`,loadFailed:`读不到例行任务:{message}`,emptyHint:`按 n 新建一条。`,precheck:`预检:{command}`,engineDefault:`默认引擎`,engineChanged:`{name} 已改用 {engine}。`,engineChangedNewSession:`{name} 已改用 {engine}。下次运行会新开会话,原来的会话保留为任务。`,lastFailed:`上次失败({when}):{reason}`,recentRuns:`最近执行`,precheckDetail:`为什么跳过 —— 预检{exit},耗时 {duration}ms`,precheckExited:`退出码 {code}`,precheckTimedOut:`超时`,precheckStdout:`标准输出`,precheckStderr:`标准错误`,precheckNoOutput:`(无输出)`,noRuns:`尚未执行。`,responses:`回报`,noResponses:"还没有执行回报。agent 用 `routine-respond` 回报。",responseAwaiting:`等待回报`,responseMissing:`未回报`,noSelection:`例行任务会按调度在某个项目里跑它的提示词。`,running:`正在运行 {name}…`,ranWith:`{name}:{status}`,latestRunNoTask:`最近一次执行没有创建任务。`,runNow:`[ 立即运行 ]`,deleteTitle:`删除这条例行任务?`,deleteBody:`将删除 {name} 及其执行记录。它已经创建的任务不受影响。`,deleteButton:`删除`,createFailed:`创建例行任务失败:{error}`,deleteFailed:`删除“{name}”失败:{error}`,enableFailed:`“{name}”仍处于暂停状态:{error}`,disableFailed:`“{name}”仍处于启用状态:{error}`,runFailed:`无法立即运行“{name}”——排程未受影响:{error}`},NC={title:`Kanban`,hint:`tab project · ←↓↑→ card · enter detail · n new · d delete · r refresh · esc close`,loading:`Loading issues…`,noRepos:"No projects yet — add one with `rove add <path>`, or file a story with `rove api issue-create`.",empty:"No issues — agents file them via `rove api issue-create`.",readFailed:"Couldn't read this project's stories: {error}. Run `rove doctor`, then reopen Kanban.",readFailedToast:`Couldn't read stories for {repo}: {error}`,columnEmpty:`No cards`,column:{backlog:`Backlog`,inProgress:`In progress`,parked:`Parked`,done:`Done`},more:`+{count} more`,attention:`{count} need you`,turnComplete:`turn done`,menu:{setStatus:`status → {status}`},detail:{status:{open:`open`,doing:`doing`,hold:`hold`,done:`done`},statusLabel:`STATUS`,created:`created {date}`,linked:`linked to a session`,titleLabel:`TITLE`,description:`DESCRIPTION`,noDescription:`No description.`,attachHint:`paste a path / ctrl+v screenshot → inserts an image placeholder`,engine:`ENGINE`,workspace:`WORKSPACE`,placement:{worktree:`New worktree task — its own workspace`,projectWorktree:`New worktree — as a chattab in the project workspace`,project:`Project checkout — a new chattab, no worktree`},jumpLabel:`AFTER START`,jump:{stay:`Stay on the board`,follow:`Jump to the session`},startLegend:`enter/ctrl+enter start · tab fields · ←→ status/engine · ↑↓ workspace · esc save & close`,sessionLabel:`SESSION`,openAction:`Open the linked session ↵`,unlinkAction:`Unlink`,openLegend:`enter open the focused action · tab fields · ←→ status · unlink returns the card to Backlog · esc save & close`,eventsLabel:`EVENTS`,eventsLoading:`Loading events…`,eventsNone:`No engine events recorded yet.`,doneNote:`Done stories have nothing left to start — set the status back to reopen one · esc save & close`,startedBackground:`Started in background: {title}`,newStory:`NEW STORY`,createLegend:`ctrl+s save · enter/ctrl+enter save & start · tab fields · esc cancel`},confirmDelete:{title:`Delete story #{id}?`,body:`“{title}” will be removed from the tracker. A linked task, branch, or worktree is left untouched.`},deleteFailed:`Couldn't delete story #{id}: {error}`,createFailed:`Couldn't create the story: {error}`,updateFailed:`Couldn't save story #{id}: {error}`,statusFailed:`Story #{id} stays in its old column: {error}`,linkFailed:`Story #{id} isn't linked to its task: {error}`,unlinkFailed:`Story #{id} is still linked: {error}`},PC={title:`看板`,hint:`tab 切项目 · ←↓↑→ 选卡片 · enter 详情 · n 新建 · d 删除 · r 刷新 · esc 关闭`,loading:`正在加载 issues…`,noRepos:"还没有项目——用 `rove add <路径>` 添加一个,或用 `rove api issue-create` 创建一个 story。",empty:"暂无 issue——agent 可通过 `rove api issue-create` 创建。",readFailed:"读取该项目的 story 失败:{error}。请运行 `rove doctor`,再重新打开看板。",readFailedToast:`读取 {repo} 的 story 失败:{error}`,columnEmpty:`暂无卡片`,column:{backlog:`待办`,inProgress:`进行中`,parked:`搁置`,done:`已完成`},more:`还有 {count} 条`,attention:`{count} 张等你处理`,turnComplete:`回合完成`,menu:{setStatus:`状态 → {status}`},detail:{status:{open:`待办`,doing:`进行中`,hold:`搁置`,done:`已完成`},statusLabel:`状态`,created:`创建于 {date}`,linked:`已关联会话`,titleLabel:`标题`,description:`描述`,noDescription:`暂无描述。`,attachHint:`粘贴路径 / ctrl+v 贴截图 → 插入图片占位行`,engine:`引擎`,workspace:`工作区`,placement:{worktree:`新建 worktree 任务——独立工作区`,projectWorktree:`新建 worktree——作为项目工作区里的 chattab`,project:`项目主目录——新开 chattab,不建 worktree`},jumpLabel:`启动后`,jump:{stay:`留在看板`,follow:`跳转到会话`},startLegend:`enter/ctrl+enter 启动 · tab 切字段 · ←→ 状态/引擎 · ↑↓ 工作区 · esc 保存关闭`,sessionLabel:`会话`,openAction:`打开关联会话 ↵`,unlinkAction:`解除关联`,openLegend:`enter 执行选中操作 · tab 切字段 · ←→ 状态 · 解除关联把卡片退回 Backlog · esc 保存关闭`,eventsLabel:`事件`,eventsLoading:`正在加载事件…`,eventsNone:`暂无引擎事件记录。`,doneNote:`已完成的 story 无需启动——改回状态即可重新打开 · esc 保存关闭`,startedBackground:`已在后台启动:{title}`,newStory:`新建 STORY`,createLegend:`ctrl+s 仅保存 · enter/ctrl+enter 保存并启动 · tab 切字段 · esc 取消`},confirmDelete:{title:`删除 story #{id}?`,body:`「{title}」将从 tracker 中移除。已关联的任务、分支、worktree 不受影响。`},deleteFailed:`删除 story #{id} 失败:{error}`,createFailed:`创建 story 失败:{error}`,updateFailed:`保存 story #{id} 失败:{error}`,statusFailed:`Story #{id} 仍留在原来的列:{error}`,linkFailed:`Story #{id} 未能关联到它的任务:{error}`,unlinkFailed:`Story #{id} 仍处于关联状态:{error}`},FC={title:`ISSUES`,noRepo:`no project`,empty:`No open issues.`,assignedFilter:`assigned to me`,starting:`Starting work on #{number}…`,startedNoEngine:`Created {title}, but its engine did not start.`,linkedChip:`→ {title}`,openingLinked:`Opening {title}…`,startFailed:`Couldn't start work on #{number}: {error}`,errorHint:{noRemote:"Add a GitHub remote (`git remote add origin <url>`) and try again, or press q / esc to close.",ghMissing:"Install the `gh` CLI and authenticate, or press q / esc to close.",auth:"Run `gh auth login`, or press q / esc to close.",fallback:`{message} · press q / esc to close`}},IC={title:`议题`,noRepo:`无项目`,empty:`没有开放的议题。`,assignedFilter:`分配给我的`,starting:`正在开始处理 #{number}…`,startedNoEngine:`已创建 {title},但引擎没有启动。`,linkedChip:`→ {title}`,openingLinked:`正在打开 {title}…`,startFailed:`开始处理 #{number} 失败:{error}`,errorHint:{noRemote:"添加 GitHub remote(`git remote add origin <url>`)后重试,或按 q / esc 关闭。",ghMissing:"安装 `gh` CLI 并登录,或按 q / esc 关闭。",auth:"执行 `gh auth login`,或按 q / esc 关闭。",fallback:`{message} · 按 q / esc 关闭`}};function LC(){let e=I()===`zh`;return{kanban:e?PC:NC,auto:e?MC:jC,items:e?IC:FC,nav:(e?Yr:Jr).nav,group:(e?Yr:Jr).group,common:e?Nr:Mr}}function $(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e))}function RC(){let{auto:e}=LC();return(t,n)=>{let r=e;for(let e of t.replace(/^automations\./,``).split(`.`))r=r&&typeof r==`object`?Reflect.get(r,e):void 0;return typeof r==`string`?n?$(r,n):r:t}}function zC(e){return e instanceof Error?e.message:String(e)}function BC(e){return e.replace(/^\/private\//,`/`).replace(/\/+$/,``)}function VC(e,t){let n=e.split(`/`).filter(Boolean),r=n[n.length-1]??e;return t.some(t=>t!==e&&t.split(`/`).filter(Boolean).pop()===r)&&n.length>1?`${n[n.length-2]}/${r}`:r}function HC(...e){let t=new Set,n=[];for(let r of e.flat()){if(!r||r.startsWith(`ssh://`))continue;let e=BC(r);t.has(e)||(t.add(e),n.push(r))}return n}function UC(e){return HC((_(e.tasks)?.tasks??[]).filter(e=>!xu(e)).map(e=>e.repo))}function WC(e){let t=_(e.tasks),{taskId:n}=_(e.selection);return t?.tasks.find(e=>e.id===n)?.repo}function GC(e){let[t,n]=(0,h.useState)(0);return(0,h.useEffect)(()=>jr(e,()=>n(e=>e+1)),[e]),[t,(0,h.useCallback)(()=>n(e=>e+1),[])]}function KC(e){return e instanceof HTMLElement?e.isContentEditable||[`INPUT`,`TEXTAREA`,`SELECT`].includes(e.tagName):!1}function qC(e){let t=(0,h.useRef)(e);t.current=e,(0,h.useEffect)(()=>{let e=e=>{if(e.defaultPrevented||B.get()||mn.get())return;let n=e.target instanceof HTMLElement?e.target:null;KC(n)||n?.closest(`.rail, .side-panel, .xterm`)||e.metaKey||e.altKey||e.ctrlKey&&e.key.toLowerCase()===`c`&&window.getSelection()?.toString()||t.current(e)&&(e.preventDefault(),e.stopPropagation())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[])}function JC(){let e=(0,h.useRef)(null);return(0,h.useEffect)(()=>e.current?.focus(),[]),e}var YC={working:`info`,waiting:`warning`,error:`attention`,done:`success`,idle:`muted`},XC={prOpen:``,prMerged:``,prClosed:``};function ZC(e){let t=QC(e);return{look:t,tone:YC[t]}}function QC(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 $C(e){return e.rowStatus?.kind===`needs-input`||e.rowStatus?.kind===`attention`}var ew={busy:0,attention:1,"needs-input":2,running:3,unseen:4,idle:5};function tw(e){let t;for(let{rowStatus:n}of e)n&&(!t||ew[n.kind]<ew[t.kind]||n.kind===t.kind&&n.since>t.since)&&(t=n);return t}function nw(e,t,n){if(!e)return null;if(e.lifecycle===`merged`)return{glyph:XC.prMerged,tone:n?`text-muted`:`text-merged`,state:`merged`};if(e.lifecycle===`closed`)return{glyph:XC.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:XC.prOpen,tone:i,state:`open`,...r?{checks:r}:{}}}function rw(e){return nw(e.pr,e.prChip,e.prChipStale===!0)}function iw(e){return nw(e,(e.mergeable??``).toUpperCase()===`CONFLICTING`?`conflict`:e.checkState===`failing`?`failing`:e.checkState===`passing`?`passing`:null,!1)}function aw(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]}function ow({tone:e,children:t}){return(0,L.jsx)(`span`,{className:Re(`flex-none font-mono text-meta`,e&&ef[e]),children:t})}var sw=`mt-3 grid grid-cols-[repeat(auto-fit,minmax(min(100%,17rem),1fr))] items-start gap-x-5 gap-y-6`,cw=e=>e?`flex min-w-0 flex-col gap-2 pt-2 [border-top:var(--hairline)_solid_var(--accent)]`:`flex min-w-0 flex-col gap-2 pt-2 [border-top:var(--hairline)_solid_var(--line)]`,lw=`flex min-w-0 items-center gap-2`,uw=`min-w-0 truncate font-bold`,dw=`truncate font-mono text-meta text-muted`,fw=`m-0 line-clamp-6 whitespace-pre-wrap wrap-anywhere`,pw=`flex min-w-0 flex-col`,mw=`flex min-w-0 items-baseline gap-2 py-px font-mono text-meta`,hw=`flex flex-wrap gap-x-3.5 gap-y-1 font-mono text-meta`,gw=`flex min-w-0 flex-wrap items-center gap-x-3.5 gap-y-0.5 px-2.5 py-1 font-mono text-meta`,_w=1.2,vw=.3,yw=20,bw=.35,xw=.25,Sw=.12,Cw=2,ww=1,Tw={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}},Ew=Array.from({length:9},(e,t)=>Math.hypot(t%3-1,Math.floor(t/3)-1));function Dw(e){return bw+.65*(.5+.5*Math.cos(2*Math.PI*e/_w))}function Ow(e,t,n,r=1){switch(e){case`working`:{let e=t*80/1e3/r;return Ew.map(t=>Dw(e-t*vw))}case`waiting`:{let e=[0,1,4,5].includes(Math.floor(t/r)%yw);return Array(9).fill(e?xw:1)}default:{let t=Tw[e],r=Array(9).fill(Sw);return t?.dots.forEach((e,i)=>{let a=Math.min(Math.max(n-i*ww,0),Cw)/Cw;r[e]=t.bright*a+Sw*(1-a)}),r}}}function kw(e,t){let n=Tw[e];return!n||t<(n.dots.length-1)*ww+Cw}var Aw=3,jw=new Set,Mw;function Nw(e,t){let n=typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches,r=1/0,i=e.held+t-e.step,a=kw(e.look,n?r:i);return Ow(e.look,t,n?r:i,n?Aw:1).forEach((t,n)=>{let r=e.el.children[n].style;r.opacity=t.toFixed(3)}),a}function Pw(){let e=Math.floor(performance.now()/80);for(let t of jw)Nw(t,e)||jw.delete(t);Fw()}function Fw(){Mw=jw.size?window.setTimeout(Pw,80-performance.now()%80+2):void 0}function Iw(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 Nw(a,r)&&(jw.add(a),Mw===void 0&&Fw()),()=>{jw.delete(a)}}function Lw({status:e}){let{look:t,tone:n}=ZC(e);return(0,L.jsx)(zw,{look:t,tone:n,since:e?.since??0},t)}var Rw=e=>e===`muted`?`text-muted`:e===`ink`?`text-ink`:ef[e];function zw({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?Iw(t,e,i):void 0},[e,i]),(0,L.jsx)(`span`,{ref:r,className:`inline-grid flex-none grid-cols-[repeat(3,3px)] auto-rows-[3px] gap-px self-center ${Rw(t)}`,"aria-hidden":`true`,children:Array.from({length:9},(e,t)=>(0,L.jsx)(`i`,{className:`rounded-full bg-current opacity-12`},t))})}var Bw=6;function Vw(e,t){let[n,r]=(0,h.useState)(null),[i,a]=(0,h.useState)(()=>J(e,`diff.files`,{taskId:t.id})??null),o=`${t.rowStatus?.kind??``}:${t.rowStatus?.since??0}`,s=JSON.stringify(t.changes??null);return(0,h.useEffect)(()=>{let n=!0;return X(e,`output.read`,{taskId:t.id,limit:8}).then(e=>n&&r(EC(e)),()=>n&&r(null)),()=>{n=!1}},[e,t.id,o]),(0,h.useEffect)(()=>{let n=!0;return X(e,`diff.files`,{taskId:t.id}).then(e=>n&&a(e),()=>{}),()=>{n=!1}},[e,t.id,s,o]),{reply:n,changes:i?DC(i):null}}function Hw({changes:e,onOpen:t}){if(!e)return(0,L.jsx)(`p`,{className:en,children:`…`});if(e.files.length===0)return(0,L.jsx)(`p`,{className:`m-0 font-mono text-meta text-subtle`,children:F(`compare.noChanges`)});let n=e.files.length-Bw;return(0,L.jsxs)(`div`,{className:pw,children:[(0,L.jsxs)(`p`,{className:`m-0 flex gap-2 font-mono text-meta text-muted`,children:[(0,L.jsx)(`span`,{children:F(`compare.files`,{count:e.files.length})}),e.added>0&&(0,L.jsxs)(ow,{tone:`added`,children:[`+`,e.added]}),e.deleted>0&&(0,L.jsxs)(ow,{tone:`removed`,children:[`−`,e.deleted]})]}),e.files.slice(0,Bw).map(n=>(0,L.jsxs)(R,{variant:`row`,className:`${mw} text-left [&:hover]:underline`,title:n.path,onClick:()=>t(n.path,e.scope),children:[(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n.path}),n.added?(0,L.jsxs)(ow,{tone:`added`,children:[`+`,n.added]}):null,n.deleted?(0,L.jsxs)(ow,{tone:`removed`,children:[`−`,n.deleted]}):null]},n.path)),n>0&&(0,L.jsx)(`span`,{className:`font-mono text-meta text-subtle`,children:F(`compare.more`,{count:n})})]})}function Uw({model:e,row:t,round:n}){let{reply:r,changes:i}=Vw(e,t),{look:a}=ZC(t.rowStatus),o=t.kept===!0,s=(n,r)=>{e.select(t.id),Fs({taskId:t.id,path:n,scope:r})};return(0,L.jsxs)(`section`,{className:cw(o),"data-attempt":t.id,children:[(0,L.jsxs)(`div`,{className:lw,children:[(0,L.jsx)(Lw,{status:t.rowStatus}),(0,L.jsx)(`span`,{className:uw,children:t.engine?.name??t.label}),(0,L.jsx)(`span`,{className:`flex-none text-meta text-muted`,children:F(`compare.status.${a}`)}),o&&(0,L.jsx)(`span`,{className:`ml-auto flex-none font-mono text-meta text-accent`,children:F(`compare.kept`)})]}),(0,L.jsx)(`span`,{className:dw,title:t.branch,children:t.branch}),r?(0,L.jsx)(`p`,{className:fw,children:r}):(0,L.jsx)(`p`,{className:`m-0 text-muted`,children:F(`compare.noReply`)}),(0,L.jsx)(Hw,{changes:i,onOpen:s}),(0,L.jsxs)(`div`,{className:hw,children:[(0,L.jsx)(R,{hit:`tight`,onClick:()=>e.select(t.id),children:F(`compare.terminal`)}),(0,L.jsx)(R,{hit:`tight`,onClick:()=>s(`.`,i?.scope??`working`),children:F(`compare.diff`)}),o?(0,L.jsx)(R,{hit:`tight`,onClick:()=>void AC(e,t),children:F(`compare.unkeep`)}):(0,L.jsx)(R,{hit:`tight`,onClick:()=>void kC(e,t,n),children:F(`compare.keep`)})]})]})}function Ww({model:e}){I();let t=_(bn),n=_(e.tasks),r=JC(),i=t&&n?wC(n.tasks,t):[];return(0,L.jsxs)(`div`,{className:Dy,tabIndex:0,ref:r,onKeyDown:e=>{e.metaKey||e.ctrlKey||e.altKey||e.key!==`q`&&e.key!==`Escape`||(e.preventDefault(),V.set(null))},children:[(0,L.jsx)(`h1`,{className:Oy,children:F(`compare.title`)}),i.length===0?(0,L.jsx)(`p`,{className:`text-muted`,children:F(`compare.empty`)}):(0,L.jsx)(`div`,{className:sw,children:i.map(t=>(0,L.jsx)(Uw,{model:e,row:t,round:i},t.id))})]})}function Gw(e){let t=Math.floor(e/6e4),n=Math.floor(t/60);return{minutes:t,hours:n,days:Math.floor(n/24)}}function Kw(e,t=Date.now()){let n=Math.max(0,t-e),r=Math.floor(n/1e3);if(r<60)return`${r}s`;let{minutes:i,hours:a,days:o}=Gw(n);return i<60?`${i}m`:a<24?`${a}h`:`${o}d`}var qw=[{id:`issues`,label:`reviewQueue.sourceIssues`},{id:`reviews`,label:`reviewQueue.sourceReviews`}];function Jw(){I();let e=_(Ig);return(0,L.jsx)(`span`,{className:`flex items-baseline gap-3 font-mono text-meta`,children:qw.map(t=>t.id===e?(0,L.jsx)(`span`,{className:`text-ink`,children:F(t.label)},t.id):(0,L.jsx)(R,{onClick:()=>Ig.set(t.id),children:F(t.label)},t.id))})}var Yw={passing:`reviewQueue.checksPassing`,failing:`reviewQueue.checksFailing`,pending:`reviewQueue.checksPending`},Xw={missing:`reviewQueue.gh.missing`,unauthenticated:`reviewQueue.gh.unauthenticated`,failed:`reviewQueue.gh.failed`};function Zw(e){let{pr:t}=e,n=Date.parse(t.createdAt),r=[t.isDraft?F(`reviewQueue.draft`):``,t.fork?F(`reviewQueue.fork`):``,t.checks?F(Yw[t.checks]):``];return(0,L.jsxs)(`div`,{"data-row":e.index,className:Py(e.at),onClick:e.onPick,children:[(0,L.jsxs)(`div`,{className:Fy,children:[(0,L.jsxs)(`span`,{className:`mono ${Iy}`,children:[t.nameWithOwner.split(`/`)[1],`#`,t.number]}),(0,L.jsx)(`span`,{className:Ry,children:t.title}),(0,L.jsx)(R,{disabled:e.busy,onClick:e.onReview,children:F(`reviewQueue.start`)})]}),(0,L.jsxs)(`div`,{className:Ly,children:[(0,L.jsx)(`span`,{className:Ry,children:[t.author,...r].filter(Boolean).join(`, `)}),(0,L.jsxs)(`span`,{className:`mono`,children:[`+`,t.additions,` −`,t.deletions]}),(0,L.jsx)(`span`,{className:`mono`,children:Number.isFinite(n)?Kw(n,e.now):``})]})]})}function Qw({model:e}){I();let t=e.client,[n,r]=(0,h.useState)(null),[i,a]=(0,h.useState)(null),[o,s]=(0,h.useState)(0),[c,l]=(0,h.useState)(null),[u,d]=(0,h.useState)(null),[f,p]=(0,h.useState)(0),m=(0,h.useRef)(!1),g=JC(),_=(0,h.useRef)(null);(0,h.useEffect)(()=>{let e=!0,n=m.current;return m.current=!1,a(null),t.request(`review.queue`,n?{refresh:!0}:{}).then(t=>e&&r(t)).catch(t=>{e&&(a(zC(t)),r({prs:[],other:0}))}),()=>{e=!1}},[t,f]);let v=n?.prs??[],y=Math.min(o,Math.max(0,v.length-1));(0,h.useEffect)(()=>{_.current?.querySelector(`[data-row="${y}"]`)?.scrollIntoView({block:`nearest`})},[y]);let b=async e=>{if(c===null){l(e.number),d(F(`reviewQueue.preparing`,{number:e.number}));try{let{ref:n}=await t.request(`review.prepare`,{repo:e.repo,number:e.number});Dn(Lg(e,n,F(`reviewQueue.prompt`,{number:e.number,repo:e.nameWithOwner,title:e.title,url:e.url,head:e.headRef,base:e.baseRef})))}catch(t){H(F(`reviewQueue.failed`,{number:e.number,error:zC(t)}),`error`)}finally{l(null),d(null)}}};qC(e=>{if(e.ctrlKey)return e.key===`c`&&(V.set(null),!0);switch(e.key){case`Escape`:case`q`:return V.set(null),!0;case`j`:case`ArrowDown`:return s(Math.min(v.length-1,y+1)),!0;case`k`:case`ArrowUp`:return s(Math.max(0,y-1)),!0;case`r`:return m.current=!0,p(e=>e+1),!0;case`Enter`:{let e=v[y];return e&&b(e),!0}default:return!1}});let x=Date.now();return(0,L.jsxs)(`div`,{className:Dy,tabIndex:0,ref:g,children:[(0,L.jsxs)(`div`,{className:ky,children:[(0,L.jsx)(`h1`,{className:Oy,children:F(`reviewQueue.title`)}),(0,L.jsx)(Jw,{})]}),i?(0,L.jsx)(`p`,{className:`text-error`,children:i}):n===null?(0,L.jsx)(`p`,{className:`text-muted`,children:`…`}):n.reason?(0,L.jsx)(`p`,{className:`text-muted`,children:F(Xw[n.reason])}):v.length===0?(0,L.jsx)(`p`,{className:`text-muted`,children:F(`reviewQueue.empty`)}):(0,L.jsx)(`div`,{className:Ny,ref:_,children:v.map((e,t)=>(0,L.jsx)(Zw,{pr:e,index:t,at:t===y,now:x,busy:c!==null,onPick:()=>s(t),onReview:()=>void b(e)},`${e.nameWithOwner}#${e.number}`))}),n&&n.other>0&&(0,L.jsx)(`p`,{className:`text-muted mx-0 mt-2 mb-0 text-meta leading-[inherit]`,children:F(`reviewQueue.other`,{count:n.other})}),u&&(0,L.jsx)(`p`,{className:`text-muted mx-0 mt-2 mb-0 text-meta leading-[inherit]`,children:u})]})}var $w=30;function eT(){let{items:e}=LC();return t=>{let n=t.indexOf(`: `);switch(n>=0?t.slice(0,n):`failed`){case`no-remote`:return e.errorHint.noRemote;case`gh-missing`:return e.errorHint.ghMissing;case`auth`:return e.errorHint.auth;default:return $(e.errorHint.fallback,{message:t})}}}function tT({model:e}){let{items:t,common:n}=LC(),r=eT(),i=e.client,a=_(e.tasks),o=UC(e),s=WC(e),[c,l]=(0,h.useState)(()=>{let e=s?o.findIndex(e=>BC(e)===BC(s)):-1;return Math.max(0,e)}),u=o[c],d=(e,t)=>({repo:e,limit:$w,...t?{assignee:`@me`}:{}}),f=e=>Object.fromEntries(e.links.map(e=>[e.number,e.taskId])),[p,m]=(0,h.useState)(()=>u?J(i,`workitem.list`,d(u,!1))?.items??null:null),[g,v]=(0,h.useState)(()=>{let e=u?J(i,`workitem.links`,{repo:u}):void 0;return e?f(e):{}}),[y,b]=(0,h.useState)(null),[x,S]=(0,h.useState)(!1),[C,w]=(0,h.useState)(0),[T,E]=(0,h.useState)(0),[D,O]=(0,h.useState)(!1),[k,ee]=(0,h.useState)(null),A=JC(),te=(0,h.useRef)(!1);(0,h.useEffect)(()=>{let e=!0;if(!u){m([]);return}b(null);let t=te.current;te.current=!1;let n=d(u,x),r=J(i,`workitem.list`,n);return r&&m(r.items),i.request(`workitem.list`,{...n,...t?{refresh:!0}:{}}).then(t=>e&&m(Y(i,`workitem.list`,n,t).items)).catch(t=>{e&&(b(zC(t)),m([]))}),X(i,`workitem.links`,{repo:u}).then(t=>e&&v(f(t))).catch(()=>e&&v({})),()=>{e=!1}},[i,u,x,C,a?.tasks.length]);let ne=p??[],j=Math.min(T,Math.max(0,ne.length-1));(0,h.useEffect)(()=>ee(null),[u,x]);let re=(0,h.useRef)(null);(0,h.useEffect)(()=>{re.current?.querySelector(`[data-row="${j}"]`)?.scrollIntoView({block:`nearest`})},[j]);let M=e=>a?.tasks.find(t=>t.id===e)?.label??e,N=t=>{V.set(null),e.select(t)},ie=async()=>{let e=ne[j];if(!e||!u||D)return;let n=g[e.number];if(n){ee($(t.openingLinked,{title:M(n)})),N(n);return}O(!0),ee($(t.starting,{number:e.number}));try{let n=await i.request(`workitem.start`,{repo:u,number:e.number});n.started?N(n.taskId):ee($(t.startedNoEngine,{title:n.title}))}catch(n){H($(t.startFailed,{number:e.number,error:zC(n)}),`error`)}finally{O(!1)}};qC(e=>{if(e.ctrlKey)return e.key===`c`&&(V.set(null),!0);switch(e.key){case`Escape`:case`q`:return V.set(null),!0;case`j`:case`ArrowDown`:return E(Math.min(ne.length-1,j+1)),!0;case`k`:case`ArrowUp`:return E(Math.max(0,j-1)),!0;case`Tab`:return l(t=>o.length?(t+(e.shiftKey?o.length-1:1))%o.length:0),!0;case`a`:return S(e=>!e),!0;case`r`:return te.current=!0,w(e=>e+1),!0;case`Enter`:return ie(),!0;default:return!1}});let ae=Date.now();return(0,L.jsxs)(`div`,{className:Dy,tabIndex:0,ref:A,children:[(0,L.jsxs)(`div`,{className:ky,children:[(0,L.jsx)(`h1`,{className:Oy,children:t.title}),(0,L.jsx)(Jw,{}),(0,L.jsxs)(`span`,{className:`mono touch:empty:hidden! text-muted ${Ay(!0)}`,children:[u?VC(u,o):t.noRepo,x?` ${t.assignedFilter}`:``]})]}),y?(0,L.jsxs)(`div`,{className:Ny,children:[(0,L.jsx)(`p`,{className:`text-error`,children:y}),(0,L.jsx)(`p`,{className:`text-muted`,children:r(y)})]}):p===null?(0,L.jsx)(`p`,{className:`text-muted`,children:n.loading}):ne.length===0?(0,L.jsx)(`p`,{className:`text-muted`,children:t.empty}):(0,L.jsx)(`div`,{className:Ny,ref:re,children:ne.map((e,n)=>{let r=g[e.number],i=Date.parse(e.updatedAt);return(0,L.jsxs)(`div`,{"data-row":n,className:Py(n===j),onClick:()=>n===j?void ie():E(n),children:[(0,L.jsxs)(`div`,{className:Fy,children:[(0,L.jsxs)(`span`,{className:`mono ${Iy}`,children:[`#`,e.number]}),(0,L.jsx)(`span`,{children:e.title})]}),(0,L.jsxs)(`div`,{className:Ly,children:[(0,L.jsx)(`span`,{className:Ry,children:[e.author,...e.labels.slice(0,2)].filter(Boolean).join(`, `)}),r&&(0,L.jsx)(`span`,{children:$(t.linkedChip,{title:M(r)})}),(0,L.jsx)(`span`,{className:`mono`,children:Number.isFinite(i)?Kw(i,ae):``})]})]},e.number)})}),k&&(0,L.jsx)(`p`,{className:`text-muted mx-0 mt-2 mb-0 text-meta leading-[inherit]`,children:k})]})}function nT({model:e}){return _(Ig)===`reviews`?(0,L.jsx)(Qw,{model:e}):(0,L.jsx)(tT,{model:e})}var rT={backlog:`active`,in_progress:`active`,in_review:`parked`,error:`parked`,done:`terminal`,canceled:`terminal`,open:`active`,doing:`active`,hold:`parked`};function iT(e){return rT[e]??`parked`}var aT=[`backlog`,`in_progress`,`parked`,`done`];function oT(e,t,n){let r=e.find(e=>e.issues.length>0)?.issues[0]?.id??null;if(t==null)return r;let i=-1,a=-1;for(let[n,r]of e.entries()){let e=r.issues.findIndex(e=>e.id===t);if(e!==-1){i=n,a=e;break}}if(i===-1)return r;if(n===`up`||n===`down`){let r=e[i]?.issues??[],o=n===`up`?a-1:a+1;return r[Math.max(0,Math.min(o,r.length-1))]?.id??t}let o=n===`left`?-1:1;for(let n=i+o;n>=0&&n<e.length;n+=o){let r=e[n]?.issues??[];if(r.length!==0)return r[Math.min(a,r.length-1)]?.id??t}return t}function sT(e,t){let n=iT(e.status);return n===`terminal`?`done`:n===`parked`?`parked`:e.taskId!==void 0&&e.taskId!==``&&(t?.(e.taskId)??!0)||e.status===`doing`?`in_progress`:`backlog`}function cT(e,t){let n=0;return{columns:e.map(e=>{if(e.key!==`in_progress`)return e;let r=[],i=[];for(let n of e.issues)n.taskId!==void 0&&n.taskId!==``&&t(n.taskId)?r.push(n):i.push(n);return n=r.length,r.length===0?e:{...e,issues:[...r,...i]}}),attentionCount:n}}function lT(e,t){return e.created===t.created?t.id-e.id:e.created<t.created?1:-1}function uT(e,t){let n={backlog:[],in_progress:[],parked:[],done:[]};for(let r of e)n[sT(r,t)].push(r);return aT.map(e=>{let t=e===`done`||e===`parked`,r=n[e].sort(lT);return!t||r.length<=20?{key:e,issues:r,hiddenCount:0}:{key:e,issues:r.slice(0,20),hiddenCount:r.length-20}})}var dT=[`worktree`,`projectWorktree`,`project`];async function fT(e,t){let n=t.placement===`project`?`project`:`worktree`,{title:r,prompt:i}=await e.request(`issue.prompt`,{repo:t.repo,id:t.issue.id,where:n}),a=[];if(t.placement!==`project`){let{taskId:n}=await e.request(`task.create`,{repo:t.repo,engine:t.engine,title:r,prompt:i});if(await e.request(`issue.update`,{repo:t.repo,id:t.issue.id,task:n}).catch(e=>a.push({kind:`link`,error:zC(e)})),t.placement===`worktree`)return{taskId:n,warnings:a};let o=await e.request(`task.openMain`,{repo:t.repo}),s=await e.request(`tab.openViewport`,{taskId:o.taskId,viewTaskId:n});return{taskId:o.taskId,tabId:s.tabId,warnings:a}}let{taskId:o}=await e.request(`task.openMain`,{repo:t.repo}),{tabId:s,taskId:c=o}=await e.request(`tab.new`,{taskId:o,kind:`engine`,engine:t.engine,prompt:i});return await e.request(`issue.setStatus`,{repo:t.repo,id:t.issue.id,status:`doing`}).catch(e=>a.push({kind:`status`,error:zC(e)})),{taskId:c,tabId:s,warnings:a}}var pT=`text-meta leading-[inherit]`,mT=`text-meta`,hT=`flex flex-col gap-2 overflow-hidden`,gT=`flex min-w-0 items-baseline gap-3`,_T=`font-bold whitespace-nowrap text-accent touch:relative touch:after:absolute touch:after:-inset-x-2 touch:after:-inset-y-1 touch:after:content-['']`,vT=`min-w-0 truncate ${mT}`,yT=`ml-auto ${pT}`,bT=`grid min-h-0 flex-1 grid-cols-4 gap-2`,xT=`flex min-h-0 flex-1 flex-col gap-2`,ST=`flex gap-4 ${mT}`,CT=e=>`flex items-baseline gap-1.5 whitespace-nowrap touch:relative touch:after:absolute touch:after:-inset-x-1.5 touch:after:-top-1 touch:after:-bottom-3 touch:after:content-[''] ${e?`font-bold text-accent`:`text-muted`}`,wT={in_progress:`text-accent`,parked:`text-warning`,done:`text-success`},TT=e=>`flex min-h-0 flex-col rounded-md border-hairline border-line p-2 ${e?`flex-1`:``}`,ET=e=>`m-0 mb-2 flex justify-between gap-2 font-mono text-meta font-bold normal-nums ${wT[e]??`text-muted`}`,DT=`flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto`,OT=`m-0 ${mT}`,kT=e=>`flex flex-none cursor-pointer flex-col gap-1 rounded-sm border-hairline bg-surface px-2.5 py-2 ${e.selected?`border-accent`:e.attention?`border-warning`:`border-line hover:border-line-active`}`,AT=`flex justify-between gap-2`,jT=e=>`min-w-0 font-bold wrap-anywhere ${e?`text-muted`:``}`,MT=`h-[2.8em] overflow-hidden whitespace-pre-wrap wrap-anywhere ${pT}`,NT=`flex justify-between gap-2 ${mT}`,PT=`w-[min(680px,calc(100vw-32px))]!`,FT=`flex items-baseline gap-3.5`,IT=`flex items-baseline gap-2.5`,LT=`tracking-[0] normal-case`,RT=`min-h-40 font-mono`,zT=`flex flex-col items-start gap-0.5`,BT=e=>`text-left font-mono text-meta whitespace-pre-wrap normal-nums ${e?`font-bold text-accent`:`font-normal text-muted`}`,VT=pT,HT=`flex flex-col gap-1 [&_p]:m-0`,UT=`flex gap-2 ${mT}`,WT=`min-w-[4ch] text-right`,GT=`rounded-sm border-hairline border-transparent p-1 focus:border-accent focus:outline-none`,KT={choice:`radiogroup`,list:`listbox`,cells:`group`};function qT(e){return(0,L.jsx)(`div`,{ref:e.fieldRef,role:KT[e.kind??`choice`],tabIndex:0,"aria-label":e.label,className:`${GT} ${e.className??``}`,onKeyDown:e.onKeyDown,onClick:e.onClick,children:e.children})}var JT=[`open`,`doing`,`hold`,`done`];function YT({model:e,taskId:t}){let{kanban:n}=LC(),[r,i]=(0,h.useState)(null);return(0,h.useEffect)(()=>{let n=!0;return e.client.request(`task.events`,{taskId:t}).then(e=>n&&i(e.events)).catch(()=>n&&i([])),()=>{n=!1}},[e,t]),(0,L.jsxs)(`div`,{className:HT,children:[(0,L.jsx)(`h2`,{className:`${z} text-muted`,children:n.detail.eventsLabel}),r===null?(0,L.jsx)(`p`,{className:`text-muted`,children:n.detail.eventsLoading}):r.length===0?(0,L.jsx)(`p`,{className:`text-muted`,children:n.detail.eventsNone}):r.map(e=>(0,L.jsxs)(`div`,{className:`mono ${UT}`,children:[(0,L.jsx)(`span`,{className:`text-muted ${WT}`,children:Kw(e.at)}),(0,L.jsx)(`span`,{children:e.kind}),e.tail&&(0,L.jsx)(`span`,{className:`text-muted`,children:e.tail})]},`${e.at}:${e.kind}:${e.tail}`))]})}function XT(e){let{kanban:t}=LC(),{issue:n,mode:r}=e,i=r===`create`,a=!i&&n.taskId?n.taskId:null,o=i||!a&&n.status!==`done`,[s,c]=(0,h.useState)(n.title),[l,u]=(0,h.useState)(n.body),[d,f]=(0,h.useState)(n.status),[p,m]=(0,h.useState)(e.defaultEngine),[g,_]=(0,h.useState)(dT[0]),[v,y]=(0,h.useState)(!1),[b,x]=(0,h.useState)(!1),S=(0,h.useRef)({}),C=e=>t=>{S.current[e]=t},w=i?`title`:o?`workspace`:a?`open`:`title`;(0,h.useEffect)(()=>S.current[w]?.focus(),[w]);let T=()=>({title:s.trim()||n.title,body:l,status:d}),E=()=>({engine:p,placement:g,jump:v}),D=t=>{Pn(),t&&e.onOutcome(t)},O=()=>s.trim()?!0:(S.current.title?.focus(),!1),k=()=>{i?O()&&D({kind:`create`,title:s.trim(),body:l,start:E()}):o?D({kind:`start`,...E(),...T()}):a&&D({kind:`open`,taskId:a,...T()})},ee=()=>{i&&O()&&D({kind:`create`,title:s.trim(),body:l,start:null})},A=()=>D(i?null:{kind:`close`,...T()}),te=(0,h.useRef)({commit:k,saveOnly:ee,close:A});te.current={commit:k,saveOnly:ee,close:A},(0,h.useEffect)(()=>{let e=e=>{let t=e.key===`Escape`?te.current.close:e.key===`Enter`&&(e.ctrlKey||e.metaKey)?te.current.commit:e.key.toLowerCase()===`s`&&e.ctrlKey&&!e.metaKey?te.current.saveOnly:null;t&&(e.preventDefault(),e.stopImmediatePropagation(),t())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},[]);let ne=async t=>{let n=t.find(e=>e.size>Rc);if(n){H(F(`pages.attachTooLarge`,{name:n.name||n.type}),`error`);return}x(!0);try{let n=await Promise.all(t.map(t=>Gc(e.model.client,t)));u(e=>Hc(e,n))}catch(e){H(U(e),`error`)}finally{x(!1)}},j=e=>{let t=Array.from(e.clipboardData.files);t.length!==0&&(e.preventDefault(),ne(t))},re=e=>{let t=Array.from(e.dataTransfer.files);e.preventDefault(),t.length>0&&ne(t)},M=(e,t,n)=>e[(Math.max(0,e.indexOf(t))+n+e.length)%e.length],N=(e,t,n)=>r=>{if(r.ctrlKey||r.metaKey||r.altKey)return;let i=(e===`x`?{ArrowRight:1,l:1,ArrowLeft:-1,h:-1}:{ArrowDown:1,ArrowUp:-1})[r.key];if(i)t(i);else if(r.key===`Enter`&&n)n();else return;r.preventDefault()},ie=d===`done`?`text-success`:d===`hold`?`text-warning`:d===`doing`?`text-accent`:`text-muted`,ae=e=>t.detail.status[e];return(0,L.jsx)(`div`,{className:Wn,onMouseDown:e=>e.target===e.currentTarget&&te.current.close(),children:(0,L.jsxs)(`dialog`,{open:!0,className:`${Gn(!0)} ${PT}`,"aria-label":i?t.detail.newStory:`#${n.id}`,onPaste:j,onDrop:re,onDragOver:e=>e.preventDefault(),children:[(0,L.jsxs)(`div`,{className:Kn,children:[i?(0,L.jsx)(`h1`,{className:`${z} text-muted`,children:t.detail.newStory}):(0,L.jsxs)(`h1`,{className:`${z} text-muted ${FT}`,children:[(0,L.jsxs)(`span`,{children:[`#`,n.id]}),(0,L.jsx)(`span`,{className:ie,children:ae(d)}),(0,L.jsx)(`span`,{className:`text-muted`,children:$(t.detail.created,{date:n.created})}),a&&(0,L.jsx)(`span`,{className:`text-accent`,children:t.detail.linked})]}),(0,L.jsx)(`button`,{type:`button`,className:Jn,"aria-label":F(`dialog.close`),title:F(`dialog.close`),onClick:()=>te.current.close(),children:`×`})]}),(0,L.jsxs)(`div`,{className:Yn,children:[(0,L.jsxs)(`label`,{className:zn,children:[(0,L.jsx)(`span`,{className:`${z} text-muted`,children:t.detail.titleLabel}),(0,L.jsx)(`input`,{ref:C(`title`),className:ln,spellCheck:!1,value:s,onChange:e=>c(e.target.value.replace(/[\r\n]+/g,` `)),onKeyDown:e=>{e.key===`Enter`&&!e.ctrlKey&&!e.metaKey&&(e.preventDefault(),S.current.description?.focus())}})]}),(0,L.jsxs)(`label`,{className:zn,children:[(0,L.jsxs)(`span`,{className:`${z} text-muted ${IT}`,children:[t.detail.description,(0,L.jsx)(`span`,{className:`text-muted ${LT}`,children:cl()?F(`pages.attachHintTouch`):t.detail.attachHint}),b&&(0,L.jsx)(`span`,{className:`text-accent`,children:`…`})]}),(0,L.jsx)(`textarea`,{ref:C(`description`),className:`${ln} ${Bn} ${RT}`,rows:8,spellCheck:!1,placeholder:t.detail.noDescription,value:l,onChange:e=>u(e.target.value)})]}),!i&&(0,L.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsxs)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted flex items-baseline gap-2.5`,children:[t.detail.statusLabel,(0,L.jsx)(`span`,{className:`keys-only text-muted tracking-[0] normal-case`,children:`←/→`})]}),(0,L.jsx)(qT,{fieldRef:C(`status`),label:t.detail.statusLabel,className:`flex flex-wrap gap-1.5`,onKeyDown:N(`x`,e=>f(M(JT,d,e))),children:JT.map(e=>(0,L.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-pressed":e===d,className:Hn(e===d),onClick:()=>{f(e),S.current.status?.focus()},children:ae(e)},e))})]}),o?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:zn,children:[(0,L.jsxs)(`span`,{className:`${z} text-muted ${IT}`,children:[t.detail.engine,(0,L.jsx)(`span`,{className:`keys-only text-muted ${LT}`,children:`←/→`})]}),(0,L.jsx)(qT,{fieldRef:C(`engine`),label:t.detail.engine,className:Vn,onKeyDown:N(`x`,t=>m(M(e.engines.map(e=>e.id),p,t)),k),children:e.engines.map(e=>(0,L.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-pressed":e.id===p,className:Hn(e.id===p),onClick:()=>{m(e.id),S.current.engine?.focus()},children:e.name},e.id))})]}),(0,L.jsxs)(`div`,{className:zn,children:[(0,L.jsxs)(`span`,{className:`${z} text-muted ${IT}`,children:[t.detail.workspace,(0,L.jsx)(`span`,{className:`keys-only text-muted ${LT}`,children:`↑/↓`})]}),(0,L.jsx)(qT,{fieldRef:C(`workspace`),label:t.detail.workspace,className:zT,onKeyDown:N(`y`,e=>_(M(dT,g,e)),k),children:dT.map(e=>(0,L.jsxs)(`button`,{type:`button`,tabIndex:-1,"aria-pressed":e===g,className:`touch:py-1.5 ${BT(e===g)}`,onClick:()=>{_(e),S.current.workspace?.focus()},children:[e===g?`▸ `:` `,t.detail.placement[e]]},e))})]}),(0,L.jsxs)(`div`,{className:zn,children:[(0,L.jsxs)(`span`,{className:`${z} text-muted ${IT}`,children:[t.detail.jumpLabel,(0,L.jsx)(`span`,{className:`keys-only text-muted ${LT}`,children:`←/→`})]}),(0,L.jsx)(qT,{fieldRef:C(`jump`),label:t.detail.jumpLabel,className:Vn,onKeyDown:N(`x`,()=>y(!v),k),children:[!1,!0].map(e=>(0,L.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-pressed":e===v,className:Hn(e===v),onClick:()=>{y(e),S.current.jump?.focus()},children:e?t.detail.jump.follow:t.detail.jump.stay},String(e)))})]}),(0,L.jsx)(`p`,{className:`touch:empty:hidden! text-muted ${VT}`,children:(0,L.jsx)($d,{text:dl(i?t.detail.createLegend:t.detail.startLegend)})}),(0,L.jsxs)(`div`,{className:un,children:[i&&(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:ee,children:F(`pages.storySave`)}),(0,L.jsx)(`button`,{type:`button`,className:Be(),onClick:k,children:F(i?`pages.storySaveStart`:`pages.storyStart`)})]})]}):a?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:zn,children:[(0,L.jsx)(`span`,{className:`${z} text-muted`,children:t.detail.sessionLabel}),(0,L.jsxs)(`div`,{className:`${Vn} ${GT}`,children:[(0,L.jsx)(`button`,{ref:C(`open`),type:`button`,className:Hn(!0),onClick:()=>D({kind:`open`,taskId:a,...T()}),children:t.detail.openAction}),(0,L.jsx)(`button`,{ref:C(`unlink`),type:`button`,className:Hn(),onClick:()=>D({kind:`unlink`,...T()}),children:t.detail.unlinkAction})]})]}),(0,L.jsx)(YT,{model:e.model,taskId:a}),(0,L.jsx)(`p`,{className:`touch:empty:hidden! text-muted ${VT}`,children:(0,L.jsx)($d,{text:dl(t.detail.openLegend)})})]}):(0,L.jsx)(`p`,{className:`touch:empty:hidden! text-muted ${VT}`,children:(0,L.jsx)($d,{text:dl(t.detail.doneNote)})})]})]})})}var ZT={"waiting-on-you":`text-error`,landing:`text-success`,"ready-for-review":`text-ink`,working:`text-accent`};function QT(e){let[t,n]=(0,h.useState)(()=>{let t=J(e,`engines.list`);return t?xl(t.engines):[]});return(0,h.useEffect)(()=>{X(e,`engines.list`).then(e=>n(xl(e.engines))).catch(()=>n([]))},[e]),{engines:t,defaultEngine:Sl(t)}}function $T(e,t){let n=UC(e),r=n.join(`
37
- `),[i,a]=(0,h.useState)(()=>J(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])=>HC(e,n,t)).then(e=>Promise.all(e.map(e=>r.request(`issue.list`,{repo:e}).catch(t=>({repoRoot:e,nextId:1,issues:[],readError:zC(t)}))))).then(n=>{let r=Y(e,`kanban.boards`,void 0,[...n].sort((e,t)=>e.repoRoot.localeCompare(t.repoRoot)));t&&a(r)}),()=>{t=!1}},[e,t,r]),i}function eE(e){let{issue:t}=e,n=t.body.trim();return(0,L.jsxs)(`div`,{"data-issue":t.id,className:kT({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,L.jsxs)(`div`,{className:AT,children:[(0,L.jsx)(`span`,{className:jT(e.column===`done`),children:t.title}),(0,L.jsxs)(`span`,{className:`mono text-muted`,children:[`#`,t.id]})]}),(0,L.jsx)(`div`,{className:`text-muted ${MT}`,children:n}),(0,L.jsxs)(`div`,{className:`mono text-muted ${NT}`,children:[(0,L.jsx)(`span`,{children:t.created}),e.badge&&(0,L.jsx)(`span`,{className:e.badge.tone,children:e.badge.label})]})]})}var tE=5e3,nE=760;function rE({model:e}){let{kanban:t,group:n,common:r}=LC(),[i,a]=GC(tE),o=$T(e,i),{engines:s,defaultEngine:c}=QT(e),l=_(e.tasks),u=WC(e),[d,f]=(0,h.useState)(null),[p,m]=(0,h.useState)(null),g=JC(),[v,y]=(0,h.useState)(!1);(0,h.useEffect)(()=>{let e=g.current;if(!e)return;let t=new ResizeObserver(()=>y(e.clientWidth<nE));return t.observe(e),()=>t.disconnect()},[g]);let b=o??[],x=u?b.find(e=>e.repoRoot.replace(/^\/private\//,`/`)===u.replace(/^\/private\//,`/`)):void 0,S=Math.max(0,b.findIndex(e=>e.repoRoot===(d??x?.repoRoot))),C=b[S],w=b.map(e=>e.repoRoot),T=b.filter(e=>e.readError).map(e=>`${e.repoRoot}\0${e.readError}`).join(`
38
- `);(0,h.useEffect)(()=>{for(let e of b)e.readError&&H($(t.readFailedToast,{repo:VC(e.repoRoot,w),error:e.readError}),`error`)},[T]);let E=l?.tasks??[],D=new Set(E.map(e=>e.id)),O=e=>E.find(t=>t.id===e)?.group,{columns:k,attentionCount:ee}=cT(C?uT(C.issues,D.size===0?void 0:e=>D.has(e)):[],e=>O(e)===`waiting-on-you`),A={backlog:t.column.backlog,in_progress:t.column.inProgress,parked:t.column.parked,done:t.column.done},te=(e,t)=>{let r=e.taskId&&(t===`in_progress`||t===`parked`)?O(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:ZT[r]??`text-muted`}:null},ne=async(t,n,r,i)=>{try{return await e.client.request(t,{repo:C?.repoRoot,...n})}catch(e){return H($(r,{id:String(i),error:zC(e)}),`error`),null}finally{a()}},j=(e,n)=>ne(`issue.setStatus`,{id:e.id,status:n},t.statusFailed,e.id),re=t=>{V.set(null),e.select(t)},M=async(n,r,i)=>{try{let a=await fT(e.client,{repo:n,issue:r,engine:i.engine,placement:i.placement});for(let e of a.warnings)H($(e.kind===`link`?t.linkFailed:t.statusFailed,{id:String(r.id),error:e.error}),`error`);i.jump?(V.set(null),e.selectWhenListed(a.taskId),a.tabId&&await e.refreshTabsNow(a.taskId).then(()=>e.select(a.taskId,a.tabId))):H($(t.detail.startedBackground,{title:`#${r.id} ${r.title}`}))}catch(e){H(U(e),`error`)}finally{a()}},N=async(e,n)=>{if(!C||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 ne(`issue.update`,{id:e.id,...r},t.updateFailed,e.id),n.status!==e.status&&await j(e,n.status),n.kind===`open`?re(n.taskId):n.kind===`unlink`?await ne(`issue.update`,{id:e.id,task:`none`},t.unlinkFailed,e.id):n.kind===`start`&&await M(C.repoRoot,{...e,...r},n)},ie=t=>{C&&(m(t.id),B.set((0,L.jsx)(XT,{model:e,issue:t,mode:`detail`,engines:s,defaultEngine:c,onOutcome:e=>void N(t,e)})))},ae=()=>{if(!C)return;let n=C.repoRoot,r={id:C.nextId,title:``,status:`open`,created:new Date().toISOString().slice(0,10),body:``};B.set((0,L.jsx)(XT,{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 M(n,o,i.start)}catch(e){H($(t.createFailed,{error:zC(e)}),`error`)}})()}}))},oe=()=>{let n=C?.issues.find(e=>e.id===p);if(!C||!n)return;let i=C.repoRoot;B.set((0,L.jsx)(Or,{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){H($(t.deleteFailed,{id:String(n.id),error:zC(e)}),`error`)}finally{a()}}}))},se=e=>{b.length!==0&&(f(b[(S+e+b.length)%b.length]?.repoRoot??null),m(null))},ce=e=>{let t=oT(k,p,e);t!=null&&m(t)},P=e=>k.some(e=>e.issues.length>0)?ce(e):se(e===`left`?-1:1);qC(e=>{if(e.ctrlKey)return e.key===`c`&&(V.set(null),!0);switch(e.key){case`Escape`:case`q`:return V.set(null),!0;case`r`:return a(),!0;case`Tab`:return se(e.shiftKey?-1:1),!0;case`ArrowUp`:return ce(`up`),!0;case`ArrowDown`:return ce(`down`),!0;case`ArrowRight`:case`l`:return P(`right`),!0;case`ArrowLeft`:case`h`:return P(`left`),!0;case`Enter`:{let e=C?.issues.find(e=>e.id===p);return e&&ie(e),!0}case`n`:return ae(),!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),mn.set({x:n,y:r,items:JT.filter(t=>t!==e.status).map(n=>({label:$(t.menu.setStatus,{status:t.detail.status[n]}),run:()=>void j(e,n)}))})},de=k.find(e=>e.issues.some(e=>e.id===p))??k.find(e=>e.issues.length>0)??k[0],fe=(e,n=!1)=>{let r=$(t.attention,{count:String(ee)});return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`span`,{children:[A[e.key],` (`,e.issues.length+e.hiddenCount,`)`]}),e.key===`in_progress`&&ee>0&&(0,L.jsx)(`span`,{className:`text-warning`,title:n?r:void 0,children:n?`!${ee}`:r})]})},pe=(e,n)=>(0,L.jsxs)(`section`,{className:TT(!n),children:[n&&(0,L.jsx)(`h2`,{className:ET(e.key),children:fe(e)}),(0,L.jsxs)(`div`,{className:DT,children:[e.issues.map(t=>(0,L.jsx)(eE,{issue:t,column:e.key,selected:t.id===p,badge:te(t,e.key),onSelect:()=>m(t.id),onOpen:()=>ie(t),onMenu:(e,n)=>ue(t,e,n)},t.id)),e.issues.length===0&&e.hiddenCount===0&&(0,L.jsx)(`p`,{className:`mono text-muted ${OT}`,children:t.columnEmpty}),e.hiddenCount>0&&(0,L.jsx)(`p`,{className:`mono text-muted ${OT}`,children:$(t.more,{count:String(e.hiddenCount)})})]})]},e.key);return(0,L.jsxs)(`div`,{className:`${Ey} ${hT}`,tabIndex:0,ref:g,children:[(0,L.jsxs)(`div`,{className:`kb-top`,children:[(0,L.jsx)(`h1`,{className:Oy,children:t.title}),(0,L.jsx)(`span`,{className:`mono keys-only text-muted`,children:t.hint}),(0,L.jsxs)(`span`,{className:`mono ${jy}`,children:[(0,L.jsx)(`button`,{type:`button`,className:`${sn} ${My.kanban}`,disabled:!C,onClick:ae,children:F(`pages.new`)}),(0,L.jsx)(`button`,{type:`button`,className:`${sn} ${My.kanban}`,disabled:!C?.issues.some(e=>e.id===p),onClick:oe,children:F(`pages.delete`)})]})]}),o===null?(0,L.jsx)(`p`,{className:`text-muted`,children:t.loading}):C?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:gT,children:[(0,L.jsxs)(`button`,{type:`button`,className:_T,onClick:()=>se(1),children:[VC(C.repoRoot,w),b.length>1&&(0,L.jsx)(`span`,{className:`text-muted`,children:` ${S+1}/${b.length}`})]}),!v&&(0,L.jsx)(`span`,{className:`mono text-muted ${vT}`,children:C.repoRoot}),C.issues.length===0&&!C.readError&&(0,L.jsx)(`span`,{className:`text-muted ${yT}`,children:t.empty})]}),C.readError?(0,L.jsx)(`p`,{className:`text-error`,children:$(t.readFailed,{error:C.readError})}):v&&de?(0,L.jsxs)(`div`,{className:xT,ref:le,children:[(0,L.jsx)(`div`,{className:`mono ${ST}`,children:k.map(e=>(0,L.jsx)(`button`,{type:`button`,className:CT(e.key===de.key),onClick:()=>{let t=e.issues[0];t&&m(t.id)},children:fe(e,!0)},e.key))}),pe(de,!1)]}):(0,L.jsx)(`div`,{className:bT,ref:le,children:k.map(e=>pe(e,!0))})]}):(0,L.jsx)(`p`,{className:`text-muted`,children:t.noRepos})]})}var iE={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})`},aE={title:`Mods`,empty:`当前没有 mod 在绘制内容。`,emptyHint:`声明了 [mod] 的插件会在这里绘制面板,TUI 和 web 显示的是同一份。`,keys:`↑↓/tab 移动 · enter 按下 · esc 返回`,pressFailed:`{plugin}:按键没有送达 mod({reason})`},oE={info:`text-info`,success:`text-success`,warning:`text-warning`,error:`text-error`,muted:`text-muted`},sE=`flex flex-col gap-3`,cE=`[&_p]:mx-0 [&_p]:my-1`,lE=`rounded-md border-hairline border-line px-3 pt-2 pb-3 font-mono`,uE=`mb-2 text-meta leading-[inherit] text-ink`,dE=(e,t)=>`flex min-w-0 items-start ${e?`[&>form]:flex-[1_1_12em] [&>form]:self-center`:``} ${t?`rounded-sm border-hairline border-line`:``}`,fE=(e,t)=>`whitespace-pre-wrap wrap-anywhere ${e?oE[e]:`text-ink`} ${t?`font-bold`:``}`,pE=(e,t)=>`cursor-pointer rounded-sm border-hairline border-current px-2.5 py-0.5 [font:inherit] font-bold! ${oE[e]} ${t?`bg-[color-mix(in_srgb,currentcolor_18%,transparent)]`:`bg-transparent [&:hover]:bg-[color-mix(in_srgb,currentcolor_18%,transparent)]`}`,mE=`flex min-w-0 max-w-[40em] self-stretch`,hE=`w-full font-mono`,gE=[0,6,12,20];function _E(e){return`mod-${e.kind}:${e.plugin}/${e.pane}/${e.key}`}function vE(e){let[t,n]=(0,h.useState)(e.value??``);return(0,L.jsx)(`form`,{className:mE,onSubmit:r=>{r.preventDefault(),e.onSubmit(t),n(e.value??``)},children:(0,L.jsx)(`input`,{id:e.id,className:`${ln} ${hE}`,spellCheck:!1,value:t,placeholder:e.placeholder,onFocus:e.onFocus,onChange:e=>n(e.target.value)})})}function yE(e){let{node:t}=e;if(t.type===`text`)return(0,L.jsx)(`span`,{className:fE(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,L.jsx)(vE,{id:_E(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,L.jsx)(`button`,{type:`button`,id:_E(n),className:pE(t.tone??`info`,Gi(n,e.cursor)),onFocus:()=>e.onFocus(n),onClick:()=>e.onPress(n),children:t.label})}return(0,L.jsx)(`div`,{className:dE(t.direction===`row`,t.border===!0),style:{flexDirection:t.direction??`column`,gap:gE[t.gap??0],padding:gE[t.padding??0]},children:t.children.map((t,n)=>(0,L.jsx)(yE,{...e,node:t},n))})}function bE({model:e}){let t=I()===`zh`?aE:iE,n=_(e.mods),r=Wi(n),[i,a]=(0,h.useState)(null),o=Ki(r,i),s=JC(),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=>H(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=qi(r,o,e);a(t),t&&document.getElementById(_E(t))?.focus()};return qC(e=>{if(e.ctrlKey)return e.key===`c`&&(V.set(null),!0);switch(e.key){case`Escape`:case`q`:return V.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,L.jsxs)(`div`,{className:`${Dy} ${sE}`,tabIndex:0,ref:s,children:[(0,L.jsxs)(`div`,{className:ky,children:[(0,L.jsx)(`h1`,{className:Oy,children:t.title}),(0,L.jsx)(`span`,{className:`keys-only touch:empty:hidden! text-muted ${Ay(!1)}`,children:t.keys})]}),n.length===0?(0,L.jsxs)(`div`,{className:cE,children:[(0,L.jsx)(`p`,{children:t.empty}),(0,L.jsx)(`p`,{className:`text-muted`,children:t.emptyHint})]}):n.map(e=>(0,L.jsxs)(`section`,{className:lE,children:[(0,L.jsxs)(`header`,{className:uE,children:[e.title,` `,(0,L.jsx)(`span`,{className:`text-muted`,children:e.plugin})]}),(0,L.jsx)(yE,{node:e.tree,pane:e,cursor:o,onPress:u,onSubmit:d,onFocus:a})]},`${e.plugin}/${e.id}`))]})}function xE(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 SE(e){return e===`dispatch_failed`||e===`skipped_unavailable`||e===`script_failed`}function CE(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 wE=6e4,TE=3294,EE=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]]),DE=new Map([[`SUN`,0],[`MON`,1],[`TUE`,2],[`WED`,3],[`THU`,4],[`FRI`,5],[`SAT`,6]]),OE=256;function kE(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 AE(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=kE(t,e.names,e.field),c=kE(i,e.names,e.field)}else s=kE(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 jE(e){if(e.length>OE)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:AE({value:n,min:0,max:59,field:`minute`}),hours:AE({value:r,min:0,max:23,field:`hour`}),daysOfMonth:AE({value:i,min:1,max:31,field:`day-of-month`}),months:AE({value:a,min:1,max:12,field:`month`,names:EE}),daysOfWeek:AE({value:o,min:0,max:7,field:`weekday`,names:DE,normalize:e=>e%7}),dayOfMonthRestricted:!i.startsWith(`*`),dayOfWeekRestricted:!o.startsWith(`*`)}}function ME(e){try{return jE(e),!0}catch{return!1}}function NE(e,t,n){return new Date(e.year,e.month-1,e.day,t,n,0,0).getTime()}function PE(e){let t=new Date(e);return{year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()}}function FE(e,t){return PE(new Date(e.year,e.month-1,e.day+t,12,0,0,0).getTime())}function IE(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 LE(e){return e-e%wE}function RE(e,t){return[...e].sort((e,n)=>(e-n)*t)}function zE(e,t){let n=jE(e),r=RE(n.hours,1),i=RE(n.minutes,1),a=new Date(LE(t)+wE),o=PE(a.getTime()),s=a.getHours(),c=a.getMinutes();for(let e=0;e<TE;e++){if(IE(n,o)){for(let e of r)if(!(e<s))for(let n of i){if(e===s&&n<c)continue;let r=NE(o,e,n);if(r>t)return r}}o=FE(o,1),s=0,c=0}throw Error(`cron expression never matches: ${e}`)}var BE=[`minute`,`hour`,`dayOfMonth`,`month`,`dayOfWeek`];function VE(e){let t=e.trim().split(/\s+/).filter(Boolean);return BE.map((e,n)=>t[n]??`*`)}function HE(e){return BE.map((t,n)=>e[n]??`*`).join(` `)}var UE=[`*`,`*/5`,`*/10`,`*/15`,`*/30`,...YE(0,59)],WE=[`*`,`*/2`,`*/3`,`*/4`,`*/6`,`*/12`,...YE(0,23)],GE=[`*`,...YE(1,31)],KE=[`*`,`JAN`,`FEB`,`MAR`,`APR`,`MAY`,`JUN`,`JUL`,`AUG`,`SEP`,`OCT`,`NOV`,`DEC`],qE=[`*`,`MON-FRI`,`SAT,SUN`,`MON`,`TUE`,`WED`,`THU`,`FRI`,`SAT`,`SUN`],JE=[`MON`,`TUE`,`WED`,`THU`,`FRI`,`SAT`,`SUN`];function YE(e,t){let n=[];for(let r=e;r<=t;r++)n.push(String(r));return n}var XE={minute:UE,hour:WE,dayOfMonth:GE,month:KE,dayOfWeek:qE};function ZE(e,t,n){let r=XE[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 QE(e,t){return Math.min(Math.max(e+t,0),BE.length-1)}function $E(e,t,n){let r=VE(e);return t<0||t>=BE.length||(r[t]=n),HE(r)}function eD(e,t){let[n,r,i,a,o]=VE(e);if(a!==`*`||i!==`*`||n===void 0||r===void 0||o===void 0)return null;let s=tD(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=JE.find(e=>e===o.toUpperCase());return u?t(`automations.schedule.onWeekday`,{weekday:t(`automations.schedule.dow.${u}`),at:c}):null}function tD(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 nD(e,t,n,r){let i=e.trim();if(!ME(i))return{kind:`invalid`};let a;try{a=zE(i,t)}catch{return{kind:`never`}}return{kind:`ok`,nextRunMs:a,relative:rD(a-t,n),absolute:iD(a,t,n,r)}}function rD(e,t){let{minutes:n,hours:r,days:i}=Gw(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 iD(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 aD(e,t){let n=t?.trim()??``;return n&&e?.effortLevels?.includes(n)?n:``}function oD(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:_}=Er();(0,h.useEffect)(()=>{Promise.all([t.client.request(`engines.list`),e.current()]).then(([e,t])=>{let n=xl(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(aD(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(aD(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,L.jsx)(Tr,{title:W(`tasks`,`changeEngine.title`),wide:!0,children:(0,L.jsxs)(`form`,{className:Yn,onKeyDown:T,onSubmit:e=>{e.preventDefault(),E()},children:[(0,L.jsx)(`ul`,{className:Un,"aria-label":W(`tasks`,`changeEngine.title`),children:n.map(e=>(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{type:`button`,"aria-pressed":e.id===o,className:vr({selected:e.id===o}),onClick:()=>S(e.id),children:[(0,L.jsx)(`span`,{className:`${Sr} text-accent`,children:e.id===o?`●`:` `}),(0,L.jsx)(`span`,{className:yr,children:e.name}),e.id===i.engine&&(0,L.jsx)(`span`,{className:`text-muted`,children:W(`tasks`,`changeEngine.current`)})]})},e.id))}),f&&v&&v.acceptsModel&&(0,L.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:W(`tasks`,`engineModel.label`)}),(0,L.jsx)(`input`,{className:ln,spellCheck:!1,placeholder:W(`tasks`,`engineModel.placeholder`),value:u,onChange:e=>d(e.target.value)}),x.length>0&&(0,L.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:x.map(e=>(0,L.jsx)(`button`,{type:`button`,className:Hn(),onClick:()=>d(e),children:e},e))})]}),b.length>0&&(0,L.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:W(`tasks`,`changeEngine.effortLabel`)}),(0,L.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:b.map(e=>(0,L.jsx)(`button`,{type:`button`,"aria-pressed":e===c,className:Hn(e===c),onClick:()=>l(e),children:e===``?W(`tasks`,`changeEngine.noEffort`):e},e||`default`))})]}),(0,L.jsx)(`p`,{className:`keys-only ${tn}`,children:(0,L.jsx)($d,{text:[W(`tasks`,`changeEngine.footer.engine`),...v?.acceptsModel?[W(`tasks`,`changeEngine.footer.model`)]:[],...b.length>0?[W(`tasks`,`changeEngine.footer.effort`)]:[],W(`tasks`,`changeEngine.footer.set`),W(`tasks`,`changeEngine.footer.cancel`)].join(` · `)})}),g&&(0,L.jsx)(`p`,{className:`text-error`,children:g}),(0,L.jsx)(Ar,{busy:m||!f,submitLabel:F(`taskops.set`)})]})})}var sD=`flex flex-col overflow-hidden @container`,cD=`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`,lD=`flex min-h-0 flex-col gap-3 overflow-y-auto scrollbar-none rt-narrow:shrink-0 rt-narrow:overflow-visible`,uD=`flex gap-1.5 px-2 pt-0 pb-1`,dD=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`}`,fD=`flex min-w-0 items-baseline gap-2.5`,pD=e=>`min-w-0 flex-1 truncate font-bold ${e?`text-muted`:``}`,mD=`whitespace-nowrap text-meta`,hD=`truncate text-meta`,gD=`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)]`,_D=`flex flex-wrap items-baseline justify-between gap-3`,vD=`font-sans text-display font-bold normal-nums wrap-anywhere`,yD=`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`,bD=`max-h-[12lh] overflow-y-auto rounded-sm bg-inset px-2.5 py-2 whitespace-pre-wrap wrap-anywhere`,xD=`min-w-0 text-meta leading-[inherit]`,SD=`flex w-full min-w-0 gap-2 text-inherit`,CD=SD,wD=`${SD} cursor-pointer border-none bg-transparent p-0 text-left font-[inherit] [&:hover]:underline`,TD=`min-w-0 flex-1 truncate`,ED=`[&+&]:mt-1.5`,DD=e=>`whitespace-pre-wrap wrap-anywhere text-meta ${e?``:`leading-[inherit]`}`,OD=`text-meta`,kD=`flex gap-4.5`,AD=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`}`,jD=`hidden gap-2 px-1 pt-0.5 pb-1.5 touch:flex`,MD=`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 ND(e){let t=e.client,[n,r]=(0,h.useState)(()=>J(t,`pendingStart.list`)?.starts??[]);if((0,h.useEffect)(()=>{let e=!0;return X(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){H($(F(`pages.laterCancelFailed`),{error:zC(e)}),`error`)}};return(0,L.jsxs)(`section`,{"data-field":`later`,className:`mt-2.5`,children:[(0,L.jsxs)(`h2`,{className:`${z} ${uD} text-muted`,children:[F(`pages.laterStarts`),` `,(0,L.jsx)(`span`,{className:`mono`,children:n.length})]}),n.map(e=>(0,L.jsxs)(`div`,{className:dD(!1),children:[(0,L.jsxs)(`span`,{className:fD,children:[(0,L.jsx)(`span`,{className:pD(!1),children:e.title}),(0,L.jsx)(`span`,{className:`mono text-muted ${mD}`,title:new Date(e.at).toLocaleString(),children:em(new Date(e.at))}),(0,L.jsx)(R,{className:`font-mono`,hit:`tight`,onClick:()=>void a(e),children:F(`pages.laterCancel`)})]}),(0,L.jsx)(`span`,{className:`mono text-muted ${hD}`,children:VC(e.repo,i)}),e.error&&(0,L.jsx)(`span`,{className:`mono text-warning truncate text-meta`,title:e.error,children:$(F(`pages.laterFailed`),{error:e.error})})]},e.id))]})}var PD={name:``,repo:``,prompt:``,schedule:`0 9 * * MON-FRI`};function FD(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))&&ME(e.schedule.trim())}function ID(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`:ME(e.schedule.trim())?null:`schedule`}function LD(e){let{auto:t,common:n}=LC(),r=RC(),i=I()===`zh`?`zh-CN`:`en-US`,[a,o]=(0,h.useState)(()=>({...PD,repo:e.repos.find(t=>e.defaultRepo&&BC(t)===BC(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(),Pn())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},[]);let m=()=>{if(FD(a)){Pn(),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=ID(a);n&&(d.current[n]?.focus(),u(Reflect.get(t.missing,n)))},g=a.repo===null?[]:e.tasks.filter(e=>BC(e.repo)===BC(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=VE(a.schedule),w=e=>{let t=BE[s];t&&p({schedule:$E(a.schedule,s,ZE(t,C[s]??`*`,e))})},T=e=>{if(!(e.ctrlKey||e.metaKey||e.altKey)){if(e.key===`ArrowLeft`||e.key===`h`)c(QE(s,-1));else if(e.key===`ArrowRight`||e.key===`l`)c(QE(s,1));else if(e.key===`ArrowUp`||e.key===`ArrowDown`)w(e.key===`ArrowUp`?1:-1);else return;e.preventDefault()}},E=nD(a.schedule,Date.now(),r,i),D=eD(a.schedule,r);return(0,L.jsx)(`div`,{className:Wn,onMouseDown:e=>e.target===e.currentTarget&&Pn(),children:(0,L.jsxs)(`dialog`,{open:!0,className:`${Gn(!0)} ${PT}`,"aria-label":t.newTitle,children:[(0,L.jsx)(`h1`,{className:`${z} text-muted`,children:t.newTitle}),(0,L.jsxs)(`div`,{className:Yn,children:[(0,L.jsxs)(`label`,{className:zn,children:[(0,L.jsx)(`span`,{className:`${z} text-muted`,children:t.fieldName}),(0,L.jsx)(`input`,{ref:f(`name`),className:ln,spellCheck:!1,placeholder:t.namePlaceholder,value:a.name,onChange:e=>p({name:e.target.value}),onKeyDown:S(`repo`)})]}),(0,L.jsxs)(`div`,{className:zn,children:[(0,L.jsxs)(`span`,{className:`${z} text-muted ${IT}`,children:[t.fieldRepo,(0,L.jsx)(`span`,{className:`keys-only text-muted ${LT}`,children:`↑/↓`})]}),(0,L.jsx)(qT,{fieldRef:f(`repo`),kind:`list`,label:t.fieldRepo,className:zT,onKeyDown:x(b),children:y.map(t=>(0,L.jsxs)(`button`,{type:`button`,tabIndex:-1,"aria-selected":t===a.repo,className:`touch:py-1.5 ${BT(t===a.repo)}`,onClick:()=>{p({repo:t,target:void 0}),d.current.repo?.focus()},children:[t===a.repo?`▸ `:` `,t===null?F(`rail.noProject`):VC(t,e.repos)]},t??``))})]}),(0,L.jsxs)(`div`,{className:zn,children:[(0,L.jsxs)(`span`,{className:`${z} text-muted ${IT}`,children:[t.fieldTarget,(0,L.jsx)(`span`,{className:`keys-only text-muted ${LT}`,children:`↑/↓`})]}),(0,L.jsx)(qT,{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,L.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:t.fieldTargetTab}),(0,L.jsx)(`input`,{ref:f(`targetTab`),className:ln,spellCheck:!1,value:a.target.tabId,onChange:e=>a.target&&p({target:{...a.target,tabId:e.target.value}}),onKeyDown:S(`prompt`)})]}),(0,L.jsxs)(`label`,{className:zn,children:[(0,L.jsx)(`span`,{className:`${z} text-muted`,children:t.fieldPrompt}),(0,L.jsx)(`input`,{ref:f(`prompt`),className:ln,spellCheck:!1,placeholder:t.promptPlaceholder,value:a.prompt,onChange:e=>p({prompt:e.target.value}),onKeyDown:S(`schedule`)})]}),(0,L.jsxs)(`div`,{className:zn,children:[(0,L.jsxs)(`span`,{className:`${z} text-muted ${IT}`,children:[t.fieldSchedule,(0,L.jsx)(`span`,{className:`keys-only text-muted ${LT}`,children:`←/→ ↑/↓`})]}),(0,L.jsx)(qT,{fieldRef:f(`schedule`),kind:`cells`,label:t.fieldSchedule,className:kD,onKeyDown:T,children:BE.map((e,n)=>(0,L.jsxs)(`button`,{type:`button`,tabIndex:-1,className:AD(n===s),onClick:()=>{c(n),d.current.schedule?.focus()},children:[C[n]??`*`,(0,L.jsx)(`span`,{children:t.cronField[e]})]},e))}),(0,L.jsx)(`div`,{className:jD,children:[-1,1].map(e=>{let n=t.cronField[BE[s]??`minute`]??``;return(0,L.jsx)(`button`,{type:`button`,tabIndex:-1,className:MD,"aria-label":F(e<0?`pages.cronDown`:`pages.cronUp`,{field:n}),onClick:()=>{w(e),d.current.schedule?.focus()},children:e<0?`−`:`+`},e)})}),E.kind===`ok`?(0,L.jsxs)(`p`,{className:`mono text-success`,children:[D?`${D}, `:``,E.relative,`, `,E.absolute]}):(0,L.jsx)(`p`,{className:`mono text-error`,children:E.kind===`never`?t.cronNever:t.cronInvalid})]}),l&&(0,L.jsxs)(`p`,{className:`text-error`,children:[`※ `,l]}),(0,L.jsx)(`p`,{className:`touch:empty:hidden! text-muted ${VT}`,children:(0,L.jsx)($d,{text:dl(t.composerLegend)})}),(0,L.jsxs)(`div`,{className:un,children:[(0,L.jsx)(`button`,{type:`button`,className:sn,onClick:Pn,children:n.cancel}),(0,L.jsx)(`button`,{ref:f(`confirm`),type:`button`,className:Be(),onClick:m,children:n.create})]})]})]})})}var RD=[`ok`,`blocked`,`failed`,`skipped`];function zD(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 BD={scheduled:`schedule`,manual:`manual`,webhook:`webhook`};function VD(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 HD(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 UD(e,t){return e.filter(e=>t===null||zD(e)===t).sort((e,t)=>Date.parse(t.at)-Date.parse(e.at)||t.runNumber-e.runNumber)}function WD(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 GD=(e,t)=>e&&typeof e==`object`?Reflect.get(e,t):void 0;function KD(e){let t=WD(e);if(!t)return{summary:e,full:e};let n=GD(t.value,`error`)??t.value,r=GD(n,`message`),i=GD(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 qD(e){let t=e.trim();if(!/^[[{]/.test(t))return e;try{return JSON.stringify(JSON.parse(t),null,2)}catch{return e}}var JD={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`},YD={success:`text-success`,muted:`text-muted`,warning:`text-warning`,error:`text-error`},XD={success:`✓`,error:`†`,warning:`!`,muted:`·`},ZD=e=>JD[e]??`muted`;function QD(e){let{auto:t}=LC(),{runs:n,when:r}=e,i=e=>t.runStatus[e]??e,a=n.filter(e=>e.response);return(0,L.jsxs)(L.Fragment,{children:[n[0]?.precheckResult&&(0,L.jsx)($D,{run:n[0]}),(0,L.jsx)(`h2`,{className:`${z} text-muted`,children:t.responses}),a.length===0?(0,L.jsx)(`p`,{className:`text-muted`,children:t.noResponses}):a.map(e=>(0,L.jsxs)(`div`,{className:ED,children:[(0,L.jsx)(`p`,{className:`mono ${OD} ${YD[ZD(e.status)]}`,children:`#${e.runNumber} ${i(e.status)}, ${r(e.response?.at)}`}),(0,L.jsx)(`p`,{className:DD(!1),children:qD(e.response?.text??``)})]},e.id))]})}function $D({run:e}){let{auto:t}=LC(),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,L.jsxs)(`div`,{children:[(0,L.jsx)(`h2`,{className:`${z} text-muted`,children:$(t.precheckDetail,{exit:r,duration:String(n.durationMs)})}),i.length===0?(0,L.jsx)(`p`,{className:`text-muted`,children:t.precheckNoOutput}):i.map(e=>(0,L.jsx)(`p`,{className:`mono ${DD(!0)}`,children:`${e.label}: ${e.text.replace(/\s+$/,``).split(`
36
+ `);return r?r.length>pw?`${r.slice(0,pw).trimEnd()}…`:r:null}function hw(e){let t=e.files.filter(e=>e.scope===`working`),n=t.length>0?`working`:`branch`,r=n===`working`?t:e.files.filter(e=>e.scope===`branch`);return{scope:n,files:r,added:r.reduce((e,t)=>e+(t.added??0),0),deleted:r.reduce((e,t)=>e+(t.deleted??0),0)}}async function gw(e,t,n){let r=new Set(e.tasks.get()?.tasks.map(e=>e.id)),i=0;try{for(let a of t.filter(e=>r.has(e)))await e.act(`task.archive`,{taskId:a,archived:!0,...n?{force:!0}:{}}),i++}catch(e){if(i>0&&H(F(`compare.archived`,{count:i})),e instanceof pd&&e.code===`TASK_BUSY`)throw e;H(F(`compare.archiveFailed`,{error:U(e)}),`error`);return}H(F(`compare.archived`,{count:i}))}async function _w(e,t,n){try{for(let r of n)r.id!==t.id&&r.kept&&await e.act(`task.keep`,{taskId:r.id,kept:!1});await e.act(`task.keep`,{taskId:t.id,kept:!0})}catch(e){H(F(`compare.keepFailed`,{error:U(e)}),`error`);return}H(F(`compare.keptToast`,{title:t.label}));let r=n.filter(e=>e.id!==t.id).map(e=>e.id);r.length!==0&&B.set((0,L.jsx)(Or,{title:F(`compare.archiveTitle`),body:F(`compare.archiveBody`,{count:r.length}),confirmLabel:F(`compare.archiveConfirm`),onConfirm:()=>gw(e,r,!1),escalate:{when:e=>e instanceof pd&&e.code===`TASK_BUSY`,label:F(`compare.archiveBusyConfirm`),title:F(`compare.archiveBusyTitle`),body:()=>F(`compare.archiveBusyBody`),run:()=>gw(e,r,!0)}}))}async function vw(e,t){try{await e.act(`task.keep`,{taskId:t.id,kept:!1}),H(F(`compare.unkeptToast`,{title:t.label}))}catch(e){H(F(`compare.keepFailed`,{error:U(e)}),`error`)}}var yw={title:`ROUTINES`,holdingDaemon:`keeping the daemon awake`,notHolding:`none active`,needAttention:`{count} of {total} need you ·`,paused:`paused`,newTitle:`New routine`,composerLegend:`enter create · tab fields · ←→ ↑↓ edit the focused field · esc cancel`,fieldName:`NAME`,fieldRepo:`REPO`,fieldTarget:`DELIVER TO`,fieldTargetTab:`EXISTING ENGINE TAB`,targetFresh:`New task on each run`,targetStanding:`Routine-owned standing task`,targetStandingNew:`Routine-owned standing task, new conversation each run`,targetExisting:`Existing conversation: {task} / {tab}. Never creates or revives a session.`,fieldPrompt:`PROMPT`,fieldSchedule:`SCHEDULE (FIVE-FIELD CRON)`,namePlaceholder:`weekday dependency audit`,promptPlaceholder:`Audit dependencies and summarize risky changes.`,noProject:`Ungrouped`,cronInvalid:`not a five-field cron`,cronField:{minute:`min`,hour:`hour`,dayOfMonth:`day`,month:`month`,dayOfWeek:`weekday`},schedule:{everyDay:`every day {at}`,weekdays:`weekdays {at}`,weekends:`weekends {at}`,onWeekday:`{weekday} {at}`,everyMinute:`every minute`,everyMinutes:`every {n}m`,everyHours:`every {n}h`,hourlyAt:`hourly at :{minute}`,atClock:`at {time}`,dow:{MON:`Mondays`,TUE:`Tuesdays`,WED:`Wednesdays`,THU:`Thursdays`,FRI:`Fridays`,SAT:`Saturdays`,SUN:`Sundays`}},when:{inMinutes:`in {n}m`,inHours:`in {n}h`,inDays:`in {n}d`,minutesAgo:`{n}m ago`,hoursAgo:`{n}h ago`,now:`now`,justNow:`just now`,dateTime:`{date}, {time}`},runStatus:{dispatched:`dispatched`,revived:`revived`,skipped_cancelled:`cancelled before delivery`,skipped_precheck:`skipped (precheck)`,skipped_blocked:`skipped (task can't use it)`,skipped_missed:`skipped (missed)`,skipped_unavailable:`skipped (unavailable)`,dispatch_failed:`dispatch failed`,ran:`ran`,script_failed:`script failed`},cronNever:`valid, but never fires`,missing:{target:`Choose an existing task.`,targetTab:`Enter an existing tab id, e.g. tab-2.`,name:`Give it a name.`,repo:`Pick a project.`,prompt:`Say what it should do.`,schedule:`That schedule will not run.`},empty:`No routines scheduled.`,loadFailed:`Could not read the routines: {message}`,emptyHint:`Press n to create one.`,precheck:`precheck: {command}`,engineDefault:`default engine`,engineChanged:`{name} now runs on {engine}.`,engineChangedNewSession:`{name} now runs on {engine}. Its next run starts a new session; the earlier one stays as a task.`,lastFailed:`last failed {when}: {reason}`,recentRuns:`RECENT RUNS`,precheckDetail:`WHY IT SKIPPED — precheck {exit} in {duration}ms`,precheckExited:`exited {code}`,precheckTimedOut:`timed out`,precheckStdout:`stdout`,precheckStderr:`stderr`,precheckNoOutput:`(no output)`,noRuns:`Not run yet.`,responses:`RESPONSES`,noResponses:"No run has reported back yet. Agents answer with `routine-respond`.",responseAwaiting:`awaiting response`,responseMissing:`no response`,noSelection:`A routine runs its prompt in a project on a schedule.`,running:`Running {name}…`,ranWith:`{name}: {status}`,latestRunNoTask:`The latest run created no task.`,runNow:`[ run now ]`,deleteTitle:`Delete routine?`,deleteBody:`{name} and its run history will be removed. Tasks it already created are untouched.`,deleteButton:`Delete`,createFailed:`Couldn't create the routine: {error}`,deleteFailed:`Couldn't delete "{name}": {error}`,enableFailed:`"{name}" stays paused: {error}`,disableFailed:`"{name}" stays enabled: {error}`,runFailed:`Couldn't run "{name}" now — schedule unchanged: {error}`},bw={title:`例行任务`,holdingDaemon:`正在保持守护进程常驻`,notHolding:`无启用项`,needAttention:`{total} 个中有 {count} 个需要处理 ·`,paused:`已暂停`,newTitle:`新建例行任务`,composerLegend:`enter 创建 · tab 切字段 · ←→ ↑↓ 编辑当前字段 · esc 取消`,fieldName:`名称`,fieldTarget:`投递目标`,fieldTargetTab:`既有引擎标签页`,targetFresh:`每次新建任务`,targetStanding:`例行任务自有的常驻任务`,targetStandingNew:`例行任务自有的常驻任务,每次运行新开对话`,targetExisting:`既有会话:{task} / {tab}。不会创建或重启会话。`,fieldRepo:`仓库`,fieldPrompt:`提示词`,fieldSchedule:`调度(五段 cron)`,namePlaceholder:`工作日依赖审计`,promptPlaceholder:`审计依赖并总结有风险的变更。`,noProject:`未分组`,cronInvalid:`不是合法的五段 cron`,cronField:{minute:`分`,hour:`时`,dayOfMonth:`日`,month:`月`,dayOfWeek:`星期`},schedule:{everyDay:`每天{at}`,weekdays:`工作日{at}`,weekends:`周末{at}`,onWeekday:`{weekday}{at}`,everyMinute:`每分钟`,everyMinutes:`每 {n} 分钟`,everyHours:`每 {n} 小时`,hourlyAt:`每小时的 :{minute}`,atClock:`{time}`,dow:{MON:`每周一`,TUE:`每周二`,WED:`每周三`,THU:`每周四`,FRI:`每周五`,SAT:`每周六`,SUN:`每周日`}},when:{inMinutes:`{n} 分钟后`,inHours:`{n} 小时后`,inDays:`{n} 天后`,minutesAgo:`{n} 分钟前`,hoursAgo:`{n} 小时前`,now:`即将`,justNow:`刚刚`,dateTime:`{date} {time}`},runStatus:{dispatched:`已派发`,revived:`已重启会话`,skipped_cancelled:`交付前已取消`,skipped_precheck:`已跳过(预检)`,skipped_blocked:`已跳过(任务暂不能接收)`,skipped_missed:`已跳过(错过时间)`,skipped_unavailable:`已跳过(不可用)`,dispatch_failed:`派发失败`,ran:`已运行`,script_failed:`脚本失败`},cronNever:`语法合法,但永远不会触发`,missing:{target:`请选择既有任务。`,targetTab:`请输入既有标签页 ID,例如 tab-2。`,name:`起个名字。`,repo:`选一个项目。`,prompt:`说明它要做什么。`,schedule:`这个调度不会触发。`},empty:`还没有例行任务。`,loadFailed:`读不到例行任务:{message}`,emptyHint:`按 n 新建一条。`,precheck:`预检:{command}`,engineDefault:`默认引擎`,engineChanged:`{name} 已改用 {engine}。`,engineChangedNewSession:`{name} 已改用 {engine}。下次运行会新开会话,原来的会话保留为任务。`,lastFailed:`上次失败({when}):{reason}`,recentRuns:`最近执行`,precheckDetail:`为什么跳过 —— 预检{exit},耗时 {duration}ms`,precheckExited:`退出码 {code}`,precheckTimedOut:`超时`,precheckStdout:`标准输出`,precheckStderr:`标准错误`,precheckNoOutput:`(无输出)`,noRuns:`尚未执行。`,responses:`回报`,noResponses:"还没有执行回报。agent 用 `routine-respond` 回报。",responseAwaiting:`等待回报`,responseMissing:`未回报`,noSelection:`例行任务会按调度在某个项目里跑它的提示词。`,running:`正在运行 {name}…`,ranWith:`{name}:{status}`,latestRunNoTask:`最近一次执行没有创建任务。`,runNow:`[ 立即运行 ]`,deleteTitle:`删除这条例行任务?`,deleteBody:`将删除 {name} 及其执行记录。它已经创建的任务不受影响。`,deleteButton:`删除`,createFailed:`创建例行任务失败:{error}`,deleteFailed:`删除“{name}”失败:{error}`,enableFailed:`“{name}”仍处于暂停状态:{error}`,disableFailed:`“{name}”仍处于启用状态:{error}`,runFailed:`无法立即运行“{name}”——排程未受影响:{error}`},xw={title:`Kanban`,hint:`tab project · ←↓↑→ card · enter detail · n new · d delete · r refresh · esc close`,loading:`Loading issues…`,noRepos:"No projects yet — add one with `rove add <path>`, or file a story with `rove api issue-create`.",empty:"No issues — agents file them via `rove api issue-create`.",readFailed:"Couldn't read this project's stories: {error}. Run `rove doctor`, then reopen Kanban.",readFailedToast:`Couldn't read stories for {repo}: {error}`,columnEmpty:`No cards`,column:{backlog:`Backlog`,inProgress:`In progress`,parked:`Parked`,done:`Done`},more:`+{count} more`,attention:`{count} need you`,turnComplete:`turn done`,menu:{setStatus:`status → {status}`},detail:{status:{open:`open`,doing:`doing`,hold:`hold`,done:`done`},statusLabel:`STATUS`,created:`created {date}`,linked:`linked to a session`,titleLabel:`TITLE`,description:`DESCRIPTION`,noDescription:`No description.`,attachHint:`paste a path / ctrl+v screenshot → inserts an image placeholder`,engine:`ENGINE`,workspace:`WORKSPACE`,placement:{worktree:`New worktree task — its own workspace`,projectWorktree:`New worktree — as a chattab in the project workspace`,project:`Project checkout — a new chattab, no worktree`},jumpLabel:`AFTER START`,jump:{stay:`Stay on the board`,follow:`Jump to the session`},startLegend:`enter/ctrl+enter start · tab fields · ←→ status/engine · ↑↓ workspace · esc save & close`,sessionLabel:`SESSION`,openAction:`Open the linked session ↵`,unlinkAction:`Unlink`,openLegend:`enter open the focused action · tab fields · ←→ status · unlink returns the card to Backlog · esc save & close`,eventsLabel:`EVENTS`,eventsLoading:`Loading events…`,eventsNone:`No engine events recorded yet.`,doneNote:`Done stories have nothing left to start — set the status back to reopen one · esc save & close`,startedBackground:`Started in background: {title}`,newStory:`NEW STORY`,createLegend:`ctrl+s save · enter/ctrl+enter save & start · tab fields · esc cancel`},confirmDelete:{title:`Delete story #{id}?`,body:`“{title}” will be removed from the tracker. A linked task, branch, or worktree is left untouched.`},deleteFailed:`Couldn't delete story #{id}: {error}`,createFailed:`Couldn't create the story: {error}`,updateFailed:`Couldn't save story #{id}: {error}`,statusFailed:`Story #{id} stays in its old column: {error}`,linkFailed:`Story #{id} isn't linked to its task: {error}`,unlinkFailed:`Story #{id} is still linked: {error}`},Sw={title:`看板`,hint:`tab 切项目 · ←↓↑→ 选卡片 · enter 详情 · n 新建 · d 删除 · r 刷新 · esc 关闭`,loading:`正在加载 issues…`,noRepos:"还没有项目——用 `rove add <路径>` 添加一个,或用 `rove api issue-create` 创建一个 story。",empty:"暂无 issue——agent 可通过 `rove api issue-create` 创建。",readFailed:"读取该项目的 story 失败:{error}。请运行 `rove doctor`,再重新打开看板。",readFailedToast:`读取 {repo} 的 story 失败:{error}`,columnEmpty:`暂无卡片`,column:{backlog:`待办`,inProgress:`进行中`,parked:`搁置`,done:`已完成`},more:`还有 {count} 条`,attention:`{count} 张等你处理`,turnComplete:`回合完成`,menu:{setStatus:`状态 → {status}`},detail:{status:{open:`待办`,doing:`进行中`,hold:`搁置`,done:`已完成`},statusLabel:`状态`,created:`创建于 {date}`,linked:`已关联会话`,titleLabel:`标题`,description:`描述`,noDescription:`暂无描述。`,attachHint:`粘贴路径 / ctrl+v 贴截图 → 插入图片占位行`,engine:`引擎`,workspace:`工作区`,placement:{worktree:`新建 worktree 任务——独立工作区`,projectWorktree:`新建 worktree——作为项目工作区里的 chattab`,project:`项目主目录——新开 chattab,不建 worktree`},jumpLabel:`启动后`,jump:{stay:`留在看板`,follow:`跳转到会话`},startLegend:`enter/ctrl+enter 启动 · tab 切字段 · ←→ 状态/引擎 · ↑↓ 工作区 · esc 保存关闭`,sessionLabel:`会话`,openAction:`打开关联会话 ↵`,unlinkAction:`解除关联`,openLegend:`enter 执行选中操作 · tab 切字段 · ←→ 状态 · 解除关联把卡片退回 Backlog · esc 保存关闭`,eventsLabel:`事件`,eventsLoading:`正在加载事件…`,eventsNone:`暂无引擎事件记录。`,doneNote:`已完成的 story 无需启动——改回状态即可重新打开 · esc 保存关闭`,startedBackground:`已在后台启动:{title}`,newStory:`新建 STORY`,createLegend:`ctrl+s 仅保存 · enter/ctrl+enter 保存并启动 · tab 切字段 · esc 取消`},confirmDelete:{title:`删除 story #{id}?`,body:`「{title}」将从 tracker 中移除。已关联的任务、分支、worktree 不受影响。`},deleteFailed:`删除 story #{id} 失败:{error}`,createFailed:`创建 story 失败:{error}`,updateFailed:`保存 story #{id} 失败:{error}`,statusFailed:`Story #{id} 仍留在原来的列:{error}`,linkFailed:`Story #{id} 未能关联到它的任务:{error}`,unlinkFailed:`Story #{id} 仍处于关联状态:{error}`},Cw={title:`ISSUES`,noRepo:`no project`,empty:`No open issues.`,assignedFilter:`assigned to me`,starting:`Starting work on #{number}…`,startedNoEngine:`Created {title}, but its engine did not start.`,linkedChip:`→ {title}`,openingLinked:`Opening {title}…`,startFailed:`Couldn't start work on #{number}: {error}`,errorHint:{noRemote:"Add a GitHub remote (`git remote add origin <url>`) and try again, or press q / esc to close.",ghMissing:"Install the `gh` CLI and authenticate, or press q / esc to close.",auth:"Run `gh auth login`, or press q / esc to close.",fallback:`{message} · press q / esc to close`}},ww={title:`议题`,noRepo:`无项目`,empty:`没有开放的议题。`,assignedFilter:`分配给我的`,starting:`正在开始处理 #{number}…`,startedNoEngine:`已创建 {title},但引擎没有启动。`,linkedChip:`→ {title}`,openingLinked:`正在打开 {title}…`,startFailed:`开始处理 #{number} 失败:{error}`,errorHint:{noRemote:"添加 GitHub remote(`git remote add origin <url>`)后重试,或按 q / esc 关闭。",ghMissing:"安装 `gh` CLI 并登录,或按 q / esc 关闭。",auth:"执行 `gh auth login`,或按 q / esc 关闭。",fallback:`{message} · 按 q / esc 关闭`}};function Tw(){let e=I()===`zh`;return{kanban:e?Sw:xw,auto:e?bw:yw,items:e?ww:Cw,nav:(e?Yr:Jr).nav,group:(e?Yr:Jr).group,common:e?Nr:Mr}}function $(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e))}function Ew(){let{auto:e}=Tw();return(t,n)=>{let r=e;for(let e of t.replace(/^automations\./,``).split(`.`))r=r&&typeof r==`object`?Reflect.get(r,e):void 0;return typeof r==`string`?n?$(r,n):r:t}}function Dw(e){return e instanceof Error?e.message:String(e)}function Ow(e){return e.replace(/^\/private\//,`/`).replace(/\/+$/,``)}function kw(e,t){let n=e.split(`/`).filter(Boolean),r=n[n.length-1]??e;return t.some(t=>t!==e&&t.split(`/`).filter(Boolean).pop()===r)&&n.length>1?`${n[n.length-2]}/${r}`:r}function Aw(...e){let t=new Set,n=[];for(let r of e.flat()){if(!r||r.startsWith(`ssh://`))continue;let e=Ow(r);t.has(e)||(t.add(e),n.push(r))}return n}function jw(e){return Aw((_(e.tasks)?.tasks??[]).filter(e=>!xu(e)).map(e=>e.repo))}function Mw(e){let t=_(e.tasks),{taskId:n}=_(e.selection);return t?.tasks.find(e=>e.id===n)?.repo}function Nw(e){let[t,n]=(0,h.useState)(0);return(0,h.useEffect)(()=>jr(e,()=>n(e=>e+1)),[e]),[t,(0,h.useCallback)(()=>n(e=>e+1),[])]}function Pw(e){return e instanceof HTMLElement?e.isContentEditable||[`INPUT`,`TEXTAREA`,`SELECT`].includes(e.tagName):!1}function Fw(e){let t=(0,h.useRef)(e);t.current=e,(0,h.useEffect)(()=>{let e=e=>{if(e.defaultPrevented||B.get()||mn.get())return;let n=e.target instanceof HTMLElement?e.target:null;Pw(n)||n?.closest(`.rail, .side-panel, .xterm`)||e.metaKey||e.altKey||e.ctrlKey&&e.key.toLowerCase()===`c`&&window.getSelection()?.toString()||t.current(e)&&(e.preventDefault(),e.stopPropagation())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[])}function Iw(){let e=(0,h.useRef)(null);return(0,h.useEffect)(()=>e.current?.focus(),[]),e}function Lw({tone:e,children:t}){return(0,L.jsx)(`span`,{className:Re(`flex-none font-mono text-meta`,e&&ef[e]),children:t})}var Rw=`mt-3 grid grid-cols-[repeat(auto-fit,minmax(min(100%,17rem),1fr))] items-start gap-x-5 gap-y-6`,zw=e=>e?`flex min-w-0 flex-col gap-2 pt-2 [border-top:var(--hairline)_solid_var(--accent)]`:`flex min-w-0 flex-col gap-2 pt-2 [border-top:var(--hairline)_solid_var(--line)]`,Bw=`flex min-w-0 items-center gap-2`,Vw=`min-w-0 truncate font-bold`,Hw=`truncate font-mono text-meta text-muted`,Uw=`m-0 line-clamp-6 whitespace-pre-wrap wrap-anywhere`,Ww=`flex min-w-0 flex-col`,Gw=`flex min-w-0 items-baseline gap-2 py-px font-mono text-meta`,Kw=`flex flex-wrap gap-x-3.5 gap-y-1 font-mono text-meta`,qw=`flex min-w-0 flex-wrap items-center gap-x-3.5 gap-y-0.5 px-2.5 py-1 font-mono text-meta`,Jw=6;function Yw(e,t){let[n,r]=(0,h.useState)(null),[i,a]=(0,h.useState)(()=>J(e,`diff.files`,{taskId:t.id})??null),o=`${t.rowStatus?.kind??``}:${t.rowStatus?.since??0}`,s=JSON.stringify(t.changes??null);return(0,h.useEffect)(()=>{let n=!0;return X(e,`output.read`,{taskId:t.id,limit:8}).then(e=>n&&r(mw(e)),()=>n&&r(null)),()=>{n=!1}},[e,t.id,o]),(0,h.useEffect)(()=>{let n=!0;return X(e,`diff.files`,{taskId:t.id}).then(e=>n&&a(e),()=>{}),()=>{n=!1}},[e,t.id,s,o]),{reply:n,changes:i?hw(i):null}}function Xw({changes:e,onOpen:t}){if(!e)return(0,L.jsx)(`p`,{className:en,children:`…`});if(e.files.length===0)return(0,L.jsx)(`p`,{className:`m-0 font-mono text-meta text-subtle`,children:F(`compare.noChanges`)});let n=e.files.length-Jw;return(0,L.jsxs)(`div`,{className:Ww,children:[(0,L.jsxs)(`p`,{className:`m-0 flex gap-2 font-mono text-meta text-muted`,children:[(0,L.jsx)(`span`,{children:F(`compare.files`,{count:e.files.length})}),e.added>0&&(0,L.jsxs)(Lw,{tone:`added`,children:[`+`,e.added]}),e.deleted>0&&(0,L.jsxs)(Lw,{tone:`removed`,children:[`−`,e.deleted]})]}),e.files.slice(0,Jw).map(n=>(0,L.jsxs)(R,{variant:`row`,className:`${Gw} text-left [&:hover]:underline`,title:n.path,onClick:()=>t(n.path,e.scope),children:[(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n.path}),n.added?(0,L.jsxs)(Lw,{tone:`added`,children:[`+`,n.added]}):null,n.deleted?(0,L.jsxs)(Lw,{tone:`removed`,children:[`−`,n.deleted]}):null]},n.path)),n>0&&(0,L.jsx)(`span`,{className:`font-mono text-meta text-subtle`,children:F(`compare.more`,{count:n})})]})}function Zw({model:e,row:t,round:n}){let{reply:r,changes:i}=Yw(e,t),{look:a}=_b(t.rowStatus),o=t.kept===!0,s=(n,r)=>{e.select(t.id),Fs({taskId:t.id,path:n,scope:r})};return(0,L.jsxs)(`section`,{className:zw(o),"data-attempt":t.id,children:[(0,L.jsxs)(`div`,{className:Bw,children:[(0,L.jsx)($b,{status:t.rowStatus}),(0,L.jsx)(`span`,{className:Vw,children:t.engine?.name??t.label}),(0,L.jsx)(`span`,{className:`flex-none text-meta text-muted`,children:F(`compare.status.${a}`)}),o&&(0,L.jsx)(`span`,{className:`ml-auto flex-none font-mono text-meta text-accent`,children:F(`compare.kept`)})]}),(0,L.jsx)(`span`,{className:Hw,title:t.branch,children:t.branch}),r?(0,L.jsx)(`p`,{className:Uw,children:r}):(0,L.jsx)(`p`,{className:`m-0 text-muted`,children:F(`compare.noReply`)}),(0,L.jsx)(Xw,{changes:i,onOpen:s}),(0,L.jsxs)(`div`,{className:Kw,children:[(0,L.jsx)(R,{hit:`tight`,onClick:()=>e.select(t.id),children:F(`compare.terminal`)}),(0,L.jsx)(R,{hit:`tight`,onClick:()=>s(`.`,i?.scope??`working`),children:F(`compare.diff`)}),o?(0,L.jsx)(R,{hit:`tight`,onClick:()=>void vw(e,t),children:F(`compare.unkeep`)}):(0,L.jsx)(R,{hit:`tight`,onClick:()=>void _w(e,t,n),children:F(`compare.keep`)})]})]})}function Qw({model:e}){I();let t=_(bn),n=_(e.tasks),r=Iw(),i=t&&n?fw(n.tasks,t):[];return(0,L.jsxs)(`div`,{className:Ay,tabIndex:0,ref:r,onKeyDown:e=>{e.metaKey||e.ctrlKey||e.altKey||e.key!==`q`&&e.key!==`Escape`||(e.preventDefault(),V.set(null))},children:[(0,L.jsx)(`h1`,{className:jy,children:F(`compare.title`)}),i.length===0?(0,L.jsx)(`p`,{className:`text-muted`,children:F(`compare.empty`)}):(0,L.jsx)(`div`,{className:Rw,children:i.map(t=>(0,L.jsx)(Zw,{model:e,row:t,round:i},t.id))})]})}function $w(e){let t=Math.floor(e/6e4),n=Math.floor(t/60);return{minutes:t,hours:n,days:Math.floor(n/24)}}function eT(e,t=Date.now()){let n=Math.max(0,t-e),r=Math.floor(n/1e3);if(r<60)return`${r}s`;let{minutes:i,hours:a,days:o}=$w(n);return i<60?`${i}m`:a<24?`${a}h`:`${o}d`}var tT=[{id:`issues`,label:`reviewQueue.sourceIssues`},{id:`reviews`,label:`reviewQueue.sourceReviews`}];function nT(){I();let e=_(Ig);return(0,L.jsx)(`span`,{className:`flex items-baseline gap-3 font-mono text-meta`,children:tT.map(t=>t.id===e?(0,L.jsx)(`span`,{className:`text-ink`,children:F(t.label)},t.id):(0,L.jsx)(R,{onClick:()=>Ig.set(t.id),children:F(t.label)},t.id))})}var rT={passing:`reviewQueue.checksPassing`,failing:`reviewQueue.checksFailing`,pending:`reviewQueue.checksPending`},iT={missing:`reviewQueue.gh.missing`,unauthenticated:`reviewQueue.gh.unauthenticated`,failed:`reviewQueue.gh.failed`};function aT(e){let{pr:t}=e,n=Date.parse(t.createdAt),r=[t.isDraft?F(`reviewQueue.draft`):``,t.fork?F(`reviewQueue.fork`):``,t.checks?F(rT[t.checks]):``];return(0,L.jsxs)(`div`,{"data-row":e.index,className:Ly(e.at),onClick:e.onPick,children:[(0,L.jsxs)(`div`,{className:Ry,children:[(0,L.jsxs)(`span`,{className:`mono ${zy}`,children:[t.nameWithOwner.split(`/`)[1],`#`,t.number]}),(0,L.jsx)(`span`,{className:Vy,children:t.title}),(0,L.jsx)(R,{disabled:e.busy,onClick:e.onReview,children:F(`reviewQueue.start`)})]}),(0,L.jsxs)(`div`,{className:By,children:[(0,L.jsx)(`span`,{className:Vy,children:[t.author,...r].filter(Boolean).join(`, `)}),(0,L.jsxs)(`span`,{className:`mono`,children:[`+`,t.additions,` −`,t.deletions]}),(0,L.jsx)(`span`,{className:`mono`,children:Number.isFinite(n)?eT(n,e.now):``})]})]})}function oT({model:e}){I();let t=e.client,[n,r]=(0,h.useState)(null),[i,a]=(0,h.useState)(null),[o,s]=(0,h.useState)(0),[c,l]=(0,h.useState)(null),[u,d]=(0,h.useState)(null),[f,p]=(0,h.useState)(0),m=(0,h.useRef)(!1),g=Iw(),_=(0,h.useRef)(null);(0,h.useEffect)(()=>{let e=!0,n=m.current;return m.current=!1,a(null),t.request(`review.queue`,n?{refresh:!0}:{}).then(t=>e&&r(t)).catch(t=>{e&&(a(Dw(t)),r({prs:[],other:0}))}),()=>{e=!1}},[t,f]);let v=n?.prs??[],y=Math.min(o,Math.max(0,v.length-1));(0,h.useEffect)(()=>{_.current?.querySelector(`[data-row="${y}"]`)?.scrollIntoView({block:`nearest`})},[y]);let b=async e=>{if(c===null){l(e.number),d(F(`reviewQueue.preparing`,{number:e.number}));try{let{ref:n}=await t.request(`review.prepare`,{repo:e.repo,number:e.number});Dn(Lg(e,n,F(`reviewQueue.prompt`,{number:e.number,repo:e.nameWithOwner,title:e.title,url:e.url,head:e.headRef,base:e.baseRef})))}catch(t){H(F(`reviewQueue.failed`,{number:e.number,error:Dw(t)}),`error`)}finally{l(null),d(null)}}};Fw(e=>{if(e.ctrlKey)return e.key===`c`&&(V.set(null),!0);switch(e.key){case`Escape`:case`q`:return V.set(null),!0;case`j`:case`ArrowDown`:return s(Math.min(v.length-1,y+1)),!0;case`k`:case`ArrowUp`:return s(Math.max(0,y-1)),!0;case`r`:return m.current=!0,p(e=>e+1),!0;case`Enter`:{let e=v[y];return e&&b(e),!0}default:return!1}});let x=Date.now();return(0,L.jsxs)(`div`,{className:Ay,tabIndex:0,ref:g,children:[(0,L.jsxs)(`div`,{className:My,children:[(0,L.jsx)(`h1`,{className:jy,children:F(`reviewQueue.title`)}),(0,L.jsx)(nT,{})]}),i?(0,L.jsx)(`p`,{className:`text-error`,children:i}):n===null?(0,L.jsx)(`p`,{className:`text-muted`,children:`…`}):n.reason?(0,L.jsx)(`p`,{className:`text-muted`,children:F(iT[n.reason])}):v.length===0?(0,L.jsx)(`p`,{className:`text-muted`,children:F(`reviewQueue.empty`)}):(0,L.jsx)(`div`,{className:Iy,ref:_,children:v.map((e,t)=>(0,L.jsx)(aT,{pr:e,index:t,at:t===y,now:x,busy:c!==null,onPick:()=>s(t),onReview:()=>void b(e)},`${e.nameWithOwner}#${e.number}`))}),n&&n.other>0&&(0,L.jsx)(`p`,{className:`text-muted mx-0 mt-2 mb-0 text-meta leading-[inherit]`,children:F(`reviewQueue.other`,{count:n.other})}),u&&(0,L.jsx)(`p`,{className:`text-muted mx-0 mt-2 mb-0 text-meta leading-[inherit]`,children:u})]})}var sT=30;function cT(){let{items:e}=Tw();return t=>{let n=t.indexOf(`: `);switch(n>=0?t.slice(0,n):`failed`){case`no-remote`:return e.errorHint.noRemote;case`gh-missing`:return e.errorHint.ghMissing;case`auth`:return e.errorHint.auth;default:return $(e.errorHint.fallback,{message:t})}}}function lT({model:e}){let{items:t,common:n}=Tw(),r=cT(),i=e.client,a=_(e.tasks),o=jw(e),s=Mw(e),[c,l]=(0,h.useState)(()=>{let e=s?o.findIndex(e=>Ow(e)===Ow(s)):-1;return Math.max(0,e)}),u=o[c],d=(e,t)=>({repo:e,limit:sT,...t?{assignee:`@me`}:{}}),f=e=>Object.fromEntries(e.links.map(e=>[e.number,e.taskId])),[p,m]=(0,h.useState)(()=>u?J(i,`workitem.list`,d(u,!1))?.items??null:null),[g,v]=(0,h.useState)(()=>{let e=u?J(i,`workitem.links`,{repo:u}):void 0;return e?f(e):{}}),[y,b]=(0,h.useState)(null),[x,S]=(0,h.useState)(!1),[C,w]=(0,h.useState)(0),[T,E]=(0,h.useState)(0),[D,O]=(0,h.useState)(!1),[k,ee]=(0,h.useState)(null),A=Iw(),te=(0,h.useRef)(!1);(0,h.useEffect)(()=>{let e=!0;if(!u){m([]);return}b(null);let t=te.current;te.current=!1;let n=d(u,x),r=J(i,`workitem.list`,n);return r&&m(r.items),i.request(`workitem.list`,{...n,...t?{refresh:!0}:{}}).then(t=>e&&m(Y(i,`workitem.list`,n,t).items)).catch(t=>{e&&(b(Dw(t)),m([]))}),X(i,`workitem.links`,{repo:u}).then(t=>e&&v(f(t))).catch(()=>e&&v({})),()=>{e=!1}},[i,u,x,C,a?.tasks.length]);let ne=p??[],j=Math.min(T,Math.max(0,ne.length-1));(0,h.useEffect)(()=>ee(null),[u,x]);let re=(0,h.useRef)(null);(0,h.useEffect)(()=>{re.current?.querySelector(`[data-row="${j}"]`)?.scrollIntoView({block:`nearest`})},[j]);let M=e=>a?.tasks.find(t=>t.id===e)?.label??e,N=t=>{V.set(null),e.select(t)},ie=async()=>{let e=ne[j];if(!e||!u||D)return;let n=g[e.number];if(n){ee($(t.openingLinked,{title:M(n)})),N(n);return}O(!0),ee($(t.starting,{number:e.number}));try{let n=await i.request(`workitem.start`,{repo:u,number:e.number});n.started?N(n.taskId):ee($(t.startedNoEngine,{title:n.title}))}catch(n){H($(t.startFailed,{number:e.number,error:Dw(n)}),`error`)}finally{O(!1)}};Fw(e=>{if(e.ctrlKey)return e.key===`c`&&(V.set(null),!0);switch(e.key){case`Escape`:case`q`:return V.set(null),!0;case`j`:case`ArrowDown`:return E(Math.min(ne.length-1,j+1)),!0;case`k`:case`ArrowUp`:return E(Math.max(0,j-1)),!0;case`Tab`:return l(t=>o.length?(t+(e.shiftKey?o.length-1:1))%o.length:0),!0;case`a`:return S(e=>!e),!0;case`r`:return te.current=!0,w(e=>e+1),!0;case`Enter`:return ie(),!0;default:return!1}});let ae=Date.now();return(0,L.jsxs)(`div`,{className:Ay,tabIndex:0,ref:A,children:[(0,L.jsxs)(`div`,{className:My,children:[(0,L.jsx)(`h1`,{className:jy,children:t.title}),(0,L.jsx)(nT,{}),(0,L.jsxs)(`span`,{className:`mono touch:empty:hidden! text-muted ${Ny(!0)}`,children:[u?kw(u,o):t.noRepo,x?` ${t.assignedFilter}`:``]})]}),y?(0,L.jsxs)(`div`,{className:Iy,children:[(0,L.jsx)(`p`,{className:`text-error`,children:y}),(0,L.jsx)(`p`,{className:`text-muted`,children:r(y)})]}):p===null?(0,L.jsx)(`p`,{className:`text-muted`,children:n.loading}):ne.length===0?(0,L.jsx)(`p`,{className:`text-muted`,children:t.empty}):(0,L.jsx)(`div`,{className:Iy,ref:re,children:ne.map((e,n)=>{let r=g[e.number],i=Date.parse(e.updatedAt);return(0,L.jsxs)(`div`,{"data-row":n,className:Ly(n===j),onClick:()=>n===j?void ie():E(n),children:[(0,L.jsxs)(`div`,{className:Ry,children:[(0,L.jsxs)(`span`,{className:`mono ${zy}`,children:[`#`,e.number]}),(0,L.jsx)(`span`,{children:e.title})]}),(0,L.jsxs)(`div`,{className:By,children:[(0,L.jsx)(`span`,{className:Vy,children:[e.author,...e.labels.slice(0,2)].filter(Boolean).join(`, `)}),r&&(0,L.jsx)(`span`,{children:$(t.linkedChip,{title:M(r)})}),(0,L.jsx)(`span`,{className:`mono`,children:Number.isFinite(i)?eT(i,ae):``})]})]},e.number)})}),k&&(0,L.jsx)(`p`,{className:`text-muted mx-0 mt-2 mb-0 text-meta leading-[inherit]`,children:k})]})}function uT({model:e}){return _(Ig)===`reviews`?(0,L.jsx)(oT,{model:e}):(0,L.jsx)(lT,{model:e})}var dT={backlog:`active`,in_progress:`active`,in_review:`parked`,error:`parked`,done:`terminal`,canceled:`terminal`,open:`active`,doing:`active`,hold:`parked`};function fT(e){return dT[e]??`parked`}var pT=[`backlog`,`in_progress`,`parked`,`done`];function mT(e,t,n){let r=e.find(e=>e.issues.length>0)?.issues[0]?.id??null;if(t==null)return r;let i=-1,a=-1;for(let[n,r]of e.entries()){let e=r.issues.findIndex(e=>e.id===t);if(e!==-1){i=n,a=e;break}}if(i===-1)return r;if(n===`up`||n===`down`){let r=e[i]?.issues??[],o=n===`up`?a-1:a+1;return r[Math.max(0,Math.min(o,r.length-1))]?.id??t}let o=n===`left`?-1:1;for(let n=i+o;n>=0&&n<e.length;n+=o){let r=e[n]?.issues??[];if(r.length!==0)return r[Math.min(a,r.length-1)]?.id??t}return t}function hT(e,t){let n=fT(e.status);return n===`terminal`?`done`:n===`parked`?`parked`:e.taskId!==void 0&&e.taskId!==``&&(t?.(e.taskId)??!0)||e.status===`doing`?`in_progress`:`backlog`}function gT(e,t){let n=0;return{columns:e.map(e=>{if(e.key!==`in_progress`)return e;let r=[],i=[];for(let n of e.issues)n.taskId!==void 0&&n.taskId!==``&&t(n.taskId)?r.push(n):i.push(n);return n=r.length,r.length===0?e:{...e,issues:[...r,...i]}}),attentionCount:n}}function _T(e,t){return e.created===t.created?t.id-e.id:e.created<t.created?1:-1}function vT(e,t){let n={backlog:[],in_progress:[],parked:[],done:[]};for(let r of e)n[hT(r,t)].push(r);return pT.map(e=>{let t=e===`done`||e===`parked`,r=n[e].sort(_T);return!t||r.length<=20?{key:e,issues:r,hiddenCount:0}:{key:e,issues:r.slice(0,20),hiddenCount:r.length-20}})}var yT=[`worktree`,`projectWorktree`,`project`];async function bT(e,t){let n=t.placement===`project`?`project`:`worktree`,{title:r,prompt:i}=await e.request(`issue.prompt`,{repo:t.repo,id:t.issue.id,where:n}),a=[];if(t.placement!==`project`){let{taskId:n}=await e.request(`task.create`,{repo:t.repo,engine:t.engine,title:r,prompt:i});if(await e.request(`issue.update`,{repo:t.repo,id:t.issue.id,task:n}).catch(e=>a.push({kind:`link`,error:Dw(e)})),t.placement===`worktree`)return{taskId:n,warnings:a};let o=await e.request(`task.openMain`,{repo:t.repo}),s=await e.request(`tab.openViewport`,{taskId:o.taskId,viewTaskId:n});return{taskId:o.taskId,tabId:s.tabId,warnings:a}}let{taskId:o}=await e.request(`task.openMain`,{repo:t.repo}),{tabId:s,taskId:c=o}=await e.request(`tab.new`,{taskId:o,kind:`engine`,engine:t.engine,prompt:i});return await e.request(`issue.setStatus`,{repo:t.repo,id:t.issue.id,status:`doing`}).catch(e=>a.push({kind:`status`,error:Dw(e)})),{taskId:c,tabId:s,warnings:a}}var xT=`text-meta leading-[inherit]`,ST=`text-meta`,CT=`flex flex-col gap-2 overflow-hidden`,wT=`flex min-w-0 items-baseline gap-3`,TT=`font-bold whitespace-nowrap text-accent touch:relative touch:after:absolute touch:after:-inset-x-2 touch:after:-inset-y-1 touch:after:content-['']`,ET=`min-w-0 truncate ${ST}`,DT=`ml-auto ${xT}`,OT=`grid min-h-0 flex-1 grid-cols-4 gap-2`,kT=`flex min-h-0 flex-1 flex-col gap-2`,AT=`flex gap-4 ${ST}`,jT=e=>`flex items-baseline gap-1.5 whitespace-nowrap touch:relative touch:after:absolute touch:after:-inset-x-1.5 touch:after:-top-1 touch:after:-bottom-3 touch:after:content-[''] ${e?`font-bold text-accent`:`text-muted`}`,MT={in_progress:`text-accent`,parked:`text-warning`,done:`text-success`},NT=e=>`flex min-h-0 flex-col rounded-md border-hairline border-line p-2 ${e?`flex-1`:``}`,PT=e=>`m-0 mb-2 flex justify-between gap-2 font-mono text-meta font-bold normal-nums ${MT[e]??`text-muted`}`,FT=`flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto`,IT=`m-0 ${ST}`,LT=e=>`flex flex-none cursor-pointer flex-col gap-1 rounded-sm border-hairline bg-surface px-2.5 py-2 ${e.selected?`border-accent`:e.attention?`border-warning`:`border-line hover:border-line-active`}`,RT=`flex justify-between gap-2`,zT=e=>`min-w-0 font-bold wrap-anywhere ${e?`text-muted`:``}`,BT=`h-[2.8em] overflow-hidden whitespace-pre-wrap wrap-anywhere ${xT}`,VT=`flex justify-between gap-2 ${ST}`,HT=`w-[min(680px,calc(100vw-32px))]!`,UT=`flex items-baseline gap-3.5`,WT=`flex items-baseline gap-2.5`,GT=`tracking-[0] normal-case`,KT=`min-h-40 font-mono`,qT=`flex flex-col items-start gap-0.5`,JT=e=>`text-left font-mono text-meta whitespace-pre-wrap normal-nums ${e?`font-bold text-accent`:`font-normal text-muted`}`,YT=xT,XT=`flex flex-col gap-1 [&_p]:m-0`,ZT=`flex gap-2 ${ST}`,QT=`min-w-[4ch] text-right`,$T=`rounded-sm border-hairline border-transparent p-1 focus:border-accent focus:outline-none`,eE={choice:`radiogroup`,list:`listbox`,cells:`group`};function tE(e){return(0,L.jsx)(`div`,{ref:e.fieldRef,role:eE[e.kind??`choice`],tabIndex:0,"aria-label":e.label,className:`${$T} ${e.className??``}`,onKeyDown:e.onKeyDown,onClick:e.onClick,children:e.children})}var nE=[`open`,`doing`,`hold`,`done`];function rE({model:e,taskId:t}){let{kanban:n}=Tw(),[r,i]=(0,h.useState)(null);return(0,h.useEffect)(()=>{let n=!0;return e.client.request(`task.events`,{taskId:t}).then(e=>n&&i(e.events)).catch(()=>n&&i([])),()=>{n=!1}},[e,t]),(0,L.jsxs)(`div`,{className:XT,children:[(0,L.jsx)(`h2`,{className:`${z} text-muted`,children:n.detail.eventsLabel}),r===null?(0,L.jsx)(`p`,{className:`text-muted`,children:n.detail.eventsLoading}):r.length===0?(0,L.jsx)(`p`,{className:`text-muted`,children:n.detail.eventsNone}):r.map(e=>(0,L.jsxs)(`div`,{className:`mono ${ZT}`,children:[(0,L.jsx)(`span`,{className:`text-muted ${QT}`,children:eT(e.at)}),(0,L.jsx)(`span`,{children:e.kind}),e.tail&&(0,L.jsx)(`span`,{className:`text-muted`,children:e.tail})]},`${e.at}:${e.kind}:${e.tail}`))]})}function iE(e){let{kanban:t}=Tw(),{issue:n,mode:r}=e,i=r===`create`,a=!i&&n.taskId?n.taskId:null,o=i||!a&&n.status!==`done`,[s,c]=(0,h.useState)(n.title),[l,u]=(0,h.useState)(n.body),[d,f]=(0,h.useState)(n.status),[p,m]=(0,h.useState)(e.defaultEngine),[g,_]=(0,h.useState)(yT[0]),[v,y]=(0,h.useState)(!1),[b,x]=(0,h.useState)(!1),S=(0,h.useRef)({}),C=e=>t=>{S.current[e]=t},w=i?`title`:o?`workspace`:a?`open`:`title`;(0,h.useEffect)(()=>S.current[w]?.focus(),[w]);let T=()=>({title:s.trim()||n.title,body:l,status:d}),E=()=>({engine:p,placement:g,jump:v}),D=t=>{Pn(),t&&e.onOutcome(t)},O=()=>s.trim()?!0:(S.current.title?.focus(),!1),k=()=>{i?O()&&D({kind:`create`,title:s.trim(),body:l,start:E()}):o?D({kind:`start`,...E(),...T()}):a&&D({kind:`open`,taskId:a,...T()})},ee=()=>{i&&O()&&D({kind:`create`,title:s.trim(),body:l,start:null})},A=()=>D(i?null:{kind:`close`,...T()}),te=(0,h.useRef)({commit:k,saveOnly:ee,close:A});te.current={commit:k,saveOnly:ee,close:A},(0,h.useEffect)(()=>{let e=e=>{let t=e.key===`Escape`?te.current.close:e.key===`Enter`&&(e.ctrlKey||e.metaKey)?te.current.commit:e.key.toLowerCase()===`s`&&e.ctrlKey&&!e.metaKey?te.current.saveOnly:null;t&&(e.preventDefault(),e.stopImmediatePropagation(),t())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},[]);let ne=async t=>{let n=t.find(e=>e.size>Rc);if(n){H(F(`pages.attachTooLarge`,{name:n.name||n.type}),`error`);return}x(!0);try{let n=await Promise.all(t.map(t=>Gc(e.model.client,t)));u(e=>Hc(e,n))}catch(e){H(U(e),`error`)}finally{x(!1)}},j=e=>{let t=Array.from(e.clipboardData.files);t.length!==0&&(e.preventDefault(),ne(t))},re=e=>{let t=Array.from(e.dataTransfer.files);e.preventDefault(),t.length>0&&ne(t)},M=(e,t,n)=>e[(Math.max(0,e.indexOf(t))+n+e.length)%e.length],N=(e,t,n)=>r=>{if(r.ctrlKey||r.metaKey||r.altKey)return;let i=(e===`x`?{ArrowRight:1,l:1,ArrowLeft:-1,h:-1}:{ArrowDown:1,ArrowUp:-1})[r.key];if(i)t(i);else if(r.key===`Enter`&&n)n();else return;r.preventDefault()},ie=d===`done`?`text-success`:d===`hold`?`text-warning`:d===`doing`?`text-accent`:`text-muted`,ae=e=>t.detail.status[e];return(0,L.jsx)(`div`,{className:Wn,onMouseDown:e=>e.target===e.currentTarget&&te.current.close(),children:(0,L.jsxs)(`dialog`,{open:!0,className:`${Gn(!0)} ${HT}`,"aria-label":i?t.detail.newStory:`#${n.id}`,onPaste:j,onDrop:re,onDragOver:e=>e.preventDefault(),children:[(0,L.jsxs)(`div`,{className:Kn,children:[i?(0,L.jsx)(`h1`,{className:`${z} text-muted`,children:t.detail.newStory}):(0,L.jsxs)(`h1`,{className:`${z} text-muted ${UT}`,children:[(0,L.jsxs)(`span`,{children:[`#`,n.id]}),(0,L.jsx)(`span`,{className:ie,children:ae(d)}),(0,L.jsx)(`span`,{className:`text-muted`,children:$(t.detail.created,{date:n.created})}),a&&(0,L.jsx)(`span`,{className:`text-accent`,children:t.detail.linked})]}),(0,L.jsx)(`button`,{type:`button`,className:Jn,"aria-label":F(`dialog.close`),title:F(`dialog.close`),onClick:()=>te.current.close(),children:`×`})]}),(0,L.jsxs)(`div`,{className:Yn,children:[(0,L.jsxs)(`label`,{className:zn,children:[(0,L.jsx)(`span`,{className:`${z} text-muted`,children:t.detail.titleLabel}),(0,L.jsx)(`input`,{ref:C(`title`),className:ln,spellCheck:!1,value:s,onChange:e=>c(e.target.value.replace(/[\r\n]+/g,` `)),onKeyDown:e=>{e.key===`Enter`&&!e.ctrlKey&&!e.metaKey&&(e.preventDefault(),S.current.description?.focus())}})]}),(0,L.jsxs)(`label`,{className:zn,children:[(0,L.jsxs)(`span`,{className:`${z} text-muted ${WT}`,children:[t.detail.description,(0,L.jsx)(`span`,{className:`text-muted ${GT}`,children:cl()?F(`pages.attachHintTouch`):t.detail.attachHint}),b&&(0,L.jsx)(`span`,{className:`text-accent`,children:`…`})]}),(0,L.jsx)(`textarea`,{ref:C(`description`),className:`${ln} ${Bn} ${KT}`,rows:8,spellCheck:!1,placeholder:t.detail.noDescription,value:l,onChange:e=>u(e.target.value)})]}),!i&&(0,L.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsxs)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted flex items-baseline gap-2.5`,children:[t.detail.statusLabel,(0,L.jsx)(`span`,{className:`keys-only text-muted tracking-[0] normal-case`,children:`←/→`})]}),(0,L.jsx)(tE,{fieldRef:C(`status`),label:t.detail.statusLabel,className:`flex flex-wrap gap-1.5`,onKeyDown:N(`x`,e=>f(M(nE,d,e))),children:nE.map(e=>(0,L.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-pressed":e===d,className:Hn(e===d),onClick:()=>{f(e),S.current.status?.focus()},children:ae(e)},e))})]}),o?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:zn,children:[(0,L.jsxs)(`span`,{className:`${z} text-muted ${WT}`,children:[t.detail.engine,(0,L.jsx)(`span`,{className:`keys-only text-muted ${GT}`,children:`←/→`})]}),(0,L.jsx)(tE,{fieldRef:C(`engine`),label:t.detail.engine,className:Vn,onKeyDown:N(`x`,t=>m(M(e.engines.map(e=>e.id),p,t)),k),children:e.engines.map(e=>(0,L.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-pressed":e.id===p,className:Hn(e.id===p),onClick:()=>{m(e.id),S.current.engine?.focus()},children:e.name},e.id))})]}),(0,L.jsxs)(`div`,{className:zn,children:[(0,L.jsxs)(`span`,{className:`${z} text-muted ${WT}`,children:[t.detail.workspace,(0,L.jsx)(`span`,{className:`keys-only text-muted ${GT}`,children:`↑/↓`})]}),(0,L.jsx)(tE,{fieldRef:C(`workspace`),label:t.detail.workspace,className:qT,onKeyDown:N(`y`,e=>_(M(yT,g,e)),k),children:yT.map(e=>(0,L.jsxs)(`button`,{type:`button`,tabIndex:-1,"aria-pressed":e===g,className:`touch:py-1.5 ${JT(e===g)}`,onClick:()=>{_(e),S.current.workspace?.focus()},children:[e===g?`▸ `:` `,t.detail.placement[e]]},e))})]}),(0,L.jsxs)(`div`,{className:zn,children:[(0,L.jsxs)(`span`,{className:`${z} text-muted ${WT}`,children:[t.detail.jumpLabel,(0,L.jsx)(`span`,{className:`keys-only text-muted ${GT}`,children:`←/→`})]}),(0,L.jsx)(tE,{fieldRef:C(`jump`),label:t.detail.jumpLabel,className:Vn,onKeyDown:N(`x`,()=>y(!v),k),children:[!1,!0].map(e=>(0,L.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-pressed":e===v,className:Hn(e===v),onClick:()=>{y(e),S.current.jump?.focus()},children:e?t.detail.jump.follow:t.detail.jump.stay},String(e)))})]}),(0,L.jsx)(`p`,{className:`touch:empty:hidden! text-muted ${YT}`,children:(0,L.jsx)($d,{text:dl(i?t.detail.createLegend:t.detail.startLegend)})}),(0,L.jsxs)(`div`,{className:un,children:[i&&(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:ee,children:F(`pages.storySave`)}),(0,L.jsx)(`button`,{type:`button`,className:Be(),onClick:k,children:F(i?`pages.storySaveStart`:`pages.storyStart`)})]})]}):a?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:zn,children:[(0,L.jsx)(`span`,{className:`${z} text-muted`,children:t.detail.sessionLabel}),(0,L.jsxs)(`div`,{className:`${Vn} ${$T}`,children:[(0,L.jsx)(`button`,{ref:C(`open`),type:`button`,className:Hn(!0),onClick:()=>D({kind:`open`,taskId:a,...T()}),children:t.detail.openAction}),(0,L.jsx)(`button`,{ref:C(`unlink`),type:`button`,className:Hn(),onClick:()=>D({kind:`unlink`,...T()}),children:t.detail.unlinkAction})]})]}),(0,L.jsx)(rE,{model:e.model,taskId:a}),(0,L.jsx)(`p`,{className:`touch:empty:hidden! text-muted ${YT}`,children:(0,L.jsx)($d,{text:dl(t.detail.openLegend)})})]}):(0,L.jsx)(`p`,{className:`touch:empty:hidden! text-muted ${YT}`,children:(0,L.jsx)($d,{text:dl(t.detail.doneNote)})})]})]})})}var aE={"waiting-on-you":`text-error`,landing:`text-success`,"ready-for-review":`text-ink`,working:`text-accent`};function oE(e){let[t,n]=(0,h.useState)(()=>{let t=J(e,`engines.list`);return t?xl(t.engines):[]});return(0,h.useEffect)(()=>{X(e,`engines.list`).then(e=>n(xl(e.engines))).catch(()=>n([]))},[e]),{engines:t,defaultEngine:Sl(t)}}function sE(e,t){let n=jw(e),r=n.join(`
37
+ `),[i,a]=(0,h.useState)(()=>J(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])=>Aw(e,n,t)).then(e=>Promise.all(e.map(e=>r.request(`issue.list`,{repo:e}).catch(t=>({repoRoot:e,nextId:1,issues:[],readError:Dw(t)}))))).then(n=>{let r=Y(e,`kanban.boards`,void 0,[...n].sort((e,t)=>e.repoRoot.localeCompare(t.repoRoot)));t&&a(r)}),()=>{t=!1}},[e,t,r]),i}function cE(e){let{issue:t}=e,n=t.body.trim();return(0,L.jsxs)(`div`,{"data-issue":t.id,className:LT({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,L.jsxs)(`div`,{className:RT,children:[(0,L.jsx)(`span`,{className:zT(e.column===`done`),children:t.title}),(0,L.jsxs)(`span`,{className:`mono text-muted`,children:[`#`,t.id]})]}),(0,L.jsx)(`div`,{className:`text-muted ${BT}`,children:n}),(0,L.jsxs)(`div`,{className:`mono text-muted ${VT}`,children:[(0,L.jsx)(`span`,{children:t.created}),e.badge&&(0,L.jsx)(`span`,{className:e.badge.tone,children:e.badge.label})]})]})}var lE=5e3,uE=760;function dE({model:e}){let{kanban:t,group:n,common:r}=Tw(),[i,a]=Nw(lE),o=sE(e,i),{engines:s,defaultEngine:c}=oE(e),l=_(e.tasks),u=Mw(e),[d,f]=(0,h.useState)(null),[p,m]=(0,h.useState)(null),g=Iw(),[v,y]=(0,h.useState)(!1);(0,h.useEffect)(()=>{let e=g.current;if(!e)return;let t=new ResizeObserver(()=>y(e.clientWidth<uE));return t.observe(e),()=>t.disconnect()},[g]);let b=o??[],x=u?b.find(e=>e.repoRoot.replace(/^\/private\//,`/`)===u.replace(/^\/private\//,`/`)):void 0,S=Math.max(0,b.findIndex(e=>e.repoRoot===(d??x?.repoRoot))),C=b[S],w=b.map(e=>e.repoRoot),T=b.filter(e=>e.readError).map(e=>`${e.repoRoot}\0${e.readError}`).join(`
38
+ `);(0,h.useEffect)(()=>{for(let e of b)e.readError&&H($(t.readFailedToast,{repo:kw(e.repoRoot,w),error:e.readError}),`error`)},[T]);let E=l?.tasks??[],D=new Set(E.map(e=>e.id)),O=e=>E.find(t=>t.id===e)?.group,{columns:k,attentionCount:ee}=gT(C?vT(C.issues,D.size===0?void 0:e=>D.has(e)):[],e=>O(e)===`waiting-on-you`),A={backlog:t.column.backlog,in_progress:t.column.inProgress,parked:t.column.parked,done:t.column.done},te=(e,t)=>{let r=e.taskId&&(t===`in_progress`||t===`parked`)?O(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:aE[r]??`text-muted`}:null},ne=async(t,n,r,i)=>{try{return await e.client.request(t,{repo:C?.repoRoot,...n})}catch(e){return H($(r,{id:String(i),error:Dw(e)}),`error`),null}finally{a()}},j=(e,n)=>ne(`issue.setStatus`,{id:e.id,status:n},t.statusFailed,e.id),re=t=>{V.set(null),e.select(t)},M=async(n,r,i)=>{try{let a=await bT(e.client,{repo:n,issue:r,engine:i.engine,placement:i.placement});for(let e of a.warnings)H($(e.kind===`link`?t.linkFailed:t.statusFailed,{id:String(r.id),error:e.error}),`error`);i.jump?(V.set(null),e.selectWhenListed(a.taskId),a.tabId&&await e.refreshTabsNow(a.taskId).then(()=>e.select(a.taskId,a.tabId))):H($(t.detail.startedBackground,{title:`#${r.id} ${r.title}`}))}catch(e){H(U(e),`error`)}finally{a()}},N=async(e,n)=>{if(!C||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 ne(`issue.update`,{id:e.id,...r},t.updateFailed,e.id),n.status!==e.status&&await j(e,n.status),n.kind===`open`?re(n.taskId):n.kind===`unlink`?await ne(`issue.update`,{id:e.id,task:`none`},t.unlinkFailed,e.id):n.kind===`start`&&await M(C.repoRoot,{...e,...r},n)},ie=t=>{C&&(m(t.id),B.set((0,L.jsx)(iE,{model:e,issue:t,mode:`detail`,engines:s,defaultEngine:c,onOutcome:e=>void N(t,e)})))},ae=()=>{if(!C)return;let n=C.repoRoot,r={id:C.nextId,title:``,status:`open`,created:new Date().toISOString().slice(0,10),body:``};B.set((0,L.jsx)(iE,{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 M(n,o,i.start)}catch(e){H($(t.createFailed,{error:Dw(e)}),`error`)}})()}}))},oe=()=>{let n=C?.issues.find(e=>e.id===p);if(!C||!n)return;let i=C.repoRoot;B.set((0,L.jsx)(Or,{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){H($(t.deleteFailed,{id:String(n.id),error:Dw(e)}),`error`)}finally{a()}}}))},se=e=>{b.length!==0&&(f(b[(S+e+b.length)%b.length]?.repoRoot??null),m(null))},ce=e=>{let t=mT(k,p,e);t!=null&&m(t)},P=e=>k.some(e=>e.issues.length>0)?ce(e):se(e===`left`?-1:1);Fw(e=>{if(e.ctrlKey)return e.key===`c`&&(V.set(null),!0);switch(e.key){case`Escape`:case`q`:return V.set(null),!0;case`r`:return a(),!0;case`Tab`:return se(e.shiftKey?-1:1),!0;case`ArrowUp`:return ce(`up`),!0;case`ArrowDown`:return ce(`down`),!0;case`ArrowRight`:case`l`:return P(`right`),!0;case`ArrowLeft`:case`h`:return P(`left`),!0;case`Enter`:{let e=C?.issues.find(e=>e.id===p);return e&&ie(e),!0}case`n`:return ae(),!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),mn.set({x:n,y:r,items:nE.filter(t=>t!==e.status).map(n=>({label:$(t.menu.setStatus,{status:t.detail.status[n]}),run:()=>void j(e,n)}))})},de=k.find(e=>e.issues.some(e=>e.id===p))??k.find(e=>e.issues.length>0)??k[0],fe=(e,n=!1)=>{let r=$(t.attention,{count:String(ee)});return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`span`,{children:[A[e.key],` (`,e.issues.length+e.hiddenCount,`)`]}),e.key===`in_progress`&&ee>0&&(0,L.jsx)(`span`,{className:`text-warning`,title:n?r:void 0,children:n?`!${ee}`:r})]})},pe=(e,n)=>(0,L.jsxs)(`section`,{className:NT(!n),children:[n&&(0,L.jsx)(`h2`,{className:PT(e.key),children:fe(e)}),(0,L.jsxs)(`div`,{className:FT,children:[e.issues.map(t=>(0,L.jsx)(cE,{issue:t,column:e.key,selected:t.id===p,badge:te(t,e.key),onSelect:()=>m(t.id),onOpen:()=>ie(t),onMenu:(e,n)=>ue(t,e,n)},t.id)),e.issues.length===0&&e.hiddenCount===0&&(0,L.jsx)(`p`,{className:`mono text-muted ${IT}`,children:t.columnEmpty}),e.hiddenCount>0&&(0,L.jsx)(`p`,{className:`mono text-muted ${IT}`,children:$(t.more,{count:String(e.hiddenCount)})})]})]},e.key);return(0,L.jsxs)(`div`,{className:`${ky} ${CT}`,tabIndex:0,ref:g,children:[(0,L.jsxs)(`div`,{className:`kb-top`,children:[(0,L.jsx)(`h1`,{className:jy,children:t.title}),(0,L.jsx)(`span`,{className:`mono keys-only text-muted`,children:t.hint}),(0,L.jsxs)(`span`,{className:`mono ${Py}`,children:[(0,L.jsx)(`button`,{type:`button`,className:`${sn} ${Fy.kanban}`,disabled:!C,onClick:ae,children:F(`pages.new`)}),(0,L.jsx)(`button`,{type:`button`,className:`${sn} ${Fy.kanban}`,disabled:!C?.issues.some(e=>e.id===p),onClick:oe,children:F(`pages.delete`)})]})]}),o===null?(0,L.jsx)(`p`,{className:`text-muted`,children:t.loading}):C?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:wT,children:[(0,L.jsxs)(`button`,{type:`button`,className:TT,onClick:()=>se(1),children:[kw(C.repoRoot,w),b.length>1&&(0,L.jsx)(`span`,{className:`text-muted`,children:` ${S+1}/${b.length}`})]}),!v&&(0,L.jsx)(`span`,{className:`mono text-muted ${ET}`,children:C.repoRoot}),C.issues.length===0&&!C.readError&&(0,L.jsx)(`span`,{className:`text-muted ${DT}`,children:t.empty})]}),C.readError?(0,L.jsx)(`p`,{className:`text-error`,children:$(t.readFailed,{error:C.readError})}):v&&de?(0,L.jsxs)(`div`,{className:kT,ref:le,children:[(0,L.jsx)(`div`,{className:`mono ${AT}`,children:k.map(e=>(0,L.jsx)(`button`,{type:`button`,className:jT(e.key===de.key),onClick:()=>{let t=e.issues[0];t&&m(t.id)},children:fe(e,!0)},e.key))}),pe(de,!1)]}):(0,L.jsx)(`div`,{className:OT,ref:le,children:k.map(e=>pe(e,!0))})]}):(0,L.jsx)(`p`,{className:`text-muted`,children:t.noRepos})]})}var fE={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})`},pE={title:`Mods`,empty:`当前没有 mod 在绘制内容。`,emptyHint:`声明了 [mod] 的插件会在这里绘制面板,TUI 和 web 显示的是同一份。`,keys:`↑↓/tab 移动 · enter 按下 · esc 返回`,pressFailed:`{plugin}:按键没有送达 mod({reason})`},mE={info:`text-info`,success:`text-success`,warning:`text-warning`,error:`text-error`,muted:`text-muted`},hE=`flex flex-col gap-3`,gE=`[&_p]:mx-0 [&_p]:my-1`,_E=`rounded-md border-hairline border-line px-3 pt-2 pb-3 font-mono`,vE=`mb-2 text-meta leading-[inherit] text-ink`,yE=(e,t)=>`flex min-w-0 items-start ${e?`[&>form]:flex-[1_1_12em] [&>form]:self-center`:``} ${t?`rounded-sm border-hairline border-line`:``}`,bE=(e,t)=>`whitespace-pre-wrap wrap-anywhere ${e?mE[e]:`text-ink`} ${t?`font-bold`:``}`,xE=(e,t)=>`cursor-pointer rounded-sm border-hairline border-current px-2.5 py-0.5 [font:inherit] font-bold! ${mE[e]} ${t?`bg-[color-mix(in_srgb,currentcolor_18%,transparent)]`:`bg-transparent [&:hover]:bg-[color-mix(in_srgb,currentcolor_18%,transparent)]`}`,SE=`flex min-w-0 max-w-[40em] self-stretch`,CE=`w-full font-mono`,wE=[0,6,12,20];function TE(e){return`mod-${e.kind}:${e.plugin}/${e.pane}/${e.key}`}function EE(e){let[t,n]=(0,h.useState)(e.value??``);return(0,L.jsx)(`form`,{className:SE,onSubmit:r=>{r.preventDefault(),e.onSubmit(t),n(e.value??``)},children:(0,L.jsx)(`input`,{id:e.id,className:`${ln} ${CE}`,spellCheck:!1,value:t,placeholder:e.placeholder,onFocus:e.onFocus,onChange:e=>n(e.target.value)})})}function DE(e){let{node:t}=e;if(t.type===`text`)return(0,L.jsx)(`span`,{className:bE(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,L.jsx)(EE,{id:TE(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,L.jsx)(`button`,{type:`button`,id:TE(n),className:xE(t.tone??`info`,Gi(n,e.cursor)),onFocus:()=>e.onFocus(n),onClick:()=>e.onPress(n),children:t.label})}return(0,L.jsx)(`div`,{className:yE(t.direction===`row`,t.border===!0),style:{flexDirection:t.direction??`column`,gap:wE[t.gap??0],padding:wE[t.padding??0]},children:t.children.map((t,n)=>(0,L.jsx)(DE,{...e,node:t},n))})}function OE({model:e}){let t=I()===`zh`?pE:fE,n=_(e.mods),r=Wi(n),[i,a]=(0,h.useState)(null),o=Ki(r,i),s=Iw(),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=>H(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=qi(r,o,e);a(t),t&&document.getElementById(TE(t))?.focus()};return Fw(e=>{if(e.ctrlKey)return e.key===`c`&&(V.set(null),!0);switch(e.key){case`Escape`:case`q`:return V.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,L.jsxs)(`div`,{className:`${Ay} ${hE}`,tabIndex:0,ref:s,children:[(0,L.jsxs)(`div`,{className:My,children:[(0,L.jsx)(`h1`,{className:jy,children:t.title}),(0,L.jsx)(`span`,{className:`keys-only touch:empty:hidden! text-muted ${Ny(!1)}`,children:t.keys})]}),n.length===0?(0,L.jsxs)(`div`,{className:gE,children:[(0,L.jsx)(`p`,{children:t.empty}),(0,L.jsx)(`p`,{className:`text-muted`,children:t.emptyHint})]}):n.map(e=>(0,L.jsxs)(`section`,{className:_E,children:[(0,L.jsxs)(`header`,{className:vE,children:[e.title,` `,(0,L.jsx)(`span`,{className:`text-muted`,children:e.plugin})]}),(0,L.jsx)(DE,{node:e.tree,pane:e,cursor:o,onPress:u,onSubmit:d,onFocus:a})]},`${e.plugin}/${e.id}`))]})}function kE(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 AE(e){return e===`dispatch_failed`||e===`skipped_unavailable`||e===`script_failed`}function jE(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 ME=6e4,NE=3294,PE=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]]),FE=new Map([[`SUN`,0],[`MON`,1],[`TUE`,2],[`WED`,3],[`THU`,4],[`FRI`,5],[`SAT`,6]]),IE=256;function LE(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 RE(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=LE(t,e.names,e.field),c=LE(i,e.names,e.field)}else s=LE(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 zE(e){if(e.length>IE)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:RE({value:n,min:0,max:59,field:`minute`}),hours:RE({value:r,min:0,max:23,field:`hour`}),daysOfMonth:RE({value:i,min:1,max:31,field:`day-of-month`}),months:RE({value:a,min:1,max:12,field:`month`,names:PE}),daysOfWeek:RE({value:o,min:0,max:7,field:`weekday`,names:FE,normalize:e=>e%7}),dayOfMonthRestricted:!i.startsWith(`*`),dayOfWeekRestricted:!o.startsWith(`*`)}}function BE(e){try{return zE(e),!0}catch{return!1}}function VE(e,t,n){return new Date(e.year,e.month-1,e.day,t,n,0,0).getTime()}function HE(e){let t=new Date(e);return{year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()}}function UE(e,t){return HE(new Date(e.year,e.month-1,e.day+t,12,0,0,0).getTime())}function WE(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 GE(e){return e-e%ME}function KE(e,t){return[...e].sort((e,n)=>(e-n)*t)}function qE(e,t){let n=zE(e),r=KE(n.hours,1),i=KE(n.minutes,1),a=new Date(GE(t)+ME),o=HE(a.getTime()),s=a.getHours(),c=a.getMinutes();for(let e=0;e<NE;e++){if(WE(n,o)){for(let e of r)if(!(e<s))for(let n of i){if(e===s&&n<c)continue;let r=VE(o,e,n);if(r>t)return r}}o=UE(o,1),s=0,c=0}throw Error(`cron expression never matches: ${e}`)}var JE=[`minute`,`hour`,`dayOfMonth`,`month`,`dayOfWeek`];function YE(e){let t=e.trim().split(/\s+/).filter(Boolean);return JE.map((e,n)=>t[n]??`*`)}function XE(e){return JE.map((t,n)=>e[n]??`*`).join(` `)}var ZE=[`*`,`*/5`,`*/10`,`*/15`,`*/30`,...rD(0,59)],QE=[`*`,`*/2`,`*/3`,`*/4`,`*/6`,`*/12`,...rD(0,23)],$E=[`*`,...rD(1,31)],eD=[`*`,`JAN`,`FEB`,`MAR`,`APR`,`MAY`,`JUN`,`JUL`,`AUG`,`SEP`,`OCT`,`NOV`,`DEC`],tD=[`*`,`MON-FRI`,`SAT,SUN`,`MON`,`TUE`,`WED`,`THU`,`FRI`,`SAT`,`SUN`],nD=[`MON`,`TUE`,`WED`,`THU`,`FRI`,`SAT`,`SUN`];function rD(e,t){let n=[];for(let r=e;r<=t;r++)n.push(String(r));return n}var iD={minute:ZE,hour:QE,dayOfMonth:$E,month:eD,dayOfWeek:tD};function aD(e,t,n){let r=iD[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 oD(e,t){return Math.min(Math.max(e+t,0),JE.length-1)}function sD(e,t,n){let r=YE(e);return t<0||t>=JE.length||(r[t]=n),XE(r)}function cD(e,t){let[n,r,i,a,o]=YE(e);if(a!==`*`||i!==`*`||n===void 0||r===void 0||o===void 0)return null;let s=lD(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=nD.find(e=>e===o.toUpperCase());return u?t(`automations.schedule.onWeekday`,{weekday:t(`automations.schedule.dow.${u}`),at:c}):null}function lD(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 uD(e,t,n,r){let i=e.trim();if(!BE(i))return{kind:`invalid`};let a;try{a=qE(i,t)}catch{return{kind:`never`}}return{kind:`ok`,nextRunMs:a,relative:dD(a-t,n),absolute:fD(a,t,n,r)}}function dD(e,t){let{minutes:n,hours:r,days:i}=$w(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 fD(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 pD(e,t){let n=t?.trim()??``;return n&&e?.effortLevels?.includes(n)?n:``}function mD(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:_}=Er();(0,h.useEffect)(()=>{Promise.all([t.client.request(`engines.list`),e.current()]).then(([e,t])=>{let n=xl(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(pD(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(pD(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,L.jsx)(Tr,{title:W(`tasks`,`changeEngine.title`),wide:!0,children:(0,L.jsxs)(`form`,{className:Yn,onKeyDown:T,onSubmit:e=>{e.preventDefault(),E()},children:[(0,L.jsx)(`ul`,{className:Un,"aria-label":W(`tasks`,`changeEngine.title`),children:n.map(e=>(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{type:`button`,"aria-pressed":e.id===o,className:vr({selected:e.id===o}),onClick:()=>S(e.id),children:[(0,L.jsx)(`span`,{className:`${Sr} text-accent`,children:e.id===o?`●`:` `}),(0,L.jsx)(`span`,{className:yr,children:e.name}),e.id===i.engine&&(0,L.jsx)(`span`,{className:`text-muted`,children:W(`tasks`,`changeEngine.current`)})]})},e.id))}),f&&v&&v.acceptsModel&&(0,L.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:W(`tasks`,`engineModel.label`)}),(0,L.jsx)(`input`,{className:ln,spellCheck:!1,placeholder:W(`tasks`,`engineModel.placeholder`),value:u,onChange:e=>d(e.target.value)}),x.length>0&&(0,L.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:x.map(e=>(0,L.jsx)(`button`,{type:`button`,className:Hn(),onClick:()=>d(e),children:e},e))})]}),b.length>0&&(0,L.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:W(`tasks`,`changeEngine.effortLabel`)}),(0,L.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:b.map(e=>(0,L.jsx)(`button`,{type:`button`,"aria-pressed":e===c,className:Hn(e===c),onClick:()=>l(e),children:e===``?W(`tasks`,`changeEngine.noEffort`):e},e||`default`))})]}),(0,L.jsx)(`p`,{className:`keys-only ${tn}`,children:(0,L.jsx)($d,{text:[W(`tasks`,`changeEngine.footer.engine`),...v?.acceptsModel?[W(`tasks`,`changeEngine.footer.model`)]:[],...b.length>0?[W(`tasks`,`changeEngine.footer.effort`)]:[],W(`tasks`,`changeEngine.footer.set`),W(`tasks`,`changeEngine.footer.cancel`)].join(` · `)})}),g&&(0,L.jsx)(`p`,{className:`text-error`,children:g}),(0,L.jsx)(Ar,{busy:m||!f,submitLabel:F(`taskops.set`)})]})})}var hD=`flex flex-col overflow-hidden @container`,gD=`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`,_D=`flex min-h-0 flex-col gap-3 overflow-y-auto scrollbar-none rt-narrow:shrink-0 rt-narrow:overflow-visible`,vD=`flex gap-1.5 px-2 pt-0 pb-1`,yD=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`}`,bD=`flex min-w-0 items-baseline gap-2.5`,xD=e=>`min-w-0 flex-1 truncate font-bold ${e?`text-muted`:``}`,SD=`whitespace-nowrap text-meta`,CD=`truncate text-meta`,wD=`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)]`,TD=`flex flex-wrap items-baseline justify-between gap-3`,ED=`font-sans text-display font-bold normal-nums wrap-anywhere`,DD=`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`,OD=`max-h-[12lh] overflow-y-auto rounded-sm bg-inset px-2.5 py-2 whitespace-pre-wrap wrap-anywhere`,kD=`min-w-0 text-meta leading-[inherit]`,AD=`flex w-full min-w-0 gap-2 text-inherit`,jD=AD,MD=`${AD} cursor-pointer border-none bg-transparent p-0 text-left font-[inherit] [&:hover]:underline`,ND=`min-w-0 flex-1 truncate`,PD=`[&+&]:mt-1.5`,FD=e=>`whitespace-pre-wrap wrap-anywhere text-meta ${e?``:`leading-[inherit]`}`,ID=`text-meta`,LD=`flex gap-4.5`,RD=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`}`,zD=`hidden gap-2 px-1 pt-0.5 pb-1.5 touch:flex`,BD=`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 VD(e){let t=e.client,[n,r]=(0,h.useState)(()=>J(t,`pendingStart.list`)?.starts??[]);if((0,h.useEffect)(()=>{let e=!0;return X(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){H($(F(`pages.laterCancelFailed`),{error:Dw(e)}),`error`)}};return(0,L.jsxs)(`section`,{"data-field":`later`,className:`mt-2.5`,children:[(0,L.jsxs)(`h2`,{className:`${z} ${vD} text-muted`,children:[F(`pages.laterStarts`),` `,(0,L.jsx)(`span`,{className:`mono`,children:n.length})]}),n.map(e=>(0,L.jsxs)(`div`,{className:yD(!1),children:[(0,L.jsxs)(`span`,{className:bD,children:[(0,L.jsx)(`span`,{className:xD(!1),children:e.title}),(0,L.jsx)(`span`,{className:`mono text-muted ${SD}`,title:new Date(e.at).toLocaleString(),children:em(new Date(e.at))}),(0,L.jsx)(R,{className:`font-mono`,hit:`tight`,onClick:()=>void a(e),children:F(`pages.laterCancel`)})]}),(0,L.jsx)(`span`,{className:`mono text-muted ${CD}`,children:kw(e.repo,i)}),e.error&&(0,L.jsx)(`span`,{className:`mono text-warning truncate text-meta`,title:e.error,children:$(F(`pages.laterFailed`),{error:e.error})})]},e.id))]})}var HD={name:``,repo:``,prompt:``,schedule:`0 9 * * MON-FRI`};function UD(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))&&BE(e.schedule.trim())}function WD(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`:BE(e.schedule.trim())?null:`schedule`}function GD(e){let{auto:t,common:n}=Tw(),r=Ew(),i=I()===`zh`?`zh-CN`:`en-US`,[a,o]=(0,h.useState)(()=>({...HD,repo:e.repos.find(t=>e.defaultRepo&&Ow(t)===Ow(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(),Pn())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},[]);let m=()=>{if(UD(a)){Pn(),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=WD(a);n&&(d.current[n]?.focus(),u(Reflect.get(t.missing,n)))},g=a.repo===null?[]:e.tasks.filter(e=>Ow(e.repo)===Ow(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=YE(a.schedule),w=e=>{let t=JE[s];t&&p({schedule:sD(a.schedule,s,aD(t,C[s]??`*`,e))})},T=e=>{if(!(e.ctrlKey||e.metaKey||e.altKey)){if(e.key===`ArrowLeft`||e.key===`h`)c(oD(s,-1));else if(e.key===`ArrowRight`||e.key===`l`)c(oD(s,1));else if(e.key===`ArrowUp`||e.key===`ArrowDown`)w(e.key===`ArrowUp`?1:-1);else return;e.preventDefault()}},E=uD(a.schedule,Date.now(),r,i),D=cD(a.schedule,r);return(0,L.jsx)(`div`,{className:Wn,onMouseDown:e=>e.target===e.currentTarget&&Pn(),children:(0,L.jsxs)(`dialog`,{open:!0,className:`${Gn(!0)} ${HT}`,"aria-label":t.newTitle,children:[(0,L.jsx)(`h1`,{className:`${z} text-muted`,children:t.newTitle}),(0,L.jsxs)(`div`,{className:Yn,children:[(0,L.jsxs)(`label`,{className:zn,children:[(0,L.jsx)(`span`,{className:`${z} text-muted`,children:t.fieldName}),(0,L.jsx)(`input`,{ref:f(`name`),className:ln,spellCheck:!1,placeholder:t.namePlaceholder,value:a.name,onChange:e=>p({name:e.target.value}),onKeyDown:S(`repo`)})]}),(0,L.jsxs)(`div`,{className:zn,children:[(0,L.jsxs)(`span`,{className:`${z} text-muted ${WT}`,children:[t.fieldRepo,(0,L.jsx)(`span`,{className:`keys-only text-muted ${GT}`,children:`↑/↓`})]}),(0,L.jsx)(tE,{fieldRef:f(`repo`),kind:`list`,label:t.fieldRepo,className:qT,onKeyDown:x(b),children:y.map(t=>(0,L.jsxs)(`button`,{type:`button`,tabIndex:-1,"aria-selected":t===a.repo,className:`touch:py-1.5 ${JT(t===a.repo)}`,onClick:()=>{p({repo:t,target:void 0}),d.current.repo?.focus()},children:[t===a.repo?`▸ `:` `,t===null?F(`rail.noProject`):kw(t,e.repos)]},t??``))})]}),(0,L.jsxs)(`div`,{className:zn,children:[(0,L.jsxs)(`span`,{className:`${z} text-muted ${WT}`,children:[t.fieldTarget,(0,L.jsx)(`span`,{className:`keys-only text-muted ${GT}`,children:`↑/↓`})]}),(0,L.jsx)(tE,{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,L.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:t.fieldTargetTab}),(0,L.jsx)(`input`,{ref:f(`targetTab`),className:ln,spellCheck:!1,value:a.target.tabId,onChange:e=>a.target&&p({target:{...a.target,tabId:e.target.value}}),onKeyDown:S(`prompt`)})]}),(0,L.jsxs)(`label`,{className:zn,children:[(0,L.jsx)(`span`,{className:`${z} text-muted`,children:t.fieldPrompt}),(0,L.jsx)(`input`,{ref:f(`prompt`),className:ln,spellCheck:!1,placeholder:t.promptPlaceholder,value:a.prompt,onChange:e=>p({prompt:e.target.value}),onKeyDown:S(`schedule`)})]}),(0,L.jsxs)(`div`,{className:zn,children:[(0,L.jsxs)(`span`,{className:`${z} text-muted ${WT}`,children:[t.fieldSchedule,(0,L.jsx)(`span`,{className:`keys-only text-muted ${GT}`,children:`←/→ ↑/↓`})]}),(0,L.jsx)(tE,{fieldRef:f(`schedule`),kind:`cells`,label:t.fieldSchedule,className:LD,onKeyDown:T,children:JE.map((e,n)=>(0,L.jsxs)(`button`,{type:`button`,tabIndex:-1,className:RD(n===s),onClick:()=>{c(n),d.current.schedule?.focus()},children:[C[n]??`*`,(0,L.jsx)(`span`,{children:t.cronField[e]})]},e))}),(0,L.jsx)(`div`,{className:zD,children:[-1,1].map(e=>{let n=t.cronField[JE[s]??`minute`]??``;return(0,L.jsx)(`button`,{type:`button`,tabIndex:-1,className:BD,"aria-label":F(e<0?`pages.cronDown`:`pages.cronUp`,{field:n}),onClick:()=>{w(e),d.current.schedule?.focus()},children:e<0?`−`:`+`},e)})}),E.kind===`ok`?(0,L.jsxs)(`p`,{className:`mono text-success`,children:[D?`${D}, `:``,E.relative,`, `,E.absolute]}):(0,L.jsx)(`p`,{className:`mono text-error`,children:E.kind===`never`?t.cronNever:t.cronInvalid})]}),l&&(0,L.jsxs)(`p`,{className:`text-error`,children:[`※ `,l]}),(0,L.jsx)(`p`,{className:`touch:empty:hidden! text-muted ${YT}`,children:(0,L.jsx)($d,{text:dl(t.composerLegend)})}),(0,L.jsxs)(`div`,{className:un,children:[(0,L.jsx)(`button`,{type:`button`,className:sn,onClick:Pn,children:n.cancel}),(0,L.jsx)(`button`,{ref:f(`confirm`),type:`button`,className:Be(),onClick:m,children:n.create})]})]})]})})}var KD=[`ok`,`blocked`,`failed`,`skipped`];function qD(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 JD={scheduled:`schedule`,manual:`manual`,webhook:`webhook`};function YD(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 XD(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 ZD(e,t){return e.filter(e=>t===null||qD(e)===t).sort((e,t)=>Date.parse(t.at)-Date.parse(e.at)||t.runNumber-e.runNumber)}function QD(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 $D=(e,t)=>e&&typeof e==`object`?Reflect.get(e,t):void 0;function eO(e){let t=QD(e);if(!t)return{summary:e,full:e};let n=$D(t.value,`error`)??t.value,r=$D(n,`message`),i=$D(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 tO(e){let t=e.trim();if(!/^[[{]/.test(t))return e;try{return JSON.stringify(JSON.parse(t),null,2)}catch{return e}}var nO={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`},rO={success:`text-success`,muted:`text-muted`,warning:`text-warning`,error:`text-error`},iO={success:`✓`,error:`†`,warning:`!`,muted:`·`},aO=e=>nO[e]??`muted`;function oO(e){let{auto:t}=Tw(),{runs:n,when:r}=e,i=e=>t.runStatus[e]??e,a=n.filter(e=>e.response);return(0,L.jsxs)(L.Fragment,{children:[n[0]?.precheckResult&&(0,L.jsx)(sO,{run:n[0]}),(0,L.jsx)(`h2`,{className:`${z} text-muted`,children:t.responses}),a.length===0?(0,L.jsx)(`p`,{className:`text-muted`,children:t.noResponses}):a.map(e=>(0,L.jsxs)(`div`,{className:PD,children:[(0,L.jsx)(`p`,{className:`mono ${ID} ${rO[aO(e.status)]}`,children:`#${e.runNumber} ${i(e.status)}, ${r(e.response?.at)}`}),(0,L.jsx)(`p`,{className:FD(!1),children:tO(e.response?.text??``)})]},e.id))]})}function sO({run:e}){let{auto:t}=Tw(),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,L.jsxs)(`div`,{children:[(0,L.jsx)(`h2`,{className:`${z} text-muted`,children:$(t.precheckDetail,{exit:r,duration:String(n.durationMs)})}),i.length===0?(0,L.jsx)(`p`,{className:`text-muted`,children:t.precheckNoOutput}):i.map(e=>(0,L.jsx)(`p`,{className:`mono ${FD(!0)}`,children:`${e.label}: ${e.text.replace(/\s+$/,``).split(`
39
39
  `).slice(-10).join(`
40
- `)}`},e.label))]})}var eO=30;function tO(e,t,n){let r=t.join(`\0`),[i,a]=(0,h.useState)(()=>Object.fromEntries(t.map(t=>[t,J(e,`routine.runs`,{id:t})?.runs??[]])));return(0,h.useEffect)(()=>{let n=!0;for(let r of t)X(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 nO(e){I();let{auto:t}=LC(),[n,r]=(0,h.useState)(null),i=UD(e.runs,n),a=e=>{if(e.status===`skipped_blocked`){let t=e.blocked?.reason;return t?$(F(`runLog.blockedRun`),{reason:F(`runLog.blocked.${t}`)}):F(`runLog.outcome.blocked`)}return t.runStatus[e.status]??e.status},o=(e,t,n,r)=>(0,L.jsx)(R,{variant:`pill`,hit:`tight`,"aria-current":t,className:`max-w-40 truncate`,onClick:n,children:`[ ${e} ]`},r);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`h2`,{className:`${z} text-muted`,children:F(`runLog.title`)}),(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1`,children:[o(F(`runLog.all`),n===null,()=>r(null),`all`),RD.map(e=>o(F(`runLog.outcome.${e}`),n===e,()=>r(e),e))]}),i.length===0?(0,L.jsx)(`p`,{className:`text-muted`,children:e.runs.length===0?t.noRuns:F(`runLog.empty`)}):i.slice(0,eO).map(n=>{let r=ZD(n.status),i=CE(n,e.now),o=i===`awaiting`?`, ${t.responseAwaiting}`:i===`missing`?`, ${t.responseMissing}`:``,s=VD(n),c=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{children:XD[r]}),(0,L.jsx)(`span`,{children:`#${n.runNumber}`}),(0,L.jsx)(`span`,{className:TD,children:`${a(n)}${n.tabId?`, ${n.tabId}`:``}${o}`}),(0,L.jsx)(`span`,{className:`text-subtle`,children:F(`runLog.source.${BD[n.trigger]}`)}),s!==null&&(0,L.jsx)(`span`,{className:`text-muted`,children:HD(s)}),(0,L.jsx)(`span`,{className:`text-muted`,children:e.when(n.at)})]}),l=n.error?KD(n.error):null,u=n.taskId,d=i===`missing`?`text-warning`:YD[r];return(0,L.jsxs)(`div`,{className:`${xD} ${d}`,children:[u?(0,L.jsx)(`button`,{type:`button`,className:`mono ${wD}`,onClick:()=>e.openRun(u),children:c}):(0,L.jsx)(`span`,{className:`mono ${CD}`,children:c}),l&&(0,L.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,L.jsx)(`summary`,{children:l.summary}),(0,L.jsx)(`pre`,{children:l.full})]})]},n.id)}),i.length>eO&&(0,L.jsx)(`p`,{className:`text-muted`,children:F(`runLog.more`,{count:i.length-eO})})]})}function rO(e){let{auto:t}=LC(),n=RC(),r=I()===`zh`?`zh-CN`:`en-US`,{routine:i,busy:a,when:o}=e,s=eD(i.schedule,n),c=i.nextRunAt?Date.parse(i.nextRunAt):NaN;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:_D,children:[(0,L.jsx)(`h2`,{className:vD,children:i.name}),(0,L.jsxs)(`span`,{className:`mono ${jy}`,children:[(0,L.jsx)(`button`,{type:`button`,className:`${sn} ${My.row}`,disabled:a,onClick:e.onRunNow,children:t.runNow}),(0,L.jsx)(`button`,{type:`button`,className:`${sn} ${My.row}`,disabled:a,onClick:e.onToggle,children:F(i.enabled?`pages.routinePause`:`pages.routineEnable`)}),(0,L.jsx)(`button`,{type:`button`,className:`${sn} ${My.row}`,disabled:a,onClick:e.onDelete,children:F(`pages.delete`)})]})]}),(0,L.jsxs)(`dl`,{className:yD,children:[(0,L.jsx)(`dt`,{className:`text-muted`,children:F(`pages.routineSchedule`)}),(0,L.jsxs)(`dd`,{children:[s??(0,L.jsx)(`span`,{className:`mono`,children:i.schedule}),s&&(0,L.jsx)(`span`,{className:`mono text-muted`,children:` ${i.schedule}`})]}),(0,L.jsx)(`dt`,{className:`text-muted`,children:F(`pages.routineNext`)}),(0,L.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,L.jsx)(`dt`,{className:`text-muted`,children:F(`pages.routineProject`)}),(0,L.jsx)(`dd`,{children:e.project}),!i.script&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`dt`,{className:`text-muted`,children:F(`pages.routineDelivers`)}),(0,L.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,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`dt`,{className:`text-muted`,children:F(`pages.routineEngine`)}),(0,L.jsxs)(`dd`,{className:`flex flex-wrap items-baseline gap-x-3.5`,children:[(0,L.jsx)(`span`,{children:e.engine}),(0,L.jsx)(R,{className:`font-mono`,hit:`tight`,disabled:a,onClick:e.onChangeEngine,children:F(`pages.routineChangeEngine`)})]})]})]}),i.precheck&&(0,L.jsx)(`p`,{className:`mono text-muted`,children:$(t.precheck,{command:i.precheck.command})}),i.script?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`h2`,{className:`${z} text-muted`,children:F(`pages.routineScript`)}),(0,L.jsx)(`p`,{className:`mono ${bD}`,children:i.script.command})]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`h2`,{className:`${z} text-muted`,children:F(`pages.routinePrompt`)}),(0,L.jsx)(`p`,{className:bD,children:i.prompt})]}),(0,L.jsx)(nO,{runs:e.runs,now:e.now,when:o,openRun:e.openRun}),(0,L.jsx)(QD,{runs:e.runs,when:o})]})}var iO=5e3;function aO({model:e}){let{auto:t,common:n}=LC(),r=e.client,[i,a]=GC(iO),o=_(e.tasks),s=UC(e),c=WC(e),[l,u]=(0,h.useState)(()=>J(r,`routine.list`)??null),[d,f]=(0,h.useState)(null),[p,m]=(0,h.useState)(null),[g,v]=(0,h.useState)(null),y=JC(),b=RC(),x=(0,h.useRef)(null);(0,h.useEffect)(()=>{let e=!0;return X(r,`routine.list`).then(t=>e&&u(t)).catch(()=>e&&u(e=>e??{automations:[],keepsDaemonAlive:!1})),()=>{e=!1}},[r,i]);let[S,C]=(0,h.useState)(()=>J(r,`engines.list`)?.engines??[]);(0,h.useEffect)(()=>{let e=!0;return X(r,`engines.list`).then(t=>e&&C(t.engines)).catch(()=>{}),()=>{e=!1}},[r]);let w=l?.automations??[],T=l?.lastRunStatus??{},E=l?.lastFailure??{},D=e=>{let t=T[e.id];return t!==void 0&&SE(t)},O=[{key:`pages.routinesNeedYou`,rows:w.filter(D)},{key:`pages.routinesActive`,rows:w.filter(e=>e.enabled&&!D(e))},{key:`pages.routinesPaused`,rows:w.filter(e=>!e.enabled&&!D(e))}],k=O.flatMap(e=>e.rows),ee=Math.max(0,k.findIndex(e=>e.id===d)),A=k[ee],te=e=>f(k[e]?.id??null),ne=O[0]?.rows.length??0,j=_(yn);(0,h.useEffect)(()=>{j===null||!l||(l.automations.some(e=>e.id===j)&&f(j),yn.set(null))},[j,l]);let re=tO(r,A?[A.id]:[],i),M=A?re[A.id]??[]:[];(0,h.useEffect)(()=>v(null),[A?.id]);let N=(0,h.useRef)(null),[ie,ae]=(0,h.useState)(0),oe=(0,h.useRef)(0);(0,h.useEffect)(()=>{let e=x.current,t=ie!==oe.current;if(oe.current=ie,t&&e&&N.current&&e.offsetTop>N.current.offsetTop){e.scrollIntoView({block:`start`,behavior:`smooth`});return}N.current?.querySelector(`[data-row="${ee}"]`)?.scrollIntoView({block:`nearest`})},[ee,ie]);let se=Date.now(),ce=e=>{let n=e?Date.parse(e):NaN;if(!Number.isFinite(n))return`—`;let r=n-se,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()},P=e=>o?.tasks.find(t=>t.id===e)?.label??e,le=t=>{V.set(null),e.select(t)},ue=(e,t,n)=>H($(e,{name:t,error:zC(n)}),`error`),de=async()=>{if(!(!A||p)){m(A.id);try{await r.request(`routine.setEnabled`,{id:A.id,enabled:!A.enabled}),a()}catch(e){ue(A.enabled?t.disableFailed:t.enableFailed,A.name,e)}finally{m(null)}}},fe=async()=>{if(!(!A||p)){m(A.id),v($(t.running,{name:A.name}));try{let e=await r.request(`routine.runNow`,{id:A.id});v($(t.ranWith,{name:A.name,status:e.status})),a()}catch(e){ue(t.runFailed,A.name,e)}finally{m(null)}}},pe=async()=>{if(p)return;let e=HC(await r.request(`repos.list`).then(e=>e.repos).catch(()=>[]),s);B.set((0,L.jsx)(LD,{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){H($(t.createFailed,{error:zC(e)}),`error`)}finally{m(null)}})()}}))},me=()=>{if(!A||p)return;let e=A;B.set((0,L.jsx)(Or,{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)}}}))};qC(e=>{if(e.ctrlKey)return e.key===`c`&&(V.set(null),!0);switch(e.key){case`Escape`:case`q`:return V.set(null),!0;case`j`:case`ArrowDown`:return te(Math.min(k.length-1,ee+1)),!0;case`k`:case`ArrowUp`:return te(Math.max(0,ee-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=M[0]?.taskId;return e?le(e):M.length>0&&v(t.latestRunNoTask),!0}default:return!1}});let he=e=>xE(e,e=>S.find(t=>t.id===e)?.name??e,t.engineDefault),ge=()=>{if(!A)return;let n=A;B.set((0,L.jsx)(oD,{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??``});v($(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?F(`rail.noProject`):VC(e,w.flatMap(e=>e.repo??[]));return(0,L.jsxs)(`div`,{className:`${Ey} ${sD}`,tabIndex:0,ref:y,children:[(0,L.jsxs)(`div`,{className:ky,children:[(0,L.jsx)(`h1`,{className:Oy,children:t.title}),(0,L.jsxs)(`span`,{className:`mono ${jy}`,children:[ne>0&&(0,L.jsx)(`span`,{className:`text-error`,children:$(t.needAttention,{count:String(ne),total:String(k.length)})}),(0,L.jsx)(`span`,{className:`text-muted`,children:l?.keepsDaemonAlive?t.holdingDaemon:t.notHolding}),(0,L.jsx)(`button`,{type:`button`,className:`${sn} ${My.header}`,onClick:()=>void pe(),children:F(`pages.new`)})]})]}),(0,L.jsx)(ND,{client:r,tick:i,reload:a}),l===null?(0,L.jsx)(`p`,{className:`text-muted`,children:n.loading}):k.length===0?(0,L.jsxs)(`div`,{className:Ny,children:[(0,L.jsx)(`p`,{className:`text-muted`,children:t.empty}),(0,L.jsx)(`p`,{className:`keys-only`,children:t.emptyHint})]}):(0,L.jsxs)(`div`,{className:cD,children:[(0,L.jsx)(`div`,{className:lD,ref:N,children:O.map(e=>e.rows.length===0?null:(0,L.jsxs)(`section`,{children:[(0,L.jsxs)(`h2`,{className:`${z} ${uD} ${e===O[0]?`text-error`:`text-muted`}`,children:[F(e.key),` `,(0,L.jsx)(`span`,{className:`mono`,children:e.rows.length})]}),e.rows.map(e=>{let n=k.indexOf(e),r=T[e.id],i=r?ZD(r):null;return(0,L.jsxs)(`div`,{"data-row":n,className:dD(n===ee),onClick:()=>{te(n),ae(e=>e+1)},children:[(0,L.jsxs)(`span`,{className:fD,children:[(0,L.jsx)(`span`,{className:pD(!e.enabled),children:e.name}),(0,L.jsx)(`span`,{className:`mono text-muted ${mD}`,children:e.enabled?ce(e.nextRunAt):t.paused}),(0,L.jsx)(`span`,{className:`mono ${i?YD[i]:`text-muted`}`,style:{width:`1ch`},children:i?XD[i]:` `})]}),(0,L.jsx)(`span`,{className:`mono text-muted ${hD}`,title:e.schedule,children:[_e(e.repo),eD(e.schedule,b)??e.schedule,he(e)?.short].filter(Boolean).join(` · `)}),E[e.id]?(0,L.jsx)(`span`,{className:`mono text-warning ${hD}`,title:E[e.id]?.reason,children:$(t.lastFailed,{when:ce(E[e.id]?.at),reason:E[e.id]?.reason??``})}):null]},e.id)})]},e.key))}),(0,L.jsx)(`div`,{className:gD,ref:x,children:A?(0,L.jsx)(rO,{routine:A,runs:M,busy:p===A.id,project:_e(A.repo),engine:he(A)?.full??null,targetTitle:A.target?P(A.target.taskId):void 0,now:se,when:ce,openRun:le,onRunNow:()=>void fe(),onToggle:()=>void de(),onDelete:me,onChangeEngine:ge}):(0,L.jsx)(`p`,{className:`text-muted`,children:t.noSelection})})]}),g&&(0,L.jsx)(`p`,{className:`text-muted mx-0 mt-2 mb-0 text-meta leading-[inherit]`,children:g})]})}var oO=`flex min-w-0 items-baseline gap-2.5 font-mono text-meta whitespace-nowrap`,sO=`${oO} w-full cursor-pointer border-none bg-transparent p-0 text-left text-inherit [font:inherit] [&:hover]:underline`,cO=`w-[5ch] flex-none text-muted`,lO=`w-[16ch] flex-none overflow-hidden text-accent`,uO=`mt-3.5 mb-0.5`,dO=`min-w-0 flex-1 truncate`,fO=`flex-none text-right text-muted`,pO=`${fO} min-w-[5ch]`,mO=`${fO} min-w-[4ch]`,hO=`${fO} min-w-[5ch]`,gO=`w-[8ch] flex-none overflow-hidden text-accent`,_O=`flex flex-wrap gap-x-3 font-mono text-meta text-muted`,vO=`m-0 text-meta text-muted`,yO={turns:0,tokens:0,ms:0},bO=e=>(e.usage?.input_tokens??0)+(e.usage?.output_tokens??0),xO=e=>Math.max(0,e.endedAt-e.startedAt),SO=(e,t)=>({turns:e.turns+1,tokens:e.tokens+bO(t),ms:e.ms+xO(t)});function CO(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function wO(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(CO(n.getTime()))}let a=new Map(i.map(e=>[e,{sum:yO,byEngine:{}}]));for(let t of e){let e=a.get(CO(t.startedAt));if(!e)continue;let n=t.vendor??`unknown`;e.sum=SO(e.sum,t),e.byEngine[n]=(e.byEngine[n]??0)+bO(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:CO(o)}:null;return{cutoff:s,days:i.map(e=>{let t=a.get(e);return{day:e,...t?.sum??yO,byEngine:t?.byEngine??{},partial:s!==null&&e<=s.day}})}}function TO(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,...SO(t.get(i)??yO,n)})}return[...t.values()].sort((e,t)=>t.tokens-e.tokens||t.turns-e.turns)}function EO(e,t){let n=new Map;for(let t of e)n.set(t.taskId,{taskId:t.taskId,...SO(n.get(t.taskId)??yO,t)});return[...n.values()].sort((e,t)=>t.tokens-e.tokens||t.turns-e.turns).slice(0,t)}function DO(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 OO=[``,`▏`,`▎`,`▍`,`▌`,`▋`,`▊`,`▉`];function kO(e,t,n){if(e<=0||t<=0)return``;let r=Math.max(1,Math.round(e/t*n*8));return`${`█`.repeat(Math.floor(r/8))}${OO[r%8]}`}var AO=[`█`,`▓`,`▒`,`░`];function jO(e,t,n,r){return n<=0?``:t.map((t,i)=>{let a=e[t]??0,o=a<=0?0:Math.max(1,Math.round(a/n*r));return(AO[i%AO.length]??`█`).repeat(o)}).join(``)}var MO=.1,NO=/^(\d+)\s*(h|d)$/;function PO(e,t){let n=NO.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*MO)||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 FO=14,IO=500,LO=3e4,RO=16,zO=8,BO=8;function VO(e,t,n,r){let i=J(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 X(e,t,n).then(e=>r&&o({kind:`ready`,value:e})).catch(e=>r&&o(t=>t.kind===`ready`?t:{kind:`failed`,error:zC(e)})),()=>{r=!1}},[e,t,s,r]),a}var HO=e=>(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`${pO}`,children:DO(e.tokens)}),(0,L.jsx)(`span`,{className:`${mO}`,children:`${e.turns}t`}),(0,L.jsx)(`span`,{className:`${hO}`,children:HD(e.ms)})]});function UO({usage:e,nameOf:t}){let n=Date.now(),r=e.flatMap(e=>e.windows.map(r=>{let i={engine:e.name||t(e.vendor),label:r.label,percent:Math.round(r.percent)},a=PO(r,n);if(a?.kind===`full`){let t=a.at-n<72e6,o=new Date(a.at).toLocaleString([],{...t?{}:{weekday:`short`},hour:`2-digit`,minute:`2-digit`});return{key:`${e.vendor}:${r.kind}`,text:$(F(`usage.full`),{...i,time:o})}}return{key:`${e.vendor}:${r.kind}`,text:$(F(a?`usage.lasts`:`usage.window`),i)}}));return r.length===0?null:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`h2`,{className:`${z} text-muted ${uO}`,children:F(`usage.quota`)}),r.map(e=>(0,L.jsx)(`p`,{className:`mono ${vO}`,children:e.text},e.key))]})}function WO({row:e,title:t,open:n}){let r=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:dO,children:t}),HO(e)]});return n?(0,L.jsx)(R,{variant:`row`,className:sO,onClick:n,children:r}):(0,L.jsx)(`div`,{className:oO,children:r})}function GO({model:e}){I();let t=JC(),[n]=GC(LO),r=VO(e,`turns.list`,{sinceDays:FO,limit:IO},n),i=VO(e,`engines.list`,{},n),a=VO(e,`usage.get`,{},n),o=_(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??F(`usage.removedTask`);return(0,L.jsxs)(`div`,{className:Dy,tabIndex:0,ref:t,onKeyDown:e=>{e.metaKey||e.ctrlKey||e.altKey||e.key!==`q`&&e.key!==`Escape`||(e.preventDefault(),V.set(null))},children:[(0,L.jsx)(`h1`,{className:Oy,children:F(`usage.title`)}),(()=>{if(r.kind===`loading`)return(0,L.jsx)(`p`,{className:`text-muted`,children:F(`usage.loading`)});if(r.kind===`failed`)return(0,L.jsx)(`p`,{className:`text-error`,children:$(F(`usage.failed`),{error:r.error})});let t=r.value.turns,n=new Set(r.value.readers??[]),i=wO(t,Date.now(),FO,IO),s=new Map;for(let e of i.days)for(let[t,n]of Object.entries(e.byEngine))s.set(t,(s.get(t)??0)+n);let u=[...s].sort((e,t)=>t[1]-e[1]).map(([e])=>e),d=Math.max(0,...i.days.map(e=>e.tokens)),f=TO(t),p=Math.max(0,...f.map(e=>e.tokens)),m=[...new Set((o?.tasks??[]).flatMap(e=>e.engine?.id&&!n.has(e.engine.id)?[e.engine.id]:[]))];return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`p`,{className:vO,children:$(F(`usage.range`),{days:FO})}),t.length===0?(0,L.jsx)(`p`,{className:`text-muted`,children:F(`usage.empty`)}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`h2`,{className:`${z} text-muted ${uO}`,children:F(`usage.perDay`)}),(0,L.jsx)(`div`,{className:_O,children:u.map((e,t)=>(0,L.jsx)(`span`,{children:`${AO[t%AO.length]} ${c(e)}`},e))}),i.days.map(e=>(0,L.jsxs)(`div`,{className:oO,children:[(0,L.jsx)(`span`,{className:cO,children:`${e.day.slice(5)}${e.partial?`~`:``}`}),(0,L.jsx)(`span`,{className:lO,children:jO(e.byEngine,u,d,RO)}),HO(e)]},e.day)),i.cutoff&&(0,L.jsx)(`p`,{className:`m-0 text-meta text-muted`,children:$(F(`usage.cutoff`),{count:i.cutoff.count,day:i.cutoff.day.slice(5)})}),(0,L.jsx)(`h2`,{className:`${z} text-muted ${uO}`,children:F(`usage.byModel`)}),f.map(e=>(0,L.jsxs)(`div`,{className:oO,children:[(0,L.jsx)(`span`,{className:dO,title:`${c(e.engine)} · ${e.model}`,children:`${c(e.engine)} · ${e.model}`}),(0,L.jsx)(`span`,{className:gO,children:kO(e.tokens,p,zO)}),HO(e)]},`${e.engine}\0${e.model}`)),(0,L.jsx)(`h2`,{className:`${z} text-muted ${uO}`,children:F(`usage.topTasks`)}),EO(t,BO).map(t=>(0,L.jsx)(WO,{row:t,title:l(t.taskId),open:o?.tasks.some(e=>e.id===t.taskId)?()=>{V.set(null),e.select(t.taskId)}:null},t.taskId))]}),m.length>0&&(0,L.jsx)(`p`,{className:`m-0 text-meta text-muted`,children:$(F(`usage.noReader`),{engines:m.map(c).join(`, `)})}),a.kind===`ready`&&a.value.usage&&(0,L.jsx)(UO,{usage:a.value.usage,nameOf:c})]})})()]})}var KO={id:`mods`,label:`mods`},qO=[{id:`kanban`,label:`kanban`,mod:`kanban`},{id:`routines`,label:`automations`},{id:`issues`,label:`issues`,mod:`issues`}];function JO({model:e}){let{nav:t}=LC(),n=_(V),r=_(e.mods).length>0,i=_(e.installedMods),a=[...qO.filter(e=>!e.mod||i.has(e.mod)),...r?[KO]:[]];return(0,L.jsxs)(`div`,{className:zy,children:[(0,L.jsxs)(`button`,{type:`button`,className:`rail-nav-row ${Hy(!1)}`,onClick:()=>Uh(),children:[F(`rail.newTask`),(0,L.jsx)(`span`,{className:Uy,"aria-hidden":`true`,children:`+`})]}),a.map(e=>(0,L.jsx)(`button`,{type:`button`,className:`rail-nav-row ${Hy(n===e.id)}`,"aria-current":n===e.id?`page`:void 0,onClick:()=>Ja(e.id),children:t[e.label]},e.id))]})}function YO({model:e,page:t}){(0,h.useEffect)(()=>e.selection.subscribe(()=>V.set(null)),[e]);let n=_(e.installedMods);return t===`kanban`&&n.has(`kanban`)?(0,L.jsx)(rE,{model:e}):t===`routines`?(0,L.jsx)(aO,{model:e}):t===`issues`&&n.has(`issues`)?(0,L.jsx)(nT,{model:e}):t===`mods`?(0,L.jsx)(bE,{model:e}):t===`compare`?(0,L.jsx)(Ww,{model:e}):t===`usage`?(0,L.jsx)(GO,{model:e}):null}var XO=f();function ZO(e){return e?.match(/^https?:\/\/[^/]+\/([^/]+\/[^/]+)\/(?:pull|merge_requests|-\/merge_requests)\//)?.[1]}var QO=e=>e.charAt(0).toUpperCase()+e.slice(1);function $O(e){return[F(`rail.pr.state.${e.state}`),...e.checks?[F(`rail.pr.checks.${e.checks}`)]:[]].join(`, `)}function ek(e){let t=new Map;for(let n of e){let e=rw(n),r=[...e&&n.pr?[{pr:n.pr,mark:e}]:[],...(n.sessionPrs??[]).flatMap(e=>{let t=iw(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&&aw([a.mark,i])!==a.mark)&&t.set(r,{task:n,pr:e,mark:i})}}return[...t.values()]}function tk({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=cl();(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=ek(e),p=aw(f.map(e=>e.mark));if(!p)return null;let m=f.length===1?`PR #${f[0]?.pr.number??``}, ${$O(p)}`:F(`rail.pr.many`,{count:f.length});return(0,L.jsxs)(`span`,{ref:o,className:`chip ${Ef} ${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,L.jsx)(`span`,{className:`font-sans`,children:f.length}),n&&(0,XO.createPortal)((0,L.jsx)(`div`,{ref:c,className:Df(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=ZO(t?.url),i=t?.additions!==void 0&&t.deletions!==void 0;return(0,L.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,L.jsx)(`span`,{className:`truncate font-semibold text-ink`,children:t.title||e.label}),(0,L.jsxs)(`span`,{className:`flex items-baseline gap-0 text-meta leading-[inherit] whitespace-nowrap`,children:[(0,L.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.25 ${n.tone}`,children:[(0,L.jsx)(`span`,{className:`font-mono`,children:n.glyph}),QO(F(`rail.pr.state.${n.state}`))]}),(0,L.jsx)(`span`,{className:`overflow-hidden text-ellipsis whitespace-pre text-muted`,children:[...n.checks?[F(`rail.pr.checks.${n.checks}`)]:[],[r,t?.number===void 0?``:`#${t.number}`].filter(Boolean).join(` `)].filter(Boolean).map(e=>`, ${e}`).join(``)}),i&&(0,L.jsxs)(`span`,{className:`ml-auto flex gap-1.5 pl-3 tabular-nums`,children:[(0,L.jsxs)(`span`,{className:`text-success`,children:[`+`,t.additions]}),(0,L.jsxs)(`span`,{className:`text-error`,children:[`−`,t.deletions]})]})]})]},t.url??`${e.id}#${t.number??``}`)})}),document.body)]})}function nk(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 rk(e,t,n,r){let i=nk(e,t,n);return i===null?null:r===`above`&&i>0?i-1:r===`below`&&i<0?i+1:i}function ik(e,t){return e.id===t.id?!1:e.kind===`main`?t.kind===`main`:t.kind!==`main`&&t.repo===e.repo}function ak(e,t,n,r,i){if(!ik(t,n))return null;if(t.kind===`main`){let i=rk(e,t,n,r);return i?{steps:i}:null}let a=n.pinned===!0||i&&r===`above`,o={...t,pinned:a},s=a===(n.pinned===!0)?rk(e.map(e=>e.id===t.id?o:e),o,n,r)??0:0,c=a===(t.pinned===!0)?{}:{pin:a};return`pin`in c||s!==0?{...c,steps:s}:null}var ok=e=>e===void 0||e.kind===`project`||e.kind===`state`?0:e.kind===`task`||e.kind===`pane`||e.kind===`round`?e.depth:1;function sk(e,t){let n=ok(e[t]),r=t+1;for(;r<e.length&&ok(e[r])>n;)r++;return r}function ck(e,t,n){let r=e.findIndex(e=>e.id===t),i=r<0?e:[...e.slice(0,r),...e.slice(sk(e,r))];for(let e=i.findIndex(e=>e.id===n)-1;e>=0;e--){let t=i[e];if(!t||t.kind===`project`||t.kind===`state`)return!0;if(t.kind===`task`&&t.depth===1&&t.task.kind!==`main`||t.kind===`round`&&t.depth===1)return!1}return!1}function lk(e,t){let n=ok(e[t]),r=[];for(let i=2;i<=n;i++){let a=t+1;for(;a<e.length&&ok(e[a])>i;)a++;let o=a<e.length&&ok(e[a])===i;r.push(i===n?o?`tee`:`elbow`:o?`pipe`:`blank`)}return r}function uk(e,t,n,r){let i=e.findIndex(e=>e.id===t);if(i<0||t===n)return e;let a=sk(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:sk(s,c);return[...s.slice(0,l),...o,...s.slice(l)]}var dk={duration:180,easing:`cubic-bezier(0.16, 1, 0.3, 1)`};function fk(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}],dk):t!==e.offsetTop&&e.animate([{transform:`translateY(${t-e.offsetTop}px)`},{transform:`none`}],dk)}})}var pk=null,mk=()=>(pk||(pk=new Image,pk.src=`data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7`),pk);function hk(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);fk(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&&!xu(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(mk(),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,sk(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&&!ik(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),pf(`default`),H(W(`tasks`,`sort.label`,{mode:W(`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=>H(W(`tasks`,`toast.moveFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)).finally(u);return}let h=ak(t,i.from,i.to,i.side,ck(m.current,i.fromRow,i.toRow));h?bf(e,i.from.id,h).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?uk(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,sk(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 gk({model:e,narrow:t,onSettings:n}){I();let r=_(ox),i=Q(`engines.skill.bannerHintWeb`,{engines:r.join(`, `)});return(0,L.jsxs)(`div`,{className:By,children:[!t&&(0,L.jsx)(OS,{client:e.client}),(0,L.jsxs)(`div`,{className:Vy,children:[(0,L.jsxs)(`button`,{type:`button`,className:`rail-nav-row ${Hy(!1)}`,onClick:n,children:[(0,L.jsxs)(`svg`,{className:Wy,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,L.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,L.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`})]}),(0,L.jsx)(`span`,{children:F(`rail.settings`)}),r.length>0&&(0,L.jsx)(`span`,{className:`ml-2 min-w-0 truncate text-meta text-subtle`,title:i,children:F(`rail.skillCue`)})]}),(0,L.jsx)(iC,{model:e,bindingId:`settings.open`})]})]})}function _k(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 vk=`rove.web.rail.shownMains`;function yk(){try{let e=JSON.parse(localStorage.getItem(vk)??`[]`);return Array.isArray(e)?Object.fromEntries(e.map(e=>[String(e),[null]])):{}}catch{return{}}}function bk(e,t){try{let n=e.filter(e=>e.kind===`main`&&(t[e.id]?.length??0)>0).map(e=>e.id);localStorage.setItem(vk,JSON.stringify(n))}catch{}}function xk(e,t,n){return(0,h.useEffect)(()=>{n&&bk(e,t)},[n,e,t]),(0,h.useMemo)(()=>n?t:{...yk(),...t},[n,t])}var Sk=g({});function Ck(e,t,n){let r=Sk.get()[`${e}::${t.id}`];return r&&r.sig===Hu(n)&&Fu(n.root).some(e=>e.id===r.leaf)?r.leaf:n.activeLeafId}function wk(e,t,n,r){Sk.set({...Sk.get(),[`${e}::${t}`]:{sig:Hu(n),leaf:r}})}function Tk(e,t,n,r){wk(e,t.id,n,r),La(Bl(e,t.id,r))?.focus()}function Ek(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 Dk(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){H(e instanceof Error?e.message:String(e),`error`)}}function Ok(e,t,n,r,i){let a=i??(n.split?Ck(t,n,n.split):`leaf-1`),o=e.selection.get();(o.taskId!==t||o.tabId!==n.id)&&e.select(t,n.id);let s=La(Bl(t,n.id,a))?.size();Dk(e,{taskId:t,tabId:n.id,action:`open`,direction:r,leafId:a,...s},e=>{e.changed?e.split&&wk(t,n.id,e.split,e.leaf):H(F(`layout.splitTooSmall`),`error`)})}function kk(e,t,n,r){let i=n.split,a=i?Ck(t,n,i):r,o=()=>Dk(e,{taskId:t,tabId:n.id,action:`close`,leafId:r},e=>{let i=e.split;if(!i)return;let o=a!==r&&Fu(i.root).some(e=>e.id===a);wk(t,n.id,i,o?a:i.activeLeafId)});if(!i||!Bu(n,i,r)){o();return}B.set((0,L.jsx)(Or,{title:F(`confirm.closePaneTitle`,{pane:zu(i,Nu(n)).get(r)??r}),body:F(`confirm.closePaneBody`),confirmLabel:F(`menu.closePane`),onConfirm:o}))}function Ak(e,t,n,r){let i=n.split;i&&B.set((0,L.jsx)(Dr,{title:yc(`split.renameTitle`),initial:zu(i,Nu(n)).get(r)??``,allowEmpty:!0,submitLabel:F(`dialog.save`),onSubmit:i=>Dk(e,{taskId:t,tabId:n.id,action:`rename`,leafId:r,title:i})}))}function jk(e,t,n,r){return[{label:F(`menu.renamePane`),section:`split`,key:ec(`workspace.split.rename`)??void 0,run:()=>Ak(e,t,n,r)},{label:F(`menu.closePane`),section:`split`,key:wi(`workspace.split.close`)||void 0,run:()=>kk(e,t,n,r)}]}function Mk(e,t,n,r){return[{label:F(`menu.splitRight`),section:`split`,key:ec(`workspace.split.right`)??void 0,run:()=>Ok(e,t,n,`right`,r)},{label:F(`menu.splitDown`),section:`split`,key:ec(`workspace.split.down`)??void 0,run:()=>Ok(e,t,n,`down`,r)}]}function Nk(e,t,n,r){let i=n.split,a=r??(i?Ck(t,n,i):`leaf-1`);return[...Mk(e,t,n,a),...Iu(i)?jk(e,t,n,a):[]]}function Pk(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)??ga(n);return!i||!Vu(i)?[]:Mk(e,t,i,i.split?Ck(t,i,i.split):`leaf-1`)}function Fk(e,{task:t,tab:n,leaf:r}){n.split&&Tk(t.id,n,n.split,r),e.select(t.id,n.id)}function Ik(e){let{row:t}=e,n=_(e.model.selection);_(Sk);let r=n.taskId===t.task.id&&n.tabId===t.tab.id&&!!t.tab.split&&Ck(t.task.id,t.tab,t.tab.split)===t.leaf;return(0,L.jsxs)(`button`,{type:`button`,className:`${vr({size:`pane`})} ${e.cursor?Pf:``}`,"aria-current":r||void 0,onClick:e.onClick,onContextMenu:e.onMenu,...e.place,children:[(0,L.jsx)(`span`,{className:xf,"aria-hidden":`true`,children:e.guides?.map((e,t)=>(0,L.jsx)(`span`,{className:wf(e)},t))}),(0,L.jsx)(`span`,{className:`${yr} text-(length:--fs-meta) ${r?`text-ink`:`text-muted`}`,children:t.label})]})}function Lk({model:e,task:t}){let[n,r]=(0,h.useState)(()=>J(e,`task.get`,{taskId:t.id})?.task??null),[i,a]=(0,h.useState)(null),{busy:o,error:s,submit:c}=Er();(0,h.useEffect)(()=>{X(e,`task.get`,{taskId:t.id}).then(e=>r(e.task)).catch(e=>a(U(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,L.jsx)(Tr,{title:W(`tasks`,`runAgain.title`),wide:!0,children:(0,L.jsxs)(`form`,{className:Yn,onSubmit:e=>{e.preventDefault(),l()},children:[(0,L.jsx)(`p`,{className:`text-muted`,children:W(`tasks`,`runAgain.source`,{title:t.label})}),(0,L.jsx)(`pre`,{className:nn,children:n?.prompt??i??W(`tasks`,`fieldNotes.loading`)}),(0,L.jsx)(`p`,{className:tn,children:W(`tasks`,`runAgain.hint`)}),s&&(0,L.jsx)(`p`,{className:`text-error`,children:s}),(0,L.jsx)(Ar,{busy:o||!n?.prompt,submitLabel:W(`tasks`,`runAgain.confirm`)})]})})}function Rk(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 zk({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:U(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(U(e))}}};return(0,L.jsx)(Tr,{title:W(`tasks`,`fieldNotes.title`),wide:!0,children:(0,L.jsxs)(`div`,{className:Yn,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,L.jsx)(`p`,{className:`font-mono text-meta break-all text-muted`,children:t}),n.kind===`loading`&&(0,L.jsx)(`p`,{className:`text-muted`,children:W(`tasks`,`fieldNotes.loading`)}),n.kind===`error`&&(0,L.jsx)(`p`,{className:`text-error`,children:n.message}),n.kind===`ready`&&f.length===0&&(0,L.jsx)(`p`,{className:`text-muted`,children:W(`tasks`,`fieldNotes.empty`)}),f.length>0&&(0,L.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,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{type:`button`,className:rn(t===i),onClick:()=>a(t),autoFocus:t===0,children:[(0,L.jsxs)(`span`,{className:`font-mono text-meta whitespace-pre text-accent`,children:[t===i?`▸ `:` `,Rk(e.at),`, `,e.author]}),(0,L.jsx)(`span`,{className:`text-ink whitespace-pre-wrap wrap-anywhere`,children:e.text})]})},`${e.at}:${t}`))}),o&&(0,L.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-line bg-paper px-3 py-2.5`,children:[(0,L.jsx)(`p`,{children:(0,L.jsx)(`strong`,{children:W(`tasks`,`fieldNotes.confirmDelete.title`)})}),(0,L.jsx)(`p`,{className:`text-muted`,children:W(`tasks`,`fieldNotes.confirmDelete.body`,{text:o.text})}),c&&(0,L.jsx)(`p`,{className:`text-error`,children:c}),(0,L.jsxs)(`div`,{className:`actions flex items-center justify-end gap-3.5`,children:[(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>s(null),children:F(`dialog.cancel`)}),(0,L.jsx)(`button`,{type:`button`,className:Be({danger:!0}),onClick:()=>void p(o),children:F(`taskops.retire`)})]})]}),!o&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`p`,{className:`keys-only font-sans text-meta text-subtle`,children:W(`tasks`,`fieldNotes.footerDeletable`)}),(0,L.jsxs)(`div`,{className:`actions flex items-center justify-end gap-3.5`,children:[(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,disabled:f[i]?.id===void 0,onClick:()=>s(f[i]??null),children:F(`taskops.retire`)}),(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:Pn,children:F(`taskops.close`)})]})]})]})})}var Bk=[`backlog`,`in_progress`,`in_review`,`done`,`canceled`,`error`],Vk={backlog:`status.backlog`,in_progress:`status.inProgress`,in_review:`status.inReview`,done:`status.done`,canceled:`status.canceled`,error:`status.error`},Hk=e=>({binding:e,key:ec(e)??void 0});async function Uk(e,t){if(!e){H(F(`menu.nothingToCopy`,{what:t}),`error`);return}try{await navigator.clipboard.writeText(e),H(F(`menu.copied`,{text:e}))}catch{H(F(`menu.copyFailed`),`error`)}}function Wk(e,t,n){let r=[{label:F(`menu.newTask`),section:`open`,run:()=>Uh(t)}],i=n.mainTaskId;return i&&(n.first||r.push({label:W(`tasks`,`menu.moveToTop`),section:`edit`,run:()=>void e.client.request(`task.move`,{taskId:i,direction:`top`}).catch(e=>H(W(`tasks`,`toast.moveFailed`,{error:String(e)}),`error`))}),r.push({label:W(`tasks`,`menu.reorderProject`),section:`edit`,...Hk(`sidebar.localMerge`),run:()=>Kk(i)})),r.push({label:W(`tasks`,`menu.fieldNotes`),section:`notes`,run:()=>B.set((0,L.jsx)(zk,{model:e,repo:t}))}),i&&r.push({label:W(`tasks`,`menu.forgetProject`),section:`danger`,danger:!0,run:()=>B.set(t_(e,t,n.label))}),r}function Gk(e){return[{label:F(`menu.newChatNoFolder`),section:`open`,run:()=>Wh()},{label:F(`menu.newShell`),section:`open`,run:()=>void Xl(e).catch(e=>H(String(e),`error`))}]}function Kk(e){let t=!hf.get();t&&e!==void 0&&gf.set(e),_f(t),document.querySelector(`.rail`)?.focus()}function qk(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?(H(W(`tasks`,`moveToProject.empty`),`error`),null):(0,L.jsx)(kr,{title:W(`tasks`,`moveToProject.title`),choices:r,onPick:async n=>{await e.client.request(`task.moveToProject`,{taskId:t.id,repo:n}),H(W(`tasks`,`toast.movedToProject`,{project:r.find(e=>e.value===n)?.label??n}))}})}function Jk(e,t,n){let r=e.client,i=[];n&&(i.push({label:F(`menu.closeTab`),section:`tab`,run:()=>B.set((0,L.jsx)(Or,{title:F(`confirm.closeTabTitle`,{tab:n.title??n.engineName??n.id}),body:F(`confirm.closeTabBody`),confirmLabel:F(`menu.closeTab`),onConfirm:async()=>{await e.closeTab(t.id,n.id)}}))}),i.push(...Nk(e,t.id,n))),i.push({label:F(`menu.newChat`),section:`open`,run:()=>void Jl(e,t.id)}),i.push({label:F(`menu.newChatPick`),section:`open`,rare:!0,run:()=>B.set((0,L.jsx)(eu,{model:e,taskId:t.id}))}),i.push({label:F(`menu.continueEngine`),section:`open`,rare:!0,...Hk(`chat.tab.fork`),run:()=>B.set((0,L.jsx)(eu,{model:e,taskId:t.id,context:`continue`,sourceTabId:n?.id}))}),i.push({label:F(`menu.newShell`),section:`open`,run:()=>void Yl(e,t.id,{kind:`shell`}).catch(e=>H(String(e),`error`))}),t.kind===`task`&&t.ownsBranch===!0&&t.branch&&!t.sharesWorkspaceOf&&!t.machine&&!t.extraRepoCount&&i.push({label:W(`tasks`,`menu.newTaskFromBranch`),section:`open`,rare:!0,run:()=>Dn({repo:t.repo,baseBranch:t.branch,worktree:!0})}),t.startsAt&&(i.push({label:F(`menu.startNow`),section:`open`,run:()=>void e.client.request(`task.startScheduledNow`,{taskId:t.id}).catch(e=>H(String(e),`error`))}),i.push({label:F(`menu.cancelStart`),section:`open`,run:()=>void e.client.request(`task.cancelScheduledStart`,{taskId:t.id}).catch(e=>H(String(e),`error`))})),t.hasPrompt&&(i.push({label:W(`tasks`,`menu.runAgain`),section:`open`,run:()=>B.set((0,L.jsx)(Lk,{model:e,task:t}))}),i.push({label:F(`menu.retryEdit`),section:`open`,rare:!0,run:()=>void Im(e,t)}));let a=!t.machine;if(a&&i.push({label:W(`tasks`,`menu.openEditor`),section:`open`,...Hk(`tasks.openWorktree`),run:()=>void Xg(e,t.id)}),t.groupId){let e=t.groupId;i.push({label:F(`compare.menu`),section:`open`,run:()=>Ya(e)})}i.push({label:F(`menu.rename`),section:`edit`,...Hk(`sidebar.rename`),run:()=>B.set((0,L.jsx)(Dr,{title:F(`menu.rename`),initial:t.title,submitLabel:F(`dialog.save`),onSubmit:n=>e.act(`task.rename`,{taskId:t.id,title:n}).then(()=>{})}))}),t.kind!==`main`&&i.push({label:t.pinned?F(`menu.unpin`):F(`menu.pin`),section:`edit`,...Hk(`sidebar.pin`),run:()=>void e.act(`task.pin`,{taskId:t.id,pinned:!t.pinned}).catch(e=>H(String(e),`error`))}),a&&i.push({label:W(`tasks`,`menu.reorder`),section:`edit`,rare:!0,...Hk(`sidebar.localMerge`),run:()=>Kk()}),i.push({label:F(`menu.setStatus`),section:`edit`,children:Bk.map(n=>({label:F(Vk[n]),checked:n===t.status,run:()=>void e.act(`task.setStatus`,{taskId:t.id,status:n}).catch(e=>H(String(e),`error`))}))}),a&&t.kind!==`main`&&!t.routine&&!t.parentTaskId&&!t.extraRepoCount&&i.push({label:W(`tasks`,`menu.moveToProject`),section:`edit`,rare:!0,run:()=>{let n=qk(e,t);n&&B.set(n)}}),a&&i.push({label:F(`menu.changeEngine`),section:`edit`,rare:!0,...Hk(`tasks.cycleEngine`),run:()=>B.set((0,L.jsx)(oD,{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}}),H(W(`tasks`,`toast.engineSwitched`,{engine:n.engine.name}))}}))}),t.pr?.checkState===`failing`&&i.push({label:W(`tasks`,`menu.fixChecks`),section:`git`,key:wi(`files.fixChecks`),run:()=>void Yg(e,t.id,F(`taskops.fixSent`))}),t.kind===`task`&&t.branch&&a&&i.push({label:W(`tasks`,`menu.syncBase`),section:`git`,rare:!0,key:wi(`files.syncBase`),run:()=>void qg(e,t.id)}),t.branch&&i.push({label:F(`menu.renameBranch`),section:`git`,rare:!0,...Hk(`tasks.renameBranch`),run:()=>B.set((0,L.jsx)(Dr,{title:F(`menu.renameBranch`),initial:t.branch,submitLabel:F(`dialog.save`),onSubmit:e=>r.request(`task.setBranch`,{taskId:t.id,branch:e}).then(()=>{})}))}),t.kind===`task`&&t.branch&&i.push({label:F(`menu.land`),section:`git`,run:()=>void Gg(e,t)});let o=[{label:F(`menu.copyWhat.id`),run:()=>void Uk(t.id,F(`menu.what.id`))}];return t.branch&&o.push({label:F(`menu.copyWhat.branch`),run:()=>void Uk(t.branch,F(`menu.what.branch`))}),o.push({label:F(`menu.copyWhat.path`),run:()=>void r.request(`task.get`,{taskId:t.id}).then(e=>Uk(e.task.worktreePath,F(`menu.what.path`))).catch(e=>H(String(e),`error`))}),i.push({label:F(`menu.copy`),section:`copy`,children:o}),t.kind!==`main`&&i.push({label:W(`tasks`,t.archived?`menu.unarchive`:`menu.archive`),section:`danger`,run:()=>void e_(e,t)}),i.push({label:F(`menu.removeSession`),section:`danger`,...Hk(`sidebar.delete`),danger:!0,run:()=>B.set(t.kind===`main`?$g(e,t):Qg(e,t))}),i}var Yk=`rove.collapsedProjects`,Xk=`rove.foldedTasks`,Zk=`rove.openedTasks`,Qk=600;function $k(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 eA(e,t){try{localStorage.setItem(e,JSON.stringify([...t]))}catch{}}var tA=(e,t)=>{let n=new Set(e);return n.delete(t)||n.add(t),n};function nA(){let e=_(ff),[t,n]=(0,h.useState)({active:!1,query:``}),[r,i]=(0,h.useState)(()=>$k(Yk)),a=e=>i(t=>{let n=tA(t,e);return eA(Yk,n),n}),[o,s]=(0,h.useState)(()=>({folded:$k(Xk),opened:$k(Zk)}));return{sort:e,cycleSort:mf,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)),eA(Xk,r),eA(Zk,i),{folded:r,opened:i}})}}var rA=[`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 iA(e){for(let t of e)for(let e of rA){let n=Ci(e).indexOf(t);if(n>=0)return{id:e,slot:n}}return null}function aA(e,t){let n=e.selection.get().taskId===t;e.select(t),Ka(),n&&!Vh(e.client)&&Ca()}function oA(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)(()=>u_.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`&&Ya(t.groupId),t?.kind===`pane`&&Fk(e,t),t&&Ka()},_=(t,n)=>{t?.kind===`task`&&pn(Jk(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=xl(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}),H(F(`rail.engineSwitched`,{engine:i.name}))}catch(e){H(F(`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=iA(Gs(t));if(hf.get()){let n=o?.kind===`task`&&o.machine===void 0;if(d?.id===`sidebar.nav`)n&&vf(e,o,d.slot%2==0?1:-1);else if(d?.id===`sidebar.localMerge`||t.key===`Enter`||t.key===`Escape`)_f(!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<Qk?(m(0),c.current=0):c.current=Date.now();break;case`sidebar.select`:case`sidebar.tree.open`:g(o);break;case`tasks.focusEngine`:Ca();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&&_f(!0);break;case`sidebar.sort`:n.cycleSort(),H(W(`tasks`,`sort.label`,{mode:W(`tasks`,`sort.modes.${ff.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`:Ja(`worktrees`);break;case`tasks.update`:Ja(`update`);break;default:return}t.preventDefault()}}}var sA=192,cA=`rove.web.railWidth`,lA=`rove.web.railFolded`;function uA(){let e=Number(localStorage.getItem(cA));return Number.isFinite(e)&&e>0?e:null}var dA=g(uA());dA.subscribe(()=>{let e=dA.get();e===null?localStorage.removeItem(cA):localStorage.setItem(cA,String(Math.round(e)))}),dA.subscribe(Ln);var fA=g(localStorage.getItem(lA)===`1`);fA.subscribe(()=>localStorage.setItem(lA,fA.get()?`1`:`0`));var pA=g(!1),mA=null;function hA(e){mA!==null&&window.clearTimeout(mA),mA=null,e?pA.set(!0):mA=window.setTimeout(()=>pA.set(!1),250)}fA.subscribe(()=>pA.set(!1)),fA.subscribe(Ln);function gA(e,t=window.innerWidth){let n=Math.max(sA,t-320);return Math.max(sA,Math.min(n,Math.round(e)))}var _A=(e,t,n)=>`~pane:${e}:${t}:${n}`;function vA(e,t){return e.flatMap(e=>e.kind===`task`?[e,...(t[e.task.id]??[]).flatMap(t=>{let n=t.split;if(!n||!Iu(n))return[];let r=zu(n,Nu(t));return Fu(n.root).map(n=>({id:_A(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 yA(e){let{row:t}=e;return(0,L.jsxs)(`button`,{type:`button`,className:`${vr({size:`pane`})} ${e.cursor?Pf:``}`,title:F(`compare.menu`),onClick:()=>{e.onClick(),Ya(t.groupId)},...e.place,children:[e.guides&&(0,L.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,L.jsx)(`span`,{className:wf(e)},t))}),(0,L.jsx)(`span`,{className:`${yr} text-(length:--fs-meta) text-muted`,children:t.title}),(0,L.jsxs)(`span`,{className:`${wr} ml-auto items-center`,children:[e.repo&&(0,L.jsx)(`span`,{className:`max-w-24 truncate text-subtle`,children:e.repo}),(0,L.jsx)(`span`,{className:`text-subtle`,children:t.tasks.length}),(0,L.jsx)(Lw,{status:tw(t.tasks)})]})]})}function bA(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,L.jsxs)(`div`,{className:`${jf} mono items-center`,children:[(0,L.jsx)(`span`,{className:`text-accent`,children:`/`}),(0,L.jsx)(`input`,{ref:t,className:Mf,type:`text`,autoFocus:!0,spellCheck:!1,autoComplete:`off`,autoCapitalize:`off`,enterKeyHint:`go`,value:e.query,placeholder:F(`rail.searchPlaceholder`),"aria-label":F(`rail.searchPlaceholder`),onChange:t=>e.onChange(t.target.value)}),e.query&&(0,L.jsx)(`span`,{className:`ml-1.5 text-muted`,children:e.count})]})}var xA=Math.min,SA=Math.max,CA=Math.round,wA=Math.floor,TA=e=>({x:e,y:e}),EA={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function DA(e,t,n){return SA(e,xA(t,n))}function OA(e,t){return typeof e==`function`?e(t):e}function kA(e){return e.split(`-`)[0]}function AA(e){return e.split(`-`)[1]}function jA(e){return e===`x`?`y`:`x`}function MA(e){return e===`y`?`height`:`width`}function NA(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function PA(e){return jA(NA(e))}function FA(e,t,n){n===void 0&&(n=!1);let r=AA(e),i=PA(e),a=MA(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=WA(o)),[o,WA(o)]}function IA(e){let t=WA(e);return[LA(e),t,LA(t)]}function LA(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var RA=[`left`,`right`],zA=[`right`,`left`],BA=[`top`,`bottom`],VA=[`bottom`,`top`];function HA(e,t,n){switch(e){case`top`:case`bottom`:return n?t?zA:RA:t?RA:zA;case`left`:case`right`:return t?BA:VA;default:return[]}}function UA(e,t,n,r){let i=AA(e),a=HA(kA(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(LA)))),a}function WA(e){let t=kA(e);return EA[t]+e.slice(t.length)}function GA(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function KA(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:GA(e)}function qA(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 JA(e,t,n){let{reference:r,floating:i}=e,a=NA(t),o=PA(t),s=MA(o),c=kA(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=AA(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function YA(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}=OA(t,e),p=KA(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=qA(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=qA(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 XA=50,ZA=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:YA},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=JA(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<XA&&(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}=JA(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},QA=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}=OA(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=kA(r),_=NA(o),v=kA(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[WA(o)]:IA(o)),x=p!==`none`;!d&&x&&b.push(...UA(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=FA(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`||_===NA(t)||T.every(e=>NA(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=NA(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{}}}},$A=new Set([`left`,`top`]);async function ej(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=kA(n),s=AA(n),c=NA(n)===`y`,l=$A.has(o)?-1:1,u=a&&c?-1:1,d=OA(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 tj=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 ej(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}}}}},nj=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}=OA(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=NA(i),p=jA(f),m=u[p],h=u[f],g=(e,t)=>DA(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 rj(){return typeof window<`u`}function ij(e){return sj(e)?(e.nodeName||``).toLowerCase():`#document`}function aj(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function oj(e){return((sj(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function sj(e){return rj()?e instanceof Node||e instanceof aj(e).Node:!1}function cj(e){return rj()?e instanceof Element||e instanceof aj(e).Element:!1}function lj(e){return rj()?e instanceof HTMLElement||e instanceof aj(e).HTMLElement:!1}function uj(e){return!rj()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof aj(e).ShadowRoot}function dj(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Sj(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function fj(e){return/^(table|td|th)$/.test(ij(e))}function pj(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var mj=/transform|translate|scale|rotate|perspective|filter/,hj=/paint|layout|strict|content/,gj=e=>!!e&&e!==`none`,_j;function vj(e){let t=cj(e)?Sj(e):e;return gj(t.transform)||gj(t.translate)||gj(t.scale)||gj(t.rotate)||gj(t.perspective)||!bj()&&(gj(t.backdropFilter)||gj(t.filter))||mj.test(t.willChange||``)||hj.test(t.contain||``)}function yj(e){let t=wj(e);for(;lj(t)&&!xj(t);){if(vj(t))return t;if(pj(t))return null;t=wj(t)}return null}function bj(){return _j??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),_j}function xj(e){return/^(html|body|#document)$/.test(ij(e))}function Sj(e){return aj(e).getComputedStyle(e)}function Cj(e){return cj(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function wj(e){if(ij(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||uj(e)&&e.host||oj(e);return uj(t)?t.host:t}function Tj(e){let t=wj(e);return xj(t)?(e.ownerDocument||e).body:lj(t)&&dj(t)?t:Tj(t)}function Ej(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Tj(e),i=r===e.ownerDocument?.body,a=aj(r);if(i){let e=Dj(a);return t.concat(a,a.visualViewport||[],dj(r)?r:[],e&&n?Ej(e):[])}return t.concat(r,Ej(r,[],n))}function Dj(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Oj(e){let t=Sj(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=lj(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=CA(n)!==a||CA(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function kj(e){return cj(e)?e:e.contextElement}function Aj(e){let t=kj(e);if(!lj(t))return TA(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Oj(t),o=(a?CA(n.width):n.width)/r,s=(a?CA(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var jj=TA(0);function Mj(e){let t=aj(e);return!bj()||!t.visualViewport?jj:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Nj(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===aj(e)}function Pj(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=kj(e),o=TA(1);t&&(r?cj(r)&&(o=Aj(r)):o=Aj(e));let s=Nj(a,n,r)?Mj(a):TA(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=aj(a),t=cj(r)?aj(r):r,n=e,i=Dj(n);for(;i&&t!==n;){let e=Aj(i),t=i.getBoundingClientRect(),r=Sj(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=aj(i),i=Dj(n)}}return qA({width:u,height:d,x:c,y:l})}function Fj(e,t){let n=Cj(e).scrollLeft;return t?t.left+n:Pj(oj(e)).left+n}function Ij(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Fj(e,n),y:n.top+t.scrollTop}}function Lj(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=oj(r),s=t?pj(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=TA(1),u=TA(0),d=lj(r);if((d||!a)&&((ij(r)!==`body`||dj(o))&&(c=Cj(r)),d)){let e=Pj(r);l=Aj(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Ij(o,c):TA(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 Rj(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function zj(e){let t=Cj(e),n=e.ownerDocument.body,r=SA(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=SA(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Fj(e),o=-t.scrollTop;return Sj(n).direction===`rtl`&&(a+=SA(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var Bj=25;function Vj(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=aj(e),a=oj(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!bj()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Fj(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<=Bj&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Hj(e,t){let n=Pj(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Aj(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Uj(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Vj(e,n,t);else if(t===`document`)r=zj(oj(e));else if(cj(t))r=Hj(t,n);else{let n=Mj(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return qA(r)}function Wj(e,t){let n=t.get(e);if(n)return n;let r=Ej(e,[],!1).filter(e=>cj(e)&&ij(e)!==`body`),i=null,a=Sj(e).position===`fixed`,o=a?wj(e):e;for(;cj(o)&&!xj(o);){let e=Sj(o),t=vj(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=wj(o)}return t.set(e,r),r}function Gj(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?pj(t)?[]:Wj(t,this._c):[].concat(n),r],o=Uj(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=Uj(t,a[e],i);s=SA(n.top,s),c=xA(n.right,c),l=xA(n.bottom,l),u=SA(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Kj(e){let{width:t,height:n}=Oj(e);return{width:t,height:n}}function qj(e,t,n){let r=lj(t),i=oj(t),a=n===`fixed`,o=Pj(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=TA(0);if((r||!a)&&((ij(t)!==`body`||dj(i))&&(s=Cj(t)),r)){let e=Pj(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Fj(i));let l=i&&!r&&!a?Ij(i,s):TA(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 Jj(e){return Sj(e).position===`static`}function Yj(e,t){if(!lj(e)||Sj(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return oj(e)===n&&(n=n.ownerDocument.body),n}function Xj(e,t){let n=aj(e);if(pj(e))return n;if(!lj(e)){let t=wj(e);for(;t&&!xj(t);){if(cj(t)&&!Jj(t))return t;t=wj(t)}return n}let r=Yj(e,t);for(;r&&fj(r)&&Jj(r);)r=Yj(r,t);return r&&xj(r)&&Jj(r)&&!vj(r)?n:r||yj(e)||n}var Zj=async function(e){let t=this.getOffsetParent||Xj,n=this.getDimensions,r=await n(e.floating);return{reference:qj(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Qj(e){return Sj(e).direction===`rtl`}var $j={convertOffsetParentRelativeRectToViewportRelativeRect:Lj,getDocumentElement:oj,getClippingRect:Gj,getOffsetParent:Xj,getElementRects:Zj,getClientRects:Rj,getDimensions:Kj,getScale:Aj,isElement:cj,isRTL:Qj};function eM(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function tM(e,t,n){let r=null,i,a=oj(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=wA(d),h=wA(a.clientWidth-(u+f)),g=wA(a.clientHeight-(d+p)),_=wA(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:SA(0,xA(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!eM(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=aj(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function nM(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=kj(e),u=i||a?[...l?Ej(l):[],...t?Ej(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?tM(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?Pj(e):null;c&&g();function g(){let t=Pj(e);h&&!eM(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 rM=tj,iM=nj,aM=QA,oM=(e,t,n)=>{let r=new Map,i=n??{},a={...$j,...i.platform,_c:r};return ZA(e,t,{...i,platform:a})},sM=`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`,cM=500,lM=400,uM=`rove-tip`,dM=null,fM=null,pM=null,mM=null,hM=0,gM=!1,_M=()=>gM;function vM(){return dM?.isConnected?dM:(dM=document.createElement(`div`),dM.id=uM,dM.setAttribute(`role`,`tooltip`),dM.className=sM,dM.hidden=!0,document.body.append(dM),dM)}function yM(){mM!==null&&window.clearTimeout(mM),mM=null}function bM(e,t,n=`top`){yM(),xM();let r=vM();r.textContent=t,r.hidden=!1,fM=e,e.setAttribute(`aria-describedby`,uM),pM=nM(e,r,()=>{if(!e.isConnected)return xM();oM(e,r,{strategy:`fixed`,placement:n,middleware:[rM(6),aM(),iM({padding:8})]}).then(({x:e,y:t})=>{r.style.left=`${e}px`,r.style.top=`${t}px`})})}function xM(){yM(),fM&&(pM?.(),pM=null,fM.getAttribute(`aria-describedby`)===uM&&fM.removeAttribute(`aria-describedby`),fM=null,dM&&(dM.hidden=!0),hM=performance.now())}function SM(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 CM(e){if(e===fM)return;yM();let t=fM!==null||performance.now()-hM<lM,n=()=>e.isConnected&&e.dataset.tip&&bM(e,e.dataset.tip);t?n():mM=window.setTimeout(n,cM)}var wM=!1;function TM(){wM||(wM=!0,document.addEventListener(`pointerover`,e=>{if(e.pointerType===`touch`)return;let t=SM(e.target);t?CM(t):fM&&e.target instanceof Node&&fM.contains(e.target)||xM()}),document.addEventListener(`pointerout`,e=>{let t=SM(e.target);t&&!(e.relatedTarget instanceof Node&&t.contains(e.relatedTarget))&&xM()}),document.addEventListener(`keydown`,e=>{gM=!0,e.key===`Escape`&&xM()},!0),document.addEventListener(`pointerdown`,()=>{gM=!1,xM()},!0),document.addEventListener(`focusin`,e=>{let t=gM?SM(e.target):null;t&&CM(t)}),document.addEventListener(`focusout`,e=>{e.target===fM&&xM()}),window.addEventListener(`blur`,xM))}var EM=450,DM=e=>{let t=e.querySelector(`.row-title`);return!!t&&t.scrollWidth>t.clientWidth};function OM(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(()=>bM(e,i.current,`right`),EM)},s=()=>{a(),xM()};return(0,h.useEffect)(()=>{let e=r.current,n=e?.closest(`.rail`);if(!t||!e||!n||!_M()||!n.contains(document.activeElement)||!DM(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`||!DM(e.currentTarget)||o(e.currentTarget)},onPointerLeave:s,hide:s}}function kM({at:e}){let t=new Date(e);if(Number.isNaN(t.getTime()))return null;let n=em(t);return(0,L.jsxs)(`span`,{className:`text-subtle`,title:F(`rail.startsAt`,{time:t.toLocaleString()}),children:[`◷ `,n]})}var AM=`block size-3.5 flex-none translate-y-px`,jM=`animate-mark-pulse motion-reduce:[animation-duration:4.8s]`;function MM(e){let t=e.status?.look;if(t===`waiting`||t===`error`)return(0,L.jsx)(`span`,{className:`${AM} text-center font-mono text-meta leading-3.5 font-semibold ${tf[e.status?.tone??`muted`]}`,"aria-hidden":`true`,children:t===`waiting`?`?`:`!`});let n=e.status&&(t===`idle`?`text-muted`:tf[e.status.tone]);return(0,L.jsx)(`svg`,{className:`${AM} ${n??(e.icon?`text-ink`:`text-muted`)} ${t===`working`?jM:``}`,viewBox:e.icon?.viewBox??`0 0 14 14`,role:e.name?`img`:void 0,"aria-label":e.name,"aria-hidden":!e.name||void 0,children:e.icon?e.icon.paths.map(e=>(0,L.jsx)(`path`,{d:e.d,fill:n?`currentColor`:e.fill??`currentColor`,fillRule:e.evenodd?`evenodd`:void 0},e.d)):(0,L.jsx)(`circle`,{cx:`7`,cy:`7`,r:`4.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.2`})})}var NM=150,PM=128,FM=0,IM=2,LM=[{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}],RM=`/-\\|`,zM=6,BM=(e,t,n,r)=>{let i=e[n];i&&t>=0&&t<i.length&&(i[t]=r)};function VM(e,t){let n=Math.min(64,Math.max(24,Math.floor(t))),r=(Math.floor(e)%NM+NM)%NM,i=Array.from({length:11},()=>Array(n).fill(` `)),a=Array.from({length:11},()=>Array(n).fill(` `));BM(a,FM,0,`o`);let o=IM+2*(LM.length-1),s=Math.min(o,Math.floor(r/2));for(let e=1;e<=s;e++)BM(i,FM,e,`|`);if(LM.forEach((e,t)=>{let o=IM+2*t,s=2*o;if(r<s)return;BM(i,FM,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))%zM+zM)%zM===0?BM(a,t,o,`=`):BM(i,t,o,`-`);d?BM(a,u,o,`o`):u<l?BM(a,u,o,`>`):BM(a,u,o,RM[(Math.floor(r/2)+t)%4]??`-`)}),r>=PM){let e=Math.ceil((r-PM+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(`
40
+ `)}`},e.label))]})}var cO=30;function lO(e,t,n){let r=t.join(`\0`),[i,a]=(0,h.useState)(()=>Object.fromEntries(t.map(t=>[t,J(e,`routine.runs`,{id:t})?.runs??[]])));return(0,h.useEffect)(()=>{let n=!0;for(let r of t)X(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 uO(e){I();let{auto:t}=Tw(),[n,r]=(0,h.useState)(null),i=ZD(e.runs,n),a=e=>{if(e.status===`skipped_blocked`){let t=e.blocked?.reason;return t?$(F(`runLog.blockedRun`),{reason:F(`runLog.blocked.${t}`)}):F(`runLog.outcome.blocked`)}return t.runStatus[e.status]??e.status},o=(e,t,n,r)=>(0,L.jsx)(R,{variant:`pill`,hit:`tight`,"aria-current":t,className:`max-w-40 truncate`,onClick:n,children:`[ ${e} ]`},r);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`h2`,{className:`${z} text-muted`,children:F(`runLog.title`)}),(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1`,children:[o(F(`runLog.all`),n===null,()=>r(null),`all`),KD.map(e=>o(F(`runLog.outcome.${e}`),n===e,()=>r(e),e))]}),i.length===0?(0,L.jsx)(`p`,{className:`text-muted`,children:e.runs.length===0?t.noRuns:F(`runLog.empty`)}):i.slice(0,cO).map(n=>{let r=aO(n.status),i=jE(n,e.now),o=i===`awaiting`?`, ${t.responseAwaiting}`:i===`missing`?`, ${t.responseMissing}`:``,s=YD(n),c=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{children:iO[r]}),(0,L.jsx)(`span`,{children:`#${n.runNumber}`}),(0,L.jsx)(`span`,{className:ND,children:`${a(n)}${n.tabId?`, ${n.tabId}`:``}${o}`}),(0,L.jsx)(`span`,{className:`text-subtle`,children:F(`runLog.source.${JD[n.trigger]}`)}),s!==null&&(0,L.jsx)(`span`,{className:`text-muted`,children:XD(s)}),(0,L.jsx)(`span`,{className:`text-muted`,children:e.when(n.at)})]}),l=n.error?eO(n.error):null,u=n.taskId,d=i===`missing`?`text-warning`:rO[r];return(0,L.jsxs)(`div`,{className:`${kD} ${d}`,children:[u?(0,L.jsx)(`button`,{type:`button`,className:`mono ${MD}`,onClick:()=>e.openRun(u),children:c}):(0,L.jsx)(`span`,{className:`mono ${jD}`,children:c}),l&&(0,L.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,L.jsx)(`summary`,{children:l.summary}),(0,L.jsx)(`pre`,{children:l.full})]})]},n.id)}),i.length>cO&&(0,L.jsx)(`p`,{className:`text-muted`,children:F(`runLog.more`,{count:i.length-cO})})]})}function dO(e){let{auto:t}=Tw(),n=Ew(),r=I()===`zh`?`zh-CN`:`en-US`,{routine:i,busy:a,when:o}=e,s=cD(i.schedule,n),c=i.nextRunAt?Date.parse(i.nextRunAt):NaN;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:TD,children:[(0,L.jsx)(`h2`,{className:ED,children:i.name}),(0,L.jsxs)(`span`,{className:`mono ${Py}`,children:[(0,L.jsx)(`button`,{type:`button`,className:`${sn} ${Fy.row}`,disabled:a,onClick:e.onRunNow,children:t.runNow}),(0,L.jsx)(`button`,{type:`button`,className:`${sn} ${Fy.row}`,disabled:a,onClick:e.onToggle,children:F(i.enabled?`pages.routinePause`:`pages.routineEnable`)}),(0,L.jsx)(`button`,{type:`button`,className:`${sn} ${Fy.row}`,disabled:a,onClick:e.onDelete,children:F(`pages.delete`)})]})]}),(0,L.jsxs)(`dl`,{className:DD,children:[(0,L.jsx)(`dt`,{className:`text-muted`,children:F(`pages.routineSchedule`)}),(0,L.jsxs)(`dd`,{children:[s??(0,L.jsx)(`span`,{className:`mono`,children:i.schedule}),s&&(0,L.jsx)(`span`,{className:`mono text-muted`,children:` ${i.schedule}`})]}),(0,L.jsx)(`dt`,{className:`text-muted`,children:F(`pages.routineNext`)}),(0,L.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,L.jsx)(`dt`,{className:`text-muted`,children:F(`pages.routineProject`)}),(0,L.jsx)(`dd`,{children:e.project}),!i.script&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`dt`,{className:`text-muted`,children:F(`pages.routineDelivers`)}),(0,L.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,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`dt`,{className:`text-muted`,children:F(`pages.routineEngine`)}),(0,L.jsxs)(`dd`,{className:`flex flex-wrap items-baseline gap-x-3.5`,children:[(0,L.jsx)(`span`,{children:e.engine}),(0,L.jsx)(R,{className:`font-mono`,hit:`tight`,disabled:a,onClick:e.onChangeEngine,children:F(`pages.routineChangeEngine`)})]})]})]}),i.precheck&&(0,L.jsx)(`p`,{className:`mono text-muted`,children:$(t.precheck,{command:i.precheck.command})}),i.script?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`h2`,{className:`${z} text-muted`,children:F(`pages.routineScript`)}),(0,L.jsx)(`p`,{className:`mono ${OD}`,children:i.script.command})]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`h2`,{className:`${z} text-muted`,children:F(`pages.routinePrompt`)}),(0,L.jsx)(`p`,{className:OD,children:i.prompt})]}),(0,L.jsx)(uO,{runs:e.runs,now:e.now,when:o,openRun:e.openRun}),(0,L.jsx)(oO,{runs:e.runs,when:o})]})}var fO=5e3;function pO({model:e}){let{auto:t,common:n}=Tw(),r=e.client,[i,a]=Nw(fO),o=_(e.tasks),s=jw(e),c=Mw(e),[l,u]=(0,h.useState)(()=>J(r,`routine.list`)??null),[d,f]=(0,h.useState)(null),[p,m]=(0,h.useState)(null),[g,v]=(0,h.useState)(null),y=Iw(),b=Ew(),x=(0,h.useRef)(null);(0,h.useEffect)(()=>{let e=!0;return X(r,`routine.list`).then(t=>e&&u(t)).catch(()=>e&&u(e=>e??{automations:[],keepsDaemonAlive:!1})),()=>{e=!1}},[r,i]);let[S,C]=(0,h.useState)(()=>J(r,`engines.list`)?.engines??[]);(0,h.useEffect)(()=>{let e=!0;return X(r,`engines.list`).then(t=>e&&C(t.engines)).catch(()=>{}),()=>{e=!1}},[r]);let w=l?.automations??[],T=l?.lastRunStatus??{},E=l?.lastFailure??{},D=e=>{let t=T[e.id];return t!==void 0&&AE(t)},O=[{key:`pages.routinesNeedYou`,rows:w.filter(D)},{key:`pages.routinesActive`,rows:w.filter(e=>e.enabled&&!D(e))},{key:`pages.routinesPaused`,rows:w.filter(e=>!e.enabled&&!D(e))}],k=O.flatMap(e=>e.rows),ee=Math.max(0,k.findIndex(e=>e.id===d)),A=k[ee],te=e=>f(k[e]?.id??null),ne=O[0]?.rows.length??0,j=_(yn);(0,h.useEffect)(()=>{j===null||!l||(l.automations.some(e=>e.id===j)&&f(j),yn.set(null))},[j,l]);let re=lO(r,A?[A.id]:[],i),M=A?re[A.id]??[]:[];(0,h.useEffect)(()=>v(null),[A?.id]);let N=(0,h.useRef)(null),[ie,ae]=(0,h.useState)(0),oe=(0,h.useRef)(0);(0,h.useEffect)(()=>{let e=x.current,t=ie!==oe.current;if(oe.current=ie,t&&e&&N.current&&e.offsetTop>N.current.offsetTop){e.scrollIntoView({block:`start`,behavior:`smooth`});return}N.current?.querySelector(`[data-row="${ee}"]`)?.scrollIntoView({block:`nearest`})},[ee,ie]);let se=Date.now(),ce=e=>{let n=e?Date.parse(e):NaN;if(!Number.isFinite(n))return`—`;let r=n-se,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()},P=e=>o?.tasks.find(t=>t.id===e)?.label??e,le=t=>{V.set(null),e.select(t)},ue=(e,t,n)=>H($(e,{name:t,error:Dw(n)}),`error`),de=async()=>{if(!(!A||p)){m(A.id);try{await r.request(`routine.setEnabled`,{id:A.id,enabled:!A.enabled}),a()}catch(e){ue(A.enabled?t.disableFailed:t.enableFailed,A.name,e)}finally{m(null)}}},fe=async()=>{if(!(!A||p)){m(A.id),v($(t.running,{name:A.name}));try{let e=await r.request(`routine.runNow`,{id:A.id});v($(t.ranWith,{name:A.name,status:e.status})),a()}catch(e){ue(t.runFailed,A.name,e)}finally{m(null)}}},pe=async()=>{if(p)return;let e=Aw(await r.request(`repos.list`).then(e=>e.repos).catch(()=>[]),s);B.set((0,L.jsx)(GD,{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){H($(t.createFailed,{error:Dw(e)}),`error`)}finally{m(null)}})()}}))},me=()=>{if(!A||p)return;let e=A;B.set((0,L.jsx)(Or,{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)}}}))};Fw(e=>{if(e.ctrlKey)return e.key===`c`&&(V.set(null),!0);switch(e.key){case`Escape`:case`q`:return V.set(null),!0;case`j`:case`ArrowDown`:return te(Math.min(k.length-1,ee+1)),!0;case`k`:case`ArrowUp`:return te(Math.max(0,ee-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=M[0]?.taskId;return e?le(e):M.length>0&&v(t.latestRunNoTask),!0}default:return!1}});let he=e=>kE(e,e=>S.find(t=>t.id===e)?.name??e,t.engineDefault),ge=()=>{if(!A)return;let n=A;B.set((0,L.jsx)(mD,{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??``});v($(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?F(`rail.noProject`):kw(e,w.flatMap(e=>e.repo??[]));return(0,L.jsxs)(`div`,{className:`${ky} ${hD}`,tabIndex:0,ref:y,children:[(0,L.jsxs)(`div`,{className:My,children:[(0,L.jsx)(`h1`,{className:jy,children:t.title}),(0,L.jsxs)(`span`,{className:`mono ${Py}`,children:[ne>0&&(0,L.jsx)(`span`,{className:`text-error`,children:$(t.needAttention,{count:String(ne),total:String(k.length)})}),(0,L.jsx)(`span`,{className:`text-muted`,children:l?.keepsDaemonAlive?t.holdingDaemon:t.notHolding}),(0,L.jsx)(`button`,{type:`button`,className:`${sn} ${Fy.header}`,onClick:()=>void pe(),children:F(`pages.new`)})]})]}),(0,L.jsx)(VD,{client:r,tick:i,reload:a}),l===null?(0,L.jsx)(`p`,{className:`text-muted`,children:n.loading}):k.length===0?(0,L.jsxs)(`div`,{className:Iy,children:[(0,L.jsx)(`p`,{className:`text-muted`,children:t.empty}),(0,L.jsx)(`p`,{className:`keys-only`,children:t.emptyHint})]}):(0,L.jsxs)(`div`,{className:gD,children:[(0,L.jsx)(`div`,{className:_D,ref:N,children:O.map(e=>e.rows.length===0?null:(0,L.jsxs)(`section`,{children:[(0,L.jsxs)(`h2`,{className:`${z} ${vD} ${e===O[0]?`text-error`:`text-muted`}`,children:[F(e.key),` `,(0,L.jsx)(`span`,{className:`mono`,children:e.rows.length})]}),e.rows.map(e=>{let n=k.indexOf(e),r=T[e.id],i=r?aO(r):null;return(0,L.jsxs)(`div`,{"data-row":n,className:yD(n===ee),onClick:()=>{te(n),ae(e=>e+1)},children:[(0,L.jsxs)(`span`,{className:bD,children:[(0,L.jsx)(`span`,{className:xD(!e.enabled),children:e.name}),(0,L.jsx)(`span`,{className:`mono text-muted ${SD}`,children:e.enabled?ce(e.nextRunAt):t.paused}),(0,L.jsx)(`span`,{className:`mono ${i?rO[i]:`text-muted`}`,style:{width:`1ch`},children:i?iO[i]:` `})]}),(0,L.jsx)(`span`,{className:`mono text-muted ${CD}`,title:e.schedule,children:[_e(e.repo),cD(e.schedule,b)??e.schedule,he(e)?.short].filter(Boolean).join(` · `)}),E[e.id]?(0,L.jsx)(`span`,{className:`mono text-warning ${CD}`,title:E[e.id]?.reason,children:$(t.lastFailed,{when:ce(E[e.id]?.at),reason:E[e.id]?.reason??``})}):null]},e.id)})]},e.key))}),(0,L.jsx)(`div`,{className:wD,ref:x,children:A?(0,L.jsx)(dO,{routine:A,runs:M,busy:p===A.id,project:_e(A.repo),engine:he(A)?.full??null,targetTitle:A.target?P(A.target.taskId):void 0,now:se,when:ce,openRun:le,onRunNow:()=>void fe(),onToggle:()=>void de(),onDelete:me,onChangeEngine:ge}):(0,L.jsx)(`p`,{className:`text-muted`,children:t.noSelection})})]}),g&&(0,L.jsx)(`p`,{className:`text-muted mx-0 mt-2 mb-0 text-meta leading-[inherit]`,children:g})]})}var mO=`flex min-w-0 items-baseline gap-2.5 font-mono text-meta whitespace-nowrap`,hO=`${mO} w-full cursor-pointer border-none bg-transparent p-0 text-left text-inherit [font:inherit] [&:hover]:underline`,gO=`w-[5ch] flex-none text-muted`,_O=`w-[16ch] flex-none overflow-hidden text-accent`,vO=`mt-3.5 mb-0.5`,yO=`min-w-0 flex-1 truncate`,bO=`flex-none text-right text-muted`,xO=`${bO} min-w-[5ch]`,SO=`${bO} min-w-[4ch]`,CO=`${bO} min-w-[5ch]`,wO=`w-[8ch] flex-none overflow-hidden text-accent`,TO=`flex flex-wrap gap-x-3 font-mono text-meta text-muted`,EO=`m-0 text-meta text-muted`,DO={turns:0,tokens:0,ms:0},OO=e=>(e.usage?.input_tokens??0)+(e.usage?.output_tokens??0),kO=e=>Math.max(0,e.endedAt-e.startedAt),AO=(e,t)=>({turns:e.turns+1,tokens:e.tokens+OO(t),ms:e.ms+kO(t)});function jO(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function MO(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(jO(n.getTime()))}let a=new Map(i.map(e=>[e,{sum:DO,byEngine:{}}]));for(let t of e){let e=a.get(jO(t.startedAt));if(!e)continue;let n=t.vendor??`unknown`;e.sum=AO(e.sum,t),e.byEngine[n]=(e.byEngine[n]??0)+OO(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:jO(o)}:null;return{cutoff:s,days:i.map(e=>{let t=a.get(e);return{day:e,...t?.sum??DO,byEngine:t?.byEngine??{},partial:s!==null&&e<=s.day}})}}function NO(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,...AO(t.get(i)??DO,n)})}return[...t.values()].sort((e,t)=>t.tokens-e.tokens||t.turns-e.turns)}function PO(e,t){let n=new Map;for(let t of e)n.set(t.taskId,{taskId:t.taskId,...AO(n.get(t.taskId)??DO,t)});return[...n.values()].sort((e,t)=>t.tokens-e.tokens||t.turns-e.turns).slice(0,t)}function FO(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 IO=[``,`▏`,`▎`,`▍`,`▌`,`▋`,`▊`,`▉`];function LO(e,t,n){if(e<=0||t<=0)return``;let r=Math.max(1,Math.round(e/t*n*8));return`${`█`.repeat(Math.floor(r/8))}${IO[r%8]}`}var RO=[`█`,`▓`,`▒`,`░`];function zO(e,t,n,r){return n<=0?``:t.map((t,i)=>{let a=e[t]??0,o=a<=0?0:Math.max(1,Math.round(a/n*r));return(RO[i%RO.length]??`█`).repeat(o)}).join(``)}var BO=.1,VO=/^(\d+)\s*(h|d)$/;function HO(e,t){let n=VO.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*BO)||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 UO=14,WO=500,GO=3e4,KO=16,qO=8,JO=8;function YO(e,t,n,r){let i=J(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 X(e,t,n).then(e=>r&&o({kind:`ready`,value:e})).catch(e=>r&&o(t=>t.kind===`ready`?t:{kind:`failed`,error:Dw(e)})),()=>{r=!1}},[e,t,s,r]),a}var XO=e=>(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`${xO}`,children:FO(e.tokens)}),(0,L.jsx)(`span`,{className:`${SO}`,children:`${e.turns}t`}),(0,L.jsx)(`span`,{className:`${CO}`,children:XD(e.ms)})]});function ZO({usage:e,nameOf:t}){let n=Date.now(),r=e.flatMap(e=>e.windows.map(r=>{let i={engine:e.name||t(e.vendor),label:r.label,percent:Math.round(r.percent)},a=HO(r,n);if(a?.kind===`full`){let t=a.at-n<72e6,o=new Date(a.at).toLocaleString([],{...t?{}:{weekday:`short`},hour:`2-digit`,minute:`2-digit`});return{key:`${e.vendor}:${r.kind}`,text:$(F(`usage.full`),{...i,time:o})}}return{key:`${e.vendor}:${r.kind}`,text:$(F(a?`usage.lasts`:`usage.window`),i)}}));return r.length===0?null:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`h2`,{className:`${z} text-muted ${vO}`,children:F(`usage.quota`)}),r.map(e=>(0,L.jsx)(`p`,{className:`mono ${EO}`,children:e.text},e.key))]})}function QO({row:e,title:t,open:n}){let r=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:yO,children:t}),XO(e)]});return n?(0,L.jsx)(R,{variant:`row`,className:hO,onClick:n,children:r}):(0,L.jsx)(`div`,{className:mO,children:r})}function $O({model:e}){I();let t=Iw(),[n]=Nw(GO),r=YO(e,`turns.list`,{sinceDays:UO,limit:WO},n),i=YO(e,`engines.list`,{},n),a=YO(e,`usage.get`,{},n),o=_(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??F(`usage.removedTask`);return(0,L.jsxs)(`div`,{className:Ay,tabIndex:0,ref:t,onKeyDown:e=>{e.metaKey||e.ctrlKey||e.altKey||e.key!==`q`&&e.key!==`Escape`||(e.preventDefault(),V.set(null))},children:[(0,L.jsx)(`h1`,{className:jy,children:F(`usage.title`)}),(()=>{if(r.kind===`loading`)return(0,L.jsx)(`p`,{className:`text-muted`,children:F(`usage.loading`)});if(r.kind===`failed`)return(0,L.jsx)(`p`,{className:`text-error`,children:$(F(`usage.failed`),{error:r.error})});let t=r.value.turns,n=new Set(r.value.readers??[]),i=MO(t,Date.now(),UO,WO),s=new Map;for(let e of i.days)for(let[t,n]of Object.entries(e.byEngine))s.set(t,(s.get(t)??0)+n);let u=[...s].sort((e,t)=>t[1]-e[1]).map(([e])=>e),d=Math.max(0,...i.days.map(e=>e.tokens)),f=NO(t),p=Math.max(0,...f.map(e=>e.tokens)),m=[...new Set((o?.tasks??[]).flatMap(e=>e.engine?.id&&!n.has(e.engine.id)?[e.engine.id]:[]))];return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`p`,{className:EO,children:$(F(`usage.range`),{days:UO})}),t.length===0?(0,L.jsx)(`p`,{className:`text-muted`,children:F(`usage.empty`)}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`h2`,{className:`${z} text-muted ${vO}`,children:F(`usage.perDay`)}),(0,L.jsx)(`div`,{className:TO,children:u.map((e,t)=>(0,L.jsx)(`span`,{children:`${RO[t%RO.length]} ${c(e)}`},e))}),i.days.map(e=>(0,L.jsxs)(`div`,{className:mO,children:[(0,L.jsx)(`span`,{className:gO,children:`${e.day.slice(5)}${e.partial?`~`:``}`}),(0,L.jsx)(`span`,{className:_O,children:zO(e.byEngine,u,d,KO)}),XO(e)]},e.day)),i.cutoff&&(0,L.jsx)(`p`,{className:`m-0 text-meta text-muted`,children:$(F(`usage.cutoff`),{count:i.cutoff.count,day:i.cutoff.day.slice(5)})}),(0,L.jsx)(`h2`,{className:`${z} text-muted ${vO}`,children:F(`usage.byModel`)}),f.map(e=>(0,L.jsxs)(`div`,{className:mO,children:[(0,L.jsx)(`span`,{className:yO,title:`${c(e.engine)} · ${e.model}`,children:`${c(e.engine)} · ${e.model}`}),(0,L.jsx)(`span`,{className:wO,children:LO(e.tokens,p,qO)}),XO(e)]},`${e.engine}\0${e.model}`)),(0,L.jsx)(`h2`,{className:`${z} text-muted ${vO}`,children:F(`usage.topTasks`)}),PO(t,JO).map(t=>(0,L.jsx)(QO,{row:t,title:l(t.taskId),open:o?.tasks.some(e=>e.id===t.taskId)?()=>{V.set(null),e.select(t.taskId)}:null},t.taskId))]}),m.length>0&&(0,L.jsx)(`p`,{className:`m-0 text-meta text-muted`,children:$(F(`usage.noReader`),{engines:m.map(c).join(`, `)})}),a.kind===`ready`&&a.value.usage&&(0,L.jsx)(ZO,{usage:a.value.usage,nameOf:c})]})})()]})}var ek={id:`mods`,label:`mods`},tk=[{id:`kanban`,label:`kanban`,mod:`kanban`},{id:`routines`,label:`automations`},{id:`issues`,label:`issues`,mod:`issues`}];function nk({model:e}){let{nav:t}=Tw(),n=_(V),r=_(e.mods).length>0,i=_(e.installedMods),a=[...tk.filter(e=>!e.mod||i.has(e.mod)),...r?[ek]:[]];return(0,L.jsxs)(`div`,{className:Hy,children:[(0,L.jsxs)(`button`,{type:`button`,className:`rail-nav-row ${Gy(!1)}`,onClick:()=>Uh(),children:[F(`rail.newTask`),(0,L.jsx)(`span`,{className:Ky,"aria-hidden":`true`,children:`+`})]}),a.map(e=>(0,L.jsx)(`button`,{type:`button`,className:`rail-nav-row ${Gy(n===e.id)}`,"aria-current":n===e.id?`page`:void 0,onClick:()=>Ja(e.id),children:t[e.label]},e.id))]})}function rk({model:e,page:t}){(0,h.useEffect)(()=>e.selection.subscribe(()=>V.set(null)),[e]);let n=_(e.installedMods);return t===`kanban`&&n.has(`kanban`)?(0,L.jsx)(dE,{model:e}):t===`routines`?(0,L.jsx)(pO,{model:e}):t===`issues`&&n.has(`issues`)?(0,L.jsx)(uT,{model:e}):t===`mods`?(0,L.jsx)(OE,{model:e}):t===`compare`?(0,L.jsx)(Qw,{model:e}):t===`usage`?(0,L.jsx)($O,{model:e}):null}var ik=f();function ak(e){return e?.match(/^https?:\/\/[^/]+\/([^/]+\/[^/]+)\/(?:pull|merge_requests|-\/merge_requests)\//)?.[1]}var ok=e=>e.charAt(0).toUpperCase()+e.slice(1);function sk(e){return[F(`rail.pr.state.${e.state}`),...e.checks?[F(`rail.pr.checks.${e.checks}`)]:[]].join(`, `)}function ck(e){let t=new Map;for(let n of e){let e=Cb(n),r=[...e&&n.pr?[{pr:n.pr,mark:e}]:[],...(n.sessionPrs??[]).flatMap(e=>{let t=wb(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&&Tb([a.mark,i])!==a.mark)&&t.set(r,{task:n,pr:e,mark:i})}}return[...t.values()]}function lk({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=cl();(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=ck(e),p=Tb(f.map(e=>e.mark));if(!p)return null;let m=f.length===1?`PR #${f[0]?.pr.number??``}, ${sk(p)}`:F(`rail.pr.many`,{count:f.length});return(0,L.jsxs)(`span`,{ref:o,className:`chip ${Ef} ${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,L.jsx)(`span`,{className:`font-sans`,children:f.length}),n&&(0,ik.createPortal)((0,L.jsx)(`div`,{ref:c,className:Df(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=ak(t?.url),i=t?.additions!==void 0&&t.deletions!==void 0;return(0,L.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,L.jsx)(`span`,{className:`truncate font-semibold text-ink`,children:t.title||e.label}),(0,L.jsxs)(`span`,{className:`flex items-baseline gap-0 text-meta leading-[inherit] whitespace-nowrap`,children:[(0,L.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.25 ${n.tone}`,children:[(0,L.jsx)(`span`,{className:`font-mono`,children:n.glyph}),ok(F(`rail.pr.state.${n.state}`))]}),(0,L.jsx)(`span`,{className:`overflow-hidden text-ellipsis whitespace-pre text-muted`,children:[...n.checks?[F(`rail.pr.checks.${n.checks}`)]:[],[r,t?.number===void 0?``:`#${t.number}`].filter(Boolean).join(` `)].filter(Boolean).map(e=>`, ${e}`).join(``)}),i&&(0,L.jsxs)(`span`,{className:`ml-auto flex gap-1.5 pl-3 tabular-nums`,children:[(0,L.jsxs)(`span`,{className:`text-success`,children:[`+`,t.additions]}),(0,L.jsxs)(`span`,{className:`text-error`,children:[`−`,t.deletions]})]})]})]},t.url??`${e.id}#${t.number??``}`)})}),document.body)]})}function uk(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 dk(e,t,n,r){let i=uk(e,t,n);return i===null?null:r===`above`&&i>0?i-1:r===`below`&&i<0?i+1:i}function fk(e,t){return e.id===t.id?!1:e.kind===`main`?t.kind===`main`:t.kind!==`main`&&t.repo===e.repo}function pk(e,t,n,r,i){if(!fk(t,n))return null;if(t.kind===`main`){let i=dk(e,t,n,r);return i?{steps:i}:null}let a=n.pinned===!0||i&&r===`above`,o={...t,pinned:a},s=a===(n.pinned===!0)?dk(e.map(e=>e.id===t.id?o:e),o,n,r)??0:0,c=a===(t.pinned===!0)?{}:{pin:a};return`pin`in c||s!==0?{...c,steps:s}:null}var mk=e=>e===void 0||e.kind===`project`||e.kind===`state`?0:e.kind===`task`||e.kind===`pane`||e.kind===`round`?e.depth:1;function hk(e,t){let n=mk(e[t]),r=t+1;for(;r<e.length&&mk(e[r])>n;)r++;return r}function gk(e,t,n){let r=e.findIndex(e=>e.id===t),i=r<0?e:[...e.slice(0,r),...e.slice(hk(e,r))];for(let e=i.findIndex(e=>e.id===n)-1;e>=0;e--){let t=i[e];if(!t||t.kind===`project`||t.kind===`state`)return!0;if(t.kind===`task`&&t.depth===1&&t.task.kind!==`main`||t.kind===`round`&&t.depth===1)return!1}return!1}function _k(e,t){let n=mk(e[t]),r=[];for(let i=2;i<=n;i++){let a=t+1;for(;a<e.length&&mk(e[a])>i;)a++;let o=a<e.length&&mk(e[a])===i;r.push(i===n?o?`tee`:`elbow`:o?`pipe`:`blank`)}return r}function vk(e,t,n,r){let i=e.findIndex(e=>e.id===t);if(i<0||t===n)return e;let a=hk(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:hk(s,c);return[...s.slice(0,l),...o,...s.slice(l)]}var yk={duration:180,easing:`cubic-bezier(0.16, 1, 0.3, 1)`};function bk(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}],yk):t!==e.offsetTop&&e.animate([{transform:`translateY(${t-e.offsetTop}px)`},{transform:`none`}],yk)}})}var xk=null,Sk=()=>(xk||(xk=new Image,xk.src=`data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7`),xk);function Ck(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);bk(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&&!xu(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(Sk(),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,hk(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&&!fk(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),pf(`default`),H(W(`tasks`,`sort.label`,{mode:W(`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=>H(W(`tasks`,`toast.moveFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)).finally(u);return}let h=pk(t,i.from,i.to,i.side,gk(m.current,i.fromRow,i.toRow));h?bf(e,i.from.id,h).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?vk(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,hk(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 wk({model:e,narrow:t,onSettings:n}){I();let r=_(Xx),i=Q(`engines.skill.bannerHintWeb`,{engines:r.join(`, `)});return(0,L.jsxs)(`div`,{className:Uy,children:[!t&&(0,L.jsx)(vC,{client:e.client}),(0,L.jsxs)(`div`,{className:Wy,children:[(0,L.jsxs)(`button`,{type:`button`,className:`rail-nav-row ${Gy(!1)}`,onClick:n,children:[(0,L.jsxs)(`svg`,{className:qy,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,L.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,L.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`})]}),(0,L.jsx)(`span`,{children:F(`rail.settings`)}),r.length>0&&(0,L.jsx)(`span`,{className:`ml-2 min-w-0 truncate text-meta text-subtle`,title:i,children:F(`rail.skillCue`)})]}),(0,L.jsx)(JC,{model:e,bindingId:`settings.open`})]})]})}function Tk(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 Ek=`rove.web.rail.shownMains`;function Dk(){try{let e=JSON.parse(localStorage.getItem(Ek)??`[]`);return Array.isArray(e)?Object.fromEntries(e.map(e=>[String(e),[null]])):{}}catch{return{}}}function Ok(e,t){try{let n=e.filter(e=>e.kind===`main`&&(t[e.id]?.length??0)>0).map(e=>e.id);localStorage.setItem(Ek,JSON.stringify(n))}catch{}}function kk(e,t,n){return(0,h.useEffect)(()=>{n&&Ok(e,t)},[n,e,t]),(0,h.useMemo)(()=>n?t:{...Dk(),...t},[n,t])}var Ak=g({});function jk(e,t,n){let r=Ak.get()[`${e}::${t.id}`];return r&&r.sig===Hu(n)&&Fu(n.root).some(e=>e.id===r.leaf)?r.leaf:n.activeLeafId}function Mk(e,t,n,r){Ak.set({...Ak.get(),[`${e}::${t}`]:{sig:Hu(n),leaf:r}})}function Nk(e,t,n,r){Mk(e,t.id,n,r),La(Bl(e,t.id,r))?.focus()}function Pk(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 Fk(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){H(e instanceof Error?e.message:String(e),`error`)}}function Ik(e,t,n,r,i){let a=i??(n.split?jk(t,n,n.split):`leaf-1`),o=e.selection.get();(o.taskId!==t||o.tabId!==n.id)&&e.select(t,n.id);let s=La(Bl(t,n.id,a))?.size();Fk(e,{taskId:t,tabId:n.id,action:`open`,direction:r,leafId:a,...s},e=>{e.changed?e.split&&Mk(t,n.id,e.split,e.leaf):H(F(`layout.splitTooSmall`),`error`)})}function Lk(e,t,n,r){let i=n.split,a=i?jk(t,n,i):r,o=()=>Fk(e,{taskId:t,tabId:n.id,action:`close`,leafId:r},e=>{let i=e.split;if(!i)return;let o=a!==r&&Fu(i.root).some(e=>e.id===a);Mk(t,n.id,i,o?a:i.activeLeafId)});if(!i||!Bu(n,i,r)){o();return}B.set((0,L.jsx)(Or,{title:F(`confirm.closePaneTitle`,{pane:zu(i,Nu(n)).get(r)??r}),body:F(`confirm.closePaneBody`),confirmLabel:F(`menu.closePane`),onConfirm:o}))}function Rk(e,t,n,r){let i=n.split;i&&B.set((0,L.jsx)(Dr,{title:yc(`split.renameTitle`),initial:zu(i,Nu(n)).get(r)??``,allowEmpty:!0,submitLabel:F(`dialog.save`),onSubmit:i=>Fk(e,{taskId:t,tabId:n.id,action:`rename`,leafId:r,title:i})}))}function zk(e,t,n,r){return[{label:F(`menu.renamePane`),section:`split`,key:ec(`workspace.split.rename`)??void 0,run:()=>Rk(e,t,n,r)},{label:F(`menu.closePane`),section:`split`,key:wi(`workspace.split.close`)||void 0,run:()=>Lk(e,t,n,r)}]}function Bk(e,t,n,r){return[{label:F(`menu.splitRight`),section:`split`,key:ec(`workspace.split.right`)??void 0,run:()=>Ik(e,t,n,`right`,r)},{label:F(`menu.splitDown`),section:`split`,key:ec(`workspace.split.down`)??void 0,run:()=>Ik(e,t,n,`down`,r)}]}function Vk(e,t,n,r){let i=n.split,a=r??(i?jk(t,n,i):`leaf-1`);return[...Bk(e,t,n,a),...Iu(i)?zk(e,t,n,a):[]]}function Hk(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)??ga(n);return!i||!Vu(i)?[]:Bk(e,t,i,i.split?jk(t,i,i.split):`leaf-1`)}function Uk(e,{task:t,tab:n,leaf:r}){n.split&&Nk(t.id,n,n.split,r),e.select(t.id,n.id)}function Wk(e){let{row:t}=e,n=_(e.model.selection);_(Ak);let r=n.taskId===t.task.id&&n.tabId===t.tab.id&&!!t.tab.split&&jk(t.task.id,t.tab,t.tab.split)===t.leaf;return(0,L.jsxs)(`button`,{type:`button`,className:`${vr({size:`pane`})} ${e.cursor?Pf:``}`,"aria-current":r||void 0,onClick:e.onClick,onContextMenu:e.onMenu,...e.place,children:[(0,L.jsx)(`span`,{className:xf,"aria-hidden":`true`,children:e.guides?.map((e,t)=>(0,L.jsx)(`span`,{className:wf(e)},t))}),(0,L.jsx)(`span`,{className:`${yr} text-(length:--fs-meta) ${r?`text-ink`:`text-muted`}`,children:t.label})]})}function Gk({model:e,task:t}){let[n,r]=(0,h.useState)(()=>J(e,`task.get`,{taskId:t.id})?.task??null),[i,a]=(0,h.useState)(null),{busy:o,error:s,submit:c}=Er();(0,h.useEffect)(()=>{X(e,`task.get`,{taskId:t.id}).then(e=>r(e.task)).catch(e=>a(U(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,L.jsx)(Tr,{title:W(`tasks`,`runAgain.title`),wide:!0,children:(0,L.jsxs)(`form`,{className:Yn,onSubmit:e=>{e.preventDefault(),l()},children:[(0,L.jsx)(`p`,{className:`text-muted`,children:W(`tasks`,`runAgain.source`,{title:t.label})}),(0,L.jsx)(`pre`,{className:nn,children:n?.prompt??i??W(`tasks`,`fieldNotes.loading`)}),(0,L.jsx)(`p`,{className:tn,children:W(`tasks`,`runAgain.hint`)}),s&&(0,L.jsx)(`p`,{className:`text-error`,children:s}),(0,L.jsx)(Ar,{busy:o||!n?.prompt,submitLabel:W(`tasks`,`runAgain.confirm`)})]})})}function Kk(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 qk({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:U(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(U(e))}}};return(0,L.jsx)(Tr,{title:W(`tasks`,`fieldNotes.title`),wide:!0,children:(0,L.jsxs)(`div`,{className:Yn,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,L.jsx)(`p`,{className:`font-mono text-meta break-all text-muted`,children:t}),n.kind===`loading`&&(0,L.jsx)(`p`,{className:`text-muted`,children:W(`tasks`,`fieldNotes.loading`)}),n.kind===`error`&&(0,L.jsx)(`p`,{className:`text-error`,children:n.message}),n.kind===`ready`&&f.length===0&&(0,L.jsx)(`p`,{className:`text-muted`,children:W(`tasks`,`fieldNotes.empty`)}),f.length>0&&(0,L.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,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{type:`button`,className:rn(t===i),onClick:()=>a(t),autoFocus:t===0,children:[(0,L.jsxs)(`span`,{className:`font-mono text-meta whitespace-pre text-accent`,children:[t===i?`▸ `:` `,Kk(e.at),`, `,e.author]}),(0,L.jsx)(`span`,{className:`text-ink whitespace-pre-wrap wrap-anywhere`,children:e.text})]})},`${e.at}:${t}`))}),o&&(0,L.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-line bg-paper px-3 py-2.5`,children:[(0,L.jsx)(`p`,{children:(0,L.jsx)(`strong`,{children:W(`tasks`,`fieldNotes.confirmDelete.title`)})}),(0,L.jsx)(`p`,{className:`text-muted`,children:W(`tasks`,`fieldNotes.confirmDelete.body`,{text:o.text})}),c&&(0,L.jsx)(`p`,{className:`text-error`,children:c}),(0,L.jsxs)(`div`,{className:`actions flex items-center justify-end gap-3.5`,children:[(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>s(null),children:F(`dialog.cancel`)}),(0,L.jsx)(`button`,{type:`button`,className:Be({danger:!0}),onClick:()=>void p(o),children:F(`taskops.retire`)})]})]}),!o&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`p`,{className:`keys-only font-sans text-meta text-subtle`,children:W(`tasks`,`fieldNotes.footerDeletable`)}),(0,L.jsxs)(`div`,{className:`actions flex items-center justify-end gap-3.5`,children:[(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,disabled:f[i]?.id===void 0,onClick:()=>s(f[i]??null),children:F(`taskops.retire`)}),(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:Pn,children:F(`taskops.close`)})]})]})]})})}var Jk=[`backlog`,`in_progress`,`in_review`,`done`,`canceled`,`error`],Yk={backlog:`status.backlog`,in_progress:`status.inProgress`,in_review:`status.inReview`,done:`status.done`,canceled:`status.canceled`,error:`status.error`},Xk=e=>({binding:e,key:ec(e)??void 0});async function Zk(e,t){if(!e){H(F(`menu.nothingToCopy`,{what:t}),`error`);return}try{await navigator.clipboard.writeText(e),H(F(`menu.copied`,{text:e}))}catch{H(F(`menu.copyFailed`),`error`)}}function Qk(e,t,n){let r=[{label:F(`menu.newTask`),section:`open`,run:()=>Uh(t)}],i=n.mainTaskId;return i&&(n.first||r.push({label:W(`tasks`,`menu.moveToTop`),section:`edit`,run:()=>void e.client.request(`task.move`,{taskId:i,direction:`top`}).catch(e=>H(W(`tasks`,`toast.moveFailed`,{error:String(e)}),`error`))}),r.push({label:W(`tasks`,`menu.reorderProject`),section:`edit`,...Xk(`sidebar.localMerge`),run:()=>eA(i)})),r.push({label:W(`tasks`,`menu.fieldNotes`),section:`notes`,run:()=>B.set((0,L.jsx)(qk,{model:e,repo:t}))}),i&&r.push({label:W(`tasks`,`menu.forgetProject`),section:`danger`,danger:!0,run:()=>B.set(t_(e,t,n.label))}),r}function $k(e){return[{label:F(`menu.newChatNoFolder`),section:`open`,run:()=>Wh()},{label:F(`menu.newShell`),section:`open`,run:()=>void Xl(e).catch(e=>H(String(e),`error`))}]}function eA(e){let t=!hf.get();t&&e!==void 0&&gf.set(e),_f(t),document.querySelector(`.rail`)?.focus()}function tA(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?(H(W(`tasks`,`moveToProject.empty`),`error`),null):(0,L.jsx)(kr,{title:W(`tasks`,`moveToProject.title`),choices:r,onPick:async n=>{await e.client.request(`task.moveToProject`,{taskId:t.id,repo:n}),H(W(`tasks`,`toast.movedToProject`,{project:r.find(e=>e.value===n)?.label??n}))}})}function nA(e,t,n){let r=e.client,i=[];n&&(i.push({label:F(`menu.closeTab`),section:`tab`,run:()=>B.set((0,L.jsx)(Or,{title:F(`confirm.closeTabTitle`,{tab:n.title??n.engineName??n.id}),body:F(`confirm.closeTabBody`),confirmLabel:F(`menu.closeTab`),onConfirm:async()=>{await e.closeTab(t.id,n.id)}}))}),i.push(...Vk(e,t.id,n))),i.push({label:F(`menu.newChat`),section:`open`,run:()=>void Jl(e,t.id)}),i.push({label:F(`menu.newChatPick`),section:`open`,rare:!0,run:()=>B.set((0,L.jsx)(eu,{model:e,taskId:t.id}))}),i.push({label:F(`menu.continueEngine`),section:`open`,rare:!0,...Xk(`chat.tab.fork`),run:()=>B.set((0,L.jsx)(eu,{model:e,taskId:t.id,context:`continue`,sourceTabId:n?.id}))}),i.push({label:F(`menu.newShell`),section:`open`,run:()=>void Yl(e,t.id,{kind:`shell`}).catch(e=>H(String(e),`error`))}),t.kind===`task`&&t.ownsBranch===!0&&t.branch&&!t.sharesWorkspaceOf&&!t.machine&&!t.extraRepoCount&&i.push({label:W(`tasks`,`menu.newTaskFromBranch`),section:`open`,rare:!0,run:()=>Dn({repo:t.repo,baseBranch:t.branch,worktree:!0})}),t.startsAt&&(i.push({label:F(`menu.startNow`),section:`open`,run:()=>void e.client.request(`task.startScheduledNow`,{taskId:t.id}).catch(e=>H(String(e),`error`))}),i.push({label:F(`menu.cancelStart`),section:`open`,run:()=>void e.client.request(`task.cancelScheduledStart`,{taskId:t.id}).catch(e=>H(String(e),`error`))})),t.hasPrompt&&(i.push({label:W(`tasks`,`menu.runAgain`),section:`open`,run:()=>B.set((0,L.jsx)(Gk,{model:e,task:t}))}),i.push({label:F(`menu.retryEdit`),section:`open`,rare:!0,run:()=>void Im(e,t)}));let a=!t.machine;if(a&&i.push({label:W(`tasks`,`menu.openEditor`),section:`open`,...Xk(`tasks.openWorktree`),run:()=>void Xg(e,t.id)}),t.groupId){let e=t.groupId;i.push({label:F(`compare.menu`),section:`open`,run:()=>Ya(e)})}i.push({label:F(`menu.rename`),section:`edit`,...Xk(`sidebar.rename`),run:()=>B.set((0,L.jsx)(Dr,{title:F(`menu.rename`),initial:t.title,submitLabel:F(`dialog.save`),onSubmit:n=>e.act(`task.rename`,{taskId:t.id,title:n}).then(()=>{})}))}),t.kind!==`main`&&i.push({label:t.pinned?F(`menu.unpin`):F(`menu.pin`),section:`edit`,...Xk(`sidebar.pin`),run:()=>void e.act(`task.pin`,{taskId:t.id,pinned:!t.pinned}).catch(e=>H(String(e),`error`))}),a&&i.push({label:W(`tasks`,`menu.reorder`),section:`edit`,rare:!0,...Xk(`sidebar.localMerge`),run:()=>eA()}),i.push({label:F(`menu.setStatus`),section:`edit`,children:Jk.map(n=>({label:F(Yk[n]),checked:n===t.status,run:()=>void e.act(`task.setStatus`,{taskId:t.id,status:n}).catch(e=>H(String(e),`error`))}))}),a&&t.kind!==`main`&&!t.routine&&!t.parentTaskId&&!t.extraRepoCount&&i.push({label:W(`tasks`,`menu.moveToProject`),section:`edit`,rare:!0,run:()=>{let n=tA(e,t);n&&B.set(n)}}),a&&i.push({label:F(`menu.changeEngine`),section:`edit`,rare:!0,...Xk(`tasks.cycleEngine`),run:()=>B.set((0,L.jsx)(mD,{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}}),H(W(`tasks`,`toast.engineSwitched`,{engine:n.engine.name}))}}))}),t.pr?.checkState===`failing`&&i.push({label:W(`tasks`,`menu.fixChecks`),section:`git`,key:wi(`files.fixChecks`),run:()=>void Yg(e,t.id,F(`taskops.fixSent`))}),t.kind===`task`&&t.branch&&a&&i.push({label:W(`tasks`,`menu.syncBase`),section:`git`,rare:!0,key:wi(`files.syncBase`),run:()=>void qg(e,t.id)}),t.branch&&i.push({label:F(`menu.renameBranch`),section:`git`,rare:!0,...Xk(`tasks.renameBranch`),run:()=>B.set((0,L.jsx)(Dr,{title:F(`menu.renameBranch`),initial:t.branch,submitLabel:F(`dialog.save`),onSubmit:e=>r.request(`task.setBranch`,{taskId:t.id,branch:e}).then(()=>{})}))}),t.kind===`task`&&t.branch&&i.push({label:F(`menu.land`),section:`git`,run:()=>void Gg(e,t)});let o=[{label:F(`menu.copyWhat.id`),run:()=>void Zk(t.id,F(`menu.what.id`))}];return t.branch&&o.push({label:F(`menu.copyWhat.branch`),run:()=>void Zk(t.branch,F(`menu.what.branch`))}),o.push({label:F(`menu.copyWhat.path`),run:()=>void r.request(`task.get`,{taskId:t.id}).then(e=>Zk(e.task.worktreePath,F(`menu.what.path`))).catch(e=>H(String(e),`error`))}),i.push({label:F(`menu.copy`),section:`copy`,children:o}),t.kind!==`main`&&i.push({label:W(`tasks`,t.archived?`menu.unarchive`:`menu.archive`),section:`danger`,run:()=>void e_(e,t)}),i.push({label:F(`menu.removeSession`),section:`danger`,...Xk(`sidebar.delete`),danger:!0,run:()=>B.set(t.kind===`main`?$g(e,t):Qg(e,t))}),i}var rA=`rove.collapsedProjects`,iA=`rove.foldedTasks`,aA=`rove.openedTasks`,oA=600;function sA(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 cA(e,t){try{localStorage.setItem(e,JSON.stringify([...t]))}catch{}}var lA=(e,t)=>{let n=new Set(e);return n.delete(t)||n.add(t),n};function uA(){let e=_(ff),[t,n]=(0,h.useState)({active:!1,query:``}),[r,i]=(0,h.useState)(()=>sA(rA)),a=e=>i(t=>{let n=lA(t,e);return cA(rA,n),n}),[o,s]=(0,h.useState)(()=>({folded:sA(iA),opened:sA(aA)}));return{sort:e,cycleSort:mf,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)),cA(iA,r),cA(aA,i),{folded:r,opened:i}})}}var dA=[`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 fA(e){for(let t of e)for(let e of dA){let n=Ci(e).indexOf(t);if(n>=0)return{id:e,slot:n}}return null}function pA(e,t){let n=e.selection.get().taskId===t;e.select(t),Ka(),n&&!Vh(e.client)&&Ca()}function mA(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)(()=>u_.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`&&Ya(t.groupId),t?.kind===`pane`&&Uk(e,t),t&&Ka()},_=(t,n)=>{t?.kind===`task`&&pn(nA(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=xl(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}),H(F(`rail.engineSwitched`,{engine:i.name}))}catch(e){H(F(`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=fA(Gs(t));if(hf.get()){let n=o?.kind===`task`&&o.machine===void 0;if(d?.id===`sidebar.nav`)n&&vf(e,o,d.slot%2==0?1:-1);else if(d?.id===`sidebar.localMerge`||t.key===`Enter`||t.key===`Escape`)_f(!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<oA?(m(0),c.current=0):c.current=Date.now();break;case`sidebar.select`:case`sidebar.tree.open`:g(o);break;case`tasks.focusEngine`:Ca();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&&_f(!0);break;case`sidebar.sort`:n.cycleSort(),H(W(`tasks`,`sort.label`,{mode:W(`tasks`,`sort.modes.${ff.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`:Ja(`worktrees`);break;case`tasks.update`:Ja(`update`);break;default:return}t.preventDefault()}}}var hA=192,gA=`rove.web.railWidth`,_A=`rove.web.railFolded`;function vA(){let e=Number(localStorage.getItem(gA));return Number.isFinite(e)&&e>0?e:null}var yA=g(vA());yA.subscribe(()=>{let e=yA.get();e===null?localStorage.removeItem(gA):localStorage.setItem(gA,String(Math.round(e)))}),yA.subscribe(Ln);var bA=g(localStorage.getItem(_A)===`1`);bA.subscribe(()=>localStorage.setItem(_A,bA.get()?`1`:`0`));var xA=g(!1),SA=null;function CA(e){SA!==null&&window.clearTimeout(SA),SA=null,e?xA.set(!0):SA=window.setTimeout(()=>xA.set(!1),250)}bA.subscribe(()=>xA.set(!1)),bA.subscribe(Ln);function wA(e,t=window.innerWidth){let n=Math.max(hA,t-320);return Math.max(hA,Math.min(n,Math.round(e)))}var TA=(e,t,n)=>`~pane:${e}:${t}:${n}`;function EA(e,t){return e.flatMap(e=>e.kind===`task`?[e,...(t[e.task.id]??[]).flatMap(t=>{let n=t.split;if(!n||!Iu(n))return[];let r=zu(n,Nu(t));return Fu(n.root).map(n=>({id:TA(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 DA(e){let{row:t}=e;return(0,L.jsxs)(`button`,{type:`button`,className:`${vr({size:`pane`})} ${e.cursor?Pf:``}`,title:F(`compare.menu`),onClick:()=>{e.onClick(),Ya(t.groupId)},...e.place,children:[e.guides&&(0,L.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,L.jsx)(`span`,{className:wf(e)},t))}),(0,L.jsx)(`span`,{className:`${yr} text-(length:--fs-meta) text-muted`,children:t.title}),(0,L.jsxs)(`span`,{className:`${wr} ml-auto items-center`,children:[e.repo&&(0,L.jsx)(`span`,{className:`max-w-24 truncate text-subtle`,children:e.repo}),(0,L.jsx)(`span`,{className:`text-subtle`,children:t.tasks.length}),(0,L.jsx)($b,{status:xb(t.tasks)})]})]})}function OA(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,L.jsxs)(`div`,{className:`${jf} mono items-center`,children:[(0,L.jsx)(`span`,{className:`text-accent`,children:`/`}),(0,L.jsx)(`input`,{ref:t,className:Mf,type:`text`,autoFocus:!0,spellCheck:!1,autoComplete:`off`,autoCapitalize:`off`,enterKeyHint:`go`,value:e.query,placeholder:F(`rail.searchPlaceholder`),"aria-label":F(`rail.searchPlaceholder`),onChange:t=>e.onChange(t.target.value)}),e.query&&(0,L.jsx)(`span`,{className:`ml-1.5 text-muted`,children:e.count})]})}var kA=Math.min,AA=Math.max,jA=Math.round,MA=Math.floor,NA=e=>({x:e,y:e}),PA={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function FA(e,t,n){return AA(e,kA(t,n))}function IA(e,t){return typeof e==`function`?e(t):e}function LA(e){return e.split(`-`)[0]}function RA(e){return e.split(`-`)[1]}function zA(e){return e===`x`?`y`:`x`}function BA(e){return e===`y`?`height`:`width`}function VA(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function HA(e){return zA(VA(e))}function UA(e,t,n){n===void 0&&(n=!1);let r=RA(e),i=HA(e),a=BA(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=QA(o)),[o,QA(o)]}function WA(e){let t=QA(e);return[GA(e),t,GA(t)]}function GA(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var KA=[`left`,`right`],qA=[`right`,`left`],JA=[`top`,`bottom`],YA=[`bottom`,`top`];function XA(e,t,n){switch(e){case`top`:case`bottom`:return n?t?qA:KA:t?KA:qA;case`left`:case`right`:return t?JA:YA;default:return[]}}function ZA(e,t,n,r){let i=RA(e),a=XA(LA(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(GA)))),a}function QA(e){let t=LA(e);return PA[t]+e.slice(t.length)}function $A(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function ej(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:$A(e)}function tj(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 nj(e,t,n){let{reference:r,floating:i}=e,a=VA(t),o=HA(t),s=BA(o),c=LA(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=RA(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function rj(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}=IA(t,e),p=ej(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=tj(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=tj(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 ij=50,aj=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:rj},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=nj(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<ij&&(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}=nj(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},oj=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}=IA(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=LA(r),_=VA(o),v=LA(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[QA(o)]:WA(o)),x=p!==`none`;!d&&x&&b.push(...ZA(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=UA(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`||_===VA(t)||T.every(e=>VA(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=VA(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{}}}},sj=new Set([`left`,`top`]);async function cj(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=LA(n),s=RA(n),c=VA(n)===`y`,l=sj.has(o)?-1:1,u=a&&c?-1:1,d=IA(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 lj=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 cj(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}}}}},uj=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}=IA(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=VA(i),p=zA(f),m=u[p],h=u[f],g=(e,t)=>FA(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 dj(){return typeof window<`u`}function fj(e){return hj(e)?(e.nodeName||``).toLowerCase():`#document`}function pj(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function mj(e){return((hj(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function hj(e){return dj()?e instanceof Node||e instanceof pj(e).Node:!1}function gj(e){return dj()?e instanceof Element||e instanceof pj(e).Element:!1}function _j(e){return dj()?e instanceof HTMLElement||e instanceof pj(e).HTMLElement:!1}function vj(e){return!dj()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof pj(e).ShadowRoot}function yj(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Aj(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function bj(e){return/^(table|td|th)$/.test(fj(e))}function xj(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Sj=/transform|translate|scale|rotate|perspective|filter/,Cj=/paint|layout|strict|content/,wj=e=>!!e&&e!==`none`,Tj;function Ej(e){let t=gj(e)?Aj(e):e;return wj(t.transform)||wj(t.translate)||wj(t.scale)||wj(t.rotate)||wj(t.perspective)||!Oj()&&(wj(t.backdropFilter)||wj(t.filter))||Sj.test(t.willChange||``)||Cj.test(t.contain||``)}function Dj(e){let t=Mj(e);for(;_j(t)&&!kj(t);){if(Ej(t))return t;if(xj(t))return null;t=Mj(t)}return null}function Oj(){return Tj??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Tj}function kj(e){return/^(html|body|#document)$/.test(fj(e))}function Aj(e){return pj(e).getComputedStyle(e)}function jj(e){return gj(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Mj(e){if(fj(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||vj(e)&&e.host||mj(e);return vj(t)?t.host:t}function Nj(e){let t=Mj(e);return kj(t)?(e.ownerDocument||e).body:_j(t)&&yj(t)?t:Nj(t)}function Pj(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Nj(e),i=r===e.ownerDocument?.body,a=pj(r);if(i){let e=Fj(a);return t.concat(a,a.visualViewport||[],yj(r)?r:[],e&&n?Pj(e):[])}return t.concat(r,Pj(r,[],n))}function Fj(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ij(e){let t=Aj(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=_j(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=jA(n)!==a||jA(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Lj(e){return gj(e)?e:e.contextElement}function Rj(e){let t=Lj(e);if(!_j(t))return NA(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Ij(t),o=(a?jA(n.width):n.width)/r,s=(a?jA(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var zj=NA(0);function Bj(e){let t=pj(e);return!Oj()||!t.visualViewport?zj:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Vj(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===pj(e)}function Hj(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Lj(e),o=NA(1);t&&(r?gj(r)&&(o=Rj(r)):o=Rj(e));let s=Vj(a,n,r)?Bj(a):NA(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=pj(a),t=gj(r)?pj(r):r,n=e,i=Fj(n);for(;i&&t!==n;){let e=Rj(i),t=i.getBoundingClientRect(),r=Aj(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=pj(i),i=Fj(n)}}return tj({width:u,height:d,x:c,y:l})}function Uj(e,t){let n=jj(e).scrollLeft;return t?t.left+n:Hj(mj(e)).left+n}function Wj(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Uj(e,n),y:n.top+t.scrollTop}}function Gj(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=mj(r),s=t?xj(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=NA(1),u=NA(0),d=_j(r);if((d||!a)&&((fj(r)!==`body`||yj(o))&&(c=jj(r)),d)){let e=Hj(r);l=Rj(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Wj(o,c):NA(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 Kj(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function qj(e){let t=jj(e),n=e.ownerDocument.body,r=AA(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=AA(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Uj(e),o=-t.scrollTop;return Aj(n).direction===`rtl`&&(a+=AA(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var Jj=25;function Yj(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=pj(e),a=mj(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Oj()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Uj(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<=Jj&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Xj(e,t){let n=Hj(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Rj(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Zj(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Yj(e,n,t);else if(t===`document`)r=qj(mj(e));else if(gj(t))r=Xj(t,n);else{let n=Bj(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return tj(r)}function Qj(e,t){let n=t.get(e);if(n)return n;let r=Pj(e,[],!1).filter(e=>gj(e)&&fj(e)!==`body`),i=null,a=Aj(e).position===`fixed`,o=a?Mj(e):e;for(;gj(o)&&!kj(o);){let e=Aj(o),t=Ej(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Mj(o)}return t.set(e,r),r}function $j(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?xj(t)?[]:Qj(t,this._c):[].concat(n),r],o=Zj(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=Zj(t,a[e],i);s=AA(n.top,s),c=kA(n.right,c),l=kA(n.bottom,l),u=AA(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function eM(e){let{width:t,height:n}=Ij(e);return{width:t,height:n}}function tM(e,t,n){let r=_j(t),i=mj(t),a=n===`fixed`,o=Hj(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=NA(0);if((r||!a)&&((fj(t)!==`body`||yj(i))&&(s=jj(t)),r)){let e=Hj(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Uj(i));let l=i&&!r&&!a?Wj(i,s):NA(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 nM(e){return Aj(e).position===`static`}function rM(e,t){if(!_j(e)||Aj(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return mj(e)===n&&(n=n.ownerDocument.body),n}function iM(e,t){let n=pj(e);if(xj(e))return n;if(!_j(e)){let t=Mj(e);for(;t&&!kj(t);){if(gj(t)&&!nM(t))return t;t=Mj(t)}return n}let r=rM(e,t);for(;r&&bj(r)&&nM(r);)r=rM(r,t);return r&&kj(r)&&nM(r)&&!Ej(r)?n:r||Dj(e)||n}var aM=async function(e){let t=this.getOffsetParent||iM,n=this.getDimensions,r=await n(e.floating);return{reference:tM(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function oM(e){return Aj(e).direction===`rtl`}var sM={convertOffsetParentRelativeRectToViewportRelativeRect:Gj,getDocumentElement:mj,getClippingRect:$j,getOffsetParent:iM,getElementRects:aM,getClientRects:Kj,getDimensions:eM,getScale:Rj,isElement:gj,isRTL:oM};function cM(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function lM(e,t,n){let r=null,i,a=mj(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=MA(d),h=MA(a.clientWidth-(u+f)),g=MA(a.clientHeight-(d+p)),_=MA(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:AA(0,kA(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!cM(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=pj(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function uM(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=Lj(e),u=i||a?[...l?Pj(l):[],...t?Pj(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?lM(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?Hj(e):null;c&&g();function g(){let t=Hj(e);h&&!cM(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 dM=lj,fM=uj,pM=oj,mM=(e,t,n)=>{let r=new Map,i=n??{},a={...sM,...i.platform,_c:r};return aj(e,t,{...i,platform:a})},hM=`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`,gM=500,_M=400,vM=`rove-tip`,yM=null,bM=null,xM=null,SM=null,CM=0,wM=!1,TM=()=>wM;function EM(){return yM?.isConnected?yM:(yM=document.createElement(`div`),yM.id=vM,yM.setAttribute(`role`,`tooltip`),yM.className=hM,yM.hidden=!0,document.body.append(yM),yM)}function DM(){SM!==null&&window.clearTimeout(SM),SM=null}function OM(e,t,n=`top`){DM(),kM();let r=EM();r.textContent=t,r.hidden=!1,bM=e,e.setAttribute(`aria-describedby`,vM),xM=uM(e,r,()=>{if(!e.isConnected)return kM();mM(e,r,{strategy:`fixed`,placement:n,middleware:[dM(6),pM(),fM({padding:8})]}).then(({x:e,y:t})=>{r.style.left=`${e}px`,r.style.top=`${t}px`})})}function kM(){DM(),bM&&(xM?.(),xM=null,bM.getAttribute(`aria-describedby`)===vM&&bM.removeAttribute(`aria-describedby`),bM=null,yM&&(yM.hidden=!0),CM=performance.now())}function AM(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 jM(e){if(e===bM)return;DM();let t=bM!==null||performance.now()-CM<_M,n=()=>e.isConnected&&e.dataset.tip&&OM(e,e.dataset.tip);t?n():SM=window.setTimeout(n,gM)}var MM=!1;function NM(){MM||(MM=!0,document.addEventListener(`pointerover`,e=>{if(e.pointerType===`touch`)return;let t=AM(e.target);t?jM(t):bM&&e.target instanceof Node&&bM.contains(e.target)||kM()}),document.addEventListener(`pointerout`,e=>{let t=AM(e.target);t&&!(e.relatedTarget instanceof Node&&t.contains(e.relatedTarget))&&kM()}),document.addEventListener(`keydown`,e=>{wM=!0,e.key===`Escape`&&kM()},!0),document.addEventListener(`pointerdown`,()=>{wM=!1,kM()},!0),document.addEventListener(`focusin`,e=>{let t=wM?AM(e.target):null;t&&jM(t)}),document.addEventListener(`focusout`,e=>{e.target===bM&&kM()}),window.addEventListener(`blur`,kM))}var PM=450,FM=e=>{let t=e.querySelector(`.row-title`);return!!t&&t.scrollWidth>t.clientWidth};function IM(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(()=>OM(e,i.current,`right`),PM)},s=()=>{a(),kM()};return(0,h.useEffect)(()=>{let e=r.current,n=e?.closest(`.rail`);if(!t||!e||!n||!TM()||!n.contains(document.activeElement)||!FM(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`||!FM(e.currentTarget)||o(e.currentTarget)},onPointerLeave:s,hide:s}}function LM({at:e}){let t=new Date(e);if(Number.isNaN(t.getTime()))return null;let n=em(t);return(0,L.jsxs)(`span`,{className:`text-subtle`,title:F(`rail.startsAt`,{time:t.toLocaleString()}),children:[`◷ `,n]})}var RM=150,zM=128,BM=0,VM=2,HM=[{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}],UM=`/-\\|`,WM=6,GM=(e,t,n,r)=>{let i=e[n];i&&t>=0&&t<i.length&&(i[t]=r)};function KM(e,t){let n=Math.min(64,Math.max(24,Math.floor(t))),r=(Math.floor(e)%RM+RM)%RM,i=Array.from({length:11},()=>Array(n).fill(` `)),a=Array.from({length:11},()=>Array(n).fill(` `));GM(a,BM,0,`o`);let o=VM+2*(HM.length-1),s=Math.min(o,Math.floor(r/2));for(let e=1;e<=s;e++)GM(i,BM,e,`|`);if(HM.forEach((e,t)=>{let o=VM+2*t,s=2*o;if(r<s)return;GM(i,BM,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))%WM+WM)%WM===0?GM(a,t,o,`=`):GM(i,t,o,`-`);d?GM(a,u,o,`o`):u<l?GM(a,u,o,`>`):GM(a,u,o,UM[(Math.floor(r/2)+t)%4]??`-`)}),r>=zM){let e=Math.ceil((r-zM+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(`
41
41
  `),accent:a.map(e=>e.join(``)).join(`
42
- `)}}var HM=`min-h-0 w-full overflow-y-auto`,UM=`mx-auto mt-[min(16vh,8rem)] flex w-full max-w-130 flex-col gap-4 px-5 pb-7`,WM=`relative grid w-full select-none overflow-hidden font-mono text-(length:--fs-body) text-subtle [contain:layout_paint]`,GM=`col-start-1 row-start-1 m-0 whitespace-pre font-[inherit] leading-[inherit]`,KM=`invisible absolute top-0 left-0 whitespace-pre`,qM=1.3,JM=`0000000000`,YM=1e3/12;function XM(){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=VM(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)/YM);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,L.jsxs)(`div`,{ref:e,"aria-hidden":`true`,"data-field":`first-run-art`,className:WM,style:{height:`${11*qM}em`,lineHeight:qM},children:[(0,L.jsx)(`span`,{ref:t,className:KM,children:JM}),(0,L.jsx)(`pre`,{ref:n,className:GM}),(0,L.jsx)(`pre`,{ref:r,className:`${GM} text-accent`})]})}function ZM(e){let t=W(`doctor`,`fix.humanOnlyWhy`),n=[];if(e.git||n.push({id:`git`,label:W(`doctor`,`fix.git`),action:W(`doctor`,`fix.gitAction`),why:t}),e.engines.length===0){let r=e.signedOut.length>0;n.push({id:`engine`,label:W(`doctor`,r?`fix.noEngineLogin`:`fix.noEngine`),action:W(`doctor`,r?`fix.noEngineLoginAction`:`fix.noEngineAction`,{list:e.signedOut.map(e=>e.id).join(`, `)}),why:t})}return n}function QM({model:e}){I(),_(hi);let[t,n]=(0,h.useState)(()=>J(e,`welcome.env`)??null);(0,h.useEffect)(()=>{let t=!0;return X(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)?ZM(t):[];return(0,L.jsx)(`div`,{className:HM,"data-field":`welcome`,children:(0,L.jsxs)(`div`,{className:UM,children:[(0,L.jsx)(XM,{}),(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,L.jsx)(`h1`,{className:`m-0 font-sans text-title font-semibold text-ink`,children:F(`firstRun.title`)}),(0,L.jsx)(`p`,{className:`m-0 font-sans text-body text-muted`,children:F(`firstRun.body`)})]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,L.jsx)(`button`,{type:`button`,className:Be(),"data-field":`start-first-task`,onClick:()=>Uh(t?.start?.repo),children:F(`firstRun.start`)}),(0,L.jsx)(`span`,{className:`keys-only mono text-meta text-subtle`,children:wi(`task.new.global`)})]}),t!==null&&r!==null&&(0,L.jsxs)(`div`,{className:`flex flex-col gap-1.5 font-sans text-meta`,children:[(0,L.jsx)(`p`,{className:`m-0 ${r.warn?`text-warning`:`text-subtle`}`,children:W(`workspace`,`welcome.${r.key}`,{list:r.list})}),!t.git&&(0,L.jsx)(`p`,{className:`m-0 text-warning`,children:W(`workspace`,`welcome.gitMissing`)}),i.map(e=>(0,L.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,L.jsx)(`p`,{className:`m-0 text-warning`,children:e.label}),(0,L.jsx)(`p`,{className:`mono m-0 text-accent`,children:e.action}),(0,L.jsx)(`p`,{className:`m-0 text-muted`,children:e.why})]},e.id)),i.length>0&&(0,L.jsx)(`p`,{className:`m-0 text-muted`,children:W(`common`,`failureHint`,{command:`rove doctor`})})]})]})})}function $M(e,t){e.preventDefault(),mn.set({x:e.clientX,y:e.clientY,items:t,target:e.currentTarget,fromKeyboard:e.button!==2})}function eN({model:e,narrow:t}){let n=I(),r=_(e.tasks),i=_(e.remote),a=Kf(e),o=_(e.tabs),s=CC(e),c=_(e.tabsSettled),l=_(e.selection),u=r?.tasks??[],d=r?.attention.filter(e=>e.unread).length??0,f=l.taskId,p=xk(u,o,c),m=new Map([...u,...i].map(e=>[e.id,e])),g=nA(),v=_(hf),y=_(cf)===`state`,b=_(gf),x=e=>(y?Qh:Mu)({tasks:u,remote:i,machines:a,sort:g.sort,query:e,fold:{...g.hand,selectedId:f??void 0}}),S=x(g.search.active?g.search.query:``),{groups:C}=S,w=g.search.active?S.rows:Pu(vA($h(_k(S.rows,p,l.taskId,c,b)),o),g.collapsed),T=e=>e.filter(e=>e.kind!==`project`&&e.kind!==`state`&&e.kind!==`round`),E=(n===`zh`?Yr:Jr).machine,D=new Set(a.filter(e=>e.state!==`online`).map(e=>e.alias)),O=C.find(e=>e.tasks.some(e=>e.kind===`main`))?.repo,k=e=>({mainTaskId:C.find(t=>t.repo===e)?.tasks.find(e=>e.kind===`main`)?.id??null,label:tu(e),first:e===O}),ee=hk(e,u,!g.search.active&&!y,g.sort==="default"),{place:A,dragging:te}=ee.places(w),ne=()=>B.set((0,L.jsx)(LS,{model:e})),j=oA(e,w,g,{selectedId:f,onNewTask:Uh,onSettings:ne}),re=b!==null&&w.some(e=>e.id===b),M=j.setCursor;(0,h.useEffect)(()=>{re&&b!==null&&M(b)},[re,b,M]);let N=T(x(``).rows).length,ie=(0,h.useRef)(null),ae=_(fA)&&!t,oe=_(pA)&&ae,se=t?u.find(e=>e.id===l.taskId&&!e.deleting)??null:null;return(0,L.jsxs)(`nav`,{className:`${kf} ${ae?`is-folded`:``}`,ref:ie,inert:ae&&!oe,"aria-hidden":ae&&!oe,onMouseEnter:ae?()=>hA(!0):void 0,onMouseLeave:ae?()=>hA(!1):void 0,tabIndex:0,onKeyDown:e=>{dC(`sidebar`),j.onKeyDown(e)},children:[(0,L.jsxs)(`header`,{className:Af,children:[(0,L.jsxs)(`span`,{className:`${Yt} mr-auto`,children:[(0,L.jsx)(`span`,{className:Xt,children:`[`}),` rove `,(0,L.jsx)(`span`,{className:Xt,children:`]`})]}),(0,L.jsxs)(`span`,{className:`relative`,children:[(0,L.jsx)(`button`,{type:`button`,className:`m-0 text-meta font-medium normal-nums inbox-chip relative ${mr} ${Ze} ${d>0?`text-accent`:`text-muted`}`,onClick:()=>B.set((0,L.jsx)(af,{model:e})),children:F(`rail.inbox`,{count:d})}),(0,L.jsx)(iC,{model:e,bindingId:`inbox.show`,head:!0})]}),(0,L.jsx)(Zy,{})]}),v&&(0,L.jsxs)(`div`,{className:`flex gap-1 px-3.5 pb-2 text-meta mono`,children:[(0,L.jsx)(`span`,{className:`text-accent`,children:W(`tasks`,`moveChip`).trim()}),(0,L.jsx)(`span`,{className:`keys-only ml-1.5 text-muted`,children:(0,L.jsx)($d,{text:F(`taskops.moveHint`)})})]}),g.search.active&&(0,L.jsx)(bA,{query:g.search.query,count:`${T(w).length}/${N}`,onChange:e=>g.setSearch(t=>({...t,query:e}))}),(0,L.jsx)(JO,{model:e}),(0,L.jsxs)(`div`,{"data-rail-body":!0,className:Nf(te!==null),...ee.body,children:[r&&u.length===0&&i.length===0&&t&&(0,L.jsx)(QM,{model:e}),r&&u.length===0&&i.length===0&&!t&&(0,L.jsx)(`p`,{className:`m-0 px-2 py-3 font-mono text-meta text-subtle`,children:F(`rail.empty`)}),se&&(0,L.jsx)(KN,{title:se.title}),w.map((t,n)=>t.kind===`round`?(0,L.jsx)(yA,{row:t,guides:t.depth>1?lk(w,n):void 0,repo:y&&t.depth===1?Xh(t.tasks[0]):void 0,cursor:t.id===j.cursor,place:A(t),onClick:()=>j.setCursor(t.id)},t.id):t.kind===`pane`?(0,L.jsx)(Ik,{model:e,row:t,guides:lk(w,n),cursor:t.id===j.cursor,place:A(t),onClick:()=>{j.setCursor(t.id),Fk(e,t),Ka()},onMenu:n=>{j.setCursor(t.id),$M(n,jk(e,t.task.id,t.tab,t.leaf))}},t.id):(0,L.jsx)(tN,{row:t,guides:t.kind===`task`&&t.depth>1?lk(w,n):void 0,cloud:Uf(t,a,E),repo:y&&t.kind===`task`&&t.depth===1?Xh(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===j.cursor,stale:t.machine!==void 0&&D.has(t.machine),collapsed:(t.kind===`project`||t.kind===`state`)&&g.collapsed.has(t.id),drag:ee.props(t),dragging:te===t.id,place:A(t),onNewTask:t.kind===`project`?t.noProject?Wh:()=>Uh(t.repo,t.machine):void 0,moving:v&&t.machine===void 0&&(t.kind===`project`?!t.noProject&&k(t.repo).mainTaskId===j.cursor:t.id===j.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?tw([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:()=>{j.setCursor(t.id),(t.kind===`project`||t.kind===`state`)&&g.toggleProject(t.id),t.kind===`task`&&aA(e,t.task.id)},onMenu:n=>{if(t.kind!==`project`||t.machine===void 0){if(t.kind===`project`&&t.noProject){$M(n,Gk(e));return}if(t.kind===`project`){let r=k(t.repo);r.mainTaskId&&w.some(e=>e.id===r.mainTaskId)&&j.setCursor(r.mainTaskId),$M(n,Wk(e,t.repo,r));return}t.kind===`task`&&(j.setCursor(t.id),$M(n,fn(iN(rN(Jk(e,t.task,null),t.fold,()=>g.toggleTaskFold(t.id,t.fold?.collapsed===!0)),Pk(e,t.task.id)),F(`menu.more`))))}}},t.id))]}),(0,L.jsx)(gk,{model:e,narrow:t,onSettings:ne}),(0,L.jsx)(qN,{pane:`sidebar`}),!t&&!ae&&(0,L.jsx)(VN,{rail:ie})]})}function tN(e){let{row:t}=e,n=OM(t.kind===`task`?t.task.label:``,e.cursor&&t.kind===`task`),r=e.cursor?Pf:``;if(t.kind===`project`||t.kind===`state`)return(0,L.jsxs)(`h2`,{className:Ff({moving:e.moving,dragging:e.dragging,grab:e.drag!==void 0}),onContextMenu:e.onMenu,...e.place,...e.drag,children:[(0,L.jsxs)(`button`,{type:`button`,className:Lf,title:t.kind===`project`&&!t.noProject?t.repo:void 0,"aria-expanded":!e.collapsed,onClick:e.onClick,children:[(0,L.jsx)(`span`,{className:`truncate`,children:t.label}),t.kind===`state`&&(0,L.jsx)(`span`,{className:`font-normal text-subtle`,children:t.count}),(0,L.jsx)(fo,{right:e.collapsed,className:Rf(!!e.collapsed)})]}),e.onNewTask&&t.kind===`project`&&(0,L.jsx)(`button`,{type:`button`,className:zf,title:F(`rail.newTask`),onClick:e.onNewTask,children:`+`})]});let i=t.task,a=i.rowStatus?.kind===`running`,o=Rg(i),s=_(Ab)===`engine`,c=t.fold?.collapsed?e.rollup:i.rowStatus;return(0,L.jsxs)(`button`,{type:`button`,ref:n.ref,className:`${vr({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,L.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,L.jsx)(`span`,{className:wf(e)},t))}),(0,L.jsx)(MM,{icon:e.engineIcon,name:i.engine?.name,status:s?ZC(c):void 0}),(0,L.jsx)(`span`,{className:`${br} ${e.stale?`text-subtle`:``} ${a?xr:``}`,children:t.attempt??i.label}),(0,L.jsxs)(`span`,{className:`${wr} ml-auto items-center`,children:[e.repo&&(0,L.jsx)(`span`,{className:`max-w-24 truncate text-subtle`,children:e.repo}),t.level!==void 0&&(0,L.jsx)(`span`,{className:`text-subtle`,children:t.level}),(i.extraRepoCount??0)>0&&(0,L.jsxs)(`span`,{className:`text-subtle`,title:F(`rail.extraRepos`,{count:i.extraRepoCount??0}),children:[`+`,i.extraRepoCount]}),o&&(0,L.jsxs)(`span`,{className:`text-subtle tabular-nums`,title:F(`rail.todos`,o),children:[o.done,`/`,o.total]}),t.fold?.collapsed&&(0,L.jsx)(nN,{count:t.fold.count,onUnfold:e.onToggleFold}),i.kept&&(0,L.jsx)(`span`,{className:`text-accent`,title:F(`compare.kept`),children:`✓`}),i.pinned&&(0,L.jsx)(`span`,{className:`text-subtle`,children:`▴`}),i.startsAt&&(0,L.jsx)(kM,{at:i.startsAt}),(0,L.jsx)(tk,{tasks:e.prTasks??[i],onOpen:n.hide}),!s&&(0,L.jsx)(Lw,{status:c}),e.cloud&&(0,L.jsx)(Wf,{label:e.cloud})]})]})}function nN(e){let t=W(`tasks`,`menu.expandChildren`);return(0,L.jsxs)(`span`,{role:`button`,tabIndex:-1,"aria-label":t,"aria-expanded":!1,className:`chip text-muted ${Tf}`,title:t,onClick:t=>{t.stopPropagation(),e.onUnfold()},children:[e.count,(0,L.jsx)(fo,{right:!0})]})}function rN(e,t,n){if(!t)return e;let r={label:W(`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 iN(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)]}var aN=`flex-none fill-none stroke-current [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:1.25]`,oN=(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`}`,sN=`absolute top-2 left-[calc(--spacing(2)+var(--shell-inset-left,0px))] z-7 flex items-center gap-0.5`,cN=`[&.is-resizing_iframe]:pointer-events-none`,lN=e=>`side-panel ${Xe} relative row-1 flex min-h-0 min-w-0 flex-col ${cN} ${e?`flex-1 p-0`:`pt-2 pr-1 pb-1 pl-0`}`,uN=`grid min-h-0 flex-1 grid-rows-[minmax(0,1fr)] [--divider:5px] ${cN}`,dN=`side-col row-1 flex min-h-0 min-w-0 flex-col`,fN=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`}`,pN=`min-w-0 flex-1 truncate px-2 text-ink`,mN=`flex min-w-0 flex-1 items-center gap-0.5`,hN=`scrollbar-none flex min-w-0 gap-0.5 overflow-x-auto`,gN=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`}`,_N=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`}`,vN=`truncate`,yN=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`}`,bN=`ml-auto flex gap-0.5`,xN=`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-['']`,SN=`side-view flex min-h-0 min-w-0 flex-1 flex-col [&[hidden]]:hidden`,CN=`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`,wN=`flex min-h-0 flex-1 flex-col gap-1.5`,TN=`flex items-center gap-0.5 [&_svg]:flex-none`,EN=`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`,DN=`min-w-0 flex-1 rounded-sm border-none bg-paper`;function ON({children:e}){return(0,L.jsx)(`svg`,{className:`size-3.5 ${aN}`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:e})}var kN={chat:(0,L.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,L.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,L.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,L.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,L.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,L.jsx)(`path`,{d:`M2 10a6 6 0 1 1 12 0M8 10l2.5-3.5M4 13h8`})};function AN(e){let t=vo(e);return t?yo(t):F(`panel.browser`)}var jN=7.3,MN=22,NN=160,PN=2,FN=24;function IN(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(NN,MN+e*jN)+PN}return n<=t}function LN(e,t,n){let r=[{label:F(`panel.close`),section:`close`,run:()=>Vs(e,n.id)}];return t.tabs.length>1&&r.push({label:F(`panel.closeOthers`),section:`close`,run:()=>Bs(e,e=>jo(e,n.id))}),r}function RN({taskId:e,column:t}){I();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&&!IN(t.tabs.map(AN),i-FN);return(0,h.useEffect)(()=>{r.current?.querySelector(`.is-active`)?.scrollIntoView({block:`nearest`,inline:`nearest`})},[t.active,t.tabs.length,o]),(0,L.jsxs)(`div`,{className:mN,ref:n,children:[(0,L.jsx)(`div`,{className:hN,role:`tablist`,"aria-label":F(`panel.tabs`),ref:r,children:t.tabs.map(n=>{let r=n.id===t.active;return(0,L.jsxs)(`div`,{role:`presentation`,className:gN({active:r,compact:o}),onMouseDown:e=>{e.button===1&&e.preventDefault()},onAuxClick:t=>{t.button===1&&(t.preventDefault(),Vs(e,n.id))},onContextMenu:r=>$M(r,LN(e,t,n)),children:[(0,L.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":r,className:_N(r),title:vo(n)||AN(n),onClick:()=>Bs(e,e=>xo(e,n.id)),children:(0,L.jsx)(`span`,{className:vN,children:AN(n)})}),(0,L.jsx)(`button`,{type:`button`,className:yN(r),"aria-label":F(`panel.close`),tabIndex:-1,onClick:()=>Vs(e,n.id),children:`×`})]},n.id)})}),(0,L.jsx)(`button`,{type:`button`,className:oN({tool:!0}),title:F(`panel.new`),"aria-label":F(`panel.new`),onClick:()=>Bs(e,wo),children:(0,L.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{d:`M8 3.5v9M3.5 8h9`})})})]})}function zN({edge:e,className:t,...n}){return(0,L.jsx)(`div`,{"data-grip":``,className:Re(`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 BN=400;function VN({rail:e}){I();let t=(0,h.useRef)(null),n=(0,h.useRef)(0),r=(0,h.useRef)(null);return(0,L.jsx)(zN,{edge:`right`,title:F(`layout.railResize`),onPointerDown:n=>{t.current={x:n.clientX,width:e.current?.getBoundingClientRect().width??0,moved:!1},n.currentTarget.setPointerCapture(n.pointerId),Rn(!0)},onPointerMove:e=>{let n=t.current;!n||e.clientX===n.x||(n.moved=!0,dA.set(gA(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<BN?(n.current=0,dA.set(null)):(n.current=i,r.current=window.setTimeout(()=>fA.set(!0),BN))},onLostPointerCapture:()=>Rn(!1)})}function HN({side:e}){return(0,L.jsxs)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,L.jsx)(`rect`,{x:`1.5`,y:`2.5`,width:`13`,height:`11`,rx:`2.5`}),(0,L.jsx)(`path`,{d:e===`left`?`M6 2.5v11`:`M10 2.5v11`})]})}function UN({model:e}){I();let t=_(gC),n=_(fA),r=_(e.tasks),i=t=>vC(e,t),a=F(n?`layout.railUnfold`:`layout.railFold`),o=n&&(r?.tasks??[]).some($C);return(0,L.jsxs)(`div`,{className:sN,onMouseEnter:()=>n&&pA.get()&&hA(!0),onMouseLeave:()=>n&&pA.get()&&hA(!1),children:[(0,L.jsxs)(`button`,{type:`button`,className:oN(),title:a,"aria-label":a,onClick:()=>fA.set(!n),children:[(0,L.jsx)(HN,{side:`left`}),o&&(0,L.jsx)(`span`,{className:`absolute top-0.75 right-0.75 size-1.5 rounded-full bg-accent`})]}),(0,L.jsx)(`button`,{type:`button`,className:oN(),title:F(`layout.navBack`),"aria-label":F(`layout.navBack`),disabled:hC(t,-1,i)<0,onClick:()=>xC(e,-1),children:(0,L.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{d:`M10 3.5 5.5 8l4.5 4.5`})})}),(0,L.jsx)(`button`,{type:`button`,className:oN(),title:F(`layout.navForward`),"aria-label":F(`layout.navForward`),disabled:hC(t,1,i)<0,onClick:()=>xC(e,1),children:(0,L.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{d:`M6 3.5 10.5 8 6 12.5`})})})]})}var WN=(0,L.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 GN({taskId:e}){I();let t=_(es);return(0,L.jsxs)(`div`,{className:Qe,children:[(0,L.jsx)(`button`,{type:`button`,className:`mono ${$e}`,onClick:qa,children:(0,L.jsx)(`span`,{className:`text-accent`,children:`‹ ${Cc(`narrowBack`)}`})}),e&&(0,L.jsx)(`span`,{className:`mono ml-auto flex gap-0.5`,role:`tablist`,children:[`terminal`,...$o].map(n=>{let r=F(n===`terminal`?`layout.narrowTerminal`:`panel.${n}`);return(0,L.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":t===n,"aria-label":r,title:r,className:et,onClick:()=>n===`terminal`?es.set(n):Ns(e,n),children:(0,L.jsx)(ON,{children:n===`terminal`?WN:kN[n]})},n)})})]})}function KN({title:e}){return I(),(0,L.jsxs)(`button`,{type:`button`,className:vr({}),onClick:Ka,children:[(0,L.jsx)(`span`,{className:`${Sr} font-bold text-accent`,children:`↩`}),(0,L.jsx)(`span`,{className:yr,children:wc(`recentJump`,{title:e})})]})}function qN({pane:e}){I();let{prefs:t}=x_(),n=_(uC)[e];if(!t.keyHints)return null;let r=cC(e,n?`always`:`firstUse`);return r.length===0?null:(0,L.jsx)(`p`,{className:`mono text-muted ${tt}`,children:(0,L.jsx)($d,{text:r.map(e=>`${pi(e.cap)} ${vc(`pane.${e.msg}`)}`).join(` · `)})})}function JN(e){return e===`localhost`||e.endsWith(`.localhost`)||e===`[::1]`||/^127(\.\d{1,3}){3}$/.test(e)}var YN=/^(localhost|127(\.\d{1,3}){3}|\[::1\])(:\d+)?([/?#]|$)/i,XN=/^[a-z][a-z0-9+.-]*:(?!\d+([/?#]|$))/i;function ZN(e){let t=e.trim();if(!t||/\s/.test(t)||XN.test(t)&&!/^https?:\/\//i.test(t))return null;let n=/^https?:\/\//i.test(t)?t:YN.test(t)?`http://${t}`:`https://${t.replace(/^\/\//,``)}`;try{let e=new URL(n);return e.hostname?e.href:null}catch{return null}}function QN(e,t,n=JN(t.hostname)){let r=new URL(e);return r.origin===t.origin?`self`:JN(r.hostname)?n?`yes`:`remote`:r.protocol===`https:`?`yes`:`unreachable`}function $N(e,t,n){let r=new URL(e).host;return t===`self`?{key:`self`,host:r}:t===`remote`?{key:`remote`,host:r}:t===`unreachable`?{key:`noFrame`,host:r}:n&&!n.reachable?{key:`unreachable`,host:r}:n&&!n.frameable?{key:`refuses`,host:r}:null}var eP=6e4,tP=new Map;function nP(e){let t=tP.get(e);return t&&Date.now()-t.at<eP?t:null}function rP(e,t,n){let[,r]=(0,h.useState)(0);(0,h.useEffect)(()=>{if(!n||nP(t))return;let i=!0;return e.request(`browser.probe`,{url:t,origin:window.location.origin}).then(e=>tP.set(t,{probe:e,at:Date.now()}),()=>tP.set(t,{probe:null,at:Date.now()})).then(()=>i&&r(e=>e+1)),()=>{i=!1}},[e,t,n]);let i=n?nP(t):null;return{pending:n&&!i,probe:i?.probe??null}}function iP({d:e}){return(0,L.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{d:e})})}var aP=`M6.5 3.5h-3v9h9v-3M9.5 3.5h3v3M12.5 3.5l-5 5`;function oP({model:e,tab:t,onNavigate:n,onStep:r}){I();let i=vo(t),[a,o]=(0,h.useState)(i),[s,c]=(0,h.useState)(!1),[l,u]=(0,h.useState)(0),d=_(e.client.conn).hello?.peer?.local,f=i?QN(i,window.location,d):null;(0,h.useEffect)(()=>{o(i),c(!1)},[i]);let p=e=>{let t=ZN(e);c(t===null&&e.trim()!==``),t!==null&&(o(t),t===i?u(l+1):n(t))},m=i?new URL(i).hostname:``,g=f===`yes`&&i.startsWith(`https:`)&&!JN(m),{pending:v,probe:y}=rP(e.client,i,g),b=i&&f?$N(i,f,y):null,x=f===`yes`&&!b&&!v,S=b?F(`browser.${b.key}`,{host:b.host}):f===null?F(s?`browser.invalid`:`browser.empty`):null;return(0,L.jsxs)(`div`,{className:wN,children:[(0,L.jsxs)(`form`,{className:TN,onSubmit:e=>{e.preventDefault(),p(a)},children:[(0,L.jsx)(`button`,{type:`button`,className:oN({small:!0}),disabled:t.at<=0,title:F(`browser.back`),"aria-label":F(`browser.back`),onClick:()=>r(t.at-1),children:(0,L.jsx)(iP,{d:`M10 3.5 5.5 8l4.5 4.5`})}),(0,L.jsx)(`button`,{type:`button`,className:oN({small:!0}),disabled:t.at>=t.urls.length-1,title:F(`browser.forward`),"aria-label":F(`browser.forward`),onClick:()=>r(t.at+1),children:(0,L.jsx)(iP,{d:`M6 3.5 10.5 8 6 12.5`})}),(0,L.jsx)(`button`,{type:`button`,className:oN({small:!0}),disabled:!x,title:F(`browser.reload`),"aria-label":F(`browser.reload`),onClick:()=>u(l+1),children:(0,L.jsx)(iP,{d:`M12.5 8a4.5 4.5 0 1 1-1.4-3.3M12.5 2.5v2.7H9.8`})}),(0,L.jsx)(`input`,{className:`browser-url mono ${EN}`,value:a,placeholder:F(`browser.placeholder`),"aria-label":F(`browser.address`),"aria-invalid":s,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,inputMode:`url`,onChange:e=>o(e.target.value)}),i?(0,L.jsx)(`a`,{className:oN({small:!0}),href:i,target:`_blank`,rel:`noopener noreferrer`,title:F(`browser.openTab`),"aria-label":F(`browser.openTab`),children:(0,L.jsx)(iP,{d:aP})}):(0,L.jsx)(`button`,{type:`button`,className:oN({small:!0}),disabled:!0,"aria-label":F(`browser.openTab`),children:(0,L.jsx)(iP,{d:aP})})]}),x?(0,L.jsx)(`iframe`,{className:DN,src:i,title:i,sandbox:`allow-scripts allow-same-origin allow-forms allow-popups`,referrerPolicy:`no-referrer`},`${i}#${l}`):S?(0,L.jsx)(`p`,{className:CN,children:S}):null]})}var sP=`scrollbar-none flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto p-3`,cP=`m-0 p-3 font-mono text-meta text-muted`,lP=`flex items-baseline justify-between gap-3 font-mono text-meta normal-nums`,uP=`flex h-1.5 w-full gap-px overflow-hidden rounded-full bg-inset`,dP=`h-full min-w-[2px] flex-none`,fP=`m-0 flex list-none flex-col p-0`,pP=`-mx-1 flex h-5.5 min-w-0 items-center gap-2 rounded-xs px-1 font-mono text-meta normal-nums`,mP=`mt-2`,hP=`size-2 flex-none rounded-full bg-line`,gP=`flex min-w-0 flex-1 items-center gap-1.5`,_P=`min-w-0 truncate text-muted`,vP=`w-[7ch] flex-none text-right text-ink`,yP=`w-[6ch] flex-none text-right text-muted`,bP=`group/fold`,xP=`${pP} cursor-pointer list-none hover:bg-hover focus-visible:outline focus-visible:outline-1 focus-visible:outline-focus [&::-webkit-details-marker]:hidden`,SP=`m-0 flex list-none flex-col p-0`,CP=`${pP} pl-5`,wP=`flex min-w-0 flex-1 overflow-hidden`,TP=`min-w-0 truncate text-subtle`,EP=`flex-none text-muted`,DP=`w-[7ch] flex-none text-right text-muted`,OP=`w-[6ch] flex-none`,kP=1e4,AP={system:`var(--info)`,system_prompt:`var(--info)`,system_tools:`var(--success)`,mcp_tools:`var(--warning)`,mcp_instructions:`var(--warning)`,custom_agents:`var(--ink)`,memory_files:`var(--merged)`,skills:`var(--muted)`,messages:`var(--accent)`,used:`var(--accent)`},jP=[`var(--info)`,`var(--success)`,`var(--warning)`,`var(--merged)`];function MP({model:e,task:t,active:n}){I();let r=_(e.client.conn),i=_(e.selection),a=_(e.tabs)[t.id]??[],o=i.taskId===t.id?a.find(e=>e.id===i.tabId):void 0,s=(o?.kind===`engine`?o:a.find(e=>e.kind===`engine`))?.id??null,[c,l]=(0,h.useState)({kind:`loading`}),[u,d]=(0,h.useState)(!1),f=(0,h.useRef)(``);if((0,h.useEffect)(()=>{if(!n||r.state!==`open`)return;let i=`${t.id}::${s}`;if(f.current!==i&&l({kind:`loading`}),f.current=i,!s){l({kind:`ready`,meter:null});return}let a=!0,o=n=>e.client.request(`context.usage`,{taskId:t.id,tabId:s,probe:n}).then(e=>a&&l({kind:`ready`,meter:e.meter})).catch(e=>a&&l(t=>t.kind===`ready`?t:{kind:`failed`,error:zC(e)})),c=()=>{d(!0),o(!0).finally(()=>a&&d(!1))};o(!1).then(c);let u=jr(kP,c);return()=>{a=!1,d(!1),u()}},[e,n,r.state,t.id,s]),c.kind===`loading`)return(0,L.jsx)(`p`,{className:cP,children:F(`context.loading`)});if(c.kind===`failed`)return(0,L.jsx)(`p`,{className:cP,children:F(`context.failed`,{error:c.error})});if(!c.meter)return(0,L.jsx)(`p`,{className:cP,children:F(`context.none`)});let p=c.meter,m=p.rows.filter(e=>e.share!==void 0),g=e=>e.share===void 0?void 0:AP[e.key]??jP[m.indexOf(e)%jP.length],v=`${p.approximate?`~`:``}${PP(p.used)}`;return(0,L.jsxs)(`div`,{className:sP,children:[(0,L.jsxs)(`div`,{className:lP,children:[(0,L.jsx)(`span`,{className:`text-ink`,children:p.percent===null?F(`context.usedTokens`,{tokens:v}):F(`context.used`,{percent:FP(p.percent)})}),p.window!==null&&(0,L.jsxs)(`span`,{className:`text-muted`,children:[v,` / `,PP(p.window)]})]}),(0,L.jsx)(`div`,{className:uP,role:`meter`,"aria-valuenow":Math.round(p.percent??100),"aria-valuemin":0,"aria-valuemax":100,children:m.map(e=>(0,L.jsx)(`span`,{className:dP,style:{width:`${e.share}%`,background:g(e)}},e.key))}),(0,L.jsx)(`ul`,{className:fP,children:p.rows.map((e,t)=>{let n=`context.part.${e.key}`,r=F(n)===n?e.label??e.key:F(n),i=g(e),a=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:hP,style:i?{background:i}:void 0}),(0,L.jsxs)(`span`,{className:gP,children:[(0,L.jsx)(`span`,{className:_P,title:r,children:r}),e.items&&(0,L.jsx)(`span`,{className:`inline-block flex-none text-subtle group-open/fold:rotate-90`,children:`›`})]}),(0,L.jsx)(`span`,{className:vP,children:PP(e.tokens)}),(0,L.jsx)(`span`,{className:yP,children:e.deferred?`—`:FP(e.tokens/(p.window??p.used)*100)})]}),o=(e.deferred?!p.rows[t-1]?.deferred:e.share===void 0)?mP:void 0;if(!e.items)return(0,L.jsx)(`li`,{className:o,children:(0,L.jsx)(`div`,{className:pP,children:a})},e.key);let s=e.items.reduce((e,t)=>e+t.tokens,0),c=(e.itemCount??e.items.length)-e.items.length;return(0,L.jsx)(`li`,{className:o,children:(0,L.jsxs)(`details`,{className:bP,children:[(0,L.jsx)(`summary`,{className:xP,children:a}),(0,L.jsxs)(`ul`,{className:SP,children:[e.items.map(e=>(0,L.jsx)(NP,{name:e.name,tokens:e.tokens},e.name)),c>0&&(0,L.jsx)(NP,{name:F(`context.more`,{count:c}),tokens:e.tokens-s})]})]})},e.key)})}),u&&m.length<2&&(0,L.jsx)(`p`,{className:`m-0 font-mono text-meta text-subtle`,children:F(`context.probing`)})]})}function NP({name:e,tokens:t}){let n=e.lastIndexOf(`/`)+1;return(0,L.jsxs)(`li`,{className:CP,title:e,children:[(0,L.jsxs)(`span`,{className:wP,children:[n>0&&(0,L.jsx)(`span`,{className:`min-w-0 truncate text-subtle`,children:e.slice(0,n)}),(0,L.jsx)(`span`,{className:n>0?EP:TP,children:e.slice(n)})]}),(0,L.jsx)(`span`,{className:DP,children:PP(Math.max(0,t))}),(0,L.jsx)(`span`,{className:OP})]})}function PP(e){return e>=1e6?`${+(e/1e6).toFixed(1)}M`:e>=1e3?`${+(e/1e3).toFixed(1)}k`:String(e)}function FP(e){return e>0&&e<.1?`<0.1%`:`${e<10?+e.toFixed(1):Math.round(e)}%`}var IP=3;function LP({model:e,task:t}){I();let n=t.autoFixCi,r=n=>void e.client.request(`task.autoFixCi`,{taskId:t.id,enabled:n}).catch(e=>H(e instanceof Error?e.message:String(e),`error`));return(0,L.jsx)(`div`,{className:`flex items-center gap-3 px-2 pt-1 font-mono text-meta`,children:n?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:n.stopped?ef.attention:`text-muted`,title:F(`files.autoFix.hint`),children:F(n.stopped?`files.autoFix.stopped`:`files.autoFix.count`,{n:n.attempts,max:IP})}),(0,L.jsx)(R,{hit:`tight`,onClick:()=>r(!1),children:F(`files.autoFix.off`)})]}):(0,L.jsx)(R,{hit:`tight`,title:F(`files.autoFix.hint`),onClick:()=>r(!0),children:F(`files.autoFix.on`)})})}function RP(e){let t=e.pr;return!!t&&t.number!==void 0&&!e.machine&&(t.lifecycle===`open`||t.lifecycle===`ready_to_merge`)}function zP(e){let t={fail:0,pending:0,pass:0,skipped:0};for(let n of e)t[n.state]++;return t}function BP(e){let t=Math.max(0,Math.round(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m${String(t%60).padStart(2,`0`)}s`:`${Math.floor(n/60)}h${String(n%60).padStart(2,`0`)}m`}function VP(e,t){let{startedAt:n,completedAt:r,durationMs:i}=e;return e.state===`pending`?n?{key:`files.checks.runningFor`,vars:{elapsed:BP(t-n)}}:null:i===null?r?{key:`files.checks.finishedAgo`,vars:{age:Ac(t-r)}}:null:r?{key:`files.checks.tookAgo`,vars:{duration:BP(i),age:Ac(t-r)}}:{key:`files.checks.took`,vars:{duration:BP(i)}}}function HP(e){let t=[],n=e.mergeState.toUpperCase();e.draft&&t.push({key:`files.merge.draft`,tone:`warning`}),e.mergeable.toUpperCase()===`CONFLICTING`||n===`DIRTY`?t.push({key:`files.merge.conflicts`,tone:`attention`}):n===`BEHIND`?t.push({key:`files.merge.behind`,tone:`warning`}):n===`UNSTABLE`?t.push({key:`files.merge.unstable`,tone:`warning`}):n===`BLOCKED`?t.push({key:`files.merge.blocked`,tone:`warning`}):n===`CLEAN`&&!e.draft&&t.push({key:`files.merge.clean`,tone:`success`});let r=e.review.toUpperCase();return r===`APPROVED`?t.push({key:`files.merge.approved`,tone:`success`}):r===`CHANGES_REQUESTED`?t.push({key:`files.merge.changes`,tone:`attention`}):r===`REVIEW_REQUIRED`&&t.push({key:`files.merge.reviewRequired`,tone:`warning`}),t}var UP=`flex flex-col gap-0.5 px-2 pb-2 font-mono text-meta`,WP=`flex items-start gap-2`,GP=`flex min-w-0 flex-1 flex-wrap items-center gap-x-2 text-left text-ink`,KP={pass:{glyph:`✓`,tone:`success`},fail:{glyph:`✗`,tone:`attention`},pending:{glyph:`●`,tone:`warning`},skipped:{glyph:`–`,tone:`muted`}};function qP({model:e,task:t}){I();let n=t.pr,r=t.id,[i,a]=(0,h.useState)(()=>J(e,`pr.checks`,{taskId:r})??null),[o,s]=(0,h.useState)(null),[c,l]=(0,h.useState)({}),[u,d]=(0,h.useState)(0),f=`${n?.number}:${n?.checkState}:${n?.mergeable}:${n?.reviewDecision}`;(0,h.useEffect)(()=>{let t=!0,n={taskId:r};return e.client.request(`pr.checks`,u>0?{...n,fresh:!0}:n).then(r=>{t&&(Y(e,`pr.checks`,n,r),a(r))},e=>t&&a({outcome:`unavailable`,detail:e instanceof Error?e.message:String(e)})),()=>{t=!1}},[e,r,f,u]);let p=t=>{let n=`${t.runId}:${t.name}`;if(c[n]){l(({[n]:e,...t})=>t);return}l(e=>({...e,[n]:{state:`loading`}})),e.client.request(`pr.checkLog`,{taskId:r,runId:t.runId,job:t.name}).then(e=>e.outcome===`ok`?{state:`text`,text:e.tail}:e.outcome===`none`?{state:`note`,text:F(`files.checks.noLog`)}:{state:`note`,text:F(`files.checks.logUnavailable`,{detail:e.detail})}).catch(e=>({state:`note`,text:F(`files.checks.logUnavailable`,{detail:e instanceof Error?e.message:String(e)})})).then(e=>l(t=>n in t?{...t,[n]:e}:t))},m=(0,L.jsx)(R,{hit:`tight`,className:`flex-none whitespace-nowrap`,onClick:()=>d(e=>e+1),children:F(`files.checks.refresh`)});if(!i)return(0,L.jsx)(`div`,{className:UP,children:(0,L.jsx)(`div`,{className:WP,children:(0,L.jsxs)(`span`,{className:`flex-1 text-muted`,children:[F(`files.checks.title`),` `,F(`files.checks.loading`)]})})});if(i.outcome!==`ok`)return(0,L.jsx)(`div`,{className:UP,children:(0,L.jsxs)(`div`,{className:WP,children:[(0,L.jsx)(`span`,{className:`min-w-0 flex-1 text-muted wrap-anywhere`,children:i.outcome===`none`?F(`files.checks.none`):F(`files.checks.unavailable`,{detail:i.detail})}),m]})});let g=zP(i.checks),_=Date.now(),v=o??(g.fail>0||g.pending>0),y=HP(i);return(0,L.jsxs)(`div`,{className:UP,children:[(0,L.jsxs)(`div`,{className:WP,children:[(0,L.jsxs)(R,{variant:`row`,className:GP,"aria-expanded":v,disabled:i.total===0,onClick:()=>s(!v),children:[i.total>0&&(0,L.jsx)(fo,{right:!v}),(0,L.jsx)(`span`,{children:i.total===0?F(`files.checks.none`):F(`files.checks.summary`,{pass:g.pass+g.skipped,total:i.total})}),g.fail>0&&(0,L.jsx)(`span`,{className:ef.attention,children:F(`files.checks.failed`,{count:g.fail})}),g.pending>0&&(0,L.jsx)(`span`,{className:ef.warning,children:F(`files.checks.running`,{count:g.pending})}),y.map(e=>(0,L.jsx)(`span`,{className:ef[e.tone],children:F(e.key)},e.key))]}),m]}),v&&i.checks.map(e=>{let{glyph:t,tone:n}=KP[e.state],r=VP(e,_),i=`${e.runId}:${e.name}`,a=c[i];return(0,L.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,L.jsxs)(`div`,{className:`flex items-baseline gap-2 pl-4`,children:[(0,L.jsx)(`span`,{className:`w-[1ch] flex-none text-center ${ef[n]}`,children:t}),(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.name,children:e.name}),r&&(0,L.jsx)(`span`,{className:`flex-none text-subtle`,children:F(r.key,r.vars)}),e.state===`fail`&&e.runId&&(0,L.jsx)(R,{hit:`tight`,className:`flex-none whitespace-nowrap`,onClick:()=>p(e),children:F(a?`files.checks.hideLog`:`files.checks.log`)})]}),a&&(0,L.jsx)(`pre`,{className:`m-0 ml-4 mb-1 max-h-40 overflow-y-auto rounded-sm border-hairline border-line bg-inset px-2 py-1.5 whitespace-pre-wrap wrap-anywhere text-muted`,children:a.state===`loading`?F(`files.checks.loading`):a.text})]},`${e.name}:${e.url}`)}),v&&i.total>i.checks.length&&(0,L.jsx)(`span`,{className:`pl-4 text-subtle`,children:F(`files.checks.more`,{count:i.total-i.checks.length})})]})}function JP({model:e,task:t}){return RP(t)?(0,L.jsxs)(`div`,{onKeyDown:e=>e.stopPropagation(),children:[(0,L.jsx)(qP,{model:e,task:t}),(0,L.jsx)(LP,{model:e,task:t})]}):null}var YP=[`renamed`,`added`,`untracked`,`modified`,`deleted`,`conflict`],XP={U:`conflict`,D:`deleted`,M:`modified`,T:`modified`,"?":`untracked`,A:`added`,R:`renamed`,C:`renamed`},ZP={conflict:`attention`,deleted:`attention`,modified:`warning`,untracked:`success`,added:`success`,renamed:`accent`},QP={conflict:`!`,deleted:`D`,modified:`M`,untracked:`U`,added:`A`,renamed:`R`};function $P(e){let t=new Map;for(let n of[`branch`,`working`])for(let r of e){let e=r.scope===n?XP[r.status]:void 0;e&&t.set(r.path,e)}let n=new Map(t);for(let[e,r]of t)for(let t=e.indexOf(`/`);t>=0;t=e.indexOf(`/`,t+1)){let i=e.slice(0,t+1),a=n.get(i);(a===void 0||YP.indexOf(r)>YP.indexOf(a))&&n.set(i,r)}return n}function eF(e,t){return e.some(e=>e.scope===`working`&&e.path===t&&e.status!==`?`)}function tF(e,t){let n={children:new Map,file:!1};for(let t of e){let e=n;for(let n of t.split(`/`)){let t=e.children.get(n);t||(t={children:new Map,file:!1},e.children.set(n,t)),e=t}e.file=!0}let r=[],i=(e,n,a)=>{let o=[...e.children].sort(([e,t],[n,r])=>{let i=t.children.size>0&&!t.file;return i===(r.children.size>0&&!r.file)?e.localeCompare(n):i?-1:1});for(let[e,s]of o){let o=s.children.size>0&&!s.file,c=o?`${n}${e}/`:`${n}${e}`,l=o&&t.has(c);r.push({path:c,name:e,depth:a,dir:o,open:l}),l&&i(s,c,a+1)}};return i(n,``,0),r}var nF={start:`\x1B[200~`,end:`\x1B[201~`};function rF(e,t){return e.engineTarget(t).tabId??e.tabs.get()[t]?.find(e=>e.kind===`engine`)?.id}async function iF(e,t,n){let r=rF(e,t);if(!r)return H(F(`files.stripNoEngine`),`error`),!1;try{return e.selection.get().tabId!==r&&e.select(t,r),await e.client.request(`term.input`,{stream:Bl(t,r),data:`${nF.start}${n}${nF.end}`}),H(F(`files.stripFilled`)),!0}catch(e){return H(e instanceof Error?e.message:String(e),`error`),!1}}function aF(e){let t=e.kind===`task`&&!e.noWorktree&&!e.machine&&!e.archived,n=e.changes;return t&&!!n&&`added`in n&&n.added+n.deleted>0}function oF(e){return[...aF(e)?[`commit`]:[],...sF(e)]}function sF(e){let t=e.pr;if(!t)return e.kind===`task`&&!e.noWorktree&&!e.machine&&!e.archived&&!e.sessionPrs?.length?[`createPR`]:[];if(t.lifecycle===`merged`)return e.archived||e.kind===`main`?[]:[`archive`];if(t.lifecycle!==`open`&&t.lifecycle!==`ready_to_merge`)return[];let n=[];return((t.mergeable??``).toUpperCase()===`CONFLICTING`||e.prChip===`conflict`)&&n.push(`conflicts`),t.checkState===`failing`&&n.push(`fixCI`),(t.reviewDecision??``).toUpperCase()===`CHANGES_REQUESTED`&&n.push(`comments`),n}async function cF(e,t,n){try{let r=await e.client.request(`task.prompt`,{taskId:t.id,kind:n});r.outcome===`unavailable`?H(F(`files.stripUnavailable`,{detail:r.detail??``}),`error`):r.outcome===`none`||!r.prompt?H(F(`files.stripNothing`),`error`):await iF(e,t.id,r.prompt)}catch(e){H(e instanceof Error?e.message:String(e),`error`)}}var lF={commit:`files.stripCommit`,createPR:`files.stripCreate`,conflicts:`files.stripConflicts`,fixCI:`files.stripFixCi`,comments:`files.stripComments`,archive:`files.stripArchive`};function uF({model:e,task:t}){let n=oF(t);return n.length===0?null:(0,L.jsx)(`div`,{className:`flex flex-wrap justify-end gap-x-3.5 gap-y-1 px-2 pb-2 font-mono text-meta whitespace-nowrap`,children:n.map(n=>(0,L.jsx)(R,{onClick:()=>n===`archive`?void e_(e,t):void cF(e,t,n),children:F(lF[n])},n))})}function dF(e){return e instanceof pd&&e.code===`NOT_CONNECTED`?F(`workspace.connect.notConnected`):e instanceof Error?e.message:String(e)}var fF=2e3;function pF({model:e,task:t}){I();let n=t.id,r=!t.machine,[i,a]=(0,h.useState)(null),[o,s]=(0,h.useState)(!1),c=i?.running===!0;if((0,h.useEffect)(()=>{if(!r)return;let t=!0,i=()=>e.client.request(`run.status`,{taskId:n}).then(e=>t&&a(e),()=>{});i();let o=c?window.setInterval(()=>void i(),fF):0;return()=>{t=!1,window.clearInterval(o)}},[e,n,r,c]),!r||!i?.script)return null;let l=async t=>{s(!0);try{a(await e.client.request(t,{taskId:n}))}catch(e){H(e instanceof Error?e.message:String(e),`error`)}finally{s(!1)}};return(0,L.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-x-3.5 gap-y-1 px-2 pb-2 font-mono text-meta whitespace-nowrap`,children:[i.url&&(0,L.jsx)(R,{onClick:()=>i.url&&Ls(n,i.url),children:F(`files.run.open`,{port:i.port??``})}),(0,L.jsx)(R,{disabled:o,onClick:()=>void l(c?`run.stop`:`run.start`),children:F(c?`files.run.stop`:`files.run.run`)})]})}function mF({model:e,task:t,narrow:n=!1}){I();let[r,i]=(0,h.useState)(()=>J(e,`files.list`,{taskId:t.id})?.files??null),[a,o]=(0,h.useState)(()=>$P(J(e,`diff.files`,{taskId:t.id})?.files??[])),[s,c]=(0,h.useState)(null),[l,u]=(0,h.useState)(new Set),[d,f]=(0,h.useState)(0),[p,m]=(0,h.useState)(0),g=(0,h.useRef)(null),v=_(xn),y=_(e.client.conn),b=JSON.stringify(t.changes??null);(0,h.useEffect)(()=>{let n=!0;return X(e,`files.list`,{taskId:t.id}).then(e=>{n&&(i(e.files),c(null))},e=>n&&c(dF(e))),()=>{n=!1}},[e,t.id,b,p,y.state]),(0,h.useEffect)(()=>{let n=!0;return X(e,`diff.files`,{taskId:t.id}).then(e=>n&&o($P(e.files)),()=>{}),()=>{n=!1}},[e,t.id,b,p,y.state]);let x=r!==null,S=tF(r??[],l).map(e=>({path:e.path,label:e.name,depth:e.depth,dir:e.dir,open:e.open,state:a.get(e.path)})),C=Math.min(d,Math.max(0,S.length-1)),w=S[C],T=(e,t)=>u(n=>{let r=new Set(n);return t??!r.has(e)?r.add(e):r.delete(e),r}),E=e=>Is(t.id,e),D=e=>Fs({taskId:t.id,path:e,scope:`working`}),O=n=>{if(!v?.startsWith(`${t.id}::`)){H(F(`files.mentionNoEngine`),`error`);return}e.client.request(`term.input`,{stream:v,data:`@${n} `}).catch(e=>H(String(e),`error`))},k=n=>t.machine?H(F(`files.remoteNoExternal`,{host:t.machine.label}),`error`):void e.client.request(`file.openExternal`,{taskId:t.id,path:n}).then(()=>H(F(`taskops.openedExternal`))).catch(e=>H(e instanceof Error?e.message:String(e),`error`));return(0,L.jsxs)(`div`,{className:`group/pane flex min-h-0 min-w-0 flex-1 flex-col outline-none ${n?`px-1.5 pt-2.5 pb-2`:`pt-0.5 pr-1.5 pb-1.5 pl-0`}`,tabIndex:0,ref:g,onKeyDown:e=>{let t=e.key;if(t===`j`||t===`ArrowDown`)f(Math.min(S.length-1,C+1));else if(t===`k`||t===`ArrowUp`)f(Math.max(0,C-1));else if((t===`l`||t===`ArrowRight`)&&w?.dir)T(w.path,!0);else if((t===`h`||t===`ArrowLeft`)&&w?.dir)T(w.path,!1);else if(t===`r`)m(e=>e+1);else if(t===`D`&&e.shiftKey)D(`.`);else if(t===`d`&&w)D(w.path);else if(t===`Enter`&&w)w.dir?T(w.path):E(w.path);else if(t===`a`&&w)O(w.path);else if(t===`o`&&w&&!w.dir)k(w.path);else return;e.preventDefault()},children:[(0,L.jsx)(uF,{model:e,task:t}),(0,L.jsx)(JP,{model:e,task:t}),(0,L.jsx)(pF,{model:e,task:t}),(0,L.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[s&&(0,L.jsx)(`p`,{className:`mono text-error`,children:s}),!s&&x&&S.length===0&&(0,L.jsx)(`p`,{className:`mx-2.5 my-3 font-mono text-meta text-subtle`,children:F(`files.emptyAll`)}),S.map((e,t)=>(0,L.jsxs)(`button`,{type:`button`,className:vr({selected:t===C,size:n?`file-narrow`:`file`}),style:{paddingLeft:8+e.depth*14},title:e.path,onClick:()=>{f(t),g.current?.focus(),e.dir?T(e.path):E(e.path)},children:[(0,L.jsx)(`span`,{className:Cr,children:e.dir?(0,L.jsx)(fo,{right:!e.open}):null}),(0,L.jsx)(`span`,{className:`${yr} ${e.state?ef[ZP[e.state]]:``}`,children:e.label}),e.state&&(0,L.jsx)(`span`,{className:`w-[1ch] flex-none text-center font-mono ${ef[ZP[e.state]]}`,title:F(`files.state.${e.state}`),children:e.dir?`•`:QP[e.state]})]},e.path))]})]})}var hF={md:`md`,markdown:`md`,html:`html`,htm:`html`,svg:`svg`,png:`image`,jpg:`image`,jpeg:`image`,gif:`image`,webp:`image`,pdf:`pdf`};function gF(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<0?null:hF[t.slice(n+1).toLowerCase()]??null}function _F(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}var vF=e=>new TextDecoder().decode(_F(e));function yF(e,t){if(e===`svg`)return`image/svg+xml`;if(e===`pdf`)return`application/pdf`;let n=t.slice(t.lastIndexOf(`.`)+1).toLowerCase();return n===`jpg`||n===`jpeg`?`image/jpeg`:n===`gif`?`image/gif`:n===`webp`?`image/webp`:`image/png`}var bF=`default-src 'none'; img-src data:; style-src 'unsafe-inline'`;function xF(e){let t=`<meta http-equiv="Content-Security-Policy" content="${bF}">`,n=/^\s*<!doctype[^>]*>/i.exec(e);return n?`${n[0]}${t}${e.slice(n[0].length)}`:`${t}${e}`}var SF=/^\[([^\]\n]+)\]\((https?:\/\/[^\s)]+)\)/,CF=/^https?:\/\/[^\s<>)\]]+/,wF=/[\p{L}\p{N}]/u;function TF(e){let t=[],n=``,r=()=>{n&&t.push({t:`text`,v:n}),n=``},i=0;for(;i<e.length;){let a=e.slice(i),o=e[i]??``;if(o==="`"){let n=e.indexOf("`",i+1);if(n>i+1){r(),t.push({t:`code`,v:e.slice(i+1,n)}),i=n+1;continue}}else if(a.startsWith(`**`)){let n=e.indexOf(`**`,i+2);if(n>i+2){r(),t.push({t:`bold`,c:TF(e.slice(i+2,n))}),i=n+2;continue}}else if(o===`*`||o===`_`&&!wF.test(e[i-1]??``)){let n=e.indexOf(o,i+1);if(n>i+1&&!/\s/.test(e[i+1]??` `)&&(o===`*`||!wF.test(e[n+1]??``))){r(),t.push({t:`em`,c:TF(e.slice(i+1,n))}),i=n+1;continue}}else if(o===`[`){let e=SF.exec(a);if(e){r(),t.push({t:`link`,href:e[2],c:TF(e[1])}),i+=e[0].length;continue}}else if(o===`h`&&!wF.test(e[i-1]??``)){let e=CF.exec(a);if(e){let n=e[0].replace(/[.,;:!?]+$/,``);r(),t.push({t:`link`,href:n,c:[{t:`text`,v:n}]}),i+=n.length;continue}}n+=o,i++}return r(),t}var EF=/^\s*(```+|~~~+)\s*([\w+#.-]*)\s*$/,DF=/^(#{1,6})\s+(.*?)\s*#*\s*$/,OF=/^(\s*)([-*+])\s+(.*)$/,kF=/^(\s*)\d+[.)]\s+(.*)$/,AF=/^\s*([-*_])(\s*\1){2,}\s*$/,jF=/^\s*\|.*\|\s*$/,MF=/^\s*\|?\s*:?-{2,}:?\s*(\|\s*:?-{2,}:?\s*)*\|?\s*$/,NF=e=>e.trim().replace(/^\|/,``).replace(/\|$/,``).split(`|`).map(e=>e.trim());function PF(e){let t=e.replace(/\r\n?/g,`
42
+ `)}}var qM=`min-h-0 w-full overflow-y-auto`,JM=`mx-auto mt-[min(16vh,8rem)] flex w-full max-w-130 flex-col gap-4 px-5 pb-7`,YM=`relative grid w-full select-none overflow-hidden font-mono text-(length:--fs-body) text-subtle [contain:layout_paint]`,XM=`col-start-1 row-start-1 m-0 whitespace-pre font-[inherit] leading-[inherit]`,ZM=`invisible absolute top-0 left-0 whitespace-pre`,QM=1.3,$M=`0000000000`,eN=1e3/12;function tN(){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=KM(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)/eN);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,L.jsxs)(`div`,{ref:e,"aria-hidden":`true`,"data-field":`first-run-art`,className:YM,style:{height:`${11*QM}em`,lineHeight:QM},children:[(0,L.jsx)(`span`,{ref:t,className:ZM,children:$M}),(0,L.jsx)(`pre`,{ref:n,className:XM}),(0,L.jsx)(`pre`,{ref:r,className:`${XM} text-accent`})]})}function nN(e){let t=W(`doctor`,`fix.humanOnlyWhy`),n=[];if(e.git||n.push({id:`git`,label:W(`doctor`,`fix.git`),action:W(`doctor`,`fix.gitAction`),why:t}),e.engines.length===0){let r=e.signedOut.length>0;n.push({id:`engine`,label:W(`doctor`,r?`fix.noEngineLogin`:`fix.noEngine`),action:W(`doctor`,r?`fix.noEngineLoginAction`:`fix.noEngineAction`,{list:e.signedOut.map(e=>e.id).join(`, `)}),why:t})}return n}function rN({model:e}){I(),_(hi);let[t,n]=(0,h.useState)(()=>J(e,`welcome.env`)??null);(0,h.useEffect)(()=>{let t=!0;return X(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)?nN(t):[];return(0,L.jsx)(`div`,{className:qM,"data-field":`welcome`,children:(0,L.jsxs)(`div`,{className:JM,children:[(0,L.jsx)(tN,{}),(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,L.jsx)(`h1`,{className:`m-0 font-sans text-title font-semibold text-ink`,children:F(`firstRun.title`)}),(0,L.jsx)(`p`,{className:`m-0 font-sans text-body text-muted`,children:F(`firstRun.body`)})]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,L.jsx)(`button`,{type:`button`,className:Be(),"data-field":`start-first-task`,onClick:()=>Uh(t?.start?.repo),children:F(`firstRun.start`)}),(0,L.jsx)(`span`,{className:`keys-only mono text-meta text-subtle`,children:wi(`task.new.global`)})]}),t!==null&&r!==null&&(0,L.jsxs)(`div`,{className:`flex flex-col gap-1.5 font-sans text-meta`,children:[(0,L.jsx)(`p`,{className:`m-0 ${r.warn?`text-warning`:`text-subtle`}`,children:W(`workspace`,`welcome.${r.key}`,{list:r.list})}),!t.git&&(0,L.jsx)(`p`,{className:`m-0 text-warning`,children:W(`workspace`,`welcome.gitMissing`)}),i.map(e=>(0,L.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,L.jsx)(`p`,{className:`m-0 text-warning`,children:e.label}),(0,L.jsx)(`p`,{className:`mono m-0 text-accent`,children:e.action}),(0,L.jsx)(`p`,{className:`m-0 text-muted`,children:e.why})]},e.id)),i.length>0&&(0,L.jsx)(`p`,{className:`m-0 text-muted`,children:W(`common`,`failureHint`,{command:`rove doctor`})})]})]})})}function iN(e,t){e.preventDefault(),mn.set({x:e.clientX,y:e.clientY,items:t,target:e.currentTarget,fromKeyboard:e.button!==2})}function aN({model:e,narrow:t}){let n=I(),r=_(e.tasks),i=_(e.remote),a=Kf(e),o=_(e.tabs),s=mb(e),c=_(e.tabsSettled),l=_(e.selection),u=r?.tasks??[],d=r?.attention.filter(e=>e.unread).length??0,f=l.taskId,p=kk(u,o,c),m=new Map([...u,...i].map(e=>[e.id,e])),g=uA(),v=_(hf),y=_(cf)===`state`,b=_(gf),x=e=>(y?Qh:Mu)({tasks:u,remote:i,machines:a,sort:g.sort,query:e,fold:{...g.hand,selectedId:f??void 0}}),S=x(g.search.active?g.search.query:``),{groups:C}=S,w=g.search.active?S.rows:Pu(EA($h(Tk(S.rows,p,l.taskId,c,b)),o),g.collapsed),T=e=>e.filter(e=>e.kind!==`project`&&e.kind!==`state`&&e.kind!==`round`),E=(n===`zh`?Yr:Jr).machine,D=new Set(a.filter(e=>e.state!==`online`).map(e=>e.alias)),O=C.find(e=>e.tasks.some(e=>e.kind===`main`))?.repo,k=e=>({mainTaskId:C.find(t=>t.repo===e)?.tasks.find(e=>e.kind===`main`)?.id??null,label:tu(e),first:e===O}),ee=Ck(e,u,!g.search.active&&!y,g.sort==="default"),{place:A,dragging:te}=ee.places(w),ne=()=>B.set((0,L.jsx)(DC,{model:e})),j=mA(e,w,g,{selectedId:f,onNewTask:Uh,onSettings:ne}),re=b!==null&&w.some(e=>e.id===b),M=j.setCursor;(0,h.useEffect)(()=>{re&&b!==null&&M(b)},[re,b,M]);let N=T(x(``).rows).length,ie=(0,h.useRef)(null),ae=_(bA)&&!t,oe=_(xA)&&ae,se=t?u.find(e=>e.id===l.taskId&&!e.deleting)??null:null;return(0,L.jsxs)(`nav`,{className:`${kf} ${ae?`is-folded`:``}`,ref:ie,inert:ae&&!oe,"aria-hidden":ae&&!oe,onMouseEnter:ae?()=>CA(!0):void 0,onMouseLeave:ae?()=>CA(!1):void 0,tabIndex:0,onKeyDown:e=>{tw(`sidebar`),j.onKeyDown(e)},children:[(0,L.jsxs)(`header`,{className:Af,children:[(0,L.jsxs)(`span`,{className:`${Yt} mr-auto`,children:[(0,L.jsx)(`span`,{className:Xt,children:`[`}),` rove `,(0,L.jsx)(`span`,{className:Xt,children:`]`})]}),(0,L.jsxs)(`span`,{className:`relative`,children:[(0,L.jsx)(`button`,{type:`button`,className:`m-0 text-meta font-medium normal-nums inbox-chip relative ${mr} ${Ze} ${d>0?`text-accent`:`text-muted`}`,onClick:()=>B.set((0,L.jsx)(af,{model:e})),children:F(`rail.inbox`,{count:d})}),(0,L.jsx)(JC,{model:e,bindingId:`inbox.show`,head:!0})]}),(0,L.jsx)(eb,{})]}),v&&(0,L.jsxs)(`div`,{className:`flex gap-1 px-3.5 pb-2 text-meta mono`,children:[(0,L.jsx)(`span`,{className:`text-accent`,children:W(`tasks`,`moveChip`).trim()}),(0,L.jsx)(`span`,{className:`keys-only ml-1.5 text-muted`,children:(0,L.jsx)($d,{text:F(`taskops.moveHint`)})})]}),g.search.active&&(0,L.jsx)(OA,{query:g.search.query,count:`${T(w).length}/${N}`,onChange:e=>g.setSearch(t=>({...t,query:e}))}),(0,L.jsx)(nk,{model:e}),(0,L.jsxs)(`div`,{"data-rail-body":!0,className:Nf(te!==null),...ee.body,children:[r&&u.length===0&&i.length===0&&t&&(0,L.jsx)(rN,{model:e}),r&&u.length===0&&i.length===0&&!t&&(0,L.jsx)(`p`,{className:`m-0 px-2 py-3 font-mono text-meta text-subtle`,children:F(`rail.empty`)}),se&&(0,L.jsx)(ZN,{title:se.title}),w.map((t,n)=>t.kind===`round`?(0,L.jsx)(DA,{row:t,guides:t.depth>1?_k(w,n):void 0,repo:y&&t.depth===1?Xh(t.tasks[0]):void 0,cursor:t.id===j.cursor,place:A(t),onClick:()=>j.setCursor(t.id)},t.id):t.kind===`pane`?(0,L.jsx)(Wk,{model:e,row:t,guides:_k(w,n),cursor:t.id===j.cursor,place:A(t),onClick:()=>{j.setCursor(t.id),Uk(e,t),Ka()},onMenu:n=>{j.setCursor(t.id),iN(n,zk(e,t.task.id,t.tab,t.leaf))}},t.id):(0,L.jsx)(oN,{row:t,guides:t.kind===`task`&&t.depth>1?_k(w,n):void 0,cloud:Uf(t,a,E),repo:y&&t.kind===`task`&&t.depth===1?Xh(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===j.cursor,stale:t.machine!==void 0&&D.has(t.machine),collapsed:(t.kind===`project`||t.kind===`state`)&&g.collapsed.has(t.id),drag:ee.props(t),dragging:te===t.id,place:A(t),onNewTask:t.kind===`project`?t.noProject?Wh:()=>Uh(t.repo,t.machine):void 0,moving:v&&t.machine===void 0&&(t.kind===`project`?!t.noProject&&k(t.repo).mainTaskId===j.cursor:t.id===j.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?xb([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:()=>{j.setCursor(t.id),(t.kind===`project`||t.kind===`state`)&&g.toggleProject(t.id),t.kind===`task`&&pA(e,t.task.id)},onMenu:n=>{if(t.kind!==`project`||t.machine===void 0){if(t.kind===`project`&&t.noProject){iN(n,$k(e));return}if(t.kind===`project`){let r=k(t.repo);r.mainTaskId&&w.some(e=>e.id===r.mainTaskId)&&j.setCursor(r.mainTaskId),iN(n,Qk(e,t.repo,r));return}t.kind===`task`&&(j.setCursor(t.id),iN(n,fn(lN(cN(nA(e,t.task,null),t.fold,()=>g.toggleTaskFold(t.id,t.fold?.collapsed===!0)),Hk(e,t.task.id)),F(`menu.more`))))}}},t.id))]}),(0,L.jsx)(wk,{model:e,narrow:t,onSettings:ne}),(0,L.jsx)(QN,{pane:`sidebar`}),!t&&!ae&&(0,L.jsx)(KN,{rail:ie})]})}function oN(e){let{row:t}=e,n=IM(t.kind===`task`?t.task.label:``,e.cursor&&t.kind===`task`),r=e.cursor?Pf:``;if(t.kind===`project`||t.kind===`state`)return(0,L.jsxs)(`h2`,{className:Ff({moving:e.moving,dragging:e.dragging,grab:e.drag!==void 0}),onContextMenu:e.onMenu,...e.place,...e.drag,children:[(0,L.jsxs)(`button`,{type:`button`,className:Lf,title:t.kind===`project`&&!t.noProject?t.repo:void 0,"aria-expanded":!e.collapsed,onClick:e.onClick,children:[(0,L.jsx)(`span`,{className:`truncate`,children:t.label}),t.kind===`state`&&(0,L.jsx)(`span`,{className:`font-normal text-subtle`,children:t.count}),(0,L.jsx)(fo,{right:e.collapsed,className:Rf(!!e.collapsed)})]}),e.onNewTask&&t.kind===`project`&&(0,L.jsx)(`button`,{type:`button`,className:zf,title:F(`rail.newTask`),onClick:e.onNewTask,children:`+`})]});let i=t.task,a=i.rowStatus?.kind===`running`,o=Rg(i),s=_(Ob)===`engine`,c=t.fold?.collapsed?e.rollup:i.rowStatus;return(0,L.jsxs)(`button`,{type:`button`,ref:n.ref,className:`${vr({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,L.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,L.jsx)(`span`,{className:wf(e)},t))}),(0,L.jsx)(Mb,{icon:e.engineIcon,name:i.engine?.name,status:s?_b(c):void 0}),(0,L.jsx)(`span`,{className:`${br} ${e.stale?`text-subtle`:``} ${a?xr:``}`,children:t.attempt??i.label}),(0,L.jsxs)(`span`,{className:`${wr} ml-auto items-center`,children:[e.repo&&(0,L.jsx)(`span`,{className:`max-w-24 truncate text-subtle`,children:e.repo}),t.level!==void 0&&(0,L.jsx)(`span`,{className:`text-subtle`,children:t.level}),(i.extraRepoCount??0)>0&&(0,L.jsxs)(`span`,{className:`text-subtle`,title:F(`rail.extraRepos`,{count:i.extraRepoCount??0}),children:[`+`,i.extraRepoCount]}),o&&(0,L.jsxs)(`span`,{className:`text-subtle tabular-nums`,title:F(`rail.todos`,o),children:[o.done,`/`,o.total]}),t.fold?.collapsed&&(0,L.jsx)(sN,{count:t.fold.count,onUnfold:e.onToggleFold}),i.kept&&(0,L.jsx)(`span`,{className:`text-accent`,title:F(`compare.kept`),children:`✓`}),i.pinned&&(0,L.jsx)(`span`,{className:`text-subtle`,children:`▴`}),i.startsAt&&(0,L.jsx)(LM,{at:i.startsAt}),(0,L.jsx)(lk,{tasks:e.prTasks??[i],onOpen:n.hide}),!s&&(0,L.jsx)($b,{status:c}),e.cloud&&(0,L.jsx)(Wf,{label:e.cloud})]})]})}function sN(e){let t=W(`tasks`,`menu.expandChildren`);return(0,L.jsxs)(`span`,{role:`button`,tabIndex:-1,"aria-label":t,"aria-expanded":!1,className:`chip text-muted ${Tf}`,title:t,onClick:t=>{t.stopPropagation(),e.onUnfold()},children:[e.count,(0,L.jsx)(fo,{right:!0})]})}function cN(e,t,n){if(!t)return e;let r={label:W(`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 lN(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)]}var uN=`flex-none fill-none stroke-current [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:1.25]`,dN=(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`}`,fN=`absolute top-2 left-[calc(--spacing(2)+var(--shell-inset-left,0px))] z-7 flex items-center gap-0.5`,pN=`[&.is-resizing_iframe]:pointer-events-none`,mN=e=>`side-panel ${Xe} relative row-1 flex min-h-0 min-w-0 flex-col ${pN} ${e?`flex-1 p-0`:`pt-2 pr-1 pb-1 pl-0`}`,hN=`grid min-h-0 flex-1 grid-rows-[minmax(0,1fr)] [--divider:5px] ${pN}`,gN=`side-col row-1 flex min-h-0 min-w-0 flex-col`,_N=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`}`,vN=`min-w-0 flex-1 truncate px-2 text-ink`,yN=`flex min-w-0 flex-1 items-center gap-0.5`,bN=`scrollbar-none flex min-w-0 gap-0.5 overflow-x-auto`,xN=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`}`,SN=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`}`,CN=`truncate`,wN=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`}`,TN=`ml-auto flex gap-0.5`,EN=`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-['']`,DN=`side-view flex min-h-0 min-w-0 flex-1 flex-col [&[hidden]]:hidden`,ON=`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`,kN=`flex min-h-0 flex-1 flex-col gap-1.5`,AN=`flex items-center gap-0.5 [&_svg]:flex-none`,jN=`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`,MN=`min-w-0 flex-1 rounded-sm border-none bg-paper`;function NN({children:e}){return(0,L.jsx)(`svg`,{className:`size-3.5 ${uN}`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:e})}var PN={chat:(0,L.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,L.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,L.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,L.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,L.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,L.jsx)(`path`,{d:`M2 10a6 6 0 1 1 12 0M8 10l2.5-3.5M4 13h8`})};function FN(e){let t=vo(e);return t?yo(t):F(`panel.browser`)}var IN=7.3,LN=22,RN=160,zN=2,BN=24;function VN(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(RN,LN+e*IN)+zN}return n<=t}function HN(e,t,n){let r=[{label:F(`panel.close`),section:`close`,run:()=>Vs(e,n.id)}];return t.tabs.length>1&&r.push({label:F(`panel.closeOthers`),section:`close`,run:()=>Bs(e,e=>jo(e,n.id))}),r}function UN({taskId:e,column:t}){I();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&&!VN(t.tabs.map(FN),i-BN);return(0,h.useEffect)(()=>{r.current?.querySelector(`.is-active`)?.scrollIntoView({block:`nearest`,inline:`nearest`})},[t.active,t.tabs.length,o]),(0,L.jsxs)(`div`,{className:yN,ref:n,children:[(0,L.jsx)(`div`,{className:bN,role:`tablist`,"aria-label":F(`panel.tabs`),ref:r,children:t.tabs.map(n=>{let r=n.id===t.active;return(0,L.jsxs)(`div`,{role:`presentation`,className:xN({active:r,compact:o}),onMouseDown:e=>{e.button===1&&e.preventDefault()},onAuxClick:t=>{t.button===1&&(t.preventDefault(),Vs(e,n.id))},onContextMenu:r=>iN(r,HN(e,t,n)),children:[(0,L.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":r,className:SN(r),title:vo(n)||FN(n),onClick:()=>Bs(e,e=>xo(e,n.id)),children:(0,L.jsx)(`span`,{className:CN,children:FN(n)})}),(0,L.jsx)(`button`,{type:`button`,className:wN(r),"aria-label":F(`panel.close`),tabIndex:-1,onClick:()=>Vs(e,n.id),children:`×`})]},n.id)})}),(0,L.jsx)(`button`,{type:`button`,className:dN({tool:!0}),title:F(`panel.new`),"aria-label":F(`panel.new`),onClick:()=>Bs(e,wo),children:(0,L.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{d:`M8 3.5v9M3.5 8h9`})})})]})}function WN({edge:e,className:t,...n}){return(0,L.jsx)(`div`,{"data-grip":``,className:Re(`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 GN=400;function KN({rail:e}){I();let t=(0,h.useRef)(null),n=(0,h.useRef)(0),r=(0,h.useRef)(null);return(0,L.jsx)(WN,{edge:`right`,title:F(`layout.railResize`),onPointerDown:n=>{t.current={x:n.clientX,width:e.current?.getBoundingClientRect().width??0,moved:!1},n.currentTarget.setPointerCapture(n.pointerId),Rn(!0)},onPointerMove:e=>{let n=t.current;!n||e.clientX===n.x||(n.moved=!0,yA.set(wA(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<GN?(n.current=0,yA.set(null)):(n.current=i,r.current=window.setTimeout(()=>bA.set(!0),GN))},onLostPointerCapture:()=>Rn(!1)})}function qN({side:e}){return(0,L.jsxs)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,L.jsx)(`rect`,{x:`1.5`,y:`2.5`,width:`13`,height:`11`,rx:`2.5`}),(0,L.jsx)(`path`,{d:e===`left`?`M6 2.5v11`:`M10 2.5v11`})]})}function JN({model:e}){I();let t=_(ow),n=_(bA),r=_(e.tasks),i=t=>cw(e,t),a=F(n?`layout.railUnfold`:`layout.railFold`),o=n&&(r?.tasks??[]).some(yb);return(0,L.jsxs)(`div`,{className:fN,onMouseEnter:()=>n&&xA.get()&&CA(!0),onMouseLeave:()=>n&&xA.get()&&CA(!1),children:[(0,L.jsxs)(`button`,{type:`button`,className:dN(),title:a,"aria-label":a,onClick:()=>bA.set(!n),children:[(0,L.jsx)(qN,{side:`left`}),o&&(0,L.jsx)(`span`,{className:`absolute top-0.75 right-0.75 size-1.5 rounded-full bg-accent`})]}),(0,L.jsx)(`button`,{type:`button`,className:dN(),title:F(`layout.navBack`),"aria-label":F(`layout.navBack`),disabled:aw(t,-1,i)<0,onClick:()=>dw(e,-1),children:(0,L.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{d:`M10 3.5 5.5 8l4.5 4.5`})})}),(0,L.jsx)(`button`,{type:`button`,className:dN(),title:F(`layout.navForward`),"aria-label":F(`layout.navForward`),disabled:aw(t,1,i)<0,onClick:()=>dw(e,1),children:(0,L.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{d:`M6 3.5 10.5 8 6 12.5`})})})]})}var YN=(0,L.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 XN({taskId:e}){I();let t=_(es);return(0,L.jsxs)(`div`,{className:Qe,children:[(0,L.jsx)(`button`,{type:`button`,className:`mono ${$e}`,onClick:qa,children:(0,L.jsx)(`span`,{className:`text-accent`,children:`‹ ${Cc(`narrowBack`)}`})}),e&&(0,L.jsx)(`span`,{className:`mono ml-auto flex gap-0.5`,role:`tablist`,children:[`terminal`,...$o].map(n=>{let r=F(n===`terminal`?`layout.narrowTerminal`:`panel.${n}`);return(0,L.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":t===n,"aria-label":r,title:r,className:et,onClick:()=>n===`terminal`?es.set(n):Ns(e,n),children:(0,L.jsx)(NN,{children:n===`terminal`?YN:PN[n]})},n)})})]})}function ZN({title:e}){return I(),(0,L.jsxs)(`button`,{type:`button`,className:vr({}),onClick:Ka,children:[(0,L.jsx)(`span`,{className:`${Sr} font-bold text-accent`,children:`↩`}),(0,L.jsx)(`span`,{className:yr,children:wc(`recentJump`,{title:e})})]})}function QN({pane:e}){I();let{prefs:t}=x_(),n=_(ew)[e];if(!t.keyHints)return null;let r=QC(e,n?`always`:`firstUse`);return r.length===0?null:(0,L.jsx)(`p`,{className:`mono text-muted ${tt}`,children:(0,L.jsx)($d,{text:r.map(e=>`${pi(e.cap)} ${vc(`pane.${e.msg}`)}`).join(` · `)})})}function $N(e){return e===`localhost`||e.endsWith(`.localhost`)||e===`[::1]`||/^127(\.\d{1,3}){3}$/.test(e)}var eP=/^(localhost|127(\.\d{1,3}){3}|\[::1\])(:\d+)?([/?#]|$)/i,tP=/^[a-z][a-z0-9+.-]*:(?!\d+([/?#]|$))/i;function nP(e){let t=e.trim();if(!t||/\s/.test(t)||tP.test(t)&&!/^https?:\/\//i.test(t))return null;let n=/^https?:\/\//i.test(t)?t:eP.test(t)?`http://${t}`:`https://${t.replace(/^\/\//,``)}`;try{let e=new URL(n);return e.hostname?e.href:null}catch{return null}}function rP(e,t,n=$N(t.hostname)){let r=new URL(e);return r.origin===t.origin?`self`:$N(r.hostname)?n?`yes`:`remote`:r.protocol===`https:`?`yes`:`unreachable`}function iP(e,t,n){let r=new URL(e).host;return t===`self`?{key:`self`,host:r}:t===`remote`?{key:`remote`,host:r}:t===`unreachable`?{key:`noFrame`,host:r}:n&&!n.reachable?{key:`unreachable`,host:r}:n&&!n.frameable?{key:`refuses`,host:r}:null}var aP=6e4,oP=new Map;function sP(e){let t=oP.get(e);return t&&Date.now()-t.at<aP?t:null}function cP(e,t,n){let[,r]=(0,h.useState)(0);(0,h.useEffect)(()=>{if(!n||sP(t))return;let i=!0;return e.request(`browser.probe`,{url:t,origin:window.location.origin}).then(e=>oP.set(t,{probe:e,at:Date.now()}),()=>oP.set(t,{probe:null,at:Date.now()})).then(()=>i&&r(e=>e+1)),()=>{i=!1}},[e,t,n]);let i=n?sP(t):null;return{pending:n&&!i,probe:i?.probe??null}}function lP({d:e}){return(0,L.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{d:e})})}var uP=`M6.5 3.5h-3v9h9v-3M9.5 3.5h3v3M12.5 3.5l-5 5`;function dP({model:e,tab:t,onNavigate:n,onStep:r}){I();let i=vo(t),[a,o]=(0,h.useState)(i),[s,c]=(0,h.useState)(!1),[l,u]=(0,h.useState)(0),d=_(e.client.conn).hello?.peer?.local,f=i?rP(i,window.location,d):null;(0,h.useEffect)(()=>{o(i),c(!1)},[i]);let p=e=>{let t=nP(e);c(t===null&&e.trim()!==``),t!==null&&(o(t),t===i?u(l+1):n(t))},m=i?new URL(i).hostname:``,g=f===`yes`&&i.startsWith(`https:`)&&!$N(m),{pending:v,probe:y}=cP(e.client,i,g),b=i&&f?iP(i,f,y):null,x=f===`yes`&&!b&&!v,S=b?F(`browser.${b.key}`,{host:b.host}):f===null?F(s?`browser.invalid`:`browser.empty`):null;return(0,L.jsxs)(`div`,{className:kN,children:[(0,L.jsxs)(`form`,{className:AN,onSubmit:e=>{e.preventDefault(),p(a)},children:[(0,L.jsx)(`button`,{type:`button`,className:dN({small:!0}),disabled:t.at<=0,title:F(`browser.back`),"aria-label":F(`browser.back`),onClick:()=>r(t.at-1),children:(0,L.jsx)(lP,{d:`M10 3.5 5.5 8l4.5 4.5`})}),(0,L.jsx)(`button`,{type:`button`,className:dN({small:!0}),disabled:t.at>=t.urls.length-1,title:F(`browser.forward`),"aria-label":F(`browser.forward`),onClick:()=>r(t.at+1),children:(0,L.jsx)(lP,{d:`M6 3.5 10.5 8 6 12.5`})}),(0,L.jsx)(`button`,{type:`button`,className:dN({small:!0}),disabled:!x,title:F(`browser.reload`),"aria-label":F(`browser.reload`),onClick:()=>u(l+1),children:(0,L.jsx)(lP,{d:`M12.5 8a4.5 4.5 0 1 1-1.4-3.3M12.5 2.5v2.7H9.8`})}),(0,L.jsx)(`input`,{className:`browser-url mono ${jN}`,value:a,placeholder:F(`browser.placeholder`),"aria-label":F(`browser.address`),"aria-invalid":s,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,inputMode:`url`,onChange:e=>o(e.target.value)}),i?(0,L.jsx)(`a`,{className:dN({small:!0}),href:i,target:`_blank`,rel:`noopener noreferrer`,title:F(`browser.openTab`),"aria-label":F(`browser.openTab`),children:(0,L.jsx)(lP,{d:uP})}):(0,L.jsx)(`button`,{type:`button`,className:dN({small:!0}),disabled:!0,"aria-label":F(`browser.openTab`),children:(0,L.jsx)(lP,{d:uP})})]}),x?(0,L.jsx)(`iframe`,{className:MN,src:i,title:i,sandbox:`allow-scripts allow-same-origin allow-forms allow-popups`,referrerPolicy:`no-referrer`},`${i}#${l}`):S?(0,L.jsx)(`p`,{className:ON,children:S}):null]})}var fP=`scrollbar-none flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto p-3`,pP=`m-0 p-3 font-mono text-meta text-muted`,mP=`flex items-baseline justify-between gap-3 font-mono text-meta normal-nums`,hP=`flex h-1.5 w-full gap-px overflow-hidden rounded-full bg-inset`,gP=`h-full min-w-[2px] flex-none`,_P=`m-0 flex list-none flex-col p-0`,vP=`-mx-1 flex h-5.5 min-w-0 items-center gap-2 rounded-xs px-1 font-mono text-meta normal-nums`,yP=`mt-2`,bP=`size-2 flex-none rounded-full bg-line`,xP=`flex min-w-0 flex-1 items-center gap-1.5`,SP=`min-w-0 truncate text-muted`,CP=`w-[7ch] flex-none text-right text-ink`,wP=`w-[6ch] flex-none text-right text-muted`,TP=`group/fold`,EP=`${vP} cursor-pointer list-none hover:bg-hover focus-visible:outline focus-visible:outline-1 focus-visible:outline-focus [&::-webkit-details-marker]:hidden`,DP=`m-0 flex list-none flex-col p-0`,OP=`${vP} pl-5`,kP=`flex min-w-0 flex-1 overflow-hidden`,AP=`min-w-0 truncate text-subtle`,jP=`flex-none text-muted`,MP=`w-[7ch] flex-none text-right text-muted`,NP=`w-[6ch] flex-none`,PP=1e4,FP={system:`var(--info)`,system_prompt:`var(--info)`,system_tools:`var(--success)`,mcp_tools:`var(--warning)`,mcp_instructions:`var(--warning)`,custom_agents:`var(--ink)`,memory_files:`var(--merged)`,skills:`var(--muted)`,messages:`var(--accent)`,used:`var(--accent)`},IP=[`var(--info)`,`var(--success)`,`var(--warning)`,`var(--merged)`];function LP({model:e,task:t,active:n}){I();let r=_(e.client.conn),i=_(e.selection),a=_(e.tabs)[t.id]??[],o=i.taskId===t.id?a.find(e=>e.id===i.tabId):void 0,s=(o?.kind===`engine`?o:a.find(e=>e.kind===`engine`))?.id??null,[c,l]=(0,h.useState)({kind:`loading`}),[u,d]=(0,h.useState)(!1),f=(0,h.useRef)(``);if((0,h.useEffect)(()=>{if(!n||r.state!==`open`)return;let i=`${t.id}::${s}`;if(f.current!==i&&l({kind:`loading`}),f.current=i,!s){l({kind:`ready`,meter:null});return}let a=!0,o=n=>e.client.request(`context.usage`,{taskId:t.id,tabId:s,probe:n}).then(e=>a&&l({kind:`ready`,meter:e.meter})).catch(e=>a&&l(t=>t.kind===`ready`?t:{kind:`failed`,error:Dw(e)})),c=()=>{d(!0),o(!0).finally(()=>a&&d(!1))};o(!1).then(c);let u=jr(PP,c);return()=>{a=!1,d(!1),u()}},[e,n,r.state,t.id,s]),c.kind===`loading`)return(0,L.jsx)(`p`,{className:pP,children:F(`context.loading`)});if(c.kind===`failed`)return(0,L.jsx)(`p`,{className:pP,children:F(`context.failed`,{error:c.error})});if(!c.meter)return(0,L.jsx)(`p`,{className:pP,children:F(`context.none`)});let p=c.meter,m=p.rows.filter(e=>e.share!==void 0),g=e=>e.share===void 0?void 0:FP[e.key]??IP[m.indexOf(e)%IP.length],v=`${p.approximate?`~`:``}${zP(p.used)}`;return(0,L.jsxs)(`div`,{className:fP,children:[(0,L.jsxs)(`div`,{className:mP,children:[(0,L.jsx)(`span`,{className:`text-ink`,children:p.percent===null?F(`context.usedTokens`,{tokens:v}):F(`context.used`,{percent:BP(p.percent)})}),p.window!==null&&(0,L.jsxs)(`span`,{className:`text-muted`,children:[v,` / `,zP(p.window)]})]}),(0,L.jsx)(`div`,{className:hP,role:`meter`,"aria-valuenow":Math.round(p.percent??100),"aria-valuemin":0,"aria-valuemax":100,children:m.map(e=>(0,L.jsx)(`span`,{className:gP,style:{width:`${e.share}%`,background:g(e)}},e.key))}),(0,L.jsx)(`ul`,{className:_P,children:p.rows.map((e,t)=>{let n=`context.part.${e.key}`,r=F(n)===n?e.label??e.key:F(n),i=g(e),a=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:bP,style:i?{background:i}:void 0}),(0,L.jsxs)(`span`,{className:xP,children:[(0,L.jsx)(`span`,{className:SP,title:r,children:r}),e.items&&(0,L.jsx)(`span`,{className:`inline-block flex-none text-subtle group-open/fold:rotate-90`,children:`›`})]}),(0,L.jsx)(`span`,{className:CP,children:zP(e.tokens)}),(0,L.jsx)(`span`,{className:wP,children:e.deferred?`—`:BP(e.tokens/(p.window??p.used)*100)})]}),o=(e.deferred?!p.rows[t-1]?.deferred:e.share===void 0)?yP:void 0;if(!e.items)return(0,L.jsx)(`li`,{className:o,children:(0,L.jsx)(`div`,{className:vP,children:a})},e.key);let s=e.items.reduce((e,t)=>e+t.tokens,0),c=(e.itemCount??e.items.length)-e.items.length;return(0,L.jsx)(`li`,{className:o,children:(0,L.jsxs)(`details`,{className:TP,children:[(0,L.jsx)(`summary`,{className:EP,children:a}),(0,L.jsxs)(`ul`,{className:DP,children:[e.items.map(e=>(0,L.jsx)(RP,{name:e.name,tokens:e.tokens},e.name)),c>0&&(0,L.jsx)(RP,{name:F(`context.more`,{count:c}),tokens:e.tokens-s})]})]})},e.key)})}),u&&m.length<2&&(0,L.jsx)(`p`,{className:`m-0 font-mono text-meta text-subtle`,children:F(`context.probing`)})]})}function RP({name:e,tokens:t}){let n=e.lastIndexOf(`/`)+1;return(0,L.jsxs)(`li`,{className:OP,title:e,children:[(0,L.jsxs)(`span`,{className:kP,children:[n>0&&(0,L.jsx)(`span`,{className:`min-w-0 truncate text-subtle`,children:e.slice(0,n)}),(0,L.jsx)(`span`,{className:n>0?jP:AP,children:e.slice(n)})]}),(0,L.jsx)(`span`,{className:MP,children:zP(Math.max(0,t))}),(0,L.jsx)(`span`,{className:NP})]})}function zP(e){return e>=1e6?`${+(e/1e6).toFixed(1)}M`:e>=1e3?`${+(e/1e3).toFixed(1)}k`:String(e)}function BP(e){return e>0&&e<.1?`<0.1%`:`${e<10?+e.toFixed(1):Math.round(e)}%`}var VP=3;function HP({model:e,task:t}){I();let n=t.autoFixCi,r=n=>void e.client.request(`task.autoFixCi`,{taskId:t.id,enabled:n}).catch(e=>H(e instanceof Error?e.message:String(e),`error`));return(0,L.jsx)(`div`,{className:`flex items-center gap-3 px-2 pt-1 font-mono text-meta`,children:n?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:n.stopped?ef.attention:`text-muted`,title:F(`files.autoFix.hint`),children:F(n.stopped?`files.autoFix.stopped`:`files.autoFix.count`,{n:n.attempts,max:VP})}),(0,L.jsx)(R,{hit:`tight`,onClick:()=>r(!1),children:F(`files.autoFix.off`)})]}):(0,L.jsx)(R,{hit:`tight`,title:F(`files.autoFix.hint`),onClick:()=>r(!0),children:F(`files.autoFix.on`)})})}function UP(e){let t=e.pr;return!!t&&t.number!==void 0&&!e.machine&&(t.lifecycle===`open`||t.lifecycle===`ready_to_merge`)}function WP(e){let t={fail:0,pending:0,pass:0,skipped:0};for(let n of e)t[n.state]++;return t}function GP(e){let t=Math.max(0,Math.round(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m${String(t%60).padStart(2,`0`)}s`:`${Math.floor(n/60)}h${String(n%60).padStart(2,`0`)}m`}function KP(e,t){let{startedAt:n,completedAt:r,durationMs:i}=e;return e.state===`pending`?n?{key:`files.checks.runningFor`,vars:{elapsed:GP(t-n)}}:null:i===null?r?{key:`files.checks.finishedAgo`,vars:{age:Ac(t-r)}}:null:r?{key:`files.checks.tookAgo`,vars:{duration:GP(i),age:Ac(t-r)}}:{key:`files.checks.took`,vars:{duration:GP(i)}}}function qP(e){let t=[],n=e.mergeState.toUpperCase();e.draft&&t.push({key:`files.merge.draft`,tone:`warning`}),e.mergeable.toUpperCase()===`CONFLICTING`||n===`DIRTY`?t.push({key:`files.merge.conflicts`,tone:`attention`}):n===`BEHIND`?t.push({key:`files.merge.behind`,tone:`warning`}):n===`UNSTABLE`?t.push({key:`files.merge.unstable`,tone:`warning`}):n===`BLOCKED`?t.push({key:`files.merge.blocked`,tone:`warning`}):n===`CLEAN`&&!e.draft&&t.push({key:`files.merge.clean`,tone:`success`});let r=e.review.toUpperCase();return r===`APPROVED`?t.push({key:`files.merge.approved`,tone:`success`}):r===`CHANGES_REQUESTED`?t.push({key:`files.merge.changes`,tone:`attention`}):r===`REVIEW_REQUIRED`&&t.push({key:`files.merge.reviewRequired`,tone:`warning`}),t}var JP=`flex flex-col gap-0.5 px-2 pb-2 font-mono text-meta`,YP=`flex items-start gap-2`,XP=`flex min-w-0 flex-1 flex-wrap items-center gap-x-2 text-left text-ink`,ZP={pass:{glyph:`✓`,tone:`success`},fail:{glyph:`✗`,tone:`attention`},pending:{glyph:`●`,tone:`warning`},skipped:{glyph:`–`,tone:`muted`}};function QP({model:e,task:t}){I();let n=t.pr,r=t.id,[i,a]=(0,h.useState)(()=>J(e,`pr.checks`,{taskId:r})??null),[o,s]=(0,h.useState)(null),[c,l]=(0,h.useState)({}),[u,d]=(0,h.useState)(0),f=`${n?.number}:${n?.checkState}:${n?.mergeable}:${n?.reviewDecision}`;(0,h.useEffect)(()=>{let t=!0,n={taskId:r};return e.client.request(`pr.checks`,u>0?{...n,fresh:!0}:n).then(r=>{t&&(Y(e,`pr.checks`,n,r),a(r))},e=>t&&a({outcome:`unavailable`,detail:e instanceof Error?e.message:String(e)})),()=>{t=!1}},[e,r,f,u]);let p=t=>{let n=`${t.runId}:${t.name}`;if(c[n]){l(({[n]:e,...t})=>t);return}l(e=>({...e,[n]:{state:`loading`}})),e.client.request(`pr.checkLog`,{taskId:r,runId:t.runId,job:t.name}).then(e=>e.outcome===`ok`?{state:`text`,text:e.tail}:e.outcome===`none`?{state:`note`,text:F(`files.checks.noLog`)}:{state:`note`,text:F(`files.checks.logUnavailable`,{detail:e.detail})}).catch(e=>({state:`note`,text:F(`files.checks.logUnavailable`,{detail:e instanceof Error?e.message:String(e)})})).then(e=>l(t=>n in t?{...t,[n]:e}:t))},m=(0,L.jsx)(R,{hit:`tight`,className:`flex-none whitespace-nowrap`,onClick:()=>d(e=>e+1),children:F(`files.checks.refresh`)});if(!i)return(0,L.jsx)(`div`,{className:JP,children:(0,L.jsx)(`div`,{className:YP,children:(0,L.jsxs)(`span`,{className:`flex-1 text-muted`,children:[F(`files.checks.title`),` `,F(`files.checks.loading`)]})})});if(i.outcome!==`ok`)return(0,L.jsx)(`div`,{className:JP,children:(0,L.jsxs)(`div`,{className:YP,children:[(0,L.jsx)(`span`,{className:`min-w-0 flex-1 text-muted wrap-anywhere`,children:i.outcome===`none`?F(`files.checks.none`):F(`files.checks.unavailable`,{detail:i.detail})}),m]})});let g=WP(i.checks),_=Date.now(),v=o??(g.fail>0||g.pending>0),y=qP(i);return(0,L.jsxs)(`div`,{className:JP,children:[(0,L.jsxs)(`div`,{className:YP,children:[(0,L.jsxs)(R,{variant:`row`,className:XP,"aria-expanded":v,disabled:i.total===0,onClick:()=>s(!v),children:[i.total>0&&(0,L.jsx)(fo,{right:!v}),(0,L.jsx)(`span`,{children:i.total===0?F(`files.checks.none`):F(`files.checks.summary`,{pass:g.pass+g.skipped,total:i.total})}),g.fail>0&&(0,L.jsx)(`span`,{className:ef.attention,children:F(`files.checks.failed`,{count:g.fail})}),g.pending>0&&(0,L.jsx)(`span`,{className:ef.warning,children:F(`files.checks.running`,{count:g.pending})}),y.map(e=>(0,L.jsx)(`span`,{className:ef[e.tone],children:F(e.key)},e.key))]}),m]}),v&&i.checks.map(e=>{let{glyph:t,tone:n}=ZP[e.state],r=KP(e,_),i=`${e.runId}:${e.name}`,a=c[i];return(0,L.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,L.jsxs)(`div`,{className:`flex items-baseline gap-2 pl-4`,children:[(0,L.jsx)(`span`,{className:`w-[1ch] flex-none text-center ${ef[n]}`,children:t}),(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.name,children:e.name}),r&&(0,L.jsx)(`span`,{className:`flex-none text-subtle`,children:F(r.key,r.vars)}),e.state===`fail`&&e.runId&&(0,L.jsx)(R,{hit:`tight`,className:`flex-none whitespace-nowrap`,onClick:()=>p(e),children:F(a?`files.checks.hideLog`:`files.checks.log`)})]}),a&&(0,L.jsx)(`pre`,{className:`m-0 ml-4 mb-1 max-h-40 overflow-y-auto rounded-sm border-hairline border-line bg-inset px-2 py-1.5 whitespace-pre-wrap wrap-anywhere text-muted`,children:a.state===`loading`?F(`files.checks.loading`):a.text})]},`${e.name}:${e.url}`)}),v&&i.total>i.checks.length&&(0,L.jsx)(`span`,{className:`pl-4 text-subtle`,children:F(`files.checks.more`,{count:i.total-i.checks.length})})]})}function $P({model:e,task:t}){return UP(t)?(0,L.jsxs)(`div`,{onKeyDown:e=>e.stopPropagation(),children:[(0,L.jsx)(QP,{model:e,task:t}),(0,L.jsx)(HP,{model:e,task:t})]}):null}var eF=[`renamed`,`added`,`untracked`,`modified`,`deleted`,`conflict`],tF={U:`conflict`,D:`deleted`,M:`modified`,T:`modified`,"?":`untracked`,A:`added`,R:`renamed`,C:`renamed`},nF={conflict:`attention`,deleted:`attention`,modified:`warning`,untracked:`success`,added:`success`,renamed:`accent`},rF={conflict:`!`,deleted:`D`,modified:`M`,untracked:`U`,added:`A`,renamed:`R`};function iF(e){let t=new Map;for(let n of[`branch`,`working`])for(let r of e){let e=r.scope===n?tF[r.status]:void 0;e&&t.set(r.path,e)}let n=new Map(t);for(let[e,r]of t)for(let t=e.indexOf(`/`);t>=0;t=e.indexOf(`/`,t+1)){let i=e.slice(0,t+1),a=n.get(i);(a===void 0||eF.indexOf(r)>eF.indexOf(a))&&n.set(i,r)}return n}function aF(e,t){return e.some(e=>e.scope===`working`&&e.path===t&&e.status!==`?`)}function oF(e,t){let n={children:new Map,file:!1};for(let t of e){let e=n;for(let n of t.split(`/`)){let t=e.children.get(n);t||(t={children:new Map,file:!1},e.children.set(n,t)),e=t}e.file=!0}let r=[],i=(e,n,a)=>{let o=[...e.children].sort(([e,t],[n,r])=>{let i=t.children.size>0&&!t.file;return i===(r.children.size>0&&!r.file)?e.localeCompare(n):i?-1:1});for(let[e,s]of o){let o=s.children.size>0&&!s.file,c=o?`${n}${e}/`:`${n}${e}`,l=o&&t.has(c);r.push({path:c,name:e,depth:a,dir:o,open:l}),l&&i(s,c,a+1)}};return i(n,``,0),r}var sF={start:`\x1B[200~`,end:`\x1B[201~`};function cF(e,t){return e.engineTarget(t).tabId??e.tabs.get()[t]?.find(e=>e.kind===`engine`)?.id}async function lF(e,t,n){let r=cF(e,t);if(!r)return H(F(`files.stripNoEngine`),`error`),!1;try{return e.selection.get().tabId!==r&&e.select(t,r),await e.client.request(`term.input`,{stream:Bl(t,r),data:`${sF.start}${n}${sF.end}`}),H(F(`files.stripFilled`)),!0}catch(e){return H(e instanceof Error?e.message:String(e),`error`),!1}}function uF(e){let t=e.kind===`task`&&!e.noWorktree&&!e.machine&&!e.archived,n=e.changes;return t&&!!n&&`added`in n&&n.added+n.deleted>0}function dF(e){return[...uF(e)?[`commit`]:[],...fF(e)]}function fF(e){let t=e.pr;if(!t)return e.kind===`task`&&!e.noWorktree&&!e.machine&&!e.archived&&!e.sessionPrs?.length?[`createPR`]:[];if(t.lifecycle===`merged`)return e.archived||e.kind===`main`?[]:[`archive`];if(t.lifecycle!==`open`&&t.lifecycle!==`ready_to_merge`)return[];let n=[];return((t.mergeable??``).toUpperCase()===`CONFLICTING`||e.prChip===`conflict`)&&n.push(`conflicts`),t.checkState===`failing`&&n.push(`fixCI`),(t.reviewDecision??``).toUpperCase()===`CHANGES_REQUESTED`&&n.push(`comments`),n}async function pF(e,t,n){try{let r=await e.client.request(`task.prompt`,{taskId:t.id,kind:n});r.outcome===`unavailable`?H(F(`files.stripUnavailable`,{detail:r.detail??``}),`error`):r.outcome===`none`||!r.prompt?H(F(`files.stripNothing`),`error`):await lF(e,t.id,r.prompt)}catch(e){H(e instanceof Error?e.message:String(e),`error`)}}var mF={commit:`files.stripCommit`,createPR:`files.stripCreate`,conflicts:`files.stripConflicts`,fixCI:`files.stripFixCi`,comments:`files.stripComments`,archive:`files.stripArchive`};function hF({model:e,task:t}){let n=dF(t);return n.length===0?null:(0,L.jsx)(`div`,{className:`flex flex-wrap justify-end gap-x-3.5 gap-y-1 px-2 pb-2 font-mono text-meta whitespace-nowrap`,children:n.map(n=>(0,L.jsx)(R,{onClick:()=>n===`archive`?void e_(e,t):void pF(e,t,n),children:F(mF[n])},n))})}function gF(e){return e instanceof pd&&e.code===`NOT_CONNECTED`?F(`workspace.connect.notConnected`):e instanceof Error?e.message:String(e)}var _F=2e3;function vF({model:e,task:t}){I();let n=t.id,r=!t.machine,[i,a]=(0,h.useState)(null),[o,s]=(0,h.useState)(!1),c=i?.running===!0;if((0,h.useEffect)(()=>{if(!r)return;let t=!0,i=()=>e.client.request(`run.status`,{taskId:n}).then(e=>t&&a(e),()=>{});i();let o=c?window.setInterval(()=>void i(),_F):0;return()=>{t=!1,window.clearInterval(o)}},[e,n,r,c]),!r||!i?.script)return null;let l=async t=>{s(!0);try{a(await e.client.request(t,{taskId:n}))}catch(e){H(e instanceof Error?e.message:String(e),`error`)}finally{s(!1)}};return(0,L.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-x-3.5 gap-y-1 px-2 pb-2 font-mono text-meta whitespace-nowrap`,children:[i.url&&(0,L.jsx)(R,{onClick:()=>i.url&&Ls(n,i.url),children:F(`files.run.open`,{port:i.port??``})}),(0,L.jsx)(R,{disabled:o,onClick:()=>void l(c?`run.stop`:`run.start`),children:F(c?`files.run.stop`:`files.run.run`)})]})}function yF({model:e,task:t,narrow:n=!1}){I();let[r,i]=(0,h.useState)(()=>J(e,`files.list`,{taskId:t.id})?.files??null),[a,o]=(0,h.useState)(()=>iF(J(e,`diff.files`,{taskId:t.id})?.files??[])),[s,c]=(0,h.useState)(null),[l,u]=(0,h.useState)(new Set),[d,f]=(0,h.useState)(0),[p,m]=(0,h.useState)(0),g=(0,h.useRef)(null),v=_(xn),y=_(e.client.conn),b=JSON.stringify(t.changes??null);(0,h.useEffect)(()=>{let n=!0;return X(e,`files.list`,{taskId:t.id}).then(e=>{n&&(i(e.files),c(null))},e=>n&&c(gF(e))),()=>{n=!1}},[e,t.id,b,p,y.state]),(0,h.useEffect)(()=>{let n=!0;return X(e,`diff.files`,{taskId:t.id}).then(e=>n&&o(iF(e.files)),()=>{}),()=>{n=!1}},[e,t.id,b,p,y.state]);let x=r!==null,S=oF(r??[],l).map(e=>({path:e.path,label:e.name,depth:e.depth,dir:e.dir,open:e.open,state:a.get(e.path)})),C=Math.min(d,Math.max(0,S.length-1)),w=S[C],T=(e,t)=>u(n=>{let r=new Set(n);return t??!r.has(e)?r.add(e):r.delete(e),r}),E=e=>Is(t.id,e),D=e=>Fs({taskId:t.id,path:e,scope:`working`}),O=n=>{if(!v?.startsWith(`${t.id}::`)){H(F(`files.mentionNoEngine`),`error`);return}e.client.request(`term.input`,{stream:v,data:`@${n} `}).catch(e=>H(String(e),`error`))},k=n=>t.machine?H(F(`files.remoteNoExternal`,{host:t.machine.label}),`error`):void e.client.request(`file.openExternal`,{taskId:t.id,path:n}).then(()=>H(F(`taskops.openedExternal`))).catch(e=>H(e instanceof Error?e.message:String(e),`error`));return(0,L.jsxs)(`div`,{className:`group/pane flex min-h-0 min-w-0 flex-1 flex-col outline-none ${n?`px-1.5 pt-2.5 pb-2`:`pt-0.5 pr-1.5 pb-1.5 pl-0`}`,tabIndex:0,ref:g,onKeyDown:e=>{let t=e.key;if(t===`j`||t===`ArrowDown`)f(Math.min(S.length-1,C+1));else if(t===`k`||t===`ArrowUp`)f(Math.max(0,C-1));else if((t===`l`||t===`ArrowRight`)&&w?.dir)T(w.path,!0);else if((t===`h`||t===`ArrowLeft`)&&w?.dir)T(w.path,!1);else if(t===`r`)m(e=>e+1);else if(t===`D`&&e.shiftKey)D(`.`);else if(t===`d`&&w)D(w.path);else if(t===`Enter`&&w)w.dir?T(w.path):E(w.path);else if(t===`a`&&w)O(w.path);else if(t===`o`&&w&&!w.dir)k(w.path);else return;e.preventDefault()},children:[(0,L.jsx)(hF,{model:e,task:t}),(0,L.jsx)($P,{model:e,task:t}),(0,L.jsx)(vF,{model:e,task:t}),(0,L.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[s&&(0,L.jsx)(`p`,{className:`mono text-error`,children:s}),!s&&x&&S.length===0&&(0,L.jsx)(`p`,{className:`mx-2.5 my-3 font-mono text-meta text-subtle`,children:F(`files.emptyAll`)}),S.map((e,t)=>(0,L.jsxs)(`button`,{type:`button`,className:vr({selected:t===C,size:n?`file-narrow`:`file`}),style:{paddingLeft:8+e.depth*14},title:e.path,onClick:()=>{f(t),g.current?.focus(),e.dir?T(e.path):E(e.path)},children:[(0,L.jsx)(`span`,{className:Cr,children:e.dir?(0,L.jsx)(fo,{right:!e.open}):null}),(0,L.jsx)(`span`,{className:`${yr} ${e.state?ef[nF[e.state]]:``}`,children:e.label}),e.state&&(0,L.jsx)(`span`,{className:`w-[1ch] flex-none text-center font-mono ${ef[nF[e.state]]}`,title:F(`files.state.${e.state}`),children:e.dir?`•`:rF[e.state]})]},e.path))]})]})}var bF={md:`md`,markdown:`md`,html:`html`,htm:`html`,svg:`svg`,png:`image`,jpg:`image`,jpeg:`image`,gif:`image`,webp:`image`,pdf:`pdf`};function xF(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<0?null:bF[t.slice(n+1).toLowerCase()]??null}function SF(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}var CF=e=>new TextDecoder().decode(SF(e));function wF(e,t){if(e===`svg`)return`image/svg+xml`;if(e===`pdf`)return`application/pdf`;let n=t.slice(t.lastIndexOf(`.`)+1).toLowerCase();return n===`jpg`||n===`jpeg`?`image/jpeg`:n===`gif`?`image/gif`:n===`webp`?`image/webp`:`image/png`}var TF=`default-src 'none'; img-src data:; style-src 'unsafe-inline'`;function EF(e){let t=`<meta http-equiv="Content-Security-Policy" content="${TF}">`,n=/^\s*<!doctype[^>]*>/i.exec(e);return n?`${n[0]}${t}${e.slice(n[0].length)}`:`${t}${e}`}var DF=/^\[([^\]\n]+)\]\((https?:\/\/[^\s)]+)\)/,OF=/^https?:\/\/[^\s<>)\]]+/,kF=/[\p{L}\p{N}]/u;function AF(e){let t=[],n=``,r=()=>{n&&t.push({t:`text`,v:n}),n=``},i=0;for(;i<e.length;){let a=e.slice(i),o=e[i]??``;if(o==="`"){let n=e.indexOf("`",i+1);if(n>i+1){r(),t.push({t:`code`,v:e.slice(i+1,n)}),i=n+1;continue}}else if(a.startsWith(`**`)){let n=e.indexOf(`**`,i+2);if(n>i+2){r(),t.push({t:`bold`,c:AF(e.slice(i+2,n))}),i=n+2;continue}}else if(o===`*`||o===`_`&&!kF.test(e[i-1]??``)){let n=e.indexOf(o,i+1);if(n>i+1&&!/\s/.test(e[i+1]??` `)&&(o===`*`||!kF.test(e[n+1]??``))){r(),t.push({t:`em`,c:AF(e.slice(i+1,n))}),i=n+1;continue}}else if(o===`[`){let e=DF.exec(a);if(e){r(),t.push({t:`link`,href:e[2],c:AF(e[1])}),i+=e[0].length;continue}}else if(o===`h`&&!kF.test(e[i-1]??``)){let e=OF.exec(a);if(e){let n=e[0].replace(/[.,;:!?]+$/,``);r(),t.push({t:`link`,href:n,c:[{t:`text`,v:n}]}),i+=n.length;continue}}n+=o,i++}return r(),t}var jF=/^\s*(```+|~~~+)\s*([\w+#.-]*)\s*$/,MF=/^(#{1,6})\s+(.*?)\s*#*\s*$/,NF=/^(\s*)([-*+])\s+(.*)$/,PF=/^(\s*)\d+[.)]\s+(.*)$/,FF=/^\s*([-*_])(\s*\1){2,}\s*$/,IF=/^\s*\|.*\|\s*$/,LF=/^\s*\|?\s*:?-{2,}:?\s*(\|\s*:?-{2,}:?\s*)*\|?\s*$/,RF=e=>e.trim().replace(/^\|/,``).replace(/\|$/,``).split(`|`).map(e=>e.trim());function zF(e){let t=e.replace(/\r\n?/g,`
43
43
  `).split(`
44
- `),n=[],r=[],i=()=>{r.length>0&&n.push({t:`para`,c:TF(r.join(`
45
- `))}),r=[]};for(let e=0;e<t.length;e++){let a=t[e],o=EF.exec(a);if(o){i();let r=o[1][0],a=[];for(e++;e<t.length&&!RegExp(`^\\s*${r}{3,}\\s*$`).test(t[e]);e++)a.push(t[e]);n.push({t:`code`,lang:o[2]??``,v:a.join(`
46
- `)});continue}if(a.trim()===``){i();continue}let s=DF.exec(a);if(s){i(),n.push({t:`heading`,level:s[1].length,c:TF(s[2])});continue}if(AF.test(a)){i(),n.push({t:`hr`});continue}if(jF.test(a)){i();let r=[];for(;e<t.length&&jF.test(t[e]);e++){let n=t[e];MF.test(n)||r.push(NF(n))}e--,n.push({t:`table`,rows:r.map(e=>e.map(e=>TF(e)))});continue}if(a.startsWith(`>`)){i();let r=[];for(;e<t.length&&t[e].startsWith(`>`);e++)r.push(t[e].replace(/^>\s?/,``));e--,n.push({t:`quote`,c:TF(r.join(`
47
- `))});continue}let c=OF.exec(a),l=c?null:kF.exec(a);if(c||l){i();let r=!c,a=[];for(;e<t.length;e++){let n=r?kF.exec(t[e]):OF.exec(t[e]);if(!n)break;let i=n[1].length;a.push({depth:Math.min(3,Math.floor(i/2)),c:TF(r?n[2]:n[3])})}e--,n.push({t:`list`,ordered:r,items:a});continue}r.push(a)}return i(),n}var FF=`flex min-h-0 min-w-0 flex-1 flex-col font-sans text-body`,IF=`flex flex-none flex-wrap items-center gap-x-3 gap-y-1 px-3 pb-1.5 font-mono text-meta`,LF=`min-w-0 flex-1 basis-32 py-1 text-meta`,RF=`min-h-0 flex-1 overflow-y-auto px-3 pb-3`,zF=`m-0 px-3 py-2 font-mono text-meta text-subtle`,BF=`m-0 whitespace-pre-wrap px-3 pb-3 font-mono text-meta leading-[1.45] text-muted wrap-anywhere`,VF=e=>`group/entry mt-3 rounded-sm border-l-2 py-0.5 pl-2.5 ${e.flash?`border-accent bg-accent-soft`:e.current?`border-line-active`:`border-transparent`}`,HF=`mb-0.5 flex items-center gap-2 font-mono text-meta`,UF=e=>e===`user`?`text-accent`:`text-muted`,WF=`text-subtle`,GF=`ml-auto opacity-0 group-hover/entry:opacity-100 focus-visible:opacity-100 touch:opacity-100`,KF=`m-0 mt-0.5 flex min-w-0 items-baseline gap-1.5 font-mono text-meta text-subtle`,qF=`flex-none text-muted`,JF=`min-w-0 flex-1 truncate`,YF=`leading-[1.5] wrap-anywhere`,XF=`m-0 mb-2 whitespace-pre-wrap last:mb-0`,ZF=`m-0 mt-3 mb-1.5 font-semibold first:mt-0`,QF=`m-0 mb-2 flex flex-col gap-0.5 pl-5 last:mb-0`,$F=`m-0 mb-2 border-l-2 border-line pl-2.5 whitespace-pre-wrap text-muted last:mb-0`,eI=`m-0 mb-2 overflow-x-auto rounded-sm border-hairline border-line bg-inset px-2.5 py-2 font-mono text-meta leading-[1.45] last:mb-0`,tI=`rounded-xs bg-inset px-1 font-mono text-meta`,nI=`text-accent underline`,rI=`mb-2 block max-w-full overflow-x-auto border-collapse font-mono text-meta last:mb-0`,iI=`border-hairline border-line px-2 py-0.5 text-left align-top`,aI=`my-2 border-0 border-t border-line`;function oI(e,t){let n=t.trim().toLowerCase();if(!n)return e;let r=e.toLowerCase(),i=[],a=0;for(let t=r.indexOf(n);t>=0;t=r.indexOf(n,a))t>a&&i.push(e.slice(a,t)),i.push((0,L.jsx)(`mark`,{className:Dg,"data-hit":``,children:e.slice(t,t+n.length)},t)),a=t+n.length;return i.push(e.slice(a)),h.Children.toArray(i)}var sI=[`h3`,`h3`,`h4`,`h5`,`h6`,`h6`];function cI({level:e,children:t}){let n=sI[Math.min(5,Math.max(0,e-1))]??`h6`;return(0,L.jsx)(n,{className:ZF,children:t})}function lI(e,t){return e.map((e,n)=>(0,L.jsx)(h.Fragment,{children:t(e)},n))}function uI({nodes:e,needle:t}){return lI(e,e=>e.t===`text`?oI(e.v,t):e.t===`code`?(0,L.jsx)(`code`,{className:tI,children:oI(e.v,t)}):e.t===`bold`?(0,L.jsx)(`strong`,{children:(0,L.jsx)(uI,{nodes:e.c,needle:t})}):e.t===`em`?(0,L.jsx)(`em`,{children:(0,L.jsx)(uI,{nodes:e.c,needle:t})}):(0,L.jsx)(`a`,{className:nI,href:e.href,target:`_blank`,rel:`noopener noreferrer`,children:(0,L.jsx)(uI,{nodes:e.c,needle:t})}))}function dI({block:e,needle:t}){switch(e.t){case`heading`:return(0,L.jsx)(cI,{level:e.level,children:(0,L.jsx)(uI,{nodes:e.c,needle:t})});case`para`:return(0,L.jsx)(`p`,{className:XF,children:(0,L.jsx)(uI,{nodes:e.c,needle:t})});case`code`:return(0,L.jsx)(`pre`,{className:eI,children:(0,L.jsx)(`code`,{children:oI(e.v,t)})});case`quote`:return(0,L.jsx)(`blockquote`,{className:$F,children:(0,L.jsx)(uI,{nodes:e.c,needle:t})});case`hr`:return(0,L.jsx)(`hr`,{className:aI});case`list`:{let n=e.ordered?`ol`:`ul`;return(0,L.jsx)(n,{className:`${QF} ${e.ordered?`list-decimal`:`list-disc`}`,children:lI(e.items,e=>(0,L.jsx)(`li`,{style:{marginLeft:`${e.depth*1.25}rem`},children:(0,L.jsx)(uI,{nodes:e.c,needle:t})}))})}case`table`:return(0,L.jsx)(`table`,{className:rI,children:(0,L.jsx)(`tbody`,{children:lI(e.rows,e=>(0,L.jsx)(`tr`,{children:lI(e,e=>(0,L.jsx)(`td`,{className:iI,children:(0,L.jsx)(uI,{nodes:e,needle:t})}))}))})})}}function fI({source:e,needle:t=``}){let n=(0,h.useMemo)(()=>PF(e),[e]);return(0,L.jsx)(`div`,{className:YF,children:lI(n,e=>(0,L.jsx)(dI,{block:e,needle:t}))})}function pI(e){if(e instanceof pd){if(e.code===`TOO_LARGE`){let t=e.detail?.size;return $(F(`artifact.tooLarge`),{size:typeof t==`number`?`${(t/1048576).toFixed(1)} MB`:`5 MB+`})}if(e.code===`NOT_PREVIEWABLE`)return F(`artifact.notPreviewable`);if(e.code===`NOT_FOUND`)return F(`artifact.gone`)}return $(F(`artifact.failed`),{error:e instanceof Error?e.message:String(e)})}function mI(e,t,n,r){let[i,a]=(0,h.useState)({kind:`loading`});return(0,h.useEffect)(()=>{let r=!0;return e.client.request(`file.read`,{taskId:t,path:n}).then(e=>r&&a({kind:`ready`,file:e}),e=>r&&a({kind:`failed`,text:pI(e)})),()=>{r=!1}},[e,t,n,r]),i}function hI(e,t){let n=(0,h.useMemo)(()=>e===null?null:URL.createObjectURL(new Blob([_F(e)],{type:t})),[e,t]);return(0,h.useEffect)(()=>()=>void(n&&URL.revokeObjectURL(n)),[n]),n}function gI({model:e,taskId:t,path:n,kind:r,changeKey:i}){I();let a=mI(e,t,n,i),o=hI(a.kind===`ready`&&(r===`svg`||r===`image`||r===`pdf`)?a.file.base64:null,r===`md`||r===`html`?``:yF(r,n));return a.kind===`loading`?(0,L.jsx)(`p`,{className:en,children:F(`artifact.loading`)}):a.kind===`failed`?(0,L.jsx)(`p`,{className:`${en} text-error`,children:a.text}):r===`md`?(0,L.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto px-3 py-2`,children:(0,L.jsx)(fI,{source:vF(a.file.base64)})}):r===`html`?(0,L.jsx)(`iframe`,{title:n,sandbox:``,srcDoc:xF(vF(a.file.base64)),style:{colorScheme:`light`,background:`#fff`},className:`min-h-0 w-full flex-1 border-none`}):o?r===`pdf`?(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,L.jsx)(`a`,{className:`${sn} px-3 py-1 font-mono text-meta`,href:o,target:`_blank`,rel:`noreferrer noopener`,children:F(`artifact.open`)}),(0,L.jsx)(`iframe`,{title:n,src:o,className:`min-h-0 w-full flex-1 border-none`})]}):(0,L.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:(0,L.jsx)(`img`,{src:o,alt:n,className:`max-w-full`})}):null}function _I(e){let[t,n]=(0,h.useState)(0),r=e.open&&e.items.length>0,i=Math.min(t,Math.max(0,e.items.length-1)),a=(0,h.useRef)(null),{onCursor:o}=e;return(0,h.useEffect)(()=>o?.(i),[i,o]),(0,h.useEffect)(()=>{a.current?.scrollIntoView({block:`nearest`})},[i,e.items]),(0,L.jsxs)(`div`,{className:`relative`,children:[(0,L.jsx)(`input`,{className:ln,"data-field":e.field,spellCheck:!1,autoComplete:`off`,autoFocus:e.autoFocus,placeholder:e.placeholder,value:e.value,onChange:t=>{n(0),e.onChange(t.target.value.replace(/[\r\n]+/g,``))},onKeyDown:t=>{if(!t.nativeEvent.isComposing){if(t.key===`ArrowDown`||t.key===`ArrowUp`){if(!r)return;t.preventDefault(),n(Math.max(0,Math.min(e.items.length-1,i+(t.key===`ArrowDown`?1:-1))))}else t.key===`Tab`&&!t.shiftKey&&r&&e.onComplete?.(i)?(t.preventDefault(),n(0)):t.key===`Enter`&&!t.ctrlKey&&!t.metaKey&&(t.preventDefault(),r?((e.onEnterRow??e.onPick)(i),n(0)):e.onEnter?.())}}}),r&&(0,L.jsx)(`ul`,{className:`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`,children:e.items.map((t,n)=>(0,L.jsx)(`li`,{ref:n===i?a:void 0,children:(0,L.jsxs)(`button`,{type:`button`,tabIndex:-1,"aria-pressed":n===i,className:on({cursor:n===i,accent:!!t.accent}),onMouseDown:t=>{t.preventDefault(),e.onPick(n)},children:[(0,L.jsx)(`span`,{children:t.text}),t.dim&&(0,L.jsxs)(`span`,{className:`text-muted`,children:[` `,t.dim]})]})},t.key))})]})}function vI(e,t,n){let r=[{ref:null,suggestion:{key:`default`,text:t,dim:F(`review.baseDefault`),accent:!0}}],i=(e,n)=>{for(let i of e)i!==t&&r.push({ref:i,suggestion:{key:`${n}:${i}`,text:i,dim:n}})};i(e?.branches??[],F(`review.baseBranch`)),i(e?.remotes??[],F(`review.baseRemote`)),i(e?.tags??[],F(`review.baseTag`));for(let t of e?.commits??[])r.push({ref:t.sha,suggestion:{key:`commit:${t.sha}`,text:t.sha,dim:t.subject}});let a=n.trim().toLowerCase();if(a===``)return r.slice(0,40);let o=r.filter(e=>`${e.suggestion.text} ${e.suggestion.dim??``}`.toLowerCase().includes(a)),s=e=>e.suggestion.text.toLowerCase()===a?0:1;return o.sort((e,t)=>s(e)-s(t)).slice(0,40)}function yI(e){let[t,n]=(0,h.useState)(!1),[r,i]=(0,h.useState)(``),[a,o]=(0,h.useState)(null),s=e.model.client;(0,h.useEffect)(()=>{if(!t)return;let n=!0;return X(s,`diff.refs`,{taskId:e.taskId}).then(e=>n&&o(e),()=>{}),()=>{n=!1}},[t,s,e.taskId]);let c=vI(a,e.base,r),l=t=>{e.onPick(t),n(!1),i(``)},u=e.custom??e.base,d=[{id:`task`,label:F(`review.scopeTask`)},{id:`working`,label:F(`review.scopeWorking`)},{id:`branch`,label:F(`review.scopeBranch`)}],f=d.find(t=>t.id===e.scope)?.label??``;return(0,L.jsxs)(`span`,{className:`relative`,onKeyDown:e=>{e.stopPropagation(),e.key===`Escape`&&t&&n(!1)},children:[(0,L.jsx)(R,{hit:`tight`,"aria-expanded":t,"aria-haspopup":`menu`,onClick:t=>{let r=t.currentTarget.getBoundingClientRect();mn.set({x:r.left,y:r.bottom+2,target:t.currentTarget,items:[...d.map(t=>({label:t.label,section:`scope`,checked:t.id===e.scope,run:()=>e.onScope(t.id)})),{label:F(`review.compareAgainst`,{base:u}),section:`base`,run:()=>n(!0)}]})},children:F(`review.scopeMenu`,{base:u,scope:f})}),t&&(0,L.jsx)(`div`,{className:`absolute top-full left-0 z-3 mt-1 w-64 max-w-full rounded-sm border-hairline border-line-active bg-surface p-1 shadow-popover`,children:(0,L.jsx)(_I,{field:`diff-base`,autoFocus:!0,value:r,onChange:i,items:c.map(e=>e.suggestion),open:!0,placeholder:F(`review.basePlaceholder`),onPick:e=>l(c[e]?.ref??null),onEnter:()=>l(r.trim()===``?null:r.trim())})})]})}var bI=`rove.diffBase`;function xI(){try{let e=JSON.parse(localStorage.getItem(bI)??`{}`);return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`string`))}catch{return{}}}function SI(e){return xI()[e]??null}function CI(e,t){let n=xI();t===null?delete n[e]:n[e]=t;try{localStorage.setItem(bI,JSON.stringify(n))}catch{}}function wI(e){let[t,n]=(0,h.useState)(()=>SI(e.taskId));return[t,t=>{CI(e.taskId,t),n(t),t!==null&&e.scope!==`task`&&Fs({taskId:e.taskId,path:e.path,scope:`task`})}]}var TI={add:`bg-diff-added-bg`,del:`bg-diff-removed-bg`},EI={add:`text-diff-added`,del:`text-diff-removed`};function DI(e,t){let n=t.cursor?`bg-inset group-focus/preview:bg-accent-soft`:t.noted?`bg-inset`:TI[e]??``;return`relative grid ${e===`file`||e===`note`?`cursor-pointer`:`cursor-default`} grid-cols-[4ch_4ch_2ch_minmax(0,1fr)] gap-x-2 gap-y-0 whitespace-pre px-3 group-data-file/preview:grid-cols-[4ch_1ch_minmax(0,1fr)] @max-md/preview:grid-cols-[3ch_3ch_1ch_minmax(0,1fr)] @max-md/preview:gap-x-1 @max-md/preview:px-1.5 @max-md/preview:group-data-file/preview:grid-cols-[3ch_1ch_minmax(0,1fr)] ${n} ${e===`file`?`mt-2 border-t-hairline border-line pt-1 font-bold text-ink`:e===`hunk`||e===`meta`?`text-subtle`:``}`}var OI=`text-right text-subtle`,kI=`${OI} group-data-file/preview:hidden`,AI=(e,t,n=!1)=>t?`text-accent`:n?`text-diff-added`:EI[e]??``,jI=e=>`min-w-0 whitespace-pre-wrap wrap-anywhere ${EI[e]??``}`,MI=`min-w-0 whitespace-pre-wrap wrap-anywhere text-accent`,NI=`col-span-3 flex min-w-0 items-baseline gap-2 overflow-hidden`,PI=(0,h.memo)(function(e){return(0,L.jsxs)(`div`,{className:`flex items-center ${e.viewed?`opacity-60`:``}`,children:[(0,L.jsxs)(R,{variant:`row`,"data-row":e.index,"aria-expanded":!e.closed,"aria-label":F(e.closed?`review.unfold`:`review.fold`,{path:e.name}),className:`${DI(`file`,{cursor:e.cursor,noted:!1})} min-w-0 flex-1 text-left`,onClick:()=>e.onToggleFold(e.index,e.path),children:[(0,L.jsx)(`span`,{className:`grid place-items-center text-subtle`,children:(0,L.jsx)(fo,{right:e.closed})}),(0,L.jsxs)(`span`,{className:NI,children:[(0,L.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name}),e.added?(0,L.jsxs)(ow,{tone:`added`,children:[`+`,e.added]}):null,e.removed?(0,L.jsxs)(ow,{tone:`removed`,children:[`−`,e.removed]}):null]})]}),e.path!==null&&(0,L.jsx)(R,{hit:`tight`,className:`flex-none px-2`,"aria-pressed":e.viewed,"aria-label":F(e.viewed?`review.unmarkViewed`:`review.markViewed`,{path:e.name}),onClick:()=>e.path!==null&&e.onToggleViewed(e.path),children:e.viewed?F(`review.viewedOn`):F(`review.viewed`)})]})});function FI(e){return(0,L.jsxs)(`div`,{className:`absolute top-full right-3 z-1 flex gap-1.5`,children:[(0,L.jsx)(R,{variant:`floating`,onMouseDown:e=>e.preventDefault(),onClick:t=>{t.stopPropagation(),e.onComment()},children:F(`review.comment`)}),e.showRange&&(0,L.jsx)(R,{variant:`floating`,onClick:t=>{t.stopPropagation(),e.onRange()},children:F(`review.range`)}),e.ranged&&(0,L.jsx)(R,{variant:`floating`,title:F(`preview.askInChatHint`),onMouseDown:e=>e.preventDefault(),onClick:t=>{t.stopPropagation(),e.onAsk()},children:F(`preview.askInChat`)})]})}function II({note:e,onEdit:t}){return(0,L.jsxs)(R,{variant:`row`,className:`${DI(`note`,{cursor:!1,noted:!1})} w-full text-left`,onClick:t,children:[(0,L.jsx)(`span`,{className:kI}),(0,L.jsx)(`span`,{}),(0,L.jsx)(`span`,{className:`text-accent`,children:`●`}),(0,L.jsx)(`span`,{className:MI,children:e.body})]})}function LI(e){let t=(0,h.useRef)(e);return t.current=e,(0,h.useMemo)(()=>({rowClick:(e,n)=>t.current.rowClick(e,n),fileClick:(e,n)=>t.current.fileClick(e,n),viewedClick:e=>t.current.viewedClick(e),editNote:e=>t.current.editNote(e)}),[])}var RI=2e3,zI=(0,h.memo)(function(e){let{index:t,row:n,noted:r}=e;return(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{"data-row":t,className:DI(n.kind,{cursor:e.cursor,noted:r}),onClick:n=>e.onClick(t,n),children:[(0,L.jsx)(`span`,{className:kI,children:n.oldNo??``}),(0,L.jsx)(`span`,{className:OI,children:n.newNo??``}),(0,L.jsx)(`span`,{className:AI(n.kind,r,e.changed),children:n.kind===`add`?`+`:n.kind===`del`?`−`:r?`●`:e.changed?`▎`:` `}),(0,L.jsxs)(`span`,{className:jI(n.kind),children:[n.text.length>RI?n.text.slice(0,RI):n.text,n.text.length>RI&&(0,L.jsxs)(`span`,{className:`text-subtle`,children:[` `,F(`review.lineClipped`,{count:(n.text.length-RI).toLocaleString()})]})]}),e.actions]}),e.notes?.map(t=>t.id===e.editId?(0,L.jsx)(h.Fragment,{children:e.composer},t.id):(0,L.jsx)(II,{note:t,onEdit:()=>e.onEditNote(t)},t.id)),e.editId===void 0&&e.composer]})});function BI(e){return(0,L.jsxs)(`div`,{className:`flex flex-none flex-wrap items-center gap-x-3 gap-y-1 px-2 pt-1.5 font-mono text-meta`,children:[e.picker,(0,L.jsx)(R,{hit:`tight`,"aria-pressed":e.ignoreWs,title:F(`review.ignoreWsHint`),className:`opacity-60 aria-pressed:underline aria-pressed:opacity-100`,onClick:e.onToggleWs,children:F(`review.ignoreWs`)}),(0,L.jsxs)(`span`,{className:`flex min-w-0 basis-full flex-wrap items-center gap-x-1.5 text-muted`,children:[F(`review.totals`,{files:e.files,added:e.added,removed:e.removed}),e.shape&&(0,L.jsxs)(`span`,{children:[`· `,e.shape]}),e.files>0&&(0,L.jsxs)(`span`,{className:`whitespace-nowrap`,children:[`· `,F(`review.viewedCount`,{done:e.viewed,files:e.files})]})]}),(0,L.jsxs)(`span`,{className:`ml-auto flex items-center gap-x-3`,children:[e.files>1&&(0,L.jsx)(R,{hit:`tight`,onClick:e.onNextFile,children:F(`review.nextFile`)}),e.onNextComment&&(0,L.jsx)(R,{hit:`tight`,onClick:e.onNextComment,children:F(`review.nextComment`)}),e.files>1&&(0,L.jsx)(R,{hit:`tight`,onClick:e.onFoldAll,children:e.allFolded?F(`review.unfoldAll`):F(`review.foldAll`)})]})]})}var VI=`rove.diffViewed`,HI=(e,t)=>`${e}\0${t}`,UI=4096;function WI(e){let t=2166136261;for(let n of e){let e=n.text.length>UI?`${n.text.slice(0,UI/2)}${n.text.length}${n.text.slice(-2048)}`:n.text,r=`${n.kind}${e}\n`;for(let e=0;e<r.length;e++)t=Math.imul(t^r.charCodeAt(e),16777619)}return(t>>>0).toString(16)}function GI(e){let t=new Map,n=-1,r=r=>{let i=n>=0?e[n]?.path:null;i&&t.set(i,WI(e.slice(n+1,r)))};return e.forEach((e,t)=>{e.kind===`file`&&(r(t),n=t)}),r(e.length),t}function KI(){try{let e=JSON.parse(localStorage.getItem(VI)??`{}`);return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`string`))}catch{return{}}}function qI(e){try{localStorage.setItem(VI,JSON.stringify(e))}catch{}}function JI(e,t,n){let r=new Set;for(let[i,a]of n)e[HI(t,i)]===a&&r.add(i);return r}function YI(e,t,n,r){let i={...e};return r===void 0?delete i[HI(t,n)]:i[HI(t,n)]=r,i}function XI(e,t){return e.find(e=>e>t)??e[0]??null}var ZI=`rove.diffIgnoreWs`;function QI(){try{return localStorage.getItem(ZI)===`1`}catch{return!1}}function $I(e){try{localStorage.setItem(ZI,e?`1`:`0`)}catch{}}var eL=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/;function tL(e,t=null,n=!1){let r=[],i=0,a=0,o=t,s=!1;for(let t of e.replace(/\n$/,``).split(`
48
- `)){if(t.startsWith(`diff --git `)){let e=/ b\/(.+)$/.exec(t);o=e?e[1]:o,s=!1,r.push({kind:`file`,text:o??t,oldNo:null,newNo:null,path:o});continue}let e=eL.exec(t);if(e){i=Number(e[1]),a=Number(e[2]),s=!0,r.push({kind:`hunk`,text:t,oldNo:null,newNo:null,path:o});continue}if(!s){r.push({kind:`meta`,text:t,oldNo:null,newNo:null,path:o});continue}t.startsWith(`+`)?r.push({kind:`add`,text:t.slice(1),oldNo:null,newNo:a++,path:o}):t.startsWith(`-`)?r.push({kind:`del`,text:t.slice(1),oldNo:i++,newNo:null,path:o,...n?{foreignOld:!0}:{}}):t.startsWith(`\\`)?r.push({kind:`meta`,text:t,oldNo:null,newNo:null,path:o}):r.push({kind:`ctx`,text:t.slice(1),oldNo:i++,newNo:a++,path:o})}return r}function nL(e,t){return e.replace(/\n$/,``).split(`
49
- `).map((e,n)=>({kind:`ctx`,text:e,oldNo:null,newNo:n+1,path:t}))}function rL(e){return e.kind===`del`?e.foreignOld?null:e.oldNo:e.kind===`add`||e.kind===`ctx`?e.newNo:null}function iL(e){let t=e.startLine?`lines ${e.startLine}-${e.line}`:`line ${e.line}`;return`@${e.path} (${t}) `}function aL(e,t,n){let r=e[t],i=r?rL(r):null;if(!r?.path||i===null)return null;if(n===null||n===t)return{path:r.path,line:i};let a=e[Math.min(n,t)],o=e[Math.max(n,t)],s=a?rL(a):null,c=o?rL(o):null;return s===null||c===null||a?.path!==o?.path?{path:r.path,line:i}:s===c?{path:r.path,line:c}:{path:r.path,startLine:Math.min(s,c),line:Math.max(s,c)}}function oL(e,t,n){let r=aL(e,t,n);if(!r)return null;let i=r.startLine!==void 0&&n!==null;return{...r,first:i?Math.min(n,t):t,last:i?Math.max(n,t):t}}function sL(e,t){let n=[],r=!1;return e.forEach((e,i)=>{e.kind===`file`&&(r=e.path!==null&&t.has(e.path)),(!r||e.kind===`file`)&&n.push(i)}),n}function cL(e){let t=new Map,n=-1;return e.forEach((e,r)=>{if(e.kind===`file`){n=r,t.set(r,{added:0,removed:0});return}let i=t.get(n);i&&(e.kind===`add`?i.added++:e.kind===`del`&&i.removed++)}),t}function lL(e){return(0,L.jsx)(`div`,{className:`flex flex-none items-center gap-3 px-2 pt-1.5 font-mono text-meta`,children:(0,L.jsx)(R,{hit:`tight`,onClick:()=>e.file?Fs({taskId:e.taskId,path:e.path,scope:`working`}):Is(e.taskId,e.path),children:F(e.file?`preview.modeDiff`:`preview.modeFile`)})})}function uL(e,t,n,r,i){let[a,o]=(0,h.useState)(null);return(0,h.useEffect)(()=>{if(!r)return;let i=!0;return X(e,`diff.file`,{taskId:t,path:n,scope:`working`}).then(e=>{if(!i)return;let t=e.kind===`diff`&&typeof e.text==`string`?tL(e.text,n):[];o(new Set(t.flatMap(e=>e.kind===`add`&&e.newNo!==null?[e.newNo]:[])))},()=>i&&o(null)),()=>{i=!1}},[e,t,n,r,i]),r?a:null}var dL=[`source`,`tests`,`config`,`docs`,`generated`],fL=/(^|\/)(bun\.lockb?|package-lock\.json|yarn\.lock|pnpm-lock\.yaml|Cargo\.lock|poetry\.lock|uv\.lock|Gemfile\.lock|go\.sum|composer\.lock)$/,pL=/(^|\/)(dist|build|generated|__generated__|\.next)\/|\.min\.(js|css)$|\.snap$|\.generated\.|\.pb\.go$|\.map$/,mL=/(^|\/)(tests?|__tests__|spec|e2e)\/|\.(test|spec)\.[cm]?[jt]sx?$|_test\.(go|py)$|(^|\/)test_[^/]+\.py$/,hL=/\.(md|mdx|rst|txt)$|(^|\/)docs\//i,gL=/(^|\/)(\.[\w.-]+rc(\.\w+)?|[\w.-]*\.config\.[cm]?[jt]s|tsconfig[\w.-]*\.json|package\.json|biome\.json|Dockerfile|Makefile)$|\.(ya?ml|toml|ini|env)$|(^|\/)\.(github|changeset|vscode)\//,_L=e=>fL.test(e);function vL(e){return fL.test(e)||pL.test(e)?`generated`:mL.test(e)?`tests`:hL.test(e)?`docs`:gL.test(e)?`config`:`source`}var yL=e=>vL(e)===`generated`;function bL(e){let t=e.filter(e=>vL(e.path)!==`generated`),n=t.reduce((e,t)=>e+t.lines,0);return t.length===0?1:((e,t)=>e<=2&&t<=30?1:e<=5&&t<=150?2:e<=10&&t<=400?3:e<=20&&t<=1e3?4:5)(t.length,n)}function xL(e){let t=[],n=(e,n)=>n>0&&t.push({group:e,count:n});for(let t of dL)t===`generated`?(n(`lockfile`,e.filter(_L).length),n(`generated`,e.filter(e=>vL(e)===`generated`&&!_L(e)).length)):n(t,e.filter(e=>vL(e)===t).length);return t}function SL(e){let t=[];for(let n of e)(n.kind===`file`||t.length===0)&&t.push([]),t[t.length-1]?.push(n);let n=e=>dL.indexOf(vL(e[0]?.path??``));return t.map((e,t)=>({file:e,i:t})).sort((e,t)=>n(e.file)-n(t.file)||e.i-t.i).flatMap(({file:e})=>e)}function CL(e){return xL(e.map(e=>e.path)).map(({group:e,count:t})=>({key:e===`lockfile`?t===1?`lockfile`:`lockfiles`:e,count:t}))}function wL(e,t){let n=[...e.entries()].flatMap(([e,n])=>{let r=t[e]?.path;return r?[{path:r,lines:n.added+n.removed}]:[]});return n.length<2?``:[F(`review.shape.effort`,{n:bL(n)}),...CL(n).map(e=>F(`review.shape.${e.key}`,{count:e.count}))].join(` · `)}function TL(e,t,n){if(!e||typeof e!=`object`||!(`kind`in e))return{kind:`text`,text:F(`preview.unknown`)};let r=`text`in e&&typeof e.text==`string`?e.text:``;switch(e.kind){case`diff`:{let e=tL(r,t===`.`?null:t,n);return{kind:`rows`,rows:t===`.`?SL(e):e,diff:!0}}case`code`:return{kind:`rows`,rows:nL(r,t),diff:!1};case`binary`:return{kind:`text`,text:F(`preview.binary`)};case`empty`:return{kind:`text`,text:F(`preview.empty`)};case`error`:return{kind:`text`,text:`message`in e?String(e.message):F(`preview.unknown`),error:!0};default:return{kind:`text`,text:F(`preview.noHunks`,{kind:String(e.kind)})}}}function EL(e){return e instanceof pd&&e.code===`UNKNOWN_OP`?Error(F(`review.notSupported`)):e instanceof Error?e:Error(String(e))}function DL(e,t){let n=e.tasks.get()?.tasks.find(e=>e.id===t);return n?.workspace?`${n.machine?.id??``}:${n.workspace}`:t}var OL={add:`+`,del:`-`},kL=40,AL=160,jL=e=>`${OL[e.kind]??` `}${e.text.slice(0,AL)}`,ML=e=>e.startLine!==void 0&&e.startLine!==e.line?`${e.filePath}:${e.startLine}-${e.line}`:`${e.filePath}:${e.line}`;function NL(e,t,n){let r=[];for(let i=t;i<=n&&r.length<kL;i++){let t=e[i];t&&rL(t)!==null&&r.push(jL(t))}return r.join(`
50
- `)}function PL(e,t){let n=e.startLine??e.line,r=t.flatMap((t,n)=>t.path===e.filePath&&rL(t)!==null?[n]:[]);if(!e.code){let i=r.filter(r=>{let i=rL(t[r]);return i>=n&&i<=e.line}),a=i[0],o=i[i.length-1];return a===void 0||o===void 0?null:{first:a,last:o}}let i=e.code.split(`
51
- `);for(let e=0;e+i.length<=r.length;e++){let a=r.slice(e,e+i.length),o=a[0],s=a[a.length-1];if(o!==void 0&&s!==void 0&&rL(t[o])===n&&a.every((e,n)=>jL(t[e])===i[n]))return{first:o,last:s}}return null}function FL(e,t,n){return PL(e,t)?`ok`:t.some(t=>t.path===e.filePath)||n?`moved`:`unknown`}function IL(e){let[t,n]=(0,h.useState)(null),r=()=>{n(null),e.focusView()},i=async n=>{if(t){if(t.kind===`add`){let{target:r}=t;await e.client.request(`review.add`,{taskId:e.taskId,filePath:r.path,line:r.line,...r.startLine?{startLine:r.startLine}:{},code:NL(e.rows,r.first,r.last),body:n})}else await e.client.request(`review.edit`,{taskId:e.taskId,id:t.note.id,body:n}).catch(e=>{throw EL(e)});e.onSaved(t.kind===`add`),r()}};return{node:t&&(0,L.jsx)(LL,{location:t.kind===`add`?ML({filePath:t.target.path,startLine:t.target.startLine,line:t.target.line}):ML(t.note),...t.kind===`edit`?{initial:t.note.body}:{},onSubmit:i,onCancel:r}),row:t?t.kind===`add`?t.target.last:PL(t.note,e.rows)?.last??-1:null,editId:t?.kind===`edit`?t.note.id:void 0,add:()=>e.target&&n({kind:`add`,target:e.target}),edit:e=>n({kind:`edit`,note:e})}}function LL(e){let[t,n]=(0,h.useState)(e.initial??``),[r,i]=(0,h.useState)(!1),[a,o]=(0,h.useState)(null),s=e.initial!==void 0,c=t.trim(),l=async()=>{if(!(!c||r)){i(!0),o(null);try{await e.onSubmit(c)}catch(e){o(e instanceof Error?e.message:String(e)),i(!1)}}};return(0,L.jsxs)(`div`,{className:DI(`note`,{cursor:!1,noted:!1}),onKeyDown:e=>e.stopPropagation(),onMouseUp:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:[(0,L.jsx)(`span`,{className:kI}),(0,L.jsx)(`span`,{}),(0,L.jsx)(`span`,{className:`text-accent`,children:`●`}),(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5 whitespace-normal`,children:[(0,L.jsx)(`textarea`,{className:`${ln} ${Bn} font-mono`,"aria-label":F(s?`review.noteEditOn`:`review.noteOn`,{location:e.location}),autoFocus:!0,rows:3,value:t,disabled:r,onChange:e=>n(e.target.value),onFocus:e=>e.currentTarget.setSelectionRange(t.length,t.length),onKeyDown:t=>{t.key===`Enter`&&(t.ctrlKey||t.metaKey)?(t.preventDefault(),l()):t.key===`Escape`&&(t.preventDefault(),e.onCancel())}}),a&&(0,L.jsx)(`p`,{className:`m-0 text-error`,children:a}),(0,L.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,L.jsx)(R,{hit:`tight`,disabled:r||!c,onClick:()=>void l(),children:F(s?`review.noteSave`:`review.noteAdd`)}),(0,L.jsx)(R,{hit:`tight`,className:`text-muted`,disabled:r,onClick:e.onCancel,children:F(`review.noteCancel`)})]})]})]})}function RL({notes:e,states:t,sending:n,onShow:r,onEdit:i,onDrop:a,onSend:o}){I();let[s,c]=(0,h.useState)(!1);if(e.length===0)return null;let l=e.length;return(0,L.jsxs)(`div`,{className:`flex max-h-2/5 min-h-0 flex-none flex-col border-t-hairline border-line font-mono text-meta`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-1.5 narrow:px-2`,children:[(0,L.jsxs)(R,{variant:`row`,className:`flex min-w-0 flex-1 items-center gap-2 text-left text-ink`,"aria-expanded":s,onClick:()=>c(!s),children:[(0,L.jsx)(fo,{right:!s}),(0,L.jsx)(`span`,{children:l===1?F(`review.countOne`):F(`review.count`,{count:l})})]}),(0,L.jsx)(R,{disabled:n,onClick:o,children:n?F(`review.sending`):F(`review.send`,{count:l})})]}),s&&(0,L.jsx)(`ul`,{className:`m-0 min-h-0 list-none overflow-y-auto p-0 pb-1`,children:e.map(e=>(0,L.jsxs)(`li`,{className:`flex flex-col gap-0.5 px-3 py-1 narrow:px-2`,children:[(0,L.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,L.jsx)(R,{variant:`row`,className:`min-w-0 flex-1 truncate text-left text-ink hover:underline`,title:F(`review.show`),onClick:()=>r(e),children:ML(e)}),t.get(e.id)===`moved`&&(0,L.jsx)(`span`,{title:F(`review.movedHint`),children:(0,L.jsx)(ow,{tone:`warning`,children:F(`review.moved`)})}),(0,L.jsx)(R,{hit:`tight`,onClick:()=>i(e),children:F(`review.edit`)}),(0,L.jsx)(R,{hit:`tight`,onClick:()=>a(e),children:F(`review.drop`)})]}),(0,L.jsx)(`p`,{className:`m-0 line-clamp-2 whitespace-pre-wrap wrap-anywhere text-muted`,children:e.body})]},e.id))})]})}var zL=[];function BL({model:e,view:t,active:n,restored:r,onClose:i}){I();let a=cl(),[o,s]=(0,h.useState)(QI),[c,l]=(0,h.useState)(KI),[u,d]=wI(t),f=t.scope===`task`?u:null,p=f!==null,m=t.file===!0,g={taskId:t.taskId,path:t.path,scope:t.scope,...m?{content:!0}:{},...o?{ignoreWhitespace:!0}:{},...f?{base:f}:{}},v=DL(e,t.taskId),y={...g,taskId:v},[b,x]=(0,h.useState)(()=>{let n=J(e,`diff.file`,y);return n===void 0?null:TL(n,t.path,p)}),[S,C]=(0,h.useState)(()=>J(e,`review.list`,{taskId:t.taskId})?.notes??[]),[w,T]=(0,h.useState)(()=>J(e,`diff.files`,{taskId:v})),[E,D]=(0,h.useState)(0),[O,k]=(0,h.useState)(null),[ee,A]=(0,h.useState)(!1),[te,ne]=(0,h.useState)(new Map),[j,re]=(0,h.useState)(!1),[M,N]=(0,h.useState)(0),ie=(0,h.useRef)(null),ae=e.client,oe=_(ae.conn).state;(0,h.useEffect)(()=>{let e=!0;return ae.request(`diff.file`,g).then(n=>e&&x(TL(Y(ae,`diff.file`,y,n),t.path,p)),t=>{if(e){if(f&&t instanceof pd&&t.code===`BAD_REF`){d(null),H(t.message,`error`);return}x({kind:`text`,text:dF(t),error:!0})}}),()=>{e=!1}},[ae,t.taskId,t.path,t.scope,o,f,M,oe]),(0,h.useEffect)(()=>{let e=!0;return ae.request(`diff.files`,{taskId:t.taskId}).then(t=>e&&T(Y(ae,`diff.files`,{taskId:v},t)),()=>{}),()=>{e=!1}},[ae,t.taskId,M]);let se=()=>void X(ae,`review.list`,{taskId:t.taskId}).then(e=>C(e.notes));(0,h.useEffect)(se,[ae,t.taskId,M]);let ce=(0,h.useRef)(!1);(0,h.useEffect)(()=>{n&&(ce.current||!r)&&ie.current?.focus(),ce.current=!0},[n,r]);let P=b?.kind===`rows`?b.rows:zL,le=b?.kind===`rows`&&b.diff,ue=w?.base??null,de=t.path!==`.`&&t.scope===`working`&&eF(w?.files??[],t.path),fe=uL(ae,t.taskId,t.path,m&&de&&!le,M),pe=(0,h.useMemo)(()=>P.map((e,t)=>`row-${t}`),[P]),me=(0,h.useMemo)(()=>cL(P),[P]),he=(0,h.useMemo)(()=>GI(P),[P]),ge=(0,h.useMemo)(()=>JI(c,t.taskId,he),[c,t.taskId,he]),_e=(0,h.useMemo)(()=>{let e=new Set;for(let t of he.keys())(te.get(t)??(yL(t)||ge.has(t)))&&e.add(t);return e},[he,ge,te]),ve=(e,t)=>ne(n=>{let r=new Map(n);for(let n of e)r.set(n,t);return r}),ye=(0,h.useMemo)(()=>sL(P,_e),[P,_e]),be=(0,h.useMemo)(()=>S.filter(e=>e.sentAt===void 0),[S]),xe=(0,h.useMemo)(()=>be.map(e=>({note:e,at:PL(e,P)})),[be,P]),Se=(0,h.useMemo)(()=>{let e=new Set;for(let{at:t}of xe)if(t)for(let n=t.first;n<=t.last;n++)e.add(n);return e},[xe]),Ce=(0,h.useMemo)(()=>{let e=new Map;for(let{note:t,at:n}of xe)n&&e.set(n.last,[...e.get(n.last)??[],t]);return e},[xe]),we=t.path===`.`&&b!==null&&!(b.kind===`text`&&b.error),Te=(0,h.useMemo)(()=>{let e=new Map;for(let{note:t}of xe)e.set(t.id,FL(t,P,we));return e},[xe,P,we]);(0,h.useEffect)(()=>{if(ye.includes(E))return;let e=E;for(;e>0&&P[e]?.kind!==`file`;)e--;D(e),k(null)},[ye,E,P]);let Ee=(0,h.useRef)(!1);(0,h.useEffect)(()=>{if(!Ee.current){Ee.current=!0;return}ie.current?.querySelector(`[data-row="${E}"]`)?.scrollIntoView({block:`nearest`})},[E]);let De=oL(P,E,O),Oe=e=>ve([e],!_e.has(e)),ke=[...me.keys()].flatMap(e=>P[e]?.path?[P[e]?.path]:[]),Ae=(0,h.useMemo)(()=>wL(me,P),[me,P]),je=ke.length>0&&ke.every(e=>_e.has(e)),Me=[...me.values()].reduce((e,t)=>({added:e.added+t.added,removed:e.removed+t.removed}),{added:0,removed:0}),Ne=e=>{let n=YI(c,t.taskId,e,ge.has(e)?void 0:he.get(e));l(n),qI(n),ne(t=>{let n=new Map(t);return n.delete(e),n})},Pe=()=>{$I(!o),s(!o)},Fe=IL({client:ae,taskId:t.taskId,rows:P,target:De,onSaved:e=>{e&&(k(null),A(!1)),se()},focusView:()=>ie.current?.focus()}),Ie=e=>{Be(e),(t.path===`.`||t.path===e.filePath)&&Fe.edit(e)},Le=e=>void ae.request(`review.remove`,{taskId:t.taskId,id:e.id}).then(se).catch(e=>H(EL(e).message,`error`)),Re=_(xn),ze=()=>{let e=aL(P,E,O);if(e){if(!Re?.startsWith(`${t.taskId}::`)){H(F(`files.mentionNoEngine`),`error`);return}ae.request(`term.input`,{stream:Re,data:iL(e)}).then(()=>{k(null),La(Re)?.focus()}).catch(e=>H(e instanceof Error?e.message:String(e),`error`))}},Be=e=>{let n=PL(e,P),r=P.findIndex(t=>t.kind===`file`&&t.path===e.filePath);n?(ve([e.filePath],!1),D(n.first)):t.path===`.`&&r>=0?D(r):t.path!==e.filePath&&t.path!==`.`&&Fs({taskId:t.taskId,path:e.filePath,scope:t.scope}),k(null),A(!1)},Ve=()=>{re(!0),ae.request(`review.send`,e.engineTarget(t.taskId)).then(e=>{H(e.delivered?F(`preview.sent`,{count:e.sent}):F(`preview.notSent`,{reason:e.reason??``}),e.delivered?`info`:`error`),se()}).catch(e=>H(e instanceof Error?e.message:String(e),`error`)).finally(()=>re(!1))},He=()=>{let e=XI([...me.keys()],E);e!==null&&(D(e),k(null),A(!1))},R=()=>{let e=XI(xe.flatMap(({at:e})=>e?[e.first]:[]).sort((e,t)=>e-t),E);if(e===null)return;let t=P[e]?.path;t&&ve([t],!1),D(e),k(null),A(!1)},Ue=e=>D(t=>{let n=Math.max(0,ye.indexOf(t));return ye[Math.min(ye.length-1,Math.max(0,n+e))]??t}),We=e=>{let t=e.key;if(t===`j`||t===`ArrowDown`)Ue(1);else if(t===`k`||t===`ArrowUp`)Ue(-1);else if(t===`v`)k(e=>e===null?E:null),A(!0);else if(t===`c`&&!e.ctrlKey)Fe.add();else if(t===`x`){let e=xe.find(({at:e})=>e&&E>=e.first&&E<=e.last);e&&Le(e.note)}else if(t===`s`)Ve();else if(t===`z`){let e=P[E]?.path;e&&le&&Oe(e)}else if(t===`r`)N(e=>e+1);else if(t===`q`||t===`Escape`)i();else if(e.ctrlKey&&!e.metaKey&&t.toLowerCase()===`c`&&!window.getSelection()?.toString())i();else return;e.preventDefault()},Ge=()=>{let e=window.getSelection();if(!e||e.isCollapsed)return;let t=e=>(e instanceof Element?e:e?.parentElement)?.closest(`[data-row]`),n=t(e.anchorNode),r=t(e.focusNode);!n||!r||(k(Number(n.dataset.row)),D(Number(r.dataset.row)),A(!0))},Ke=LI({rowClick:(e,t)=>{window.getSelection()?.isCollapsed!==!1&&(t.shiftKey?k(e=>e??E):(!a||O===null)&&k(null),D(e),A(!0))},fileClick:(e,t)=>{D(e),k(null),A(!1),t&&Oe(t)},viewedClick:Ne,editNote:Ie}),qe=O===null?E:Math.min(O,E),Je=O===null?E:Math.max(O,E);return(0,L.jsxs)(`div`,{className:`group/preview @container/preview flex min-h-0 min-w-0 flex-1 flex-col outline-none`,"data-file":m&&!le?``:void 0,tabIndex:0,ref:ie,onKeyDown:We,children:[de&&(0,L.jsx)(lL,{taskId:t.taskId,path:t.path,file:m}),le&&(0,L.jsx)(BI,{picker:ue!==null&&(0,L.jsx)(yI,{taskId:t.taskId,model:e,scope:t.scope,onScope:e=>Fs({taskId:t.taskId,path:t.path,scope:e}),base:ue,custom:u,onPick:d}),ignoreWs:o,onToggleWs:Pe,files:ke.length,shape:Ae,added:Me.added,removed:Me.removed,viewed:ge.size,allFolded:je,onFoldAll:()=>ve(ke,!je),onNextFile:He,onNextComment:xe.some(({at:e})=>e)?R:null}),(0,L.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto py-1.5 font-mono text-meta/normal`,onMouseUp:Ge,children:[!b&&(0,L.jsx)(`p`,{className:`mx-2.5 my-3 font-mono text-meta text-subtle`,children:F(`preview.loading`)}),b?.kind===`text`&&(0,L.jsx)(`p`,{className:`mx-2.5 my-3 font-mono text-meta text-subtle ${b.error?`text-error`:``}`,children:b.text}),ye.map(e=>{let t=P[e],n=e>=qe&&e<=Je;if(t.kind===`file`){let r=me.get(e),i=t.path;return(0,L.jsx)(PI,{index:e,name:t.text,path:i,closed:i!==null&&_e.has(i),viewed:i!==null&&ge.has(i),cursor:n,added:r?.added??0,removed:r?.removed??0,onToggleFold:Ke.fileClick,onToggleViewed:Ke.viewedClick},pe[e])}return(0,L.jsx)(zI,{index:e,row:t,cursor:n,noted:Se.has(e),actions:ee&&De&&!Fe.node&&e===Je&&(0,L.jsx)(FI,{showRange:a&&O===null,ranged:O!==null,onComment:Fe.add,onRange:()=>k(E),onAsk:ze}),notes:Ce.get(e),changed:t.newNo!==null&&fe?.has(t.newNo)===!0,composer:e===Fe.row?Fe.node:void 0,editId:e===Fe.row?Fe.editId:void 0,onClick:Ke.rowClick,onEditNote:Ke.editNote},pe[e])}),Fe.row===-1&&Fe.node]}),(0,L.jsx)(RL,{notes:be,states:Te,sending:j,onShow:Be,onEdit:Ie,onDrop:Le,onSend:Ve})]})}function VL(e){I();let{model:t,view:n}=e,r=n.path===`.`?null:gF(n.path),[i,a]=(0,h.useState)(null),o=_(t.tasks);if(!r)return(0,L.jsx)(BL,{...e});let s=i===n.path,c=JSON.stringify(o?.tasks.find(e=>e.id===n.taskId)?.changes??null);return(0,L.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,L.jsxs)(`div`,{className:`flex gap-x-3 px-2.5 py-1`,children:[(0,L.jsx)(R,{variant:`pill`,hit:`tight`,"aria-current":!s,onClick:()=>a(null),children:`[ ${F(`artifact.preview`)} ]`}),(0,L.jsx)(R,{variant:`pill`,hit:`tight`,"aria-current":s,onClick:()=>a(n.path),children:`[ ${F(`artifact.source`)} ]`})]}),s?(0,L.jsx)(BL,{...e}):(0,L.jsx)(gI,{model:t,taskId:n.taskId,path:n.path,kind:r,changeKey:c})]})}var HL={entries:[],failed:new Set},UL=[`command`,`cmd`,`file_path`,`path`,`pattern`,`query`,`url`,`description`,`prompt`],WL=100;function GL(e){let t=(e.split(`
52
- `).find(e=>e.trim()!==``)??``).trim();return t.length>WL?`${t.slice(0,99)}…`:t}function KL(e){if(typeof e==`string`)return GL(e);if(!e||typeof e!=`object`)return``;let t=e,n=e=>typeof e==`string`?e:Array.isArray(e)&&e.every(e=>typeof e==`string`)?e.join(` `):``;for(let e of UL){let r=n(t[e]);if(r.trim())return GL(r)}for(let e of Object.values(t)){let t=n(e);if(t.trim())return GL(t)}return``}function qL(e){return e===`user`||e===`assistant`||e===`system`?e:null}function JL(e,t){let n=[],r=[];return e.forEach((e,i)=>{let a=qL(e.role);if(!a)return;let o=[],s=[];for(let t of e.blocks??[])t.type===`text`&&t.text?.trim()?o.push(t.text.trim()):t.type===`tool_call`?s.push({callId:t.callId??``,name:t.name??`tool`,summary:KL(t.input)}):t.type===`tool_result`&&t.isError&&t.callId&&r.push(t.callId);(o.length!==0||s.length!==0)&&n.push({index:t+i,role:a,at:e.timestamp??``,text:o.join(`
44
+ `),n=[],r=[],i=()=>{r.length>0&&n.push({t:`para`,c:AF(r.join(`
45
+ `))}),r=[]};for(let e=0;e<t.length;e++){let a=t[e],o=jF.exec(a);if(o){i();let r=o[1][0],a=[];for(e++;e<t.length&&!RegExp(`^\\s*${r}{3,}\\s*$`).test(t[e]);e++)a.push(t[e]);n.push({t:`code`,lang:o[2]??``,v:a.join(`
46
+ `)});continue}if(a.trim()===``){i();continue}let s=MF.exec(a);if(s){i(),n.push({t:`heading`,level:s[1].length,c:AF(s[2])});continue}if(FF.test(a)){i(),n.push({t:`hr`});continue}if(IF.test(a)){i();let r=[];for(;e<t.length&&IF.test(t[e]);e++){let n=t[e];LF.test(n)||r.push(RF(n))}e--,n.push({t:`table`,rows:r.map(e=>e.map(e=>AF(e)))});continue}if(a.startsWith(`>`)){i();let r=[];for(;e<t.length&&t[e].startsWith(`>`);e++)r.push(t[e].replace(/^>\s?/,``));e--,n.push({t:`quote`,c:AF(r.join(`
47
+ `))});continue}let c=NF.exec(a),l=c?null:PF.exec(a);if(c||l){i();let r=!c,a=[];for(;e<t.length;e++){let n=r?PF.exec(t[e]):NF.exec(t[e]);if(!n)break;let i=n[1].length;a.push({depth:Math.min(3,Math.floor(i/2)),c:AF(r?n[2]:n[3])})}e--,n.push({t:`list`,ordered:r,items:a});continue}r.push(a)}return i(),n}var BF=`flex min-h-0 min-w-0 flex-1 flex-col font-sans text-body`,VF=`flex flex-none flex-wrap items-center gap-x-3 gap-y-1 px-3 pb-1.5 font-mono text-meta`,HF=`min-w-0 flex-1 basis-32 py-1 text-meta`,UF=`min-h-0 flex-1 overflow-y-auto px-3 pb-3`,WF=`m-0 px-3 py-2 font-mono text-meta text-subtle`,GF=`m-0 whitespace-pre-wrap px-3 pb-3 font-mono text-meta leading-[1.45] text-muted wrap-anywhere`,KF=e=>`group/entry mt-3 rounded-sm border-l-2 py-0.5 pl-2.5 ${e.flash?`border-accent bg-accent-soft`:e.current?`border-line-active`:`border-transparent`}`,qF=`mb-0.5 flex items-center gap-2 font-mono text-meta`,JF=e=>e===`user`?`text-accent`:`text-muted`,YF=`text-subtle`,XF=`ml-auto opacity-0 group-hover/entry:opacity-100 focus-visible:opacity-100 touch:opacity-100`,ZF=`m-0 mt-0.5 flex min-w-0 items-baseline gap-1.5 font-mono text-meta text-subtle`,QF=`flex-none text-muted`,$F=`min-w-0 flex-1 truncate`,eI=`leading-[1.5] wrap-anywhere`,tI=`m-0 mb-2 whitespace-pre-wrap last:mb-0`,nI=`m-0 mt-3 mb-1.5 font-semibold first:mt-0`,rI=`m-0 mb-2 flex flex-col gap-0.5 pl-5 last:mb-0`,iI=`m-0 mb-2 border-l-2 border-line pl-2.5 whitespace-pre-wrap text-muted last:mb-0`,aI=`m-0 mb-2 overflow-x-auto rounded-sm border-hairline border-line bg-inset px-2.5 py-2 font-mono text-meta leading-[1.45] last:mb-0`,oI=`rounded-xs bg-inset px-1 font-mono text-meta`,sI=`text-accent underline`,cI=`mb-2 block max-w-full overflow-x-auto border-collapse font-mono text-meta last:mb-0`,lI=`border-hairline border-line px-2 py-0.5 text-left align-top`,uI=`my-2 border-0 border-t border-line`;function dI(e,t){let n=t.trim().toLowerCase();if(!n)return e;let r=e.toLowerCase(),i=[],a=0;for(let t=r.indexOf(n);t>=0;t=r.indexOf(n,a))t>a&&i.push(e.slice(a,t)),i.push((0,L.jsx)(`mark`,{className:Dg,"data-hit":``,children:e.slice(t,t+n.length)},t)),a=t+n.length;return i.push(e.slice(a)),h.Children.toArray(i)}var fI=[`h3`,`h3`,`h4`,`h5`,`h6`,`h6`];function pI({level:e,children:t}){let n=fI[Math.min(5,Math.max(0,e-1))]??`h6`;return(0,L.jsx)(n,{className:nI,children:t})}function mI(e,t){return e.map((e,n)=>(0,L.jsx)(h.Fragment,{children:t(e)},n))}function hI({nodes:e,needle:t}){return mI(e,e=>e.t===`text`?dI(e.v,t):e.t===`code`?(0,L.jsx)(`code`,{className:oI,children:dI(e.v,t)}):e.t===`bold`?(0,L.jsx)(`strong`,{children:(0,L.jsx)(hI,{nodes:e.c,needle:t})}):e.t===`em`?(0,L.jsx)(`em`,{children:(0,L.jsx)(hI,{nodes:e.c,needle:t})}):(0,L.jsx)(`a`,{className:sI,href:e.href,target:`_blank`,rel:`noopener noreferrer`,children:(0,L.jsx)(hI,{nodes:e.c,needle:t})}))}function gI({block:e,needle:t}){switch(e.t){case`heading`:return(0,L.jsx)(pI,{level:e.level,children:(0,L.jsx)(hI,{nodes:e.c,needle:t})});case`para`:return(0,L.jsx)(`p`,{className:tI,children:(0,L.jsx)(hI,{nodes:e.c,needle:t})});case`code`:return(0,L.jsx)(`pre`,{className:aI,children:(0,L.jsx)(`code`,{children:dI(e.v,t)})});case`quote`:return(0,L.jsx)(`blockquote`,{className:iI,children:(0,L.jsx)(hI,{nodes:e.c,needle:t})});case`hr`:return(0,L.jsx)(`hr`,{className:uI});case`list`:{let n=e.ordered?`ol`:`ul`;return(0,L.jsx)(n,{className:`${rI} ${e.ordered?`list-decimal`:`list-disc`}`,children:mI(e.items,e=>(0,L.jsx)(`li`,{style:{marginLeft:`${e.depth*1.25}rem`},children:(0,L.jsx)(hI,{nodes:e.c,needle:t})}))})}case`table`:return(0,L.jsx)(`table`,{className:cI,children:(0,L.jsx)(`tbody`,{children:mI(e.rows,e=>(0,L.jsx)(`tr`,{children:mI(e,e=>(0,L.jsx)(`td`,{className:lI,children:(0,L.jsx)(hI,{nodes:e,needle:t})}))}))})})}}function _I({source:e,needle:t=``}){let n=(0,h.useMemo)(()=>zF(e),[e]);return(0,L.jsx)(`div`,{className:eI,children:mI(n,e=>(0,L.jsx)(gI,{block:e,needle:t}))})}function vI(e){if(e instanceof pd){if(e.code===`TOO_LARGE`){let t=e.detail?.size;return $(F(`artifact.tooLarge`),{size:typeof t==`number`?`${(t/1048576).toFixed(1)} MB`:`5 MB+`})}if(e.code===`NOT_PREVIEWABLE`)return F(`artifact.notPreviewable`);if(e.code===`NOT_FOUND`)return F(`artifact.gone`)}return $(F(`artifact.failed`),{error:e instanceof Error?e.message:String(e)})}function yI(e,t,n,r){let[i,a]=(0,h.useState)({kind:`loading`});return(0,h.useEffect)(()=>{let r=!0;return e.client.request(`file.read`,{taskId:t,path:n}).then(e=>r&&a({kind:`ready`,file:e}),e=>r&&a({kind:`failed`,text:vI(e)})),()=>{r=!1}},[e,t,n,r]),i}function bI(e,t){let n=(0,h.useMemo)(()=>e===null?null:URL.createObjectURL(new Blob([SF(e)],{type:t})),[e,t]);return(0,h.useEffect)(()=>()=>void(n&&URL.revokeObjectURL(n)),[n]),n}function xI({model:e,taskId:t,path:n,kind:r,changeKey:i}){I();let a=yI(e,t,n,i),o=bI(a.kind===`ready`&&(r===`svg`||r===`image`||r===`pdf`)?a.file.base64:null,r===`md`||r===`html`?``:wF(r,n));return a.kind===`loading`?(0,L.jsx)(`p`,{className:en,children:F(`artifact.loading`)}):a.kind===`failed`?(0,L.jsx)(`p`,{className:`${en} text-error`,children:a.text}):r===`md`?(0,L.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto px-3 py-2`,children:(0,L.jsx)(_I,{source:CF(a.file.base64)})}):r===`html`?(0,L.jsx)(`iframe`,{title:n,sandbox:``,srcDoc:EF(CF(a.file.base64)),style:{colorScheme:`light`,background:`#fff`},className:`min-h-0 w-full flex-1 border-none`}):o?r===`pdf`?(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,L.jsx)(`a`,{className:`${sn} px-3 py-1 font-mono text-meta`,href:o,target:`_blank`,rel:`noreferrer noopener`,children:F(`artifact.open`)}),(0,L.jsx)(`iframe`,{title:n,src:o,className:`min-h-0 w-full flex-1 border-none`})]}):(0,L.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:(0,L.jsx)(`img`,{src:o,alt:n,className:`max-w-full`})}):null}function SI(e){let[t,n]=(0,h.useState)(0),r=e.open&&e.items.length>0,i=Math.min(t,Math.max(0,e.items.length-1)),a=(0,h.useRef)(null),{onCursor:o}=e;return(0,h.useEffect)(()=>o?.(i),[i,o]),(0,h.useEffect)(()=>{a.current?.scrollIntoView({block:`nearest`})},[i,e.items]),(0,L.jsxs)(`div`,{className:`relative`,children:[(0,L.jsx)(`input`,{className:ln,"data-field":e.field,spellCheck:!1,autoComplete:`off`,autoFocus:e.autoFocus,placeholder:e.placeholder,value:e.value,onChange:t=>{n(0),e.onChange(t.target.value.replace(/[\r\n]+/g,``))},onKeyDown:t=>{if(!t.nativeEvent.isComposing){if(t.key===`ArrowDown`||t.key===`ArrowUp`){if(!r)return;t.preventDefault(),n(Math.max(0,Math.min(e.items.length-1,i+(t.key===`ArrowDown`?1:-1))))}else t.key===`Tab`&&!t.shiftKey&&r&&e.onComplete?.(i)?(t.preventDefault(),n(0)):t.key===`Enter`&&!t.ctrlKey&&!t.metaKey&&(t.preventDefault(),r?((e.onEnterRow??e.onPick)(i),n(0)):e.onEnter?.())}}}),r&&(0,L.jsx)(`ul`,{className:`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`,children:e.items.map((t,n)=>(0,L.jsx)(`li`,{ref:n===i?a:void 0,children:(0,L.jsxs)(`button`,{type:`button`,tabIndex:-1,"aria-pressed":n===i,className:on({cursor:n===i,accent:!!t.accent}),onMouseDown:t=>{t.preventDefault(),e.onPick(n)},children:[(0,L.jsx)(`span`,{children:t.text}),t.dim&&(0,L.jsxs)(`span`,{className:`text-muted`,children:[` `,t.dim]})]})},t.key))})]})}function CI(e,t,n){let r=[{ref:null,suggestion:{key:`default`,text:t,dim:F(`review.baseDefault`),accent:!0}}],i=(e,n)=>{for(let i of e)i!==t&&r.push({ref:i,suggestion:{key:`${n}:${i}`,text:i,dim:n}})};i(e?.branches??[],F(`review.baseBranch`)),i(e?.remotes??[],F(`review.baseRemote`)),i(e?.tags??[],F(`review.baseTag`));for(let t of e?.commits??[])r.push({ref:t.sha,suggestion:{key:`commit:${t.sha}`,text:t.sha,dim:t.subject}});let a=n.trim().toLowerCase();if(a===``)return r.slice(0,40);let o=r.filter(e=>`${e.suggestion.text} ${e.suggestion.dim??``}`.toLowerCase().includes(a)),s=e=>e.suggestion.text.toLowerCase()===a?0:1;return o.sort((e,t)=>s(e)-s(t)).slice(0,40)}function wI(e){let[t,n]=(0,h.useState)(!1),[r,i]=(0,h.useState)(``),[a,o]=(0,h.useState)(null),s=e.model.client;(0,h.useEffect)(()=>{if(!t)return;let n=!0;return X(s,`diff.refs`,{taskId:e.taskId}).then(e=>n&&o(e),()=>{}),()=>{n=!1}},[t,s,e.taskId]);let c=CI(a,e.base,r),l=t=>{e.onPick(t),n(!1),i(``)},u=e.custom??e.base,d=[{id:`task`,label:F(`review.scopeTask`)},{id:`working`,label:F(`review.scopeWorking`)},{id:`branch`,label:F(`review.scopeBranch`)}],f=d.find(t=>t.id===e.scope)?.label??``;return(0,L.jsxs)(`span`,{className:`relative`,onKeyDown:e=>{e.stopPropagation(),e.key===`Escape`&&t&&n(!1)},children:[(0,L.jsx)(R,{hit:`tight`,"aria-expanded":t,"aria-haspopup":`menu`,onClick:t=>{let r=t.currentTarget.getBoundingClientRect();mn.set({x:r.left,y:r.bottom+2,target:t.currentTarget,items:[...d.map(t=>({label:t.label,section:`scope`,checked:t.id===e.scope,run:()=>e.onScope(t.id)})),{label:F(`review.compareAgainst`,{base:u}),section:`base`,run:()=>n(!0)}]})},children:F(`review.scopeMenu`,{base:u,scope:f})}),t&&(0,L.jsx)(`div`,{className:`absolute top-full left-0 z-3 mt-1 w-64 max-w-full rounded-sm border-hairline border-line-active bg-surface p-1 shadow-popover`,children:(0,L.jsx)(SI,{field:`diff-base`,autoFocus:!0,value:r,onChange:i,items:c.map(e=>e.suggestion),open:!0,placeholder:F(`review.basePlaceholder`),onPick:e=>l(c[e]?.ref??null),onEnter:()=>l(r.trim()===``?null:r.trim())})})]})}var TI=`rove.diffBase`;function EI(){try{let e=JSON.parse(localStorage.getItem(TI)??`{}`);return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`string`))}catch{return{}}}function DI(e){return EI()[e]??null}function OI(e,t){let n=EI();t===null?delete n[e]:n[e]=t;try{localStorage.setItem(TI,JSON.stringify(n))}catch{}}function kI(e){let[t,n]=(0,h.useState)(()=>DI(e.taskId));return[t,t=>{OI(e.taskId,t),n(t),t!==null&&e.scope!==`task`&&Fs({taskId:e.taskId,path:e.path,scope:`task`})}]}var AI={add:`bg-diff-added-bg`,del:`bg-diff-removed-bg`},jI={add:`text-diff-added`,del:`text-diff-removed`};function MI(e,t){let n=t.cursor?`bg-inset group-focus/preview:bg-accent-soft`:t.noted?`bg-inset`:AI[e]??``;return`relative grid ${e===`file`||e===`note`?`cursor-pointer`:`cursor-default`} grid-cols-[4ch_4ch_2ch_minmax(0,1fr)] gap-x-2 gap-y-0 whitespace-pre px-3 group-data-file/preview:grid-cols-[4ch_1ch_minmax(0,1fr)] @max-md/preview:grid-cols-[3ch_3ch_1ch_minmax(0,1fr)] @max-md/preview:gap-x-1 @max-md/preview:px-1.5 @max-md/preview:group-data-file/preview:grid-cols-[3ch_1ch_minmax(0,1fr)] ${n} ${e===`file`?`mt-2 border-t-hairline border-line pt-1 font-bold text-ink`:e===`hunk`||e===`meta`?`text-subtle`:``}`}var NI=`text-right text-subtle`,PI=`${NI} group-data-file/preview:hidden`,FI=(e,t,n=!1)=>t?`text-accent`:n?`text-diff-added`:jI[e]??``,II=e=>`min-w-0 whitespace-pre-wrap wrap-anywhere ${jI[e]??``}`,LI=`min-w-0 whitespace-pre-wrap wrap-anywhere text-accent`,RI=`col-span-3 flex min-w-0 items-baseline gap-2 overflow-hidden`,zI=(0,h.memo)(function(e){return(0,L.jsxs)(`div`,{className:`flex items-center ${e.viewed?`opacity-60`:``}`,children:[(0,L.jsxs)(R,{variant:`row`,"data-row":e.index,"aria-expanded":!e.closed,"aria-label":F(e.closed?`review.unfold`:`review.fold`,{path:e.name}),className:`${MI(`file`,{cursor:e.cursor,noted:!1})} min-w-0 flex-1 text-left`,onClick:()=>e.onToggleFold(e.index,e.path),children:[(0,L.jsx)(`span`,{className:`grid place-items-center text-subtle`,children:(0,L.jsx)(fo,{right:e.closed})}),(0,L.jsxs)(`span`,{className:RI,children:[(0,L.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name}),e.added?(0,L.jsxs)(Lw,{tone:`added`,children:[`+`,e.added]}):null,e.removed?(0,L.jsxs)(Lw,{tone:`removed`,children:[`−`,e.removed]}):null]})]}),e.path!==null&&(0,L.jsx)(R,{hit:`tight`,className:`flex-none px-2`,"aria-pressed":e.viewed,"aria-label":F(e.viewed?`review.unmarkViewed`:`review.markViewed`,{path:e.name}),onClick:()=>e.path!==null&&e.onToggleViewed(e.path),children:e.viewed?F(`review.viewedOn`):F(`review.viewed`)})]})});function BI(e){return(0,L.jsxs)(`div`,{className:`absolute top-full right-3 z-1 flex gap-1.5`,children:[(0,L.jsx)(R,{variant:`floating`,onMouseDown:e=>e.preventDefault(),onClick:t=>{t.stopPropagation(),e.onComment()},children:F(`review.comment`)}),e.showRange&&(0,L.jsx)(R,{variant:`floating`,onClick:t=>{t.stopPropagation(),e.onRange()},children:F(`review.range`)}),e.ranged&&(0,L.jsx)(R,{variant:`floating`,title:F(`preview.askInChatHint`),onMouseDown:e=>e.preventDefault(),onClick:t=>{t.stopPropagation(),e.onAsk()},children:F(`preview.askInChat`)})]})}function VI({note:e,onEdit:t}){return(0,L.jsxs)(R,{variant:`row`,className:`${MI(`note`,{cursor:!1,noted:!1})} w-full text-left`,onClick:t,children:[(0,L.jsx)(`span`,{className:PI}),(0,L.jsx)(`span`,{}),(0,L.jsx)(`span`,{className:`text-accent`,children:`●`}),(0,L.jsx)(`span`,{className:LI,children:e.body})]})}function HI(e){let t=(0,h.useRef)(e);return t.current=e,(0,h.useMemo)(()=>({rowClick:(e,n)=>t.current.rowClick(e,n),fileClick:(e,n)=>t.current.fileClick(e,n),viewedClick:e=>t.current.viewedClick(e),editNote:e=>t.current.editNote(e)}),[])}var UI=2e3,WI=(0,h.memo)(function(e){let{index:t,row:n,noted:r}=e;return(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{"data-row":t,className:MI(n.kind,{cursor:e.cursor,noted:r}),onClick:n=>e.onClick(t,n),children:[(0,L.jsx)(`span`,{className:PI,children:n.oldNo??``}),(0,L.jsx)(`span`,{className:NI,children:n.newNo??``}),(0,L.jsx)(`span`,{className:FI(n.kind,r,e.changed),children:n.kind===`add`?`+`:n.kind===`del`?`−`:r?`●`:e.changed?`▎`:` `}),(0,L.jsxs)(`span`,{className:II(n.kind),children:[n.text.length>UI?n.text.slice(0,UI):n.text,n.text.length>UI&&(0,L.jsxs)(`span`,{className:`text-subtle`,children:[` `,F(`review.lineClipped`,{count:(n.text.length-UI).toLocaleString()})]})]}),e.actions]}),e.notes?.map(t=>t.id===e.editId?(0,L.jsx)(h.Fragment,{children:e.composer},t.id):(0,L.jsx)(VI,{note:t,onEdit:()=>e.onEditNote(t)},t.id)),e.editId===void 0&&e.composer]})});function GI(e){return(0,L.jsxs)(`div`,{className:`flex flex-none flex-wrap items-center gap-x-3 gap-y-1 px-2 pt-1.5 font-mono text-meta`,children:[e.picker,(0,L.jsx)(R,{hit:`tight`,"aria-pressed":e.ignoreWs,title:F(`review.ignoreWsHint`),className:`opacity-60 aria-pressed:underline aria-pressed:opacity-100`,onClick:e.onToggleWs,children:F(`review.ignoreWs`)}),(0,L.jsxs)(`span`,{className:`flex min-w-0 basis-full flex-wrap items-center gap-x-1.5 text-muted`,children:[F(`review.totals`,{files:e.files,added:e.added,removed:e.removed}),e.shape&&(0,L.jsxs)(`span`,{children:[`· `,e.shape]}),e.files>0&&(0,L.jsxs)(`span`,{className:`whitespace-nowrap`,children:[`· `,F(`review.viewedCount`,{done:e.viewed,files:e.files})]})]}),(0,L.jsxs)(`span`,{className:`ml-auto flex items-center gap-x-3`,children:[e.files>1&&(0,L.jsx)(R,{hit:`tight`,onClick:e.onNextFile,children:F(`review.nextFile`)}),e.onNextComment&&(0,L.jsx)(R,{hit:`tight`,onClick:e.onNextComment,children:F(`review.nextComment`)}),e.files>1&&(0,L.jsx)(R,{hit:`tight`,onClick:e.onFoldAll,children:e.allFolded?F(`review.unfoldAll`):F(`review.foldAll`)})]})]})}var KI=`rove.diffViewed`,qI=(e,t)=>`${e}\0${t}`,JI=4096;function YI(e){let t=2166136261;for(let n of e){let e=n.text.length>JI?`${n.text.slice(0,JI/2)}${n.text.length}${n.text.slice(-2048)}`:n.text,r=`${n.kind}${e}\n`;for(let e=0;e<r.length;e++)t=Math.imul(t^r.charCodeAt(e),16777619)}return(t>>>0).toString(16)}function XI(e){let t=new Map,n=-1,r=r=>{let i=n>=0?e[n]?.path:null;i&&t.set(i,YI(e.slice(n+1,r)))};return e.forEach((e,t)=>{e.kind===`file`&&(r(t),n=t)}),r(e.length),t}function ZI(){try{let e=JSON.parse(localStorage.getItem(KI)??`{}`);return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`string`))}catch{return{}}}function QI(e){try{localStorage.setItem(KI,JSON.stringify(e))}catch{}}function $I(e,t,n){let r=new Set;for(let[i,a]of n)e[qI(t,i)]===a&&r.add(i);return r}function eL(e,t,n,r){let i={...e};return r===void 0?delete i[qI(t,n)]:i[qI(t,n)]=r,i}function tL(e,t){return e.find(e=>e>t)??e[0]??null}var nL=`rove.diffIgnoreWs`;function rL(){try{return localStorage.getItem(nL)===`1`}catch{return!1}}function iL(e){try{localStorage.setItem(nL,e?`1`:`0`)}catch{}}var aL=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/;function oL(e,t=null,n=!1){let r=[],i=0,a=0,o=t,s=!1;for(let t of e.replace(/\n$/,``).split(`
48
+ `)){if(t.startsWith(`diff --git `)){let e=/ b\/(.+)$/.exec(t);o=e?e[1]:o,s=!1,r.push({kind:`file`,text:o??t,oldNo:null,newNo:null,path:o});continue}let e=aL.exec(t);if(e){i=Number(e[1]),a=Number(e[2]),s=!0,r.push({kind:`hunk`,text:t,oldNo:null,newNo:null,path:o});continue}if(!s){r.push({kind:`meta`,text:t,oldNo:null,newNo:null,path:o});continue}t.startsWith(`+`)?r.push({kind:`add`,text:t.slice(1),oldNo:null,newNo:a++,path:o}):t.startsWith(`-`)?r.push({kind:`del`,text:t.slice(1),oldNo:i++,newNo:null,path:o,...n?{foreignOld:!0}:{}}):t.startsWith(`\\`)?r.push({kind:`meta`,text:t,oldNo:null,newNo:null,path:o}):r.push({kind:`ctx`,text:t.slice(1),oldNo:i++,newNo:a++,path:o})}return r}function sL(e,t){return e.replace(/\n$/,``).split(`
49
+ `).map((e,n)=>({kind:`ctx`,text:e,oldNo:null,newNo:n+1,path:t}))}function cL(e){return e.kind===`del`?e.foreignOld?null:e.oldNo:e.kind===`add`||e.kind===`ctx`?e.newNo:null}function lL(e){let t=e.startLine?`lines ${e.startLine}-${e.line}`:`line ${e.line}`;return`@${e.path} (${t}) `}function uL(e,t,n){let r=e[t],i=r?cL(r):null;if(!r?.path||i===null)return null;if(n===null||n===t)return{path:r.path,line:i};let a=e[Math.min(n,t)],o=e[Math.max(n,t)],s=a?cL(a):null,c=o?cL(o):null;return s===null||c===null||a?.path!==o?.path?{path:r.path,line:i}:s===c?{path:r.path,line:c}:{path:r.path,startLine:Math.min(s,c),line:Math.max(s,c)}}function dL(e,t,n){let r=uL(e,t,n);if(!r)return null;let i=r.startLine!==void 0&&n!==null;return{...r,first:i?Math.min(n,t):t,last:i?Math.max(n,t):t}}function fL(e,t){let n=[],r=!1;return e.forEach((e,i)=>{e.kind===`file`&&(r=e.path!==null&&t.has(e.path)),(!r||e.kind===`file`)&&n.push(i)}),n}function pL(e){let t=new Map,n=-1;return e.forEach((e,r)=>{if(e.kind===`file`){n=r,t.set(r,{added:0,removed:0});return}let i=t.get(n);i&&(e.kind===`add`?i.added++:e.kind===`del`&&i.removed++)}),t}function mL(e){return(0,L.jsx)(`div`,{className:`flex flex-none items-center gap-3 px-2 pt-1.5 font-mono text-meta`,children:(0,L.jsx)(R,{hit:`tight`,onClick:()=>e.file?Fs({taskId:e.taskId,path:e.path,scope:`working`}):Is(e.taskId,e.path),children:F(e.file?`preview.modeDiff`:`preview.modeFile`)})})}function hL(e,t,n,r,i){let[a,o]=(0,h.useState)(null);return(0,h.useEffect)(()=>{if(!r)return;let i=!0;return X(e,`diff.file`,{taskId:t,path:n,scope:`working`}).then(e=>{if(!i)return;let t=e.kind===`diff`&&typeof e.text==`string`?oL(e.text,n):[];o(new Set(t.flatMap(e=>e.kind===`add`&&e.newNo!==null?[e.newNo]:[])))},()=>i&&o(null)),()=>{i=!1}},[e,t,n,r,i]),r?a:null}var gL=[`source`,`tests`,`config`,`docs`,`generated`],_L=/(^|\/)(bun\.lockb?|package-lock\.json|yarn\.lock|pnpm-lock\.yaml|Cargo\.lock|poetry\.lock|uv\.lock|Gemfile\.lock|go\.sum|composer\.lock)$/,vL=/(^|\/)(dist|build|generated|__generated__|\.next)\/|\.min\.(js|css)$|\.snap$|\.generated\.|\.pb\.go$|\.map$/,yL=/(^|\/)(tests?|__tests__|spec|e2e)\/|\.(test|spec)\.[cm]?[jt]sx?$|_test\.(go|py)$|(^|\/)test_[^/]+\.py$/,bL=/\.(md|mdx|rst|txt)$|(^|\/)docs\//i,xL=/(^|\/)(\.[\w.-]+rc(\.\w+)?|[\w.-]*\.config\.[cm]?[jt]s|tsconfig[\w.-]*\.json|package\.json|biome\.json|Dockerfile|Makefile)$|\.(ya?ml|toml|ini|env)$|(^|\/)\.(github|changeset|vscode)\//,SL=e=>_L.test(e);function CL(e){return _L.test(e)||vL.test(e)?`generated`:yL.test(e)?`tests`:bL.test(e)?`docs`:xL.test(e)?`config`:`source`}var wL=e=>CL(e)===`generated`;function TL(e){let t=e.filter(e=>CL(e.path)!==`generated`),n=t.reduce((e,t)=>e+t.lines,0);return t.length===0?1:((e,t)=>e<=2&&t<=30?1:e<=5&&t<=150?2:e<=10&&t<=400?3:e<=20&&t<=1e3?4:5)(t.length,n)}function EL(e){let t=[],n=(e,n)=>n>0&&t.push({group:e,count:n});for(let t of gL)t===`generated`?(n(`lockfile`,e.filter(SL).length),n(`generated`,e.filter(e=>CL(e)===`generated`&&!SL(e)).length)):n(t,e.filter(e=>CL(e)===t).length);return t}function DL(e){let t=[];for(let n of e)(n.kind===`file`||t.length===0)&&t.push([]),t[t.length-1]?.push(n);let n=e=>gL.indexOf(CL(e[0]?.path??``));return t.map((e,t)=>({file:e,i:t})).sort((e,t)=>n(e.file)-n(t.file)||e.i-t.i).flatMap(({file:e})=>e)}function OL(e){return EL(e.map(e=>e.path)).map(({group:e,count:t})=>({key:e===`lockfile`?t===1?`lockfile`:`lockfiles`:e,count:t}))}function kL(e,t){let n=[...e.entries()].flatMap(([e,n])=>{let r=t[e]?.path;return r?[{path:r,lines:n.added+n.removed}]:[]});return n.length<2?``:[F(`review.shape.effort`,{n:TL(n)}),...OL(n).map(e=>F(`review.shape.${e.key}`,{count:e.count}))].join(` · `)}function AL(e,t,n){if(!e||typeof e!=`object`||!(`kind`in e))return{kind:`text`,text:F(`preview.unknown`)};let r=`text`in e&&typeof e.text==`string`?e.text:``;switch(e.kind){case`diff`:{let e=oL(r,t===`.`?null:t,n);return{kind:`rows`,rows:t===`.`?DL(e):e,diff:!0}}case`code`:return{kind:`rows`,rows:sL(r,t),diff:!1};case`binary`:return{kind:`text`,text:F(`preview.binary`)};case`empty`:return{kind:`text`,text:F(`preview.empty`)};case`error`:return{kind:`text`,text:`message`in e?String(e.message):F(`preview.unknown`),error:!0};default:return{kind:`text`,text:F(`preview.noHunks`,{kind:String(e.kind)})}}}function jL(e){return e instanceof pd&&e.code===`UNKNOWN_OP`?Error(F(`review.notSupported`)):e instanceof Error?e:Error(String(e))}function ML(e,t){let n=e.tasks.get()?.tasks.find(e=>e.id===t);return n?.workspace?`${n.machine?.id??``}:${n.workspace}`:t}var NL={add:`+`,del:`-`},PL=40,FL=160,IL=e=>`${NL[e.kind]??` `}${e.text.slice(0,FL)}`,LL=e=>e.startLine!==void 0&&e.startLine!==e.line?`${e.filePath}:${e.startLine}-${e.line}`:`${e.filePath}:${e.line}`;function RL(e,t,n){let r=[];for(let i=t;i<=n&&r.length<PL;i++){let t=e[i];t&&cL(t)!==null&&r.push(IL(t))}return r.join(`
50
+ `)}function zL(e,t){let n=e.startLine??e.line,r=t.flatMap((t,n)=>t.path===e.filePath&&cL(t)!==null?[n]:[]);if(!e.code){let i=r.filter(r=>{let i=cL(t[r]);return i>=n&&i<=e.line}),a=i[0],o=i[i.length-1];return a===void 0||o===void 0?null:{first:a,last:o}}let i=e.code.split(`
51
+ `);for(let e=0;e+i.length<=r.length;e++){let a=r.slice(e,e+i.length),o=a[0],s=a[a.length-1];if(o!==void 0&&s!==void 0&&cL(t[o])===n&&a.every((e,n)=>IL(t[e])===i[n]))return{first:o,last:s}}return null}function BL(e,t,n){return zL(e,t)?`ok`:t.some(t=>t.path===e.filePath)||n?`moved`:`unknown`}function VL(e){let[t,n]=(0,h.useState)(null),r=()=>{n(null),e.focusView()},i=async n=>{if(t){if(t.kind===`add`){let{target:r}=t;await e.client.request(`review.add`,{taskId:e.taskId,filePath:r.path,line:r.line,...r.startLine?{startLine:r.startLine}:{},code:RL(e.rows,r.first,r.last),body:n})}else await e.client.request(`review.edit`,{taskId:e.taskId,id:t.note.id,body:n}).catch(e=>{throw jL(e)});e.onSaved(t.kind===`add`),r()}};return{node:t&&(0,L.jsx)(HL,{location:t.kind===`add`?LL({filePath:t.target.path,startLine:t.target.startLine,line:t.target.line}):LL(t.note),...t.kind===`edit`?{initial:t.note.body}:{},onSubmit:i,onCancel:r}),row:t?t.kind===`add`?t.target.last:zL(t.note,e.rows)?.last??-1:null,editId:t?.kind===`edit`?t.note.id:void 0,add:()=>e.target&&n({kind:`add`,target:e.target}),edit:e=>n({kind:`edit`,note:e})}}function HL(e){let[t,n]=(0,h.useState)(e.initial??``),[r,i]=(0,h.useState)(!1),[a,o]=(0,h.useState)(null),s=e.initial!==void 0,c=t.trim(),l=async()=>{if(!(!c||r)){i(!0),o(null);try{await e.onSubmit(c)}catch(e){o(e instanceof Error?e.message:String(e)),i(!1)}}};return(0,L.jsxs)(`div`,{className:MI(`note`,{cursor:!1,noted:!1}),onKeyDown:e=>e.stopPropagation(),onMouseUp:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:[(0,L.jsx)(`span`,{className:PI}),(0,L.jsx)(`span`,{}),(0,L.jsx)(`span`,{className:`text-accent`,children:`●`}),(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5 whitespace-normal`,children:[(0,L.jsx)(`textarea`,{className:`${ln} ${Bn} font-mono`,"aria-label":F(s?`review.noteEditOn`:`review.noteOn`,{location:e.location}),autoFocus:!0,rows:3,value:t,disabled:r,onChange:e=>n(e.target.value),onFocus:e=>e.currentTarget.setSelectionRange(t.length,t.length),onKeyDown:t=>{t.key===`Enter`&&(t.ctrlKey||t.metaKey)?(t.preventDefault(),l()):t.key===`Escape`&&(t.preventDefault(),e.onCancel())}}),a&&(0,L.jsx)(`p`,{className:`m-0 text-error`,children:a}),(0,L.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,L.jsx)(R,{hit:`tight`,disabled:r||!c,onClick:()=>void l(),children:F(s?`review.noteSave`:`review.noteAdd`)}),(0,L.jsx)(R,{hit:`tight`,className:`text-muted`,disabled:r,onClick:e.onCancel,children:F(`review.noteCancel`)})]})]})]})}function UL({notes:e,states:t,sending:n,onShow:r,onEdit:i,onDrop:a,onSend:o}){I();let[s,c]=(0,h.useState)(!1);if(e.length===0)return null;let l=e.length;return(0,L.jsxs)(`div`,{className:`flex max-h-2/5 min-h-0 flex-none flex-col border-t-hairline border-line font-mono text-meta`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-1.5 narrow:px-2`,children:[(0,L.jsxs)(R,{variant:`row`,className:`flex min-w-0 flex-1 items-center gap-2 text-left text-ink`,"aria-expanded":s,onClick:()=>c(!s),children:[(0,L.jsx)(fo,{right:!s}),(0,L.jsx)(`span`,{children:l===1?F(`review.countOne`):F(`review.count`,{count:l})})]}),(0,L.jsx)(R,{disabled:n,onClick:o,children:n?F(`review.sending`):F(`review.send`,{count:l})})]}),s&&(0,L.jsx)(`ul`,{className:`m-0 min-h-0 list-none overflow-y-auto p-0 pb-1`,children:e.map(e=>(0,L.jsxs)(`li`,{className:`flex flex-col gap-0.5 px-3 py-1 narrow:px-2`,children:[(0,L.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,L.jsx)(R,{variant:`row`,className:`min-w-0 flex-1 truncate text-left text-ink hover:underline`,title:F(`review.show`),onClick:()=>r(e),children:LL(e)}),t.get(e.id)===`moved`&&(0,L.jsx)(`span`,{title:F(`review.movedHint`),children:(0,L.jsx)(Lw,{tone:`warning`,children:F(`review.moved`)})}),(0,L.jsx)(R,{hit:`tight`,onClick:()=>i(e),children:F(`review.edit`)}),(0,L.jsx)(R,{hit:`tight`,onClick:()=>a(e),children:F(`review.drop`)})]}),(0,L.jsx)(`p`,{className:`m-0 line-clamp-2 whitespace-pre-wrap wrap-anywhere text-muted`,children:e.body})]},e.id))})]})}var WL=[];function GL({model:e,view:t,active:n,restored:r,onClose:i}){I();let a=cl(),[o,s]=(0,h.useState)(rL),[c,l]=(0,h.useState)(ZI),[u,d]=kI(t),f=t.scope===`task`?u:null,p=f!==null,m=t.file===!0,g={taskId:t.taskId,path:t.path,scope:t.scope,...m?{content:!0}:{},...o?{ignoreWhitespace:!0}:{},...f?{base:f}:{}},v=ML(e,t.taskId),y={...g,taskId:v},[b,x]=(0,h.useState)(()=>{let n=J(e,`diff.file`,y);return n===void 0?null:AL(n,t.path,p)}),[S,C]=(0,h.useState)(()=>J(e,`review.list`,{taskId:t.taskId})?.notes??[]),[w,T]=(0,h.useState)(()=>J(e,`diff.files`,{taskId:v})),[E,D]=(0,h.useState)(0),[O,k]=(0,h.useState)(null),[ee,A]=(0,h.useState)(!1),[te,ne]=(0,h.useState)(new Map),[j,re]=(0,h.useState)(!1),[M,N]=(0,h.useState)(0),ie=(0,h.useRef)(null),ae=e.client,oe=_(ae.conn).state;(0,h.useEffect)(()=>{let e=!0;return ae.request(`diff.file`,g).then(n=>e&&x(AL(Y(ae,`diff.file`,y,n),t.path,p)),t=>{if(e){if(f&&t instanceof pd&&t.code===`BAD_REF`){d(null),H(t.message,`error`);return}x({kind:`text`,text:gF(t),error:!0})}}),()=>{e=!1}},[ae,t.taskId,t.path,t.scope,o,f,M,oe]),(0,h.useEffect)(()=>{let e=!0;return ae.request(`diff.files`,{taskId:t.taskId}).then(t=>e&&T(Y(ae,`diff.files`,{taskId:v},t)),()=>{}),()=>{e=!1}},[ae,t.taskId,M]);let se=()=>void X(ae,`review.list`,{taskId:t.taskId}).then(e=>C(e.notes));(0,h.useEffect)(se,[ae,t.taskId,M]);let ce=(0,h.useRef)(!1);(0,h.useEffect)(()=>{n&&(ce.current||!r)&&ie.current?.focus(),ce.current=!0},[n,r]);let P=b?.kind===`rows`?b.rows:WL,le=b?.kind===`rows`&&b.diff,ue=w?.base??null,de=t.path!==`.`&&t.scope===`working`&&aF(w?.files??[],t.path),fe=hL(ae,t.taskId,t.path,m&&de&&!le,M),pe=(0,h.useMemo)(()=>P.map((e,t)=>`row-${t}`),[P]),me=(0,h.useMemo)(()=>pL(P),[P]),he=(0,h.useMemo)(()=>XI(P),[P]),ge=(0,h.useMemo)(()=>$I(c,t.taskId,he),[c,t.taskId,he]),_e=(0,h.useMemo)(()=>{let e=new Set;for(let t of he.keys())(te.get(t)??(wL(t)||ge.has(t)))&&e.add(t);return e},[he,ge,te]),ve=(e,t)=>ne(n=>{let r=new Map(n);for(let n of e)r.set(n,t);return r}),ye=(0,h.useMemo)(()=>fL(P,_e),[P,_e]),be=(0,h.useMemo)(()=>S.filter(e=>e.sentAt===void 0),[S]),xe=(0,h.useMemo)(()=>be.map(e=>({note:e,at:zL(e,P)})),[be,P]),Se=(0,h.useMemo)(()=>{let e=new Set;for(let{at:t}of xe)if(t)for(let n=t.first;n<=t.last;n++)e.add(n);return e},[xe]),Ce=(0,h.useMemo)(()=>{let e=new Map;for(let{note:t,at:n}of xe)n&&e.set(n.last,[...e.get(n.last)??[],t]);return e},[xe]),we=t.path===`.`&&b!==null&&!(b.kind===`text`&&b.error),Te=(0,h.useMemo)(()=>{let e=new Map;for(let{note:t}of xe)e.set(t.id,BL(t,P,we));return e},[xe,P,we]);(0,h.useEffect)(()=>{if(ye.includes(E))return;let e=E;for(;e>0&&P[e]?.kind!==`file`;)e--;D(e),k(null)},[ye,E,P]);let Ee=(0,h.useRef)(!1);(0,h.useEffect)(()=>{if(!Ee.current){Ee.current=!0;return}ie.current?.querySelector(`[data-row="${E}"]`)?.scrollIntoView({block:`nearest`})},[E]);let De=dL(P,E,O),Oe=e=>ve([e],!_e.has(e)),ke=[...me.keys()].flatMap(e=>P[e]?.path?[P[e]?.path]:[]),Ae=(0,h.useMemo)(()=>kL(me,P),[me,P]),je=ke.length>0&&ke.every(e=>_e.has(e)),Me=[...me.values()].reduce((e,t)=>({added:e.added+t.added,removed:e.removed+t.removed}),{added:0,removed:0}),Ne=e=>{let n=eL(c,t.taskId,e,ge.has(e)?void 0:he.get(e));l(n),QI(n),ne(t=>{let n=new Map(t);return n.delete(e),n})},Pe=()=>{iL(!o),s(!o)},Fe=VL({client:ae,taskId:t.taskId,rows:P,target:De,onSaved:e=>{e&&(k(null),A(!1)),se()},focusView:()=>ie.current?.focus()}),Ie=e=>{Be(e),(t.path===`.`||t.path===e.filePath)&&Fe.edit(e)},Le=e=>void ae.request(`review.remove`,{taskId:t.taskId,id:e.id}).then(se).catch(e=>H(jL(e).message,`error`)),Re=_(xn),ze=()=>{let e=uL(P,E,O);if(e){if(!Re?.startsWith(`${t.taskId}::`)){H(F(`files.mentionNoEngine`),`error`);return}ae.request(`term.input`,{stream:Re,data:lL(e)}).then(()=>{k(null),La(Re)?.focus()}).catch(e=>H(e instanceof Error?e.message:String(e),`error`))}},Be=e=>{let n=zL(e,P),r=P.findIndex(t=>t.kind===`file`&&t.path===e.filePath);n?(ve([e.filePath],!1),D(n.first)):t.path===`.`&&r>=0?D(r):t.path!==e.filePath&&t.path!==`.`&&Fs({taskId:t.taskId,path:e.filePath,scope:t.scope}),k(null),A(!1)},Ve=()=>{re(!0),ae.request(`review.send`,e.engineTarget(t.taskId)).then(e=>{H(e.delivered?F(`preview.sent`,{count:e.sent}):F(`preview.notSent`,{reason:e.reason??``}),e.delivered?`info`:`error`),se()}).catch(e=>H(e instanceof Error?e.message:String(e),`error`)).finally(()=>re(!1))},He=()=>{let e=tL([...me.keys()],E);e!==null&&(D(e),k(null),A(!1))},R=()=>{let e=tL(xe.flatMap(({at:e})=>e?[e.first]:[]).sort((e,t)=>e-t),E);if(e===null)return;let t=P[e]?.path;t&&ve([t],!1),D(e),k(null),A(!1)},Ue=e=>D(t=>{let n=Math.max(0,ye.indexOf(t));return ye[Math.min(ye.length-1,Math.max(0,n+e))]??t}),We=e=>{let t=e.key;if(t===`j`||t===`ArrowDown`)Ue(1);else if(t===`k`||t===`ArrowUp`)Ue(-1);else if(t===`v`)k(e=>e===null?E:null),A(!0);else if(t===`c`&&!e.ctrlKey)Fe.add();else if(t===`x`){let e=xe.find(({at:e})=>e&&E>=e.first&&E<=e.last);e&&Le(e.note)}else if(t===`s`)Ve();else if(t===`z`){let e=P[E]?.path;e&&le&&Oe(e)}else if(t===`r`)N(e=>e+1);else if(t===`q`||t===`Escape`)i();else if(e.ctrlKey&&!e.metaKey&&t.toLowerCase()===`c`&&!window.getSelection()?.toString())i();else return;e.preventDefault()},Ge=()=>{let e=window.getSelection();if(!e||e.isCollapsed)return;let t=e=>(e instanceof Element?e:e?.parentElement)?.closest(`[data-row]`),n=t(e.anchorNode),r=t(e.focusNode);!n||!r||(k(Number(n.dataset.row)),D(Number(r.dataset.row)),A(!0))},Ke=HI({rowClick:(e,t)=>{window.getSelection()?.isCollapsed!==!1&&(t.shiftKey?k(e=>e??E):(!a||O===null)&&k(null),D(e),A(!0))},fileClick:(e,t)=>{D(e),k(null),A(!1),t&&Oe(t)},viewedClick:Ne,editNote:Ie}),qe=O===null?E:Math.min(O,E),Je=O===null?E:Math.max(O,E);return(0,L.jsxs)(`div`,{className:`group/preview @container/preview flex min-h-0 min-w-0 flex-1 flex-col outline-none`,"data-file":m&&!le?``:void 0,tabIndex:0,ref:ie,onKeyDown:We,children:[de&&(0,L.jsx)(mL,{taskId:t.taskId,path:t.path,file:m}),le&&(0,L.jsx)(GI,{picker:ue!==null&&(0,L.jsx)(wI,{taskId:t.taskId,model:e,scope:t.scope,onScope:e=>Fs({taskId:t.taskId,path:t.path,scope:e}),base:ue,custom:u,onPick:d}),ignoreWs:o,onToggleWs:Pe,files:ke.length,shape:Ae,added:Me.added,removed:Me.removed,viewed:ge.size,allFolded:je,onFoldAll:()=>ve(ke,!je),onNextFile:He,onNextComment:xe.some(({at:e})=>e)?R:null}),(0,L.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto py-1.5 font-mono text-meta/normal`,onMouseUp:Ge,children:[!b&&(0,L.jsx)(`p`,{className:`mx-2.5 my-3 font-mono text-meta text-subtle`,children:F(`preview.loading`)}),b?.kind===`text`&&(0,L.jsx)(`p`,{className:`mx-2.5 my-3 font-mono text-meta text-subtle ${b.error?`text-error`:``}`,children:b.text}),ye.map(e=>{let t=P[e],n=e>=qe&&e<=Je;if(t.kind===`file`){let r=me.get(e),i=t.path;return(0,L.jsx)(zI,{index:e,name:t.text,path:i,closed:i!==null&&_e.has(i),viewed:i!==null&&ge.has(i),cursor:n,added:r?.added??0,removed:r?.removed??0,onToggleFold:Ke.fileClick,onToggleViewed:Ke.viewedClick},pe[e])}return(0,L.jsx)(WI,{index:e,row:t,cursor:n,noted:Se.has(e),actions:ee&&De&&!Fe.node&&e===Je&&(0,L.jsx)(BI,{showRange:a&&O===null,ranged:O!==null,onComment:Fe.add,onRange:()=>k(E),onAsk:ze}),notes:Ce.get(e),changed:t.newNo!==null&&fe?.has(t.newNo)===!0,composer:e===Fe.row?Fe.node:void 0,editId:e===Fe.row?Fe.editId:void 0,onClick:Ke.rowClick,onEditNote:Ke.editNote},pe[e])}),Fe.row===-1&&Fe.node]}),(0,L.jsx)(UL,{notes:be,states:Te,sending:j,onShow:Be,onEdit:Ie,onDrop:Le,onSend:Ve})]})}function KL(e){I();let{model:t,view:n}=e,r=n.path===`.`?null:xF(n.path),[i,a]=(0,h.useState)(null),o=_(t.tasks);if(!r)return(0,L.jsx)(GL,{...e});let s=i===n.path,c=JSON.stringify(o?.tasks.find(e=>e.id===n.taskId)?.changes??null);return(0,L.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,L.jsxs)(`div`,{className:`flex gap-x-3 px-2.5 py-1`,children:[(0,L.jsx)(R,{variant:`pill`,hit:`tight`,"aria-current":!s,onClick:()=>a(null),children:`[ ${F(`artifact.preview`)} ]`}),(0,L.jsx)(R,{variant:`pill`,hit:`tight`,"aria-current":s,onClick:()=>a(n.path),children:`[ ${F(`artifact.source`)} ]`})]}),s?(0,L.jsx)(GL,{...e}):(0,L.jsx)(xI,{model:t,taskId:n.taskId,path:n.path,kind:r,changeKey:c})]})}var qL={entries:[],failed:new Set},JL=[`command`,`cmd`,`file_path`,`path`,`pattern`,`query`,`url`,`description`,`prompt`],YL=100;function XL(e){let t=(e.split(`
52
+ `).find(e=>e.trim()!==``)??``).trim();return t.length>YL?`${t.slice(0,99)}…`:t}function ZL(e){if(typeof e==`string`)return XL(e);if(!e||typeof e!=`object`)return``;let t=e,n=e=>typeof e==`string`?e:Array.isArray(e)&&e.every(e=>typeof e==`string`)?e.join(` `):``;for(let e of JL){let r=n(t[e]);if(r.trim())return XL(r)}for(let e of Object.values(t)){let t=n(e);if(t.trim())return XL(t)}return``}function QL(e){return e===`user`||e===`assistant`||e===`system`?e:null}function $L(e,t){let n=[],r=[];return e.forEach((e,i)=>{let a=QL(e.role);if(!a)return;let o=[],s=[];for(let t of e.blocks??[])t.type===`text`&&t.text?.trim()?o.push(t.text.trim()):t.type===`tool_call`?s.push({callId:t.callId??``,name:t.name??`tool`,summary:ZL(t.input)}):t.type===`tool_result`&&t.isError&&t.callId&&r.push(t.callId);(o.length!==0||s.length!==0)&&n.push({index:t+i,role:a,at:e.timestamp??``,text:o.join(`
53
53
 
54
- `),tools:s})}),{entries:n,failed:r}}function YL(e,t,n){let r=JL(t,n),i=new Map(e.entries.map(e=>[e.index,e]));for(let e of r.entries)i.set(e.index,e);let a=r.failed.length>0?new Set([...e.failed,...r.failed]):e.failed;return{entries:[...i.values()].sort((e,t)=>e.index-t.index),failed:a}}function XL(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>e.text.toLowerCase().includes(n)||e.tools.some(e=>`${e.name} ${e.summary}`.toLowerCase().includes(n))).map(e=>e.index):[]}var ZL=e=>e.replace(/[*_`]+/g,``).replace(/[…\s]+/g,` `).trim().toLowerCase();function QL(e,t){let n=e.find(e=>e.at===t.at&&e.role===t.role);if(n)return n.index;let r=ZL(t.snippet);return r?e.find(e=>e.role===t.role&&ZL(e.text).includes(r))?.index??null:null}function $L(e,t){let n=e[0];if(!n)return!0;let[r,i]=[Date.parse(n.at),Date.parse(t.at)];return Number.isNaN(r)||Number.isNaN(i)?!0:r>i}function eR(e,t){let n=e.tools.map(e=>`- \`${e.name}\`${e.summary?` ${e.summary}`:``}${t.has(e.callId)?` (failed)`:``}`);return[e.text,n.join(`
54
+ `),tools:s})}),{entries:n,failed:r}}function eR(e,t,n){let r=$L(t,n),i=new Map(e.entries.map(e=>[e.index,e]));for(let e of r.entries)i.set(e.index,e);let a=r.failed.length>0?new Set([...e.failed,...r.failed]):e.failed;return{entries:[...i.values()].sort((e,t)=>e.index-t.index),failed:a}}function tR(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>e.text.toLowerCase().includes(n)||e.tools.some(e=>`${e.name} ${e.summary}`.toLowerCase().includes(n))).map(e=>e.index):[]}var nR=e=>e.replace(/[*_`]+/g,``).replace(/[…\s]+/g,` `).trim().toLowerCase();function rR(e,t){let n=e.find(e=>e.at===t.at&&e.role===t.role);if(n)return n.index;let r=nR(t.snippet);return r?e.find(e=>e.role===t.role&&nR(e.text).includes(r))?.index??null:null}function iR(e,t){let n=e[0];if(!n)return!0;let[r,i]=[Date.parse(n.at),Date.parse(t.at)];return Number.isNaN(r)||Number.isNaN(i)?!0:r>i}function aR(e,t){let n=e.tools.map(e=>`- \`${e.name}\`${e.summary?` ${e.summary}`:``}${t.has(e.callId)?` (failed)`:``}`);return[e.text,n.join(`
55
55
  `)].filter(e=>e!==``).join(`
56
56
 
57
- `)}function tR(e,t){return e.text===``?eR(e,t):e.text}function nR(e,t,n,r){return`# ${e}\n\n${t.map(e=>`${`## ${r[e.role]}${e.at?` · ${e.at}`:``}`}\n\n${eR(e,n)}`).join(`
57
+ `)}function oR(e,t){return e.text===``?aR(e,t):e.text}function sR(e,t,n,r){return`# ${e}\n\n${t.map(e=>`${`## ${r[e.role]}${e.at?` · ${e.at}`:``}`}\n\n${aR(e,n)}`).join(`
58
58
 
59
- `)}\n`}var rR=50;function iR(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:rR,...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=YL(HL,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:U(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:YL(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:YL(e.transcript,n.history?.messages??[],n.history?.firstIndex??0),older:n.olderCursor??null}:e)}catch(e){t===c.current&&r({kind:`error`,message:U(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=YL(i,t.messages,t.firstIndex),r=e.olderCursor??null}return t===c.current?(r(e=>e.kind===`ready`?{...e,transcript:n.reduce((e,t)=>YL(e,t.messages,t.firstIndex),e.transcript),older:null}:e),i):null}catch(e){return t===c.current&&r({kind:`error`,message:U(e)}),null}finally{t===c.current&&(s.current=!1,a(!1))}},[l]),refresh:d,reload:(0,h.useCallback)(()=>{r({kind:`loading`}),u()},[u])}}var aR=3e3,oR=80,sR=2500;function cR(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 lR=e=>{let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})};function uR(e){let{entry:t}=e,n=F(t.role===`user`?`transcript.you`:t.role===`assistant`?`transcript.agent`:`transcript.system`);return(0,L.jsxs)(`article`,{className:VF(e),"data-index":t.index,children:[(0,L.jsxs)(`header`,{className:HF,children:[(0,L.jsx)(`span`,{className:UF(t.role),children:n}),(0,L.jsx)(`span`,{className:WF,children:lR(t.at)}),(0,L.jsx)(R,{className:GF,onClick:e.onCopy,children:F(`transcript.copy`)})]}),t.text!==``&&(0,L.jsx)(fI,{source:t.text,needle:e.needle}),t.tools.map((t,n)=>(0,L.jsxs)(`p`,{className:KF,title:`${t.name} ${t.summary}`,children:[(0,L.jsx)(`span`,{className:qF,children:oI(t.name,e.needle)}),(0,L.jsx)(`span`,{className:JF,children:oI(t.summary,e.needle)}),e.failed.has(t.callId)&&(0,L.jsx)(`span`,{className:`flex-none text-error`,children:F(`transcript.failed`)})]},n))]})}function dR({model:e,task:t,active:n}){I();let r=iR(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=_(n_),g=i.kind===`ready`?i:null,v=(0,h.useMemo)(()=>g?.transcript.entries??[],[g?.transcript]),y=g?.transcript.failed??new Set,b=(0,h.useMemo)(()=>XL(v,a),[v,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(),aR);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))},[v]);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=QL(v,m.hit);e===null?g.older&&$L(v,m.hit)?D():n_.set(null):(u(e),C(e),n_.set(null))},[m,g,v,n,t.id]),(0,h.useEffect)(()=>{if(l===null)return;let e=setTimeout(()=>u(null),sR);return()=>clearTimeout(e)},[l]),(0,h.useEffect)(()=>{c(0);let e=XL(v,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(``))},ee=e=>void navigator.clipboard.writeText(tR(e,y)).then(()=>H(F(`transcript.copied`)),()=>H(F(`menu.copyFailed`),`error`)),A=async()=>{let e=await r.loadAll();if(!e)return;let n={user:F(`transcript.you`),assistant:F(`transcript.agent`),system:F(`transcript.system`)};cR(`${t.label.replace(/[^\p{L}\p{N}]+/gu,`-`).replace(/^-|-$/g,``)||`conversation`}.md`,nR(t.label,e.entries,e.failed,n))};return i.kind===`loading`?(0,L.jsx)(`div`,{className:FF,children:(0,L.jsx)(`p`,{className:zF,children:F(`transcript.loading`)})}):i.kind===`error`?(0,L.jsxs)(`div`,{className:FF,children:[(0,L.jsx)(`p`,{className:`${zF} text-error`,children:F(`transcript.error`,{error:i.message})}),(0,L.jsx)(`p`,{className:zF,children:(0,L.jsx)(R,{onClick:r.reload,children:F(`transcript.retry`)})})]}):i.kind===`terminal`?(0,L.jsxs)(`div`,{className:FF,children:[(0,L.jsx)(`p`,{className:zF,children:F(`transcript.noHistory`)}),(0,L.jsx)(`pre`,{className:`${BF} min-h-0 flex-1 overflow-y-auto`,children:i.tail.join(`
60
- `)})]}):(0,L.jsxs)(`div`,{className:FF,children:[(0,L.jsxs)(`div`,{className:IF,children:[(0,L.jsx)(`input`,{className:`${ln} ${LF}`,value:a,placeholder:F(`transcript.findPlaceholder`),"aria-label":F(`transcript.findPlaceholder`),spellCheck:!1,autoComplete:`off`,onChange:e=>o(e.target.value),onKeyDown:k}),a.trim()!==``&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`whitespace-nowrap text-muted`,children:b.length===0?F(`transcript.findNone`):F(`transcript.findCount`,{at:x+1,total:b.length})}),(0,L.jsx)(R,{onClick:()=>O(-1),disabled:b.length===0,children:F(`transcript.prev`)}),(0,L.jsx)(R,{onClick:()=>O(1),disabled:b.length===0,children:F(`transcript.next`)})]}),(0,L.jsx)(R,{onClick:()=>void A(),disabled:v.length===0,children:F(`transcript.export`)})]}),(0,L.jsxs)(`div`,{ref:d,className:RF,onScroll:e=>{let t=e.currentTarget;f.current=t.scrollHeight-t.scrollTop-t.clientHeight<oR,t.scrollTop<oR&&g?.older&&!r.paging&&D()},children:[g?.older&&(0,L.jsx)(`p`,{className:`m-0 px-3 py-2 font-mono text-meta text-subtle`,children:(0,L.jsx)(R,{onClick:()=>void D(),disabled:r.paging,children:F(`transcript.older`)})}),v.length===0&&(0,L.jsx)(`p`,{className:`m-0 px-3 py-2 font-mono text-meta text-subtle`,children:F(`transcript.empty`)}),v.map(e=>(0,L.jsx)(uR,{entry:e,failed:y,needle:a,flash:l===e.index,current:S===e.index,onCopy:()=>ee(e)},e.index))]})]})}var fR={working:`review.scopeWorking`,branch:`review.scopeBranch`,task:`review.scopeTask`};function pR(e){return e.kind===`file`?{text:Ro(e.path),hint:e.path}:e.kind===`diff`?e.path===`.`?{text:F(fR[e.scope]),hint:F(`preview.whole`)}:{text:Ro(e.path),hint:e.path}:{text:F(`panel.${e.kind}`),hint:F(`panel.${e.kind}`)}}function mR({taskId:e,kind:t,expand:n}){I();let r=_(as),i=F(r?`panel.restore`:`panel.expand`);return(0,L.jsxs)(L.Fragment,{children:[n&&(0,L.jsx)(`button`,{type:`button`,className:oN({tool:!0}),title:i,"aria-label":i,"aria-pressed":r,onClick:()=>as.set(!r),children:(0,L.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,L.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,L.jsx)(`button`,{type:`button`,className:oN({tool:!0}),title:F(`panel.close`),"aria-label":F(`panel.close`),onClick:()=>zs(e,t),children:(0,L.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{d:`M4 4l8 8M12 4l-8 8`})})})]})}function hR({taskId:e,column:t,narrow:n}){if(I(),t.kind===`browser`)return(0,L.jsxs)(`div`,{className:fN(n),children:[(0,L.jsx)(RN,{taskId:e,column:t}),!n&&(0,L.jsx)(mR,{taskId:e,kind:`browser`,expand:!0})]});if(n&&t.kind!==`diff`)return null;let{text:r,hint:i}=pR(t);return(0,L.jsxs)(`div`,{className:fN(n),children:[(0,L.jsx)(`span`,{className:pN,title:i,children:r}),(0,L.jsx)(mR,{taskId:e,kind:t.kind,expand:!n})]})}function gR({model:e,task:t,column:n}){let r=(0,h.useRef)([]);return r.current=Mo(r.current,n.active,n.tabs),n.tabs.filter(e=>r.current.includes(e.id)).map(r=>(0,L.jsx)(`div`,{className:SN,hidden:r.id!==n.active,children:(0,L.jsx)(oP,{model:e,tab:r,onNavigate:e=>Bs(t.id,t=>Eo(t,r.id,e)),onStep:e=>Bs(t.id,t=>Do(t,r.id,e))})},r.id))}function _R({model:e,task:t,column:n,narrow:r,restored:i}){return n.kind===`browser`?(0,L.jsx)(gR,{model:e,task:t,column:n}):(0,L.jsxs)(`div`,{className:SN,children:[n.kind===`files`&&(0,L.jsx)(mF,{model:e,task:t,narrow:r}),n.kind===`chat`&&(0,L.jsx)(dR,{model:e,task:t,active:!0}),n.kind===`quota`&&(0,L.jsx)(MP,{model:e,task:t,active:!0}),n.kind===`file`&&(0,L.jsx)(VL,{model:e,view:{taskId:t.id,path:n.path,scope:`working`,file:!0},active:!0,restored:i,onClose:()=>zs(t.id,`file`)},`${t.id}:file:${n.path}`),n.kind===`diff`&&(0,L.jsx)(VL,{model:e,view:{taskId:t.id,path:n.path,scope:n.scope},active:!0,restored:i,onClose:()=>zs(t.id,`diff`)},`${t.id}:${n.path}:${n.scope}`)]})}function vR({taskId:e,kinds:t,index:n,body:r,slot:i}){I();let a=(0,h.useRef)(null);return(0,L.jsx)(`div`,{className:xN,style:{gridColumn:i},title:F(`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=Qo(r.widths,n,t.clientX-r.x,220);Ms(e,e=>Xo(e,i))},onLostPointerCapture:()=>{a.current=null,r.current?.classList.remove(`is-resizing`)},onDoubleClick:()=>Ms(e,Zo)})}function yR({panel:e}){I();let t=(0,h.useRef)(null);return(0,L.jsx)(zN,{edge:`left`,title:F(`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),Rn(!0)},onPointerMove:e=>{let n=t.current;if(!n||e.clientX===n.x)return;let r=fA.get()?0:gA(dA.get()??280);rs.set(os(n.width-(e.clientX-n.x),r))},onLostPointerCapture:()=>{t.current=null,e.current?.classList.remove(`is-resizing`),Rn(!1)},onDoubleClick:()=>rs.set(null)})}var bR=e=>e.kind===`diff`?`diff:${e.path}:${e.scope}`:e.kind===`file`?`file:${e.path}`:e.kind;function xR({model:e,task:t,narrow:n}){I();let r=As(t.id),i=_(es),a=_(as),o=(0,h.useRef)(null),s=(0,h.useRef)(null),c=i===`terminal`?`files`:i,l=n?Lo(r,c):void 0;(0,h.useEffect)(()=>{n&&!l&&Ms(t.id,e=>Ho(e,c))},[n,l,c,t.id]);let u=n?l?[l]:[]:r.columns,d=u.map(e=>e.kind),f=(n?[1]:Yo(r)).map((e,t)=>`${t>0?`var(--divider) `:``}minmax(0, ${e}fr)`).join(` `),p=(0,h.useRef)(u.map(bR));return(0,L.jsxs)(`aside`,{className:lN(n),ref:o,children:[!n&&!a&&(0,L.jsx)(yR,{panel:o}),(0,L.jsxs)(`div`,{className:uN,ref:s,style:{gridTemplateColumns:f},children:[u.map(r=>(0,L.jsxs)(`section`,{className:dN,"data-kind":r.kind,style:{gridColumn:2*d.indexOf(r.kind)+1},children:[(0,L.jsx)(hR,{taskId:t.id,column:r,narrow:n}),(0,L.jsx)(_R,{model:e,task:t,column:r,narrow:n,restored:p.current.includes(bR(r))})]},r.kind)),!n&&u.slice(1).map((e,n)=>(0,L.jsx)(vR,{taskId:t.id,kinds:d,index:n,body:s,slot:2*n+2},`divider:${e.kind}`))]})]})}function SR({model:e,task:t,remoteHost:n,narrow:r=!1}){let i=_(Sn),a=js(t?.id??null);return!r&&(i||!a)?null:t?(0,L.jsx)(xR,{model:e,task:t,narrow:r},t.id):n?(0,L.jsx)(`aside`,{className:lN(!1),children:(0,L.jsx)(Gf,{host:n,onMachines:()=>mg(e)})}):null}var CR=1500;function wR({model:e}){let t=e.client,n=_(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),CR);return()=>window.clearTimeout(e)},[n.state]),n.state===`open`||n.state===`connecting`&&!r?null:(0,L.jsxs)(`footer`,{className:Ht,children:[(0,L.jsx)(`span`,{className:Ut(n.state===`retrying`)}),(0,L.jsx)(`span`,{children:n.state===`retrying`?F(`status.retrying`,{count:n.failures}):F(`status.connecting`)}),n.state===`retrying`&&(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>t.retryNow(),children:F(`status.retry`)})]})}var TR=`rove.web.update.skipped`;function ER(e){return!e.latest||!e.notify||e.latest===e.skipped||e.latest===e.asked?null:e.latest}var DR=null;function OR(){let e=Gy.get(),t=ER({latest:e?.info?.hasUpdate?e.info.latest:null,notify:g_.get().prefs.updateNotify,skipped:localStorage.getItem(TR),asked:DR});!t||B.get()!==null||(DR=t,B.set((0,L.jsx)(kR,{current:e?.current??``,latest:t})))}function kR(e){return(0,L.jsx)(Tr,{title:F(`updatePrompt.title`,{version:e.latest}),children:(0,L.jsxs)(`div`,{className:Yn,children:[(0,L.jsx)(`p`,{className:`text-muted`,children:F(`updatePrompt.body`,{current:e.current})}),(0,L.jsxs)(`div`,{className:un,children:[(0,L.jsx)(R,{onClick:()=>{localStorage.setItem(TR,e.latest),Pn()},children:F(`updatePrompt.skip`)}),(0,L.jsx)(R,{onClick:Pn,children:F(`updatePrompt.later`)}),(0,L.jsx)(R,{variant:`filled`,autoFocus:!0,onClick:()=>{Pn(),Ky.set(!0),Ja(`update`)},children:F(`updatePrompt.yes`)})]})]})})}function AR({model:e,taskId:t,groupId:n}){I();let r=_(e.tasks),i=r?wC(r.tasks,n):[];return i.length<2||!i.some(e=>e.id===t)?null:(0,L.jsxs)(`nav`,{className:gw,"aria-label":F(`compare.menu`),children:[i.map((n,r)=>(0,L.jsxs)(R,{variant:`pill`,hit:`tight`,"aria-current":n.id===t,onClick:()=>e.select(n.id),children:[`[ `,(0,L.jsx)(Lw,{status:n.rowStatus}),r+1,` `,n.engine?.name??n.label,n.kept&&(0,L.jsx)(`span`,{className:`text-accent`,children:`✓`}),` ]`]},n.id)),(0,L.jsx)(R,{hit:`tight`,className:`ml-auto flex-none whitespace-nowrap`,onClick:()=>Ya(n),children:F(`compare.strip`)})]})}var jR=new Set,MR=2e3;function NR(e){jR.add(e)}function PR(e,t=MR){setTimeout(()=>jR.delete(e),t)}var FR=e=>jR.has(e),IR=new Map,LR=new Set,RR=(e,t)=>`${e}/${t}`,zR=e=>IR.get(e)??``;function BR(e,t){t===``?IR.delete(e):IR.set(e,t);for(let e of LR)e()}function VR(e){return LR.add(e),()=>LR.delete(e)}function HR(e,t){let n=zR(e).trimEnd();BR(e,n===``?t:`${n}\n\n${t}`)}function UR(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 WR(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&&H(F(`voice.learned`,{pairs:r.map(e=>F(`voice.learnedPair`,{spoken:e.spoken,term:e.term})).join(`, `)}),`info`,{label:F(`voice.undo`),run:()=>void e.request(`voice.unlearn`,{learned:r}).then(()=>H(F(`voice.unlearned`)),()=>H(F(`voice.unlearnFailed`),`error`))})}function GR({model:e,taskId:t,tabId:n}){let r=_(e.tasks)?.tasks.find(e=>e.id===t)!==void 0,i=RR(t,n),a=(0,h.useSyncExternalStore)(VR,()=>zR(i)),[o,s]=(0,h.useState)(!1),{attachments:c,attach:l,remove:u,ready:d,clear:f}=al(e,e=>H(e,`error`)),p=(0,h.useRef)(null),m=Bh(e.client),[g,v]=(0,h.useState)(!1),y=Ym({value:a,onChange:e=>BR(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)}`;BR(i,s);let c=n+o.length+e.length;b.current=UR(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)||BR(i,t)},C=e=>void S(e),w=async(r=a)=>{s(!0);try{let a=el(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?(BR(i,``),f(),v(!1),b.current&&WR(e.client,b.current,r),b.current=null,!0):(H(F(`layout.composerNotSent`,{reason:o.reason??``}),`error`),!1)}catch(e){let t=e instanceof pd?e.code:void 0;return H(t===`UNKNOWN_OP`?F(`layout.composerOldBridge`):t===`AWAITING_PERMISSION`?F(`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===``&&c.length===0,O=()=>{(0,XO.flushSync)(()=>v(!0)),p.current?.focus()};return(0,L.jsx)(vh,{value:a,placeholder:F(`layout.composerPlaceholder`),sendLabel:F(`layout.composerSend`),busy:o,ready:a.trim()!==``||c.length>0,attached:(0,L.jsx)(ol,{attachments:c,onRemove:u}),attach:(0,L.jsxs)(Qc,{className:oh,title:F(`layout.composerAttach`),disabled:o,onFiles:T,children:[(0,L.jsx)(`span`,{className:`sr-only`,children:F(`layout.composerAttach`)}),(0,L.jsx)(fh,{})]}),dictate:(0,L.jsx)(Hh,{...E,look:sh,face:e=>(0,L.jsx)(_h,{state:e})}),voice:D?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Hh,{...E,onSend:C,look:ch,idle:F(`voice.hold`),face:e=>(0,L.jsx)(gh,{state:e,idle:F(`voice.hold`),working:F(`voice.working`),slide:F(`voice.slideToSend`),release:F(`voice.tipSend`)})}),(0,L.jsx)(ph,{label:F(`voice.type`),onClick:O})]}):void 0,composerKey:i,fieldRef:p,suggest:y.list,...y.field,onPaste:Zc(T).onPaste,onSend:()=>void w()})}var KR={up:`layout.termKeyUp`,down:`layout.termKeyDown`,left:`layout.termKeyLeft`,right:`layout.termKeyRight`,interrupt:`layout.termKeyInterrupt`,enter:`layout.termKeyEnter`};function qR({handle:e,atMenu:t}){I();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,L.jsx)(`button`,{type:`button`,className:lt(!1),"aria-label":KR[e.id]?F(KR[e.id]):void 0,onClick:()=>{r(!1),i.input(e.bytes(i.modes.applicationCursorKeysMode),!0)},children:e.cap},e.id);return(0,L.jsxs)(`div`,{className:`mono ${ct}`,role:`toolbar`,"aria-label":F(`layout.termKeys`),onPointerDown:e=>e.preventDefault(),children:[t&&qd.map(a),(0,L.jsx)(`button`,{type:`button`,className:lt(n),"aria-pressed":n,onClick:()=>r(!n),children:`ctrl`}),Gd.filter(e=>!(t&&qd.includes(e))).map(a)]})}var JR={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`},YR=`Rove Nerd Symbols`,XR=[`"JetBrains Mono"`,`"${YR}"`,`"SF Mono"`,`ui-monospace`,`Menlo`,`monospace`].join(`, `);function ZR(e){switch(e.kind){case`restored`:return F(`workspace.restored`);case`notLive`:return F(`workspace.tabNotLive`);case`exited`:return F(`workspace.exited`,{code:e.code??`?`});case`failed`:return F(`workspace.attachFailed`,{message:e.message});case`none`:return``}}function QR(e){I();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?F(`workspace.reopenFailed`,{message:o.error}):s?F(`workspace.engineExited`,{code:s.code??`?`}):c?d?F(`workspace.usageLimitUntil`,{time:new Date(d).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}):F(`workspace.usageLimit`):ZR(t);return(0,L.jsxs)(`div`,{className:Vt(t.kind===`failed`||!!o.error),children:[(0,L.jsx)(`span`,{children:m}),e.onReopen&&(f||s)&&(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,disabled:o.busy,onClick:()=>e.onReopen?.(s!==null),children:o.busy?F(`workspace.reopening`):F(s?`workspace.retry`:`workspace.reopen`)}),t.kind===`failed`&&e.onRetryAttach&&(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:e.onRetryAttach,children:F(`workspace.retry`)}),c&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(R,{variant:`link`,hit:`tight`,onClick:()=>B.set((0,L.jsx)(eu,{model:r,taskId:i,context:`continue`,sourceTabId:a})),children:F(`menu.continueEngine`)}),(0,L.jsx)(R,{variant:`link`,hit:`tight`,disabled:l,onClick:()=>{u(!0),r.client.request(`task.resumeQuota`,{taskId:i}).catch(e=>H(e instanceof Error?e.message:String(e),`error`)).finally(()=>u(!1))},children:F(l?`workspace.resumingQuota`:`workspace.resumeQuota`)}),(0,L.jsx)(R,{variant:`link`,hit:`tight`,onClick:e.onDismissLimit,children:F(`workspace.dismiss`)})]}),p&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>B.set((0,L.jsx)(LS,{model:r,section:`engines`})),children:F(`workspace.engineSettings`)}),(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>B.set((0,L.jsx)(eu,{model:r,taskId:i})),children:F(`menu.newChatPick`)}),(0,L.jsx)(R,{variant:`link`,hit:`tight`,onClick:()=>B.set((0,L.jsx)(eu,{model:r,taskId:i,context:`continue`,sourceTabId:a})),children:F(`menu.continueEngine`)})]})]})}function $R(e){let t=e.split(`
59
+ `)}\n`}var cR=50;function lR(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:cR,...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=eR(qL,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:U(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:eR(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:eR(e.transcript,n.history?.messages??[],n.history?.firstIndex??0),older:n.olderCursor??null}:e)}catch(e){t===c.current&&r({kind:`error`,message:U(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=eR(i,t.messages,t.firstIndex),r=e.olderCursor??null}return t===c.current?(r(e=>e.kind===`ready`?{...e,transcript:n.reduce((e,t)=>eR(e,t.messages,t.firstIndex),e.transcript),older:null}:e),i):null}catch(e){return t===c.current&&r({kind:`error`,message:U(e)}),null}finally{t===c.current&&(s.current=!1,a(!1))}},[l]),refresh:d,reload:(0,h.useCallback)(()=>{r({kind:`loading`}),u()},[u])}}var uR=3e3,dR=80,fR=2500;function pR(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 mR=e=>{let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})};function hR(e){let{entry:t}=e,n=F(t.role===`user`?`transcript.you`:t.role===`assistant`?`transcript.agent`:`transcript.system`);return(0,L.jsxs)(`article`,{className:KF(e),"data-index":t.index,children:[(0,L.jsxs)(`header`,{className:qF,children:[(0,L.jsx)(`span`,{className:JF(t.role),children:n}),(0,L.jsx)(`span`,{className:YF,children:mR(t.at)}),(0,L.jsx)(R,{className:XF,onClick:e.onCopy,children:F(`transcript.copy`)})]}),t.text!==``&&(0,L.jsx)(_I,{source:t.text,needle:e.needle}),t.tools.map((t,n)=>(0,L.jsxs)(`p`,{className:ZF,title:`${t.name} ${t.summary}`,children:[(0,L.jsx)(`span`,{className:QF,children:dI(t.name,e.needle)}),(0,L.jsx)(`span`,{className:$F,children:dI(t.summary,e.needle)}),e.failed.has(t.callId)&&(0,L.jsx)(`span`,{className:`flex-none text-error`,children:F(`transcript.failed`)})]},n))]})}function gR({model:e,task:t,active:n}){I();let r=lR(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=_(n_),g=i.kind===`ready`?i:null,v=(0,h.useMemo)(()=>g?.transcript.entries??[],[g?.transcript]),y=g?.transcript.failed??new Set,b=(0,h.useMemo)(()=>tR(v,a),[v,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(),uR);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))},[v]);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=rR(v,m.hit);e===null?g.older&&iR(v,m.hit)?D():n_.set(null):(u(e),C(e),n_.set(null))},[m,g,v,n,t.id]),(0,h.useEffect)(()=>{if(l===null)return;let e=setTimeout(()=>u(null),fR);return()=>clearTimeout(e)},[l]),(0,h.useEffect)(()=>{c(0);let e=tR(v,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(``))},ee=e=>void navigator.clipboard.writeText(oR(e,y)).then(()=>H(F(`transcript.copied`)),()=>H(F(`menu.copyFailed`),`error`)),A=async()=>{let e=await r.loadAll();if(!e)return;let n={user:F(`transcript.you`),assistant:F(`transcript.agent`),system:F(`transcript.system`)};pR(`${t.label.replace(/[^\p{L}\p{N}]+/gu,`-`).replace(/^-|-$/g,``)||`conversation`}.md`,sR(t.label,e.entries,e.failed,n))};return i.kind===`loading`?(0,L.jsx)(`div`,{className:BF,children:(0,L.jsx)(`p`,{className:WF,children:F(`transcript.loading`)})}):i.kind===`error`?(0,L.jsxs)(`div`,{className:BF,children:[(0,L.jsx)(`p`,{className:`${WF} text-error`,children:F(`transcript.error`,{error:i.message})}),(0,L.jsx)(`p`,{className:WF,children:(0,L.jsx)(R,{onClick:r.reload,children:F(`transcript.retry`)})})]}):i.kind===`terminal`?(0,L.jsxs)(`div`,{className:BF,children:[(0,L.jsx)(`p`,{className:WF,children:F(`transcript.noHistory`)}),(0,L.jsx)(`pre`,{className:`${GF} min-h-0 flex-1 overflow-y-auto`,children:i.tail.join(`
60
+ `)})]}):(0,L.jsxs)(`div`,{className:BF,children:[(0,L.jsxs)(`div`,{className:VF,children:[(0,L.jsx)(`input`,{className:`${ln} ${HF}`,value:a,placeholder:F(`transcript.findPlaceholder`),"aria-label":F(`transcript.findPlaceholder`),spellCheck:!1,autoComplete:`off`,onChange:e=>o(e.target.value),onKeyDown:k}),a.trim()!==``&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`whitespace-nowrap text-muted`,children:b.length===0?F(`transcript.findNone`):F(`transcript.findCount`,{at:x+1,total:b.length})}),(0,L.jsx)(R,{onClick:()=>O(-1),disabled:b.length===0,children:F(`transcript.prev`)}),(0,L.jsx)(R,{onClick:()=>O(1),disabled:b.length===0,children:F(`transcript.next`)})]}),(0,L.jsx)(R,{onClick:()=>void A(),disabled:v.length===0,children:F(`transcript.export`)})]}),(0,L.jsxs)(`div`,{ref:d,className:UF,onScroll:e=>{let t=e.currentTarget;f.current=t.scrollHeight-t.scrollTop-t.clientHeight<dR,t.scrollTop<dR&&g?.older&&!r.paging&&D()},children:[g?.older&&(0,L.jsx)(`p`,{className:`m-0 px-3 py-2 font-mono text-meta text-subtle`,children:(0,L.jsx)(R,{onClick:()=>void D(),disabled:r.paging,children:F(`transcript.older`)})}),v.length===0&&(0,L.jsx)(`p`,{className:`m-0 px-3 py-2 font-mono text-meta text-subtle`,children:F(`transcript.empty`)}),v.map(e=>(0,L.jsx)(hR,{entry:e,failed:y,needle:a,flash:l===e.index,current:S===e.index,onCopy:()=>ee(e)},e.index))]})]})}var _R={working:`review.scopeWorking`,branch:`review.scopeBranch`,task:`review.scopeTask`};function vR(e){return e.kind===`file`?{text:Ro(e.path),hint:e.path}:e.kind===`diff`?e.path===`.`?{text:F(_R[e.scope]),hint:F(`preview.whole`)}:{text:Ro(e.path),hint:e.path}:{text:F(`panel.${e.kind}`),hint:F(`panel.${e.kind}`)}}function yR({taskId:e,kind:t,expand:n}){I();let r=_(as),i=F(r?`panel.restore`:`panel.expand`);return(0,L.jsxs)(L.Fragment,{children:[n&&(0,L.jsx)(`button`,{type:`button`,className:dN({tool:!0}),title:i,"aria-label":i,"aria-pressed":r,onClick:()=>as.set(!r),children:(0,L.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,L.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,L.jsx)(`button`,{type:`button`,className:dN({tool:!0}),title:F(`panel.close`),"aria-label":F(`panel.close`),onClick:()=>zs(e,t),children:(0,L.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{d:`M4 4l8 8M12 4l-8 8`})})})]})}function bR({taskId:e,column:t,narrow:n}){if(I(),t.kind===`browser`)return(0,L.jsxs)(`div`,{className:_N(n),children:[(0,L.jsx)(UN,{taskId:e,column:t}),!n&&(0,L.jsx)(yR,{taskId:e,kind:`browser`,expand:!0})]});if(n&&t.kind!==`diff`)return null;let{text:r,hint:i}=vR(t);return(0,L.jsxs)(`div`,{className:_N(n),children:[(0,L.jsx)(`span`,{className:vN,title:i,children:r}),(0,L.jsx)(yR,{taskId:e,kind:t.kind,expand:!n})]})}function xR({model:e,task:t,column:n}){let r=(0,h.useRef)([]);return r.current=Mo(r.current,n.active,n.tabs),n.tabs.filter(e=>r.current.includes(e.id)).map(r=>(0,L.jsx)(`div`,{className:DN,hidden:r.id!==n.active,children:(0,L.jsx)(dP,{model:e,tab:r,onNavigate:e=>Bs(t.id,t=>Eo(t,r.id,e)),onStep:e=>Bs(t.id,t=>Do(t,r.id,e))})},r.id))}function SR({model:e,task:t,column:n,narrow:r,restored:i}){return n.kind===`browser`?(0,L.jsx)(xR,{model:e,task:t,column:n}):(0,L.jsxs)(`div`,{className:DN,children:[n.kind===`files`&&(0,L.jsx)(yF,{model:e,task:t,narrow:r}),n.kind===`chat`&&(0,L.jsx)(gR,{model:e,task:t,active:!0}),n.kind===`quota`&&(0,L.jsx)(LP,{model:e,task:t,active:!0}),n.kind===`file`&&(0,L.jsx)(KL,{model:e,view:{taskId:t.id,path:n.path,scope:`working`,file:!0},active:!0,restored:i,onClose:()=>zs(t.id,`file`)},`${t.id}:file:${n.path}`),n.kind===`diff`&&(0,L.jsx)(KL,{model:e,view:{taskId:t.id,path:n.path,scope:n.scope},active:!0,restored:i,onClose:()=>zs(t.id,`diff`)},`${t.id}:${n.path}:${n.scope}`)]})}function CR({taskId:e,kinds:t,index:n,body:r,slot:i}){I();let a=(0,h.useRef)(null);return(0,L.jsx)(`div`,{className:EN,style:{gridColumn:i},title:F(`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=Qo(r.widths,n,t.clientX-r.x,220);Ms(e,e=>Xo(e,i))},onLostPointerCapture:()=>{a.current=null,r.current?.classList.remove(`is-resizing`)},onDoubleClick:()=>Ms(e,Zo)})}function wR({panel:e}){I();let t=(0,h.useRef)(null);return(0,L.jsx)(WN,{edge:`left`,title:F(`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),Rn(!0)},onPointerMove:e=>{let n=t.current;if(!n||e.clientX===n.x)return;let r=bA.get()?0:wA(yA.get()??280);rs.set(os(n.width-(e.clientX-n.x),r))},onLostPointerCapture:()=>{t.current=null,e.current?.classList.remove(`is-resizing`),Rn(!1)},onDoubleClick:()=>rs.set(null)})}var TR=e=>e.kind===`diff`?`diff:${e.path}:${e.scope}`:e.kind===`file`?`file:${e.path}`:e.kind;function ER({model:e,task:t,narrow:n}){I();let r=As(t.id),i=_(es),a=_(as),o=(0,h.useRef)(null),s=(0,h.useRef)(null),c=i===`terminal`?`files`:i,l=n?Lo(r,c):void 0;(0,h.useEffect)(()=>{n&&!l&&Ms(t.id,e=>Ho(e,c))},[n,l,c,t.id]);let u=n?l?[l]:[]:r.columns,d=u.map(e=>e.kind),f=(n?[1]:Yo(r)).map((e,t)=>`${t>0?`var(--divider) `:``}minmax(0, ${e}fr)`).join(` `),p=(0,h.useRef)(u.map(TR));return(0,L.jsxs)(`aside`,{className:mN(n),ref:o,children:[!n&&!a&&(0,L.jsx)(wR,{panel:o}),(0,L.jsxs)(`div`,{className:hN,ref:s,style:{gridTemplateColumns:f},children:[u.map(r=>(0,L.jsxs)(`section`,{className:gN,"data-kind":r.kind,style:{gridColumn:2*d.indexOf(r.kind)+1},children:[(0,L.jsx)(bR,{taskId:t.id,column:r,narrow:n}),(0,L.jsx)(SR,{model:e,task:t,column:r,narrow:n,restored:p.current.includes(TR(r))})]},r.kind)),!n&&u.slice(1).map((e,n)=>(0,L.jsx)(CR,{taskId:t.id,kinds:d,index:n,body:s,slot:2*n+2},`divider:${e.kind}`))]})]})}function DR({model:e,task:t,remoteHost:n,narrow:r=!1}){let i=_(Sn),a=js(t?.id??null);return!r&&(i||!a)?null:t?(0,L.jsx)(ER,{model:e,task:t,narrow:r},t.id):n?(0,L.jsx)(`aside`,{className:mN(!1),children:(0,L.jsx)(Gf,{host:n,onMachines:()=>mg(e)})}):null}var OR=1500;function kR({model:e}){let t=e.client,n=_(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),OR);return()=>window.clearTimeout(e)},[n.state]),n.state===`open`||n.state===`connecting`&&!r?null:(0,L.jsxs)(`footer`,{className:Ht,children:[(0,L.jsx)(`span`,{className:Ut(n.state===`retrying`)}),(0,L.jsx)(`span`,{children:n.state===`retrying`?F(`status.retrying`,{count:n.failures}):F(`status.connecting`)}),n.state===`retrying`&&(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>t.retryNow(),children:F(`status.retry`)})]})}var AR=`rove.web.update.skipped`;function jR(e){return!e.latest||!e.notify||e.latest===e.skipped||e.latest===e.asked?null:e.latest}var MR=null;function NR(){let e=Jy.get(),t=jR({latest:e?.info?.hasUpdate?e.info.latest:null,notify:g_.get().prefs.updateNotify,skipped:localStorage.getItem(AR),asked:MR});!t||B.get()!==null||(MR=t,B.set((0,L.jsx)(PR,{current:e?.current??``,latest:t})))}function PR(e){return(0,L.jsx)(Tr,{title:F(`updatePrompt.title`,{version:e.latest}),children:(0,L.jsxs)(`div`,{className:Yn,children:[(0,L.jsx)(`p`,{className:`text-muted`,children:F(`updatePrompt.body`,{current:e.current})}),(0,L.jsxs)(`div`,{className:un,children:[(0,L.jsx)(R,{onClick:()=>{localStorage.setItem(AR,e.latest),Pn()},children:F(`updatePrompt.skip`)}),(0,L.jsx)(R,{onClick:Pn,children:F(`updatePrompt.later`)}),(0,L.jsx)(R,{variant:`filled`,autoFocus:!0,onClick:()=>{Pn(),Yy.set(!0),Ja(`update`)},children:F(`updatePrompt.yes`)})]})]})})}function FR({model:e,taskId:t,groupId:n}){I();let r=_(e.tasks),i=r?fw(r.tasks,n):[];return i.length<2||!i.some(e=>e.id===t)?null:(0,L.jsxs)(`nav`,{className:qw,"aria-label":F(`compare.menu`),children:[i.map((n,r)=>(0,L.jsxs)(R,{variant:`pill`,hit:`tight`,"aria-current":n.id===t,onClick:()=>e.select(n.id),children:[`[ `,(0,L.jsx)($b,{status:n.rowStatus}),r+1,` `,n.engine?.name??n.label,n.kept&&(0,L.jsx)(`span`,{className:`text-accent`,children:`✓`}),` ]`]},n.id)),(0,L.jsx)(R,{hit:`tight`,className:`ml-auto flex-none whitespace-nowrap`,onClick:()=>Ya(n),children:F(`compare.strip`)})]})}var IR=new Set,LR=2e3;function RR(e){IR.add(e)}function zR(e,t=LR){setTimeout(()=>IR.delete(e),t)}var BR=e=>IR.has(e),VR=new Map,HR=new Set,UR=(e,t)=>`${e}/${t}`,WR=e=>VR.get(e)??``;function GR(e,t){t===``?VR.delete(e):VR.set(e,t);for(let e of HR)e()}function KR(e){return HR.add(e),()=>HR.delete(e)}function qR(e,t){let n=WR(e).trimEnd();GR(e,n===``?t:`${n}\n\n${t}`)}function JR(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 YR(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&&H(F(`voice.learned`,{pairs:r.map(e=>F(`voice.learnedPair`,{spoken:e.spoken,term:e.term})).join(`, `)}),`info`,{label:F(`voice.undo`),run:()=>void e.request(`voice.unlearn`,{learned:r}).then(()=>H(F(`voice.unlearned`)),()=>H(F(`voice.unlearnFailed`),`error`))})}function XR({model:e,taskId:t,tabId:n}){let r=_(e.tasks)?.tasks.find(e=>e.id===t)!==void 0,i=UR(t,n),a=(0,h.useSyncExternalStore)(KR,()=>WR(i)),[o,s]=(0,h.useState)(!1),{attachments:c,attach:l,remove:u,ready:d,clear:f}=al(e,e=>H(e,`error`)),p=(0,h.useRef)(null),m=Bh(e.client),[g,v]=(0,h.useState)(!1),y=Ym({value:a,onChange:e=>GR(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)}`;GR(i,s);let c=n+o.length+e.length;b.current=JR(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)||GR(i,t)},C=e=>void S(e),w=async(r=a)=>{s(!0);try{let a=el(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?(GR(i,``),f(),v(!1),b.current&&YR(e.client,b.current,r),b.current=null,!0):(H(F(`layout.composerNotSent`,{reason:o.reason??``}),`error`),!1)}catch(e){let t=e instanceof pd?e.code:void 0;return H(t===`UNKNOWN_OP`?F(`layout.composerOldBridge`):t===`AWAITING_PERMISSION`?F(`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===``&&c.length===0,O=()=>{(0,ik.flushSync)(()=>v(!0)),p.current?.focus()};return(0,L.jsx)(vh,{value:a,placeholder:F(`layout.composerPlaceholder`),sendLabel:F(`layout.composerSend`),busy:o,ready:a.trim()!==``||c.length>0,attached:(0,L.jsx)(ol,{attachments:c,onRemove:u}),attach:(0,L.jsxs)(Qc,{className:oh,title:F(`layout.composerAttach`),disabled:o,onFiles:T,children:[(0,L.jsx)(`span`,{className:`sr-only`,children:F(`layout.composerAttach`)}),(0,L.jsx)(fh,{})]}),dictate:(0,L.jsx)(Hh,{...E,look:sh,face:e=>(0,L.jsx)(_h,{state:e})}),voice:D?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Hh,{...E,onSend:C,look:ch,idle:F(`voice.hold`),face:e=>(0,L.jsx)(gh,{state:e,idle:F(`voice.hold`),working:F(`voice.working`),slide:F(`voice.slideToSend`),release:F(`voice.tipSend`)})}),(0,L.jsx)(ph,{label:F(`voice.type`),onClick:O})]}):void 0,composerKey:i,fieldRef:p,suggest:y.list,...y.field,onPaste:Zc(T).onPaste,onSend:()=>void w()})}var ZR={up:`layout.termKeyUp`,down:`layout.termKeyDown`,left:`layout.termKeyLeft`,right:`layout.termKeyRight`,interrupt:`layout.termKeyInterrupt`,enter:`layout.termKeyEnter`};function QR({handle:e,atMenu:t}){I();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,L.jsx)(`button`,{type:`button`,className:lt(!1),"aria-label":ZR[e.id]?F(ZR[e.id]):void 0,onClick:()=>{r(!1),i.input(e.bytes(i.modes.applicationCursorKeysMode),!0)},children:e.cap},e.id);return(0,L.jsxs)(`div`,{className:`mono ${ct}`,role:`toolbar`,"aria-label":F(`layout.termKeys`),onPointerDown:e=>e.preventDefault(),children:[t&&qd.map(a),(0,L.jsx)(`button`,{type:`button`,className:lt(n),"aria-pressed":n,onClick:()=>r(!n),children:`ctrl`}),Gd.filter(e=>!(t&&qd.includes(e))).map(a)]})}var $R={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`},ez=`Rove Nerd Symbols`,tz=[`"JetBrains Mono"`,`"${ez}"`,`"SF Mono"`,`ui-monospace`,`Menlo`,`monospace`].join(`, `);function nz(e){switch(e.kind){case`restored`:return F(`workspace.restored`);case`notLive`:return F(`workspace.tabNotLive`);case`exited`:return F(`workspace.exited`,{code:e.code??`?`});case`failed`:return F(`workspace.attachFailed`,{message:e.message});case`none`:return``}}function rz(e){I();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?F(`workspace.reopenFailed`,{message:o.error}):s?F(`workspace.engineExited`,{code:s.code??`?`}):c?d?F(`workspace.usageLimitUntil`,{time:new Date(d).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}):F(`workspace.usageLimit`):nz(t);return(0,L.jsxs)(`div`,{className:Vt(t.kind===`failed`||!!o.error),children:[(0,L.jsx)(`span`,{children:m}),e.onReopen&&(f||s)&&(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,disabled:o.busy,onClick:()=>e.onReopen?.(s!==null),children:o.busy?F(`workspace.reopening`):F(s?`workspace.retry`:`workspace.reopen`)}),t.kind===`failed`&&e.onRetryAttach&&(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:e.onRetryAttach,children:F(`workspace.retry`)}),c&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(R,{variant:`link`,hit:`tight`,onClick:()=>B.set((0,L.jsx)(eu,{model:r,taskId:i,context:`continue`,sourceTabId:a})),children:F(`menu.continueEngine`)}),(0,L.jsx)(R,{variant:`link`,hit:`tight`,disabled:l,onClick:()=>{u(!0),r.client.request(`task.resumeQuota`,{taskId:i}).catch(e=>H(e instanceof Error?e.message:String(e),`error`)).finally(()=>u(!1))},children:F(l?`workspace.resumingQuota`:`workspace.resumeQuota`)}),(0,L.jsx)(R,{variant:`link`,hit:`tight`,onClick:e.onDismissLimit,children:F(`workspace.dismiss`)})]}),p&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>B.set((0,L.jsx)(DC,{model:r,section:`engines`})),children:F(`workspace.engineSettings`)}),(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>B.set((0,L.jsx)(eu,{model:r,taskId:i})),children:F(`menu.newChatPick`)}),(0,L.jsx)(R,{variant:`link`,hit:`tight`,onClick:()=>B.set((0,L.jsx)(eu,{model:r,taskId:i,context:`continue`,sourceTabId:a})),children:F(`menu.continueEngine`)})]})]})}function iz(e){let t=e.split(`
61
61
  `).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(`
62
62
  `).matchAll(/`+/g),e=>e[0].length)),r="`".repeat(Math.max(3,n+1));return`${r}\n${t.join(`
63
- `)}\n${r}\n`}function ez(e){let t=document.querySelector(`[data-composer="${CSS.escape(e)}"]`);return t&&t.offsetParent!==null?t:null}function tz(e,t,n,r){let i=$R(e.term.getSelection());if(i===null)return!1;let a=RR(t,n),o=ez(a);if(o){HR(a,i),e.term.clearSelection();let t=o.querySelector(`textarea`);return t?.focus(),t?.setSelectionRange(t.value.length,t.value.length),!0}return r?(H(F(`quote.atMenu`),`error`),!1):e.term.modes.bracketedPasteMode?(e.term.paste(i),e.term.clearSelection(),e.term.focus(),!0):(H(F(`quote.notReady`),`error`),!1)}async function nz(e,t,n){for(let r of n){r.size>1048576&&H(F(`layout.dropUploading`,{name:r.name}));try{t.term.paste(`${await Gc(e,r)} `)}catch(e){H(e instanceof Error?e.message:String(e),`error`)}}t.term.focus()}async function rz(){if(!navigator.clipboard?.read)throw Error(F(`layout.pasteNeedsHttps`));let e=[];for(let t of await navigator.clipboard.read())for(let n of t.types)(n.startsWith(`image/`)||n===`application/pdf`)&&e.push(new File([await t.getType(n)],`clipboard`,{type:n}));return e}async function iz(e,t){let n;try{n=await rz()}catch(e){H(F(`layout.pasteNoAccess`,{error:e instanceof Error?e.message:String(e)}),`error`);return}n.length===0?H(F(`layout.pasteNoImage`),`error`):await nz(e,t,n)}async function az(e){try{return await navigator.clipboard.writeText(e),!0}catch{return H(F(`menu.copyFailed`),`error`),!1}}function oz(e){let{client:t,taskId:n,tabId:r,leafId:i}=e,a=_(e.model.tasks)?.tasks.find(e=>e.id===n)?.tabStatus?.[r]?.kind===`needs-input`;I();let o=(0,h.useRef)(null),[s,c]=(0,h.useState)({kind:`none`}),[l,u]=(0,h.useState)(null),[d,f]=(0,h.useState)(0),[p,m]=(0,h.useState)({busy:!1,error:null}),g=(0,h.useRef)(e);g.current=e,Bh(t);let v=e.composer===!0&&Vh(t),y=(0,h.useRef)(v);y.current=v,(0,h.useEffect)(()=>{let e=o.current;if(!e)return;let a=null,s=!1,l=[document.fonts.load(`13px "JetBrains Mono"`),document.fonts.load(`bold 13px "JetBrains Mono"`)];document.fonts.load(`13px "${YR}"`,String.fromCodePoint(57504)).catch(()=>{});let d=()=>{s||Pd({client:t,host:e,taskId:n,tabId:r,leafId:i,focusOnMount:g.current.focused!==!1&&!y.current},{setNotice:c,onScrolled:f,onFocusChange:e=>{if(!a)return;let{stream:t}=a.handle;e?(g.current.onActivate?.(),Fa.set(La(t)??null)):Fa.get()?.stream===t&&Fa.set(null)},onExit:()=>{FR(Bl(n,r,i))||g.current.onExit?.()},copyText:az,pasteImage:async()=>{a&&await iz(t,a.handle)}}).then(e=>{s?e.release():(a=e,u(e.handle))})};return Nd(t,n,r,i)?d():Promise.allSettled(l).then(d),()=>{s=!0,u(null),a?.release()}},[t,n,r,i]);let[b,x]=(0,h.useState)(!1);(0,h.useEffect)(()=>{if(!l)return;x(l.term.hasSelection());let e=l.term.onSelectionChange(()=>x(l.term.hasSelection()));return()=>{e.dispose(),x(!1)}},[l]),(0,h.useEffect)(()=>{if(!l)return;let{term:e,stream:a}=l,o={stream:a,focus:()=>e.focus(),input:t=>e.input(t,!0),reattach:()=>l.reattach(),scrollPages:e=>l.scrollLines(e*10),hasSelection:()=>e.hasSelection(),copySelection:()=>{let t=e.getSelection();return t.trim().length!==0&&(az(t),e.clearSelection(),!0)},reset:()=>{let o={cols:e.cols,rows:e.rows};B.set((0,L.jsx)(Or,{title:yc(`reset.title`),body:yc(`reset.body`),confirmLabel:F(`workspace.reset`),onConfirm:async()=>{NR(a);try{await t.request(`tab.split`,{taskId:n,tabId:r,action:`reset`,leafId:i??`leaf-1`,...o}),await l.reattach(),e.focus()}finally{PR(a)}}}))},size:()=>({cols:e.cols,rows:e.rows})},s=Ia(o);return document.activeElement===e.textarea&&Fa.set(o),()=>{s()}},[l,t,n,r,i]),(0,h.useEffect)(()=>{e.focused&&!v&&l&&document.activeElement!==l.term.textarea&&l.term.focus()},[e.focused,v,l]);let S=!i||i===`leaf-1`,[C,w]=(0,h.useState)(null),T=e.engineExit?.since===C,[E,D]=(0,h.useState)(null),O=e.usageLimit&&e.usageLimit.since!==E?e.usageLimit:null,k=(0,h.useRef)(!1),ee=async(i,a)=>{if(!k.current){k.current=!0,m({busy:!0,error:null});try{await t.request(`term.revive`,{taskId:n,tabId:r,...a?{restartExited:a}:{}}),await i.reattach(),i.term.focus(),w(e.engineExit?.since??null),m({busy:!1,error:null})}catch(e){m({busy:!1,error:e instanceof Error?e.message:String(e)})}finally{k.current=!1}}};return(0,L.jsxs)(`div`,{className:Ft,"data-stream":Bl(n,r,i),onDragOver:e=>e.dataTransfer.types.includes(`Files`)&&e.preventDefault(),onDrop:e=>{!e.dataTransfer.files.length||!l||(e.preventDefault(),nz(t,l,Array.from(e.dataTransfer.files)))},onPasteCapture:e=>{if(!l)return;let n=Array.from(e.clipboardData.files);(n.length!==0||e.clipboardData.getData(`text/plain`)===``)&&(e.preventDefault(),e.stopPropagation(),n.length>0?nz(t,l,n):iz(t,l))},children:[(0,L.jsxs)(`div`,{className:It,children:[(0,L.jsx)(`div`,{className:Lt,ref:o}),(0,L.jsx)(QR,{notice:s,engineExit:T?null:e.engineExit??null,model:e.model,taskId:n,tabId:r,revive:p,onReopen:S&&l?e=>void ee(l,e):void 0,onRetryAttach:l?()=>void l.reattach():void 0,usageLimit:O!==null,onDismissLimit:O?()=>D(O.since):void 0}),b&&e.composer&&l&&(0,L.jsx)(R,{variant:`floating`,className:`absolute top-2.5 right-2.5 z-4`,title:F(`quote.title`),onClick:()=>tz(l,n,r,a),children:F(`quote.action`)}),d>0&&l&&(0,L.jsxs)(`div`,{className:`mono absolute right-2.5 bottom-2.5 z-4 flex gap-3 rounded-sm border-hairline border-line bg-inset px-2.5 py-1 text-meta`,children:[(0,L.jsx)(`span`,{className:`text-warning`,children:yc(`scrolledBack`,{lines:d})}),(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>l.scrollToTop(),children:yc(`scrollFirst`)}),(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>l.scrollToBottom(),children:yc(`scrollLatest`)})]})]}),e.composer&&(0,L.jsx)(GR,{model:e.model,taskId:n,tabId:r}),l&&(0,L.jsx)(qR,{handle:l,atMenu:a})]})}var sz=e=>Ek(e)!==null,cz=e=>Iu(Ek(e)?.tab.split);function lz(e){let t=Ek(e),n=t?.tab.split;return t&&n?{...t,split:n,leaf:Ck(t.taskId,t.tab,n)}:null}Ea(()=>[{id:`workspace.split.right`,chords:[`ctrl+\\`],prefix:!1,surface:`workspace`,live:sz,run:e=>{let t=Ek(e);t&&Ok(e,t.taskId,t.tab,`right`)}},{id:`workspace.split.down`,chords:[`ctrl+=`],prefix:!1,surface:`workspace`,live:sz,run:e=>{let t=Ek(e);t&&Ok(e,t.taskId,t.tab,`down`)}},{id:`workspace.split.focus-next`,chords:[`f3`],prefix:!1,surface:`workspace`,live:cz,run:e=>{let t=lz(e);t&&Tk(t.taskId,t.tab,t.split,Ru(t.split,t.leaf))}},{id:`workspace.split.close`,chords:[`w`],prefix:!0,surface:`workspace`,live:cz,run:e=>{let t=lz(e);t&&kk(e,t.taskId,t.tab,t.leaf)}},{id:`workspace.split.rename`,chords:[`f2`],prefix:!1,surface:`workspace`,live:cz,run:e=>{let t=lz(e);t&&Ak(e,t.taskId,t.tab,t.leaf)}}]);var uz=[{id:`leaf-1`,x:0,y:0,w:1,h:1,left:!1,top:!1}];function dz({model:e,taskId:t,tab:n}){let r=n.split;_(Sk);let i=r?Ck(t,n,r):`leaf-1`,a=r?zu(r,Nu(n)):new Map,o=Iu(r),{prefs:s}=x_(),c=_(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,L.jsx)(`div`,{className:rt,children:(r?Lu(r.root):uz).map(c=>(0,L.jsxs)(`div`,{className:ot(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,L.jsx)(oz,{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&&wk(t,n.id,r,c.id),onExit:()=>{o?Dk(e,{taskId:t,tabId:n.id,action:`close`,leafId:c.id}):n.kind!==`engine`&&e.closeTab(t,n.id).catch(()=>{})}}),o&&(0,L.jsx)(`span`,{className:st(s.splitStyle===`rule`,c.id===i),onContextMenu:r=>$M(r,Nk(e,t,n,c.id)),children:a.get(c.id)})]},c.id))})}var fz=/^[0-9a-f]{7,40}$/i;function pz(e,t){return t.sharesWorkspaceOf||!t.baseRef?null:e.find(e=>e.id!==t.id&&e.branch!==``&&e.branch===t.baseRef)||(fz.test(t.baseRef)&&t.parentTaskId?e.find(e=>e.id===t.parentTaskId)??null:null)}function mz(e,t){let n=[];for(let r=pz(e,t);r&&n.length<20&&!n.includes(r);r=pz(e,r))n.unshift(r);let r=e.filter(n=>!n.deleting&&pz(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&&!fz.test(i.baseRef)?i.baseRef:null;return{nodes:[...n,t,...r],at:n.length,base:a}}var hz=e=>e.pr?.lifecycle===`merged`;function gz(e){return e.nodes.find(e=>!hz(e))??null}function _z({model:e,taskId:t}){I();let n=_(e.tasks)?.tasks??[],r=n.find(e=>e.id===t),i=r?mz(n,r):null;if(!i)return null;let a=gz(i);return(0,L.jsxs)(`nav`,{className:gw,"aria-label":F(`compare.stackLabel`),children:[i.base&&(0,L.jsxs)(`span`,{className:`text-subtle`,children:[i.base,` ←`]}),i.nodes.map((n,r)=>(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-x-3.5`,children:[r>0&&(0,L.jsx)(`span`,{className:`text-subtle`,children:`←`}),(0,L.jsxs)(R,{variant:`pill`,hit:`tight`,"aria-current":n.id===t,onClick:()=>e.select(n.id),children:[`[ `,(0,L.jsx)(Lw,{status:n.rowStatus}),n.label||n.title,hz(n)?(0,L.jsx)(`span`,{className:`text-accent`,children:`✓`}):n.pr?.number?(0,L.jsx)(`span`,{children:`PR`}):null,` ]`]})]},n.id)),a&&!a.machine&&(0,L.jsx)(R,{hit:`tight`,className:`ml-auto flex-none whitespace-nowrap`,onClick:()=>void Gg(e,a),children:F(`compare.landBottom`)})]})}function vz(e,t){return e===`never`?!1:e!==`multipleOnly`||t>=2}function yz({taskId:e}){I();let t=As(e),n=_(Sn),r=js(e)&&!n;return(0,L.jsx)(`div`,{className:bN,children:$o.map(n=>{let i=r&&!!Lo(t,n);return(0,L.jsx)(`button`,{type:`button`,className:oN({on:i}),title:F(`panel.${n}`),"aria-label":F(`panel.${n}`),"aria-pressed":i,onClick:()=>Ps(e,n),children:(0,L.jsx)(ON,{children:kN[n]})},n)})})}function bz({model:e,task:t,tabs:n,narrow:r}){let i=_(e.selection),{prefs:a}=x_(),o=!vz(a.tabStrip,n.length);return(0,L.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,L.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=>$M(r,fn(Jk(e,t,n),F(`menu.more`))),children:[(0,L.jsx)(`span`,{className:`text-subtle group-aria-selected/tab:text-accent`,children:r+1}),Nu(n)]},n.id)),!r&&(0,L.jsx)(yz,{taskId:t.id})]})}function xz(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e))}function Sz({model:e}){let t=I()===`zh`?ri:ni,n=e.client,[r,i]=(0,h.useState)(()=>(J(n,`worktrees.list`,{network:!0})??J(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=>X(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&&H(xz(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`){B.set((0,L.jsx)(Or,{title:t.delete.forceTitle,body:`${xz(t.delete.forceBody,{branch:e.branch||e.path})}\n\n${xz(t.delete.forceReason,{reason:U(n)})}`,confirmLabel:t.delete.button,onConfirm:()=>_(e,!0)}));return}H(xz(t.delete.failed,{error:U(n)}),`error`)}},v=e=>B.set((0,L.jsx)(Or,{title:t.delete.confirmTitle,body:xz(t.delete.confirmBody,{branch:e.branch||e.path}),confirmLabel:t.delete.button,onConfirm:async()=>{_(e,!1)}})),y=n=>{if(!n.taskId){H(t.land.noTask,`error`);return}Gg(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(),V.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`)V.set(null);else return;e.preventDefault()},x=0;return(0,L.jsxs)(`div`,{className:Dy,tabIndex:0,ref:d,onKeyDown:b,children:[(0,L.jsx)(`h1`,{className:Oy,children:t.title}),r===null?(0,L.jsx)(`p`,{className:`text-muted`,children:t.loading}):f.length===0?(0,L.jsx)(`p`,{className:`text-muted`,children:t.noProjects}):f.map(e=>{let n=x;return x+=e.worktrees.length,(0,L.jsxs)(`section`,{className:my,children:[(0,L.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,L.jsx)(`span`,{children:e.repo}),(0,L.jsx)(`span`,{className:`rule`})]}),e.worktrees.length===0&&(0,L.jsx)(`p`,{className:`mono text-muted`,children:t.noWorktrees}),e.worktrees.map((e,r)=>{let i=n+r;return(0,L.jsxs)(`div`,{"data-row":i,className:hy(i===m),onClick:()=>c(i),children:[(0,L.jsxs)(`div`,{className:gy,children:[(0,L.jsx)(`span`,{className:vy,children:e.branch||t.row.detached}),e.roveManaged&&(0,L.jsx)(`span`,{className:`chip text-muted`,children:t.badge.roveManaged}),e.dirty===!0&&(0,L.jsx)(`span`,{className:`chip text-warning`,children:t.badge.dirty}),e.dirty===null&&(0,L.jsx)(`span`,{className:`chip text-muted`,children:t.badge.dirtyUnknown}),(0,L.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,L.jsx)(`span`,{className:`chip ${e.verdict===`merged`?`text-success`:e.verdict===`stale`?`text-warning`:`text-accent`}`,children:t.verdict[e.verdictReason]??e.verdictReason})]}),(0,L.jsxs)(`div`,{className:`${_y} mono text-muted`,children:[(0,L.jsx)(`span`,{className:yy,children:e.path}),e.createdAtMs>0&&(0,L.jsx)(`span`,{children:xz(t.row.created,{age:Ac(Date.now()-e.createdAtMs)})})]}),i===m&&(0,L.jsxs)(`div`,{className:`flex items-baseline gap-2 text-[length:var(--fs-body)]`,children:[(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>v(e),children:t.delete.button}),e.taskId&&(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>y(e),children:t.land.button})]})]},e.path)})]},e.repo)}),(0,L.jsx)(`p`,{className:`${by} mono keys-only text-muted`,children:(0,L.jsx)($d,{text:`j/k · d ${t.delete.button} · l ${t.land.button} · q/esc`})})]})}function Cz({model:e,narrow:t}){let n=_(e.selection),r=_(e.tabs),i=_(e.tasks),a=_(e.remote),o=a.find(e=>e.id===n.taskId&&!e.machine?.stale),s=pa(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=_(V),f=zb(s?.id),p=s?.rowStatus?.kind===`running`,m=_(Tn),g=_(es)!==`terminal`&&t&&!!s;return(0,h.useEffect)(()=>{let t=e.selection.get();return e.selection.subscribe(()=>{Tn.set(null);let n=e.selection.get();(n.taskId!==t.taskId||n.tabId!==t.tabId)&&es.set(`terminal`),t=n})},[e]),(0,h.useEffect)(()=>bC(e),[e]),d===`update`?(0,L.jsxs)(`main`,{className:`${Mt} ${Ye}`,children:[t&&(0,L.jsx)(GN,{}),(0,L.jsx)(eb,{client:e.client})]}):d===`worktrees`?(0,L.jsxs)(`main`,{className:`${Mt} ${Ye}`,children:[t&&(0,L.jsx)(GN,{}),(0,L.jsx)(Sz,{model:e})]}):d?(0,L.jsxs)(`main`,{className:`${Mt} ${Ye}`,children:[t&&(0,L.jsx)(GN,{}),(0,L.jsx)(YO,{model:e,page:d})]}):m?(0,L.jsxs)(`main`,{className:`${Mt} ${Ye}`,children:[t&&(0,L.jsx)(GN,{}),(0,L.jsx)(`div`,{className:Nt,children:(0,L.jsx)(Kh,{model:e,seed:m},Pm(m))})]}):(0,L.jsxs)(`main`,{className:`${Mt} ${Ye}`,children:[t&&(0,L.jsx)(GN,{taskId:s?.id}),s&&(0,L.jsx)(bz,{model:e,task:s,tabs:l,narrow:t}),s&&!s.groupId&&(0,L.jsx)(_z,{model:e,taskId:s.id}),s?.groupId&&(0,L.jsx)(AR,{model:e,taskId:s.id,groupId:s.groupId}),(0,L.jsxs)(`div`,{className:`${Nt} ${p?Pt:``}`,style:f?{"--task-ink":f}:void 0,children:[!t&&!s&&!c&&i&&i.tasks.length+a.length===0&&(0,L.jsx)(QM,{model:e}),!s&&!c&&i&&i.tasks.length+a.length>0&&(0,L.jsx)(`p`,{className:At,children:F(`workspace.pickTask`)}),c?.machine&&(0,L.jsx)(`div`,{className:jt,children:(0,L.jsx)(Gf,{host:c.machine.label,onMachines:()=>mg(e)})}),s&&u&&l.length===0&&!g&&(0,L.jsxs)(`div`,{className:jt,children:[(0,L.jsx)(`p`,{children:F(`workspace.noTabs`)}),(0,L.jsx)(R,{variant:`filled`,onClick:()=>void Yl(e,s.id,{kind:`engine`}).catch(e=>H(String(e),`error`)),children:s.engine?F(`workspace.startEngine`,{engine:s.engine.name}):F(`workspace.startSession`)}),` `,(0,L.jsx)(R,{variant:`filled`,onClick:()=>void Jl(e,s.id),children:F(`menu.newChat`)}),` `,(0,L.jsx)(R,{variant:`filled`,onClick:()=>B.set((0,L.jsx)(eu,{model:e,taskId:s.id})),children:F(`menu.newChatPick`)})]}),s&&g&&(0,L.jsx)(SR,{model:e,task:s,narrow:!0}),s&&n.tabId&&l.some(e=>e.id===n.tabId)&&(0,L.jsx)(`div`,{className:`min-w-0 flex-1 ${g?`hidden`:`flex`}`,children:(0,L.jsx)(dz,{model:e,taskId:s.id,tab:l.find(e=>e.id===n.tabId)??l[0]},`${s.id}::${n.tabId}`)})]})]})}function wz({model:e}){I();let t=_(e.client.conn);return t.hello===null&&t.failures>=2?(0,L.jsx)(Tz,{}):(0,L.jsx)(Ez,{model:e})}function Tz(){let[e,t]=(0,h.useState)(null);return(0,h.useEffect)(()=>{oo().then(t)},[]),e===null?null:e?(0,L.jsx)(uo,{}):(0,L.jsx)(dn,{failing:!0})}function Ez({model:e}){ZS(e);let t=_(e.client.conn).hello;(0,h.useEffect)(()=>{if(!t)return;ib(e.client,t.roveVersion);let n=()=>void Xy(e.client).then(OR);n();let r=window.setInterval(n,36e5);return()=>window.clearInterval(r)},[t,e.client]),td(e),Qu(e),Ha(),yi(e.client),oC(e),ji(e.client),lx(e.client),(0,h.useEffect)(()=>{e.onSelect=Ka;let t=Tn.subscribe(()=>{Tn.get()!==null&&Ka()});return On(),t},[e]),(0,h.useEffect)(()=>tS(e),[e]);let n=_(Sn),r=_(e.selection),i=_(e.tasks),a=_(e.remote),o=eo(),s=_(fA),c=_(pA),l=_(dA),u=_(Ga),d=_(rs),f=_(as),p=_(V),m=_(Fn)===`drag`,g=_(Tn)!==null,v=a.find(e=>e.id===r.taskId&&!e.machine?.stale),y=pa(i,r.taskId)??v??null,b=v?void 0:a.find(e=>e.id===r.taskId),x=js(y?.id??null),S=As(y?.id??``).columns.length,C=o?to(u,!!y||!!b,p!==null||g):null;(0,h.useEffect)(()=>e.setTaskShown(C===null||C===`content`&&p===null&&!g),[e,C,p,g]);let w=gA(l??280),T=s?0:w,E=d===null?ss(S,T):os(d,T),D={"--rail-w":`${s?0:w}px`,"--rail-open-w":`${w}px`,"--panel-w":E===null?void 0:`${E}px`};return(0,L.jsxs)(`div`,{className:Ke,children:[(0,L.jsx)(Ni,{onRefresh:()=>Mi(e.client)}),(0,L.jsxs)(`div`,{className:qe({zen:n||!x||!y&&!b||o||g,expanded:f&&!n&&!o,surface:C,folded:s&&!o,peek:s&&c&&!o,dragging:m}),style:o?void 0:D,children:[!o&&(0,L.jsx)(UN,{model:e}),s&&!o&&(0,L.jsx)(`div`,{className:`absolute inset-y-0 left-0 z-5 col-1 row-1 w-2.5`,title:F(`layout.railUnfold`),onMouseEnter:()=>hA(!0),onMouseLeave:()=>hA(!1),onMouseUp:()=>fA.set(!1)}),(0,L.jsx)(eN,{model:e,narrow:o}),(0,L.jsx)(Cz,{model:e,narrow:o}),!o&&(0,L.jsx)(SR,{model:e,task:y,remoteHost:b?.machine?.label}),(0,L.jsx)(wR,{model:e}),(0,L.jsx)(_o,{}),(0,L.jsx)(nC,{model:e}),(0,L.jsx)(_a,{model:e})]})]})}var Dz=`a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`;function Oz(e){return[...e.querySelectorAll(Dz)].filter(e=>e.tabIndex>=0&&e.offsetParent!==null)}function kz(){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=Oz(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 Az(e){if(!Mn())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 jz(e){for(let t of document.querySelectorAll(`${e}.is-leaving`))t.remove()}function Mz(){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 Nz(){let e=B.get(),t=-1/0;B.subscribe(()=>{let n=B.get();if(n===null&&e!==null)t=performance.now(),Az(`.overlay`);else if(n!==null){let n=e!==null||performance.now()-t<140;jz(`.overlay`),n&&requestAnimationFrame(Mz)}e=n});let n=mn.get();mn.subscribe(()=>{let e=mn.get();e===null&&n!==null?Az(`.menu`):e!==null&&jz(`.menu`),n=e});let r=ud.get().guide;ud.subscribe(()=>{let e=ud.get().guide;e===null&&r!==null?Az(`.prefix-guide`):e!==null&&jz(`.prefix-guide`),r=e})}var Pz=500,Fz=10,Iz=`input, textarea, select, [contenteditable], .xterm`,Lz=[`mousedown`,`mouseup`,`click`,`contextmenu`];function Rz(){let e=null,t=()=>{e&&window.clearTimeout(e.timer),e=null},n=()=>{let e=e=>{e.preventDefault(),e.stopPropagation()},t=()=>{for(let t of Lz)document.removeEventListener(t,e,!0);document.removeEventListener(`pointerdown`,t,!0),document.removeEventListener(`keydown`,t,!0)};for(let t of Lz)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(Iz))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())},Pz)};e=a},!0),document.addEventListener(`pointermove`,n=>{e&&Math.hypot(n.clientX-e.x,n.clientY-e.y)>Fz&&t()},!0),document.addEventListener(`pointerup`,t,!0),document.addEventListener(`pointercancel`,t,!0),document.addEventListener(`contextmenu`,t=>{e&&t.isTrusted&&(e.native=!0)},!0)}function zz(e,t){e.viewingExtras=()=>us({narrow:Qa(),panelOpen:is.get(),zen:Sn.get()});let n=()=>e.reportViewing();is.subscribe(n),Sn.subscribe(n),$a(n),t.on(`panel`,t=>{ls(t)&&Hs(t,e.selection.get().taskId)})}function Bz(e){let t=e;return!!t&&typeof t.promptId==`string`&&typeof t.title==`string`}function Vz({client:e,prompt:t}){let n=(I()===`zh`?Nr:Mr).prompt,[r,i]=(0,h.useState)(t.initial??``),a=(0,h.useRef)(!1),{busy:o,error:s,submit:c}=Er();return(0,h.useEffect)(()=>()=>{a.current||e.request(`ui.promptReply`,{promptId:t.promptId}).catch(()=>{})},[e,t.promptId]),(0,L.jsx)(Tr,{title:t.title,children:(0,L.jsxs)(`form`,{className:Yn,onSubmit:n=>{n.preventDefault(),c(async()=>{await e.request(`ui.promptReply`,{promptId:t.promptId,value:r}),a.current=!0})},children:[(0,L.jsx)(`input`,{className:ln,"aria-label":n.fieldLabel,autoFocus:!0,spellCheck:!1,value:r,placeholder:t.placeholder,onChange:e=>i(e.target.value)}),s&&(0,L.jsx)(`p`,{className:`text-error`,children:s}),(0,L.jsx)(Ar,{busy:o,submitLabel:n.submitLabel})]})})}function Hz(e,t){B.get()||B.set((0,L.jsx)(Vz,{client:e,prompt:t},t.promptId))}var Uz=900,Wz=new WeakMap;function Gz(e){e.setAttribute(`data-scrolling`,``),window.clearTimeout(Wz.get(e)),Wz.set(e,window.setTimeout(()=>e.removeAttribute(`data-scrolling`),Uz))}function Kz(){document.addEventListener(`scroll`,e=>{let t=e.target instanceof Element?e.target:document.scrollingElement;t&&Gz(t)},{capture:!0,passive:!0})}var qz=`rove-web.reloadedFor`;function Jz(e,t,n){return e===null?`adopt`:t===e||t===n?`stay`:`reload`}function Yz(){let e=null;try{e=window.sessionStorage}catch{}return{storage:e,reload:()=>window.location.reload()}}function Xz(e,t=Yz()){let n=null,r=null,i=()=>{try{return t.storage?.getItem(qz)??r}catch{return r}};return e.conn.subscribe(()=>{let{state:a,hello:o}=e.conn.get();if(a!==`open`||!o)return;let s=Jz(n,o.roveVersion,i());if(s===`adopt`&&(n=o.roveVersion),s===`reload`){r=o.roveVersion;try{t.storage?.setItem(qz,o.roveVersion)}catch{}t.reload()}})}function Zz(){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 Qz=(0,m.createRoot)(document.getElementById(`root`));Zz(),Rz(),Kz(),Nz(),kz(),TM();function $z(e){let t=new _d(vd(),e),n=new ha(t);t.on(`prompt`,e=>{Bz(e)&&Hz(t,e)}),zz(n,t),Xz(t),t.start(),Qz.render((0,L.jsx)(h.StrictMode,{children:(0,L.jsx)(wz,{model:n})}))}var eB=i();eB?$z(eB):Promise.all([K(),oo()]).then(([e,t])=>{e?$z(``):Qz.render((0,L.jsx)(h.StrictMode,{children:t?(0,L.jsx)(uo,{}):(0,L.jsx)(dn,{})}))});export{g_ as a,Bl as c,Rt as d,Bt as f,xb as i,xn as l,XR as n,Jd as o,JR as r,pd as s,Gz as t,Fn as u};
63
+ `)}\n${r}\n`}function az(e){let t=document.querySelector(`[data-composer="${CSS.escape(e)}"]`);return t&&t.offsetParent!==null?t:null}function oz(e,t,n,r){let i=iz(e.term.getSelection());if(i===null)return!1;let a=UR(t,n),o=az(a);if(o){qR(a,i),e.term.clearSelection();let t=o.querySelector(`textarea`);return t?.focus(),t?.setSelectionRange(t.value.length,t.value.length),!0}return r?(H(F(`quote.atMenu`),`error`),!1):e.term.modes.bracketedPasteMode?(e.term.paste(i),e.term.clearSelection(),e.term.focus(),!0):(H(F(`quote.notReady`),`error`),!1)}async function sz(e,t,n){for(let r of n){r.size>1048576&&H(F(`layout.dropUploading`,{name:r.name}));try{t.term.paste(`${await Gc(e,r)} `)}catch(e){H(e instanceof Error?e.message:String(e),`error`)}}t.term.focus()}async function cz(){if(!navigator.clipboard?.read)throw Error(F(`layout.pasteNeedsHttps`));let e=[];for(let t of await navigator.clipboard.read())for(let n of t.types)(n.startsWith(`image/`)||n===`application/pdf`)&&e.push(new File([await t.getType(n)],`clipboard`,{type:n}));return e}async function lz(e,t){let n;try{n=await cz()}catch(e){H(F(`layout.pasteNoAccess`,{error:e instanceof Error?e.message:String(e)}),`error`);return}n.length===0?H(F(`layout.pasteNoImage`),`error`):await sz(e,t,n)}async function uz(e){try{return await navigator.clipboard.writeText(e),!0}catch{return H(F(`menu.copyFailed`),`error`),!1}}function dz(e){let{client:t,taskId:n,tabId:r,leafId:i}=e,a=_(e.model.tasks)?.tasks.find(e=>e.id===n)?.tabStatus?.[r]?.kind===`needs-input`;I();let o=(0,h.useRef)(null),[s,c]=(0,h.useState)({kind:`none`}),[l,u]=(0,h.useState)(null),[d,f]=(0,h.useState)(0),[p,m]=(0,h.useState)({busy:!1,error:null}),g=(0,h.useRef)(e);g.current=e,Bh(t);let v=e.composer===!0&&Vh(t),y=(0,h.useRef)(v);y.current=v,(0,h.useEffect)(()=>{let e=o.current;if(!e)return;let a=null,s=!1,l=[document.fonts.load(`13px "JetBrains Mono"`),document.fonts.load(`bold 13px "JetBrains Mono"`)];document.fonts.load(`13px "${ez}"`,String.fromCodePoint(57504)).catch(()=>{});let d=()=>{s||Pd({client:t,host:e,taskId:n,tabId:r,leafId:i,focusOnMount:g.current.focused!==!1&&!y.current},{setNotice:c,onScrolled:f,onFocusChange:e=>{if(!a)return;let{stream:t}=a.handle;e?(g.current.onActivate?.(),Fa.set(La(t)??null)):Fa.get()?.stream===t&&Fa.set(null)},onExit:()=>{BR(Bl(n,r,i))||g.current.onExit?.()},copyText:uz,pasteImage:async()=>{a&&await lz(t,a.handle)}}).then(e=>{s?e.release():(a=e,u(e.handle))})};return Nd(t,n,r,i)?d():Promise.allSettled(l).then(d),()=>{s=!0,u(null),a?.release()}},[t,n,r,i]);let[b,x]=(0,h.useState)(!1);(0,h.useEffect)(()=>{if(!l)return;x(l.term.hasSelection());let e=l.term.onSelectionChange(()=>x(l.term.hasSelection()));return()=>{e.dispose(),x(!1)}},[l]),(0,h.useEffect)(()=>{if(!l)return;let{term:e,stream:a}=l,o={stream:a,focus:()=>e.focus(),input:t=>e.input(t,!0),reattach:()=>l.reattach(),scrollPages:e=>l.scrollLines(e*10),hasSelection:()=>e.hasSelection(),copySelection:()=>{let t=e.getSelection();return t.trim().length!==0&&(uz(t),e.clearSelection(),!0)},reset:()=>{let o={cols:e.cols,rows:e.rows};B.set((0,L.jsx)(Or,{title:yc(`reset.title`),body:yc(`reset.body`),confirmLabel:F(`workspace.reset`),onConfirm:async()=>{RR(a);try{await t.request(`tab.split`,{taskId:n,tabId:r,action:`reset`,leafId:i??`leaf-1`,...o}),await l.reattach(),e.focus()}finally{zR(a)}}}))},size:()=>({cols:e.cols,rows:e.rows})},s=Ia(o);return document.activeElement===e.textarea&&Fa.set(o),()=>{s()}},[l,t,n,r,i]),(0,h.useEffect)(()=>{e.focused&&!v&&l&&document.activeElement!==l.term.textarea&&l.term.focus()},[e.focused,v,l]);let S=!i||i===`leaf-1`,[C,w]=(0,h.useState)(null),T=e.engineExit?.since===C,[E,D]=(0,h.useState)(null),O=e.usageLimit&&e.usageLimit.since!==E?e.usageLimit:null,k=(0,h.useRef)(!1),ee=async(i,a)=>{if(!k.current){k.current=!0,m({busy:!0,error:null});try{await t.request(`term.revive`,{taskId:n,tabId:r,...a?{restartExited:a}:{}}),await i.reattach(),i.term.focus(),w(e.engineExit?.since??null),m({busy:!1,error:null})}catch(e){m({busy:!1,error:e instanceof Error?e.message:String(e)})}finally{k.current=!1}}};return(0,L.jsxs)(`div`,{className:Ft,"data-stream":Bl(n,r,i),onDragOver:e=>e.dataTransfer.types.includes(`Files`)&&e.preventDefault(),onDrop:e=>{!e.dataTransfer.files.length||!l||(e.preventDefault(),sz(t,l,Array.from(e.dataTransfer.files)))},onPasteCapture:e=>{if(!l)return;let n=Array.from(e.clipboardData.files);(n.length!==0||e.clipboardData.getData(`text/plain`)===``)&&(e.preventDefault(),e.stopPropagation(),n.length>0?sz(t,l,n):lz(t,l))},children:[(0,L.jsxs)(`div`,{className:It,children:[(0,L.jsx)(`div`,{className:Lt,ref:o}),(0,L.jsx)(rz,{notice:s,engineExit:T?null:e.engineExit??null,model:e.model,taskId:n,tabId:r,revive:p,onReopen:S&&l?e=>void ee(l,e):void 0,onRetryAttach:l?()=>void l.reattach():void 0,usageLimit:O!==null,onDismissLimit:O?()=>D(O.since):void 0}),b&&e.composer&&l&&(0,L.jsx)(R,{variant:`floating`,className:`absolute top-2.5 right-2.5 z-4`,title:F(`quote.title`),onClick:()=>oz(l,n,r,a),children:F(`quote.action`)}),d>0&&l&&(0,L.jsxs)(`div`,{className:`mono absolute right-2.5 bottom-2.5 z-4 flex gap-3 rounded-sm border-hairline border-line bg-inset px-2.5 py-1 text-meta`,children:[(0,L.jsx)(`span`,{className:`text-warning`,children:yc(`scrolledBack`,{lines:d})}),(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>l.scrollToTop(),children:yc(`scrollFirst`)}),(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>l.scrollToBottom(),children:yc(`scrollLatest`)})]})]}),e.composer&&(0,L.jsx)(XR,{model:e.model,taskId:n,tabId:r}),l&&(0,L.jsx)(QR,{handle:l,atMenu:a})]})}var fz=e=>Pk(e)!==null,pz=e=>Iu(Pk(e)?.tab.split);function mz(e){let t=Pk(e),n=t?.tab.split;return t&&n?{...t,split:n,leaf:jk(t.taskId,t.tab,n)}:null}Ea(()=>[{id:`workspace.split.right`,chords:[`ctrl+\\`],prefix:!1,surface:`workspace`,live:fz,run:e=>{let t=Pk(e);t&&Ik(e,t.taskId,t.tab,`right`)}},{id:`workspace.split.down`,chords:[`ctrl+=`],prefix:!1,surface:`workspace`,live:fz,run:e=>{let t=Pk(e);t&&Ik(e,t.taskId,t.tab,`down`)}},{id:`workspace.split.focus-next`,chords:[`f3`],prefix:!1,surface:`workspace`,live:pz,run:e=>{let t=mz(e);t&&Nk(t.taskId,t.tab,t.split,Ru(t.split,t.leaf))}},{id:`workspace.split.close`,chords:[`w`],prefix:!0,surface:`workspace`,live:pz,run:e=>{let t=mz(e);t&&Lk(e,t.taskId,t.tab,t.leaf)}},{id:`workspace.split.rename`,chords:[`f2`],prefix:!1,surface:`workspace`,live:pz,run:e=>{let t=mz(e);t&&Rk(e,t.taskId,t.tab,t.leaf)}}]);var hz=[{id:`leaf-1`,x:0,y:0,w:1,h:1,left:!1,top:!1}];function gz({model:e,taskId:t,tab:n}){let r=n.split;_(Ak);let i=r?jk(t,n,r):`leaf-1`,a=r?zu(r,Nu(n)):new Map,o=Iu(r),{prefs:s}=x_(),c=_(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,L.jsx)(`div`,{className:rt,children:(r?Lu(r.root):hz).map(c=>(0,L.jsxs)(`div`,{className:ot(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,L.jsx)(dz,{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&&Mk(t,n.id,r,c.id),onExit:()=>{o?Fk(e,{taskId:t,tabId:n.id,action:`close`,leafId:c.id}):n.kind!==`engine`&&e.closeTab(t,n.id).catch(()=>{})}}),o&&(0,L.jsx)(`span`,{className:st(s.splitStyle===`rule`,c.id===i),onContextMenu:r=>iN(r,Vk(e,t,n,c.id)),children:a.get(c.id)})]},c.id))})}var _z=/^[0-9a-f]{7,40}$/i;function vz(e,t){return t.sharesWorkspaceOf||!t.baseRef?null:e.find(e=>e.id!==t.id&&e.branch!==``&&e.branch===t.baseRef)||(_z.test(t.baseRef)&&t.parentTaskId?e.find(e=>e.id===t.parentTaskId)??null:null)}function yz(e,t){let n=[];for(let r=vz(e,t);r&&n.length<20&&!n.includes(r);r=vz(e,r))n.unshift(r);let r=e.filter(n=>!n.deleting&&vz(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&&!_z.test(i.baseRef)?i.baseRef:null;return{nodes:[...n,t,...r],at:n.length,base:a}}var bz=e=>e.pr?.lifecycle===`merged`;function xz(e){return e.nodes.find(e=>!bz(e))??null}function Sz({model:e,taskId:t}){I();let n=_(e.tasks)?.tasks??[],r=n.find(e=>e.id===t),i=r?yz(n,r):null;if(!i)return null;let a=xz(i);return(0,L.jsxs)(`nav`,{className:qw,"aria-label":F(`compare.stackLabel`),children:[i.base&&(0,L.jsxs)(`span`,{className:`text-subtle`,children:[i.base,` ←`]}),i.nodes.map((n,r)=>(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-x-3.5`,children:[r>0&&(0,L.jsx)(`span`,{className:`text-subtle`,children:`←`}),(0,L.jsxs)(R,{variant:`pill`,hit:`tight`,"aria-current":n.id===t,onClick:()=>e.select(n.id),children:[`[ `,(0,L.jsx)($b,{status:n.rowStatus}),n.label||n.title,bz(n)?(0,L.jsx)(`span`,{className:`text-accent`,children:`✓`}):n.pr?.number?(0,L.jsx)(`span`,{children:`PR`}):null,` ]`]})]},n.id)),a&&!a.machine&&(0,L.jsx)(R,{hit:`tight`,className:`ml-auto flex-none whitespace-nowrap`,onClick:()=>void Gg(e,a),children:F(`compare.landBottom`)})]})}function Cz(e,t){return e===`never`?!1:e!==`multipleOnly`||t>=2}function wz({taskId:e}){I();let t=As(e),n=_(Sn),r=js(e)&&!n;return(0,L.jsx)(`div`,{className:TN,children:$o.map(n=>{let i=r&&!!Lo(t,n);return(0,L.jsx)(`button`,{type:`button`,className:dN({on:i}),title:F(`panel.${n}`),"aria-label":F(`panel.${n}`),"aria-pressed":i,onClick:()=>Ps(e,n),children:(0,L.jsx)(NN,{children:PN[n]})},n)})})}function Tz({model:e,task:t,tabs:n,narrow:r}){let i=_(e.selection),{prefs:a}=x_(),o=!Cz(a.tabStrip,n.length);return(0,L.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,L.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=>iN(r,fn(nA(e,t,n),F(`menu.more`))),children:[(0,L.jsx)(`span`,{className:`text-subtle group-aria-selected/tab:text-accent`,children:r+1}),Nu(n)]},n.id)),!r&&(0,L.jsx)(wz,{taskId:t.id})]})}function Ez(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e))}function Dz({model:e}){let t=I()===`zh`?ri:ni,n=e.client,[r,i]=(0,h.useState)(()=>(J(n,`worktrees.list`,{network:!0})??J(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=>X(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&&H(Ez(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`){B.set((0,L.jsx)(Or,{title:t.delete.forceTitle,body:`${Ez(t.delete.forceBody,{branch:e.branch||e.path})}\n\n${Ez(t.delete.forceReason,{reason:U(n)})}`,confirmLabel:t.delete.button,onConfirm:()=>_(e,!0)}));return}H(Ez(t.delete.failed,{error:U(n)}),`error`)}},v=e=>B.set((0,L.jsx)(Or,{title:t.delete.confirmTitle,body:Ez(t.delete.confirmBody,{branch:e.branch||e.path}),confirmLabel:t.delete.button,onConfirm:async()=>{_(e,!1)}})),y=n=>{if(!n.taskId){H(t.land.noTask,`error`);return}Gg(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(),V.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`)V.set(null);else return;e.preventDefault()},x=0;return(0,L.jsxs)(`div`,{className:Ay,tabIndex:0,ref:d,onKeyDown:b,children:[(0,L.jsx)(`h1`,{className:jy,children:t.title}),r===null?(0,L.jsx)(`p`,{className:`text-muted`,children:t.loading}):f.length===0?(0,L.jsx)(`p`,{className:`text-muted`,children:t.noProjects}):f.map(e=>{let n=x;return x+=e.worktrees.length,(0,L.jsxs)(`section`,{className:_y,children:[(0,L.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,L.jsx)(`span`,{children:e.repo}),(0,L.jsx)(`span`,{className:`rule`})]}),e.worktrees.length===0&&(0,L.jsx)(`p`,{className:`mono text-muted`,children:t.noWorktrees}),e.worktrees.map((e,r)=>{let i=n+r;return(0,L.jsxs)(`div`,{"data-row":i,className:vy(i===m),onClick:()=>c(i),children:[(0,L.jsxs)(`div`,{className:yy,children:[(0,L.jsx)(`span`,{className:xy,children:e.branch||t.row.detached}),e.roveManaged&&(0,L.jsx)(`span`,{className:`chip text-muted`,children:t.badge.roveManaged}),e.dirty===!0&&(0,L.jsx)(`span`,{className:`chip text-warning`,children:t.badge.dirty}),e.dirty===null&&(0,L.jsx)(`span`,{className:`chip text-muted`,children:t.badge.dirtyUnknown}),(0,L.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,L.jsx)(`span`,{className:`chip ${e.verdict===`merged`?`text-success`:e.verdict===`stale`?`text-warning`:`text-accent`}`,children:t.verdict[e.verdictReason]??e.verdictReason})]}),(0,L.jsxs)(`div`,{className:`${by} mono text-muted`,children:[(0,L.jsx)(`span`,{className:Sy,children:e.path}),e.createdAtMs>0&&(0,L.jsx)(`span`,{children:Ez(t.row.created,{age:Ac(Date.now()-e.createdAtMs)})})]}),i===m&&(0,L.jsxs)(`div`,{className:`flex items-baseline gap-2 text-[length:var(--fs-body)]`,children:[(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>v(e),children:t.delete.button}),e.taskId&&(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>y(e),children:t.land.button})]})]},e.path)})]},e.repo)}),(0,L.jsx)(`p`,{className:`${Cy} mono keys-only text-muted`,children:(0,L.jsx)($d,{text:`j/k · d ${t.delete.button} · l ${t.land.button} · q/esc`})})]})}function Oz({model:e,narrow:t}){let n=_(e.selection),r=_(e.tabs),i=_(e.tasks),a=_(e.remote),o=a.find(e=>e.id===n.taskId&&!e.machine?.stale),s=pa(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=_(V),f=kx(s?.id),p=s?.rowStatus?.kind===`running`,m=_(Tn),g=_(es)!==`terminal`&&t&&!!s;return(0,h.useEffect)(()=>{let t=e.selection.get();return e.selection.subscribe(()=>{Tn.set(null);let n=e.selection.get();(n.taskId!==t.taskId||n.tabId!==t.tabId)&&es.set(`terminal`),t=n})},[e]),(0,h.useEffect)(()=>uw(e),[e]),d===`update`?(0,L.jsxs)(`main`,{className:`${Mt} ${Ye}`,children:[t&&(0,L.jsx)(XN,{}),(0,L.jsx)(rb,{client:e.client})]}):d===`worktrees`?(0,L.jsxs)(`main`,{className:`${Mt} ${Ye}`,children:[t&&(0,L.jsx)(XN,{}),(0,L.jsx)(Dz,{model:e})]}):d?(0,L.jsxs)(`main`,{className:`${Mt} ${Ye}`,children:[t&&(0,L.jsx)(XN,{}),(0,L.jsx)(rk,{model:e,page:d})]}):m?(0,L.jsxs)(`main`,{className:`${Mt} ${Ye}`,children:[t&&(0,L.jsx)(XN,{}),(0,L.jsx)(`div`,{className:Nt,children:(0,L.jsx)(Kh,{model:e,seed:m},Pm(m))})]}):(0,L.jsxs)(`main`,{className:`${Mt} ${Ye}`,children:[t&&(0,L.jsx)(XN,{taskId:s?.id}),s&&(0,L.jsx)(Tz,{model:e,task:s,tabs:l,narrow:t}),s&&!s.groupId&&(0,L.jsx)(Sz,{model:e,taskId:s.id}),s?.groupId&&(0,L.jsx)(FR,{model:e,taskId:s.id,groupId:s.groupId}),(0,L.jsxs)(`div`,{className:`${Nt} ${p?Pt:``}`,style:f?{"--task-ink":f}:void 0,children:[!t&&!s&&!c&&i&&i.tasks.length+a.length===0&&(0,L.jsx)(rN,{model:e}),!s&&!c&&i&&i.tasks.length+a.length>0&&(0,L.jsx)(`p`,{className:At,children:F(`workspace.pickTask`)}),c?.machine&&(0,L.jsx)(`div`,{className:jt,children:(0,L.jsx)(Gf,{host:c.machine.label,onMachines:()=>mg(e)})}),s&&u&&l.length===0&&!g&&(0,L.jsxs)(`div`,{className:jt,children:[(0,L.jsx)(`p`,{children:F(`workspace.noTabs`)}),(0,L.jsx)(R,{variant:`filled`,onClick:()=>void Yl(e,s.id,{kind:`engine`}).catch(e=>H(String(e),`error`)),children:s.engine?F(`workspace.startEngine`,{engine:s.engine.name}):F(`workspace.startSession`)}),` `,(0,L.jsx)(R,{variant:`filled`,onClick:()=>void Jl(e,s.id),children:F(`menu.newChat`)}),` `,(0,L.jsx)(R,{variant:`filled`,onClick:()=>B.set((0,L.jsx)(eu,{model:e,taskId:s.id})),children:F(`menu.newChatPick`)})]}),s&&g&&(0,L.jsx)(DR,{model:e,task:s,narrow:!0}),s&&n.tabId&&l.some(e=>e.id===n.tabId)&&(0,L.jsx)(`div`,{className:`min-w-0 flex-1 ${g?`hidden`:`flex`}`,children:(0,L.jsx)(gz,{model:e,taskId:s.id,tab:l.find(e=>e.id===n.tabId)??l[0]},`${s.id}::${n.tabId}`)})]})]})}function kz({model:e}){I();let t=_(e.client.conn);return t.hello===null&&t.failures>=2?(0,L.jsx)(Az,{}):(0,L.jsx)(jz,{model:e})}function Az(){let[e,t]=(0,h.useState)(null);return(0,h.useEffect)(()=>{oo().then(t)},[]),e===null?null:e?(0,L.jsx)(uo,{}):(0,L.jsx)(dn,{failing:!0})}function jz({model:e}){VC(e);let t=_(e.client.conn).hello;(0,h.useEffect)(()=>{if(!t)return;sb(e.client,t.roveVersion);let n=()=>void $y(e.client).then(NR);n();let r=window.setInterval(n,36e5);return()=>window.clearInterval(r)},[t,e.client]),td(e),Qu(e),Ha(),yi(e.client),XC(e),ji(e.client),$x(e.client),(0,h.useEffect)(()=>{e.onSelect=Ka;let t=Tn.subscribe(()=>{Tn.get()!==null&&Ka()});return On(),t},[e]),(0,h.useEffect)(()=>GS(e),[e]);let n=_(Sn),r=_(e.selection),i=_(e.tasks),a=_(e.remote),o=eo(),s=_(bA),c=_(xA),l=_(yA),u=_(Ga),d=_(rs),f=_(as),p=_(V),m=_(Fn)===`drag`,g=_(Tn)!==null,v=a.find(e=>e.id===r.taskId&&!e.machine?.stale),y=pa(i,r.taskId)??v??null,b=v?void 0:a.find(e=>e.id===r.taskId),x=js(y?.id??null),S=As(y?.id??``).columns.length,C=o?to(u,!!y||!!b,p!==null||g):null;(0,h.useEffect)(()=>e.setTaskShown(C===null||C===`content`&&p===null&&!g),[e,C,p,g]);let w=wA(l??280),T=s?0:w,E=d===null?ss(S,T):os(d,T),D={"--rail-w":`${s?0:w}px`,"--rail-open-w":`${w}px`,"--panel-w":E===null?void 0:`${E}px`};return(0,L.jsxs)(`div`,{className:Ke,children:[(0,L.jsx)(Ni,{onRefresh:()=>Mi(e.client)}),(0,L.jsxs)(`div`,{className:qe({zen:n||!x||!y&&!b||o||g,expanded:f&&!n&&!o,surface:C,folded:s&&!o,peek:s&&c&&!o,dragging:m}),style:o?void 0:D,children:[!o&&(0,L.jsx)(JN,{model:e}),s&&!o&&(0,L.jsx)(`div`,{className:`absolute inset-y-0 left-0 z-5 col-1 row-1 w-2.5`,title:F(`layout.railUnfold`),onMouseEnter:()=>CA(!0),onMouseLeave:()=>CA(!1),onMouseUp:()=>bA.set(!1)}),(0,L.jsx)(aN,{model:e,narrow:o}),(0,L.jsx)(Oz,{model:e,narrow:o}),!o&&(0,L.jsx)(DR,{model:e,task:y,remoteHost:b?.machine?.label}),(0,L.jsx)(kR,{model:e}),(0,L.jsx)(_o,{}),(0,L.jsx)(KC,{model:e}),(0,L.jsx)(_a,{model:e})]})]})}var Mz=`a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`;function Nz(e){return[...e.querySelectorAll(Mz)].filter(e=>e.tabIndex>=0&&e.offsetParent!==null)}function Pz(){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=Nz(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 Fz(e){if(!Mn())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 Iz(e){for(let t of document.querySelectorAll(`${e}.is-leaving`))t.remove()}function Lz(){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 Rz(){let e=B.get(),t=-1/0;B.subscribe(()=>{let n=B.get();if(n===null&&e!==null)t=performance.now(),Fz(`.overlay`);else if(n!==null){let n=e!==null||performance.now()-t<140;Iz(`.overlay`),n&&requestAnimationFrame(Lz)}e=n});let n=mn.get();mn.subscribe(()=>{let e=mn.get();e===null&&n!==null?Fz(`.menu`):e!==null&&Iz(`.menu`),n=e});let r=ud.get().guide;ud.subscribe(()=>{let e=ud.get().guide;e===null&&r!==null?Fz(`.prefix-guide`):e!==null&&Iz(`.prefix-guide`),r=e})}var zz=500,Bz=10,Vz=`input, textarea, select, [contenteditable], .xterm`,Hz=[`mousedown`,`mouseup`,`click`,`contextmenu`];function Uz(){let e=null,t=()=>{e&&window.clearTimeout(e.timer),e=null},n=()=>{let e=e=>{e.preventDefault(),e.stopPropagation()},t=()=>{for(let t of Hz)document.removeEventListener(t,e,!0);document.removeEventListener(`pointerdown`,t,!0),document.removeEventListener(`keydown`,t,!0)};for(let t of Hz)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(Vz))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())},zz)};e=a},!0),document.addEventListener(`pointermove`,n=>{e&&Math.hypot(n.clientX-e.x,n.clientY-e.y)>Bz&&t()},!0),document.addEventListener(`pointerup`,t,!0),document.addEventListener(`pointercancel`,t,!0),document.addEventListener(`contextmenu`,t=>{e&&t.isTrusted&&(e.native=!0)},!0)}function Wz(e,t){e.viewingExtras=()=>us({narrow:Qa(),panelOpen:is.get(),zen:Sn.get()});let n=()=>e.reportViewing();is.subscribe(n),Sn.subscribe(n),$a(n),t.on(`panel`,t=>{ls(t)&&Hs(t,e.selection.get().taskId)})}function Gz(e){let t=e;return!!t&&typeof t.promptId==`string`&&typeof t.title==`string`}function Kz({client:e,prompt:t}){let n=(I()===`zh`?Nr:Mr).prompt,[r,i]=(0,h.useState)(t.initial??``),a=(0,h.useRef)(!1),{busy:o,error:s,submit:c}=Er();return(0,h.useEffect)(()=>()=>{a.current||e.request(`ui.promptReply`,{promptId:t.promptId}).catch(()=>{})},[e,t.promptId]),(0,L.jsx)(Tr,{title:t.title,children:(0,L.jsxs)(`form`,{className:Yn,onSubmit:n=>{n.preventDefault(),c(async()=>{await e.request(`ui.promptReply`,{promptId:t.promptId,value:r}),a.current=!0})},children:[(0,L.jsx)(`input`,{className:ln,"aria-label":n.fieldLabel,autoFocus:!0,spellCheck:!1,value:r,placeholder:t.placeholder,onChange:e=>i(e.target.value)}),s&&(0,L.jsx)(`p`,{className:`text-error`,children:s}),(0,L.jsx)(Ar,{busy:o,submitLabel:n.submitLabel})]})})}function qz(e,t){B.get()||B.set((0,L.jsx)(Kz,{client:e,prompt:t},t.promptId))}var Jz=900,Yz=new WeakMap;function Xz(e){e.setAttribute(`data-scrolling`,``),window.clearTimeout(Yz.get(e)),Yz.set(e,window.setTimeout(()=>e.removeAttribute(`data-scrolling`),Jz))}function Zz(){document.addEventListener(`scroll`,e=>{let t=e.target instanceof Element?e.target:document.scrollingElement;t&&Xz(t)},{capture:!0,passive:!0})}var Qz=`rove-web.reloadedFor`;function $z(e,t,n){return e===null?`adopt`:t===e||t===n?`stay`:`reload`}function eB(){let e=null;try{e=window.sessionStorage}catch{}return{storage:e,reload:()=>window.location.reload()}}function tB(e,t=eB()){let n=null,r=null,i=()=>{try{return t.storage?.getItem(Qz)??r}catch{return r}};return e.conn.subscribe(()=>{let{state:a,hello:o}=e.conn.get();if(a!==`open`||!o)return;let s=$z(n,o.roveVersion,i());if(s===`adopt`&&(n=o.roveVersion),s===`reload`){r=o.roveVersion;try{t.storage?.setItem(Qz,o.roveVersion)}catch{}t.reload()}})}function nB(){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 rB=(0,m.createRoot)(document.getElementById(`root`));nB(),Uz(),Zz(),Rz(),Pz(),NM();function iB(e){let t=new _d(vd(),e),n=new ha(t);t.on(`prompt`,e=>{Gz(e)&&qz(t,e)}),Wz(n,t),tB(t),t.start(),rB.render((0,L.jsx)(h.StrictMode,{children:(0,L.jsx)(kz,{model:n})}))}var aB=i();aB?iB(aB):Promise.all([K(),oo()]).then(([e,t])=>{e?iB(``):rB.render((0,L.jsx)(h.StrictMode,{children:t?(0,L.jsx)(uo,{}):(0,L.jsx)(dn,{})}))});export{g_ as a,Bl as c,Rt as d,Bt as f,hx as i,xn as l,tz as n,Jd as o,$R as r,pd as s,Xz as t,Fn as u};